From: Andrea Amorese Date: Wed, 8 Sep 2021 08:31:18 +0000 (+0200) Subject: Built motion from commit 614202e9.|2.5.345 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;/%22card-image.png//%27?a=commitdiff_plain;h=2fe523688a96b40b788fc63eb71917765d60a7f0;p=motion2.git Built motion from commit 614202e9.|2.5.345 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index f50588e..b48b46f 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-08T08:18:04.787Z", + "time": "2021-09-08T08:25:44.486Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 343655e..9013586 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-08T08:18:04.787Z", + "time": "2021-09-08T08:25:44.486Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index df0992e..cbd5523 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 _0x90b1=['contactManager','integration','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','action','STRING'];(function(_0x1584ad,_0x218442){var _0x5524a8=function(_0x5c3833){while(--_0x5c3833){_0x1584ad['push'](_0x1584ad['shift']());}};_0x5524a8(++_0x218442);}(_0x90b1,0x1bb));var _0x190b=function(_0x53e787,_0x4298e6){_0x53e787=_0x53e787-0x0;var _0x2781a0=_0x90b1[_0x53e787];return _0x2781a0;};'use strict';var Sequelize=require(_0x190b('0x0'));module[_0x190b('0x1')]={'name':{'type':Sequelize[_0x190b('0x2')],'get':function(_0x55cd11){return this['getDataValue'](_0x190b('0x3'));}},'action':{'type':Sequelize[_0x190b('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x190b('0x5'),_0x190b('0x6'),'motionbar','jscripty','urlForward','browser',_0x190b('0x7'),_0x190b('0x8')]],'msg':_0x190b('0x9')}},'comment':_0x190b('0x9')},'data1':{'type':Sequelize[_0x190b('0x4')](0x1000),'comment':_0x190b('0xa')},'data2':{'type':Sequelize[_0x190b('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x190b('0x4')](0x1000),'comment':_0x190b('0xb')},'data4':{'type':Sequelize[_0x190b('0x4')](0x1000),'comments':_0x190b('0xc')},'data5':{'type':Sequelize[_0x190b('0x4')](0x1000),'comments':_0x190b('0xd')},'data6':{'type':Sequelize[_0x190b('0x4')],'comments':_0x190b('0xe')},'data7':{'type':Sequelize['TEXT'],'comments':_0x190b('0xf')}}; \ No newline at end of file +var _0x3f8a=['jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x467df4,_0x24b22f){var _0x38f096=function(_0x4c9502){while(--_0x4c9502){_0x467df4['push'](_0x467df4['shift']());}};_0x38f096(++_0x24b22f);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3fe92d,_0x963233){_0x3fe92d=_0x3fe92d-0x0;var _0xc3fca7=_0x3f8a[_0x3fe92d];return _0xc3fca7;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'get':function(_0x23c224){return this['getDataValue'](_0xa3f8('0x3'));}},'action':{'type':Sequelize[_0xa3f8('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xa3f8('0x5'),_0xa3f8('0x6'),_0xa3f8('0x7'),_0xa3f8('0x8'),_0xa3f8('0x9'),_0xa3f8('0xa'),_0xa3f8('0xb'),_0xa3f8('0xc')]],'msg':_0xa3f8('0xd')}},'comment':_0xa3f8('0xd')},'data1':{'type':Sequelize[_0xa3f8('0x4')](0x1000),'comment':_0xa3f8('0xe')},'data2':{'type':Sequelize[_0xa3f8('0x4')](0x1000),'comment':_0xa3f8('0xf')},'data3':{'type':Sequelize[_0xa3f8('0x4')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0xa3f8('0x4')](0x1000),'comments':_0xa3f8('0x10')},'data5':{'type':Sequelize[_0xa3f8('0x4')](0x1000),'comments':_0xa3f8('0x11')},'data6':{'type':Sequelize['STRING'],'comments':_0xa3f8('0x12')},'data7':{'type':Sequelize[_0xa3f8('0x13')],'comments':_0xa3f8('0x14')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index b7d55ab..5f4b536 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 _0x5912=['set','Content-Range','apply','reject','save','update','destroy','error','name','send','body','find','Action','then','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','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','end','undefined','limit','count','offset'];(function(_0x23eb8c,_0x5618e8){var _0x4978ba=function(_0x1512ed){while(--_0x1512ed){_0x23eb8c['push'](_0x23eb8c['shift']());}};_0x4978ba(++_0x5618e8);}(_0x5912,0x9e));var _0x2591=function(_0x1fd6fa,_0x1128fd){_0x1fd6fa=_0x1fd6fa-0x0;var _0x31cc4c=_0x5912[_0x1fd6fa];return _0x31cc4c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2591('0x0'));var zipdir=require(_0x2591('0x1'));var jsonpatch=require(_0x2591('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2591('0x3'));var Mustache=require(_0x2591('0x4'));var util=require(_0x2591('0x5'));var path=require('path');var sox=require(_0x2591('0x6'));var csv=require('to-csv');var ejs=require(_0x2591('0x7'));var fs=require('fs');var fs_extra=require(_0x2591('0x8'));var _=require('lodash');var squel=require(_0x2591('0x9'));var crypto=require(_0x2591('0xa'));var jsforce=require(_0x2591('0xb'));var deskjs=require(_0x2591('0xc'));var toCsv=require(_0x2591('0xd'));var querystring=require(_0x2591('0xe'));var Papa=require(_0x2591('0xf'));var Redis=require(_0x2591('0x10'));var authService=require(_0x2591('0x11'));var qs=require(_0x2591('0x12'));var as=require(_0x2591('0x13'));var hardwareService=require(_0x2591('0x14'));var logger=require(_0x2591('0x15'))(_0x2591('0x16'));var utils=require(_0x2591('0x17'));var config=require(_0x2591('0x18'));var licenseUtil=require(_0x2591('0x19'));var db=require(_0x2591('0x1a'))['db'];function respondWithStatusCode(_0x162358,_0x139739){_0x139739=_0x139739||0xcc;return function(_0xd9a4c0){if(_0xd9a4c0){return _0x162358[_0x2591('0x1b')](_0x139739);}return _0x162358[_0x2591('0x1c')](_0x139739)[_0x2591('0x1d')]();};}function respondWithResult(_0xa77e56,_0x394f7a){_0x394f7a=_0x394f7a||0xc8;return function(_0x31553d){if(_0x31553d){return _0xa77e56[_0x2591('0x1c')](_0x394f7a)['json'](_0x31553d);}};}function respondWithFilteredResult(_0xeaf9fb,_0x56c1e9){return function(_0x65c8de){if(_0x65c8de){var _0x14f9b0=typeof _0x56c1e9['offset']===_0x2591('0x1e')&&typeof _0x56c1e9[_0x2591('0x1f')]===_0x2591('0x1e');var _0x3ccfe2=_0x65c8de[_0x2591('0x20')];var _0xd08b81=_0x14f9b0?0x0:_0x56c1e9[_0x2591('0x21')];var _0x370c28=_0x14f9b0?_0x65c8de[_0x2591('0x20')]:_0x56c1e9[_0x2591('0x21')]+_0x56c1e9[_0x2591('0x1f')];var _0x2d4bce;if(_0x370c28>=_0x3ccfe2){_0x370c28=_0x3ccfe2;_0x2d4bce=0xc8;}else{_0x2d4bce=0xce;}_0xeaf9fb['status'](_0x2d4bce);return _0xeaf9fb[_0x2591('0x22')](_0x2591('0x23'),_0xd08b81+'-'+_0x370c28+'/'+_0x3ccfe2)['json'](_0x65c8de);}return null;};}function patchUpdates(_0x5b17d1){return function(_0x7f62fc){try{jsonpatch[_0x2591('0x24')](_0x7f62fc,_0x5b17d1,!![]);}catch(_0x25eacf){return BPromise[_0x2591('0x25')](_0x25eacf);}return _0x7f62fc[_0x2591('0x26')]();};}function saveUpdates(_0x5bb717,_0xd4cbc5){return function(_0x25fea1){if(_0x25fea1){return _0x25fea1[_0x2591('0x27')](_0x5bb717)['then'](function(_0x4a6837){return _0x4a6837;});}return null;};}function removeEntity(_0x302491,_0x4b31c7){return function(_0x55bbfa){if(_0x55bbfa){return _0x55bbfa[_0x2591('0x28')]()['then'](function(){_0x302491[_0x2591('0x1c')](0xcc)[_0x2591('0x1d')]();});}};}function handleEntityNotFound(_0x480ddd,_0x17b862){return function(_0x167a34){if(!_0x167a34){_0x480ddd['sendStatus'](0x194);}return _0x167a34;};}function handleError(_0x5dc1a4,_0x27635c){_0x27635c=_0x27635c||0x1f4;return function(_0x294f54){logger[_0x2591('0x29')](_0x294f54['stack']);if(_0x294f54['name']){delete _0x294f54[_0x2591('0x2a')];}_0x5dc1a4[_0x2591('0x1c')](_0x27635c)[_0x2591('0x2b')](_0x294f54);};}exports[_0x2591('0x27')]=function(_0x4510a0,_0x46470c){if(_0x4510a0[_0x2591('0x2c')]['id']){delete _0x4510a0[_0x2591('0x2c')]['id'];}return db['Action'][_0x2591('0x2d')]({'where':{'id':_0x4510a0['params']['id']}})['then'](handleEntityNotFound(_0x46470c,null))['then'](saveUpdates(_0x4510a0[_0x2591('0x2c')],null))['then'](respondWithResult(_0x46470c,null))['catch'](handleError(_0x46470c,null));};exports[_0x2591('0x28')]=function(_0x4f8ad2,_0x1af139){return db[_0x2591('0x2e')][_0x2591('0x2d')]({'where':{'id':_0x4f8ad2['params']['id']}})['then'](handleEntityNotFound(_0x1af139,null))[_0x2591('0x2f')](removeEntity(_0x1af139,null))['catch'](handleError(_0x1af139,null));}; \ No newline at end of file +var _0xbbf2=['count','offset','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','body','Action','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit'];(function(_0x44b8dd,_0x2558dc){var _0x2317b8=function(_0x2401ee){while(--_0x2401ee){_0x44b8dd['push'](_0x44b8dd['shift']());}};_0x2317b8(++_0x2558dc);}(_0xbbf2,0xf4));var _0x2bbf=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0xbbf2[_0x54b283];return _0x2462b3;};'use strict';var emlformat=require(_0x2bbf('0x0'));var rimraf=require(_0x2bbf('0x1'));var zipdir=require(_0x2bbf('0x2'));var jsonpatch=require(_0x2bbf('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2bbf('0x4'));var Mustache=require(_0x2bbf('0x5'));var util=require(_0x2bbf('0x6'));var path=require(_0x2bbf('0x7'));var sox=require('sox');var csv=require(_0x2bbf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2bbf('0x9'));var _=require(_0x2bbf('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2bbf('0xb'));var deskjs=require(_0x2bbf('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2bbf('0xd'));var Papa=require(_0x2bbf('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2bbf('0xf'));var as=require(_0x2bbf('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2bbf('0x11'));var utils=require(_0x2bbf('0x12'));var config=require(_0x2bbf('0x13'));var licenseUtil=require(_0x2bbf('0x14'));var db=require(_0x2bbf('0x15'))['db'];function respondWithStatusCode(_0x4eafee,_0x309eb8){_0x309eb8=_0x309eb8||0xcc;return function(_0x53a851){if(_0x53a851){return _0x4eafee['sendStatus'](_0x309eb8);}return _0x4eafee['status'](_0x309eb8)['end']();};}function respondWithResult(_0x2bd1da,_0x1fb46b){_0x1fb46b=_0x1fb46b||0xc8;return function(_0xa810dd){if(_0xa810dd){return _0x2bd1da[_0x2bbf('0x16')](_0x1fb46b)[_0x2bbf('0x17')](_0xa810dd);}};}function respondWithFilteredResult(_0x11c124,_0x1027be){return function(_0x82fefb){if(_0x82fefb){var _0x16730e=typeof _0x1027be['offset']===_0x2bbf('0x18')&&typeof _0x1027be[_0x2bbf('0x19')]===_0x2bbf('0x18');var _0x374eb5=_0x82fefb[_0x2bbf('0x1a')];var _0x4f8637=_0x16730e?0x0:_0x1027be[_0x2bbf('0x1b')];var _0x327fdb=_0x16730e?_0x82fefb[_0x2bbf('0x1a')]:_0x1027be['offset']+_0x1027be[_0x2bbf('0x19')];var _0x35affe;if(_0x327fdb>=_0x374eb5){_0x327fdb=_0x374eb5;_0x35affe=0xc8;}else{_0x35affe=0xce;}_0x11c124[_0x2bbf('0x16')](_0x35affe);return _0x11c124[_0x2bbf('0x1c')](_0x2bbf('0x1d'),_0x4f8637+'-'+_0x327fdb+'/'+_0x374eb5)[_0x2bbf('0x17')](_0x82fefb);}return null;};}function patchUpdates(_0x656873){return function(_0x214d04){try{jsonpatch['apply'](_0x214d04,_0x656873,!![]);}catch(_0x222231){return BPromise[_0x2bbf('0x1e')](_0x222231);}return _0x214d04[_0x2bbf('0x1f')]();};}function saveUpdates(_0x1b6a08,_0x11628a){return function(_0x302d47){if(_0x302d47){return _0x302d47[_0x2bbf('0x20')](_0x1b6a08)[_0x2bbf('0x21')](function(_0x55ce7b){return _0x55ce7b;});}return null;};}function removeEntity(_0x2f72f8,_0xbff673){return function(_0xa3b8de){if(_0xa3b8de){return _0xa3b8de[_0x2bbf('0x22')]()[_0x2bbf('0x21')](function(){_0x2f72f8[_0x2bbf('0x16')](0xcc)[_0x2bbf('0x23')]();});}};}function handleEntityNotFound(_0x3b4a44,_0x19a13f){return function(_0x172fa6){if(!_0x172fa6){_0x3b4a44[_0x2bbf('0x24')](0x194);}return _0x172fa6;};}function handleError(_0x1338db,_0xac4ab8){_0xac4ab8=_0xac4ab8||0x1f4;return function(_0x260a08){logger[_0x2bbf('0x25')](_0x260a08[_0x2bbf('0x26')]);if(_0x260a08[_0x2bbf('0x27')]){delete _0x260a08[_0x2bbf('0x27')];}_0x1338db[_0x2bbf('0x16')](_0xac4ab8)[_0x2bbf('0x28')](_0x260a08);};}exports['update']=function(_0x2aa3ce,_0x56285a){if(_0x2aa3ce[_0x2bbf('0x29')]['id']){delete _0x2aa3ce[_0x2bbf('0x29')]['id'];}return db[_0x2bbf('0x2a')]['find']({'where':{'id':_0x2aa3ce['params']['id']}})[_0x2bbf('0x21')](handleEntityNotFound(_0x56285a,null))['then'](saveUpdates(_0x2aa3ce[_0x2bbf('0x29')],null))[_0x2bbf('0x21')](respondWithResult(_0x56285a,null))[_0x2bbf('0x2b')](handleError(_0x56285a,null));};exports[_0x2bbf('0x22')]=function(_0x230940,_0x321a3e){return db[_0x2bbf('0x2a')][_0x2bbf('0x2c')]({'where':{'id':_0x230940['params']['id']}})[_0x2bbf('0x21')](handleEntityNotFound(_0x321a3e,null))['then'](removeEntity(_0x321a3e,null))[_0x2bbf('0x2b')](handleError(_0x321a3e,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index c497803..82a6151 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 _0x2868=['path','../../config/environment','./action.attributes','define','Action','lodash','../../config/logger','api','bluebird'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x2868,0x191));var _0x8286=function(_0x50be91,_0x35ae41){_0x50be91=_0x50be91-0x0;var _0x559974=_0x2868[_0x50be91];return _0x559974;};'use strict';var _=require(_0x8286('0x0'));var util=require('util');var logger=require(_0x8286('0x1'))(_0x8286('0x2'));var moment=require('moment');var BPromise=require(_0x8286('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8286('0x4'));var rimraf=require('rimraf');var config=require(_0x8286('0x5'));var attributes=require(_0x8286('0x6'));module['exports']=function(_0xa1b0f9,_0x9a8dcd){return _0xa1b0f9[_0x8286('0x7')](_0x8286('0x8'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d75=['tools_actions','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./action.attributes','exports','Action'];(function(_0x32cecf,_0x113e22){var _0x6da45e=function(_0x500633){while(--_0x500633){_0x32cecf['push'](_0x32cecf['shift']());}};_0x6da45e(++_0x113e22);}(_0x8d75,0x6d));var _0x58d7=function(_0x53e609,_0x4754bc){_0x53e609=_0x53e609-0x0;var _0x51ded9=_0x8d75[_0x53e609];return _0x51ded9;};'use strict';var _=require(_0x58d7('0x0'));var util=require(_0x58d7('0x1'));var logger=require(_0x58d7('0x2'))(_0x58d7('0x3'));var moment=require(_0x58d7('0x4'));var BPromise=require(_0x58d7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x58d7('0x6'));var config=require(_0x58d7('0x7'));var attributes=require(_0x58d7('0x8'));module[_0x58d7('0x9')]=function(_0xd008a7,_0x48ded1){return _0xd008a7['define'](_0x58d7('0xa'),attributes,{'tableName':_0x58d7('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 e4890c9..b853803 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x53ec,0x192));var _0xc53e=function(_0x41cf29,_0x216a99){_0x41cf29=_0x41cf29-0x0;var _0x566462=_0x53ec[_0x41cf29];return _0x566462;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x5076ab,_0x3c8625){var _0x15088c=function(_0x2b9a6d){while(--_0x2b9a6d){_0x5076ab['push'](_0x5076ab['shift']());}};_0x15088c(++_0x3c8625);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 83b9918..2ce97a7 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 _0xa21b=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x3cb656,_0xaa47b4){var _0x290763=function(_0x7aa613){while(--_0x7aa613){_0x3cb656['push'](_0x3cb656['shift']());}};_0x290763(++_0xaa47b4);}(_0xa21b,0xd2));var _0xba21=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0xa21b[_0x38b14f];return _0x22a324;};'use strict';var multer=require(_0xba21('0x0'));var util=require(_0xba21('0x1'));var path=require(_0xba21('0x2'));var timeout=require('connect-timeout');var express=require(_0xba21('0x3'));var router=express[_0xba21('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xba21('0x5'));var interaction=require(_0xba21('0x6'));var config=require(_0xba21('0x7'));var controller=require('./action.controller');router[_0xba21('0x8')](_0xba21('0x9'),auth[_0xba21('0xa')](),controller[_0xba21('0xb')]);router[_0xba21('0xc')](_0xba21('0x9'),auth[_0xba21('0xa')](),controller[_0xba21('0xd')]);module[_0xba21('0xe')]=router; \ No newline at end of file +var _0x59b8=['fs-extra','../../components/auth/service','../../config/environment','put','/:id','isAuthenticated','delete','destroy','multer','path','connect-timeout','express'];(function(_0x58e665,_0x26b3ca){var _0xf5655a=function(_0x32a3c3){while(--_0x32a3c3){_0x58e665['push'](_0x58e665['shift']());}};_0xf5655a(++_0x26b3ca);}(_0x59b8,0x8c));var _0x859b=function(_0x5aef45,_0x35e9f3){_0x5aef45=_0x5aef45-0x0;var _0x27d2cc=_0x59b8[_0x5aef45];return _0x27d2cc;};'use strict';var multer=require(_0x859b('0x0'));var util=require('util');var path=require(_0x859b('0x1'));var timeout=require(_0x859b('0x2'));var express=require(_0x859b('0x3'));var router=express['Router']();var fs_extra=require(_0x859b('0x4'));var auth=require(_0x859b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x859b('0x6'));var controller=require('./action.controller');router[_0x859b('0x7')](_0x859b('0x8'),auth[_0x859b('0x9')](),controller['update']);router[_0x859b('0xa')](_0x859b('0x8'),auth[_0x859b('0x9')](),controller[_0x859b('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 9bf5f1a..7a9ef60 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 _0x7da7=['TEXT','sequelize','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7da7,0x10d));var _0x77da=function(_0x4ee9cd,_0xd375b0){_0x4ee9cd=_0x4ee9cd-0x0;var _0x328a5b=_0x7da7[_0x4ee9cd];return _0x328a5b;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'name':{'type':Sequelize[_0x77da('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x77da('0x2')]},'conditions':{'type':Sequelize[_0x77da('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','TEXT'];(function(_0x8765f5,_0x4aeecd){var _0x581aff=function(_0x1733bc){while(--_0x1733bc){_0x8765f5['push'](_0x8765f5['shift']());}};_0x581aff(++_0x4aeecd);}(_0x5fc3,0xa8));var _0x35fc=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0x5fc3[_0x87239];return _0x53af1e;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x35fc('0x2')]},'parent':{'type':Sequelize[_0x35fc('0x2')]},'table':{'type':Sequelize[_0x35fc('0x2')]},'conditions':{'type':Sequelize[_0x35fc('0x3')]},'joins':{'type':Sequelize[_0x35fc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 1b9dd75..0d2c67c 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 _0xfc89=['UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','operator','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','clone','output','fullPath','%s-%s.%s','randomstring','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','savename','COUNT(*)','count','run','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','debug','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','dbH','sendStatus','status','undefined','offset','apply','reject','save','update','destroy','then','get','CustomReports','UserProfileResource','end','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','catch','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)'];(function(_0x156fa6,_0x5253ae){var _0x41e823=function(_0x467419){while(--_0x467419){_0x156fa6['push'](_0x156fa6['shift']());}};_0x41e823(++_0x5253ae);}(_0xfc89,0xe7));var _0x9fc8=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xfc89[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x9fc8('0x0'));var rimraf=require(_0x9fc8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fc8('0x2'));var rp=require(_0x9fc8('0x3'));var moment=require(_0x9fc8('0x4'));var BPromise=require(_0x9fc8('0x5'));var Mustache=require(_0x9fc8('0x6'));var util=require(_0x9fc8('0x7'));var path=require('path');var sox=require(_0x9fc8('0x8'));var csv=require(_0x9fc8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9fc8('0xa'));var _=require(_0x9fc8('0xb'));var squel=require('squel');var crypto=require(_0x9fc8('0xc'));var jsforce=require(_0x9fc8('0xd'));var deskjs=require(_0x9fc8('0xe'));var toCsv=require(_0x9fc8('0x9'));var querystring=require(_0x9fc8('0xf'));var Papa=require(_0x9fc8('0x10'));var Redis=require(_0x9fc8('0x11'));var authService=require(_0x9fc8('0x12'));var qs=require(_0x9fc8('0x13'));var as=require(_0x9fc8('0x14'));var hardwareService=require(_0x9fc8('0x15'));var logger=require(_0x9fc8('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9fc8('0x17'))['db'];var dbH=require('../../mysqldb')[_0x9fc8('0x18')];function respondWithStatusCode(_0x4a12e9,_0x57180e){_0x57180e=_0x57180e||0xcc;return function(_0x539c77){if(_0x539c77){return _0x4a12e9[_0x9fc8('0x19')](_0x57180e);}return _0x4a12e9['status'](_0x57180e)['end']();};}function respondWithResult(_0x4fcb20,_0x4f61c5){_0x4f61c5=_0x4f61c5||0xc8;return function(_0x21e53b){if(_0x21e53b){return _0x4fcb20[_0x9fc8('0x1a')](_0x4f61c5)['json'](_0x21e53b);}};}function respondWithFilteredResult(_0x2e8edf,_0x3aab13){return function(_0x43651d){if(_0x43651d){var _0x379f55=typeof _0x3aab13['offset']===_0x9fc8('0x1b')&&typeof _0x3aab13['limit']===_0x9fc8('0x1b');var _0x5acc48=_0x43651d['count'];var _0x1dbc85=_0x379f55?0x0:_0x3aab13['offset'];var _0x41081a=_0x379f55?_0x43651d['count']:_0x3aab13[_0x9fc8('0x1c')]+_0x3aab13['limit'];var _0xe103da;if(_0x41081a>=_0x5acc48){_0x41081a=_0x5acc48;_0xe103da=0xc8;}else{_0xe103da=0xce;}_0x2e8edf[_0x9fc8('0x1a')](_0xe103da);return _0x2e8edf['set']('Content-Range',_0x1dbc85+'-'+_0x41081a+'/'+_0x5acc48)['json'](_0x43651d);}return null;};}function patchUpdates(_0x3172aa){return function(_0x11da49){try{jsonpatch[_0x9fc8('0x1d')](_0x11da49,_0x3172aa,!![]);}catch(_0x4687b6){return BPromise[_0x9fc8('0x1e')](_0x4687b6);}return _0x11da49[_0x9fc8('0x1f')]();};}function saveUpdates(_0x82622b,_0x49fd2b){return function(_0x2e4487){if(_0x2e4487){return _0x2e4487[_0x9fc8('0x20')](_0x82622b)['then'](function(_0x29747f){return _0x29747f;});}return null;};}function removeEntity(_0x2d2880,_0x138335){return function(_0x41763b){if(_0x41763b){return _0x41763b[_0x9fc8('0x21')]()[_0x9fc8('0x22')](function(){var _0x4d5195=_0x41763b[_0x9fc8('0x23')]({'plain':!![]});var _0xc14861=_0x9fc8('0x24');return db[_0x9fc8('0x25')][_0x9fc8('0x21')]({'where':{'type':_0xc14861,'resourceId':_0x4d5195['id']}})['then'](function(){return _0x41763b;});})[_0x9fc8('0x22')](function(){_0x2d2880['status'](0xcc)[_0x9fc8('0x26')]();});}};}function handleEntityNotFound(_0x134c91,_0x354ea6){return function(_0x446ade){if(!_0x446ade){_0x134c91[_0x9fc8('0x19')](0x194);}return _0x446ade;};}function handleError(_0x5ee2f1,_0x24470d){_0x24470d=_0x24470d||0x1f4;return function(_0x1506b6){logger[_0x9fc8('0x27')](_0x1506b6[_0x9fc8('0x28')]);if(_0x1506b6[_0x9fc8('0x29')]){delete _0x1506b6[_0x9fc8('0x29')];}_0x5ee2f1['status'](_0x24470d)[_0x9fc8('0x2a')](_0x1506b6);};}exports[_0x9fc8('0x2b')]=function(_0xfe2d84,_0x8cf59b){var _0x20319e={},_0x1c51f9={},_0x4dedda={'count':0x0,'rows':[]};var _0x81acaa=_[_0x9fc8('0x2c')](db[_0x9fc8('0x2d')][_0x9fc8('0x2e')],function(_0x14fdb1){return{'name':_0x14fdb1['fieldName'],'type':_0x14fdb1[_0x9fc8('0x2f')][_0x9fc8('0x30')]};});_0x1c51f9['model']=_['map'](_0x81acaa,_0x9fc8('0x29'));_0x1c51f9['query']=_[_0x9fc8('0x31')](_0xfe2d84[_0x9fc8('0x32')]);_0x1c51f9[_0x9fc8('0x33')]=_['intersection'](_0x1c51f9[_0x9fc8('0x34')],_0x1c51f9['query']);_0x20319e[_0x9fc8('0x35')]=_[_0x9fc8('0x36')](_0x1c51f9[_0x9fc8('0x34')],qs[_0x9fc8('0x37')](_0xfe2d84[_0x9fc8('0x32')][_0x9fc8('0x37')]));_0x20319e[_0x9fc8('0x35')]=_0x20319e['attributes'][_0x9fc8('0x38')]?_0x20319e[_0x9fc8('0x35')]:_0x1c51f9['model'];if(!_0xfe2d84[_0x9fc8('0x32')][_0x9fc8('0x39')](_0x9fc8('0x3a'))){_0x20319e[_0x9fc8('0x3b')]=qs[_0x9fc8('0x3b')](_0xfe2d84['query']['limit']);_0x20319e[_0x9fc8('0x1c')]=qs[_0x9fc8('0x1c')](_0xfe2d84[_0x9fc8('0x32')][_0x9fc8('0x1c')]);}_0x20319e[_0x9fc8('0x3c')]=qs[_0x9fc8('0x3d')](_0xfe2d84[_0x9fc8('0x32')][_0x9fc8('0x3d')]);_0x20319e[_0x9fc8('0x3e')]=qs[_0x9fc8('0x33')](_[_0x9fc8('0x3f')](_0xfe2d84[_0x9fc8('0x32')],_0x1c51f9[_0x9fc8('0x33')]),_0x81acaa);if(_0xfe2d84[_0x9fc8('0x32')][_0x9fc8('0x40')]){_0x20319e[_0x9fc8('0x3e')]=_[_0x9fc8('0x41')](_0x20319e[_0x9fc8('0x3e')],{'$or':_[_0x9fc8('0x2c')](_0x81acaa,function(_0x1e6ff2){if(_0x1e6ff2[_0x9fc8('0x2f')]!==_0x9fc8('0x42')){var _0x171e45={};_0x171e45[_0x1e6ff2[_0x9fc8('0x29')]]={'$like':'%'+_0xfe2d84[_0x9fc8('0x32')][_0x9fc8('0x40')]+'%'};return _0x171e45;}})});}_0x20319e=_[_0x9fc8('0x41')]({},_0x20319e,_0xfe2d84['options']);var _0x34c2aa={'where':_0x20319e[_0x9fc8('0x3e')]};return db[_0x9fc8('0x2d')]['count'](_0x34c2aa)[_0x9fc8('0x22')](function(_0x39364c){_0x4dedda['count']=_0x39364c;if(_0xfe2d84[_0x9fc8('0x32')][_0x9fc8('0x43')]){_0x20319e[_0x9fc8('0x44')]=[{'all':!![]}];}return db[_0x9fc8('0x2d')][_0x9fc8('0x45')](_0x20319e);})[_0x9fc8('0x22')](function(_0x26b3ed){_0x4dedda[_0x9fc8('0x46')]=_0x26b3ed;return _0x4dedda;})['then'](respondWithFilteredResult(_0x8cf59b,_0x20319e))['catch'](handleError(_0x8cf59b,null));};exports[_0x9fc8('0x47')]=function(_0x16289d,_0x5654a8){var _0x7b85c3={'raw':![],'where':{'id':_0x16289d['params']['id']}},_0x10d89e={};_0x10d89e[_0x9fc8('0x34')]=_['keys'](db[_0x9fc8('0x2d')][_0x9fc8('0x2e')]);_0x10d89e['query']=_[_0x9fc8('0x31')](_0x16289d[_0x9fc8('0x32')]);_0x10d89e[_0x9fc8('0x33')]=_[_0x9fc8('0x36')](_0x10d89e[_0x9fc8('0x34')],_0x10d89e[_0x9fc8('0x32')]);_0x7b85c3[_0x9fc8('0x35')]=_['intersection'](_0x10d89e[_0x9fc8('0x34')],qs[_0x9fc8('0x37')](_0x16289d[_0x9fc8('0x32')][_0x9fc8('0x37')]));_0x7b85c3[_0x9fc8('0x35')]=_0x7b85c3[_0x9fc8('0x35')][_0x9fc8('0x38')]?_0x7b85c3[_0x9fc8('0x35')]:_0x10d89e[_0x9fc8('0x34')];if(_0x16289d[_0x9fc8('0x32')][_0x9fc8('0x43')]){_0x7b85c3[_0x9fc8('0x44')]=[{'all':!![]}];}_0x7b85c3=_[_0x9fc8('0x41')]({},_0x7b85c3,_0x16289d[_0x9fc8('0x48')]);return db[_0x9fc8('0x2d')][_0x9fc8('0x49')](_0x7b85c3)[_0x9fc8('0x22')](handleEntityNotFound(_0x5654a8,null))['then'](respondWithResult(_0x5654a8,null))['catch'](handleError(_0x5654a8,null));};exports[_0x9fc8('0x4a')]=function(_0x48b6ba,_0x102544){return db[_0x9fc8('0x2d')][_0x9fc8('0x4a')](_0x48b6ba['body'],{})[_0x9fc8('0x22')](function(_0x3819bf){var _0x135b5d=_0x48b6ba['user']['get']({'plain':!![]});if(!_0x135b5d)throw new Error(_0x9fc8('0x4b'));if(_0x135b5d[_0x9fc8('0x4c')]===_0x9fc8('0x4d')){var _0x1cc0d2=_0x3819bf[_0x9fc8('0x23')]({'plain':!![]});var _0x4e60a3=_0x9fc8('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x4e60a3,'userProfileId':_0x135b5d[_0x9fc8('0x4f')]},'raw':!![]})['then'](function(_0x101139){if(_0x101139&&_0x101139[_0x9fc8('0x50')]===0x0){return db[_0x9fc8('0x25')]['create']({'name':_0x1cc0d2[_0x9fc8('0x29')],'resourceId':_0x1cc0d2['id'],'type':_0x9fc8('0x24'),'sectionId':_0x101139['id']},{})[_0x9fc8('0x22')](function(){return _0x3819bf;});}else{return _0x3819bf;}})['catch'](function(_0x34589e){logger['error'](_0x9fc8('0x51'),_0x34589e);throw _0x34589e;});}return _0x3819bf;})['then'](respondWithResult(_0x102544,0xc9))['catch'](handleError(_0x102544,null));};exports[_0x9fc8('0x20')]=function(_0x5269be,_0x581476){if(_0x5269be[_0x9fc8('0x52')]['id']){delete _0x5269be[_0x9fc8('0x52')]['id'];}return db[_0x9fc8('0x2d')][_0x9fc8('0x49')]({'where':{'id':_0x5269be[_0x9fc8('0x53')]['id']}})[_0x9fc8('0x22')](handleEntityNotFound(_0x581476,null))[_0x9fc8('0x22')](saveUpdates(_0x5269be[_0x9fc8('0x52')],null))[_0x9fc8('0x22')](respondWithResult(_0x581476,null))[_0x9fc8('0x54')](handleError(_0x581476,null));};exports[_0x9fc8('0x21')]=function(_0x1b3add,_0x423843){return db[_0x9fc8('0x2d')][_0x9fc8('0x49')]({'where':{'id':_0x1b3add[_0x9fc8('0x53')]['id']}})[_0x9fc8('0x22')](handleEntityNotFound(_0x423843,null))['then'](removeEntity(_0x423843,null))['catch'](handleError(_0x423843,null));};exports['preview']=function(_0x164f9d,_0x125c7b){var _0x516fec=0xa;var _0x3a5940=[_0x9fc8('0x55'),_0x9fc8('0x56'),_0x9fc8('0x57'),_0x9fc8('0x58')];var _0x2c7354={'SUM':_0x9fc8('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9fc8('0x5a'),'MAX':_0x9fc8('0x5b'),'MIN':_0x9fc8('0x5c'),'AVG':_0x9fc8('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9fc8('0x5e')};var _0x5f3c00={'SEC_TO_TIME':_0x9fc8('0x5f'),'DATE':_0x9fc8('0x60'),'HOUR':_0x9fc8('0x61'),'ROUND':_0x9fc8('0x62'),'UNIX_TIMESTAMP':_0x9fc8('0x63')};var _0x4196ce=function(_0x413c00){return!_[_0x9fc8('0x64')]([_0x9fc8('0x65'),_0x9fc8('0x66'),_0x9fc8('0x67'),_0x9fc8('0x68')],_0x413c00);};var _0x2002b1=function(_0x6c1437){if(!_0x6c1437||!_0x6c1437[_0x9fc8('0x69')][_0x9fc8('0x38')]){return'';}for(var _0x54d21b='(',_0x7c6127=0x0;_0x7c6127<_0x6c1437[_0x9fc8('0x69')]['length'];_0x7c6127+=0x1){_0x7c6127>0x0&&(_0x54d21b+='\x20'+_0x6c1437['operator']+'\x20');_0x54d21b+=_0x6c1437[_0x9fc8('0x69')][_0x7c6127][_0x9fc8('0x6a')]?_0x2002b1(_0x6c1437[_0x9fc8('0x69')][_0x7c6127][_0x9fc8('0x6a')]):_0x6c1437[_0x9fc8('0x69')][_0x7c6127][_0x9fc8('0x6b')]+'\x20'+_0x6c1437[_0x9fc8('0x69')][_0x7c6127][_0x9fc8('0x6c')]+(_0x4196ce(_0x6c1437[_0x9fc8('0x69')][_0x7c6127][_0x9fc8('0x6c')])?'\x20'+_0x6c1437[_0x9fc8('0x69')][_0x7c6127][_0x9fc8('0x6d')]:'');}return _0x54d21b+')';};var _0x420de8={'where':{'id':_0x164f9d[_0x9fc8('0x53')]['id']}},_0x1800c2,_0x54678a,_0x49dc9f,_0x1899ce,_0x3b3168;_0x420de8=_[_0x9fc8('0x41')]({},_0x420de8,_0x164f9d['options']);return db['AnalyticCustomReport'][_0x9fc8('0x49')](_0x420de8)[_0x9fc8('0x22')](function(_0x101723){if(_0x101723){_0x1800c2=_0x101723;return _0x101723[_0x9fc8('0x6e')]();}return null;})[_0x9fc8('0x22')](function(_0x45cc61){if(_0x45cc61){if(!_0x45cc61[_0x9fc8('0x38')]){throw new db[(_0x9fc8('0x6f'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x54678a=_0x45cc61;return db[_0x9fc8('0x70')][_0x9fc8('0x45')]({'raw':!![]});}return null;})[_0x9fc8('0x22')](function(_0x513153){if(_0x513153){_0x49dc9f=_[_0x9fc8('0x71')](_0x513153,'id');var _0x5abe24;var _0xc08dc1=squel[_0x9fc8('0x72')]();_0xc08dc1[_0x9fc8('0x73')](_0x1800c2[_0x9fc8('0x74')]);for(var _0x228612=0x0;_0x228612<_0x54678a[_0x9fc8('0x38')];_0x228612+=0x1){_0x5abe24=_0x54678a[_0x228612][_0x9fc8('0x75')]?_0x49dc9f[_0x54678a[_0x228612][_0x9fc8('0x75')]][_0x9fc8('0x76')]:_0x54678a[_0x228612][_0x9fc8('0x6b')];_0x5abe24=_0x54678a[_0x228612][_0x9fc8('0x77')]?_[_0x9fc8('0x78')](_0x2c7354[_0x54678a[_0x228612]['function']],'%s',_0x5abe24):_0x5abe24;_0x5abe24=_0x54678a[_0x228612][_0x9fc8('0x79')]?_[_0x9fc8('0x78')](_0x5f3c00[_0x54678a[_0x228612][_0x9fc8('0x79')]],'%s',_0x5abe24):_0x5abe24;if(_0x54678a[_0x228612]['groupBy']){_0xc08dc1['group'](_0x5abe24);}_0x54678a[_0x228612][_0x9fc8('0x7a')]&&_0xc08dc1[_0x9fc8('0x3c')](_0x5abe24,_0x54678a[_0x228612][_0x9fc8('0x7a')]===_0x9fc8('0x7b')?![]:!![]);_0xc08dc1[_0x9fc8('0x6b')](_0x5abe24,_0x54678a[_0x228612][_0x9fc8('0x7c')]||_0x5abe24);}if(_0x1800c2['joins']){_0x1800c2[_0x9fc8('0x7d')]=JSON[_0x9fc8('0x7e')](_0x1800c2[_0x9fc8('0x7d')]);for(var _0x301a40=0x0;_0x301a40<_0x1800c2[_0x9fc8('0x7d')][_0x9fc8('0x38')];_0x301a40+=0x1){if(_0x1800c2[_0x9fc8('0x7d')][_0x301a40][_0x9fc8('0x2f')]&&_['includes'](_0x3a5940,_0x1800c2[_0x9fc8('0x7d')][_0x301a40][_0x9fc8('0x2f')])&&_0x1800c2[_0x9fc8('0x7d')][_0x301a40][_0x9fc8('0x7f')]&&_0x1800c2['joins'][_0x301a40]['foreignTable']&&_0x1800c2[_0x9fc8('0x7d')][_0x301a40][_0x9fc8('0x80')]){_0xc08dc1[_0x1800c2[_0x9fc8('0x7d')][_0x301a40][_0x9fc8('0x2f')]](_0x1800c2[_0x9fc8('0x7d')][_0x301a40][_0x9fc8('0x81')],null,util[_0x9fc8('0x79')](_0x9fc8('0x82'),_0x1800c2[_0x9fc8('0x74')],_0x1800c2[_0x9fc8('0x7d')][_0x301a40][_0x9fc8('0x7f')],_0x1800c2['joins'][_0x301a40]['foreignTable'],_0x1800c2[_0x9fc8('0x7d')][_0x301a40][_0x9fc8('0x80')]));}}}if(_0x1800c2[_0x9fc8('0x83')]){_0x1800c2[_0x9fc8('0x83')]=JSON['parse'](_0x1800c2[_0x9fc8('0x83')]);_0xc08dc1[_0x9fc8('0x3e')](_0x2002b1(_0x1800c2[_0x9fc8('0x83')][_0x9fc8('0x6a')]));}_0x3b3168=_0xc08dc1['clone']();_0xc08dc1[_0x9fc8('0x3b')](_0x516fec);_0xc08dc1[_0x9fc8('0x1c')](0x0);logger['debug']('Limited\x20Query:',_0xc08dc1[_0x9fc8('0x84')]());return dbH[_0x9fc8('0x85')][_0x9fc8('0x32')](_0xc08dc1[_0x9fc8('0x84')](),{'type':dbH[_0x9fc8('0x85')][_0x9fc8('0x86')][_0x9fc8('0x87')]});}})[_0x9fc8('0x22')](respondWithResult(_0x125c7b,null))[_0x9fc8('0x54')](handleError(_0x125c7b,null));};function runReport(_0x283240,_0x2d32ec,_0x29053f){var _0x5414f9=_0x2d32ec['name'];var _0x4ec5bb=0xa;var _0x2ded60=[_0x9fc8('0x55'),_0x9fc8('0x56'),'right_join',_0x9fc8('0x58')];var _0x59372f={'SUM':_0x9fc8('0x59'),'COUNT':_0x9fc8('0x88'),'COUNT DISTINCT':_0x9fc8('0x5a'),'MAX':_0x9fc8('0x5b'),'MIN':_0x9fc8('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9fc8('0x5e')};var _0x22c381={'SEC_TO_TIME':_0x9fc8('0x5f'),'DATE':_0x9fc8('0x60'),'HOUR':'HOUR(%s)','ROUND':_0x9fc8('0x62'),'UNIX_TIMESTAMP':_0x9fc8('0x63')};var _0x1325e8=function(_0x1762c4){return!_['includes']([_0x9fc8('0x65'),_0x9fc8('0x66'),_0x9fc8('0x67'),_0x9fc8('0x68')],_0x1762c4);};var _0x4aa5c1=function(_0x45b1bd){if(!_0x45b1bd||!_0x45b1bd[_0x9fc8('0x69')][_0x9fc8('0x38')]){return'';}for(var _0x4b89d3='(',_0xb610b9=0x0;_0xb610b9<_0x45b1bd[_0x9fc8('0x69')]['length'];_0xb610b9+=0x1){_0xb610b9>0x0&&(_0x4b89d3+='\x20'+_0x45b1bd[_0x9fc8('0x89')]+'\x20');_0x4b89d3+=_0x45b1bd[_0x9fc8('0x69')][_0xb610b9]['group']?_0x4aa5c1(_0x45b1bd['rules'][_0xb610b9][_0x9fc8('0x6a')]):_0x45b1bd[_0x9fc8('0x69')][_0xb610b9][_0x9fc8('0x6b')]+'\x20'+_0x45b1bd['rules'][_0xb610b9][_0x9fc8('0x6c')]+(_0x1325e8(_0x45b1bd[_0x9fc8('0x69')][_0xb610b9][_0x9fc8('0x6c')])?'\x20'+_0x45b1bd[_0x9fc8('0x69')][_0xb610b9][_0x9fc8('0x6d')]:'');}return _0x4b89d3+')';};var _0xc62699={'where':{'id':_0x283240['id']}},_0x405549,_0x4514fb,_0x20d270,_0x2f2bd5,_0x565d7a;_0xc62699=_['merge']({},_0xc62699,_0x29053f);return db[_0x9fc8('0x2d')][_0x9fc8('0x49')](_0xc62699)[_0x9fc8('0x22')](function(_0x163f00){if(_0x163f00){_0x405549=_0x163f00;return _0x163f00[_0x9fc8('0x6e')]();}return null;})[_0x9fc8('0x22')](function(_0x52b552){if(_0x52b552){if(!_0x52b552['length']){throw new db[(_0x9fc8('0x6f'))][(_0x9fc8('0x8a'))](_0x9fc8('0x8b'),0x193);}_0x4514fb=_0x52b552;return db[_0x9fc8('0x70')][_0x9fc8('0x45')]({'raw':!![]});}return null;})[_0x9fc8('0x22')](function(_0x46d62c){if(_0x46d62c){_0x20d270=_[_0x9fc8('0x71')](_0x46d62c,'id');var _0x13dfe1;var _0xa79398=squel[_0x9fc8('0x72')]();_0xa79398[_0x9fc8('0x73')](_0x405549[_0x9fc8('0x74')]);for(var _0x1bf3a6=0x0;_0x1bf3a6<_0x4514fb[_0x9fc8('0x38')];_0x1bf3a6+=0x1){_0x13dfe1=_0x4514fb[_0x1bf3a6][_0x9fc8('0x75')]?_0x20d270[_0x4514fb[_0x1bf3a6]['MetricId']][_0x9fc8('0x76')]:_0x4514fb[_0x1bf3a6][_0x9fc8('0x6b')];_0x13dfe1=_0x4514fb[_0x1bf3a6][_0x9fc8('0x77')]?_[_0x9fc8('0x78')](_0x59372f[_0x4514fb[_0x1bf3a6]['function']],'%s',_0x13dfe1):_0x13dfe1;_0x13dfe1=_0x4514fb[_0x1bf3a6][_0x9fc8('0x79')]?_[_0x9fc8('0x78')](_0x22c381[_0x4514fb[_0x1bf3a6][_0x9fc8('0x79')]],'%s',_0x13dfe1):_0x13dfe1;if(_0x4514fb[_0x1bf3a6][_0x9fc8('0x8c')]){_0xa79398['group'](_0x13dfe1);}_0x4514fb[_0x1bf3a6][_0x9fc8('0x7a')]&&_0xa79398['order'](_0x13dfe1,_0x4514fb[_0x1bf3a6][_0x9fc8('0x7a')]===_0x9fc8('0x7b')?![]:!![]);_0xa79398['field'](_0x13dfe1,_0x4514fb[_0x1bf3a6][_0x9fc8('0x7c')]||_0x13dfe1);}if(_0x405549['joins']){_0x405549[_0x9fc8('0x7d')]=JSON['parse'](_0x405549[_0x9fc8('0x7d')]);for(var _0x5d2146=0x0;_0x5d2146<_0x405549['joins']['length'];_0x5d2146+=0x1){if(_0x405549[_0x9fc8('0x7d')][_0x5d2146][_0x9fc8('0x2f')]&&_[_0x9fc8('0x64')](_0x2ded60,_0x405549[_0x9fc8('0x7d')][_0x5d2146][_0x9fc8('0x2f')])&&_0x405549['joins'][_0x5d2146][_0x9fc8('0x7f')]&&_0x405549[_0x9fc8('0x7d')][_0x5d2146][_0x9fc8('0x81')]&&_0x405549['joins'][_0x5d2146]['foreignKey']){_0xa79398[_0x405549[_0x9fc8('0x7d')][_0x5d2146]['type']](_0x405549[_0x9fc8('0x7d')][_0x5d2146][_0x9fc8('0x81')],null,util[_0x9fc8('0x79')](_0x9fc8('0x82'),_0x405549[_0x9fc8('0x74')],_0x405549[_0x9fc8('0x7d')][_0x5d2146][_0x9fc8('0x7f')],_0x405549[_0x9fc8('0x7d')][_0x5d2146]['foreignTable'],_0x405549[_0x9fc8('0x7d')][_0x5d2146]['foreignKey']));}}}if(_0x405549[_0x9fc8('0x83')]){_0x405549['conditions']=JSON[_0x9fc8('0x7e')](_0x405549[_0x9fc8('0x83')]);_0xa79398[_0x9fc8('0x3e')](_0x4aa5c1(_0x405549[_0x9fc8('0x83')][_0x9fc8('0x6a')]));}_0x565d7a=_0xa79398[_0x9fc8('0x8d')]();_0xa79398['limit'](_0x4ec5bb);_0xa79398[_0x9fc8('0x1c')](0x0);return;}})[_0x9fc8('0x22')](function(){if(_0x2d32ec[_0x9fc8('0x8e')]==='web'){return null;}var _0x23bc8e=_[_0x9fc8('0x41')](_0x2d32ec,{'name':_0x2d32ec[_0x9fc8('0x8f')]||_0x2d32ec[_0x9fc8('0x29')]||_0x405549[_0x9fc8('0x29')],'basename':_0x5414f9,'savename':util[_0x9fc8('0x79')](_0x9fc8('0x90'),_0x2d32ec[_0x9fc8('0x29')]||_0x405549[_0x9fc8('0x29')],require(_0x9fc8('0x91'))['generate'](0x4),_0x2d32ec[_0x9fc8('0x8e')]||_0x9fc8('0x92')),'reportId':_0x405549['id'],'reportType':'custom'});return db[_0x9fc8('0x93')][_0x9fc8('0x4a')](_0x23bc8e,{'raw':!![]});})[_0x9fc8('0x22')](function(_0x5cfc35){if(_0x405549[_0x9fc8('0x74')]===_0x9fc8('0x94')){_0x565d7a[_0x9fc8('0x3e')](_0x405549['table']+_0x9fc8('0x95'),_0x2d32ec['startDate'],_0x2d32ec[_0x9fc8('0x96')]);}else{_0x565d7a[_0x9fc8('0x3e')](_0x405549[_0x9fc8('0x74')]+_0x9fc8('0x97'),_0x2d32ec['startDate'],_0x2d32ec[_0x9fc8('0x96')]);}if(_0x5cfc35){logger[_0x9fc8('0x98')](_0x9fc8('0x99'),_0x565d7a['toString']());require(_0x9fc8('0x9a'))[_0x9fc8('0x9b')](path[_0x9fc8('0x55')](__dirname,_0x9fc8('0x9c'),_0x5cfc35['output']),[_0x5cfc35['id'],_0x565d7a[_0x9fc8('0x84')](),path[_0x9fc8('0x55')](__dirname,'../../files/reports',_0x5cfc35[_0x9fc8('0x9d')]),_0x5414f9]);return _0x5cfc35;}else{var _0x2c55b6=squel[_0x9fc8('0x72')]();_0x2c55b6[_0x9fc8('0x73')]('('+_0x565d7a[_0x9fc8('0x84')]()+')','countTable');_0x2c55b6[_0x9fc8('0x6b')](_0x9fc8('0x9e'),_0x9fc8('0x9f'));_0x565d7a[_0x9fc8('0x3b')](_0x2d32ec[_0x9fc8('0x3b')]||_0x4ec5bb);_0x565d7a['offset'](_0x2d32ec['offset']||0x0);return dbH['sequelize']['query'](_0x2c55b6[_0x9fc8('0x84')](),{'type':dbH[_0x9fc8('0x85')][_0x9fc8('0x86')]['SELECT']})['then'](function(_0x58c801){if(!_0x58c801['length']){_0x2f2bd5=0x0;}else{_0x2f2bd5=_0x58c801[0x0][_0x9fc8('0x9f')]||0x0;}return dbH[_0x9fc8('0x85')]['query'](_0x565d7a[_0x9fc8('0x84')](),{'type':dbH[_0x9fc8('0x85')][_0x9fc8('0x86')][_0x9fc8('0x87')]});})[_0x9fc8('0x22')](function(_0xfbdf51){return{'rows':_0xfbdf51||[],'count':_0x2f2bd5};});}});}exports[_0x9fc8('0xa0')]=function(_0xaa38d6,_0x1e6e63){return runReport(_0xaa38d6['params'],_0xaa38d6[_0x9fc8('0x32')],_0xaa38d6[_0x9fc8('0x48')])[_0x9fc8('0x22')](respondWithResult(_0x1e6e63,null))[_0x9fc8('0x54')](handleError(_0x1e6e63,null));};exports['runReport']=runReport;exports[_0x9fc8('0x32')]=function(_0x9b8da4,_0x5407f2){var _0x1f711e=0xa;var _0x38e630=[_0x9fc8('0x55'),'left_join',_0x9fc8('0x57'),_0x9fc8('0x58')];var _0x877466={'SUM':'SUM(%s)','COUNT':_0x9fc8('0x88'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x9fc8('0xa1'),'GROUP_CONCAT ASC':_0x9fc8('0xa2'),'GROUP_CONCAT DESC':_0x9fc8('0x5e')};var _0x644d75={'SEC_TO_TIME':_0x9fc8('0x5f'),'DATE':'DATE(%s)','HOUR':_0x9fc8('0x61'),'ROUND':_0x9fc8('0x62'),'UNIX_TIMESTAMP':_0x9fc8('0x63')};var _0x5683fe=function(_0x3afb5a){return!_['includes']([_0x9fc8('0x65'),_0x9fc8('0x66'),'IS\x20EMPTY',_0x9fc8('0x68')],_0x3afb5a);};var _0x330d18=function(_0x3aeca6){if(!_0x3aeca6||!_0x3aeca6[_0x9fc8('0x69')][_0x9fc8('0x38')]){return'';}for(var _0x506c44='(',_0x54d35e=0x0;_0x54d35e<_0x3aeca6[_0x9fc8('0x69')][_0x9fc8('0x38')];_0x54d35e+=0x1){_0x54d35e>0x0&&(_0x506c44+='\x20'+_0x3aeca6[_0x9fc8('0x89')]+'\x20');_0x506c44+=_0x3aeca6[_0x9fc8('0x69')][_0x54d35e]['group']?_0x330d18(_0x3aeca6['rules'][_0x54d35e]['group']):_0x3aeca6['rules'][_0x54d35e]['field']+'\x20'+_0x3aeca6[_0x9fc8('0x69')][_0x54d35e][_0x9fc8('0x6c')]+(_0x5683fe(_0x3aeca6['rules'][_0x54d35e][_0x9fc8('0x6c')])?'\x20'+_0x3aeca6['rules'][_0x54d35e][_0x9fc8('0x6d')]:'');}return _0x506c44+')';};var _0x3395a5={'where':{'id':_0x9b8da4['params']['id']}},_0x419bab,_0x5d6cee,_0x13406d,_0x453a8a,_0x16a2fd;_0x3395a5=_['merge']({},_0x3395a5,_0x9b8da4[_0x9fc8('0x48')]);return db['AnalyticCustomReport'][_0x9fc8('0x49')](_0x3395a5)[_0x9fc8('0x22')](function(_0x5a8cc4){if(_0x5a8cc4){_0x419bab=_0x5a8cc4;return _0x5a8cc4[_0x9fc8('0x6e')]();}return null;})[_0x9fc8('0x22')](function(_0x1d1556){if(_0x1d1556){if(!_0x1d1556[_0x9fc8('0x38')]){throw new db[(_0x9fc8('0x6f'))][(_0x9fc8('0x8a'))](_0x9fc8('0x8b'),0x193);}_0x5d6cee=_0x1d1556;return db[_0x9fc8('0x70')]['findAll']({'raw':!![]});}return null;})[_0x9fc8('0x22')](function(_0x3f5792){if(_0x3f5792){_0x13406d=_[_0x9fc8('0x71')](_0x3f5792,'id');var _0x45364d;var _0x466c7e=squel[_0x9fc8('0x72')]();_0x466c7e['from'](_0x419bab[_0x9fc8('0x74')]);for(var _0x2c7cfb=0x0;_0x2c7cfb<_0x5d6cee[_0x9fc8('0x38')];_0x2c7cfb+=0x1){_0x45364d=_0x5d6cee[_0x2c7cfb][_0x9fc8('0x75')]?_0x13406d[_0x5d6cee[_0x2c7cfb][_0x9fc8('0x75')]][_0x9fc8('0x76')]:_0x5d6cee[_0x2c7cfb][_0x9fc8('0x6b')];_0x45364d=_0x5d6cee[_0x2c7cfb][_0x9fc8('0x77')]?_[_0x9fc8('0x78')](_0x877466[_0x5d6cee[_0x2c7cfb][_0x9fc8('0x77')]],'%s',_0x45364d):_0x45364d;_0x45364d=_0x5d6cee[_0x2c7cfb]['format']?_[_0x9fc8('0x78')](_0x644d75[_0x5d6cee[_0x2c7cfb][_0x9fc8('0x79')]],'%s',_0x45364d):_0x45364d;if(_0x5d6cee[_0x2c7cfb][_0x9fc8('0x8c')]){_0x466c7e[_0x9fc8('0x6a')](_0x45364d);}_0x5d6cee[_0x2c7cfb][_0x9fc8('0x7a')]&&_0x466c7e[_0x9fc8('0x3c')](_0x45364d,_0x5d6cee[_0x2c7cfb][_0x9fc8('0x7a')]===_0x9fc8('0x7b')?![]:!![]);_0x466c7e[_0x9fc8('0x6b')](_0x45364d,_0x5d6cee[_0x2c7cfb]['alias']||_0x45364d);}if(_0x419bab['joins']){_0x419bab[_0x9fc8('0x7d')]=JSON[_0x9fc8('0x7e')](_0x419bab[_0x9fc8('0x7d')]);for(var _0x261629=0x0;_0x261629<_0x419bab[_0x9fc8('0x7d')][_0x9fc8('0x38')];_0x261629+=0x1){if(_0x419bab[_0x9fc8('0x7d')][_0x261629][_0x9fc8('0x2f')]&&_[_0x9fc8('0x64')](_0x38e630,_0x419bab['joins'][_0x261629][_0x9fc8('0x2f')])&&_0x419bab[_0x9fc8('0x7d')][_0x261629][_0x9fc8('0x7f')]&&_0x419bab[_0x9fc8('0x7d')][_0x261629]['foreignTable']&&_0x419bab['joins'][_0x261629][_0x9fc8('0x80')]){_0x466c7e[_0x419bab[_0x9fc8('0x7d')][_0x261629][_0x9fc8('0x2f')]](_0x419bab[_0x9fc8('0x7d')][_0x261629][_0x9fc8('0x81')],null,util[_0x9fc8('0x79')](_0x9fc8('0x82'),_0x419bab[_0x9fc8('0x74')],_0x419bab[_0x9fc8('0x7d')][_0x261629][_0x9fc8('0x7f')],_0x419bab['joins'][_0x261629][_0x9fc8('0x81')],_0x419bab[_0x9fc8('0x7d')][_0x261629][_0x9fc8('0x80')]));}}}if(_0x419bab[_0x9fc8('0x83')]){_0x419bab[_0x9fc8('0x83')]=JSON['parse'](_0x419bab['conditions']);_0x466c7e[_0x9fc8('0x3e')](_0x330d18(_0x419bab[_0x9fc8('0x83')][_0x9fc8('0x6a')]));}_0x16a2fd=_0x466c7e[_0x9fc8('0x8d')]();_0x466c7e['limit'](_0x1f711e);_0x466c7e[_0x9fc8('0x1c')](0x0);logger[_0x9fc8('0xa3')](_0x9fc8('0xa4'),_0x466c7e[_0x9fc8('0x84')]());return dbH[_0x9fc8('0x85')][_0x9fc8('0x32')](_0x466c7e[_0x9fc8('0x84')](),{'type':dbH[_0x9fc8('0x85')]['QueryTypes'][_0x9fc8('0x87')]});}})[_0x9fc8('0x22')](function(){return{'sql':_0x16a2fd[_0x9fc8('0x84')]()};})['then'](respondWithResult(_0x5407f2,null))[_0x9fc8('0x54')](handleError(_0x5407f2,null));}; \ No newline at end of file +var _0xf7b4=['.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','savename','COUNT(*)','QueryTypes','runReport','operator','Limited\x20Query:','eml-format','fast-json-patch','request-promise','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/logger','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','get','CustomReports','UserProfileResource','destroy','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','COUNT(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','sequelize','toString','SELECT','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','value','getFields','MetricId','output','web','randomstring','generate','csv','custom','AnalyticExtractedReport','startDate','endDate'];(function(_0x4070dc,_0x50aba7){var _0x176208=function(_0x497187){while(--_0x497187){_0x4070dc['push'](_0x4070dc['shift']());}};_0x176208(++_0x50aba7);}(_0xf7b4,0x152));var _0x4f7b=function(_0x276b57,_0x1fa708){_0x276b57=_0x276b57-0x0;var _0x5db4b9=_0xf7b4[_0x276b57];return _0x5db4b9;};'use strict';var emlformat=require(_0x4f7b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f7b('0x1'));var rp=require(_0x4f7b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f7b('0x3'));var util=require(_0x4f7b('0x4'));var path=require(_0x4f7b('0x5'));var sox=require(_0x4f7b('0x6'));var csv=require(_0x4f7b('0x7'));var ejs=require(_0x4f7b('0x8'));var fs=require('fs');var fs_extra=require(_0x4f7b('0x9'));var _=require(_0x4f7b('0xa'));var squel=require(_0x4f7b('0xb'));var crypto=require(_0x4f7b('0xc'));var jsforce=require(_0x4f7b('0xd'));var deskjs=require(_0x4f7b('0xe'));var toCsv=require(_0x4f7b('0x7'));var querystring=require('querystring');var Papa=require(_0x4f7b('0xf'));var Redis=require(_0x4f7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f7b('0x11'));var as=require(_0x4f7b('0x12'));var hardwareService=require(_0x4f7b('0x13'));var logger=require(_0x4f7b('0x14'))(_0x4f7b('0x15'));var utils=require('../../config/utils');var config=require(_0x4f7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0x4f7b('0x17'))[_0x4f7b('0x18')];function respondWithStatusCode(_0x3c55e1,_0x41a050){_0x41a050=_0x41a050||0xcc;return function(_0x4f7c2b){if(_0x4f7c2b){return _0x3c55e1[_0x4f7b('0x19')](_0x41a050);}return _0x3c55e1[_0x4f7b('0x1a')](_0x41a050)[_0x4f7b('0x1b')]();};}function respondWithResult(_0x43a51a,_0x339486){_0x339486=_0x339486||0xc8;return function(_0x330de9){if(_0x330de9){return _0x43a51a[_0x4f7b('0x1a')](_0x339486)[_0x4f7b('0x1c')](_0x330de9);}};}function respondWithFilteredResult(_0x260667,_0x29fdd5){return function(_0x1a28b8){if(_0x1a28b8){var _0x1e7afc=typeof _0x29fdd5['offset']===_0x4f7b('0x1d')&&typeof _0x29fdd5['limit']==='undefined';var _0x24e5cf=_0x1a28b8[_0x4f7b('0x1e')];var _0x519d90=_0x1e7afc?0x0:_0x29fdd5[_0x4f7b('0x1f')];var _0x24c460=_0x1e7afc?_0x1a28b8[_0x4f7b('0x1e')]:_0x29fdd5[_0x4f7b('0x1f')]+_0x29fdd5['limit'];var _0x1daa79;if(_0x24c460>=_0x24e5cf){_0x24c460=_0x24e5cf;_0x1daa79=0xc8;}else{_0x1daa79=0xce;}_0x260667['status'](_0x1daa79);return _0x260667[_0x4f7b('0x20')](_0x4f7b('0x21'),_0x519d90+'-'+_0x24c460+'/'+_0x24e5cf)[_0x4f7b('0x1c')](_0x1a28b8);}return null;};}function patchUpdates(_0xdb2df2){return function(_0x27127b){try{jsonpatch[_0x4f7b('0x22')](_0x27127b,_0xdb2df2,!![]);}catch(_0xc5dcfa){return BPromise[_0x4f7b('0x23')](_0xc5dcfa);}return _0x27127b[_0x4f7b('0x24')]();};}function saveUpdates(_0x5508bd,_0x410176){return function(_0x32027b){if(_0x32027b){return _0x32027b[_0x4f7b('0x25')](_0x5508bd)['then'](function(_0x150f57){return _0x150f57;});}return null;};}function removeEntity(_0x4610a4,_0x5d22f4){return function(_0x15dbec){if(_0x15dbec){return _0x15dbec['destroy']()[_0x4f7b('0x26')](function(){var _0x2429be=_0x15dbec[_0x4f7b('0x27')]({'plain':!![]});var _0x278c41=_0x4f7b('0x28');return db[_0x4f7b('0x29')][_0x4f7b('0x2a')]({'where':{'type':_0x278c41,'resourceId':_0x2429be['id']}})[_0x4f7b('0x26')](function(){return _0x15dbec;});})['then'](function(){_0x4610a4[_0x4f7b('0x1a')](0xcc)[_0x4f7b('0x1b')]();});}};}function handleEntityNotFound(_0x311675,_0x5c6c3e){return function(_0x19da29){if(!_0x19da29){_0x311675[_0x4f7b('0x19')](0x194);}return _0x19da29;};}function handleError(_0x1db684,_0x3a56ff){_0x3a56ff=_0x3a56ff||0x1f4;return function(_0x1ccce0){logger['error'](_0x1ccce0[_0x4f7b('0x2b')]);if(_0x1ccce0[_0x4f7b('0x2c')]){delete _0x1ccce0[_0x4f7b('0x2c')];}_0x1db684['status'](_0x3a56ff)[_0x4f7b('0x2d')](_0x1ccce0);};}exports['index']=function(_0x4e4828,_0x1a2346){var _0x52a5b1={},_0x1aad4b={},_0x232b79={'count':0x0,'rows':[]};var _0x22f489=_[_0x4f7b('0x2e')](db[_0x4f7b('0x2f')][_0x4f7b('0x30')],function(_0x13a113){return{'name':_0x13a113[_0x4f7b('0x31')],'type':_0x13a113[_0x4f7b('0x32')][_0x4f7b('0x33')]};});_0x1aad4b[_0x4f7b('0x34')]=_[_0x4f7b('0x2e')](_0x22f489,_0x4f7b('0x2c'));_0x1aad4b[_0x4f7b('0x35')]=_[_0x4f7b('0x36')](_0x4e4828[_0x4f7b('0x35')]);_0x1aad4b[_0x4f7b('0x37')]=_[_0x4f7b('0x38')](_0x1aad4b[_0x4f7b('0x34')],_0x1aad4b[_0x4f7b('0x35')]);_0x52a5b1[_0x4f7b('0x39')]=_[_0x4f7b('0x38')](_0x1aad4b['model'],qs[_0x4f7b('0x3a')](_0x4e4828['query'][_0x4f7b('0x3a')]));_0x52a5b1[_0x4f7b('0x39')]=_0x52a5b1['attributes'][_0x4f7b('0x3b')]?_0x52a5b1[_0x4f7b('0x39')]:_0x1aad4b[_0x4f7b('0x34')];if(!_0x4e4828['query'][_0x4f7b('0x3c')](_0x4f7b('0x3d'))){_0x52a5b1[_0x4f7b('0x3e')]=qs[_0x4f7b('0x3e')](_0x4e4828[_0x4f7b('0x35')][_0x4f7b('0x3e')]);_0x52a5b1[_0x4f7b('0x1f')]=qs['offset'](_0x4e4828[_0x4f7b('0x35')]['offset']);}_0x52a5b1[_0x4f7b('0x3f')]=qs[_0x4f7b('0x40')](_0x4e4828[_0x4f7b('0x35')]['sort']);_0x52a5b1[_0x4f7b('0x41')]=qs['filters'](_[_0x4f7b('0x42')](_0x4e4828[_0x4f7b('0x35')],_0x1aad4b['filters']),_0x22f489);if(_0x4e4828['query'][_0x4f7b('0x43')]){_0x52a5b1['where']=_[_0x4f7b('0x44')](_0x52a5b1[_0x4f7b('0x41')],{'$or':_['map'](_0x22f489,function(_0x1d0746){if(_0x1d0746['type']!=='VIRTUAL'){var _0x4e5ddf={};_0x4e5ddf[_0x1d0746[_0x4f7b('0x2c')]]={'$like':'%'+_0x4e4828[_0x4f7b('0x35')][_0x4f7b('0x43')]+'%'};return _0x4e5ddf;}})});}_0x52a5b1=_[_0x4f7b('0x44')]({},_0x52a5b1,_0x4e4828['options']);var _0x3da93f={'where':_0x52a5b1['where']};return db[_0x4f7b('0x2f')]['count'](_0x3da93f)[_0x4f7b('0x26')](function(_0x5698c6){_0x232b79[_0x4f7b('0x1e')]=_0x5698c6;if(_0x4e4828[_0x4f7b('0x35')][_0x4f7b('0x45')]){_0x52a5b1[_0x4f7b('0x46')]=[{'all':!![]}];}return db[_0x4f7b('0x2f')][_0x4f7b('0x47')](_0x52a5b1);})[_0x4f7b('0x26')](function(_0x2f0cea){_0x232b79[_0x4f7b('0x48')]=_0x2f0cea;return _0x232b79;})[_0x4f7b('0x26')](respondWithFilteredResult(_0x1a2346,_0x52a5b1))[_0x4f7b('0x49')](handleError(_0x1a2346,null));};exports[_0x4f7b('0x4a')]=function(_0x9c58fa,_0x508eaa){var _0x3a9c34={'raw':![],'where':{'id':_0x9c58fa[_0x4f7b('0x4b')]['id']}},_0x3a9200={};_0x3a9200[_0x4f7b('0x34')]=_['keys'](db['AnalyticCustomReport'][_0x4f7b('0x30')]);_0x3a9200[_0x4f7b('0x35')]=_[_0x4f7b('0x36')](_0x9c58fa[_0x4f7b('0x35')]);_0x3a9200['filters']=_['intersection'](_0x3a9200[_0x4f7b('0x34')],_0x3a9200[_0x4f7b('0x35')]);_0x3a9c34[_0x4f7b('0x39')]=_[_0x4f7b('0x38')](_0x3a9200['model'],qs['fields'](_0x9c58fa[_0x4f7b('0x35')][_0x4f7b('0x3a')]));_0x3a9c34[_0x4f7b('0x39')]=_0x3a9c34[_0x4f7b('0x39')][_0x4f7b('0x3b')]?_0x3a9c34['attributes']:_0x3a9200[_0x4f7b('0x34')];if(_0x9c58fa[_0x4f7b('0x35')][_0x4f7b('0x45')]){_0x3a9c34['include']=[{'all':!![]}];}_0x3a9c34=_[_0x4f7b('0x44')]({},_0x3a9c34,_0x9c58fa[_0x4f7b('0x4c')]);return db[_0x4f7b('0x2f')][_0x4f7b('0x4d')](_0x3a9c34)[_0x4f7b('0x26')](handleEntityNotFound(_0x508eaa,null))[_0x4f7b('0x26')](respondWithResult(_0x508eaa,null))[_0x4f7b('0x49')](handleError(_0x508eaa,null));};exports[_0x4f7b('0x4e')]=function(_0x2630ec,_0x1ef931){return db['AnalyticCustomReport'][_0x4f7b('0x4e')](_0x2630ec[_0x4f7b('0x4f')],{})[_0x4f7b('0x26')](function(_0x5003f1){var _0x16eaef=_0x2630ec[_0x4f7b('0x50')][_0x4f7b('0x27')]({'plain':!![]});if(!_0x16eaef)throw new Error(_0x4f7b('0x51'));if(_0x16eaef[_0x4f7b('0x52')]===_0x4f7b('0x50')){var _0x144ba1=_0x5003f1[_0x4f7b('0x27')]({'plain':!![]});var _0x776ce7=_0x4f7b('0x53');return db['UserProfileSection'][_0x4f7b('0x4d')]({'where':{'name':_0x776ce7,'userProfileId':_0x16eaef[_0x4f7b('0x54')]},'raw':!![]})[_0x4f7b('0x26')](function(_0x4d1ac9){if(_0x4d1ac9&&_0x4d1ac9[_0x4f7b('0x55')]===0x0){return db[_0x4f7b('0x29')][_0x4f7b('0x4e')]({'name':_0x144ba1[_0x4f7b('0x2c')],'resourceId':_0x144ba1['id'],'type':_0x4f7b('0x28'),'sectionId':_0x4d1ac9['id']},{})[_0x4f7b('0x26')](function(){return _0x5003f1;});}else{return _0x5003f1;}})['catch'](function(_0x2de413){logger[_0x4f7b('0x56')](_0x4f7b('0x57'),_0x2de413);throw _0x2de413;});}return _0x5003f1;})['then'](respondWithResult(_0x1ef931,0xc9))[_0x4f7b('0x49')](handleError(_0x1ef931,null));};exports[_0x4f7b('0x25')]=function(_0x1016a9,_0x3fb0d5){if(_0x1016a9[_0x4f7b('0x4f')]['id']){delete _0x1016a9[_0x4f7b('0x4f')]['id'];}return db['AnalyticCustomReport'][_0x4f7b('0x4d')]({'where':{'id':_0x1016a9['params']['id']}})['then'](handleEntityNotFound(_0x3fb0d5,null))['then'](saveUpdates(_0x1016a9[_0x4f7b('0x4f')],null))[_0x4f7b('0x26')](respondWithResult(_0x3fb0d5,null))[_0x4f7b('0x49')](handleError(_0x3fb0d5,null));};exports['destroy']=function(_0x587baa,_0xabc42c){return db[_0x4f7b('0x2f')]['find']({'where':{'id':_0x587baa[_0x4f7b('0x4b')]['id']}})[_0x4f7b('0x26')](handleEntityNotFound(_0xabc42c,null))[_0x4f7b('0x26')](removeEntity(_0xabc42c,null))[_0x4f7b('0x49')](handleError(_0xabc42c,null));};exports['preview']=function(_0x38c89a,_0xa1128){var _0x14dad8=0xa;var _0x42b378=[_0x4f7b('0x58'),_0x4f7b('0x59'),_0x4f7b('0x5a'),'cross_join'];var _0x529821={'SUM':'SUM(%s)','COUNT':_0x4f7b('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x4f7b('0x5c'),'GROUP_CONCAT ASC':_0x4f7b('0x5d'),'GROUP_CONCAT DESC':_0x4f7b('0x5e')};var _0x50d051={'SEC_TO_TIME':_0x4f7b('0x5f'),'DATE':_0x4f7b('0x60'),'HOUR':_0x4f7b('0x61'),'ROUND':_0x4f7b('0x62'),'UNIX_TIMESTAMP':_0x4f7b('0x63')};var _0x2a80fe=function(_0x31bed4){return!_[_0x4f7b('0x64')]([_0x4f7b('0x65'),_0x4f7b('0x66'),_0x4f7b('0x67'),_0x4f7b('0x68')],_0x31bed4);};var _0x1b1a02=function(_0x8f9464){if(!_0x8f9464||!_0x8f9464['rules'][_0x4f7b('0x3b')]){return'';}for(var _0x46d15c='(',_0x3c5b28=0x0;_0x3c5b28<_0x8f9464[_0x4f7b('0x69')][_0x4f7b('0x3b')];_0x3c5b28+=0x1){_0x3c5b28>0x0&&(_0x46d15c+='\x20'+_0x8f9464['operator']+'\x20');_0x46d15c+=_0x8f9464['rules'][_0x3c5b28][_0x4f7b('0x6a')]?_0x1b1a02(_0x8f9464['rules'][_0x3c5b28][_0x4f7b('0x6a')]):_0x8f9464[_0x4f7b('0x69')][_0x3c5b28][_0x4f7b('0x6b')]+'\x20'+_0x8f9464[_0x4f7b('0x69')][_0x3c5b28]['condition']+(_0x2a80fe(_0x8f9464[_0x4f7b('0x69')][_0x3c5b28][_0x4f7b('0x6c')])?'\x20'+_0x8f9464[_0x4f7b('0x69')][_0x3c5b28]['value']:'');}return _0x46d15c+')';};var _0x4b2089={'where':{'id':_0x38c89a[_0x4f7b('0x4b')]['id']}},_0x5b16cb,_0x3b6808,_0x5f5cb5,_0x49ff77,_0x4b33f5;_0x4b2089=_[_0x4f7b('0x44')]({},_0x4b2089,_0x38c89a[_0x4f7b('0x4c')]);return db['AnalyticCustomReport'][_0x4f7b('0x4d')](_0x4b2089)[_0x4f7b('0x26')](function(_0x56b3c7){if(_0x56b3c7){_0x5b16cb=_0x56b3c7;return _0x56b3c7['getFields']();}return null;})[_0x4f7b('0x26')](function(_0x431857){if(_0x431857){if(!_0x431857[_0x4f7b('0x3b')]){throw new db[(_0x4f7b('0x6d'))]['ValidationErrorItem'](_0x4f7b('0x6e'),0x193);}_0x3b6808=_0x431857;return db[_0x4f7b('0x6f')][_0x4f7b('0x47')]({'raw':!![]});}return null;})[_0x4f7b('0x26')](function(_0x2ac8db){if(_0x2ac8db){_0x5f5cb5=_[_0x4f7b('0x70')](_0x2ac8db,'id');var _0x54cd1f;var _0x1fa0fd=squel[_0x4f7b('0x71')]();_0x1fa0fd[_0x4f7b('0x72')](_0x5b16cb[_0x4f7b('0x73')]);for(var _0x1ca442=0x0;_0x1ca442<_0x3b6808['length'];_0x1ca442+=0x1){_0x54cd1f=_0x3b6808[_0x1ca442]['MetricId']?_0x5f5cb5[_0x3b6808[_0x1ca442]['MetricId']][_0x4f7b('0x74')]:_0x3b6808[_0x1ca442][_0x4f7b('0x6b')];_0x54cd1f=_0x3b6808[_0x1ca442][_0x4f7b('0x75')]?_[_0x4f7b('0x76')](_0x529821[_0x3b6808[_0x1ca442][_0x4f7b('0x75')]],'%s',_0x54cd1f):_0x54cd1f;_0x54cd1f=_0x3b6808[_0x1ca442]['format']?_[_0x4f7b('0x76')](_0x50d051[_0x3b6808[_0x1ca442][_0x4f7b('0x77')]],'%s',_0x54cd1f):_0x54cd1f;if(_0x3b6808[_0x1ca442][_0x4f7b('0x78')]){_0x1fa0fd[_0x4f7b('0x6a')](_0x54cd1f);}_0x3b6808[_0x1ca442][_0x4f7b('0x79')]&&_0x1fa0fd[_0x4f7b('0x3f')](_0x54cd1f,_0x3b6808[_0x1ca442][_0x4f7b('0x79')]===_0x4f7b('0x7a')?![]:!![]);_0x1fa0fd[_0x4f7b('0x6b')](_0x54cd1f,_0x3b6808[_0x1ca442][_0x4f7b('0x7b')]||_0x54cd1f);}if(_0x5b16cb[_0x4f7b('0x7c')]){_0x5b16cb[_0x4f7b('0x7c')]=JSON[_0x4f7b('0x7d')](_0x5b16cb[_0x4f7b('0x7c')]);for(var _0x3b126f=0x0;_0x3b126f<_0x5b16cb[_0x4f7b('0x7c')][_0x4f7b('0x3b')];_0x3b126f+=0x1){if(_0x5b16cb[_0x4f7b('0x7c')][_0x3b126f]['type']&&_['includes'](_0x42b378,_0x5b16cb[_0x4f7b('0x7c')][_0x3b126f][_0x4f7b('0x32')])&&_0x5b16cb[_0x4f7b('0x7c')][_0x3b126f][_0x4f7b('0x7e')]&&_0x5b16cb['joins'][_0x3b126f][_0x4f7b('0x7f')]&&_0x5b16cb[_0x4f7b('0x7c')][_0x3b126f][_0x4f7b('0x80')]){_0x1fa0fd[_0x5b16cb[_0x4f7b('0x7c')][_0x3b126f][_0x4f7b('0x32')]](_0x5b16cb[_0x4f7b('0x7c')][_0x3b126f][_0x4f7b('0x7f')],null,util[_0x4f7b('0x77')](_0x4f7b('0x81'),_0x5b16cb[_0x4f7b('0x73')],_0x5b16cb[_0x4f7b('0x7c')][_0x3b126f][_0x4f7b('0x7e')],_0x5b16cb[_0x4f7b('0x7c')][_0x3b126f][_0x4f7b('0x7f')],_0x5b16cb[_0x4f7b('0x7c')][_0x3b126f]['foreignKey']));}}}if(_0x5b16cb[_0x4f7b('0x82')]){_0x5b16cb[_0x4f7b('0x82')]=JSON['parse'](_0x5b16cb['conditions']);_0x1fa0fd[_0x4f7b('0x41')](_0x1b1a02(_0x5b16cb[_0x4f7b('0x82')][_0x4f7b('0x6a')]));}_0x4b33f5=_0x1fa0fd[_0x4f7b('0x83')]();_0x1fa0fd[_0x4f7b('0x3e')](_0x14dad8);_0x1fa0fd[_0x4f7b('0x1f')](0x0);logger[_0x4f7b('0x84')]('Limited\x20Query:',_0x1fa0fd['toString']());return dbH[_0x4f7b('0x85')][_0x4f7b('0x35')](_0x1fa0fd[_0x4f7b('0x86')](),{'type':dbH[_0x4f7b('0x85')]['QueryTypes'][_0x4f7b('0x87')]});}})[_0x4f7b('0x26')](respondWithResult(_0xa1128,null))['catch'](handleError(_0xa1128,null));};function runReport(_0x6aef20,_0x247541,_0x50aabe){var _0x4b7f8d=_0x247541[_0x4f7b('0x2c')];var _0x5f00cd=0xa;var _0x58d04a=['join',_0x4f7b('0x59'),'right_join',_0x4f7b('0x88')];var _0x1e33d2={'SUM':_0x4f7b('0x89'),'COUNT':_0x4f7b('0x5b'),'COUNT DISTINCT':_0x4f7b('0x8a'),'MAX':_0x4f7b('0x8b'),'MIN':_0x4f7b('0x8c'),'AVG':_0x4f7b('0x8d'),'GROUP_CONCAT':_0x4f7b('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4f7b('0x5e')};var _0x35c3cb={'SEC_TO_TIME':_0x4f7b('0x5f'),'DATE':_0x4f7b('0x60'),'HOUR':_0x4f7b('0x61'),'ROUND':_0x4f7b('0x62'),'UNIX_TIMESTAMP':_0x4f7b('0x63')};var _0x342478=function(_0x52e632){return!_[_0x4f7b('0x64')]([_0x4f7b('0x65'),_0x4f7b('0x66'),'IS\x20EMPTY',_0x4f7b('0x68')],_0x52e632);};var _0x589972=function(_0xc7cb31){if(!_0xc7cb31||!_0xc7cb31[_0x4f7b('0x69')]['length']){return'';}for(var _0x5d4c37='(',_0xb719e6=0x0;_0xb719e6<_0xc7cb31['rules'][_0x4f7b('0x3b')];_0xb719e6+=0x1){_0xb719e6>0x0&&(_0x5d4c37+='\x20'+_0xc7cb31['operator']+'\x20');_0x5d4c37+=_0xc7cb31[_0x4f7b('0x69')][_0xb719e6][_0x4f7b('0x6a')]?_0x589972(_0xc7cb31[_0x4f7b('0x69')][_0xb719e6]['group']):_0xc7cb31[_0x4f7b('0x69')][_0xb719e6]['field']+'\x20'+_0xc7cb31[_0x4f7b('0x69')][_0xb719e6][_0x4f7b('0x6c')]+(_0x342478(_0xc7cb31[_0x4f7b('0x69')][_0xb719e6][_0x4f7b('0x6c')])?'\x20'+_0xc7cb31[_0x4f7b('0x69')][_0xb719e6][_0x4f7b('0x8e')]:'');}return _0x5d4c37+')';};var _0x1aad59={'where':{'id':_0x6aef20['id']}},_0x514c3c,_0x33d890,_0x5d6ed2,_0x55de73,_0x5a24d8;_0x1aad59=_[_0x4f7b('0x44')]({},_0x1aad59,_0x50aabe);return db['AnalyticCustomReport'][_0x4f7b('0x4d')](_0x1aad59)[_0x4f7b('0x26')](function(_0x20ea43){if(_0x20ea43){_0x514c3c=_0x20ea43;return _0x20ea43[_0x4f7b('0x8f')]();}return null;})[_0x4f7b('0x26')](function(_0x3f5f81){if(_0x3f5f81){if(!_0x3f5f81[_0x4f7b('0x3b')]){throw new db[(_0x4f7b('0x6d'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x33d890=_0x3f5f81;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4f7b('0x26')](function(_0x34bca4){if(_0x34bca4){_0x5d6ed2=_[_0x4f7b('0x70')](_0x34bca4,'id');var _0x4a384e;var _0x2133c5=squel['select']();_0x2133c5[_0x4f7b('0x72')](_0x514c3c[_0x4f7b('0x73')]);for(var _0x478ac6=0x0;_0x478ac6<_0x33d890[_0x4f7b('0x3b')];_0x478ac6+=0x1){_0x4a384e=_0x33d890[_0x478ac6][_0x4f7b('0x90')]?_0x5d6ed2[_0x33d890[_0x478ac6][_0x4f7b('0x90')]]['metric']:_0x33d890[_0x478ac6][_0x4f7b('0x6b')];_0x4a384e=_0x33d890[_0x478ac6][_0x4f7b('0x75')]?_[_0x4f7b('0x76')](_0x1e33d2[_0x33d890[_0x478ac6][_0x4f7b('0x75')]],'%s',_0x4a384e):_0x4a384e;_0x4a384e=_0x33d890[_0x478ac6][_0x4f7b('0x77')]?_[_0x4f7b('0x76')](_0x35c3cb[_0x33d890[_0x478ac6][_0x4f7b('0x77')]],'%s',_0x4a384e):_0x4a384e;if(_0x33d890[_0x478ac6][_0x4f7b('0x78')]){_0x2133c5[_0x4f7b('0x6a')](_0x4a384e);}_0x33d890[_0x478ac6]['orderBy']&&_0x2133c5[_0x4f7b('0x3f')](_0x4a384e,_0x33d890[_0x478ac6]['orderBy']==='DESC'?![]:!![]);_0x2133c5[_0x4f7b('0x6b')](_0x4a384e,_0x33d890[_0x478ac6][_0x4f7b('0x7b')]||_0x4a384e);}if(_0x514c3c['joins']){_0x514c3c['joins']=JSON[_0x4f7b('0x7d')](_0x514c3c['joins']);for(var _0x13c2e4=0x0;_0x13c2e4<_0x514c3c[_0x4f7b('0x7c')][_0x4f7b('0x3b')];_0x13c2e4+=0x1){if(_0x514c3c[_0x4f7b('0x7c')][_0x13c2e4][_0x4f7b('0x32')]&&_[_0x4f7b('0x64')](_0x58d04a,_0x514c3c[_0x4f7b('0x7c')][_0x13c2e4][_0x4f7b('0x32')])&&_0x514c3c['joins'][_0x13c2e4][_0x4f7b('0x7e')]&&_0x514c3c[_0x4f7b('0x7c')][_0x13c2e4][_0x4f7b('0x7f')]&&_0x514c3c[_0x4f7b('0x7c')][_0x13c2e4][_0x4f7b('0x80')]){_0x2133c5[_0x514c3c[_0x4f7b('0x7c')][_0x13c2e4][_0x4f7b('0x32')]](_0x514c3c['joins'][_0x13c2e4][_0x4f7b('0x7f')],null,util[_0x4f7b('0x77')](_0x4f7b('0x81'),_0x514c3c[_0x4f7b('0x73')],_0x514c3c[_0x4f7b('0x7c')][_0x13c2e4][_0x4f7b('0x7e')],_0x514c3c[_0x4f7b('0x7c')][_0x13c2e4][_0x4f7b('0x7f')],_0x514c3c[_0x4f7b('0x7c')][_0x13c2e4]['foreignKey']));}}}if(_0x514c3c['conditions']){_0x514c3c['conditions']=JSON['parse'](_0x514c3c[_0x4f7b('0x82')]);_0x2133c5[_0x4f7b('0x41')](_0x589972(_0x514c3c[_0x4f7b('0x82')][_0x4f7b('0x6a')]));}_0x5a24d8=_0x2133c5[_0x4f7b('0x83')]();_0x2133c5[_0x4f7b('0x3e')](_0x5f00cd);_0x2133c5[_0x4f7b('0x1f')](0x0);return;}})['then'](function(){if(_0x247541[_0x4f7b('0x91')]===_0x4f7b('0x92')){return null;}var _0x39ec96=_[_0x4f7b('0x44')](_0x247541,{'name':_0x247541['fullPath']||_0x247541[_0x4f7b('0x2c')]||_0x514c3c[_0x4f7b('0x2c')],'basename':_0x4b7f8d,'savename':util[_0x4f7b('0x77')]('%s-%s.%s',_0x247541[_0x4f7b('0x2c')]||_0x514c3c[_0x4f7b('0x2c')],require(_0x4f7b('0x93'))[_0x4f7b('0x94')](0x4),_0x247541[_0x4f7b('0x91')]||_0x4f7b('0x95')),'reportId':_0x514c3c['id'],'reportType':_0x4f7b('0x96')});return db[_0x4f7b('0x97')][_0x4f7b('0x4e')](_0x39ec96,{'raw':!![]});})[_0x4f7b('0x26')](function(_0x2365a8){if(_0x514c3c[_0x4f7b('0x73')]==='cdr'){_0x5a24d8['where'](_0x514c3c[_0x4f7b('0x73')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x247541[_0x4f7b('0x98')],_0x247541[_0x4f7b('0x99')]);}else{_0x5a24d8['where'](_0x514c3c[_0x4f7b('0x73')]+_0x4f7b('0x9a'),_0x247541['startDate'],_0x247541['endDate']);}if(_0x2365a8){logger['info'](_0x4f7b('0x9b'),_0x5a24d8['toString']());require('child_process')[_0x4f7b('0x9c')](path[_0x4f7b('0x58')](__dirname,_0x4f7b('0x9d'),_0x2365a8[_0x4f7b('0x91')]),[_0x2365a8['id'],_0x5a24d8[_0x4f7b('0x86')](),path[_0x4f7b('0x58')](__dirname,'../../files/reports',_0x2365a8[_0x4f7b('0x9e')]),_0x4b7f8d]);return _0x2365a8;}else{var _0x1ebf36=squel['select']();_0x1ebf36[_0x4f7b('0x72')]('('+_0x5a24d8['toString']()+')','countTable');_0x1ebf36['field'](_0x4f7b('0x9f'),_0x4f7b('0x1e'));_0x5a24d8[_0x4f7b('0x3e')](_0x247541[_0x4f7b('0x3e')]||_0x5f00cd);_0x5a24d8['offset'](_0x247541[_0x4f7b('0x1f')]||0x0);return dbH['sequelize']['query'](_0x1ebf36['toString'](),{'type':dbH['sequelize'][_0x4f7b('0xa0')][_0x4f7b('0x87')]})[_0x4f7b('0x26')](function(_0x218d56){if(!_0x218d56[_0x4f7b('0x3b')]){_0x55de73=0x0;}else{_0x55de73=_0x218d56[0x0]['count']||0x0;}return dbH[_0x4f7b('0x85')][_0x4f7b('0x35')](_0x5a24d8[_0x4f7b('0x86')](),{'type':dbH[_0x4f7b('0x85')][_0x4f7b('0xa0')][_0x4f7b('0x87')]});})['then'](function(_0x26b2cd){return{'rows':_0x26b2cd||[],'count':_0x55de73};});}});}exports['run']=function(_0x1b0e87,_0x2339d6){return runReport(_0x1b0e87[_0x4f7b('0x4b')],_0x1b0e87[_0x4f7b('0x35')],_0x1b0e87[_0x4f7b('0x4c')])[_0x4f7b('0x26')](respondWithResult(_0x2339d6,null))[_0x4f7b('0x49')](handleError(_0x2339d6,null));};exports[_0x4f7b('0xa1')]=runReport;exports[_0x4f7b('0x35')]=function(_0x2e9ac8,_0x2ad7f6){var _0x2967c0=0xa;var _0x4f58f1=['join',_0x4f7b('0x59'),_0x4f7b('0x5a'),_0x4f7b('0x88')];var _0x13d7cd={'SUM':_0x4f7b('0x89'),'COUNT':_0x4f7b('0x5b'),'COUNT DISTINCT':_0x4f7b('0x8a'),'MAX':_0x4f7b('0x8b'),'MIN':_0x4f7b('0x8c'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x4f7b('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x10d15f={'SEC_TO_TIME':_0x4f7b('0x5f'),'DATE':_0x4f7b('0x60'),'HOUR':_0x4f7b('0x61'),'ROUND':_0x4f7b('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x324ee3=function(_0x287aae){return!_[_0x4f7b('0x64')](['IS\x20NULL',_0x4f7b('0x66'),_0x4f7b('0x67'),_0x4f7b('0x68')],_0x287aae);};var _0x1896d6=function(_0x58cf43){if(!_0x58cf43||!_0x58cf43[_0x4f7b('0x69')]['length']){return'';}for(var _0x407fb8='(',_0x3866c0=0x0;_0x3866c0<_0x58cf43[_0x4f7b('0x69')][_0x4f7b('0x3b')];_0x3866c0+=0x1){_0x3866c0>0x0&&(_0x407fb8+='\x20'+_0x58cf43[_0x4f7b('0xa2')]+'\x20');_0x407fb8+=_0x58cf43[_0x4f7b('0x69')][_0x3866c0][_0x4f7b('0x6a')]?_0x1896d6(_0x58cf43[_0x4f7b('0x69')][_0x3866c0][_0x4f7b('0x6a')]):_0x58cf43[_0x4f7b('0x69')][_0x3866c0][_0x4f7b('0x6b')]+'\x20'+_0x58cf43[_0x4f7b('0x69')][_0x3866c0][_0x4f7b('0x6c')]+(_0x324ee3(_0x58cf43[_0x4f7b('0x69')][_0x3866c0][_0x4f7b('0x6c')])?'\x20'+_0x58cf43[_0x4f7b('0x69')][_0x3866c0][_0x4f7b('0x8e')]:'');}return _0x407fb8+')';};var _0x4904be={'where':{'id':_0x2e9ac8['params']['id']}},_0x5561cb,_0x50a1e5,_0x2b5a28,_0x4f548d,_0x2a9e64;_0x4904be=_[_0x4f7b('0x44')]({},_0x4904be,_0x2e9ac8[_0x4f7b('0x4c')]);return db[_0x4f7b('0x2f')][_0x4f7b('0x4d')](_0x4904be)['then'](function(_0x4b8b02){if(_0x4b8b02){_0x5561cb=_0x4b8b02;return _0x4b8b02[_0x4f7b('0x8f')]();}return null;})[_0x4f7b('0x26')](function(_0x5d4442){if(_0x5d4442){if(!_0x5d4442['length']){throw new db[(_0x4f7b('0x6d'))]['ValidationErrorItem'](_0x4f7b('0x6e'),0x193);}_0x50a1e5=_0x5d4442;return db['AnalyticMetric'][_0x4f7b('0x47')]({'raw':!![]});}return null;})[_0x4f7b('0x26')](function(_0x442037){if(_0x442037){_0x2b5a28=_[_0x4f7b('0x70')](_0x442037,'id');var _0x3f0c8c;var _0x6585d5=squel[_0x4f7b('0x71')]();_0x6585d5[_0x4f7b('0x72')](_0x5561cb[_0x4f7b('0x73')]);for(var _0x726e61=0x0;_0x726e61<_0x50a1e5[_0x4f7b('0x3b')];_0x726e61+=0x1){_0x3f0c8c=_0x50a1e5[_0x726e61]['MetricId']?_0x2b5a28[_0x50a1e5[_0x726e61][_0x4f7b('0x90')]]['metric']:_0x50a1e5[_0x726e61][_0x4f7b('0x6b')];_0x3f0c8c=_0x50a1e5[_0x726e61][_0x4f7b('0x75')]?_[_0x4f7b('0x76')](_0x13d7cd[_0x50a1e5[_0x726e61][_0x4f7b('0x75')]],'%s',_0x3f0c8c):_0x3f0c8c;_0x3f0c8c=_0x50a1e5[_0x726e61][_0x4f7b('0x77')]?_['replace'](_0x10d15f[_0x50a1e5[_0x726e61]['format']],'%s',_0x3f0c8c):_0x3f0c8c;if(_0x50a1e5[_0x726e61][_0x4f7b('0x78')]){_0x6585d5[_0x4f7b('0x6a')](_0x3f0c8c);}_0x50a1e5[_0x726e61]['orderBy']&&_0x6585d5[_0x4f7b('0x3f')](_0x3f0c8c,_0x50a1e5[_0x726e61][_0x4f7b('0x79')]===_0x4f7b('0x7a')?![]:!![]);_0x6585d5[_0x4f7b('0x6b')](_0x3f0c8c,_0x50a1e5[_0x726e61][_0x4f7b('0x7b')]||_0x3f0c8c);}if(_0x5561cb['joins']){_0x5561cb[_0x4f7b('0x7c')]=JSON[_0x4f7b('0x7d')](_0x5561cb[_0x4f7b('0x7c')]);for(var _0xdb78d=0x0;_0xdb78d<_0x5561cb[_0x4f7b('0x7c')][_0x4f7b('0x3b')];_0xdb78d+=0x1){if(_0x5561cb[_0x4f7b('0x7c')][_0xdb78d][_0x4f7b('0x32')]&&_['includes'](_0x4f58f1,_0x5561cb[_0x4f7b('0x7c')][_0xdb78d]['type'])&&_0x5561cb[_0x4f7b('0x7c')][_0xdb78d][_0x4f7b('0x7e')]&&_0x5561cb['joins'][_0xdb78d][_0x4f7b('0x7f')]&&_0x5561cb[_0x4f7b('0x7c')][_0xdb78d][_0x4f7b('0x80')]){_0x6585d5[_0x5561cb[_0x4f7b('0x7c')][_0xdb78d][_0x4f7b('0x32')]](_0x5561cb[_0x4f7b('0x7c')][_0xdb78d][_0x4f7b('0x7f')],null,util[_0x4f7b('0x77')]('%s.%s\x20=\x20%s.%s',_0x5561cb[_0x4f7b('0x73')],_0x5561cb[_0x4f7b('0x7c')][_0xdb78d][_0x4f7b('0x7e')],_0x5561cb['joins'][_0xdb78d][_0x4f7b('0x7f')],_0x5561cb[_0x4f7b('0x7c')][_0xdb78d][_0x4f7b('0x80')]));}}}if(_0x5561cb['conditions']){_0x5561cb[_0x4f7b('0x82')]=JSON[_0x4f7b('0x7d')](_0x5561cb[_0x4f7b('0x82')]);_0x6585d5['where'](_0x1896d6(_0x5561cb[_0x4f7b('0x82')]['group']));}_0x2a9e64=_0x6585d5[_0x4f7b('0x83')]();_0x6585d5[_0x4f7b('0x3e')](_0x2967c0);_0x6585d5[_0x4f7b('0x1f')](0x0);logger[_0x4f7b('0x84')](_0x4f7b('0xa3'),_0x6585d5['toString']());return dbH['sequelize'][_0x4f7b('0x35')](_0x6585d5[_0x4f7b('0x86')](),{'type':dbH[_0x4f7b('0x85')]['QueryTypes']['SELECT']});}})[_0x4f7b('0x26')](function(){return{'sql':_0x2a9e64['toString']()};})[_0x4f7b('0x26')](respondWithResult(_0x2ad7f6,null))[_0x4f7b('0x49')](handleError(_0x2ad7f6,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 75af13f..d5eefde 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 _0xef1a=['AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./analyticCustomReport.attributes','exports','define'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xef1a,0x146));var _0xaef1=function(_0x16e459,_0x48e6f3){_0x16e459=_0x16e459-0x0;var _0x5e80ad=_0xef1a[_0x16e459];return _0x5e80ad;};'use strict';var _=require('lodash');var util=require(_0xaef1('0x0'));var logger=require(_0xaef1('0x1'))(_0xaef1('0x2'));var moment=require(_0xaef1('0x3'));var BPromise=require(_0xaef1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaef1('0x5'));var rimraf=require('rimraf');var config=require(_0xaef1('0x6'));var attributes=require(_0xaef1('0x7'));module[_0xaef1('0x8')]=function(_0x1e2d6e,_0x4991cd){return _0x1e2d6e[_0xaef1('0x9')](_0xaef1('0xa'),attributes,{'tableName':_0xaef1('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7bd=['analytics_custom_reports','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./analyticCustomReport.attributes','exports','AnalyticCustomReport'];(function(_0x5944ce,_0x1f2262){var _0x4e52bb=function(_0x4c628a){while(--_0x4c628a){_0x5944ce['push'](_0x5944ce['shift']());}};_0x4e52bb(++_0x1f2262);}(_0xf7bd,0xfb));var _0xdf7b=function(_0x5df780,_0x3460c8){_0x5df780=_0x5df780-0x0;var _0x535f5b=_0xf7bd[_0x5df780];return _0x535f5b;};'use strict';var _=require(_0xdf7b('0x0'));var util=require(_0xdf7b('0x1'));var logger=require(_0xdf7b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdf7b('0x3'));var rp=require(_0xdf7b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf7b('0x5'));var config=require('../../config/environment');var attributes=require(_0xdf7b('0x6'));module[_0xdf7b('0x7')]=function(_0x5bdec5,_0x4dcbb9){return _0x5bdec5['define'](_0xdf7b('0x8'),attributes,{'tableName':_0xdf7b('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 25548f1..206f4b9 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 _0x650c=['http','request','then','info','request\x20sent','debug','stringify','error','AnalyticCustomReport,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise'];(function(_0x10f0a5,_0x45ff64){var _0x563a85=function(_0x7b7bd2){while(--_0x7b7bd2){_0x10f0a5['push'](_0x10f0a5['shift']());}};_0x563a85(++_0x45ff64);}(_0x650c,0x1df));var _0xc650=function(_0x22875e,_0xb601fb){_0x22875e=_0x22875e-0x0;var _0x934224=_0x650c[_0x22875e];return _0x934224;};'use strict';var _=require(_0xc650('0x0'));var util=require('util');var moment=require(_0xc650('0x1'));var BPromise=require(_0xc650('0x2'));var rs=require(_0xc650('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc650('0x4'));var config=require(_0xc650('0x5'));var jayson=require(_0xc650('0x6'));var client=jayson['client'][_0xc650('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x48d968,_0x4e6182,_0x41d0e4){return new BPromise(function(_0x5db9d3,_0x4c9d3b){return client[_0xc650('0x8')](_0x48d968,_0x41d0e4)[_0xc650('0x9')](function(_0x5436ad){logger[_0xc650('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4e6182,_0xc650('0xb'));logger[_0xc650('0xc')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4e6182,_0xc650('0xb'),JSON[_0xc650('0xd')](_0x5436ad));if(_0x5436ad[_0xc650('0xe')]){if(_0x5436ad[_0xc650('0xe')]['code']===0x1f4){logger[_0xc650('0xe')](_0xc650('0xf'),_0x4e6182,_0x5436ad[_0xc650('0xe')][_0xc650('0x10')]);return _0x4c9d3b(_0x5436ad[_0xc650('0xe')][_0xc650('0x10')]);}logger[_0xc650('0xe')](_0xc650('0xf'),_0x4e6182,_0x5436ad[_0xc650('0xe')][_0xc650('0x10')]);return _0x5db9d3(_0x5436ad['error']['message']);}else{logger[_0xc650('0xa')](_0xc650('0xf'),_0x4e6182,'request\x20sent');_0x5db9d3(_0x5436ad['result'][_0xc650('0x10')]);}})[_0xc650('0x11')](function(_0x3d9624){logger[_0xc650('0xe')](_0xc650('0xf'),_0x4e6182,_0x3d9624);_0x4c9d3b(_0x3d9624);});});} \ No newline at end of file +var _0x7600=['debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0xcbdad1,_0x5c7032){var _0x359da2=function(_0x333e31){while(--_0x333e31){_0xcbdad1['push'](_0xcbdad1['shift']());}};_0x359da2(++_0x5c7032);}(_0x7600,0x13c));var _0x0760=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x7600[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0x0760('0x0'));var util=require(_0x0760('0x1'));var moment=require(_0x0760('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0760('0x3'));var db=require(_0x0760('0x4'))['db'];var utils=require(_0x0760('0x5'));var logger=require(_0x0760('0x6'))(_0x0760('0x7'));var config=require(_0x0760('0x8'));var jayson=require(_0x0760('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a5d4b,_0x5fe917,_0xe84154){return new BPromise(function(_0xdc4de3,_0x25e556){return client[_0x0760('0xa')](_0x3a5d4b,_0xe84154)[_0x0760('0xb')](function(_0x292592){logger[_0x0760('0xc')](_0x0760('0xd'),_0x5fe917,'request\x20sent');logger[_0x0760('0xe')](_0x0760('0xf'),_0x5fe917,_0x0760('0x10'),JSON[_0x0760('0x11')](_0x292592));if(_0x292592[_0x0760('0x12')]){if(_0x292592[_0x0760('0x12')][_0x0760('0x13')]===0x1f4){logger[_0x0760('0x12')](_0x0760('0xd'),_0x5fe917,_0x292592['error'][_0x0760('0x14')]);return _0x25e556(_0x292592[_0x0760('0x12')]['message']);}logger[_0x0760('0x12')](_0x0760('0xd'),_0x5fe917,_0x292592[_0x0760('0x12')]['message']);return _0xdc4de3(_0x292592['error'][_0x0760('0x14')]);}else{logger[_0x0760('0xc')](_0x0760('0xd'),_0x5fe917,'request\x20sent');_0xdc4de3(_0x292592['result'][_0x0760('0x14')]);}})[_0x0760('0x15')](function(_0x229d99){logger['error'](_0x0760('0xd'),_0x5fe917,_0x229d99);_0x25e556(_0x229d99);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 35c4c36..4bf8eb1 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 _0xb6fa=['/:id/preview','run','/:id/query','query','post','create','put','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id'];(function(_0x50bee7,_0x60c9e){var _0x2c60f9=function(_0x394ff2){while(--_0x394ff2){_0x50bee7['push'](_0x50bee7['shift']());}};_0x2c60f9(++_0x60c9e);}(_0xb6fa,0x185));var _0xab6f=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0xb6fa[_0x1ebce2];return _0x4a330c;};'use strict';var multer=require(_0xab6f('0x0'));var util=require(_0xab6f('0x1'));var path=require('path');var timeout=require(_0xab6f('0x2'));var express=require('express');var router=express[_0xab6f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xab6f('0x4'));var interaction=require(_0xab6f('0x5'));var config=require('../../config/environment');var controller=require(_0xab6f('0x6'));router[_0xab6f('0x7')]('/',auth[_0xab6f('0x8')](),controller[_0xab6f('0x9')]);router['get'](_0xab6f('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xab6f('0xb'),auth[_0xab6f('0x8')](),controller['preview']);router['get']('/:id/run',auth[_0xab6f('0x8')](),controller[_0xab6f('0xc')]);router[_0xab6f('0x7')](_0xab6f('0xd'),auth[_0xab6f('0x8')](),controller[_0xab6f('0xe')]);router[_0xab6f('0xf')]('/',auth[_0xab6f('0x8')](),controller[_0xab6f('0x10')]);router[_0xab6f('0x11')](_0xab6f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xab6f('0x12')](_0xab6f('0xa'),auth[_0xab6f('0x8')](),controller[_0xab6f('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5dc5=['show','preview','/:id/run','/:id/query','query','post','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x488bfd,_0x25d5b3){var _0x408153=function(_0x145a8b){while(--_0x145a8b){_0x488bfd['push'](_0x488bfd['shift']());}};_0x408153(++_0x25d5b3);}(_0x5dc5,0x16c));var _0x55dc=function(_0x110862,_0x2fb05b){_0x110862=_0x110862-0x0;var _0x5c3c0a=_0x5dc5[_0x110862];return _0x5c3c0a;};'use strict';var multer=require(_0x55dc('0x0'));var util=require(_0x55dc('0x1'));var path=require(_0x55dc('0x2'));var timeout=require(_0x55dc('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x55dc('0x4'));var auth=require(_0x55dc('0x5'));var interaction=require(_0x55dc('0x6'));var config=require(_0x55dc('0x7'));var controller=require('./analyticCustomReport.controller');router[_0x55dc('0x8')]('/',auth[_0x55dc('0x9')](),controller['index']);router[_0x55dc('0x8')]('/:id',auth[_0x55dc('0x9')](),controller[_0x55dc('0xa')]);router[_0x55dc('0x8')]('/:id/preview',auth[_0x55dc('0x9')](),controller[_0x55dc('0xb')]);router[_0x55dc('0x8')](_0x55dc('0xc'),auth[_0x55dc('0x9')](),controller['run']);router['get'](_0x55dc('0xd'),auth['isAuthenticated'](),controller[_0x55dc('0xe')]);router[_0x55dc('0xf')]('/',auth[_0x55dc('0x9')](),controller[_0x55dc('0x10')]);router['put']('/:id',auth[_0x55dc('0x9')](),controller[_0x55dc('0x11')]);router[_0x55dc('0x12')](_0x55dc('0x13'),auth['isAuthenticated'](),controller[_0x55dc('0x14')]);module[_0x55dc('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 555b133..10946ef 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 _0x71ab=['TEXT','exports','STRING'];(function(_0x17cc54,_0xfeeb29){var _0x10b93e=function(_0x57b1b3){while(--_0x57b1b3){_0x17cc54['push'](_0x17cc54['shift']());}};_0x10b93e(++_0xfeeb29);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb71a('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb71a('0x1')]},'conditions':{'type':Sequelize[_0xb71a('0x2')]},'joins':{'type':Sequelize[_0xb71a('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','TEXT','sequelize'];(function(_0x210977,_0x1216d2){var _0x248ccb=function(_0x18304b){while(--_0x18304b){_0x210977['push'](_0x210977['shift']());}};_0x248ccb(++_0x1216d2);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7995('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x7995('0x2')]},'conditions':{'type':Sequelize[_0x7995('0x3')]},'joins':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 079c727..cde6b65 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 _0x46ed=['SEC_TO_TIME(%s)','value','AnalyticMetric','select','DESC','output','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','sequelize','runReport','left_join','COUNT(%s)','MIN(%s)','AVG(%s)','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','QueryTypes','SELECT'];(function(_0x2a87fc,_0x30a039){var _0x32d9f5=function(_0x2e157c){while(--_0x2e157c){_0x2a87fc['push'](_0x2a87fc['shift']());}};_0x32d9f5(++_0x30a039);}(_0x46ed,0x168));var _0xd46e=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x46ed[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xf3048c,_0x27dbfb){_0x27dbfb=_0x27dbfb||0xcc;return function(_0x53b309){if(_0x53b309){return _0xf3048c['sendStatus'](_0x27dbfb);}return _0xf3048c[_0xd46e('0x1a')](_0x27dbfb)[_0xd46e('0x1b')]();};}function respondWithResult(_0x1e9aae,_0x3fdf88){_0x3fdf88=_0x3fdf88||0xc8;return function(_0x50c7c3){if(_0x50c7c3){return _0x1e9aae[_0xd46e('0x1a')](_0x3fdf88)[_0xd46e('0x1c')](_0x50c7c3);}};}function respondWithFilteredResult(_0x417402,_0x3d72ce){return function(_0x36a317){if(_0x36a317){var _0x47fa8f=typeof _0x3d72ce[_0xd46e('0x1d')]===_0xd46e('0x1e')&&typeof _0x3d72ce[_0xd46e('0x1f')]==='undefined';var _0x5ddd04=_0x36a317[_0xd46e('0x20')];var _0x1bd574=_0x47fa8f?0x0:_0x3d72ce['offset'];var _0x4fd1f2=_0x47fa8f?_0x36a317[_0xd46e('0x20')]:_0x3d72ce[_0xd46e('0x1d')]+_0x3d72ce[_0xd46e('0x1f')];var _0x2273c5;if(_0x4fd1f2>=_0x5ddd04){_0x4fd1f2=_0x5ddd04;_0x2273c5=0xc8;}else{_0x2273c5=0xce;}_0x417402[_0xd46e('0x1a')](_0x2273c5);return _0x417402[_0xd46e('0x21')](_0xd46e('0x22'),_0x1bd574+'-'+_0x4fd1f2+'/'+_0x5ddd04)[_0xd46e('0x1c')](_0x36a317);}return null;};}function patchUpdates(_0xb4940){return function(_0x3c7e91){try{jsonpatch[_0xd46e('0x23')](_0x3c7e91,_0xb4940,!![]);}catch(_0x5ba94d){return BPromise[_0xd46e('0x24')](_0x5ba94d);}return _0x3c7e91[_0xd46e('0x25')]();};}function saveUpdates(_0x79aa51,_0x45ce0b){return function(_0x128246){if(_0x128246){return _0x128246[_0xd46e('0x26')](_0x79aa51)[_0xd46e('0x27')](function(_0x8a1be){return _0x8a1be;});}return null;};}function removeEntity(_0x62dea5,_0x4cf899){return function(_0x314570){if(_0x314570){return _0x314570['destroy']()['then'](function(){var _0x371054=_0x314570[_0xd46e('0x28')]({'plain':!![]});var _0x21135f=_0xd46e('0x29');return db[_0xd46e('0x2a')][_0xd46e('0x2b')]({'where':{'type':_0x21135f,'resourceId':_0x371054['id']}})[_0xd46e('0x27')](function(){return _0x314570;});})['then'](function(){_0x62dea5[_0xd46e('0x1a')](0xcc)[_0xd46e('0x1b')]();});}};}function handleEntityNotFound(_0xddbce9,_0x17db79){return function(_0x96f15c){if(!_0x96f15c){_0xddbce9[_0xd46e('0x2c')](0x194);}return _0x96f15c;};}function handleError(_0x58aeef,_0x465d54){_0x465d54=_0x465d54||0x1f4;return function(_0x3a1ced){logger[_0xd46e('0x2d')](_0x3a1ced[_0xd46e('0x2e')]);if(_0x3a1ced[_0xd46e('0x2f')]){delete _0x3a1ced[_0xd46e('0x2f')];}_0x58aeef[_0xd46e('0x1a')](_0x465d54)[_0xd46e('0x30')](_0x3a1ced);};}exports[_0xd46e('0x31')]=function(_0x45ea47,_0x2ff785){var _0x504324={},_0x2f4a1b={},_0x5ed8dc={'count':0x0,'rows':[]};var _0x1248ce=_[_0xd46e('0x32')](db[_0xd46e('0x33')][_0xd46e('0x34')],function(_0x5ef248){return{'name':_0x5ef248[_0xd46e('0x35')],'type':_0x5ef248[_0xd46e('0x36')]['key']};});_0x2f4a1b[_0xd46e('0x37')]=_[_0xd46e('0x32')](_0x1248ce,'name');_0x2f4a1b[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x45ea47[_0xd46e('0x38')]);_0x2f4a1b['filters']=_['intersection'](_0x2f4a1b[_0xd46e('0x37')],_0x2f4a1b[_0xd46e('0x38')]);_0x504324[_0xd46e('0x3a')]=_[_0xd46e('0x3b')](_0x2f4a1b[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x504324['attributes']=_0x504324[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x504324[_0xd46e('0x3a')]:_0x2f4a1b[_0xd46e('0x37')];if(!_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3e')](_0xd46e('0x3f'))){_0x504324['limit']=qs[_0xd46e('0x1f')](_0x45ea47[_0xd46e('0x38')]['limit']);_0x504324[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x1d')]);}_0x504324['order']=qs[_0xd46e('0x40')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x40')]);_0x504324[_0xd46e('0x41')]=qs[_0xd46e('0x42')](_[_0xd46e('0x43')](_0x45ea47[_0xd46e('0x38')],_0x2f4a1b[_0xd46e('0x42')]),_0x1248ce);if(_0x45ea47['query'][_0xd46e('0x44')]){_0x504324[_0xd46e('0x41')]=_[_0xd46e('0x45')](_0x504324[_0xd46e('0x41')],{'$or':_[_0xd46e('0x32')](_0x1248ce,function(_0x56f99c){if(_0x56f99c[_0xd46e('0x36')]!=='VIRTUAL'){var _0x55230d={};_0x55230d[_0x56f99c['name']]={'$like':'%'+_0x45ea47['query'][_0xd46e('0x44')]+'%'};return _0x55230d;}})});}_0x504324=_['merge']({},_0x504324,_0x45ea47[_0xd46e('0x46')]);var _0x40720e={'where':_0x504324['where']};return db[_0xd46e('0x33')][_0xd46e('0x20')](_0x40720e)[_0xd46e('0x27')](function(_0x31ba12){_0x5ed8dc[_0xd46e('0x20')]=_0x31ba12;if(_0x45ea47[_0xd46e('0x38')][_0xd46e('0x47')]){_0x504324[_0xd46e('0x48')]=[{'all':!![]}];}return db[_0xd46e('0x33')][_0xd46e('0x49')](_0x504324);})[_0xd46e('0x27')](function(_0x5ea048){_0x5ed8dc['rows']=_0x5ea048;return _0x5ed8dc;})['then'](respondWithFilteredResult(_0x2ff785,_0x504324))[_0xd46e('0x4a')](handleError(_0x2ff785,null));};exports['show']=function(_0x168d35,_0x272f5f){var _0x3fdf67={'raw':!![],'where':{'id':_0x168d35[_0xd46e('0x4b')]['id']}},_0x416505={};_0x416505[_0xd46e('0x37')]=_[_0xd46e('0x39')](db[_0xd46e('0x33')]['rawAttributes']);_0x416505[_0xd46e('0x38')]=_['keys'](_0x168d35[_0xd46e('0x38')]);_0x416505[_0xd46e('0x42')]=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],_0x416505[_0xd46e('0x38')]);_0x3fdf67['attributes']=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x168d35[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x3fdf67['attributes']=_0x3fdf67[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x3fdf67[_0xd46e('0x3a')]:_0x416505[_0xd46e('0x37')];if(_0x168d35[_0xd46e('0x38')]['includeAll']){_0x3fdf67[_0xd46e('0x48')]=[{'all':!![]}];}_0x3fdf67=_[_0xd46e('0x45')]({},_0x3fdf67,_0x168d35[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fdf67)[_0xd46e('0x27')](handleEntityNotFound(_0x272f5f,null))[_0xd46e('0x27')](respondWithResult(_0x272f5f,null))[_0xd46e('0x4a')](handleError(_0x272f5f,null));};exports['create']=function(_0xf9dab,_0x71a8dc){return db[_0xd46e('0x33')][_0xd46e('0x4d')](_0xf9dab[_0xd46e('0x4e')],{})['then'](function(_0x4ae314){var _0x3a94cf=_0xf9dab[_0xd46e('0x4f')][_0xd46e('0x28')]({'plain':!![]});if(!_0x3a94cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a94cf['role']===_0xd46e('0x4f')){var _0x9d8638=_0x4ae314['get']({'plain':!![]});var _0x2eee92=_0xd46e('0x50');return db[_0xd46e('0x51')][_0xd46e('0x4c')]({'where':{'name':_0x2eee92,'userProfileId':_0x3a94cf[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x27')](function(_0x80ed51){if(_0x80ed51&&_0x80ed51[_0xd46e('0x53')]===0x0){return db['UserProfileResource'][_0xd46e('0x4d')]({'name':_0x9d8638[_0xd46e('0x2f')],'resourceId':_0x9d8638['id'],'type':_0xd46e('0x29'),'sectionId':_0x80ed51['id']},{})[_0xd46e('0x27')](function(){return _0x4ae314;});}else{return _0x4ae314;}})['catch'](function(_0x56dd9a){logger[_0xd46e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56dd9a);throw _0x56dd9a;});}return _0x4ae314;})[_0xd46e('0x27')](respondWithResult(_0x71a8dc,0xc9))[_0xd46e('0x4a')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x26')]=function(_0x31f7eb,_0x5a7870){if(_0x31f7eb[_0xd46e('0x4e')]['id']){delete _0x31f7eb['body']['id'];}return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x31f7eb[_0xd46e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7870,null))[_0xd46e('0x27')](saveUpdates(_0x31f7eb[_0xd46e('0x4e')],null))[_0xd46e('0x27')](respondWithResult(_0x5a7870,null))[_0xd46e('0x4a')](handleError(_0x5a7870,null));};exports[_0xd46e('0x2b')]=function(_0x2cc676,_0x2760ef){return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x2cc676[_0xd46e('0x4b')]['id']}})[_0xd46e('0x27')](handleEntityNotFound(_0x2760ef,null))[_0xd46e('0x27')](removeEntity(_0x2760ef,null))[_0xd46e('0x4a')](handleError(_0x2760ef,null));};exports[_0xd46e('0x54')]=function(_0x47a86c,_0x3ec709){var _0x37a22f=0xa;var _0xe0cd61=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0xaf9641={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x481dce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x2dacb4=function(_0x2f9fcb){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x2f9fcb);};var _0x1aaa99=function(_0x272514){if(!_0x272514||!_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x476f09='(',_0x5067b7=0x0;_0x5067b7<_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')];_0x5067b7+=0x1){_0x5067b7>0x0&&(_0x476f09+='\x20'+_0x272514[_0xd46e('0x68')]+'\x20');_0x476f09+=_0x272514['rules'][_0x5067b7][_0xd46e('0x69')]?_0x1aaa99(_0x272514[_0xd46e('0x67')][_0x5067b7]['group']):_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6a')]+'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['condition']+(_0x2dacb4(_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6b')])?'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['value']:'');}return _0x476f09+')';};var _0xe5f8cd={'where':{'id':_0x47a86c[_0xd46e('0x4b')]['id']}},_0x516e7d,_0x32eed0,_0x148187,_0x35db1b,_0x4f3ba0;_0xe5f8cd=_[_0xd46e('0x45')]({},_0xe5f8cd,_0x47a86c[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0xe5f8cd)[_0xd46e('0x27')](function(_0x16f906){if(_0x16f906){_0x516e7d=_0x16f906;return _0x16f906[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0x3e55a3){if(_0x3e55a3){if(!_0x3e55a3[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))](_0xd46e('0x6f'),0x193);}_0x32eed0=_0x3e55a3;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3e0ed5){if(_0x3e0ed5){_0x148187=_[_0xd46e('0x70')](_0x3e0ed5,'id');var _0x2fff69;var _0x249938=squel['select']();_0x249938[_0xd46e('0x71')](_0x516e7d[_0xd46e('0x72')]);for(var _0xfb4073=0x0;_0xfb4073<_0x32eed0[_0xd46e('0x3d')];_0xfb4073+=0x1){_0x2fff69=_0x32eed0[_0xfb4073]['MetricId']?_0x148187[_0x32eed0[_0xfb4073][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x32eed0[_0xfb4073]['field'];_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0xaf9641[_0x32eed0[_0xfb4073]['function']],'%s',_0x2fff69):_0x2fff69;_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x481dce[_0x32eed0[_0xfb4073]['format']],'%s',_0x2fff69):_0x2fff69;if(_0x32eed0[_0xfb4073][_0xd46e('0x78')]){_0x249938['group'](_0x2fff69);}_0x32eed0[_0xfb4073][_0xd46e('0x79')]&&_0x249938[_0xd46e('0x7a')](_0x2fff69,_0x32eed0[_0xfb4073]['orderBy']==='DESC'?![]:!![]);_0x249938[_0xd46e('0x6a')](_0x2fff69,_0x32eed0[_0xfb4073][_0xd46e('0x7b')]||_0x2fff69);}if(_0x516e7d[_0xd46e('0x7c')]){_0x516e7d[_0xd46e('0x7c')]=JSON['parse'](_0x516e7d[_0xd46e('0x7c')]);for(var _0x372509=0x0;_0x372509<_0x516e7d['joins'][_0xd46e('0x3d')];_0x372509+=0x1){if(_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0xe0cd61,_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')])&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7d')]&&_0x516e7d[_0xd46e('0x7c')][_0x372509]['foreignTable']&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7e')]){_0x249938[_0x516e7d['joins'][_0x372509][_0xd46e('0x36')]](_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0x516e7d[_0xd46e('0x72')],_0x516e7d['joins'][_0x372509]['parentKey'],_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],_0x516e7d['joins'][_0x372509]['foreignKey']));}}}if(_0x516e7d['conditions']){_0x516e7d[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x516e7d[_0xd46e('0x81')]);_0x249938['where'](_0x1aaa99(_0x516e7d[_0xd46e('0x81')][_0xd46e('0x69')]));}_0x4f3ba0=_0x249938[_0xd46e('0x83')]();_0x249938['limit'](_0x37a22f);_0x249938['offset'](0x0);logger['debug']('Limited\x20Query:',_0x249938[_0xd46e('0x84')]());return dbH['sequelize'][_0xd46e('0x38')](_0x249938['toString'](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](respondWithResult(_0x3ec709,null))[_0xd46e('0x4a')](handleError(_0x3ec709,null));};function runReport(_0xf16d87,_0x99872a,_0x57a7cc){var _0x586024=_0x99872a[_0xd46e('0x2f')];var _0x383919=0xa;var _0x114f2c=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0x4ca21f={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x5ef4cc={'SEC_TO_TIME':_0xd46e('0x87'),'DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x88460a=function(_0x3a3744){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x3a3744);};var _0x3c476d=function(_0x1b2a6d){if(!_0x1b2a6d||!_0x1b2a6d[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x441f73='(',_0x1d2738=0x0;_0x1d2738<_0x1b2a6d['rules'][_0xd46e('0x3d')];_0x1d2738+=0x1){_0x1d2738>0x0&&(_0x441f73+='\x20'+_0x1b2a6d['operator']+'\x20');_0x441f73+=_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x69')]?_0x3c476d(_0x1b2a6d['rules'][_0x1d2738][_0xd46e('0x69')]):_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6a')]+'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')]+(_0x88460a(_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')])?'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x88')]:'');}return _0x441f73+')';};var _0x3fa34d={'where':{'id':_0xf16d87['id']}},_0xc098c9,_0x5f5ba7,_0x493df5,_0x18e140,_0x459a0c;_0x3fa34d=_[_0xd46e('0x45')]({},_0x3fa34d,_0x57a7cc);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fa34d)[_0xd46e('0x27')](function(_0x5b554e){if(_0x5b554e){_0xc098c9=_0x5b554e;return _0x5b554e[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0xa254f5){if(_0xa254f5){if(!_0xa254f5[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5f5ba7=_0xa254f5;return db[_0xd46e('0x89')][_0xd46e('0x49')]({'raw':!![]});}return null;})['then'](function(_0x3c8d68){if(_0x3c8d68){_0x493df5=_[_0xd46e('0x70')](_0x3c8d68,'id');var _0x9e222d;var _0x3da17e=squel[_0xd46e('0x8a')]();_0x3da17e[_0xd46e('0x71')](_0xc098c9[_0xd46e('0x72')]);for(var _0x282f71=0x0;_0x282f71<_0x5f5ba7[_0xd46e('0x3d')];_0x282f71+=0x1){_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x73')]?_0x493df5[_0x5f5ba7[_0x282f71][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x5f5ba7[_0x282f71][_0xd46e('0x6a')];_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x75')]?_['replace'](_0x4ca21f[_0x5f5ba7[_0x282f71]['function']],'%s',_0x9e222d):_0x9e222d;_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x5ef4cc[_0x5f5ba7[_0x282f71][_0xd46e('0x77')]],'%s',_0x9e222d):_0x9e222d;if(_0x5f5ba7[_0x282f71][_0xd46e('0x78')]){_0x3da17e[_0xd46e('0x69')](_0x9e222d);}_0x5f5ba7[_0x282f71][_0xd46e('0x79')]&&_0x3da17e['order'](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x3da17e[_0xd46e('0x6a')](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x7b')]||_0x9e222d);}if(_0xc098c9['joins']){_0xc098c9[_0xd46e('0x7c')]=JSON[_0xd46e('0x82')](_0xc098c9['joins']);for(var _0xdf967c=0x0;_0xdf967c<_0xc098c9['joins']['length'];_0xdf967c+=0x1){if(_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x114f2c,_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['type'])&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7d')]&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7f')]&&_0xc098c9['joins'][_0xdf967c]['foreignKey']){_0x3da17e[_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]](_0xc098c9['joins'][_0xdf967c]['foreignTable'],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0xc098c9[_0xd46e('0x72')],_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['parentKey'],_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x7f')],_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7e')]));}}}if(_0xc098c9[_0xd46e('0x81')]){_0xc098c9[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0xc098c9[_0xd46e('0x81')]);_0x3da17e[_0xd46e('0x41')](_0x3c476d(_0xc098c9['conditions'][_0xd46e('0x69')]));}_0x459a0c=_0x3da17e[_0xd46e('0x83')]();_0x3da17e['limit'](_0x383919);_0x3da17e['offset'](0x0);return;}})[_0xd46e('0x27')](function(){if(_0x99872a[_0xd46e('0x8c')]==='web'){return null;}var _0x5e637d=_[_0xd46e('0x45')](_0x99872a,{'name':_0x99872a[_0xd46e('0x8d')]||_0x99872a['name']||_0xc098c9[_0xd46e('0x2f')],'basename':_0x586024,'savename':util[_0xd46e('0x77')](_0xd46e('0x8e'),_0x99872a[_0xd46e('0x2f')]||_0xc098c9[_0xd46e('0x2f')],require(_0xd46e('0x8f'))['generate'](0x4),_0x99872a[_0xd46e('0x8c')]||_0xd46e('0x90')),'reportId':_0xc098c9['id'],'reportType':_0xd46e('0x91')});return db[_0xd46e('0x92')][_0xd46e('0x4d')](_0x5e637d,{'raw':!![]});})[_0xd46e('0x27')](function(_0x3311a6){if(_0xc098c9[_0xd46e('0x72')]===_0xd46e('0x93')){_0x459a0c[_0xd46e('0x41')](_0xc098c9[_0xd46e('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x99872a[_0xd46e('0x94')],_0x99872a['endDate']);}else{_0x459a0c['where'](_0xc098c9[_0xd46e('0x72')]+_0xd46e('0x95'),_0x99872a[_0xd46e('0x94')],_0x99872a[_0xd46e('0x96')]);}if(_0x3311a6){logger[_0xd46e('0x97')](_0xd46e('0x98'),_0x459a0c[_0xd46e('0x84')]());require(_0xd46e('0x99'))['fork'](path[_0xd46e('0x55')](__dirname,'../../components/export/',_0x3311a6[_0xd46e('0x8c')]),[_0x3311a6['id'],_0x459a0c[_0xd46e('0x84')](),path[_0xd46e('0x55')](__dirname,_0xd46e('0x9a'),_0x3311a6[_0xd46e('0x9b')]),_0x586024]);return _0x3311a6;}else{var _0x399918=squel[_0xd46e('0x8a')]();_0x399918[_0xd46e('0x71')]('('+_0x459a0c['toString']()+')',_0xd46e('0x9c'));_0x399918[_0xd46e('0x6a')](_0xd46e('0x9d'),'count');_0x459a0c[_0xd46e('0x1f')](_0x99872a[_0xd46e('0x1f')]||_0x383919);_0x459a0c[_0xd46e('0x1d')](_0x99872a['offset']||0x0);return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x399918[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]})['then'](function(_0x4967ff){if(!_0x4967ff[_0xd46e('0x3d')]){_0x18e140=0x0;}else{_0x18e140=_0x4967ff[0x0][_0xd46e('0x20')]||0x0;}return dbH['sequelize'][_0xd46e('0x38')](_0x459a0c[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]});})[_0xd46e('0x27')](function(_0x4bb76b){return{'rows':_0x4bb76b||[],'count':_0x18e140};});}});}exports['run']=function(_0x204a9f,_0x52ca5a){return runReport(_0x204a9f[_0xd46e('0x4b')],_0x204a9f[_0xd46e('0x38')],_0x204a9f['options'])[_0xd46e('0x27')](respondWithResult(_0x52ca5a,null))[_0xd46e('0x4a')](handleError(_0x52ca5a,null));};exports[_0xd46e('0x9f')]=runReport;exports[_0xd46e('0x38')]=function(_0x786ae,_0x537c73){var _0x1610bd=0xa;var _0x20cc4c=[_0xd46e('0x55'),_0xd46e('0xa0'),_0xd46e('0x56'),_0xd46e('0x57')];var _0x368742={'SUM':_0xd46e('0x58'),'COUNT':_0xd46e('0xa1'),'COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':_0xd46e('0xa2'),'AVG':_0xd46e('0xa3'),'GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x285cf8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc87da2=function(_0x195f02){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),'IS\x20NOT\x20NULL',_0xd46e('0x65'),_0xd46e('0x66')],_0x195f02);};var _0x44322f=function(_0x49959f){if(!_0x49959f||!_0x49959f['rules'][_0xd46e('0x3d')]){return'';}for(var _0x2094e5='(',_0x85aac1=0x0;_0x85aac1<_0x49959f[_0xd46e('0x67')][_0xd46e('0x3d')];_0x85aac1+=0x1){_0x85aac1>0x0&&(_0x2094e5+='\x20'+_0x49959f[_0xd46e('0x68')]+'\x20');_0x2094e5+=_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]?_0x44322f(_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]):_0x49959f['rules'][_0x85aac1][_0xd46e('0x6a')]+'\x20'+_0x49959f['rules'][_0x85aac1]['condition']+(_0xc87da2(_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x6b')])?'\x20'+_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x88')]:'');}return _0x2094e5+')';};var _0x101a29={'where':{'id':_0x786ae[_0xd46e('0x4b')]['id']}},_0x3a44da,_0x417068,_0x52e73e,_0x206077,_0xe729b6;_0x101a29=_[_0xd46e('0x45')]({},_0x101a29,_0x786ae[_0xd46e('0x46')]);return db['AnalyticDefaultReport'][_0xd46e('0x4c')](_0x101a29)[_0xd46e('0x27')](function(_0x1d08bb){if(_0x1d08bb){_0x3a44da=_0x1d08bb;return _0x1d08bb['getFields']();}return null;})[_0xd46e('0x27')](function(_0x8c6ed1){if(_0x8c6ed1){if(!_0x8c6ed1['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xd46e('0x6f'),0x193);}_0x417068=_0x8c6ed1;return db[_0xd46e('0x89')]['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3a13f8){if(_0x3a13f8){_0x52e73e=_['keyBy'](_0x3a13f8,'id');var _0x5a8661;var _0x157fb0=squel[_0xd46e('0x8a')]();_0x157fb0[_0xd46e('0x71')](_0x3a44da[_0xd46e('0x72')]);for(var _0x50750f=0x0;_0x50750f<_0x417068['length'];_0x50750f+=0x1){_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x73')]?_0x52e73e[_0x417068[_0x50750f][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x417068[_0x50750f][_0xd46e('0x6a')];_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0x368742[_0x417068[_0x50750f][_0xd46e('0x75')]],'%s',_0x5a8661):_0x5a8661;_0x5a8661=_0x417068[_0x50750f]['format']?_[_0xd46e('0x76')](_0x285cf8[_0x417068[_0x50750f][_0xd46e('0x77')]],'%s',_0x5a8661):_0x5a8661;if(_0x417068[_0x50750f]['groupBy']){_0x157fb0[_0xd46e('0x69')](_0x5a8661);}_0x417068[_0x50750f][_0xd46e('0x79')]&&_0x157fb0[_0xd46e('0x7a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x157fb0[_0xd46e('0x6a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x7b')]||_0x5a8661);}if(_0x3a44da[_0xd46e('0x7c')]){_0x3a44da['joins']=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x7c')]);for(var _0x3c819b=0x0;_0x3c819b<_0x3a44da[_0xd46e('0x7c')][_0xd46e('0x3d')];_0x3c819b+=0x1){if(_0x3a44da['joins'][_0x3c819b][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x20cc4c,_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')])&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7d')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']){_0x157fb0[_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')]](_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3a44da[_0xd46e('0x72')],_0x3a44da['joins'][_0x3c819b][_0xd46e('0x7d')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']));}}}if(_0x3a44da[_0xd46e('0x81')]){_0x3a44da[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x81')]);_0x157fb0[_0xd46e('0x41')](_0x44322f(_0x3a44da[_0xd46e('0x81')][_0xd46e('0x69')]));}_0xe729b6=_0x157fb0[_0xd46e('0x83')]();_0x157fb0[_0xd46e('0x1f')](_0x1610bd);_0x157fb0['offset'](0x0);logger['debug'](_0xd46e('0xa4'),_0x157fb0['toString']());return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x157fb0[_0xd46e('0x84')](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](function(){return{'sql':_0xe729b6['toString']()};})['then'](respondWithResult(_0x537c73,null))[_0xd46e('0x4a')](handleError(_0x537c73,null));}; \ No newline at end of file +var _0xba34=['save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','value','order','output','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x296402,_0x44efc3){var _0x4f30b7=function(_0x4b6727){while(--_0x4b6727){_0x296402['push'](_0x296402['shift']());}};_0x4f30b7(++_0x44efc3);}(_0xba34,0x119));var _0x4ba3=function(_0x4ddbfb,_0x4d51ec){_0x4ddbfb=_0x4ddbfb-0x0;var _0x3b34e0=_0xba34[_0x4ddbfb];return _0x3b34e0;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4ba3('0x19'))['dbH'];function respondWithStatusCode(_0x256f02,_0x4419b4){_0x4419b4=_0x4419b4||0xcc;return function(_0x29e498){if(_0x29e498){return _0x256f02[_0x4ba3('0x1a')](_0x4419b4);}return _0x256f02[_0x4ba3('0x1b')](_0x4419b4)[_0x4ba3('0x1c')]();};}function respondWithResult(_0x3a74f7,_0x12ac90){_0x12ac90=_0x12ac90||0xc8;return function(_0x1dec48){if(_0x1dec48){return _0x3a74f7[_0x4ba3('0x1b')](_0x12ac90)[_0x4ba3('0x1d')](_0x1dec48);}};}function respondWithFilteredResult(_0x301359,_0x29a9d1){return function(_0x25f584){if(_0x25f584){var _0x40e75b=typeof _0x29a9d1[_0x4ba3('0x1e')]==='undefined'&&typeof _0x29a9d1[_0x4ba3('0x1f')]===_0x4ba3('0x20');var _0x5ff7ce=_0x25f584[_0x4ba3('0x21')];var _0x556290=_0x40e75b?0x0:_0x29a9d1[_0x4ba3('0x1e')];var _0xe4eff9=_0x40e75b?_0x25f584[_0x4ba3('0x21')]:_0x29a9d1[_0x4ba3('0x1e')]+_0x29a9d1[_0x4ba3('0x1f')];var _0x125944;if(_0xe4eff9>=_0x5ff7ce){_0xe4eff9=_0x5ff7ce;_0x125944=0xc8;}else{_0x125944=0xce;}_0x301359['status'](_0x125944);return _0x301359['set'](_0x4ba3('0x22'),_0x556290+'-'+_0xe4eff9+'/'+_0x5ff7ce)['json'](_0x25f584);}return null;};}function patchUpdates(_0x18dff5){return function(_0x163967){try{jsonpatch[_0x4ba3('0x23')](_0x163967,_0x18dff5,!![]);}catch(_0xbc7023){return BPromise[_0x4ba3('0x24')](_0xbc7023);}return _0x163967[_0x4ba3('0x25')]();};}function saveUpdates(_0x4a0823,_0x143c78){return function(_0x1f87e1){if(_0x1f87e1){return _0x1f87e1['update'](_0x4a0823)[_0x4ba3('0x26')](function(_0x4ffe39){return _0x4ffe39;});}return null;};}function removeEntity(_0x1ae4de,_0x18abb3){return function(_0x11a917){if(_0x11a917){return _0x11a917[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){var _0xe29a49=_0x11a917[_0x4ba3('0x28')]({'plain':!![]});var _0xe1f7d2=_0x4ba3('0x29');return db[_0x4ba3('0x2a')]['destroy']({'where':{'type':_0xe1f7d2,'resourceId':_0xe29a49['id']}})[_0x4ba3('0x26')](function(){return _0x11a917;});})[_0x4ba3('0x26')](function(){_0x1ae4de[_0x4ba3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10537e,_0x1fe5e2){return function(_0x44d78c){if(!_0x44d78c){_0x10537e['sendStatus'](0x194);}return _0x44d78c;};}function handleError(_0x10cae6,_0x843276){_0x843276=_0x843276||0x1f4;return function(_0x34ecb4){logger[_0x4ba3('0x2b')](_0x34ecb4['stack']);if(_0x34ecb4['name']){delete _0x34ecb4[_0x4ba3('0x2c')];}_0x10cae6[_0x4ba3('0x1b')](_0x843276)[_0x4ba3('0x2d')](_0x34ecb4);};}exports[_0x4ba3('0x2e')]=function(_0x2cb5d5,_0x11f88f){var _0x48b3b7={},_0x27444b={},_0x28f36c={'count':0x0,'rows':[]};var _0x24d8fc=_[_0x4ba3('0x2f')](db[_0x4ba3('0x30')][_0x4ba3('0x31')],function(_0x457236){return{'name':_0x457236[_0x4ba3('0x32')],'type':_0x457236[_0x4ba3('0x33')][_0x4ba3('0x34')]};});_0x27444b['model']=_['map'](_0x24d8fc,'name');_0x27444b[_0x4ba3('0x35')]=_[_0x4ba3('0x36')](_0x2cb5d5[_0x4ba3('0x35')]);_0x27444b[_0x4ba3('0x37')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],_0x27444b[_0x4ba3('0x35')]);_0x48b3b7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x2cb5d5[_0x4ba3('0x35')]['fields']));_0x48b3b7[_0x4ba3('0x3a')]=_0x48b3b7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x48b3b7['attributes']:_0x27444b[_0x4ba3('0x39')];if(!_0x2cb5d5['query'][_0x4ba3('0x3d')](_0x4ba3('0x3e'))){_0x48b3b7[_0x4ba3('0x1f')]=qs[_0x4ba3('0x1f')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1f')]);_0x48b3b7['offset']=qs[_0x4ba3('0x1e')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1e')]);}_0x48b3b7['order']=qs[_0x4ba3('0x3f')](_0x2cb5d5[_0x4ba3('0x35')]['sort']);_0x48b3b7[_0x4ba3('0x40')]=qs['filters'](_['pick'](_0x2cb5d5[_0x4ba3('0x35')],_0x27444b[_0x4ba3('0x37')]),_0x24d8fc);if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x41')]){_0x48b3b7[_0x4ba3('0x40')]=_['merge'](_0x48b3b7[_0x4ba3('0x40')],{'$or':_[_0x4ba3('0x2f')](_0x24d8fc,function(_0x46d2ca){if(_0x46d2ca[_0x4ba3('0x33')]!==_0x4ba3('0x42')){var _0x2acc92={};_0x2acc92[_0x46d2ca[_0x4ba3('0x2c')]]={'$like':'%'+_0x2cb5d5[_0x4ba3('0x35')]['filter']+'%'};return _0x2acc92;}})});}_0x48b3b7=_[_0x4ba3('0x43')]({},_0x48b3b7,_0x2cb5d5[_0x4ba3('0x44')]);var _0x3cb07f={'where':_0x48b3b7[_0x4ba3('0x40')]};return db[_0x4ba3('0x30')][_0x4ba3('0x21')](_0x3cb07f)[_0x4ba3('0x26')](function(_0xdcc2a2){_0x28f36c[_0x4ba3('0x21')]=_0xdcc2a2;if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x45')]){_0x48b3b7[_0x4ba3('0x46')]=[{'all':!![]}];}return db[_0x4ba3('0x30')][_0x4ba3('0x47')](_0x48b3b7);})['then'](function(_0x5af671){_0x28f36c['rows']=_0x5af671;return _0x28f36c;})['then'](respondWithFilteredResult(_0x11f88f,_0x48b3b7))['catch'](handleError(_0x11f88f,null));};exports[_0x4ba3('0x48')]=function(_0x5c4659,_0x29e74d){var _0x5567c7={'raw':!![],'where':{'id':_0x5c4659[_0x4ba3('0x49')]['id']}},_0x53d6eb={};_0x53d6eb[_0x4ba3('0x39')]=_[_0x4ba3('0x36')](db[_0x4ba3('0x30')]['rawAttributes']);_0x53d6eb[_0x4ba3('0x35')]=_['keys'](_0x5c4659[_0x4ba3('0x35')]);_0x53d6eb['filters']=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],_0x53d6eb[_0x4ba3('0x35')]);_0x5567c7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x5c4659['query'][_0x4ba3('0x3b')]));_0x5567c7[_0x4ba3('0x3a')]=_0x5567c7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x5567c7[_0x4ba3('0x3a')]:_0x53d6eb['model'];if(_0x5c4659['query'][_0x4ba3('0x45')]){_0x5567c7[_0x4ba3('0x46')]=[{'all':!![]}];}_0x5567c7=_[_0x4ba3('0x43')]({},_0x5567c7,_0x5c4659['options']);return db[_0x4ba3('0x30')][_0x4ba3('0x4a')](_0x5567c7)[_0x4ba3('0x26')](handleEntityNotFound(_0x29e74d,null))['then'](respondWithResult(_0x29e74d,null))['catch'](handleError(_0x29e74d,null));};exports[_0x4ba3('0x4b')]=function(_0x482a83,_0x439acf){return db[_0x4ba3('0x30')][_0x4ba3('0x4b')](_0x482a83[_0x4ba3('0x4c')],{})[_0x4ba3('0x26')](function(_0x213eb0){var _0x590739=_0x482a83[_0x4ba3('0x4d')][_0x4ba3('0x28')]({'plain':!![]});if(!_0x590739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590739[_0x4ba3('0x4e')]===_0x4ba3('0x4d')){var _0x156c2d=_0x213eb0[_0x4ba3('0x28')]({'plain':!![]});var _0x360472='Reports';return db[_0x4ba3('0x4f')][_0x4ba3('0x4a')]({'where':{'name':_0x360472,'userProfileId':_0x590739['userProfileId']},'raw':!![]})[_0x4ba3('0x26')](function(_0x19d70f){if(_0x19d70f&&_0x19d70f[_0x4ba3('0x50')]===0x0){return db[_0x4ba3('0x2a')][_0x4ba3('0x4b')]({'name':_0x156c2d[_0x4ba3('0x2c')],'resourceId':_0x156c2d['id'],'type':_0x4ba3('0x29'),'sectionId':_0x19d70f['id']},{})[_0x4ba3('0x26')](function(){return _0x213eb0;});}else{return _0x213eb0;}})[_0x4ba3('0x51')](function(_0x428a27){logger[_0x4ba3('0x2b')](_0x4ba3('0x52'),_0x428a27);throw _0x428a27;});}return _0x213eb0;})[_0x4ba3('0x26')](respondWithResult(_0x439acf,0xc9))[_0x4ba3('0x51')](handleError(_0x439acf,null));};exports[_0x4ba3('0x53')]=function(_0x48a3d4,_0x5e7ed5){if(_0x48a3d4['body']['id']){delete _0x48a3d4[_0x4ba3('0x4c')]['id'];}return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x48a3d4[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5e7ed5,null))['then'](saveUpdates(_0x48a3d4[_0x4ba3('0x4c')],null))[_0x4ba3('0x26')](respondWithResult(_0x5e7ed5,null))[_0x4ba3('0x51')](handleError(_0x5e7ed5,null));};exports[_0x4ba3('0x27')]=function(_0x5359d1,_0x1e83fb){return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x5359d1[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x1e83fb,null))[_0x4ba3('0x26')](removeEntity(_0x1e83fb,null))[_0x4ba3('0x51')](handleError(_0x1e83fb,null));};exports[_0x4ba3('0x54')]=function(_0x328314,_0x4fa64d){var _0x20c849=0xa;var _0x42bb4b=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x40827a={'SUM':_0x4ba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':_0x4ba3('0x5b'),'MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x4cc10a={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ba3('0x62')};var _0xaef1b=function(_0x2a48fe){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),'IS\x20NOT\x20NULL',_0x4ba3('0x65'),_0x4ba3('0x66')],_0x2a48fe);};var _0x34cc21=function(_0x469ef0){if(!_0x469ef0||!_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')]){return'';}for(var _0x3fdf7f='(',_0x38699e=0x0;_0x38699e<_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')];_0x38699e+=0x1){_0x38699e>0x0&&(_0x3fdf7f+='\x20'+_0x469ef0[_0x4ba3('0x68')]+'\x20');_0x3fdf7f+=_0x469ef0['rules'][_0x38699e][_0x4ba3('0x69')]?_0x34cc21(_0x469ef0[_0x4ba3('0x67')][_0x38699e]['group']):_0x469ef0['rules'][_0x38699e][_0x4ba3('0x6a')]+'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['condition']+(_0xaef1b(_0x469ef0[_0x4ba3('0x67')][_0x38699e][_0x4ba3('0x6b')])?'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['value']:'');}return _0x3fdf7f+')';};var _0x1f5815={'where':{'id':_0x328314['params']['id']}},_0x46224,_0x1af489,_0x11209b,_0x24a75a,_0x3a4838;_0x1f5815=_[_0x4ba3('0x43')]({},_0x1f5815,_0x328314[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x1f5815)[_0x4ba3('0x26')](function(_0x2f8bcc){if(_0x2f8bcc){_0x46224=_0x2f8bcc;return _0x2f8bcc[_0x4ba3('0x6c')]();}return null;})[_0x4ba3('0x26')](function(_0x21c8b1){if(_0x21c8b1){if(!_0x21c8b1[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1af489=_0x21c8b1;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x13ee2c){if(_0x13ee2c){_0x11209b=_[_0x4ba3('0x6f')](_0x13ee2c,'id');var _0x442d66;var _0x5c7fc2=squel[_0x4ba3('0x70')]();_0x5c7fc2[_0x4ba3('0x71')](_0x46224[_0x4ba3('0x72')]);for(var _0x5baf26=0x0;_0x5baf26<_0x1af489[_0x4ba3('0x3c')];_0x5baf26+=0x1){_0x442d66=_0x1af489[_0x5baf26]['MetricId']?_0x11209b[_0x1af489[_0x5baf26][_0x4ba3('0x73')]][_0x4ba3('0x74')]:_0x1af489[_0x5baf26]['field'];_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x40827a[_0x1af489[_0x5baf26][_0x4ba3('0x75')]],'%s',_0x442d66):_0x442d66;_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x4cc10a[_0x1af489[_0x5baf26][_0x4ba3('0x77')]],'%s',_0x442d66):_0x442d66;if(_0x1af489[_0x5baf26][_0x4ba3('0x78')]){_0x5c7fc2[_0x4ba3('0x69')](_0x442d66);}_0x1af489[_0x5baf26][_0x4ba3('0x79')]&&_0x5c7fc2['order'](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x5c7fc2[_0x4ba3('0x6a')](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x7b')]||_0x442d66);}if(_0x46224[_0x4ba3('0x7c')]){_0x46224[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x7c')]);for(var _0x365d94=0x0;_0x365d94<_0x46224[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x365d94+=0x1){if(_0x46224[_0x4ba3('0x7c')][_0x365d94]['type']&&_[_0x4ba3('0x63')](_0x42bb4b,_0x46224[_0x4ba3('0x7c')][_0x365d94]['type'])&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7e')]&&_0x46224['joins'][_0x365d94]['foreignTable']&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]){_0x5c7fc2[_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x33')]](_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x46224['table'],_0x46224[_0x4ba3('0x7c')][_0x365d94]['parentKey'],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]));}}}if(_0x46224[_0x4ba3('0x82')]){_0x46224[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x82')]);_0x5c7fc2['where'](_0x34cc21(_0x46224[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x3a4838=_0x5c7fc2[_0x4ba3('0x83')]();_0x5c7fc2['limit'](_0x20c849);_0x5c7fc2[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x5c7fc2[_0x4ba3('0x86')]());return dbH[_0x4ba3('0x87')][_0x4ba3('0x35')](_0x5c7fc2[_0x4ba3('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x4ba3('0x88')]});}})['then'](respondWithResult(_0x4fa64d,null))[_0x4ba3('0x51')](handleError(_0x4fa64d,null));};function runReport(_0x15508f,_0x108679,_0x20f7db){var _0x5a3c63=_0x108679['name'];var _0x2d16e5=0xa;var _0x2b2132=['join',_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x1e8232={'SUM':_0x4ba3('0x59'),'COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':_0x4ba3('0x8a'),'GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x13dbc4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5aa412=function(_0x4ec70e){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),_0x4ba3('0x65'),_0x4ba3('0x66')],_0x4ec70e);};var _0x333a97=function(_0x30d7a9){if(!_0x30d7a9||!_0x30d7a9['rules'][_0x4ba3('0x3c')]){return'';}for(var _0x4cd4a2='(',_0x31a725=0x0;_0x31a725<_0x30d7a9['rules'][_0x4ba3('0x3c')];_0x31a725+=0x1){_0x31a725>0x0&&(_0x4cd4a2+='\x20'+_0x30d7a9[_0x4ba3('0x68')]+'\x20');_0x4cd4a2+=_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x69')]?_0x333a97(_0x30d7a9[_0x4ba3('0x67')][_0x31a725]['group']):_0x30d7a9['rules'][_0x31a725][_0x4ba3('0x6a')]+'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')]+(_0x5aa412(_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')])?'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x8c')]:'');}return _0x4cd4a2+')';};var _0x3d8606={'where':{'id':_0x15508f['id']}},_0x2d00e3,_0x35441e,_0x217ea4,_0x40dcee,_0x5ea9d0;_0x3d8606=_[_0x4ba3('0x43')]({},_0x3d8606,_0x20f7db);return db['AnalyticDefaultReport'][_0x4ba3('0x4a')](_0x3d8606)[_0x4ba3('0x26')](function(_0x17b970){if(_0x17b970){_0x2d00e3=_0x17b970;return _0x17b970[_0x4ba3('0x6c')]();}return null;})['then'](function(_0x2a2dc2){if(_0x2a2dc2){if(!_0x2a2dc2[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35441e=_0x2a2dc2;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0x3188c8){if(_0x3188c8){_0x217ea4=_['keyBy'](_0x3188c8,'id');var _0x2f793a;var _0x1194a5=squel[_0x4ba3('0x70')]();_0x1194a5[_0x4ba3('0x71')](_0x2d00e3[_0x4ba3('0x72')]);for(var _0x1e2134=0x0;_0x1e2134<_0x35441e['length'];_0x1e2134+=0x1){_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x73')]?_0x217ea4[_0x35441e[_0x1e2134]['MetricId']][_0x4ba3('0x74')]:_0x35441e[_0x1e2134][_0x4ba3('0x6a')];_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x1e8232[_0x35441e[_0x1e2134]['function']],'%s',_0x2f793a):_0x2f793a;_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x13dbc4[_0x35441e[_0x1e2134]['format']],'%s',_0x2f793a):_0x2f793a;if(_0x35441e[_0x1e2134][_0x4ba3('0x78')]){_0x1194a5['group'](_0x2f793a);}_0x35441e[_0x1e2134][_0x4ba3('0x79')]&&_0x1194a5[_0x4ba3('0x8d')](_0x2f793a,_0x35441e[_0x1e2134][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x1194a5[_0x4ba3('0x6a')](_0x2f793a,_0x35441e[_0x1e2134]['alias']||_0x2f793a);}if(_0x2d00e3['joins']){_0x2d00e3[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x7c')]);for(var _0x56244e=0x0;_0x56244e<_0x2d00e3[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x56244e+=0x1){if(_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x2b2132,_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')])&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')]&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')]&&_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x7f')]){_0x1194a5[_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')]](_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x2d00e3[_0x4ba3('0x72')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e]['foreignKey']));}}}if(_0x2d00e3['conditions']){_0x2d00e3[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x82')]);_0x1194a5[_0x4ba3('0x40')](_0x333a97(_0x2d00e3[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x5ea9d0=_0x1194a5[_0x4ba3('0x83')]();_0x1194a5['limit'](_0x2d16e5);_0x1194a5['offset'](0x0);return;}})[_0x4ba3('0x26')](function(){if(_0x108679[_0x4ba3('0x8e')]==='web'){return null;}var _0x4fb6b5=_['merge'](_0x108679,{'name':_0x108679['fullPath']||_0x108679[_0x4ba3('0x2c')]||_0x2d00e3[_0x4ba3('0x2c')],'basename':_0x5a3c63,'savename':util[_0x4ba3('0x77')](_0x4ba3('0x8f'),_0x108679[_0x4ba3('0x2c')]||_0x2d00e3['name'],require(_0x4ba3('0x90'))[_0x4ba3('0x91')](0x4),_0x108679[_0x4ba3('0x8e')]||'csv'),'reportId':_0x2d00e3['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x4fb6b5,{'raw':!![]});})[_0x4ba3('0x26')](function(_0x17d501){if(_0x2d00e3[_0x4ba3('0x72')]===_0x4ba3('0x92')){_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3['table']+_0x4ba3('0x93'),_0x108679['startDate'],_0x108679[_0x4ba3('0x94')]);}else{_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3[_0x4ba3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x108679[_0x4ba3('0x95')],_0x108679[_0x4ba3('0x94')]);}if(_0x17d501){logger[_0x4ba3('0x96')](_0x4ba3('0x97'),_0x5ea9d0['toString']());require('child_process')[_0x4ba3('0x98')](path[_0x4ba3('0x55')](__dirname,'../../components/export/',_0x17d501[_0x4ba3('0x8e')]),[_0x17d501['id'],_0x5ea9d0['toString'](),path['join'](__dirname,'../../files/reports',_0x17d501['savename']),_0x5a3c63]);return _0x17d501;}else{var _0x2d2ca3=squel[_0x4ba3('0x70')]();_0x2d2ca3[_0x4ba3('0x71')]('('+_0x5ea9d0[_0x4ba3('0x86')]()+')',_0x4ba3('0x99'));_0x2d2ca3['field']('COUNT(*)',_0x4ba3('0x21'));_0x5ea9d0['limit'](_0x108679[_0x4ba3('0x1f')]||_0x2d16e5);_0x5ea9d0[_0x4ba3('0x1e')](_0x108679[_0x4ba3('0x1e')]||0x0);return dbH['sequelize'][_0x4ba3('0x35')](_0x2d2ca3[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]})[_0x4ba3('0x26')](function(_0xc938c){if(!_0xc938c[_0x4ba3('0x3c')]){_0x40dcee=0x0;}else{_0x40dcee=_0xc938c[0x0][_0x4ba3('0x21')]||0x0;}return dbH['sequelize']['query'](_0x5ea9d0[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]});})[_0x4ba3('0x26')](function(_0xd97c26){return{'rows':_0xd97c26||[],'count':_0x40dcee};});}});}exports['run']=function(_0x1fbdc7,_0x9e45ec){return runReport(_0x1fbdc7['params'],_0x1fbdc7[_0x4ba3('0x35')],_0x1fbdc7[_0x4ba3('0x44')])[_0x4ba3('0x26')](respondWithResult(_0x9e45ec,null))[_0x4ba3('0x51')](handleError(_0x9e45ec,null));};exports[_0x4ba3('0x9b')]=runReport;exports[_0x4ba3('0x35')]=function(_0xddfb0c,_0x41c531){var _0x25bf75=0xa;var _0x18bd77=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x2e812b={'SUM':'SUM(%s)','COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':_0x4ba3('0x9c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dc74f={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x4ba3('0x61'),'ROUND':_0x4ba3('0x9d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1590f0=function(_0x5efab9){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),'IS\x20EMPTY',_0x4ba3('0x66')],_0x5efab9);};var _0x4d3262=function(_0x4ad4d3){if(!_0x4ad4d3||!_0x4ad4d3[_0x4ba3('0x67')]['length']){return'';}for(var _0x4529a3='(',_0x9b9c64=0x0;_0x9b9c64<_0x4ad4d3[_0x4ba3('0x67')]['length'];_0x9b9c64+=0x1){_0x9b9c64>0x0&&(_0x4529a3+='\x20'+_0x4ad4d3['operator']+'\x20');_0x4529a3+=_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]?_0x4d3262(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]):_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64]['field']+'\x20'+_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')]+(_0x1590f0(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')])?'\x20'+_0x4ad4d3['rules'][_0x9b9c64][_0x4ba3('0x8c')]:'');}return _0x4529a3+')';};var _0x3073c5={'where':{'id':_0xddfb0c[_0x4ba3('0x49')]['id']}},_0x3d1c11,_0xa41747,_0x25c92c,_0x422a8d,_0x225746;_0x3073c5=_[_0x4ba3('0x43')]({},_0x3073c5,_0xddfb0c[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x3073c5)[_0x4ba3('0x26')](function(_0x3db4c2){if(_0x3db4c2){_0x3d1c11=_0x3db4c2;return _0x3db4c2['getFields']();}return null;})[_0x4ba3('0x26')](function(_0x4a8449){if(_0x4a8449){if(!_0x4a8449[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))](_0x4ba3('0x9e'),0x193);}_0xa41747=_0x4a8449;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0xfaf98a){if(_0xfaf98a){_0x25c92c=_['keyBy'](_0xfaf98a,'id');var _0x30c904;var _0x267801=squel[_0x4ba3('0x70')]();_0x267801[_0x4ba3('0x71')](_0x3d1c11['table']);for(var _0x1bae1b=0x0;_0x1bae1b<_0xa41747[_0x4ba3('0x3c')];_0x1bae1b+=0x1){_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x73')]?_0x25c92c[_0xa41747[_0x1bae1b][_0x4ba3('0x73')]]['metric']:_0xa41747[_0x1bae1b][_0x4ba3('0x6a')];_0x30c904=_0xa41747[_0x1bae1b]['function']?_[_0x4ba3('0x76')](_0x2e812b[_0xa41747[_0x1bae1b][_0x4ba3('0x75')]],'%s',_0x30c904):_0x30c904;_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x5dc74f[_0xa41747[_0x1bae1b]['format']],'%s',_0x30c904):_0x30c904;if(_0xa41747[_0x1bae1b]['groupBy']){_0x267801[_0x4ba3('0x69')](_0x30c904);}_0xa41747[_0x1bae1b][_0x4ba3('0x79')]&&_0x267801[_0x4ba3('0x8d')](_0x30c904,_0xa41747[_0x1bae1b]['orderBy']==='DESC'?![]:!![]);_0x267801[_0x4ba3('0x6a')](_0x30c904,_0xa41747[_0x1bae1b][_0x4ba3('0x7b')]||_0x30c904);}if(_0x3d1c11[_0x4ba3('0x7c')]){_0x3d1c11[_0x4ba3('0x7c')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x7c')]);for(var _0x2f4966=0x0;_0x2f4966<_0x3d1c11[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x2f4966+=0x1){if(_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x18bd77,_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')])&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x80')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7f')]){_0x267801[_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]](_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x3d1c11[_0x4ba3('0x72')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],_0x3d1c11['joins'][_0x2f4966][_0x4ba3('0x7f')]));}}}if(_0x3d1c11[_0x4ba3('0x82')]){_0x3d1c11[_0x4ba3('0x82')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x82')]);_0x267801[_0x4ba3('0x40')](_0x4d3262(_0x3d1c11[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x225746=_0x267801[_0x4ba3('0x83')]();_0x267801[_0x4ba3('0x1f')](_0x25bf75);_0x267801[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x267801['toString']());return dbH[_0x4ba3('0x87')]['query'](_0x267801['toString'](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')]['SELECT']});}})[_0x4ba3('0x26')](function(){return{'sql':_0x225746[_0x4ba3('0x86')]()};})[_0x4ba3('0x26')](respondWithResult(_0x41c531,null))[_0x4ba3('0x51')](handleError(_0x41c531,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 2557505..948417c 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 _0x1f8e=['analytics_default_reports','lodash','api','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x211bc3,_0x5860c8){var _0x34c9a2=function(_0x4bfa37){while(--_0x4bfa37){_0x211bc3['push'](_0x211bc3['shift']());}};_0x34c9a2(++_0x5860c8);}(_0x1f8e,0x177));var _0xe1f8=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1f8e[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xe1f8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe1f8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe1f8('0x2'));var fs=require('fs');var path=require(_0xe1f8('0x3'));var rimraf=require(_0xe1f8('0x4'));var config=require(_0xe1f8('0x5'));var attributes=require(_0xe1f8('0x6'));module[_0xe1f8('0x7')]=function(_0x4c77f3,_0x1a7d67){return _0x4c77f3[_0xe1f8('0x8')](_0xe1f8('0x9'),attributes,{'tableName':_0xe1f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd70f=['request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','../../config/logger','bluebird'];(function(_0x2e6dee,_0x1a61b0){var _0x47706=function(_0x365546){while(--_0x365546){_0x2e6dee['push'](_0x2e6dee['shift']());}};_0x47706(++_0x1a61b0);}(_0xd70f,0x1e8));var _0xfd70=function(_0x1c7f88,_0x20e675){_0x1c7f88=_0x1c7f88-0x0;var _0x3d7870=_0xd70f[_0x1c7f88];return _0x3d7870;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfd70('0x0'))('api');var moment=require('moment');var BPromise=require(_0xfd70('0x1'));var rp=require(_0xfd70('0x2'));var fs=require('fs');var path=require(_0xfd70('0x3'));var rimraf=require('rimraf');var config=require(_0xfd70('0x4'));var attributes=require(_0xfd70('0x5'));module[_0xfd70('0x6')]=function(_0x3dad4e,_0x25bb5d){return _0x3dad4e['define']('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 40067c1..611d617 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 _0xb810=['debug','request\x20sent','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xb810,0x159));var _0x0b81=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb810[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x0b81('0x0'));var util=require('util');var moment=require(_0x0b81('0x1'));var BPromise=require(_0x0b81('0x2'));var rs=require(_0x0b81('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b81('0x4'))['db'];var utils=require(_0x0b81('0x5'));var logger=require('../../config/logger')(_0x0b81('0x6'));var config=require('../../config/environment');var jayson=require(_0x0b81('0x7'));var client=jayson[_0x0b81('0x8')][_0x0b81('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b5557,_0x50ea44,_0x57b1ae){return new BPromise(function(_0x31e003,_0x5aa643){return client['request'](_0x1b5557,_0x57b1ae)['then'](function(_0x18d359){logger[_0x0b81('0xa')](_0x0b81('0xb'),_0x50ea44,'request\x20sent');logger[_0x0b81('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x50ea44,_0x0b81('0xd'),JSON['stringify'](_0x18d359));if(_0x18d359[_0x0b81('0xe')]){if(_0x18d359[_0x0b81('0xe')]['code']===0x1f4){logger['error'](_0x0b81('0xb'),_0x50ea44,_0x18d359[_0x0b81('0xe')][_0x0b81('0xf')]);return _0x5aa643(_0x18d359[_0x0b81('0xe')]['message']);}logger[_0x0b81('0xe')](_0x0b81('0xb'),_0x50ea44,_0x18d359[_0x0b81('0xe')][_0x0b81('0xf')]);return _0x31e003(_0x18d359[_0x0b81('0xe')]['message']);}else{logger[_0x0b81('0xa')](_0x0b81('0xb'),_0x50ea44,_0x0b81('0xd'));_0x31e003(_0x18d359[_0x0b81('0x10')][_0x0b81('0xf')]);}})['catch'](function(_0xd01926){logger[_0x0b81('0xe')](_0x0b81('0xb'),_0x50ea44,_0xd01926);_0x5aa643(_0xd01926);});});} \ No newline at end of file +var _0x5cb8=['result','catch','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5e211e,_0x92599){var _0x1927b1=function(_0x5b236f){while(--_0x5b236f){_0x5e211e['push'](_0x5e211e['shift']());}};_0x1927b1(++_0x92599);}(_0x5cb8,0x1ca));var _0x85cb=function(_0xd6bd63,_0xff5bd){_0xd6bd63=_0xd6bd63-0x0;var _0x50b62b=_0x5cb8[_0xd6bd63];return _0x50b62b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85cb('0x0'));var BPromise=require(_0x85cb('0x1'));var rs=require(_0x85cb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x85cb('0x3'))('rpc');var config=require(_0x85cb('0x4'));var jayson=require(_0x85cb('0x5'));var client=jayson['client'][_0x85cb('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x9ed74f,_0xb3659b,_0x19592e){return new BPromise(function(_0x36a767,_0x11f41c){return client[_0x85cb('0x7')](_0x9ed74f,_0x19592e)[_0x85cb('0x8')](function(_0xf16755){logger[_0x85cb('0x9')](_0x85cb('0xa'),_0xb3659b,_0x85cb('0xb'));logger[_0x85cb('0xc')](_0x85cb('0xd'),_0xb3659b,_0x85cb('0xb'),JSON['stringify'](_0xf16755));if(_0xf16755[_0x85cb('0xe')]){if(_0xf16755[_0x85cb('0xe')][_0x85cb('0xf')]===0x1f4){logger[_0x85cb('0xe')](_0x85cb('0xa'),_0xb3659b,_0xf16755['error']['message']);return _0x11f41c(_0xf16755[_0x85cb('0xe')][_0x85cb('0x10')]);}logger[_0x85cb('0xe')](_0x85cb('0xa'),_0xb3659b,_0xf16755[_0x85cb('0xe')][_0x85cb('0x10')]);return _0x36a767(_0xf16755['error'][_0x85cb('0x10')]);}else{logger[_0x85cb('0x9')](_0x85cb('0xa'),_0xb3659b,_0x85cb('0xb'));_0x36a767(_0xf16755[_0x85cb('0x11')][_0x85cb('0x10')]);}})[_0x85cb('0x12')](function(_0x2a8c2a){logger[_0x85cb('0xe')](_0x85cb('0xa'),_0xb3659b,_0x2a8c2a);_0x11f41c(_0x2a8c2a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 039e179..2159144 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 _0x8e34=['/:id/query','query','create','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/run','run'];(function(_0x1192f3,_0x69e7a0){var _0x1ae852=function(_0x253784){while(--_0x253784){_0x1192f3['push'](_0x1192f3['shift']());}};_0x1ae852(++_0x69e7a0);}(_0x8e34,0x1bf));var _0x48e3=function(_0x48d249,_0x41c005){_0x48d249=_0x48d249-0x0;var _0x341cc4=_0x8e34[_0x48d249];return _0x341cc4;};'use strict';var multer=require(_0x48e3('0x0'));var util=require('util');var path=require(_0x48e3('0x1'));var timeout=require('connect-timeout');var express=require(_0x48e3('0x2'));var router=express[_0x48e3('0x3')]();var fs_extra=require(_0x48e3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x48e3('0x5'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x48e3('0x6')]('/',auth[_0x48e3('0x7')](),controller[_0x48e3('0x8')]);router[_0x48e3('0x6')](_0x48e3('0x9'),auth['isAuthenticated'](),controller[_0x48e3('0xa')]);router[_0x48e3('0x6')]('/:id/preview',auth[_0x48e3('0x7')](),controller['preview']);router['get'](_0x48e3('0xb'),auth[_0x48e3('0x7')](),controller[_0x48e3('0xc')]);router[_0x48e3('0x6')](_0x48e3('0xd'),auth[_0x48e3('0x7')](),controller[_0x48e3('0xe')]);router['post']('/',auth[_0x48e3('0x7')](),controller[_0x48e3('0xf')]);router['put'](_0x48e3('0x9'),auth['isAuthenticated'](),controller[_0x48e3('0x10')]);router[_0x48e3('0x11')](_0x48e3('0x9'),auth[_0x48e3('0x7')](),controller[_0x48e3('0x12')]);module[_0x48e3('0x13')]=router; \ No newline at end of file +var _0x2a58=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','run','/:id/query','query','post','put','delete','destroy','multer','connect-timeout'];(function(_0x331204,_0x1128f2){var _0x578012=function(_0x19e0ed){while(--_0x19e0ed){_0x331204['push'](_0x331204['shift']());}};_0x578012(++_0x1128f2);}(_0x2a58,0x102));var _0x82a5=function(_0x1e7fd6,_0x4359a3){_0x1e7fd6=_0x1e7fd6-0x0;var _0x56b6fe=_0x2a58[_0x1e7fd6];return _0x56b6fe;};'use strict';var multer=require(_0x82a5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x82a5('0x1'));var express=require(_0x82a5('0x2'));var router=express[_0x82a5('0x3')]();var fs_extra=require(_0x82a5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x82a5('0x5'));var config=require(_0x82a5('0x6'));var controller=require(_0x82a5('0x7'));router[_0x82a5('0x8')]('/',auth[_0x82a5('0x9')](),controller[_0x82a5('0xa')]);router['get'](_0x82a5('0xb'),auth[_0x82a5('0x9')](),controller[_0x82a5('0xc')]);router['get']('/:id/preview',auth[_0x82a5('0x9')](),controller['preview']);router[_0x82a5('0x8')]('/:id/run',auth[_0x82a5('0x9')](),controller[_0x82a5('0xd')]);router[_0x82a5('0x8')](_0x82a5('0xe'),auth[_0x82a5('0x9')](),controller[_0x82a5('0xf')]);router[_0x82a5('0x10')]('/',auth[_0x82a5('0x9')](),controller['create']);router[_0x82a5('0x11')](_0x82a5('0xb'),auth[_0x82a5('0x9')](),controller['update']);router[_0x82a5('0x12')](_0x82a5('0xb'),auth[_0x82a5('0x9')](),controller[_0x82a5('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 6af04b5..09bca7c 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 _0x1111=['pdf','xlsx','DATE','Loading','ENUM','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING','csv'];(function(_0x2d25d1,_0x1f634d){var _0x5be9e5=function(_0x422beb){while(--_0x422beb){_0x2d25d1['push'](_0x2d25d1['shift']());}};_0x5be9e5(++_0x1f634d);}(_0x1111,0x19b));var _0x1111=function(_0x22a783,_0x43e533){_0x22a783=_0x22a783-0x0;var _0x4cfac9=_0x1111[_0x22a783];return _0x4cfac9;};'use strict';var Sequelize=require(_0x1111('0x0'));var moment=require(_0x1111('0x1'));module[_0x1111('0x2')]={'name':{'type':Sequelize[_0x1111('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x1111('0x4'),_0x1111('0x5'),_0x1111('0x6')),'allowNull':![],'defaultValue':_0x1111('0x4')},'savename':{'type':Sequelize[_0x1111('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x1111('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x1111('0x8')},'type':{'type':Sequelize[_0x1111('0x9')](_0x1111('0xa'),_0x1111('0xb')),'allowNull':![],'defaultValue':_0x1111('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x1111('0xc')]},'reportType':{'type':Sequelize[_0x1111('0x3')]}}; \ No newline at end of file +var _0x9e0d=['sequelize','moment','STRING','csv','pdf','DATE','manual','scheduled','INTEGER','UNSIGNED'];(function(_0x22eff4,_0x475bf4){var _0x43837d=function(_0x290f71){while(--_0x290f71){_0x22eff4['push'](_0x22eff4['shift']());}};_0x43837d(++_0x475bf4);}(_0x9e0d,0x1c2));var _0xd9e0=function(_0x38bc08,_0x39ab88){_0x38bc08=_0x38bc08-0x0;var _0x8110e4=_0x9e0d[_0x38bc08];return _0x8110e4;};'use strict';var Sequelize=require(_0xd9e0('0x0'));var moment=require(_0xd9e0('0x1'));module['exports']={'name':{'type':Sequelize[_0xd9e0('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xd9e0('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xd9e0('0x3'),_0xd9e0('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0xd9e0('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xd9e0('0x5')]},'endDate':{'type':Sequelize[_0xd9e0('0x5')]},'status':{'type':Sequelize[_0xd9e0('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0xd9e0('0x6'),_0xd9e0('0x7')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xd9e0('0x8')](0xb)[_0xd9e0('0x9')]},'reportType':{'type':Sequelize[_0xd9e0('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index f6f671b..eeb17e6 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 _0x8779=['eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','get','ExtractedReports','UserProfileResource','stack','name','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','params','output','existsSync','join','root','server/files/reports','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','format','%s.%s','basename','toLowerCase'];(function(_0x4207c3,_0x1278a2){var _0x4845c9=function(_0x4a1365){while(--_0x4a1365){_0x4207c3['push'](_0x4207c3['shift']());}};_0x4845c9(++_0x1278a2);}(_0x8779,0xc0));var _0x9877=function(_0x35aae8,_0xab007a){_0x35aae8=_0x35aae8-0x0;var _0xd9f10c=_0x8779[_0x35aae8];return _0xd9f10c;};'use strict';var emlformat=require(_0x9877('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9877('0x1'));var jsonpatch=require(_0x9877('0x2'));var rp=require('request-promise');var moment=require(_0x9877('0x3'));var BPromise=require(_0x9877('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9877('0x5'));var sox=require(_0x9877('0x6'));var csv=require(_0x9877('0x7'));var ejs=require(_0x9877('0x8'));var fs=require('fs');var fs_extra=require(_0x9877('0x9'));var _=require(_0x9877('0xa'));var squel=require(_0x9877('0xb'));var crypto=require(_0x9877('0xc'));var jsforce=require(_0x9877('0xd'));var deskjs=require(_0x9877('0xe'));var toCsv=require(_0x9877('0x7'));var querystring=require('querystring');var Papa=require(_0x9877('0xf'));var Redis=require('ioredis');var authService=require(_0x9877('0x10'));var qs=require(_0x9877('0x11'));var as=require(_0x9877('0x12'));var hardwareService=require(_0x9877('0x13'));var logger=require(_0x9877('0x14'))(_0x9877('0x15'));var utils=require(_0x9877('0x16'));var config=require(_0x9877('0x17'));var licenseUtil=require(_0x9877('0x18'));var db=require(_0x9877('0x19'))['db'];function respondWithStatusCode(_0xb9a8aa,_0x1c1bfb){_0x1c1bfb=_0x1c1bfb||0xcc;return function(_0x51bc21){if(_0x51bc21){return _0xb9a8aa[_0x9877('0x1a')](_0x1c1bfb);}return _0xb9a8aa[_0x9877('0x1b')](_0x1c1bfb)[_0x9877('0x1c')]();};}function respondWithResult(_0x332f62,_0x2cbe07){_0x2cbe07=_0x2cbe07||0xc8;return function(_0xe81b28){if(_0xe81b28){return _0x332f62[_0x9877('0x1b')](_0x2cbe07)[_0x9877('0x1d')](_0xe81b28);}};}function respondWithFilteredResult(_0xa013d7,_0x2061d7){return function(_0x1cd9a8){if(_0x1cd9a8){var _0x560e67=typeof _0x2061d7[_0x9877('0x1e')]===_0x9877('0x1f')&&typeof _0x2061d7[_0x9877('0x20')]==='undefined';var _0x22b5fd=_0x1cd9a8[_0x9877('0x21')];var _0x2cb7fa=_0x560e67?0x0:_0x2061d7[_0x9877('0x1e')];var _0x3765dc=_0x560e67?_0x1cd9a8[_0x9877('0x21')]:_0x2061d7[_0x9877('0x1e')]+_0x2061d7[_0x9877('0x20')];var _0x3d0cd3;if(_0x3765dc>=_0x22b5fd){_0x3765dc=_0x22b5fd;_0x3d0cd3=0xc8;}else{_0x3d0cd3=0xce;}_0xa013d7[_0x9877('0x1b')](_0x3d0cd3);return _0xa013d7[_0x9877('0x22')](_0x9877('0x23'),_0x2cb7fa+'-'+_0x3765dc+'/'+_0x22b5fd)['json'](_0x1cd9a8);}return null;};}function patchUpdates(_0x339630){return function(_0x17ed32){try{jsonpatch[_0x9877('0x24')](_0x17ed32,_0x339630,!![]);}catch(_0x5e2b67){return BPromise['reject'](_0x5e2b67);}return _0x17ed32['save']();};}function saveUpdates(_0xecd2d8,_0x239e9d){return function(_0x4f0d95){if(_0x4f0d95){return _0x4f0d95[_0x9877('0x25')](_0xecd2d8)['then'](function(_0x1be3c3){return _0x1be3c3;});}return null;};}function removeEntity(_0x168e68,_0x26515e){return function(_0x5127f6){if(_0x5127f6){return _0x5127f6[_0x9877('0x26')]()[_0x9877('0x27')](function(){var _0x39a812=_0x5127f6[_0x9877('0x28')]({'plain':!![]});var _0x137e60=_0x9877('0x29');return db[_0x9877('0x2a')][_0x9877('0x26')]({'where':{'type':_0x137e60,'resourceId':_0x39a812['id']}})[_0x9877('0x27')](function(){return _0x5127f6;});})[_0x9877('0x27')](function(){_0x168e68[_0x9877('0x1b')](0xcc)[_0x9877('0x1c')]();});}};}function handleEntityNotFound(_0x4c2a34,_0x28583f){return function(_0x536918){if(!_0x536918){_0x4c2a34[_0x9877('0x1a')](0x194);}return _0x536918;};}function handleError(_0x31f51b,_0x4467f9){_0x4467f9=_0x4467f9||0x1f4;return function(_0x2e1d78){logger['error'](_0x2e1d78[_0x9877('0x2b')]);if(_0x2e1d78[_0x9877('0x2c')]){delete _0x2e1d78['name'];}_0x31f51b[_0x9877('0x1b')](_0x4467f9)['send'](_0x2e1d78);};}exports[_0x9877('0x2d')]=function(_0x20fbae,_0x49c3e4){var _0x13fe75={},_0x462929={},_0x22510b={'count':0x0,'rows':[]};var _0x1bdaae=_[_0x9877('0x2e')](db[_0x9877('0x2f')][_0x9877('0x30')],function(_0x330ba3){return{'name':_0x330ba3['fieldName'],'type':_0x330ba3[_0x9877('0x31')][_0x9877('0x32')]};});_0x462929[_0x9877('0x33')]=_[_0x9877('0x2e')](_0x1bdaae,'name');_0x462929[_0x9877('0x34')]=_[_0x9877('0x35')](_0x20fbae[_0x9877('0x34')]);_0x462929[_0x9877('0x36')]=_[_0x9877('0x37')](_0x462929[_0x9877('0x33')],_0x462929[_0x9877('0x34')]);_0x13fe75[_0x9877('0x38')]=_['intersection'](_0x462929[_0x9877('0x33')],qs[_0x9877('0x39')](_0x20fbae[_0x9877('0x34')]['fields']));_0x13fe75[_0x9877('0x38')]=_0x13fe75[_0x9877('0x38')][_0x9877('0x3a')]?_0x13fe75[_0x9877('0x38')]:_0x462929[_0x9877('0x33')];if(!_0x20fbae['query'][_0x9877('0x3b')](_0x9877('0x3c'))){_0x13fe75[_0x9877('0x20')]=qs[_0x9877('0x20')](_0x20fbae[_0x9877('0x34')][_0x9877('0x20')]);_0x13fe75['offset']=qs[_0x9877('0x1e')](_0x20fbae['query'][_0x9877('0x1e')]);}_0x13fe75[_0x9877('0x3d')]=qs[_0x9877('0x3e')](_0x20fbae[_0x9877('0x34')][_0x9877('0x3e')]);_0x13fe75[_0x9877('0x3f')]=qs['filters'](_[_0x9877('0x40')](_0x20fbae[_0x9877('0x34')],_0x462929['filters']),_0x1bdaae);if(_0x20fbae[_0x9877('0x34')][_0x9877('0x41')]){_0x13fe75[_0x9877('0x3f')]=_[_0x9877('0x42')](_0x13fe75['where'],{'$or':_[_0x9877('0x2e')](_0x1bdaae,function(_0x349834){if(_0x349834[_0x9877('0x31')]!==_0x9877('0x43')){var _0x369235={};_0x369235[_0x349834[_0x9877('0x2c')]]={'$like':'%'+_0x20fbae[_0x9877('0x34')]['filter']+'%'};return _0x369235;}})});}_0x13fe75=_[_0x9877('0x42')]({},_0x13fe75,_0x20fbae['options']);var _0x19b685={'where':_0x13fe75[_0x9877('0x3f')]};return db['AnalyticExtractedReport'][_0x9877('0x21')](_0x19b685)[_0x9877('0x27')](function(_0x2b6df4){_0x22510b[_0x9877('0x21')]=_0x2b6df4;if(_0x20fbae[_0x9877('0x34')][_0x9877('0x44')]){_0x13fe75[_0x9877('0x45')]=[{'all':!![]}];}return db[_0x9877('0x2f')]['findAll'](_0x13fe75);})['then'](function(_0x39d866){_0x22510b[_0x9877('0x46')]=_0x39d866;return _0x22510b;})[_0x9877('0x27')](respondWithFilteredResult(_0x49c3e4,_0x13fe75))['catch'](handleError(_0x49c3e4,null));};exports[_0x9877('0x47')]=function(_0x3f8b19,_0x7abeb8){var _0x13fe4e={'raw':!![],'where':{'id':_0x3f8b19['params']['id']}},_0xd3b411={};_0xd3b411[_0x9877('0x33')]=_[_0x9877('0x35')](db[_0x9877('0x2f')]['rawAttributes']);_0xd3b411[_0x9877('0x34')]=_[_0x9877('0x35')](_0x3f8b19[_0x9877('0x34')]);_0xd3b411[_0x9877('0x36')]=_[_0x9877('0x37')](_0xd3b411[_0x9877('0x33')],_0xd3b411['query']);_0x13fe4e[_0x9877('0x38')]=_[_0x9877('0x37')](_0xd3b411['model'],qs[_0x9877('0x39')](_0x3f8b19[_0x9877('0x34')][_0x9877('0x39')]));_0x13fe4e[_0x9877('0x38')]=_0x13fe4e[_0x9877('0x38')][_0x9877('0x3a')]?_0x13fe4e['attributes']:_0xd3b411['model'];if(_0x3f8b19[_0x9877('0x34')][_0x9877('0x44')]){_0x13fe4e[_0x9877('0x45')]=[{'all':!![]}];}_0x13fe4e=_[_0x9877('0x42')]({},_0x13fe4e,_0x3f8b19[_0x9877('0x48')]);return db[_0x9877('0x2f')][_0x9877('0x49')](_0x13fe4e)[_0x9877('0x27')](handleEntityNotFound(_0x7abeb8,null))['then'](respondWithResult(_0x7abeb8,null))[_0x9877('0x4a')](handleError(_0x7abeb8,null));};exports[_0x9877('0x4b')]=function(_0xbce761,_0x5cd24f){return db[_0x9877('0x2f')][_0x9877('0x4b')](_0xbce761[_0x9877('0x4c')],{})[_0x9877('0x27')](function(_0x2b38d4){var _0x2be24f=_0xbce761[_0x9877('0x4d')]['get']({'plain':!![]});if(!_0x2be24f)throw new Error(_0x9877('0x4e'));if(_0x2be24f['role']==='user'){var _0x48f5c3=_0x2b38d4['get']({'plain':!![]});var _0x459ea2=_0x9877('0x29');return db['UserProfileSection'][_0x9877('0x49')]({'where':{'name':_0x459ea2,'userProfileId':_0x2be24f['userProfileId']},'raw':!![]})[_0x9877('0x27')](function(_0x3ab0bb){if(_0x3ab0bb&&_0x3ab0bb[_0x9877('0x4f')]===0x0){return db[_0x9877('0x2a')][_0x9877('0x4b')]({'name':_0x48f5c3[_0x9877('0x2c')],'resourceId':_0x48f5c3['id'],'type':_0x3ab0bb[_0x9877('0x2c')],'sectionId':_0x3ab0bb['id']},{})['then'](function(){return _0x2b38d4;});}else{return _0x2b38d4;}})['catch'](function(_0x29963a){logger[_0x9877('0x50')](_0x9877('0x51'),_0x29963a);throw _0x29963a;});}return _0x2b38d4;})[_0x9877('0x27')](respondWithResult(_0x5cd24f,0xc9))[_0x9877('0x4a')](handleError(_0x5cd24f,null));};exports[_0x9877('0x25')]=function(_0x83bcdf,_0x5aa38a){if(_0x83bcdf['body']['id']){delete _0x83bcdf[_0x9877('0x4c')]['id'];}return db['AnalyticExtractedReport'][_0x9877('0x49')]({'where':{'id':_0x83bcdf['params']['id']}})[_0x9877('0x27')](handleEntityNotFound(_0x5aa38a,null))['then'](saveUpdates(_0x83bcdf[_0x9877('0x4c')],null))['then'](respondWithResult(_0x5aa38a,null))[_0x9877('0x4a')](handleError(_0x5aa38a,null));};exports['destroy']=function(_0x242b51,_0x2709e6){return db['AnalyticExtractedReport'][_0x9877('0x49')]({'where':{'id':_0x242b51['params']['id']}})[_0x9877('0x27')](handleEntityNotFound(_0x2709e6,null))[_0x9877('0x27')](removeEntity(_0x2709e6,null))[_0x9877('0x4a')](handleError(_0x2709e6,null));};exports[_0x9877('0x52')]=function(_0x3bb0dc,_0x4830c3,_0x4061ae){return db[_0x9877('0x2f')]['find']({'where':{'id':_0x3bb0dc[_0x9877('0x53')]['id']},'attributes':[_0x9877('0x2c'),'basename','savename',_0x9877('0x54')],'raw':!![]})[_0x9877('0x27')](handleEntityNotFound(_0x4830c3,null))[_0x9877('0x27')](function(_0x20cccb){if(_0x20cccb){if(!fs[_0x9877('0x55')](path[_0x9877('0x56')](config[_0x9877('0x57')],_0x9877('0x58'),_0x20cccb[_0x9877('0x59')]))){throw new db[(_0x9877('0x5a'))]['ValidationError'](_0x9877('0x5b'));}if(_0x3bb0dc[_0x9877('0x34')]['exists']){return _0x4830c3[_0x9877('0x1a')](0xc8);}return _0x4830c3[_0x9877('0x52')](path['join'](config['root'],_0x9877('0x58'),_0x20cccb[_0x9877('0x59')]),util[_0x9877('0x5c')](_0x9877('0x5d'),_0x20cccb[_0x9877('0x5e')]||_0x20cccb[_0x9877('0x2c')],_0x20cccb[_0x9877('0x54')][_0x9877('0x5f')]()));}})[_0x9877('0x4a')](handleError(_0x4830c3,null));}; \ No newline at end of file +var _0x99e8=['path','sox','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','update','then','destroy','get','UserProfileResource','error','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','rows','catch','show','params','length','includeAll','include','find','create','user','role','ExtractedReports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x45e7e7,_0x10e163){var _0x5ed7e6=function(_0x1eec0e){while(--_0x1eec0e){_0x45e7e7['push'](_0x45e7e7['shift']());}};_0x5ed7e6(++_0x10e163);}(_0x99e8,0x10f));var _0x899e=function(_0x16fec1,_0x9775af){_0x16fec1=_0x16fec1-0x0;var _0x28fa7d=_0x99e8[_0x16fec1];return _0x28fa7d;};'use strict';var emlformat=require(_0x899e('0x0'));var rimraf=require(_0x899e('0x1'));var zipdir=require(_0x899e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x899e('0x3'));var moment=require(_0x899e('0x4'));var BPromise=require(_0x899e('0x5'));var Mustache=require(_0x899e('0x6'));var util=require(_0x899e('0x7'));var path=require(_0x899e('0x8'));var sox=require(_0x899e('0x9'));var csv=require('to-csv');var ejs=require(_0x899e('0xa'));var fs=require('fs');var fs_extra=require(_0x899e('0xb'));var _=require('lodash');var squel=require(_0x899e('0xc'));var crypto=require(_0x899e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x899e('0xe'));var Papa=require(_0x899e('0xf'));var Redis=require(_0x899e('0x10'));var authService=require(_0x899e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x899e('0x12'));var hardwareService=require(_0x899e('0x13'));var logger=require('../../config/logger')(_0x899e('0x14'));var utils=require('../../config/utils');var config=require(_0x899e('0x15'));var licenseUtil=require(_0x899e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14356d,_0x3897d1){_0x3897d1=_0x3897d1||0xcc;return function(_0x9a00aa){if(_0x9a00aa){return _0x14356d[_0x899e('0x17')](_0x3897d1);}return _0x14356d[_0x899e('0x18')](_0x3897d1)[_0x899e('0x19')]();};}function respondWithResult(_0x2bf18d,_0x1ee21b){_0x1ee21b=_0x1ee21b||0xc8;return function(_0x47fc19){if(_0x47fc19){return _0x2bf18d[_0x899e('0x18')](_0x1ee21b)[_0x899e('0x1a')](_0x47fc19);}};}function respondWithFilteredResult(_0x93b83d,_0x294838){return function(_0xb99d59){if(_0xb99d59){var _0x4ca194=typeof _0x294838['offset']===_0x899e('0x1b')&&typeof _0x294838[_0x899e('0x1c')]===_0x899e('0x1b');var _0x2d697d=_0xb99d59[_0x899e('0x1d')];var _0x32129f=_0x4ca194?0x0:_0x294838[_0x899e('0x1e')];var _0x1120d5=_0x4ca194?_0xb99d59['count']:_0x294838[_0x899e('0x1e')]+_0x294838[_0x899e('0x1c')];var _0x215662;if(_0x1120d5>=_0x2d697d){_0x1120d5=_0x2d697d;_0x215662=0xc8;}else{_0x215662=0xce;}_0x93b83d['status'](_0x215662);return _0x93b83d['set']('Content-Range',_0x32129f+'-'+_0x1120d5+'/'+_0x2d697d)[_0x899e('0x1a')](_0xb99d59);}return null;};}function patchUpdates(_0x4ba930){return function(_0x3e237b){try{jsonpatch[_0x899e('0x1f')](_0x3e237b,_0x4ba930,!![]);}catch(_0x72499c){return BPromise[_0x899e('0x20')](_0x72499c);}return _0x3e237b['save']();};}function saveUpdates(_0x4b4e72,_0x4e9352){return function(_0x1d1260){if(_0x1d1260){return _0x1d1260[_0x899e('0x21')](_0x4b4e72)[_0x899e('0x22')](function(_0x487576){return _0x487576;});}return null;};}function removeEntity(_0x5cd689,_0x38a6dd){return function(_0x924cff){if(_0x924cff){return _0x924cff[_0x899e('0x23')]()[_0x899e('0x22')](function(){var _0x1f2266=_0x924cff[_0x899e('0x24')]({'plain':!![]});var _0x1f22d8='ExtractedReports';return db[_0x899e('0x25')][_0x899e('0x23')]({'where':{'type':_0x1f22d8,'resourceId':_0x1f2266['id']}})[_0x899e('0x22')](function(){return _0x924cff;});})[_0x899e('0x22')](function(){_0x5cd689['status'](0xcc)[_0x899e('0x19')]();});}};}function handleEntityNotFound(_0x9db48a,_0x276c8c){return function(_0x26fd47){if(!_0x26fd47){_0x9db48a[_0x899e('0x17')](0x194);}return _0x26fd47;};}function handleError(_0xb82872,_0x233ea7){_0x233ea7=_0x233ea7||0x1f4;return function(_0x1bc9e5){logger[_0x899e('0x26')](_0x1bc9e5['stack']);if(_0x1bc9e5[_0x899e('0x27')]){delete _0x1bc9e5['name'];}_0xb82872[_0x899e('0x18')](_0x233ea7)[_0x899e('0x28')](_0x1bc9e5);};}exports[_0x899e('0x29')]=function(_0x462b93,_0x2ebd65){var _0x1e15a1={},_0x4805f8={},_0x867028={'count':0x0,'rows':[]};var _0x291c62=_['map'](db[_0x899e('0x2a')][_0x899e('0x2b')],function(_0x26a852){return{'name':_0x26a852[_0x899e('0x2c')],'type':_0x26a852['type']['key']};});_0x4805f8[_0x899e('0x2d')]=_['map'](_0x291c62,_0x899e('0x27'));_0x4805f8[_0x899e('0x2e')]=_[_0x899e('0x2f')](_0x462b93[_0x899e('0x2e')]);_0x4805f8[_0x899e('0x30')]=_[_0x899e('0x31')](_0x4805f8[_0x899e('0x2d')],_0x4805f8[_0x899e('0x2e')]);_0x1e15a1[_0x899e('0x32')]=_[_0x899e('0x31')](_0x4805f8['model'],qs['fields'](_0x462b93[_0x899e('0x2e')][_0x899e('0x33')]));_0x1e15a1[_0x899e('0x32')]=_0x1e15a1[_0x899e('0x32')]['length']?_0x1e15a1['attributes']:_0x4805f8[_0x899e('0x2d')];if(!_0x462b93['query'][_0x899e('0x34')](_0x899e('0x35'))){_0x1e15a1['limit']=qs[_0x899e('0x1c')](_0x462b93['query'][_0x899e('0x1c')]);_0x1e15a1[_0x899e('0x1e')]=qs[_0x899e('0x1e')](_0x462b93[_0x899e('0x2e')][_0x899e('0x1e')]);}_0x1e15a1[_0x899e('0x36')]=qs['sort'](_0x462b93[_0x899e('0x2e')][_0x899e('0x37')]);_0x1e15a1[_0x899e('0x38')]=qs[_0x899e('0x30')](_[_0x899e('0x39')](_0x462b93[_0x899e('0x2e')],_0x4805f8['filters']),_0x291c62);if(_0x462b93['query'][_0x899e('0x3a')]){_0x1e15a1[_0x899e('0x38')]=_['merge'](_0x1e15a1[_0x899e('0x38')],{'$or':_[_0x899e('0x3b')](_0x291c62,function(_0x48ca6f){if(_0x48ca6f['type']!==_0x899e('0x3c')){var _0x207dd4={};_0x207dd4[_0x48ca6f[_0x899e('0x27')]]={'$like':'%'+_0x462b93[_0x899e('0x2e')][_0x899e('0x3a')]+'%'};return _0x207dd4;}})});}_0x1e15a1=_[_0x899e('0x3d')]({},_0x1e15a1,_0x462b93[_0x899e('0x3e')]);var _0x317d05={'where':_0x1e15a1[_0x899e('0x38')]};return db[_0x899e('0x2a')]['count'](_0x317d05)['then'](function(_0x22dbf5){_0x867028[_0x899e('0x1d')]=_0x22dbf5;if(_0x462b93[_0x899e('0x2e')]['includeAll']){_0x1e15a1['include']=[{'all':!![]}];}return db[_0x899e('0x2a')]['findAll'](_0x1e15a1);})[_0x899e('0x22')](function(_0x299f8e){_0x867028[_0x899e('0x3f')]=_0x299f8e;return _0x867028;})[_0x899e('0x22')](respondWithFilteredResult(_0x2ebd65,_0x1e15a1))[_0x899e('0x40')](handleError(_0x2ebd65,null));};exports[_0x899e('0x41')]=function(_0x305dc1,_0x4499bc){var _0x249f45={'raw':!![],'where':{'id':_0x305dc1[_0x899e('0x42')]['id']}},_0x3623fe={};_0x3623fe[_0x899e('0x2d')]=_[_0x899e('0x2f')](db['AnalyticExtractedReport'][_0x899e('0x2b')]);_0x3623fe[_0x899e('0x2e')]=_['keys'](_0x305dc1[_0x899e('0x2e')]);_0x3623fe[_0x899e('0x30')]=_[_0x899e('0x31')](_0x3623fe[_0x899e('0x2d')],_0x3623fe[_0x899e('0x2e')]);_0x249f45['attributes']=_[_0x899e('0x31')](_0x3623fe[_0x899e('0x2d')],qs[_0x899e('0x33')](_0x305dc1['query'][_0x899e('0x33')]));_0x249f45[_0x899e('0x32')]=_0x249f45[_0x899e('0x32')][_0x899e('0x43')]?_0x249f45['attributes']:_0x3623fe[_0x899e('0x2d')];if(_0x305dc1[_0x899e('0x2e')][_0x899e('0x44')]){_0x249f45[_0x899e('0x45')]=[{'all':!![]}];}_0x249f45=_[_0x899e('0x3d')]({},_0x249f45,_0x305dc1[_0x899e('0x3e')]);return db[_0x899e('0x2a')][_0x899e('0x46')](_0x249f45)[_0x899e('0x22')](handleEntityNotFound(_0x4499bc,null))[_0x899e('0x22')](respondWithResult(_0x4499bc,null))[_0x899e('0x40')](handleError(_0x4499bc,null));};exports[_0x899e('0x47')]=function(_0x2cc7b4,_0xcae778){return db[_0x899e('0x2a')][_0x899e('0x47')](_0x2cc7b4['body'],{})[_0x899e('0x22')](function(_0x48a798){var _0x3afa9c=_0x2cc7b4[_0x899e('0x48')][_0x899e('0x24')]({'plain':!![]});if(!_0x3afa9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3afa9c[_0x899e('0x49')]===_0x899e('0x48')){var _0xcb63fc=_0x48a798[_0x899e('0x24')]({'plain':!![]});var _0x43eb53=_0x899e('0x4a');return db[_0x899e('0x4b')][_0x899e('0x46')]({'where':{'name':_0x43eb53,'userProfileId':_0x3afa9c[_0x899e('0x4c')]},'raw':!![]})[_0x899e('0x22')](function(_0x563387){if(_0x563387&&_0x563387['autoAssociation']===0x0){return db[_0x899e('0x25')][_0x899e('0x47')]({'name':_0xcb63fc[_0x899e('0x27')],'resourceId':_0xcb63fc['id'],'type':_0x563387['name'],'sectionId':_0x563387['id']},{})['then'](function(){return _0x48a798;});}else{return _0x48a798;}})[_0x899e('0x40')](function(_0x4978ad){logger[_0x899e('0x26')](_0x899e('0x4d'),_0x4978ad);throw _0x4978ad;});}return _0x48a798;})[_0x899e('0x22')](respondWithResult(_0xcae778,0xc9))[_0x899e('0x40')](handleError(_0xcae778,null));};exports[_0x899e('0x21')]=function(_0x3d2b1a,_0x2ce888){if(_0x3d2b1a[_0x899e('0x4e')]['id']){delete _0x3d2b1a[_0x899e('0x4e')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x3d2b1a[_0x899e('0x42')]['id']}})[_0x899e('0x22')](handleEntityNotFound(_0x2ce888,null))['then'](saveUpdates(_0x3d2b1a[_0x899e('0x4e')],null))[_0x899e('0x22')](respondWithResult(_0x2ce888,null))['catch'](handleError(_0x2ce888,null));};exports[_0x899e('0x23')]=function(_0x32ca11,_0x5e1ea6){return db[_0x899e('0x2a')][_0x899e('0x46')]({'where':{'id':_0x32ca11[_0x899e('0x42')]['id']}})[_0x899e('0x22')](handleEntityNotFound(_0x5e1ea6,null))['then'](removeEntity(_0x5e1ea6,null))[_0x899e('0x40')](handleError(_0x5e1ea6,null));};exports[_0x899e('0x4f')]=function(_0x1cb28e,_0x4fb4e4,_0x438030){return db['AnalyticExtractedReport'][_0x899e('0x46')]({'where':{'id':_0x1cb28e['params']['id']},'attributes':[_0x899e('0x27'),_0x899e('0x50'),_0x899e('0x51'),_0x899e('0x52')],'raw':!![]})[_0x899e('0x22')](handleEntityNotFound(_0x4fb4e4,null))['then'](function(_0x2dca1b){if(_0x2dca1b){if(!fs[_0x899e('0x53')](path[_0x899e('0x54')](config[_0x899e('0x55')],_0x899e('0x56'),_0x2dca1b[_0x899e('0x51')]))){throw new db[(_0x899e('0x57'))][(_0x899e('0x58'))](_0x899e('0x59'));}if(_0x1cb28e['query']['exists']){return _0x4fb4e4['sendStatus'](0xc8);}return _0x4fb4e4[_0x899e('0x4f')](path[_0x899e('0x54')](config[_0x899e('0x55')],'server/files/reports',_0x2dca1b[_0x899e('0x51')]),util[_0x899e('0x5a')](_0x899e('0x5b'),_0x2dca1b[_0x899e('0x50')]||_0x2dca1b[_0x899e('0x27')],_0x2dca1b[_0x899e('0x52')][_0x899e('0x5c')]()));}})[_0x899e('0x40')](handleError(_0x4fb4e4,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index f53bf01..957e5a7 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 _0x52f8=['request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','../../config/logger','bluebird'];(function(_0x436202,_0x57c276){var _0x1a3027=function(_0x1d7d4c){while(--_0x1d7d4c){_0x436202['push'](_0x436202['shift']());}};_0x1a3027(++_0x57c276);}(_0x52f8,0x152));var _0x852f=function(_0x2a4977,_0x47691c){_0x2a4977=_0x2a4977-0x0;var _0x3a453f=_0x52f8[_0x2a4977];return _0x3a453f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x852f('0x0'))('api');var moment=require('moment');var BPromise=require(_0x852f('0x1'));var rp=require(_0x852f('0x2'));var fs=require('fs');var path=require(_0x852f('0x3'));var rimraf=require(_0x852f('0x4'));var config=require(_0x852f('0x5'));var attributes=require(_0x852f('0x6'));module[_0x852f('0x7')]=function(_0x5a2853,_0x149ac1){return _0x5a2853[_0x852f('0x8')](_0x852f('0x9'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x853c=['util','../../config/logger','api','moment','bluebird','request-promise','path','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports'];(function(_0x2319c7,_0x171cb9){var _0x136a90=function(_0x13a28b){while(--_0x13a28b){_0x2319c7['push'](_0x2319c7['shift']());}};_0x136a90(++_0x171cb9);}(_0x853c,0xc6));var _0xc853=function(_0x5be0fa,_0x1289a0){_0x5be0fa=_0x5be0fa-0x0;var _0x108c94=_0x853c[_0x5be0fa];return _0x108c94;};'use strict';var _=require('lodash');var util=require(_0xc853('0x0'));var logger=require(_0xc853('0x1'))(_0xc853('0x2'));var moment=require(_0xc853('0x3'));var BPromise=require(_0xc853('0x4'));var rp=require(_0xc853('0x5'));var fs=require('fs');var path=require(_0xc853('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc853('0x7'));module[_0xc853('0x8')]=function(_0x3a0f17,_0x34c4e9){return _0x3a0f17[_0xc853('0x9')]('AnalyticExtractedReport',attributes,{'tableName':_0xc853('0xa'),'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 3d767e5..04fe5d4 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 _0x8301=['result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message'];(function(_0x292e0e,_0x4478da){var _0x304003=function(_0x1488b9){while(--_0x1488b9){_0x292e0e['push'](_0x292e0e['shift']());}};_0x304003(++_0x4478da);}(_0x8301,0x169));var _0x1830=function(_0x456a4b,_0x51df8){_0x456a4b=_0x456a4b-0x0;var _0x42957c=_0x8301[_0x456a4b];return _0x42957c;};'use strict';var _=require('lodash');var util=require(_0x1830('0x0'));var moment=require(_0x1830('0x1'));var BPromise=require('bluebird');var rs=require(_0x1830('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1830('0x3'))['db'];var utils=require(_0x1830('0x4'));var logger=require(_0x1830('0x5'))('rpc');var config=require(_0x1830('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1830('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3ed5e1,_0x4e79ab,_0x103ddd){return new BPromise(function(_0x27452a,_0x27664c){return client[_0x1830('0x8')](_0x3ed5e1,_0x103ddd)[_0x1830('0x9')](function(_0x396094){logger[_0x1830('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4e79ab,'request\x20sent');logger[_0x1830('0xb')](_0x1830('0xc'),_0x4e79ab,_0x1830('0xd'),JSON[_0x1830('0xe')](_0x396094));if(_0x396094[_0x1830('0xf')]){if(_0x396094['error'][_0x1830('0x10')]===0x1f4){logger['error'](_0x1830('0x11'),_0x4e79ab,_0x396094[_0x1830('0xf')][_0x1830('0x12')]);return _0x27664c(_0x396094[_0x1830('0xf')]['message']);}logger[_0x1830('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4e79ab,_0x396094[_0x1830('0xf')][_0x1830('0x12')]);return _0x27452a(_0x396094[_0x1830('0xf')][_0x1830('0x12')]);}else{logger['info'](_0x1830('0x11'),_0x4e79ab,_0x1830('0xd'));_0x27452a(_0x396094[_0x1830('0x13')][_0x1830('0x12')]);}})['catch'](function(_0xf1e928){logger[_0x1830('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4e79ab,_0xf1e928);_0x27664c(_0xf1e928);});});} \ No newline at end of file +var _0x52d3=['../../config/logger','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x52d3,0x188));var _0x352d=function(_0x7dd46a,_0x9c4ef7){_0x7dd46a=_0x7dd46a-0x0;var _0x29461d=_0x52d3[_0x7dd46a];return _0x29461d;};'use strict';var _=require(_0x352d('0x0'));var util=require(_0x352d('0x1'));var moment=require(_0x352d('0x2'));var BPromise=require(_0x352d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x352d('0x4'));var db=require(_0x352d('0x5'))['db'];var utils=require(_0x352d('0x6'));var logger=require(_0x352d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x352d('0x8')][_0x352d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39b79d,_0x260e88,_0x48c492){return new BPromise(function(_0x307866,_0x59172e){return client[_0x352d('0xa')](_0x39b79d,_0x48c492)[_0x352d('0xb')](function(_0x188f71){logger[_0x352d('0xc')](_0x352d('0xd'),_0x260e88,_0x352d('0xe'));logger[_0x352d('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x260e88,_0x352d('0xe'),JSON['stringify'](_0x188f71));if(_0x188f71[_0x352d('0x10')]){if(_0x188f71[_0x352d('0x10')][_0x352d('0x11')]===0x1f4){logger['error'](_0x352d('0xd'),_0x260e88,_0x188f71[_0x352d('0x10')][_0x352d('0x12')]);return _0x59172e(_0x188f71[_0x352d('0x10')][_0x352d('0x12')]);}logger['error'](_0x352d('0xd'),_0x260e88,_0x188f71['error'][_0x352d('0x12')]);return _0x307866(_0x188f71[_0x352d('0x10')][_0x352d('0x12')]);}else{logger[_0x352d('0xc')](_0x352d('0xd'),_0x260e88,_0x352d('0xe'));_0x307866(_0x188f71[_0x352d('0x13')][_0x352d('0x12')]);}})[_0x352d('0x14')](function(_0x19439a){logger[_0x352d('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x260e88,_0x19439a);_0x59172e(_0x19439a);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index f9a2b79..c09a895 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 _0x721b=['delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','create','update'];(function(_0x3cdb4a,_0x233b8e){var _0x5d3c4f=function(_0x7cef23){while(--_0x7cef23){_0x3cdb4a['push'](_0x3cdb4a['shift']());}};_0x5d3c4f(++_0x233b8e);}(_0x721b,0x157));var _0xb721=function(_0x293f41,_0x5317c5){_0x293f41=_0x293f41-0x0;var _0x47c5a9=_0x721b[_0x293f41];return _0x47c5a9;};'use strict';var multer=require('multer');var util=require(_0xb721('0x0'));var path=require(_0xb721('0x1'));var timeout=require(_0xb721('0x2'));var express=require('express');var router=express[_0xb721('0x3')]();var fs_extra=require(_0xb721('0x4'));var auth=require(_0xb721('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb721('0x6'));var controller=require(_0xb721('0x7'));router[_0xb721('0x8')]('/',auth[_0xb721('0x9')](),controller[_0xb721('0xa')]);router['get'](_0xb721('0xb'),auth[_0xb721('0x9')](),controller[_0xb721('0xc')]);router[_0xb721('0x8')](_0xb721('0xd'),auth['isAuthenticated'](),controller['download']);router[_0xb721('0xe')]('/',auth['isAuthenticated'](),controller[_0xb721('0xf')]);router['put'](_0xb721('0xb'),auth[_0xb721('0x9')](),controller[_0xb721('0x10')]);router[_0xb721('0x11')](_0xb721('0xb'),auth[_0xb721('0x9')](),controller[_0xb721('0x12')]);module[_0xb721('0x13')]=router; \ No newline at end of file +var _0xdb4e=['../../config/environment','./analyticExtractedReport.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','update','delete','exports','path','express','Router','../../components/auth/service'];(function(_0x3be4e6,_0x232d3d){var _0x2e4f7d=function(_0x4c315e){while(--_0x4c315e){_0x3be4e6['push'](_0x3be4e6['shift']());}};_0x2e4f7d(++_0x232d3d);}(_0xdb4e,0x1dc));var _0xedb4=function(_0x375be9,_0x2f37cb){_0x375be9=_0x375be9-0x0;var _0x579867=_0xdb4e[_0x375be9];return _0x579867;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xedb4('0x0'));var timeout=require('connect-timeout');var express=require(_0xedb4('0x1'));var router=express[_0xedb4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xedb4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xedb4('0x4'));var controller=require(_0xedb4('0x5'));router['get']('/',auth[_0xedb4('0x6')](),controller['index']);router[_0xedb4('0x7')](_0xedb4('0x8'),auth[_0xedb4('0x6')](),controller[_0xedb4('0x9')]);router[_0xedb4('0x7')](_0xedb4('0xa'),auth[_0xedb4('0x6')](),controller[_0xedb4('0xb')]);router[_0xedb4('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xedb4('0xd')]);router[_0xedb4('0xe')](_0xedb4('0x8'),auth[_0xedb4('0x6')](),controller['destroy']);module[_0xedb4('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 1d87e25..20c0930 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 _0x8e93=['exports','TEXT','STRING','sequelize'];(function(_0x2e6c75,_0x47eb58){var _0x576ff1=function(_0x1b7125){while(--_0x1b7125){_0x2e6c75['push'](_0x2e6c75['shift']());}};_0x576ff1(++_0x47eb58);}(_0x8e93,0x1c7));var _0x38e9=function(_0x193f43,_0xa490c6){_0x193f43=_0x193f43-0x0;var _0x2e978e=_0x8e93[_0x193f43];return _0x2e978e;};'use strict';var Sequelize=require(_0x38e9('0x0'));module[_0x38e9('0x1')]={'field':{'type':Sequelize[_0x38e9('0x2')]},'alias':{'type':Sequelize[_0x38e9('0x3')]},'function':{'type':Sequelize[_0x38e9('0x3')]},'format':{'type':Sequelize[_0x38e9('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x38e9('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa261=['BOOLEAN','exports','TEXT','STRING'];(function(_0x3cfb3c,_0x8b172){var _0x5c3d52=function(_0x26b7c4){while(--_0x26b7c4){_0x3cfb3c['push'](_0x3cfb3c['shift']());}};_0x5c3d52(++_0x8b172);}(_0xa261,0x1e5));var _0x1a26=function(_0x404328,_0x22a461){_0x404328=_0x404328-0x0;var _0x3cc279=_0xa261[_0x404328];return _0x3cc279;};'use strict';var Sequelize=require('sequelize');module[_0x1a26('0x0')]={'field':{'type':Sequelize[_0x1a26('0x1')]},'alias':{'type':Sequelize[_0x1a26('0x2')]},'function':{'type':Sequelize[_0x1a26('0x2')]},'format':{'type':Sequelize[_0x1a26('0x2')]},'groupBy':{'type':Sequelize[_0x1a26('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1a26('0x2')]},'custom':{'type':Sequelize[_0x1a26('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index ed701b8..172b29b 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 _0x5f26=['order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','rawAttributes','find','create','bulkCreate','body','update','bulkDestroy','ids','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','fieldName','type','model','query','filters','intersection','attributes','fields','length'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x5f26,0xc3));var _0x65f2=function(_0x57f785,_0x1b4f18){_0x57f785=_0x57f785-0x0;var _0x5a5eb4=_0x5f26[_0x57f785];return _0x5a5eb4;};'use strict';var emlformat=require(_0x65f2('0x0'));var rimraf=require(_0x65f2('0x1'));var zipdir=require(_0x65f2('0x2'));var jsonpatch=require(_0x65f2('0x3'));var rp=require(_0x65f2('0x4'));var moment=require(_0x65f2('0x5'));var BPromise=require(_0x65f2('0x6'));var Mustache=require(_0x65f2('0x7'));var util=require(_0x65f2('0x8'));var path=require(_0x65f2('0x9'));var sox=require(_0x65f2('0xa'));var csv=require(_0x65f2('0xb'));var ejs=require(_0x65f2('0xc'));var fs=require('fs');var fs_extra=require(_0x65f2('0xd'));var _=require(_0x65f2('0xe'));var squel=require(_0x65f2('0xf'));var crypto=require(_0x65f2('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x65f2('0x11'));var toCsv=require(_0x65f2('0xb'));var querystring=require(_0x65f2('0x12'));var Papa=require('papaparse');var Redis=require(_0x65f2('0x13'));var authService=require(_0x65f2('0x14'));var qs=require(_0x65f2('0x15'));var as=require(_0x65f2('0x16'));var hardwareService=require(_0x65f2('0x17'));var logger=require(_0x65f2('0x18'))(_0x65f2('0x19'));var utils=require(_0x65f2('0x1a'));var config=require(_0x65f2('0x1b'));var licenseUtil=require(_0x65f2('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x227201,_0x4096b2){_0x4096b2=_0x4096b2||0xcc;return function(_0x2e86bc){if(_0x2e86bc){return _0x227201[_0x65f2('0x1d')](_0x4096b2);}return _0x227201[_0x65f2('0x1e')](_0x4096b2)[_0x65f2('0x1f')]();};}function respondWithResult(_0xbee882,_0x2006ac){_0x2006ac=_0x2006ac||0xc8;return function(_0x12cfa9){if(_0x12cfa9){return _0xbee882[_0x65f2('0x1e')](_0x2006ac)[_0x65f2('0x20')](_0x12cfa9);}};}function respondWithFilteredResult(_0x5791b0,_0x2c5ad5){return function(_0xbc1418){if(_0xbc1418){var _0x30c040=typeof _0x2c5ad5[_0x65f2('0x21')]===_0x65f2('0x22')&&typeof _0x2c5ad5['limit']===_0x65f2('0x22');var _0x3e8f73=_0xbc1418[_0x65f2('0x23')];var _0x247717=_0x30c040?0x0:_0x2c5ad5[_0x65f2('0x21')];var _0x1e90ce=_0x30c040?_0xbc1418[_0x65f2('0x23')]:_0x2c5ad5[_0x65f2('0x21')]+_0x2c5ad5[_0x65f2('0x24')];var _0x57b267;if(_0x1e90ce>=_0x3e8f73){_0x1e90ce=_0x3e8f73;_0x57b267=0xc8;}else{_0x57b267=0xce;}_0x5791b0['status'](_0x57b267);return _0x5791b0[_0x65f2('0x25')](_0x65f2('0x26'),_0x247717+'-'+_0x1e90ce+'/'+_0x3e8f73)[_0x65f2('0x20')](_0xbc1418);}return null;};}function patchUpdates(_0x5292a8){return function(_0x4de82e){try{jsonpatch[_0x65f2('0x27')](_0x4de82e,_0x5292a8,!![]);}catch(_0x53c770){return BPromise[_0x65f2('0x28')](_0x53c770);}return _0x4de82e[_0x65f2('0x29')]();};}function saveUpdates(_0x3df755,_0x264f82){return function(_0x45e449){if(_0x45e449){return _0x45e449['update'](_0x3df755)[_0x65f2('0x2a')](function(_0xb4865b){return _0xb4865b;});}return null;};}function removeEntity(_0x158a4e,_0x415955){return function(_0x32e7a2){if(_0x32e7a2){return _0x32e7a2[_0x65f2('0x2b')]()[_0x65f2('0x2a')](function(){_0x158a4e[_0x65f2('0x1e')](0xcc)[_0x65f2('0x1f')]();});}};}function handleEntityNotFound(_0x2317d8,_0x2d4284){return function(_0x43d40d){if(!_0x43d40d){_0x2317d8[_0x65f2('0x1d')](0x194);}return _0x43d40d;};}function handleError(_0x317e15,_0x44a5e0){_0x44a5e0=_0x44a5e0||0x1f4;return function(_0x2673b1){logger[_0x65f2('0x2c')](_0x2673b1[_0x65f2('0x2d')]);if(_0x2673b1[_0x65f2('0x2e')]){delete _0x2673b1[_0x65f2('0x2e')];}_0x317e15[_0x65f2('0x1e')](_0x44a5e0)[_0x65f2('0x2f')](_0x2673b1);};}exports[_0x65f2('0x30')]=function(_0x215d01,_0x2ea228){var _0x418e07={},_0x178061={},_0x38fd4c={'count':0x0,'rows':[]};var _0x2f9016=_[_0x65f2('0x31')](db[_0x65f2('0x32')]['rawAttributes'],function(_0x1ae431){return{'name':_0x1ae431[_0x65f2('0x33')],'type':_0x1ae431[_0x65f2('0x34')]['key']};});_0x178061[_0x65f2('0x35')]=_['map'](_0x2f9016,_0x65f2('0x2e'));_0x178061[_0x65f2('0x36')]=_['keys'](_0x215d01['query']);_0x178061[_0x65f2('0x37')]=_[_0x65f2('0x38')](_0x178061['model'],_0x178061[_0x65f2('0x36')]);_0x418e07[_0x65f2('0x39')]=_[_0x65f2('0x38')](_0x178061[_0x65f2('0x35')],qs[_0x65f2('0x3a')](_0x215d01[_0x65f2('0x36')][_0x65f2('0x3a')]));_0x418e07[_0x65f2('0x39')]=_0x418e07[_0x65f2('0x39')][_0x65f2('0x3b')]?_0x418e07[_0x65f2('0x39')]:_0x178061['model'];if(!_0x215d01[_0x65f2('0x36')]['hasOwnProperty']('nolimit')){_0x418e07[_0x65f2('0x24')]=qs[_0x65f2('0x24')](_0x215d01[_0x65f2('0x36')][_0x65f2('0x24')]);_0x418e07[_0x65f2('0x21')]=qs[_0x65f2('0x21')](_0x215d01[_0x65f2('0x36')][_0x65f2('0x21')]);}_0x418e07[_0x65f2('0x3c')]=qs[_0x65f2('0x3d')](_0x215d01[_0x65f2('0x36')][_0x65f2('0x3d')]);_0x418e07['where']=qs['filters'](_[_0x65f2('0x3e')](_0x215d01['query'],_0x178061[_0x65f2('0x37')]),_0x2f9016);if(_0x215d01[_0x65f2('0x36')][_0x65f2('0x3f')]){_0x418e07[_0x65f2('0x40')]=_[_0x65f2('0x41')](_0x418e07['where'],{'$or':_[_0x65f2('0x31')](_0x2f9016,function(_0xd72116){if(_0xd72116['type']!==_0x65f2('0x42')){var _0x47e8f3={};_0x47e8f3[_0xd72116[_0x65f2('0x2e')]]={'$like':'%'+_0x215d01[_0x65f2('0x36')][_0x65f2('0x3f')]+'%'};return _0x47e8f3;}})});}_0x418e07=_[_0x65f2('0x41')]({},_0x418e07,_0x215d01[_0x65f2('0x43')]);var _0x354a23={'where':_0x418e07[_0x65f2('0x40')]};return db[_0x65f2('0x32')]['count'](_0x354a23)[_0x65f2('0x2a')](function(_0x49f9e4){_0x38fd4c['count']=_0x49f9e4;if(_0x215d01[_0x65f2('0x36')][_0x65f2('0x44')]){_0x418e07['include']=[{'all':!![]}];}return db[_0x65f2('0x32')][_0x65f2('0x45')](_0x418e07);})[_0x65f2('0x2a')](function(_0x4c2d93){_0x38fd4c['rows']=_0x4c2d93;return _0x38fd4c;})[_0x65f2('0x2a')](respondWithFilteredResult(_0x2ea228,_0x418e07))[_0x65f2('0x46')](handleError(_0x2ea228,null));};exports[_0x65f2('0x47')]=function(_0x43f00d,_0x51b205){var _0x5b3640={'raw':![],'where':{'id':_0x43f00d[_0x65f2('0x48')]['id']}},_0x17be54={};_0x17be54[_0x65f2('0x35')]=_[_0x65f2('0x49')](db['AnalyticFieldReport'][_0x65f2('0x4a')]);_0x17be54[_0x65f2('0x36')]=_[_0x65f2('0x49')](_0x43f00d[_0x65f2('0x36')]);_0x17be54['filters']=_['intersection'](_0x17be54[_0x65f2('0x35')],_0x17be54[_0x65f2('0x36')]);_0x5b3640[_0x65f2('0x39')]=_[_0x65f2('0x38')](_0x17be54[_0x65f2('0x35')],qs[_0x65f2('0x3a')](_0x43f00d['query'][_0x65f2('0x3a')]));_0x5b3640['attributes']=_0x5b3640['attributes'][_0x65f2('0x3b')]?_0x5b3640[_0x65f2('0x39')]:_0x17be54[_0x65f2('0x35')];if(_0x43f00d[_0x65f2('0x36')][_0x65f2('0x44')]){_0x5b3640['include']=[{'all':!![]}];}_0x5b3640=_[_0x65f2('0x41')]({},_0x5b3640,_0x43f00d[_0x65f2('0x43')]);return db[_0x65f2('0x32')][_0x65f2('0x4b')](_0x5b3640)['then'](handleEntityNotFound(_0x51b205,null))['then'](respondWithResult(_0x51b205,null))[_0x65f2('0x46')](handleError(_0x51b205,null));};exports['create']=function(_0x4ffa6d,_0xd5150f){return db[_0x65f2('0x32')][_0x65f2('0x4c')](_0x4ffa6d['body'],{})[_0x65f2('0x2a')](respondWithResult(_0xd5150f,0xc9))['catch'](handleError(_0xd5150f,null));};exports[_0x65f2('0x4d')]=function(_0x2f5f9a,_0x31d18c){return db['AnalyticFieldReport']['bulkCreate'](_0x2f5f9a[_0x65f2('0x4e')],{'raw':![],'individualHooks':!![]})[_0x65f2('0x2a')](respondWithResult(_0x31d18c,0xc9))[_0x65f2('0x46')](handleError(_0x31d18c,null));};exports[_0x65f2('0x4f')]=function(_0x5a744b,_0x3ba56e){if(_0x5a744b['body']['id']){delete _0x5a744b[_0x65f2('0x4e')]['id'];}return db[_0x65f2('0x32')][_0x65f2('0x4b')]({'where':{'id':_0x5a744b[_0x65f2('0x48')]['id']}})[_0x65f2('0x2a')](handleEntityNotFound(_0x3ba56e,null))['then'](saveUpdates(_0x5a744b[_0x65f2('0x4e')],null))[_0x65f2('0x2a')](respondWithResult(_0x3ba56e,null))[_0x65f2('0x46')](handleError(_0x3ba56e,null));};exports['destroy']=function(_0x100cd0,_0x20cd0d){return db[_0x65f2('0x32')][_0x65f2('0x4b')]({'where':{'id':_0x100cd0[_0x65f2('0x48')]['id']}})[_0x65f2('0x2a')](handleEntityNotFound(_0x20cd0d,null))[_0x65f2('0x2a')](removeEntity(_0x20cd0d,null))[_0x65f2('0x46')](handleError(_0x20cd0d,null));};exports[_0x65f2('0x50')]=function(_0x4bfb95,_0x2c7438){return db[_0x65f2('0x32')][_0x65f2('0x2b')]({'where':{'id':_0x4bfb95['query'][_0x65f2('0x51')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2c7438,0xcc))[_0x65f2('0x46')](handleError(_0x2c7438,null));};exports['addFields']=function(_0x179510,_0x47a396,_0x13ec4d){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x179510[_0x65f2('0x48')]['id']}})['then'](handleEntityNotFound(_0x47a396,null))[_0x65f2('0x2a')](function(_0x5c12e7){if(_0x5c12e7){return db[_0x65f2('0x52')][_0x65f2('0x53')](function(_0x57b266){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x179510['params']['id']},'transaction':_0x57b266})[_0x65f2('0x2a')](function(_0x559dff){var _0x4de4c1=_[_0x65f2('0x31')](_0x179510['body'],function(_0x12d0af){delete _0x12d0af['id'];_0x12d0af[_0x65f2('0x54')]=_0x179510[_0x65f2('0x48')]['id'];return _0x12d0af;});return db[_0x65f2('0x32')][_0x65f2('0x4d')](_0x4de4c1,{'transaction':_0x57b266});});})[_0x65f2('0x2a')](function(){return db[_0x65f2('0x32')][_0x65f2('0x45')]({'where':{'CustomReportId':_0x179510[_0x65f2('0x48')]['id']}});});}})[_0x65f2('0x2a')](respondWithResult(_0x47a396,null))[_0x65f2('0x46')](handleError(_0x47a396,null));}; \ No newline at end of file +var _0x1ae0=['request-promise','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','map','AnalyticFieldReport','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','bulkCreate','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','eml-format','rimraf','fast-json-patch'];(function(_0x43af80,_0x1a300e){var _0x26c0ea=function(_0x3fb0b6){while(--_0x3fb0b6){_0x43af80['push'](_0x43af80['shift']());}};_0x26c0ea(++_0x1a300e);}(_0x1ae0,0x1d7));var _0x01ae=function(_0x5de1bc,_0x434be1){_0x5de1bc=_0x5de1bc-0x0;var _0x19f4b8=_0x1ae0[_0x5de1bc];return _0x19f4b8;};'use strict';var emlformat=require(_0x01ae('0x0'));var rimraf=require(_0x01ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x01ae('0x2'));var rp=require(_0x01ae('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x01ae('0x4'));var path=require(_0x01ae('0x5'));var sox=require(_0x01ae('0x6'));var csv=require(_0x01ae('0x7'));var ejs=require(_0x01ae('0x8'));var fs=require('fs');var fs_extra=require(_0x01ae('0x9'));var _=require('lodash');var squel=require(_0x01ae('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x01ae('0xb'));var toCsv=require('to-csv');var querystring=require(_0x01ae('0xc'));var Papa=require('papaparse');var Redis=require(_0x01ae('0xd'));var authService=require(_0x01ae('0xe'));var qs=require(_0x01ae('0xf'));var as=require(_0x01ae('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x01ae('0x11'))(_0x01ae('0x12'));var utils=require(_0x01ae('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x01ae('0x14'));var db=require(_0x01ae('0x15'))['db'];function respondWithStatusCode(_0x22d401,_0x3ccf10){_0x3ccf10=_0x3ccf10||0xcc;return function(_0x582dd5){if(_0x582dd5){return _0x22d401['sendStatus'](_0x3ccf10);}return _0x22d401['status'](_0x3ccf10)['end']();};}function respondWithResult(_0x51ea42,_0x3487de){_0x3487de=_0x3487de||0xc8;return function(_0x1ac0da){if(_0x1ac0da){return _0x51ea42[_0x01ae('0x16')](_0x3487de)[_0x01ae('0x17')](_0x1ac0da);}};}function respondWithFilteredResult(_0x52b501,_0x5e449f){return function(_0x36f81c){if(_0x36f81c){var _0x348f74=typeof _0x5e449f['offset']===_0x01ae('0x18')&&typeof _0x5e449f[_0x01ae('0x19')]===_0x01ae('0x18');var _0xce48ef=_0x36f81c[_0x01ae('0x1a')];var _0x4ac6c5=_0x348f74?0x0:_0x5e449f[_0x01ae('0x1b')];var _0xd7c7bf=_0x348f74?_0x36f81c[_0x01ae('0x1a')]:_0x5e449f[_0x01ae('0x1b')]+_0x5e449f[_0x01ae('0x19')];var _0x434e39;if(_0xd7c7bf>=_0xce48ef){_0xd7c7bf=_0xce48ef;_0x434e39=0xc8;}else{_0x434e39=0xce;}_0x52b501[_0x01ae('0x16')](_0x434e39);return _0x52b501[_0x01ae('0x1c')](_0x01ae('0x1d'),_0x4ac6c5+'-'+_0xd7c7bf+'/'+_0xce48ef)['json'](_0x36f81c);}return null;};}function patchUpdates(_0x46ba1a){return function(_0x2817d5){try{jsonpatch['apply'](_0x2817d5,_0x46ba1a,!![]);}catch(_0x2d6ee7){return BPromise[_0x01ae('0x1e')](_0x2d6ee7);}return _0x2817d5[_0x01ae('0x1f')]();};}function saveUpdates(_0x264353,_0x2ed6a7){return function(_0x176baf){if(_0x176baf){return _0x176baf[_0x01ae('0x20')](_0x264353)[_0x01ae('0x21')](function(_0xd24b3c){return _0xd24b3c;});}return null;};}function removeEntity(_0x360d4c,_0x3ea91f){return function(_0x257142){if(_0x257142){return _0x257142['destroy']()[_0x01ae('0x21')](function(){_0x360d4c[_0x01ae('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6003a3,_0x11615d){return function(_0x152be2){if(!_0x152be2){_0x6003a3[_0x01ae('0x22')](0x194);}return _0x152be2;};}function handleError(_0x413230,_0x3f0f8a){_0x3f0f8a=_0x3f0f8a||0x1f4;return function(_0x19257e){logger[_0x01ae('0x23')](_0x19257e[_0x01ae('0x24')]);if(_0x19257e[_0x01ae('0x25')]){delete _0x19257e[_0x01ae('0x25')];}_0x413230[_0x01ae('0x16')](_0x3f0f8a)[_0x01ae('0x26')](_0x19257e);};}exports[_0x01ae('0x27')]=function(_0x4ac2cf,_0x272f43){var _0x27e803={},_0x235ad7={},_0x593542={'count':0x0,'rows':[]};var _0x3ceee3=_[_0x01ae('0x28')](db[_0x01ae('0x29')]['rawAttributes'],function(_0xae4f05){return{'name':_0xae4f05[_0x01ae('0x2a')],'type':_0xae4f05[_0x01ae('0x2b')][_0x01ae('0x2c')]};});_0x235ad7[_0x01ae('0x2d')]=_['map'](_0x3ceee3,_0x01ae('0x25'));_0x235ad7['query']=_[_0x01ae('0x2e')](_0x4ac2cf[_0x01ae('0x2f')]);_0x235ad7['filters']=_[_0x01ae('0x30')](_0x235ad7[_0x01ae('0x2d')],_0x235ad7[_0x01ae('0x2f')]);_0x27e803[_0x01ae('0x31')]=_[_0x01ae('0x30')](_0x235ad7[_0x01ae('0x2d')],qs[_0x01ae('0x32')](_0x4ac2cf[_0x01ae('0x2f')][_0x01ae('0x32')]));_0x27e803[_0x01ae('0x31')]=_0x27e803[_0x01ae('0x31')][_0x01ae('0x33')]?_0x27e803[_0x01ae('0x31')]:_0x235ad7[_0x01ae('0x2d')];if(!_0x4ac2cf[_0x01ae('0x2f')]['hasOwnProperty'](_0x01ae('0x34'))){_0x27e803[_0x01ae('0x19')]=qs[_0x01ae('0x19')](_0x4ac2cf['query']['limit']);_0x27e803[_0x01ae('0x1b')]=qs[_0x01ae('0x1b')](_0x4ac2cf['query']['offset']);}_0x27e803[_0x01ae('0x35')]=qs[_0x01ae('0x36')](_0x4ac2cf[_0x01ae('0x2f')][_0x01ae('0x36')]);_0x27e803[_0x01ae('0x37')]=qs['filters'](_[_0x01ae('0x38')](_0x4ac2cf[_0x01ae('0x2f')],_0x235ad7[_0x01ae('0x39')]),_0x3ceee3);if(_0x4ac2cf[_0x01ae('0x2f')][_0x01ae('0x3a')]){_0x27e803[_0x01ae('0x37')]=_[_0x01ae('0x3b')](_0x27e803[_0x01ae('0x37')],{'$or':_[_0x01ae('0x28')](_0x3ceee3,function(_0x2e26c0){if(_0x2e26c0[_0x01ae('0x2b')]!=='VIRTUAL'){var _0x2d7f22={};_0x2d7f22[_0x2e26c0['name']]={'$like':'%'+_0x4ac2cf[_0x01ae('0x2f')][_0x01ae('0x3a')]+'%'};return _0x2d7f22;}})});}_0x27e803=_[_0x01ae('0x3b')]({},_0x27e803,_0x4ac2cf[_0x01ae('0x3c')]);var _0x343a07={'where':_0x27e803[_0x01ae('0x37')]};return db[_0x01ae('0x29')]['count'](_0x343a07)['then'](function(_0x5a3e7e){_0x593542[_0x01ae('0x1a')]=_0x5a3e7e;if(_0x4ac2cf[_0x01ae('0x2f')][_0x01ae('0x3d')]){_0x27e803[_0x01ae('0x3e')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x01ae('0x3f')](_0x27e803);})[_0x01ae('0x21')](function(_0x584c79){_0x593542['rows']=_0x584c79;return _0x593542;})['then'](respondWithFilteredResult(_0x272f43,_0x27e803))['catch'](handleError(_0x272f43,null));};exports[_0x01ae('0x40')]=function(_0x5df623,_0x5c149a){var _0x1c8a7d={'raw':![],'where':{'id':_0x5df623[_0x01ae('0x41')]['id']}},_0x59fc4f={};_0x59fc4f['model']=_[_0x01ae('0x2e')](db['AnalyticFieldReport'][_0x01ae('0x42')]);_0x59fc4f[_0x01ae('0x2f')]=_['keys'](_0x5df623[_0x01ae('0x2f')]);_0x59fc4f[_0x01ae('0x39')]=_['intersection'](_0x59fc4f[_0x01ae('0x2d')],_0x59fc4f[_0x01ae('0x2f')]);_0x1c8a7d[_0x01ae('0x31')]=_[_0x01ae('0x30')](_0x59fc4f['model'],qs[_0x01ae('0x32')](_0x5df623[_0x01ae('0x2f')]['fields']));_0x1c8a7d[_0x01ae('0x31')]=_0x1c8a7d['attributes']['length']?_0x1c8a7d[_0x01ae('0x31')]:_0x59fc4f['model'];if(_0x5df623['query']['includeAll']){_0x1c8a7d[_0x01ae('0x3e')]=[{'all':!![]}];}_0x1c8a7d=_[_0x01ae('0x3b')]({},_0x1c8a7d,_0x5df623[_0x01ae('0x3c')]);return db[_0x01ae('0x29')][_0x01ae('0x43')](_0x1c8a7d)[_0x01ae('0x21')](handleEntityNotFound(_0x5c149a,null))[_0x01ae('0x21')](respondWithResult(_0x5c149a,null))[_0x01ae('0x44')](handleError(_0x5c149a,null));};exports[_0x01ae('0x45')]=function(_0x594d8c,_0x274974){return db['AnalyticFieldReport']['create'](_0x594d8c[_0x01ae('0x46')],{})[_0x01ae('0x21')](respondWithResult(_0x274974,0xc9))[_0x01ae('0x44')](handleError(_0x274974,null));};exports[_0x01ae('0x47')]=function(_0x337783,_0x1ae1e0){return db['AnalyticFieldReport'][_0x01ae('0x47')](_0x337783[_0x01ae('0x46')],{'raw':![],'individualHooks':!![]})[_0x01ae('0x21')](respondWithResult(_0x1ae1e0,0xc9))[_0x01ae('0x44')](handleError(_0x1ae1e0,null));};exports['update']=function(_0x2dd2a3,_0x24d11b){if(_0x2dd2a3[_0x01ae('0x46')]['id']){delete _0x2dd2a3[_0x01ae('0x46')]['id'];}return db[_0x01ae('0x29')][_0x01ae('0x43')]({'where':{'id':_0x2dd2a3['params']['id']}})[_0x01ae('0x21')](handleEntityNotFound(_0x24d11b,null))[_0x01ae('0x21')](saveUpdates(_0x2dd2a3[_0x01ae('0x46')],null))[_0x01ae('0x21')](respondWithResult(_0x24d11b,null))['catch'](handleError(_0x24d11b,null));};exports[_0x01ae('0x48')]=function(_0x5e61ae,_0x5123d1){return db[_0x01ae('0x29')]['find']({'where':{'id':_0x5e61ae[_0x01ae('0x41')]['id']}})[_0x01ae('0x21')](handleEntityNotFound(_0x5123d1,null))[_0x01ae('0x21')](removeEntity(_0x5123d1,null))[_0x01ae('0x44')](handleError(_0x5123d1,null));};exports[_0x01ae('0x49')]=function(_0x24760d,_0x9d32a4){return db[_0x01ae('0x29')]['destroy']({'where':{'id':_0x24760d[_0x01ae('0x2f')][_0x01ae('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0x01ae('0x21')](respondWithResult(_0x9d32a4,0xcc))[_0x01ae('0x44')](handleError(_0x9d32a4,null));};exports[_0x01ae('0x4b')]=function(_0x21bde4,_0x2943be,_0x7aeba3){return db[_0x01ae('0x4c')]['findOne']({'where':{'id':_0x21bde4[_0x01ae('0x41')]['id']}})[_0x01ae('0x21')](handleEntityNotFound(_0x2943be,null))[_0x01ae('0x21')](function(_0x48ac3d){if(_0x48ac3d){return db[_0x01ae('0x4d')][_0x01ae('0x4e')](function(_0x1971c2){return db[_0x01ae('0x29')][_0x01ae('0x48')]({'where':{'CustomReportId':_0x21bde4[_0x01ae('0x41')]['id']},'transaction':_0x1971c2})[_0x01ae('0x21')](function(_0x135705){var _0x524563=_['map'](_0x21bde4[_0x01ae('0x46')],function(_0x27f3f6){delete _0x27f3f6['id'];_0x27f3f6['CustomReportId']=_0x21bde4['params']['id'];return _0x27f3f6;});return db[_0x01ae('0x29')][_0x01ae('0x47')](_0x524563,{'transaction':_0x1971c2});});})[_0x01ae('0x21')](function(){return db[_0x01ae('0x29')]['findAll']({'where':{'CustomReportId':_0x21bde4[_0x01ae('0x41')]['id']}});});}})[_0x01ae('0x21')](respondWithResult(_0x2943be,null))[_0x01ae('0x44')](handleError(_0x2943be,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 663233d..48a2acf 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 _0x6850=['moment','path','../../config/environment','exports','define','AnalyticFieldReport','analytics_report_fields','util','api'];(function(_0x5493d2,_0x654b97){var _0x1bec36=function(_0x1cacde){while(--_0x1cacde){_0x5493d2['push'](_0x5493d2['shift']());}};_0x1bec36(++_0x654b97);}(_0x6850,0x1a5));var _0x0685=function(_0x55b591,_0x105016){_0x55b591=_0x55b591-0x0;var _0x3a0a1f=_0x6850[_0x55b591];return _0x3a0a1f;};'use strict';var _=require('lodash');var util=require(_0x0685('0x0'));var logger=require('../../config/logger')(_0x0685('0x1'));var moment=require(_0x0685('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0685('0x3'));var rimraf=require('rimraf');var config=require(_0x0685('0x4'));var attributes=require('./analyticFieldReport.attributes');module[_0x0685('0x5')]=function(_0x1cc80a,_0x58c297){return _0x1cc80a[_0x0685('0x6')](_0x0685('0x7'),attributes,{'tableName':_0x0685('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4f4=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','moment','request-promise','path','./analyticFieldReport.attributes'];(function(_0x513ec6,_0x34a613){var _0x24f3a8=function(_0x481233){while(--_0x481233){_0x513ec6['push'](_0x513ec6['shift']());}};_0x24f3a8(++_0x34a613);}(_0xc4f4,0xd6));var _0x4c4f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc4f4[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x4c4f('0x0'));var util=require('util');var logger=require(_0x4c4f('0x1'))('api');var moment=require(_0x4c4f('0x2'));var BPromise=require('bluebird');var rp=require(_0x4c4f('0x3'));var fs=require('fs');var path=require(_0x4c4f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4c4f('0x5'));module[_0x4c4f('0x6')]=function(_0x2526fa,_0x1d181d){return _0x2526fa[_0x4c4f('0x7')](_0x4c4f('0x8'),attributes,{'tableName':_0x4c4f('0x9'),'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 7cfdeaf..c690e0c 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 _0x0c59=['then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x0c59,0x1b4));var _0x90c5=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x0c59[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0x90c5('0x0'));var util=require(_0x90c5('0x1'));var moment=require(_0x90c5('0x2'));var BPromise=require(_0x90c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x90c5('0x4'));var db=require(_0x90c5('0x5'))['db'];var utils=require(_0x90c5('0x6'));var logger=require(_0x90c5('0x7'))(_0x90c5('0x8'));var config=require(_0x90c5('0x9'));var jayson=require(_0x90c5('0xa'));var client=jayson[_0x90c5('0xb')][_0x90c5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a4e84,_0x577a60,_0x3976d5){return new BPromise(function(_0x5f53e8,_0x388b7a){return client[_0x90c5('0xd')](_0x3a4e84,_0x3976d5)[_0x90c5('0xe')](function(_0x21cd74){logger[_0x90c5('0xf')](_0x90c5('0x10'),_0x577a60,'request\x20sent');logger[_0x90c5('0x11')](_0x90c5('0x12'),_0x577a60,_0x90c5('0x13'),JSON[_0x90c5('0x14')](_0x21cd74));if(_0x21cd74[_0x90c5('0x15')]){if(_0x21cd74[_0x90c5('0x15')]['code']===0x1f4){logger[_0x90c5('0x15')](_0x90c5('0x10'),_0x577a60,_0x21cd74['error'][_0x90c5('0x16')]);return _0x388b7a(_0x21cd74['error'][_0x90c5('0x16')]);}logger[_0x90c5('0x15')](_0x90c5('0x10'),_0x577a60,_0x21cd74[_0x90c5('0x15')][_0x90c5('0x16')]);return _0x5f53e8(_0x21cd74['error'][_0x90c5('0x16')]);}else{logger[_0x90c5('0xf')](_0x90c5('0x10'),_0x577a60,_0x90c5('0x13'));_0x5f53e8(_0x21cd74[_0x90c5('0x17')][_0x90c5('0x16')]);}})[_0x90c5('0x18')](function(_0x31807f){logger[_0x90c5('0x15')]('AnalyticFieldReport,\x20%s,\x20%s',_0x577a60,_0x31807f);_0x388b7a(_0x31807f);});});} \ No newline at end of file +var _0xcb6a=['rpc','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0xcb6a,0x19e));var _0xacb6=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xcb6a[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xacb6('0x0'));var util=require(_0xacb6('0x1'));var moment=require('moment');var BPromise=require(_0xacb6('0x2'));var rs=require(_0xacb6('0x3'));var fs=require('fs');var Redis=require(_0xacb6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xacb6('0x5'))(_0xacb6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xacb6('0x7')][_0xacb6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x495eae,_0x1c8863,_0x199975){return new BPromise(function(_0x544702,_0x470ad0){return client['request'](_0x495eae,_0x199975)[_0xacb6('0x9')](function(_0x11794b){logger[_0xacb6('0xa')](_0xacb6('0xb'),_0x1c8863,_0xacb6('0xc'));logger[_0xacb6('0xd')](_0xacb6('0xe'),_0x1c8863,_0xacb6('0xc'),JSON[_0xacb6('0xf')](_0x11794b));if(_0x11794b[_0xacb6('0x10')]){if(_0x11794b[_0xacb6('0x10')]['code']===0x1f4){logger[_0xacb6('0x10')](_0xacb6('0xb'),_0x1c8863,_0x11794b[_0xacb6('0x10')]['message']);return _0x470ad0(_0x11794b[_0xacb6('0x10')][_0xacb6('0x11')]);}logger[_0xacb6('0x10')](_0xacb6('0xb'),_0x1c8863,_0x11794b[_0xacb6('0x10')]['message']);return _0x544702(_0x11794b[_0xacb6('0x10')][_0xacb6('0x11')]);}else{logger['info'](_0xacb6('0xb'),_0x1c8863,_0xacb6('0xc'));_0x544702(_0x11794b[_0xacb6('0x12')]['message']);}})[_0xacb6('0x13')](function(_0x3fc5e1){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x1c8863,_0x3fc5e1);_0x470ad0(_0x3fc5e1);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 79f0a23..e83f70f 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(_0x14a8f3,_0x15c749){var _0x267924=function(_0xaa3d78){while(--_0xaa3d78){_0x14a8f3['push'](_0x14a8f3['shift']());}};_0x267924(++_0x15c749);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x1a846c,_0x3b8f66){var _0x1baf5b=function(_0x3707aa){while(--_0x3707aa){_0x1a846c['push'](_0x1a846c['shift']());}};_0x1baf5b(++_0x3b8f66);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 7fb1aab..0dfc303 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 _0x8b1a=['STRING','TEXT','sequelize','exports'];(function(_0x2d06bf,_0x114b2d){var _0x3fa0c7=function(_0x5d31b9){while(--_0x5d31b9){_0x2d06bf['push'](_0x2d06bf['shift']());}};_0x3fa0c7(++_0x114b2d);}(_0x8b1a,0x152));var _0xa8b1=function(_0x42ee0d,_0x4a9d2d){_0x42ee0d=_0x42ee0d-0x0;var _0x5183fe=_0x8b1a[_0x42ee0d];return _0x5183fe;};'use strict';var Sequelize=require(_0xa8b1('0x0'));module[_0xa8b1('0x1')]={'name':{'type':Sequelize[_0xa8b1('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xa8b1('0x2')]},'metric':{'type':Sequelize[_0xa8b1('0x3')]},'description':{'type':Sequelize[_0xa8b1('0x2')]}}; \ No newline at end of file +var _0x83e1=['TEXT','sequelize','exports','name'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x83e1,0x1ad));var _0x183e=function(_0x4702ee,_0xaf6a45){_0x4702ee=_0x4702ee-0x0;var _0x62ca7d=_0x83e1[_0x4702ee];return _0x62ca7d;};'use strict';var Sequelize=require(_0x183e('0x0'));module[_0x183e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x183e('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x183e('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 570f16c..af1c269 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 _0x6aa7=['json','apply','reject','save','update','then','destroy','get','Metrics','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','catch','error','params','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','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range'];(function(_0x58cb21,_0x4737cc){var _0x37e679=function(_0x154326){while(--_0x154326){_0x58cb21['push'](_0x58cb21['shift']());}};_0x37e679(++_0x4737cc);}(_0x6aa7,0x178));var _0x76aa=function(_0x1c8a6d,_0x4569d){_0x1c8a6d=_0x1c8a6d-0x0;var _0x1a7cd3=_0x6aa7[_0x1c8a6d];return _0x1a7cd3;};'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'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){var _0x2cba6d=_0x3cd039[_0x76aa('0x29')]({'plain':!![]});var _0x26b75e=_0x76aa('0x2a');return db['UserProfileResource'][_0x76aa('0x28')]({'where':{'type':_0x26b75e,'resourceId':_0x2cba6d['id']}})[_0x76aa('0x27')](function(){return _0x3cd039;});})[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x2f9316,_0x25a803){return function(_0x282d0a){if(!_0x282d0a){_0x2f9316[_0x76aa('0x19')](0x194);}return _0x282d0a;};}function handleError(_0x1bdc3d,_0x545b06){_0x545b06=_0x545b06||0x1f4;return function(_0x3fcb7f){logger['error'](_0x3fcb7f[_0x76aa('0x2b')]);if(_0x3fcb7f[_0x76aa('0x2c')]){delete _0x3fcb7f[_0x76aa('0x2c')];}_0x1bdc3d[_0x76aa('0x1a')](_0x545b06)[_0x76aa('0x2d')](_0x3fcb7f);};}exports[_0x76aa('0x2e')]=function(_0x2ee0f9,_0x3827ec){var _0x19fd4f={},_0x3ea05a={},_0x5edcd8={'count':0x0,'rows':[]};var _0x430ad6=_[_0x76aa('0x2f')](db[_0x76aa('0x30')][_0x76aa('0x31')],function(_0x458ac3){return{'name':_0x458ac3[_0x76aa('0x32')],'type':_0x458ac3[_0x76aa('0x33')]['key']};});_0x3ea05a[_0x76aa('0x34')]=_[_0x76aa('0x2f')](_0x430ad6,'name');_0x3ea05a[_0x76aa('0x35')]=_['keys'](_0x2ee0f9[_0x76aa('0x35')]);_0x3ea05a['filters']=_[_0x76aa('0x36')](_0x3ea05a['model'],_0x3ea05a['query']);_0x19fd4f[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x3ea05a[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x2ee0f9['query']['fields']));_0x19fd4f[_0x76aa('0x37')]=_0x19fd4f[_0x76aa('0x37')][_0x76aa('0x39')]?_0x19fd4f[_0x76aa('0x37')]:_0x3ea05a[_0x76aa('0x34')];if(!_0x2ee0f9['query'][_0x76aa('0x3a')]('nolimit')){_0x19fd4f['limit']=qs[_0x76aa('0x1f')](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1f')]);_0x19fd4f[_0x76aa('0x1e')]=qs['offset'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1e')]);}_0x19fd4f[_0x76aa('0x3b')]=qs['sort'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x3c')]);_0x19fd4f[_0x76aa('0x3d')]=qs[_0x76aa('0x3e')](_[_0x76aa('0x3f')](_0x2ee0f9[_0x76aa('0x35')],_0x3ea05a[_0x76aa('0x3e')]),_0x430ad6);if(_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]){_0x19fd4f['where']=_[_0x76aa('0x41')](_0x19fd4f[_0x76aa('0x3d')],{'$or':_[_0x76aa('0x2f')](_0x430ad6,function(_0xa824e8){if(_0xa824e8[_0x76aa('0x33')]!==_0x76aa('0x42')){var _0x572fdb={};_0x572fdb[_0xa824e8['name']]={'$like':'%'+_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]+'%'};return _0x572fdb;}})});}_0x19fd4f=_[_0x76aa('0x41')]({},_0x19fd4f,_0x2ee0f9[_0x76aa('0x43')]);var _0x50599f={'where':_0x19fd4f[_0x76aa('0x3d')]};return db[_0x76aa('0x30')][_0x76aa('0x1d')](_0x50599f)[_0x76aa('0x27')](function(_0x1138b5){_0x5edcd8['count']=_0x1138b5;if(_0x2ee0f9[_0x76aa('0x35')]['includeAll']){_0x19fd4f[_0x76aa('0x44')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x19fd4f);})['then'](function(_0x144f0a){_0x5edcd8['rows']=_0x144f0a;return _0x5edcd8;})['then'](respondWithFilteredResult(_0x3827ec,_0x19fd4f))['catch'](handleError(_0x3827ec,null));};exports[_0x76aa('0x45')]=function(_0x3fd153,_0x116dc5){var _0x2c0744={'raw':!![],'where':{'id':_0x3fd153['params']['id']}},_0x27a52e={};_0x27a52e[_0x76aa('0x34')]=_[_0x76aa('0x46')](db[_0x76aa('0x30')][_0x76aa('0x31')]);_0x27a52e[_0x76aa('0x35')]=_['keys'](_0x3fd153[_0x76aa('0x35')]);_0x27a52e[_0x76aa('0x3e')]=_['intersection'](_0x27a52e[_0x76aa('0x34')],_0x27a52e['query']);_0x2c0744[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x27a52e[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x3fd153[_0x76aa('0x35')][_0x76aa('0x38')]));_0x2c0744[_0x76aa('0x37')]=_0x2c0744[_0x76aa('0x37')][_0x76aa('0x39')]?_0x2c0744[_0x76aa('0x37')]:_0x27a52e['model'];if(_0x3fd153[_0x76aa('0x35')]['includeAll']){_0x2c0744[_0x76aa('0x44')]=[{'all':!![]}];}_0x2c0744=_[_0x76aa('0x41')]({},_0x2c0744,_0x3fd153[_0x76aa('0x43')]);return db[_0x76aa('0x30')]['find'](_0x2c0744)['then'](handleEntityNotFound(_0x116dc5,null))[_0x76aa('0x27')](respondWithResult(_0x116dc5,null))['catch'](handleError(_0x116dc5,null));};exports[_0x76aa('0x47')]=function(_0x302a0c,_0x4315b3){return db[_0x76aa('0x30')][_0x76aa('0x47')](_0x302a0c[_0x76aa('0x48')],{})['then'](function(_0x564546){var _0x2fcf8f=_0x302a0c[_0x76aa('0x49')][_0x76aa('0x29')]({'plain':!![]});if(!_0x2fcf8f)throw new Error(_0x76aa('0x4a'));if(_0x2fcf8f[_0x76aa('0x4b')]===_0x76aa('0x49')){var _0x4c52d5=_0x564546[_0x76aa('0x29')]({'plain':!![]});var _0x2d631e=_0x76aa('0x2a');return db['UserProfileSection'][_0x76aa('0x4c')]({'where':{'name':_0x2d631e,'userProfileId':_0x2fcf8f['userProfileId']},'raw':!![]})[_0x76aa('0x27')](function(_0x5e1d84){if(_0x5e1d84&&_0x5e1d84[_0x76aa('0x4d')]===0x0){return db[_0x76aa('0x4e')][_0x76aa('0x47')]({'name':_0x4c52d5[_0x76aa('0x2c')],'resourceId':_0x4c52d5['id'],'type':_0x5e1d84[_0x76aa('0x2c')],'sectionId':_0x5e1d84['id']},{})[_0x76aa('0x27')](function(){return _0x564546;});}else{return _0x564546;}})[_0x76aa('0x4f')](function(_0x4f2c2b){logger[_0x76aa('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f2c2b);throw _0x4f2c2b;});}return _0x564546;})[_0x76aa('0x27')](respondWithResult(_0x4315b3,0xc9))[_0x76aa('0x4f')](handleError(_0x4315b3,null));};exports[_0x76aa('0x26')]=function(_0x53be10,_0x3fa7ec){if(_0x53be10[_0x76aa('0x48')]['id']){delete _0x53be10[_0x76aa('0x48')]['id'];}return db['AnalyticMetric'][_0x76aa('0x4c')]({'where':{'id':_0x53be10[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x3fa7ec,null))[_0x76aa('0x27')](saveUpdates(_0x53be10['body'],null))[_0x76aa('0x27')](respondWithResult(_0x3fa7ec,null))[_0x76aa('0x4f')](handleError(_0x3fa7ec,null));};exports[_0x76aa('0x28')]=function(_0x410933,_0x2027f8){return db[_0x76aa('0x30')]['find']({'where':{'id':_0x410933[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x2027f8,null))[_0x76aa('0x27')](removeEntity(_0x2027f8,null))[_0x76aa('0x4f')](handleError(_0x2027f8,null));}; \ No newline at end of file +var _0xe14b=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','keys','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring'];(function(_0x3d35bc,_0x236c64){var _0x4db1a9=function(_0x3e368a){while(--_0x3e368a){_0x3d35bc['push'](_0x3d35bc['shift']());}};_0x4db1a9(++_0x236c64);}(_0xe14b,0x93));var _0xbe14=function(_0x34bc0e,_0xaceecd){_0x34bc0e=_0x34bc0e-0x0;var _0x1fa67f=_0xe14b[_0x34bc0e];return _0x1fa67f;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){var _0x4851f8=_0x2da350[_0xbe14('0x23')]({'plain':!![]});var _0x5fa043=_0xbe14('0x24');return db[_0xbe14('0x25')][_0xbe14('0x26')]({'where':{'type':_0x5fa043,'resourceId':_0x4851f8['id']}})[_0xbe14('0x22')](function(){return _0x2da350;});})['then'](function(){_0x3d3608[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x391556,_0x169369){return function(_0x5dd475){if(!_0x5dd475){_0x391556[_0xbe14('0x16')](0x194);}return _0x5dd475;};}function handleError(_0x29fc64,_0x59bf34){_0x59bf34=_0x59bf34||0x1f4;return function(_0x3c3613){logger[_0xbe14('0x27')](_0x3c3613[_0xbe14('0x28')]);if(_0x3c3613[_0xbe14('0x29')]){delete _0x3c3613[_0xbe14('0x29')];}_0x29fc64[_0xbe14('0x17')](_0x59bf34)[_0xbe14('0x2a')](_0x3c3613);};}exports[_0xbe14('0x2b')]=function(_0x4168c8,_0x16a159){var _0x40538f={},_0x3bf43c={},_0x39dc0a={'count':0x0,'rows':[]};var _0x10ae36=_[_0xbe14('0x2c')](db[_0xbe14('0x2d')][_0xbe14('0x2e')],function(_0x2ff48e){return{'name':_0x2ff48e[_0xbe14('0x2f')],'type':_0x2ff48e[_0xbe14('0x30')]['key']};});_0x3bf43c[_0xbe14('0x31')]=_['map'](_0x10ae36,'name');_0x3bf43c[_0xbe14('0x32')]=_['keys'](_0x4168c8[_0xbe14('0x32')]);_0x3bf43c[_0xbe14('0x33')]=_['intersection'](_0x3bf43c['model'],_0x3bf43c['query']);_0x40538f[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x3bf43c['model'],qs[_0xbe14('0x36')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x36')]));_0x40538f[_0xbe14('0x34')]=_0x40538f[_0xbe14('0x34')]['length']?_0x40538f['attributes']:_0x3bf43c[_0xbe14('0x31')];if(!_0x4168c8['query']['hasOwnProperty']('nolimit')){_0x40538f[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1a')]);_0x40538f[_0xbe14('0x1c')]=qs[_0xbe14('0x1c')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1c')]);}_0x40538f[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x38')]);_0x40538f['where']=qs['filters'](_[_0xbe14('0x39')](_0x4168c8[_0xbe14('0x32')],_0x3bf43c[_0xbe14('0x33')]),_0x10ae36);if(_0x4168c8['query'][_0xbe14('0x3a')]){_0x40538f[_0xbe14('0x3b')]=_[_0xbe14('0x3c')](_0x40538f[_0xbe14('0x3b')],{'$or':_[_0xbe14('0x2c')](_0x10ae36,function(_0x25ee1f){if(_0x25ee1f[_0xbe14('0x30')]!==_0xbe14('0x3d')){var _0x1b2608={};_0x1b2608[_0x25ee1f['name']]={'$like':'%'+_0x4168c8[_0xbe14('0x32')][_0xbe14('0x3a')]+'%'};return _0x1b2608;}})});}_0x40538f=_[_0xbe14('0x3c')]({},_0x40538f,_0x4168c8[_0xbe14('0x3e')]);var _0x3287b9={'where':_0x40538f[_0xbe14('0x3b')]};return db['AnalyticMetric'][_0xbe14('0x1b')](_0x3287b9)[_0xbe14('0x22')](function(_0x1220c9){_0x39dc0a[_0xbe14('0x1b')]=_0x1220c9;if(_0x4168c8['query']['includeAll']){_0x40538f[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2d')][_0xbe14('0x40')](_0x40538f);})['then'](function(_0x5d5318){_0x39dc0a[_0xbe14('0x41')]=_0x5d5318;return _0x39dc0a;})['then'](respondWithFilteredResult(_0x16a159,_0x40538f))['catch'](handleError(_0x16a159,null));};exports[_0xbe14('0x42')]=function(_0x1f0355,_0x8216c3){var _0x5051e4={'raw':!![],'where':{'id':_0x1f0355['params']['id']}},_0x558525={};_0x558525[_0xbe14('0x31')]=_[_0xbe14('0x43')](db[_0xbe14('0x2d')]['rawAttributes']);_0x558525[_0xbe14('0x32')]=_[_0xbe14('0x43')](_0x1f0355[_0xbe14('0x32')]);_0x558525[_0xbe14('0x33')]=_['intersection'](_0x558525['model'],_0x558525[_0xbe14('0x32')]);_0x5051e4[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x558525[_0xbe14('0x31')],qs[_0xbe14('0x36')](_0x1f0355['query']['fields']));_0x5051e4[_0xbe14('0x34')]=_0x5051e4[_0xbe14('0x34')][_0xbe14('0x44')]?_0x5051e4[_0xbe14('0x34')]:_0x558525['model'];if(_0x1f0355[_0xbe14('0x32')][_0xbe14('0x45')]){_0x5051e4['include']=[{'all':!![]}];}_0x5051e4=_[_0xbe14('0x3c')]({},_0x5051e4,_0x1f0355[_0xbe14('0x3e')]);return db[_0xbe14('0x2d')][_0xbe14('0x46')](_0x5051e4)['then'](handleEntityNotFound(_0x8216c3,null))['then'](respondWithResult(_0x8216c3,null))[_0xbe14('0x47')](handleError(_0x8216c3,null));};exports[_0xbe14('0x48')]=function(_0x4a1a37,_0x5acf90){return db[_0xbe14('0x2d')][_0xbe14('0x48')](_0x4a1a37[_0xbe14('0x49')],{})[_0xbe14('0x22')](function(_0xdbc6e1){var _0xd04fd5=_0x4a1a37[_0xbe14('0x4a')]['get']({'plain':!![]});if(!_0xd04fd5)throw new Error(_0xbe14('0x4b'));if(_0xd04fd5[_0xbe14('0x4c')]===_0xbe14('0x4a')){var _0x22b1f8=_0xdbc6e1[_0xbe14('0x23')]({'plain':!![]});var _0x494c32=_0xbe14('0x24');return db[_0xbe14('0x4d')][_0xbe14('0x46')]({'where':{'name':_0x494c32,'userProfileId':_0xd04fd5[_0xbe14('0x4e')]},'raw':!![]})[_0xbe14('0x22')](function(_0x2dbeb1){if(_0x2dbeb1&&_0x2dbeb1['autoAssociation']===0x0){return db['UserProfileResource'][_0xbe14('0x48')]({'name':_0x22b1f8[_0xbe14('0x29')],'resourceId':_0x22b1f8['id'],'type':_0x2dbeb1[_0xbe14('0x29')],'sectionId':_0x2dbeb1['id']},{})['then'](function(){return _0xdbc6e1;});}else{return _0xdbc6e1;}})['catch'](function(_0x44fe0d){logger[_0xbe14('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44fe0d);throw _0x44fe0d;});}return _0xdbc6e1;})[_0xbe14('0x22')](respondWithResult(_0x5acf90,0xc9))[_0xbe14('0x47')](handleError(_0x5acf90,null));};exports['update']=function(_0x28f995,_0x4a40d2){if(_0x28f995[_0xbe14('0x49')]['id']){delete _0x28f995[_0xbe14('0x49')]['id'];}return db[_0xbe14('0x2d')]['find']({'where':{'id':_0x28f995[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4a40d2,null))['then'](saveUpdates(_0x28f995[_0xbe14('0x49')],null))[_0xbe14('0x22')](respondWithResult(_0x4a40d2,null))[_0xbe14('0x47')](handleError(_0x4a40d2,null));};exports[_0xbe14('0x26')]=function(_0x49322f,_0x4f06a3){return db[_0xbe14('0x2d')][_0xbe14('0x46')]({'where':{'id':_0x49322f[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4f06a3,null))[_0xbe14('0x22')](removeEntity(_0x4f06a3,null))[_0xbe14('0x47')](handleError(_0x4f06a3,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 63e8d8b..2db7a01 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 _0x2c24=['moment','bluebird','request-promise','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api'];(function(_0x59250d,_0x2119d5){var _0x1e686a=function(_0x133b84){while(--_0x133b84){_0x59250d['push'](_0x59250d['shift']());}};_0x1e686a(++_0x2119d5);}(_0x2c24,0x1e6));var _0x42c2=function(_0x5e06f8,_0x2b62df){_0x5e06f8=_0x5e06f8-0x0;var _0x476c69=_0x2c24[_0x5e06f8];return _0x476c69;};'use strict';var _=require(_0x42c2('0x0'));var util=require(_0x42c2('0x1'));var logger=require(_0x42c2('0x2'))(_0x42c2('0x3'));var moment=require(_0x42c2('0x4'));var BPromise=require(_0x42c2('0x5'));var rp=require(_0x42c2('0x6'));var fs=require('fs');var path=require(_0x42c2('0x7'));var rimraf=require(_0x42c2('0x8'));var config=require('../../config/environment');var attributes=require(_0x42c2('0x9'));module[_0x42c2('0xa')]=function(_0x4950c1,_0x20d310){return _0x4950c1[_0x42c2('0xb')](_0x42c2('0xc'),attributes,{'tableName':_0x42c2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82f8=['./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x34ceb2,_0x231a8f){var _0xa3aab0=function(_0x48e9e7){while(--_0x48e9e7){_0x34ceb2['push'](_0x34ceb2['shift']());}};_0xa3aab0(++_0x231a8f);}(_0x82f8,0x157));var _0x882f=function(_0x509edd,_0x38cbbb){_0x509edd=_0x509edd-0x0;var _0x4d589a=_0x82f8[_0x509edd];return _0x4d589a;};'use strict';var _=require('lodash');var util=require(_0x882f('0x0'));var logger=require(_0x882f('0x1'))('api');var moment=require(_0x882f('0x2'));var BPromise=require(_0x882f('0x3'));var rp=require(_0x882f('0x4'));var fs=require('fs');var path=require(_0x882f('0x5'));var rimraf=require(_0x882f('0x6'));var config=require(_0x882f('0x7'));var attributes=require(_0x882f('0x8'));module[_0x882f('0x9')]=function(_0x4efdc9,_0x57fc29){return _0x4efdc9[_0x882f('0xa')](_0x882f('0xb'),attributes,{'tableName':_0x882f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 95a8d67..b1b89a8 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 _0xf7b2=['stringify','error','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf7b2,0xfc));var _0x2f7b=function(_0x5a3ebe,_0xde9bae){_0x5a3ebe=_0x5a3ebe-0x0;var _0x1fda3c=_0xf7b2[_0x5a3ebe];return _0x1fda3c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2f7b('0x0'));var rs=require(_0x2f7b('0x1'));var fs=require('fs');var Redis=require(_0x2f7b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f7b('0x3'));var logger=require(_0x2f7b('0x4'))(_0x2f7b('0x5'));var config=require(_0x2f7b('0x6'));var jayson=require(_0x2f7b('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24a9a3,_0x29cef6,_0x5f651){return new BPromise(function(_0x46da24,_0x32775a){return client['request'](_0x24a9a3,_0x5f651)[_0x2f7b('0x8')](function(_0x51ff66){logger[_0x2f7b('0x9')](_0x2f7b('0xa'),_0x29cef6,_0x2f7b('0xb'));logger[_0x2f7b('0xc')](_0x2f7b('0xd'),_0x29cef6,_0x2f7b('0xb'),JSON[_0x2f7b('0xe')](_0x51ff66));if(_0x51ff66[_0x2f7b('0xf')]){if(_0x51ff66['error']['code']===0x1f4){logger['error'](_0x2f7b('0xa'),_0x29cef6,_0x51ff66['error']['message']);return _0x32775a(_0x51ff66[_0x2f7b('0xf')]['message']);}logger[_0x2f7b('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x29cef6,_0x51ff66[_0x2f7b('0xf')][_0x2f7b('0x10')]);return _0x46da24(_0x51ff66[_0x2f7b('0xf')][_0x2f7b('0x10')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x29cef6,'request\x20sent');_0x46da24(_0x51ff66[_0x2f7b('0x11')][_0x2f7b('0x10')]);}})[_0x2f7b('0x12')](function(_0x4f26ff){logger[_0x2f7b('0xf')](_0x2f7b('0xa'),_0x29cef6,_0x4f26ff);_0x32775a(_0x4f26ff);});});} \ No newline at end of file +var _0x882e=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result'];(function(_0x118afa,_0x4bf0c1){var _0x167d76=function(_0x2c529b){while(--_0x2c529b){_0x118afa['push'](_0x118afa['shift']());}};_0x167d76(++_0x4bf0c1);}(_0x882e,0x187));var _0xe882=function(_0x30d216,_0x176a44){_0x30d216=_0x30d216-0x0;var _0x368bb9=_0x882e[_0x30d216];return _0x368bb9;};'use strict';var _=require(_0xe882('0x0'));var util=require(_0xe882('0x1'));var moment=require(_0xe882('0x2'));var BPromise=require(_0xe882('0x3'));var rs=require(_0xe882('0x4'));var fs=require('fs');var Redis=require(_0xe882('0x5'));var db=require(_0xe882('0x6'))['db'];var utils=require(_0xe882('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xe882('0x8'));var jayson=require(_0xe882('0x9'));var client=jayson[_0xe882('0xa')][_0xe882('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1caa4c,_0xead114,_0x4eaeb0){return new BPromise(function(_0x482430,_0x15514f){return client[_0xe882('0xc')](_0x1caa4c,_0x4eaeb0)[_0xe882('0xd')](function(_0x120d11){logger['info'](_0xe882('0xe'),_0xead114,_0xe882('0xf'));logger[_0xe882('0x10')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0xead114,_0xe882('0xf'),JSON[_0xe882('0x11')](_0x120d11));if(_0x120d11['error']){if(_0x120d11['error'][_0xe882('0x12')]===0x1f4){logger[_0xe882('0x13')](_0xe882('0xe'),_0xead114,_0x120d11[_0xe882('0x13')][_0xe882('0x14')]);return _0x15514f(_0x120d11[_0xe882('0x13')]['message']);}logger[_0xe882('0x13')](_0xe882('0xe'),_0xead114,_0x120d11[_0xe882('0x13')]['message']);return _0x482430(_0x120d11[_0xe882('0x13')]['message']);}else{logger[_0xe882('0x15')](_0xe882('0xe'),_0xead114,_0xe882('0xf'));_0x482430(_0x120d11[_0xe882('0x16')][_0xe882('0x14')]);}})['catch'](function(_0x38ca26){logger['error'](_0xe882('0xe'),_0xead114,_0x38ca26);_0x15514f(_0x38ca26);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 4943218..901e9fd 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 _0x6a83=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x6a83,0xd2));var _0x36a8=function(_0x4e118a,_0x2f81e1){_0x4e118a=_0x4e118a-0x0;var _0xee834a=_0x6a83[_0x4e118a];return _0xee834a;};'use strict';var multer=require(_0x36a8('0x0'));var util=require(_0x36a8('0x1'));var path=require(_0x36a8('0x2'));var timeout=require(_0x36a8('0x3'));var express=require(_0x36a8('0x4'));var router=express[_0x36a8('0x5')]();var fs_extra=require(_0x36a8('0x6'));var auth=require(_0x36a8('0x7'));var interaction=require(_0x36a8('0x8'));var config=require(_0x36a8('0x9'));var controller=require(_0x36a8('0xa'));router[_0x36a8('0xb')]('/',auth[_0x36a8('0xc')](),controller[_0x36a8('0xd')]);router[_0x36a8('0xb')](_0x36a8('0xe'),auth[_0x36a8('0xc')](),controller[_0x36a8('0xf')]);router[_0x36a8('0x10')]('/',auth['isAuthenticated'](),controller[_0x36a8('0x11')]);router['put'](_0x36a8('0xe'),auth[_0x36a8('0xc')](),controller['update']);router[_0x36a8('0x12')](_0x36a8('0xe'),auth['isAuthenticated'](),controller[_0x36a8('0x13')]);module[_0x36a8('0x14')]=router; \ No newline at end of file +var _0x7163=['../../components/interaction/service','../../config/environment','./analyticMetric.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0x7163,0x1ef));var _0x3716=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x7163[_0x45bf86];return _0x1f02b7;};'use strict';var multer=require(_0x3716('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3716('0x1'));var express=require(_0x3716('0x2'));var router=express[_0x3716('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3716('0x4'));var interaction=require(_0x3716('0x5'));var config=require(_0x3716('0x6'));var controller=require(_0x3716('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3716('0x8')]);router[_0x3716('0x9')](_0x3716('0xa'),auth[_0x3716('0xb')](),controller[_0x3716('0xc')]);router[_0x3716('0xd')]('/',auth[_0x3716('0xb')](),controller[_0x3716('0xe')]);router[_0x3716('0xf')](_0x3716('0xa'),auth[_0x3716('0xb')](),controller[_0x3716('0x10')]);router[_0x3716('0x11')](_0x3716('0xa'),auth[_0x3716('0xb')](),controller[_0x3716('0x12')]);module[_0x3716('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 20360fe..fc68edc 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 _0xe79a=['TEXT'];(function(_0x477cb9,_0x1f151b){var _0x59f8ec=function(_0x231c54){while(--_0x231c54){_0x477cb9['push'](_0x477cb9['shift']());}};_0x59f8ec(++_0x1f151b);}(_0xe79a,0x70));var _0xae79=function(_0x23cc76,_0x9c756b){_0x23cc76=_0x23cc76-0x0;var _0x2f5c13=_0xe79a[_0x23cc76];return _0x2f5c13;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0xae79('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x8498=['sequelize','TEXT'];(function(_0x232cbf,_0x3e2f33){var _0x1cd460=function(_0x29b4f3){while(--_0x29b4f3){_0x232cbf['push'](_0x232cbf['shift']());}};_0x1cd460(++_0x3e2f33);}(_0x8498,0xf2));var _0x8849=function(_0x413841,_0x38933d){_0x413841=_0x413841-0x0;var _0x4907d0=_0x8498[_0x413841];return _0x4907d0;};'use strict';var Sequelize=require(_0x8849('0x0'));module['exports']={'tree':{'type':Sequelize[_0x8849('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 221b951..675c480 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 _0x3d05=['nolimit','limit','order','sort','where','filters','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name','index','map','AnalyticTreeReport','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0xc304dc,_0xa53659){var _0x38b100=function(_0x4217c1){while(--_0x4217c1){_0xc304dc['push'](_0xc304dc['shift']());}};_0x38b100(++_0xa53659);}(_0x3d05,0x104));var _0x53d0=function(_0x929c7e,_0x38c4cc){_0x929c7e=_0x929c7e-0x0;var _0x5de099=_0x3d05[_0x929c7e];return _0x5de099;};'use strict';var emlformat=require(_0x53d0('0x0'));var rimraf=require(_0x53d0('0x1'));var zipdir=require(_0x53d0('0x2'));var jsonpatch=require(_0x53d0('0x3'));var rp=require(_0x53d0('0x4'));var moment=require(_0x53d0('0x5'));var BPromise=require(_0x53d0('0x6'));var Mustache=require(_0x53d0('0x7'));var util=require(_0x53d0('0x8'));var path=require(_0x53d0('0x9'));var sox=require(_0x53d0('0xa'));var csv=require(_0x53d0('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53d0('0xc'));var _=require(_0x53d0('0xd'));var squel=require(_0x53d0('0xe'));var crypto=require(_0x53d0('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x53d0('0xb'));var querystring=require(_0x53d0('0x10'));var Papa=require(_0x53d0('0x11'));var Redis=require(_0x53d0('0x12'));var authService=require(_0x53d0('0x13'));var qs=require(_0x53d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x53d0('0x15'));var logger=require(_0x53d0('0x16'))(_0x53d0('0x17'));var utils=require(_0x53d0('0x18'));var config=require(_0x53d0('0x19'));var licenseUtil=require(_0x53d0('0x1a'));var db=require(_0x53d0('0x1b'))['db'];function respondWithStatusCode(_0xc96359,_0x326d1b){_0x326d1b=_0x326d1b||0xcc;return function(_0x3d0ed9){if(_0x3d0ed9){return _0xc96359[_0x53d0('0x1c')](_0x326d1b);}return _0xc96359[_0x53d0('0x1d')](_0x326d1b)[_0x53d0('0x1e')]();};}function respondWithResult(_0x5c2cdc,_0x13f2fb){_0x13f2fb=_0x13f2fb||0xc8;return function(_0x57257e){if(_0x57257e){return _0x5c2cdc['status'](_0x13f2fb)[_0x53d0('0x1f')](_0x57257e);}};}function respondWithFilteredResult(_0x107ba6,_0x58cc09){return function(_0x2c4707){if(_0x2c4707){var _0x214d4f=typeof _0x58cc09[_0x53d0('0x20')]===_0x53d0('0x21')&&typeof _0x58cc09['limit']===_0x53d0('0x21');var _0x4507df=_0x2c4707[_0x53d0('0x22')];var _0x2254de=_0x214d4f?0x0:_0x58cc09['offset'];var _0x5b97b2=_0x214d4f?_0x2c4707[_0x53d0('0x22')]:_0x58cc09[_0x53d0('0x20')]+_0x58cc09['limit'];var _0x23f15b;if(_0x5b97b2>=_0x4507df){_0x5b97b2=_0x4507df;_0x23f15b=0xc8;}else{_0x23f15b=0xce;}_0x107ba6[_0x53d0('0x1d')](_0x23f15b);return _0x107ba6[_0x53d0('0x23')](_0x53d0('0x24'),_0x2254de+'-'+_0x5b97b2+'/'+_0x4507df)[_0x53d0('0x1f')](_0x2c4707);}return null;};}function patchUpdates(_0x184621){return function(_0x1b2d07){try{jsonpatch[_0x53d0('0x25')](_0x1b2d07,_0x184621,!![]);}catch(_0x1d79c2){return BPromise[_0x53d0('0x26')](_0x1d79c2);}return _0x1b2d07[_0x53d0('0x27')]();};}function saveUpdates(_0x156a2a,_0x3462b6){return function(_0x4dc205){if(_0x4dc205){return _0x4dc205['update'](_0x156a2a)[_0x53d0('0x28')](function(_0x29c245){return _0x29c245;});}return null;};}function removeEntity(_0x5d2e77,_0x19f13b){return function(_0x55b5d9){if(_0x55b5d9){return _0x55b5d9[_0x53d0('0x29')]()[_0x53d0('0x28')](function(){_0x5d2e77[_0x53d0('0x1d')](0xcc)[_0x53d0('0x1e')]();});}};}function handleEntityNotFound(_0x192b5e,_0x18be4c){return function(_0xde0013){if(!_0xde0013){_0x192b5e[_0x53d0('0x1c')](0x194);}return _0xde0013;};}function handleError(_0x281cba,_0x946d4c){_0x946d4c=_0x946d4c||0x1f4;return function(_0x1ca453){logger[_0x53d0('0x2a')](_0x1ca453['stack']);if(_0x1ca453[_0x53d0('0x2b')]){delete _0x1ca453[_0x53d0('0x2b')];}_0x281cba[_0x53d0('0x1d')](_0x946d4c)['send'](_0x1ca453);};}exports[_0x53d0('0x2c')]=function(_0x6068b3,_0x1002f0){var _0xdb333a={},_0x3e2198={},_0x4ea7fc={'count':0x0,'rows':[]};var _0x5ca541=_[_0x53d0('0x2d')](db[_0x53d0('0x2e')]['rawAttributes'],function(_0x318c2a){return{'name':_0x318c2a[_0x53d0('0x2f')],'type':_0x318c2a['type'][_0x53d0('0x30')]};});_0x3e2198[_0x53d0('0x31')]=_[_0x53d0('0x2d')](_0x5ca541,_0x53d0('0x2b'));_0x3e2198[_0x53d0('0x32')]=_['keys'](_0x6068b3[_0x53d0('0x32')]);_0x3e2198['filters']=_[_0x53d0('0x33')](_0x3e2198[_0x53d0('0x31')],_0x3e2198[_0x53d0('0x32')]);_0xdb333a[_0x53d0('0x34')]=_[_0x53d0('0x33')](_0x3e2198[_0x53d0('0x31')],qs['fields'](_0x6068b3[_0x53d0('0x32')][_0x53d0('0x35')]));_0xdb333a[_0x53d0('0x34')]=_0xdb333a[_0x53d0('0x34')][_0x53d0('0x36')]?_0xdb333a['attributes']:_0x3e2198['model'];if(!_0x6068b3[_0x53d0('0x32')][_0x53d0('0x37')](_0x53d0('0x38'))){_0xdb333a['limit']=qs[_0x53d0('0x39')](_0x6068b3[_0x53d0('0x32')][_0x53d0('0x39')]);_0xdb333a[_0x53d0('0x20')]=qs[_0x53d0('0x20')](_0x6068b3[_0x53d0('0x32')]['offset']);}_0xdb333a[_0x53d0('0x3a')]=qs[_0x53d0('0x3b')](_0x6068b3['query']['sort']);_0xdb333a[_0x53d0('0x3c')]=qs[_0x53d0('0x3d')](_[_0x53d0('0x3e')](_0x6068b3[_0x53d0('0x32')],_0x3e2198[_0x53d0('0x3d')]),_0x5ca541);if(_0x6068b3[_0x53d0('0x32')][_0x53d0('0x3f')]){_0xdb333a[_0x53d0('0x3c')]=_['merge'](_0xdb333a[_0x53d0('0x3c')],{'$or':_['map'](_0x5ca541,function(_0x22113c){if(_0x22113c[_0x53d0('0x40')]!=='VIRTUAL'){var _0x57c75c={};_0x57c75c[_0x22113c[_0x53d0('0x2b')]]={'$like':'%'+_0x6068b3[_0x53d0('0x32')][_0x53d0('0x3f')]+'%'};return _0x57c75c;}})});}_0xdb333a=_[_0x53d0('0x41')]({},_0xdb333a,_0x6068b3[_0x53d0('0x42')]);var _0x141225={'where':_0xdb333a[_0x53d0('0x3c')]};return db[_0x53d0('0x2e')][_0x53d0('0x22')](_0x141225)[_0x53d0('0x28')](function(_0x194441){_0x4ea7fc[_0x53d0('0x22')]=_0x194441;if(_0x6068b3[_0x53d0('0x32')][_0x53d0('0x43')]){_0xdb333a[_0x53d0('0x44')]=[{'all':!![]}];}return db[_0x53d0('0x2e')][_0x53d0('0x45')](_0xdb333a);})[_0x53d0('0x28')](function(_0x494842){_0x4ea7fc[_0x53d0('0x46')]=_0x494842;return _0x4ea7fc;})[_0x53d0('0x28')](respondWithFilteredResult(_0x1002f0,_0xdb333a))[_0x53d0('0x47')](handleError(_0x1002f0,null));};exports[_0x53d0('0x48')]=function(_0x297f7b,_0x2bd07b){var _0x326525={'raw':!![],'where':{'id':_0x297f7b['params']['id']}},_0x1000cd={};_0x1000cd['model']=_['keys'](db[_0x53d0('0x2e')][_0x53d0('0x49')]);_0x1000cd[_0x53d0('0x32')]=_['keys'](_0x297f7b[_0x53d0('0x32')]);_0x1000cd[_0x53d0('0x3d')]=_['intersection'](_0x1000cd['model'],_0x1000cd['query']);_0x326525['attributes']=_[_0x53d0('0x33')](_0x1000cd[_0x53d0('0x31')],qs[_0x53d0('0x35')](_0x297f7b[_0x53d0('0x32')][_0x53d0('0x35')]));_0x326525['attributes']=_0x326525['attributes']['length']?_0x326525[_0x53d0('0x34')]:_0x1000cd[_0x53d0('0x31')];if(_0x297f7b[_0x53d0('0x32')][_0x53d0('0x43')]){_0x326525[_0x53d0('0x44')]=[{'all':!![]}];}_0x326525=_[_0x53d0('0x41')]({},_0x326525,_0x297f7b[_0x53d0('0x42')]);return db[_0x53d0('0x2e')][_0x53d0('0x4a')](_0x326525)[_0x53d0('0x28')](handleEntityNotFound(_0x2bd07b,null))[_0x53d0('0x28')](respondWithResult(_0x2bd07b,null))['catch'](handleError(_0x2bd07b,null));};exports[_0x53d0('0x4b')]=function(_0xa583f3,_0x3b6e12){return db[_0x53d0('0x2e')][_0x53d0('0x4b')](_0xa583f3[_0x53d0('0x4c')],{})['then'](respondWithResult(_0x3b6e12,0xc9))['catch'](handleError(_0x3b6e12,null));};exports[_0x53d0('0x4d')]=function(_0x552305,_0x39034d){if(_0x552305[_0x53d0('0x4c')]['id']){delete _0x552305[_0x53d0('0x4c')]['id'];}return db[_0x53d0('0x2e')][_0x53d0('0x4a')]({'where':{'id':_0x552305[_0x53d0('0x4e')]['id']}})[_0x53d0('0x28')](handleEntityNotFound(_0x39034d,null))['then'](saveUpdates(_0x552305[_0x53d0('0x4c')],null))[_0x53d0('0x28')](respondWithResult(_0x39034d,null))[_0x53d0('0x47')](handleError(_0x39034d,null));};exports['destroy']=function(_0x2973b4,_0x42f49d){return db[_0x53d0('0x2e')]['find']({'where':{'id':_0x2973b4['params']['id']}})['then'](handleEntityNotFound(_0x42f49d,null))[_0x53d0('0x28')](removeEntity(_0x42f49d,null))[_0x53d0('0x47')](handleError(_0x42f49d,null));}; \ No newline at end of file +var _0x0a0c=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','count','limit','set','Content-Range','reject','save','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','then','include','findAll','catch','params','includeAll','create','body','update','find','eml-format','rimraf','zip-dir','util','path','ejs','fs-extra','squel','crypto','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4c0c8a,_0x20f48f){var _0x177c3a=function(_0x47d277){while(--_0x47d277){_0x4c0c8a['push'](_0x4c0c8a['shift']());}};_0x177c3a(++_0x20f48f);}(_0x0a0c,0x17e));var _0xc0a0=function(_0x47a332,_0x38a628){_0x47a332=_0x47a332-0x0;var _0x12d025=_0x0a0c[_0x47a332];return _0x12d025;};'use strict';var emlformat=require(_0xc0a0('0x0'));var rimraf=require(_0xc0a0('0x1'));var zipdir=require(_0xc0a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc0a0('0x3'));var path=require(_0xc0a0('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc0a0('0x5'));var fs=require('fs');var fs_extra=require(_0xc0a0('0x6'));var _=require('lodash');var squel=require(_0xc0a0('0x7'));var crypto=require(_0xc0a0('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc0a0('0x9'));var querystring=require('querystring');var Papa=require(_0xc0a0('0xa'));var Redis=require(_0xc0a0('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xc0a0('0xc'));var as=require(_0xc0a0('0xd'));var hardwareService=require(_0xc0a0('0xe'));var logger=require(_0xc0a0('0xf'))(_0xc0a0('0x10'));var utils=require(_0xc0a0('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc0a0('0x12'))['db'];function respondWithStatusCode(_0x559949,_0x22f9c2){_0x22f9c2=_0x22f9c2||0xcc;return function(_0x54d907){if(_0x54d907){return _0x559949['sendStatus'](_0x22f9c2);}return _0x559949[_0xc0a0('0x13')](_0x22f9c2)[_0xc0a0('0x14')]();};}function respondWithResult(_0xee0dcb,_0x38e714){_0x38e714=_0x38e714||0xc8;return function(_0x2fe723){if(_0x2fe723){return _0xee0dcb[_0xc0a0('0x13')](_0x38e714)[_0xc0a0('0x15')](_0x2fe723);}};}function respondWithFilteredResult(_0x218a34,_0x1987b1){return function(_0xb4b1b9){if(_0xb4b1b9){var _0x6b292c=typeof _0x1987b1[_0xc0a0('0x16')]==='undefined'&&typeof _0x1987b1['limit']==='undefined';var _0x32759b=_0xb4b1b9[_0xc0a0('0x17')];var _0x2d9e78=_0x6b292c?0x0:_0x1987b1[_0xc0a0('0x16')];var _0x1e36d7=_0x6b292c?_0xb4b1b9[_0xc0a0('0x17')]:_0x1987b1['offset']+_0x1987b1[_0xc0a0('0x18')];var _0x46e74f;if(_0x1e36d7>=_0x32759b){_0x1e36d7=_0x32759b;_0x46e74f=0xc8;}else{_0x46e74f=0xce;}_0x218a34[_0xc0a0('0x13')](_0x46e74f);return _0x218a34[_0xc0a0('0x19')](_0xc0a0('0x1a'),_0x2d9e78+'-'+_0x1e36d7+'/'+_0x32759b)['json'](_0xb4b1b9);}return null;};}function patchUpdates(_0x467614){return function(_0x8bc2b1){try{jsonpatch['apply'](_0x8bc2b1,_0x467614,!![]);}catch(_0x4d8b41){return BPromise[_0xc0a0('0x1b')](_0x4d8b41);}return _0x8bc2b1[_0xc0a0('0x1c')]();};}function saveUpdates(_0x187944,_0x266838){return function(_0x4e8d21){if(_0x4e8d21){return _0x4e8d21['update'](_0x187944)['then'](function(_0x506350){return _0x506350;});}return null;};}function removeEntity(_0x48164c,_0x401291){return function(_0x42c500){if(_0x42c500){return _0x42c500[_0xc0a0('0x1d')]()['then'](function(){_0x48164c['status'](0xcc)[_0xc0a0('0x14')]();});}};}function handleEntityNotFound(_0x326ddc,_0x3f8688){return function(_0x46a2f7){if(!_0x46a2f7){_0x326ddc['sendStatus'](0x194);}return _0x46a2f7;};}function handleError(_0x1a0549,_0x16e3bd){_0x16e3bd=_0x16e3bd||0x1f4;return function(_0x3cb0c8){logger[_0xc0a0('0x1e')](_0x3cb0c8[_0xc0a0('0x1f')]);if(_0x3cb0c8[_0xc0a0('0x20')]){delete _0x3cb0c8['name'];}_0x1a0549[_0xc0a0('0x13')](_0x16e3bd)[_0xc0a0('0x21')](_0x3cb0c8);};}exports[_0xc0a0('0x22')]=function(_0x12e2a2,_0x995640){var _0x4f79ea={},_0x55f379={},_0x7bbc98={'count':0x0,'rows':[]};var _0x5191ea=_[_0xc0a0('0x23')](db[_0xc0a0('0x24')][_0xc0a0('0x25')],function(_0x7673cb){return{'name':_0x7673cb['fieldName'],'type':_0x7673cb[_0xc0a0('0x26')][_0xc0a0('0x27')]};});_0x55f379[_0xc0a0('0x28')]=_['map'](_0x5191ea,_0xc0a0('0x20'));_0x55f379[_0xc0a0('0x29')]=_[_0xc0a0('0x2a')](_0x12e2a2[_0xc0a0('0x29')]);_0x55f379[_0xc0a0('0x2b')]=_[_0xc0a0('0x2c')](_0x55f379[_0xc0a0('0x28')],_0x55f379['query']);_0x4f79ea['attributes']=_[_0xc0a0('0x2c')](_0x55f379['model'],qs[_0xc0a0('0x2d')](_0x12e2a2[_0xc0a0('0x29')][_0xc0a0('0x2d')]));_0x4f79ea[_0xc0a0('0x2e')]=_0x4f79ea[_0xc0a0('0x2e')][_0xc0a0('0x2f')]?_0x4f79ea[_0xc0a0('0x2e')]:_0x55f379[_0xc0a0('0x28')];if(!_0x12e2a2[_0xc0a0('0x29')]['hasOwnProperty'](_0xc0a0('0x30'))){_0x4f79ea[_0xc0a0('0x18')]=qs[_0xc0a0('0x18')](_0x12e2a2[_0xc0a0('0x29')]['limit']);_0x4f79ea[_0xc0a0('0x16')]=qs[_0xc0a0('0x16')](_0x12e2a2[_0xc0a0('0x29')]['offset']);}_0x4f79ea[_0xc0a0('0x31')]=qs[_0xc0a0('0x32')](_0x12e2a2[_0xc0a0('0x29')][_0xc0a0('0x32')]);_0x4f79ea[_0xc0a0('0x33')]=qs['filters'](_[_0xc0a0('0x34')](_0x12e2a2[_0xc0a0('0x29')],_0x55f379[_0xc0a0('0x2b')]),_0x5191ea);if(_0x12e2a2[_0xc0a0('0x29')][_0xc0a0('0x35')]){_0x4f79ea[_0xc0a0('0x33')]=_[_0xc0a0('0x36')](_0x4f79ea[_0xc0a0('0x33')],{'$or':_[_0xc0a0('0x23')](_0x5191ea,function(_0x1998eb){if(_0x1998eb['type']!=='VIRTUAL'){var _0x135463={};_0x135463[_0x1998eb[_0xc0a0('0x20')]]={'$like':'%'+_0x12e2a2[_0xc0a0('0x29')]['filter']+'%'};return _0x135463;}})});}_0x4f79ea=_[_0xc0a0('0x36')]({},_0x4f79ea,_0x12e2a2[_0xc0a0('0x37')]);var _0x2ef117={'where':_0x4f79ea[_0xc0a0('0x33')]};return db['AnalyticTreeReport'][_0xc0a0('0x17')](_0x2ef117)[_0xc0a0('0x38')](function(_0xc229b7){_0x7bbc98[_0xc0a0('0x17')]=_0xc229b7;if(_0x12e2a2['query']['includeAll']){_0x4f79ea[_0xc0a0('0x39')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xc0a0('0x3a')](_0x4f79ea);})[_0xc0a0('0x38')](function(_0x51e0ae){_0x7bbc98['rows']=_0x51e0ae;return _0x7bbc98;})[_0xc0a0('0x38')](respondWithFilteredResult(_0x995640,_0x4f79ea))[_0xc0a0('0x3b')](handleError(_0x995640,null));};exports['show']=function(_0x303afe,_0x88d376){var _0x38b852={'raw':!![],'where':{'id':_0x303afe[_0xc0a0('0x3c')]['id']}},_0x138703={};_0x138703[_0xc0a0('0x28')]=_[_0xc0a0('0x2a')](db['AnalyticTreeReport'][_0xc0a0('0x25')]);_0x138703[_0xc0a0('0x29')]=_[_0xc0a0('0x2a')](_0x303afe[_0xc0a0('0x29')]);_0x138703[_0xc0a0('0x2b')]=_[_0xc0a0('0x2c')](_0x138703['model'],_0x138703[_0xc0a0('0x29')]);_0x38b852['attributes']=_[_0xc0a0('0x2c')](_0x138703[_0xc0a0('0x28')],qs['fields'](_0x303afe[_0xc0a0('0x29')][_0xc0a0('0x2d')]));_0x38b852[_0xc0a0('0x2e')]=_0x38b852[_0xc0a0('0x2e')][_0xc0a0('0x2f')]?_0x38b852[_0xc0a0('0x2e')]:_0x138703['model'];if(_0x303afe[_0xc0a0('0x29')][_0xc0a0('0x3d')]){_0x38b852[_0xc0a0('0x39')]=[{'all':!![]}];}_0x38b852=_[_0xc0a0('0x36')]({},_0x38b852,_0x303afe[_0xc0a0('0x37')]);return db[_0xc0a0('0x24')]['find'](_0x38b852)[_0xc0a0('0x38')](handleEntityNotFound(_0x88d376,null))[_0xc0a0('0x38')](respondWithResult(_0x88d376,null))['catch'](handleError(_0x88d376,null));};exports[_0xc0a0('0x3e')]=function(_0x327bf5,_0x3b81fe){return db['AnalyticTreeReport']['create'](_0x327bf5[_0xc0a0('0x3f')],{})[_0xc0a0('0x38')](respondWithResult(_0x3b81fe,0xc9))['catch'](handleError(_0x3b81fe,null));};exports[_0xc0a0('0x40')]=function(_0x54718b,_0x4779d4){if(_0x54718b[_0xc0a0('0x3f')]['id']){delete _0x54718b[_0xc0a0('0x3f')]['id'];}return db[_0xc0a0('0x24')][_0xc0a0('0x41')]({'where':{'id':_0x54718b[_0xc0a0('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4779d4,null))[_0xc0a0('0x38')](saveUpdates(_0x54718b['body'],null))[_0xc0a0('0x38')](respondWithResult(_0x4779d4,null))['catch'](handleError(_0x4779d4,null));};exports[_0xc0a0('0x1d')]=function(_0x2399cb,_0x49426d){return db[_0xc0a0('0x24')][_0xc0a0('0x41')]({'where':{'id':_0x2399cb['params']['id']}})[_0xc0a0('0x38')](handleEntityNotFound(_0x49426d,null))['then'](removeEntity(_0x49426d,null))['catch'](handleError(_0x49426d,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 837d6a5..272bb1d 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 _0x0adb=['define','analytics_report_trees','lodash','util','../../config/logger','moment','request-promise','rimraf','./analyticTreeReport.attributes'];(function(_0x2cf568,_0x19e000){var _0x5ea874=function(_0x44b46c){while(--_0x44b46c){_0x2cf568['push'](_0x2cf568['shift']());}};_0x5ea874(++_0x19e000);}(_0x0adb,0x14f));var _0xb0ad=function(_0x543960,_0x271658){_0x543960=_0x543960-0x0;var _0x640a49=_0x0adb[_0x543960];return _0x640a49;};'use strict';var _=require(_0xb0ad('0x0'));var util=require(_0xb0ad('0x1'));var logger=require(_0xb0ad('0x2'))('api');var moment=require(_0xb0ad('0x3'));var BPromise=require('bluebird');var rp=require(_0xb0ad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb0ad('0x5'));var config=require('../../config/environment');var attributes=require(_0xb0ad('0x6'));module['exports']=function(_0x3627ec,_0x2328f3){return _0x3627ec[_0xb0ad('0x7')]('AnalyticTreeReport',attributes,{'tableName':_0xb0ad('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68cb=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5cb443,_0x3994d6){var _0x270bf1=function(_0x7a06e){while(--_0x7a06e){_0x5cb443['push'](_0x5cb443['shift']());}};_0x270bf1(++_0x3994d6);}(_0x68cb,0x10e));var _0xb68c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x68cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb68c('0x0'));var logger=require(_0xb68c('0x1'))('api');var moment=require(_0xb68c('0x2'));var BPromise=require(_0xb68c('0x3'));var rp=require(_0xb68c('0x4'));var fs=require('fs');var path=require(_0xb68c('0x5'));var rimraf=require(_0xb68c('0x6'));var config=require(_0xb68c('0x7'));var attributes=require(_0xb68c('0x8'));module[_0xb68c('0x9')]=function(_0x36b57f,_0x1a3700){return _0x36b57f['define'](_0xb68c('0xa'),attributes,{'tableName':_0xb68c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index d8344d8..4b2974b 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x14f2dd,_0x5cc742){var _0x5d071c=function(_0x2d63e8){while(--_0x2d63e8){_0x14f2dd['push'](_0x14f2dd['shift']());}};_0x5d071c(++_0x5cc742);}(_0xdb28,0x106));var _0x8db2=function(_0x41bc66,_0x30a09e){_0x41bc66=_0x41bc66-0x0;var _0x50f121=_0xdb28[_0x41bc66];return _0x50f121;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x1c00fd,_0x5f1937){var _0x2c4d7c=function(_0x2035b0){while(--_0x2035b0){_0x1c00fd['push'](_0x1c00fd['shift']());}};_0x2c4d7c(++_0x5f1937);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5d6652,_0x2c8613){_0x5d6652=_0x5d6652-0x0;var _0x5a699e=_0x5f2f[_0x5d6652];return _0x5a699e;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 679499b..789106b 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 _0x8772=['index','get','/:id','show','post','create','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x8772,0x184));var _0x2877=function(_0x5c1eaf,_0x2d7243){_0x5c1eaf=_0x5c1eaf-0x0;var _0x5d1455=_0x8772[_0x5c1eaf];return _0x5d1455;};'use strict';var multer=require(_0x2877('0x0'));var util=require(_0x2877('0x1'));var path=require(_0x2877('0x2'));var timeout=require('connect-timeout');var express=require(_0x2877('0x3'));var router=express[_0x2877('0x4')]();var fs_extra=require(_0x2877('0x5'));var auth=require(_0x2877('0x6'));var interaction=require(_0x2877('0x7'));var config=require(_0x2877('0x8'));var controller=require(_0x2877('0x9'));router['get']('/',auth[_0x2877('0xa')](),controller[_0x2877('0xb')]);router[_0x2877('0xc')](_0x2877('0xd'),auth['isAuthenticated'](),controller[_0x2877('0xe')]);router[_0x2877('0xf')]('/',auth['isAuthenticated'](),controller[_0x2877('0x10')]);router['put'](_0x2877('0xd'),auth[_0x2877('0xa')](),controller['update']);router[_0x2877('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x2877('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd012=['delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','create','update'];(function(_0x589068,_0x627d6b){var _0x395873=function(_0x5386ca){while(--_0x5386ca){_0x589068['push'](_0x589068['shift']());}};_0x395873(++_0x627d6b);}(_0xd012,0x146));var _0x2d01=function(_0xd8f30d,_0x48a911){_0xd8f30d=_0xd8f30d-0x0;var _0x45326f=_0xd012[_0xd8f30d];return _0x45326f;};'use strict';var multer=require('multer');var util=require(_0x2d01('0x0'));var path=require('path');var timeout=require(_0x2d01('0x1'));var express=require(_0x2d01('0x2'));var router=express[_0x2d01('0x3')]();var fs_extra=require(_0x2d01('0x4'));var auth=require(_0x2d01('0x5'));var interaction=require(_0x2d01('0x6'));var config=require(_0x2d01('0x7'));var controller=require(_0x2d01('0x8'));router[_0x2d01('0x9')]('/',auth[_0x2d01('0xa')](),controller[_0x2d01('0xb')]);router[_0x2d01('0x9')](_0x2d01('0xc'),auth[_0x2d01('0xa')](),controller[_0x2d01('0xd')]);router['post']('/',auth[_0x2d01('0xa')](),controller[_0x2d01('0xe')]);router['put']('/:id',auth[_0x2d01('0xa')](),controller[_0x2d01('0xf')]);router[_0x2d01('0x10')]('/:id',auth[_0x2d01('0xa')](),controller[_0x2d01('0x11')]);module[_0x2d01('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 9f47e21..f101d30 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 _0x7f90=['STRING','sequelize','exports'];(function(_0x574a99,_0xc41992){var _0x124e4b=function(_0x1ddd97){while(--_0x1ddd97){_0x574a99['push'](_0x574a99['shift']());}};_0x124e4b(++_0xc41992);}(_0x7f90,0xf4));var _0x07f9=function(_0x246c1d,_0x48668f){_0x246c1d=_0x246c1d-0x0;var _0x2f5975=_0x7f90[_0x246c1d];return _0x2f5975;};'use strict';var Sequelize=require(_0x07f9('0x0'));module[_0x07f9('0x1')]={'name':{'type':Sequelize[_0x07f9('0x2')]},'basename':{'type':Sequelize[_0x07f9('0x2')]},'type':{'type':Sequelize[_0x07f9('0x2')]}}; \ No newline at end of file +var _0x3f49=['exports','STRING','sequelize'];(function(_0x59b349,_0x50ee5f){var _0x3ac315=function(_0x2a2cf3){while(--_0x2a2cf3){_0x59b349['push'](_0x59b349['shift']());}};_0x3ac315(++_0x50ee5f);}(_0x3f49,0x11f));var _0x93f4=function(_0x65bcf2,_0xbfd0a7){_0x65bcf2=_0x65bcf2-0x0;var _0x42972c=_0x3f49[_0x65bcf2];return _0x42972c;};'use strict';var Sequelize=require(_0x93f4('0x0'));module[_0x93f4('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x93f4('0x2')]},'type':{'type':Sequelize[_0x93f4('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index f40e7a6..25e58d6 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 _0xbeea=['fs-extra','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','set','Content-Range','reject','update','then','destroy','end','error','stack','send','index','map','Attachment','rawAttributes','type','key','name','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','rows','show','params','include','find','clone','omit','createdAt','updatedAt','body','catch','file','basename','create','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbeea,0x146));var _0xabee=function(_0x1d65d1,_0x34fbd1){_0x1d65d1=_0x1d65d1-0x0;var _0x4bf796=_0xbeea[_0x1d65d1];return _0x4bf796;};'use strict';var emlformat=require(_0xabee('0x0'));var rimraf=require(_0xabee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xabee('0x2'));var rp=require('request-promise');var moment=require(_0xabee('0x3'));var BPromise=require(_0xabee('0x4'));var Mustache=require(_0xabee('0x5'));var util=require(_0xabee('0x6'));var path=require(_0xabee('0x7'));var sox=require(_0xabee('0x8'));var csv=require(_0xabee('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xabee('0xa'));var _=require('lodash');var squel=require(_0xabee('0xb'));var crypto=require(_0xabee('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xabee('0x9'));var querystring=require(_0xabee('0xd'));var Papa=require(_0xabee('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xabee('0xf'));var as=require(_0xabee('0x10'));var hardwareService=require(_0xabee('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xabee('0x12'));var db=require(_0xabee('0x13'))['db'];function respondWithStatusCode(_0x5c5627,_0x3b87af){_0x3b87af=_0x3b87af||0xcc;return function(_0x5261dd){if(_0x5261dd){return _0x5c5627['sendStatus'](_0x3b87af);}return _0x5c5627[_0xabee('0x14')](_0x3b87af)['end']();};}function respondWithResult(_0x26650d,_0x429d13){_0x429d13=_0x429d13||0xc8;return function(_0x3e4323){if(_0x3e4323){return _0x26650d[_0xabee('0x14')](_0x429d13)[_0xabee('0x15')](_0x3e4323);}};}function respondWithFilteredResult(_0x53f873,_0x816bcb){return function(_0x413ab6){if(_0x413ab6){var _0x19eaf7=typeof _0x816bcb[_0xabee('0x16')]===_0xabee('0x17')&&typeof _0x816bcb[_0xabee('0x18')]===_0xabee('0x17');var _0x365a37=_0x413ab6['count'];var _0x263dba=_0x19eaf7?0x0:_0x816bcb[_0xabee('0x16')];var _0x37646a=_0x19eaf7?_0x413ab6['count']:_0x816bcb['offset']+_0x816bcb[_0xabee('0x18')];var _0x30996b;if(_0x37646a>=_0x365a37){_0x37646a=_0x365a37;_0x30996b=0xc8;}else{_0x30996b=0xce;}_0x53f873['status'](_0x30996b);return _0x53f873[_0xabee('0x19')](_0xabee('0x1a'),_0x263dba+'-'+_0x37646a+'/'+_0x365a37)['json'](_0x413ab6);}return null;};}function patchUpdates(_0xa84260){return function(_0x46780b){try{jsonpatch['apply'](_0x46780b,_0xa84260,!![]);}catch(_0xdf3771){return BPromise[_0xabee('0x1b')](_0xdf3771);}return _0x46780b['save']();};}function saveUpdates(_0x32b028,_0xd7f00){return function(_0xb9fa7){if(_0xb9fa7){return _0xb9fa7[_0xabee('0x1c')](_0x32b028)[_0xabee('0x1d')](function(_0x57ed8a){return _0x57ed8a;});}return null;};}function removeEntity(_0x537d33,_0x27f2c7){return function(_0x59397c){if(_0x59397c){return _0x59397c[_0xabee('0x1e')]()[_0xabee('0x1d')](function(){_0x537d33[_0xabee('0x14')](0xcc)[_0xabee('0x1f')]();});}};}function handleEntityNotFound(_0x59a941,_0x5a3f26){return function(_0x4cc0a6){if(!_0x4cc0a6){_0x59a941['sendStatus'](0x194);}return _0x4cc0a6;};}function handleError(_0x12c822,_0x2d4c24){_0x2d4c24=_0x2d4c24||0x1f4;return function(_0x55a4b1){logger[_0xabee('0x20')](_0x55a4b1[_0xabee('0x21')]);if(_0x55a4b1['name']){delete _0x55a4b1['name'];}_0x12c822[_0xabee('0x14')](_0x2d4c24)[_0xabee('0x22')](_0x55a4b1);};}exports[_0xabee('0x23')]=function(_0x426b5b,_0x52b545){var _0x32db0a={},_0x2f084e={},_0x28fc5f={'count':0x0,'rows':[]};var _0x2b01a6=_[_0xabee('0x24')](db[_0xabee('0x25')][_0xabee('0x26')],function(_0x2abb8d){return{'name':_0x2abb8d['fieldName'],'type':_0x2abb8d[_0xabee('0x27')][_0xabee('0x28')]};});_0x2f084e['model']=_[_0xabee('0x24')](_0x2b01a6,_0xabee('0x29'));_0x2f084e['query']=_[_0xabee('0x2a')](_0x426b5b[_0xabee('0x2b')]);_0x2f084e[_0xabee('0x2c')]=_[_0xabee('0x2d')](_0x2f084e[_0xabee('0x2e')],_0x2f084e['query']);_0x32db0a[_0xabee('0x2f')]=_['intersection'](_0x2f084e[_0xabee('0x2e')],qs[_0xabee('0x30')](_0x426b5b[_0xabee('0x2b')]['fields']));_0x32db0a[_0xabee('0x2f')]=_0x32db0a[_0xabee('0x2f')][_0xabee('0x31')]?_0x32db0a['attributes']:_0x2f084e[_0xabee('0x2e')];if(!_0x426b5b['query'][_0xabee('0x32')](_0xabee('0x33'))){_0x32db0a[_0xabee('0x18')]=qs[_0xabee('0x18')](_0x426b5b[_0xabee('0x2b')][_0xabee('0x18')]);_0x32db0a[_0xabee('0x16')]=qs['offset'](_0x426b5b['query'][_0xabee('0x16')]);}_0x32db0a[_0xabee('0x34')]=qs[_0xabee('0x35')](_0x426b5b[_0xabee('0x2b')][_0xabee('0x35')]);_0x32db0a[_0xabee('0x36')]=qs[_0xabee('0x2c')](_[_0xabee('0x37')](_0x426b5b[_0xabee('0x2b')],_0x2f084e['filters']),_0x2b01a6);if(_0x426b5b[_0xabee('0x2b')][_0xabee('0x38')]){_0x32db0a[_0xabee('0x36')]=_['merge'](_0x32db0a[_0xabee('0x36')],{'$or':_[_0xabee('0x24')](_0x2b01a6,function(_0x1a3e60){if(_0x1a3e60[_0xabee('0x27')]!==_0xabee('0x39')){var _0xb4bcf3={};_0xb4bcf3[_0x1a3e60[_0xabee('0x29')]]={'$like':'%'+_0x426b5b[_0xabee('0x2b')][_0xabee('0x38')]+'%'};return _0xb4bcf3;}})});}_0x32db0a=_[_0xabee('0x3a')]({},_0x32db0a,_0x426b5b[_0xabee('0x3b')]);var _0x4f3f9b={'where':_0x32db0a[_0xabee('0x36')]};return db[_0xabee('0x25')][_0xabee('0x3c')](_0x4f3f9b)[_0xabee('0x1d')](function(_0x490d17){_0x28fc5f[_0xabee('0x3c')]=_0x490d17;if(_0x426b5b['query'][_0xabee('0x3d')]){_0x32db0a['include']=[{'all':!![]}];}return db[_0xabee('0x25')][_0xabee('0x3e')](_0x32db0a);})[_0xabee('0x1d')](function(_0x117d2d){_0x28fc5f[_0xabee('0x3f')]=_0x117d2d;return _0x28fc5f;})['then'](respondWithFilteredResult(_0x52b545,_0x32db0a))['catch'](handleError(_0x52b545,null));};exports[_0xabee('0x40')]=function(_0x241beb,_0x56f83b){var _0x48ecc7={'raw':!![],'where':{'id':_0x241beb[_0xabee('0x41')]['id']}},_0x2a4208={};_0x2a4208[_0xabee('0x2e')]=_[_0xabee('0x2a')](db[_0xabee('0x25')][_0xabee('0x26')]);_0x2a4208[_0xabee('0x2b')]=_[_0xabee('0x2a')](_0x241beb['query']);_0x2a4208[_0xabee('0x2c')]=_[_0xabee('0x2d')](_0x2a4208[_0xabee('0x2e')],_0x2a4208[_0xabee('0x2b')]);_0x48ecc7[_0xabee('0x2f')]=_[_0xabee('0x2d')](_0x2a4208[_0xabee('0x2e')],qs[_0xabee('0x30')](_0x241beb[_0xabee('0x2b')]['fields']));_0x48ecc7[_0xabee('0x2f')]=_0x48ecc7[_0xabee('0x2f')][_0xabee('0x31')]?_0x48ecc7['attributes']:_0x2a4208[_0xabee('0x2e')];if(_0x241beb[_0xabee('0x2b')][_0xabee('0x3d')]){_0x48ecc7[_0xabee('0x42')]=[{'all':!![]}];}_0x48ecc7=_[_0xabee('0x3a')]({},_0x48ecc7,_0x241beb[_0xabee('0x3b')]);return db[_0xabee('0x25')][_0xabee('0x43')](_0x48ecc7)['then'](handleEntityNotFound(_0x56f83b,null))[_0xabee('0x1d')](respondWithResult(_0x56f83b,null))['catch'](handleError(_0x56f83b,null));};exports[_0xabee('0x44')]=function(_0x295a3b,_0x183d6e){var _0x2785e6={'where':{'id':_0x295a3b[_0xabee('0x41')]['id']}},_0x567fbf={};_0x567fbf[_0xabee('0x2e')]=_[_0xabee('0x2a')](db[_0xabee('0x25')][_0xabee('0x26')]);_0x2785e6[_0xabee('0x2f')]=_[_0xabee('0x2d')](_0x567fbf[_0xabee('0x2e')],qs['fields'](_0x295a3b['query']['fields']));_0x2785e6['attributes']=_0x2785e6[_0xabee('0x2f')][_0xabee('0x31')]?_0x2785e6['attributes']:_0x567fbf[_0xabee('0x2e')];if(_0x295a3b[_0xabee('0x2b')][_0xabee('0x3d')]){_0x2785e6[_0xabee('0x42')]=[{'all':!![]}];}_0x2785e6=_['merge']({},_0x2785e6,_0x295a3b[_0xabee('0x3b')]);return db[_0xabee('0x25')][_0xabee('0x43')](_0x2785e6)[_0xabee('0x1d')](handleEntityNotFound(_0x183d6e,null))[_0xabee('0x1d')](function(_0x58ec75){if(_0x58ec75){var _0x590341=_0x58ec75['get']({'plain':!![]});_0x590341=qs[_0xabee('0x45')](_0x590341,['id',_0xabee('0x46'),_0xabee('0x47')]);_0x295a3b[_0xabee('0x48')]=_[_0xabee('0x45')](_0x295a3b[_0xabee('0x48')],['id',_0xabee('0x46'),_0xabee('0x47')]);return db['Attachment']['create'](_[_0xabee('0x3a')](_0x590341,_0x295a3b[_0xabee('0x48')]),{'include':_0x295a3b[_0xabee('0x2b')][_0xabee('0x3d')]?[{'all':!![]}]:undefined});}})[_0xabee('0x1d')](respondWithResult(_0x183d6e,0xc9))[_0xabee('0x49')](handleError(_0x183d6e,null));};exports[_0xabee('0x1c')]=function(_0xa8fa1a,_0x46adc9){if(_0xa8fa1a[_0xabee('0x48')]['id']){delete _0xa8fa1a[_0xabee('0x48')]['id'];}return db[_0xabee('0x25')][_0xabee('0x43')]({'where':{'id':_0xa8fa1a[_0xabee('0x41')]['id']}})[_0xabee('0x1d')](handleEntityNotFound(_0x46adc9,null))[_0xabee('0x1d')](saveUpdates(_0xa8fa1a[_0xabee('0x48')],null))[_0xabee('0x1d')](respondWithResult(_0x46adc9,null))[_0xabee('0x49')](handleError(_0x46adc9,null));};exports[_0xabee('0x1e')]=function(_0x2ac140,_0xb4b666){return db[_0xabee('0x25')]['find']({'where':{'id':_0x2ac140[_0xabee('0x41')]['id']}})[_0xabee('0x1d')](handleEntityNotFound(_0xb4b666,null))['then'](removeEntity(_0xb4b666,null))['catch'](handleError(_0xb4b666,null));};exports['create']=function(_0x40eedf,_0x563fd3,_0x14a44d){_0x40eedf[_0xabee('0x48')]['name']=_0x40eedf[_0xabee('0x4a')]['originalname'];_0x40eedf[_0xabee('0x48')][_0xabee('0x4b')]=_0x40eedf['file']['filename'];_0x40eedf[_0xabee('0x48')]['type']=_0x40eedf[_0xabee('0x4a')]['mimetype'];return db[_0xabee('0x25')][_0xabee('0x4c')](_0x40eedf[_0xabee('0x48')])['then'](respondWithResult(_0x563fd3,0xc9))[_0xabee('0x49')](handleError(_0x563fd3,null));};exports[_0xabee('0x4d')]=function(_0x1656a5,_0x2fbbbd,_0x10cccf){return db[_0xabee('0x25')][_0xabee('0x4e')]({'where':{'id':_0x1656a5[_0xabee('0x41')]['id']},'raw':!![]})[_0xabee('0x1d')](handleEntityNotFound(_0x2fbbbd,null))[_0xabee('0x1d')](function(_0x5c534d){if(_0x5c534d){var _0x52e7ac=_0x5c534d[_0xabee('0x4f')]!==null;var _0x22e7a1=path[_0xabee('0x50')](config[_0xabee('0x51')],_0xabee('0x52'));if(_0x52e7ac){_0x22e7a1=path[_0xabee('0x50')](_0x22e7a1,_0xabee('0x53'));}var _0x57d7ac=path[_0xabee('0x50')](_0x22e7a1,_0x5c534d[_0xabee('0x4b')]);return _0x2fbbbd[_0xabee('0x4d')](_0x57d7ac);}})[_0xabee('0x49')](handleError(_0x2fbbbd,null));}; \ No newline at end of file +var _0xe433=['fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','destroy','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','then','rows','catch','show','params','length','find','clone','get','createdAt','updatedAt','body','omit','create','update','file','filename','mimetype','findOne','ChatOfflineMessageId','join','offline-chat/','download','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x4af2a5,_0x5c444c){var _0x5138ff=function(_0xed2a77){while(--_0xed2a77){_0x4af2a5['push'](_0x4af2a5['shift']());}};_0x5138ff(++_0x5c444c);}(_0xe433,0xaf));var _0x3e43=function(_0x3a4ec7,_0xc1653e){_0x3a4ec7=_0x3a4ec7-0x0;var _0x1c9333=_0xe433[_0x3a4ec7];return _0x1c9333;};'use strict';var emlformat=require(_0x3e43('0x0'));var rimraf=require(_0x3e43('0x1'));var zipdir=require(_0x3e43('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3e43('0x3'));var moment=require(_0x3e43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3e43('0x5'));var util=require(_0x3e43('0x6'));var path=require(_0x3e43('0x7'));var sox=require(_0x3e43('0x8'));var csv=require(_0x3e43('0x9'));var ejs=require(_0x3e43('0xa'));var fs=require('fs');var fs_extra=require(_0x3e43('0xb'));var _=require(_0x3e43('0xc'));var squel=require(_0x3e43('0xd'));var crypto=require(_0x3e43('0xe'));var jsforce=require(_0x3e43('0xf'));var deskjs=require(_0x3e43('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3e43('0x11'));var Redis=require(_0x3e43('0x12'));var authService=require(_0x3e43('0x13'));var qs=require(_0x3e43('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e43('0x15'));var logger=require(_0x3e43('0x16'))('api');var utils=require(_0x3e43('0x17'));var config=require(_0x3e43('0x18'));var licenseUtil=require(_0x3e43('0x19'));var db=require(_0x3e43('0x1a'))['db'];function respondWithStatusCode(_0x21160f,_0x8c2e80){_0x8c2e80=_0x8c2e80||0xcc;return function(_0x301cf8){if(_0x301cf8){return _0x21160f[_0x3e43('0x1b')](_0x8c2e80);}return _0x21160f[_0x3e43('0x1c')](_0x8c2e80)[_0x3e43('0x1d')]();};}function respondWithResult(_0x14abcd,_0x1f610b){_0x1f610b=_0x1f610b||0xc8;return function(_0x5d324b){if(_0x5d324b){return _0x14abcd[_0x3e43('0x1c')](_0x1f610b)['json'](_0x5d324b);}};}function respondWithFilteredResult(_0x55290f,_0x4260fd){return function(_0x5c158f){if(_0x5c158f){var _0x1c9277=typeof _0x4260fd[_0x3e43('0x1e')]===_0x3e43('0x1f')&&typeof _0x4260fd['limit']==='undefined';var _0xf4c5da=_0x5c158f[_0x3e43('0x20')];var _0x308e57=_0x1c9277?0x0:_0x4260fd[_0x3e43('0x1e')];var _0x4e6cdc=_0x1c9277?_0x5c158f[_0x3e43('0x20')]:_0x4260fd['offset']+_0x4260fd['limit'];var _0x530e7b;if(_0x4e6cdc>=_0xf4c5da){_0x4e6cdc=_0xf4c5da;_0x530e7b=0xc8;}else{_0x530e7b=0xce;}_0x55290f[_0x3e43('0x1c')](_0x530e7b);return _0x55290f[_0x3e43('0x21')](_0x3e43('0x22'),_0x308e57+'-'+_0x4e6cdc+'/'+_0xf4c5da)[_0x3e43('0x23')](_0x5c158f);}return null;};}function patchUpdates(_0x305058){return function(_0x192fa3){try{jsonpatch[_0x3e43('0x24')](_0x192fa3,_0x305058,!![]);}catch(_0x206387){return BPromise[_0x3e43('0x25')](_0x206387);}return _0x192fa3[_0x3e43('0x26')]();};}function saveUpdates(_0x5e515a,_0x118eca){return function(_0x3ece18){if(_0x3ece18){return _0x3ece18['update'](_0x5e515a)['then'](function(_0x2d13c5){return _0x2d13c5;});}return null;};}function removeEntity(_0x29f205,_0x4b1116){return function(_0x17cd67){if(_0x17cd67){return _0x17cd67[_0x3e43('0x27')]()['then'](function(){_0x29f205[_0x3e43('0x1c')](0xcc)[_0x3e43('0x1d')]();});}};}function handleEntityNotFound(_0x13581d,_0x1556eb){return function(_0x533608){if(!_0x533608){_0x13581d[_0x3e43('0x1b')](0x194);}return _0x533608;};}function handleError(_0x1bf615,_0x2397a1){_0x2397a1=_0x2397a1||0x1f4;return function(_0x2936e7){logger[_0x3e43('0x28')](_0x2936e7[_0x3e43('0x29')]);if(_0x2936e7[_0x3e43('0x2a')]){delete _0x2936e7[_0x3e43('0x2a')];}_0x1bf615[_0x3e43('0x1c')](_0x2397a1)[_0x3e43('0x2b')](_0x2936e7);};}exports[_0x3e43('0x2c')]=function(_0x8fdb3c,_0x106ca6){var _0x52ee02={},_0x4964be={},_0x5e6b9a={'count':0x0,'rows':[]};var _0x18041c=_[_0x3e43('0x2d')](db[_0x3e43('0x2e')][_0x3e43('0x2f')],function(_0x107abd){return{'name':_0x107abd[_0x3e43('0x30')],'type':_0x107abd['type'][_0x3e43('0x31')]};});_0x4964be['model']=_['map'](_0x18041c,_0x3e43('0x2a'));_0x4964be[_0x3e43('0x32')]=_[_0x3e43('0x33')](_0x8fdb3c[_0x3e43('0x32')]);_0x4964be[_0x3e43('0x34')]=_[_0x3e43('0x35')](_0x4964be[_0x3e43('0x36')],_0x4964be[_0x3e43('0x32')]);_0x52ee02[_0x3e43('0x37')]=_[_0x3e43('0x35')](_0x4964be[_0x3e43('0x36')],qs[_0x3e43('0x38')](_0x8fdb3c[_0x3e43('0x32')]['fields']));_0x52ee02[_0x3e43('0x37')]=_0x52ee02[_0x3e43('0x37')]['length']?_0x52ee02['attributes']:_0x4964be['model'];if(!_0x8fdb3c['query'][_0x3e43('0x39')]('nolimit')){_0x52ee02[_0x3e43('0x3a')]=qs[_0x3e43('0x3a')](_0x8fdb3c[_0x3e43('0x32')][_0x3e43('0x3a')]);_0x52ee02[_0x3e43('0x1e')]=qs[_0x3e43('0x1e')](_0x8fdb3c[_0x3e43('0x32')][_0x3e43('0x1e')]);}_0x52ee02[_0x3e43('0x3b')]=qs['sort'](_0x8fdb3c[_0x3e43('0x32')][_0x3e43('0x3c')]);_0x52ee02[_0x3e43('0x3d')]=qs[_0x3e43('0x34')](_['pick'](_0x8fdb3c[_0x3e43('0x32')],_0x4964be[_0x3e43('0x34')]),_0x18041c);if(_0x8fdb3c[_0x3e43('0x32')]['filter']){_0x52ee02[_0x3e43('0x3d')]=_[_0x3e43('0x3e')](_0x52ee02[_0x3e43('0x3d')],{'$or':_[_0x3e43('0x2d')](_0x18041c,function(_0x5643fa){if(_0x5643fa[_0x3e43('0x3f')]!==_0x3e43('0x40')){var _0x148243={};_0x148243[_0x5643fa[_0x3e43('0x2a')]]={'$like':'%'+_0x8fdb3c[_0x3e43('0x32')][_0x3e43('0x41')]+'%'};return _0x148243;}})});}_0x52ee02=_['merge']({},_0x52ee02,_0x8fdb3c[_0x3e43('0x42')]);var _0x7d8539={'where':_0x52ee02[_0x3e43('0x3d')]};return db['Attachment'][_0x3e43('0x20')](_0x7d8539)['then'](function(_0x146222){_0x5e6b9a['count']=_0x146222;if(_0x8fdb3c['query'][_0x3e43('0x43')]){_0x52ee02[_0x3e43('0x44')]=[{'all':!![]}];}return db[_0x3e43('0x2e')][_0x3e43('0x45')](_0x52ee02);})[_0x3e43('0x46')](function(_0x87ad56){_0x5e6b9a[_0x3e43('0x47')]=_0x87ad56;return _0x5e6b9a;})['then'](respondWithFilteredResult(_0x106ca6,_0x52ee02))[_0x3e43('0x48')](handleError(_0x106ca6,null));};exports[_0x3e43('0x49')]=function(_0x1ec7d4,_0x11b276){var _0x1317f0={'raw':!![],'where':{'id':_0x1ec7d4[_0x3e43('0x4a')]['id']}},_0x2a6b00={};_0x2a6b00[_0x3e43('0x36')]=_[_0x3e43('0x33')](db[_0x3e43('0x2e')]['rawAttributes']);_0x2a6b00[_0x3e43('0x32')]=_[_0x3e43('0x33')](_0x1ec7d4[_0x3e43('0x32')]);_0x2a6b00[_0x3e43('0x34')]=_['intersection'](_0x2a6b00[_0x3e43('0x36')],_0x2a6b00[_0x3e43('0x32')]);_0x1317f0['attributes']=_['intersection'](_0x2a6b00[_0x3e43('0x36')],qs[_0x3e43('0x38')](_0x1ec7d4['query'][_0x3e43('0x38')]));_0x1317f0[_0x3e43('0x37')]=_0x1317f0[_0x3e43('0x37')][_0x3e43('0x4b')]?_0x1317f0[_0x3e43('0x37')]:_0x2a6b00[_0x3e43('0x36')];if(_0x1ec7d4['query'][_0x3e43('0x43')]){_0x1317f0[_0x3e43('0x44')]=[{'all':!![]}];}_0x1317f0=_[_0x3e43('0x3e')]({},_0x1317f0,_0x1ec7d4[_0x3e43('0x42')]);return db[_0x3e43('0x2e')][_0x3e43('0x4c')](_0x1317f0)[_0x3e43('0x46')](handleEntityNotFound(_0x11b276,null))[_0x3e43('0x46')](respondWithResult(_0x11b276,null))['catch'](handleError(_0x11b276,null));};exports[_0x3e43('0x4d')]=function(_0x45acfc,_0x45415b){var _0x5ef2ce={'where':{'id':_0x45acfc['params']['id']}},_0x458dbb={};_0x458dbb[_0x3e43('0x36')]=_['keys'](db['Attachment'][_0x3e43('0x2f')]);_0x5ef2ce['attributes']=_['intersection'](_0x458dbb['model'],qs[_0x3e43('0x38')](_0x45acfc[_0x3e43('0x32')][_0x3e43('0x38')]));_0x5ef2ce['attributes']=_0x5ef2ce[_0x3e43('0x37')][_0x3e43('0x4b')]?_0x5ef2ce[_0x3e43('0x37')]:_0x458dbb[_0x3e43('0x36')];if(_0x45acfc[_0x3e43('0x32')][_0x3e43('0x43')]){_0x5ef2ce[_0x3e43('0x44')]=[{'all':!![]}];}_0x5ef2ce=_['merge']({},_0x5ef2ce,_0x45acfc[_0x3e43('0x42')]);return db[_0x3e43('0x2e')][_0x3e43('0x4c')](_0x5ef2ce)[_0x3e43('0x46')](handleEntityNotFound(_0x45415b,null))[_0x3e43('0x46')](function(_0x330c0c){if(_0x330c0c){var _0x265eb8=_0x330c0c[_0x3e43('0x4e')]({'plain':!![]});_0x265eb8=qs['omit'](_0x265eb8,['id',_0x3e43('0x4f'),_0x3e43('0x50')]);_0x45acfc[_0x3e43('0x51')]=_[_0x3e43('0x52')](_0x45acfc[_0x3e43('0x51')],['id','createdAt',_0x3e43('0x50')]);return db[_0x3e43('0x2e')][_0x3e43('0x53')](_['merge'](_0x265eb8,_0x45acfc[_0x3e43('0x51')]),{'include':_0x45acfc[_0x3e43('0x32')][_0x3e43('0x43')]?[{'all':!![]}]:undefined});}})[_0x3e43('0x46')](respondWithResult(_0x45415b,0xc9))[_0x3e43('0x48')](handleError(_0x45415b,null));};exports[_0x3e43('0x54')]=function(_0x20e1ad,_0x21f007){if(_0x20e1ad[_0x3e43('0x51')]['id']){delete _0x20e1ad['body']['id'];}return db['Attachment'][_0x3e43('0x4c')]({'where':{'id':_0x20e1ad[_0x3e43('0x4a')]['id']}})[_0x3e43('0x46')](handleEntityNotFound(_0x21f007,null))[_0x3e43('0x46')](saveUpdates(_0x20e1ad[_0x3e43('0x51')],null))[_0x3e43('0x46')](respondWithResult(_0x21f007,null))['catch'](handleError(_0x21f007,null));};exports[_0x3e43('0x27')]=function(_0xfa24c6,_0x1188c6){return db[_0x3e43('0x2e')][_0x3e43('0x4c')]({'where':{'id':_0xfa24c6[_0x3e43('0x4a')]['id']}})[_0x3e43('0x46')](handleEntityNotFound(_0x1188c6,null))['then'](removeEntity(_0x1188c6,null))['catch'](handleError(_0x1188c6,null));};exports['create']=function(_0x4af817,_0x45423b,_0x430d1b){_0x4af817[_0x3e43('0x51')]['name']=_0x4af817['file']['originalname'];_0x4af817[_0x3e43('0x51')]['basename']=_0x4af817[_0x3e43('0x55')][_0x3e43('0x56')];_0x4af817[_0x3e43('0x51')]['type']=_0x4af817[_0x3e43('0x55')][_0x3e43('0x57')];return db[_0x3e43('0x2e')]['create'](_0x4af817['body'])[_0x3e43('0x46')](respondWithResult(_0x45423b,0xc9))['catch'](handleError(_0x45423b,null));};exports['download']=function(_0x4d8c46,_0x12477e,_0x4f3ca8){return db[_0x3e43('0x2e')][_0x3e43('0x58')]({'where':{'id':_0x4d8c46[_0x3e43('0x4a')]['id']},'raw':!![]})[_0x3e43('0x46')](handleEntityNotFound(_0x12477e,null))[_0x3e43('0x46')](function(_0x57ef09){if(_0x57ef09){var _0x1691bc=_0x57ef09[_0x3e43('0x59')]!==null;var _0x37744d=path[_0x3e43('0x5a')](config['root'],'server/files/attachments/');if(_0x1691bc){_0x37744d=path[_0x3e43('0x5a')](_0x37744d,_0x3e43('0x5b'));}var _0x2eb967=path[_0x3e43('0x5a')](_0x37744d,_0x57ef09['basename']);return _0x12477e[_0x3e43('0x5c')](_0x2eb967);}})[_0x3e43('0x48')](handleError(_0x12477e,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 66a4204..899f776 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 _0x0e28=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','attachments','lodash'];(function(_0x3d7022,_0x59dfd5){var _0x40870b=function(_0x20c643){while(--_0x20c643){_0x3d7022['push'](_0x3d7022['shift']());}};_0x40870b(++_0x59dfd5);}(_0x0e28,0x8e));var _0x80e2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0e28[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x80e2('0x0'));var util=require(_0x80e2('0x1'));var logger=require(_0x80e2('0x2'))(_0x80e2('0x3'));var moment=require('moment');var BPromise=require(_0x80e2('0x4'));var rp=require(_0x80e2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x80e2('0x6'));var config=require(_0x80e2('0x7'));var attributes=require('./attachment.attributes');module[_0x80e2('0x8')]=function(_0x4a49b2,_0x386d4e){return _0x4a49b2[_0x80e2('0x9')]('Attachment',attributes,{'tableName':_0x80e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x355d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','lodash'];(function(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0x355d,0xdf));var _0xd355=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x355d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd355('0x0'));var util=require(_0xd355('0x1'));var logger=require(_0xd355('0x2'))(_0xd355('0x3'));var moment=require(_0xd355('0x4'));var BPromise=require(_0xd355('0x5'));var rp=require(_0xd355('0x6'));var fs=require('fs');var path=require(_0xd355('0x7'));var rimraf=require(_0xd355('0x8'));var config=require(_0xd355('0x9'));var attributes=require(_0xd355('0xa'));module[_0xd355('0xb')]=function(_0xb45dfa,_0x128c02){return _0xb45dfa[_0xd355('0xc')](_0xd355('0xd'),attributes,{'tableName':'attachments','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 07bfdd8..6f497e1 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 _0x3036=['request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateAttachment','Attachment','create','body','options','raw','catch','moment','bluebird','randomstring','../../mysqldb','../../config/environment','client','http'];(function(_0x1953e9,_0x58b5bb){var _0x485ae4=function(_0x568c96){while(--_0x568c96){_0x1953e9['push'](_0x1953e9['shift']());}};_0x485ae4(++_0x58b5bb);}(_0x3036,0x1a9));var _0x6303=function(_0x5f016a,_0x2c829f){_0x5f016a=_0x5f016a-0x0;var _0xf108d8=_0x3036[_0x5f016a];return _0xf108d8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6303('0x0'));var BPromise=require(_0x6303('0x1'));var rs=require(_0x6303('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6303('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6303('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x6303('0x5')][_0x6303('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x25a0ce,_0x48c936,_0x8a0038){return new BPromise(function(_0x420da8,_0x2e2be8){return client[_0x6303('0x7')](_0x25a0ce,_0x8a0038)[_0x6303('0x8')](function(_0x2684ac){logger[_0x6303('0x9')](_0x6303('0xa'),_0x48c936,_0x6303('0xb'));logger['debug'](_0x6303('0xc'),_0x48c936,_0x6303('0xb'),JSON[_0x6303('0xd')](_0x2684ac));if(_0x2684ac[_0x6303('0xe')]){if(_0x2684ac[_0x6303('0xe')]['code']===0x1f4){logger[_0x6303('0xe')](_0x6303('0xa'),_0x48c936,_0x2684ac[_0x6303('0xe')][_0x6303('0xf')]);return _0x2e2be8(_0x2684ac[_0x6303('0xe')]['message']);}logger['error']('Attachment,\x20%s,\x20%s',_0x48c936,_0x2684ac[_0x6303('0xe')][_0x6303('0xf')]);return _0x420da8(_0x2684ac[_0x6303('0xe')][_0x6303('0xf')]);}else{logger[_0x6303('0x9')](_0x6303('0xa'),_0x48c936,_0x6303('0xb'));_0x420da8(_0x2684ac[_0x6303('0x10')][_0x6303('0xf')]);}})['catch'](function(_0x50a19c){logger[_0x6303('0xe')](_0x6303('0xa'),_0x48c936,_0x50a19c);_0x2e2be8(_0x50a19c);});});}exports[_0x6303('0x11')]=function(_0x748520){var _0x36a6af=this;return new Promise(function(_0x4fe5cf,_0x30dcd2){return db[_0x6303('0x12')][_0x6303('0x13')](_0x748520[_0x6303('0x14')],{'raw':_0x748520[_0x6303('0x15')]?_0x748520[_0x6303('0x15')][_0x6303('0x16')]===undefined?!![]:![]:!![]})[_0x6303('0x8')](function(_0x223d91){logger[_0x6303('0x9')](_0x6303('0x11'),_0x748520);logger['debug']('CreateAttachment',_0x748520,JSON[_0x6303('0xd')](_0x223d91));_0x4fe5cf(_0x223d91);})[_0x6303('0x17')](function(_0x24c7c5){logger[_0x6303('0xe')]('CreateAttachment',_0x24c7c5[_0x6303('0xf')],_0x748520);_0x30dcd2(_0x36a6af[_0x6303('0xe')](0x1f4,_0x24c7c5[_0x6303('0xf')]));});});}; \ No newline at end of file +var _0xa477=['Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateAttachment','Attachment','create','body','options','raw','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xa477,0xe6));var _0x7a47=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa477[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x7a47('0x0'));var util=require(_0x7a47('0x1'));var moment=require('moment');var BPromise=require(_0x7a47('0x2'));var rs=require(_0x7a47('0x3'));var fs=require('fs');var Redis=require(_0x7a47('0x4'));var db=require(_0x7a47('0x5'))['db'];var utils=require(_0x7a47('0x6'));var logger=require(_0x7a47('0x7'))(_0x7a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a47('0x9'));var client=jayson[_0x7a47('0xa')][_0x7a47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6e0e,_0x54e9aa,_0x47f594){return new BPromise(function(_0x4276ed,_0x49db4c){return client[_0x7a47('0xc')](_0x4c6e0e,_0x47f594)[_0x7a47('0xd')](function(_0x52eb49){logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,_0x7a47('0x10'));logger[_0x7a47('0x11')](_0x7a47('0x12'),_0x54e9aa,'request\x20sent',JSON[_0x7a47('0x13')](_0x52eb49));if(_0x52eb49[_0x7a47('0x14')]){if(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x15')]===0x1f4){logger['error'](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);return _0x49db4c(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')]['message']);return _0x4276ed(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}else{logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,'request\x20sent');_0x4276ed(_0x52eb49[_0x7a47('0x17')][_0x7a47('0x16')]);}})['catch'](function(_0x4a81fb){logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x4a81fb);_0x49db4c(_0x4a81fb);});});}exports[_0x7a47('0x18')]=function(_0x5a4e79){var _0x444c48=this;return new Promise(function(_0x4a24b6,_0x203ab4){return db[_0x7a47('0x19')][_0x7a47('0x1a')](_0x5a4e79[_0x7a47('0x1b')],{'raw':_0x5a4e79[_0x7a47('0x1c')]?_0x5a4e79[_0x7a47('0x1c')][_0x7a47('0x1d')]===undefined?!![]:![]:!![]})[_0x7a47('0xd')](function(_0x46e58d){logger['info'](_0x7a47('0x18'),_0x5a4e79);logger[_0x7a47('0x11')](_0x7a47('0x18'),_0x5a4e79,JSON[_0x7a47('0x13')](_0x46e58d));_0x4a24b6(_0x46e58d);})[_0x7a47('0x1e')](function(_0x322426){logger[_0x7a47('0x14')](_0x7a47('0x18'),_0x322426[_0x7a47('0x16')],_0x5a4e79);_0x203ab4(_0x444c48[_0x7a47('0x14')](0x1f4,_0x322426[_0x7a47('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 4209305..49d8fc0 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 _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x0b0e[_0x2642cb];return _0xe6e41;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 0144245..2a1ea54 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 _0xddab=['blockDuration','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','login','google','profile','email','callback','authenticate','/login','use','clientID','clientSecret','secret','callbackURL','Setting','allowedLoginAttempts'];(function(_0x258e53,_0x5ce840){var _0x51d3a6=function(_0x1c0827){while(--_0x1c0827){_0x258e53['push'](_0x258e53['shift']());}};_0x51d3a6(++_0x5ce840);}(_0xddab,0x86));var _0xbdda=function(_0x149974,_0x2aa3f9){_0x149974=_0x149974-0x0;var _0x26d903=_0xddab[_0x149974];return _0x26d903;};'use strict';var _=require(_0xbdda('0x0'));var passport=require('passport');var GoogleStrategy=require(_0xbdda('0x1'))[_0xbdda('0x2')];var moment=require(_0xbdda('0x3'));var db=require(_0xbdda('0x4'))['db'];var config=require(_0xbdda('0x5'));var signToken=require(_0xbdda('0x6'))['signToken'];var utils=require(_0xbdda('0x7'));exports[_0xbdda('0x8')]=passport['authenticate'](_0xbdda('0x9'),{'failureRedirect':'/login','scope':[_0xbdda('0xa'),_0xbdda('0xb')],'session':![]});exports[_0xbdda('0xc')]=passport[_0xbdda('0xd')]('google',{'failureRedirect':_0xbdda('0xe'),'session':![]});passport[_0xbdda('0xf')](new GoogleStrategy({'clientID':config[_0xbdda('0x9')]?config[_0xbdda('0x9')][_0xbdda('0x10')]:'id','clientSecret':config[_0xbdda('0x9')]?config[_0xbdda('0x9')][_0xbdda('0x11')]:_0xbdda('0x12'),'callbackURL':config[_0xbdda('0x9')]?config[_0xbdda('0x9')][_0xbdda('0x13')]:''},function(_0x4a5709,_0x42123c,_0xf3ae55,_0xe00927){var _0x38adfc,_0x1557f5;return db[_0xbdda('0x14')]['findOne']({'where':{'id':0x1},'attributes':[_0xbdda('0x15'),_0xbdda('0x16')],'raw':!![]})['then'](function(_0x3ccab8){_0x38adfc=_0x3ccab8;return db[_0xbdda('0x17')][_0xbdda('0x18')]({'where':{'email':_[_0xbdda('0x19')](_0xf3ae55[_0xbdda('0x1a')],_0xbdda('0x1b')),'role':{'$or':[_0xbdda('0x1c'),_0xbdda('0x1d'),'agent']}}});})[_0xbdda('0x1e')](function(_0x163eea){_0x1557f5=_0x163eea;if(_0x1557f5){if(_0x1557f5[_0xbdda('0x1f')]){return _0xe00927(_0xbdda('0x20'));}else if(_0x38adfc[_0xbdda('0x16')]>0x0){if(_0x1557f5['blocked']){if(moment(_0x1557f5[_0xbdda('0x21')])[_0xbdda('0x22')](_0x38adfc[_0xbdda('0x16')],_0xbdda('0x23'))>moment()){return _0xe00927(_0xbdda('0x20'));}else{return utils[_0xbdda('0x24')](_0x1557f5,0x0,![],null)[_0xbdda('0x1e')](function(){return utils[_0xbdda('0x25')](_0x1557f5);})[_0xbdda('0x1e')](function(){return _0xe00927(null,_0x1557f5);});}}else{return utils[_0xbdda('0x25')](_0x1557f5)[_0xbdda('0x1e')](function(){return _0xe00927(null,_0x1557f5);});}}else{return utils[_0xbdda('0x25')](_0x1557f5)[_0xbdda('0x1e')](function(){return _0xe00927(null,_0x1557f5);});}}return _0xe00927(_0xbdda('0x20'));})[_0xbdda('0x26')](function(_0x4c7c49){_0xe00927(_0x4c7c49);});})); \ No newline at end of file +var _0x805e=['blockDuration','then','find','map','emails','value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../config/environment','../../components/auth/service','signToken','login','authenticate','google','profile','email','callback','/login','use','clientID','secret','callbackURL','findOne','allowedLoginAttempts'];(function(_0x2a390b,_0xf49f9b){var _0x5df10a=function(_0x115dbe){while(--_0x115dbe){_0x2a390b['push'](_0x2a390b['shift']());}};_0x5df10a(++_0xf49f9b);}(_0x805e,0x171));var _0xe805=function(_0x4f2ce6,_0x2a0163){_0x4f2ce6=_0x4f2ce6-0x0;var _0x3dbb40=_0x805e[_0x4f2ce6];return _0x3dbb40;};'use strict';var _=require(_0xe805('0x0'));var passport=require(_0xe805('0x1'));var GoogleStrategy=require(_0xe805('0x2'))[_0xe805('0x3')];var moment=require(_0xe805('0x4'));var db=require('../../mysqldb')['db'];var config=require(_0xe805('0x5'));var signToken=require(_0xe805('0x6'))[_0xe805('0x7')];var utils=require('../../config/utils');exports[_0xe805('0x8')]=passport[_0xe805('0x9')](_0xe805('0xa'),{'failureRedirect':'/login','scope':[_0xe805('0xb'),_0xe805('0xc')],'session':![]});exports[_0xe805('0xd')]=passport[_0xe805('0x9')](_0xe805('0xa'),{'failureRedirect':_0xe805('0xe'),'session':![]});passport[_0xe805('0xf')](new GoogleStrategy({'clientID':config[_0xe805('0xa')]?config[_0xe805('0xa')][_0xe805('0x10')]:'id','clientSecret':config[_0xe805('0xa')]?config[_0xe805('0xa')]['clientSecret']:_0xe805('0x11'),'callbackURL':config[_0xe805('0xa')]?config['google'][_0xe805('0x12')]:''},function(_0x7b64cb,_0x43d8c5,_0x1fd697,_0x3e5faf){var _0x279959,_0x160224;return db['Setting'][_0xe805('0x13')]({'where':{'id':0x1},'attributes':[_0xe805('0x14'),_0xe805('0x15')],'raw':!![]})[_0xe805('0x16')](function(_0xc961ac){_0x279959=_0xc961ac;return db['User'][_0xe805('0x17')]({'where':{'email':_[_0xe805('0x18')](_0x1fd697[_0xe805('0x19')],_0xe805('0x1a')),'role':{'$or':[_0xe805('0x1b'),_0xe805('0x1c'),_0xe805('0x1d')]}}});})[_0xe805('0x16')](function(_0x3596be){_0x160224=_0x3596be;if(_0x160224){if(_0x160224[_0xe805('0x1e')]){return _0x3e5faf(_0xe805('0x1f'));}else if(_0x279959['blockDuration']>0x0){if(_0x160224[_0xe805('0x20')]){if(moment(_0x160224[_0xe805('0x21')])[_0xe805('0x22')](_0x279959['blockDuration'],_0xe805('0x23'))>moment()){return _0x3e5faf(_0xe805('0x1f'));}else{return utils[_0xe805('0x24')](_0x160224,0x0,![],null)[_0xe805('0x16')](function(){return utils[_0xe805('0x25')](_0x160224);})[_0xe805('0x16')](function(){return _0x3e5faf(null,_0x160224);});}}else{return utils[_0xe805('0x25')](_0x160224)[_0xe805('0x16')](function(){return _0x3e5faf(null,_0x160224);});}}else{return utils[_0xe805('0x25')](_0x160224)['then'](function(){return _0x3e5faf(null,_0x160224);});}}return _0x3e5faf(_0xe805('0x1f'));})[_0xe805('0x26')](function(_0x53daa5){_0x3e5faf(_0x53daa5);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index fd2443d..82400b9 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 _0x6b7b=['isMiddleware','setTokenCookie','exports','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','callback'];(function(_0xab0016,_0x3f7fbe){var _0x307da7=function(_0x4fab84){while(--_0x4fab84){_0xab0016['push'](_0xab0016['shift']());}};_0x307da7(++_0x3f7fbe);}(_0x6b7b,0x93));var _0xb6b7=function(_0x4d6121,_0x76a281){_0x4d6121=_0x4d6121-0x0;var _0xbe22fa=_0x6b7b[_0x4d6121];return _0xbe22fa;};'use strict';var express=require('express');var passport=require(_0xb6b7('0x0'));var router=express[_0xb6b7('0x1')]();var controller=require(_0xb6b7('0x2'));var userController=require(_0xb6b7('0x3'));var authService=require(_0xb6b7('0x4'));router['get']('/',controller[_0xb6b7('0x5')]);router[_0xb6b7('0x6')](_0xb6b7('0x7'),controller[_0xb6b7('0x8')],authService[_0xb6b7('0x9')],userController[_0xb6b7('0x5')],authService[_0xb6b7('0xa')]);module[_0xb6b7('0xb')]=router; \ No newline at end of file +var _0x4098=['../user/user.controller.js','../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie','exports','passport','Router'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x4098,0x120));var _0x8409=function(_0x328bf7,_0x3d7985){_0x328bf7=_0x328bf7-0x0;var _0x14cff7=_0x4098[_0x328bf7];return _0x14cff7;};'use strict';var express=require('express');var passport=require(_0x8409('0x0'));var router=express[_0x8409('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0x8409('0x2'));var authService=require(_0x8409('0x3'));router[_0x8409('0x4')]('/',controller[_0x8409('0x5')]);router['get']('/callback',controller[_0x8409('0x6')],authService[_0x8409('0x7')],userController['login'],authService[_0x8409('0x8')]);module[_0x8409('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 42ca70b..4be41e2 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 _0xbe79=['password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','then','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','MailAccount','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','pass','merge','format','\x22%s\x22\x20<%s>','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','find','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','previousPasswords','status','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0xbe79,0x169));var _0x9be7=function(_0x2f02b5,_0x577559){_0x2f02b5=_0x2f02b5-0x0;var _0x287202=_0xbe79[_0x2f02b5];return _0x287202;};'use strict';var util=require(_0x9be7('0x0'));var passport=require(_0x9be7('0x1'));var LocalStrategy=require(_0x9be7('0x2'))[_0x9be7('0x3')];var jayson=require(_0x9be7('0x4'));var _=require('lodash');var rs=require(_0x9be7('0x5'));var moment=require(_0x9be7('0x6'));var db=require(_0x9be7('0x7'))['db'];var authService=require(_0x9be7('0x8'));var utils=require(_0x9be7('0x9'));var client=jayson[_0x9be7('0xa')]['http']({'port':0x232b});function localAuthenticate(_0x2ddcb5,_0x1b5892,_0x4b4efe,_0x4f4088){var _0x372445,_0x48e09a;return db[_0x9be7('0xb')][_0x9be7('0xc')]({'where':{'id':0x1},'attributes':[_0x9be7('0xd'),_0x9be7('0xe')],'raw':!![]})['then'](function(_0x270451){_0x372445=_0x270451;return _0x2ddcb5[_0x9be7('0xc')]({'attributes':['id','name',_0x9be7('0xf'),_0x9be7('0x10'),_0x9be7('0x11'),_0x9be7('0x12'),_0x9be7('0x13'),_0x9be7('0x14'),_0x9be7('0x15')],'where':{'name':_0x1b5892,'role':{'$or':[_0x9be7('0x16'),_0x9be7('0x17'),_0x9be7('0x18')]}}});})[_0x9be7('0x19')](function(_0x3695f5){if(!_0x3695f5||_0x3695f5&&_0x3695f5[_0x9be7('0x1a')]!==_0x1b5892){throw new Error(_0x9be7('0x1b'));}else{_0x48e09a=_0x3695f5;return _0x48e09a;}})[_0x9be7('0x19')](function(){_0x48e09a[_0x9be7('0x1c')](_0x4b4efe,function(_0x4f89d6,_0x2d3fc6){var _0x314496=_0x48e09a[_0x9be7('0x15')]+0x1;if(_0x4f89d6){return _0x4f4088(_0x4f89d6);}else if(!_0x2d3fc6){if(_0x48e09a[_0x9be7('0x12')]){return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});}else if(_0x372445[_0x9be7('0xd')]>0x0){if(_0x48e09a[_0x9be7('0x13')]){if(_0x372445[_0x9be7('0xe')]>0x0){if(moment(_0x48e09a[_0x9be7('0x14')])[_0x9be7('0x1d')](_0x372445[_0x9be7('0xe')],_0x9be7('0x1e'))>moment()){return _0x4f4088(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x9be7('0x1f')](_0x48e09a,_0x314496,![],null)[_0x9be7('0x19')](function(){return _0x4f4088(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});}}else{if(_0x314496>=_0x372445['allowedLoginAttempts']){return utils[_0x9be7('0x1f')](_0x48e09a,0x0,!![],moment())[_0x9be7('0x19')](function(){return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});});}else{return utils[_0x9be7('0x1f')](_0x48e09a,_0x314496,![],null)[_0x9be7('0x19')](function(){return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});});}}}else{return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});}}else{if(_0x48e09a[_0x9be7('0x12')]){return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});}else if(_0x372445[_0x9be7('0xd')]>0x0){if(_0x48e09a[_0x9be7('0x13')]){if(_0x372445[_0x9be7('0xe')]>0x0){if(moment(_0x48e09a[_0x9be7('0x14')])['add'](_0x372445[_0x9be7('0xe')],_0x9be7('0x1e'))>moment()){return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});}else{return utils['clearBlockUser'](_0x48e09a,0x0,![],null)[_0x9be7('0x19')](function(){return utils[_0x9be7('0x20')](_0x48e09a);})['then'](function(){return _0x4f4088(null,_0x48e09a);});}}else{return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});}}else{return utils[_0x9be7('0x1f')](_0x48e09a,0x0,![],null)['then'](function(){return utils[_0x9be7('0x20')](_0x48e09a);})[_0x9be7('0x19')](function(){return _0x4f4088(null,_0x48e09a);})[_0x9be7('0x21')](function(_0x59a5f5){return _0x4f4088(null,![],_0x59a5f5);});}}else{if(_0x48e09a[_0x9be7('0x13')]){return _0x4f4088(null,![],{'message':_0x9be7('0x1b')});}else{return utils['getLicense'](_0x48e09a)[_0x9be7('0x19')](function(){return _0x4f4088(null,_0x48e09a);});}}}});})[_0x9be7('0x21')](function(_0x53b475){return _0x4f4088(null,![],_0x53b475);});}function sendServiceMail(_0x119f9e){return db[_0x9be7('0x22')]['find']({'where':{'service':!![]},'attributes':['id',_0x9be7('0x1a'),_0x9be7('0x23')],'include':[{'model':db['MailServerOut'],'as':_0x9be7('0x24')}]})['then'](function(_0x3e5b37){if(!_0x3e5b37){throw new Error(_0x9be7('0x25'));}var _0x80a6e0={'tls':{'rejectUnauthorized':![]}};if(_0x3e5b37[_0x9be7('0x24')]['service']){_0x80a6e0[_0x9be7('0x26')]=_0x3e5b37[_0x9be7('0x24')][_0x9be7('0x26')];}else{_0x80a6e0[_0x9be7('0x27')]=_0x3e5b37['Smtp']['host'];_0x80a6e0[_0x9be7('0x28')]=_0x3e5b37[_0x9be7('0x24')][_0x9be7('0x28')];_0x80a6e0[_0x9be7('0x29')]=_0x3e5b37[_0x9be7('0x24')]['secure'];}if(_0x3e5b37['Smtp'][_0x9be7('0x2a')]){_0x80a6e0['auth']={'user':_0x3e5b37[_0x9be7('0x24')][_0x9be7('0x17')],'pass':_0x3e5b37[_0x9be7('0x24')][_0x9be7('0x2b')]};}var _0x25d115={'account':_0x80a6e0,'message':_[_0x9be7('0x2c')]({'from':util[_0x9be7('0x2d')](_0x9be7('0x2e'),_0x3e5b37['name'],_0x3e5b37[_0x9be7('0x23')]||_0x3e5b37[_0x9be7('0x24')][_0x9be7('0x17')])},_0x119f9e)};return client['request'](_0x9be7('0x2f'),_0x25d115);})[_0x9be7('0x19')](function(_0x498bcd){if(_0x498bcd['error']){throw new Error(util[_0x9be7('0x2d')](_0x9be7('0x30'),_0x498bcd[_0x9be7('0x31')][_0x9be7('0x32')]||JSON[_0x9be7('0x33')](_0x498bcd['error'])));}return!![];});}function handleError(_0xb8701b,_0x196580,_0xa861dd){return _0xb8701b['status'](_0x196580||0x1f4)[_0x9be7('0x34')]({'message':_0xa861dd?_0xa861dd[_0x9be7('0x32')]||_0xa861dd:''});}exports[_0x9be7('0x35')]=function(_0x5aaaf4,_0x33722f,_0xe8f8b1){passport[_0x9be7('0x1c')](_0x9be7('0x36'),function(_0x7e3bfc,_0x2545d5,_0x883337){var _0x25d505=_0x7e3bfc||_0x883337;if(_0x25d505){return handleError(_0x33722f,0x191,_0x25d505);}if(!_0x2545d5){return handleError(_0x33722f,0x194,{'message':_0x9be7('0x37')});}else{var _0x3bae1d={'payload':{'id':_0x2545d5['id'],'role':_0x2545d5[_0x9be7('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x9be7('0x38')](_0x3bae1d)['then'](function(_0x58290a){_0x33722f[_0x9be7('0x39')]({'id':_0x2545d5['id'],'token':_0x58290a,'statusCall':'','isAlreadyLogged':_0x2545d5[_0x9be7('0x3a')]});});}})(_0x5aaaf4,_0x33722f,_0xe8f8b1);};exports[_0x9be7('0x3b')]=function(_0x5c0559,_0x2aa760,_0x44834c){if(!_0x5c0559[_0x9be7('0x3c')][_0x9be7('0x23')]){return handleError(_0x2aa760,0x1f4,{'message':_0x9be7('0x3d')});}var _0x5d876a=rs[_0x9be7('0x3e')]();_0x5c0559[_0x9be7('0x3c')][_0x9be7('0x23')]=_0x5c0559[_0x9be7('0x3c')]['email'][_0x9be7('0x3f')]()[_0x9be7('0x40')]();var _0x4a89c0;return db[_0x9be7('0xb')][_0x9be7('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9be7('0xe')],'raw':!![]})[_0x9be7('0x19')](function(_0xb7c712){_0x4a89c0=_0xb7c712;return db[_0x9be7('0x41')]['find']({'where':{'email':_0x5c0559['body'][_0x9be7('0x23')]}});})[_0x9be7('0x19')](function(_0x4eb74b){if(!_0x4eb74b){throw new Error(_0x9be7('0x42'));}if(_0x4eb74b[_0x9be7('0x12')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x4eb74b[_0x9be7('0x13')]){if(moment(_0x4eb74b[_0x9be7('0x14')])[_0x9be7('0x1d')](_0x4a89c0[_0x9be7('0xe')],_0x9be7('0x1e'))>moment()){throw new Error(_0x9be7('0x43'));}else{_0x4eb74b[_0x9be7('0x13')]=![];_0x4eb74b[_0x9be7('0x14')]=null;}}_0x4eb74b[_0x9be7('0x44')]=_0x5d876a;_0x4eb74b[_0x9be7('0x45')]=Date[_0x9be7('0x46')]()+0x36ee80;return _0x4eb74b[_0x9be7('0x47')]();})[_0x9be7('0x19')](function(){return sendServiceMail({'to':_0x5c0559['body'][_0x9be7('0x23')],'subject':_0x9be7('0x48'),'text':_0x9be7('0x49')+_0x9be7('0x4a')+_0x9be7('0x4b')+_0x5c0559[_0x9be7('0x4c')]['host']+_0x9be7('0x4d')+_0x5d876a+'\x0a\x0a'+_0x9be7('0x4e')});})[_0x9be7('0x19')](function(){_0x2aa760['status'](0xc8)['send']({'message':_0x9be7('0x4f')});})['catch'](function(_0x4a43cd){return handleError(_0x2aa760,0x1f4,_0x4a43cd);});};exports[_0x9be7('0x50')]=function(_0x84d731,_0x4f08e9,_0x2ed1b7){return db['User'][_0x9be7('0x51')]({'where':{'resetPasswordToken':_0x84d731[_0x9be7('0x52')][_0x9be7('0x53')],'resetPasswordExpires':{'$gt':Date[_0x9be7('0x46')]()}}})['then'](function(_0x471cec){if(!_0x471cec){throw new Error(_0x9be7('0x54'));}return db[_0x9be7('0xb')][_0x9be7('0xc')]({'attributes':['id',_0x9be7('0x55'),'enforcePasswordHistory',_0x9be7('0x56')]})[_0x9be7('0x19')](function(_0x2d5082){if(_0x2d5082[_0x9be7('0x55')])authService[_0x9be7('0x57')](_0x84d731[_0x9be7('0x3c')][_0x9be7('0xf')]);if(!_0x2d5082[_0x9be7('0x58')]||!_0x471cec['previousPasswords'])return _0x471cec;authService[_0x9be7('0x59')](_0x84d731[_0x9be7('0x3c')][_0x9be7('0xf')],_0x471cec[_0x9be7('0x5a')],_0x2d5082['passwordHistoryLimit']);return _0x471cec;})['then'](function(){_0x471cec['password']=_0x84d731[_0x9be7('0x3c')][_0x9be7('0xf')];_0x471cec[_0x9be7('0x44')]=null;_0x471cec[_0x9be7('0x45')]=null;return _0x471cec[_0x9be7('0x47')]();});})[_0x9be7('0x19')](function(){_0x4f08e9[_0x9be7('0x5b')](0xc8)[_0x9be7('0x34')]({'message':_0x9be7('0x5c')});})[_0x9be7('0x21')](function(_0x531f07){return handleError(_0x4f08e9,0x1f4,_0x531f07);});};passport[_0x9be7('0x5d')](new LocalStrategy({'usernameField':_0x9be7('0x1a'),'passwordField':_0x9be7('0xf')},function(_0x24fcba,_0x2810dd,_0x29b683){return localAuthenticate(db[_0x9be7('0x41')],_0x24fcba,_0x2810dd,_0x29b683);})); \ No newline at end of file +var _0x37dc=['blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','minutes','clearBlockUser','disabled','add','getLicense','catch','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','password','util','passport','passport-local','Strategy','lodash','moment','http','Setting','findOne','blockDuration','then','name','salt','role','blocked'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x37dc,0x1e9));var _0xc37d=function(_0x2ef30e,_0x305a2c){_0x2ef30e=_0x2ef30e-0x0;var _0xd62e2f=_0x37dc[_0x2ef30e];return _0xd62e2f;};'use strict';var util=require(_0xc37d('0x0'));var passport=require(_0xc37d('0x1'));var LocalStrategy=require(_0xc37d('0x2'))[_0xc37d('0x3')];var jayson=require('jayson/promise');var _=require(_0xc37d('0x4'));var rs=require('randomstring');var moment=require(_0xc37d('0x5'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson['client'][_0xc37d('0x6')]({'port':0x232b});function localAuthenticate(_0xa63f50,_0x11fe31,_0x368c3b,_0x1d6e8b){var _0x2076b3,_0x79252d;return db[_0xc37d('0x7')][_0xc37d('0x8')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc37d('0x9')],'raw':!![]})[_0xc37d('0xa')](function(_0x4dcf99){_0x2076b3=_0x4dcf99;return _0xa63f50[_0xc37d('0x8')]({'attributes':['id',_0xc37d('0xb'),'password',_0xc37d('0xc'),_0xc37d('0xd'),'disabled',_0xc37d('0xe'),_0xc37d('0xf'),_0xc37d('0x10')],'where':{'name':_0x11fe31,'role':{'$or':[_0xc37d('0x11'),_0xc37d('0x12'),_0xc37d('0x13')]}}});})[_0xc37d('0xa')](function(_0x364e9a){if(!_0x364e9a||_0x364e9a&&_0x364e9a[_0xc37d('0xb')]!==_0x11fe31){throw new Error(_0xc37d('0x14'));}else{_0x79252d=_0x364e9a;return _0x79252d;}})[_0xc37d('0xa')](function(){_0x79252d[_0xc37d('0x15')](_0x368c3b,function(_0x5371d1,_0x547047){var _0x2e44ea=_0x79252d['loginAttempts']+0x1;if(_0x5371d1){return _0x1d6e8b(_0x5371d1);}else if(!_0x547047){if(_0x79252d['disabled']){return _0x1d6e8b(null,![],{'message':_0xc37d('0x14')});}else if(_0x2076b3[_0xc37d('0x16')]>0x0){if(_0x79252d['blocked']){if(_0x2076b3[_0xc37d('0x9')]>0x0){if(moment(_0x79252d['blockedAt'])['add'](_0x2076b3[_0xc37d('0x9')],_0xc37d('0x17'))>moment()){return _0x1d6e8b(null,![],{'message':_0xc37d('0x14')});}else{return utils[_0xc37d('0x18')](_0x79252d,_0x2e44ea,![],null)[_0xc37d('0xa')](function(){return _0x1d6e8b(null,![],{'message':_0xc37d('0x14')});});}}else{return _0x1d6e8b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2e44ea>=_0x2076b3['allowedLoginAttempts']){return utils[_0xc37d('0x18')](_0x79252d,0x0,!![],moment())[_0xc37d('0xa')](function(){return _0x1d6e8b(null,![],{'message':_0xc37d('0x14')});});}else{return utils['clearBlockUser'](_0x79252d,_0x2e44ea,![],null)[_0xc37d('0xa')](function(){return _0x1d6e8b(null,![],{'message':_0xc37d('0x14')});});}}}else{return _0x1d6e8b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x79252d[_0xc37d('0x19')]){return _0x1d6e8b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2076b3[_0xc37d('0x16')]>0x0){if(_0x79252d[_0xc37d('0xe')]){if(_0x2076b3[_0xc37d('0x9')]>0x0){if(moment(_0x79252d[_0xc37d('0xf')])[_0xc37d('0x1a')](_0x2076b3[_0xc37d('0x9')],_0xc37d('0x17'))>moment()){return _0x1d6e8b(null,![],{'message':_0xc37d('0x14')});}else{return utils[_0xc37d('0x18')](_0x79252d,0x0,![],null)['then'](function(){return utils[_0xc37d('0x1b')](_0x79252d);})[_0xc37d('0xa')](function(){return _0x1d6e8b(null,_0x79252d);});}}else{return _0x1d6e8b(null,![],{'message':_0xc37d('0x14')});}}else{return utils['clearBlockUser'](_0x79252d,0x0,![],null)[_0xc37d('0xa')](function(){return utils['getLicense'](_0x79252d);})['then'](function(){return _0x1d6e8b(null,_0x79252d);})[_0xc37d('0x1c')](function(_0x1d8870){return _0x1d6e8b(null,![],_0x1d8870);});}}else{if(_0x79252d[_0xc37d('0xe')]){return _0x1d6e8b(null,![],{'message':_0xc37d('0x14')});}else{return utils[_0xc37d('0x1b')](_0x79252d)['then'](function(){return _0x1d6e8b(null,_0x79252d);});}}}});})[_0xc37d('0x1c')](function(_0x55f39e){return _0x1d6e8b(null,![],_0x55f39e);});}function sendServiceMail(_0x4090bf){return db['MailAccount'][_0xc37d('0x1d')]({'where':{'service':!![]},'attributes':['id',_0xc37d('0xb'),_0xc37d('0x1e')],'include':[{'model':db[_0xc37d('0x1f')],'as':_0xc37d('0x20')}]})[_0xc37d('0xa')](function(_0x429b4f){if(!_0x429b4f){throw new Error(_0xc37d('0x21'));}var _0x5281cd={'tls':{'rejectUnauthorized':![]}};if(_0x429b4f[_0xc37d('0x20')]['service']){_0x5281cd['service']=_0x429b4f[_0xc37d('0x20')][_0xc37d('0x22')];}else{_0x5281cd[_0xc37d('0x23')]=_0x429b4f[_0xc37d('0x20')][_0xc37d('0x23')];_0x5281cd[_0xc37d('0x24')]=_0x429b4f[_0xc37d('0x20')][_0xc37d('0x24')];_0x5281cd[_0xc37d('0x25')]=_0x429b4f['Smtp']['secure'];}if(_0x429b4f[_0xc37d('0x20')][_0xc37d('0x26')]){_0x5281cd[_0xc37d('0x27')]={'user':_0x429b4f['Smtp'][_0xc37d('0x12')],'pass':_0x429b4f[_0xc37d('0x20')][_0xc37d('0x28')]};}var _0x4ba16d={'account':_0x5281cd,'message':_[_0xc37d('0x29')]({'from':util[_0xc37d('0x2a')](_0xc37d('0x2b'),_0x429b4f[_0xc37d('0xb')],_0x429b4f[_0xc37d('0x1e')]||_0x429b4f['Smtp']['user'])},_0x4090bf)};return client[_0xc37d('0x2c')]('SendMail',_0x4ba16d);})[_0xc37d('0xa')](function(_0x13f8f4){if(_0x13f8f4[_0xc37d('0x2d')]){throw new Error(util[_0xc37d('0x2a')](_0xc37d('0x2e'),_0x13f8f4['error']['message']||JSON[_0xc37d('0x2f')](_0x13f8f4[_0xc37d('0x2d')])));}return!![];});}function handleError(_0x20014b,_0x52fac5,_0x27cf75){return _0x20014b[_0xc37d('0x30')](_0x52fac5||0x1f4)[_0xc37d('0x31')]({'message':_0x27cf75?_0x27cf75[_0xc37d('0x32')]||_0x27cf75:''});}exports[_0xc37d('0x33')]=function(_0x288731,_0xce60d3,_0x4fe880){passport['authenticate'](_0xc37d('0x34'),function(_0x12c71d,_0x220340,_0x503b7e){var _0x54a843=_0x12c71d||_0x503b7e;if(_0x54a843){return handleError(_0xce60d3,0x191,_0x54a843);}if(!_0x220340){return handleError(_0xce60d3,0x194,{'message':_0xc37d('0x35')});}else{var _0x50e7b0={'payload':{'id':_0x220340['id'],'role':_0x220340['role']},'options':{'expiresIn':0x15180}};return authService[_0xc37d('0x36')](_0x50e7b0)['then'](function(_0x156df8){_0xce60d3['json']({'id':_0x220340['id'],'token':_0x156df8,'statusCall':'','isAlreadyLogged':_0x220340[_0xc37d('0x37')]});});}})(_0x288731,_0xce60d3,_0x4fe880);};exports[_0xc37d('0x38')]=function(_0x88ed5d,_0xd7fc53,_0x1f0dbd){if(!_0x88ed5d[_0xc37d('0x39')]['email']){return handleError(_0xd7fc53,0x1f4,{'message':_0xc37d('0x3a')});}var _0x16092c=rs[_0xc37d('0x3b')]();_0x88ed5d['body'][_0xc37d('0x1e')]=_0x88ed5d[_0xc37d('0x39')][_0xc37d('0x1e')]['trim']()['toLowerCase']();var _0xdea30e;return db[_0xc37d('0x7')]['findOne']({'where':{'id':0x1},'attributes':[_0xc37d('0x16'),_0xc37d('0x9')],'raw':!![]})['then'](function(_0x48099b){_0xdea30e=_0x48099b;return db[_0xc37d('0x3c')]['find']({'where':{'email':_0x88ed5d[_0xc37d('0x39')][_0xc37d('0x1e')]}});})['then'](function(_0x3acfe1){if(!_0x3acfe1){throw new Error(_0xc37d('0x3d'));}if(_0x3acfe1['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x3acfe1[_0xc37d('0xe')]){if(moment(_0x3acfe1[_0xc37d('0xf')])[_0xc37d('0x1a')](_0xdea30e[_0xc37d('0x9')],_0xc37d('0x17'))>moment()){throw new Error(_0xc37d('0x3e'));}else{_0x3acfe1[_0xc37d('0xe')]=![];_0x3acfe1[_0xc37d('0xf')]=null;}}_0x3acfe1[_0xc37d('0x3f')]=_0x16092c;_0x3acfe1[_0xc37d('0x40')]=Date[_0xc37d('0x41')]()+0x36ee80;return _0x3acfe1[_0xc37d('0x42')]();})[_0xc37d('0xa')](function(){return sendServiceMail({'to':_0x88ed5d[_0xc37d('0x39')][_0xc37d('0x1e')],'subject':_0xc37d('0x43'),'text':_0xc37d('0x44')+_0xc37d('0x45')+'https://'+_0x88ed5d[_0xc37d('0x46')][_0xc37d('0x23')]+_0xc37d('0x47')+_0x16092c+'\x0a\x0a'+_0xc37d('0x48')});})[_0xc37d('0xa')](function(){_0xd7fc53[_0xc37d('0x30')](0xc8)['send']({'message':_0xc37d('0x49')});})[_0xc37d('0x1c')](function(_0x4fbda0){return handleError(_0xd7fc53,0x1f4,_0x4fbda0);});};exports['reset']=function(_0x840116,_0x5de5a5,_0x141d37){return db[_0xc37d('0x3c')]['find']({'where':{'resetPasswordToken':_0x840116[_0xc37d('0x4a')][_0xc37d('0x4b')],'resetPasswordExpires':{'$gt':Date[_0xc37d('0x41')]()}}})['then'](function(_0xc51444){if(!_0xc51444){throw new Error(_0xc37d('0x4c'));}return db['Setting'][_0xc37d('0x8')]({'attributes':['id',_0xc37d('0x4d'),_0xc37d('0x4e'),_0xc37d('0x4f')]})[_0xc37d('0xa')](function(_0xbad7a5){if(_0xbad7a5['securePassword'])authService[_0xc37d('0x50')](_0x840116[_0xc37d('0x39')]['password']);if(!_0xbad7a5[_0xc37d('0x4e')]||!_0xc51444[_0xc37d('0x51')])return _0xc51444;authService[_0xc37d('0x52')](_0x840116[_0xc37d('0x39')][_0xc37d('0x53')],_0xc51444['previousPasswords'],_0xbad7a5[_0xc37d('0x4f')]);return _0xc51444;})[_0xc37d('0xa')](function(){_0xc51444[_0xc37d('0x53')]=_0x840116[_0xc37d('0x39')][_0xc37d('0x53')];_0xc51444['resetPasswordToken']=null;_0xc51444[_0xc37d('0x40')]=null;return _0xc51444[_0xc37d('0x42')]();});})[_0xc37d('0xa')](function(){_0x5de5a5['status'](0xc8)[_0xc37d('0x31')]({'message':'Password\x20reset!'});})[_0xc37d('0x1c')](function(_0x5b6721){return handleError(_0x5de5a5,0x1f4,_0x5b6721);});};passport['use'](new LocalStrategy({'usernameField':_0xc37d('0xb'),'passwordField':_0xc37d('0x53')},function(_0x51db7b,_0x8e496f,_0x595ac4){return localAuthenticate(db[_0xc37d('0x3c')],_0x51db7b,_0x8e496f,_0x595ac4);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 5ffa333..f837999 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 _0xbe17=['/forgot','forgot','reset','exports','express','Router','./authLocal.controller','login','post'];(function(_0x4f9c8a,_0x16d095){var _0x295b7c=function(_0x120bb8){while(--_0x120bb8){_0x4f9c8a['push'](_0x4f9c8a['shift']());}};_0x295b7c(++_0x16d095);}(_0xbe17,0x16c));var _0x7be1=function(_0x3ee52e,_0x15f364){_0x3ee52e=_0x3ee52e-0x0;var _0x53b240=_0xbe17[_0x3ee52e];return _0x53b240;};'use strict';var express=require(_0x7be1('0x0'));var router=express[_0x7be1('0x1')]();var controller=require(_0x7be1('0x2'));router['post']('/',controller[_0x7be1('0x3')]);router[_0x7be1('0x4')](_0x7be1('0x5'),controller[_0x7be1('0x6')]);router['post']('/reset/:token',controller[_0x7be1('0x7')]);module[_0x7be1('0x8')]=router; \ No newline at end of file +var _0x01ed=['./authLocal.controller','login','post','/forgot','forgot','/reset/:token','reset','exports','express','Router'];(function(_0xb2eceb,_0x41f32e){var _0xc775c4=function(_0x14bd34){while(--_0x14bd34){_0xb2eceb['push'](_0xb2eceb['shift']());}};_0xc775c4(++_0x41f32e);}(_0x01ed,0x134));var _0xd01e=function(_0x20c290,_0x47e736){_0x20c290=_0x20c290-0x0;var _0x3d7b3b=_0x01ed[_0x20c290];return _0x3d7b3b;};'use strict';var express=require(_0xd01e('0x0'));var router=express[_0xd01e('0x1')]();var controller=require(_0xd01e('0x2'));router['post']('/',controller[_0xd01e('0x3')]);router[_0xd01e('0x4')](_0xd01e('0x5'),controller[_0xd01e('0x6')]);router[_0xd01e('0x4')](_0xd01e('0x7'),controller[_0xd01e('0x8')]);module[_0xd01e('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 6ef35ab..8e80f91 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 _0xd7e2=['BOOLEAN','sequelize','exports','STRING'];(function(_0x54ecff,_0x37ce75){var _0x150c26=function(_0x2bc3ea){while(--_0x2bc3ea){_0x54ecff['push'](_0x54ecff['shift']());}};_0x150c26(++_0x37ce75);}(_0xd7e2,0x155));var _0x2d7e=function(_0x34ce2d,_0x4d3c90){_0x34ce2d=_0x34ce2d-0x0;var _0x496aca=_0xd7e2[_0x34ce2d];return _0x496aca;};'use strict';var Sequelize=require(_0x2d7e('0x0'));module[_0x2d7e('0x1')]={'name':{'type':Sequelize[_0x2d7e('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x2d7e('0x2')]},'description':{'type':Sequelize[_0x2d7e('0x2')]},'status':{'type':Sequelize[_0x2d7e('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0xd0b0=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xd0b0,0x161));var _0x0d0b=function(_0x514b68,_0x51fece){_0x514b68=_0x514b68-0x0;var _0x5a517b=_0xd0b0[_0x514b68];return _0x5a517b;};'use strict';var Sequelize=require(_0x0d0b('0x0'));module[_0x0d0b('0x1')]={'name':{'type':Sequelize[_0x0d0b('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x0d0b('0x2')]},'description':{'type':Sequelize[_0x0d0b('0x2')]},'status':{'type':Sequelize[_0x0d0b('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0d0b('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 7859e09..bad12a6 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 _0x5b29=['params','length','find','catch','create','body','addConditions','Condition','ids','omit','getConditions','findOne','order','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','Automation','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x497bba,_0x2e54ae){var _0xb79cdd=function(_0xcdfaf1){while(--_0xcdfaf1){_0x497bba['push'](_0x497bba['shift']());}};_0xb79cdd(++_0x2e54ae);}(_0x5b29,0x160));var _0x95b2=function(_0x168d0c,_0x226ff8){_0x168d0c=_0x168d0c-0x0;var _0x59a4ea=_0x5b29[_0x168d0c];return _0x59a4ea;};'use strict';var emlformat=require(_0x95b2('0x0'));var rimraf=require(_0x95b2('0x1'));var zipdir=require(_0x95b2('0x2'));var jsonpatch=require(_0x95b2('0x3'));var rp=require(_0x95b2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x95b2('0x5'));var util=require(_0x95b2('0x6'));var path=require(_0x95b2('0x7'));var sox=require(_0x95b2('0x8'));var csv=require(_0x95b2('0x9'));var ejs=require(_0x95b2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x95b2('0xb'));var crypto=require(_0x95b2('0xc'));var jsforce=require(_0x95b2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x95b2('0x9'));var querystring=require(_0x95b2('0xe'));var Papa=require('papaparse');var Redis=require(_0x95b2('0xf'));var authService=require(_0x95b2('0x10'));var qs=require(_0x95b2('0x11'));var as=require(_0x95b2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x95b2('0x13'))('api');var utils=require(_0x95b2('0x14'));var config=require(_0x95b2('0x15'));var licenseUtil=require(_0x95b2('0x16'));var db=require(_0x95b2('0x17'))['db'];function respondWithStatusCode(_0x323786,_0x7599ac){_0x7599ac=_0x7599ac||0xcc;return function(_0x2f760c){if(_0x2f760c){return _0x323786[_0x95b2('0x18')](_0x7599ac);}return _0x323786['status'](_0x7599ac)[_0x95b2('0x19')]();};}function respondWithResult(_0x53893c,_0x328486){_0x328486=_0x328486||0xc8;return function(_0x180aab){if(_0x180aab){return _0x53893c[_0x95b2('0x1a')](_0x328486)[_0x95b2('0x1b')](_0x180aab);}};}function respondWithFilteredResult(_0x19a029,_0xd8e43){return function(_0x550f97){if(_0x550f97){var _0x4f4b20=typeof _0xd8e43['offset']==='undefined'&&typeof _0xd8e43[_0x95b2('0x1c')]===_0x95b2('0x1d');var _0x16437c=_0x550f97['count'];var _0x1f3bad=_0x4f4b20?0x0:_0xd8e43[_0x95b2('0x1e')];var _0x2b4bd3=_0x4f4b20?_0x550f97[_0x95b2('0x1f')]:_0xd8e43[_0x95b2('0x1e')]+_0xd8e43[_0x95b2('0x1c')];var _0x2b553d;if(_0x2b4bd3>=_0x16437c){_0x2b4bd3=_0x16437c;_0x2b553d=0xc8;}else{_0x2b553d=0xce;}_0x19a029[_0x95b2('0x1a')](_0x2b553d);return _0x19a029[_0x95b2('0x20')](_0x95b2('0x21'),_0x1f3bad+'-'+_0x2b4bd3+'/'+_0x16437c)[_0x95b2('0x1b')](_0x550f97);}return null;};}function patchUpdates(_0x4c8cbf){return function(_0x468c10){try{jsonpatch[_0x95b2('0x22')](_0x468c10,_0x4c8cbf,!![]);}catch(_0x1e1ba5){return BPromise[_0x95b2('0x23')](_0x1e1ba5);}return _0x468c10[_0x95b2('0x24')]();};}function saveUpdates(_0x187c5c,_0x45d1fb){return function(_0x20f779){if(_0x20f779){return _0x20f779[_0x95b2('0x25')](_0x187c5c)[_0x95b2('0x26')](function(_0x3acb2c){return _0x3acb2c;});}return null;};}function removeEntity(_0x35af0e,_0x471a1f){return function(_0x2ab123){if(_0x2ab123){return _0x2ab123[_0x95b2('0x27')]()['then'](function(){_0x35af0e['status'](0xcc)[_0x95b2('0x19')]();});}};}function handleEntityNotFound(_0x4813b3,_0x501a7d){return function(_0x11f3a2){if(!_0x11f3a2){_0x4813b3[_0x95b2('0x18')](0x194);}return _0x11f3a2;};}function handleError(_0x28131c,_0x106033){_0x106033=_0x106033||0x1f4;return function(_0x19d5ad){logger[_0x95b2('0x28')](_0x19d5ad[_0x95b2('0x29')]);if(_0x19d5ad[_0x95b2('0x2a')]){delete _0x19d5ad[_0x95b2('0x2a')];}_0x28131c[_0x95b2('0x1a')](_0x106033)['send'](_0x19d5ad);};}exports[_0x95b2('0x2b')]=function(_0x5ddbd5,_0x1de965){var _0x3b2449={},_0x324ad5={},_0x41e150={'count':0x0,'rows':[]};var _0x289351=_[_0x95b2('0x2c')](db[_0x95b2('0x2d')][_0x95b2('0x2e')],function(_0x4650c4){return{'name':_0x4650c4[_0x95b2('0x2f')],'type':_0x4650c4[_0x95b2('0x30')]['key']};});_0x324ad5[_0x95b2('0x31')]=_[_0x95b2('0x2c')](_0x289351,'name');_0x324ad5[_0x95b2('0x32')]=_[_0x95b2('0x33')](_0x5ddbd5['query']);_0x324ad5['filters']=_[_0x95b2('0x34')](_0x324ad5['model'],_0x324ad5[_0x95b2('0x32')]);_0x3b2449[_0x95b2('0x35')]=_[_0x95b2('0x34')](_0x324ad5[_0x95b2('0x31')],qs[_0x95b2('0x36')](_0x5ddbd5['query']['fields']));_0x3b2449[_0x95b2('0x35')]=_0x3b2449['attributes']['length']?_0x3b2449['attributes']:_0x324ad5[_0x95b2('0x31')];if(!_0x5ddbd5[_0x95b2('0x32')][_0x95b2('0x37')](_0x95b2('0x38'))){_0x3b2449['limit']=qs['limit'](_0x5ddbd5[_0x95b2('0x32')][_0x95b2('0x1c')]);_0x3b2449[_0x95b2('0x1e')]=qs[_0x95b2('0x1e')](_0x5ddbd5[_0x95b2('0x32')][_0x95b2('0x1e')]);}_0x3b2449['order']=qs['sort'](_0x5ddbd5[_0x95b2('0x32')][_0x95b2('0x39')]);_0x3b2449[_0x95b2('0x3a')]=qs['filters'](_[_0x95b2('0x3b')](_0x5ddbd5[_0x95b2('0x32')],_0x324ad5[_0x95b2('0x3c')]),_0x289351);if(_0x5ddbd5[_0x95b2('0x32')][_0x95b2('0x3d')]){_0x3b2449[_0x95b2('0x3a')]=_['merge'](_0x3b2449['where'],{'$or':_[_0x95b2('0x2c')](_0x289351,function(_0x1e133c){if(_0x1e133c['type']!==_0x95b2('0x3e')){var _0x118486={};_0x118486[_0x1e133c[_0x95b2('0x2a')]]={'$like':'%'+_0x5ddbd5[_0x95b2('0x32')][_0x95b2('0x3d')]+'%'};return _0x118486;}})});}_0x3b2449=_[_0x95b2('0x3f')]({},_0x3b2449,_0x5ddbd5[_0x95b2('0x40')]);var _0xf0e834={'where':_0x3b2449[_0x95b2('0x3a')]};return db[_0x95b2('0x2d')][_0x95b2('0x1f')](_0xf0e834)['then'](function(_0x516c77){_0x41e150[_0x95b2('0x1f')]=_0x516c77;if(_0x5ddbd5['query'][_0x95b2('0x41')]){_0x3b2449[_0x95b2('0x42')]=[{'all':!![]}];}return db[_0x95b2('0x2d')][_0x95b2('0x43')](_0x3b2449);})['then'](function(_0x2f32fd){_0x41e150['rows']=_0x2f32fd;return _0x41e150;})[_0x95b2('0x26')](respondWithFilteredResult(_0x1de965,_0x3b2449))['catch'](handleError(_0x1de965,null));};exports['show']=function(_0x2d4053,_0x2eb011){var _0x5183a1={'raw':![],'where':{'id':_0x2d4053[_0x95b2('0x44')]['id']}},_0x4acbbe={};_0x4acbbe[_0x95b2('0x31')]=_[_0x95b2('0x33')](db[_0x95b2('0x2d')][_0x95b2('0x2e')]);_0x4acbbe['query']=_[_0x95b2('0x33')](_0x2d4053[_0x95b2('0x32')]);_0x4acbbe[_0x95b2('0x3c')]=_[_0x95b2('0x34')](_0x4acbbe[_0x95b2('0x31')],_0x4acbbe['query']);_0x5183a1[_0x95b2('0x35')]=_['intersection'](_0x4acbbe['model'],qs[_0x95b2('0x36')](_0x2d4053[_0x95b2('0x32')]['fields']));_0x5183a1[_0x95b2('0x35')]=_0x5183a1[_0x95b2('0x35')][_0x95b2('0x45')]?_0x5183a1[_0x95b2('0x35')]:_0x4acbbe['model'];if(_0x2d4053[_0x95b2('0x32')][_0x95b2('0x41')]){_0x5183a1[_0x95b2('0x42')]=[{'all':!![]}];}_0x5183a1=_[_0x95b2('0x3f')]({},_0x5183a1,_0x2d4053[_0x95b2('0x40')]);return db[_0x95b2('0x2d')][_0x95b2('0x46')](_0x5183a1)['then'](handleEntityNotFound(_0x2eb011,null))['then'](respondWithResult(_0x2eb011,null))[_0x95b2('0x47')](handleError(_0x2eb011,null));};exports[_0x95b2('0x48')]=function(_0x2a5ee0,_0x19b53c){return db[_0x95b2('0x2d')][_0x95b2('0x48')](_0x2a5ee0[_0x95b2('0x49')],{})['then'](respondWithResult(_0x19b53c,0xc9))[_0x95b2('0x47')](handleError(_0x19b53c,null));};exports['update']=function(_0x1fc51b,_0x7c0665){if(_0x1fc51b['body']['id']){delete _0x1fc51b[_0x95b2('0x49')]['id'];}return db[_0x95b2('0x2d')][_0x95b2('0x46')]({'where':{'id':_0x1fc51b['params']['id']}})[_0x95b2('0x26')](handleEntityNotFound(_0x7c0665,null))[_0x95b2('0x26')](saveUpdates(_0x1fc51b[_0x95b2('0x49')],null))['then'](respondWithResult(_0x7c0665,null))[_0x95b2('0x47')](handleError(_0x7c0665,null));};exports[_0x95b2('0x27')]=function(_0x37a18c,_0x1be130){return db[_0x95b2('0x2d')][_0x95b2('0x46')]({'where':{'id':_0x37a18c[_0x95b2('0x44')]['id']}})['then'](handleEntityNotFound(_0x1be130,null))[_0x95b2('0x26')](removeEntity(_0x1be130,null))[_0x95b2('0x47')](handleError(_0x1be130,null));};exports[_0x95b2('0x4a')]=function(_0x2ed529,_0x153bf1,_0x5c6456){return db[_0x95b2('0x4b')]['find']({'where':{'id':_0x2ed529[_0x95b2('0x44')]['id']}})['then'](handleEntityNotFound(_0x153bf1,null))[_0x95b2('0x26')](function(_0x5829d9){if(_0x5829d9){return _0x5829d9[_0x95b2('0x4a')](_0x2ed529[_0x95b2('0x49')][_0x95b2('0x4c')],_[_0x95b2('0x4d')](_0x2ed529[_0x95b2('0x49')],[_0x95b2('0x4c'),'id'])||{});}})[_0x95b2('0x26')](respondWithResult(_0x153bf1,null))[_0x95b2('0x47')](handleError(_0x153bf1,null));};exports[_0x95b2('0x4e')]=function(_0x2dbe91,_0x3d8812,_0x1fc6cd){var _0x1d9ebe={};var _0x5e8bb0={};var _0x3e259b;var _0x41a13d;return db['Automation'][_0x95b2('0x4f')]({'where':{'id':_0x2dbe91['params']['id']}})['then'](handleEntityNotFound(_0x3d8812,null))[_0x95b2('0x26')](function(_0x36b1e3){if(_0x36b1e3){_0x3e259b=_0x36b1e3;_0x5e8bb0['model']=_['keys'](db[_0x95b2('0x4b')][_0x95b2('0x2e')]);_0x5e8bb0[_0x95b2('0x32')]=_['keys'](_0x2dbe91['query']);_0x5e8bb0[_0x95b2('0x3c')]=_[_0x95b2('0x34')](_0x5e8bb0[_0x95b2('0x31')],_0x5e8bb0[_0x95b2('0x32')]);_0x1d9ebe[_0x95b2('0x35')]=_[_0x95b2('0x34')](_0x5e8bb0[_0x95b2('0x31')],qs[_0x95b2('0x36')](_0x2dbe91[_0x95b2('0x32')]['fields']));_0x1d9ebe[_0x95b2('0x35')]=_0x1d9ebe[_0x95b2('0x35')]['length']?_0x1d9ebe['attributes']:_0x5e8bb0[_0x95b2('0x31')];_0x1d9ebe[_0x95b2('0x50')]=qs[_0x95b2('0x39')](_0x2dbe91[_0x95b2('0x32')][_0x95b2('0x39')]);_0x1d9ebe[_0x95b2('0x3a')]=qs['filters'](_['pick'](_0x2dbe91[_0x95b2('0x32')],_0x5e8bb0['filters']));if(_0x2dbe91[_0x95b2('0x32')][_0x95b2('0x3d')]){_0x1d9ebe['where']=_[_0x95b2('0x3f')](_0x1d9ebe[_0x95b2('0x3a')],{'$or':_['map'](_0x1d9ebe[_0x95b2('0x35')],function(_0x1f0910){var _0x1ca14e={};_0x1ca14e[_0x1f0910]={'$like':'%'+_0x2dbe91[_0x95b2('0x32')]['filter']+'%'};return _0x1ca14e;})});}_0x1d9ebe=_[_0x95b2('0x3f')]({},_0x1d9ebe,_0x2dbe91[_0x95b2('0x40')]);return _0x3e259b[_0x95b2('0x4e')](_0x1d9ebe);}})['then'](function(_0x14e778){if(_0x14e778){_0x41a13d=_0x14e778[_0x95b2('0x45')];if(!_0x2dbe91['query']['hasOwnProperty']('nolimit')){_0x1d9ebe[_0x95b2('0x1c')]=qs[_0x95b2('0x1c')](_0x2dbe91[_0x95b2('0x32')][_0x95b2('0x1c')]);_0x1d9ebe['offset']=qs[_0x95b2('0x1e')](_0x2dbe91[_0x95b2('0x32')][_0x95b2('0x1e')]);}return _0x3e259b[_0x95b2('0x4e')](_0x1d9ebe);}})[_0x95b2('0x26')](function(_0x50774a){if(_0x50774a){return _0x50774a?{'count':_0x41a13d,'rows':_0x50774a}:null;}})[_0x95b2('0x26')](respondWithResult(_0x3d8812,null))[_0x95b2('0x47')](handleError(_0x3d8812,null));};exports[_0x95b2('0x51')]=function(_0x35f23a,_0x18920f,_0x394415){return db['Action'][_0x95b2('0x46')]({'where':{'id':_0x35f23a[_0x95b2('0x44')]['id']}})['then'](handleEntityNotFound(_0x18920f,null))[_0x95b2('0x26')](function(_0x5ea447){if(_0x5ea447){return _0x5ea447['addActions'](_0x35f23a[_0x95b2('0x49')][_0x95b2('0x4c')],_[_0x95b2('0x4d')](_0x35f23a[_0x95b2('0x49')],['ids','id'])||{});}})[_0x95b2('0x26')](respondWithResult(_0x18920f,null))[_0x95b2('0x47')](handleError(_0x18920f,null));};exports['getActions']=function(_0x35fdd6,_0x3745fc,_0x2a9e7c){var _0x34b1e0={};var _0x4f11a3={};var _0x5c335a;var _0x15a401;return db[_0x95b2('0x2d')]['findOne']({'where':{'id':_0x35fdd6[_0x95b2('0x44')]['id']}})[_0x95b2('0x26')](handleEntityNotFound(_0x3745fc,null))[_0x95b2('0x26')](function(_0x3946a6){if(_0x3946a6){_0x5c335a=_0x3946a6;_0x4f11a3[_0x95b2('0x31')]=_['keys'](db[_0x95b2('0x52')]['rawAttributes']);_0x4f11a3[_0x95b2('0x32')]=_[_0x95b2('0x33')](_0x35fdd6[_0x95b2('0x32')]);_0x4f11a3['filters']=_[_0x95b2('0x34')](_0x4f11a3['model'],_0x4f11a3[_0x95b2('0x32')]);_0x34b1e0['attributes']=_['intersection'](_0x4f11a3[_0x95b2('0x31')],qs['fields'](_0x35fdd6[_0x95b2('0x32')]['fields']));_0x34b1e0[_0x95b2('0x35')]=_0x34b1e0[_0x95b2('0x35')][_0x95b2('0x45')]?_0x34b1e0[_0x95b2('0x35')]:_0x4f11a3['model'];_0x34b1e0[_0x95b2('0x50')]=qs[_0x95b2('0x39')](_0x35fdd6[_0x95b2('0x32')][_0x95b2('0x39')]);_0x34b1e0[_0x95b2('0x3a')]=qs[_0x95b2('0x3c')](_[_0x95b2('0x3b')](_0x35fdd6[_0x95b2('0x32')],_0x4f11a3[_0x95b2('0x3c')]));if(_0x35fdd6['query'][_0x95b2('0x3d')]){_0x34b1e0[_0x95b2('0x3a')]=_['merge'](_0x34b1e0[_0x95b2('0x3a')],{'$or':_['map'](_0x34b1e0[_0x95b2('0x35')],function(_0x56244b){var _0x46a3e8={};_0x46a3e8[_0x56244b]={'$like':'%'+_0x35fdd6[_0x95b2('0x32')][_0x95b2('0x3d')]+'%'};return _0x46a3e8;})});}_0x34b1e0=_[_0x95b2('0x3f')]({},_0x34b1e0,_0x35fdd6['options']);return _0x5c335a[_0x95b2('0x53')](_0x34b1e0);}})[_0x95b2('0x26')](function(_0x52a8a5){if(_0x52a8a5){_0x15a401=_0x52a8a5['length'];if(!_0x35fdd6['query'][_0x95b2('0x37')](_0x95b2('0x38'))){_0x34b1e0[_0x95b2('0x1c')]=qs['limit'](_0x35fdd6[_0x95b2('0x32')][_0x95b2('0x1c')]);_0x34b1e0[_0x95b2('0x1e')]=qs['offset'](_0x35fdd6['query'][_0x95b2('0x1e')]);}return _0x5c335a['getActions'](_0x34b1e0);}})[_0x95b2('0x26')](function(_0x27a8ae){if(_0x27a8ae){return _0x27a8ae?{'count':_0x15a401,'rows':_0x27a8ae}:null;}})[_0x95b2('0x26')](respondWithResult(_0x3745fc,null))[_0x95b2('0x47')](handleError(_0x3745fc,null));}; \ No newline at end of file +var _0x4155=['body','addConditions','ids','omit','getConditions','findOne','Condition','pick','nolimit','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','Automation','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','show','params','rawAttributes','keys','find','catch','create'];(function(_0x22a8cf,_0x45d864){var _0x48e5ab=function(_0x2f833b){while(--_0x2f833b){_0x22a8cf['push'](_0x22a8cf['shift']());}};_0x48e5ab(++_0x45d864);}(_0x4155,0x14c));var _0x5415=function(_0x45bf3e,_0x171fdb){_0x45bf3e=_0x45bf3e-0x0;var _0x1deb48=_0x4155[_0x45bf3e];return _0x1deb48;};'use strict';var emlformat=require(_0x5415('0x0'));var rimraf=require(_0x5415('0x1'));var zipdir=require(_0x5415('0x2'));var jsonpatch=require(_0x5415('0x3'));var rp=require(_0x5415('0x4'));var moment=require('moment');var BPromise=require(_0x5415('0x5'));var Mustache=require(_0x5415('0x6'));var util=require(_0x5415('0x7'));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(_0x5415('0x8'));var _=require(_0x5415('0x9'));var squel=require(_0x5415('0xa'));var crypto=require('crypto');var jsforce=require(_0x5415('0xb'));var deskjs=require(_0x5415('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5415('0xd'));var Papa=require(_0x5415('0xe'));var Redis=require(_0x5415('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5415('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5415('0x11'))(_0x5415('0x12'));var utils=require('../../config/utils');var config=require(_0x5415('0x13'));var licenseUtil=require(_0x5415('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ec7d2,_0x4e8248){_0x4e8248=_0x4e8248||0xcc;return function(_0x5df151){if(_0x5df151){return _0x2ec7d2['sendStatus'](_0x4e8248);}return _0x2ec7d2[_0x5415('0x15')](_0x4e8248)[_0x5415('0x16')]();};}function respondWithResult(_0x5a921f,_0x40692f){_0x40692f=_0x40692f||0xc8;return function(_0x539157){if(_0x539157){return _0x5a921f[_0x5415('0x15')](_0x40692f)[_0x5415('0x17')](_0x539157);}};}function respondWithFilteredResult(_0x4785e6,_0x415063){return function(_0x4c22eb){if(_0x4c22eb){var _0x42d951=typeof _0x415063['offset']===_0x5415('0x18')&&typeof _0x415063['limit']==='undefined';var _0x5eea9c=_0x4c22eb[_0x5415('0x19')];var _0x430ea1=_0x42d951?0x0:_0x415063[_0x5415('0x1a')];var _0x5e5b4c=_0x42d951?_0x4c22eb[_0x5415('0x19')]:_0x415063[_0x5415('0x1a')]+_0x415063[_0x5415('0x1b')];var _0x196332;if(_0x5e5b4c>=_0x5eea9c){_0x5e5b4c=_0x5eea9c;_0x196332=0xc8;}else{_0x196332=0xce;}_0x4785e6[_0x5415('0x15')](_0x196332);return _0x4785e6[_0x5415('0x1c')](_0x5415('0x1d'),_0x430ea1+'-'+_0x5e5b4c+'/'+_0x5eea9c)[_0x5415('0x17')](_0x4c22eb);}return null;};}function patchUpdates(_0x412b49){return function(_0x57e136){try{jsonpatch[_0x5415('0x1e')](_0x57e136,_0x412b49,!![]);}catch(_0x363140){return BPromise[_0x5415('0x1f')](_0x363140);}return _0x57e136[_0x5415('0x20')]();};}function saveUpdates(_0x2ac4be,_0x4ef271){return function(_0x47607a){if(_0x47607a){return _0x47607a[_0x5415('0x21')](_0x2ac4be)[_0x5415('0x22')](function(_0x388b6f){return _0x388b6f;});}return null;};}function removeEntity(_0x3cff79,_0x5012f4){return function(_0x3ee975){if(_0x3ee975){return _0x3ee975[_0x5415('0x23')]()[_0x5415('0x22')](function(){_0x3cff79[_0x5415('0x15')](0xcc)[_0x5415('0x16')]();});}};}function handleEntityNotFound(_0x11befb,_0x5c1e1f){return function(_0x39b942){if(!_0x39b942){_0x11befb['sendStatus'](0x194);}return _0x39b942;};}function handleError(_0x3cc88a,_0x4623f6){_0x4623f6=_0x4623f6||0x1f4;return function(_0x3eecc9){logger[_0x5415('0x24')](_0x3eecc9['stack']);if(_0x3eecc9[_0x5415('0x25')]){delete _0x3eecc9[_0x5415('0x25')];}_0x3cc88a['status'](_0x4623f6)[_0x5415('0x26')](_0x3eecc9);};}exports['index']=function(_0x3063be,_0x4be92c){var _0x51f605={},_0x249b37={},_0x15a30={'count':0x0,'rows':[]};var _0x3e44b7=_[_0x5415('0x27')](db[_0x5415('0x28')]['rawAttributes'],function(_0x36eafb){return{'name':_0x36eafb['fieldName'],'type':_0x36eafb['type'][_0x5415('0x29')]};});_0x249b37[_0x5415('0x2a')]=_['map'](_0x3e44b7,_0x5415('0x25'));_0x249b37[_0x5415('0x2b')]=_['keys'](_0x3063be[_0x5415('0x2b')]);_0x249b37[_0x5415('0x2c')]=_[_0x5415('0x2d')](_0x249b37[_0x5415('0x2a')],_0x249b37[_0x5415('0x2b')]);_0x51f605[_0x5415('0x2e')]=_[_0x5415('0x2d')](_0x249b37[_0x5415('0x2a')],qs[_0x5415('0x2f')](_0x3063be[_0x5415('0x2b')]['fields']));_0x51f605[_0x5415('0x2e')]=_0x51f605[_0x5415('0x2e')][_0x5415('0x30')]?_0x51f605['attributes']:_0x249b37[_0x5415('0x2a')];if(!_0x3063be[_0x5415('0x2b')][_0x5415('0x31')]('nolimit')){_0x51f605[_0x5415('0x1b')]=qs['limit'](_0x3063be[_0x5415('0x2b')]['limit']);_0x51f605[_0x5415('0x1a')]=qs['offset'](_0x3063be['query'][_0x5415('0x1a')]);}_0x51f605[_0x5415('0x32')]=qs[_0x5415('0x33')](_0x3063be[_0x5415('0x2b')][_0x5415('0x33')]);_0x51f605[_0x5415('0x34')]=qs[_0x5415('0x2c')](_['pick'](_0x3063be[_0x5415('0x2b')],_0x249b37['filters']),_0x3e44b7);if(_0x3063be[_0x5415('0x2b')]['filter']){_0x51f605[_0x5415('0x34')]=_[_0x5415('0x35')](_0x51f605['where'],{'$or':_[_0x5415('0x27')](_0x3e44b7,function(_0x330b61){if(_0x330b61[_0x5415('0x36')]!==_0x5415('0x37')){var _0x3c51bd={};_0x3c51bd[_0x330b61[_0x5415('0x25')]]={'$like':'%'+_0x3063be[_0x5415('0x2b')][_0x5415('0x38')]+'%'};return _0x3c51bd;}})});}_0x51f605=_[_0x5415('0x35')]({},_0x51f605,_0x3063be[_0x5415('0x39')]);var _0x2c4238={'where':_0x51f605[_0x5415('0x34')]};return db['Automation'][_0x5415('0x19')](_0x2c4238)[_0x5415('0x22')](function(_0x17ce97){_0x15a30[_0x5415('0x19')]=_0x17ce97;if(_0x3063be[_0x5415('0x2b')][_0x5415('0x3a')]){_0x51f605[_0x5415('0x3b')]=[{'all':!![]}];}return db[_0x5415('0x28')]['findAll'](_0x51f605);})[_0x5415('0x22')](function(_0x574b29){_0x15a30[_0x5415('0x3c')]=_0x574b29;return _0x15a30;})[_0x5415('0x22')](respondWithFilteredResult(_0x4be92c,_0x51f605))['catch'](handleError(_0x4be92c,null));};exports[_0x5415('0x3d')]=function(_0x5e532c,_0x4b9e4e){var _0x64e166={'raw':![],'where':{'id':_0x5e532c[_0x5415('0x3e')]['id']}},_0x27f0dc={};_0x27f0dc[_0x5415('0x2a')]=_['keys'](db[_0x5415('0x28')][_0x5415('0x3f')]);_0x27f0dc[_0x5415('0x2b')]=_[_0x5415('0x40')](_0x5e532c[_0x5415('0x2b')]);_0x27f0dc[_0x5415('0x2c')]=_[_0x5415('0x2d')](_0x27f0dc[_0x5415('0x2a')],_0x27f0dc[_0x5415('0x2b')]);_0x64e166[_0x5415('0x2e')]=_[_0x5415('0x2d')](_0x27f0dc[_0x5415('0x2a')],qs['fields'](_0x5e532c['query']['fields']));_0x64e166[_0x5415('0x2e')]=_0x64e166[_0x5415('0x2e')][_0x5415('0x30')]?_0x64e166[_0x5415('0x2e')]:_0x27f0dc[_0x5415('0x2a')];if(_0x5e532c[_0x5415('0x2b')][_0x5415('0x3a')]){_0x64e166[_0x5415('0x3b')]=[{'all':!![]}];}_0x64e166=_[_0x5415('0x35')]({},_0x64e166,_0x5e532c[_0x5415('0x39')]);return db[_0x5415('0x28')][_0x5415('0x41')](_0x64e166)[_0x5415('0x22')](handleEntityNotFound(_0x4b9e4e,null))[_0x5415('0x22')](respondWithResult(_0x4b9e4e,null))[_0x5415('0x42')](handleError(_0x4b9e4e,null));};exports['create']=function(_0x57ffcb,_0x5a78c8){return db[_0x5415('0x28')][_0x5415('0x43')](_0x57ffcb[_0x5415('0x44')],{})[_0x5415('0x22')](respondWithResult(_0x5a78c8,0xc9))[_0x5415('0x42')](handleError(_0x5a78c8,null));};exports[_0x5415('0x21')]=function(_0x507a22,_0x149107){if(_0x507a22['body']['id']){delete _0x507a22['body']['id'];}return db[_0x5415('0x28')]['find']({'where':{'id':_0x507a22[_0x5415('0x3e')]['id']}})[_0x5415('0x22')](handleEntityNotFound(_0x149107,null))[_0x5415('0x22')](saveUpdates(_0x507a22['body'],null))[_0x5415('0x22')](respondWithResult(_0x149107,null))[_0x5415('0x42')](handleError(_0x149107,null));};exports[_0x5415('0x23')]=function(_0x460bde,_0x56d2f9){return db[_0x5415('0x28')][_0x5415('0x41')]({'where':{'id':_0x460bde[_0x5415('0x3e')]['id']}})[_0x5415('0x22')](handleEntityNotFound(_0x56d2f9,null))[_0x5415('0x22')](removeEntity(_0x56d2f9,null))[_0x5415('0x42')](handleError(_0x56d2f9,null));};exports[_0x5415('0x45')]=function(_0x44ae62,_0x156795,_0xacde01){return db['Condition'][_0x5415('0x41')]({'where':{'id':_0x44ae62[_0x5415('0x3e')]['id']}})[_0x5415('0x22')](handleEntityNotFound(_0x156795,null))[_0x5415('0x22')](function(_0xdde1d9){if(_0xdde1d9){return _0xdde1d9[_0x5415('0x45')](_0x44ae62[_0x5415('0x44')][_0x5415('0x46')],_[_0x5415('0x47')](_0x44ae62['body'],[_0x5415('0x46'),'id'])||{});}})[_0x5415('0x22')](respondWithResult(_0x156795,null))[_0x5415('0x42')](handleError(_0x156795,null));};exports[_0x5415('0x48')]=function(_0x3ce345,_0x5ecbbf,_0x64279d){var _0x459c92={};var _0x311346={};var _0x353b04;var _0x2c4440;return db[_0x5415('0x28')][_0x5415('0x49')]({'where':{'id':_0x3ce345[_0x5415('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5ecbbf,null))[_0x5415('0x22')](function(_0x20f5ef){if(_0x20f5ef){_0x353b04=_0x20f5ef;_0x311346[_0x5415('0x2a')]=_[_0x5415('0x40')](db[_0x5415('0x4a')]['rawAttributes']);_0x311346[_0x5415('0x2b')]=_['keys'](_0x3ce345[_0x5415('0x2b')]);_0x311346[_0x5415('0x2c')]=_['intersection'](_0x311346['model'],_0x311346['query']);_0x459c92[_0x5415('0x2e')]=_[_0x5415('0x2d')](_0x311346[_0x5415('0x2a')],qs[_0x5415('0x2f')](_0x3ce345[_0x5415('0x2b')]['fields']));_0x459c92[_0x5415('0x2e')]=_0x459c92[_0x5415('0x2e')][_0x5415('0x30')]?_0x459c92[_0x5415('0x2e')]:_0x311346[_0x5415('0x2a')];_0x459c92[_0x5415('0x32')]=qs['sort'](_0x3ce345[_0x5415('0x2b')][_0x5415('0x33')]);_0x459c92[_0x5415('0x34')]=qs[_0x5415('0x2c')](_[_0x5415('0x4b')](_0x3ce345[_0x5415('0x2b')],_0x311346['filters']));if(_0x3ce345['query'][_0x5415('0x38')]){_0x459c92[_0x5415('0x34')]=_[_0x5415('0x35')](_0x459c92[_0x5415('0x34')],{'$or':_[_0x5415('0x27')](_0x459c92['attributes'],function(_0x5ac7c4){var _0x534506={};_0x534506[_0x5ac7c4]={'$like':'%'+_0x3ce345[_0x5415('0x2b')][_0x5415('0x38')]+'%'};return _0x534506;})});}_0x459c92=_[_0x5415('0x35')]({},_0x459c92,_0x3ce345[_0x5415('0x39')]);return _0x353b04[_0x5415('0x48')](_0x459c92);}})[_0x5415('0x22')](function(_0x1c6e94){if(_0x1c6e94){_0x2c4440=_0x1c6e94[_0x5415('0x30')];if(!_0x3ce345[_0x5415('0x2b')][_0x5415('0x31')](_0x5415('0x4c'))){_0x459c92[_0x5415('0x1b')]=qs[_0x5415('0x1b')](_0x3ce345[_0x5415('0x2b')]['limit']);_0x459c92['offset']=qs['offset'](_0x3ce345[_0x5415('0x2b')]['offset']);}return _0x353b04[_0x5415('0x48')](_0x459c92);}})[_0x5415('0x22')](function(_0x5ded33){if(_0x5ded33){return _0x5ded33?{'count':_0x2c4440,'rows':_0x5ded33}:null;}})['then'](respondWithResult(_0x5ecbbf,null))[_0x5415('0x42')](handleError(_0x5ecbbf,null));};exports[_0x5415('0x4d')]=function(_0x38102e,_0x133874,_0x532777){return db[_0x5415('0x4e')][_0x5415('0x41')]({'where':{'id':_0x38102e['params']['id']}})['then'](handleEntityNotFound(_0x133874,null))[_0x5415('0x22')](function(_0x758c92){if(_0x758c92){return _0x758c92[_0x5415('0x4d')](_0x38102e['body'][_0x5415('0x46')],_[_0x5415('0x47')](_0x38102e[_0x5415('0x44')],[_0x5415('0x46'),'id'])||{});}})[_0x5415('0x22')](respondWithResult(_0x133874,null))[_0x5415('0x42')](handleError(_0x133874,null));};exports[_0x5415('0x4f')]=function(_0x3958f1,_0x42ad74,_0x5147e6){var _0x5a0093={};var _0x45cbb2={};var _0x46015a;var _0x21fe8f;return db[_0x5415('0x28')][_0x5415('0x49')]({'where':{'id':_0x3958f1['params']['id']}})[_0x5415('0x22')](handleEntityNotFound(_0x42ad74,null))[_0x5415('0x22')](function(_0x3a9a86){if(_0x3a9a86){_0x46015a=_0x3a9a86;_0x45cbb2[_0x5415('0x2a')]=_['keys'](db[_0x5415('0x4e')][_0x5415('0x3f')]);_0x45cbb2['query']=_[_0x5415('0x40')](_0x3958f1[_0x5415('0x2b')]);_0x45cbb2[_0x5415('0x2c')]=_[_0x5415('0x2d')](_0x45cbb2[_0x5415('0x2a')],_0x45cbb2[_0x5415('0x2b')]);_0x5a0093[_0x5415('0x2e')]=_[_0x5415('0x2d')](_0x45cbb2[_0x5415('0x2a')],qs[_0x5415('0x2f')](_0x3958f1[_0x5415('0x2b')]['fields']));_0x5a0093[_0x5415('0x2e')]=_0x5a0093[_0x5415('0x2e')][_0x5415('0x30')]?_0x5a0093['attributes']:_0x45cbb2[_0x5415('0x2a')];_0x5a0093[_0x5415('0x32')]=qs[_0x5415('0x33')](_0x3958f1[_0x5415('0x2b')][_0x5415('0x33')]);_0x5a0093[_0x5415('0x34')]=qs[_0x5415('0x2c')](_['pick'](_0x3958f1[_0x5415('0x2b')],_0x45cbb2[_0x5415('0x2c')]));if(_0x3958f1[_0x5415('0x2b')]['filter']){_0x5a0093[_0x5415('0x34')]=_[_0x5415('0x35')](_0x5a0093[_0x5415('0x34')],{'$or':_[_0x5415('0x27')](_0x5a0093[_0x5415('0x2e')],function(_0x571f5e){var _0x3ccecd={};_0x3ccecd[_0x571f5e]={'$like':'%'+_0x3958f1[_0x5415('0x2b')][_0x5415('0x38')]+'%'};return _0x3ccecd;})});}_0x5a0093=_[_0x5415('0x35')]({},_0x5a0093,_0x3958f1['options']);return _0x46015a[_0x5415('0x4f')](_0x5a0093);}})['then'](function(_0x39b219){if(_0x39b219){_0x21fe8f=_0x39b219[_0x5415('0x30')];if(!_0x3958f1[_0x5415('0x2b')][_0x5415('0x31')]('nolimit')){_0x5a0093[_0x5415('0x1b')]=qs[_0x5415('0x1b')](_0x3958f1[_0x5415('0x2b')]['limit']);_0x5a0093['offset']=qs[_0x5415('0x1a')](_0x3958f1[_0x5415('0x2b')][_0x5415('0x1a')]);}return _0x46015a[_0x5415('0x4f')](_0x5a0093);}})[_0x5415('0x22')](function(_0x821c16){if(_0x821c16){return _0x821c16?{'count':_0x21fe8f,'rows':_0x821c16}:null;}})[_0x5415('0x22')](respondWithResult(_0x42ad74,null))[_0x5415('0x42')](handleError(_0x42ad74,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 0e7be73..f1e9c2d 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 _0xbb50=['path','../../config/environment','./automation.attributes','exports','define','Automation','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4fbaf9,_0x3b8190){var _0x1d89a0=function(_0x3b650b){while(--_0x3b650b){_0x4fbaf9['push'](_0x4fbaf9['shift']());}};_0x1d89a0(++_0x3b8190);}(_0xbb50,0xae));var _0x0bb5=function(_0x2923b8,_0x1dba92){_0x2923b8=_0x2923b8-0x0;var _0x25659a=_0xbb50[_0x2923b8];return _0x25659a;};'use strict';var _=require(_0x0bb5('0x0'));var util=require(_0x0bb5('0x1'));var logger=require('../../config/logger')(_0x0bb5('0x2'));var moment=require(_0x0bb5('0x3'));var BPromise=require(_0x0bb5('0x4'));var rp=require(_0x0bb5('0x5'));var fs=require('fs');var path=require(_0x0bb5('0x6'));var rimraf=require('rimraf');var config=require(_0x0bb5('0x7'));var attributes=require(_0x0bb5('0x8'));module[_0x0bb5('0x9')]=function(_0x6eb345,_0x38e3ec){return _0x6eb345[_0x0bb5('0xa')](_0x0bb5('0xb'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x766d=['bluebird','request-promise','path','../../config/environment','exports','Automation','lodash','util','api','moment'];(function(_0x5b589f,_0x2417b3){var _0x4084d6=function(_0x4421d5){while(--_0x4421d5){_0x5b589f['push'](_0x5b589f['shift']());}};_0x4084d6(++_0x2417b3);}(_0x766d,0x11e));var _0xd766=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x766d[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xd766('0x0'));var util=require(_0xd766('0x1'));var logger=require('../../config/logger')(_0xd766('0x2'));var moment=require(_0xd766('0x3'));var BPromise=require(_0xd766('0x4'));var rp=require(_0xd766('0x5'));var fs=require('fs');var path=require(_0xd766('0x6'));var rimraf=require('rimraf');var config=require(_0xd766('0x7'));var attributes=require('./automation.attributes');module[_0xd766('0x8')]=function(_0x168b13,_0x2a3b6a){return _0x168b13['define'](_0xd766('0x9'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index e72aa35..9889fe6 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 _0x3d3d=['info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','result','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x231ed8,_0x4dfd8a){var _0x14a210=function(_0x11b4a4){while(--_0x11b4a4){_0x231ed8['push'](_0x231ed8['shift']());}};_0x14a210(++_0x4dfd8a);}(_0x3d3d,0xab));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd3d3('0x0'));var moment=require(_0xd3d3('0x1'));var BPromise=require('bluebird');var rs=require(_0xd3d3('0x2'));var fs=require('fs');var Redis=require(_0xd3d3('0x3'));var db=require(_0xd3d3('0x4'))['db'];var utils=require(_0xd3d3('0x5'));var logger=require(_0xd3d3('0x6'))(_0xd3d3('0x7'));var config=require(_0xd3d3('0x8'));var jayson=require(_0xd3d3('0x9'));var client=jayson[_0xd3d3('0xa')][_0xd3d3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4aa421,_0x1f47fe,_0x263940){return new BPromise(function(_0x3fe58e,_0x2ed96f){return client['request'](_0x4aa421,_0x263940)[_0xd3d3('0xc')](function(_0x412054){logger[_0xd3d3('0xd')](_0xd3d3('0xe'),_0x1f47fe,'request\x20sent');logger[_0xd3d3('0xf')](_0xd3d3('0x10'),_0x1f47fe,_0xd3d3('0x11'),JSON[_0xd3d3('0x12')](_0x412054));if(_0x412054[_0xd3d3('0x13')]){if(_0x412054[_0xd3d3('0x13')]['code']===0x1f4){logger[_0xd3d3('0x13')]('Automation,\x20%s,\x20%s',_0x1f47fe,_0x412054['error']['message']);return _0x2ed96f(_0x412054[_0xd3d3('0x13')]['message']);}logger['error'](_0xd3d3('0xe'),_0x1f47fe,_0x412054[_0xd3d3('0x13')]['message']);return _0x3fe58e(_0x412054[_0xd3d3('0x13')]['message']);}else{logger['info'](_0xd3d3('0xe'),_0x1f47fe,_0xd3d3('0x11'));_0x3fe58e(_0x412054[_0xd3d3('0x14')][_0xd3d3('0x15')]);}})[_0xd3d3('0x16')](function(_0x5c3462){logger[_0xd3d3('0x13')](_0xd3d3('0xe'),_0x1f47fe,_0x5c3462);_0x2ed96f(_0x5c3462);});});} \ No newline at end of file +var _0x0664=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','code','error','message','catch'];(function(_0x329b02,_0x152c3d){var _0x241983=function(_0x1c6d39){while(--_0x1c6d39){_0x329b02['push'](_0x329b02['shift']());}};_0x241983(++_0x152c3d);}(_0x0664,0x93));var _0x4066=function(_0x3fd53b,_0x1a3e99){_0x3fd53b=_0x3fd53b-0x0;var _0x43d561=_0x0664[_0x3fd53b];return _0x43d561;};'use strict';var _=require('lodash');var util=require(_0x4066('0x0'));var moment=require('moment');var BPromise=require(_0x4066('0x1'));var rs=require(_0x4066('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4066('0x3'))['db'];var utils=require(_0x4066('0x4'));var logger=require(_0x4066('0x5'))(_0x4066('0x6'));var config=require(_0x4066('0x7'));var jayson=require(_0x4066('0x8'));var client=jayson[_0x4066('0x9')][_0x4066('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x143de5,_0x458fa7,_0x4ff15a){return new BPromise(function(_0x383df4,_0x5d360d){return client[_0x4066('0xb')](_0x143de5,_0x4ff15a)[_0x4066('0xc')](function(_0x48333f){logger['info'](_0x4066('0xd'),_0x458fa7,_0x4066('0xe'));logger[_0x4066('0xf')](_0x4066('0x10'),_0x458fa7,'request\x20sent',JSON['stringify'](_0x48333f));if(_0x48333f['error']){if(_0x48333f['error'][_0x4066('0x11')]===0x1f4){logger[_0x4066('0x12')](_0x4066('0xd'),_0x458fa7,_0x48333f[_0x4066('0x12')][_0x4066('0x13')]);return _0x5d360d(_0x48333f[_0x4066('0x12')][_0x4066('0x13')]);}logger[_0x4066('0x12')]('Automation,\x20%s,\x20%s',_0x458fa7,_0x48333f[_0x4066('0x12')][_0x4066('0x13')]);return _0x383df4(_0x48333f['error'][_0x4066('0x13')]);}else{logger['info'](_0x4066('0xd'),_0x458fa7,'request\x20sent');_0x383df4(_0x48333f['result'][_0x4066('0x13')]);}})[_0x4066('0x14')](function(_0x309ffc){logger[_0x4066('0x12')](_0x4066('0xd'),_0x458fa7,_0x309ffc);_0x5d360d(_0x309ffc);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index f8678b3..9b2958c 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 _0x3351=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','delete','exports','multer'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x3351,0x1b4));var _0x1335=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x3351[_0x2df507];return _0x1f7167;};'use strict';var multer=require(_0x1335('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1335('0x1'));var express=require(_0x1335('0x2'));var router=express[_0x1335('0x3')]();var fs_extra=require(_0x1335('0x4'));var auth=require(_0x1335('0x5'));var interaction=require(_0x1335('0x6'));var config=require(_0x1335('0x7'));var controller=require('./automation.controller');router[_0x1335('0x8')]('/',auth[_0x1335('0x9')](),controller[_0x1335('0xa')]);router[_0x1335('0x8')](_0x1335('0xb'),auth[_0x1335('0x9')](),controller[_0x1335('0xc')]);router[_0x1335('0x8')](_0x1335('0xd'),auth[_0x1335('0x9')](),controller[_0x1335('0xe')]);router['get'](_0x1335('0xf'),auth['isAuthenticated'](),controller[_0x1335('0x10')]);router[_0x1335('0x11')]('/',auth[_0x1335('0x9')](),controller[_0x1335('0x12')]);router[_0x1335('0x11')](_0x1335('0xd'),auth['isAuthenticated'](),controller[_0x1335('0x13')]);router['post'](_0x1335('0xf'),auth['isAuthenticated'](),controller[_0x1335('0x14')]);router['put'](_0x1335('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1335('0x15')](_0x1335('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1335('0x16')]=router; \ No newline at end of file +var _0xc932=['fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','addConditions','post','addActions','put','delete','destroy','multer','connect-timeout'];(function(_0x3ef8f7,_0x35359a){var _0x3b097e=function(_0x189c92){while(--_0x189c92){_0x3ef8f7['push'](_0x3ef8f7['shift']());}};_0x3b097e(++_0x35359a);}(_0xc932,0x18d));var _0x2c93=function(_0x4f4c2a,_0x5f5a28){_0x4f4c2a=_0x4f4c2a-0x0;var _0xd15be6=_0xc932[_0x4f4c2a];return _0xd15be6;};'use strict';var multer=require(_0x2c93('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2c93('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2c93('0x2'));var auth=require(_0x2c93('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./automation.controller');router[_0x2c93('0x4')]('/',auth[_0x2c93('0x5')](),controller[_0x2c93('0x6')]);router['get'](_0x2c93('0x7'),auth[_0x2c93('0x5')](),controller[_0x2c93('0x8')]);router['get'](_0x2c93('0x9'),auth[_0x2c93('0x5')](),controller[_0x2c93('0xa')]);router[_0x2c93('0x4')](_0x2c93('0xb'),auth[_0x2c93('0x5')](),controller[_0x2c93('0xc')]);router['post']('/',auth[_0x2c93('0x5')](),controller['create']);router['post'](_0x2c93('0x9'),auth[_0x2c93('0x5')](),controller[_0x2c93('0xd')]);router[_0x2c93('0xe')](_0x2c93('0xb'),auth['isAuthenticated'](),controller[_0x2c93('0xf')]);router[_0x2c93('0x10')](_0x2c93('0x7'),auth[_0x2c93('0x5')](),controller['update']);router[_0x2c93('0x11')](_0x2c93('0x7'),auth[_0x2c93('0x5')](),controller[_0x2c93('0x12')]);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 e387046..25c3155 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 _0x5525=['#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0x6e4107,_0x450818){var _0xa74c9f=function(_0x453218){while(--_0x453218){_0x6e4107['push'](_0x6e4107['shift']());}};_0xa74c9f(++_0x450818);}(_0x5525,0xd1));var _0x5552=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5525[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x5552('0x0'));module[_0x5552('0x1')]={'name':{'type':Sequelize[_0x5552('0x2')],'unique':_0x5552('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5552('0x4')](_0x5552('0x5')),'allowNull':![],'defaultValue':_0x5552('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5552('0x6')],'defaultValue':0x0,'comment':_0x5552('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x5552('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5552('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5552('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5552('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x5552('0xa')](0x3)[_0x5552('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5552('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5552('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5552('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5552('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x5552('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x5552('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5552('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5552('0xa')](0x3)[_0x5552('0x8')],'defaultValue':0x3,'comment':_0x5552('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5552('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5552('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5552('0x10')},'dialTimezone':{'type':Sequelize[_0x5552('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x5552('0x4')](_0x5552('0x11'),_0x5552('0x12'),_0x5552('0x13')),'defaultValue':_0x5552('0x11')},'dialAMDActive':{'type':Sequelize[_0x5552('0x6')],'defaultValue':0x0,'comment':_0x5552('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x5552('0xa')](0x9)[_0x5552('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x5552('0xa')](0x9)[_0x5552('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5552('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5552('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x5552('0xa')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5552('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x5552('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5552('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5552('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5552('0xa')](0x5)[_0x5552('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5552('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5552('0xa')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5552('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5552('0x4')](_0x5552('0x1c'),_0x5552('0x1d')),'defaultValue':_0x5552('0x1c')},'dialPrefix':{'type':Sequelize[_0x5552('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5552('0xa')](0x3)[_0x5552('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5552('0x1e')},'dialCutDigit':{'type':Sequelize[_0x5552('0xa')](0x3)[_0x5552('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5552('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5552('0xa')](0x3)[_0x5552('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5552('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5552('0xa')](0x5)[_0x5552('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5552('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5552('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x5552('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5552('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5552('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5552('0xa')](0x5)[_0x5552('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5552('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x5552('0xa')](0x3)[_0x5552('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5552('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5552('0xa')](0x5)[_0x5552('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5552('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5552('0xa')](0x3)[_0x5552('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5552('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5552('0xa')](0x5)[_0x5552('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xd7a1=['Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','STRING','name','ENUM','ivr'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xd7a1,0x136));var _0x1d7a=function(_0x3fc017,_0x288faf){_0x3fc017=_0x3fc017-0x0;var _0x542e8c=_0xd7a1[_0x3fc017];return _0x542e8c;};'use strict';var Sequelize=require(_0x1d7a('0x0'));module['exports']={'name':{'type':Sequelize[_0x1d7a('0x1')],'unique':_0x1d7a('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1d7a('0x3')](_0x1d7a('0x4')),'allowNull':![],'defaultValue':_0x1d7a('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1d7a('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x1d7a('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1d7a('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1d7a('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1d7a('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x1d7a('0x8')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d7a('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1d7a('0x8')](0x3)[_0x1d7a('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d7a('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1d7a('0x8')](0x5)[_0x1d7a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d7a('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1d7a('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1d7a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d7a('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1d7a('0x8')](0x3)[_0x1d7a('0x6')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1d7a('0x8')](0x5)[_0x1d7a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x1d7a('0x8')](0x3)[_0x1d7a('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1d7a('0xd')},'dialTimezone':{'type':Sequelize[_0x1d7a('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1d7a('0x1')],'defaultValue':_0x1d7a('0xe')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x1d7a('0xf'),_0x1d7a('0x10'),_0x1d7a('0x11')),'defaultValue':_0x1d7a('0xf')},'dialAMDActive':{'type':Sequelize[_0x1d7a('0x12')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1d7a('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x1d7a('0x8')](0x9)[_0x1d7a('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1d7a('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1d7a('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1d7a('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1d7a('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1d7a('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x1d7a('0x8')](0x9)[_0x1d7a('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1d7a('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1d7a('0x8')](0x9)[_0x1d7a('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1d7a('0x8')](0x9)[_0x1d7a('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1d7a('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1d7a('0x8')](0x9)[_0x1d7a('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1d7a('0x18')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x1d7a('0x19'),_0x1d7a('0x1a')),'defaultValue':_0x1d7a('0x19')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1d7a('0x8')](0x3)[_0x1d7a('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1d7a('0x1b')},'dialCutDigit':{'type':Sequelize[_0x1d7a('0x8')](0x3)[_0x1d7a('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1d7a('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1d7a('0x8')](0x3)[_0x1d7a('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1d7a('0x8')](0x5)[_0x1d7a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d7a('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x1d7a('0x8')](0x3)[_0x1d7a('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d7a('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x1d7a('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d7a('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1d7a('0x8')](0x3)[_0x1d7a('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1d7a('0x8')](0x5)[_0x1d7a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x1d7a('0x8')](0x3)[_0x1d7a('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d7a('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1d7a('0x8')](0x5)[_0x1d7a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d7a('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1d7a('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d7a('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1d7a('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 2db1c2f..31e2736 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 _0xc2b6=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','error','stack','name','send','index','map','rawAttributes','fieldName','query','keys','filters','model','attributes','fields','length','order','sort','where','pick','filter','type','VIRTUAL','merge','options','Campaign','includeAll','findAll','rows','catch','show','params','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','body','findOne','CmHopper','hasOwnProperty','nolimit','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ContactId','select','field','NOW()','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','scheduledAt','CmListId','ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','fs-extra'];(function(_0x28752d,_0x2283ee){var _0x49bf3b=function(_0x321ea1){while(--_0x321ea1){_0x28752d['push'](_0x28752d['shift']());}};_0x49bf3b(++_0x2283ee);}(_0xc2b6,0x186));var _0x6c2b=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xc2b6[_0x38a7ac];return _0x53061a;};'use strict';var emlformat=require(_0x6c2b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6c2b('0x1'));var jsonpatch=require(_0x6c2b('0x2'));var rp=require(_0x6c2b('0x3'));var moment=require(_0x6c2b('0x4'));var BPromise=require(_0x6c2b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6c2b('0x6'));var sox=require('sox');var csv=require(_0x6c2b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c2b('0x8'));var _=require(_0x6c2b('0x9'));var squel=require(_0x6c2b('0xa'));var crypto=require(_0x6c2b('0xb'));var jsforce=require(_0x6c2b('0xc'));var deskjs=require(_0x6c2b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6c2b('0xe'));var Papa=require(_0x6c2b('0xf'));var Redis=require(_0x6c2b('0x10'));var authService=require(_0x6c2b('0x11'));var qs=require(_0x6c2b('0x12'));var as=require(_0x6c2b('0x13'));var hardwareService=require(_0x6c2b('0x14'));var logger=require(_0x6c2b('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6c2b('0x16'));var db=require(_0x6c2b('0x17'))['db'];function respondWithStatusCode(_0x97f8d5,_0x1e5472){_0x1e5472=_0x1e5472||0xcc;return function(_0x515236){if(_0x515236){return _0x97f8d5[_0x6c2b('0x18')](_0x1e5472);}return _0x97f8d5[_0x6c2b('0x19')](_0x1e5472)[_0x6c2b('0x1a')]();};}function respondWithResult(_0x2c60cf,_0x3d551d){_0x3d551d=_0x3d551d||0xc8;return function(_0x575e7b){if(_0x575e7b){return _0x2c60cf['status'](_0x3d551d)[_0x6c2b('0x1b')](_0x575e7b);}};}function respondWithFilteredResult(_0x48da41,_0x268be2){return function(_0x6fbbea){if(_0x6fbbea){var _0x4e93de=typeof _0x268be2[_0x6c2b('0x1c')]===_0x6c2b('0x1d')&&typeof _0x268be2[_0x6c2b('0x1e')]===_0x6c2b('0x1d');var _0x2b5999=_0x6fbbea[_0x6c2b('0x1f')];var _0x5040a8=_0x4e93de?0x0:_0x268be2[_0x6c2b('0x1c')];var _0x5da44a=_0x4e93de?_0x6fbbea['count']:_0x268be2[_0x6c2b('0x1c')]+_0x268be2['limit'];var _0x171f23;if(_0x5da44a>=_0x2b5999){_0x5da44a=_0x2b5999;_0x171f23=0xc8;}else{_0x171f23=0xce;}_0x48da41[_0x6c2b('0x19')](_0x171f23);return _0x48da41[_0x6c2b('0x20')](_0x6c2b('0x21'),_0x5040a8+'-'+_0x5da44a+'/'+_0x2b5999)[_0x6c2b('0x1b')](_0x6fbbea);}return null;};}function patchUpdates(_0x2efd52){return function(_0x355627){try{jsonpatch['apply'](_0x355627,_0x2efd52,!![]);}catch(_0x2ebf93){return BPromise['reject'](_0x2ebf93);}return _0x355627['save']();};}function saveUpdates(_0x336275,_0x401788){return function(_0x4ea7c6){if(_0x4ea7c6){return _0x4ea7c6[_0x6c2b('0x22')](_0x336275)[_0x6c2b('0x23')](function(_0x372225){return _0x372225;});}return null;};}function removeEntity(_0x5c9885,_0x380da0){return function(_0x44379c){if(_0x44379c){return _0x44379c[_0x6c2b('0x24')]()[_0x6c2b('0x23')](function(){var _0x3225f7=_0x44379c[_0x6c2b('0x25')]({'plain':!![]});var _0x372165='IvrCampaigns';return db['UserProfileResource'][_0x6c2b('0x24')]({'where':{'type':_0x372165,'resourceId':_0x3225f7['id']}})[_0x6c2b('0x23')](function(){return _0x44379c;});})[_0x6c2b('0x23')](function(){_0x5c9885['status'](0xcc)[_0x6c2b('0x1a')]();});}};}function handleEntityNotFound(_0x4d5ca6,_0x144544){return function(_0x42f4a6){if(!_0x42f4a6){_0x4d5ca6[_0x6c2b('0x18')](0x194);}return _0x42f4a6;};}function handleError(_0x239810,_0xb8eedd){_0xb8eedd=_0xb8eedd||0x1f4;return function(_0x1a4e55){logger[_0x6c2b('0x26')](_0x1a4e55[_0x6c2b('0x27')]);if(_0x1a4e55[_0x6c2b('0x28')]){delete _0x1a4e55['name'];}_0x239810[_0x6c2b('0x19')](_0xb8eedd)[_0x6c2b('0x29')](_0x1a4e55);};}exports[_0x6c2b('0x2a')]=function(_0x5be6f5,_0x31573e){var _0x270fee={},_0xd13b60={},_0x2c26eb={'count':0x0,'rows':[]};var _0x11ab0b=_[_0x6c2b('0x2b')](db['Campaign'][_0x6c2b('0x2c')],function(_0x436ef5){return{'name':_0x436ef5[_0x6c2b('0x2d')],'type':_0x436ef5['type']['key']};});_0xd13b60['model']=_[_0x6c2b('0x2b')](_0x11ab0b,_0x6c2b('0x28'));_0xd13b60[_0x6c2b('0x2e')]=_[_0x6c2b('0x2f')](_0x5be6f5[_0x6c2b('0x2e')]);_0xd13b60[_0x6c2b('0x30')]=_['intersection'](_0xd13b60[_0x6c2b('0x31')],_0xd13b60[_0x6c2b('0x2e')]);_0x270fee[_0x6c2b('0x32')]=_['intersection'](_0xd13b60[_0x6c2b('0x31')],qs['fields'](_0x5be6f5[_0x6c2b('0x2e')][_0x6c2b('0x33')]));_0x270fee[_0x6c2b('0x32')]=_0x270fee['attributes'][_0x6c2b('0x34')]?_0x270fee[_0x6c2b('0x32')]:_0xd13b60[_0x6c2b('0x31')];if(!_0x5be6f5['query']['hasOwnProperty']('nolimit')){_0x270fee[_0x6c2b('0x1e')]=qs['limit'](_0x5be6f5[_0x6c2b('0x2e')][_0x6c2b('0x1e')]);_0x270fee[_0x6c2b('0x1c')]=qs[_0x6c2b('0x1c')](_0x5be6f5[_0x6c2b('0x2e')][_0x6c2b('0x1c')]);}_0x270fee[_0x6c2b('0x35')]=qs['sort'](_0x5be6f5[_0x6c2b('0x2e')][_0x6c2b('0x36')]);_0x270fee[_0x6c2b('0x37')]=qs[_0x6c2b('0x30')](_[_0x6c2b('0x38')](_0x5be6f5[_0x6c2b('0x2e')],_0xd13b60[_0x6c2b('0x30')]),_0x11ab0b);if(_0x5be6f5['query'][_0x6c2b('0x39')]){_0x270fee[_0x6c2b('0x37')]=_['merge'](_0x270fee[_0x6c2b('0x37')],{'$or':_[_0x6c2b('0x2b')](_0x11ab0b,function(_0x4dd0c1){if(_0x4dd0c1[_0x6c2b('0x3a')]!==_0x6c2b('0x3b')){var _0x2e8791={};_0x2e8791[_0x4dd0c1[_0x6c2b('0x28')]]={'$like':'%'+_0x5be6f5[_0x6c2b('0x2e')][_0x6c2b('0x39')]+'%'};return _0x2e8791;}})});}_0x270fee=_[_0x6c2b('0x3c')]({},_0x270fee,_0x5be6f5[_0x6c2b('0x3d')]);var _0xa7bf2b={'where':_0x270fee[_0x6c2b('0x37')]};return db[_0x6c2b('0x3e')]['count'](_0xa7bf2b)[_0x6c2b('0x23')](function(_0x2eafa8){_0x2c26eb[_0x6c2b('0x1f')]=_0x2eafa8;if(_0x5be6f5[_0x6c2b('0x2e')][_0x6c2b('0x3f')]){_0x270fee['include']=[{'all':!![]}];}return db[_0x6c2b('0x3e')][_0x6c2b('0x40')](_0x270fee);})['then'](function(_0xc9a6dc){_0x2c26eb[_0x6c2b('0x41')]=_0xc9a6dc;return _0x2c26eb;})[_0x6c2b('0x23')](respondWithFilteredResult(_0x31573e,_0x270fee))[_0x6c2b('0x42')](handleError(_0x31573e,null));};exports[_0x6c2b('0x43')]=function(_0x4138b9,_0x1eb15a){var _0x5a05d6={'raw':![],'where':{'id':_0x4138b9[_0x6c2b('0x44')]['id']}},_0x7e1fb0={};_0x7e1fb0['model']=_['keys'](db['Campaign'][_0x6c2b('0x2c')]);_0x7e1fb0[_0x6c2b('0x2e')]=_[_0x6c2b('0x2f')](_0x4138b9[_0x6c2b('0x2e')]);_0x7e1fb0[_0x6c2b('0x30')]=_[_0x6c2b('0x45')](_0x7e1fb0[_0x6c2b('0x31')],_0x7e1fb0[_0x6c2b('0x2e')]);_0x5a05d6[_0x6c2b('0x32')]=_['intersection'](_0x7e1fb0['model'],qs[_0x6c2b('0x33')](_0x4138b9[_0x6c2b('0x2e')][_0x6c2b('0x33')]));_0x5a05d6[_0x6c2b('0x32')]=_0x5a05d6['attributes']['length']?_0x5a05d6[_0x6c2b('0x32')]:_0x7e1fb0[_0x6c2b('0x31')];if(_0x4138b9['query'][_0x6c2b('0x3f')]){_0x5a05d6['include']=[{'all':!![]}];}_0x5a05d6=_['merge']({},_0x5a05d6,_0x4138b9[_0x6c2b('0x3d')]);return db[_0x6c2b('0x3e')][_0x6c2b('0x46')](_0x5a05d6)['then'](handleEntityNotFound(_0x1eb15a,null))[_0x6c2b('0x23')](respondWithResult(_0x1eb15a,null))[_0x6c2b('0x42')](handleError(_0x1eb15a,null));};exports[_0x6c2b('0x47')]=function(_0x2b6fdd,_0x323f54){return db[_0x6c2b('0x3e')][_0x6c2b('0x47')](_0x2b6fdd['body'],{})[_0x6c2b('0x23')](function(_0x3500a1){var _0x217430=_0x2b6fdd[_0x6c2b('0x48')][_0x6c2b('0x25')]({'plain':!![]});if(!_0x217430)throw new Error(_0x6c2b('0x49'));if(_0x217430[_0x6c2b('0x4a')]===_0x6c2b('0x48')){var _0x1ed517=_0x3500a1['get']({'plain':!![]});var _0x191deb=_0x6c2b('0x4b');return db[_0x6c2b('0x4c')][_0x6c2b('0x46')]({'where':{'name':_0x191deb,'userProfileId':_0x217430[_0x6c2b('0x4d')]},'raw':!![]})[_0x6c2b('0x23')](function(_0x404a81){if(_0x404a81&&_0x404a81[_0x6c2b('0x4e')]===0x0){return db[_0x6c2b('0x4f')]['create']({'name':_0x1ed517['name'],'resourceId':_0x1ed517['id'],'type':_0x404a81[_0x6c2b('0x28')],'sectionId':_0x404a81['id']},{})[_0x6c2b('0x23')](function(){return _0x3500a1;});}else{return _0x3500a1;}})[_0x6c2b('0x42')](function(_0x4ab33d){logger[_0x6c2b('0x26')](_0x6c2b('0x50'),_0x4ab33d);throw _0x4ab33d;});}return _0x3500a1;})['then'](respondWithResult(_0x323f54,0xc9))[_0x6c2b('0x42')](handleError(_0x323f54,null));};exports[_0x6c2b('0x51')]=function(_0x3c56b0,_0x9fa9aa){var _0x92a9ff={'where':{'id':_0x3c56b0[_0x6c2b('0x44')]['id']}},_0x5ef37f={};_0x5ef37f['model']=_['keys'](db['Campaign'][_0x6c2b('0x2c')]);_0x92a9ff[_0x6c2b('0x32')]=_['intersection'](_0x5ef37f['model'],qs[_0x6c2b('0x33')](_0x3c56b0[_0x6c2b('0x2e')][_0x6c2b('0x33')]));_0x92a9ff[_0x6c2b('0x32')]=_0x92a9ff[_0x6c2b('0x32')][_0x6c2b('0x34')]?_0x92a9ff['attributes']:_0x5ef37f[_0x6c2b('0x31')];if(_0x3c56b0[_0x6c2b('0x2e')][_0x6c2b('0x3f')]){_0x92a9ff[_0x6c2b('0x52')]=[{'all':!![]}];}_0x92a9ff=_['merge']({},_0x92a9ff,_0x3c56b0[_0x6c2b('0x3d')]);return db['Campaign'][_0x6c2b('0x46')](_0x92a9ff)[_0x6c2b('0x23')](handleEntityNotFound(_0x9fa9aa,null))['then'](function(_0x288ff7){if(_0x288ff7){var _0x51330d=_0x288ff7[_0x6c2b('0x25')]({'plain':!![]});_0x51330d=qs[_0x6c2b('0x53')](_0x51330d,['id',_0x6c2b('0x54'),_0x6c2b('0x55')]);_0x3c56b0[_0x6c2b('0x56')]=_[_0x6c2b('0x53')](_0x3c56b0[_0x6c2b('0x56')],['id',_0x6c2b('0x54'),_0x6c2b('0x55')]);return db['Campaign'][_0x6c2b('0x47')](_[_0x6c2b('0x3c')](_0x51330d,_0x3c56b0['body']),{'include':_0x3c56b0['query']['includeAll']?[{'all':!![]}]:undefined})[_0x6c2b('0x23')](function(_0x41b742){var _0x520753=_0x3c56b0[_0x6c2b('0x48')][_0x6c2b('0x25')]({'plain':!![]});if(!_0x520753)throw new Error(_0x6c2b('0x49'));if(_0x520753[_0x6c2b('0x4a')]===_0x6c2b('0x48')){var _0x838678=_0x41b742['get']({'plain':!![]});var _0x235d2a=_0x6c2b('0x4b');return db[_0x6c2b('0x4c')][_0x6c2b('0x46')]({'where':{'name':_0x235d2a,'userProfileId':_0x520753[_0x6c2b('0x4d')]},'raw':!![]})[_0x6c2b('0x23')](function(_0x474efa){if(_0x474efa&&_0x474efa[_0x6c2b('0x4e')]===0x0){return db[_0x6c2b('0x4f')]['create']({'name':_0x838678[_0x6c2b('0x28')],'resourceId':_0x838678['id'],'type':_0x474efa[_0x6c2b('0x28')],'sectionId':_0x474efa['id']},{})[_0x6c2b('0x23')](function(){return _0x41b742;});}else{return _0x41b742;}})[_0x6c2b('0x42')](function(_0x55100b){logger[_0x6c2b('0x26')](_0x6c2b('0x50'),_0x55100b);throw _0x55100b;});}return _0x41b742;});}})['then'](respondWithResult(_0x9fa9aa,0xc9))[_0x6c2b('0x42')](handleError(_0x9fa9aa,null));};exports[_0x6c2b('0x22')]=function(_0x39bc7c,_0x282aca){if(_0x39bc7c['body']['id']){delete _0x39bc7c['body']['id'];}return db[_0x6c2b('0x3e')][_0x6c2b('0x46')]({'where':{'id':_0x39bc7c[_0x6c2b('0x44')]['id']}})[_0x6c2b('0x23')](handleEntityNotFound(_0x282aca,null))['then'](saveUpdates(_0x39bc7c['body'],null))[_0x6c2b('0x23')](respondWithResult(_0x282aca,null))[_0x6c2b('0x42')](handleError(_0x282aca,null));};exports[_0x6c2b('0x24')]=function(_0x5e4f2a,_0x59ca61){return db[_0x6c2b('0x3e')][_0x6c2b('0x46')]({'where':{'id':_0x5e4f2a['params']['id']}})['then'](handleEntityNotFound(_0x59ca61,null))[_0x6c2b('0x23')](removeEntity(_0x59ca61,null))[_0x6c2b('0x42')](handleError(_0x59ca61,null));};exports['getHoppers']=function(_0x1d5ecf,_0x4ffca3,_0x12435c){var _0x4fb2e1={'raw':!![],'where':{}};var _0x176b03={};var _0x1797bb={'count':0x0,'rows':[]};return db[_0x6c2b('0x3e')][_0x6c2b('0x57')]({'where':{'id':_0x1d5ecf[_0x6c2b('0x44')]['id']}})[_0x6c2b('0x23')](handleEntityNotFound(_0x4ffca3,null))['then'](function(_0x4936b7){if(_0x4936b7){_0x176b03[_0x6c2b('0x31')]=_[_0x6c2b('0x2f')](db[_0x6c2b('0x58')][_0x6c2b('0x2c')]);_0x176b03[_0x6c2b('0x2e')]=_[_0x6c2b('0x2f')](_0x1d5ecf[_0x6c2b('0x2e')]);_0x176b03[_0x6c2b('0x30')]=_['intersection'](_0x176b03[_0x6c2b('0x31')],_0x176b03[_0x6c2b('0x2e')]);_0x4fb2e1[_0x6c2b('0x32')]=_['intersection'](_0x176b03['model'],qs[_0x6c2b('0x33')](_0x1d5ecf['query'][_0x6c2b('0x33')]));_0x4fb2e1[_0x6c2b('0x32')]=_0x4fb2e1[_0x6c2b('0x32')][_0x6c2b('0x34')]?_0x4fb2e1[_0x6c2b('0x32')]:_0x176b03['model'];if(!_0x1d5ecf[_0x6c2b('0x2e')][_0x6c2b('0x59')](_0x6c2b('0x5a'))){_0x4fb2e1[_0x6c2b('0x1e')]=qs['limit'](_0x1d5ecf[_0x6c2b('0x2e')]['limit']);_0x4fb2e1[_0x6c2b('0x1c')]=qs[_0x6c2b('0x1c')](_0x1d5ecf[_0x6c2b('0x2e')]['offset']);}_0x4fb2e1['order']=qs[_0x6c2b('0x36')](_0x1d5ecf['query'][_0x6c2b('0x36')]);_0x4fb2e1[_0x6c2b('0x37')]=qs[_0x6c2b('0x30')](_[_0x6c2b('0x38')](_0x1d5ecf[_0x6c2b('0x2e')],_0x176b03[_0x6c2b('0x30')]));_0x4fb2e1[_0x6c2b('0x37')]['CampaignId']=_0x4936b7['id'];if(_0x1d5ecf['query']['filter']){_0x4fb2e1[_0x6c2b('0x37')]=_['merge'](_0x4fb2e1[_0x6c2b('0x37')],{'$or':_['map'](_0x4fb2e1[_0x6c2b('0x32')],function(_0x4058be){var _0x5cf3a6={};_0x5cf3a6[_0x4058be]={'$like':'%'+_0x1d5ecf[_0x6c2b('0x2e')][_0x6c2b('0x39')]+'%'};return _0x5cf3a6;})});}_0x4fb2e1=_[_0x6c2b('0x3c')]({},_0x4fb2e1,_0x1d5ecf[_0x6c2b('0x3d')]);return db[_0x6c2b('0x58')][_0x6c2b('0x1f')]({'where':_0x4fb2e1['where']})[_0x6c2b('0x23')](function(_0x19d8cb){_0x1797bb[_0x6c2b('0x1f')]=_0x19d8cb;if(_0x1d5ecf[_0x6c2b('0x2e')][_0x6c2b('0x3f')]){_0x4fb2e1['include']=[{'all':!![]}];}return db[_0x6c2b('0x58')][_0x6c2b('0x40')](_0x4fb2e1);})[_0x6c2b('0x23')](function(_0xaeeeae){_0x1797bb[_0x6c2b('0x41')]=_0xaeeeae;return _0x1797bb;});}})[_0x6c2b('0x23')](respondWithFilteredResult(_0x4ffca3,_0x4fb2e1))[_0x6c2b('0x42')](handleError(_0x4ffca3,null));};exports['getHopperHistories']=function(_0x53f35e,_0x5b9f91,_0xbf9549){var _0x4b5441={'raw':!![],'where':{}};var _0x3e0935={};var _0x52fffe={'count':0x0,'rows':[]};return db[_0x6c2b('0x3e')]['findOne']({'where':{'id':_0x53f35e[_0x6c2b('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b9f91,null))['then'](function(_0x2fa202){if(_0x2fa202){_0x3e0935['model']=_['keys'](db[_0x6c2b('0x5b')][_0x6c2b('0x2c')]);_0x3e0935[_0x6c2b('0x2e')]=_[_0x6c2b('0x2f')](_0x53f35e['query']);_0x3e0935[_0x6c2b('0x30')]=_[_0x6c2b('0x45')](_0x3e0935[_0x6c2b('0x31')],_0x3e0935[_0x6c2b('0x2e')]);_0x4b5441[_0x6c2b('0x32')]=_[_0x6c2b('0x45')](_0x3e0935[_0x6c2b('0x31')],qs['fields'](_0x53f35e['query'][_0x6c2b('0x33')]));_0x4b5441[_0x6c2b('0x32')]=_0x4b5441[_0x6c2b('0x32')][_0x6c2b('0x34')]?_0x4b5441[_0x6c2b('0x32')]:_0x3e0935[_0x6c2b('0x31')];if(!_0x53f35e['query'][_0x6c2b('0x59')](_0x6c2b('0x5a'))){_0x4b5441['limit']=qs[_0x6c2b('0x1e')](_0x53f35e[_0x6c2b('0x2e')]['limit']);_0x4b5441[_0x6c2b('0x1c')]=qs[_0x6c2b('0x1c')](_0x53f35e[_0x6c2b('0x2e')][_0x6c2b('0x1c')]);}_0x4b5441[_0x6c2b('0x35')]=qs['sort'](_0x53f35e[_0x6c2b('0x2e')][_0x6c2b('0x36')]);_0x4b5441[_0x6c2b('0x37')]=qs[_0x6c2b('0x30')](_[_0x6c2b('0x38')](_0x53f35e[_0x6c2b('0x2e')],_0x3e0935[_0x6c2b('0x30')]));_0x4b5441[_0x6c2b('0x37')][_0x6c2b('0x5c')]=_0x2fa202['id'];if(_0x53f35e['query']['filter']){_0x4b5441['where']=_[_0x6c2b('0x3c')](_0x4b5441[_0x6c2b('0x37')],{'$or':_[_0x6c2b('0x2b')](_0x4b5441[_0x6c2b('0x32')],function(_0x14c630){var _0x5d45f0={};_0x5d45f0[_0x14c630]={'$like':'%'+_0x53f35e[_0x6c2b('0x2e')][_0x6c2b('0x39')]+'%'};return _0x5d45f0;})});}_0x4b5441=_[_0x6c2b('0x3c')]({},_0x4b5441,_0x53f35e[_0x6c2b('0x3d')]);return db[_0x6c2b('0x5b')][_0x6c2b('0x1f')]({'where':_0x4b5441[_0x6c2b('0x37')]})[_0x6c2b('0x23')](function(_0x4e50ee){_0x52fffe[_0x6c2b('0x1f')]=_0x4e50ee;if(_0x53f35e[_0x6c2b('0x2e')][_0x6c2b('0x3f')]){_0x4b5441[_0x6c2b('0x52')]=[{'all':!![]}];}return db[_0x6c2b('0x5b')][_0x6c2b('0x40')](_0x4b5441);})[_0x6c2b('0x23')](function(_0x217249){_0x52fffe[_0x6c2b('0x41')]=_0x217249;return _0x52fffe;});}})[_0x6c2b('0x23')](respondWithFilteredResult(_0x5b9f91,_0x4b5441))[_0x6c2b('0x42')](handleError(_0x5b9f91,null));};exports[_0x6c2b('0x5d')]=function(_0x3d5b36,_0x3978a0,_0x15e68b){var _0x3e5d8b={'raw':!![],'where':{}};var _0x353a28={};var _0x4f2e89={'count':0x0,'rows':[]};return db['Campaign'][_0x6c2b('0x57')]({'where':{'id':_0x3d5b36[_0x6c2b('0x44')]['id']}})[_0x6c2b('0x23')](handleEntityNotFound(_0x3978a0,null))[_0x6c2b('0x23')](function(_0x5d235b){if(_0x5d235b){_0x353a28[_0x6c2b('0x31')]=_[_0x6c2b('0x2f')](db[_0x6c2b('0x5e')][_0x6c2b('0x2c')]);_0x353a28[_0x6c2b('0x2e')]=_['keys'](_0x3d5b36[_0x6c2b('0x2e')]);_0x353a28[_0x6c2b('0x30')]=_['intersection'](_0x353a28[_0x6c2b('0x31')],_0x353a28['query']);_0x3e5d8b[_0x6c2b('0x32')]=_['intersection'](_0x353a28[_0x6c2b('0x31')],qs[_0x6c2b('0x33')](_0x3d5b36['query']['fields']));_0x3e5d8b[_0x6c2b('0x32')]=_0x3e5d8b[_0x6c2b('0x32')]['length']?_0x3e5d8b[_0x6c2b('0x32')]:_0x353a28[_0x6c2b('0x31')];if(!_0x3d5b36['query'][_0x6c2b('0x59')](_0x6c2b('0x5a'))){_0x3e5d8b[_0x6c2b('0x1e')]=qs['limit'](_0x3d5b36['query']['limit']);_0x3e5d8b[_0x6c2b('0x1c')]=qs[_0x6c2b('0x1c')](_0x3d5b36['query'][_0x6c2b('0x1c')]);}_0x3e5d8b[_0x6c2b('0x35')]=qs[_0x6c2b('0x36')](_0x3d5b36['query'][_0x6c2b('0x36')]);_0x3e5d8b[_0x6c2b('0x37')]=qs['filters'](_['pick'](_0x3d5b36[_0x6c2b('0x2e')],_0x353a28[_0x6c2b('0x30')]));_0x3e5d8b[_0x6c2b('0x37')][_0x6c2b('0x5c')]=_0x5d235b['id'];if(_0x3d5b36[_0x6c2b('0x2e')][_0x6c2b('0x39')]){_0x3e5d8b['where']=_[_0x6c2b('0x3c')](_0x3e5d8b[_0x6c2b('0x37')],{'$or':_[_0x6c2b('0x2b')](_0x3e5d8b['attributes'],function(_0x3dc6f0){var _0x59f9a7={};_0x59f9a7[_0x3dc6f0]={'$like':'%'+_0x3d5b36[_0x6c2b('0x2e')][_0x6c2b('0x39')]+'%'};return _0x59f9a7;})});}_0x3e5d8b=_[_0x6c2b('0x3c')]({},_0x3e5d8b,_0x3d5b36[_0x6c2b('0x3d')]);return db[_0x6c2b('0x5e')][_0x6c2b('0x1f')]({'where':_0x3e5d8b['where']})[_0x6c2b('0x23')](function(_0xab9d50){_0x4f2e89[_0x6c2b('0x1f')]=_0xab9d50;if(_0x3d5b36['query'][_0x6c2b('0x3f')]){_0x3e5d8b[_0x6c2b('0x52')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x3e5d8b);})[_0x6c2b('0x23')](function(_0x29192e){_0x4f2e89[_0x6c2b('0x41')]=_0x29192e;return _0x4f2e89;});}})[_0x6c2b('0x23')](respondWithFilteredResult(_0x3978a0,_0x3e5d8b))[_0x6c2b('0x42')](handleError(_0x3978a0,null));};exports[_0x6c2b('0x5f')]=function(_0x5d43a7,_0x29828f,_0x44df2b){var _0x4e8cd9={'raw':!![],'where':{}};var _0x3c7569={};var _0x81aa62={'count':0x0,'rows':[]};return db['Campaign'][_0x6c2b('0x57')]({'where':{'id':_0x5d43a7[_0x6c2b('0x44')]['id']}})['then'](handleEntityNotFound(_0x29828f,null))[_0x6c2b('0x23')](function(_0x1ab6c2){if(_0x1ab6c2){_0x3c7569[_0x6c2b('0x31')]=_[_0x6c2b('0x2f')](db[_0x6c2b('0x60')][_0x6c2b('0x2c')]);_0x3c7569[_0x6c2b('0x2e')]=_['keys'](_0x5d43a7[_0x6c2b('0x2e')]);_0x3c7569[_0x6c2b('0x30')]=_[_0x6c2b('0x45')](_0x3c7569[_0x6c2b('0x31')],_0x3c7569[_0x6c2b('0x2e')]);_0x4e8cd9[_0x6c2b('0x32')]=_[_0x6c2b('0x45')](_0x3c7569['model'],qs[_0x6c2b('0x33')](_0x5d43a7[_0x6c2b('0x2e')][_0x6c2b('0x33')]));_0x4e8cd9[_0x6c2b('0x32')]=_0x4e8cd9[_0x6c2b('0x32')][_0x6c2b('0x34')]?_0x4e8cd9[_0x6c2b('0x32')]:_0x3c7569['model'];if(!_0x5d43a7[_0x6c2b('0x2e')][_0x6c2b('0x59')]('nolimit')){_0x4e8cd9[_0x6c2b('0x1e')]=qs[_0x6c2b('0x1e')](_0x5d43a7['query'][_0x6c2b('0x1e')]);_0x4e8cd9['offset']=qs[_0x6c2b('0x1c')](_0x5d43a7[_0x6c2b('0x2e')][_0x6c2b('0x1c')]);}_0x4e8cd9[_0x6c2b('0x35')]=qs[_0x6c2b('0x36')](_0x5d43a7[_0x6c2b('0x2e')][_0x6c2b('0x36')]);_0x4e8cd9[_0x6c2b('0x37')]=qs['filters'](_[_0x6c2b('0x38')](_0x5d43a7[_0x6c2b('0x2e')],_0x3c7569[_0x6c2b('0x30')]));_0x4e8cd9[_0x6c2b('0x37')][_0x6c2b('0x5c')]=_0x1ab6c2['id'];if(_0x5d43a7['query'][_0x6c2b('0x39')]){_0x4e8cd9[_0x6c2b('0x37')]=_[_0x6c2b('0x3c')](_0x4e8cd9[_0x6c2b('0x37')],{'$or':_[_0x6c2b('0x2b')](_0x4e8cd9['attributes'],function(_0x20b9b1){var _0x373199={};_0x373199[_0x20b9b1]={'$like':'%'+_0x5d43a7[_0x6c2b('0x2e')][_0x6c2b('0x39')]+'%'};return _0x373199;})});}_0x4e8cd9=_[_0x6c2b('0x3c')]({},_0x4e8cd9,_0x5d43a7[_0x6c2b('0x3d')]);return db[_0x6c2b('0x60')]['count']({'where':_0x4e8cd9[_0x6c2b('0x37')]})[_0x6c2b('0x23')](function(_0x19c54d){_0x81aa62['count']=_0x19c54d;if(_0x5d43a7[_0x6c2b('0x2e')]['includeAll']){_0x4e8cd9[_0x6c2b('0x52')]=[{'all':!![]}];}return db[_0x6c2b('0x60')][_0x6c2b('0x40')](_0x4e8cd9);})[_0x6c2b('0x23')](function(_0x5bf5bd){_0x81aa62[_0x6c2b('0x41')]=_0x5bf5bd;return _0x81aa62;});}})['then'](respondWithFilteredResult(_0x29828f,_0x4e8cd9))[_0x6c2b('0x42')](handleError(_0x29828f,null));};exports[_0x6c2b('0x61')]=function(_0x53f630,_0x5ae45b,_0x58039c){var _0x1eaf17={};var _0x5eb852={};var _0x4e6373;var _0x56bd9f;return db['Campaign'][_0x6c2b('0x57')]({'where':{'id':_0x53f630[_0x6c2b('0x44')]['id']}})[_0x6c2b('0x23')](handleEntityNotFound(_0x5ae45b,null))['then'](function(_0x1a0fd1){if(_0x1a0fd1){_0x4e6373=_0x1a0fd1;_0x5eb852[_0x6c2b('0x31')]=_[_0x6c2b('0x2f')](db[_0x6c2b('0x62')][_0x6c2b('0x2c')]);_0x5eb852[_0x6c2b('0x2e')]=_[_0x6c2b('0x2f')](_0x53f630['query']);_0x5eb852[_0x6c2b('0x30')]=_[_0x6c2b('0x45')](_0x5eb852['model'],_0x5eb852[_0x6c2b('0x2e')]);_0x1eaf17[_0x6c2b('0x32')]=_[_0x6c2b('0x45')](_0x5eb852['model'],qs['fields'](_0x53f630[_0x6c2b('0x2e')][_0x6c2b('0x33')]));_0x1eaf17[_0x6c2b('0x32')]=_0x1eaf17['attributes'][_0x6c2b('0x34')]?_0x1eaf17[_0x6c2b('0x32')]:_0x5eb852['model'];_0x1eaf17['order']=qs[_0x6c2b('0x36')](_0x53f630[_0x6c2b('0x2e')][_0x6c2b('0x36')]);_0x1eaf17[_0x6c2b('0x37')]=qs[_0x6c2b('0x30')](_[_0x6c2b('0x38')](_0x53f630[_0x6c2b('0x2e')],_0x5eb852[_0x6c2b('0x30')]));if(_0x53f630[_0x6c2b('0x2e')][_0x6c2b('0x39')]){_0x1eaf17['where']=_[_0x6c2b('0x3c')](_0x1eaf17[_0x6c2b('0x37')],{'$or':_[_0x6c2b('0x2b')](_0x1eaf17[_0x6c2b('0x32')],function(_0x5b1635){var _0x447532={};_0x447532[_0x5b1635]={'$like':'%'+_0x53f630[_0x6c2b('0x2e')]['filter']+'%'};return _0x447532;})});}_0x1eaf17=_[_0x6c2b('0x3c')]({},_0x1eaf17,_0x53f630[_0x6c2b('0x3d')]);return _0x4e6373[_0x6c2b('0x61')](_0x1eaf17);}})[_0x6c2b('0x23')](function(_0x379c4a){if(_0x379c4a){_0x56bd9f=_0x379c4a[_0x6c2b('0x34')];if(!_0x53f630[_0x6c2b('0x2e')][_0x6c2b('0x59')]('nolimit')){_0x1eaf17['limit']=qs[_0x6c2b('0x1e')](_0x53f630[_0x6c2b('0x2e')][_0x6c2b('0x1e')]);_0x1eaf17[_0x6c2b('0x1c')]=qs[_0x6c2b('0x1c')](_0x53f630[_0x6c2b('0x2e')][_0x6c2b('0x1c')]);}return _0x4e6373['getLists'](_0x1eaf17);}})[_0x6c2b('0x23')](function(_0x2fc3e6){if(_0x2fc3e6){return _0x2fc3e6?{'count':_0x56bd9f,'rows':_0x2fc3e6}:null;}})[_0x6c2b('0x23')](respondWithResult(_0x5ae45b,null))[_0x6c2b('0x42')](handleError(_0x5ae45b,null));};exports[_0x6c2b('0x63')]=function(_0x24b05b,_0x19fb68,_0xe02ebc){var _0x289611,_0x5b6689;return db[_0x6c2b('0x3e')][_0x6c2b('0x46')]({'where':{'id':_0x24b05b['params']['id']}})[_0x6c2b('0x23')](handleEntityNotFound(_0x19fb68,null))[_0x6c2b('0x23')](function(_0x2bd3fa){if(_0x2bd3fa){_0x5b6689=_0x2bd3fa;return _0x2bd3fa[_0x6c2b('0x63')](_0x24b05b[_0x6c2b('0x56')][_0x6c2b('0x64')],_[_0x6c2b('0x53')](_0x24b05b[_0x6c2b('0x56')],[_0x6c2b('0x64'),'id'])||{});}return null;})[_0x6c2b('0x65')](function(_0x4083af){var _0x258bfa;_0x289611=_0x4083af||[];var _0x11f298=[];if(_0x4083af){for(var _0x21bb68=0x0;_0x21bb68<_0x4083af[_0x6c2b('0x34')];_0x21bb68+=0x1){var _0x14bbb0=_0x4083af[_0x21bb68][_0x6c2b('0x25')]({'plain':!![]});_0x5b6689['dialCheckDuplicateType']=_0x24b05b['body']['dialCheckDuplicateType']?_0x24b05b['body'][_0x6c2b('0x66')]:_0x5b6689[_0x6c2b('0x66')];switch(_0x5b6689[_0x6c2b('0x66')]){case _0x6c2b('0x67'):_0x258bfa=squel[_0x6c2b('0x68')]()[_0x6c2b('0x69')]('cm_hopper')[_0x6c2b('0x6a')]([_0x6c2b('0x6b'),'scheduledAt',_0x6c2b('0x6c'),'ListId',_0x6c2b('0x5c'),'createdAt',_0x6c2b('0x55')],squel[_0x6c2b('0x6d')]()[_0x6c2b('0x6e')]('phone',_0x6c2b('0x6b'))[_0x6c2b('0x6e')](_0x6c2b('0x6f'),'scheduledAt')['field']('id',_0x6c2b('0x6c'))['field'](_0x14bbb0['CmListId'][_0x6c2b('0x70')](),_0x6c2b('0x71'))[_0x6c2b('0x6e')](_0x24b05b[_0x6c2b('0x44')]['id'][_0x6c2b('0x70')](),_0x6c2b('0x5c'))[_0x6c2b('0x6e')]('NOW()','createdAt')['field'](_0x6c2b('0x6f'),_0x6c2b('0x55'))[_0x6c2b('0x72')](_0x6c2b('0x73'))[_0x6c2b('0x37')](_0x6c2b('0x74'))[_0x6c2b('0x37')]('ListId\x20=\x20?',_0x14bbb0['CmListId'][_0x6c2b('0x70')]())[_0x6c2b('0x37')](_0x6c2b('0x75'))[_0x6c2b('0x37')](_0x6c2b('0x76'),squel[_0x6c2b('0x6d')]()[_0x6c2b('0x6e')]('COALESCE(calleridnum,\x27\x27)')[_0x6c2b('0x72')](_0x6c2b('0x77'))[_0x6c2b('0x37')](_0x6c2b('0x78'),_0x24b05b[_0x6c2b('0x44')]['id'][_0x6c2b('0x70')]()))['where'](_0x6c2b('0x76'),squel[_0x6c2b('0x6d')]()[_0x6c2b('0x6e')](_0x6c2b('0x79'))[_0x6c2b('0x72')](_0x6c2b('0x7a'))['where']('CampaignId\x20=\x20?',_0x24b05b[_0x6c2b('0x44')]['id'][_0x6c2b('0x70')]())))[_0x6c2b('0x70')]();break;case'onlyIfOpen':_0x258bfa=squel[_0x6c2b('0x68')]()['into'](_0x6c2b('0x7a'))['fromQuery'](['phone','scheduledAt',_0x6c2b('0x6c'),'ListId',_0x6c2b('0x5c'),'createdAt',_0x6c2b('0x55')],squel[_0x6c2b('0x6d')]()[_0x6c2b('0x6e')](_0x6c2b('0x6b'),'phone')[_0x6c2b('0x6e')]('NOW()',_0x6c2b('0x7b'))[_0x6c2b('0x6e')]('id',_0x6c2b('0x6c'))[_0x6c2b('0x6e')](_0x14bbb0[_0x6c2b('0x7c')][_0x6c2b('0x70')](),_0x6c2b('0x71'))[_0x6c2b('0x6e')](_0x24b05b[_0x6c2b('0x44')]['id'][_0x6c2b('0x70')](),_0x6c2b('0x5c'))['field'](_0x6c2b('0x6f'),_0x6c2b('0x54'))[_0x6c2b('0x6e')](_0x6c2b('0x6f'),_0x6c2b('0x55'))[_0x6c2b('0x72')](_0x6c2b('0x73'))[_0x6c2b('0x37')](_0x6c2b('0x74'))[_0x6c2b('0x37')](_0x6c2b('0x7d'),_0x14bbb0[_0x6c2b('0x7c')]['toString']())[_0x6c2b('0x37')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x6c2b('0x76'),squel[_0x6c2b('0x6d')]()[_0x6c2b('0x6e')](_0x6c2b('0x79'))[_0x6c2b('0x72')]('cm_hopper')['where'](_0x6c2b('0x78'),_0x24b05b[_0x6c2b('0x44')]['id'][_0x6c2b('0x70')]())))[_0x6c2b('0x70')]();break;default:_0x258bfa=squel[_0x6c2b('0x68')]()['into'](_0x6c2b('0x7a'))[_0x6c2b('0x6a')]([_0x6c2b('0x6b'),_0x6c2b('0x7b'),'ContactId',_0x6c2b('0x71'),_0x6c2b('0x5c'),_0x6c2b('0x54'),_0x6c2b('0x55')],squel[_0x6c2b('0x6d')]()[_0x6c2b('0x6e')](_0x6c2b('0x6b'),_0x6c2b('0x6b'))[_0x6c2b('0x6e')](_0x6c2b('0x6f'),_0x6c2b('0x7b'))[_0x6c2b('0x6e')]('id','ContactId')['field'](_0x14bbb0['CmListId']['toString'](),_0x6c2b('0x71'))['field'](_0x24b05b[_0x6c2b('0x44')]['id']['toString'](),_0x6c2b('0x5c'))[_0x6c2b('0x6e')]('NOW()',_0x6c2b('0x54'))[_0x6c2b('0x6e')]('NOW()',_0x6c2b('0x55'))[_0x6c2b('0x72')](_0x6c2b('0x73'))[_0x6c2b('0x37')]('deletedAt\x20IS\x20NULL')[_0x6c2b('0x37')](_0x6c2b('0x7d'),_0x14bbb0[_0x6c2b('0x7c')][_0x6c2b('0x70')]())[_0x6c2b('0x37')](_0x6c2b('0x75')))[_0x6c2b('0x70')]();}_0x11f298[_0x6c2b('0x7e')](db[_0x6c2b('0x7f')]['query'](_0x258bfa));}return BPromise[_0x6c2b('0x80')](_0x11f298);}})[_0x6c2b('0x23')](function(){return _0x289611;})[_0x6c2b('0x23')](respondWithResult(_0x19fb68,null))[_0x6c2b('0x42')](handleError(_0x19fb68,null));};exports['removeLists']=function(_0x3264a3,_0x340b66,_0x580b73){return db[_0x6c2b('0x3e')][_0x6c2b('0x46')]({'where':{'id':_0x3264a3[_0x6c2b('0x44')]['id']}})[_0x6c2b('0x23')](handleEntityNotFound(_0x340b66,null))[_0x6c2b('0x23')](function(_0x52fd50){if(_0x52fd50){return _0x52fd50[_0x6c2b('0x81')](_0x3264a3[_0x6c2b('0x2e')][_0x6c2b('0x64')]);}})[_0x6c2b('0x23')](function(_0x52defa){if(_0x52defa){return db[_0x6c2b('0x58')][_0x6c2b('0x24')]({'where':{'ListId':_0x3264a3[_0x6c2b('0x2e')][_0x6c2b('0x64')],'CampaignId':_0x3264a3[_0x6c2b('0x44')]['id']}})[_0x6c2b('0x23')](function(){return _0x52defa;});}})[_0x6c2b('0x23')](respondWithStatusCode(_0x340b66,null))[_0x6c2b('0x42')](handleError(_0x340b66,null));};exports['getBlackLists']=function(_0x567150,_0x1fb9ba,_0x36c0af){var _0x394087={};var _0x5c5d8e={};var _0x322062;var _0x16ae58;return db[_0x6c2b('0x3e')][_0x6c2b('0x57')]({'where':{'id':_0x567150[_0x6c2b('0x44')]['id']}})[_0x6c2b('0x23')](handleEntityNotFound(_0x1fb9ba,null))[_0x6c2b('0x23')](function(_0x1de477){if(_0x1de477){_0x322062=_0x1de477;_0x5c5d8e[_0x6c2b('0x31')]=_[_0x6c2b('0x2f')](db[_0x6c2b('0x62')][_0x6c2b('0x2c')]);_0x5c5d8e['query']=_[_0x6c2b('0x2f')](_0x567150['query']);_0x5c5d8e['filters']=_[_0x6c2b('0x45')](_0x5c5d8e[_0x6c2b('0x31')],_0x5c5d8e[_0x6c2b('0x2e')]);_0x394087[_0x6c2b('0x32')]=_[_0x6c2b('0x45')](_0x5c5d8e['model'],qs['fields'](_0x567150[_0x6c2b('0x2e')][_0x6c2b('0x33')]));_0x394087['attributes']=_0x394087[_0x6c2b('0x32')][_0x6c2b('0x34')]?_0x394087[_0x6c2b('0x32')]:_0x5c5d8e[_0x6c2b('0x31')];_0x394087['order']=qs[_0x6c2b('0x36')](_0x567150[_0x6c2b('0x2e')]['sort']);_0x394087[_0x6c2b('0x37')]=qs[_0x6c2b('0x30')](_[_0x6c2b('0x38')](_0x567150[_0x6c2b('0x2e')],_0x5c5d8e['filters']));if(_0x567150[_0x6c2b('0x2e')][_0x6c2b('0x39')]){_0x394087[_0x6c2b('0x37')]=_[_0x6c2b('0x3c')](_0x394087[_0x6c2b('0x37')],{'$or':_['map'](_0x394087[_0x6c2b('0x32')],function(_0x184ca1){var _0x3353ac={};_0x3353ac[_0x184ca1]={'$like':'%'+_0x567150[_0x6c2b('0x2e')][_0x6c2b('0x39')]+'%'};return _0x3353ac;})});}_0x394087=_['merge']({},_0x394087,_0x567150['options']);return _0x322062[_0x6c2b('0x82')](_0x394087);}})['then'](function(_0x2f9287){if(_0x2f9287){_0x16ae58=_0x2f9287['length'];if(!_0x567150[_0x6c2b('0x2e')][_0x6c2b('0x59')](_0x6c2b('0x5a'))){_0x394087[_0x6c2b('0x1e')]=qs['limit'](_0x567150[_0x6c2b('0x2e')][_0x6c2b('0x1e')]);_0x394087[_0x6c2b('0x1c')]=qs[_0x6c2b('0x1c')](_0x567150[_0x6c2b('0x2e')][_0x6c2b('0x1c')]);}return _0x322062['getBlackLists'](_0x394087);}})['then'](function(_0x3292f9){if(_0x3292f9){return _0x3292f9?{'count':_0x16ae58,'rows':_0x3292f9}:null;}})[_0x6c2b('0x23')](respondWithResult(_0x1fb9ba,null))[_0x6c2b('0x42')](handleError(_0x1fb9ba,null));};exports['addBlackLists']=function(_0x525329,_0x29e17c,_0x531bc2){var _0xa82f7d,_0x1e0a82;return db[_0x6c2b('0x3e')][_0x6c2b('0x46')]({'where':{'id':_0x525329['params']['id']}})[_0x6c2b('0x23')](handleEntityNotFound(_0x29e17c,null))[_0x6c2b('0x23')](function(_0x53a354){if(_0x53a354){_0x1e0a82=_0x53a354;return _0x53a354[_0x6c2b('0x83')](_0x525329[_0x6c2b('0x56')][_0x6c2b('0x64')],_['omit'](_0x525329[_0x6c2b('0x56')],['ids','id'])||{});}return null;})[_0x6c2b('0x65')](function(_0x576871){var _0x37e988;_0xa82f7d=_0x576871||[];var _0x204e3a=[];if(_0x576871){for(var _0x33a747=0x0;_0x33a747<_0x576871[_0x6c2b('0x34')];_0x33a747+=0x1){var _0x21562d=_0x576871[_0x33a747][_0x6c2b('0x25')]({'plain':!![]});_0x37e988=squel['insert']()[_0x6c2b('0x69')]('cm_hopper_black')['fromQuery']([_0x6c2b('0x6b'),'ContactId',_0x6c2b('0x71'),_0x6c2b('0x5c'),'createdAt',_0x6c2b('0x55')],squel[_0x6c2b('0x6d')]()[_0x6c2b('0x6e')](_0x6c2b('0x6b'),_0x6c2b('0x6b'))[_0x6c2b('0x6e')]('id',_0x6c2b('0x6c'))[_0x6c2b('0x6e')](_0x21562d[_0x6c2b('0x7c')][_0x6c2b('0x70')](),_0x6c2b('0x71'))[_0x6c2b('0x6e')](_0x525329[_0x6c2b('0x44')]['id'][_0x6c2b('0x70')](),_0x6c2b('0x5c'))[_0x6c2b('0x6e')]('NOW()',_0x6c2b('0x54'))[_0x6c2b('0x6e')](_0x6c2b('0x6f'),_0x6c2b('0x55'))[_0x6c2b('0x72')](_0x6c2b('0x73'))[_0x6c2b('0x37')]('deletedAt\x20IS\x20NULL')[_0x6c2b('0x37')](_0x6c2b('0x7d'),_0x21562d[_0x6c2b('0x7c')][_0x6c2b('0x70')]())[_0x6c2b('0x37')](_0x6c2b('0x75')))['toString']();_0x204e3a[_0x6c2b('0x7e')](db['sequelize'][_0x6c2b('0x2e')](_0x37e988));}return BPromise['all'](_0x204e3a);}})[_0x6c2b('0x23')](function(){return _0xa82f7d;})[_0x6c2b('0x23')](respondWithResult(_0x29e17c,null))[_0x6c2b('0x42')](handleError(_0x29e17c,null));};exports[_0x6c2b('0x84')]=function(_0x5ee964,_0x572f74,_0x5e4089){return db[_0x6c2b('0x3e')][_0x6c2b('0x46')]({'where':{'id':_0x5ee964['params']['id']}})['then'](handleEntityNotFound(_0x572f74,null))[_0x6c2b('0x23')](function(_0x536f78){if(_0x536f78){return _0x536f78[_0x6c2b('0x84')](_0x5ee964[_0x6c2b('0x2e')]['ids']);}})['then'](function(_0x59000d){if(_0x59000d){return db[_0x6c2b('0x60')][_0x6c2b('0x24')]({'where':{'ListId':_0x5ee964[_0x6c2b('0x2e')]['ids'],'CampaignId':_0x5ee964[_0x6c2b('0x44')]['id']}})[_0x6c2b('0x23')](function(){return _0x59000d;});}})[_0x6c2b('0x23')](respondWithStatusCode(_0x572f74,null))[_0x6c2b('0x42')](handleError(_0x572f74,null));}; \ No newline at end of file +var _0x225d=['ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','IvrCampaigns','UserProfileResource','end','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','body','createdAt','updatedAt','UserProfileSection','destroy','findOne','CmHopper','hasOwnProperty','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt'];(function(_0x43fde6,_0x2720d0){var _0x49785b=function(_0xa1cade){while(--_0xa1cade){_0x43fde6['push'](_0x43fde6['shift']());}};_0x49785b(++_0x2720d0);}(_0x225d,0x12d));var _0xd225=function(_0x17de27,_0x1ffee2){_0x17de27=_0x17de27-0x0;var _0xc8cfd0=_0x225d[_0x17de27];return _0xc8cfd0;};'use strict';var emlformat=require(_0xd225('0x0'));var rimraf=require(_0xd225('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd225('0x2'));var rp=require('request-promise');var moment=require(_0xd225('0x3'));var BPromise=require(_0xd225('0x4'));var Mustache=require(_0xd225('0x5'));var util=require(_0xd225('0x6'));var path=require(_0xd225('0x7'));var sox=require(_0xd225('0x8'));var csv=require(_0xd225('0x9'));var ejs=require(_0xd225('0xa'));var fs=require('fs');var fs_extra=require(_0xd225('0xb'));var _=require(_0xd225('0xc'));var squel=require('squel');var crypto=require(_0xd225('0xd'));var jsforce=require(_0xd225('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd225('0xf'));var Papa=require(_0xd225('0x10'));var Redis=require('ioredis');var authService=require(_0xd225('0x11'));var qs=require(_0xd225('0x12'));var as=require(_0xd225('0x13'));var hardwareService=require(_0xd225('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd225('0x15'));var config=require(_0xd225('0x16'));var licenseUtil=require(_0xd225('0x17'));var db=require(_0xd225('0x18'))['db'];function respondWithStatusCode(_0x4a8ab4,_0x2dee8b){_0x2dee8b=_0x2dee8b||0xcc;return function(_0x50f8dc){if(_0x50f8dc){return _0x4a8ab4[_0xd225('0x19')](_0x2dee8b);}return _0x4a8ab4[_0xd225('0x1a')](_0x2dee8b)['end']();};}function respondWithResult(_0x3d2b30,_0x23f128){_0x23f128=_0x23f128||0xc8;return function(_0x4f232a){if(_0x4f232a){return _0x3d2b30['status'](_0x23f128)[_0xd225('0x1b')](_0x4f232a);}};}function respondWithFilteredResult(_0x27bd57,_0x1674e6){return function(_0x1579c3){if(_0x1579c3){var _0x4f5a79=typeof _0x1674e6[_0xd225('0x1c')]===_0xd225('0x1d')&&typeof _0x1674e6[_0xd225('0x1e')]===_0xd225('0x1d');var _0x2a4fe6=_0x1579c3[_0xd225('0x1f')];var _0x2b36bb=_0x4f5a79?0x0:_0x1674e6['offset'];var _0x1ab48a=_0x4f5a79?_0x1579c3['count']:_0x1674e6[_0xd225('0x1c')]+_0x1674e6[_0xd225('0x1e')];var _0xb2e344;if(_0x1ab48a>=_0x2a4fe6){_0x1ab48a=_0x2a4fe6;_0xb2e344=0xc8;}else{_0xb2e344=0xce;}_0x27bd57[_0xd225('0x1a')](_0xb2e344);return _0x27bd57[_0xd225('0x20')](_0xd225('0x21'),_0x2b36bb+'-'+_0x1ab48a+'/'+_0x2a4fe6)[_0xd225('0x1b')](_0x1579c3);}return null;};}function patchUpdates(_0x11d821){return function(_0x566625){try{jsonpatch[_0xd225('0x22')](_0x566625,_0x11d821,!![]);}catch(_0xaad568){return BPromise['reject'](_0xaad568);}return _0x566625[_0xd225('0x23')]();};}function saveUpdates(_0x51ace8,_0x4e1b06){return function(_0x21b3af){if(_0x21b3af){return _0x21b3af[_0xd225('0x24')](_0x51ace8)[_0xd225('0x25')](function(_0x100719){return _0x100719;});}return null;};}function removeEntity(_0x319b61,_0x16c0a){return function(_0x27aeab){if(_0x27aeab){return _0x27aeab['destroy']()[_0xd225('0x25')](function(){var _0x118379=_0x27aeab['get']({'plain':!![]});var _0x29fb28=_0xd225('0x26');return db[_0xd225('0x27')]['destroy']({'where':{'type':_0x29fb28,'resourceId':_0x118379['id']}})[_0xd225('0x25')](function(){return _0x27aeab;});})[_0xd225('0x25')](function(){_0x319b61[_0xd225('0x1a')](0xcc)[_0xd225('0x28')]();});}};}function handleEntityNotFound(_0x296db8,_0x10418d){return function(_0x474835){if(!_0x474835){_0x296db8[_0xd225('0x19')](0x194);}return _0x474835;};}function handleError(_0x12a95b,_0x25fe47){_0x25fe47=_0x25fe47||0x1f4;return function(_0x5856aa){logger[_0xd225('0x29')](_0x5856aa[_0xd225('0x2a')]);if(_0x5856aa[_0xd225('0x2b')]){delete _0x5856aa['name'];}_0x12a95b[_0xd225('0x1a')](_0x25fe47)['send'](_0x5856aa);};}exports[_0xd225('0x2c')]=function(_0x453f8e,_0x288a83){var _0x39627b={},_0x4b52f7={},_0x40dc3c={'count':0x0,'rows':[]};var _0x1df0f3=_[_0xd225('0x2d')](db[_0xd225('0x2e')][_0xd225('0x2f')],function(_0x2baab7){return{'name':_0x2baab7[_0xd225('0x30')],'type':_0x2baab7[_0xd225('0x31')]['key']};});_0x4b52f7[_0xd225('0x32')]=_[_0xd225('0x2d')](_0x1df0f3,_0xd225('0x2b'));_0x4b52f7[_0xd225('0x33')]=_[_0xd225('0x34')](_0x453f8e[_0xd225('0x33')]);_0x4b52f7[_0xd225('0x35')]=_[_0xd225('0x36')](_0x4b52f7[_0xd225('0x32')],_0x4b52f7[_0xd225('0x33')]);_0x39627b[_0xd225('0x37')]=_[_0xd225('0x36')](_0x4b52f7[_0xd225('0x32')],qs[_0xd225('0x38')](_0x453f8e['query'][_0xd225('0x38')]));_0x39627b[_0xd225('0x37')]=_0x39627b[_0xd225('0x37')]['length']?_0x39627b[_0xd225('0x37')]:_0x4b52f7[_0xd225('0x32')];if(!_0x453f8e[_0xd225('0x33')]['hasOwnProperty'](_0xd225('0x39'))){_0x39627b[_0xd225('0x1e')]=qs[_0xd225('0x1e')](_0x453f8e[_0xd225('0x33')][_0xd225('0x1e')]);_0x39627b['offset']=qs[_0xd225('0x1c')](_0x453f8e[_0xd225('0x33')]['offset']);}_0x39627b[_0xd225('0x3a')]=qs['sort'](_0x453f8e[_0xd225('0x33')][_0xd225('0x3b')]);_0x39627b[_0xd225('0x3c')]=qs['filters'](_[_0xd225('0x3d')](_0x453f8e['query'],_0x4b52f7[_0xd225('0x35')]),_0x1df0f3);if(_0x453f8e[_0xd225('0x33')][_0xd225('0x3e')]){_0x39627b[_0xd225('0x3c')]=_[_0xd225('0x3f')](_0x39627b[_0xd225('0x3c')],{'$or':_[_0xd225('0x2d')](_0x1df0f3,function(_0x58af0f){if(_0x58af0f[_0xd225('0x31')]!==_0xd225('0x40')){var _0x5a05e6={};_0x5a05e6[_0x58af0f[_0xd225('0x2b')]]={'$like':'%'+_0x453f8e[_0xd225('0x33')]['filter']+'%'};return _0x5a05e6;}})});}_0x39627b=_['merge']({},_0x39627b,_0x453f8e[_0xd225('0x41')]);var _0x1a8827={'where':_0x39627b[_0xd225('0x3c')]};return db[_0xd225('0x2e')][_0xd225('0x1f')](_0x1a8827)[_0xd225('0x25')](function(_0x52bf8d){_0x40dc3c['count']=_0x52bf8d;if(_0x453f8e[_0xd225('0x33')][_0xd225('0x42')]){_0x39627b[_0xd225('0x43')]=[{'all':!![]}];}return db[_0xd225('0x2e')][_0xd225('0x44')](_0x39627b);})[_0xd225('0x25')](function(_0x5e44b6){_0x40dc3c[_0xd225('0x45')]=_0x5e44b6;return _0x40dc3c;})[_0xd225('0x25')](respondWithFilteredResult(_0x288a83,_0x39627b))[_0xd225('0x46')](handleError(_0x288a83,null));};exports[_0xd225('0x47')]=function(_0x53e45a,_0x542b32){var _0xf72be7={'raw':![],'where':{'id':_0x53e45a[_0xd225('0x48')]['id']}},_0x3b5b86={};_0x3b5b86[_0xd225('0x32')]=_['keys'](db['Campaign'][_0xd225('0x2f')]);_0x3b5b86[_0xd225('0x33')]=_[_0xd225('0x34')](_0x53e45a[_0xd225('0x33')]);_0x3b5b86[_0xd225('0x35')]=_[_0xd225('0x36')](_0x3b5b86[_0xd225('0x32')],_0x3b5b86[_0xd225('0x33')]);_0xf72be7[_0xd225('0x37')]=_[_0xd225('0x36')](_0x3b5b86[_0xd225('0x32')],qs['fields'](_0x53e45a[_0xd225('0x33')][_0xd225('0x38')]));_0xf72be7[_0xd225('0x37')]=_0xf72be7[_0xd225('0x37')][_0xd225('0x49')]?_0xf72be7[_0xd225('0x37')]:_0x3b5b86[_0xd225('0x32')];if(_0x53e45a[_0xd225('0x33')][_0xd225('0x42')]){_0xf72be7[_0xd225('0x43')]=[{'all':!![]}];}_0xf72be7=_[_0xd225('0x3f')]({},_0xf72be7,_0x53e45a[_0xd225('0x41')]);return db[_0xd225('0x2e')][_0xd225('0x4a')](_0xf72be7)[_0xd225('0x25')](handleEntityNotFound(_0x542b32,null))[_0xd225('0x25')](respondWithResult(_0x542b32,null))['catch'](handleError(_0x542b32,null));};exports[_0xd225('0x4b')]=function(_0x398d57,_0x2ee5fd){return db[_0xd225('0x2e')]['create'](_0x398d57['body'],{})[_0xd225('0x25')](function(_0x3a4e62){var _0x2ec715=_0x398d57[_0xd225('0x4c')][_0xd225('0x4d')]({'plain':!![]});if(!_0x2ec715)throw new Error(_0xd225('0x4e'));if(_0x2ec715[_0xd225('0x4f')]===_0xd225('0x4c')){var _0x54c249=_0x3a4e62[_0xd225('0x4d')]({'plain':!![]});var _0x181b98='IvrCampaigns';return db['UserProfileSection'][_0xd225('0x4a')]({'where':{'name':_0x181b98,'userProfileId':_0x2ec715[_0xd225('0x50')]},'raw':!![]})['then'](function(_0x4468ca){if(_0x4468ca&&_0x4468ca[_0xd225('0x51')]===0x0){return db['UserProfileResource'][_0xd225('0x4b')]({'name':_0x54c249[_0xd225('0x2b')],'resourceId':_0x54c249['id'],'type':_0x4468ca[_0xd225('0x2b')],'sectionId':_0x4468ca['id']},{})['then'](function(){return _0x3a4e62;});}else{return _0x3a4e62;}})[_0xd225('0x46')](function(_0x58a59c){logger[_0xd225('0x29')](_0xd225('0x52'),_0x58a59c);throw _0x58a59c;});}return _0x3a4e62;})[_0xd225('0x25')](respondWithResult(_0x2ee5fd,0xc9))[_0xd225('0x46')](handleError(_0x2ee5fd,null));};exports[_0xd225('0x53')]=function(_0x2839df,_0x154bd7){var _0x15ad69={'where':{'id':_0x2839df['params']['id']}},_0x4703a5={};_0x4703a5[_0xd225('0x32')]=_[_0xd225('0x34')](db[_0xd225('0x2e')][_0xd225('0x2f')]);_0x15ad69['attributes']=_[_0xd225('0x36')](_0x4703a5[_0xd225('0x32')],qs[_0xd225('0x38')](_0x2839df[_0xd225('0x33')][_0xd225('0x38')]));_0x15ad69[_0xd225('0x37')]=_0x15ad69[_0xd225('0x37')][_0xd225('0x49')]?_0x15ad69['attributes']:_0x4703a5[_0xd225('0x32')];if(_0x2839df[_0xd225('0x33')][_0xd225('0x42')]){_0x15ad69[_0xd225('0x43')]=[{'all':!![]}];}_0x15ad69=_[_0xd225('0x3f')]({},_0x15ad69,_0x2839df[_0xd225('0x41')]);return db['Campaign'][_0xd225('0x4a')](_0x15ad69)[_0xd225('0x25')](handleEntityNotFound(_0x154bd7,null))[_0xd225('0x25')](function(_0x2dffc1){if(_0x2dffc1){var _0x10df31=_0x2dffc1[_0xd225('0x4d')]({'plain':!![]});_0x10df31=qs[_0xd225('0x54')](_0x10df31,['id','createdAt','updatedAt']);_0x2839df[_0xd225('0x55')]=_[_0xd225('0x54')](_0x2839df[_0xd225('0x55')],['id',_0xd225('0x56'),_0xd225('0x57')]);return db[_0xd225('0x2e')][_0xd225('0x4b')](_[_0xd225('0x3f')](_0x10df31,_0x2839df[_0xd225('0x55')]),{'include':_0x2839df[_0xd225('0x33')][_0xd225('0x42')]?[{'all':!![]}]:undefined})[_0xd225('0x25')](function(_0x49bbc5){var _0x29533d=_0x2839df[_0xd225('0x4c')][_0xd225('0x4d')]({'plain':!![]});if(!_0x29533d)throw new Error(_0xd225('0x4e'));if(_0x29533d[_0xd225('0x4f')]==='user'){var _0x567555=_0x49bbc5[_0xd225('0x4d')]({'plain':!![]});var _0x580deb=_0xd225('0x26');return db[_0xd225('0x58')][_0xd225('0x4a')]({'where':{'name':_0x580deb,'userProfileId':_0x29533d[_0xd225('0x50')]},'raw':!![]})[_0xd225('0x25')](function(_0x466d85){if(_0x466d85&&_0x466d85['autoAssociation']===0x0){return db['UserProfileResource'][_0xd225('0x4b')]({'name':_0x567555['name'],'resourceId':_0x567555['id'],'type':_0x466d85[_0xd225('0x2b')],'sectionId':_0x466d85['id']},{})[_0xd225('0x25')](function(){return _0x49bbc5;});}else{return _0x49bbc5;}})[_0xd225('0x46')](function(_0x284b31){logger['error'](_0xd225('0x52'),_0x284b31);throw _0x284b31;});}return _0x49bbc5;});}})[_0xd225('0x25')](respondWithResult(_0x154bd7,0xc9))[_0xd225('0x46')](handleError(_0x154bd7,null));};exports['update']=function(_0x2046fe,_0x17910d){if(_0x2046fe[_0xd225('0x55')]['id']){delete _0x2046fe[_0xd225('0x55')]['id'];}return db[_0xd225('0x2e')][_0xd225('0x4a')]({'where':{'id':_0x2046fe['params']['id']}})['then'](handleEntityNotFound(_0x17910d,null))[_0xd225('0x25')](saveUpdates(_0x2046fe[_0xd225('0x55')],null))['then'](respondWithResult(_0x17910d,null))[_0xd225('0x46')](handleError(_0x17910d,null));};exports[_0xd225('0x59')]=function(_0x1fe8dc,_0x47c3ec){return db[_0xd225('0x2e')][_0xd225('0x4a')]({'where':{'id':_0x1fe8dc[_0xd225('0x48')]['id']}})[_0xd225('0x25')](handleEntityNotFound(_0x47c3ec,null))['then'](removeEntity(_0x47c3ec,null))[_0xd225('0x46')](handleError(_0x47c3ec,null));};exports['getHoppers']=function(_0x30caed,_0x436b06,_0x2948e2){var _0x504abe={'raw':!![],'where':{}};var _0x2ade47={};var _0x5a402b={'count':0x0,'rows':[]};return db[_0xd225('0x2e')][_0xd225('0x5a')]({'where':{'id':_0x30caed[_0xd225('0x48')]['id']}})[_0xd225('0x25')](handleEntityNotFound(_0x436b06,null))[_0xd225('0x25')](function(_0x31727c){if(_0x31727c){_0x2ade47[_0xd225('0x32')]=_[_0xd225('0x34')](db[_0xd225('0x5b')][_0xd225('0x2f')]);_0x2ade47['query']=_[_0xd225('0x34')](_0x30caed['query']);_0x2ade47[_0xd225('0x35')]=_[_0xd225('0x36')](_0x2ade47[_0xd225('0x32')],_0x2ade47[_0xd225('0x33')]);_0x504abe['attributes']=_['intersection'](_0x2ade47[_0xd225('0x32')],qs['fields'](_0x30caed[_0xd225('0x33')][_0xd225('0x38')]));_0x504abe[_0xd225('0x37')]=_0x504abe[_0xd225('0x37')][_0xd225('0x49')]?_0x504abe[_0xd225('0x37')]:_0x2ade47[_0xd225('0x32')];if(!_0x30caed[_0xd225('0x33')][_0xd225('0x5c')]('nolimit')){_0x504abe['limit']=qs['limit'](_0x30caed['query'][_0xd225('0x1e')]);_0x504abe[_0xd225('0x1c')]=qs[_0xd225('0x1c')](_0x30caed['query']['offset']);}_0x504abe[_0xd225('0x3a')]=qs[_0xd225('0x3b')](_0x30caed[_0xd225('0x33')][_0xd225('0x3b')]);_0x504abe[_0xd225('0x3c')]=qs[_0xd225('0x35')](_[_0xd225('0x3d')](_0x30caed[_0xd225('0x33')],_0x2ade47[_0xd225('0x35')]));_0x504abe[_0xd225('0x3c')][_0xd225('0x5d')]=_0x31727c['id'];if(_0x30caed[_0xd225('0x33')]['filter']){_0x504abe[_0xd225('0x3c')]=_[_0xd225('0x3f')](_0x504abe[_0xd225('0x3c')],{'$or':_[_0xd225('0x2d')](_0x504abe[_0xd225('0x37')],function(_0x3b4953){var _0x34c890={};_0x34c890[_0x3b4953]={'$like':'%'+_0x30caed[_0xd225('0x33')][_0xd225('0x3e')]+'%'};return _0x34c890;})});}_0x504abe=_[_0xd225('0x3f')]({},_0x504abe,_0x30caed['options']);return db['CmHopper'][_0xd225('0x1f')]({'where':_0x504abe['where']})[_0xd225('0x25')](function(_0xf68e5f){_0x5a402b['count']=_0xf68e5f;if(_0x30caed[_0xd225('0x33')][_0xd225('0x42')]){_0x504abe[_0xd225('0x43')]=[{'all':!![]}];}return db[_0xd225('0x5b')]['findAll'](_0x504abe);})[_0xd225('0x25')](function(_0x53fd64){_0x5a402b[_0xd225('0x45')]=_0x53fd64;return _0x5a402b;});}})[_0xd225('0x25')](respondWithFilteredResult(_0x436b06,_0x504abe))[_0xd225('0x46')](handleError(_0x436b06,null));};exports[_0xd225('0x5e')]=function(_0x68af72,_0x33e101,_0x418b57){var _0x2337a2={'raw':!![],'where':{}};var _0x396432={};var _0x3c4e64={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x68af72[_0xd225('0x48')]['id']}})[_0xd225('0x25')](handleEntityNotFound(_0x33e101,null))[_0xd225('0x25')](function(_0x162476){if(_0x162476){_0x396432[_0xd225('0x32')]=_[_0xd225('0x34')](db['CmHopperHistory']['rawAttributes']);_0x396432[_0xd225('0x33')]=_[_0xd225('0x34')](_0x68af72[_0xd225('0x33')]);_0x396432[_0xd225('0x35')]=_['intersection'](_0x396432[_0xd225('0x32')],_0x396432[_0xd225('0x33')]);_0x2337a2[_0xd225('0x37')]=_['intersection'](_0x396432['model'],qs[_0xd225('0x38')](_0x68af72['query']['fields']));_0x2337a2['attributes']=_0x2337a2[_0xd225('0x37')][_0xd225('0x49')]?_0x2337a2[_0xd225('0x37')]:_0x396432['model'];if(!_0x68af72['query']['hasOwnProperty']('nolimit')){_0x2337a2[_0xd225('0x1e')]=qs['limit'](_0x68af72[_0xd225('0x33')][_0xd225('0x1e')]);_0x2337a2[_0xd225('0x1c')]=qs[_0xd225('0x1c')](_0x68af72[_0xd225('0x33')][_0xd225('0x1c')]);}_0x2337a2[_0xd225('0x3a')]=qs[_0xd225('0x3b')](_0x68af72[_0xd225('0x33')][_0xd225('0x3b')]);_0x2337a2[_0xd225('0x3c')]=qs[_0xd225('0x35')](_[_0xd225('0x3d')](_0x68af72[_0xd225('0x33')],_0x396432['filters']));_0x2337a2['where'][_0xd225('0x5d')]=_0x162476['id'];if(_0x68af72[_0xd225('0x33')][_0xd225('0x3e')]){_0x2337a2[_0xd225('0x3c')]=_['merge'](_0x2337a2['where'],{'$or':_[_0xd225('0x2d')](_0x2337a2['attributes'],function(_0x6b0a02){var _0xd1ddad={};_0xd1ddad[_0x6b0a02]={'$like':'%'+_0x68af72['query'][_0xd225('0x3e')]+'%'};return _0xd1ddad;})});}_0x2337a2=_['merge']({},_0x2337a2,_0x68af72[_0xd225('0x41')]);return db[_0xd225('0x5f')][_0xd225('0x1f')]({'where':_0x2337a2[_0xd225('0x3c')]})[_0xd225('0x25')](function(_0x3f60a5){_0x3c4e64[_0xd225('0x1f')]=_0x3f60a5;if(_0x68af72[_0xd225('0x33')][_0xd225('0x42')]){_0x2337a2[_0xd225('0x43')]=[{'all':!![]}];}return db[_0xd225('0x5f')][_0xd225('0x44')](_0x2337a2);})[_0xd225('0x25')](function(_0x5b4468){_0x3c4e64[_0xd225('0x45')]=_0x5b4468;return _0x3c4e64;});}})[_0xd225('0x25')](respondWithFilteredResult(_0x33e101,_0x2337a2))[_0xd225('0x46')](handleError(_0x33e101,null));};exports['getHopperFinals']=function(_0x133228,_0x347565,_0x323171){var _0x29b085={'raw':!![],'where':{}};var _0x1cf61a={};var _0x3825e2={'count':0x0,'rows':[]};return db[_0xd225('0x2e')][_0xd225('0x5a')]({'where':{'id':_0x133228[_0xd225('0x48')]['id']}})['then'](handleEntityNotFound(_0x347565,null))[_0xd225('0x25')](function(_0x304a64){if(_0x304a64){_0x1cf61a[_0xd225('0x32')]=_[_0xd225('0x34')](db[_0xd225('0x60')][_0xd225('0x2f')]);_0x1cf61a[_0xd225('0x33')]=_[_0xd225('0x34')](_0x133228[_0xd225('0x33')]);_0x1cf61a[_0xd225('0x35')]=_[_0xd225('0x36')](_0x1cf61a[_0xd225('0x32')],_0x1cf61a[_0xd225('0x33')]);_0x29b085[_0xd225('0x37')]=_[_0xd225('0x36')](_0x1cf61a['model'],qs[_0xd225('0x38')](_0x133228[_0xd225('0x33')][_0xd225('0x38')]));_0x29b085[_0xd225('0x37')]=_0x29b085[_0xd225('0x37')][_0xd225('0x49')]?_0x29b085['attributes']:_0x1cf61a[_0xd225('0x32')];if(!_0x133228[_0xd225('0x33')]['hasOwnProperty'](_0xd225('0x39'))){_0x29b085[_0xd225('0x1e')]=qs[_0xd225('0x1e')](_0x133228[_0xd225('0x33')][_0xd225('0x1e')]);_0x29b085[_0xd225('0x1c')]=qs[_0xd225('0x1c')](_0x133228[_0xd225('0x33')][_0xd225('0x1c')]);}_0x29b085[_0xd225('0x3a')]=qs[_0xd225('0x3b')](_0x133228[_0xd225('0x33')]['sort']);_0x29b085[_0xd225('0x3c')]=qs[_0xd225('0x35')](_['pick'](_0x133228['query'],_0x1cf61a[_0xd225('0x35')]));_0x29b085[_0xd225('0x3c')][_0xd225('0x5d')]=_0x304a64['id'];if(_0x133228['query']['filter']){_0x29b085['where']=_[_0xd225('0x3f')](_0x29b085['where'],{'$or':_[_0xd225('0x2d')](_0x29b085[_0xd225('0x37')],function(_0x44640e){var _0x43a0e4={};_0x43a0e4[_0x44640e]={'$like':'%'+_0x133228[_0xd225('0x33')]['filter']+'%'};return _0x43a0e4;})});}_0x29b085=_[_0xd225('0x3f')]({},_0x29b085,_0x133228['options']);return db[_0xd225('0x60')][_0xd225('0x1f')]({'where':_0x29b085[_0xd225('0x3c')]})[_0xd225('0x25')](function(_0x4785b3){_0x3825e2[_0xd225('0x1f')]=_0x4785b3;if(_0x133228[_0xd225('0x33')][_0xd225('0x42')]){_0x29b085['include']=[{'all':!![]}];}return db[_0xd225('0x60')][_0xd225('0x44')](_0x29b085);})['then'](function(_0x4fdc73){_0x3825e2[_0xd225('0x45')]=_0x4fdc73;return _0x3825e2;});}})['then'](respondWithFilteredResult(_0x347565,_0x29b085))[_0xd225('0x46')](handleError(_0x347565,null));};exports[_0xd225('0x61')]=function(_0x4ef61e,_0x4873d9,_0x5cc325){var _0x4d960f={'raw':!![],'where':{}};var _0x47d241={};var _0x1a1230={'count':0x0,'rows':[]};return db[_0xd225('0x2e')][_0xd225('0x5a')]({'where':{'id':_0x4ef61e[_0xd225('0x48')]['id']}})[_0xd225('0x25')](handleEntityNotFound(_0x4873d9,null))[_0xd225('0x25')](function(_0x20fd54){if(_0x20fd54){_0x47d241[_0xd225('0x32')]=_[_0xd225('0x34')](db[_0xd225('0x62')]['rawAttributes']);_0x47d241[_0xd225('0x33')]=_['keys'](_0x4ef61e[_0xd225('0x33')]);_0x47d241['filters']=_[_0xd225('0x36')](_0x47d241['model'],_0x47d241[_0xd225('0x33')]);_0x4d960f[_0xd225('0x37')]=_[_0xd225('0x36')](_0x47d241[_0xd225('0x32')],qs[_0xd225('0x38')](_0x4ef61e['query'][_0xd225('0x38')]));_0x4d960f[_0xd225('0x37')]=_0x4d960f['attributes'][_0xd225('0x49')]?_0x4d960f['attributes']:_0x47d241[_0xd225('0x32')];if(!_0x4ef61e[_0xd225('0x33')][_0xd225('0x5c')]('nolimit')){_0x4d960f[_0xd225('0x1e')]=qs[_0xd225('0x1e')](_0x4ef61e[_0xd225('0x33')][_0xd225('0x1e')]);_0x4d960f[_0xd225('0x1c')]=qs[_0xd225('0x1c')](_0x4ef61e[_0xd225('0x33')][_0xd225('0x1c')]);}_0x4d960f[_0xd225('0x3a')]=qs[_0xd225('0x3b')](_0x4ef61e[_0xd225('0x33')][_0xd225('0x3b')]);_0x4d960f['where']=qs[_0xd225('0x35')](_[_0xd225('0x3d')](_0x4ef61e[_0xd225('0x33')],_0x47d241[_0xd225('0x35')]));_0x4d960f[_0xd225('0x3c')][_0xd225('0x5d')]=_0x20fd54['id'];if(_0x4ef61e[_0xd225('0x33')][_0xd225('0x3e')]){_0x4d960f[_0xd225('0x3c')]=_[_0xd225('0x3f')](_0x4d960f[_0xd225('0x3c')],{'$or':_['map'](_0x4d960f[_0xd225('0x37')],function(_0x4bd5d6){var _0x546f7c={};_0x546f7c[_0x4bd5d6]={'$like':'%'+_0x4ef61e[_0xd225('0x33')][_0xd225('0x3e')]+'%'};return _0x546f7c;})});}_0x4d960f=_[_0xd225('0x3f')]({},_0x4d960f,_0x4ef61e[_0xd225('0x41')]);return db[_0xd225('0x62')]['count']({'where':_0x4d960f[_0xd225('0x3c')]})['then'](function(_0x320d02){_0x1a1230[_0xd225('0x1f')]=_0x320d02;if(_0x4ef61e[_0xd225('0x33')][_0xd225('0x42')]){_0x4d960f[_0xd225('0x43')]=[{'all':!![]}];}return db[_0xd225('0x62')][_0xd225('0x44')](_0x4d960f);})['then'](function(_0x377e1c){_0x1a1230['rows']=_0x377e1c;return _0x1a1230;});}})[_0xd225('0x25')](respondWithFilteredResult(_0x4873d9,_0x4d960f))[_0xd225('0x46')](handleError(_0x4873d9,null));};exports[_0xd225('0x63')]=function(_0x1e35ee,_0x7352b3,_0x5df18f){var _0x585542={};var _0x32afbf={};var _0x7b458e;var _0x943742;return db[_0xd225('0x2e')]['findOne']({'where':{'id':_0x1e35ee['params']['id']}})[_0xd225('0x25')](handleEntityNotFound(_0x7352b3,null))[_0xd225('0x25')](function(_0x3ee54e){if(_0x3ee54e){_0x7b458e=_0x3ee54e;_0x32afbf[_0xd225('0x32')]=_[_0xd225('0x34')](db[_0xd225('0x64')][_0xd225('0x2f')]);_0x32afbf['query']=_['keys'](_0x1e35ee[_0xd225('0x33')]);_0x32afbf[_0xd225('0x35')]=_[_0xd225('0x36')](_0x32afbf[_0xd225('0x32')],_0x32afbf['query']);_0x585542['attributes']=_[_0xd225('0x36')](_0x32afbf[_0xd225('0x32')],qs[_0xd225('0x38')](_0x1e35ee[_0xd225('0x33')]['fields']));_0x585542[_0xd225('0x37')]=_0x585542['attributes'][_0xd225('0x49')]?_0x585542[_0xd225('0x37')]:_0x32afbf[_0xd225('0x32')];_0x585542[_0xd225('0x3a')]=qs[_0xd225('0x3b')](_0x1e35ee['query'][_0xd225('0x3b')]);_0x585542[_0xd225('0x3c')]=qs[_0xd225('0x35')](_[_0xd225('0x3d')](_0x1e35ee[_0xd225('0x33')],_0x32afbf[_0xd225('0x35')]));if(_0x1e35ee[_0xd225('0x33')]['filter']){_0x585542['where']=_[_0xd225('0x3f')](_0x585542[_0xd225('0x3c')],{'$or':_[_0xd225('0x2d')](_0x585542[_0xd225('0x37')],function(_0x22bd90){var _0x23e045={};_0x23e045[_0x22bd90]={'$like':'%'+_0x1e35ee[_0xd225('0x33')][_0xd225('0x3e')]+'%'};return _0x23e045;})});}_0x585542=_[_0xd225('0x3f')]({},_0x585542,_0x1e35ee[_0xd225('0x41')]);return _0x7b458e[_0xd225('0x63')](_0x585542);}})[_0xd225('0x25')](function(_0x514b6c){if(_0x514b6c){_0x943742=_0x514b6c[_0xd225('0x49')];if(!_0x1e35ee[_0xd225('0x33')]['hasOwnProperty'](_0xd225('0x39'))){_0x585542['limit']=qs[_0xd225('0x1e')](_0x1e35ee[_0xd225('0x33')]['limit']);_0x585542[_0xd225('0x1c')]=qs[_0xd225('0x1c')](_0x1e35ee[_0xd225('0x33')][_0xd225('0x1c')]);}return _0x7b458e[_0xd225('0x63')](_0x585542);}})[_0xd225('0x25')](function(_0x137d03){if(_0x137d03){return _0x137d03?{'count':_0x943742,'rows':_0x137d03}:null;}})[_0xd225('0x25')](respondWithResult(_0x7352b3,null))['catch'](handleError(_0x7352b3,null));};exports[_0xd225('0x65')]=function(_0x3eb55e,_0x1a0ac0,_0x1023fd){var _0x173e04,_0x4f5b19;return db[_0xd225('0x2e')][_0xd225('0x4a')]({'where':{'id':_0x3eb55e[_0xd225('0x48')]['id']}})[_0xd225('0x25')](handleEntityNotFound(_0x1a0ac0,null))[_0xd225('0x25')](function(_0x1040ad){if(_0x1040ad){_0x4f5b19=_0x1040ad;return _0x1040ad['addLists'](_0x3eb55e[_0xd225('0x55')][_0xd225('0x66')],_[_0xd225('0x54')](_0x3eb55e[_0xd225('0x55')],['ids','id'])||{});}return null;})['spread'](function(_0x373805){var _0x4e8ec6;_0x173e04=_0x373805||[];var _0x24f4f2=[];if(_0x373805){for(var _0xbd6b58=0x0;_0xbd6b58<_0x373805[_0xd225('0x49')];_0xbd6b58+=0x1){var _0x57d128=_0x373805[_0xbd6b58][_0xd225('0x4d')]({'plain':!![]});_0x4f5b19['dialCheckDuplicateType']=_0x3eb55e[_0xd225('0x55')][_0xd225('0x67')]?_0x3eb55e[_0xd225('0x55')][_0xd225('0x67')]:_0x4f5b19['dialCheckDuplicateType'];switch(_0x4f5b19[_0xd225('0x67')]){case _0xd225('0x68'):_0x4e8ec6=squel[_0xd225('0x69')]()['into'](_0xd225('0x6a'))[_0xd225('0x6b')]([_0xd225('0x6c'),_0xd225('0x6d'),_0xd225('0x6e'),_0xd225('0x6f'),_0xd225('0x5d'),_0xd225('0x56'),_0xd225('0x57')],squel[_0xd225('0x70')]()[_0xd225('0x71')]('phone',_0xd225('0x6c'))[_0xd225('0x71')](_0xd225('0x72'),'scheduledAt')['field']('id','ContactId')['field'](_0x57d128[_0xd225('0x73')][_0xd225('0x74')](),_0xd225('0x6f'))[_0xd225('0x71')](_0x3eb55e[_0xd225('0x48')]['id']['toString'](),'CampaignId')[_0xd225('0x71')](_0xd225('0x72'),_0xd225('0x56'))[_0xd225('0x71')](_0xd225('0x72'),_0xd225('0x57'))[_0xd225('0x75')](_0xd225('0x76'))[_0xd225('0x3c')](_0xd225('0x77'))[_0xd225('0x3c')](_0xd225('0x78'),_0x57d128['CmListId'][_0xd225('0x74')]())[_0xd225('0x3c')](_0xd225('0x79'))[_0xd225('0x3c')](_0xd225('0x7a'),squel[_0xd225('0x70')]()[_0xd225('0x71')](_0xd225('0x7b'))[_0xd225('0x75')](_0xd225('0x7c'))[_0xd225('0x3c')](_0xd225('0x7d'),_0x3eb55e[_0xd225('0x48')]['id'][_0xd225('0x74')]()))[_0xd225('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd225('0x70')]()[_0xd225('0x71')](_0xd225('0x7e'))[_0xd225('0x75')](_0xd225('0x6a'))[_0xd225('0x3c')](_0xd225('0x7d'),_0x3eb55e[_0xd225('0x48')]['id']['toString']())))[_0xd225('0x74')]();break;case _0xd225('0x7f'):_0x4e8ec6=squel[_0xd225('0x69')]()[_0xd225('0x80')](_0xd225('0x6a'))[_0xd225('0x6b')]([_0xd225('0x6c'),_0xd225('0x6d'),_0xd225('0x6e'),_0xd225('0x6f'),'CampaignId',_0xd225('0x56'),'updatedAt'],squel['select']()[_0xd225('0x71')](_0xd225('0x6c'),'phone')[_0xd225('0x71')](_0xd225('0x72'),_0xd225('0x6d'))[_0xd225('0x71')]('id',_0xd225('0x6e'))['field'](_0x57d128[_0xd225('0x73')][_0xd225('0x74')](),'ListId')[_0xd225('0x71')](_0x3eb55e[_0xd225('0x48')]['id']['toString'](),_0xd225('0x5d'))['field'](_0xd225('0x72'),'createdAt')['field'](_0xd225('0x72'),_0xd225('0x57'))[_0xd225('0x75')](_0xd225('0x76'))[_0xd225('0x3c')](_0xd225('0x77'))[_0xd225('0x3c')](_0xd225('0x78'),_0x57d128['CmListId']['toString']())[_0xd225('0x3c')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xd225('0x7a'),squel[_0xd225('0x70')]()[_0xd225('0x71')](_0xd225('0x7e'))[_0xd225('0x75')](_0xd225('0x6a'))[_0xd225('0x3c')](_0xd225('0x7d'),_0x3eb55e[_0xd225('0x48')]['id'][_0xd225('0x74')]())))['toString']();break;default:_0x4e8ec6=squel[_0xd225('0x69')]()['into'](_0xd225('0x6a'))['fromQuery'](['phone','scheduledAt',_0xd225('0x6e'),_0xd225('0x6f'),_0xd225('0x5d'),_0xd225('0x56'),_0xd225('0x57')],squel[_0xd225('0x70')]()[_0xd225('0x71')]('phone',_0xd225('0x6c'))[_0xd225('0x71')](_0xd225('0x72'),_0xd225('0x6d'))[_0xd225('0x71')]('id',_0xd225('0x6e'))[_0xd225('0x71')](_0x57d128['CmListId'][_0xd225('0x74')](),_0xd225('0x6f'))[_0xd225('0x71')](_0x3eb55e[_0xd225('0x48')]['id'][_0xd225('0x74')](),_0xd225('0x5d'))['field'](_0xd225('0x72'),'createdAt')[_0xd225('0x71')]('NOW()','updatedAt')[_0xd225('0x75')](_0xd225('0x76'))['where'](_0xd225('0x77'))[_0xd225('0x3c')]('ListId\x20=\x20?',_0x57d128['CmListId'][_0xd225('0x74')]())[_0xd225('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0xd225('0x74')]();}_0x24f4f2[_0xd225('0x81')](db[_0xd225('0x82')]['query'](_0x4e8ec6));}return BPromise[_0xd225('0x83')](_0x24f4f2);}})[_0xd225('0x25')](function(){return _0x173e04;})[_0xd225('0x25')](respondWithResult(_0x1a0ac0,null))[_0xd225('0x46')](handleError(_0x1a0ac0,null));};exports[_0xd225('0x84')]=function(_0x18c337,_0x9bb7a8,_0xa3edad){return db[_0xd225('0x2e')][_0xd225('0x4a')]({'where':{'id':_0x18c337[_0xd225('0x48')]['id']}})[_0xd225('0x25')](handleEntityNotFound(_0x9bb7a8,null))[_0xd225('0x25')](function(_0x2f1397){if(_0x2f1397){return _0x2f1397[_0xd225('0x84')](_0x18c337[_0xd225('0x33')][_0xd225('0x66')]);}})[_0xd225('0x25')](function(_0x561cec){if(_0x561cec){return db['CmHopper']['destroy']({'where':{'ListId':_0x18c337[_0xd225('0x33')][_0xd225('0x66')],'CampaignId':_0x18c337[_0xd225('0x48')]['id']}})['then'](function(){return _0x561cec;});}})[_0xd225('0x25')](respondWithStatusCode(_0x9bb7a8,null))[_0xd225('0x46')](handleError(_0x9bb7a8,null));};exports['getBlackLists']=function(_0x3397f5,_0x2c432f,_0x1d7d8f){var _0x1d4abb={};var _0x25a330={};var _0x5ea091;var _0x51fd41;return db[_0xd225('0x2e')]['findOne']({'where':{'id':_0x3397f5[_0xd225('0x48')]['id']}})[_0xd225('0x25')](handleEntityNotFound(_0x2c432f,null))['then'](function(_0x500a94){if(_0x500a94){_0x5ea091=_0x500a94;_0x25a330[_0xd225('0x32')]=_[_0xd225('0x34')](db['CmList'][_0xd225('0x2f')]);_0x25a330[_0xd225('0x33')]=_[_0xd225('0x34')](_0x3397f5[_0xd225('0x33')]);_0x25a330[_0xd225('0x35')]=_[_0xd225('0x36')](_0x25a330['model'],_0x25a330[_0xd225('0x33')]);_0x1d4abb['attributes']=_[_0xd225('0x36')](_0x25a330['model'],qs[_0xd225('0x38')](_0x3397f5[_0xd225('0x33')][_0xd225('0x38')]));_0x1d4abb[_0xd225('0x37')]=_0x1d4abb[_0xd225('0x37')][_0xd225('0x49')]?_0x1d4abb['attributes']:_0x25a330[_0xd225('0x32')];_0x1d4abb[_0xd225('0x3a')]=qs['sort'](_0x3397f5[_0xd225('0x33')]['sort']);_0x1d4abb[_0xd225('0x3c')]=qs[_0xd225('0x35')](_[_0xd225('0x3d')](_0x3397f5[_0xd225('0x33')],_0x25a330[_0xd225('0x35')]));if(_0x3397f5[_0xd225('0x33')][_0xd225('0x3e')]){_0x1d4abb[_0xd225('0x3c')]=_[_0xd225('0x3f')](_0x1d4abb[_0xd225('0x3c')],{'$or':_['map'](_0x1d4abb['attributes'],function(_0x9163a){var _0x509fd0={};_0x509fd0[_0x9163a]={'$like':'%'+_0x3397f5[_0xd225('0x33')][_0xd225('0x3e')]+'%'};return _0x509fd0;})});}_0x1d4abb=_[_0xd225('0x3f')]({},_0x1d4abb,_0x3397f5[_0xd225('0x41')]);return _0x5ea091['getBlackLists'](_0x1d4abb);}})['then'](function(_0x581b60){if(_0x581b60){_0x51fd41=_0x581b60[_0xd225('0x49')];if(!_0x3397f5[_0xd225('0x33')][_0xd225('0x5c')](_0xd225('0x39'))){_0x1d4abb[_0xd225('0x1e')]=qs[_0xd225('0x1e')](_0x3397f5[_0xd225('0x33')]['limit']);_0x1d4abb[_0xd225('0x1c')]=qs[_0xd225('0x1c')](_0x3397f5[_0xd225('0x33')]['offset']);}return _0x5ea091[_0xd225('0x85')](_0x1d4abb);}})[_0xd225('0x25')](function(_0x20014f){if(_0x20014f){return _0x20014f?{'count':_0x51fd41,'rows':_0x20014f}:null;}})[_0xd225('0x25')](respondWithResult(_0x2c432f,null))['catch'](handleError(_0x2c432f,null));};exports[_0xd225('0x86')]=function(_0x10f390,_0x15e3be,_0x841de0){var _0x1c470c,_0x2e8daf;return db['Campaign'][_0xd225('0x4a')]({'where':{'id':_0x10f390[_0xd225('0x48')]['id']}})[_0xd225('0x25')](handleEntityNotFound(_0x15e3be,null))[_0xd225('0x25')](function(_0x17ac75){if(_0x17ac75){_0x2e8daf=_0x17ac75;return _0x17ac75[_0xd225('0x86')](_0x10f390['body']['ids'],_['omit'](_0x10f390[_0xd225('0x55')],['ids','id'])||{});}return null;})[_0xd225('0x87')](function(_0x57c1e6){var _0x21186f;_0x1c470c=_0x57c1e6||[];var _0x51393d=[];if(_0x57c1e6){for(var _0x3b857e=0x0;_0x3b857e<_0x57c1e6[_0xd225('0x49')];_0x3b857e+=0x1){var _0x1435b4=_0x57c1e6[_0x3b857e][_0xd225('0x4d')]({'plain':!![]});_0x21186f=squel['insert']()[_0xd225('0x80')](_0xd225('0x88'))[_0xd225('0x6b')]([_0xd225('0x6c'),_0xd225('0x6e'),_0xd225('0x6f'),_0xd225('0x5d'),_0xd225('0x56'),'updatedAt'],squel[_0xd225('0x70')]()[_0xd225('0x71')](_0xd225('0x6c'),'phone')[_0xd225('0x71')]('id','ContactId')[_0xd225('0x71')](_0x1435b4[_0xd225('0x73')][_0xd225('0x74')](),_0xd225('0x6f'))[_0xd225('0x71')](_0x10f390[_0xd225('0x48')]['id']['toString'](),_0xd225('0x5d'))['field']('NOW()',_0xd225('0x56'))[_0xd225('0x71')](_0xd225('0x72'),_0xd225('0x57'))[_0xd225('0x75')](_0xd225('0x76'))[_0xd225('0x3c')](_0xd225('0x77'))[_0xd225('0x3c')](_0xd225('0x78'),_0x1435b4[_0xd225('0x73')]['toString']())[_0xd225('0x3c')](_0xd225('0x79')))[_0xd225('0x74')]();_0x51393d[_0xd225('0x81')](db[_0xd225('0x82')][_0xd225('0x33')](_0x21186f));}return BPromise[_0xd225('0x83')](_0x51393d);}})[_0xd225('0x25')](function(){return _0x1c470c;})[_0xd225('0x25')](respondWithResult(_0x15e3be,null))['catch'](handleError(_0x15e3be,null));};exports['removeBlackLists']=function(_0x38cfdc,_0x40361f,_0x5f0e59){return db[_0xd225('0x2e')][_0xd225('0x4a')]({'where':{'id':_0x38cfdc[_0xd225('0x48')]['id']}})[_0xd225('0x25')](handleEntityNotFound(_0x40361f,null))[_0xd225('0x25')](function(_0x58a5dd){if(_0x58a5dd){return _0x58a5dd['removeBlackLists'](_0x38cfdc['query'][_0xd225('0x66')]);}})[_0xd225('0x25')](function(_0x1f6b24){if(_0x1f6b24){return db[_0xd225('0x62')][_0xd225('0x59')]({'where':{'ListId':_0x38cfdc[_0xd225('0x33')]['ids'],'CampaignId':_0x38cfdc[_0xd225('0x48')]['id']}})[_0xd225('0x25')](function(){return _0x1f6b24;});}})[_0xd225('0x25')](respondWithStatusCode(_0x40361f,null))[_0xd225('0x46')](handleError(_0x40361f,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 6e936d1..14b1b90 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x5224ba,_0x3fb4e1){var _0x459bd2=function(_0x61be43){while(--_0x61be43){_0x5224ba['push'](_0x5224ba['shift']());}};_0x459bd2(++_0x3fb4e1);}(_0x7a54,0x106));var _0x47a5=function(_0x548b37,_0x446e7d){_0x548b37=_0x548b37-0x0;var _0x55020f=_0x7a54[_0x548b37];return _0x55020f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 4953dc0..52679cd 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 _0x544a=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result','GetCampaign','Campaign','findAll','raw','options','limit','model','attributes','include','map','then','debug','catch','lodash','util','moment'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0x544a,0xbd));var _0xa544=function(_0x173512,_0x532bf1){_0x173512=_0x173512-0x0;var _0x1e7ae0=_0x544a[_0x173512];return _0x1e7ae0;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var moment=require(_0xa544('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa544('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa544('0x4'));var logger=require(_0xa544('0x5'))('rpc');var config=require(_0xa544('0x6'));var jayson=require(_0xa544('0x7'));var client=jayson[_0xa544('0x8')][_0xa544('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39caac,_0x543cd1,_0x407443){return new BPromise(function(_0x495819,_0x39bcd7){return client[_0xa544('0xa')](_0x39caac,_0x407443)['then'](function(_0x2e9a6a){logger[_0xa544('0xb')](_0xa544('0xc'),_0x543cd1,_0xa544('0xd'));logger['debug'](_0xa544('0xe'),_0x543cd1,_0xa544('0xd'),JSON['stringify'](_0x2e9a6a));if(_0x2e9a6a[_0xa544('0xf')]){if(_0x2e9a6a['error'][_0xa544('0x10')]===0x1f4){logger[_0xa544('0xf')]('Campaign,\x20%s,\x20%s',_0x543cd1,_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);return _0x39bcd7(_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);}logger[_0xa544('0xf')](_0xa544('0xc'),_0x543cd1,_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);return _0x495819(_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);}else{logger[_0xa544('0xb')](_0xa544('0xc'),_0x543cd1,'request\x20sent');_0x495819(_0x2e9a6a[_0xa544('0x12')][_0xa544('0x11')]);}})['catch'](function(_0x9093bd){logger[_0xa544('0xf')](_0xa544('0xc'),_0x543cd1,_0x9093bd);_0x39bcd7(_0x9093bd);});});}exports[_0xa544('0x13')]=function(_0x2c5ae8){var _0x297298=this;return new Promise(function(_0x1f3fcc,_0x44ccd3){return db[_0xa544('0x14')][_0xa544('0x15')]({'raw':_0x2c5ae8['options']?_0x2c5ae8['options'][_0xa544('0x16')]===undefined?!![]:![]:!![],'where':_0x2c5ae8[_0xa544('0x17')]?_0x2c5ae8[_0xa544('0x17')]['where']||null:null,'attributes':_0x2c5ae8[_0xa544('0x17')]?_0x2c5ae8[_0xa544('0x17')]['attributes']||null:null,'limit':_0x2c5ae8[_0xa544('0x17')]?_0x2c5ae8[_0xa544('0x17')][_0xa544('0x18')]||null:null,'include':_0x2c5ae8[_0xa544('0x17')]?_0x2c5ae8[_0xa544('0x17')]['include']?_['map'](_0x2c5ae8[_0xa544('0x17')]['include'],function(_0x407a61){return{'model':db[_0x407a61[_0xa544('0x19')]],'as':_0x407a61['as'],'attributes':_0x407a61[_0xa544('0x1a')],'include':_0x407a61[_0xa544('0x1b')]?_[_0xa544('0x1c')](_0x407a61[_0xa544('0x1b')],function(_0xcd7bfa){return{'model':db[_0xcd7bfa[_0xa544('0x19')]],'as':_0xcd7bfa['as'],'attributes':_0xcd7bfa[_0xa544('0x1a')],'include':_0xcd7bfa['include']?_[_0xa544('0x1c')](_0xcd7bfa[_0xa544('0x1b')],function(_0x578483){return{'model':db[_0x578483[_0xa544('0x19')]],'as':_0x578483['as'],'attributes':_0x578483[_0xa544('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa544('0x1d')](function(_0x4fdf9e){logger[_0xa544('0xb')](_0xa544('0x13'),_0x2c5ae8);logger[_0xa544('0x1e')](_0xa544('0x13'),_0x2c5ae8,JSON['stringify'](_0x4fdf9e));_0x1f3fcc(_0x4fdf9e);})[_0xa544('0x1f')](function(_0x290c45){logger[_0xa544('0xf')]('GetCampaign',_0x290c45[_0xa544('0x11')],_0x2c5ae8);_0x44ccd3(_0x297298[_0xa544('0xf')](0x1f4,_0x290c45['message']));});});}; \ No newline at end of file +var _0x7794=['include','map','model','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','http','request','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign','findAll','options','where','attributes'];(function(_0xf32434,_0x54fb6){var _0x42f2e8=function(_0x399198){while(--_0x399198){_0xf32434['push'](_0xf32434['shift']());}};_0x42f2e8(++_0x54fb6);}(_0x7794,0x7b));var _0x4779=function(_0xe4495c,_0x4b8f3b){_0xe4495c=_0xe4495c-0x0;var _0x123bb5=_0x7794[_0xe4495c];return _0x123bb5;};'use strict';var _=require('lodash');var util=require(_0x4779('0x0'));var moment=require(_0x4779('0x1'));var BPromise=require(_0x4779('0x2'));var rs=require(_0x4779('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4779('0x4'))['db'];var utils=require(_0x4779('0x5'));var logger=require('../../config/logger')(_0x4779('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4779('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x339512,_0x523c93,_0xb3fe18){return new BPromise(function(_0x13bb66,_0x270a5f){return client[_0x4779('0x8')](_0x339512,_0xb3fe18)[_0x4779('0x9')](function(_0x7179e1){logger[_0x4779('0xa')]('Campaign,\x20%s,\x20%s',_0x523c93,_0x4779('0xb'));logger[_0x4779('0xc')](_0x4779('0xd'),_0x523c93,_0x4779('0xb'),JSON[_0x4779('0xe')](_0x7179e1));if(_0x7179e1[_0x4779('0xf')]){if(_0x7179e1[_0x4779('0xf')][_0x4779('0x10')]===0x1f4){logger[_0x4779('0xf')](_0x4779('0x11'),_0x523c93,_0x7179e1['error']['message']);return _0x270a5f(_0x7179e1['error'][_0x4779('0x12')]);}logger[_0x4779('0xf')](_0x4779('0x11'),_0x523c93,_0x7179e1[_0x4779('0xf')]['message']);return _0x13bb66(_0x7179e1[_0x4779('0xf')][_0x4779('0x12')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x523c93,_0x4779('0xb'));_0x13bb66(_0x7179e1[_0x4779('0x13')][_0x4779('0x12')]);}})[_0x4779('0x14')](function(_0x56ec51){logger['error'](_0x4779('0x11'),_0x523c93,_0x56ec51);_0x270a5f(_0x56ec51);});});}exports[_0x4779('0x15')]=function(_0x19fbb6){var _0x582e89=this;return new Promise(function(_0x3dbe70,_0x5d9a58){return db[_0x4779('0x16')][_0x4779('0x17')]({'raw':_0x19fbb6['options']?_0x19fbb6[_0x4779('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x19fbb6[_0x4779('0x18')]?_0x19fbb6[_0x4779('0x18')][_0x4779('0x19')]||null:null,'attributes':_0x19fbb6[_0x4779('0x18')]?_0x19fbb6[_0x4779('0x18')][_0x4779('0x1a')]||null:null,'limit':_0x19fbb6['options']?_0x19fbb6[_0x4779('0x18')]['limit']||null:null,'include':_0x19fbb6['options']?_0x19fbb6[_0x4779('0x18')][_0x4779('0x1b')]?_[_0x4779('0x1c')](_0x19fbb6[_0x4779('0x18')]['include'],function(_0x152887){return{'model':db[_0x152887[_0x4779('0x1d')]],'as':_0x152887['as'],'attributes':_0x152887[_0x4779('0x1a')],'include':_0x152887['include']?_[_0x4779('0x1c')](_0x152887[_0x4779('0x1b')],function(_0x577b13){return{'model':db[_0x577b13[_0x4779('0x1d')]],'as':_0x577b13['as'],'attributes':_0x577b13[_0x4779('0x1a')],'include':_0x577b13['include']?_[_0x4779('0x1c')](_0x577b13[_0x4779('0x1b')],function(_0x211af1){return{'model':db[_0x211af1[_0x4779('0x1d')]],'as':_0x211af1['as'],'attributes':_0x211af1[_0x4779('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4779('0x9')](function(_0xeb1850){logger[_0x4779('0xa')]('GetCampaign',_0x19fbb6);logger[_0x4779('0xc')](_0x4779('0x15'),_0x19fbb6,JSON[_0x4779('0xe')](_0xeb1850));_0x3dbe70(_0xeb1850);})[_0x4779('0x14')](function(_0x8b4c42){logger[_0x4779('0xf')](_0x4779('0x15'),_0x8b4c42[_0x4779('0x12')],_0x19fbb6);_0x5d9a58(_0x582e89['error'](0x1f4,_0x8b4c42['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 42044d3..7c9bde2 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 _0xf44c=['addLists','addBlackLists','put','delete','destroy','removeBlackLists','exports','multer','path','connect-timeout','express','Router','fs-extra','isAuthenticated','index','get','/:id','show','getHoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0xf44c,0x163));var _0xcf44=function(_0x4c8403,_0x1bfb0b){_0x4c8403=_0x4c8403-0x0;var _0x4fc19e=_0xf44c[_0x4c8403];return _0x4fc19e;};'use strict';var multer=require(_0xcf44('0x0'));var util=require('util');var path=require(_0xcf44('0x1'));var timeout=require(_0xcf44('0x2'));var express=require(_0xcf44('0x3'));var router=express[_0xcf44('0x4')]();var fs_extra=require(_0xcf44('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./campaign.controller');router['get']('/',auth[_0xcf44('0x6')](),controller[_0xcf44('0x7')]);router[_0xcf44('0x8')](_0xcf44('0x9'),auth[_0xcf44('0x6')](),controller[_0xcf44('0xa')]);router[_0xcf44('0x8')]('/:id/hoppers',auth[_0xcf44('0x6')](),controller[_0xcf44('0xb')]);router[_0xcf44('0x8')]('/:id/hopper_histories',auth[_0xcf44('0x6')](),controller[_0xcf44('0xc')]);router[_0xcf44('0x8')](_0xcf44('0xd'),auth[_0xcf44('0x6')](),controller['getHopperFinals']);router['get'](_0xcf44('0xe'),auth[_0xcf44('0x6')](),controller[_0xcf44('0xf')]);router['get'](_0xcf44('0x10'),auth['isAuthenticated'](),controller['getLists']);router[_0xcf44('0x8')](_0xcf44('0x11'),auth[_0xcf44('0x6')](),controller[_0xcf44('0x12')]);router[_0xcf44('0x13')]('/',auth[_0xcf44('0x6')](),controller[_0xcf44('0x14')]);router[_0xcf44('0x13')](_0xcf44('0x15'),auth['isAuthenticated'](),controller['clone']);router[_0xcf44('0x13')]('/:id/lists',auth[_0xcf44('0x6')](),controller[_0xcf44('0x16')]);router[_0xcf44('0x13')]('/:id/blacklists',auth[_0xcf44('0x6')](),controller[_0xcf44('0x17')]);router[_0xcf44('0x18')](_0xcf44('0x9'),auth[_0xcf44('0x6')](),controller['update']);router[_0xcf44('0x19')](_0xcf44('0x9'),auth[_0xcf44('0x6')](),controller[_0xcf44('0x1a')]);router[_0xcf44('0x19')]('/:id/lists',auth[_0xcf44('0x6')](),controller['removeLists']);router[_0xcf44('0x19')](_0xcf44('0x11'),auth[_0xcf44('0x6')](),controller[_0xcf44('0x1b')]);module[_0xcf44('0x1c')]=router; \ No newline at end of file +var _0x3de8=['getBlackLists','post','/:id/clone','clone','addLists','addBlackLists','update','delete','removeBlackLists','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists'];(function(_0x302d0b,_0x2c7dbb){var _0x3b9e1d=function(_0x598beb){while(--_0x598beb){_0x302d0b['push'](_0x302d0b['shift']());}};_0x3b9e1d(++_0x2c7dbb);}(_0x3de8,0xe9));var _0x83de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3de8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x83de('0x0'));var util=require(_0x83de('0x1'));var path=require('path');var timeout=require(_0x83de('0x2'));var express=require(_0x83de('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x83de('0x4'));var config=require(_0x83de('0x5'));var controller=require(_0x83de('0x6'));router[_0x83de('0x7')]('/',auth[_0x83de('0x8')](),controller['index']);router[_0x83de('0x7')](_0x83de('0x9'),auth[_0x83de('0x8')](),controller['show']);router['get'](_0x83de('0xa'),auth[_0x83de('0x8')](),controller['getHoppers']);router['get'](_0x83de('0xb'),auth[_0x83de('0x8')](),controller[_0x83de('0xc')]);router[_0x83de('0x7')](_0x83de('0xd'),auth[_0x83de('0x8')](),controller['getHopperFinals']);router[_0x83de('0x7')](_0x83de('0xe'),auth['isAuthenticated'](),controller[_0x83de('0xf')]);router[_0x83de('0x7')](_0x83de('0x10'),auth['isAuthenticated'](),controller[_0x83de('0x11')]);router['get'](_0x83de('0x12'),auth['isAuthenticated'](),controller[_0x83de('0x13')]);router[_0x83de('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x83de('0x14')](_0x83de('0x15'),auth['isAuthenticated'](),controller[_0x83de('0x16')]);router['post']('/:id/lists',auth[_0x83de('0x8')](),controller[_0x83de('0x17')]);router['post'](_0x83de('0x12'),auth['isAuthenticated'](),controller[_0x83de('0x18')]);router['put'](_0x83de('0x9'),auth[_0x83de('0x8')](),controller[_0x83de('0x19')]);router[_0x83de('0x1a')](_0x83de('0x9'),auth[_0x83de('0x8')](),controller['destroy']);router[_0x83de('0x1a')](_0x83de('0x10'),auth[_0x83de('0x8')](),controller['removeLists']);router['delete'](_0x83de('0x12'),auth[_0x83de('0x8')](),controller[_0x83de('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index d6ba345..eb9cb0f 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 _0x8596=['getDataValue','key','sequelize','exports','STRING','VIRTUAL'];(function(_0x3edec5,_0x41c2ff){var _0x21d1ab=function(_0x4cc96b){while(--_0x4cc96b){_0x3edec5['push'](_0x3edec5['shift']());}};_0x21d1ab(++_0x41c2ff);}(_0x8596,0x1be));var _0x6859=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x8596[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x6859('0x0'));module[_0x6859('0x1')]={'key':{'type':Sequelize[_0x6859('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x6859('0x2')]},'name':{'type':Sequelize[_0x6859('0x3')],'get':function(){return this[_0x6859('0x4')](_0x6859('0x5'));}}}; \ No newline at end of file +var _0x23f2=['STRING','TEXT','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0x4eafb7,_0x57c2f8){var _0x9cdbab=function(_0x23ef96){while(--_0x23ef96){_0x4eafb7['push'](_0x4eafb7['shift']());}};_0x9cdbab(++_0x57c2f8);}(_0x23f2,0x194));var _0x223f=function(_0x486668,_0x3931e1){_0x486668=_0x486668-0x0;var _0x5eb501=_0x23f2[_0x486668];return _0x5eb501;};'use strict';var Sequelize=require(_0x223f('0x0'));module[_0x223f('0x1')]={'key':{'type':Sequelize[_0x223f('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x223f('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x223f('0x2')]},'name':{'type':Sequelize[_0x223f('0x4')],'get':function(){return this[_0x223f('0x5')](_0x223f('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 8b54704..a13068d 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 _0xcf9d=['SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','crypto','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','CannedAnswers','UserProfileResource','end','error','name','send','map','CannedAnswer','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','update','body','create','key','MailAccountId'];(function(_0x5c38d6,_0xd8577){var _0x1fa864=function(_0x39c33d){while(--_0x39c33d){_0x5c38d6['push'](_0x5c38d6['shift']());}};_0x1fa864(++_0xd8577);}(_0xcf9d,0x105));var _0xdcf9=function(_0x27e147,_0x4ce2c5){_0x27e147=_0x27e147-0x0;var _0x3a3b5f=_0xcf9d[_0x27e147];return _0x3a3b5f;};'use strict';var emlformat=require(_0xdcf9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdcf9('0x1'));var jsonpatch=require(_0xdcf9('0x2'));var rp=require(_0xdcf9('0x3'));var moment=require(_0xdcf9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdcf9('0x5'));var path=require(_0xdcf9('0x6'));var sox=require(_0xdcf9('0x7'));var csv=require('to-csv');var ejs=require(_0xdcf9('0x8'));var fs=require('fs');var fs_extra=require(_0xdcf9('0x9'));var _=require(_0xdcf9('0xa'));var squel=require('squel');var crypto=require(_0xdcf9('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdcf9('0xc'));var authService=require(_0xdcf9('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xdcf9('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdcf9('0xf'))(_0xdcf9('0x10'));var utils=require(_0xdcf9('0x11'));var config=require(_0xdcf9('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xdcf9('0x13'))['db'];function respondWithStatusCode(_0x420e28,_0x2dff90){_0x2dff90=_0x2dff90||0xcc;return function(_0x4dc666){if(_0x4dc666){return _0x420e28[_0xdcf9('0x14')](_0x2dff90);}return _0x420e28[_0xdcf9('0x15')](_0x2dff90)['end']();};}function respondWithResult(_0x224d9f,_0x499260){_0x499260=_0x499260||0xc8;return function(_0xe8fbfd){if(_0xe8fbfd){return _0x224d9f[_0xdcf9('0x15')](_0x499260)[_0xdcf9('0x16')](_0xe8fbfd);}};}function respondWithFilteredResult(_0x151ed8,_0x52222a){return function(_0x123a41){if(_0x123a41){var _0xaa6d18=typeof _0x52222a[_0xdcf9('0x17')]===_0xdcf9('0x18')&&typeof _0x52222a[_0xdcf9('0x19')]==='undefined';var _0x4995bb=_0x123a41[_0xdcf9('0x1a')];var _0x1a14a6=_0xaa6d18?0x0:_0x52222a[_0xdcf9('0x17')];var _0x1b46e9=_0xaa6d18?_0x123a41['count']:_0x52222a[_0xdcf9('0x17')]+_0x52222a['limit'];var _0x4cc062;if(_0x1b46e9>=_0x4995bb){_0x1b46e9=_0x4995bb;_0x4cc062=0xc8;}else{_0x4cc062=0xce;}_0x151ed8[_0xdcf9('0x15')](_0x4cc062);return _0x151ed8[_0xdcf9('0x1b')](_0xdcf9('0x1c'),_0x1a14a6+'-'+_0x1b46e9+'/'+_0x4995bb)[_0xdcf9('0x16')](_0x123a41);}return null;};}function patchUpdates(_0x594258){return function(_0x40f8c6){try{jsonpatch[_0xdcf9('0x1d')](_0x40f8c6,_0x594258,!![]);}catch(_0xd98226){return BPromise['reject'](_0xd98226);}return _0x40f8c6[_0xdcf9('0x1e')]();};}function saveUpdates(_0x17d701,_0x9a7dc8){return function(_0x542c06){if(_0x542c06){return _0x542c06['update'](_0x17d701)[_0xdcf9('0x1f')](function(_0x13d818){return _0x13d818;});}return null;};}function removeEntity(_0x2e5199,_0x112a33){return function(_0x30ce20){if(_0x30ce20){return _0x30ce20[_0xdcf9('0x20')]()[_0xdcf9('0x1f')](function(){var _0x1ac563=_0x30ce20[_0xdcf9('0x21')]({'plain':!![]});var _0x92acc3=_0xdcf9('0x22');return db[_0xdcf9('0x23')][_0xdcf9('0x20')]({'where':{'type':_0x92acc3,'resourceId':_0x1ac563['id']}})[_0xdcf9('0x1f')](function(){return _0x30ce20;});})['then'](function(){_0x2e5199[_0xdcf9('0x15')](0xcc)[_0xdcf9('0x24')]();});}};}function handleEntityNotFound(_0x38d5c2,_0x8b070){return function(_0x23fcf4){if(!_0x23fcf4){_0x38d5c2[_0xdcf9('0x14')](0x194);}return _0x23fcf4;};}function handleError(_0x4ad97a,_0x1b5ef5){_0x1b5ef5=_0x1b5ef5||0x1f4;return function(_0x1c29af){logger[_0xdcf9('0x25')](_0x1c29af['stack']);if(_0x1c29af[_0xdcf9('0x26')]){delete _0x1c29af['name'];}_0x4ad97a[_0xdcf9('0x15')](_0x1b5ef5)[_0xdcf9('0x27')](_0x1c29af);};}exports['index']=function(_0x46d93f,_0x173b20){var _0x4407b1={},_0xc402c8={},_0x39c985={'count':0x0,'rows':[]};var _0x3c05ca=_[_0xdcf9('0x28')](db[_0xdcf9('0x29')][_0xdcf9('0x2a')],function(_0x502b99){return{'name':_0x502b99[_0xdcf9('0x2b')],'type':_0x502b99[_0xdcf9('0x2c')]['key']};});_0xc402c8[_0xdcf9('0x2d')]=_[_0xdcf9('0x28')](_0x3c05ca,'name');_0xc402c8[_0xdcf9('0x2e')]=_[_0xdcf9('0x2f')](_0x46d93f[_0xdcf9('0x2e')]);_0xc402c8[_0xdcf9('0x30')]=_[_0xdcf9('0x31')](_0xc402c8['model'],_0xc402c8['query']);_0x4407b1['attributes']=_[_0xdcf9('0x31')](_0xc402c8['model'],qs[_0xdcf9('0x32')](_0x46d93f[_0xdcf9('0x2e')][_0xdcf9('0x32')]));_0x4407b1['attributes']=_0x4407b1[_0xdcf9('0x33')][_0xdcf9('0x34')]?_0x4407b1[_0xdcf9('0x33')]:_0xc402c8['model'];if(!_0x46d93f[_0xdcf9('0x2e')][_0xdcf9('0x35')]('nolimit')){_0x4407b1[_0xdcf9('0x19')]=qs[_0xdcf9('0x19')](_0x46d93f['query'][_0xdcf9('0x19')]);_0x4407b1[_0xdcf9('0x17')]=qs[_0xdcf9('0x17')](_0x46d93f[_0xdcf9('0x2e')]['offset']);}_0x4407b1['order']=qs['sort'](_0x46d93f[_0xdcf9('0x2e')]['sort']);_0x4407b1['where']=qs[_0xdcf9('0x30')](_[_0xdcf9('0x36')](_0x46d93f[_0xdcf9('0x2e')],_0xc402c8[_0xdcf9('0x30')]),_0x3c05ca);if(_0x46d93f[_0xdcf9('0x2e')][_0xdcf9('0x37')]){_0x4407b1[_0xdcf9('0x38')]=_[_0xdcf9('0x39')](_0x4407b1['where'],{'$or':[{'key':{'$like':'%'+_0x46d93f[_0xdcf9('0x2e')][_0xdcf9('0x37')]+'%'}},{'value':{'$like':'%'+_0x46d93f[_0xdcf9('0x2e')][_0xdcf9('0x37')]+'%'}}]});}_0x4407b1=_[_0xdcf9('0x39')]({},_0x4407b1,_0x46d93f[_0xdcf9('0x3a')]);var _0x32ecff={'where':_0x4407b1['where']};return db[_0xdcf9('0x29')][_0xdcf9('0x1a')](_0x32ecff)[_0xdcf9('0x1f')](function(_0x57a9bf){_0x39c985[_0xdcf9('0x1a')]=_0x57a9bf;if(_0x46d93f[_0xdcf9('0x2e')][_0xdcf9('0x3b')]){_0x4407b1[_0xdcf9('0x3c')]=[{'all':!![]}];}return db['CannedAnswer'][_0xdcf9('0x3d')](_0x4407b1);})[_0xdcf9('0x1f')](function(_0x1de701){_0x39c985[_0xdcf9('0x3e')]=_0x1de701;return _0x39c985;})['then'](respondWithFilteredResult(_0x173b20,_0x4407b1))[_0xdcf9('0x3f')](handleError(_0x173b20,null));};exports['show']=function(_0x5c1360,_0x1310d5){var _0x2bdcd6={'raw':!![],'where':{'id':_0x5c1360[_0xdcf9('0x40')]['id']}},_0x41cbd8={};_0x41cbd8[_0xdcf9('0x2d')]=_[_0xdcf9('0x2f')](db[_0xdcf9('0x29')][_0xdcf9('0x2a')]);_0x41cbd8[_0xdcf9('0x2e')]=_['keys'](_0x5c1360[_0xdcf9('0x2e')]);_0x41cbd8[_0xdcf9('0x30')]=_[_0xdcf9('0x31')](_0x41cbd8[_0xdcf9('0x2d')],_0x41cbd8['query']);_0x2bdcd6['attributes']=_[_0xdcf9('0x31')](_0x41cbd8[_0xdcf9('0x2d')],qs[_0xdcf9('0x32')](_0x5c1360[_0xdcf9('0x2e')][_0xdcf9('0x32')]));_0x2bdcd6[_0xdcf9('0x33')]=_0x2bdcd6[_0xdcf9('0x33')][_0xdcf9('0x34')]?_0x2bdcd6['attributes']:_0x41cbd8['model'];if(_0x5c1360[_0xdcf9('0x2e')][_0xdcf9('0x3b')]){_0x2bdcd6[_0xdcf9('0x3c')]=[{'all':!![]}];}_0x2bdcd6=_[_0xdcf9('0x39')]({},_0x2bdcd6,_0x5c1360[_0xdcf9('0x3a')]);return db[_0xdcf9('0x29')][_0xdcf9('0x41')](_0x2bdcd6)[_0xdcf9('0x1f')](handleEntityNotFound(_0x1310d5,null))[_0xdcf9('0x1f')](respondWithResult(_0x1310d5,null))[_0xdcf9('0x3f')](handleError(_0x1310d5,null));};exports[_0xdcf9('0x42')]=function(_0x4fc71d,_0x354b85){if(_0x4fc71d[_0xdcf9('0x43')]['id']){delete _0x4fc71d[_0xdcf9('0x43')]['id'];}return db[_0xdcf9('0x29')][_0xdcf9('0x41')]({'where':{'id':_0x4fc71d['params']['id']}})[_0xdcf9('0x1f')](handleEntityNotFound(_0x354b85,null))['then'](saveUpdates(_0x4fc71d[_0xdcf9('0x43')],null))['then'](respondWithResult(_0x354b85,null))[_0xdcf9('0x3f')](handleError(_0x354b85,null));};exports[_0xdcf9('0x20')]=function(_0x2da8f9,_0x2165bc){return db[_0xdcf9('0x29')]['find']({'where':{'id':_0x2da8f9[_0xdcf9('0x40')]['id']}})[_0xdcf9('0x1f')](handleEntityNotFound(_0x2165bc,null))[_0xdcf9('0x1f')](removeEntity(_0x2165bc,null))[_0xdcf9('0x3f')](handleError(_0x2165bc,null));};exports[_0xdcf9('0x44')]=function(_0x42d356,_0x19663c){var _0x4e8154={'key':_0x42d356[_0xdcf9('0x43')][_0xdcf9('0x45')]};if(_0x42d356[_0xdcf9('0x43')][_0xdcf9('0x46')]){_0x4e8154['MailAccountId']=_0x42d356[_0xdcf9('0x43')][_0xdcf9('0x46')];}else if(_0x42d356[_0xdcf9('0x43')]['SmsAccountId']){_0x4e8154[_0xdcf9('0x47')]=_0x42d356[_0xdcf9('0x43')][_0xdcf9('0x47')];}else if(_0x42d356[_0xdcf9('0x43')]['OpenchannelAccountId']){_0x4e8154['OpenchannelAccountId']=_0x42d356[_0xdcf9('0x43')][_0xdcf9('0x48')];}else if(_0x42d356[_0xdcf9('0x43')][_0xdcf9('0x49')]){_0x4e8154[_0xdcf9('0x49')]=_0x42d356['body'][_0xdcf9('0x49')];}return db['CannedAnswer'][_0xdcf9('0x41')]({'where':_0x4e8154})[_0xdcf9('0x1f')](function(_0x215bd5){if(_0x215bd5){throw new db[(_0xdcf9('0x4a'))][(_0xdcf9('0x4b'))](_0xdcf9('0x4c'));}return db[_0xdcf9('0x29')]['create'](_0x42d356[_0xdcf9('0x43')]);})['then'](function(_0x27cc24){var _0xbbfaed=_0x42d356[_0xdcf9('0x4d')]['get']({'plain':!![]});if(!_0xbbfaed)throw new Error(_0xdcf9('0x4e'));if(_0xbbfaed[_0xdcf9('0x4f')]===_0xdcf9('0x4d')){var _0x2378c8=_0x27cc24[_0xdcf9('0x21')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xdcf9('0x22'),'userProfileId':_0xbbfaed[_0xdcf9('0x50')]},'raw':!![]})[_0xdcf9('0x1f')](function(_0x422498){if(_0x422498&&_0x422498[_0xdcf9('0x51')]===0x0){return db[_0xdcf9('0x23')][_0xdcf9('0x44')]({'name':_0x2378c8[_0xdcf9('0x26')],'resourceId':_0x2378c8['id'],'type':_0x422498['name'],'sectionId':_0x422498['id']},{})[_0xdcf9('0x1f')](function(){return _0x27cc24;});}else{return _0x27cc24;}})[_0xdcf9('0x3f')](function(_0x34398c){logger[_0xdcf9('0x25')](_0xdcf9('0x52'),_0x34398c);throw _0x34398c;});}return _0x27cc24;})[_0xdcf9('0x1f')](respondWithResult(_0x19663c,0xc9))[_0xdcf9('0x3f')](handleError(_0x19663c,null));}; \ No newline at end of file +var _0x60e3=['../../mysqldb','status','offset','limit','count','Content-Range','json','apply','reject','save','then','destroy','CannedAnswers','end','sendStatus','error','name','send','index','map','CannedAnswer','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','fields','find','update','body','params','MailAccountId','ChatWebsiteId','Sequelize','ValidationError','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x3a1dab,_0xb44f93){var _0x568728=function(_0x17bfe9){while(--_0x17bfe9){_0x3a1dab['push'](_0x3a1dab['shift']());}};_0x568728(++_0xb44f93);}(_0x60e3,0x14d));var _0x360e=function(_0x25d3c7,_0x2b0510){_0x25d3c7=_0x25d3c7-0x0;var _0x312806=_0x60e3[_0x25d3c7];return _0x312806;};'use strict';var emlformat=require(_0x360e('0x0'));var rimraf=require(_0x360e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x360e('0x2'));var rp=require(_0x360e('0x3'));var moment=require(_0x360e('0x4'));var BPromise=require(_0x360e('0x5'));var Mustache=require('mustache');var util=require(_0x360e('0x6'));var path=require(_0x360e('0x7'));var sox=require(_0x360e('0x8'));var csv=require(_0x360e('0x9'));var ejs=require(_0x360e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x360e('0xb'));var squel=require(_0x360e('0xc'));var crypto=require(_0x360e('0xd'));var jsforce=require(_0x360e('0xe'));var deskjs=require(_0x360e('0xf'));var toCsv=require(_0x360e('0x9'));var querystring=require(_0x360e('0x10'));var Papa=require(_0x360e('0x11'));var Redis=require(_0x360e('0x12'));var authService=require(_0x360e('0x13'));var qs=require(_0x360e('0x14'));var as=require(_0x360e('0x15'));var hardwareService=require(_0x360e('0x16'));var logger=require(_0x360e('0x17'))(_0x360e('0x18'));var utils=require('../../config/utils');var config=require(_0x360e('0x19'));var licenseUtil=require(_0x360e('0x1a'));var db=require(_0x360e('0x1b'))['db'];function respondWithStatusCode(_0x5eecd5,_0x424418){_0x424418=_0x424418||0xcc;return function(_0x38ea37){if(_0x38ea37){return _0x5eecd5['sendStatus'](_0x424418);}return _0x5eecd5[_0x360e('0x1c')](_0x424418)['end']();};}function respondWithResult(_0x3afffa,_0x1785a7){_0x1785a7=_0x1785a7||0xc8;return function(_0x5dbf85){if(_0x5dbf85){return _0x3afffa[_0x360e('0x1c')](_0x1785a7)['json'](_0x5dbf85);}};}function respondWithFilteredResult(_0x9feacb,_0x4bc900){return function(_0xd96ca9){if(_0xd96ca9){var _0x3c6503=typeof _0x4bc900[_0x360e('0x1d')]==='undefined'&&typeof _0x4bc900[_0x360e('0x1e')]==='undefined';var _0x2386be=_0xd96ca9[_0x360e('0x1f')];var _0x291bf3=_0x3c6503?0x0:_0x4bc900[_0x360e('0x1d')];var _0x38af22=_0x3c6503?_0xd96ca9[_0x360e('0x1f')]:_0x4bc900[_0x360e('0x1d')]+_0x4bc900[_0x360e('0x1e')];var _0x5a09e2;if(_0x38af22>=_0x2386be){_0x38af22=_0x2386be;_0x5a09e2=0xc8;}else{_0x5a09e2=0xce;}_0x9feacb[_0x360e('0x1c')](_0x5a09e2);return _0x9feacb['set'](_0x360e('0x20'),_0x291bf3+'-'+_0x38af22+'/'+_0x2386be)[_0x360e('0x21')](_0xd96ca9);}return null;};}function patchUpdates(_0x165c2a){return function(_0x4f8f4e){try{jsonpatch[_0x360e('0x22')](_0x4f8f4e,_0x165c2a,!![]);}catch(_0x2f3ada){return BPromise[_0x360e('0x23')](_0x2f3ada);}return _0x4f8f4e[_0x360e('0x24')]();};}function saveUpdates(_0x433c96,_0x20ac0b){return function(_0x387d4b){if(_0x387d4b){return _0x387d4b['update'](_0x433c96)[_0x360e('0x25')](function(_0x56d26b){return _0x56d26b;});}return null;};}function removeEntity(_0x31aeeb,_0x36addd){return function(_0x237a33){if(_0x237a33){return _0x237a33[_0x360e('0x26')]()[_0x360e('0x25')](function(){var _0x1dbe08=_0x237a33['get']({'plain':!![]});var _0x4e1c00=_0x360e('0x27');return db['UserProfileResource'][_0x360e('0x26')]({'where':{'type':_0x4e1c00,'resourceId':_0x1dbe08['id']}})[_0x360e('0x25')](function(){return _0x237a33;});})[_0x360e('0x25')](function(){_0x31aeeb[_0x360e('0x1c')](0xcc)[_0x360e('0x28')]();});}};}function handleEntityNotFound(_0x4f1115,_0x2272d8){return function(_0x158eb0){if(!_0x158eb0){_0x4f1115[_0x360e('0x29')](0x194);}return _0x158eb0;};}function handleError(_0x140666,_0x39bd40){_0x39bd40=_0x39bd40||0x1f4;return function(_0x5264bc){logger[_0x360e('0x2a')](_0x5264bc['stack']);if(_0x5264bc[_0x360e('0x2b')]){delete _0x5264bc[_0x360e('0x2b')];}_0x140666[_0x360e('0x1c')](_0x39bd40)[_0x360e('0x2c')](_0x5264bc);};}exports[_0x360e('0x2d')]=function(_0x313c9c,_0x5d1509){var _0x5eadeb={},_0x331f51={},_0x100309={'count':0x0,'rows':[]};var _0x309426=_[_0x360e('0x2e')](db[_0x360e('0x2f')][_0x360e('0x30')],function(_0x1f320e){return{'name':_0x1f320e[_0x360e('0x31')],'type':_0x1f320e['type'][_0x360e('0x32')]};});_0x331f51['model']=_[_0x360e('0x2e')](_0x309426,'name');_0x331f51[_0x360e('0x33')]=_[_0x360e('0x34')](_0x313c9c['query']);_0x331f51[_0x360e('0x35')]=_[_0x360e('0x36')](_0x331f51[_0x360e('0x37')],_0x331f51['query']);_0x5eadeb['attributes']=_[_0x360e('0x36')](_0x331f51[_0x360e('0x37')],qs['fields'](_0x313c9c['query']['fields']));_0x5eadeb[_0x360e('0x38')]=_0x5eadeb[_0x360e('0x38')][_0x360e('0x39')]?_0x5eadeb[_0x360e('0x38')]:_0x331f51['model'];if(!_0x313c9c[_0x360e('0x33')][_0x360e('0x3a')](_0x360e('0x3b'))){_0x5eadeb[_0x360e('0x1e')]=qs[_0x360e('0x1e')](_0x313c9c['query'][_0x360e('0x1e')]);_0x5eadeb[_0x360e('0x1d')]=qs['offset'](_0x313c9c[_0x360e('0x33')][_0x360e('0x1d')]);}_0x5eadeb[_0x360e('0x3c')]=qs[_0x360e('0x3d')](_0x313c9c[_0x360e('0x33')]['sort']);_0x5eadeb[_0x360e('0x3e')]=qs[_0x360e('0x35')](_['pick'](_0x313c9c['query'],_0x331f51[_0x360e('0x35')]),_0x309426);if(_0x313c9c['query']['filter']){_0x5eadeb[_0x360e('0x3e')]=_['merge'](_0x5eadeb[_0x360e('0x3e')],{'$or':[{'key':{'$like':'%'+_0x313c9c[_0x360e('0x33')][_0x360e('0x3f')]+'%'}},{'value':{'$like':'%'+_0x313c9c[_0x360e('0x33')][_0x360e('0x3f')]+'%'}}]});}_0x5eadeb=_[_0x360e('0x40')]({},_0x5eadeb,_0x313c9c[_0x360e('0x41')]);var _0x4af359={'where':_0x5eadeb[_0x360e('0x3e')]};return db[_0x360e('0x2f')]['count'](_0x4af359)[_0x360e('0x25')](function(_0x1638a7){_0x100309[_0x360e('0x1f')]=_0x1638a7;if(_0x313c9c[_0x360e('0x33')][_0x360e('0x42')]){_0x5eadeb[_0x360e('0x43')]=[{'all':!![]}];}return db[_0x360e('0x2f')][_0x360e('0x44')](_0x5eadeb);})[_0x360e('0x25')](function(_0x2e5747){_0x100309[_0x360e('0x45')]=_0x2e5747;return _0x100309;})[_0x360e('0x25')](respondWithFilteredResult(_0x5d1509,_0x5eadeb))[_0x360e('0x46')](handleError(_0x5d1509,null));};exports[_0x360e('0x47')]=function(_0x195489,_0x19d014){var _0x59b09e={'raw':!![],'where':{'id':_0x195489['params']['id']}},_0x3a858b={};_0x3a858b[_0x360e('0x37')]=_[_0x360e('0x34')](db[_0x360e('0x2f')][_0x360e('0x30')]);_0x3a858b[_0x360e('0x33')]=_[_0x360e('0x34')](_0x195489[_0x360e('0x33')]);_0x3a858b[_0x360e('0x35')]=_[_0x360e('0x36')](_0x3a858b['model'],_0x3a858b[_0x360e('0x33')]);_0x59b09e[_0x360e('0x38')]=_[_0x360e('0x36')](_0x3a858b[_0x360e('0x37')],qs[_0x360e('0x48')](_0x195489[_0x360e('0x33')][_0x360e('0x48')]));_0x59b09e[_0x360e('0x38')]=_0x59b09e[_0x360e('0x38')][_0x360e('0x39')]?_0x59b09e['attributes']:_0x3a858b['model'];if(_0x195489[_0x360e('0x33')]['includeAll']){_0x59b09e[_0x360e('0x43')]=[{'all':!![]}];}_0x59b09e=_['merge']({},_0x59b09e,_0x195489[_0x360e('0x41')]);return db[_0x360e('0x2f')][_0x360e('0x49')](_0x59b09e)['then'](handleEntityNotFound(_0x19d014,null))[_0x360e('0x25')](respondWithResult(_0x19d014,null))[_0x360e('0x46')](handleError(_0x19d014,null));};exports[_0x360e('0x4a')]=function(_0x31a45e,_0x47854f){if(_0x31a45e[_0x360e('0x4b')]['id']){delete _0x31a45e[_0x360e('0x4b')]['id'];}return db[_0x360e('0x2f')][_0x360e('0x49')]({'where':{'id':_0x31a45e['params']['id']}})['then'](handleEntityNotFound(_0x47854f,null))['then'](saveUpdates(_0x31a45e[_0x360e('0x4b')],null))['then'](respondWithResult(_0x47854f,null))[_0x360e('0x46')](handleError(_0x47854f,null));};exports[_0x360e('0x26')]=function(_0x52249b,_0x1cf449){return db[_0x360e('0x2f')][_0x360e('0x49')]({'where':{'id':_0x52249b[_0x360e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1cf449,null))[_0x360e('0x25')](removeEntity(_0x1cf449,null))[_0x360e('0x46')](handleError(_0x1cf449,null));};exports['create']=function(_0x389457,_0x191661){var _0x2c9b19={'key':_0x389457[_0x360e('0x4b')][_0x360e('0x32')]};if(_0x389457[_0x360e('0x4b')][_0x360e('0x4d')]){_0x2c9b19[_0x360e('0x4d')]=_0x389457['body'][_0x360e('0x4d')];}else if(_0x389457[_0x360e('0x4b')]['SmsAccountId']){_0x2c9b19['SmsAccountId']=_0x389457[_0x360e('0x4b')]['SmsAccountId'];}else if(_0x389457[_0x360e('0x4b')]['OpenchannelAccountId']){_0x2c9b19['OpenchannelAccountId']=_0x389457['body']['OpenchannelAccountId'];}else if(_0x389457[_0x360e('0x4b')][_0x360e('0x4e')]){_0x2c9b19['ChatWebsiteId']=_0x389457[_0x360e('0x4b')]['ChatWebsiteId'];}return db[_0x360e('0x2f')][_0x360e('0x49')]({'where':_0x2c9b19})['then'](function(_0x3f343d){if(_0x3f343d){throw new db[(_0x360e('0x4f'))][(_0x360e('0x50'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x360e('0x2f')][_0x360e('0x51')](_0x389457['body']);})['then'](function(_0x2475c6){var _0x70d938=_0x389457[_0x360e('0x52')][_0x360e('0x53')]({'plain':!![]});if(!_0x70d938)throw new Error(_0x360e('0x54'));if(_0x70d938[_0x360e('0x55')]===_0x360e('0x52')){var _0x1d47b2=_0x2475c6['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x360e('0x27'),'userProfileId':_0x70d938[_0x360e('0x56')]},'raw':!![]})[_0x360e('0x25')](function(_0x23adfc){if(_0x23adfc&&_0x23adfc[_0x360e('0x57')]===0x0){return db[_0x360e('0x58')]['create']({'name':_0x1d47b2[_0x360e('0x2b')],'resourceId':_0x1d47b2['id'],'type':_0x23adfc['name'],'sectionId':_0x23adfc['id']},{})['then'](function(){return _0x2475c6;});}else{return _0x2475c6;}})[_0x360e('0x46')](function(_0x4f611b){logger[_0x360e('0x2a')](_0x360e('0x59'),_0x4f611b);throw _0x4f611b;});}return _0x2475c6;})[_0x360e('0x25')](respondWithResult(_0x191661,0xc9))[_0x360e('0x46')](handleError(_0x191661,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 4a6efed..59eb11e 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 _0x8921=['rimraf','../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8921,0x70));var _0x1892=function(_0x6478ba,_0x61342){_0x6478ba=_0x6478ba-0x0;var _0x2786c5=_0x8921[_0x6478ba];return _0x2786c5;};'use strict';var _=require('lodash');var util=require(_0x1892('0x0'));var logger=require('../../config/logger')(_0x1892('0x1'));var moment=require(_0x1892('0x2'));var BPromise=require(_0x1892('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1892('0x4'));var rimraf=require(_0x1892('0x5'));var config=require(_0x1892('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x1892('0x7')]=function(_0x1076c6,_0x3ce039){return _0x1076c6[_0x1892('0x8')](_0x1892('0x9'),attributes,{'tableName':_0x1892('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1892('0xb'),'collate':_0x1892('0xc')});}; \ No newline at end of file +var _0x87ee=['lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci'];(function(_0x500aa7,_0x350ad6){var _0x5aca36=function(_0x4b63e8){while(--_0x4b63e8){_0x500aa7['push'](_0x500aa7['shift']());}};_0x5aca36(++_0x350ad6);}(_0x87ee,0x120));var _0xe87e=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x87ee[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xe87e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe87e('0x1'));var BPromise=require(_0xe87e('0x2'));var rp=require(_0xe87e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe87e('0x4'));var config=require(_0xe87e('0x5'));var attributes=require(_0xe87e('0x6'));module[_0xe87e('0x7')]=function(_0x182f26,_0x434657){return _0x182f26[_0xe87e('0x8')](_0xe87e('0x9'),attributes,{'tableName':_0xe87e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe87e('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index fd4d514..fc38541 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(_0x26cbb7,_0x3e0c3c){var _0x2b2f6e=function(_0x3b0c8f){while(--_0x3b0c8f){_0x26cbb7['push'](_0x26cbb7['shift']());}};_0x2b2f6e(++_0x3e0c3c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x515bc0,_0x3a13f9){var _0x4a38ee=function(_0x3cf61a){while(--_0x3cf61a){_0x515bc0['push'](_0x515bc0['shift']());}};_0x4a38ee(++_0x3a13f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 4dc0844..ab40715 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 _0x86eb=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./cannedAnswer.controller','get','isAuthenticated','index','show','post','create'];(function(_0x200d27,_0x1fe65f){var _0x4eda33=function(_0x171859){while(--_0x171859){_0x200d27['push'](_0x200d27['shift']());}};_0x4eda33(++_0x1fe65f);}(_0x86eb,0x92));var _0xb86e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x86eb[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb86e('0x0'));var util=require(_0xb86e('0x1'));var path=require(_0xb86e('0x2'));var timeout=require(_0xb86e('0x3'));var express=require(_0xb86e('0x4'));var router=express[_0xb86e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb86e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb86e('0x7'));router[_0xb86e('0x8')]('/',auth[_0xb86e('0x9')](),controller[_0xb86e('0xa')]);router['get']('/:id',auth[_0xb86e('0x9')](),controller[_0xb86e('0xb')]);router[_0xb86e('0xc')]('/',auth[_0xb86e('0x9')](),controller[_0xb86e('0xd')]);router[_0xb86e('0xe')](_0xb86e('0xf'),auth[_0xb86e('0x9')](),controller[_0xb86e('0x10')]);router[_0xb86e('0x11')](_0xb86e('0xf'),auth[_0xb86e('0x9')](),controller[_0xb86e('0x12')]);module[_0xb86e('0x13')]=router; \ No newline at end of file +var _0xd668=['update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','./cannedAnswer.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x29789e,_0x175b83){var _0x5d7bf5=function(_0x106fba){while(--_0x106fba){_0x29789e['push'](_0x29789e['shift']());}};_0x5d7bf5(++_0x175b83);}(_0xd668,0xad));var _0x8d66=function(_0x4a34c2,_0x20e6b3){_0x4a34c2=_0x4a34c2-0x0;var _0x1ec7a6=_0xd668[_0x4a34c2];return _0x1ec7a6;};'use strict';var multer=require(_0x8d66('0x0'));var util=require('util');var path=require(_0x8d66('0x1'));var timeout=require(_0x8d66('0x2'));var express=require(_0x8d66('0x3'));var router=express[_0x8d66('0x4')]();var fs_extra=require(_0x8d66('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8d66('0x6'));router[_0x8d66('0x7')]('/',auth['isAuthenticated'](),controller[_0x8d66('0x8')]);router[_0x8d66('0x7')](_0x8d66('0x9'),auth[_0x8d66('0xa')](),controller[_0x8d66('0xb')]);router[_0x8d66('0xc')]('/',auth[_0x8d66('0xa')](),controller[_0x8d66('0xd')]);router['put']('/:id',auth[_0x8d66('0xa')](),controller[_0x8d66('0xe')]);router['delete'](_0x8d66('0x9'),auth[_0x8d66('0xa')](),controller[_0x8d66('0xf')]);module[_0x8d66('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 4a82cc9..00b640e 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 _0xef92=['STRING','INTEGER','sequelize','exports','DATE'];(function(_0x50e071,_0x5e7266){var _0x16fe58=function(_0x3a37e8){while(--_0x3a37e8){_0x50e071['push'](_0x50e071['shift']());}};_0x16fe58(++_0x5e7266);}(_0xef92,0xf2));var _0x2ef9=function(_0x1a74c3,_0x1a2ed9){_0x1a74c3=_0x1a74c3-0x0;var _0x42c213=_0xef92[_0x1a74c3];return _0x42c213;};'use strict';var Sequelize=require(_0x2ef9('0x0'));module[_0x2ef9('0x1')]={'calldate':{'type':Sequelize[_0x2ef9('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x2ef9('0x3')]},'dst':{'type':Sequelize[_0x2ef9('0x3')]},'dcontext':{'type':Sequelize[_0x2ef9('0x3')]},'channel':{'type':Sequelize[_0x2ef9('0x3')]},'dstchannel':{'type':Sequelize[_0x2ef9('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x2ef9('0x3')]},'duration':{'type':Sequelize[_0x2ef9('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2ef9('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2ef9('0x3')]},'amaflags':{'type':Sequelize[_0x2ef9('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x2ef9('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x2ef9('0x3')]},'peeraccount':{'type':Sequelize[_0x2ef9('0x3')]},'type':{'type':Sequelize[_0x2ef9('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc961=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc961,0x17a));var _0x1c96=function(_0x1f2422,_0x125fd2){_0x1f2422=_0x1f2422-0x0;var _0x4fb420=_0xc961[_0x1f2422];return _0x4fb420;};'use strict';var Sequelize=require(_0x1c96('0x0'));module[_0x1c96('0x1')]={'calldate':{'type':Sequelize[_0x1c96('0x2')],'allowNull':![],'defaultValue':_0x1c96('0x3')},'clid':{'type':Sequelize[_0x1c96('0x4')]},'src':{'type':Sequelize[_0x1c96('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x1c96('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x1c96('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x1c96('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1c96('0x4')]},'amaflags':{'type':Sequelize[_0x1c96('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1c96('0x4')]},'userfield':{'type':Sequelize[_0x1c96('0x4')]},'uniqueid':{'type':Sequelize[_0x1c96('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x1c96('0x4')]},'peeraccount':{'type':Sequelize[_0x1c96('0x4')]},'type':{'type':Sequelize[_0x1c96('0x4')]},'tag':{'type':Sequelize[_0x1c96('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 7afaef7..c44b70b 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 _0x8a28=['filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','Cdr','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick'];(function(_0x2c8df0,_0x32e64b){var _0x5753b1=function(_0x279686){while(--_0x279686){_0x2c8df0['push'](_0x2c8df0['shift']());}};_0x5753b1(++_0x32e64b);}(_0x8a28,0xfd));var _0x88a2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8a28[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x88a2('0x0'));var rimraf=require(_0x88a2('0x1'));var zipdir=require(_0x88a2('0x2'));var jsonpatch=require(_0x88a2('0x3'));var rp=require(_0x88a2('0x4'));var moment=require(_0x88a2('0x5'));var BPromise=require(_0x88a2('0x6'));var Mustache=require(_0x88a2('0x7'));var util=require('util');var path=require(_0x88a2('0x8'));var sox=require(_0x88a2('0x9'));var csv=require(_0x88a2('0xa'));var ejs=require(_0x88a2('0xb'));var fs=require('fs');var fs_extra=require(_0x88a2('0xc'));var _=require('lodash');var squel=require(_0x88a2('0xd'));var crypto=require('crypto');var jsforce=require(_0x88a2('0xe'));var deskjs=require(_0x88a2('0xf'));var toCsv=require(_0x88a2('0xa'));var querystring=require(_0x88a2('0x10'));var Papa=require(_0x88a2('0x11'));var Redis=require(_0x88a2('0x12'));var authService=require(_0x88a2('0x13'));var qs=require(_0x88a2('0x14'));var as=require(_0x88a2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x88a2('0x16'));var utils=require(_0x88a2('0x17'));var config=require(_0x88a2('0x18'));var licenseUtil=require(_0x88a2('0x19'));var db=require(_0x88a2('0x1a'))['db'];function respondWithStatusCode(_0x4887fc,_0x210a52){_0x210a52=_0x210a52||0xcc;return function(_0x1a4056){if(_0x1a4056){return _0x4887fc[_0x88a2('0x1b')](_0x210a52);}return _0x4887fc[_0x88a2('0x1c')](_0x210a52)['end']();};}function respondWithResult(_0x923706,_0x407ef0){_0x407ef0=_0x407ef0||0xc8;return function(_0x3b83ce){if(_0x3b83ce){return _0x923706['status'](_0x407ef0)[_0x88a2('0x1d')](_0x3b83ce);}};}function respondWithFilteredResult(_0x207b12,_0x462b7b){return function(_0x42facc){if(_0x42facc){var _0x1beccd=typeof _0x462b7b[_0x88a2('0x1e')]===_0x88a2('0x1f')&&typeof _0x462b7b[_0x88a2('0x20')]===_0x88a2('0x1f');var _0x417bf8=_0x42facc[_0x88a2('0x21')];var _0x3c030e=_0x1beccd?0x0:_0x462b7b[_0x88a2('0x1e')];var _0x29dc1b=_0x1beccd?_0x42facc[_0x88a2('0x21')]:_0x462b7b[_0x88a2('0x1e')]+_0x462b7b[_0x88a2('0x20')];var _0x46ed82;if(_0x29dc1b>=_0x417bf8){_0x29dc1b=_0x417bf8;_0x46ed82=0xc8;}else{_0x46ed82=0xce;}_0x207b12['status'](_0x46ed82);return _0x207b12[_0x88a2('0x22')](_0x88a2('0x23'),_0x3c030e+'-'+_0x29dc1b+'/'+_0x417bf8)['json'](_0x42facc);}return null;};}function patchUpdates(_0x499891){return function(_0x7a054c){try{jsonpatch[_0x88a2('0x24')](_0x7a054c,_0x499891,!![]);}catch(_0x102139){return BPromise[_0x88a2('0x25')](_0x102139);}return _0x7a054c[_0x88a2('0x26')]();};}function saveUpdates(_0x54c6ed,_0x3b6401){return function(_0xda54c4){if(_0xda54c4){return _0xda54c4[_0x88a2('0x27')](_0x54c6ed)[_0x88a2('0x28')](function(_0x4be832){return _0x4be832;});}return null;};}function removeEntity(_0x1f104c,_0x527744){return function(_0x5bbd79){if(_0x5bbd79){return _0x5bbd79[_0x88a2('0x29')]()[_0x88a2('0x28')](function(){_0x1f104c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1343fc,_0xac4afe){return function(_0x5be767){if(!_0x5be767){_0x1343fc[_0x88a2('0x1b')](0x194);}return _0x5be767;};}function handleError(_0x4427a1,_0x2ba881){_0x2ba881=_0x2ba881||0x1f4;return function(_0x2474fc){logger['error'](_0x2474fc[_0x88a2('0x2a')]);if(_0x2474fc['name']){delete _0x2474fc[_0x88a2('0x2b')];}_0x4427a1[_0x88a2('0x1c')](_0x2ba881)[_0x88a2('0x2c')](_0x2474fc);};}exports['index']=function(_0x165259,_0x3eca1a){var _0x4c441a={},_0x21bd1b={},_0x537a8f={'count':0x0,'rows':[]};var _0x541cd0=_['map'](db[_0x88a2('0x2d')][_0x88a2('0x2e')],function(_0x1ceaab){return{'name':_0x1ceaab[_0x88a2('0x2f')],'type':_0x1ceaab[_0x88a2('0x30')][_0x88a2('0x31')]};});_0x21bd1b['model']=_[_0x88a2('0x32')](_0x541cd0,_0x88a2('0x2b'));_0x21bd1b[_0x88a2('0x33')]=_[_0x88a2('0x34')](_0x165259[_0x88a2('0x33')]);_0x21bd1b[_0x88a2('0x35')]=_[_0x88a2('0x36')](_0x21bd1b[_0x88a2('0x37')],_0x21bd1b[_0x88a2('0x33')]);_0x4c441a[_0x88a2('0x38')]=_['intersection'](_0x21bd1b['model'],qs[_0x88a2('0x39')](_0x165259[_0x88a2('0x33')][_0x88a2('0x39')]));_0x4c441a['attributes']=_0x4c441a[_0x88a2('0x38')][_0x88a2('0x3a')]?_0x4c441a['attributes']:_0x21bd1b[_0x88a2('0x37')];if(!_0x165259[_0x88a2('0x33')][_0x88a2('0x3b')]('nolimit')){_0x4c441a['limit']=qs[_0x88a2('0x20')](_0x165259[_0x88a2('0x33')]['limit']);_0x4c441a[_0x88a2('0x1e')]=qs[_0x88a2('0x1e')](_0x165259[_0x88a2('0x33')][_0x88a2('0x1e')]);}_0x4c441a[_0x88a2('0x3c')]=qs[_0x88a2('0x3d')](_0x165259[_0x88a2('0x33')][_0x88a2('0x3d')]);_0x4c441a['where']=qs[_0x88a2('0x35')](_[_0x88a2('0x3e')](_0x165259['query'],_0x21bd1b[_0x88a2('0x35')]),_0x541cd0);if(_0x165259[_0x88a2('0x33')][_0x88a2('0x3f')]){_0x4c441a[_0x88a2('0x40')]=_[_0x88a2('0x41')](_0x4c441a[_0x88a2('0x40')],{'$or':_[_0x88a2('0x32')](_0x541cd0,function(_0x21828b){if(_0x21828b[_0x88a2('0x30')]!==_0x88a2('0x42')){var _0x120e17={};_0x120e17[_0x21828b[_0x88a2('0x2b')]]={'$like':'%'+_0x165259[_0x88a2('0x33')][_0x88a2('0x3f')]+'%'};return _0x120e17;}})});}_0x4c441a=_[_0x88a2('0x41')]({},_0x4c441a,_0x165259[_0x88a2('0x43')]);var _0x1496d9={'where':_0x4c441a[_0x88a2('0x40')]};return db[_0x88a2('0x2d')][_0x88a2('0x21')](_0x1496d9)[_0x88a2('0x28')](function(_0x201591){_0x537a8f[_0x88a2('0x21')]=_0x201591;if(_0x165259[_0x88a2('0x33')][_0x88a2('0x44')]){_0x4c441a['include']=[{'all':!![]}];}return db['Cdr'][_0x88a2('0x45')](_0x4c441a);})[_0x88a2('0x28')](function(_0x555415){_0x537a8f[_0x88a2('0x46')]=_0x555415;return _0x537a8f;})[_0x88a2('0x28')](respondWithFilteredResult(_0x3eca1a,_0x4c441a))[_0x88a2('0x47')](handleError(_0x3eca1a,null));};exports[_0x88a2('0x48')]=function(_0x339648,_0x33a5c7){var _0x4d9726={'raw':!![],'where':{'id':_0x339648[_0x88a2('0x49')]['id']}},_0x23f8c8={};_0x23f8c8[_0x88a2('0x37')]=_['keys'](db[_0x88a2('0x2d')][_0x88a2('0x2e')]);_0x23f8c8[_0x88a2('0x33')]=_[_0x88a2('0x34')](_0x339648['query']);_0x23f8c8[_0x88a2('0x35')]=_[_0x88a2('0x36')](_0x23f8c8[_0x88a2('0x37')],_0x23f8c8[_0x88a2('0x33')]);_0x4d9726[_0x88a2('0x38')]=_[_0x88a2('0x36')](_0x23f8c8[_0x88a2('0x37')],qs[_0x88a2('0x39')](_0x339648[_0x88a2('0x33')][_0x88a2('0x39')]));_0x4d9726[_0x88a2('0x38')]=_0x4d9726[_0x88a2('0x38')][_0x88a2('0x3a')]?_0x4d9726[_0x88a2('0x38')]:_0x23f8c8[_0x88a2('0x37')];if(_0x339648[_0x88a2('0x33')][_0x88a2('0x44')]){_0x4d9726[_0x88a2('0x4a')]=[{'all':!![]}];}_0x4d9726=_[_0x88a2('0x41')]({},_0x4d9726,_0x339648[_0x88a2('0x43')]);return db['Cdr'][_0x88a2('0x4b')](_0x4d9726)['then'](handleEntityNotFound(_0x33a5c7,null))[_0x88a2('0x28')](respondWithResult(_0x33a5c7,null))['catch'](handleError(_0x33a5c7,null));};exports[_0x88a2('0x4c')]=function(_0x25dad5,_0x1c5e6b){return db[_0x88a2('0x2d')][_0x88a2('0x4c')](_0x25dad5[_0x88a2('0x4d')],{})[_0x88a2('0x28')](respondWithResult(_0x1c5e6b,0xc9))[_0x88a2('0x47')](handleError(_0x1c5e6b,null));};exports['update']=function(_0x1d773c,_0x1cc256){if(_0x1d773c['body']['id']){delete _0x1d773c[_0x88a2('0x4d')]['id'];}return db['Cdr'][_0x88a2('0x4b')]({'where':{'id':_0x1d773c['params']['id']}})[_0x88a2('0x28')](handleEntityNotFound(_0x1cc256,null))[_0x88a2('0x28')](saveUpdates(_0x1d773c[_0x88a2('0x4d')],null))[_0x88a2('0x28')](respondWithResult(_0x1cc256,null))[_0x88a2('0x47')](handleError(_0x1cc256,null));};exports[_0x88a2('0x29')]=function(_0x39bffe,_0x2fbdf4){return db[_0x88a2('0x2d')][_0x88a2('0x4b')]({'where':{'id':_0x39bffe[_0x88a2('0x49')]['id']}})[_0x88a2('0x28')](handleEntityNotFound(_0x2fbdf4,null))['then'](removeEntity(_0x2fbdf4,null))['catch'](handleError(_0x2fbdf4,null));};exports[_0x88a2('0x4e')]=function(_0x889d30,_0x20f198){return db[_0x88a2('0x2d')][_0x88a2('0x4e')]()['then'](respondWithResult(_0x20f198,null))[_0x88a2('0x47')](handleError(_0x20f198,null));}; \ No newline at end of file +var _0x8819=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','zip-dir','fast-json-patch'];(function(_0x36e8db,_0x5230b5){var _0xd6eb32=function(_0x16b9f6){while(--_0x16b9f6){_0x36e8db['push'](_0x36e8db['shift']());}};_0xd6eb32(++_0x5230b5);}(_0x8819,0x94));var _0x9881=function(_0x4dc460,_0x2fa091){_0x4dc460=_0x4dc460-0x0;var _0x2adada=_0x8819[_0x4dc460];return _0x2adada;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9881('0x0'));var jsonpatch=require(_0x9881('0x1'));var rp=require(_0x9881('0x2'));var moment=require(_0x9881('0x3'));var BPromise=require(_0x9881('0x4'));var Mustache=require('mustache');var util=require(_0x9881('0x5'));var path=require(_0x9881('0x6'));var sox=require(_0x9881('0x7'));var csv=require(_0x9881('0x8'));var ejs=require(_0x9881('0x9'));var fs=require('fs');var fs_extra=require(_0x9881('0xa'));var _=require('lodash');var squel=require(_0x9881('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9881('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9881('0xd'));var Redis=require('ioredis');var authService=require(_0x9881('0xe'));var qs=require(_0x9881('0xf'));var as=require(_0x9881('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9881('0x11'))(_0x9881('0x12'));var utils=require(_0x9881('0x13'));var config=require(_0x9881('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9881('0x15'))['db'];function respondWithStatusCode(_0x26ee3f,_0x5c6d2d){_0x5c6d2d=_0x5c6d2d||0xcc;return function(_0x42850e){if(_0x42850e){return _0x26ee3f['sendStatus'](_0x5c6d2d);}return _0x26ee3f['status'](_0x5c6d2d)['end']();};}function respondWithResult(_0x58f526,_0x12794f){_0x12794f=_0x12794f||0xc8;return function(_0x3178d7){if(_0x3178d7){return _0x58f526[_0x9881('0x16')](_0x12794f)[_0x9881('0x17')](_0x3178d7);}};}function respondWithFilteredResult(_0x39d127,_0x1d57ea){return function(_0x4b9d1b){if(_0x4b9d1b){var _0x411513=typeof _0x1d57ea[_0x9881('0x18')]===_0x9881('0x19')&&typeof _0x1d57ea['limit']==='undefined';var _0x4c92c9=_0x4b9d1b[_0x9881('0x1a')];var _0x4c3493=_0x411513?0x0:_0x1d57ea[_0x9881('0x18')];var _0x5a9848=_0x411513?_0x4b9d1b['count']:_0x1d57ea[_0x9881('0x18')]+_0x1d57ea[_0x9881('0x1b')];var _0x1cbac3;if(_0x5a9848>=_0x4c92c9){_0x5a9848=_0x4c92c9;_0x1cbac3=0xc8;}else{_0x1cbac3=0xce;}_0x39d127[_0x9881('0x16')](_0x1cbac3);return _0x39d127[_0x9881('0x1c')](_0x9881('0x1d'),_0x4c3493+'-'+_0x5a9848+'/'+_0x4c92c9)[_0x9881('0x17')](_0x4b9d1b);}return null;};}function patchUpdates(_0x1243cc){return function(_0x1ee450){try{jsonpatch[_0x9881('0x1e')](_0x1ee450,_0x1243cc,!![]);}catch(_0x32ca84){return BPromise[_0x9881('0x1f')](_0x32ca84);}return _0x1ee450[_0x9881('0x20')]();};}function saveUpdates(_0x300fa6,_0x174b39){return function(_0x58485d){if(_0x58485d){return _0x58485d['update'](_0x300fa6)[_0x9881('0x21')](function(_0x513545){return _0x513545;});}return null;};}function removeEntity(_0x499461,_0x1ba558){return function(_0x30ed15){if(_0x30ed15){return _0x30ed15['destroy']()['then'](function(){_0x499461[_0x9881('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bddc1,_0x161f8d){return function(_0x16eeca){if(!_0x16eeca){_0x2bddc1[_0x9881('0x22')](0x194);}return _0x16eeca;};}function handleError(_0x2c3cd1,_0x14e6f9){_0x14e6f9=_0x14e6f9||0x1f4;return function(_0x2f6b7c){logger[_0x9881('0x23')](_0x2f6b7c[_0x9881('0x24')]);if(_0x2f6b7c[_0x9881('0x25')]){delete _0x2f6b7c[_0x9881('0x25')];}_0x2c3cd1[_0x9881('0x16')](_0x14e6f9)[_0x9881('0x26')](_0x2f6b7c);};}exports['index']=function(_0x31956e,_0x41fe0d){var _0x5c2815={},_0x236979={},_0x3d7120={'count':0x0,'rows':[]};var _0x4970be=_[_0x9881('0x27')](db[_0x9881('0x28')][_0x9881('0x29')],function(_0x204f2b){return{'name':_0x204f2b[_0x9881('0x2a')],'type':_0x204f2b[_0x9881('0x2b')][_0x9881('0x2c')]};});_0x236979[_0x9881('0x2d')]=_['map'](_0x4970be,_0x9881('0x25'));_0x236979[_0x9881('0x2e')]=_[_0x9881('0x2f')](_0x31956e[_0x9881('0x2e')]);_0x236979[_0x9881('0x30')]=_[_0x9881('0x31')](_0x236979['model'],_0x236979[_0x9881('0x2e')]);_0x5c2815[_0x9881('0x32')]=_['intersection'](_0x236979[_0x9881('0x2d')],qs[_0x9881('0x33')](_0x31956e[_0x9881('0x2e')][_0x9881('0x33')]));_0x5c2815[_0x9881('0x32')]=_0x5c2815['attributes'][_0x9881('0x34')]?_0x5c2815[_0x9881('0x32')]:_0x236979[_0x9881('0x2d')];if(!_0x31956e[_0x9881('0x2e')][_0x9881('0x35')](_0x9881('0x36'))){_0x5c2815[_0x9881('0x1b')]=qs[_0x9881('0x1b')](_0x31956e[_0x9881('0x2e')][_0x9881('0x1b')]);_0x5c2815[_0x9881('0x18')]=qs[_0x9881('0x18')](_0x31956e[_0x9881('0x2e')][_0x9881('0x18')]);}_0x5c2815[_0x9881('0x37')]=qs[_0x9881('0x38')](_0x31956e['query'][_0x9881('0x38')]);_0x5c2815['where']=qs[_0x9881('0x30')](_['pick'](_0x31956e[_0x9881('0x2e')],_0x236979[_0x9881('0x30')]),_0x4970be);if(_0x31956e['query'][_0x9881('0x39')]){_0x5c2815['where']=_[_0x9881('0x3a')](_0x5c2815[_0x9881('0x3b')],{'$or':_[_0x9881('0x27')](_0x4970be,function(_0x204fc3){if(_0x204fc3['type']!==_0x9881('0x3c')){var _0x3d183e={};_0x3d183e[_0x204fc3[_0x9881('0x25')]]={'$like':'%'+_0x31956e[_0x9881('0x2e')][_0x9881('0x39')]+'%'};return _0x3d183e;}})});}_0x5c2815=_[_0x9881('0x3a')]({},_0x5c2815,_0x31956e[_0x9881('0x3d')]);var _0x4feb70={'where':_0x5c2815[_0x9881('0x3b')]};return db['Cdr'][_0x9881('0x1a')](_0x4feb70)[_0x9881('0x21')](function(_0x1c0396){_0x3d7120['count']=_0x1c0396;if(_0x31956e[_0x9881('0x2e')][_0x9881('0x3e')]){_0x5c2815[_0x9881('0x3f')]=[{'all':!![]}];}return db['Cdr'][_0x9881('0x40')](_0x5c2815);})[_0x9881('0x21')](function(_0x4fe13d){_0x3d7120[_0x9881('0x41')]=_0x4fe13d;return _0x3d7120;})[_0x9881('0x21')](respondWithFilteredResult(_0x41fe0d,_0x5c2815))[_0x9881('0x42')](handleError(_0x41fe0d,null));};exports[_0x9881('0x43')]=function(_0x424ed1,_0x1eae2f){var _0x2ac606={'raw':!![],'where':{'id':_0x424ed1[_0x9881('0x44')]['id']}},_0x4421bc={};_0x4421bc[_0x9881('0x2d')]=_['keys'](db[_0x9881('0x28')][_0x9881('0x29')]);_0x4421bc[_0x9881('0x2e')]=_[_0x9881('0x2f')](_0x424ed1[_0x9881('0x2e')]);_0x4421bc['filters']=_[_0x9881('0x31')](_0x4421bc[_0x9881('0x2d')],_0x4421bc[_0x9881('0x2e')]);_0x2ac606[_0x9881('0x32')]=_['intersection'](_0x4421bc[_0x9881('0x2d')],qs[_0x9881('0x33')](_0x424ed1[_0x9881('0x2e')]['fields']));_0x2ac606[_0x9881('0x32')]=_0x2ac606[_0x9881('0x32')][_0x9881('0x34')]?_0x2ac606[_0x9881('0x32')]:_0x4421bc[_0x9881('0x2d')];if(_0x424ed1[_0x9881('0x2e')][_0x9881('0x3e')]){_0x2ac606[_0x9881('0x3f')]=[{'all':!![]}];}_0x2ac606=_[_0x9881('0x3a')]({},_0x2ac606,_0x424ed1[_0x9881('0x3d')]);return db['Cdr'][_0x9881('0x45')](_0x2ac606)[_0x9881('0x21')](handleEntityNotFound(_0x1eae2f,null))[_0x9881('0x21')](respondWithResult(_0x1eae2f,null))['catch'](handleError(_0x1eae2f,null));};exports[_0x9881('0x46')]=function(_0x24a52b,_0x1e1f0f){return db['Cdr']['create'](_0x24a52b[_0x9881('0x47')],{})[_0x9881('0x21')](respondWithResult(_0x1e1f0f,0xc9))[_0x9881('0x42')](handleError(_0x1e1f0f,null));};exports[_0x9881('0x48')]=function(_0x49c478,_0x514263){if(_0x49c478[_0x9881('0x47')]['id']){delete _0x49c478[_0x9881('0x47')]['id'];}return db[_0x9881('0x28')]['find']({'where':{'id':_0x49c478[_0x9881('0x44')]['id']}})[_0x9881('0x21')](handleEntityNotFound(_0x514263,null))['then'](saveUpdates(_0x49c478[_0x9881('0x47')],null))[_0x9881('0x21')](respondWithResult(_0x514263,null))[_0x9881('0x42')](handleError(_0x514263,null));};exports[_0x9881('0x49')]=function(_0x21720a,_0x32cb89){return db[_0x9881('0x28')]['find']({'where':{'id':_0x21720a[_0x9881('0x44')]['id']}})['then'](handleEntityNotFound(_0x32cb89,null))[_0x9881('0x21')](removeEntity(_0x32cb89,null))[_0x9881('0x42')](handleError(_0x32cb89,null));};exports[_0x9881('0x4a')]=function(_0x16ca26,_0x590acc){return db['Cdr'][_0x9881('0x4a')]()[_0x9881('0x21')](respondWithResult(_0x590acc,null))[_0x9881('0x42')](handleError(_0x590acc,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 2d5bc3a..e3f8231 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x4a50d5,_0x56c238){var _0xe29c91=function(_0x3719e6){while(--_0x3719e6){_0x4a50d5['push'](_0x4a50d5['shift']());}};_0xe29c91(++_0x56c238);}(_0x7a54,0x106));var _0x47a5=function(_0x215d2a,_0x57402b){_0x215d2a=_0x215d2a-0x0;var _0x1c3572=_0x7a54[_0x215d2a];return _0x1c3572;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x389535,_0x5a8428){var _0x2b2c94=function(_0x12731c){while(--_0x12731c){_0x389535['push'](_0x389535['shift']());}};_0x2b2c94(++_0x5a8428);}(_0x7a54,0x106));var _0x47a5=function(_0x487d16,_0x5bef67){_0x487d16=_0x487d16-0x0;var _0x4e459b=_0x7a54[_0x487d16];return _0x4e459b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index a237f7f..32cc6e0 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 _0x301b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x135166,_0x4094d8){var _0x1b6677=function(_0xb3eae0){while(--_0xb3eae0){_0x135166['push'](_0x135166['shift']());}};_0x1b6677(++_0x4094d8);}(_0x301b,0xa4));var _0xb301=function(_0x20270e,_0x172076){_0x20270e=_0x20270e-0x0;var _0x22e10a=_0x301b[_0x20270e];return _0x22e10a;};'use strict';var _=require(_0xb301('0x0'));var util=require(_0xb301('0x1'));var moment=require(_0xb301('0x2'));var BPromise=require(_0xb301('0x3'));var rs=require(_0xb301('0x4'));var fs=require('fs');var Redis=require(_0xb301('0x5'));var db=require(_0xb301('0x6'))['db'];var utils=require(_0xb301('0x7'));var logger=require(_0xb301('0x8'))(_0xb301('0x9'));var config=require('../../config/environment');var jayson=require(_0xb301('0xa'));var client=jayson[_0xb301('0xb')][_0xb301('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e29f8,_0x125b49,_0x15ef9a){return new BPromise(function(_0x250adb,_0x52a22f){return client['request'](_0x4e29f8,_0x15ef9a)['then'](function(_0xb887e0){logger[_0xb301('0xd')](_0xb301('0xe'),_0x125b49,_0xb301('0xf'));logger[_0xb301('0x10')](_0xb301('0x11'),_0x125b49,_0xb301('0xf'),JSON[_0xb301('0x12')](_0xb887e0));if(_0xb887e0[_0xb301('0x13')]){if(_0xb887e0[_0xb301('0x13')][_0xb301('0x14')]===0x1f4){logger[_0xb301('0x13')](_0xb301('0xe'),_0x125b49,_0xb887e0['error']['message']);return _0x52a22f(_0xb887e0[_0xb301('0x13')][_0xb301('0x15')]);}logger[_0xb301('0x13')]('Cdr,\x20%s,\x20%s',_0x125b49,_0xb887e0[_0xb301('0x13')][_0xb301('0x15')]);return _0x250adb(_0xb887e0[_0xb301('0x13')][_0xb301('0x15')]);}else{logger[_0xb301('0xd')](_0xb301('0xe'),_0x125b49,_0xb301('0xf'));_0x250adb(_0xb887e0[_0xb301('0x16')][_0xb301('0x15')]);}})[_0xb301('0x17')](function(_0x2ecd53){logger[_0xb301('0x13')](_0xb301('0xe'),_0x125b49,_0x2ecd53);_0x52a22f(_0x2ecd53);});});} \ No newline at end of file +var _0x8670=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Cdr,\x20%s,\x20%s','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x8670,0x1bc));var _0x0867=function(_0x1b95a1,_0x529852){_0x1b95a1=_0x1b95a1-0x0;var _0x57aef1=_0x8670[_0x1b95a1];return _0x57aef1;};'use strict';var _=require(_0x0867('0x0'));var util=require(_0x0867('0x1'));var moment=require(_0x0867('0x2'));var BPromise=require(_0x0867('0x3'));var rs=require(_0x0867('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0867('0x5'))['db'];var utils=require(_0x0867('0x6'));var logger=require(_0x0867('0x7'))(_0x0867('0x8'));var config=require(_0x0867('0x9'));var jayson=require(_0x0867('0xa'));var client=jayson['client'][_0x0867('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56de19,_0x51f91a,_0x2d4ea8){return new BPromise(function(_0x5526ad,_0x160cac){return client[_0x0867('0xc')](_0x56de19,_0x2d4ea8)['then'](function(_0x523a25){logger[_0x0867('0xd')](_0x0867('0xe'),_0x51f91a,'request\x20sent');logger['debug'](_0x0867('0xf'),_0x51f91a,_0x0867('0x10'),JSON[_0x0867('0x11')](_0x523a25));if(_0x523a25['error']){if(_0x523a25[_0x0867('0x12')]['code']===0x1f4){logger[_0x0867('0x12')]('Cdr,\x20%s,\x20%s',_0x51f91a,_0x523a25[_0x0867('0x12')]['message']);return _0x160cac(_0x523a25[_0x0867('0x12')]['message']);}logger['error']('Cdr,\x20%s,\x20%s',_0x51f91a,_0x523a25[_0x0867('0x12')][_0x0867('0x13')]);return _0x5526ad(_0x523a25[_0x0867('0x12')][_0x0867('0x13')]);}else{logger['info'](_0x0867('0xe'),_0x51f91a,'request\x20sent');_0x5526ad(_0x523a25[_0x0867('0x14')][_0x0867('0x13')]);}})[_0x0867('0x15')](function(_0x5f9e35){logger[_0x0867('0x12')](_0x0867('0xe'),_0x51f91a,_0x5f9e35);_0x160cac(_0x5f9e35);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index d07b632..4d5b52d 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(_0x43faf3,_0x579bbe){var _0x404b76=function(_0x459dbd){while(--_0x459dbd){_0x43faf3['push'](_0x43faf3['shift']());}};_0x404b76(++_0x579bbe);}(_0xb10b,0x12a));var _0xbb10=function(_0x2bb452,_0x2dbbc0){_0x2bb452=_0x2bb452-0x0;var _0x5f50a6=_0xb10b[_0x2bb452];return _0x5f50a6;};'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(_0x71b765,_0x3053f8){var _0x34cb24=function(_0x2dd237){while(--_0x2dd237){_0x71b765['push'](_0x71b765['shift']());}};_0x34cb24(++_0x3053f8);}(_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 fde9086..1df1d37 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 _0x9a52=['exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9a52,0x145));var _0x29a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a52[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x29a5('0x0')]={'priority':{'type':Sequelize[_0x29a5('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x29a5('0x2')],'allowNull':![],'defaultValue':_0x29a5('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x29a5('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x29a5('0x4')}}; \ No newline at end of file +var _0xf749=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0xf749,0x1cf));var _0x9f74=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xf749[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x9f74('0x0'));module[_0x9f74('0x1')]={'priority':{'type':Sequelize[_0x9f74('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9f74('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9f74('0x4')]()},'description':{'type':Sequelize[_0x9f74('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9f74('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 994bb3e..4a0b9b2 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 _0x83e1=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','show','model','ChatApplication','rawAttributes','keys','intersection','attributes','fields','query','length','include','merge','find','catch','body','params','eml-format','rimraf','fast-json-patch','moment','util','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x540277,_0xfd2105){var _0x584fda=function(_0xea4e77){while(--_0xea4e77){_0x540277['push'](_0x540277['shift']());}};_0x584fda(++_0xfd2105);}(_0x83e1,0x1ad));var _0x183e=function(_0x28942a,_0x454774){_0x28942a=_0x28942a-0x0;var _0x5f1b09=_0x83e1[_0x28942a];return _0x5f1b09;};'use strict';var emlformat=require(_0x183e('0x0'));var rimraf=require(_0x183e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x183e('0x2'));var rp=require('request-promise');var moment=require(_0x183e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x183e('0x4'));var path=require(_0x183e('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x183e('0x6'));var _=require(_0x183e('0x7'));var squel=require(_0x183e('0x8'));var crypto=require('crypto');var jsforce=require(_0x183e('0x9'));var deskjs=require(_0x183e('0xa'));var toCsv=require(_0x183e('0xb'));var querystring=require('querystring');var Papa=require(_0x183e('0xc'));var Redis=require(_0x183e('0xd'));var authService=require(_0x183e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x183e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x183e('0x10'))(_0x183e('0x11'));var utils=require(_0x183e('0x12'));var config=require(_0x183e('0x13'));var licenseUtil=require(_0x183e('0x14'));var db=require(_0x183e('0x15'))['db'];function respondWithStatusCode(_0x192605,_0x5b86b3){_0x5b86b3=_0x5b86b3||0xcc;return function(_0x53e576){if(_0x53e576){return _0x192605['sendStatus'](_0x5b86b3);}return _0x192605[_0x183e('0x16')](_0x5b86b3)[_0x183e('0x17')]();};}function respondWithResult(_0x1aae2f,_0x5d4941){_0x5d4941=_0x5d4941||0xc8;return function(_0x140a70){if(_0x140a70){return _0x1aae2f[_0x183e('0x16')](_0x5d4941)[_0x183e('0x18')](_0x140a70);}};}function respondWithFilteredResult(_0x51b258,_0x8f4af8){return function(_0x35badd){if(_0x35badd){var _0x3faadf=typeof _0x8f4af8[_0x183e('0x19')]===_0x183e('0x1a')&&typeof _0x8f4af8[_0x183e('0x1b')]===_0x183e('0x1a');var _0x271d11=_0x35badd['count'];var _0x27d487=_0x3faadf?0x0:_0x8f4af8[_0x183e('0x19')];var _0x322f56=_0x3faadf?_0x35badd[_0x183e('0x1c')]:_0x8f4af8[_0x183e('0x19')]+_0x8f4af8[_0x183e('0x1b')];var _0x5d3de1;if(_0x322f56>=_0x271d11){_0x322f56=_0x271d11;_0x5d3de1=0xc8;}else{_0x5d3de1=0xce;}_0x51b258[_0x183e('0x16')](_0x5d3de1);return _0x51b258[_0x183e('0x1d')](_0x183e('0x1e'),_0x27d487+'-'+_0x322f56+'/'+_0x271d11)[_0x183e('0x18')](_0x35badd);}return null;};}function patchUpdates(_0x4cf0da){return function(_0x4d8102){try{jsonpatch['apply'](_0x4d8102,_0x4cf0da,!![]);}catch(_0x4dc915){return BPromise[_0x183e('0x1f')](_0x4dc915);}return _0x4d8102['save']();};}function saveUpdates(_0x553fee,_0xc96e61){return function(_0x34a128){if(_0x34a128){return _0x34a128[_0x183e('0x20')](_0x553fee)[_0x183e('0x21')](function(_0x4031d8){return _0x4031d8;});}return null;};}function removeEntity(_0x4ea291,_0x223351){return function(_0x5d6b29){if(_0x5d6b29){return _0x5d6b29[_0x183e('0x22')]()[_0x183e('0x21')](function(){_0x4ea291[_0x183e('0x16')](0xcc)[_0x183e('0x17')]();});}};}function handleEntityNotFound(_0x5a0d1d,_0x5eda06){return function(_0x7b9a98){if(!_0x7b9a98){_0x5a0d1d[_0x183e('0x23')](0x194);}return _0x7b9a98;};}function handleError(_0x4b5467,_0x5457ed){_0x5457ed=_0x5457ed||0x1f4;return function(_0x14522f){logger[_0x183e('0x24')](_0x14522f[_0x183e('0x25')]);if(_0x14522f['name']){delete _0x14522f[_0x183e('0x26')];}_0x4b5467[_0x183e('0x16')](_0x5457ed)[_0x183e('0x27')](_0x14522f);};}exports[_0x183e('0x28')]=function(_0x26de99,_0x1f8603){var _0x2f9657={'raw':!![],'where':{'id':_0x26de99['params']['id']}},_0x1bc636={};_0x1bc636[_0x183e('0x29')]=_['keys'](db[_0x183e('0x2a')][_0x183e('0x2b')]);_0x1bc636['query']=_[_0x183e('0x2c')](_0x26de99['query']);_0x1bc636['filters']=_[_0x183e('0x2d')](_0x1bc636['model'],_0x1bc636['query']);_0x2f9657[_0x183e('0x2e')]=_[_0x183e('0x2d')](_0x1bc636[_0x183e('0x29')],qs[_0x183e('0x2f')](_0x26de99[_0x183e('0x30')][_0x183e('0x2f')]));_0x2f9657[_0x183e('0x2e')]=_0x2f9657['attributes'][_0x183e('0x31')]?_0x2f9657['attributes']:_0x1bc636[_0x183e('0x29')];if(_0x26de99[_0x183e('0x30')]['includeAll']){_0x2f9657[_0x183e('0x32')]=[{'all':!![]}];}_0x2f9657=_[_0x183e('0x33')]({},_0x2f9657,_0x26de99['options']);return db['ChatApplication'][_0x183e('0x34')](_0x2f9657)[_0x183e('0x21')](handleEntityNotFound(_0x1f8603,null))[_0x183e('0x21')](respondWithResult(_0x1f8603,null))[_0x183e('0x35')](handleError(_0x1f8603,null));};exports[_0x183e('0x20')]=function(_0x3f2ddb,_0x4fbaff){if(_0x3f2ddb[_0x183e('0x36')]['id']){delete _0x3f2ddb['body']['id'];}return db['ChatApplication'][_0x183e('0x34')]({'where':{'id':_0x3f2ddb[_0x183e('0x37')]['id']}})[_0x183e('0x21')](handleEntityNotFound(_0x4fbaff,null))['then'](saveUpdates(_0x3f2ddb['body'],null))[_0x183e('0x21')](respondWithResult(_0x4fbaff,null))['catch'](handleError(_0x4fbaff,null));};exports[_0x183e('0x22')]=function(_0x3efe07,_0x52f113){return db[_0x183e('0x2a')][_0x183e('0x34')]({'where':{'id':_0x3efe07[_0x183e('0x37')]['id']}})[_0x183e('0x21')](handleEntityNotFound(_0x52f113,null))[_0x183e('0x21')](removeEntity(_0x52f113,null))[_0x183e('0x35')](handleError(_0x52f113,null));}; \ No newline at end of file +var _0x5d31=['then','destroy','error','stack','name','send','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','ChatApplication','find','catch','body','params','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update'];(function(_0x3c5163,_0xac9816){var _0x2943c=function(_0x5daca7){while(--_0x5daca7){_0x3c5163['push'](_0x3c5163['shift']());}};_0x2943c(++_0xac9816);}(_0x5d31,0xf7));var _0x15d3=function(_0x1c3fee,_0x26b5ac){_0x1c3fee=_0x1c3fee-0x0;var _0x112788=_0x5d31[_0x1c3fee];return _0x112788;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x15d3('0x0'));var zipdir=require(_0x15d3('0x1'));var jsonpatch=require(_0x15d3('0x2'));var rp=require('request-promise');var moment=require(_0x15d3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x15d3('0x4'));var path=require(_0x15d3('0x5'));var sox=require(_0x15d3('0x6'));var csv=require(_0x15d3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x15d3('0x8'));var _=require(_0x15d3('0x9'));var squel=require(_0x15d3('0xa'));var crypto=require(_0x15d3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x15d3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x15d3('0xd'));var Redis=require('ioredis');var authService=require(_0x15d3('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15d3('0xf'));var logger=require(_0x15d3('0x10'))(_0x15d3('0x11'));var utils=require(_0x15d3('0x12'));var config=require(_0x15d3('0x13'));var licenseUtil=require(_0x15d3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x219867,_0x1397d8){_0x1397d8=_0x1397d8||0xcc;return function(_0x2811b5){if(_0x2811b5){return _0x219867[_0x15d3('0x15')](_0x1397d8);}return _0x219867[_0x15d3('0x16')](_0x1397d8)[_0x15d3('0x17')]();};}function respondWithResult(_0x24eb07,_0x1658cf){_0x1658cf=_0x1658cf||0xc8;return function(_0x44b5a4){if(_0x44b5a4){return _0x24eb07[_0x15d3('0x16')](_0x1658cf)[_0x15d3('0x18')](_0x44b5a4);}};}function respondWithFilteredResult(_0x4af3a7,_0x304a13){return function(_0x17401b){if(_0x17401b){var _0x5bbfef=typeof _0x304a13[_0x15d3('0x19')]===_0x15d3('0x1a')&&typeof _0x304a13[_0x15d3('0x1b')]===_0x15d3('0x1a');var _0x1b7b3f=_0x17401b[_0x15d3('0x1c')];var _0x46f9ce=_0x5bbfef?0x0:_0x304a13[_0x15d3('0x19')];var _0x46e18b=_0x5bbfef?_0x17401b[_0x15d3('0x1c')]:_0x304a13[_0x15d3('0x19')]+_0x304a13['limit'];var _0x41c358;if(_0x46e18b>=_0x1b7b3f){_0x46e18b=_0x1b7b3f;_0x41c358=0xc8;}else{_0x41c358=0xce;}_0x4af3a7[_0x15d3('0x16')](_0x41c358);return _0x4af3a7['set']('Content-Range',_0x46f9ce+'-'+_0x46e18b+'/'+_0x1b7b3f)['json'](_0x17401b);}return null;};}function patchUpdates(_0x4ebc97){return function(_0x39bb05){try{jsonpatch[_0x15d3('0x1d')](_0x39bb05,_0x4ebc97,!![]);}catch(_0x40a327){return BPromise[_0x15d3('0x1e')](_0x40a327);}return _0x39bb05[_0x15d3('0x1f')]();};}function saveUpdates(_0x2fa13c,_0x4da198){return function(_0x49eb89){if(_0x49eb89){return _0x49eb89[_0x15d3('0x20')](_0x2fa13c)[_0x15d3('0x21')](function(_0x444075){return _0x444075;});}return null;};}function removeEntity(_0x72852f,_0x5b06cc){return function(_0x232078){if(_0x232078){return _0x232078[_0x15d3('0x22')]()[_0x15d3('0x21')](function(){_0x72852f[_0x15d3('0x16')](0xcc)[_0x15d3('0x17')]();});}};}function handleEntityNotFound(_0x240cf4,_0x4a499a){return function(_0x514380){if(!_0x514380){_0x240cf4['sendStatus'](0x194);}return _0x514380;};}function handleError(_0x31706f,_0x1cd5bc){_0x1cd5bc=_0x1cd5bc||0x1f4;return function(_0x23e1f8){logger[_0x15d3('0x23')](_0x23e1f8[_0x15d3('0x24')]);if(_0x23e1f8[_0x15d3('0x25')]){delete _0x23e1f8[_0x15d3('0x25')];}_0x31706f[_0x15d3('0x16')](_0x1cd5bc)[_0x15d3('0x26')](_0x23e1f8);};}exports['show']=function(_0x5f445a,_0x164aa1){var _0x4e5840={'raw':!![],'where':{'id':_0x5f445a['params']['id']}},_0x6a9c0c={};_0x6a9c0c[_0x15d3('0x27')]=_[_0x15d3('0x28')](db['ChatApplication'][_0x15d3('0x29')]);_0x6a9c0c[_0x15d3('0x2a')]=_[_0x15d3('0x28')](_0x5f445a[_0x15d3('0x2a')]);_0x6a9c0c[_0x15d3('0x2b')]=_[_0x15d3('0x2c')](_0x6a9c0c[_0x15d3('0x27')],_0x6a9c0c[_0x15d3('0x2a')]);_0x4e5840[_0x15d3('0x2d')]=_[_0x15d3('0x2c')](_0x6a9c0c['model'],qs[_0x15d3('0x2e')](_0x5f445a[_0x15d3('0x2a')][_0x15d3('0x2e')]));_0x4e5840[_0x15d3('0x2d')]=_0x4e5840[_0x15d3('0x2d')][_0x15d3('0x2f')]?_0x4e5840[_0x15d3('0x2d')]:_0x6a9c0c[_0x15d3('0x27')];if(_0x5f445a['query'][_0x15d3('0x30')]){_0x4e5840['include']=[{'all':!![]}];}_0x4e5840=_[_0x15d3('0x31')]({},_0x4e5840,_0x5f445a[_0x15d3('0x32')]);return db[_0x15d3('0x33')][_0x15d3('0x34')](_0x4e5840)[_0x15d3('0x21')](handleEntityNotFound(_0x164aa1,null))[_0x15d3('0x21')](respondWithResult(_0x164aa1,null))[_0x15d3('0x35')](handleError(_0x164aa1,null));};exports[_0x15d3('0x20')]=function(_0x340d03,_0x20e680){if(_0x340d03[_0x15d3('0x36')]['id']){delete _0x340d03[_0x15d3('0x36')]['id'];}return db[_0x15d3('0x33')][_0x15d3('0x34')]({'where':{'id':_0x340d03[_0x15d3('0x37')]['id']}})['then'](handleEntityNotFound(_0x20e680,null))[_0x15d3('0x21')](saveUpdates(_0x340d03[_0x15d3('0x36')],null))['then'](respondWithResult(_0x20e680,null))[_0x15d3('0x35')](handleError(_0x20e680,null));};exports[_0x15d3('0x22')]=function(_0xd2708,_0x51963f){return db[_0x15d3('0x33')]['find']({'where':{'id':_0xd2708[_0x15d3('0x37')]['id']}})[_0x15d3('0x21')](handleEntityNotFound(_0x51963f,null))['then'](removeEntity(_0x51963f,null))[_0x15d3('0x35')](handleError(_0x51963f,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index f4c2199..31819a2 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 _0xba6c=['request-promise','path','rimraf','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba6c,0x113));var _0xcba6=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xba6c[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0xcba6('0x0'));var util=require('util');var logger=require(_0xcba6('0x1'))(_0xcba6('0x2'));var moment=require(_0xcba6('0x3'));var BPromise=require(_0xcba6('0x4'));var rp=require(_0xcba6('0x5'));var fs=require('fs');var path=require(_0xcba6('0x6'));var rimraf=require(_0xcba6('0x7'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0xcba6('0x8')]=function(_0x1fd901,_0x34d35d){return _0x1fd901[_0xcba6('0x9')](_0xcba6('0xa'),attributes,{'tableName':_0xcba6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcba6('0xc'),'collate':_0xcba6('0xd')});}; \ No newline at end of file +var _0xba54=['bluebird','request-promise','path','rimraf','../../config/environment','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment'];(function(_0x1c79ef,_0x58ef08){var _0x5cc81f=function(_0x4f8ef6){while(--_0x4f8ef6){_0x1c79ef['push'](_0x1c79ef['shift']());}};_0x5cc81f(++_0x58ef08);}(_0xba54,0x176));var _0x4ba5=function(_0x4f9cc2,_0x5097f8){_0x4f9cc2=_0x4f9cc2-0x0;var _0x32b348=_0xba54[_0x4f9cc2];return _0x32b348;};'use strict';var _=require('lodash');var util=require(_0x4ba5('0x0'));var logger=require(_0x4ba5('0x1'))('api');var moment=require(_0x4ba5('0x2'));var BPromise=require(_0x4ba5('0x3'));var rp=require(_0x4ba5('0x4'));var fs=require('fs');var path=require(_0x4ba5('0x5'));var rimraf=require(_0x4ba5('0x6'));var config=require(_0x4ba5('0x7'));var attributes=require('./chatApplication.attributes');module[_0x4ba5('0x8')]=function(_0x293322,_0x1991bb){return _0x293322['define'](_0x4ba5('0x9'),attributes,{'tableName':_0x4ba5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4ba5('0xb'),'collate':_0x4ba5('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 2ed751f..9c6fe60 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 _0x93d1=['client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x93d1,0x12e));var _0x193d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x93d1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x193d('0x0'));var util=require(_0x193d('0x1'));var moment=require(_0x193d('0x2'));var BPromise=require(_0x193d('0x3'));var rs=require(_0x193d('0x4'));var fs=require('fs');var Redis=require(_0x193d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x193d('0x6'));var logger=require(_0x193d('0x7'))(_0x193d('0x8'));var config=require(_0x193d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x193d('0xa')][_0x193d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17e022,_0x303c52,_0x5f1756){return new BPromise(function(_0x24b5b5,_0x1feade){return client[_0x193d('0xc')](_0x17e022,_0x5f1756)['then'](function(_0x5c1efe){logger[_0x193d('0xd')](_0x193d('0xe'),_0x303c52,_0x193d('0xf'));logger[_0x193d('0x10')](_0x193d('0x11'),_0x303c52,'request\x20sent',JSON[_0x193d('0x12')](_0x5c1efe));if(_0x5c1efe[_0x193d('0x13')]){if(_0x5c1efe[_0x193d('0x13')][_0x193d('0x14')]===0x1f4){logger[_0x193d('0x13')](_0x193d('0xe'),_0x303c52,_0x5c1efe['error'][_0x193d('0x15')]);return _0x1feade(_0x5c1efe['error'][_0x193d('0x15')]);}logger[_0x193d('0x13')](_0x193d('0xe'),_0x303c52,_0x5c1efe[_0x193d('0x13')][_0x193d('0x15')]);return _0x24b5b5(_0x5c1efe[_0x193d('0x13')][_0x193d('0x15')]);}else{logger[_0x193d('0xd')]('ChatApplication,\x20%s,\x20%s',_0x303c52,'request\x20sent');_0x24b5b5(_0x5c1efe[_0x193d('0x16')][_0x193d('0x15')]);}})[_0x193d('0x17')](function(_0x3f874b){logger[_0x193d('0x13')]('ChatApplication,\x20%s,\x20%s',_0x303c52,_0x3f874b);_0x1feade(_0x3f874b);});});} \ No newline at end of file +var _0x707f=['info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xdbd686,_0x4acde5){var _0x2a60e5=function(_0x571784){while(--_0x571784){_0xdbd686['push'](_0xdbd686['shift']());}};_0x2a60e5(++_0x4acde5);}(_0x707f,0x18e));var _0xf707=function(_0x2848b0,_0x599922){_0x2848b0=_0x2848b0-0x0;var _0x5c085d=_0x707f[_0x2848b0];return _0x5c085d;};'use strict';var _=require(_0xf707('0x0'));var util=require(_0xf707('0x1'));var moment=require(_0xf707('0x2'));var BPromise=require('bluebird');var rs=require(_0xf707('0x3'));var fs=require('fs');var Redis=require(_0xf707('0x4'));var db=require(_0xf707('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf707('0x6'))(_0xf707('0x7'));var config=require(_0xf707('0x8'));var jayson=require(_0xf707('0x9'));var client=jayson[_0xf707('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x222a0c,_0x57df7e,_0x1f2ef){return new BPromise(function(_0x2a0e90,_0x345b43){return client[_0xf707('0xb')](_0x222a0c,_0x1f2ef)[_0xf707('0xc')](function(_0x4684ab){logger['info'](_0xf707('0xd'),_0x57df7e,_0xf707('0xe'));logger['debug'](_0xf707('0xf'),_0x57df7e,_0xf707('0xe'),JSON[_0xf707('0x10')](_0x4684ab));if(_0x4684ab['error']){if(_0x4684ab[_0xf707('0x11')][_0xf707('0x12')]===0x1f4){logger[_0xf707('0x11')](_0xf707('0xd'),_0x57df7e,_0x4684ab['error'][_0xf707('0x13')]);return _0x345b43(_0x4684ab[_0xf707('0x11')][_0xf707('0x13')]);}logger[_0xf707('0x11')](_0xf707('0xd'),_0x57df7e,_0x4684ab[_0xf707('0x11')][_0xf707('0x13')]);return _0x2a0e90(_0x4684ab[_0xf707('0x11')][_0xf707('0x13')]);}else{logger[_0xf707('0x14')](_0xf707('0xd'),_0x57df7e,_0xf707('0xe'));_0x2a0e90(_0x4684ab[_0xf707('0x15')][_0xf707('0x13')]);}})['catch'](function(_0x2a5518){logger[_0xf707('0x11')](_0xf707('0xd'),_0x57df7e,_0x2a5518);_0x345b43(_0x2a5518);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 19b01aa..262b5ce 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 _0xff51=['./chatApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x427731,_0x298994){var _0x1f7ffe=function(_0x26cb5d){while(--_0x26cb5d){_0x427731['push'](_0x427731['shift']());}};_0x1f7ffe(++_0x298994);}(_0xff51,0xb9));var _0x1ff5=function(_0x12daa3,_0x5725c8){_0x12daa3=_0x12daa3-0x0;var _0x219113=_0xff51[_0x12daa3];return _0x219113;};'use strict';var multer=require(_0x1ff5('0x0'));var util=require(_0x1ff5('0x1'));var path=require(_0x1ff5('0x2'));var timeout=require(_0x1ff5('0x3'));var express=require('express');var router=express[_0x1ff5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1ff5('0x5'));var config=require(_0x1ff5('0x6'));var controller=require(_0x1ff5('0x7'));router[_0x1ff5('0x8')](_0x1ff5('0x9'),auth[_0x1ff5('0xa')](),controller[_0x1ff5('0xb')]);router[_0x1ff5('0xc')]('/:id',auth[_0x1ff5('0xa')](),controller['update']);router[_0x1ff5('0xd')](_0x1ff5('0x9'),auth[_0x1ff5('0xa')](),controller[_0x1ff5('0xe')]);module[_0x1ff5('0xf')]=router; \ No newline at end of file +var _0x28ac=['destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','show','put','/:id','delete'];(function(_0x3d9565,_0x5db973){var _0x546f66=function(_0x137352){while(--_0x137352){_0x3d9565['push'](_0x3d9565['shift']());}};_0x546f66(++_0x5db973);}(_0x28ac,0x1d3));var _0xc28a=function(_0x5eedb0,_0x4de7c2){_0x5eedb0=_0x5eedb0-0x0;var _0x1c6169=_0x28ac[_0x5eedb0];return _0x1c6169;};'use strict';var multer=require('multer');var util=require(_0xc28a('0x0'));var path=require(_0xc28a('0x1'));var timeout=require(_0xc28a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc28a('0x3'));var interaction=require(_0xc28a('0x4'));var config=require(_0xc28a('0x5'));var controller=require(_0xc28a('0x6'));router[_0xc28a('0x7')]('/:id',auth[_0xc28a('0x8')](),controller[_0xc28a('0x9')]);router[_0xc28a('0xa')](_0xc28a('0xb'),auth[_0xc28a('0x8')](),controller['update']);router[_0xc28a('0xc')](_0xc28a('0xb'),auth[_0xc28a('0x8')](),controller[_0xc28a('0xd')]);module[_0xc28a('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 4200964..3c5e499 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 _0xc5a2=['STRING','BOOLEAN','sequelize'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0xc5a2,0x149));var _0x2c5a=function(_0x4cfab7,_0x1a8211){_0x4cfab7=_0x4cfab7-0x0;var _0x5498be=_0xc5a2[_0x4cfab7];return _0x5498be;};'use strict';var Sequelize=require(_0x2c5a('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c5a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x2c5a('0x1')]},'write':{'type':Sequelize[_0x2c5a('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xad30=['STRING','BOOLEAN','sequelize','exports'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0xad30,0x82));var _0x0ad3=function(_0x46c25c,_0x43f24b){_0x46c25c=_0x46c25c-0x0;var _0x477fca=_0xad30[_0x46c25c];return _0x477fca;};'use strict';var Sequelize=require(_0x0ad3('0x0'));module[_0x0ad3('0x1')]={'name':{'type':Sequelize[_0x0ad3('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x0ad3('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 90d3435..48ff015 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 _0xb805=['pick','filter','merge','options','ChatGroup','includeAll','include','findAll','rows','show','params','length','create','body','catch','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','addMessage','ChatGroupId','$gte','getMessages','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','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','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2dbfb5,_0x621e9a){var _0x3ae10a=function(_0x2fbe51){while(--_0x2fbe51){_0x2dbfb5['push'](_0x2dbfb5['shift']());}};_0x3ae10a(++_0x621e9a);}(_0xb805,0x83));var _0x5b80=function(_0x13b2e5,_0x148e0d){_0x13b2e5=_0x13b2e5-0x0;var _0xc6e78c=_0xb805[_0x13b2e5];return _0xc6e78c;};'use strict';var emlformat=require(_0x5b80('0x0'));var rimraf=require(_0x5b80('0x1'));var zipdir=require(_0x5b80('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5b80('0x3'));var moment=require(_0x5b80('0x4'));var BPromise=require(_0x5b80('0x5'));var Mustache=require(_0x5b80('0x6'));var util=require(_0x5b80('0x7'));var path=require(_0x5b80('0x8'));var sox=require(_0x5b80('0x9'));var csv=require('to-csv');var ejs=require(_0x5b80('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b80('0xb'));var squel=require(_0x5b80('0xc'));var crypto=require(_0x5b80('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5b80('0xe'));var querystring=require(_0x5b80('0xf'));var Papa=require(_0x5b80('0x10'));var Redis=require(_0x5b80('0x11'));var authService=require(_0x5b80('0x12'));var qs=require(_0x5b80('0x13'));var as=require(_0x5b80('0x14'));var hardwareService=require(_0x5b80('0x15'));var logger=require(_0x5b80('0x16'))(_0x5b80('0x17'));var utils=require(_0x5b80('0x18'));var config=require(_0x5b80('0x19'));var licenseUtil=require(_0x5b80('0x1a'));var db=require(_0x5b80('0x1b'))['db'];config[_0x5b80('0x1c')]=_['defaults'](config[_0x5b80('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x5b80('0x1d'))(new Redis(config['redis']));require(_0x5b80('0x1e'))[_0x5b80('0x1f')](socket);function respondWithStatusCode(_0x2a9a59,_0x5264fa){_0x5264fa=_0x5264fa||0xcc;return function(_0x439805){if(_0x439805){return _0x2a9a59[_0x5b80('0x20')](_0x5264fa);}return _0x2a9a59[_0x5b80('0x21')](_0x5264fa)[_0x5b80('0x22')]();};}function respondWithResult(_0x1f881d,_0x2793cb){_0x2793cb=_0x2793cb||0xc8;return function(_0x14c29d){if(_0x14c29d){return _0x1f881d[_0x5b80('0x21')](_0x2793cb)[_0x5b80('0x23')](_0x14c29d);}};}function respondWithFilteredResult(_0x2b88a8,_0x4028ee){return function(_0x1bd60e){if(_0x1bd60e){var _0x1cc8b9=typeof _0x4028ee[_0x5b80('0x24')]===_0x5b80('0x25')&&typeof _0x4028ee[_0x5b80('0x26')]==='undefined';var _0x5f1442=_0x1bd60e[_0x5b80('0x27')];var _0xfbe2e7=_0x1cc8b9?0x0:_0x4028ee[_0x5b80('0x24')];var _0x300bc8=_0x1cc8b9?_0x1bd60e['count']:_0x4028ee[_0x5b80('0x24')]+_0x4028ee[_0x5b80('0x26')];var _0x28f77e;if(_0x300bc8>=_0x5f1442){_0x300bc8=_0x5f1442;_0x28f77e=0xc8;}else{_0x28f77e=0xce;}_0x2b88a8[_0x5b80('0x21')](_0x28f77e);return _0x2b88a8[_0x5b80('0x28')](_0x5b80('0x29'),_0xfbe2e7+'-'+_0x300bc8+'/'+_0x5f1442)[_0x5b80('0x23')](_0x1bd60e);}return null;};}function patchUpdates(_0x54c115){return function(_0x3c07ba){try{jsonpatch[_0x5b80('0x2a')](_0x3c07ba,_0x54c115,!![]);}catch(_0x323fbe){return BPromise[_0x5b80('0x2b')](_0x323fbe);}return _0x3c07ba['save']();};}function saveUpdates(_0xed32a6,_0x263782){return function(_0x39afb3){if(_0x39afb3){return _0x39afb3[_0x5b80('0x2c')](_0xed32a6)[_0x5b80('0x2d')](function(_0x564607){return _0x564607;});}return null;};}function removeEntity(_0x4bffb5,_0x401284){return function(_0x164af4){if(_0x164af4){return _0x164af4[_0x5b80('0x2e')]()['then'](function(){_0x4bffb5[_0x5b80('0x21')](0xcc)[_0x5b80('0x22')]();});}};}function handleEntityNotFound(_0x29ebb4,_0x145b82){return function(_0x428eae){if(!_0x428eae){_0x29ebb4[_0x5b80('0x20')](0x194);}return _0x428eae;};}function handleError(_0x3bf415,_0x3e0219){_0x3e0219=_0x3e0219||0x1f4;return function(_0x340ca5){logger[_0x5b80('0x2f')](_0x340ca5[_0x5b80('0x30')]);if(_0x340ca5[_0x5b80('0x31')]){delete _0x340ca5[_0x5b80('0x31')];}_0x3bf415['status'](_0x3e0219)[_0x5b80('0x32')](_0x340ca5);};}exports[_0x5b80('0x33')]=function(_0x2ae8da,_0x2b1698){var _0x565c51={},_0x1d9799={},_0x13201c={'count':0x0,'rows':[]};var _0x1a8264=_[_0x5b80('0x34')](db['ChatGroup'][_0x5b80('0x35')],function(_0x2b53e7){return{'name':_0x2b53e7[_0x5b80('0x36')],'type':_0x2b53e7[_0x5b80('0x37')][_0x5b80('0x38')]};});_0x1d9799['model']=_[_0x5b80('0x34')](_0x1a8264,_0x5b80('0x31'));_0x1d9799['query']=_[_0x5b80('0x39')](_0x2ae8da[_0x5b80('0x3a')]);_0x1d9799[_0x5b80('0x3b')]=_[_0x5b80('0x3c')](_0x1d9799[_0x5b80('0x3d')],_0x1d9799[_0x5b80('0x3a')]);_0x565c51[_0x5b80('0x3e')]=_[_0x5b80('0x3c')](_0x1d9799[_0x5b80('0x3d')],qs[_0x5b80('0x3f')](_0x2ae8da[_0x5b80('0x3a')]['fields']));_0x565c51[_0x5b80('0x3e')]=_0x565c51['attributes']['length']?_0x565c51['attributes']:_0x1d9799['model'];if(!_0x2ae8da[_0x5b80('0x3a')][_0x5b80('0x40')](_0x5b80('0x41'))){_0x565c51[_0x5b80('0x26')]=qs['limit'](_0x2ae8da['query']['limit']);_0x565c51[_0x5b80('0x24')]=qs[_0x5b80('0x24')](_0x2ae8da[_0x5b80('0x3a')][_0x5b80('0x24')]);}_0x565c51[_0x5b80('0x42')]=qs['sort'](_0x2ae8da[_0x5b80('0x3a')][_0x5b80('0x43')]);_0x565c51[_0x5b80('0x44')]=qs['filters'](_[_0x5b80('0x45')](_0x2ae8da[_0x5b80('0x3a')],_0x1d9799[_0x5b80('0x3b')]),_0x1a8264);if(_0x2ae8da['query'][_0x5b80('0x46')]){_0x565c51[_0x5b80('0x44')]=_[_0x5b80('0x47')](_0x565c51[_0x5b80('0x44')],{'$or':_[_0x5b80('0x34')](_0x1a8264,function(_0x56ec0e){if(_0x56ec0e[_0x5b80('0x37')]!=='VIRTUAL'){var _0x4289c0={};_0x4289c0[_0x56ec0e[_0x5b80('0x31')]]={'$like':'%'+_0x2ae8da[_0x5b80('0x3a')][_0x5b80('0x46')]+'%'};return _0x4289c0;}})});}_0x565c51=_['merge']({},_0x565c51,_0x2ae8da[_0x5b80('0x48')]);var _0x38e22b={'where':_0x565c51[_0x5b80('0x44')]};return db[_0x5b80('0x49')][_0x5b80('0x27')](_0x38e22b)[_0x5b80('0x2d')](function(_0x47acbd){_0x13201c[_0x5b80('0x27')]=_0x47acbd;if(_0x2ae8da[_0x5b80('0x3a')][_0x5b80('0x4a')]){_0x565c51[_0x5b80('0x4b')]=[{'all':!![]}];}return db['ChatGroup'][_0x5b80('0x4c')](_0x565c51);})[_0x5b80('0x2d')](function(_0x42bc48){_0x13201c[_0x5b80('0x4d')]=_0x42bc48;return _0x13201c;})[_0x5b80('0x2d')](respondWithFilteredResult(_0x2b1698,_0x565c51))['catch'](handleError(_0x2b1698,null));};exports[_0x5b80('0x4e')]=function(_0x133ebd,_0x5823d8){var _0x593d42={'raw':!![],'where':{'id':_0x133ebd[_0x5b80('0x4f')]['id']}},_0x233bda={};_0x233bda[_0x5b80('0x3d')]=_[_0x5b80('0x39')](db['ChatGroup'][_0x5b80('0x35')]);_0x233bda[_0x5b80('0x3a')]=_['keys'](_0x133ebd[_0x5b80('0x3a')]);_0x233bda['filters']=_[_0x5b80('0x3c')](_0x233bda[_0x5b80('0x3d')],_0x233bda['query']);_0x593d42[_0x5b80('0x3e')]=_['intersection'](_0x233bda[_0x5b80('0x3d')],qs['fields'](_0x133ebd['query'][_0x5b80('0x3f')]));_0x593d42[_0x5b80('0x3e')]=_0x593d42[_0x5b80('0x3e')][_0x5b80('0x50')]?_0x593d42[_0x5b80('0x3e')]:_0x233bda['model'];if(_0x133ebd[_0x5b80('0x3a')][_0x5b80('0x4a')]){_0x593d42[_0x5b80('0x4b')]=[{'all':!![]}];}_0x593d42=_[_0x5b80('0x47')]({},_0x593d42,_0x133ebd[_0x5b80('0x48')]);return db[_0x5b80('0x49')]['find'](_0x593d42)[_0x5b80('0x2d')](handleEntityNotFound(_0x5823d8,null))[_0x5b80('0x2d')](respondWithResult(_0x5823d8,null))['catch'](handleError(_0x5823d8,null));};exports[_0x5b80('0x51')]=function(_0x406418,_0x17e8d6){return db[_0x5b80('0x49')][_0x5b80('0x51')](_0x406418[_0x5b80('0x52')],{})[_0x5b80('0x2d')](respondWithResult(_0x17e8d6,0xc9))[_0x5b80('0x53')](handleError(_0x17e8d6,null));};exports['update']=function(_0x2feaa4,_0x4a2148){if(_0x2feaa4[_0x5b80('0x52')]['id']){delete _0x2feaa4[_0x5b80('0x52')]['id'];}return db[_0x5b80('0x49')]['find']({'where':{'id':_0x2feaa4['params']['id']}})[_0x5b80('0x2d')](handleEntityNotFound(_0x4a2148,null))[_0x5b80('0x2d')](saveUpdates(_0x2feaa4[_0x5b80('0x52')],null))['then'](respondWithResult(_0x4a2148,null))['catch'](handleError(_0x4a2148,null));};exports[_0x5b80('0x2e')]=function(_0x1bbe9f,_0x284e4d){return db[_0x5b80('0x49')][_0x5b80('0x54')]({'where':{'id':_0x1bbe9f[_0x5b80('0x4f')]['id']}})[_0x5b80('0x2d')](handleEntityNotFound(_0x284e4d,null))['then'](removeEntity(_0x284e4d,null))[_0x5b80('0x53')](handleError(_0x284e4d,null));};exports[_0x5b80('0x55')]=function(_0x536ad8,_0x4013b7){return db[_0x5b80('0x49')]['describe']()[_0x5b80('0x2d')](respondWithResult(_0x4013b7,null))[_0x5b80('0x53')](handleError(_0x4013b7,null));};exports[_0x5b80('0x56')]=function(_0x2f30e8,_0x3c3d09,_0x5573e8){return db[_0x5b80('0x57')][_0x5b80('0x27')]({'where':{'ChatGroupId':_0x2f30e8[_0x5b80('0x4f')]['id'],'ToId':_0x2f30e8[_0x5b80('0x58')]['id'],'read':![]}})[_0x5b80('0x2d')](function(_0x5e3639){return{'id':_[_0x5b80('0x59')](_0x2f30e8[_0x5b80('0x4f')]['id']),'count':_0x5e3639};})['then'](respondWithResult(_0x3c3d09,null))[_0x5b80('0x53')](handleError(_0x3c3d09,null));};exports[_0x5b80('0x5a')]=function(_0x24b6cf,_0x46049a,_0x35d0d7){return db[_0x5b80('0x49')][_0x5b80('0x54')]({'where':{'id':_0x24b6cf[_0x5b80('0x4f')]['id']}})['then'](handleEntityNotFound(_0x46049a,null))['then'](function(_0x57fde1){if(_0x57fde1){return _0x57fde1[_0x5b80('0x5a')](_0x24b6cf[_0x5b80('0x52')][_0x5b80('0x5b')],_[_0x5b80('0x5c')](_0x24b6cf['body'],[_0x5b80('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x46049a,null))[_0x5b80('0x53')](handleError(_0x46049a,null));};exports[_0x5b80('0x5d')]=function(_0x14ba7c,_0x174761,_0x469692){var _0x5d1a88={};var _0x36172e={};var _0x5a73fa;var _0x339ddc;return db['ChatGroup'][_0x5b80('0x5e')]({'where':{'id':_0x14ba7c[_0x5b80('0x4f')]['id']}})['then'](handleEntityNotFound(_0x174761,null))[_0x5b80('0x2d')](function(_0x3345c2){if(_0x3345c2){_0x5a73fa=_0x3345c2;_0x36172e[_0x5b80('0x3d')]=_[_0x5b80('0x39')](db[_0x5b80('0x5f')][_0x5b80('0x35')]);_0x36172e['query']=_[_0x5b80('0x39')](_0x14ba7c['query']);_0x36172e['filters']=_[_0x5b80('0x3c')](_0x36172e[_0x5b80('0x3d')],_0x36172e[_0x5b80('0x3a')]);_0x5d1a88[_0x5b80('0x3e')]=_[_0x5b80('0x3c')](_0x36172e[_0x5b80('0x3d')],qs[_0x5b80('0x3f')](_0x14ba7c['query']['fields']));_0x5d1a88[_0x5b80('0x3e')]=_0x5d1a88[_0x5b80('0x3e')]['length']?_0x5d1a88[_0x5b80('0x3e')]:_0x36172e[_0x5b80('0x3d')];_0x5d1a88[_0x5b80('0x42')]=qs['sort'](_0x14ba7c[_0x5b80('0x3a')]['sort']);_0x5d1a88[_0x5b80('0x44')]=qs['filters'](_[_0x5b80('0x45')](_0x14ba7c[_0x5b80('0x3a')],_0x36172e[_0x5b80('0x3b')]));if(_0x14ba7c[_0x5b80('0x3a')][_0x5b80('0x46')]){_0x5d1a88[_0x5b80('0x44')]=_[_0x5b80('0x47')](_0x5d1a88[_0x5b80('0x44')],{'$or':_[_0x5b80('0x34')](_0x5d1a88[_0x5b80('0x3e')],function(_0x1c96d5){var _0x2e394b={};_0x2e394b[_0x1c96d5]={'$like':'%'+_0x14ba7c[_0x5b80('0x3a')][_0x5b80('0x46')]+'%'};return _0x2e394b;})});}_0x5d1a88=_[_0x5b80('0x47')]({},_0x5d1a88,_0x14ba7c['options']);return _0x5a73fa['getMembers'](_0x5d1a88);}})[_0x5b80('0x2d')](function(_0x186a34){if(_0x186a34){_0x339ddc=_0x186a34[_0x5b80('0x50')];if(!_0x14ba7c[_0x5b80('0x3a')]['hasOwnProperty'](_0x5b80('0x41'))){_0x5d1a88[_0x5b80('0x26')]=qs[_0x5b80('0x26')](_0x14ba7c[_0x5b80('0x3a')][_0x5b80('0x26')]);_0x5d1a88[_0x5b80('0x24')]=qs['offset'](_0x14ba7c[_0x5b80('0x3a')][_0x5b80('0x24')]);}return _0x5a73fa['getMembers'](_0x5d1a88);}})[_0x5b80('0x2d')](function(_0x3352f8){if(_0x3352f8){return _0x3352f8?{'count':_0x339ddc,'rows':_0x3352f8}:null;}})['then'](respondWithResult(_0x174761,null))['catch'](handleError(_0x174761,null));};exports['removeMembers']=function(_0x2357d0,_0x1621f9,_0x362602){return db[_0x5b80('0x49')]['find']({'where':{'id':_0x2357d0[_0x5b80('0x4f')]['id']}})[_0x5b80('0x2d')](handleEntityNotFound(_0x1621f9,null))[_0x5b80('0x2d')](function(_0x231687){if(_0x231687){return _0x231687['removeMembers'](_0x2357d0[_0x5b80('0x3a')][_0x5b80('0x5b')]);}})[_0x5b80('0x2d')](respondWithStatusCode(_0x1621f9,null))['catch'](handleError(_0x1621f9,null));};exports[_0x5b80('0x60')]=function(_0x4f2f00,_0x5c4def,_0x16602e){if(_0x4f2f00[_0x5b80('0x52')]['id']){delete _0x4f2f00[_0x5b80('0x52')]['id'];}return db[_0x5b80('0x49')]['find']({'where':{'id':_0x4f2f00[_0x5b80('0x4f')]['id']}})[_0x5b80('0x2d')](handleEntityNotFound(_0x5c4def,null))[_0x5b80('0x2d')](function(_0x188db9){if(_0x188db9){_0x4f2f00['body'][_0x5b80('0x61')]=_0x188db9['id'];return db[_0x5b80('0x57')][_0x5b80('0x51')](_0x4f2f00['body']);}})[_0x5b80('0x2d')](respondWithResult(_0x5c4def,null))[_0x5b80('0x53')](handleError(_0x5c4def,null));};exports['getMessages']=function(_0x4bc7a6,_0x216dbe,_0x11076a){var _0x2f78b8={};var _0xfba637={};var _0x3996ce;var _0x38ba51;return db['ChatGroup'][_0x5b80('0x5e')]({'where':{'id':_0x4bc7a6[_0x5b80('0x4f')]['id']}})[_0x5b80('0x2d')](handleEntityNotFound(_0x216dbe,null))[_0x5b80('0x2d')](function(_0xb3bacb){if(_0xb3bacb){_0x3996ce=_0xb3bacb;_0xfba637[_0x5b80('0x3d')]=_[_0x5b80('0x39')](db[_0x5b80('0x57')]['rawAttributes']);_0xfba637[_0x5b80('0x3a')]=_[_0x5b80('0x39')](_0x4bc7a6[_0x5b80('0x3a')]);_0xfba637[_0x5b80('0x3b')]=_[_0x5b80('0x3c')](_0xfba637[_0x5b80('0x3d')],_0xfba637[_0x5b80('0x3a')]);_0x2f78b8[_0x5b80('0x3e')]=_[_0x5b80('0x3c')](_0xfba637[_0x5b80('0x3d')],qs[_0x5b80('0x3f')](_0x4bc7a6[_0x5b80('0x3a')][_0x5b80('0x3f')]));_0x2f78b8[_0x5b80('0x3e')]=_0x2f78b8[_0x5b80('0x3e')][_0x5b80('0x50')]?_0x2f78b8[_0x5b80('0x3e')]:_0xfba637[_0x5b80('0x3d')];_0x2f78b8[_0x5b80('0x42')]=qs['sort'](_0x4bc7a6['query'][_0x5b80('0x43')]);_0x2f78b8[_0x5b80('0x44')]=qs[_0x5b80('0x3b')](_[_0x5b80('0x45')](_0x4bc7a6[_0x5b80('0x3a')],_0xfba637[_0x5b80('0x3b')]));if(_0x4bc7a6[_0x5b80('0x3a')][_0x5b80('0x46')]){_0x2f78b8[_0x5b80('0x44')]=_['merge'](_0x2f78b8['where'],{'$or':_[_0x5b80('0x34')](_0x2f78b8[_0x5b80('0x3e')],function(_0xb131db){var _0x274012={};_0x274012[_0xb131db]={'$like':'%'+_0x4bc7a6[_0x5b80('0x3a')][_0x5b80('0x46')]+'%'};return _0x274012;})});}if(_0x4bc7a6[_0x5b80('0x3a')][_0x5b80('0x62')]){var _0x16a94e=_0x4bc7a6[_0x5b80('0x3a')][_0x5b80('0x62')]['split'](',');var _0x1a845c={};_0x1a845c[_0x16a94e[0x0]]={'$gte':moment(_0x16a94e[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2f78b8[_0x5b80('0x44')]=_[_0x5b80('0x47')](_0x2f78b8['where'],_0x1a845c);}_0x2f78b8=_[_0x5b80('0x47')]({},_0x2f78b8,_0x4bc7a6[_0x5b80('0x48')]);return _0x3996ce['getMessages'](_0x2f78b8);}})[_0x5b80('0x2d')](function(_0x4c565b){if(_0x4c565b){_0x38ba51=_0x4c565b['length'];if(!_0x4bc7a6[_0x5b80('0x3a')][_0x5b80('0x40')]('nolimit')){_0x2f78b8['limit']=qs['limit'](_0x4bc7a6[_0x5b80('0x3a')][_0x5b80('0x26')]);_0x2f78b8[_0x5b80('0x24')]=qs[_0x5b80('0x24')](_0x4bc7a6[_0x5b80('0x3a')]['offset']);}return _0x3996ce[_0x5b80('0x63')](_0x2f78b8);}})['then'](function(_0x1921e8){if(_0x1921e8){return _0x1921e8?{'count':_0x38ba51,'rows':_0x1921e8}:null;}})[_0x5b80('0x2d')](respondWithResult(_0x216dbe,null))['catch'](handleError(_0x216dbe,null));}; \ No newline at end of file +var _0x6854=['ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','apply','reject','update','destroy','then','error','stack','name','send','index','map'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x6854,0x1bc));var _0x4685=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x6854[_0x22e9fe];return _0x47cd19;};'use strict';var emlformat=require(_0x4685('0x0'));var rimraf=require(_0x4685('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4685('0x2'));var rp=require('request-promise');var moment=require(_0x4685('0x3'));var BPromise=require(_0x4685('0x4'));var Mustache=require('mustache');var util=require(_0x4685('0x5'));var path=require(_0x4685('0x6'));var sox=require(_0x4685('0x7'));var csv=require(_0x4685('0x8'));var ejs=require(_0x4685('0x9'));var fs=require('fs');var fs_extra=require(_0x4685('0xa'));var _=require('lodash');var squel=require(_0x4685('0xb'));var crypto=require(_0x4685('0xc'));var jsforce=require(_0x4685('0xd'));var deskjs=require(_0x4685('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4685('0xf'));var Papa=require(_0x4685('0x10'));var Redis=require(_0x4685('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4685('0x12'));var hardwareService=require(_0x4685('0x13'));var logger=require(_0x4685('0x14'))(_0x4685('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4685('0x16'));var db=require(_0x4685('0x17'))['db'];config[_0x4685('0x18')]=_['defaults'](config[_0x4685('0x18')],{'host':_0x4685('0x19'),'port':0x18eb});var socket=require(_0x4685('0x1a'))(new Redis(config[_0x4685('0x18')]));require('./chatGroup.socket')[_0x4685('0x1b')](socket);function respondWithStatusCode(_0x4cf0c1,_0x2133ca){_0x2133ca=_0x2133ca||0xcc;return function(_0x13c5c3){if(_0x13c5c3){return _0x4cf0c1[_0x4685('0x1c')](_0x2133ca);}return _0x4cf0c1[_0x4685('0x1d')](_0x2133ca)[_0x4685('0x1e')]();};}function respondWithResult(_0x403f2b,_0x392f5e){_0x392f5e=_0x392f5e||0xc8;return function(_0x51518c){if(_0x51518c){return _0x403f2b['status'](_0x392f5e)[_0x4685('0x1f')](_0x51518c);}};}function respondWithFilteredResult(_0x23bd52,_0x57460b){return function(_0x1983f4){if(_0x1983f4){var _0x32339c=typeof _0x57460b[_0x4685('0x20')]===_0x4685('0x21')&&typeof _0x57460b['limit']===_0x4685('0x21');var _0x5b9f84=_0x1983f4[_0x4685('0x22')];var _0x52dac5=_0x32339c?0x0:_0x57460b['offset'];var _0x3a975b=_0x32339c?_0x1983f4[_0x4685('0x22')]:_0x57460b[_0x4685('0x20')]+_0x57460b['limit'];var _0x4c8927;if(_0x3a975b>=_0x5b9f84){_0x3a975b=_0x5b9f84;_0x4c8927=0xc8;}else{_0x4c8927=0xce;}_0x23bd52[_0x4685('0x1d')](_0x4c8927);return _0x23bd52['set']('Content-Range',_0x52dac5+'-'+_0x3a975b+'/'+_0x5b9f84)['json'](_0x1983f4);}return null;};}function patchUpdates(_0x3cef06){return function(_0x598fed){try{jsonpatch[_0x4685('0x23')](_0x598fed,_0x3cef06,!![]);}catch(_0x686cac){return BPromise[_0x4685('0x24')](_0x686cac);}return _0x598fed['save']();};}function saveUpdates(_0x258c2c,_0x450fdf){return function(_0x105b73){if(_0x105b73){return _0x105b73[_0x4685('0x25')](_0x258c2c)['then'](function(_0x58dfbb){return _0x58dfbb;});}return null;};}function removeEntity(_0x20a4e6,_0x5af936){return function(_0x93ca64){if(_0x93ca64){return _0x93ca64[_0x4685('0x26')]()[_0x4685('0x27')](function(){_0x20a4e6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c4199,_0x53d232){return function(_0xcdad03){if(!_0xcdad03){_0x2c4199[_0x4685('0x1c')](0x194);}return _0xcdad03;};}function handleError(_0x16a7f2,_0x157779){_0x157779=_0x157779||0x1f4;return function(_0x2ec74a){logger[_0x4685('0x28')](_0x2ec74a[_0x4685('0x29')]);if(_0x2ec74a[_0x4685('0x2a')]){delete _0x2ec74a[_0x4685('0x2a')];}_0x16a7f2[_0x4685('0x1d')](_0x157779)[_0x4685('0x2b')](_0x2ec74a);};}exports[_0x4685('0x2c')]=function(_0x38d10d,_0x1f5624){var _0x5db6eb={},_0x456ea3={},_0x13406f={'count':0x0,'rows':[]};var _0x190e65=_[_0x4685('0x2d')](db[_0x4685('0x2e')][_0x4685('0x2f')],function(_0x157d2f){return{'name':_0x157d2f[_0x4685('0x30')],'type':_0x157d2f[_0x4685('0x31')][_0x4685('0x32')]};});_0x456ea3[_0x4685('0x33')]=_[_0x4685('0x2d')](_0x190e65,'name');_0x456ea3[_0x4685('0x34')]=_[_0x4685('0x35')](_0x38d10d['query']);_0x456ea3['filters']=_[_0x4685('0x36')](_0x456ea3[_0x4685('0x33')],_0x456ea3[_0x4685('0x34')]);_0x5db6eb[_0x4685('0x37')]=_[_0x4685('0x36')](_0x456ea3[_0x4685('0x33')],qs['fields'](_0x38d10d[_0x4685('0x34')][_0x4685('0x38')]));_0x5db6eb[_0x4685('0x37')]=_0x5db6eb[_0x4685('0x37')][_0x4685('0x39')]?_0x5db6eb[_0x4685('0x37')]:_0x456ea3[_0x4685('0x33')];if(!_0x38d10d[_0x4685('0x34')]['hasOwnProperty'](_0x4685('0x3a'))){_0x5db6eb[_0x4685('0x3b')]=qs[_0x4685('0x3b')](_0x38d10d[_0x4685('0x34')]['limit']);_0x5db6eb[_0x4685('0x20')]=qs['offset'](_0x38d10d[_0x4685('0x34')][_0x4685('0x20')]);}_0x5db6eb[_0x4685('0x3c')]=qs[_0x4685('0x3d')](_0x38d10d[_0x4685('0x34')][_0x4685('0x3d')]);_0x5db6eb[_0x4685('0x3e')]=qs[_0x4685('0x3f')](_[_0x4685('0x40')](_0x38d10d['query'],_0x456ea3[_0x4685('0x3f')]),_0x190e65);if(_0x38d10d[_0x4685('0x34')][_0x4685('0x41')]){_0x5db6eb[_0x4685('0x3e')]=_[_0x4685('0x42')](_0x5db6eb['where'],{'$or':_[_0x4685('0x2d')](_0x190e65,function(_0x3d3c3b){if(_0x3d3c3b[_0x4685('0x31')]!==_0x4685('0x43')){var _0x477e31={};_0x477e31[_0x3d3c3b[_0x4685('0x2a')]]={'$like':'%'+_0x38d10d[_0x4685('0x34')]['filter']+'%'};return _0x477e31;}})});}_0x5db6eb=_['merge']({},_0x5db6eb,_0x38d10d['options']);var _0x5cbcb5={'where':_0x5db6eb[_0x4685('0x3e')]};return db[_0x4685('0x2e')]['count'](_0x5cbcb5)['then'](function(_0x4e9685){_0x13406f[_0x4685('0x22')]=_0x4e9685;if(_0x38d10d[_0x4685('0x34')][_0x4685('0x44')]){_0x5db6eb[_0x4685('0x45')]=[{'all':!![]}];}return db['ChatGroup'][_0x4685('0x46')](_0x5db6eb);})[_0x4685('0x27')](function(_0x59fe7f){_0x13406f[_0x4685('0x47')]=_0x59fe7f;return _0x13406f;})[_0x4685('0x27')](respondWithFilteredResult(_0x1f5624,_0x5db6eb))[_0x4685('0x48')](handleError(_0x1f5624,null));};exports[_0x4685('0x49')]=function(_0x378cf4,_0x4b9347){var _0x584e55={'raw':!![],'where':{'id':_0x378cf4[_0x4685('0x4a')]['id']}},_0x282edf={};_0x282edf[_0x4685('0x33')]=_['keys'](db[_0x4685('0x2e')]['rawAttributes']);_0x282edf[_0x4685('0x34')]=_[_0x4685('0x35')](_0x378cf4[_0x4685('0x34')]);_0x282edf[_0x4685('0x3f')]=_[_0x4685('0x36')](_0x282edf[_0x4685('0x33')],_0x282edf['query']);_0x584e55['attributes']=_[_0x4685('0x36')](_0x282edf[_0x4685('0x33')],qs['fields'](_0x378cf4['query'][_0x4685('0x38')]));_0x584e55[_0x4685('0x37')]=_0x584e55[_0x4685('0x37')]['length']?_0x584e55[_0x4685('0x37')]:_0x282edf[_0x4685('0x33')];if(_0x378cf4[_0x4685('0x34')][_0x4685('0x44')]){_0x584e55[_0x4685('0x45')]=[{'all':!![]}];}_0x584e55=_[_0x4685('0x42')]({},_0x584e55,_0x378cf4[_0x4685('0x4b')]);return db[_0x4685('0x2e')][_0x4685('0x4c')](_0x584e55)[_0x4685('0x27')](handleEntityNotFound(_0x4b9347,null))[_0x4685('0x27')](respondWithResult(_0x4b9347,null))[_0x4685('0x48')](handleError(_0x4b9347,null));};exports[_0x4685('0x4d')]=function(_0x4df786,_0x452515){return db[_0x4685('0x2e')][_0x4685('0x4d')](_0x4df786['body'],{})[_0x4685('0x27')](respondWithResult(_0x452515,0xc9))[_0x4685('0x48')](handleError(_0x452515,null));};exports[_0x4685('0x25')]=function(_0x151425,_0x173d6a){if(_0x151425[_0x4685('0x4e')]['id']){delete _0x151425[_0x4685('0x4e')]['id'];}return db[_0x4685('0x2e')][_0x4685('0x4c')]({'where':{'id':_0x151425[_0x4685('0x4a')]['id']}})[_0x4685('0x27')](handleEntityNotFound(_0x173d6a,null))[_0x4685('0x27')](saveUpdates(_0x151425[_0x4685('0x4e')],null))[_0x4685('0x27')](respondWithResult(_0x173d6a,null))['catch'](handleError(_0x173d6a,null));};exports[_0x4685('0x26')]=function(_0x35fee0,_0x57f071){return db[_0x4685('0x2e')][_0x4685('0x4c')]({'where':{'id':_0x35fee0[_0x4685('0x4a')]['id']}})['then'](handleEntityNotFound(_0x57f071,null))[_0x4685('0x27')](removeEntity(_0x57f071,null))[_0x4685('0x48')](handleError(_0x57f071,null));};exports[_0x4685('0x4f')]=function(_0x49baa5,_0xa7e58d){return db['ChatGroup']['describe']()[_0x4685('0x27')](respondWithResult(_0xa7e58d,null))[_0x4685('0x48')](handleError(_0xa7e58d,null));};exports[_0x4685('0x50')]=function(_0x68776,_0x187c85,_0x1a4058){return db[_0x4685('0x51')][_0x4685('0x22')]({'where':{'ChatGroupId':_0x68776[_0x4685('0x4a')]['id'],'ToId':_0x68776[_0x4685('0x52')]['id'],'read':![]}})[_0x4685('0x27')](function(_0xc803c5){return{'id':_[_0x4685('0x53')](_0x68776[_0x4685('0x4a')]['id']),'count':_0xc803c5};})['then'](respondWithResult(_0x187c85,null))['catch'](handleError(_0x187c85,null));};exports[_0x4685('0x54')]=function(_0x179dab,_0x5ad75e,_0xf32691){return db[_0x4685('0x2e')][_0x4685('0x4c')]({'where':{'id':_0x179dab[_0x4685('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5ad75e,null))['then'](function(_0x5461dc){if(_0x5461dc){return _0x5461dc[_0x4685('0x54')](_0x179dab[_0x4685('0x4e')][_0x4685('0x55')],_[_0x4685('0x56')](_0x179dab[_0x4685('0x4e')],[_0x4685('0x55'),'id'])||{});}})[_0x4685('0x27')](respondWithResult(_0x5ad75e,null))['catch'](handleError(_0x5ad75e,null));};exports[_0x4685('0x57')]=function(_0x41680c,_0xf8622d,_0x4e1d41){var _0x44d19b={};var _0x4decb4={};var _0xc78135;var _0x268bba;return db[_0x4685('0x2e')][_0x4685('0x58')]({'where':{'id':_0x41680c[_0x4685('0x4a')]['id']}})[_0x4685('0x27')](handleEntityNotFound(_0xf8622d,null))[_0x4685('0x27')](function(_0x5ee6c2){if(_0x5ee6c2){_0xc78135=_0x5ee6c2;_0x4decb4[_0x4685('0x33')]=_['keys'](db[_0x4685('0x59')][_0x4685('0x2f')]);_0x4decb4[_0x4685('0x34')]=_[_0x4685('0x35')](_0x41680c[_0x4685('0x34')]);_0x4decb4['filters']=_[_0x4685('0x36')](_0x4decb4[_0x4685('0x33')],_0x4decb4[_0x4685('0x34')]);_0x44d19b[_0x4685('0x37')]=_[_0x4685('0x36')](_0x4decb4[_0x4685('0x33')],qs[_0x4685('0x38')](_0x41680c['query'][_0x4685('0x38')]));_0x44d19b[_0x4685('0x37')]=_0x44d19b[_0x4685('0x37')][_0x4685('0x39')]?_0x44d19b[_0x4685('0x37')]:_0x4decb4[_0x4685('0x33')];_0x44d19b[_0x4685('0x3c')]=qs['sort'](_0x41680c['query'][_0x4685('0x3d')]);_0x44d19b[_0x4685('0x3e')]=qs[_0x4685('0x3f')](_[_0x4685('0x40')](_0x41680c[_0x4685('0x34')],_0x4decb4[_0x4685('0x3f')]));if(_0x41680c[_0x4685('0x34')][_0x4685('0x41')]){_0x44d19b[_0x4685('0x3e')]=_[_0x4685('0x42')](_0x44d19b[_0x4685('0x3e')],{'$or':_[_0x4685('0x2d')](_0x44d19b[_0x4685('0x37')],function(_0x4b38ae){var _0x351c75={};_0x351c75[_0x4b38ae]={'$like':'%'+_0x41680c[_0x4685('0x34')]['filter']+'%'};return _0x351c75;})});}_0x44d19b=_[_0x4685('0x42')]({},_0x44d19b,_0x41680c[_0x4685('0x4b')]);return _0xc78135[_0x4685('0x57')](_0x44d19b);}})[_0x4685('0x27')](function(_0x555e4b){if(_0x555e4b){_0x268bba=_0x555e4b[_0x4685('0x39')];if(!_0x41680c[_0x4685('0x34')][_0x4685('0x5a')](_0x4685('0x3a'))){_0x44d19b[_0x4685('0x3b')]=qs[_0x4685('0x3b')](_0x41680c['query'][_0x4685('0x3b')]);_0x44d19b[_0x4685('0x20')]=qs[_0x4685('0x20')](_0x41680c['query']['offset']);}return _0xc78135[_0x4685('0x57')](_0x44d19b);}})[_0x4685('0x27')](function(_0x359cb2){if(_0x359cb2){return _0x359cb2?{'count':_0x268bba,'rows':_0x359cb2}:null;}})['then'](respondWithResult(_0xf8622d,null))['catch'](handleError(_0xf8622d,null));};exports[_0x4685('0x5b')]=function(_0x2da98c,_0x317294,_0x25675f){return db[_0x4685('0x2e')][_0x4685('0x4c')]({'where':{'id':_0x2da98c[_0x4685('0x4a')]['id']}})['then'](handleEntityNotFound(_0x317294,null))[_0x4685('0x27')](function(_0x54b40a){if(_0x54b40a){return _0x54b40a['removeMembers'](_0x2da98c[_0x4685('0x34')]['ids']);}})['then'](respondWithStatusCode(_0x317294,null))[_0x4685('0x48')](handleError(_0x317294,null));};exports[_0x4685('0x5c')]=function(_0x479962,_0x4ec1f7,_0x387909){if(_0x479962[_0x4685('0x4e')]['id']){delete _0x479962[_0x4685('0x4e')]['id'];}return db[_0x4685('0x2e')][_0x4685('0x4c')]({'where':{'id':_0x479962[_0x4685('0x4a')]['id']}})[_0x4685('0x27')](handleEntityNotFound(_0x4ec1f7,null))[_0x4685('0x27')](function(_0x1e1aac){if(_0x1e1aac){_0x479962[_0x4685('0x4e')][_0x4685('0x5d')]=_0x1e1aac['id'];return db[_0x4685('0x51')][_0x4685('0x4d')](_0x479962['body']);}})['then'](respondWithResult(_0x4ec1f7,null))[_0x4685('0x48')](handleError(_0x4ec1f7,null));};exports[_0x4685('0x5e')]=function(_0x46b313,_0x1d851d,_0x49c514){var _0x4c1ccf={};var _0x1b3445={};var _0x1fd5ae;var _0x123f37;return db[_0x4685('0x2e')][_0x4685('0x58')]({'where':{'id':_0x46b313[_0x4685('0x4a')]['id']}})[_0x4685('0x27')](handleEntityNotFound(_0x1d851d,null))[_0x4685('0x27')](function(_0x1c0816){if(_0x1c0816){_0x1fd5ae=_0x1c0816;_0x1b3445[_0x4685('0x33')]=_[_0x4685('0x35')](db[_0x4685('0x51')][_0x4685('0x2f')]);_0x1b3445[_0x4685('0x34')]=_['keys'](_0x46b313[_0x4685('0x34')]);_0x1b3445[_0x4685('0x3f')]=_[_0x4685('0x36')](_0x1b3445['model'],_0x1b3445[_0x4685('0x34')]);_0x4c1ccf[_0x4685('0x37')]=_[_0x4685('0x36')](_0x1b3445[_0x4685('0x33')],qs[_0x4685('0x38')](_0x46b313['query'][_0x4685('0x38')]));_0x4c1ccf[_0x4685('0x37')]=_0x4c1ccf['attributes'][_0x4685('0x39')]?_0x4c1ccf[_0x4685('0x37')]:_0x1b3445[_0x4685('0x33')];_0x4c1ccf[_0x4685('0x3c')]=qs['sort'](_0x46b313[_0x4685('0x34')][_0x4685('0x3d')]);_0x4c1ccf[_0x4685('0x3e')]=qs[_0x4685('0x3f')](_[_0x4685('0x40')](_0x46b313['query'],_0x1b3445[_0x4685('0x3f')]));if(_0x46b313[_0x4685('0x34')][_0x4685('0x41')]){_0x4c1ccf[_0x4685('0x3e')]=_[_0x4685('0x42')](_0x4c1ccf[_0x4685('0x3e')],{'$or':_[_0x4685('0x2d')](_0x4c1ccf[_0x4685('0x37')],function(_0x22bbed){var _0x1ac5ec={};_0x1ac5ec[_0x22bbed]={'$like':'%'+_0x46b313[_0x4685('0x34')]['filter']+'%'};return _0x1ac5ec;})});}if(_0x46b313[_0x4685('0x34')][_0x4685('0x5f')]){var _0x3aadf2=_0x46b313[_0x4685('0x34')][_0x4685('0x5f')]['split'](',');var _0x3dc827={};_0x3dc827[_0x3aadf2[0x0]]={'$gte':moment(_0x3aadf2[0x1])[_0x4685('0x60')](_0x4685('0x61'))};_0x4c1ccf[_0x4685('0x3e')]=_[_0x4685('0x42')](_0x4c1ccf['where'],_0x3dc827);}_0x4c1ccf=_[_0x4685('0x42')]({},_0x4c1ccf,_0x46b313[_0x4685('0x4b')]);return _0x1fd5ae[_0x4685('0x5e')](_0x4c1ccf);}})[_0x4685('0x27')](function(_0x158d5d){if(_0x158d5d){_0x123f37=_0x158d5d[_0x4685('0x39')];if(!_0x46b313[_0x4685('0x34')][_0x4685('0x5a')](_0x4685('0x3a'))){_0x4c1ccf[_0x4685('0x3b')]=qs['limit'](_0x46b313[_0x4685('0x34')][_0x4685('0x3b')]);_0x4c1ccf[_0x4685('0x20')]=qs[_0x4685('0x20')](_0x46b313[_0x4685('0x34')][_0x4685('0x20')]);}return _0x1fd5ae[_0x4685('0x5e')](_0x4c1ccf);}})[_0x4685('0x27')](function(_0x3882ce){if(_0x3882ce){return _0x3882ce?{'count':_0x123f37,'rows':_0x3882ce}:null;}})[_0x4685('0x27')](respondWithResult(_0x1d851d,null))[_0x4685('0x48')](handleError(_0x1d851d,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 8ed3c64..f0fb53e 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 _0xd115=['update','emit','hasOwnProperty','events','../../mysqldb','ChatGroup','save'];(function(_0x3bf036,_0x412beb){var _0x201fe7=function(_0x1580c7){while(--_0x1580c7){_0x3bf036['push'](_0x3bf036['shift']());}};_0x201fe7(++_0x412beb);}(_0xd115,0x192));var _0x5d11=function(_0x39f877,_0x2d0aa2){_0x39f877=_0x39f877-0x0;var _0x3ab7fa=_0xd115[_0x39f877];return _0x3ab7fa;};'use strict';var EventEmitter=require(_0x5d11('0x0'));var ChatGroup=require(_0x5d11('0x1'))['db'][_0x5d11('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5d11('0x3'),'afterUpdate':_0x5d11('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4c4d66){return function(_0x46af40,_0x3ec5c8,_0x5a0d4e){ChatGroupEvents[_0x5d11('0x5')](_0x4c4d66+':'+_0x46af40['id'],_0x46af40);ChatGroupEvents[_0x5d11('0x5')](_0x4c4d66,_0x46af40);_0x5a0d4e(null);};}for(var e in events){if(events[_0x5d11('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xd65c=['../../mysqldb','save','update','remove','emit','hook','exports','events'];(function(_0x22ea59,_0x387ed1){var _0x444611=function(_0x5b2fea){while(--_0x5b2fea){_0x22ea59['push'](_0x22ea59['shift']());}};_0x444611(++_0x387ed1);}(_0xd65c,0x177));var _0xcd65=function(_0x1107d2,_0x16d075){_0x1107d2=_0x1107d2-0x0;var _0x2f88eb=_0xd65c[_0x1107d2];return _0x2f88eb;};'use strict';var EventEmitter=require(_0xcd65('0x0'));var ChatGroup=require(_0xcd65('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcd65('0x2'),'afterUpdate':_0xcd65('0x3'),'afterDestroy':_0xcd65('0x4')};function emitEvent(_0x445a71){return function(_0x3d5811,_0x6f43a4,_0xd905c2){ChatGroupEvents['emit'](_0x445a71+':'+_0x3d5811['id'],_0x3d5811);ChatGroupEvents[_0xcd65('0x5')](_0x445a71,_0x3d5811);_0xd905c2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xcd65('0x6')](e,emitEvent(event));}}module[_0xcd65('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 2e41ec0..fd4e48c 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 _0xc95c=['./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','moment','request-promise','path','rimraf'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc95c,0x127));var _0xcc95=function(_0x18d22b,_0x2bf0e6){_0x18d22b=_0x18d22b-0x0;var _0x3e97a6=_0xc95c[_0x18d22b];return _0x3e97a6;};'use strict';var _=require('lodash');var util=require(_0xcc95('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xcc95('0x1'));var BPromise=require('bluebird');var rp=require(_0xcc95('0x2'));var fs=require('fs');var path=require(_0xcc95('0x3'));var rimraf=require(_0xcc95('0x4'));var config=require('../../config/environment');var attributes=require(_0xcc95('0x5'));module[_0xcc95('0x6')]=function(_0x26cddb,_0x4b451b){return _0x26cddb[_0xcc95('0x7')](_0xcc95('0x8'),attributes,{'tableName':_0xcc95('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cb9=['util','api','moment','bluebird','request-promise','path','rimraf','define','ChatGroup','chat_groups','lodash'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x9cb9,0x1c2));var _0x99cb=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9cb9[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x99cb('0x0'));var util=require(_0x99cb('0x1'));var logger=require('../../config/logger')(_0x99cb('0x2'));var moment=require(_0x99cb('0x3'));var BPromise=require(_0x99cb('0x4'));var rp=require(_0x99cb('0x5'));var fs=require('fs');var path=require(_0x99cb('0x6'));var rimraf=require(_0x99cb('0x7'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module['exports']=function(_0x9bbf1b,_0x1d46b7){return _0x9bbf1b[_0x99cb('0x8')](_0x99cb('0x9'),attributes,{'tableName':_0x99cb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 866a6ff..34b63f6 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 _0x9589=['socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x5f21d3,_0x28b05c){var _0x342ed2=function(_0x529b26){while(--_0x529b26){_0x5f21d3['push'](_0x5f21d3['shift']());}};_0x342ed2(++_0x28b05c);}(_0x9589,0xbc));var _0x9958=function(_0x45e0fc,_0x7dbe4){_0x45e0fc=_0x45e0fc-0x0;var _0x549c12=_0x9589[_0x45e0fc];return _0x549c12;};'use strict';var _=require(_0x9958('0x0'));var util=require(_0x9958('0x1'));var moment=require(_0x9958('0x2'));var BPromise=require(_0x9958('0x3'));var rs=require(_0x9958('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9958('0x5'))['db'];var utils=require(_0x9958('0x6'));var logger=require(_0x9958('0x7'))('rpc');var config=require(_0x9958('0x8'));var jayson=require(_0x9958('0x9'));var client=jayson[_0x9958('0xa')][_0x9958('0xb')]({'port':0x232a});config[_0x9958('0xc')]=_[_0x9958('0xd')](config['redis'],{'host':_0x9958('0xe'),'port':0x18eb});var socket=require(_0x9958('0xf'))(new Redis(config[_0x9958('0xc')]));require(_0x9958('0x10'))[_0x9958('0x11')](socket);function respondWithRpcPromise(_0x185b6b,_0x1e2647,_0x1e5c25){return new BPromise(function(_0x3369b3,_0x68907){return client[_0x9958('0x12')](_0x185b6b,_0x1e5c25)[_0x9958('0x13')](function(_0x242f1b){logger[_0x9958('0x14')](_0x9958('0x15'),_0x1e2647,_0x9958('0x16'));logger[_0x9958('0x17')](_0x9958('0x18'),_0x1e2647,'request\x20sent',JSON[_0x9958('0x19')](_0x242f1b));if(_0x242f1b['error']){if(_0x242f1b[_0x9958('0x1a')]['code']===0x1f4){logger[_0x9958('0x1a')](_0x9958('0x15'),_0x1e2647,_0x242f1b[_0x9958('0x1a')][_0x9958('0x1b')]);return _0x68907(_0x242f1b['error'][_0x9958('0x1b')]);}logger[_0x9958('0x1a')]('ChatGroup,\x20%s,\x20%s',_0x1e2647,_0x242f1b['error'][_0x9958('0x1b')]);return _0x3369b3(_0x242f1b['error'][_0x9958('0x1b')]);}else{logger[_0x9958('0x14')](_0x9958('0x15'),_0x1e2647,_0x9958('0x16'));_0x3369b3(_0x242f1b[_0x9958('0x1c')][_0x9958('0x1b')]);}})['catch'](function(_0x54a10d){logger[_0x9958('0x1a')]('ChatGroup,\x20%s,\x20%s',_0x1e2647,_0x54a10d);_0x68907(_0x54a10d);});});} \ No newline at end of file +var _0x1696=['ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then'];(function(_0x2ff186,_0x5dbe0b){var _0x35c956=function(_0x3067a1){while(--_0x3067a1){_0x2ff186['push'](_0x2ff186['shift']());}};_0x35c956(++_0x5dbe0b);}(_0x1696,0x79));var _0x6169=function(_0x53f26a,_0x1125df){_0x53f26a=_0x53f26a-0x0;var _0x16e6c7=_0x1696[_0x53f26a];return _0x16e6c7;};'use strict';var _=require(_0x6169('0x0'));var util=require('util');var moment=require(_0x6169('0x1'));var BPromise=require(_0x6169('0x2'));var rs=require(_0x6169('0x3'));var fs=require('fs');var Redis=require(_0x6169('0x4'));var db=require(_0x6169('0x5'))['db'];var utils=require(_0x6169('0x6'));var logger=require(_0x6169('0x7'))(_0x6169('0x8'));var config=require(_0x6169('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6169('0xa')][_0x6169('0xb')]({'port':0x232a});config[_0x6169('0xc')]=_[_0x6169('0xd')](config[_0x6169('0xc')],{'host':_0x6169('0xe'),'port':0x18eb});var socket=require(_0x6169('0xf'))(new Redis(config['redis']));require(_0x6169('0x10'))['register'](socket);function respondWithRpcPromise(_0x1cdeb4,_0x5d46d7,_0x5b5f33){return new BPromise(function(_0x46c85b,_0x2f714f){return client[_0x6169('0x11')](_0x1cdeb4,_0x5b5f33)[_0x6169('0x12')](function(_0x58df8b){logger['info'](_0x6169('0x13'),_0x5d46d7,_0x6169('0x14'));logger['debug'](_0x6169('0x15'),_0x5d46d7,_0x6169('0x14'),JSON[_0x6169('0x16')](_0x58df8b));if(_0x58df8b['error']){if(_0x58df8b['error']['code']===0x1f4){logger[_0x6169('0x17')](_0x6169('0x13'),_0x5d46d7,_0x58df8b[_0x6169('0x17')][_0x6169('0x18')]);return _0x2f714f(_0x58df8b[_0x6169('0x17')]['message']);}logger[_0x6169('0x17')](_0x6169('0x13'),_0x5d46d7,_0x58df8b['error'][_0x6169('0x18')]);return _0x46c85b(_0x58df8b['error'][_0x6169('0x18')]);}else{logger[_0x6169('0x19')]('ChatGroup,\x20%s,\x20%s',_0x5d46d7,_0x6169('0x14'));_0x46c85b(_0x58df8b[_0x6169('0x1a')][_0x6169('0x18')]);}})[_0x6169('0x1b')](function(_0xff7981){logger[_0x6169('0x17')](_0x6169('0x13'),_0x5d46d7,_0xff7981);_0x2f714f(_0xff7981);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 2691480..b78a704 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 _0x65e0=['remove','removeListener','register','length','chatGroup:','./chatGroup.events','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x65e0,0x171));var _0x065e=function(_0x3beb4e,_0x2d1a69){_0x3beb4e=_0x3beb4e-0x0;var _0xd40198=_0x65e0[_0x3beb4e];return _0xd40198;};'use strict';var ChatGroupEvents=require(_0x065e('0x0'));var events=[_0x065e('0x1'),_0x065e('0x2'),'update'];function createListener(_0x428636,_0xf5c434){return function(_0x3dde79){_0xf5c434['emit'](_0x428636,_0x3dde79);};}function removeListener(_0x50f10a,_0x53e805){return function(){ChatGroupEvents[_0x065e('0x3')](_0x50f10a,_0x53e805);};}exports[_0x065e('0x4')]=function(_0xe0c1e8){for(var _0x368bf1=0x0,_0x531618=events[_0x065e('0x5')];_0x368bf1<_0x531618;_0x368bf1++){var _0x385cd7=events[_0x368bf1];var _0x1c9f38=createListener(_0x065e('0x6')+_0x385cd7,_0xe0c1e8);ChatGroupEvents['on'](_0x385cd7,_0x1c9f38);}}; \ No newline at end of file +var _0x623f=['emit','chatGroup:','./chatGroup.events','remove','update'];(function(_0x49dd51,_0xf5a10e){var _0x23ac30=function(_0x36fcbc){while(--_0x36fcbc){_0x49dd51['push'](_0x49dd51['shift']());}};_0x23ac30(++_0xf5a10e);}(_0x623f,0x1b5));var _0xf623=function(_0x1fe7b7,_0xd96e2a){_0x1fe7b7=_0x1fe7b7-0x0;var _0x6c3623=_0x623f[_0x1fe7b7];return _0x6c3623;};'use strict';var ChatGroupEvents=require(_0xf623('0x0'));var events=['save',_0xf623('0x1'),_0xf623('0x2')];function createListener(_0x25666f,_0x579833){return function(_0x25d39c){_0x579833[_0xf623('0x3')](_0x25666f,_0x25d39c);};}function removeListener(_0xc9a38a,_0x3931d2){return function(){ChatGroupEvents['removeListener'](_0xc9a38a,_0x3931d2);};}exports['register']=function(_0x4a7d8d){for(var _0x44b31f=0x0,_0x4ab532=events['length'];_0x44b31f<_0x4ab532;_0x44b31f++){var _0x1fc412=events[_0x44b31f];var _0x30e664=createListener(_0xf623('0x4')+_0x1fc412,_0x4a7d8d);ChatGroupEvents['on'](_0x1fc412,_0x30e664);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 628d9eb..c76475d 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 _0xd800=['/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','update','delete','removeMembers','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/unread','getUnread'];(function(_0x48d86c,_0x3ce765){var _0xea02f1=function(_0x59f0be){while(--_0x59f0be){_0x48d86c['push'](_0x48d86c['shift']());}};_0xea02f1(++_0x3ce765);}(_0xd800,0x16b));var _0x0d80=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xd800[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0d80('0x0'));var util=require('util');var path=require(_0x0d80('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d80('0x2')]();var fs_extra=require(_0x0d80('0x3'));var auth=require(_0x0d80('0x4'));var interaction=require(_0x0d80('0x5'));var config=require(_0x0d80('0x6'));var controller=require('./chatGroup.controller');router[_0x0d80('0x7')]('/',auth[_0x0d80('0x8')](),controller[_0x0d80('0x9')]);router[_0x0d80('0x7')](_0x0d80('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0d80('0x7')](_0x0d80('0xb'),auth[_0x0d80('0x8')](),controller[_0x0d80('0xc')]);router[_0x0d80('0x7')](_0x0d80('0xd'),auth[_0x0d80('0x8')](),controller[_0x0d80('0xe')]);router[_0x0d80('0x7')](_0x0d80('0xf'),auth[_0x0d80('0x8')](),controller[_0x0d80('0x10')]);router[_0x0d80('0x7')](_0x0d80('0x11'),auth[_0x0d80('0x8')](),controller[_0x0d80('0x12')]);router[_0x0d80('0x13')]('/',auth[_0x0d80('0x8')](),controller[_0x0d80('0x14')]);router[_0x0d80('0x13')](_0x0d80('0xf'),auth[_0x0d80('0x8')](),controller[_0x0d80('0x15')]);router[_0x0d80('0x13')](_0x0d80('0x11'),auth[_0x0d80('0x8')](),controller[_0x0d80('0x16')]);router['put']('/:id',auth[_0x0d80('0x8')](),controller[_0x0d80('0x17')]);router[_0x0d80('0x18')](_0x0d80('0xb'),auth[_0x0d80('0x8')](),controller['destroy']);router[_0x0d80('0x18')]('/:id/members',auth[_0x0d80('0x8')](),controller[_0x0d80('0x19')]);module[_0x0d80('0x1a')]=router; \ No newline at end of file +var _0x0a3b=['/:id/members','addMessage','put','/:id','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','isAuthenticated','get','/describe','/:id/unread','getUnread','/:id/messages','getMessages','post'];(function(_0x27d443,_0x4ee5ec){var _0x21b822=function(_0x4c6296){while(--_0x4c6296){_0x27d443['push'](_0x27d443['shift']());}};_0x21b822(++_0x4ee5ec);}(_0x0a3b,0xc6));var _0xb0a3=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0x0a3b[_0x142ec2];return _0x45ef4e;};'use strict';var multer=require(_0xb0a3('0x0'));var util=require(_0xb0a3('0x1'));var path=require(_0xb0a3('0x2'));var timeout=require(_0xb0a3('0x3'));var express=require(_0xb0a3('0x4'));var router=express[_0xb0a3('0x5')]();var fs_extra=require(_0xb0a3('0x6'));var auth=require(_0xb0a3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb0a3('0x8'));var controller=require(_0xb0a3('0x9'));router['get']('/',auth[_0xb0a3('0xa')](),controller['index']);router[_0xb0a3('0xb')](_0xb0a3('0xc'),auth[_0xb0a3('0xa')](),controller['describe']);router[_0xb0a3('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb0a3('0xb')](_0xb0a3('0xd'),auth[_0xb0a3('0xa')](),controller[_0xb0a3('0xe')]);router[_0xb0a3('0xb')]('/:id/members',auth[_0xb0a3('0xa')](),controller['getMembers']);router[_0xb0a3('0xb')](_0xb0a3('0xf'),auth[_0xb0a3('0xa')](),controller[_0xb0a3('0x10')]);router[_0xb0a3('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb0a3('0x11')](_0xb0a3('0x12'),auth['isAuthenticated'](),controller['addMembers']);router[_0xb0a3('0x11')]('/:id/messages',auth[_0xb0a3('0xa')](),controller[_0xb0a3('0x13')]);router[_0xb0a3('0x14')](_0xb0a3('0x15'),auth[_0xb0a3('0xa')](),controller[_0xb0a3('0x16')]);router[_0xb0a3('0x17')](_0xb0a3('0x15'),auth[_0xb0a3('0xa')](),controller[_0xb0a3('0x18')]);router['delete']('/:id/members',auth[_0xb0a3('0xa')](),controller[_0xb0a3('0x19')]);module[_0xb0a3('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 34cce44..b7c43bb 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 _0x8caf=['INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out','exports','BOOLEAN'];(function(_0x44e196,_0x50d0fd){var _0x370a79=function(_0x5341a2){while(--_0x5341a2){_0x44e196['push'](_0x44e196['shift']());}};_0x370a79(++_0x50d0fd);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x2e1051,_0x58b01d){_0x2e1051=_0x2e1051-0x0;var _0x5aa734=_0x8caf[_0x2e1051];return _0x5aa734;};'use strict';var Sequelize=require('sequelize');module[_0xf8ca('0x0')]={'closed':{'type':Sequelize[_0xf8ca('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xf8ca('0x2')]},'ratingType':{'type':Sequelize[_0xf8ca('0x3')](_0xf8ca('0x4'),_0xf8ca('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xf8ca('0x6')]},'pathTranscript':{'type':Sequelize[_0xf8ca('0x6')]},'mailTranscript':{'type':Sequelize[_0xf8ca('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xf8ca('0x8')]},'disposition':{'type':Sequelize[_0xf8ca('0x7')]},'secondDisposition':{'type':Sequelize[_0xf8ca('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf8ca('0x7')]},'browserName':{'type':Sequelize[_0xf8ca('0x7')]},'browserVersion':{'type':Sequelize[_0xf8ca('0x7')]},'osName':{'type':Sequelize[_0xf8ca('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xf8ca('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xf8ca('0x6')]},'customerIp':{'type':Sequelize[_0xf8ca('0x7')]},'formData':{'type':Sequelize[_0xf8ca('0x6')](_0xf8ca('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xf8ca('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xf8ca('0x3')]('in',_0xf8ca('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf8ca('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xf8ca('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xf8ca('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xed3c=['TEXT','ENUM','sequelize','exports','BOOLEAN','INTEGER','star','thumb','STRING','DATE'];(function(_0x2ae5e2,_0x240b99){var _0x4f7722=function(_0x1b87c1){while(--_0x1b87c1){_0x2ae5e2['push'](_0x2ae5e2['shift']());}};_0x4f7722(++_0x240b99);}(_0xed3c,0x1a6));var _0xced3=function(_0x5782a3,_0x2d54f3){_0x5782a3=_0x5782a3-0x0;var _0x5dcae1=_0xed3c[_0x5782a3];return _0x5dcae1;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'closed':{'type':Sequelize[_0xced3('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xced3('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0xced3('0x4'),_0xced3('0x5')),'defaultValue':_0xced3('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xced3('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xced3('0x7')]},'disposition':{'type':Sequelize[_0xced3('0x6')]},'secondDisposition':{'type':Sequelize[_0xced3('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xced3('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xced3('0x6')]},'deviceType':{'type':Sequelize[_0xced3('0x6')]},'referer':{'type':Sequelize[_0xced3('0x8')]},'customerIp':{'type':Sequelize[_0xced3('0x6')]},'formData':{'type':Sequelize[_0xced3('0x8')]('long')},'read1stAt':{'type':Sequelize[_0xced3('0x7')]},'lastMsgAt':{'type':Sequelize[_0xced3('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xced3('0x9')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xced3('0x6')]},'customerPort':{'type':Sequelize[_0xced3('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xced3('0x8')]},'autoreplyExecuted':{'type':Sequelize[_0xced3('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 7299bd5..6f2a2ea 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 _0x36ee=['filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','User','UserId','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20=\x20?','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','a.key','Account.key','Account.mandatoryDisposition','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','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','show','params','includeAll','options','create','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','POST','email','vidaooNote','isNull','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','closed','Unauthorized','attachId','ChatOfflineMessageId','root','server/files/attachments/','offline-chat/','join','download','close','mailTranscript','transcript-%s.txt','Messages','format','customer','%s%d','Visitor','agentIdentifier','website_alias','agentAlias','System','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','addMessage','omit','ids','getMessages','include','findAll','rows','getMyMessages','includeAgent','spread','emit','chatInteractionTags:save','removeTags','unix','files','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','direction','secret','read','Owner','get','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','osName','referer','customerIp','createReadStream','pipe','createWriteStream','out','server','views','downloadInteraction.ejs','log','err','unlinkSync','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','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','jayson/promise','client','http','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','json','limit','undefined','offset','count','set','apply','reject','save','update','then','end','sendStatus','stack','name','send','render','merge','body','contact','agent','interaction','account','Users','fullname','TagIds','Tags','split','forEach','push','index','map','ChatInteraction','rawAttributes','type','key','model','query','keys'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'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 pdf=require(_0xe36e('0x12'));var hardwareService=require(_0xe36e('0x13'));var logger=require(_0xe36e('0x14'))(_0xe36e('0x15'));var utils=require(_0xe36e('0x16'));var config=require(_0xe36e('0x17'));var licenseUtil=require(_0xe36e('0x18'));var db=require('../../mysqldb')['db'];config[_0xe36e('0x19')]=_[_0xe36e('0x1a')](config[_0xe36e('0x19')],{'host':_0xe36e('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe36e('0x19')]));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0xe36e('0x1c'));var client=jayson[_0xe36e('0x1d')][_0xe36e('0x1e')]({'port':0x232b});var client9004=jayson[_0xe36e('0x1d')][_0xe36e('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x924cd5,_0x2096f6,_0x39bae8,_0x387c37){return new BPromise(function(_0x428d34,_0x5792e8){var _0x333554=_0x387c37||client;return _0x333554[_0xe36e('0x1f')](_0x924cd5,_0x39bae8)['then'](function(_0x21d9a3){logger['info'](_0xe36e('0x20'),_0x2096f6,_0xe36e('0x21'));logger['debug'](_0xe36e('0x22'),_0x2096f6,_0xe36e('0x21'),JSON[_0xe36e('0x23')](_0x21d9a3));if(_0x21d9a3['error']){if(_0x21d9a3[_0xe36e('0x24')][_0xe36e('0x25')]===0x1f4){logger[_0xe36e('0x24')](_0xe36e('0x20'),_0x2096f6,_0x21d9a3[_0xe36e('0x24')][_0xe36e('0x26')]);return _0x5792e8(_0x21d9a3['error'][_0xe36e('0x26')]);}logger[_0xe36e('0x24')](_0xe36e('0x20'),_0x2096f6,_0x21d9a3[_0xe36e('0x24')][_0xe36e('0x26')]);return _0x428d34(_0x21d9a3['error']['message']);}else{logger[_0xe36e('0x27')](_0xe36e('0x20'),_0x2096f6,_0xe36e('0x21'));_0x428d34(_0x21d9a3[_0xe36e('0x28')][_0xe36e('0x26')]);}})[_0xe36e('0x29')](function(_0x1a045c){logger['error'](_0xe36e('0x20'),_0x2096f6,_0x1a045c);_0x5792e8(_0x1a045c);});});}function respondWithStatusCode(_0x35f9e7,_0x10597f){_0x10597f=_0x10597f||0xcc;return function(_0x262caa){if(_0x262caa){return _0x35f9e7['sendStatus'](_0x10597f);}return _0x35f9e7[_0xe36e('0x2a')](_0x10597f)['end']();};}function respondWithResult(_0xf7b02e,_0x5993de){_0x5993de=_0x5993de||0xc8;return function(_0x19f001){if(_0x19f001){return _0xf7b02e['status'](_0x5993de)[_0xe36e('0x2b')](_0x19f001);}};}function respondWithFilteredResult(_0x4c5d98,_0x3b1045){return function(_0x59548b){if(_0x59548b){var _0x4bb75b=typeof _0x3b1045['offset']==='undefined'&&typeof _0x3b1045[_0xe36e('0x2c')]===_0xe36e('0x2d');var _0x4cf185=_0x59548b['count'];var _0x1fa1ec=_0x4bb75b?0x0:_0x3b1045[_0xe36e('0x2e')];var _0x259e19=_0x4bb75b?_0x59548b[_0xe36e('0x2f')]:_0x3b1045[_0xe36e('0x2e')]+_0x3b1045[_0xe36e('0x2c')];var _0x57bb9b;if(_0x259e19>=_0x4cf185){_0x259e19=_0x4cf185;_0x57bb9b=0xc8;}else{_0x57bb9b=0xce;}_0x4c5d98[_0xe36e('0x2a')](_0x57bb9b);return _0x4c5d98[_0xe36e('0x30')]('Content-Range',_0x1fa1ec+'-'+_0x259e19+'/'+_0x4cf185)[_0xe36e('0x2b')](_0x59548b);}return null;};}function patchUpdates(_0xa06f61){return function(_0xba4869){try{jsonpatch[_0xe36e('0x31')](_0xba4869,_0xa06f61,!![]);}catch(_0x21623e){return BPromise[_0xe36e('0x32')](_0x21623e);}return _0xba4869[_0xe36e('0x33')]();};}function saveUpdates(_0x127807,_0x36cee2){return function(_0x1cc329){if(_0x1cc329){return _0x1cc329[_0xe36e('0x34')](_0x127807)['then'](function(_0x4507b9){return _0x4507b9;});}return null;};}function removeEntity(_0x59231e,_0x4a717e){return function(_0x81cf9a){if(_0x81cf9a){return _0x81cf9a['destroy']()[_0xe36e('0x35')](function(){_0x59231e[_0xe36e('0x2a')](0xcc)[_0xe36e('0x36')]();});}};}function handleEntityNotFound(_0x235437,_0x4a6a2b){return function(_0x56135c){if(!_0x56135c){_0x235437[_0xe36e('0x37')](0x194);}return _0x56135c;};}function handleError(_0x222c65,_0x19a53f){_0x19a53f=_0x19a53f||0x1f4;return function(_0x243338){logger['error'](_0x243338[_0xe36e('0x38')]);if(_0x243338[_0xe36e('0x39')]){delete _0x243338[_0xe36e('0x39')];}_0x222c65['status'](_0x19a53f)[_0xe36e('0x3a')](_0x243338);};}function getMustacheRender(_0x2ff8f4,_0x5d9f64){return Mustache[_0xe36e('0x3b')](_0x2ff8f4,_[_0xe36e('0x3c')](_0x5d9f64[_0xe36e('0x3d')],{'contact':_0x5d9f64[_0xe36e('0x3e')],'message':_0x5d9f64[_0xe36e('0x26')],'agent':_0x5d9f64[_0xe36e('0x3f')],'interaction':_0x5d9f64[_0xe36e('0x40')],'account':_0x5d9f64[_0xe36e('0x41')]}))||'';}function getInteractionUsers(_0x458a4e,_0x23da09){return new BPromise(function(_0x2f1933,_0x39dd9b){try{if(_0x23da09[_0x458a4e['id']]){_0x458a4e[_0xe36e('0x42')]=_['map'](_0x23da09[_0x458a4e['id']],function(_0x23d36e){return{'id':_0x23d36e['id'],'fullname':_0x23d36e[_0xe36e('0x43')]};});}}catch(_0xd45bb3){_0x39dd9b(_0xd45bb3);}_0x2f1933(_0x458a4e);});}function getInteractionTags(_0x11ee1d,_0x295feb){return new BPromise(function(_0x4d133b,_0x591e33){try{if(_0x11ee1d[_0xe36e('0x44')]){_0x11ee1d[_0xe36e('0x45')]=[];_0x11ee1d[_0xe36e('0x44')][_0xe36e('0x46')](',')[_0xe36e('0x47')](function(_0x34a1ba){_0x11ee1d[_0xe36e('0x45')][_0xe36e('0x48')](_0x295feb[_0x34a1ba]);});}delete _0x11ee1d['TagIds'];}catch(_0x198a40){_0x591e33(_0x198a40);}_0x4d133b(_0x11ee1d);});}function updateChatInteraction(_0x2d392c,_0x4788a0,_0x21dc35){return new BPromise(function(_0x5ef3e4,_0x23e344){return getInteractionUsers(_0x2d392c,_0x21dc35)[_0xe36e('0x35')](function(_0x1d45a4){return getInteractionTags(_0x1d45a4,_0x4788a0);})[_0xe36e('0x35')](function(_0x3b1269){_0x5ef3e4(_0x3b1269);})['catch'](function(_0x2ffc34){_0x23e344(_0x2ffc34);});});}exports[_0xe36e('0x49')]=function(_0x2265c4,_0x1dddfe){var _0x2e57f4={},_0x31760e={},_0x569809={'count':0x0,'rows':[]};var _0x122704=_[_0xe36e('0x4a')](db[_0xe36e('0x4b')][_0xe36e('0x4c')],function(_0x1cbb7d){return{'name':_0x1cbb7d['fieldName'],'type':_0x1cbb7d[_0xe36e('0x4d')][_0xe36e('0x4e')]};});_0x31760e[_0xe36e('0x4f')]=_[_0xe36e('0x4a')](_0x122704,_0xe36e('0x39'));_0x31760e[_0xe36e('0x50')]=_[_0xe36e('0x51')](_0x2265c4[_0xe36e('0x50')]);_0x31760e[_0xe36e('0x52')]=_['intersection'](_0x31760e['model'],_0x31760e[_0xe36e('0x50')]);_0x2e57f4['attributes']=_[_0xe36e('0x53')](_0x31760e[_0xe36e('0x4f')],qs[_0xe36e('0x54')](_0x2265c4[_0xe36e('0x50')]['fields']));_0x2e57f4[_0xe36e('0x55')]=_0x2e57f4[_0xe36e('0x55')]['length']?_0x2e57f4[_0xe36e('0x55')]:_0x31760e[_0xe36e('0x4f')];if(!_0x2265c4[_0xe36e('0x50')][_0xe36e('0x56')](_0xe36e('0x57'))){_0x2e57f4[_0xe36e('0x2c')]=qs[_0xe36e('0x2c')](_0x2265c4[_0xe36e('0x50')][_0xe36e('0x2c')]);_0x2e57f4[_0xe36e('0x2e')]=qs[_0xe36e('0x2e')](_0x2265c4[_0xe36e('0x50')][_0xe36e('0x2e')]);}_0x2e57f4[_0xe36e('0x58')]=qs[_0xe36e('0x59')](_0x2265c4['query'][_0xe36e('0x59')]);_0x2e57f4['where']=qs['filters'](_[_0xe36e('0x5a')](_0x2265c4[_0xe36e('0x50')],_0x31760e['filters']),_0x122704);var _0x3ec864=[];var _0x3814eb=squel[_0xe36e('0x5b')]()[_0xe36e('0x5c')]('id')[_0xe36e('0x5c')](_0xe36e('0x39'))[_0xe36e('0x5c')](_0xe36e('0x5d'))[_0xe36e('0x5e')]('tools_tags');var _0x22117e=squel[_0xe36e('0x5b')]()['field'](_0xe36e('0x5f'))[_0xe36e('0x5c')](_0xe36e('0x60'))[_0xe36e('0x5c')](_0xe36e('0x61'))['from']('user_has_chat_interactions','ui')['left_join']('users','u',_0xe36e('0x62'));var _0x2fab4c=squel[_0xe36e('0x5b')]()[_0xe36e('0x5e')](_0xe36e('0x63'),'i')[_0xe36e('0x64')](_0xe36e('0x65'),'c',_0xe36e('0x66'))[_0xe36e('0x64')]('users','o',_0xe36e('0x67'))[_0xe36e('0x64')]('chat_websites','a',_0xe36e('0x68'))[_0xe36e('0x64')](_0xe36e('0x69'),'me',_0xe36e('0x6a'))[_0xe36e('0x64')](_0xe36e('0x6b'),'it',_0xe36e('0x6c'))[_0xe36e('0x64')](_0xe36e('0x6d'),'t',_0xe36e('0x6e'));var _0x56718a=squel[_0xe36e('0x6f')]();var _0x389e91=[];var _0x6f979f=squel[_0xe36e('0x6f')]();var _0x3e4860;if(_0x2265c4[_0xe36e('0x50')][_0xe36e('0x70')]){_0x3e4860=as[_0xe36e('0x71')](_0x2265c4[_0xe36e('0x50')][_0xe36e('0x70')]);var _0x432584=_0x3e4860[_0xe36e('0x72')];for(var _0x434d88=0x0;_0x434d88<_0x3e4860[_0xe36e('0x73')]['length'];_0x434d88++){var _0x429a01=_0x3e4860[_0xe36e('0x73')][_0x434d88];var _0x49336b='i';var _0xce5583=_[_0xe36e('0x74')](_0x122704,[_0xe36e('0x39'),_0x429a01[_0xe36e('0x5c')]]);if(!_0xce5583){switch(_0x429a01[_0xe36e('0x5c')]){case _0xe36e('0x75'):if(_0x429a01['value']==0x1){_0x2fab4c[_0xe36e('0x76')]('`'+_0x429a01['field']+_0xe36e('0x77'));}else{_0x2fab4c[_0xe36e('0x76')]('`'+_0x429a01[_0xe36e('0x5c')]+_0xe36e('0x78'));}break;case _0xe36e('0x79'):if(_0x429a01[_0xe36e('0x7a')]===_0xe36e('0x7b')){if(_0x429a01[_0xe36e('0x7c')]['split']('\x20')[_0xe36e('0x7d')]>0x1){_0x56718a[_0x432584](_0xe36e('0x7e'),qs['getFullTextValue'](_0x429a01[_0xe36e('0x7c')]),null);}else{var _0x2bf9ac='%'+_0x429a01[_0xe36e('0x7c')]+'%';_0x56718a[_0x432584](_0xe36e('0x7f'),_0x2bf9ac,_0x2bf9ac,_0x2bf9ac);}}else{_0xce5583=_[_0xe36e('0x74')](_0x122704,[_0xe36e('0x39'),_0xe36e('0x80')]);_0x429a01['field']=_0xe36e('0x80');_0x483e06=as[_0xe36e('0x81')](_0x49336b,_0xce5583[_0xe36e('0x4d')],_0x429a01);_0x56718a[_0x432584](_0x483e06[_0xe36e('0x82')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x83')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x36')]);}break;case _0xe36e('0x84'):var _0xeab452=_0x429a01[_0xe36e('0x7c')]['split'](',')[_0xe36e('0x4a')](function(_0x9a77de){return Number(_0x9a77de);});_0xeab452[_0xe36e('0x47')](function(_0x2f05f5){_0x6f979f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2f05f5+',%');});_0x389e91=_['union'](_0x389e91,_0xeab452);break;case _0xe36e('0x85'):if(_0x429a01['operator']==='$substring'){_0x56718a[_0x432584]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x429a01[_0xe36e('0x7c')]+'%',null);}else{_0xce5583=_['find'](_0x122704,[_0xe36e('0x39'),_0xe36e('0x86')]);_0x429a01[_0xe36e('0x5c')]=_0xe36e('0x86');_0x483e06=as[_0xe36e('0x81')](_0x49336b,_0xce5583[_0xe36e('0x4d')],_0x429a01);_0x56718a[_0x432584](_0x483e06[_0xe36e('0x82')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x83')],_0x483e06['value'][_0xe36e('0x36')]);}break;case'body':_0x483e06=as[_0xe36e('0x81')]('me',null,_0x429a01);_0x56718a[_0x432584](_0x483e06['text'],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x83')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x36')]);break;}}else{var _0x483e06=as['buildExpression'](_0x49336b,_0xce5583[_0xe36e('0x4d')],_0x429a01);_0x56718a[_0x432584](_0x483e06[_0xe36e('0x82')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x83')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x36')]);}}}else{var _0x57ae0d=_(_0x2265c4[_0xe36e('0x50')])[_0xe36e('0x51')]()['map'](function(_0xb83ea7){return _['some'](_0x122704,[_0xe36e('0x39'),_0xb83ea7])?_0xb83ea7:undefined;})[_0xe36e('0x87')]()[_0xe36e('0x7c')]();if(!_[_0xe36e('0x88')](_0x57ae0d)){_0x57ae0d['forEach'](function(_0x2d920e){if(_0x2d920e==='ChatWebsiteId'){_0x2fab4c['where'](_0xe36e('0x89'),[][_0xe36e('0x8a')](_0x2265c4['query'][_0x2d920e]));}else if(_0x2d920e==='createdAt'){var _0x460cc9=JSON['parse'](_0x2265c4[_0xe36e('0x50')][_0x2d920e])[_0xe36e('0x8b')];var _0x2c0ed5=JSON[_0xe36e('0x8c')](_0x2265c4[_0xe36e('0x50')][_0x2d920e])[_0xe36e('0x8d')];_0x2fab4c['where'](_0xe36e('0x8e'),_0x460cc9,_0x2c0ed5);}else{if(_0x2265c4[_0xe36e('0x50')][_0x2d920e]===_0xe36e('0x8f')){_0x2fab4c[_0xe36e('0x90')]('i.'+_0x2d920e+'\x20IS\x20NULL');}else{_0x2fab4c[_0xe36e('0x90')]('i.'+_0x2d920e+_0xe36e('0x91'),_0x2265c4[_0xe36e('0x50')][_0x2d920e]);}}});}if(_0x2265c4[_0xe36e('0x50')]['read']){if(_0x2265c4[_0xe36e('0x50')]['read']==0x1){_0x2fab4c[_0xe36e('0x76')]('`unreadMessages`\x20=\x200');}else{_0x2fab4c[_0xe36e('0x76')]('`unreadMessages`\x20>\x200');}}if(_0x2265c4['query'][_0xe36e('0x92')]){_0x389e91=_[_0xe36e('0x93')](_0x2265c4[_0xe36e('0x50')]['tag'])?_0x2265c4[_0xe36e('0x50')][_0xe36e('0x92')]:new Array(_0x2265c4['query'][_0xe36e('0x92')]);_0x389e91[_0xe36e('0x47')](function(_0x156e7f){_0x6f979f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x156e7f+',%');});}if(_0x2265c4['query'][_0xe36e('0x94')]){var _0x2ba37a=_0x2265c4[_0xe36e('0x50')][_0xe36e('0x94')][_0xe36e('0x95')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xe36e('0x96')](_0x2ba37a)){_0x56718a['or'](_0xe36e('0x97'),_0x2ba37a+'%');}else{_0x56718a['or'](_0xe36e('0x98'),qs[_0xe36e('0x99')](_0x2ba37a))['or'](_0xe36e('0x9a'),_0x2ba37a+'%');}}}_0x2fab4c['where'](_0x56718a);_0x2fab4c[_0xe36e('0x9b')](_0xe36e('0x9c'));var _0x188dc9={'type':db['Sequelize'][_0xe36e('0x9d')]['SELECT'],'raw':!![]};var _0x2ee394=_0x2fab4c['clone']();_0x2ee394[_0xe36e('0x5c')](_0xe36e('0x9c'));_0x2ee394['field'](_0xe36e('0x9e'),'unreadMessages');if(_0x2e57f4[_0xe36e('0x58')]){_0x2e57f4[_0xe36e('0x58')][_0xe36e('0x47')](function(_0x201212){var _0x431aac=_0x201212[0x0]==='contactName'?_0x201212[0x0]:'i.'+_0x201212[0x0];_0x2fab4c[_0xe36e('0x58')](_0x431aac,_0x201212[0x1]==='DESC'?![]:!![]);});}if(!_[_0xe36e('0x88')](_0x389e91)){_0x2fab4c[_0xe36e('0x76')](_0x6f979f);_0x2ee394[_0xe36e('0x90')](_0xe36e('0x9f'),_0x389e91);}BPromise[_0xe36e('0xa0')]()[_0xe36e('0x35')](function(){if(!_0x3e4860){if(_0x2265c4['query'][_0xe36e('0xa1')])return;_0x2ee394[_0xe36e('0x90')](_0xe36e('0xa2'));_0x2fab4c['where'](_0xe36e('0xa2'));return;}if(_0x2265c4[_0xe36e('0xa3')][_0xe36e('0xa4')]!==_0xe36e('0x3f'))return;return _0x2265c4['user'][_0xe36e('0xa5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x11ebdd){if(_['isEmpty'](_0x11ebdd)){_0x2ee394[_0xe36e('0x90')](_0xe36e('0xa6'));_0x2fab4c[_0xe36e('0x90')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x2ee394[_0xe36e('0x90')](_0xe36e('0x89'),_['map'](_0x11ebdd,'id'));_0x2fab4c[_0xe36e('0x90')](_0xe36e('0x89'),_[_0xe36e('0x4a')](_0x11ebdd,'id'));}});})['then'](function(){if(_0x2265c4['user'][_0xe36e('0xa4')]===_0xe36e('0x3f')&&!_0x3e4860&&!_0x2265c4[_0xe36e('0x50')][_0xe36e('0xa1')])return[];return db[_0xe36e('0xa7')]['query'](_0x2ee394[_0xe36e('0xa8')](),_0x188dc9);})[_0xe36e('0x35')](function(_0x2c923b){_0x569809[_0xe36e('0x2f')]=_0x2c923b['length'];if(_0x569809[_0xe36e('0x2f')]===0x0)return[];return db[_0xe36e('0xa7')]['query'](_0x3814eb['toString'](),_0x188dc9)['then'](function(_0x1acffb){_0x3ec864=_['keyBy'](_0x1acffb,'id');_0x188dc9=_['merge'](_0x188dc9,{'model':db[_0xe36e('0x4b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2265c4[_0xe36e('0x50')][_0xe36e('0x54')]){_0x2e57f4[_0xe36e('0x55')][_0xe36e('0x47')](function(_0x378126){_0x2fab4c['field']('i.'+_0x378126);});}else{_0x2fab4c[_0xe36e('0x5c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xa9'),_0xe36e('0xaa'));_0x2fab4c[_0xe36e('0x5c')]('a.mandatoryDisposition',_0xe36e('0xab'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xac'),_0xe36e('0xad'));_0x2fab4c['field'](_0xe36e('0xae'));_0x2fab4c['field'](_0xe36e('0xaf'),_0xe36e('0xb0'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xb1'),_0xe36e('0xb2'));_0x2fab4c['field'](_0xe36e('0xb3'),_0xe36e('0xb4'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xb5'),_0xe36e('0xb6'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xb7'),_0xe36e('0xb8'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xb9'),_0xe36e('0xba'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xbb'),'Owner.fullname');_0x2fab4c['field']('o.internal',_0xe36e('0xbc'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xbd'),_0xe36e('0x44'));}if(_0x2e57f4['limit'])_0x2fab4c[_0xe36e('0x2c')](_0x2e57f4[_0xe36e('0x2c')]);if(_0x2e57f4[_0xe36e('0x2e')])_0x2fab4c[_0xe36e('0x2e')](_0x2e57f4['offset']);return db[_0xe36e('0xa7')][_0xe36e('0x50')](_0x2fab4c[_0xe36e('0xa8')](),_0x188dc9);})[_0xe36e('0x35')](function(_0x515a79){if(_0x515a79['length']>0x0)_0x22117e[_0xe36e('0x90')](_0xe36e('0xbe'),_['map'](_0x515a79,'id'));return db['sequelize']['query'](_0x22117e[_0xe36e('0xa8')](),_0x188dc9)[_0xe36e('0x35')](function(_0xd57a9e){var _0x4d7f1a=_[_0xe36e('0xbf')](_0xd57a9e,_0xe36e('0xc0'));var _0x280812=[];_0x515a79[_0xe36e('0x47')](function(_0x5250c9){_0x280812[_0xe36e('0x48')](updateChatInteraction(_0x5250c9,_0x3ec864,_0x4d7f1a));});return BPromise[_0xe36e('0xc1')](_0x280812);});});})[_0xe36e('0x35')](function(_0x3b4152){_0x569809['rows']=_0x3b4152;return _0x569809;})[_0xe36e('0x35')](respondWithFilteredResult(_0x1dddfe,_0x2e57f4))['catch'](handleError(_0x1dddfe,null));};exports[_0xe36e('0xc2')]=function(_0x4c169c,_0x1c95cd){var _0x2b3e81={'raw':![],'where':{'id':_0x4c169c[_0xe36e('0xc3')]['id']}},_0x498822={};_0x498822[_0xe36e('0x4f')]=_['keys'](db[_0xe36e('0x4b')][_0xe36e('0x4c')]);_0x498822[_0xe36e('0x50')]=_[_0xe36e('0x51')](_0x4c169c[_0xe36e('0x50')]);_0x498822[_0xe36e('0x52')]=_['intersection'](_0x498822[_0xe36e('0x4f')],_0x498822[_0xe36e('0x50')]);_0x2b3e81['attributes']=_[_0xe36e('0x53')](_0x498822['model'],qs[_0xe36e('0x54')](_0x4c169c[_0xe36e('0x50')][_0xe36e('0x54')]));_0x2b3e81[_0xe36e('0x55')]=_0x2b3e81['attributes'][_0xe36e('0x7d')]?_0x2b3e81[_0xe36e('0x55')]:_0x498822[_0xe36e('0x4f')];if(_0x4c169c[_0xe36e('0x50')][_0xe36e('0xc4')]){_0x2b3e81['include']=[{'all':!![]}];}_0x2b3e81=_[_0xe36e('0x3c')]({},_0x2b3e81,_0x4c169c[_0xe36e('0xc5')]);return db['ChatInteraction']['find'](_0x2b3e81)[_0xe36e('0x35')](handleEntityNotFound(_0x1c95cd,null))['then'](respondWithResult(_0x1c95cd,null))[_0xe36e('0x29')](handleError(_0x1c95cd,null));};exports[_0xe36e('0xc6')]=function(_0x23dfd7,_0x3f9c84){return db[_0xe36e('0x4b')][_0xe36e('0xc6')](_0x23dfd7[_0xe36e('0x3d')],{})[_0xe36e('0x35')](respondWithResult(_0x3f9c84,0xc9))[_0xe36e('0x29')](handleError(_0x3f9c84,null));};exports[_0xe36e('0x34')]=function(_0x4ca2cc,_0xab0e50){if(_0x4ca2cc['body']['id']){delete _0x4ca2cc[_0xe36e('0x3d')]['id'];}return db[_0xe36e('0x4b')][_0xe36e('0x74')]({'where':{'id':_0x4ca2cc['params']['id']}})[_0xe36e('0x35')](handleEntityNotFound(_0xab0e50,null))[_0xe36e('0x35')](saveUpdates(_0x4ca2cc['body'],null))[_0xe36e('0x35')](respondWithResult(_0xab0e50,null))['catch'](handleError(_0xab0e50,null));};exports[_0xe36e('0xc7')]=function(_0x3d14b1,_0x3246c6){return db[_0xe36e('0x4b')][_0xe36e('0x74')]({'where':{'id':_0x3d14b1[_0xe36e('0xc3')]['id']}})[_0xe36e('0x35')](handleEntityNotFound(_0x3246c6,null))[_0xe36e('0x35')](removeEntity(_0x3246c6,null))[_0xe36e('0x29')](handleError(_0x3246c6,null));};exports[_0xe36e('0xc8')]=function(_0x166c22,_0x47b082){return db['ChatInteraction'][_0xe36e('0xc8')]()[_0xe36e('0x35')](respondWithResult(_0x47b082,null))[_0xe36e('0x29')](handleError(_0x47b082,null));};exports[_0xe36e('0xc9')]=function(_0x5b3f98,_0xf38a08){var _0x24a0f6=_0x5b3f98['params']['id'];var _0x281519;var _0x4d12f6;var _0x260fff;return db[_0xe36e('0x4b')][_0xe36e('0xca')]({'where':{'id':_0x24a0f6}})['then'](function(_0x142caa){_0x281519=_0x142caa;return db[_0xe36e('0xcb')][_0xe36e('0xca')]({'where':{'id':_0x142caa[_0xe36e('0xa1')]},'attributes':['id',_0xe36e('0xcc'),_0xe36e('0xcd'),_0xe36e('0xce'),'vidaooNote',_0xe36e('0xcf')],'raw':!![]});})[_0xe36e('0x35')](function(_0x2d890a){if(_0x2d890a&&_0x2d890a[_0xe36e('0xcc')]&&_0x2d890a[_0xe36e('0xcd')]){_0x4d12f6=_0x2d890a;var _0x165372={'interaction':{'id':_0x24a0f6},'agent':{'id':_0x5b3f98[_0xe36e('0xa3')]['id'],'name':_0x5b3f98[_0xe36e('0xa3')][_0xe36e('0x39')],'fullname':_0x5b3f98['user'][_0xe36e('0x43')],'email':_0x5b3f98[_0xe36e('0xa3')]['email']},'contact':_0x5b3f98['body']['contact'],'account':_0x5b3f98[_0xe36e('0x3d')][_0xe36e('0x41')]};var _0x4ed60e={'rejectUnauthorized':![],'method':_0xe36e('0xd0'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x2d890a['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5b3f98['user'][_0xe36e('0xd1')]],'buttons':null,'topic':_0x4d12f6[_0xe36e('0xce')],'note':_['isNull'](_0x4d12f6[_0xe36e('0xd2')])?null:getMustacheRender(_0x4d12f6[_0xe36e('0xd2')],_0x165372),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xe36e('0xd3')](_0x4d12f6[_0xe36e('0xcf')])){var _0x493407=getMustacheRender(_0x4d12f6[_0xe36e('0xcf')],_0x165372);var _0x3d451f=JSON['parse'](_0x493407);_0x4ed60e['body'][_0xe36e('0xd4')]=_0x3d451f;}}catch(_0x1e018b){throw new db[(_0xe36e('0xd5'))][(_0xe36e('0xd6'))](_0xe36e('0xd7'));}return rp(_0x4ed60e);}else{throw new db[(_0xe36e('0xd5'))][(_0xe36e('0xd6'))](_0xe36e('0xd8'));}})['then'](function(_0x44cf3d){_0x260fff=_0x44cf3d;if(_0x260fff['id']){var _0x7b1e8f={'body':_0x260fff[_0xe36e('0xd9')],'ChatWebsiteId':_0x4d12f6['id'],'ChatInteractionId':_0x281519['id'],'direction':'out','UserId':_0x5b3f98[_0xe36e('0xa3')]['id']};return db[_0xe36e('0xda')][_0xe36e('0xc6')](_0x7b1e8f,{});}else{throw new db[(_0xe36e('0xd5'))][(_0xe36e('0xd6'))](_0xe36e('0xdb'));}})['then'](function(){return _0x281519[_0xe36e('0xdc')]({'vidaooSessionId':_0x260fff['id']});})[_0xe36e('0x35')](respondWithResult(_0xf38a08,null))['catch'](handleError(_0xf38a08,null));};exports['customUpdate']=function(_0x33f382,_0x4a6986){if(_0x33f382[_0xe36e('0x3d')]['id']){delete _0x33f382[_0xe36e('0x3d')]['id'];}return db['ChatInteraction'][_0xe36e('0x74')]({'where':{'id':_0x33f382[_0xe36e('0xc3')]['id']},'include':[{'model':db[_0xe36e('0xdd')],'as':_0xe36e('0x79')}]})['then'](handleEntityNotFound(_0x4a6986,null))['then'](saveUpdates(_0x33f382[_0xe36e('0x3d')],null))[_0xe36e('0x35')](respondWithResult(_0x4a6986,null))[_0xe36e('0x29')](handleError(_0x4a6986,null));};exports[_0xe36e('0xde')]=function(_0x15bf65,_0x2c2f12,_0x1ec6c5){if(_0x15bf65['body']['id']){delete _0x15bf65[_0xe36e('0x3d')]['id'];}return db[_0xe36e('0x4b')][_0xe36e('0x74')]({'where':{'id':_0x15bf65[_0xe36e('0xc3')]['id']}})[_0xe36e('0x35')](function(_0x322fc4){if(!_0x322fc4){logger[_0xe36e('0x24')](_0xe36e('0xdf'),_0xe36e('0xde'),0x194,_0xe36e('0xe0'));_0x2c2f12[_0xe36e('0x37')](0x194);}else{if(_0x322fc4['UserId']){throw new db[(_0xe36e('0xd5'))][(_0xe36e('0xd6'))](_0xe36e('0xe1'));}}return _0x322fc4;})[_0xe36e('0x35')](function(_0x478cc9){if(_0x478cc9){return _0x478cc9['update']({'closed':_0x15bf65[_0xe36e('0x3d')]['closed'],'disposition':_0x15bf65[_0xe36e('0x3d')]['disposition']})[_0xe36e('0x35')](function(_0x52de0f){return _0x52de0f;});}})[_0xe36e('0x35')](function(_0x30928a){return respondWithRpcPromise(_0xe36e('0xe2'),_0xe36e('0xde'),_0x15bf65[_0xe36e('0x3d')],client9004);})['then'](respondWithResult(_0x2c2f12,null))[_0xe36e('0x29')](handleError(_0x2c2f12,null));};exports[_0xe36e('0xe3')]=function(_0x3b8631,_0x5bf046,_0x4fc846){_0x3b8631[_0xe36e('0x3d')][_0xe36e('0x39')]=_0x3b8631['file'][_0xe36e('0xe4')];_0x3b8631['body'][_0xe36e('0xe5')]=_0x3b8631[_0xe36e('0xe6')][_0xe36e('0xe7')];_0x3b8631[_0xe36e('0x3d')][_0xe36e('0x4d')]=_0x3b8631[_0xe36e('0xe6')][_0xe36e('0xe8')];return db[_0xe36e('0xe9')][_0xe36e('0xc6')](_0x3b8631[_0xe36e('0x3d')])[_0xe36e('0x35')](respondWithResult(_0x5bf046,0xc9))[_0xe36e('0x29')](handleError(_0x5bf046,null));};exports[_0xe36e('0xea')]=function(_0x50cc85,_0x2ad011,_0x5466b8){return db[_0xe36e('0x4b')][_0xe36e('0xca')]({'where':{'id':_0x50cc85[_0xe36e('0xc3')]['id']},'raw':!![]})[_0xe36e('0x35')](handleEntityNotFound(_0x2ad011,null))[_0xe36e('0x35')](function(_0x57456d){if(_0x57456d){if(_0x57456d[_0xe36e('0xeb')]){return _0x2ad011[_0xe36e('0x2a')](0x193)[_0xe36e('0x2b')]({'status':0x193,'message':_0xe36e('0xec')});}return db[_0xe36e('0xe9')][_0xe36e('0xca')]({'where':{'id':_0x50cc85[_0xe36e('0x50')][_0xe36e('0xed')]},'raw':!![]})[_0xe36e('0x35')](handleEntityNotFound(_0x2ad011,null));}})[_0xe36e('0x35')](function(_0x1a380e){if(_0x1a380e){var _0xd786b8=_0x1a380e[_0xe36e('0xee')]!==null;var _0x38d16c=path['join'](config[_0xe36e('0xef')],_0xe36e('0xf0'));if(_0xd786b8){_0x38d16c=path['join'](_0x38d16c,_0xe36e('0xf1'));}var _0x512a19=path[_0xe36e('0xf2')](_0x38d16c,_0x1a380e['basename']);return _0x2ad011[_0xe36e('0xf3')](_0x512a19);}})[_0xe36e('0x29')](handleError(_0x2ad011,null));};exports[_0xe36e('0xf4')]=function(_0x153b4f,_0x5d2afc){var _0xeb0eb3=null;var _0x67afa3=null;var _0x2e0f59=null;var _0x2644c7=null;if(_0x153b4f[_0xe36e('0x3d')]['id']){delete _0x153b4f[_0xe36e('0x3d')]['id'];}if(_0x153b4f['body'][_0xe36e('0xf5')]){_0x2644c7=path[_0xe36e('0xf2')](config[_0xe36e('0xef')],'server/files/chat/upload/',util['format'](_0xe36e('0xf6'),Date['now']()));_0x153b4f[_0xe36e('0x3d')]['pathTranscript']=_0x2644c7;}return db[_0xe36e('0x4b')]['find']({'where':{'id':_0x153b4f[_0xe36e('0xc3')]['id']},'include':[{'model':db[_0xe36e('0xda')],'as':_0xe36e('0xf7'),'include':[{'model':db[_0xe36e('0x85')],'as':_0xe36e('0x85')}]}]})[_0xe36e('0x35')](handleEntityNotFound(_0x5d2afc,null))['then'](saveUpdates(_0x153b4f['body'],null))[_0xe36e('0x35')](function(_0x26031e){if(_0x26031e){_0xeb0eb3=_0x26031e;return db[_0xe36e('0xcb')]['find']({'where':{'id':_0xeb0eb3[_0xe36e('0xa1')]}});}})[_0xe36e('0x35')](function(_0xc1d0bd){if(_0xc1d0bd){_0x2e0f59=_0xc1d0bd;return db[_0xe36e('0xdd')][_0xe36e('0x74')]({'where':{'id':_0xeb0eb3[_0xe36e('0x80')]}});}})[_0xe36e('0x35')](function(_0x518d30){if(_0x518d30){_0x67afa3=_0x518d30;if(_0x2644c7){var _0xfb015e=null;for(var _0xd2176=0x1;_0xd2176<_0xeb0eb3[_0xe36e('0xf7')]['length'];++_0xd2176){_0xfb015e=_0xeb0eb3[_0xe36e('0xf7')][_0xd2176];var _0x4727cd=_0xfb015e['UserId']?util[_0xe36e('0xf8')]('%s%d',_0x2e0f59['agentAlias'],_0xfb015e[_0xe36e('0x86')]):'System';var _0x3ac919=_0x153b4f[_0xe36e('0x3d')][_0xe36e('0xf9')]||util['format'](_0xe36e('0xfa'),_0xe36e('0xfb'),_0xfb015e[_0xe36e('0x80')]);switch(_0x2e0f59[_0xe36e('0xfc')]){case _0xe36e('0xfd'):_0x4727cd=_0xfb015e[_0xe36e('0x86')]?util[_0xe36e('0xf8')](_0xe36e('0xfa'),_0x2e0f59[_0xe36e('0xfe')],_0xfb015e[_0xe36e('0x86')]):_0xe36e('0xff');break;case _0xe36e('0x100'):_0x4727cd=_0xfb015e['UserId']?_0xfb015e[_0xe36e('0x85')][_0xe36e('0x101')]||_0xfb015e['User'][_0xe36e('0x43')]:_0xe36e('0xff');break;case'agent_fullname':_0x4727cd=_0xfb015e[_0xe36e('0x86')]?_0xfb015e[_0xe36e('0x85')]['fullname']:_0xe36e('0xff');break;default:_0x4727cd=_0xfb015e[_0xe36e('0x86')]?util[_0xe36e('0xf8')](_0xe36e('0xfa'),_0x2e0f59[_0xe36e('0xfe')],_0xfb015e[_0xe36e('0x86')]):_0xe36e('0xff');}var _0x332cd8=util[_0xe36e('0xf8')](_0xe36e('0x102'),moment(_0xfb015e['createdAt'])[_0xe36e('0xf8')](_0xe36e('0x103')),_0xfb015e['direction']==='in'?_0x3ac919:_0x4727cd,_0xfb015e[_0xe36e('0x3d')]);if(!_0xfb015e['secret']){fs['appendFileSync'](_0x2644c7,_0x332cd8);}}return db['MailAccount'][_0xe36e('0xca')]({'where':{'service':!![]},'include':[{'model':db[_0xe36e('0x104')],'as':_0xe36e('0x105'),'raw':!![]}]});}}})[_0xe36e('0x35')](function(_0x154f52){if(_0x154f52&&_0x154f52['Smtp']&&_0x153b4f[_0xe36e('0x3d')]){var _0x34523d={'tls':{'rejectUnauthorized':![]}};if(_0x154f52['Smtp']['service']){_0x34523d[_0xe36e('0x106')]=_0x154f52[_0xe36e('0x105')][_0xe36e('0x106')];}else{_0x34523d[_0xe36e('0x107')]=_0x154f52['Smtp'][_0xe36e('0x107')];_0x34523d['port']=_0x154f52[_0xe36e('0x105')][_0xe36e('0x108')];_0x34523d[_0xe36e('0x109')]=_0x154f52['Smtp'][_0xe36e('0x109')];}if(_0x154f52['Smtp'][_0xe36e('0x10a')]){_0x34523d[_0xe36e('0x10b')]={'user':_0x154f52[_0xe36e('0x105')][_0xe36e('0xa3')],'pass':_0x154f52[_0xe36e('0x105')][_0xe36e('0x10c')]};}return respondWithRpcPromise(_0xe36e('0x10d'),'sendMail',{'account':_0x34523d,'message':{'from':util[_0xe36e('0xf8')](_0xe36e('0x10e'),_0x154f52['name'],_0x154f52[_0xe36e('0xd1')]||_0x154f52['Smtp'][_0xe36e('0xa3')]),'to':_0x153b4f['body'][_0xe36e('0xf5')],'subject':'Mail\x20Transcript','text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x153b4f[_0xe36e('0x3d')][_0xe36e('0xf5')]),'attachments':[{'path':_0x2644c7}]}})[_0xe36e('0x35')](function(){return _0xeb0eb3;})[_0xe36e('0x29')](function(_0x65e8ae){console[_0xe36e('0x24')](_0x65e8ae);});}else{return _0xeb0eb3;}})[_0xe36e('0x35')](respondWithStatusCode(_0x5d2afc,0xc8))[_0xe36e('0x29')](handleError(_0x5d2afc,null));};exports[_0xe36e('0x10f')]=function(_0x49225b,_0x214f23,_0x29883e){return db[_0xe36e('0xda')][_0xe36e('0x74')]({'where':{'id':_0x49225b[_0xe36e('0xc3')]['id']}})[_0xe36e('0x35')](handleEntityNotFound(_0x214f23,null))[_0xe36e('0x35')](function(_0xeb88eb){if(_0xeb88eb){return _0xeb88eb[_0xe36e('0x10f')](_0x49225b[_0xe36e('0x3d')]['ids'],_[_0xe36e('0x110')](_0x49225b['body'],[_0xe36e('0x111'),'id'])||{});}})[_0xe36e('0x35')](respondWithResult(_0x214f23,null))[_0xe36e('0x29')](handleError(_0x214f23,null));};exports[_0xe36e('0x112')]=function(_0x37282a,_0x5e7360,_0x4b4e4f){var _0x5583d8={'raw':![],'where':{}};var _0x542ae6={};var _0x2291e7={'count':0x0,'rows':[]};return db[_0xe36e('0x4b')]['findOne']({'where':{'id':_0x37282a[_0xe36e('0xc3')]['id']}})['then'](handleEntityNotFound(_0x5e7360,null))['then'](function(_0x12e580){if(_0x12e580){_0x542ae6['model']=_[_0xe36e('0x51')](db[_0xe36e('0xda')]['rawAttributes']);_0x542ae6[_0xe36e('0x50')]=_[_0xe36e('0x51')](_0x37282a['query']);_0x542ae6[_0xe36e('0x52')]=_[_0xe36e('0x53')](_0x542ae6[_0xe36e('0x4f')],_0x542ae6[_0xe36e('0x50')]);_0x5583d8[_0xe36e('0x55')]=_[_0xe36e('0x53')](_0x542ae6[_0xe36e('0x4f')],qs['fields'](_0x37282a[_0xe36e('0x50')][_0xe36e('0x54')]));_0x5583d8['attributes']=_0x5583d8['attributes'][_0xe36e('0x7d')]?_0x5583d8[_0xe36e('0x55')]:_0x542ae6['model'];if(!_0x37282a[_0xe36e('0x50')][_0xe36e('0x56')](_0xe36e('0x57'))){_0x5583d8[_0xe36e('0x2c')]=qs[_0xe36e('0x2c')](_0x37282a[_0xe36e('0x50')]['limit']);_0x5583d8['offset']=qs['offset'](_0x37282a[_0xe36e('0x50')][_0xe36e('0x2e')]);}_0x5583d8['order']=qs[_0xe36e('0x59')](_0x37282a['query'][_0xe36e('0x59')]);_0x5583d8[_0xe36e('0x90')]=qs['filters'](_[_0xe36e('0x5a')](_0x37282a[_0xe36e('0x50')],_0x542ae6[_0xe36e('0x52')]));_0x5583d8[_0xe36e('0x90')]['ChatInteractionId']=_0x12e580['id'];if(_0x37282a[_0xe36e('0x50')][_0xe36e('0x94')]){_0x5583d8[_0xe36e('0x90')]=_[_0xe36e('0x3c')](_0x5583d8[_0xe36e('0x90')],{'$or':_['map'](_0x5583d8['attributes'],function(_0xb40daf){var _0x584f19={};_0x584f19[_0xb40daf]={'$like':'%'+_0x37282a['query'][_0xe36e('0x94')]+'%'};return _0x584f19;})});}if(_0x37282a[_0xe36e('0x50')][_0xe36e('0x8b')]){var _0x2ee22b=_0x37282a[_0xe36e('0x50')][_0xe36e('0x8b')][_0xe36e('0x46')](',');var _0x2cfaee={};_0x2cfaee[_0x2ee22b[0x0]]={'$gte':moment(_0x2ee22b[0x1])[_0xe36e('0xf8')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5583d8[_0xe36e('0x90')]=_[_0xe36e('0x3c')](_0x5583d8[_0xe36e('0x90')],_0x2cfaee);}_0x5583d8=_[_0xe36e('0x3c')]({},_0x5583d8,_0x37282a[_0xe36e('0xc5')]);return db[_0xe36e('0xda')][_0xe36e('0x2f')]({'where':_0x5583d8['where']})[_0xe36e('0x35')](function(_0x3f0fd2){_0x2291e7[_0xe36e('0x2f')]=_0x3f0fd2;if(_0x37282a[_0xe36e('0x50')][_0xe36e('0xc4')]){_0x5583d8[_0xe36e('0x113')]=[{'all':!![]}];}return db[_0xe36e('0xda')][_0xe36e('0x114')](_0x5583d8);})[_0xe36e('0x35')](function(_0x2c85c5){_0x2291e7[_0xe36e('0x115')]=_0x2c85c5;return _0x2291e7;});}})[_0xe36e('0x35')](respondWithFilteredResult(_0x5e7360,_0x5583d8))[_0xe36e('0x29')](handleError(_0x5e7360,null));};exports[_0xe36e('0x116')]=function(_0x545f90,_0x2291d1,_0x3ccaa5){var _0x19f952={'where':{}},_0x3e706e={},_0x51cea0={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xe36e('0xca')]({'where':{'id':_0x545f90['params']['id']}})[_0xe36e('0x35')](handleEntityNotFound(_0x2291d1,null))['then'](function(_0x21ffc7){if(_0x21ffc7){_0x3e706e[_0xe36e('0x4f')]=_['keys'](db[_0xe36e('0xda')][_0xe36e('0x4c')]);_0x3e706e[_0xe36e('0x50')]=_['keys'](_0x545f90[_0xe36e('0x50')]);_0x3e706e[_0xe36e('0x52')]=_[_0xe36e('0x53')](_0x3e706e[_0xe36e('0x4f')],_0x3e706e[_0xe36e('0x50')]);_0x19f952['attributes']=_[_0xe36e('0x53')](_0x3e706e[_0xe36e('0x4f')],qs[_0xe36e('0x54')](_0x545f90[_0xe36e('0x50')][_0xe36e('0x54')]));_0x19f952['attributes']=_0x19f952[_0xe36e('0x55')][_0xe36e('0x7d')]?_0x19f952[_0xe36e('0x55')]:_0x3e706e[_0xe36e('0x4f')];if(!_0x545f90[_0xe36e('0x50')]['hasOwnProperty'](_0xe36e('0x57'))){_0x19f952['limit']=qs[_0xe36e('0x2c')](_0x545f90['query'][_0xe36e('0x2c')]);_0x19f952[_0xe36e('0x2e')]=qs[_0xe36e('0x2e')](_0x545f90[_0xe36e('0x50')][_0xe36e('0x2e')]);}_0x19f952[_0xe36e('0x58')]=qs[_0xe36e('0x59')](_0x545f90[_0xe36e('0x50')][_0xe36e('0x59')]);_0x19f952[_0xe36e('0x90')]=qs[_0xe36e('0x52')](_[_0xe36e('0x5a')](_0x545f90[_0xe36e('0x50')],_0x3e706e['filters']));_0x19f952['where'][_0xe36e('0xc0')]=_0x21ffc7['id'];if(_0x545f90[_0xe36e('0x50')][_0xe36e('0x94')]){_0x19f952[_0xe36e('0x90')]=_[_0xe36e('0x3c')](_0x19f952[_0xe36e('0x90')],{'$or':_[_0xe36e('0x4a')](_0x19f952[_0xe36e('0x55')],function(_0x82c1ae){var _0x5f22b7={};_0x5f22b7[_0x82c1ae]={'$like':'%'+_0x545f90[_0xe36e('0x50')][_0xe36e('0x94')]+'%'};return _0x5f22b7;})});}_0x19f952['where']['secret']=![];if(_0x545f90[_0xe36e('0x50')]['id']){_0x19f952[_0xe36e('0x90')]['id']={'$gt':_0x545f90[_0xe36e('0x50')]['id']};}_0x19f952=_[_0xe36e('0x3c')]({},_0x19f952,_0x545f90['options']);return db[_0xe36e('0xda')]['count']({'where':_0x19f952[_0xe36e('0x90')]})[_0xe36e('0x35')](function(_0x150c17){_0x51cea0[_0xe36e('0x2f')]=_0x150c17;_0x19f952[_0xe36e('0x113')]=[];if(_0x545f90[_0xe36e('0x50')][_0xe36e('0x117')]){_0x19f952['include'][_0xe36e('0x48')]({'model':db[_0xe36e('0x85')],'as':'User','attributes':['id',_0xe36e('0x43'),_0xe36e('0x101')]});}if(_0x545f90[_0xe36e('0x50')]['includeAll']){_0x19f952[_0xe36e('0x113')]=[{'all':!![]}];}return db[_0xe36e('0xda')][_0xe36e('0x114')](_0x19f952);})['then'](function(_0x4553ac){_0x51cea0[_0xe36e('0x115')]=_0x4553ac;return _0x51cea0;});}})['then'](respondWithFilteredResult(_0x2291d1,_0x19f952))[_0xe36e('0x29')](handleError(_0x2291d1,null));};exports['addTags']=function(_0x2cba34,_0x1e7118,_0x4b8d01){return db[_0xe36e('0x4b')][_0xe36e('0x74')]({'where':{'id':_0x2cba34['params']['id']}})['then'](handleEntityNotFound(_0x1e7118,null))[_0xe36e('0x35')](function(_0x4284aa){if(_0x4284aa){return _0x4284aa['setTags'](_0x2cba34['body'][_0xe36e('0x111')],_[_0xe36e('0x110')](_0x2cba34[_0xe36e('0x3d')],[_0xe36e('0x111'),'id'])||{})[_0xe36e('0x118')](function(){return db[_0xe36e('0x84')][_0xe36e('0x114')]({'attributes':['id','name',_0xe36e('0x5d')],'where':{'id':_0x2cba34[_0xe36e('0x3d')][_0xe36e('0x111')]}});})[_0xe36e('0x35')](function(_0x464128){socket[_0xe36e('0x119')](_0xe36e('0x11a'),{'id':Number(_0x2cba34[_0xe36e('0xc3')]['id']),'tags':_0x464128||[]});return{'id':Number(_0x2cba34['params']['id']),'tags':_0x464128||[]};});}})['then'](respondWithResult(_0x1e7118,null))[_0xe36e('0x29')](handleError(_0x1e7118,null));};exports[_0xe36e('0x11b')]=function(_0x262797,_0x40f9f1,_0x457c8e){return db[_0xe36e('0x4b')]['find']({'where':{'id':_0x262797[_0xe36e('0xc3')]['id']}})['then'](handleEntityNotFound(_0x40f9f1,null))['then'](function(_0x31fb7a){if(_0x31fb7a){return _0x31fb7a['removeTags'](_0x262797[_0xe36e('0x50')][_0xe36e('0x111')]);}})[_0xe36e('0x35')](respondWithStatusCode(_0x40f9f1,null))[_0xe36e('0x29')](handleError(_0x40f9f1,null));};exports[_0xe36e('0xf3')]=function(_0x20a347,_0x2c1324){var _0xa7ef59=moment()[_0xe36e('0x11c')]()[_0xe36e('0xa8')]();var _0x3a4701=path[_0xe36e('0xf2')](config[_0xe36e('0xef')],'server',_0xe36e('0x11d'),'tmp');var _0x1cab01=path[_0xe36e('0xf2')](config[_0xe36e('0xef')],'server',_0xe36e('0x11d'),_0xe36e('0x11e'));var _0x6c8c82=path[_0xe36e('0xf2')](_0x3a4701,_0xa7ef59);var _0x71c885=util['format'](_0xe36e('0x11f'),_0x20a347[_0xe36e('0xc3')]['id'],_0xa7ef59);var _0x29393a=path[_0xe36e('0xf2')](_0x3a4701,_0x71c885);var _0x4e7b14=[];_0x4e7b14[_0xe36e('0x48')]({'model':db[_0xe36e('0x85')],'as':_0xe36e('0x85'),'attributes':['id',_0xe36e('0x43')],'raw':!![]});_0x4e7b14[_0xe36e('0x48')]({'model':db[_0xe36e('0xdd')],'as':_0xe36e('0x79'),'attributes':['id',_0xe36e('0x120'),_0xe36e('0x121')],'raw':!![]});if(_0x20a347[_0xe36e('0x50')]['attachments']){_0x4e7b14[_0xe36e('0x48')]({'model':db[_0xe36e('0xe9')],'as':'Attachment','raw':!![]});}var _0xecb02b=[{'model':db[_0xe36e('0xda')],'as':_0xe36e('0xf7'),'attributes':['id',_0xe36e('0x3d'),_0xe36e('0x122'),_0xe36e('0x123'),_0xe36e('0x124'),_0xe36e('0x125')],'include':_0x4e7b14}];_0xecb02b[_0xe36e('0x48')]({'model':db[_0xe36e('0xcb')],'as':'Account','attributes':['id',_0xe36e('0x39')]});_0xecb02b[_0xe36e('0x48')]({'model':db[_0xe36e('0x85')],'as':_0xe36e('0x126'),'attributes':['id',_0xe36e('0x43')]});return db[_0xe36e('0x4b')][_0xe36e('0x74')]({'where':{'id':_0x20a347[_0xe36e('0xc3')]['id']},'include':_0xecb02b})[_0xe36e('0x35')](handleEntityNotFound(_0x2c1324,null))[_0xe36e('0x35')](function(_0x4197e9){if(_0x4197e9){var _0x35c442=_0x4197e9[_0xe36e('0x127')]({'plain':!![]});fs['mkdirSync'](_0x6c8c82);var _0x343ad8={'channel':'Chat','account':_0x35c442[_0xe36e('0x128')][_0xe36e('0x39')],'agent':_0x35c442[_0xe36e('0x126')]?_0x35c442[_0xe36e('0x126')]['fullname']:_0xe36e('0x129'),'createdAt':moment(_0x35c442[_0xe36e('0x122')])['format'](_0xe36e('0x12a'))[_0xe36e('0xa8')](),'closedAt':_0x35c442[_0xe36e('0xeb')]?moment(_0x35c442[_0xe36e('0x12b')])[_0xe36e('0xf8')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe36e('0xa8')]():'','disposition':_0x35c442[_0xe36e('0x12c')],'chatInfo':{'browser':_0x35c442['browserName'],'os':_0x35c442[_0xe36e('0x12d')],'referer':_0x35c442[_0xe36e('0x12e')],'customerIp':_0x35c442[_0xe36e('0x12f')],'customerPort':_0x35c442['customerPort']?_0x35c442['customerPort']:'N.A.'},'messages':_(_0x35c442[_0xe36e('0xf7')])['tail']()[_0xe36e('0x94')]({'secret':![]})['map'](function(_0x59156b){if(_0x59156b[_0xe36e('0xe9')]){var _0x52719b=path[_0xe36e('0xf2')](_0x1cab01,_0x59156b['Attachment'][_0xe36e('0xe5')]);if(fs['existsSync'](_0x52719b)){fs[_0xe36e('0x130')](_0x52719b)[_0xe36e('0x131')](fs[_0xe36e('0x132')](path[_0xe36e('0xf2')](_0x6c8c82,_0x59156b[_0xe36e('0xe9')][_0xe36e('0xe5')])));}}return{'date':moment(_0x59156b[_0xe36e('0x122')])[_0xe36e('0xf8')](_0xe36e('0x12a'))[_0xe36e('0xa8')](),'sender':_0x59156b[_0xe36e('0x123')]===_0xe36e('0x133')?_0x59156b['User']?_0x59156b[_0xe36e('0x85')][_0xe36e('0x43')]:_0xe36e('0xff'):_0x59156b[_0xe36e('0x79')]['firstName']+(_0x59156b[_0xe36e('0x79')][_0xe36e('0x121')]?'\x20'+_0x59156b[_0xe36e('0x79')]['lastName']:''),'body':_0x59156b['Attachment']?_0x59156b[_0xe36e('0xe9')][_0xe36e('0xe5')]:_0x59156b['body'],'direction':_0x59156b[_0xe36e('0x123')]===_0xe36e('0x133')?'A':'C','secret':_0x59156b['secret'],'read':_0x59156b[_0xe36e('0x125')],'attachment':_0x59156b[_0xe36e('0xe9')]};})['value']()};return ejs['renderFile'](path[_0xe36e('0xf2')](config[_0xe36e('0xef')],_0xe36e('0x134'),_0xe36e('0x135'),_0xe36e('0x136')),{'interaction':_0x343ad8})[_0xe36e('0x35')](function(_0x340915){var _0x5370b9=path['join'](_0x6c8c82,'transcript-'+_0x35c442['id']+'-'+_0xa7ef59+'.pdf');var _0x16b769={'path':_0x5370b9,'channel':'Chat','interactionId':_0x35c442['id']};return pdf['createPdfFromHTML'](_0x340915,_0x16b769);})[_0xe36e('0x35')](function(){return new BPromise(function(_0x36706c,_0x5e7f24){zipdir(_0x6c8c82,{'saveTo':_0x29393a},function(_0x5e19e2,_0x2a89b0){if(_0x5e19e2)return _0x5e7f24(_0x5e19e2);return _0x36706c(_0x2a89b0);});})[_0xe36e('0x35')](function(){return new BPromise(function(_0xf70d66,_0x2c0371){rimraf(_0x6c8c82,function(_0x59de53){if(_0x59de53)_0x2c0371(_0x59de53);return _0xf70d66();});});})[_0xe36e('0x35')](function(){return _0x2c1324['download'](_0x29393a,_0x71c885,function(_0x47e24c){if(_0x47e24c){console[_0xe36e('0x137')](_0xe36e('0x138'),_0x47e24c);}else{fs[_0xe36e('0x139')](_0x29393a);}});});});}else{return _0x2c1324[_0xe36e('0x37')](0xc8);}})[_0xe36e('0x29')](handleError(_0x2c1324,null));}; \ No newline at end of file +var _0x0abf=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','select','field','color','from','tools_tags','user_has_chat_interactions','users','chat_interactions','left_join','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','includeAll','include','options','params','describe','ChatWebsite','findOne','vidaooApiKey','vidaooTopic','vidaooMetadata','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','download','mailTranscript','format','transcript-%s.txt','now','User','CmContact','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','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','omit','pick','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','root','attachments','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','firstName','views','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','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','sendStatus','status','json','offset','undefined','limit','count','reject','update','destroy','end','stack','name','render','merge','body','contact','agent','account','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','rawAttributes','fieldName','type','key','model'];(function(_0x59039f,_0x402430){var _0x17f209=function(_0xa86449){while(--_0xa86449){_0x59039f['push'](_0x59039f['shift']());}};_0x17f209(++_0x402430);}(_0x0abf,0xe8));var _0xf0ab=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0abf[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xf0ab('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0ab('0x12'))(_0xf0ab('0x13'));var utils=require(_0xf0ab('0x14'));var config=require(_0xf0ab('0x15'));var licenseUtil=require(_0xf0ab('0x16'));var db=require(_0xf0ab('0x17'))['db'];config[_0xf0ab('0x18')]=_['defaults'](config[_0xf0ab('0x18')],{'host':_0xf0ab('0x19'),'port':0x18eb});var socket=require(_0xf0ab('0x1a'))(new Redis(config[_0xf0ab('0x18')]));require(_0xf0ab('0x1b'))[_0xf0ab('0x1c')](socket);var jayson=require(_0xf0ab('0x1d'));var client=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232b});var client9004=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x221bac,_0x200cf5,_0x2f4618,_0x230f40){return new BPromise(function(_0x54b0ce,_0x457465){var _0x9e3b47=_0x230f40||client;return _0x9e3b47[_0xf0ab('0x20')](_0x221bac,_0x2f4618)[_0xf0ab('0x21')](function(_0x776619){logger[_0xf0ab('0x22')](_0xf0ab('0x23'),_0x200cf5,_0xf0ab('0x24'));logger[_0xf0ab('0x25')](_0xf0ab('0x26'),_0x200cf5,_0xf0ab('0x24'),JSON[_0xf0ab('0x27')](_0x776619));if(_0x776619[_0xf0ab('0x28')]){if(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x29')]===0x1f4){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x457465(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}logger[_0xf0ab('0x28')](_0xf0ab('0x23'),_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x54b0ce(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}else{logger[_0xf0ab('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,'request\x20sent');_0x54b0ce(_0x776619['result'][_0xf0ab('0x2a')]);}})['catch'](function(_0x3eca32){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x3eca32);_0x457465(_0x3eca32);});});}function respondWithStatusCode(_0x163078,_0x22671e){_0x22671e=_0x22671e||0xcc;return function(_0x10bf5f){if(_0x10bf5f){return _0x163078[_0xf0ab('0x2b')](_0x22671e);}return _0x163078[_0xf0ab('0x2c')](_0x22671e)['end']();};}function respondWithResult(_0x2d0da7,_0x574ce7){_0x574ce7=_0x574ce7||0xc8;return function(_0x55d799){if(_0x55d799){return _0x2d0da7[_0xf0ab('0x2c')](_0x574ce7)[_0xf0ab('0x2d')](_0x55d799);}};}function respondWithFilteredResult(_0x1b223d,_0x445160){return function(_0x43476c){if(_0x43476c){var _0x174052=typeof _0x445160[_0xf0ab('0x2e')]===_0xf0ab('0x2f')&&typeof _0x445160[_0xf0ab('0x30')]===_0xf0ab('0x2f');var _0x21e8ac=_0x43476c[_0xf0ab('0x31')];var _0x58cbe1=_0x174052?0x0:_0x445160[_0xf0ab('0x2e')];var _0x35973a=_0x174052?_0x43476c['count']:_0x445160['offset']+_0x445160[_0xf0ab('0x30')];var _0x1dc84e;if(_0x35973a>=_0x21e8ac){_0x35973a=_0x21e8ac;_0x1dc84e=0xc8;}else{_0x1dc84e=0xce;}_0x1b223d[_0xf0ab('0x2c')](_0x1dc84e);return _0x1b223d['set']('Content-Range',_0x58cbe1+'-'+_0x35973a+'/'+_0x21e8ac)[_0xf0ab('0x2d')](_0x43476c);}return null;};}function patchUpdates(_0x58fa03){return function(_0x1cfd52){try{jsonpatch['apply'](_0x1cfd52,_0x58fa03,!![]);}catch(_0x3f66fa){return BPromise[_0xf0ab('0x32')](_0x3f66fa);}return _0x1cfd52['save']();};}function saveUpdates(_0x56e728,_0x469f42){return function(_0x27c6f9){if(_0x27c6f9){return _0x27c6f9[_0xf0ab('0x33')](_0x56e728)[_0xf0ab('0x21')](function(_0x2519c7){return _0x2519c7;});}return null;};}function removeEntity(_0x36195d,_0x17f3b3){return function(_0xf8f0f4){if(_0xf8f0f4){return _0xf8f0f4[_0xf0ab('0x34')]()[_0xf0ab('0x21')](function(){_0x36195d[_0xf0ab('0x2c')](0xcc)[_0xf0ab('0x35')]();});}};}function handleEntityNotFound(_0x22dcfe,_0x437fdb){return function(_0x5d8443){if(!_0x5d8443){_0x22dcfe[_0xf0ab('0x2b')](0x194);}return _0x5d8443;};}function handleError(_0x45c449,_0xc575ed){_0xc575ed=_0xc575ed||0x1f4;return function(_0x5c9192){logger[_0xf0ab('0x28')](_0x5c9192[_0xf0ab('0x36')]);if(_0x5c9192[_0xf0ab('0x37')]){delete _0x5c9192['name'];}_0x45c449[_0xf0ab('0x2c')](_0xc575ed)['send'](_0x5c9192);};}function getMustacheRender(_0xda3971,_0x492d7c){return Mustache[_0xf0ab('0x38')](_0xda3971,_[_0xf0ab('0x39')](_0x492d7c[_0xf0ab('0x3a')],{'contact':_0x492d7c[_0xf0ab('0x3b')],'message':_0x492d7c[_0xf0ab('0x2a')],'agent':_0x492d7c[_0xf0ab('0x3c')],'interaction':_0x492d7c['interaction'],'account':_0x492d7c[_0xf0ab('0x3d')]}))||'';}function getInteractionUsers(_0x683d08,_0x5a6df5){return new BPromise(function(_0x207fbb,_0xce89bc){try{if(_0x5a6df5[_0x683d08['id']]){_0x683d08[_0xf0ab('0x3e')]=_[_0xf0ab('0x3f')](_0x5a6df5[_0x683d08['id']],function(_0x31fa72){return{'id':_0x31fa72['id'],'fullname':_0x31fa72[_0xf0ab('0x40')]};});}}catch(_0x28c20c){_0xce89bc(_0x28c20c);}_0x207fbb(_0x683d08);});}function getInteractionTags(_0x528d4b,_0x406a1d){return new BPromise(function(_0x4f6e93,_0x7c4629){try{if(_0x528d4b['TagIds']){_0x528d4b[_0xf0ab('0x41')]=[];_0x528d4b[_0xf0ab('0x42')][_0xf0ab('0x43')](',')[_0xf0ab('0x44')](function(_0x2b7ed5){_0x528d4b['Tags'][_0xf0ab('0x45')](_0x406a1d[_0x2b7ed5]);});}delete _0x528d4b[_0xf0ab('0x42')];}catch(_0x28e7a4){_0x7c4629(_0x28e7a4);}_0x4f6e93(_0x528d4b);});}function updateChatInteraction(_0x197955,_0x191caf,_0x17a73){return new BPromise(function(_0x45849c,_0x413f5c){return getInteractionUsers(_0x197955,_0x17a73)[_0xf0ab('0x21')](function(_0x3b214a){return getInteractionTags(_0x3b214a,_0x191caf);})[_0xf0ab('0x21')](function(_0x32ec93){_0x45849c(_0x32ec93);})[_0xf0ab('0x46')](function(_0x5e6b6b){_0x413f5c(_0x5e6b6b);});});}exports['index']=function(_0x2fc677,_0x4e6c41){var _0x1fc766={},_0x2d50c0={},_0x4bbdf6={'count':0x0,'rows':[]};var _0x8c2d2c=_[_0xf0ab('0x3f')](db['ChatInteraction'][_0xf0ab('0x47')],function(_0x29cc6a){return{'name':_0x29cc6a[_0xf0ab('0x48')],'type':_0x29cc6a[_0xf0ab('0x49')][_0xf0ab('0x4a')]};});_0x2d50c0[_0xf0ab('0x4b')]=_[_0xf0ab('0x3f')](_0x8c2d2c,_0xf0ab('0x37'));_0x2d50c0[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x2fc677[_0xf0ab('0x4c')]);_0x2d50c0[_0xf0ab('0x4e')]=_[_0xf0ab('0x4f')](_0x2d50c0[_0xf0ab('0x4b')],_0x2d50c0['query']);_0x1fc766['attributes']=_[_0xf0ab('0x4f')](_0x2d50c0['model'],qs['fields'](_0x2fc677['query'][_0xf0ab('0x50')]));_0x1fc766[_0xf0ab('0x51')]=_0x1fc766[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x1fc766[_0xf0ab('0x51')]:_0x2d50c0[_0xf0ab('0x4b')];if(!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x1fc766[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x2fc677[_0xf0ab('0x4c')]['limit']);_0x1fc766[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x1fc766[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x1fc766['where']=qs['filters'](_['pick'](_0x2fc677[_0xf0ab('0x4c')],_0x2d50c0[_0xf0ab('0x4e')]),_0x8c2d2c);var _0x577c85=[];var _0xa1a416=squel[_0xf0ab('0x57')]()['field']('id')[_0xf0ab('0x58')](_0xf0ab('0x37'))[_0xf0ab('0x58')](_0xf0ab('0x59'))[_0xf0ab('0x5a')](_0xf0ab('0x5b'));var _0x26508b=squel['select']()[_0xf0ab('0x58')]('u.id')[_0xf0ab('0x58')]('u.fullname')[_0xf0ab('0x58')]('ui.ChatInteractionId')['from'](_0xf0ab('0x5c'),'ui')['left_join'](_0xf0ab('0x5d'),'u','u.id\x20=\x20ui.UserId');var _0x2eff07=squel['select']()[_0xf0ab('0x5a')](_0xf0ab('0x5e'),'i')[_0xf0ab('0x5f')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xf0ab('0x5d'),'o',_0xf0ab('0x60'))['left_join']('chat_websites','a',_0xf0ab('0x61'))[_0xf0ab('0x5f')](_0xf0ab('0x62'),'me',_0xf0ab('0x63'))[_0xf0ab('0x5f')](_0xf0ab('0x64'),'it',_0xf0ab('0x65'))[_0xf0ab('0x5f')](_0xf0ab('0x5b'),'t',_0xf0ab('0x66'));var _0x1e6a4e=squel['expr']();var _0x41ed17=[];var _0x5b24e3=squel[_0xf0ab('0x67')]();var _0x61d3db;if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]){_0x61d3db=as[_0xf0ab('0x69')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]);var _0x1f11aa=_0x61d3db[_0xf0ab('0x6a')];for(var _0x180ee6=0x0;_0x180ee6<_0x61d3db['conditions'][_0xf0ab('0x52')];_0x180ee6++){var _0x2266f3=_0x61d3db[_0xf0ab('0x6b')][_0x180ee6];var _0x1d4a72='i';var _0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0x2266f3[_0xf0ab('0x58')]]);if(!_0x2232eb){switch(_0x2266f3[_0xf0ab('0x58')]){case'unreadMessages':if(_0x2266f3['value']==0x1){_0x2eff07[_0xf0ab('0x6d')]('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6e'));}else{_0x2eff07['having']('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6f'));}break;case _0xf0ab('0x70'):if(_0x2266f3['operator']===_0xf0ab('0x71')){if(_0x2266f3[_0xf0ab('0x72')][_0xf0ab('0x43')]('\x20')[_0xf0ab('0x52')]>0x1){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x73'),qs['getFullTextValue'](_0x2266f3[_0xf0ab('0x72')]),null);}else{var _0x70b02d='%'+_0x2266f3[_0xf0ab('0x72')]+'%';_0x1e6a4e[_0x1f11aa](_0xf0ab('0x74'),_0x70b02d,_0x70b02d,_0x70b02d);}}else{_0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x75')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x75');_0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')]['start'],_0x5154f5['value'][_0xf0ab('0x35')]);}break;case _0xf0ab('0x78'):var _0x325ad6=_0x2266f3['value'][_0xf0ab('0x43')](',')['map'](function(_0x1a32dc){return Number(_0x1a32dc);});_0x325ad6[_0xf0ab('0x44')](function(_0x1787e2){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1787e2+',%');});_0x41ed17=_[_0xf0ab('0x79')](_0x41ed17,_0x325ad6);break;case'User':if(_0x2266f3['operator']===_0xf0ab('0x71')){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x7a'),'%'+_0x2266f3[_0xf0ab('0x72')]+'%',null);}else{_0x2232eb=_['find'](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x7b')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x7b');_0x5154f5=as['buildExpression'](_0x1d4a72,_0x2232eb['type'],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5['text'],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}break;case _0xf0ab('0x3a'):_0x5154f5=as[_0xf0ab('0x76')]('me',null,_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);break;}}else{var _0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}}}else{var _0x42f067=_(_0x2fc677['query'])[_0xf0ab('0x4d')]()[_0xf0ab('0x3f')](function(_0x4c8e95){return _['some'](_0x8c2d2c,['name',_0x4c8e95])?_0x4c8e95:undefined;})[_0xf0ab('0x7d')]()[_0xf0ab('0x72')]();if(!_[_0xf0ab('0x7e')](_0x42f067)){_0x42f067[_0xf0ab('0x44')](function(_0x15aa78){if(_0x15aa78===_0xf0ab('0x7f')){_0x2eff07['where'](_0xf0ab('0x80'),[]['concat'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]));}else if(_0x15aa78==='createdAt'){var _0x2978a9=JSON['parse'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])['$gte'];var _0x58ca28=JSON[_0xf0ab('0x81')](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])[_0xf0ab('0x82')];_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x84'),_0x2978a9,_0x58ca28);}else{if(_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]===_0xf0ab('0x85')){_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x86'));}else{_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x87'),_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]);}}});}if(_0x2fc677[_0xf0ab('0x4c')]['read']){if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x88')]==0x1){_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x89'));}else{_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x8a'));}}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]){_0x41ed17=_[_0xf0ab('0x8c')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')])?_0x2fc677[_0xf0ab('0x4c')]['tag']:new Array(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]);_0x41ed17[_0xf0ab('0x44')](function(_0x2196a7){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2196a7+',%');});}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]){var _0x4463cc=_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]['replace']('\x5c','\x5c\x5c')[_0xf0ab('0x8e')](/'/g,'\x27\x27');if(qs[_0xf0ab('0x8f')](_0x4463cc)){_0x1e6a4e['or']('i.id\x20LIKE\x20?',_0x4463cc+'%');}else{_0x1e6a4e['or'](_0xf0ab('0x90'),qs['getFullTextValue'](_0x4463cc))['or'](_0xf0ab('0x91'),_0x4463cc+'%');}}}_0x2eff07[_0xf0ab('0x83')](_0x1e6a4e);_0x2eff07['group'](_0xf0ab('0x92'));var _0x148a72={'type':db['Sequelize']['QueryTypes'][_0xf0ab('0x93')],'raw':!![]};var _0x58140c=_0x2eff07[_0xf0ab('0x94')]();_0x58140c[_0xf0ab('0x58')]('i.id');_0x58140c['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf0ab('0x95'));if(_0x1fc766[_0xf0ab('0x55')]){_0x1fc766[_0xf0ab('0x55')][_0xf0ab('0x44')](function(_0x49c89f){var _0x272f9c=_0x49c89f[0x0]===_0xf0ab('0x96')?_0x49c89f[0x0]:'i.'+_0x49c89f[0x0];_0x2eff07[_0xf0ab('0x55')](_0x272f9c,_0x49c89f[0x1]===_0xf0ab('0x97')?![]:!![]);});}if(!_[_0xf0ab('0x7e')](_0x41ed17)){_0x2eff07['having'](_0x5b24e3);_0x58140c['where'](_0xf0ab('0x98'),_0x41ed17);}BPromise[_0xf0ab('0x99')]()['then'](function(){if(!_0x61d3db){if(_0x2fc677['query'][_0xf0ab('0x7f')])return;_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x9a'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9a'));return;}if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]!==_0xf0ab('0x3c'))return;return _0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9d')]({'attributes':['id'],'raw':!![]})[_0xf0ab('0x21')](function(_0x52eca9){if(_['isEmpty'](_0x52eca9)){_0x58140c[_0xf0ab('0x83')]('i.ChatWebsiteId\x20IS\x20NULL');_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9e'));}else{_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x80'),_['map'](_0x52eca9,'id'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x80'),_[_0xf0ab('0x3f')](_0x52eca9,'id'));}});})[_0xf0ab('0x21')](function(){if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]===_0xf0ab('0x3c')&&!_0x61d3db&&!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x7f')])return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x58140c[_0xf0ab('0xa0')](),_0x148a72);})[_0xf0ab('0x21')](function(_0x4211a1){_0x4bbdf6['count']=_0x4211a1[_0xf0ab('0x52')];if(_0x4bbdf6[_0xf0ab('0x31')]===0x0)return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0xa1a416[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x611cf7){_0x577c85=_['keyBy'](_0x611cf7,'id');_0x148a72=_['merge'](_0x148a72,{'model':db[_0xf0ab('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x50')]){_0x1fc766['attributes'][_0xf0ab('0x44')](function(_0x405b34){_0x2eff07[_0xf0ab('0x58')]('i.'+_0x405b34);});}else{_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa2'),'unreadMessages');_0x2eff07['field'](_0xf0ab('0xa3'),'Account.key');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa4'),'Account.mandatoryDisposition');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa5'),_0xf0ab('0x96'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa6'));_0x2eff07['field'](_0xf0ab('0xa7'),_0xf0ab('0xa8'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa9'),_0xf0ab('0xaa'));_0x2eff07['field'](_0xf0ab('0xab'),_0xf0ab('0xac'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xad'),_0xf0ab('0xae'));_0x2eff07['field'](_0xf0ab('0xaf'),_0xf0ab('0xb0'));_0x2eff07[_0xf0ab('0x58')]('c.fax',_0xf0ab('0xb1'));_0x2eff07['field'](_0xf0ab('0xb2'),_0xf0ab('0xb3'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xb4'),'Owner.internal');_0x2eff07[_0xf0ab('0x58')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x1fc766[_0xf0ab('0x30')])_0x2eff07['limit'](_0x1fc766['limit']);if(_0x1fc766[_0xf0ab('0x2e')])_0x2eff07[_0xf0ab('0x2e')](_0x1fc766['offset']);return db['sequelize']['query'](_0x2eff07['toString'](),_0x148a72);})[_0xf0ab('0x21')](function(_0x12d9b6){if(_0x12d9b6[_0xf0ab('0x52')]>0x0)_0x26508b[_0xf0ab('0x83')](_0xf0ab('0xb5'),_['map'](_0x12d9b6,'id'));return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x26508b[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x84eab9){var _0x27cd98=_[_0xf0ab('0xb6')](_0x84eab9,'ChatInteractionId');var _0x16dca7=[];_0x12d9b6[_0xf0ab('0x44')](function(_0x39633a){_0x16dca7[_0xf0ab('0x45')](updateChatInteraction(_0x39633a,_0x577c85,_0x27cd98));});return BPromise[_0xf0ab('0xb7')](_0x16dca7);});});})[_0xf0ab('0x21')](function(_0x527a4b){_0x4bbdf6[_0xf0ab('0xb8')]=_0x527a4b;return _0x4bbdf6;})[_0xf0ab('0x21')](respondWithFilteredResult(_0x4e6c41,_0x1fc766))[_0xf0ab('0x46')](handleError(_0x4e6c41,null));};exports[_0xf0ab('0xb9')]=function(_0x4ca7a3,_0x426419){var _0x395bf6={'raw':![],'where':{'id':_0x4ca7a3['params']['id']}},_0x5b7744={};_0x5b7744[_0xf0ab('0x4b')]=_[_0xf0ab('0x4d')](db[_0xf0ab('0xa1')][_0xf0ab('0x47')]);_0x5b7744[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4ca7a3[_0xf0ab('0x4c')]);_0x5b7744[_0xf0ab('0x4e')]=_['intersection'](_0x5b7744[_0xf0ab('0x4b')],_0x5b7744['query']);_0x395bf6['attributes']=_[_0xf0ab('0x4f')](_0x5b7744[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x395bf6[_0xf0ab('0x51')]=_0x395bf6[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x395bf6['attributes']:_0x5b7744[_0xf0ab('0x4b')];if(_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x395bf6[_0xf0ab('0xbb')]=[{'all':!![]}];}_0x395bf6=_[_0xf0ab('0x39')]({},_0x395bf6,_0x4ca7a3[_0xf0ab('0xbc')]);return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')](_0x395bf6)[_0xf0ab('0x21')](handleEntityNotFound(_0x426419,null))[_0xf0ab('0x21')](respondWithResult(_0x426419,null))['catch'](handleError(_0x426419,null));};exports['create']=function(_0x58946c,_0x2f339d){return db['ChatInteraction']['create'](_0x58946c[_0xf0ab('0x3a')],{})[_0xf0ab('0x21')](respondWithResult(_0x2f339d,0xc9))[_0xf0ab('0x46')](handleError(_0x2f339d,null));};exports[_0xf0ab('0x33')]=function(_0xdf495,_0x55a296){if(_0xdf495[_0xf0ab('0x3a')]['id']){delete _0xdf495[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0xdf495[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x55a296,null))[_0xf0ab('0x21')](saveUpdates(_0xdf495[_0xf0ab('0x3a')],null))['then'](respondWithResult(_0x55a296,null))[_0xf0ab('0x46')](handleError(_0x55a296,null));};exports['destroy']=function(_0x3c1a2c,_0x17a3b6){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3c1a2c[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x17a3b6,null))[_0xf0ab('0x21')](removeEntity(_0x17a3b6,null))[_0xf0ab('0x46')](handleError(_0x17a3b6,null));};exports[_0xf0ab('0xbe')]=function(_0x1f2efa,_0x1d12fb){return db[_0xf0ab('0xa1')]['describe']()[_0xf0ab('0x21')](respondWithResult(_0x1d12fb,null))[_0xf0ab('0x46')](handleError(_0x1d12fb,null));};exports['createVidaooSession']=function(_0x35486d,_0x3f5ade){var _0x135a10=_0x35486d[_0xf0ab('0xbd')]['id'];var _0x48fc7e;var _0x5f55d2;var _0x7c7c3b;return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x135a10}})[_0xf0ab('0x21')](function(_0x2beaaa){_0x48fc7e=_0x2beaaa;return db[_0xf0ab('0xbf')][_0xf0ab('0xc0')]({'where':{'id':_0x2beaaa[_0xf0ab('0x7f')]},'attributes':['id',_0xf0ab('0xc1'),'vidaooEscalation',_0xf0ab('0xc2'),'vidaooNote',_0xf0ab('0xc3')],'raw':!![]});})[_0xf0ab('0x21')](function(_0x354e18){if(_0x354e18&&_0x354e18['vidaooApiKey']&&_0x354e18[_0xf0ab('0xc4')]){_0x5f55d2=_0x354e18;var _0x2068d6={'interaction':{'id':_0x135a10},'agent':{'id':_0x35486d[_0xf0ab('0x9b')]['id'],'name':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x37')],'fullname':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x40')],'email':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]},'contact':_0x35486d['body']['contact'],'account':_0x35486d[_0xf0ab('0x3a')][_0xf0ab('0x3d')]};var _0x35b480={'rejectUnauthorized':![],'method':_0xf0ab('0xc6'),'url':_0xf0ab('0xc7'),'headers':{'X-APIKEY':_0x354e18[_0xf0ab('0xc1')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]],'buttons':null,'topic':_0x5f55d2[_0xf0ab('0xc2')],'note':_[_0xf0ab('0xc8')](_0x5f55d2['vidaooNote'])?null:getMustacheRender(_0x5f55d2[_0xf0ab('0xc9')],_0x2068d6),'metadata':null},'redirect':_0xf0ab('0xca'),'json':!![]};try{if(!_[_0xf0ab('0xc8')](_0x5f55d2[_0xf0ab('0xc3')])){var _0x41e2d8=getMustacheRender(_0x5f55d2[_0xf0ab('0xc3')],_0x2068d6);var _0x57f44d=JSON[_0xf0ab('0x81')](_0x41e2d8);_0x35b480[_0xf0ab('0x3a')][_0xf0ab('0xcb')]=_0x57f44d;}}catch(_0x533b37){throw new db[(_0xf0ab('0xcc'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x35b480);}else{throw new db[(_0xf0ab('0xcc'))][(_0xf0ab('0xcd'))](_0xf0ab('0xce'));}})['then'](function(_0x1697ca){_0x7c7c3b=_0x1697ca;if(_0x7c7c3b['id']){var _0x15da8a={'body':_0x7c7c3b[_0xf0ab('0xcf')],'ChatWebsiteId':_0x5f55d2['id'],'ChatInteractionId':_0x48fc7e['id'],'direction':'out','UserId':_0x35486d[_0xf0ab('0x9b')]['id']};return db[_0xf0ab('0xd0')][_0xf0ab('0xd1')](_0x15da8a,{});}else{throw new db['Sequelize'][(_0xf0ab('0xcd'))](_0xf0ab('0xd2'));}})[_0xf0ab('0x21')](function(){return _0x48fc7e[_0xf0ab('0xd3')]({'vidaooSessionId':_0x7c7c3b['id']});})[_0xf0ab('0x21')](respondWithResult(_0x3f5ade,null))[_0xf0ab('0x46')](handleError(_0x3f5ade,null));};exports[_0xf0ab('0xd4')]=function(_0x115e3d,_0x2d0f9c){if(_0x115e3d[_0xf0ab('0x3a')]['id']){delete _0x115e3d[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x115e3d[_0xf0ab('0xbd')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x2d0f9c,null))[_0xf0ab('0x21')](saveUpdates(_0x115e3d['body'],null))[_0xf0ab('0x21')](respondWithResult(_0x2d0f9c,null))['catch'](handleError(_0x2d0f9c,null));};exports[_0xf0ab('0xd5')]=function(_0x1e9768,_0x4398a3,_0x4195d9){if(_0x1e9768[_0xf0ab('0x3a')]['id']){delete _0x1e9768[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x1e9768[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](function(_0x5f10a5){if(!_0x5f10a5){logger[_0xf0ab('0x28')](_0xf0ab('0xd6'),_0xf0ab('0xd5'),0x194,_0xf0ab('0xd7'));_0x4398a3[_0xf0ab('0x2b')](0x194);}else{if(_0x5f10a5[_0xf0ab('0x7b')]){throw new db['Sequelize']['ValidationError'](_0xf0ab('0xd8'));}}return _0x5f10a5;})[_0xf0ab('0x21')](function(_0x564124){if(_0x564124){return _0x564124[_0xf0ab('0x33')]({'closed':_0x1e9768[_0xf0ab('0x3a')][_0xf0ab('0xd9')],'disposition':_0x1e9768['body'][_0xf0ab('0xda')]})[_0xf0ab('0x21')](function(_0x2d9046){return _0x2d9046;});}})[_0xf0ab('0x21')](function(_0x4e5f1e){return respondWithRpcPromise(_0xf0ab('0xdb'),_0xf0ab('0xd5'),_0x1e9768[_0xf0ab('0x3a')],client9004);})['then'](respondWithResult(_0x4398a3,null))['catch'](handleError(_0x4398a3,null));};exports['attachmentUpload']=function(_0x581cb1,_0x22251d,_0x2b5993){_0x581cb1[_0xf0ab('0x3a')]['name']=_0x581cb1[_0xf0ab('0xdc')]['originalname'];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0xdd')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xde')];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0x49')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xdf')];return db[_0xf0ab('0xe0')][_0xf0ab('0xd1')](_0x581cb1[_0xf0ab('0x3a')])[_0xf0ab('0x21')](respondWithResult(_0x22251d,0xc9))[_0xf0ab('0x46')](handleError(_0x22251d,null));};exports[_0xf0ab('0xe1')]=function(_0x4d09bf,_0x415b9d,_0x11ed58){return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x4d09bf[_0xf0ab('0xbd')]['id']},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null))[_0xf0ab('0x21')](function(_0x278e32){if(_0x278e32){if(_0x278e32['closed']){return _0x415b9d[_0xf0ab('0x2c')](0x193)[_0xf0ab('0x2d')]({'status':0x193,'message':_0xf0ab('0xe2')});}return db[_0xf0ab('0xe0')][_0xf0ab('0xc0')]({'where':{'id':_0x4d09bf[_0xf0ab('0x4c')][_0xf0ab('0xe3')]},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null));}})['then'](function(_0xadae03){if(_0xadae03){var _0x550b00=_0xadae03[_0xf0ab('0xe4')]!==null;var _0x2bfb6a=path[_0xf0ab('0xe5')](config['root'],_0xf0ab('0xe6'));if(_0x550b00){_0x2bfb6a=path[_0xf0ab('0xe5')](_0x2bfb6a,'offline-chat/');}var _0x5d62e4=path['join'](_0x2bfb6a,_0xadae03['basename']);return _0x415b9d[_0xf0ab('0xe7')](_0x5d62e4);}})['catch'](handleError(_0x415b9d,null));};exports['close']=function(_0x3b8bbe,_0x7e24c4){var _0x2d0ea3=null;var _0x4a18ad=null;var _0x57aaae=null;var _0x2ab0be=null;if(_0x3b8bbe[_0xf0ab('0x3a')]['id']){delete _0x3b8bbe['body']['id'];}if(_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')]){_0x2ab0be=path['join'](config['root'],'server/files/chat/upload/',util[_0xf0ab('0xe9')](_0xf0ab('0xea'),Date[_0xf0ab('0xeb')]()));_0x3b8bbe[_0xf0ab('0x3a')]['pathTranscript']=_0x2ab0be;}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x3b8bbe['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xf0ab('0xec')],'as':'User'}]}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x7e24c4,null))[_0xf0ab('0x21')](saveUpdates(_0x3b8bbe[_0xf0ab('0x3a')],null))[_0xf0ab('0x21')](function(_0x116c84){if(_0x116c84){_0x2d0ea3=_0x116c84;return db[_0xf0ab('0xbf')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3[_0xf0ab('0x7f')]}});}})[_0xf0ab('0x21')](function(_0x1d6e15){if(_0x1d6e15){_0x57aaae=_0x1d6e15;return db[_0xf0ab('0xed')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3['ContactId']}});}})[_0xf0ab('0x21')](function(_0x29427c){if(_0x29427c){_0x4a18ad=_0x29427c;if(_0x2ab0be){var _0x29d4a1=null;for(var _0x50e996=0x1;_0x50e996<_0x2d0ea3['Messages'][_0xf0ab('0x52')];++_0x50e996){_0x29d4a1=_0x2d0ea3[_0xf0ab('0xee')][_0x50e996];var _0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');var _0xc1537e=_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xf2')]||util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0xf0ab('0xf3'),_0x29d4a1[_0xf0ab('0x75')]);switch(_0x57aaae[_0xf0ab('0xf4')]){case _0xf0ab('0xf5'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae['agentAlias'],_0x29d4a1[_0xf0ab('0x7b')]):'System';break;case _0xf0ab('0xf6'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0xf7')]||_0x29d4a1['User'][_0xf0ab('0x40')]:'System';break;case'agent_fullname':_0x8e04bb=_0x29d4a1['UserId']?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0x40')]:_0xf0ab('0xf1');break;default:_0x8e04bb=_0x29d4a1['UserId']?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');}var _0x2c39f0=util[_0xf0ab('0xe9')](_0xf0ab('0xf8'),moment(_0x29d4a1[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0xfa')),_0x29d4a1[_0xf0ab('0xfb')]==='in'?_0xc1537e:_0x8e04bb,_0x29d4a1['body']);if(!_0x29d4a1[_0xf0ab('0xfc')]){fs[_0xf0ab('0xfd')](_0x2ab0be,_0x2c39f0);}}return db[_0xf0ab('0xfe')][_0xf0ab('0xc0')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf0ab('0xff'),'raw':!![]}]});}}})['then'](function(_0x21eb2b){if(_0x21eb2b&&_0x21eb2b['Smtp']&&_0x3b8bbe[_0xf0ab('0x3a')]){var _0x262659={'tls':{'rejectUnauthorized':![]}};if(_0x21eb2b['Smtp'][_0xf0ab('0x100')]){_0x262659[_0xf0ab('0x100')]=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x100')];}else{_0x262659[_0xf0ab('0x101')]=_0x21eb2b['Smtp'][_0xf0ab('0x101')];_0x262659[_0xf0ab('0x102')]=_0x21eb2b[_0xf0ab('0xff')]['port'];_0x262659['secure']=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x103')];}if(_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x104')]){_0x262659['auth']={'user':_0x21eb2b['Smtp'][_0xf0ab('0x9b')],'pass':_0x21eb2b[_0xf0ab('0xff')]['pass']};}return respondWithRpcPromise('SendMail',_0xf0ab('0x105'),{'account':_0x262659,'message':{'from':util['format'](_0xf0ab('0x106'),_0x21eb2b['name'],_0x21eb2b[_0xf0ab('0xc5')]||_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x9b')]),'to':_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')],'subject':_0xf0ab('0x107'),'text':util[_0xf0ab('0xe9')](_0xf0ab('0x108'),_0x3b8bbe['body'][_0xf0ab('0xe8')]),'attachments':[{'path':_0x2ab0be}]}})[_0xf0ab('0x21')](function(){return _0x2d0ea3;})[_0xf0ab('0x46')](function(_0x15f041){console[_0xf0ab('0x28')](_0x15f041);});}else{return _0x2d0ea3;}})['then'](respondWithStatusCode(_0x7e24c4,0xc8))[_0xf0ab('0x46')](handleError(_0x7e24c4,null));};exports[_0xf0ab('0x109')]=function(_0x5eda4b,_0x57a8ab,_0x3cee1d){return db[_0xf0ab('0xd0')][_0xf0ab('0x6c')]({'where':{'id':_0x5eda4b[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x57a8ab,null))[_0xf0ab('0x21')](function(_0x4dff6e){if(_0x4dff6e){return _0x4dff6e[_0xf0ab('0x109')](_0x5eda4b[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_[_0xf0ab('0x10b')](_0x5eda4b[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{});}})['then'](respondWithResult(_0x57a8ab,null))[_0xf0ab('0x46')](handleError(_0x57a8ab,null));};exports['getMessages']=function(_0x283bf5,_0x1afcea,_0x22a9f8){var _0x33dbfc={'raw':![],'where':{}};var _0x487318={};var _0x546e13={'count':0x0,'rows':[]};return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x283bf5[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x1afcea,null))[_0xf0ab('0x21')](function(_0xa3b903){if(_0xa3b903){_0x487318['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x487318[_0xf0ab('0x4c')]=_['keys'](_0x283bf5[_0xf0ab('0x4c')]);_0x487318[_0xf0ab('0x4e')]=_['intersection'](_0x487318[_0xf0ab('0x4b')],_0x487318[_0xf0ab('0x4c')]);_0x33dbfc[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x487318[_0xf0ab('0x4b')],qs['fields'](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x33dbfc[_0xf0ab('0x51')]=_0x33dbfc['attributes'][_0xf0ab('0x52')]?_0x33dbfc[_0xf0ab('0x51')]:_0x487318[_0xf0ab('0x4b')];if(!_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x33dbfc[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x33dbfc['offset']=qs['offset'](_0x283bf5[_0xf0ab('0x4c')]['offset']);}_0x33dbfc['order']=qs[_0xf0ab('0x56')](_0x283bf5[_0xf0ab('0x4c')]['sort']);_0x33dbfc[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x283bf5['query'],_0x487318[_0xf0ab('0x4e')]));_0x33dbfc['where'][_0xf0ab('0x10d')]=_0xa3b903['id'];if(_0x283bf5['query'][_0xf0ab('0x8d')]){_0x33dbfc[_0xf0ab('0x83')]=_[_0xf0ab('0x39')](_0x33dbfc['where'],{'$or':_[_0xf0ab('0x3f')](_0x33dbfc[_0xf0ab('0x51')],function(_0x2ddc1d){var _0x3cef14={};_0x3cef14[_0x2ddc1d]={'$like':'%'+_0x283bf5['query'][_0xf0ab('0x8d')]+'%'};return _0x3cef14;})});}if(_0x283bf5[_0xf0ab('0x4c')]['$gte']){var _0x38ea18=_0x283bf5[_0xf0ab('0x4c')]['$gte']['split'](',');var _0x7ee6b3={};_0x7ee6b3[_0x38ea18[0x0]]={'$gte':moment(_0x38ea18[0x1])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))};_0x33dbfc['where']=_[_0xf0ab('0x39')](_0x33dbfc['where'],_0x7ee6b3);}_0x33dbfc=_[_0xf0ab('0x39')]({},_0x33dbfc,_0x283bf5['options']);return db[_0xf0ab('0xd0')]['count']({'where':_0x33dbfc['where']})['then'](function(_0x1d1451){_0x546e13['count']=_0x1d1451;if(_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x33dbfc[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x33dbfc);})['then'](function(_0x16a1d2){_0x546e13[_0xf0ab('0xb8')]=_0x16a1d2;return _0x546e13;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x1afcea,_0x33dbfc))[_0xf0ab('0x46')](handleError(_0x1afcea,null));};exports[_0xf0ab('0x110')]=function(_0x4b91de,_0x3a602f,_0x47788a){var _0x3592f1={'where':{}},_0x577f13={},_0x2f99c2={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf0ab('0xc0')]({'where':{'id':_0x4b91de[_0xf0ab('0xbd')]['id']}})['then'](handleEntityNotFound(_0x3a602f,null))['then'](function(_0x43c6b8){if(_0x43c6b8){_0x577f13['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x577f13[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4b91de[_0xf0ab('0x4c')]);_0x577f13['filters']=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],_0x577f13[_0xf0ab('0x4c')]);_0x3592f1[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4b91de['query'][_0xf0ab('0x50')]));_0x3592f1[_0xf0ab('0x51')]=_0x3592f1['attributes'][_0xf0ab('0x52')]?_0x3592f1['attributes']:_0x577f13[_0xf0ab('0x4b')];if(!_0x4b91de['query']['hasOwnProperty']('nolimit')){_0x3592f1[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x3592f1[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x3592f1[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x3592f1[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x4b91de[_0xf0ab('0x4c')],_0x577f13[_0xf0ab('0x4e')]));_0x3592f1['where'][_0xf0ab('0x10d')]=_0x43c6b8['id'];if(_0x4b91de['query'][_0xf0ab('0x8d')]){_0x3592f1['where']=_[_0xf0ab('0x39')](_0x3592f1[_0xf0ab('0x83')],{'$or':_[_0xf0ab('0x3f')](_0x3592f1['attributes'],function(_0x58f64c){var _0x5dc7d4={};_0x5dc7d4[_0x58f64c]={'$like':'%'+_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x8d')]+'%'};return _0x5dc7d4;})});}_0x3592f1['where'][_0xf0ab('0xfc')]=![];if(_0x4b91de[_0xf0ab('0x4c')]['id']){_0x3592f1[_0xf0ab('0x83')]['id']={'$gt':_0x4b91de[_0xf0ab('0x4c')]['id']};}_0x3592f1=_['merge']({},_0x3592f1,_0x4b91de['options']);return db[_0xf0ab('0xd0')][_0xf0ab('0x31')]({'where':_0x3592f1[_0xf0ab('0x83')]})[_0xf0ab('0x21')](function(_0x2ab983){_0x2f99c2['count']=_0x2ab983;_0x3592f1[_0xf0ab('0xbb')]=[];if(_0x4b91de['query'][_0xf0ab('0x111')]){_0x3592f1[_0xf0ab('0xbb')][_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id',_0xf0ab('0x40'),_0xf0ab('0xf7')]});}if(_0x4b91de[_0xf0ab('0x4c')]['includeAll']){_0x3592f1[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x3592f1);})[_0xf0ab('0x21')](function(_0x3d70c0){_0x2f99c2[_0xf0ab('0xb8')]=_0x3d70c0;return _0x2f99c2;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x3a602f,_0x3592f1))[_0xf0ab('0x46')](handleError(_0x3a602f,null));};exports['addTags']=function(_0x4d10af,_0x5cf4bd,_0x368523){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x4d10af['params']['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x5cf4bd,null))[_0xf0ab('0x21')](function(_0x46a38a){if(_0x46a38a){return _0x46a38a[_0xf0ab('0x112')](_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_['omit'](_0x4d10af[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{})[_0xf0ab('0x113')](function(){return db['Tag'][_0xf0ab('0x10f')]({'attributes':['id',_0xf0ab('0x37'),_0xf0ab('0x59')],'where':{'id':_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')]}});})[_0xf0ab('0x21')](function(_0x1df97b){socket[_0xf0ab('0x114')](_0xf0ab('0x115'),{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]});return{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]};});}})[_0xf0ab('0x21')](respondWithResult(_0x5cf4bd,null))['catch'](handleError(_0x5cf4bd,null));};exports[_0xf0ab('0x116')]=function(_0x3ca465,_0x4e379d,_0x122e66){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3ca465[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x4e379d,null))[_0xf0ab('0x21')](function(_0x5c56e0){if(_0x5c56e0){return _0x5c56e0[_0xf0ab('0x116')](_0x3ca465[_0xf0ab('0x4c')][_0xf0ab('0x10a')]);}})['then'](respondWithStatusCode(_0x4e379d,null))[_0xf0ab('0x46')](handleError(_0x4e379d,null));};exports[_0xf0ab('0xe7')]=function(_0x2baa40,_0x4ff52d){var _0x2a2fea=moment()[_0xf0ab('0x117')]()[_0xf0ab('0xa0')]();var _0x4eccbd=path['join'](config['root'],_0xf0ab('0x118'),_0xf0ab('0x119'),_0xf0ab('0x11a'));var _0x5b6475=path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],'server',_0xf0ab('0x119'),_0xf0ab('0x11c'));var _0x595bda=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2a2fea);var _0x2bd3e3=util['format']('transcript-%d-%s.zip',_0x2baa40[_0xf0ab('0xbd')]['id'],_0x2a2fea);var _0x25242e=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2bd3e3);var _0x3d8794=[];_0x3d8794[_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id','fullname'],'raw':!![]});_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xed')],'as':_0xf0ab('0x70'),'attributes':['id','firstName',_0xf0ab('0x11d')],'raw':!![]});if(_0x2baa40[_0xf0ab('0x4c')][_0xf0ab('0x11c')]){_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xe0')],'as':'Attachment','raw':!![]});}var _0x243763=[{'model':db[_0xf0ab('0xd0')],'as':_0xf0ab('0xee'),'attributes':['id',_0xf0ab('0x3a'),'createdAt',_0xf0ab('0xfb'),_0xf0ab('0xfc'),_0xf0ab('0x88')],'include':_0x3d8794}];_0x243763['push']({'model':db[_0xf0ab('0xbf')],'as':_0xf0ab('0x11e'),'attributes':['id',_0xf0ab('0x37')]});_0x243763['push']({'model':db[_0xf0ab('0xec')],'as':_0xf0ab('0x11f'),'attributes':['id',_0xf0ab('0x40')]});return db[_0xf0ab('0xa1')]['find']({'where':{'id':_0x2baa40[_0xf0ab('0xbd')]['id']},'include':_0x243763})[_0xf0ab('0x21')](handleEntityNotFound(_0x4ff52d,null))[_0xf0ab('0x21')](function(_0x2c2e20){if(_0x2c2e20){var _0x57bd77=_0x2c2e20[_0xf0ab('0x120')]({'plain':!![]});fs[_0xf0ab('0x121')](_0x595bda);var _0x169b02={'channel':_0xf0ab('0x122'),'account':_0x57bd77[_0xf0ab('0x11e')]['name'],'agent':_0x57bd77[_0xf0ab('0x11f')]?_0x57bd77['Owner'][_0xf0ab('0x40')]:_0xf0ab('0x123'),'createdAt':moment(_0x57bd77[_0xf0ab('0xf9')])['format'](_0xf0ab('0x10e'))['toString'](),'closedAt':_0x57bd77['closed']?moment(_0x57bd77['closedAt'])[_0xf0ab('0xe9')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x57bd77[_0xf0ab('0xda')],'chatInfo':{'browser':_0x57bd77[_0xf0ab('0x124')],'os':_0x57bd77[_0xf0ab('0x125')],'referer':_0x57bd77[_0xf0ab('0x126')],'customerIp':_0x57bd77[_0xf0ab('0x127')],'customerPort':_0x57bd77['customerPort']?_0x57bd77[_0xf0ab('0x128')]:_0xf0ab('0x123')},'messages':_(_0x57bd77['Messages'])[_0xf0ab('0x129')]()[_0xf0ab('0x8d')]({'secret':![]})[_0xf0ab('0x3f')](function(_0x2aa512){if(_0x2aa512['Attachment']){var _0x26009e=path[_0xf0ab('0xe5')](_0x5b6475,_0x2aa512['Attachment'][_0xf0ab('0xdd')]);if(fs[_0xf0ab('0x12a')](_0x26009e)){fs['createReadStream'](_0x26009e)[_0xf0ab('0x12b')](fs[_0xf0ab('0x12c')](path['join'](_0x595bda,_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')])));}}return{'date':moment(_0x2aa512[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))['toString'](),'sender':_0x2aa512[_0xf0ab('0xfb')]==='out'?_0x2aa512[_0xf0ab('0xec')]?_0x2aa512['User'][_0xf0ab('0x40')]:_0xf0ab('0xf1'):_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x12d')]+(_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x11d')]?'\x20'+_0x2aa512[_0xf0ab('0x70')]['lastName']:''),'body':_0x2aa512[_0xf0ab('0xe0')]?_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')]:_0x2aa512[_0xf0ab('0x3a')],'direction':_0x2aa512[_0xf0ab('0xfb')]==='out'?'A':'C','secret':_0x2aa512[_0xf0ab('0xfc')],'read':_0x2aa512[_0xf0ab('0x88')],'attachment':_0x2aa512[_0xf0ab('0xe0')]};})[_0xf0ab('0x72')]()};return ejs['renderFile'](path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],_0xf0ab('0x118'),_0xf0ab('0x12e'),'downloadInteraction.ejs'),{'interaction':_0x169b02})['then'](function(_0x3ad886){var _0x3df4a2=path['join'](_0x595bda,'transcript-'+_0x57bd77['id']+'-'+_0x2a2fea+_0xf0ab('0x12f'));var _0x378d44={'path':_0x3df4a2,'channel':_0xf0ab('0x122'),'interactionId':_0x57bd77['id']};return pdf[_0xf0ab('0x130')](_0x3ad886,_0x378d44);})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x1e4acb,_0x25a1eb){zipdir(_0x595bda,{'saveTo':_0x25242e},function(_0x406090,_0x414d09){if(_0x406090)return _0x25a1eb(_0x406090);return _0x1e4acb(_0x414d09);});})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x235528,_0x581c80){rimraf(_0x595bda,function(_0x14332a){if(_0x14332a)_0x581c80(_0x14332a);return _0x235528();});});})[_0xf0ab('0x21')](function(){return _0x4ff52d[_0xf0ab('0xe7')](_0x25242e,_0x2bd3e3,function(_0x4f9211){if(_0x4f9211){console[_0xf0ab('0x131')](_0xf0ab('0x132'),_0x4f9211);}else{fs[_0xf0ab('0x133')](_0x25242e);}});});});}else{return _0x4ff52d['sendStatus'](0xc8);}})[_0xf0ab('0x46')](handleError(_0x4ff52d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 46c1752..f221c36 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 _0xe741=['length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatMessage','save','update','remove','getUsers','setDataValue','Users','findAll','then','unreadMessages'];(function(_0xc589cb,_0x3ad86b){var _0x26fbd7=function(_0x1816a3){while(--_0x1816a3){_0xc589cb['push'](_0xc589cb['shift']());}};_0x26fbd7(++_0x3ad86b);}(_0xe741,0xe2));var _0x1e74=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xe741[_0x36c5b0];return _0xf19333;};'use strict';var EventEmitter=require(_0x1e74('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x1e74('0x1'))['db'][_0x1e74('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1e74('0x3'),'afterUpdate':_0x1e74('0x4'),'afterDestroy':_0x1e74('0x5')};function emitEvent(_0x2ad813){return function(_0x168572,_0x4d17b5,_0x3dce8c){_0x168572[_0x1e74('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2d7000){_0x168572[_0x1e74('0x7')](_0x1e74('0x8'),_0x2d7000['map'](function(_0x43efdc){return{'id':_0x43efdc['id']};}));return ChatMessage[_0x1e74('0x9')]({'where':{'ChatInteractionId':_0x168572['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1e74('0xa')](function(_0x5bb326){_0x168572[_0x1e74('0x7')](_0x1e74('0xb'),_0x5bb326[_0x1e74('0xc')]);ChatInteractionEvents['emit'](_0x2ad813+':'+_0x168572['id'],_0x168572);ChatInteractionEvents[_0x1e74('0xd')](_0x2ad813,_0x168572);_0x3dce8c(null);})[_0x1e74('0xe')](_0x3dce8c(null));};}for(var e in events){if(events[_0x1e74('0xf')](e)){var event=events[e];ChatInteraction[_0x1e74('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x70e1=['setMaxListeners','save','remove','getUsers','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','ChatInteraction','../../mysqldb','ChatMessage'];(function(_0x50ae24,_0x3c4d1f){var _0x463ac3=function(_0x5ee2d1){while(--_0x5ee2d1){_0x50ae24['push'](_0x50ae24['shift']());}};_0x463ac3(++_0x3c4d1f);}(_0x70e1,0x194));var _0x170e=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0x70e1[_0x261522];return _0x98a25a;};'use strict';var EventEmitter=require(_0x170e('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x170e('0x1')];var ChatMessage=require(_0x170e('0x2'))['db'][_0x170e('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x170e('0x4')](0x0);var events={'afterCreate':_0x170e('0x5'),'afterUpdate':'update','afterDestroy':_0x170e('0x6')};function emitEvent(_0x237004){return function(_0x5228f2,_0x1b028e,_0x4751dd){_0x5228f2[_0x170e('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x442a4b){_0x5228f2[_0x170e('0x8')](_0x170e('0x9'),_0x442a4b[_0x170e('0xa')](function(_0x11d328){return{'id':_0x11d328['id']};}));return ChatMessage[_0x170e('0xb')]({'where':{'ChatInteractionId':_0x5228f2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3dc997){_0x5228f2[_0x170e('0x8')](_0x170e('0xc'),_0x3dc997['length']);ChatInteractionEvents[_0x170e('0xd')](_0x237004+':'+_0x5228f2['id'],_0x5228f2);ChatInteractionEvents[_0x170e('0xd')](_0x237004,_0x5228f2);_0x4751dd(null);})[_0x170e('0xe')](_0x4751dd(null));};}for(var e in events){if(events[_0x170e('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x170e('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index c50e2f8..6a0a5ef 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 _0x1aad=['exports','define','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes'];(function(_0x59cb45,_0x29f0b2){var _0x2c97d3=function(_0x328a70){while(--_0x328a70){_0x59cb45['push'](_0x59cb45['shift']());}};_0x2c97d3(++_0x29f0b2);}(_0x1aad,0x14c));var _0xd1aa=function(_0x2e767e,_0x591c30){_0x2e767e=_0x2e767e-0x0;var _0x539d6c=_0x1aad[_0x2e767e];return _0x539d6c;};'use strict';var _=require(_0xd1aa('0x0'));var util=require(_0xd1aa('0x1'));var logger=require(_0xd1aa('0x2'))(_0xd1aa('0x3'));var moment=require(_0xd1aa('0x4'));var BPromise=require(_0xd1aa('0x5'));var rp=require(_0xd1aa('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd1aa('0x7'));var config=require(_0xd1aa('0x8'));var attributes=require(_0xd1aa('0x9'));module[_0xd1aa('0xa')]=function(_0x1c665a,_0x5b35dd){return _0x1c665a[_0xd1aa('0xb')]('ChatInteraction',attributes,{'tableName':_0xd1aa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x29ee05,_0x3658a8,_0x3c506a){if(_0x29ee05[_0xd1aa('0xd')](_0xd1aa('0xe'))){_0x29ee05['closedAt']=moment()[_0xd1aa('0xf')](_0xd1aa('0x10'));}_0x3c506a(null,_0x29ee05);}},'charset':'utf8mb4','collate':_0xd1aa('0x11')});}; \ No newline at end of file +var _0xf6d6=['../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closed','closedAt','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x159555,_0x117772){var _0x411e11=function(_0x4d646a){while(--_0x4d646a){_0x159555['push'](_0x159555['shift']());}};_0x411e11(++_0x117772);}(_0xf6d6,0x12a));var _0x6f6d=function(_0x2a20b9,_0x3edbc7){_0x2a20b9=_0x2a20b9-0x0;var _0x5cbbd5=_0xf6d6[_0x2a20b9];return _0x5cbbd5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f6d('0x0'))(_0x6f6d('0x1'));var moment=require(_0x6f6d('0x2'));var BPromise=require('bluebird');var rp=require(_0x6f6d('0x3'));var fs=require('fs');var path=require(_0x6f6d('0x4'));var rimraf=require(_0x6f6d('0x5'));var config=require(_0x6f6d('0x6'));var attributes=require(_0x6f6d('0x7'));module[_0x6f6d('0x8')]=function(_0x1fed0d,_0xeb3d13){return _0x1fed0d[_0x6f6d('0x9')](_0x6f6d('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x46bddd,_0x2f22c9,_0xe9bfa7){if(_0x46bddd[_0x6f6d('0xb')](_0x6f6d('0xc'))){_0x46bddd[_0x6f6d('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0xe9bfa7(null,_0x46bddd);}},'charset':_0x6f6d('0xe'),'collate':_0x6f6d('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 133eca3..6d24230 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 _0x602d=['code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','AddTagsToChatInteraction','where','addTags','ids','omit','spread','AddTags','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x104799,_0x865033){var _0x1021a6=function(_0x30bb7a){while(--_0x30bb7a){_0x104799['push'](_0x104799['shift']());}};_0x1021a6(++_0x865033);}(_0x602d,0x1e0));var _0xd602=function(_0x1e2b3e,_0xafbf55){_0x1e2b3e=_0x1e2b3e-0x0;var _0x4830dd=_0x602d[_0x1e2b3e];return _0x4830dd;};'use strict';var _=require(_0xd602('0x0'));var util=require(_0xd602('0x1'));var moment=require(_0xd602('0x2'));var BPromise=require('bluebird');var rs=require(_0xd602('0x3'));var fs=require('fs');var Redis=require(_0xd602('0x4'));var db=require(_0xd602('0x5'))['db'];var utils=require(_0xd602('0x6'));var logger=require(_0xd602('0x7'))(_0xd602('0x8'));var config=require(_0xd602('0x9'));var jayson=require(_0xd602('0xa'));var client=jayson[_0xd602('0xb')][_0xd602('0xc')]({'port':0x232a});config[_0xd602('0xd')]=_[_0xd602('0xe')](config['redis'],{'host':_0xd602('0xf'),'port':0x18eb});var socket=require(_0xd602('0x10'))(new Redis(config[_0xd602('0xd')]));require(_0xd602('0x11'))[_0xd602('0x12')](socket);function respondWithRpcPromise(_0x1e4f2c,_0x46e748,_0x12a0b1){return new BPromise(function(_0x42218f,_0x22b58b){return client[_0xd602('0x13')](_0x1e4f2c,_0x12a0b1)[_0xd602('0x14')](function(_0x2d54c5){logger[_0xd602('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x46e748,_0xd602('0x16'));logger['debug'](_0xd602('0x17'),_0x46e748,_0xd602('0x16'),JSON[_0xd602('0x18')](_0x2d54c5));if(_0x2d54c5[_0xd602('0x19')]){if(_0x2d54c5[_0xd602('0x19')][_0xd602('0x1a')]===0x1f4){logger['error'](_0xd602('0x1b'),_0x46e748,_0x2d54c5[_0xd602('0x19')][_0xd602('0x1c')]);return _0x22b58b(_0x2d54c5['error'][_0xd602('0x1c')]);}logger[_0xd602('0x19')](_0xd602('0x1b'),_0x46e748,_0x2d54c5[_0xd602('0x19')][_0xd602('0x1c')]);return _0x42218f(_0x2d54c5[_0xd602('0x19')]['message']);}else{logger['info'](_0xd602('0x1b'),_0x46e748,_0xd602('0x16'));_0x42218f(_0x2d54c5[_0xd602('0x1d')][_0xd602('0x1c')]);}})[_0xd602('0x1e')](function(_0x4568ee){logger[_0xd602('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x46e748,_0x4568ee);_0x22b58b(_0x4568ee);});});}exports[_0xd602('0x1f')]=function(_0x3d86ed){var _0x182dae=this;return new Promise(function(_0x37e945,_0x8217f2){return db[_0xd602('0x20')][_0xd602('0x21')](_0x3d86ed[_0xd602('0x22')],{'raw':_0x3d86ed[_0xd602('0x23')]?_0x3d86ed['options'][_0xd602('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d86ed[_0xd602('0x23')]?_0x3d86ed[_0xd602('0x23')]['where']||null:null,'attributes':_0x3d86ed[_0xd602('0x23')]?_0x3d86ed[_0xd602('0x23')][_0xd602('0x25')]||null:null,'limit':_0x3d86ed[_0xd602('0x23')]?_0x3d86ed[_0xd602('0x23')]['limit']||null:null})['then'](function(_0x565cce){logger['info'](_0xd602('0x1f'),_0x3d86ed);logger['debug']('UpdateChatInteraction',_0x3d86ed,JSON['stringify'](_0x565cce));_0x37e945(_0x565cce);})[_0xd602('0x1e')](function(_0x211973){logger[_0xd602('0x19')](_0xd602('0x1f'),_0x211973[_0xd602('0x1c')],_0x3d86ed);_0x8217f2(_0x182dae[_0xd602('0x19')](0x1f4,_0x211973['message']));});});};exports[_0xd602('0x26')]=function(_0xff605f){return new Promise(function(_0xb7c897,_0x293f17){return db[_0xd602('0x20')]['find']({'where':_0xff605f[_0xd602('0x23')]?_0xff605f[_0xd602('0x23')][_0xd602('0x27')]||null:null})['then'](function(_0x566f3c){if(_0x566f3c){return _0x566f3c[_0xd602('0x28')](_0xff605f[_0xd602('0x22')][_0xd602('0x29')],_[_0xd602('0x2a')](_0xff605f['body'],[_0xd602('0x29'),'id'])||{});}})[_0xd602('0x2b')](function(_0x2f15ec){logger[_0xd602('0x15')](_0xd602('0x2c'),_0xff605f);logger[_0xd602('0x2d')]('AddTags',_0xff605f,JSON[_0xd602('0x18')](_0x2f15ec));_0xb7c897(_0x2f15ec);})[_0xd602('0x1e')](function(_0x292243){logger[_0xd602('0x19')]('AddTags',_0x292243[_0xd602('0x1c')],_0xff605f);_0x293f17(_this['error'](0x1f4,_0x292243[_0xd602('0x1c')]));});});}; \ No newline at end of file +var _0x3a48=['code','message','ChatInteraction,\x20%s,\x20%s','result','ChatInteraction','update','body','options','raw','where','limit','UpdateChatInteraction','stringify','catch','AddTagsToChatInteraction','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./chatInteraction.socket','register','request','then','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x383979,_0x5e79ed){var _0x15d18c=function(_0x3002ab){while(--_0x3002ab){_0x383979['push'](_0x383979['shift']());}};_0x15d18c(++_0x5e79ed);}(_0x3a48,0xf0));var _0x83a4=function(_0xf91883,_0x289b41){_0xf91883=_0xf91883-0x0;var _0x2ab933=_0x3a48[_0xf91883];return _0x2ab933;};'use strict';var _=require('lodash');var util=require(_0x83a4('0x0'));var moment=require(_0x83a4('0x1'));var BPromise=require(_0x83a4('0x2'));var rs=require(_0x83a4('0x3'));var fs=require('fs');var Redis=require(_0x83a4('0x4'));var db=require(_0x83a4('0x5'))['db'];var utils=require(_0x83a4('0x6'));var logger=require(_0x83a4('0x7'))(_0x83a4('0x8'));var config=require(_0x83a4('0x9'));var jayson=require(_0x83a4('0xa'));var client=jayson[_0x83a4('0xb')]['http']({'port':0x232a});config['redis']=_[_0x83a4('0xc')](config[_0x83a4('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x83a4('0xe'))(new Redis(config[_0x83a4('0xd')]));require(_0x83a4('0xf'))[_0x83a4('0x10')](socket);function respondWithRpcPromise(_0x4b216d,_0xe64e1e,_0x220509){return new BPromise(function(_0x1b9a79,_0x58785b){return client[_0x83a4('0x11')](_0x4b216d,_0x220509)[_0x83a4('0x12')](function(_0x2c6957){logger[_0x83a4('0x13')]('ChatInteraction,\x20%s,\x20%s',_0xe64e1e,'request\x20sent');logger[_0x83a4('0x14')](_0x83a4('0x15'),_0xe64e1e,_0x83a4('0x16'),JSON['stringify'](_0x2c6957));if(_0x2c6957[_0x83a4('0x17')]){if(_0x2c6957[_0x83a4('0x17')][_0x83a4('0x18')]===0x1f4){logger[_0x83a4('0x17')]('ChatInteraction,\x20%s,\x20%s',_0xe64e1e,_0x2c6957[_0x83a4('0x17')]['message']);return _0x58785b(_0x2c6957[_0x83a4('0x17')][_0x83a4('0x19')]);}logger[_0x83a4('0x17')](_0x83a4('0x1a'),_0xe64e1e,_0x2c6957[_0x83a4('0x17')][_0x83a4('0x19')]);return _0x1b9a79(_0x2c6957[_0x83a4('0x17')][_0x83a4('0x19')]);}else{logger[_0x83a4('0x13')](_0x83a4('0x1a'),_0xe64e1e,'request\x20sent');_0x1b9a79(_0x2c6957[_0x83a4('0x1b')][_0x83a4('0x19')]);}})['catch'](function(_0x48c7dd){logger['error'](_0x83a4('0x1a'),_0xe64e1e,_0x48c7dd);_0x58785b(_0x48c7dd);});});}exports['UpdateChatInteraction']=function(_0x28bf8e){var _0x46e956=this;return new Promise(function(_0x4c2c1c,_0x2dfe48){return db[_0x83a4('0x1c')][_0x83a4('0x1d')](_0x28bf8e[_0x83a4('0x1e')],{'raw':_0x28bf8e[_0x83a4('0x1f')]?_0x28bf8e[_0x83a4('0x1f')][_0x83a4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28bf8e[_0x83a4('0x1f')]?_0x28bf8e[_0x83a4('0x1f')][_0x83a4('0x21')]||null:null,'attributes':_0x28bf8e[_0x83a4('0x1f')]?_0x28bf8e[_0x83a4('0x1f')]['attributes']||null:null,'limit':_0x28bf8e[_0x83a4('0x1f')]?_0x28bf8e[_0x83a4('0x1f')][_0x83a4('0x22')]||null:null})[_0x83a4('0x12')](function(_0x5b1ea9){logger[_0x83a4('0x13')]('UpdateChatInteraction',_0x28bf8e);logger['debug'](_0x83a4('0x23'),_0x28bf8e,JSON[_0x83a4('0x24')](_0x5b1ea9));_0x4c2c1c(_0x5b1ea9);})[_0x83a4('0x25')](function(_0x5b4920){logger['error'](_0x83a4('0x23'),_0x5b4920[_0x83a4('0x19')],_0x28bf8e);_0x2dfe48(_0x46e956[_0x83a4('0x17')](0x1f4,_0x5b4920[_0x83a4('0x19')]));});});};exports[_0x83a4('0x26')]=function(_0x4c6788){return new Promise(function(_0x246379,_0x348b35){return db[_0x83a4('0x1c')]['find']({'where':_0x4c6788[_0x83a4('0x1f')]?_0x4c6788[_0x83a4('0x1f')][_0x83a4('0x21')]||null:null})[_0x83a4('0x12')](function(_0x357133){if(_0x357133){return _0x357133[_0x83a4('0x27')](_0x4c6788[_0x83a4('0x1e')][_0x83a4('0x28')],_[_0x83a4('0x29')](_0x4c6788[_0x83a4('0x1e')],[_0x83a4('0x28'),'id'])||{});}})[_0x83a4('0x2a')](function(_0x359a51){logger[_0x83a4('0x13')]('AddTags',_0x4c6788);logger[_0x83a4('0x14')](_0x83a4('0x2b'),_0x4c6788,JSON[_0x83a4('0x24')](_0x359a51));_0x246379(_0x359a51);})[_0x83a4('0x25')](function(_0x13bd85){logger[_0x83a4('0x17')](_0x83a4('0x2b'),_0x13bd85[_0x83a4('0x19')],_0x4c6788);_0x348b35(_this['error'](0x1f4,_0x13bd85[_0x83a4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index da9c1b3..c1bc297 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 _0xa8a8=['update','removeListener','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x4882cc,_0x599451){var _0x573354=function(_0x117433){while(--_0x117433){_0x4882cc['push'](_0x4882cc['shift']());}};_0x573354(++_0x599451);}(_0xa8a8,0x1ef));var _0x8a8a=function(_0x5d4507,_0x4fcbd5){_0x5d4507=_0x5d4507-0x0;var _0x482c9b=_0xa8a8[_0x5d4507];return _0x482c9b;};'use strict';var ChatInteractionEvents=require(_0x8a8a('0x0'));var events=[_0x8a8a('0x1'),'remove',_0x8a8a('0x2')];function createListener(_0x1cb4ff,_0x31918b){return function(_0x445f72){_0x31918b['emit'](_0x1cb4ff,_0x445f72);};}function removeListener(_0x14c905,_0x440ca6){return function(){ChatInteractionEvents[_0x8a8a('0x3')](_0x14c905,_0x440ca6);};}exports[_0x8a8a('0x4')]=function(_0x3c3ac3){for(var _0x335d1a=0x0,_0x16a5bc=events[_0x8a8a('0x5')];_0x335d1a<_0x16a5bc;_0x335d1a++){var _0x37b3f9=events[_0x335d1a];var _0x49d9b1=createListener(_0x8a8a('0x6')+_0x37b3f9,_0x3c3ac3);ChatInteractionEvents['on'](_0x37b3f9,_0x49d9b1);}}; \ No newline at end of file +var _0x8627=['update','emit','removeListener','register','length','chatInteraction:','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8627,0xd1));var _0x7862=function(_0x5b52fd,_0x5dbdb2){_0x5b52fd=_0x5b52fd-0x0;var _0x3ad899=_0x8627[_0x5b52fd];return _0x3ad899;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x7862('0x0'),_0x7862('0x1')];function createListener(_0x39b332,_0x449178){return function(_0x36c098){_0x449178[_0x7862('0x2')](_0x39b332,_0x36c098);};}function removeListener(_0x52c238,_0x27771a){return function(){ChatInteractionEvents[_0x7862('0x3')](_0x52c238,_0x27771a);};}exports[_0x7862('0x4')]=function(_0x53eb1b){for(var _0x1966f9=0x0,_0x5f1bb8=events[_0x7862('0x5')];_0x1966f9<_0x5f1bb8;_0x1966f9++){var _0x2d400d=events[_0x1966f9];var _0x6c1ec5=createListener(_0x7862('0x6')+_0x2d400d,_0x53eb1b);ChatInteractionEvents['on'](_0x2d400d,_0x6c1ec5);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 4beda9e..94d0e38 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 _0xd3dc=['/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','tracked','chatinteraction:destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','post','create','createVidaooSession','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','/:id/tags','chatinteraction:addtags','addTags','put','chat','chatinteraction:update'];(function(_0x24f8af,_0x2eb8db){var _0x3f5702=function(_0x2a397e){while(--_0x2a397e){_0x24f8af['push'](_0x24f8af['shift']());}};_0x3f5702(++_0x2eb8db);}(_0xd3dc,0x107));var _0xcd3d=function(_0x948cad,_0x3172b0){_0x948cad=_0x948cad-0x0;var _0x519ecd=_0xd3dc[_0x948cad];return _0x519ecd;};'use strict';var multer=require(_0xcd3d('0x0'));var util=require(_0xcd3d('0x1'));var path=require(_0xcd3d('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd3d('0x3'));var router=express[_0xcd3d('0x4')]();var fs_extra=require(_0xcd3d('0x5'));var auth=require(_0xcd3d('0x6'));var interaction=require(_0xcd3d('0x7'));var config=require(_0xcd3d('0x8'));var controller=require(_0xcd3d('0x9'));router[_0xcd3d('0xa')]('/',auth[_0xcd3d('0xb')](),controller[_0xcd3d('0xc')]);router[_0xcd3d('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xcd3d('0xd')]);router[_0xcd3d('0xa')](_0xcd3d('0xe'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0xcd3d('0xa')](_0xcd3d('0xf'),auth[_0xcd3d('0x10')](),controller[_0xcd3d('0x11')]);router[_0xcd3d('0xa')](_0xcd3d('0x12'),auth['isAuthenticated'](),controller[_0xcd3d('0x13')]);router[_0xcd3d('0xa')]('/:id/my_messages',auth[_0xcd3d('0x10')](),controller[_0xcd3d('0x14')]);router[_0xcd3d('0xa')](_0xcd3d('0x15'),auth[_0xcd3d('0xb')](),controller['download']);router[_0xcd3d('0x16')]('/',auth[_0xcd3d('0xb')](),controller[_0xcd3d('0x17')]);router['post']('/:id/vidaoo',auth[_0xcd3d('0xb')](),controller[_0xcd3d('0x18')]);var upload=multer({'storage':multer[_0xcd3d('0x19')]({'destination':function(_0x6bb361,_0x24cf86,_0x4f680d){_0x4f680d(null,path[_0xcd3d('0x1a')](config['root'],_0xcd3d('0x1b')));},'filename':function(_0x5c0f8c,_0x30cb58,_0x458532){_0x458532(null,util[_0xcd3d('0x1c')](_0xcd3d('0x1d'),Date[_0xcd3d('0x1e')](),_0x30cb58[_0xcd3d('0x1f')][_0xcd3d('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xcd3d('0x21'),upload['single'](_0xcd3d('0x22')),controller[_0xcd3d('0x23')]);router[_0xcd3d('0x16')](_0xcd3d('0x12'),auth[_0xcd3d('0x10')](),controller[_0xcd3d('0x24')]);router['post'](_0xcd3d('0x25'),auth['isAuthenticated'](),interaction['tracked']('chat',_0xcd3d('0x26')),controller[_0xcd3d('0x27')]);router[_0xcd3d('0x28')](_0xcd3d('0xe'),auth[_0xcd3d('0xb')](),interaction['tracked'](_0xcd3d('0x29'),_0xcd3d('0x2a')),controller['update']);router[_0xcd3d('0x28')](_0xcd3d('0x2b'),controller[_0xcd3d('0x2c')]);router[_0xcd3d('0x28')]('/:id/abandon',auth[_0xcd3d('0x10')](),controller[_0xcd3d('0x2d')]);router[_0xcd3d('0x28')](_0xcd3d('0x2e'),controller[_0xcd3d('0x2f')]);router[_0xcd3d('0x30')](_0xcd3d('0xe'),auth[_0xcd3d('0xb')](),interaction[_0xcd3d('0x31')](_0xcd3d('0x29'),_0xcd3d('0x32')),controller['destroy']);router[_0xcd3d('0x30')](_0xcd3d('0x25'),auth[_0xcd3d('0xb')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x1ba6=['/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','getMessages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','originalname','replace','single','file','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','chatinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1ba6,0x89));var _0x61ba=function(_0x1f09a1,_0x1d5602){_0x1f09a1=_0x1f09a1-0x0;var _0x4ccfb0=_0x1ba6[_0x1f09a1];return _0x4ccfb0;};'use strict';var multer=require(_0x61ba('0x0'));var util=require(_0x61ba('0x1'));var path=require(_0x61ba('0x2'));var timeout=require(_0x61ba('0x3'));var express=require(_0x61ba('0x4'));var router=express[_0x61ba('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x61ba('0x6'));var interaction=require(_0x61ba('0x7'));var config=require(_0x61ba('0x8'));var controller=require('./chatInteraction.controller');router[_0x61ba('0x9')]('/',auth[_0x61ba('0xa')](),controller['index']);router[_0x61ba('0x9')](_0x61ba('0xb'),auth['isAuthenticated'](),controller[_0x61ba('0xc')]);router['get'](_0x61ba('0xd'),auth[_0x61ba('0xe')](),controller['show']);router[_0x61ba('0x9')](_0x61ba('0xf'),auth[_0x61ba('0xe')](),controller[_0x61ba('0x10')]);router[_0x61ba('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x61ba('0x11')]);router['get']('/:id/my_messages',auth[_0x61ba('0xe')](),controller[_0x61ba('0x12')]);router[_0x61ba('0x9')](_0x61ba('0x13'),auth['isAuthenticated'](),controller[_0x61ba('0x14')]);router[_0x61ba('0x15')]('/',auth[_0x61ba('0xa')](),controller[_0x61ba('0x16')]);router[_0x61ba('0x15')](_0x61ba('0x17'),auth[_0x61ba('0xa')](),controller[_0x61ba('0x18')]);var upload=multer({'storage':multer[_0x61ba('0x19')]({'destination':function(_0x124840,_0x54d9cc,_0x5a6f07){_0x5a6f07(null,path[_0x61ba('0x1a')](config[_0x61ba('0x1b')],_0x61ba('0x1c')));},'filename':function(_0x5598df,_0x4daf45,_0xaff090){_0xaff090(null,util['format']('%s-%s',Date['now'](),_0x4daf45[_0x61ba('0x1d')][_0x61ba('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x61ba('0x1f')](_0x61ba('0x20')),controller['attachmentUpload']);router[_0x61ba('0x15')](_0x61ba('0x21'),auth[_0x61ba('0xe')](),controller[_0x61ba('0x22')]);router[_0x61ba('0x15')](_0x61ba('0x23'),auth[_0x61ba('0xa')](),interaction[_0x61ba('0x24')](_0x61ba('0x25'),_0x61ba('0x26')),controller[_0x61ba('0x27')]);router[_0x61ba('0x28')](_0x61ba('0xd'),auth[_0x61ba('0xa')](),interaction['tracked'](_0x61ba('0x25'),'chatinteraction:update'),controller['update']);router[_0x61ba('0x28')](_0x61ba('0x29'),controller[_0x61ba('0x2a')]);router[_0x61ba('0x28')](_0x61ba('0x2b'),auth[_0x61ba('0xe')](),controller['abandon']);router[_0x61ba('0x28')](_0x61ba('0x2c'),controller['close']);router['delete'](_0x61ba('0xd'),auth[_0x61ba('0xa')](),interaction['tracked']('chat',_0x61ba('0x2d')),controller[_0x61ba('0x2e')]);router[_0x61ba('0x2f')](_0x61ba('0x23'),auth[_0x61ba('0xa')](),controller[_0x61ba('0x30')]);module[_0x61ba('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 5b8168e..f6021ac 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 _0xd4db=['INTEGER','exports','TEXT','medium'];(function(_0x358123,_0x4356af){var _0x4c51cd=function(_0x5a882a){while(--_0x5a882a){_0x358123['push'](_0x358123['shift']());}};_0x4c51cd(++_0x4356af);}(_0xd4db,0x71));var _0xbd4d=function(_0x3d67d1,_0x3579b8){_0x3d67d1=_0x3d67d1-0x0;var _0x490bd0=_0xd4db[_0x3d67d1];return _0x490bd0;};'use strict';var Sequelize=require('sequelize');module[_0xbd4d('0x0')]={'body':{'type':Sequelize[_0xbd4d('0x1')](_0xbd4d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xbd4d('0x3')]}}; \ No newline at end of file +var _0x026c=['sequelize','INTEGER'];(function(_0xf7c5ff,_0x4909ab){var _0x4f240f=function(_0x2afd7d){while(--_0x2afd7d){_0xf7c5ff['push'](_0xf7c5ff['shift']());}};_0x4f240f(++_0x4909ab);}(_0x026c,0x17c));var _0xc026=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x026c[_0x2abc3d];return _0x252745;};'use strict';var Sequelize=require(_0xc026('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xc026('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 90ec209..f031304 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 _0x2b79=['VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','sort','VoiceQueues','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','filter','resourceId','push','createdAt','FromId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','order','merge','where'];(function(_0x39bc5a,_0x32ad38){var _0xcc2510=function(_0x1bae13){while(--_0x1bae13){_0x39bc5a['push'](_0x39bc5a['shift']());}};_0xcc2510(++_0x32ad38);}(_0x2b79,0x10a));var _0x92b7=function(_0x1b91c7,_0x539acd){_0x1b91c7=_0x1b91c7-0x0;var _0xbbe014=_0x2b79[_0x1b91c7];return _0xbbe014;};'use strict';var emlformat=require(_0x92b7('0x0'));var rimraf=require(_0x92b7('0x1'));var zipdir=require(_0x92b7('0x2'));var jsonpatch=require(_0x92b7('0x3'));var rp=require(_0x92b7('0x4'));var moment=require(_0x92b7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x92b7('0x6'));var util=require(_0x92b7('0x7'));var path=require('path');var sox=require(_0x92b7('0x8'));var csv=require(_0x92b7('0x9'));var ejs=require(_0x92b7('0xa'));var fs=require('fs');var fs_extra=require(_0x92b7('0xb'));var _=require('lodash');var squel=require(_0x92b7('0xc'));var crypto=require(_0x92b7('0xd'));var jsforce=require(_0x92b7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x92b7('0x9'));var querystring=require(_0x92b7('0xf'));var Papa=require(_0x92b7('0x10'));var Redis=require(_0x92b7('0x11'));var authService=require(_0x92b7('0x12'));var qs=require(_0x92b7('0x13'));var as=require(_0x92b7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92b7('0x15'))(_0x92b7('0x16'));var utils=require('../../config/utils');var config=require(_0x92b7('0x17'));var licenseUtil=require(_0x92b7('0x18'));var db=require(_0x92b7('0x19'))['db'];config[_0x92b7('0x1a')]=_[_0x92b7('0x1b')](config[_0x92b7('0x1a')],{'host':_0x92b7('0x1c'),'port':0x18eb});var socket=require(_0x92b7('0x1d'))(new Redis(config[_0x92b7('0x1a')]));require(_0x92b7('0x1e'))[_0x92b7('0x1f')](socket);function respondWithStatusCode(_0x19b610,_0x14a778){_0x14a778=_0x14a778||0xcc;return function(_0x1d46a2){if(_0x1d46a2){return _0x19b610[_0x92b7('0x20')](_0x14a778);}return _0x19b610[_0x92b7('0x21')](_0x14a778)['end']();};}function respondWithResult(_0x38dca7,_0x2de953){_0x2de953=_0x2de953||0xc8;return function(_0x18cc15){if(_0x18cc15){return _0x38dca7['status'](_0x2de953)['json'](_0x18cc15);}};}function respondWithFilteredResult(_0x51db30,_0x3fb9bf){return function(_0x570328){if(_0x570328){var _0x23c9b3=typeof _0x3fb9bf[_0x92b7('0x22')]===_0x92b7('0x23')&&typeof _0x3fb9bf['limit']===_0x92b7('0x23');var _0x11fa3a=_0x570328[_0x92b7('0x24')];var _0xd1d401=_0x23c9b3?0x0:_0x3fb9bf['offset'];var _0x4a9559=_0x23c9b3?_0x570328[_0x92b7('0x24')]:_0x3fb9bf[_0x92b7('0x22')]+_0x3fb9bf[_0x92b7('0x25')];var _0x30faed;if(_0x4a9559>=_0x11fa3a){_0x4a9559=_0x11fa3a;_0x30faed=0xc8;}else{_0x30faed=0xce;}_0x51db30[_0x92b7('0x21')](_0x30faed);return _0x51db30[_0x92b7('0x26')](_0x92b7('0x27'),_0xd1d401+'-'+_0x4a9559+'/'+_0x11fa3a)[_0x92b7('0x28')](_0x570328);}return null;};}function patchUpdates(_0x47913d){return function(_0x19f978){try{jsonpatch['apply'](_0x19f978,_0x47913d,!![]);}catch(_0x541174){return BPromise[_0x92b7('0x29')](_0x541174);}return _0x19f978['save']();};}function saveUpdates(_0x3ffbc8,_0x5accb6){return function(_0x51a8d1){if(_0x51a8d1){return _0x51a8d1[_0x92b7('0x2a')](_0x3ffbc8)[_0x92b7('0x2b')](function(_0x35df7a){return _0x35df7a;});}return null;};}function removeEntity(_0x4e01f9,_0x341071){return function(_0xd6c4e5){if(_0xd6c4e5){return _0xd6c4e5[_0x92b7('0x2c')]()[_0x92b7('0x2b')](function(){_0x4e01f9[_0x92b7('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d008f,_0x53426a){return function(_0x18ae50){if(!_0x18ae50){_0x1d008f['sendStatus'](0x194);}return _0x18ae50;};}function handleError(_0x3e8a23,_0x5d6b84){_0x5d6b84=_0x5d6b84||0x1f4;return function(_0xd56791){logger[_0x92b7('0x2d')](_0xd56791[_0x92b7('0x2e')]);if(_0xd56791[_0x92b7('0x2f')]){delete _0xd56791[_0x92b7('0x2f')];}_0x3e8a23['status'](_0x5d6b84)[_0x92b7('0x30')](_0xd56791);};}exports[_0x92b7('0x31')]=function(_0x9f1917,_0x44bc05){var _0x5c0a53={},_0x4c0439={},_0x4d39fe={'count':0x0,'rows':[]};var _0x1c341e=_[_0x92b7('0x32')](db[_0x92b7('0x33')][_0x92b7('0x34')],function(_0x37e1ed){return{'name':_0x37e1ed[_0x92b7('0x35')],'type':_0x37e1ed[_0x92b7('0x36')][_0x92b7('0x37')]};});_0x4c0439['model']=_[_0x92b7('0x32')](_0x1c341e,_0x92b7('0x2f'));_0x4c0439['query']=_[_0x92b7('0x38')](_0x9f1917[_0x92b7('0x39')]);_0x4c0439[_0x92b7('0x3a')]=_[_0x92b7('0x3b')](_0x4c0439[_0x92b7('0x3c')],_0x4c0439[_0x92b7('0x39')]);_0x5c0a53[_0x92b7('0x3d')]=_[_0x92b7('0x3b')](_0x4c0439['model'],qs[_0x92b7('0x3e')](_0x9f1917[_0x92b7('0x39')][_0x92b7('0x3e')]));_0x5c0a53[_0x92b7('0x3d')]=_0x5c0a53[_0x92b7('0x3d')][_0x92b7('0x3f')]?_0x5c0a53[_0x92b7('0x3d')]:_0x4c0439['model'];if(!_0x9f1917[_0x92b7('0x39')]['hasOwnProperty']('nolimit')){_0x5c0a53[_0x92b7('0x25')]=qs[_0x92b7('0x25')](_0x9f1917[_0x92b7('0x39')][_0x92b7('0x25')]);_0x5c0a53[_0x92b7('0x22')]=qs[_0x92b7('0x22')](_0x9f1917[_0x92b7('0x39')][_0x92b7('0x22')]);}_0x5c0a53[_0x92b7('0x40')]=qs['sort'](_0x9f1917['query']['sort']);_0x5c0a53['where']=qs[_0x92b7('0x3a')](_['pick'](_0x9f1917[_0x92b7('0x39')],_0x4c0439[_0x92b7('0x3a')]),_0x1c341e);if(_0x9f1917[_0x92b7('0x39')]['filter']){_0x5c0a53['where']=_[_0x92b7('0x41')](_0x5c0a53[_0x92b7('0x42')],{'$or':_['map'](_0x1c341e,function(_0x346093){if(_0x346093[_0x92b7('0x36')]!==_0x92b7('0x43')){var _0x1ffb7e={};_0x1ffb7e[_0x346093[_0x92b7('0x2f')]]={'$like':'%'+_0x9f1917[_0x92b7('0x39')]['filter']+'%'};return _0x1ffb7e;}})});}_0x5c0a53=_[_0x92b7('0x41')]({},_0x5c0a53,_0x9f1917['options']);var _0x4ac934={'where':_0x5c0a53['where']};return db[_0x92b7('0x33')]['count'](_0x4ac934)['then'](function(_0x1a88f0){_0x4d39fe[_0x92b7('0x24')]=_0x1a88f0;if(_0x9f1917[_0x92b7('0x39')][_0x92b7('0x44')]){_0x5c0a53[_0x92b7('0x45')]=[{'all':!![]}];}return db[_0x92b7('0x33')][_0x92b7('0x46')](_0x5c0a53);})[_0x92b7('0x2b')](function(_0x289c2e){_0x4d39fe[_0x92b7('0x47')]=_0x289c2e;return _0x4d39fe;})[_0x92b7('0x2b')](respondWithFilteredResult(_0x44bc05,_0x5c0a53))['catch'](handleError(_0x44bc05,null));};exports[_0x92b7('0x48')]=function(_0x3b0c0a,_0x36c291){var _0x39e004={'raw':!![],'where':{'id':_0x3b0c0a[_0x92b7('0x49')]['id']}},_0x1c7042={};_0x1c7042[_0x92b7('0x3c')]=_['keys'](db['ChatInternalMessage']['rawAttributes']);_0x1c7042[_0x92b7('0x39')]=_['keys'](_0x3b0c0a[_0x92b7('0x39')]);_0x1c7042[_0x92b7('0x3a')]=_[_0x92b7('0x3b')](_0x1c7042[_0x92b7('0x3c')],_0x1c7042['query']);_0x39e004[_0x92b7('0x3d')]=_[_0x92b7('0x3b')](_0x1c7042[_0x92b7('0x3c')],qs[_0x92b7('0x3e')](_0x3b0c0a[_0x92b7('0x39')]['fields']));_0x39e004[_0x92b7('0x3d')]=_0x39e004[_0x92b7('0x3d')]['length']?_0x39e004[_0x92b7('0x3d')]:_0x1c7042[_0x92b7('0x3c')];if(_0x3b0c0a[_0x92b7('0x39')][_0x92b7('0x44')]){_0x39e004[_0x92b7('0x45')]=[{'all':!![]}];}_0x39e004=_['merge']({},_0x39e004,_0x3b0c0a[_0x92b7('0x4a')]);return db[_0x92b7('0x33')][_0x92b7('0x4b')](_0x39e004)[_0x92b7('0x2b')](handleEntityNotFound(_0x36c291,null))[_0x92b7('0x2b')](respondWithResult(_0x36c291,null))[_0x92b7('0x4c')](handleError(_0x36c291,null));};exports[_0x92b7('0x4d')]=function(_0x45045f,_0x10d860){return db[_0x92b7('0x33')][_0x92b7('0x4d')](_0x45045f[_0x92b7('0x4e')],{})[_0x92b7('0x2b')](respondWithResult(_0x10d860,0xc9))[_0x92b7('0x4c')](handleError(_0x10d860,null));};exports[_0x92b7('0x2a')]=function(_0x23c89b,_0x519f5b){if(_0x23c89b['body']['id']){delete _0x23c89b[_0x92b7('0x4e')]['id'];}return db[_0x92b7('0x33')][_0x92b7('0x4b')]({'where':{'id':_0x23c89b['params']['id']}})[_0x92b7('0x2b')](handleEntityNotFound(_0x519f5b,null))[_0x92b7('0x2b')](saveUpdates(_0x23c89b['body'],null))[_0x92b7('0x2b')](respondWithResult(_0x519f5b,null))['catch'](handleError(_0x519f5b,null));};exports[_0x92b7('0x2c')]=function(_0x588c81,_0x201a3c){return db[_0x92b7('0x33')][_0x92b7('0x4b')]({'where':{'id':_0x588c81[_0x92b7('0x49')]['id']}})[_0x92b7('0x2b')](handleEntityNotFound(_0x201a3c,null))[_0x92b7('0x2b')](removeEntity(_0x201a3c,null))[_0x92b7('0x4c')](handleError(_0x201a3c,null));};exports['describe']=function(_0x5276bc,_0x120736){return db[_0x92b7('0x33')][_0x92b7('0x4f')]()[_0x92b7('0x2b')](respondWithResult(_0x120736,null))['catch'](handleError(_0x120736,null));};function wrapUser(_0x545db){return function(_0x36b7e7){var _0x329249=_0x545db[_0x92b7('0x50')]({'plain':!![]});_0x329249[_0x92b7('0x51')]=[];if(_0x36b7e7){_0x329249[_0x92b7('0x52')]=_0x36b7e7['createdAt'];_0x329249[_0x92b7('0x53')]=_0x36b7e7;}else{_0x329249[_0x92b7('0x52')]=moment(0x0)[_0x92b7('0x54')](_0x92b7('0x55'));_0x329249[_0x92b7('0x53')]={};}return _0x329249;};}exports[_0x92b7('0x56')]=function(_0x509284,_0x59bbbf,_0x50306f){var _0x23676a=[];return db['User'][_0x92b7('0x46')]({'where':{'role':[_0x92b7('0x57'),'admin',_0x92b7('0x58')]},'attributes':['id',_0x92b7('0x59'),_0x92b7('0x2f'),_0x92b7('0x5a'),_0x92b7('0x5b'),_0x92b7('0x5c'),_0x92b7('0x5d'),_0x92b7('0x5e'),_0x92b7('0x5f'),_0x92b7('0x60')],'order':qs[_0x92b7('0x61')]('-online'),'include':[{'model':db['VoiceQueue'],'as':_0x92b7('0x62'),'attributes':['id',_0x92b7('0x2f'),_0x92b7('0x36')],'through':{'attributes':[]}}]})[_0x92b7('0x2b')](function(_0xc0b50e){if(_0xc0b50e){var _0x13cbb7=_0x509284[_0x92b7('0x58')]['get']({'plain':!![]});if(!_0x13cbb7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13cbb7['role']===_0x92b7('0x58')){return db[_0x92b7('0x63')]['find']({'where':{'name':_0x92b7('0x64'),'userProfileId':_0x13cbb7[_0x92b7('0x65')]},'raw':!![]})[_0x92b7('0x2b')](function(_0x625dc4){if(_0x625dc4){if(_0x625dc4['autoAssociation']===0x0){return db[_0x92b7('0x66')][_0x92b7('0x46')]({'where':{'sectionId':_0x625dc4['id']},'raw':!![]})[_0x92b7('0x2b')](function(_0x25688f){var _0x2705b1=[];if(_[_0x92b7('0x67')](_0x25688f)){_0x2705b1=_[_0x92b7('0x68')](_0xc0b50e,function(_0x421517){if(_0x421517['role']!==_0x92b7('0x57')){return _0x421517;}});return _0x2705b1;}else{for(var _0x2937a1=0x0;_0x2937a1<_0xc0b50e[_0x92b7('0x3f')];_0x2937a1++){var _0x59c5ca=_0xc0b50e[_0x2937a1];if(_0x59c5ca[_0x92b7('0x5a')]==='agent'){var _0x10cc49=_[_0x92b7('0x4b')](_0x25688f,function(_0xa804c6){return _0xa804c6[_0x92b7('0x69')]===_0x59c5ca['id'];});if(_0x10cc49)_0x2705b1['push'](_0x59c5ca);}else{_0x2705b1[_0x92b7('0x6a')](_0x59c5ca);}}return _0x2705b1;}});}else{return _0xc0b50e;}}else{var _0x428559=_['filter'](_0xc0b50e,function(_0xe920c1){if(_0xe920c1['role']!=='agent'){return _0xe920c1;}});return _0x428559;}});}else{return _0xc0b50e;}}})[_0x92b7('0x2b')](function(_0x13ac66){var _0x547c36=[];if(_0x13ac66){_0x23676a=_0x13ac66;for(var _0x1f3d74=0x0;_0x1f3d74<_0x13ac66[_0x92b7('0x3f')];_0x1f3d74+=0x1){_0x23676a[_0x1f3d74][_0x92b7('0x51')]=[];_0x547c36['push'](db['ChatInternalMessage'][_0x92b7('0x4b')]({'where':{'FromId':[_0x509284['user']['id'],_0x13ac66[_0x1f3d74]['id']],'ToId':[_0x509284[_0x92b7('0x58')]['id'],_0x13ac66[_0x1f3d74]['id']],'ChatGroupId':null},'attributes':['id',_0x92b7('0x6b'),_0x92b7('0x6c'),'ToId',_0x92b7('0x6d'),_0x92b7('0x4e')],'order':qs[_0x92b7('0x61')](_0x92b7('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x92b7('0x2b')](wrapUser(_0x13ac66[_0x1f3d74])));}return BPromise['all'](_0x547c36);}return[];})[_0x92b7('0x2b')](function(_0x27875c){return{'rows':_0x27875c,'count':_0x27875c[_0x92b7('0x3f')]};})[_0x92b7('0x2b')](respondWithResult(_0x59bbbf,null))[_0x92b7('0x4c')](handleError(_0x59bbbf,null));}; \ No newline at end of file +var _0xfa16=['catch','show','params','intersection','fields','includeAll','find','create','body','describe','lastMessageAt','createdAt','format','lastMessage','getUsers','User','findAll','agent','admin','user','fullname','lastLoginAt','allowmessenger','-online','VoiceQueue','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','isEmpty','role','resourceId','push','FromId','ToId','-createdAt','all','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','keys','query','attributes','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','include','rows'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xfa16,0x1d5));var _0x6fa1=function(_0x1067c0,_0xad006b){_0x1067c0=_0x1067c0-0x0;var _0x15a20a=_0xfa16[_0x1067c0];return _0x15a20a;};'use strict';var emlformat=require(_0x6fa1('0x0'));var rimraf=require(_0x6fa1('0x1'));var zipdir=require(_0x6fa1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6fa1('0x3'));var Mustache=require(_0x6fa1('0x4'));var util=require(_0x6fa1('0x5'));var path=require('path');var sox=require(_0x6fa1('0x6'));var csv=require(_0x6fa1('0x7'));var ejs=require(_0x6fa1('0x8'));var fs=require('fs');var fs_extra=require(_0x6fa1('0x9'));var _=require('lodash');var squel=require(_0x6fa1('0xa'));var crypto=require(_0x6fa1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6fa1('0xc'));var toCsv=require(_0x6fa1('0x7'));var querystring=require(_0x6fa1('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6fa1('0xe'));var qs=require(_0x6fa1('0xf'));var as=require(_0x6fa1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6fa1('0x11'))(_0x6fa1('0x12'));var utils=require(_0x6fa1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6fa1('0x14'));var db=require(_0x6fa1('0x15'))['db'];config['redis']=_[_0x6fa1('0x16')](config[_0x6fa1('0x17')],{'host':_0x6fa1('0x18'),'port':0x18eb});var socket=require(_0x6fa1('0x19'))(new Redis(config['redis']));require(_0x6fa1('0x1a'))[_0x6fa1('0x1b')](socket);function respondWithStatusCode(_0x53c440,_0x343128){_0x343128=_0x343128||0xcc;return function(_0x403661){if(_0x403661){return _0x53c440[_0x6fa1('0x1c')](_0x343128);}return _0x53c440[_0x6fa1('0x1d')](_0x343128)[_0x6fa1('0x1e')]();};}function respondWithResult(_0xa69980,_0x236d4a){_0x236d4a=_0x236d4a||0xc8;return function(_0x27398a){if(_0x27398a){return _0xa69980[_0x6fa1('0x1d')](_0x236d4a)[_0x6fa1('0x1f')](_0x27398a);}};}function respondWithFilteredResult(_0x280bdf,_0x1f48c6){return function(_0x4b5c8c){if(_0x4b5c8c){var _0x27edcf=typeof _0x1f48c6['offset']===_0x6fa1('0x20')&&typeof _0x1f48c6[_0x6fa1('0x21')]===_0x6fa1('0x20');var _0x3c80ff=_0x4b5c8c[_0x6fa1('0x22')];var _0x42bd05=_0x27edcf?0x0:_0x1f48c6[_0x6fa1('0x23')];var _0x4daab2=_0x27edcf?_0x4b5c8c['count']:_0x1f48c6[_0x6fa1('0x23')]+_0x1f48c6[_0x6fa1('0x21')];var _0x4fcb55;if(_0x4daab2>=_0x3c80ff){_0x4daab2=_0x3c80ff;_0x4fcb55=0xc8;}else{_0x4fcb55=0xce;}_0x280bdf[_0x6fa1('0x1d')](_0x4fcb55);return _0x280bdf[_0x6fa1('0x24')](_0x6fa1('0x25'),_0x42bd05+'-'+_0x4daab2+'/'+_0x3c80ff)['json'](_0x4b5c8c);}return null;};}function patchUpdates(_0xae2171){return function(_0x13ce27){try{jsonpatch[_0x6fa1('0x26')](_0x13ce27,_0xae2171,!![]);}catch(_0x4ba702){return BPromise[_0x6fa1('0x27')](_0x4ba702);}return _0x13ce27[_0x6fa1('0x28')]();};}function saveUpdates(_0x81bb29,_0x301876){return function(_0x4efb4f){if(_0x4efb4f){return _0x4efb4f[_0x6fa1('0x29')](_0x81bb29)[_0x6fa1('0x2a')](function(_0x4bb1b5){return _0x4bb1b5;});}return null;};}function removeEntity(_0x58121e,_0xff4aeb){return function(_0x54582d){if(_0x54582d){return _0x54582d[_0x6fa1('0x2b')]()['then'](function(){_0x58121e[_0x6fa1('0x1d')](0xcc)[_0x6fa1('0x1e')]();});}};}function handleEntityNotFound(_0x20772a,_0x23bf73){return function(_0x33fd30){if(!_0x33fd30){_0x20772a['sendStatus'](0x194);}return _0x33fd30;};}function handleError(_0x300393,_0x10ad42){_0x10ad42=_0x10ad42||0x1f4;return function(_0x40bd1c){logger[_0x6fa1('0x2c')](_0x40bd1c[_0x6fa1('0x2d')]);if(_0x40bd1c[_0x6fa1('0x2e')]){delete _0x40bd1c[_0x6fa1('0x2e')];}_0x300393[_0x6fa1('0x1d')](_0x10ad42)[_0x6fa1('0x2f')](_0x40bd1c);};}exports[_0x6fa1('0x30')]=function(_0x3ae063,_0x196013){var _0x438a5d={},_0x165e5b={},_0x185288={'count':0x0,'rows':[]};var _0x1685f1=_[_0x6fa1('0x31')](db[_0x6fa1('0x32')][_0x6fa1('0x33')],function(_0x50375e){return{'name':_0x50375e[_0x6fa1('0x34')],'type':_0x50375e[_0x6fa1('0x35')][_0x6fa1('0x36')]};});_0x165e5b[_0x6fa1('0x37')]=_[_0x6fa1('0x31')](_0x1685f1,'name');_0x165e5b['query']=_[_0x6fa1('0x38')](_0x3ae063['query']);_0x165e5b['filters']=_['intersection'](_0x165e5b[_0x6fa1('0x37')],_0x165e5b[_0x6fa1('0x39')]);_0x438a5d['attributes']=_['intersection'](_0x165e5b[_0x6fa1('0x37')],qs['fields'](_0x3ae063[_0x6fa1('0x39')]['fields']));_0x438a5d[_0x6fa1('0x3a')]=_0x438a5d['attributes'][_0x6fa1('0x3b')]?_0x438a5d[_0x6fa1('0x3a')]:_0x165e5b[_0x6fa1('0x37')];if(!_0x3ae063[_0x6fa1('0x39')][_0x6fa1('0x3c')]('nolimit')){_0x438a5d[_0x6fa1('0x21')]=qs['limit'](_0x3ae063['query'][_0x6fa1('0x21')]);_0x438a5d[_0x6fa1('0x23')]=qs[_0x6fa1('0x23')](_0x3ae063[_0x6fa1('0x39')][_0x6fa1('0x23')]);}_0x438a5d[_0x6fa1('0x3d')]=qs[_0x6fa1('0x3e')](_0x3ae063[_0x6fa1('0x39')][_0x6fa1('0x3e')]);_0x438a5d['where']=qs[_0x6fa1('0x3f')](_['pick'](_0x3ae063[_0x6fa1('0x39')],_0x165e5b[_0x6fa1('0x3f')]),_0x1685f1);if(_0x3ae063[_0x6fa1('0x39')][_0x6fa1('0x40')]){_0x438a5d[_0x6fa1('0x41')]=_[_0x6fa1('0x42')](_0x438a5d[_0x6fa1('0x41')],{'$or':_[_0x6fa1('0x31')](_0x1685f1,function(_0x2c061a){if(_0x2c061a[_0x6fa1('0x35')]!==_0x6fa1('0x43')){var _0x124a22={};_0x124a22[_0x2c061a[_0x6fa1('0x2e')]]={'$like':'%'+_0x3ae063[_0x6fa1('0x39')]['filter']+'%'};return _0x124a22;}})});}_0x438a5d=_[_0x6fa1('0x42')]({},_0x438a5d,_0x3ae063[_0x6fa1('0x44')]);var _0x4a8f21={'where':_0x438a5d[_0x6fa1('0x41')]};return db[_0x6fa1('0x32')]['count'](_0x4a8f21)[_0x6fa1('0x2a')](function(_0x4ce7f0){_0x185288[_0x6fa1('0x22')]=_0x4ce7f0;if(_0x3ae063['query']['includeAll']){_0x438a5d[_0x6fa1('0x45')]=[{'all':!![]}];}return db[_0x6fa1('0x32')]['findAll'](_0x438a5d);})[_0x6fa1('0x2a')](function(_0x45eaa1){_0x185288[_0x6fa1('0x46')]=_0x45eaa1;return _0x185288;})[_0x6fa1('0x2a')](respondWithFilteredResult(_0x196013,_0x438a5d))[_0x6fa1('0x47')](handleError(_0x196013,null));};exports[_0x6fa1('0x48')]=function(_0x580181,_0x2c7444){var _0x391ce7={'raw':!![],'where':{'id':_0x580181[_0x6fa1('0x49')]['id']}},_0x12e70f={};_0x12e70f[_0x6fa1('0x37')]=_[_0x6fa1('0x38')](db[_0x6fa1('0x32')][_0x6fa1('0x33')]);_0x12e70f[_0x6fa1('0x39')]=_[_0x6fa1('0x38')](_0x580181[_0x6fa1('0x39')]);_0x12e70f[_0x6fa1('0x3f')]=_[_0x6fa1('0x4a')](_0x12e70f['model'],_0x12e70f[_0x6fa1('0x39')]);_0x391ce7[_0x6fa1('0x3a')]=_[_0x6fa1('0x4a')](_0x12e70f[_0x6fa1('0x37')],qs[_0x6fa1('0x4b')](_0x580181[_0x6fa1('0x39')][_0x6fa1('0x4b')]));_0x391ce7[_0x6fa1('0x3a')]=_0x391ce7[_0x6fa1('0x3a')][_0x6fa1('0x3b')]?_0x391ce7[_0x6fa1('0x3a')]:_0x12e70f['model'];if(_0x580181['query'][_0x6fa1('0x4c')]){_0x391ce7[_0x6fa1('0x45')]=[{'all':!![]}];}_0x391ce7=_[_0x6fa1('0x42')]({},_0x391ce7,_0x580181[_0x6fa1('0x44')]);return db[_0x6fa1('0x32')][_0x6fa1('0x4d')](_0x391ce7)[_0x6fa1('0x2a')](handleEntityNotFound(_0x2c7444,null))[_0x6fa1('0x2a')](respondWithResult(_0x2c7444,null))[_0x6fa1('0x47')](handleError(_0x2c7444,null));};exports[_0x6fa1('0x4e')]=function(_0x424ddd,_0x3b284d){return db['ChatInternalMessage'][_0x6fa1('0x4e')](_0x424ddd[_0x6fa1('0x4f')],{})[_0x6fa1('0x2a')](respondWithResult(_0x3b284d,0xc9))[_0x6fa1('0x47')](handleError(_0x3b284d,null));};exports[_0x6fa1('0x29')]=function(_0x5c4032,_0x5a0a68){if(_0x5c4032[_0x6fa1('0x4f')]['id']){delete _0x5c4032[_0x6fa1('0x4f')]['id'];}return db[_0x6fa1('0x32')]['find']({'where':{'id':_0x5c4032[_0x6fa1('0x49')]['id']}})[_0x6fa1('0x2a')](handleEntityNotFound(_0x5a0a68,null))['then'](saveUpdates(_0x5c4032[_0x6fa1('0x4f')],null))['then'](respondWithResult(_0x5a0a68,null))[_0x6fa1('0x47')](handleError(_0x5a0a68,null));};exports['destroy']=function(_0x2d0708,_0x2e8ccb){return db[_0x6fa1('0x32')]['find']({'where':{'id':_0x2d0708[_0x6fa1('0x49')]['id']}})[_0x6fa1('0x2a')](handleEntityNotFound(_0x2e8ccb,null))[_0x6fa1('0x2a')](removeEntity(_0x2e8ccb,null))['catch'](handleError(_0x2e8ccb,null));};exports[_0x6fa1('0x50')]=function(_0x1e2292,_0xe00c72){return db['ChatInternalMessage'][_0x6fa1('0x50')]()[_0x6fa1('0x2a')](respondWithResult(_0xe00c72,null))[_0x6fa1('0x47')](handleError(_0xe00c72,null));};function wrapUser(_0x1bfe96){return function(_0x4993b3){var _0x53e424=_0x1bfe96['get']({'plain':!![]});_0x53e424['messages']=[];if(_0x4993b3){_0x53e424[_0x6fa1('0x51')]=_0x4993b3[_0x6fa1('0x52')];_0x53e424['lastMessage']=_0x4993b3;}else{_0x53e424['lastMessageAt']=moment(0x0)[_0x6fa1('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x53e424[_0x6fa1('0x54')]={};}return _0x53e424;};}exports[_0x6fa1('0x55')]=function(_0x1800a9,_0x415645,_0x403868){var _0xdf8c67=[];return db[_0x6fa1('0x56')][_0x6fa1('0x57')]({'where':{'role':[_0x6fa1('0x58'),_0x6fa1('0x59'),_0x6fa1('0x5a')]},'attributes':['id',_0x6fa1('0x5b'),_0x6fa1('0x2e'),'role','userpic','internal','online',_0x6fa1('0x5c'),_0x6fa1('0x5d'),'showWebBar'],'order':qs[_0x6fa1('0x3e')](_0x6fa1('0x5e')),'include':[{'model':db[_0x6fa1('0x5f')],'as':'VoiceQueues','attributes':['id',_0x6fa1('0x2e'),_0x6fa1('0x35')],'through':{'attributes':[]}}]})[_0x6fa1('0x2a')](function(_0x3ed76d){if(_0x3ed76d){var _0x488af6=_0x1800a9[_0x6fa1('0x5a')][_0x6fa1('0x60')]({'plain':!![]});if(!_0x488af6)throw new Error(_0x6fa1('0x61'));if(_0x488af6['role']===_0x6fa1('0x5a')){return db[_0x6fa1('0x62')]['find']({'where':{'name':_0x6fa1('0x63'),'userProfileId':_0x488af6['userProfileId']},'raw':!![]})[_0x6fa1('0x2a')](function(_0x234268){if(_0x234268){if(_0x234268['autoAssociation']===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x234268['id']},'raw':!![]})[_0x6fa1('0x2a')](function(_0x4d7e20){var _0x4d9a76=[];if(_[_0x6fa1('0x64')](_0x4d7e20)){_0x4d9a76=_[_0x6fa1('0x40')](_0x3ed76d,function(_0x2acd23){if(_0x2acd23[_0x6fa1('0x65')]!==_0x6fa1('0x58')){return _0x2acd23;}});return _0x4d9a76;}else{for(var _0xfc9b9d=0x0;_0xfc9b9d<_0x3ed76d[_0x6fa1('0x3b')];_0xfc9b9d++){var _0x78aa68=_0x3ed76d[_0xfc9b9d];if(_0x78aa68['role']===_0x6fa1('0x58')){var _0x172568=_[_0x6fa1('0x4d')](_0x4d7e20,function(_0x16edc6){return _0x16edc6[_0x6fa1('0x66')]===_0x78aa68['id'];});if(_0x172568)_0x4d9a76[_0x6fa1('0x67')](_0x78aa68);}else{_0x4d9a76[_0x6fa1('0x67')](_0x78aa68);}}return _0x4d9a76;}});}else{return _0x3ed76d;}}else{var _0x29569d=_[_0x6fa1('0x40')](_0x3ed76d,function(_0x590dd4){if(_0x590dd4[_0x6fa1('0x65')]!==_0x6fa1('0x58')){return _0x590dd4;}});return _0x29569d;}});}else{return _0x3ed76d;}}})[_0x6fa1('0x2a')](function(_0x4a8355){var _0x22d093=[];if(_0x4a8355){_0xdf8c67=_0x4a8355;for(var _0x53b455=0x0;_0x53b455<_0x4a8355[_0x6fa1('0x3b')];_0x53b455+=0x1){_0xdf8c67[_0x53b455]['messages']=[];_0x22d093['push'](db[_0x6fa1('0x32')]['find']({'where':{'FromId':[_0x1800a9[_0x6fa1('0x5a')]['id'],_0x4a8355[_0x53b455]['id']],'ToId':[_0x1800a9[_0x6fa1('0x5a')]['id'],_0x4a8355[_0x53b455]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x6fa1('0x68'),_0x6fa1('0x69'),'read',_0x6fa1('0x4f')],'order':qs[_0x6fa1('0x3e')](_0x6fa1('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x6fa1('0x2a')](wrapUser(_0x4a8355[_0x53b455])));}return BPromise[_0x6fa1('0x6b')](_0x22d093);}return[];})[_0x6fa1('0x2a')](function(_0x4149af){return{'rows':_0x4149af,'count':_0x4149af['length']};})[_0x6fa1('0x2a')](respondWithResult(_0x415645,null))[_0x6fa1('0x47')](handleError(_0x415645,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index bcfaa74..9a0bff4 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 _0xcb03=['emit','hasOwnProperty','hook','setMaxListeners'];(function(_0x6d405,_0x1f6174){var _0x5ea766=function(_0xe819b9){while(--_0xe819b9){_0x6d405['push'](_0x6d405['shift']());}};_0x5ea766(++_0x1f6174);}(_0xcb03,0x19f));var _0x3cb0=function(_0x198c6b,_0x49edab){_0x198c6b=_0x198c6b-0x0;var _0xcd8e32=_0xcb03[_0x198c6b];return _0xcd8e32;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3cb0('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1e4d75){return function(_0x572b9b,_0x172d31,_0x568f8a){ChatInternalMessageEvents[_0x3cb0('0x1')](_0x1e4d75+':'+_0x572b9b['id'],_0x572b9b);ChatInternalMessageEvents[_0x3cb0('0x1')](_0x1e4d75,_0x572b9b);_0x568f8a(null);};}for(var e in events){if(events[_0x3cb0('0x2')](e)){var event=events[e];ChatInternalMessage[_0x3cb0('0x3')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xa364=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x1692bc,_0x53e527){var _0x4eef30=function(_0x51ceea){while(--_0x51ceea){_0x1692bc['push'](_0x1692bc['shift']());}};_0x4eef30(++_0x53e527);}(_0xa364,0x6a));var _0x4a36=function(_0x2a5dd8,_0x1f48d0){_0x2a5dd8=_0x2a5dd8-0x0;var _0xf57875=_0xa364[_0x2a5dd8];return _0xf57875;};'use strict';var EventEmitter=require(_0x4a36('0x0'));var ChatInternalMessage=require(_0x4a36('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4a36('0x2')](0x0);var events={'afterCreate':_0x4a36('0x3'),'afterUpdate':_0x4a36('0x4'),'afterDestroy':_0x4a36('0x5')};function emitEvent(_0x1e62f3){return function(_0x5510d6,_0x5e2c19,_0x43666e){ChatInternalMessageEvents[_0x4a36('0x6')](_0x1e62f3+':'+_0x5510d6['id'],_0x5510d6);ChatInternalMessageEvents[_0x4a36('0x6')](_0x1e62f3,_0x5510d6);_0x43666e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x4a36('0x7')](e,emitEvent(event));}}module[_0x4a36('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index c25fbd5..df337a3 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 _0xc3fb=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0xc3fb,0x81));var _0xbc3f=function(_0x53e924,_0x35643e){_0x53e924=_0x53e924-0x0;var _0x1864ef=_0xc3fb[_0x53e924];return _0x1864ef;};'use strict';var _=require(_0xbc3f('0x0'));var util=require(_0xbc3f('0x1'));var logger=require(_0xbc3f('0x2'))(_0xbc3f('0x3'));var moment=require(_0xbc3f('0x4'));var BPromise=require(_0xbc3f('0x5'));var rp=require(_0xbc3f('0x6'));var fs=require('fs');var path=require(_0xbc3f('0x7'));var rimraf=require(_0xbc3f('0x8'));var config=require(_0xbc3f('0x9'));var attributes=require(_0xbc3f('0xa'));module[_0xbc3f('0xb')]=function(_0xab72b0,_0x433442){return _0xab72b0[_0xbc3f('0xc')]('ChatInternalMessage',attributes,{'tableName':_0xbc3f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbc3f('0xe'),'collate':_0xbc3f('0xf')});}; \ No newline at end of file +var _0x4156=['ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','util','api','moment','request-promise','path','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x857c02,_0x3cc0b3){var _0x5bbbab=function(_0x4c7733){while(--_0x4c7733){_0x857c02['push'](_0x857c02['shift']());}};_0x5bbbab(++_0x3cc0b3);}(_0x4156,0xbe));var _0x6415=function(_0x262ddf,_0x38c08e){_0x262ddf=_0x262ddf-0x0;var _0x4da6fb=_0x4156[_0x262ddf];return _0x4da6fb;};'use strict';var _=require('lodash');var util=require(_0x6415('0x0'));var logger=require('../../config/logger')(_0x6415('0x1'));var moment=require(_0x6415('0x2'));var BPromise=require('bluebird');var rp=require(_0x6415('0x3'));var fs=require('fs');var path=require(_0x6415('0x4'));var rimraf=require('rimraf');var config=require(_0x6415('0x5'));var attributes=require(_0x6415('0x6'));module[_0x6415('0x7')]=function(_0x23b255,_0x37f2ab){return _0x23b255['define'](_0x6415('0x8'),attributes,{'tableName':_0x6415('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6415('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index b59b34c..ef816dd 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 _0x731d=['jayson/promise','client','http','redis','localhost','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x20b2f2,_0x49ce53){var _0x16d50c=function(_0x129667){while(--_0x129667){_0x20b2f2['push'](_0x20b2f2['shift']());}};_0x16d50c(++_0x49ce53);}(_0x731d,0x123));var _0xd731=function(_0x1887a0,_0x3ffe57){_0x1887a0=_0x1887a0-0x0;var _0x5d31e4=_0x731d[_0x1887a0];return _0x5d31e4;};'use strict';var _=require(_0xd731('0x0'));var util=require(_0xd731('0x1'));var moment=require('moment');var BPromise=require(_0xd731('0x2'));var rs=require(_0xd731('0x3'));var fs=require('fs');var Redis=require(_0xd731('0x4'));var db=require(_0xd731('0x5'))['db'];var utils=require(_0xd731('0x6'));var logger=require(_0xd731('0x7'))('rpc');var config=require(_0xd731('0x8'));var jayson=require(_0xd731('0x9'));var client=jayson[_0xd731('0xa')][_0xd731('0xb')]({'port':0x232a});config[_0xd731('0xc')]=_['defaults'](config[_0xd731('0xc')],{'host':_0xd731('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd731('0xc')]));require(_0xd731('0xe'))[_0xd731('0xf')](socket);function respondWithRpcPromise(_0x56eb9b,_0x3c115f,_0x5c288b){return new BPromise(function(_0x2908c4,_0x3cba6e){return client[_0xd731('0x10')](_0x56eb9b,_0x5c288b)[_0xd731('0x11')](function(_0x5ce05d){logger[_0xd731('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x3c115f,_0xd731('0x13'));logger[_0xd731('0x14')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x3c115f,_0xd731('0x13'),JSON['stringify'](_0x5ce05d));if(_0x5ce05d['error']){if(_0x5ce05d['error']['code']===0x1f4){logger['error'](_0xd731('0x15'),_0x3c115f,_0x5ce05d[_0xd731('0x16')]['message']);return _0x3cba6e(_0x5ce05d['error'][_0xd731('0x17')]);}logger[_0xd731('0x16')](_0xd731('0x15'),_0x3c115f,_0x5ce05d['error'][_0xd731('0x17')]);return _0x2908c4(_0x5ce05d[_0xd731('0x16')]['message']);}else{logger['info'](_0xd731('0x15'),_0x3c115f,'request\x20sent');_0x2908c4(_0x5ce05d['result']['message']);}})[_0xd731('0x18')](function(_0x5c3716){logger[_0xd731('0x16')](_0xd731('0x15'),_0x3c115f,_0x5c3716);_0x3cba6e(_0x5c3716);});});} \ No newline at end of file +var _0xef35=['../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x42f392,_0x53ffff){var _0x40ec61=function(_0x1343ab){while(--_0x1343ab){_0x42f392['push'](_0x42f392['shift']());}};_0x40ec61(++_0x53ffff);}(_0xef35,0x95));var _0x5ef3=function(_0x71b765,_0x3053f8){_0x71b765=_0x71b765-0x0;var _0x34cb24=_0xef35[_0x71b765];return _0x34cb24;};'use strict';var _=require(_0x5ef3('0x0'));var util=require('util');var moment=require(_0x5ef3('0x1'));var BPromise=require(_0x5ef3('0x2'));var rs=require(_0x5ef3('0x3'));var fs=require('fs');var Redis=require(_0x5ef3('0x4'));var db=require(_0x5ef3('0x5'))['db'];var utils=require(_0x5ef3('0x6'));var logger=require(_0x5ef3('0x7'))('rpc');var config=require(_0x5ef3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5ef3('0x9')]['http']({'port':0x232a});config[_0x5ef3('0xa')]=_[_0x5ef3('0xb')](config[_0x5ef3('0xa')],{'host':_0x5ef3('0xc'),'port':0x18eb});var socket=require(_0x5ef3('0xd'))(new Redis(config[_0x5ef3('0xa')]));require('./chatInternalMessage.socket')[_0x5ef3('0xe')](socket);function respondWithRpcPromise(_0x52abd9,_0x88774f,_0x45fa53){return new BPromise(function(_0x5b19b6,_0x2ddbd7){return client['request'](_0x52abd9,_0x45fa53)['then'](function(_0x50e477){logger[_0x5ef3('0xf')](_0x5ef3('0x10'),_0x88774f,_0x5ef3('0x11'));logger[_0x5ef3('0x12')](_0x5ef3('0x13'),_0x88774f,'request\x20sent',JSON[_0x5ef3('0x14')](_0x50e477));if(_0x50e477[_0x5ef3('0x15')]){if(_0x50e477[_0x5ef3('0x15')][_0x5ef3('0x16')]===0x1f4){logger[_0x5ef3('0x15')](_0x5ef3('0x10'),_0x88774f,_0x50e477[_0x5ef3('0x15')][_0x5ef3('0x17')]);return _0x2ddbd7(_0x50e477['error']['message']);}logger[_0x5ef3('0x15')](_0x5ef3('0x10'),_0x88774f,_0x50e477[_0x5ef3('0x15')][_0x5ef3('0x17')]);return _0x5b19b6(_0x50e477[_0x5ef3('0x15')]['message']);}else{logger['info'](_0x5ef3('0x10'),_0x88774f,_0x5ef3('0x11'));_0x5b19b6(_0x50e477[_0x5ef3('0x18')][_0x5ef3('0x17')]);}})[_0x5ef3('0x19')](function(_0x1c8008){logger[_0x5ef3('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x88774f,_0x1c8008);_0x2ddbd7(_0x1c8008);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index f90b1db..04fe533 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 _0x7d80=['./chatInternalMessage.events','remove','emit','register','length'];(function(_0x2a0300,_0x1510a2){var _0x279524=function(_0x46ff81){while(--_0x46ff81){_0x2a0300['push'](_0x2a0300['shift']());}};_0x279524(++_0x1510a2);}(_0x7d80,0x186));var _0x07d8=function(_0x2ca7a3,_0x4d908d){_0x2ca7a3=_0x2ca7a3-0x0;var _0x318cb2=_0x7d80[_0x2ca7a3];return _0x318cb2;};'use strict';var ChatInternalMessageEvents=require(_0x07d8('0x0'));var events=['save',_0x07d8('0x1'),'update'];function createListener(_0xc14632,_0x46b35b){return function(_0x385460){_0x46b35b[_0x07d8('0x2')](_0xc14632,_0x385460);};}function removeListener(_0x7c2e60,_0x41961e){return function(){ChatInternalMessageEvents['removeListener'](_0x7c2e60,_0x41961e);};}exports[_0x07d8('0x3')]=function(_0x13ff9a){for(var _0x5f5d6e=0x0,_0x4b2608=events[_0x07d8('0x4')];_0x5f5d6e<_0x4b2608;_0x5f5d6e++){var _0x5c2f29=events[_0x5f5d6e];var _0x3203d2=createListener('chatInternalMessage:'+_0x5c2f29,_0x13ff9a);ChatInternalMessageEvents['on'](_0x5c2f29,_0x3203d2);}}; \ No newline at end of file +var _0xb4be=['save','update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x8857f0,_0x471d00){var _0x420dc5=function(_0x4e700b){while(--_0x4e700b){_0x8857f0['push'](_0x8857f0['shift']());}};_0x420dc5(++_0x471d00);}(_0xb4be,0xa7));var _0xeb4b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb4be[_0x19950b];return _0x3c6b41;};'use strict';var ChatInternalMessageEvents=require(_0xeb4b('0x0'));var events=[_0xeb4b('0x1'),'remove',_0xeb4b('0x2')];function createListener(_0x2fc51b,_0x2f3de8){return function(_0x6bd18b){_0x2f3de8[_0xeb4b('0x3')](_0x2fc51b,_0x6bd18b);};}function removeListener(_0x1da422,_0x1cb300){return function(){ChatInternalMessageEvents[_0xeb4b('0x4')](_0x1da422,_0x1cb300);};}exports[_0xeb4b('0x5')]=function(_0xe55d59){for(var _0x6eecd7=0x0,_0x486b7d=events[_0xeb4b('0x6')];_0x6eecd7<_0x486b7d;_0x6eecd7++){var _0x5f5466=events[_0x6eecd7];var _0xda96fa=createListener(_0xeb4b('0x7')+_0x5f5466,_0xe55d59);ChatInternalMessageEvents['on'](_0x5f5466,_0xda96fa);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index a4883b8..f7caffe 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 _0xdf52=['update','delete','/:id','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','getUsers','post','create'];(function(_0x30fbbd,_0x4156e7){var _0xf62d43=function(_0x13af44){while(--_0x13af44){_0x30fbbd['push'](_0x30fbbd['shift']());}};_0xf62d43(++_0x4156e7);}(_0xdf52,0x8b));var _0x2df5=function(_0x2f9c35,_0x15abfc){_0x2f9c35=_0x2f9c35-0x0;var _0x1129e1=_0xdf52[_0x2f9c35];return _0x1129e1;};'use strict';var multer=require(_0x2df5('0x0'));var util=require(_0x2df5('0x1'));var path=require('path');var timeout=require(_0x2df5('0x2'));var express=require(_0x2df5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2df5('0x4'));var config=require(_0x2df5('0x5'));var controller=require(_0x2df5('0x6'));router[_0x2df5('0x7')]('/',auth[_0x2df5('0x8')](),controller['index']);router[_0x2df5('0x7')](_0x2df5('0x9'),auth[_0x2df5('0x8')](),controller[_0x2df5('0xa')]);router['get']('/users',auth[_0x2df5('0x8')](),controller[_0x2df5('0xb')]);router['get']('/:id',auth[_0x2df5('0x8')](),controller['show']);router[_0x2df5('0xc')]('/',auth[_0x2df5('0x8')](),controller[_0x2df5('0xd')]);router['put']('/:id',controller[_0x2df5('0xe')]);router[_0x2df5('0xf')](_0x2df5('0x10'),auth[_0x2df5('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf2b9=['post','create','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','getUsers','/:id','show'];(function(_0x29e871,_0x330b98){var _0x3380e3=function(_0x26eeae){while(--_0x26eeae){_0x29e871['push'](_0x29e871['shift']());}};_0x3380e3(++_0x330b98);}(_0xf2b9,0x123));var _0x9f2b=function(_0x522a6a,_0x50b382){_0x522a6a=_0x522a6a-0x0;var _0x2e33df=_0xf2b9[_0x522a6a];return _0x2e33df;};'use strict';var multer=require(_0x9f2b('0x0'));var util=require(_0x9f2b('0x1'));var path=require(_0x9f2b('0x2'));var timeout=require('connect-timeout');var express=require(_0x9f2b('0x3'));var router=express[_0x9f2b('0x4')]();var fs_extra=require(_0x9f2b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9f2b('0x6'));var config=require(_0x9f2b('0x7'));var controller=require(_0x9f2b('0x8'));router[_0x9f2b('0x9')]('/',auth[_0x9f2b('0xa')](),controller[_0x9f2b('0xb')]);router[_0x9f2b('0x9')]('/describe',auth[_0x9f2b('0xa')](),controller[_0x9f2b('0xc')]);router['get'](_0x9f2b('0xd'),auth['isAuthenticated'](),controller[_0x9f2b('0xe')]);router['get'](_0x9f2b('0xf'),auth[_0x9f2b('0xa')](),controller[_0x9f2b('0x10')]);router[_0x9f2b('0x11')]('/',auth[_0x9f2b('0xa')](),controller[_0x9f2b('0x12')]);router[_0x9f2b('0x13')](_0x9f2b('0xf'),controller[_0x9f2b('0x14')]);router[_0x9f2b('0x15')]('/:id',auth[_0x9f2b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 9749502..11bf7e0 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 _0xf4f4=['out','DATE','TEXT','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x23f7d9,_0x2977e8){var _0x546070=function(_0x592614){while(--_0x592614){_0x23f7d9['push'](_0x23f7d9['shift']());}};_0x546070(++_0x2977e8);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x3db639,_0x59d613){_0x3db639=_0x3db639-0x0;var _0x337446=_0xf4f4[_0x3db639];return _0x337446;};'use strict';var Sequelize=require(_0x4f4f('0x0'));module[_0x4f4f('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4f4f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4f4f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4f4f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4f4f('0x4')]('in',_0x4f4f('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x4f4f('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4f4f('0x7')]}}; \ No newline at end of file +var _0x9563=['BOOLEAN','ENUM','DATE','TEXT','sequelize','exports','medium'];(function(_0x3cc033,_0x11c7cb){var _0x56fa8d=function(_0x537fe5){while(--_0x537fe5){_0x3cc033['push'](_0x3cc033['shift']());}};_0x56fa8d(++_0x11c7cb);}(_0x9563,0x1e7));var _0x3956=function(_0x37d843,_0x5a1de3){_0x37d843=_0x37d843-0x0;var _0x6ae125=_0x9563[_0x37d843];return _0x6ae125;};'use strict';var Sequelize=require(_0x3956('0x0'));module[_0x3956('0x1')]={'body':{'type':Sequelize['TEXT'](_0x3956('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3956('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3956('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3956('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x3956('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3956('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 8fc6762..ec09600 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 _0x4d58=['name','send','index','map','ChatMessage','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create','body','params','describe','chat-interactions','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','[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','SELECT','contact','User','fullname','email','internal','agent','manual','channel','event','accept','EventManager','acceptmessage','parse','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','QueryTypes','interface','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatMessage.socket','register','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','destroy','stack'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4d58,0xd3));var _0x84d5=function(_0x14b800,_0x522988){_0x14b800=_0x14b800-0x0;var _0xf1f84d=_0x4d58[_0x14b800];return _0xf1f84d;};'use strict';var emlformat=require(_0x84d5('0x0'));var rimraf=require(_0x84d5('0x1'));var zipdir=require(_0x84d5('0x2'));var jsonpatch=require(_0x84d5('0x3'));var rp=require(_0x84d5('0x4'));var moment=require(_0x84d5('0x5'));var BPromise=require(_0x84d5('0x6'));var Mustache=require(_0x84d5('0x7'));var util=require(_0x84d5('0x8'));var path=require(_0x84d5('0x9'));var sox=require(_0x84d5('0xa'));var csv=require(_0x84d5('0xb'));var ejs=require(_0x84d5('0xc'));var fs=require('fs');var fs_extra=require(_0x84d5('0xd'));var _=require(_0x84d5('0xe'));var squel=require(_0x84d5('0xf'));var crypto=require('crypto');var jsforce=require(_0x84d5('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x84d5('0x11'));var Papa=require(_0x84d5('0x12'));var Redis=require(_0x84d5('0x13'));var authService=require(_0x84d5('0x14'));var qs=require(_0x84d5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84d5('0x16'));var logger=require(_0x84d5('0x17'))('api');var utils=require(_0x84d5('0x18'));var config=require(_0x84d5('0x19'));var licenseUtil=require(_0x84d5('0x1a'));var db=require(_0x84d5('0x1b'))['db'];config[_0x84d5('0x1c')]=_['defaults'](config[_0x84d5('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x84d5('0x1d'))(new Redis(config[_0x84d5('0x1c')]));require(_0x84d5('0x1e'))[_0x84d5('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x84d5('0x20')][_0x84d5('0x21')]({'port':0x232c});var client9002=jayson[_0x84d5('0x20')][_0x84d5('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xaab564,_0x360b8c,_0x1544d0,_0xfd91ca){return new BPromise(function(_0x1c8bf4,_0x12253a){var _0x585d36=_0xfd91ca||client;return _0x585d36[_0x84d5('0x22')](_0xaab564,_0x1544d0)[_0x84d5('0x23')](function(_0x5dda21){logger[_0x84d5('0x24')](_0x84d5('0x25'),_0x360b8c,_0x84d5('0x26'));logger['debug'](_0x84d5('0x27'),_0x360b8c,'request\x20sent',JSON[_0x84d5('0x28')](_0x5dda21));if(_0x5dda21[_0x84d5('0x29')]){if(_0x5dda21[_0x84d5('0x29')]['code']===0x1f4){logger['error'](_0x84d5('0x25'),_0x360b8c,_0x5dda21[_0x84d5('0x29')][_0x84d5('0x2a')]);return _0x12253a(_0x5dda21['error'][_0x84d5('0x2a')]);}logger[_0x84d5('0x29')]('ChatMessage,\x20%s,\x20%s',_0x360b8c,_0x5dda21['error'][_0x84d5('0x2a')]);return _0x1c8bf4(_0x5dda21['error']['message']);}else{logger[_0x84d5('0x24')]('ChatMessage,\x20%s,\x20%s',_0x360b8c,_0x84d5('0x26'));_0x1c8bf4(_0x5dda21['result'][_0x84d5('0x2a')]);}})['catch'](function(_0x4fe5aa){logger['error'](_0x84d5('0x25'),_0x360b8c,_0x4fe5aa);_0x12253a(_0x4fe5aa);});});}function respondWithStatusCode(_0x53d8ef,_0x2daf74){_0x2daf74=_0x2daf74||0xcc;return function(_0x1d1188){if(_0x1d1188){return _0x53d8ef[_0x84d5('0x2b')](_0x2daf74);}return _0x53d8ef[_0x84d5('0x2c')](_0x2daf74)[_0x84d5('0x2d')]();};}function respondWithResult(_0xa309d3,_0x12d0e7){_0x12d0e7=_0x12d0e7||0xc8;return function(_0x14256f){if(_0x14256f){return _0xa309d3[_0x84d5('0x2c')](_0x12d0e7)[_0x84d5('0x2e')](_0x14256f);}};}function respondWithFilteredResult(_0x194e15,_0x52f74b){return function(_0x1b8634){if(_0x1b8634){var _0x5e3e6b=typeof _0x52f74b[_0x84d5('0x2f')]===_0x84d5('0x30')&&typeof _0x52f74b['limit']===_0x84d5('0x30');var _0x3978dd=_0x1b8634[_0x84d5('0x31')];var _0x1dd5cc=_0x5e3e6b?0x0:_0x52f74b[_0x84d5('0x2f')];var _0x2c6314=_0x5e3e6b?_0x1b8634['count']:_0x52f74b[_0x84d5('0x2f')]+_0x52f74b['limit'];var _0x27dc94;if(_0x2c6314>=_0x3978dd){_0x2c6314=_0x3978dd;_0x27dc94=0xc8;}else{_0x27dc94=0xce;}_0x194e15[_0x84d5('0x2c')](_0x27dc94);return _0x194e15[_0x84d5('0x32')](_0x84d5('0x33'),_0x1dd5cc+'-'+_0x2c6314+'/'+_0x3978dd)['json'](_0x1b8634);}return null;};}function patchUpdates(_0x481f2a){return function(_0x329b34){try{jsonpatch[_0x84d5('0x34')](_0x329b34,_0x481f2a,!![]);}catch(_0x3f27a4){return BPromise['reject'](_0x3f27a4);}return _0x329b34[_0x84d5('0x35')]();};}function saveUpdates(_0x3a3608,_0x3d9643){return function(_0x4c0cf5){if(_0x4c0cf5){return _0x4c0cf5[_0x84d5('0x36')](_0x3a3608)[_0x84d5('0x23')](function(_0xbd9296){return _0xbd9296;});}return null;};}function removeEntity(_0x59d916,_0x190bd9){return function(_0x21a2ef){if(_0x21a2ef){return _0x21a2ef[_0x84d5('0x37')]()['then'](function(){_0x59d916[_0x84d5('0x2c')](0xcc)[_0x84d5('0x2d')]();});}};}function handleEntityNotFound(_0x3afe2f,_0x3363ae){return function(_0x3e0b31){if(!_0x3e0b31){_0x3afe2f[_0x84d5('0x2b')](0x194);}return _0x3e0b31;};}function handleError(_0x1945e4,_0x48dabf){_0x48dabf=_0x48dabf||0x1f4;return function(_0x55112f){logger['error'](_0x55112f[_0x84d5('0x38')]);if(_0x55112f[_0x84d5('0x39')]){delete _0x55112f['name'];}_0x1945e4[_0x84d5('0x2c')](_0x48dabf)[_0x84d5('0x3a')](_0x55112f);};}exports[_0x84d5('0x3b')]=function(_0x33cbbd,_0x30b1d4){var _0x41c0ba={},_0x20b28c={},_0x4afd0b={'count':0x0,'rows':[]};var _0x59dcfd=_[_0x84d5('0x3c')](db[_0x84d5('0x3d')][_0x84d5('0x3e')],function(_0x5853d4){return{'name':_0x5853d4[_0x84d5('0x3f')],'type':_0x5853d4['type']['key']};});_0x20b28c['model']=_[_0x84d5('0x3c')](_0x59dcfd,_0x84d5('0x39'));_0x20b28c[_0x84d5('0x40')]=_[_0x84d5('0x41')](_0x33cbbd['query']);_0x20b28c[_0x84d5('0x42')]=_[_0x84d5('0x43')](_0x20b28c[_0x84d5('0x44')],_0x20b28c[_0x84d5('0x40')]);_0x41c0ba[_0x84d5('0x45')]=_[_0x84d5('0x43')](_0x20b28c[_0x84d5('0x44')],qs[_0x84d5('0x46')](_0x33cbbd[_0x84d5('0x40')][_0x84d5('0x46')]));_0x41c0ba[_0x84d5('0x45')]=_0x41c0ba['attributes']['length']?_0x41c0ba[_0x84d5('0x45')]:_0x20b28c[_0x84d5('0x44')];if(!_0x33cbbd[_0x84d5('0x40')][_0x84d5('0x47')](_0x84d5('0x48'))){_0x41c0ba[_0x84d5('0x49')]=qs[_0x84d5('0x49')](_0x33cbbd[_0x84d5('0x40')][_0x84d5('0x49')]);_0x41c0ba[_0x84d5('0x2f')]=qs[_0x84d5('0x2f')](_0x33cbbd[_0x84d5('0x40')][_0x84d5('0x2f')]);}_0x41c0ba['order']=qs[_0x84d5('0x4a')](_0x33cbbd[_0x84d5('0x40')][_0x84d5('0x4a')]);_0x41c0ba[_0x84d5('0x4b')]=qs[_0x84d5('0x42')](_[_0x84d5('0x4c')](_0x33cbbd[_0x84d5('0x40')],_0x20b28c['filters']),_0x59dcfd);if(_0x33cbbd[_0x84d5('0x40')][_0x84d5('0x4d')]){_0x41c0ba[_0x84d5('0x4b')]=_[_0x84d5('0x4e')](_0x41c0ba[_0x84d5('0x4b')],{'$or':_['map'](_0x59dcfd,function(_0x56c3e3){if(_0x56c3e3[_0x84d5('0x4f')]!==_0x84d5('0x50')){var _0x22b335={};_0x22b335[_0x56c3e3['name']]={'$like':'%'+_0x33cbbd['query'][_0x84d5('0x4d')]+'%'};return _0x22b335;}})});}_0x41c0ba=_[_0x84d5('0x4e')]({},_0x41c0ba,_0x33cbbd[_0x84d5('0x51')]);var _0x3e0cec={'where':_0x41c0ba['where']};return db[_0x84d5('0x3d')][_0x84d5('0x31')](_0x3e0cec)[_0x84d5('0x23')](function(_0x5875a7){_0x4afd0b['count']=_0x5875a7;if(_0x33cbbd[_0x84d5('0x40')][_0x84d5('0x52')]){_0x41c0ba[_0x84d5('0x53')]=[{'all':!![]}];}return db[_0x84d5('0x3d')][_0x84d5('0x54')](_0x41c0ba);})[_0x84d5('0x23')](function(_0x19d7e9){_0x4afd0b['rows']=_0x19d7e9;return _0x4afd0b;})[_0x84d5('0x23')](respondWithFilteredResult(_0x30b1d4,_0x41c0ba))[_0x84d5('0x55')](handleError(_0x30b1d4,null));};exports[_0x84d5('0x56')]=function(_0x6ee391,_0x32b159){var _0x11381f={'raw':!![],'where':{'id':_0x6ee391['params']['id']}},_0x53dfa5={};_0x53dfa5[_0x84d5('0x44')]=_[_0x84d5('0x41')](db[_0x84d5('0x3d')][_0x84d5('0x3e')]);_0x53dfa5[_0x84d5('0x40')]=_['keys'](_0x6ee391[_0x84d5('0x40')]);_0x53dfa5['filters']=_[_0x84d5('0x43')](_0x53dfa5['model'],_0x53dfa5[_0x84d5('0x40')]);_0x11381f[_0x84d5('0x45')]=_[_0x84d5('0x43')](_0x53dfa5[_0x84d5('0x44')],qs['fields'](_0x6ee391[_0x84d5('0x40')][_0x84d5('0x46')]));_0x11381f[_0x84d5('0x45')]=_0x11381f[_0x84d5('0x45')][_0x84d5('0x57')]?_0x11381f[_0x84d5('0x45')]:_0x53dfa5[_0x84d5('0x44')];if(_0x6ee391['query'][_0x84d5('0x52')]){_0x11381f[_0x84d5('0x53')]=[{'all':!![]}];}_0x11381f=_[_0x84d5('0x4e')]({},_0x11381f,_0x6ee391[_0x84d5('0x51')]);return db[_0x84d5('0x3d')][_0x84d5('0x58')](_0x11381f)['then'](handleEntityNotFound(_0x32b159,null))[_0x84d5('0x23')](respondWithResult(_0x32b159,null))['catch'](handleError(_0x32b159,null));};exports[_0x84d5('0x59')]=function(_0x40d62e,_0x2a2d1b){return db[_0x84d5('0x3d')][_0x84d5('0x59')](_0x40d62e[_0x84d5('0x5a')],{})[_0x84d5('0x23')](respondWithResult(_0x2a2d1b,0xc9))['catch'](handleError(_0x2a2d1b,null));};exports['update']=function(_0x162559,_0x3881bf){if(_0x162559[_0x84d5('0x5a')]['id']){delete _0x162559['body']['id'];}return db[_0x84d5('0x3d')][_0x84d5('0x58')]({'where':{'id':_0x162559[_0x84d5('0x5b')]['id']}})[_0x84d5('0x23')](handleEntityNotFound(_0x3881bf,null))['then'](saveUpdates(_0x162559[_0x84d5('0x5a')],null))[_0x84d5('0x23')](respondWithResult(_0x3881bf,null))[_0x84d5('0x55')](handleError(_0x3881bf,null));};exports['destroy']=function(_0x18e621,_0x4ca644){return db[_0x84d5('0x3d')][_0x84d5('0x58')]({'where':{'id':_0x18e621[_0x84d5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4ca644,null))[_0x84d5('0x23')](removeEntity(_0x4ca644,null))['catch'](handleError(_0x4ca644,null));};exports[_0x84d5('0x5c')]=function(_0x2a0375,_0x3a905f){return db[_0x84d5('0x3d')][_0x84d5('0x5c')]()[_0x84d5('0x23')](respondWithResult(_0x3a905f,null))[_0x84d5('0x55')](handleError(_0x3a905f,null));};var interaction_log=require(_0x84d5('0x17'))(_0x84d5('0x5d'));exports['accept']=function(_0x2bf115,_0x1ace16,_0x1941cf){var _0x39cb32={'agent':{},'channel':_0x84d5('0x5e')};if(_0x2bf115[_0x84d5('0x5a')]['id']){delete _0x2bf115[_0x84d5('0x5a')]['id'];}_0x2bf115[_0x84d5('0x5a')]['read']=!![];_0x2bf115[_0x84d5('0x5a')][_0x84d5('0x5f')]=moment()[_0x84d5('0x60')](_0x84d5('0x61'));_0x2bf115[_0x84d5('0x5a')][_0x84d5('0x62')]=_0x2bf115[_0x84d5('0x5a')][_0x84d5('0x62')]||_0x2bf115[_0x84d5('0x63')]['id'];_0x39cb32['agent']['id']=_0x2bf115[_0x84d5('0x5a')]['UserId'];return db[_0x84d5('0x3d')][_0x84d5('0x58')]({'where':{'id':_0x2bf115[_0x84d5('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1ace16,null))[_0x84d5('0x23')](saveUpdates(_0x2bf115['body'],null))['then'](function(_0x1c2691){if(_0x1c2691){_0x39cb32[_0x84d5('0x2a')]=_0x1c2691[_0x84d5('0x64')]({'plain':!![]});return db[_0x84d5('0x65')][_0x84d5('0x58')]({'where':{'id':_0x1c2691['ChatInteractionId']}});}return null;})[_0x84d5('0x23')](handleEntityNotFound(_0x1ace16,null))[_0x84d5('0x23')](function(_0x4b7679){if(_0x4b7679){return _0x4b7679[_0x84d5('0x36')]({'UserId':_0x2bf115[_0x84d5('0x5a')][_0x84d5('0x62')],'read1stAt':_['isNil'](_0x4b7679['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x84d5('0x23')](function(_0x455f9a){if(_0x455f9a){_0x39cb32['interaction']=_0x455f9a[_0x84d5('0x64')]({'plain':!![]});interaction_log[_0x84d5('0x24')](_0x84d5('0x66'),_0x2bf115[_0x84d5('0x63')]['id'],_0x2bf115[_0x84d5('0x63')]['name'],_0x2bf115[_0x84d5('0x63')][_0x84d5('0x67')],_0x39cb32[_0x84d5('0x68')]['id'],_0x2bf115[_0x84d5('0x5a')]?JSON[_0x84d5('0x28')](_0x2bf115[_0x84d5('0x5a')]):_0x84d5('0x69'));return respondWithRpcPromise(_0x84d5('0x6a'),'acceptMessage',_0x39cb32);}return null;})[_0x84d5('0x23')](function(_0x973795){var _0x5e1212=_0x84d5('0x6b')+_0x973795[_0x84d5('0x2a')][_0x84d5('0x6c')];return db['sequelize'][_0x84d5('0x40')](_0x5e1212,{'type':db[_0x84d5('0x6d')]['QueryTypes'][_0x84d5('0x6e')],'raw':!![]})[_0x84d5('0x23')](function(_0x21d2d9){return _0x21d2d9;});})[_0x84d5('0x23')](function(_0x5b17c2){if(_0x5b17c2){_0x39cb32[_0x84d5('0x2a')][_0x84d5('0x6f')]=_0x5b17c2[0x0];if(!_0x2bf115[_0x84d5('0x5a')][_0x84d5('0x62')])return;return db[_0x84d5('0x70')][_0x84d5('0x58')]({'where':{'id':_0x2bf115[_0x84d5('0x5a')][_0x84d5('0x62')],'role':'agent'},'attributes':['id',_0x84d5('0x39'),_0x84d5('0x71'),_0x84d5('0x72'),_0x84d5('0x73')],'raw':!![]});}return null;})['then'](function(_0x379190){if(!_0x379190)return null;_0x39cb32['message'][_0x84d5('0x74')]=_0x379190;return _0x39cb32;})[_0x84d5('0x23')](function(_0x507bee){if(_0x507bee){if(_0x2bf115['body'][_0x84d5('0x75')]){_0x39cb32['message']['interface']=util[_0x84d5('0x60')]('SIP/%s',_0x2bf115[_0x84d5('0x63')]['name']);_0x39cb32['message'][_0x84d5('0x76')]=_0x39cb32[_0x84d5('0x76')];_0x39cb32[_0x84d5('0x2a')]['motionChannel']=_0x39cb32['channel'];_0x39cb32[_0x84d5('0x2a')][_0x84d5('0x77')]=_0x84d5('0x78');return respondWithRpcPromise(_0x84d5('0x79'),'EventManager',{'event':_0x84d5('0x7a'),'message':_['merge'](_0x39cb32[_0x84d5('0x2a')],JSON[_0x84d5('0x7b')](_0x39cb32['interaction'][_0x84d5('0x7c')]))},client9002)[_0x84d5('0x23')](function(){return _0x39cb32;});}return _0x39cb32;}return null;})[_0x84d5('0x23')](respondWithResult(_0x1ace16,null))[_0x84d5('0x55')](handleError(_0x1ace16,null));};var interaction_log=require(_0x84d5('0x17'))(_0x84d5('0x5d'));exports[_0x84d5('0x7d')]=function(_0x1e9843,_0x283e96,_0x2a56d2){var _0xc515d5={'agent':{},'channel':'chat'};if(_0x1e9843[_0x84d5('0x5a')]['id']){delete _0x1e9843['body']['id'];}_0x1e9843[_0x84d5('0x5a')][_0x84d5('0x62')]=_0x1e9843[_0x84d5('0x5a')][_0x84d5('0x62')]||_0x1e9843[_0x84d5('0x63')]['id'];_0xc515d5[_0x84d5('0x74')]['id']=_0x1e9843[_0x84d5('0x5a')][_0x84d5('0x62')];return db[_0x84d5('0x3d')][_0x84d5('0x58')]({'where':{'id':_0x1e9843[_0x84d5('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x283e96,null))['then'](function(_0x48d481){if(_0x48d481){_0xc515d5['message']=_0x48d481[_0x84d5('0x64')]({'plain':!![]});return db[_0x84d5('0x65')][_0x84d5('0x58')]({'where':{'id':_0x48d481['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x283e96,null))['then'](function(_0xe22449){if(_0xe22449){_0xc515d5[_0x84d5('0x68')]=_0xe22449['get']({'plain':!![]});interaction_log[_0x84d5('0x24')](_0x84d5('0x7e'),_0x1e9843[_0x84d5('0x63')]['id'],_0x1e9843[_0x84d5('0x63')][_0x84d5('0x39')],_0x1e9843[_0x84d5('0x63')]['role'],_0xc515d5[_0x84d5('0x68')]['id'],_0x1e9843[_0x84d5('0x5a')]?JSON[_0x84d5('0x28')](_0x1e9843[_0x84d5('0x5a')]):_0x84d5('0x69'));return respondWithRpcPromise(_0x84d5('0x7f'),_0x84d5('0x80'),_0xc515d5);}return null;})[_0x84d5('0x23')](function(_0x572005){var _0x244d87=_0x84d5('0x6b')+_0x572005[_0x84d5('0x2a')][_0x84d5('0x6c')];return db[_0x84d5('0x81')][_0x84d5('0x40')](_0x244d87,{'type':db['Sequelize'][_0x84d5('0x82')][_0x84d5('0x6e')],'raw':!![]})[_0x84d5('0x23')](function(_0x15b1c0){return _0x15b1c0;});})['then'](function(_0x95416c){if(_0x95416c){_0xc515d5[_0x84d5('0x2a')][_0x84d5('0x6f')]=_0x95416c[0x0];if(!_0x1e9843['body'][_0x84d5('0x62')])return;return db[_0x84d5('0x70')][_0x84d5('0x58')]({'where':{'id':_0x1e9843['body']['UserId'],'role':_0x84d5('0x74')},'attributes':['id',_0x84d5('0x39'),_0x84d5('0x71'),_0x84d5('0x72'),_0x84d5('0x73')],'raw':!![]});}return null;})[_0x84d5('0x23')](function(_0x536fbb){if(!_0x536fbb)return null;_0xc515d5['message'][_0x84d5('0x74')]=_0x536fbb;return _0xc515d5;})[_0x84d5('0x23')](function(_0x16dacd){if(_0x16dacd){_0x16dacd[_0x84d5('0x2a')][_0x84d5('0x83')]=util[_0x84d5('0x60')](_0x84d5('0x84'),_0x1e9843[_0x84d5('0x63')][_0x84d5('0x39')]);_0x16dacd[_0x84d5('0x2a')][_0x84d5('0x76')]=_0xc515d5[_0x84d5('0x76')];_0x16dacd[_0x84d5('0x2a')]['motionChannel']=_0xc515d5[_0x84d5('0x76')];_0x16dacd[_0x84d5('0x2a')][_0x84d5('0x77')]='reject';respondWithRpcPromise(_0x84d5('0x79'),'EventManager',{'event':_0x84d5('0x85'),'message':_['merge'](_0xc515d5[_0x84d5('0x2a')],JSON[_0x84d5('0x7b')](_0xc515d5[_0x84d5('0x68')]['formData']))},client9002);return _0xc515d5;}return null;})[_0x84d5('0x23')](respondWithResult(_0x283e96,null))['catch'](handleError(_0x283e96,null));}; \ No newline at end of file +var _0xdb92=['rejectmessage','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','sendStatus','status','end','offset','limit','count','set','json','apply','reject','save','destroy','stack','name','send','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','where','filter','merge','VIRTUAL','options','include','ChatMessage','findAll','rows','show','params','rawAttributes','includeAll','find','create','body','chat','read','readAt','format','UserId','user','agent','get','ChatInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','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','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','formData','chat-interactions','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','sequelize','SELECT'];(function(_0x47df86,_0x579c21){var _0xe2bce7=function(_0x22df2e){while(--_0x22df2e){_0x47df86['push'](_0x47df86['shift']());}};_0xe2bce7(++_0x579c21);}(_0xdb92,0x181));var _0x2db9=function(_0x28b914,_0x1273ec){_0x28b914=_0x28b914-0x0;var _0x1a30c1=_0xdb92[_0x28b914];return _0x1a30c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2db9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2db9('0x1'));var moment=require(_0x2db9('0x2'));var BPromise=require(_0x2db9('0x3'));var Mustache=require(_0x2db9('0x4'));var util=require(_0x2db9('0x5'));var path=require(_0x2db9('0x6'));var sox=require(_0x2db9('0x7'));var csv=require(_0x2db9('0x8'));var ejs=require(_0x2db9('0x9'));var fs=require('fs');var fs_extra=require(_0x2db9('0xa'));var _=require('lodash');var squel=require(_0x2db9('0xb'));var crypto=require('crypto');var jsforce=require(_0x2db9('0xc'));var deskjs=require(_0x2db9('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2db9('0xe'));var Redis=require(_0x2db9('0xf'));var authService=require(_0x2db9('0x10'));var qs=require(_0x2db9('0x11'));var as=require(_0x2db9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2db9('0x13'))(_0x2db9('0x14'));var utils=require(_0x2db9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2db9('0x16'));var db=require(_0x2db9('0x17'))['db'];config[_0x2db9('0x18')]=_[_0x2db9('0x19')](config[_0x2db9('0x18')],{'host':_0x2db9('0x1a'),'port':0x18eb});var socket=require(_0x2db9('0x1b'))(new Redis(config['redis']));require(_0x2db9('0x1c'))[_0x2db9('0x1d')](socket);var jayson=require(_0x2db9('0x1e'));var client=jayson['client'][_0x2db9('0x1f')]({'port':0x232c});var client9002=jayson[_0x2db9('0x20')][_0x2db9('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4dad95,_0x1e4400,_0x2c95a5,_0x3f001f){return new BPromise(function(_0x283314,_0x40134c){var _0x1d0546=_0x3f001f||client;return _0x1d0546[_0x2db9('0x21')](_0x4dad95,_0x2c95a5)[_0x2db9('0x22')](function(_0x145be1){logger[_0x2db9('0x23')](_0x2db9('0x24'),_0x1e4400,_0x2db9('0x25'));logger[_0x2db9('0x26')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1e4400,_0x2db9('0x25'),JSON['stringify'](_0x145be1));if(_0x145be1[_0x2db9('0x27')]){if(_0x145be1[_0x2db9('0x27')]['code']===0x1f4){logger[_0x2db9('0x27')](_0x2db9('0x24'),_0x1e4400,_0x145be1[_0x2db9('0x27')][_0x2db9('0x28')]);return _0x40134c(_0x145be1[_0x2db9('0x27')][_0x2db9('0x28')]);}logger[_0x2db9('0x27')]('ChatMessage,\x20%s,\x20%s',_0x1e4400,_0x145be1['error'][_0x2db9('0x28')]);return _0x283314(_0x145be1['error'][_0x2db9('0x28')]);}else{logger[_0x2db9('0x23')]('ChatMessage,\x20%s,\x20%s',_0x1e4400,_0x2db9('0x25'));_0x283314(_0x145be1['result'][_0x2db9('0x28')]);}})[_0x2db9('0x29')](function(_0x30dcb9){logger[_0x2db9('0x27')]('ChatMessage,\x20%s,\x20%s',_0x1e4400,_0x30dcb9);_0x40134c(_0x30dcb9);});});}function respondWithStatusCode(_0x14a1ea,_0xb67e06){_0xb67e06=_0xb67e06||0xcc;return function(_0x57b468){if(_0x57b468){return _0x14a1ea[_0x2db9('0x2a')](_0xb67e06);}return _0x14a1ea[_0x2db9('0x2b')](_0xb67e06)[_0x2db9('0x2c')]();};}function respondWithResult(_0x880011,_0x152f80){_0x152f80=_0x152f80||0xc8;return function(_0x8c7e6d){if(_0x8c7e6d){return _0x880011['status'](_0x152f80)['json'](_0x8c7e6d);}};}function respondWithFilteredResult(_0x561474,_0x596ec5){return function(_0x47ed5e){if(_0x47ed5e){var _0x47ff9c=typeof _0x596ec5[_0x2db9('0x2d')]==='undefined'&&typeof _0x596ec5[_0x2db9('0x2e')]==='undefined';var _0x4ae9b3=_0x47ed5e[_0x2db9('0x2f')];var _0x5a1439=_0x47ff9c?0x0:_0x596ec5['offset'];var _0x3bec94=_0x47ff9c?_0x47ed5e['count']:_0x596ec5['offset']+_0x596ec5['limit'];var _0x2a4f99;if(_0x3bec94>=_0x4ae9b3){_0x3bec94=_0x4ae9b3;_0x2a4f99=0xc8;}else{_0x2a4f99=0xce;}_0x561474[_0x2db9('0x2b')](_0x2a4f99);return _0x561474[_0x2db9('0x30')]('Content-Range',_0x5a1439+'-'+_0x3bec94+'/'+_0x4ae9b3)[_0x2db9('0x31')](_0x47ed5e);}return null;};}function patchUpdates(_0x27828f){return function(_0x1b3e1e){try{jsonpatch[_0x2db9('0x32')](_0x1b3e1e,_0x27828f,!![]);}catch(_0x90a72a){return BPromise[_0x2db9('0x33')](_0x90a72a);}return _0x1b3e1e[_0x2db9('0x34')]();};}function saveUpdates(_0x2d75c7,_0x3b1f4d){return function(_0x1fa4ea){if(_0x1fa4ea){return _0x1fa4ea['update'](_0x2d75c7)['then'](function(_0x3dc08b){return _0x3dc08b;});}return null;};}function removeEntity(_0x18474b,_0x175258){return function(_0x3bd3ef){if(_0x3bd3ef){return _0x3bd3ef[_0x2db9('0x35')]()[_0x2db9('0x22')](function(){_0x18474b[_0x2db9('0x2b')](0xcc)[_0x2db9('0x2c')]();});}};}function handleEntityNotFound(_0x22cc07,_0x514ff6){return function(_0x41e373){if(!_0x41e373){_0x22cc07[_0x2db9('0x2a')](0x194);}return _0x41e373;};}function handleError(_0x43cfec,_0x38c10a){_0x38c10a=_0x38c10a||0x1f4;return function(_0x219393){logger[_0x2db9('0x27')](_0x219393[_0x2db9('0x36')]);if(_0x219393[_0x2db9('0x37')]){delete _0x219393[_0x2db9('0x37')];}_0x43cfec[_0x2db9('0x2b')](_0x38c10a)[_0x2db9('0x38')](_0x219393);};}exports['index']=function(_0x3dc2d5,_0x14fb0c){var _0x4ef07c={},_0x5adc58={},_0x5477f1={'count':0x0,'rows':[]};var _0x3ac6f7=_[_0x2db9('0x39')](db['ChatMessage']['rawAttributes'],function(_0x45dbe5){return{'name':_0x45dbe5[_0x2db9('0x3a')],'type':_0x45dbe5[_0x2db9('0x3b')][_0x2db9('0x3c')]};});_0x5adc58['model']=_[_0x2db9('0x39')](_0x3ac6f7,_0x2db9('0x37'));_0x5adc58[_0x2db9('0x3d')]=_[_0x2db9('0x3e')](_0x3dc2d5[_0x2db9('0x3d')]);_0x5adc58[_0x2db9('0x3f')]=_[_0x2db9('0x40')](_0x5adc58[_0x2db9('0x41')],_0x5adc58[_0x2db9('0x3d')]);_0x4ef07c[_0x2db9('0x42')]=_[_0x2db9('0x40')](_0x5adc58[_0x2db9('0x41')],qs['fields'](_0x3dc2d5[_0x2db9('0x3d')][_0x2db9('0x43')]));_0x4ef07c[_0x2db9('0x42')]=_0x4ef07c[_0x2db9('0x42')]['length']?_0x4ef07c[_0x2db9('0x42')]:_0x5adc58[_0x2db9('0x41')];if(!_0x3dc2d5[_0x2db9('0x3d')]['hasOwnProperty']('nolimit')){_0x4ef07c[_0x2db9('0x2e')]=qs[_0x2db9('0x2e')](_0x3dc2d5[_0x2db9('0x3d')][_0x2db9('0x2e')]);_0x4ef07c[_0x2db9('0x2d')]=qs[_0x2db9('0x2d')](_0x3dc2d5[_0x2db9('0x3d')][_0x2db9('0x2d')]);}_0x4ef07c[_0x2db9('0x44')]=qs['sort'](_0x3dc2d5[_0x2db9('0x3d')]['sort']);_0x4ef07c[_0x2db9('0x45')]=qs[_0x2db9('0x3f')](_['pick'](_0x3dc2d5[_0x2db9('0x3d')],_0x5adc58['filters']),_0x3ac6f7);if(_0x3dc2d5['query'][_0x2db9('0x46')]){_0x4ef07c[_0x2db9('0x45')]=_[_0x2db9('0x47')](_0x4ef07c['where'],{'$or':_['map'](_0x3ac6f7,function(_0x40922d){if(_0x40922d['type']!==_0x2db9('0x48')){var _0x5b41d3={};_0x5b41d3[_0x40922d[_0x2db9('0x37')]]={'$like':'%'+_0x3dc2d5[_0x2db9('0x3d')]['filter']+'%'};return _0x5b41d3;}})});}_0x4ef07c=_['merge']({},_0x4ef07c,_0x3dc2d5[_0x2db9('0x49')]);var _0x40488e={'where':_0x4ef07c['where']};return db['ChatMessage'][_0x2db9('0x2f')](_0x40488e)[_0x2db9('0x22')](function(_0x10bfbe){_0x5477f1[_0x2db9('0x2f')]=_0x10bfbe;if(_0x3dc2d5[_0x2db9('0x3d')]['includeAll']){_0x4ef07c[_0x2db9('0x4a')]=[{'all':!![]}];}return db[_0x2db9('0x4b')][_0x2db9('0x4c')](_0x4ef07c);})['then'](function(_0x392674){_0x5477f1[_0x2db9('0x4d')]=_0x392674;return _0x5477f1;})[_0x2db9('0x22')](respondWithFilteredResult(_0x14fb0c,_0x4ef07c))[_0x2db9('0x29')](handleError(_0x14fb0c,null));};exports[_0x2db9('0x4e')]=function(_0x2d21a3,_0x484579){var _0x49c8d4={'raw':!![],'where':{'id':_0x2d21a3[_0x2db9('0x4f')]['id']}},_0x46f481={};_0x46f481[_0x2db9('0x41')]=_[_0x2db9('0x3e')](db[_0x2db9('0x4b')][_0x2db9('0x50')]);_0x46f481[_0x2db9('0x3d')]=_[_0x2db9('0x3e')](_0x2d21a3[_0x2db9('0x3d')]);_0x46f481[_0x2db9('0x3f')]=_[_0x2db9('0x40')](_0x46f481[_0x2db9('0x41')],_0x46f481['query']);_0x49c8d4[_0x2db9('0x42')]=_[_0x2db9('0x40')](_0x46f481[_0x2db9('0x41')],qs['fields'](_0x2d21a3[_0x2db9('0x3d')][_0x2db9('0x43')]));_0x49c8d4[_0x2db9('0x42')]=_0x49c8d4[_0x2db9('0x42')]['length']?_0x49c8d4[_0x2db9('0x42')]:_0x46f481[_0x2db9('0x41')];if(_0x2d21a3[_0x2db9('0x3d')][_0x2db9('0x51')]){_0x49c8d4[_0x2db9('0x4a')]=[{'all':!![]}];}_0x49c8d4=_[_0x2db9('0x47')]({},_0x49c8d4,_0x2d21a3['options']);return db[_0x2db9('0x4b')][_0x2db9('0x52')](_0x49c8d4)[_0x2db9('0x22')](handleEntityNotFound(_0x484579,null))['then'](respondWithResult(_0x484579,null))['catch'](handleError(_0x484579,null));};exports[_0x2db9('0x53')]=function(_0x42cdd7,_0x4fd24e){return db['ChatMessage'][_0x2db9('0x53')](_0x42cdd7['body'],{})[_0x2db9('0x22')](respondWithResult(_0x4fd24e,0xc9))[_0x2db9('0x29')](handleError(_0x4fd24e,null));};exports['update']=function(_0x1e7f6c,_0x44527f){if(_0x1e7f6c[_0x2db9('0x54')]['id']){delete _0x1e7f6c[_0x2db9('0x54')]['id'];}return db[_0x2db9('0x4b')][_0x2db9('0x52')]({'where':{'id':_0x1e7f6c['params']['id']}})[_0x2db9('0x22')](handleEntityNotFound(_0x44527f,null))['then'](saveUpdates(_0x1e7f6c[_0x2db9('0x54')],null))[_0x2db9('0x22')](respondWithResult(_0x44527f,null))[_0x2db9('0x29')](handleError(_0x44527f,null));};exports[_0x2db9('0x35')]=function(_0x413d42,_0x5f15a0){return db['ChatMessage'][_0x2db9('0x52')]({'where':{'id':_0x413d42[_0x2db9('0x4f')]['id']}})[_0x2db9('0x22')](handleEntityNotFound(_0x5f15a0,null))[_0x2db9('0x22')](removeEntity(_0x5f15a0,null))[_0x2db9('0x29')](handleError(_0x5f15a0,null));};exports['describe']=function(_0x2d9362,_0x27c3a0){return db[_0x2db9('0x4b')]['describe']()['then'](respondWithResult(_0x27c3a0,null))[_0x2db9('0x29')](handleError(_0x27c3a0,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports['accept']=function(_0x422773,_0x91a832,_0x27290f){var _0x170bc4={'agent':{},'channel':_0x2db9('0x55')};if(_0x422773['body']['id']){delete _0x422773[_0x2db9('0x54')]['id'];}_0x422773[_0x2db9('0x54')][_0x2db9('0x56')]=!![];_0x422773[_0x2db9('0x54')][_0x2db9('0x57')]=moment()[_0x2db9('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x422773[_0x2db9('0x54')][_0x2db9('0x59')]=_0x422773['body'][_0x2db9('0x59')]||_0x422773[_0x2db9('0x5a')]['id'];_0x170bc4[_0x2db9('0x5b')]['id']=_0x422773[_0x2db9('0x54')][_0x2db9('0x59')];return db[_0x2db9('0x4b')][_0x2db9('0x52')]({'where':{'id':_0x422773[_0x2db9('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x91a832,null))['then'](saveUpdates(_0x422773[_0x2db9('0x54')],null))['then'](function(_0x292962){if(_0x292962){_0x170bc4[_0x2db9('0x28')]=_0x292962[_0x2db9('0x5c')]({'plain':!![]});return db[_0x2db9('0x5d')]['find']({'where':{'id':_0x292962['ChatInteractionId']}});}return null;})[_0x2db9('0x22')](handleEntityNotFound(_0x91a832,null))['then'](function(_0x504f28){if(_0x504f28){return _0x504f28['update']({'UserId':_0x422773[_0x2db9('0x54')][_0x2db9('0x59')],'read1stAt':_[_0x2db9('0x5e')](_0x504f28['read1stAt'])?moment()[_0x2db9('0x58')](_0x2db9('0x5f')):undefined});}return null;})['then'](function(_0x46e855){if(_0x46e855){_0x170bc4[_0x2db9('0x60')]=_0x46e855['get']({'plain':!![]});interaction_log['info'](_0x2db9('0x61'),_0x422773[_0x2db9('0x5a')]['id'],_0x422773['user']['name'],_0x422773['user'][_0x2db9('0x62')],_0x170bc4[_0x2db9('0x60')]['id'],_0x422773['body']?JSON[_0x2db9('0x63')](_0x422773[_0x2db9('0x54')]):_0x2db9('0x64'));return respondWithRpcPromise(_0x2db9('0x65'),_0x2db9('0x66'),_0x170bc4);}return null;})['then'](function(_0x45be47){var _0x27852a=_0x2db9('0x67')+_0x45be47[_0x2db9('0x28')][_0x2db9('0x68')];return db['sequelize'][_0x2db9('0x3d')](_0x27852a,{'type':db[_0x2db9('0x69')][_0x2db9('0x6a')]['SELECT'],'raw':!![]})['then'](function(_0x552f70){return _0x552f70;});})[_0x2db9('0x22')](function(_0x8a1281){if(_0x8a1281){_0x170bc4[_0x2db9('0x28')][_0x2db9('0x6b')]=_0x8a1281[0x0];if(!_0x422773[_0x2db9('0x54')]['UserId'])return;return db[_0x2db9('0x6c')][_0x2db9('0x52')]({'where':{'id':_0x422773[_0x2db9('0x54')][_0x2db9('0x59')],'role':_0x2db9('0x5b')},'attributes':['id',_0x2db9('0x37'),_0x2db9('0x6d'),_0x2db9('0x6e'),_0x2db9('0x6f')],'raw':!![]});}return null;})[_0x2db9('0x22')](function(_0x2fd395){if(!_0x2fd395)return null;_0x170bc4[_0x2db9('0x28')][_0x2db9('0x5b')]=_0x2fd395;return _0x170bc4;})[_0x2db9('0x22')](function(_0x2dd0f7){if(_0x2dd0f7){if(_0x422773[_0x2db9('0x54')]['manual']){_0x170bc4[_0x2db9('0x28')][_0x2db9('0x70')]=util['format'](_0x2db9('0x71'),_0x422773['user'][_0x2db9('0x37')]);_0x170bc4[_0x2db9('0x28')][_0x2db9('0x72')]=_0x170bc4[_0x2db9('0x72')];_0x170bc4[_0x2db9('0x28')][_0x2db9('0x73')]=_0x170bc4[_0x2db9('0x72')];_0x170bc4[_0x2db9('0x28')][_0x2db9('0x74')]=_0x2db9('0x75');return respondWithRpcPromise(_0x2db9('0x76'),_0x2db9('0x76'),{'event':_0x2db9('0x77'),'message':_[_0x2db9('0x47')](_0x170bc4[_0x2db9('0x28')],JSON[_0x2db9('0x78')](_0x170bc4[_0x2db9('0x60')][_0x2db9('0x79')]))},client9002)[_0x2db9('0x22')](function(){return _0x170bc4;});}return _0x170bc4;}return null;})[_0x2db9('0x22')](respondWithResult(_0x91a832,null))[_0x2db9('0x29')](handleError(_0x91a832,null));};var interaction_log=require(_0x2db9('0x13'))(_0x2db9('0x7a'));exports[_0x2db9('0x33')]=function(_0x231aeb,_0x43a5f2,_0x295055){var _0x3c5c2c={'agent':{},'channel':'chat'};if(_0x231aeb['body']['id']){delete _0x231aeb['body']['id'];}_0x231aeb[_0x2db9('0x54')][_0x2db9('0x59')]=_0x231aeb[_0x2db9('0x54')][_0x2db9('0x59')]||_0x231aeb[_0x2db9('0x5a')]['id'];_0x3c5c2c['agent']['id']=_0x231aeb[_0x2db9('0x54')][_0x2db9('0x59')];return db[_0x2db9('0x4b')]['find']({'where':{'id':_0x231aeb[_0x2db9('0x4f')]['id'],'UserId':null}})[_0x2db9('0x22')](handleEntityNotFound(_0x43a5f2,null))[_0x2db9('0x22')](function(_0x443116){if(_0x443116){_0x3c5c2c[_0x2db9('0x28')]=_0x443116[_0x2db9('0x5c')]({'plain':!![]});return db[_0x2db9('0x5d')]['find']({'where':{'id':_0x443116[_0x2db9('0x7b')]}});}return null;})[_0x2db9('0x22')](handleEntityNotFound(_0x43a5f2,null))[_0x2db9('0x22')](function(_0x58484a){if(_0x58484a){_0x3c5c2c[_0x2db9('0x60')]=_0x58484a[_0x2db9('0x5c')]({'plain':!![]});interaction_log[_0x2db9('0x23')](_0x2db9('0x7c'),_0x231aeb[_0x2db9('0x5a')]['id'],_0x231aeb[_0x2db9('0x5a')]['name'],_0x231aeb[_0x2db9('0x5a')][_0x2db9('0x62')],_0x3c5c2c[_0x2db9('0x60')]['id'],_0x231aeb['body']?JSON[_0x2db9('0x63')](_0x231aeb[_0x2db9('0x54')]):_0x2db9('0x64'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x3c5c2c);}return null;})[_0x2db9('0x22')](function(_0x1d045c){var _0x1c189d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1d045c['message'][_0x2db9('0x68')];return db[_0x2db9('0x7d')][_0x2db9('0x3d')](_0x1c189d,{'type':db[_0x2db9('0x69')][_0x2db9('0x6a')][_0x2db9('0x7e')],'raw':!![]})[_0x2db9('0x22')](function(_0x1956ed){return _0x1956ed;});})['then'](function(_0x3a32ed){if(_0x3a32ed){_0x3c5c2c[_0x2db9('0x28')][_0x2db9('0x6b')]=_0x3a32ed[0x0];if(!_0x231aeb[_0x2db9('0x54')][_0x2db9('0x59')])return;return db[_0x2db9('0x6c')][_0x2db9('0x52')]({'where':{'id':_0x231aeb['body'][_0x2db9('0x59')],'role':_0x2db9('0x5b')},'attributes':['id','name',_0x2db9('0x6d'),_0x2db9('0x6e'),'internal'],'raw':!![]});}return null;})[_0x2db9('0x22')](function(_0x12d125){if(!_0x12d125)return null;_0x3c5c2c['message'][_0x2db9('0x5b')]=_0x12d125;return _0x3c5c2c;})[_0x2db9('0x22')](function(_0x16b4ed){if(_0x16b4ed){_0x16b4ed['message'][_0x2db9('0x70')]=util[_0x2db9('0x58')](_0x2db9('0x71'),_0x231aeb[_0x2db9('0x5a')][_0x2db9('0x37')]);_0x16b4ed[_0x2db9('0x28')]['channel']=_0x3c5c2c[_0x2db9('0x72')];_0x16b4ed[_0x2db9('0x28')][_0x2db9('0x73')]=_0x3c5c2c['channel'];_0x16b4ed[_0x2db9('0x28')][_0x2db9('0x74')]=_0x2db9('0x33');respondWithRpcPromise('EventManager',_0x2db9('0x76'),{'event':_0x2db9('0x7f'),'message':_[_0x2db9('0x47')](_0x3c5c2c[_0x2db9('0x28')],JSON[_0x2db9('0x78')](_0x3c5c2c[_0x2db9('0x60')][_0x2db9('0x79')]))},client9002);return _0x3c5c2c;}return null;})[_0x2db9('0x22')](respondWithResult(_0x43a5f2,null))[_0x2db9('0x29')](handleError(_0x43a5f2,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index c5c1ed7..60640ef 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 _0x4508=['update','remove','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x386525,_0xefae6){var _0x14d015=function(_0x4a45c1){while(--_0x4a45c1){_0x386525['push'](_0x386525['shift']());}};_0x14d015(++_0xefae6);}(_0x4508,0x1bb));var _0x8450=function(_0x265e12,_0x3fd9ff){_0x265e12=_0x265e12-0x0;var _0x54ae44=_0x4508[_0x265e12];return _0x54ae44;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x8450('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8450('0x1'),'afterDestroy':_0x8450('0x2')};function emitEvent(_0x23e5db){return function(_0x1cb0fc,_0x2c1c5a,_0x4fec01){ChatMessageEvents['emit'](_0x23e5db+':'+_0x1cb0fc['id'],_0x1cb0fc);ChatMessageEvents['emit'](_0x23e5db,_0x1cb0fc);_0x4fec01(null);};}for(var e in events){if(events[_0x8450('0x3')](e)){var event=events[e];ChatMessage[_0x8450('0x4')](e,emitEvent(event));}}module[_0x8450('0x5')]=ChatMessageEvents; \ No newline at end of file +var _0x5a01=['remove','emit','hasOwnProperty','exports','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x4d66de,_0x23bddf){var _0x242051=function(_0x3ff231){while(--_0x3ff231){_0x4d66de['push'](_0x4d66de['shift']());}};_0x242051(++_0x23bddf);}(_0x5a01,0x16c));var _0x15a0=function(_0x292f35,_0x72e859){_0x292f35=_0x292f35-0x0;var _0x288e75=_0x5a01[_0x292f35];return _0x288e75;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x15a0('0x0'))['db'][_0x15a0('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x15a0('0x2')](0x0);var events={'afterCreate':_0x15a0('0x3'),'afterUpdate':'update','afterDestroy':_0x15a0('0x4')};function emitEvent(_0x39d6bd){return function(_0x4b8c29,_0x5b2c17,_0x3fa065){ChatMessageEvents['emit'](_0x39d6bd+':'+_0x4b8c29['id'],_0x4b8c29);ChatMessageEvents[_0x15a0('0x5')](_0x39d6bd,_0x4b8c29);_0x3fa065(null);};}for(var e in events){if(events[_0x15a0('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x15a0('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index b24f1ac..a5ef69e 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 _0xedd9=['exports','ChatMessage','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xedd9,0xfc));var _0x9edd=function(_0x167e31,_0x56fa39){_0x167e31=_0x167e31-0x0;var _0x2ba47c=_0xedd9[_0x167e31];return _0x2ba47c;};'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':'chat_messages','paranoid':![],'indexes':[{'name':_0x9edd('0xb'),'fields':[_0x9edd('0xc')],'type':_0x9edd('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3280fd,_0x49d5e3,_0x494a24){var _0x5d2f90=_0x268f9e[_0x9edd('0xe')];var _0x138767=_0x3280fd['get']({'plain':!![]});if(_0x138767[_0x9edd('0xf')][_0x9edd('0x10')]()==='in'||_0x138767['direction'][_0x9edd('0x10')]()===_0x9edd('0x11')&&!_0x138767[_0x9edd('0x12')]&&!_[_0x9edd('0x13')](_0x138767[_0x9edd('0x14')])){_0x5d2f90[_0x9edd('0x15')][_0x9edd('0x16')]({'where':{'id':_0x138767[_0x9edd('0x17')]}})['then'](function(_0x176bfa){if(_0x176bfa){_0x176bfa[_0x9edd('0x18')]({'lastMsgAt':_0x138767[_0x9edd('0x19')],'lastMsgDirection':_0x138767[_0x9edd('0xf')][_0x9edd('0x10')]()});}})[_0x9edd('0x1a')](function(_0x1042aa){console[_0x9edd('0x1b')](_0x1042aa);});}_0x494a24();}},'charset':'utf8mb4','collate':_0x9edd('0x1c')});}; \ No newline at end of file +var _0xb155=['findOne','ChatInteractionId','createdAt','catch','error','utf8mb4','lodash','api','moment','../../config/environment','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','ChatInteraction'];(function(_0x3a52c4,_0x19babd){var _0x366b56=function(_0x153154){while(--_0x153154){_0x3a52c4['push'](_0x3a52c4['shift']());}};_0x366b56(++_0x19babd);}(_0xb155,0x186));var _0x5b15=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0xb155[_0x3fb9dd];return _0x20136a;};'use strict';var _=require(_0x5b15('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5b15('0x1'));var moment=require(_0x5b15('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5b15('0x3'));var attributes=require('./chatMessage.attributes');module[_0x5b15('0x4')]=function(_0x29e36c,_0x45c2b1){return _0x29e36c[_0x5b15('0x5')](_0x5b15('0x6'),attributes,{'tableName':_0x5b15('0x7'),'paranoid':![],'indexes':[{'name':_0x5b15('0x8'),'fields':[_0x5b15('0x9')],'type':_0x5b15('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x348264,_0x1ced35,_0x4c0352){var _0x1ea858=_0x29e36c[_0x5b15('0xb')];var _0x218de2=_0x348264[_0x5b15('0xc')]({'plain':!![]});if(_0x218de2[_0x5b15('0xd')]['toLowerCase']()==='in'||_0x218de2['direction'][_0x5b15('0xe')]()==='out'&&!_0x218de2['secret']&&!_[_0x5b15('0xf')](_0x218de2[_0x5b15('0x10')])){_0x1ea858[_0x5b15('0x11')][_0x5b15('0x12')]({'where':{'id':_0x218de2[_0x5b15('0x13')]}})['then'](function(_0x5bdb84){if(_0x5bdb84){_0x5bdb84['update']({'lastMsgAt':_0x218de2[_0x5b15('0x14')],'lastMsgDirection':_0x218de2[_0x5b15('0xd')]['toLowerCase']()});}})[_0x5b15('0x15')](function(_0x5ccc75){console[_0x5b15('0x16')](_0x5ccc75);});}_0x4c0352();}},'charset':_0x5b15('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 2822186..b731922 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 _0xf4de=['../../config/environment','client','http','redis','defaults','localhost','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ChatMessage','options','raw','CreateChatMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2a37ed,_0x57174f){var _0x536fdc=function(_0x47b8e1){while(--_0x47b8e1){_0x2a37ed['push'](_0x2a37ed['shift']());}};_0x536fdc(++_0x57174f);}(_0xf4de,0x160));var _0xef4d=function(_0x4e5298,_0x3cbf79){_0x4e5298=_0x4e5298-0x0;var _0x40184d=_0xf4de[_0x4e5298];return _0x40184d;};'use strict';var _=require(_0xef4d('0x0'));var util=require('util');var moment=require(_0xef4d('0x1'));var BPromise=require(_0xef4d('0x2'));var rs=require(_0xef4d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef4d('0x4'))['db'];var utils=require(_0xef4d('0x5'));var logger=require(_0xef4d('0x6'))(_0xef4d('0x7'));var config=require(_0xef4d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xef4d('0x9')][_0xef4d('0xa')]({'port':0x232a});config[_0xef4d('0xb')]=_[_0xef4d('0xc')](config['redis'],{'host':_0xef4d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef4d('0xb')]));require(_0xef4d('0xe'))['register'](socket);function respondWithRpcPromise(_0x3d883a,_0x2f382d,_0x30f61f){return new BPromise(function(_0x2c70c3,_0x1a8243){return client[_0xef4d('0xf')](_0x3d883a,_0x30f61f)[_0xef4d('0x10')](function(_0x42e37a){logger[_0xef4d('0x11')](_0xef4d('0x12'),_0x2f382d,_0xef4d('0x13'));logger[_0xef4d('0x14')](_0xef4d('0x15'),_0x2f382d,_0xef4d('0x13'),JSON[_0xef4d('0x16')](_0x42e37a));if(_0x42e37a[_0xef4d('0x17')]){if(_0x42e37a[_0xef4d('0x17')]['code']===0x1f4){logger[_0xef4d('0x17')](_0xef4d('0x12'),_0x2f382d,_0x42e37a[_0xef4d('0x17')][_0xef4d('0x18')]);return _0x1a8243(_0x42e37a[_0xef4d('0x17')][_0xef4d('0x18')]);}logger[_0xef4d('0x17')](_0xef4d('0x12'),_0x2f382d,_0x42e37a[_0xef4d('0x17')][_0xef4d('0x18')]);return _0x2c70c3(_0x42e37a[_0xef4d('0x17')]['message']);}else{logger['info'](_0xef4d('0x12'),_0x2f382d,_0xef4d('0x13'));_0x2c70c3(_0x42e37a['result'][_0xef4d('0x18')]);}})[_0xef4d('0x19')](function(_0x32ae38){logger[_0xef4d('0x17')](_0xef4d('0x12'),_0x2f382d,_0x32ae38);_0x1a8243(_0x32ae38);});});}exports['CreateChatMessage']=function(_0x2dc5b2){var _0x11c2ff=this;return new Promise(function(_0xc87aa8,_0x11e6e8){return db[_0xef4d('0x1a')]['create'](_0x2dc5b2['body'],{'raw':_0x2dc5b2[_0xef4d('0x1b')]?_0x2dc5b2[_0xef4d('0x1b')][_0xef4d('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x1c0878){logger[_0xef4d('0x11')](_0xef4d('0x1d'),_0x2dc5b2);logger['debug'](_0xef4d('0x1d'),_0x2dc5b2,JSON[_0xef4d('0x16')](_0x1c0878));_0xc87aa8(_0x1c0878);})[_0xef4d('0x19')](function(_0x567206){logger[_0xef4d('0x17')]('CreateChatMessage',_0x567206['message'],_0x2dc5b2);_0x11e6e8(_0x11c2ff[_0xef4d('0x17')](0x1f4,_0x567206[_0xef4d('0x18')]));});});}; \ No newline at end of file +var _0xb1eb=['catch','options','raw','then','info','CreateChatMessage','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','request','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','ChatMessage,\x20%s,\x20%s','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb1eb,0x10c));var _0xbb1e=function(_0x4b4eca,_0xb2831c){_0x4b4eca=_0x4b4eca-0x0;var _0x3005f8=_0xb1eb[_0x4b4eca];return _0x3005f8;};'use strict';var _=require(_0xbb1e('0x0'));var util=require('util');var moment=require(_0xbb1e('0x1'));var BPromise=require(_0xbb1e('0x2'));var rs=require(_0xbb1e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb1e('0x4'))['db'];var utils=require(_0xbb1e('0x5'));var logger=require(_0xbb1e('0x6'))('rpc');var config=require(_0xbb1e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbb1e('0x8')][_0xbb1e('0x9')]({'port':0x232a});config['redis']=_[_0xbb1e('0xa')](config[_0xbb1e('0xb')],{'host':_0xbb1e('0xc'),'port':0x18eb});var socket=require(_0xbb1e('0xd'))(new Redis(config['redis']));require(_0xbb1e('0xe'))['register'](socket);function respondWithRpcPromise(_0x4dec6b,_0x4a07ca,_0x5dba6a){return new BPromise(function(_0x1fc7c3,_0x2fb014){return client[_0xbb1e('0xf')](_0x4dec6b,_0x5dba6a)['then'](function(_0x49e4e1){logger['info']('ChatMessage,\x20%s,\x20%s',_0x4a07ca,'request\x20sent');logger[_0xbb1e('0x10')](_0xbb1e('0x11'),_0x4a07ca,_0xbb1e('0x12'),JSON['stringify'](_0x49e4e1));if(_0x49e4e1[_0xbb1e('0x13')]){if(_0x49e4e1['error']['code']===0x1f4){logger[_0xbb1e('0x13')](_0xbb1e('0x14'),_0x4a07ca,_0x49e4e1[_0xbb1e('0x13')][_0xbb1e('0x15')]);return _0x2fb014(_0x49e4e1[_0xbb1e('0x13')]['message']);}logger[_0xbb1e('0x13')](_0xbb1e('0x14'),_0x4a07ca,_0x49e4e1[_0xbb1e('0x13')]['message']);return _0x1fc7c3(_0x49e4e1[_0xbb1e('0x13')]['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x4a07ca,_0xbb1e('0x12'));_0x1fc7c3(_0x49e4e1['result'][_0xbb1e('0x15')]);}})[_0xbb1e('0x16')](function(_0x36c254){logger[_0xbb1e('0x13')]('ChatMessage,\x20%s,\x20%s',_0x4a07ca,_0x36c254);_0x2fb014(_0x36c254);});});}exports['CreateChatMessage']=function(_0x6bce27){var _0x17ee48=this;return new Promise(function(_0x31b7d4,_0x135117){return db['ChatMessage']['create'](_0x6bce27['body'],{'raw':_0x6bce27[_0xbb1e('0x17')]?_0x6bce27[_0xbb1e('0x17')][_0xbb1e('0x18')]===undefined?!![]:![]:!![]})[_0xbb1e('0x19')](function(_0x181e99){logger[_0xbb1e('0x1a')](_0xbb1e('0x1b'),_0x6bce27);logger['debug'](_0xbb1e('0x1b'),_0x6bce27,JSON[_0xbb1e('0x1c')](_0x181e99));_0x31b7d4(_0x181e99);})['catch'](function(_0x453bc3){logger[_0xbb1e('0x13')](_0xbb1e('0x1b'),_0x453bc3[_0xbb1e('0x15')],_0x6bce27);_0x135117(_0x17ee48[_0xbb1e('0x13')](0x1f4,_0x453bc3[_0xbb1e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 27534cb..76bde96 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 _0x3645=['emit','removeListener','register','length','save','remove','update'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x3645,0x154));var _0x5364=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x3645[_0x3fb030];return _0xd6899b;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x5364('0x0'),_0x5364('0x1'),_0x5364('0x2')];function createListener(_0x28eafb,_0x2d71d7){return function(_0x2f629b){_0x2d71d7[_0x5364('0x3')](_0x28eafb,_0x2f629b);};}function removeListener(_0x5a63bf,_0x334a16){return function(){ChatMessageEvents[_0x5364('0x4')](_0x5a63bf,_0x334a16);};}exports[_0x5364('0x5')]=function(_0x1f9c6b){for(var _0x417c44=0x0,_0x7933a5=events[_0x5364('0x6')];_0x417c44<_0x7933a5;_0x417c44++){var _0x43fb3f=events[_0x417c44];var _0x3c1b21=createListener('chatMessage:'+_0x43fb3f,_0x1f9c6b);ChatMessageEvents['on'](_0x43fb3f,_0x3c1b21);}}; \ No newline at end of file +var _0x5455=['remove','update','emit','removeListener','register','length','chatMessage:','save'];(function(_0x29889a,_0x2dd2ea){var _0x1b95ca=function(_0x167ad8){while(--_0x167ad8){_0x29889a['push'](_0x29889a['shift']());}};_0x1b95ca(++_0x2dd2ea);}(_0x5455,0x197));var _0x5545=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5455[_0xfae23b];return _0x200640;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x5545('0x0'),_0x5545('0x1'),_0x5545('0x2')];function createListener(_0x414d1c,_0xba68b3){return function(_0x38b608){_0xba68b3[_0x5545('0x3')](_0x414d1c,_0x38b608);};}function removeListener(_0x4cd466,_0x48fce5){return function(){ChatMessageEvents[_0x5545('0x4')](_0x4cd466,_0x48fce5);};}exports[_0x5545('0x5')]=function(_0x5c22f1){for(var _0x5a6ac7=0x0,_0x2ea57f=events[_0x5545('0x6')];_0x5a6ac7<_0x2ea57f;_0x5a6ac7++){var _0x5c2476=events[_0x5a6ac7];var _0x9cbb0d=createListener(_0x5545('0x7')+_0x5c2476,_0x5c22f1);ChatMessageEvents['on'](_0x5c2476,_0x9cbb0d);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 6e454c8..684e93b 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 _0x4782=['reject','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x822282,_0x56c940){var _0x5b982f=function(_0x2b2fe7){while(--_0x2b2fe7){_0x822282['push'](_0x822282['shift']());}};_0x5b982f(++_0x56c940);}(_0x4782,0x1e9));var _0x2478=function(_0x1c3166,_0x25a4b){_0x1c3166=_0x1c3166-0x0;var _0x13a19f=_0x4782[_0x1c3166];return _0x13a19f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2478('0x0'));var timeout=require(_0x2478('0x1'));var express=require(_0x2478('0x2'));var router=express[_0x2478('0x3')]();var fs_extra=require(_0x2478('0x4'));var auth=require(_0x2478('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2478('0x6'));var controller=require(_0x2478('0x7'));router[_0x2478('0x8')]('/',auth[_0x2478('0x9')](),controller[_0x2478('0xa')]);router[_0x2478('0x8')](_0x2478('0xb'),auth[_0x2478('0x9')](),controller[_0x2478('0xc')]);router[_0x2478('0x8')](_0x2478('0xd'),auth[_0x2478('0x9')](),controller['show']);router[_0x2478('0xe')]('/',auth[_0x2478('0x9')](),interaction[_0x2478('0xf')](_0x2478('0x10'),_0x2478('0x11')),controller[_0x2478('0x12')]);router[_0x2478('0x13')](_0x2478('0xd'),controller[_0x2478('0x14')]);router[_0x2478('0x13')](_0x2478('0x15'),auth[_0x2478('0x9')](),controller[_0x2478('0x16')]);router['put'](_0x2478('0x17'),auth[_0x2478('0x9')](),controller[_0x2478('0x18')]);router[_0x2478('0x19')](_0x2478('0xd'),auth[_0x2478('0x9')](),controller['destroy']);module[_0x2478('0x1a')]=router; \ No newline at end of file +var _0x89cb=['accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','post','chat','chatmessage:create','create','put','update'];(function(_0x4fee41,_0x2a1b3b){var _0x35a6d1=function(_0xa5a5d9){while(--_0xa5a5d9){_0x4fee41['push'](_0x4fee41['shift']());}};_0x35a6d1(++_0x2a1b3b);}(_0x89cb,0x158));var _0xb89c=function(_0x15802c,_0x240be6){_0x15802c=_0x15802c-0x0;var _0x33d406=_0x89cb[_0x15802c];return _0x33d406;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb89c('0x0'));var timeout=require(_0xb89c('0x1'));var express=require(_0xb89c('0x2'));var router=express[_0xb89c('0x3')]();var fs_extra=require(_0xb89c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb89c('0x5'));var config=require(_0xb89c('0x6'));var controller=require(_0xb89c('0x7'));router['get']('/',auth[_0xb89c('0x8')](),controller[_0xb89c('0x9')]);router[_0xb89c('0xa')](_0xb89c('0xb'),auth[_0xb89c('0x8')](),controller[_0xb89c('0xc')]);router[_0xb89c('0xa')](_0xb89c('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xb89c('0xe')]('/',auth[_0xb89c('0x8')](),interaction['tracked'](_0xb89c('0xf'),_0xb89c('0x10')),controller[_0xb89c('0x11')]);router[_0xb89c('0x12')](_0xb89c('0xd'),controller[_0xb89c('0x13')]);router[_0xb89c('0x12')]('/:id/accept',auth[_0xb89c('0x8')](),controller[_0xb89c('0x14')]);router[_0xb89c('0x12')](_0xb89c('0x15'),auth[_0xb89c('0x8')](),controller[_0xb89c('0x16')]);router[_0xb89c('0x17')](_0xb89c('0xd'),auth[_0xb89c('0x8')](),controller[_0xb89c('0x18')]);module[_0xb89c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 756025c..56e02a7 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 _0x7d3d=['sequelize','exports'];(function(_0x3e2292,_0x54f827){var _0x26da7c=function(_0x3ff754){while(--_0x3ff754){_0x3e2292['push'](_0x3e2292['shift']());}};_0x26da7c(++_0x54f827);}(_0x7d3d,0x1aa));var _0xd7d3=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0x7d3d[_0x25fa5c];return _0x1bade2;};'use strict';var Sequelize=require(_0xd7d3('0x0'));module[_0xd7d3('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file +var _0xc179=['medium','exports','TEXT'];(function(_0x20ce67,_0x28288f){var _0x463156=function(_0x5b2aac){while(--_0x5b2aac){_0x20ce67['push'](_0x20ce67['shift']());}};_0x463156(++_0x28288f);}(_0xc179,0x7c));var _0x9c17=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0xc179[_0x4b5813];return _0x423465;};'use strict';var Sequelize=require('sequelize');module[_0x9c17('0x0')]={'body':{'type':Sequelize[_0x9c17('0x1')](_0x9c17('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 1bd05da..83d55ca 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(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x7a54,0x106));var _0x47a5=function(_0x446c4e,_0x11eb91){_0x446c4e=_0x446c4e-0x0;var _0x5cbdfb=_0x7a54[_0x446c4e];return _0x5cbdfb;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x7a54,0x106));var _0x47a5=function(_0x21a4c6,_0x24d392){_0x21a4c6=_0x21a4c6-0x0;var _0x4ea916=_0x7a54[_0x21a4c6];return _0x4ea916;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index a012566..7aed28d 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 _0x600a=['../../config/environment','utf8mb4','utf8mb4_unicode_ci','util','moment','request-promise'];(function(_0x39fa89,_0x51c384){var _0x24bc06=function(_0x1ee395){while(--_0x1ee395){_0x39fa89['push'](_0x39fa89['shift']());}};_0x24bc06(++_0x51c384);}(_0x600a,0x177));var _0xa600=function(_0x29a29f,_0x155ce7){_0x29a29f=_0x29a29f-0x0;var _0x443ea3=_0x600a[_0x29a29f];return _0x443ea3;};'use strict';var _=require('lodash');var util=require(_0xa600('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa600('0x1'));var BPromise=require('bluebird');var rp=require(_0xa600('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa600('0x3'));var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x478e63,_0x7518d4){return _0x478e63['define']('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa600('0x4'),'collate':_0xa600('0x5')});}; \ No newline at end of file +var _0x3125=['../../config/environment','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2c5f00,_0x3558ec){var _0x36ddd4=function(_0x42d5ab){while(--_0x42d5ab){_0x2c5f00['push'](_0x2c5f00['shift']());}};_0x36ddd4(++_0x3558ec);}(_0x3125,0xa2));var _0x5312=function(_0x2136ae,_0x17766d){_0x2136ae=_0x2136ae-0x0;var _0x53579e=_0x3125[_0x2136ae];return _0x53579e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5312('0x0'))(_0x5312('0x1'));var moment=require('moment');var BPromise=require(_0x5312('0x2'));var rp=require(_0x5312('0x3'));var fs=require('fs');var path=require(_0x5312('0x4'));var rimraf=require(_0x5312('0x5'));var config=require(_0x5312('0x6'));var attributes=require('./chatOfflineMessage.attributes');module[_0x5312('0x7')]=function(_0x167129,_0x335765){return _0x167129[_0x5312('0x8')](_0x5312('0x9'),attributes,{'tableName':_0x5312('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5312('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index ed7656f..04ab866 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 _0xb000=['message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xb000,0x1a7));var _0x0b00=function(_0x21205e,_0x7eb8e7){_0x21205e=_0x21205e-0x0;var _0x136ebb=_0xb000[_0x21205e];return _0x136ebb;};'use strict';var _=require(_0x0b00('0x0'));var util=require('util');var moment=require(_0x0b00('0x1'));var BPromise=require(_0x0b00('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b00('0x3'));var db=require(_0x0b00('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0b00('0x5'));var config=require(_0x0b00('0x6'));var jayson=require(_0x0b00('0x7'));var client=jayson[_0x0b00('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24f76b,_0x37bd48,_0x1b4523){return new BPromise(function(_0x34fabe,_0x5145af){return client['request'](_0x24f76b,_0x1b4523)[_0x0b00('0x9')](function(_0x19d76b){logger[_0x0b00('0xa')](_0x0b00('0xb'),_0x37bd48,'request\x20sent');logger[_0x0b00('0xc')](_0x0b00('0xd'),_0x37bd48,_0x0b00('0xe'),JSON[_0x0b00('0xf')](_0x19d76b));if(_0x19d76b[_0x0b00('0x10')]){if(_0x19d76b[_0x0b00('0x10')][_0x0b00('0x11')]===0x1f4){logger['error'](_0x0b00('0xb'),_0x37bd48,_0x19d76b[_0x0b00('0x10')][_0x0b00('0x12')]);return _0x5145af(_0x19d76b['error'][_0x0b00('0x12')]);}logger[_0x0b00('0x10')](_0x0b00('0xb'),_0x37bd48,_0x19d76b[_0x0b00('0x10')][_0x0b00('0x12')]);return _0x34fabe(_0x19d76b[_0x0b00('0x10')][_0x0b00('0x12')]);}else{logger[_0x0b00('0xa')](_0x0b00('0xb'),_0x37bd48,_0x0b00('0xe'));_0x34fabe(_0x19d76b[_0x0b00('0x13')][_0x0b00('0x12')]);}})[_0x0b00('0x14')](function(_0x1aca85){logger[_0x0b00('0x10')](_0x0b00('0xb'),_0x37bd48,_0x1aca85);_0x5145af(_0x1aca85);});});} \ No newline at end of file +var _0x5502=['request\x20sent','debug','code','message','error','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5502,0x10b));var _0x2550=function(_0x8ef5f0,_0x11a1b3){_0x8ef5f0=_0x8ef5f0-0x0;var _0xe276a9=_0x5502[_0x8ef5f0];return _0xe276a9;};'use strict';var _=require(_0x2550('0x0'));var util=require(_0x2550('0x1'));var moment=require(_0x2550('0x2'));var BPromise=require(_0x2550('0x3'));var rs=require(_0x2550('0x4'));var fs=require('fs');var Redis=require(_0x2550('0x5'));var db=require(_0x2550('0x6'))['db'];var utils=require(_0x2550('0x7'));var logger=require(_0x2550('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2550('0x9'));var client=jayson['client'][_0x2550('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40f108,_0x251b47,_0xa31805){return new BPromise(function(_0x1e4255,_0x2decd3){return client['request'](_0x40f108,_0xa31805)[_0x2550('0xb')](function(_0x9b0c02){logger['info'](_0x2550('0xc'),_0x251b47,_0x2550('0xd'));logger[_0x2550('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x251b47,_0x2550('0xd'),JSON['stringify'](_0x9b0c02));if(_0x9b0c02['error']){if(_0x9b0c02['error'][_0x2550('0xf')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x251b47,_0x9b0c02['error'][_0x2550('0x10')]);return _0x2decd3(_0x9b0c02[_0x2550('0x11')][_0x2550('0x10')]);}logger[_0x2550('0x11')](_0x2550('0xc'),_0x251b47,_0x9b0c02[_0x2550('0x11')][_0x2550('0x10')]);return _0x1e4255(_0x9b0c02[_0x2550('0x11')][_0x2550('0x10')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x251b47,_0x2550('0xd'));_0x1e4255(_0x9b0c02[_0x2550('0x12')][_0x2550('0x10')]);}})[_0x2550('0x13')](function(_0x3dcbee){logger[_0x2550('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x251b47,_0x3dcbee);_0x2decd3(_0x3dcbee);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 0830a67..884cdee 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 _0xc435=['index','/describe','describe','get','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated'];(function(_0x4e6141,_0x2f1516){var _0x398b49=function(_0x356727){while(--_0x356727){_0x4e6141['push'](_0x4e6141['shift']());}};_0x398b49(++_0x2f1516);}(_0xc435,0x1da));var _0x5c43=function(_0x4ed8bf,_0x53a94f){_0x4ed8bf=_0x4ed8bf-0x0;var _0x130e32=_0xc435[_0x4ed8bf];return _0x130e32;};'use strict';var multer=require(_0x5c43('0x0'));var util=require('util');var path=require(_0x5c43('0x1'));var timeout=require(_0x5c43('0x2'));var express=require('express');var router=express[_0x5c43('0x3')]();var fs_extra=require(_0x5c43('0x4'));var auth=require(_0x5c43('0x5'));var interaction=require(_0x5c43('0x6'));var config=require(_0x5c43('0x7'));var controller=require(_0x5c43('0x8'));router['get']('/',auth[_0x5c43('0x9')](),controller[_0x5c43('0xa')]);router['get'](_0x5c43('0xb'),auth['isAuthenticated'](),controller[_0x5c43('0xc')]);router[_0x5c43('0xd')](_0x5c43('0xe'),auth[_0x5c43('0x9')](),controller[_0x5c43('0xf')]);router[_0x5c43('0x10')]('/',auth['isAuthenticated'](),controller[_0x5c43('0x11')]);router[_0x5c43('0x12')]('/:id',auth[_0x5c43('0x9')](),controller[_0x5c43('0x13')]);router['delete']('/:id',auth[_0x5c43('0x9')](),controller[_0x5c43('0x14')]);module[_0x5c43('0x15')]=router; \ No newline at end of file +var _0xe605=['index','/describe','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated'];(function(_0x5dbf6a,_0x11391b){var _0x3cb7d9=function(_0x28fd5c){while(--_0x28fd5c){_0x5dbf6a['push'](_0x5dbf6a['shift']());}};_0x3cb7d9(++_0x11391b);}(_0xe605,0x1ee));var _0x5e60=function(_0x4060ff,_0x36c553){_0x4060ff=_0x4060ff-0x0;var _0x254af3=_0xe605[_0x4060ff];return _0x254af3;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require(_0x5e60('0x2'));var timeout=require(_0x5e60('0x3'));var express=require(_0x5e60('0x4'));var router=express[_0x5e60('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')](_0x5e60('0xd'),auth[_0x5e60('0xb')](),controller[_0x5e60('0xe')]);router[_0x5e60('0xa')]('/:id',auth[_0x5e60('0xb')](),controller[_0x5e60('0xf')]);router['post']('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0x10')]);router[_0x5e60('0x11')](_0x5e60('0x12'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x13')]);router[_0x5e60('0x14')](_0x5e60('0x12'),auth['isAuthenticated'](),controller[_0x5e60('0x15')]);module[_0x5e60('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index f062c98..c3ddf17 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 _0x58c6=['sequelize','ENUM','mouseOver','timeout','INTEGER'];(function(_0x4968bc,_0x73ac39){var _0x1bb23f=function(_0x514490){while(--_0x514490){_0x4968bc['push'](_0x4968bc['shift']());}};_0x1bb23f(++_0x73ac39);}(_0x58c6,0xd7));var _0x658c=function(_0x21c130,_0x225833){_0x21c130=_0x21c130-0x0;var _0x58f574=_0x58c6[_0x21c130];return _0x58f574;};'use strict';var Sequelize=require(_0x658c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x658c('0x1')](_0x658c('0x2'),_0x658c('0x3')),'defaultValue':_0x658c('0x2')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x658c('0x4')]}}; \ No newline at end of file +var _0x7931=['STRING','ENUM','timeout','mouseOver','sequelize'];(function(_0x31038b,_0x3ac1c9){var _0x1c9d3c=function(_0xe00e97){while(--_0xe00e97){_0x31038b['push'](_0x31038b['shift']());}};_0x1c9d3c(++_0x3ac1c9);}(_0x7931,0xe5));var _0x1793=function(_0x1eae3d,_0x4567dd){_0x1eae3d=_0x1eae3d-0x0;var _0x30ed39=_0x7931[_0x1eae3d];return _0x30ed39;};'use strict';var Sequelize=require(_0x1793('0x0'));module['exports']={'name':{'type':Sequelize[_0x1793('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1793('0x2')]('mouseOver',_0x1793('0x3')),'defaultValue':_0x1793('0x4')},'selector':{'type':Sequelize[_0x1793('0x1')]},'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 a06639f..890ca3c 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 _0xa1aa=['ChatProactiveAction','find','create','body','catch','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options'];(function(_0x128d68,_0x555a32){var _0x24ad4d=function(_0x101a3a){while(--_0x101a3a){_0x128d68['push'](_0x128d68['shift']());}};_0x24ad4d(++_0x555a32);}(_0xa1aa,0x88));var _0xaa1a=function(_0xd1c706,_0x16139a){_0xd1c706=_0xd1c706-0x0;var _0x3872b6=_0xa1aa[_0xd1c706];return _0x3872b6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaa1a('0x0'));var jsonpatch=require(_0xaa1a('0x1'));var rp=require(_0xaa1a('0x2'));var moment=require(_0xaa1a('0x3'));var BPromise=require(_0xaa1a('0x4'));var Mustache=require(_0xaa1a('0x5'));var util=require(_0xaa1a('0x6'));var path=require('path');var sox=require(_0xaa1a('0x7'));var csv=require(_0xaa1a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa1a('0x9'));var _=require(_0xaa1a('0xa'));var squel=require(_0xaa1a('0xb'));var crypto=require(_0xaa1a('0xc'));var jsforce=require(_0xaa1a('0xd'));var deskjs=require(_0xaa1a('0xe'));var toCsv=require(_0xaa1a('0x8'));var querystring=require(_0xaa1a('0xf'));var Papa=require(_0xaa1a('0x10'));var Redis=require('ioredis');var authService=require(_0xaa1a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaa1a('0x12'));var hardwareService=require(_0xaa1a('0x13'));var logger=require(_0xaa1a('0x14'))(_0xaa1a('0x15'));var utils=require(_0xaa1a('0x16'));var config=require(_0xaa1a('0x17'));var licenseUtil=require(_0xaa1a('0x18'));var db=require(_0xaa1a('0x19'))['db'];function respondWithStatusCode(_0x41640e,_0x136e90){_0x136e90=_0x136e90||0xcc;return function(_0x3feb49){if(_0x3feb49){return _0x41640e['sendStatus'](_0x136e90);}return _0x41640e['status'](_0x136e90)[_0xaa1a('0x1a')]();};}function respondWithResult(_0x3b211d,_0x30afd5){_0x30afd5=_0x30afd5||0xc8;return function(_0xa6e170){if(_0xa6e170){return _0x3b211d[_0xaa1a('0x1b')](_0x30afd5)[_0xaa1a('0x1c')](_0xa6e170);}};}function respondWithFilteredResult(_0x5ea190,_0x332733){return function(_0x2db211){if(_0x2db211){var _0x4c2720=typeof _0x332733[_0xaa1a('0x1d')]==='undefined'&&typeof _0x332733['limit']===_0xaa1a('0x1e');var _0x3bb7c9=_0x2db211[_0xaa1a('0x1f')];var _0x123ab4=_0x4c2720?0x0:_0x332733[_0xaa1a('0x1d')];var _0x35e9d5=_0x4c2720?_0x2db211[_0xaa1a('0x1f')]:_0x332733[_0xaa1a('0x1d')]+_0x332733[_0xaa1a('0x20')];var _0x8f7377;if(_0x35e9d5>=_0x3bb7c9){_0x35e9d5=_0x3bb7c9;_0x8f7377=0xc8;}else{_0x8f7377=0xce;}_0x5ea190['status'](_0x8f7377);return _0x5ea190[_0xaa1a('0x21')](_0xaa1a('0x22'),_0x123ab4+'-'+_0x35e9d5+'/'+_0x3bb7c9)[_0xaa1a('0x1c')](_0x2db211);}return null;};}function patchUpdates(_0x2558a8){return function(_0x436551){try{jsonpatch[_0xaa1a('0x23')](_0x436551,_0x2558a8,!![]);}catch(_0x299b10){return BPromise[_0xaa1a('0x24')](_0x299b10);}return _0x436551['save']();};}function saveUpdates(_0x45570b,_0x412e4f){return function(_0x2a362c){if(_0x2a362c){return _0x2a362c[_0xaa1a('0x25')](_0x45570b)[_0xaa1a('0x26')](function(_0xff4914){return _0xff4914;});}return null;};}function removeEntity(_0x11a0f6,_0x221409){return function(_0x4629c1){if(_0x4629c1){return _0x4629c1['destroy']()[_0xaa1a('0x26')](function(){_0x11a0f6['status'](0xcc)[_0xaa1a('0x1a')]();});}};}function handleEntityNotFound(_0x408773,_0xac2c7d){return function(_0x15fb61){if(!_0x15fb61){_0x408773[_0xaa1a('0x27')](0x194);}return _0x15fb61;};}function handleError(_0xf45b27,_0x16b90c){_0x16b90c=_0x16b90c||0x1f4;return function(_0x5523fa){logger[_0xaa1a('0x28')](_0x5523fa[_0xaa1a('0x29')]);if(_0x5523fa['name']){delete _0x5523fa[_0xaa1a('0x2a')];}_0xf45b27['status'](_0x16b90c)[_0xaa1a('0x2b')](_0x5523fa);};}exports[_0xaa1a('0x2c')]=function(_0xd2360d,_0x572eef){var _0x20d5c0={'raw':!![],'where':{'id':_0xd2360d[_0xaa1a('0x2d')]['id']}},_0x2de205={};_0x2de205[_0xaa1a('0x2e')]=_['keys'](db['ChatProactiveAction'][_0xaa1a('0x2f')]);_0x2de205[_0xaa1a('0x30')]=_[_0xaa1a('0x31')](_0xd2360d[_0xaa1a('0x30')]);_0x2de205[_0xaa1a('0x32')]=_[_0xaa1a('0x33')](_0x2de205['model'],_0x2de205['query']);_0x20d5c0[_0xaa1a('0x34')]=_[_0xaa1a('0x33')](_0x2de205[_0xaa1a('0x2e')],qs[_0xaa1a('0x35')](_0xd2360d[_0xaa1a('0x30')][_0xaa1a('0x35')]));_0x20d5c0['attributes']=_0x20d5c0[_0xaa1a('0x34')][_0xaa1a('0x36')]?_0x20d5c0[_0xaa1a('0x34')]:_0x2de205[_0xaa1a('0x2e')];if(_0xd2360d[_0xaa1a('0x30')][_0xaa1a('0x37')]){_0x20d5c0[_0xaa1a('0x38')]=[{'all':!![]}];}_0x20d5c0=_[_0xaa1a('0x39')]({},_0x20d5c0,_0xd2360d[_0xaa1a('0x3a')]);return db[_0xaa1a('0x3b')][_0xaa1a('0x3c')](_0x20d5c0)['then'](handleEntityNotFound(_0x572eef,null))[_0xaa1a('0x26')](respondWithResult(_0x572eef,null))['catch'](handleError(_0x572eef,null));};exports[_0xaa1a('0x3d')]=function(_0x1231f6,_0x56dcb6){return db[_0xaa1a('0x3b')][_0xaa1a('0x3d')](_0x1231f6[_0xaa1a('0x3e')],{})['then'](respondWithResult(_0x56dcb6,0xc9))[_0xaa1a('0x3f')](handleError(_0x56dcb6,null));};exports[_0xaa1a('0x25')]=function(_0x340ce5,_0x251637){if(_0x340ce5[_0xaa1a('0x3e')]['id']){delete _0x340ce5[_0xaa1a('0x3e')]['id'];}return db[_0xaa1a('0x3b')]['find']({'where':{'id':_0x340ce5[_0xaa1a('0x2d')]['id']}})['then'](handleEntityNotFound(_0x251637,null))[_0xaa1a('0x26')](saveUpdates(_0x340ce5[_0xaa1a('0x3e')],null))['then'](respondWithResult(_0x251637,null))[_0xaa1a('0x3f')](handleError(_0x251637,null));};exports[_0xaa1a('0x40')]=function(_0x39e871,_0xe52233){return db[_0xaa1a('0x3b')][_0xaa1a('0x3c')]({'where':{'id':_0x39e871[_0xaa1a('0x2d')]['id']}})[_0xaa1a('0x26')](handleEntityNotFound(_0xe52233,null))[_0xaa1a('0x26')](removeEntity(_0xe52233,null))[_0xaa1a('0x3f')](handleError(_0xe52233,null));}; \ No newline at end of file +var _0x2caf=['squel','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','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','include','options','find','create','body','catch','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x550871,_0x31c12c){var _0x5b6226=function(_0x128990){while(--_0x128990){_0x550871['push'](_0x550871['shift']());}};_0x5b6226(++_0x31c12c);}(_0x2caf,0x6a));var _0xf2ca=function(_0x24a335,_0x3acdf1){_0x24a335=_0x24a335-0x0;var _0x52c004=_0x2caf[_0x24a335];return _0x52c004;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf2ca('0x0'));var rp=require('request-promise');var moment=require(_0xf2ca('0x1'));var BPromise=require(_0xf2ca('0x2'));var Mustache=require(_0xf2ca('0x3'));var util=require(_0xf2ca('0x4'));var path=require(_0xf2ca('0x5'));var sox=require(_0xf2ca('0x6'));var csv=require(_0xf2ca('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf2ca('0x8'));var _=require(_0xf2ca('0x9'));var squel=require(_0xf2ca('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf2ca('0xb'));var toCsv=require(_0xf2ca('0x7'));var querystring=require(_0xf2ca('0xc'));var Papa=require(_0xf2ca('0xd'));var Redis=require(_0xf2ca('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf2ca('0xf'));var as=require(_0xf2ca('0x10'));var hardwareService=require(_0xf2ca('0x11'));var logger=require(_0xf2ca('0x12'))(_0xf2ca('0x13'));var utils=require(_0xf2ca('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf2ca('0x15'));var db=require(_0xf2ca('0x16'))['db'];function respondWithStatusCode(_0x54a3cb,_0x88529f){_0x88529f=_0x88529f||0xcc;return function(_0x383112){if(_0x383112){return _0x54a3cb['sendStatus'](_0x88529f);}return _0x54a3cb['status'](_0x88529f)[_0xf2ca('0x17')]();};}function respondWithResult(_0x52a278,_0x284484){_0x284484=_0x284484||0xc8;return function(_0x3123fe){if(_0x3123fe){return _0x52a278[_0xf2ca('0x18')](_0x284484)[_0xf2ca('0x19')](_0x3123fe);}};}function respondWithFilteredResult(_0x410997,_0x2057a2){return function(_0x2ddfac){if(_0x2ddfac){var _0x5aec64=typeof _0x2057a2[_0xf2ca('0x1a')]==='undefined'&&typeof _0x2057a2[_0xf2ca('0x1b')]==='undefined';var _0x235e79=_0x2ddfac[_0xf2ca('0x1c')];var _0x59ea3c=_0x5aec64?0x0:_0x2057a2[_0xf2ca('0x1a')];var _0x160230=_0x5aec64?_0x2ddfac[_0xf2ca('0x1c')]:_0x2057a2[_0xf2ca('0x1a')]+_0x2057a2[_0xf2ca('0x1b')];var _0x1ca233;if(_0x160230>=_0x235e79){_0x160230=_0x235e79;_0x1ca233=0xc8;}else{_0x1ca233=0xce;}_0x410997[_0xf2ca('0x18')](_0x1ca233);return _0x410997[_0xf2ca('0x1d')](_0xf2ca('0x1e'),_0x59ea3c+'-'+_0x160230+'/'+_0x235e79)[_0xf2ca('0x19')](_0x2ddfac);}return null;};}function patchUpdates(_0xea662){return function(_0x55dc6a){try{jsonpatch[_0xf2ca('0x1f')](_0x55dc6a,_0xea662,!![]);}catch(_0x45a028){return BPromise[_0xf2ca('0x20')](_0x45a028);}return _0x55dc6a[_0xf2ca('0x21')]();};}function saveUpdates(_0x41cb71,_0x386c58){return function(_0x1bbd60){if(_0x1bbd60){return _0x1bbd60[_0xf2ca('0x22')](_0x41cb71)['then'](function(_0x14791b){return _0x14791b;});}return null;};}function removeEntity(_0x1767f7,_0x56ebed){return function(_0x1c032c){if(_0x1c032c){return _0x1c032c[_0xf2ca('0x23')]()[_0xf2ca('0x24')](function(){_0x1767f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbfcb0b,_0x1b3c01){return function(_0x214fa9){if(!_0x214fa9){_0xbfcb0b[_0xf2ca('0x25')](0x194);}return _0x214fa9;};}function handleError(_0x1255ba,_0x427a17){_0x427a17=_0x427a17||0x1f4;return function(_0x339e10){logger[_0xf2ca('0x26')](_0x339e10['stack']);if(_0x339e10[_0xf2ca('0x27')]){delete _0x339e10[_0xf2ca('0x27')];}_0x1255ba[_0xf2ca('0x18')](_0x427a17)[_0xf2ca('0x28')](_0x339e10);};}exports[_0xf2ca('0x29')]=function(_0x41fc04,_0x17707e){var _0xb0ae21={'raw':!![],'where':{'id':_0x41fc04[_0xf2ca('0x2a')]['id']}},_0x1b44fb={};_0x1b44fb[_0xf2ca('0x2b')]=_[_0xf2ca('0x2c')](db[_0xf2ca('0x2d')][_0xf2ca('0x2e')]);_0x1b44fb[_0xf2ca('0x2f')]=_[_0xf2ca('0x2c')](_0x41fc04[_0xf2ca('0x2f')]);_0x1b44fb[_0xf2ca('0x30')]=_[_0xf2ca('0x31')](_0x1b44fb['model'],_0x1b44fb[_0xf2ca('0x2f')]);_0xb0ae21[_0xf2ca('0x32')]=_[_0xf2ca('0x31')](_0x1b44fb[_0xf2ca('0x2b')],qs[_0xf2ca('0x33')](_0x41fc04[_0xf2ca('0x2f')][_0xf2ca('0x33')]));_0xb0ae21[_0xf2ca('0x32')]=_0xb0ae21[_0xf2ca('0x32')]['length']?_0xb0ae21[_0xf2ca('0x32')]:_0x1b44fb[_0xf2ca('0x2b')];if(_0x41fc04[_0xf2ca('0x2f')]['includeAll']){_0xb0ae21[_0xf2ca('0x34')]=[{'all':!![]}];}_0xb0ae21=_['merge']({},_0xb0ae21,_0x41fc04[_0xf2ca('0x35')]);return db[_0xf2ca('0x2d')][_0xf2ca('0x36')](_0xb0ae21)[_0xf2ca('0x24')](handleEntityNotFound(_0x17707e,null))[_0xf2ca('0x24')](respondWithResult(_0x17707e,null))['catch'](handleError(_0x17707e,null));};exports['create']=function(_0x36a532,_0x48b49b){return db[_0xf2ca('0x2d')][_0xf2ca('0x37')](_0x36a532[_0xf2ca('0x38')],{})[_0xf2ca('0x24')](respondWithResult(_0x48b49b,0xc9))[_0xf2ca('0x39')](handleError(_0x48b49b,null));};exports[_0xf2ca('0x22')]=function(_0x304d9e,_0x3692b1){if(_0x304d9e[_0xf2ca('0x38')]['id']){delete _0x304d9e[_0xf2ca('0x38')]['id'];}return db[_0xf2ca('0x2d')][_0xf2ca('0x36')]({'where':{'id':_0x304d9e[_0xf2ca('0x2a')]['id']}})[_0xf2ca('0x24')](handleEntityNotFound(_0x3692b1,null))[_0xf2ca('0x24')](saveUpdates(_0x304d9e[_0xf2ca('0x38')],null))['then'](respondWithResult(_0x3692b1,null))[_0xf2ca('0x39')](handleError(_0x3692b1,null));};exports[_0xf2ca('0x23')]=function(_0x39a2dd,_0x148570){return db['ChatProactiveAction'][_0xf2ca('0x36')]({'where':{'id':_0x39a2dd['params']['id']}})[_0xf2ca('0x24')](handleEntityNotFound(_0x148570,null))[_0xf2ca('0x24')](removeEntity(_0x148570,null))[_0xf2ca('0x39')](handleError(_0x148570,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 7cd6e67..5ec1056 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 _0xabda=['bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment'];(function(_0x7d66f2,_0x55a83e){var _0x30bf39=function(_0x2e5e5e){while(--_0x2e5e5e){_0x7d66f2['push'](_0x7d66f2['shift']());}};_0x30bf39(++_0x55a83e);}(_0xabda,0xce));var _0xaabd=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xabda[_0x2ca9d4];return _0x258956;};'use strict';var _=require(_0xaabd('0x0'));var util=require(_0xaabd('0x1'));var logger=require(_0xaabd('0x2'))('api');var moment=require(_0xaabd('0x3'));var BPromise=require(_0xaabd('0x4'));var rp=require(_0xaabd('0x5'));var fs=require('fs');var path=require(_0xaabd('0x6'));var rimraf=require(_0xaabd('0x7'));var config=require(_0xaabd('0x8'));var attributes=require(_0xaabd('0x9'));module[_0xaabd('0xa')]=function(_0x537924,_0x1631ac){return _0x537924[_0xaabd('0xb')](_0xaabd('0xc'),attributes,{'tableName':_0xaabd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd17f=['../../config/logger','api','moment','rimraf','exports','chat_proactive_actions','util'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xd17f,0xa0));var _0xfd17=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd17f[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xfd17('0x0'));var logger=require(_0xfd17('0x1'))(_0xfd17('0x2'));var moment=require(_0xfd17('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfd17('0x4'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0xfd17('0x5')]=function(_0x57c2e1,_0x226377){return _0x57c2e1['define']('ChatProactiveAction',attributes,{'tableName':_0xfd17('0x6'),'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 cbb69ee..2c98133 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 _0x096a=['ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','then'];(function(_0x53135c,_0x10a974){var _0x503026=function(_0x488fb9){while(--_0x488fb9){_0x53135c['push'](_0x53135c['shift']());}};_0x503026(++_0x10a974);}(_0x096a,0x121));var _0xa096=function(_0x5b44dc,_0x348d84){_0x5b44dc=_0x5b44dc-0x0;var _0x22aefd=_0x096a[_0x5b44dc];return _0x22aefd;};'use strict';var _=require(_0xa096('0x0'));var util=require('util');var moment=require(_0xa096('0x1'));var BPromise=require(_0xa096('0x2'));var rs=require(_0xa096('0x3'));var fs=require('fs');var Redis=require(_0xa096('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa096('0x5'));var logger=require('../../config/logger')(_0xa096('0x6'));var config=require('../../config/environment');var jayson=require(_0xa096('0x7'));var client=jayson[_0xa096('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d58ff,_0x586103,_0x230366){return new BPromise(function(_0xf1c3e0,_0x23bfe7){return client[_0xa096('0x9')](_0x2d58ff,_0x230366)[_0xa096('0xa')](function(_0x120058){logger['info'](_0xa096('0xb'),_0x586103,_0xa096('0xc'));logger[_0xa096('0xd')](_0xa096('0xe'),_0x586103,_0xa096('0xc'),JSON['stringify'](_0x120058));if(_0x120058[_0xa096('0xf')]){if(_0x120058[_0xa096('0xf')][_0xa096('0x10')]===0x1f4){logger['error'](_0xa096('0xb'),_0x586103,_0x120058[_0xa096('0xf')][_0xa096('0x11')]);return _0x23bfe7(_0x120058[_0xa096('0xf')][_0xa096('0x11')]);}logger[_0xa096('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x586103,_0x120058[_0xa096('0xf')][_0xa096('0x11')]);return _0xf1c3e0(_0x120058[_0xa096('0xf')]['message']);}else{logger[_0xa096('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x586103,'request\x20sent');_0xf1c3e0(_0x120058[_0xa096('0x13')][_0xa096('0x11')]);}})['catch'](function(_0x41e0e0){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x586103,_0x41e0e0);_0x23bfe7(_0x41e0e0);});});} \ No newline at end of file +var _0xf1f8=['../../config/logger','rpc','../../config/environment','client','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf1f8,0x9a));var _0x8f1f=function(_0x32a7d2,_0x52f386){_0x32a7d2=_0x32a7d2-0x0;var _0x1b8c6c=_0xf1f8[_0x32a7d2];return _0x1b8c6c;};'use strict';var _=require(_0x8f1f('0x0'));var util=require(_0x8f1f('0x1'));var moment=require(_0x8f1f('0x2'));var BPromise=require(_0x8f1f('0x3'));var rs=require(_0x8f1f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8f1f('0x5'));var logger=require(_0x8f1f('0x6'))(_0x8f1f('0x7'));var config=require(_0x8f1f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8f1f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb7d883,_0x54ad38,_0x30b513){return new BPromise(function(_0x47678e,_0x5bc171){return client[_0x8f1f('0xa')](_0xb7d883,_0x30b513)['then'](function(_0x5406bb){logger[_0x8f1f('0xb')](_0x8f1f('0xc'),_0x54ad38,_0x8f1f('0xd'));logger[_0x8f1f('0xe')](_0x8f1f('0xf'),_0x54ad38,_0x8f1f('0xd'),JSON['stringify'](_0x5406bb));if(_0x5406bb[_0x8f1f('0x10')]){if(_0x5406bb[_0x8f1f('0x10')][_0x8f1f('0x11')]===0x1f4){logger[_0x8f1f('0x10')](_0x8f1f('0xc'),_0x54ad38,_0x5406bb[_0x8f1f('0x10')][_0x8f1f('0x12')]);return _0x5bc171(_0x5406bb[_0x8f1f('0x10')][_0x8f1f('0x12')]);}logger[_0x8f1f('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x54ad38,_0x5406bb[_0x8f1f('0x10')][_0x8f1f('0x12')]);return _0x47678e(_0x5406bb[_0x8f1f('0x10')][_0x8f1f('0x12')]);}else{logger[_0x8f1f('0xb')](_0x8f1f('0xc'),_0x54ad38,_0x8f1f('0xd'));_0x47678e(_0x5406bb[_0x8f1f('0x13')][_0x8f1f('0x12')]);}})['catch'](function(_0x1f8cad){logger['error'](_0x8f1f('0xc'),_0x54ad38,_0x1f8cad);_0x5bc171(_0x1f8cad);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 6b07c77..e02d37b 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 _0x55ca=['multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','destroy','exports'];(function(_0x5217cc,_0x3fd394){var _0x192de5=function(_0xc99e49){while(--_0xc99e49){_0x5217cc['push'](_0x5217cc['shift']());}};_0x192de5(++_0x3fd394);}(_0x55ca,0x126));var _0xa55c=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x55ca[_0x4aba15];return _0x1c8122;};'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')](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x9')](),controller[_0xa55c('0xb')]);router['put'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller['update']);router['delete'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xc')]);module[_0xa55c('0xd')]=router; \ No newline at end of file +var _0x038b=['isAuthenticated','/:id','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x038b,0x114));var _0xb038=function(_0x269be8,_0x508df6){_0x269be8=_0x269be8-0x0;var _0x5201ae=_0x038b[_0x269be8];return _0x5201ae;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb038('0x8')]);router[_0xb038('0x9')]('/',auth[_0xb038('0xa')](),controller['create']);router['put'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['update']);router['delete'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['destroy']);module[_0xb038('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index a7176c1..3450488 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 _0x8f66=['roundrobin','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x50a732,_0x1eab82){var _0x2047a1=function(_0x277e50){while(--_0x277e50){_0x50a732['push'](_0x50a732['shift']());}};_0x2047a1(++_0x1eab82);}(_0x8f66,0x14a));var _0x68f6=function(_0x39a3f4,_0x7f4ae8){_0x39a3f4=_0x39a3f4-0x0;var _0x4a894d=_0x8f66[_0x39a3f4];return _0x4a894d;};'use strict';var Sequelize=require('sequelize');module[_0x68f6('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x68f6('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x68f6('0x2')]},'timeout':{'type':Sequelize[_0x68f6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x68f6('0x4')](_0x68f6('0x5'),'beepall',_0x68f6('0x6'))}}; \ No newline at end of file +var _0xb9d3=['name','INTEGER','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x23fde2,_0x3c0ecc){var _0x2b910b=function(_0x5d9afa){while(--_0x5d9afa){_0x23fde2['push'](_0x23fde2['shift']());}};_0x2b910b(++_0x3c0ecc);}(_0xb9d3,0x8d));var _0x3b9d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb9d3[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x3b9d('0x0'));module[_0x3b9d('0x1')]={'name':{'type':Sequelize[_0x3b9d('0x2')],'unique':_0x3b9d('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3b9d('0x2')]},'timeout':{'type':Sequelize[_0x3b9d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3b9d('0x5')]('rrmemory',_0x3b9d('0x6'),_0x3b9d('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 8c47152..91909d2 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 _0x3e3e=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','get','ChatQueues','UserProfileResource','destroy','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','count','includeAll','include','findAll','rows','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserChatQueue','ChatQueueId','User','findAndCountAll','UserId','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','userChatQueue:save','select','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','every','TeamId','all','union','compact','removeTeams','ids','isEmpty','forEach','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','emit','getAgents','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x118afa,_0x4bf0c1){var _0x167d76=function(_0x2c529b){while(--_0x2c529b){_0x118afa['push'](_0x118afa['shift']());}};_0x167d76(++_0x4bf0c1);}(_0x3e3e,0x1bc));var _0xe3e3=function(_0x463da4,_0x1a4968){_0x463da4=_0x463da4-0x0;var _0x433887=_0x3e3e[_0x463da4];return _0x433887;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe3e3('0x0'));var zipdir=require(_0xe3e3('0x1'));var jsonpatch=require(_0xe3e3('0x2'));var rp=require(_0xe3e3('0x3'));var moment=require(_0xe3e3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe3e3('0x5'));var util=require(_0xe3e3('0x6'));var path=require(_0xe3e3('0x7'));var sox=require(_0xe3e3('0x8'));var csv=require('to-csv');var ejs=require(_0xe3e3('0x9'));var fs=require('fs');var fs_extra=require(_0xe3e3('0xa'));var _=require('lodash');var squel=require(_0xe3e3('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe3e3('0xc'));var Papa=require(_0xe3e3('0xd'));var Redis=require(_0xe3e3('0xe'));var authService=require(_0xe3e3('0xf'));var qs=require(_0xe3e3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3e3('0x11'));var logger=require(_0xe3e3('0x12'))(_0xe3e3('0x13'));var utils=require(_0xe3e3('0x14'));var config=require(_0xe3e3('0x15'));var licenseUtil=require(_0xe3e3('0x16'));var db=require(_0xe3e3('0x17'))['db'];config[_0xe3e3('0x18')]=_[_0xe3e3('0x19')](config[_0xe3e3('0x18')],{'host':_0xe3e3('0x1a'),'port':0x18eb});var socket=require(_0xe3e3('0x1b'))(new Redis(config[_0xe3e3('0x18')]));require(_0xe3e3('0x1c'))[_0xe3e3('0x1d')](socket);var jayson=require(_0xe3e3('0x1e'));var client=jayson['client'][_0xe3e3('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x608c54,_0x3454ec,_0xcf0b8b,_0x5a76df){return new BPromise(function(_0x1f8af4,_0x52be7e){var _0x1c96b7=_0x5a76df||client;return _0x1c96b7[_0xe3e3('0x20')](_0x608c54,_0xcf0b8b)[_0xe3e3('0x21')](function(_0x1a794c){logger[_0xe3e3('0x22')](_0xe3e3('0x23'),_0x3454ec,_0xe3e3('0x24'));logger[_0xe3e3('0x25')](_0xe3e3('0x26'),_0x3454ec,_0xe3e3('0x24'),JSON[_0xe3e3('0x27')](_0x1a794c));if(_0x1a794c[_0xe3e3('0x28')]){if(_0x1a794c[_0xe3e3('0x28')][_0xe3e3('0x29')]===0x1f4){logger[_0xe3e3('0x28')](_0xe3e3('0x23'),_0x3454ec,_0x1a794c[_0xe3e3('0x28')][_0xe3e3('0x2a')]);return _0x52be7e(_0x1a794c['error'][_0xe3e3('0x2a')]);}logger[_0xe3e3('0x28')](_0xe3e3('0x23'),_0x3454ec,_0x1a794c['error'][_0xe3e3('0x2a')]);return _0x1f8af4(_0x1a794c[_0xe3e3('0x28')][_0xe3e3('0x2a')]);}else{logger[_0xe3e3('0x22')](_0xe3e3('0x23'),_0x3454ec,_0xe3e3('0x24'));_0x1f8af4(_0x1a794c[_0xe3e3('0x2b')][_0xe3e3('0x2a')]);}})[_0xe3e3('0x2c')](function(_0x8234db){logger['error']('ChatQueue,\x20%s,\x20%s',_0x3454ec,_0x8234db);_0x52be7e(_0x8234db);});});}function respondWithStatusCode(_0x7b8dad,_0x41d07e){_0x41d07e=_0x41d07e||0xcc;return function(_0xcd94c6){if(_0xcd94c6){return _0x7b8dad[_0xe3e3('0x2d')](_0x41d07e);}return _0x7b8dad[_0xe3e3('0x2e')](_0x41d07e)[_0xe3e3('0x2f')]();};}function respondWithResult(_0x22e36e,_0x6ee75b){_0x6ee75b=_0x6ee75b||0xc8;return function(_0x2e7e1a){if(_0x2e7e1a){return _0x22e36e[_0xe3e3('0x2e')](_0x6ee75b)['json'](_0x2e7e1a);}};}function respondWithFilteredResult(_0x53d945,_0x432ec2){return function(_0x59c0ff){if(_0x59c0ff){var _0x3b64c9=typeof _0x432ec2[_0xe3e3('0x30')]===_0xe3e3('0x31')&&typeof _0x432ec2[_0xe3e3('0x32')]==='undefined';var _0x45c213=_0x59c0ff['count'];var _0x58e5bf=_0x3b64c9?0x0:_0x432ec2[_0xe3e3('0x30')];var _0x368d46=_0x3b64c9?_0x59c0ff['count']:_0x432ec2['offset']+_0x432ec2[_0xe3e3('0x32')];var _0xa93410;if(_0x368d46>=_0x45c213){_0x368d46=_0x45c213;_0xa93410=0xc8;}else{_0xa93410=0xce;}_0x53d945[_0xe3e3('0x2e')](_0xa93410);return _0x53d945[_0xe3e3('0x33')](_0xe3e3('0x34'),_0x58e5bf+'-'+_0x368d46+'/'+_0x45c213)[_0xe3e3('0x35')](_0x59c0ff);}return null;};}function patchUpdates(_0x1d0594){return function(_0x32b434){try{jsonpatch[_0xe3e3('0x36')](_0x32b434,_0x1d0594,!![]);}catch(_0xf4615a){return BPromise[_0xe3e3('0x37')](_0xf4615a);}return _0x32b434[_0xe3e3('0x38')]();};}function saveUpdates(_0x2d06ee,_0xd4bc39){return function(_0x2e5647){if(_0x2e5647){return _0x2e5647[_0xe3e3('0x39')](_0x2d06ee)[_0xe3e3('0x21')](function(_0x47c1b8){return _0x47c1b8;});}return null;};}function removeEntity(_0x366412,_0x515c56){return function(_0x4f4894){if(_0x4f4894){return _0x4f4894['destroy']()[_0xe3e3('0x21')](function(){var _0x21ed9c=_0x4f4894[_0xe3e3('0x3a')]({'plain':!![]});var _0x3400ac=_0xe3e3('0x3b');return db[_0xe3e3('0x3c')][_0xe3e3('0x3d')]({'where':{'type':_0x3400ac,'resourceId':_0x21ed9c['id']}})[_0xe3e3('0x21')](function(){return _0x4f4894;});})[_0xe3e3('0x21')](function(){_0x366412[_0xe3e3('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47bfa9,_0x844f01){return function(_0x4014f4){if(!_0x4014f4){_0x47bfa9[_0xe3e3('0x2d')](0x194);}return _0x4014f4;};}function handleError(_0x3afef6,_0x417c6f){_0x417c6f=_0x417c6f||0x1f4;return function(_0x448f45){logger[_0xe3e3('0x28')](_0x448f45[_0xe3e3('0x3e')]);if(_0x448f45[_0xe3e3('0x3f')]){delete _0x448f45[_0xe3e3('0x3f')];}_0x3afef6[_0xe3e3('0x2e')](_0x417c6f)[_0xe3e3('0x40')](_0x448f45);};}exports[_0xe3e3('0x41')]=function(_0x4beadd,_0x488bc5){var _0xf0bf28={},_0x41c5c7={},_0x497dc2={'count':0x0,'rows':[]};var _0x45ed19=_[_0xe3e3('0x42')](db[_0xe3e3('0x43')][_0xe3e3('0x44')],function(_0x2b994e){return{'name':_0x2b994e[_0xe3e3('0x45')],'type':_0x2b994e[_0xe3e3('0x46')][_0xe3e3('0x47')]};});_0x41c5c7[_0xe3e3('0x48')]=_[_0xe3e3('0x42')](_0x45ed19,'name');_0x41c5c7['query']=_[_0xe3e3('0x49')](_0x4beadd[_0xe3e3('0x4a')]);_0x41c5c7[_0xe3e3('0x4b')]=_[_0xe3e3('0x4c')](_0x41c5c7['model'],_0x41c5c7[_0xe3e3('0x4a')]);_0xf0bf28[_0xe3e3('0x4d')]=_['intersection'](_0x41c5c7[_0xe3e3('0x48')],qs[_0xe3e3('0x4e')](_0x4beadd[_0xe3e3('0x4a')][_0xe3e3('0x4e')]));_0xf0bf28[_0xe3e3('0x4d')]=_0xf0bf28[_0xe3e3('0x4d')][_0xe3e3('0x4f')]?_0xf0bf28[_0xe3e3('0x4d')]:_0x41c5c7[_0xe3e3('0x48')];if(!_0x4beadd[_0xe3e3('0x4a')][_0xe3e3('0x50')](_0xe3e3('0x51'))){_0xf0bf28[_0xe3e3('0x32')]=qs[_0xe3e3('0x32')](_0x4beadd[_0xe3e3('0x4a')]['limit']);_0xf0bf28[_0xe3e3('0x30')]=qs['offset'](_0x4beadd[_0xe3e3('0x4a')][_0xe3e3('0x30')]);}_0xf0bf28[_0xe3e3('0x52')]=qs[_0xe3e3('0x53')](_0x4beadd[_0xe3e3('0x4a')]['sort']);_0xf0bf28['where']=qs[_0xe3e3('0x4b')](_[_0xe3e3('0x54')](_0x4beadd[_0xe3e3('0x4a')],_0x41c5c7[_0xe3e3('0x4b')]),_0x45ed19);if(_0x4beadd['query'][_0xe3e3('0x55')]){_0xf0bf28[_0xe3e3('0x56')]=_[_0xe3e3('0x57')](_0xf0bf28['where'],{'$or':_[_0xe3e3('0x42')](_0x45ed19,function(_0x17f20d){if(_0x17f20d[_0xe3e3('0x46')]!=='VIRTUAL'){var _0x2f74c={};_0x2f74c[_0x17f20d[_0xe3e3('0x3f')]]={'$like':'%'+_0x4beadd[_0xe3e3('0x4a')][_0xe3e3('0x55')]+'%'};return _0x2f74c;}})});}_0xf0bf28=_[_0xe3e3('0x57')]({},_0xf0bf28,_0x4beadd['options']);var _0x516e85={'where':_0xf0bf28[_0xe3e3('0x56')]};return db[_0xe3e3('0x43')][_0xe3e3('0x58')](_0x516e85)[_0xe3e3('0x21')](function(_0x35b3d8){_0x497dc2['count']=_0x35b3d8;if(_0x4beadd['query'][_0xe3e3('0x59')]){_0xf0bf28[_0xe3e3('0x5a')]=[{'all':!![]}];}return db[_0xe3e3('0x43')][_0xe3e3('0x5b')](_0xf0bf28);})[_0xe3e3('0x21')](function(_0x397eb0){_0x497dc2[_0xe3e3('0x5c')]=_0x397eb0;return _0x497dc2;})['then'](respondWithFilteredResult(_0x488bc5,_0xf0bf28))[_0xe3e3('0x2c')](handleError(_0x488bc5,null));};exports[_0xe3e3('0x5d')]=function(_0x19fd98,_0x3270c1){var _0x2af0c8={'raw':!![],'where':{'id':_0x19fd98[_0xe3e3('0x5e')]['id']}},_0x338af8={};_0x338af8[_0xe3e3('0x48')]=_[_0xe3e3('0x49')](db[_0xe3e3('0x43')][_0xe3e3('0x44')]);_0x338af8[_0xe3e3('0x4a')]=_[_0xe3e3('0x49')](_0x19fd98[_0xe3e3('0x4a')]);_0x338af8['filters']=_[_0xe3e3('0x4c')](_0x338af8[_0xe3e3('0x48')],_0x338af8[_0xe3e3('0x4a')]);_0x2af0c8[_0xe3e3('0x4d')]=_['intersection'](_0x338af8[_0xe3e3('0x48')],qs[_0xe3e3('0x4e')](_0x19fd98[_0xe3e3('0x4a')][_0xe3e3('0x4e')]));_0x2af0c8[_0xe3e3('0x4d')]=_0x2af0c8[_0xe3e3('0x4d')][_0xe3e3('0x4f')]?_0x2af0c8['attributes']:_0x338af8[_0xe3e3('0x48')];if(_0x19fd98['query'][_0xe3e3('0x59')]){_0x2af0c8[_0xe3e3('0x5a')]=[{'all':!![]}];}_0x2af0c8=_['merge']({},_0x2af0c8,_0x19fd98[_0xe3e3('0x5f')]);return db[_0xe3e3('0x43')][_0xe3e3('0x60')](_0x2af0c8)[_0xe3e3('0x21')](handleEntityNotFound(_0x3270c1,null))[_0xe3e3('0x21')](respondWithResult(_0x3270c1,null))[_0xe3e3('0x2c')](handleError(_0x3270c1,null));};exports['create']=function(_0x3fff25,_0x5379b5){return db[_0xe3e3('0x43')][_0xe3e3('0x61')](_0x3fff25[_0xe3e3('0x62')],{})[_0xe3e3('0x21')](function(_0x2fa13f){var _0x26fd76=_0x3fff25['user'][_0xe3e3('0x3a')]({'plain':!![]});if(!_0x26fd76)throw new Error(_0xe3e3('0x63'));if(_0x26fd76[_0xe3e3('0x64')]===_0xe3e3('0x65')){var _0x3aac1f=_0x2fa13f[_0xe3e3('0x3a')]({'plain':!![]});var _0x44879f=_0xe3e3('0x3b');return db['UserProfileSection'][_0xe3e3('0x60')]({'where':{'name':_0x44879f,'userProfileId':_0x26fd76['userProfileId']},'raw':!![]})[_0xe3e3('0x21')](function(_0x57f273){if(_0x57f273&&_0x57f273[_0xe3e3('0x66')]===0x0){return db[_0xe3e3('0x3c')][_0xe3e3('0x61')]({'name':_0x3aac1f[_0xe3e3('0x3f')],'resourceId':_0x3aac1f['id'],'type':_0x57f273[_0xe3e3('0x3f')],'sectionId':_0x57f273['id']},{})['then'](function(){return _0x2fa13f;});}else{return _0x2fa13f;}})[_0xe3e3('0x2c')](function(_0x30707a){logger[_0xe3e3('0x28')](_0xe3e3('0x67'),_0x30707a);throw _0x30707a;});}return _0x2fa13f;})[_0xe3e3('0x21')](respondWithResult(_0x5379b5,0xc9))[_0xe3e3('0x2c')](handleError(_0x5379b5,null));};exports[_0xe3e3('0x39')]=function(_0x2b5bbd,_0x4181ed){if(_0x2b5bbd[_0xe3e3('0x62')]['id']){delete _0x2b5bbd['body']['id'];}return db[_0xe3e3('0x43')][_0xe3e3('0x60')]({'where':{'id':_0x2b5bbd['params']['id']}})['then'](handleEntityNotFound(_0x4181ed,null))[_0xe3e3('0x21')](saveUpdates(_0x2b5bbd[_0xe3e3('0x62')],null))[_0xe3e3('0x21')](respondWithResult(_0x4181ed,null))[_0xe3e3('0x2c')](handleError(_0x4181ed,null));};exports[_0xe3e3('0x3d')]=function(_0x3bfd21,_0xf75993){return db['ChatQueue']['find']({'where':{'id':_0x3bfd21[_0xe3e3('0x5e')]['id']}})[_0xe3e3('0x21')](handleEntityNotFound(_0xf75993,null))[_0xe3e3('0x21')](removeEntity(_0xf75993,null))[_0xe3e3('0x2c')](handleError(_0xf75993,null));};exports[_0xe3e3('0x68')]=function(_0x50c810,_0x544361){return db[_0xe3e3('0x43')][_0xe3e3('0x68')]()['then'](respondWithResult(_0x544361,null))[_0xe3e3('0x2c')](handleError(_0x544361,null));};exports['getMembers']=function(_0x37d2f7,_0x4bcbe2,_0x3878c6){var _0x970f8e={'raw':!![],'where':{}},_0x146206={},_0x3c6c62;return db[_0xe3e3('0x43')]['findOne']({'where':{'id':_0x37d2f7['params']['id']}})[_0xe3e3('0x21')](handleEntityNotFound(_0x4bcbe2,null))[_0xe3e3('0x21')](function(_0x5a1c98){if(_0x5a1c98){_0x3c6c62=_0x5a1c98[_0xe3e3('0x3a')]({'plain':!![]});_0x146206['model']=_[_0xe3e3('0x49')](db[_0xe3e3('0x69')][_0xe3e3('0x44')]);_0x146206[_0xe3e3('0x4a')]=_[_0xe3e3('0x49')](_0x37d2f7[_0xe3e3('0x4a')]);_0x146206[_0xe3e3('0x4b')]=_['intersection'](_0x146206[_0xe3e3('0x48')],_0x146206[_0xe3e3('0x4a')]);_0x970f8e[_0xe3e3('0x4d')]=_['intersection'](_0x146206[_0xe3e3('0x48')],qs[_0xe3e3('0x4e')](_0x37d2f7[_0xe3e3('0x4a')][_0xe3e3('0x4e')]));_0x970f8e['attributes']=_0x970f8e[_0xe3e3('0x4d')][_0xe3e3('0x4f')]?_0x970f8e['attributes']:_0x146206['model'];if(!_0x37d2f7[_0xe3e3('0x4a')][_0xe3e3('0x50')]('nolimit')){_0x970f8e[_0xe3e3('0x32')]=qs['limit'](_0x37d2f7[_0xe3e3('0x4a')][_0xe3e3('0x32')]);_0x970f8e[_0xe3e3('0x30')]=qs[_0xe3e3('0x30')](_0x37d2f7[_0xe3e3('0x4a')][_0xe3e3('0x30')]);}_0x970f8e[_0xe3e3('0x52')]=qs[_0xe3e3('0x53')](_0x37d2f7[_0xe3e3('0x4a')][_0xe3e3('0x53')]);_0x970f8e[_0xe3e3('0x56')]=qs[_0xe3e3('0x4b')](_[_0xe3e3('0x54')](_0x37d2f7[_0xe3e3('0x4a')],_0x146206['filters']));_0x970f8e['where'][_0xe3e3('0x6a')]=_0x5a1c98['id'];if(_0x37d2f7[_0xe3e3('0x4a')][_0xe3e3('0x55')]){_0x970f8e[_0xe3e3('0x56')]=_[_0xe3e3('0x57')](_0x970f8e['where'],{'$or':_[_0xe3e3('0x42')](_0x970f8e[_0xe3e3('0x4d')],function(_0x33b49d){var _0x57b312={};_0x57b312[_0x33b49d]={'$like':'%'+_0x37d2f7[_0xe3e3('0x4a')][_0xe3e3('0x55')]+'%'};return _0x57b312;})});}_0x970f8e=_['merge']({},_0x970f8e,_0x37d2f7[_0xe3e3('0x5f')]);return db[_0xe3e3('0x69')][_0xe3e3('0x5b')](_0x970f8e);}})[_0xe3e3('0x21')](function(_0xa17ee7){if(_0xa17ee7){return db[_0xe3e3('0x6b')][_0xe3e3('0x6c')]({'where':{'id':_[_0xe3e3('0x42')](_0xa17ee7,_0xe3e3('0x6d')),'role':'agent'},'attributes':['id','name',_0xe3e3('0x6e'),_0xe3e3('0x6f'),_0xe3e3('0x70')]});}})[_0xe3e3('0x21')](function(_0x245f00){if(_0x245f00){return{'count':_0x245f00[_0xe3e3('0x58')],'rows':_[_0xe3e3('0x42')](_0x245f00[_0xe3e3('0x5c')],function(_0x1885bb){return{'membername':_0x1885bb[_0xe3e3('0x3f')],'UserId':_0x1885bb['id'],'queue_name':_0x3c6c62['name'],'ChatQueueId':_0x3c6c62['id'],'interface':util[_0xe3e3('0x71')](_0xe3e3('0x72'),_0xe3e3('0x73'),_0x1885bb['name']),'penalty':0x0,'paused':_0x1885bb['chatPause'],'createdAt':_0x1885bb[_0xe3e3('0x70')],'updatedAt':_0x1885bb[_0xe3e3('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe3e3('0x21')](respondWithFilteredResult(_0x4bcbe2,_0x970f8e))['catch'](handleError(_0x4bcbe2,null));};exports['getTeams']=function(_0x1be925,_0x29273d,_0x2b827f){var _0x45f020={};var _0x4dd82d={};var _0x86cb8;var _0x533815;return db[_0xe3e3('0x43')]['findOne']({'where':{'id':_0x1be925['params']['id']}})[_0xe3e3('0x21')](handleEntityNotFound(_0x29273d,null))[_0xe3e3('0x21')](function(_0x18b9f7){if(_0x18b9f7){_0x86cb8=_0x18b9f7;_0x4dd82d[_0xe3e3('0x48')]=_[_0xe3e3('0x49')](db['Team'][_0xe3e3('0x44')]);_0x4dd82d['query']=_[_0xe3e3('0x49')](_0x1be925[_0xe3e3('0x4a')]);_0x4dd82d[_0xe3e3('0x4b')]=_['intersection'](_0x4dd82d[_0xe3e3('0x48')],_0x4dd82d[_0xe3e3('0x4a')]);_0x45f020[_0xe3e3('0x4d')]=_[_0xe3e3('0x4c')](_0x4dd82d[_0xe3e3('0x48')],qs[_0xe3e3('0x4e')](_0x1be925[_0xe3e3('0x4a')][_0xe3e3('0x4e')]));_0x45f020[_0xe3e3('0x4d')]=_0x45f020[_0xe3e3('0x4d')]['length']?_0x45f020['attributes']:_0x4dd82d[_0xe3e3('0x48')];_0x45f020[_0xe3e3('0x52')]=qs['sort'](_0x1be925['query'][_0xe3e3('0x53')]);_0x45f020[_0xe3e3('0x56')]=qs[_0xe3e3('0x4b')](_['pick'](_0x1be925['query'],_0x4dd82d[_0xe3e3('0x4b')]));if(_0x1be925[_0xe3e3('0x4a')][_0xe3e3('0x55')]){_0x45f020[_0xe3e3('0x56')]=_['merge'](_0x45f020[_0xe3e3('0x56')],{'$or':_[_0xe3e3('0x42')](_0x45f020[_0xe3e3('0x4d')],function(_0x1ce5fa){var _0x25686e={};_0x25686e[_0x1ce5fa]={'$like':'%'+_0x1be925[_0xe3e3('0x4a')][_0xe3e3('0x55')]+'%'};return _0x25686e;})});}_0x45f020=_[_0xe3e3('0x57')]({},_0x45f020,_0x1be925[_0xe3e3('0x5f')]);return _0x86cb8['getTeams'](_0x45f020);}})[_0xe3e3('0x21')](function(_0x5c0fd3){if(_0x5c0fd3){_0x533815=_0x5c0fd3['length'];if(!_0x1be925[_0xe3e3('0x4a')][_0xe3e3('0x50')](_0xe3e3('0x51'))){_0x45f020['limit']=qs[_0xe3e3('0x32')](_0x1be925[_0xe3e3('0x4a')][_0xe3e3('0x32')]);_0x45f020[_0xe3e3('0x30')]=qs[_0xe3e3('0x30')](_0x1be925['query'][_0xe3e3('0x30')]);}return _0x86cb8[_0xe3e3('0x74')](_0x45f020);}})['then'](function(_0x74ae41){if(_0x74ae41){return _0x74ae41?{'count':_0x533815,'rows':_0x74ae41}:null;}})[_0xe3e3('0x21')](respondWithResult(_0x29273d,null))['catch'](handleError(_0x29273d,null));};exports[_0xe3e3('0x75')]=function(_0x131a3d,_0x18759d,_0x538b35){var _0x1d1ecb=_0x131a3d[_0xe3e3('0x62')]['ids'];return db[_0xe3e3('0x76')][_0xe3e3('0x5b')]({'where':{'id':_0x1d1ecb},'attributes':['id'],'include':[{'model':db[_0xe3e3('0x6b')],'as':_0xe3e3('0x77'),'attributes':['id',_0xe3e3('0x3f'),'online',_0xe3e3('0x78'),_0xe3e3('0x79')],'raw':!![]}]})[_0xe3e3('0x21')](function(_0x572af1){if(_0x572af1){var _0x561228=_[_0xe3e3('0x7a')](_0x572af1,function(_0x35cd0c){var _0x40ef99=_0x35cd0c[_0xe3e3('0x3a')]({'plain':!![]});return _0x40ef99[_0xe3e3('0x77')];});return db[_0xe3e3('0x43')][_0xe3e3('0x60')]({'where':{'id':_0x131a3d[_0xe3e3('0x5e')]['id']}})[_0xe3e3('0x21')](function(_0x36e314){return db[_0xe3e3('0x7b')][_0xe3e3('0x7c')](function(_0x215748){return _0x36e314[_0xe3e3('0x75')](_0x1d1ecb,{'transaction':_0x215748})[_0xe3e3('0x21')](function(){return BPromise[_0xe3e3('0x7d')](_0x561228,function(_0x3fe199){return db['UserChatQueue'][_0xe3e3('0x7e')]({'where':{'UserId':_0x3fe199['id'],'ChatQueueId':_0x131a3d['params']['id']},'transaction':_0x215748});});})[_0xe3e3('0x21')](function(){_0x561228['forEach'](function(_0x4feff7){socket['emit'](_0xe3e3('0x7f'),{'UserId':_0x4feff7['id'],'ChatQueueId':_0x36e314['id']});});});});});}})['then'](respondWithStatusCode(_0x18759d,null))[_0xe3e3('0x2c')](handleError(_0x18759d,null));};exports['removeTeams']=function(_0x3991b2,_0xdda48e,_0xa2ddc1){return db[_0xe3e3('0x76')][_0xe3e3('0x5b')]({'where':{'id':_0x3991b2['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe3e3('0x77'),'attributes':['id'],'raw':!![]}]})[_0xe3e3('0x21')](handleEntityNotFound(_0xdda48e,null))[_0xe3e3('0x21')](function(_0x2d1ab8){var _0x1f776e=_[_0xe3e3('0x42')](_0x2d1ab8,'id');var _0xf6c2c2=[];var _0xd7f33c=[];var _0x4345cd=squel[_0xe3e3('0x80')]();_0x4345cd[_0xe3e3('0x81')](_0xe3e3('0x82'))['from']('team_has_chat_queues','tq')[_0xe3e3('0x83')]('user_has_teams','ut',_0xe3e3('0x84'))[_0xe3e3('0x56')](_0xe3e3('0x85'),_0x3991b2['params']['id']);for(var _0x53f7e6=0x0;_0x53f7e6<_0x2d1ab8[_0xe3e3('0x4f')];_0x53f7e6+=0x1){let _0x51a1ee=_0x2d1ab8[_0x53f7e6];for(var _0x2d0915=0x0;_0x2d0915<_0x51a1ee[_0xe3e3('0x77')][_0xe3e3('0x4f')];_0x2d0915+=0x1){let _0x2ae9f4=_0x51a1ee[_0xe3e3('0x77')][_0x2d0915];var _0x55c1b8=_0x4345cd[_0xe3e3('0x86')]();_0x55c1b8[_0xe3e3('0x56')](_0xe3e3('0x87'),_0x2ae9f4['id']);_0xd7f33c[_0xe3e3('0x88')](db['sequelize'][_0xe3e3('0x4a')](_0x55c1b8['toString'](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0xe3e3('0x21')](function(_0x513044){if(_0x513044[_0xe3e3('0x4f')]===0x1){return _0x2ae9f4['id'];}else{var _0x1e45f=_[_0xe3e3('0x89')](_['map'](_0x513044,_0xe3e3('0x8a')),function(_0x14fd67){return _['includes'](_0x1f776e,_0x14fd67);});if(_0x1e45f){return _0x2ae9f4['id'];}}}));}}return BPromise[_0xe3e3('0x8b')](_0xd7f33c)[_0xe3e3('0x21')](function(_0x18b113){_0xf6c2c2=_(_0xf6c2c2)[_0xe3e3('0x8c')](_0x18b113)[_0xe3e3('0x8d')]()['value']();return db[_0xe3e3('0x43')][_0xe3e3('0x60')]({'where':{'id':_0x3991b2['params']['id']}})['then'](function(_0x1f9003){return db[_0xe3e3('0x7b')][_0xe3e3('0x7c')](function(_0x5712ca){return _0x1f9003[_0xe3e3('0x8e')](_0x3991b2['query'][_0xe3e3('0x8f')],{'transaction':_0x5712ca})[_0xe3e3('0x21')](function(){if(!_[_0xe3e3('0x90')](_0xf6c2c2)){return _0x1f9003['removeAgents'](_0xf6c2c2,{'transaction':_0x5712ca});}})[_0xe3e3('0x21')](function(){_0xf6c2c2[_0xe3e3('0x91')](function(_0x1f99b6){socket['emit'](_0xe3e3('0x92'),{'UserId':_0x1f99b6,'ChatQueueId':_0x1f9003['id']});});});});});});})[_0xe3e3('0x21')](respondWithStatusCode(_0xdda48e,null))['catch'](handleError(_0xdda48e,null));};exports[_0xe3e3('0x93')]=function(_0x3df0e5,_0x4d8d87,_0xdaebc3){return db[_0xe3e3('0x43')][_0xe3e3('0x60')]({'where':{'id':_0x3df0e5[_0xe3e3('0x5e')]['id']}})[_0xe3e3('0x21')](handleEntityNotFound(_0x4d8d87,null))[_0xe3e3('0x21')](function(_0x2014b1){if(_0x2014b1){return _0x2014b1[_0xe3e3('0x93')](_0x3df0e5[_0xe3e3('0x62')][_0xe3e3('0x8f')],_[_0xe3e3('0x94')](_0x3df0e5[_0xe3e3('0x62')],[_0xe3e3('0x8f'),'id'])||{})[_0xe3e3('0x95')](function(_0x376584){for(var _0x465df2=0x0;_0x465df2<_0x3df0e5[_0xe3e3('0x62')][_0xe3e3('0x8f')][_0xe3e3('0x4f')];_0x465df2+=0x1){socket['emit'](_0xe3e3('0x7f'),{'UserId':Number(_0x3df0e5[_0xe3e3('0x62')]['ids'][_0x465df2]),'ChatQueueId':Number(_0x3df0e5[_0xe3e3('0x5e')]['id'])});}return _0x376584;});}})[_0xe3e3('0x21')](respondWithResult(_0x4d8d87,null))[_0xe3e3('0x2c')](handleError(_0x4d8d87,null));};exports[_0xe3e3('0x96')]=function(_0x3bf778,_0x467e54,_0x18538c){return db[_0xe3e3('0x43')]['find']({'where':{'id':_0x3bf778[_0xe3e3('0x5e')]['id']}})['then'](handleEntityNotFound(_0x467e54,null))['then'](function(_0x1eaf65){if(_0x1eaf65){return _0x1eaf65[_0xe3e3('0x96')](_0x3bf778[_0xe3e3('0x4a')][_0xe3e3('0x8f')])[_0xe3e3('0x21')](function(){if(_[_0xe3e3('0x97')](_0x3bf778['query']['ids'])){for(var _0x231200=0x0;_0x231200<_0x3bf778[_0xe3e3('0x4a')][_0xe3e3('0x8f')][_0xe3e3('0x4f')];_0x231200+=0x1){socket[_0xe3e3('0x98')](_0xe3e3('0x92'),{'UserId':Number(_0x3bf778[_0xe3e3('0x4a')][_0xe3e3('0x8f')][_0x231200]),'ChatQueueId':Number(_0x3bf778['params']['id'])});}}else{socket[_0xe3e3('0x98')](_0xe3e3('0x92'),{'UserId':Number(_0x3bf778[_0xe3e3('0x4a')][_0xe3e3('0x8f')]),'ChatQueueId':Number(_0x3bf778[_0xe3e3('0x5e')]['id'])});}});}})[_0xe3e3('0x21')](respondWithStatusCode(_0x467e54,null))[_0xe3e3('0x2c')](handleError(_0x467e54,null));};exports[_0xe3e3('0x99')]=function(_0x50fe0f,_0x5bdebf,_0x579b4c){var _0x57cec1={};var _0x4b78b7={};var _0x54e9ad;var _0x824b70;return db[_0xe3e3('0x43')][_0xe3e3('0x9a')]({'where':{'id':_0x50fe0f[_0xe3e3('0x5e')]['id']}})[_0xe3e3('0x21')](handleEntityNotFound(_0x5bdebf,null))[_0xe3e3('0x21')](function(_0x23b5cd){if(_0x23b5cd){_0x54e9ad=_0x23b5cd;_0x4b78b7['model']=_[_0xe3e3('0x49')](db[_0xe3e3('0x6b')]['rawAttributes']);_0x4b78b7['query']=_[_0xe3e3('0x49')](_0x50fe0f[_0xe3e3('0x4a')]);_0x4b78b7[_0xe3e3('0x4b')]=_[_0xe3e3('0x4c')](_0x4b78b7['model'],_0x4b78b7[_0xe3e3('0x4a')]);_0x57cec1[_0xe3e3('0x4d')]=_[_0xe3e3('0x4c')](_0x4b78b7['model'],qs['fields'](_0x50fe0f['query'][_0xe3e3('0x4e')]));_0x57cec1['attributes']=_0x57cec1[_0xe3e3('0x4d')][_0xe3e3('0x4f')]?_0x57cec1[_0xe3e3('0x4d')]:_0x4b78b7['model'];_0x57cec1[_0xe3e3('0x52')]=qs[_0xe3e3('0x53')](_0x50fe0f[_0xe3e3('0x4a')][_0xe3e3('0x53')]);_0x57cec1[_0xe3e3('0x56')]=qs[_0xe3e3('0x4b')](_[_0xe3e3('0x54')](_0x50fe0f['query'],_0x4b78b7[_0xe3e3('0x4b')]));if(_0x50fe0f['query']['filter']){_0x57cec1[_0xe3e3('0x56')]=_['merge'](_0x57cec1[_0xe3e3('0x56')],{'$or':_[_0xe3e3('0x42')](_0x57cec1[_0xe3e3('0x4d')],function(_0x21e06b){var _0x52d28b={};_0x52d28b[_0x21e06b]={'$like':'%'+_0x50fe0f[_0xe3e3('0x4a')][_0xe3e3('0x55')]+'%'};return _0x52d28b;})});}_0x57cec1=_[_0xe3e3('0x57')]({},_0x57cec1,_0x50fe0f[_0xe3e3('0x5f')]);return _0x54e9ad[_0xe3e3('0x99')](_0x57cec1);}})[_0xe3e3('0x21')](function(_0x47773c){if(_0x47773c){_0x824b70=_0x47773c['length'];if(!_0x50fe0f[_0xe3e3('0x4a')][_0xe3e3('0x50')](_0xe3e3('0x51'))){_0x57cec1[_0xe3e3('0x32')]=qs[_0xe3e3('0x32')](_0x50fe0f[_0xe3e3('0x4a')][_0xe3e3('0x32')]);_0x57cec1[_0xe3e3('0x30')]=qs[_0xe3e3('0x30')](_0x50fe0f[_0xe3e3('0x4a')][_0xe3e3('0x30')]);}return _0x54e9ad[_0xe3e3('0x99')](_0x57cec1);}})[_0xe3e3('0x21')](function(_0x2c1aae){if(_0x2c1aae){return _0x2c1aae?{'count':_0x824b70,'rows':_0x2c1aae}:null;}})[_0xe3e3('0x21')](respondWithResult(_0x5bdebf,null))[_0xe3e3('0x2c')](handleError(_0x5bdebf,null));}; \ No newline at end of file +var _0xf403=['findAll','show','params','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','order','ChatQueueId','User','findAndCountAll','UserId','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','isArray','getAgents','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','UserProfileResource','destroy','name','send','map','rawAttributes','fieldName','key','model','attributes','intersection','fields','length','query','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','ChatQueue','includeAll','include'];(function(_0x278f93,_0x5d74c6){var _0x47d224=function(_0x3acef8){while(--_0x3acef8){_0x278f93['push'](_0x278f93['shift']());}};_0x47d224(++_0x5d74c6);}(_0xf403,0x178));var _0x3f40=function(_0x457326,_0xd08ec4){_0x457326=_0x457326-0x0;var _0x2a7674=_0xf403[_0x457326];return _0x2a7674;};'use strict';var emlformat=require(_0x3f40('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f40('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f40('0x2'));var moment=require(_0x3f40('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3f40('0x4'));var util=require(_0x3f40('0x5'));var path=require(_0x3f40('0x6'));var sox=require(_0x3f40('0x7'));var csv=require(_0x3f40('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f40('0x9'));var squel=require(_0x3f40('0xa'));var crypto=require(_0x3f40('0xb'));var jsforce=require(_0x3f40('0xc'));var deskjs=require(_0x3f40('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3f40('0xe'));var Papa=require(_0x3f40('0xf'));var Redis=require('ioredis');var authService=require(_0x3f40('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3f40('0x11'));var hardwareService=require(_0x3f40('0x12'));var logger=require(_0x3f40('0x13'))(_0x3f40('0x14'));var utils=require('../../config/utils');var config=require(_0x3f40('0x15'));var licenseUtil=require(_0x3f40('0x16'));var db=require(_0x3f40('0x17'))['db'];config['redis']=_[_0x3f40('0x18')](config[_0x3f40('0x19')],{'host':_0x3f40('0x1a'),'port':0x18eb});var socket=require(_0x3f40('0x1b'))(new Redis(config[_0x3f40('0x19')]));require('./chatQueue.socket')['register'](socket);var jayson=require(_0x3f40('0x1c'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x358e39,_0x17ea36,_0x1f7fcf,_0x149600){return new BPromise(function(_0xce1994,_0x3f3434){var _0x4ace5a=_0x149600||client;return _0x4ace5a[_0x3f40('0x1d')](_0x358e39,_0x1f7fcf)[_0x3f40('0x1e')](function(_0x5a1340){logger[_0x3f40('0x1f')](_0x3f40('0x20'),_0x17ea36,_0x3f40('0x21'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x17ea36,'request\x20sent',JSON[_0x3f40('0x22')](_0x5a1340));if(_0x5a1340[_0x3f40('0x23')]){if(_0x5a1340[_0x3f40('0x23')][_0x3f40('0x24')]===0x1f4){logger[_0x3f40('0x23')](_0x3f40('0x20'),_0x17ea36,_0x5a1340[_0x3f40('0x23')][_0x3f40('0x25')]);return _0x3f3434(_0x5a1340[_0x3f40('0x23')][_0x3f40('0x25')]);}logger[_0x3f40('0x23')]('ChatQueue,\x20%s,\x20%s',_0x17ea36,_0x5a1340[_0x3f40('0x23')][_0x3f40('0x25')]);return _0xce1994(_0x5a1340[_0x3f40('0x23')][_0x3f40('0x25')]);}else{logger[_0x3f40('0x1f')](_0x3f40('0x20'),_0x17ea36,_0x3f40('0x21'));_0xce1994(_0x5a1340[_0x3f40('0x26')]['message']);}})[_0x3f40('0x27')](function(_0x19c75a){logger[_0x3f40('0x23')](_0x3f40('0x20'),_0x17ea36,_0x19c75a);_0x3f3434(_0x19c75a);});});}function respondWithStatusCode(_0x2dcd53,_0x42b0d0){_0x42b0d0=_0x42b0d0||0xcc;return function(_0x19d7ca){if(_0x19d7ca){return _0x2dcd53[_0x3f40('0x28')](_0x42b0d0);}return _0x2dcd53[_0x3f40('0x29')](_0x42b0d0)[_0x3f40('0x2a')]();};}function respondWithResult(_0x5618b5,_0x569ed4){_0x569ed4=_0x569ed4||0xc8;return function(_0x1d92f6){if(_0x1d92f6){return _0x5618b5[_0x3f40('0x29')](_0x569ed4)['json'](_0x1d92f6);}};}function respondWithFilteredResult(_0x28a8b6,_0x35a270){return function(_0x5a6167){if(_0x5a6167){var _0x5c9f88=typeof _0x35a270[_0x3f40('0x2b')]===_0x3f40('0x2c')&&typeof _0x35a270['limit']===_0x3f40('0x2c');var _0x28af24=_0x5a6167[_0x3f40('0x2d')];var _0x10e293=_0x5c9f88?0x0:_0x35a270['offset'];var _0x4736a5=_0x5c9f88?_0x5a6167[_0x3f40('0x2d')]:_0x35a270['offset']+_0x35a270[_0x3f40('0x2e')];var _0x5b4c6c;if(_0x4736a5>=_0x28af24){_0x4736a5=_0x28af24;_0x5b4c6c=0xc8;}else{_0x5b4c6c=0xce;}_0x28a8b6[_0x3f40('0x29')](_0x5b4c6c);return _0x28a8b6[_0x3f40('0x2f')](_0x3f40('0x30'),_0x10e293+'-'+_0x4736a5+'/'+_0x28af24)[_0x3f40('0x31')](_0x5a6167);}return null;};}function patchUpdates(_0x4864c6){return function(_0x3750e7){try{jsonpatch[_0x3f40('0x32')](_0x3750e7,_0x4864c6,!![]);}catch(_0xec19ea){return BPromise[_0x3f40('0x33')](_0xec19ea);}return _0x3750e7['save']();};}function saveUpdates(_0x18927c,_0x58e5d0){return function(_0x5ec603){if(_0x5ec603){return _0x5ec603[_0x3f40('0x34')](_0x18927c)[_0x3f40('0x1e')](function(_0x50cf48){return _0x50cf48;});}return null;};}function removeEntity(_0x42520c,_0x5c1f2f){return function(_0x4b2c00){if(_0x4b2c00){return _0x4b2c00['destroy']()[_0x3f40('0x1e')](function(){var _0x47562c=_0x4b2c00['get']({'plain':!![]});var _0x564157='ChatQueues';return db[_0x3f40('0x35')][_0x3f40('0x36')]({'where':{'type':_0x564157,'resourceId':_0x47562c['id']}})[_0x3f40('0x1e')](function(){return _0x4b2c00;});})[_0x3f40('0x1e')](function(){_0x42520c[_0x3f40('0x29')](0xcc)[_0x3f40('0x2a')]();});}};}function handleEntityNotFound(_0x37347e,_0x38d13b){return function(_0x2b2418){if(!_0x2b2418){_0x37347e[_0x3f40('0x28')](0x194);}return _0x2b2418;};}function handleError(_0x420c77,_0x379a73){_0x379a73=_0x379a73||0x1f4;return function(_0x2deb2f){logger[_0x3f40('0x23')](_0x2deb2f['stack']);if(_0x2deb2f['name']){delete _0x2deb2f[_0x3f40('0x37')];}_0x420c77['status'](_0x379a73)[_0x3f40('0x38')](_0x2deb2f);};}exports['index']=function(_0x485fa5,_0x2975c5){var _0x1905f4={},_0x5a47d5={},_0x11140b={'count':0x0,'rows':[]};var _0x73416b=_[_0x3f40('0x39')](db['ChatQueue'][_0x3f40('0x3a')],function(_0x2b3e39){return{'name':_0x2b3e39[_0x3f40('0x3b')],'type':_0x2b3e39['type'][_0x3f40('0x3c')]};});_0x5a47d5[_0x3f40('0x3d')]=_[_0x3f40('0x39')](_0x73416b,'name');_0x5a47d5['query']=_['keys'](_0x485fa5['query']);_0x5a47d5['filters']=_['intersection'](_0x5a47d5[_0x3f40('0x3d')],_0x5a47d5['query']);_0x1905f4[_0x3f40('0x3e')]=_[_0x3f40('0x3f')](_0x5a47d5[_0x3f40('0x3d')],qs[_0x3f40('0x40')](_0x485fa5['query'][_0x3f40('0x40')]));_0x1905f4['attributes']=_0x1905f4[_0x3f40('0x3e')][_0x3f40('0x41')]?_0x1905f4[_0x3f40('0x3e')]:_0x5a47d5[_0x3f40('0x3d')];if(!_0x485fa5[_0x3f40('0x42')]['hasOwnProperty'](_0x3f40('0x43'))){_0x1905f4[_0x3f40('0x2e')]=qs[_0x3f40('0x2e')](_0x485fa5[_0x3f40('0x42')][_0x3f40('0x2e')]);_0x1905f4[_0x3f40('0x2b')]=qs[_0x3f40('0x2b')](_0x485fa5[_0x3f40('0x42')][_0x3f40('0x2b')]);}_0x1905f4['order']=qs['sort'](_0x485fa5[_0x3f40('0x42')][_0x3f40('0x44')]);_0x1905f4[_0x3f40('0x45')]=qs[_0x3f40('0x46')](_[_0x3f40('0x47')](_0x485fa5['query'],_0x5a47d5[_0x3f40('0x46')]),_0x73416b);if(_0x485fa5[_0x3f40('0x42')][_0x3f40('0x48')]){_0x1905f4[_0x3f40('0x45')]=_[_0x3f40('0x49')](_0x1905f4[_0x3f40('0x45')],{'$or':_[_0x3f40('0x39')](_0x73416b,function(_0x30c943){if(_0x30c943[_0x3f40('0x4a')]!==_0x3f40('0x4b')){var _0x44452c={};_0x44452c[_0x30c943[_0x3f40('0x37')]]={'$like':'%'+_0x485fa5[_0x3f40('0x42')]['filter']+'%'};return _0x44452c;}})});}_0x1905f4=_['merge']({},_0x1905f4,_0x485fa5[_0x3f40('0x4c')]);var _0x582014={'where':_0x1905f4[_0x3f40('0x45')]};return db[_0x3f40('0x4d')][_0x3f40('0x2d')](_0x582014)[_0x3f40('0x1e')](function(_0xa26a51){_0x11140b[_0x3f40('0x2d')]=_0xa26a51;if(_0x485fa5[_0x3f40('0x42')][_0x3f40('0x4e')]){_0x1905f4[_0x3f40('0x4f')]=[{'all':!![]}];}return db[_0x3f40('0x4d')][_0x3f40('0x50')](_0x1905f4);})[_0x3f40('0x1e')](function(_0x29628c){_0x11140b['rows']=_0x29628c;return _0x11140b;})[_0x3f40('0x1e')](respondWithFilteredResult(_0x2975c5,_0x1905f4))['catch'](handleError(_0x2975c5,null));};exports[_0x3f40('0x51')]=function(_0x5a3d9,_0xbc25a){var _0x382ad7={'raw':!![],'where':{'id':_0x5a3d9[_0x3f40('0x52')]['id']}},_0x33ec52={};_0x33ec52[_0x3f40('0x3d')]=_[_0x3f40('0x53')](db['ChatQueue'][_0x3f40('0x3a')]);_0x33ec52['query']=_['keys'](_0x5a3d9[_0x3f40('0x42')]);_0x33ec52[_0x3f40('0x46')]=_[_0x3f40('0x3f')](_0x33ec52[_0x3f40('0x3d')],_0x33ec52['query']);_0x382ad7['attributes']=_[_0x3f40('0x3f')](_0x33ec52['model'],qs['fields'](_0x5a3d9[_0x3f40('0x42')][_0x3f40('0x40')]));_0x382ad7['attributes']=_0x382ad7[_0x3f40('0x3e')][_0x3f40('0x41')]?_0x382ad7['attributes']:_0x33ec52[_0x3f40('0x3d')];if(_0x5a3d9[_0x3f40('0x42')]['includeAll']){_0x382ad7[_0x3f40('0x4f')]=[{'all':!![]}];}_0x382ad7=_[_0x3f40('0x49')]({},_0x382ad7,_0x5a3d9[_0x3f40('0x4c')]);return db[_0x3f40('0x4d')][_0x3f40('0x54')](_0x382ad7)[_0x3f40('0x1e')](handleEntityNotFound(_0xbc25a,null))[_0x3f40('0x1e')](respondWithResult(_0xbc25a,null))[_0x3f40('0x27')](handleError(_0xbc25a,null));};exports['create']=function(_0x28a05b,_0x3993ac){return db['ChatQueue'][_0x3f40('0x55')](_0x28a05b[_0x3f40('0x56')],{})['then'](function(_0x4dc53a){var _0x555c5c=_0x28a05b['user'][_0x3f40('0x57')]({'plain':!![]});if(!_0x555c5c)throw new Error(_0x3f40('0x58'));if(_0x555c5c[_0x3f40('0x59')]===_0x3f40('0x5a')){var _0x471262=_0x4dc53a['get']({'plain':!![]});var _0x3ca021=_0x3f40('0x5b');return db[_0x3f40('0x5c')][_0x3f40('0x54')]({'where':{'name':_0x3ca021,'userProfileId':_0x555c5c['userProfileId']},'raw':!![]})[_0x3f40('0x1e')](function(_0x1320dd){if(_0x1320dd&&_0x1320dd[_0x3f40('0x5d')]===0x0){return db[_0x3f40('0x35')][_0x3f40('0x55')]({'name':_0x471262[_0x3f40('0x37')],'resourceId':_0x471262['id'],'type':_0x1320dd[_0x3f40('0x37')],'sectionId':_0x1320dd['id']},{})[_0x3f40('0x1e')](function(){return _0x4dc53a;});}else{return _0x4dc53a;}})[_0x3f40('0x27')](function(_0x4e0d9f){logger[_0x3f40('0x23')](_0x3f40('0x5e'),_0x4e0d9f);throw _0x4e0d9f;});}return _0x4dc53a;})['then'](respondWithResult(_0x3993ac,0xc9))['catch'](handleError(_0x3993ac,null));};exports[_0x3f40('0x34')]=function(_0x281d58,_0x127cd5){if(_0x281d58['body']['id']){delete _0x281d58[_0x3f40('0x56')]['id'];}return db[_0x3f40('0x4d')][_0x3f40('0x54')]({'where':{'id':_0x281d58[_0x3f40('0x52')]['id']}})[_0x3f40('0x1e')](handleEntityNotFound(_0x127cd5,null))[_0x3f40('0x1e')](saveUpdates(_0x281d58[_0x3f40('0x56')],null))[_0x3f40('0x1e')](respondWithResult(_0x127cd5,null))[_0x3f40('0x27')](handleError(_0x127cd5,null));};exports['destroy']=function(_0x189493,_0x3081a3){return db[_0x3f40('0x4d')][_0x3f40('0x54')]({'where':{'id':_0x189493[_0x3f40('0x52')]['id']}})['then'](handleEntityNotFound(_0x3081a3,null))[_0x3f40('0x1e')](removeEntity(_0x3081a3,null))[_0x3f40('0x27')](handleError(_0x3081a3,null));};exports[_0x3f40('0x5f')]=function(_0x1b121d,_0x428cc4){return db[_0x3f40('0x4d')][_0x3f40('0x5f')]()[_0x3f40('0x1e')](respondWithResult(_0x428cc4,null))[_0x3f40('0x27')](handleError(_0x428cc4,null));};exports[_0x3f40('0x60')]=function(_0x48acaf,_0x275517,_0x5be6bb){var _0x785aec={'raw':!![],'where':{}},_0x57709d={},_0x48d8cb;return db[_0x3f40('0x4d')][_0x3f40('0x61')]({'where':{'id':_0x48acaf['params']['id']}})[_0x3f40('0x1e')](handleEntityNotFound(_0x275517,null))[_0x3f40('0x1e')](function(_0xe93f64){if(_0xe93f64){_0x48d8cb=_0xe93f64['get']({'plain':!![]});_0x57709d[_0x3f40('0x3d')]=_['keys'](db[_0x3f40('0x62')][_0x3f40('0x3a')]);_0x57709d['query']=_[_0x3f40('0x53')](_0x48acaf[_0x3f40('0x42')]);_0x57709d[_0x3f40('0x46')]=_['intersection'](_0x57709d[_0x3f40('0x3d')],_0x57709d['query']);_0x785aec[_0x3f40('0x3e')]=_[_0x3f40('0x3f')](_0x57709d['model'],qs[_0x3f40('0x40')](_0x48acaf['query'][_0x3f40('0x40')]));_0x785aec[_0x3f40('0x3e')]=_0x785aec[_0x3f40('0x3e')][_0x3f40('0x41')]?_0x785aec[_0x3f40('0x3e')]:_0x57709d[_0x3f40('0x3d')];if(!_0x48acaf[_0x3f40('0x42')][_0x3f40('0x63')](_0x3f40('0x43'))){_0x785aec[_0x3f40('0x2e')]=qs[_0x3f40('0x2e')](_0x48acaf[_0x3f40('0x42')][_0x3f40('0x2e')]);_0x785aec[_0x3f40('0x2b')]=qs[_0x3f40('0x2b')](_0x48acaf[_0x3f40('0x42')][_0x3f40('0x2b')]);}_0x785aec[_0x3f40('0x64')]=qs[_0x3f40('0x44')](_0x48acaf[_0x3f40('0x42')][_0x3f40('0x44')]);_0x785aec['where']=qs['filters'](_[_0x3f40('0x47')](_0x48acaf[_0x3f40('0x42')],_0x57709d[_0x3f40('0x46')]));_0x785aec[_0x3f40('0x45')][_0x3f40('0x65')]=_0xe93f64['id'];if(_0x48acaf[_0x3f40('0x42')][_0x3f40('0x48')]){_0x785aec[_0x3f40('0x45')]=_['merge'](_0x785aec[_0x3f40('0x45')],{'$or':_[_0x3f40('0x39')](_0x785aec[_0x3f40('0x3e')],function(_0x19aac4){var _0x267db4={};_0x267db4[_0x19aac4]={'$like':'%'+_0x48acaf[_0x3f40('0x42')][_0x3f40('0x48')]+'%'};return _0x267db4;})});}_0x785aec=_[_0x3f40('0x49')]({},_0x785aec,_0x48acaf[_0x3f40('0x4c')]);return db[_0x3f40('0x62')][_0x3f40('0x50')](_0x785aec);}})['then'](function(_0x2f792e){if(_0x2f792e){return db[_0x3f40('0x66')][_0x3f40('0x67')]({'where':{'id':_[_0x3f40('0x39')](_0x2f792e,_0x3f40('0x68')),'role':'agent'},'attributes':['id',_0x3f40('0x37'),_0x3f40('0x69'),_0x3f40('0x6a'),_0x3f40('0x6b')]});}})[_0x3f40('0x1e')](function(_0x106b09){if(_0x106b09){return{'count':_0x106b09[_0x3f40('0x2d')],'rows':_[_0x3f40('0x39')](_0x106b09['rows'],function(_0x462631){return{'membername':_0x462631[_0x3f40('0x37')],'UserId':_0x462631['id'],'queue_name':_0x48d8cb[_0x3f40('0x37')],'ChatQueueId':_0x48d8cb['id'],'interface':util[_0x3f40('0x6c')](_0x3f40('0x6d'),_0x3f40('0x6e'),_0x462631[_0x3f40('0x37')]),'penalty':0x0,'paused':_0x462631[_0x3f40('0x69')],'createdAt':_0x462631[_0x3f40('0x6b')],'updatedAt':_0x462631[_0x3f40('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3f40('0x1e')](respondWithFilteredResult(_0x275517,_0x785aec))['catch'](handleError(_0x275517,null));};exports['getTeams']=function(_0x559d8b,_0xb193df,_0x1a3186){var _0x2a8eed={};var _0x3fea06={};var _0x439fb3;var _0x3ddea7;return db[_0x3f40('0x4d')][_0x3f40('0x61')]({'where':{'id':_0x559d8b[_0x3f40('0x52')]['id']}})[_0x3f40('0x1e')](handleEntityNotFound(_0xb193df,null))[_0x3f40('0x1e')](function(_0x21b2bd){if(_0x21b2bd){_0x439fb3=_0x21b2bd;_0x3fea06['model']=_[_0x3f40('0x53')](db['Team'][_0x3f40('0x3a')]);_0x3fea06[_0x3f40('0x42')]=_['keys'](_0x559d8b[_0x3f40('0x42')]);_0x3fea06[_0x3f40('0x46')]=_['intersection'](_0x3fea06[_0x3f40('0x3d')],_0x3fea06['query']);_0x2a8eed['attributes']=_[_0x3f40('0x3f')](_0x3fea06[_0x3f40('0x3d')],qs[_0x3f40('0x40')](_0x559d8b[_0x3f40('0x42')]['fields']));_0x2a8eed[_0x3f40('0x3e')]=_0x2a8eed['attributes'][_0x3f40('0x41')]?_0x2a8eed[_0x3f40('0x3e')]:_0x3fea06[_0x3f40('0x3d')];_0x2a8eed[_0x3f40('0x64')]=qs[_0x3f40('0x44')](_0x559d8b[_0x3f40('0x42')]['sort']);_0x2a8eed[_0x3f40('0x45')]=qs[_0x3f40('0x46')](_[_0x3f40('0x47')](_0x559d8b['query'],_0x3fea06[_0x3f40('0x46')]));if(_0x559d8b[_0x3f40('0x42')][_0x3f40('0x48')]){_0x2a8eed[_0x3f40('0x45')]=_[_0x3f40('0x49')](_0x2a8eed[_0x3f40('0x45')],{'$or':_[_0x3f40('0x39')](_0x2a8eed[_0x3f40('0x3e')],function(_0x5c9a47){var _0x8d1429={};_0x8d1429[_0x5c9a47]={'$like':'%'+_0x559d8b['query'][_0x3f40('0x48')]+'%'};return _0x8d1429;})});}_0x2a8eed=_['merge']({},_0x2a8eed,_0x559d8b[_0x3f40('0x4c')]);return _0x439fb3[_0x3f40('0x6f')](_0x2a8eed);}})['then'](function(_0x1f5e7c){if(_0x1f5e7c){_0x3ddea7=_0x1f5e7c[_0x3f40('0x41')];if(!_0x559d8b[_0x3f40('0x42')][_0x3f40('0x63')]('nolimit')){_0x2a8eed['limit']=qs[_0x3f40('0x2e')](_0x559d8b[_0x3f40('0x42')]['limit']);_0x2a8eed[_0x3f40('0x2b')]=qs[_0x3f40('0x2b')](_0x559d8b[_0x3f40('0x42')]['offset']);}return _0x439fb3[_0x3f40('0x6f')](_0x2a8eed);}})[_0x3f40('0x1e')](function(_0x12160){if(_0x12160){return _0x12160?{'count':_0x3ddea7,'rows':_0x12160}:null;}})['then'](respondWithResult(_0xb193df,null))[_0x3f40('0x27')](handleError(_0xb193df,null));};exports[_0x3f40('0x70')]=function(_0x577afc,_0x3430e0,_0x471486){var _0x5b80dc=_0x577afc[_0x3f40('0x56')]['ids'];return db[_0x3f40('0x71')][_0x3f40('0x50')]({'where':{'id':_0x5b80dc},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3f40('0x72'),'attributes':['id',_0x3f40('0x37'),_0x3f40('0x73'),_0x3f40('0x74'),'interface'],'raw':!![]}]})[_0x3f40('0x1e')](function(_0x3547f2){if(_0x3547f2){var _0x284723=_['flatMap'](_0x3547f2,function(_0x5c7f77){var _0x32d9ea=_0x5c7f77[_0x3f40('0x57')]({'plain':!![]});return _0x32d9ea[_0x3f40('0x72')];});return db[_0x3f40('0x4d')][_0x3f40('0x54')]({'where':{'id':_0x577afc[_0x3f40('0x52')]['id']}})[_0x3f40('0x1e')](function(_0x4ddf06){return db[_0x3f40('0x75')][_0x3f40('0x76')](function(_0x5ebcbc){return _0x4ddf06[_0x3f40('0x70')](_0x5b80dc,{'transaction':_0x5ebcbc})[_0x3f40('0x1e')](function(){return BPromise[_0x3f40('0x77')](_0x284723,function(_0x3a522e){return db['UserChatQueue'][_0x3f40('0x78')]({'where':{'UserId':_0x3a522e['id'],'ChatQueueId':_0x577afc['params']['id']},'transaction':_0x5ebcbc});});})[_0x3f40('0x1e')](function(){_0x284723[_0x3f40('0x79')](function(_0x13d490){socket[_0x3f40('0x7a')](_0x3f40('0x7b'),{'UserId':_0x13d490['id'],'ChatQueueId':_0x4ddf06['id']});});});});});}})[_0x3f40('0x1e')](respondWithStatusCode(_0x3430e0,null))[_0x3f40('0x27')](handleError(_0x3430e0,null));};exports[_0x3f40('0x7c')]=function(_0x486552,_0x15c93e,_0x44881f){return db[_0x3f40('0x71')]['findAll']({'where':{'id':_0x486552[_0x3f40('0x42')][_0x3f40('0x7d')]},'attributes':['id'],'include':[{'model':db[_0x3f40('0x66')],'as':_0x3f40('0x72'),'attributes':['id'],'raw':!![]}]})[_0x3f40('0x1e')](handleEntityNotFound(_0x15c93e,null))[_0x3f40('0x1e')](function(_0x358218){var _0x572143=_['map'](_0x358218,'id');var _0x51fe2f=[];var _0x31b04e=[];var _0x12246d=squel[_0x3f40('0x7e')]();_0x12246d[_0x3f40('0x7f')](_0x3f40('0x80'))[_0x3f40('0x81')](_0x3f40('0x82'),'tq')[_0x3f40('0x83')](_0x3f40('0x84'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x3f40('0x85'),_0x486552['params']['id']);for(var _0x498f3d=0x0;_0x498f3d<_0x358218['length'];_0x498f3d+=0x1){let _0x187138=_0x358218[_0x498f3d];for(var _0xb5b3f1=0x0;_0xb5b3f1<_0x187138['Agents'][_0x3f40('0x41')];_0xb5b3f1+=0x1){let _0x43d666=_0x187138['Agents'][_0xb5b3f1];var _0x482c9f=_0x12246d[_0x3f40('0x86')]();_0x482c9f[_0x3f40('0x45')](_0x3f40('0x87'),_0x43d666['id']);_0x31b04e[_0x3f40('0x88')](db[_0x3f40('0x75')]['query'](_0x482c9f[_0x3f40('0x89')](),{'type':db[_0x3f40('0x75')][_0x3f40('0x8a')][_0x3f40('0x8b')]})[_0x3f40('0x1e')](function(_0x5df1f1){if(_0x5df1f1[_0x3f40('0x41')]===0x1){return _0x43d666['id'];}else{var _0x2444fc=_[_0x3f40('0x8c')](_['map'](_0x5df1f1,_0x3f40('0x8d')),function(_0x328399){return _[_0x3f40('0x8e')](_0x572143,_0x328399);});if(_0x2444fc){return _0x43d666['id'];}}}));}}return BPromise[_0x3f40('0x8f')](_0x31b04e)[_0x3f40('0x1e')](function(_0x1bbe7f){_0x51fe2f=_(_0x51fe2f)['union'](_0x1bbe7f)[_0x3f40('0x90')]()[_0x3f40('0x91')]();return db[_0x3f40('0x4d')][_0x3f40('0x54')]({'where':{'id':_0x486552[_0x3f40('0x52')]['id']}})[_0x3f40('0x1e')](function(_0x53e352){return db[_0x3f40('0x75')]['transaction'](function(_0x3247b3){return _0x53e352[_0x3f40('0x7c')](_0x486552[_0x3f40('0x42')][_0x3f40('0x7d')],{'transaction':_0x3247b3})[_0x3f40('0x1e')](function(){if(!_[_0x3f40('0x92')](_0x51fe2f)){return _0x53e352[_0x3f40('0x93')](_0x51fe2f,{'transaction':_0x3247b3});}})[_0x3f40('0x1e')](function(){_0x51fe2f[_0x3f40('0x79')](function(_0x1e79b8){socket[_0x3f40('0x7a')](_0x3f40('0x94'),{'UserId':_0x1e79b8,'ChatQueueId':_0x53e352['id']});});});});});});})['then'](respondWithStatusCode(_0x15c93e,null))['catch'](handleError(_0x15c93e,null));};exports['addAgents']=function(_0x1ecbec,_0x3c539d,_0x1262ae){return db[_0x3f40('0x4d')]['find']({'where':{'id':_0x1ecbec[_0x3f40('0x52')]['id']}})[_0x3f40('0x1e')](handleEntityNotFound(_0x3c539d,null))[_0x3f40('0x1e')](function(_0x2d49de){if(_0x2d49de){return _0x2d49de[_0x3f40('0x95')](_0x1ecbec[_0x3f40('0x56')]['ids'],_['omit'](_0x1ecbec[_0x3f40('0x56')],[_0x3f40('0x7d'),'id'])||{})['spread'](function(_0x2ab420){for(var _0x1a5dea=0x0;_0x1a5dea<_0x1ecbec[_0x3f40('0x56')][_0x3f40('0x7d')][_0x3f40('0x41')];_0x1a5dea+=0x1){socket[_0x3f40('0x7a')](_0x3f40('0x7b'),{'UserId':Number(_0x1ecbec[_0x3f40('0x56')][_0x3f40('0x7d')][_0x1a5dea]),'ChatQueueId':Number(_0x1ecbec[_0x3f40('0x52')]['id'])});}return _0x2ab420;});}})[_0x3f40('0x1e')](respondWithResult(_0x3c539d,null))[_0x3f40('0x27')](handleError(_0x3c539d,null));};exports[_0x3f40('0x93')]=function(_0x2309b3,_0x487e41,_0x53e491){return db['ChatQueue']['find']({'where':{'id':_0x2309b3['params']['id']}})['then'](handleEntityNotFound(_0x487e41,null))['then'](function(_0x4049bc){if(_0x4049bc){return _0x4049bc[_0x3f40('0x93')](_0x2309b3[_0x3f40('0x42')]['ids'])['then'](function(){if(_[_0x3f40('0x96')](_0x2309b3[_0x3f40('0x42')]['ids'])){for(var _0x445d47=0x0;_0x445d47<_0x2309b3[_0x3f40('0x42')]['ids']['length'];_0x445d47+=0x1){socket[_0x3f40('0x7a')](_0x3f40('0x94'),{'UserId':Number(_0x2309b3[_0x3f40('0x42')][_0x3f40('0x7d')][_0x445d47]),'ChatQueueId':Number(_0x2309b3[_0x3f40('0x52')]['id'])});}}else{socket[_0x3f40('0x7a')](_0x3f40('0x94'),{'UserId':Number(_0x2309b3[_0x3f40('0x42')][_0x3f40('0x7d')]),'ChatQueueId':Number(_0x2309b3['params']['id'])});}});}})[_0x3f40('0x1e')](respondWithStatusCode(_0x487e41,null))[_0x3f40('0x27')](handleError(_0x487e41,null));};exports['getAgents']=function(_0x2982aa,_0x1fab52,_0x4eb3c5){var _0x50fe62={};var _0x4f0cd7={};var _0x1cebb8;var _0x27385f;return db[_0x3f40('0x4d')]['findOne']({'where':{'id':_0x2982aa[_0x3f40('0x52')]['id']}})[_0x3f40('0x1e')](handleEntityNotFound(_0x1fab52,null))['then'](function(_0x276b08){if(_0x276b08){_0x1cebb8=_0x276b08;_0x4f0cd7[_0x3f40('0x3d')]=_[_0x3f40('0x53')](db[_0x3f40('0x66')][_0x3f40('0x3a')]);_0x4f0cd7[_0x3f40('0x42')]=_['keys'](_0x2982aa[_0x3f40('0x42')]);_0x4f0cd7[_0x3f40('0x46')]=_[_0x3f40('0x3f')](_0x4f0cd7[_0x3f40('0x3d')],_0x4f0cd7[_0x3f40('0x42')]);_0x50fe62[_0x3f40('0x3e')]=_[_0x3f40('0x3f')](_0x4f0cd7[_0x3f40('0x3d')],qs['fields'](_0x2982aa['query'][_0x3f40('0x40')]));_0x50fe62[_0x3f40('0x3e')]=_0x50fe62['attributes'][_0x3f40('0x41')]?_0x50fe62['attributes']:_0x4f0cd7[_0x3f40('0x3d')];_0x50fe62[_0x3f40('0x64')]=qs[_0x3f40('0x44')](_0x2982aa[_0x3f40('0x42')][_0x3f40('0x44')]);_0x50fe62[_0x3f40('0x45')]=qs[_0x3f40('0x46')](_[_0x3f40('0x47')](_0x2982aa[_0x3f40('0x42')],_0x4f0cd7[_0x3f40('0x46')]));if(_0x2982aa[_0x3f40('0x42')][_0x3f40('0x48')]){_0x50fe62[_0x3f40('0x45')]=_['merge'](_0x50fe62[_0x3f40('0x45')],{'$or':_['map'](_0x50fe62[_0x3f40('0x3e')],function(_0x1fb853){var _0x17abb2={};_0x17abb2[_0x1fb853]={'$like':'%'+_0x2982aa[_0x3f40('0x42')][_0x3f40('0x48')]+'%'};return _0x17abb2;})});}_0x50fe62=_[_0x3f40('0x49')]({},_0x50fe62,_0x2982aa[_0x3f40('0x4c')]);return _0x1cebb8[_0x3f40('0x97')](_0x50fe62);}})[_0x3f40('0x1e')](function(_0x27ad17){if(_0x27ad17){_0x27385f=_0x27ad17[_0x3f40('0x41')];if(!_0x2982aa['query'][_0x3f40('0x63')](_0x3f40('0x43'))){_0x50fe62['limit']=qs[_0x3f40('0x2e')](_0x2982aa[_0x3f40('0x42')][_0x3f40('0x2e')]);_0x50fe62[_0x3f40('0x2b')]=qs['offset'](_0x2982aa[_0x3f40('0x42')][_0x3f40('0x2b')]);}return _0x1cebb8[_0x3f40('0x97')](_0x50fe62);}})[_0x3f40('0x1e')](function(_0x201e48){if(_0x201e48){return _0x201e48?{'count':_0x27385f,'rows':_0x201e48}:null;}})[_0x3f40('0x1e')](respondWithResult(_0x1fab52,null))[_0x3f40('0x27')](handleError(_0x1fab52,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 37f558e..3c291fd 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 _0x6246=['hasOwnProperty','hook','../../mysqldb','ChatQueue','save','remove','emit'];(function(_0x3aa370,_0x49c3de){var _0x3d1860=function(_0x3382e8){while(--_0x3382e8){_0x3aa370['push'](_0x3aa370['shift']());}};_0x3d1860(++_0x49c3de);}(_0x6246,0x1c2));var _0x6624=function(_0x2fca3c,_0xbe8fa5){_0x2fca3c=_0x2fca3c-0x0;var _0x1d8d95=_0x6246[_0x2fca3c];return _0x1d8d95;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x6624('0x0'))['db'][_0x6624('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6624('0x2'),'afterUpdate':'update','afterDestroy':_0x6624('0x3')};function emitEvent(_0x39a434){return function(_0x218e2d,_0x3cd53f,_0x8736c6){ChatQueueEvents[_0x6624('0x4')](_0x39a434+':'+_0x218e2d['id'],_0x218e2d);ChatQueueEvents[_0x6624('0x4')](_0x39a434,_0x218e2d);_0x8736c6(null);};}for(var e in events){if(events[_0x6624('0x5')](e)){var event=events[e];ChatQueue[_0x6624('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xf9ec=['../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0xf9ec,0x128));var _0xcf9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf9ec[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xcf9e('0x0'));var ChatQueue=require(_0xcf9e('0x1'))['db'][_0xcf9e('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xcf9e('0x3')](0x0);var events={'afterCreate':_0xcf9e('0x4'),'afterUpdate':_0xcf9e('0x5'),'afterDestroy':_0xcf9e('0x6')};function emitEvent(_0x10dced){return function(_0x590148,_0x244049,_0x524adf){ChatQueueEvents[_0xcf9e('0x7')](_0x10dced+':'+_0x590148['id'],_0x590148);ChatQueueEvents['emit'](_0x10dced,_0x590148);_0x524adf(null);};}for(var e in events){if(events[_0xcf9e('0x8')](e)){var event=events[e];ChatQueue[_0xcf9e('0x9')](e,emitEvent(event));}}module[_0xcf9e('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 1ad952d..72156fa 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 _0x8a25=['../../config/logger','moment','request-promise','path','../../config/environment','exports','define','ChatQueue','lodash','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8a25,0x94));var _0x58a2=function(_0x265b08,_0x505063){_0x265b08=_0x265b08-0x0;var _0xb60ab=_0x8a25[_0x265b08];return _0xb60ab;};'use strict';var _=require(_0x58a2('0x0'));var util=require(_0x58a2('0x1'));var logger=require(_0x58a2('0x2'))('api');var moment=require(_0x58a2('0x3'));var BPromise=require('bluebird');var rp=require(_0x58a2('0x4'));var fs=require('fs');var path=require(_0x58a2('0x5'));var rimraf=require('rimraf');var config=require(_0x58a2('0x6'));var attributes=require('./chatQueue.attributes');module[_0x58a2('0x7')]=function(_0x426334,_0x297f14){return _0x426334[_0x58a2('0x8')](_0x58a2('0x9'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98fa=['bluebird','request-promise','rimraf','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','api'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x98fa,0x152));var _0xa98f=function(_0x900a62,_0x52889d){_0x900a62=_0x900a62-0x0;var _0x1f537a=_0x98fa[_0x900a62];return _0x1f537a;};'use strict';var _=require(_0xa98f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa98f('0x1'));var moment=require('moment');var BPromise=require(_0xa98f('0x2'));var rp=require(_0xa98f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa98f('0x4'));var config=require('../../config/environment');var attributes=require(_0xa98f('0x5'));module[_0xa98f('0x6')]=function(_0x1ac0f6,_0x4217eb){return _0x1ac0f6[_0xa98f('0x7')](_0xa98f('0x8'),attributes,{'tableName':_0xa98f('0x9'),'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 a74fb5d..431299d 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 _0x5b0f=['ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','find','ShowChatQueue','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','info'];(function(_0x127155,_0x25c0be){var _0x1aac6a=function(_0x352c31){while(--_0x352c31){_0x127155['push'](_0x127155['shift']());}};_0x1aac6a(++_0x25c0be);}(_0x5b0f,0xde));var _0xf5b0=function(_0x43c6fa,_0x2744f5){_0x43c6fa=_0x43c6fa-0x0;var _0x2f08d7=_0x5b0f[_0x43c6fa];return _0x2f08d7;};'use strict';var _=require('lodash');var util=require(_0xf5b0('0x0'));var moment=require('moment');var BPromise=require(_0xf5b0('0x1'));var rs=require(_0xf5b0('0x2'));var fs=require('fs');var Redis=require(_0xf5b0('0x3'));var db=require(_0xf5b0('0x4'))['db'];var utils=require(_0xf5b0('0x5'));var logger=require(_0xf5b0('0x6'))(_0xf5b0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf5b0('0x8')][_0xf5b0('0x9')]({'port':0x232a});config[_0xf5b0('0xa')]=_[_0xf5b0('0xb')](config['redis'],{'host':_0xf5b0('0xc'),'port':0x18eb});var socket=require(_0xf5b0('0xd'))(new Redis(config['redis']));require(_0xf5b0('0xe'))[_0xf5b0('0xf')](socket);function respondWithRpcPromise(_0x238d58,_0x4a79e5,_0xa981a7){return new BPromise(function(_0xaee4ce,_0x1fbe22){return client[_0xf5b0('0x10')](_0x238d58,_0xa981a7)['then'](function(_0x11e678){logger[_0xf5b0('0x11')](_0xf5b0('0x12'),_0x4a79e5,_0xf5b0('0x13'));logger[_0xf5b0('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x4a79e5,_0xf5b0('0x13'),JSON[_0xf5b0('0x15')](_0x11e678));if(_0x11e678[_0xf5b0('0x16')]){if(_0x11e678['error']['code']===0x1f4){logger[_0xf5b0('0x16')](_0xf5b0('0x12'),_0x4a79e5,_0x11e678[_0xf5b0('0x16')]['message']);return _0x1fbe22(_0x11e678[_0xf5b0('0x16')][_0xf5b0('0x17')]);}logger[_0xf5b0('0x16')](_0xf5b0('0x12'),_0x4a79e5,_0x11e678[_0xf5b0('0x16')][_0xf5b0('0x17')]);return _0xaee4ce(_0x11e678[_0xf5b0('0x16')][_0xf5b0('0x17')]);}else{logger[_0xf5b0('0x11')]('ChatQueue,\x20%s,\x20%s',_0x4a79e5,_0xf5b0('0x13'));_0xaee4ce(_0x11e678[_0xf5b0('0x18')][_0xf5b0('0x17')]);}})[_0xf5b0('0x19')](function(_0x2b55b3){logger[_0xf5b0('0x16')](_0xf5b0('0x12'),_0x4a79e5,_0x2b55b3);_0x1fbe22(_0x2b55b3);});});}exports[_0xf5b0('0x1a')]=function(_0x1ecd3d){var _0x4f46d8=this;return new Promise(function(_0x4f58ea,_0x1ec5a9){return db[_0xf5b0('0x1b')][_0xf5b0('0x1c')]({'raw':_0x1ecd3d[_0xf5b0('0x1d')]?_0x1ecd3d[_0xf5b0('0x1d')][_0xf5b0('0x1e')]===undefined?!![]:![]:!![],'where':_0x1ecd3d[_0xf5b0('0x1d')]?_0x1ecd3d[_0xf5b0('0x1d')][_0xf5b0('0x1f')]||null:null,'attributes':_0x1ecd3d[_0xf5b0('0x1d')]?_0x1ecd3d[_0xf5b0('0x1d')][_0xf5b0('0x20')]||null:null,'limit':_0x1ecd3d[_0xf5b0('0x1d')]?_0x1ecd3d[_0xf5b0('0x1d')][_0xf5b0('0x21')]||null:null,'include':_0x1ecd3d[_0xf5b0('0x1d')]?_0x1ecd3d[_0xf5b0('0x1d')][_0xf5b0('0x22')]?_[_0xf5b0('0x23')](_0x1ecd3d[_0xf5b0('0x1d')][_0xf5b0('0x22')],function(_0x54c678){return{'model':db[_0x54c678[_0xf5b0('0x24')]],'as':_0x54c678['as'],'attributes':_0x54c678[_0xf5b0('0x20')],'include':_0x54c678[_0xf5b0('0x22')]?_[_0xf5b0('0x23')](_0x54c678[_0xf5b0('0x22')],function(_0x367ceb){return{'model':db[_0x367ceb['model']],'as':_0x367ceb['as'],'attributes':_0x367ceb['attributes'],'include':_0x367ceb[_0xf5b0('0x22')]?_[_0xf5b0('0x23')](_0x367ceb[_0xf5b0('0x22')],function(_0x541503){return{'model':db[_0x541503[_0xf5b0('0x24')]],'as':_0x541503['as'],'attributes':_0x541503[_0xf5b0('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5b0('0x25')](function(_0x2abdfc){logger[_0xf5b0('0x11')]('GetChatQueue',_0x1ecd3d);logger[_0xf5b0('0x14')](_0xf5b0('0x1a'),_0x1ecd3d,JSON[_0xf5b0('0x15')](_0x2abdfc));_0x4f58ea(_0x2abdfc);})[_0xf5b0('0x19')](function(_0x3b7649){logger[_0xf5b0('0x16')](_0xf5b0('0x1a'),_0x3b7649[_0xf5b0('0x17')],_0x1ecd3d);_0x1ec5a9(_0x4f46d8[_0xf5b0('0x16')](0x1f4,_0x3b7649['message']));});});};exports['ShowChatQueue']=function(_0x1546c6){var _0x41b948=this;return new Promise(function(_0x25e97c,_0x3bcaa9){return db[_0xf5b0('0x1b')][_0xf5b0('0x26')]({'raw':_0x1546c6[_0xf5b0('0x1d')]?_0x1546c6[_0xf5b0('0x1d')][_0xf5b0('0x1e')]===undefined?!![]:![]:!![],'where':_0x1546c6[_0xf5b0('0x1d')]?_0x1546c6[_0xf5b0('0x1d')][_0xf5b0('0x1f')]||null:null,'attributes':_0x1546c6[_0xf5b0('0x1d')]?_0x1546c6[_0xf5b0('0x1d')][_0xf5b0('0x20')]||null:null,'include':_0x1546c6[_0xf5b0('0x1d')]?_0x1546c6[_0xf5b0('0x1d')][_0xf5b0('0x22')]?_[_0xf5b0('0x23')](_0x1546c6[_0xf5b0('0x1d')][_0xf5b0('0x22')],function(_0x461a50){return{'model':db[_0x461a50[_0xf5b0('0x24')]],'as':_0x461a50['as'],'attributes':_0x461a50[_0xf5b0('0x20')],'include':_0x461a50[_0xf5b0('0x22')]?_[_0xf5b0('0x23')](_0x461a50['include'],function(_0x5d9ce3){return{'model':db[_0x5d9ce3[_0xf5b0('0x24')]],'as':_0x5d9ce3['as'],'attributes':_0x5d9ce3['attributes'],'include':_0x5d9ce3['include']?_[_0xf5b0('0x23')](_0x5d9ce3['include'],function(_0x5cf0c0){return{'model':db[_0x5cf0c0['model']],'as':_0x5cf0c0['as'],'attributes':_0x5cf0c0[_0xf5b0('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5b0('0x25')](function(_0x4636a5){logger['info'](_0xf5b0('0x27'),_0x1546c6);logger['debug'](_0xf5b0('0x27'),_0x1546c6,JSON['stringify'](_0x4636a5));_0x25e97c(_0x4636a5);})[_0xf5b0('0x19')](function(_0x321bc9){logger[_0xf5b0('0x16')]('ShowChatQueue',_0x321bc9[_0xf5b0('0x17')],_0x1546c6);_0x3bcaa9(_0x41b948[_0xf5b0('0x16')](0x1f4,_0x321bc9[_0xf5b0('0x17')]));});});}; \ No newline at end of file +var _0xfde3=['./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetChatQueue','ChatQueue','options','raw','where','attributes','include','model','map','info','find','ShowChatQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x101f49,_0x2618b4){var _0x1cf552=function(_0x15d0d1){while(--_0x15d0d1){_0x101f49['push'](_0x101f49['shift']());}};_0x1cf552(++_0x2618b4);}(_0xfde3,0x19f));var _0x3fde=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xfde3[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x3fde('0x0'));var util=require(_0x3fde('0x1'));var moment=require(_0x3fde('0x2'));var BPromise=require(_0x3fde('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3fde('0x4'));var db=require(_0x3fde('0x5'))['db'];var utils=require(_0x3fde('0x6'));var logger=require('../../config/logger')(_0x3fde('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3fde('0x8')][_0x3fde('0x9')]({'port':0x232a});config['redis']=_[_0x3fde('0xa')](config[_0x3fde('0xb')],{'host':_0x3fde('0xc'),'port':0x18eb});var socket=require(_0x3fde('0xd'))(new Redis(config[_0x3fde('0xb')]));require(_0x3fde('0xe'))[_0x3fde('0xf')](socket);function respondWithRpcPromise(_0x10c0cd,_0x46fd1f,_0x367c76){return new BPromise(function(_0x1d749e,_0x2ad60c){return client[_0x3fde('0x10')](_0x10c0cd,_0x367c76)[_0x3fde('0x11')](function(_0x86a077){logger['info'](_0x3fde('0x12'),_0x46fd1f,'request\x20sent');logger[_0x3fde('0x13')](_0x3fde('0x14'),_0x46fd1f,'request\x20sent',JSON[_0x3fde('0x15')](_0x86a077));if(_0x86a077[_0x3fde('0x16')]){if(_0x86a077[_0x3fde('0x16')]['code']===0x1f4){logger[_0x3fde('0x16')](_0x3fde('0x12'),_0x46fd1f,_0x86a077[_0x3fde('0x16')][_0x3fde('0x17')]);return _0x2ad60c(_0x86a077[_0x3fde('0x16')]['message']);}logger[_0x3fde('0x16')](_0x3fde('0x12'),_0x46fd1f,_0x86a077[_0x3fde('0x16')][_0x3fde('0x17')]);return _0x1d749e(_0x86a077[_0x3fde('0x16')][_0x3fde('0x17')]);}else{logger['info'](_0x3fde('0x12'),_0x46fd1f,_0x3fde('0x18'));_0x1d749e(_0x86a077[_0x3fde('0x19')][_0x3fde('0x17')]);}})[_0x3fde('0x1a')](function(_0x1f0fbc){logger[_0x3fde('0x16')](_0x3fde('0x12'),_0x46fd1f,_0x1f0fbc);_0x2ad60c(_0x1f0fbc);});});}exports[_0x3fde('0x1b')]=function(_0x370219){var _0x412b0d=this;return new Promise(function(_0x3f664b,_0x5787d4){return db[_0x3fde('0x1c')]['findAll']({'raw':_0x370219[_0x3fde('0x1d')]?_0x370219['options'][_0x3fde('0x1e')]===undefined?!![]:![]:!![],'where':_0x370219['options']?_0x370219['options'][_0x3fde('0x1f')]||null:null,'attributes':_0x370219['options']?_0x370219['options'][_0x3fde('0x20')]||null:null,'limit':_0x370219['options']?_0x370219[_0x3fde('0x1d')]['limit']||null:null,'include':_0x370219['options']?_0x370219[_0x3fde('0x1d')][_0x3fde('0x21')]?_['map'](_0x370219['options'][_0x3fde('0x21')],function(_0x32dd8c){return{'model':db[_0x32dd8c[_0x3fde('0x22')]],'as':_0x32dd8c['as'],'attributes':_0x32dd8c[_0x3fde('0x20')],'include':_0x32dd8c[_0x3fde('0x21')]?_[_0x3fde('0x23')](_0x32dd8c[_0x3fde('0x21')],function(_0x109674){return{'model':db[_0x109674['model']],'as':_0x109674['as'],'attributes':_0x109674[_0x3fde('0x20')],'include':_0x109674[_0x3fde('0x21')]?_[_0x3fde('0x23')](_0x109674[_0x3fde('0x21')],function(_0x76db72){return{'model':db[_0x76db72[_0x3fde('0x22')]],'as':_0x76db72['as'],'attributes':_0x76db72[_0x3fde('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3fde('0x11')](function(_0x31a21a){logger[_0x3fde('0x24')](_0x3fde('0x1b'),_0x370219);logger['debug'](_0x3fde('0x1b'),_0x370219,JSON[_0x3fde('0x15')](_0x31a21a));_0x3f664b(_0x31a21a);})['catch'](function(_0x502186){logger[_0x3fde('0x16')]('GetChatQueue',_0x502186['message'],_0x370219);_0x5787d4(_0x412b0d['error'](0x1f4,_0x502186[_0x3fde('0x17')]));});});};exports['ShowChatQueue']=function(_0x40d865){var _0x49a58a=this;return new Promise(function(_0x48306f,_0x50bf5c){return db[_0x3fde('0x1c')][_0x3fde('0x25')]({'raw':_0x40d865[_0x3fde('0x1d')]?_0x40d865[_0x3fde('0x1d')][_0x3fde('0x1e')]===undefined?!![]:![]:!![],'where':_0x40d865[_0x3fde('0x1d')]?_0x40d865['options'][_0x3fde('0x1f')]||null:null,'attributes':_0x40d865[_0x3fde('0x1d')]?_0x40d865[_0x3fde('0x1d')][_0x3fde('0x20')]||null:null,'include':_0x40d865[_0x3fde('0x1d')]?_0x40d865[_0x3fde('0x1d')]['include']?_['map'](_0x40d865[_0x3fde('0x1d')][_0x3fde('0x21')],function(_0x18cdd9){return{'model':db[_0x18cdd9['model']],'as':_0x18cdd9['as'],'attributes':_0x18cdd9[_0x3fde('0x20')],'include':_0x18cdd9[_0x3fde('0x21')]?_[_0x3fde('0x23')](_0x18cdd9[_0x3fde('0x21')],function(_0x96afda){return{'model':db[_0x96afda[_0x3fde('0x22')]],'as':_0x96afda['as'],'attributes':_0x96afda[_0x3fde('0x20')],'include':_0x96afda['include']?_[_0x3fde('0x23')](_0x96afda[_0x3fde('0x21')],function(_0x282c79){return{'model':db[_0x282c79[_0x3fde('0x22')]],'as':_0x282c79['as'],'attributes':_0x282c79[_0x3fde('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3fde('0x11')](function(_0x50473b){logger[_0x3fde('0x24')](_0x3fde('0x26'),_0x40d865);logger[_0x3fde('0x13')](_0x3fde('0x26'),_0x40d865,JSON[_0x3fde('0x15')](_0x50473b));_0x48306f(_0x50473b);})[_0x3fde('0x1a')](function(_0x1d3db3){logger[_0x3fde('0x16')](_0x3fde('0x26'),_0x1d3db3[_0x3fde('0x17')],_0x40d865);_0x50bf5c(_0x49a58a[_0x3fde('0x16')](0x1f4,_0x1d3db3[_0x3fde('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 43bfe8b..c33b0bc 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 _0x702d=['remove','update','emit','register','length','./chatQueue.events','save'];(function(_0x3b4a16,_0x45444a){var _0x4a86ca=function(_0x5193a7){while(--_0x5193a7){_0x3b4a16['push'](_0x3b4a16['shift']());}};_0x4a86ca(++_0x45444a);}(_0x702d,0x147));var _0xd702=function(_0x3ebdfb,_0x26783b){_0x3ebdfb=_0x3ebdfb-0x0;var _0x47b42b=_0x702d[_0x3ebdfb];return _0x47b42b;};'use strict';var ChatQueueEvents=require(_0xd702('0x0'));var events=[_0xd702('0x1'),_0xd702('0x2'),_0xd702('0x3')];function createListener(_0x37ed5c,_0x5c2b9e){return function(_0x20c11a){_0x5c2b9e[_0xd702('0x4')](_0x37ed5c,_0x20c11a);};}function removeListener(_0x27b260,_0x1c5a32){return function(){ChatQueueEvents['removeListener'](_0x27b260,_0x1c5a32);};}exports[_0xd702('0x5')]=function(_0x544e94){for(var _0x1aecfc=0x0,_0x3a2c03=events[_0xd702('0x6')];_0x1aecfc<_0x3a2c03;_0x1aecfc++){var _0x5af246=events[_0x1aecfc];var _0x12bb75=createListener('chatQueue:'+_0x5af246,_0x544e94);ChatQueueEvents['on'](_0x5af246,_0x12bb75);}}; \ No newline at end of file +var _0x702d=['remove','update','emit','register','length','./chatQueue.events','save'];(function(_0x1d9ae5,_0x455fd3){var _0xad4649=function(_0x5a3c52){while(--_0x5a3c52){_0x1d9ae5['push'](_0x1d9ae5['shift']());}};_0xad4649(++_0x455fd3);}(_0x702d,0x147));var _0xd702=function(_0x2eca98,_0x29d1a9){_0x2eca98=_0x2eca98-0x0;var _0x304aa7=_0x702d[_0x2eca98];return _0x304aa7;};'use strict';var ChatQueueEvents=require(_0xd702('0x0'));var events=[_0xd702('0x1'),_0xd702('0x2'),_0xd702('0x3')];function createListener(_0x37ed5c,_0x5c2b9e){return function(_0x20c11a){_0x5c2b9e[_0xd702('0x4')](_0x37ed5c,_0x20c11a);};}function removeListener(_0x27b260,_0x1c5a32){return function(){ChatQueueEvents['removeListener'](_0x27b260,_0x1c5a32);};}exports[_0xd702('0x5')]=function(_0x544e94){for(var _0x1aecfc=0x0,_0x3a2c03=events[_0xd702('0x6')];_0x1aecfc<_0x3a2c03;_0x1aecfc++){var _0x5af246=events[_0x1aecfc];var _0x12bb75=createListener('chatQueue:'+_0x5af246,_0x544e94);ChatQueueEvents['on'](_0x5af246,_0x12bb75);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 3d45396..77f4208 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3e74,0x175));var _0x43e7=function(_0x5797af,_0x56b5c9){_0x5797af=_0x5797af-0x0;var _0x18bd3e=_0x3e74[_0x5797af];return _0x18bd3e;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3900f5,_0x43ebf5){var _0x1beb7=function(_0x23388f){while(--_0x23388f){_0x3900f5['push'](_0x3900f5['shift']());}};_0x1beb7(++_0x43ebf5);}(_0x7217,0x19e));var _0x7721=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x7217[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 045a611..23de4c6 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 _0x5aae=['DATE','moment','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5aae,0xe5));var _0xe5aa=function(_0x405a1f,_0x446aa3){_0x405a1f=_0x405a1f-0x0;var _0x4fd010=_0x5aae[_0x405a1f];return _0x4fd010;};'use strict';var moment=require(_0xe5aa('0x0'));var Sequelize=require(_0xe5aa('0x1'));module[_0xe5aa('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xe5aa('0x3')]},'acceptAt':{'type':Sequelize[_0xe5aa('0x3')]},'exitAt':{'type':Sequelize[_0xe5aa('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9ca2=['sequelize','exports','STRING','DATE'];(function(_0xf2dce0,_0xe97145){var _0x41685a=function(_0x395d00){while(--_0x395d00){_0xf2dce0['push'](_0xf2dce0['shift']());}};_0x41685a(++_0xe97145);}(_0x9ca2,0xe4));var _0x29ca=function(_0x3bb03a,_0x2b5645){_0x3bb03a=_0x3bb03a-0x0;var _0x55dd63=_0x9ca2[_0x3bb03a];return _0x55dd63;};'use strict';var moment=require('moment');var Sequelize=require(_0x29ca('0x0'));module[_0x29ca('0x1')]={'uniqueid':{'type':Sequelize[_0x29ca('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x29ca('0x3')]},'leaveAt':{'type':Sequelize[_0x29ca('0x3')]},'acceptAt':{'type':Sequelize[_0x29ca('0x3')]},'exitAt':{'type':Sequelize[_0x29ca('0x3')]},'reason':{'type':Sequelize[_0x29ca('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 53c373b..ff7eafc 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 _0x644f=['fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatQueueReport','includeAll','findAll','rows','catch','show','keys','include','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs'];(function(_0x3b7756,_0x5704df){var _0x241321=function(_0x15d285){while(--_0x15d285){_0x3b7756['push'](_0x3b7756['shift']());}};_0x241321(++_0x5704df);}(_0x644f,0x177));var _0xf644=function(_0x33c637,_0x597c26){_0x33c637=_0x33c637-0x0;var _0x14aa20=_0x644f[_0x33c637];return _0x14aa20;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf644('0x0'));var zipdir=require(_0xf644('0x1'));var jsonpatch=require(_0xf644('0x2'));var rp=require(_0xf644('0x3'));var moment=require(_0xf644('0x4'));var BPromise=require(_0xf644('0x5'));var Mustache=require(_0xf644('0x6'));var util=require(_0xf644('0x7'));var path=require(_0xf644('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf644('0x9'));var fs=require('fs');var fs_extra=require(_0xf644('0xa'));var _=require(_0xf644('0xb'));var squel=require('squel');var crypto=require(_0xf644('0xc'));var jsforce=require(_0xf644('0xd'));var deskjs=require(_0xf644('0xe'));var toCsv=require(_0xf644('0xf'));var querystring=require(_0xf644('0x10'));var Papa=require('papaparse');var Redis=require(_0xf644('0x11'));var authService=require(_0xf644('0x12'));var qs=require(_0xf644('0x13'));var as=require(_0xf644('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf644('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf644('0x16'));var db=require(_0xf644('0x17'))['db'];function respondWithStatusCode(_0x2e7a91,_0x5c103f){_0x5c103f=_0x5c103f||0xcc;return function(_0x3f6a40){if(_0x3f6a40){return _0x2e7a91[_0xf644('0x18')](_0x5c103f);}return _0x2e7a91[_0xf644('0x19')](_0x5c103f)[_0xf644('0x1a')]();};}function respondWithResult(_0x2df351,_0x4ddae2){_0x4ddae2=_0x4ddae2||0xc8;return function(_0x5dd82b){if(_0x5dd82b){return _0x2df351['status'](_0x4ddae2)['json'](_0x5dd82b);}};}function respondWithFilteredResult(_0x4f996c,_0x1a18f2){return function(_0x50e68b){if(_0x50e68b){var _0x46610a=typeof _0x1a18f2[_0xf644('0x1b')]===_0xf644('0x1c')&&typeof _0x1a18f2[_0xf644('0x1d')]===_0xf644('0x1c');var _0x50df3a=_0x50e68b['count'];var _0x10f61d=_0x46610a?0x0:_0x1a18f2[_0xf644('0x1b')];var _0x12ee4d=_0x46610a?_0x50e68b[_0xf644('0x1e')]:_0x1a18f2[_0xf644('0x1b')]+_0x1a18f2[_0xf644('0x1d')];var _0x43b430;if(_0x12ee4d>=_0x50df3a){_0x12ee4d=_0x50df3a;_0x43b430=0xc8;}else{_0x43b430=0xce;}_0x4f996c[_0xf644('0x19')](_0x43b430);return _0x4f996c[_0xf644('0x1f')](_0xf644('0x20'),_0x10f61d+'-'+_0x12ee4d+'/'+_0x50df3a)[_0xf644('0x21')](_0x50e68b);}return null;};}function patchUpdates(_0x567c1d){return function(_0x10aaba){try{jsonpatch[_0xf644('0x22')](_0x10aaba,_0x567c1d,!![]);}catch(_0xa7f8a2){return BPromise[_0xf644('0x23')](_0xa7f8a2);}return _0x10aaba[_0xf644('0x24')]();};}function saveUpdates(_0x5be5e5,_0x440314){return function(_0x1aa245){if(_0x1aa245){return _0x1aa245[_0xf644('0x25')](_0x5be5e5)[_0xf644('0x26')](function(_0x201c89){return _0x201c89;});}return null;};}function removeEntity(_0x560033,_0x72bd1e){return function(_0x2fe394){if(_0x2fe394){return _0x2fe394[_0xf644('0x27')]()[_0xf644('0x26')](function(){_0x560033['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9adbfb,_0x112606){return function(_0x372f30){if(!_0x372f30){_0x9adbfb['sendStatus'](0x194);}return _0x372f30;};}function handleError(_0x5dd1b5,_0x3a6c70){_0x3a6c70=_0x3a6c70||0x1f4;return function(_0x354cce){logger[_0xf644('0x28')](_0x354cce['stack']);if(_0x354cce[_0xf644('0x29')]){delete _0x354cce['name'];}_0x5dd1b5[_0xf644('0x19')](_0x3a6c70)[_0xf644('0x2a')](_0x354cce);};}exports[_0xf644('0x2b')]=function(_0x295c04,_0x424316){var _0x585133={},_0x5cbbf5={},_0x44366a={'count':0x0,'rows':[]};var _0x1cd792=_[_0xf644('0x2c')](db['ChatQueueReport'][_0xf644('0x2d')],function(_0xd49736){return{'name':_0xd49736[_0xf644('0x2e')],'type':_0xd49736[_0xf644('0x2f')][_0xf644('0x30')]};});_0x5cbbf5['model']=_[_0xf644('0x2c')](_0x1cd792,_0xf644('0x29'));_0x5cbbf5[_0xf644('0x31')]=_['keys'](_0x295c04['query']);_0x5cbbf5[_0xf644('0x32')]=_['intersection'](_0x5cbbf5[_0xf644('0x33')],_0x5cbbf5[_0xf644('0x31')]);_0x585133[_0xf644('0x34')]=_[_0xf644('0x35')](_0x5cbbf5[_0xf644('0x33')],qs[_0xf644('0x36')](_0x295c04[_0xf644('0x31')][_0xf644('0x36')]));_0x585133['attributes']=_0x585133['attributes'][_0xf644('0x37')]?_0x585133['attributes']:_0x5cbbf5[_0xf644('0x33')];if(!_0x295c04[_0xf644('0x31')]['hasOwnProperty'](_0xf644('0x38'))){_0x585133['limit']=qs[_0xf644('0x1d')](_0x295c04[_0xf644('0x31')][_0xf644('0x1d')]);_0x585133[_0xf644('0x1b')]=qs[_0xf644('0x1b')](_0x295c04[_0xf644('0x31')][_0xf644('0x1b')]);}_0x585133[_0xf644('0x39')]=qs[_0xf644('0x3a')](_0x295c04[_0xf644('0x31')][_0xf644('0x3a')]);_0x585133[_0xf644('0x3b')]=qs['filters'](_[_0xf644('0x3c')](_0x295c04[_0xf644('0x31')],_0x5cbbf5[_0xf644('0x32')]),_0x1cd792);if(_0x295c04[_0xf644('0x31')][_0xf644('0x3d')]){_0x585133[_0xf644('0x3b')]=_[_0xf644('0x3e')](_0x585133[_0xf644('0x3b')],{'$or':_['map'](_0x1cd792,function(_0x255506){if(_0x255506['type']!==_0xf644('0x3f')){var _0x37dcc9={};_0x37dcc9[_0x255506[_0xf644('0x29')]]={'$like':'%'+_0x295c04[_0xf644('0x31')][_0xf644('0x3d')]+'%'};return _0x37dcc9;}})});}_0x585133=_['merge']({},_0x585133,_0x295c04[_0xf644('0x40')]);var _0x414d74={'where':_0x585133['where']};return db[_0xf644('0x41')][_0xf644('0x1e')](_0x414d74)[_0xf644('0x26')](function(_0x4bcddc){_0x44366a[_0xf644('0x1e')]=_0x4bcddc;if(_0x295c04['query'][_0xf644('0x42')]){_0x585133['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0xf644('0x43')](_0x585133);})[_0xf644('0x26')](function(_0x270e7f){_0x44366a[_0xf644('0x44')]=_0x270e7f;return _0x44366a;})['then'](respondWithFilteredResult(_0x424316,_0x585133))[_0xf644('0x45')](handleError(_0x424316,null));};exports[_0xf644('0x46')]=function(_0x1ea8fd,_0x41dedf){var _0x124c63={'raw':!![],'where':{'id':_0x1ea8fd['params']['id']}},_0x2c8716={};_0x2c8716['model']=_[_0xf644('0x47')](db[_0xf644('0x41')]['rawAttributes']);_0x2c8716[_0xf644('0x31')]=_[_0xf644('0x47')](_0x1ea8fd[_0xf644('0x31')]);_0x2c8716[_0xf644('0x32')]=_[_0xf644('0x35')](_0x2c8716[_0xf644('0x33')],_0x2c8716[_0xf644('0x31')]);_0x124c63['attributes']=_[_0xf644('0x35')](_0x2c8716['model'],qs['fields'](_0x1ea8fd[_0xf644('0x31')][_0xf644('0x36')]));_0x124c63[_0xf644('0x34')]=_0x124c63['attributes']['length']?_0x124c63['attributes']:_0x2c8716['model'];if(_0x1ea8fd[_0xf644('0x31')][_0xf644('0x42')]){_0x124c63[_0xf644('0x48')]=[{'all':!![]}];}_0x124c63=_['merge']({},_0x124c63,_0x1ea8fd[_0xf644('0x40')]);return db[_0xf644('0x41')][_0xf644('0x49')](_0x124c63)[_0xf644('0x26')](handleEntityNotFound(_0x41dedf,null))[_0xf644('0x26')](respondWithResult(_0x41dedf,null))[_0xf644('0x45')](handleError(_0x41dedf,null));};exports[_0xf644('0x4a')]=function(_0x2b9617,_0x1074f7){return db[_0xf644('0x41')]['create'](_0x2b9617[_0xf644('0x4b')],{})[_0xf644('0x26')](respondWithResult(_0x1074f7,0xc9))[_0xf644('0x45')](handleError(_0x1074f7,null));};exports[_0xf644('0x25')]=function(_0x2893d8,_0x28acb6){if(_0x2893d8[_0xf644('0x4b')]['id']){delete _0x2893d8[_0xf644('0x4b')]['id'];}return db['ChatQueueReport'][_0xf644('0x49')]({'where':{'id':_0x2893d8[_0xf644('0x4c')]['id']}})['then'](handleEntityNotFound(_0x28acb6,null))[_0xf644('0x26')](saveUpdates(_0x2893d8[_0xf644('0x4b')],null))['then'](respondWithResult(_0x28acb6,null))[_0xf644('0x45')](handleError(_0x28acb6,null));};exports[_0xf644('0x27')]=function(_0x232853,_0x42b872){return db[_0xf644('0x41')]['find']({'where':{'id':_0x232853['params']['id']}})[_0xf644('0x26')](handleEntityNotFound(_0x42b872,null))[_0xf644('0x26')](removeEntity(_0x42b872,null))['catch'](handleError(_0x42b872,null));};exports['describe']=function(_0x3a7e5d,_0x436497){return db[_0xf644('0x41')]['describe']()['then'](respondWithResult(_0x436497,null))[_0xf644('0x45')](handleError(_0x436497,null));}; \ No newline at end of file +var _0x0a1c=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','keys','find','create','body','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0x0a1c[_0x11e30d];return _0x2d4e29;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc0a1('0x0'));var jsonpatch=require(_0xc0a1('0x1'));var rp=require(_0xc0a1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc0a1('0x3'));var util=require(_0xc0a1('0x4'));var path=require(_0xc0a1('0x5'));var sox=require(_0xc0a1('0x6'));var csv=require(_0xc0a1('0x7'));var ejs=require(_0xc0a1('0x8'));var fs=require('fs');var fs_extra=require(_0xc0a1('0x9'));var _=require(_0xc0a1('0xa'));var squel=require(_0xc0a1('0xb'));var crypto=require(_0xc0a1('0xc'));var jsforce=require(_0xc0a1('0xd'));var deskjs=require(_0xc0a1('0xe'));var toCsv=require(_0xc0a1('0x7'));var querystring=require(_0xc0a1('0xf'));var Papa=require(_0xc0a1('0x10'));var Redis=require(_0xc0a1('0x11'));var authService=require(_0xc0a1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc0a1('0x13'));var hardwareService=require(_0xc0a1('0x14'));var logger=require(_0xc0a1('0x15'))('api');var utils=require(_0xc0a1('0x16'));var config=require(_0xc0a1('0x17'));var licenseUtil=require(_0xc0a1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1565f4,_0x138338){_0x138338=_0x138338||0xcc;return function(_0x4969b9){if(_0x4969b9){return _0x1565f4[_0xc0a1('0x19')](_0x138338);}return _0x1565f4[_0xc0a1('0x1a')](_0x138338)[_0xc0a1('0x1b')]();};}function respondWithResult(_0x395ade,_0x32c3b9){_0x32c3b9=_0x32c3b9||0xc8;return function(_0x517689){if(_0x517689){return _0x395ade['status'](_0x32c3b9)[_0xc0a1('0x1c')](_0x517689);}};}function respondWithFilteredResult(_0x3f5ce8,_0x49a97c){return function(_0x5a3e1d){if(_0x5a3e1d){var _0x8aa354=typeof _0x49a97c[_0xc0a1('0x1d')]==='undefined'&&typeof _0x49a97c[_0xc0a1('0x1e')]===_0xc0a1('0x1f');var _0x27ad22=_0x5a3e1d[_0xc0a1('0x20')];var _0x234067=_0x8aa354?0x0:_0x49a97c[_0xc0a1('0x1d')];var _0x36620e=_0x8aa354?_0x5a3e1d[_0xc0a1('0x20')]:_0x49a97c[_0xc0a1('0x1d')]+_0x49a97c[_0xc0a1('0x1e')];var _0x1e02aa;if(_0x36620e>=_0x27ad22){_0x36620e=_0x27ad22;_0x1e02aa=0xc8;}else{_0x1e02aa=0xce;}_0x3f5ce8[_0xc0a1('0x1a')](_0x1e02aa);return _0x3f5ce8[_0xc0a1('0x21')](_0xc0a1('0x22'),_0x234067+'-'+_0x36620e+'/'+_0x27ad22)[_0xc0a1('0x1c')](_0x5a3e1d);}return null;};}function patchUpdates(_0x3e8940){return function(_0x563987){try{jsonpatch[_0xc0a1('0x23')](_0x563987,_0x3e8940,!![]);}catch(_0x4f0f02){return BPromise[_0xc0a1('0x24')](_0x4f0f02);}return _0x563987[_0xc0a1('0x25')]();};}function saveUpdates(_0x19e24b,_0x316f1a){return function(_0x40eaa4){if(_0x40eaa4){return _0x40eaa4['update'](_0x19e24b)[_0xc0a1('0x26')](function(_0x1ae706){return _0x1ae706;});}return null;};}function removeEntity(_0x247179,_0x3e7997){return function(_0xb78441){if(_0xb78441){return _0xb78441[_0xc0a1('0x27')]()[_0xc0a1('0x26')](function(){_0x247179[_0xc0a1('0x1a')](0xcc)[_0xc0a1('0x1b')]();});}};}function handleEntityNotFound(_0x161bff,_0x5d9925){return function(_0x569816){if(!_0x569816){_0x161bff[_0xc0a1('0x19')](0x194);}return _0x569816;};}function handleError(_0xcd9b89,_0x5b5d13){_0x5b5d13=_0x5b5d13||0x1f4;return function(_0x52ba51){logger[_0xc0a1('0x28')](_0x52ba51[_0xc0a1('0x29')]);if(_0x52ba51['name']){delete _0x52ba51[_0xc0a1('0x2a')];}_0xcd9b89[_0xc0a1('0x1a')](_0x5b5d13)[_0xc0a1('0x2b')](_0x52ba51);};}exports[_0xc0a1('0x2c')]=function(_0x8f4588,_0x1814ac){var _0x114f76={},_0x2bc99f={},_0x4b4c93={'count':0x0,'rows':[]};var _0x26604b=_[_0xc0a1('0x2d')](db[_0xc0a1('0x2e')][_0xc0a1('0x2f')],function(_0x254c32){return{'name':_0x254c32[_0xc0a1('0x30')],'type':_0x254c32['type']['key']};});_0x2bc99f[_0xc0a1('0x31')]=_[_0xc0a1('0x2d')](_0x26604b,'name');_0x2bc99f[_0xc0a1('0x32')]=_['keys'](_0x8f4588[_0xc0a1('0x32')]);_0x2bc99f['filters']=_[_0xc0a1('0x33')](_0x2bc99f[_0xc0a1('0x31')],_0x2bc99f[_0xc0a1('0x32')]);_0x114f76['attributes']=_[_0xc0a1('0x33')](_0x2bc99f['model'],qs[_0xc0a1('0x34')](_0x8f4588[_0xc0a1('0x32')]['fields']));_0x114f76[_0xc0a1('0x35')]=_0x114f76[_0xc0a1('0x35')][_0xc0a1('0x36')]?_0x114f76[_0xc0a1('0x35')]:_0x2bc99f[_0xc0a1('0x31')];if(!_0x8f4588[_0xc0a1('0x32')]['hasOwnProperty'](_0xc0a1('0x37'))){_0x114f76[_0xc0a1('0x1e')]=qs[_0xc0a1('0x1e')](_0x8f4588[_0xc0a1('0x32')][_0xc0a1('0x1e')]);_0x114f76[_0xc0a1('0x1d')]=qs['offset'](_0x8f4588['query'][_0xc0a1('0x1d')]);}_0x114f76[_0xc0a1('0x38')]=qs[_0xc0a1('0x39')](_0x8f4588['query']['sort']);_0x114f76[_0xc0a1('0x3a')]=qs[_0xc0a1('0x3b')](_[_0xc0a1('0x3c')](_0x8f4588['query'],_0x2bc99f[_0xc0a1('0x3b')]),_0x26604b);if(_0x8f4588[_0xc0a1('0x32')]['filter']){_0x114f76[_0xc0a1('0x3a')]=_[_0xc0a1('0x3d')](_0x114f76['where'],{'$or':_[_0xc0a1('0x2d')](_0x26604b,function(_0x32f40b){if(_0x32f40b[_0xc0a1('0x3e')]!==_0xc0a1('0x3f')){var _0x442c1c={};_0x442c1c[_0x32f40b[_0xc0a1('0x2a')]]={'$like':'%'+_0x8f4588[_0xc0a1('0x32')][_0xc0a1('0x40')]+'%'};return _0x442c1c;}})});}_0x114f76=_['merge']({},_0x114f76,_0x8f4588['options']);var _0x300df9={'where':_0x114f76[_0xc0a1('0x3a')]};return db['ChatQueueReport'][_0xc0a1('0x20')](_0x300df9)[_0xc0a1('0x26')](function(_0x273b64){_0x4b4c93[_0xc0a1('0x20')]=_0x273b64;if(_0x8f4588[_0xc0a1('0x32')][_0xc0a1('0x41')]){_0x114f76['include']=[{'all':!![]}];}return db[_0xc0a1('0x2e')][_0xc0a1('0x42')](_0x114f76);})['then'](function(_0x289501){_0x4b4c93[_0xc0a1('0x43')]=_0x289501;return _0x4b4c93;})[_0xc0a1('0x26')](respondWithFilteredResult(_0x1814ac,_0x114f76))[_0xc0a1('0x44')](handleError(_0x1814ac,null));};exports[_0xc0a1('0x45')]=function(_0x1b58ec,_0x41d73d){var _0x4d9b35={'raw':!![],'where':{'id':_0x1b58ec[_0xc0a1('0x46')]['id']}},_0x542fb3={};_0x542fb3['model']=_[_0xc0a1('0x47')](db['ChatQueueReport']['rawAttributes']);_0x542fb3[_0xc0a1('0x32')]=_[_0xc0a1('0x47')](_0x1b58ec[_0xc0a1('0x32')]);_0x542fb3[_0xc0a1('0x3b')]=_[_0xc0a1('0x33')](_0x542fb3[_0xc0a1('0x31')],_0x542fb3[_0xc0a1('0x32')]);_0x4d9b35[_0xc0a1('0x35')]=_[_0xc0a1('0x33')](_0x542fb3[_0xc0a1('0x31')],qs[_0xc0a1('0x34')](_0x1b58ec[_0xc0a1('0x32')][_0xc0a1('0x34')]));_0x4d9b35[_0xc0a1('0x35')]=_0x4d9b35[_0xc0a1('0x35')][_0xc0a1('0x36')]?_0x4d9b35['attributes']:_0x542fb3[_0xc0a1('0x31')];if(_0x1b58ec[_0xc0a1('0x32')]['includeAll']){_0x4d9b35['include']=[{'all':!![]}];}_0x4d9b35=_[_0xc0a1('0x3d')]({},_0x4d9b35,_0x1b58ec['options']);return db[_0xc0a1('0x2e')][_0xc0a1('0x48')](_0x4d9b35)[_0xc0a1('0x26')](handleEntityNotFound(_0x41d73d,null))['then'](respondWithResult(_0x41d73d,null))[_0xc0a1('0x44')](handleError(_0x41d73d,null));};exports[_0xc0a1('0x49')]=function(_0x5b1244,_0x934f6d){return db[_0xc0a1('0x2e')]['create'](_0x5b1244['body'],{})[_0xc0a1('0x26')](respondWithResult(_0x934f6d,0xc9))[_0xc0a1('0x44')](handleError(_0x934f6d,null));};exports['update']=function(_0x437380,_0x216a82){if(_0x437380[_0xc0a1('0x4a')]['id']){delete _0x437380[_0xc0a1('0x4a')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x437380[_0xc0a1('0x46')]['id']}})['then'](handleEntityNotFound(_0x216a82,null))[_0xc0a1('0x26')](saveUpdates(_0x437380['body'],null))[_0xc0a1('0x26')](respondWithResult(_0x216a82,null))['catch'](handleError(_0x216a82,null));};exports[_0xc0a1('0x27')]=function(_0x280bbc,_0x5b5069){return db[_0xc0a1('0x2e')][_0xc0a1('0x48')]({'where':{'id':_0x280bbc[_0xc0a1('0x46')]['id']}})[_0xc0a1('0x26')](handleEntityNotFound(_0x5b5069,null))[_0xc0a1('0x26')](removeEntity(_0x5b5069,null))['catch'](handleError(_0x5b5069,null));};exports['describe']=function(_0x46fd8d,_0x4820bf){return db[_0xc0a1('0x2e')]['describe']()[_0xc0a1('0x26')](respondWithResult(_0x4820bf,null))[_0xc0a1('0x44')](handleError(_0x4820bf,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 40bd286..346dde0 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(_0x3f99a8,_0x160bf7){var _0x25c907=function(_0x4f5dd0){while(--_0x4f5dd0){_0x3f99a8['push'](_0x3f99a8['shift']());}};_0x25c907(++_0x160bf7);}(_0xe706,0xa3));var _0x6e70=function(_0x6d7f08,_0x9e8c3b){_0x6d7f08=_0x6d7f08-0x0;var _0x35e5e1=_0xe706[_0x6d7f08];return _0x35e5e1;};'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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0xa041de,_0x3600e2){var _0x1d654c=function(_0x295d70){while(--_0x295d70){_0xa041de['push'](_0xa041de['shift']());}};_0x1d654c(++_0x3600e2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 7f9401d..02a60fb 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 _0x3b3d=['ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','body','options','raw','catch','update','where','attributes','UpdateChatQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3b3d,0x93));var _0xd3b3=function(_0x436c52,_0x41e4ad){_0x436c52=_0x436c52-0x0;var _0x36c613=_0x3b3d[_0x436c52];return _0x36c613;};'use strict';var _=require(_0xd3b3('0x0'));var util=require('util');var moment=require(_0xd3b3('0x1'));var BPromise=require(_0xd3b3('0x2'));var rs=require(_0xd3b3('0x3'));var fs=require('fs');var Redis=require(_0xd3b3('0x4'));var db=require(_0xd3b3('0x5'))['db'];var utils=require(_0xd3b3('0x6'));var logger=require(_0xd3b3('0x7'))(_0xd3b3('0x8'));var config=require(_0xd3b3('0x9'));var jayson=require(_0xd3b3('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e9942,_0x5d09fb,_0xabde5a){return new BPromise(function(_0x24c821,_0x5db941){return client[_0xd3b3('0xb')](_0x3e9942,_0xabde5a)[_0xd3b3('0xc')](function(_0x165e2c){logger['info'](_0xd3b3('0xd'),_0x5d09fb,_0xd3b3('0xe'));logger[_0xd3b3('0xf')](_0xd3b3('0x10'),_0x5d09fb,'request\x20sent',JSON[_0xd3b3('0x11')](_0x165e2c));if(_0x165e2c[_0xd3b3('0x12')]){if(_0x165e2c['error'][_0xd3b3('0x13')]===0x1f4){logger['error'](_0xd3b3('0xd'),_0x5d09fb,_0x165e2c['error'][_0xd3b3('0x14')]);return _0x5db941(_0x165e2c[_0xd3b3('0x12')][_0xd3b3('0x14')]);}logger['error'](_0xd3b3('0xd'),_0x5d09fb,_0x165e2c[_0xd3b3('0x12')][_0xd3b3('0x14')]);return _0x24c821(_0x165e2c[_0xd3b3('0x12')][_0xd3b3('0x14')]);}else{logger['info'](_0xd3b3('0xd'),_0x5d09fb,_0xd3b3('0xe'));_0x24c821(_0x165e2c[_0xd3b3('0x15')]['message']);}})['catch'](function(_0x592de9){logger[_0xd3b3('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x5d09fb,_0x592de9);_0x5db941(_0x592de9);});});}exports[_0xd3b3('0x16')]=function(_0xd85eba){var _0x3e44f3=this;return new Promise(function(_0x4a2341,_0x583848){return db[_0xd3b3('0x17')]['create'](_0xd85eba[_0xd3b3('0x18')],{'raw':_0xd85eba[_0xd3b3('0x19')]?_0xd85eba['options'][_0xd3b3('0x1a')]===undefined?!![]:![]:!![]})[_0xd3b3('0xc')](function(_0x599114){logger['info'](_0xd3b3('0x16'),_0xd85eba);logger[_0xd3b3('0xf')](_0xd3b3('0x16'),_0xd85eba,JSON[_0xd3b3('0x11')](_0x599114));_0x4a2341(_0x599114);})[_0xd3b3('0x1b')](function(_0x567fdd){logger['error'](_0xd3b3('0x16'),_0x567fdd[_0xd3b3('0x14')],_0xd85eba);_0x583848(_0x3e44f3[_0xd3b3('0x12')](0x1f4,_0x567fdd[_0xd3b3('0x14')]));});});};exports['UpdateChatQueueReport']=function(_0x2a0207){var _0x3824d4=this;return new Promise(function(_0x47923a,_0x6ff308){return db[_0xd3b3('0x17')][_0xd3b3('0x1c')](_0x2a0207[_0xd3b3('0x18')],{'raw':_0x2a0207[_0xd3b3('0x19')]?_0x2a0207[_0xd3b3('0x19')][_0xd3b3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a0207[_0xd3b3('0x19')]?_0x2a0207[_0xd3b3('0x19')][_0xd3b3('0x1d')]||null:null,'attributes':_0x2a0207['options']?_0x2a0207[_0xd3b3('0x19')][_0xd3b3('0x1e')]||null:null,'limit':_0x2a0207[_0xd3b3('0x19')]?_0x2a0207[_0xd3b3('0x19')]['limit']||null:null})[_0xd3b3('0xc')](function(_0x2ec518){logger['info'](_0xd3b3('0x1f'),_0x2a0207);logger['debug'](_0xd3b3('0x1f'),_0x2a0207,JSON['stringify'](_0x2ec518));_0x47923a(_0x2ec518);})[_0xd3b3('0x1b')](function(_0x387951){logger[_0xd3b3('0x12')](_0xd3b3('0x1f'),_0x387951[_0xd3b3('0x14')],_0x2a0207);_0x6ff308(_0x3824d4[_0xd3b3('0x12')](0x1f4,_0x387951[_0xd3b3('0x14')]));});});}; \ No newline at end of file +var _0x9cbe=['ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','update','where','attributes','limit','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9cbe,0x114));var _0xe9cb=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9cbe[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe9cb('0x0'));var rs=require(_0xe9cb('0x1'));var fs=require('fs');var Redis=require(_0xe9cb('0x2'));var db=require(_0xe9cb('0x3'))['db'];var utils=require(_0xe9cb('0x4'));var logger=require(_0xe9cb('0x5'))('rpc');var config=require(_0xe9cb('0x6'));var jayson=require(_0xe9cb('0x7'));var client=jayson[_0xe9cb('0x8')][_0xe9cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x404615,_0x7894ea,_0x32d7a9){return new BPromise(function(_0x2493b5,_0x3fcde0){return client['request'](_0x404615,_0x32d7a9)[_0xe9cb('0xa')](function(_0x34c371){logger[_0xe9cb('0xb')](_0xe9cb('0xc'),_0x7894ea,_0xe9cb('0xd'));logger[_0xe9cb('0xe')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x7894ea,_0xe9cb('0xd'),JSON[_0xe9cb('0xf')](_0x34c371));if(_0x34c371[_0xe9cb('0x10')]){if(_0x34c371[_0xe9cb('0x10')][_0xe9cb('0x11')]===0x1f4){logger['error'](_0xe9cb('0xc'),_0x7894ea,_0x34c371[_0xe9cb('0x10')][_0xe9cb('0x12')]);return _0x3fcde0(_0x34c371[_0xe9cb('0x10')][_0xe9cb('0x12')]);}logger[_0xe9cb('0x10')](_0xe9cb('0xc'),_0x7894ea,_0x34c371[_0xe9cb('0x10')][_0xe9cb('0x12')]);return _0x2493b5(_0x34c371['error'][_0xe9cb('0x12')]);}else{logger[_0xe9cb('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x7894ea,_0xe9cb('0xd'));_0x2493b5(_0x34c371[_0xe9cb('0x13')][_0xe9cb('0x12')]);}})[_0xe9cb('0x14')](function(_0x488175){logger[_0xe9cb('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x7894ea,_0x488175);_0x3fcde0(_0x488175);});});}exports['CreateChatQueueReport']=function(_0x3500c1){var _0x5abd27=this;return new Promise(function(_0x2f7b89,_0x2c0dbd){return db[_0xe9cb('0x15')][_0xe9cb('0x16')](_0x3500c1[_0xe9cb('0x17')],{'raw':_0x3500c1[_0xe9cb('0x18')]?_0x3500c1[_0xe9cb('0x18')][_0xe9cb('0x19')]===undefined?!![]:![]:!![]})[_0xe9cb('0xa')](function(_0x31c0c0){logger[_0xe9cb('0xb')](_0xe9cb('0x1a'),_0x3500c1);logger[_0xe9cb('0xe')]('CreateChatQueueReport',_0x3500c1,JSON['stringify'](_0x31c0c0));_0x2f7b89(_0x31c0c0);})[_0xe9cb('0x14')](function(_0x1db7e9){logger[_0xe9cb('0x10')]('CreateChatQueueReport',_0x1db7e9[_0xe9cb('0x12')],_0x3500c1);_0x2c0dbd(_0x5abd27[_0xe9cb('0x10')](0x1f4,_0x1db7e9[_0xe9cb('0x12')]));});});};exports[_0xe9cb('0x1b')]=function(_0x436f2b){var _0x10de0c=this;return new Promise(function(_0x2be04a,_0x35b12a){return db['ChatQueueReport'][_0xe9cb('0x1c')](_0x436f2b[_0xe9cb('0x17')],{'raw':_0x436f2b[_0xe9cb('0x18')]?_0x436f2b[_0xe9cb('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x436f2b[_0xe9cb('0x18')]?_0x436f2b[_0xe9cb('0x18')][_0xe9cb('0x1d')]||null:null,'attributes':_0x436f2b['options']?_0x436f2b[_0xe9cb('0x18')][_0xe9cb('0x1e')]||null:null,'limit':_0x436f2b[_0xe9cb('0x18')]?_0x436f2b[_0xe9cb('0x18')][_0xe9cb('0x1f')]||null:null})[_0xe9cb('0xa')](function(_0x39c80d){logger[_0xe9cb('0xb')](_0xe9cb('0x1b'),_0x436f2b);logger[_0xe9cb('0xe')]('UpdateChatQueueReport',_0x436f2b,JSON[_0xe9cb('0xf')](_0x39c80d));_0x2be04a(_0x39c80d);})[_0xe9cb('0x14')](function(_0x5138d2){logger[_0xe9cb('0x10')](_0xe9cb('0x1b'),_0x5138d2[_0xe9cb('0x12')],_0x436f2b);_0x35b12a(_0x10de0c['error'](0x1f4,_0x5138d2['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 2fb6309..f4fb517 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 _0xd10f=['update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','./chatQueueReport.controller','get','index','/describe','isAuthenticated','/:id','show','post'];(function(_0x18329c,_0x5804b7){var _0x19cbc5=function(_0x1732ca){while(--_0x1732ca){_0x18329c['push'](_0x18329c['shift']());}};_0x19cbc5(++_0x5804b7);}(_0xd10f,0xb3));var _0xfd10=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd10f[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xfd10('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfd10('0x1'));var express=require(_0xfd10('0x2'));var router=express[_0xfd10('0x3')]();var fs_extra=require(_0xfd10('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfd10('0x5'));router[_0xfd10('0x6')]('/',auth['isAuthenticated'](),controller[_0xfd10('0x7')]);router['get'](_0xfd10('0x8'),auth[_0xfd10('0x9')](),controller['describe']);router['get'](_0xfd10('0xa'),auth[_0xfd10('0x9')](),controller[_0xfd10('0xb')]);router[_0xfd10('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xfd10('0xa'),auth['isAuthenticated'](),controller[_0xfd10('0xd')]);router['delete'](_0xfd10('0xa'),auth['isAuthenticated'](),controller[_0xfd10('0xe')]);module[_0xfd10('0xf')]=router; \ No newline at end of file +var _0x04aa=['isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','/describe','describe','/:id'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x04aa,0x13c));var _0xa04a=function(_0xbc411e,_0x20fea4){_0xbc411e=_0xbc411e-0x0;var _0x5ee6b0=_0x04aa[_0xbc411e];return _0x5ee6b0;};'use strict';var multer=require(_0xa04a('0x0'));var util=require(_0xa04a('0x1'));var path=require(_0xa04a('0x2'));var timeout=require(_0xa04a('0x3'));var express=require(_0xa04a('0x4'));var router=express[_0xa04a('0x5')]();var fs_extra=require(_0xa04a('0x6'));var auth=require(_0xa04a('0x7'));var interaction=require(_0xa04a('0x8'));var config=require('../../config/environment');var controller=require(_0xa04a('0x9'));router[_0xa04a('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa04a('0xa')](_0xa04a('0xb'),auth['isAuthenticated'](),controller[_0xa04a('0xc')]);router[_0xa04a('0xa')](_0xa04a('0xd'),auth[_0xa04a('0xe')](),controller[_0xa04a('0xf')]);router[_0xa04a('0x10')]('/',auth[_0xa04a('0xe')](),controller['create']);router[_0xa04a('0x11')](_0xa04a('0xd'),auth[_0xa04a('0xe')](),controller[_0xa04a('0x12')]);router[_0xa04a('0x13')](_0xa04a('0xd'),auth['isAuthenticated'](),controller[_0xa04a('0x14')]);module[_0xa04a('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index ee70e0c..8e3633f 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x44bf37,_0x16a69e){var _0x1e5ca0=function(_0x5f1624){while(--_0x5f1624){_0x44bf37['push'](_0x44bf37['shift']());}};_0x1e5ca0(++_0x16a69e);}(_0xaa88,0x137));var _0x8aa8=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0xaa88[_0x1aeda2];return _0x32dc6d;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x48fff1,_0x50c537){var _0x127a1d=function(_0x2abe66){while(--_0x2abe66){_0x48fff1['push'](_0x48fff1['shift']());}};_0x127a1d(++_0x50c537);}(_0x9c44,0x178));var _0x49c4=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x9c44[_0x23e7c1];return _0x1add43;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 5043887..2c73ba7 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 _0xd8c8=['then','includeAll','include','show','params','catch','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','end','error','stack','send','map','rawAttributes','fieldName','key','model','name','query','keys','intersection','attributes','fields','length','nolimit','filters','pick','filter','merge','where','VIRTUAL','options','ChatTransferReport'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0xd8c8,0x9e));var _0x8d8c=function(_0x33b793,_0x487fd8){_0x33b793=_0x33b793-0x0;var _0x32356b=_0xd8c8[_0x33b793];return _0x32356b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d8c('0x0'));var zipdir=require(_0x8d8c('0x1'));var jsonpatch=require(_0x8d8c('0x2'));var rp=require(_0x8d8c('0x3'));var moment=require(_0x8d8c('0x4'));var BPromise=require(_0x8d8c('0x5'));var Mustache=require(_0x8d8c('0x6'));var util=require(_0x8d8c('0x7'));var path=require(_0x8d8c('0x8'));var sox=require(_0x8d8c('0x9'));var csv=require(_0x8d8c('0xa'));var ejs=require(_0x8d8c('0xb'));var fs=require('fs');var fs_extra=require(_0x8d8c('0xc'));var _=require(_0x8d8c('0xd'));var squel=require(_0x8d8c('0xe'));var crypto=require(_0x8d8c('0xf'));var jsforce=require(_0x8d8c('0x10'));var deskjs=require(_0x8d8c('0x11'));var toCsv=require(_0x8d8c('0xa'));var querystring=require(_0x8d8c('0x12'));var Papa=require(_0x8d8c('0x13'));var Redis=require('ioredis');var authService=require(_0x8d8c('0x14'));var qs=require(_0x8d8c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d8c('0x16'));var logger=require('../../config/logger')(_0x8d8c('0x17'));var utils=require(_0x8d8c('0x18'));var config=require(_0x8d8c('0x19'));var licenseUtil=require(_0x8d8c('0x1a'));var db=require(_0x8d8c('0x1b'))['db'];function respondWithStatusCode(_0x128beb,_0x5b52da){_0x5b52da=_0x5b52da||0xcc;return function(_0x495efb){if(_0x495efb){return _0x128beb[_0x8d8c('0x1c')](_0x5b52da);}return _0x128beb[_0x8d8c('0x1d')](_0x5b52da)['end']();};}function respondWithResult(_0x661251,_0x437a17){_0x437a17=_0x437a17||0xc8;return function(_0x2a120f){if(_0x2a120f){return _0x661251[_0x8d8c('0x1d')](_0x437a17)[_0x8d8c('0x1e')](_0x2a120f);}};}function respondWithFilteredResult(_0x1c2002,_0x42e5db){return function(_0x10858a){if(_0x10858a){var _0x25bff9=typeof _0x42e5db[_0x8d8c('0x1f')]===_0x8d8c('0x20')&&typeof _0x42e5db[_0x8d8c('0x21')]===_0x8d8c('0x20');var _0x3a1735=_0x10858a[_0x8d8c('0x22')];var _0x11afc5=_0x25bff9?0x0:_0x42e5db[_0x8d8c('0x1f')];var _0xf0b669=_0x25bff9?_0x10858a[_0x8d8c('0x22')]:_0x42e5db[_0x8d8c('0x1f')]+_0x42e5db[_0x8d8c('0x21')];var _0x4085a9;if(_0xf0b669>=_0x3a1735){_0xf0b669=_0x3a1735;_0x4085a9=0xc8;}else{_0x4085a9=0xce;}_0x1c2002['status'](_0x4085a9);return _0x1c2002['set'](_0x8d8c('0x23'),_0x11afc5+'-'+_0xf0b669+'/'+_0x3a1735)['json'](_0x10858a);}return null;};}function patchUpdates(_0x2bf783){return function(_0x108bcf){try{jsonpatch[_0x8d8c('0x24')](_0x108bcf,_0x2bf783,!![]);}catch(_0x393fb4){return BPromise['reject'](_0x393fb4);}return _0x108bcf[_0x8d8c('0x25')]();};}function saveUpdates(_0x2b64ec,_0x48fe24){return function(_0x5581c6){if(_0x5581c6){return _0x5581c6[_0x8d8c('0x26')](_0x2b64ec)['then'](function(_0x286cf7){return _0x286cf7;});}return null;};}function removeEntity(_0x14b93f,_0x2aa3a1){return function(_0xe49a7f){if(_0xe49a7f){return _0xe49a7f['destroy']()['then'](function(){_0x14b93f[_0x8d8c('0x1d')](0xcc)[_0x8d8c('0x27')]();});}};}function handleEntityNotFound(_0x28d8d3,_0x419d7b){return function(_0x3347af){if(!_0x3347af){_0x28d8d3[_0x8d8c('0x1c')](0x194);}return _0x3347af;};}function handleError(_0x48211d,_0x55b3e2){_0x55b3e2=_0x55b3e2||0x1f4;return function(_0xf72776){logger[_0x8d8c('0x28')](_0xf72776[_0x8d8c('0x29')]);if(_0xf72776['name']){delete _0xf72776['name'];}_0x48211d[_0x8d8c('0x1d')](_0x55b3e2)[_0x8d8c('0x2a')](_0xf72776);};}exports['index']=function(_0x1b5f96,_0x29614c){var _0x1fa6cd={},_0x5ef6f9={},_0x2688bc={'count':0x0,'rows':[]};var _0x5866a5=_[_0x8d8c('0x2b')](db['ChatTransferReport'][_0x8d8c('0x2c')],function(_0x63481f){return{'name':_0x63481f[_0x8d8c('0x2d')],'type':_0x63481f['type'][_0x8d8c('0x2e')]};});_0x5ef6f9[_0x8d8c('0x2f')]=_[_0x8d8c('0x2b')](_0x5866a5,_0x8d8c('0x30'));_0x5ef6f9[_0x8d8c('0x31')]=_[_0x8d8c('0x32')](_0x1b5f96[_0x8d8c('0x31')]);_0x5ef6f9['filters']=_[_0x8d8c('0x33')](_0x5ef6f9['model'],_0x5ef6f9[_0x8d8c('0x31')]);_0x1fa6cd[_0x8d8c('0x34')]=_['intersection'](_0x5ef6f9[_0x8d8c('0x2f')],qs['fields'](_0x1b5f96[_0x8d8c('0x31')][_0x8d8c('0x35')]));_0x1fa6cd[_0x8d8c('0x34')]=_0x1fa6cd[_0x8d8c('0x34')][_0x8d8c('0x36')]?_0x1fa6cd[_0x8d8c('0x34')]:_0x5ef6f9[_0x8d8c('0x2f')];if(!_0x1b5f96[_0x8d8c('0x31')]['hasOwnProperty'](_0x8d8c('0x37'))){_0x1fa6cd['limit']=qs[_0x8d8c('0x21')](_0x1b5f96['query'][_0x8d8c('0x21')]);_0x1fa6cd['offset']=qs[_0x8d8c('0x1f')](_0x1b5f96[_0x8d8c('0x31')][_0x8d8c('0x1f')]);}_0x1fa6cd['order']=qs['sort'](_0x1b5f96[_0x8d8c('0x31')]['sort']);_0x1fa6cd['where']=qs[_0x8d8c('0x38')](_[_0x8d8c('0x39')](_0x1b5f96[_0x8d8c('0x31')],_0x5ef6f9['filters']),_0x5866a5);if(_0x1b5f96[_0x8d8c('0x31')][_0x8d8c('0x3a')]){_0x1fa6cd['where']=_[_0x8d8c('0x3b')](_0x1fa6cd[_0x8d8c('0x3c')],{'$or':_[_0x8d8c('0x2b')](_0x5866a5,function(_0x411c33){if(_0x411c33['type']!==_0x8d8c('0x3d')){var _0x21234b={};_0x21234b[_0x411c33[_0x8d8c('0x30')]]={'$like':'%'+_0x1b5f96[_0x8d8c('0x31')][_0x8d8c('0x3a')]+'%'};return _0x21234b;}})});}_0x1fa6cd=_[_0x8d8c('0x3b')]({},_0x1fa6cd,_0x1b5f96[_0x8d8c('0x3e')]);var _0x2598dc={'where':_0x1fa6cd[_0x8d8c('0x3c')]};return db[_0x8d8c('0x3f')][_0x8d8c('0x22')](_0x2598dc)[_0x8d8c('0x40')](function(_0x185b3d){_0x2688bc[_0x8d8c('0x22')]=_0x185b3d;if(_0x1b5f96[_0x8d8c('0x31')][_0x8d8c('0x41')]){_0x1fa6cd[_0x8d8c('0x42')]=[{'all':!![]}];}return db[_0x8d8c('0x3f')]['findAll'](_0x1fa6cd);})[_0x8d8c('0x40')](function(_0x336412){_0x2688bc['rows']=_0x336412;return _0x2688bc;})['then'](respondWithFilteredResult(_0x29614c,_0x1fa6cd))['catch'](handleError(_0x29614c,null));};exports[_0x8d8c('0x43')]=function(_0x450aee,_0x79e47e){var _0x540ba2={'raw':!![],'where':{'id':_0x450aee[_0x8d8c('0x44')]['id']}},_0xbabc3f={};_0xbabc3f['model']=_[_0x8d8c('0x32')](db['ChatTransferReport'][_0x8d8c('0x2c')]);_0xbabc3f[_0x8d8c('0x31')]=_[_0x8d8c('0x32')](_0x450aee[_0x8d8c('0x31')]);_0xbabc3f[_0x8d8c('0x38')]=_[_0x8d8c('0x33')](_0xbabc3f[_0x8d8c('0x2f')],_0xbabc3f[_0x8d8c('0x31')]);_0x540ba2['attributes']=_[_0x8d8c('0x33')](_0xbabc3f[_0x8d8c('0x2f')],qs['fields'](_0x450aee[_0x8d8c('0x31')]['fields']));_0x540ba2['attributes']=_0x540ba2[_0x8d8c('0x34')]['length']?_0x540ba2[_0x8d8c('0x34')]:_0xbabc3f[_0x8d8c('0x2f')];if(_0x450aee[_0x8d8c('0x31')]['includeAll']){_0x540ba2[_0x8d8c('0x42')]=[{'all':!![]}];}_0x540ba2=_[_0x8d8c('0x3b')]({},_0x540ba2,_0x450aee[_0x8d8c('0x3e')]);return db[_0x8d8c('0x3f')]['find'](_0x540ba2)['then'](handleEntityNotFound(_0x79e47e,null))[_0x8d8c('0x40')](respondWithResult(_0x79e47e,null))[_0x8d8c('0x45')](handleError(_0x79e47e,null));};exports[_0x8d8c('0x46')]=function(_0x1aa03f,_0x154324){return db[_0x8d8c('0x3f')][_0x8d8c('0x46')](_0x1aa03f[_0x8d8c('0x47')],{})['then'](respondWithResult(_0x154324,0xc9))[_0x8d8c('0x45')](handleError(_0x154324,null));};exports[_0x8d8c('0x26')]=function(_0xc2886e,_0x46bf5f){if(_0xc2886e[_0x8d8c('0x47')]['id']){delete _0xc2886e['body']['id'];}return db[_0x8d8c('0x3f')][_0x8d8c('0x48')]({'where':{'id':_0xc2886e[_0x8d8c('0x44')]['id']}})[_0x8d8c('0x40')](handleEntityNotFound(_0x46bf5f,null))[_0x8d8c('0x40')](saveUpdates(_0xc2886e[_0x8d8c('0x47')],null))['then'](respondWithResult(_0x46bf5f,null))[_0x8d8c('0x45')](handleError(_0x46bf5f,null));};exports['destroy']=function(_0x243e98,_0x4c5056){return db['ChatTransferReport']['find']({'where':{'id':_0x243e98['params']['id']}})[_0x8d8c('0x40')](handleEntityNotFound(_0x4c5056,null))[_0x8d8c('0x40')](removeEntity(_0x4c5056,null))[_0x8d8c('0x45')](handleError(_0x4c5056,null));};exports[_0x8d8c('0x49')]=function(_0x1388aa,_0x3096f8){return db[_0x8d8c('0x3f')][_0x8d8c('0x49')]()['then'](respondWithResult(_0x3096f8,null))[_0x8d8c('0x45')](handleError(_0x3096f8,null));}; \ No newline at end of file +var _0x4e59=['api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','end','stack','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x28e12f,_0x14fbb8){var _0x31b17e=function(_0x5e79c8){while(--_0x5e79c8){_0x28e12f['push'](_0x28e12f['shift']());}};_0x31b17e(++_0x14fbb8);}(_0x4e59,0x80));var _0x94e5=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4e59[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x94e5('0x0'));var rimraf=require(_0x94e5('0x1'));var zipdir=require(_0x94e5('0x2'));var jsonpatch=require(_0x94e5('0x3'));var rp=require('request-promise');var moment=require(_0x94e5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x94e5('0x5'));var util=require(_0x94e5('0x6'));var path=require(_0x94e5('0x7'));var sox=require(_0x94e5('0x8'));var csv=require(_0x94e5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x94e5('0xa'));var _=require(_0x94e5('0xb'));var squel=require(_0x94e5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x94e5('0xd'));var toCsv=require(_0x94e5('0x9'));var querystring=require(_0x94e5('0xe'));var Papa=require(_0x94e5('0xf'));var Redis=require(_0x94e5('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x94e5('0x11'));var hardwareService=require(_0x94e5('0x12'));var logger=require(_0x94e5('0x13'))(_0x94e5('0x14'));var utils=require(_0x94e5('0x15'));var config=require(_0x94e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20dd8c,_0x3143a4){_0x3143a4=_0x3143a4||0xcc;return function(_0x4cc47c){if(_0x4cc47c){return _0x20dd8c[_0x94e5('0x17')](_0x3143a4);}return _0x20dd8c['status'](_0x3143a4)['end']();};}function respondWithResult(_0x423118,_0x27bcb1){_0x27bcb1=_0x27bcb1||0xc8;return function(_0x147051){if(_0x147051){return _0x423118[_0x94e5('0x18')](_0x27bcb1)[_0x94e5('0x19')](_0x147051);}};}function respondWithFilteredResult(_0x55e71b,_0xe753f3){return function(_0x1e37a0){if(_0x1e37a0){var _0x353536=typeof _0xe753f3[_0x94e5('0x1a')]===_0x94e5('0x1b')&&typeof _0xe753f3[_0x94e5('0x1c')]===_0x94e5('0x1b');var _0x515b41=_0x1e37a0[_0x94e5('0x1d')];var _0x3ea3ad=_0x353536?0x0:_0xe753f3[_0x94e5('0x1a')];var _0x563e70=_0x353536?_0x1e37a0[_0x94e5('0x1d')]:_0xe753f3[_0x94e5('0x1a')]+_0xe753f3[_0x94e5('0x1c')];var _0x4ad323;if(_0x563e70>=_0x515b41){_0x563e70=_0x515b41;_0x4ad323=0xc8;}else{_0x4ad323=0xce;}_0x55e71b[_0x94e5('0x18')](_0x4ad323);return _0x55e71b[_0x94e5('0x1e')](_0x94e5('0x1f'),_0x3ea3ad+'-'+_0x563e70+'/'+_0x515b41)[_0x94e5('0x19')](_0x1e37a0);}return null;};}function patchUpdates(_0x40c53e){return function(_0x50d0d7){try{jsonpatch[_0x94e5('0x20')](_0x50d0d7,_0x40c53e,!![]);}catch(_0x2b3d0a){return BPromise[_0x94e5('0x21')](_0x2b3d0a);}return _0x50d0d7['save']();};}function saveUpdates(_0x4ce6e2,_0x58d0c4){return function(_0x2f7772){if(_0x2f7772){return _0x2f7772['update'](_0x4ce6e2)[_0x94e5('0x22')](function(_0x25ea32){return _0x25ea32;});}return null;};}function removeEntity(_0x4ea8c0,_0x4936e0){return function(_0xbc1a5d){if(_0xbc1a5d){return _0xbc1a5d[_0x94e5('0x23')]()['then'](function(){_0x4ea8c0[_0x94e5('0x18')](0xcc)[_0x94e5('0x24')]();});}};}function handleEntityNotFound(_0x1a5cce,_0x215522){return function(_0x3071e1){if(!_0x3071e1){_0x1a5cce[_0x94e5('0x17')](0x194);}return _0x3071e1;};}function handleError(_0x96dbb6,_0x3c811a){_0x3c811a=_0x3c811a||0x1f4;return function(_0x445c75){logger['error'](_0x445c75[_0x94e5('0x25')]);if(_0x445c75[_0x94e5('0x26')]){delete _0x445c75[_0x94e5('0x26')];}_0x96dbb6['status'](_0x3c811a)[_0x94e5('0x27')](_0x445c75);};}exports[_0x94e5('0x28')]=function(_0x514806,_0x25093d){var _0x3adf01={},_0x459b00={},_0x2aff2a={'count':0x0,'rows':[]};var _0x5647ae=_['map'](db[_0x94e5('0x29')][_0x94e5('0x2a')],function(_0x4f7c87){return{'name':_0x4f7c87[_0x94e5('0x2b')],'type':_0x4f7c87[_0x94e5('0x2c')][_0x94e5('0x2d')]};});_0x459b00[_0x94e5('0x2e')]=_[_0x94e5('0x2f')](_0x5647ae,_0x94e5('0x26'));_0x459b00[_0x94e5('0x30')]=_[_0x94e5('0x31')](_0x514806['query']);_0x459b00[_0x94e5('0x32')]=_['intersection'](_0x459b00[_0x94e5('0x2e')],_0x459b00[_0x94e5('0x30')]);_0x3adf01['attributes']=_[_0x94e5('0x33')](_0x459b00[_0x94e5('0x2e')],qs[_0x94e5('0x34')](_0x514806[_0x94e5('0x30')]['fields']));_0x3adf01['attributes']=_0x3adf01[_0x94e5('0x35')][_0x94e5('0x36')]?_0x3adf01[_0x94e5('0x35')]:_0x459b00['model'];if(!_0x514806[_0x94e5('0x30')]['hasOwnProperty'](_0x94e5('0x37'))){_0x3adf01[_0x94e5('0x1c')]=qs[_0x94e5('0x1c')](_0x514806[_0x94e5('0x30')]['limit']);_0x3adf01[_0x94e5('0x1a')]=qs[_0x94e5('0x1a')](_0x514806[_0x94e5('0x30')][_0x94e5('0x1a')]);}_0x3adf01[_0x94e5('0x38')]=qs[_0x94e5('0x39')](_0x514806[_0x94e5('0x30')]['sort']);_0x3adf01[_0x94e5('0x3a')]=qs['filters'](_[_0x94e5('0x3b')](_0x514806[_0x94e5('0x30')],_0x459b00['filters']),_0x5647ae);if(_0x514806[_0x94e5('0x30')]['filter']){_0x3adf01[_0x94e5('0x3a')]=_[_0x94e5('0x3c')](_0x3adf01[_0x94e5('0x3a')],{'$or':_[_0x94e5('0x2f')](_0x5647ae,function(_0x35402d){if(_0x35402d[_0x94e5('0x2c')]!==_0x94e5('0x3d')){var _0x397894={};_0x397894[_0x35402d[_0x94e5('0x26')]]={'$like':'%'+_0x514806[_0x94e5('0x30')][_0x94e5('0x3e')]+'%'};return _0x397894;}})});}_0x3adf01=_['merge']({},_0x3adf01,_0x514806[_0x94e5('0x3f')]);var _0x2bb14d={'where':_0x3adf01[_0x94e5('0x3a')]};return db[_0x94e5('0x29')][_0x94e5('0x1d')](_0x2bb14d)[_0x94e5('0x22')](function(_0x370523){_0x2aff2a['count']=_0x370523;if(_0x514806[_0x94e5('0x30')]['includeAll']){_0x3adf01[_0x94e5('0x40')]=[{'all':!![]}];}return db[_0x94e5('0x29')][_0x94e5('0x41')](_0x3adf01);})[_0x94e5('0x22')](function(_0x79f6ed){_0x2aff2a[_0x94e5('0x42')]=_0x79f6ed;return _0x2aff2a;})['then'](respondWithFilteredResult(_0x25093d,_0x3adf01))['catch'](handleError(_0x25093d,null));};exports['show']=function(_0x1dabf2,_0x631cd8){var _0x480c7d={'raw':!![],'where':{'id':_0x1dabf2[_0x94e5('0x43')]['id']}},_0x188da6={};_0x188da6[_0x94e5('0x2e')]=_['keys'](db['ChatTransferReport'][_0x94e5('0x2a')]);_0x188da6['query']=_[_0x94e5('0x31')](_0x1dabf2[_0x94e5('0x30')]);_0x188da6[_0x94e5('0x32')]=_['intersection'](_0x188da6[_0x94e5('0x2e')],_0x188da6[_0x94e5('0x30')]);_0x480c7d[_0x94e5('0x35')]=_['intersection'](_0x188da6['model'],qs['fields'](_0x1dabf2[_0x94e5('0x30')][_0x94e5('0x34')]));_0x480c7d[_0x94e5('0x35')]=_0x480c7d[_0x94e5('0x35')]['length']?_0x480c7d['attributes']:_0x188da6[_0x94e5('0x2e')];if(_0x1dabf2[_0x94e5('0x30')][_0x94e5('0x44')]){_0x480c7d[_0x94e5('0x40')]=[{'all':!![]}];}_0x480c7d=_[_0x94e5('0x3c')]({},_0x480c7d,_0x1dabf2[_0x94e5('0x3f')]);return db[_0x94e5('0x29')][_0x94e5('0x45')](_0x480c7d)[_0x94e5('0x22')](handleEntityNotFound(_0x631cd8,null))['then'](respondWithResult(_0x631cd8,null))[_0x94e5('0x46')](handleError(_0x631cd8,null));};exports[_0x94e5('0x47')]=function(_0x4c7fd1,_0x98fb08){return db[_0x94e5('0x29')][_0x94e5('0x47')](_0x4c7fd1[_0x94e5('0x48')],{})[_0x94e5('0x22')](respondWithResult(_0x98fb08,0xc9))[_0x94e5('0x46')](handleError(_0x98fb08,null));};exports['update']=function(_0x3be59c,_0x240248){if(_0x3be59c[_0x94e5('0x48')]['id']){delete _0x3be59c[_0x94e5('0x48')]['id'];}return db[_0x94e5('0x29')]['find']({'where':{'id':_0x3be59c[_0x94e5('0x43')]['id']}})[_0x94e5('0x22')](handleEntityNotFound(_0x240248,null))[_0x94e5('0x22')](saveUpdates(_0x3be59c['body'],null))[_0x94e5('0x22')](respondWithResult(_0x240248,null))[_0x94e5('0x46')](handleError(_0x240248,null));};exports[_0x94e5('0x23')]=function(_0x1233e2,_0xd101ce){return db['ChatTransferReport']['find']({'where':{'id':_0x1233e2[_0x94e5('0x43')]['id']}})[_0x94e5('0x22')](handleEntityNotFound(_0xd101ce,null))[_0x94e5('0x22')](removeEntity(_0xd101ce,null))[_0x94e5('0x46')](handleError(_0xd101ce,null));};exports[_0x94e5('0x49')]=function(_0x573898,_0x2b11e4){return db[_0x94e5('0x29')][_0x94e5('0x49')]()[_0x94e5('0x22')](respondWithResult(_0x2b11e4,null))[_0x94e5('0x46')](handleError(_0x2b11e4,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 3b766ae..a43dbf6 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 _0x5908=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatTransferReport','uniqueid'];(function(_0x2d584e,_0x2c0c9a){var _0x4b3ce4=function(_0x2bbfa4){while(--_0x2bbfa4){_0x2d584e['push'](_0x2d584e['shift']());}};_0x4b3ce4(++_0x2c0c9a);}(_0x5908,0x1d4));var _0x8590=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x5908[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x8590('0x0'));var util=require(_0x8590('0x1'));var logger=require(_0x8590('0x2'))(_0x8590('0x3'));var moment=require('moment');var BPromise=require(_0x8590('0x4'));var rp=require(_0x8590('0x5'));var fs=require('fs');var path=require(_0x8590('0x6'));var rimraf=require(_0x8590('0x7'));var config=require(_0x8590('0x8'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0xdcd657,_0x4babb9){return _0xdcd657[_0x8590('0x9')](_0x8590('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8590('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x51e6=['rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','../../config/logger','moment','bluebird','path'];(function(_0x2edfdc,_0x5a5493){var _0x2a98f5=function(_0x50c094){while(--_0x50c094){_0x2edfdc['push'](_0x2edfdc['shift']());}};_0x2a98f5(++_0x5a5493);}(_0x51e6,0x1f3));var _0x651e=function(_0x25a19a,_0x536079){_0x25a19a=_0x25a19a-0x0;var _0x9d8a38=_0x51e6[_0x25a19a];return _0x9d8a38;};'use strict';var _=require(_0x651e('0x0'));var util=require('util');var logger=require(_0x651e('0x1'))('api');var moment=require(_0x651e('0x2'));var BPromise=require(_0x651e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x651e('0x4'));var rimraf=require(_0x651e('0x5'));var config=require(_0x651e('0x6'));var attributes=require(_0x651e('0x7'));module['exports']=function(_0x115a8d,_0x48bbc2){return _0x115a8d[_0x651e('0x8')](_0x651e('0x9'),attributes,{'tableName':_0x651e('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x651e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 163bf19..07128b5 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 _0xe332=['../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x53a2c9,_0x5bcc2e){var _0x3b1949=function(_0x3cbcac){while(--_0x3cbcac){_0x53a2c9['push'](_0x53a2c9['shift']());}};_0x3b1949(++_0x5bcc2e);}(_0xe332,0x8e));var _0x2e33=function(_0x5e2aaf,_0x5ee3e3){_0x5e2aaf=_0x5e2aaf-0x0;var _0x508383=_0xe332[_0x5e2aaf];return _0x508383;};'use strict';var _=require(_0x2e33('0x0'));var util=require(_0x2e33('0x1'));var moment=require(_0x2e33('0x2'));var BPromise=require(_0x2e33('0x3'));var rs=require(_0x2e33('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e33('0x5'))['db'];var utils=require(_0x2e33('0x6'));var logger=require(_0x2e33('0x7'))(_0x2e33('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2e33('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x398329,_0x2fe297,_0x5cce4f){return new BPromise(function(_0x303fb9,_0x32d9b7){return client[_0x2e33('0xa')](_0x398329,_0x5cce4f)[_0x2e33('0xb')](function(_0x35ad9e){logger[_0x2e33('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x2fe297,'request\x20sent');logger['debug'](_0x2e33('0xd'),_0x2fe297,_0x2e33('0xe'),JSON[_0x2e33('0xf')](_0x35ad9e));if(_0x35ad9e[_0x2e33('0x10')]){if(_0x35ad9e[_0x2e33('0x10')]['code']===0x1f4){logger['error'](_0x2e33('0x11'),_0x2fe297,_0x35ad9e[_0x2e33('0x10')][_0x2e33('0x12')]);return _0x32d9b7(_0x35ad9e[_0x2e33('0x10')]['message']);}logger['error'](_0x2e33('0x11'),_0x2fe297,_0x35ad9e[_0x2e33('0x10')]['message']);return _0x303fb9(_0x35ad9e[_0x2e33('0x10')][_0x2e33('0x12')]);}else{logger[_0x2e33('0xc')](_0x2e33('0x11'),_0x2fe297,_0x2e33('0xe'));_0x303fb9(_0x35ad9e[_0x2e33('0x13')]['message']);}})[_0x2e33('0x14')](function(_0x4205d1){logger[_0x2e33('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x2fe297,_0x4205d1);_0x32d9b7(_0x4205d1);});});} \ No newline at end of file +var _0x419b=['then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x45064c,_0x216778){var _0x4b52ca=function(_0x5167e1){while(--_0x5167e1){_0x45064c['push'](_0x45064c['shift']());}};_0x4b52ca(++_0x216778);}(_0x419b,0x66));var _0xb419=function(_0x9dccbb,_0x684fcf){_0x9dccbb=_0x9dccbb-0x0;var _0x630e98=_0x419b[_0x9dccbb];return _0x630e98;};'use strict';var _=require(_0xb419('0x0'));var util=require(_0xb419('0x1'));var moment=require('moment');var BPromise=require(_0xb419('0x2'));var rs=require(_0xb419('0x3'));var fs=require('fs');var Redis=require(_0xb419('0x4'));var db=require(_0xb419('0x5'))['db'];var utils=require(_0xb419('0x6'));var logger=require(_0xb419('0x7'))(_0xb419('0x8'));var config=require(_0xb419('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb419('0xa')][_0xb419('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dc206,_0x4ba229,_0x5016a7){return new BPromise(function(_0x60b48c,_0x5ec502){return client[_0xb419('0xc')](_0x4dc206,_0x5016a7)[_0xb419('0xd')](function(_0x23b8da){logger[_0xb419('0xe')](_0xb419('0xf'),_0x4ba229,'request\x20sent');logger[_0xb419('0x10')](_0xb419('0x11'),_0x4ba229,'request\x20sent',JSON[_0xb419('0x12')](_0x23b8da));if(_0x23b8da[_0xb419('0x13')]){if(_0x23b8da[_0xb419('0x13')][_0xb419('0x14')]===0x1f4){logger[_0xb419('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x4ba229,_0x23b8da['error'][_0xb419('0x15')]);return _0x5ec502(_0x23b8da['error'][_0xb419('0x15')]);}logger[_0xb419('0x13')](_0xb419('0xf'),_0x4ba229,_0x23b8da[_0xb419('0x13')][_0xb419('0x15')]);return _0x60b48c(_0x23b8da[_0xb419('0x13')][_0xb419('0x15')]);}else{logger[_0xb419('0xe')](_0xb419('0xf'),_0x4ba229,'request\x20sent');_0x60b48c(_0x23b8da[_0xb419('0x16')][_0xb419('0x15')]);}})['catch'](function(_0x1cae3){logger[_0xb419('0x13')](_0xb419('0xf'),_0x4ba229,_0x1cae3);_0x5ec502(_0x1cae3);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 3a231fb..5316b46 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 _0x2d95=['destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete'];(function(_0x4a96cb,_0x48d55d){var _0x83781=function(_0x52c661){while(--_0x52c661){_0x4a96cb['push'](_0x4a96cb['shift']());}};_0x83781(++_0x48d55d);}(_0x2d95,0xca));var _0x52d9=function(_0xdc9cf,_0x40dc29){_0xdc9cf=_0xdc9cf-0x0;var _0x702704=_0x2d95[_0xdc9cf];return _0x702704;};'use strict';var multer=require(_0x52d9('0x0'));var util=require('util');var path=require(_0x52d9('0x1'));var timeout=require('connect-timeout');var express=require(_0x52d9('0x2'));var router=express[_0x52d9('0x3')]();var fs_extra=require(_0x52d9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x52d9('0x5'));var config=require(_0x52d9('0x6'));var controller=require(_0x52d9('0x7'));router[_0x52d9('0x8')]('/',auth[_0x52d9('0x9')](),controller[_0x52d9('0xa')]);router[_0x52d9('0x8')](_0x52d9('0xb'),auth[_0x52d9('0x9')](),controller[_0x52d9('0xc')]);router[_0x52d9('0x8')](_0x52d9('0xd'),auth[_0x52d9('0x9')](),controller[_0x52d9('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x52d9('0xf')](_0x52d9('0xd'),auth[_0x52d9('0x9')](),controller[_0x52d9('0x10')]);router[_0x52d9('0x11')]('/:id',auth[_0x52d9('0x9')](),controller[_0x52d9('0x12')]);module[_0x52d9('0x13')]=router; \ No newline at end of file +var _0x3559=['../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x3559,0x1b5));var _0x9355=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3559[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x9355('0x0'));var util=require(_0x9355('0x1'));var path=require(_0x9355('0x2'));var timeout=require('connect-timeout');var express=require(_0x9355('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9355('0x4'));var interaction=require(_0x9355('0x5'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0x9355('0x6')]('/',auth[_0x9355('0x7')](),controller[_0x9355('0x8')]);router[_0x9355('0x6')](_0x9355('0x9'),auth[_0x9355('0x7')](),controller['describe']);router['get'](_0x9355('0xa'),auth[_0x9355('0x7')](),controller[_0x9355('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9355('0xc')]);router['put'](_0x9355('0xa'),auth[_0x9355('0x7')](),controller[_0x9355('0xd')]);router[_0x9355('0xe')](_0x9355('0xa'),auth[_0x9355('0x7')](),controller[_0x9355('0xf')]);module[_0x9355('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 137a8b2..a524c0c 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 _0x451c=['Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','squared','Chat','BOOLEAN','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','input','name','getDataValue','setDataValue','onlineForm','stringify','textarea','Comments','Leave\x20your\x20comments','parse','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:'];(function(_0x197115,_0x14d69a){var _0x19d830=function(_0x1f59c5){while(--_0x1f59c5){_0x197115['push'](_0x197115['shift']());}};_0x19d830(++_0x14d69a);}(_0x451c,0x75));var _0xc451=function(_0x4d8fe1,_0x3ed474){_0x4d8fe1=_0x4d8fe1-0x0;var _0x46685e=_0x451c[_0x4d8fe1];return _0x46685e;};'use strict';var Sequelize=require(_0xc451('0x0'));var rs=require(_0xc451('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xc451('0x2')],'allowNull':![],'unique':_0xc451('0x3')},'description':{'type':Sequelize[_0xc451('0x2')]},'mapKey':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xc451('0x4')},'key':{'type':Sequelize[_0xc451('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xc451('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xc451('0x2')],'allowNull':![],'defaultValue':_0xc451('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc451('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc451('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xc451('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xc451('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xc451('0x9')](_0xc451('0xa'),_0xc451('0xb')),'defaultValue':_0xc451('0xa')},'header_online':{'type':Sequelize[_0xc451('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0xc')},'offline_chat_button':{'type':Sequelize[_0xc451('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xc451('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xc451('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xc451('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xc451('0xd')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xc451('0xe')]},'closingQuestion':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x11')},'noteTitle':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x12')},'placeholderMessage':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xc451('0x14')},'closingMessageButton':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x15')},'skipMessageButton':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x16')},'conditionAgreement':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x17')},'ratingType':{'type':Sequelize['ENUM'](_0xc451('0x18'),_0xc451('0x19')),'defaultValue':_0xc451('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xc451('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xc451('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xc451('0x1a'),'variable':null,'config':{'placeholder':_0xc451('0x1b'),'type':'text','required':!![]},'props':{'title':_0xc451('0x1b'),'helpText':''}},{'type':'input','props':{'title':_0xc451('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xc451('0x4'),'type':_0xc451('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xc451('0x1c')]('onlineForm')?JSON['parse'](this['getDataValue']('onlineForm')):{};},'set':function(_0x13b720){return this[_0xc451('0x1d')](_0xc451('0x1e'),JSON[_0xc451('0x1f')](_0x13b720));}},'offlineForm':{'type':Sequelize[_0xc451('0xe')],'defaultValue':function(){return JSON[_0xc451('0x1f')]({'items':[{'type':_0xc451('0x1a'),'props':{'title':_0xc451('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xc451('0x4'),'type':'email'},'variable':null},{'type':_0xc451('0x20'),'config':{'placeholder':_0xc451('0x21')},'props':{'title':_0xc451('0x21'),'helpText':_0xc451('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xc451('0x1c')]('offlineForm')?JSON[_0xc451('0x23')](this[_0xc451('0x1c')](_0xc451('0x24'))):{};},'set':function(_0x214155){return this[_0xc451('0x1d')](_0xc451('0x24'),JSON['stringify'](_0x214155));}},'token':{'type':Sequelize[_0xc451('0x2')],'defaultValue':function(){return rs[_0xc451('0x25')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x26')},'waitingMessage':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x27')},'offlineMessageSubject':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xc451('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0xc451('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x2a')},'skipUnmanaged':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x16')},'sendUnmanaged':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x15')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xc451('0xe')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xc451('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc451('0x2b');}},'notificationSound':{'type':Sequelize[_0xc451('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0xc451('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xc451('0x2')],'defaultValue':_0xc451('0x2d')},'verticalAlignment':{'type':Sequelize[_0xc451('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xc451('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xc451('0x2')]},'customerAvatar':{'type':Sequelize[_0xc451('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xc451('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xc451('0x2')],'allowNull':![],'defaultValue':_0xc451('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc451('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc451('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xc451('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xc451('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc451('0x8')],'comment':_0xc451('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc451('0x30'),'set':function(_0x2b138e){if(!_0x2b138e)this[_0xc451('0x1d')](_0xc451('0x31'),null);this[_0xc451('0x1d')](_0xc451('0x32'),_0x2b138e);}},'vidaooEscalation':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xc451('0x2')]},'vidaooTopic':{'type':Sequelize[_0xc451('0x2')],'allowNull':![],'defaultValue':_0xc451('0x33')},'vidaooNote':{'type':Sequelize[_0xc451('0x2')],'defaultValue':function(){return _0xc451('0x34');}},'vidaooMetadata':{'type':Sequelize[_0xc451('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xc451('0xd')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xc451('0xe')]}}; \ No newline at end of file +var _0x319d=['alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','stringify','input','text','name','getDataValue','onlineForm','parse','textarea','Comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','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','bottom_right'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0x319d,0xfb));var _0xd319=function(_0x20c290,_0x47e736){_0x20c290=_0x20c290-0x0;var _0x3d7b3b=_0x319d[_0x20c290];return _0x3d7b3b;};'use strict';var Sequelize=require(_0xd319('0x0'));var rs=require(_0xd319('0x1'));module['exports']={'name':{'type':Sequelize[_0xd319('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xd319('0x2')],'allowNull':![],'unique':_0xd319('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xd319('0x4')},'mapKeyOffline':{'type':Sequelize[_0xd319('0x2')],'defaultValue':_0xd319('0x4')},'key':{'type':Sequelize[_0xd319('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xd319('0x2')],'defaultValue':_0xd319('0x5')},'customerAlias':{'type':Sequelize[_0xd319('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xd319('0x2')],'allowNull':![],'defaultValue':_0xd319('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd319('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd319('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xd319('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xd319('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xd319('0xa'),_0xd319('0xb')),'defaultValue':_0xd319('0xa')},'header_online':{'type':Sequelize[_0xd319('0x2')],'defaultValue':_0xd319('0xc')},'start_chat_button':{'type':Sequelize[_0xd319('0x2')],'defaultValue':_0xd319('0xd')},'offline_chat_button':{'type':Sequelize[_0xd319('0x2')],'defaultValue':_0xd319('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xd319('0xf')},'download_transcript':{'type':Sequelize[_0xd319('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xd319('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xd319('0x2')],'defaultValue':_0xd319('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xd319('0x11')]},'closingQuestion':{'type':Sequelize[_0xd319('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd319('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd319('0x13')},'noteTitle':{'type':Sequelize[_0xd319('0x2')],'defaultValue':_0xd319('0x14')},'placeholderMessage':{'type':Sequelize[_0xd319('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xd319('0x2')],'defaultValue':_0xd319('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xd319('0xe')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xd319('0x16')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xd319('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xd319('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xd319('0x2')],'defaultValue':_0xd319('0x17')},'ratingType':{'type':Sequelize[_0xd319('0x18')]('star','thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xd319('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xd319('0x11')],'defaultValue':function(){return JSON[_0xd319('0x19')]({'items':[{'type':_0xd319('0x1a'),'variable':null,'config':{'placeholder':'name','type':_0xd319('0x1b'),'required':!![]},'props':{'title':_0xd319('0x1c'),'helpText':''}},{'type':'input','props':{'title':_0xd319('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xd319('0x4'),'type':_0xd319('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xd319('0x1d')](_0xd319('0x1e'))?JSON[_0xd319('0x1f')](this[_0xd319('0x1d')](_0xd319('0x1e'))):{};},'set':function(_0x3240b2){return this['setDataValue']('onlineForm',JSON[_0xd319('0x19')](_0x3240b2));}},'offlineForm':{'type':Sequelize[_0xd319('0x11')],'defaultValue':function(){return JSON[_0xd319('0x19')]({'items':[{'type':'input','props':{'title':_0xd319('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xd319('0x4'),'type':'email'},'variable':null},{'type':_0xd319('0x20'),'config':{'placeholder':_0xd319('0x21')},'props':{'title':_0xd319('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xd319('0x1d')](_0xd319('0x22'))?JSON[_0xd319('0x1f')](this[_0xd319('0x1d')](_0xd319('0x22'))):{};},'set':function(_0x316228){return this[_0xd319('0x23')](_0xd319('0x22'),JSON[_0xd319('0x19')](_0x316228));}},'token':{'type':Sequelize[_0xd319('0x2')],'defaultValue':function(){return rs[_0xd319('0x24')]();}},'autoclose':{'type':Sequelize[_0xd319('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xd319('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xd319('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xd319('0x2')]},'forwardOffline':{'type':Sequelize[_0xd319('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xd319('0x2')],'defaultValue':_0xd319('0x25')},'waitingMessage':{'type':Sequelize[_0xd319('0x2')],'defaultValue':_0xd319('0x26')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xd319('0x2')],'defaultValue':_0xd319('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xd319('0x2')],'defaultValue':_0xd319('0x16')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xd319('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xd319('0x11')]},'showAgentAvatar':{'type':Sequelize[_0xd319('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xd319('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd319('0x28');}},'notificationSound':{'type':Sequelize[_0xd319('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xd319('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xd319('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xd319('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xd319('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xd319('0x2')],'defaultValue':_0xd319('0x2b')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xd319('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0xd319('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xd319('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd319('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xd319('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd319('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd319('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xd319('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd319('0x8')],'comment':_0xd319('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0xd319('0x9')],'defaultValue':![],'comment':_0xd319('0x2e'),'set':function(_0x44c8d2){if(!_0x44c8d2)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xd319('0x23')](_0xd319('0x2f'),_0x44c8d2);}},'vidaooEscalation':{'type':Sequelize[_0xd319('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xd319('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xd319('0x2')],'defaultValue':function(){return _0xd319('0x30');}},'vidaooMetadata':{'type':Sequelize[_0xd319('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xd319('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xd319('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 6c4bdd5..c66eb83 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 _0xaa4e=['fields','query','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','show','params','intersection','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','findAll','rows','removeDispositions','getAnswers','CannedAnswer','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','root','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmContact','Contacts','DESC','ChatApplication','Applications','List','applications','list','orderBy','asc','account','contact','headers','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','update','created','autoclose','close','unmanaged','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','files','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','subjectOffline','toPairsIn','mapValues','email','offlineMessageSubject','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','User','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','color_button','backgroundColor','addApplications','transaction','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','offlineForm','items','fromKey','getOfflineMessages','addAgents','omit','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','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/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatWebsite.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','save','get','ChatWebsites','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','model','keys'];(function(_0x4d5350,_0x41305b){var _0x4b2651=function(_0x2e88d3){while(--_0x2e88d3){_0x4d5350['push'](_0x4d5350['shift']());}};_0x4b2651(++_0x41305b);}(_0xaa4e,0xf3));var _0xeaa4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xaa4e[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xeaa4('0x0'));var rimraf=require(_0xeaa4('0x1'));var zipdir=require(_0xeaa4('0x2'));var jsonpatch=require(_0xeaa4('0x3'));var rp=require(_0xeaa4('0x4'));var moment=require(_0xeaa4('0x5'));var BPromise=require(_0xeaa4('0x6'));var Mustache=require(_0xeaa4('0x7'));var util=require(_0xeaa4('0x8'));var path=require('path');var sox=require(_0xeaa4('0x9'));var csv=require('to-csv');var ejs=require(_0xeaa4('0xa'));var fs=require('fs');var fs_extra=require(_0xeaa4('0xb'));var _=require(_0xeaa4('0xc'));var squel=require(_0xeaa4('0xd'));var crypto=require('crypto');var jsforce=require(_0xeaa4('0xe'));var deskjs=require(_0xeaa4('0xf'));var toCsv=require(_0xeaa4('0x10'));var querystring=require(_0xeaa4('0x11'));var Papa=require(_0xeaa4('0x12'));var Redis=require(_0xeaa4('0x13'));var authService=require(_0xeaa4('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xeaa4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeaa4('0x16'))('api');var utils=require(_0xeaa4('0x17'));var config=require(_0xeaa4('0x18'));var licenseUtil=require(_0xeaa4('0x19'));var db=require('../../mysqldb')['db'];config[_0xeaa4('0x1a')]=_[_0xeaa4('0x1b')](config[_0xeaa4('0x1a')],{'host':_0xeaa4('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeaa4('0x1a')]));require(_0xeaa4('0x1d'))[_0xeaa4('0x1e')](socket);var jayson=require(_0xeaa4('0x1f'));var client=jayson[_0xeaa4('0x20')][_0xeaa4('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xeaa4('0x21')]({'port':0x232a});var client9003=jayson[_0xeaa4('0x20')][_0xeaa4('0x21')]({'port':0x232b});var client9001=jayson['client'][_0xeaa4('0x21')]({'port':0x2329});function respondWithRpcPromise(_0x18c372,_0x5101ba,_0x3e2ee0,_0x362625){return new BPromise(function(_0x497668,_0xa16223){var _0x968de5=_0x362625||client;return _0x968de5['request'](_0x18c372,_0x3e2ee0)[_0xeaa4('0x22')](function(_0xa7ba75){logger[_0xeaa4('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x5101ba,_0xeaa4('0x24'));logger[_0xeaa4('0x25')](_0xeaa4('0x26'),_0x5101ba,'request\x20sent',JSON[_0xeaa4('0x27')](_0xa7ba75));if(_0xa7ba75[_0xeaa4('0x28')]){if(_0xa7ba75[_0xeaa4('0x28')][_0xeaa4('0x29')]===0x1f4){logger[_0xeaa4('0x28')]('ChatWebsite,\x20%s,\x20%s',_0x5101ba,_0xa7ba75[_0xeaa4('0x28')][_0xeaa4('0x2a')]);return _0xa16223(_0xa7ba75[_0xeaa4('0x28')][_0xeaa4('0x2a')]);}logger[_0xeaa4('0x28')](_0xeaa4('0x2b'),_0x5101ba,_0xa7ba75[_0xeaa4('0x28')]['message']);return _0x497668(_0xa7ba75[_0xeaa4('0x28')][_0xeaa4('0x2a')]);}else{logger['info'](_0xeaa4('0x2b'),_0x5101ba,'request\x20sent');_0x497668(_0xa7ba75[_0xeaa4('0x2c')][_0xeaa4('0x2a')]);}})[_0xeaa4('0x2d')](function(_0x325158){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x5101ba,_0x325158);_0xa16223(_0x325158);});});}function respondWithStatusCode(_0x5e1eeb,_0x3c8df4){_0x3c8df4=_0x3c8df4||0xcc;return function(_0x18103e){if(_0x18103e){return _0x5e1eeb[_0xeaa4('0x2e')](_0x3c8df4);}return _0x5e1eeb['status'](_0x3c8df4)[_0xeaa4('0x2f')]();};}function respondWithResult(_0x2ef7ba,_0x2c2b84){_0x2c2b84=_0x2c2b84||0xc8;return function(_0x58c7df){if(_0x58c7df){return _0x2ef7ba['status'](_0x2c2b84)[_0xeaa4('0x30')](_0x58c7df);}};}function respondWithFilteredResult(_0x1ea81f,_0x25f01c){return function(_0x7ba4c1){if(_0x7ba4c1){var _0x39a147=typeof _0x25f01c[_0xeaa4('0x31')]===_0xeaa4('0x32')&&typeof _0x25f01c[_0xeaa4('0x33')]===_0xeaa4('0x32');var _0x19d6a8=_0x7ba4c1[_0xeaa4('0x34')];var _0x13c150=_0x39a147?0x0:_0x25f01c['offset'];var _0x4dcc22=_0x39a147?_0x7ba4c1[_0xeaa4('0x34')]:_0x25f01c[_0xeaa4('0x31')]+_0x25f01c[_0xeaa4('0x33')];var _0x468d1a;if(_0x4dcc22>=_0x19d6a8){_0x4dcc22=_0x19d6a8;_0x468d1a=0xc8;}else{_0x468d1a=0xce;}_0x1ea81f[_0xeaa4('0x35')](_0x468d1a);return _0x1ea81f[_0xeaa4('0x36')]('Content-Range',_0x13c150+'-'+_0x4dcc22+'/'+_0x19d6a8)[_0xeaa4('0x30')](_0x7ba4c1);}return null;};}function patchUpdates(_0x3d586e){return function(_0xf417e2){try{jsonpatch[_0xeaa4('0x37')](_0xf417e2,_0x3d586e,!![]);}catch(_0x2e8bec){return BPromise['reject'](_0x2e8bec);}return _0xf417e2[_0xeaa4('0x38')]();};}function saveUpdates(_0x56f3c2,_0x22fec5){return function(_0x5088f5){if(_0x5088f5){return _0x5088f5['update'](_0x56f3c2)[_0xeaa4('0x22')](function(_0x59dacb){return _0x59dacb;});}return null;};}function removeEntity(_0x3f90d4,_0x443274){return function(_0x42009f){if(_0x42009f){return _0x42009f['destroy']()[_0xeaa4('0x22')](function(){var _0x342366=_0x42009f[_0xeaa4('0x39')]({'plain':!![]});var _0x2b0c42=_0xeaa4('0x3a');return db['UserProfileResource']['destroy']({'where':{'type':_0x2b0c42,'resourceId':_0x342366['id']}})[_0xeaa4('0x22')](function(){return _0x42009f;});})[_0xeaa4('0x22')](function(){_0x3f90d4[_0xeaa4('0x35')](0xcc)[_0xeaa4('0x2f')]();});}};}function handleEntityNotFound(_0x58feb0,_0x17e019){return function(_0x2c6be0){if(!_0x2c6be0){_0x58feb0[_0xeaa4('0x2e')](0x194);}return _0x2c6be0;};}function handleError(_0x12c525,_0xea7fb8){_0xea7fb8=_0xea7fb8||0x1f4;return function(_0xc09b6c){logger[_0xeaa4('0x28')](_0xc09b6c[_0xeaa4('0x3b')]);if(_0xc09b6c[_0xeaa4('0x3c')]){delete _0xc09b6c[_0xeaa4('0x3c')];}_0x12c525['status'](_0xea7fb8)[_0xeaa4('0x3d')](_0xc09b6c);};}exports[_0xeaa4('0x3e')]=function(_0x339955,_0x2ede5a){var _0x5d88a3={'include':[{'model':db[_0xeaa4('0x3f')],'as':_0xeaa4('0x40')}]},_0x1aede7={},_0x5445f6={'count':0x0,'rows':[]};var _0x3ad7b0=_[_0xeaa4('0x41')](db[_0xeaa4('0x42')][_0xeaa4('0x43')],function(_0x15dee3){return{'name':_0x15dee3[_0xeaa4('0x44')],'type':_0x15dee3[_0xeaa4('0x45')]['key']};});_0x1aede7[_0xeaa4('0x46')]=_[_0xeaa4('0x41')](_0x3ad7b0,_0xeaa4('0x3c'));_0x1aede7['query']=_[_0xeaa4('0x47')](_0x339955['query']);_0x1aede7['filters']=_['intersection'](_0x1aede7['model'],_0x1aede7['query']);_0x5d88a3['attributes']=_['intersection'](_0x1aede7[_0xeaa4('0x46')],qs[_0xeaa4('0x48')](_0x339955[_0xeaa4('0x49')][_0xeaa4('0x48')]));_0x5d88a3[_0xeaa4('0x4a')]=_0x5d88a3[_0xeaa4('0x4a')]['length']?_0x5d88a3['attributes']:_0x1aede7[_0xeaa4('0x46')];if(!_0x339955['query'][_0xeaa4('0x4b')](_0xeaa4('0x4c'))){_0x5d88a3[_0xeaa4('0x33')]=qs[_0xeaa4('0x33')](_0x339955['query'][_0xeaa4('0x33')]);_0x5d88a3['offset']=qs[_0xeaa4('0x31')](_0x339955[_0xeaa4('0x49')][_0xeaa4('0x31')]);}_0x5d88a3['order']=qs['sort'](_0x339955['query'][_0xeaa4('0x4d')]);_0x5d88a3[_0xeaa4('0x4e')]=qs[_0xeaa4('0x4f')](_[_0xeaa4('0x50')](_0x339955['query'],_0x1aede7[_0xeaa4('0x4f')]),_0x3ad7b0);if(_0x339955[_0xeaa4('0x49')]['filter']){_0x5d88a3[_0xeaa4('0x4e')]=_['merge'](_0x5d88a3[_0xeaa4('0x4e')],{'$or':_[_0xeaa4('0x41')](_0x3ad7b0,function(_0x412f43){if(_0x412f43[_0xeaa4('0x45')]!=='VIRTUAL'){var _0x54eca5={};_0x54eca5[_0x412f43['name']]={'$like':'%'+_0x339955[_0xeaa4('0x49')][_0xeaa4('0x51')]+'%'};return _0x54eca5;}})});}_0x5d88a3=_[_0xeaa4('0x52')]({},_0x5d88a3,_0x339955[_0xeaa4('0x53')]);var _0x692d33={'where':_0x5d88a3['where']};return db['ChatWebsite']['count'](_0x692d33)['then'](function(_0x39b4e1){_0x5445f6[_0xeaa4('0x34')]=_0x39b4e1;if(_0x339955[_0xeaa4('0x49')][_0xeaa4('0x54')]){_0x5d88a3[_0xeaa4('0x55')]=[{'all':!![]}];}return db[_0xeaa4('0x42')]['findAll'](_0x5d88a3);})[_0xeaa4('0x22')](function(_0x5e5082){_0x5445f6['rows']=_0x5e5082;return _0x5445f6;})[_0xeaa4('0x22')](respondWithFilteredResult(_0x2ede5a,_0x5d88a3))[_0xeaa4('0x2d')](handleError(_0x2ede5a,null));};exports[_0xeaa4('0x56')]=function(_0x5564c0,_0x5b1e3d){var _0x11fc08={'raw':![],'where':{'id':_0x5564c0[_0xeaa4('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xeaa4('0x40')}]},_0x28265c={};_0x28265c[_0xeaa4('0x46')]=_['keys'](db[_0xeaa4('0x42')][_0xeaa4('0x43')]);_0x28265c[_0xeaa4('0x49')]=_[_0xeaa4('0x47')](_0x5564c0[_0xeaa4('0x49')]);_0x28265c[_0xeaa4('0x4f')]=_[_0xeaa4('0x58')](_0x28265c[_0xeaa4('0x46')],_0x28265c[_0xeaa4('0x49')]);_0x11fc08[_0xeaa4('0x4a')]=_['intersection'](_0x28265c['model'],qs[_0xeaa4('0x48')](_0x5564c0[_0xeaa4('0x49')][_0xeaa4('0x48')]));_0x11fc08[_0xeaa4('0x4a')]=_0x11fc08[_0xeaa4('0x4a')][_0xeaa4('0x59')]?_0x11fc08[_0xeaa4('0x4a')]:_0x28265c['model'];if(_0x5564c0['query'][_0xeaa4('0x54')]){_0x11fc08[_0xeaa4('0x55')]=[{'all':!![]}];}_0x11fc08=_[_0xeaa4('0x52')]({},_0x11fc08,_0x5564c0['options']);return db[_0xeaa4('0x42')][_0xeaa4('0x5a')](_0x11fc08)[_0xeaa4('0x22')](handleEntityNotFound(_0x5b1e3d,null))[_0xeaa4('0x22')](respondWithResult(_0x5b1e3d,null))[_0xeaa4('0x2d')](handleError(_0x5b1e3d,null));};exports[_0xeaa4('0x5b')]=function(_0x5de187,_0xe80252){return db[_0xeaa4('0x42')][_0xeaa4('0x5b')](_0x5de187[_0xeaa4('0x5c')],{})[_0xeaa4('0x22')](function(_0xc24937){var _0x30416e=_0x5de187[_0xeaa4('0x5d')]['get']({'plain':!![]});if(!_0x30416e)throw new Error(_0xeaa4('0x5e'));if(_0x30416e['role']===_0xeaa4('0x5d')){var _0x51bd93=_0xc24937[_0xeaa4('0x39')]({'plain':!![]});var _0x1b9bf5='ChatWebsites';return db[_0xeaa4('0x5f')][_0xeaa4('0x5a')]({'where':{'name':_0x1b9bf5,'userProfileId':_0x30416e[_0xeaa4('0x60')]},'raw':!![]})[_0xeaa4('0x22')](function(_0x2995df){if(_0x2995df&&_0x2995df[_0xeaa4('0x61')]===0x0){return db[_0xeaa4('0x62')][_0xeaa4('0x5b')]({'name':_0x51bd93[_0xeaa4('0x3c')],'resourceId':_0x51bd93['id'],'type':_0x2995df[_0xeaa4('0x3c')],'sectionId':_0x2995df['id']},{})[_0xeaa4('0x22')](function(){return _0xc24937;});}else{return _0xc24937;}})[_0xeaa4('0x2d')](function(_0x3ed757){logger[_0xeaa4('0x28')](_0xeaa4('0x63'),_0x3ed757);throw _0x3ed757;});}return _0xc24937;})['then'](respondWithResult(_0xe80252,0xc9))[_0xeaa4('0x2d')](handleError(_0xe80252,null));};exports['update']=function(_0x43a431,_0x4d090d){if(_0x43a431['body']['id']){delete _0x43a431['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x43a431[_0xeaa4('0x57')]['id']},'include':[{'model':db[_0xeaa4('0x3f')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4d090d,null))['then'](saveUpdates(_0x43a431[_0xeaa4('0x5c')],null))['then'](respondWithResult(_0x4d090d,null))[_0xeaa4('0x2d')](handleError(_0x4d090d,null));};exports[_0xeaa4('0x64')]=function(_0x1610d4,_0x438373){return db['ChatWebsite'][_0xeaa4('0x5a')]({'where':{'id':_0x1610d4[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x438373,null))[_0xeaa4('0x22')](removeEntity(_0x438373,null))['catch'](handleError(_0x438373,null));};exports['describe']=function(_0x36a206,_0x8429b6){return db[_0xeaa4('0x42')][_0xeaa4('0x65')]()[_0xeaa4('0x22')](respondWithResult(_0x8429b6,null))[_0xeaa4('0x2d')](handleError(_0x8429b6,null));};exports[_0xeaa4('0x66')]=function(_0x2f83f4,_0x12d348,_0x4dfa5a){if(_0x2f83f4[_0xeaa4('0x5c')]['id']){delete _0x2f83f4[_0xeaa4('0x5c')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x2f83f4[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x12d348,null))[_0xeaa4('0x22')](function(_0x1a5bc9){if(_0x1a5bc9){_0x2f83f4[_0xeaa4('0x5c')][_0xeaa4('0x67')]=_0x1a5bc9['id'];return db[_0xeaa4('0x68')]['create'](_0x2f83f4[_0xeaa4('0x5c')]);}})[_0xeaa4('0x22')](respondWithResult(_0x12d348,null))[_0xeaa4('0x2d')](handleError(_0x12d348,null));};exports[_0xeaa4('0x69')]=function(_0x5412f5,_0x4d7bc6,_0x394538){var _0x5a5c02={'raw':![],'where':{}};var _0x9215ab={};var _0x230c85={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xeaa4('0x6a')]({'where':{'id':_0x5412f5[_0xeaa4('0x57')]['id']}})['then'](handleEntityNotFound(_0x4d7bc6,null))[_0xeaa4('0x22')](function(_0x279718){if(_0x279718){_0x9215ab[_0xeaa4('0x46')]=_[_0xeaa4('0x47')](db['Disposition'][_0xeaa4('0x43')]);_0x9215ab[_0xeaa4('0x49')]=_[_0xeaa4('0x47')](_0x5412f5[_0xeaa4('0x49')]);_0x9215ab[_0xeaa4('0x4f')]=_[_0xeaa4('0x58')](_0x9215ab[_0xeaa4('0x46')],_0x9215ab[_0xeaa4('0x49')]);_0x5a5c02[_0xeaa4('0x4a')]=_[_0xeaa4('0x58')](_0x9215ab[_0xeaa4('0x46')],qs[_0xeaa4('0x48')](_0x5412f5['query'][_0xeaa4('0x48')]));_0x5a5c02[_0xeaa4('0x4a')]=_0x5a5c02[_0xeaa4('0x4a')][_0xeaa4('0x59')]?_0x5a5c02[_0xeaa4('0x4a')]:_0x9215ab[_0xeaa4('0x46')];if(!_0x5412f5[_0xeaa4('0x49')][_0xeaa4('0x4b')](_0xeaa4('0x4c'))){_0x5a5c02['limit']=qs['limit'](_0x5412f5['query'][_0xeaa4('0x33')]);_0x5a5c02[_0xeaa4('0x31')]=qs[_0xeaa4('0x31')](_0x5412f5[_0xeaa4('0x49')][_0xeaa4('0x31')]);}_0x5a5c02[_0xeaa4('0x6b')]=qs[_0xeaa4('0x4d')](_0x5412f5['query'][_0xeaa4('0x4d')]);_0x5a5c02['where']=qs['filters'](_[_0xeaa4('0x50')](_0x5412f5['query'],_0x9215ab[_0xeaa4('0x4f')]));_0x5a5c02[_0xeaa4('0x4e')][_0xeaa4('0x67')]=_0x279718['id'];if(_0x5412f5[_0xeaa4('0x49')][_0xeaa4('0x51')]){_0x5a5c02[_0xeaa4('0x4e')]=_[_0xeaa4('0x52')](_0x5a5c02[_0xeaa4('0x4e')],{'$or':_[_0xeaa4('0x41')](_0x5a5c02[_0xeaa4('0x4a')],function(_0x5b99ee){var _0x4ded59={};_0x4ded59[_0x5b99ee]={'$like':'%'+_0x5412f5[_0xeaa4('0x49')][_0xeaa4('0x51')]+'%'};return _0x4ded59;})});}_0x5a5c02=_[_0xeaa4('0x52')]({},_0x5a5c02,_0x5412f5[_0xeaa4('0x53')]);return db[_0xeaa4('0x68')][_0xeaa4('0x34')]({'where':_0x5a5c02[_0xeaa4('0x4e')]})[_0xeaa4('0x22')](function(_0x5ad980){_0x230c85[_0xeaa4('0x34')]=_0x5ad980;if(_0x5412f5[_0xeaa4('0x49')][_0xeaa4('0x54')]){_0x5a5c02[_0xeaa4('0x55')]=[{'all':!![]}];}return db[_0xeaa4('0x68')][_0xeaa4('0x6c')](_0x5a5c02);})['then'](function(_0x27b0b7){_0x230c85[_0xeaa4('0x6d')]=_0x27b0b7;return _0x230c85;});}})[_0xeaa4('0x22')](respondWithFilteredResult(_0x4d7bc6,_0x5a5c02))[_0xeaa4('0x2d')](handleError(_0x4d7bc6,null));};exports[_0xeaa4('0x6e')]=function(_0x574808,_0x21c3d5,_0x1f6de1){return db['ChatWebsite']['find']({'where':{'id':_0x574808[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x21c3d5,null))[_0xeaa4('0x22')](function(_0x2e0dec){if(_0x2e0dec){return _0x2e0dec[_0xeaa4('0x6e')](_0x574808[_0xeaa4('0x49')]['ids']);}})[_0xeaa4('0x22')](respondWithStatusCode(_0x21c3d5,null))[_0xeaa4('0x2d')](handleError(_0x21c3d5,null));};exports['addAnswer']=function(_0x5715b6,_0x35c3d5,_0x202421){if(_0x5715b6[_0xeaa4('0x5c')]['id']){delete _0x5715b6[_0xeaa4('0x5c')]['id'];}return db[_0xeaa4('0x42')][_0xeaa4('0x5a')]({'where':{'id':_0x5715b6[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x35c3d5,null))[_0xeaa4('0x22')](function(_0x5d9072){if(_0x5d9072){_0x5715b6['body'][_0xeaa4('0x67')]=_0x5d9072['id'];return db['CannedAnswer'][_0xeaa4('0x5b')](_0x5715b6['body']);}})[_0xeaa4('0x22')](respondWithResult(_0x35c3d5,null))['catch'](handleError(_0x35c3d5,null));};exports[_0xeaa4('0x6f')]=function(_0x22d546,_0x37e07c,_0x2e1ce5){var _0x254cc3={'raw':![],'where':{}};var _0x2c24ca={};var _0x3eae4b={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xeaa4('0x6a')]({'where':{'id':_0x22d546[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x37e07c,null))[_0xeaa4('0x22')](function(_0x341ee2){if(_0x341ee2){_0x2c24ca['model']=_[_0xeaa4('0x47')](db[_0xeaa4('0x70')][_0xeaa4('0x43')]);_0x2c24ca[_0xeaa4('0x49')]=_[_0xeaa4('0x47')](_0x22d546['query']);_0x2c24ca[_0xeaa4('0x4f')]=_['intersection'](_0x2c24ca[_0xeaa4('0x46')],_0x2c24ca[_0xeaa4('0x49')]);_0x254cc3[_0xeaa4('0x4a')]=_['intersection'](_0x2c24ca['model'],qs[_0xeaa4('0x48')](_0x22d546[_0xeaa4('0x49')]['fields']));_0x254cc3['attributes']=_0x254cc3[_0xeaa4('0x4a')][_0xeaa4('0x59')]?_0x254cc3['attributes']:_0x2c24ca[_0xeaa4('0x46')];if(!_0x22d546[_0xeaa4('0x49')][_0xeaa4('0x4b')](_0xeaa4('0x4c'))){_0x254cc3['limit']=qs[_0xeaa4('0x33')](_0x22d546['query'][_0xeaa4('0x33')]);_0x254cc3[_0xeaa4('0x31')]=qs[_0xeaa4('0x31')](_0x22d546[_0xeaa4('0x49')][_0xeaa4('0x31')]);}_0x254cc3[_0xeaa4('0x6b')]=qs[_0xeaa4('0x4d')](_0x22d546[_0xeaa4('0x49')][_0xeaa4('0x4d')]);_0x254cc3[_0xeaa4('0x4e')]=qs[_0xeaa4('0x4f')](_[_0xeaa4('0x50')](_0x22d546[_0xeaa4('0x49')],_0x2c24ca[_0xeaa4('0x4f')]));_0x254cc3[_0xeaa4('0x4e')][_0xeaa4('0x67')]=_0x341ee2['id'];if(_0x22d546[_0xeaa4('0x49')][_0xeaa4('0x51')]){_0x254cc3[_0xeaa4('0x4e')]=_[_0xeaa4('0x52')](_0x254cc3[_0xeaa4('0x4e')],{'$or':_['map'](_0x254cc3['attributes'],function(_0x141c69){var _0x31b9c7={};_0x31b9c7[_0x141c69]={'$like':'%'+_0x22d546[_0xeaa4('0x49')][_0xeaa4('0x51')]+'%'};return _0x31b9c7;})});}_0x254cc3=_['merge']({},_0x254cc3,_0x22d546[_0xeaa4('0x53')]);return db[_0xeaa4('0x70')][_0xeaa4('0x34')]({'where':_0x254cc3[_0xeaa4('0x4e')]})[_0xeaa4('0x22')](function(_0x15154d){_0x3eae4b[_0xeaa4('0x34')]=_0x15154d;if(_0x22d546['query'][_0xeaa4('0x54')]){_0x254cc3[_0xeaa4('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xeaa4('0x6c')](_0x254cc3);})[_0xeaa4('0x22')](function(_0x2f9f70){_0x3eae4b[_0xeaa4('0x6d')]=_0x2f9f70;return _0x3eae4b;});}})['then'](respondWithFilteredResult(_0x37e07c,_0x254cc3))[_0xeaa4('0x2d')](handleError(_0x37e07c,null));};exports['removeAnswers']=function(_0x5db873,_0x450c72,_0x17d27b){return db['ChatWebsite'][_0xeaa4('0x5a')]({'where':{'id':_0x5db873[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x450c72,null))[_0xeaa4('0x22')](function(_0x11e79b){if(_0x11e79b){return _0x11e79b[_0xeaa4('0x71')](_0x5db873['query'][_0xeaa4('0x72')]);}})['then'](respondWithStatusCode(_0x450c72,null))[_0xeaa4('0x2d')](handleError(_0x450c72,null));};exports[_0xeaa4('0x73')]=function(_0x59cf38,_0x126f5d,_0x2937ae){_0x59cf38['body'][_0xeaa4('0x74')]=_0x59cf38[_0xeaa4('0x75')][_0xeaa4('0x76')];return db[_0xeaa4('0x42')][_0xeaa4('0x5a')]({'where':{'id':_0x59cf38['params']['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x126f5d,null))[_0xeaa4('0x22')](saveUpdates(_0x59cf38[_0xeaa4('0x5c')],null))[_0xeaa4('0x22')](respondWithResult(_0x126f5d,null))[_0xeaa4('0x2d')](handleError(_0x126f5d,null));};exports[_0xeaa4('0x77')]=function(_0x574802,_0x3fce29,_0x57d312){_0x574802[_0xeaa4('0x5c')][_0xeaa4('0x78')]=_0x574802[_0xeaa4('0x75')][_0xeaa4('0x76')];return db[_0xeaa4('0x42')][_0xeaa4('0x5a')]({'where':{'id':_0x574802[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x3fce29,null))['then'](saveUpdates(_0x574802['body'],null))['then'](respondWithResult(_0x3fce29,null))['catch'](handleError(_0x3fce29,null));};exports[_0xeaa4('0x79')]=function(_0x14391f,_0x59e64d,_0x323252){_0x14391f['body']['customerAvatar']=_0x14391f[_0xeaa4('0x75')][_0xeaa4('0x76')];return db[_0xeaa4('0x42')][_0xeaa4('0x5a')]({'where':{'id':_0x14391f[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x59e64d,null))[_0xeaa4('0x22')](saveUpdates(_0x14391f['body'],null))[_0xeaa4('0x22')](respondWithResult(_0x59e64d,null))[_0xeaa4('0x2d')](handleError(_0x59e64d,null));};exports[_0xeaa4('0x7a')]=function(_0x19e953,_0x104226,_0x47e1ed){_0x19e953[_0xeaa4('0x5c')][_0xeaa4('0x7b')]=_0x19e953[_0xeaa4('0x75')][_0xeaa4('0x76')];return db[_0xeaa4('0x42')][_0xeaa4('0x5a')]({'where':{'id':_0x19e953[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x104226,null))[_0xeaa4('0x22')](saveUpdates(_0x19e953[_0xeaa4('0x5c')],null))[_0xeaa4('0x22')](respondWithResult(_0x104226,null))[_0xeaa4('0x2d')](handleError(_0x104226,null));};exports[_0xeaa4('0x7c')]=function(_0x4ead93,_0x270438,_0x4f9e78){var _0x55c5cd=path['join'](config[_0xeaa4('0x7d')],'server/files/images/logos/default_logo.svg');var _0x3894ac={'where':{'id':_0x4ead93[_0xeaa4('0x57')]['id']},'attributes':['id',_0xeaa4('0x74')],'raw':!![]};var _0x9d59d=![];return require('../../config/license/util')[_0xeaa4('0x7e')]()[_0xeaa4('0x22')](function(_0x2ca59e){if(_0x2ca59e){_0x9d59d=_0x2ca59e[_0xeaa4('0x7f')];}})[_0xeaa4('0x22')](function(){return db[_0xeaa4('0x42')][_0xeaa4('0x5a')](_0x3894ac);})[_0xeaa4('0x22')](handleEntityNotFound(_0x270438,null))[_0xeaa4('0x22')](function(_0x57fc48){if(_0x57fc48){if(!_[_0xeaa4('0x80')](_0x57fc48[_0xeaa4('0x74')])){if(fs[_0xeaa4('0x81')](path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0x83'),_0x57fc48[_0xeaa4('0x74')]))&&_0x9d59d){_0x55c5cd=path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0x83'),_0x57fc48[_0xeaa4('0x74')]);}}return _0x270438[_0xeaa4('0x84')](_0x55c5cd);}})['catch'](handleError(_0x270438,null));};exports[_0xeaa4('0x85')]=function(_0x36fc75,_0x31d087,_0x2a764d){var _0x3fb361=path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],'server/files/images/avatars/default_avatar.png');var _0x51cc71={'where':{'id':_0x36fc75[_0xeaa4('0x57')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0xeaa4('0x5a')](_0x51cc71)['then'](handleEntityNotFound(_0x31d087,null))['then'](function(_0x3b27dd){if(_0x3b27dd){if(!_[_0xeaa4('0x80')](_0x3b27dd['agentAvatar'])){if(fs[_0xeaa4('0x81')](path['join'](config['root'],_0xeaa4('0x86'),_0x3b27dd[_0xeaa4('0x78')]))){_0x3fb361=path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0x86'),_0x3b27dd['agentAvatar']);}}return _0x31d087['download'](_0x3fb361);}})[_0xeaa4('0x2d')](handleError(_0x31d087,null));};exports[_0xeaa4('0x87')]=function(_0x28aff8,_0x59635b,_0x3ed897){var _0x2c299c=path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0x88'));var _0x4b8044={'where':{'id':_0x28aff8[_0xeaa4('0x57')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0xeaa4('0x5a')](_0x4b8044)['then'](handleEntityNotFound(_0x59635b,null))['then'](function(_0xedcbc7){if(_0xedcbc7){if(!_[_0xeaa4('0x80')](_0xedcbc7['customerAvatar'])){if(fs[_0xeaa4('0x81')](path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0x86'),_0xedcbc7[_0xeaa4('0x89')]))&&_0xedcbc7[_0xeaa4('0x8a')]){_0x2c299c=path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],'server/files/images/avatars/',_0xedcbc7[_0xeaa4('0x89')]);}}return _0x59635b['download'](_0x2c299c);}})['catch'](handleError(_0x59635b,null));};exports[_0xeaa4('0x8b')]=function(_0x5c7082,_0x4a7fa6,_0x1eb73d){var _0x242423=path[_0xeaa4('0x82')](config['root'],_0xeaa4('0x8c'));var _0x3198f6={'where':{'id':_0x5c7082[_0xeaa4('0x57')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xeaa4('0x42')][_0xeaa4('0x5a')](_0x3198f6)[_0xeaa4('0x22')](handleEntityNotFound(_0x4a7fa6,null))[_0xeaa4('0x22')](function(_0x1409b6){if(_0x1409b6){if(!_[_0xeaa4('0x80')](_0x1409b6[_0xeaa4('0x7b')])){if(fs[_0xeaa4('0x81')](path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0x86'),_0x1409b6['systemAvatar']))){_0x242423=path['join'](config[_0xeaa4('0x7d')],'server/files/images/avatars/',_0x1409b6[_0xeaa4('0x7b')]);}}return _0x4a7fa6[_0xeaa4('0x84')](_0x242423);}})['catch'](handleError(_0x4a7fa6,null));};exports[_0xeaa4('0x8d')]=function(_0x1fda69,_0x5304c5,_0xc337f1){var _0x4ca0cb=require(_0xeaa4('0x8e'));var _0x354fcf=new _0x4ca0cb();var _0x362fd1=_0x354fcf[_0xeaa4('0x8f')](_0x1fda69['headers'][_0xeaa4('0x90')])[_0xeaa4('0x91')]();var _0x446220={'body':_0x1fda69[_0xeaa4('0x5c')],'channel':_0xeaa4('0x92')};var _0x43843e=[];var _0x36a305=[];var _0x3c2989={};var _0x8a58b5=![];return db['CmContact']['describe']()['then'](function(_0x172af9){if(!_0x172af9){throw new db[(_0xeaa4('0x93'))][(_0xeaa4('0x94'))](_0xeaa4('0x95'));}_0x43843e=_[_0xeaa4('0x96')](_[_0xeaa4('0x47')](_0x172af9),[_0xeaa4('0x97'),'updatedAt']);_0x36a305=_[_0xeaa4('0x96')](_[_0xeaa4('0x47')](_0x172af9),[_0xeaa4('0x97'),_0xeaa4('0x98'),_0xeaa4('0x99'),_0xeaa4('0x9a')]);if(_0x1fda69[_0xeaa4('0x5c')]['id']){delete _0x1fda69[_0xeaa4('0x5c')]['id'];}if(_[_0xeaa4('0x80')](_0x1fda69['body'][_0xeaa4('0x9b')])){throw new db[(_0xeaa4('0x93'))][(_0xeaa4('0x94'))](_0xeaa4('0x9c'));}if(_[_0xeaa4('0x80')](_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0x5c')])||_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0x5c')]===''){throw new db[(_0xeaa4('0x93'))][(_0xeaa4('0x94'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0x9d')])){throw new db[(_0xeaa4('0x93'))][(_0xeaa4('0x94'))](_0xeaa4('0x9e')+_0x36a305);}if(!_[_0xeaa4('0x9f')](_0x36a305,_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0x9d')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x36a305);}_0x3c2989[_0x1fda69['body'][_0xeaa4('0x9d')]]=_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0x9b')];})[_0xeaa4('0x22')](function(){return db[_0xeaa4('0x42')][_0xeaa4('0x5a')]({'where':{'id':_0x1fda69[_0xeaa4('0x57')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xeaa4('0xa0')],'as':_0xeaa4('0xa1'),'where':_0x3c2989,'limit':0x1,'order':[['updatedAt',_0xeaa4('0xa2')]]}]},{'model':db[_0xeaa4('0xa3')],'as':_0xeaa4('0xa4')}]});})[_0xeaa4('0x22')](handleEntityNotFound(_0x5304c5,null))['then'](function(_0x1bbc02){if(_0x1bbc02&&_0x1bbc02[_0xeaa4('0xa5')]){_0x446220['account']=_0x1bbc02;_0x446220[_0xeaa4('0xa6')]=_0x1bbc02['Applications'];_0x446220[_0xeaa4('0xa7')]=_0x1bbc02[_0xeaa4('0xa5')];_0x446220['applications']=_[_0xeaa4('0xa8')](_0x446220[_0xeaa4('0xa6')],['priority'],[_0xeaa4('0xa9')]);if(_0x446220[_0xeaa4('0xaa')][_0xeaa4('0xa4')]){delete _0x446220[_0xeaa4('0xaa')]['Applications'];}if(_0x446220[_0xeaa4('0xaa')]['List']&&_0x446220[_0xeaa4('0xaa')][_0xeaa4('0xa5')]['Contacts'][_0xeaa4('0x59')]){return _0x446220[_0xeaa4('0xaa')][_0xeaa4('0xa5')][_0xeaa4('0xa1')][0x0];}var _0xefeddb=_['defaults'](_0x1fda69[_0xeaa4('0x5c')],{'firstName':_0x1fda69['body'][_0xeaa4('0x9b')],'ListId':_0x1bbc02[_0xeaa4('0x9a')]});_0xefeddb[_0x1fda69['body'][_0xeaa4('0x9d')]]=_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0x9b')];return db[_0xeaa4('0xa0')][_0xeaa4('0x5b')](_0xefeddb,{'fields':_0x43843e,'raw':!![]});}})[_0xeaa4('0x22')](handleEntityNotFound(_0x5304c5,null))[_0xeaa4('0x22')](function(_0x72933e){_0x446220[_0xeaa4('0xab')]=_0x72933e;var _0xf31f75=_0x1fda69[_0xeaa4('0x5c')]['customerIp'];if(_0x1fda69[_0xeaa4('0xac')][_0xeaa4('0xad')]){_0xf31f75=_0x1fda69['headers']['cf-connecting-ip'];}else if(_0x1fda69[_0xeaa4('0xac')]['x-forwarded-for']){_0xf31f75=_['first'](_0x1fda69[_0xeaa4('0xac')][_0xeaa4('0xae')][_0xeaa4('0xaf')](','));}if(_0x72933e){var _0x2f7089={'ContactId':_0x72933e['id'],'ChatWebsiteId':_0x1fda69[_0xeaa4('0x57')]['id'],'from':(_0x72933e[_0xeaa4('0xb0')]||'')+'\x20'+(_0x72933e[_0xeaa4('0xb1')]||''),'customerIp':_0xf31f75,'customerPort':_0x1fda69['headers'][_0xeaa4('0xb2')]?_0x1fda69['headers']['x-real-port']:null,'referer':_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0xb3')],'browserName':_0x362fd1[_0xeaa4('0xb4')][_0xeaa4('0x3c')]&&_0x362fd1[_0xeaa4('0xb4')]['version']?util[_0xeaa4('0xb5')](_0xeaa4('0xb6'),_0x362fd1['browser']['name'],_0x362fd1[_0xeaa4('0xb4')][_0xeaa4('0xb7')]):'unknown','browserVersion':_0x362fd1[_0xeaa4('0xb4')]['version']||'unknown','osName':util[_0xeaa4('0xb5')](_0xeaa4('0xb6'),_0x362fd1['os'][_0xeaa4('0x3c')],_0x362fd1['os'][_0xeaa4('0xb7')]),'osVersion':_0x362fd1['os'][_0xeaa4('0xb7')],'deviceModel':_0x362fd1[_0xeaa4('0xb8')][_0xeaa4('0x46')]&&_0x362fd1[_0xeaa4('0xb8')][_0xeaa4('0xb9')]?util[_0xeaa4('0xb5')](_0xeaa4('0xba'),_0x362fd1[_0xeaa4('0xb8')][_0xeaa4('0x46')],_0x362fd1[_0xeaa4('0xb8')][_0xeaa4('0xb9')],_0x362fd1['device'][_0xeaa4('0x45')]):null,'deviceVendor':_0x362fd1[_0xeaa4('0xb8')]['vendor'],'deviceType':_0x362fd1[_0xeaa4('0xb8')][_0xeaa4('0x45')],'formData':JSON[_0xeaa4('0x27')](_0x1fda69[_0xeaa4('0x5c')])};var _0x29323c={'ChatWebsiteId':_0x1fda69['params']['id'],'closed':![]};if(_0x1fda69['body'][_0xeaa4('0xbb')]){_0x29323c['threadId']=_0x1fda69[_0xeaa4('0x5c')]['threadId'];return db[_0xeaa4('0xbc')][_0xeaa4('0x5a')]({'where':_0x29323c})['then'](function(_0x21ca27){if(_0x21ca27){return[_0x21ca27,![]];}_0x2f7089[_0xeaa4('0xbb')]=_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0xbb')];_0x2f7089['externalUrl']=_0x1fda69['body'][_0xeaa4('0xbd')];return db['ChatInteraction'][_0xeaa4('0x5b')](_0x2f7089)['then'](function(_0x55e56a){return[_0x55e56a,!![]];});});}_0x29323c[_0xeaa4('0xbe')]=_0x72933e['id'];if(_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0xbf')]&&_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0xbf')]['id']){_0x29323c['id']=_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0xbf')]['id'];return db[_0xeaa4('0xbc')][_0xeaa4('0x5a')]({'where':_0x29323c})[_0xeaa4('0x22')](function(_0x93314a){if(_0x93314a){return[_0x93314a,![]];}return db[_0xeaa4('0xbc')][_0xeaa4('0x5b')](_0x2f7089)[_0xeaa4('0x22')](function(_0x22d097){return[_0x22d097,!![]];});});}return db[_0xeaa4('0xbc')]['create'](_0x2f7089)[_0xeaa4('0x22')](function(_0x3fe781){return[_0x3fe781,!![]];});}})['spread'](function(_0x46607f,_0x4f8b92){if(_0x46607f){_0x8a58b5=_0x4f8b92;if(!_0x4f8b92){var _0x157434={'from':(_0x446220['contact'][_0xeaa4('0xb0')]||'')+'\x20'+(_0x446220[_0xeaa4('0xab')][_0xeaa4('0xb1')]||'')};if(_0x1fda69['body'][_0xeaa4('0xbb')]&&_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0xc0')]&&_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0xbb')]!=_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0xc0')]){_0x157434[_0xeaa4('0xbb')]=_0x1fda69['body'][_0xeaa4('0xc0')];}return _0x46607f[_0xeaa4('0xc1')](_0x157434);}else{return _0x46607f;}}})['then'](function(_0x2a698e){_0x446220['interaction']=_0x2a698e['get']({'plain':!![]});_0x446220[_0xeaa4('0xbf')][_0xeaa4('0xc2')]=_0x8a58b5;if(_0x446220[_0xeaa4('0xbf')][_0xeaa4('0xc2')]){if(_0x446220['account'][_0xeaa4('0xc3')]){_0x446220[_0xeaa4('0xa6')]['push']({'id':0x0,'priority':_0x446220[_0xeaa4('0xa6')][_0xeaa4('0x59')]+0x1,'app':_0xeaa4('0xc4'),'appdata':_0xeaa4('0xc5'),'interval':'*,*,*,*'});}}return db['ChatMessage']['create']({'body':_0x1fda69[_0xeaa4('0x5c')][_0xeaa4('0x5c')],'ChatWebsiteId':_0x1fda69['params']['id'],'ChatInteractionId':_0x2a698e['id'],'direction':'in','ContactId':_0x446220[_0xeaa4('0xab')]['id'],'AttachmentId':_0x1fda69['body']['AttachmentId']});})[_0xeaa4('0x22')](function(_0x58a5b9){_0x446220[_0xeaa4('0x2a')]=_0x58a5b9;if(_0x446220[_0xeaa4('0xbf')]['UserId']){return db['User'][_0xeaa4('0x5a')]({'attributes':['id','name'],'where':{'id':_0x446220[_0xeaa4('0xbf')]['UserId']}})[_0xeaa4('0x22')](function(_0x1d8897){if(_0x1d8897){_0x446220[_0xeaa4('0xa6')][_0xeaa4('0xc6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1d8897[_0xeaa4('0x3c')]+','+(_0x446220[_0xeaa4('0xaa')][_0xeaa4('0xc7')]||0xa),'interval':_0xeaa4('0xc8')});_0x446220[_0xeaa4('0xc9')]=!![];}return respondWithRpcPromise(_0xeaa4('0xca'),_0xeaa4('0xcb'),_0x446220);});}return respondWithRpcPromise(_0xeaa4('0xca'),_0xeaa4('0xcb'),_0x446220);})[_0xeaa4('0x22')](function(_0x26a109){respondWithRpcPromise(_0xeaa4('0xcc'),'EventManager',{'event':_0xeaa4('0x8d'),'message':_0x26a109},client9002);return _0x26a109;})[_0xeaa4('0x22')](respondWithResult(_0x5304c5,null))[_0xeaa4('0x2d')](handleError(_0x5304c5,null));};exports[_0xeaa4('0xcd')]=function(_0x34ad76,_0x5d117b,_0x3718aa){var _0x39ce79,_0xb5f7d9,_0x1af742;var _0x2c34ba=[];var _0x7b9096=[];var _0x48b87e={};var _0x54790f=_0x34ad76[_0xeaa4('0xce')]||[];var _0xd668f3=[];var _0x4b8ace;return db['CmContact'][_0xeaa4('0x65')]()[_0xeaa4('0x22')](function(_0x456c2f){if(!_0x456c2f){throw new db[(_0xeaa4('0x93'))][(_0xeaa4('0x94'))](_0xeaa4('0x95'));}_0x7b9096=_[_0xeaa4('0x96')](_[_0xeaa4('0x47')](_0x456c2f),[_0xeaa4('0x97'),'updatedAt']);_0x2c34ba=_[_0xeaa4('0x96')](_[_0xeaa4('0x47')](_0x456c2f),[_0xeaa4('0x97'),'updatedAt','CompanyId',_0xeaa4('0x9a')]);if(_0x34ad76[_0xeaa4('0x5c')]['id']){delete _0x34ad76[_0xeaa4('0x5c')]['id'];}if(_[_0xeaa4('0x80')](_0x34ad76['body'][_0xeaa4('0x9b')])){throw _0x5d117b['status'](0x1f4)[_0xeaa4('0x3d')](new db[(_0xeaa4('0x93'))]['ValidationError'](_0xeaa4('0x9c')));}if(_[_0xeaa4('0x80')](_0x34ad76['body'][_0xeaa4('0x5c')])||_0x34ad76[_0xeaa4('0x5c')][_0xeaa4('0x5c')]===''){throw _0x5d117b[_0xeaa4('0x35')](0x1f4)[_0xeaa4('0x3d')](new db[(_0xeaa4('0x93'))]['ValidationError'](_0xeaa4('0xcf')));}if(_['isNil'](_0x34ad76[_0xeaa4('0x5c')][_0xeaa4('0xd0')])){throw _0x5d117b[_0xeaa4('0x35')](0x1f4)[_0xeaa4('0x3d')](new db[(_0xeaa4('0x93'))][(_0xeaa4('0x94'))](_0xeaa4('0xd1')+_0x2c34ba));}if(!_[_0xeaa4('0x9f')](_0x2c34ba,_0x34ad76[_0xeaa4('0x5c')][_0xeaa4('0xd0')])){throw _0x5d117b[_0xeaa4('0x35')](0x1f4)[_0xeaa4('0x3d')](new db['Sequelize'][(_0xeaa4('0x94'))](_0xeaa4('0xd2')+_0x2c34ba));}_0x48b87e[_0x34ad76[_0xeaa4('0x5c')]['mapKeyOffline']]=_0x34ad76[_0xeaa4('0x5c')][_0xeaa4('0x9b')];})[_0xeaa4('0x22')](function(){return db[_0xeaa4('0x42')][_0xeaa4('0x5a')]({'where':{'id':_0x34ad76['params']['id']},'include':[{'model':db[_0xeaa4('0xd3')],'as':_0xeaa4('0xa5')},{'model':db[_0xeaa4('0xd4')],'as':'MailAccount'}]});})[_0xeaa4('0x22')](handleEntityNotFound(_0x5d117b,null))[_0xeaa4('0x22')](function(_0x128946){if(_0x128946&&_0x128946['List']){_0xb5f7d9=_0x128946;var _0x307e0d=_[_0xeaa4('0x1b')](_0x34ad76[_0xeaa4('0x5c')],{'firstName':_0x34ad76[_0xeaa4('0x5c')][_0xeaa4('0x9b')],'phone':_0x34ad76[_0xeaa4('0x5c')][_0xeaa4('0x9b')],'ListId':_0x128946[_0xeaa4('0x9a')]});_0x307e0d[_0x34ad76['body'][_0xeaa4('0xd0')]]=_0x34ad76['body'][_0xeaa4('0x9b')];return db[_0xeaa4('0xa0')][_0xeaa4('0xd5')]({'where':_0x48b87e,'defaults':_0x307e0d});}})[_0xeaa4('0xd6')](function(_0xb3e7c0){if(_0xb3e7c0){_0x1af742=_0xb3e7c0;var _0x5bacea=fs[_0xeaa4('0xd7')](path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0xd8')),_0xeaa4('0xd9'));var _0x113d3c=ejs[_0xeaa4('0xda')](_0x5bacea,{'body':_[_0xeaa4('0xdb')](_0x34ad76['body']['body']),'bodyTitle':_0xb5f7d9[_0xeaa4('0xdc')]});return db[_0xeaa4('0xdd')][_0xeaa4('0x5b')]({'body':_0x113d3c,'ContactId':_0xb3e7c0['id'],'ChatWebsiteId':_0xb5f7d9['id']});}})[_0xeaa4('0x22')](function(_0x4e16b1){_0x4b8ace=_0x4e16b1;if(_0x54790f[_0xeaa4('0x59')]){var _0x9ccc81=_0x54790f[_0xeaa4('0x41')](function(_0x5adb83){return{'name':_0x5adb83[_0xeaa4('0xde')],'basename':_0x5adb83[_0xeaa4('0x76')],'type':_0x5adb83[_0xeaa4('0xdf')],'ChatOfflineMessageId':_0x4e16b1['id']};});_0xd668f3=_0x9ccc81[_0xeaa4('0x41')](_0x37f4c2=>{var _0x8727c3={'filename':_0x37f4c2[_0xeaa4('0x3c')],'path':path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0xe0'),_0xeaa4('0xce'),_0xeaa4('0xe1'),_0xeaa4('0xe2'),_0x37f4c2[_0xeaa4('0xe3')])};return _0x8727c3;});if(!_0xb5f7d9[_0xeaa4('0xe4')]){return db[_0xeaa4('0xe5')]['transaction'](function(_0x49fe70){return db[_0xeaa4('0xe6')][_0xeaa4('0xe7')](_0x9ccc81,{'transaction':_0x49fe70});});}}})[_0xeaa4('0x22')](function(){if(_0x4b8ace){_0x39ce79=_0x4b8ace;return db[_0xeaa4('0xd4')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0xeaa4('0xe8')],'as':'Smtp','raw':!![]}]});}})[_0xeaa4('0x22')](function(_0x31d667){if(_0x31d667&&_0x31d667[_0xeaa4('0xe9')]&&_0xb5f7d9[_0xeaa4('0xea')]&&_0xb5f7d9[_0xeaa4('0xeb')]){var _0x133e08={'tls':{'rejectUnauthorized':![]}};if(_0x31d667['Smtp'][_0xeaa4('0xec')]){_0x133e08['service']=_0x31d667[_0xeaa4('0xe9')][_0xeaa4('0xec')];}else{_0x133e08[_0xeaa4('0xed')]=_0x31d667['Smtp']['host'];_0x133e08[_0xeaa4('0xee')]=_0x31d667[_0xeaa4('0xe9')][_0xeaa4('0xee')];_0x133e08['secure']=_0x31d667[_0xeaa4('0xe9')][_0xeaa4('0xef')];}if(_0x31d667[_0xeaa4('0xe9')][_0xeaa4('0xf0')]){_0x133e08[_0xeaa4('0xf1')]={'user':_0x31d667['Smtp']['user'],'pass':_0x31d667[_0xeaa4('0xe9')][_0xeaa4('0xf2')]};}return respondWithRpcPromise('SendMail',_0xeaa4('0xf3'),{'account':_0x133e08,'message':{'from':util['format'](_0xeaa4('0xf4'),_0x31d667[_0xeaa4('0x3c')],_0x31d667['email']||_0x31d667[_0xeaa4('0xe9')][_0xeaa4('0x5d')]),'to':_0xb5f7d9[_0xeaa4('0xeb')],'subject':_0xb5f7d9['offlineMessageSubject'],'html':_0x39ce79['body'],'attachments':_0xd668f3}},client9003)['then'](function(){return _0x39ce79;})['catch'](function(_0x5fa51f){console[_0xeaa4('0x28')](_0x5fa51f);});}})[_0xeaa4('0x22')](function(){if(_0xb5f7d9&&_0xb5f7d9['openNewInteraction']&&_0xb5f7d9['MailAccountId']){var _0x539217=[];if(_0x54790f['length']){_0x539217=_0x54790f[_0xeaa4('0x41')](function(_0x5e6d85){return{'name':_0x5e6d85[_0xeaa4('0xde')],'basename':_0x5e6d85[_0xeaa4('0x76')],'type':_0x5e6d85[_0xeaa4('0xdf')],'ChatOfflineMessageId':_0x4b8ace['id']};});}var _0x2f0b8d;if(!_[_0xeaa4('0x80')](_0xb5f7d9[_0xeaa4('0xf5')])){var _0x42983a=_[_0xeaa4('0x41')](_0x34ad76['body'],function(_0x3c7de9){return _0x3c7de9;});var _0x1b4467=_[_0xeaa4('0xf6')](_0x42983a)[0x0];var _0x49cad9=_[_0xeaa4('0xf7')](_0x1b4467,function(_0xc97a66){return _0xc97a66;});_0x2f0b8d=_0x49cad9[0x1][_0xb5f7d9[_0xeaa4('0xf5')]];}var _0x2497e4={'from':_0x1af742[_0xeaa4('0xf8')],'firstName':_0x1af742[_0xeaa4('0xb0')],'lastName':_0x1af742[_0xeaa4('0xb1')],'mapKey':_0xeaa4('0xf8'),'message':{'from':_0x1af742['email'],'to':_0xb5f7d9['MailAccount']['email'],'cc':'','subject':_[_0xeaa4('0x80')](_0x2f0b8d)?_0xb5f7d9[_0xeaa4('0xf9')]:_0x2f0b8d,'messageId':'','sentAt':new Date(),'attach':_0x539217[_0xeaa4('0x59')],'attachments':_0x539217,'originChannel':_0xeaa4('0xfa'),'ChatWebsiteId':_0xb5f7d9['id'],'ChatOfflineMessageId':_0x39ce79['id'],'originTo':_0xb5f7d9[_0xeaa4('0xd4')][_0xeaa4('0xf8')]},'body':_0x39ce79['body']};var _0x313324={'account':{'id':_0xb5f7d9[_0xeaa4('0xfb')]},'body':_0x2497e4,'log':_0xeaa4('0xfc')};return respondWithRpcPromise(_0xeaa4('0xfc'),_0xeaa4('0xfd'),_0x313324,client9001)[_0xeaa4('0x22')](function(){return _0x39ce79;})['catch'](function(_0x3fa00e){console[_0xeaa4('0x28')](_0x3fa00e);});}return;})[_0xeaa4('0x22')](function(){if(_0x39ce79){return _0x39ce79;}})[_0xeaa4('0x22')](respondWithResult(_0x5d117b,null))[_0xeaa4('0x2d')](function(_0x176bca){console[_0xeaa4('0x28')](_0xeaa4('0x2d'),_0x176bca);for(var _0x3b2d83 of _0x54790f){var _0xbea88b=path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],'server','files',_0xeaa4('0xe1'),'offline-chat',_0x3b2d83[_0xeaa4('0x76')]);fs_extra[_0xeaa4('0xfe')](_0xbea88b)[_0xeaa4('0x2d')](function(_0x1e082f){console['error'](_0xeaa4('0xff'),_0xbea88b,_0x1e082f);});}});};exports['addInteraction']=function(_0x544849,_0x2a4fd8,_0x27f863){return db[_0xeaa4('0xbc')]['find']({'where':{'id':_0x544849[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x2a4fd8,null))[_0xeaa4('0x22')](function(_0x4aa37b){if(_0x4aa37b){return _0x4aa37b['addInteraction'](_0x544849[_0xeaa4('0x5c')]['ids'],_['omit'](_0x544849['body'],[_0xeaa4('0x72'),'id'])||{});}})[_0xeaa4('0x22')](respondWithResult(_0x2a4fd8,null))[_0xeaa4('0x2d')](handleError(_0x2a4fd8,null));};exports['getInteractions']=function(_0x4da05f,_0x529acb,_0x4ccb70){var _0x15b55b={'raw':![],'where':{}};var _0x1bdebb={};var _0x28ad1d={'count':0x0,'rows':[]};return db[_0xeaa4('0x42')][_0xeaa4('0x6a')]({'where':{'id':_0x4da05f[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x529acb,null))[_0xeaa4('0x22')](function(_0x1b072e){if(_0x1b072e){_0x1bdebb[_0xeaa4('0x46')]=_[_0xeaa4('0x47')](db[_0xeaa4('0xbc')][_0xeaa4('0x43')]);_0x1bdebb[_0xeaa4('0x49')]=_[_0xeaa4('0x47')](_0x4da05f[_0xeaa4('0x49')]);_0x1bdebb[_0xeaa4('0x4f')]=_[_0xeaa4('0x58')](_0x1bdebb[_0xeaa4('0x46')],_0x1bdebb[_0xeaa4('0x49')]);_0x15b55b['attributes']=_[_0xeaa4('0x58')](_0x1bdebb[_0xeaa4('0x46')],qs[_0xeaa4('0x48')](_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x48')]));_0x15b55b[_0xeaa4('0x4a')]=_0x15b55b[_0xeaa4('0x4a')]['length']?_0x15b55b[_0xeaa4('0x4a')]:_0x1bdebb['model'];if(!_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x4b')](_0xeaa4('0x4c'))){_0x15b55b['limit']=qs[_0xeaa4('0x33')](_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x33')]);_0x15b55b[_0xeaa4('0x31')]=qs[_0xeaa4('0x31')](_0x4da05f[_0xeaa4('0x49')]['offset']);}_0x15b55b['order']=qs[_0xeaa4('0x4d')](_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x4d')]);_0x15b55b[_0xeaa4('0x4e')]=qs[_0xeaa4('0x4f')](_[_0xeaa4('0x50')](_0x4da05f[_0xeaa4('0x49')],_0x1bdebb[_0xeaa4('0x4f')]));_0x15b55b['where'][_0xeaa4('0x67')]=_0x1b072e['id'];if(_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x51')]){_0x15b55b['where']=_[_0xeaa4('0x52')](_0x15b55b[_0xeaa4('0x4e')],{'$or':_[_0xeaa4('0x41')](_0x15b55b[_0xeaa4('0x4a')],function(_0xfce8f0){var _0x205044={};_0x205044[_0xfce8f0]={'$like':'%'+_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x51')]+'%'};return _0x205044;})});}_0x15b55b=_[_0xeaa4('0x52')]({},_0x15b55b,_0x4da05f[_0xeaa4('0x53')]);return db[_0xeaa4('0xbc')][_0xeaa4('0x34')]({'where':_0x15b55b[_0xeaa4('0x4e')]})[_0xeaa4('0x22')](function(_0x2ec23a){_0x28ad1d['count']=_0x2ec23a;if(_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x54')]){_0x15b55b['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xeaa4('0x100')],'as':_0xeaa4('0x101'),'attributes':[_0xeaa4('0x3c'),_0xeaa4('0x102'),_0xeaa4('0x103')],'required':![]},{'model':db[_0xeaa4('0x104')],'as':_0xeaa4('0x105'),'attributes':['id',_0xeaa4('0x3c'),_0xeaa4('0x106')],'where':_0x4da05f[_0xeaa4('0x49')]['tag']?{'id':_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x107')]}:undefined,'required':_0x4da05f[_0xeaa4('0x49')][_0xeaa4('0x107')]?!![]:![]}];}return db[_0xeaa4('0xbc')][_0xeaa4('0x6c')](_0x15b55b);})[_0xeaa4('0x22')](function(_0x1c0491){_0x28ad1d[_0xeaa4('0x6d')]=_0x1c0491;return _0x28ad1d;});}})['then'](respondWithFilteredResult(_0x529acb,_0x15b55b))[_0xeaa4('0x2d')](handleError(_0x529acb,null));};function iftimePromise(_0x1b1084,_0x54826e){return respondWithRpcPromise(_0xeaa4('0x108'),_0xeaa4('0x109'),{'command':_0x54826e[_0xeaa4('0x10a')]?util[_0xeaa4('0xb5')](_0xeaa4('0x10b'),_0x1b1084[_0xeaa4('0x10c')],_0x54826e[_0xeaa4('0x10a')]):util['format'](_0xeaa4('0x10d'),_0x1b1084[_0xeaa4('0x10c')])},client9002)['then'](function(_0x249aa0){var _0x34ef99=_0x249aa0&&_0x249aa0[_0xeaa4('0x10e')](_0xeaa4('0x10f'))>=0x0?!![]:![];logger[_0xeaa4('0x23')](_0xeaa4('0x110'),_0x54826e['id'],_0x1b1084['id'],_0x1b1084[_0xeaa4('0x10c')],_0x34ef99?_0xeaa4('0x111'):'OFFLINE',_0x54826e[_0xeaa4('0x10a')]?_0x54826e['timezone']:_0xeaa4('0x112'));return _0x34ef99;})['catch'](function(_0x376cfd){logger['error'](_0xeaa4('0x110'),_0x54826e['id'],_0x1b1084['id'],_0x1b1084[_0xeaa4('0x10c')],util['inspect'](_0x376cfd,{'showHidden':![],'depth':null}),_0x54826e[_0xeaa4('0x10a')]?_0x54826e[_0xeaa4('0x10a')]:_0xeaa4('0x112'));return![];});}exports['getSnippet']=function(_0x4b1235,_0x12de96,_0x374ba4){var _0x34a262=0x0;var _0x3828cb=0x0;var _0x59ae26=![];var _0x5d6591;var _0x57394a;return db['ChatWebsite']['find']({'where':{'id':_0x4b1235[_0xeaa4('0x57')]['id']},'include':[{'model':db[_0xeaa4('0x113')],'as':_0xeaa4('0x113'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x12de96,null))[_0xeaa4('0x22')](function(_0x5af336){if(_0x5af336){_0x5d6591=_0x5af336;return _0x5af336[_0xeaa4('0x114')]({'raw':!![]});}})[_0xeaa4('0x22')](function(_0x48e7fd){if(_0x5d6591){if(_0x48e7fd){_0x57394a=_0x48e7fd;}}return require('../../config/license/util')[_0xeaa4('0x7e')]();})[_0xeaa4('0x22')](function(_0xdea6a8){if(_0xdea6a8){_0x3828cb=_0xdea6a8[_0xeaa4('0x115')];_0x59ae26=_0xdea6a8[_0xeaa4('0x7f')];}})[_0xeaa4('0x22')](function(){return db[_0xeaa4('0xbc')][_0xeaa4('0x34')]({'where':{'closed':![]}});})['then'](function(_0x26f1b5){_0x34a262=_0x26f1b5;if(_0x3828cb&&_0x26f1b5>_0x3828cb){return db[_0xeaa4('0x116')]['findOne']({'where':{'id':0x1}})['then'](function(_0x15e23a){if(_0x15e23a){_0x15e23a[_0xeaa4('0x117')](_0xeaa4('0x118'));}});}})[_0xeaa4('0x22')](function(){if(_0x5d6591[_0xeaa4('0x113')]&&_0x5d6591['Interval']['Intervals']){var _0x20c38d=[];for(var _0x596879=0x0;_0x596879<_0x5d6591[_0xeaa4('0x113')][_0xeaa4('0x119')]['length'];_0x596879++){var _0x1af6ad=_0x5d6591[_0xeaa4('0x113')][_0xeaa4('0x119')][_0x596879]['get']({'plain':!![]});_0x20c38d['push'](iftimePromise(_0x1af6ad,_0x5d6591));}return BPromise[_0xeaa4('0x11a')](_0x20c38d)['then'](function(_0xab04e4){return _[_0xeaa4('0x11b')](_0xab04e4);});}else{return!![];}})[_0xeaa4('0x22')](function(_0x1d7d36){var _0x9bca5a=fs[_0xeaa4('0xd7')](path[_0xeaa4('0x82')](config[_0xeaa4('0x7d')],_0xeaa4('0x11c')),_0xeaa4('0xd9'));var _0x52883c={'remote':_0x5d6591[_0xeaa4('0x11d')],'query':querystring['stringify'](_['merge'](_0x5d6591['get']({'plain':!![]}),{'customerIp':_0x4b1235[_0xeaa4('0xac')]['x-forwarded-for']||_0x4b1235['headers'][_0xeaa4('0x11e')]||_0x4b1235[_0xeaa4('0x11f')][_0xeaa4('0x120')]||_0x4b1235['ip'],'referer':_0x4b1235[_0xeaa4('0xac')]['referer'],'openedInteractions':_0x34a262,'maxInteractions':_0x3828cb,'virtual':_0x59ae26[_0xeaa4('0x115')],'online':_0x1d7d36,'custom':_0x59ae26}))[_0xeaa4('0x121')](/'/g,'\x5c\x27')};_0x12de96[_0xeaa4('0x3d')](ejs[_0xeaa4('0xda')](Mustache[_0xeaa4('0xda')](_0x9bca5a,_0x52883c),{'proactiveActions':_0x57394a,'alignment':_0x5d6591[_0xeaa4('0x122')],'verticalAlignment':_0x5d6591[_0xeaa4('0x123')],'div_color':_0x5d6591[_0xeaa4('0x106')],'text_color':_0x5d6591['textColor'],'button_color':_0x5d6591[_0xeaa4('0x124')],'background_color':_0x5d6591[_0xeaa4('0x125')]}));})[_0xeaa4('0x2d')](handleError(_0x12de96,null));};exports[_0xeaa4('0x126')]=function(_0x34506b,_0x18ee59,_0x4f0e96){return db[_0xeaa4('0x42')]['findOne']({'where':{'id':_0x34506b[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x18ee59,null))[_0xeaa4('0x22')](function(_0x57f22b){if(_0x57f22b){return db[_0xeaa4('0xe5')][_0xeaa4('0x127')](function(_0x5ab3d0){return db[_0xeaa4('0xa3')][_0xeaa4('0x64')]({'where':{'ChatWebsiteId':_0x34506b['params']['id']},'transaction':_0x5ab3d0})[_0xeaa4('0x22')](function(_0x4fcf01){var _0x5ee671=_[_0xeaa4('0x41')](_0x34506b[_0xeaa4('0x5c')],function(_0x389350){_0x389350[_0xeaa4('0x67')]=_0x34506b['params']['id'];return _0x389350;});return db['ChatApplication'][_0xeaa4('0xe7')](_0x5ee671,{'transaction':_0x5ab3d0});});})[_0xeaa4('0x22')](function(){return db['ChatApplication'][_0xeaa4('0x128')]({'where':{'ChatWebsiteId':_0x34506b[_0xeaa4('0x57')]['id']},'order':_0xeaa4('0x129')});});}})[_0xeaa4('0x22')](respondWithResult(_0x18ee59,null))['catch'](handleError(_0x18ee59,null));};exports['getApplications']=function(_0xff7f5d,_0xec94b3,_0x57be24){var _0x179a05={};var _0x449825={};var _0x5446a7;var _0xb816d5;return db[_0xeaa4('0x42')][_0xeaa4('0x6a')]({'where':{'id':_0xff7f5d[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0xec94b3,null))['then'](function(_0x7d3698){if(_0x7d3698){_0x5446a7=_0x7d3698;_0x449825[_0xeaa4('0x46')]=_[_0xeaa4('0x47')](db['ChatApplication'][_0xeaa4('0x43')]);_0x449825['query']=_[_0xeaa4('0x47')](_0xff7f5d[_0xeaa4('0x49')]);_0x449825[_0xeaa4('0x4f')]=_[_0xeaa4('0x58')](_0x449825[_0xeaa4('0x46')],_0x449825[_0xeaa4('0x49')]);_0x179a05[_0xeaa4('0x4a')]=_[_0xeaa4('0x58')](_0x449825[_0xeaa4('0x46')],qs['fields'](_0xff7f5d[_0xeaa4('0x49')][_0xeaa4('0x48')]));_0x179a05[_0xeaa4('0x4a')]=_0x179a05['attributes'][_0xeaa4('0x59')]?_0x179a05[_0xeaa4('0x4a')]:_0x449825[_0xeaa4('0x46')];_0x179a05[_0xeaa4('0x6b')]=qs[_0xeaa4('0x4d')](_0xff7f5d[_0xeaa4('0x49')][_0xeaa4('0x4d')]);_0x179a05[_0xeaa4('0x4e')]=qs['filters'](_['pick'](_0xff7f5d[_0xeaa4('0x49')],_0x449825['filters']));if(_0xff7f5d[_0xeaa4('0x49')][_0xeaa4('0x51')]){_0x179a05[_0xeaa4('0x4e')]=_[_0xeaa4('0x52')](_0x179a05[_0xeaa4('0x4e')],{'$or':_[_0xeaa4('0x41')](_0x179a05[_0xeaa4('0x4a')],function(_0x494362){var _0x22c2b6={};_0x22c2b6[_0x494362]={'$like':'%'+_0xff7f5d[_0xeaa4('0x49')]['filter']+'%'};return _0x22c2b6;})});}_0x179a05=_[_0xeaa4('0x52')]({},_0x179a05,_0xff7f5d[_0xeaa4('0x53')]);return _0x5446a7[_0xeaa4('0x12a')](_0x179a05);}})[_0xeaa4('0x22')](function(_0x10a648){if(_0x10a648){_0xb816d5=_0x10a648[_0xeaa4('0x59')];if(!_0xff7f5d[_0xeaa4('0x49')]['hasOwnProperty'](_0xeaa4('0x4c'))){_0x179a05[_0xeaa4('0x33')]=qs[_0xeaa4('0x33')](_0xff7f5d[_0xeaa4('0x49')][_0xeaa4('0x33')]);_0x179a05[_0xeaa4('0x31')]=qs['offset'](_0xff7f5d[_0xeaa4('0x49')][_0xeaa4('0x31')]);}return _0x5446a7[_0xeaa4('0x12a')](_0x179a05);}})[_0xeaa4('0x22')](function(_0x33765e){if(_0x33765e){return _0x33765e?{'count':_0xb816d5,'rows':_0x33765e}:null;}})[_0xeaa4('0x22')](respondWithResult(_0xec94b3,null))[_0xeaa4('0x2d')](handleError(_0xec94b3,null));};exports[_0xeaa4('0x12b')]=function(_0x2bf917,_0x5ee026,_0x49c247){return db[_0xeaa4('0x12c')]['find']({'where':{'id':_0x2bf917[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x5ee026,null))['then'](function(_0x507735){if(_0x507735){return _0x507735[_0xeaa4('0x12b')](_0x2bf917[_0xeaa4('0x5c')][_0xeaa4('0x72')],_['omit'](_0x2bf917[_0xeaa4('0x5c')],[_0xeaa4('0x72'),'id'])||{});}})['then'](respondWithResult(_0x5ee026,null))[_0xeaa4('0x2d')](handleError(_0x5ee026,null));};exports[_0xeaa4('0x114')]=function(_0x1381bc,_0x10bb6d,_0x524d0d){var _0x2a2dcd={};var _0x36a382={};var _0x5bbb0a;var _0x17cc2f;return db[_0xeaa4('0x42')][_0xeaa4('0x6a')]({'where':{'id':_0x1381bc[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x10bb6d,null))[_0xeaa4('0x22')](function(_0x3405d6){if(_0x3405d6){_0x5bbb0a=_0x3405d6;_0x36a382[_0xeaa4('0x46')]=_['keys'](db[_0xeaa4('0x12d')][_0xeaa4('0x43')]);_0x36a382[_0xeaa4('0x49')]=_[_0xeaa4('0x47')](_0x1381bc[_0xeaa4('0x49')]);_0x36a382[_0xeaa4('0x4f')]=_['intersection'](_0x36a382[_0xeaa4('0x46')],_0x36a382[_0xeaa4('0x49')]);_0x2a2dcd[_0xeaa4('0x4a')]=_[_0xeaa4('0x58')](_0x36a382['model'],qs['fields'](_0x1381bc['query'][_0xeaa4('0x48')]));_0x2a2dcd[_0xeaa4('0x4a')]=_0x2a2dcd[_0xeaa4('0x4a')][_0xeaa4('0x59')]?_0x2a2dcd[_0xeaa4('0x4a')]:_0x36a382['model'];_0x2a2dcd[_0xeaa4('0x6b')]=qs['sort'](_0x1381bc[_0xeaa4('0x49')]['sort']);_0x2a2dcd[_0xeaa4('0x4e')]=qs[_0xeaa4('0x4f')](_[_0xeaa4('0x50')](_0x1381bc[_0xeaa4('0x49')],_0x36a382[_0xeaa4('0x4f')]));if(_0x1381bc['query']['filter']){_0x2a2dcd[_0xeaa4('0x4e')]=_[_0xeaa4('0x52')](_0x2a2dcd[_0xeaa4('0x4e')],{'$or':_[_0xeaa4('0x41')](_0x2a2dcd['attributes'],function(_0x51a3ad){var _0x5e47c2={};_0x5e47c2[_0x51a3ad]={'$like':'%'+_0x1381bc[_0xeaa4('0x49')][_0xeaa4('0x51')]+'%'};return _0x5e47c2;})});}_0x2a2dcd=_['merge']({},_0x2a2dcd,_0x1381bc[_0xeaa4('0x53')]);return _0x5bbb0a[_0xeaa4('0x114')](_0x2a2dcd);}})[_0xeaa4('0x22')](function(_0x27feaa){if(_0x27feaa){_0x17cc2f=_0x27feaa[_0xeaa4('0x59')];if(!_0x1381bc['query'][_0xeaa4('0x4b')](_0xeaa4('0x4c'))){_0x2a2dcd[_0xeaa4('0x33')]=qs[_0xeaa4('0x33')](_0x1381bc[_0xeaa4('0x49')][_0xeaa4('0x33')]);_0x2a2dcd[_0xeaa4('0x31')]=qs[_0xeaa4('0x31')](_0x1381bc[_0xeaa4('0x49')][_0xeaa4('0x31')]);}return _0x5bbb0a[_0xeaa4('0x114')](_0x2a2dcd);}})[_0xeaa4('0x22')](function(_0x5145e5){if(_0x5145e5){return _0x5145e5?{'count':_0x17cc2f,'rows':_0x5145e5}:null;}})[_0xeaa4('0x22')](respondWithResult(_0x10bb6d,null))[_0xeaa4('0x2d')](handleError(_0x10bb6d,null));};exports[_0xeaa4('0x12e')]=function(_0x3d3c64,_0x269966,_0xc63d2d){var _0x2c440d=_0x3d3c64['query']['online']==='false'?_0xeaa4('0x12f'):'onlineForm';return db['ChatWebsite'][_0xeaa4('0x5a')]({'attributes':['id',_0x2c440d],'where':{'id':_0x3d3c64[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x269966,null))[_0xeaa4('0x22')](function(_0x768e38){if(_0x768e38){var _0x4f0de1=_0x768e38[_0x2c440d];var _0x589490=_0x4f0de1&&_0x4f0de1[_0xeaa4('0x130')]?_0x4f0de1[_0xeaa4('0x130')]:[];_0x269966[_0xeaa4('0x3d')]({'fromKey':_[_0xeaa4('0x80')](_0x4f0de1[_0xeaa4('0x131')])?undefined:_0x4f0de1[_0xeaa4('0x131')],'count':_0x589490[_0xeaa4('0x59')],'rows':_0x589490});}})['catch'](handleError(_0x269966,null));};exports[_0xeaa4('0x132')]=function(_0x527768,_0xf54bcd,_0x429170){var _0x4bec96={'raw':![],'where':{}};var _0x282b35={};var _0x3bc0c9={'count':0x0,'rows':[]};return db[_0xeaa4('0x42')][_0xeaa4('0x6a')]({'where':{'id':_0x527768[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0xf54bcd,null))[_0xeaa4('0x22')](function(_0x5b539a){if(_0x5b539a){_0x282b35[_0xeaa4('0x46')]=_[_0xeaa4('0x47')](db[_0xeaa4('0xdd')]['rawAttributes']);_0x282b35[_0xeaa4('0x49')]=_[_0xeaa4('0x47')](_0x527768['query']);_0x282b35[_0xeaa4('0x4f')]=_[_0xeaa4('0x58')](_0x282b35[_0xeaa4('0x46')],_0x282b35['query']);_0x4bec96[_0xeaa4('0x4a')]=_['intersection'](_0x282b35[_0xeaa4('0x46')],qs[_0xeaa4('0x48')](_0x527768[_0xeaa4('0x49')][_0xeaa4('0x48')]));_0x4bec96[_0xeaa4('0x4a')]=_0x4bec96[_0xeaa4('0x4a')][_0xeaa4('0x59')]?_0x4bec96[_0xeaa4('0x4a')]:_0x282b35[_0xeaa4('0x46')];if(!_0x527768[_0xeaa4('0x49')][_0xeaa4('0x4b')](_0xeaa4('0x4c'))){_0x4bec96[_0xeaa4('0x33')]=qs[_0xeaa4('0x33')](_0x527768[_0xeaa4('0x49')][_0xeaa4('0x33')]);_0x4bec96[_0xeaa4('0x31')]=qs[_0xeaa4('0x31')](_0x527768['query'][_0xeaa4('0x31')]);}_0x4bec96[_0xeaa4('0x6b')]=qs[_0xeaa4('0x4d')](_0x527768[_0xeaa4('0x49')][_0xeaa4('0x4d')]);_0x4bec96[_0xeaa4('0x4e')]=qs['filters'](_[_0xeaa4('0x50')](_0x527768[_0xeaa4('0x49')],_0x282b35[_0xeaa4('0x4f')]));_0x4bec96[_0xeaa4('0x4e')][_0xeaa4('0x67')]=_0x5b539a['id'];if(_0x527768[_0xeaa4('0x49')]['filter']){_0x4bec96['where']=_[_0xeaa4('0x52')](_0x4bec96[_0xeaa4('0x4e')],{'$or':_['map'](_0x4bec96[_0xeaa4('0x4a')],function(_0x39aae9){var _0x9dd339={};_0x9dd339[_0x39aae9]={'$like':'%'+_0x527768['query']['filter']+'%'};return _0x9dd339;})});}_0x4bec96=_[_0xeaa4('0x52')]({},_0x4bec96,_0x527768[_0xeaa4('0x53')]);return db[_0xeaa4('0xdd')][_0xeaa4('0x34')]({'where':_0x4bec96[_0xeaa4('0x4e')]})[_0xeaa4('0x22')](function(_0x752e01){_0x3bc0c9['count']=_0x752e01;if(_0x527768[_0xeaa4('0x49')][_0xeaa4('0x54')]){_0x4bec96[_0xeaa4('0x55')]=[{'all':!![]}];}else{_0x4bec96[_0xeaa4('0x55')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage'][_0xeaa4('0x6c')](_0x4bec96);})[_0xeaa4('0x22')](function(_0x22d723){_0x3bc0c9[_0xeaa4('0x6d')]=_0x22d723;return _0x3bc0c9;});}})[_0xeaa4('0x22')](respondWithFilteredResult(_0xf54bcd,_0x4bec96))[_0xeaa4('0x2d')](handleError(_0xf54bcd,null));};exports[_0xeaa4('0x133')]=function(_0x129213,_0x28005e,_0x24d313){return db['ChatWebsite'][_0xeaa4('0x5a')]({'where':{'id':_0x129213['params']['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0x28005e,null))[_0xeaa4('0x22')](function(_0x46df61){if(_0x46df61){return _0x46df61[_0xeaa4('0x133')](_0x129213['body']['ids'],_[_0xeaa4('0x134')](_0x129213['body'],[_0xeaa4('0x72'),'id'])||{})[_0xeaa4('0xd6')](function(_0x355e71){for(var _0x1a0818=0x0;_0x1a0818<_0x129213[_0xeaa4('0x5c')][_0xeaa4('0x72')][_0xeaa4('0x59')];_0x1a0818+=0x1){socket[_0xeaa4('0x135')](_0xeaa4('0x136'),{'UserId':Number(_0x129213['body'][_0xeaa4('0x72')][_0x1a0818]),'ChatWebsiteId':Number(_0x129213[_0xeaa4('0x57')]['id'])});}return _0x355e71;});}})[_0xeaa4('0x22')](respondWithResult(_0x28005e,null))[_0xeaa4('0x2d')](handleError(_0x28005e,null));};exports[_0xeaa4('0x137')]=function(_0x5a3e45,_0xd21621,_0x3a00d8){return db['ChatWebsite'][_0xeaa4('0x5a')]({'where':{'id':_0x5a3e45[_0xeaa4('0x57')]['id']}})[_0xeaa4('0x22')](handleEntityNotFound(_0xd21621,null))['then'](function(_0x5e0a5a){if(_0x5e0a5a){return _0x5e0a5a[_0xeaa4('0x137')](_0x5a3e45[_0xeaa4('0x49')][_0xeaa4('0x72')])['then'](function(){if(_[_0xeaa4('0x138')](_0x5a3e45[_0xeaa4('0x49')][_0xeaa4('0x72')])){for(var _0x277cc8=0x0;_0x277cc8<_0x5a3e45[_0xeaa4('0x49')][_0xeaa4('0x72')][_0xeaa4('0x59')];_0x277cc8+=0x1){socket['emit'](_0xeaa4('0x139'),{'UserId':Number(_0x5a3e45[_0xeaa4('0x49')]['ids'][_0x277cc8]),'ChatWebsiteId':Number(_0x5a3e45[_0xeaa4('0x57')]['id'])});}}else{socket['emit'](_0xeaa4('0x139'),{'UserId':Number(_0x5a3e45[_0xeaa4('0x49')]['ids']),'ChatWebsiteId':Number(_0x5a3e45[_0xeaa4('0x57')]['id'])});}});}})[_0xeaa4('0x22')](respondWithStatusCode(_0xd21621,null))[_0xeaa4('0x2d')](handleError(_0xd21621,null));};exports[_0xeaa4('0x13a')]=function(_0x757598,_0x5f3b30,_0x515642){var _0x11f9dc={};var _0x386e7e={};var _0x827d7b;var _0x65fafa;return db[_0xeaa4('0x42')][_0xeaa4('0x6a')]({'where':{'id':_0x757598['params']['id']}})['then'](handleEntityNotFound(_0x5f3b30,null))[_0xeaa4('0x22')](function(_0x3de015){if(_0x3de015){_0x827d7b=_0x3de015;_0x386e7e[_0xeaa4('0x46')]=_[_0xeaa4('0x47')](db[_0xeaa4('0x100')][_0xeaa4('0x43')]);_0x386e7e[_0xeaa4('0x49')]=_[_0xeaa4('0x47')](_0x757598[_0xeaa4('0x49')]);_0x386e7e[_0xeaa4('0x4f')]=_[_0xeaa4('0x58')](_0x386e7e[_0xeaa4('0x46')],_0x386e7e['query']);_0x11f9dc['attributes']=_[_0xeaa4('0x58')](_0x386e7e[_0xeaa4('0x46')],qs[_0xeaa4('0x48')](_0x757598[_0xeaa4('0x49')][_0xeaa4('0x48')]));_0x11f9dc['attributes']=_0x11f9dc[_0xeaa4('0x4a')][_0xeaa4('0x59')]?_0x11f9dc[_0xeaa4('0x4a')]:_0x386e7e[_0xeaa4('0x46')];_0x11f9dc['order']=qs[_0xeaa4('0x4d')](_0x757598[_0xeaa4('0x49')][_0xeaa4('0x4d')]);_0x11f9dc[_0xeaa4('0x4e')]=qs[_0xeaa4('0x4f')](_[_0xeaa4('0x50')](_0x757598['query'],_0x386e7e[_0xeaa4('0x4f')]));if(_0x757598[_0xeaa4('0x49')][_0xeaa4('0x51')]){_0x11f9dc['where']=_[_0xeaa4('0x52')](_0x11f9dc['where'],{'$or':_[_0xeaa4('0x41')](_0x11f9dc[_0xeaa4('0x4a')],function(_0x42b301){var _0x3437ac={};_0x3437ac[_0x42b301]={'$like':'%'+_0x757598[_0xeaa4('0x49')][_0xeaa4('0x51')]+'%'};return _0x3437ac;})});}_0x11f9dc=_[_0xeaa4('0x52')]({},_0x11f9dc,_0x757598[_0xeaa4('0x53')]);return _0x827d7b['getAgents'](_0x11f9dc);}})[_0xeaa4('0x22')](function(_0x2a840d){if(_0x2a840d){_0x65fafa=_0x2a840d[_0xeaa4('0x59')];if(!_0x757598['query']['hasOwnProperty'](_0xeaa4('0x4c'))){_0x11f9dc[_0xeaa4('0x33')]=qs[_0xeaa4('0x33')](_0x757598[_0xeaa4('0x49')][_0xeaa4('0x33')]);_0x11f9dc[_0xeaa4('0x31')]=qs[_0xeaa4('0x31')](_0x757598[_0xeaa4('0x49')][_0xeaa4('0x31')]);}return _0x827d7b[_0xeaa4('0x13a')](_0x11f9dc);}})[_0xeaa4('0x22')](function(_0x57c31a){if(_0x57c31a){return _0x57c31a?{'count':_0x65fafa,'rows':_0x57c31a}:null;}})[_0xeaa4('0x22')](respondWithResult(_0x5f3b30,null))[_0xeaa4('0x2d')](handleError(_0x5f3b30,null));}; \ No newline at end of file +var _0xe023=['create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','mandatoryDispositionPause','destroy','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','pick','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','customerAvatar','systemAvatar','join','root','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','ListId','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','DESC','ChatApplication','List','applications','Applications','list','priority','asc','account','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','%s\x20%s','version','unknown','format','device','vendor','%s\x20%s\x20%s','threadId','ContactId','interaction','ChatInteraction','spread','messageId','created','autoclose','push','*,*,*,*','ChatMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','updatedAt','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','utf8','render','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','basename','sequelize','transaction','bulkCreate','MailServerOut','Smtp','forwardOfflineAddress','service','port','secure','authentication','auth','pass','SendMail','sendMail','offlineMessageSubject','openNewInteraction','subjectOffline','firstName','email','Chat','MailAccountId','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','Tag','Tags','tag','rows','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','info','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','virtual','License','increment','Intervals','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','replace','alignment','verticalAlignment','color','color_button','backgroundColor','addApplications','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','false','offlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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','../../config/environment','../../config/license/util','defaults','redis','localhost','./chatWebsite.socket','register','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','update','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','show','params','includeAll','find'];(function(_0x105def,_0x4bf138){var _0x52aba8=function(_0xb2eecb){while(--_0xb2eecb){_0x105def['push'](_0x105def['shift']());}};_0x52aba8(++_0x4bf138);}(_0xe023,0xcc));var _0x3e02=function(_0x22f50c,_0x1f56d5){_0x22f50c=_0x22f50c-0x0;var _0x346d71=_0xe023[_0x22f50c];return _0x346d71;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e02('0x0'));var zipdir=require(_0x3e02('0x1'));var jsonpatch=require(_0x3e02('0x2'));var rp=require(_0x3e02('0x3'));var moment=require('moment');var BPromise=require(_0x3e02('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3e02('0x5'));var sox=require(_0x3e02('0x6'));var csv=require(_0x3e02('0x7'));var ejs=require(_0x3e02('0x8'));var fs=require('fs');var fs_extra=require(_0x3e02('0x9'));var _=require(_0x3e02('0xa'));var squel=require(_0x3e02('0xb'));var crypto=require(_0x3e02('0xc'));var jsforce=require(_0x3e02('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3e02('0x7'));var querystring=require(_0x3e02('0xe'));var Papa=require(_0x3e02('0xf'));var Redis=require(_0x3e02('0x10'));var authService=require(_0x3e02('0x11'));var qs=require(_0x3e02('0x12'));var as=require(_0x3e02('0x13'));var hardwareService=require(_0x3e02('0x14'));var logger=require(_0x3e02('0x15'))('api');var utils=require(_0x3e02('0x16'));var config=require(_0x3e02('0x17'));var licenseUtil=require(_0x3e02('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3e02('0x19')](config[_0x3e02('0x1a')],{'host':_0x3e02('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3e02('0x1a')]));require(_0x3e02('0x1c'))[_0x3e02('0x1d')](socket);var jayson=require(_0x3e02('0x1e'));var client=jayson[_0x3e02('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x3e02('0x1f')][_0x3e02('0x20')]({'port':0x232a});var client9003=jayson[_0x3e02('0x1f')][_0x3e02('0x20')]({'port':0x232b});var client9001=jayson[_0x3e02('0x1f')][_0x3e02('0x20')]({'port':0x2329});function respondWithRpcPromise(_0x26d5fc,_0x471b45,_0x123ced,_0x3c5214){return new BPromise(function(_0x2a92e7,_0xaa0e5c){var _0x1f8ed6=_0x3c5214||client;return _0x1f8ed6[_0x3e02('0x21')](_0x26d5fc,_0x123ced)[_0x3e02('0x22')](function(_0x51bfd6){logger['info'](_0x3e02('0x23'),_0x471b45,_0x3e02('0x24'));logger[_0x3e02('0x25')](_0x3e02('0x26'),_0x471b45,_0x3e02('0x24'),JSON[_0x3e02('0x27')](_0x51bfd6));if(_0x51bfd6['error']){if(_0x51bfd6['error'][_0x3e02('0x28')]===0x1f4){logger[_0x3e02('0x29')](_0x3e02('0x23'),_0x471b45,_0x51bfd6[_0x3e02('0x29')]['message']);return _0xaa0e5c(_0x51bfd6['error']['message']);}logger['error'](_0x3e02('0x23'),_0x471b45,_0x51bfd6[_0x3e02('0x29')][_0x3e02('0x2a')]);return _0x2a92e7(_0x51bfd6['error'][_0x3e02('0x2a')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x471b45,_0x3e02('0x24'));_0x2a92e7(_0x51bfd6['result'][_0x3e02('0x2a')]);}})[_0x3e02('0x2b')](function(_0x12d97d){logger['error'](_0x3e02('0x23'),_0x471b45,_0x12d97d);_0xaa0e5c(_0x12d97d);});});}function respondWithStatusCode(_0x1e347e,_0x3ff320){_0x3ff320=_0x3ff320||0xcc;return function(_0x54b31b){if(_0x54b31b){return _0x1e347e[_0x3e02('0x2c')](_0x3ff320);}return _0x1e347e[_0x3e02('0x2d')](_0x3ff320)[_0x3e02('0x2e')]();};}function respondWithResult(_0x5cd171,_0x5a144d){_0x5a144d=_0x5a144d||0xc8;return function(_0x2a882f){if(_0x2a882f){return _0x5cd171[_0x3e02('0x2d')](_0x5a144d)['json'](_0x2a882f);}};}function respondWithFilteredResult(_0x5333b6,_0x1cdc55){return function(_0x5e92b0){if(_0x5e92b0){var _0x1aa1c0=typeof _0x1cdc55['offset']==='undefined'&&typeof _0x1cdc55[_0x3e02('0x2f')]===_0x3e02('0x30');var _0x4457a3=_0x5e92b0[_0x3e02('0x31')];var _0x51b6e6=_0x1aa1c0?0x0:_0x1cdc55[_0x3e02('0x32')];var _0x58b968=_0x1aa1c0?_0x5e92b0[_0x3e02('0x31')]:_0x1cdc55[_0x3e02('0x32')]+_0x1cdc55[_0x3e02('0x2f')];var _0x1d6b21;if(_0x58b968>=_0x4457a3){_0x58b968=_0x4457a3;_0x1d6b21=0xc8;}else{_0x1d6b21=0xce;}_0x5333b6[_0x3e02('0x2d')](_0x1d6b21);return _0x5333b6[_0x3e02('0x33')](_0x3e02('0x34'),_0x51b6e6+'-'+_0x58b968+'/'+_0x4457a3)[_0x3e02('0x35')](_0x5e92b0);}return null;};}function patchUpdates(_0x744d58){return function(_0x329b85){try{jsonpatch[_0x3e02('0x36')](_0x329b85,_0x744d58,!![]);}catch(_0x4ced71){return BPromise[_0x3e02('0x37')](_0x4ced71);}return _0x329b85['save']();};}function saveUpdates(_0x50eb3c,_0x5761b8){return function(_0x5892b9){if(_0x5892b9){return _0x5892b9[_0x3e02('0x38')](_0x50eb3c)[_0x3e02('0x22')](function(_0x261736){return _0x261736;});}return null;};}function removeEntity(_0x45417f,_0x32ed25){return function(_0x56cacb){if(_0x56cacb){return _0x56cacb['destroy']()[_0x3e02('0x22')](function(){var _0x5e1842=_0x56cacb[_0x3e02('0x39')]({'plain':!![]});var _0x921fce=_0x3e02('0x3a');return db[_0x3e02('0x3b')]['destroy']({'where':{'type':_0x921fce,'resourceId':_0x5e1842['id']}})[_0x3e02('0x22')](function(){return _0x56cacb;});})[_0x3e02('0x22')](function(){_0x45417f[_0x3e02('0x2d')](0xcc)[_0x3e02('0x2e')]();});}};}function handleEntityNotFound(_0x3b72b8,_0x4dd3cd){return function(_0x50bece){if(!_0x50bece){_0x3b72b8[_0x3e02('0x2c')](0x194);}return _0x50bece;};}function handleError(_0x559b88,_0x3ea7f6){_0x3ea7f6=_0x3ea7f6||0x1f4;return function(_0x45438a){logger[_0x3e02('0x29')](_0x45438a[_0x3e02('0x3c')]);if(_0x45438a[_0x3e02('0x3d')]){delete _0x45438a['name'];}_0x559b88[_0x3e02('0x2d')](_0x3ea7f6)[_0x3e02('0x3e')](_0x45438a);};}exports[_0x3e02('0x3f')]=function(_0x3c0bee,_0x39ffda){var _0x4a7f09={'include':[{'model':db[_0x3e02('0x40')],'as':'mandatoryDispositionPause'}]},_0x284ae8={},_0x3f23ed={'count':0x0,'rows':[]};var _0x4e2762=_[_0x3e02('0x41')](db[_0x3e02('0x42')][_0x3e02('0x43')],function(_0x673622){return{'name':_0x673622[_0x3e02('0x44')],'type':_0x673622[_0x3e02('0x45')][_0x3e02('0x46')]};});_0x284ae8[_0x3e02('0x47')]=_[_0x3e02('0x41')](_0x4e2762,'name');_0x284ae8['query']=_[_0x3e02('0x48')](_0x3c0bee[_0x3e02('0x49')]);_0x284ae8[_0x3e02('0x4a')]=_['intersection'](_0x284ae8[_0x3e02('0x47')],_0x284ae8['query']);_0x4a7f09[_0x3e02('0x4b')]=_[_0x3e02('0x4c')](_0x284ae8[_0x3e02('0x47')],qs[_0x3e02('0x4d')](_0x3c0bee['query'][_0x3e02('0x4d')]));_0x4a7f09[_0x3e02('0x4b')]=_0x4a7f09[_0x3e02('0x4b')][_0x3e02('0x4e')]?_0x4a7f09['attributes']:_0x284ae8[_0x3e02('0x47')];if(!_0x3c0bee[_0x3e02('0x49')][_0x3e02('0x4f')]('nolimit')){_0x4a7f09['limit']=qs[_0x3e02('0x2f')](_0x3c0bee[_0x3e02('0x49')][_0x3e02('0x2f')]);_0x4a7f09['offset']=qs['offset'](_0x3c0bee[_0x3e02('0x49')][_0x3e02('0x32')]);}_0x4a7f09[_0x3e02('0x50')]=qs[_0x3e02('0x51')](_0x3c0bee[_0x3e02('0x49')][_0x3e02('0x51')]);_0x4a7f09[_0x3e02('0x52')]=qs[_0x3e02('0x4a')](_['pick'](_0x3c0bee[_0x3e02('0x49')],_0x284ae8[_0x3e02('0x4a')]),_0x4e2762);if(_0x3c0bee[_0x3e02('0x49')][_0x3e02('0x53')]){_0x4a7f09[_0x3e02('0x52')]=_[_0x3e02('0x54')](_0x4a7f09[_0x3e02('0x52')],{'$or':_[_0x3e02('0x41')](_0x4e2762,function(_0x1fcb87){if(_0x1fcb87['type']!==_0x3e02('0x55')){var _0x523371={};_0x523371[_0x1fcb87['name']]={'$like':'%'+_0x3c0bee[_0x3e02('0x49')][_0x3e02('0x53')]+'%'};return _0x523371;}})});}_0x4a7f09=_[_0x3e02('0x54')]({},_0x4a7f09,_0x3c0bee[_0x3e02('0x56')]);var _0x331c76={'where':_0x4a7f09[_0x3e02('0x52')]};return db[_0x3e02('0x42')][_0x3e02('0x31')](_0x331c76)[_0x3e02('0x22')](function(_0x4260aa){_0x3f23ed[_0x3e02('0x31')]=_0x4260aa;if(_0x3c0bee['query']['includeAll']){_0x4a7f09[_0x3e02('0x57')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x4a7f09);})[_0x3e02('0x22')](function(_0x4bcfab){_0x3f23ed['rows']=_0x4bcfab;return _0x3f23ed;})[_0x3e02('0x22')](respondWithFilteredResult(_0x39ffda,_0x4a7f09))[_0x3e02('0x2b')](handleError(_0x39ffda,null));};exports[_0x3e02('0x58')]=function(_0xd7b673,_0x1c3377){var _0x39c364={'raw':![],'where':{'id':_0xd7b673[_0x3e02('0x59')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x210b64={};_0x210b64['model']=_[_0x3e02('0x48')](db[_0x3e02('0x42')][_0x3e02('0x43')]);_0x210b64[_0x3e02('0x49')]=_['keys'](_0xd7b673[_0x3e02('0x49')]);_0x210b64[_0x3e02('0x4a')]=_[_0x3e02('0x4c')](_0x210b64[_0x3e02('0x47')],_0x210b64['query']);_0x39c364['attributes']=_[_0x3e02('0x4c')](_0x210b64['model'],qs[_0x3e02('0x4d')](_0xd7b673['query']['fields']));_0x39c364[_0x3e02('0x4b')]=_0x39c364[_0x3e02('0x4b')]['length']?_0x39c364[_0x3e02('0x4b')]:_0x210b64[_0x3e02('0x47')];if(_0xd7b673['query'][_0x3e02('0x5a')]){_0x39c364[_0x3e02('0x57')]=[{'all':!![]}];}_0x39c364=_[_0x3e02('0x54')]({},_0x39c364,_0xd7b673['options']);return db[_0x3e02('0x42')][_0x3e02('0x5b')](_0x39c364)[_0x3e02('0x22')](handleEntityNotFound(_0x1c3377,null))['then'](respondWithResult(_0x1c3377,null))[_0x3e02('0x2b')](handleError(_0x1c3377,null));};exports[_0x3e02('0x5c')]=function(_0x343176,_0x28c452){return db[_0x3e02('0x42')][_0x3e02('0x5c')](_0x343176[_0x3e02('0x5d')],{})[_0x3e02('0x22')](function(_0x2b9f93){var _0x3cfc21=_0x343176['user']['get']({'plain':!![]});if(!_0x3cfc21)throw new Error(_0x3e02('0x5e'));if(_0x3cfc21['role']===_0x3e02('0x5f')){var _0x307711=_0x2b9f93[_0x3e02('0x39')]({'plain':!![]});var _0x3ce7be=_0x3e02('0x3a');return db['UserProfileSection'][_0x3e02('0x5b')]({'where':{'name':_0x3ce7be,'userProfileId':_0x3cfc21[_0x3e02('0x60')]},'raw':!![]})[_0x3e02('0x22')](function(_0x151667){if(_0x151667&&_0x151667[_0x3e02('0x61')]===0x0){return db[_0x3e02('0x3b')][_0x3e02('0x5c')]({'name':_0x307711[_0x3e02('0x3d')],'resourceId':_0x307711['id'],'type':_0x151667['name'],'sectionId':_0x151667['id']},{})[_0x3e02('0x22')](function(){return _0x2b9f93;});}else{return _0x2b9f93;}})[_0x3e02('0x2b')](function(_0x18216b){logger[_0x3e02('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18216b);throw _0x18216b;});}return _0x2b9f93;})[_0x3e02('0x22')](respondWithResult(_0x28c452,0xc9))['catch'](handleError(_0x28c452,null));};exports['update']=function(_0x464247,_0x2a474f){if(_0x464247[_0x3e02('0x5d')]['id']){delete _0x464247[_0x3e02('0x5d')]['id'];}return db[_0x3e02('0x42')][_0x3e02('0x5b')]({'where':{'id':_0x464247[_0x3e02('0x59')]['id']},'include':[{'model':db[_0x3e02('0x40')],'as':_0x3e02('0x62')}]})[_0x3e02('0x22')](handleEntityNotFound(_0x2a474f,null))[_0x3e02('0x22')](saveUpdates(_0x464247[_0x3e02('0x5d')],null))['then'](respondWithResult(_0x2a474f,null))['catch'](handleError(_0x2a474f,null));};exports[_0x3e02('0x63')]=function(_0x58335b,_0x216a67){return db['ChatWebsite'][_0x3e02('0x5b')]({'where':{'id':_0x58335b[_0x3e02('0x59')]['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x216a67,null))[_0x3e02('0x22')](removeEntity(_0x216a67,null))[_0x3e02('0x2b')](handleError(_0x216a67,null));};exports['describe']=function(_0x3c794f,_0x57d0c0){return db['ChatWebsite'][_0x3e02('0x64')]()[_0x3e02('0x22')](respondWithResult(_0x57d0c0,null))[_0x3e02('0x2b')](handleError(_0x57d0c0,null));};exports[_0x3e02('0x65')]=function(_0x570f00,_0x5902bc,_0x181d65){if(_0x570f00[_0x3e02('0x5d')]['id']){delete _0x570f00['body']['id'];}return db[_0x3e02('0x42')]['find']({'where':{'id':_0x570f00[_0x3e02('0x59')]['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x5902bc,null))[_0x3e02('0x22')](function(_0x5e92dc){if(_0x5e92dc){_0x570f00[_0x3e02('0x5d')][_0x3e02('0x66')]=_0x5e92dc['id'];return db[_0x3e02('0x67')]['create'](_0x570f00['body']);}})['then'](respondWithResult(_0x5902bc,null))['catch'](handleError(_0x5902bc,null));};exports[_0x3e02('0x68')]=function(_0x26c13f,_0x7fa403,_0x198ec3){var _0x33d096={'raw':![],'where':{}};var _0x1c65f1={};var _0x2b3e1f={'count':0x0,'rows':[]};return db[_0x3e02('0x42')][_0x3e02('0x69')]({'where':{'id':_0x26c13f[_0x3e02('0x59')]['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x7fa403,null))[_0x3e02('0x22')](function(_0x2abe38){if(_0x2abe38){_0x1c65f1[_0x3e02('0x47')]=_[_0x3e02('0x48')](db[_0x3e02('0x67')][_0x3e02('0x43')]);_0x1c65f1[_0x3e02('0x49')]=_['keys'](_0x26c13f[_0x3e02('0x49')]);_0x1c65f1[_0x3e02('0x4a')]=_['intersection'](_0x1c65f1['model'],_0x1c65f1[_0x3e02('0x49')]);_0x33d096[_0x3e02('0x4b')]=_[_0x3e02('0x4c')](_0x1c65f1[_0x3e02('0x47')],qs[_0x3e02('0x4d')](_0x26c13f['query'][_0x3e02('0x4d')]));_0x33d096[_0x3e02('0x4b')]=_0x33d096[_0x3e02('0x4b')][_0x3e02('0x4e')]?_0x33d096[_0x3e02('0x4b')]:_0x1c65f1[_0x3e02('0x47')];if(!_0x26c13f[_0x3e02('0x49')][_0x3e02('0x4f')](_0x3e02('0x6a'))){_0x33d096['limit']=qs[_0x3e02('0x2f')](_0x26c13f[_0x3e02('0x49')]['limit']);_0x33d096[_0x3e02('0x32')]=qs[_0x3e02('0x32')](_0x26c13f[_0x3e02('0x49')][_0x3e02('0x32')]);}_0x33d096['order']=qs['sort'](_0x26c13f[_0x3e02('0x49')]['sort']);_0x33d096[_0x3e02('0x52')]=qs[_0x3e02('0x4a')](_[_0x3e02('0x6b')](_0x26c13f[_0x3e02('0x49')],_0x1c65f1[_0x3e02('0x4a')]));_0x33d096[_0x3e02('0x52')][_0x3e02('0x66')]=_0x2abe38['id'];if(_0x26c13f[_0x3e02('0x49')][_0x3e02('0x53')]){_0x33d096[_0x3e02('0x52')]=_[_0x3e02('0x54')](_0x33d096['where'],{'$or':_[_0x3e02('0x41')](_0x33d096[_0x3e02('0x4b')],function(_0x34ca65){var _0x5b6798={};_0x5b6798[_0x34ca65]={'$like':'%'+_0x26c13f[_0x3e02('0x49')][_0x3e02('0x53')]+'%'};return _0x5b6798;})});}_0x33d096=_['merge']({},_0x33d096,_0x26c13f['options']);return db['Disposition'][_0x3e02('0x31')]({'where':_0x33d096[_0x3e02('0x52')]})[_0x3e02('0x22')](function(_0x37ff75){_0x2b3e1f[_0x3e02('0x31')]=_0x37ff75;if(_0x26c13f['query']['includeAll']){_0x33d096[_0x3e02('0x57')]=[{'all':!![]}];}return db[_0x3e02('0x67')][_0x3e02('0x6c')](_0x33d096);})[_0x3e02('0x22')](function(_0x4e3c91){_0x2b3e1f['rows']=_0x4e3c91;return _0x2b3e1f;});}})[_0x3e02('0x22')](respondWithFilteredResult(_0x7fa403,_0x33d096))[_0x3e02('0x2b')](handleError(_0x7fa403,null));};exports['removeDispositions']=function(_0xdeefee,_0x3944b6,_0x124893){return db[_0x3e02('0x42')]['find']({'where':{'id':_0xdeefee[_0x3e02('0x59')]['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x3944b6,null))[_0x3e02('0x22')](function(_0x3f19c1){if(_0x3f19c1){return _0x3f19c1[_0x3e02('0x6d')](_0xdeefee[_0x3e02('0x49')][_0x3e02('0x6e')]);}})[_0x3e02('0x22')](respondWithStatusCode(_0x3944b6,null))[_0x3e02('0x2b')](handleError(_0x3944b6,null));};exports['addAnswer']=function(_0x3d8fa8,_0x39f7fb,_0xd8d5c){if(_0x3d8fa8['body']['id']){delete _0x3d8fa8[_0x3e02('0x5d')]['id'];}return db[_0x3e02('0x42')]['find']({'where':{'id':_0x3d8fa8['params']['id']}})['then'](handleEntityNotFound(_0x39f7fb,null))['then'](function(_0x492b24){if(_0x492b24){_0x3d8fa8[_0x3e02('0x5d')][_0x3e02('0x66')]=_0x492b24['id'];return db[_0x3e02('0x6f')][_0x3e02('0x5c')](_0x3d8fa8[_0x3e02('0x5d')]);}})[_0x3e02('0x22')](respondWithResult(_0x39f7fb,null))[_0x3e02('0x2b')](handleError(_0x39f7fb,null));};exports[_0x3e02('0x70')]=function(_0x4a4fbb,_0x22152e,_0x3f4a9f){var _0x546a8d={'raw':![],'where':{}};var _0x586793={};var _0x354d18={'count':0x0,'rows':[]};return db[_0x3e02('0x42')]['findOne']({'where':{'id':_0x4a4fbb[_0x3e02('0x59')]['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x22152e,null))['then'](function(_0x4d9361){if(_0x4d9361){_0x586793[_0x3e02('0x47')]=_['keys'](db['CannedAnswer'][_0x3e02('0x43')]);_0x586793[_0x3e02('0x49')]=_[_0x3e02('0x48')](_0x4a4fbb[_0x3e02('0x49')]);_0x586793['filters']=_[_0x3e02('0x4c')](_0x586793[_0x3e02('0x47')],_0x586793['query']);_0x546a8d['attributes']=_[_0x3e02('0x4c')](_0x586793[_0x3e02('0x47')],qs['fields'](_0x4a4fbb[_0x3e02('0x49')][_0x3e02('0x4d')]));_0x546a8d['attributes']=_0x546a8d[_0x3e02('0x4b')][_0x3e02('0x4e')]?_0x546a8d[_0x3e02('0x4b')]:_0x586793['model'];if(!_0x4a4fbb[_0x3e02('0x49')][_0x3e02('0x4f')](_0x3e02('0x6a'))){_0x546a8d[_0x3e02('0x2f')]=qs[_0x3e02('0x2f')](_0x4a4fbb[_0x3e02('0x49')]['limit']);_0x546a8d['offset']=qs['offset'](_0x4a4fbb[_0x3e02('0x49')][_0x3e02('0x32')]);}_0x546a8d['order']=qs['sort'](_0x4a4fbb[_0x3e02('0x49')][_0x3e02('0x51')]);_0x546a8d[_0x3e02('0x52')]=qs['filters'](_[_0x3e02('0x6b')](_0x4a4fbb[_0x3e02('0x49')],_0x586793[_0x3e02('0x4a')]));_0x546a8d[_0x3e02('0x52')][_0x3e02('0x66')]=_0x4d9361['id'];if(_0x4a4fbb[_0x3e02('0x49')][_0x3e02('0x53')]){_0x546a8d[_0x3e02('0x52')]=_['merge'](_0x546a8d['where'],{'$or':_['map'](_0x546a8d[_0x3e02('0x4b')],function(_0x5a08c9){var _0x339b23={};_0x339b23[_0x5a08c9]={'$like':'%'+_0x4a4fbb[_0x3e02('0x49')][_0x3e02('0x53')]+'%'};return _0x339b23;})});}_0x546a8d=_['merge']({},_0x546a8d,_0x4a4fbb[_0x3e02('0x56')]);return db['CannedAnswer']['count']({'where':_0x546a8d[_0x3e02('0x52')]})[_0x3e02('0x22')](function(_0x41b86a){_0x354d18[_0x3e02('0x31')]=_0x41b86a;if(_0x4a4fbb[_0x3e02('0x49')][_0x3e02('0x5a')]){_0x546a8d[_0x3e02('0x57')]=[{'all':!![]}];}return db[_0x3e02('0x6f')][_0x3e02('0x6c')](_0x546a8d);})[_0x3e02('0x22')](function(_0x3428b8){_0x354d18['rows']=_0x3428b8;return _0x354d18;});}})[_0x3e02('0x22')](respondWithFilteredResult(_0x22152e,_0x546a8d))[_0x3e02('0x2b')](handleError(_0x22152e,null));};exports['removeAnswers']=function(_0x394a9a,_0x2de4bf,_0xbfa0ec){return db[_0x3e02('0x42')][_0x3e02('0x5b')]({'where':{'id':_0x394a9a['params']['id']}})['then'](handleEntityNotFound(_0x2de4bf,null))[_0x3e02('0x22')](function(_0x292b0b){if(_0x292b0b){return _0x292b0b[_0x3e02('0x71')](_0x394a9a['query'][_0x3e02('0x6e')]);}})[_0x3e02('0x22')](respondWithStatusCode(_0x2de4bf,null))['catch'](handleError(_0x2de4bf,null));};exports[_0x3e02('0x72')]=function(_0x2ebeda,_0x4f020a,_0xa9b1a2){_0x2ebeda[_0x3e02('0x5d')][_0x3e02('0x73')]=_0x2ebeda[_0x3e02('0x74')][_0x3e02('0x75')];return db[_0x3e02('0x42')][_0x3e02('0x5b')]({'where':{'id':_0x2ebeda['params']['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x4f020a,null))[_0x3e02('0x22')](saveUpdates(_0x2ebeda['body'],null))[_0x3e02('0x22')](respondWithResult(_0x4f020a,null))[_0x3e02('0x2b')](handleError(_0x4f020a,null));};exports[_0x3e02('0x76')]=function(_0x15f47e,_0x32c76b,_0x5ae870){_0x15f47e[_0x3e02('0x5d')]['agentAvatar']=_0x15f47e['file']['filename'];return db[_0x3e02('0x42')][_0x3e02('0x5b')]({'where':{'id':_0x15f47e[_0x3e02('0x59')]['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x32c76b,null))[_0x3e02('0x22')](saveUpdates(_0x15f47e[_0x3e02('0x5d')],null))[_0x3e02('0x22')](respondWithResult(_0x32c76b,null))['catch'](handleError(_0x32c76b,null));};exports['addCustomerAvatar']=function(_0x514fc0,_0x5646f3,_0x2dc1fd){_0x514fc0[_0x3e02('0x5d')][_0x3e02('0x77')]=_0x514fc0['file'][_0x3e02('0x75')];return db[_0x3e02('0x42')]['find']({'where':{'id':_0x514fc0['params']['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x5646f3,null))[_0x3e02('0x22')](saveUpdates(_0x514fc0[_0x3e02('0x5d')],null))[_0x3e02('0x22')](respondWithResult(_0x5646f3,null))[_0x3e02('0x2b')](handleError(_0x5646f3,null));};exports['addSystemAvatar']=function(_0x8ea333,_0x23a701,_0xd81436){_0x8ea333[_0x3e02('0x5d')][_0x3e02('0x78')]=_0x8ea333[_0x3e02('0x74')][_0x3e02('0x75')];return db[_0x3e02('0x42')][_0x3e02('0x5b')]({'where':{'id':_0x8ea333['params']['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x23a701,null))[_0x3e02('0x22')](saveUpdates(_0x8ea333[_0x3e02('0x5d')],null))[_0x3e02('0x22')](respondWithResult(_0x23a701,null))[_0x3e02('0x2b')](handleError(_0x23a701,null));};exports['getLogo']=function(_0x4de74f,_0x5e9b5e,_0x4b028e){var _0x530b17=path[_0x3e02('0x79')](config[_0x3e02('0x7a')],'server/files/images/logos/default_logo.svg');var _0x4ad317={'where':{'id':_0x4de74f[_0x3e02('0x59')]['id']},'attributes':['id',_0x3e02('0x73')],'raw':!![]};var _0x2a7d02=![];return require('../../config/license/util')[_0x3e02('0x7b')]()['then'](function(_0x2b337e){if(_0x2b337e){_0x2a7d02=_0x2b337e[_0x3e02('0x7c')];}})[_0x3e02('0x22')](function(){return db[_0x3e02('0x42')][_0x3e02('0x5b')](_0x4ad317);})['then'](handleEntityNotFound(_0x5e9b5e,null))['then'](function(_0x43c43a){if(_0x43c43a){if(!_[_0x3e02('0x7d')](_0x43c43a[_0x3e02('0x73')])){if(fs['existsSync'](path['join'](config[_0x3e02('0x7a')],_0x3e02('0x7e'),_0x43c43a['sitepic']))&&_0x2a7d02){_0x530b17=path[_0x3e02('0x79')](config[_0x3e02('0x7a')],'server/files/images/logos/',_0x43c43a['sitepic']);}}return _0x5e9b5e[_0x3e02('0x7f')](_0x530b17);}})[_0x3e02('0x2b')](handleError(_0x5e9b5e,null));};exports[_0x3e02('0x80')]=function(_0x213d78,_0x5a4d4f,_0x11b5bb){var _0x12113b=path['join'](config[_0x3e02('0x7a')],_0x3e02('0x81'));var _0x429add={'where':{'id':_0x213d78['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x3e02('0x42')][_0x3e02('0x5b')](_0x429add)[_0x3e02('0x22')](handleEntityNotFound(_0x5a4d4f,null))[_0x3e02('0x22')](function(_0x57ebd8){if(_0x57ebd8){if(!_[_0x3e02('0x7d')](_0x57ebd8[_0x3e02('0x82')])){if(fs[_0x3e02('0x83')](path[_0x3e02('0x79')](config[_0x3e02('0x7a')],'server/files/images/avatars/',_0x57ebd8[_0x3e02('0x82')]))){_0x12113b=path[_0x3e02('0x79')](config[_0x3e02('0x7a')],_0x3e02('0x84'),_0x57ebd8[_0x3e02('0x82')]);}}return _0x5a4d4f[_0x3e02('0x7f')](_0x12113b);}})['catch'](handleError(_0x5a4d4f,null));};exports[_0x3e02('0x85')]=function(_0x3728fa,_0x50abc6,_0x470fc2){var _0x522598=path['join'](config['root'],_0x3e02('0x86'));var _0x4fbdff={'where':{'id':_0x3728fa[_0x3e02('0x59')]['id']},'attributes':['id',_0x3e02('0x77'),_0x3e02('0x87')],'raw':!![]};return db[_0x3e02('0x42')][_0x3e02('0x5b')](_0x4fbdff)['then'](handleEntityNotFound(_0x50abc6,null))[_0x3e02('0x22')](function(_0x5e1925){if(_0x5e1925){if(!_[_0x3e02('0x7d')](_0x5e1925[_0x3e02('0x77')])){if(fs[_0x3e02('0x83')](path[_0x3e02('0x79')](config[_0x3e02('0x7a')],_0x3e02('0x84'),_0x5e1925[_0x3e02('0x77')]))&&_0x5e1925[_0x3e02('0x87')]){_0x522598=path[_0x3e02('0x79')](config[_0x3e02('0x7a')],_0x3e02('0x84'),_0x5e1925[_0x3e02('0x77')]);}}return _0x50abc6[_0x3e02('0x7f')](_0x522598);}})['catch'](handleError(_0x50abc6,null));};exports[_0x3e02('0x88')]=function(_0x23a2e4,_0x18a58e,_0x3fdac4){var _0x36caf8=path['join'](config['root'],'server/files/images/avatars/system_avatar.png');var _0x51ade0={'where':{'id':_0x23a2e4[_0x3e02('0x59')]['id']},'attributes':['id',_0x3e02('0x78')],'raw':!![]};return db[_0x3e02('0x42')][_0x3e02('0x5b')](_0x51ade0)['then'](handleEntityNotFound(_0x18a58e,null))['then'](function(_0x54d327){if(_0x54d327){if(!_[_0x3e02('0x7d')](_0x54d327[_0x3e02('0x78')])){if(fs['existsSync'](path[_0x3e02('0x79')](config[_0x3e02('0x7a')],'server/files/images/avatars/',_0x54d327['systemAvatar']))){_0x36caf8=path[_0x3e02('0x79')](config[_0x3e02('0x7a')],_0x3e02('0x84'),_0x54d327['systemAvatar']);}}return _0x18a58e[_0x3e02('0x7f')](_0x36caf8);}})[_0x3e02('0x2b')](handleError(_0x18a58e,null));};exports[_0x3e02('0x89')]=function(_0x57ed99,_0x38f4a1,_0x3f1901){var _0x399807=require(_0x3e02('0x8a'));var _0x56e351=new _0x399807();var _0x49086f=_0x56e351[_0x3e02('0x8b')](_0x57ed99[_0x3e02('0x8c')][_0x3e02('0x8d')])[_0x3e02('0x8e')]();var _0x692613={'body':_0x57ed99[_0x3e02('0x5d')],'channel':_0x3e02('0x8f')};var _0x115317=[];var _0x1f4285=[];var _0x535546={};var _0x54132f=![];return db[_0x3e02('0x90')][_0x3e02('0x64')]()[_0x3e02('0x22')](function(_0x12af8b){if(!_0x12af8b){throw new db[(_0x3e02('0x91'))][(_0x3e02('0x92'))](_0x3e02('0x93'));}_0x115317=_[_0x3e02('0x94')](_[_0x3e02('0x48')](_0x12af8b),['createdAt','updatedAt']);_0x1f4285=_['difference'](_['keys'](_0x12af8b),[_0x3e02('0x95'),'updatedAt','CompanyId',_0x3e02('0x96')]);if(_0x57ed99[_0x3e02('0x5d')]['id']){delete _0x57ed99[_0x3e02('0x5d')]['id'];}if(_[_0x3e02('0x7d')](_0x57ed99[_0x3e02('0x5d')]['from'])){throw new db[(_0x3e02('0x91'))][(_0x3e02('0x92'))]('from\x20is\x20mandatory');}if(_[_0x3e02('0x7d')](_0x57ed99[_0x3e02('0x5d')]['body'])||_0x57ed99[_0x3e02('0x5d')][_0x3e02('0x5d')]===''){throw new db[(_0x3e02('0x91'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3e02('0x7d')](_0x57ed99['body']['mapKey'])){throw new db[(_0x3e02('0x91'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1f4285);}if(!_['includes'](_0x1f4285,_0x57ed99[_0x3e02('0x5d')][_0x3e02('0x97')])){throw new db['Sequelize']['ValidationError'](_0x3e02('0x98')+_0x1f4285);}_0x535546[_0x57ed99[_0x3e02('0x5d')][_0x3e02('0x97')]]=_0x57ed99['body'][_0x3e02('0x99')];})[_0x3e02('0x22')](function(){return db['ChatWebsite'][_0x3e02('0x5b')]({'where':{'id':_0x57ed99[_0x3e02('0x59')]['id']},'include':[{'model':db[_0x3e02('0x9a')],'as':'List','include':[{'model':db['CmContact'],'as':_0x3e02('0x9b'),'where':_0x535546,'limit':0x1,'order':[['updatedAt',_0x3e02('0x9c')]]}]},{'model':db[_0x3e02('0x9d')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x38f4a1,null))['then'](function(_0x365a47){if(_0x365a47&&_0x365a47[_0x3e02('0x9e')]){_0x692613['account']=_0x365a47;_0x692613[_0x3e02('0x9f')]=_0x365a47[_0x3e02('0xa0')];_0x692613[_0x3e02('0xa1')]=_0x365a47[_0x3e02('0x9e')];_0x692613['applications']=_['orderBy'](_0x692613[_0x3e02('0x9f')],[_0x3e02('0xa2')],[_0x3e02('0xa3')]);if(_0x692613[_0x3e02('0xa4')]['Applications']){delete _0x692613['account'][_0x3e02('0xa0')];}if(_0x692613['account']['List']&&_0x692613[_0x3e02('0xa4')]['List'][_0x3e02('0x9b')]['length']){return _0x692613['account'][_0x3e02('0x9e')][_0x3e02('0x9b')][0x0];}var _0x160893=_['defaults'](_0x57ed99['body'],{'firstName':_0x57ed99[_0x3e02('0x5d')][_0x3e02('0x99')],'ListId':_0x365a47[_0x3e02('0x96')]});_0x160893[_0x57ed99['body'][_0x3e02('0x97')]]=_0x57ed99[_0x3e02('0x5d')][_0x3e02('0x99')];return db[_0x3e02('0x90')][_0x3e02('0x5c')](_0x160893,{'fields':_0x115317,'raw':!![]});}})[_0x3e02('0x22')](handleEntityNotFound(_0x38f4a1,null))['then'](function(_0x3fba59){_0x692613[_0x3e02('0xa5')]=_0x3fba59;var _0x306e3e=_0x57ed99[_0x3e02('0x5d')][_0x3e02('0xa6')];if(_0x57ed99[_0x3e02('0x8c')][_0x3e02('0xa7')]){_0x306e3e=_0x57ed99[_0x3e02('0x8c')][_0x3e02('0xa7')];}else if(_0x57ed99[_0x3e02('0x8c')][_0x3e02('0xa8')]){_0x306e3e=_[_0x3e02('0xa9')](_0x57ed99[_0x3e02('0x8c')]['x-forwarded-for'][_0x3e02('0xaa')](','));}if(_0x3fba59){var _0x1c8732={'ContactId':_0x3fba59['id'],'ChatWebsiteId':_0x57ed99[_0x3e02('0x59')]['id'],'from':(_0x3fba59['firstName']||'')+'\x20'+(_0x3fba59[_0x3e02('0xab')]||''),'customerIp':_0x306e3e,'customerPort':_0x57ed99[_0x3e02('0x8c')][_0x3e02('0xac')]?_0x57ed99[_0x3e02('0x8c')][_0x3e02('0xac')]:null,'referer':_0x57ed99[_0x3e02('0x5d')][_0x3e02('0xad')],'browserName':_0x49086f[_0x3e02('0xae')][_0x3e02('0x3d')]&&_0x49086f[_0x3e02('0xae')]['version']?util['format'](_0x3e02('0xaf'),_0x49086f['browser'][_0x3e02('0x3d')],_0x49086f['browser']['version']):'unknown','browserVersion':_0x49086f[_0x3e02('0xae')][_0x3e02('0xb0')]||_0x3e02('0xb1'),'osName':util[_0x3e02('0xb2')](_0x3e02('0xaf'),_0x49086f['os'][_0x3e02('0x3d')],_0x49086f['os'][_0x3e02('0xb0')]),'osVersion':_0x49086f['os']['version'],'deviceModel':_0x49086f[_0x3e02('0xb3')][_0x3e02('0x47')]&&_0x49086f['device'][_0x3e02('0xb4')]?util['format'](_0x3e02('0xb5'),_0x49086f[_0x3e02('0xb3')][_0x3e02('0x47')],_0x49086f['device'][_0x3e02('0xb4')],_0x49086f[_0x3e02('0xb3')][_0x3e02('0x45')]):null,'deviceVendor':_0x49086f[_0x3e02('0xb3')][_0x3e02('0xb4')],'deviceType':_0x49086f[_0x3e02('0xb3')][_0x3e02('0x45')],'formData':JSON[_0x3e02('0x27')](_0x57ed99['body'])};var _0x515715={'ChatWebsiteId':_0x57ed99[_0x3e02('0x59')]['id'],'closed':![]};if(_0x57ed99[_0x3e02('0x5d')][_0x3e02('0xb6')]){_0x515715[_0x3e02('0xb6')]=_0x57ed99[_0x3e02('0x5d')]['threadId'];return db['ChatInteraction']['find']({'where':_0x515715})[_0x3e02('0x22')](function(_0x1e3898){if(_0x1e3898){return[_0x1e3898,![]];}_0x1c8732[_0x3e02('0xb6')]=_0x57ed99[_0x3e02('0x5d')][_0x3e02('0xb6')];_0x1c8732['externalUrl']=_0x57ed99[_0x3e02('0x5d')]['externalUrl'];return db['ChatInteraction']['create'](_0x1c8732)[_0x3e02('0x22')](function(_0x4eafd5){return[_0x4eafd5,!![]];});});}_0x515715[_0x3e02('0xb7')]=_0x3fba59['id'];if(_0x57ed99[_0x3e02('0x5d')][_0x3e02('0xb8')]&&_0x57ed99[_0x3e02('0x5d')]['interaction']['id']){_0x515715['id']=_0x57ed99['body'][_0x3e02('0xb8')]['id'];return db['ChatInteraction'][_0x3e02('0x5b')]({'where':_0x515715})['then'](function(_0x312a39){if(_0x312a39){return[_0x312a39,![]];}return db[_0x3e02('0xb9')][_0x3e02('0x5c')](_0x1c8732)[_0x3e02('0x22')](function(_0x4fe498){return[_0x4fe498,!![]];});});}return db['ChatInteraction']['create'](_0x1c8732)[_0x3e02('0x22')](function(_0xb1a2bb){return[_0xb1a2bb,!![]];});}})[_0x3e02('0xba')](function(_0x262f10,_0x268482){if(_0x262f10){_0x54132f=_0x268482;if(!_0x268482){var _0x34dfc2={'from':(_0x692613[_0x3e02('0xa5')]['firstName']||'')+'\x20'+(_0x692613[_0x3e02('0xa5')][_0x3e02('0xab')]||'')};if(_0x57ed99[_0x3e02('0x5d')]['threadId']&&_0x57ed99[_0x3e02('0x5d')][_0x3e02('0xbb')]&&_0x57ed99[_0x3e02('0x5d')]['threadId']!=_0x57ed99[_0x3e02('0x5d')]['messageId']){_0x34dfc2[_0x3e02('0xb6')]=_0x57ed99[_0x3e02('0x5d')]['messageId'];}return _0x262f10[_0x3e02('0x38')](_0x34dfc2);}else{return _0x262f10;}}})['then'](function(_0x2fe29b){_0x692613['interaction']=_0x2fe29b[_0x3e02('0x39')]({'plain':!![]});_0x692613[_0x3e02('0xb8')]['created']=_0x54132f;if(_0x692613[_0x3e02('0xb8')][_0x3e02('0xbc')]){if(_0x692613[_0x3e02('0xa4')][_0x3e02('0xbd')]){_0x692613['applications'][_0x3e02('0xbe')]({'id':0x0,'priority':_0x692613[_0x3e02('0x9f')][_0x3e02('0x4e')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x3e02('0xbf')});}}return db[_0x3e02('0xc0')][_0x3e02('0x5c')]({'body':_0x57ed99[_0x3e02('0x5d')][_0x3e02('0x5d')],'ChatWebsiteId':_0x57ed99[_0x3e02('0x59')]['id'],'ChatInteractionId':_0x2fe29b['id'],'direction':'in','ContactId':_0x692613[_0x3e02('0xa5')]['id'],'AttachmentId':_0x57ed99['body'][_0x3e02('0xc1')]});})[_0x3e02('0x22')](function(_0x5701ca){_0x692613['message']=_0x5701ca;if(_0x692613[_0x3e02('0xb8')]['UserId']){return db[_0x3e02('0xc2')][_0x3e02('0x5b')]({'attributes':['id','name'],'where':{'id':_0x692613['interaction']['UserId']}})['then'](function(_0x467cd0){if(_0x467cd0){_0x692613['applications'][_0x3e02('0xc3')]({'id':0x0,'priority':0x0,'app':_0x3e02('0xc4'),'appdata':_0x467cd0[_0x3e02('0x3d')]+','+(_0x692613[_0x3e02('0xa4')][_0x3e02('0xc5')]||0xa),'interval':_0x3e02('0xbf')});_0x692613[_0x3e02('0xc6')]=!![];}return respondWithRpcPromise(_0x3e02('0xc7'),_0x3e02('0xc8'),_0x692613);});}return respondWithRpcPromise(_0x3e02('0xc7'),_0x3e02('0xc8'),_0x692613);})[_0x3e02('0x22')](function(_0xdb3607){respondWithRpcPromise(_0x3e02('0xc9'),_0x3e02('0xc9'),{'event':_0x3e02('0x89'),'message':_0xdb3607},client9002);return _0xdb3607;})[_0x3e02('0x22')](respondWithResult(_0x38f4a1,null))[_0x3e02('0x2b')](handleError(_0x38f4a1,null));};exports[_0x3e02('0xca')]=function(_0x2c57ff,_0x46bca3,_0x59ce74){var _0x270695,_0x49b7db,_0x385fcd;var _0xcbd34b=[];var _0x26611c=[];var _0x24f51b={};var _0x38e69f=_0x2c57ff[_0x3e02('0xcb')]||[];var _0x836d7c=[];var _0x459b07;return db['CmContact']['describe']()['then'](function(_0x50879b){if(!_0x50879b){throw new db[(_0x3e02('0x91'))][(_0x3e02('0x92'))](_0x3e02('0x93'));}_0x26611c=_['difference'](_[_0x3e02('0x48')](_0x50879b),['createdAt',_0x3e02('0xcc')]);_0xcbd34b=_['difference'](_[_0x3e02('0x48')](_0x50879b),[_0x3e02('0x95'),_0x3e02('0xcc'),'CompanyId',_0x3e02('0x96')]);if(_0x2c57ff[_0x3e02('0x5d')]['id']){delete _0x2c57ff['body']['id'];}if(_[_0x3e02('0x7d')](_0x2c57ff[_0x3e02('0x5d')][_0x3e02('0x99')])){throw _0x46bca3['status'](0x1f4)[_0x3e02('0x3e')](new db[(_0x3e02('0x91'))][(_0x3e02('0x92'))](_0x3e02('0xcd')));}if(_[_0x3e02('0x7d')](_0x2c57ff[_0x3e02('0x5d')][_0x3e02('0x5d')])||_0x2c57ff['body'][_0x3e02('0x5d')]===''){throw _0x46bca3[_0x3e02('0x2d')](0x1f4)[_0x3e02('0x3e')](new db[(_0x3e02('0x91'))]['ValidationError'](_0x3e02('0xce')));}if(_[_0x3e02('0x7d')](_0x2c57ff[_0x3e02('0x5d')][_0x3e02('0xcf')])){throw _0x46bca3['status'](0x1f4)[_0x3e02('0x3e')](new db['Sequelize']['ValidationError'](_0x3e02('0xd0')+_0xcbd34b));}if(!_['includes'](_0xcbd34b,_0x2c57ff[_0x3e02('0x5d')]['mapKeyOffline'])){throw _0x46bca3['status'](0x1f4)['send'](new db[(_0x3e02('0x91'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xcbd34b));}_0x24f51b[_0x2c57ff[_0x3e02('0x5d')][_0x3e02('0xcf')]]=_0x2c57ff[_0x3e02('0x5d')][_0x3e02('0x99')];})['then'](function(){return db[_0x3e02('0x42')][_0x3e02('0x5b')]({'where':{'id':_0x2c57ff[_0x3e02('0x59')]['id']},'include':[{'model':db[_0x3e02('0x9a')],'as':_0x3e02('0x9e')},{'model':db[_0x3e02('0xd1')],'as':_0x3e02('0xd1')}]});})[_0x3e02('0x22')](handleEntityNotFound(_0x46bca3,null))[_0x3e02('0x22')](function(_0x4a7966){if(_0x4a7966&&_0x4a7966[_0x3e02('0x9e')]){_0x49b7db=_0x4a7966;var _0x3faa29=_[_0x3e02('0x19')](_0x2c57ff['body'],{'firstName':_0x2c57ff[_0x3e02('0x5d')]['from'],'phone':_0x2c57ff[_0x3e02('0x5d')]['from'],'ListId':_0x4a7966['ListId']});_0x3faa29[_0x2c57ff[_0x3e02('0x5d')]['mapKeyOffline']]=_0x2c57ff['body'][_0x3e02('0x99')];return db[_0x3e02('0x90')][_0x3e02('0xd2')]({'where':_0x24f51b,'defaults':_0x3faa29});}})[_0x3e02('0xba')](function(_0x268dd0){if(_0x268dd0){_0x385fcd=_0x268dd0;var _0x1ace69=fs['readFileSync'](path[_0x3e02('0x79')](config[_0x3e02('0x7a')],'server/files/templates/chatOfflineMessage.ejs'),_0x3e02('0xd3'));var _0x37277d=ejs[_0x3e02('0xd4')](_0x1ace69,{'body':_['toPairs'](_0x2c57ff[_0x3e02('0x5d')][_0x3e02('0x5d')]),'bodyTitle':_0x49b7db[_0x3e02('0xd5')]});return db[_0x3e02('0xd6')][_0x3e02('0x5c')]({'body':_0x37277d,'ContactId':_0x268dd0['id'],'ChatWebsiteId':_0x49b7db['id']});}})['then'](function(_0x1ad96f){_0x459b07=_0x1ad96f;if(_0x38e69f[_0x3e02('0x4e')]){var _0x2547be=_0x38e69f[_0x3e02('0x41')](function(_0x59957c){return{'name':_0x59957c[_0x3e02('0xd7')],'basename':_0x59957c[_0x3e02('0x75')],'type':_0x59957c[_0x3e02('0xd8')],'ChatOfflineMessageId':_0x1ad96f['id']};});_0x836d7c=_0x2547be['map'](_0x5d82e6=>{var _0x317189={'filename':_0x5d82e6['name'],'path':path[_0x3e02('0x79')](config[_0x3e02('0x7a')],_0x3e02('0xd9'),_0x3e02('0xcb'),'attachments','offline-chat',_0x5d82e6[_0x3e02('0xda')])};return _0x317189;});if(!_0x49b7db['openNewInteraction']){return db[_0x3e02('0xdb')][_0x3e02('0xdc')](function(_0x5c13fc){return db['Attachment'][_0x3e02('0xdd')](_0x2547be,{'transaction':_0x5c13fc});});}}})[_0x3e02('0x22')](function(){if(_0x459b07){_0x270695=_0x459b07;return db['MailAccount'][_0x3e02('0x69')]({'where':{'active':!![]},'include':[{'model':db[_0x3e02('0xde')],'as':_0x3e02('0xdf'),'raw':!![]}]});}})[_0x3e02('0x22')](function(_0x224a9d){if(_0x224a9d&&_0x224a9d[_0x3e02('0xdf')]&&_0x49b7db['forwardOffline']&&_0x49b7db[_0x3e02('0xe0')]){var _0x56c91e={'tls':{'rejectUnauthorized':![]}};if(_0x224a9d[_0x3e02('0xdf')][_0x3e02('0xe1')]){_0x56c91e['service']=_0x224a9d[_0x3e02('0xdf')][_0x3e02('0xe1')];}else{_0x56c91e['host']=_0x224a9d['Smtp']['host'];_0x56c91e[_0x3e02('0xe2')]=_0x224a9d['Smtp'][_0x3e02('0xe2')];_0x56c91e[_0x3e02('0xe3')]=_0x224a9d['Smtp'][_0x3e02('0xe3')];}if(_0x224a9d[_0x3e02('0xdf')][_0x3e02('0xe4')]){_0x56c91e[_0x3e02('0xe5')]={'user':_0x224a9d['Smtp'][_0x3e02('0x5f')],'pass':_0x224a9d[_0x3e02('0xdf')][_0x3e02('0xe6')]};}return respondWithRpcPromise(_0x3e02('0xe7'),_0x3e02('0xe8'),{'account':_0x56c91e,'message':{'from':util[_0x3e02('0xb2')]('\x22%s\x22\x20<%s>',_0x224a9d[_0x3e02('0x3d')],_0x224a9d['email']||_0x224a9d[_0x3e02('0xdf')][_0x3e02('0x5f')]),'to':_0x49b7db[_0x3e02('0xe0')],'subject':_0x49b7db[_0x3e02('0xe9')],'html':_0x270695[_0x3e02('0x5d')],'attachments':_0x836d7c}},client9003)['then'](function(){return _0x270695;})[_0x3e02('0x2b')](function(_0x3308ea){console['error'](_0x3308ea);});}})[_0x3e02('0x22')](function(){if(_0x49b7db&&_0x49b7db[_0x3e02('0xea')]&&_0x49b7db['MailAccountId']){var _0x58fa9b=[];if(_0x38e69f['length']){_0x58fa9b=_0x38e69f[_0x3e02('0x41')](function(_0x17d675){return{'name':_0x17d675[_0x3e02('0xd7')],'basename':_0x17d675[_0x3e02('0x75')],'type':_0x17d675[_0x3e02('0xd8')],'ChatOfflineMessageId':_0x459b07['id']};});}var _0x1f04ed;if(!_[_0x3e02('0x7d')](_0x49b7db[_0x3e02('0xeb')])){var _0x2f4271=_['map'](_0x2c57ff[_0x3e02('0x5d')],function(_0x1002a3){return _0x1002a3;});var _0x39e9e6=_['toPairsIn'](_0x2f4271)[0x0];var _0x4f0d3e=_['mapValues'](_0x39e9e6,function(_0x29ad4a){return _0x29ad4a;});_0x1f04ed=_0x4f0d3e[0x1][_0x49b7db[_0x3e02('0xeb')]];}var _0x38fb4a={'from':_0x385fcd['email'],'firstName':_0x385fcd[_0x3e02('0xec')],'lastName':_0x385fcd[_0x3e02('0xab')],'mapKey':_0x3e02('0xed'),'message':{'from':_0x385fcd['email'],'to':_0x49b7db['MailAccount'][_0x3e02('0xed')],'cc':'','subject':_['isNil'](_0x1f04ed)?_0x49b7db[_0x3e02('0xe9')]:_0x1f04ed,'messageId':'','sentAt':new Date(),'attach':_0x58fa9b[_0x3e02('0x4e')],'attachments':_0x58fa9b,'originChannel':_0x3e02('0xee'),'ChatWebsiteId':_0x49b7db['id'],'ChatOfflineMessageId':_0x270695['id'],'originTo':_0x49b7db[_0x3e02('0xd1')]['email']},'body':_0x270695['body']};var _0x2e15bd={'account':{'id':_0x49b7db[_0x3e02('0xef')]},'body':_0x38fb4a,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x2e15bd,client9001)[_0x3e02('0x22')](function(){return _0x270695;})[_0x3e02('0x2b')](function(_0x5059c3){console['error'](_0x5059c3);});}return;})[_0x3e02('0x22')](function(){if(_0x270695){return _0x270695;}})[_0x3e02('0x22')](respondWithResult(_0x46bca3,null))[_0x3e02('0x2b')](function(_0x2cb098){console[_0x3e02('0x29')](_0x3e02('0x2b'),_0x2cb098);for(var _0x2a667e of _0x38e69f){var _0x13aef6=path[_0x3e02('0x79')](config[_0x3e02('0x7a')],'server','files','attachments','offline-chat',_0x2a667e[_0x3e02('0x75')]);fs_extra['remove'](_0x13aef6)[_0x3e02('0x2b')](function(_0x4a9d12){console[_0x3e02('0x29')](_0x3e02('0xf0'),_0x13aef6,_0x4a9d12);});}});};exports[_0x3e02('0xf1')]=function(_0x469e89,_0x1338c1,_0x368c64){return db[_0x3e02('0xb9')]['find']({'where':{'id':_0x469e89['params']['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x1338c1,null))[_0x3e02('0x22')](function(_0x5482fb){if(_0x5482fb){return _0x5482fb[_0x3e02('0xf1')](_0x469e89[_0x3e02('0x5d')]['ids'],_[_0x3e02('0xf2')](_0x469e89[_0x3e02('0x5d')],['ids','id'])||{});}})[_0x3e02('0x22')](respondWithResult(_0x1338c1,null))[_0x3e02('0x2b')](handleError(_0x1338c1,null));};exports[_0x3e02('0xf3')]=function(_0x4ccc0d,_0x5d7aff,_0x33ef5f){var _0x524534={'raw':![],'where':{}};var _0x2f28c1={};var _0x4e055f={'count':0x0,'rows':[]};return db[_0x3e02('0x42')][_0x3e02('0x69')]({'where':{'id':_0x4ccc0d[_0x3e02('0x59')]['id']}})['then'](handleEntityNotFound(_0x5d7aff,null))['then'](function(_0x360818){if(_0x360818){_0x2f28c1[_0x3e02('0x47')]=_[_0x3e02('0x48')](db[_0x3e02('0xb9')][_0x3e02('0x43')]);_0x2f28c1['query']=_[_0x3e02('0x48')](_0x4ccc0d[_0x3e02('0x49')]);_0x2f28c1[_0x3e02('0x4a')]=_[_0x3e02('0x4c')](_0x2f28c1[_0x3e02('0x47')],_0x2f28c1[_0x3e02('0x49')]);_0x524534[_0x3e02('0x4b')]=_[_0x3e02('0x4c')](_0x2f28c1[_0x3e02('0x47')],qs['fields'](_0x4ccc0d[_0x3e02('0x49')][_0x3e02('0x4d')]));_0x524534[_0x3e02('0x4b')]=_0x524534['attributes'][_0x3e02('0x4e')]?_0x524534[_0x3e02('0x4b')]:_0x2f28c1[_0x3e02('0x47')];if(!_0x4ccc0d[_0x3e02('0x49')]['hasOwnProperty'](_0x3e02('0x6a'))){_0x524534[_0x3e02('0x2f')]=qs['limit'](_0x4ccc0d[_0x3e02('0x49')][_0x3e02('0x2f')]);_0x524534[_0x3e02('0x32')]=qs[_0x3e02('0x32')](_0x4ccc0d[_0x3e02('0x49')][_0x3e02('0x32')]);}_0x524534[_0x3e02('0x50')]=qs[_0x3e02('0x51')](_0x4ccc0d[_0x3e02('0x49')][_0x3e02('0x51')]);_0x524534[_0x3e02('0x52')]=qs[_0x3e02('0x4a')](_[_0x3e02('0x6b')](_0x4ccc0d[_0x3e02('0x49')],_0x2f28c1[_0x3e02('0x4a')]));_0x524534['where'][_0x3e02('0x66')]=_0x360818['id'];if(_0x4ccc0d[_0x3e02('0x49')]['filter']){_0x524534[_0x3e02('0x52')]=_[_0x3e02('0x54')](_0x524534[_0x3e02('0x52')],{'$or':_[_0x3e02('0x41')](_0x524534[_0x3e02('0x4b')],function(_0x33d473){var _0x1fb0de={};_0x1fb0de[_0x33d473]={'$like':'%'+_0x4ccc0d[_0x3e02('0x49')][_0x3e02('0x53')]+'%'};return _0x1fb0de;})});}_0x524534=_['merge']({},_0x524534,_0x4ccc0d[_0x3e02('0x56')]);return db[_0x3e02('0xb9')]['count']({'where':_0x524534['where']})[_0x3e02('0x22')](function(_0x25f0de){_0x4e055f[_0x3e02('0x31')]=_0x25f0de;if(_0x4ccc0d['query'][_0x3e02('0x5a')]){_0x524534['include']=[{'model':db[_0x3e02('0x90')],'as':_0x3e02('0xf4'),'required':![]},{'model':db['User'],'as':_0x3e02('0xf5'),'attributes':[_0x3e02('0x3d'),'fullname','internal'],'required':![]},{'model':db[_0x3e02('0xf6')],'as':_0x3e02('0xf7'),'attributes':['id',_0x3e02('0x3d'),'color'],'where':_0x4ccc0d[_0x3e02('0x49')][_0x3e02('0xf8')]?{'id':_0x4ccc0d['query'][_0x3e02('0xf8')]}:undefined,'required':_0x4ccc0d[_0x3e02('0x49')][_0x3e02('0xf8')]?!![]:![]}];}return db[_0x3e02('0xb9')]['findAll'](_0x524534);})[_0x3e02('0x22')](function(_0x30e44c){_0x4e055f[_0x3e02('0xf9')]=_0x30e44c;return _0x4e055f;});}})[_0x3e02('0x22')](respondWithFilteredResult(_0x5d7aff,_0x524534))['catch'](handleError(_0x5d7aff,null));};function iftimePromise(_0x2106d2,_0x223e08){return respondWithRpcPromise(_0x3e02('0xfa'),_0x3e02('0xfb'),{'command':_0x223e08[_0x3e02('0xfc')]?util[_0x3e02('0xb2')](_0x3e02('0xfd'),_0x2106d2['interval'],_0x223e08[_0x3e02('0xfc')]):util[_0x3e02('0xb2')]('iftime\x20%s',_0x2106d2[_0x3e02('0xfe')])},client9002)['then'](function(_0xe3f5b7){var _0x4b23af=_0xe3f5b7&&_0xe3f5b7[_0x3e02('0xff')](_0x3e02('0x100'))>=0x0?!![]:![];logger[_0x3e02('0x101')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x223e08['id'],_0x2106d2['id'],_0x2106d2[_0x3e02('0xfe')],_0x4b23af?_0x3e02('0x102'):_0x3e02('0x103'),_0x223e08['timezone']?_0x223e08[_0x3e02('0xfc')]:_0x3e02('0x104'));return _0x4b23af;})[_0x3e02('0x2b')](function(_0x264965){logger[_0x3e02('0x29')](_0x3e02('0x105'),_0x223e08['id'],_0x2106d2['id'],_0x2106d2[_0x3e02('0xfe')],util[_0x3e02('0x106')](_0x264965,{'showHidden':![],'depth':null}),_0x223e08[_0x3e02('0xfc')]?_0x223e08[_0x3e02('0xfc')]:_0x3e02('0x104'));return![];});}exports[_0x3e02('0xfb')]=function(_0x363a84,_0x4ab926,_0x3fe93a){var _0x1686a3=0x0;var _0x4098b7=0x0;var _0x3838c3=![];var _0x4c5e04;var _0x557eea;return db[_0x3e02('0x42')][_0x3e02('0x5b')]({'where':{'id':_0x363a84['params']['id']},'include':[{'model':db[_0x3e02('0x107')],'as':'Interval','include':[{'model':db[_0x3e02('0x107')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0x3e02('0x22')](handleEntityNotFound(_0x4ab926,null))[_0x3e02('0x22')](function(_0x4974e8){if(_0x4974e8){_0x4c5e04=_0x4974e8;return _0x4974e8['getProactiveActions']({'raw':!![]});}})[_0x3e02('0x22')](function(_0x5b6eb1){if(_0x4c5e04){if(_0x5b6eb1){_0x557eea=_0x5b6eb1;}}return require(_0x3e02('0x18'))[_0x3e02('0x7b')]();})['then'](function(_0x28de5c){if(_0x28de5c){_0x4098b7=_0x28de5c[_0x3e02('0x108')];_0x3838c3=_0x28de5c[_0x3e02('0x7c')];}})[_0x3e02('0x22')](function(){return db['ChatInteraction'][_0x3e02('0x31')]({'where':{'closed':![]}});})['then'](function(_0x311b4e){_0x1686a3=_0x311b4e;if(_0x4098b7&&_0x311b4e>_0x4098b7){return db[_0x3e02('0x109')][_0x3e02('0x69')]({'where':{'id':0x1}})['then'](function(_0x40ef2b){if(_0x40ef2b){_0x40ef2b[_0x3e02('0x10a')]('chatLicenseExceeded');}});}})[_0x3e02('0x22')](function(){if(_0x4c5e04[_0x3e02('0x107')]&&_0x4c5e04[_0x3e02('0x107')]['Intervals']){var _0x188c05=[];for(var _0x3360a9=0x0;_0x3360a9<_0x4c5e04['Interval'][_0x3e02('0x10b')][_0x3e02('0x4e')];_0x3360a9++){var _0x3d916a=_0x4c5e04[_0x3e02('0x107')][_0x3e02('0x10b')][_0x3360a9]['get']({'plain':!![]});_0x188c05[_0x3e02('0xbe')](iftimePromise(_0x3d916a,_0x4c5e04));}return BPromise[_0x3e02('0x10c')](_0x188c05)[_0x3e02('0x22')](function(_0x2ebf1b){return _[_0x3e02('0x10d')](_0x2ebf1b);});}else{return!![];}})['then'](function(_0x4a0b65){var _0x2c2636=fs['readFileSync'](path[_0x3e02('0x79')](config['root'],_0x3e02('0x10e')),_0x3e02('0xd3'));var _0x1dfbaf={'remote':_0x4c5e04[_0x3e02('0x10f')],'query':querystring[_0x3e02('0x27')](_[_0x3e02('0x54')](_0x4c5e04[_0x3e02('0x39')]({'plain':!![]}),{'customerIp':_0x363a84[_0x3e02('0x8c')]['x-forwarded-for']||_0x363a84[_0x3e02('0x8c')][_0x3e02('0x110')]||_0x363a84[_0x3e02('0x111')]['remoteAddress']||_0x363a84['ip'],'referer':_0x363a84[_0x3e02('0x8c')][_0x3e02('0xad')],'openedInteractions':_0x1686a3,'maxInteractions':_0x4098b7,'virtual':_0x3838c3['virtual'],'online':_0x4a0b65,'custom':_0x3838c3}))[_0x3e02('0x112')](/'/g,'\x5c\x27')};_0x4ab926['send'](ejs['render'](Mustache['render'](_0x2c2636,_0x1dfbaf),{'proactiveActions':_0x557eea,'alignment':_0x4c5e04[_0x3e02('0x113')],'verticalAlignment':_0x4c5e04[_0x3e02('0x114')],'div_color':_0x4c5e04[_0x3e02('0x115')],'text_color':_0x4c5e04['textColor'],'button_color':_0x4c5e04[_0x3e02('0x116')],'background_color':_0x4c5e04[_0x3e02('0x117')]}));})['catch'](handleError(_0x4ab926,null));};exports[_0x3e02('0x118')]=function(_0x207ddb,_0x15a8f3,_0x4cfc65){return db['ChatWebsite'][_0x3e02('0x69')]({'where':{'id':_0x207ddb[_0x3e02('0x59')]['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x15a8f3,null))[_0x3e02('0x22')](function(_0x3c7218){if(_0x3c7218){return db[_0x3e02('0xdb')][_0x3e02('0xdc')](function(_0xb65816){return db['ChatApplication'][_0x3e02('0x63')]({'where':{'ChatWebsiteId':_0x207ddb[_0x3e02('0x59')]['id']},'transaction':_0xb65816})[_0x3e02('0x22')](function(_0x5416ef){var _0x40869b=_[_0x3e02('0x41')](_0x207ddb[_0x3e02('0x5d')],function(_0x504599){_0x504599['ChatWebsiteId']=_0x207ddb[_0x3e02('0x59')]['id'];return _0x504599;});return db[_0x3e02('0x9d')][_0x3e02('0xdd')](_0x40869b,{'transaction':_0xb65816});});})[_0x3e02('0x22')](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x207ddb['params']['id']},'order':_0x3e02('0xa2')});});}})['then'](respondWithResult(_0x15a8f3,null))[_0x3e02('0x2b')](handleError(_0x15a8f3,null));};exports['getApplications']=function(_0x5ecd06,_0x30a3af,_0x40d92e){var _0x563b66={};var _0x383c54={};var _0x34a074;var _0x38e347;return db[_0x3e02('0x42')]['findOne']({'where':{'id':_0x5ecd06['params']['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x30a3af,null))[_0x3e02('0x22')](function(_0x1dae29){if(_0x1dae29){_0x34a074=_0x1dae29;_0x383c54['model']=_[_0x3e02('0x48')](db[_0x3e02('0x9d')][_0x3e02('0x43')]);_0x383c54[_0x3e02('0x49')]=_[_0x3e02('0x48')](_0x5ecd06[_0x3e02('0x49')]);_0x383c54[_0x3e02('0x4a')]=_['intersection'](_0x383c54[_0x3e02('0x47')],_0x383c54[_0x3e02('0x49')]);_0x563b66[_0x3e02('0x4b')]=_['intersection'](_0x383c54[_0x3e02('0x47')],qs[_0x3e02('0x4d')](_0x5ecd06[_0x3e02('0x49')][_0x3e02('0x4d')]));_0x563b66[_0x3e02('0x4b')]=_0x563b66[_0x3e02('0x4b')][_0x3e02('0x4e')]?_0x563b66[_0x3e02('0x4b')]:_0x383c54['model'];_0x563b66['order']=qs[_0x3e02('0x51')](_0x5ecd06[_0x3e02('0x49')]['sort']);_0x563b66[_0x3e02('0x52')]=qs['filters'](_[_0x3e02('0x6b')](_0x5ecd06['query'],_0x383c54[_0x3e02('0x4a')]));if(_0x5ecd06['query']['filter']){_0x563b66['where']=_[_0x3e02('0x54')](_0x563b66[_0x3e02('0x52')],{'$or':_[_0x3e02('0x41')](_0x563b66[_0x3e02('0x4b')],function(_0x5a2fb5){var _0x1318c0={};_0x1318c0[_0x5a2fb5]={'$like':'%'+_0x5ecd06[_0x3e02('0x49')][_0x3e02('0x53')]+'%'};return _0x1318c0;})});}_0x563b66=_[_0x3e02('0x54')]({},_0x563b66,_0x5ecd06[_0x3e02('0x56')]);return _0x34a074[_0x3e02('0x119')](_0x563b66);}})[_0x3e02('0x22')](function(_0x15af53){if(_0x15af53){_0x38e347=_0x15af53[_0x3e02('0x4e')];if(!_0x5ecd06['query'][_0x3e02('0x4f')](_0x3e02('0x6a'))){_0x563b66[_0x3e02('0x2f')]=qs[_0x3e02('0x2f')](_0x5ecd06[_0x3e02('0x49')][_0x3e02('0x2f')]);_0x563b66[_0x3e02('0x32')]=qs['offset'](_0x5ecd06[_0x3e02('0x49')]['offset']);}return _0x34a074[_0x3e02('0x119')](_0x563b66);}})[_0x3e02('0x22')](function(_0x920b73){if(_0x920b73){return _0x920b73?{'count':_0x38e347,'rows':_0x920b73}:null;}})['then'](respondWithResult(_0x30a3af,null))[_0x3e02('0x2b')](handleError(_0x30a3af,null));};exports['addProactiveActions']=function(_0x1f8eac,_0x3a6aa5,_0x5e5b60){return db['chatProactiveAction'][_0x3e02('0x5b')]({'where':{'id':_0x1f8eac['params']['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x3a6aa5,null))[_0x3e02('0x22')](function(_0x2f3535){if(_0x2f3535){return _0x2f3535[_0x3e02('0x11a')](_0x1f8eac[_0x3e02('0x5d')]['ids'],_[_0x3e02('0xf2')](_0x1f8eac['body'],[_0x3e02('0x6e'),'id'])||{});}})[_0x3e02('0x22')](respondWithResult(_0x3a6aa5,null))[_0x3e02('0x2b')](handleError(_0x3a6aa5,null));};exports[_0x3e02('0x11b')]=function(_0xae08c1,_0x1add77,_0x20ca2e){var _0x11b978={};var _0x2134ed={};var _0x5b96d2;var _0x44d63a;return db[_0x3e02('0x42')][_0x3e02('0x69')]({'where':{'id':_0xae08c1['params']['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x1add77,null))[_0x3e02('0x22')](function(_0x296bdd){if(_0x296bdd){_0x5b96d2=_0x296bdd;_0x2134ed['model']=_[_0x3e02('0x48')](db[_0x3e02('0x11c')][_0x3e02('0x43')]);_0x2134ed[_0x3e02('0x49')]=_['keys'](_0xae08c1[_0x3e02('0x49')]);_0x2134ed[_0x3e02('0x4a')]=_['intersection'](_0x2134ed[_0x3e02('0x47')],_0x2134ed[_0x3e02('0x49')]);_0x11b978[_0x3e02('0x4b')]=_[_0x3e02('0x4c')](_0x2134ed[_0x3e02('0x47')],qs[_0x3e02('0x4d')](_0xae08c1[_0x3e02('0x49')][_0x3e02('0x4d')]));_0x11b978[_0x3e02('0x4b')]=_0x11b978[_0x3e02('0x4b')][_0x3e02('0x4e')]?_0x11b978[_0x3e02('0x4b')]:_0x2134ed[_0x3e02('0x47')];_0x11b978[_0x3e02('0x50')]=qs['sort'](_0xae08c1['query'][_0x3e02('0x51')]);_0x11b978[_0x3e02('0x52')]=qs[_0x3e02('0x4a')](_[_0x3e02('0x6b')](_0xae08c1[_0x3e02('0x49')],_0x2134ed[_0x3e02('0x4a')]));if(_0xae08c1[_0x3e02('0x49')][_0x3e02('0x53')]){_0x11b978[_0x3e02('0x52')]=_[_0x3e02('0x54')](_0x11b978[_0x3e02('0x52')],{'$or':_[_0x3e02('0x41')](_0x11b978[_0x3e02('0x4b')],function(_0x433de2){var _0x54748f={};_0x54748f[_0x433de2]={'$like':'%'+_0xae08c1[_0x3e02('0x49')][_0x3e02('0x53')]+'%'};return _0x54748f;})});}_0x11b978=_[_0x3e02('0x54')]({},_0x11b978,_0xae08c1[_0x3e02('0x56')]);return _0x5b96d2[_0x3e02('0x11b')](_0x11b978);}})[_0x3e02('0x22')](function(_0x4fb005){if(_0x4fb005){_0x44d63a=_0x4fb005[_0x3e02('0x4e')];if(!_0xae08c1['query'][_0x3e02('0x4f')]('nolimit')){_0x11b978[_0x3e02('0x2f')]=qs[_0x3e02('0x2f')](_0xae08c1[_0x3e02('0x49')][_0x3e02('0x2f')]);_0x11b978[_0x3e02('0x32')]=qs[_0x3e02('0x32')](_0xae08c1['query']['offset']);}return _0x5b96d2[_0x3e02('0x11b')](_0x11b978);}})[_0x3e02('0x22')](function(_0x3bbd13){if(_0x3bbd13){return _0x3bbd13?{'count':_0x44d63a,'rows':_0x3bbd13}:null;}})['then'](respondWithResult(_0x1add77,null))[_0x3e02('0x2b')](handleError(_0x1add77,null));};exports['getFields']=function(_0x56c5ba,_0x3d8816,_0x23c89f){var _0x1d5146=_0x56c5ba[_0x3e02('0x49')]['online']===_0x3e02('0x11d')?_0x3e02('0x11e'):'onlineForm';return db[_0x3e02('0x42')][_0x3e02('0x5b')]({'attributes':['id',_0x1d5146],'where':{'id':_0x56c5ba[_0x3e02('0x59')]['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x3d8816,null))[_0x3e02('0x22')](function(_0x39b91f){if(_0x39b91f){var _0x2efcc0=_0x39b91f[_0x1d5146];var _0x5431a8=_0x2efcc0&&_0x2efcc0[_0x3e02('0x11f')]?_0x2efcc0[_0x3e02('0x11f')]:[];_0x3d8816[_0x3e02('0x3e')]({'fromKey':_['isNil'](_0x2efcc0[_0x3e02('0x120')])?undefined:_0x2efcc0[_0x3e02('0x120')],'count':_0x5431a8[_0x3e02('0x4e')],'rows':_0x5431a8});}})[_0x3e02('0x2b')](handleError(_0x3d8816,null));};exports[_0x3e02('0x121')]=function(_0x3a332a,_0x41d51f,_0x585c01){var _0x4306c7={'raw':![],'where':{}};var _0x5e6f26={};var _0x59588e={'count':0x0,'rows':[]};return db[_0x3e02('0x42')][_0x3e02('0x69')]({'where':{'id':_0x3a332a['params']['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x41d51f,null))[_0x3e02('0x22')](function(_0x1f11dd){if(_0x1f11dd){_0x5e6f26[_0x3e02('0x47')]=_[_0x3e02('0x48')](db['ChatOfflineMessage'][_0x3e02('0x43')]);_0x5e6f26['query']=_[_0x3e02('0x48')](_0x3a332a[_0x3e02('0x49')]);_0x5e6f26[_0x3e02('0x4a')]=_[_0x3e02('0x4c')](_0x5e6f26[_0x3e02('0x47')],_0x5e6f26['query']);_0x4306c7[_0x3e02('0x4b')]=_[_0x3e02('0x4c')](_0x5e6f26[_0x3e02('0x47')],qs[_0x3e02('0x4d')](_0x3a332a[_0x3e02('0x49')]['fields']));_0x4306c7[_0x3e02('0x4b')]=_0x4306c7[_0x3e02('0x4b')][_0x3e02('0x4e')]?_0x4306c7[_0x3e02('0x4b')]:_0x5e6f26[_0x3e02('0x47')];if(!_0x3a332a['query'][_0x3e02('0x4f')]('nolimit')){_0x4306c7['limit']=qs['limit'](_0x3a332a[_0x3e02('0x49')]['limit']);_0x4306c7[_0x3e02('0x32')]=qs[_0x3e02('0x32')](_0x3a332a['query'][_0x3e02('0x32')]);}_0x4306c7[_0x3e02('0x50')]=qs[_0x3e02('0x51')](_0x3a332a[_0x3e02('0x49')][_0x3e02('0x51')]);_0x4306c7[_0x3e02('0x52')]=qs['filters'](_['pick'](_0x3a332a[_0x3e02('0x49')],_0x5e6f26[_0x3e02('0x4a')]));_0x4306c7['where'][_0x3e02('0x66')]=_0x1f11dd['id'];if(_0x3a332a[_0x3e02('0x49')][_0x3e02('0x53')]){_0x4306c7[_0x3e02('0x52')]=_['merge'](_0x4306c7['where'],{'$or':_[_0x3e02('0x41')](_0x4306c7['attributes'],function(_0x4d8bd3){var _0x3a1212={};_0x3a1212[_0x4d8bd3]={'$like':'%'+_0x3a332a['query'][_0x3e02('0x53')]+'%'};return _0x3a1212;})});}_0x4306c7=_[_0x3e02('0x54')]({},_0x4306c7,_0x3a332a[_0x3e02('0x56')]);return db[_0x3e02('0xd6')][_0x3e02('0x31')]({'where':_0x4306c7[_0x3e02('0x52')]})[_0x3e02('0x22')](function(_0x3d045c){_0x59588e['count']=_0x3d045c;if(_0x3a332a['query']['includeAll']){_0x4306c7[_0x3e02('0x57')]=[{'all':!![]}];}else{_0x4306c7[_0x3e02('0x57')]=[{'model':db[_0x3e02('0x90')],'as':_0x3e02('0xf4'),'required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage'][_0x3e02('0x6c')](_0x4306c7);})[_0x3e02('0x22')](function(_0x17c996){_0x59588e[_0x3e02('0xf9')]=_0x17c996;return _0x59588e;});}})['then'](respondWithFilteredResult(_0x41d51f,_0x4306c7))['catch'](handleError(_0x41d51f,null));};exports[_0x3e02('0x122')]=function(_0x12e848,_0x1bd90f,_0x5405a2){return db[_0x3e02('0x42')][_0x3e02('0x5b')]({'where':{'id':_0x12e848[_0x3e02('0x59')]['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x1bd90f,null))[_0x3e02('0x22')](function(_0x378982){if(_0x378982){return _0x378982[_0x3e02('0x122')](_0x12e848[_0x3e02('0x5d')][_0x3e02('0x6e')],_['omit'](_0x12e848['body'],[_0x3e02('0x6e'),'id'])||{})[_0x3e02('0xba')](function(_0x516281){for(var _0x1459b1=0x0;_0x1459b1<_0x12e848[_0x3e02('0x5d')][_0x3e02('0x6e')]['length'];_0x1459b1+=0x1){socket[_0x3e02('0x123')](_0x3e02('0x124'),{'UserId':Number(_0x12e848[_0x3e02('0x5d')][_0x3e02('0x6e')][_0x1459b1]),'ChatWebsiteId':Number(_0x12e848[_0x3e02('0x59')]['id'])});}return _0x516281;});}})[_0x3e02('0x22')](respondWithResult(_0x1bd90f,null))[_0x3e02('0x2b')](handleError(_0x1bd90f,null));};exports[_0x3e02('0x125')]=function(_0x41c577,_0x26ad6e,_0x12e47a){return db['ChatWebsite']['find']({'where':{'id':_0x41c577[_0x3e02('0x59')]['id']}})['then'](handleEntityNotFound(_0x26ad6e,null))[_0x3e02('0x22')](function(_0x128e12){if(_0x128e12){return _0x128e12[_0x3e02('0x125')](_0x41c577[_0x3e02('0x49')][_0x3e02('0x6e')])[_0x3e02('0x22')](function(){if(_['isArray'](_0x41c577[_0x3e02('0x49')][_0x3e02('0x6e')])){for(var _0x41541f=0x0;_0x41541f<_0x41c577['query']['ids']['length'];_0x41541f+=0x1){socket[_0x3e02('0x123')](_0x3e02('0x126'),{'UserId':Number(_0x41c577[_0x3e02('0x49')][_0x3e02('0x6e')][_0x41541f]),'ChatWebsiteId':Number(_0x41c577[_0x3e02('0x59')]['id'])});}}else{socket[_0x3e02('0x123')](_0x3e02('0x126'),{'UserId':Number(_0x41c577[_0x3e02('0x49')]['ids']),'ChatWebsiteId':Number(_0x41c577['params']['id'])});}});}})[_0x3e02('0x22')](respondWithStatusCode(_0x26ad6e,null))[_0x3e02('0x2b')](handleError(_0x26ad6e,null));};exports['getAgents']=function(_0x14f538,_0x4f3f47,_0x39b0bb){var _0x1bc281={};var _0x29dc1e={};var _0xa041c2;var _0x54fcd4;return db['ChatWebsite'][_0x3e02('0x69')]({'where':{'id':_0x14f538[_0x3e02('0x59')]['id']}})[_0x3e02('0x22')](handleEntityNotFound(_0x4f3f47,null))[_0x3e02('0x22')](function(_0x157ed9){if(_0x157ed9){_0xa041c2=_0x157ed9;_0x29dc1e[_0x3e02('0x47')]=_[_0x3e02('0x48')](db['User'][_0x3e02('0x43')]);_0x29dc1e[_0x3e02('0x49')]=_[_0x3e02('0x48')](_0x14f538[_0x3e02('0x49')]);_0x29dc1e[_0x3e02('0x4a')]=_[_0x3e02('0x4c')](_0x29dc1e[_0x3e02('0x47')],_0x29dc1e[_0x3e02('0x49')]);_0x1bc281['attributes']=_[_0x3e02('0x4c')](_0x29dc1e[_0x3e02('0x47')],qs[_0x3e02('0x4d')](_0x14f538[_0x3e02('0x49')]['fields']));_0x1bc281[_0x3e02('0x4b')]=_0x1bc281[_0x3e02('0x4b')][_0x3e02('0x4e')]?_0x1bc281[_0x3e02('0x4b')]:_0x29dc1e[_0x3e02('0x47')];_0x1bc281[_0x3e02('0x50')]=qs[_0x3e02('0x51')](_0x14f538[_0x3e02('0x49')][_0x3e02('0x51')]);_0x1bc281[_0x3e02('0x52')]=qs[_0x3e02('0x4a')](_[_0x3e02('0x6b')](_0x14f538[_0x3e02('0x49')],_0x29dc1e[_0x3e02('0x4a')]));if(_0x14f538[_0x3e02('0x49')][_0x3e02('0x53')]){_0x1bc281[_0x3e02('0x52')]=_[_0x3e02('0x54')](_0x1bc281[_0x3e02('0x52')],{'$or':_[_0x3e02('0x41')](_0x1bc281[_0x3e02('0x4b')],function(_0x3ad79c){var _0x551de0={};_0x551de0[_0x3ad79c]={'$like':'%'+_0x14f538[_0x3e02('0x49')]['filter']+'%'};return _0x551de0;})});}_0x1bc281=_[_0x3e02('0x54')]({},_0x1bc281,_0x14f538[_0x3e02('0x56')]);return _0xa041c2[_0x3e02('0x127')](_0x1bc281);}})[_0x3e02('0x22')](function(_0x19a99d){if(_0x19a99d){_0x54fcd4=_0x19a99d['length'];if(!_0x14f538[_0x3e02('0x49')]['hasOwnProperty']('nolimit')){_0x1bc281[_0x3e02('0x2f')]=qs['limit'](_0x14f538['query'][_0x3e02('0x2f')]);_0x1bc281[_0x3e02('0x32')]=qs[_0x3e02('0x32')](_0x14f538[_0x3e02('0x49')][_0x3e02('0x32')]);}return _0xa041c2[_0x3e02('0x127')](_0x1bc281);}})['then'](function(_0x161631){if(_0x161631){return _0x161631?{'count':_0x54fcd4,'rows':_0x161631}:null;}})[_0x3e02('0x22')](respondWithResult(_0x4f3f47,null))[_0x3e02('0x2b')](handleError(_0x4f3f47,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 9d7ca66..2abb6d7 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 _0x3148=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x19f28e,_0x479808){var _0x5b609a=function(_0x48e422){while(--_0x48e422){_0x19f28e['push'](_0x19f28e['shift']());}};_0x5b609a(++_0x479808);}(_0x3148,0x1d3));var _0x8314=function(_0x461f41,_0x405481){_0x461f41=_0x461f41-0x0;var _0x22c772=_0x3148[_0x461f41];return _0x22c772;};'use strict';var EventEmitter=require(_0x8314('0x0'));var ChatWebsite=require(_0x8314('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8314('0x2')](0x0);var events={'afterCreate':_0x8314('0x3'),'afterUpdate':_0x8314('0x4'),'afterDestroy':_0x8314('0x5')};function emitEvent(_0x58f818){return function(_0x35ee55,_0x41e9fd,_0x62c506){ChatWebsiteEvents[_0x8314('0x6')](_0x58f818+':'+_0x35ee55['id'],_0x35ee55);ChatWebsiteEvents[_0x8314('0x6')](_0x58f818,_0x35ee55);_0x62c506(null);};}for(var e in events){if(events[_0x8314('0x7')](e)){var event=events[e];ChatWebsite[_0x8314('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xb91a=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatWebsite','update'];(function(_0x319807,_0x5ac442){var _0x270e1a=function(_0x592fc1){while(--_0x592fc1){_0x319807['push'](_0x319807['shift']());}};_0x270e1a(++_0x5ac442);}(_0xb91a,0xf4));var _0xab91=function(_0x32d602,_0x2e4e3d){_0x32d602=_0x32d602-0x0;var _0x121e2f=_0xb91a[_0x32d602];return _0x121e2f;};'use strict';var EventEmitter=require(_0xab91('0x0'));var ChatWebsite=require(_0xab91('0x1'))['db'][_0xab91('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xab91('0x3'),'afterDestroy':_0xab91('0x4')};function emitEvent(_0xb312db){return function(_0x439eb2,_0x1afca9,_0x30e4ce){ChatWebsiteEvents[_0xab91('0x5')](_0xb312db+':'+_0x439eb2['id'],_0x439eb2);ChatWebsiteEvents[_0xab91('0x5')](_0xb312db,_0x439eb2);_0x30e4ce(null);};}for(var e in events){if(events[_0xab91('0x6')](e)){var event=events[e];ChatWebsite[_0xab91('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 5354ae8..1a0c3fa 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 _0x8e6a=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash'];(function(_0x4e889b,_0x12dcb2){var _0x1ab442=function(_0x107a9f){while(--_0x107a9f){_0x4e889b['push'](_0x4e889b['shift']());}};_0x1ab442(++_0x12dcb2);}(_0x8e6a,0xcb));var _0xa8e6=function(_0x57ac07,_0x2a94d1){_0x57ac07=_0x57ac07-0x0;var _0x467816=_0x8e6a[_0x57ac07];return _0x467816;};'use strict';var _=require(_0xa8e6('0x0'));var util=require(_0xa8e6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa8e6('0x2'));var BPromise=require(_0xa8e6('0x3'));var rp=require(_0xa8e6('0x4'));var fs=require('fs');var path=require(_0xa8e6('0x5'));var rimraf=require(_0xa8e6('0x6'));var config=require(_0xa8e6('0x7'));var attributes=require(_0xa8e6('0x8'));module['exports']=function(_0x17e959,_0x235aaf){return _0x17e959[_0xa8e6('0x9')](_0xa8e6('0xa'),attributes,{'tableName':_0xa8e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0afb=['../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','lodash','../../config/logger','api','moment','path','rimraf'];(function(_0x4c9764,_0xf767b4){var _0x272af7=function(_0x58387b){while(--_0x58387b){_0x4c9764['push'](_0x4c9764['shift']());}};_0x272af7(++_0xf767b4);}(_0x0afb,0x165));var _0xb0af=function(_0x3c0253,_0x3bb454){_0x3c0253=_0x3c0253-0x0;var _0x39ec2b=_0x0afb[_0x3c0253];return _0x39ec2b;};'use strict';var _=require(_0xb0af('0x0'));var util=require('util');var logger=require(_0xb0af('0x1'))(_0xb0af('0x2'));var moment=require(_0xb0af('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb0af('0x4'));var rimraf=require(_0xb0af('0x5'));var config=require(_0xb0af('0x6'));var attributes=require(_0xb0af('0x7'));module[_0xb0af('0x8')]=function(_0x356d2f,_0x2a987e){return _0x356d2f[_0xb0af('0x9')]('ChatWebsite',attributes,{'tableName':_0xb0af('0xa'),'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 cb37dc7..c6b5f20 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 _0x5b0d=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5b0d,0x14c));var _0xd5b0=function(_0x361190,_0x4da5cd){_0x361190=_0x361190-0x0;var _0xc4c00c=_0x5b0d[_0x361190];return _0xc4c00c;};'use strict';var _=require(_0xd5b0('0x0'));var util=require('util');var moment=require(_0xd5b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xd5b0('0x2'));var fs=require('fs');var Redis=require(_0xd5b0('0x3'));var db=require(_0xd5b0('0x4'))['db'];var utils=require(_0xd5b0('0x5'));var logger=require('../../config/logger')(_0xd5b0('0x6'));var config=require(_0xd5b0('0x7'));var jayson=require(_0xd5b0('0x8'));var client=jayson[_0xd5b0('0x9')][_0xd5b0('0xa')]({'port':0x232a});config[_0xd5b0('0xb')]=_[_0xd5b0('0xc')](config['redis'],{'host':_0xd5b0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd5b0('0xb')]));require(_0xd5b0('0xe'))['register'](socket);function respondWithRpcPromise(_0x4febe1,_0x5bf744,_0x462797){return new BPromise(function(_0x235580,_0x2d7b34){return client[_0xd5b0('0xf')](_0x4febe1,_0x462797)[_0xd5b0('0x10')](function(_0x2ce541){logger[_0xd5b0('0x11')](_0xd5b0('0x12'),_0x5bf744,_0xd5b0('0x13'));logger['debug'](_0xd5b0('0x14'),_0x5bf744,_0xd5b0('0x13'),JSON[_0xd5b0('0x15')](_0x2ce541));if(_0x2ce541[_0xd5b0('0x16')]){if(_0x2ce541[_0xd5b0('0x16')][_0xd5b0('0x17')]===0x1f4){logger['error'](_0xd5b0('0x12'),_0x5bf744,_0x2ce541[_0xd5b0('0x16')][_0xd5b0('0x18')]);return _0x2d7b34(_0x2ce541[_0xd5b0('0x16')][_0xd5b0('0x18')]);}logger[_0xd5b0('0x16')](_0xd5b0('0x12'),_0x5bf744,_0x2ce541[_0xd5b0('0x16')][_0xd5b0('0x18')]);return _0x235580(_0x2ce541['error'][_0xd5b0('0x18')]);}else{logger['info'](_0xd5b0('0x12'),_0x5bf744,'request\x20sent');_0x235580(_0x2ce541['result'][_0xd5b0('0x18')]);}})[_0xd5b0('0x19')](function(_0x3fa9fc){logger['error'](_0xd5b0('0x12'),_0x5bf744,_0x3fa9fc);_0x2d7b34(_0x3fa9fc);});});} \ No newline at end of file +var _0xc4a2=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./chatWebsite.socket','register','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x2e6108,_0xbb950c){var _0x476d4f=function(_0x423b11){while(--_0x423b11){_0x2e6108['push'](_0x2e6108['shift']());}};_0x476d4f(++_0xbb950c);}(_0xc4a2,0x1ba));var _0x2c4a=function(_0x9c6422,_0x38df84){_0x9c6422=_0x9c6422-0x0;var _0x8e037b=_0xc4a2[_0x9c6422];return _0x8e037b;};'use strict';var _=require(_0x2c4a('0x0'));var util=require('util');var moment=require(_0x2c4a('0x1'));var BPromise=require(_0x2c4a('0x2'));var rs=require(_0x2c4a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c4a('0x4'))['db'];var utils=require(_0x2c4a('0x5'));var logger=require(_0x2c4a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2c4a('0x7'));var client=jayson[_0x2c4a('0x8')]['http']({'port':0x232a});config['redis']=_[_0x2c4a('0x9')](config['redis'],{'host':_0x2c4a('0xa'),'port':0x18eb});var socket=require(_0x2c4a('0xb'))(new Redis(config[_0x2c4a('0xc')]));require(_0x2c4a('0xd'))[_0x2c4a('0xe')](socket);function respondWithRpcPromise(_0x45c229,_0x14893e,_0x435795){return new BPromise(function(_0x57d38f,_0x5d14bd){return client[_0x2c4a('0xf')](_0x45c229,_0x435795)['then'](function(_0x3ffbeb){logger['info'](_0x2c4a('0x10'),_0x14893e,_0x2c4a('0x11'));logger[_0x2c4a('0x12')](_0x2c4a('0x13'),_0x14893e,_0x2c4a('0x11'),JSON[_0x2c4a('0x14')](_0x3ffbeb));if(_0x3ffbeb[_0x2c4a('0x15')]){if(_0x3ffbeb[_0x2c4a('0x15')]['code']===0x1f4){logger[_0x2c4a('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x14893e,_0x3ffbeb['error'][_0x2c4a('0x16')]);return _0x5d14bd(_0x3ffbeb['error']['message']);}logger['error'](_0x2c4a('0x10'),_0x14893e,_0x3ffbeb[_0x2c4a('0x15')][_0x2c4a('0x16')]);return _0x57d38f(_0x3ffbeb['error'][_0x2c4a('0x16')]);}else{logger[_0x2c4a('0x17')](_0x2c4a('0x10'),_0x14893e,'request\x20sent');_0x57d38f(_0x3ffbeb[_0x2c4a('0x18')][_0x2c4a('0x16')]);}})[_0x2c4a('0x19')](function(_0x17a9f8){logger[_0x2c4a('0x15')](_0x2c4a('0x10'),_0x14893e,_0x17a9f8);_0x5d14bd(_0x17a9f8);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 02b11de..1a08192 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 _0x5248=['emit','register','length','chatWebsite:','./chatWebsite.events','remove'];(function(_0x200fc2,_0x3560d5){var _0x462bdd=function(_0x50c746){while(--_0x50c746){_0x200fc2['push'](_0x200fc2['shift']());}};_0x462bdd(++_0x3560d5);}(_0x5248,0xf4));var _0x8524=function(_0x4a882d,_0x563b7e){_0x4a882d=_0x4a882d-0x0;var _0x1cf18c=_0x5248[_0x4a882d];return _0x1cf18c;};'use strict';var ChatWebsiteEvents=require(_0x8524('0x0'));var events=['save',_0x8524('0x1'),'update'];function createListener(_0x1bcf6c,_0x571bb8){return function(_0x13cfc8){_0x571bb8[_0x8524('0x2')](_0x1bcf6c,_0x13cfc8);};}function removeListener(_0x3bffa6,_0x307f89){return function(){ChatWebsiteEvents['removeListener'](_0x3bffa6,_0x307f89);};}exports[_0x8524('0x3')]=function(_0x3cc6c9){for(var _0x2821dd=0x0,_0x2f0f1c=events[_0x8524('0x4')];_0x2821dd<_0x2f0f1c;_0x2821dd++){var _0x3d28be=events[_0x2821dd];var _0x855337=createListener(_0x8524('0x5')+_0x3d28be,_0x3cc6c9);ChatWebsiteEvents['on'](_0x3d28be,_0x855337);}}; \ No newline at end of file +var _0x79b9=['./chatWebsite.events','save','remove','update','emit','removeListener','register','length','chatWebsite:'];(function(_0x6aad74,_0x32ecf4){var _0x5b1c38=function(_0x567477){while(--_0x567477){_0x6aad74['push'](_0x6aad74['shift']());}};_0x5b1c38(++_0x32ecf4);}(_0x79b9,0x195));var _0x979b=function(_0x2a3a18,_0x438fbf){_0x2a3a18=_0x2a3a18-0x0;var _0x5620f5=_0x79b9[_0x2a3a18];return _0x5620f5;};'use strict';var ChatWebsiteEvents=require(_0x979b('0x0'));var events=[_0x979b('0x1'),_0x979b('0x2'),_0x979b('0x3')];function createListener(_0x33eec5,_0x39e95c){return function(_0x22fc0a){_0x39e95c[_0x979b('0x4')](_0x33eec5,_0x22fc0a);};}function removeListener(_0xa6f558,_0x394e29){return function(){ChatWebsiteEvents[_0x979b('0x5')](_0xa6f558,_0x394e29);};}exports[_0x979b('0x6')]=function(_0x206e3b){for(var _0x398ec1=0x0,_0x1f4309=events[_0x979b('0x7')];_0x398ec1<_0x1f4309;_0x398ec1++){var _0x40f9c7=events[_0x398ec1];var _0x2cf2c6=createListener(_0x979b('0x8')+_0x40f9c7,_0x206e3b);ChatWebsiteEvents['on'](_0x40f9c7,_0x2cf2c6);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 813c945..2ce6521 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 _0x2f29=['put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','getOfflineMessages','/:id/users','create','post','addAnswer','diskStorage','join','root','server/files/images/logos/','%s-%s','originalname','/:id/logo','file','addLogo','server/files/images/avatars/','format','now','single','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','addAgents'];(function(_0x5953d9,_0x1e903c){var _0x50a511=function(_0x5613d4){while(--_0x5613d4){_0x5953d9['push'](_0x5953d9['shift']());}};_0x50a511(++_0x1e903c);}(_0x2f29,0x1ca));var _0x92f2=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x2f29[_0x4fbfd9];return _0x31dc94;};'use strict';var multer=require('multer');var util=require(_0x92f2('0x0'));var path=require(_0x92f2('0x1'));var timeout=require('connect-timeout');var express=require(_0x92f2('0x2'));var router=express[_0x92f2('0x3')]();var fs_extra=require(_0x92f2('0x4'));var auth=require(_0x92f2('0x5'));var interaction=require(_0x92f2('0x6'));var config=require(_0x92f2('0x7'));var controller=require('./chatWebsite.controller');router[_0x92f2('0x8')]('/',auth[_0x92f2('0x9')](),controller[_0x92f2('0xa')]);router[_0x92f2('0x8')](_0x92f2('0xb'),auth['isAuthenticated'](),controller[_0x92f2('0xc')]);router['get']('/:id',auth[_0x92f2('0x9')](),controller['show']);router[_0x92f2('0x8')](_0x92f2('0xd'),auth[_0x92f2('0x9')](),controller[_0x92f2('0xe')]);router['get'](_0x92f2('0xf'),auth[_0x92f2('0x9')](),controller[_0x92f2('0x10')]);router[_0x92f2('0x8')]('/:id/logo',controller[_0x92f2('0x11')]);router[_0x92f2('0x8')](_0x92f2('0x12'),controller[_0x92f2('0x13')]);router[_0x92f2('0x8')](_0x92f2('0x14'),controller[_0x92f2('0x15')]);router[_0x92f2('0x8')](_0x92f2('0x16'),controller['getSystemAvatar']);router[_0x92f2('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x92f2('0x17')]);router[_0x92f2('0x8')](_0x92f2('0x18'),controller[_0x92f2('0x19')]);router[_0x92f2('0x8')](_0x92f2('0x1a'),auth[_0x92f2('0x9')](),controller[_0x92f2('0x1b')]);router['get'](_0x92f2('0x1c'),auth[_0x92f2('0x9')](),controller['getProactiveActions']);router[_0x92f2('0x8')](_0x92f2('0x1d'),controller[_0x92f2('0x1e')]);router[_0x92f2('0x8')]('/:id/offline_messages',auth[_0x92f2('0x9')](),controller[_0x92f2('0x1f')]);router[_0x92f2('0x8')](_0x92f2('0x20'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x92f2('0x21')]);router[_0x92f2('0x22')](_0x92f2('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x92f2('0xf'),auth[_0x92f2('0x9')](),controller[_0x92f2('0x23')]);var upload=multer({'storage':multer[_0x92f2('0x24')]({'destination':function(_0x345402,_0x251d5f,_0x59c754){_0x59c754(null,path[_0x92f2('0x25')](config[_0x92f2('0x26')],_0x92f2('0x27')));},'filename':function(_0x50dc19,_0x2e48c3,_0x2b2837){_0x2b2837(null,util['format'](_0x92f2('0x28'),Date['now'](),_0x2e48c3[_0x92f2('0x29')]));}})});router['post'](_0x92f2('0x2a'),upload['single'](_0x92f2('0x2b')),controller[_0x92f2('0x2c')]);var upload=multer({'storage':multer[_0x92f2('0x24')]({'destination':function(_0x134e9f,_0xcbb56c,_0xe6db7b){_0xe6db7b(null,path['join'](config['root'],_0x92f2('0x2d')));},'filename':function(_0x3484f9,_0x16af94,_0x33372f){_0x33372f(null,util[_0x92f2('0x2e')](_0x92f2('0x28'),Date[_0x92f2('0x2f')](),_0x16af94[_0x92f2('0x29')]));}})});router[_0x92f2('0x22')]('/:id/avatar',upload[_0x92f2('0x30')](_0x92f2('0x2b')),controller[_0x92f2('0x31')]);var upload=multer({'storage':multer[_0x92f2('0x24')]({'destination':function(_0x3211c1,_0x1f32f9,_0x17109a){_0x17109a(null,path[_0x92f2('0x25')](config[_0x92f2('0x26')],_0x92f2('0x2d')));},'filename':function(_0x2004d7,_0x3ea398,_0xa38d0b){_0xa38d0b(null,util[_0x92f2('0x2e')](_0x92f2('0x28'),Date['now'](),_0x3ea398['originalname']));}})});router[_0x92f2('0x22')]('/:id/customer_avatar',upload[_0x92f2('0x30')]('file'),controller[_0x92f2('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5c1d4d,_0x29ff95,_0xf69435){_0xf69435(null,path[_0x92f2('0x25')](config['root'],_0x92f2('0x2d')));},'filename':function(_0x4c112d,_0x597b77,_0x2d4aa1){_0x2d4aa1(null,util[_0x92f2('0x2e')]('%s-%s',Date[_0x92f2('0x2f')](),_0x597b77['originalname']));}})});router['post'](_0x92f2('0x16'),upload[_0x92f2('0x30')](_0x92f2('0x2b')),controller[_0x92f2('0x33')]);router[_0x92f2('0x22')](_0x92f2('0x34'),controller[_0x92f2('0x35')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x506d70,_0x3d3ed7,_0x10e3a3){const _0x134408=path[_0x92f2('0x25')](config[_0x92f2('0x26')],_0x92f2('0x36'),_0x92f2('0x37'),_0x92f2('0x38'));fs_extra[_0x92f2('0x39')](_0x134408,function(){_0x10e3a3(null,_0x134408);});},'filename':function(_0x1cd706,_0x498322,_0x3a30ef){const _0x2df6b5=_0x498322[_0x92f2('0x29')][_0x92f2('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x142490=path[_0x92f2('0x3b')](_0x2df6b5);const _0x5fd8b1=Date[_0x92f2('0x2f')]()+'-'+_0x2df6b5['replace'](_0x142490,'')+_0x142490;_0x3a30ef(null,_0x5fd8b1);}})});router[_0x92f2('0x22')](_0x92f2('0x3c'),offlineUploadMulter[_0x92f2('0x3d')](),controller[_0x92f2('0x3e')]);router['post'](_0x92f2('0x3f'),auth[_0x92f2('0x9')](),controller[_0x92f2('0x40')]);router[_0x92f2('0x22')]('/:id/applications',auth[_0x92f2('0x9')](),controller[_0x92f2('0x41')]);router[_0x92f2('0x22')]('/:id/proactive_actions',auth[_0x92f2('0x9')](),controller['addProactiveActions']);router[_0x92f2('0x22')](_0x92f2('0x20'),auth['isAuthenticated'](),controller[_0x92f2('0x42')]);router[_0x92f2('0x43')]('/:id',auth[_0x92f2('0x9')](),controller[_0x92f2('0x44')]);router[_0x92f2('0x45')]('/:id',auth[_0x92f2('0x9')](),controller[_0x92f2('0x46')]);router[_0x92f2('0x45')]('/:id/dispositions',auth[_0x92f2('0x9')](),controller[_0x92f2('0x47')]);router[_0x92f2('0x45')](_0x92f2('0xf'),auth[_0x92f2('0x9')](),controller[_0x92f2('0x48')]);router[_0x92f2('0x45')](_0x92f2('0x20'),auth[_0x92f2('0x9')](),controller[_0x92f2('0x49')]);module[_0x92f2('0x4a')]=router; \ No newline at end of file +var _0x4490=['/:id/customer_avatar','addCustomerAvatar','server/files/images/avatars/','/:id/notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','/:id/canned_answers','removeAnswers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/logo','getLogo','/:id/avatar','getCustomerAvatar','getInteractions','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','create','post','addDisposition','addAnswer','diskStorage','root','%s-%s','now','single','file','addLogo','join','format','originalname','addAvatar'];(function(_0x5f4b06,_0x3e5997){var _0x55cc05=function(_0x1f81fd){while(--_0x1f81fd){_0x5f4b06['push'](_0x5f4b06['shift']());}};_0x55cc05(++_0x3e5997);}(_0x4490,0x1a8));var _0x0449=function(_0x21eb25,_0x49d114){_0x21eb25=_0x21eb25-0x0;var _0x5a890e=_0x4490[_0x21eb25];return _0x5a890e;};'use strict';var multer=require(_0x0449('0x0'));var util=require(_0x0449('0x1'));var path=require(_0x0449('0x2'));var timeout=require(_0x0449('0x3'));var express=require(_0x0449('0x4'));var router=express[_0x0449('0x5')]();var fs_extra=require(_0x0449('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0449('0x7'));var config=require(_0x0449('0x8'));var controller=require('./chatWebsite.controller');router[_0x0449('0x9')]('/',auth[_0x0449('0xa')](),controller['index']);router[_0x0449('0x9')](_0x0449('0xb'),auth[_0x0449('0xa')](),controller[_0x0449('0xc')]);router[_0x0449('0x9')](_0x0449('0xd'),auth[_0x0449('0xa')](),controller['show']);router[_0x0449('0x9')](_0x0449('0xe'),auth[_0x0449('0xa')](),controller[_0x0449('0xf')]);router[_0x0449('0x9')]('/:id/canned_answers',auth[_0x0449('0xa')](),controller['getAnswers']);router[_0x0449('0x9')](_0x0449('0x10'),controller[_0x0449('0x11')]);router[_0x0449('0x9')](_0x0449('0x12'),controller['getAvatar']);router[_0x0449('0x9')]('/:id/customer_avatar',controller[_0x0449('0x13')]);router['get']('/:id/system_avatar',controller['getSystemAvatar']);router[_0x0449('0x9')]('/:id/interactions',auth[_0x0449('0xa')](),controller[_0x0449('0x14')]);router[_0x0449('0x9')]('/:id/snippet',controller[_0x0449('0x15')]);router[_0x0449('0x9')]('/:id/applications',auth[_0x0449('0xa')](),controller[_0x0449('0x16')]);router['get'](_0x0449('0x17'),auth[_0x0449('0xa')](),controller[_0x0449('0x18')]);router['get'](_0x0449('0x19'),controller[_0x0449('0x1a')]);router[_0x0449('0x9')](_0x0449('0x1b'),auth[_0x0449('0xa')](),controller[_0x0449('0x1c')]);router[_0x0449('0x9')](_0x0449('0x1d'),auth[_0x0449('0xa')](),controller['getAgents']);router['post']('/',auth[_0x0449('0xa')](),controller[_0x0449('0x1e')]);router[_0x0449('0x1f')](_0x0449('0xe'),auth[_0x0449('0xa')](),controller[_0x0449('0x20')]);router[_0x0449('0x1f')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x0449('0x21')]);var upload=multer({'storage':multer[_0x0449('0x22')]({'destination':function(_0x2aeca9,_0x401e7d,_0x8b0e9){_0x8b0e9(null,path['join'](config[_0x0449('0x23')],'server/files/images/logos/'));},'filename':function(_0x1632c6,_0x187e90,_0x87fece){_0x87fece(null,util['format'](_0x0449('0x24'),Date[_0x0449('0x25')](),_0x187e90['originalname']));}})});router['post']('/:id/logo',upload[_0x0449('0x26')](_0x0449('0x27')),controller[_0x0449('0x28')]);var upload=multer({'storage':multer[_0x0449('0x22')]({'destination':function(_0x2d2067,_0x2e1ea9,_0x4c8a8c){_0x4c8a8c(null,path[_0x0449('0x29')](config[_0x0449('0x23')],'server/files/images/avatars/'));},'filename':function(_0x3a6eb3,_0x53aa6b,_0x4de485){_0x4de485(null,util[_0x0449('0x2a')]('%s-%s',Date[_0x0449('0x25')](),_0x53aa6b[_0x0449('0x2b')]));}})});router[_0x0449('0x1f')](_0x0449('0x12'),upload[_0x0449('0x26')]('file'),controller[_0x0449('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2bbbf7,_0xb1c74d,_0x1245ac){_0x1245ac(null,path[_0x0449('0x29')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x4acf36,_0x913143,_0x1ed7cb){_0x1ed7cb(null,util[_0x0449('0x2a')](_0x0449('0x24'),Date[_0x0449('0x25')](),_0x913143[_0x0449('0x2b')]));}})});router[_0x0449('0x1f')](_0x0449('0x2d'),upload[_0x0449('0x26')](_0x0449('0x27')),controller[_0x0449('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x308d70,_0x396a56,_0x1f1253){_0x1f1253(null,path[_0x0449('0x29')](config[_0x0449('0x23')],_0x0449('0x2f')));},'filename':function(_0x344209,_0x97f0b9,_0x13e1dd){_0x13e1dd(null,util[_0x0449('0x2a')]('%s-%s',Date[_0x0449('0x25')](),_0x97f0b9[_0x0449('0x2b')]));}})});router[_0x0449('0x1f')]('/:id/system_avatar',upload[_0x0449('0x26')](_0x0449('0x27')),controller['addSystemAvatar']);router[_0x0449('0x1f')](_0x0449('0x30'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x0449('0x22')]({'destination':function(_0x4fe868,_0x1aa0e8,_0x2e4fe1){const _0x4a7f34=path['join'](config[_0x0449('0x23')],_0x0449('0x31'),_0x0449('0x32'),_0x0449('0x33'));fs_extra['ensureDir'](_0x4a7f34,function(){_0x2e4fe1(null,_0x4a7f34);});},'filename':function(_0x184921,_0xbedc6a,_0x166be6){const _0x591670=_0xbedc6a[_0x0449('0x2b')][_0x0449('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2a42cf=path[_0x0449('0x35')](_0x591670);const _0x3b1aa1=Date[_0x0449('0x25')]()+'-'+_0x591670[_0x0449('0x34')](_0x2a42cf,'')+_0x2a42cf;_0x166be6(null,_0x3b1aa1);}})});router[_0x0449('0x1f')](_0x0449('0x36'),offlineUploadMulter['any'](),controller[_0x0449('0x37')]);router[_0x0449('0x1f')]('/:id/interactions',auth[_0x0449('0xa')](),controller[_0x0449('0x38')]);router[_0x0449('0x1f')](_0x0449('0x39'),auth[_0x0449('0xa')](),controller[_0x0449('0x3a')]);router[_0x0449('0x1f')](_0x0449('0x17'),auth[_0x0449('0xa')](),controller[_0x0449('0x3b')]);router[_0x0449('0x1f')](_0x0449('0x1d'),auth[_0x0449('0xa')](),controller[_0x0449('0x3c')]);router[_0x0449('0x3d')](_0x0449('0xd'),auth[_0x0449('0xa')](),controller[_0x0449('0x3e')]);router[_0x0449('0x3f')]('/:id',auth[_0x0449('0xa')](),controller[_0x0449('0x40')]);router[_0x0449('0x3f')](_0x0449('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x0449('0x3f')](_0x0449('0x41'),auth[_0x0449('0xa')](),controller[_0x0449('0x42')]);router[_0x0449('0x3f')]('/:id/users',auth[_0x0449('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index f0ac7ad..2f30587 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 _0xfd2e=['STRING','AmazonAWS','sequelize'];(function(_0x775324,_0x4bae4a){var _0x3c05db=function(_0x5cbe25){while(--_0x5cbe25){_0x775324['push'](_0x775324['shift']());}};_0x3c05db(++_0x4bae4a);}(_0xfd2e,0x6e));var _0xefd2=function(_0x43c8eb,_0xf76efe){_0x43c8eb=_0x43c8eb-0x0;var _0x3b1c3b=_0xfd2e[_0x43c8eb];return _0x3b1c3b;};'use strict';var Sequelize=require(_0xefd2('0x0'));module['exports']={'name':{'type':Sequelize[_0xefd2('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xefd2('0x2'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xefd2('0x1')]},'data2':{'type':Sequelize[_0xefd2('0x1')]}}; \ No newline at end of file +var _0x2bae=['AmazonAWS','Google','sequelize','exports','STRING','ENUM'];(function(_0xd8d422,_0x2a29cb){var _0x554af6=function(_0x4f5385){while(--_0x4f5385){_0xd8d422['push'](_0xd8d422['shift']());}};_0x554af6(++_0x2a29cb);}(_0x2bae,0x164));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe2ba('0x0'));module[_0xe2ba('0x1')]={'name':{'type':Sequelize[_0xe2ba('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe2ba('0x3')](_0xe2ba('0x4'),_0xe2ba('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xe2ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index eb9ac42..58bed16 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 _0x0b0e=['hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','CloudProvider','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length'];(function(_0x2b3248,_0x4681c3){var _0x4c273=function(_0xd66761){while(--_0xd66761){_0x2b3248['push'](_0x2b3248['shift']());}};_0x4c273(++_0x4681c3);}(_0x0b0e,0x187));var _0xe0b0=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x0b0e[_0x35885a];return _0xe86249;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['CloudProvider'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'all':!![]}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x41')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x402a0e){_0x36d137[_0xe0b0('0x42')]=_0x402a0e;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x43')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x44')]=function(_0x52ffe4,_0x2aad80){var _0x309bbf={'raw':!![],'where':{'id':_0x52ffe4['params']['id']}},_0x528818={};_0x528818[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db['CloudProvider'][_0xe0b0('0x2b')]);_0x528818[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x52ffe4[_0xe0b0('0x2e')]);_0x528818[_0xe0b0('0x39')]=_['intersection'](_0x528818['model'],_0x528818['query']);_0x309bbf[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x528818['model'],qs[_0xe0b0('0x33')](_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x309bbf[_0xe0b0('0x32')]=_0x309bbf[_0xe0b0('0x32')]['length']?_0x309bbf['attributes']:_0x528818[_0xe0b0('0x31')];if(_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x309bbf[_0xe0b0('0x45')]=[{'all':!![]}];}_0x309bbf=_[_0xe0b0('0x3b')]({},_0x309bbf,_0x52ffe4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x46')](_0x309bbf)['then'](handleEntityNotFound(_0x2aad80,null))['then'](respondWithResult(_0x2aad80,null))['catch'](handleError(_0x2aad80,null));};exports[_0xe0b0('0x47')]=function(_0x2184d3,_0x2419ce){return db[_0xe0b0('0x2a')]['create'](_0x2184d3[_0xe0b0('0x48')],{})[_0xe0b0('0x23')](respondWithResult(_0x2419ce,0xc9))['catch'](handleError(_0x2419ce,null));};exports['update']=function(_0x2365be,_0x1bc6e0){if(_0x2365be['body']['id']){delete _0x2365be[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x2365be['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1bc6e0,null))['then'](saveUpdates(_0x2365be[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,null))[_0xe0b0('0x43')](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x24')]=function(_0x19ee71,_0xf9e694){return db['CloudProvider']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));}; \ No newline at end of file +var _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','CloudProvider','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x5f2f,0x73));var _0xf5f2=function(_0x12efd7,_0x14202f){_0x12efd7=_0x12efd7-0x0;var _0x4bb9b2=_0x5f2f[_0x12efd7];return _0x4bb9b2;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':!![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index c15278c..2dd7050 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 _0x76d1=['moment','bluebird','request-promise','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','api'];(function(_0x80544e,_0x37a3f3){var _0x4f9b90=function(_0x4f95d6){while(--_0x4f95d6){_0x80544e['push'](_0x80544e['shift']());}};_0x4f9b90(++_0x37a3f3);}(_0x76d1,0x99));var _0x176d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x76d1[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x176d('0x0'));var util=require(_0x176d('0x1'));var logger=require('../../config/logger')(_0x176d('0x2'));var moment=require(_0x176d('0x3'));var BPromise=require(_0x176d('0x4'));var rp=require(_0x176d('0x5'));var fs=require('fs');var path=require(_0x176d('0x6'));var rimraf=require(_0x176d('0x7'));var config=require('../../config/environment');var attributes=require(_0x176d('0x8'));module[_0x176d('0x9')]=function(_0x12b4f5,_0x74ba99){return _0x12b4f5[_0x176d('0xa')](_0x176d('0xb'),attributes,{'tableName':_0x176d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe770=['exports','define','cloud_providers','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x131fe7,_0x21fcdb){var _0x2eddf3=function(_0x1be350){while(--_0x1be350){_0x131fe7['push'](_0x131fe7['shift']());}};_0x2eddf3(++_0x21fcdb);}(_0xe770,0x1b0));var _0x0e77=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe770[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0e77('0x0'));var util=require(_0x0e77('0x1'));var logger=require(_0x0e77('0x2'))(_0x0e77('0x3'));var moment=require('moment');var BPromise=require(_0x0e77('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e77('0x5'));var rimraf=require(_0x0e77('0x6'));var config=require(_0x0e77('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x0e77('0x8')]=function(_0x272de2,_0x223299){return _0x272de2[_0x0e77('0x9')]('CloudProvider',attributes,{'tableName':_0x0e77('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 3958751..8cd4e0f 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 _0xe797=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xe797,0x12a));var _0x7e79=function(_0x517bc0,_0x302e15){_0x517bc0=_0x517bc0-0x0;var _0x242402=_0xe797[_0x517bc0];return _0x242402;};'use strict';var _=require(_0x7e79('0x0'));var util=require(_0x7e79('0x1'));var moment=require(_0x7e79('0x2'));var BPromise=require(_0x7e79('0x3'));var rs=require(_0x7e79('0x4'));var fs=require('fs');var Redis=require(_0x7e79('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e79('0x6'));var logger=require(_0x7e79('0x7'))('rpc');var config=require(_0x7e79('0x8'));var jayson=require(_0x7e79('0x9'));var client=jayson[_0x7e79('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fdfa1,_0x9dd35a,_0x358bd6){return new BPromise(function(_0x484e66,_0x54aab5){return client[_0x7e79('0xb')](_0x4fdfa1,_0x358bd6)[_0x7e79('0xc')](function(_0x134e89){logger['info'](_0x7e79('0xd'),_0x9dd35a,_0x7e79('0xe'));logger[_0x7e79('0xf')](_0x7e79('0x10'),_0x9dd35a,_0x7e79('0xe'),JSON[_0x7e79('0x11')](_0x134e89));if(_0x134e89[_0x7e79('0x12')]){if(_0x134e89[_0x7e79('0x12')][_0x7e79('0x13')]===0x1f4){logger['error'](_0x7e79('0xd'),_0x9dd35a,_0x134e89['error'][_0x7e79('0x14')]);return _0x54aab5(_0x134e89['error'][_0x7e79('0x14')]);}logger[_0x7e79('0x12')](_0x7e79('0xd'),_0x9dd35a,_0x134e89[_0x7e79('0x12')]['message']);return _0x484e66(_0x134e89[_0x7e79('0x12')][_0x7e79('0x14')]);}else{logger[_0x7e79('0x15')](_0x7e79('0xd'),_0x9dd35a,_0x7e79('0xe'));_0x484e66(_0x134e89[_0x7e79('0x16')][_0x7e79('0x14')]);}})['catch'](function(_0x2ec0c7){logger[_0x7e79('0x12')](_0x7e79('0xd'),_0x9dd35a,_0x2ec0c7);_0x54aab5(_0x2ec0c7);});});} \ No newline at end of file +var _0x20d8=['stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s'];(function(_0x141f5b,_0x4b93fd){var _0x322673=function(_0x252408){while(--_0x252408){_0x141f5b['push'](_0x141f5b['shift']());}};_0x322673(++_0x4b93fd);}(_0x20d8,0xee));var _0x820d=function(_0x2efcbf,_0x35a97d){_0x2efcbf=_0x2efcbf-0x0;var _0x1604b2=_0x20d8[_0x2efcbf];return _0x1604b2;};'use strict';var _=require(_0x820d('0x0'));var util=require(_0x820d('0x1'));var moment=require(_0x820d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x820d('0x3'));var db=require(_0x820d('0x4'))['db'];var utils=require(_0x820d('0x5'));var logger=require(_0x820d('0x6'))(_0x820d('0x7'));var config=require('../../config/environment');var jayson=require(_0x820d('0x8'));var client=jayson[_0x820d('0x9')][_0x820d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e23e3,_0x435a84,_0xa2751d){return new BPromise(function(_0x3b084c,_0x485bde){return client[_0x820d('0xb')](_0x4e23e3,_0xa2751d)['then'](function(_0x45fdd7){logger['info']('CloudProvider,\x20%s,\x20%s',_0x435a84,_0x820d('0xc'));logger['debug'](_0x820d('0xd'),_0x435a84,_0x820d('0xc'),JSON[_0x820d('0xe')](_0x45fdd7));if(_0x45fdd7['error']){if(_0x45fdd7[_0x820d('0xf')][_0x820d('0x10')]===0x1f4){logger['error'](_0x820d('0x11'),_0x435a84,_0x45fdd7['error'][_0x820d('0x12')]);return _0x485bde(_0x45fdd7[_0x820d('0xf')][_0x820d('0x12')]);}logger[_0x820d('0xf')](_0x820d('0x11'),_0x435a84,_0x45fdd7[_0x820d('0xf')]['message']);return _0x3b084c(_0x45fdd7['error'][_0x820d('0x12')]);}else{logger['info'](_0x820d('0x11'),_0x435a84,_0x820d('0xc'));_0x3b084c(_0x45fdd7[_0x820d('0x13')]['message']);}})[_0x820d('0x14')](function(_0x3466c1){logger[_0x820d('0xf')](_0x820d('0x11'),_0x435a84,_0x3466c1);_0x485bde(_0x3466c1);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 9897f47..ffc2b33 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 _0x11c1=['get','isAuthenticated','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x11c1,0x1cb));var _0x111c=function(_0x5da49e,_0x358e31){_0x5da49e=_0x5da49e-0x0;var _0x3729e6=_0x11c1[_0x5da49e];return _0x3729e6;};'use strict';var multer=require(_0x111c('0x0'));var util=require('util');var path=require(_0x111c('0x1'));var timeout=require(_0x111c('0x2'));var express=require(_0x111c('0x3'));var router=express[_0x111c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x111c('0x5'));var interaction=require(_0x111c('0x6'));var config=require(_0x111c('0x7'));var controller=require(_0x111c('0x8'));router[_0x111c('0x9')]('/',auth[_0x111c('0xa')](),controller['index']);router[_0x111c('0x9')](_0x111c('0xb'),auth[_0x111c('0xa')](),controller[_0x111c('0xc')]);router[_0x111c('0xd')]('/',auth[_0x111c('0xa')](),controller[_0x111c('0xe')]);router[_0x111c('0xf')](_0x111c('0xb'),auth[_0x111c('0xa')](),controller[_0x111c('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x111c('0x11')]=router; \ No newline at end of file +var _0x4cb9=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x445b09,_0x49179f){var _0x1f1fa2=function(_0x4c8791){while(--_0x4c8791){_0x445b09['push'](_0x445b09['shift']());}};_0x1f1fa2(++_0x49179f);}(_0x4cb9,0x8f));var _0x94cb=function(_0x4cde67,_0x1f58b8){_0x4cde67=_0x4cde67-0x0;var _0xd80b56=_0x4cb9[_0x4cde67];return _0xd80b56;};'use strict';var multer=require('multer');var util=require(_0x94cb('0x0'));var path=require(_0x94cb('0x1'));var timeout=require(_0x94cb('0x2'));var express=require(_0x94cb('0x3'));var router=express[_0x94cb('0x4')]();var fs_extra=require(_0x94cb('0x5'));var auth=require(_0x94cb('0x6'));var interaction=require(_0x94cb('0x7'));var config=require('../../config/environment');var controller=require(_0x94cb('0x8'));router[_0x94cb('0x9')]('/',auth[_0x94cb('0xa')](),controller[_0x94cb('0xb')]);router[_0x94cb('0x9')](_0x94cb('0xc'),auth[_0x94cb('0xa')](),controller[_0x94cb('0xd')]);router[_0x94cb('0xe')]('/',auth['isAuthenticated'](),controller[_0x94cb('0xf')]);router[_0x94cb('0x10')](_0x94cb('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x94cb('0x11')](_0x94cb('0xc'),auth['isAuthenticated'](),controller[_0x94cb('0x12')]);module[_0x94cb('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 23a9260..0689063 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 _0x5089=['exports','name','STRING','sequelize'];(function(_0x32e4de,_0x7da1c5){var _0x51ba2a=function(_0x2a7322){while(--_0x2a7322){_0x32e4de['push'](_0x32e4de['shift']());}};_0x51ba2a(++_0x7da1c5);}(_0x5089,0x1bb));var _0x9508=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0x5089[_0xa1e3ca];return _0x5005ab;};'use strict';var Sequelize=require(_0x9508('0x0'));module[_0x9508('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9508('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x9508('0x3')]},'companyId':{'type':Sequelize[_0x9508('0x3')]},'website':{'type':Sequelize[_0x9508('0x3')]},'phone':{'type':Sequelize[_0x9508('0x3')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9508('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x9508('0x3')]},'city':{'type':Sequelize[_0x9508('0x3')]},'country':{'type':Sequelize[_0x9508('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9508('0x3')]},'sStreet':{'type':Sequelize[_0x9508('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x9508('0x3')]},'sCountry':{'type':Sequelize[_0x9508('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe062=['STRING','sequelize','exports'];(function(_0x130dd5,_0x406f8a){var _0xe75fdb=function(_0x1b209d){while(--_0x1b209d){_0x130dd5['push'](_0x130dd5['shift']());}};_0xe75fdb(++_0x406f8a);}(_0xe062,0x17b));var _0x2e06=function(_0x1b0d45,_0x120d3d){_0x1b0d45=_0x1b0d45-0x0;var _0x38c0fa=_0xe062[_0x1b0d45];return _0x38c0fa;};'use strict';var Sequelize=require(_0x2e06('0x0'));module[_0x2e06('0x1')]={'name':{'type':Sequelize[_0x2e06('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x2e06('0x2')]},'companyId':{'type':Sequelize[_0x2e06('0x2')]},'website':{'type':Sequelize[_0x2e06('0x2')]},'phone':{'type':Sequelize[_0x2e06('0x2')]},'fax':{'type':Sequelize[_0x2e06('0x2')]},'type':{'type':Sequelize[_0x2e06('0x2')]},'street':{'type':Sequelize[_0x2e06('0x2')]},'postalCode':{'type':Sequelize[_0x2e06('0x2')]},'city':{'type':Sequelize[_0x2e06('0x2')]},'country':{'type':Sequelize[_0x2e06('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x2e06('0x2')]},'sStreet':{'type':Sequelize[_0x2e06('0x2')]},'sPostalCode':{'type':Sequelize[_0x2e06('0x2')]},'sCity':{'type':Sequelize[_0x2e06('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 7239898..3e8724e 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 _0xea6f=['stack','name','send','index','CmCompany','describe','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','ids','omit','getContacts','findOne','pick','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','json','apply','save','update','then','destroy','get','Companies','UserProfileResource'];(function(_0x2bb033,_0x517cda){var _0x1d47d5=function(_0x17f98c){while(--_0x17f98c){_0x2bb033['push'](_0x2bb033['shift']());}};_0x1d47d5(++_0x517cda);}(_0xea6f,0xd5));var _0xfea6=function(_0xdd59ff,_0x3288f7){_0xdd59ff=_0xdd59ff-0x0;var _0x3f187e=_0xea6f[_0xdd59ff];return _0x3f187e;};'use strict';var emlformat=require(_0xfea6('0x0'));var rimraf=require(_0xfea6('0x1'));var zipdir=require(_0xfea6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfea6('0x3'));var moment=require(_0xfea6('0x4'));var BPromise=require(_0xfea6('0x5'));var Mustache=require(_0xfea6('0x6'));var util=require(_0xfea6('0x7'));var path=require('path');var sox=require(_0xfea6('0x8'));var csv=require(_0xfea6('0x9'));var ejs=require(_0xfea6('0xa'));var fs=require('fs');var fs_extra=require(_0xfea6('0xb'));var _=require(_0xfea6('0xc'));var squel=require(_0xfea6('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfea6('0xe'));var authService=require(_0xfea6('0xf'));var qs=require(_0xfea6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfea6('0x11'));var logger=require('../../config/logger')(_0xfea6('0x12'));var utils=require(_0xfea6('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfea6('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x457a4e,_0x4f8732){_0x4f8732=_0x4f8732||0xcc;return function(_0x27ced1){if(_0x27ced1){return _0x457a4e[_0xfea6('0x15')](_0x4f8732);}return _0x457a4e['status'](_0x4f8732)[_0xfea6('0x16')]();};}function respondWithResult(_0x44cd2a,_0x104816){_0x104816=_0x104816||0xc8;return function(_0x3a6feb){if(_0x3a6feb){return _0x44cd2a[_0xfea6('0x17')](_0x104816)['json'](_0x3a6feb);}};}function respondWithFilteredResult(_0x3dedc4,_0x387c63){return function(_0x250b30){if(_0x250b30){var _0x58ccfc=typeof _0x387c63['offset']==='undefined'&&typeof _0x387c63[_0xfea6('0x18')]===_0xfea6('0x19');var _0x768454=_0x250b30[_0xfea6('0x1a')];var _0x344887=_0x58ccfc?0x0:_0x387c63['offset'];var _0x59958d=_0x58ccfc?_0x250b30['count']:_0x387c63[_0xfea6('0x1b')]+_0x387c63['limit'];var _0x1f6c2b;if(_0x59958d>=_0x768454){_0x59958d=_0x768454;_0x1f6c2b=0xc8;}else{_0x1f6c2b=0xce;}_0x3dedc4[_0xfea6('0x17')](_0x1f6c2b);return _0x3dedc4[_0xfea6('0x1c')](_0xfea6('0x1d'),_0x344887+'-'+_0x59958d+'/'+_0x768454)[_0xfea6('0x1e')](_0x250b30);}return null;};}function patchUpdates(_0x4f7902){return function(_0x2feab5){try{jsonpatch[_0xfea6('0x1f')](_0x2feab5,_0x4f7902,!![]);}catch(_0x29f530){return BPromise['reject'](_0x29f530);}return _0x2feab5[_0xfea6('0x20')]();};}function saveUpdates(_0x2aba02,_0x4c2750){return function(_0x1aba1f){if(_0x1aba1f){return _0x1aba1f[_0xfea6('0x21')](_0x2aba02)[_0xfea6('0x22')](function(_0x1c379d){return _0x1c379d;});}return null;};}function removeEntity(_0x5e4edc,_0x545edb){return function(_0x115eed){if(_0x115eed){return _0x115eed[_0xfea6('0x23')]()[_0xfea6('0x22')](function(){var _0x41b993=_0x115eed[_0xfea6('0x24')]({'plain':!![]});var _0x38d865=_0xfea6('0x25');return db[_0xfea6('0x26')]['destroy']({'where':{'type':_0x38d865,'resourceId':_0x41b993['id']}})[_0xfea6('0x22')](function(){return _0x115eed;});})['then'](function(){_0x5e4edc['status'](0xcc)[_0xfea6('0x16')]();});}};}function handleEntityNotFound(_0x2bf808,_0x1316fd){return function(_0x23e2ba){if(!_0x23e2ba){_0x2bf808[_0xfea6('0x15')](0x194);}return _0x23e2ba;};}function handleError(_0x37856c,_0x343034){_0x343034=_0x343034||0x1f4;return function(_0x5e3e03){logger['error'](_0x5e3e03[_0xfea6('0x27')]);if(_0x5e3e03[_0xfea6('0x28')]){delete _0x5e3e03[_0xfea6('0x28')];}_0x37856c[_0xfea6('0x17')](_0x343034)[_0xfea6('0x29')](_0x5e3e03);};}exports[_0xfea6('0x2a')]=function(_0x57e6a2,_0x558f4c){var _0x877e91={},_0x5d8d80={},_0x442f99={'count':0x0,'rows':[]};return db[_0xfea6('0x2b')][_0xfea6('0x2c')]()[_0xfea6('0x22')](function(_0x25ca62){_0x5d8d80['model']=_[_0xfea6('0x2d')](_0x25ca62);_0x5d8d80[_0xfea6('0x2e')]=_[_0xfea6('0x2d')](_0x57e6a2[_0xfea6('0x2e')]);_0x5d8d80[_0xfea6('0x2f')]=_[_0xfea6('0x30')](_0x5d8d80[_0xfea6('0x31')],_0x5d8d80[_0xfea6('0x2e')]);_0x877e91[_0xfea6('0x32')]=_['intersection'](_0x5d8d80[_0xfea6('0x31')],qs['fields'](_0x57e6a2[_0xfea6('0x2e')][_0xfea6('0x33')]));_0x877e91[_0xfea6('0x32')]=_0x877e91[_0xfea6('0x32')][_0xfea6('0x34')]?_0x877e91[_0xfea6('0x32')]:_0x5d8d80[_0xfea6('0x31')];if(!_0x57e6a2[_0xfea6('0x2e')][_0xfea6('0x35')](_0xfea6('0x36'))){_0x877e91[_0xfea6('0x18')]=qs[_0xfea6('0x18')](_0x57e6a2[_0xfea6('0x2e')][_0xfea6('0x18')]);_0x877e91[_0xfea6('0x1b')]=qs['offset'](_0x57e6a2[_0xfea6('0x2e')][_0xfea6('0x1b')]);}_0x877e91[_0xfea6('0x37')]=qs[_0xfea6('0x38')](_0x57e6a2['query'][_0xfea6('0x38')]);_0x877e91['where']=qs[_0xfea6('0x2f')](_['pick'](_0x57e6a2[_0xfea6('0x2e')],_0x5d8d80[_0xfea6('0x2f')]),_0x25ca62);if(_0x57e6a2[_0xfea6('0x2e')][_0xfea6('0x39')]){_0x877e91[_0xfea6('0x3a')]=_[_0xfea6('0x3b')](_0x877e91[_0xfea6('0x3a')],{'$or':_['map'](_0x877e91[_0xfea6('0x32')],function(_0x2248df){var _0x319d28={};_0x319d28[_0x2248df]={'$like':'%'+_0x57e6a2['query'][_0xfea6('0x39')]+'%'};return _0x319d28;})});}_0x877e91=_[_0xfea6('0x3b')]({},_0x877e91,_0x57e6a2['options']);var _0x523016={'where':_0x877e91[_0xfea6('0x3a')]};return db[_0xfea6('0x2b')][_0xfea6('0x1a')](_0x523016)[_0xfea6('0x22')](function(_0x5ca3b0){_0x442f99[_0xfea6('0x1a')]=_0x5ca3b0;if(_0x57e6a2['query'][_0xfea6('0x3c')]){_0x877e91[_0xfea6('0x3d')]=[{'all':!![]}];}return db['CmCompany'][_0xfea6('0x3e')](_0x877e91);})[_0xfea6('0x22')](function(_0x34762b){_0x442f99[_0xfea6('0x3f')]=_0x34762b;return _0x442f99;})['then'](respondWithFilteredResult(_0x558f4c,_0x877e91))[_0xfea6('0x40')](handleError(_0x558f4c,null));})['catch'](handleError(_0x558f4c,null));};exports[_0xfea6('0x41')]=function(_0x559635,_0x3811ad){var _0x1a3ec0={'raw':![],'where':{'id':_0x559635[_0xfea6('0x42')]['id']}},_0x29f13f={};_0x29f13f[_0xfea6('0x31')]=_[_0xfea6('0x2d')](db[_0xfea6('0x2b')][_0xfea6('0x43')]);_0x29f13f[_0xfea6('0x2e')]=_[_0xfea6('0x2d')](_0x559635[_0xfea6('0x2e')]);_0x29f13f[_0xfea6('0x2f')]=_[_0xfea6('0x30')](_0x29f13f[_0xfea6('0x31')],_0x29f13f[_0xfea6('0x2e')]);_0x1a3ec0['attributes']=_['intersection'](_0x29f13f['model'],qs[_0xfea6('0x33')](_0x559635[_0xfea6('0x2e')][_0xfea6('0x33')]));_0x1a3ec0[_0xfea6('0x32')]=_0x1a3ec0[_0xfea6('0x32')]['length']?_0x1a3ec0[_0xfea6('0x32')]:_0x29f13f[_0xfea6('0x31')];if(_0x559635[_0xfea6('0x2e')][_0xfea6('0x3c')]){_0x1a3ec0['include']=[{'all':!![]}];}_0x1a3ec0=_[_0xfea6('0x3b')]({},_0x1a3ec0,_0x559635[_0xfea6('0x44')]);return db[_0xfea6('0x2b')][_0xfea6('0x45')](_0x1a3ec0)[_0xfea6('0x22')](handleEntityNotFound(_0x3811ad,null))['then'](respondWithResult(_0x3811ad,null))[_0xfea6('0x40')](handleError(_0x3811ad,null));};exports[_0xfea6('0x46')]=function(_0x85fa5f,_0x4e84dc){return db[_0xfea6('0x2b')][_0xfea6('0x46')](_0x85fa5f['body'],{})[_0xfea6('0x22')](function(_0x22b889){var _0x309e28=_0x85fa5f[_0xfea6('0x47')]['get']({'plain':!![]});if(!_0x309e28)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x309e28['role']===_0xfea6('0x47')){var _0x347980=_0x22b889[_0xfea6('0x24')]({'plain':!![]});var _0x4482db=_0xfea6('0x25');return db[_0xfea6('0x48')][_0xfea6('0x45')]({'where':{'name':_0x4482db,'userProfileId':_0x309e28['userProfileId']},'raw':!![]})[_0xfea6('0x22')](function(_0x19300d){if(_0x19300d&&_0x19300d[_0xfea6('0x49')]===0x0){return db['UserProfileResource'][_0xfea6('0x46')]({'name':_0x347980[_0xfea6('0x28')],'resourceId':_0x347980['id'],'type':_0x19300d[_0xfea6('0x28')],'sectionId':_0x19300d['id']},{})[_0xfea6('0x22')](function(){return _0x22b889;});}else{return _0x22b889;}})[_0xfea6('0x40')](function(_0x38f598){logger[_0xfea6('0x4a')](_0xfea6('0x4b'),_0x38f598);throw _0x38f598;});}return _0x22b889;})[_0xfea6('0x22')](respondWithResult(_0x4e84dc,0xc9))[_0xfea6('0x40')](handleError(_0x4e84dc,null));};exports['update']=function(_0x23f34d,_0x267745){if(_0x23f34d[_0xfea6('0x4c')]['id']){delete _0x23f34d[_0xfea6('0x4c')]['id'];}return db[_0xfea6('0x2b')][_0xfea6('0x45')]({'where':{'id':_0x23f34d[_0xfea6('0x42')]['id']}})[_0xfea6('0x22')](handleEntityNotFound(_0x267745,null))[_0xfea6('0x22')](saveUpdates(_0x23f34d['body'],null))['then'](respondWithResult(_0x267745,null))[_0xfea6('0x40')](handleError(_0x267745,null));};exports[_0xfea6('0x23')]=function(_0x23fef9,_0x800164){return db[_0xfea6('0x2b')]['find']({'where':{'id':_0x23fef9[_0xfea6('0x42')]['id']}})[_0xfea6('0x22')](handleEntityNotFound(_0x800164,null))[_0xfea6('0x22')](removeEntity(_0x800164,null))['catch'](handleError(_0x800164,null));};exports[_0xfea6('0x2c')]=function(_0x286095,_0x410546){return db['CmCompany'][_0xfea6('0x2c')]()['then'](respondWithResult(_0x410546,null))[_0xfea6('0x40')](handleError(_0x410546,null));};exports[_0xfea6('0x4d')]=function(_0x1d6a89,_0x307b6b,_0x556c22){return db[_0xfea6('0x4e')][_0xfea6('0x45')]({'where':{'id':_0x1d6a89[_0xfea6('0x42')]['id']}})[_0xfea6('0x22')](handleEntityNotFound(_0x307b6b,null))[_0xfea6('0x22')](function(_0x2b4a9f){if(_0x2b4a9f){return _0x2b4a9f[_0xfea6('0x4d')](_0x1d6a89['body'][_0xfea6('0x4f')],_[_0xfea6('0x50')](_0x1d6a89[_0xfea6('0x4c')],[_0xfea6('0x4f'),'id'])||{});}})[_0xfea6('0x22')](respondWithResult(_0x307b6b,null))[_0xfea6('0x40')](handleError(_0x307b6b,null));};exports[_0xfea6('0x51')]=function(_0x173da4,_0x53c9c4,_0x4e4adc){var _0x1054a8={};var _0x257201={};var _0x179a28;var _0x23d6e4;return db['CmCompany'][_0xfea6('0x52')]({'where':{'id':_0x173da4[_0xfea6('0x42')]['id']}})['then'](handleEntityNotFound(_0x53c9c4,null))[_0xfea6('0x22')](function(_0x377bfd){if(_0x377bfd){_0x179a28=_0x377bfd;_0x257201[_0xfea6('0x31')]=_[_0xfea6('0x2d')](db[_0xfea6('0x4e')]['rawAttributes']);_0x257201['query']=_[_0xfea6('0x2d')](_0x173da4[_0xfea6('0x2e')]);_0x257201[_0xfea6('0x2f')]=_[_0xfea6('0x30')](_0x257201[_0xfea6('0x31')],_0x257201[_0xfea6('0x2e')]);_0x1054a8[_0xfea6('0x32')]=_[_0xfea6('0x30')](_0x257201[_0xfea6('0x31')],qs['fields'](_0x173da4[_0xfea6('0x2e')][_0xfea6('0x33')]));_0x1054a8[_0xfea6('0x32')]=_0x1054a8[_0xfea6('0x32')]['length']?_0x1054a8[_0xfea6('0x32')]:_0x257201[_0xfea6('0x31')];_0x1054a8[_0xfea6('0x37')]=qs[_0xfea6('0x38')](_0x173da4[_0xfea6('0x2e')][_0xfea6('0x38')]);_0x1054a8[_0xfea6('0x3a')]=qs[_0xfea6('0x2f')](_[_0xfea6('0x53')](_0x173da4[_0xfea6('0x2e')],_0x257201[_0xfea6('0x2f')]));if(_0x173da4[_0xfea6('0x2e')][_0xfea6('0x39')]){_0x1054a8[_0xfea6('0x3a')]=_[_0xfea6('0x3b')](_0x1054a8['where'],{'$or':_['map'](_0x1054a8[_0xfea6('0x32')],function(_0x46e658){var _0xd135ff={};_0xd135ff[_0x46e658]={'$like':'%'+_0x173da4['query'][_0xfea6('0x39')]+'%'};return _0xd135ff;})});}_0x1054a8=_[_0xfea6('0x3b')]({},_0x1054a8,_0x173da4[_0xfea6('0x44')]);return _0x179a28['getContacts'](_0x1054a8);}})[_0xfea6('0x22')](function(_0x3d7efa){if(_0x3d7efa){_0x23d6e4=_0x3d7efa[_0xfea6('0x34')];if(!_0x173da4['query'][_0xfea6('0x35')](_0xfea6('0x36'))){_0x1054a8[_0xfea6('0x18')]=qs[_0xfea6('0x18')](_0x173da4[_0xfea6('0x2e')][_0xfea6('0x18')]);_0x1054a8['offset']=qs[_0xfea6('0x1b')](_0x173da4[_0xfea6('0x2e')][_0xfea6('0x1b')]);}return _0x179a28[_0xfea6('0x51')](_0x1054a8);}})[_0xfea6('0x22')](function(_0x264beb){if(_0x264beb){return _0x264beb?{'count':_0x23d6e4,'rows':_0x264beb}:null;}})[_0xfea6('0x22')](respondWithResult(_0x53c9c4,null))['catch'](handleError(_0x53c9c4,null));}; \ No newline at end of file +var _0xc335=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','stack','name','send','index','CmCompany','describe','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','options','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','findOne','CmContact','pick','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x302ac0,_0x250435){var _0x1633ad=function(_0x55d3ec){while(--_0x55d3ec){_0x302ac0['push'](_0x302ac0['shift']());}};_0x1633ad(++_0x250435);}(_0xc335,0xfc));var _0x5c33=function(_0x134e71,_0x160446){_0x134e71=_0x134e71-0x0;var _0x1f245b=_0xc335[_0x134e71];return _0x1f245b;};'use strict';var emlformat=require(_0x5c33('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5c33('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c33('0x2'));var moment=require(_0x5c33('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5c33('0x4'));var util=require(_0x5c33('0x5'));var path=require(_0x5c33('0x6'));var sox=require(_0x5c33('0x7'));var csv=require(_0x5c33('0x8'));var ejs=require(_0x5c33('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5c33('0xa'));var crypto=require(_0x5c33('0xb'));var jsforce=require(_0x5c33('0xc'));var deskjs=require(_0x5c33('0xd'));var toCsv=require(_0x5c33('0x8'));var querystring=require(_0x5c33('0xe'));var Papa=require(_0x5c33('0xf'));var Redis=require(_0x5c33('0x10'));var authService=require(_0x5c33('0x11'));var qs=require(_0x5c33('0x12'));var as=require(_0x5c33('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c33('0x14'))(_0x5c33('0x15'));var utils=require('../../config/utils');var config=require(_0x5c33('0x16'));var licenseUtil=require(_0x5c33('0x17'));var db=require(_0x5c33('0x18'))['db'];function respondWithStatusCode(_0x4697c3,_0x49136f){_0x49136f=_0x49136f||0xcc;return function(_0x5e1bc6){if(_0x5e1bc6){return _0x4697c3[_0x5c33('0x19')](_0x49136f);}return _0x4697c3[_0x5c33('0x1a')](_0x49136f)[_0x5c33('0x1b')]();};}function respondWithResult(_0x121ab3,_0x439301){_0x439301=_0x439301||0xc8;return function(_0x486cc4){if(_0x486cc4){return _0x121ab3[_0x5c33('0x1a')](_0x439301)[_0x5c33('0x1c')](_0x486cc4);}};}function respondWithFilteredResult(_0x49d7db,_0x1d54eb){return function(_0x1abdf7){if(_0x1abdf7){var _0x14337d=typeof _0x1d54eb['offset']===_0x5c33('0x1d')&&typeof _0x1d54eb[_0x5c33('0x1e')]===_0x5c33('0x1d');var _0x5abf45=_0x1abdf7['count'];var _0x4e7616=_0x14337d?0x0:_0x1d54eb[_0x5c33('0x1f')];var _0x126288=_0x14337d?_0x1abdf7[_0x5c33('0x20')]:_0x1d54eb[_0x5c33('0x1f')]+_0x1d54eb['limit'];var _0x206697;if(_0x126288>=_0x5abf45){_0x126288=_0x5abf45;_0x206697=0xc8;}else{_0x206697=0xce;}_0x49d7db[_0x5c33('0x1a')](_0x206697);return _0x49d7db[_0x5c33('0x21')](_0x5c33('0x22'),_0x4e7616+'-'+_0x126288+'/'+_0x5abf45)[_0x5c33('0x1c')](_0x1abdf7);}return null;};}function patchUpdates(_0xf3a7d4){return function(_0x5caf79){try{jsonpatch[_0x5c33('0x23')](_0x5caf79,_0xf3a7d4,!![]);}catch(_0x1a0d01){return BPromise[_0x5c33('0x24')](_0x1a0d01);}return _0x5caf79[_0x5c33('0x25')]();};}function saveUpdates(_0x27a5e9,_0x3623dc){return function(_0x306b8d){if(_0x306b8d){return _0x306b8d[_0x5c33('0x26')](_0x27a5e9)[_0x5c33('0x27')](function(_0xca22e4){return _0xca22e4;});}return null;};}function removeEntity(_0x535108,_0x57473d){return function(_0x11c770){if(_0x11c770){return _0x11c770[_0x5c33('0x28')]()[_0x5c33('0x27')](function(){var _0x48c9d6=_0x11c770[_0x5c33('0x29')]({'plain':!![]});var _0x2119b8=_0x5c33('0x2a');return db['UserProfileResource'][_0x5c33('0x28')]({'where':{'type':_0x2119b8,'resourceId':_0x48c9d6['id']}})[_0x5c33('0x27')](function(){return _0x11c770;});})[_0x5c33('0x27')](function(){_0x535108[_0x5c33('0x1a')](0xcc)[_0x5c33('0x1b')]();});}};}function handleEntityNotFound(_0x1c6239,_0x15a0cc){return function(_0x3d00b4){if(!_0x3d00b4){_0x1c6239[_0x5c33('0x19')](0x194);}return _0x3d00b4;};}function handleError(_0x392c99,_0x52096c){_0x52096c=_0x52096c||0x1f4;return function(_0x4ced91){logger['error'](_0x4ced91[_0x5c33('0x2b')]);if(_0x4ced91[_0x5c33('0x2c')]){delete _0x4ced91['name'];}_0x392c99['status'](_0x52096c)[_0x5c33('0x2d')](_0x4ced91);};}exports[_0x5c33('0x2e')]=function(_0x1c81e8,_0x378eba){var _0x563245={},_0x3859bf={},_0x14c28e={'count':0x0,'rows':[]};return db[_0x5c33('0x2f')][_0x5c33('0x30')]()[_0x5c33('0x27')](function(_0x2948b5){_0x3859bf['model']=_[_0x5c33('0x31')](_0x2948b5);_0x3859bf[_0x5c33('0x32')]=_['keys'](_0x1c81e8[_0x5c33('0x32')]);_0x3859bf[_0x5c33('0x33')]=_[_0x5c33('0x34')](_0x3859bf[_0x5c33('0x35')],_0x3859bf[_0x5c33('0x32')]);_0x563245['attributes']=_[_0x5c33('0x34')](_0x3859bf[_0x5c33('0x35')],qs[_0x5c33('0x36')](_0x1c81e8[_0x5c33('0x32')]['fields']));_0x563245['attributes']=_0x563245[_0x5c33('0x37')][_0x5c33('0x38')]?_0x563245[_0x5c33('0x37')]:_0x3859bf[_0x5c33('0x35')];if(!_0x1c81e8[_0x5c33('0x32')][_0x5c33('0x39')](_0x5c33('0x3a'))){_0x563245['limit']=qs[_0x5c33('0x1e')](_0x1c81e8[_0x5c33('0x32')]['limit']);_0x563245[_0x5c33('0x1f')]=qs['offset'](_0x1c81e8[_0x5c33('0x32')][_0x5c33('0x1f')]);}_0x563245[_0x5c33('0x3b')]=qs[_0x5c33('0x3c')](_0x1c81e8['query']['sort']);_0x563245[_0x5c33('0x3d')]=qs[_0x5c33('0x33')](_['pick'](_0x1c81e8[_0x5c33('0x32')],_0x3859bf[_0x5c33('0x33')]),_0x2948b5);if(_0x1c81e8['query'][_0x5c33('0x3e')]){_0x563245[_0x5c33('0x3d')]=_[_0x5c33('0x3f')](_0x563245[_0x5c33('0x3d')],{'$or':_[_0x5c33('0x40')](_0x563245['attributes'],function(_0x20d3a1){var _0x561f45={};_0x561f45[_0x20d3a1]={'$like':'%'+_0x1c81e8[_0x5c33('0x32')]['filter']+'%'};return _0x561f45;})});}_0x563245=_[_0x5c33('0x3f')]({},_0x563245,_0x1c81e8[_0x5c33('0x41')]);var _0x269d69={'where':_0x563245['where']};return db[_0x5c33('0x2f')][_0x5c33('0x20')](_0x269d69)[_0x5c33('0x27')](function(_0x2df9ba){_0x14c28e[_0x5c33('0x20')]=_0x2df9ba;if(_0x1c81e8[_0x5c33('0x32')][_0x5c33('0x42')]){_0x563245['include']=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x563245);})['then'](function(_0x210e14){_0x14c28e[_0x5c33('0x43')]=_0x210e14;return _0x14c28e;})[_0x5c33('0x27')](respondWithFilteredResult(_0x378eba,_0x563245))[_0x5c33('0x44')](handleError(_0x378eba,null));})[_0x5c33('0x44')](handleError(_0x378eba,null));};exports[_0x5c33('0x45')]=function(_0x57e715,_0x2962e1){var _0x146497={'raw':![],'where':{'id':_0x57e715[_0x5c33('0x46')]['id']}},_0x213b6a={};_0x213b6a[_0x5c33('0x35')]=_[_0x5c33('0x31')](db[_0x5c33('0x2f')][_0x5c33('0x47')]);_0x213b6a['query']=_[_0x5c33('0x31')](_0x57e715[_0x5c33('0x32')]);_0x213b6a[_0x5c33('0x33')]=_[_0x5c33('0x34')](_0x213b6a[_0x5c33('0x35')],_0x213b6a[_0x5c33('0x32')]);_0x146497['attributes']=_['intersection'](_0x213b6a[_0x5c33('0x35')],qs[_0x5c33('0x36')](_0x57e715[_0x5c33('0x32')]['fields']));_0x146497[_0x5c33('0x37')]=_0x146497[_0x5c33('0x37')][_0x5c33('0x38')]?_0x146497[_0x5c33('0x37')]:_0x213b6a['model'];if(_0x57e715[_0x5c33('0x32')][_0x5c33('0x42')]){_0x146497[_0x5c33('0x48')]=[{'all':!![]}];}_0x146497=_[_0x5c33('0x3f')]({},_0x146497,_0x57e715[_0x5c33('0x41')]);return db[_0x5c33('0x2f')][_0x5c33('0x49')](_0x146497)[_0x5c33('0x27')](handleEntityNotFound(_0x2962e1,null))[_0x5c33('0x27')](respondWithResult(_0x2962e1,null))['catch'](handleError(_0x2962e1,null));};exports[_0x5c33('0x4a')]=function(_0x16afe3,_0x1131dd){return db['CmCompany'][_0x5c33('0x4a')](_0x16afe3[_0x5c33('0x4b')],{})[_0x5c33('0x27')](function(_0x2abbae){var _0x2c7629=_0x16afe3[_0x5c33('0x4c')][_0x5c33('0x29')]({'plain':!![]});if(!_0x2c7629)throw new Error(_0x5c33('0x4d'));if(_0x2c7629['role']===_0x5c33('0x4c')){var _0x4535e2=_0x2abbae['get']({'plain':!![]});var _0x572ace='Companies';return db[_0x5c33('0x4e')][_0x5c33('0x49')]({'where':{'name':_0x572ace,'userProfileId':_0x2c7629['userProfileId']},'raw':!![]})[_0x5c33('0x27')](function(_0x1d194c){if(_0x1d194c&&_0x1d194c[_0x5c33('0x4f')]===0x0){return db[_0x5c33('0x50')][_0x5c33('0x4a')]({'name':_0x4535e2['name'],'resourceId':_0x4535e2['id'],'type':_0x1d194c[_0x5c33('0x2c')],'sectionId':_0x1d194c['id']},{})[_0x5c33('0x27')](function(){return _0x2abbae;});}else{return _0x2abbae;}})['catch'](function(_0x57dfbe){logger[_0x5c33('0x51')](_0x5c33('0x52'),_0x57dfbe);throw _0x57dfbe;});}return _0x2abbae;})['then'](respondWithResult(_0x1131dd,0xc9))['catch'](handleError(_0x1131dd,null));};exports[_0x5c33('0x26')]=function(_0xcca135,_0x43d628){if(_0xcca135['body']['id']){delete _0xcca135[_0x5c33('0x4b')]['id'];}return db[_0x5c33('0x2f')][_0x5c33('0x49')]({'where':{'id':_0xcca135[_0x5c33('0x46')]['id']}})[_0x5c33('0x27')](handleEntityNotFound(_0x43d628,null))[_0x5c33('0x27')](saveUpdates(_0xcca135['body'],null))[_0x5c33('0x27')](respondWithResult(_0x43d628,null))[_0x5c33('0x44')](handleError(_0x43d628,null));};exports[_0x5c33('0x28')]=function(_0x49c60c,_0x374bd2){return db[_0x5c33('0x2f')][_0x5c33('0x49')]({'where':{'id':_0x49c60c['params']['id']}})[_0x5c33('0x27')](handleEntityNotFound(_0x374bd2,null))[_0x5c33('0x27')](removeEntity(_0x374bd2,null))[_0x5c33('0x44')](handleError(_0x374bd2,null));};exports[_0x5c33('0x30')]=function(_0x739f85,_0x597c38){return db[_0x5c33('0x2f')][_0x5c33('0x30')]()[_0x5c33('0x27')](respondWithResult(_0x597c38,null))[_0x5c33('0x44')](handleError(_0x597c38,null));};exports[_0x5c33('0x53')]=function(_0x1d7de9,_0xd5df7d,_0x2524e3){return db['CmContact'][_0x5c33('0x49')]({'where':{'id':_0x1d7de9['params']['id']}})[_0x5c33('0x27')](handleEntityNotFound(_0xd5df7d,null))[_0x5c33('0x27')](function(_0x3d4143){if(_0x3d4143){return _0x3d4143[_0x5c33('0x53')](_0x1d7de9[_0x5c33('0x4b')][_0x5c33('0x54')],_[_0x5c33('0x55')](_0x1d7de9['body'],['ids','id'])||{});}})['then'](respondWithResult(_0xd5df7d,null))['catch'](handleError(_0xd5df7d,null));};exports[_0x5c33('0x56')]=function(_0x1df24d,_0x40788e,_0x144d50){var _0x9c7aff={};var _0xb1bc24={};var _0x239645;var _0x4a59c9;return db[_0x5c33('0x2f')][_0x5c33('0x57')]({'where':{'id':_0x1df24d['params']['id']}})[_0x5c33('0x27')](handleEntityNotFound(_0x40788e,null))[_0x5c33('0x27')](function(_0x6924fa){if(_0x6924fa){_0x239645=_0x6924fa;_0xb1bc24[_0x5c33('0x35')]=_[_0x5c33('0x31')](db[_0x5c33('0x58')][_0x5c33('0x47')]);_0xb1bc24['query']=_[_0x5c33('0x31')](_0x1df24d[_0x5c33('0x32')]);_0xb1bc24[_0x5c33('0x33')]=_[_0x5c33('0x34')](_0xb1bc24[_0x5c33('0x35')],_0xb1bc24[_0x5c33('0x32')]);_0x9c7aff[_0x5c33('0x37')]=_['intersection'](_0xb1bc24[_0x5c33('0x35')],qs[_0x5c33('0x36')](_0x1df24d[_0x5c33('0x32')][_0x5c33('0x36')]));_0x9c7aff[_0x5c33('0x37')]=_0x9c7aff[_0x5c33('0x37')][_0x5c33('0x38')]?_0x9c7aff[_0x5c33('0x37')]:_0xb1bc24[_0x5c33('0x35')];_0x9c7aff[_0x5c33('0x3b')]=qs[_0x5c33('0x3c')](_0x1df24d['query'][_0x5c33('0x3c')]);_0x9c7aff[_0x5c33('0x3d')]=qs['filters'](_[_0x5c33('0x59')](_0x1df24d[_0x5c33('0x32')],_0xb1bc24[_0x5c33('0x33')]));if(_0x1df24d['query']['filter']){_0x9c7aff[_0x5c33('0x3d')]=_['merge'](_0x9c7aff[_0x5c33('0x3d')],{'$or':_[_0x5c33('0x40')](_0x9c7aff[_0x5c33('0x37')],function(_0xae063b){var _0x40017c={};_0x40017c[_0xae063b]={'$like':'%'+_0x1df24d[_0x5c33('0x32')]['filter']+'%'};return _0x40017c;})});}_0x9c7aff=_[_0x5c33('0x3f')]({},_0x9c7aff,_0x1df24d['options']);return _0x239645[_0x5c33('0x56')](_0x9c7aff);}})['then'](function(_0x2330d9){if(_0x2330d9){_0x4a59c9=_0x2330d9['length'];if(!_0x1df24d[_0x5c33('0x32')][_0x5c33('0x39')]('nolimit')){_0x9c7aff[_0x5c33('0x1e')]=qs[_0x5c33('0x1e')](_0x1df24d['query'][_0x5c33('0x1e')]);_0x9c7aff[_0x5c33('0x1f')]=qs['offset'](_0x1df24d['query']['offset']);}return _0x239645[_0x5c33('0x56')](_0x9c7aff);}})[_0x5c33('0x27')](function(_0x40bf43){if(_0x40bf43){return _0x40bf43?{'count':_0x4a59c9,'rows':_0x40bf43}:null;}})[_0x5c33('0x27')](respondWithResult(_0x40788e,null))[_0x5c33('0x44')](handleError(_0x40788e,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 760f8d0..6bcf5de 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 _0x2831=['moment','rimraf','../../config/environment','./cmCompany.attributes','exports','define','cm_companies','lodash','util','api'];(function(_0x54a2e4,_0x1ff92c){var _0x4742d0=function(_0x147a6f){while(--_0x147a6f){_0x54a2e4['push'](_0x54a2e4['shift']());}};_0x4742d0(++_0x1ff92c);}(_0x2831,0xed));var _0x1283=function(_0x390785,_0x55f296){_0x390785=_0x390785-0x0;var _0x476272=_0x2831[_0x390785];return _0x476272;};'use strict';var _=require(_0x1283('0x0'));var util=require(_0x1283('0x1'));var logger=require('../../config/logger')(_0x1283('0x2'));var moment=require(_0x1283('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1283('0x4'));var config=require(_0x1283('0x5'));var attributes=require(_0x1283('0x6'));module[_0x1283('0x7')]=function(_0x142860,_0x4453e3){return _0x142860[_0x1283('0x8')]('CmCompany',attributes,{'tableName':_0x1283('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb979=['cm_companies','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb979,0x157));var _0x9b97=function(_0x231a5a,_0x5ade5c){_0x231a5a=_0x231a5a-0x0;var _0x53a856=_0xb979[_0x231a5a];return _0x53a856;};'use strict';var _=require(_0x9b97('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9b97('0x1'));var moment=require(_0x9b97('0x2'));var BPromise=require(_0x9b97('0x3'));var rp=require(_0x9b97('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9b97('0x5'));var config=require(_0x9b97('0x6'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x3f15ed,_0x46e3ae){return _0x3f15ed[_0x9b97('0x7')]('CmCompany',attributes,{'tableName':_0x9b97('0x8'),'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 5907a96..3456b39 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 _0x3201=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x310319,_0x2acf87){var _0x1d9d4c=function(_0x1f67dd){while(--_0x1f67dd){_0x310319['push'](_0x310319['shift']());}};_0x1d9d4c(++_0x2acf87);}(_0x3201,0x17c));var _0x1320=function(_0x2a8c21,_0x163576){_0x2a8c21=_0x2a8c21-0x0;var _0x5f3061=_0x3201[_0x2a8c21];return _0x5f3061;};'use strict';var _=require(_0x1320('0x0'));var util=require(_0x1320('0x1'));var moment=require(_0x1320('0x2'));var BPromise=require(_0x1320('0x3'));var rs=require(_0x1320('0x4'));var fs=require('fs');var Redis=require(_0x1320('0x5'));var db=require(_0x1320('0x6'))['db'];var utils=require(_0x1320('0x7'));var logger=require(_0x1320('0x8'))(_0x1320('0x9'));var config=require(_0x1320('0xa'));var jayson=require(_0x1320('0xb'));var client=jayson[_0x1320('0xc')][_0x1320('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3ae9d7,_0xf3decf,_0x3ccb60){return new BPromise(function(_0xbbfcb4,_0x30b161){return client['request'](_0x3ae9d7,_0x3ccb60)[_0x1320('0xe')](function(_0x3fca3a){logger[_0x1320('0xf')](_0x1320('0x10'),_0xf3decf,'request\x20sent');logger[_0x1320('0x11')](_0x1320('0x12'),_0xf3decf,_0x1320('0x13'),JSON['stringify'](_0x3fca3a));if(_0x3fca3a[_0x1320('0x14')]){if(_0x3fca3a[_0x1320('0x14')][_0x1320('0x15')]===0x1f4){logger[_0x1320('0x14')]('CmCompany,\x20%s,\x20%s',_0xf3decf,_0x3fca3a[_0x1320('0x14')][_0x1320('0x16')]);return _0x30b161(_0x3fca3a['error'][_0x1320('0x16')]);}logger[_0x1320('0x14')](_0x1320('0x10'),_0xf3decf,_0x3fca3a['error']['message']);return _0xbbfcb4(_0x3fca3a[_0x1320('0x14')][_0x1320('0x16')]);}else{logger[_0x1320('0xf')](_0x1320('0x10'),_0xf3decf,_0x1320('0x13'));_0xbbfcb4(_0x3fca3a[_0x1320('0x17')][_0x1320('0x16')]);}})[_0x1320('0x18')](function(_0x29ee7b){logger[_0x1320('0x14')](_0x1320('0x10'),_0xf3decf,_0x29ee7b);_0x30b161(_0x29ee7b);});});} \ No newline at end of file +var _0xaa5b=['rpc','jayson/promise','http','request','then','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5cb22e,_0x816435){var _0x426ec5=function(_0x336291){while(--_0x336291){_0x5cb22e['push'](_0x5cb22e['shift']());}};_0x426ec5(++_0x816435);}(_0xaa5b,0x78));var _0xbaa5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa5b[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xbaa5('0x0'));var moment=require('moment');var BPromise=require(_0xbaa5('0x1'));var rs=require(_0xbaa5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbaa5('0x3'))['db'];var utils=require(_0xbaa5('0x4'));var logger=require(_0xbaa5('0x5'))(_0xbaa5('0x6'));var config=require('../../config/environment');var jayson=require(_0xbaa5('0x7'));var client=jayson['client'][_0xbaa5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f3453,_0x954bd1,_0x399c75){return new BPromise(function(_0x6460f3,_0x83956c){return client[_0xbaa5('0x9')](_0x1f3453,_0x399c75)[_0xbaa5('0xa')](function(_0x23ab2d){logger['info'](_0xbaa5('0xb'),_0x954bd1,'request\x20sent');logger[_0xbaa5('0xc')](_0xbaa5('0xd'),_0x954bd1,_0xbaa5('0xe'),JSON[_0xbaa5('0xf')](_0x23ab2d));if(_0x23ab2d[_0xbaa5('0x10')]){if(_0x23ab2d['error']['code']===0x1f4){logger[_0xbaa5('0x10')](_0xbaa5('0xb'),_0x954bd1,_0x23ab2d[_0xbaa5('0x10')][_0xbaa5('0x11')]);return _0x83956c(_0x23ab2d[_0xbaa5('0x10')]['message']);}logger['error'](_0xbaa5('0xb'),_0x954bd1,_0x23ab2d[_0xbaa5('0x10')]['message']);return _0x6460f3(_0x23ab2d[_0xbaa5('0x10')][_0xbaa5('0x11')]);}else{logger[_0xbaa5('0x12')]('CmCompany,\x20%s,\x20%s',_0x954bd1,_0xbaa5('0xe'));_0x6460f3(_0x23ab2d[_0xbaa5('0x13')]['message']);}})[_0xbaa5('0x14')](function(_0x3ae27c){logger[_0xbaa5('0x10')](_0xbaa5('0xb'),_0x954bd1,_0x3ae27c);_0x83956c(_0x3ae27c);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 9e1b805..323595a 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 _0x3cca=['getContacts','post','create','addContacts','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','/:id/contacts'];(function(_0x1a9ed0,_0x1085fc){var _0x47bbd6=function(_0x27bd1c){while(--_0x27bd1c){_0x1a9ed0['push'](_0x1a9ed0['shift']());}};_0x47bbd6(++_0x1085fc);}(_0x3cca,0xce));var _0xa3cc=function(_0x5a76f7,_0xbc12b9){_0x5a76f7=_0x5a76f7-0x0;var _0x2f23d3=_0x3cca[_0x5a76f7];return _0x2f23d3;};'use strict';var multer=require(_0xa3cc('0x0'));var util=require(_0xa3cc('0x1'));var path=require(_0xa3cc('0x2'));var timeout=require('connect-timeout');var express=require(_0xa3cc('0x3'));var router=express[_0xa3cc('0x4')]();var fs_extra=require(_0xa3cc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa3cc('0x6'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router['get']('/',auth[_0xa3cc('0x7')](),controller[_0xa3cc('0x8')]);router[_0xa3cc('0x9')](_0xa3cc('0xa'),auth['isAuthenticated'](),controller[_0xa3cc('0xb')]);router[_0xa3cc('0x9')](_0xa3cc('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa3cc('0x9')](_0xa3cc('0xd'),auth[_0xa3cc('0x7')](),controller[_0xa3cc('0xe')]);router[_0xa3cc('0xf')]('/',auth[_0xa3cc('0x7')](),controller[_0xa3cc('0x10')]);router[_0xa3cc('0xf')](_0xa3cc('0xd'),auth['isAuthenticated'](),controller[_0xa3cc('0x11')]);router[_0xa3cc('0x12')](_0xa3cc('0xc'),auth[_0xa3cc('0x7')](),controller['update']);router[_0xa3cc('0x13')](_0xa3cc('0xc'),auth['isAuthenticated'](),controller[_0xa3cc('0x14')]);module[_0xa3cc('0x15')]=router; \ No newline at end of file +var _0xdac3=['/:id','show','getContacts','post','create','/:id/contacts','addContacts','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/describe'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xdac3,0x1ec));var _0x3dac=function(_0x39853d,_0x2501bf){_0x39853d=_0x39853d-0x0;var _0x5864ca=_0xdac3[_0x39853d];return _0x5864ca;};'use strict';var multer=require(_0x3dac('0x0'));var util=require(_0x3dac('0x1'));var path=require(_0x3dac('0x2'));var timeout=require('connect-timeout');var express=require(_0x3dac('0x3'));var router=express[_0x3dac('0x4')]();var fs_extra=require(_0x3dac('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3dac('0x6'));var config=require(_0x3dac('0x7'));var controller=require(_0x3dac('0x8'));router[_0x3dac('0x9')]('/',auth[_0x3dac('0xa')](),controller['index']);router['get'](_0x3dac('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x3dac('0xc'),auth[_0x3dac('0xa')](),controller[_0x3dac('0xd')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0x3dac('0xe')]);router[_0x3dac('0xf')]('/',auth[_0x3dac('0xa')](),controller[_0x3dac('0x10')]);router['post'](_0x3dac('0x11'),auth[_0x3dac('0xa')](),controller[_0x3dac('0x12')]);router[_0x3dac('0x13')](_0x3dac('0xc'),auth[_0x3dac('0xa')](),controller[_0x3dac('0x14')]);router[_0x3dac('0x15')](_0x3dac('0xc'),auth['isAuthenticated'](),controller[_0x3dac('0x16')]);module[_0x3dac('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 6a75745..01b9f69 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 _0x2136=['DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x2ab64d,_0x393c32){var _0xa365c2=function(_0x5087ce){while(--_0x5087ce){_0x2ab64d['push'](_0x2ab64d['shift']());}};_0xa365c2(++_0x393c32);}(_0x2136,0x152));var _0x6213=function(_0x45ccf6,_0x187595){_0x45ccf6=_0x45ccf6-0x0;var _0x140e18=_0x2136[_0x45ccf6];return _0x140e18;};'use strict';var _=require(_0x6213('0x0'));var Sequelize=require(_0x6213('0x1'));module[_0x6213('0x2')]={'firstName':{'type':Sequelize[_0x6213('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x6213('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x6213('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6213('0x4')]},'phone':{'type':Sequelize[_0x6213('0x3')]},'mobile':{'type':Sequelize[_0x6213('0x3')]},'fax':{'type':Sequelize[_0x6213('0x3')]},'email':{'type':Sequelize[_0x6213('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x6213('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x6213('0x3')]},'skype':{'type':Sequelize[_0x6213('0x3')]},'teams':{'type':Sequelize[_0x6213('0x3')]},'viber':{'type':Sequelize[_0x6213('0x3')]},'line':{'type':Sequelize[_0x6213('0x3')]},'wechat':{'type':Sequelize[_0x6213('0x3')]},'telegram':{'type':Sequelize[_0x6213('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x6213('0x5')],'defaultValue':Sequelize[_0x6213('0x6')]}}; \ No newline at end of file +var _0xc43f=['DATE','NOW','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0xe82af4,_0x52319f){var _0x466772=function(_0x694b5d){while(--_0x694b5d){_0xe82af4['push'](_0xe82af4['shift']());}};_0x466772(++_0x52319f);}(_0xc43f,0x12a));var _0xfc43=function(_0x414e89,_0x7f6091){_0x414e89=_0x414e89-0x0;var _0x27e26c=_0xc43f[_0x414e89];return _0x27e26c;};'use strict';var _=require('lodash');var Sequelize=require(_0xfc43('0x0'));module[_0xfc43('0x1')]={'firstName':{'type':Sequelize[_0xfc43('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xfc43('0x2')]},'street':{'type':Sequelize[_0xfc43('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xfc43('0x2')]},'country':{'type':Sequelize[_0xfc43('0x2')]},'dateOfBirth':{'type':Sequelize[_0xfc43('0x2')]},'description':{'type':Sequelize[_0xfc43('0x3')]},'phone':{'type':Sequelize[_0xfc43('0x2')]},'mobile':{'type':Sequelize[_0xfc43('0x2')]},'fax':{'type':Sequelize[_0xfc43('0x2')]},'email':{'type':Sequelize[_0xfc43('0x2')]},'url':{'type':Sequelize[_0xfc43('0x2')]},'facebook':{'type':Sequelize[_0xfc43('0x2')]},'fb_data':{'type':Sequelize[_0xfc43('0x2')]},'twitter':{'type':Sequelize[_0xfc43('0x2')]},'skype':{'type':Sequelize[_0xfc43('0x2')]},'teams':{'type':Sequelize[_0xfc43('0x2')]},'viber':{'type':Sequelize[_0xfc43('0x2')]},'line':{'type':Sequelize[_0xfc43('0x2')]},'wechat':{'type':Sequelize[_0xfc43('0x2')]},'telegram':{'type':Sequelize[_0xfc43('0x2')]},'UserId':{'type':Sequelize[_0xfc43('0x4')]},'priority':{'type':Sequelize[_0xfc43('0x4')](0x2)[_0xfc43('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xfc43('0x6')],'defaultValue':Sequelize[_0xfc43('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 079efd6..17365dd 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 _0x07f6=['Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','file','filename','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','parse','import','binding','No\x20phone\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','mail','chat','fax','whatsapp','voice','-createdAt','resolve','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','uniqueid','source','destination','starttime','endtime','duration','note','userDisposition','userSecondDisposition','userThirdDisposition','fullname','createdAt','findAndCountAll','startCase','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','Account','Owner','browserName','customerIp','deviceModel','osName','ratingType','subject','substatus','openchannel','threadId','Interaction','sortBy','reverse','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','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','CmContact','describe','keys','length','startsWith','push','CmCustomField','findOne','trimStart','cf_','all','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','select','field','from','cm_contacts','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','sqlOperator','conditions','find','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','dateOfBirth','fieldType','datetime','DATE','buildExpression','text','value','start','end','hasOwnProperty','filter','isNil','Contact','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.fax','c.email','c.ListId','c.createdAt','c.CompanyId','TagIds','Tags','rows','catch','columnName','displayName','findAll','alias','custom','values','body','get','mergeWith','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','bulkCreate','each','duplicates','$or','findOrCreate','spread','params','color','$and','omit','format','pickBy','cf_%d','setFields','id\x20=\x20?','phone','rawAttributes','pick','options','getTags','setTags','ids','getHoppers','ContactId','includeAll','include','getHopperHistories','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x07f6,0x17e));var _0x607f=function(_0x3a4318,_0x13c6eb){_0x3a4318=_0x3a4318-0x0;var _0x36d746=_0x07f6[_0x3a4318];return _0x36d746;};'use strict';var emlformat=require(_0x607f('0x0'));var rimraf=require(_0x607f('0x1'));var zipdir=require(_0x607f('0x2'));var jsonpatch=require(_0x607f('0x3'));var rp=require(_0x607f('0x4'));var moment=require(_0x607f('0x5'));var BPromise=require(_0x607f('0x6'));var Mustache=require('mustache');var util=require(_0x607f('0x7'));var path=require(_0x607f('0x8'));var sox=require(_0x607f('0x9'));var csv=require(_0x607f('0xa'));var ejs=require(_0x607f('0xb'));var fs=require('fs');var fs_extra=require(_0x607f('0xc'));var _=require('lodash');var squel=require(_0x607f('0xd'));var crypto=require(_0x607f('0xe'));var jsforce=require(_0x607f('0xf'));var deskjs=require(_0x607f('0x10'));var toCsv=require('to-csv');var querystring=require(_0x607f('0x11'));var Papa=require(_0x607f('0x12'));var Redis=require(_0x607f('0x13'));var authService=require(_0x607f('0x14'));var qs=require(_0x607f('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x607f('0x16'));var logger=require(_0x607f('0x17'))(_0x607f('0x18'));var utils=require('../../config/utils');var config=require(_0x607f('0x19'));var licenseUtil=require(_0x607f('0x1a'));var db=require('../../mysqldb')['db'];config[_0x607f('0x1b')]=_[_0x607f('0x1c')](config['redis'],{'host':_0x607f('0x1d'),'port':0x18eb});var socket=require(_0x607f('0x1e'))(new Redis(config[_0x607f('0x1b')]));require(_0x607f('0x1f'))[_0x607f('0x20')](socket);function respondWithStatusCode(_0x4e08e1,_0x441840){_0x441840=_0x441840||0xcc;return function(_0x1a5194){if(_0x1a5194){return _0x4e08e1[_0x607f('0x21')](_0x441840);}return _0x4e08e1[_0x607f('0x22')](_0x441840)['end']();};}function respondWithResult(_0x10534a,_0x28f2c5){_0x28f2c5=_0x28f2c5||0xc8;return function(_0x41650b){if(_0x41650b){return _0x10534a['status'](_0x28f2c5)[_0x607f('0x23')](_0x41650b);}};}function respondWithFilteredResult(_0x59a6ac,_0x37f053){return function(_0x3da3ff){if(_0x3da3ff){var _0x598ef0=typeof _0x37f053['offset']===_0x607f('0x24')&&typeof _0x37f053[_0x607f('0x25')]===_0x607f('0x24');var _0x32b8cd=_0x3da3ff[_0x607f('0x26')];var _0x522032=_0x598ef0?0x0:_0x37f053[_0x607f('0x27')];var _0xaa04bb=_0x598ef0?_0x3da3ff[_0x607f('0x26')]:_0x37f053['offset']+_0x37f053[_0x607f('0x25')];var _0x4b4344;if(_0xaa04bb>=_0x32b8cd){_0xaa04bb=_0x32b8cd;_0x4b4344=0xc8;}else{_0x4b4344=0xce;}_0x59a6ac['status'](_0x4b4344);return _0x59a6ac[_0x607f('0x28')](_0x607f('0x29'),_0x522032+'-'+_0xaa04bb+'/'+_0x32b8cd)['json'](_0x3da3ff);}return null;};}function patchUpdates(_0x425c81){return function(_0x8b01cf){try{jsonpatch[_0x607f('0x2a')](_0x8b01cf,_0x425c81,!![]);}catch(_0x32bcbe){return BPromise[_0x607f('0x2b')](_0x32bcbe);}return _0x8b01cf[_0x607f('0x2c')]();};}function saveUpdates(_0x811d81,_0x265373){return function(_0x46a49f){if(_0x46a49f){return _0x46a49f[_0x607f('0x2d')](_0x811d81)['then'](function(_0x14ba4a){return _0x14ba4a;});}return null;};}function removeEntity(_0x441d75,_0xc8ca4b){return function(_0x454777){if(_0x454777){return _0x454777[_0x607f('0x2e')]()[_0x607f('0x2f')](function(){_0x441d75[_0x607f('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x508297,_0x162bf4){return function(_0x58c073){if(!_0x58c073){_0x508297[_0x607f('0x21')](0x194);}return _0x58c073;};}function handleError(_0x1896f,_0x2792d8){_0x2792d8=_0x2792d8||0x1f4;return function(_0x576781){logger['error'](_0x576781['stack']);if(_0x576781[_0x607f('0x30')]){delete _0x576781[_0x607f('0x30')];}_0x1896f['status'](_0x2792d8)[_0x607f('0x31')](_0x576781);};}exports[_0x607f('0x32')]=function(_0x7a5624,_0x369725){var _0x3719ca={},_0x2afa87={},_0x15c195={'count':0x0,'rows':[]};return db[_0x607f('0x33')][_0x607f('0x34')]()[_0x607f('0x2f')](function(_0xad25bd){var _0x56a7ef=[];for(var _0x18fe9d=0x0;_0x18fe9d0x1){_0x30aa91['or'](_0x607f('0x74'),qs[_0x607f('0x75')](_0x4cf804),null);}else{if(qs[_0x607f('0x76')](_0x4cf804)){_0x30aa91['or'](_0x607f('0x77'),_0x4cf804+'%');_0x30aa91['or'](_0x607f('0x78'),_0x4cf804+'%');_0x30aa91['or'](_0x607f('0x79'),_0x4cf804+'%');_0x30aa91['or'](_0x607f('0x7a'),_0x4cf804+'%');}else if(qs[_0x607f('0x7b')](_0x4cf804)){_0x30aa91['or'](_0x607f('0x7c'),_0x4cf804+'%');}else{_0x30aa91['or'](_0x607f('0x7d'),'%'+_0x4cf804+'%');_0x30aa91['or'](_0x607f('0x7e'),'%'+_0x4cf804+'%');_0x30aa91['or'](_0x607f('0x7c'),'%'+_0x4cf804+'%');}}}}_0x14f75c['where'](_0x30aa91);_0x14f75c[_0x607f('0x7f')](_0x607f('0x80'));var _0x24728a={'type':db[_0x607f('0x81')][_0x607f('0x82')][_0x607f('0x83')],'raw':!![]};var _0x188d92=_0x14f75c[_0x607f('0x84')]()[_0x607f('0x4a')](_0x607f('0x80'));if(_0x3719ca[_0x607f('0x46')]){_0x3719ca[_0x607f('0x46')][_0x607f('0x5a')](function(_0x242eae){_0x14f75c[_0x607f('0x46')]('c.'+_0x242eae[0x0],_0x242eae[0x1]===_0x607f('0x85')?![]:!![]);});}if(!_[_0x607f('0x6c')](_0x404be8)){_0x14f75c[_0x607f('0x86')](_0x20b253);_0x188d92[_0x607f('0x48')](_0x607f('0x87'),_0x404be8);}BPromise['resolve']()[_0x607f('0x2f')](function(){if(!_0x404f80)return;if(_0x7a5624[_0x607f('0x88')][_0x607f('0x89')]!==_0x607f('0x8a'))return;if(!_[_0x607f('0x8b')](_0x404f80[_0x607f('0x55')],[_0x607f('0x4a'),_0x607f('0x5d')])){return _0x7a5624[_0x607f('0x88')][_0x607f('0x8c')]({'attributes':['id'],'raw':!![]})[_0x607f('0x2f')](function(_0x3efa67){if(_[_0x607f('0x6c')](_0x3efa67)){_0x188d92[_0x607f('0x48')](_0x607f('0x8d'));_0x14f75c[_0x607f('0x48')](_0x607f('0x8d'));}else{_0x188d92[_0x607f('0x48')]('c.ListId\x20IN\x20?',_[_0x607f('0x59')](_0x3efa67,'id'));_0x14f75c[_0x607f('0x48')](_0x607f('0x8e'),_[_0x607f('0x59')](_0x3efa67,'id'));}});}})[_0x607f('0x2f')](function(){if(_0x7a5624[_0x607f('0x88')][_0x607f('0x89')]==='agent'&&!_0x404f80&&!_0x7a5624[_0x607f('0x40')][_0x607f('0x6d')])return[];return db[_0x607f('0x8f')]['query'](_0x188d92[_0x607f('0x90')](),_0x24728a);})[_0x607f('0x2f')](function(_0x195c0a){_0x15c195[_0x607f('0x26')]=_0x195c0a[_0x607f('0x36')];if(_0x15c195[_0x607f('0x26')]===0x0)return[];return db[_0x607f('0x8f')]['query'](_0x148b8f[_0x607f('0x90')](),_0x24728a)['then'](function(_0x4bc208){_0x29d6b9=_[_0x607f('0x91')](_0x4bc208,'id');_0x24728a=_[_0x607f('0x92')](_0x24728a,{'model':db[_0x607f('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x7a5624['query'][_0x607f('0x44')]){_0x3719ca[_0x607f('0x43')][_0x607f('0x5a')](function(_0x6a5333){_0x14f75c['field']('c.'+_0x6a5333);});}else{_0x14f75c[_0x607f('0x4a')](_0x607f('0x80'));_0x14f75c['field'](_0x607f('0x93'));_0x14f75c['field'](_0x607f('0x94'));_0x14f75c['field'](_0x607f('0x95'));_0x14f75c[_0x607f('0x4a')]('c.mobile');_0x14f75c[_0x607f('0x4a')](_0x607f('0x96'));_0x14f75c[_0x607f('0x4a')](_0x607f('0x97'));_0x14f75c[_0x607f('0x4a')](_0x607f('0x98'));_0x14f75c[_0x607f('0x4a')](_0x607f('0x99'));_0x14f75c[_0x607f('0x4a')]('c.deletedAt');_0x14f75c[_0x607f('0x4a')](_0x607f('0x9a'));_0x14f75c[_0x607f('0x4a')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x607f('0x9b'));}if(_0x3719ca[_0x607f('0x25')])_0x14f75c['limit'](_0x3719ca['limit']);if(_0x3719ca[_0x607f('0x27')])_0x14f75c[_0x607f('0x27')](_0x3719ca[_0x607f('0x27')]);return db[_0x607f('0x8f')]['query'](_0x14f75c['toString'](),_0x24728a);});})[_0x607f('0x2f')](function(_0x3b66e9){_0x3b66e9[_0x607f('0x5a')](function(_0x3486f5){if(_0x3486f5[_0x607f('0x9b')]){_0x3486f5[_0x607f('0x9c')]=[];_0x3486f5[_0x607f('0x9b')][_0x607f('0x58')](',')[_0x607f('0x5a')](function(_0x3b266e){_0x3486f5['Tags']['push'](_0x29d6b9[_0x3b266e]);});}delete _0x3486f5[_0x607f('0x9b')];});_0x15c195[_0x607f('0x9d')]=_0x3b66e9;return _0x15c195;})[_0x607f('0x2f')](respondWithFilteredResult(_0x369725,_0x3719ca));})[_0x607f('0x9e')](handleError(_0x369725,null));};exports['destroy']=function(_0x497e94,_0x28fac5){return db[_0x607f('0x33')][_0x607f('0x56')]({'where':{'id':_0x497e94['params']['id']}})[_0x607f('0x2f')](handleEntityNotFound(_0x28fac5,null))[_0x607f('0x2f')](removeEntity(_0x28fac5,null))[_0x607f('0x9e')](handleError(_0x28fac5,null));};exports[_0x607f('0x34')]=function(_0x5ad85d,_0x1e65ff){return db[_0x607f('0x33')][_0x607f('0x34')]()[_0x607f('0x2f')](function(_0x387096){delete _0x387096['tags'];for(var _0x1416ce=0x0;_0x1416ce=_0x3d7795){_0x2e054c=_0x3d7795;_0x3d3edf=0xc8;}else{_0x3d3edf=0xce;}_0x50c8b0[_0x5113('0x22')](_0x3d3edf);return _0x50c8b0[_0x5113('0x26')](_0x5113('0x27'),_0x16551a+'-'+_0x2e054c+'/'+_0x3d7795)[_0x5113('0x28')](_0x5a2b9f);}return null;};}function patchUpdates(_0x4705b2){return function(_0x1652c){try{jsonpatch[_0x5113('0x29')](_0x1652c,_0x4705b2,!![]);}catch(_0x43a53f){return BPromise[_0x5113('0x2a')](_0x43a53f);}return _0x1652c[_0x5113('0x2b')]();};}function saveUpdates(_0x5a941b,_0xe2607f){return function(_0x20379a){if(_0x20379a){return _0x20379a[_0x5113('0x2c')](_0x5a941b)[_0x5113('0x2d')](function(_0x42e043){return _0x42e043;});}return null;};}function removeEntity(_0x4c1ead,_0x293214){return function(_0x48a279){if(_0x48a279){return _0x48a279[_0x5113('0x2e')]()[_0x5113('0x2d')](function(){_0x4c1ead[_0x5113('0x22')](0xcc)[_0x5113('0x2f')]();});}};}function handleEntityNotFound(_0xd92ad0,_0x770e7b){return function(_0x4a5fd0){if(!_0x4a5fd0){_0xd92ad0['sendStatus'](0x194);}return _0x4a5fd0;};}function handleError(_0x16bed5,_0x2d546d){_0x2d546d=_0x2d546d||0x1f4;return function(_0xd58e84){logger[_0x5113('0x30')](_0xd58e84[_0x5113('0x31')]);if(_0xd58e84[_0x5113('0x32')]){delete _0xd58e84[_0x5113('0x32')];}_0x16bed5[_0x5113('0x22')](_0x2d546d)[_0x5113('0x33')](_0xd58e84);};}exports['index']=function(_0x3cab5a,_0x3d95e4){var _0x5c853e={},_0x393a19={},_0x26940b={'count':0x0,'rows':[]};return db['CmContact'][_0x5113('0x34')]()['then'](function(_0x88a47b){var _0x3f562e=[];for(var _0x50f5e2=0x0;_0x50f5e20x1){_0xd1b94b['or'](_0x5113('0x73'),qs[_0x5113('0x74')](_0x567811),null);}else{if(qs['isNumeric'](_0x567811)){_0xd1b94b['or'](_0x5113('0x75'),_0x567811+'%');_0xd1b94b['or']('c.phone\x20LIKE\x20?',_0x567811+'%');_0xd1b94b['or']('c.mobile\x20LIKE\x20?',_0x567811+'%');_0xd1b94b['or'](_0x5113('0x76'),_0x567811+'%');}else if(qs[_0x5113('0x77')](_0x567811)){_0xd1b94b['or']('c.email\x20LIKE\x20?',_0x567811+'%');}else{_0xd1b94b['or'](_0x5113('0x78'),'%'+_0x567811+'%');_0xd1b94b['or']('c.lastName\x20LIKE\x20?','%'+_0x567811+'%');_0xd1b94b['or'](_0x5113('0x79'),'%'+_0x567811+'%');}}}}_0x3c1b25['where'](_0xd1b94b);_0x3c1b25['group'](_0x5113('0x7a'));var _0x52364b={'type':db[_0x5113('0x7b')]['QueryTypes'][_0x5113('0x7c')],'raw':!![]};var _0x1bebda=_0x3c1b25[_0x5113('0x7d')]()[_0x5113('0x49')](_0x5113('0x7a'));if(_0x5c853e[_0x5113('0x45')]){_0x5c853e['order'][_0x5113('0x6b')](function(_0x446327){_0x3c1b25[_0x5113('0x45')]('c.'+_0x446327[0x0],_0x446327[0x1]===_0x5113('0x7e')?![]:!![]);});}if(!_[_0x5113('0x6a')](_0x397909)){_0x3c1b25[_0x5113('0x7f')](_0x13cf37);_0x1bebda[_0x5113('0x47')](_0x5113('0x80'),_0x397909);}BPromise[_0x5113('0x81')]()[_0x5113('0x2d')](function(){if(!_0x255028)return;if(_0x3cab5a[_0x5113('0x82')][_0x5113('0x83')]!==_0x5113('0x84'))return;if(!_[_0x5113('0x85')](_0x255028['conditions'],[_0x5113('0x49'),_0x5113('0x5c')])){return _0x3cab5a[_0x5113('0x82')][_0x5113('0x86')]({'attributes':['id'],'raw':!![]})[_0x5113('0x2d')](function(_0xf1fe94){if(_['isEmpty'](_0xf1fe94)){_0x1bebda[_0x5113('0x47')](_0x5113('0x87'));_0x3c1b25[_0x5113('0x47')]('c.ListId\x20IS\x20NULL');}else{_0x1bebda[_0x5113('0x47')]('c.ListId\x20IN\x20?',_[_0x5113('0x5a')](_0xf1fe94,'id'));_0x3c1b25[_0x5113('0x47')](_0x5113('0x6d'),_[_0x5113('0x5a')](_0xf1fe94,'id'));}});}})[_0x5113('0x2d')](function(){if(_0x3cab5a[_0x5113('0x82')][_0x5113('0x83')]===_0x5113('0x84')&&!_0x255028&&!_0x3cab5a[_0x5113('0x3d')][_0x5113('0x6c')])return[];return db[_0x5113('0x88')]['query'](_0x1bebda[_0x5113('0x89')](),_0x52364b);})[_0x5113('0x2d')](function(_0x48f277){_0x26940b[_0x5113('0x25')]=_0x48f277[_0x5113('0x35')];if(_0x26940b[_0x5113('0x25')]===0x0)return[];return db[_0x5113('0x88')][_0x5113('0x3d')](_0x373bed[_0x5113('0x89')](),_0x52364b)[_0x5113('0x2d')](function(_0x4b7278){_0x200bc9=_[_0x5113('0x8a')](_0x4b7278,'id');_0x52364b=_[_0x5113('0x8b')](_0x52364b,{'model':db[_0x5113('0x8c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3cab5a[_0x5113('0x3d')][_0x5113('0x8d')]){_0x5c853e[_0x5113('0x40')][_0x5113('0x6b')](function(_0x2233ba){_0x3c1b25[_0x5113('0x49')]('c.'+_0x2233ba);});}else{_0x3c1b25[_0x5113('0x49')]('c.id');_0x3c1b25[_0x5113('0x49')]('c.firstName');_0x3c1b25[_0x5113('0x49')]('c.lastName');_0x3c1b25[_0x5113('0x49')](_0x5113('0x8e'));_0x3c1b25[_0x5113('0x49')](_0x5113('0x8f'));_0x3c1b25[_0x5113('0x49')](_0x5113('0x90'));_0x3c1b25[_0x5113('0x49')](_0x5113('0x91'));_0x3c1b25['field'](_0x5113('0x92'));_0x3c1b25['field']('c.createdAt');_0x3c1b25[_0x5113('0x49')](_0x5113('0x93'));_0x3c1b25[_0x5113('0x49')](_0x5113('0x94'));_0x3c1b25[_0x5113('0x49')](_0x5113('0x95'),'TagIds');}if(_0x5c853e[_0x5113('0x44')])_0x3c1b25[_0x5113('0x44')](_0x5c853e['limit']);if(_0x5c853e[_0x5113('0x23')])_0x3c1b25['offset'](_0x5c853e[_0x5113('0x23')]);return db['sequelize']['query'](_0x3c1b25['toString'](),_0x52364b);});})['then'](function(_0x5374b7){_0x5374b7[_0x5113('0x6b')](function(_0x51fbb5){if(_0x51fbb5[_0x5113('0x96')]){_0x51fbb5[_0x5113('0x97')]=[];_0x51fbb5['TagIds']['split'](',')[_0x5113('0x6b')](function(_0x287640){_0x51fbb5[_0x5113('0x97')][_0x5113('0x39')](_0x200bc9[_0x287640]);});}delete _0x51fbb5['TagIds'];});_0x26940b[_0x5113('0x98')]=_0x5374b7;return _0x26940b;})[_0x5113('0x2d')](respondWithFilteredResult(_0x3d95e4,_0x5c853e));})[_0x5113('0x99')](handleError(_0x3d95e4,null));};exports[_0x5113('0x2e')]=function(_0x57d092,_0x3ed7c8){return db['CmContact'][_0x5113('0x9a')]({'where':{'id':_0x57d092['params']['id']}})[_0x5113('0x2d')](handleEntityNotFound(_0x3ed7c8,null))[_0x5113('0x2d')](removeEntity(_0x3ed7c8,null))['catch'](handleError(_0x3ed7c8,null));};exports[_0x5113('0x34')]=function(_0xe73c82,_0x5472ff){return db[_0x5113('0x8c')][_0x5113('0x34')]()[_0x5113('0x2d')](function(_0x50f8a1){delete _0x50f8a1[_0x5113('0x9b')];for(var _0x337ab6=0x0;_0x337ab6{}\s\\|]/g,'-');_0x2e5855(null,util[_0xd89e('0x22')](_0xd89e('0x23'),path['basename'](_0x391187['originalname'],path[_0xd89e('0x24')](_0x391187[_0xd89e('0x20')])),Date[_0xd89e('0x25')](),path['extname'](_0x391187[_0xd89e('0x20')])));}})});router['post'](_0xd89e('0x26'),upload[_0xd89e('0x27')]('file'),controller[_0xd89e('0x28')]);var upload=multer({'storage':multer[_0xd89e('0x29')]({'destination':function(_0x5dbef9,_0x155aad,_0x153989){_0x153989(null,path[_0xd89e('0x1d')](config[_0xd89e('0x1e')],_0xd89e('0x1f')));},'filename':function(_0x4e8711,_0x4e4427,_0x497fa4){_0x4e4427[_0xd89e('0x20')]=_0x4e4427[_0xd89e('0x20')][_0xd89e('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x497fa4(null,util[_0xd89e('0x22')](_0xd89e('0x23'),path[_0xd89e('0x2a')](_0x4e4427[_0xd89e('0x20')],path[_0xd89e('0x24')](_0x4e4427[_0xd89e('0x20')])),Date[_0xd89e('0x25')](),path[_0xd89e('0x24')](_0x4e4427[_0xd89e('0x20')])));}})});router[_0xd89e('0x17')]('/upload',upload['single'](_0xd89e('0x2b')),controller[_0xd89e('0x2c')]);router[_0xd89e('0x17')]('/upload/:id',auth[_0xd89e('0x7')](),controller[_0xd89e('0x2d')]);router[_0xd89e('0x2e')](_0xd89e('0xc'),auth[_0xd89e('0x7')](),controller[_0xd89e('0x2f')]);router['delete'](_0xd89e('0xc'),auth[_0xd89e('0x7')](),controller[_0xd89e('0x30')]);module['exports']=router; \ No newline at end of file +var _0xe9fe=['update','delete','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','/merge','merge','create','bulkCreate','setTags','diskStorage','join','root','server/files/tmp','originalname','format','%s-%s%s','basename','extname','now','single','uploadCsv','replace','file','upload','import','put'];(function(_0x52c5b0,_0x4e543e){var _0x3d98dc=function(_0x61633){while(--_0x61633){_0x52c5b0['push'](_0x52c5b0['shift']());}};_0x3d98dc(++_0x4e543e);}(_0xe9fe,0xfc));var _0xee9f=function(_0x4ded50,_0x4a6af3){_0x4ded50=_0x4ded50-0x0;var _0xa92135=_0xe9fe[_0x4ded50];return _0xa92135;};'use strict';var multer=require(_0xee9f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee9f('0x1'));var express=require(_0xee9f('0x2'));var router=express[_0xee9f('0x3')]();var fs_extra=require(_0xee9f('0x4'));var auth=require(_0xee9f('0x5'));var interaction=require(_0xee9f('0x6'));var config=require(_0xee9f('0x7'));var controller=require(_0xee9f('0x8'));router[_0xee9f('0x9')]('/',auth[_0xee9f('0xa')](),controller[_0xee9f('0xb')]);router[_0xee9f('0x9')](_0xee9f('0xc'),auth[_0xee9f('0xa')](),controller[_0xee9f('0xd')]);router[_0xee9f('0x9')](_0xee9f('0xe'),auth['isAuthenticated'](),controller[_0xee9f('0xf')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0xee9f('0x10')]);router[_0xee9f('0x9')](_0xee9f('0x11'),auth[_0xee9f('0xa')](),controller[_0xee9f('0x12')]);router['get'](_0xee9f('0x13'),auth[_0xee9f('0xa')](),controller[_0xee9f('0x14')]);router[_0xee9f('0x9')](_0xee9f('0x15'),auth[_0xee9f('0xa')](),controller[_0xee9f('0x16')]);router['get'](_0xee9f('0x17'),auth[_0xee9f('0xa')](),controller[_0xee9f('0x18')]);router['get']('/:id/journey',auth[_0xee9f('0xa')](),controller['getJourney']);router[_0xee9f('0x19')](_0xee9f('0x1a'),auth[_0xee9f('0xa')](),controller[_0xee9f('0x1b')]);router[_0xee9f('0x19')]('/',auth['isAuthenticated'](),controller[_0xee9f('0x1c')]);router[_0xee9f('0x19')]('/create_many',auth[_0xee9f('0xa')](),controller[_0xee9f('0x1d')]);router['post']('/:id/tags',auth[_0xee9f('0xa')](),controller[_0xee9f('0x1e')]);var upload=multer({'storage':multer[_0xee9f('0x1f')]({'destination':function(_0x17733e,_0x526d81,_0x5bc595){_0x5bc595(null,path[_0xee9f('0x20')](config[_0xee9f('0x21')],_0xee9f('0x22')));},'filename':function(_0x3024d9,_0x586a60,_0x275291){_0x586a60[_0xee9f('0x23')]=_0x586a60[_0xee9f('0x23')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x275291(null,util[_0xee9f('0x24')](_0xee9f('0x25'),path[_0xee9f('0x26')](_0x586a60[_0xee9f('0x23')],path[_0xee9f('0x27')](_0x586a60['originalname'])),Date[_0xee9f('0x28')](),path['extname'](_0x586a60[_0xee9f('0x23')])));}})});router[_0xee9f('0x19')]('/csv',upload[_0xee9f('0x29')]('file'),controller[_0xee9f('0x2a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x56f0df,_0x332e4e,_0x4556f){_0x4556f(null,path[_0xee9f('0x20')](config['root'],_0xee9f('0x22')));},'filename':function(_0x5248e0,_0x25594e,_0x1a7afd){_0x25594e[_0xee9f('0x23')]=_0x25594e[_0xee9f('0x23')][_0xee9f('0x2b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1a7afd(null,util[_0xee9f('0x24')]('%s-%s%s',path['basename'](_0x25594e['originalname'],path[_0xee9f('0x27')](_0x25594e[_0xee9f('0x23')])),Date[_0xee9f('0x28')](),path[_0xee9f('0x27')](_0x25594e[_0xee9f('0x23')])));}})});router['post']('/upload',upload[_0xee9f('0x29')](_0xee9f('0x2c')),controller[_0xee9f('0x2d')]);router[_0xee9f('0x19')]('/upload/:id',auth[_0xee9f('0xa')](),controller[_0xee9f('0x2e')]);router[_0xee9f('0x2f')]('/:id',auth[_0xee9f('0xa')](),controller[_0xee9f('0x30')]);router[_0xee9f('0x31')]('/:id',auth[_0xee9f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 4e3da0a..50f824e 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 _0xf248=['type','parse','values','isArray','setDataValue','stringify','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','name','TEXT','long'];(function(_0x58f65e,_0x467d61){var _0x35684b=function(_0x17cafe){while(--_0x17cafe){_0x58f65e['push'](_0x58f65e['shift']());}};_0x35684b(++_0x467d61);}(_0xf248,0x15c));var _0x8f24=function(_0x5d8302,_0xa145db){_0x5d8302=_0x5d8302-0x0;var _0xd2aaec=_0xf248[_0x5d8302];return _0xd2aaec;};'use strict';var Sequelize=require(_0x8f24('0x0'));var _=require(_0x8f24('0x1'));module[_0x8f24('0x2')]={'name':{'type':Sequelize[_0x8f24('0x3')],'get':function(_0x48f7e2){return this[_0x8f24('0x4')]('alias');}},'alias':{'type':Sequelize[_0x8f24('0x5')],'allowNull':![],'set':function(_0x3e071d){this['setDataValue']('alias',_0x3e071d?_0x3e071d:this[_0x8f24('0x4')](_0x8f24('0x6')));}},'type':{'type':Sequelize[_0x8f24('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x8f24('0x7')](_0x8f24('0x8')),'get':function(){if(this[_0x8f24('0x4')](_0x8f24('0x9'))==='select'){return JSON[_0x8f24('0xa')](this[_0x8f24('0x4')](_0x8f24('0xb')));}else{return this[_0x8f24('0x4')](_0x8f24('0xb'));}},'set':function(_0x2c9fdb){if(Array[_0x8f24('0xc')](_0x2c9fdb)){this[_0x8f24('0xd')](_0x8f24('0xb'),JSON[_0x8f24('0xe')](_0x2c9fdb));}else{this[_0x8f24('0xd')](_0x8f24('0xb'),_0x2c9fdb);}}},'required':{'type':Sequelize[_0x8f24('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x8f24('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x8f24('0x10'))}}; \ No newline at end of file +var _0xbb18=['values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','alias','STRING','setDataValue','getDataValue','name','TEXT','long','type','select'];(function(_0x15d9c0,_0x3435bc){var _0x3479bb=function(_0x3f0f35){while(--_0x3f0f35){_0x15d9c0['push'](_0x15d9c0['shift']());}};_0x3479bb(++_0x3435bc);}(_0xbb18,0xa8));var _0x8bb1=function(_0x33c637,_0x597c26){_0x33c637=_0x33c637-0x0;var _0x14aa20=_0xbb18[_0x33c637];return _0x14aa20;};'use strict';var Sequelize=require(_0x8bb1('0x0'));var _=require(_0x8bb1('0x1'));module[_0x8bb1('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x56969b){return this['getDataValue'](_0x8bb1('0x3'));}},'alias':{'type':Sequelize[_0x8bb1('0x4')],'allowNull':![],'set':function(_0x3fb8ff){this[_0x8bb1('0x5')](_0x8bb1('0x3'),_0x3fb8ff?_0x3fb8ff:this[_0x8bb1('0x6')](_0x8bb1('0x7')));}},'type':{'type':Sequelize[_0x8bb1('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x8bb1('0x8')](_0x8bb1('0x9')),'get':function(){if(this[_0x8bb1('0x6')](_0x8bb1('0xa'))===_0x8bb1('0xb')){return JSON['parse'](this[_0x8bb1('0x6')](_0x8bb1('0xc')));}else{return this[_0x8bb1('0x6')](_0x8bb1('0xc'));}},'set':function(_0xeba7){if(Array[_0x8bb1('0xd')](_0xeba7)){this[_0x8bb1('0x5')](_0x8bb1('0xc'),JSON[_0x8bb1('0xe')](_0xeba7));}else{this['setDataValue'](_0x8bb1('0xc'),_0xeba7);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x8bb1('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x8bb1('0x10')](_0x8bb1('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 98e64be..c6e46d4 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 _0x2546=['keys','options','update','body','find','create','transaction','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','destroy','then','error','stack','name','index','CmCustomField','rawAttributes','type','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params'];(function(_0x219353,_0x5cd156){var _0x364146=function(_0x23e5be){while(--_0x23e5be){_0x219353['push'](_0x219353['shift']());}};_0x364146(++_0x5cd156);}(_0x2546,0xc8));var _0x6254=function(_0x2a8d94,_0x387f97){_0x2a8d94=_0x2a8d94-0x0;var _0x5a1f1d=_0x2546[_0x2a8d94];return _0x5a1f1d;};'use strict';var emlformat=require(_0x6254('0x0'));var rimraf=require(_0x6254('0x1'));var zipdir=require(_0x6254('0x2'));var jsonpatch=require(_0x6254('0x3'));var rp=require(_0x6254('0x4'));var moment=require('moment');var BPromise=require(_0x6254('0x5'));var Mustache=require(_0x6254('0x6'));var util=require('util');var path=require(_0x6254('0x7'));var sox=require(_0x6254('0x8'));var csv=require(_0x6254('0x9'));var ejs=require(_0x6254('0xa'));var fs=require('fs');var fs_extra=require(_0x6254('0xb'));var _=require(_0x6254('0xc'));var squel=require(_0x6254('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6254('0x9'));var querystring=require(_0x6254('0xe'));var Papa=require(_0x6254('0xf'));var Redis=require(_0x6254('0x10'));var authService=require(_0x6254('0x11'));var qs=require(_0x6254('0x12'));var as=require(_0x6254('0x13'));var hardwareService=require(_0x6254('0x14'));var logger=require(_0x6254('0x15'))(_0x6254('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6254('0x17'));var db=require(_0x6254('0x18'))['db'];function respondWithStatusCode(_0x128bf1,_0x3ec250){_0x3ec250=_0x3ec250||0xcc;return function(_0x427855){if(_0x427855){return _0x128bf1[_0x6254('0x19')](_0x3ec250);}return _0x128bf1[_0x6254('0x1a')](_0x3ec250)[_0x6254('0x1b')]();};}function respondWithResult(_0x1ef44b,_0x3e6bf6){_0x3e6bf6=_0x3e6bf6||0xc8;return function(_0x2d7690){if(_0x2d7690){return _0x1ef44b[_0x6254('0x1a')](_0x3e6bf6)[_0x6254('0x1c')](_0x2d7690);}};}function respondWithFilteredResult(_0x493bb3,_0x4f4580){return function(_0x5cb3c7){if(_0x5cb3c7){var _0x3c558d=typeof _0x4f4580[_0x6254('0x1d')]===_0x6254('0x1e')&&typeof _0x4f4580['limit']===_0x6254('0x1e');var _0xc4f9f3=_0x5cb3c7[_0x6254('0x1f')];var _0x3703bd=_0x3c558d?0x0:_0x4f4580[_0x6254('0x1d')];var _0x1902d4=_0x3c558d?_0x5cb3c7['count']:_0x4f4580['offset']+_0x4f4580[_0x6254('0x20')];var _0x1d94b7;if(_0x1902d4>=_0xc4f9f3){_0x1902d4=_0xc4f9f3;_0x1d94b7=0xc8;}else{_0x1d94b7=0xce;}_0x493bb3['status'](_0x1d94b7);return _0x493bb3[_0x6254('0x21')]('Content-Range',_0x3703bd+'-'+_0x1902d4+'/'+_0xc4f9f3)[_0x6254('0x1c')](_0x5cb3c7);}return null;};}function patchUpdates(_0x4facf6){return function(_0x405ef6){try{jsonpatch[_0x6254('0x22')](_0x405ef6,_0x4facf6,!![]);}catch(_0x1f8542){return BPromise['reject'](_0x1f8542);}return _0x405ef6[_0x6254('0x23')]();};}function saveUpdates(_0x542a67,_0x262439){return function(_0x48e737){if(_0x48e737){return _0x48e737['update'](_0x542a67)['then'](function(_0x67b05c){return _0x67b05c;});}return null;};}function removeEntity(_0x39f619,_0x38f34e){return function(_0x57126c){if(_0x57126c){return _0x57126c[_0x6254('0x24')]()[_0x6254('0x25')](function(){_0x39f619[_0x6254('0x1a')](0xcc)[_0x6254('0x1b')]();});}};}function handleEntityNotFound(_0x408e3b,_0x546ea7){return function(_0xb0ba6b){if(!_0xb0ba6b){_0x408e3b['sendStatus'](0x194);}return _0xb0ba6b;};}function handleError(_0xc57239,_0x36f061){_0x36f061=_0x36f061||0x1f4;return function(_0x312df4){logger[_0x6254('0x26')](_0x312df4[_0x6254('0x27')]);if(_0x312df4[_0x6254('0x28')]){delete _0x312df4[_0x6254('0x28')];}_0xc57239['status'](_0x36f061)['send'](_0x312df4);};}exports[_0x6254('0x29')]=function(_0x27d1bf,_0x1f94d9){var _0x80bdee={},_0x39be77={},_0x8cedcf={'count':0x0,'rows':[]};var _0x673f01=_['map'](db[_0x6254('0x2a')][_0x6254('0x2b')],function(_0x4b084a){return{'name':_0x4b084a['fieldName'],'type':_0x4b084a[_0x6254('0x2c')][_0x6254('0x2d')]};});_0x39be77['model']=_['differenceBy'](_[_0x6254('0x2e')](_0x673f01,_0x6254('0x28')),['name']);_0x39be77[_0x6254('0x2f')]=_['keys'](_0x27d1bf[_0x6254('0x2f')]);_0x39be77['filters']=_[_0x6254('0x30')](_0x39be77[_0x6254('0x31')],_0x39be77[_0x6254('0x2f')]);_0x80bdee['attributes']=_[_0x6254('0x30')](_0x39be77[_0x6254('0x31')],qs[_0x6254('0x32')](_0x27d1bf['query'][_0x6254('0x32')]));_0x80bdee[_0x6254('0x33')]=_0x80bdee[_0x6254('0x33')][_0x6254('0x34')]?_0x80bdee['attributes']:_0x39be77[_0x6254('0x31')];if(!_0x27d1bf[_0x6254('0x2f')][_0x6254('0x35')](_0x6254('0x36'))){_0x80bdee[_0x6254('0x20')]=qs[_0x6254('0x20')](_0x27d1bf['query'][_0x6254('0x20')]);_0x80bdee[_0x6254('0x1d')]=qs[_0x6254('0x1d')](_0x27d1bf[_0x6254('0x2f')]['offset']);}_0x80bdee[_0x6254('0x37')]=qs[_0x6254('0x38')](_0x27d1bf[_0x6254('0x2f')][_0x6254('0x38')]);_0x80bdee[_0x6254('0x39')]=qs[_0x6254('0x3a')](_[_0x6254('0x3b')](_0x27d1bf[_0x6254('0x2f')],_0x39be77['filters']),_0x673f01);if(_0x27d1bf['query'][_0x6254('0x3c')]){_0x80bdee['where']=_[_0x6254('0x3d')](_0x80bdee[_0x6254('0x39')],{'$or':_['map'](_0x673f01,function(_0x2aff1a){if(_0x2aff1a[_0x6254('0x2c')]!==_0x6254('0x3e')){var _0x5c147e={};_0x5c147e[_0x2aff1a[_0x6254('0x28')]]={'$like':'%'+_0x27d1bf[_0x6254('0x2f')][_0x6254('0x3c')]+'%'};return _0x5c147e;}})});}_0x80bdee=_[_0x6254('0x3d')]({},_0x80bdee,_0x27d1bf['options']);var _0xd41c81={'where':_0x80bdee[_0x6254('0x39')]};return db[_0x6254('0x2a')]['count'](_0xd41c81)[_0x6254('0x25')](function(_0x1f84d3){_0x8cedcf[_0x6254('0x1f')]=_0x1f84d3;if(_0x27d1bf[_0x6254('0x2f')][_0x6254('0x3f')]){_0x80bdee[_0x6254('0x40')]=[{'all':!![]}];}return db[_0x6254('0x2a')][_0x6254('0x41')](_0x80bdee);})[_0x6254('0x25')](function(_0x56bb87){_0x8cedcf[_0x6254('0x42')]=_0x56bb87;return _0x8cedcf;})[_0x6254('0x25')](respondWithFilteredResult(_0x1f94d9,_0x80bdee))[_0x6254('0x43')](handleError(_0x1f94d9,null));};exports[_0x6254('0x44')]=function(_0x381f7f,_0x4f72ba){var _0x475f18={'raw':!![],'where':{'id':_0x381f7f[_0x6254('0x45')]['id']}},_0x5eef6b={};_0x5eef6b[_0x6254('0x31')]=_[_0x6254('0x46')](db[_0x6254('0x2a')][_0x6254('0x2b')]);_0x5eef6b[_0x6254('0x2f')]=_[_0x6254('0x46')](_0x381f7f[_0x6254('0x2f')]);_0x5eef6b[_0x6254('0x3a')]=_['intersection'](_0x5eef6b[_0x6254('0x31')],_0x5eef6b[_0x6254('0x2f')]);_0x475f18[_0x6254('0x33')]=_[_0x6254('0x30')](_0x5eef6b[_0x6254('0x31')],qs[_0x6254('0x32')](_0x381f7f[_0x6254('0x2f')]['fields']));_0x475f18[_0x6254('0x33')]=_0x475f18['attributes']['length']?_0x475f18[_0x6254('0x33')]:_0x5eef6b['model'];if(_0x381f7f[_0x6254('0x2f')][_0x6254('0x3f')]){_0x475f18[_0x6254('0x40')]=[{'all':!![]}];}_0x475f18=_['merge']({},_0x475f18,_0x381f7f[_0x6254('0x47')]);return db['CmCustomField']['find'](_0x475f18)[_0x6254('0x25')](handleEntityNotFound(_0x4f72ba,null))[_0x6254('0x25')](respondWithResult(_0x4f72ba,null))[_0x6254('0x43')](handleError(_0x4f72ba,null));};exports[_0x6254('0x48')]=function(_0x1ccee8,_0xc5f2df){if(_0x1ccee8[_0x6254('0x49')]['id']){delete _0x1ccee8[_0x6254('0x49')]['id'];}return db[_0x6254('0x2a')][_0x6254('0x4a')]({'where':{'id':_0x1ccee8[_0x6254('0x45')]['id']}})[_0x6254('0x25')](handleEntityNotFound(_0xc5f2df,null))['then'](saveUpdates(_0x1ccee8[_0x6254('0x49')],null))[_0x6254('0x25')](respondWithResult(_0xc5f2df,null))['catch'](handleError(_0xc5f2df,null));};exports[_0x6254('0x24')]=function(_0x51e837,_0x262961){return db[_0x6254('0x2a')][_0x6254('0x4a')]({'where':{'id':_0x51e837[_0x6254('0x45')]['id']}})['then'](handleEntityNotFound(_0x262961,null))[_0x6254('0x25')](removeEntity(_0x262961,null))[_0x6254('0x43')](handleError(_0x262961,null));};exports[_0x6254('0x4b')]=function(_0x2b941d,_0x13edb5){var _0x40f35c;return db['sequelize'][_0x6254('0x4c')](function(_0x5e986a){return db[_0x6254('0x2a')]['create'](_0x2b941d[_0x6254('0x49')],{'transaction':_0x5e986a})[_0x6254('0x25')](function(_0x3c6ba2){_0x40f35c=_0x3c6ba2;var _0x33e010={'type':db[_0x6254('0x4d')][_0x6254('0x4e')],'transaction':_0x5e986a};switch(_0x2b941d[_0x6254('0x49')]['type']){case _0x6254('0x4f'):_0x33e010[_0x6254('0x2c')]=db[_0x6254('0x4d')][_0x6254('0x4e')];break;case'number':_0x33e010['type']=db[_0x6254('0x4d')][_0x6254('0x50')];break;case _0x6254('0x51'):_0x33e010[_0x6254('0x2c')]=db[_0x6254('0x4d')][_0x6254('0x52')];_0x33e010[_0x6254('0x53')]=![];break;default:}return db[_0x6254('0x54')][_0x6254('0x55')][_0x6254('0x56')](_0x6254('0x57'),util[_0x6254('0x58')](_0x6254('0x59'),_0x40f35c['id']),_0x33e010);})[_0x6254('0x25')](function(){return _0x40f35c;});})[_0x6254('0x25')](respondWithResult(_0x13edb5,0xc9))['catch'](handleError(_0x13edb5,null));}; \ No newline at end of file +var _0x6881=['TEXT','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','undefined','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','CmCustomField','rawAttributes','type','key','model','differenceBy','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','length','find','body','create','sequelize','transaction','Sequelize'];(function(_0x2059df,_0x367401){var _0xdd848b=function(_0x13055b){while(--_0x13055b){_0x2059df['push'](_0x2059df['shift']());}};_0xdd848b(++_0x367401);}(_0x6881,0x1bd));var _0x1688=function(_0xfc0e4,_0x3242de){_0xfc0e4=_0xfc0e4-0x0;var _0x3cdfbb=_0x6881[_0xfc0e4];return _0x3cdfbb;};'use strict';var emlformat=require(_0x1688('0x0'));var rimraf=require(_0x1688('0x1'));var zipdir=require(_0x1688('0x2'));var jsonpatch=require(_0x1688('0x3'));var rp=require(_0x1688('0x4'));var moment=require(_0x1688('0x5'));var BPromise=require(_0x1688('0x6'));var Mustache=require(_0x1688('0x7'));var util=require('util');var path=require('path');var sox=require(_0x1688('0x8'));var csv=require(_0x1688('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1688('0xa'));var squel=require(_0x1688('0xb'));var crypto=require(_0x1688('0xc'));var jsforce=require(_0x1688('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1688('0x9'));var querystring=require(_0x1688('0xe'));var Papa=require(_0x1688('0xf'));var Redis=require(_0x1688('0x10'));var authService=require(_0x1688('0x11'));var qs=require(_0x1688('0x12'));var as=require(_0x1688('0x13'));var hardwareService=require(_0x1688('0x14'));var logger=require('../../config/logger')(_0x1688('0x15'));var utils=require(_0x1688('0x16'));var config=require(_0x1688('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x325b13,_0x463168){_0x463168=_0x463168||0xcc;return function(_0x1db08c){if(_0x1db08c){return _0x325b13[_0x1688('0x18')](_0x463168);}return _0x325b13['status'](_0x463168)[_0x1688('0x19')]();};}function respondWithResult(_0x48c408,_0x37891e){_0x37891e=_0x37891e||0xc8;return function(_0x54f1ec){if(_0x54f1ec){return _0x48c408[_0x1688('0x1a')](_0x37891e)[_0x1688('0x1b')](_0x54f1ec);}};}function respondWithFilteredResult(_0x3d6aa7,_0x23a2f6){return function(_0x2f2b5a){if(_0x2f2b5a){var _0x2d14e7=typeof _0x23a2f6[_0x1688('0x1c')]==='undefined'&&typeof _0x23a2f6[_0x1688('0x1d')]===_0x1688('0x1e');var _0x4194da=_0x2f2b5a['count'];var _0x12a9b0=_0x2d14e7?0x0:_0x23a2f6[_0x1688('0x1c')];var _0x5a15d7=_0x2d14e7?_0x2f2b5a['count']:_0x23a2f6['offset']+_0x23a2f6[_0x1688('0x1d')];var _0x45cea4;if(_0x5a15d7>=_0x4194da){_0x5a15d7=_0x4194da;_0x45cea4=0xc8;}else{_0x45cea4=0xce;}_0x3d6aa7[_0x1688('0x1a')](_0x45cea4);return _0x3d6aa7[_0x1688('0x1f')](_0x1688('0x20'),_0x12a9b0+'-'+_0x5a15d7+'/'+_0x4194da)[_0x1688('0x1b')](_0x2f2b5a);}return null;};}function patchUpdates(_0x28e2bb){return function(_0x1faa0f){try{jsonpatch[_0x1688('0x21')](_0x1faa0f,_0x28e2bb,!![]);}catch(_0x31b9a2){return BPromise['reject'](_0x31b9a2);}return _0x1faa0f[_0x1688('0x22')]();};}function saveUpdates(_0x3b7274,_0x3c1228){return function(_0x1d293f){if(_0x1d293f){return _0x1d293f[_0x1688('0x23')](_0x3b7274)[_0x1688('0x24')](function(_0x311b82){return _0x311b82;});}return null;};}function removeEntity(_0x3ed079,_0x5f5926){return function(_0x1f339b){if(_0x1f339b){return _0x1f339b[_0x1688('0x25')]()[_0x1688('0x24')](function(){_0x3ed079[_0x1688('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1522e4,_0x257749){return function(_0x5d3514){if(!_0x5d3514){_0x1522e4[_0x1688('0x18')](0x194);}return _0x5d3514;};}function handleError(_0x52112e,_0x2234fa){_0x2234fa=_0x2234fa||0x1f4;return function(_0x2aed14){logger['error'](_0x2aed14[_0x1688('0x26')]);if(_0x2aed14['name']){delete _0x2aed14[_0x1688('0x27')];}_0x52112e[_0x1688('0x1a')](_0x2234fa)[_0x1688('0x28')](_0x2aed14);};}exports[_0x1688('0x29')]=function(_0x5c3511,_0x5de866){var _0x200403={},_0x5d9bda={},_0x431cf5={'count':0x0,'rows':[]};var _0x4cecfe=_[_0x1688('0x2a')](db[_0x1688('0x2b')][_0x1688('0x2c')],function(_0x32d076){return{'name':_0x32d076['fieldName'],'type':_0x32d076[_0x1688('0x2d')][_0x1688('0x2e')]};});_0x5d9bda[_0x1688('0x2f')]=_[_0x1688('0x30')](_[_0x1688('0x2a')](_0x4cecfe,_0x1688('0x27')),[_0x1688('0x27')]);_0x5d9bda['query']=_[_0x1688('0x31')](_0x5c3511[_0x1688('0x32')]);_0x5d9bda[_0x1688('0x33')]=_[_0x1688('0x34')](_0x5d9bda[_0x1688('0x2f')],_0x5d9bda[_0x1688('0x32')]);_0x200403['attributes']=_[_0x1688('0x34')](_0x5d9bda[_0x1688('0x2f')],qs['fields'](_0x5c3511[_0x1688('0x32')][_0x1688('0x35')]));_0x200403[_0x1688('0x36')]=_0x200403[_0x1688('0x36')]['length']?_0x200403[_0x1688('0x36')]:_0x5d9bda[_0x1688('0x2f')];if(!_0x5c3511['query']['hasOwnProperty'](_0x1688('0x37'))){_0x200403[_0x1688('0x1d')]=qs[_0x1688('0x1d')](_0x5c3511[_0x1688('0x32')][_0x1688('0x1d')]);_0x200403['offset']=qs[_0x1688('0x1c')](_0x5c3511[_0x1688('0x32')][_0x1688('0x1c')]);}_0x200403[_0x1688('0x38')]=qs[_0x1688('0x39')](_0x5c3511[_0x1688('0x32')][_0x1688('0x39')]);_0x200403[_0x1688('0x3a')]=qs[_0x1688('0x33')](_['pick'](_0x5c3511[_0x1688('0x32')],_0x5d9bda[_0x1688('0x33')]),_0x4cecfe);if(_0x5c3511[_0x1688('0x32')][_0x1688('0x3b')]){_0x200403[_0x1688('0x3a')]=_[_0x1688('0x3c')](_0x200403[_0x1688('0x3a')],{'$or':_[_0x1688('0x2a')](_0x4cecfe,function(_0x357f24){if(_0x357f24[_0x1688('0x2d')]!==_0x1688('0x3d')){var _0xd314a5={};_0xd314a5[_0x357f24[_0x1688('0x27')]]={'$like':'%'+_0x5c3511[_0x1688('0x32')][_0x1688('0x3b')]+'%'};return _0xd314a5;}})});}_0x200403=_['merge']({},_0x200403,_0x5c3511[_0x1688('0x3e')]);var _0x1606b4={'where':_0x200403['where']};return db[_0x1688('0x2b')][_0x1688('0x3f')](_0x1606b4)[_0x1688('0x24')](function(_0x53a6eb){_0x431cf5['count']=_0x53a6eb;if(_0x5c3511[_0x1688('0x32')][_0x1688('0x40')]){_0x200403[_0x1688('0x41')]=[{'all':!![]}];}return db[_0x1688('0x2b')][_0x1688('0x42')](_0x200403);})[_0x1688('0x24')](function(_0x161fec){_0x431cf5['rows']=_0x161fec;return _0x431cf5;})['then'](respondWithFilteredResult(_0x5de866,_0x200403))[_0x1688('0x43')](handleError(_0x5de866,null));};exports[_0x1688('0x44')]=function(_0x5e984f,_0x4b3506){var _0x4ea52d={'raw':!![],'where':{'id':_0x5e984f[_0x1688('0x45')]['id']}},_0x9c8d39={};_0x9c8d39[_0x1688('0x2f')]=_[_0x1688('0x31')](db[_0x1688('0x2b')][_0x1688('0x2c')]);_0x9c8d39[_0x1688('0x32')]=_['keys'](_0x5e984f[_0x1688('0x32')]);_0x9c8d39[_0x1688('0x33')]=_[_0x1688('0x34')](_0x9c8d39[_0x1688('0x2f')],_0x9c8d39[_0x1688('0x32')]);_0x4ea52d[_0x1688('0x36')]=_[_0x1688('0x34')](_0x9c8d39[_0x1688('0x2f')],qs[_0x1688('0x35')](_0x5e984f['query']['fields']));_0x4ea52d[_0x1688('0x36')]=_0x4ea52d[_0x1688('0x36')][_0x1688('0x46')]?_0x4ea52d['attributes']:_0x9c8d39['model'];if(_0x5e984f['query']['includeAll']){_0x4ea52d[_0x1688('0x41')]=[{'all':!![]}];}_0x4ea52d=_[_0x1688('0x3c')]({},_0x4ea52d,_0x5e984f['options']);return db[_0x1688('0x2b')][_0x1688('0x47')](_0x4ea52d)['then'](handleEntityNotFound(_0x4b3506,null))['then'](respondWithResult(_0x4b3506,null))['catch'](handleError(_0x4b3506,null));};exports['update']=function(_0x409f75,_0x2097db){if(_0x409f75[_0x1688('0x48')]['id']){delete _0x409f75[_0x1688('0x48')]['id'];}return db[_0x1688('0x2b')][_0x1688('0x47')]({'where':{'id':_0x409f75['params']['id']}})['then'](handleEntityNotFound(_0x2097db,null))[_0x1688('0x24')](saveUpdates(_0x409f75[_0x1688('0x48')],null))[_0x1688('0x24')](respondWithResult(_0x2097db,null))[_0x1688('0x43')](handleError(_0x2097db,null));};exports[_0x1688('0x25')]=function(_0x450d48,_0x114ae5){return db[_0x1688('0x2b')][_0x1688('0x47')]({'where':{'id':_0x450d48['params']['id']}})['then'](handleEntityNotFound(_0x114ae5,null))[_0x1688('0x24')](removeEntity(_0x114ae5,null))[_0x1688('0x43')](handleError(_0x114ae5,null));};exports[_0x1688('0x49')]=function(_0x11ed2d,_0x409c7a){var _0x135b44;return db[_0x1688('0x4a')][_0x1688('0x4b')](function(_0x3d77b8){return db[_0x1688('0x2b')][_0x1688('0x49')](_0x11ed2d[_0x1688('0x48')],{'transaction':_0x3d77b8})[_0x1688('0x24')](function(_0xb82ba9){_0x135b44=_0xb82ba9;var _0x147d87={'type':db[_0x1688('0x4c')][_0x1688('0x4d')],'transaction':_0x3d77b8};switch(_0x11ed2d[_0x1688('0x48')][_0x1688('0x2d')]){case'text':_0x147d87[_0x1688('0x2d')]=db[_0x1688('0x4c')]['TEXT'];break;case'number':_0x147d87[_0x1688('0x2d')]=db[_0x1688('0x4c')][_0x1688('0x4e')];break;case _0x1688('0x4f'):_0x147d87[_0x1688('0x2d')]=db[_0x1688('0x4c')][_0x1688('0x50')];_0x147d87[_0x1688('0x51')]=![];break;default:}return db[_0x1688('0x4a')][_0x1688('0x52')][_0x1688('0x53')](_0x1688('0x54'),util[_0x1688('0x55')](_0x1688('0x56'),_0x135b44['id']),_0x147d87);})['then'](function(){return _0x135b44;});})[_0x1688('0x24')](respondWithResult(_0x409c7a,0xc9))[_0x1688('0x43')](handleError(_0x409c7a,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index bef5c48..f1fe425 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 _0x3320=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x3320,0x1eb));var _0x0332=function(_0x305272,_0x19a527){_0x305272=_0x305272-0x0;var _0x43fdf1=_0x3320[_0x305272];return _0x43fdf1;};'use strict';var _=require(_0x0332('0x0'));var util=require(_0x0332('0x1'));var logger=require(_0x0332('0x2'))(_0x0332('0x3'));var moment=require(_0x0332('0x4'));var BPromise=require(_0x0332('0x5'));var rp=require(_0x0332('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0332('0x7'));var config=require(_0x0332('0x8'));var attributes=require(_0x0332('0x9'));module[_0x0332('0xa')]=function(_0x39c68a,_0x2ed3b1){return _0x39c68a['define'](_0x0332('0xb'),attributes,{'tableName':_0x0332('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ff6=['cm_custom_fields','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./cmCustomField.attributes','define','CmCustomField'];(function(_0x5a7e86,_0x4c1c83){var _0xfe62a1=function(_0x121e3d){while(--_0x121e3d){_0x5a7e86['push'](_0x5a7e86['shift']());}};_0xfe62a1(++_0x4c1c83);}(_0x2ff6,0x10f));var _0x62ff=function(_0xeef356,_0x3b4b28){_0xeef356=_0xeef356-0x0;var _0x3497c3=_0x2ff6[_0xeef356];return _0x3497c3;};'use strict';var _=require(_0x62ff('0x0'));var util=require('util');var logger=require(_0x62ff('0x1'))('api');var moment=require(_0x62ff('0x2'));var BPromise=require(_0x62ff('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62ff('0x4'));var rimraf=require('rimraf');var config=require(_0x62ff('0x5'));var attributes=require(_0x62ff('0x6'));module['exports']=function(_0x47b77a,_0x466c96){return _0x47b77a[_0x62ff('0x7')](_0x62ff('0x8'),attributes,{'tableName':_0x62ff('0x9'),'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 196c771..7a504e4 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 _0xfaa0=['info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then'];(function(_0x20fae5,_0x1cd746){var _0x3a4ec9=function(_0x3df499){while(--_0x3df499){_0x20fae5['push'](_0x20fae5['shift']());}};_0x3a4ec9(++_0x1cd746);}(_0xfaa0,0x16a));var _0x0faa=function(_0x540f62,_0x5e81eb){_0x540f62=_0x540f62-0x0;var _0x19a147=_0xfaa0[_0x540f62];return _0x19a147;};'use strict';var _=require(_0x0faa('0x0'));var util=require(_0x0faa('0x1'));var moment=require(_0x0faa('0x2'));var BPromise=require('bluebird');var rs=require(_0x0faa('0x3'));var fs=require('fs');var Redis=require(_0x0faa('0x4'));var db=require(_0x0faa('0x5'))['db'];var utils=require(_0x0faa('0x6'));var logger=require(_0x0faa('0x7'))(_0x0faa('0x8'));var config=require(_0x0faa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0faa('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fca7a,_0x2678e5,_0x40c35f){return new BPromise(function(_0x182356,_0x2296f2){return client['request'](_0x3fca7a,_0x40c35f)[_0x0faa('0xb')](function(_0x4a60a7){logger[_0x0faa('0xc')](_0x0faa('0xd'),_0x2678e5,_0x0faa('0xe'));logger[_0x0faa('0xf')](_0x0faa('0x10'),_0x2678e5,'request\x20sent',JSON[_0x0faa('0x11')](_0x4a60a7));if(_0x4a60a7[_0x0faa('0x12')]){if(_0x4a60a7[_0x0faa('0x12')][_0x0faa('0x13')]===0x1f4){logger['error'](_0x0faa('0xd'),_0x2678e5,_0x4a60a7[_0x0faa('0x12')][_0x0faa('0x14')]);return _0x2296f2(_0x4a60a7['error'][_0x0faa('0x14')]);}logger[_0x0faa('0x12')](_0x0faa('0xd'),_0x2678e5,_0x4a60a7[_0x0faa('0x12')][_0x0faa('0x14')]);return _0x182356(_0x4a60a7['error'][_0x0faa('0x14')]);}else{logger[_0x0faa('0xc')]('CmCustomField,\x20%s,\x20%s',_0x2678e5,_0x0faa('0xe'));_0x182356(_0x4a60a7[_0x0faa('0x15')][_0x0faa('0x14')]);}})['catch'](function(_0x258025){logger[_0x0faa('0x12')](_0x0faa('0xd'),_0x2678e5,_0x258025);_0x2296f2(_0x258025);});});} \ No newline at end of file +var _0x62ae=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5643c7,_0x2d38df){var _0xe13763=function(_0x571c9c){while(--_0x571c9c){_0x5643c7['push'](_0x5643c7['shift']());}};_0xe13763(++_0x2d38df);}(_0x62ae,0xc2));var _0xe62a=function(_0x45950b,_0x322e54){_0x45950b=_0x45950b-0x0;var _0x1a4001=_0x62ae[_0x45950b];return _0x1a4001;};'use strict';var _=require(_0xe62a('0x0'));var util=require(_0xe62a('0x1'));var moment=require(_0xe62a('0x2'));var BPromise=require(_0xe62a('0x3'));var rs=require(_0xe62a('0x4'));var fs=require('fs');var Redis=require(_0xe62a('0x5'));var db=require(_0xe62a('0x6'))['db'];var utils=require(_0xe62a('0x7'));var logger=require(_0xe62a('0x8'))(_0xe62a('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe62a('0xa')][_0xe62a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40964b,_0x1c10a3,_0x4e2ada){return new BPromise(function(_0x3b1d22,_0x141426){return client[_0xe62a('0xc')](_0x40964b,_0x4e2ada)[_0xe62a('0xd')](function(_0x3e95b7){logger[_0xe62a('0xe')](_0xe62a('0xf'),_0x1c10a3,_0xe62a('0x10'));logger[_0xe62a('0x11')](_0xe62a('0x12'),_0x1c10a3,_0xe62a('0x10'),JSON[_0xe62a('0x13')](_0x3e95b7));if(_0x3e95b7['error']){if(_0x3e95b7[_0xe62a('0x14')][_0xe62a('0x15')]===0x1f4){logger[_0xe62a('0x14')](_0xe62a('0xf'),_0x1c10a3,_0x3e95b7[_0xe62a('0x14')][_0xe62a('0x16')]);return _0x141426(_0x3e95b7['error'][_0xe62a('0x16')]);}logger[_0xe62a('0x14')](_0xe62a('0xf'),_0x1c10a3,_0x3e95b7[_0xe62a('0x14')][_0xe62a('0x16')]);return _0x3b1d22(_0x3e95b7[_0xe62a('0x14')][_0xe62a('0x16')]);}else{logger[_0xe62a('0xe')](_0xe62a('0xf'),_0x1c10a3,_0xe62a('0x10'));_0x3b1d22(_0x3e95b7[_0xe62a('0x17')]['message']);}})[_0xe62a('0x18')](function(_0x1738ad){logger[_0xe62a('0x14')](_0xe62a('0xf'),_0x1c10a3,_0x1738ad);_0x141426(_0x1738ad);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index b984eeb..35886c1 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 _0xc83b=['delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x1f39bb,_0x5cd7fe){var _0x57d502=function(_0x391b47){while(--_0x391b47){_0x1f39bb['push'](_0x1f39bb['shift']());}};_0x57d502(++_0x5cd7fe);}(_0xc83b,0xa4));var _0xbc83=function(_0x25d8ea,_0x25ddf1){_0x25d8ea=_0x25d8ea-0x0;var _0x2afc26=_0xc83b[_0x25d8ea];return _0x2afc26;};'use strict';var multer=require(_0xbc83('0x0'));var util=require(_0xbc83('0x1'));var path=require(_0xbc83('0x2'));var timeout=require(_0xbc83('0x3'));var express=require('express');var router=express[_0xbc83('0x4')]();var fs_extra=require(_0xbc83('0x5'));var auth=require(_0xbc83('0x6'));var interaction=require(_0xbc83('0x7'));var config=require(_0xbc83('0x8'));var controller=require('./cmCustomField.controller');router[_0xbc83('0x9')]('/',auth[_0xbc83('0xa')](),controller['index']);router[_0xbc83('0x9')](_0xbc83('0xb'),auth['isAuthenticated'](),controller[_0xbc83('0xc')]);router[_0xbc83('0xd')]('/',auth['isAuthenticated'](),controller[_0xbc83('0xe')]);router[_0xbc83('0xf')](_0xbc83('0xb'),auth[_0xbc83('0xa')](),controller['update']);router[_0xbc83('0x10')](_0xbc83('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xbc83('0x11')]=router; \ No newline at end of file +var _0xed52=['get','post','create','put','/:id','delete','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xed52,0x16e));var _0x2ed5=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xed52[_0x4dbaad];return _0x226c72;};'use strict';var multer=require('multer');var util=require(_0x2ed5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2ed5('0x1'));var router=express[_0x2ed5('0x2')]();var fs_extra=require(_0x2ed5('0x3'));var auth=require(_0x2ed5('0x4'));var interaction=require(_0x2ed5('0x5'));var config=require(_0x2ed5('0x6'));var controller=require(_0x2ed5('0x7'));router['get']('/',auth[_0x2ed5('0x8')](),controller['index']);router[_0x2ed5('0x9')]('/:id',auth[_0x2ed5('0x8')](),controller['show']);router[_0x2ed5('0xa')]('/',auth[_0x2ed5('0x8')](),controller[_0x2ed5('0xb')]);router[_0x2ed5('0xc')](_0x2ed5('0xd'),auth[_0x2ed5('0x8')](),controller['update']);router[_0x2ed5('0xe')](_0x2ed5('0xd'),auth[_0x2ed5('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index feddc16..b3e68f5 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 _0xcf4e=['STRING','BOOLEAN','contactListQueue','moment','sequelize','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0xcf4e,0x108));var _0xecf4=function(_0xa90f94,_0x76cf3){_0xa90f94=_0xa90f94-0x0;var _0x429da9=_0xcf4e[_0xa90f94];return _0x429da9;};'use strict';var moment=require(_0xecf4('0x0'));var Sequelize=require(_0xecf4('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xecf4('0x2')],'defaultValue':moment()[_0xecf4('0x3')](_0xecf4('0x4'))},'countbusyretry':{'type':Sequelize[_0xecf4('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xecf4('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xecf4('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xecf4('0x2')]},'priority':{'type':Sequelize[_0xecf4('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xecf4('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xecf4('0x5')],'unique':_0xecf4('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xecf4('0x8')},'UserId':{'type':Sequelize[_0xecf4('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xecf4('0x5')],'unique':_0xecf4('0x8')},'CampaignId':{'type':Sequelize[_0xecf4('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xecf4('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xecf4('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xecf4('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xecf4('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x493d=['STRING','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','contactListQueue','moment','sequelize','exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x493d,0x138));var _0xd493=function(_0x1bdfe7,_0x5c062c){_0x1bdfe7=_0x1bdfe7-0x0;var _0x6dc98e=_0x493d[_0x1bdfe7];return _0x6dc98e;};'use strict';var moment=require(_0xd493('0x0'));var Sequelize=require(_0xd493('0x1'));module[_0xd493('0x2')]={'phone':{'type':Sequelize[_0xd493('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xd493('0x4')](_0xd493('0x5'))},'countbusyretry':{'type':Sequelize[_0xd493('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd493('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd493('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd493('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd493('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xd493('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xd493('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xd493('0x6')],'unique':_0xd493('0x8')},'ListId':{'type':Sequelize[_0xd493('0x6')],'unique':_0xd493('0x8')},'UserId':{'type':Sequelize[_0xd493('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xd493('0x6')],'unique':_0xd493('0x8')},'CampaignId':{'type':Sequelize[_0xd493('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xd493('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd493('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd493('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index c64241d..dc6b86c 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 _0x196e=['VoiceQueue','Queue','dialActive','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','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','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','name','index','map','CmHopper','rawAttributes','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','fields','attributes','hasOwnProperty','nolimit','sort','filter','merge','where','type','includeAll','include','catch','show','params','length','options','find','create','body','describe','VoiceQueueId','omit','dataValues','createdAt','updatedAt','state','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','LOCK','UPDATE','CmCompany','Company','CmList'];(function(_0x3c2e23,_0x2dcebb){var _0x110306=function(_0x5baa29){while(--_0x5baa29){_0x3c2e23['push'](_0x3c2e23['shift']());}};_0x110306(++_0x2dcebb);}(_0x196e,0x96));var _0xe196=function(_0x7c0074,_0x1ffdcf){_0x7c0074=_0x7c0074-0x0;var _0x13e95b=_0x196e[_0x7c0074];return _0x13e95b;};'use strict';var emlformat=require(_0xe196('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe196('0x1'));var jsonpatch=require(_0xe196('0x2'));var rp=require(_0xe196('0x3'));var moment=require(_0xe196('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe196('0x5'));var util=require('util');var path=require(_0xe196('0x6'));var sox=require(_0xe196('0x7'));var csv=require(_0xe196('0x8'));var ejs=require(_0xe196('0x9'));var fs=require('fs');var fs_extra=require(_0xe196('0xa'));var _=require(_0xe196('0xb'));var squel=require(_0xe196('0xc'));var crypto=require(_0xe196('0xd'));var jsforce=require(_0xe196('0xe'));var deskjs=require(_0xe196('0xf'));var toCsv=require(_0xe196('0x8'));var querystring=require(_0xe196('0x10'));var Papa=require(_0xe196('0x11'));var Redis=require(_0xe196('0x12'));var authService=require(_0xe196('0x13'));var qs=require(_0xe196('0x14'));var as=require(_0xe196('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe196('0x16'));var utils=require(_0xe196('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe196('0x18'));var db=require(_0xe196('0x19'))['db'];function respondWithStatusCode(_0x491e92,_0xf6bead){_0xf6bead=_0xf6bead||0xcc;return function(_0x417683){if(_0x417683){return _0x491e92['sendStatus'](_0xf6bead);}return _0x491e92[_0xe196('0x1a')](_0xf6bead)['end']();};}function respondWithResult(_0xe7574a,_0x2cda61){_0x2cda61=_0x2cda61||0xc8;return function(_0x331c8d){if(_0x331c8d){return _0xe7574a[_0xe196('0x1a')](_0x2cda61)[_0xe196('0x1b')](_0x331c8d);}};}function respondWithFilteredResult(_0x2dc22b,_0x23ffd8){return function(_0x832e86){if(_0x832e86){var _0xe90d40=typeof _0x23ffd8[_0xe196('0x1c')]===_0xe196('0x1d')&&typeof _0x23ffd8[_0xe196('0x1e')]==='undefined';var _0x41642c=_0x832e86[_0xe196('0x1f')];var _0x54f1af=_0xe90d40?0x0:_0x23ffd8[_0xe196('0x1c')];var _0x8db238=_0xe90d40?_0x832e86[_0xe196('0x1f')]:_0x23ffd8[_0xe196('0x1c')]+_0x23ffd8[_0xe196('0x1e')];var _0x3bb6b2;if(_0x8db238>=_0x41642c){_0x8db238=_0x41642c;_0x3bb6b2=0xc8;}else{_0x3bb6b2=0xce;}_0x2dc22b[_0xe196('0x1a')](_0x3bb6b2);return _0x2dc22b[_0xe196('0x20')](_0xe196('0x21'),_0x54f1af+'-'+_0x8db238+'/'+_0x41642c)[_0xe196('0x1b')](_0x832e86);}return null;};}function patchUpdates(_0x4ce257){return function(_0x13a068){try{jsonpatch['apply'](_0x13a068,_0x4ce257,!![]);}catch(_0x268767){return BPromise[_0xe196('0x22')](_0x268767);}return _0x13a068[_0xe196('0x23')]();};}function saveUpdates(_0x56d471,_0x1222b3){return function(_0x5ac84d){if(_0x5ac84d){return _0x5ac84d[_0xe196('0x24')](_0x56d471)[_0xe196('0x25')](function(_0x5c05a0){return _0x5c05a0;});}return null;};}function removeEntity(_0x23e95e,_0x140ad9){return function(_0x15dad4){if(_0x15dad4){return _0x15dad4[_0xe196('0x26')]()['then'](function(){_0x23e95e[_0xe196('0x1a')](0xcc)[_0xe196('0x27')]();});}};}function handleEntityNotFound(_0xa9d0f7,_0x1232af){return function(_0x44cc34){if(!_0x44cc34){_0xa9d0f7[_0xe196('0x28')](0x194);}return _0x44cc34;};}function handleError(_0xc3489e,_0x1bdee4){_0x1bdee4=_0x1bdee4||0x1f4;return function(_0x16fb23){logger[_0xe196('0x29')](_0x16fb23['stack']);if(_0x16fb23['name']){delete _0x16fb23[_0xe196('0x2a')];}_0xc3489e[_0xe196('0x1a')](_0x1bdee4)['send'](_0x16fb23);};}exports[_0xe196('0x2b')]=function(_0x4c6c30,_0x4e5dbb){var _0x4d60ce={},_0x212f8e={},_0x15ad20={'count':0x0,'rows':[]};var _0x4f7c64=_[_0xe196('0x2c')](db[_0xe196('0x2d')][_0xe196('0x2e')],function(_0x5a5e9b){return{'name':_0x5a5e9b['fieldName'],'type':_0x5a5e9b['type'][_0xe196('0x2f')]};});_0x212f8e[_0xe196('0x30')]=_[_0xe196('0x2c')](_0x4f7c64,_0xe196('0x2a'));_0x212f8e[_0xe196('0x31')]=_[_0xe196('0x32')](_0x4c6c30['query']);_0x212f8e[_0xe196('0x33')]=_[_0xe196('0x34')](_0x212f8e[_0xe196('0x30')],_0x212f8e[_0xe196('0x31')]);_0x212f8e[_0xe196('0x33')]=_[_0xe196('0x35')](_0x212f8e[_0xe196('0x33')],[_0xe196('0x36'),_0xe196('0x37'),_0xe196('0x38'),'$gte',_0xe196('0x39'),_0xe196('0x3a'),_0xe196('0x3b'),_0xe196('0x3c'),_0xe196('0x3d'),_0xe196('0x3e'),_0xe196('0x3f'),_0xe196('0x40'),_0xe196('0x41'),_0xe196('0x42'),_0xe196('0x43'),_0xe196('0x44'),_0xe196('0x45'),'$like',_0xe196('0x46'),'$contains',_0xe196('0x47'),_0xe196('0x48')]);_0x4d60ce['attributes']=_[_0xe196('0x34')](_0x212f8e['model'],qs[_0xe196('0x49')](_0x4c6c30[_0xe196('0x31')][_0xe196('0x49')]));_0x4d60ce[_0xe196('0x4a')]=_0x4d60ce[_0xe196('0x4a')]['length']?_0x4d60ce['attributes']:_0x212f8e['model'];if(!_0x4c6c30[_0xe196('0x31')][_0xe196('0x4b')](_0xe196('0x4c'))){_0x4d60ce[_0xe196('0x1e')]=qs['limit'](_0x4c6c30['query'][_0xe196('0x1e')]);_0x4d60ce['offset']=qs[_0xe196('0x1c')](_0x4c6c30[_0xe196('0x31')]['offset']);}_0x4d60ce['order']=qs[_0xe196('0x4d')](_0x4c6c30[_0xe196('0x31')]['sort']);_0x4d60ce['where']=qs[_0xe196('0x33')](_['pick'](_0x4c6c30[_0xe196('0x31')],_0x212f8e['filters']),_0x4f7c64);if(_0x4c6c30['query'][_0xe196('0x4e')]){_0x4d60ce['where']=_[_0xe196('0x4f')](_0x4d60ce[_0xe196('0x50')],{'$or':_[_0xe196('0x2c')](_0x4f7c64,function(_0x13533d){if(_0x13533d[_0xe196('0x51')]!=='VIRTUAL'){var _0x16896b={};_0x16896b[_0x13533d[_0xe196('0x2a')]]={'$like':'%'+_0x4c6c30[_0xe196('0x31')][_0xe196('0x4e')]+'%'};return _0x16896b;}})});}_0x4d60ce=_[_0xe196('0x4f')]({},_0x4d60ce,_0x4c6c30['options']);var _0x313381={'where':_0x4d60ce[_0xe196('0x50')]};return db['CmHopper'][_0xe196('0x1f')](_0x313381)['then'](function(_0x30c524){_0x15ad20[_0xe196('0x1f')]=_0x30c524;if(_0x4c6c30[_0xe196('0x31')][_0xe196('0x52')]){_0x4d60ce[_0xe196('0x53')]=[{'all':!![]}];}return db[_0xe196('0x2d')]['findAll'](_0x4d60ce);})['then'](function(_0x32a583){_0x15ad20['rows']=_0x32a583;return _0x15ad20;})[_0xe196('0x25')](respondWithFilteredResult(_0x4e5dbb,_0x4d60ce))[_0xe196('0x54')](handleError(_0x4e5dbb,null));};exports[_0xe196('0x55')]=function(_0x13218f,_0x579118){var _0xf45418={'raw':!![],'where':{'id':_0x13218f[_0xe196('0x56')]['id']}},_0x4fb187={};_0x4fb187[_0xe196('0x30')]=_[_0xe196('0x32')](db['CmHopper']['rawAttributes']);_0x4fb187[_0xe196('0x31')]=_[_0xe196('0x32')](_0x13218f[_0xe196('0x31')]);_0x4fb187[_0xe196('0x33')]=_['intersection'](_0x4fb187[_0xe196('0x30')],_0x4fb187[_0xe196('0x31')]);_0xf45418['attributes']=_[_0xe196('0x34')](_0x4fb187['model'],qs[_0xe196('0x49')](_0x13218f[_0xe196('0x31')][_0xe196('0x49')]));_0xf45418[_0xe196('0x4a')]=_0xf45418['attributes'][_0xe196('0x57')]?_0xf45418['attributes']:_0x4fb187[_0xe196('0x30')];if(_0x13218f[_0xe196('0x31')][_0xe196('0x52')]){_0xf45418['include']=[{'all':!![]}];}_0xf45418=_[_0xe196('0x4f')]({},_0xf45418,_0x13218f[_0xe196('0x58')]);return db[_0xe196('0x2d')][_0xe196('0x59')](_0xf45418)['then'](handleEntityNotFound(_0x579118,null))[_0xe196('0x25')](respondWithResult(_0x579118,null))[_0xe196('0x54')](handleError(_0x579118,null));};exports[_0xe196('0x5a')]=function(_0x23d0d2,_0x4b5b6e){return db[_0xe196('0x2d')][_0xe196('0x5a')](_0x23d0d2[_0xe196('0x5b')],{})[_0xe196('0x25')](respondWithResult(_0x4b5b6e,0xc9))['catch'](handleError(_0x4b5b6e,null));};exports[_0xe196('0x24')]=function(_0x1e6531,_0x57a06f){if(_0x1e6531[_0xe196('0x5b')]['id']){delete _0x1e6531['body']['id'];}return db[_0xe196('0x2d')][_0xe196('0x59')]({'where':{'id':_0x1e6531['params']['id']}})[_0xe196('0x25')](handleEntityNotFound(_0x57a06f,null))[_0xe196('0x25')](saveUpdates(_0x1e6531['body'],null))[_0xe196('0x25')](respondWithResult(_0x57a06f,null))[_0xe196('0x54')](handleError(_0x57a06f,null));};exports[_0xe196('0x5c')]=function(_0x1a3d64,_0x124001){return db[_0xe196('0x2d')][_0xe196('0x5c')]()['then'](respondWithResult(_0x124001,null))[_0xe196('0x54')](handleError(_0x124001,null));};exports[_0xe196('0x26')]=function(_0x3ff619,_0x42328c){var _0x1d3c55;return db['CmHopper']['find']({'where':{'id':_0x3ff619['params']['id']}})[_0xe196('0x25')](handleEntityNotFound(_0x42328c,null))[_0xe196('0x25')](function(_0xa2c0fa){if(_0xa2c0fa){return _0xa2c0fa[_0xe196('0x26')]()[_0xe196('0x25')](function(_0x4e66f1){return _0x4e66f1;});}})['then'](function(_0x4ed15f){_0x1d3c55=_0x4ed15f;if(_0x4ed15f){if(_0x4ed15f[_0xe196('0x5d')]||_0x4ed15f['CampaignId']){return db[_0x4ed15f['VoiceQueueId']?'VoiceQueue':'Campaign'][_0xe196('0x59')]({'where':{'id':_0x4ed15f[_0xe196('0x5d')]?_0x4ed15f[_0xe196('0x5d')]:_0x4ed15f['CampaignId']},'attributes':['id',_0xe196('0x2a')],'raw':!![]});}}})[_0xe196('0x25')](function(_0x59fc6d){var _0x14dc9d={};if(_0x59fc6d){_[_0xe196('0x4f')](_0x14dc9d,_[_0xe196('0x5e')](_0x1d3c55[_0xe196('0x5f')],[_0xe196('0x60'),_0xe196('0x61'),'id']));_0x14dc9d[_0xe196('0x62')]=0x15;_0x14dc9d['statedesc']='deleted';_0x14dc9d[_0xe196('0x63')]=_0x59fc6d[_0xe196('0x2a')];_0x14dc9d[_0xe196('0x64')]=_0x3ff619[_0xe196('0x65')]['name'];_0x14dc9d[_0xe196('0x66')]=_0x3ff619[_0xe196('0x65')]['id'];_0x14dc9d[_0xe196('0x67')]=!![];_0x14dc9d[_0xe196('0x68')]=moment()[_0xe196('0x69')](_0xe196('0x6a'));_0x14dc9d[_0xe196('0x6b')]=_0x1d3c55[_0xe196('0x6c')];_0x14dc9d[_0xe196('0x6d')]=_0x1d3c55['VoiceQueueId']?_0xe196('0x6e'):'ivr';return db[_0xe196('0x6f')]['find']({'where':{'id':_0x14dc9d[_0xe196('0x70')]},'attributes':['firstName',_0xe196('0x71')]})['then'](function(_0x54d8c1){if(!_['isNil'](_0x42328c)&&!_[_0xe196('0x72')](_0x54d8c1[_0xe196('0x73')])){_0x14dc9d['calleridname']=_0x54d8c1['firstName'];if(!_[_0xe196('0x72')](_0x54d8c1[_0xe196('0x71')])){_0x14dc9d[_0xe196('0x74')]+='\x20'+_0x54d8c1[_0xe196('0x71')];}}})['finally'](function(){return db[_0xe196('0x75')]['create'](_0x14dc9d);});}})[_0xe196('0x25')](function(){return _0x42328c['status'](0xcc)[_0xe196('0x27')]();})[_0xe196('0x54')](handleError(_0x42328c,null));};exports['getPreview']=function(_0x1c03e1,_0x5d0b13,_0x1f71e4){var _0x59ebbf=[];return db['CmContact'][_0xe196('0x5c')]()[_0xe196('0x25')](function(_0x195be7){_0x59ebbf=_[_0xe196('0x32')](_0x195be7);return _0x1c03e1['user'][_0xe196('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xe196('0x77')},'attributes':['id',_0xe196('0x78')],'raw':!![]});})['then'](function(_0x486f37){if(_0x486f37&&_0x486f37[_0xe196('0x57')]){return db[_0xe196('0x79')]['transaction'](function(_0x5f2c1c){var _0x4cdd32={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe196('0x69')](_0xe196('0x6a'))},'VoiceQueueId':{'$in':_[_0xe196('0x2c')](_0x486f37,'id')},'$or':[{'UserId':null},{'UserId':_0x1c03e1[_0xe196('0x65')]['id']}]};var _0x212466=[];if(_0x1c03e1[_0xe196('0x5b')]['direction']&&_0x1c03e1['body']['direction']===_0xe196('0x7a')){if(!_[_0xe196('0x7b')](_0x1c03e1[_0xe196('0x5b')][_0xe196('0x7c')])){_0x4cdd32['id']={'$in':_0x1c03e1[_0xe196('0x5b')][_0xe196('0x7c')]};}_0x212466=[[_0xe196('0x7d'),_0xe196('0x7e')],[_0xe196('0x7f'),_0x486f37[0x0][_0xe196('0x78')]===_0xe196('0x7e')?_0xe196('0x80'):_0xe196('0x7e')],db[_0xe196('0x79')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0xe196('0x7b')](_0x1c03e1['body'][_0xe196('0x7c')])){_0x4cdd32['id']={'$notIn':_0x1c03e1['body'][_0xe196('0x7c')]};}_0x212466=[[_0xe196('0x7d'),'DESC'],[_0xe196('0x7f'),_0x486f37[0x0][_0xe196('0x78')]],db[_0xe196('0x79')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db['CmHopper']['findOne']({'attributes':['id','scheduledat'],'where':_0x4cdd32,'order':_0x212466,'transaction':_0x5f2c1c,'lock':_0x5f2c1c[_0xe196('0x81')][_0xe196('0x82')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x59ebbf,'include':[{'model':db[_0xe196('0x83')],'as':_0xe196('0x84'),'attributes':['id',_0xe196('0x2a')]}]},{'model':db[_0xe196('0x85')],'as':'List','attributes':['id','name']},{'model':db[_0xe196('0x86')],'as':_0xe196('0x87'),'attributes':['id',_0xe196('0x2a'),_0xe196('0x88')]}]})[_0xe196('0x25')](function(_0x18a2a2){if(_0x18a2a2){return _0x18a2a2[_0xe196('0x24')]({'UserId':_0x1c03e1[_0xe196('0x65')]['id']},{'transaction':_0x5f2c1c});}});});}})[_0xe196('0x25')](handleEntityNotFound(_0x5d0b13,null))[_0xe196('0x25')](respondWithResult(_0x5d0b13,null))[_0xe196('0x54')](handleError(_0x5d0b13,null));};exports['getOpenContacts']=function(_0x3686ee,_0x390576,_0x470e93){return _0x3686ee['user'][_0xe196('0x76')]({'where':{'type':_0xe196('0x89'),'dialActive':!![],'dialMethod':_0xe196('0x77')},'attributes':['id'],'raw':!![]})[_0xe196('0x25')](function(_0x36bbb9){if(_0x36bbb9&&_0x36bbb9['length']){return db[_0xe196('0x2d')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe196('0x69')](_0xe196('0x6a'))},'VoiceQueueId':{'$in':_[_0xe196('0x2c')](_0x36bbb9,'id')},'$or':[{'UserId':null},{'UserId':_0x3686ee[_0xe196('0x65')]['id']}]}});}return 0x0;})[_0xe196('0x25')](function(_0x5d139d){if(!_[_0xe196('0x72')](_0x5d139d)&&_[_0xe196('0x8a')](_0x5d139d)){return _0x390576[_0xe196('0x1a')](0xc8)[_0xe196('0x1b')]({'contacts':_0x5d139d});}else{logger[_0xe196('0x29')](_0xe196('0x8b'),_0xe196('0x8c'),0x194,_0xe196('0x8d'));_0x390576[_0xe196('0x28')](0x194);}})['catch'](handleError(_0x390576,null));}; \ No newline at end of file +var _0xe192=['include','findAll','show','params','rawAttributes','find','catch','create','body','describe','VoiceQueueId','CampaignId','dataValues','createdAt','updatedAt','state','deleted','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','getPreview','preview','transaction','format','direction','prev','isEmpty','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','ASC','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','getOpenContacts','getVoiceQueues','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','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','limit','set','json','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','CmHopper','fieldName','key','model','query','keys','filters','intersection','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$notBetween','$in','$notIn','$like','$notLike','$notILike','$overlap','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xe192,0x16d));var _0x2e19=function(_0x5a7702,_0x2caa93){_0x5a7702=_0x5a7702-0x0;var _0x3e8969=_0xe192[_0x5a7702];return _0x3e8969;};'use strict';var emlformat=require(_0x2e19('0x0'));var rimraf=require(_0x2e19('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e19('0x2'));var rp=require(_0x2e19('0x3'));var moment=require(_0x2e19('0x4'));var BPromise=require(_0x2e19('0x5'));var Mustache=require('mustache');var util=require(_0x2e19('0x6'));var path=require(_0x2e19('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2e19('0x8'));var fs=require('fs');var fs_extra=require(_0x2e19('0x9'));var _=require(_0x2e19('0xa'));var squel=require(_0x2e19('0xb'));var crypto=require(_0x2e19('0xc'));var jsforce=require(_0x2e19('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2e19('0xe'));var querystring=require(_0x2e19('0xf'));var Papa=require(_0x2e19('0x10'));var Redis=require(_0x2e19('0x11'));var authService=require(_0x2e19('0x12'));var qs=require(_0x2e19('0x13'));var as=require(_0x2e19('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2e19('0x15'));var utils=require(_0x2e19('0x16'));var config=require(_0x2e19('0x17'));var licenseUtil=require(_0x2e19('0x18'));var db=require(_0x2e19('0x19'))['db'];function respondWithStatusCode(_0x5a901c,_0x209ebd){_0x209ebd=_0x209ebd||0xcc;return function(_0x4f36c3){if(_0x4f36c3){return _0x5a901c['sendStatus'](_0x209ebd);}return _0x5a901c[_0x2e19('0x1a')](_0x209ebd)[_0x2e19('0x1b')]();};}function respondWithResult(_0x31d482,_0x20d361){_0x20d361=_0x20d361||0xc8;return function(_0x57bead){if(_0x57bead){return _0x31d482[_0x2e19('0x1a')](_0x20d361)['json'](_0x57bead);}};}function respondWithFilteredResult(_0x23ed96,_0x45fa2b){return function(_0x247725){if(_0x247725){var _0x14d356=typeof _0x45fa2b[_0x2e19('0x1c')]===_0x2e19('0x1d')&&typeof _0x45fa2b['limit']===_0x2e19('0x1d');var _0x3d3b2b=_0x247725[_0x2e19('0x1e')];var _0xa79ca6=_0x14d356?0x0:_0x45fa2b[_0x2e19('0x1c')];var _0x2bae89=_0x14d356?_0x247725[_0x2e19('0x1e')]:_0x45fa2b['offset']+_0x45fa2b[_0x2e19('0x1f')];var _0xb585d0;if(_0x2bae89>=_0x3d3b2b){_0x2bae89=_0x3d3b2b;_0xb585d0=0xc8;}else{_0xb585d0=0xce;}_0x23ed96[_0x2e19('0x1a')](_0xb585d0);return _0x23ed96[_0x2e19('0x20')]('Content-Range',_0xa79ca6+'-'+_0x2bae89+'/'+_0x3d3b2b)[_0x2e19('0x21')](_0x247725);}return null;};}function patchUpdates(_0x3c5743){return function(_0xc364e){try{jsonpatch['apply'](_0xc364e,_0x3c5743,!![]);}catch(_0xefdc49){return BPromise[_0x2e19('0x22')](_0xefdc49);}return _0xc364e['save']();};}function saveUpdates(_0x178cef,_0x5079fd){return function(_0x379be8){if(_0x379be8){return _0x379be8[_0x2e19('0x23')](_0x178cef)['then'](function(_0x20abb0){return _0x20abb0;});}return null;};}function removeEntity(_0x4bb079,_0x174284){return function(_0x1cd72f){if(_0x1cd72f){return _0x1cd72f[_0x2e19('0x24')]()[_0x2e19('0x25')](function(){_0x4bb079[_0x2e19('0x1a')](0xcc)[_0x2e19('0x1b')]();});}};}function handleEntityNotFound(_0x48c0f2,_0x463c5a){return function(_0x3f5fd2){if(!_0x3f5fd2){_0x48c0f2[_0x2e19('0x26')](0x194);}return _0x3f5fd2;};}function handleError(_0x291c1c,_0x262dd3){_0x262dd3=_0x262dd3||0x1f4;return function(_0x30c106){logger[_0x2e19('0x27')](_0x30c106[_0x2e19('0x28')]);if(_0x30c106['name']){delete _0x30c106[_0x2e19('0x29')];}_0x291c1c[_0x2e19('0x1a')](_0x262dd3)[_0x2e19('0x2a')](_0x30c106);};}exports[_0x2e19('0x2b')]=function(_0xe06e65,_0xb69290){var _0x30c798={},_0x43ef38={},_0x2f3f17={'count':0x0,'rows':[]};var _0x4cf39f=_[_0x2e19('0x2c')](db[_0x2e19('0x2d')]['rawAttributes'],function(_0x1e51ed){return{'name':_0x1e51ed[_0x2e19('0x2e')],'type':_0x1e51ed['type'][_0x2e19('0x2f')]};});_0x43ef38[_0x2e19('0x30')]=_[_0x2e19('0x2c')](_0x4cf39f,_0x2e19('0x29'));_0x43ef38[_0x2e19('0x31')]=_[_0x2e19('0x32')](_0xe06e65[_0x2e19('0x31')]);_0x43ef38[_0x2e19('0x33')]=_[_0x2e19('0x34')](_0x43ef38['model'],_0x43ef38['query']);_0x43ef38[_0x2e19('0x33')]=_[_0x2e19('0x35')](_0x43ef38[_0x2e19('0x33')],[_0x2e19('0x36'),_0x2e19('0x37'),'$gt',_0x2e19('0x38'),_0x2e19('0x39'),_0x2e19('0x3a'),_0x2e19('0x3b'),_0x2e19('0x3c'),'$not','$between',_0x2e19('0x3d'),_0x2e19('0x3e'),_0x2e19('0x3f'),_0x2e19('0x40'),_0x2e19('0x41'),'$iLike',_0x2e19('0x42'),_0x2e19('0x40'),_0x2e19('0x43'),'$contains','$contained','$any']);_0x30c798[_0x2e19('0x44')]=_[_0x2e19('0x34')](_0x43ef38[_0x2e19('0x30')],qs[_0x2e19('0x45')](_0xe06e65['query'][_0x2e19('0x45')]));_0x30c798[_0x2e19('0x44')]=_0x30c798[_0x2e19('0x44')][_0x2e19('0x46')]?_0x30c798[_0x2e19('0x44')]:_0x43ef38['model'];if(!_0xe06e65[_0x2e19('0x31')][_0x2e19('0x47')](_0x2e19('0x48'))){_0x30c798[_0x2e19('0x1f')]=qs[_0x2e19('0x1f')](_0xe06e65[_0x2e19('0x31')][_0x2e19('0x1f')]);_0x30c798['offset']=qs[_0x2e19('0x1c')](_0xe06e65[_0x2e19('0x31')][_0x2e19('0x1c')]);}_0x30c798['order']=qs[_0x2e19('0x49')](_0xe06e65[_0x2e19('0x31')][_0x2e19('0x49')]);_0x30c798['where']=qs[_0x2e19('0x33')](_[_0x2e19('0x4a')](_0xe06e65['query'],_0x43ef38[_0x2e19('0x33')]),_0x4cf39f);if(_0xe06e65['query'][_0x2e19('0x4b')]){_0x30c798[_0x2e19('0x4c')]=_['merge'](_0x30c798[_0x2e19('0x4c')],{'$or':_['map'](_0x4cf39f,function(_0x3feee6){if(_0x3feee6[_0x2e19('0x4d')]!==_0x2e19('0x4e')){var _0x19358a={};_0x19358a[_0x3feee6[_0x2e19('0x29')]]={'$like':'%'+_0xe06e65[_0x2e19('0x31')][_0x2e19('0x4b')]+'%'};return _0x19358a;}})});}_0x30c798=_[_0x2e19('0x4f')]({},_0x30c798,_0xe06e65[_0x2e19('0x50')]);var _0x4c5679={'where':_0x30c798[_0x2e19('0x4c')]};return db[_0x2e19('0x2d')]['count'](_0x4c5679)[_0x2e19('0x25')](function(_0x12ff7e){_0x2f3f17[_0x2e19('0x1e')]=_0x12ff7e;if(_0xe06e65['query'][_0x2e19('0x51')]){_0x30c798[_0x2e19('0x52')]=[{'all':!![]}];}return db[_0x2e19('0x2d')][_0x2e19('0x53')](_0x30c798);})[_0x2e19('0x25')](function(_0x55bfb2){_0x2f3f17['rows']=_0x55bfb2;return _0x2f3f17;})[_0x2e19('0x25')](respondWithFilteredResult(_0xb69290,_0x30c798))['catch'](handleError(_0xb69290,null));};exports[_0x2e19('0x54')]=function(_0x129936,_0x1fde00){var _0xf77fc7={'raw':!![],'where':{'id':_0x129936[_0x2e19('0x55')]['id']}},_0x1a4a3e={};_0x1a4a3e[_0x2e19('0x30')]=_['keys'](db[_0x2e19('0x2d')][_0x2e19('0x56')]);_0x1a4a3e['query']=_[_0x2e19('0x32')](_0x129936['query']);_0x1a4a3e[_0x2e19('0x33')]=_[_0x2e19('0x34')](_0x1a4a3e[_0x2e19('0x30')],_0x1a4a3e['query']);_0xf77fc7[_0x2e19('0x44')]=_['intersection'](_0x1a4a3e[_0x2e19('0x30')],qs[_0x2e19('0x45')](_0x129936[_0x2e19('0x31')][_0x2e19('0x45')]));_0xf77fc7[_0x2e19('0x44')]=_0xf77fc7['attributes'][_0x2e19('0x46')]?_0xf77fc7[_0x2e19('0x44')]:_0x1a4a3e[_0x2e19('0x30')];if(_0x129936['query'][_0x2e19('0x51')]){_0xf77fc7['include']=[{'all':!![]}];}_0xf77fc7=_[_0x2e19('0x4f')]({},_0xf77fc7,_0x129936[_0x2e19('0x50')]);return db[_0x2e19('0x2d')][_0x2e19('0x57')](_0xf77fc7)[_0x2e19('0x25')](handleEntityNotFound(_0x1fde00,null))[_0x2e19('0x25')](respondWithResult(_0x1fde00,null))[_0x2e19('0x58')](handleError(_0x1fde00,null));};exports[_0x2e19('0x59')]=function(_0x3f82cc,_0x36921e){return db['CmHopper'][_0x2e19('0x59')](_0x3f82cc['body'],{})[_0x2e19('0x25')](respondWithResult(_0x36921e,0xc9))['catch'](handleError(_0x36921e,null));};exports['update']=function(_0x545113,_0x14a3d5){if(_0x545113[_0x2e19('0x5a')]['id']){delete _0x545113[_0x2e19('0x5a')]['id'];}return db[_0x2e19('0x2d')][_0x2e19('0x57')]({'where':{'id':_0x545113[_0x2e19('0x55')]['id']}})[_0x2e19('0x25')](handleEntityNotFound(_0x14a3d5,null))[_0x2e19('0x25')](saveUpdates(_0x545113[_0x2e19('0x5a')],null))[_0x2e19('0x25')](respondWithResult(_0x14a3d5,null))[_0x2e19('0x58')](handleError(_0x14a3d5,null));};exports['describe']=function(_0x253939,_0x20c614){return db[_0x2e19('0x2d')][_0x2e19('0x5b')]()[_0x2e19('0x25')](respondWithResult(_0x20c614,null))['catch'](handleError(_0x20c614,null));};exports[_0x2e19('0x24')]=function(_0x574b16,_0x21e3b){var _0x54cd43;return db[_0x2e19('0x2d')][_0x2e19('0x57')]({'where':{'id':_0x574b16[_0x2e19('0x55')]['id']}})[_0x2e19('0x25')](handleEntityNotFound(_0x21e3b,null))[_0x2e19('0x25')](function(_0x43b68c){if(_0x43b68c){return _0x43b68c[_0x2e19('0x24')]()[_0x2e19('0x25')](function(_0x2d3f95){return _0x2d3f95;});}})[_0x2e19('0x25')](function(_0x4bd366){_0x54cd43=_0x4bd366;if(_0x4bd366){if(_0x4bd366[_0x2e19('0x5c')]||_0x4bd366['CampaignId']){return db[_0x4bd366[_0x2e19('0x5c')]?'VoiceQueue':'Campaign'][_0x2e19('0x57')]({'where':{'id':_0x4bd366[_0x2e19('0x5c')]?_0x4bd366[_0x2e19('0x5c')]:_0x4bd366[_0x2e19('0x5d')]},'attributes':['id',_0x2e19('0x29')],'raw':!![]});}}})['then'](function(_0x5063a2){var _0x25f1b5={};if(_0x5063a2){_[_0x2e19('0x4f')](_0x25f1b5,_['omit'](_0x54cd43[_0x2e19('0x5e')],[_0x2e19('0x5f'),_0x2e19('0x60'),'id']));_0x25f1b5[_0x2e19('0x61')]=0x15;_0x25f1b5['statedesc']=_0x2e19('0x62');_0x25f1b5['campaign']=_0x5063a2[_0x2e19('0x29')];_0x25f1b5[_0x2e19('0x63')]=_0x574b16[_0x2e19('0x64')]['name'];_0x25f1b5[_0x2e19('0x65')]=_0x574b16[_0x2e19('0x64')]['id'];_0x25f1b5[_0x2e19('0x62')]=!![];_0x25f1b5[_0x2e19('0x66')]=moment()['format'](_0x2e19('0x67'));_0x25f1b5[_0x2e19('0x68')]=_0x54cd43[_0x2e19('0x69')];_0x25f1b5[_0x2e19('0x6a')]=_0x54cd43[_0x2e19('0x5c')]?_0x2e19('0x6b'):_0x2e19('0x6c');return db[_0x2e19('0x6d')][_0x2e19('0x57')]({'where':{'id':_0x25f1b5[_0x2e19('0x6e')]},'attributes':[_0x2e19('0x6f'),'lastName']})[_0x2e19('0x25')](function(_0x2c84b4){if(!_['isNil'](_0x21e3b)&&!_[_0x2e19('0x70')](_0x2c84b4[_0x2e19('0x6f')])){_0x25f1b5[_0x2e19('0x71')]=_0x2c84b4[_0x2e19('0x6f')];if(!_['isNil'](_0x2c84b4[_0x2e19('0x72')])){_0x25f1b5[_0x2e19('0x71')]+='\x20'+_0x2c84b4['lastName'];}}})[_0x2e19('0x73')](function(){return db['CmHopperFinal'][_0x2e19('0x59')](_0x25f1b5);});}})[_0x2e19('0x25')](function(){return _0x21e3b[_0x2e19('0x1a')](0xcc)['end']();})[_0x2e19('0x58')](handleError(_0x21e3b,null));};exports[_0x2e19('0x74')]=function(_0x4adbcd,_0x1b2ce5,_0x8662ed){var _0x6318dc=[];return db[_0x2e19('0x6d')][_0x2e19('0x5b')]()[_0x2e19('0x25')](function(_0x4ec0ff){_0x6318dc=_['keys'](_0x4ec0ff);return _0x4adbcd['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x2e19('0x75')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x2e19('0x25')](function(_0x3a9856){if(_0x3a9856&&_0x3a9856[_0x2e19('0x46')]){return db['sequelize'][_0x2e19('0x76')](function(_0x4909f3){var _0x2ebd23={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2e19('0x77')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x2e19('0x2c')](_0x3a9856,'id')},'$or':[{'UserId':null},{'UserId':_0x4adbcd[_0x2e19('0x64')]['id']}]};var _0x2020ab=[];if(_0x4adbcd['body'][_0x2e19('0x78')]&&_0x4adbcd[_0x2e19('0x5a')][_0x2e19('0x78')]===_0x2e19('0x79')){if(!_[_0x2e19('0x7a')](_0x4adbcd[_0x2e19('0x5a')][_0x2e19('0x7b')])){_0x2ebd23['id']={'$in':_0x4adbcd[_0x2e19('0x5a')][_0x2e19('0x7b')]};}_0x2020ab=[[_0x2e19('0x7c'),'ASC'],[_0x2e19('0x7d'),_0x3a9856[0x0][_0x2e19('0x7e')]===_0x2e19('0x7f')?_0x2e19('0x80'):_0x2e19('0x7f')],db[_0x2e19('0x81')][_0x2e19('0x82')](_0x2e19('0x83')),['id',_0x2e19('0x80')]];}else{if(!_[_0x2e19('0x7a')](_0x4adbcd[_0x2e19('0x5a')][_0x2e19('0x7b')])){_0x2ebd23['id']={'$notIn':_0x4adbcd[_0x2e19('0x5a')][_0x2e19('0x7b')]};}_0x2020ab=[['priority','DESC'],[_0x2e19('0x7d'),_0x3a9856[0x0][_0x2e19('0x7e')]],db[_0x2e19('0x81')][_0x2e19('0x82')](_0x2e19('0x84')),['id',_0x2e19('0x7f')]];}return db[_0x2e19('0x2d')][_0x2e19('0x85')]({'attributes':['id',_0x2e19('0x86')],'where':_0x2ebd23,'order':_0x2020ab,'transaction':_0x4909f3,'lock':_0x4909f3[_0x2e19('0x87')][_0x2e19('0x88')],'include':[{'model':db[_0x2e19('0x6d')],'as':_0x2e19('0x89'),'attributes':_0x6318dc,'include':[{'model':db[_0x2e19('0x8a')],'as':_0x2e19('0x8b'),'attributes':['id',_0x2e19('0x29')]}]},{'model':db['CmList'],'as':_0x2e19('0x8c'),'attributes':['id',_0x2e19('0x29')]},{'model':db['VoiceQueue'],'as':_0x2e19('0x8d'),'attributes':['id',_0x2e19('0x29'),_0x2e19('0x8e')]}]})[_0x2e19('0x25')](function(_0x4bc683){if(_0x4bc683){return _0x4bc683[_0x2e19('0x23')]({'UserId':_0x4adbcd[_0x2e19('0x64')]['id']},{'transaction':_0x4909f3});}});});}})[_0x2e19('0x25')](handleEntityNotFound(_0x1b2ce5,null))[_0x2e19('0x25')](respondWithResult(_0x1b2ce5,null))[_0x2e19('0x58')](handleError(_0x1b2ce5,null));};exports[_0x2e19('0x8f')]=function(_0x2320ef,_0x5ba7d7,_0x14347b){return _0x2320ef[_0x2e19('0x64')][_0x2e19('0x90')]({'where':{'type':_0x2e19('0x91'),'dialActive':!![],'dialMethod':_0x2e19('0x75')},'attributes':['id'],'raw':!![]})[_0x2e19('0x25')](function(_0x372cb0){if(_0x372cb0&&_0x372cb0[_0x2e19('0x46')]){return db[_0x2e19('0x2d')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2e19('0x77')](_0x2e19('0x67'))},'VoiceQueueId':{'$in':_['map'](_0x372cb0,'id')},'$or':[{'UserId':null},{'UserId':_0x2320ef[_0x2e19('0x64')]['id']}]}});}return 0x0;})[_0x2e19('0x25')](function(_0x2bbc3e){if(!_[_0x2e19('0x70')](_0x2bbc3e)&&_[_0x2e19('0x92')](_0x2bbc3e)){return _0x5ba7d7['status'](0xc8)[_0x2e19('0x21')]({'contacts':_0x2bbc3e});}else{logger[_0x2e19('0x27')](_0x2e19('0x93'),_0x2e19('0x8f'),0x194,_0x2e19('0x94'));_0x5ba7d7['sendStatus'](0x194);}})[_0x2e19('0x58')](handleError(_0x5ba7d7,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index c8444a5..f6e47f4 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 _0xc1c6=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x2972d1,_0x433cc4){var _0x418ecb=function(_0x3898bb){while(--_0x3898bb){_0x2972d1['push'](_0x2972d1['shift']());}};_0x418ecb(++_0x433cc4);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4de38a,_0x2442d3){_0x4de38a=_0x4de38a-0x0;var _0x2b3563=_0xc1c6[_0x4de38a];return _0x2b3563;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[{'name':_0x6c1c('0xa'),'fields':[_0x6c1c('0xa')]},{'name':'phone','fields':[_0x6c1c('0xb')]},{'name':_0x6c1c('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['define','scheduledat','phone','priority','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x438ddc,_0x3fc4ac){var _0x1483e7=function(_0x38f90a){while(--_0x38f90a){_0x438ddc['push'](_0x438ddc['shift']());}};_0x1483e7(++_0x3fc4ac);}(_0xf494,0x1c6));var _0x4f49=function(_0x39392a,_0x389c8b){_0x39392a=_0x39392a-0x0;var _0x2bba00=_0xf494[_0x39392a];return _0x2bba00;};'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')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]},{'name':_0x4f49('0xd'),'fields':[_0x4f49('0xd')]},{'name':_0x4f49('0xe'),'fields':[_0x4f49('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 83264bf..7f1503c 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 _0x374e=['Agent','name','voicePause','length','UserId','push','includes','MoveContactManagedDialer','`scheduledat`\x20>=\x20','format','\x22%s\x22','CountReScheduled','GetContactRecallMe','all','GetCmHopperPreview','describe','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetCmHopper','CmHopper','options','include','map','model','attributes','then','catch','ShowCmHopper','find','raw','CreateCmHopper','create','body','UpdateCmHopper','update','where','limit','DestroyCmHopper','destroy','GetContactDialer','sequelize','transaction','findAll','order','LOCK','UPDATE','CmContact','Contact','keys','User'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0x374e,0x1a8));var _0xe374=function(_0x2b20b3,_0x124c9e){_0x2b20b3=_0x2b20b3-0x0;var _0x4dad4b=_0x374e[_0x2b20b3];return _0x4dad4b;};'use strict';var _=require(_0xe374('0x0'));var util=require(_0xe374('0x1'));var moment=require('moment');var BPromise=require(_0xe374('0x2'));var rs=require(_0xe374('0x3'));var fs=require('fs');var Redis=require(_0xe374('0x4'));var db=require(_0xe374('0x5'))['db'];var utils=require(_0xe374('0x6'));var logger=require(_0xe374('0x7'))(_0xe374('0x8'));var config=require(_0xe374('0x9'));var jayson=require(_0xe374('0xa'));var client=jayson['client'][_0xe374('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e87a8,_0x579cf9,_0xafd364){return new BPromise(function(_0x223a13,_0x34553b){return client['request'](_0x2e87a8,_0xafd364)['then'](function(_0x412552){logger[_0xe374('0xc')](_0xe374('0xd'),_0x579cf9,_0xe374('0xe'));logger[_0xe374('0xf')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x579cf9,_0xe374('0xe'),JSON[_0xe374('0x10')](_0x412552));if(_0x412552['error']){if(_0x412552[_0xe374('0x11')][_0xe374('0x12')]===0x1f4){logger[_0xe374('0x11')]('CmHopper,\x20%s,\x20%s',_0x579cf9,_0x412552[_0xe374('0x11')][_0xe374('0x13')]);return _0x34553b(_0x412552[_0xe374('0x11')][_0xe374('0x13')]);}logger[_0xe374('0x11')](_0xe374('0xd'),_0x579cf9,_0x412552[_0xe374('0x11')][_0xe374('0x13')]);return _0x223a13(_0x412552[_0xe374('0x11')][_0xe374('0x13')]);}else{logger[_0xe374('0xc')](_0xe374('0xd'),_0x579cf9,_0xe374('0xe'));_0x223a13(_0x412552['result'][_0xe374('0x13')]);}})['catch'](function(_0x369915){logger[_0xe374('0x11')](_0xe374('0xd'),_0x579cf9,_0x369915);_0x34553b(_0x369915);});});}exports[_0xe374('0x14')]=function(_0x1fde75){var _0x23bcfc=this;return new Promise(function(_0x1ea3bc,_0x1c9ad7){return db[_0xe374('0x15')]['findAll']({'raw':_0x1fde75['options']?_0x1fde75[_0xe374('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1fde75['options']?_0x1fde75[_0xe374('0x16')]['where']||null:null,'attributes':_0x1fde75[_0xe374('0x16')]?_0x1fde75[_0xe374('0x16')]['attributes']||null:null,'limit':_0x1fde75[_0xe374('0x16')]?_0x1fde75['options']['limit']||null:null,'include':_0x1fde75[_0xe374('0x16')]?_0x1fde75[_0xe374('0x16')][_0xe374('0x17')]?_[_0xe374('0x18')](_0x1fde75[_0xe374('0x16')]['include'],function(_0x2bc1e8){return{'model':db[_0x2bc1e8[_0xe374('0x19')]],'as':_0x2bc1e8['as'],'attributes':_0x2bc1e8[_0xe374('0x1a')],'include':_0x2bc1e8[_0xe374('0x17')]?_['map'](_0x2bc1e8[_0xe374('0x17')],function(_0x1cb486){return{'model':db[_0x1cb486[_0xe374('0x19')]],'as':_0x1cb486['as'],'attributes':_0x1cb486[_0xe374('0x1a')],'include':_0x1cb486['include']?_[_0xe374('0x18')](_0x1cb486[_0xe374('0x17')],function(_0x5f2cc9){return{'model':db[_0x5f2cc9['model']],'as':_0x5f2cc9['as'],'attributes':_0x5f2cc9[_0xe374('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe374('0x1b')](function(_0xc009ab){logger['info'](_0xe374('0x14'),_0x1fde75);logger[_0xe374('0xf')]('GetCmHopper',_0x1fde75,JSON[_0xe374('0x10')](_0xc009ab));_0x1ea3bc(_0xc009ab);})[_0xe374('0x1c')](function(_0x385c30){logger[_0xe374('0x11')](_0xe374('0x14'),_0x385c30[_0xe374('0x13')],_0x1fde75);_0x1c9ad7(_0x23bcfc['error'](0x1f4,_0x385c30[_0xe374('0x13')]));});});};exports[_0xe374('0x1d')]=function(_0x1dada1){var _0x3e37b6=this;return new Promise(function(_0x288e29,_0x377aa0){return db[_0xe374('0x15')][_0xe374('0x1e')]({'raw':_0x1dada1[_0xe374('0x16')]?_0x1dada1['options'][_0xe374('0x1f')]===undefined?!![]:![]:!![],'where':_0x1dada1[_0xe374('0x16')]?_0x1dada1[_0xe374('0x16')]['where']||null:null,'attributes':_0x1dada1[_0xe374('0x16')]?_0x1dada1[_0xe374('0x16')]['attributes']||null:null,'include':_0x1dada1[_0xe374('0x16')]?_0x1dada1[_0xe374('0x16')][_0xe374('0x17')]?_['map'](_0x1dada1[_0xe374('0x16')]['include'],function(_0x209817){return{'model':db[_0x209817[_0xe374('0x19')]],'as':_0x209817['as'],'attributes':_0x209817['attributes'],'include':_0x209817['include']?_[_0xe374('0x18')](_0x209817[_0xe374('0x17')],function(_0x58dc31){return{'model':db[_0x58dc31['model']],'as':_0x58dc31['as'],'attributes':_0x58dc31[_0xe374('0x1a')],'include':_0x58dc31[_0xe374('0x17')]?_['map'](_0x58dc31[_0xe374('0x17')],function(_0x4cece0){return{'model':db[_0x4cece0['model']],'as':_0x4cece0['as'],'attributes':_0x4cece0[_0xe374('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe374('0x1b')](function(_0x5ca60c){logger[_0xe374('0xc')](_0xe374('0x1d'),_0x1dada1);logger[_0xe374('0xf')](_0xe374('0x1d'),_0x1dada1,JSON['stringify'](_0x5ca60c));_0x288e29(_0x5ca60c);})[_0xe374('0x1c')](function(_0x1167b1){logger['error']('ShowCmHopper',_0x1167b1[_0xe374('0x13')],_0x1dada1);_0x377aa0(_0x3e37b6['error'](0x1f4,_0x1167b1[_0xe374('0x13')]));});});};exports[_0xe374('0x20')]=function(_0x1cba23){var _0x4bca8d=this;return new Promise(function(_0x389eb6,_0x359ade){return db['CmHopper'][_0xe374('0x21')](_0x1cba23[_0xe374('0x22')],{'raw':_0x1cba23[_0xe374('0x16')]?_0x1cba23[_0xe374('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xe374('0x1b')](function(_0x52061d){logger[_0xe374('0xc')]('CreateCmHopper',_0x1cba23);logger[_0xe374('0xf')](_0xe374('0x20'),_0x1cba23,JSON[_0xe374('0x10')](_0x52061d));_0x389eb6(_0x52061d);})[_0xe374('0x1c')](function(_0x2bed0e){logger[_0xe374('0x11')]('CreateCmHopper',_0x2bed0e['message'],_0x1cba23);_0x359ade(_0x4bca8d['error'](0x1f4,_0x2bed0e[_0xe374('0x13')]));});});};exports[_0xe374('0x23')]=function(_0x54d532){var _0x5e07db=this;return new Promise(function(_0x1b7f62,_0x15af27){return db['CmHopper'][_0xe374('0x24')](_0x54d532[_0xe374('0x22')],{'raw':_0x54d532[_0xe374('0x16')]?_0x54d532['options'][_0xe374('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54d532[_0xe374('0x16')]?_0x54d532[_0xe374('0x16')][_0xe374('0x25')]||null:null,'attributes':_0x54d532[_0xe374('0x16')]?_0x54d532[_0xe374('0x16')]['attributes']||null:null,'limit':_0x54d532[_0xe374('0x16')]?_0x54d532['options'][_0xe374('0x26')]||null:null})['then'](function(_0x20fd5b){logger[_0xe374('0xc')](_0xe374('0x23'),_0x54d532);logger['debug'](_0xe374('0x23'),_0x54d532,JSON['stringify'](_0x20fd5b));_0x1b7f62(_0x20fd5b);})['catch'](function(_0x52ad55){logger[_0xe374('0x11')](_0xe374('0x23'),_0x52ad55[_0xe374('0x13')],_0x54d532);_0x15af27(_0x5e07db[_0xe374('0x11')](0x1f4,_0x52ad55['message']));});});};exports[_0xe374('0x27')]=function(_0x1bdbd1){var _0x6c1e5b=this;return new Promise(function(_0x30975f,_0x2ddc09){return db[_0xe374('0x15')][_0xe374('0x28')]({'where':_0x1bdbd1['options']?_0x1bdbd1[_0xe374('0x16')]['where']||null:null})[_0xe374('0x1b')](function(_0x1b93ca){logger[_0xe374('0xc')](_0xe374('0x27'),_0x1bdbd1);logger['debug']('DestroyCmHopper',_0x1bdbd1,JSON[_0xe374('0x10')](_0x1b93ca));_0x30975f(_0x1b93ca);})[_0xe374('0x1c')](function(_0x5e4b45){logger[_0xe374('0x11')](_0xe374('0x27'),_0x5e4b45[_0xe374('0x13')],_0x1bdbd1);_0x2ddc09(_0x6c1e5b['error'](0x1f4,_0x5e4b45[_0xe374('0x13')]));});});};exports[_0xe374('0x29')]=function(_0x144720){var _0x5030e4=this;return new Promise(function(_0x323a20,_0x2eee8c){return db['CmContact']['describe']()[_0xe374('0x1b')](function(_0x3a91a1){return db[_0xe374('0x2a')][_0xe374('0x2b')](function(_0x23a07e){return db[_0xe374('0x15')][_0xe374('0x2c')]({'where':_0x144720[_0xe374('0x16')]?_0x144720[_0xe374('0x16')]['where']||null:null,'attributes':_0x144720[_0xe374('0x16')]?_0x144720['options'][_0xe374('0x1a')]||null:null,'limit':_0x144720[_0xe374('0x16')]?_0x144720[_0xe374('0x16')][_0xe374('0x26')]||null:null,'order':_0x144720[_0xe374('0x16')]?_0x144720[_0xe374('0x16')][_0xe374('0x2d')]||null:null,'transaction':_0x23a07e,'lock':_0x23a07e[_0xe374('0x2e')][_0xe374('0x2f')],'include':[{'model':db[_0xe374('0x30')],'as':_0xe374('0x31'),'attributes':_[_0xe374('0x32')](_0x3a91a1)},{'model':db[_0xe374('0x33')],'as':_0xe374('0x34'),'attributes':['id',_0xe374('0x35'),_0xe374('0x36')]}]})[_0xe374('0x1b')](function(_0x35df31){var _0x3e1e5a=[];var _0x153f5d=[];for(var _0x3e911a=0x0;_0x3e911a<_0x35df31[_0xe374('0x37')];_0x3e911a+=0x1){var _0x4e2129=_0x35df31[_0x3e911a][_0xe374('0x38')];if(_0x4e2129===null){_0x3e1e5a[_0xe374('0x39')](_0x35df31[_0x3e911a][_0xe374('0x24')](_0x144720['body'],{'transaction':_0x23a07e}));}else if(!_0x153f5d[_0xe374('0x3a')](_0x4e2129)){_0x153f5d[_0xe374('0x39')](_0x4e2129);_0x3e1e5a[_0xe374('0x39')](_0x35df31[_0x3e911a][_0xe374('0x24')](_0x144720['body'],{'transaction':_0x23a07e}));}}return BPromise['all'](_0x3e1e5a);});})[_0xe374('0x1b')](function(_0x1c0fee){logger['info'](_0xe374('0x29'),_0x144720);logger[_0xe374('0xf')](_0xe374('0x29'),_0x144720,JSON['stringify'](_0x1c0fee));_0x323a20(_0x1c0fee);})['catch'](function(_0x4690d4){logger['error'](_0xe374('0x29'),_0x4690d4[_0xe374('0x13')],_0x144720);_0x2eee8c(_0x5030e4['error'](0x1f4,_0x4690d4[_0xe374('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x489e9e){var _0x49be94=this;return new Promise(function(_0x1ce299,_0x47e258){return db['sequelize'][_0xe374('0x2b')](function(_0x31485e){return db['CmHopperFinal'][_0xe374('0x21')](_0x489e9e[_0xe374('0x22')],{'raw':_0x489e9e['options']?_0x489e9e[_0xe374('0x16')][_0xe374('0x1f')]===undefined?!![]:![]:!![],'transaction':_0x31485e})[_0xe374('0x1b')](function(){return db[_0xe374('0x15')][_0xe374('0x28')]({'where':_0x489e9e['options']?_0x489e9e['options']['where']||null:null,'transaction':_0x31485e});});})[_0xe374('0x1b')](function(_0x4a4b32){logger[_0xe374('0xc')](_0xe374('0x3b'),_0x489e9e);logger['debug'](_0xe374('0x3b'),_0x489e9e,JSON['stringify'](_0x4a4b32));_0x1ce299(_0x4a4b32);})[_0xe374('0x1c')](function(_0x3b04e1){logger['error'](_0xe374('0x3b'),_0x3b04e1[_0xe374('0x13')],_0x489e9e);_0x47e258(_0x49be94['error'](0x1f4,_0x3b04e1[_0xe374('0x13')]));});});};exports['CountReScheduled']=function(_0x6b5aee){var _0x18c83d=this;return new Promise(function(_0x35339e,_0x48b117){return db[_0xe374('0x15')][_0xe374('0x2c')]({'raw':_0x6b5aee[_0xe374('0x16')]?_0x6b5aee[_0xe374('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x6b5aee[_0xe374('0x16')]?_0x6b5aee[_0xe374('0x16')][_0xe374('0x25')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xe374('0x2a')]['fn']('IF',db[_0xe374('0x2a')]['literal'](_0xe374('0x3c')+util[_0xe374('0x3d')](_0xe374('0x3e'),moment()[_0xe374('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0xe374('0x1b')](function(_0x3158b9){logger['info'](_0xe374('0x3f'),_0x6b5aee);logger[_0xe374('0xf')](_0xe374('0x3f'),_0x6b5aee,JSON[_0xe374('0x10')](_0x3158b9));_0x35339e(_0x3158b9);})[_0xe374('0x1c')](function(_0x217c1d){logger['error'](_0xe374('0x3f'),_0x217c1d['message'],_0x6b5aee);_0x48b117(_0x18c83d['error'](0x1f4,_0x217c1d[_0xe374('0x13')]));});});};exports[_0xe374('0x40')]=function(_0x27656f){var _0x5cb9d3=this;return new Promise(function(_0x33fa03,_0x559ed5){return db['CmContact']['describe']()[_0xe374('0x1b')](function(_0x1399a6){return db[_0xe374('0x2a')][_0xe374('0x2b')](function(_0x5cc475){return db[_0xe374('0x15')][_0xe374('0x2c')]({'where':_0x27656f[_0xe374('0x16')]?_0x27656f[_0xe374('0x16')]['where']||null:null,'attributes':_0x27656f[_0xe374('0x16')]?_0x27656f[_0xe374('0x16')][_0xe374('0x1a')]||null:null,'limit':0x1,'order':_0x27656f['options']?_0x27656f[_0xe374('0x16')]['order']||null:null,'group':db[_0xe374('0x15')][_0xe374('0x38')],'transaction':_0x5cc475,'lock':_0x5cc475[_0xe374('0x2e')]['UPDATE'],'include':_0x27656f[_0xe374('0x16')]?_0x27656f[_0xe374('0x16')]['include']?_[_0xe374('0x18')](_0x27656f[_0xe374('0x16')][_0xe374('0x17')],function(_0x3ac8cd){return{'model':db[_0x3ac8cd[_0xe374('0x19')]],'as':_0x3ac8cd['as'],'attributes':_0x3ac8cd[_0xe374('0x1a')],'include':_0x3ac8cd[_0xe374('0x17')]?_[_0xe374('0x18')](_0x3ac8cd[_0xe374('0x17')],function(_0x3c7b6a){return{'model':db[_0x3c7b6a[_0xe374('0x19')]],'as':_0x3c7b6a['as'],'attributes':_0x3c7b6a['attributes'],'include':_0x3c7b6a['include']?_[_0xe374('0x18')](_0x3c7b6a[_0xe374('0x17')],function(_0x51d694){return{'model':db[_0x51d694[_0xe374('0x19')]],'as':_0x51d694['as'],'attributes':_0x51d694[_0xe374('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe374('0x1b')](function(_0x53338b){var _0x41c9a8=[];for(var _0x701891=0x0;_0x701891<_0x53338b[_0xe374('0x37')];_0x701891+=0x1){_0x41c9a8[_0xe374('0x39')](_0x53338b[_0x701891]['update'](_0x27656f[_0xe374('0x22')],{'transaction':_0x5cc475}));}return BPromise[_0xe374('0x41')](_0x41c9a8);});})[_0xe374('0x1b')](function(_0x4013e7){logger[_0xe374('0xc')](_0xe374('0x40'),_0x27656f);logger[_0xe374('0xf')](_0xe374('0x40'),_0x27656f,JSON[_0xe374('0x10')](_0x4013e7));_0x33fa03(_0x4013e7);})[_0xe374('0x1c')](function(_0x1badd7){logger['error'](_0xe374('0x40'),_0x1badd7['message'],_0x27656f);_0x559ed5(_0x5cb9d3['error'](0x1f4,_0x1badd7[_0xe374('0x13')]));});});});};exports[_0xe374('0x42')]=function(_0x354cd6){var _0x32532b=this;return new Promise(function(_0xafab90,_0x4f113a){db[_0xe374('0x30')][_0xe374('0x43')]()[_0xe374('0x1b')](function(_0x572966){return db['CmHopper'][_0xe374('0x2c')]({'raw':_0x354cd6[_0xe374('0x16')]?_0x354cd6[_0xe374('0x16')][_0xe374('0x1f')]===undefined?!![]:![]:!![],'where':_0x354cd6[_0xe374('0x16')]?_0x354cd6[_0xe374('0x16')][_0xe374('0x25')]||null:null,'attributes':_0x354cd6['options']?_0x354cd6['options'][_0xe374('0x1a')]||null:null,'limit':_0x354cd6[_0xe374('0x16')]?_0x354cd6[_0xe374('0x16')][_0xe374('0x26')]||null:null,'include':_0x354cd6[_0xe374('0x16')]?_0x354cd6[_0xe374('0x16')]['include']?_[_0xe374('0x18')](_0x354cd6[_0xe374('0x16')]['include'],function(_0x30b720){return{'model':db[_0x30b720[_0xe374('0x19')]],'as':_0x30b720['as'],'attributes':_0x30b720['as']===_0xe374('0x31')?_[_0xe374('0x32')](_0x572966):_0x30b720[_0xe374('0x1a')],'include':_0x30b720[_0xe374('0x17')]?_[_0xe374('0x18')](_0x30b720[_0xe374('0x17')],function(_0x1609e4){return{'model':db[_0x1609e4[_0xe374('0x19')]],'as':_0x1609e4['as'],'attributes':_0x1609e4[_0xe374('0x1a')],'include':_0x1609e4[_0xe374('0x17')]?_['map'](_0x1609e4[_0xe374('0x17')],function(_0x1aa04b){return{'model':db[_0x1aa04b[_0xe374('0x19')]],'as':_0x1aa04b['as'],'attributes':_0x1aa04b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x11d20f){logger[_0xe374('0xc')](_0xe374('0x14'),_0x354cd6);logger[_0xe374('0xf')](_0xe374('0x14'),_0x354cd6,JSON[_0xe374('0x10')](_0x11d20f));_0xafab90(_0x11d20f);})['catch'](function(_0x567e4d){logger['error'](_0xe374('0x14'),_0x567e4d[_0xe374('0x13')],_0x354cd6);_0x4f113a(_0x32532b[_0xe374('0x11')](0x1f4,_0x567e4d[_0xe374('0x13')]));});});});}; \ No newline at end of file +var _0xbfc2=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','stringify','ShowCmHopper','find','info','CreateCmHopper','create','body','UpdateCmHopper','update','limit','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','order','Contact','User','voicePause','length','push','includes','MoveContactManagedDialer','CmHopperFinal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','CmContact','LOCK','UPDATE','keys','lodash'];(function(_0x41e270,_0x12d030){var _0x2485c3=function(_0xf3f483){while(--_0xf3f483){_0x41e270['push'](_0x41e270['shift']());}};_0x2485c3(++_0x12d030);}(_0xbfc2,0x1a3));var _0x2bfc=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xbfc2[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x2bfc('0x0'));var util=require('util');var moment=require(_0x2bfc('0x1'));var BPromise=require(_0x2bfc('0x2'));var rs=require(_0x2bfc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2bfc('0x4'))['db'];var utils=require(_0x2bfc('0x5'));var logger=require(_0x2bfc('0x6'))(_0x2bfc('0x7'));var config=require(_0x2bfc('0x8'));var jayson=require(_0x2bfc('0x9'));var client=jayson[_0x2bfc('0xa')][_0x2bfc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5229ba,_0x1c9854,_0x11609f){return new BPromise(function(_0x3c600b,_0x12d910){return client[_0x2bfc('0xc')](_0x5229ba,_0x11609f)[_0x2bfc('0xd')](function(_0x462449){logger['info'](_0x2bfc('0xe'),_0x1c9854,_0x2bfc('0xf'));logger[_0x2bfc('0x10')](_0x2bfc('0x11'),_0x1c9854,'request\x20sent',JSON['stringify'](_0x462449));if(_0x462449[_0x2bfc('0x12')]){if(_0x462449[_0x2bfc('0x12')][_0x2bfc('0x13')]===0x1f4){logger[_0x2bfc('0x12')](_0x2bfc('0xe'),_0x1c9854,_0x462449[_0x2bfc('0x12')][_0x2bfc('0x14')]);return _0x12d910(_0x462449['error']['message']);}logger[_0x2bfc('0x12')](_0x2bfc('0xe'),_0x1c9854,_0x462449[_0x2bfc('0x12')][_0x2bfc('0x14')]);return _0x3c600b(_0x462449[_0x2bfc('0x12')]['message']);}else{logger['info'](_0x2bfc('0xe'),_0x1c9854,_0x2bfc('0xf'));_0x3c600b(_0x462449[_0x2bfc('0x15')][_0x2bfc('0x14')]);}})[_0x2bfc('0x16')](function(_0x152ea5){logger['error'](_0x2bfc('0xe'),_0x1c9854,_0x152ea5);_0x12d910(_0x152ea5);});});}exports[_0x2bfc('0x17')]=function(_0x2dfe42){var _0x3b0528=this;return new Promise(function(_0x40c7a4,_0x10278f){return db[_0x2bfc('0x18')][_0x2bfc('0x19')]({'raw':_0x2dfe42[_0x2bfc('0x1a')]?_0x2dfe42[_0x2bfc('0x1a')][_0x2bfc('0x1b')]===undefined?!![]:![]:!![],'where':_0x2dfe42[_0x2bfc('0x1a')]?_0x2dfe42[_0x2bfc('0x1a')][_0x2bfc('0x1c')]||null:null,'attributes':_0x2dfe42['options']?_0x2dfe42[_0x2bfc('0x1a')][_0x2bfc('0x1d')]||null:null,'limit':_0x2dfe42[_0x2bfc('0x1a')]?_0x2dfe42[_0x2bfc('0x1a')]['limit']||null:null,'include':_0x2dfe42[_0x2bfc('0x1a')]?_0x2dfe42['options'][_0x2bfc('0x1e')]?_[_0x2bfc('0x1f')](_0x2dfe42[_0x2bfc('0x1a')]['include'],function(_0x43f4e2){return{'model':db[_0x43f4e2[_0x2bfc('0x20')]],'as':_0x43f4e2['as'],'attributes':_0x43f4e2['attributes'],'include':_0x43f4e2[_0x2bfc('0x1e')]?_[_0x2bfc('0x1f')](_0x43f4e2[_0x2bfc('0x1e')],function(_0x3ad8c2){return{'model':db[_0x3ad8c2[_0x2bfc('0x20')]],'as':_0x3ad8c2['as'],'attributes':_0x3ad8c2[_0x2bfc('0x1d')],'include':_0x3ad8c2[_0x2bfc('0x1e')]?_['map'](_0x3ad8c2[_0x2bfc('0x1e')],function(_0x246d4d){return{'model':db[_0x246d4d['model']],'as':_0x246d4d['as'],'attributes':_0x246d4d[_0x2bfc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2bfc('0xd')](function(_0x4a7343){logger['info'](_0x2bfc('0x17'),_0x2dfe42);logger[_0x2bfc('0x10')]('GetCmHopper',_0x2dfe42,JSON[_0x2bfc('0x21')](_0x4a7343));_0x40c7a4(_0x4a7343);})['catch'](function(_0x33c8a5){logger[_0x2bfc('0x12')](_0x2bfc('0x17'),_0x33c8a5['message'],_0x2dfe42);_0x10278f(_0x3b0528[_0x2bfc('0x12')](0x1f4,_0x33c8a5['message']));});});};exports[_0x2bfc('0x22')]=function(_0x5c3fac){var _0x1cc264=this;return new Promise(function(_0x3a3570,_0x45ec11){return db[_0x2bfc('0x18')][_0x2bfc('0x23')]({'raw':_0x5c3fac[_0x2bfc('0x1a')]?_0x5c3fac[_0x2bfc('0x1a')][_0x2bfc('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c3fac['options']?_0x5c3fac[_0x2bfc('0x1a')]['where']||null:null,'attributes':_0x5c3fac[_0x2bfc('0x1a')]?_0x5c3fac[_0x2bfc('0x1a')][_0x2bfc('0x1d')]||null:null,'include':_0x5c3fac[_0x2bfc('0x1a')]?_0x5c3fac[_0x2bfc('0x1a')][_0x2bfc('0x1e')]?_[_0x2bfc('0x1f')](_0x5c3fac[_0x2bfc('0x1a')][_0x2bfc('0x1e')],function(_0x3ea14a){return{'model':db[_0x3ea14a['model']],'as':_0x3ea14a['as'],'attributes':_0x3ea14a['attributes'],'include':_0x3ea14a['include']?_[_0x2bfc('0x1f')](_0x3ea14a['include'],function(_0x157678){return{'model':db[_0x157678[_0x2bfc('0x20')]],'as':_0x157678['as'],'attributes':_0x157678[_0x2bfc('0x1d')],'include':_0x157678['include']?_[_0x2bfc('0x1f')](_0x157678[_0x2bfc('0x1e')],function(_0xb6442d){return{'model':db[_0xb6442d[_0x2bfc('0x20')]],'as':_0xb6442d['as'],'attributes':_0xb6442d['attributes']};}):[]};}):[]};}):[]:[]})[_0x2bfc('0xd')](function(_0x243c1c){logger[_0x2bfc('0x24')](_0x2bfc('0x22'),_0x5c3fac);logger[_0x2bfc('0x10')](_0x2bfc('0x22'),_0x5c3fac,JSON[_0x2bfc('0x21')](_0x243c1c));_0x3a3570(_0x243c1c);})[_0x2bfc('0x16')](function(_0x1f87ff){logger[_0x2bfc('0x12')](_0x2bfc('0x22'),_0x1f87ff['message'],_0x5c3fac);_0x45ec11(_0x1cc264['error'](0x1f4,_0x1f87ff[_0x2bfc('0x14')]));});});};exports[_0x2bfc('0x25')]=function(_0x464e56){var _0x2323bd=this;return new Promise(function(_0x1efa1e,_0x518dab){return db[_0x2bfc('0x18')][_0x2bfc('0x26')](_0x464e56[_0x2bfc('0x27')],{'raw':_0x464e56[_0x2bfc('0x1a')]?_0x464e56[_0x2bfc('0x1a')][_0x2bfc('0x1b')]===undefined?!![]:![]:!![]})[_0x2bfc('0xd')](function(_0x59b224){logger[_0x2bfc('0x24')](_0x2bfc('0x25'),_0x464e56);logger[_0x2bfc('0x10')](_0x2bfc('0x25'),_0x464e56,JSON[_0x2bfc('0x21')](_0x59b224));_0x1efa1e(_0x59b224);})['catch'](function(_0x1b7830){logger[_0x2bfc('0x12')](_0x2bfc('0x25'),_0x1b7830[_0x2bfc('0x14')],_0x464e56);_0x518dab(_0x2323bd[_0x2bfc('0x12')](0x1f4,_0x1b7830[_0x2bfc('0x14')]));});});};exports[_0x2bfc('0x28')]=function(_0x2e4a2a){var _0x3b9e62=this;return new Promise(function(_0x2e7000,_0x1668b4){return db[_0x2bfc('0x18')][_0x2bfc('0x29')](_0x2e4a2a['body'],{'raw':_0x2e4a2a[_0x2bfc('0x1a')]?_0x2e4a2a['options'][_0x2bfc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e4a2a[_0x2bfc('0x1a')]?_0x2e4a2a[_0x2bfc('0x1a')][_0x2bfc('0x1c')]||null:null,'attributes':_0x2e4a2a['options']?_0x2e4a2a[_0x2bfc('0x1a')][_0x2bfc('0x1d')]||null:null,'limit':_0x2e4a2a[_0x2bfc('0x1a')]?_0x2e4a2a[_0x2bfc('0x1a')][_0x2bfc('0x2a')]||null:null})[_0x2bfc('0xd')](function(_0x1510de){logger[_0x2bfc('0x24')](_0x2bfc('0x28'),_0x2e4a2a);logger['debug']('UpdateCmHopper',_0x2e4a2a,JSON[_0x2bfc('0x21')](_0x1510de));_0x2e7000(_0x1510de);})[_0x2bfc('0x16')](function(_0x15de14){logger[_0x2bfc('0x12')](_0x2bfc('0x28'),_0x15de14[_0x2bfc('0x14')],_0x2e4a2a);_0x1668b4(_0x3b9e62['error'](0x1f4,_0x15de14[_0x2bfc('0x14')]));});});};exports[_0x2bfc('0x2b')]=function(_0x5cbd3b){var _0x43a7bc=this;return new Promise(function(_0xae467,_0x56cceb){return db[_0x2bfc('0x18')][_0x2bfc('0x2c')]({'where':_0x5cbd3b['options']?_0x5cbd3b[_0x2bfc('0x1a')][_0x2bfc('0x1c')]||null:null})[_0x2bfc('0xd')](function(_0x361405){logger[_0x2bfc('0x24')](_0x2bfc('0x2b'),_0x5cbd3b);logger[_0x2bfc('0x10')](_0x2bfc('0x2b'),_0x5cbd3b,JSON[_0x2bfc('0x21')](_0x361405));_0xae467(_0x361405);})['catch'](function(_0x537ff5){logger[_0x2bfc('0x12')](_0x2bfc('0x2b'),_0x537ff5[_0x2bfc('0x14')],_0x5cbd3b);_0x56cceb(_0x43a7bc[_0x2bfc('0x12')](0x1f4,_0x537ff5[_0x2bfc('0x14')]));});});};exports[_0x2bfc('0x2d')]=function(_0x1a7ad1){var _0x1dd582=this;return new Promise(function(_0x20d0f2,_0x28a66f){return db['CmContact'][_0x2bfc('0x2e')]()[_0x2bfc('0xd')](function(_0x39c67b){return db[_0x2bfc('0x2f')][_0x2bfc('0x30')](function(_0x1a4e5d){return db[_0x2bfc('0x18')][_0x2bfc('0x19')]({'where':_0x1a7ad1['options']?_0x1a7ad1[_0x2bfc('0x1a')][_0x2bfc('0x1c')]||null:null,'attributes':_0x1a7ad1[_0x2bfc('0x1a')]?_0x1a7ad1['options'][_0x2bfc('0x1d')]||null:null,'limit':_0x1a7ad1[_0x2bfc('0x1a')]?_0x1a7ad1[_0x2bfc('0x1a')][_0x2bfc('0x2a')]||null:null,'order':_0x1a7ad1[_0x2bfc('0x1a')]?_0x1a7ad1[_0x2bfc('0x1a')][_0x2bfc('0x31')]||null:null,'transaction':_0x1a4e5d,'lock':_0x1a4e5d['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x2bfc('0x32'),'attributes':_['keys'](_0x39c67b)},{'model':db[_0x2bfc('0x33')],'as':'Agent','attributes':['id','name',_0x2bfc('0x34')]}]})[_0x2bfc('0xd')](function(_0x4e442d){var _0x3a65a0=[];var _0x168826=[];for(var _0x3b0d98=0x0;_0x3b0d98<_0x4e442d[_0x2bfc('0x35')];_0x3b0d98+=0x1){var _0x57d7bc=_0x4e442d[_0x3b0d98]['UserId'];if(_0x57d7bc===null){_0x3a65a0[_0x2bfc('0x36')](_0x4e442d[_0x3b0d98][_0x2bfc('0x29')](_0x1a7ad1[_0x2bfc('0x27')],{'transaction':_0x1a4e5d}));}else if(!_0x168826[_0x2bfc('0x37')](_0x57d7bc)){_0x168826[_0x2bfc('0x36')](_0x57d7bc);_0x3a65a0[_0x2bfc('0x36')](_0x4e442d[_0x3b0d98][_0x2bfc('0x29')](_0x1a7ad1['body'],{'transaction':_0x1a4e5d}));}}return BPromise['all'](_0x3a65a0);});})['then'](function(_0x36f5fd){logger[_0x2bfc('0x24')]('GetContactDialer',_0x1a7ad1);logger[_0x2bfc('0x10')](_0x2bfc('0x2d'),_0x1a7ad1,JSON['stringify'](_0x36f5fd));_0x20d0f2(_0x36f5fd);})[_0x2bfc('0x16')](function(_0x1f17d2){logger[_0x2bfc('0x12')](_0x2bfc('0x2d'),_0x1f17d2['message'],_0x1a7ad1);_0x28a66f(_0x1dd582[_0x2bfc('0x12')](0x1f4,_0x1f17d2['message']));});});});};exports[_0x2bfc('0x38')]=function(_0x5ab25b){var _0x5b562f=this;return new Promise(function(_0x48bac2,_0x36ea25){return db[_0x2bfc('0x2f')][_0x2bfc('0x30')](function(_0x8715a){return db[_0x2bfc('0x39')][_0x2bfc('0x26')](_0x5ab25b[_0x2bfc('0x27')],{'raw':_0x5ab25b[_0x2bfc('0x1a')]?_0x5ab25b['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x8715a})['then'](function(){return db['CmHopper'][_0x2bfc('0x2c')]({'where':_0x5ab25b[_0x2bfc('0x1a')]?_0x5ab25b[_0x2bfc('0x1a')][_0x2bfc('0x1c')]||null:null,'transaction':_0x8715a});});})[_0x2bfc('0xd')](function(_0x30a497){logger['info'](_0x2bfc('0x38'),_0x5ab25b);logger[_0x2bfc('0x10')](_0x2bfc('0x38'),_0x5ab25b,JSON['stringify'](_0x30a497));_0x48bac2(_0x30a497);})[_0x2bfc('0x16')](function(_0x54deda){logger[_0x2bfc('0x12')](_0x2bfc('0x38'),_0x54deda[_0x2bfc('0x14')],_0x5ab25b);_0x36ea25(_0x5b562f[_0x2bfc('0x12')](0x1f4,_0x54deda[_0x2bfc('0x14')]));});});};exports['CountReScheduled']=function(_0x138f83){var _0xdc38cd=this;return new Promise(function(_0x9fe3d6,_0x37d04b){return db[_0x2bfc('0x18')][_0x2bfc('0x19')]({'raw':_0x138f83[_0x2bfc('0x1a')]?_0x138f83[_0x2bfc('0x1a')][_0x2bfc('0x1b')]===undefined?!![]:![]:!![],'where':_0x138f83[_0x2bfc('0x1a')]?_0x138f83[_0x2bfc('0x1a')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x2bfc('0x3a')+util[_0x2bfc('0x3b')](_0x2bfc('0x3c'),moment()['format'](_0x2bfc('0x3d')))+_0x2bfc('0x3e')))),_0x2bfc('0x3f')]]})[_0x2bfc('0xd')](function(_0x58818c){logger[_0x2bfc('0x24')](_0x2bfc('0x40'),_0x138f83);logger[_0x2bfc('0x10')](_0x2bfc('0x40'),_0x138f83,JSON[_0x2bfc('0x21')](_0x58818c));_0x9fe3d6(_0x58818c);})[_0x2bfc('0x16')](function(_0x53d859){logger[_0x2bfc('0x12')]('CountReScheduled',_0x53d859[_0x2bfc('0x14')],_0x138f83);_0x37d04b(_0xdc38cd[_0x2bfc('0x12')](0x1f4,_0x53d859[_0x2bfc('0x14')]));});});};exports[_0x2bfc('0x41')]=function(_0x2f23dc){var _0x3ea5ed=this;return new Promise(function(_0x516ec7,_0x45dd69){return db[_0x2bfc('0x42')]['describe']()[_0x2bfc('0xd')](function(_0x3a5443){return db[_0x2bfc('0x2f')][_0x2bfc('0x30')](function(_0x241ef5){return db[_0x2bfc('0x18')][_0x2bfc('0x19')]({'where':_0x2f23dc['options']?_0x2f23dc[_0x2bfc('0x1a')][_0x2bfc('0x1c')]||null:null,'attributes':_0x2f23dc[_0x2bfc('0x1a')]?_0x2f23dc[_0x2bfc('0x1a')][_0x2bfc('0x1d')]||null:null,'limit':0x1,'order':_0x2f23dc[_0x2bfc('0x1a')]?_0x2f23dc[_0x2bfc('0x1a')]['order']||null:null,'group':db[_0x2bfc('0x18')]['UserId'],'transaction':_0x241ef5,'lock':_0x241ef5[_0x2bfc('0x43')][_0x2bfc('0x44')],'include':_0x2f23dc[_0x2bfc('0x1a')]?_0x2f23dc[_0x2bfc('0x1a')][_0x2bfc('0x1e')]?_[_0x2bfc('0x1f')](_0x2f23dc[_0x2bfc('0x1a')]['include'],function(_0x477502){return{'model':db[_0x477502['model']],'as':_0x477502['as'],'attributes':_0x477502[_0x2bfc('0x1d')],'include':_0x477502[_0x2bfc('0x1e')]?_[_0x2bfc('0x1f')](_0x477502[_0x2bfc('0x1e')],function(_0x5b5147){return{'model':db[_0x5b5147[_0x2bfc('0x20')]],'as':_0x5b5147['as'],'attributes':_0x5b5147[_0x2bfc('0x1d')],'include':_0x5b5147[_0x2bfc('0x1e')]?_[_0x2bfc('0x1f')](_0x5b5147[_0x2bfc('0x1e')],function(_0x4d4839){return{'model':db[_0x4d4839[_0x2bfc('0x20')]],'as':_0x4d4839['as'],'attributes':_0x4d4839[_0x2bfc('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x217649){var _0x5edc1a=[];for(var _0xf09ff4=0x0;_0xf09ff4<_0x217649[_0x2bfc('0x35')];_0xf09ff4+=0x1){_0x5edc1a[_0x2bfc('0x36')](_0x217649[_0xf09ff4][_0x2bfc('0x29')](_0x2f23dc[_0x2bfc('0x27')],{'transaction':_0x241ef5}));}return BPromise['all'](_0x5edc1a);});})['then'](function(_0x244ad8){logger[_0x2bfc('0x24')](_0x2bfc('0x41'),_0x2f23dc);logger['debug'](_0x2bfc('0x41'),_0x2f23dc,JSON[_0x2bfc('0x21')](_0x244ad8));_0x516ec7(_0x244ad8);})[_0x2bfc('0x16')](function(_0x684052){logger['error']('GetContactRecallMe',_0x684052[_0x2bfc('0x14')],_0x2f23dc);_0x45dd69(_0x3ea5ed[_0x2bfc('0x12')](0x1f4,_0x684052[_0x2bfc('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x22983d){var _0x38f847=this;return new Promise(function(_0x482808,_0x58254f){db[_0x2bfc('0x42')][_0x2bfc('0x2e')]()['then'](function(_0x2beb49){return db[_0x2bfc('0x18')][_0x2bfc('0x19')]({'raw':_0x22983d[_0x2bfc('0x1a')]?_0x22983d[_0x2bfc('0x1a')][_0x2bfc('0x1b')]===undefined?!![]:![]:!![],'where':_0x22983d[_0x2bfc('0x1a')]?_0x22983d[_0x2bfc('0x1a')]['where']||null:null,'attributes':_0x22983d[_0x2bfc('0x1a')]?_0x22983d[_0x2bfc('0x1a')][_0x2bfc('0x1d')]||null:null,'limit':_0x22983d[_0x2bfc('0x1a')]?_0x22983d['options']['limit']||null:null,'include':_0x22983d['options']?_0x22983d['options'][_0x2bfc('0x1e')]?_[_0x2bfc('0x1f')](_0x22983d[_0x2bfc('0x1a')][_0x2bfc('0x1e')],function(_0x244a5a){return{'model':db[_0x244a5a[_0x2bfc('0x20')]],'as':_0x244a5a['as'],'attributes':_0x244a5a['as']===_0x2bfc('0x32')?_[_0x2bfc('0x45')](_0x2beb49):_0x244a5a[_0x2bfc('0x1d')],'include':_0x244a5a[_0x2bfc('0x1e')]?_['map'](_0x244a5a[_0x2bfc('0x1e')],function(_0x10c9bf){return{'model':db[_0x10c9bf[_0x2bfc('0x20')]],'as':_0x10c9bf['as'],'attributes':_0x10c9bf['attributes'],'include':_0x10c9bf[_0x2bfc('0x1e')]?_['map'](_0x10c9bf[_0x2bfc('0x1e')],function(_0x26cf95){return{'model':db[_0x26cf95[_0x2bfc('0x20')]],'as':_0x26cf95['as'],'attributes':_0x26cf95[_0x2bfc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2bfc('0xd')](function(_0x2ef46f){logger[_0x2bfc('0x24')]('GetCmHopper',_0x22983d);logger[_0x2bfc('0x10')](_0x2bfc('0x17'),_0x22983d,JSON['stringify'](_0x2ef46f));_0x482808(_0x2ef46f);})[_0x2bfc('0x16')](function(_0x5a2135){logger['error'](_0x2bfc('0x17'),_0x5a2135[_0x2bfc('0x14')],_0x22983d);_0x58254f(_0x38f847[_0x2bfc('0x12')](0x1f4,_0x5a2135[_0x2bfc('0x14')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 419902b..e97eaf2 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 _0xa95f=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','get','describe','/opencontacts','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xa95f,0x131));var _0xfa95=function(_0x540b5d,_0x3c2b28){_0x540b5d=_0x540b5d-0x0;var _0x484ca7=_0xa95f[_0x540b5d];return _0x484ca7;};'use strict';var multer=require(_0xfa95('0x0'));var util=require(_0xfa95('0x1'));var path=require('path');var timeout=require(_0xfa95('0x2'));var express=require(_0xfa95('0x3'));var router=express[_0xfa95('0x4')]();var fs_extra=require(_0xfa95('0x5'));var auth=require(_0xfa95('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfa95('0x7'));var controller=require(_0xfa95('0x8'));router['get']('/',auth[_0xfa95('0x9')](),controller[_0xfa95('0xa')]);router[_0xfa95('0xb')]('/describe',auth[_0xfa95('0x9')](),controller[_0xfa95('0xc')]);router[_0xfa95('0xb')](_0xfa95('0xd'),auth[_0xfa95('0x9')](),controller['getOpenContacts']);router[_0xfa95('0xb')](_0xfa95('0xe'),auth[_0xfa95('0x9')](),controller[_0xfa95('0xf')]);router[_0xfa95('0x10')]('/',auth[_0xfa95('0x9')](),controller[_0xfa95('0x11')]);router['post']('/preview',auth[_0xfa95('0x9')](),controller['getPreview']);router[_0xfa95('0x12')]('/:id',auth[_0xfa95('0x9')](),controller['update']);router[_0xfa95('0x13')](_0xfa95('0xe'),auth[_0xfa95('0x9')](),controller[_0xfa95('0x14')]);module[_0xfa95('0x15')]=router; \ No newline at end of file +var _0x190c=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','getOpenContacts','/:id','post','create','/preview','getPreview','put'];(function(_0x19e1c8,_0x3ca38a){var _0x51cb9e=function(_0x4fec2f){while(--_0x4fec2f){_0x19e1c8['push'](_0x19e1c8['shift']());}};_0x51cb9e(++_0x3ca38a);}(_0x190c,0xa5));var _0xc190=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0x190c[_0x45c48f];return _0xaf5037;};'use strict';var multer=require(_0xc190('0x0'));var util=require(_0xc190('0x1'));var path=require(_0xc190('0x2'));var timeout=require(_0xc190('0x3'));var express=require(_0xc190('0x4'));var router=express[_0xc190('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc190('0x6'));var interaction=require(_0xc190('0x7'));var config=require(_0xc190('0x8'));var controller=require('./cmHopper.controller');router[_0xc190('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc190('0x9')]('/describe',auth[_0xc190('0xa')](),controller[_0xc190('0xb')]);router['get']('/opencontacts',auth[_0xc190('0xa')](),controller[_0xc190('0xc')]);router['get'](_0xc190('0xd'),auth[_0xc190('0xa')](),controller['show']);router[_0xc190('0xe')]('/',auth[_0xc190('0xa')](),controller[_0xc190('0xf')]);router[_0xc190('0xe')](_0xc190('0x10'),auth[_0xc190('0xa')](),controller[_0xc190('0x11')]);router[_0xc190('0x12')](_0xc190('0xd'),auth['isAuthenticated'](),controller[_0xc190('0x13')]);router[_0xc190('0x14')]('/:id',auth[_0xc190('0xa')](),controller[_0xc190('0x15')]);module[_0xc190('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 8b08248..6d0c054 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 _0xafdd=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x5e5f5a,_0x5cb19a){var _0x4141ae=function(_0x4bb2ea){while(--_0x4bb2ea){_0x5e5f5a['push'](_0x5e5f5a['shift']());}};_0x4141ae(++_0x5cb19a);}(_0xafdd,0x19a));var _0xdafd=function(_0x1709c4,_0x397c9d){_0x1709c4=_0x1709c4-0x0;var _0x5126a1=_0xafdd[_0x1709c4];return _0x5126a1;};'use strict';var moment=require(_0xdafd('0x0'));var Sequelize=require(_0xdafd('0x1'));module[_0xdafd('0x2')]={'phone':{'type':Sequelize[_0xdafd('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xdafd('0x4')],'unique':_0xdafd('0x5')},'ListId':{'type':Sequelize[_0xdafd('0x4')],'unique':_0xdafd('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xdafd('0x5')}}; \ No newline at end of file +var _0x8876=['sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x3f9a9c,_0x549770){var _0x1e2c44=function(_0x18f2df){while(--_0x18f2df){_0x3f9a9c['push'](_0x3f9a9c['shift']());}};_0x1e2c44(++_0x549770);}(_0x8876,0xa0));var _0x6887=function(_0x4850d1,_0xcbcf96){_0x4850d1=_0x4850d1-0x0;var _0x5d296b=_0x8876[_0x4850d1];return _0x5d296b;};'use strict';var moment=require('moment');var Sequelize=require(_0x6887('0x0'));module[_0x6887('0x1')]={'phone':{'type':Sequelize[_0x6887('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x6887('0x3')],'unique':_0x6887('0x4')},'ListId':{'type':Sequelize[_0x6887('0x3')],'unique':_0x6887('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x6887('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 62310d9..3203042 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 _0xdacb=['filters','pick','filter','merge','options','includeAll','findAll','rows','include','find','body','params','catch','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','keys','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where'];(function(_0x59987b,_0x3a0d06){var _0x39960f=function(_0x2ece88){while(--_0x2ece88){_0x59987b['push'](_0x59987b['shift']());}};_0x39960f(++_0x3a0d06);}(_0xdacb,0xec));var _0xbdac=function(_0x1fec15,_0xac95a){_0x1fec15=_0x1fec15-0x0;var _0x25a469=_0xdacb[_0x1fec15];return _0x25a469;};'use strict';var emlformat=require(_0xbdac('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbdac('0x1'));var rp=require(_0xbdac('0x2'));var moment=require('moment');var BPromise=require(_0xbdac('0x3'));var Mustache=require(_0xbdac('0x4'));var util=require(_0xbdac('0x5'));var path=require(_0xbdac('0x6'));var sox=require(_0xbdac('0x7'));var csv=require(_0xbdac('0x8'));var ejs=require(_0xbdac('0x9'));var fs=require('fs');var fs_extra=require(_0xbdac('0xa'));var _=require(_0xbdac('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbdac('0xc'));var deskjs=require(_0xbdac('0xd'));var toCsv=require(_0xbdac('0x8'));var querystring=require(_0xbdac('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbdac('0xf'));var qs=require(_0xbdac('0x10'));var as=require(_0xbdac('0x11'));var hardwareService=require(_0xbdac('0x12'));var logger=require('../../config/logger')(_0xbdac('0x13'));var utils=require(_0xbdac('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbdac('0x15'))['db'];function respondWithStatusCode(_0x564d73,_0xbfa9c2){_0xbfa9c2=_0xbfa9c2||0xcc;return function(_0x53aa0a){if(_0x53aa0a){return _0x564d73[_0xbdac('0x16')](_0xbfa9c2);}return _0x564d73['status'](_0xbfa9c2)[_0xbdac('0x17')]();};}function respondWithResult(_0x32465d,_0x22165b){_0x22165b=_0x22165b||0xc8;return function(_0x4e2e21){if(_0x4e2e21){return _0x32465d['status'](_0x22165b)[_0xbdac('0x18')](_0x4e2e21);}};}function respondWithFilteredResult(_0x195ecc,_0x3b5c98){return function(_0xdbfd1f){if(_0xdbfd1f){var _0x4317a3=typeof _0x3b5c98['offset']===_0xbdac('0x19')&&typeof _0x3b5c98[_0xbdac('0x1a')]===_0xbdac('0x19');var _0x3ece29=_0xdbfd1f[_0xbdac('0x1b')];var _0x27ec63=_0x4317a3?0x0:_0x3b5c98['offset'];var _0xec82d2=_0x4317a3?_0xdbfd1f[_0xbdac('0x1b')]:_0x3b5c98[_0xbdac('0x1c')]+_0x3b5c98[_0xbdac('0x1a')];var _0x4a2085;if(_0xec82d2>=_0x3ece29){_0xec82d2=_0x3ece29;_0x4a2085=0xc8;}else{_0x4a2085=0xce;}_0x195ecc[_0xbdac('0x1d')](_0x4a2085);return _0x195ecc[_0xbdac('0x1e')](_0xbdac('0x1f'),_0x27ec63+'-'+_0xec82d2+'/'+_0x3ece29)[_0xbdac('0x18')](_0xdbfd1f);}return null;};}function patchUpdates(_0x100ce8){return function(_0x311732){try{jsonpatch[_0xbdac('0x20')](_0x311732,_0x100ce8,!![]);}catch(_0x3e5792){return BPromise[_0xbdac('0x21')](_0x3e5792);}return _0x311732[_0xbdac('0x22')]();};}function saveUpdates(_0x18febd,_0x394c31){return function(_0x2604a4){if(_0x2604a4){return _0x2604a4[_0xbdac('0x23')](_0x18febd)[_0xbdac('0x24')](function(_0x1173ec){return _0x1173ec;});}return null;};}function removeEntity(_0x1c8bce,_0x4fce33){return function(_0x1072f8){if(_0x1072f8){return _0x1072f8[_0xbdac('0x25')]()['then'](function(){_0x1c8bce[_0xbdac('0x1d')](0xcc)[_0xbdac('0x17')]();});}};}function handleEntityNotFound(_0x24f8e4,_0x357342){return function(_0xc88c76){if(!_0xc88c76){_0x24f8e4['sendStatus'](0x194);}return _0xc88c76;};}function handleError(_0x58387a,_0x55bfbd){_0x55bfbd=_0x55bfbd||0x1f4;return function(_0x203cf0){logger[_0xbdac('0x26')](_0x203cf0[_0xbdac('0x27')]);if(_0x203cf0['name']){delete _0x203cf0[_0xbdac('0x28')];}_0x58387a[_0xbdac('0x1d')](_0x55bfbd)[_0xbdac('0x29')](_0x203cf0);};}exports[_0xbdac('0x2a')]=function(_0xd0fc76,_0x48deed){var _0x4f5cce={},_0x45829b={},_0x40c3a4={'count':0x0,'rows':[]};var _0x74c079=_['map'](db[_0xbdac('0x2b')][_0xbdac('0x2c')],function(_0x5174ff){return{'name':_0x5174ff[_0xbdac('0x2d')],'type':_0x5174ff[_0xbdac('0x2e')][_0xbdac('0x2f')]};});_0x45829b[_0xbdac('0x30')]=_[_0xbdac('0x31')](_0x74c079,'name');_0x45829b['query']=_[_0xbdac('0x32')](_0xd0fc76['query']);_0x45829b['filters']=_[_0xbdac('0x33')](_0x45829b['model'],_0x45829b[_0xbdac('0x34')]);_0x4f5cce['attributes']=_[_0xbdac('0x33')](_0x45829b[_0xbdac('0x30')],qs[_0xbdac('0x35')](_0xd0fc76['query'][_0xbdac('0x35')]));_0x4f5cce[_0xbdac('0x36')]=_0x4f5cce[_0xbdac('0x36')][_0xbdac('0x37')]?_0x4f5cce[_0xbdac('0x36')]:_0x45829b['model'];if(!_0xd0fc76[_0xbdac('0x34')][_0xbdac('0x38')]('nolimit')){_0x4f5cce[_0xbdac('0x1a')]=qs['limit'](_0xd0fc76['query']['limit']);_0x4f5cce[_0xbdac('0x1c')]=qs[_0xbdac('0x1c')](_0xd0fc76[_0xbdac('0x34')][_0xbdac('0x1c')]);}_0x4f5cce[_0xbdac('0x39')]=qs[_0xbdac('0x3a')](_0xd0fc76[_0xbdac('0x34')][_0xbdac('0x3a')]);_0x4f5cce[_0xbdac('0x3b')]=qs[_0xbdac('0x3c')](_[_0xbdac('0x3d')](_0xd0fc76[_0xbdac('0x34')],_0x45829b[_0xbdac('0x3c')]),_0x74c079);if(_0xd0fc76[_0xbdac('0x34')][_0xbdac('0x3e')]){_0x4f5cce[_0xbdac('0x3b')]=_['merge'](_0x4f5cce[_0xbdac('0x3b')],{'$or':_[_0xbdac('0x31')](_0x74c079,function(_0x3be550){if(_0x3be550[_0xbdac('0x2e')]!=='VIRTUAL'){var _0x59e3ca={};_0x59e3ca[_0x3be550[_0xbdac('0x28')]]={'$like':'%'+_0xd0fc76[_0xbdac('0x34')]['filter']+'%'};return _0x59e3ca;}})});}_0x4f5cce=_[_0xbdac('0x3f')]({},_0x4f5cce,_0xd0fc76[_0xbdac('0x40')]);var _0x5d7fb9={'where':_0x4f5cce['where']};return db[_0xbdac('0x2b')][_0xbdac('0x1b')](_0x5d7fb9)[_0xbdac('0x24')](function(_0x5c7286){_0x40c3a4[_0xbdac('0x1b')]=_0x5c7286;if(_0xd0fc76[_0xbdac('0x34')][_0xbdac('0x41')]){_0x4f5cce['include']=[{'all':!![]}];}return db[_0xbdac('0x2b')][_0xbdac('0x42')](_0x4f5cce);})[_0xbdac('0x24')](function(_0x304cda){_0x40c3a4[_0xbdac('0x43')]=_0x304cda;return _0x40c3a4;})[_0xbdac('0x24')](respondWithFilteredResult(_0x48deed,_0x4f5cce))['catch'](handleError(_0x48deed,null));};exports['show']=function(_0x575cfd,_0x233cae){var _0xc68faf={'raw':!![],'where':{'id':_0x575cfd['params']['id']}},_0x4d80a3={};_0x4d80a3[_0xbdac('0x30')]=_[_0xbdac('0x32')](db[_0xbdac('0x2b')][_0xbdac('0x2c')]);_0x4d80a3['query']=_[_0xbdac('0x32')](_0x575cfd[_0xbdac('0x34')]);_0x4d80a3[_0xbdac('0x3c')]=_[_0xbdac('0x33')](_0x4d80a3[_0xbdac('0x30')],_0x4d80a3[_0xbdac('0x34')]);_0xc68faf[_0xbdac('0x36')]=_[_0xbdac('0x33')](_0x4d80a3['model'],qs['fields'](_0x575cfd[_0xbdac('0x34')][_0xbdac('0x35')]));_0xc68faf[_0xbdac('0x36')]=_0xc68faf[_0xbdac('0x36')][_0xbdac('0x37')]?_0xc68faf[_0xbdac('0x36')]:_0x4d80a3[_0xbdac('0x30')];if(_0x575cfd['query'][_0xbdac('0x41')]){_0xc68faf[_0xbdac('0x44')]=[{'all':!![]}];}_0xc68faf=_['merge']({},_0xc68faf,_0x575cfd[_0xbdac('0x40')]);return db['CmHopperBlack'][_0xbdac('0x45')](_0xc68faf)[_0xbdac('0x24')](handleEntityNotFound(_0x233cae,null))['then'](respondWithResult(_0x233cae,null))['catch'](handleError(_0x233cae,null));};exports[_0xbdac('0x23')]=function(_0x262fa4,_0x4fc758){if(_0x262fa4[_0xbdac('0x46')]['id']){delete _0x262fa4[_0xbdac('0x46')]['id'];}return db['CmHopperBlack'][_0xbdac('0x45')]({'where':{'id':_0x262fa4[_0xbdac('0x47')]['id']}})[_0xbdac('0x24')](handleEntityNotFound(_0x4fc758,null))[_0xbdac('0x24')](saveUpdates(_0x262fa4[_0xbdac('0x46')],null))[_0xbdac('0x24')](respondWithResult(_0x4fc758,null))[_0xbdac('0x48')](handleError(_0x4fc758,null));};exports[_0xbdac('0x25')]=function(_0x468605,_0x291a19){return db[_0xbdac('0x2b')][_0xbdac('0x45')]({'where':{'id':_0x468605[_0xbdac('0x47')]['id']}})['then'](handleEntityNotFound(_0x291a19,null))['then'](removeEntity(_0x291a19,null))[_0xbdac('0x48')](handleError(_0x291a19,null));};exports[_0xbdac('0x49')]=function(_0x3a0166,_0x414be5){return db[_0xbdac('0x2b')][_0xbdac('0x49')]()[_0xbdac('0x24')](respondWithResult(_0x414be5,null))[_0xbdac('0x48')](handleError(_0x414be5,null));}; \ No newline at end of file +var _0xa1ab=['options','includeAll','include','findAll','rows','catch','show','params','keys','body','find','describe','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa1ab,0x1a1));var _0xba1a=function(_0x4c6308,_0x606eb6){_0x4c6308=_0x4c6308-0x0;var _0x360ab3=_0xa1ab[_0x4c6308];return _0x360ab3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba1a('0x0'));var zipdir=require(_0xba1a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xba1a('0x2'));var BPromise=require(_0xba1a('0x3'));var Mustache=require(_0xba1a('0x4'));var util=require(_0xba1a('0x5'));var path=require(_0xba1a('0x6'));var sox=require(_0xba1a('0x7'));var csv=require('to-csv');var ejs=require(_0xba1a('0x8'));var fs=require('fs');var fs_extra=require(_0xba1a('0x9'));var _=require(_0xba1a('0xa'));var squel=require(_0xba1a('0xb'));var crypto=require(_0xba1a('0xc'));var jsforce=require(_0xba1a('0xd'));var deskjs=require(_0xba1a('0xe'));var toCsv=require(_0xba1a('0xf'));var querystring=require(_0xba1a('0x10'));var Papa=require(_0xba1a('0x11'));var Redis=require(_0xba1a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xba1a('0x13'));var as=require(_0xba1a('0x14'));var hardwareService=require(_0xba1a('0x15'));var logger=require(_0xba1a('0x16'))(_0xba1a('0x17'));var utils=require('../../config/utils');var config=require(_0xba1a('0x18'));var licenseUtil=require(_0xba1a('0x19'));var db=require(_0xba1a('0x1a'))['db'];function respondWithStatusCode(_0x14e770,_0x467e85){_0x467e85=_0x467e85||0xcc;return function(_0x2e086c){if(_0x2e086c){return _0x14e770[_0xba1a('0x1b')](_0x467e85);}return _0x14e770[_0xba1a('0x1c')](_0x467e85)[_0xba1a('0x1d')]();};}function respondWithResult(_0x64b6fc,_0x5e0ece){_0x5e0ece=_0x5e0ece||0xc8;return function(_0x984dc1){if(_0x984dc1){return _0x64b6fc[_0xba1a('0x1c')](_0x5e0ece)[_0xba1a('0x1e')](_0x984dc1);}};}function respondWithFilteredResult(_0x56245b,_0x5a49ad){return function(_0x4ee554){if(_0x4ee554){var _0xeda5=typeof _0x5a49ad[_0xba1a('0x1f')]===_0xba1a('0x20')&&typeof _0x5a49ad[_0xba1a('0x21')]===_0xba1a('0x20');var _0x1a357e=_0x4ee554[_0xba1a('0x22')];var _0x1b91a3=_0xeda5?0x0:_0x5a49ad[_0xba1a('0x1f')];var _0x390ceb=_0xeda5?_0x4ee554[_0xba1a('0x22')]:_0x5a49ad[_0xba1a('0x1f')]+_0x5a49ad[_0xba1a('0x21')];var _0x45ed45;if(_0x390ceb>=_0x1a357e){_0x390ceb=_0x1a357e;_0x45ed45=0xc8;}else{_0x45ed45=0xce;}_0x56245b[_0xba1a('0x1c')](_0x45ed45);return _0x56245b[_0xba1a('0x23')](_0xba1a('0x24'),_0x1b91a3+'-'+_0x390ceb+'/'+_0x1a357e)[_0xba1a('0x1e')](_0x4ee554);}return null;};}function patchUpdates(_0x2654da){return function(_0x464a73){try{jsonpatch[_0xba1a('0x25')](_0x464a73,_0x2654da,!![]);}catch(_0x122131){return BPromise[_0xba1a('0x26')](_0x122131);}return _0x464a73[_0xba1a('0x27')]();};}function saveUpdates(_0x585efb,_0x5a4596){return function(_0x28cedb){if(_0x28cedb){return _0x28cedb[_0xba1a('0x28')](_0x585efb)[_0xba1a('0x29')](function(_0x1b2cf8){return _0x1b2cf8;});}return null;};}function removeEntity(_0x341edb,_0x212abc){return function(_0x1ad725){if(_0x1ad725){return _0x1ad725[_0xba1a('0x2a')]()[_0xba1a('0x29')](function(){_0x341edb[_0xba1a('0x1c')](0xcc)[_0xba1a('0x1d')]();});}};}function handleEntityNotFound(_0x3ea4f3,_0x2de152){return function(_0x310e2e){if(!_0x310e2e){_0x3ea4f3[_0xba1a('0x1b')](0x194);}return _0x310e2e;};}function handleError(_0xb8ff92,_0x183e61){_0x183e61=_0x183e61||0x1f4;return function(_0x43ee75){logger[_0xba1a('0x2b')](_0x43ee75[_0xba1a('0x2c')]);if(_0x43ee75[_0xba1a('0x2d')]){delete _0x43ee75[_0xba1a('0x2d')];}_0xb8ff92[_0xba1a('0x1c')](_0x183e61)[_0xba1a('0x2e')](_0x43ee75);};}exports[_0xba1a('0x2f')]=function(_0x206021,_0x4b906d){var _0x7cc229={},_0x3e0e5d={},_0xf92506={'count':0x0,'rows':[]};var _0x5eb36d=_[_0xba1a('0x30')](db[_0xba1a('0x31')][_0xba1a('0x32')],function(_0x1e8669){return{'name':_0x1e8669[_0xba1a('0x33')],'type':_0x1e8669['type'][_0xba1a('0x34')]};});_0x3e0e5d[_0xba1a('0x35')]=_[_0xba1a('0x30')](_0x5eb36d,_0xba1a('0x2d'));_0x3e0e5d[_0xba1a('0x36')]=_['keys'](_0x206021[_0xba1a('0x36')]);_0x3e0e5d[_0xba1a('0x37')]=_[_0xba1a('0x38')](_0x3e0e5d[_0xba1a('0x35')],_0x3e0e5d[_0xba1a('0x36')]);_0x7cc229[_0xba1a('0x39')]=_[_0xba1a('0x38')](_0x3e0e5d[_0xba1a('0x35')],qs['fields'](_0x206021['query'][_0xba1a('0x3a')]));_0x7cc229[_0xba1a('0x39')]=_0x7cc229[_0xba1a('0x39')][_0xba1a('0x3b')]?_0x7cc229[_0xba1a('0x39')]:_0x3e0e5d[_0xba1a('0x35')];if(!_0x206021['query'][_0xba1a('0x3c')](_0xba1a('0x3d'))){_0x7cc229[_0xba1a('0x21')]=qs[_0xba1a('0x21')](_0x206021[_0xba1a('0x36')][_0xba1a('0x21')]);_0x7cc229[_0xba1a('0x1f')]=qs[_0xba1a('0x1f')](_0x206021[_0xba1a('0x36')][_0xba1a('0x1f')]);}_0x7cc229['order']=qs['sort'](_0x206021[_0xba1a('0x36')][_0xba1a('0x3e')]);_0x7cc229[_0xba1a('0x3f')]=qs[_0xba1a('0x37')](_[_0xba1a('0x40')](_0x206021[_0xba1a('0x36')],_0x3e0e5d[_0xba1a('0x37')]),_0x5eb36d);if(_0x206021[_0xba1a('0x36')][_0xba1a('0x41')]){_0x7cc229['where']=_[_0xba1a('0x42')](_0x7cc229[_0xba1a('0x3f')],{'$or':_[_0xba1a('0x30')](_0x5eb36d,function(_0x4198af){if(_0x4198af[_0xba1a('0x43')]!==_0xba1a('0x44')){var _0xe54aa8={};_0xe54aa8[_0x4198af[_0xba1a('0x2d')]]={'$like':'%'+_0x206021[_0xba1a('0x36')][_0xba1a('0x41')]+'%'};return _0xe54aa8;}})});}_0x7cc229=_['merge']({},_0x7cc229,_0x206021[_0xba1a('0x45')]);var _0x223321={'where':_0x7cc229['where']};return db[_0xba1a('0x31')][_0xba1a('0x22')](_0x223321)['then'](function(_0x55f4cf){_0xf92506[_0xba1a('0x22')]=_0x55f4cf;if(_0x206021[_0xba1a('0x36')][_0xba1a('0x46')]){_0x7cc229[_0xba1a('0x47')]=[{'all':!![]}];}return db[_0xba1a('0x31')][_0xba1a('0x48')](_0x7cc229);})[_0xba1a('0x29')](function(_0xf4bd9f){_0xf92506[_0xba1a('0x49')]=_0xf4bd9f;return _0xf92506;})['then'](respondWithFilteredResult(_0x4b906d,_0x7cc229))[_0xba1a('0x4a')](handleError(_0x4b906d,null));};exports[_0xba1a('0x4b')]=function(_0x22c167,_0x425cdd){var _0x17aac6={'raw':!![],'where':{'id':_0x22c167[_0xba1a('0x4c')]['id']}},_0x2df59c={};_0x2df59c[_0xba1a('0x35')]=_[_0xba1a('0x4d')](db[_0xba1a('0x31')][_0xba1a('0x32')]);_0x2df59c[_0xba1a('0x36')]=_[_0xba1a('0x4d')](_0x22c167[_0xba1a('0x36')]);_0x2df59c[_0xba1a('0x37')]=_[_0xba1a('0x38')](_0x2df59c[_0xba1a('0x35')],_0x2df59c[_0xba1a('0x36')]);_0x17aac6[_0xba1a('0x39')]=_['intersection'](_0x2df59c[_0xba1a('0x35')],qs[_0xba1a('0x3a')](_0x22c167[_0xba1a('0x36')]['fields']));_0x17aac6[_0xba1a('0x39')]=_0x17aac6[_0xba1a('0x39')]['length']?_0x17aac6[_0xba1a('0x39')]:_0x2df59c[_0xba1a('0x35')];if(_0x22c167[_0xba1a('0x36')][_0xba1a('0x46')]){_0x17aac6[_0xba1a('0x47')]=[{'all':!![]}];}_0x17aac6=_[_0xba1a('0x42')]({},_0x17aac6,_0x22c167[_0xba1a('0x45')]);return db[_0xba1a('0x31')]['find'](_0x17aac6)[_0xba1a('0x29')](handleEntityNotFound(_0x425cdd,null))[_0xba1a('0x29')](respondWithResult(_0x425cdd,null))['catch'](handleError(_0x425cdd,null));};exports['update']=function(_0x4aab24,_0x135b3e){if(_0x4aab24[_0xba1a('0x4e')]['id']){delete _0x4aab24[_0xba1a('0x4e')]['id'];}return db[_0xba1a('0x31')][_0xba1a('0x4f')]({'where':{'id':_0x4aab24[_0xba1a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x135b3e,null))[_0xba1a('0x29')](saveUpdates(_0x4aab24[_0xba1a('0x4e')],null))['then'](respondWithResult(_0x135b3e,null))[_0xba1a('0x4a')](handleError(_0x135b3e,null));};exports[_0xba1a('0x2a')]=function(_0x296951,_0x54b1d6){return db[_0xba1a('0x31')][_0xba1a('0x4f')]({'where':{'id':_0x296951['params']['id']}})[_0xba1a('0x29')](handleEntityNotFound(_0x54b1d6,null))[_0xba1a('0x29')](removeEntity(_0x54b1d6,null))[_0xba1a('0x4a')](handleError(_0x54b1d6,null));};exports[_0xba1a('0x50')]=function(_0x33dbc8,_0x37b445){return db[_0xba1a('0x31')][_0xba1a('0x50')]()[_0xba1a('0x29')](respondWithResult(_0x37b445,null))[_0xba1a('0x4a')](handleError(_0x37b445,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index fb61628..bd41a21 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 _0xa1ef=['bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','define','CmHopperBlack','../../config/logger','api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa1ef,0x6a));var _0xfa1e=function(_0x18d36f,_0x31b65f){_0x18d36f=_0x18d36f-0x0;var _0x10034d=_0xa1ef[_0x18d36f];return _0x10034d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa1e('0x0'))(_0xfa1e('0x1'));var moment=require('moment');var BPromise=require(_0xfa1e('0x2'));var rp=require(_0xfa1e('0x3'));var fs=require('fs');var path=require(_0xfa1e('0x4'));var rimraf=require(_0xfa1e('0x5'));var config=require('../../config/environment');var attributes=require(_0xfa1e('0x6'));module['exports']=function(_0x3e5604,_0x49c0dd){return _0x3e5604[_0xfa1e('0x7')](_0xfa1e('0x8'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf868=['define','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0x1fd1c9,_0x304a5e){var _0x21caaf=function(_0x3352ed){while(--_0x3352ed){_0x1fd1c9['push'](_0x1fd1c9['shift']());}};_0x21caaf(++_0x304a5e);}(_0xf868,0x145));var _0x8f86=function(_0x274a82,_0x488fb8){_0x274a82=_0x274a82-0x0;var _0x2ef548=_0xf868[_0x274a82];return _0x2ef548;};'use strict';var _=require(_0x8f86('0x0'));var util=require('util');var logger=require(_0x8f86('0x1'))(_0x8f86('0x2'));var moment=require(_0x8f86('0x3'));var BPromise=require(_0x8f86('0x4'));var rp=require(_0x8f86('0x5'));var fs=require('fs');var path=require(_0x8f86('0x6'));var rimraf=require(_0x8f86('0x7'));var config=require(_0x8f86('0x8'));var attributes=require(_0x8f86('0x9'));module[_0x8f86('0xa')]=function(_0x162106,_0x4276dd){return _0x162106[_0x8f86('0xb')](_0x8f86('0xc'),attributes,{'tableName':_0x8f86('0xd'),'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 63c617f..57eb9d0 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 _0xc687=['then','info','CmHopperBlack,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetCmHopperBlack','findAll','options','raw','attributes','limit','include','map','model','UpdateCmHopperBlack','CmHopperBlack','update','body','DestroyCmHopperBlack','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x230cf2,_0x3d7bd7){var _0x3931ae=function(_0x482fde){while(--_0x482fde){_0x230cf2['push'](_0x230cf2['shift']());}};_0x3931ae(++_0x3d7bd7);}(_0xc687,0x1b0));var _0x7c68=function(_0x4ef2ca,_0x229fe0){_0x4ef2ca=_0x4ef2ca-0x0;var _0x20d1d6=_0xc687[_0x4ef2ca];return _0x20d1d6;};'use strict';var _=require(_0x7c68('0x0'));var util=require(_0x7c68('0x1'));var moment=require(_0x7c68('0x2'));var BPromise=require('bluebird');var rs=require(_0x7c68('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7c68('0x4'));var logger=require(_0x7c68('0x5'))(_0x7c68('0x6'));var config=require(_0x7c68('0x7'));var jayson=require(_0x7c68('0x8'));var client=jayson[_0x7c68('0x9')][_0x7c68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fb810,_0x20bd70,_0x3adaee){return new BPromise(function(_0x873ae3,_0x3fc489){return client[_0x7c68('0xb')](_0x1fb810,_0x3adaee)[_0x7c68('0xc')](function(_0x4b3d3f){logger[_0x7c68('0xd')](_0x7c68('0xe'),_0x20bd70,'request\x20sent');logger[_0x7c68('0xf')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x20bd70,_0x7c68('0x10'),JSON[_0x7c68('0x11')](_0x4b3d3f));if(_0x4b3d3f['error']){if(_0x4b3d3f[_0x7c68('0x12')][_0x7c68('0x13')]===0x1f4){logger[_0x7c68('0x12')](_0x7c68('0xe'),_0x20bd70,_0x4b3d3f[_0x7c68('0x12')][_0x7c68('0x14')]);return _0x3fc489(_0x4b3d3f['error'][_0x7c68('0x14')]);}logger[_0x7c68('0x12')](_0x7c68('0xe'),_0x20bd70,_0x4b3d3f[_0x7c68('0x12')][_0x7c68('0x14')]);return _0x873ae3(_0x4b3d3f[_0x7c68('0x12')]['message']);}else{logger['info'](_0x7c68('0xe'),_0x20bd70,_0x7c68('0x10'));_0x873ae3(_0x4b3d3f[_0x7c68('0x15')]['message']);}})[_0x7c68('0x16')](function(_0x53d74e){logger['error'](_0x7c68('0xe'),_0x20bd70,_0x53d74e);_0x3fc489(_0x53d74e);});});}exports[_0x7c68('0x17')]=function(_0x2afba7){var _0x29aabe=this;return new Promise(function(_0x93691b,_0x5c46bb){return db['CmHopperBlack'][_0x7c68('0x18')]({'raw':_0x2afba7[_0x7c68('0x19')]?_0x2afba7[_0x7c68('0x19')][_0x7c68('0x1a')]===undefined?!![]:![]:!![],'where':_0x2afba7[_0x7c68('0x19')]?_0x2afba7[_0x7c68('0x19')]['where']||null:null,'attributes':_0x2afba7['options']?_0x2afba7[_0x7c68('0x19')][_0x7c68('0x1b')]||null:null,'limit':_0x2afba7['options']?_0x2afba7['options'][_0x7c68('0x1c')]||null:null,'include':_0x2afba7['options']?_0x2afba7['options'][_0x7c68('0x1d')]?_['map'](_0x2afba7[_0x7c68('0x19')][_0x7c68('0x1d')],function(_0x1be999){return{'model':db[_0x1be999['model']],'as':_0x1be999['as'],'attributes':_0x1be999[_0x7c68('0x1b')],'include':_0x1be999[_0x7c68('0x1d')]?_[_0x7c68('0x1e')](_0x1be999[_0x7c68('0x1d')],function(_0x411fe3){return{'model':db[_0x411fe3[_0x7c68('0x1f')]],'as':_0x411fe3['as'],'attributes':_0x411fe3[_0x7c68('0x1b')],'include':_0x411fe3[_0x7c68('0x1d')]?_[_0x7c68('0x1e')](_0x411fe3[_0x7c68('0x1d')],function(_0x2c0b85){return{'model':db[_0x2c0b85[_0x7c68('0x1f')]],'as':_0x2c0b85['as'],'attributes':_0x2c0b85['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c68('0xc')](function(_0xaf023f){logger['info'](_0x7c68('0x17'),_0x2afba7);logger[_0x7c68('0xf')]('GetCmHopperBlack',_0x2afba7,JSON[_0x7c68('0x11')](_0xaf023f));_0x93691b(_0xaf023f);})['catch'](function(_0x3f4642){logger['error'](_0x7c68('0x17'),_0x3f4642[_0x7c68('0x14')],_0x2afba7);_0x5c46bb(_0x29aabe[_0x7c68('0x12')](0x1f4,_0x3f4642[_0x7c68('0x14')]));});});};exports[_0x7c68('0x20')]=function(_0x1b68cb){var _0x10fca9=this;return new Promise(function(_0x1b035d,_0x5aba89){return db[_0x7c68('0x21')][_0x7c68('0x22')](_0x1b68cb[_0x7c68('0x23')],{'raw':_0x1b68cb[_0x7c68('0x19')]?_0x1b68cb[_0x7c68('0x19')][_0x7c68('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b68cb[_0x7c68('0x19')]?_0x1b68cb[_0x7c68('0x19')]['where']||null:null,'attributes':_0x1b68cb[_0x7c68('0x19')]?_0x1b68cb[_0x7c68('0x19')][_0x7c68('0x1b')]||null:null,'limit':_0x1b68cb[_0x7c68('0x19')]?_0x1b68cb[_0x7c68('0x19')][_0x7c68('0x1c')]||null:null})[_0x7c68('0xc')](function(_0x34f211){logger[_0x7c68('0xd')](_0x7c68('0x20'),_0x1b68cb);logger['debug'](_0x7c68('0x20'),_0x1b68cb,JSON[_0x7c68('0x11')](_0x34f211));_0x1b035d(_0x34f211);})[_0x7c68('0x16')](function(_0xdf0c18){logger[_0x7c68('0x12')](_0x7c68('0x20'),_0xdf0c18[_0x7c68('0x14')],_0x1b68cb);_0x5aba89(_0x10fca9[_0x7c68('0x12')](0x1f4,_0xdf0c18['message']));});});};exports['DestroyCmHopperBlack']=function(_0x3b9dba){var _0x51b3f7=this;return new Promise(function(_0x2cb213,_0x3b649f){return db[_0x7c68('0x21')]['destroy']({'where':_0x3b9dba[_0x7c68('0x19')]?_0x3b9dba[_0x7c68('0x19')]['where']||null:null})[_0x7c68('0xc')](function(_0x13ad55){logger[_0x7c68('0xd')](_0x7c68('0x24'),_0x3b9dba);logger[_0x7c68('0xf')]('DestroyCmHopperBlack',_0x3b9dba,JSON[_0x7c68('0x11')](_0x13ad55));_0x2cb213(_0x13ad55);})[_0x7c68('0x16')](function(_0xe2cb7d){logger[_0x7c68('0x12')](_0x7c68('0x24'),_0xe2cb7d['message'],_0x3b9dba);_0x3b649f(_0x51b3f7[_0x7c68('0x12')](0x1f4,_0xe2cb7d[_0x7c68('0x14')]));});});}; \ No newline at end of file +var _0x818e=['CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','attributes','limit','include','map','model','then','stringify','update','raw','where','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','CmHopperBlack,\x20%s,\x20%s','debug'];(function(_0x24bcc4,_0x226525){var _0x2e6411=function(_0x541b84){while(--_0x541b84){_0x24bcc4['push'](_0x24bcc4['shift']());}};_0x2e6411(++_0x226525);}(_0x818e,0x122));var _0xe818=function(_0x2afb75,_0x1e9ddf){_0x2afb75=_0x2afb75-0x0;var _0x5e0c7=_0x818e[_0x2afb75];return _0x5e0c7;};'use strict';var _=require(_0xe818('0x0'));var util=require(_0xe818('0x1'));var moment=require(_0xe818('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe818('0x3'));var db=require(_0xe818('0x4'))['db'];var utils=require(_0xe818('0x5'));var logger=require(_0xe818('0x6'))(_0xe818('0x7'));var config=require(_0xe818('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe818('0x9')][_0xe818('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b7271,_0x614326,_0x169749){return new BPromise(function(_0x2b84db,_0x550cd0){return client['request'](_0x2b7271,_0x169749)['then'](function(_0x315f0f){logger[_0xe818('0xb')](_0xe818('0xc'),_0x614326,'request\x20sent');logger[_0xe818('0xd')](_0xe818('0xe'),_0x614326,_0xe818('0xf'),JSON['stringify'](_0x315f0f));if(_0x315f0f['error']){if(_0x315f0f[_0xe818('0x10')][_0xe818('0x11')]===0x1f4){logger[_0xe818('0x10')](_0xe818('0xc'),_0x614326,_0x315f0f['error'][_0xe818('0x12')]);return _0x550cd0(_0x315f0f['error']['message']);}logger[_0xe818('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x614326,_0x315f0f[_0xe818('0x10')][_0xe818('0x12')]);return _0x2b84db(_0x315f0f[_0xe818('0x10')][_0xe818('0x12')]);}else{logger[_0xe818('0xb')](_0xe818('0xc'),_0x614326,'request\x20sent');_0x2b84db(_0x315f0f[_0xe818('0x13')]['message']);}})[_0xe818('0x14')](function(_0xd6ea2f){logger['error'](_0xe818('0xc'),_0x614326,_0xd6ea2f);_0x550cd0(_0xd6ea2f);});});}exports[_0xe818('0x15')]=function(_0x4a4a4f){var _0x2b94ae=this;return new Promise(function(_0x22172c,_0xea4b88){return db[_0xe818('0x16')][_0xe818('0x17')]({'raw':_0x4a4a4f[_0xe818('0x18')]?_0x4a4a4f['options']['raw']===undefined?!![]:![]:!![],'where':_0x4a4a4f['options']?_0x4a4a4f[_0xe818('0x18')]['where']||null:null,'attributes':_0x4a4a4f[_0xe818('0x18')]?_0x4a4a4f[_0xe818('0x18')][_0xe818('0x19')]||null:null,'limit':_0x4a4a4f[_0xe818('0x18')]?_0x4a4a4f[_0xe818('0x18')][_0xe818('0x1a')]||null:null,'include':_0x4a4a4f[_0xe818('0x18')]?_0x4a4a4f[_0xe818('0x18')][_0xe818('0x1b')]?_[_0xe818('0x1c')](_0x4a4a4f[_0xe818('0x18')][_0xe818('0x1b')],function(_0x7ee28a){return{'model':db[_0x7ee28a['model']],'as':_0x7ee28a['as'],'attributes':_0x7ee28a[_0xe818('0x19')],'include':_0x7ee28a[_0xe818('0x1b')]?_[_0xe818('0x1c')](_0x7ee28a['include'],function(_0x486ad3){return{'model':db[_0x486ad3[_0xe818('0x1d')]],'as':_0x486ad3['as'],'attributes':_0x486ad3['attributes'],'include':_0x486ad3[_0xe818('0x1b')]?_['map'](_0x486ad3[_0xe818('0x1b')],function(_0x161a53){return{'model':db[_0x161a53[_0xe818('0x1d')]],'as':_0x161a53['as'],'attributes':_0x161a53[_0xe818('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe818('0x1e')](function(_0x47caf1){logger[_0xe818('0xb')](_0xe818('0x15'),_0x4a4a4f);logger[_0xe818('0xd')](_0xe818('0x15'),_0x4a4a4f,JSON[_0xe818('0x1f')](_0x47caf1));_0x22172c(_0x47caf1);})[_0xe818('0x14')](function(_0x3d99c2){logger['error'](_0xe818('0x15'),_0x3d99c2['message'],_0x4a4a4f);_0xea4b88(_0x2b94ae[_0xe818('0x10')](0x1f4,_0x3d99c2[_0xe818('0x12')]));});});};exports['UpdateCmHopperBlack']=function(_0x211bdd){var _0x2abeac=this;return new Promise(function(_0x13653e,_0x394455){return db[_0xe818('0x16')][_0xe818('0x20')](_0x211bdd['body'],{'raw':_0x211bdd['options']?_0x211bdd[_0xe818('0x18')][_0xe818('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x211bdd[_0xe818('0x18')]?_0x211bdd['options'][_0xe818('0x22')]||null:null,'attributes':_0x211bdd[_0xe818('0x18')]?_0x211bdd[_0xe818('0x18')][_0xe818('0x19')]||null:null,'limit':_0x211bdd[_0xe818('0x18')]?_0x211bdd[_0xe818('0x18')][_0xe818('0x1a')]||null:null})[_0xe818('0x1e')](function(_0x1ebdfe){logger[_0xe818('0xb')](_0xe818('0x23'),_0x211bdd);logger['debug']('UpdateCmHopperBlack',_0x211bdd,JSON[_0xe818('0x1f')](_0x1ebdfe));_0x13653e(_0x1ebdfe);})[_0xe818('0x14')](function(_0x119126){logger[_0xe818('0x10')](_0xe818('0x23'),_0x119126[_0xe818('0x12')],_0x211bdd);_0x394455(_0x2abeac[_0xe818('0x10')](0x1f4,_0x119126[_0xe818('0x12')]));});});};exports[_0xe818('0x24')]=function(_0x795b5a){var _0x302cd7=this;return new Promise(function(_0x3a0956,_0x284517){return db[_0xe818('0x16')][_0xe818('0x25')]({'where':_0x795b5a['options']?_0x795b5a[_0xe818('0x18')][_0xe818('0x22')]||null:null})[_0xe818('0x1e')](function(_0x270b3b){logger[_0xe818('0xb')]('DestroyCmHopperBlack',_0x795b5a);logger[_0xe818('0xd')](_0xe818('0x24'),_0x795b5a,JSON[_0xe818('0x1f')](_0x270b3b));_0x3a0956(_0x270b3b);})[_0xe818('0x14')](function(_0x5a0777){logger[_0xe818('0x10')](_0xe818('0x24'),_0x5a0777[_0xe818('0x12')],_0x795b5a);_0x284517(_0x302cd7[_0xe818('0x10')](0x1f4,_0x5a0777[_0xe818('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index c5d818e..b50bd16 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 _0x781d=['isAuthenticated','index','/describe','describe','put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x781d,0x14a));var _0xd781=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x781d[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd781('0x2'));var router=express[_0xd781('0x3')]();var fs_extra=require(_0xd781('0x4'));var auth=require(_0xd781('0x5'));var interaction=require(_0xd781('0x6'));var config=require(_0xd781('0x7'));var controller=require(_0xd781('0x8'));router[_0xd781('0x9')]('/',auth[_0xd781('0xa')](),controller[_0xd781('0xb')]);router['get'](_0xd781('0xc'),auth[_0xd781('0xa')](),controller[_0xd781('0xd')]);router[_0xd781('0x9')]('/:id',auth[_0xd781('0xa')](),controller['show']);router[_0xd781('0xe')](_0xd781('0xf'),auth['isAuthenticated'](),controller[_0xd781('0x10')]);router[_0xd781('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd781('0x12')]);module[_0xd781('0x13')]=router; \ No newline at end of file +var _0x8ca9=['express','Router','fs-extra','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1b58b8,_0x3e1c2a){var _0x479502=function(_0x3af2ae){while(--_0x3af2ae){_0x1b58b8['push'](_0x1b58b8['shift']());}};_0x479502(++_0x3e1c2a);}(_0x8ca9,0x9c));var _0x98ca=function(_0x39e915,_0x550174){_0x39e915=_0x39e915-0x0;var _0x56eb78=_0x8ca9[_0x39e915];return _0x56eb78;};'use strict';var multer=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var path=require(_0x98ca('0x2'));var timeout=require(_0x98ca('0x3'));var express=require(_0x98ca('0x4'));var router=express[_0x98ca('0x5')]();var fs_extra=require(_0x98ca('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x98ca('0x7'));var controller=require('./cmHopperBlack.controller');router[_0x98ca('0x8')]('/',auth['isAuthenticated'](),controller[_0x98ca('0x9')]);router[_0x98ca('0x8')](_0x98ca('0xa'),auth[_0x98ca('0xb')](),controller[_0x98ca('0xc')]);router[_0x98ca('0x8')](_0x98ca('0xd'),auth[_0x98ca('0xb')](),controller[_0x98ca('0xe')]);router[_0x98ca('0xf')](_0x98ca('0xd'),auth[_0x98ca('0xb')](),controller[_0x98ca('0x10')]);router[_0x98ca('0x11')](_0x98ca('0xd'),auth[_0x98ca('0xb')](),controller[_0x98ca('0x12')]);module[_0x98ca('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 625970e..4a29ff1 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 _0x1876=['STRING','DATE','getDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x18805f,_0x9973b){var _0x54edbb=function(_0x4686e8){while(--_0x4686e8){_0x18805f['push'](_0x18805f['shift']());}};_0x54edbb(++_0x9973b);}(_0x1876,0xbb));var _0x6187=function(_0x560d0f,_0x35c834){_0x560d0f=_0x560d0f-0x0;var _0x1686f4=_0x1876[_0x560d0f];return _0x1686f4;};'use strict';var Sequelize=require(_0x6187('0x0'));var moment=require('moment');module[_0x6187('0x1')]={'state':{'type':Sequelize[_0x6187('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6187('0x3')]},'scheduledat':{'type':Sequelize[_0x6187('0x4')]},'countbusyretry':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6187('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x6187('0x3')]},'originatecalleridname':{'type':Sequelize[_0x6187('0x3')]},'calleridnum':{'type':Sequelize[_0x6187('0x3')]},'calleridname':{'type':Sequelize[_0x6187('0x3')]},'starttime':{'type':Sequelize[_0x6187('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x6187('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x6187('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6187('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x6187('0x3')]},'membername':{'type':Sequelize[_0x6187('0x3')]},'reason':{'type':Sequelize[_0x6187('0x3')]},'disposition':{'type':Sequelize[_0x6187('0x3')]},'secondDisposition':{'type':Sequelize[_0x6187('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6187('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4758ce){var _0x37962c=this[_0x6187('0x5')]('endtime');if(_0x37962c&&_0x4758ce){this['setDataValue'](_0x6187('0x6'),moment(_0x4758ce)[_0x6187('0x7')](moment(_0x37962c),_0x6187('0x8')));}return this['setDataValue']('dispositionat',_0x4758ce);}},'amd':{'type':Sequelize[_0x6187('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6187('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6187('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6187('0x4')]},'callback':{'type':Sequelize[_0x6187('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6187('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6187('0x4')]},'deleted':{'type':Sequelize[_0x6187('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6187('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6187('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6187('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6a03=['sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN'];(function(_0x17d69e,_0x27717d){var _0x4b153f=function(_0x542e11){while(--_0x542e11){_0x17d69e['push'](_0x17d69e['shift']());}};_0x4b153f(++_0x27717d);}(_0x6a03,0xea));var _0x36a0=function(_0x4f169,_0x361145){_0x4f169=_0x4f169-0x0;var _0x4a47dd=_0x6a03[_0x4f169];return _0x4a47dd;};'use strict';var Sequelize=require(_0x36a0('0x0'));var moment=require(_0x36a0('0x1'));module['exports']={'state':{'type':Sequelize[_0x36a0('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x36a0('0x3')]},'scheduledat':{'type':Sequelize[_0x36a0('0x4')]},'countbusyretry':{'type':Sequelize[_0x36a0('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x36a0('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x36a0('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x36a0('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x36a0('0x3')]},'originatecalleridname':{'type':Sequelize[_0x36a0('0x3')]},'calleridnum':{'type':Sequelize[_0x36a0('0x3')]},'calleridname':{'type':Sequelize[_0x36a0('0x3')]},'starttime':{'type':Sequelize[_0x36a0('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x36a0('0x4')]},'droptime':{'type':Sequelize[_0x36a0('0x4')]},'endtime':{'type':Sequelize[_0x36a0('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x36a0('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x36a0('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x36a0('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x36a0('0x3')]},'campaigntype':{'type':Sequelize[_0x36a0('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x36a0('0x3')]},'disposition':{'type':Sequelize[_0x36a0('0x3')]},'secondDisposition':{'type':Sequelize[_0x36a0('0x3')]},'thirdDisposition':{'type':Sequelize[_0x36a0('0x3')]},'dispositionat':{'type':Sequelize[_0x36a0('0x4')],'set':function(_0x397889){var _0x3e2cc0=this[_0x36a0('0x5')](_0x36a0('0x6'));if(_0x3e2cc0&&_0x397889){this[_0x36a0('0x7')](_0x36a0('0x8'),moment(_0x397889)[_0x36a0('0x9')](moment(_0x3e2cc0),_0x36a0('0xa')));}return this[_0x36a0('0x7')](_0x36a0('0xb'),_0x397889);}},'amd':{'type':Sequelize[_0x36a0('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x36a0('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x36a0('0x4')]},'callback':{'type':Sequelize[_0x36a0('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x36a0('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x36a0('0x4')]},'deleted':{'type':Sequelize[_0x36a0('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x36a0('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x36a0('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x36a0('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x36a0('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x36a0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x36a0('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x36a0('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 73e34bf..12dde74 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 _0x1261=['attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','describe','catch','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','cm_hopper','fromQuery','phone','scheduledAt','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','into','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','checkContactHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','CmHopperFinal','model','map','name','keys','query','intersection'];(function(_0x47e3ba,_0x4856f5){var _0x58d2a3=function(_0x4ebb95){while(--_0x4ebb95){_0x47e3ba['push'](_0x47e3ba['shift']());}};_0x58d2a3(++_0x4856f5);}(_0x1261,0x144));var _0x1126=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x1261[_0x1c8c28];return _0x1f59b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['CmHopperFinal'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':!![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['CmHopperFinal']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')]()['then'](respondWithResult(_0x5111d3,null))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports[_0x1126('0x24')]=function(_0x518e0a,_0x3e4eeb){if(_0x518e0a[_0x1126('0x44')][_0x1126('0x45')]){delete _0x518e0a['body'][_0x1126('0x45')];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'uniqueid':_0x518e0a[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0x3e4eeb,null))[_0x1126('0x25')](saveUpdates(_0x518e0a[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0x3e4eeb,null))['catch'](handleError(_0x3e4eeb,null));};exports[_0x1126('0x46')]=function(_0x5a2287,_0x40168e,_0x2ad118){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x5a2287[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4a')))),_0x1126('0x4b')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x4e')))),_0x1126('0x4f')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x1126('0x50')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x1126('0x51')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),_0x1126('0x53')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x40168e,null))[_0x1126('0x25')](respondWithResult(_0x40168e,null))[_0x1126('0x43')](handleError(_0x40168e,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xcc1a95,_0x315386,_0x5e0ea1){return db[_0x1126('0x29')]['findAll']({'raw':![],'where':{'CampaignId':_0xcc1a95[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x1126('0x4b')],[db['sequelize']['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x56')))),_0x1126('0x57')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x4e')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x58')))),'dropContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x59')))),_0x1126('0x51')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),'reCallContacts'],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x315386,null))[_0x1126('0x25')](respondWithResult(_0x315386,null))[_0x1126('0x43')](handleError(_0x315386,null));};exports[_0x1126('0x5a')]=function(_0x247f12,_0xd20fbe,_0x3d5e15){return db[_0x1126('0x5b')][_0x1126('0x41')]({'where':{'id':_0x247f12[_0x1126('0x3f')]['id']}})['then'](handleEntityNotFound(_0xd20fbe,null))[_0x1126('0x25')](function(_0x274343){var _0x2b61ae;if(_0x274343){_0x2b61ae=squel['insert']()['into'](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),'ContactId','ListId','VoiceQueueId',_0x1126('0x60'),_0x1126('0x61')],squel[_0x1126('0x62')]()[_0x1126('0x63')]('ANY_VALUE(calleridnum)',_0x1126('0x5e'))['field'](_0x1126('0x64'),_0x1126('0x5f'))[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),'ListId')[_0x1126('0x63')]('ANY_VALUE(VoiceQueueId)',_0x1126('0x68'))[_0x1126('0x63')]('NOW()',_0x1126('0x60'))[_0x1126('0x63')]('NOW()',_0x1126('0x61'))[_0x1126('0x69')]('cm_hopper_final')['where'](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())['where']('state\x20=\x20?',_0x247f12['body'][_0x1126('0x6c')]['toString']())['where'](_0x1126('0x6d'))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()['field'](_0x1126('0x5e'))[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12['params']['id'][_0x1126('0x6b')]()))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')](_0x1126('0x71')))[_0x1126('0x72')](_0x1126('0x66')))[_0x1126('0x6b')]();return db[_0x1126('0x47')][_0x1126('0x2e')](_0x2b61ae);}return[];})['then'](respondWithResult(_0xd20fbe,null))[_0x1126('0x43')](handleError(_0xd20fbe,null));};exports[_0x1126('0x73')]=function(_0x33cccf,_0x1483f4,_0x3be5bf){return db['Campaign'][_0x1126('0x41')]({'where':{'id':_0x33cccf['params']['id']}})['then'](handleEntityNotFound(_0x1483f4,null))[_0x1126('0x25')](function(_0x2b1884){var _0x55f366;if(_0x2b1884){_0x55f366=squel['insert']()[_0x1126('0x74')](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),_0x1126('0x66'),_0x1126('0x75'),_0x1126('0x76'),_0x1126('0x60'),'updatedAt'],squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x77'),_0x1126('0x5e'))[_0x1126('0x63')](_0x1126('0x64'),'scheduledAt')[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),_0x1126('0x75'))[_0x1126('0x63')](_0x1126('0x78'),_0x1126('0x76'))[_0x1126('0x63')]('NOW()','createdAt')[_0x1126('0x63')]('NOW()',_0x1126('0x61'))['from'](_0x1126('0x70'))['where'](_0x1126('0x79'),_0x33cccf['params']['id']['toString']())['where'](_0x1126('0x7a'),_0x33cccf[_0x1126('0x44')]['state']['toString']())[_0x1126('0x37')](_0x1126('0x6d'))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x1126('0x63')]('phone')[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id']['toString']()))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')]('state\x20=\x204'))[_0x1126('0x72')]('ContactId'))[_0x1126('0x6b')]();return db['sequelize'][_0x1126('0x2e')](_0x55f366);}return[];})[_0x1126('0x25')](respondWithResult(_0x1483f4,null))[_0x1126('0x43')](handleError(_0x1483f4,null));};exports[_0x1126('0x7b')]=function(_0x59c04b,_0x429183,_0x834360){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x59c04b[_0x1126('0x44')][_0x1126('0x68')],'CampaignId':_0x59c04b[_0x1126('0x44')]['CampaignId'],'ContactId':_0x59c04b[_0x1126('0x44')]['ContactId']}})[_0x1126('0x25')](handleEntityNotFound(_0x429183,null))[_0x1126('0x25')](function(_0x4d6bb2){if(_0x4d6bb2){return _0x4d6bb2;}return null;})[_0x1126('0x25')](respondWithResult(_0x429183,null))[_0x1126('0x43')](handleError(_0x429183,null));}; \ No newline at end of file +var _0xba34=['insert','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','state\x20=\x20?','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','CmHopperFinal','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','uniqueid','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign'];(function(_0x36d203,_0x3653f3){var _0x2f9e62=function(_0x461a77){while(--_0x461a77){_0x36d203['push'](_0x36d203['shift']());}};_0x2f9e62(++_0x3653f3);}(_0xba34,0x119));var _0x4ba3=function(_0x5ef2d2,_0x2cc463){_0x5ef2d2=_0x5ef2d2-0x0;var _0x2a3c37=_0xba34[_0x5ef2d2];return _0x2a3c37;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':!![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['describe']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['describe']()[_0x4ba3('0x26')](respondWithResult(_0x1fe115,null))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports[_0x4ba3('0x25')]=function(_0x58648d,_0x47f588){if(_0x58648d[_0x4ba3('0x49')]['uniqueid']){delete _0x58648d[_0x4ba3('0x49')][_0x4ba3('0x4a')];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'uniqueid':_0x58648d[_0x4ba3('0x4b')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x47f588,null))['then'](saveUpdates(_0x58648d[_0x4ba3('0x49')],null))[_0x4ba3('0x26')](respondWithResult(_0x47f588,null))['catch'](handleError(_0x47f588,null));};exports[_0x4ba3('0x4c')]=function(_0x12ae6f,_0x156c2d,_0x19d6a3){return db[_0x4ba3('0x2d')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x12ae6f[_0x4ba3('0x4b')]['id']},'attributes':[[db[_0x4ba3('0x4d')]['fn']('COUNT',db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x4f')))),_0x4ba3('0x50')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x52')))),_0x4ba3('0x53')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x4ba3('0x54')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')]['literal'](_0x4ba3('0x55')))),_0x4ba3('0x56')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x57')))),_0x4ba3('0x58')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4ba3('0x59')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x5a')))),_0x4ba3('0x5b')],[db['sequelize']['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')]['literal'](_0x4ba3('0x5c')))),'answeringMachine']]})[_0x4ba3('0x26')](handleEntityNotFound(_0x156c2d,null))[_0x4ba3('0x26')](respondWithResult(_0x156c2d,null))[_0x4ba3('0x46')](handleError(_0x156c2d,null));};exports[_0x4ba3('0x5d')]=function(_0xf0fd32,_0x4b5289,_0x3d9a7e){return db[_0x4ba3('0x2d')][_0x4ba3('0x44')]({'raw':![],'where':{'CampaignId':_0xf0fd32[_0x4ba3('0x4b')]['id']},'attributes':[[db[_0x4ba3('0x4d')]['fn']('COUNT',db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x4f')))),_0x4ba3('0x50')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x52')))),'noAnswerContacts'],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x4ba3('0x4e')](_0x4ba3('0x5e')))),'busyContacts'],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db['sequelize'][_0x4ba3('0x4e')](_0x4ba3('0x55')))),_0x4ba3('0x56')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db['sequelize'][_0x4ba3('0x4e')](_0x4ba3('0x57')))),_0x4ba3('0x58')],[db['sequelize']['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x5f')))),_0x4ba3('0x59')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x4ba3('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x4ba3('0x5b')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db['sequelize']['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x5c')))),'answeringMachine']]})[_0x4ba3('0x26')](handleEntityNotFound(_0x4b5289,null))['then'](respondWithResult(_0x4b5289,null))[_0x4ba3('0x46')](handleError(_0x4b5289,null));};exports[_0x4ba3('0x60')]=function(_0x5dce8f,_0x37fedb,_0x2ed729){return db[_0x4ba3('0x61')][_0x4ba3('0x48')]({'where':{'id':_0x5dce8f[_0x4ba3('0x4b')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x37fedb,null))[_0x4ba3('0x26')](function(_0x329874){var _0x360127;if(_0x329874){_0x360127=squel['insert']()[_0x4ba3('0x62')](_0x4ba3('0x63'))[_0x4ba3('0x64')]([_0x4ba3('0x65'),_0x4ba3('0x66'),_0x4ba3('0x67'),_0x4ba3('0x68'),_0x4ba3('0x69'),_0x4ba3('0x6a'),_0x4ba3('0x6b')],squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')]('ANY_VALUE(calleridnum)',_0x4ba3('0x65'))[_0x4ba3('0x6d')]('NOW()',_0x4ba3('0x66'))[_0x4ba3('0x6d')]('ANY_VALUE(ContactId)','ContactId')[_0x4ba3('0x6d')](_0x4ba3('0x6e'),_0x4ba3('0x68'))[_0x4ba3('0x6d')](_0x4ba3('0x6f'),_0x4ba3('0x69'))[_0x4ba3('0x6d')](_0x4ba3('0x70'),'createdAt')[_0x4ba3('0x6d')]('NOW()',_0x4ba3('0x6b'))[_0x4ba3('0x71')](_0x4ba3('0x72'))[_0x4ba3('0x3d')](_0x4ba3('0x73'),_0x5dce8f[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')]('state\x20=\x20?',_0x5dce8f[_0x4ba3('0x49')][_0x4ba3('0x75')][_0x4ba3('0x74')]())['where'](_0x4ba3('0x76'))[_0x4ba3('0x3d')](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')](_0x4ba3('0x65'))[_0x4ba3('0x71')]('cm_hopper')['where'](_0x4ba3('0x73'),_0x5dce8f['params']['id'][_0x4ba3('0x74')]()))[_0x4ba3('0x3d')](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()['field']('calleridnum')[_0x4ba3('0x71')](_0x4ba3('0x72'))['where'](_0x4ba3('0x73'),_0x5dce8f[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x78')))[_0x4ba3('0x79')](_0x4ba3('0x67')))['toString']();return db[_0x4ba3('0x4d')][_0x4ba3('0x32')](_0x360127);}return[];})[_0x4ba3('0x26')](respondWithResult(_0x37fedb,null))['catch'](handleError(_0x37fedb,null));};exports[_0x4ba3('0x7a')]=function(_0x13dbc4,_0x4e334c,_0x39d1d3){return db[_0x4ba3('0x7b')]['find']({'where':{'id':_0x13dbc4['params']['id']}})['then'](handleEntityNotFound(_0x4e334c,null))['then'](function(_0x206e93){var _0x2d57a7;if(_0x206e93){_0x2d57a7=squel[_0x4ba3('0x7c')]()[_0x4ba3('0x62')](_0x4ba3('0x63'))[_0x4ba3('0x64')]([_0x4ba3('0x65'),'scheduledAt',_0x4ba3('0x67'),'ListId',_0x4ba3('0x7d'),'createdAt',_0x4ba3('0x6b')],squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')](_0x4ba3('0x7e'),_0x4ba3('0x65'))['field']('NOW()',_0x4ba3('0x66'))[_0x4ba3('0x6d')](_0x4ba3('0x7f'),_0x4ba3('0x67'))[_0x4ba3('0x6d')](_0x4ba3('0x6e'),_0x4ba3('0x68'))[_0x4ba3('0x6d')](_0x4ba3('0x80'),_0x4ba3('0x7d'))[_0x4ba3('0x6d')](_0x4ba3('0x70'),'createdAt')[_0x4ba3('0x6d')]('NOW()',_0x4ba3('0x6b'))[_0x4ba3('0x71')](_0x4ba3('0x72'))[_0x4ba3('0x3d')]('CampaignId\x20=\x20?',_0x13dbc4[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x81'),_0x13dbc4['body']['state'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x76'))['where'](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')](_0x4ba3('0x65'))[_0x4ba3('0x71')](_0x4ba3('0x63'))['where'](_0x4ba3('0x82'),_0x13dbc4['params']['id'][_0x4ba3('0x74')]()))[_0x4ba3('0x3d')](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()['field'](_0x4ba3('0x83'))[_0x4ba3('0x71')]('cm_hopper_final')[_0x4ba3('0x3d')]('CampaignId\x20=\x20?',_0x13dbc4[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x78')))[_0x4ba3('0x79')]('ContactId'))['toString']();return db[_0x4ba3('0x4d')][_0x4ba3('0x32')](_0x2d57a7);}return[];})[_0x4ba3('0x26')](respondWithResult(_0x4e334c,null))['catch'](handleError(_0x4e334c,null));};exports[_0x4ba3('0x84')]=function(_0x38a7a8,_0x5553eb,_0x402ab1){return db[_0x4ba3('0x85')][_0x4ba3('0x86')]({'where':{'VoiceQueueId':_0x38a7a8[_0x4ba3('0x49')][_0x4ba3('0x69')],'CampaignId':_0x38a7a8[_0x4ba3('0x49')][_0x4ba3('0x7d')],'ContactId':_0x38a7a8[_0x4ba3('0x49')]['ContactId']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5553eb,null))[_0x4ba3('0x26')](function(_0xfb16a6){if(_0xfb16a6){return _0xfb16a6;}return null;})[_0x4ba3('0x26')](respondWithResult(_0x5553eb,null))[_0x4ba3('0x46')](handleError(_0x5553eb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index eb46257..baa8f64 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 _0x751d=['./cmHopperFinal.attributes','exports','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x751d,0x1d3));var _0xd751=function(_0x20fb02,_0x96c029){_0x20fb02=_0x20fb02-0x0;var _0x24a33e=_0x751d[_0x20fb02];return _0x24a33e;};'use strict';var _=require(_0xd751('0x0'));var util=require(_0xd751('0x1'));var logger=require(_0xd751('0x2'))(_0xd751('0x3'));var moment=require('moment');var BPromise=require(_0xd751('0x4'));var rp=require(_0xd751('0x5'));var fs=require('fs');var path=require(_0xd751('0x6'));var rimraf=require(_0xd751('0x7'));var config=require(_0xd751('0x8'));var attributes=require(_0xd751('0x9'));module[_0xd751('0xa')]=function(_0x1f15d2,_0x519006){return _0x1f15d2['define'](_0xd751('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xd751('0xc'),'fields':['calleridnum']},{'name':_0xd751('0xd'),'fields':[_0xd751('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6496=['define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','./cmHopperFinal.attributes','exports'];(function(_0x40be9d,_0x9294ce){var _0x4fb656=function(_0x4cd05e){while(--_0x4cd05e){_0x40be9d['push'](_0x40be9d['shift']());}};_0x4fb656(++_0x9294ce);}(_0x6496,0x1e1));var _0x6649=function(_0x24cdd5,_0x4232a0){_0x24cdd5=_0x24cdd5-0x0;var _0x52a09e=_0x6496[_0x24cdd5];return _0x52a09e;};'use strict';var _=require(_0x6649('0x0'));var util=require(_0x6649('0x1'));var logger=require(_0x6649('0x2'))(_0x6649('0x3'));var moment=require('moment');var BPromise=require(_0x6649('0x4'));var rp=require(_0x6649('0x5'));var fs=require('fs');var path=require(_0x6649('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6649('0x7'));module[_0x6649('0x8')]=function(_0x446a13,_0x4112f4){return _0x446a13[_0x6649('0x9')](_0x6649('0xa'),attributes,{'tableName':_0x6649('0xb'),'paranoid':![],'indexes':[{'name':_0x6649('0xc'),'fields':[_0x6649('0xc')]},{'name':_0x6649('0xd'),'fields':[_0x6649('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 02dde2a..7419711 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(_0x4a850c,_0x49eb71){var _0x4008cf=function(_0x50e31f){while(--_0x50e31f){_0x4a850c['push'](_0x4a850c['shift']());}};_0x4008cf(++_0x49eb71);}(_0xb10b,0x12a));var _0xbb10=function(_0x1eb5da,_0x1974ec){_0x1eb5da=_0x1eb5da-0x0;var _0x579a2f=_0xb10b[_0x1eb5da];return _0x579a2f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x535c35,_0x3a1b4f){var _0x3702d9=function(_0x235a54){while(--_0x235a54){_0x535c35['push'](_0x535c35['shift']());}};_0x3702d9(++_0x3a1b4f);}(_0x7a54,0x106));var _0x47a5=function(_0x3449b3,_0xffe6be){_0x3449b3=_0x3449b3-0x0;var _0x33404b=_0x7a54[_0x3449b3];return _0x33404b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 6ffa5c8..3f3754c 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 _0x3a6d=['/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x3a6d,0x143));var _0xd3a6=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x3a6d[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var path=require('path');var timeout=require(_0xd3a6('0x2'));var express=require(_0xd3a6('0x3'));var router=express[_0xd3a6('0x4')]();var fs_extra=require(_0xd3a6('0x5'));var auth=require(_0xd3a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd3a6('0x7'));var controller=require(_0xd3a6('0x8'));router[_0xd3a6('0x9')]('/',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xb')]);router[_0xd3a6('0x9')]('/describe',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xc')]);router[_0xd3a6('0x9')](_0xd3a6('0xd'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xe')]);router[_0xd3a6('0x9')](_0xd3a6('0xf'),auth[_0xd3a6('0xa')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xd3a6('0x9')](_0xd3a6('0x10'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x11')]);router[_0xd3a6('0x12')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xd3a6('0x12')](_0xd3a6('0x13'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x14')]);router[_0xd3a6('0x12')](_0xd3a6('0x15'),auth[_0xd3a6('0xa')](),controller['checkContactHopper']);router[_0xd3a6('0x16')](_0xd3a6('0xd'),auth[_0xd3a6('0xa')](),controller['update']);module[_0xd3a6('0x17')]=router; \ No newline at end of file +var _0x434b=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','path'];(function(_0x3a3ba6,_0x1c2fa1){var _0x36af82=function(_0x467b4e){while(--_0x467b4e){_0x3a3ba6['push'](_0x3a3ba6['shift']());}};_0x36af82(++_0x1c2fa1);}(_0x434b,0x17f));var _0xb434=function(_0x55c00d,_0x520cb6){_0x55c00d=_0x55c00d-0x0;var _0x254a8f=_0x434b[_0x55c00d];return _0x254a8f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb434('0x0'));var timeout=require(_0xb434('0x1'));var express=require('express');var router=express[_0xb434('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb434('0x3'));var interaction=require(_0xb434('0x4'));var config=require(_0xb434('0x5'));var controller=require(_0xb434('0x6'));router[_0xb434('0x7')]('/',auth[_0xb434('0x8')](),controller[_0xb434('0x9')]);router[_0xb434('0x7')](_0xb434('0xa'),auth['isAuthenticated'](),controller[_0xb434('0xb')]);router[_0xb434('0x7')](_0xb434('0xc'),auth[_0xb434('0x8')](),controller[_0xb434('0xd')]);router[_0xb434('0x7')](_0xb434('0xe'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0xb434('0x7')](_0xb434('0xf'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0xb434('0x10')](_0xb434('0x11'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xb434('0x10')](_0xb434('0x12'),auth['isAuthenticated'](),controller[_0xb434('0x13')]);router[_0xb434('0x10')](_0xb434('0x14'),auth[_0xb434('0x8')](),controller[_0xb434('0x15')]);router[_0xb434('0x16')](_0xb434('0xc'),auth[_0xb434('0x8')](),controller['update']);module[_0xb434('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 4f1abea..dbd2ac9 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 _0x53fd=['DATE','STRING','BOOLEAN','sequelize','INTEGER'];(function(_0xaf4769,_0xdb8bf7){var _0x4f491c=function(_0x1c0f76){while(--_0x1c0f76){_0xaf4769['push'](_0xaf4769['shift']());}};_0x4f491c(++_0xdb8bf7);}(_0x53fd,0x184));var _0xd53f=function(_0x492e5a,_0x2e051f){_0x492e5a=_0x492e5a-0x0;var _0x4f83b2=_0x53fd[_0x492e5a];return _0x4f83b2;};'use strict';var Sequelize=require(_0xd53f('0x0'));module['exports']={'state':{'type':Sequelize[_0xd53f('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xd53f('0x2')]},'countbusyretry':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd53f('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xd53f('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd53f('0x3')]},'calleridname':{'type':Sequelize[_0xd53f('0x3')]},'starttime':{'type':Sequelize[_0xd53f('0x2')]},'responsetime':{'type':Sequelize[_0xd53f('0x2')]},'answertime':{'type':Sequelize[_0xd53f('0x2')]},'droptime':{'type':Sequelize[_0xd53f('0x2')]},'endtime':{'type':Sequelize[_0xd53f('0x2')]},'ringtime':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd53f('0x3')]},'campaign':{'type':Sequelize[_0xd53f('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd53f('0x3')]},'reason':{'type':Sequelize[_0xd53f('0x3')]},'amd':{'type':Sequelize[_0xd53f('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd53f('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd53f('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xd53f('0x2')]},'edited':{'type':Sequelize[_0xd53f('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd53f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xce87=['DATE','INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x341cad,_0x4fcca4){var _0x401840=function(_0x17681b){while(--_0x17681b){_0x341cad['push'](_0x341cad['shift']());}};_0x401840(++_0x4fcca4);}(_0xce87,0x76));var _0x7ce8=function(_0x167914,_0x87b5a){_0x167914=_0x167914-0x0;var _0x5e5d79=_0xce87[_0x167914];return _0x5e5d79;};'use strict';var Sequelize=require(_0x7ce8('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x7ce8('0x1')]},'scheduledat':{'type':Sequelize[_0x7ce8('0x2')]},'countbusyretry':{'type':Sequelize[_0x7ce8('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7ce8('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7ce8('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x7ce8('0x1')]},'originatecalleridname':{'type':Sequelize[_0x7ce8('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7ce8('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x7ce8('0x2')]},'answertime':{'type':Sequelize[_0x7ce8('0x2')]},'droptime':{'type':Sequelize[_0x7ce8('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x7ce8('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7ce8('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7ce8('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7ce8('0x1')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x7ce8('0x1')]},'amd':{'type':Sequelize[_0x7ce8('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7ce8('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7ce8('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7ce8('0x2')]},'recallme':{'type':Sequelize[_0x7ce8('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x7ce8('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x7ce8('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7ce8('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7ce8('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 58262be..1f48632 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 _0x4671=['merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','end','error','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where'];(function(_0x164cb4,_0x40ea97){var _0x1bbe7e=function(_0x562197){while(--_0x562197){_0x164cb4['push'](_0x164cb4['shift']());}};_0x1bbe7e(++_0x40ea97);}(_0x4671,0x1c9));var _0x1467=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4671[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1467('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1467('0x1'));var rp=require(_0x1467('0x2'));var moment=require(_0x1467('0x3'));var BPromise=require(_0x1467('0x4'));var Mustache=require(_0x1467('0x5'));var util=require('util');var path=require(_0x1467('0x6'));var sox=require(_0x1467('0x7'));var csv=require('to-csv');var ejs=require(_0x1467('0x8'));var fs=require('fs');var fs_extra=require(_0x1467('0x9'));var _=require(_0x1467('0xa'));var squel=require(_0x1467('0xb'));var crypto=require(_0x1467('0xc'));var jsforce=require(_0x1467('0xd'));var deskjs=require(_0x1467('0xe'));var toCsv=require(_0x1467('0xf'));var querystring=require('querystring');var Papa=require(_0x1467('0x10'));var Redis=require('ioredis');var authService=require(_0x1467('0x11'));var qs=require(_0x1467('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1467('0x13'))('api');var utils=require(_0x1467('0x14'));var config=require(_0x1467('0x15'));var licenseUtil=require(_0x1467('0x16'));var db=require(_0x1467('0x17'))['db'];function respondWithStatusCode(_0x3c096c,_0x24a133){_0x24a133=_0x24a133||0xcc;return function(_0x587039){if(_0x587039){return _0x3c096c[_0x1467('0x18')](_0x24a133);}return _0x3c096c[_0x1467('0x19')](_0x24a133)['end']();};}function respondWithResult(_0x20aea0,_0x3c2f14){_0x3c2f14=_0x3c2f14||0xc8;return function(_0x3088bf){if(_0x3088bf){return _0x20aea0[_0x1467('0x19')](_0x3c2f14)[_0x1467('0x1a')](_0x3088bf);}};}function respondWithFilteredResult(_0x14921d,_0x4c357e){return function(_0x322802){if(_0x322802){var _0xd2529b=typeof _0x4c357e[_0x1467('0x1b')]===_0x1467('0x1c')&&typeof _0x4c357e[_0x1467('0x1d')]===_0x1467('0x1c');var _0x1f6319=_0x322802[_0x1467('0x1e')];var _0x3651dc=_0xd2529b?0x0:_0x4c357e[_0x1467('0x1b')];var _0x48138e=_0xd2529b?_0x322802['count']:_0x4c357e[_0x1467('0x1b')]+_0x4c357e['limit'];var _0x439e3b;if(_0x48138e>=_0x1f6319){_0x48138e=_0x1f6319;_0x439e3b=0xc8;}else{_0x439e3b=0xce;}_0x14921d[_0x1467('0x19')](_0x439e3b);return _0x14921d['set'](_0x1467('0x1f'),_0x3651dc+'-'+_0x48138e+'/'+_0x1f6319)[_0x1467('0x1a')](_0x322802);}return null;};}function patchUpdates(_0x1138d8){return function(_0x4b4a40){try{jsonpatch['apply'](_0x4b4a40,_0x1138d8,!![]);}catch(_0x51caf7){return BPromise[_0x1467('0x20')](_0x51caf7);}return _0x4b4a40[_0x1467('0x21')]();};}function saveUpdates(_0x20ceff,_0x4b054b){return function(_0x418625){if(_0x418625){return _0x418625[_0x1467('0x22')](_0x20ceff)[_0x1467('0x23')](function(_0x31e6c4){return _0x31e6c4;});}return null;};}function removeEntity(_0x34d39f,_0x3737f6){return function(_0x4e700d){if(_0x4e700d){return _0x4e700d['destroy']()[_0x1467('0x23')](function(){_0x34d39f[_0x1467('0x19')](0xcc)[_0x1467('0x24')]();});}};}function handleEntityNotFound(_0x34655c,_0x4f549e){return function(_0x5dcbde){if(!_0x5dcbde){_0x34655c['sendStatus'](0x194);}return _0x5dcbde;};}function handleError(_0x583f20,_0x1fe098){_0x1fe098=_0x1fe098||0x1f4;return function(_0x15a3eb){logger[_0x1467('0x25')](_0x15a3eb[_0x1467('0x26')]);if(_0x15a3eb[_0x1467('0x27')]){delete _0x15a3eb['name'];}_0x583f20['status'](_0x1fe098)[_0x1467('0x28')](_0x15a3eb);};}exports[_0x1467('0x29')]=function(_0x23b06b,_0x2cbd22){var _0x410af7={},_0x475b64={},_0x2bdd11={'count':0x0,'rows':[]};var _0x256da1=_['map'](db[_0x1467('0x2a')][_0x1467('0x2b')],function(_0x71f1f1){return{'name':_0x71f1f1[_0x1467('0x2c')],'type':_0x71f1f1[_0x1467('0x2d')][_0x1467('0x2e')]};});_0x475b64[_0x1467('0x2f')]=_[_0x1467('0x30')](_0x256da1,_0x1467('0x27'));_0x475b64[_0x1467('0x31')]=_[_0x1467('0x32')](_0x23b06b[_0x1467('0x31')]);_0x475b64[_0x1467('0x33')]=_[_0x1467('0x34')](_0x475b64[_0x1467('0x2f')],_0x475b64[_0x1467('0x31')]);_0x410af7[_0x1467('0x35')]=_[_0x1467('0x34')](_0x475b64[_0x1467('0x2f')],qs[_0x1467('0x36')](_0x23b06b['query']['fields']));_0x410af7[_0x1467('0x35')]=_0x410af7['attributes'][_0x1467('0x37')]?_0x410af7[_0x1467('0x35')]:_0x475b64[_0x1467('0x2f')];if(!_0x23b06b[_0x1467('0x31')]['hasOwnProperty'](_0x1467('0x38'))){_0x410af7[_0x1467('0x1d')]=qs[_0x1467('0x1d')](_0x23b06b[_0x1467('0x31')]['limit']);_0x410af7[_0x1467('0x1b')]=qs[_0x1467('0x1b')](_0x23b06b[_0x1467('0x31')][_0x1467('0x1b')]);}_0x410af7[_0x1467('0x39')]=qs[_0x1467('0x3a')](_0x23b06b[_0x1467('0x31')]['sort']);_0x410af7['where']=qs[_0x1467('0x33')](_['pick'](_0x23b06b[_0x1467('0x31')],_0x475b64[_0x1467('0x33')]),_0x256da1);if(_0x23b06b['query'][_0x1467('0x3b')]){_0x410af7[_0x1467('0x3c')]=_[_0x1467('0x3d')](_0x410af7[_0x1467('0x3c')],{'$or':_['map'](_0x256da1,function(_0x38c103){if(_0x38c103['type']!==_0x1467('0x3e')){var _0x844657={};_0x844657[_0x38c103[_0x1467('0x27')]]={'$like':'%'+_0x23b06b[_0x1467('0x31')]['filter']+'%'};return _0x844657;}})});}_0x410af7=_[_0x1467('0x3d')]({},_0x410af7,_0x23b06b[_0x1467('0x3f')]);var _0x3bd2e1={'where':_0x410af7['where']};return db['CmHopperHistory'][_0x1467('0x1e')](_0x3bd2e1)['then'](function(_0x56d123){_0x2bdd11[_0x1467('0x1e')]=_0x56d123;if(_0x23b06b['query'][_0x1467('0x40')]){_0x410af7[_0x1467('0x41')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x410af7);})[_0x1467('0x23')](function(_0x4a43cb){_0x2bdd11['rows']=_0x4a43cb;return _0x2bdd11;})[_0x1467('0x23')](respondWithFilteredResult(_0x2cbd22,_0x410af7))[_0x1467('0x42')](handleError(_0x2cbd22,null));};exports[_0x1467('0x43')]=function(_0x40cc40,_0x318989){var _0x1db13f={'raw':!![],'where':{'id':_0x40cc40[_0x1467('0x44')]['id']}},_0x87d8b8={};_0x87d8b8[_0x1467('0x2f')]=_[_0x1467('0x32')](db['CmHopperHistory']['rawAttributes']);_0x87d8b8[_0x1467('0x31')]=_[_0x1467('0x32')](_0x40cc40[_0x1467('0x31')]);_0x87d8b8[_0x1467('0x33')]=_['intersection'](_0x87d8b8[_0x1467('0x2f')],_0x87d8b8[_0x1467('0x31')]);_0x1db13f['attributes']=_[_0x1467('0x34')](_0x87d8b8[_0x1467('0x2f')],qs[_0x1467('0x36')](_0x40cc40[_0x1467('0x31')][_0x1467('0x36')]));_0x1db13f[_0x1467('0x35')]=_0x1db13f['attributes'][_0x1467('0x37')]?_0x1db13f[_0x1467('0x35')]:_0x87d8b8[_0x1467('0x2f')];if(_0x40cc40['query']['includeAll']){_0x1db13f[_0x1467('0x41')]=[{'all':!![]}];}_0x1db13f=_[_0x1467('0x3d')]({},_0x1db13f,_0x40cc40['options']);return db['CmHopperHistory'][_0x1467('0x45')](_0x1db13f)[_0x1467('0x23')](handleEntityNotFound(_0x318989,null))['then'](respondWithResult(_0x318989,null))[_0x1467('0x42')](handleError(_0x318989,null));};exports[_0x1467('0x46')]=function(_0x34d4c6,_0x341a29){return db[_0x1467('0x2a')][_0x1467('0x46')](_0x34d4c6[_0x1467('0x47')],{})[_0x1467('0x23')](respondWithResult(_0x341a29,0xc9))[_0x1467('0x42')](handleError(_0x341a29,null));};exports[_0x1467('0x48')]=function(_0x169216,_0x1a5d4b){return db[_0x1467('0x2a')][_0x1467('0x48')]()['then'](respondWithResult(_0x1a5d4b,null))[_0x1467('0x42')](handleError(_0x1a5d4b,null));};exports[_0x1467('0x22')]=function(_0xd612af,_0x52f363){if(_0xd612af['body'][_0x1467('0x49')]){delete _0xd612af[_0x1467('0x47')][_0x1467('0x49')];}return db['CmHopperHistory'][_0x1467('0x45')]({'where':{'uniqueid':_0xd612af['params']['id']}})[_0x1467('0x23')](handleEntityNotFound(_0x52f363,null))[_0x1467('0x23')](saveUpdates(_0xd612af[_0x1467('0x47')],null))[_0x1467('0x23')](respondWithResult(_0x52f363,null))[_0x1467('0x42')](handleError(_0x52f363,null));}; \ No newline at end of file +var _0xb6b0=['nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','CmHopperHistory','findAll','rows','show','params','keys','find','catch','create','body','describe','uniqueid','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x4dc4fc,_0x1d7139){var _0x203e8a=function(_0x15487a){while(--_0x15487a){_0x4dc4fc['push'](_0x4dc4fc['shift']());}};_0x203e8a(++_0x1d7139);}(_0xb6b0,0xef));var _0x0b6b=function(_0x48cee4,_0x15269e){_0x48cee4=_0x48cee4-0x0;var _0x372152=_0xb6b0[_0x48cee4];return _0x372152;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b6b('0x0'));var zipdir=require(_0x0b6b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b6b('0x2'));var moment=require(_0x0b6b('0x3'));var BPromise=require(_0x0b6b('0x4'));var Mustache=require('mustache');var util=require(_0x0b6b('0x5'));var path=require('path');var sox=require(_0x0b6b('0x6'));var csv=require(_0x0b6b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0b6b('0x8'));var _=require('lodash');var squel=require(_0x0b6b('0x9'));var crypto=require(_0x0b6b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0b6b('0x7'));var querystring=require('querystring');var Papa=require(_0x0b6b('0xb'));var Redis=require('ioredis');var authService=require(_0x0b6b('0xc'));var qs=require(_0x0b6b('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b6b('0xe'));var logger=require('../../config/logger')(_0x0b6b('0xf'));var utils=require(_0x0b6b('0x10'));var config=require(_0x0b6b('0x11'));var licenseUtil=require(_0x0b6b('0x12'));var db=require(_0x0b6b('0x13'))['db'];function respondWithStatusCode(_0x485751,_0xb428b){_0xb428b=_0xb428b||0xcc;return function(_0x8a84a9){if(_0x8a84a9){return _0x485751['sendStatus'](_0xb428b);}return _0x485751[_0x0b6b('0x14')](_0xb428b)['end']();};}function respondWithResult(_0x4e3166,_0x963deb){_0x963deb=_0x963deb||0xc8;return function(_0x18a602){if(_0x18a602){return _0x4e3166[_0x0b6b('0x14')](_0x963deb)[_0x0b6b('0x15')](_0x18a602);}};}function respondWithFilteredResult(_0x591ac6,_0x38db10){return function(_0x8993fc){if(_0x8993fc){var _0x368262=typeof _0x38db10['offset']===_0x0b6b('0x16')&&typeof _0x38db10['limit']===_0x0b6b('0x16');var _0x547b56=_0x8993fc[_0x0b6b('0x17')];var _0x3b0fa3=_0x368262?0x0:_0x38db10[_0x0b6b('0x18')];var _0x4d1386=_0x368262?_0x8993fc[_0x0b6b('0x17')]:_0x38db10['offset']+_0x38db10[_0x0b6b('0x19')];var _0x1c89f9;if(_0x4d1386>=_0x547b56){_0x4d1386=_0x547b56;_0x1c89f9=0xc8;}else{_0x1c89f9=0xce;}_0x591ac6[_0x0b6b('0x14')](_0x1c89f9);return _0x591ac6[_0x0b6b('0x1a')](_0x0b6b('0x1b'),_0x3b0fa3+'-'+_0x4d1386+'/'+_0x547b56)[_0x0b6b('0x15')](_0x8993fc);}return null;};}function patchUpdates(_0x3affd4){return function(_0x3bcd90){try{jsonpatch[_0x0b6b('0x1c')](_0x3bcd90,_0x3affd4,!![]);}catch(_0x46c00b){return BPromise['reject'](_0x46c00b);}return _0x3bcd90['save']();};}function saveUpdates(_0x34e7b3,_0x21d940){return function(_0x29ab94){if(_0x29ab94){return _0x29ab94[_0x0b6b('0x1d')](_0x34e7b3)[_0x0b6b('0x1e')](function(_0x11c20d){return _0x11c20d;});}return null;};}function removeEntity(_0x2f8181,_0xc0ae52){return function(_0xc7cb3b){if(_0xc7cb3b){return _0xc7cb3b['destroy']()[_0x0b6b('0x1e')](function(){_0x2f8181[_0x0b6b('0x14')](0xcc)[_0x0b6b('0x1f')]();});}};}function handleEntityNotFound(_0x312b86,_0xa31975){return function(_0x4d2e4b){if(!_0x4d2e4b){_0x312b86['sendStatus'](0x194);}return _0x4d2e4b;};}function handleError(_0x25f82c,_0x46ed66){_0x46ed66=_0x46ed66||0x1f4;return function(_0x2bdd45){logger[_0x0b6b('0x20')](_0x2bdd45[_0x0b6b('0x21')]);if(_0x2bdd45[_0x0b6b('0x22')]){delete _0x2bdd45[_0x0b6b('0x22')];}_0x25f82c[_0x0b6b('0x14')](_0x46ed66)[_0x0b6b('0x23')](_0x2bdd45);};}exports[_0x0b6b('0x24')]=function(_0x21060d,_0x5c6c56){var _0x12d9d4={},_0x5b6085={},_0x3e3909={'count':0x0,'rows':[]};var _0x55ec91=_[_0x0b6b('0x25')](db['CmHopperHistory'][_0x0b6b('0x26')],function(_0x1dc0a6){return{'name':_0x1dc0a6['fieldName'],'type':_0x1dc0a6[_0x0b6b('0x27')][_0x0b6b('0x28')]};});_0x5b6085[_0x0b6b('0x29')]=_['map'](_0x55ec91,_0x0b6b('0x22'));_0x5b6085[_0x0b6b('0x2a')]=_['keys'](_0x21060d[_0x0b6b('0x2a')]);_0x5b6085[_0x0b6b('0x2b')]=_[_0x0b6b('0x2c')](_0x5b6085['model'],_0x5b6085[_0x0b6b('0x2a')]);_0x12d9d4[_0x0b6b('0x2d')]=_[_0x0b6b('0x2c')](_0x5b6085[_0x0b6b('0x29')],qs[_0x0b6b('0x2e')](_0x21060d[_0x0b6b('0x2a')]['fields']));_0x12d9d4[_0x0b6b('0x2d')]=_0x12d9d4[_0x0b6b('0x2d')][_0x0b6b('0x2f')]?_0x12d9d4[_0x0b6b('0x2d')]:_0x5b6085[_0x0b6b('0x29')];if(!_0x21060d[_0x0b6b('0x2a')][_0x0b6b('0x30')](_0x0b6b('0x31'))){_0x12d9d4[_0x0b6b('0x19')]=qs['limit'](_0x21060d[_0x0b6b('0x2a')][_0x0b6b('0x19')]);_0x12d9d4['offset']=qs['offset'](_0x21060d[_0x0b6b('0x2a')][_0x0b6b('0x18')]);}_0x12d9d4[_0x0b6b('0x32')]=qs['sort'](_0x21060d[_0x0b6b('0x2a')][_0x0b6b('0x33')]);_0x12d9d4[_0x0b6b('0x34')]=qs[_0x0b6b('0x2b')](_[_0x0b6b('0x35')](_0x21060d[_0x0b6b('0x2a')],_0x5b6085['filters']),_0x55ec91);if(_0x21060d['query']['filter']){_0x12d9d4[_0x0b6b('0x34')]=_[_0x0b6b('0x36')](_0x12d9d4[_0x0b6b('0x34')],{'$or':_[_0x0b6b('0x25')](_0x55ec91,function(_0x5dcfce){if(_0x5dcfce[_0x0b6b('0x27')]!==_0x0b6b('0x37')){var _0x3f98d9={};_0x3f98d9[_0x5dcfce[_0x0b6b('0x22')]]={'$like':'%'+_0x21060d[_0x0b6b('0x2a')][_0x0b6b('0x38')]+'%'};return _0x3f98d9;}})});}_0x12d9d4=_[_0x0b6b('0x36')]({},_0x12d9d4,_0x21060d[_0x0b6b('0x39')]);var _0x2a3bc3={'where':_0x12d9d4['where']};return db['CmHopperHistory'][_0x0b6b('0x17')](_0x2a3bc3)[_0x0b6b('0x1e')](function(_0x2aa530){_0x3e3909[_0x0b6b('0x17')]=_0x2aa530;if(_0x21060d[_0x0b6b('0x2a')][_0x0b6b('0x3a')]){_0x12d9d4[_0x0b6b('0x3b')]=[{'all':!![]}];}return db[_0x0b6b('0x3c')][_0x0b6b('0x3d')](_0x12d9d4);})[_0x0b6b('0x1e')](function(_0x2ee9fc){_0x3e3909[_0x0b6b('0x3e')]=_0x2ee9fc;return _0x3e3909;})[_0x0b6b('0x1e')](respondWithFilteredResult(_0x5c6c56,_0x12d9d4))['catch'](handleError(_0x5c6c56,null));};exports[_0x0b6b('0x3f')]=function(_0x411e2d,_0x5c5e9d){var _0x43c8c1={'raw':!![],'where':{'id':_0x411e2d[_0x0b6b('0x40')]['id']}},_0x34423b={};_0x34423b[_0x0b6b('0x29')]=_[_0x0b6b('0x41')](db[_0x0b6b('0x3c')][_0x0b6b('0x26')]);_0x34423b['query']=_[_0x0b6b('0x41')](_0x411e2d[_0x0b6b('0x2a')]);_0x34423b[_0x0b6b('0x2b')]=_[_0x0b6b('0x2c')](_0x34423b[_0x0b6b('0x29')],_0x34423b[_0x0b6b('0x2a')]);_0x43c8c1[_0x0b6b('0x2d')]=_[_0x0b6b('0x2c')](_0x34423b[_0x0b6b('0x29')],qs[_0x0b6b('0x2e')](_0x411e2d[_0x0b6b('0x2a')]['fields']));_0x43c8c1[_0x0b6b('0x2d')]=_0x43c8c1[_0x0b6b('0x2d')][_0x0b6b('0x2f')]?_0x43c8c1[_0x0b6b('0x2d')]:_0x34423b[_0x0b6b('0x29')];if(_0x411e2d[_0x0b6b('0x2a')][_0x0b6b('0x3a')]){_0x43c8c1[_0x0b6b('0x3b')]=[{'all':!![]}];}_0x43c8c1=_[_0x0b6b('0x36')]({},_0x43c8c1,_0x411e2d['options']);return db['CmHopperHistory'][_0x0b6b('0x42')](_0x43c8c1)[_0x0b6b('0x1e')](handleEntityNotFound(_0x5c5e9d,null))['then'](respondWithResult(_0x5c5e9d,null))[_0x0b6b('0x43')](handleError(_0x5c5e9d,null));};exports[_0x0b6b('0x44')]=function(_0x487c3c,_0x174842){return db['CmHopperHistory']['create'](_0x487c3c[_0x0b6b('0x45')],{})[_0x0b6b('0x1e')](respondWithResult(_0x174842,0xc9))[_0x0b6b('0x43')](handleError(_0x174842,null));};exports['describe']=function(_0x2b7e5c,_0x7a42b7){return db['CmHopperHistory'][_0x0b6b('0x46')]()[_0x0b6b('0x1e')](respondWithResult(_0x7a42b7,null))[_0x0b6b('0x43')](handleError(_0x7a42b7,null));};exports[_0x0b6b('0x1d')]=function(_0x417dd4,_0x5054d6){if(_0x417dd4[_0x0b6b('0x45')][_0x0b6b('0x47')]){delete _0x417dd4['body'][_0x0b6b('0x47')];}return db[_0x0b6b('0x3c')][_0x0b6b('0x42')]({'where':{'uniqueid':_0x417dd4['params']['id']}})[_0x0b6b('0x1e')](handleEntityNotFound(_0x5054d6,null))[_0x0b6b('0x1e')](saveUpdates(_0x417dd4[_0x0b6b('0x45')],null))[_0x0b6b('0x1e')](respondWithResult(_0x5054d6,null))[_0x0b6b('0x43')](handleError(_0x5054d6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 604a5bd..2a23332 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 _0xf9e5=['request-promise','rimraf','../../config/environment','exports','define','CmHopperHistory','endtime','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x211182,_0x551948){var _0x33f194=function(_0x355896){while(--_0x355896){_0x211182['push'](_0x211182['shift']());}};_0x33f194(++_0x551948);}(_0xf9e5,0x89));var _0x5f9e=function(_0x51f74c,_0x294369){_0x51f74c=_0x51f74c-0x0;var _0x13d4de=_0xf9e5[_0x51f74c];return _0x13d4de;};'use strict';var _=require(_0x5f9e('0x0'));var util=require(_0x5f9e('0x1'));var logger=require(_0x5f9e('0x2'))(_0x5f9e('0x3'));var moment=require(_0x5f9e('0x4'));var BPromise=require(_0x5f9e('0x5'));var rp=require(_0x5f9e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f9e('0x7'));var config=require(_0x5f9e('0x8'));var attributes=require('./cmHopperHistory.attributes');module[_0x5f9e('0x9')]=function(_0x4c3209,_0x5d1f10){return _0x4c3209[_0x5f9e('0xa')](_0x5f9e('0xb'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x5f9e('0xc'),'fields':[_0x5f9e('0xc')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3024=['uniqueid','lodash','util','api','moment','path','../../config/environment','./cmHopperHistory.attributes','CmHopperHistory','cm_hopper_history','endtime'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0x3024,0x64));var _0x4302=function(_0x524d04,_0x220c52){_0x524d04=_0x524d04-0x0;var _0x3fd4eb=_0x3024[_0x524d04];return _0x3fd4eb;};'use strict';var _=require(_0x4302('0x0'));var util=require(_0x4302('0x1'));var logger=require('../../config/logger')(_0x4302('0x2'));var moment=require(_0x4302('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4302('0x4'));var rimraf=require('rimraf');var config=require(_0x4302('0x5'));var attributes=require(_0x4302('0x6'));module['exports']=function(_0x13d051,_0x5f20){return _0x13d051['define'](_0x4302('0x7'),attributes,{'tableName':_0x4302('0x8'),'paranoid':![],'indexes':[{'name':_0x4302('0x9'),'fields':[_0x4302('0x9')]},{'name':_0x4302('0xa'),'fields':[_0x4302('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 35930eb..f8f1ea0 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 _0x9bb4=['request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','then','findAll','raw','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','AvgHandleTime','stringify','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','debug','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','CmHopperHistory,\x20%s,\x20%s'];(function(_0x421c77,_0x31e9b9){var _0x1296f3=function(_0x239d4c){while(--_0x239d4c){_0x421c77['push'](_0x421c77['shift']());}};_0x1296f3(++_0x31e9b9);}(_0x9bb4,0xd5));var _0x49bb=function(_0x4e7ea8,_0x2e208c){_0x4e7ea8=_0x4e7ea8-0x0;var _0x5d9cd1=_0x9bb4[_0x4e7ea8];return _0x5d9cd1;};'use strict';var _=require(_0x49bb('0x0'));var util=require(_0x49bb('0x1'));var moment=require(_0x49bb('0x2'));var BPromise=require(_0x49bb('0x3'));var rs=require(_0x49bb('0x4'));var fs=require('fs');var Redis=require(_0x49bb('0x5'));var db=require(_0x49bb('0x6'))['db'];var utils=require(_0x49bb('0x7'));var logger=require(_0x49bb('0x8'))('rpc');var config=require(_0x49bb('0x9'));var jayson=require(_0x49bb('0xa'));var client=jayson[_0x49bb('0xb')][_0x49bb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d603d,_0x15c24c,_0x353853){return new BPromise(function(_0x1a4094,_0x2967d4){return client[_0x49bb('0xd')](_0x4d603d,_0x353853)['then'](function(_0x6ba4a2){logger['info'](_0x49bb('0xe'),_0x15c24c,_0x49bb('0xf'));logger['debug'](_0x49bb('0x10'),_0x15c24c,'request\x20sent',JSON['stringify'](_0x6ba4a2));if(_0x6ba4a2[_0x49bb('0x11')]){if(_0x6ba4a2['error'][_0x49bb('0x12')]===0x1f4){logger[_0x49bb('0x11')](_0x49bb('0xe'),_0x15c24c,_0x6ba4a2[_0x49bb('0x11')][_0x49bb('0x13')]);return _0x2967d4(_0x6ba4a2[_0x49bb('0x11')][_0x49bb('0x13')]);}logger[_0x49bb('0x11')](_0x49bb('0xe'),_0x15c24c,_0x6ba4a2['error'][_0x49bb('0x13')]);return _0x1a4094(_0x6ba4a2['error'][_0x49bb('0x13')]);}else{logger[_0x49bb('0x14')](_0x49bb('0xe'),_0x15c24c,_0x49bb('0xf'));_0x1a4094(_0x6ba4a2[_0x49bb('0x15')][_0x49bb('0x13')]);}})[_0x49bb('0x16')](function(_0x11bc5f){logger['error'](_0x49bb('0xe'),_0x15c24c,_0x11bc5f);_0x2967d4(_0x11bc5f);});});}exports[_0x49bb('0x17')]=function(_0x5b45c0){var _0x2cb8de=this;return new Promise(function(_0x3d41f2,_0x554fbb){return db[_0x49bb('0x18')][_0x49bb('0x19')](_0x5b45c0['body'],{'raw':_0x5b45c0[_0x49bb('0x1a')]?_0x5b45c0[_0x49bb('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x49bb('0x1b')](function(_0x5387ed){logger[_0x49bb('0x14')]('CreateCmHopperHistory',_0x5b45c0);logger['debug'](_0x49bb('0x17'),_0x5b45c0,JSON['stringify'](_0x5387ed));_0x3d41f2(_0x5387ed);})['catch'](function(_0x16b8fa){logger[_0x49bb('0x11')](_0x49bb('0x17'),_0x16b8fa[_0x49bb('0x13')],_0x5b45c0);_0x554fbb(_0x2cb8de['error'](0x1f4,_0x16b8fa['message']));});});};exports['AvgHandleTime']=function(_0x4eae24){var _0x5f5625=this;return new Promise(function(_0xe9938a,_0x570847){return db['CmHopperHistory'][_0x49bb('0x1c')]({'raw':_0x4eae24[_0x49bb('0x1a')]?_0x4eae24[_0x49bb('0x1a')][_0x49bb('0x1d')]===undefined?!![]:![]:!![],'where':_0x4eae24[_0x49bb('0x1a')]?_0x4eae24['options'][_0x49bb('0x1e')]||null:null,'attributes':[[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['col']('id')),_0x49bb('0x21')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db['sequelize'][_0x49bb('0x22')](_0x49bb('0x23')))),_0x49bb('0x24')],[db[_0x49bb('0x1f')]['fn']('COUNT',db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')]['literal'](_0x49bb('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db['sequelize']['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')]('`state`\x20=\x2011,\x201,\x20null'))),_0x49bb('0x26')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x27'),db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')](_0x49bb('0x28')))),_0x49bb('0x29')],[db['sequelize']['fn'](_0x49bb('0x27'),db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x49bb('0x2a')]]})['then'](function(_0x182aa0){logger['info'](_0x49bb('0x2b'),_0x4eae24);logger['debug'](_0x49bb('0x2b'),_0x4eae24,JSON[_0x49bb('0x2c')](_0x182aa0));_0xe9938a(_0x182aa0);})['catch'](function(_0x56139c){logger['error']('AvgHandleTime',_0x56139c['message'],_0x4eae24);_0x570847(_0x5f5625[_0x49bb('0x11')](0x1f4,_0x56139c[_0x49bb('0x13')]));});});};exports[_0x49bb('0x2d')]=function(_0x2b9680){var _0x203e6d=this;return new Promise(function(_0x2784a9,_0x1025c5){return db['CmHopperHistory']['findAll']({'raw':_0x2b9680[_0x49bb('0x1a')]?_0x2b9680[_0x49bb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2b9680[_0x49bb('0x1a')]?_0x2b9680[_0x49bb('0x1a')]['where']||null:null,'attributes':[['campaign',_0x49bb('0x2e')],[db['sequelize']['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')](_0x49bb('0x2f')))),_0x49bb('0x30')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')](_0x49bb('0x31')))),_0x49bb('0x32')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')](_0x49bb('0x23')))),_0x49bb('0x33')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db['sequelize'][_0x49bb('0x22')]('`state`\x20=\x205,\x201,\x20null'))),_0x49bb('0x34')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')]['literal'](_0x49bb('0x35')))),_0x49bb('0x36')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db['sequelize'][_0x49bb('0x22')](_0x49bb('0x37')))),_0x49bb('0x38')],[db[_0x49bb('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')](_0x49bb('0x39')))),_0x49bb('0x3a')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db['sequelize']['fn']('IF',db[_0x49bb('0x1f')]['literal'](_0x49bb('0x3b')))),_0x49bb('0x3c')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x49bb('0x22')](_0x49bb('0x3d')))),_0x49bb('0x3e')],[db[_0x49bb('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')](_0x49bb('0x3f')))),_0x49bb('0x40')],[db['sequelize']['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db['sequelize'][_0x49bb('0x22')](_0x49bb('0x41')))),_0x49bb('0x42')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db['sequelize']['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')](_0x49bb('0x43')))),'outboundAnswerAgiCallsDay'],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')]('`state`\x20=\x2020,\x201,\x20null'))),_0x49bb('0x42')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db[_0x49bb('0x1f')][_0x49bb('0x22')](_0x49bb('0x44')))),_0x49bb('0x45')]],'group':[_0x49bb('0x46')]})[_0x49bb('0x1b')](function(_0x2ead0f){logger['info'](_0x49bb('0x2d'),_0x2b9680);logger[_0x49bb('0x47')](_0x49bb('0x2d'),_0x2b9680,JSON[_0x49bb('0x2c')](_0x2ead0f));_0x2784a9(_0x2ead0f);})[_0x49bb('0x16')](function(_0x3fc2f1){logger[_0x49bb('0x11')](_0x49bb('0x2d'),_0x3fc2f1[_0x49bb('0x13')],_0x2b9680);_0x1025c5(_0x203e6d[_0x49bb('0x11')](0x1f4,_0x3fc2f1[_0x49bb('0x13')]));});});};exports[_0x49bb('0x48')]=function(_0x36ccc2){var _0x72569b=this;return new Promise(function(_0xec9667,_0x386bff){return db[_0x49bb('0x18')][_0x49bb('0x1c')]({'raw':_0x36ccc2[_0x49bb('0x1a')]?_0x36ccc2[_0x49bb('0x1a')][_0x49bb('0x1d')]===undefined?!![]:![]:!![],'where':_0x36ccc2[_0x49bb('0x1a')]?_0x36ccc2[_0x49bb('0x1a')]['where']||null:null,'attributes':[[_0x49bb('0x46'),_0x49bb('0x2e')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')][_0x49bb('0x49')]('id')),_0x49bb('0x4a')],[db[_0x49bb('0x1f')]['fn'](_0x49bb('0x20'),db[_0x49bb('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x49bb('0x4b')]],'group':['campaign']})[_0x49bb('0x1b')](function(_0x2630a7){logger[_0x49bb('0x14')](_0x49bb('0x48'),_0x36ccc2);logger[_0x49bb('0x47')](_0x49bb('0x48'),_0x36ccc2,JSON[_0x49bb('0x2c')](_0x2630a7));_0xec9667(_0x2630a7);})[_0x49bb('0x16')](function(_0x5e5aad){logger[_0x49bb('0x11')](_0x49bb('0x48'),_0x5e5aad[_0x49bb('0x13')],_0x36ccc2);_0x386bff(_0x72569b[_0x49bb('0x11')](0x1f4,_0x5e5aad[_0x49bb('0x13')]));});});}; \ No newline at end of file +var _0x95c5=['options','raw','stringify','AvgHandleTime','where','sequelize','COUNT','col','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','catch','campaign','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','findAll','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','body'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x95c5,0x153));var _0x595c=function(_0x5d61b4,_0x4f7b91){_0x5d61b4=_0x5d61b4-0x0;var _0x183fc5=_0x95c5[_0x5d61b4];return _0x183fc5;};'use strict';var _=require(_0x595c('0x0'));var util=require(_0x595c('0x1'));var moment=require('moment');var BPromise=require(_0x595c('0x2'));var rs=require(_0x595c('0x3'));var fs=require('fs');var Redis=require(_0x595c('0x4'));var db=require(_0x595c('0x5'))['db'];var utils=require(_0x595c('0x6'));var logger=require(_0x595c('0x7'))(_0x595c('0x8'));var config=require(_0x595c('0x9'));var jayson=require(_0x595c('0xa'));var client=jayson[_0x595c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49a115,_0xc9f937,_0xfcaf47){return new BPromise(function(_0x218eca,_0x3b55ad){return client[_0x595c('0xc')](_0x49a115,_0xfcaf47)[_0x595c('0xd')](function(_0x1250e7){logger[_0x595c('0xe')](_0x595c('0xf'),_0xc9f937,'request\x20sent');logger[_0x595c('0x10')](_0x595c('0x11'),_0xc9f937,_0x595c('0x12'),JSON['stringify'](_0x1250e7));if(_0x1250e7[_0x595c('0x13')]){if(_0x1250e7[_0x595c('0x13')][_0x595c('0x14')]===0x1f4){logger[_0x595c('0x13')](_0x595c('0xf'),_0xc9f937,_0x1250e7[_0x595c('0x13')][_0x595c('0x15')]);return _0x3b55ad(_0x1250e7[_0x595c('0x13')][_0x595c('0x15')]);}logger[_0x595c('0x13')](_0x595c('0xf'),_0xc9f937,_0x1250e7[_0x595c('0x13')][_0x595c('0x15')]);return _0x218eca(_0x1250e7[_0x595c('0x13')]['message']);}else{logger[_0x595c('0xe')](_0x595c('0xf'),_0xc9f937,_0x595c('0x12'));_0x218eca(_0x1250e7[_0x595c('0x16')]['message']);}})['catch'](function(_0x3a2a04){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0xc9f937,_0x3a2a04);_0x3b55ad(_0x3a2a04);});});}exports[_0x595c('0x17')]=function(_0xe45721){var _0xe7cf1e=this;return new Promise(function(_0x4f9936,_0x66c9fb){return db[_0x595c('0x18')]['create'](_0xe45721[_0x595c('0x19')],{'raw':_0xe45721[_0x595c('0x1a')]?_0xe45721[_0x595c('0x1a')][_0x595c('0x1b')]===undefined?!![]:![]:!![]})[_0x595c('0xd')](function(_0x3195b8){logger[_0x595c('0xe')](_0x595c('0x17'),_0xe45721);logger[_0x595c('0x10')]('CreateCmHopperHistory',_0xe45721,JSON[_0x595c('0x1c')](_0x3195b8));_0x4f9936(_0x3195b8);})['catch'](function(_0x378eaf){logger[_0x595c('0x13')](_0x595c('0x17'),_0x378eaf[_0x595c('0x15')],_0xe45721);_0x66c9fb(_0xe7cf1e[_0x595c('0x13')](0x1f4,_0x378eaf[_0x595c('0x15')]));});});};exports[_0x595c('0x1d')]=function(_0x1eb0ff){var _0x53ed36=this;return new Promise(function(_0x458cb6,_0x58178e){return db[_0x595c('0x18')]['findAll']({'raw':_0x1eb0ff[_0x595c('0x1a')]?_0x1eb0ff[_0x595c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1eb0ff[_0x595c('0x1a')]?_0x1eb0ff[_0x595c('0x1a')][_0x595c('0x1e')]||null:null,'attributes':[[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')][_0x595c('0x21')]('id')),'predictiveIntervalTotalCalls'],[db[_0x595c('0x1f')]['fn']('COUNT',db[_0x595c('0x1f')]['fn']('IF',db['sequelize'][_0x595c('0x22')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x23')))),_0x595c('0x24')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x595c('0x25')))),_0x595c('0x26')],[db[_0x595c('0x1f')]['fn']('AVG',db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x27')))),_0x595c('0x28')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x29'),db['sequelize']['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x2a')))),'predictiveIntervalAvgTalktime']]})[_0x595c('0xd')](function(_0x432ea4){logger['info']('AvgHandleTime',_0x1eb0ff);logger[_0x595c('0x10')](_0x595c('0x1d'),_0x1eb0ff,JSON[_0x595c('0x1c')](_0x432ea4));_0x458cb6(_0x432ea4);})[_0x595c('0x2b')](function(_0x34bc34){logger[_0x595c('0x13')]('AvgHandleTime',_0x34bc34[_0x595c('0x15')],_0x1eb0ff);_0x58178e(_0x53ed36[_0x595c('0x13')](0x1f4,_0x34bc34['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x36af22){var _0x32dae5=this;return new Promise(function(_0x10571c,_0x2be239){return db[_0x595c('0x18')]['findAll']({'raw':_0x36af22[_0x595c('0x1a')]?_0x36af22[_0x595c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x36af22[_0x595c('0x1a')]?_0x36af22['options'][_0x595c('0x1e')]||null:null,'attributes':[[_0x595c('0x2c'),'name'],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db['sequelize'][_0x595c('0x22')]('`state`\x20=\x200,\x201,\x20null'))),_0x595c('0x2d')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0x595c('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x2f')))),_0x595c('0x30')],[db['sequelize']['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x31')))),_0x595c('0x32')],[db['sequelize']['fn']('COUNT',db[_0x595c('0x1f')]['fn']('IF',db['sequelize'][_0x595c('0x22')](_0x595c('0x33')))),_0x595c('0x34')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x595c('0x35')))),_0x595c('0x36')],[db[_0x595c('0x1f')]['fn']('COUNT',db[_0x595c('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x595c('0x37')))),'outboundDropCallsDayCallersExit'],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db['sequelize']['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x38')))),'outboundUnknownCallsDay'],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db['sequelize']['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x595c('0x39')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db['sequelize'][_0x595c('0x22')](_0x595c('0x3a')))),_0x595c('0x3b')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x3c')))),_0x595c('0x3d')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x3e')))),_0x595c('0x3f')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x40')))),_0x595c('0x3d')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x41')))),_0x595c('0x42')]],'group':[_0x595c('0x2c')]})['then'](function(_0x35a292){logger[_0x595c('0xe')]('GetVoiceQueueHopperHistory',_0x36af22);logger[_0x595c('0x10')]('GetVoiceQueueHopperHistory',_0x36af22,JSON['stringify'](_0x35a292));_0x10571c(_0x35a292);})[_0x595c('0x2b')](function(_0x1d1b03){logger[_0x595c('0x13')](_0x595c('0x43'),_0x1d1b03[_0x595c('0x15')],_0x36af22);_0x2be239(_0x32dae5[_0x595c('0x13')](0x1f4,_0x1d1b03['message']));});});};exports[_0x595c('0x44')]=function(_0x23597a){var _0x92d2dd=this;return new Promise(function(_0x554960,_0x2b8243){return db['CmHopperHistory'][_0x595c('0x45')]({'raw':_0x23597a[_0x595c('0x1a')]?_0x23597a[_0x595c('0x1a')][_0x595c('0x1b')]===undefined?!![]:![]:!![],'where':_0x23597a[_0x595c('0x1a')]?_0x23597a[_0x595c('0x1a')]['where']||null:null,'attributes':[[_0x595c('0x2c'),_0x595c('0x46')],[db['sequelize']['fn'](_0x595c('0x20'),db[_0x595c('0x1f')][_0x595c('0x21')]('id')),_0x595c('0x47')],[db['sequelize']['fn']('COUNT',db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x2f')))),_0x595c('0x48')]],'group':[_0x595c('0x2c')]})[_0x595c('0xd')](function(_0x569f8b){logger[_0x595c('0xe')](_0x595c('0x44'),_0x23597a);logger['debug'](_0x595c('0x44'),_0x23597a,JSON['stringify'](_0x569f8b));_0x554960(_0x569f8b);})[_0x595c('0x2b')](function(_0x5272d4){logger[_0x595c('0x13')](_0x595c('0x44'),_0x5272d4['message'],_0x23597a);_0x2b8243(_0x92d2dd[_0x595c('0x13')](0x1f4,_0x5272d4[_0x595c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index f079845..5fb32ef 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 _0x5b1c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','post','create','put','/:id','update','exports'];(function(_0x203569,_0x5cfc79){var _0x2c9216=function(_0x12d5dc){while(--_0x12d5dc){_0x203569['push'](_0x203569['shift']());}};_0x2c9216(++_0x5cfc79);}(_0x5b1c,0x118));var _0xc5b1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5b1c[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xc5b1('0x0'));var util=require(_0xc5b1('0x1'));var path=require(_0xc5b1('0x2'));var timeout=require(_0xc5b1('0x3'));var express=require(_0xc5b1('0x4'));var router=express[_0xc5b1('0x5')]();var fs_extra=require(_0xc5b1('0x6'));var auth=require(_0xc5b1('0x7'));var interaction=require(_0xc5b1('0x8'));var config=require('../../config/environment');var controller=require(_0xc5b1('0x9'));router[_0xc5b1('0xa')]('/',auth[_0xc5b1('0xb')](),controller[_0xc5b1('0xc')]);router[_0xc5b1('0xa')](_0xc5b1('0xd'),auth[_0xc5b1('0xb')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc5b1('0xe')]('/',auth[_0xc5b1('0xb')](),controller[_0xc5b1('0xf')]);router[_0xc5b1('0x10')](_0xc5b1('0x11'),auth['isAuthenticated'](),controller[_0xc5b1('0x12')]);module[_0xc5b1('0x13')]=router; \ No newline at end of file +var _0x068d=['show','post','put','update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','/:id'];(function(_0x49c957,_0x3509d8){var _0x5b1d38=function(_0x219976){while(--_0x219976){_0x49c957['push'](_0x49c957['shift']());}};_0x5b1d38(++_0x3509d8);}(_0x068d,0x1f4));var _0xd068=function(_0x4cfdcd,_0x2d31ad){_0x4cfdcd=_0x4cfdcd-0x0;var _0xdd959b=_0x068d[_0x4cfdcd];return _0xdd959b;};'use strict';var multer=require(_0xd068('0x0'));var util=require('util');var path=require(_0xd068('0x1'));var timeout=require(_0xd068('0x2'));var express=require('express');var router=express[_0xd068('0x3')]();var fs_extra=require(_0xd068('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd068('0x5'));var config=require('../../config/environment');var controller=require(_0xd068('0x6'));router[_0xd068('0x7')]('/',auth[_0xd068('0x8')](),controller['index']);router[_0xd068('0x7')]('/describe',auth[_0xd068('0x8')](),controller['describe']);router[_0xd068('0x7')](_0xd068('0x9'),auth['isAuthenticated'](),controller[_0xd068('0xa')]);router[_0xd068('0xb')]('/',auth[_0xd068('0x8')](),controller['create']);router[_0xd068('0xc')](_0xd068('0x9'),auth['isAuthenticated'](),controller[_0xd068('0xd')]);module[_0xd068('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index fe47059..9b96cd3 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 _0x0763=['sequelize','STRING','name'];(function(_0x34d343,_0x1f5141){var _0x4f1e20=function(_0x35b8eb){while(--_0x35b8eb){_0x34d343['push'](_0x34d343['shift']());}};_0x4f1e20(++_0x1f5141);}(_0x0763,0x87));var _0x3076=function(_0x6978c0,_0x1f6765){_0x6978c0=_0x6978c0-0x0;var _0x361377=_0x0763[_0x6978c0];return _0x361377;};'use strict';var Sequelize=require(_0x3076('0x0'));module['exports']={'name':{'type':Sequelize[_0x3076('0x1')],'unique':_0x3076('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x3076('0x1')]}}; \ No newline at end of file +var _0x1134=['sequelize','exports','name','STRING'];(function(_0x27f614,_0x2b0fdc){var _0x533fe0=function(_0x2f42f5){while(--_0x2f42f5){_0x27f614['push'](_0x27f614['shift']());}};_0x533fe0(++_0x2b0fdc);}(_0x1134,0x19c));var _0x4113=function(_0x2d5c59,_0x1e0bc1){_0x2d5c59=_0x2d5c59-0x0;var _0x30ac80=_0x1134[_0x2d5c59];return _0x30ac80;};'use strict';var Sequelize=require(_0x4113('0x0'));module[_0x4113('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4113('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4113('0x3')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 4d66d7d..6e5594b 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 _0xc914=['model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','params','rawAttributes','length','find','catch','create','body','user','role','Lists','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','Disposition','getDispositions','findOne','hasOwnProperty','ListId','removeDispositions','ids','CmContact','isArray','tags','join','each','success','dataValues','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','CmCustomField','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./cmList.socket','register','sendStatus','status','end','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','get','error','name','map','CmList','type','key'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0xc914,0x173));var _0x4c91=function(_0x4caefc,_0x4f667c){_0x4caefc=_0x4caefc-0x0;var _0x35fd5f=_0xc914[_0x4caefc];return _0x35fd5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c91('0x0'));var zipdir=require(_0x4c91('0x1'));var jsonpatch=require(_0x4c91('0x2'));var rp=require(_0x4c91('0x3'));var moment=require(_0x4c91('0x4'));var BPromise=require(_0x4c91('0x5'));var Mustache=require('mustache');var util=require(_0x4c91('0x6'));var path=require('path');var sox=require(_0x4c91('0x7'));var csv=require('to-csv');var ejs=require(_0x4c91('0x8'));var fs=require('fs');var fs_extra=require(_0x4c91('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4c91('0xa'));var jsforce=require(_0x4c91('0xb'));var deskjs=require(_0x4c91('0xc'));var toCsv=require(_0x4c91('0xd'));var querystring=require(_0x4c91('0xe'));var Papa=require(_0x4c91('0xf'));var Redis=require(_0x4c91('0x10'));var authService=require(_0x4c91('0x11'));var qs=require(_0x4c91('0x12'));var as=require(_0x4c91('0x13'));var hardwareService=require(_0x4c91('0x14'));var logger=require(_0x4c91('0x15'))(_0x4c91('0x16'));var utils=require('../../config/utils');var config=require(_0x4c91('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4c91('0x18'))['db'];config['redis']=_[_0x4c91('0x19')](config['redis'],{'host':_0x4c91('0x1a'),'port':0x18eb});var socket=require(_0x4c91('0x1b'))(new Redis(config[_0x4c91('0x1c')]));require(_0x4c91('0x1d'))[_0x4c91('0x1e')](socket);function respondWithStatusCode(_0x321570,_0x3b083a){_0x3b083a=_0x3b083a||0xcc;return function(_0x5e1834){if(_0x5e1834){return _0x321570[_0x4c91('0x1f')](_0x3b083a);}return _0x321570[_0x4c91('0x20')](_0x3b083a)[_0x4c91('0x21')]();};}function respondWithResult(_0x36105e,_0x57d876){_0x57d876=_0x57d876||0xc8;return function(_0xc82253){if(_0xc82253){return _0x36105e[_0x4c91('0x20')](_0x57d876)['json'](_0xc82253);}};}function respondWithFilteredResult(_0x1fb7c1,_0x5dbc45){return function(_0xf1d8){if(_0xf1d8){var _0x38411d=typeof _0x5dbc45['offset']==='undefined'&&typeof _0x5dbc45[_0x4c91('0x22')]==='undefined';var _0x217531=_0xf1d8[_0x4c91('0x23')];var _0x52f324=_0x38411d?0x0:_0x5dbc45[_0x4c91('0x24')];var _0x6e6a66=_0x38411d?_0xf1d8['count']:_0x5dbc45[_0x4c91('0x24')]+_0x5dbc45[_0x4c91('0x22')];var _0x3ebd59;if(_0x6e6a66>=_0x217531){_0x6e6a66=_0x217531;_0x3ebd59=0xc8;}else{_0x3ebd59=0xce;}_0x1fb7c1[_0x4c91('0x20')](_0x3ebd59);return _0x1fb7c1[_0x4c91('0x25')](_0x4c91('0x26'),_0x52f324+'-'+_0x6e6a66+'/'+_0x217531)[_0x4c91('0x27')](_0xf1d8);}return null;};}function patchUpdates(_0x3fac3b){return function(_0x3a833c){try{jsonpatch[_0x4c91('0x28')](_0x3a833c,_0x3fac3b,!![]);}catch(_0x5271b4){return BPromise[_0x4c91('0x29')](_0x5271b4);}return _0x3a833c[_0x4c91('0x2a')]();};}function saveUpdates(_0x23d90b,_0x3dc31f){return function(_0x3a9024){if(_0x3a9024){return _0x3a9024[_0x4c91('0x2b')](_0x23d90b)[_0x4c91('0x2c')](function(_0xb95a0d){return _0xb95a0d;});}return null;};}function removeEntity(_0x30ebb2,_0x37ab47){return function(_0x1fd1ce){if(_0x1fd1ce){return _0x1fd1ce['destroy']()[_0x4c91('0x2c')](function(){var _0xd72464=_0x1fd1ce[_0x4c91('0x2d')]({'plain':!![]});var _0x52504d='Lists';return db['UserProfileResource']['destroy']({'where':{'type':_0x52504d,'resourceId':_0xd72464['id']}})[_0x4c91('0x2c')](function(){return _0x1fd1ce;});})[_0x4c91('0x2c')](function(){_0x30ebb2['status'](0xcc)[_0x4c91('0x21')]();});}};}function handleEntityNotFound(_0x3e2634,_0x5c29c4){return function(_0x3439b7){if(!_0x3439b7){_0x3e2634[_0x4c91('0x1f')](0x194);}return _0x3439b7;};}function handleError(_0x4f5b24,_0x36fef4){_0x36fef4=_0x36fef4||0x1f4;return function(_0x54950c){logger[_0x4c91('0x2e')](_0x54950c['stack']);if(_0x54950c[_0x4c91('0x2f')]){delete _0x54950c[_0x4c91('0x2f')];}_0x4f5b24[_0x4c91('0x20')](_0x36fef4)['send'](_0x54950c);};}exports['index']=function(_0x3aa880,_0x4973f2){var _0x896a20={},_0x34fff3={},_0x15b3f7={'count':0x0,'rows':[]};var _0x5ad1f8=_[_0x4c91('0x30')](db[_0x4c91('0x31')]['rawAttributes'],function(_0x5bc72e){return{'name':_0x5bc72e['fieldName'],'type':_0x5bc72e[_0x4c91('0x32')][_0x4c91('0x33')]};});_0x34fff3[_0x4c91('0x34')]=_['map'](_0x5ad1f8,'name');_0x34fff3['query']=_[_0x4c91('0x35')](_0x3aa880[_0x4c91('0x36')]);_0x34fff3['filters']=_[_0x4c91('0x37')](_0x34fff3[_0x4c91('0x34')],_0x34fff3[_0x4c91('0x36')]);_0x896a20[_0x4c91('0x38')]=_[_0x4c91('0x37')](_0x34fff3[_0x4c91('0x34')],qs[_0x4c91('0x39')](_0x3aa880[_0x4c91('0x36')]['fields']));_0x896a20['attributes']=_0x896a20[_0x4c91('0x38')]['length']?_0x896a20[_0x4c91('0x38')]:_0x34fff3[_0x4c91('0x34')];if(!_0x3aa880['query']['hasOwnProperty'](_0x4c91('0x3a'))){_0x896a20[_0x4c91('0x22')]=qs[_0x4c91('0x22')](_0x3aa880[_0x4c91('0x36')]['limit']);_0x896a20[_0x4c91('0x24')]=qs['offset'](_0x3aa880[_0x4c91('0x36')][_0x4c91('0x24')]);}_0x896a20[_0x4c91('0x3b')]=qs[_0x4c91('0x3c')](_0x3aa880['query'][_0x4c91('0x3c')]);_0x896a20[_0x4c91('0x3d')]=qs[_0x4c91('0x3e')](_[_0x4c91('0x3f')](_0x3aa880[_0x4c91('0x36')],_0x34fff3['filters']),_0x5ad1f8);if(_0x3aa880[_0x4c91('0x36')][_0x4c91('0x40')]){_0x896a20[_0x4c91('0x3d')]=_[_0x4c91('0x41')](_0x896a20['where'],{'$or':_[_0x4c91('0x30')](_0x5ad1f8,function(_0x1bea0d){if(_0x1bea0d[_0x4c91('0x32')]!=='VIRTUAL'){var _0x243035={};_0x243035[_0x1bea0d[_0x4c91('0x2f')]]={'$like':'%'+_0x3aa880['query'][_0x4c91('0x40')]+'%'};return _0x243035;}})});}_0x896a20=_[_0x4c91('0x41')]({},_0x896a20,_0x3aa880[_0x4c91('0x42')]);var _0x4345f8={'where':_0x896a20[_0x4c91('0x3d')]};return db['CmList']['count'](_0x4345f8)[_0x4c91('0x2c')](function(_0xeb4ba9){_0x15b3f7['count']=_0xeb4ba9;if(_0x3aa880[_0x4c91('0x36')][_0x4c91('0x43')]){_0x896a20[_0x4c91('0x44')]=[{'all':!![]}];}return db[_0x4c91('0x31')][_0x4c91('0x45')](_0x896a20);})[_0x4c91('0x2c')](function(_0x82cbb6){_0x15b3f7[_0x4c91('0x46')]=_0x82cbb6;return _0x15b3f7;})[_0x4c91('0x2c')](respondWithFilteredResult(_0x4973f2,_0x896a20))['catch'](handleError(_0x4973f2,null));};exports['show']=function(_0x362cca,_0x575452){var _0x1f9986={'raw':![],'where':{'id':_0x362cca[_0x4c91('0x47')]['id']}},_0x4a3520={};_0x4a3520[_0x4c91('0x34')]=_['keys'](db[_0x4c91('0x31')][_0x4c91('0x48')]);_0x4a3520[_0x4c91('0x36')]=_[_0x4c91('0x35')](_0x362cca[_0x4c91('0x36')]);_0x4a3520[_0x4c91('0x3e')]=_[_0x4c91('0x37')](_0x4a3520[_0x4c91('0x34')],_0x4a3520['query']);_0x1f9986['attributes']=_[_0x4c91('0x37')](_0x4a3520['model'],qs['fields'](_0x362cca[_0x4c91('0x36')][_0x4c91('0x39')]));_0x1f9986[_0x4c91('0x38')]=_0x1f9986[_0x4c91('0x38')][_0x4c91('0x49')]?_0x1f9986[_0x4c91('0x38')]:_0x4a3520[_0x4c91('0x34')];if(_0x362cca[_0x4c91('0x36')][_0x4c91('0x43')]){_0x1f9986[_0x4c91('0x44')]=[{'all':!![]}];}_0x1f9986=_['merge']({},_0x1f9986,_0x362cca[_0x4c91('0x42')]);return db[_0x4c91('0x31')][_0x4c91('0x4a')](_0x1f9986)[_0x4c91('0x2c')](handleEntityNotFound(_0x575452,null))[_0x4c91('0x2c')](respondWithResult(_0x575452,null))[_0x4c91('0x4b')](handleError(_0x575452,null));};exports['create']=function(_0x12d5d0,_0x87811e){return db[_0x4c91('0x31')][_0x4c91('0x4c')](_0x12d5d0[_0x4c91('0x4d')],{})[_0x4c91('0x2c')](function(_0x571998){var _0x4db8a3=_0x12d5d0[_0x4c91('0x4e')][_0x4c91('0x2d')]({'plain':!![]});if(!_0x4db8a3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4db8a3[_0x4c91('0x4f')]===_0x4c91('0x4e')){var _0x1f16cf=_0x571998['get']({'plain':!![]});var _0x5a3c28=_0x4c91('0x50');return db[_0x4c91('0x51')]['find']({'where':{'name':_0x5a3c28,'userProfileId':_0x4db8a3[_0x4c91('0x52')]},'raw':!![]})['then'](function(_0x503245){if(_0x503245&&_0x503245['autoAssociation']===0x0){return db[_0x4c91('0x53')][_0x4c91('0x4c')]({'name':_0x1f16cf['name'],'resourceId':_0x1f16cf['id'],'type':_0x503245[_0x4c91('0x2f')],'sectionId':_0x503245['id']},{})[_0x4c91('0x2c')](function(){return _0x571998;});}else{return _0x571998;}})[_0x4c91('0x4b')](function(_0x1e1336){logger['error'](_0x4c91('0x54'),_0x1e1336);throw _0x1e1336;});}return _0x571998;})[_0x4c91('0x2c')](respondWithResult(_0x87811e,0xc9))['catch'](handleError(_0x87811e,null));};exports[_0x4c91('0x2b')]=function(_0x456b4a,_0xe9c6b3){if(_0x456b4a[_0x4c91('0x4d')]['id']){delete _0x456b4a['body']['id'];}return db['CmList']['find']({'where':{'id':_0x456b4a[_0x4c91('0x47')]['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0xe9c6b3,null))['then'](saveUpdates(_0x456b4a['body'],null))[_0x4c91('0x2c')](respondWithResult(_0xe9c6b3,null))[_0x4c91('0x4b')](handleError(_0xe9c6b3,null));};exports[_0x4c91('0x55')]=function(_0x1e5347,_0x37ea04){return db[_0x4c91('0x31')]['find']({'where':{'id':_0x1e5347['params']['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0x37ea04,null))[_0x4c91('0x2c')](removeEntity(_0x37ea04,null))[_0x4c91('0x4b')](handleError(_0x37ea04,null));};exports['describe']=function(_0x5c73e,_0x3519db){return db[_0x4c91('0x31')][_0x4c91('0x56')]()[_0x4c91('0x2c')](respondWithResult(_0x3519db,null))['catch'](handleError(_0x3519db,null));};exports['addDisposition']=function(_0xfb69cd,_0x5de183,_0x53c339){if(_0xfb69cd[_0x4c91('0x4d')]['id']){delete _0xfb69cd[_0x4c91('0x4d')]['id'];}return db[_0x4c91('0x31')][_0x4c91('0x4a')]({'where':{'id':_0xfb69cd[_0x4c91('0x47')]['id']}})['then'](handleEntityNotFound(_0x5de183,null))[_0x4c91('0x2c')](function(_0x25fa2d){if(_0x25fa2d){_0xfb69cd[_0x4c91('0x4d')]['ListId']=_0x25fa2d['id'];return db[_0x4c91('0x57')][_0x4c91('0x4c')](_0xfb69cd[_0x4c91('0x4d')]);}})['then'](respondWithResult(_0x5de183,null))[_0x4c91('0x4b')](handleError(_0x5de183,null));};exports[_0x4c91('0x58')]=function(_0x5cab5e,_0x8c5e19,_0x5a83b8){var _0x30e791={'raw':![],'where':{}};var _0x3826d8={};var _0x1fd022={'count':0x0,'rows':[]};return db['CmList'][_0x4c91('0x59')]({'where':{'id':_0x5cab5e[_0x4c91('0x47')]['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0x8c5e19,null))[_0x4c91('0x2c')](function(_0x5f468c){if(_0x5f468c){_0x3826d8[_0x4c91('0x34')]=_['keys'](db['Disposition']['rawAttributes']);_0x3826d8[_0x4c91('0x36')]=_[_0x4c91('0x35')](_0x5cab5e[_0x4c91('0x36')]);_0x3826d8['filters']=_[_0x4c91('0x37')](_0x3826d8[_0x4c91('0x34')],_0x3826d8['query']);_0x30e791['attributes']=_[_0x4c91('0x37')](_0x3826d8[_0x4c91('0x34')],qs[_0x4c91('0x39')](_0x5cab5e['query'][_0x4c91('0x39')]));_0x30e791[_0x4c91('0x38')]=_0x30e791[_0x4c91('0x38')][_0x4c91('0x49')]?_0x30e791[_0x4c91('0x38')]:_0x3826d8[_0x4c91('0x34')];if(!_0x5cab5e['query'][_0x4c91('0x5a')](_0x4c91('0x3a'))){_0x30e791['limit']=qs['limit'](_0x5cab5e[_0x4c91('0x36')][_0x4c91('0x22')]);_0x30e791[_0x4c91('0x24')]=qs[_0x4c91('0x24')](_0x5cab5e[_0x4c91('0x36')][_0x4c91('0x24')]);}_0x30e791[_0x4c91('0x3b')]=qs['sort'](_0x5cab5e[_0x4c91('0x36')][_0x4c91('0x3c')]);_0x30e791[_0x4c91('0x3d')]=qs['filters'](_[_0x4c91('0x3f')](_0x5cab5e[_0x4c91('0x36')],_0x3826d8['filters']));_0x30e791[_0x4c91('0x3d')][_0x4c91('0x5b')]=_0x5f468c['id'];if(_0x5cab5e[_0x4c91('0x36')]['filter']){_0x30e791[_0x4c91('0x3d')]=_['merge'](_0x30e791['where'],{'$or':_[_0x4c91('0x30')](_0x30e791[_0x4c91('0x38')],function(_0x2c94b4){var _0x29c44c={};_0x29c44c[_0x2c94b4]={'$like':'%'+_0x5cab5e[_0x4c91('0x36')]['filter']+'%'};return _0x29c44c;})});}_0x30e791=_[_0x4c91('0x41')]({},_0x30e791,_0x5cab5e[_0x4c91('0x42')]);return db['Disposition'][_0x4c91('0x23')]({'where':_0x30e791[_0x4c91('0x3d')]})['then'](function(_0x3b862d){_0x1fd022['count']=_0x3b862d;if(_0x5cab5e[_0x4c91('0x36')][_0x4c91('0x43')]){_0x30e791[_0x4c91('0x44')]=[{'all':!![]}];}return db[_0x4c91('0x57')][_0x4c91('0x45')](_0x30e791);})[_0x4c91('0x2c')](function(_0x164ea6){_0x1fd022[_0x4c91('0x46')]=_0x164ea6;return _0x1fd022;});}})[_0x4c91('0x2c')](respondWithFilteredResult(_0x8c5e19,_0x30e791))[_0x4c91('0x4b')](handleError(_0x8c5e19,null));};exports[_0x4c91('0x5c')]=function(_0x4ec5dc,_0x4c98a0,_0x29b940){return db['CmList'][_0x4c91('0x4a')]({'where':{'id':_0x4ec5dc['params']['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0x4c98a0,null))[_0x4c91('0x2c')](function(_0x2a2218){if(_0x2a2218){return _0x2a2218[_0x4c91('0x5c')](_0x4ec5dc['query'][_0x4c91('0x5d')]);}})['then'](respondWithStatusCode(_0x4c98a0,null))[_0x4c91('0x4b')](handleError(_0x4c98a0,null));};exports['addContacts']=function(_0x448847,_0xefd81e,_0x15cd4c){return db[_0x4c91('0x31')][_0x4c91('0x4a')]({'where':{'id':_0x448847[_0x4c91('0x47')]['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0xefd81e,null))[_0x4c91('0x2c')](function(_0x271309){if(_0x271309){var _0x1132d7=[];var _0x583a5f={'success':[],'errors':[]};return db[_0x4c91('0x5e')][_0x4c91('0x56')]()[_0x4c91('0x2c')](function(_0x1638d1){if(_0x448847['body']['tags']&&_[_0x4c91('0x5f')](_0x448847[_0x4c91('0x4d')]['tags'])){if(_0x448847[_0x4c91('0x4d')][_0x4c91('0x60')][_0x4c91('0x49')]){_0x448847[_0x4c91('0x4d')][_0x4c91('0x60')]=_0x448847[_0x4c91('0x4d')][_0x4c91('0x60')][_0x4c91('0x61')](';')+';';}else{_0x448847[_0x4c91('0x4d')][_0x4c91('0x60')]=null;}}else{_0x448847[_0x4c91('0x4d')][_0x4c91('0x60')]=null;}if(_0x448847['body']&&_['isArray'](_0x448847['body'])){for(var _0x5393c2=0x0;_0x5393c2<_0x448847[_0x4c91('0x4d')][_0x4c91('0x49')];_0x5393c2+=0x1){_0x448847[_0x4c91('0x4d')][_0x5393c2][_0x4c91('0x5b')]=_0x448847[_0x4c91('0x47')]['id'];_0x1132d7['push'](_0x448847[_0x4c91('0x4d')][_0x5393c2]);}return BPromise[_0x4c91('0x62')](_0x1132d7,function(_0x15bfb2){return db[_0x4c91('0x5e')][_0x4c91('0x4c')](_['omit'](_0x15bfb2,[_0x4c91('0x5d'),'id'])||{},{'fields':_[_0x4c91('0x35')](_0x1638d1),'raw':!![]})[_0x4c91('0x2c')](function(_0x27240e){_0x583a5f[_0x4c91('0x63')]['push'](_0x27240e[_0x4c91('0x64')]);})['catch'](function(_0x49afaf){_0x583a5f['errors']['push']({'data':_0x15bfb2,'error':_0x49afaf['message']});});})[_0x4c91('0x2c')](function(_0x5e1afa){return _0x583a5f;})[_0x4c91('0x4b')](function(_0x26f221){return _0x26f221;});}else{_0xefd81e[_0x4c91('0x20')](0x190)[_0x4c91('0x27')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x4c91('0x2c')](respondWithResult(_0xefd81e,null))['catch'](handleError(_0xefd81e,null));};exports[_0x4c91('0x65')]=function(_0x9cecd6,_0x123d7c,_0x10518a){var _0x47caa2;return db[_0x4c91('0x31')]['find']({'where':{'id':_0x9cecd6['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x4c91('0x66')}]})[_0x4c91('0x2c')](handleEntityNotFound(_0x123d7c,null))['then'](function(_0x49e156){if(_0x49e156){_0x47caa2=_0x49e156;return db[_0x4c91('0x5e')][_0x4c91('0x48')];}})[_0x4c91('0x2c')](function(_0x55f5be){if(_0x55f5be){var _0x21f652={};var _0x314a5a={};_0x314a5a['model']=_[_0x4c91('0x67')](_['keys'](_0x55f5be),_[_0x4c91('0x30')](_0x47caa2[_0x4c91('0x66')],function(_0x156cf5){return util[_0x4c91('0x68')](_0x4c91('0x69'),_0x156cf5['id']);}));_0x314a5a[_0x4c91('0x36')]=_[_0x4c91('0x35')](_0x9cecd6[_0x4c91('0x36')]);_0x314a5a[_0x4c91('0x3e')]=_[_0x4c91('0x37')](_0x314a5a[_0x4c91('0x34')],_0x314a5a[_0x4c91('0x36')]);_0x21f652[_0x4c91('0x38')]=_[_0x4c91('0x37')](_0x314a5a[_0x4c91('0x34')],qs[_0x4c91('0x39')](_0x9cecd6[_0x4c91('0x36')][_0x4c91('0x39')]));_0x21f652['attributes']=_0x21f652[_0x4c91('0x38')]['length']?_0x21f652['attributes']:_0x314a5a['model'];if(!_0x9cecd6[_0x4c91('0x36')][_0x4c91('0x5a')](_0x4c91('0x3a'))){_0x21f652[_0x4c91('0x22')]=qs[_0x4c91('0x22')](_0x9cecd6[_0x4c91('0x36')][_0x4c91('0x22')]);_0x21f652['offset']=qs[_0x4c91('0x24')](_0x9cecd6[_0x4c91('0x36')][_0x4c91('0x24')]);}_0x21f652[_0x4c91('0x3b')]=qs[_0x4c91('0x3c')](_0x9cecd6[_0x4c91('0x36')][_0x4c91('0x3c')]);_0x21f652[_0x4c91('0x3d')]=qs[_0x4c91('0x3e')](_[_0x4c91('0x3f')](_0x9cecd6[_0x4c91('0x36')],_0x314a5a['filters']));_0x21f652[_0x4c91('0x6a')]=!![];if(_0x9cecd6['query'][_0x4c91('0x40')]){_0x21f652[_0x4c91('0x3d')]=_[_0x4c91('0x41')](_0x21f652[_0x4c91('0x3d')],{'$or':_[_0x4c91('0x30')](_0x21f652[_0x4c91('0x38')],function(_0x2e36de){var _0x431423={};_0x431423[_0x2e36de]={'$like':'%'+_0x9cecd6[_0x4c91('0x36')]['filter']+'%'};return _0x431423;})});}_0x21f652=_[_0x4c91('0x41')]({},_0x21f652,_0x9cecd6[_0x4c91('0x42')]);return _0x47caa2[_0x4c91('0x65')](_0x21f652);}})[_0x4c91('0x2c')](respondWithResult(_0x123d7c,null))[_0x4c91('0x4b')](handleError(_0x123d7c,null));};exports[_0x4c91('0x6b')]=function(_0x3722e8,_0x395dfb,_0x2357c2){var _0x3a1b93;return db['CmList'][_0x4c91('0x4a')]({'where':{'id':_0x3722e8[_0x4c91('0x47')]['id']},'include':[{'model':db[_0x4c91('0x6c')],'as':_0x4c91('0x66')}]})[_0x4c91('0x2c')](handleEntityNotFound(_0x395dfb,null))['then'](function(_0x53d407){if(_0x53d407){_0x3a1b93=_0x53d407;return db['CmContact']['rawAttributes'];}})['then'](function(_0x2ef898){if(_0x2ef898){var _0x275e28={};var _0x552f05={};_0x552f05[_0x4c91('0x34')]=_[_0x4c91('0x67')](_[_0x4c91('0x35')](_0x2ef898),_[_0x4c91('0x30')](_0x3a1b93[_0x4c91('0x66')],function(_0x1d672e){return util[_0x4c91('0x68')](_0x4c91('0x69'),_0x1d672e['id']);}));_0x552f05[_0x4c91('0x36')]=_[_0x4c91('0x35')](_0x3722e8[_0x4c91('0x36')]);_0x552f05[_0x4c91('0x3e')]=_['intersection'](_0x552f05[_0x4c91('0x34')],_0x552f05[_0x4c91('0x36')]);_0x275e28[_0x4c91('0x38')]=_[_0x4c91('0x37')](_0x552f05[_0x4c91('0x34')],qs[_0x4c91('0x39')](_0x3722e8[_0x4c91('0x36')][_0x4c91('0x39')]));_0x275e28['attributes']=_0x275e28[_0x4c91('0x38')]['length']?_0x275e28[_0x4c91('0x38')]:_0x552f05[_0x4c91('0x34')];if(!_0x3722e8['query'][_0x4c91('0x5a')](_0x4c91('0x3a'))){_0x275e28[_0x4c91('0x22')]=qs[_0x4c91('0x22')](_0x3722e8[_0x4c91('0x36')][_0x4c91('0x22')]);_0x275e28['offset']=qs[_0x4c91('0x24')](_0x3722e8['query']['offset']);}_0x275e28[_0x4c91('0x3b')]=qs[_0x4c91('0x3c')](_0x3722e8[_0x4c91('0x36')][_0x4c91('0x3c')]);_0x275e28['where']=qs[_0x4c91('0x3e')](_[_0x4c91('0x3f')](_0x3722e8[_0x4c91('0x36')],_0x552f05['filters']));_0x275e28[_0x4c91('0x6a')]=!![];if(_0x3722e8[_0x4c91('0x36')][_0x4c91('0x40')]){_0x275e28[_0x4c91('0x3d')]=_[_0x4c91('0x41')](_0x275e28[_0x4c91('0x3d')],{'$or':_[_0x4c91('0x30')](_0x275e28['attributes'],function(_0x59a384){var _0x4f287b={};_0x4f287b[_0x59a384]={'$like':'%'+_0x3722e8['query']['filter']+'%'};return _0x4f287b;})});}_0x275e28=_['merge']({},_0x275e28,_0x3722e8[_0x4c91('0x42')]);return _0x3a1b93[_0x4c91('0x65')](_0x275e28);}})[_0x4c91('0x2c')](function(_0x512784){if(!_['isEmpty'](_0x512784)){var _0x53ebc9=toCsv(_0x512784);var _0x58c4cf=Date[_0x4c91('0x6d')]();fs[_0x4c91('0x6e')](util[_0x4c91('0x68')](_0x4c91('0x6f'),_0x3a1b93['id'],_0x58c4cf),_0x53ebc9);_0x395dfb['setHeader'](_0x4c91('0x70'),_0x4c91('0x71')+util[_0x4c91('0x68')](_0x4c91('0x72'),_0x3a1b93['id'],_0x58c4cf));_0x395dfb['setHeader'](_0x4c91('0x73'),_0x4c91('0x74'));return _0x395dfb[_0x4c91('0x75')](util['format'](_0x4c91('0x6f'),_0x3a1b93['id'],_0x58c4cf));}else{return _0x395dfb[_0x4c91('0x1f')](0xcc);}})['catch'](handleError(_0x395dfb,null));};exports['addCustomField']=function(_0x45a7fe,_0x5caa91,_0x2b884b){var _0x3c2421;delete _0x45a7fe[_0x4c91('0x4d')]['id'];return db['CmList'][_0x4c91('0x59')]({'where':{'id':_0x45a7fe['params']['id']}})['then'](handleEntityNotFound(_0x5caa91,null))[_0x4c91('0x2c')](function(_0x1d27f6){if(_0x1d27f6){return db[_0x4c91('0x76')][_0x4c91('0x77')](function(_0x16ba54){return db[_0x4c91('0x6c')][_0x4c91('0x4c')](_0x45a7fe[_0x4c91('0x4d')],{'transaction':_0x16ba54})[_0x4c91('0x2c')](function(_0x5cb915){_0x3c2421=_0x5cb915;return _0x1d27f6['addCustomFields'](_0x5cb915,{'transaction':_0x16ba54});})[_0x4c91('0x2c')](function(){var _0x8264e2={'type':db[_0x4c91('0x78')][_0x4c91('0x79')],'transaction':_0x16ba54};switch(_0x45a7fe[_0x4c91('0x4d')][_0x4c91('0x32')]){case _0x4c91('0x7a'):_0x8264e2[_0x4c91('0x32')]=db[_0x4c91('0x78')][_0x4c91('0x79')];break;case _0x4c91('0x7b'):_0x8264e2[_0x4c91('0x32')]=db[_0x4c91('0x78')][_0x4c91('0x7c')];break;case _0x4c91('0x7d'):_0x8264e2[_0x4c91('0x32')]=db[_0x4c91('0x78')][_0x4c91('0x7e')];_0x8264e2[_0x4c91('0x7f')]=![];break;default:}return db[_0x4c91('0x76')][_0x4c91('0x80')][_0x4c91('0x81')](_0x4c91('0x82'),util[_0x4c91('0x68')](_0x4c91('0x83'),_0x3c2421['id']),_0x8264e2);})[_0x4c91('0x2c')](function(){return _0x3c2421;});});}})[_0x4c91('0x2c')](respondWithResult(_0x5caa91,null))[_0x4c91('0x4b')](handleError(_0x5caa91,null));};exports[_0x4c91('0x84')]=function(_0x481520,_0x58d1f4,_0x51206f){var _0x2b3de0={};var _0x3e410b={};var _0x3a4951;var _0x405e62;return db[_0x4c91('0x31')][_0x4c91('0x59')]({'where':{'id':_0x481520[_0x4c91('0x47')]['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0x58d1f4,null))[_0x4c91('0x2c')](function(_0x3463e6){if(_0x3463e6){_0x3a4951=_0x3463e6;_0x3e410b[_0x4c91('0x34')]=_[_0x4c91('0x35')](db[_0x4c91('0x6c')][_0x4c91('0x48')]);_0x3e410b[_0x4c91('0x36')]=_[_0x4c91('0x35')](_0x481520[_0x4c91('0x36')]);_0x3e410b[_0x4c91('0x3e')]=_[_0x4c91('0x37')](_0x3e410b[_0x4c91('0x34')],_0x3e410b['query']);_0x2b3de0[_0x4c91('0x38')]=_[_0x4c91('0x37')](_0x3e410b[_0x4c91('0x34')],qs[_0x4c91('0x39')](_0x481520[_0x4c91('0x36')][_0x4c91('0x39')]));_0x2b3de0[_0x4c91('0x38')]=_0x2b3de0[_0x4c91('0x38')][_0x4c91('0x49')]?_0x2b3de0['attributes']:_0x3e410b[_0x4c91('0x34')];_0x2b3de0[_0x4c91('0x3b')]=qs['sort'](_0x481520[_0x4c91('0x36')][_0x4c91('0x3c')]);_0x2b3de0[_0x4c91('0x3d')]=qs[_0x4c91('0x3e')](_[_0x4c91('0x3f')](_0x481520['query'],_0x3e410b['filters']));_0x2b3de0[_0x4c91('0x3d')]=_[_0x4c91('0x41')](_0x2b3de0[_0x4c91('0x3d')],{'$or':[{'ListId':_0x3463e6['id']},{'ListId':null}]});if(_0x481520['query'][_0x4c91('0x40')]){_0x2b3de0[_0x4c91('0x3d')]=_[_0x4c91('0x41')](_0x2b3de0['where'],{'$or':_['map'](_0x2b3de0[_0x4c91('0x38')],function(_0x4b9954){var _0x189c52={};_0x189c52[_0x4b9954]={'$like':'%'+_0x481520[_0x4c91('0x36')][_0x4c91('0x40')]+'%'};return _0x189c52;})});}_0x2b3de0=_[_0x4c91('0x41')]({},_0x2b3de0,_0x481520[_0x4c91('0x42')]);return db[_0x4c91('0x6c')]['findAndCountAll'](_0x2b3de0);}})[_0x4c91('0x2c')](respondWithResult(_0x58d1f4,null))['catch'](handleError(_0x58d1f4,null));};exports[_0x4c91('0x85')]=function(_0x14e673,_0x3e7917,_0x1f7c02){return db[_0x4c91('0x31')][_0x4c91('0x4a')]({'where':{'id':_0x14e673[_0x4c91('0x47')]['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0x3e7917,null))[_0x4c91('0x2c')](function(_0x4ea19d){if(_0x4ea19d){return _0x4ea19d[_0x4c91('0x85')](_0x14e673[_0x4c91('0x4d')]['ids'],_['omit'](_0x14e673[_0x4c91('0x4d')],[_0x4c91('0x5d'),'id'])||{})[_0x4c91('0x86')](function(_0x330a7c){for(var _0x4b72bb=0x0;_0x4b72bb<_0x14e673[_0x4c91('0x4d')][_0x4c91('0x5d')][_0x4c91('0x49')];_0x4b72bb+=0x1){socket[_0x4c91('0x87')](_0x4c91('0x88'),{'UserId':Number(_0x14e673[_0x4c91('0x4d')][_0x4c91('0x5d')][_0x4b72bb]),'CmListId':Number(_0x14e673[_0x4c91('0x47')]['id'])});}return _0x330a7c;});}})[_0x4c91('0x2c')](respondWithResult(_0x3e7917,null))[_0x4c91('0x4b')](handleError(_0x3e7917,null));};exports[_0x4c91('0x89')]=function(_0x33fe53,_0x41ce07,_0x5cb48c){return db[_0x4c91('0x31')][_0x4c91('0x4a')]({'where':{'id':_0x33fe53[_0x4c91('0x47')]['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0x41ce07,null))[_0x4c91('0x2c')](function(_0x4a5f1b){if(_0x4a5f1b){return _0x4a5f1b[_0x4c91('0x89')](_0x33fe53[_0x4c91('0x36')][_0x4c91('0x5d')])['then'](function(){if(_[_0x4c91('0x5f')](_0x33fe53['query'][_0x4c91('0x5d')])){for(var _0x15ce25=0x0;_0x15ce25<_0x33fe53[_0x4c91('0x36')]['ids']['length'];_0x15ce25+=0x1){socket['emit'](_0x4c91('0x8a'),{'UserId':Number(_0x33fe53[_0x4c91('0x36')][_0x4c91('0x5d')][_0x15ce25]),'CmListId':Number(_0x33fe53[_0x4c91('0x47')]['id'])});}}else{socket[_0x4c91('0x87')](_0x4c91('0x8a'),{'UserId':Number(_0x33fe53[_0x4c91('0x36')]['ids']),'CmListId':Number(_0x33fe53[_0x4c91('0x47')]['id'])});}});}})[_0x4c91('0x2c')](respondWithStatusCode(_0x41ce07,null))[_0x4c91('0x4b')](handleError(_0x41ce07,null));};exports[_0x4c91('0x8b')]=function(_0x495571,_0x3adb72,_0x2822ae){var _0x55e34f={};var _0xb1ebdc={};var _0x556ab8;var _0x32478f;return db[_0x4c91('0x31')]['findOne']({'where':{'id':_0x495571[_0x4c91('0x47')]['id']}})[_0x4c91('0x2c')](handleEntityNotFound(_0x3adb72,null))['then'](function(_0x155780){if(_0x155780){_0x556ab8=_0x155780;_0xb1ebdc[_0x4c91('0x34')]=_[_0x4c91('0x35')](db[_0x4c91('0x8c')]['rawAttributes']);_0xb1ebdc[_0x4c91('0x36')]=_[_0x4c91('0x35')](_0x495571[_0x4c91('0x36')]);_0xb1ebdc['filters']=_[_0x4c91('0x37')](_0xb1ebdc[_0x4c91('0x34')],_0xb1ebdc[_0x4c91('0x36')]);_0x55e34f[_0x4c91('0x38')]=_['intersection'](_0xb1ebdc[_0x4c91('0x34')],qs[_0x4c91('0x39')](_0x495571[_0x4c91('0x36')][_0x4c91('0x39')]));_0x55e34f[_0x4c91('0x38')]=_0x55e34f[_0x4c91('0x38')][_0x4c91('0x49')]?_0x55e34f[_0x4c91('0x38')]:_0xb1ebdc[_0x4c91('0x34')];_0x55e34f['order']=qs[_0x4c91('0x3c')](_0x495571[_0x4c91('0x36')][_0x4c91('0x3c')]);_0x55e34f[_0x4c91('0x3d')]=qs[_0x4c91('0x3e')](_[_0x4c91('0x3f')](_0x495571[_0x4c91('0x36')],_0xb1ebdc[_0x4c91('0x3e')]));if(_0x495571['query'][_0x4c91('0x40')]){_0x55e34f[_0x4c91('0x3d')]=_[_0x4c91('0x41')](_0x55e34f[_0x4c91('0x3d')],{'$or':_[_0x4c91('0x30')](_0x55e34f['attributes'],function(_0x1d52dc){var _0x5054fd={};_0x5054fd[_0x1d52dc]={'$like':'%'+_0x495571[_0x4c91('0x36')][_0x4c91('0x40')]+'%'};return _0x5054fd;})});}_0x55e34f=_[_0x4c91('0x41')]({},_0x55e34f,_0x495571[_0x4c91('0x42')]);return _0x556ab8[_0x4c91('0x8b')](_0x55e34f);}})['then'](function(_0x59c189){if(_0x59c189){_0x32478f=_0x59c189[_0x4c91('0x49')];if(!_0x495571[_0x4c91('0x36')][_0x4c91('0x5a')](_0x4c91('0x3a'))){_0x55e34f[_0x4c91('0x22')]=qs[_0x4c91('0x22')](_0x495571[_0x4c91('0x36')]['limit']);_0x55e34f[_0x4c91('0x24')]=qs[_0x4c91('0x24')](_0x495571[_0x4c91('0x36')][_0x4c91('0x24')]);}return _0x556ab8[_0x4c91('0x8b')](_0x55e34f);}})['then'](function(_0x53e7bd){if(_0x53e7bd){return _0x53e7bd?{'count':_0x32478f,'rows':_0x53e7bd}:null;}})[_0x4c91('0x2c')](respondWithResult(_0x3adb72,null))[_0x4c91('0x4b')](handleError(_0x3adb72,null));}; \ No newline at end of file +var _0x99b6=['offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','Lists','error','name','send','index','map','CmList','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','concat','CustomFields','format','hasOwnProperty','nolimit','raw','getContactsCsv','CmCustomField','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','download','addCustomField','transaction','addCustomFields','TEXT','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','jsforce','querystring','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','sendStatus','status','end'];(function(_0x2043a1,_0x2043bf){var _0x22e7ea=function(_0x5258a4){while(--_0x5258a4){_0x2043a1['push'](_0x2043a1['shift']());}};_0x22e7ea(++_0x2043bf);}(_0x99b6,0x73));var _0x699b=function(_0x2fba8c,_0x58d4ab){_0x2fba8c=_0x2fba8c-0x0;var _0x146f80=_0x99b6[_0x2fba8c];return _0x146f80;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x699b('0x0'));var jsonpatch=require(_0x699b('0x1'));var rp=require(_0x699b('0x2'));var moment=require(_0x699b('0x3'));var BPromise=require(_0x699b('0x4'));var Mustache=require('mustache');var util=require(_0x699b('0x5'));var path=require(_0x699b('0x6'));var sox=require(_0x699b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x699b('0x8'));var _=require(_0x699b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x699b('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x699b('0xb'));var Papa=require('papaparse');var Redis=require(_0x699b('0xc'));var authService=require(_0x699b('0xd'));var qs=require(_0x699b('0xe'));var as=require(_0x699b('0xf'));var hardwareService=require(_0x699b('0x10'));var logger=require(_0x699b('0x11'))('api');var utils=require(_0x699b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x699b('0x13'));var db=require(_0x699b('0x14'))['db'];config[_0x699b('0x15')]=_[_0x699b('0x16')](config[_0x699b('0x15')],{'host':_0x699b('0x17'),'port':0x18eb});var socket=require(_0x699b('0x18'))(new Redis(config[_0x699b('0x15')]));require(_0x699b('0x19'))[_0x699b('0x1a')](socket);function respondWithStatusCode(_0x33eadc,_0x518fed){_0x518fed=_0x518fed||0xcc;return function(_0x561f7c){if(_0x561f7c){return _0x33eadc[_0x699b('0x1b')](_0x518fed);}return _0x33eadc[_0x699b('0x1c')](_0x518fed)[_0x699b('0x1d')]();};}function respondWithResult(_0x2675b8,_0x3cc4ee){_0x3cc4ee=_0x3cc4ee||0xc8;return function(_0x503341){if(_0x503341){return _0x2675b8[_0x699b('0x1c')](_0x3cc4ee)['json'](_0x503341);}};}function respondWithFilteredResult(_0xd43111,_0x14f9fa){return function(_0x39b97b){if(_0x39b97b){var _0x1eaf24=typeof _0x14f9fa[_0x699b('0x1e')]==='undefined'&&typeof _0x14f9fa[_0x699b('0x1f')]===_0x699b('0x20');var _0x96469=_0x39b97b['count'];var _0x9b2b3d=_0x1eaf24?0x0:_0x14f9fa['offset'];var _0x8380c3=_0x1eaf24?_0x39b97b[_0x699b('0x21')]:_0x14f9fa[_0x699b('0x1e')]+_0x14f9fa[_0x699b('0x1f')];var _0x50dba1;if(_0x8380c3>=_0x96469){_0x8380c3=_0x96469;_0x50dba1=0xc8;}else{_0x50dba1=0xce;}_0xd43111['status'](_0x50dba1);return _0xd43111[_0x699b('0x22')]('Content-Range',_0x9b2b3d+'-'+_0x8380c3+'/'+_0x96469)[_0x699b('0x23')](_0x39b97b);}return null;};}function patchUpdates(_0x5c639f){return function(_0xca722a){try{jsonpatch[_0x699b('0x24')](_0xca722a,_0x5c639f,!![]);}catch(_0x3e80ef){return BPromise[_0x699b('0x25')](_0x3e80ef);}return _0xca722a[_0x699b('0x26')]();};}function saveUpdates(_0x384a34,_0x28e4aa){return function(_0x54910c){if(_0x54910c){return _0x54910c[_0x699b('0x27')](_0x384a34)[_0x699b('0x28')](function(_0x5d31d6){return _0x5d31d6;});}return null;};}function removeEntity(_0x52a3f6,_0x1b9279){return function(_0x309461){if(_0x309461){return _0x309461[_0x699b('0x29')]()['then'](function(){var _0x36003a=_0x309461['get']({'plain':!![]});var _0x55d5e4=_0x699b('0x2a');return db['UserProfileResource'][_0x699b('0x29')]({'where':{'type':_0x55d5e4,'resourceId':_0x36003a['id']}})[_0x699b('0x28')](function(){return _0x309461;});})[_0x699b('0x28')](function(){_0x52a3f6[_0x699b('0x1c')](0xcc)[_0x699b('0x1d')]();});}};}function handleEntityNotFound(_0x55a968,_0x294a61){return function(_0x53083b){if(!_0x53083b){_0x55a968[_0x699b('0x1b')](0x194);}return _0x53083b;};}function handleError(_0x529095,_0x343c52){_0x343c52=_0x343c52||0x1f4;return function(_0x40acc6){logger[_0x699b('0x2b')](_0x40acc6['stack']);if(_0x40acc6[_0x699b('0x2c')]){delete _0x40acc6['name'];}_0x529095[_0x699b('0x1c')](_0x343c52)[_0x699b('0x2d')](_0x40acc6);};}exports[_0x699b('0x2e')]=function(_0x36f8cf,_0x2613a9){var _0x481a5b={},_0x32b352={},_0x295f4a={'count':0x0,'rows':[]};var _0x23f87b=_[_0x699b('0x2f')](db[_0x699b('0x30')][_0x699b('0x31')],function(_0x3f8bd8){return{'name':_0x3f8bd8[_0x699b('0x32')],'type':_0x3f8bd8[_0x699b('0x33')]['key']};});_0x32b352[_0x699b('0x34')]=_[_0x699b('0x2f')](_0x23f87b,_0x699b('0x2c'));_0x32b352['query']=_[_0x699b('0x35')](_0x36f8cf[_0x699b('0x36')]);_0x32b352[_0x699b('0x37')]=_[_0x699b('0x38')](_0x32b352[_0x699b('0x34')],_0x32b352[_0x699b('0x36')]);_0x481a5b[_0x699b('0x39')]=_[_0x699b('0x38')](_0x32b352[_0x699b('0x34')],qs[_0x699b('0x3a')](_0x36f8cf[_0x699b('0x36')][_0x699b('0x3a')]));_0x481a5b['attributes']=_0x481a5b[_0x699b('0x39')][_0x699b('0x3b')]?_0x481a5b[_0x699b('0x39')]:_0x32b352['model'];if(!_0x36f8cf[_0x699b('0x36')]['hasOwnProperty']('nolimit')){_0x481a5b[_0x699b('0x1f')]=qs['limit'](_0x36f8cf[_0x699b('0x36')]['limit']);_0x481a5b['offset']=qs['offset'](_0x36f8cf[_0x699b('0x36')][_0x699b('0x1e')]);}_0x481a5b[_0x699b('0x3c')]=qs['sort'](_0x36f8cf[_0x699b('0x36')][_0x699b('0x3d')]);_0x481a5b[_0x699b('0x3e')]=qs['filters'](_[_0x699b('0x3f')](_0x36f8cf[_0x699b('0x36')],_0x32b352[_0x699b('0x37')]),_0x23f87b);if(_0x36f8cf[_0x699b('0x36')][_0x699b('0x40')]){_0x481a5b[_0x699b('0x3e')]=_[_0x699b('0x41')](_0x481a5b['where'],{'$or':_[_0x699b('0x2f')](_0x23f87b,function(_0x508aa2){if(_0x508aa2[_0x699b('0x33')]!=='VIRTUAL'){var _0x20c970={};_0x20c970[_0x508aa2[_0x699b('0x2c')]]={'$like':'%'+_0x36f8cf['query'][_0x699b('0x40')]+'%'};return _0x20c970;}})});}_0x481a5b=_[_0x699b('0x41')]({},_0x481a5b,_0x36f8cf[_0x699b('0x42')]);var _0x38eb6c={'where':_0x481a5b[_0x699b('0x3e')]};return db[_0x699b('0x30')][_0x699b('0x21')](_0x38eb6c)['then'](function(_0x532528){_0x295f4a['count']=_0x532528;if(_0x36f8cf['query']['includeAll']){_0x481a5b[_0x699b('0x43')]=[{'all':!![]}];}return db[_0x699b('0x30')][_0x699b('0x44')](_0x481a5b);})[_0x699b('0x28')](function(_0x172158){_0x295f4a[_0x699b('0x45')]=_0x172158;return _0x295f4a;})[_0x699b('0x28')](respondWithFilteredResult(_0x2613a9,_0x481a5b))[_0x699b('0x46')](handleError(_0x2613a9,null));};exports[_0x699b('0x47')]=function(_0x56c638,_0x27c4b3){var _0x1dcf01={'raw':![],'where':{'id':_0x56c638[_0x699b('0x48')]['id']}},_0x436104={};_0x436104['model']=_[_0x699b('0x35')](db[_0x699b('0x30')][_0x699b('0x31')]);_0x436104[_0x699b('0x36')]=_[_0x699b('0x35')](_0x56c638[_0x699b('0x36')]);_0x436104[_0x699b('0x37')]=_[_0x699b('0x38')](_0x436104[_0x699b('0x34')],_0x436104[_0x699b('0x36')]);_0x1dcf01[_0x699b('0x39')]=_['intersection'](_0x436104[_0x699b('0x34')],qs[_0x699b('0x3a')](_0x56c638[_0x699b('0x36')]['fields']));_0x1dcf01[_0x699b('0x39')]=_0x1dcf01['attributes'][_0x699b('0x3b')]?_0x1dcf01[_0x699b('0x39')]:_0x436104[_0x699b('0x34')];if(_0x56c638['query'][_0x699b('0x49')]){_0x1dcf01[_0x699b('0x43')]=[{'all':!![]}];}_0x1dcf01=_[_0x699b('0x41')]({},_0x1dcf01,_0x56c638[_0x699b('0x42')]);return db[_0x699b('0x30')][_0x699b('0x4a')](_0x1dcf01)['then'](handleEntityNotFound(_0x27c4b3,null))['then'](respondWithResult(_0x27c4b3,null))[_0x699b('0x46')](handleError(_0x27c4b3,null));};exports[_0x699b('0x4b')]=function(_0x5787c0,_0x592be9){return db[_0x699b('0x30')][_0x699b('0x4b')](_0x5787c0[_0x699b('0x4c')],{})['then'](function(_0x5bca20){var _0x177e12=_0x5787c0['user'][_0x699b('0x4d')]({'plain':!![]});if(!_0x177e12)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x177e12[_0x699b('0x4e')]==='user'){var _0x405851=_0x5bca20[_0x699b('0x4d')]({'plain':!![]});var _0x5ed6cf=_0x699b('0x2a');return db[_0x699b('0x4f')][_0x699b('0x4a')]({'where':{'name':_0x5ed6cf,'userProfileId':_0x177e12[_0x699b('0x50')]},'raw':!![]})[_0x699b('0x28')](function(_0x630724){if(_0x630724&&_0x630724[_0x699b('0x51')]===0x0){return db[_0x699b('0x52')][_0x699b('0x4b')]({'name':_0x405851['name'],'resourceId':_0x405851['id'],'type':_0x630724[_0x699b('0x2c')],'sectionId':_0x630724['id']},{})['then'](function(){return _0x5bca20;});}else{return _0x5bca20;}})[_0x699b('0x46')](function(_0x53254d){logger['error'](_0x699b('0x53'),_0x53254d);throw _0x53254d;});}return _0x5bca20;})[_0x699b('0x28')](respondWithResult(_0x592be9,0xc9))[_0x699b('0x46')](handleError(_0x592be9,null));};exports[_0x699b('0x27')]=function(_0x3d1205,_0x5313a7){if(_0x3d1205[_0x699b('0x4c')]['id']){delete _0x3d1205[_0x699b('0x4c')]['id'];}return db[_0x699b('0x30')]['find']({'where':{'id':_0x3d1205['params']['id']}})[_0x699b('0x28')](handleEntityNotFound(_0x5313a7,null))[_0x699b('0x28')](saveUpdates(_0x3d1205[_0x699b('0x4c')],null))[_0x699b('0x28')](respondWithResult(_0x5313a7,null))[_0x699b('0x46')](handleError(_0x5313a7,null));};exports[_0x699b('0x29')]=function(_0x164875,_0x22e9ec){return db[_0x699b('0x30')]['find']({'where':{'id':_0x164875[_0x699b('0x48')]['id']}})[_0x699b('0x28')](handleEntityNotFound(_0x22e9ec,null))['then'](removeEntity(_0x22e9ec,null))['catch'](handleError(_0x22e9ec,null));};exports[_0x699b('0x54')]=function(_0x59bcdf,_0x7cd778){return db['CmList'][_0x699b('0x54')]()[_0x699b('0x28')](respondWithResult(_0x7cd778,null))[_0x699b('0x46')](handleError(_0x7cd778,null));};exports[_0x699b('0x55')]=function(_0x196f1e,_0x190075,_0xe80fcb){if(_0x196f1e['body']['id']){delete _0x196f1e[_0x699b('0x4c')]['id'];}return db[_0x699b('0x30')][_0x699b('0x4a')]({'where':{'id':_0x196f1e[_0x699b('0x48')]['id']}})[_0x699b('0x28')](handleEntityNotFound(_0x190075,null))[_0x699b('0x28')](function(_0x364410){if(_0x364410){_0x196f1e[_0x699b('0x4c')][_0x699b('0x56')]=_0x364410['id'];return db[_0x699b('0x57')][_0x699b('0x4b')](_0x196f1e[_0x699b('0x4c')]);}})['then'](respondWithResult(_0x190075,null))[_0x699b('0x46')](handleError(_0x190075,null));};exports[_0x699b('0x58')]=function(_0x2590b5,_0x57e3b2,_0x3de892){var _0x307f44={'raw':![],'where':{}};var _0x583baf={};var _0x296c75={'count':0x0,'rows':[]};return db[_0x699b('0x30')][_0x699b('0x59')]({'where':{'id':_0x2590b5[_0x699b('0x48')]['id']}})['then'](handleEntityNotFound(_0x57e3b2,null))[_0x699b('0x28')](function(_0x601f87){if(_0x601f87){_0x583baf[_0x699b('0x34')]=_[_0x699b('0x35')](db[_0x699b('0x57')]['rawAttributes']);_0x583baf[_0x699b('0x36')]=_[_0x699b('0x35')](_0x2590b5['query']);_0x583baf[_0x699b('0x37')]=_[_0x699b('0x38')](_0x583baf[_0x699b('0x34')],_0x583baf[_0x699b('0x36')]);_0x307f44['attributes']=_[_0x699b('0x38')](_0x583baf['model'],qs['fields'](_0x2590b5[_0x699b('0x36')][_0x699b('0x3a')]));_0x307f44[_0x699b('0x39')]=_0x307f44['attributes'][_0x699b('0x3b')]?_0x307f44[_0x699b('0x39')]:_0x583baf['model'];if(!_0x2590b5[_0x699b('0x36')]['hasOwnProperty']('nolimit')){_0x307f44[_0x699b('0x1f')]=qs[_0x699b('0x1f')](_0x2590b5[_0x699b('0x36')][_0x699b('0x1f')]);_0x307f44[_0x699b('0x1e')]=qs[_0x699b('0x1e')](_0x2590b5[_0x699b('0x36')]['offset']);}_0x307f44[_0x699b('0x3c')]=qs[_0x699b('0x3d')](_0x2590b5[_0x699b('0x36')]['sort']);_0x307f44[_0x699b('0x3e')]=qs[_0x699b('0x37')](_[_0x699b('0x3f')](_0x2590b5[_0x699b('0x36')],_0x583baf[_0x699b('0x37')]));_0x307f44['where'][_0x699b('0x56')]=_0x601f87['id'];if(_0x2590b5[_0x699b('0x36')][_0x699b('0x40')]){_0x307f44['where']=_[_0x699b('0x41')](_0x307f44['where'],{'$or':_['map'](_0x307f44[_0x699b('0x39')],function(_0x50089e){var _0x2c944e={};_0x2c944e[_0x50089e]={'$like':'%'+_0x2590b5[_0x699b('0x36')][_0x699b('0x40')]+'%'};return _0x2c944e;})});}_0x307f44=_[_0x699b('0x41')]({},_0x307f44,_0x2590b5[_0x699b('0x42')]);return db[_0x699b('0x57')]['count']({'where':_0x307f44[_0x699b('0x3e')]})[_0x699b('0x28')](function(_0x18933){_0x296c75['count']=_0x18933;if(_0x2590b5[_0x699b('0x36')]['includeAll']){_0x307f44[_0x699b('0x43')]=[{'all':!![]}];}return db[_0x699b('0x57')][_0x699b('0x44')](_0x307f44);})[_0x699b('0x28')](function(_0x1859b3){_0x296c75['rows']=_0x1859b3;return _0x296c75;});}})[_0x699b('0x28')](respondWithFilteredResult(_0x57e3b2,_0x307f44))[_0x699b('0x46')](handleError(_0x57e3b2,null));};exports[_0x699b('0x5a')]=function(_0x371b0e,_0x1ba4ca,_0x356359){return db[_0x699b('0x30')][_0x699b('0x4a')]({'where':{'id':_0x371b0e[_0x699b('0x48')]['id']}})[_0x699b('0x28')](handleEntityNotFound(_0x1ba4ca,null))[_0x699b('0x28')](function(_0x356be9){if(_0x356be9){return _0x356be9[_0x699b('0x5a')](_0x371b0e[_0x699b('0x36')][_0x699b('0x5b')]);}})['then'](respondWithStatusCode(_0x1ba4ca,null))[_0x699b('0x46')](handleError(_0x1ba4ca,null));};exports[_0x699b('0x5c')]=function(_0x692c74,_0x42051d,_0x4c076c){return db['CmList'][_0x699b('0x4a')]({'where':{'id':_0x692c74[_0x699b('0x48')]['id']}})['then'](handleEntityNotFound(_0x42051d,null))['then'](function(_0x536b61){if(_0x536b61){var _0x573f23=[];var _0x3ac4f6={'success':[],'errors':[]};return db[_0x699b('0x5d')][_0x699b('0x54')]()[_0x699b('0x28')](function(_0x8b5a19){if(_0x692c74[_0x699b('0x4c')][_0x699b('0x5e')]&&_[_0x699b('0x5f')](_0x692c74[_0x699b('0x4c')][_0x699b('0x5e')])){if(_0x692c74[_0x699b('0x4c')][_0x699b('0x5e')]['length']){_0x692c74['body']['tags']=_0x692c74[_0x699b('0x4c')]['tags'][_0x699b('0x60')](';')+';';}else{_0x692c74[_0x699b('0x4c')][_0x699b('0x5e')]=null;}}else{_0x692c74[_0x699b('0x4c')][_0x699b('0x5e')]=null;}if(_0x692c74[_0x699b('0x4c')]&&_['isArray'](_0x692c74[_0x699b('0x4c')])){for(var _0x24f242=0x0;_0x24f242<_0x692c74['body'][_0x699b('0x3b')];_0x24f242+=0x1){_0x692c74[_0x699b('0x4c')][_0x24f242][_0x699b('0x56')]=_0x692c74[_0x699b('0x48')]['id'];_0x573f23[_0x699b('0x61')](_0x692c74[_0x699b('0x4c')][_0x24f242]);}return BPromise[_0x699b('0x62')](_0x573f23,function(_0x22632f){return db[_0x699b('0x5d')][_0x699b('0x4b')](_[_0x699b('0x63')](_0x22632f,[_0x699b('0x5b'),'id'])||{},{'fields':_[_0x699b('0x35')](_0x8b5a19),'raw':!![]})['then'](function(_0x584b80){_0x3ac4f6[_0x699b('0x64')][_0x699b('0x61')](_0x584b80[_0x699b('0x65')]);})[_0x699b('0x46')](function(_0x34a5c5){_0x3ac4f6['errors'][_0x699b('0x61')]({'data':_0x22632f,'error':_0x34a5c5[_0x699b('0x66')]});});})[_0x699b('0x28')](function(_0x10c0f2){return _0x3ac4f6;})[_0x699b('0x46')](function(_0x4bf4b8){return _0x4bf4b8;});}else{_0x42051d[_0x699b('0x1c')](0x190)[_0x699b('0x23')]({'message':_0x699b('0x67')});}});}})['then'](respondWithResult(_0x42051d,null))[_0x699b('0x46')](handleError(_0x42051d,null));};exports[_0x699b('0x68')]=function(_0x27688e,_0x1fd25,_0x5d30b0){var _0x4d60cc;return db[_0x699b('0x30')][_0x699b('0x4a')]({'where':{'id':_0x27688e[_0x699b('0x48')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x699b('0x28')](handleEntityNotFound(_0x1fd25,null))['then'](function(_0x244d6b){if(_0x244d6b){_0x4d60cc=_0x244d6b;return db['CmContact'][_0x699b('0x31')];}})[_0x699b('0x28')](function(_0x56bbee){if(_0x56bbee){var _0x5860ff={};var _0x2f4182={};_0x2f4182[_0x699b('0x34')]=_[_0x699b('0x69')](_[_0x699b('0x35')](_0x56bbee),_[_0x699b('0x2f')](_0x4d60cc[_0x699b('0x6a')],function(_0x11f372){return util[_0x699b('0x6b')]('cf_%d',_0x11f372['id']);}));_0x2f4182[_0x699b('0x36')]=_[_0x699b('0x35')](_0x27688e[_0x699b('0x36')]);_0x2f4182[_0x699b('0x37')]=_['intersection'](_0x2f4182['model'],_0x2f4182[_0x699b('0x36')]);_0x5860ff[_0x699b('0x39')]=_[_0x699b('0x38')](_0x2f4182[_0x699b('0x34')],qs['fields'](_0x27688e[_0x699b('0x36')][_0x699b('0x3a')]));_0x5860ff[_0x699b('0x39')]=_0x5860ff['attributes'][_0x699b('0x3b')]?_0x5860ff[_0x699b('0x39')]:_0x2f4182[_0x699b('0x34')];if(!_0x27688e[_0x699b('0x36')][_0x699b('0x6c')](_0x699b('0x6d'))){_0x5860ff['limit']=qs['limit'](_0x27688e[_0x699b('0x36')][_0x699b('0x1f')]);_0x5860ff['offset']=qs[_0x699b('0x1e')](_0x27688e[_0x699b('0x36')][_0x699b('0x1e')]);}_0x5860ff['order']=qs['sort'](_0x27688e[_0x699b('0x36')][_0x699b('0x3d')]);_0x5860ff[_0x699b('0x3e')]=qs[_0x699b('0x37')](_[_0x699b('0x3f')](_0x27688e[_0x699b('0x36')],_0x2f4182[_0x699b('0x37')]));_0x5860ff[_0x699b('0x6e')]=!![];if(_0x27688e['query'][_0x699b('0x40')]){_0x5860ff['where']=_[_0x699b('0x41')](_0x5860ff[_0x699b('0x3e')],{'$or':_[_0x699b('0x2f')](_0x5860ff[_0x699b('0x39')],function(_0x5d698a){var _0x40332b={};_0x40332b[_0x5d698a]={'$like':'%'+_0x27688e[_0x699b('0x36')]['filter']+'%'};return _0x40332b;})});}_0x5860ff=_['merge']({},_0x5860ff,_0x27688e[_0x699b('0x42')]);return _0x4d60cc[_0x699b('0x68')](_0x5860ff);}})[_0x699b('0x28')](respondWithResult(_0x1fd25,null))[_0x699b('0x46')](handleError(_0x1fd25,null));};exports[_0x699b('0x6f')]=function(_0x418a39,_0x22f752,_0x470857){var _0x384875;return db['CmList'][_0x699b('0x4a')]({'where':{'id':_0x418a39[_0x699b('0x48')]['id']},'include':[{'model':db[_0x699b('0x70')],'as':_0x699b('0x6a')}]})['then'](handleEntityNotFound(_0x22f752,null))['then'](function(_0xb3adfc){if(_0xb3adfc){_0x384875=_0xb3adfc;return db['CmContact']['rawAttributes'];}})['then'](function(_0x4f0291){if(_0x4f0291){var _0x4d84aa={};var _0x4c7835={};_0x4c7835[_0x699b('0x34')]=_['concat'](_[_0x699b('0x35')](_0x4f0291),_[_0x699b('0x2f')](_0x384875['CustomFields'],function(_0x2f8a44){return util[_0x699b('0x6b')]('cf_%d',_0x2f8a44['id']);}));_0x4c7835[_0x699b('0x36')]=_['keys'](_0x418a39[_0x699b('0x36')]);_0x4c7835[_0x699b('0x37')]=_['intersection'](_0x4c7835[_0x699b('0x34')],_0x4c7835[_0x699b('0x36')]);_0x4d84aa[_0x699b('0x39')]=_[_0x699b('0x38')](_0x4c7835[_0x699b('0x34')],qs[_0x699b('0x3a')](_0x418a39[_0x699b('0x36')][_0x699b('0x3a')]));_0x4d84aa[_0x699b('0x39')]=_0x4d84aa[_0x699b('0x39')]['length']?_0x4d84aa[_0x699b('0x39')]:_0x4c7835[_0x699b('0x34')];if(!_0x418a39[_0x699b('0x36')][_0x699b('0x6c')](_0x699b('0x6d'))){_0x4d84aa['limit']=qs[_0x699b('0x1f')](_0x418a39['query']['limit']);_0x4d84aa[_0x699b('0x1e')]=qs[_0x699b('0x1e')](_0x418a39['query'][_0x699b('0x1e')]);}_0x4d84aa['order']=qs['sort'](_0x418a39['query']['sort']);_0x4d84aa[_0x699b('0x3e')]=qs[_0x699b('0x37')](_[_0x699b('0x3f')](_0x418a39[_0x699b('0x36')],_0x4c7835[_0x699b('0x37')]));_0x4d84aa[_0x699b('0x6e')]=!![];if(_0x418a39[_0x699b('0x36')][_0x699b('0x40')]){_0x4d84aa[_0x699b('0x3e')]=_['merge'](_0x4d84aa[_0x699b('0x3e')],{'$or':_[_0x699b('0x2f')](_0x4d84aa[_0x699b('0x39')],function(_0x20ffb8){var _0x105e5f={};_0x105e5f[_0x20ffb8]={'$like':'%'+_0x418a39[_0x699b('0x36')][_0x699b('0x40')]+'%'};return _0x105e5f;})});}_0x4d84aa=_['merge']({},_0x4d84aa,_0x418a39[_0x699b('0x42')]);return _0x384875[_0x699b('0x68')](_0x4d84aa);}})[_0x699b('0x28')](function(_0x2de6c5){if(!_[_0x699b('0x71')](_0x2de6c5)){var _0x510ea3=toCsv(_0x2de6c5);var _0x20173b=Date[_0x699b('0x72')]();fs[_0x699b('0x73')](util[_0x699b('0x6b')](_0x699b('0x74'),_0x384875['id'],_0x20173b),_0x510ea3);_0x22f752['setHeader'](_0x699b('0x75'),_0x699b('0x76')+util[_0x699b('0x6b')]('list_%d_%s.csv',_0x384875['id'],_0x20173b));_0x22f752[_0x699b('0x77')](_0x699b('0x78'),_0x699b('0x79'));return _0x22f752[_0x699b('0x7a')](util[_0x699b('0x6b')](_0x699b('0x74'),_0x384875['id'],_0x20173b));}else{return _0x22f752[_0x699b('0x1b')](0xcc);}})[_0x699b('0x46')](handleError(_0x22f752,null));};exports[_0x699b('0x7b')]=function(_0x5b2efd,_0x2e71d5,_0x4ba091){var _0x2187a8;delete _0x5b2efd[_0x699b('0x4c')]['id'];return db[_0x699b('0x30')][_0x699b('0x59')]({'where':{'id':_0x5b2efd[_0x699b('0x48')]['id']}})[_0x699b('0x28')](handleEntityNotFound(_0x2e71d5,null))['then'](function(_0x5ca5b3){if(_0x5ca5b3){return db['sequelize'][_0x699b('0x7c')](function(_0x18dea0){return db[_0x699b('0x70')][_0x699b('0x4b')](_0x5b2efd['body'],{'transaction':_0x18dea0})[_0x699b('0x28')](function(_0x3bc2fe){_0x2187a8=_0x3bc2fe;return _0x5ca5b3[_0x699b('0x7d')](_0x3bc2fe,{'transaction':_0x18dea0});})[_0x699b('0x28')](function(){var _0x51fdfd={'type':db['Sequelize'][_0x699b('0x7e')],'transaction':_0x18dea0};switch(_0x5b2efd[_0x699b('0x4c')]['type']){case'text':_0x51fdfd[_0x699b('0x33')]=db[_0x699b('0x7f')]['TEXT'];break;case _0x699b('0x80'):_0x51fdfd[_0x699b('0x33')]=db[_0x699b('0x7f')][_0x699b('0x81')];break;case _0x699b('0x82'):_0x51fdfd['type']=db[_0x699b('0x7f')][_0x699b('0x83')];_0x51fdfd[_0x699b('0x84')]=![];break;default:}return db[_0x699b('0x85')][_0x699b('0x86')][_0x699b('0x87')](_0x699b('0x88'),util[_0x699b('0x6b')](_0x699b('0x89'),_0x2187a8['id']),_0x51fdfd);})[_0x699b('0x28')](function(){return _0x2187a8;});});}})[_0x699b('0x28')](respondWithResult(_0x2e71d5,null))[_0x699b('0x46')](handleError(_0x2e71d5,null));};exports[_0x699b('0x8a')]=function(_0x542a57,_0x3e4df3,_0x8ed387){var _0x21a9a3={};var _0x2c1235={};var _0x26c938;var _0x4a5b80;return db[_0x699b('0x30')]['findOne']({'where':{'id':_0x542a57['params']['id']}})[_0x699b('0x28')](handleEntityNotFound(_0x3e4df3,null))[_0x699b('0x28')](function(_0x3556c7){if(_0x3556c7){_0x26c938=_0x3556c7;_0x2c1235['model']=_[_0x699b('0x35')](db[_0x699b('0x70')]['rawAttributes']);_0x2c1235[_0x699b('0x36')]=_[_0x699b('0x35')](_0x542a57['query']);_0x2c1235[_0x699b('0x37')]=_[_0x699b('0x38')](_0x2c1235[_0x699b('0x34')],_0x2c1235[_0x699b('0x36')]);_0x21a9a3['attributes']=_[_0x699b('0x38')](_0x2c1235[_0x699b('0x34')],qs[_0x699b('0x3a')](_0x542a57[_0x699b('0x36')][_0x699b('0x3a')]));_0x21a9a3[_0x699b('0x39')]=_0x21a9a3['attributes'][_0x699b('0x3b')]?_0x21a9a3[_0x699b('0x39')]:_0x2c1235[_0x699b('0x34')];_0x21a9a3[_0x699b('0x3c')]=qs[_0x699b('0x3d')](_0x542a57[_0x699b('0x36')][_0x699b('0x3d')]);_0x21a9a3['where']=qs[_0x699b('0x37')](_[_0x699b('0x3f')](_0x542a57[_0x699b('0x36')],_0x2c1235[_0x699b('0x37')]));_0x21a9a3[_0x699b('0x3e')]=_[_0x699b('0x41')](_0x21a9a3['where'],{'$or':[{'ListId':_0x3556c7['id']},{'ListId':null}]});if(_0x542a57['query'][_0x699b('0x40')]){_0x21a9a3[_0x699b('0x3e')]=_[_0x699b('0x41')](_0x21a9a3[_0x699b('0x3e')],{'$or':_[_0x699b('0x2f')](_0x21a9a3[_0x699b('0x39')],function(_0x4c3d98){var _0x588bfd={};_0x588bfd[_0x4c3d98]={'$like':'%'+_0x542a57[_0x699b('0x36')][_0x699b('0x40')]+'%'};return _0x588bfd;})});}_0x21a9a3=_['merge']({},_0x21a9a3,_0x542a57[_0x699b('0x42')]);return db[_0x699b('0x70')]['findAndCountAll'](_0x21a9a3);}})[_0x699b('0x28')](respondWithResult(_0x3e4df3,null))[_0x699b('0x46')](handleError(_0x3e4df3,null));};exports['addAgents']=function(_0x32163a,_0x288249,_0xf2f92e){return db[_0x699b('0x30')]['find']({'where':{'id':_0x32163a[_0x699b('0x48')]['id']}})[_0x699b('0x28')](handleEntityNotFound(_0x288249,null))['then'](function(_0x130af9){if(_0x130af9){return _0x130af9[_0x699b('0x8b')](_0x32163a['body'][_0x699b('0x5b')],_[_0x699b('0x63')](_0x32163a[_0x699b('0x4c')],[_0x699b('0x5b'),'id'])||{})[_0x699b('0x8c')](function(_0x3d77a2){for(var _0x5b0337=0x0;_0x5b0337<_0x32163a[_0x699b('0x4c')][_0x699b('0x5b')][_0x699b('0x3b')];_0x5b0337+=0x1){socket[_0x699b('0x8d')](_0x699b('0x8e'),{'UserId':Number(_0x32163a['body']['ids'][_0x5b0337]),'CmListId':Number(_0x32163a['params']['id'])});}return _0x3d77a2;});}})[_0x699b('0x28')](respondWithResult(_0x288249,null))[_0x699b('0x46')](handleError(_0x288249,null));};exports[_0x699b('0x8f')]=function(_0xc75285,_0x3d0b77,_0x46d70f){return db[_0x699b('0x30')][_0x699b('0x4a')]({'where':{'id':_0xc75285['params']['id']}})[_0x699b('0x28')](handleEntityNotFound(_0x3d0b77,null))[_0x699b('0x28')](function(_0x163b45){if(_0x163b45){return _0x163b45[_0x699b('0x8f')](_0xc75285[_0x699b('0x36')][_0x699b('0x5b')])['then'](function(){if(_[_0x699b('0x5f')](_0xc75285[_0x699b('0x36')][_0x699b('0x5b')])){for(var _0x1089b0=0x0;_0x1089b0<_0xc75285[_0x699b('0x36')][_0x699b('0x5b')]['length'];_0x1089b0+=0x1){socket[_0x699b('0x8d')]('userCmList:remove',{'UserId':Number(_0xc75285['query'][_0x699b('0x5b')][_0x1089b0]),'CmListId':Number(_0xc75285[_0x699b('0x48')]['id'])});}}else{socket[_0x699b('0x8d')]('userCmList:remove',{'UserId':Number(_0xc75285[_0x699b('0x36')][_0x699b('0x5b')]),'CmListId':Number(_0xc75285[_0x699b('0x48')]['id'])});}});}})[_0x699b('0x28')](respondWithStatusCode(_0x3d0b77,null))['catch'](handleError(_0x3d0b77,null));};exports[_0x699b('0x90')]=function(_0x5714f5,_0x8c749b,_0xe82cc2){var _0x4ce291={};var _0x495f7c={};var _0x5acf90;var _0x5267ca;return db[_0x699b('0x30')][_0x699b('0x59')]({'where':{'id':_0x5714f5[_0x699b('0x48')]['id']}})[_0x699b('0x28')](handleEntityNotFound(_0x8c749b,null))[_0x699b('0x28')](function(_0x128bfa){if(_0x128bfa){_0x5acf90=_0x128bfa;_0x495f7c[_0x699b('0x34')]=_['keys'](db['User'][_0x699b('0x31')]);_0x495f7c[_0x699b('0x36')]=_[_0x699b('0x35')](_0x5714f5[_0x699b('0x36')]);_0x495f7c[_0x699b('0x37')]=_[_0x699b('0x38')](_0x495f7c['model'],_0x495f7c[_0x699b('0x36')]);_0x4ce291[_0x699b('0x39')]=_[_0x699b('0x38')](_0x495f7c[_0x699b('0x34')],qs['fields'](_0x5714f5[_0x699b('0x36')][_0x699b('0x3a')]));_0x4ce291[_0x699b('0x39')]=_0x4ce291[_0x699b('0x39')][_0x699b('0x3b')]?_0x4ce291[_0x699b('0x39')]:_0x495f7c[_0x699b('0x34')];_0x4ce291[_0x699b('0x3c')]=qs[_0x699b('0x3d')](_0x5714f5[_0x699b('0x36')][_0x699b('0x3d')]);_0x4ce291[_0x699b('0x3e')]=qs['filters'](_[_0x699b('0x3f')](_0x5714f5[_0x699b('0x36')],_0x495f7c['filters']));if(_0x5714f5['query'][_0x699b('0x40')]){_0x4ce291[_0x699b('0x3e')]=_[_0x699b('0x41')](_0x4ce291[_0x699b('0x3e')],{'$or':_['map'](_0x4ce291[_0x699b('0x39')],function(_0x3e3c61){var _0x40ca6a={};_0x40ca6a[_0x3e3c61]={'$like':'%'+_0x5714f5['query'][_0x699b('0x40')]+'%'};return _0x40ca6a;})});}_0x4ce291=_[_0x699b('0x41')]({},_0x4ce291,_0x5714f5[_0x699b('0x42')]);return _0x5acf90[_0x699b('0x90')](_0x4ce291);}})[_0x699b('0x28')](function(_0x2c7d8f){if(_0x2c7d8f){_0x5267ca=_0x2c7d8f[_0x699b('0x3b')];if(!_0x5714f5['query'][_0x699b('0x6c')](_0x699b('0x6d'))){_0x4ce291[_0x699b('0x1f')]=qs[_0x699b('0x1f')](_0x5714f5[_0x699b('0x36')][_0x699b('0x1f')]);_0x4ce291[_0x699b('0x1e')]=qs[_0x699b('0x1e')](_0x5714f5[_0x699b('0x36')][_0x699b('0x1e')]);}return _0x5acf90[_0x699b('0x90')](_0x4ce291);}})[_0x699b('0x28')](function(_0x2c3fab){if(_0x2c3fab){return _0x2c3fab?{'count':_0x5267ca,'rows':_0x2c3fab}:null;}})[_0x699b('0x28')](respondWithResult(_0x8c749b,null))['catch'](handleError(_0x8c749b,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 30fa364..24c3977 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0x7217,0x19e));var _0x7721=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x7217[_0x1c546c];return _0x2cc384;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe14b,0x93));var _0xbe14=function(_0x50b8c5,_0x19ae48){_0x50b8c5=_0x50b8c5-0x0;var _0x145ad5=_0xe14b[_0x50b8c5];return _0x145ad5;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 3fd42fc..77f2cd4 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 _0xf3cd=['path','rimraf','../../config/environment','exports','define','CmList','cm_lists','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x32a132,_0x48723d){var _0x32a726=function(_0x519b32){while(--_0x519b32){_0x32a132['push'](_0x32a132['shift']());}};_0x32a726(++_0x48723d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3a634e,_0x273db2){_0x3a634e=_0x3a634e-0x0;var _0x2ecddb=_0xf3cd[_0x3a634e];return _0x2ecddb;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./cmList.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb43b=['rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash','util','api','moment','bluebird','path'];(function(_0x180b51,_0x561264){var _0xadca9=function(_0x2f2fc3){while(--_0x2f2fc3){_0x180b51['push'](_0x180b51['shift']());}};_0xadca9(++_0x561264);}(_0xb43b,0x1b2));var _0xbb43=function(_0x14f133,_0x351396){_0x14f133=_0x14f133-0x0;var _0x3bcc42=_0xb43b[_0x14f133];return _0x3bcc42;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index e9b7d86..315cac5 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 _0x76e3=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmList,\x20%s,\x20%s'];(function(_0x3599a3,_0x303d80){var _0x428b04=function(_0x1559bf){while(--_0x1559bf){_0x3599a3['push'](_0x3599a3['shift']());}};_0x428b04(++_0x303d80);}(_0x76e3,0x14c));var _0x376e=function(_0x1ec792,_0xe9bdf7){_0x1ec792=_0x1ec792-0x0;var _0x3051a0=_0x76e3[_0x1ec792];return _0x3051a0;};'use strict';var _=require(_0x376e('0x0'));var util=require(_0x376e('0x1'));var moment=require(_0x376e('0x2'));var BPromise=require(_0x376e('0x3'));var rs=require(_0x376e('0x4'));var fs=require('fs');var Redis=require(_0x376e('0x5'));var db=require(_0x376e('0x6'))['db'];var utils=require(_0x376e('0x7'));var logger=require(_0x376e('0x8'))(_0x376e('0x9'));var config=require(_0x376e('0xa'));var jayson=require(_0x376e('0xb'));var client=jayson[_0x376e('0xc')][_0x376e('0xd')]({'port':0x232a});config[_0x376e('0xe')]=_[_0x376e('0xf')](config[_0x376e('0xe')],{'host':_0x376e('0x10'),'port':0x18eb});var socket=require(_0x376e('0x11'))(new Redis(config[_0x376e('0xe')]));require('./cmList.socket')[_0x376e('0x12')](socket);function respondWithRpcPromise(_0x5c3c69,_0x401c02,_0x18cf0d){return new BPromise(function(_0xf55405,_0x14d9db){return client[_0x376e('0x13')](_0x5c3c69,_0x18cf0d)[_0x376e('0x14')](function(_0x416860){logger[_0x376e('0x15')]('CmList,\x20%s,\x20%s',_0x401c02,'request\x20sent');logger[_0x376e('0x16')](_0x376e('0x17'),_0x401c02,_0x376e('0x18'),JSON[_0x376e('0x19')](_0x416860));if(_0x416860[_0x376e('0x1a')]){if(_0x416860['error']['code']===0x1f4){logger[_0x376e('0x1a')](_0x376e('0x1b'),_0x401c02,_0x416860[_0x376e('0x1a')][_0x376e('0x1c')]);return _0x14d9db(_0x416860[_0x376e('0x1a')][_0x376e('0x1c')]);}logger[_0x376e('0x1a')](_0x376e('0x1b'),_0x401c02,_0x416860[_0x376e('0x1a')][_0x376e('0x1c')]);return _0xf55405(_0x416860['error'][_0x376e('0x1c')]);}else{logger[_0x376e('0x15')](_0x376e('0x1b'),_0x401c02,_0x376e('0x18'));_0xf55405(_0x416860['result']['message']);}})[_0x376e('0x1d')](function(_0x1bfbde){logger[_0x376e('0x1a')](_0x376e('0x1b'),_0x401c02,_0x1bfbde);_0x14d9db(_0x1bfbde);});});} \ No newline at end of file +var _0xc4eb=['./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults'];(function(_0x3f31be,_0x56aabd){var _0x59837f=function(_0xdea951){while(--_0xdea951){_0x3f31be['push'](_0x3f31be['shift']());}};_0x59837f(++_0x56aabd);}(_0xc4eb,0xa9));var _0xbc4e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc4eb[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xbc4e('0x0'));var util=require(_0xbc4e('0x1'));var moment=require(_0xbc4e('0x2'));var BPromise=require(_0xbc4e('0x3'));var rs=require(_0xbc4e('0x4'));var fs=require('fs');var Redis=require(_0xbc4e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc4e('0x6'));var logger=require(_0xbc4e('0x7'))(_0xbc4e('0x8'));var config=require(_0xbc4e('0x9'));var jayson=require(_0xbc4e('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xbc4e('0xb')]=_[_0xbc4e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbc4e('0xb')]));require(_0xbc4e('0xd'))[_0xbc4e('0xe')](socket);function respondWithRpcPromise(_0x186bb3,_0x4e91d1,_0x55862e){return new BPromise(function(_0x11247c,_0x4b2cd6){return client[_0xbc4e('0xf')](_0x186bb3,_0x55862e)[_0xbc4e('0x10')](function(_0x76410d){logger[_0xbc4e('0x11')](_0xbc4e('0x12'),_0x4e91d1,'request\x20sent');logger['debug'](_0xbc4e('0x13'),_0x4e91d1,'request\x20sent',JSON[_0xbc4e('0x14')](_0x76410d));if(_0x76410d[_0xbc4e('0x15')]){if(_0x76410d['error'][_0xbc4e('0x16')]===0x1f4){logger[_0xbc4e('0x15')]('CmList,\x20%s,\x20%s',_0x4e91d1,_0x76410d[_0xbc4e('0x15')]['message']);return _0x4b2cd6(_0x76410d['error'][_0xbc4e('0x17')]);}logger['error'](_0xbc4e('0x12'),_0x4e91d1,_0x76410d['error']['message']);return _0x11247c(_0x76410d[_0xbc4e('0x15')][_0xbc4e('0x17')]);}else{logger[_0xbc4e('0x11')](_0xbc4e('0x12'),_0x4e91d1,_0xbc4e('0x18'));_0x11247c(_0x76410d[_0xbc4e('0x19')][_0xbc4e('0x17')]);}})['catch'](function(_0x5c0d81){logger[_0xbc4e('0x15')](_0xbc4e('0x12'),_0x4e91d1,_0x5c0d81);_0x4b2cd6(_0x5c0d81);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index ad8fdd1..cb53276 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 _0xe24f=['remove','emit','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x31cb0e,_0x14b7ea){var _0x4e7bc2=function(_0x19e568){while(--_0x19e568){_0x31cb0e['push'](_0x31cb0e['shift']());}};_0x4e7bc2(++_0x14b7ea);}(_0xe24f,0x1d6));var _0xfe24=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe24f[_0x20a584];return _0x4b41a8;};'use strict';var CmListEvents=require(_0xfe24('0x0'));var events=[_0xfe24('0x1'),_0xfe24('0x2'),'update'];function createListener(_0x5440b3,_0x1d3d75){return function(_0x3f26d2){_0x1d3d75[_0xfe24('0x3')](_0x5440b3,_0x3f26d2);};}function removeListener(_0x59af7a,_0xbc3dc){return function(){CmListEvents[_0xfe24('0x4')](_0x59af7a,_0xbc3dc);};}exports[_0xfe24('0x5')]=function(_0xd2e36){for(var _0x3a2cda=0x0,_0x4a55c2=events[_0xfe24('0x6')];_0x3a2cda<_0x4a55c2;_0x3a2cda++){var _0x2b04bd=events[_0x3a2cda];var _0x4f4b20=createListener(_0xfe24('0x7')+_0x2b04bd,_0xd2e36);CmListEvents['on'](_0x2b04bd,_0x4f4b20);}}; \ No newline at end of file +var _0x65c2=['emit','register','length','cmList:','./cmList.events','save','remove','update'];(function(_0x515923,_0x569d28){var _0x5827c9=function(_0x56d606){while(--_0x56d606){_0x515923['push'](_0x515923['shift']());}};_0x5827c9(++_0x569d28);}(_0x65c2,0x184));var _0x265c=function(_0x492063,_0xe743cd){_0x492063=_0x492063-0x0;var _0x5f2c12=_0x65c2[_0x492063];return _0x5f2c12;};'use strict';var CmListEvents=require(_0x265c('0x0'));var events=[_0x265c('0x1'),_0x265c('0x2'),_0x265c('0x3')];function createListener(_0x42c8d3,_0x5cb1d6){return function(_0xb2e443){_0x5cb1d6[_0x265c('0x4')](_0x42c8d3,_0xb2e443);};}function removeListener(_0x2ebbd4,_0x5a08df){return function(){CmListEvents['removeListener'](_0x2ebbd4,_0x5a08df);};}exports[_0x265c('0x5')]=function(_0xdd9b8){for(var _0x2003b2=0x0,_0x38f6bf=events[_0x265c('0x6')];_0x2003b2<_0x38f6bf;_0x2003b2++){var _0x5f2e6c=events[_0x2003b2];var _0x2651ab=createListener(_0x265c('0x7')+_0x5f2e6c,_0xdd9b8);CmListEvents['on'](_0x5f2e6c,_0x2651ab);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 2e9daf9..4eb805d 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 _0x3009=['connect-timeout','express','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/fields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','put','/:id','update','delete','removeDispositions','exports','multer','util','path'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x3009,0x152));var _0x9300=function(_0x67cdef,_0x4fab65){_0x67cdef=_0x67cdef-0x0;var _0xc78571=_0x3009[_0x67cdef];return _0xc78571;};'use strict';var multer=require(_0x9300('0x0'));var util=require(_0x9300('0x1'));var path=require(_0x9300('0x2'));var timeout=require(_0x9300('0x3'));var express=require(_0x9300('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9300('0x5'));var config=require(_0x9300('0x6'));var controller=require(_0x9300('0x7'));router[_0x9300('0x8')]('/',auth[_0x9300('0x9')](),controller[_0x9300('0xa')]);router[_0x9300('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x9300('0xb')]);router[_0x9300('0x8')]('/:id',auth[_0x9300('0x9')](),controller[_0x9300('0xc')]);router[_0x9300('0x8')](_0x9300('0xd'),auth[_0x9300('0x9')](),controller[_0x9300('0xe')]);router[_0x9300('0x8')](_0x9300('0xf'),auth[_0x9300('0x9')](),controller[_0x9300('0x10')]);router[_0x9300('0x8')]('/:id/contacts/csv',auth[_0x9300('0x9')](),controller['getContactsCsv']);router[_0x9300('0x8')](_0x9300('0x11'),auth['isAuthenticated'](),controller['getCustomFields']);router[_0x9300('0x8')](_0x9300('0x12'),auth[_0x9300('0x9')](),controller[_0x9300('0x13')]);router[_0x9300('0x14')]('/',auth[_0x9300('0x9')](),controller[_0x9300('0x15')]);router['post'](_0x9300('0xd'),auth[_0x9300('0x9')](),controller[_0x9300('0x16')]);router[_0x9300('0x14')](_0x9300('0xf'),auth[_0x9300('0x9')](),controller[_0x9300('0x17')]);router[_0x9300('0x14')](_0x9300('0x11'),auth[_0x9300('0x9')](),controller[_0x9300('0x18')]);router[_0x9300('0x14')](_0x9300('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0x9300('0x19')](_0x9300('0x1a'),auth[_0x9300('0x9')](),controller[_0x9300('0x1b')]);router[_0x9300('0x1c')](_0x9300('0x1a'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9300('0x1d')]);router[_0x9300('0x1c')](_0x9300('0x12'),auth[_0x9300('0x9')](),controller['removeAgents']);module[_0x9300('0x1e')]=router; \ No newline at end of file +var _0xcfe3=['Router','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','get','/describe','describe','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/fields','getAgents','post','addDisposition','addContacts','addCustomField','addAgents','put','/:id','update','delete','destroy','removeDispositions','/:id/users','removeAgents','exports','multer','util','path'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xcfe3,0xf5));var _0x3cfe=function(_0x35845d,_0x49a43b){_0x35845d=_0x35845d-0x0;var _0x5d98c0=_0xcfe3[_0x35845d];return _0x5d98c0;};'use strict';var multer=require(_0x3cfe('0x0'));var util=require(_0x3cfe('0x1'));var path=require(_0x3cfe('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3cfe('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3cfe('0x4'));var config=require(_0x3cfe('0x5'));var controller=require(_0x3cfe('0x6'));router['get']('/',auth[_0x3cfe('0x7')](),controller['index']);router[_0x3cfe('0x8')](_0x3cfe('0x9'),auth['isAuthenticated'](),controller[_0x3cfe('0xa')]);router[_0x3cfe('0x8')]('/:id',auth[_0x3cfe('0x7')](),controller[_0x3cfe('0xb')]);router[_0x3cfe('0x8')](_0x3cfe('0xc'),auth[_0x3cfe('0x7')](),controller[_0x3cfe('0xd')]);router[_0x3cfe('0x8')](_0x3cfe('0xe'),auth[_0x3cfe('0x7')](),controller['getContacts']);router[_0x3cfe('0x8')]('/:id/contacts/csv',auth['isAuthenticated'](),controller['getContactsCsv']);router[_0x3cfe('0x8')](_0x3cfe('0xf'),auth[_0x3cfe('0x7')](),controller['getCustomFields']);router['get']('/:id/users',auth[_0x3cfe('0x7')](),controller[_0x3cfe('0x10')]);router[_0x3cfe('0x11')]('/',auth[_0x3cfe('0x7')](),controller['create']);router[_0x3cfe('0x11')]('/:id/dispositions',auth[_0x3cfe('0x7')](),controller[_0x3cfe('0x12')]);router[_0x3cfe('0x11')](_0x3cfe('0xe'),auth[_0x3cfe('0x7')](),controller[_0x3cfe('0x13')]);router[_0x3cfe('0x11')](_0x3cfe('0xf'),auth['isAuthenticated'](),controller[_0x3cfe('0x14')]);router['post']('/:id/users',auth[_0x3cfe('0x7')](),controller[_0x3cfe('0x15')]);router[_0x3cfe('0x16')](_0x3cfe('0x17'),auth[_0x3cfe('0x7')](),controller[_0x3cfe('0x18')]);router[_0x3cfe('0x19')](_0x3cfe('0x17'),auth[_0x3cfe('0x7')](),controller[_0x3cfe('0x1a')]);router[_0x3cfe('0x19')](_0x3cfe('0xc'),auth[_0x3cfe('0x7')](),controller[_0x3cfe('0x1b')]);router[_0x3cfe('0x19')](_0x3cfe('0x1c'),auth['isAuthenticated'](),controller[_0x3cfe('0x1d')]);module[_0x3cfe('0x1e')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 5680444..9410ac3 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 _0x245d=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0xe62c94,_0x185f32){var _0x3c512e=function(_0x197406){while(--_0x197406){_0xe62c94['push'](_0xe62c94['shift']());}};_0x3c512e(++_0x185f32);}(_0x245d,0x11e));var _0xd245=function(_0x5aa253,_0x4c85e1){_0x5aa253=_0x5aa253-0x0;var _0x5b82ef=_0x245d[_0x5aa253];return _0x5b82ef;};'use strict';var Sequelize=require(_0xd245('0x0'));module[_0xd245('0x1')]={'name':{'type':Sequelize[_0xd245('0x2')],'get':function(_0x27775d){return this['getDataValue'](_0xd245('0x3'));}},'field':{'type':Sequelize[_0xd245('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xd245('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xd245('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x7f56=['STRING','sequelize'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7f56,0xc3));var _0x67f5=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x7f56[_0x12a2a6];return _0x1754ae;};'use strict';var Sequelize=require(_0x67f5('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2b6d09){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0x67f5('0x1')],'allowNull':![]},'operator':{'type':Sequelize[_0x67f5('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x67f5('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 0392a03..04b3130 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(_0x5454b1,_0x1936aa){var _0x3b9e41=function(_0x40a418){while(--_0x40a418){_0x5454b1['push'](_0x5454b1['shift']());}};_0x3b9e41(++_0x1936aa);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x10ccd2,_0x4fa7c6){var _0x3fecba=function(_0x120edb){while(--_0x120edb){_0x10ccd2['push'](_0x10ccd2['shift']());}};_0x3fecba(++_0x4fa7c6);}(_0x7a54,0x106));var _0x47a5=function(_0xde2f63,_0x4687f0){_0xde2f63=_0xde2f63-0x0;var _0x20aaeb=_0x7a54[_0xde2f63];return _0x20aaeb;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index da0da1b..f5a4aa4 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 _0xce1e=['path','rimraf','../../config/environment','./condition.attributes','Condition','tools_conditions','lodash','util','api','bluebird','request-promise'];(function(_0x396cda,_0x274c16){var _0x270107=function(_0x4f822e){while(--_0x4f822e){_0x396cda['push'](_0x396cda['shift']());}};_0x270107(++_0x274c16);}(_0xce1e,0x171));var _0xece1=function(_0x285d39,_0x587c0b){_0x285d39=_0x285d39-0x0;var _0x2cb8c3=_0xce1e[_0x285d39];return _0x2cb8c3;};'use strict';var _=require(_0xece1('0x0'));var util=require(_0xece1('0x1'));var logger=require('../../config/logger')(_0xece1('0x2'));var moment=require('moment');var BPromise=require(_0xece1('0x3'));var rp=require(_0xece1('0x4'));var fs=require('fs');var path=require(_0xece1('0x5'));var rimraf=require(_0xece1('0x6'));var config=require(_0xece1('0x7'));var attributes=require(_0xece1('0x8'));module['exports']=function(_0x4f4b99,_0x2553db){return _0x4f4b99['define'](_0xece1('0x9'),attributes,{'tableName':_0xece1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cbb=['define','Condition','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x5cbb,0x1e2));var _0xb5cb=function(_0x163386,_0x20fb61){_0x163386=_0x163386-0x0;var _0x4eec3d=_0x5cbb[_0x163386];return _0x4eec3d;};'use strict';var _=require(_0xb5cb('0x0'));var util=require(_0xb5cb('0x1'));var logger=require(_0xb5cb('0x2'))('api');var moment=require(_0xb5cb('0x3'));var BPromise=require(_0xb5cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5cb('0x5'));var rimraf=require(_0xb5cb('0x6'));var config=require(_0xb5cb('0x7'));var attributes=require(_0xb5cb('0x8'));module[_0xb5cb('0x9')]=function(_0x501b96,_0x2de72e){return _0x501b96[_0xb5cb('0xa')](_0xb5cb('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 503759d..037bb62 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 _0xa389=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1abd18,_0xf44d37){var _0x221f16=function(_0x2aa5f7){while(--_0x2aa5f7){_0x1abd18['push'](_0x1abd18['shift']());}};_0x221f16(++_0xf44d37);}(_0xa389,0xfe));var _0x9a38=function(_0x1e05f9,_0x369a14){_0x1e05f9=_0x1e05f9-0x0;var _0x132bbb=_0xa389[_0x1e05f9];return _0x132bbb;};'use strict';var _=require(_0x9a38('0x0'));var util=require('util');var moment=require(_0x9a38('0x1'));var BPromise=require(_0x9a38('0x2'));var rs=require(_0x9a38('0x3'));var fs=require('fs');var Redis=require(_0x9a38('0x4'));var db=require(_0x9a38('0x5'))['db'];var utils=require(_0x9a38('0x6'));var logger=require('../../config/logger')(_0x9a38('0x7'));var config=require(_0x9a38('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9a38('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x386f57,_0x1be649,_0x399e23){return new BPromise(function(_0x305d21,_0x3015c2){return client[_0x9a38('0xa')](_0x386f57,_0x399e23)[_0x9a38('0xb')](function(_0xc663e6){logger[_0x9a38('0xc')](_0x9a38('0xd'),_0x1be649,_0x9a38('0xe'));logger[_0x9a38('0xf')](_0x9a38('0x10'),_0x1be649,_0x9a38('0xe'),JSON[_0x9a38('0x11')](_0xc663e6));if(_0xc663e6[_0x9a38('0x12')]){if(_0xc663e6[_0x9a38('0x12')][_0x9a38('0x13')]===0x1f4){logger[_0x9a38('0x12')](_0x9a38('0xd'),_0x1be649,_0xc663e6['error'][_0x9a38('0x14')]);return _0x3015c2(_0xc663e6['error']['message']);}logger[_0x9a38('0x12')]('Condition,\x20%s,\x20%s',_0x1be649,_0xc663e6[_0x9a38('0x12')][_0x9a38('0x14')]);return _0x305d21(_0xc663e6[_0x9a38('0x12')]['message']);}else{logger[_0x9a38('0xc')](_0x9a38('0xd'),_0x1be649,_0x9a38('0xe'));_0x305d21(_0xc663e6[_0x9a38('0x15')][_0x9a38('0x14')]);}})[_0x9a38('0x16')](function(_0x17daf6){logger[_0x9a38('0x12')](_0x9a38('0xd'),_0x1be649,_0x17daf6);_0x3015c2(_0x17daf6);});});} \ No newline at end of file +var _0x86e1=['debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x520825,_0x1f1171){var _0x2ab8de=function(_0x2ec556){while(--_0x2ec556){_0x520825['push'](_0x520825['shift']());}};_0x2ab8de(++_0x1f1171);}(_0x86e1,0xd7));var _0x186e=function(_0x18fc70,_0x4a17e2){_0x18fc70=_0x18fc70-0x0;var _0xa7789c=_0x86e1[_0x18fc70];return _0xa7789c;};'use strict';var _=require('lodash');var util=require(_0x186e('0x0'));var moment=require(_0x186e('0x1'));var BPromise=require(_0x186e('0x2'));var rs=require(_0x186e('0x3'));var fs=require('fs');var Redis=require(_0x186e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x186e('0x5'))('rpc');var config=require(_0x186e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x186e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x392b8b,_0x4489ed,_0x12cef7){return new BPromise(function(_0x5ad32d,_0x59d95a){return client[_0x186e('0x8')](_0x392b8b,_0x12cef7)[_0x186e('0x9')](function(_0x4e9d52){logger[_0x186e('0xa')](_0x186e('0xb'),_0x4489ed,_0x186e('0xc'));logger[_0x186e('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x4489ed,_0x186e('0xc'),JSON[_0x186e('0xe')](_0x4e9d52));if(_0x4e9d52[_0x186e('0xf')]){if(_0x4e9d52[_0x186e('0xf')][_0x186e('0x10')]===0x1f4){logger['error'](_0x186e('0xb'),_0x4489ed,_0x4e9d52[_0x186e('0xf')][_0x186e('0x11')]);return _0x59d95a(_0x4e9d52[_0x186e('0xf')]['message']);}logger[_0x186e('0xf')](_0x186e('0xb'),_0x4489ed,_0x4e9d52[_0x186e('0xf')][_0x186e('0x11')]);return _0x5ad32d(_0x4e9d52[_0x186e('0xf')][_0x186e('0x11')]);}else{logger[_0x186e('0xa')](_0x186e('0xb'),_0x4489ed,_0x186e('0xc'));_0x5ad32d(_0x4e9d52[_0x186e('0x12')]['message']);}})['catch'](function(_0x2dc7e3){logger[_0x186e('0xf')](_0x186e('0xb'),_0x4489ed,_0x2dc7e3);_0x59d95a(_0x2dc7e3);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index b3ee71b..8de8549 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 _0xae79=['../../config/environment','put','/:id','update','delete','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x7b707c,_0x206242){var _0x2f8f35=function(_0x3e840b){while(--_0x3e840b){_0x7b707c['push'](_0x7b707c['shift']());}};_0x2f8f35(++_0x206242);}(_0xae79,0x77));var _0x9ae7=function(_0x35f047,_0x52b671){_0x35f047=_0x35f047-0x0;var _0x28c539=_0xae79[_0x35f047];return _0x28c539;};'use strict';var multer=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var path=require(_0x9ae7('0x2'));var timeout=require(_0x9ae7('0x3'));var express=require(_0x9ae7('0x4'));var router=express[_0x9ae7('0x5')]();var fs_extra=require(_0x9ae7('0x6'));var auth=require(_0x9ae7('0x7'));var interaction=require(_0x9ae7('0x8'));var config=require(_0x9ae7('0x9'));var controller=require('./condition.controller');router[_0x9ae7('0xa')](_0x9ae7('0xb'),auth['isAuthenticated'](),controller[_0x9ae7('0xc')]);router[_0x9ae7('0xd')]('/:id',auth[_0x9ae7('0xe')](),controller['destroy']);module[_0x9ae7('0xf')]=router; \ No newline at end of file +var _0x05d8=['isAuthenticated','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id'];(function(_0x481bdf,_0x231538){var _0x281a12=function(_0x264b18){while(--_0x264b18){_0x481bdf['push'](_0x481bdf['shift']());}};_0x281a12(++_0x231538);}(_0x05d8,0x146));var _0x805d=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x05d8[_0x34021d];return _0x16597b;};'use strict';var multer=require(_0x805d('0x0'));var util=require(_0x805d('0x1'));var path=require(_0x805d('0x2'));var timeout=require(_0x805d('0x3'));var express=require(_0x805d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x805d('0x5'));var interaction=require(_0x805d('0x6'));var config=require(_0x805d('0x7'));var controller=require(_0x805d('0x8'));router['put'](_0x805d('0x9'),auth[_0x805d('0xa')](),controller['update']);router['delete'](_0x805d('0x9'),auth[_0x805d('0xa')](),controller[_0x805d('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index a120762..9a9bbf4 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['STRING','sequelize'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xb7e7,0x121));var _0x7b7e=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xb7e7[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x57e950,_0x10e674){var _0x75660a=function(_0x2d4bf3){while(--_0x2d4bf3){_0x57e950['push'](_0x57e950['shift']());}};_0x75660a(++_0x10e674);}(_0xb10b,0x12a));var _0xbb10=function(_0xe1269d,_0x57b7c3){_0xe1269d=_0xe1269d-0x0;var _0x261ca1=_0xb10b[_0xe1269d];return _0x261ca1;};'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/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index c25195d..f1c663f 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 _0xe69f=['ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','Dashboard','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','update','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','findOne','DashboardItem','pick','getItems','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0xe69f,0x73));var _0xfe69=function(_0x3fa6c5,_0x12644e){_0x3fa6c5=_0x3fa6c5-0x0;var _0x373708=_0xe69f[_0x3fa6c5];return _0x373708;};'use strict';var emlformat=require(_0xfe69('0x0'));var rimraf=require(_0xfe69('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe69('0x2'));var rp=require(_0xfe69('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfe69('0x4'));var util=require('util');var path=require(_0xfe69('0x5'));var sox=require(_0xfe69('0x6'));var csv=require(_0xfe69('0x7'));var ejs=require(_0xfe69('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfe69('0x9'));var squel=require(_0xfe69('0xa'));var crypto=require(_0xfe69('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfe69('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfe69('0xd'));var Redis=require(_0xfe69('0xe'));var authService=require(_0xfe69('0xf'));var qs=require(_0xfe69('0x10'));var as=require(_0xfe69('0x11'));var hardwareService=require(_0xfe69('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xfe69('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfe69('0x14'));var db=require('../../mysqldb')['db'];config[_0xfe69('0x15')]=_[_0xfe69('0x16')](config[_0xfe69('0x15')],{'host':_0xfe69('0x17'),'port':0x18eb});var socket=require(_0xfe69('0x18'))(new Redis(config['redis']));require(_0xfe69('0x19'))[_0xfe69('0x1a')](socket);function respondWithStatusCode(_0x241108,_0x193264){_0x193264=_0x193264||0xcc;return function(_0x130aa3){if(_0x130aa3){return _0x241108[_0xfe69('0x1b')](_0x193264);}return _0x241108[_0xfe69('0x1c')](_0x193264)[_0xfe69('0x1d')]();};}function respondWithResult(_0x4b22d0,_0x20eb9b){_0x20eb9b=_0x20eb9b||0xc8;return function(_0x545021){if(_0x545021){return _0x4b22d0[_0xfe69('0x1c')](_0x20eb9b)[_0xfe69('0x1e')](_0x545021);}};}function respondWithFilteredResult(_0x2f7a81,_0x4488d0){return function(_0x489f1b){if(_0x489f1b){var _0x5231f4=typeof _0x4488d0['offset']===_0xfe69('0x1f')&&typeof _0x4488d0[_0xfe69('0x20')]===_0xfe69('0x1f');var _0x4bea83=_0x489f1b[_0xfe69('0x21')];var _0x552ee1=_0x5231f4?0x0:_0x4488d0['offset'];var _0x2adecf=_0x5231f4?_0x489f1b['count']:_0x4488d0[_0xfe69('0x22')]+_0x4488d0['limit'];var _0x2876f1;if(_0x2adecf>=_0x4bea83){_0x2adecf=_0x4bea83;_0x2876f1=0xc8;}else{_0x2876f1=0xce;}_0x2f7a81[_0xfe69('0x1c')](_0x2876f1);return _0x2f7a81[_0xfe69('0x23')](_0xfe69('0x24'),_0x552ee1+'-'+_0x2adecf+'/'+_0x4bea83)[_0xfe69('0x1e')](_0x489f1b);}return null;};}function patchUpdates(_0x5d7f40){return function(_0x1f09bc){try{jsonpatch[_0xfe69('0x25')](_0x1f09bc,_0x5d7f40,!![]);}catch(_0x2040ba){return BPromise[_0xfe69('0x26')](_0x2040ba);}return _0x1f09bc[_0xfe69('0x27')]();};}function saveUpdates(_0x46897b,_0x27dbeb){return function(_0xceb48e){if(_0xceb48e){return _0xceb48e['update'](_0x46897b)[_0xfe69('0x28')](function(_0x5f3245){return _0x5f3245;});}return null;};}function removeEntity(_0x1cb98b,_0x49172d){return function(_0x2ff063){if(_0x2ff063){return _0x2ff063['destroy']()[_0xfe69('0x28')](function(){var _0x39b9ee=_0x2ff063[_0xfe69('0x29')]({'plain':!![]});var _0x2345fe=_0xfe69('0x2a');return db[_0xfe69('0x2b')][_0xfe69('0x2c')]({'where':{'type':_0x2345fe,'resourceId':_0x39b9ee['id']}})[_0xfe69('0x28')](function(){return _0x2ff063;});})[_0xfe69('0x28')](function(){_0x1cb98b[_0xfe69('0x1c')](0xcc)[_0xfe69('0x1d')]();});}};}function handleEntityNotFound(_0x588a2e,_0x448522){return function(_0x48c8ab){if(!_0x48c8ab){_0x588a2e['sendStatus'](0x194);}return _0x48c8ab;};}function handleError(_0x235e1b,_0x218c56){_0x218c56=_0x218c56||0x1f4;return function(_0x38bb93){logger[_0xfe69('0x2d')](_0x38bb93[_0xfe69('0x2e')]);if(_0x38bb93[_0xfe69('0x2f')]){delete _0x38bb93['name'];}_0x235e1b[_0xfe69('0x1c')](_0x218c56)[_0xfe69('0x30')](_0x38bb93);};}exports[_0xfe69('0x31')]=function(_0x5076c4,_0x485038){var _0x393d9e={},_0xc7b2b7={},_0x1c91a8={'count':0x0,'rows':[]};var _0x181c07=_['map'](db['Dashboard'][_0xfe69('0x32')],function(_0x174d31){return{'name':_0x174d31[_0xfe69('0x33')],'type':_0x174d31[_0xfe69('0x34')][_0xfe69('0x35')]};});_0xc7b2b7[_0xfe69('0x36')]=_[_0xfe69('0x37')](_0x181c07,'name');_0xc7b2b7[_0xfe69('0x38')]=_[_0xfe69('0x39')](_0x5076c4[_0xfe69('0x38')]);_0xc7b2b7[_0xfe69('0x3a')]=_['intersection'](_0xc7b2b7[_0xfe69('0x36')],_0xc7b2b7['query']);_0x393d9e[_0xfe69('0x3b')]=_[_0xfe69('0x3c')](_0xc7b2b7[_0xfe69('0x36')],qs[_0xfe69('0x3d')](_0x5076c4[_0xfe69('0x38')]['fields']));_0x393d9e[_0xfe69('0x3b')]=_0x393d9e[_0xfe69('0x3b')][_0xfe69('0x3e')]?_0x393d9e['attributes']:_0xc7b2b7[_0xfe69('0x36')];if(!_0x5076c4[_0xfe69('0x38')][_0xfe69('0x3f')](_0xfe69('0x40'))){_0x393d9e['limit']=qs[_0xfe69('0x20')](_0x5076c4[_0xfe69('0x38')]['limit']);_0x393d9e[_0xfe69('0x22')]=qs['offset'](_0x5076c4[_0xfe69('0x38')]['offset']);}_0x393d9e[_0xfe69('0x41')]=qs[_0xfe69('0x42')](_0x5076c4[_0xfe69('0x38')]['sort']);_0x393d9e[_0xfe69('0x43')]=qs[_0xfe69('0x3a')](_['pick'](_0x5076c4[_0xfe69('0x38')],_0xc7b2b7['filters']),_0x181c07);if(_0x5076c4[_0xfe69('0x38')]['filter']){_0x393d9e[_0xfe69('0x43')]=_[_0xfe69('0x44')](_0x393d9e['where'],{'$or':_['map'](_0x181c07,function(_0x537e23){if(_0x537e23[_0xfe69('0x34')]!==_0xfe69('0x45')){var _0x19a80d={};_0x19a80d[_0x537e23['name']]={'$like':'%'+_0x5076c4[_0xfe69('0x38')][_0xfe69('0x46')]+'%'};return _0x19a80d;}})});}_0x393d9e=_['merge']({},_0x393d9e,_0x5076c4[_0xfe69('0x47')]);var _0x167ee7={'where':_0x393d9e[_0xfe69('0x43')]};return db[_0xfe69('0x48')][_0xfe69('0x21')](_0x167ee7)[_0xfe69('0x28')](function(_0x5a8367){_0x1c91a8[_0xfe69('0x21')]=_0x5a8367;if(_0x5076c4[_0xfe69('0x38')][_0xfe69('0x49')]){_0x393d9e[_0xfe69('0x4a')]=[{'all':!![]}];}return db[_0xfe69('0x48')][_0xfe69('0x4b')](_0x393d9e);})[_0xfe69('0x28')](function(_0x3cc001){_0x1c91a8[_0xfe69('0x4c')]=_0x3cc001;return _0x1c91a8;})[_0xfe69('0x28')](respondWithFilteredResult(_0x485038,_0x393d9e))['catch'](handleError(_0x485038,null));};exports[_0xfe69('0x4d')]=function(_0x3a9809,_0x1ca8dc){var _0x31b6b4={'raw':![],'where':{'id':_0x3a9809[_0xfe69('0x4e')]['id']}},_0x3bfd0c={};_0x3bfd0c['model']=_[_0xfe69('0x39')](db[_0xfe69('0x48')][_0xfe69('0x32')]);_0x3bfd0c[_0xfe69('0x38')]=_[_0xfe69('0x39')](_0x3a9809[_0xfe69('0x38')]);_0x3bfd0c[_0xfe69('0x3a')]=_[_0xfe69('0x3c')](_0x3bfd0c[_0xfe69('0x36')],_0x3bfd0c[_0xfe69('0x38')]);_0x31b6b4[_0xfe69('0x3b')]=_['intersection'](_0x3bfd0c[_0xfe69('0x36')],qs['fields'](_0x3a9809[_0xfe69('0x38')]['fields']));_0x31b6b4[_0xfe69('0x3b')]=_0x31b6b4[_0xfe69('0x3b')][_0xfe69('0x3e')]?_0x31b6b4[_0xfe69('0x3b')]:_0x3bfd0c['model'];if(_0x3a9809[_0xfe69('0x38')][_0xfe69('0x49')]){_0x31b6b4[_0xfe69('0x4a')]=[{'all':!![]}];}_0x31b6b4=_[_0xfe69('0x44')]({},_0x31b6b4,_0x3a9809[_0xfe69('0x47')]);return db[_0xfe69('0x48')][_0xfe69('0x4f')](_0x31b6b4)['then'](handleEntityNotFound(_0x1ca8dc,null))['then'](respondWithResult(_0x1ca8dc,null))[_0xfe69('0x50')](handleError(_0x1ca8dc,null));};exports[_0xfe69('0x51')]=function(_0x493d84,_0x4584ac){return db[_0xfe69('0x48')][_0xfe69('0x51')](_0x493d84[_0xfe69('0x52')],{})['then'](function(_0x5755f6){var _0x37cf4a=_0x493d84[_0xfe69('0x53')][_0xfe69('0x29')]({'plain':!![]});if(!_0x37cf4a)throw new Error(_0xfe69('0x54'));if(_0x37cf4a[_0xfe69('0x55')]==='user'){var _0x41b5f5=_0x5755f6[_0xfe69('0x29')]({'plain':!![]});var _0x4e2784=_0xfe69('0x2a');return db[_0xfe69('0x56')][_0xfe69('0x4f')]({'where':{'name':_0x4e2784,'userProfileId':_0x37cf4a[_0xfe69('0x57')]},'raw':!![]})[_0xfe69('0x28')](function(_0x44fdfa){if(_0x44fdfa&&_0x44fdfa['autoAssociation']===0x0){return db['UserProfileResource'][_0xfe69('0x51')]({'name':_0x41b5f5['name'],'resourceId':_0x41b5f5['id'],'type':_0x44fdfa['name'],'sectionId':_0x44fdfa['id']},{})[_0xfe69('0x28')](function(){return _0x5755f6;});}else{return _0x5755f6;}})[_0xfe69('0x50')](function(_0x246fa1){logger[_0xfe69('0x2d')](_0xfe69('0x58'),_0x246fa1);throw _0x246fa1;});}return _0x5755f6;})[_0xfe69('0x28')](respondWithResult(_0x4584ac,0xc9))[_0xfe69('0x50')](handleError(_0x4584ac,null));};exports[_0xfe69('0x59')]=function(_0x3620a7,_0xdbdeb1){var _0x19f304={'where':{'id':_0x3620a7[_0xfe69('0x4e')]['id']}},_0xcf457d={};_0xcf457d[_0xfe69('0x36')]=_[_0xfe69('0x39')](db[_0xfe69('0x48')][_0xfe69('0x32')]);_0x19f304[_0xfe69('0x3b')]=_[_0xfe69('0x3c')](_0xcf457d[_0xfe69('0x36')],qs[_0xfe69('0x3d')](_0x3620a7[_0xfe69('0x38')][_0xfe69('0x3d')]));_0x19f304[_0xfe69('0x3b')]=_0x19f304['attributes'][_0xfe69('0x3e')]?_0x19f304[_0xfe69('0x3b')]:_0xcf457d[_0xfe69('0x36')];if(_0x3620a7[_0xfe69('0x38')][_0xfe69('0x49')]){_0x19f304[_0xfe69('0x4a')]=[{'all':!![]}];}_0x19f304=_['merge']({},_0x19f304,_0x3620a7['options']);return db[_0xfe69('0x48')][_0xfe69('0x4f')](_0x19f304)[_0xfe69('0x28')](handleEntityNotFound(_0xdbdeb1,null))[_0xfe69('0x28')](function(_0x6e2169){if(_0x6e2169){var _0x4ea7c0=_0x6e2169['get']({'plain':!![]});_0x4ea7c0=qs[_0xfe69('0x5a')](_0x4ea7c0,['id',_0xfe69('0x5b'),_0xfe69('0x5c')]);_0x3620a7[_0xfe69('0x52')]=_[_0xfe69('0x5a')](_0x3620a7['body'],['id','createdAt',_0xfe69('0x5c')]);return db[_0xfe69('0x48')][_0xfe69('0x51')](_[_0xfe69('0x44')](_0x4ea7c0,_0x3620a7[_0xfe69('0x52')]),{'include':_0x3620a7['query'][_0xfe69('0x49')]?[{'all':!![]}]:undefined})[_0xfe69('0x28')](function(_0x12953f){var _0x35e52d=_0x3620a7['user'][_0xfe69('0x29')]({'plain':!![]});if(!_0x35e52d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35e52d[_0xfe69('0x55')]===_0xfe69('0x53')){var _0x254197=_0x12953f[_0xfe69('0x29')]({'plain':!![]});var _0x2b48d3=_0xfe69('0x2a');return db['UserProfileSection'][_0xfe69('0x4f')]({'where':{'name':_0x2b48d3,'userProfileId':_0x35e52d[_0xfe69('0x57')]},'raw':!![]})['then'](function(_0x2bd7b1){if(_0x2bd7b1&&_0x2bd7b1['autoAssociation']===0x0){return db[_0xfe69('0x2b')][_0xfe69('0x51')]({'name':_0x254197[_0xfe69('0x2f')],'resourceId':_0x254197['id'],'type':_0x2bd7b1['name'],'sectionId':_0x2bd7b1['id']},{})[_0xfe69('0x28')](function(){return _0x12953f;});}else{return _0x12953f;}})[_0xfe69('0x50')](function(_0x37ef29){logger['error'](_0xfe69('0x58'),_0x37ef29);throw _0x37ef29;});}return _0x12953f;});}})[_0xfe69('0x28')](respondWithResult(_0xdbdeb1,0xc9))['catch'](handleError(_0xdbdeb1,null));};exports[_0xfe69('0x5d')]=function(_0x2835c6,_0x219fb8){if(_0x2835c6[_0xfe69('0x52')]['id']){delete _0x2835c6[_0xfe69('0x52')]['id'];}return db[_0xfe69('0x48')]['find']({'where':{'id':_0x2835c6[_0xfe69('0x4e')]['id']}})[_0xfe69('0x28')](handleEntityNotFound(_0x219fb8,null))['then'](saveUpdates(_0x2835c6[_0xfe69('0x52')],null))[_0xfe69('0x28')](respondWithResult(_0x219fb8,null))[_0xfe69('0x50')](handleError(_0x219fb8,null));};exports[_0xfe69('0x2c')]=function(_0x118f57,_0x529dd7){return db[_0xfe69('0x48')][_0xfe69('0x4f')]({'where':{'id':_0x118f57[_0xfe69('0x4e')]['id']}})['then'](handleEntityNotFound(_0x529dd7,null))[_0xfe69('0x28')](removeEntity(_0x529dd7,null))[_0xfe69('0x50')](handleError(_0x529dd7,null));};function widgetAttributes(_0x5e09b0){try{switch(_0x5e09b0['type']){case'iframe':return[{'name':_0xfe69('0x5e'),'value':_0x5e09b0[_0xfe69('0x5e')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0[_0xfe69('0x5f')][0x0]?_0x5e09b0[_0xfe69('0x5f')][0x0][_0xfe69('0x60')]:undefined)||_0xfe69('0x61')}];case'custom':return[{'name':_0xfe69('0x62'),'value':_0x5e09b0['attrPath']||(_0x5e09b0['attrs']&&_0x5e09b0[_0xfe69('0x5f')][0x0]?_0x5e09b0[_0xfe69('0x5f')][0x0][_0xfe69('0x60')]:undefined)||''}];case _0xfe69('0x63'):return[{'name':'attrHourFormat','value':_0x5e09b0[_0xfe69('0x64')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0[_0xfe69('0x5f')][0x0]?_0x5e09b0[_0xfe69('0x5f')][0x0][_0xfe69('0x60')]:undefined)||_0xfe69('0x65')},{'name':'attrTimezone','value':_0x5e09b0['attrTimezone']||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0[_0xfe69('0x5f')][0x1]?_0x5e09b0[_0xfe69('0x5f')][0x1][_0xfe69('0x60')]:undefined)||'0.00'},{'name':_0xfe69('0x66'),'value':_0x5e09b0[_0xfe69('0x66')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0['attrs'][0x2]?_0x5e09b0['attrs'][0x2][_0xfe69('0x60')]:undefined)||0xc}];case _0xfe69('0x67'):return[{'name':_0xfe69('0x68'),'value':_0x5e09b0[_0xfe69('0x68')]||(_0x5e09b0['attrs']&&_0x5e09b0[_0xfe69('0x5f')][0x0]?_0x5e09b0[_0xfe69('0x5f')][0x0]['value']:undefined)||'total'},{'name':_0xfe69('0x69'),'value':_0x5e09b0['attrVoiceQueues']||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0[_0xfe69('0x5f')][0x1]?_0x5e09b0[_0xfe69('0x5f')][0x1][_0xfe69('0x60')]:undefined)||[]},{'name':_0xfe69('0x66'),'value':_0x5e09b0[_0xfe69('0x66')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0[_0xfe69('0x5f')][0x2]?_0x5e09b0[_0xfe69('0x5f')][0x2]['value']:undefined)||0x14}];case _0xfe69('0x6a'):case _0xfe69('0x6b'):return[{'name':_0xfe69('0x6c'),'value':_0x5e09b0[_0xfe69('0x6c')]||(_0x5e09b0['attrs']&&_0x5e09b0[_0xfe69('0x5f')][0x0]?_0x5e09b0[_0xfe69('0x5f')][0x0][_0xfe69('0x60')]:undefined)||_0xfe69('0x6d')},{'name':_0xfe69('0x6e'),'value':_0x5e09b0[_0xfe69('0x6e')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0['attrs'][0x1]?_0x5e09b0[_0xfe69('0x5f')][0x1][_0xfe69('0x60')]:undefined)||null},{'name':_0xfe69('0x6f'),'value':_0x5e09b0[_0xfe69('0x6f')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0['attrs'][0x2]?_0x5e09b0[_0xfe69('0x5f')][0x2][_0xfe69('0x60')]:undefined)||null},{'name':_0xfe69('0x69'),'value':_0x5e09b0[_0xfe69('0x69')]||(_0x5e09b0['attrs']&&_0x5e09b0[_0xfe69('0x5f')][0x3]?_0x5e09b0[_0xfe69('0x5f')][0x3][_0xfe69('0x60')]:undefined)||[]}];case _0xfe69('0x70'):return[{'name':_0xfe69('0x71'),'type':_0x5e09b0[_0xfe69('0x72')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0[_0xfe69('0x5f')][0x0]?_0x5e09b0[_0xfe69('0x5f')][0x0]['type']:undefined)||null,'value':_0x5e09b0[_0xfe69('0x71')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0['attrs'][0x0]?_0x5e09b0[_0xfe69('0x5f')][0x0]['value']:undefined)||null},{'name':_0xfe69('0x73'),'value':_0x5e09b0[_0xfe69('0x73')]||(_0x5e09b0[_0xfe69('0x5f')]&&_0x5e09b0[_0xfe69('0x5f')][0x1]?_0x5e09b0['attrs'][0x1][_0xfe69('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x1b3fc7){logger[_0xfe69('0x2d')]('widgetAttributes:\x20%s',JSON[_0xfe69('0x74')](_0x1b3fc7));return[];}}exports[_0xfe69('0x75')]=function(_0x50b7c2,_0x307c14,_0x1c4599){if(_0x50b7c2[_0xfe69('0x52')]['id']){delete _0x50b7c2[_0xfe69('0x52')]['id'];}return db['Dashboard'][_0xfe69('0x4f')]({'where':{'id':_0x50b7c2[_0xfe69('0x4e')]['id']}})[_0xfe69('0x28')](handleEntityNotFound(_0x307c14,null))['then'](function(_0x1d9efe){if(_0x1d9efe){_0x50b7c2['body'][_0xfe69('0x76')]=_0x1d9efe['id'];_0x50b7c2[_0xfe69('0x52')][_0xfe69('0x5f')]=widgetAttributes(_0x50b7c2[_0xfe69('0x52')]);return db['DashboardItem']['create'](_0x50b7c2[_0xfe69('0x52')]);}})[_0xfe69('0x28')](respondWithResult(_0x307c14,null))[_0xfe69('0x50')](handleError(_0x307c14,null));};exports['getItems']=function(_0x254058,_0xbdb9e,_0x585704){var _0x7882fa={};var _0x499e32={};var _0x347794;var _0xb88c1c;return db[_0xfe69('0x48')][_0xfe69('0x77')]({'where':{'id':_0x254058[_0xfe69('0x4e')]['id']}})[_0xfe69('0x28')](handleEntityNotFound(_0xbdb9e,null))['then'](function(_0x5cc10f){if(_0x5cc10f){_0x347794=_0x5cc10f;_0x499e32['model']=_['keys'](db[_0xfe69('0x78')][_0xfe69('0x32')]);_0x499e32[_0xfe69('0x38')]=_['keys'](_0x254058[_0xfe69('0x38')]);_0x499e32[_0xfe69('0x3a')]=_[_0xfe69('0x3c')](_0x499e32[_0xfe69('0x36')],_0x499e32[_0xfe69('0x38')]);_0x7882fa[_0xfe69('0x3b')]=_[_0xfe69('0x3c')](_0x499e32[_0xfe69('0x36')],qs[_0xfe69('0x3d')](_0x254058[_0xfe69('0x38')][_0xfe69('0x3d')]));_0x7882fa[_0xfe69('0x3b')]=_0x7882fa[_0xfe69('0x3b')][_0xfe69('0x3e')]?_0x7882fa[_0xfe69('0x3b')]:_0x499e32[_0xfe69('0x36')];_0x7882fa[_0xfe69('0x41')]=qs[_0xfe69('0x42')](_0x254058[_0xfe69('0x38')][_0xfe69('0x42')]);_0x7882fa[_0xfe69('0x43')]=qs[_0xfe69('0x3a')](_[_0xfe69('0x79')](_0x254058['query'],_0x499e32[_0xfe69('0x3a')]));if(_0x254058[_0xfe69('0x38')][_0xfe69('0x46')]){_0x7882fa[_0xfe69('0x43')]=_[_0xfe69('0x44')](_0x7882fa['where'],{'$or':_[_0xfe69('0x37')](_0x7882fa['attributes'],function(_0x38b015){var _0xe0e6e5={};_0xe0e6e5[_0x38b015]={'$like':'%'+_0x254058[_0xfe69('0x38')][_0xfe69('0x46')]+'%'};return _0xe0e6e5;})});}_0x7882fa=_['merge']({},_0x7882fa,_0x254058[_0xfe69('0x47')]);return _0x347794[_0xfe69('0x7a')](_0x7882fa);}})['then'](function(_0x193af3){if(_0x193af3){_0xb88c1c=_0x193af3[_0xfe69('0x3e')];if(!_0x254058['query'][_0xfe69('0x3f')](_0xfe69('0x40'))){_0x7882fa[_0xfe69('0x20')]=qs[_0xfe69('0x20')](_0x254058[_0xfe69('0x38')][_0xfe69('0x20')]);_0x7882fa[_0xfe69('0x22')]=qs[_0xfe69('0x22')](_0x254058['query'][_0xfe69('0x22')]);}return _0x347794[_0xfe69('0x7a')](_0x7882fa);}})[_0xfe69('0x28')](function(_0x42f57b){if(_0x42f57b){return _0x42f57b?{'count':_0xb88c1c,'rows':_0x42f57b}:null;}})[_0xfe69('0x28')](respondWithResult(_0xbdb9e,null))[_0xfe69('0x50')](handleError(_0xbdb9e,null));}; \ No newline at end of file +var _0xa28f=['jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','get','CustomDashboards','UserProfileResource','end','stack','name','send','map','Dashboard','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','role','userProfileId','autoAssociation','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel'];(function(_0x5970eb,_0x4fc983){var _0x388228=function(_0x21a474){while(--_0x21a474){_0x5970eb['push'](_0x5970eb['shift']());}};_0x388228(++_0x4fc983);}(_0xa28f,0x1c9));var _0xfa28=function(_0x442a5d,_0x2a6745){_0x442a5d=_0x442a5d-0x0;var _0x51d134=_0xa28f[_0x442a5d];return _0x51d134;};'use strict';var emlformat=require(_0xfa28('0x0'));var rimraf=require(_0xfa28('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfa28('0x2'));var rp=require(_0xfa28('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfa28('0x4'));var util=require(_0xfa28('0x5'));var path=require('path');var sox=require(_0xfa28('0x6'));var csv=require(_0xfa28('0x7'));var ejs=require(_0xfa28('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa28('0x9'));var squel=require(_0xfa28('0xa'));var crypto=require('crypto');var jsforce=require(_0xfa28('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfa28('0x7'));var querystring=require(_0xfa28('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfa28('0xd'));var qs=require(_0xfa28('0xe'));var as=require(_0xfa28('0xf'));var hardwareService=require(_0xfa28('0x10'));var logger=require(_0xfa28('0x11'))(_0xfa28('0x12'));var utils=require(_0xfa28('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xfa28('0x14')]=_['defaults'](config[_0xfa28('0x14')],{'host':_0xfa28('0x15'),'port':0x18eb});var socket=require(_0xfa28('0x16'))(new Redis(config[_0xfa28('0x14')]));require(_0xfa28('0x17'))[_0xfa28('0x18')](socket);function respondWithStatusCode(_0x38700a,_0x205aea){_0x205aea=_0x205aea||0xcc;return function(_0x152556){if(_0x152556){return _0x38700a[_0xfa28('0x19')](_0x205aea);}return _0x38700a['status'](_0x205aea)['end']();};}function respondWithResult(_0x51d53b,_0x328748){_0x328748=_0x328748||0xc8;return function(_0x326c5a){if(_0x326c5a){return _0x51d53b[_0xfa28('0x1a')](_0x328748)[_0xfa28('0x1b')](_0x326c5a);}};}function respondWithFilteredResult(_0x368176,_0x5297fe){return function(_0x2cbeef){if(_0x2cbeef){var _0x3d538a=typeof _0x5297fe[_0xfa28('0x1c')]==='undefined'&&typeof _0x5297fe[_0xfa28('0x1d')]===_0xfa28('0x1e');var _0x312741=_0x2cbeef[_0xfa28('0x1f')];var _0x5d756b=_0x3d538a?0x0:_0x5297fe[_0xfa28('0x1c')];var _0x499204=_0x3d538a?_0x2cbeef['count']:_0x5297fe[_0xfa28('0x1c')]+_0x5297fe['limit'];var _0x1f82f0;if(_0x499204>=_0x312741){_0x499204=_0x312741;_0x1f82f0=0xc8;}else{_0x1f82f0=0xce;}_0x368176[_0xfa28('0x1a')](_0x1f82f0);return _0x368176[_0xfa28('0x20')]('Content-Range',_0x5d756b+'-'+_0x499204+'/'+_0x312741)[_0xfa28('0x1b')](_0x2cbeef);}return null;};}function patchUpdates(_0x875e5){return function(_0x3b3851){try{jsonpatch[_0xfa28('0x21')](_0x3b3851,_0x875e5,!![]);}catch(_0x44a48e){return BPromise[_0xfa28('0x22')](_0x44a48e);}return _0x3b3851[_0xfa28('0x23')]();};}function saveUpdates(_0x23a6f5,_0x3737f8){return function(_0x464674){if(_0x464674){return _0x464674[_0xfa28('0x24')](_0x23a6f5)['then'](function(_0x466053){return _0x466053;});}return null;};}function removeEntity(_0x122444,_0x2a8c3b){return function(_0x192d3a){if(_0x192d3a){return _0x192d3a[_0xfa28('0x25')]()[_0xfa28('0x26')](function(){var _0x3732b7=_0x192d3a[_0xfa28('0x27')]({'plain':!![]});var _0x2f7032=_0xfa28('0x28');return db[_0xfa28('0x29')][_0xfa28('0x25')]({'where':{'type':_0x2f7032,'resourceId':_0x3732b7['id']}})['then'](function(){return _0x192d3a;});})[_0xfa28('0x26')](function(){_0x122444[_0xfa28('0x1a')](0xcc)[_0xfa28('0x2a')]();});}};}function handleEntityNotFound(_0x53550f,_0x4dfc76){return function(_0x2ca267){if(!_0x2ca267){_0x53550f[_0xfa28('0x19')](0x194);}return _0x2ca267;};}function handleError(_0xd31e96,_0x2619fe){_0x2619fe=_0x2619fe||0x1f4;return function(_0x4ad0e0){logger['error'](_0x4ad0e0[_0xfa28('0x2b')]);if(_0x4ad0e0[_0xfa28('0x2c')]){delete _0x4ad0e0[_0xfa28('0x2c')];}_0xd31e96[_0xfa28('0x1a')](_0x2619fe)[_0xfa28('0x2d')](_0x4ad0e0);};}exports['index']=function(_0x56db63,_0x234b17){var _0x585b4c={},_0xf0e5a4={},_0x3fb266={'count':0x0,'rows':[]};var _0x1e37fc=_[_0xfa28('0x2e')](db[_0xfa28('0x2f')][_0xfa28('0x30')],function(_0x3ddff7){return{'name':_0x3ddff7[_0xfa28('0x31')],'type':_0x3ddff7[_0xfa28('0x32')]['key']};});_0xf0e5a4['model']=_['map'](_0x1e37fc,_0xfa28('0x2c'));_0xf0e5a4[_0xfa28('0x33')]=_[_0xfa28('0x34')](_0x56db63['query']);_0xf0e5a4[_0xfa28('0x35')]=_[_0xfa28('0x36')](_0xf0e5a4[_0xfa28('0x37')],_0xf0e5a4[_0xfa28('0x33')]);_0x585b4c['attributes']=_[_0xfa28('0x36')](_0xf0e5a4[_0xfa28('0x37')],qs['fields'](_0x56db63['query'][_0xfa28('0x38')]));_0x585b4c[_0xfa28('0x39')]=_0x585b4c[_0xfa28('0x39')][_0xfa28('0x3a')]?_0x585b4c['attributes']:_0xf0e5a4[_0xfa28('0x37')];if(!_0x56db63[_0xfa28('0x33')]['hasOwnProperty'](_0xfa28('0x3b'))){_0x585b4c[_0xfa28('0x1d')]=qs[_0xfa28('0x1d')](_0x56db63[_0xfa28('0x33')]['limit']);_0x585b4c['offset']=qs[_0xfa28('0x1c')](_0x56db63[_0xfa28('0x33')][_0xfa28('0x1c')]);}_0x585b4c[_0xfa28('0x3c')]=qs[_0xfa28('0x3d')](_0x56db63[_0xfa28('0x33')][_0xfa28('0x3d')]);_0x585b4c['where']=qs['filters'](_[_0xfa28('0x3e')](_0x56db63[_0xfa28('0x33')],_0xf0e5a4['filters']),_0x1e37fc);if(_0x56db63[_0xfa28('0x33')][_0xfa28('0x3f')]){_0x585b4c['where']=_[_0xfa28('0x40')](_0x585b4c[_0xfa28('0x41')],{'$or':_['map'](_0x1e37fc,function(_0x49cc5f){if(_0x49cc5f['type']!==_0xfa28('0x42')){var _0x131af6={};_0x131af6[_0x49cc5f[_0xfa28('0x2c')]]={'$like':'%'+_0x56db63[_0xfa28('0x33')][_0xfa28('0x3f')]+'%'};return _0x131af6;}})});}_0x585b4c=_[_0xfa28('0x40')]({},_0x585b4c,_0x56db63[_0xfa28('0x43')]);var _0x53c61e={'where':_0x585b4c[_0xfa28('0x41')]};return db['Dashboard'][_0xfa28('0x1f')](_0x53c61e)[_0xfa28('0x26')](function(_0x250558){_0x3fb266[_0xfa28('0x1f')]=_0x250558;if(_0x56db63[_0xfa28('0x33')][_0xfa28('0x44')]){_0x585b4c[_0xfa28('0x45')]=[{'all':!![]}];}return db[_0xfa28('0x2f')]['findAll'](_0x585b4c);})['then'](function(_0x5e6d18){_0x3fb266[_0xfa28('0x46')]=_0x5e6d18;return _0x3fb266;})[_0xfa28('0x26')](respondWithFilteredResult(_0x234b17,_0x585b4c))[_0xfa28('0x47')](handleError(_0x234b17,null));};exports[_0xfa28('0x48')]=function(_0x27a4a1,_0x55e939){var _0x2e1501={'raw':![],'where':{'id':_0x27a4a1[_0xfa28('0x49')]['id']}},_0x408d80={};_0x408d80[_0xfa28('0x37')]=_[_0xfa28('0x34')](db['Dashboard']['rawAttributes']);_0x408d80[_0xfa28('0x33')]=_[_0xfa28('0x34')](_0x27a4a1[_0xfa28('0x33')]);_0x408d80[_0xfa28('0x35')]=_['intersection'](_0x408d80[_0xfa28('0x37')],_0x408d80[_0xfa28('0x33')]);_0x2e1501[_0xfa28('0x39')]=_[_0xfa28('0x36')](_0x408d80[_0xfa28('0x37')],qs[_0xfa28('0x38')](_0x27a4a1[_0xfa28('0x33')][_0xfa28('0x38')]));_0x2e1501['attributes']=_0x2e1501[_0xfa28('0x39')][_0xfa28('0x3a')]?_0x2e1501[_0xfa28('0x39')]:_0x408d80[_0xfa28('0x37')];if(_0x27a4a1[_0xfa28('0x33')]['includeAll']){_0x2e1501[_0xfa28('0x45')]=[{'all':!![]}];}_0x2e1501=_['merge']({},_0x2e1501,_0x27a4a1['options']);return db['Dashboard'][_0xfa28('0x4a')](_0x2e1501)[_0xfa28('0x26')](handleEntityNotFound(_0x55e939,null))[_0xfa28('0x26')](respondWithResult(_0x55e939,null))['catch'](handleError(_0x55e939,null));};exports[_0xfa28('0x4b')]=function(_0x958b47,_0x2a513b){return db['Dashboard']['create'](_0x958b47[_0xfa28('0x4c')],{})[_0xfa28('0x26')](function(_0x2b8a82){var _0x2f6fd6=_0x958b47[_0xfa28('0x4d')]['get']({'plain':!![]});if(!_0x2f6fd6)throw new Error(_0xfa28('0x4e'));if(_0x2f6fd6['role']==='user'){var _0x3f51e9=_0x2b8a82['get']({'plain':!![]});var _0x551642=_0xfa28('0x28');return db[_0xfa28('0x4f')][_0xfa28('0x4a')]({'where':{'name':_0x551642,'userProfileId':_0x2f6fd6['userProfileId']},'raw':!![]})[_0xfa28('0x26')](function(_0x579b80){if(_0x579b80&&_0x579b80['autoAssociation']===0x0){return db[_0xfa28('0x29')][_0xfa28('0x4b')]({'name':_0x3f51e9[_0xfa28('0x2c')],'resourceId':_0x3f51e9['id'],'type':_0x579b80[_0xfa28('0x2c')],'sectionId':_0x579b80['id']},{})['then'](function(){return _0x2b8a82;});}else{return _0x2b8a82;}})[_0xfa28('0x47')](function(_0x37218b){logger[_0xfa28('0x50')](_0xfa28('0x51'),_0x37218b);throw _0x37218b;});}return _0x2b8a82;})[_0xfa28('0x26')](respondWithResult(_0x2a513b,0xc9))['catch'](handleError(_0x2a513b,null));};exports['clone']=function(_0x2e24fd,_0x5a6148){var _0x44d7ca={'where':{'id':_0x2e24fd[_0xfa28('0x49')]['id']}},_0xf9690f={};_0xf9690f['model']=_['keys'](db[_0xfa28('0x2f')][_0xfa28('0x30')]);_0x44d7ca[_0xfa28('0x39')]=_[_0xfa28('0x36')](_0xf9690f['model'],qs['fields'](_0x2e24fd[_0xfa28('0x33')]['fields']));_0x44d7ca[_0xfa28('0x39')]=_0x44d7ca[_0xfa28('0x39')][_0xfa28('0x3a')]?_0x44d7ca[_0xfa28('0x39')]:_0xf9690f[_0xfa28('0x37')];if(_0x2e24fd[_0xfa28('0x33')]['includeAll']){_0x44d7ca[_0xfa28('0x45')]=[{'all':!![]}];}_0x44d7ca=_[_0xfa28('0x40')]({},_0x44d7ca,_0x2e24fd[_0xfa28('0x43')]);return db[_0xfa28('0x2f')][_0xfa28('0x4a')](_0x44d7ca)[_0xfa28('0x26')](handleEntityNotFound(_0x5a6148,null))['then'](function(_0x3ec674){if(_0x3ec674){var _0x356775=_0x3ec674['get']({'plain':!![]});_0x356775=qs[_0xfa28('0x52')](_0x356775,['id','createdAt',_0xfa28('0x53')]);_0x2e24fd[_0xfa28('0x4c')]=_[_0xfa28('0x52')](_0x2e24fd[_0xfa28('0x4c')],['id',_0xfa28('0x54'),_0xfa28('0x53')]);return db[_0xfa28('0x2f')][_0xfa28('0x4b')](_['merge'](_0x356775,_0x2e24fd['body']),{'include':_0x2e24fd[_0xfa28('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0xfa28('0x26')](function(_0x392d0d){var _0x46b6fa=_0x2e24fd[_0xfa28('0x4d')][_0xfa28('0x27')]({'plain':!![]});if(!_0x46b6fa)throw new Error(_0xfa28('0x4e'));if(_0x46b6fa[_0xfa28('0x55')]==='user'){var _0xeb0e7a=_0x392d0d[_0xfa28('0x27')]({'plain':!![]});var _0x258478=_0xfa28('0x28');return db[_0xfa28('0x4f')]['find']({'where':{'name':_0x258478,'userProfileId':_0x46b6fa[_0xfa28('0x56')]},'raw':!![]})[_0xfa28('0x26')](function(_0x47079a){if(_0x47079a&&_0x47079a[_0xfa28('0x57')]===0x0){return db['UserProfileResource'][_0xfa28('0x4b')]({'name':_0xeb0e7a[_0xfa28('0x2c')],'resourceId':_0xeb0e7a['id'],'type':_0x47079a[_0xfa28('0x2c')],'sectionId':_0x47079a['id']},{})['then'](function(){return _0x392d0d;});}else{return _0x392d0d;}})['catch'](function(_0x1a1d52){logger[_0xfa28('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a1d52);throw _0x1a1d52;});}return _0x392d0d;});}})[_0xfa28('0x26')](respondWithResult(_0x5a6148,0xc9))[_0xfa28('0x47')](handleError(_0x5a6148,null));};exports[_0xfa28('0x24')]=function(_0x2a592c,_0x1c6c05){if(_0x2a592c[_0xfa28('0x4c')]['id']){delete _0x2a592c[_0xfa28('0x4c')]['id'];}return db['Dashboard'][_0xfa28('0x4a')]({'where':{'id':_0x2a592c[_0xfa28('0x49')]['id']}})[_0xfa28('0x26')](handleEntityNotFound(_0x1c6c05,null))[_0xfa28('0x26')](saveUpdates(_0x2a592c['body'],null))[_0xfa28('0x26')](respondWithResult(_0x1c6c05,null))[_0xfa28('0x47')](handleError(_0x1c6c05,null));};exports[_0xfa28('0x25')]=function(_0x1d039c,_0x3ca917){return db['Dashboard'][_0xfa28('0x4a')]({'where':{'id':_0x1d039c[_0xfa28('0x49')]['id']}})['then'](handleEntityNotFound(_0x3ca917,null))['then'](removeEntity(_0x3ca917,null))[_0xfa28('0x47')](handleError(_0x3ca917,null));};function widgetAttributes(_0x2f7d49){try{switch(_0x2f7d49[_0xfa28('0x32')]){case _0xfa28('0x58'):return[{'name':_0xfa28('0x59'),'value':_0x2f7d49['attrUrl']||(_0x2f7d49[_0xfa28('0x5a')]&&_0x2f7d49['attrs'][0x0]?_0x2f7d49[_0xfa28('0x5a')][0x0]['value']:undefined)||'https://'}];case _0xfa28('0x5b'):return[{'name':'attrPath','value':_0x2f7d49[_0xfa28('0x5c')]||(_0x2f7d49['attrs']&&_0x2f7d49[_0xfa28('0x5a')][0x0]?_0x2f7d49[_0xfa28('0x5a')][0x0][_0xfa28('0x5d')]:undefined)||''}];case _0xfa28('0x5e'):return[{'name':_0xfa28('0x5f'),'value':_0x2f7d49['attrHourFormat']||(_0x2f7d49[_0xfa28('0x5a')]&&_0x2f7d49['attrs'][0x0]?_0x2f7d49['attrs'][0x0][_0xfa28('0x5d')]:undefined)||_0xfa28('0x60')},{'name':'attrTimezone','value':_0x2f7d49[_0xfa28('0x61')]||(_0x2f7d49['attrs']&&_0x2f7d49[_0xfa28('0x5a')][0x1]?_0x2f7d49[_0xfa28('0x5a')][0x1][_0xfa28('0x5d')]:undefined)||_0xfa28('0x62')},{'name':_0xfa28('0x63'),'value':_0x2f7d49[_0xfa28('0x63')]||(_0x2f7d49[_0xfa28('0x5a')]&&_0x2f7d49['attrs'][0x2]?_0x2f7d49['attrs'][0x2][_0xfa28('0x5d')]:undefined)||0xc}];case _0xfa28('0x64'):return[{'name':_0xfa28('0x65'),'value':_0x2f7d49[_0xfa28('0x65')]||(_0x2f7d49['attrs']&&_0x2f7d49[_0xfa28('0x5a')][0x0]?_0x2f7d49['attrs'][0x0]['value']:undefined)||_0xfa28('0x66')},{'name':_0xfa28('0x67'),'value':_0x2f7d49[_0xfa28('0x67')]||(_0x2f7d49[_0xfa28('0x5a')]&&_0x2f7d49['attrs'][0x1]?_0x2f7d49[_0xfa28('0x5a')][0x1][_0xfa28('0x5d')]:undefined)||[]},{'name':_0xfa28('0x63'),'value':_0x2f7d49[_0xfa28('0x63')]||(_0x2f7d49['attrs']&&_0x2f7d49['attrs'][0x2]?_0x2f7d49[_0xfa28('0x5a')][0x2][_0xfa28('0x5d')]:undefined)||0x14}];case _0xfa28('0x68'):case _0xfa28('0x69'):return[{'name':'attrSerie1','value':_0x2f7d49[_0xfa28('0x6a')]||(_0x2f7d49[_0xfa28('0x5a')]&&_0x2f7d49['attrs'][0x0]?_0x2f7d49['attrs'][0x0][_0xfa28('0x5d')]:undefined)||_0xfa28('0x66')},{'name':_0xfa28('0x6b'),'value':_0x2f7d49[_0xfa28('0x6b')]||(_0x2f7d49[_0xfa28('0x5a')]&&_0x2f7d49[_0xfa28('0x5a')][0x1]?_0x2f7d49[_0xfa28('0x5a')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x2f7d49['attrSerie3']||(_0x2f7d49[_0xfa28('0x5a')]&&_0x2f7d49['attrs'][0x2]?_0x2f7d49[_0xfa28('0x5a')][0x2][_0xfa28('0x5d')]:undefined)||null},{'name':_0xfa28('0x67'),'value':_0x2f7d49[_0xfa28('0x67')]||(_0x2f7d49[_0xfa28('0x5a')]&&_0x2f7d49[_0xfa28('0x5a')][0x3]?_0x2f7d49[_0xfa28('0x5a')][0x3][_0xfa28('0x5d')]:undefined)||[]}];case _0xfa28('0x6c'):return[{'name':_0xfa28('0x6d'),'type':_0x2f7d49[_0xfa28('0x6e')]||(_0x2f7d49[_0xfa28('0x5a')]&&_0x2f7d49[_0xfa28('0x5a')][0x0]?_0x2f7d49[_0xfa28('0x5a')][0x0][_0xfa28('0x32')]:undefined)||null,'value':_0x2f7d49[_0xfa28('0x6d')]||(_0x2f7d49[_0xfa28('0x5a')]&&_0x2f7d49[_0xfa28('0x5a')][0x0]?_0x2f7d49[_0xfa28('0x5a')][0x0][_0xfa28('0x5d')]:undefined)||null},{'name':'attrRefresh','value':_0x2f7d49[_0xfa28('0x6f')]||(_0x2f7d49['attrs']&&_0x2f7d49['attrs'][0x1]?_0x2f7d49[_0xfa28('0x5a')][0x1][_0xfa28('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x368a15){logger[_0xfa28('0x50')](_0xfa28('0x70'),JSON['stringify'](_0x368a15));return[];}}exports[_0xfa28('0x71')]=function(_0x482a0c,_0x41e37c,_0x194a9c){if(_0x482a0c[_0xfa28('0x4c')]['id']){delete _0x482a0c['body']['id'];}return db[_0xfa28('0x2f')]['find']({'where':{'id':_0x482a0c['params']['id']}})[_0xfa28('0x26')](handleEntityNotFound(_0x41e37c,null))['then'](function(_0x549b12){if(_0x549b12){_0x482a0c[_0xfa28('0x4c')][_0xfa28('0x72')]=_0x549b12['id'];_0x482a0c[_0xfa28('0x4c')][_0xfa28('0x5a')]=widgetAttributes(_0x482a0c[_0xfa28('0x4c')]);return db[_0xfa28('0x73')]['create'](_0x482a0c[_0xfa28('0x4c')]);}})[_0xfa28('0x26')](respondWithResult(_0x41e37c,null))[_0xfa28('0x47')](handleError(_0x41e37c,null));};exports['getItems']=function(_0x2cc77c,_0x231e01,_0x22f06d){var _0x535d1c={};var _0x15ad34={};var _0x416fe3;var _0x3ac817;return db['Dashboard']['findOne']({'where':{'id':_0x2cc77c[_0xfa28('0x49')]['id']}})[_0xfa28('0x26')](handleEntityNotFound(_0x231e01,null))['then'](function(_0x31c77f){if(_0x31c77f){_0x416fe3=_0x31c77f;_0x15ad34[_0xfa28('0x37')]=_[_0xfa28('0x34')](db[_0xfa28('0x73')][_0xfa28('0x30')]);_0x15ad34[_0xfa28('0x33')]=_[_0xfa28('0x34')](_0x2cc77c[_0xfa28('0x33')]);_0x15ad34[_0xfa28('0x35')]=_[_0xfa28('0x36')](_0x15ad34['model'],_0x15ad34[_0xfa28('0x33')]);_0x535d1c['attributes']=_[_0xfa28('0x36')](_0x15ad34[_0xfa28('0x37')],qs[_0xfa28('0x38')](_0x2cc77c[_0xfa28('0x33')][_0xfa28('0x38')]));_0x535d1c[_0xfa28('0x39')]=_0x535d1c[_0xfa28('0x39')][_0xfa28('0x3a')]?_0x535d1c[_0xfa28('0x39')]:_0x15ad34[_0xfa28('0x37')];_0x535d1c[_0xfa28('0x3c')]=qs[_0xfa28('0x3d')](_0x2cc77c['query'][_0xfa28('0x3d')]);_0x535d1c['where']=qs[_0xfa28('0x35')](_[_0xfa28('0x3e')](_0x2cc77c['query'],_0x15ad34[_0xfa28('0x35')]));if(_0x2cc77c[_0xfa28('0x33')][_0xfa28('0x3f')]){_0x535d1c[_0xfa28('0x41')]=_[_0xfa28('0x40')](_0x535d1c[_0xfa28('0x41')],{'$or':_[_0xfa28('0x2e')](_0x535d1c[_0xfa28('0x39')],function(_0x32c98e){var _0x1359d2={};_0x1359d2[_0x32c98e]={'$like':'%'+_0x2cc77c[_0xfa28('0x33')]['filter']+'%'};return _0x1359d2;})});}_0x535d1c=_[_0xfa28('0x40')]({},_0x535d1c,_0x2cc77c['options']);return _0x416fe3['getItems'](_0x535d1c);}})['then'](function(_0x1e636e){if(_0x1e636e){_0x3ac817=_0x1e636e['length'];if(!_0x2cc77c['query']['hasOwnProperty']('nolimit')){_0x535d1c[_0xfa28('0x1d')]=qs[_0xfa28('0x1d')](_0x2cc77c[_0xfa28('0x33')][_0xfa28('0x1d')]);_0x535d1c[_0xfa28('0x1c')]=qs[_0xfa28('0x1c')](_0x2cc77c[_0xfa28('0x33')]['offset']);}return _0x416fe3[_0xfa28('0x74')](_0x535d1c);}})['then'](function(_0x54c0df){if(_0x54c0df){return _0x54c0df?{'count':_0x3ac817,'rows':_0x54c0df}:null;}})['then'](respondWithResult(_0x231e01,null))[_0xfa28('0x47')](handleError(_0x231e01,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 239b3ad..496d0a3 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 _0x30cd=['emit','hasOwnProperty','exports','events','../../mysqldb','Dashboard','save','update'];(function(_0x3aec10,_0x234b92){var _0x41b475=function(_0x1e2f40){while(--_0x1e2f40){_0x3aec10['push'](_0x3aec10['shift']());}};_0x41b475(++_0x234b92);}(_0x30cd,0x1e3));var _0xd30c=function(_0x401fd6,_0xb28d69){_0x401fd6=_0x401fd6-0x0;var _0x451f8f=_0x30cd[_0x401fd6];return _0x451f8f;};'use strict';var EventEmitter=require(_0xd30c('0x0'));var Dashboard=require(_0xd30c('0x1'))['db'][_0xd30c('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd30c('0x3'),'afterUpdate':_0xd30c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x286d63){return function(_0x1226fd,_0x44aff3,_0x1381b9){DashboardEvents[_0xd30c('0x5')](_0x286d63+':'+_0x1226fd['id'],_0x1226fd);DashboardEvents[_0xd30c('0x5')](_0x286d63,_0x1226fd);_0x1381b9(null);};}for(var e in events){if(events[_0xd30c('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xd30c('0x7')]=DashboardEvents; \ No newline at end of file +var _0xca8b=['events','../../mysqldb','Dashboard','save','update','remove','emit','hook'];(function(_0x3933a3,_0x4063cf){var _0x26d133=function(_0x301c18){while(--_0x301c18){_0x3933a3['push'](_0x3933a3['shift']());}};_0x26d133(++_0x4063cf);}(_0xca8b,0x130));var _0xbca8=function(_0xf8a0a0,_0x55d29d){_0xf8a0a0=_0xf8a0a0-0x0;var _0x50506d=_0xca8b[_0xf8a0a0];return _0x50506d;};'use strict';var EventEmitter=require(_0xbca8('0x0'));var Dashboard=require(_0xbca8('0x1'))['db'][_0xbca8('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbca8('0x3'),'afterUpdate':_0xbca8('0x4'),'afterDestroy':_0xbca8('0x5')};function emitEvent(_0x11877f){return function(_0x48d383,_0x214d7d,_0x59a9be){DashboardEvents[_0xbca8('0x6')](_0x11877f+':'+_0x48d383['id'],_0x48d383);DashboardEvents['emit'](_0x11877f,_0x48d383);_0x59a9be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xbca8('0x7')](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 afa8b02..2055a19 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 _0x699c=['dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x1e7d5d,_0x8fbf6c){var _0x272207=function(_0x44ea51){while(--_0x44ea51){_0x1e7d5d['push'](_0x1e7d5d['shift']());}};_0x272207(++_0x8fbf6c);}(_0x699c,0x127));var _0xc699=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x699c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xc699('0x0'));var util=require(_0xc699('0x1'));var logger=require(_0xc699('0x2'))(_0xc699('0x3'));var moment=require(_0xc699('0x4'));var BPromise=require(_0xc699('0x5'));var rp=require(_0xc699('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc699('0x7'));var config=require(_0xc699('0x8'));var attributes=require(_0xc699('0x9'));module[_0xc699('0xa')]=function(_0x160857,_0x55bc89){return _0x160857[_0xc699('0xb')](_0xc699('0xc'),attributes,{'tableName':_0xc699('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b82=['Dashboard','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','define'];(function(_0x5cc65e,_0x3d5f63){var _0x58d03b=function(_0x48a7bf){while(--_0x48a7bf){_0x5cc65e['push'](_0x5cc65e['shift']());}};_0x58d03b(++_0x3d5f63);}(_0x8b82,0x1e1));var _0x28b8=function(_0xec16ad,_0x2ab9b7){_0xec16ad=_0xec16ad-0x0;var _0x3b8a02=_0x8b82[_0xec16ad];return _0x3b8a02;};'use strict';var _=require(_0x28b8('0x0'));var util=require(_0x28b8('0x1'));var logger=require('../../config/logger')(_0x28b8('0x2'));var moment=require(_0x28b8('0x3'));var BPromise=require(_0x28b8('0x4'));var rp=require(_0x28b8('0x5'));var fs=require('fs');var path=require(_0x28b8('0x6'));var rimraf=require(_0x28b8('0x7'));var config=require(_0x28b8('0x8'));var attributes=require(_0x28b8('0x9'));module['exports']=function(_0x52f266,_0x3c4b47){return _0x52f266[_0x28b8('0xa')](_0x28b8('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index fc7ceeb..80676a3 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 _0x46b7=['request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x597834,_0x159bb6){var _0x12da6c=function(_0x161c38){while(--_0x161c38){_0x597834['push'](_0x597834['shift']());}};_0x12da6c(++_0x159bb6);}(_0x46b7,0xf0));var _0x746b=function(_0xc6fb21,_0x23e9e9){_0xc6fb21=_0xc6fb21-0x0;var _0x398166=_0x46b7[_0xc6fb21];return _0x398166;};'use strict';var _=require(_0x746b('0x0'));var util=require(_0x746b('0x1'));var moment=require(_0x746b('0x2'));var BPromise=require(_0x746b('0x3'));var rs=require(_0x746b('0x4'));var fs=require('fs');var Redis=require(_0x746b('0x5'));var db=require(_0x746b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x746b('0x7'))(_0x746b('0x8'));var config=require(_0x746b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x746b('0xa')]['http']({'port':0x232a});config[_0x746b('0xb')]=_[_0x746b('0xc')](config[_0x746b('0xb')],{'host':_0x746b('0xd'),'port':0x18eb});var socket=require(_0x746b('0xe'))(new Redis(config[_0x746b('0xb')]));require(_0x746b('0xf'))['register'](socket);function respondWithRpcPromise(_0x321113,_0x4a34df,_0x42b22b){return new BPromise(function(_0x2442ad,_0x5941b1){return client[_0x746b('0x10')](_0x321113,_0x42b22b)[_0x746b('0x11')](function(_0x180a37){logger[_0x746b('0x12')](_0x746b('0x13'),_0x4a34df,_0x746b('0x14'));logger['debug'](_0x746b('0x15'),_0x4a34df,_0x746b('0x14'),JSON['stringify'](_0x180a37));if(_0x180a37[_0x746b('0x16')]){if(_0x180a37['error'][_0x746b('0x17')]===0x1f4){logger['error'](_0x746b('0x13'),_0x4a34df,_0x180a37[_0x746b('0x16')]['message']);return _0x5941b1(_0x180a37[_0x746b('0x16')][_0x746b('0x18')]);}logger['error'](_0x746b('0x13'),_0x4a34df,_0x180a37['error'][_0x746b('0x18')]);return _0x2442ad(_0x180a37[_0x746b('0x16')][_0x746b('0x18')]);}else{logger[_0x746b('0x12')](_0x746b('0x13'),_0x4a34df,_0x746b('0x14'));_0x2442ad(_0x180a37['result']['message']);}})[_0x746b('0x19')](function(_0x419d3a){logger['error'](_0x746b('0x13'),_0x4a34df,_0x419d3a);_0x5941b1(_0x419d3a);});});} \ No newline at end of file +var _0xf05b=['redis','localhost','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xf05b,0xbd));var _0xbf05=function(_0x34beef,_0x3760db){_0x34beef=_0x34beef-0x0;var _0x12f247=_0xf05b[_0x34beef];return _0x12f247;};'use strict';var _=require(_0xbf05('0x0'));var util=require(_0xbf05('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbf05('0x2'));var fs=require('fs');var Redis=require(_0xbf05('0x3'));var db=require(_0xbf05('0x4'))['db'];var utils=require(_0xbf05('0x5'));var logger=require(_0xbf05('0x6'))('rpc');var config=require(_0xbf05('0x7'));var jayson=require(_0xbf05('0x8'));var client=jayson[_0xbf05('0x9')][_0xbf05('0xa')]({'port':0x232a});config[_0xbf05('0xb')]=_['defaults'](config[_0xbf05('0xb')],{'host':_0xbf05('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbf05('0xb')]));require(_0xbf05('0xd'))[_0xbf05('0xe')](socket);function respondWithRpcPromise(_0x5b143c,_0x1b108c,_0x3a97ca){return new BPromise(function(_0x381f8c,_0x4c8903){return client[_0xbf05('0xf')](_0x5b143c,_0x3a97ca)[_0xbf05('0x10')](function(_0x1c8b5f){logger[_0xbf05('0x11')](_0xbf05('0x12'),_0x1b108c,_0xbf05('0x13'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x1b108c,'request\x20sent',JSON['stringify'](_0x1c8b5f));if(_0x1c8b5f[_0xbf05('0x14')]){if(_0x1c8b5f[_0xbf05('0x14')][_0xbf05('0x15')]===0x1f4){logger[_0xbf05('0x14')](_0xbf05('0x12'),_0x1b108c,_0x1c8b5f[_0xbf05('0x14')][_0xbf05('0x16')]);return _0x4c8903(_0x1c8b5f[_0xbf05('0x14')][_0xbf05('0x16')]);}logger['error'](_0xbf05('0x12'),_0x1b108c,_0x1c8b5f[_0xbf05('0x14')][_0xbf05('0x16')]);return _0x381f8c(_0x1c8b5f['error']['message']);}else{logger[_0xbf05('0x11')](_0xbf05('0x12'),_0x1b108c,_0xbf05('0x13'));_0x381f8c(_0x1c8b5f[_0xbf05('0x17')][_0xbf05('0x16')]);}})[_0xbf05('0x18')](function(_0x2455a5){logger[_0xbf05('0x14')]('Dashboard,\x20%s,\x20%s',_0x1b108c,_0x2455a5);_0x4c8903(_0x2455a5);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 362978e..4203eb9 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 _0x88fc=['removeListener','register','length','./dashboard.events','save','remove','update','emit'];(function(_0x20bc66,_0x2aef37){var _0x3c1b3c=function(_0x23c970){while(--_0x23c970){_0x20bc66['push'](_0x20bc66['shift']());}};_0x3c1b3c(++_0x2aef37);}(_0x88fc,0x193));var _0xc88f=function(_0x29c150,_0x46d349){_0x29c150=_0x29c150-0x0;var _0x5b1731=_0x88fc[_0x29c150];return _0x5b1731;};'use strict';var DashboardEvents=require(_0xc88f('0x0'));var events=[_0xc88f('0x1'),_0xc88f('0x2'),_0xc88f('0x3')];function createListener(_0xc6713d,_0x21f62e){return function(_0x352f38){_0x21f62e[_0xc88f('0x4')](_0xc6713d,_0x352f38);};}function removeListener(_0x36f0a1,_0x14f26d){return function(){DashboardEvents[_0xc88f('0x5')](_0x36f0a1,_0x14f26d);};}exports[_0xc88f('0x6')]=function(_0x408dc4){for(var _0x25ca72=0x0,_0x4e7a26=events[_0xc88f('0x7')];_0x25ca72<_0x4e7a26;_0x25ca72++){var _0x413335=events[_0x25ca72];var _0x198a16=createListener('dashboard:'+_0x413335,_0x408dc4);DashboardEvents['on'](_0x413335,_0x198a16);}}; \ No newline at end of file +var _0x76e7=['./dashboard.events','save','update','emit','dashboard:'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x76e7,0x181));var _0x776e=function(_0x2e6ab8,_0x4ea85c){_0x2e6ab8=_0x2e6ab8-0x0;var _0x16cba0=_0x76e7[_0x2e6ab8];return _0x16cba0;};'use strict';var DashboardEvents=require(_0x776e('0x0'));var events=[_0x776e('0x1'),'remove',_0x776e('0x2')];function createListener(_0xe21881,_0x5695a3){return function(_0x307f29){_0x5695a3[_0x776e('0x3')](_0xe21881,_0x307f29);};}function removeListener(_0x46427d,_0x32b870){return function(){DashboardEvents['removeListener'](_0x46427d,_0x32b870);};}exports['register']=function(_0x972f8d){for(var _0x319658=0x0,_0x41ba4c=events['length'];_0x319658<_0x41ba4c;_0x319658++){var _0x205b2f=events[_0x319658];var _0x25ca3c=createListener(_0x776e('0x4')+_0x205b2f,_0x972f8d);DashboardEvents['on'](_0x205b2f,_0x25ca3c);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 96bd353..7a210a0 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 _0xca80=['post','create','/:id/clone','/:id/items','addItem','put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','show','getItems'];(function(_0x3f499d,_0x4edf4b){var _0x4242c3=function(_0x14f3bd){while(--_0x14f3bd){_0x3f499d['push'](_0x3f499d['shift']());}};_0x4242c3(++_0x4edf4b);}(_0xca80,0x162));var _0x0ca8=function(_0x3b318a,_0x34f9a8){_0x3b318a=_0x3b318a-0x0;var _0x21ae80=_0xca80[_0x3b318a];return _0x21ae80;};'use strict';var multer=require(_0x0ca8('0x0'));var util=require(_0x0ca8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0ca8('0x2'));var router=express[_0x0ca8('0x3')]();var fs_extra=require(_0x0ca8('0x4'));var auth=require(_0x0ca8('0x5'));var interaction=require(_0x0ca8('0x6'));var config=require(_0x0ca8('0x7'));var controller=require(_0x0ca8('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0ca8('0x9')](_0x0ca8('0xa'),auth[_0x0ca8('0xb')](),controller[_0x0ca8('0xc')]);router[_0x0ca8('0x9')]('/:id/items',auth['isAuthenticated'](),controller[_0x0ca8('0xd')]);router[_0x0ca8('0xe')]('/',auth[_0x0ca8('0xb')](),controller[_0x0ca8('0xf')]);router[_0x0ca8('0xe')](_0x0ca8('0x10'),auth[_0x0ca8('0xb')](),controller['clone']);router['post'](_0x0ca8('0x11'),auth[_0x0ca8('0xb')](),controller[_0x0ca8('0x12')]);router[_0x0ca8('0x13')]('/:id',auth[_0x0ca8('0xb')](),controller[_0x0ca8('0x14')]);router['delete'](_0x0ca8('0xa'),auth[_0x0ca8('0xb')](),controller[_0x0ca8('0x15')]);module[_0x0ca8('0x16')]=router; \ No newline at end of file +var _0x236f=['post','create','/:id/clone','addItem','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems'];(function(_0x25df80,_0xa2aec5){var _0x17b6d0=function(_0x446155){while(--_0x446155){_0x25df80['push'](_0x25df80['shift']());}};_0x17b6d0(++_0xa2aec5);}(_0x236f,0xa5));var _0xf236=function(_0x22748e,_0xf692d8){_0x22748e=_0x22748e-0x0;var _0x49f814=_0x236f[_0x22748e];return _0x49f814;};'use strict';var multer=require(_0xf236('0x0'));var util=require(_0xf236('0x1'));var path=require('path');var timeout=require(_0xf236('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf236('0x3'));var auth=require(_0xf236('0x4'));var interaction=require(_0xf236('0x5'));var config=require(_0xf236('0x6'));var controller=require(_0xf236('0x7'));router[_0xf236('0x8')]('/',auth[_0xf236('0x9')](),controller[_0xf236('0xa')]);router[_0xf236('0x8')](_0xf236('0xb'),auth[_0xf236('0x9')](),controller[_0xf236('0xc')]);router[_0xf236('0x8')](_0xf236('0xd'),auth['isAuthenticated'](),controller[_0xf236('0xe')]);router[_0xf236('0xf')]('/',auth['isAuthenticated'](),controller[_0xf236('0x10')]);router['post'](_0xf236('0x11'),auth[_0xf236('0x9')](),controller['clone']);router[_0xf236('0xf')](_0xf236('0xd'),auth[_0xf236('0x9')](),controller[_0xf236('0x12')]);router['put'](_0xf236('0xb'),auth[_0xf236('0x9')](),controller['update']);router['delete'](_0xf236('0xb'),auth[_0xf236('0x9')](),controller[_0xf236('0x13')]);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 84932cc..08d7f84 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 _0x0295=['#ffffff','sequelize','exports','TEXT','long','parse','getDataValue','attrs','setDataValue','INTEGER','STRING'];(function(_0x91384,_0x545eef){var _0x44daa0=function(_0x5a0cc5){while(--_0x5a0cc5){_0x91384['push'](_0x91384['shift']());}};_0x44daa0(++_0x545eef);}(_0x0295,0x1f0));var _0x5029=function(_0x451130,_0x595ee2){_0x451130=_0x451130-0x0;var _0x68c08e=_0x0295[_0x451130];return _0x68c08e;};'use strict';var Sequelize=require(_0x5029('0x0'));var squel=require('squel');var _=require('lodash');module[_0x5029('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5029('0x2')](_0x5029('0x3')),'get':function(){try{return JSON[_0x5029('0x4')](this[_0x5029('0x5')](_0x5029('0x6')));}catch(_0x69a497){return[];}},'set':function(_0x200217){try{this[_0x5029('0x7')](_0x5029('0x6'),JSON['stringify'](_0x200217));}catch(_0x54978f){this['setDataValue'](_0x5029('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5029('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5029('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':_0x5029('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5029('0x9')]},'titleFontSize':{'type':Sequelize[_0x5029('0x8')],'defaultValue':0xc}}; \ No newline at end of file +var _0xeff8=['sequelize','squel','exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0xbc6fc0,_0x135ebf){var _0x254b84=function(_0x3ab153){while(--_0x3ab153){_0xbc6fc0['push'](_0xbc6fc0['shift']());}};_0x254b84(++_0x135ebf);}(_0xeff8,0x186));var _0x8eff=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xeff8[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x8eff('0x0'));var squel=require(_0x8eff('0x1'));var _=require('lodash');module[_0x8eff('0x2')]={'title':{'type':Sequelize[_0x8eff('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8eff('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x8eff('0x4')),'get':function(){try{return JSON[_0x8eff('0x5')](this[_0x8eff('0x6')](_0x8eff('0x7')));}catch(_0x4ac51c){return[];}},'set':function(_0x469641){try{this[_0x8eff('0x8')](_0x8eff('0x7'),JSON[_0x8eff('0x9')](_0x469641));}catch(_0x491f01){this[_0x8eff('0x8')](_0x8eff('0x7'),JSON[_0x8eff('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x8eff('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x8eff('0xa')]},'background':{'type':Sequelize[_0x8eff('0x3')],'allowNull':![],'defaultValue':_0x8eff('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8eff('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8eff('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index c614d72..b8bbba7 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 _0xb4c9=['error','name','send','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','include','merge','options','DashboardItem','catch','find','params','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','status','json','undefined','limit','count','offset','apply','reject','update','then','destroy'];(function(_0x2d23d8,_0xe79330){var _0x17bbff=function(_0x2ac01e){while(--_0x2ac01e){_0x2d23d8['push'](_0x2d23d8['shift']());}};_0x17bbff(++_0xe79330);}(_0xb4c9,0xe5));var _0x9b4c=function(_0x21637e,_0x3266b1){_0x21637e=_0x21637e-0x0;var _0x36617f=_0xb4c9[_0x21637e];return _0x36617f;};'use strict';var emlformat=require(_0x9b4c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9b4c('0x1'));var jsonpatch=require(_0x9b4c('0x2'));var rp=require(_0x9b4c('0x3'));var moment=require('moment');var BPromise=require(_0x9b4c('0x4'));var Mustache=require('mustache');var util=require(_0x9b4c('0x5'));var path=require(_0x9b4c('0x6'));var sox=require(_0x9b4c('0x7'));var csv=require(_0x9b4c('0x8'));var ejs=require(_0x9b4c('0x9'));var fs=require('fs');var fs_extra=require(_0x9b4c('0xa'));var _=require(_0x9b4c('0xb'));var squel=require('squel');var crypto=require(_0x9b4c('0xc'));var jsforce=require(_0x9b4c('0xd'));var deskjs=require(_0x9b4c('0xe'));var toCsv=require(_0x9b4c('0x8'));var querystring=require(_0x9b4c('0xf'));var Papa=require(_0x9b4c('0x10'));var Redis=require(_0x9b4c('0x11'));var authService=require(_0x9b4c('0x12'));var qs=require(_0x9b4c('0x13'));var as=require(_0x9b4c('0x14'));var hardwareService=require(_0x9b4c('0x15'));var logger=require(_0x9b4c('0x16'))(_0x9b4c('0x17'));var utils=require(_0x9b4c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9b4c('0x19'));var db=require(_0x9b4c('0x1a'))['db'];config['redis']=_[_0x9b4c('0x1b')](config[_0x9b4c('0x1c')],{'host':_0x9b4c('0x1d'),'port':0x18eb});var socket=require(_0x9b4c('0x1e'))(new Redis(config[_0x9b4c('0x1c')]));require(_0x9b4c('0x1f'))[_0x9b4c('0x20')](socket);function respondWithStatusCode(_0xa946bb,_0x2249b4){_0x2249b4=_0x2249b4||0xcc;return function(_0xd52936){if(_0xd52936){return _0xa946bb['sendStatus'](_0x2249b4);}return _0xa946bb['status'](_0x2249b4)['end']();};}function respondWithResult(_0x1b2a7f,_0x6b8f8d){_0x6b8f8d=_0x6b8f8d||0xc8;return function(_0x4afcc2){if(_0x4afcc2){return _0x1b2a7f[_0x9b4c('0x21')](_0x6b8f8d)[_0x9b4c('0x22')](_0x4afcc2);}};}function respondWithFilteredResult(_0x1b105e,_0x5aa46d){return function(_0xc15210){if(_0xc15210){var _0x320a1e=typeof _0x5aa46d['offset']===_0x9b4c('0x23')&&typeof _0x5aa46d[_0x9b4c('0x24')]==='undefined';var _0x46bae2=_0xc15210[_0x9b4c('0x25')];var _0x43466d=_0x320a1e?0x0:_0x5aa46d[_0x9b4c('0x26')];var _0x1219be=_0x320a1e?_0xc15210[_0x9b4c('0x25')]:_0x5aa46d['offset']+_0x5aa46d[_0x9b4c('0x24')];var _0x1d62b5;if(_0x1219be>=_0x46bae2){_0x1219be=_0x46bae2;_0x1d62b5=0xc8;}else{_0x1d62b5=0xce;}_0x1b105e[_0x9b4c('0x21')](_0x1d62b5);return _0x1b105e['set']('Content-Range',_0x43466d+'-'+_0x1219be+'/'+_0x46bae2)['json'](_0xc15210);}return null;};}function patchUpdates(_0x313349){return function(_0xc7e36c){try{jsonpatch[_0x9b4c('0x27')](_0xc7e36c,_0x313349,!![]);}catch(_0x551d27){return BPromise[_0x9b4c('0x28')](_0x551d27);}return _0xc7e36c['save']();};}function saveUpdates(_0x51ef95,_0x58fd02){return function(_0x401ccc){if(_0x401ccc){return _0x401ccc[_0x9b4c('0x29')](_0x51ef95)[_0x9b4c('0x2a')](function(_0x4d65f7){return _0x4d65f7;});}return null;};}function removeEntity(_0x470f05,_0x3dfe96){return function(_0x4e37ba){if(_0x4e37ba){return _0x4e37ba[_0x9b4c('0x2b')]()['then'](function(){_0x470f05['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15052b,_0x34392f){return function(_0x34e975){if(!_0x34e975){_0x15052b['sendStatus'](0x194);}return _0x34e975;};}function handleError(_0x131f12,_0x2d6f97){_0x2d6f97=_0x2d6f97||0x1f4;return function(_0x189829){logger[_0x9b4c('0x2c')](_0x189829['stack']);if(_0x189829[_0x9b4c('0x2d')]){delete _0x189829[_0x9b4c('0x2d')];}_0x131f12[_0x9b4c('0x21')](_0x2d6f97)[_0x9b4c('0x2e')](_0x189829);};}exports[_0x9b4c('0x2f')]=function(_0x2adf7e,_0x16047f){var _0x69f737={'raw':![],'where':{'id':_0x2adf7e['params']['id']}},_0x7117c9={};_0x7117c9[_0x9b4c('0x30')]=_[_0x9b4c('0x31')](db['DashboardItem'][_0x9b4c('0x32')]);_0x7117c9['query']=_[_0x9b4c('0x31')](_0x2adf7e[_0x9b4c('0x33')]);_0x7117c9[_0x9b4c('0x34')]=_[_0x9b4c('0x35')](_0x7117c9[_0x9b4c('0x30')],_0x7117c9[_0x9b4c('0x33')]);_0x69f737[_0x9b4c('0x36')]=_[_0x9b4c('0x35')](_0x7117c9['model'],qs['fields'](_0x2adf7e[_0x9b4c('0x33')][_0x9b4c('0x37')]));_0x69f737['attributes']=_0x69f737[_0x9b4c('0x36')]['length']?_0x69f737[_0x9b4c('0x36')]:_0x7117c9[_0x9b4c('0x30')];if(_0x2adf7e[_0x9b4c('0x33')]['includeAll']){_0x69f737[_0x9b4c('0x38')]=[{'all':!![]}];}_0x69f737=_[_0x9b4c('0x39')]({},_0x69f737,_0x2adf7e[_0x9b4c('0x3a')]);return db[_0x9b4c('0x3b')]['find'](_0x69f737)[_0x9b4c('0x2a')](handleEntityNotFound(_0x16047f,null))['then'](respondWithResult(_0x16047f,null))[_0x9b4c('0x3c')](handleError(_0x16047f,null));};exports[_0x9b4c('0x2b')]=function(_0x2fb192,_0x5d9a69){return db['DashboardItem'][_0x9b4c('0x3d')]({'where':{'id':_0x2fb192[_0x9b4c('0x3e')]['id']}})[_0x9b4c('0x2a')](handleEntityNotFound(_0x5d9a69,null))[_0x9b4c('0x2a')](removeEntity(_0x5d9a69,null))[_0x9b4c('0x3c')](handleError(_0x5d9a69,null));};function widgetAttributes(_0x4cb305){try{switch(_0x4cb305['type']){case _0x9b4c('0x3f'):return[{'name':_0x9b4c('0x40'),'value':_0x4cb305[_0x9b4c('0x40')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305[_0x9b4c('0x41')][0x0]?_0x4cb305[_0x9b4c('0x41')][0x0]['value']:undefined)||_0x9b4c('0x42')}];case _0x9b4c('0x43'):return[{'name':_0x9b4c('0x44'),'value':_0x4cb305[_0x9b4c('0x44')]||(_0x4cb305['attrs']&&_0x4cb305[_0x9b4c('0x41')][0x0]?_0x4cb305[_0x9b4c('0x41')][0x0][_0x9b4c('0x45')]:undefined)||''}];case _0x9b4c('0x46'):return[{'name':'attrHourFormat','value':_0x4cb305[_0x9b4c('0x47')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305['attrs'][0x0]?_0x4cb305[_0x9b4c('0x41')][0x0]['value']:undefined)||_0x9b4c('0x48')},{'name':_0x9b4c('0x49'),'value':_0x4cb305[_0x9b4c('0x49')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305[_0x9b4c('0x41')][0x1]?_0x4cb305[_0x9b4c('0x41')][0x1][_0x9b4c('0x45')]:undefined)||_0x9b4c('0x4a')},{'name':_0x9b4c('0x4b'),'value':_0x4cb305[_0x9b4c('0x4b')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305[_0x9b4c('0x41')][0x2]?_0x4cb305[_0x9b4c('0x41')][0x2][_0x9b4c('0x45')]:undefined)||0xc}];case _0x9b4c('0x4c'):return[{'name':'attrMetric','value':_0x4cb305['attrMetric']||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305[_0x9b4c('0x41')][0x0]?_0x4cb305[_0x9b4c('0x41')][0x0]['value']:undefined)||_0x9b4c('0x4d')},{'name':'attrVoiceQueues','value':_0x4cb305[_0x9b4c('0x4e')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305['attrs'][0x1]?_0x4cb305[_0x9b4c('0x41')][0x1][_0x9b4c('0x45')]:undefined)||[]},{'name':_0x9b4c('0x4b'),'value':_0x4cb305[_0x9b4c('0x4b')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305[_0x9b4c('0x41')][0x2]?_0x4cb305[_0x9b4c('0x41')][0x2][_0x9b4c('0x45')]:undefined)||0x14}];case _0x9b4c('0x4f'):case'pie-chart':return[{'name':_0x9b4c('0x50'),'value':_0x4cb305[_0x9b4c('0x50')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305[_0x9b4c('0x41')][0x0]?_0x4cb305['attrs'][0x0][_0x9b4c('0x45')]:undefined)||_0x9b4c('0x4d')},{'name':_0x9b4c('0x51'),'value':_0x4cb305[_0x9b4c('0x51')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305[_0x9b4c('0x41')][0x1]?_0x4cb305[_0x9b4c('0x41')][0x1][_0x9b4c('0x45')]:undefined)||null},{'name':'attrSerie3','value':_0x4cb305[_0x9b4c('0x52')]||(_0x4cb305['attrs']&&_0x4cb305[_0x9b4c('0x41')][0x2]?_0x4cb305['attrs'][0x2][_0x9b4c('0x45')]:undefined)||null},{'name':_0x9b4c('0x4e'),'value':_0x4cb305[_0x9b4c('0x4e')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305[_0x9b4c('0x41')][0x3]?_0x4cb305[_0x9b4c('0x41')][0x3][_0x9b4c('0x45')]:undefined)||[]}];case _0x9b4c('0x53'):return[{'name':_0x9b4c('0x54'),'type':_0x4cb305[_0x9b4c('0x55')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305['attrs'][0x0]?_0x4cb305[_0x9b4c('0x41')][0x0]['type']:undefined)||null,'value':_0x4cb305[_0x9b4c('0x54')]||(_0x4cb305[_0x9b4c('0x41')]&&_0x4cb305['attrs'][0x0]?_0x4cb305['attrs'][0x0]['value']:undefined)||null},{'name':_0x9b4c('0x56'),'value':_0x4cb305[_0x9b4c('0x56')]||(_0x4cb305['attrs']&&_0x4cb305[_0x9b4c('0x41')][0x1]?_0x4cb305['attrs'][0x1][_0x9b4c('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x3a44e4){logger[_0x9b4c('0x2c')](_0x9b4c('0x57'),JSON[_0x9b4c('0x58')](_0x3a44e4));return[];}}exports['create']=function(_0x55e21d,_0x42820c){if(_0x55e21d[_0x9b4c('0x59')]){_0x55e21d[_0x9b4c('0x59')]['attrs']=widgetAttributes(_0x55e21d[_0x9b4c('0x59')]);}return db['DashboardItem'][_0x9b4c('0x5a')](_0x55e21d['body'],{})[_0x9b4c('0x2a')](respondWithResult(_0x42820c,0xc9))[_0x9b4c('0x3c')](handleError(_0x42820c,null));};exports[_0x9b4c('0x29')]=function(_0x5c40df,_0x28010e){if(_0x5c40df[_0x9b4c('0x59')]['id']){delete _0x5c40df[_0x9b4c('0x59')]['id'];}_0x5c40df[_0x9b4c('0x59')]['attrs']=widgetAttributes(_0x5c40df[_0x9b4c('0x59')]);return db['DashboardItem'][_0x9b4c('0x3d')]({'where':{'id':_0x5c40df[_0x9b4c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x28010e,null))[_0x9b4c('0x2a')](saveUpdates(_0x5c40df[_0x9b4c('0x59')],null))[_0x9b4c('0x2a')](respondWithResult(_0x28010e,null))[_0x9b4c('0x3c')](handleError(_0x28010e,null));}; \ No newline at end of file +var _0xfbf9=['then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','query','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','type','attrUrl','attrs','value','https://','attrPath','clock','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update'];(function(_0x56af11,_0x494f5b){var _0x2b51d7=function(_0x843bd4){while(--_0x843bd4){_0x56af11['push'](_0x56af11['shift']());}};_0x2b51d7(++_0x494f5b);}(_0xfbf9,0x138));var _0x9fbf=function(_0x298152,_0x2bab07){_0x298152=_0x298152-0x0;var _0x58117d=_0xfbf9[_0x298152];return _0x58117d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9fbf('0x0'));var zipdir=require(_0x9fbf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9fbf('0x2'));var BPromise=require(_0x9fbf('0x3'));var Mustache=require(_0x9fbf('0x4'));var util=require(_0x9fbf('0x5'));var path=require(_0x9fbf('0x6'));var sox=require('sox');var csv=require(_0x9fbf('0x7'));var ejs=require(_0x9fbf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9fbf('0x9'));var squel=require('squel');var crypto=require(_0x9fbf('0xa'));var jsforce=require(_0x9fbf('0xb'));var deskjs=require(_0x9fbf('0xc'));var toCsv=require(_0x9fbf('0x7'));var querystring=require(_0x9fbf('0xd'));var Papa=require(_0x9fbf('0xe'));var Redis=require(_0x9fbf('0xf'));var authService=require(_0x9fbf('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fbf('0x11'))(_0x9fbf('0x12'));var utils=require('../../config/utils');var config=require(_0x9fbf('0x13'));var licenseUtil=require(_0x9fbf('0x14'));var db=require(_0x9fbf('0x15'))['db'];config['redis']=_[_0x9fbf('0x16')](config[_0x9fbf('0x17')],{'host':_0x9fbf('0x18'),'port':0x18eb});var socket=require(_0x9fbf('0x19'))(new Redis(config['redis']));require(_0x9fbf('0x1a'))[_0x9fbf('0x1b')](socket);function respondWithStatusCode(_0x55ac8b,_0x199895){_0x199895=_0x199895||0xcc;return function(_0x3775be){if(_0x3775be){return _0x55ac8b[_0x9fbf('0x1c')](_0x199895);}return _0x55ac8b[_0x9fbf('0x1d')](_0x199895)[_0x9fbf('0x1e')]();};}function respondWithResult(_0x3fdb47,_0x403af2){_0x403af2=_0x403af2||0xc8;return function(_0x2c2a81){if(_0x2c2a81){return _0x3fdb47[_0x9fbf('0x1d')](_0x403af2)[_0x9fbf('0x1f')](_0x2c2a81);}};}function respondWithFilteredResult(_0xa3a40e,_0x182a1b){return function(_0x536e5a){if(_0x536e5a){var _0x4cfa43=typeof _0x182a1b[_0x9fbf('0x20')]==='undefined'&&typeof _0x182a1b[_0x9fbf('0x21')]===_0x9fbf('0x22');var _0x5204cc=_0x536e5a[_0x9fbf('0x23')];var _0x1680eb=_0x4cfa43?0x0:_0x182a1b[_0x9fbf('0x20')];var _0x426284=_0x4cfa43?_0x536e5a[_0x9fbf('0x23')]:_0x182a1b['offset']+_0x182a1b[_0x9fbf('0x21')];var _0x1e23d8;if(_0x426284>=_0x5204cc){_0x426284=_0x5204cc;_0x1e23d8=0xc8;}else{_0x1e23d8=0xce;}_0xa3a40e[_0x9fbf('0x1d')](_0x1e23d8);return _0xa3a40e[_0x9fbf('0x24')](_0x9fbf('0x25'),_0x1680eb+'-'+_0x426284+'/'+_0x5204cc)['json'](_0x536e5a);}return null;};}function patchUpdates(_0x2742c6){return function(_0x1b188e){try{jsonpatch[_0x9fbf('0x26')](_0x1b188e,_0x2742c6,!![]);}catch(_0x46c826){return BPromise['reject'](_0x46c826);}return _0x1b188e['save']();};}function saveUpdates(_0x36eea5,_0x526598){return function(_0x5c1d2b){if(_0x5c1d2b){return _0x5c1d2b[_0x9fbf('0x27')](_0x36eea5)[_0x9fbf('0x28')](function(_0x2b3c38){return _0x2b3c38;});}return null;};}function removeEntity(_0x1b0164,_0x3ed577){return function(_0x3a858b){if(_0x3a858b){return _0x3a858b[_0x9fbf('0x29')]()[_0x9fbf('0x28')](function(){_0x1b0164[_0x9fbf('0x1d')](0xcc)[_0x9fbf('0x1e')]();});}};}function handleEntityNotFound(_0x31154a,_0x23e30f){return function(_0x223c6a){if(!_0x223c6a){_0x31154a[_0x9fbf('0x1c')](0x194);}return _0x223c6a;};}function handleError(_0x3e803c,_0x18d6eb){_0x18d6eb=_0x18d6eb||0x1f4;return function(_0x10217d){logger[_0x9fbf('0x2a')](_0x10217d[_0x9fbf('0x2b')]);if(_0x10217d['name']){delete _0x10217d[_0x9fbf('0x2c')];}_0x3e803c[_0x9fbf('0x1d')](_0x18d6eb)[_0x9fbf('0x2d')](_0x10217d);};}exports[_0x9fbf('0x2e')]=function(_0x43580b,_0x4de2b1){var _0x4b26c6={'raw':![],'where':{'id':_0x43580b[_0x9fbf('0x2f')]['id']}},_0x73fc6a={};_0x73fc6a[_0x9fbf('0x30')]=_[_0x9fbf('0x31')](db[_0x9fbf('0x32')]['rawAttributes']);_0x73fc6a['query']=_[_0x9fbf('0x31')](_0x43580b[_0x9fbf('0x33')]);_0x73fc6a[_0x9fbf('0x34')]=_[_0x9fbf('0x35')](_0x73fc6a[_0x9fbf('0x30')],_0x73fc6a[_0x9fbf('0x33')]);_0x4b26c6[_0x9fbf('0x36')]=_[_0x9fbf('0x35')](_0x73fc6a[_0x9fbf('0x30')],qs[_0x9fbf('0x37')](_0x43580b[_0x9fbf('0x33')][_0x9fbf('0x37')]));_0x4b26c6['attributes']=_0x4b26c6[_0x9fbf('0x36')][_0x9fbf('0x38')]?_0x4b26c6[_0x9fbf('0x36')]:_0x73fc6a[_0x9fbf('0x30')];if(_0x43580b[_0x9fbf('0x33')][_0x9fbf('0x39')]){_0x4b26c6[_0x9fbf('0x3a')]=[{'all':!![]}];}_0x4b26c6=_['merge']({},_0x4b26c6,_0x43580b[_0x9fbf('0x3b')]);return db[_0x9fbf('0x32')][_0x9fbf('0x3c')](_0x4b26c6)[_0x9fbf('0x28')](handleEntityNotFound(_0x4de2b1,null))[_0x9fbf('0x28')](respondWithResult(_0x4de2b1,null))[_0x9fbf('0x3d')](handleError(_0x4de2b1,null));};exports[_0x9fbf('0x29')]=function(_0x893341,_0x3f3baa){return db[_0x9fbf('0x32')][_0x9fbf('0x3c')]({'where':{'id':_0x893341[_0x9fbf('0x2f')]['id']}})[_0x9fbf('0x28')](handleEntityNotFound(_0x3f3baa,null))[_0x9fbf('0x28')](removeEntity(_0x3f3baa,null))[_0x9fbf('0x3d')](handleError(_0x3f3baa,null));};function widgetAttributes(_0x32ef40){try{switch(_0x32ef40[_0x9fbf('0x3e')]){case'iframe':return[{'name':_0x9fbf('0x3f'),'value':_0x32ef40['attrUrl']||(_0x32ef40['attrs']&&_0x32ef40[_0x9fbf('0x40')][0x0]?_0x32ef40[_0x9fbf('0x40')][0x0][_0x9fbf('0x41')]:undefined)||_0x9fbf('0x42')}];case'custom':return[{'name':_0x9fbf('0x43'),'value':_0x32ef40[_0x9fbf('0x43')]||(_0x32ef40[_0x9fbf('0x40')]&&_0x32ef40[_0x9fbf('0x40')][0x0]?_0x32ef40[_0x9fbf('0x40')][0x0]['value']:undefined)||''}];case _0x9fbf('0x44'):return[{'name':'attrHourFormat','value':_0x32ef40['attrHourFormat']||(_0x32ef40[_0x9fbf('0x40')]&&_0x32ef40[_0x9fbf('0x40')][0x0]?_0x32ef40['attrs'][0x0][_0x9fbf('0x41')]:undefined)||_0x9fbf('0x45')},{'name':'attrTimezone','value':_0x32ef40[_0x9fbf('0x46')]||(_0x32ef40['attrs']&&_0x32ef40['attrs'][0x1]?_0x32ef40[_0x9fbf('0x40')][0x1][_0x9fbf('0x41')]:undefined)||'0.00'},{'name':_0x9fbf('0x47'),'value':_0x32ef40[_0x9fbf('0x47')]||(_0x32ef40[_0x9fbf('0x40')]&&_0x32ef40[_0x9fbf('0x40')][0x2]?_0x32ef40[_0x9fbf('0x40')][0x2][_0x9fbf('0x41')]:undefined)||0xc}];case _0x9fbf('0x48'):return[{'name':_0x9fbf('0x49'),'value':_0x32ef40[_0x9fbf('0x49')]||(_0x32ef40[_0x9fbf('0x40')]&&_0x32ef40['attrs'][0x0]?_0x32ef40['attrs'][0x0][_0x9fbf('0x41')]:undefined)||_0x9fbf('0x4a')},{'name':_0x9fbf('0x4b'),'value':_0x32ef40[_0x9fbf('0x4b')]||(_0x32ef40[_0x9fbf('0x40')]&&_0x32ef40['attrs'][0x1]?_0x32ef40[_0x9fbf('0x40')][0x1][_0x9fbf('0x41')]:undefined)||[]},{'name':_0x9fbf('0x47'),'value':_0x32ef40[_0x9fbf('0x47')]||(_0x32ef40['attrs']&&_0x32ef40[_0x9fbf('0x40')][0x2]?_0x32ef40[_0x9fbf('0x40')][0x2][_0x9fbf('0x41')]:undefined)||0x14}];case _0x9fbf('0x4c'):case _0x9fbf('0x4d'):return[{'name':_0x9fbf('0x4e'),'value':_0x32ef40[_0x9fbf('0x4e')]||(_0x32ef40['attrs']&&_0x32ef40[_0x9fbf('0x40')][0x0]?_0x32ef40[_0x9fbf('0x40')][0x0]['value']:undefined)||'total'},{'name':_0x9fbf('0x4f'),'value':_0x32ef40[_0x9fbf('0x4f')]||(_0x32ef40['attrs']&&_0x32ef40[_0x9fbf('0x40')][0x1]?_0x32ef40[_0x9fbf('0x40')][0x1][_0x9fbf('0x41')]:undefined)||null},{'name':_0x9fbf('0x50'),'value':_0x32ef40['attrSerie3']||(_0x32ef40[_0x9fbf('0x40')]&&_0x32ef40[_0x9fbf('0x40')][0x2]?_0x32ef40[_0x9fbf('0x40')][0x2][_0x9fbf('0x41')]:undefined)||null},{'name':_0x9fbf('0x4b'),'value':_0x32ef40[_0x9fbf('0x4b')]||(_0x32ef40['attrs']&&_0x32ef40[_0x9fbf('0x40')][0x3]?_0x32ef40[_0x9fbf('0x40')][0x3][_0x9fbf('0x41')]:undefined)||[]}];case _0x9fbf('0x51'):return[{'name':_0x9fbf('0x52'),'type':_0x32ef40[_0x9fbf('0x53')]||(_0x32ef40[_0x9fbf('0x40')]&&_0x32ef40[_0x9fbf('0x40')][0x0]?_0x32ef40[_0x9fbf('0x40')][0x0]['type']:undefined)||null,'value':_0x32ef40[_0x9fbf('0x52')]||(_0x32ef40['attrs']&&_0x32ef40[_0x9fbf('0x40')][0x0]?_0x32ef40[_0x9fbf('0x40')][0x0]['value']:undefined)||null},{'name':_0x9fbf('0x54'),'value':_0x32ef40[_0x9fbf('0x54')]||(_0x32ef40[_0x9fbf('0x40')]&&_0x32ef40[_0x9fbf('0x40')][0x1]?_0x32ef40[_0x9fbf('0x40')][0x1][_0x9fbf('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x3605d4){logger[_0x9fbf('0x2a')]('widgetAttributes:\x20%s',JSON[_0x9fbf('0x55')](_0x3605d4));return[];}}exports[_0x9fbf('0x56')]=function(_0x4a60b8,_0x34ebc3){if(_0x4a60b8[_0x9fbf('0x57')]){_0x4a60b8['body'][_0x9fbf('0x40')]=widgetAttributes(_0x4a60b8['body']);}return db[_0x9fbf('0x32')][_0x9fbf('0x56')](_0x4a60b8[_0x9fbf('0x57')],{})[_0x9fbf('0x28')](respondWithResult(_0x34ebc3,0xc9))[_0x9fbf('0x3d')](handleError(_0x34ebc3,null));};exports[_0x9fbf('0x27')]=function(_0xfa502d,_0x32176a){if(_0xfa502d[_0x9fbf('0x57')]['id']){delete _0xfa502d[_0x9fbf('0x57')]['id'];}_0xfa502d[_0x9fbf('0x57')]['attrs']=widgetAttributes(_0xfa502d[_0x9fbf('0x57')]);return db[_0x9fbf('0x32')][_0x9fbf('0x3c')]({'where':{'id':_0xfa502d[_0x9fbf('0x2f')]['id']}})[_0x9fbf('0x28')](handleEntityNotFound(_0x32176a,null))['then'](saveUpdates(_0xfa502d[_0x9fbf('0x57')],null))[_0x9fbf('0x28')](respondWithResult(_0x32176a,null))[_0x9fbf('0x3d')](handleError(_0x32176a,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 5298014..f65d050 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 _0xb0dd=['hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','save','update','remove','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb0dd,0xc1));var _0xdb0d=function(_0x4654f7,_0x2d4205){_0x4654f7=_0x4654f7-0x0;var _0x14b3aa=_0xb0dd[_0x4654f7];return _0x14b3aa;};'use strict';var EventEmitter=require(_0xdb0d('0x0'));var DashboardItem=require(_0xdb0d('0x1'))['db'][_0xdb0d('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdb0d('0x3'),'afterUpdate':_0xdb0d('0x4'),'afterDestroy':_0xdb0d('0x5')};function emitEvent(_0x52a96f){return function(_0xe54f9d,_0x5bf0be,_0x4749d8){DashboardItemEvents[_0xdb0d('0x6')](_0x52a96f+':'+_0xe54f9d['id'],_0xe54f9d);DashboardItemEvents[_0xdb0d('0x6')](_0x52a96f,_0xe54f9d);_0x4749d8(null);};}for(var e in events){if(events[_0xdb0d('0x7')](e)){var event=events[e];DashboardItem[_0xdb0d('0x8')](e,emitEvent(event));}}module[_0xdb0d('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0xcd41=['hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xcd41,0x1e7));var _0x1cd4=function(_0x2bdd5d,_0x17c96d){_0x2bdd5d=_0x2bdd5d-0x0;var _0x1367ae=_0xcd41[_0x2bdd5d];return _0x1367ae;};'use strict';var EventEmitter=require(_0x1cd4('0x0'));var DashboardItem=require(_0x1cd4('0x1'))['db'][_0x1cd4('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1cd4('0x3')](0x0);var events={'afterCreate':_0x1cd4('0x4'),'afterUpdate':_0x1cd4('0x5'),'afterDestroy':_0x1cd4('0x6')};function emitEvent(_0x583eb8){return function(_0x1ae5c4,_0x12091a,_0x1cf376){DashboardItemEvents[_0x1cd4('0x7')](_0x583eb8+':'+_0x1ae5c4['id'],_0x1ae5c4);DashboardItemEvents[_0x1cd4('0x7')](_0x583eb8,_0x1ae5c4);_0x1cf376(null);};}for(var e in events){if(events[_0x1cd4('0x8')](e)){var event=events[e];DashboardItem[_0x1cd4('0x9')](e,emitEvent(event));}}module[_0x1cd4('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index afd1fdd..7656aef 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 _0x6d23=['moment','bluebird','request-promise','path','../../config/environment','./dashboardItem.attributes','define','dashboard_items','lodash','util','api'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0x6d23,0x6b));var _0x36d2=function(_0x8b3a8a,_0x1ce5de){_0x8b3a8a=_0x8b3a8a-0x0;var _0x4e9011=_0x6d23[_0x8b3a8a];return _0x4e9011;};'use strict';var _=require(_0x36d2('0x0'));var util=require(_0x36d2('0x1'));var logger=require('../../config/logger')(_0x36d2('0x2'));var moment=require(_0x36d2('0x3'));var BPromise=require(_0x36d2('0x4'));var rp=require(_0x36d2('0x5'));var fs=require('fs');var path=require(_0x36d2('0x6'));var rimraf=require('rimraf');var config=require(_0x36d2('0x7'));var attributes=require(_0x36d2('0x8'));module['exports']=function(_0x7e13ef,_0x584992){return _0x7e13ef[_0x36d2('0x9')]('DashboardItem',attributes,{'tableName':_0x36d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90a8=['path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','util','../../config/logger','moment','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x90a8,0x11a));var _0x890a=function(_0x4e5c2e,_0x13a47b){_0x4e5c2e=_0x4e5c2e-0x0;var _0x5940ea=_0x90a8[_0x4e5c2e];return _0x5940ea;};'use strict';var _=require('lodash');var util=require(_0x890a('0x0'));var logger=require(_0x890a('0x1'))('api');var moment=require(_0x890a('0x2'));var BPromise=require(_0x890a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x890a('0x4'));var rimraf=require(_0x890a('0x5'));var config=require(_0x890a('0x6'));var attributes=require(_0x890a('0x7'));module[_0x890a('0x8')]=function(_0x114346,_0x4780d0){return _0x114346[_0x890a('0x9')](_0x890a('0xa'),attributes,{'tableName':'dashboard_items','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 b37bee3..ff863c4 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 _0xa4f8=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x28949a,_0x3c4e18){var _0x220936=function(_0x27a8e8){while(--_0x27a8e8){_0x28949a['push'](_0x28949a['shift']());}};_0x220936(++_0x3c4e18);}(_0xa4f8,0x1f4));var _0x8a4f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa4f8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8a4f('0x0'));var util=require('util');var moment=require(_0x8a4f('0x1'));var BPromise=require(_0x8a4f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a4f('0x3'));var db=require(_0x8a4f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a4f('0x5'))(_0x8a4f('0x6'));var config=require(_0x8a4f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8a4f('0x8')]({'port':0x232a});config[_0x8a4f('0x9')]=_[_0x8a4f('0xa')](config[_0x8a4f('0x9')],{'host':_0x8a4f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8a4f('0x9')]));require(_0x8a4f('0xc'))[_0x8a4f('0xd')](socket);function respondWithRpcPromise(_0x112676,_0x56ba71,_0x7ec341){return new BPromise(function(_0x278a55,_0x52af90){return client[_0x8a4f('0xe')](_0x112676,_0x7ec341)['then'](function(_0x2fc9f3){logger[_0x8a4f('0xf')](_0x8a4f('0x10'),_0x56ba71,_0x8a4f('0x11'));logger[_0x8a4f('0x12')](_0x8a4f('0x13'),_0x56ba71,_0x8a4f('0x11'),JSON[_0x8a4f('0x14')](_0x2fc9f3));if(_0x2fc9f3[_0x8a4f('0x15')]){if(_0x2fc9f3['error']['code']===0x1f4){logger[_0x8a4f('0x15')](_0x8a4f('0x10'),_0x56ba71,_0x2fc9f3[_0x8a4f('0x15')]['message']);return _0x52af90(_0x2fc9f3[_0x8a4f('0x15')]['message']);}logger[_0x8a4f('0x15')]('DashboardItem,\x20%s,\x20%s',_0x56ba71,_0x2fc9f3[_0x8a4f('0x15')][_0x8a4f('0x16')]);return _0x278a55(_0x2fc9f3['error'][_0x8a4f('0x16')]);}else{logger[_0x8a4f('0xf')](_0x8a4f('0x10'),_0x56ba71,_0x8a4f('0x11'));_0x278a55(_0x2fc9f3[_0x8a4f('0x17')]['message']);}})[_0x8a4f('0x18')](function(_0x15c9e3){logger[_0x8a4f('0x15')](_0x8a4f('0x10'),_0x56ba71,_0x15c9e3);_0x52af90(_0x15c9e3);});});} \ No newline at end of file +var _0xa158=['../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','catch','util','moment','ioredis','../../config/utils'];(function(_0x3f993e,_0x2d5757){var _0x39c135=function(_0x39e00b){while(--_0x39e00b){_0x3f993e['push'](_0x3f993e['shift']());}};_0x39c135(++_0x2d5757);}(_0xa158,0x1be));var _0x8a15=function(_0x37b2a7,_0x3a3dad){_0x37b2a7=_0x37b2a7-0x0;var _0x3d8770=_0xa158[_0x37b2a7];return _0x3d8770;};'use strict';var _=require('lodash');var util=require(_0x8a15('0x0'));var moment=require(_0x8a15('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a15('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a15('0x3'));var logger=require(_0x8a15('0x4'))(_0x8a15('0x5'));var config=require('../../config/environment');var jayson=require(_0x8a15('0x6'));var client=jayson[_0x8a15('0x7')][_0x8a15('0x8')]({'port':0x232a});config[_0x8a15('0x9')]=_['defaults'](config[_0x8a15('0x9')],{'host':_0x8a15('0xa'),'port':0x18eb});var socket=require(_0x8a15('0xb'))(new Redis(config['redis']));require(_0x8a15('0xc'))[_0x8a15('0xd')](socket);function respondWithRpcPromise(_0x166971,_0x4762c8,_0x2363e9){return new BPromise(function(_0xfc1e09,_0x258a65){return client[_0x8a15('0xe')](_0x166971,_0x2363e9)[_0x8a15('0xf')](function(_0x1ee769){logger[_0x8a15('0x10')]('DashboardItem,\x20%s,\x20%s',_0x4762c8,'request\x20sent');logger[_0x8a15('0x11')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4762c8,_0x8a15('0x12'),JSON[_0x8a15('0x13')](_0x1ee769));if(_0x1ee769[_0x8a15('0x14')]){if(_0x1ee769[_0x8a15('0x14')][_0x8a15('0x15')]===0x1f4){logger[_0x8a15('0x14')](_0x8a15('0x16'),_0x4762c8,_0x1ee769[_0x8a15('0x14')][_0x8a15('0x17')]);return _0x258a65(_0x1ee769[_0x8a15('0x14')][_0x8a15('0x17')]);}logger[_0x8a15('0x14')](_0x8a15('0x16'),_0x4762c8,_0x1ee769[_0x8a15('0x14')][_0x8a15('0x17')]);return _0xfc1e09(_0x1ee769[_0x8a15('0x14')][_0x8a15('0x17')]);}else{logger[_0x8a15('0x10')](_0x8a15('0x16'),_0x4762c8,'request\x20sent');_0xfc1e09(_0x1ee769['result'][_0x8a15('0x17')]);}})[_0x8a15('0x18')](function(_0x1eb12a){logger[_0x8a15('0x14')](_0x8a15('0x16'),_0x4762c8,_0x1eb12a);_0x258a65(_0x1eb12a);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index e06b872..b9b177f 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 _0x2d45=['save','remove','update','emit','register','length','./dashboardItem.events'];(function(_0x4c6e7e,_0x151f05){var _0x5770ff=function(_0x192b65){while(--_0x192b65){_0x4c6e7e['push'](_0x4c6e7e['shift']());}};_0x5770ff(++_0x151f05);}(_0x2d45,0x195));var _0x52d4=function(_0x5eb3c9,_0x37673d){_0x5eb3c9=_0x5eb3c9-0x0;var _0x3608c2=_0x2d45[_0x5eb3c9];return _0x3608c2;};'use strict';var DashboardItemEvents=require(_0x52d4('0x0'));var events=[_0x52d4('0x1'),_0x52d4('0x2'),_0x52d4('0x3')];function createListener(_0x4eaa3a,_0x3e83be){return function(_0x59531c){_0x3e83be[_0x52d4('0x4')](_0x4eaa3a,_0x59531c);};}function removeListener(_0x3c08b5,_0x476227){return function(){DashboardItemEvents['removeListener'](_0x3c08b5,_0x476227);};}exports[_0x52d4('0x5')]=function(_0x16d373){for(var _0x3a52f6=0x0,_0x45ccc4=events[_0x52d4('0x6')];_0x3a52f6<_0x45ccc4;_0x3a52f6++){var _0x5be438=events[_0x3a52f6];var _0x1df239=createListener('dashboardItem:'+_0x5be438,_0x16d373);DashboardItemEvents['on'](_0x5be438,_0x1df239);}}; \ No newline at end of file +var _0x4a51=['remove','update','emit','removeListener','register','length','dashboardItem:','save'];(function(_0x630cf5,_0xff68d5){var _0x3e32d2=function(_0x3ae888){while(--_0x3ae888){_0x630cf5['push'](_0x630cf5['shift']());}};_0x3e32d2(++_0xff68d5);}(_0x4a51,0x187));var _0x14a5=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x4a51[_0x2dea24];return _0x309d58;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x14a5('0x0'),_0x14a5('0x1'),_0x14a5('0x2')];function createListener(_0xbd1493,_0x4d8034){return function(_0x4c307c){_0x4d8034[_0x14a5('0x3')](_0xbd1493,_0x4c307c);};}function removeListener(_0x58bde1,_0x2e9b0a){return function(){DashboardItemEvents[_0x14a5('0x4')](_0x58bde1,_0x2e9b0a);};}exports[_0x14a5('0x5')]=function(_0x26ab22){for(var _0x39e80d=0x0,_0x444460=events[_0x14a5('0x6')];_0x39e80d<_0x444460;_0x39e80d++){var _0x2dd71c=events[_0x39e80d];var _0x441036=createListener(_0x14a5('0x7')+_0x2dd71c,_0x26ab22);DashboardItemEvents['on'](_0x2dd71c,_0x441036);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ce23764..4661ada 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 _0x0253=['connect-timeout','express','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','post','create','update','delete','util','path'];(function(_0x3af881,_0xe63125){var _0x225dd9=function(_0x20d5be){while(--_0x20d5be){_0x3af881['push'](_0x3af881['shift']());}};_0x225dd9(++_0xe63125);}(_0x0253,0x11c));var _0x3025=function(_0x3215ea,_0x3dd690){_0x3215ea=_0x3215ea-0x0;var _0x3d6fd2=_0x0253[_0x3215ea];return _0x3d6fd2;};'use strict';var multer=require('multer');var util=require(_0x3025('0x0'));var path=require(_0x3025('0x1'));var timeout=require(_0x3025('0x2'));var express=require(_0x3025('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3025('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3025('0x5'));var controller=require('./dashboardItem.controller');router[_0x3025('0x6')](_0x3025('0x7'),auth[_0x3025('0x8')](),controller['show']);router[_0x3025('0x9')]('/',auth[_0x3025('0x8')](),controller[_0x3025('0xa')]);router['put'](_0x3025('0x7'),auth['isAuthenticated'](),controller[_0x3025('0xb')]);router[_0x3025('0xc')](_0x3025('0x7'),auth[_0x3025('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0d93=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x3a532e,_0x307180){var _0x2df8d6=function(_0x19d6cf){while(--_0x19d6cf){_0x3a532e['push'](_0x3a532e['shift']());}};_0x2df8d6(++_0x307180);}(_0x0d93,0x121));var _0x30d9=function(_0xf363f0,_0x3b5eeb){_0xf363f0=_0xf363f0-0x0;var _0x55a386=_0x0d93[_0xf363f0];return _0x55a386;};'use strict';var multer=require(_0x30d9('0x0'));var util=require(_0x30d9('0x1'));var path=require(_0x30d9('0x2'));var timeout=require('connect-timeout');var express=require(_0x30d9('0x3'));var router=express[_0x30d9('0x4')]();var fs_extra=require(_0x30d9('0x5'));var auth=require(_0x30d9('0x6'));var interaction=require(_0x30d9('0x7'));var config=require(_0x30d9('0x8'));var controller=require(_0x30d9('0x9'));router[_0x30d9('0xa')](_0x30d9('0xb'),auth[_0x30d9('0xc')](),controller[_0x30d9('0xd')]);router[_0x30d9('0xe')]('/',auth[_0x30d9('0xc')](),controller[_0x30d9('0xf')]);router[_0x30d9('0x10')](_0x30d9('0xb'),auth['isAuthenticated'](),controller[_0x30d9('0x11')]);router[_0x30d9('0x12')](_0x30d9('0xb'),auth[_0x30d9('0xc')](),controller[_0x30d9('0x13')]);module[_0x30d9('0x14')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 5018721..ef65081 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 _0xa2b3=['STRING','ENUM','first','third','exports'];(function(_0x549386,_0x45ad0f){var _0x12b4d4=function(_0x5a76e8){while(--_0x5a76e8){_0x549386['push'](_0x549386['shift']());}};_0x12b4d4(++_0x45ad0f);}(_0xa2b3,0x77));var _0x3a2b=function(_0x30df6a,_0x1c77b8){_0x30df6a=_0x30df6a-0x0;var _0xad223f=_0xa2b3[_0x30df6a];return _0xad223f;};'use strict';var Sequelize=require('sequelize');module[_0x3a2b('0x0')]={'name':{'type':Sequelize[_0x3a2b('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x3a2b('0x2')](_0x3a2b('0x3'),'second',_0x3a2b('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x3a2b('0x1')]}}; \ No newline at end of file +var _0x29d4=['exports','STRING','ENUM','second','third','first','sequelize'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0x29d4,0x172));var _0x429d=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x29d4[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0x429d('0x0'));module[_0x429d('0x1')]={'name':{'type':Sequelize[_0x429d('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x429d('0x3')]('first',_0x429d('0x4'),_0x429d('0x5')),'allowNull':![],'defaultValue':_0x429d('0x6')},'description':{'type':Sequelize[_0x429d('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 3a91102..fe9523d 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 _0xa166=['name','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','includeAll','include','findAll','show','params','length','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','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','Content-Range','apply','reject','save','update','then','destroy','Dispositions','UserProfileResource'];(function(_0x5a888a,_0x1f8460){var _0x14dd31=function(_0x202643){while(--_0x202643){_0x5a888a['push'](_0x5a888a['shift']());}};_0x14dd31(++_0x1f8460);}(_0xa166,0x1be));var _0x6a16=function(_0x360a38,_0x14fe94){_0x360a38=_0x360a38-0x0;var _0x1c6544=_0xa166[_0x360a38];return _0x1c6544;};'use strict';var emlformat=require(_0x6a16('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6a16('0x1'));var moment=require(_0x6a16('0x2'));var BPromise=require(_0x6a16('0x3'));var Mustache=require('mustache');var util=require(_0x6a16('0x4'));var path=require('path');var sox=require(_0x6a16('0x5'));var csv=require(_0x6a16('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a16('0x7'));var squel=require(_0x6a16('0x8'));var crypto=require(_0x6a16('0x9'));var jsforce=require(_0x6a16('0xa'));var deskjs=require(_0x6a16('0xb'));var toCsv=require(_0x6a16('0x6'));var querystring=require(_0x6a16('0xc'));var Papa=require('papaparse');var Redis=require(_0x6a16('0xd'));var authService=require(_0x6a16('0xe'));var qs=require(_0x6a16('0xf'));var as=require(_0x6a16('0x10'));var hardwareService=require(_0x6a16('0x11'));var logger=require(_0x6a16('0x12'))('api');var utils=require(_0x6a16('0x13'));var config=require(_0x6a16('0x14'));var licenseUtil=require(_0x6a16('0x15'));var db=require(_0x6a16('0x16'))['db'];function respondWithStatusCode(_0x1fc1e0,_0x4d55c2){_0x4d55c2=_0x4d55c2||0xcc;return function(_0x2a03ff){if(_0x2a03ff){return _0x1fc1e0['sendStatus'](_0x4d55c2);}return _0x1fc1e0[_0x6a16('0x17')](_0x4d55c2)[_0x6a16('0x18')]();};}function respondWithResult(_0x5c4888,_0x4829da){_0x4829da=_0x4829da||0xc8;return function(_0x38835f){if(_0x38835f){return _0x5c4888[_0x6a16('0x17')](_0x4829da)[_0x6a16('0x19')](_0x38835f);}};}function respondWithFilteredResult(_0x2195bf,_0x36a3ac){return function(_0x2d05a0){if(_0x2d05a0){var _0x530c32=typeof _0x36a3ac[_0x6a16('0x1a')]===_0x6a16('0x1b')&&typeof _0x36a3ac[_0x6a16('0x1c')]===_0x6a16('0x1b');var _0x244d01=_0x2d05a0[_0x6a16('0x1d')];var _0x3f36a7=_0x530c32?0x0:_0x36a3ac['offset'];var _0x4704fa=_0x530c32?_0x2d05a0['count']:_0x36a3ac[_0x6a16('0x1a')]+_0x36a3ac[_0x6a16('0x1c')];var _0x33f637;if(_0x4704fa>=_0x244d01){_0x4704fa=_0x244d01;_0x33f637=0xc8;}else{_0x33f637=0xce;}_0x2195bf['status'](_0x33f637);return _0x2195bf[_0x6a16('0x1e')](_0x6a16('0x1f'),_0x3f36a7+'-'+_0x4704fa+'/'+_0x244d01)['json'](_0x2d05a0);}return null;};}function patchUpdates(_0xe7d99f){return function(_0x5e0a5f){try{jsonpatch[_0x6a16('0x20')](_0x5e0a5f,_0xe7d99f,!![]);}catch(_0x2fcd9b){return BPromise[_0x6a16('0x21')](_0x2fcd9b);}return _0x5e0a5f[_0x6a16('0x22')]();};}function saveUpdates(_0x11e210,_0x8aa476){return function(_0x4b027d){if(_0x4b027d){return _0x4b027d[_0x6a16('0x23')](_0x11e210)[_0x6a16('0x24')](function(_0x2bf7ab){return _0x2bf7ab;});}return null;};}function removeEntity(_0x2d0d7e,_0x9cb29e){return function(_0x9fbd6f){if(_0x9fbd6f){return _0x9fbd6f[_0x6a16('0x25')]()['then'](function(){var _0x2051c9=_0x9fbd6f['get']({'plain':!![]});var _0x11dc41=_0x6a16('0x26');return db[_0x6a16('0x27')]['destroy']({'where':{'type':_0x11dc41,'resourceId':_0x2051c9['id']}})[_0x6a16('0x24')](function(){return _0x9fbd6f;});})[_0x6a16('0x24')](function(){_0x2d0d7e[_0x6a16('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b7880,_0x56402b){return function(_0x3ed0af){if(!_0x3ed0af){_0x5b7880['sendStatus'](0x194);}return _0x3ed0af;};}function handleError(_0x5d086d,_0x13cd10){_0x13cd10=_0x13cd10||0x1f4;return function(_0x3e4b67){logger['error'](_0x3e4b67['stack']);if(_0x3e4b67['name']){delete _0x3e4b67[_0x6a16('0x28')];}_0x5d086d[_0x6a16('0x17')](_0x13cd10)['send'](_0x3e4b67);};}exports[_0x6a16('0x29')]=function(_0x57faff,_0x2f0eee){var _0x1311c6={},_0x2262a0={},_0xb00fb3={'count':0x0,'rows':[]};var _0x2e76dd=_[_0x6a16('0x2a')](db[_0x6a16('0x2b')][_0x6a16('0x2c')],function(_0x365c9b){return{'name':_0x365c9b[_0x6a16('0x2d')],'type':_0x365c9b[_0x6a16('0x2e')][_0x6a16('0x2f')]};});_0x2262a0[_0x6a16('0x30')]=_[_0x6a16('0x2a')](_0x2e76dd,'name');_0x2262a0[_0x6a16('0x31')]=_[_0x6a16('0x32')](_0x57faff[_0x6a16('0x31')]);_0x2262a0[_0x6a16('0x33')]=_['intersection'](_0x2262a0[_0x6a16('0x30')],_0x2262a0[_0x6a16('0x31')]);_0x1311c6['attributes']=_[_0x6a16('0x34')](_0x2262a0[_0x6a16('0x30')],qs['fields'](_0x57faff[_0x6a16('0x31')][_0x6a16('0x35')]));_0x1311c6[_0x6a16('0x36')]=_0x1311c6[_0x6a16('0x36')]['length']?_0x1311c6['attributes']:_0x2262a0[_0x6a16('0x30')];if(!_0x57faff[_0x6a16('0x31')]['hasOwnProperty']('nolimit')){_0x1311c6['limit']=qs[_0x6a16('0x1c')](_0x57faff[_0x6a16('0x31')]['limit']);_0x1311c6[_0x6a16('0x1a')]=qs['offset'](_0x57faff[_0x6a16('0x31')][_0x6a16('0x1a')]);}_0x1311c6[_0x6a16('0x37')]=qs[_0x6a16('0x38')](_0x57faff[_0x6a16('0x31')]['sort']);_0x1311c6[_0x6a16('0x39')]=qs['filters'](_[_0x6a16('0x3a')](_0x57faff[_0x6a16('0x31')],_0x2262a0['filters']),_0x2e76dd);if(_0x57faff['query'][_0x6a16('0x3b')]){_0x1311c6[_0x6a16('0x39')]=_[_0x6a16('0x3c')](_0x1311c6[_0x6a16('0x39')],{'$or':_[_0x6a16('0x2a')](_0x2e76dd,function(_0x52ed1f){if(_0x52ed1f[_0x6a16('0x2e')]!=='VIRTUAL'){var _0x3f4207={};_0x3f4207[_0x52ed1f[_0x6a16('0x28')]]={'$like':'%'+_0x57faff[_0x6a16('0x31')][_0x6a16('0x3b')]+'%'};return _0x3f4207;}})});}_0x1311c6=_[_0x6a16('0x3c')]({},_0x1311c6,_0x57faff['options']);var _0x357311={'where':_0x1311c6[_0x6a16('0x39')]};return db['Disposition'][_0x6a16('0x1d')](_0x357311)['then'](function(_0x301878){_0xb00fb3['count']=_0x301878;if(_0x57faff['query'][_0x6a16('0x3d')]){_0x1311c6[_0x6a16('0x3e')]=[{'all':!![]}];}return db[_0x6a16('0x2b')][_0x6a16('0x3f')](_0x1311c6);})[_0x6a16('0x24')](function(_0x5e020e){_0xb00fb3['rows']=_0x5e020e;return _0xb00fb3;})[_0x6a16('0x24')](respondWithFilteredResult(_0x2f0eee,_0x1311c6))['catch'](handleError(_0x2f0eee,null));};exports[_0x6a16('0x40')]=function(_0x212ea5,_0x20ec12){var _0x3885c7={'raw':!![],'where':{'id':_0x212ea5[_0x6a16('0x41')]['id']}},_0x21973a={};_0x21973a['model']=_[_0x6a16('0x32')](db[_0x6a16('0x2b')][_0x6a16('0x2c')]);_0x21973a[_0x6a16('0x31')]=_[_0x6a16('0x32')](_0x212ea5[_0x6a16('0x31')]);_0x21973a[_0x6a16('0x33')]=_[_0x6a16('0x34')](_0x21973a[_0x6a16('0x30')],_0x21973a['query']);_0x3885c7[_0x6a16('0x36')]=_[_0x6a16('0x34')](_0x21973a[_0x6a16('0x30')],qs['fields'](_0x212ea5[_0x6a16('0x31')][_0x6a16('0x35')]));_0x3885c7[_0x6a16('0x36')]=_0x3885c7['attributes'][_0x6a16('0x42')]?_0x3885c7['attributes']:_0x21973a['model'];if(_0x212ea5['query']['includeAll']){_0x3885c7[_0x6a16('0x3e')]=[{'all':!![]}];}_0x3885c7=_[_0x6a16('0x3c')]({},_0x3885c7,_0x212ea5[_0x6a16('0x43')]);return db['Disposition'][_0x6a16('0x44')](_0x3885c7)['then'](handleEntityNotFound(_0x20ec12,null))[_0x6a16('0x24')](respondWithResult(_0x20ec12,null))[_0x6a16('0x45')](handleError(_0x20ec12,null));};exports[_0x6a16('0x46')]=function(_0x5b08cc,_0x4a80a2){return db[_0x6a16('0x2b')]['create'](_0x5b08cc[_0x6a16('0x47')],{})[_0x6a16('0x24')](function(_0x2d9ab){var _0x1a160b=_0x5b08cc[_0x6a16('0x48')][_0x6a16('0x49')]({'plain':!![]});if(!_0x1a160b)throw new Error(_0x6a16('0x4a'));if(_0x1a160b[_0x6a16('0x4b')]===_0x6a16('0x48')){var _0x4d74ec=_0x2d9ab[_0x6a16('0x49')]({'plain':!![]});var _0xe88dc3='Dispositions';return db[_0x6a16('0x4c')][_0x6a16('0x44')]({'where':{'name':_0xe88dc3,'userProfileId':_0x1a160b[_0x6a16('0x4d')]},'raw':!![]})[_0x6a16('0x24')](function(_0x37957d){if(_0x37957d&&_0x37957d[_0x6a16('0x4e')]===0x0){return db['UserProfileResource'][_0x6a16('0x46')]({'name':_0x4d74ec[_0x6a16('0x28')],'resourceId':_0x4d74ec['id'],'type':_0x37957d['name'],'sectionId':_0x37957d['id']},{})['then'](function(){return _0x2d9ab;});}else{return _0x2d9ab;}})[_0x6a16('0x45')](function(_0x4e5093){logger[_0x6a16('0x4f')](_0x6a16('0x50'),_0x4e5093);throw _0x4e5093;});}return _0x2d9ab;})[_0x6a16('0x24')](respondWithResult(_0x4a80a2,0xc9))[_0x6a16('0x45')](handleError(_0x4a80a2,null));};exports[_0x6a16('0x23')]=function(_0x305c8d,_0x5b0c3c){if(_0x305c8d[_0x6a16('0x47')]['id']){delete _0x305c8d['body']['id'];}return db['Disposition'][_0x6a16('0x44')]({'where':{'id':_0x305c8d[_0x6a16('0x41')]['id']}})[_0x6a16('0x24')](handleEntityNotFound(_0x5b0c3c,null))[_0x6a16('0x24')](saveUpdates(_0x305c8d[_0x6a16('0x47')],null))[_0x6a16('0x24')](respondWithResult(_0x5b0c3c,null))[_0x6a16('0x45')](handleError(_0x5b0c3c,null));};exports[_0x6a16('0x25')]=function(_0x42e981,_0x48028d){return db['Disposition'][_0x6a16('0x44')]({'where':{'id':_0x42e981[_0x6a16('0x41')]['id']}})['then'](handleEntityNotFound(_0x48028d,null))['then'](removeEntity(_0x48028d,null))['catch'](handleError(_0x48028d,null));}; \ No newline at end of file +var _0x6439=['nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','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','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty'];(function(_0x279f10,_0x8cc5ae){var _0x3c56ad=function(_0x348e94){while(--_0x348e94){_0x279f10['push'](_0x279f10['shift']());}};_0x3c56ad(++_0x8cc5ae);}(_0x6439,0x1ce));var _0x9643=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x6439[_0x2e4aa2];return _0x5e6092;};'use strict';var emlformat=require(_0x9643('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9643('0x1'));var rp=require(_0x9643('0x2'));var moment=require(_0x9643('0x3'));var BPromise=require(_0x9643('0x4'));var Mustache=require(_0x9643('0x5'));var util=require(_0x9643('0x6'));var path=require('path');var sox=require(_0x9643('0x7'));var csv=require('to-csv');var ejs=require(_0x9643('0x8'));var fs=require('fs');var fs_extra=require(_0x9643('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9643('0xa'));var jsforce=require(_0x9643('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9643('0xc'));var querystring=require(_0x9643('0xd'));var Papa=require(_0x9643('0xe'));var Redis=require('ioredis');var authService=require(_0x9643('0xf'));var qs=require(_0x9643('0x10'));var as=require(_0x9643('0x11'));var hardwareService=require(_0x9643('0x12'));var logger=require(_0x9643('0x13'))(_0x9643('0x14'));var utils=require(_0x9643('0x15'));var config=require(_0x9643('0x16'));var licenseUtil=require(_0x9643('0x17'));var db=require(_0x9643('0x18'))['db'];function respondWithStatusCode(_0x84cbbc,_0x170750){_0x170750=_0x170750||0xcc;return function(_0x1cedeb){if(_0x1cedeb){return _0x84cbbc[_0x9643('0x19')](_0x170750);}return _0x84cbbc[_0x9643('0x1a')](_0x170750)['end']();};}function respondWithResult(_0x4fb968,_0x1cf22f){_0x1cf22f=_0x1cf22f||0xc8;return function(_0x1fee9e){if(_0x1fee9e){return _0x4fb968['status'](_0x1cf22f)['json'](_0x1fee9e);}};}function respondWithFilteredResult(_0x2bdccb,_0x9e745d){return function(_0x265864){if(_0x265864){var _0x5ef405=typeof _0x9e745d[_0x9643('0x1b')]===_0x9643('0x1c')&&typeof _0x9e745d[_0x9643('0x1d')]==='undefined';var _0x138306=_0x265864[_0x9643('0x1e')];var _0x4817b0=_0x5ef405?0x0:_0x9e745d[_0x9643('0x1b')];var _0x4807b5=_0x5ef405?_0x265864[_0x9643('0x1e')]:_0x9e745d['offset']+_0x9e745d['limit'];var _0x22bf99;if(_0x4807b5>=_0x138306){_0x4807b5=_0x138306;_0x22bf99=0xc8;}else{_0x22bf99=0xce;}_0x2bdccb[_0x9643('0x1a')](_0x22bf99);return _0x2bdccb['set'](_0x9643('0x1f'),_0x4817b0+'-'+_0x4807b5+'/'+_0x138306)[_0x9643('0x20')](_0x265864);}return null;};}function patchUpdates(_0x2fd16a){return function(_0x295746){try{jsonpatch[_0x9643('0x21')](_0x295746,_0x2fd16a,!![]);}catch(_0x32c424){return BPromise[_0x9643('0x22')](_0x32c424);}return _0x295746[_0x9643('0x23')]();};}function saveUpdates(_0x3c07b5,_0x36fe69){return function(_0x300c39){if(_0x300c39){return _0x300c39[_0x9643('0x24')](_0x3c07b5)[_0x9643('0x25')](function(_0x3f470f){return _0x3f470f;});}return null;};}function removeEntity(_0x3a6292,_0x4a642f){return function(_0x56eb21){if(_0x56eb21){return _0x56eb21[_0x9643('0x26')]()['then'](function(){var _0x389fe5=_0x56eb21[_0x9643('0x27')]({'plain':!![]});var _0x5a1430='Dispositions';return db[_0x9643('0x28')]['destroy']({'where':{'type':_0x5a1430,'resourceId':_0x389fe5['id']}})['then'](function(){return _0x56eb21;});})['then'](function(){_0x3a6292[_0x9643('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd7580f,_0x221aaa){return function(_0x195fc5){if(!_0x195fc5){_0xd7580f[_0x9643('0x19')](0x194);}return _0x195fc5;};}function handleError(_0xe831fa,_0x39832a){_0x39832a=_0x39832a||0x1f4;return function(_0xccb523){logger['error'](_0xccb523[_0x9643('0x29')]);if(_0xccb523[_0x9643('0x2a')]){delete _0xccb523['name'];}_0xe831fa[_0x9643('0x1a')](_0x39832a)[_0x9643('0x2b')](_0xccb523);};}exports[_0x9643('0x2c')]=function(_0x1c9231,_0x1b2da6){var _0x4f130a={},_0x3add0f={},_0x53b69c={'count':0x0,'rows':[]};var _0xdf69a3=_[_0x9643('0x2d')](db[_0x9643('0x2e')][_0x9643('0x2f')],function(_0x4d1edf){return{'name':_0x4d1edf[_0x9643('0x30')],'type':_0x4d1edf[_0x9643('0x31')][_0x9643('0x32')]};});_0x3add0f['model']=_[_0x9643('0x2d')](_0xdf69a3,'name');_0x3add0f['query']=_[_0x9643('0x33')](_0x1c9231['query']);_0x3add0f[_0x9643('0x34')]=_[_0x9643('0x35')](_0x3add0f[_0x9643('0x36')],_0x3add0f[_0x9643('0x37')]);_0x4f130a[_0x9643('0x38')]=_[_0x9643('0x35')](_0x3add0f[_0x9643('0x36')],qs[_0x9643('0x39')](_0x1c9231[_0x9643('0x37')]['fields']));_0x4f130a['attributes']=_0x4f130a[_0x9643('0x38')][_0x9643('0x3a')]?_0x4f130a[_0x9643('0x38')]:_0x3add0f[_0x9643('0x36')];if(!_0x1c9231[_0x9643('0x37')][_0x9643('0x3b')](_0x9643('0x3c'))){_0x4f130a[_0x9643('0x1d')]=qs[_0x9643('0x1d')](_0x1c9231[_0x9643('0x37')][_0x9643('0x1d')]);_0x4f130a[_0x9643('0x1b')]=qs[_0x9643('0x1b')](_0x1c9231[_0x9643('0x37')]['offset']);}_0x4f130a[_0x9643('0x3d')]=qs[_0x9643('0x3e')](_0x1c9231[_0x9643('0x37')][_0x9643('0x3e')]);_0x4f130a[_0x9643('0x3f')]=qs[_0x9643('0x34')](_[_0x9643('0x40')](_0x1c9231[_0x9643('0x37')],_0x3add0f[_0x9643('0x34')]),_0xdf69a3);if(_0x1c9231[_0x9643('0x37')][_0x9643('0x41')]){_0x4f130a['where']=_[_0x9643('0x42')](_0x4f130a[_0x9643('0x3f')],{'$or':_[_0x9643('0x2d')](_0xdf69a3,function(_0x2aea6f){if(_0x2aea6f[_0x9643('0x31')]!=='VIRTUAL'){var _0x2bf108={};_0x2bf108[_0x2aea6f['name']]={'$like':'%'+_0x1c9231[_0x9643('0x37')][_0x9643('0x41')]+'%'};return _0x2bf108;}})});}_0x4f130a=_[_0x9643('0x42')]({},_0x4f130a,_0x1c9231[_0x9643('0x43')]);var _0x5c18fa={'where':_0x4f130a['where']};return db[_0x9643('0x2e')]['count'](_0x5c18fa)[_0x9643('0x25')](function(_0x5ed71b){_0x53b69c[_0x9643('0x1e')]=_0x5ed71b;if(_0x1c9231[_0x9643('0x37')][_0x9643('0x44')]){_0x4f130a[_0x9643('0x45')]=[{'all':!![]}];}return db[_0x9643('0x2e')][_0x9643('0x46')](_0x4f130a);})[_0x9643('0x25')](function(_0x135880){_0x53b69c[_0x9643('0x47')]=_0x135880;return _0x53b69c;})['then'](respondWithFilteredResult(_0x1b2da6,_0x4f130a))[_0x9643('0x48')](handleError(_0x1b2da6,null));};exports[_0x9643('0x49')]=function(_0x118397,_0x38136a){var _0x3f5c68={'raw':!![],'where':{'id':_0x118397[_0x9643('0x4a')]['id']}},_0x57033d={};_0x57033d['model']=_[_0x9643('0x33')](db[_0x9643('0x2e')][_0x9643('0x2f')]);_0x57033d['query']=_[_0x9643('0x33')](_0x118397[_0x9643('0x37')]);_0x57033d[_0x9643('0x34')]=_[_0x9643('0x35')](_0x57033d[_0x9643('0x36')],_0x57033d['query']);_0x3f5c68[_0x9643('0x38')]=_[_0x9643('0x35')](_0x57033d['model'],qs[_0x9643('0x39')](_0x118397['query'][_0x9643('0x39')]));_0x3f5c68[_0x9643('0x38')]=_0x3f5c68[_0x9643('0x38')][_0x9643('0x3a')]?_0x3f5c68[_0x9643('0x38')]:_0x57033d[_0x9643('0x36')];if(_0x118397[_0x9643('0x37')]['includeAll']){_0x3f5c68[_0x9643('0x45')]=[{'all':!![]}];}_0x3f5c68=_['merge']({},_0x3f5c68,_0x118397['options']);return db[_0x9643('0x2e')][_0x9643('0x4b')](_0x3f5c68)[_0x9643('0x25')](handleEntityNotFound(_0x38136a,null))[_0x9643('0x25')](respondWithResult(_0x38136a,null))['catch'](handleError(_0x38136a,null));};exports['create']=function(_0x89c927,_0x533e01){return db[_0x9643('0x2e')][_0x9643('0x4c')](_0x89c927[_0x9643('0x4d')],{})['then'](function(_0x28beed){var _0x59ad01=_0x89c927[_0x9643('0x4e')][_0x9643('0x27')]({'plain':!![]});if(!_0x59ad01)throw new Error(_0x9643('0x4f'));if(_0x59ad01[_0x9643('0x50')]===_0x9643('0x4e')){var _0x88d25a=_0x28beed[_0x9643('0x27')]({'plain':!![]});var _0xba8ee8=_0x9643('0x51');return db[_0x9643('0x52')][_0x9643('0x4b')]({'where':{'name':_0xba8ee8,'userProfileId':_0x59ad01[_0x9643('0x53')]},'raw':!![]})[_0x9643('0x25')](function(_0x29f7ee){if(_0x29f7ee&&_0x29f7ee[_0x9643('0x54')]===0x0){return db[_0x9643('0x28')]['create']({'name':_0x88d25a[_0x9643('0x2a')],'resourceId':_0x88d25a['id'],'type':_0x29f7ee[_0x9643('0x2a')],'sectionId':_0x29f7ee['id']},{})[_0x9643('0x25')](function(){return _0x28beed;});}else{return _0x28beed;}})[_0x9643('0x48')](function(_0x40a38f){logger[_0x9643('0x55')](_0x9643('0x56'),_0x40a38f);throw _0x40a38f;});}return _0x28beed;})['then'](respondWithResult(_0x533e01,0xc9))['catch'](handleError(_0x533e01,null));};exports[_0x9643('0x24')]=function(_0x2a51f5,_0x4b7f33){if(_0x2a51f5['body']['id']){delete _0x2a51f5['body']['id'];}return db[_0x9643('0x2e')]['find']({'where':{'id':_0x2a51f5[_0x9643('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4b7f33,null))[_0x9643('0x25')](saveUpdates(_0x2a51f5['body'],null))['then'](respondWithResult(_0x4b7f33,null))[_0x9643('0x48')](handleError(_0x4b7f33,null));};exports[_0x9643('0x26')]=function(_0x5bc005,_0x3c32c7){return db[_0x9643('0x2e')]['find']({'where':{'id':_0x5bc005[_0x9643('0x4a')]['id']}})[_0x9643('0x25')](handleEntityNotFound(_0x3c32c7,null))[_0x9643('0x25')](removeEntity(_0x3c32c7,null))['catch'](handleError(_0x3c32c7,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 0595b5b..619812a 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 _0x67ec=['name_chat','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','../../config/logger','api','moment','bluebird','./disposition.attributes','Disposition','name','ListId'];(function(_0x30ee43,_0x2675eb){var _0x1664b3=function(_0x2e1282){while(--_0x2e1282){_0x30ee43['push'](_0x30ee43['shift']());}};_0x1664b3(++_0x2675eb);}(_0x67ec,0xd8));var _0xc67e=function(_0x4cc9d2,_0x216c44){_0x4cc9d2=_0x4cc9d2-0x0;var _0x45db56=_0x67ec[_0x4cc9d2];return _0x45db56;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc67e('0x0'))(_0xc67e('0x1'));var moment=require(_0xc67e('0x2'));var BPromise=require(_0xc67e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc67e('0x4'));module['exports']=function(_0x3e2582,_0x260591){return _0x3e2582['define'](_0xc67e('0x5'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xc67e('0x6'),_0xc67e('0x7')]},{'unique':!![],'name':_0xc67e('0x8'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0xc67e('0x6'),_0xc67e('0x9')]},{'unique':!![],'name':_0xc67e('0xa'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0xc67e('0xb'),'fields':[_0xc67e('0x6'),_0xc67e('0xc')]},{'unique':!![],'name':_0xc67e('0xd'),'fields':[_0xc67e('0x6'),_0xc67e('0xe')]},{'unique':!![],'name':_0xc67e('0xf'),'fields':[_0xc67e('0x6'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd69f=['name','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','name_voice','ListId','name_chat'];(function(_0x168476,_0x4b0f6a){var _0x1c29e6=function(_0x52bdc1){while(--_0x52bdc1){_0x168476['push'](_0x168476['shift']());}};_0x1c29e6(++_0x4b0f6a);}(_0xd69f,0x1b3));var _0xfd69=function(_0x18b7c1,_0xfca626){_0x18b7c1=_0x18b7c1-0x0;var _0xbe933b=_0xd69f[_0x18b7c1];return _0xbe933b;};'use strict';var _=require(_0xfd69('0x0'));var util=require(_0xfd69('0x1'));var logger=require('../../config/logger')(_0xfd69('0x2'));var moment=require(_0xfd69('0x3'));var BPromise=require(_0xfd69('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd69('0x5'));var rimraf=require(_0xfd69('0x6'));var config=require(_0xfd69('0x7'));var attributes=require(_0xfd69('0x8'));module[_0xfd69('0x9')]=function(_0x5be6a3,_0x1eac0c){return _0x5be6a3[_0xfd69('0xa')](_0xfd69('0xb'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xfd69('0xc'),'fields':['name',_0xfd69('0xd')]},{'unique':!![],'name':_0xfd69('0xe'),'fields':[_0xfd69('0xf'),_0xfd69('0x10')]},{'unique':!![],'name':_0xfd69('0x11'),'fields':[_0xfd69('0xf'),'MailAccountId']},{'unique':!![],'name':_0xfd69('0x12'),'fields':[_0xfd69('0xf'),_0xfd69('0x13')]},{'unique':!![],'name':_0xfd69('0x14'),'fields':['name',_0xfd69('0x15')]},{'unique':!![],'name':_0xfd69('0x16'),'fields':[_0xfd69('0xf'),_0xfd69('0x17')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xfd69('0xf'),_0xfd69('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index a9db7c0..feb55e8 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(_0x15c734,_0x20b0d3){var _0x38cee6=function(_0x15b4d7){while(--_0x15b4d7){_0x15c734['push'](_0x15c734['shift']());}};_0x38cee6(++_0x20b0d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _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(_0xb5957e,_0x5bbc18){var _0x1ef512=function(_0x3fb30f){while(--_0x3fb30f){_0xb5957e['push'](_0xb5957e['shift']());}};_0x1ef512(++_0x5bbc18);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 d662064..c5d6ba4 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 _0xcf5b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x2fdf6e,_0x5ac9e8){var _0x28f96d=function(_0x29b71d){while(--_0x29b71d){_0x2fdf6e['push'](_0x2fdf6e['shift']());}};_0x28f96d(++_0x5ac9e8);}(_0xcf5b,0xd3));var _0xbcf5=function(_0x168127,_0x59cea1){_0x168127=_0x168127-0x0;var _0x4c99ad=_0xcf5b[_0x168127];return _0x4c99ad;};'use strict';var multer=require(_0xbcf5('0x0'));var util=require(_0xbcf5('0x1'));var path=require(_0xbcf5('0x2'));var timeout=require(_0xbcf5('0x3'));var express=require(_0xbcf5('0x4'));var router=express[_0xbcf5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbcf5('0x6'));var interaction=require(_0xbcf5('0x7'));var config=require(_0xbcf5('0x8'));var controller=require('./disposition.controller');router['get']('/',auth[_0xbcf5('0x9')](),controller[_0xbcf5('0xa')]);router[_0xbcf5('0xb')](_0xbcf5('0xc'),auth[_0xbcf5('0x9')](),controller[_0xbcf5('0xd')]);router[_0xbcf5('0xe')]('/',auth[_0xbcf5('0x9')](),controller['create']);router[_0xbcf5('0xf')](_0xbcf5('0xc'),auth[_0xbcf5('0x9')](),controller[_0xbcf5('0x10')]);router['delete'](_0xbcf5('0xc'),auth[_0xbcf5('0x9')](),controller[_0xbcf5('0x11')]);module['exports']=router; \ No newline at end of file +var _0xaf1e=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x5a9666,_0x30bc94){var _0x28601f=function(_0x52e447){while(--_0x52e447){_0x5a9666['push'](_0x5a9666['shift']());}};_0x28601f(++_0x30bc94);}(_0xaf1e,0x157));var _0xeaf1=function(_0x5d4b72,_0x206c9d){_0x5d4b72=_0x5d4b72-0x0;var _0x5c331b=_0xaf1e[_0x5d4b72];return _0x5c331b;};'use strict';var multer=require(_0xeaf1('0x0'));var util=require(_0xeaf1('0x1'));var path=require(_0xeaf1('0x2'));var timeout=require('connect-timeout');var express=require(_0xeaf1('0x3'));var router=express[_0xeaf1('0x4')]();var fs_extra=require(_0xeaf1('0x5'));var auth=require(_0xeaf1('0x6'));var interaction=require(_0xeaf1('0x7'));var config=require(_0xeaf1('0x8'));var controller=require('./disposition.controller');router[_0xeaf1('0x9')]('/',auth['isAuthenticated'](),controller[_0xeaf1('0xa')]);router['get'](_0xeaf1('0xb'),auth[_0xeaf1('0xc')](),controller[_0xeaf1('0xd')]);router[_0xeaf1('0xe')]('/',auth['isAuthenticated'](),controller[_0xeaf1('0xf')]);router[_0xeaf1('0x10')](_0xeaf1('0xb'),auth[_0xeaf1('0xc')](),controller['update']);router[_0xeaf1('0x11')](_0xeaf1('0xb'),auth[_0xeaf1('0xc')](),controller[_0xeaf1('0x12')]);module[_0xeaf1('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 72d94c8..7de2b53 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 _0xce91=['4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','TEXT','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400'];(function(_0x1998bb,_0x1f1da1){var _0x4ae4c9=function(_0x4741e8){while(--_0x4741e8){_0x1998bb['push'](_0x1998bb['shift']());}};_0x4ae4c9(++_0x1f1da1);}(_0xce91,0x78));var _0x1ce9=function(_0x191b1a,_0x58360e){_0x191b1a=_0x191b1a-0x0;var _0xde89da=_0xce91[_0x191b1a];return _0xde89da;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1ce9('0x0')]},'ecm':{'type':Sequelize[_0x1ce9('0x1')](_0x1ce9('0x2'),'no'),'defaultValue':_0x1ce9('0x2')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x1ce9('0x3')},'localstationid':{'type':Sequelize[_0x1ce9('0x0')],'unique':_0x1ce9('0x4')},'minrate':{'type':Sequelize[_0x1ce9('0x1')](_0x1ce9('0x5'),_0x1ce9('0x6'),_0x1ce9('0x7'),_0x1ce9('0x8'),_0x1ce9('0x9'),_0x1ce9('0xa')),'defaultValue':_0x1ce9('0x6')},'maxrate':{'type':Sequelize[_0x1ce9('0x1')](_0x1ce9('0x5'),_0x1ce9('0x6'),_0x1ce9('0x7'),_0x1ce9('0x8'),_0x1ce9('0x9'),_0x1ce9('0xa')),'defaultValue':_0x1ce9('0xa')},'modem':{'type':Sequelize[_0x1ce9('0x0')],'defaultValue':_0x1ce9('0xb')},'gateway':{'type':Sequelize[_0x1ce9('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x1ce9('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1ce9('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1ce9('0x1')](_0x1ce9('0xd'),_0x1ce9('0xe'),_0x1ce9('0xf'),'KHOMP'),'defaultValue':_0x1ce9('0xd')},'key':{'type':Sequelize[_0x1ce9('0x0')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1ce9('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1ce9('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1ce9('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1ce9('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1ce9('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1ce9('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1ce9('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1ce9('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1ce9('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1ce9('0x12'),'set':function(_0x26a793){if(!_0x26a793)this['setDataValue'](_0x1ce9('0x13'),null);this['setDataValue'](_0x1ce9('0x14'),_0x26a793);}}}; \ No newline at end of file +var _0x1f50=['7200','12000','14400','4800','2400','DADHI','SIP','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes'];(function(_0x127715,_0x20058e){var _0x5d2eb3=function(_0x5e1b73){while(--_0x5e1b73){_0x127715['push'](_0x127715['shift']());}};_0x5d2eb3(++_0x20058e);}(_0x1f50,0xb9));var _0x01f5=function(_0x5c4cc8,_0x40d5fc){_0x5c4cc8=_0x5c4cc8-0x0;var _0x36b55f=_0x1f50[_0x5c4cc8];return _0x36b55f;};'use strict';var Sequelize=require(_0x01f5('0x0'));module[_0x01f5('0x1')]={'name':{'type':Sequelize[_0x01f5('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x01f5('0x3')]('yes','no'),'defaultValue':_0x01f5('0x4')},'headerinfo':{'type':Sequelize[_0x01f5('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x01f5('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x01f5('0x3')]('2400','4800',_0x01f5('0x5'),'9600',_0x01f5('0x6'),_0x01f5('0x7')),'defaultValue':_0x01f5('0x8')},'maxrate':{'type':Sequelize[_0x01f5('0x3')](_0x01f5('0x9'),_0x01f5('0x8'),_0x01f5('0x5'),'9600','12000',_0x01f5('0x7')),'defaultValue':_0x01f5('0x7')},'modem':{'type':Sequelize[_0x01f5('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x01f5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x01f5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP','IAX',_0x01f5('0xa'),'KHOMP'),'defaultValue':_0x01f5('0xb')},'key':{'type':Sequelize[_0x01f5('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x01f5('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x01f5('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x01f5('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x01f5('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x01f5('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x01f5('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x01f5('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x01f5('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x01f5('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x01f5('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x01f5('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x24b0b2){if(!_0x24b0b2)this[_0x01f5('0x10')](_0x01f5('0x11'),null);this[_0x01f5('0x10')](_0x01f5('0x12'),_0x24b0b2);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 10a10ba..a3ca20a 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 _0x2fcb=['sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','List','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','ContactId','dataValues','SendFax','info','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','removeAgents','userFaxAccount:remove','emit','User','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','offset','undefined','count','limit','set','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','map','FaxAccount','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','options','includeAll','include','findAll','show','params','Pause','mandatoryDispositionPause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','addDisposition','FaxAccountId','Disposition','findOne','rawAttributes','order','merge','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Owner','fullname','internal','Tag','Tags'];(function(_0x47bb96,_0x21a22d){var _0x1b921b=function(_0x25d152){while(--_0x25d152){_0x47bb96['push'](_0x47bb96['shift']());}};_0x1b921b(++_0x21a22d);}(_0x2fcb,0x1d1));var _0xb2fc=function(_0x35f8d5,_0x21df88){_0x35f8d5=_0x35f8d5-0x0;var _0x2fd0ac=_0x2fcb[_0x35f8d5];return _0x2fd0ac;};'use strict';var emlformat=require(_0xb2fc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb2fc('0x1'));var jsonpatch=require(_0xb2fc('0x2'));var rp=require(_0xb2fc('0x3'));var moment=require(_0xb2fc('0x4'));var BPromise=require(_0xb2fc('0x5'));var Mustache=require(_0xb2fc('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb2fc('0x7'));var csv=require(_0xb2fc('0x8'));var ejs=require(_0xb2fc('0x9'));var fs=require('fs');var fs_extra=require(_0xb2fc('0xa'));var _=require(_0xb2fc('0xb'));var squel=require(_0xb2fc('0xc'));var crypto=require(_0xb2fc('0xd'));var jsforce=require(_0xb2fc('0xe'));var deskjs=require(_0xb2fc('0xf'));var toCsv=require(_0xb2fc('0x8'));var querystring=require(_0xb2fc('0x10'));var Papa=require(_0xb2fc('0x11'));var Redis=require(_0xb2fc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb2fc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb2fc('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb2fc('0x15'));var licenseUtil=require(_0xb2fc('0x16'));var db=require(_0xb2fc('0x17'))['db'];config[_0xb2fc('0x18')]=_[_0xb2fc('0x19')](config['redis'],{'host':_0xb2fc('0x1a'),'port':0x18eb});var socket=require(_0xb2fc('0x1b'))(new Redis(config[_0xb2fc('0x18')]));require(_0xb2fc('0x1c'))[_0xb2fc('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb2fc('0x1e')][_0xb2fc('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x147dbb,_0x2b236d,_0x4eaf9d,_0x485d21){return new BPromise(function(_0x4d081d,_0x3aab34){var _0x44302e=_0x485d21||client;return _0x44302e[_0xb2fc('0x20')](_0x147dbb,_0x4eaf9d)[_0xb2fc('0x21')](function(_0x3882fb){logger['info'](_0xb2fc('0x22'),_0x2b236d,_0xb2fc('0x23'));logger[_0xb2fc('0x24')](_0xb2fc('0x25'),_0x2b236d,_0xb2fc('0x23'),JSON[_0xb2fc('0x26')](_0x3882fb));if(_0x3882fb[_0xb2fc('0x27')]){if(_0x3882fb[_0xb2fc('0x27')][_0xb2fc('0x28')]===0x1f4){logger[_0xb2fc('0x27')](_0xb2fc('0x22'),_0x2b236d,_0x3882fb[_0xb2fc('0x27')][_0xb2fc('0x29')]);return _0x3aab34(_0x3882fb[_0xb2fc('0x27')]['message']);}logger['error'](_0xb2fc('0x22'),_0x2b236d,_0x3882fb['error'][_0xb2fc('0x29')]);return _0x4d081d(_0x3882fb['error']['message']);}else{logger['info'](_0xb2fc('0x22'),_0x2b236d,_0xb2fc('0x23'));_0x4d081d(_0x3882fb[_0xb2fc('0x2a')]['message']);}})[_0xb2fc('0x2b')](function(_0x5c30e5){logger[_0xb2fc('0x27')](_0xb2fc('0x22'),_0x2b236d,_0x5c30e5);_0x3aab34(_0x5c30e5);});});}function respondWithStatusCode(_0x2964a8,_0x4c4245){_0x4c4245=_0x4c4245||0xcc;return function(_0xb1c3a3){if(_0xb1c3a3){return _0x2964a8['sendStatus'](_0x4c4245);}return _0x2964a8['status'](_0x4c4245)[_0xb2fc('0x2c')]();};}function respondWithResult(_0x54620f,_0x592681){_0x592681=_0x592681||0xc8;return function(_0x763ede){if(_0x763ede){return _0x54620f[_0xb2fc('0x2d')](_0x592681)[_0xb2fc('0x2e')](_0x763ede);}};}function respondWithFilteredResult(_0x598846,_0x23c668){return function(_0x1f3ca5){if(_0x1f3ca5){var _0x18c08d=typeof _0x23c668[_0xb2fc('0x2f')]==='undefined'&&typeof _0x23c668['limit']===_0xb2fc('0x30');var _0x3f978e=_0x1f3ca5['count'];var _0xc163b9=_0x18c08d?0x0:_0x23c668[_0xb2fc('0x2f')];var _0x3351d1=_0x18c08d?_0x1f3ca5[_0xb2fc('0x31')]:_0x23c668[_0xb2fc('0x2f')]+_0x23c668[_0xb2fc('0x32')];var _0x3e122e;if(_0x3351d1>=_0x3f978e){_0x3351d1=_0x3f978e;_0x3e122e=0xc8;}else{_0x3e122e=0xce;}_0x598846['status'](_0x3e122e);return _0x598846[_0xb2fc('0x33')]('Content-Range',_0xc163b9+'-'+_0x3351d1+'/'+_0x3f978e)[_0xb2fc('0x2e')](_0x1f3ca5);}return null;};}function patchUpdates(_0x22fe70){return function(_0x200425){try{jsonpatch[_0xb2fc('0x34')](_0x200425,_0x22fe70,!![]);}catch(_0x567c1c){return BPromise['reject'](_0x567c1c);}return _0x200425[_0xb2fc('0x35')]();};}function saveUpdates(_0x2b0fc2,_0x25eb0d){return function(_0x305e3f){if(_0x305e3f){return _0x305e3f[_0xb2fc('0x36')](_0x2b0fc2)[_0xb2fc('0x21')](function(_0x423b19){return _0x423b19;});}return null;};}function removeEntity(_0x52a929,_0xc91b53){return function(_0x1dd56a){if(_0x1dd56a){return _0x1dd56a[_0xb2fc('0x37')]()[_0xb2fc('0x21')](function(){var _0x1bd18c=_0x1dd56a[_0xb2fc('0x38')]({'plain':!![]});var _0x4728a8=_0xb2fc('0x39');return db[_0xb2fc('0x3a')][_0xb2fc('0x37')]({'where':{'type':_0x4728a8,'resourceId':_0x1bd18c['id']}})[_0xb2fc('0x21')](function(){return _0x1dd56a;});})[_0xb2fc('0x21')](function(){_0x52a929['status'](0xcc)[_0xb2fc('0x2c')]();});}};}function handleEntityNotFound(_0x4d091c,_0x3c326e){return function(_0x5e1527){if(!_0x5e1527){_0x4d091c['sendStatus'](0x194);}return _0x5e1527;};}function handleError(_0x41e01b,_0x5d9fa2){_0x5d9fa2=_0x5d9fa2||0x1f4;return function(_0x1b345e){logger[_0xb2fc('0x27')](_0x1b345e[_0xb2fc('0x3b')]);if(_0x1b345e[_0xb2fc('0x3c')]){delete _0x1b345e['name'];}_0x41e01b[_0xb2fc('0x2d')](_0x5d9fa2)[_0xb2fc('0x3d')](_0x1b345e);};}exports[_0xb2fc('0x3e')]=function(_0x59ff53,_0x23564c){var _0xccc9f7={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x49a324={},_0x21d411={'count':0x0,'rows':[]};var _0x29b326=_[_0xb2fc('0x3f')](db[_0xb2fc('0x40')]['rawAttributes'],function(_0x10c612){return{'name':_0x10c612[_0xb2fc('0x41')],'type':_0x10c612[_0xb2fc('0x42')][_0xb2fc('0x43')]};});_0x49a324[_0xb2fc('0x44')]=_[_0xb2fc('0x3f')](_0x29b326,_0xb2fc('0x3c'));_0x49a324[_0xb2fc('0x45')]=_[_0xb2fc('0x46')](_0x59ff53[_0xb2fc('0x45')]);_0x49a324['filters']=_[_0xb2fc('0x47')](_0x49a324[_0xb2fc('0x44')],_0x49a324[_0xb2fc('0x45')]);_0xccc9f7['attributes']=_[_0xb2fc('0x47')](_0x49a324[_0xb2fc('0x44')],qs['fields'](_0x59ff53[_0xb2fc('0x45')][_0xb2fc('0x48')]));_0xccc9f7[_0xb2fc('0x49')]=_0xccc9f7[_0xb2fc('0x49')][_0xb2fc('0x4a')]?_0xccc9f7[_0xb2fc('0x49')]:_0x49a324['model'];if(!_0x59ff53[_0xb2fc('0x45')][_0xb2fc('0x4b')](_0xb2fc('0x4c'))){_0xccc9f7['limit']=qs[_0xb2fc('0x32')](_0x59ff53[_0xb2fc('0x45')][_0xb2fc('0x32')]);_0xccc9f7[_0xb2fc('0x2f')]=qs[_0xb2fc('0x2f')](_0x59ff53[_0xb2fc('0x45')][_0xb2fc('0x2f')]);}_0xccc9f7['order']=qs[_0xb2fc('0x4d')](_0x59ff53['query'][_0xb2fc('0x4d')]);_0xccc9f7[_0xb2fc('0x4e')]=qs[_0xb2fc('0x4f')](_[_0xb2fc('0x50')](_0x59ff53[_0xb2fc('0x45')],_0x49a324[_0xb2fc('0x4f')]),_0x29b326);if(_0x59ff53['query'][_0xb2fc('0x51')]){_0xccc9f7[_0xb2fc('0x4e')]=_['merge'](_0xccc9f7[_0xb2fc('0x4e')],{'$or':_[_0xb2fc('0x3f')](_0x29b326,function(_0xc2ef4){if(_0xc2ef4[_0xb2fc('0x42')]!=='VIRTUAL'){var _0x914a4a={};_0x914a4a[_0xc2ef4['name']]={'$like':'%'+_0x59ff53[_0xb2fc('0x45')]['filter']+'%'};return _0x914a4a;}})});}_0xccc9f7=_['merge']({},_0xccc9f7,_0x59ff53[_0xb2fc('0x52')]);var _0x6675a0={'where':_0xccc9f7[_0xb2fc('0x4e')]};return db[_0xb2fc('0x40')]['count'](_0x6675a0)['then'](function(_0x379685){_0x21d411[_0xb2fc('0x31')]=_0x379685;if(_0x59ff53['query'][_0xb2fc('0x53')]){_0xccc9f7[_0xb2fc('0x54')]=[{'all':!![]}];}return db['FaxAccount'][_0xb2fc('0x55')](_0xccc9f7);})[_0xb2fc('0x21')](function(_0x54d979){_0x21d411['rows']=_0x54d979;return _0x21d411;})['then'](respondWithFilteredResult(_0x23564c,_0xccc9f7))[_0xb2fc('0x2b')](handleError(_0x23564c,null));};exports[_0xb2fc('0x56')]=function(_0x2a5db7,_0x5d809f){var _0x1d2296={'raw':![],'where':{'id':_0x2a5db7[_0xb2fc('0x57')]['id']},'include':[{'model':db[_0xb2fc('0x58')],'as':_0xb2fc('0x59')}]},_0x1ee52e={};_0x1ee52e['model']=_[_0xb2fc('0x46')](db[_0xb2fc('0x40')]['rawAttributes']);_0x1ee52e[_0xb2fc('0x45')]=_[_0xb2fc('0x46')](_0x2a5db7[_0xb2fc('0x45')]);_0x1ee52e[_0xb2fc('0x4f')]=_[_0xb2fc('0x47')](_0x1ee52e[_0xb2fc('0x44')],_0x1ee52e[_0xb2fc('0x45')]);_0x1d2296[_0xb2fc('0x49')]=_['intersection'](_0x1ee52e[_0xb2fc('0x44')],qs[_0xb2fc('0x48')](_0x2a5db7[_0xb2fc('0x45')][_0xb2fc('0x48')]));_0x1d2296[_0xb2fc('0x49')]=_0x1d2296[_0xb2fc('0x49')][_0xb2fc('0x4a')]?_0x1d2296[_0xb2fc('0x49')]:_0x1ee52e[_0xb2fc('0x44')];if(_0x2a5db7[_0xb2fc('0x45')][_0xb2fc('0x53')]){_0x1d2296[_0xb2fc('0x54')]=[{'all':!![]}];}_0x1d2296=_['merge']({},_0x1d2296,_0x2a5db7[_0xb2fc('0x52')]);return db[_0xb2fc('0x40')][_0xb2fc('0x5a')](_0x1d2296)['then'](handleEntityNotFound(_0x5d809f,null))[_0xb2fc('0x21')](respondWithResult(_0x5d809f,null))[_0xb2fc('0x2b')](handleError(_0x5d809f,null));};exports[_0xb2fc('0x5b')]=function(_0x85774,_0x5a90cc){return db['FaxAccount'][_0xb2fc('0x5b')](_0x85774[_0xb2fc('0x5c')],{})[_0xb2fc('0x21')](function(_0x5adcd0){var _0x3b07c6=_0x85774[_0xb2fc('0x5d')][_0xb2fc('0x38')]({'plain':!![]});if(!_0x3b07c6)throw new Error(_0xb2fc('0x5e'));if(_0x3b07c6[_0xb2fc('0x5f')]===_0xb2fc('0x5d')){var _0x44f237=_0x5adcd0['get']({'plain':!![]});var _0x384b8a=_0xb2fc('0x39');return db[_0xb2fc('0x60')][_0xb2fc('0x5a')]({'where':{'name':_0x384b8a,'userProfileId':_0x3b07c6[_0xb2fc('0x61')]},'raw':!![]})[_0xb2fc('0x21')](function(_0x44dea2){if(_0x44dea2&&_0x44dea2['autoAssociation']===0x0){return db[_0xb2fc('0x3a')][_0xb2fc('0x5b')]({'name':_0x44f237['name'],'resourceId':_0x44f237['id'],'type':_0x44dea2['name'],'sectionId':_0x44dea2['id']},{})[_0xb2fc('0x21')](function(){return _0x5adcd0;});}else{return _0x5adcd0;}})[_0xb2fc('0x2b')](function(_0x4e0c50){logger[_0xb2fc('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e0c50);throw _0x4e0c50;});}return _0x5adcd0;})[_0xb2fc('0x21')](respondWithResult(_0x5a90cc,0xc9))[_0xb2fc('0x2b')](handleError(_0x5a90cc,null));};exports[_0xb2fc('0x36')]=function(_0x53b5b1,_0x5bbabe){if(_0x53b5b1[_0xb2fc('0x5c')]['id']){delete _0x53b5b1[_0xb2fc('0x5c')]['id'];}return db['FaxAccount'][_0xb2fc('0x5a')]({'where':{'id':_0x53b5b1['params']['id']},'include':[{'model':db[_0xb2fc('0x58')],'as':_0xb2fc('0x59')}]})[_0xb2fc('0x21')](handleEntityNotFound(_0x5bbabe,null))[_0xb2fc('0x21')](saveUpdates(_0x53b5b1[_0xb2fc('0x5c')],null))[_0xb2fc('0x21')](respondWithResult(_0x5bbabe,null))[_0xb2fc('0x2b')](handleError(_0x5bbabe,null));};exports['destroy']=function(_0x41f134,_0x21a5df){return db[_0xb2fc('0x40')][_0xb2fc('0x5a')]({'where':{'id':_0x41f134['params']['id']}})['then'](handleEntityNotFound(_0x21a5df,null))['then'](removeEntity(_0x21a5df,null))[_0xb2fc('0x2b')](handleError(_0x21a5df,null));};exports[_0xb2fc('0x62')]=function(_0x56ea61,_0x5700a0){return db[_0xb2fc('0x40')][_0xb2fc('0x62')]()[_0xb2fc('0x21')](respondWithResult(_0x5700a0,null))[_0xb2fc('0x2b')](handleError(_0x5700a0,null));};exports[_0xb2fc('0x63')]=function(_0x4649d0,_0x1a4030,_0x2db5f5){if(_0x4649d0[_0xb2fc('0x5c')]['id']){delete _0x4649d0[_0xb2fc('0x5c')]['id'];}return db[_0xb2fc('0x40')][_0xb2fc('0x5a')]({'where':{'id':_0x4649d0[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x1a4030,null))[_0xb2fc('0x21')](function(_0x343dab){if(_0x343dab){_0x4649d0['body'][_0xb2fc('0x64')]=_0x343dab['id'];return db[_0xb2fc('0x65')][_0xb2fc('0x5b')](_0x4649d0[_0xb2fc('0x5c')]);}})['then'](respondWithResult(_0x1a4030,null))['catch'](handleError(_0x1a4030,null));};exports['getDispositions']=function(_0xdd4d47,_0x1f94eb,_0x3c7d0e){var _0x3fc328={'raw':![],'where':{}};var _0xd67d9e={};var _0x15ed78={'count':0x0,'rows':[]};return db[_0xb2fc('0x40')][_0xb2fc('0x66')]({'where':{'id':_0xdd4d47[_0xb2fc('0x57')]['id']}})['then'](handleEntityNotFound(_0x1f94eb,null))[_0xb2fc('0x21')](function(_0x18c88d){if(_0x18c88d){_0xd67d9e[_0xb2fc('0x44')]=_[_0xb2fc('0x46')](db[_0xb2fc('0x65')][_0xb2fc('0x67')]);_0xd67d9e[_0xb2fc('0x45')]=_[_0xb2fc('0x46')](_0xdd4d47[_0xb2fc('0x45')]);_0xd67d9e[_0xb2fc('0x4f')]=_['intersection'](_0xd67d9e['model'],_0xd67d9e[_0xb2fc('0x45')]);_0x3fc328['attributes']=_['intersection'](_0xd67d9e[_0xb2fc('0x44')],qs[_0xb2fc('0x48')](_0xdd4d47[_0xb2fc('0x45')][_0xb2fc('0x48')]));_0x3fc328[_0xb2fc('0x49')]=_0x3fc328['attributes'][_0xb2fc('0x4a')]?_0x3fc328[_0xb2fc('0x49')]:_0xd67d9e[_0xb2fc('0x44')];if(!_0xdd4d47[_0xb2fc('0x45')][_0xb2fc('0x4b')](_0xb2fc('0x4c'))){_0x3fc328[_0xb2fc('0x32')]=qs[_0xb2fc('0x32')](_0xdd4d47['query'][_0xb2fc('0x32')]);_0x3fc328['offset']=qs[_0xb2fc('0x2f')](_0xdd4d47[_0xb2fc('0x45')]['offset']);}_0x3fc328[_0xb2fc('0x68')]=qs[_0xb2fc('0x4d')](_0xdd4d47['query']['sort']);_0x3fc328[_0xb2fc('0x4e')]=qs[_0xb2fc('0x4f')](_[_0xb2fc('0x50')](_0xdd4d47[_0xb2fc('0x45')],_0xd67d9e['filters']));_0x3fc328['where'][_0xb2fc('0x64')]=_0x18c88d['id'];if(_0xdd4d47['query']['filter']){_0x3fc328['where']=_[_0xb2fc('0x69')](_0x3fc328[_0xb2fc('0x4e')],{'$or':_[_0xb2fc('0x3f')](_0x3fc328[_0xb2fc('0x49')],function(_0x46deb4){var _0x54882a={};_0x54882a[_0x46deb4]={'$like':'%'+_0xdd4d47[_0xb2fc('0x45')][_0xb2fc('0x51')]+'%'};return _0x54882a;})});}_0x3fc328=_[_0xb2fc('0x69')]({},_0x3fc328,_0xdd4d47[_0xb2fc('0x52')]);return db[_0xb2fc('0x65')][_0xb2fc('0x31')]({'where':_0x3fc328['where']})['then'](function(_0x1e53a6){_0x15ed78[_0xb2fc('0x31')]=_0x1e53a6;if(_0xdd4d47['query'][_0xb2fc('0x53')]){_0x3fc328[_0xb2fc('0x54')]=[{'all':!![]}];}return db['Disposition'][_0xb2fc('0x55')](_0x3fc328);})[_0xb2fc('0x21')](function(_0x22e943){_0x15ed78[_0xb2fc('0x6a')]=_0x22e943;return _0x15ed78;});}})['then'](respondWithFilteredResult(_0x1f94eb,_0x3fc328))[_0xb2fc('0x2b')](handleError(_0x1f94eb,null));};exports[_0xb2fc('0x6b')]=function(_0x32979c,_0x548274,_0x39e077){return db[_0xb2fc('0x40')]['find']({'where':{'id':_0x32979c[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x548274,null))[_0xb2fc('0x21')](function(_0x35863b){if(_0x35863b){return _0x35863b[_0xb2fc('0x6b')](_0x32979c[_0xb2fc('0x45')][_0xb2fc('0x6c')]);}})[_0xb2fc('0x21')](respondWithStatusCode(_0x548274,null))[_0xb2fc('0x2b')](handleError(_0x548274,null));};exports[_0xb2fc('0x6d')]=function(_0x2dd5cd,_0x1d4936,_0x241c13){if(_0x2dd5cd['body']['id']){delete _0x2dd5cd[_0xb2fc('0x5c')]['id'];}return db[_0xb2fc('0x40')][_0xb2fc('0x5a')]({'where':{'id':_0x2dd5cd[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x1d4936,null))[_0xb2fc('0x21')](function(_0x13802a){if(_0x13802a){_0x2dd5cd['body']['FaxAccountId']=_0x13802a['id'];return db[_0xb2fc('0x6e')]['create'](_0x2dd5cd[_0xb2fc('0x5c')]);}})[_0xb2fc('0x21')](respondWithResult(_0x1d4936,null))[_0xb2fc('0x2b')](handleError(_0x1d4936,null));};exports[_0xb2fc('0x6f')]=function(_0x564e3d,_0xfad38e,_0x17aa24){var _0x26f258={'raw':![],'where':{}};var _0x135886={};var _0x4f0fd3={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x564e3d[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0xfad38e,null))[_0xb2fc('0x21')](function(_0x63d76a){if(_0x63d76a){_0x135886[_0xb2fc('0x44')]=_[_0xb2fc('0x46')](db[_0xb2fc('0x6e')][_0xb2fc('0x67')]);_0x135886['query']=_[_0xb2fc('0x46')](_0x564e3d['query']);_0x135886[_0xb2fc('0x4f')]=_['intersection'](_0x135886['model'],_0x135886[_0xb2fc('0x45')]);_0x26f258['attributes']=_[_0xb2fc('0x47')](_0x135886[_0xb2fc('0x44')],qs[_0xb2fc('0x48')](_0x564e3d[_0xb2fc('0x45')][_0xb2fc('0x48')]));_0x26f258[_0xb2fc('0x49')]=_0x26f258[_0xb2fc('0x49')]['length']?_0x26f258[_0xb2fc('0x49')]:_0x135886['model'];if(!_0x564e3d['query']['hasOwnProperty'](_0xb2fc('0x4c'))){_0x26f258[_0xb2fc('0x32')]=qs[_0xb2fc('0x32')](_0x564e3d[_0xb2fc('0x45')][_0xb2fc('0x32')]);_0x26f258[_0xb2fc('0x2f')]=qs[_0xb2fc('0x2f')](_0x564e3d['query'][_0xb2fc('0x2f')]);}_0x26f258[_0xb2fc('0x68')]=qs['sort'](_0x564e3d[_0xb2fc('0x45')][_0xb2fc('0x4d')]);_0x26f258[_0xb2fc('0x4e')]=qs[_0xb2fc('0x4f')](_[_0xb2fc('0x50')](_0x564e3d[_0xb2fc('0x45')],_0x135886[_0xb2fc('0x4f')]));_0x26f258[_0xb2fc('0x4e')][_0xb2fc('0x64')]=_0x63d76a['id'];if(_0x564e3d[_0xb2fc('0x45')][_0xb2fc('0x51')]){_0x26f258[_0xb2fc('0x4e')]=_[_0xb2fc('0x69')](_0x26f258[_0xb2fc('0x4e')],{'$or':_[_0xb2fc('0x3f')](_0x26f258[_0xb2fc('0x49')],function(_0x50027c){var _0x9ee921={};_0x9ee921[_0x50027c]={'$like':'%'+_0x564e3d['query']['filter']+'%'};return _0x9ee921;})});}_0x26f258=_[_0xb2fc('0x69')]({},_0x26f258,_0x564e3d[_0xb2fc('0x52')]);return db[_0xb2fc('0x6e')][_0xb2fc('0x31')]({'where':_0x26f258[_0xb2fc('0x4e')]})[_0xb2fc('0x21')](function(_0x2060c6){_0x4f0fd3[_0xb2fc('0x31')]=_0x2060c6;if(_0x564e3d[_0xb2fc('0x45')][_0xb2fc('0x53')]){_0x26f258[_0xb2fc('0x54')]=[{'all':!![]}];}return db[_0xb2fc('0x6e')][_0xb2fc('0x55')](_0x26f258);})[_0xb2fc('0x21')](function(_0x317c04){_0x4f0fd3[_0xb2fc('0x6a')]=_0x317c04;return _0x4f0fd3;});}})[_0xb2fc('0x21')](respondWithFilteredResult(_0xfad38e,_0x26f258))[_0xb2fc('0x2b')](handleError(_0xfad38e,null));};exports['removeAnswers']=function(_0x54e581,_0x56505a,_0x243def){return db[_0xb2fc('0x40')][_0xb2fc('0x5a')]({'where':{'id':_0x54e581[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x56505a,null))[_0xb2fc('0x21')](function(_0x3ed9c7){if(_0x3ed9c7){return _0x3ed9c7[_0xb2fc('0x70')](_0x54e581[_0xb2fc('0x45')]['ids']);}})[_0xb2fc('0x21')](respondWithStatusCode(_0x56505a,null))[_0xb2fc('0x2b')](handleError(_0x56505a,null));};exports[_0xb2fc('0x71')]=function(_0xd7004f,_0x67fa93,_0x29130d){return db['FaxInteraction'][_0xb2fc('0x5a')]({'where':{'id':_0xd7004f[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x67fa93,null))[_0xb2fc('0x21')](function(_0x40ecf7){if(_0x40ecf7){return _0x40ecf7[_0xb2fc('0x71')](_0xd7004f[_0xb2fc('0x5c')]['ids'],_[_0xb2fc('0x72')](_0xd7004f[_0xb2fc('0x5c')],[_0xb2fc('0x6c'),'id'])||{});}})[_0xb2fc('0x21')](respondWithResult(_0x67fa93,null))[_0xb2fc('0x2b')](handleError(_0x67fa93,null));};exports[_0xb2fc('0x73')]=function(_0x2cd669,_0x67ff00,_0x3c89ae){var _0x3a494a={'raw':![],'where':{}};var _0x3231da={};var _0x1f8003={'count':0x0,'rows':[]};return db[_0xb2fc('0x40')]['findOne']({'where':{'id':_0x2cd669[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x67ff00,null))[_0xb2fc('0x21')](function(_0x2633c7){if(_0x2633c7){_0x3231da[_0xb2fc('0x44')]=_[_0xb2fc('0x46')](db[_0xb2fc('0x74')][_0xb2fc('0x67')]);_0x3231da[_0xb2fc('0x45')]=_[_0xb2fc('0x46')](_0x2cd669[_0xb2fc('0x45')]);_0x3231da[_0xb2fc('0x4f')]=_[_0xb2fc('0x47')](_0x3231da['model'],_0x3231da[_0xb2fc('0x45')]);_0x3a494a[_0xb2fc('0x49')]=_[_0xb2fc('0x47')](_0x3231da['model'],qs[_0xb2fc('0x48')](_0x2cd669[_0xb2fc('0x45')][_0xb2fc('0x48')]));_0x3a494a['attributes']=_0x3a494a['attributes']['length']?_0x3a494a[_0xb2fc('0x49')]:_0x3231da[_0xb2fc('0x44')];if(!_0x2cd669[_0xb2fc('0x45')][_0xb2fc('0x4b')](_0xb2fc('0x4c'))){_0x3a494a[_0xb2fc('0x32')]=qs['limit'](_0x2cd669[_0xb2fc('0x45')][_0xb2fc('0x32')]);_0x3a494a['offset']=qs[_0xb2fc('0x2f')](_0x2cd669[_0xb2fc('0x45')][_0xb2fc('0x2f')]);}_0x3a494a[_0xb2fc('0x68')]=qs[_0xb2fc('0x4d')](_0x2cd669[_0xb2fc('0x45')][_0xb2fc('0x4d')]);_0x3a494a[_0xb2fc('0x4e')]=qs[_0xb2fc('0x4f')](_[_0xb2fc('0x50')](_0x2cd669[_0xb2fc('0x45')],_0x3231da[_0xb2fc('0x4f')]));_0x3a494a['where'][_0xb2fc('0x64')]=_0x2633c7['id'];if(_0x2cd669['query']['filter']){_0x3a494a['where']=_[_0xb2fc('0x69')](_0x3a494a[_0xb2fc('0x4e')],{'$or':_['map'](_0x3a494a[_0xb2fc('0x49')],function(_0x4ee66b){var _0x112365={};_0x112365[_0x4ee66b]={'$like':'%'+_0x2cd669[_0xb2fc('0x45')][_0xb2fc('0x51')]+'%'};return _0x112365;})});}_0x3a494a=_[_0xb2fc('0x69')]({},_0x3a494a,_0x2cd669[_0xb2fc('0x52')]);return db[_0xb2fc('0x74')][_0xb2fc('0x31')]({'where':_0x3a494a[_0xb2fc('0x4e')]})['then'](function(_0x5f1243){_0x1f8003[_0xb2fc('0x31')]=_0x5f1243;if(_0x2cd669[_0xb2fc('0x45')][_0xb2fc('0x53')]){_0x3a494a['include']=[{'model':db[_0xb2fc('0x75')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xb2fc('0x76'),'attributes':[_0xb2fc('0x3c'),_0xb2fc('0x77'),_0xb2fc('0x78')],'required':![]},{'model':db[_0xb2fc('0x79')],'as':_0xb2fc('0x7a'),'attributes':['id',_0xb2fc('0x3c'),'color'],'where':_0x2cd669[_0xb2fc('0x45')]['tag']?{'id':_0x2cd669['query']['tag']}:undefined,'required':_0x2cd669[_0xb2fc('0x45')]['tag']?!![]:![]}];}return db[_0xb2fc('0x74')][_0xb2fc('0x55')](_0x3a494a);})[_0xb2fc('0x21')](function(_0x5d22a2){_0x1f8003[_0xb2fc('0x6a')]=_0x5d22a2;return _0x1f8003;});}})[_0xb2fc('0x21')](respondWithFilteredResult(_0x67ff00,_0x3a494a))[_0xb2fc('0x2b')](handleError(_0x67ff00,null));};exports['addApplications']=function(_0xb284fe,_0x4a153c,_0x75aa93){return db[_0xb2fc('0x40')][_0xb2fc('0x66')]({'where':{'id':_0xb284fe[_0xb2fc('0x57')]['id']}})['then'](handleEntityNotFound(_0x4a153c,null))['then'](function(_0x2a87f8){if(_0x2a87f8){return db[_0xb2fc('0x7b')][_0xb2fc('0x7c')](function(_0x4bbe2c){return db[_0xb2fc('0x7d')][_0xb2fc('0x37')]({'where':{'FaxAccountId':_0xb284fe[_0xb2fc('0x57')]['id']},'transaction':_0x4bbe2c})[_0xb2fc('0x21')](function(_0x28bda3){var _0x1a46c0=_[_0xb2fc('0x3f')](_0xb284fe[_0xb2fc('0x5c')],function(_0x52f1ab){_0x52f1ab['FaxAccountId']=_0xb284fe['params']['id'];return _0x52f1ab;});return db['FaxApplication'][_0xb2fc('0x7e')](_0x1a46c0,{'transaction':_0x4bbe2c});});})['then'](function(){return db[_0xb2fc('0x7d')][_0xb2fc('0x7f')]({'where':{'FaxAccountId':_0xb284fe[_0xb2fc('0x57')]['id']},'order':_0xb2fc('0x80')});});}})[_0xb2fc('0x21')](respondWithResult(_0x4a153c,null))[_0xb2fc('0x2b')](handleError(_0x4a153c,null));};exports['getApplications']=function(_0x56ff4e,_0x586fc2,_0x140c01){var _0x37207d={};var _0x5704f7={};var _0x2e7f02;var _0xe6f28a;return db['FaxAccount'][_0xb2fc('0x66')]({'where':{'id':_0x56ff4e['params']['id']}})['then'](handleEntityNotFound(_0x586fc2,null))['then'](function(_0x336168){if(_0x336168){_0x2e7f02=_0x336168;_0x5704f7[_0xb2fc('0x44')]=_[_0xb2fc('0x46')](db[_0xb2fc('0x7d')]['rawAttributes']);_0x5704f7[_0xb2fc('0x45')]=_[_0xb2fc('0x46')](_0x56ff4e[_0xb2fc('0x45')]);_0x5704f7[_0xb2fc('0x4f')]=_['intersection'](_0x5704f7['model'],_0x5704f7[_0xb2fc('0x45')]);_0x37207d[_0xb2fc('0x49')]=_['intersection'](_0x5704f7['model'],qs['fields'](_0x56ff4e[_0xb2fc('0x45')]['fields']));_0x37207d[_0xb2fc('0x49')]=_0x37207d['attributes'][_0xb2fc('0x4a')]?_0x37207d[_0xb2fc('0x49')]:_0x5704f7[_0xb2fc('0x44')];_0x37207d['order']=qs[_0xb2fc('0x4d')](_0x56ff4e[_0xb2fc('0x45')][_0xb2fc('0x4d')]);_0x37207d[_0xb2fc('0x4e')]=qs[_0xb2fc('0x4f')](_[_0xb2fc('0x50')](_0x56ff4e[_0xb2fc('0x45')],_0x5704f7[_0xb2fc('0x4f')]));if(_0x56ff4e[_0xb2fc('0x45')]['filter']){_0x37207d['where']=_['merge'](_0x37207d[_0xb2fc('0x4e')],{'$or':_[_0xb2fc('0x3f')](_0x37207d[_0xb2fc('0x49')],function(_0x4acc56){var _0x1e137f={};_0x1e137f[_0x4acc56]={'$like':'%'+_0x56ff4e['query']['filter']+'%'};return _0x1e137f;})});}_0x37207d=_[_0xb2fc('0x69')]({},_0x37207d,_0x56ff4e[_0xb2fc('0x52')]);return _0x2e7f02['getApplications'](_0x37207d);}})[_0xb2fc('0x21')](function(_0x25a082){if(_0x25a082){_0xe6f28a=_0x25a082[_0xb2fc('0x4a')];if(!_0x56ff4e[_0xb2fc('0x45')]['hasOwnProperty'](_0xb2fc('0x4c'))){_0x37207d[_0xb2fc('0x32')]=qs[_0xb2fc('0x32')](_0x56ff4e[_0xb2fc('0x45')][_0xb2fc('0x32')]);_0x37207d[_0xb2fc('0x2f')]=qs[_0xb2fc('0x2f')](_0x56ff4e['query'][_0xb2fc('0x2f')]);}return _0x2e7f02[_0xb2fc('0x81')](_0x37207d);}})[_0xb2fc('0x21')](function(_0x201646){if(_0x201646){return _0x201646?{'count':_0xe6f28a,'rows':_0x201646}:null;}})[_0xb2fc('0x21')](respondWithResult(_0x586fc2,null))[_0xb2fc('0x2b')](handleError(_0x586fc2,null));};function Extension(_0x1aaa75,_0x5dc150,_0x5b146b,_0x332146){this[_0xb2fc('0x82')]=_0xb2fc('0x83');this[_0xb2fc('0x84')]=_0x1aaa75[_0xb2fc('0x85')];this[_0xb2fc('0x86')]=_0x332146;this[_0xb2fc('0x42')]=_0xb2fc('0x87');this['description']='Fax\x20Extension';this[_0xb2fc('0x64')]=_0x1aaa75['id'];this[_0xb2fc('0x80')]=_0x5dc150;this[_0xb2fc('0x88')]=_0x5b146b;}function createExtensionsReciveFax(_0x209fb8){var _0x5a1a7d=0x1;var _0x162bc0=[];_0x162bc0[_0xb2fc('0x89')](new Extension(_0x209fb8,_0x5a1a7d,'','Answer'));_0x5a1a7d+=0x1;_0x162bc0[_0xb2fc('0x89')](new Extension(_0x209fb8,_0x5a1a7d,_0xb2fc('0x8a'),_0xb2fc('0x8b')));_0x5a1a7d+=0x1;for(var _0x449bce in _0x209fb8){if(_0x209fb8[_0xb2fc('0x4b')](_0x449bce)&&(_0x449bce===_0xb2fc('0x8c')||_0x449bce===_0xb2fc('0x85')||_0x449bce===_0xb2fc('0x8d')||_0x449bce===_0xb2fc('0x8e')||_0x449bce===_0xb2fc('0x8f')||_0x449bce===_0xb2fc('0x90')||_0x449bce===_0xb2fc('0x91')||_0x449bce===_0xb2fc('0x92')||_0x449bce==='t38timeout')){_0x162bc0[_0xb2fc('0x89')](new Extension(_0x209fb8,_0x5a1a7d,_0xb2fc('0x93')+_0x449bce+')='+_0x209fb8[_0x449bce],_0xb2fc('0x8b')));_0x5a1a7d+=0x1;}}_0x162bc0['push'](new Extension(_0x209fb8,_0x5a1a7d,'6',_0xb2fc('0x94')));_0x5a1a7d+=0x1;_0x162bc0['push'](new Extension(_0x209fb8,_0x5a1a7d,_0xb2fc('0x95'),_0xb2fc('0x96')));_0x5a1a7d=0x0;return _0x162bc0;}exports[_0xb2fc('0x97')]=function(_0x19f61d,_0x20a463,_0x106219){var _0x3bdab3;return db[_0xb2fc('0x7b')][_0xb2fc('0x7c')](function(_0x21c0ce){return db[_0xb2fc('0x40')][_0xb2fc('0x5b')](_0x19f61d['body'],{'transaction':_0x21c0ce})[_0xb2fc('0x21')](function(_0x1b4170){_0x3bdab3=_0x1b4170[_0xb2fc('0x38')]({'plain':!![]});return db[_0xb2fc('0x98')]['bulkCreate'](createExtensionsReciveFax(_0x3bdab3),{'transaction':_0x21c0ce});});})[_0xb2fc('0x21')](function(){return _0x3bdab3;})[_0xb2fc('0x21')](respondWithResult(_0x20a463,null))[_0xb2fc('0x2b')](handleError(_0x20a463,null));};exports[_0xb2fc('0x99')]=function(_0x122f6c,_0x1c729e,_0x4cd1d8){var _0x3e9299;return db['sequelize'][_0xb2fc('0x7c')](function(_0x1b457f){return db[_0xb2fc('0x40')][_0xb2fc('0x36')](_0x122f6c['body'],{'where':{'id':_0x122f6c[_0xb2fc('0x5c')]['id']},'transaction':_0x1b457f})[_0xb2fc('0x21')](function(_0x23157c){return db['VoiceExtension'][_0xb2fc('0x37')]({'where':{'FaxAccountId':_0x122f6c[_0xb2fc('0x5c')]['id']},'transaction':_0x1b457f})['then'](function(_0xc48893){return db[_0xb2fc('0x98')][_0xb2fc('0x7e')](createExtensionsReciveFax(_[_0xb2fc('0x72')](_0x122f6c[_0xb2fc('0x5c')],['tech',_0xb2fc('0x43'),_0xb2fc('0x9a'),_0xb2fc('0x9b'),_0xb2fc('0x9c'),_0xb2fc('0x9d')])),{'transaction':_0x1b457f});});});})[_0xb2fc('0x21')](function(){return db[_0xb2fc('0x40')][_0xb2fc('0x9e')](_0x122f6c[_0xb2fc('0x5c')]['id']);})[_0xb2fc('0x21')](respondWithResult(_0x1c729e,null))[_0xb2fc('0x2b')](handleError(_0x1c729e,null));};exports[_0xb2fc('0x9f')]=function(_0x191ef7,_0x34b8f4,_0x2aa46e){var _0x3a52ad={'raw':!![],'where':{}};var _0x448694={};var _0x4606b2={'count':0x0,'rows':[]};return db[_0xb2fc('0x40')][_0xb2fc('0x66')]({'where':{'id':_0x191ef7['params']['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x34b8f4,null))[_0xb2fc('0x21')](function(_0x1212f6){if(_0x1212f6){_0x448694[_0xb2fc('0x44')]=_[_0xb2fc('0x46')](db[_0xb2fc('0xa0')][_0xb2fc('0x67')]);_0x448694[_0xb2fc('0x45')]=_[_0xb2fc('0x46')](_0x191ef7[_0xb2fc('0x45')]);_0x448694['filters']=_['intersection'](_0x448694[_0xb2fc('0x44')],_0x448694['query']);_0x3a52ad[_0xb2fc('0x49')]=_[_0xb2fc('0x47')](_0x448694[_0xb2fc('0x44')],qs['fields'](_0x191ef7[_0xb2fc('0x45')]['fields']));_0x3a52ad[_0xb2fc('0x49')]=_0x3a52ad[_0xb2fc('0x49')][_0xb2fc('0x4a')]?_0x3a52ad[_0xb2fc('0x49')]:_0x448694[_0xb2fc('0x44')];if(!_0x191ef7[_0xb2fc('0x45')][_0xb2fc('0x4b')]('nolimit')){_0x3a52ad[_0xb2fc('0x32')]=qs[_0xb2fc('0x32')](_0x191ef7['query'][_0xb2fc('0x32')]);_0x3a52ad[_0xb2fc('0x2f')]=qs[_0xb2fc('0x2f')](_0x191ef7[_0xb2fc('0x45')][_0xb2fc('0x2f')]);}_0x3a52ad[_0xb2fc('0x68')]=qs[_0xb2fc('0x4d')](_0x191ef7[_0xb2fc('0x45')][_0xb2fc('0x4d')]);_0x3a52ad[_0xb2fc('0x4e')]=qs[_0xb2fc('0x4f')](_[_0xb2fc('0x50')](_0x191ef7[_0xb2fc('0x45')],_0x448694[_0xb2fc('0x4f')]));_0x3a52ad[_0xb2fc('0x4e')][_0xb2fc('0x64')]=_0x1212f6['id'];if(_0x191ef7[_0xb2fc('0x45')][_0xb2fc('0x51')]){_0x3a52ad['where']=_[_0xb2fc('0x69')](_0x3a52ad[_0xb2fc('0x4e')],{'$or':_[_0xb2fc('0x3f')](_0x3a52ad[_0xb2fc('0x49')],function(_0x1ae584){var _0x8fed19={};_0x8fed19[_0x1ae584]={'$like':'%'+_0x191ef7[_0xb2fc('0x45')][_0xb2fc('0x51')]+'%'};return _0x8fed19;})});}if(_0x191ef7[_0xb2fc('0x45')]['$gte']){var _0xf58f1a=_0x191ef7[_0xb2fc('0x45')][_0xb2fc('0xa1')][_0xb2fc('0xa2')](',');var _0x4fd764={};_0x4fd764[_0xf58f1a[0x0]]={'$gte':moment(_0xf58f1a[0x1])[_0xb2fc('0xa3')](_0xb2fc('0xa4'))};_0x3a52ad['where']=_[_0xb2fc('0x69')](_0x3a52ad[_0xb2fc('0x4e')],_0x4fd764);}_0x3a52ad=_[_0xb2fc('0x69')]({},_0x3a52ad,_0x191ef7['options']);return db['FaxMessage'][_0xb2fc('0x31')]({'where':_0x3a52ad[_0xb2fc('0x4e')]})[_0xb2fc('0x21')](function(_0xcf64e2){_0x4606b2['count']=_0xcf64e2;if(_0x191ef7[_0xb2fc('0x45')][_0xb2fc('0x53')]){_0x3a52ad[_0xb2fc('0x54')]=[{'all':!![]}];}return db[_0xb2fc('0xa0')][_0xb2fc('0x55')](_0x3a52ad);})[_0xb2fc('0x21')](function(_0x5ba787){_0x4606b2['rows']=_0x5ba787;return _0x4606b2;});}})[_0xb2fc('0x21')](respondWithFilteredResult(_0x34b8f4,_0x3a52ad))['catch'](handleError(_0x34b8f4,null));};exports['send']=function(_0x459e32,_0x546a80,_0x11a931){var _0x22decb,_0x7571df={},_0x278922;if(_0x459e32[_0xb2fc('0x5c')]['to']){_0x278922=_0x459e32[_0xb2fc('0x5c')]['to'][0x0];}return db['FaxAccount'][_0xb2fc('0x5a')]({'where':{'id':_0x459e32[_0xb2fc('0x57')]['id']},'include':[{'model':db[_0xb2fc('0xa5')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x278922},'limit':0x1,'order':[['updatedAt',_0xb2fc('0xa6')]]}]}]})[_0xb2fc('0x21')](handleEntityNotFound(_0x546a80,null))[_0xb2fc('0x21')](function(_0x419564){_0x22decb=_0x419564;if(_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')]&&_0x459e32['body']['attachments'][_0xb2fc('0x4a')]){for(var _0x54d383=0x0;_0x54d383<_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][_0xb2fc('0x4a')];_0x54d383+=0x1){_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][_0x54d383]={'filename':_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][_0x54d383]['name'],'id':_0x459e32[_0xb2fc('0x5c')]['attachments'][_0x54d383]['id'],'path':path['join'](config[_0xb2fc('0xa8')],_0xb2fc('0xa9'),_0x459e32['body']['attachments'][_0x54d383][_0xb2fc('0xaa')])};}}return respondWithRpcPromise(_0xb2fc('0xab'),_0xb2fc('0xab'),{'FaxAccountId':_[_0xb2fc('0xac')](_0x459e32[_0xb2fc('0x57')]['id'])?undefined:_0x459e32['params']['id'],'path':_[_0xb2fc('0xac')](_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][0x0][_0xb2fc('0xad')])?undefined:_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][0x0][_0xb2fc('0xad')],'fax':_['isNil'](_0x459e32[_0xb2fc('0x5c')]['to'][0x0])?undefined:_0x459e32['body']['to'][0x0]},client9002);})['then'](function(){if(_0x22decb){if(_[_0xb2fc('0xac')](_0x459e32[_0xb2fc('0x5c')]['from'])){_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xae')]=util[_0xb2fc('0xa3')](_0xb2fc('0xaf'),_0x22decb[_0xb2fc('0x3c')],_0x22decb['fax']);}if(_0x22decb[_0xb2fc('0xb0')]){if(_0x22decb[_0xb2fc('0xb0')][_0xb2fc('0xb1')]['length']){return _0x22decb[_0xb2fc('0xb0')][_0xb2fc('0xb1')][0x0];}else{return db['CmContact'][_0xb2fc('0x5b')](_[_0xb2fc('0x19')](_0x459e32[_0xb2fc('0x5c')],{'firstName':_0x459e32[_0xb2fc('0x5c')]['to'][0x0],'phone':_0x459e32['body']['to'][0x0],'fax':_0x459e32['body']['to'][0x0],'ListId':_0x22decb[_0xb2fc('0x9d')]}));}}else{throw new Error(_0xb2fc('0xb2'));}}else{throw new Error(_0xb2fc('0xb3'));}})[_0xb2fc('0x21')](function(_0x195b21){if(_0x195b21){return db[_0xb2fc('0x74')][_0xb2fc('0x5a')]({'where':{'ContactId':_0x195b21['id'],'closed':![],'FaxAccountId':_0x22decb['id']}})['then'](function(_0x42f7f5){if(_0x42f7f5){return[_0x42f7f5,![]];}return db[_0xb2fc('0x74')][_0xb2fc('0x5b')]({'UserId':_0x459e32[_0xb2fc('0x5d')]['id'],'ContactId':_0x195b21['id'],'FaxAccountId':_0x22decb['id'],'fax':_0x459e32['body']['to'][0x0],'firstMsgDirection':_0xb2fc('0xb4'),'Messages':[_[_0xb2fc('0x69')](_0x459e32[_0xb2fc('0x5c')],{'read':![],'body':_0x459e32['body'][_0xb2fc('0xa7')][0x0][_0xb2fc('0xb5')],'FaxAccountId':_0x22decb['id'],'UserId':_0x459e32[_0xb2fc('0x5d')]['id'],'ContactId':_0x195b21['id'],'AttachmentId':_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0xb2fc('0xa0')],'as':_0xb2fc('0xb6')}]})[_0xb2fc('0x21')](function(_0x286db3){return[_0x286db3,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x1273cc,_0x25e667){if(_0x25e667){return _0x1273cc;}return db[_0xb2fc('0xa0')][_0xb2fc('0x5b')]({'direction':'out','read':![],'body':_0x459e32['body'][_0xb2fc('0xa7')][0x0][_0xb2fc('0xb5')],'FaxAccountId':_0x22decb['id'],'FaxInteractionId':_0x1273cc['id'],'UserId':_0x459e32[_0xb2fc('0x5d')]['id'],'ContactId':_0x1273cc[_0xb2fc('0xb7')],'AttachmentId':_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][0x0]['id']})['then'](function(_0x58a717){_0x1273cc['dataValues'][_0xb2fc('0xb6')]=[];_0x1273cc[_0xb2fc('0xb8')][_0xb2fc('0xb6')][_0xb2fc('0x89')](_0x58a717['dataValues']);return _0x1273cc;});})['then'](function(_0x262b3b){respondWithRpcPromise(_0xb2fc('0xb9'),'SendFax',{'FaxAccountId':_[_0xb2fc('0xac')](_0x459e32['params']['id'])?undefined:_0x459e32[_0xb2fc('0x57')]['id'],'path':_[_0xb2fc('0xac')](_0x459e32['body'][_0xb2fc('0xa7')][0x0][_0xb2fc('0xad')])?undefined:_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][0x0][_0xb2fc('0xad')],'fax':_[_0xb2fc('0xac')](_0x459e32[_0xb2fc('0x5c')]['to'][0x0])?undefined:_0x459e32[_0xb2fc('0x5c')]['to'][0x0],'AttachmentId':_0x459e32[_0xb2fc('0x5c')][_0xb2fc('0xa7')][0x0]['id']},client9002)[_0xb2fc('0x21')](function(_0x51ce85){logger[_0xb2fc('0xba')]('SendFaxRpc,\x20%s',_0x51ce85);})[_0xb2fc('0x2b')](function(_0x4ac1f7){logger[_0xb2fc('0xba')](_0xb2fc('0xbb'),_0x4ac1f7);});return _0x262b3b;})['then'](respondWithResult(_0x546a80,null))[_0xb2fc('0x2b')](handleError(_0x546a80,null));};exports['addAgents']=function(_0x8a6cdd,_0x435b10,_0x56b649){return db[_0xb2fc('0x40')][_0xb2fc('0x5a')]({'where':{'id':_0x8a6cdd[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x435b10,null))[_0xb2fc('0x21')](function(_0x2fafbe){if(_0x2fafbe){return _0x2fafbe[_0xb2fc('0xbc')](_0x8a6cdd[_0xb2fc('0x5c')][_0xb2fc('0x6c')],_['omit'](_0x8a6cdd['body'],[_0xb2fc('0x6c'),'id'])||{})[_0xb2fc('0xbd')](function(_0x14a4eb){for(var _0x416d1d=0x0;_0x416d1d<_0x8a6cdd[_0xb2fc('0x5c')][_0xb2fc('0x6c')]['length'];_0x416d1d+=0x1){socket['emit'](_0xb2fc('0xbe'),{'UserId':Number(_0x8a6cdd[_0xb2fc('0x5c')][_0xb2fc('0x6c')][_0x416d1d]),'FaxAccountId':Number(_0x8a6cdd[_0xb2fc('0x57')]['id'])});}return _0x14a4eb;});}})[_0xb2fc('0x21')](respondWithResult(_0x435b10,null))[_0xb2fc('0x2b')](handleError(_0x435b10,null));};exports[_0xb2fc('0xbf')]=function(_0x347b2d,_0x4e5ad8,_0x46be4a){return db[_0xb2fc('0x40')][_0xb2fc('0x5a')]({'where':{'id':_0x347b2d[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x4e5ad8,null))['then'](function(_0x23a634){if(_0x23a634){return _0x23a634[_0xb2fc('0xbf')](_0x347b2d[_0xb2fc('0x45')][_0xb2fc('0x6c')])[_0xb2fc('0x21')](function(){if(_['isArray'](_0x347b2d[_0xb2fc('0x45')]['ids'])){for(var _0x5560ed=0x0;_0x5560ed<_0x347b2d['query'][_0xb2fc('0x6c')][_0xb2fc('0x4a')];_0x5560ed+=0x1){socket['emit'](_0xb2fc('0xc0'),{'UserId':Number(_0x347b2d['query'][_0xb2fc('0x6c')][_0x5560ed]),'FaxAccountId':Number(_0x347b2d[_0xb2fc('0x57')]['id'])});}}else{socket[_0xb2fc('0xc1')](_0xb2fc('0xc0'),{'UserId':Number(_0x347b2d[_0xb2fc('0x45')][_0xb2fc('0x6c')]),'FaxAccountId':Number(_0x347b2d['params']['id'])});}});}})[_0xb2fc('0x21')](respondWithStatusCode(_0x4e5ad8,null))[_0xb2fc('0x2b')](handleError(_0x4e5ad8,null));};exports['getAgents']=function(_0x24efe7,_0x1b0e52,_0x220dff){var _0x96304d={};var _0x375e87={};var _0x39a014;var _0xd995ab;return db[_0xb2fc('0x40')][_0xb2fc('0x66')]({'where':{'id':_0x24efe7[_0xb2fc('0x57')]['id']}})[_0xb2fc('0x21')](handleEntityNotFound(_0x1b0e52,null))['then'](function(_0x5abdac){if(_0x5abdac){_0x39a014=_0x5abdac;_0x375e87[_0xb2fc('0x44')]=_[_0xb2fc('0x46')](db[_0xb2fc('0xc2')][_0xb2fc('0x67')]);_0x375e87[_0xb2fc('0x45')]=_[_0xb2fc('0x46')](_0x24efe7[_0xb2fc('0x45')]);_0x375e87[_0xb2fc('0x4f')]=_[_0xb2fc('0x47')](_0x375e87[_0xb2fc('0x44')],_0x375e87[_0xb2fc('0x45')]);_0x96304d[_0xb2fc('0x49')]=_['intersection'](_0x375e87[_0xb2fc('0x44')],qs[_0xb2fc('0x48')](_0x24efe7[_0xb2fc('0x45')][_0xb2fc('0x48')]));_0x96304d[_0xb2fc('0x49')]=_0x96304d['attributes'][_0xb2fc('0x4a')]?_0x96304d[_0xb2fc('0x49')]:_0x375e87['model'];_0x96304d[_0xb2fc('0x68')]=qs[_0xb2fc('0x4d')](_0x24efe7[_0xb2fc('0x45')]['sort']);_0x96304d[_0xb2fc('0x4e')]=qs[_0xb2fc('0x4f')](_[_0xb2fc('0x50')](_0x24efe7[_0xb2fc('0x45')],_0x375e87[_0xb2fc('0x4f')]));if(_0x24efe7[_0xb2fc('0x45')][_0xb2fc('0x51')]){_0x96304d[_0xb2fc('0x4e')]=_[_0xb2fc('0x69')](_0x96304d[_0xb2fc('0x4e')],{'$or':_[_0xb2fc('0x3f')](_0x96304d[_0xb2fc('0x49')],function(_0x2fb541){var _0x43e4f4={};_0x43e4f4[_0x2fb541]={'$like':'%'+_0x24efe7[_0xb2fc('0x45')][_0xb2fc('0x51')]+'%'};return _0x43e4f4;})});}_0x96304d=_[_0xb2fc('0x69')]({},_0x96304d,_0x24efe7[_0xb2fc('0x52')]);return _0x39a014[_0xb2fc('0xc3')](_0x96304d);}})[_0xb2fc('0x21')](function(_0x1eb01c){if(_0x1eb01c){_0xd995ab=_0x1eb01c[_0xb2fc('0x4a')];if(!_0x24efe7[_0xb2fc('0x45')][_0xb2fc('0x4b')](_0xb2fc('0x4c'))){_0x96304d[_0xb2fc('0x32')]=qs[_0xb2fc('0x32')](_0x24efe7[_0xb2fc('0x45')]['limit']);_0x96304d[_0xb2fc('0x2f')]=qs[_0xb2fc('0x2f')](_0x24efe7[_0xb2fc('0x45')]['offset']);}return _0x39a014[_0xb2fc('0xc3')](_0x96304d);}})[_0xb2fc('0x21')](function(_0x68659a){if(_0x68659a){return _0x68659a?{'count':_0xd995ab,'rows':_0x68659a}:null;}})[_0xb2fc('0x21')](respondWithResult(_0x1b0e52,null))['catch'](handleError(_0x1b0e52,null));}; \ No newline at end of file +var _0x285b=['description','appdata','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','maxrate','minrate','modem','push','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','sequelize','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmContact','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','Contacts','Send\x20Fax\x20failed','out','filename','spread','ContactId','dataValues','Messages','SendFax','path','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','code','FaxAccount,\x20%s,\x20%s','error','message','result','catch','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','destroy','get','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','Pause','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','removeDispositions','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','ids','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','FaxApplication','bulkCreate','priority','getApplications','exten','app','system'];(function(_0x1df467,_0x3839b3){var _0x30cfff=function(_0x1a8bbb){while(--_0x1a8bbb){_0x1df467['push'](_0x1df467['shift']());}};_0x30cfff(++_0x3839b3);}(_0x285b,0x1ce));var _0xb285=function(_0x18ebcb,_0x4e6397){_0x18ebcb=_0x18ebcb-0x0;var _0x28f014=_0x285b[_0x18ebcb];return _0x28f014;};'use strict';var emlformat=require(_0xb285('0x0'));var rimraf=require(_0xb285('0x1'));var zipdir=require(_0xb285('0x2'));var jsonpatch=require(_0xb285('0x3'));var rp=require(_0xb285('0x4'));var moment=require(_0xb285('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb285('0x6'));var util=require(_0xb285('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb285('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb285('0x9'));var _=require('lodash');var squel=require(_0xb285('0xa'));var crypto=require(_0xb285('0xb'));var jsforce=require(_0xb285('0xc'));var deskjs=require(_0xb285('0xd'));var toCsv=require(_0xb285('0x8'));var querystring=require(_0xb285('0xe'));var Papa=require(_0xb285('0xf'));var Redis=require(_0xb285('0x10'));var authService=require(_0xb285('0x11'));var qs=require(_0xb285('0x12'));var as=require(_0xb285('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb285('0x14'))(_0xb285('0x15'));var utils=require(_0xb285('0x16'));var config=require(_0xb285('0x17'));var licenseUtil=require(_0xb285('0x18'));var db=require(_0xb285('0x19'))['db'];config[_0xb285('0x1a')]=_[_0xb285('0x1b')](config[_0xb285('0x1a')],{'host':_0xb285('0x1c'),'port':0x18eb});var socket=require(_0xb285('0x1d'))(new Redis(config[_0xb285('0x1a')]));require(_0xb285('0x1e'))[_0xb285('0x1f')](socket);var jayson=require(_0xb285('0x20'));var client=jayson[_0xb285('0x21')][_0xb285('0x22')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21f988,_0x365855,_0x1cfdea,_0x383ee2){return new BPromise(function(_0x1ed3e9,_0x5f2aad){var _0x41f7cd=_0x383ee2||client;return _0x41f7cd[_0xb285('0x23')](_0x21f988,_0x1cfdea)[_0xb285('0x24')](function(_0x4426e4){logger[_0xb285('0x25')]('FaxAccount,\x20%s,\x20%s',_0x365855,_0xb285('0x26'));logger[_0xb285('0x27')](_0xb285('0x28'),_0x365855,'request\x20sent',JSON['stringify'](_0x4426e4));if(_0x4426e4['error']){if(_0x4426e4['error'][_0xb285('0x29')]===0x1f4){logger['error'](_0xb285('0x2a'),_0x365855,_0x4426e4['error']['message']);return _0x5f2aad(_0x4426e4[_0xb285('0x2b')]['message']);}logger[_0xb285('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x365855,_0x4426e4[_0xb285('0x2b')][_0xb285('0x2c')]);return _0x1ed3e9(_0x4426e4[_0xb285('0x2b')][_0xb285('0x2c')]);}else{logger[_0xb285('0x25')](_0xb285('0x2a'),_0x365855,_0xb285('0x26'));_0x1ed3e9(_0x4426e4[_0xb285('0x2d')][_0xb285('0x2c')]);}})[_0xb285('0x2e')](function(_0x11ac9e){logger[_0xb285('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x365855,_0x11ac9e);_0x5f2aad(_0x11ac9e);});});}function respondWithStatusCode(_0x43adff,_0xb18154){_0xb18154=_0xb18154||0xcc;return function(_0x128ba6){if(_0x128ba6){return _0x43adff[_0xb285('0x2f')](_0xb18154);}return _0x43adff['status'](_0xb18154)[_0xb285('0x30')]();};}function respondWithResult(_0xb63d3a,_0x2b47be){_0x2b47be=_0x2b47be||0xc8;return function(_0x5b0189){if(_0x5b0189){return _0xb63d3a[_0xb285('0x31')](_0x2b47be)['json'](_0x5b0189);}};}function respondWithFilteredResult(_0xa14a1f,_0x53c9fc){return function(_0x5bc478){if(_0x5bc478){var _0x4aba79=typeof _0x53c9fc[_0xb285('0x32')]===_0xb285('0x33')&&typeof _0x53c9fc['limit']===_0xb285('0x33');var _0x1a57ee=_0x5bc478[_0xb285('0x34')];var _0x210a35=_0x4aba79?0x0:_0x53c9fc[_0xb285('0x32')];var _0x4038c7=_0x4aba79?_0x5bc478['count']:_0x53c9fc[_0xb285('0x32')]+_0x53c9fc[_0xb285('0x35')];var _0x35a982;if(_0x4038c7>=_0x1a57ee){_0x4038c7=_0x1a57ee;_0x35a982=0xc8;}else{_0x35a982=0xce;}_0xa14a1f['status'](_0x35a982);return _0xa14a1f[_0xb285('0x36')](_0xb285('0x37'),_0x210a35+'-'+_0x4038c7+'/'+_0x1a57ee)[_0xb285('0x38')](_0x5bc478);}return null;};}function patchUpdates(_0x20c9df){return function(_0x211084){try{jsonpatch[_0xb285('0x39')](_0x211084,_0x20c9df,!![]);}catch(_0x5e17c1){return BPromise[_0xb285('0x3a')](_0x5e17c1);}return _0x211084['save']();};}function saveUpdates(_0x75503a,_0x4c56bd){return function(_0x2a57b4){if(_0x2a57b4){return _0x2a57b4[_0xb285('0x3b')](_0x75503a)['then'](function(_0x454c6f){return _0x454c6f;});}return null;};}function removeEntity(_0x2b323d,_0x2dc895){return function(_0x1a3719){if(_0x1a3719){return _0x1a3719[_0xb285('0x3c')]()[_0xb285('0x24')](function(){var _0x3d64be=_0x1a3719[_0xb285('0x3d')]({'plain':!![]});var _0xed311c='FaxAccounts';return db[_0xb285('0x3e')]['destroy']({'where':{'type':_0xed311c,'resourceId':_0x3d64be['id']}})[_0xb285('0x24')](function(){return _0x1a3719;});})['then'](function(){_0x2b323d[_0xb285('0x31')](0xcc)[_0xb285('0x30')]();});}};}function handleEntityNotFound(_0x353409,_0x1d8017){return function(_0x356366){if(!_0x356366){_0x353409[_0xb285('0x2f')](0x194);}return _0x356366;};}function handleError(_0x2a3a48,_0x130e64){_0x130e64=_0x130e64||0x1f4;return function(_0x12e506){logger[_0xb285('0x2b')](_0x12e506[_0xb285('0x3f')]);if(_0x12e506[_0xb285('0x40')]){delete _0x12e506[_0xb285('0x40')];}_0x2a3a48[_0xb285('0x31')](_0x130e64)[_0xb285('0x41')](_0x12e506);};}exports[_0xb285('0x42')]=function(_0x2901ec,_0x3422be){var _0x4e6a7a={'include':[{'model':db['Pause'],'as':_0xb285('0x43')}]},_0x3b0411={},_0x361638={'count':0x0,'rows':[]};var _0x41cfad=_['map'](db[_0xb285('0x44')][_0xb285('0x45')],function(_0x33f4a9){return{'name':_0x33f4a9[_0xb285('0x46')],'type':_0x33f4a9[_0xb285('0x47')][_0xb285('0x48')]};});_0x3b0411[_0xb285('0x49')]=_[_0xb285('0x4a')](_0x41cfad,_0xb285('0x40'));_0x3b0411[_0xb285('0x4b')]=_[_0xb285('0x4c')](_0x2901ec[_0xb285('0x4b')]);_0x3b0411[_0xb285('0x4d')]=_[_0xb285('0x4e')](_0x3b0411[_0xb285('0x49')],_0x3b0411[_0xb285('0x4b')]);_0x4e6a7a[_0xb285('0x4f')]=_[_0xb285('0x4e')](_0x3b0411['model'],qs[_0xb285('0x50')](_0x2901ec[_0xb285('0x4b')][_0xb285('0x50')]));_0x4e6a7a[_0xb285('0x4f')]=_0x4e6a7a['attributes'][_0xb285('0x51')]?_0x4e6a7a[_0xb285('0x4f')]:_0x3b0411[_0xb285('0x49')];if(!_0x2901ec[_0xb285('0x4b')][_0xb285('0x52')](_0xb285('0x53'))){_0x4e6a7a[_0xb285('0x35')]=qs[_0xb285('0x35')](_0x2901ec[_0xb285('0x4b')][_0xb285('0x35')]);_0x4e6a7a[_0xb285('0x32')]=qs[_0xb285('0x32')](_0x2901ec[_0xb285('0x4b')][_0xb285('0x32')]);}_0x4e6a7a[_0xb285('0x54')]=qs[_0xb285('0x55')](_0x2901ec[_0xb285('0x4b')][_0xb285('0x55')]);_0x4e6a7a[_0xb285('0x56')]=qs[_0xb285('0x4d')](_[_0xb285('0x57')](_0x2901ec[_0xb285('0x4b')],_0x3b0411[_0xb285('0x4d')]),_0x41cfad);if(_0x2901ec[_0xb285('0x4b')][_0xb285('0x58')]){_0x4e6a7a[_0xb285('0x56')]=_['merge'](_0x4e6a7a[_0xb285('0x56')],{'$or':_[_0xb285('0x4a')](_0x41cfad,function(_0x43f402){if(_0x43f402[_0xb285('0x47')]!==_0xb285('0x59')){var _0x459b81={};_0x459b81[_0x43f402['name']]={'$like':'%'+_0x2901ec[_0xb285('0x4b')][_0xb285('0x58')]+'%'};return _0x459b81;}})});}_0x4e6a7a=_['merge']({},_0x4e6a7a,_0x2901ec['options']);var _0x5475fa={'where':_0x4e6a7a[_0xb285('0x56')]};return db[_0xb285('0x44')][_0xb285('0x34')](_0x5475fa)[_0xb285('0x24')](function(_0x24e202){_0x361638[_0xb285('0x34')]=_0x24e202;if(_0x2901ec['query'][_0xb285('0x5a')]){_0x4e6a7a[_0xb285('0x5b')]=[{'all':!![]}];}return db[_0xb285('0x44')][_0xb285('0x5c')](_0x4e6a7a);})[_0xb285('0x24')](function(_0x46deac){_0x361638[_0xb285('0x5d')]=_0x46deac;return _0x361638;})[_0xb285('0x24')](respondWithFilteredResult(_0x3422be,_0x4e6a7a))['catch'](handleError(_0x3422be,null));};exports[_0xb285('0x5e')]=function(_0x26c5d2,_0x4014b3){var _0x58bcb1={'raw':![],'where':{'id':_0x26c5d2[_0xb285('0x5f')]['id']},'include':[{'model':db[_0xb285('0x60')],'as':_0xb285('0x43')}]},_0xc48552={};_0xc48552[_0xb285('0x49')]=_['keys'](db['FaxAccount'][_0xb285('0x45')]);_0xc48552['query']=_[_0xb285('0x4c')](_0x26c5d2[_0xb285('0x4b')]);_0xc48552[_0xb285('0x4d')]=_['intersection'](_0xc48552[_0xb285('0x49')],_0xc48552[_0xb285('0x4b')]);_0x58bcb1[_0xb285('0x4f')]=_[_0xb285('0x4e')](_0xc48552[_0xb285('0x49')],qs[_0xb285('0x50')](_0x26c5d2[_0xb285('0x4b')][_0xb285('0x50')]));_0x58bcb1[_0xb285('0x4f')]=_0x58bcb1[_0xb285('0x4f')][_0xb285('0x51')]?_0x58bcb1[_0xb285('0x4f')]:_0xc48552['model'];if(_0x26c5d2[_0xb285('0x4b')]['includeAll']){_0x58bcb1[_0xb285('0x5b')]=[{'all':!![]}];}_0x58bcb1=_[_0xb285('0x61')]({},_0x58bcb1,_0x26c5d2[_0xb285('0x62')]);return db[_0xb285('0x44')][_0xb285('0x63')](_0x58bcb1)[_0xb285('0x24')](handleEntityNotFound(_0x4014b3,null))[_0xb285('0x24')](respondWithResult(_0x4014b3,null))[_0xb285('0x2e')](handleError(_0x4014b3,null));};exports[_0xb285('0x64')]=function(_0x49fa97,_0x24903f){return db[_0xb285('0x44')][_0xb285('0x64')](_0x49fa97[_0xb285('0x65')],{})[_0xb285('0x24')](function(_0x5a4761){var _0x3c4255=_0x49fa97[_0xb285('0x66')][_0xb285('0x3d')]({'plain':!![]});if(!_0x3c4255)throw new Error(_0xb285('0x67'));if(_0x3c4255[_0xb285('0x68')]===_0xb285('0x66')){var _0x209e02=_0x5a4761[_0xb285('0x3d')]({'plain':!![]});var _0x4f5223=_0xb285('0x69');return db[_0xb285('0x6a')]['find']({'where':{'name':_0x4f5223,'userProfileId':_0x3c4255[_0xb285('0x6b')]},'raw':!![]})[_0xb285('0x24')](function(_0x3bc8f8){if(_0x3bc8f8&&_0x3bc8f8[_0xb285('0x6c')]===0x0){return db[_0xb285('0x3e')][_0xb285('0x64')]({'name':_0x209e02[_0xb285('0x40')],'resourceId':_0x209e02['id'],'type':_0x3bc8f8[_0xb285('0x40')],'sectionId':_0x3bc8f8['id']},{})[_0xb285('0x24')](function(){return _0x5a4761;});}else{return _0x5a4761;}})['catch'](function(_0x185c60){logger[_0xb285('0x2b')](_0xb285('0x6d'),_0x185c60);throw _0x185c60;});}return _0x5a4761;})[_0xb285('0x24')](respondWithResult(_0x24903f,0xc9))[_0xb285('0x2e')](handleError(_0x24903f,null));};exports['update']=function(_0x191525,_0x57a7eb){if(_0x191525[_0xb285('0x65')]['id']){delete _0x191525[_0xb285('0x65')]['id'];}return db[_0xb285('0x44')]['find']({'where':{'id':_0x191525[_0xb285('0x5f')]['id']},'include':[{'model':db[_0xb285('0x60')],'as':'mandatoryDispositionPause'}]})[_0xb285('0x24')](handleEntityNotFound(_0x57a7eb,null))[_0xb285('0x24')](saveUpdates(_0x191525[_0xb285('0x65')],null))['then'](respondWithResult(_0x57a7eb,null))[_0xb285('0x2e')](handleError(_0x57a7eb,null));};exports['destroy']=function(_0x1c76b7,_0x4be251){return db[_0xb285('0x44')][_0xb285('0x63')]({'where':{'id':_0x1c76b7[_0xb285('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4be251,null))[_0xb285('0x24')](removeEntity(_0x4be251,null))[_0xb285('0x2e')](handleError(_0x4be251,null));};exports[_0xb285('0x6e')]=function(_0x2b3487,_0x4c3cf0){return db[_0xb285('0x44')][_0xb285('0x6e')]()[_0xb285('0x24')](respondWithResult(_0x4c3cf0,null))['catch'](handleError(_0x4c3cf0,null));};exports[_0xb285('0x6f')]=function(_0x471eba,_0x54b1de,_0x4c902a){if(_0x471eba['body']['id']){delete _0x471eba['body']['id'];}return db[_0xb285('0x44')][_0xb285('0x63')]({'where':{'id':_0x471eba[_0xb285('0x5f')]['id']}})[_0xb285('0x24')](handleEntityNotFound(_0x54b1de,null))[_0xb285('0x24')](function(_0x2fe880){if(_0x2fe880){_0x471eba[_0xb285('0x65')][_0xb285('0x70')]=_0x2fe880['id'];return db[_0xb285('0x71')][_0xb285('0x64')](_0x471eba[_0xb285('0x65')]);}})[_0xb285('0x24')](respondWithResult(_0x54b1de,null))[_0xb285('0x2e')](handleError(_0x54b1de,null));};exports['getDispositions']=function(_0x2b4525,_0x3a05a6,_0x51d081){var _0x4c6838={'raw':![],'where':{}};var _0x5ba610={};var _0x28a46c={'count':0x0,'rows':[]};return db[_0xb285('0x44')][_0xb285('0x72')]({'where':{'id':_0x2b4525[_0xb285('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3a05a6,null))[_0xb285('0x24')](function(_0x1a107e){if(_0x1a107e){_0x5ba610[_0xb285('0x49')]=_[_0xb285('0x4c')](db[_0xb285('0x71')]['rawAttributes']);_0x5ba610['query']=_[_0xb285('0x4c')](_0x2b4525[_0xb285('0x4b')]);_0x5ba610['filters']=_[_0xb285('0x4e')](_0x5ba610[_0xb285('0x49')],_0x5ba610['query']);_0x4c6838[_0xb285('0x4f')]=_[_0xb285('0x4e')](_0x5ba610[_0xb285('0x49')],qs['fields'](_0x2b4525[_0xb285('0x4b')][_0xb285('0x50')]));_0x4c6838[_0xb285('0x4f')]=_0x4c6838['attributes'][_0xb285('0x51')]?_0x4c6838[_0xb285('0x4f')]:_0x5ba610[_0xb285('0x49')];if(!_0x2b4525['query'][_0xb285('0x52')](_0xb285('0x53'))){_0x4c6838[_0xb285('0x35')]=qs[_0xb285('0x35')](_0x2b4525[_0xb285('0x4b')][_0xb285('0x35')]);_0x4c6838[_0xb285('0x32')]=qs[_0xb285('0x32')](_0x2b4525[_0xb285('0x4b')]['offset']);}_0x4c6838[_0xb285('0x54')]=qs[_0xb285('0x55')](_0x2b4525['query'][_0xb285('0x55')]);_0x4c6838[_0xb285('0x56')]=qs['filters'](_['pick'](_0x2b4525['query'],_0x5ba610['filters']));_0x4c6838[_0xb285('0x56')][_0xb285('0x70')]=_0x1a107e['id'];if(_0x2b4525[_0xb285('0x4b')][_0xb285('0x58')]){_0x4c6838['where']=_[_0xb285('0x61')](_0x4c6838[_0xb285('0x56')],{'$or':_[_0xb285('0x4a')](_0x4c6838[_0xb285('0x4f')],function(_0x563f1f){var _0x11eb90={};_0x11eb90[_0x563f1f]={'$like':'%'+_0x2b4525[_0xb285('0x4b')][_0xb285('0x58')]+'%'};return _0x11eb90;})});}_0x4c6838=_[_0xb285('0x61')]({},_0x4c6838,_0x2b4525[_0xb285('0x62')]);return db[_0xb285('0x71')][_0xb285('0x34')]({'where':_0x4c6838[_0xb285('0x56')]})['then'](function(_0x4d0e8f){_0x28a46c[_0xb285('0x34')]=_0x4d0e8f;if(_0x2b4525[_0xb285('0x4b')]['includeAll']){_0x4c6838[_0xb285('0x5b')]=[{'all':!![]}];}return db[_0xb285('0x71')][_0xb285('0x5c')](_0x4c6838);})[_0xb285('0x24')](function(_0x441f19){_0x28a46c[_0xb285('0x5d')]=_0x441f19;return _0x28a46c;});}})[_0xb285('0x24')](respondWithFilteredResult(_0x3a05a6,_0x4c6838))['catch'](handleError(_0x3a05a6,null));};exports[_0xb285('0x73')]=function(_0x46b66a,_0x5bbf41,_0x9b2418){return db[_0xb285('0x44')][_0xb285('0x63')]({'where':{'id':_0x46b66a['params']['id']}})[_0xb285('0x24')](handleEntityNotFound(_0x5bbf41,null))[_0xb285('0x24')](function(_0x5cf479){if(_0x5cf479){return _0x5cf479[_0xb285('0x73')](_0x46b66a[_0xb285('0x4b')]['ids']);}})[_0xb285('0x24')](respondWithStatusCode(_0x5bbf41,null))[_0xb285('0x2e')](handleError(_0x5bbf41,null));};exports['addAnswer']=function(_0x3b2df6,_0x3ab5bb,_0x59b5f4){if(_0x3b2df6[_0xb285('0x65')]['id']){delete _0x3b2df6[_0xb285('0x65')]['id'];}return db[_0xb285('0x44')]['find']({'where':{'id':_0x3b2df6[_0xb285('0x5f')]['id']}})[_0xb285('0x24')](handleEntityNotFound(_0x3ab5bb,null))[_0xb285('0x24')](function(_0x119e2e){if(_0x119e2e){_0x3b2df6[_0xb285('0x65')][_0xb285('0x70')]=_0x119e2e['id'];return db[_0xb285('0x74')][_0xb285('0x64')](_0x3b2df6['body']);}})['then'](respondWithResult(_0x3ab5bb,null))[_0xb285('0x2e')](handleError(_0x3ab5bb,null));};exports[_0xb285('0x75')]=function(_0x170d04,_0x32d91f,_0x16cf6a){var _0x5b6456={'raw':![],'where':{}};var _0x781c53={};var _0x45b2f4={'count':0x0,'rows':[]};return db[_0xb285('0x44')][_0xb285('0x72')]({'where':{'id':_0x170d04[_0xb285('0x5f')]['id']}})[_0xb285('0x24')](handleEntityNotFound(_0x32d91f,null))[_0xb285('0x24')](function(_0x231b30){if(_0x231b30){_0x781c53[_0xb285('0x49')]=_[_0xb285('0x4c')](db[_0xb285('0x74')][_0xb285('0x45')]);_0x781c53[_0xb285('0x4b')]=_[_0xb285('0x4c')](_0x170d04[_0xb285('0x4b')]);_0x781c53[_0xb285('0x4d')]=_[_0xb285('0x4e')](_0x781c53[_0xb285('0x49')],_0x781c53[_0xb285('0x4b')]);_0x5b6456[_0xb285('0x4f')]=_[_0xb285('0x4e')](_0x781c53[_0xb285('0x49')],qs[_0xb285('0x50')](_0x170d04[_0xb285('0x4b')][_0xb285('0x50')]));_0x5b6456['attributes']=_0x5b6456[_0xb285('0x4f')][_0xb285('0x51')]?_0x5b6456['attributes']:_0x781c53['model'];if(!_0x170d04[_0xb285('0x4b')][_0xb285('0x52')](_0xb285('0x53'))){_0x5b6456[_0xb285('0x35')]=qs[_0xb285('0x35')](_0x170d04[_0xb285('0x4b')][_0xb285('0x35')]);_0x5b6456[_0xb285('0x32')]=qs[_0xb285('0x32')](_0x170d04['query'][_0xb285('0x32')]);}_0x5b6456[_0xb285('0x54')]=qs[_0xb285('0x55')](_0x170d04[_0xb285('0x4b')][_0xb285('0x55')]);_0x5b6456['where']=qs[_0xb285('0x4d')](_[_0xb285('0x57')](_0x170d04['query'],_0x781c53[_0xb285('0x4d')]));_0x5b6456[_0xb285('0x56')][_0xb285('0x70')]=_0x231b30['id'];if(_0x170d04[_0xb285('0x4b')][_0xb285('0x58')]){_0x5b6456['where']=_['merge'](_0x5b6456['where'],{'$or':_[_0xb285('0x4a')](_0x5b6456[_0xb285('0x4f')],function(_0xb7b05){var _0x457e02={};_0x457e02[_0xb7b05]={'$like':'%'+_0x170d04[_0xb285('0x4b')]['filter']+'%'};return _0x457e02;})});}_0x5b6456=_[_0xb285('0x61')]({},_0x5b6456,_0x170d04[_0xb285('0x62')]);return db['CannedAnswer'][_0xb285('0x34')]({'where':_0x5b6456[_0xb285('0x56')]})[_0xb285('0x24')](function(_0x66b7b9){_0x45b2f4[_0xb285('0x34')]=_0x66b7b9;if(_0x170d04['query'][_0xb285('0x5a')]){_0x5b6456[_0xb285('0x5b')]=[{'all':!![]}];}return db[_0xb285('0x74')][_0xb285('0x5c')](_0x5b6456);})[_0xb285('0x24')](function(_0x1d99c0){_0x45b2f4[_0xb285('0x5d')]=_0x1d99c0;return _0x45b2f4;});}})['then'](respondWithFilteredResult(_0x32d91f,_0x5b6456))[_0xb285('0x2e')](handleError(_0x32d91f,null));};exports[_0xb285('0x76')]=function(_0x2b6c51,_0xca6d56,_0x3a2dfc){return db[_0xb285('0x44')][_0xb285('0x63')]({'where':{'id':_0x2b6c51[_0xb285('0x5f')]['id']}})[_0xb285('0x24')](handleEntityNotFound(_0xca6d56,null))['then'](function(_0x56364d){if(_0x56364d){return _0x56364d['removeAnswers'](_0x2b6c51[_0xb285('0x4b')]['ids']);}})[_0xb285('0x24')](respondWithStatusCode(_0xca6d56,null))[_0xb285('0x2e')](handleError(_0xca6d56,null));};exports[_0xb285('0x77')]=function(_0x13b798,_0x4f29ff,_0x3cbb7e){return db[_0xb285('0x78')][_0xb285('0x63')]({'where':{'id':_0x13b798[_0xb285('0x5f')]['id']}})[_0xb285('0x24')](handleEntityNotFound(_0x4f29ff,null))[_0xb285('0x24')](function(_0x4d401b){if(_0x4d401b){return _0x4d401b['addInteraction'](_0x13b798[_0xb285('0x65')][_0xb285('0x79')],_[_0xb285('0x7a')](_0x13b798[_0xb285('0x65')],[_0xb285('0x79'),'id'])||{});}})[_0xb285('0x24')](respondWithResult(_0x4f29ff,null))[_0xb285('0x2e')](handleError(_0x4f29ff,null));};exports[_0xb285('0x7b')]=function(_0x5a621d,_0x4940f0,_0x243418){var _0x111330={'raw':![],'where':{}};var _0x18a372={};var _0x33f130={'count':0x0,'rows':[]};return db['FaxAccount'][_0xb285('0x72')]({'where':{'id':_0x5a621d[_0xb285('0x5f')]['id']}})[_0xb285('0x24')](handleEntityNotFound(_0x4940f0,null))[_0xb285('0x24')](function(_0x1418d1){if(_0x1418d1){_0x18a372[_0xb285('0x49')]=_[_0xb285('0x4c')](db[_0xb285('0x78')][_0xb285('0x45')]);_0x18a372[_0xb285('0x4b')]=_[_0xb285('0x4c')](_0x5a621d[_0xb285('0x4b')]);_0x18a372[_0xb285('0x4d')]=_[_0xb285('0x4e')](_0x18a372[_0xb285('0x49')],_0x18a372['query']);_0x111330['attributes']=_[_0xb285('0x4e')](_0x18a372[_0xb285('0x49')],qs['fields'](_0x5a621d[_0xb285('0x4b')][_0xb285('0x50')]));_0x111330[_0xb285('0x4f')]=_0x111330['attributes']['length']?_0x111330[_0xb285('0x4f')]:_0x18a372[_0xb285('0x49')];if(!_0x5a621d[_0xb285('0x4b')][_0xb285('0x52')]('nolimit')){_0x111330[_0xb285('0x35')]=qs[_0xb285('0x35')](_0x5a621d[_0xb285('0x4b')][_0xb285('0x35')]);_0x111330[_0xb285('0x32')]=qs['offset'](_0x5a621d[_0xb285('0x4b')][_0xb285('0x32')]);}_0x111330['order']=qs[_0xb285('0x55')](_0x5a621d[_0xb285('0x4b')][_0xb285('0x55')]);_0x111330[_0xb285('0x56')]=qs['filters'](_[_0xb285('0x57')](_0x5a621d[_0xb285('0x4b')],_0x18a372[_0xb285('0x4d')]));_0x111330[_0xb285('0x56')][_0xb285('0x70')]=_0x1418d1['id'];if(_0x5a621d[_0xb285('0x4b')][_0xb285('0x58')]){_0x111330['where']=_[_0xb285('0x61')](_0x111330[_0xb285('0x56')],{'$or':_['map'](_0x111330['attributes'],function(_0x26c075){var _0x179d6b={};_0x179d6b[_0x26c075]={'$like':'%'+_0x5a621d[_0xb285('0x4b')][_0xb285('0x58')]+'%'};return _0x179d6b;})});}_0x111330=_[_0xb285('0x61')]({},_0x111330,_0x5a621d[_0xb285('0x62')]);return db['FaxInteraction'][_0xb285('0x34')]({'where':_0x111330[_0xb285('0x56')]})[_0xb285('0x24')](function(_0x3e674f){_0x33f130[_0xb285('0x34')]=_0x3e674f;if(_0x5a621d['query']['includeAll']){_0x111330[_0xb285('0x5b')]=[{'model':db['CmContact'],'as':_0xb285('0x7c'),'required':![]},{'model':db['User'],'as':_0xb285('0x7d'),'attributes':[_0xb285('0x40'),_0xb285('0x7e'),_0xb285('0x7f')],'required':![]},{'model':db[_0xb285('0x80')],'as':_0xb285('0x81'),'attributes':['id',_0xb285('0x40'),_0xb285('0x82')],'where':_0x5a621d[_0xb285('0x4b')][_0xb285('0x83')]?{'id':_0x5a621d[_0xb285('0x4b')]['tag']}:undefined,'required':_0x5a621d[_0xb285('0x4b')][_0xb285('0x83')]?!![]:![]}];}return db[_0xb285('0x78')][_0xb285('0x5c')](_0x111330);})['then'](function(_0xa93840){_0x33f130[_0xb285('0x5d')]=_0xa93840;return _0x33f130;});}})['then'](respondWithFilteredResult(_0x4940f0,_0x111330))['catch'](handleError(_0x4940f0,null));};exports[_0xb285('0x84')]=function(_0x80afaa,_0x200d15,_0x4c2e25){return db[_0xb285('0x44')][_0xb285('0x72')]({'where':{'id':_0x80afaa['params']['id']}})[_0xb285('0x24')](handleEntityNotFound(_0x200d15,null))[_0xb285('0x24')](function(_0xd7976d){if(_0xd7976d){return db['sequelize'][_0xb285('0x85')](function(_0x38ca9e){return db[_0xb285('0x86')][_0xb285('0x3c')]({'where':{'FaxAccountId':_0x80afaa[_0xb285('0x5f')]['id']},'transaction':_0x38ca9e})[_0xb285('0x24')](function(_0x215d59){var _0x1e5a09=_['map'](_0x80afaa[_0xb285('0x65')],function(_0x2318d6){_0x2318d6['FaxAccountId']=_0x80afaa[_0xb285('0x5f')]['id'];return _0x2318d6;});return db[_0xb285('0x86')][_0xb285('0x87')](_0x1e5a09,{'transaction':_0x38ca9e});});})[_0xb285('0x24')](function(){return db[_0xb285('0x86')]['findAndCountAll']({'where':{'FaxAccountId':_0x80afaa['params']['id']},'order':_0xb285('0x88')});});}})[_0xb285('0x24')](respondWithResult(_0x200d15,null))['catch'](handleError(_0x200d15,null));};exports[_0xb285('0x89')]=function(_0x4aea4d,_0xd92cbd,_0x3a3802){var _0x2baf7d={};var _0x4187b3={};var _0x41dcdb;var _0x180947;return db[_0xb285('0x44')][_0xb285('0x72')]({'where':{'id':_0x4aea4d['params']['id']}})[_0xb285('0x24')](handleEntityNotFound(_0xd92cbd,null))['then'](function(_0x20a9e2){if(_0x20a9e2){_0x41dcdb=_0x20a9e2;_0x4187b3[_0xb285('0x49')]=_[_0xb285('0x4c')](db[_0xb285('0x86')]['rawAttributes']);_0x4187b3[_0xb285('0x4b')]=_[_0xb285('0x4c')](_0x4aea4d[_0xb285('0x4b')]);_0x4187b3[_0xb285('0x4d')]=_[_0xb285('0x4e')](_0x4187b3[_0xb285('0x49')],_0x4187b3[_0xb285('0x4b')]);_0x2baf7d['attributes']=_[_0xb285('0x4e')](_0x4187b3[_0xb285('0x49')],qs[_0xb285('0x50')](_0x4aea4d[_0xb285('0x4b')][_0xb285('0x50')]));_0x2baf7d[_0xb285('0x4f')]=_0x2baf7d[_0xb285('0x4f')][_0xb285('0x51')]?_0x2baf7d[_0xb285('0x4f')]:_0x4187b3[_0xb285('0x49')];_0x2baf7d[_0xb285('0x54')]=qs[_0xb285('0x55')](_0x4aea4d[_0xb285('0x4b')][_0xb285('0x55')]);_0x2baf7d[_0xb285('0x56')]=qs[_0xb285('0x4d')](_[_0xb285('0x57')](_0x4aea4d[_0xb285('0x4b')],_0x4187b3['filters']));if(_0x4aea4d[_0xb285('0x4b')][_0xb285('0x58')]){_0x2baf7d[_0xb285('0x56')]=_[_0xb285('0x61')](_0x2baf7d[_0xb285('0x56')],{'$or':_[_0xb285('0x4a')](_0x2baf7d['attributes'],function(_0x58c07b){var _0x4636ba={};_0x4636ba[_0x58c07b]={'$like':'%'+_0x4aea4d[_0xb285('0x4b')]['filter']+'%'};return _0x4636ba;})});}_0x2baf7d=_[_0xb285('0x61')]({},_0x2baf7d,_0x4aea4d[_0xb285('0x62')]);return _0x41dcdb[_0xb285('0x89')](_0x2baf7d);}})[_0xb285('0x24')](function(_0x309c5a){if(_0x309c5a){_0x180947=_0x309c5a['length'];if(!_0x4aea4d[_0xb285('0x4b')][_0xb285('0x52')](_0xb285('0x53'))){_0x2baf7d['limit']=qs[_0xb285('0x35')](_0x4aea4d[_0xb285('0x4b')][_0xb285('0x35')]);_0x2baf7d['offset']=qs[_0xb285('0x32')](_0x4aea4d[_0xb285('0x4b')][_0xb285('0x32')]);}return _0x41dcdb[_0xb285('0x89')](_0x2baf7d);}})[_0xb285('0x24')](function(_0x332352){if(_0x332352){return _0x332352?{'count':_0x180947,'rows':_0x332352}:null;}})[_0xb285('0x24')](respondWithResult(_0xd92cbd,null))[_0xb285('0x2e')](handleError(_0xd92cbd,null));};function Extension(_0x30ec05,_0x4cc452,_0x272e80,_0x4a654c){this['context']='from-voip-provider';this[_0xb285('0x8a')]=_0x30ec05['localstationid'];this[_0xb285('0x8b')]=_0x4a654c;this[_0xb285('0x47')]=_0xb285('0x8c');this[_0xb285('0x8d')]='Fax\x20Extension';this[_0xb285('0x70')]=_0x30ec05['id'];this['priority']=_0x4cc452;this[_0xb285('0x8e')]=_0x272e80;}function createExtensionsReciveFax(_0x3a308c){var _0xbfd6ef=0x1;var _0x22c984=[];_0x22c984['push'](new Extension(_0x3a308c,_0xbfd6ef,'','Answer'));_0xbfd6ef+=0x1;_0x22c984['push'](new Extension(_0x3a308c,_0xbfd6ef,_0xb285('0x8f'),_0xb285('0x90')));_0xbfd6ef+=0x1;for(var _0x481e3e in _0x3a308c){if(_0x3a308c[_0xb285('0x52')](_0x481e3e)&&(_0x481e3e===_0xb285('0x91')||_0x481e3e===_0xb285('0x92')||_0x481e3e===_0xb285('0x93')||_0x481e3e===_0xb285('0x94')||_0x481e3e==='headerinfo'||_0x481e3e===_0xb285('0x95')||_0x481e3e===_0xb285('0x96')||_0x481e3e===_0xb285('0x97')||_0x481e3e==='t38timeout')){_0x22c984[_0xb285('0x98')](new Extension(_0x3a308c,_0xbfd6ef,'FAXOPT('+_0x481e3e+')='+_0x3a308c[_0x481e3e],_0xb285('0x90')));_0xbfd6ef+=0x1;}}_0x22c984[_0xb285('0x98')](new Extension(_0x3a308c,_0xbfd6ef,'6',_0xb285('0x99')));_0xbfd6ef+=0x1;_0x22c984[_0xb285('0x98')](new Extension(_0x3a308c,_0xbfd6ef,_0xb285('0x9a'),_0xb285('0x9b')));_0xbfd6ef=0x0;return _0x22c984;}exports[_0xb285('0x9c')]=function(_0x54bbbb,_0x37c047,_0x345513){var _0x4dcdd4;return db[_0xb285('0x9d')][_0xb285('0x85')](function(_0x577d37){return db[_0xb285('0x44')]['create'](_0x54bbbb[_0xb285('0x65')],{'transaction':_0x577d37})[_0xb285('0x24')](function(_0x11ff79){_0x4dcdd4=_0x11ff79[_0xb285('0x3d')]({'plain':!![]});return db[_0xb285('0x9e')]['bulkCreate'](createExtensionsReciveFax(_0x4dcdd4),{'transaction':_0x577d37});});})[_0xb285('0x24')](function(){return _0x4dcdd4;})[_0xb285('0x24')](respondWithResult(_0x37c047,null))[_0xb285('0x2e')](handleError(_0x37c047,null));};exports['updateAccountApplications']=function(_0x2861a7,_0x2879ca,_0x16264a){var _0xdba081;return db[_0xb285('0x9d')]['transaction'](function(_0x2c42e2){return db['FaxAccount'][_0xb285('0x3b')](_0x2861a7[_0xb285('0x65')],{'where':{'id':_0x2861a7['body']['id']},'transaction':_0x2c42e2})[_0xb285('0x24')](function(_0x54f166){return db[_0xb285('0x9e')][_0xb285('0x3c')]({'where':{'FaxAccountId':_0x2861a7[_0xb285('0x65')]['id']},'transaction':_0x2c42e2})[_0xb285('0x24')](function(_0x5099d2){return db['VoiceExtension'][_0xb285('0x87')](createExtensionsReciveFax(_[_0xb285('0x7a')](_0x2861a7[_0xb285('0x65')],[_0xb285('0x9f'),_0xb285('0x48'),_0xb285('0xa0'),_0xb285('0xa1'),_0xb285('0xa2'),_0xb285('0xa3')])),{'transaction':_0x2c42e2});});});})[_0xb285('0x24')](function(){return db[_0xb285('0x44')][_0xb285('0xa4')](_0x2861a7[_0xb285('0x65')]['id']);})[_0xb285('0x24')](respondWithResult(_0x2879ca,null))[_0xb285('0x2e')](handleError(_0x2879ca,null));};exports[_0xb285('0xa5')]=function(_0x283754,_0x3a9fa7,_0x55b8ac){var _0x4b4017={'raw':!![],'where':{}};var _0x5278a7={};var _0x4278a1={'count':0x0,'rows':[]};return db[_0xb285('0x44')]['findOne']({'where':{'id':_0x283754[_0xb285('0x5f')]['id']}})[_0xb285('0x24')](handleEntityNotFound(_0x3a9fa7,null))[_0xb285('0x24')](function(_0x55c489){if(_0x55c489){_0x5278a7[_0xb285('0x49')]=_['keys'](db[_0xb285('0xa6')][_0xb285('0x45')]);_0x5278a7[_0xb285('0x4b')]=_[_0xb285('0x4c')](_0x283754['query']);_0x5278a7['filters']=_[_0xb285('0x4e')](_0x5278a7[_0xb285('0x49')],_0x5278a7['query']);_0x4b4017['attributes']=_[_0xb285('0x4e')](_0x5278a7[_0xb285('0x49')],qs[_0xb285('0x50')](_0x283754[_0xb285('0x4b')]['fields']));_0x4b4017[_0xb285('0x4f')]=_0x4b4017[_0xb285('0x4f')][_0xb285('0x51')]?_0x4b4017[_0xb285('0x4f')]:_0x5278a7[_0xb285('0x49')];if(!_0x283754[_0xb285('0x4b')][_0xb285('0x52')]('nolimit')){_0x4b4017[_0xb285('0x35')]=qs[_0xb285('0x35')](_0x283754[_0xb285('0x4b')][_0xb285('0x35')]);_0x4b4017[_0xb285('0x32')]=qs[_0xb285('0x32')](_0x283754[_0xb285('0x4b')][_0xb285('0x32')]);}_0x4b4017[_0xb285('0x54')]=qs[_0xb285('0x55')](_0x283754[_0xb285('0x4b')][_0xb285('0x55')]);_0x4b4017['where']=qs[_0xb285('0x4d')](_['pick'](_0x283754[_0xb285('0x4b')],_0x5278a7[_0xb285('0x4d')]));_0x4b4017[_0xb285('0x56')][_0xb285('0x70')]=_0x55c489['id'];if(_0x283754['query'][_0xb285('0x58')]){_0x4b4017[_0xb285('0x56')]=_[_0xb285('0x61')](_0x4b4017['where'],{'$or':_[_0xb285('0x4a')](_0x4b4017[_0xb285('0x4f')],function(_0x1615e3){var _0x1e5678={};_0x1e5678[_0x1615e3]={'$like':'%'+_0x283754[_0xb285('0x4b')][_0xb285('0x58')]+'%'};return _0x1e5678;})});}if(_0x283754['query']['$gte']){var _0x5277b2=_0x283754[_0xb285('0x4b')][_0xb285('0xa7')][_0xb285('0xa8')](',');var _0x515986={};_0x515986[_0x5277b2[0x0]]={'$gte':moment(_0x5277b2[0x1])[_0xb285('0xa9')](_0xb285('0xaa'))};_0x4b4017[_0xb285('0x56')]=_['merge'](_0x4b4017[_0xb285('0x56')],_0x515986);}_0x4b4017=_['merge']({},_0x4b4017,_0x283754[_0xb285('0x62')]);return db[_0xb285('0xa6')][_0xb285('0x34')]({'where':_0x4b4017[_0xb285('0x56')]})[_0xb285('0x24')](function(_0x599da4){_0x4278a1[_0xb285('0x34')]=_0x599da4;if(_0x283754[_0xb285('0x4b')][_0xb285('0x5a')]){_0x4b4017[_0xb285('0x5b')]=[{'all':!![]}];}return db[_0xb285('0xa6')][_0xb285('0x5c')](_0x4b4017);})[_0xb285('0x24')](function(_0x27ee5d){_0x4278a1[_0xb285('0x5d')]=_0x27ee5d;return _0x4278a1;});}})[_0xb285('0x24')](respondWithFilteredResult(_0x3a9fa7,_0x4b4017))[_0xb285('0x2e')](handleError(_0x3a9fa7,null));};exports[_0xb285('0x41')]=function(_0xe1cccd,_0x3d3835,_0x15363e){var _0x5dc04d,_0x166899={},_0x379bca;if(_0xe1cccd[_0xb285('0x65')]['to']){_0x379bca=_0xe1cccd[_0xb285('0x65')]['to'][0x0];}return db[_0xb285('0x44')][_0xb285('0x63')]({'where':{'id':_0xe1cccd[_0xb285('0x5f')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xb285('0xab')],'as':'Contacts','where':{'fax':_0x379bca},'limit':0x1,'order':[[_0xb285('0xa1'),_0xb285('0xac')]]}]}]})[_0xb285('0x24')](handleEntityNotFound(_0x3d3835,null))['then'](function(_0xd8780c){_0x5dc04d=_0xd8780c;if(_0xe1cccd['body']['attachments']&&_0xe1cccd[_0xb285('0x65')][_0xb285('0xad')][_0xb285('0x51')]){for(var _0x3adaff=0x0;_0x3adaff<_0xe1cccd['body']['attachments'][_0xb285('0x51')];_0x3adaff+=0x1){_0xe1cccd[_0xb285('0x65')]['attachments'][_0x3adaff]={'filename':_0xe1cccd[_0xb285('0x65')][_0xb285('0xad')][_0x3adaff][_0xb285('0x40')],'id':_0xe1cccd[_0xb285('0x65')][_0xb285('0xad')][_0x3adaff]['id'],'path':path[_0xb285('0xae')](config['root'],_0xb285('0xaf'),_0xe1cccd[_0xb285('0x65')]['attachments'][_0x3adaff][_0xb285('0xb0')])};}}return respondWithRpcPromise('CheckAfterSend',_0xb285('0xb1'),{'FaxAccountId':_['isNil'](_0xe1cccd[_0xb285('0x5f')]['id'])?undefined:_0xe1cccd[_0xb285('0x5f')]['id'],'path':_[_0xb285('0xb2')](_0xe1cccd[_0xb285('0x65')][_0xb285('0xad')][0x0]['path'])?undefined:_0xe1cccd['body'][_0xb285('0xad')][0x0]['path'],'fax':_['isNil'](_0xe1cccd[_0xb285('0x65')]['to'][0x0])?undefined:_0xe1cccd[_0xb285('0x65')]['to'][0x0]},client9002);})[_0xb285('0x24')](function(){if(_0x5dc04d){if(_[_0xb285('0xb2')](_0xe1cccd['body'][_0xb285('0xb3')])){_0xe1cccd['body'][_0xb285('0xb3')]=util[_0xb285('0xa9')](_0xb285('0xb4'),_0x5dc04d[_0xb285('0x40')],_0x5dc04d[_0xb285('0xb5')]);}if(_0x5dc04d[_0xb285('0xb6')]){if(_0x5dc04d[_0xb285('0xb6')][_0xb285('0xb7')]['length']){return _0x5dc04d[_0xb285('0xb6')][_0xb285('0xb7')][0x0];}else{return db[_0xb285('0xab')][_0xb285('0x64')](_['defaults'](_0xe1cccd[_0xb285('0x65')],{'firstName':_0xe1cccd[_0xb285('0x65')]['to'][0x0],'phone':_0xe1cccd['body']['to'][0x0],'fax':_0xe1cccd['body']['to'][0x0],'ListId':_0x5dc04d[_0xb285('0xa3')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xb285('0xb8'));}})[_0xb285('0x24')](function(_0x2b005f){if(_0x2b005f){return db[_0xb285('0x78')][_0xb285('0x63')]({'where':{'ContactId':_0x2b005f['id'],'closed':![],'FaxAccountId':_0x5dc04d['id']}})[_0xb285('0x24')](function(_0x3306fa){if(_0x3306fa){return[_0x3306fa,![]];}return db[_0xb285('0x78')][_0xb285('0x64')]({'UserId':_0xe1cccd['user']['id'],'ContactId':_0x2b005f['id'],'FaxAccountId':_0x5dc04d['id'],'fax':_0xe1cccd[_0xb285('0x65')]['to'][0x0],'firstMsgDirection':_0xb285('0xb9'),'Messages':[_['merge'](_0xe1cccd[_0xb285('0x65')],{'read':![],'body':_0xe1cccd[_0xb285('0x65')][_0xb285('0xad')][0x0][_0xb285('0xba')],'FaxAccountId':_0x5dc04d['id'],'UserId':_0xe1cccd['user']['id'],'ContactId':_0x2b005f['id'],'AttachmentId':_0xe1cccd['body'][_0xb285('0xad')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})['then'](function(_0x5993b5){return[_0x5993b5,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb285('0xbb')](function(_0x2de890,_0x217882){if(_0x217882){return _0x2de890;}return db['FaxMessage'][_0xb285('0x64')]({'direction':_0xb285('0xb9'),'read':![],'body':_0xe1cccd[_0xb285('0x65')]['attachments'][0x0][_0xb285('0xba')],'FaxAccountId':_0x5dc04d['id'],'FaxInteractionId':_0x2de890['id'],'UserId':_0xe1cccd[_0xb285('0x66')]['id'],'ContactId':_0x2de890[_0xb285('0xbc')],'AttachmentId':_0xe1cccd[_0xb285('0x65')][_0xb285('0xad')][0x0]['id']})[_0xb285('0x24')](function(_0xf357c){_0x2de890[_0xb285('0xbd')][_0xb285('0xbe')]=[];_0x2de890[_0xb285('0xbd')]['Messages'][_0xb285('0x98')](_0xf357c[_0xb285('0xbd')]);return _0x2de890;});})['then'](function(_0x51a125){respondWithRpcPromise(_0xb285('0xbf'),_0xb285('0xbf'),{'FaxAccountId':_[_0xb285('0xb2')](_0xe1cccd[_0xb285('0x5f')]['id'])?undefined:_0xe1cccd[_0xb285('0x5f')]['id'],'path':_['isNil'](_0xe1cccd['body']['attachments'][0x0][_0xb285('0xc0')])?undefined:_0xe1cccd[_0xb285('0x65')][_0xb285('0xad')][0x0]['path'],'fax':_[_0xb285('0xb2')](_0xe1cccd[_0xb285('0x65')]['to'][0x0])?undefined:_0xe1cccd[_0xb285('0x65')]['to'][0x0],'AttachmentId':_0xe1cccd[_0xb285('0x65')]['attachments'][0x0]['id']},client9002)[_0xb285('0x24')](function(_0x12386d){logger['info']('SendFaxRpc,\x20%s',_0x12386d);})[_0xb285('0x2e')](function(_0x59c596){logger[_0xb285('0x25')](_0xb285('0xc1'),_0x59c596);});return _0x51a125;})[_0xb285('0x24')](respondWithResult(_0x3d3835,null))[_0xb285('0x2e')](handleError(_0x3d3835,null));};exports[_0xb285('0xc2')]=function(_0x42e9f3,_0x4e2c64,_0x521ecf){return db[_0xb285('0x44')]['find']({'where':{'id':_0x42e9f3[_0xb285('0x5f')]['id']}})[_0xb285('0x24')](handleEntityNotFound(_0x4e2c64,null))[_0xb285('0x24')](function(_0x3d6f09){if(_0x3d6f09){return _0x3d6f09[_0xb285('0xc2')](_0x42e9f3[_0xb285('0x65')][_0xb285('0x79')],_[_0xb285('0x7a')](_0x42e9f3['body'],[_0xb285('0x79'),'id'])||{})[_0xb285('0xbb')](function(_0x39a2be){for(var _0x27f717=0x0;_0x27f717<_0x42e9f3[_0xb285('0x65')]['ids'][_0xb285('0x51')];_0x27f717+=0x1){socket[_0xb285('0xc3')](_0xb285('0xc4'),{'UserId':Number(_0x42e9f3[_0xb285('0x65')][_0xb285('0x79')][_0x27f717]),'FaxAccountId':Number(_0x42e9f3[_0xb285('0x5f')]['id'])});}return _0x39a2be;});}})['then'](respondWithResult(_0x4e2c64,null))[_0xb285('0x2e')](handleError(_0x4e2c64,null));};exports[_0xb285('0xc5')]=function(_0xdd10c8,_0x59734f,_0x1d7383){return db[_0xb285('0x44')]['find']({'where':{'id':_0xdd10c8[_0xb285('0x5f')]['id']}})['then'](handleEntityNotFound(_0x59734f,null))[_0xb285('0x24')](function(_0x2e11d3){if(_0x2e11d3){return _0x2e11d3[_0xb285('0xc5')](_0xdd10c8['query'][_0xb285('0x79')])[_0xb285('0x24')](function(){if(_['isArray'](_0xdd10c8[_0xb285('0x4b')][_0xb285('0x79')])){for(var _0x4d2c95=0x0;_0x4d2c95<_0xdd10c8[_0xb285('0x4b')][_0xb285('0x79')]['length'];_0x4d2c95+=0x1){socket[_0xb285('0xc3')](_0xb285('0xc6'),{'UserId':Number(_0xdd10c8[_0xb285('0x4b')][_0xb285('0x79')][_0x4d2c95]),'FaxAccountId':Number(_0xdd10c8[_0xb285('0x5f')]['id'])});}}else{socket[_0xb285('0xc3')](_0xb285('0xc6'),{'UserId':Number(_0xdd10c8['query'][_0xb285('0x79')]),'FaxAccountId':Number(_0xdd10c8[_0xb285('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x59734f,null))[_0xb285('0x2e')](handleError(_0x59734f,null));};exports['getAgents']=function(_0x4309ec,_0x571023,_0x26b71c){var _0x508d99={};var _0x35571f={};var _0x254c9f;var _0x78b71b;return db[_0xb285('0x44')][_0xb285('0x72')]({'where':{'id':_0x4309ec[_0xb285('0x5f')]['id']}})[_0xb285('0x24')](handleEntityNotFound(_0x571023,null))[_0xb285('0x24')](function(_0xa3520d){if(_0xa3520d){_0x254c9f=_0xa3520d;_0x35571f[_0xb285('0x49')]=_[_0xb285('0x4c')](db[_0xb285('0xc7')]['rawAttributes']);_0x35571f[_0xb285('0x4b')]=_[_0xb285('0x4c')](_0x4309ec[_0xb285('0x4b')]);_0x35571f[_0xb285('0x4d')]=_[_0xb285('0x4e')](_0x35571f[_0xb285('0x49')],_0x35571f[_0xb285('0x4b')]);_0x508d99['attributes']=_[_0xb285('0x4e')](_0x35571f[_0xb285('0x49')],qs[_0xb285('0x50')](_0x4309ec[_0xb285('0x4b')][_0xb285('0x50')]));_0x508d99[_0xb285('0x4f')]=_0x508d99[_0xb285('0x4f')][_0xb285('0x51')]?_0x508d99['attributes']:_0x35571f['model'];_0x508d99[_0xb285('0x54')]=qs[_0xb285('0x55')](_0x4309ec[_0xb285('0x4b')]['sort']);_0x508d99['where']=qs[_0xb285('0x4d')](_[_0xb285('0x57')](_0x4309ec['query'],_0x35571f[_0xb285('0x4d')]));if(_0x4309ec['query'][_0xb285('0x58')]){_0x508d99[_0xb285('0x56')]=_[_0xb285('0x61')](_0x508d99[_0xb285('0x56')],{'$or':_['map'](_0x508d99['attributes'],function(_0x29340b){var _0x53c6d2={};_0x53c6d2[_0x29340b]={'$like':'%'+_0x4309ec[_0xb285('0x4b')][_0xb285('0x58')]+'%'};return _0x53c6d2;})});}_0x508d99=_['merge']({},_0x508d99,_0x4309ec[_0xb285('0x62')]);return _0x254c9f[_0xb285('0xc8')](_0x508d99);}})['then'](function(_0x476ee9){if(_0x476ee9){_0x78b71b=_0x476ee9[_0xb285('0x51')];if(!_0x4309ec[_0xb285('0x4b')][_0xb285('0x52')]('nolimit')){_0x508d99[_0xb285('0x35')]=qs['limit'](_0x4309ec[_0xb285('0x4b')][_0xb285('0x35')]);_0x508d99[_0xb285('0x32')]=qs[_0xb285('0x32')](_0x4309ec['query']['offset']);}return _0x254c9f[_0xb285('0xc8')](_0x508d99);}})[_0xb285('0x24')](function(_0x56f688){if(_0x56f688){return _0x56f688?{'count':_0x78b71b,'rows':_0x56f688}:null;}})[_0xb285('0x24')](respondWithResult(_0x571023,null))['catch'](handleError(_0x571023,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 7ed8867..11d0f27 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 _0x9dc7=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x8e8578,_0xd2a6b5){var _0x279605=function(_0x4b0347){while(--_0x4b0347){_0x8e8578['push'](_0x8e8578['shift']());}};_0x279605(++_0xd2a6b5);}(_0x9dc7,0x1b1));var _0x79dc=function(_0x490069,_0x362791){_0x490069=_0x490069-0x0;var _0x361d12=_0x9dc7[_0x490069];return _0x361d12;};'use strict';var EventEmitter=require(_0x79dc('0x0'));var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x79dc('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x79dc('0x2')};function emitEvent(_0x785001){return function(_0x473c7b,_0x23532e,_0x2dbb56){FaxAccountEvents[_0x79dc('0x3')](_0x785001+':'+_0x473c7b['id'],_0x473c7b);FaxAccountEvents[_0x79dc('0x3')](_0x785001,_0x473c7b);_0x2dbb56(null);};}for(var e in events){if(events[_0x79dc('0x4')](e)){var event=events[e];FaxAccount[_0x79dc('0x5')](e,emitEvent(event));}}module[_0x79dc('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0x076b=['exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','hook'];(function(_0x4b192c,_0x4d13a9){var _0x498dc2=function(_0x18d57d){while(--_0x18d57d){_0x4b192c['push'](_0x4b192c['shift']());}};_0x498dc2(++_0x4d13a9);}(_0x076b,0x1c1));var _0xb076=function(_0x184004,_0x561145){_0x184004=_0x184004-0x0;var _0x508fc0=_0x076b[_0x184004];return _0x508fc0;};'use strict';var EventEmitter=require(_0xb076('0x0'));var FaxAccount=require(_0xb076('0x1'))['db'][_0xb076('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb076('0x3')](0x0);var events={'afterCreate':_0xb076('0x4'),'afterUpdate':_0xb076('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5da5dd){return function(_0x1817f6,_0x3168a5,_0x3d872a){FaxAccountEvents['emit'](_0x5da5dd+':'+_0x1817f6['id'],_0x1817f6);FaxAccountEvents['emit'](_0x5da5dd,_0x1817f6);_0x3d872a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xb076('0x6')](e,emitEvent(event));}}module[_0xb076('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 9727ced..ab94af6 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 _0x20b8=['fax_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','define','FaxAccount'];(function(_0x1efae1,_0xa90eb2){var _0x394c47=function(_0x3fad25){while(--_0x3fad25){_0x1efae1['push'](_0x1efae1['shift']());}};_0x394c47(++_0xa90eb2);}(_0x20b8,0x1ae));var _0x820b=function(_0x3d274e,_0x329874){_0x3d274e=_0x3d274e-0x0;var _0x4e73d8=_0x20b8[_0x3d274e];return _0x4e73d8;};'use strict';var _=require(_0x820b('0x0'));var util=require(_0x820b('0x1'));var logger=require(_0x820b('0x2'))('api');var moment=require(_0x820b('0x3'));var BPromise=require(_0x820b('0x4'));var rp=require(_0x820b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x820b('0x6'));var config=require(_0x820b('0x7'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0xa37aa1,_0x496c6e){return _0xa37aa1[_0x820b('0x8')](_0x820b('0x9'),attributes,{'tableName':_0x820b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90af=['define','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x18d187,_0x1348d7){var _0xbecc2c=function(_0x2e8a87){while(--_0x2e8a87){_0x18d187['push'](_0x18d187['shift']());}};_0xbecc2c(++_0x1348d7);}(_0x90af,0x157));var _0xf90a=function(_0x5df4c6,_0x113609){_0x5df4c6=_0x5df4c6-0x0;var _0x3ea081=_0x90af[_0x5df4c6];return _0x3ea081;};'use strict';var _=require(_0xf90a('0x0'));var util=require(_0xf90a('0x1'));var logger=require(_0xf90a('0x2'))(_0xf90a('0x3'));var moment=require(_0xf90a('0x4'));var BPromise=require('bluebird');var rp=require(_0xf90a('0x5'));var fs=require('fs');var path=require(_0xf90a('0x6'));var rimraf=require('rimraf');var config=require(_0xf90a('0x7'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x136f99,_0x1b9ccc){return _0x136f99[_0xf90a('0x8')]('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 997f033..8c69365 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 _0xa2af=['length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFaxAccount','findAll','options','raw','attributes','include','model','map','then','debug','stringify','NotifyFaxAccount','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','ValidationError','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','CmContact','Contacts','DESC','FaxApplication','Applications','get','account','applications','list','orderBy','priority','asc'];(function(_0x523c93,_0x3258be){var _0x1d2d7f=function(_0x572da1){while(--_0x572da1){_0x523c93['push'](_0x523c93['shift']());}};_0x1d2d7f(++_0x3258be);}(_0xa2af,0x1c8));var _0xfa2a=function(_0x3dc46d,_0x1790d0){_0x3dc46d=_0x3dc46d-0x0;var _0x47bca8=_0xa2af[_0x3dc46d];return _0x47bca8;};'use strict';var _=require('lodash');var util=require(_0xfa2a('0x0'));var moment=require(_0xfa2a('0x1'));var BPromise=require(_0xfa2a('0x2'));var rs=require(_0xfa2a('0x3'));var fs=require('fs');var Redis=require(_0xfa2a('0x4'));var db=require(_0xfa2a('0x5'))['db'];var utils=require(_0xfa2a('0x6'));var logger=require(_0xfa2a('0x7'))(_0xfa2a('0x8'));var config=require(_0xfa2a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfa2a('0xa')][_0xfa2a('0xb')]({'port':0x232c});config[_0xfa2a('0xc')]=_[_0xfa2a('0xd')](config[_0xfa2a('0xc')],{'host':_0xfa2a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0xedbfe0,_0x325889,_0x3394a8){return new BPromise(function(_0x94a1c6,_0x24ba7e){return client['request'](_0xedbfe0,_0x3394a8)['then'](function(_0x4b4d7c){logger[_0xfa2a('0xf')](_0xfa2a('0x10'),_0x325889,_0xfa2a('0x11'));logger['debug'](_0xfa2a('0x12'),_0x325889,'request\x20sent',JSON['stringify'](_0x4b4d7c));if(_0x4b4d7c['error']){if(_0x4b4d7c[_0xfa2a('0x13')]['code']===0x1f4){logger[_0xfa2a('0x13')]('FaxAccount,\x20%s,\x20%s',_0x325889,_0x4b4d7c['error'][_0xfa2a('0x14')]);return _0x24ba7e(_0x4b4d7c[_0xfa2a('0x13')][_0xfa2a('0x14')]);}logger[_0xfa2a('0x13')](_0xfa2a('0x10'),_0x325889,_0x4b4d7c[_0xfa2a('0x13')][_0xfa2a('0x14')]);return _0x94a1c6(_0x4b4d7c['error'][_0xfa2a('0x14')]);}else{logger[_0xfa2a('0xf')]('FaxAccount,\x20%s,\x20%s',_0x325889,_0xfa2a('0x11'));_0x94a1c6(_0x4b4d7c[_0xfa2a('0x15')]['message']);}})[_0xfa2a('0x16')](function(_0x5a6c75){logger[_0xfa2a('0x13')](_0xfa2a('0x10'),_0x325889,_0x5a6c75);_0x24ba7e(_0x5a6c75);});});}exports[_0xfa2a('0x17')]=function(_0x36d750){var _0x30fddf=this;return new Promise(function(_0x29bc21,_0x32eb3b){return db['FaxAccount'][_0xfa2a('0x18')]({'raw':_0x36d750[_0xfa2a('0x19')]?_0x36d750[_0xfa2a('0x19')][_0xfa2a('0x1a')]===undefined?!![]:![]:!![],'where':_0x36d750[_0xfa2a('0x19')]?_0x36d750['options']['where']||null:null,'attributes':_0x36d750[_0xfa2a('0x19')]?_0x36d750[_0xfa2a('0x19')][_0xfa2a('0x1b')]||null:null,'limit':_0x36d750[_0xfa2a('0x19')]?_0x36d750[_0xfa2a('0x19')]['limit']||null:null,'include':_0x36d750[_0xfa2a('0x19')]?_0x36d750[_0xfa2a('0x19')][_0xfa2a('0x1c')]?_['map'](_0x36d750[_0xfa2a('0x19')][_0xfa2a('0x1c')],function(_0x214eb6){return{'model':db[_0x214eb6[_0xfa2a('0x1d')]],'as':_0x214eb6['as'],'attributes':_0x214eb6[_0xfa2a('0x1b')],'include':_0x214eb6[_0xfa2a('0x1c')]?_['map'](_0x214eb6[_0xfa2a('0x1c')],function(_0x5112ee){return{'model':db[_0x5112ee[_0xfa2a('0x1d')]],'as':_0x5112ee['as'],'attributes':_0x5112ee[_0xfa2a('0x1b')],'include':_0x5112ee['include']?_[_0xfa2a('0x1e')](_0x5112ee[_0xfa2a('0x1c')],function(_0x70a472){return{'model':db[_0x70a472[_0xfa2a('0x1d')]],'as':_0x70a472['as'],'attributes':_0x70a472[_0xfa2a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfa2a('0x1f')](function(_0x302d8b){logger[_0xfa2a('0xf')](_0xfa2a('0x17'),_0x36d750);logger[_0xfa2a('0x20')](_0xfa2a('0x17'),_0x36d750,JSON[_0xfa2a('0x21')](_0x302d8b));_0x29bc21(_0x302d8b);})['catch'](function(_0x336c8f){logger[_0xfa2a('0x13')]('GetFaxAccount',_0x336c8f[_0xfa2a('0x14')],_0x36d750);_0x32eb3b(_0x30fddf[_0xfa2a('0x13')](0x1f4,_0x336c8f['message']));});});};exports[_0xfa2a('0x22')]=function(_0x2118e6,_0x2843ad,_0x5183cb){var _0x3310d3=this;return new Promise(function(_0x47923a,_0x4a388c){var _0x257358={'body':_0x2118e6['body'],'channel':'fax'};var _0x2e025f=[];var _0x554981=[];var _0x4314d0={};return db['CmContact'][_0xfa2a('0x23')]()['then'](function(_0x3102fc){if(!_0x3102fc){throw new db[(_0xfa2a('0x24'))]['ValidationError'](_0xfa2a('0x25'));}_0x2e025f=_[_0xfa2a('0x26')](_[_0xfa2a('0x27')](_0x3102fc),[_0xfa2a('0x28'),_0xfa2a('0x29')]);_0x554981=_['difference'](_['keys'](_0x3102fc),['createdAt',_0xfa2a('0x29'),_0xfa2a('0x2a'),_0xfa2a('0x2b')]);if(_0x2118e6[_0xfa2a('0x2c')]['id']){delete _0x2118e6[_0xfa2a('0x2c')]['id'];}if(_[_0xfa2a('0x2d')](_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x2e')])){throw new db[(_0xfa2a('0x24'))][(_0xfa2a('0x2f'))]('from\x20is\x20mandatory');}if(_[_0xfa2a('0x2d')](_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x2c')])||_0x2118e6[_0xfa2a('0x2c')]['body']===''){throw new db['Sequelize'][(_0xfa2a('0x2f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xfa2a('0x2d')](_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x30')])){throw new db[(_0xfa2a('0x24'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x554981);}if(!_[_0xfa2a('0x31')](_0x554981,_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x30')])){throw new db[(_0xfa2a('0x24'))][(_0xfa2a('0x2f'))](_0xfa2a('0x32')+_0x554981);}_0x4314d0[_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x30')]]=_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x2e')];})[_0xfa2a('0x1f')](function(){return db['FaxAccount'][_0xfa2a('0x33')]({'where':{'id':_0x2118e6['account']['id']},'include':[{'model':db[_0xfa2a('0x34')],'as':_0xfa2a('0x35'),'include':[{'model':db[_0xfa2a('0x36')],'as':_0xfa2a('0x37'),'where':_0x4314d0,'limit':0x1,'order':[[_0xfa2a('0x29'),_0xfa2a('0x38')]]}]},{'model':db[_0xfa2a('0x39')],'as':_0xfa2a('0x3a')}]});})['then'](function(_0x360e81){if(_0x360e81&&_0x360e81['List']){var _0x5807b4=_0x360e81[_0xfa2a('0x3b')]({'plain':!![]});_0x257358[_0xfa2a('0x3c')]=_0x5807b4;_0x257358[_0xfa2a('0x3d')]=_0x5807b4[_0xfa2a('0x3a')];_0x257358[_0xfa2a('0x3e')]=_0x5807b4[_0xfa2a('0x35')];_0x257358[_0xfa2a('0x3d')]=_[_0xfa2a('0x3f')](_0x257358['applications'],[_0xfa2a('0x40')],[_0xfa2a('0x41')]);if(_0x257358[_0xfa2a('0x3c')]['Applications']){delete _0x257358['account'][_0xfa2a('0x3a')];}if(_0x257358[_0xfa2a('0x3c')][_0xfa2a('0x35')]&&_0x257358[_0xfa2a('0x3c')]['List']['Contacts'][_0xfa2a('0x42')]){return _0x257358['account'][_0xfa2a('0x35')][_0xfa2a('0x37')][0x0];}var _0x5b2188=_[_0xfa2a('0xd')](_0x2118e6[_0xfa2a('0x2c')],{'firstName':_0x2118e6[_0xfa2a('0x2c')]['from'],'ListId':_0x5807b4[_0xfa2a('0x2b')]});_0x5b2188[_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x30')]]=_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x2e')];return db[_0xfa2a('0x36')][_0xfa2a('0x43')](_0x5b2188,{'fields':_0x2e025f,'raw':!![]});}})[_0xfa2a('0x1f')](function(_0x34e15d){_0x257358[_0xfa2a('0x44')]=_0x34e15d;if(_0x34e15d){var _0x7a821d={'ContactId':_0x34e15d['id'],'FaxAccountId':_0x2118e6[_0xfa2a('0x3c')]['id'],'fax':_0x34e15d['fax']};return db['FaxInteraction'][_0xfa2a('0x33')]({'where':{'ContactId':_0x34e15d['id'],'closed':![],'FaxAccountId':_0x2118e6[_0xfa2a('0x3c')]['id']}})[_0xfa2a('0x1f')](function(_0x2906bd){if(_0x2906bd){return[_0x2906bd,![]];}return db[_0xfa2a('0x45')][_0xfa2a('0x43')](_0x7a821d)[_0xfa2a('0x1f')](function(_0x54759c){return[_0x54759c,!![]];});});}else{throw new Error(_0xfa2a('0x46'));}})[_0xfa2a('0x47')](function(_0x4723bd,_0x3314e5){var _0x567459=_0x4723bd[_0xfa2a('0x3b')]({'plain':!![]});if(_0x3314e5){if(_0x257358[_0xfa2a('0x3c')]['autoclose']){_0x257358[_0xfa2a('0x3d')]['push']({'id':0x0,'priority':_0x257358[_0xfa2a('0x3d')]['length']+0x1,'app':_0xfa2a('0x48'),'appdata':_0xfa2a('0x49'),'interval':_0xfa2a('0x4a')});}_0x567459[_0xfa2a('0x4b')]=!![];}else{_0x567459[_0xfa2a('0x4b')]=![];}_0x257358[_0xfa2a('0x4c')]=_0x567459;return db[_0xfa2a('0x4d')][_0xfa2a('0x43')]({'body':_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x2c')],'FaxAccountId':_0x2118e6[_0xfa2a('0x3c')]['id'],'FaxInteractionId':_0x4723bd['id'],'direction':'in','ContactId':_0x4723bd[_0xfa2a('0x4e')],'AttachmentId':_0x2118e6[_0xfa2a('0x2c')][_0xfa2a('0x4f')]});})[_0xfa2a('0x1f')](function(_0x542322){_0x257358[_0xfa2a('0x14')]=_0x542322;if(_0x257358[_0xfa2a('0x4c')][_0xfa2a('0x50')]){return db[_0xfa2a('0x51')][_0xfa2a('0x33')]({'attributes':['id',_0xfa2a('0x52')],'where':{'id':_0x257358[_0xfa2a('0x4c')][_0xfa2a('0x50')]}})[_0xfa2a('0x1f')](function(_0x5972ad){if(_0x5972ad){_0x257358[_0xfa2a('0x3d')][_0xfa2a('0x53')]({'id':0x0,'priority':0x0,'app':_0xfa2a('0x54'),'appdata':_0x5972ad[_0xfa2a('0x52')]+','+(_0x257358['account']['waitForTheAssignedAgent']||0xa),'interval':_0xfa2a('0x4a')});}return respondWithRpcPromise(_0xfa2a('0x55'),_0xfa2a('0x56'),_0x257358);});}return respondWithRpcPromise(_0xfa2a('0x55'),_0xfa2a('0x56'),_0x257358);})[_0xfa2a('0x1f')](function(_0x3ac8cc){_0x47923a(_0x3ac8cc);})[_0xfa2a('0x16')](function(_0x101eb1){_0x4a388c(_0x3310d3['error'](0x1f4,_0x101eb1[_0xfa2a('0x14')]));});});}; \ No newline at end of file +var _0x3125=['isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','CmContact','Contacts','DESC','Applications','get','applications','list','asc','account','create','FaxInteraction','Contact\x20not\x20found','autoclose','push','length','close','*,*,*,*','interaction','FaxMessage','AttachmentId','name','UserId','agent','waitForTheAssignedAgent','Start','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','socket.io-emitter','redis','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','options','where','attributes','include','map','model','debug','NotifyFaxAccount','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','body'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0x3125,0x74));var _0x5312=function(_0x116779,_0x3b9777){_0x116779=_0x116779-0x0;var _0x5921e9=_0x3125[_0x116779];return _0x5921e9;};'use strict';var _=require('lodash');var util=require(_0x5312('0x0'));var moment=require(_0x5312('0x1'));var BPromise=require(_0x5312('0x2'));var rs=require(_0x5312('0x3'));var fs=require('fs');var Redis=require(_0x5312('0x4'));var db=require(_0x5312('0x5'))['db'];var utils=require(_0x5312('0x6'));var logger=require(_0x5312('0x7'))(_0x5312('0x8'));var config=require(_0x5312('0x9'));var jayson=require(_0x5312('0xa'));var client=jayson['client'][_0x5312('0xb')]({'port':0x232c});config['redis']=_[_0x5312('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5312('0xd'))(new Redis(config[_0x5312('0xe')]));require(_0x5312('0xf'))[_0x5312('0x10')](socket);function respondWithRpcPromise(_0x176dd1,_0x37636a,_0x406fc7){return new BPromise(function(_0x477896,_0xc86b26){return client[_0x5312('0x11')](_0x176dd1,_0x406fc7)[_0x5312('0x12')](function(_0x133f66){logger[_0x5312('0x13')](_0x5312('0x14'),_0x37636a,_0x5312('0x15'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x37636a,_0x5312('0x15'),JSON[_0x5312('0x16')](_0x133f66));if(_0x133f66[_0x5312('0x17')]){if(_0x133f66[_0x5312('0x17')][_0x5312('0x18')]===0x1f4){logger[_0x5312('0x17')]('FaxAccount,\x20%s,\x20%s',_0x37636a,_0x133f66[_0x5312('0x17')][_0x5312('0x19')]);return _0xc86b26(_0x133f66[_0x5312('0x17')]['message']);}logger[_0x5312('0x17')](_0x5312('0x14'),_0x37636a,_0x133f66[_0x5312('0x17')]['message']);return _0x477896(_0x133f66[_0x5312('0x17')][_0x5312('0x19')]);}else{logger[_0x5312('0x13')]('FaxAccount,\x20%s,\x20%s',_0x37636a,'request\x20sent');_0x477896(_0x133f66[_0x5312('0x1a')][_0x5312('0x19')]);}})[_0x5312('0x1b')](function(_0x580e6e){logger['error'](_0x5312('0x14'),_0x37636a,_0x580e6e);_0xc86b26(_0x580e6e);});});}exports[_0x5312('0x1c')]=function(_0x190e15){var _0x46ff6b=this;return new Promise(function(_0x473130,_0x348ea3){return db[_0x5312('0x1d')]['findAll']({'raw':_0x190e15[_0x5312('0x1e')]?_0x190e15[_0x5312('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x190e15[_0x5312('0x1e')]?_0x190e15[_0x5312('0x1e')][_0x5312('0x1f')]||null:null,'attributes':_0x190e15['options']?_0x190e15[_0x5312('0x1e')][_0x5312('0x20')]||null:null,'limit':_0x190e15[_0x5312('0x1e')]?_0x190e15[_0x5312('0x1e')]['limit']||null:null,'include':_0x190e15[_0x5312('0x1e')]?_0x190e15['options'][_0x5312('0x21')]?_[_0x5312('0x22')](_0x190e15[_0x5312('0x1e')][_0x5312('0x21')],function(_0x5ae3b8){return{'model':db[_0x5ae3b8['model']],'as':_0x5ae3b8['as'],'attributes':_0x5ae3b8[_0x5312('0x20')],'include':_0x5ae3b8[_0x5312('0x21')]?_[_0x5312('0x22')](_0x5ae3b8[_0x5312('0x21')],function(_0x94a837){return{'model':db[_0x94a837[_0x5312('0x23')]],'as':_0x94a837['as'],'attributes':_0x94a837[_0x5312('0x20')],'include':_0x94a837[_0x5312('0x21')]?_['map'](_0x94a837[_0x5312('0x21')],function(_0x5777bc){return{'model':db[_0x5777bc[_0x5312('0x23')]],'as':_0x5777bc['as'],'attributes':_0x5777bc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xc9db6b){logger[_0x5312('0x13')](_0x5312('0x1c'),_0x190e15);logger[_0x5312('0x24')](_0x5312('0x1c'),_0x190e15,JSON[_0x5312('0x16')](_0xc9db6b));_0x473130(_0xc9db6b);})[_0x5312('0x1b')](function(_0x48be58){logger[_0x5312('0x17')](_0x5312('0x1c'),_0x48be58['message'],_0x190e15);_0x348ea3(_0x46ff6b['error'](0x1f4,_0x48be58[_0x5312('0x19')]));});});};exports[_0x5312('0x25')]=function(_0x46ba2e,_0x502c03,_0x142e9e){var _0x117949=this;return new Promise(function(_0x38db4c,_0x926211){var _0x517779={'body':_0x46ba2e['body'],'channel':'fax'};var _0xea1aa5=[];var _0x167022=[];var _0x12e26b={};return db['CmContact']['describe']()[_0x5312('0x12')](function(_0x22562c){if(!_0x22562c){throw new db[(_0x5312('0x26'))][(_0x5312('0x27'))](_0x5312('0x28'));}_0xea1aa5=_['difference'](_['keys'](_0x22562c),[_0x5312('0x29'),_0x5312('0x2a')]);_0x167022=_[_0x5312('0x2b')](_['keys'](_0x22562c),[_0x5312('0x29'),_0x5312('0x2a'),'CompanyId',_0x5312('0x2c')]);if(_0x46ba2e[_0x5312('0x2d')]['id']){delete _0x46ba2e['body']['id'];}if(_[_0x5312('0x2e')](_0x46ba2e['body'][_0x5312('0x2f')])){throw new db['Sequelize'][(_0x5312('0x27'))](_0x5312('0x30'));}if(_[_0x5312('0x2e')](_0x46ba2e[_0x5312('0x2d')][_0x5312('0x2d')])||_0x46ba2e[_0x5312('0x2d')]['body']===''){throw new db[(_0x5312('0x26'))][(_0x5312('0x27'))](_0x5312('0x31'));}if(_['isNil'](_0x46ba2e[_0x5312('0x2d')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x5312('0x32')+_0x167022);}if(!_['includes'](_0x167022,_0x46ba2e['body'][_0x5312('0x33')])){throw new db['Sequelize'][(_0x5312('0x27'))](_0x5312('0x34')+_0x167022);}_0x12e26b[_0x46ba2e[_0x5312('0x2d')][_0x5312('0x33')]]=_0x46ba2e[_0x5312('0x2d')][_0x5312('0x2f')];})[_0x5312('0x12')](function(){return db[_0x5312('0x1d')][_0x5312('0x35')]({'where':{'id':_0x46ba2e['account']['id']},'include':[{'model':db[_0x5312('0x36')],'as':_0x5312('0x37'),'include':[{'model':db[_0x5312('0x38')],'as':_0x5312('0x39'),'where':_0x12e26b,'limit':0x1,'order':[[_0x5312('0x2a'),_0x5312('0x3a')]]}]},{'model':db['FaxApplication'],'as':_0x5312('0x3b')}]});})[_0x5312('0x12')](function(_0x3a3ac8){if(_0x3a3ac8&&_0x3a3ac8[_0x5312('0x37')]){var _0x290421=_0x3a3ac8[_0x5312('0x3c')]({'plain':!![]});_0x517779['account']=_0x290421;_0x517779[_0x5312('0x3d')]=_0x290421[_0x5312('0x3b')];_0x517779[_0x5312('0x3e')]=_0x290421[_0x5312('0x37')];_0x517779[_0x5312('0x3d')]=_['orderBy'](_0x517779[_0x5312('0x3d')],['priority'],[_0x5312('0x3f')]);if(_0x517779[_0x5312('0x40')][_0x5312('0x3b')]){delete _0x517779[_0x5312('0x40')][_0x5312('0x3b')];}if(_0x517779['account'][_0x5312('0x37')]&&_0x517779[_0x5312('0x40')][_0x5312('0x37')][_0x5312('0x39')]['length']){return _0x517779['account'][_0x5312('0x37')][_0x5312('0x39')][0x0];}var _0x449ed2=_[_0x5312('0xc')](_0x46ba2e[_0x5312('0x2d')],{'firstName':_0x46ba2e[_0x5312('0x2d')][_0x5312('0x2f')],'ListId':_0x290421['ListId']});_0x449ed2[_0x46ba2e[_0x5312('0x2d')][_0x5312('0x33')]]=_0x46ba2e['body']['from'];return db[_0x5312('0x38')][_0x5312('0x41')](_0x449ed2,{'fields':_0xea1aa5,'raw':!![]});}})[_0x5312('0x12')](function(_0x24e359){_0x517779['contact']=_0x24e359;if(_0x24e359){var _0x53a09c={'ContactId':_0x24e359['id'],'FaxAccountId':_0x46ba2e[_0x5312('0x40')]['id'],'fax':_0x24e359['fax']};return db[_0x5312('0x42')][_0x5312('0x35')]({'where':{'ContactId':_0x24e359['id'],'closed':![],'FaxAccountId':_0x46ba2e[_0x5312('0x40')]['id']}})[_0x5312('0x12')](function(_0x465311){if(_0x465311){return[_0x465311,![]];}return db[_0x5312('0x42')]['create'](_0x53a09c)[_0x5312('0x12')](function(_0x44f938){return[_0x44f938,!![]];});});}else{throw new Error(_0x5312('0x43'));}})['spread'](function(_0x3f103d,_0x13316f){var _0x388d3a=_0x3f103d[_0x5312('0x3c')]({'plain':!![]});if(_0x13316f){if(_0x517779['account'][_0x5312('0x44')]){_0x517779[_0x5312('0x3d')][_0x5312('0x45')]({'id':0x0,'priority':_0x517779[_0x5312('0x3d')][_0x5312('0x46')]+0x1,'app':_0x5312('0x47'),'appdata':'unmanaged','interval':_0x5312('0x48')});}_0x388d3a['created']=!![];}else{_0x388d3a['created']=![];}_0x517779[_0x5312('0x49')]=_0x388d3a;return db[_0x5312('0x4a')][_0x5312('0x41')]({'body':_0x46ba2e[_0x5312('0x2d')][_0x5312('0x2d')],'FaxAccountId':_0x46ba2e[_0x5312('0x40')]['id'],'FaxInteractionId':_0x3f103d['id'],'direction':'in','ContactId':_0x3f103d['ContactId'],'AttachmentId':_0x46ba2e[_0x5312('0x2d')][_0x5312('0x4b')]});})['then'](function(_0x18d6e8){_0x517779[_0x5312('0x19')]=_0x18d6e8;if(_0x517779['interaction']['UserId']){return db['User'][_0x5312('0x35')]({'attributes':['id',_0x5312('0x4c')],'where':{'id':_0x517779[_0x5312('0x49')][_0x5312('0x4d')]}})['then'](function(_0x592d35){if(_0x592d35){_0x517779[_0x5312('0x3d')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5312('0x4e'),'appdata':_0x592d35[_0x5312('0x4c')]+','+(_0x517779[_0x5312('0x40')][_0x5312('0x4f')]||0xa),'interval':_0x5312('0x48')});}return respondWithRpcPromise(_0x5312('0x50'),'startRouting',_0x517779);});}return respondWithRpcPromise(_0x5312('0x50'),'startRouting',_0x517779);})['then'](function(_0x4e0402){_0x38db4c(_0x4e0402);})[_0x5312('0x1b')](function(_0x4f94dd){_0x926211(_0x117949[_0x5312('0x17')](0x1f4,_0x4f94dd['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 1a94438..2ef089e 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 _0x3416=['removeListener','register','./faxAccount.events','save','remove','update','emit'];(function(_0x3017e8,_0x26bd0e){var _0x396032=function(_0x5b3670){while(--_0x5b3670){_0x3017e8['push'](_0x3017e8['shift']());}};_0x396032(++_0x26bd0e);}(_0x3416,0xf0));var _0x6341=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0x3416[_0x29c3b2];return _0x4b3aa7;};'use strict';var FaxAccountEvents=require(_0x6341('0x0'));var events=[_0x6341('0x1'),_0x6341('0x2'),_0x6341('0x3')];function createListener(_0x756ded,_0x489c95){return function(_0x24fd0b){_0x489c95[_0x6341('0x4')](_0x756ded,_0x24fd0b);};}function removeListener(_0x1b6246,_0x132313){return function(){FaxAccountEvents[_0x6341('0x5')](_0x1b6246,_0x132313);};}exports[_0x6341('0x6')]=function(_0x706bcf){for(var _0x3c99ba=0x0,_0x44d525=events['length'];_0x3c99ba<_0x44d525;_0x3c99ba++){var _0x4d3add=events[_0x3c99ba];var _0x2f3a48=createListener('faxAccount:'+_0x4d3add,_0x706bcf);FaxAccountEvents['on'](_0x4d3add,_0x2f3a48);}}; \ No newline at end of file +var _0x66bd=['length','./faxAccount.events','save','remove','emit','removeListener','register'];(function(_0x517882,_0x9370e3){var _0x172377=function(_0x397e2b){while(--_0x397e2b){_0x517882['push'](_0x517882['shift']());}};_0x172377(++_0x9370e3);}(_0x66bd,0x189));var _0xd66b=function(_0x21ba39,_0x413046){_0x21ba39=_0x21ba39-0x0;var _0x7a1e4f=_0x66bd[_0x21ba39];return _0x7a1e4f;};'use strict';var FaxAccountEvents=require(_0xd66b('0x0'));var events=[_0xd66b('0x1'),_0xd66b('0x2'),'update'];function createListener(_0x2062c2,_0x21dff4){return function(_0x151c6e){_0x21dff4[_0xd66b('0x3')](_0x2062c2,_0x151c6e);};}function removeListener(_0x52203f,_0x322a9a){return function(){FaxAccountEvents[_0xd66b('0x4')](_0x52203f,_0x322a9a);};}exports[_0xd66b('0x5')]=function(_0x1dab78){for(var _0x49d7b3=0x0,_0xb6fb43=events[_0xd66b('0x6')];_0x49d7b3<_0xb6fb43;_0x49d7b3++){var _0x110eec=events[_0x49d7b3];var _0x4d43ac=createListener('faxAccount:'+_0x110eec,_0x1dab78);FaxAccountEvents['on'](_0x110eec,_0x4d43ac);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index cb1e992..8af7255 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x648319,_0x464339){var _0x50f646=function(_0x547523){while(--_0x547523){_0x648319['push'](_0x648319['shift']());}};_0x50f646(++_0x464339);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x3b086e,_0x38d0ce){var _0x14dbd3=function(_0x264610){while(--_0x264610){_0x3b086e['push'](_0x3b086e['shift']());}};_0x14dbd3(++_0x38d0ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 18e73a8..cf63667 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 _0x34f0=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1b2cf7,_0x8b25e2){var _0x5471c6=function(_0x54f4ac){while(--_0x54f4ac){_0x1b2cf7['push'](_0x1b2cf7['shift']());}};_0x5471c6(++_0x8b25e2);}(_0x34f0,0x1be));var _0x034f=function(_0x1b519e,_0x439a87){_0x1b519e=_0x1b519e-0x0;var _0x1f03d4=_0x34f0[_0x1b519e];return _0x1f03d4;};'use strict';var Sequelize=require(_0x034f('0x0'));module[_0x034f('0x1')]={'priority':{'type':Sequelize[_0x034f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x034f('0x3')],'allowNull':![],'defaultValue':_0x034f('0x4')},'appdata':{'type':Sequelize[_0x034f('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x034f('0x6')}}; \ No newline at end of file +var _0xe549=['*,*,*,*','INTEGER','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe549,0x112));var _0x9e54=function(_0x3a7266,_0x1ead65){_0x3a7266=_0x3a7266-0x0;var _0x317c7f=_0xe549[_0x3a7266];return _0x317c7f;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x9e54('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x9e54('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9e54('0x1')]},'interval':{'type':Sequelize[_0x9e54('0x1')],'defaultValue':_0x9e54('0x2')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 4586c2c..5e88b09 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 _0x4632=['limit','count','set','Content-Range','json','apply','save','update','then','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','options','findAll','rows','params','keys','fields','includeAll','merge','catch','create','find','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset'];(function(_0x4b6db3,_0x4bfef8){var _0x5797ff=function(_0x574adf){while(--_0x574adf){_0x4b6db3['push'](_0x4b6db3['shift']());}};_0x5797ff(++_0x4bfef8);}(_0x4632,0x1c8));var _0x2463=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4632[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x2463('0x0'));var rimraf=require(_0x2463('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2463('0x2'));var rp=require(_0x2463('0x3'));var moment=require('moment');var BPromise=require(_0x2463('0x4'));var Mustache=require(_0x2463('0x5'));var util=require('util');var path=require(_0x2463('0x6'));var sox=require(_0x2463('0x7'));var csv=require(_0x2463('0x8'));var ejs=require(_0x2463('0x9'));var fs=require('fs');var fs_extra=require(_0x2463('0xa'));var _=require(_0x2463('0xb'));var squel=require(_0x2463('0xc'));var crypto=require(_0x2463('0xd'));var jsforce=require(_0x2463('0xe'));var deskjs=require(_0x2463('0xf'));var toCsv=require(_0x2463('0x8'));var querystring=require(_0x2463('0x10'));var Papa=require('papaparse');var Redis=require(_0x2463('0x11'));var authService=require(_0x2463('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2463('0x13'));var config=require(_0x2463('0x14'));var licenseUtil=require(_0x2463('0x15'));var db=require(_0x2463('0x16'))['db'];function respondWithStatusCode(_0x33dcb1,_0x1df8bc){_0x1df8bc=_0x1df8bc||0xcc;return function(_0x593291){if(_0x593291){return _0x33dcb1[_0x2463('0x17')](_0x1df8bc);}return _0x33dcb1['status'](_0x1df8bc)[_0x2463('0x18')]();};}function respondWithResult(_0xcec5d1,_0x244f7b){_0x244f7b=_0x244f7b||0xc8;return function(_0x2e48fa){if(_0x2e48fa){return _0xcec5d1[_0x2463('0x19')](_0x244f7b)['json'](_0x2e48fa);}};}function respondWithFilteredResult(_0x723a0,_0x33e4c7){return function(_0x4006ac){if(_0x4006ac){var _0x54a829=typeof _0x33e4c7[_0x2463('0x1a')]==='undefined'&&typeof _0x33e4c7[_0x2463('0x1b')]==='undefined';var _0x5a2c24=_0x4006ac[_0x2463('0x1c')];var _0x29134a=_0x54a829?0x0:_0x33e4c7[_0x2463('0x1a')];var _0x512514=_0x54a829?_0x4006ac[_0x2463('0x1c')]:_0x33e4c7['offset']+_0x33e4c7[_0x2463('0x1b')];var _0x1275d6;if(_0x512514>=_0x5a2c24){_0x512514=_0x5a2c24;_0x1275d6=0xc8;}else{_0x1275d6=0xce;}_0x723a0[_0x2463('0x19')](_0x1275d6);return _0x723a0[_0x2463('0x1d')](_0x2463('0x1e'),_0x29134a+'-'+_0x512514+'/'+_0x5a2c24)[_0x2463('0x1f')](_0x4006ac);}return null;};}function patchUpdates(_0x4d59b9){return function(_0x469c0c){try{jsonpatch[_0x2463('0x20')](_0x469c0c,_0x4d59b9,!![]);}catch(_0x20f27d){return BPromise['reject'](_0x20f27d);}return _0x469c0c[_0x2463('0x21')]();};}function saveUpdates(_0x53a1ee,_0x274904){return function(_0x37bc91){if(_0x37bc91){return _0x37bc91[_0x2463('0x22')](_0x53a1ee)[_0x2463('0x23')](function(_0x542fc5){return _0x542fc5;});}return null;};}function removeEntity(_0x3a586f,_0x1635cb){return function(_0x4a41b8){if(_0x4a41b8){return _0x4a41b8['destroy']()[_0x2463('0x23')](function(){_0x3a586f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48d846,_0xec82ec){return function(_0x12fcf5){if(!_0x12fcf5){_0x48d846[_0x2463('0x17')](0x194);}return _0x12fcf5;};}function handleError(_0x1afb22,_0x5cb405){_0x5cb405=_0x5cb405||0x1f4;return function(_0x3032c1){logger['error'](_0x3032c1['stack']);if(_0x3032c1[_0x2463('0x24')]){delete _0x3032c1[_0x2463('0x24')];}_0x1afb22[_0x2463('0x19')](_0x5cb405)['send'](_0x3032c1);};}exports[_0x2463('0x25')]=function(_0x5d2286,_0x1440e3){var _0x3eab0c={},_0x2aa329={},_0x19c588={'count':0x0,'rows':[]};var _0x58b3b3=_[_0x2463('0x26')](db[_0x2463('0x27')][_0x2463('0x28')],function(_0x23276a){return{'name':_0x23276a[_0x2463('0x29')],'type':_0x23276a[_0x2463('0x2a')][_0x2463('0x2b')]};});_0x2aa329[_0x2463('0x2c')]=_[_0x2463('0x26')](_0x58b3b3,_0x2463('0x24'));_0x2aa329['query']=_['keys'](_0x5d2286[_0x2463('0x2d')]);_0x2aa329[_0x2463('0x2e')]=_['intersection'](_0x2aa329[_0x2463('0x2c')],_0x2aa329[_0x2463('0x2d')]);_0x3eab0c[_0x2463('0x2f')]=_[_0x2463('0x30')](_0x2aa329[_0x2463('0x2c')],qs['fields'](_0x5d2286[_0x2463('0x2d')]['fields']));_0x3eab0c['attributes']=_0x3eab0c['attributes'][_0x2463('0x31')]?_0x3eab0c[_0x2463('0x2f')]:_0x2aa329['model'];if(!_0x5d2286[_0x2463('0x2d')][_0x2463('0x32')](_0x2463('0x33'))){_0x3eab0c[_0x2463('0x1b')]=qs[_0x2463('0x1b')](_0x5d2286['query'][_0x2463('0x1b')]);_0x3eab0c[_0x2463('0x1a')]=qs['offset'](_0x5d2286[_0x2463('0x2d')][_0x2463('0x1a')]);}_0x3eab0c[_0x2463('0x34')]=qs['sort'](_0x5d2286[_0x2463('0x2d')]['sort']);_0x3eab0c[_0x2463('0x35')]=qs[_0x2463('0x2e')](_[_0x2463('0x36')](_0x5d2286[_0x2463('0x2d')],_0x2aa329[_0x2463('0x2e')]),_0x58b3b3);if(_0x5d2286['query'][_0x2463('0x37')]){_0x3eab0c[_0x2463('0x35')]=_['merge'](_0x3eab0c[_0x2463('0x35')],{'$or':_['map'](_0x58b3b3,function(_0x3c1c4e){if(_0x3c1c4e[_0x2463('0x2a')]!==_0x2463('0x38')){var _0x3e894a={};_0x3e894a[_0x3c1c4e[_0x2463('0x24')]]={'$like':'%'+_0x5d2286[_0x2463('0x2d')][_0x2463('0x37')]+'%'};return _0x3e894a;}})});}_0x3eab0c=_['merge']({},_0x3eab0c,_0x5d2286[_0x2463('0x39')]);var _0x45430b={'where':_0x3eab0c[_0x2463('0x35')]};return db[_0x2463('0x27')]['count'](_0x45430b)[_0x2463('0x23')](function(_0x3cc9ee){_0x19c588[_0x2463('0x1c')]=_0x3cc9ee;if(_0x5d2286['query']['includeAll']){_0x3eab0c['include']=[{'all':!![]}];}return db[_0x2463('0x27')][_0x2463('0x3a')](_0x3eab0c);})['then'](function(_0x4e96cc){_0x19c588[_0x2463('0x3b')]=_0x4e96cc;return _0x19c588;})[_0x2463('0x23')](respondWithFilteredResult(_0x1440e3,_0x3eab0c))['catch'](handleError(_0x1440e3,null));};exports['show']=function(_0x3e7cf8,_0x2e79ea){var _0x1059cd={'raw':!![],'where':{'id':_0x3e7cf8[_0x2463('0x3c')]['id']}},_0x4adeba={};_0x4adeba['model']=_[_0x2463('0x3d')](db[_0x2463('0x27')][_0x2463('0x28')]);_0x4adeba[_0x2463('0x2d')]=_[_0x2463('0x3d')](_0x3e7cf8[_0x2463('0x2d')]);_0x4adeba[_0x2463('0x2e')]=_['intersection'](_0x4adeba[_0x2463('0x2c')],_0x4adeba[_0x2463('0x2d')]);_0x1059cd[_0x2463('0x2f')]=_[_0x2463('0x30')](_0x4adeba[_0x2463('0x2c')],qs[_0x2463('0x3e')](_0x3e7cf8['query'][_0x2463('0x3e')]));_0x1059cd['attributes']=_0x1059cd['attributes']['length']?_0x1059cd['attributes']:_0x4adeba[_0x2463('0x2c')];if(_0x3e7cf8[_0x2463('0x2d')][_0x2463('0x3f')]){_0x1059cd['include']=[{'all':!![]}];}_0x1059cd=_[_0x2463('0x40')]({},_0x1059cd,_0x3e7cf8[_0x2463('0x39')]);return db[_0x2463('0x27')]['find'](_0x1059cd)['then'](handleEntityNotFound(_0x2e79ea,null))[_0x2463('0x23')](respondWithResult(_0x2e79ea,null))[_0x2463('0x41')](handleError(_0x2e79ea,null));};exports['create']=function(_0x207a51,_0x39e47e){return db[_0x2463('0x27')][_0x2463('0x42')](_0x207a51['body'],{})['then'](respondWithResult(_0x39e47e,0xc9))[_0x2463('0x41')](handleError(_0x39e47e,null));};exports[_0x2463('0x22')]=function(_0x4d388b,_0xe37306){if(_0x4d388b['body']['id']){delete _0x4d388b['body']['id'];}return db[_0x2463('0x27')][_0x2463('0x43')]({'where':{'id':_0x4d388b[_0x2463('0x3c')]['id']}})[_0x2463('0x23')](handleEntityNotFound(_0xe37306,null))[_0x2463('0x23')](saveUpdates(_0x4d388b[_0x2463('0x44')],null))[_0x2463('0x23')](respondWithResult(_0xe37306,null))[_0x2463('0x41')](handleError(_0xe37306,null));};exports['destroy']=function(_0x2f1a90,_0x49a6ce){return db[_0x2463('0x27')][_0x2463('0x43')]({'where':{'id':_0x2f1a90[_0x2463('0x3c')]['id']}})[_0x2463('0x23')](handleEntityNotFound(_0x49a6ce,null))[_0x2463('0x23')](removeEntity(_0x49a6ce,null))[_0x2463('0x41')](handleError(_0x49a6ce,null));}; \ No newline at end of file +var _0xc7b5=['merge','options','includeAll','include','rows','catch','show','params','create','body','update','find','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','order','sort','pick','filter','where','VIRTUAL'];(function(_0x5e59ad,_0x258069){var _0x305fcb=function(_0x364406){while(--_0x364406){_0x5e59ad['push'](_0x5e59ad['shift']());}};_0x305fcb(++_0x258069);}(_0xc7b5,0x1c8));var _0x5c7b=function(_0x12e1ab,_0x3f3061){_0x12e1ab=_0x12e1ab-0x0;var _0x1c57c1=_0xc7b5[_0x12e1ab];return _0x1c57c1;};'use strict';var emlformat=require(_0x5c7b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5c7b('0x1'));var jsonpatch=require(_0x5c7b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5c7b('0x3'));var Mustache=require(_0x5c7b('0x4'));var util=require(_0x5c7b('0x5'));var path=require(_0x5c7b('0x6'));var sox=require(_0x5c7b('0x7'));var csv=require('to-csv');var ejs=require(_0x5c7b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c7b('0x9'));var squel=require(_0x5c7b('0xa'));var crypto=require(_0x5c7b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5c7b('0xc'));var toCsv=require(_0x5c7b('0xd'));var querystring=require(_0x5c7b('0xe'));var Papa=require('papaparse');var Redis=require(_0x5c7b('0xf'));var authService=require(_0x5c7b('0x10'));var qs=require(_0x5c7b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c7b('0x12'))(_0x5c7b('0x13'));var utils=require(_0x5c7b('0x14'));var config=require(_0x5c7b('0x15'));var licenseUtil=require(_0x5c7b('0x16'));var db=require(_0x5c7b('0x17'))['db'];function respondWithStatusCode(_0x139fa9,_0x57a92f){_0x57a92f=_0x57a92f||0xcc;return function(_0x150453){if(_0x150453){return _0x139fa9[_0x5c7b('0x18')](_0x57a92f);}return _0x139fa9[_0x5c7b('0x19')](_0x57a92f)['end']();};}function respondWithResult(_0x45bf32,_0x5f5dfb){_0x5f5dfb=_0x5f5dfb||0xc8;return function(_0x5ada69){if(_0x5ada69){return _0x45bf32['status'](_0x5f5dfb)[_0x5c7b('0x1a')](_0x5ada69);}};}function respondWithFilteredResult(_0x1b7e41,_0x22d39a){return function(_0x62181b){if(_0x62181b){var _0x146212=typeof _0x22d39a[_0x5c7b('0x1b')]===_0x5c7b('0x1c')&&typeof _0x22d39a[_0x5c7b('0x1d')]===_0x5c7b('0x1c');var _0xe986f2=_0x62181b[_0x5c7b('0x1e')];var _0x105bd3=_0x146212?0x0:_0x22d39a[_0x5c7b('0x1b')];var _0x4838e1=_0x146212?_0x62181b[_0x5c7b('0x1e')]:_0x22d39a[_0x5c7b('0x1b')]+_0x22d39a[_0x5c7b('0x1d')];var _0x213736;if(_0x4838e1>=_0xe986f2){_0x4838e1=_0xe986f2;_0x213736=0xc8;}else{_0x213736=0xce;}_0x1b7e41[_0x5c7b('0x19')](_0x213736);return _0x1b7e41[_0x5c7b('0x1f')](_0x5c7b('0x20'),_0x105bd3+'-'+_0x4838e1+'/'+_0xe986f2)[_0x5c7b('0x1a')](_0x62181b);}return null;};}function patchUpdates(_0xca14b9){return function(_0x23dc18){try{jsonpatch[_0x5c7b('0x21')](_0x23dc18,_0xca14b9,!![]);}catch(_0x427f2c){return BPromise['reject'](_0x427f2c);}return _0x23dc18[_0x5c7b('0x22')]();};}function saveUpdates(_0x3dc3d9,_0x71f2fd){return function(_0x576395){if(_0x576395){return _0x576395['update'](_0x3dc3d9)[_0x5c7b('0x23')](function(_0x816033){return _0x816033;});}return null;};}function removeEntity(_0x1030eb,_0x56e1e9){return function(_0x3265d0){if(_0x3265d0){return _0x3265d0[_0x5c7b('0x24')]()[_0x5c7b('0x23')](function(){_0x1030eb[_0x5c7b('0x19')](0xcc)[_0x5c7b('0x25')]();});}};}function handleEntityNotFound(_0x13c86c,_0x16d709){return function(_0x3da443){if(!_0x3da443){_0x13c86c[_0x5c7b('0x18')](0x194);}return _0x3da443;};}function handleError(_0x403666,_0xb1ca78){_0xb1ca78=_0xb1ca78||0x1f4;return function(_0x20715a){logger[_0x5c7b('0x26')](_0x20715a[_0x5c7b('0x27')]);if(_0x20715a[_0x5c7b('0x28')]){delete _0x20715a[_0x5c7b('0x28')];}_0x403666[_0x5c7b('0x19')](_0xb1ca78)[_0x5c7b('0x29')](_0x20715a);};}exports[_0x5c7b('0x2a')]=function(_0x311470,_0x37dcd1){var _0x5f44a8={},_0x53f69a={},_0x7516ff={'count':0x0,'rows':[]};var _0x21d25b=_[_0x5c7b('0x2b')](db[_0x5c7b('0x2c')][_0x5c7b('0x2d')],function(_0x73b953){return{'name':_0x73b953[_0x5c7b('0x2e')],'type':_0x73b953[_0x5c7b('0x2f')]['key']};});_0x53f69a[_0x5c7b('0x30')]=_[_0x5c7b('0x2b')](_0x21d25b,_0x5c7b('0x28'));_0x53f69a[_0x5c7b('0x31')]=_[_0x5c7b('0x32')](_0x311470[_0x5c7b('0x31')]);_0x53f69a[_0x5c7b('0x33')]=_['intersection'](_0x53f69a['model'],_0x53f69a[_0x5c7b('0x31')]);_0x5f44a8[_0x5c7b('0x34')]=_[_0x5c7b('0x35')](_0x53f69a[_0x5c7b('0x30')],qs[_0x5c7b('0x36')](_0x311470[_0x5c7b('0x31')][_0x5c7b('0x36')]));_0x5f44a8[_0x5c7b('0x34')]=_0x5f44a8[_0x5c7b('0x34')][_0x5c7b('0x37')]?_0x5f44a8[_0x5c7b('0x34')]:_0x53f69a['model'];if(!_0x311470['query']['hasOwnProperty']('nolimit')){_0x5f44a8[_0x5c7b('0x1d')]=qs[_0x5c7b('0x1d')](_0x311470[_0x5c7b('0x31')][_0x5c7b('0x1d')]);_0x5f44a8[_0x5c7b('0x1b')]=qs['offset'](_0x311470[_0x5c7b('0x31')][_0x5c7b('0x1b')]);}_0x5f44a8[_0x5c7b('0x38')]=qs[_0x5c7b('0x39')](_0x311470[_0x5c7b('0x31')][_0x5c7b('0x39')]);_0x5f44a8['where']=qs[_0x5c7b('0x33')](_[_0x5c7b('0x3a')](_0x311470[_0x5c7b('0x31')],_0x53f69a[_0x5c7b('0x33')]),_0x21d25b);if(_0x311470[_0x5c7b('0x31')][_0x5c7b('0x3b')]){_0x5f44a8[_0x5c7b('0x3c')]=_['merge'](_0x5f44a8[_0x5c7b('0x3c')],{'$or':_[_0x5c7b('0x2b')](_0x21d25b,function(_0x169d92){if(_0x169d92[_0x5c7b('0x2f')]!==_0x5c7b('0x3d')){var _0x5a05c3={};_0x5a05c3[_0x169d92[_0x5c7b('0x28')]]={'$like':'%'+_0x311470[_0x5c7b('0x31')][_0x5c7b('0x3b')]+'%'};return _0x5a05c3;}})});}_0x5f44a8=_[_0x5c7b('0x3e')]({},_0x5f44a8,_0x311470[_0x5c7b('0x3f')]);var _0x50c2d9={'where':_0x5f44a8[_0x5c7b('0x3c')]};return db[_0x5c7b('0x2c')]['count'](_0x50c2d9)[_0x5c7b('0x23')](function(_0x371a3d){_0x7516ff['count']=_0x371a3d;if(_0x311470['query'][_0x5c7b('0x40')]){_0x5f44a8[_0x5c7b('0x41')]=[{'all':!![]}];}return db[_0x5c7b('0x2c')]['findAll'](_0x5f44a8);})['then'](function(_0x14b601){_0x7516ff[_0x5c7b('0x42')]=_0x14b601;return _0x7516ff;})['then'](respondWithFilteredResult(_0x37dcd1,_0x5f44a8))[_0x5c7b('0x43')](handleError(_0x37dcd1,null));};exports[_0x5c7b('0x44')]=function(_0x19fb54,_0x204e65){var _0x61bd13={'raw':!![],'where':{'id':_0x19fb54[_0x5c7b('0x45')]['id']}},_0x3f1d99={};_0x3f1d99['model']=_['keys'](db[_0x5c7b('0x2c')]['rawAttributes']);_0x3f1d99[_0x5c7b('0x31')]=_[_0x5c7b('0x32')](_0x19fb54[_0x5c7b('0x31')]);_0x3f1d99[_0x5c7b('0x33')]=_['intersection'](_0x3f1d99[_0x5c7b('0x30')],_0x3f1d99[_0x5c7b('0x31')]);_0x61bd13[_0x5c7b('0x34')]=_[_0x5c7b('0x35')](_0x3f1d99[_0x5c7b('0x30')],qs[_0x5c7b('0x36')](_0x19fb54['query'][_0x5c7b('0x36')]));_0x61bd13['attributes']=_0x61bd13[_0x5c7b('0x34')][_0x5c7b('0x37')]?_0x61bd13[_0x5c7b('0x34')]:_0x3f1d99['model'];if(_0x19fb54[_0x5c7b('0x31')][_0x5c7b('0x40')]){_0x61bd13[_0x5c7b('0x41')]=[{'all':!![]}];}_0x61bd13=_['merge']({},_0x61bd13,_0x19fb54['options']);return db[_0x5c7b('0x2c')]['find'](_0x61bd13)[_0x5c7b('0x23')](handleEntityNotFound(_0x204e65,null))[_0x5c7b('0x23')](respondWithResult(_0x204e65,null))['catch'](handleError(_0x204e65,null));};exports[_0x5c7b('0x46')]=function(_0x12c46f,_0x560027){return db[_0x5c7b('0x2c')]['create'](_0x12c46f[_0x5c7b('0x47')],{})['then'](respondWithResult(_0x560027,0xc9))[_0x5c7b('0x43')](handleError(_0x560027,null));};exports[_0x5c7b('0x48')]=function(_0x4cdd0e,_0x1cdbc1){if(_0x4cdd0e[_0x5c7b('0x47')]['id']){delete _0x4cdd0e[_0x5c7b('0x47')]['id'];}return db[_0x5c7b('0x2c')][_0x5c7b('0x49')]({'where':{'id':_0x4cdd0e['params']['id']}})['then'](handleEntityNotFound(_0x1cdbc1,null))[_0x5c7b('0x23')](saveUpdates(_0x4cdd0e[_0x5c7b('0x47')],null))[_0x5c7b('0x23')](respondWithResult(_0x1cdbc1,null))['catch'](handleError(_0x1cdbc1,null));};exports[_0x5c7b('0x24')]=function(_0x12d2c0,_0x81522d){return db[_0x5c7b('0x2c')][_0x5c7b('0x49')]({'where':{'id':_0x12d2c0[_0x5c7b('0x45')]['id']}})[_0x5c7b('0x23')](handleEntityNotFound(_0x81522d,null))['then'](removeEntity(_0x81522d,null))[_0x5c7b('0x43')](handleError(_0x81522d,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index af4a185..b470c50 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 _0xc964=['moment','bluebird','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','lodash','util','api'];(function(_0x4f2cb1,_0x58c675){var _0x29077b=function(_0x284ac9){while(--_0x284ac9){_0x4f2cb1['push'](_0x4f2cb1['shift']());}};_0x29077b(++_0x58c675);}(_0xc964,0xc9));var _0x4c96=function(_0x307d15,_0xab4946){_0x307d15=_0x307d15-0x0;var _0x2f517c=_0xc964[_0x307d15];return _0x2f517c;};'use strict';var _=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var logger=require('../../config/logger')(_0x4c96('0x2'));var moment=require(_0x4c96('0x3'));var BPromise=require(_0x4c96('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c96('0x5'));var rimraf=require(_0x4c96('0x6'));var config=require(_0x4c96('0x7'));var attributes=require('./faxApplication.attributes');module[_0x4c96('0x8')]=function(_0x16efed,_0x220b4d){return _0x16efed[_0x4c96('0x9')](_0x4c96('0xa'),attributes,{'tableName':_0x4c96('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x21b4=['request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4c0ed5,_0x24f47a){var _0x20b37a=function(_0x4c8398){while(--_0x4c8398){_0x4c0ed5['push'](_0x4c0ed5['shift']());}};_0x20b37a(++_0x24f47a);}(_0x21b4,0x10a));var _0x421b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21b4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x421b('0x0'));var util=require(_0x421b('0x1'));var logger=require(_0x421b('0x2'))(_0x421b('0x3'));var moment=require(_0x421b('0x4'));var BPromise=require(_0x421b('0x5'));var rp=require(_0x421b('0x6'));var fs=require('fs');var path=require(_0x421b('0x7'));var rimraf=require(_0x421b('0x8'));var config=require(_0x421b('0x9'));var attributes=require(_0x421b('0xa'));module[_0x421b('0xb')]=function(_0x4906ac,_0x49448a){return _0x4906ac[_0x421b('0xc')](_0x421b('0xd'),attributes,{'tableName':_0x421b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x421b('0xf'),'collate':_0x421b('0x10')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 900a6ef..bd29397 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 _0x33a7=['catch','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','request','then','info','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateFaxApplication','update','body','options','raw','where','attributes','limit','debug'];(function(_0x319696,_0x477274){var _0x44085a=function(_0x33c51d){while(--_0x33c51d){_0x319696['push'](_0x319696['shift']());}};_0x44085a(++_0x477274);}(_0x33a7,0xfd));var _0x733a=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0x33a7[_0x40df5f];return _0x1573f1;};'use strict';var _=require('lodash');var util=require(_0x733a('0x0'));var moment=require(_0x733a('0x1'));var BPromise=require(_0x733a('0x2'));var rs=require(_0x733a('0x3'));var fs=require('fs');var Redis=require(_0x733a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x733a('0x5'));var config=require(_0x733a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x733a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f347d,_0x2dce9c,_0x51d9dd){return new BPromise(function(_0x1b6aeb,_0x1cf7f1){return client[_0x733a('0x8')](_0x2f347d,_0x51d9dd)[_0x733a('0x9')](function(_0x5036e4){logger[_0x733a('0xa')](_0x733a('0xb'),_0x2dce9c,'request\x20sent');logger['debug'](_0x733a('0xc'),_0x2dce9c,_0x733a('0xd'),JSON[_0x733a('0xe')](_0x5036e4));if(_0x5036e4[_0x733a('0xf')]){if(_0x5036e4['error']['code']===0x1f4){logger[_0x733a('0xf')](_0x733a('0xb'),_0x2dce9c,_0x5036e4[_0x733a('0xf')][_0x733a('0x10')]);return _0x1cf7f1(_0x5036e4[_0x733a('0xf')]['message']);}logger[_0x733a('0xf')](_0x733a('0xb'),_0x2dce9c,_0x5036e4[_0x733a('0xf')]['message']);return _0x1b6aeb(_0x5036e4['error']['message']);}else{logger[_0x733a('0xa')]('FaxApplication,\x20%s,\x20%s',_0x2dce9c,_0x733a('0xd'));_0x1b6aeb(_0x5036e4[_0x733a('0x11')][_0x733a('0x10')]);}})['catch'](function(_0x22d45d){logger[_0x733a('0xf')](_0x733a('0xb'),_0x2dce9c,_0x22d45d);_0x1cf7f1(_0x22d45d);});});}exports[_0x733a('0x12')]=function(_0x3a96fb){var _0x5031b2=this;return new Promise(function(_0x23b939,_0xa5329b){return db['FaxApplication'][_0x733a('0x13')](_0x3a96fb[_0x733a('0x14')],{'raw':_0x3a96fb[_0x733a('0x15')]?_0x3a96fb[_0x733a('0x15')][_0x733a('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a96fb[_0x733a('0x15')]?_0x3a96fb['options'][_0x733a('0x17')]||null:null,'attributes':_0x3a96fb[_0x733a('0x15')]?_0x3a96fb[_0x733a('0x15')][_0x733a('0x18')]||null:null,'limit':_0x3a96fb[_0x733a('0x15')]?_0x3a96fb[_0x733a('0x15')][_0x733a('0x19')]||null:null})[_0x733a('0x9')](function(_0x2f43bc){logger[_0x733a('0xa')](_0x733a('0x12'),_0x3a96fb);logger[_0x733a('0x1a')](_0x733a('0x12'),_0x3a96fb,JSON[_0x733a('0xe')](_0x2f43bc));_0x23b939(_0x2f43bc);})[_0x733a('0x1b')](function(_0x2cfe6c){logger[_0x733a('0xf')](_0x733a('0x12'),_0x2cfe6c[_0x733a('0x10')],_0x3a96fb);_0xa5329b(_0x5031b2[_0x733a('0xf')](0x1f4,_0x2cfe6c[_0x733a('0x10')]));});});}; \ No newline at end of file +var _0x4bc6=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','debug','util','moment'];(function(_0x1cd18b,_0x355aec){var _0x5e79e0=function(_0x8755b0){while(--_0x8755b0){_0x1cd18b['push'](_0x1cd18b['shift']());}};_0x5e79e0(++_0x355aec);}(_0x4bc6,0xd0));var _0x64bc=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4bc6[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x64bc('0x0'));var moment=require(_0x64bc('0x1'));var BPromise=require('bluebird');var rs=require(_0x64bc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64bc('0x3'))['db'];var utils=require(_0x64bc('0x4'));var logger=require(_0x64bc('0x5'))(_0x64bc('0x6'));var config=require(_0x64bc('0x7'));var jayson=require(_0x64bc('0x8'));var client=jayson[_0x64bc('0x9')][_0x64bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a2287,_0x5c02e2,_0x491c96){return new BPromise(function(_0x5a436a,_0x2ec7a8){return client[_0x64bc('0xb')](_0x4a2287,_0x491c96)[_0x64bc('0xc')](function(_0x4c2293){logger[_0x64bc('0xd')](_0x64bc('0xe'),_0x5c02e2,_0x64bc('0xf'));logger['debug'](_0x64bc('0x10'),_0x5c02e2,_0x64bc('0xf'),JSON['stringify'](_0x4c2293));if(_0x4c2293[_0x64bc('0x11')]){if(_0x4c2293['error'][_0x64bc('0x12')]===0x1f4){logger[_0x64bc('0x11')](_0x64bc('0xe'),_0x5c02e2,_0x4c2293['error']['message']);return _0x2ec7a8(_0x4c2293[_0x64bc('0x11')][_0x64bc('0x13')]);}logger[_0x64bc('0x11')](_0x64bc('0xe'),_0x5c02e2,_0x4c2293['error']['message']);return _0x5a436a(_0x4c2293[_0x64bc('0x11')][_0x64bc('0x13')]);}else{logger[_0x64bc('0xd')](_0x64bc('0xe'),_0x5c02e2,_0x64bc('0xf'));_0x5a436a(_0x4c2293[_0x64bc('0x14')][_0x64bc('0x13')]);}})[_0x64bc('0x15')](function(_0x495e80){logger['error'](_0x64bc('0xe'),_0x5c02e2,_0x495e80);_0x2ec7a8(_0x495e80);});});}exports[_0x64bc('0x16')]=function(_0x2a09c7){var _0x35182a=this;return new Promise(function(_0x44714b,_0x44fc97){return db[_0x64bc('0x17')][_0x64bc('0x18')](_0x2a09c7['body'],{'raw':_0x2a09c7[_0x64bc('0x19')]?_0x2a09c7[_0x64bc('0x19')][_0x64bc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a09c7[_0x64bc('0x19')]?_0x2a09c7[_0x64bc('0x19')][_0x64bc('0x1b')]||null:null,'attributes':_0x2a09c7[_0x64bc('0x19')]?_0x2a09c7[_0x64bc('0x19')][_0x64bc('0x1c')]||null:null,'limit':_0x2a09c7[_0x64bc('0x19')]?_0x2a09c7['options']['limit']||null:null})[_0x64bc('0xc')](function(_0x5b39ac){logger[_0x64bc('0xd')](_0x64bc('0x16'),_0x2a09c7);logger[_0x64bc('0x1d')](_0x64bc('0x16'),_0x2a09c7,JSON['stringify'](_0x5b39ac));_0x44714b(_0x5b39ac);})[_0x64bc('0x15')](function(_0x3d0d96){logger[_0x64bc('0x11')](_0x64bc('0x16'),_0x3d0d96[_0x64bc('0x13')],_0x2a09c7);_0x44fc97(_0x35182a['error'](0x1f4,_0x3d0d96[_0x64bc('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index fa55135..b4a2f3c 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 _0x0abf=['isAuthenticated','index','show','post','put','/:id','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x0abf,0xe8));var _0xf0ab=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0abf[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0xb')]('/',auth[_0xf0ab('0x8')](),controller['create']);router[_0xf0ab('0xc')](_0xf0ab('0xd'),auth[_0xf0ab('0x8')](),controller['update']);router['delete'](_0xf0ab('0xd'),auth['isAuthenticated'](),controller[_0xf0ab('0xe')]);module[_0xf0ab('0xf')]=router; \ No newline at end of file +var _0x6e6c=['delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e6('0x5'));var controller=require('./faxApplication.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0xa')]('/',auth['isAuthenticated'](),controller[_0xc6e6('0xb')]);router['put'](_0xc6e6('0x8'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xc')]);router[_0xc6e6('0xd')](_0xc6e6('0x8'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xe')]);module[_0xc6e6('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 827b07c..60b1725 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 _0x8d23=['DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x214500,_0x5d3434){var _0x46496c=function(_0x3373f6){while(--_0x3373f6){_0x214500['push'](_0x214500['shift']());}};_0x46496c(++_0x5d3434);}(_0x8d23,0x1c1));var _0x38d2=function(_0x18413b,_0x2fee67){_0x18413b=_0x18413b-0x0;var _0x213331=_0x8d23[_0x18413b];return _0x213331;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x38d2('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x38d2('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x38d2('0x2')]},'thirdDisposition':{'type':Sequelize[_0x38d2('0x2')]},'note':{'type':Sequelize[_0x38d2('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x38d2('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x38d2('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x38d2('0x3')]('in',_0x38d2('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x6df7=['sequelize','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x14e96d,_0x16e42d){var _0x145620=function(_0x23f82f){while(--_0x23f82f){_0x14e96d['push'](_0x14e96d['shift']());}};_0x145620(++_0x16e42d);}(_0x6df7,0x72));var _0x76df=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6df7[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x76df('0x0'));module['exports']={'closed':{'type':Sequelize[_0x76df('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x76df('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x76df('0x3')]},'thirdDisposition':{'type':Sequelize[_0x76df('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x76df('0x2')]},'fax':{'type':Sequelize[_0x76df('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x76df('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x76df('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x76df('0x4')]('in',_0x76df('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index a9c4df7..bf657af 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 _0x363a=['files','tmp','attachments','join','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./faxInteraction.socket','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','map','fullname','TagIds','Tags','split','forEach','push','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','select','field','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','includeAll','options','create','describe','addMessage','ids','getMessages','findOne','FaxMessage','nolimit','sort','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','color','emit','faxInteractionTags:save','removeTags','download','root','server'];(function(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_0x363a,0x1cc));var _0xa363=function(_0x400b6c,_0x4a6139){_0x400b6c=_0x400b6c-0x0;var _0x4c4e3e=_0x363a[_0x400b6c];return _0x4c4e3e;};'use strict';var emlformat=require(_0xa363('0x0'));var rimraf=require(_0xa363('0x1'));var zipdir=require(_0xa363('0x2'));var jsonpatch=require(_0xa363('0x3'));var rp=require(_0xa363('0x4'));var moment=require('moment');var BPromise=require(_0xa363('0x5'));var Mustache=require(_0xa363('0x6'));var util=require(_0xa363('0x7'));var path=require(_0xa363('0x8'));var sox=require(_0xa363('0x9'));var csv=require(_0xa363('0xa'));var ejs=require(_0xa363('0xb'));var fs=require('fs');var fs_extra=require(_0xa363('0xc'));var _=require(_0xa363('0xd'));var squel=require(_0xa363('0xe'));var crypto=require(_0xa363('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa363('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa363('0x11'));var Papa=require(_0xa363('0x12'));var Redis=require('ioredis');var authService=require(_0xa363('0x13'));var qs=require(_0xa363('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa363('0x15'));var logger=require(_0xa363('0x16'))(_0xa363('0x17'));var utils=require(_0xa363('0x18'));var config=require(_0xa363('0x19'));var licenseUtil=require(_0xa363('0x1a'));var db=require(_0xa363('0x1b'))['db'];config[_0xa363('0x1c')]=_[_0xa363('0x1d')](config[_0xa363('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa363('0x1c')]));require(_0xa363('0x1e'))['register'](socket);function respondWithStatusCode(_0xf7e474,_0x2880c9){_0x2880c9=_0x2880c9||0xcc;return function(_0x1e77da){if(_0x1e77da){return _0xf7e474[_0xa363('0x1f')](_0x2880c9);}return _0xf7e474[_0xa363('0x20')](_0x2880c9)[_0xa363('0x21')]();};}function respondWithResult(_0x3befd3,_0x1384ac){_0x1384ac=_0x1384ac||0xc8;return function(_0x4dca9a){if(_0x4dca9a){return _0x3befd3['status'](_0x1384ac)['json'](_0x4dca9a);}};}function respondWithFilteredResult(_0x177cd7,_0x4e326c){return function(_0x45897c){if(_0x45897c){var _0x57f939=typeof _0x4e326c[_0xa363('0x22')]==='undefined'&&typeof _0x4e326c['limit']===_0xa363('0x23');var _0x44da24=_0x45897c[_0xa363('0x24')];var _0x5a75f9=_0x57f939?0x0:_0x4e326c['offset'];var _0x3f0781=_0x57f939?_0x45897c[_0xa363('0x24')]:_0x4e326c[_0xa363('0x22')]+_0x4e326c[_0xa363('0x25')];var _0x3dc8ea;if(_0x3f0781>=_0x44da24){_0x3f0781=_0x44da24;_0x3dc8ea=0xc8;}else{_0x3dc8ea=0xce;}_0x177cd7[_0xa363('0x20')](_0x3dc8ea);return _0x177cd7[_0xa363('0x26')](_0xa363('0x27'),_0x5a75f9+'-'+_0x3f0781+'/'+_0x44da24)[_0xa363('0x28')](_0x45897c);}return null;};}function patchUpdates(_0x153502){return function(_0x623e03){try{jsonpatch['apply'](_0x623e03,_0x153502,!![]);}catch(_0x214fbd){return BPromise[_0xa363('0x29')](_0x214fbd);}return _0x623e03[_0xa363('0x2a')]();};}function saveUpdates(_0x209d3d,_0x2186d3){return function(_0xa0cc50){if(_0xa0cc50){return _0xa0cc50[_0xa363('0x2b')](_0x209d3d)[_0xa363('0x2c')](function(_0x5b0ed5){return _0x5b0ed5;});}return null;};}function removeEntity(_0x5afc80,_0x4dabc3){return function(_0x1fcfed){if(_0x1fcfed){return _0x1fcfed[_0xa363('0x2d')]()['then'](function(){_0x5afc80['status'](0xcc)[_0xa363('0x21')]();});}};}function handleEntityNotFound(_0x23c3d1,_0x4bb604){return function(_0x196a71){if(!_0x196a71){_0x23c3d1[_0xa363('0x1f')](0x194);}return _0x196a71;};}function handleError(_0x3b79fa,_0x4591fe){_0x4591fe=_0x4591fe||0x1f4;return function(_0x4bd12f){logger[_0xa363('0x2e')](_0x4bd12f['stack']);if(_0x4bd12f[_0xa363('0x2f')]){delete _0x4bd12f[_0xa363('0x2f')];}_0x3b79fa[_0xa363('0x20')](_0x4591fe)[_0xa363('0x30')](_0x4bd12f);};}function getInteractionUsers(_0x46301d,_0x2ba4ba){return new BPromise(function(_0x50598a,_0x24037a){try{if(_0x2ba4ba[_0x46301d['id']]){_0x46301d['Users']=_[_0xa363('0x31')](_0x2ba4ba[_0x46301d['id']],function(_0x57c51c){return{'id':_0x57c51c['id'],'fullname':_0x57c51c[_0xa363('0x32')]};});}}catch(_0x3206e0){_0x24037a(_0x3206e0);}_0x50598a(_0x46301d);});}function getInteractionTags(_0x43396a,_0x1d9955){return new BPromise(function(_0x5143cc,_0x34245c){try{if(_0x43396a[_0xa363('0x33')]){_0x43396a[_0xa363('0x34')]=[];_0x43396a[_0xa363('0x33')][_0xa363('0x35')](',')[_0xa363('0x36')](function(_0x3360b9){_0x43396a[_0xa363('0x34')][_0xa363('0x37')](_0x1d9955[_0x3360b9]);});}delete _0x43396a[_0xa363('0x33')];}catch(_0x1f7632){_0x34245c(_0x1f7632);}_0x5143cc(_0x43396a);});}function updateFaxInteraction(_0xaced40,_0x3937c1,_0x37a597){return new BPromise(function(_0xaad0f2,_0x29b269){return getInteractionUsers(_0xaced40,_0x37a597)[_0xa363('0x2c')](function(_0x33c4ab){return getInteractionTags(_0x33c4ab,_0x3937c1);})[_0xa363('0x2c')](function(_0x5bd8c0){_0xaad0f2(_0x5bd8c0);})[_0xa363('0x38')](function(_0x391512){_0x29b269(_0x391512);});});}exports[_0xa363('0x39')]=function(_0x1885a8,_0x168e62){var _0x192797={},_0x3e4ac5={},_0x471b92={'count':0x0,'rows':[]};var _0x179713=_[_0xa363('0x31')](db[_0xa363('0x3a')][_0xa363('0x3b')],function(_0x2ab3ee){return{'name':_0x2ab3ee[_0xa363('0x3c')],'type':_0x2ab3ee[_0xa363('0x3d')][_0xa363('0x3e')]};});_0x3e4ac5[_0xa363('0x3f')]=_[_0xa363('0x31')](_0x179713,'name');_0x3e4ac5['query']=_[_0xa363('0x40')](_0x1885a8[_0xa363('0x41')]);_0x3e4ac5[_0xa363('0x42')]=_[_0xa363('0x43')](_0x3e4ac5[_0xa363('0x3f')],_0x3e4ac5['query']);_0x192797[_0xa363('0x44')]=_[_0xa363('0x43')](_0x3e4ac5['model'],qs[_0xa363('0x45')](_0x1885a8['query'][_0xa363('0x45')]));_0x192797[_0xa363('0x44')]=_0x192797[_0xa363('0x44')][_0xa363('0x46')]?_0x192797[_0xa363('0x44')]:_0x3e4ac5['model'];if(!_0x1885a8[_0xa363('0x41')][_0xa363('0x47')]('nolimit')){_0x192797[_0xa363('0x25')]=qs['limit'](_0x1885a8[_0xa363('0x41')][_0xa363('0x25')]);_0x192797[_0xa363('0x22')]=qs[_0xa363('0x22')](_0x1885a8[_0xa363('0x41')][_0xa363('0x22')]);}_0x192797[_0xa363('0x48')]=qs['sort'](_0x1885a8[_0xa363('0x41')]['sort']);_0x192797[_0xa363('0x49')]=qs[_0xa363('0x42')](_[_0xa363('0x4a')](_0x1885a8[_0xa363('0x41')],_0x3e4ac5[_0xa363('0x42')]),_0x179713);var _0x3661ef=[];var _0x45d94d=squel[_0xa363('0x4b')]()['field']('id')[_0xa363('0x4c')]('name')[_0xa363('0x4c')]('color')['from'](_0xa363('0x4d'));var _0x5aabf2=squel[_0xa363('0x4b')]()[_0xa363('0x4c')](_0xa363('0x4e'))[_0xa363('0x4c')](_0xa363('0x4f'))['field'](_0xa363('0x50'))[_0xa363('0x51')]('user_has_fax_interactions','ui')[_0xa363('0x52')](_0xa363('0x53'),'u',_0xa363('0x54'));var _0x1d740c=squel[_0xa363('0x4b')]()[_0xa363('0x51')]('fax_interactions','i')[_0xa363('0x52')](_0xa363('0x55'),'c',_0xa363('0x56'))[_0xa363('0x52')](_0xa363('0x53'),'o',_0xa363('0x57'))[_0xa363('0x52')](_0xa363('0x58'),'a',_0xa363('0x59'))[_0xa363('0x52')](_0xa363('0x5a'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xa363('0x52')](_0xa363('0x5b'),'it','it.FaxInteractionId\x20=\x20i.id')[_0xa363('0x52')](_0xa363('0x4d'),'t',_0xa363('0x5c'));var _0x312ac4=squel[_0xa363('0x5d')]();var _0x1397d0=[];var _0x381893=squel[_0xa363('0x5d')]();var _0x3fb4e1;if(_0x1885a8[_0xa363('0x41')]['search']){_0x3fb4e1=as[_0xa363('0x5e')](_0x1885a8[_0xa363('0x41')]['search']);var _0x406d62=_0x3fb4e1['sqlOperator'];for(var _0x46782a=0x0;_0x46782a<_0x3fb4e1['conditions']['length'];_0x46782a++){var _0x288403=_0x3fb4e1[_0xa363('0x5f')][_0x46782a];var _0x3caf4b='i';var _0x42f1a2=_[_0xa363('0x60')](_0x179713,[_0xa363('0x2f'),_0x288403[_0xa363('0x4c')]]);if(!_0x42f1a2){switch(_0x288403[_0xa363('0x4c')]){case'unreadMessages':if(_0x288403[_0xa363('0x61')]==0x1){_0x1d740c[_0xa363('0x62')]('`'+_0x288403['field']+_0xa363('0x63'));}else{_0x1d740c[_0xa363('0x62')]('`'+_0x288403[_0xa363('0x4c')]+_0xa363('0x64'));}break;case _0xa363('0x65'):if(_0x288403[_0xa363('0x66')]==='$substring'){if(_0x288403[_0xa363('0x61')][_0xa363('0x35')]('\x20')[_0xa363('0x46')]>0x1){_0x312ac4[_0x406d62](_0xa363('0x67'),qs[_0xa363('0x68')](_0x288403[_0xa363('0x61')]),null);}else{var _0x3f1e2b='%'+_0x288403[_0xa363('0x61')]+'%';_0x312ac4[_0x406d62](_0xa363('0x69'),_0x3f1e2b,_0x3f1e2b,_0x3f1e2b);}}else{_0x42f1a2=_[_0xa363('0x60')](_0x179713,['name',_0xa363('0x6a')]);_0x288403[_0xa363('0x4c')]=_0xa363('0x6a');_0x44c308=as[_0xa363('0x6b')](_0x3caf4b,_0x42f1a2[_0xa363('0x3d')],_0x288403);_0x312ac4[_0x406d62](_0x44c308[_0xa363('0x6c')],_0x44c308[_0xa363('0x61')][_0xa363('0x6d')],_0x44c308['value'][_0xa363('0x21')]);}break;case _0xa363('0x6e'):var _0x7d81b4=_0x288403[_0xa363('0x61')][_0xa363('0x35')](',')[_0xa363('0x31')](function(_0x16f3b4){return Number(_0x16f3b4);});_0x7d81b4[_0xa363('0x36')](function(_0x382d61){_0x381893['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x382d61+',%');});_0x1397d0=_[_0xa363('0x6f')](_0x1397d0,_0x7d81b4);break;case'User':if(_0x288403['operator']==='$substring'){_0x312ac4[_0x406d62](_0xa363('0x70'),'%'+_0x288403[_0xa363('0x61')]+'%',null);}else{_0x42f1a2=_['find'](_0x179713,[_0xa363('0x2f'),_0xa363('0x71')]);_0x288403['field']='UserId';_0x44c308=as[_0xa363('0x6b')](_0x3caf4b,_0x42f1a2[_0xa363('0x3d')],_0x288403);_0x312ac4[_0x406d62](_0x44c308[_0xa363('0x6c')],_0x44c308['value'][_0xa363('0x6d')],_0x44c308[_0xa363('0x61')][_0xa363('0x21')]);}break;case _0xa363('0x72'):_0x44c308=as[_0xa363('0x6b')]('me',null,_0x288403);_0x312ac4[_0x406d62](_0x44c308[_0xa363('0x6c')],_0x44c308[_0xa363('0x61')][_0xa363('0x6d')],_0x44c308[_0xa363('0x61')][_0xa363('0x21')]);break;}}else{var _0x44c308=as[_0xa363('0x6b')](_0x3caf4b,_0x42f1a2[_0xa363('0x3d')],_0x288403);_0x312ac4[_0x406d62](_0x44c308['text'],_0x44c308[_0xa363('0x61')]['start'],_0x44c308[_0xa363('0x61')]['end']);}}}else{var _0x343cb8=_(_0x1885a8[_0xa363('0x41')])[_0xa363('0x40')]()[_0xa363('0x31')](function(_0x841049){return _[_0xa363('0x73')](_0x179713,[_0xa363('0x2f'),_0x841049])?_0x841049:undefined;})[_0xa363('0x74')]()[_0xa363('0x61')]();if(!_[_0xa363('0x75')](_0x343cb8)){_0x343cb8[_0xa363('0x36')](function(_0x3988d4){if(_0x3988d4===_0xa363('0x76')){_0x1d740c[_0xa363('0x49')](_0xa363('0x77'),[][_0xa363('0x78')](_0x1885a8[_0xa363('0x41')][_0x3988d4]));}else if(_0x3988d4===_0xa363('0x79')){var _0x415a58=JSON[_0xa363('0x7a')](_0x1885a8[_0xa363('0x41')][_0x3988d4])[_0xa363('0x7b')];var _0xec404b=JSON['parse'](_0x1885a8[_0xa363('0x41')][_0x3988d4])[_0xa363('0x7c')];_0x1d740c[_0xa363('0x49')](_0xa363('0x7d'),_0x415a58,_0xec404b);}else{if(_0x1885a8[_0xa363('0x41')][_0x3988d4]===_0xa363('0x7e')){_0x1d740c[_0xa363('0x49')]('i.'+_0x3988d4+_0xa363('0x7f'));}else{_0x1d740c[_0xa363('0x49')]('i.'+_0x3988d4+'\x20=\x20?',_0x1885a8[_0xa363('0x41')][_0x3988d4]);}}});}if(_0x1885a8[_0xa363('0x41')][_0xa363('0x80')]){if(_0x1885a8[_0xa363('0x41')][_0xa363('0x80')]==0x1){_0x1d740c['having']('`unreadMessages`\x20=\x200');}else{_0x1d740c[_0xa363('0x62')](_0xa363('0x81'));}}if(_0x1885a8['query'][_0xa363('0x82')]){_0x1397d0=_[_0xa363('0x83')](_0x1885a8[_0xa363('0x41')][_0xa363('0x82')])?_0x1885a8[_0xa363('0x41')]['tag']:new Array(_0x1885a8['query'][_0xa363('0x82')]);_0x1397d0['forEach'](function(_0x420472){_0x381893['or'](_0xa363('0x84'),'%,'+_0x420472+',%');});}if(_0x1885a8[_0xa363('0x41')][_0xa363('0x85')]){var _0x3daf7e=_0x1885a8[_0xa363('0x41')][_0xa363('0x85')][_0xa363('0x86')]('\x5c','\x5c\x5c')[_0xa363('0x86')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3daf7e)){_0x312ac4['or'](_0xa363('0x87'),_0x3daf7e+'%')['or'](_0xa363('0x88'),_0x3daf7e+'%');}_0x312ac4['or'](_0xa363('0x89'),_0x3daf7e+'%');}}_0x1d740c[_0xa363('0x49')](_0x312ac4);_0x1d740c['group']('i.id');var _0x47baf0={'type':db[_0xa363('0x8a')][_0xa363('0x8b')]['SELECT'],'raw':!![]};var _0x298a5a=_0x1d740c[_0xa363('0x8c')]();_0x298a5a[_0xa363('0x4c')](_0xa363('0x8d'));_0x298a5a[_0xa363('0x4c')](_0xa363('0x8e'),_0xa363('0x8f'));if(_0x192797[_0xa363('0x48')]){_0x192797[_0xa363('0x48')][_0xa363('0x36')](function(_0x270cf0){var _0x326128=_0x270cf0[0x0]===_0xa363('0x90')?_0x270cf0[0x0]:'i.'+_0x270cf0[0x0];_0x1d740c['order'](_0x326128,_0x270cf0[0x1]===_0xa363('0x91')?![]:!![]);});}if(!_['isEmpty'](_0x1397d0)){_0x1d740c[_0xa363('0x62')](_0x381893);_0x298a5a[_0xa363('0x49')](_0xa363('0x92'),_0x1397d0);}BPromise[_0xa363('0x93')]()[_0xa363('0x2c')](function(){if(!_0x3fb4e1){if(_0x1885a8[_0xa363('0x41')][_0xa363('0x76')])return;_0x298a5a[_0xa363('0x49')](_0xa363('0x94'));_0x1d740c[_0xa363('0x49')](_0xa363('0x94'));return;}if(_0x1885a8[_0xa363('0x95')][_0xa363('0x96')]!==_0xa363('0x97'))return;return _0x1885a8[_0xa363('0x95')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xa363('0x2c')](function(_0x1f0d92){if(_[_0xa363('0x75')](_0x1f0d92)){_0x298a5a['where'](_0xa363('0x98'));_0x1d740c[_0xa363('0x49')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x298a5a['where'](_0xa363('0x77'),_[_0xa363('0x31')](_0x1f0d92,'id'));_0x1d740c[_0xa363('0x49')](_0xa363('0x77'),_[_0xa363('0x31')](_0x1f0d92,'id'));}});})['then'](function(){if(_0x1885a8['user'][_0xa363('0x96')]===_0xa363('0x97')&&!_0x3fb4e1&&!_0x1885a8[_0xa363('0x41')][_0xa363('0x76')])return[];return db[_0xa363('0x99')][_0xa363('0x41')](_0x298a5a[_0xa363('0x9a')](),_0x47baf0);})[_0xa363('0x2c')](function(_0x120535){_0x471b92[_0xa363('0x24')]=_0x120535[_0xa363('0x46')];if(_0x471b92['count']===0x0)return[];return db[_0xa363('0x99')][_0xa363('0x41')](_0x45d94d[_0xa363('0x9a')](),_0x47baf0)[_0xa363('0x2c')](function(_0xc794c6){_0x3661ef=_[_0xa363('0x9b')](_0xc794c6,'id');_0x47baf0=_[_0xa363('0x9c')](_0x47baf0,{'model':db[_0xa363('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1885a8[_0xa363('0x41')][_0xa363('0x45')]){_0x192797[_0xa363('0x44')][_0xa363('0x36')](function(_0x45d933){_0x1d740c[_0xa363('0x4c')]('i.'+_0x45d933);});}else{_0x1d740c[_0xa363('0x4c')](_0xa363('0x8e'),_0xa363('0x8f'));_0x1d740c[_0xa363('0x4c')](_0xa363('0x9d'),_0xa363('0x9e'));_0x1d740c[_0xa363('0x4c')]('a.mandatoryDisposition',_0xa363('0x9f'));_0x1d740c[_0xa363('0x4c')](_0xa363('0xa0'),_0xa363('0x90'));_0x1d740c[_0xa363('0x4c')](_0xa363('0xa1'));_0x1d740c[_0xa363('0x4c')](_0xa363('0xa2'),_0xa363('0xa3'));_0x1d740c[_0xa363('0x4c')]('c.lastName',_0xa363('0xa4'));_0x1d740c['field']('c.email',_0xa363('0xa5'));_0x1d740c[_0xa363('0x4c')](_0xa363('0xa6'),_0xa363('0xa7'));_0x1d740c[_0xa363('0x4c')](_0xa363('0xa8'),_0xa363('0xa9'));_0x1d740c[_0xa363('0x4c')](_0xa363('0xaa'),'Contact.fax');_0x1d740c['field'](_0xa363('0xab'),_0xa363('0xac'));_0x1d740c[_0xa363('0x4c')](_0xa363('0xad'),_0xa363('0xae'));_0x1d740c[_0xa363('0x4c')](_0xa363('0xaf'),_0xa363('0x33'));}if(_0x192797[_0xa363('0x25')])_0x1d740c[_0xa363('0x25')](_0x192797[_0xa363('0x25')]);if(_0x192797[_0xa363('0x22')])_0x1d740c['offset'](_0x192797[_0xa363('0x22')]);return db[_0xa363('0x99')][_0xa363('0x41')](_0x1d740c[_0xa363('0x9a')](),_0x47baf0);})['then'](function(_0x56851e){if(_0x56851e[_0xa363('0x46')]>0x0)_0x5aabf2[_0xa363('0x49')](_0xa363('0xb0'),_['map'](_0x56851e,'id'));return db[_0xa363('0x99')]['query'](_0x5aabf2[_0xa363('0x9a')](),_0x47baf0)[_0xa363('0x2c')](function(_0x2757fa){var _0x400f9c=_[_0xa363('0xb1')](_0x2757fa,_0xa363('0xb2'));var _0xbb321e=[];_0x56851e[_0xa363('0x36')](function(_0x4706e1){_0xbb321e[_0xa363('0x37')](updateFaxInteraction(_0x4706e1,_0x3661ef,_0x400f9c));});return BPromise[_0xa363('0xb3')](_0xbb321e);});});})['then'](function(_0x9bd6){_0x471b92[_0xa363('0xb4')]=_0x9bd6;return _0x471b92;})[_0xa363('0x2c')](respondWithFilteredResult(_0x168e62,_0x192797))[_0xa363('0x38')](handleError(_0x168e62,null));};exports[_0xa363('0xb5')]=function(_0x38d025,_0x2fb56b){var _0x59c17d={'raw':![],'where':{'id':_0x38d025[_0xa363('0xb6')]['id']}},_0x2282ed={};_0x2282ed[_0xa363('0x3f')]=_[_0xa363('0x40')](db[_0xa363('0x3a')][_0xa363('0x3b')]);_0x2282ed['query']=_[_0xa363('0x40')](_0x38d025[_0xa363('0x41')]);_0x2282ed['filters']=_[_0xa363('0x43')](_0x2282ed[_0xa363('0x3f')],_0x2282ed[_0xa363('0x41')]);_0x59c17d['attributes']=_['intersection'](_0x2282ed['model'],qs[_0xa363('0x45')](_0x38d025[_0xa363('0x41')][_0xa363('0x45')]));_0x59c17d['attributes']=_0x59c17d[_0xa363('0x44')][_0xa363('0x46')]?_0x59c17d['attributes']:_0x2282ed['model'];if(_0x38d025['query'][_0xa363('0xb7')]){_0x59c17d['include']=[{'all':!![]}];}_0x59c17d=_[_0xa363('0x9c')]({},_0x59c17d,_0x38d025[_0xa363('0xb8')]);return db[_0xa363('0x3a')]['find'](_0x59c17d)[_0xa363('0x2c')](handleEntityNotFound(_0x2fb56b,null))['then'](respondWithResult(_0x2fb56b,null))[_0xa363('0x38')](handleError(_0x2fb56b,null));};exports[_0xa363('0xb9')]=function(_0x1074e5,_0x5b497c){return db[_0xa363('0x3a')][_0xa363('0xb9')](_0x1074e5[_0xa363('0x72')],{})[_0xa363('0x2c')](respondWithResult(_0x5b497c,0xc9))[_0xa363('0x38')](handleError(_0x5b497c,null));};exports['update']=function(_0x499986,_0x10e204){if(_0x499986[_0xa363('0x72')]['id']){delete _0x499986[_0xa363('0x72')]['id'];}return db[_0xa363('0x3a')][_0xa363('0x60')]({'where':{'id':_0x499986['params']['id']}})['then'](handleEntityNotFound(_0x10e204,null))[_0xa363('0x2c')](saveUpdates(_0x499986['body'],null))['then'](respondWithResult(_0x10e204,null))[_0xa363('0x38')](handleError(_0x10e204,null));};exports[_0xa363('0x2d')]=function(_0x4b49c1,_0x3aa069){return db['FaxInteraction']['find']({'where':{'id':_0x4b49c1[_0xa363('0xb6')]['id']}})[_0xa363('0x2c')](handleEntityNotFound(_0x3aa069,null))['then'](removeEntity(_0x3aa069,null))[_0xa363('0x38')](handleError(_0x3aa069,null));};exports['describe']=function(_0x4048c9,_0x5e60e7){return db[_0xa363('0x3a')][_0xa363('0xba')]()[_0xa363('0x2c')](respondWithResult(_0x5e60e7,null))[_0xa363('0x38')](handleError(_0x5e60e7,null));};exports[_0xa363('0xbb')]=function(_0x67c50e,_0x19dc03,_0x9351d){return db['FaxMessage'][_0xa363('0x60')]({'where':{'id':_0x67c50e[_0xa363('0xb6')]['id']}})['then'](handleEntityNotFound(_0x19dc03,null))['then'](function(_0x22520a){if(_0x22520a){return _0x22520a['addMessage'](_0x67c50e['body']['ids'],_['omit'](_0x67c50e[_0xa363('0x72')],[_0xa363('0xbc'),'id'])||{});}})[_0xa363('0x2c')](respondWithResult(_0x19dc03,null))[_0xa363('0x38')](handleError(_0x19dc03,null));};exports[_0xa363('0xbd')]=function(_0x51f548,_0x35b789,_0x47ab22){var _0x49e301={'raw':![],'where':{}};var _0x1e4937={};var _0x28543b={'count':0x0,'rows':[]};return db[_0xa363('0x3a')][_0xa363('0xbe')]({'where':{'id':_0x51f548[_0xa363('0xb6')]['id']}})['then'](handleEntityNotFound(_0x35b789,null))[_0xa363('0x2c')](function(_0x365cc0){if(_0x365cc0){_0x1e4937[_0xa363('0x3f')]=_['keys'](db[_0xa363('0xbf')]['rawAttributes']);_0x1e4937[_0xa363('0x41')]=_[_0xa363('0x40')](_0x51f548[_0xa363('0x41')]);_0x1e4937['filters']=_[_0xa363('0x43')](_0x1e4937['model'],_0x1e4937[_0xa363('0x41')]);_0x49e301[_0xa363('0x44')]=_[_0xa363('0x43')](_0x1e4937[_0xa363('0x3f')],qs['fields'](_0x51f548['query'][_0xa363('0x45')]));_0x49e301['attributes']=_0x49e301['attributes'][_0xa363('0x46')]?_0x49e301[_0xa363('0x44')]:_0x1e4937[_0xa363('0x3f')];if(!_0x51f548['query'][_0xa363('0x47')](_0xa363('0xc0'))){_0x49e301[_0xa363('0x25')]=qs[_0xa363('0x25')](_0x51f548[_0xa363('0x41')]['limit']);_0x49e301['offset']=qs[_0xa363('0x22')](_0x51f548[_0xa363('0x41')]['offset']);}_0x49e301['order']=qs['sort'](_0x51f548[_0xa363('0x41')][_0xa363('0xc1')]);_0x49e301[_0xa363('0x49')]=qs['filters'](_['pick'](_0x51f548['query'],_0x1e4937[_0xa363('0x42')]));_0x49e301[_0xa363('0x49')][_0xa363('0xb2')]=_0x365cc0['id'];if(_0x51f548[_0xa363('0x41')][_0xa363('0x85')]){_0x49e301[_0xa363('0x49')]=_[_0xa363('0x9c')](_0x49e301[_0xa363('0x49')],{'$or':_['map'](_0x49e301['attributes'],function(_0x3be759){var _0x1d4d9e={};_0x1d4d9e[_0x3be759]={'$like':'%'+_0x51f548[_0xa363('0x41')][_0xa363('0x85')]+'%'};return _0x1d4d9e;})});}if(_0x51f548[_0xa363('0x41')][_0xa363('0x7b')]){var _0x380306=_0x51f548[_0xa363('0x41')][_0xa363('0x7b')][_0xa363('0x35')](',');var _0x1c83ff={};_0x1c83ff[_0x380306[0x0]]={'$gte':moment(_0x380306[0x1])[_0xa363('0xc2')](_0xa363('0xc3'))};_0x49e301[_0xa363('0x49')]=_[_0xa363('0x9c')](_0x49e301[_0xa363('0x49')],_0x1c83ff);}_0x49e301=_[_0xa363('0x9c')]({},_0x49e301,_0x51f548[_0xa363('0xb8')]);return db[_0xa363('0xbf')][_0xa363('0x24')]({'where':_0x49e301[_0xa363('0x49')]})['then'](function(_0x505638){_0x28543b[_0xa363('0x24')]=_0x505638;if(_0x51f548['query'][_0xa363('0xb7')]){_0x49e301['include']=[{'all':!![]}];}return db[_0xa363('0xbf')][_0xa363('0xc4')](_0x49e301);})[_0xa363('0x2c')](function(_0x199770){_0x28543b['rows']=_0x199770;return _0x28543b;});}})[_0xa363('0x2c')](respondWithFilteredResult(_0x35b789,_0x49e301))[_0xa363('0x38')](handleError(_0x35b789,null));};exports['addTags']=function(_0x2d4edd,_0x4c6e8f,_0x507d54){return db[_0xa363('0x3a')][_0xa363('0x60')]({'where':{'id':_0x2d4edd[_0xa363('0xb6')]['id']}})[_0xa363('0x2c')](handleEntityNotFound(_0x4c6e8f,null))[_0xa363('0x2c')](function(_0x5ddabe){if(_0x5ddabe){return _0x5ddabe[_0xa363('0xc5')](_0x2d4edd[_0xa363('0x72')][_0xa363('0xbc')],_['omit'](_0x2d4edd[_0xa363('0x72')],[_0xa363('0xbc'),'id'])||{})[_0xa363('0xc6')](function(){return db[_0xa363('0x6e')][_0xa363('0xc4')]({'attributes':['id',_0xa363('0x2f'),_0xa363('0xc7')],'where':{'id':_0x2d4edd[_0xa363('0x72')]['ids']}});})[_0xa363('0x2c')](function(_0x58ddc0){socket[_0xa363('0xc8')](_0xa363('0xc9'),{'id':Number(_0x2d4edd[_0xa363('0xb6')]['id']),'tags':_0x58ddc0||[]});return{'id':Number(_0x2d4edd[_0xa363('0xb6')]['id']),'tags':_0x58ddc0||[]};});}})[_0xa363('0x2c')](respondWithResult(_0x4c6e8f,null))[_0xa363('0x38')](handleError(_0x4c6e8f,null));};exports[_0xa363('0xca')]=function(_0x277301,_0x1787ab,_0x469584){return db['FaxInteraction']['find']({'where':{'id':_0x277301['params']['id']}})['then'](handleEntityNotFound(_0x1787ab,null))['then'](function(_0x138c38){if(_0x138c38){return _0x138c38[_0xa363('0xca')](_0x277301[_0xa363('0x41')][_0xa363('0xbc')]);}})['then'](respondWithStatusCode(_0x1787ab,null))[_0xa363('0x38')](handleError(_0x1787ab,null));};exports[_0xa363('0xcb')]=function(_0x443a7a,_0x4b4b97){var _0x385bb0=moment()['unix']()[_0xa363('0x9a')]();var _0x378332=path['join'](config[_0xa363('0xcc')],_0xa363('0xcd'),_0xa363('0xce'),_0xa363('0xcf'));var _0x540e64=path['join'](config[_0xa363('0xcc')],'server',_0xa363('0xce'),_0xa363('0xd0'));var _0x2bdfc2=path[_0xa363('0xd1')](_0x378332,_0x385bb0);var _0x34e5b3=util[_0xa363('0xc2')](_0xa363('0xd2'),_0x443a7a[_0xa363('0xb6')]['id'],_0x385bb0);var _0x242c8c=path[_0xa363('0xd1')](_0x378332,_0x34e5b3);var _0x55ac86=[];_0x55ac86[_0xa363('0x37')]({'model':db[_0xa363('0xd3')],'as':_0xa363('0xd3'),'raw':!![]});var _0x579d2a=[{'model':db[_0xa363('0xbf')],'as':_0xa363('0xd4'),'attributes':['id',_0xa363('0x72'),_0xa363('0x79')],'include':_0x55ac86}];return db['FaxInteraction'][_0xa363('0x60')]({'where':{'id':_0x443a7a[_0xa363('0xb6')]['id']},'include':_0x579d2a})[_0xa363('0x2c')](handleEntityNotFound(_0x4b4b97,null))[_0xa363('0x2c')](function(_0x12138d){if(_0x12138d&&_0x12138d[_0xa363('0xd4')]){var _0x296f2a=_0x12138d[_0xa363('0xd5')]({'plain':!![]});fs[_0xa363('0xd6')](_0x2bdfc2);for(var _0x2f5e87=0x0;_0x2f5e87<_0x296f2a[_0xa363('0xd4')][_0xa363('0x46')];_0x2f5e87++){var _0x18736c=_0x296f2a[_0xa363('0xd4')][_0x2f5e87]['Attachment'];if(_0x18736c){var _0x2a63e4=path['join'](_0x540e64,_0x18736c[_0xa363('0xd7')]);if(fs[_0xa363('0xd8')](_0x2a63e4)){fs[_0xa363('0xd9')](_0x2a63e4)[_0xa363('0xda')](fs[_0xa363('0xdb')](path[_0xa363('0xd1')](_0x2bdfc2,_0x18736c[_0xa363('0xd7')])));}}}return BPromise[_0xa363('0x93')]()[_0xa363('0x2c')](function(){return new BPromise(function(_0xaf938c,_0xd6f7ed){zipdir(_0x2bdfc2,{'saveTo':_0x242c8c},function(_0x26df25,_0x2511c9){if(_0x26df25)return _0xd6f7ed(_0x26df25);return _0xaf938c(_0x2511c9);});})[_0xa363('0x2c')](function(){return new BPromise(function(_0x1fd64a,_0x412da7){rimraf(_0x2bdfc2,function(_0x48c195){if(_0x48c195)_0x412da7(_0x48c195);return _0x1fd64a();});});})[_0xa363('0x2c')](function(){return _0x4b4b97[_0xa363('0xcb')](_0x242c8c,_0x34e5b3,function(_0x20d634){if(_0x20d634){console['log'](_0xa363('0xdc'),_0x20d634);}else{fs[_0xa363('0xdd')](_0x242c8c);}});});});}else{return _0x4b4b97[_0xa363('0x1f')](0xc8);}})[_0xa363('0x38')](handleError(_0x4b4b97,null));}; \ No newline at end of file +var _0xa6ce=['to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','json','reject','save','update','then','error','name','send','fullname','TagIds','Tags','split','forEach','push','catch','index','map','FaxInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','select','field','from','tools_tags','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','end','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','i.FaxAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','includeAll','include','options','create','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','err','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','ejs','squel','crypto','jsforce','desk.js'];(function(_0x445b7e,_0x3ea85f){var _0x17d997=function(_0x805f31){while(--_0x805f31){_0x445b7e['push'](_0x445b7e['shift']());}};_0x17d997(++_0x3ea85f);}(_0xa6ce,0xc9));var _0xea6c=function(_0x4702ee,_0xaf6a45){_0x4702ee=_0x4702ee-0x0;var _0x62ca7d=_0xa6ce[_0x4702ee];return _0x62ca7d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea6c('0x0'));var zipdir=require(_0xea6c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea6c('0x2'));var moment=require(_0xea6c('0x3'));var BPromise=require(_0xea6c('0x4'));var Mustache=require('mustache');var util=require(_0xea6c('0x5'));var path=require('path');var sox=require(_0xea6c('0x6'));var csv=require('to-csv');var ejs=require(_0xea6c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xea6c('0x8'));var crypto=require(_0xea6c('0x9'));var jsforce=require(_0xea6c('0xa'));var deskjs=require(_0xea6c('0xb'));var toCsv=require(_0xea6c('0xc'));var querystring=require(_0xea6c('0xd'));var Papa=require(_0xea6c('0xe'));var Redis=require('ioredis');var authService=require(_0xea6c('0xf'));var qs=require(_0xea6c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xea6c('0x11'));var logger=require('../../config/logger')(_0xea6c('0x12'));var utils=require(_0xea6c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xea6c('0x14'));var db=require(_0xea6c('0x15'))['db'];config[_0xea6c('0x16')]=_[_0xea6c('0x17')](config[_0xea6c('0x16')],{'host':_0xea6c('0x18'),'port':0x18eb});var socket=require(_0xea6c('0x19'))(new Redis(config[_0xea6c('0x16')]));require(_0xea6c('0x1a'))[_0xea6c('0x1b')](socket);function respondWithStatusCode(_0x26adb1,_0x1bbfae){_0x1bbfae=_0x1bbfae||0xcc;return function(_0x2bdda6){if(_0x2bdda6){return _0x26adb1[_0xea6c('0x1c')](_0x1bbfae);}return _0x26adb1[_0xea6c('0x1d')](_0x1bbfae)['end']();};}function respondWithResult(_0x7809b4,_0x339918){_0x339918=_0x339918||0xc8;return function(_0x428998){if(_0x428998){return _0x7809b4[_0xea6c('0x1d')](_0x339918)['json'](_0x428998);}};}function respondWithFilteredResult(_0x20ec89,_0x3398c8){return function(_0x4770ad){if(_0x4770ad){var _0x336cd3=typeof _0x3398c8[_0xea6c('0x1e')]===_0xea6c('0x1f')&&typeof _0x3398c8[_0xea6c('0x20')]===_0xea6c('0x1f');var _0x504cc3=_0x4770ad[_0xea6c('0x21')];var _0x4a07e0=_0x336cd3?0x0:_0x3398c8[_0xea6c('0x1e')];var _0x2ab5e1=_0x336cd3?_0x4770ad['count']:_0x3398c8[_0xea6c('0x1e')]+_0x3398c8[_0xea6c('0x20')];var _0xf24ae4;if(_0x2ab5e1>=_0x504cc3){_0x2ab5e1=_0x504cc3;_0xf24ae4=0xc8;}else{_0xf24ae4=0xce;}_0x20ec89[_0xea6c('0x1d')](_0xf24ae4);return _0x20ec89['set']('Content-Range',_0x4a07e0+'-'+_0x2ab5e1+'/'+_0x504cc3)[_0xea6c('0x22')](_0x4770ad);}return null;};}function patchUpdates(_0x34a803){return function(_0x56f5a8){try{jsonpatch['apply'](_0x56f5a8,_0x34a803,!![]);}catch(_0x3cf3df){return BPromise[_0xea6c('0x23')](_0x3cf3df);}return _0x56f5a8[_0xea6c('0x24')]();};}function saveUpdates(_0x1ee267,_0x5d2d3d){return function(_0x549ae7){if(_0x549ae7){return _0x549ae7[_0xea6c('0x25')](_0x1ee267)[_0xea6c('0x26')](function(_0x1a6965){return _0x1a6965;});}return null;};}function removeEntity(_0x2233db,_0x3ecdb9){return function(_0x3e3d6d){if(_0x3e3d6d){return _0x3e3d6d['destroy']()[_0xea6c('0x26')](function(){_0x2233db['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cf5b5,_0x32cd9e){return function(_0xd72bbe){if(!_0xd72bbe){_0x4cf5b5[_0xea6c('0x1c')](0x194);}return _0xd72bbe;};}function handleError(_0x497149,_0x2c8293){_0x2c8293=_0x2c8293||0x1f4;return function(_0x5eefd6){logger[_0xea6c('0x27')](_0x5eefd6['stack']);if(_0x5eefd6['name']){delete _0x5eefd6[_0xea6c('0x28')];}_0x497149[_0xea6c('0x1d')](_0x2c8293)[_0xea6c('0x29')](_0x5eefd6);};}function getInteractionUsers(_0x42ddfe,_0x5f4e87){return new BPromise(function(_0x5a1d3f,_0x373517){try{if(_0x5f4e87[_0x42ddfe['id']]){_0x42ddfe['Users']=_['map'](_0x5f4e87[_0x42ddfe['id']],function(_0x3d1c70){return{'id':_0x3d1c70['id'],'fullname':_0x3d1c70[_0xea6c('0x2a')]};});}}catch(_0x2a753a){_0x373517(_0x2a753a);}_0x5a1d3f(_0x42ddfe);});}function getInteractionTags(_0x58e775,_0x3866cb){return new BPromise(function(_0x2cdf0f,_0x2bdb17){try{if(_0x58e775[_0xea6c('0x2b')]){_0x58e775[_0xea6c('0x2c')]=[];_0x58e775[_0xea6c('0x2b')][_0xea6c('0x2d')](',')[_0xea6c('0x2e')](function(_0x212ccc){_0x58e775['Tags'][_0xea6c('0x2f')](_0x3866cb[_0x212ccc]);});}delete _0x58e775[_0xea6c('0x2b')];}catch(_0x2a87e1){_0x2bdb17(_0x2a87e1);}_0x2cdf0f(_0x58e775);});}function updateFaxInteraction(_0x43b112,_0x4974e9,_0x192296){return new BPromise(function(_0x48d892,_0x30cca8){return getInteractionUsers(_0x43b112,_0x192296)[_0xea6c('0x26')](function(_0x40a06f){return getInteractionTags(_0x40a06f,_0x4974e9);})['then'](function(_0x1ae659){_0x48d892(_0x1ae659);})[_0xea6c('0x30')](function(_0x54a647){_0x30cca8(_0x54a647);});});}exports[_0xea6c('0x31')]=function(_0x53d4a3,_0x41e796){var _0x53eab0={},_0x4842c8={},_0x3882b9={'count':0x0,'rows':[]};var _0x4112ab=_[_0xea6c('0x32')](db[_0xea6c('0x33')][_0xea6c('0x34')],function(_0x26d23b){return{'name':_0x26d23b[_0xea6c('0x35')],'type':_0x26d23b[_0xea6c('0x36')][_0xea6c('0x37')]};});_0x4842c8[_0xea6c('0x38')]=_[_0xea6c('0x32')](_0x4112ab,_0xea6c('0x28'));_0x4842c8['query']=_[_0xea6c('0x39')](_0x53d4a3[_0xea6c('0x3a')]);_0x4842c8[_0xea6c('0x3b')]=_[_0xea6c('0x3c')](_0x4842c8[_0xea6c('0x38')],_0x4842c8[_0xea6c('0x3a')]);_0x53eab0[_0xea6c('0x3d')]=_['intersection'](_0x4842c8[_0xea6c('0x38')],qs[_0xea6c('0x3e')](_0x53d4a3[_0xea6c('0x3a')]['fields']));_0x53eab0[_0xea6c('0x3d')]=_0x53eab0[_0xea6c('0x3d')][_0xea6c('0x3f')]?_0x53eab0[_0xea6c('0x3d')]:_0x4842c8[_0xea6c('0x38')];if(!_0x53d4a3['query']['hasOwnProperty']('nolimit')){_0x53eab0[_0xea6c('0x20')]=qs[_0xea6c('0x20')](_0x53d4a3[_0xea6c('0x3a')][_0xea6c('0x20')]);_0x53eab0[_0xea6c('0x1e')]=qs[_0xea6c('0x1e')](_0x53d4a3['query']['offset']);}_0x53eab0[_0xea6c('0x40')]=qs[_0xea6c('0x41')](_0x53d4a3['query'][_0xea6c('0x41')]);_0x53eab0[_0xea6c('0x42')]=qs[_0xea6c('0x3b')](_[_0xea6c('0x43')](_0x53d4a3['query'],_0x4842c8[_0xea6c('0x3b')]),_0x4112ab);var _0x19b0d0=[];var _0x9d1442=squel[_0xea6c('0x44')]()[_0xea6c('0x45')]('id')[_0xea6c('0x45')](_0xea6c('0x28'))['field']('color')[_0xea6c('0x46')](_0xea6c('0x47'));var _0x51fe6e=squel['select']()[_0xea6c('0x45')]('u.id')[_0xea6c('0x45')](_0xea6c('0x48'))[_0xea6c('0x45')](_0xea6c('0x49'))[_0xea6c('0x46')](_0xea6c('0x4a'),'ui')[_0xea6c('0x4b')](_0xea6c('0x4c'),'u',_0xea6c('0x4d'));var _0x172268=squel[_0xea6c('0x44')]()[_0xea6c('0x46')](_0xea6c('0x4e'),'i')[_0xea6c('0x4b')](_0xea6c('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xea6c('0x4b')](_0xea6c('0x4c'),'o',_0xea6c('0x50'))[_0xea6c('0x4b')]('fax_accounts','a',_0xea6c('0x51'))['left_join']('fax_messages','me',_0xea6c('0x52'))[_0xea6c('0x4b')](_0xea6c('0x53'),'it',_0xea6c('0x54'))[_0xea6c('0x4b')](_0xea6c('0x47'),'t','t.id\x20=\x20it.TagId');var _0x3c8675=squel['expr']();var _0x186015=[];var _0x2f20ec=squel[_0xea6c('0x55')]();var _0x3996dc;if(_0x53d4a3['query'][_0xea6c('0x56')]){_0x3996dc=as[_0xea6c('0x57')](_0x53d4a3[_0xea6c('0x3a')][_0xea6c('0x56')]);var _0x334a89=_0x3996dc[_0xea6c('0x58')];for(var _0x413662=0x0;_0x413662<_0x3996dc[_0xea6c('0x59')][_0xea6c('0x3f')];_0x413662++){var _0x55a886=_0x3996dc[_0xea6c('0x59')][_0x413662];var _0x5d54b4='i';var _0xd15cb8=_[_0xea6c('0x5a')](_0x4112ab,[_0xea6c('0x28'),_0x55a886['field']]);if(!_0xd15cb8){switch(_0x55a886[_0xea6c('0x45')]){case'unreadMessages':if(_0x55a886[_0xea6c('0x5b')]==0x1){_0x172268[_0xea6c('0x5c')]('`'+_0x55a886['field']+_0xea6c('0x5d'));}else{_0x172268[_0xea6c('0x5c')]('`'+_0x55a886[_0xea6c('0x45')]+_0xea6c('0x5e'));}break;case _0xea6c('0x5f'):if(_0x55a886[_0xea6c('0x60')]===_0xea6c('0x61')){if(_0x55a886['value'][_0xea6c('0x2d')]('\x20')[_0xea6c('0x3f')]>0x1){_0x3c8675[_0x334a89](_0xea6c('0x62'),qs[_0xea6c('0x63')](_0x55a886[_0xea6c('0x5b')]),null);}else{var _0x28047a='%'+_0x55a886[_0xea6c('0x5b')]+'%';_0x3c8675[_0x334a89](_0xea6c('0x64'),_0x28047a,_0x28047a,_0x28047a);}}else{_0xd15cb8=_['find'](_0x4112ab,[_0xea6c('0x28'),'ContactId']);_0x55a886['field']=_0xea6c('0x65');_0x320640=as[_0xea6c('0x66')](_0x5d54b4,_0xd15cb8[_0xea6c('0x36')],_0x55a886);_0x3c8675[_0x334a89](_0x320640[_0xea6c('0x67')],_0x320640[_0xea6c('0x5b')][_0xea6c('0x68')],_0x320640[_0xea6c('0x5b')][_0xea6c('0x69')]);}break;case'Tag':var _0x3a9694=_0x55a886[_0xea6c('0x5b')]['split'](',')[_0xea6c('0x32')](function(_0x46ab87){return Number(_0x46ab87);});_0x3a9694[_0xea6c('0x2e')](function(_0x3ddb01){_0x2f20ec['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3ddb01+',%');});_0x186015=_['union'](_0x186015,_0x3a9694);break;case _0xea6c('0x6a'):if(_0x55a886[_0xea6c('0x60')]===_0xea6c('0x61')){_0x3c8675[_0x334a89](_0xea6c('0x6b'),'%'+_0x55a886[_0xea6c('0x5b')]+'%',null);}else{_0xd15cb8=_[_0xea6c('0x5a')](_0x4112ab,[_0xea6c('0x28'),_0xea6c('0x6c')]);_0x55a886[_0xea6c('0x45')]='UserId';_0x320640=as['buildExpression'](_0x5d54b4,_0xd15cb8[_0xea6c('0x36')],_0x55a886);_0x3c8675[_0x334a89](_0x320640[_0xea6c('0x67')],_0x320640[_0xea6c('0x5b')][_0xea6c('0x68')],_0x320640[_0xea6c('0x5b')][_0xea6c('0x69')]);}break;case _0xea6c('0x6d'):_0x320640=as[_0xea6c('0x66')]('me',null,_0x55a886);_0x3c8675[_0x334a89](_0x320640[_0xea6c('0x67')],_0x320640[_0xea6c('0x5b')]['start'],_0x320640[_0xea6c('0x5b')][_0xea6c('0x69')]);break;}}else{var _0x320640=as['buildExpression'](_0x5d54b4,_0xd15cb8['type'],_0x55a886);_0x3c8675[_0x334a89](_0x320640['text'],_0x320640['value'][_0xea6c('0x68')],_0x320640[_0xea6c('0x5b')][_0xea6c('0x69')]);}}}else{var _0x39b2cb=_(_0x53d4a3['query'])[_0xea6c('0x39')]()['map'](function(_0x328fea){return _[_0xea6c('0x6e')](_0x4112ab,['name',_0x328fea])?_0x328fea:undefined;})[_0xea6c('0x6f')]()[_0xea6c('0x5b')]();if(!_[_0xea6c('0x70')](_0x39b2cb)){_0x39b2cb[_0xea6c('0x2e')](function(_0x59a034){if(_0x59a034===_0xea6c('0x71')){_0x172268['where'](_0xea6c('0x72'),[]['concat'](_0x53d4a3[_0xea6c('0x3a')][_0x59a034]));}else if(_0x59a034===_0xea6c('0x73')){var _0x247646=JSON['parse'](_0x53d4a3[_0xea6c('0x3a')][_0x59a034])[_0xea6c('0x74')];var _0x408d8d=JSON['parse'](_0x53d4a3['query'][_0x59a034])[_0xea6c('0x75')];_0x172268[_0xea6c('0x42')](_0xea6c('0x76'),_0x247646,_0x408d8d);}else{if(_0x53d4a3['query'][_0x59a034]===_0xea6c('0x77')){_0x172268[_0xea6c('0x42')]('i.'+_0x59a034+'\x20IS\x20NULL');}else{_0x172268[_0xea6c('0x42')]('i.'+_0x59a034+_0xea6c('0x78'),_0x53d4a3[_0xea6c('0x3a')][_0x59a034]);}}});}if(_0x53d4a3['query']['read']){if(_0x53d4a3[_0xea6c('0x3a')]['read']==0x1){_0x172268[_0xea6c('0x5c')]('`unreadMessages`\x20=\x200');}else{_0x172268[_0xea6c('0x5c')](_0xea6c('0x79'));}}if(_0x53d4a3['query'][_0xea6c('0x7a')]){_0x186015=_[_0xea6c('0x7b')](_0x53d4a3[_0xea6c('0x3a')][_0xea6c('0x7a')])?_0x53d4a3[_0xea6c('0x3a')][_0xea6c('0x7a')]:new Array(_0x53d4a3[_0xea6c('0x3a')][_0xea6c('0x7a')]);_0x186015[_0xea6c('0x2e')](function(_0x40e7cb){_0x2f20ec['or'](_0xea6c('0x7c'),'%,'+_0x40e7cb+',%');});}if(_0x53d4a3['query'][_0xea6c('0x7d')]){var _0x9b8464=_0x53d4a3['query'][_0xea6c('0x7d')]['replace']('\x5c','\x5c\x5c')[_0xea6c('0x7e')](/'/g,'\x27\x27');if(qs[_0xea6c('0x7f')](_0x9b8464)){_0x3c8675['or'](_0xea6c('0x80'),_0x9b8464+'%')['or']('i.fax\x20LIKE\x20?',_0x9b8464+'%');}_0x3c8675['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x9b8464+'%');}}_0x172268[_0xea6c('0x42')](_0x3c8675);_0x172268[_0xea6c('0x81')](_0xea6c('0x82'));var _0x509fc3={'type':db[_0xea6c('0x83')][_0xea6c('0x84')]['SELECT'],'raw':!![]};var _0x586b60=_0x172268['clone']();_0x586b60[_0xea6c('0x45')](_0xea6c('0x82'));_0x586b60[_0xea6c('0x45')](_0xea6c('0x85'),_0xea6c('0x86'));if(_0x53eab0[_0xea6c('0x40')]){_0x53eab0[_0xea6c('0x40')][_0xea6c('0x2e')](function(_0x5a5e58){var _0x1efb47=_0x5a5e58[0x0]===_0xea6c('0x87')?_0x5a5e58[0x0]:'i.'+_0x5a5e58[0x0];_0x172268[_0xea6c('0x40')](_0x1efb47,_0x5a5e58[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x186015)){_0x172268[_0xea6c('0x5c')](_0x2f20ec);_0x586b60['where'](_0xea6c('0x88'),_0x186015);}BPromise[_0xea6c('0x89')]()[_0xea6c('0x26')](function(){if(!_0x3996dc){if(_0x53d4a3[_0xea6c('0x3a')]['FaxAccountId'])return;_0x586b60[_0xea6c('0x42')](_0xea6c('0x8a'));_0x172268[_0xea6c('0x42')](_0xea6c('0x8a'));return;}if(_0x53d4a3[_0xea6c('0x8b')][_0xea6c('0x8c')]!=='agent')return;return _0x53d4a3[_0xea6c('0x8b')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x105a11){if(_['isEmpty'](_0x105a11)){_0x586b60[_0xea6c('0x42')](_0xea6c('0x8d'));_0x172268[_0xea6c('0x42')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x586b60[_0xea6c('0x42')](_0xea6c('0x72'),_['map'](_0x105a11,'id'));_0x172268[_0xea6c('0x42')](_0xea6c('0x72'),_['map'](_0x105a11,'id'));}});})[_0xea6c('0x26')](function(){if(_0x53d4a3[_0xea6c('0x8b')][_0xea6c('0x8c')]===_0xea6c('0x8e')&&!_0x3996dc&&!_0x53d4a3[_0xea6c('0x3a')]['FaxAccountId'])return[];return db[_0xea6c('0x8f')][_0xea6c('0x3a')](_0x586b60[_0xea6c('0x90')](),_0x509fc3);})[_0xea6c('0x26')](function(_0x492659){_0x3882b9[_0xea6c('0x21')]=_0x492659['length'];if(_0x3882b9[_0xea6c('0x21')]===0x0)return[];return db[_0xea6c('0x8f')][_0xea6c('0x3a')](_0x9d1442[_0xea6c('0x90')](),_0x509fc3)['then'](function(_0x505980){_0x19b0d0=_[_0xea6c('0x91')](_0x505980,'id');_0x509fc3=_[_0xea6c('0x92')](_0x509fc3,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x53d4a3[_0xea6c('0x3a')][_0xea6c('0x3e')]){_0x53eab0[_0xea6c('0x3d')][_0xea6c('0x2e')](function(_0x37539a){_0x172268['field']('i.'+_0x37539a);});}else{_0x172268[_0xea6c('0x45')](_0xea6c('0x85'),_0xea6c('0x86'));_0x172268[_0xea6c('0x45')]('a.key',_0xea6c('0x93'));_0x172268['field'](_0xea6c('0x94'),_0xea6c('0x95'));_0x172268[_0xea6c('0x45')](_0xea6c('0x96'),_0xea6c('0x87'));_0x172268[_0xea6c('0x45')](_0xea6c('0x97'));_0x172268[_0xea6c('0x45')](_0xea6c('0x98'),_0xea6c('0x99'));_0x172268[_0xea6c('0x45')](_0xea6c('0x9a'),_0xea6c('0x9b'));_0x172268[_0xea6c('0x45')](_0xea6c('0x9c'),_0xea6c('0x9d'));_0x172268[_0xea6c('0x45')](_0xea6c('0x9e'),'Contact.phone');_0x172268[_0xea6c('0x45')]('c.mobile',_0xea6c('0x9f'));_0x172268[_0xea6c('0x45')](_0xea6c('0xa0'),_0xea6c('0xa1'));_0x172268[_0xea6c('0x45')](_0xea6c('0xa2'),_0xea6c('0xa3'));_0x172268[_0xea6c('0x45')](_0xea6c('0xa4'),_0xea6c('0xa5'));_0x172268['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x53eab0[_0xea6c('0x20')])_0x172268[_0xea6c('0x20')](_0x53eab0[_0xea6c('0x20')]);if(_0x53eab0['offset'])_0x172268[_0xea6c('0x1e')](_0x53eab0['offset']);return db[_0xea6c('0x8f')][_0xea6c('0x3a')](_0x172268[_0xea6c('0x90')](),_0x509fc3);})['then'](function(_0x6cea79){if(_0x6cea79[_0xea6c('0x3f')]>0x0)_0x51fe6e[_0xea6c('0x42')](_0xea6c('0xa6'),_['map'](_0x6cea79,'id'));return db['sequelize'][_0xea6c('0x3a')](_0x51fe6e['toString'](),_0x509fc3)[_0xea6c('0x26')](function(_0x360846){var _0xed07bd=_[_0xea6c('0xa7')](_0x360846,_0xea6c('0xa8'));var _0x25915b=[];_0x6cea79[_0xea6c('0x2e')](function(_0xf815d3){_0x25915b['push'](updateFaxInteraction(_0xf815d3,_0x19b0d0,_0xed07bd));});return BPromise[_0xea6c('0xa9')](_0x25915b);});});})[_0xea6c('0x26')](function(_0x3c2fc7){_0x3882b9[_0xea6c('0xaa')]=_0x3c2fc7;return _0x3882b9;})[_0xea6c('0x26')](respondWithFilteredResult(_0x41e796,_0x53eab0))[_0xea6c('0x30')](handleError(_0x41e796,null));};exports[_0xea6c('0xab')]=function(_0x5ebb78,_0x55cdae){var _0x59d031={'raw':![],'where':{'id':_0x5ebb78[_0xea6c('0xac')]['id']}},_0x27396f={};_0x27396f[_0xea6c('0x38')]=_[_0xea6c('0x39')](db[_0xea6c('0x33')][_0xea6c('0x34')]);_0x27396f[_0xea6c('0x3a')]=_[_0xea6c('0x39')](_0x5ebb78[_0xea6c('0x3a')]);_0x27396f[_0xea6c('0x3b')]=_['intersection'](_0x27396f['model'],_0x27396f[_0xea6c('0x3a')]);_0x59d031['attributes']=_[_0xea6c('0x3c')](_0x27396f[_0xea6c('0x38')],qs['fields'](_0x5ebb78[_0xea6c('0x3a')][_0xea6c('0x3e')]));_0x59d031[_0xea6c('0x3d')]=_0x59d031['attributes'][_0xea6c('0x3f')]?_0x59d031[_0xea6c('0x3d')]:_0x27396f[_0xea6c('0x38')];if(_0x5ebb78[_0xea6c('0x3a')][_0xea6c('0xad')]){_0x59d031[_0xea6c('0xae')]=[{'all':!![]}];}_0x59d031=_['merge']({},_0x59d031,_0x5ebb78[_0xea6c('0xaf')]);return db[_0xea6c('0x33')][_0xea6c('0x5a')](_0x59d031)[_0xea6c('0x26')](handleEntityNotFound(_0x55cdae,null))[_0xea6c('0x26')](respondWithResult(_0x55cdae,null))[_0xea6c('0x30')](handleError(_0x55cdae,null));};exports[_0xea6c('0xb0')]=function(_0x3464cb,_0x4e664a){return db[_0xea6c('0x33')]['create'](_0x3464cb[_0xea6c('0x6d')],{})[_0xea6c('0x26')](respondWithResult(_0x4e664a,0xc9))['catch'](handleError(_0x4e664a,null));};exports['update']=function(_0xd6477a,_0x35cba5){if(_0xd6477a[_0xea6c('0x6d')]['id']){delete _0xd6477a[_0xea6c('0x6d')]['id'];}return db[_0xea6c('0x33')][_0xea6c('0x5a')]({'where':{'id':_0xd6477a[_0xea6c('0xac')]['id']}})[_0xea6c('0x26')](handleEntityNotFound(_0x35cba5,null))[_0xea6c('0x26')](saveUpdates(_0xd6477a[_0xea6c('0x6d')],null))[_0xea6c('0x26')](respondWithResult(_0x35cba5,null))[_0xea6c('0x30')](handleError(_0x35cba5,null));};exports[_0xea6c('0xb1')]=function(_0x488cec,_0x2dafa8){return db['FaxInteraction'][_0xea6c('0x5a')]({'where':{'id':_0x488cec[_0xea6c('0xac')]['id']}})[_0xea6c('0x26')](handleEntityNotFound(_0x2dafa8,null))[_0xea6c('0x26')](removeEntity(_0x2dafa8,null))[_0xea6c('0x30')](handleError(_0x2dafa8,null));};exports[_0xea6c('0xb2')]=function(_0x1839c7,_0x429d4f){return db['FaxInteraction']['describe']()[_0xea6c('0x26')](respondWithResult(_0x429d4f,null))[_0xea6c('0x30')](handleError(_0x429d4f,null));};exports[_0xea6c('0xb3')]=function(_0x4512ed,_0x1527e6,_0x1381cd){return db[_0xea6c('0xb4')][_0xea6c('0x5a')]({'where':{'id':_0x4512ed[_0xea6c('0xac')]['id']}})['then'](handleEntityNotFound(_0x1527e6,null))['then'](function(_0x427e9a){if(_0x427e9a){return _0x427e9a[_0xea6c('0xb3')](_0x4512ed[_0xea6c('0x6d')][_0xea6c('0xb5')],_[_0xea6c('0xb6')](_0x4512ed[_0xea6c('0x6d')],[_0xea6c('0xb5'),'id'])||{});}})[_0xea6c('0x26')](respondWithResult(_0x1527e6,null))[_0xea6c('0x30')](handleError(_0x1527e6,null));};exports[_0xea6c('0xb7')]=function(_0x2174cb,_0x2e6d0a,_0x37159c){var _0x2a260c={'raw':![],'where':{}};var _0x507ba3={};var _0x14cf4d={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xea6c('0xb8')]({'where':{'id':_0x2174cb['params']['id']}})[_0xea6c('0x26')](handleEntityNotFound(_0x2e6d0a,null))[_0xea6c('0x26')](function(_0x3d5427){if(_0x3d5427){_0x507ba3[_0xea6c('0x38')]=_[_0xea6c('0x39')](db[_0xea6c('0xb4')][_0xea6c('0x34')]);_0x507ba3[_0xea6c('0x3a')]=_[_0xea6c('0x39')](_0x2174cb[_0xea6c('0x3a')]);_0x507ba3[_0xea6c('0x3b')]=_[_0xea6c('0x3c')](_0x507ba3[_0xea6c('0x38')],_0x507ba3[_0xea6c('0x3a')]);_0x2a260c['attributes']=_[_0xea6c('0x3c')](_0x507ba3[_0xea6c('0x38')],qs[_0xea6c('0x3e')](_0x2174cb['query'][_0xea6c('0x3e')]));_0x2a260c[_0xea6c('0x3d')]=_0x2a260c[_0xea6c('0x3d')]['length']?_0x2a260c[_0xea6c('0x3d')]:_0x507ba3[_0xea6c('0x38')];if(!_0x2174cb[_0xea6c('0x3a')][_0xea6c('0xb9')](_0xea6c('0xba'))){_0x2a260c['limit']=qs[_0xea6c('0x20')](_0x2174cb[_0xea6c('0x3a')][_0xea6c('0x20')]);_0x2a260c['offset']=qs[_0xea6c('0x1e')](_0x2174cb[_0xea6c('0x3a')][_0xea6c('0x1e')]);}_0x2a260c[_0xea6c('0x40')]=qs[_0xea6c('0x41')](_0x2174cb['query'][_0xea6c('0x41')]);_0x2a260c[_0xea6c('0x42')]=qs['filters'](_['pick'](_0x2174cb[_0xea6c('0x3a')],_0x507ba3[_0xea6c('0x3b')]));_0x2a260c[_0xea6c('0x42')][_0xea6c('0xa8')]=_0x3d5427['id'];if(_0x2174cb[_0xea6c('0x3a')][_0xea6c('0x7d')]){_0x2a260c[_0xea6c('0x42')]=_[_0xea6c('0x92')](_0x2a260c[_0xea6c('0x42')],{'$or':_[_0xea6c('0x32')](_0x2a260c[_0xea6c('0x3d')],function(_0x5c2efa){var _0x316bf4={};_0x316bf4[_0x5c2efa]={'$like':'%'+_0x2174cb['query'][_0xea6c('0x7d')]+'%'};return _0x316bf4;})});}if(_0x2174cb[_0xea6c('0x3a')][_0xea6c('0x74')]){var _0x44723c=_0x2174cb['query']['$gte']['split'](',');var _0x33dadd={};_0x33dadd[_0x44723c[0x0]]={'$gte':moment(_0x44723c[0x1])['format'](_0xea6c('0xbb'))};_0x2a260c[_0xea6c('0x42')]=_[_0xea6c('0x92')](_0x2a260c[_0xea6c('0x42')],_0x33dadd);}_0x2a260c=_[_0xea6c('0x92')]({},_0x2a260c,_0x2174cb[_0xea6c('0xaf')]);return db[_0xea6c('0xb4')]['count']({'where':_0x2a260c[_0xea6c('0x42')]})[_0xea6c('0x26')](function(_0xd608e3){_0x14cf4d[_0xea6c('0x21')]=_0xd608e3;if(_0x2174cb['query'][_0xea6c('0xad')]){_0x2a260c['include']=[{'all':!![]}];}return db['FaxMessage'][_0xea6c('0xbc')](_0x2a260c);})[_0xea6c('0x26')](function(_0x55dc95){_0x14cf4d[_0xea6c('0xaa')]=_0x55dc95;return _0x14cf4d;});}})[_0xea6c('0x26')](respondWithFilteredResult(_0x2e6d0a,_0x2a260c))[_0xea6c('0x30')](handleError(_0x2e6d0a,null));};exports[_0xea6c('0xbd')]=function(_0xb10d9e,_0x5f1074,_0xe569e3){return db[_0xea6c('0x33')][_0xea6c('0x5a')]({'where':{'id':_0xb10d9e[_0xea6c('0xac')]['id']}})[_0xea6c('0x26')](handleEntityNotFound(_0x5f1074,null))[_0xea6c('0x26')](function(_0xc7a64b){if(_0xc7a64b){return _0xc7a64b['setTags'](_0xb10d9e[_0xea6c('0x6d')]['ids'],_[_0xea6c('0xb6')](_0xb10d9e[_0xea6c('0x6d')],['ids','id'])||{})[_0xea6c('0xbe')](function(){return db['Tag'][_0xea6c('0xbc')]({'attributes':['id',_0xea6c('0x28'),'color'],'where':{'id':_0xb10d9e[_0xea6c('0x6d')][_0xea6c('0xb5')]}});})[_0xea6c('0x26')](function(_0x275647){socket[_0xea6c('0xbf')](_0xea6c('0xc0'),{'id':Number(_0xb10d9e[_0xea6c('0xac')]['id']),'tags':_0x275647||[]});return{'id':Number(_0xb10d9e['params']['id']),'tags':_0x275647||[]};});}})[_0xea6c('0x26')](respondWithResult(_0x5f1074,null))[_0xea6c('0x30')](handleError(_0x5f1074,null));};exports[_0xea6c('0xc1')]=function(_0x5d8dd7,_0x2311cc,_0x50cea1){return db[_0xea6c('0x33')][_0xea6c('0x5a')]({'where':{'id':_0x5d8dd7['params']['id']}})['then'](handleEntityNotFound(_0x2311cc,null))[_0xea6c('0x26')](function(_0x5c76fa){if(_0x5c76fa){return _0x5c76fa['removeTags'](_0x5d8dd7[_0xea6c('0x3a')]['ids']);}})['then'](respondWithStatusCode(_0x2311cc,null))[_0xea6c('0x30')](handleError(_0x2311cc,null));};exports[_0xea6c('0xc2')]=function(_0x204c9a,_0x536463){var _0x571494=moment()[_0xea6c('0xc3')]()[_0xea6c('0x90')]();var _0x22f5c3=path[_0xea6c('0xc4')](config[_0xea6c('0xc5')],_0xea6c('0xc6'),_0xea6c('0xc7'),_0xea6c('0xc8'));var _0x179275=path['join'](config['root'],_0xea6c('0xc6'),_0xea6c('0xc7'),_0xea6c('0xc9'));var _0x57b965=path[_0xea6c('0xc4')](_0x22f5c3,_0x571494);var _0x4b2bc4=util[_0xea6c('0xca')](_0xea6c('0xcb'),_0x204c9a[_0xea6c('0xac')]['id'],_0x571494);var _0x1e0dad=path['join'](_0x22f5c3,_0x4b2bc4);var _0x3ffcec=[];_0x3ffcec['push']({'model':db[_0xea6c('0xcc')],'as':_0xea6c('0xcc'),'raw':!![]});var _0x16ab83=[{'model':db[_0xea6c('0xb4')],'as':_0xea6c('0xcd'),'attributes':['id',_0xea6c('0x6d'),_0xea6c('0x73')],'include':_0x3ffcec}];return db[_0xea6c('0x33')]['find']({'where':{'id':_0x204c9a['params']['id']},'include':_0x16ab83})[_0xea6c('0x26')](handleEntityNotFound(_0x536463,null))['then'](function(_0x1216a1){if(_0x1216a1&&_0x1216a1[_0xea6c('0xcd')]){var _0x476708=_0x1216a1[_0xea6c('0xce')]({'plain':!![]});fs[_0xea6c('0xcf')](_0x57b965);for(var _0x58c126=0x0;_0x58c126<_0x476708[_0xea6c('0xcd')]['length'];_0x58c126++){var _0x57ad3a=_0x476708['Messages'][_0x58c126][_0xea6c('0xcc')];if(_0x57ad3a){var _0x545e52=path[_0xea6c('0xc4')](_0x179275,_0x57ad3a[_0xea6c('0xd0')]);if(fs[_0xea6c('0xd1')](_0x545e52)){fs[_0xea6c('0xd2')](_0x545e52)[_0xea6c('0xd3')](fs['createWriteStream'](path['join'](_0x57b965,_0x57ad3a['basename'])));}}}return BPromise[_0xea6c('0x89')]()[_0xea6c('0x26')](function(){return new BPromise(function(_0x261c3c,_0x3a69b9){zipdir(_0x57b965,{'saveTo':_0x1e0dad},function(_0x3e6b95,_0xa563d6){if(_0x3e6b95)return _0x3a69b9(_0x3e6b95);return _0x261c3c(_0xa563d6);});})[_0xea6c('0x26')](function(){return new BPromise(function(_0xb0d577,_0x5ce48e){rimraf(_0x57b965,function(_0x289ed2){if(_0x289ed2)_0x5ce48e(_0x289ed2);return _0xb0d577();});});})[_0xea6c('0x26')](function(){return _0x536463[_0xea6c('0xc2')](_0x1e0dad,_0x4b2bc4,function(_0x3472a3){if(_0x3472a3){console['log'](_0xea6c('0xd4'),_0x3472a3);}else{fs['unlinkSync'](_0x1e0dad);}});});});}else{return _0x536463[_0xea6c('0x1c')](0xc8);}})['catch'](handleError(_0x536463,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index dcab9c4..78a7387 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 _0xb71d=['events','../../mysqldb','FaxInteraction','save','update','getUsers','setDataValue','map','unreadMessages','length','catch','hook'];(function(_0x197c9a,_0x2729c1){var _0x53ff6e=function(_0x5c0569){while(--_0x5c0569){_0x197c9a['push'](_0x197c9a['shift']());}};_0x53ff6e(++_0x2729c1);}(_0xb71d,0x120));var _0xdb71=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb71d[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require(_0xdb71('0x0'));var FaxInteraction=require(_0xdb71('0x1'))['db'][_0xdb71('0x2')];var FaxMessage=require(_0xdb71('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdb71('0x3'),'afterUpdate':_0xdb71('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1e573b){return function(_0x4cb3fe,_0x40421f,_0x55d9d2){_0x4cb3fe[_0xdb71('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x40549c){_0x4cb3fe[_0xdb71('0x6')]('Users',_0x40549c[_0xdb71('0x7')](function(_0x2473de){return{'id':_0x2473de['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x4cb3fe['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x368926){_0x4cb3fe[_0xdb71('0x6')](_0xdb71('0x8'),_0x368926[_0xdb71('0x9')]);FaxInteractionEvents['emit'](_0x1e573b+':'+_0x4cb3fe['id'],_0x4cb3fe);FaxInteractionEvents['emit'](_0x1e573b,_0x4cb3fe);_0x55d9d2(null);})[_0xdb71('0xa')](_0x55d9d2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xdb71('0xb')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x43a5=['exports','../../mysqldb','FaxInteraction','FaxMessage','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x41a168,_0x4ad99d){var _0x2205ff=function(_0x2fb5c1){while(--_0x2fb5c1){_0x41a168['push'](_0x41a168['shift']());}};_0x2205ff(++_0x4ad99d);}(_0x43a5,0x133));var _0x543a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x43a5[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x543a('0x0'))['db'][_0x543a('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0x543a('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x543a('0x3'),'afterDestroy':_0x543a('0x4')};function emitEvent(_0x1a6f9e){return function(_0x18a92a,_0x8f1ae9,_0x43bda3){_0x18a92a[_0x543a('0x5')]({'attributes':['id'],'raw':!![]})[_0x543a('0x6')](function(_0x1597bb){_0x18a92a[_0x543a('0x7')](_0x543a('0x8'),_0x1597bb[_0x543a('0x9')](function(_0x3440d4){return{'id':_0x3440d4['id']};}));return FaxMessage[_0x543a('0xa')]({'where':{'FaxInteractionId':_0x18a92a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x543a('0x6')](function(_0xcc791d){_0x18a92a[_0x543a('0x7')](_0x543a('0xb'),_0xcc791d[_0x543a('0xc')]);FaxInteractionEvents[_0x543a('0xd')](_0x1a6f9e+':'+_0x18a92a['id'],_0x18a92a);FaxInteractionEvents['emit'](_0x1a6f9e,_0x18a92a);_0x43bda3(null);})[_0x543a('0xe')](_0x43bda3(null));};}for(var e in events){if(events[_0x543a('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x543a('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 6215288..b293cdf 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 _0x233b=['closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','FaxInteraction','fax_interactions','changed','closed'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x233b,0x92));var _0xb233=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x233b[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xb233('0x0'));var logger=require(_0xb233('0x1'))(_0xb233('0x2'));var moment=require(_0xb233('0x3'));var BPromise=require(_0xb233('0x4'));var rp=require(_0xb233('0x5'));var fs=require('fs');var path=require(_0xb233('0x6'));var rimraf=require(_0xb233('0x7'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0xb233('0x8')]=function(_0x242c36,_0x44fe0f){return _0x242c36[_0xb233('0x9')](_0xb233('0xa'),attributes,{'tableName':_0xb233('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x53ecf6,_0x3f8314,_0x39d9c2){if(_0x53ecf6[_0xb233('0xc')](_0xb233('0xd'))){_0x53ecf6[_0xb233('0xe')]=moment()['format'](_0xb233('0xf'));}_0x39d9c2(null,_0x53ecf6);}}});}; \ No newline at end of file +var _0x32e0=['api','moment','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x57cdc3,_0x99c792){var _0x526d01=function(_0x38f071){while(--_0x38f071){_0x57cdc3['push'](_0x57cdc3['shift']());}};_0x526d01(++_0x99c792);}(_0x32e0,0x15d));var _0x032e=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x32e0[_0x581af1];return _0x54c22e;};'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')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4173f5,_0x58f9cf,_0x566ac4){if(_0x4173f5[_0x032e('0x9')](_0x032e('0xa'))){_0x4173f5[_0x032e('0xb')]=moment()['format'](_0x032e('0xc'));}_0x566ac4(null,_0x4173f5);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index bce9d4e..05726b4 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 _0xe894=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','attributes','limit','AddTagsToFaxInteraction','find','where','addTags','ids','omit','body','spread','AddTags','lodash','util','moment','bluebird'];(function(_0xc4cc76,_0x509923){var _0x49d202=function(_0x1fdc72){while(--_0x1fdc72){_0xc4cc76['push'](_0xc4cc76['shift']());}};_0x49d202(++_0x509923);}(_0xe894,0x1b4));var _0x4e89=function(_0x71b765,_0x3053f8){_0x71b765=_0x71b765-0x0;var _0x34cb24=_0xe894[_0x71b765];return _0x34cb24;};'use strict';var _=require(_0x4e89('0x0'));var util=require(_0x4e89('0x1'));var moment=require(_0x4e89('0x2'));var BPromise=require(_0x4e89('0x3'));var rs=require(_0x4e89('0x4'));var fs=require('fs');var Redis=require(_0x4e89('0x5'));var db=require(_0x4e89('0x6'))['db'];var utils=require(_0x4e89('0x7'));var logger=require(_0x4e89('0x8'))(_0x4e89('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4e89('0xa')][_0x4e89('0xb')]({'port':0x232a});config[_0x4e89('0xc')]=_[_0x4e89('0xd')](config[_0x4e89('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4e89('0xe'))(new Redis(config[_0x4e89('0xc')]));require(_0x4e89('0xf'))[_0x4e89('0x10')](socket);function respondWithRpcPromise(_0x3d3c42,_0x245203,_0x324bc0){return new BPromise(function(_0x14cdbd,_0xdb32a3){return client['request'](_0x3d3c42,_0x324bc0)[_0x4e89('0x11')](function(_0x47e98c){logger[_0x4e89('0x12')](_0x4e89('0x13'),_0x245203,_0x4e89('0x14'));logger[_0x4e89('0x15')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x245203,_0x4e89('0x14'),JSON[_0x4e89('0x16')](_0x47e98c));if(_0x47e98c[_0x4e89('0x17')]){if(_0x47e98c[_0x4e89('0x17')][_0x4e89('0x18')]===0x1f4){logger[_0x4e89('0x17')](_0x4e89('0x13'),_0x245203,_0x47e98c[_0x4e89('0x17')]['message']);return _0xdb32a3(_0x47e98c[_0x4e89('0x17')][_0x4e89('0x19')]);}logger[_0x4e89('0x17')](_0x4e89('0x13'),_0x245203,_0x47e98c['error'][_0x4e89('0x19')]);return _0x14cdbd(_0x47e98c[_0x4e89('0x17')]['message']);}else{logger[_0x4e89('0x12')](_0x4e89('0x13'),_0x245203,_0x4e89('0x14'));_0x14cdbd(_0x47e98c[_0x4e89('0x1a')][_0x4e89('0x19')]);}})[_0x4e89('0x1b')](function(_0x6660a6){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x245203,_0x6660a6);_0xdb32a3(_0x6660a6);});});}exports[_0x4e89('0x1c')]=function(_0x467b19){var _0x2b3269=this;return new Promise(function(_0x315a81,_0x3124e9){return db[_0x4e89('0x1d')][_0x4e89('0x1e')](_0x467b19['body'],{'raw':_0x467b19['options']?_0x467b19[_0x4e89('0x1f')][_0x4e89('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x467b19[_0x4e89('0x1f')]?_0x467b19[_0x4e89('0x1f')]['where']||null:null,'attributes':_0x467b19[_0x4e89('0x1f')]?_0x467b19[_0x4e89('0x1f')][_0x4e89('0x21')]||null:null,'limit':_0x467b19['options']?_0x467b19['options'][_0x4e89('0x22')]||null:null})[_0x4e89('0x11')](function(_0x35ab46){logger[_0x4e89('0x12')](_0x4e89('0x1c'),_0x467b19);logger[_0x4e89('0x15')](_0x4e89('0x1c'),_0x467b19,JSON[_0x4e89('0x16')](_0x35ab46));_0x315a81(_0x35ab46);})[_0x4e89('0x1b')](function(_0x216f25){logger['error'](_0x4e89('0x1c'),_0x216f25[_0x4e89('0x19')],_0x467b19);_0x3124e9(_0x2b3269[_0x4e89('0x17')](0x1f4,_0x216f25['message']));});});};exports[_0x4e89('0x23')]=function(_0x120c45){return new Promise(function(_0x17b2b1,_0xe312e5){return db[_0x4e89('0x1d')][_0x4e89('0x24')]({'where':_0x120c45[_0x4e89('0x1f')]?_0x120c45[_0x4e89('0x1f')][_0x4e89('0x25')]||null:null})[_0x4e89('0x11')](function(_0x56617d){if(_0x56617d){return _0x56617d[_0x4e89('0x26')](_0x120c45['body'][_0x4e89('0x27')],_[_0x4e89('0x28')](_0x120c45[_0x4e89('0x29')],[_0x4e89('0x27'),'id'])||{});}})[_0x4e89('0x2a')](function(_0x5dce1c){logger[_0x4e89('0x12')]('AddTags',_0x120c45);logger[_0x4e89('0x15')](_0x4e89('0x2b'),_0x120c45,JSON[_0x4e89('0x16')](_0x5dce1c));_0x17b2b1(_0x5dce1c);})[_0x4e89('0x1b')](function(_0x613dd4){logger[_0x4e89('0x17')](_0x4e89('0x2b'),_0x613dd4[_0x4e89('0x19')],_0x120c45);_0xe312e5(_this[_0x4e89('0x17')](0x1f4,_0x613dd4[_0x4e89('0x19')]));});});}; \ No newline at end of file +var _0x2096=['ioredis','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','find','where','addTags','ids','omit','AddTags','lodash','moment','bluebird','randomstring'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0x2096,0x1e8));var _0x6209=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x2096[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0x6209('0x0'));var util=require('util');var moment=require(_0x6209('0x1'));var BPromise=require(_0x6209('0x2'));var rs=require(_0x6209('0x3'));var fs=require('fs');var Redis=require(_0x6209('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6209('0x5'));var logger=require(_0x6209('0x6'))(_0x6209('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6209('0x8')][_0x6209('0x9')]({'port':0x232a});config['redis']=_[_0x6209('0xa')](config[_0x6209('0xb')],{'host':_0x6209('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6209('0xb')]));require(_0x6209('0xd'))[_0x6209('0xe')](socket);function respondWithRpcPromise(_0x2edffb,_0x52791d,_0x22ec89){return new BPromise(function(_0x1a6b16,_0x49129d){return client[_0x6209('0xf')](_0x2edffb,_0x22ec89)[_0x6209('0x10')](function(_0x7caf54){logger[_0x6209('0x11')](_0x6209('0x12'),_0x52791d,_0x6209('0x13'));logger[_0x6209('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x52791d,'request\x20sent',JSON[_0x6209('0x15')](_0x7caf54));if(_0x7caf54[_0x6209('0x16')]){if(_0x7caf54['error'][_0x6209('0x17')]===0x1f4){logger[_0x6209('0x16')](_0x6209('0x12'),_0x52791d,_0x7caf54[_0x6209('0x16')][_0x6209('0x18')]);return _0x49129d(_0x7caf54[_0x6209('0x16')]['message']);}logger[_0x6209('0x16')](_0x6209('0x12'),_0x52791d,_0x7caf54[_0x6209('0x16')][_0x6209('0x18')]);return _0x1a6b16(_0x7caf54[_0x6209('0x16')][_0x6209('0x18')]);}else{logger[_0x6209('0x11')](_0x6209('0x12'),_0x52791d,_0x6209('0x13'));_0x1a6b16(_0x7caf54[_0x6209('0x19')][_0x6209('0x18')]);}})[_0x6209('0x1a')](function(_0x3bc170){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x52791d,_0x3bc170);_0x49129d(_0x3bc170);});});}exports[_0x6209('0x1b')]=function(_0xb3f210){var _0x36ea00=this;return new Promise(function(_0x2cd569,_0x58e2cb){return db[_0x6209('0x1c')][_0x6209('0x1d')](_0xb3f210[_0x6209('0x1e')],{'raw':_0xb3f210[_0x6209('0x1f')]?_0xb3f210[_0x6209('0x1f')][_0x6209('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb3f210['options']?_0xb3f210[_0x6209('0x1f')]['where']||null:null,'attributes':_0xb3f210['options']?_0xb3f210[_0x6209('0x1f')][_0x6209('0x21')]||null:null,'limit':_0xb3f210[_0x6209('0x1f')]?_0xb3f210[_0x6209('0x1f')][_0x6209('0x22')]||null:null})[_0x6209('0x10')](function(_0x129324){logger['info'](_0x6209('0x1b'),_0xb3f210);logger[_0x6209('0x14')](_0x6209('0x1b'),_0xb3f210,JSON[_0x6209('0x15')](_0x129324));_0x2cd569(_0x129324);})['catch'](function(_0x2b93ab){logger[_0x6209('0x16')](_0x6209('0x1b'),_0x2b93ab['message'],_0xb3f210);_0x58e2cb(_0x36ea00[_0x6209('0x16')](0x1f4,_0x2b93ab['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x2a77e2){return new Promise(function(_0x11cb5c,_0x45ac05){return db[_0x6209('0x1c')][_0x6209('0x23')]({'where':_0x2a77e2[_0x6209('0x1f')]?_0x2a77e2[_0x6209('0x1f')][_0x6209('0x24')]||null:null})[_0x6209('0x10')](function(_0x54b98d){if(_0x54b98d){return _0x54b98d[_0x6209('0x25')](_0x2a77e2['body'][_0x6209('0x26')],_[_0x6209('0x27')](_0x2a77e2[_0x6209('0x1e')],[_0x6209('0x26'),'id'])||{});}})['spread'](function(_0x41b871){logger[_0x6209('0x11')](_0x6209('0x28'),_0x2a77e2);logger[_0x6209('0x14')](_0x6209('0x28'),_0x2a77e2,JSON[_0x6209('0x15')](_0x41b871));_0x11cb5c(_0x41b871);})[_0x6209('0x1a')](function(_0x59f1ec){logger[_0x6209('0x16')](_0x6209('0x28'),_0x59f1ec['message'],_0x2a77e2);_0x45ac05(_this[_0x6209('0x16')](0x1f4,_0x59f1ec[_0x6209('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index df85534..54b7a47 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 _0x12a6=['update','emit','removeListener','length','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x12a6,0x165));var _0x612a=function(_0x4c3f1c,_0x30d1a5){_0x4c3f1c=_0x4c3f1c-0x0;var _0x2119b4=_0x12a6[_0x4c3f1c];return _0x2119b4;};'use strict';var FaxInteractionEvents=require(_0x612a('0x0'));var events=[_0x612a('0x1'),_0x612a('0x2'),_0x612a('0x3')];function createListener(_0x10bb0e,_0xd2be51){return function(_0x1911eb){_0xd2be51[_0x612a('0x4')](_0x10bb0e,_0x1911eb);};}function removeListener(_0x45da9e,_0x41f844){return function(){FaxInteractionEvents[_0x612a('0x5')](_0x45da9e,_0x41f844);};}exports['register']=function(_0x5dd7b3){for(var _0x40a319=0x0,_0x4a1df6=events[_0x612a('0x6')];_0x40a319<_0x4a1df6;_0x40a319++){var _0xab23a6=events[_0x40a319];var _0x2e3839=createListener(_0x612a('0x7')+_0xab23a6,_0x5dd7b3);FaxInteractionEvents['on'](_0xab23a6,_0x2e3839);}}; \ No newline at end of file +var _0xdf0e=['register','faxInteraction:','./faxInteraction.events','save','remove','update','emit','removeListener'];(function(_0x13fe86,_0x1dd307){var _0x40fb74=function(_0x192168){while(--_0x192168){_0x13fe86['push'](_0x13fe86['shift']());}};_0x40fb74(++_0x1dd307);}(_0xdf0e,0xda));var _0xedf0=function(_0x35741f,_0x1bfb4f){_0x35741f=_0x35741f-0x0;var _0x2cd2b7=_0xdf0e[_0x35741f];return _0x2cd2b7;};'use strict';var FaxInteractionEvents=require(_0xedf0('0x0'));var events=[_0xedf0('0x1'),_0xedf0('0x2'),_0xedf0('0x3')];function createListener(_0x2964bd,_0x529762){return function(_0x1a16cb){_0x529762[_0xedf0('0x4')](_0x2964bd,_0x1a16cb);};}function removeListener(_0x34a318,_0x348241){return function(){FaxInteractionEvents[_0xedf0('0x5')](_0x34a318,_0x348241);};}exports[_0xedf0('0x6')]=function(_0x595ff8){for(var _0x38f2ea=0x0,_0x76f8eb=events['length'];_0x38f2ea<_0x76f8eb;_0x38f2ea++){var _0x1f220a=events[_0x38f2ea];var _0x57a941=createListener(_0xedf0('0x7')+_0x1f220a,_0x595ff8);FaxInteractionEvents['on'](_0x1f220a,_0x57a941);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index c4cc993..8a5a090 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 _0x4d39=['get','isAuthenticated','index','/describe','/:id','show','/:id/messages','download','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','exports','path','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0x26b08d,_0xa50004){var _0x1711e6=function(_0x28a79c){while(--_0x28a79c){_0x26b08d['push'](_0x26b08d['shift']());}};_0x1711e6(++_0xa50004);}(_0x4d39,0xb2));var _0x94d3=function(_0x496895,_0x481fda){_0x496895=_0x496895-0x0;var _0x18e186=_0x4d39[_0x496895];return _0x18e186;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x94d3('0x0'));var timeout=require(_0x94d3('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x94d3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x94d3('0x3'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0x94d3('0x4')]('/',auth[_0x94d3('0x5')](),controller[_0x94d3('0x6')]);router['get'](_0x94d3('0x7'),auth[_0x94d3('0x5')](),controller['describe']);router['get'](_0x94d3('0x8'),auth['isAuthenticated'](),controller[_0x94d3('0x9')]);router[_0x94d3('0x4')](_0x94d3('0xa'),auth[_0x94d3('0x5')](),controller['getMessages']);router[_0x94d3('0x4')]('/:id/download',auth['isAuthenticated'](),controller[_0x94d3('0xb')]);router[_0x94d3('0xc')]('/',auth['isAuthenticated'](),controller[_0x94d3('0xd')]);router[_0x94d3('0xc')](_0x94d3('0xa'),auth['isAuthenticated'](),controller['addMessage']);router[_0x94d3('0xc')](_0x94d3('0xe'),auth[_0x94d3('0x5')](),interaction[_0x94d3('0xf')](_0x94d3('0x10'),_0x94d3('0x11')),controller[_0x94d3('0x12')]);router[_0x94d3('0x13')]('/:id',auth[_0x94d3('0x5')](),interaction['tracked'](_0x94d3('0x10'),_0x94d3('0x14')),controller[_0x94d3('0x15')]);router[_0x94d3('0x16')](_0x94d3('0x8'),auth[_0x94d3('0x5')](),interaction[_0x94d3('0xf')](_0x94d3('0x10'),_0x94d3('0x17')),controller['destroy']);router['delete'](_0x94d3('0xe'),auth[_0x94d3('0x5')](),controller[_0x94d3('0x18')]);module[_0x94d3('0x19')]=router; \ No newline at end of file +var _0xce6e=['/:id/tags','tracked','fax','put','/:id','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','create','addMessage'];(function(_0x22061d,_0x6e1845){var _0x355b29=function(_0x407adb){while(--_0x407adb){_0x22061d['push'](_0x22061d['shift']());}};_0x355b29(++_0x6e1845);}(_0xce6e,0x7e));var _0xece6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce6e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xece6('0x0'));var util=require('util');var path=require(_0xece6('0x1'));var timeout=require('connect-timeout');var express=require(_0xece6('0x2'));var router=express[_0xece6('0x3')]();var fs_extra=require(_0xece6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xece6('0x5'));var config=require(_0xece6('0x6'));var controller=require(_0xece6('0x7'));router[_0xece6('0x8')]('/',auth[_0xece6('0x9')](),controller[_0xece6('0xa')]);router[_0xece6('0x8')](_0xece6('0xb'),auth[_0xece6('0x9')](),controller[_0xece6('0xc')]);router[_0xece6('0x8')]('/:id',auth[_0xece6('0x9')](),controller[_0xece6('0xd')]);router['get']('/:id/messages',auth[_0xece6('0x9')](),controller['getMessages']);router[_0xece6('0x8')](_0xece6('0xe'),auth[_0xece6('0x9')](),controller[_0xece6('0xf')]);router[_0xece6('0x10')]('/',auth[_0xece6('0x9')](),controller[_0xece6('0x11')]);router[_0xece6('0x10')]('/:id/messages',auth[_0xece6('0x9')](),controller[_0xece6('0x12')]);router[_0xece6('0x10')](_0xece6('0x13'),auth['isAuthenticated'](),interaction[_0xece6('0x14')](_0xece6('0x15'),'faxinteraction:addtags'),controller['addTags']);router[_0xece6('0x16')](_0xece6('0x17'),auth['isAuthenticated'](),interaction[_0xece6('0x14')](_0xece6('0x15'),_0xece6('0x18')),controller[_0xece6('0x19')]);router[_0xece6('0x1a')](_0xece6('0x17'),auth[_0xece6('0x9')](),interaction[_0xece6('0x14')](_0xece6('0x15'),_0xece6('0x1b')),controller[_0xece6('0x1c')]);router[_0xece6('0x1a')]('/:id/tags',auth[_0xece6('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index a00346f..b05e077 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 _0x03ce=['medium','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x41a72b,_0x6c933){var _0x4d4411=function(_0x1cfd32){while(--_0x1cfd32){_0x41a72b['push'](_0x41a72b['shift']());}};_0x4d4411(++_0x6c933);}(_0x03ce,0x1a1));var _0xe03c=function(_0x20b1f9,_0x1abe8a){_0x20b1f9=_0x20b1f9-0x0;var _0x578891=_0x03ce[_0x20b1f9];return _0x578891;};'use strict';var Sequelize=require(_0xe03c('0x0'));module[_0xe03c('0x1')]={'body':{'type':Sequelize[_0xe03c('0x2')](_0xe03c('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe03c('0x4')]('in',_0xe03c('0x5')),'defaultValue':_0xe03c('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xe03c('0x6')]}}; \ No newline at end of file +var _0xb28a=['BOOLEAN','DATE','exports','TEXT'];(function(_0x43f42c,_0x555838){var _0x11bc87=function(_0x51ae0f){while(--_0x51ae0f){_0x43f42c['push'](_0x43f42c['shift']());}};_0x11bc87(++_0x555838);}(_0xb28a,0x166));var _0xab28=function(_0x17d077,_0x43ed5d){_0x17d077=_0x17d077-0x0;var _0x53fd3b=_0xb28a[_0x17d077];return _0x53fd3b;};'use strict';var Sequelize=require('sequelize');module[_0xab28('0x0')]={'body':{'type':Sequelize[_0xab28('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xab28('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xab28('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xab28('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 7d939ef..4d412bc 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 _0xa0cd=['[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','manual','SIP/%s','channel','motionChannel','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','interface','rejectmessage','create','CmContact','findOne','fax','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','join','root','server','files','attachments','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./faxMessage.socket','register','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','merge','filter','options','FaxMessage','includeAll','include','findAll','rows','catch','show','length','find','body','params','describe','../../config/logger','fax-interactions','accept','read','readAt','format','UserId','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','info'];(function(_0x57524e,_0x236f11){var _0x4a0867=function(_0x472b27){while(--_0x472b27){_0x57524e['push'](_0x57524e['shift']());}};_0x4a0867(++_0x236f11);}(_0xa0cd,0xbe));var _0xda0c=function(_0x4accb5,_0xd15c51){_0x4accb5=_0x4accb5-0x0;var _0x5ce1f2=_0xa0cd[_0x4accb5];return _0x5ce1f2;};'use strict';var emlformat=require(_0xda0c('0x0'));var rimraf=require(_0xda0c('0x1'));var zipdir=require(_0xda0c('0x2'));var jsonpatch=require(_0xda0c('0x3'));var rp=require(_0xda0c('0x4'));var moment=require('moment');var BPromise=require(_0xda0c('0x5'));var Mustache=require('mustache');var util=require(_0xda0c('0x6'));var path=require(_0xda0c('0x7'));var sox=require('sox');var csv=require(_0xda0c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda0c('0x9'));var _=require(_0xda0c('0xa'));var squel=require('squel');var crypto=require(_0xda0c('0xb'));var jsforce=require(_0xda0c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xda0c('0xd'));var Papa=require(_0xda0c('0xe'));var Redis=require('ioredis');var authService=require(_0xda0c('0xf'));var qs=require(_0xda0c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda0c('0x11'));var logger=require('../../config/logger')(_0xda0c('0x12'));var utils=require(_0xda0c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xda0c('0x14'));var db=require('../../mysqldb')['db'];config[_0xda0c('0x15')]=_[_0xda0c('0x16')](config[_0xda0c('0x15')],{'host':_0xda0c('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda0c('0x15')]));require(_0xda0c('0x18'))[_0xda0c('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xda0c('0x1a')][_0xda0c('0x1b')]({'port':0x232c});var client9002=jayson[_0xda0c('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6fa885,_0x3c3534,_0x155693,_0x474c56){return new BPromise(function(_0x4f0c23,_0x53d8a7){var _0x1826b1=_0x474c56||client;return _0x1826b1[_0xda0c('0x1c')](_0x6fa885,_0x155693)[_0xda0c('0x1d')](function(_0x3fefdb){logger['info'](_0xda0c('0x1e'),_0x3c3534,_0xda0c('0x1f'));logger[_0xda0c('0x20')](_0xda0c('0x21'),_0x3c3534,_0xda0c('0x1f'),JSON[_0xda0c('0x22')](_0x3fefdb));if(_0x3fefdb[_0xda0c('0x23')]){if(_0x3fefdb[_0xda0c('0x23')]['code']===0x1f4){logger['error'](_0xda0c('0x1e'),_0x3c3534,_0x3fefdb['error'][_0xda0c('0x24')]);return _0x53d8a7(_0x3fefdb[_0xda0c('0x23')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x3c3534,_0x3fefdb[_0xda0c('0x23')][_0xda0c('0x24')]);return _0x4f0c23(_0x3fefdb['error'][_0xda0c('0x24')]);}else{logger['info'](_0xda0c('0x1e'),_0x3c3534,_0xda0c('0x1f'));_0x4f0c23(_0x3fefdb[_0xda0c('0x25')][_0xda0c('0x24')]);}})['catch'](function(_0xfbcb7c){logger[_0xda0c('0x23')](_0xda0c('0x1e'),_0x3c3534,_0xfbcb7c);_0x53d8a7(_0xfbcb7c);});});}function respondWithStatusCode(_0x10246b,_0x44db7e){_0x44db7e=_0x44db7e||0xcc;return function(_0x58736a){if(_0x58736a){return _0x10246b['sendStatus'](_0x44db7e);}return _0x10246b[_0xda0c('0x26')](_0x44db7e)['end']();};}function respondWithResult(_0x456588,_0x3c2407){_0x3c2407=_0x3c2407||0xc8;return function(_0x2f91fd){if(_0x2f91fd){return _0x456588[_0xda0c('0x26')](_0x3c2407)[_0xda0c('0x27')](_0x2f91fd);}};}function respondWithFilteredResult(_0x547ece,_0x5bc010){return function(_0x182b67){if(_0x182b67){var _0xa89a3b=typeof _0x5bc010[_0xda0c('0x28')]===_0xda0c('0x29')&&typeof _0x5bc010[_0xda0c('0x2a')]==='undefined';var _0x22ef5f=_0x182b67[_0xda0c('0x2b')];var _0x582d58=_0xa89a3b?0x0:_0x5bc010[_0xda0c('0x28')];var _0x52ee4c=_0xa89a3b?_0x182b67['count']:_0x5bc010[_0xda0c('0x28')]+_0x5bc010['limit'];var _0x343497;if(_0x52ee4c>=_0x22ef5f){_0x52ee4c=_0x22ef5f;_0x343497=0xc8;}else{_0x343497=0xce;}_0x547ece[_0xda0c('0x26')](_0x343497);return _0x547ece[_0xda0c('0x2c')](_0xda0c('0x2d'),_0x582d58+'-'+_0x52ee4c+'/'+_0x22ef5f)[_0xda0c('0x27')](_0x182b67);}return null;};}function patchUpdates(_0x51dd76){return function(_0x2fb442){try{jsonpatch[_0xda0c('0x2e')](_0x2fb442,_0x51dd76,!![]);}catch(_0x4eb57b){return BPromise[_0xda0c('0x2f')](_0x4eb57b);}return _0x2fb442['save']();};}function saveUpdates(_0x3d9a97,_0x108e06){return function(_0x322763){if(_0x322763){return _0x322763[_0xda0c('0x30')](_0x3d9a97)[_0xda0c('0x1d')](function(_0x32a981){return _0x32a981;});}return null;};}function removeEntity(_0x363d69,_0x182e1e){return function(_0x373571){if(_0x373571){return _0x373571[_0xda0c('0x31')]()[_0xda0c('0x1d')](function(){_0x363d69[_0xda0c('0x26')](0xcc)[_0xda0c('0x32')]();});}};}function handleEntityNotFound(_0x263d68,_0x1d3481){return function(_0x201610){if(!_0x201610){_0x263d68[_0xda0c('0x33')](0x194);}return _0x201610;};}function handleError(_0x2a314,_0x526dd2){_0x526dd2=_0x526dd2||0x1f4;return function(_0x15c9be){logger[_0xda0c('0x23')](_0x15c9be[_0xda0c('0x34')]);if(_0x15c9be[_0xda0c('0x35')]){delete _0x15c9be[_0xda0c('0x35')];}_0x2a314[_0xda0c('0x26')](_0x526dd2)[_0xda0c('0x36')](_0x15c9be);};}exports[_0xda0c('0x37')]=function(_0x3f9dee,_0x10a58f){var _0x5a1ac3={},_0x3eae10={},_0x4230ae={'count':0x0,'rows':[]};var _0x132f46=_[_0xda0c('0x38')](db['FaxMessage'][_0xda0c('0x39')],function(_0x1aa19b){return{'name':_0x1aa19b[_0xda0c('0x3a')],'type':_0x1aa19b[_0xda0c('0x3b')][_0xda0c('0x3c')]};});_0x3eae10[_0xda0c('0x3d')]=_[_0xda0c('0x38')](_0x132f46,'name');_0x3eae10[_0xda0c('0x3e')]=_[_0xda0c('0x3f')](_0x3f9dee[_0xda0c('0x3e')]);_0x3eae10[_0xda0c('0x40')]=_['intersection'](_0x3eae10['model'],_0x3eae10[_0xda0c('0x3e')]);_0x5a1ac3['attributes']=_[_0xda0c('0x41')](_0x3eae10[_0xda0c('0x3d')],qs['fields'](_0x3f9dee[_0xda0c('0x3e')][_0xda0c('0x42')]));_0x5a1ac3[_0xda0c('0x43')]=_0x5a1ac3[_0xda0c('0x43')]['length']?_0x5a1ac3[_0xda0c('0x43')]:_0x3eae10[_0xda0c('0x3d')];if(!_0x3f9dee['query'][_0xda0c('0x44')]('nolimit')){_0x5a1ac3['limit']=qs[_0xda0c('0x2a')](_0x3f9dee[_0xda0c('0x3e')][_0xda0c('0x2a')]);_0x5a1ac3[_0xda0c('0x28')]=qs['offset'](_0x3f9dee[_0xda0c('0x3e')]['offset']);}_0x5a1ac3['order']=qs[_0xda0c('0x45')](_0x3f9dee[_0xda0c('0x3e')][_0xda0c('0x45')]);_0x5a1ac3[_0xda0c('0x46')]=qs['filters'](_[_0xda0c('0x47')](_0x3f9dee[_0xda0c('0x3e')],_0x3eae10[_0xda0c('0x40')]),_0x132f46);if(_0x3f9dee[_0xda0c('0x3e')]['filter']){_0x5a1ac3[_0xda0c('0x46')]=_[_0xda0c('0x48')](_0x5a1ac3[_0xda0c('0x46')],{'$or':_[_0xda0c('0x38')](_0x132f46,function(_0x538171){if(_0x538171[_0xda0c('0x3b')]!=='VIRTUAL'){var _0x291fb4={};_0x291fb4[_0x538171[_0xda0c('0x35')]]={'$like':'%'+_0x3f9dee['query'][_0xda0c('0x49')]+'%'};return _0x291fb4;}})});}_0x5a1ac3=_[_0xda0c('0x48')]({},_0x5a1ac3,_0x3f9dee[_0xda0c('0x4a')]);var _0x3d58fb={'where':_0x5a1ac3[_0xda0c('0x46')]};return db[_0xda0c('0x4b')][_0xda0c('0x2b')](_0x3d58fb)[_0xda0c('0x1d')](function(_0x37be64){_0x4230ae['count']=_0x37be64;if(_0x3f9dee['query'][_0xda0c('0x4c')]){_0x5a1ac3[_0xda0c('0x4d')]=[{'all':!![]}];}return db['FaxMessage'][_0xda0c('0x4e')](_0x5a1ac3);})['then'](function(_0x2dad3a){_0x4230ae[_0xda0c('0x4f')]=_0x2dad3a;return _0x4230ae;})[_0xda0c('0x1d')](respondWithFilteredResult(_0x10a58f,_0x5a1ac3))[_0xda0c('0x50')](handleError(_0x10a58f,null));};exports[_0xda0c('0x51')]=function(_0x210ee8,_0x716d){var _0x2e9332={'raw':!![],'where':{'id':_0x210ee8['params']['id']}},_0x1cc1f9={};_0x1cc1f9[_0xda0c('0x3d')]=_[_0xda0c('0x3f')](db[_0xda0c('0x4b')][_0xda0c('0x39')]);_0x1cc1f9[_0xda0c('0x3e')]=_[_0xda0c('0x3f')](_0x210ee8[_0xda0c('0x3e')]);_0x1cc1f9[_0xda0c('0x40')]=_[_0xda0c('0x41')](_0x1cc1f9[_0xda0c('0x3d')],_0x1cc1f9['query']);_0x2e9332['attributes']=_[_0xda0c('0x41')](_0x1cc1f9[_0xda0c('0x3d')],qs[_0xda0c('0x42')](_0x210ee8[_0xda0c('0x3e')]['fields']));_0x2e9332[_0xda0c('0x43')]=_0x2e9332[_0xda0c('0x43')][_0xda0c('0x52')]?_0x2e9332[_0xda0c('0x43')]:_0x1cc1f9[_0xda0c('0x3d')];if(_0x210ee8[_0xda0c('0x3e')][_0xda0c('0x4c')]){_0x2e9332[_0xda0c('0x4d')]=[{'all':!![]}];}_0x2e9332=_['merge']({},_0x2e9332,_0x210ee8[_0xda0c('0x4a')]);return db[_0xda0c('0x4b')][_0xda0c('0x53')](_0x2e9332)[_0xda0c('0x1d')](handleEntityNotFound(_0x716d,null))[_0xda0c('0x1d')](respondWithResult(_0x716d,null))[_0xda0c('0x50')](handleError(_0x716d,null));};exports[_0xda0c('0x30')]=function(_0x532236,_0x10b39f){if(_0x532236[_0xda0c('0x54')]['id']){delete _0x532236['body']['id'];}return db['FaxMessage'][_0xda0c('0x53')]({'where':{'id':_0x532236[_0xda0c('0x55')]['id']}})[_0xda0c('0x1d')](handleEntityNotFound(_0x10b39f,null))['then'](saveUpdates(_0x532236[_0xda0c('0x54')],null))['then'](respondWithResult(_0x10b39f,null))[_0xda0c('0x50')](handleError(_0x10b39f,null));};exports[_0xda0c('0x31')]=function(_0x2d7f43,_0x40432b){return db[_0xda0c('0x4b')][_0xda0c('0x53')]({'where':{'id':_0x2d7f43[_0xda0c('0x55')]['id']}})[_0xda0c('0x1d')](handleEntityNotFound(_0x40432b,null))['then'](removeEntity(_0x40432b,null))[_0xda0c('0x50')](handleError(_0x40432b,null));};exports[_0xda0c('0x56')]=function(_0x556278,_0x5b6429){return db[_0xda0c('0x4b')][_0xda0c('0x56')]()[_0xda0c('0x1d')](respondWithResult(_0x5b6429,null))[_0xda0c('0x50')](handleError(_0x5b6429,null));};var interaction_log=require(_0xda0c('0x57'))(_0xda0c('0x58'));exports[_0xda0c('0x59')]=function(_0x4bbc86,_0x4748ec,_0x31fc22){var _0x78a21c={'agent':{},'channel':'fax'};if(_0x4bbc86[_0xda0c('0x54')]['id']){delete _0x4bbc86[_0xda0c('0x54')]['id'];}_0x4bbc86[_0xda0c('0x54')][_0xda0c('0x5a')]=!![];_0x4bbc86[_0xda0c('0x54')][_0xda0c('0x5b')]=moment()[_0xda0c('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x4bbc86[_0xda0c('0x54')][_0xda0c('0x5d')]=_0x4bbc86[_0xda0c('0x54')][_0xda0c('0x5d')]||_0x4bbc86['user']['id'];_0x78a21c['agent']['id']=_0x4bbc86[_0xda0c('0x54')][_0xda0c('0x5d')];return db[_0xda0c('0x4b')][_0xda0c('0x53')]({'where':{'id':_0x4bbc86[_0xda0c('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4748ec,null))['then'](saveUpdates(_0x4bbc86['body'],null))[_0xda0c('0x1d')](function(_0x430342){if(_0x430342){_0x78a21c[_0xda0c('0x24')]=_0x430342[_0xda0c('0x5e')]({'plain':!![]});return db[_0xda0c('0x5f')][_0xda0c('0x53')]({'where':{'id':_0x430342[_0xda0c('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x4748ec,null))['then'](function(_0x4b5e57){if(_0x4b5e57){return _0x4b5e57[_0xda0c('0x30')]({'UserId':_0x4bbc86['body'][_0xda0c('0x5d')],'read1stAt':_[_0xda0c('0x61')](_0x4b5e57[_0xda0c('0x62')])?moment()[_0xda0c('0x5c')](_0xda0c('0x63')):undefined});}return null;})[_0xda0c('0x1d')](function(_0x1745e6){if(_0x1745e6){_0x78a21c[_0xda0c('0x64')]=_0x1745e6[_0xda0c('0x5e')]({'plain':!![]});interaction_log[_0xda0c('0x65')](_0xda0c('0x66'),_0x4bbc86['user']['id'],_0x4bbc86[_0xda0c('0x67')][_0xda0c('0x35')],_0x4bbc86[_0xda0c('0x67')]['role'],_0x78a21c[_0xda0c('0x64')]['id'],_0x4bbc86[_0xda0c('0x54')]?JSON[_0xda0c('0x22')](_0x4bbc86[_0xda0c('0x54')]):_0xda0c('0x68'));return respondWithRpcPromise(_0xda0c('0x69'),_0xda0c('0x6a'),_0x78a21c);}return null;})[_0xda0c('0x1d')](function(_0x208842){var _0x2e8033='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x208842['message'][_0xda0c('0x6b')];return db[_0xda0c('0x6c')][_0xda0c('0x3e')](_0x2e8033,{'type':db[_0xda0c('0x6d')][_0xda0c('0x6e')][_0xda0c('0x6f')],'raw':!![]})[_0xda0c('0x1d')](function(_0x1b8055){return _0x1b8055;});})[_0xda0c('0x1d')](function(_0x472e2c){if(_0x472e2c){_0x78a21c[_0xda0c('0x24')][_0xda0c('0x70')]=_0x472e2c[0x0];if(!_0x4bbc86[_0xda0c('0x54')][_0xda0c('0x5d')])return;return db[_0xda0c('0x71')]['find']({'where':{'id':_0x4bbc86[_0xda0c('0x54')][_0xda0c('0x5d')],'role':_0xda0c('0x72')},'attributes':['id',_0xda0c('0x35'),_0xda0c('0x73'),'email',_0xda0c('0x74')],'raw':!![]});}return null;})[_0xda0c('0x1d')](function(_0x2aff9e){if(!_0x2aff9e)return null;_0x78a21c[_0xda0c('0x24')]['agent']=_0x2aff9e;return _0x78a21c;})[_0xda0c('0x1d')](function(_0x503ec3){if(_0x503ec3){if(_0x4bbc86[_0xda0c('0x54')][_0xda0c('0x75')]){_0x78a21c[_0xda0c('0x24')]['interface']=util[_0xda0c('0x5c')](_0xda0c('0x76'),_0x4bbc86[_0xda0c('0x67')][_0xda0c('0x35')]);_0x78a21c[_0xda0c('0x24')][_0xda0c('0x77')]=_0x78a21c[_0xda0c('0x77')];_0x78a21c[_0xda0c('0x24')][_0xda0c('0x78')]=_0x78a21c['channel'];_0x78a21c[_0xda0c('0x24')]['event']=_0xda0c('0x59');return respondWithRpcPromise(_0xda0c('0x79'),_0xda0c('0x79'),{'event':'acceptmessage','message':_0x78a21c[_0xda0c('0x24')]},client9002)['then'](function(){return _0x78a21c;});}return _0x78a21c;}return null;})[_0xda0c('0x1d')](respondWithResult(_0x4748ec,null))[_0xda0c('0x50')](handleError(_0x4748ec,null));};var interaction_log=require(_0xda0c('0x57'))('fax-interactions');exports['reject']=function(_0x194b16,_0x9eb683,_0xf4d344){var _0xbd0588={'agent':{},'channel':'fax'};if(_0x194b16[_0xda0c('0x54')]['id']){delete _0x194b16[_0xda0c('0x54')]['id'];}_0x194b16[_0xda0c('0x54')][_0xda0c('0x5d')]=_0x194b16[_0xda0c('0x54')][_0xda0c('0x5d')]||_0x194b16[_0xda0c('0x67')]['id'];_0xbd0588[_0xda0c('0x72')]['id']=_0x194b16[_0xda0c('0x54')][_0xda0c('0x5d')];return db[_0xda0c('0x4b')][_0xda0c('0x53')]({'where':{'id':_0x194b16[_0xda0c('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x9eb683,null))[_0xda0c('0x1d')](function(_0x9bceca){if(_0x9bceca){_0xbd0588[_0xda0c('0x24')]=_0x9bceca[_0xda0c('0x5e')]({'plain':!![]});return db[_0xda0c('0x5f')][_0xda0c('0x53')]({'where':{'id':_0x9bceca[_0xda0c('0x60')]}});}return null;})[_0xda0c('0x1d')](handleEntityNotFound(_0x9eb683,null))[_0xda0c('0x1d')](function(_0x5ccade){if(_0x5ccade){_0xbd0588[_0xda0c('0x64')]=_0x5ccade[_0xda0c('0x5e')]({'plain':!![]});interaction_log[_0xda0c('0x65')](_0xda0c('0x7a'),_0x194b16[_0xda0c('0x67')]['id'],_0x194b16['user'][_0xda0c('0x35')],_0x194b16['user'][_0xda0c('0x7b')],_0xbd0588[_0xda0c('0x64')]['id'],_0x194b16[_0xda0c('0x54')]?JSON['stringify'](_0x194b16[_0xda0c('0x54')]):_0xda0c('0x68'));return respondWithRpcPromise(_0xda0c('0x7c'),_0xda0c('0x7d'),_0xbd0588);}return null;})['then'](function(_0x37f124){var _0x114239=_0xda0c('0x7e')+_0x37f124['message']['ContactId'];return db[_0xda0c('0x6c')]['query'](_0x114239,{'type':db[_0xda0c('0x6d')][_0xda0c('0x6e')]['SELECT'],'raw':!![]})['then'](function(_0x3457ed){return _0x3457ed;});})[_0xda0c('0x1d')](function(_0x512484){if(_0x512484){_0xbd0588[_0xda0c('0x24')][_0xda0c('0x70')]=_0x512484[0x0];if(!_0x194b16[_0xda0c('0x54')]['UserId'])return;return db[_0xda0c('0x71')][_0xda0c('0x53')]({'where':{'id':_0x194b16[_0xda0c('0x54')]['UserId'],'role':'agent'},'attributes':['id',_0xda0c('0x35'),'fullname',_0xda0c('0x7f'),'internal'],'raw':!![]});}return null;})[_0xda0c('0x1d')](function(_0x4b3285){if(!_0x4b3285)return null;_0xbd0588[_0xda0c('0x24')][_0xda0c('0x72')]=_0x4b3285;return _0xbd0588;})[_0xda0c('0x1d')](function(_0x46be71){if(_0x46be71){_0x46be71[_0xda0c('0x24')][_0xda0c('0x80')]=util['format'](_0xda0c('0x76'),_0x194b16[_0xda0c('0x67')]['name']);_0x46be71[_0xda0c('0x24')][_0xda0c('0x77')]=_0xbd0588[_0xda0c('0x77')];_0x46be71[_0xda0c('0x24')]['motionChannel']=_0xbd0588['channel'];_0x46be71[_0xda0c('0x24')]['event']=_0xda0c('0x2f');respondWithRpcPromise('EventManager',_0xda0c('0x79'),{'event':_0xda0c('0x81'),'message':_0x46be71['message']},client9002);return _0xbd0588;}return null;})[_0xda0c('0x1d')](respondWithResult(_0x9eb683,null))['catch'](handleError(_0x9eb683,null));};exports[_0xda0c('0x82')]=function(_0x4f68c4,_0x5a0865){var _0xae56d6;return db[_0xda0c('0x4b')]['create'](_0x4f68c4['body'],{})['then'](function(_0xe7ce0){_0xae56d6=_0xe7ce0;return db[_0xda0c('0x83')][_0xda0c('0x84')]({'where':{'id':_0xae56d6[_0xda0c('0x6b')]}});})['then'](function(_0xce0fe1){if(_['isNil'](_0xce0fe1)){return;}else{_0xae56d6['fax']=_0xce0fe1[_0xda0c('0x85')];return db[_0xda0c('0x86')][_0xda0c('0x84')]({'where':{'id':_0xae56d6['AttachmentId']}});}})['then'](function(_0x9b2884){return respondWithRpcPromise(_0xda0c('0x87'),_0xda0c('0x87'),{'FaxAccountId':_[_0xda0c('0x61')](_0x4f68c4[_0xda0c('0x54')])?undefined:_0x4f68c4[_0xda0c('0x54')][_0xda0c('0x88')],'path':_[_0xda0c('0x61')](_0x9b2884)?undefined:util[_0xda0c('0x5c')](_0xda0c('0x89'),_0x9b2884[_0xda0c('0x8a')]),'fax':_['isNil'](_0xae56d6[_0xda0c('0x85')])?undefined:_0xae56d6[_0xda0c('0x85')],'AttachmentId':_0xae56d6[_0xda0c('0x8b')]},client9002);})[_0xda0c('0x1d')](respondWithResult(_0x5a0865,0xc9))[_0xda0c('0x50')](handleError(_0x5a0865,null));};exports['download']=function(_0x52f67f,_0x410eb4){var _0x3b0487=path[_0xda0c('0x8c')](config[_0xda0c('0x8d')],_0xda0c('0x8e'),_0xda0c('0x8f'),_0xda0c('0x90'));return db[_0xda0c('0x4b')][_0xda0c('0x53')]({'where':{'id':_0x52f67f[_0xda0c('0x55')]['id']},'include':[{'model':db[_0xda0c('0x86')],'as':'Attachment'}]})[_0xda0c('0x1d')](handleEntityNotFound(_0x410eb4,null))['then'](function(_0x591472){if(_0x591472){return _0x410eb4[_0xda0c('0x91')](path[_0xda0c('0x8c')](_0x3b0487,_0x591472[_0xda0c('0x86')][_0xda0c('0x8a')]));}})[_0xda0c('0x50')](handleError(_0x410eb4,null));}; \ No newline at end of file +var _0xb86a=['then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','reject','save','update','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','length','attributes','hasOwnProperty','sort','pick','merge','where','filter','options','includeAll','findAll','rows','show','params','fields','include','find','body','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','User','fullname','email','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','contact','internal','motionChannel','rejectmessage','CmContact','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','attachments','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','crypto','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','defaults','redis','./faxMessage.socket','register','jayson/promise','client','http','request'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb86a,0xf9));var _0xab86=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xb86a[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0xab86('0x0'));var rimraf=require(_0xab86('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab86('0x2'));var rp=require(_0xab86('0x3'));var moment=require(_0xab86('0x4'));var BPromise=require(_0xab86('0x5'));var Mustache=require(_0xab86('0x6'));var util=require(_0xab86('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xab86('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab86('0x9'));var squel=require('squel');var crypto=require(_0xab86('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xab86('0xb'));var toCsv=require(_0xab86('0x8'));var querystring=require(_0xab86('0xc'));var Papa=require(_0xab86('0xd'));var Redis=require(_0xab86('0xe'));var authService=require(_0xab86('0xf'));var qs=require(_0xab86('0x10'));var as=require(_0xab86('0x11'));var hardwareService=require(_0xab86('0x12'));var logger=require(_0xab86('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xab86('0x14'));var licenseUtil=require(_0xab86('0x15'));var db=require(_0xab86('0x16'))['db'];config['redis']=_[_0xab86('0x17')](config[_0xab86('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab86('0x18')]));require(_0xab86('0x19'))[_0xab86('0x1a')](socket);var jayson=require(_0xab86('0x1b'));var client=jayson[_0xab86('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xab86('0x1c')][_0xab86('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x64a2cf,_0x4b11a6,_0x38f1e8,_0x4a8ca1){return new BPromise(function(_0x551735,_0x250603){var _0x324cc6=_0x4a8ca1||client;return _0x324cc6[_0xab86('0x1e')](_0x64a2cf,_0x38f1e8)[_0xab86('0x1f')](function(_0x23b343){logger['info'](_0xab86('0x20'),_0x4b11a6,_0xab86('0x21'));logger[_0xab86('0x22')](_0xab86('0x23'),_0x4b11a6,_0xab86('0x21'),JSON[_0xab86('0x24')](_0x23b343));if(_0x23b343[_0xab86('0x25')]){if(_0x23b343[_0xab86('0x25')][_0xab86('0x26')]===0x1f4){logger[_0xab86('0x25')](_0xab86('0x20'),_0x4b11a6,_0x23b343['error'][_0xab86('0x27')]);return _0x250603(_0x23b343['error'][_0xab86('0x27')]);}logger[_0xab86('0x25')]('FaxMessage,\x20%s,\x20%s',_0x4b11a6,_0x23b343[_0xab86('0x25')]['message']);return _0x551735(_0x23b343[_0xab86('0x25')][_0xab86('0x27')]);}else{logger[_0xab86('0x28')]('FaxMessage,\x20%s,\x20%s',_0x4b11a6,_0xab86('0x21'));_0x551735(_0x23b343[_0xab86('0x29')][_0xab86('0x27')]);}})[_0xab86('0x2a')](function(_0xb930d3){logger[_0xab86('0x25')](_0xab86('0x20'),_0x4b11a6,_0xb930d3);_0x250603(_0xb930d3);});});}function respondWithStatusCode(_0x140964,_0x128c27){_0x128c27=_0x128c27||0xcc;return function(_0x5ddb10){if(_0x5ddb10){return _0x140964[_0xab86('0x2b')](_0x128c27);}return _0x140964[_0xab86('0x2c')](_0x128c27)[_0xab86('0x2d')]();};}function respondWithResult(_0x2e5c9e,_0x2fbb76){_0x2fbb76=_0x2fbb76||0xc8;return function(_0x30870a){if(_0x30870a){return _0x2e5c9e[_0xab86('0x2c')](_0x2fbb76)[_0xab86('0x2e')](_0x30870a);}};}function respondWithFilteredResult(_0x4183e6,_0x81edcd){return function(_0x1c54d5){if(_0x1c54d5){var _0x58ee72=typeof _0x81edcd['offset']==='undefined'&&typeof _0x81edcd[_0xab86('0x2f')]===_0xab86('0x30');var _0x15aa67=_0x1c54d5['count'];var _0x51b4cd=_0x58ee72?0x0:_0x81edcd[_0xab86('0x31')];var _0x1b07c9=_0x58ee72?_0x1c54d5[_0xab86('0x32')]:_0x81edcd[_0xab86('0x31')]+_0x81edcd[_0xab86('0x2f')];var _0x4ec2ee;if(_0x1b07c9>=_0x15aa67){_0x1b07c9=_0x15aa67;_0x4ec2ee=0xc8;}else{_0x4ec2ee=0xce;}_0x4183e6[_0xab86('0x2c')](_0x4ec2ee);return _0x4183e6[_0xab86('0x33')](_0xab86('0x34'),_0x51b4cd+'-'+_0x1b07c9+'/'+_0x15aa67)[_0xab86('0x2e')](_0x1c54d5);}return null;};}function patchUpdates(_0x452c90){return function(_0x36f8de){try{jsonpatch['apply'](_0x36f8de,_0x452c90,!![]);}catch(_0x2992eb){return BPromise[_0xab86('0x35')](_0x2992eb);}return _0x36f8de[_0xab86('0x36')]();};}function saveUpdates(_0x13bfaf,_0x329ae0){return function(_0xb67d75){if(_0xb67d75){return _0xb67d75[_0xab86('0x37')](_0x13bfaf)['then'](function(_0x559214){return _0x559214;});}return null;};}function removeEntity(_0xc0600,_0x5bd91b){return function(_0x52fcdc){if(_0x52fcdc){return _0x52fcdc['destroy']()[_0xab86('0x1f')](function(){_0xc0600['status'](0xcc)[_0xab86('0x2d')]();});}};}function handleEntityNotFound(_0x3150d7,_0x2a75ba){return function(_0x48b193){if(!_0x48b193){_0x3150d7[_0xab86('0x2b')](0x194);}return _0x48b193;};}function handleError(_0x518900,_0x443cdb){_0x443cdb=_0x443cdb||0x1f4;return function(_0x2b557b){logger['error'](_0x2b557b[_0xab86('0x38')]);if(_0x2b557b[_0xab86('0x39')]){delete _0x2b557b[_0xab86('0x39')];}_0x518900[_0xab86('0x2c')](_0x443cdb)['send'](_0x2b557b);};}exports[_0xab86('0x3a')]=function(_0x4422e8,_0x41eec8){var _0x494630={},_0x4de432={},_0x3cb75b={'count':0x0,'rows':[]};var _0x842c9f=_[_0xab86('0x3b')](db[_0xab86('0x3c')][_0xab86('0x3d')],function(_0x2beda3){return{'name':_0x2beda3[_0xab86('0x3e')],'type':_0x2beda3[_0xab86('0x3f')]['key']};});_0x4de432[_0xab86('0x40')]=_[_0xab86('0x3b')](_0x842c9f,_0xab86('0x39'));_0x4de432[_0xab86('0x41')]=_[_0xab86('0x42')](_0x4422e8[_0xab86('0x41')]);_0x4de432[_0xab86('0x43')]=_[_0xab86('0x44')](_0x4de432[_0xab86('0x40')],_0x4de432[_0xab86('0x41')]);_0x494630['attributes']=_['intersection'](_0x4de432[_0xab86('0x40')],qs['fields'](_0x4422e8[_0xab86('0x41')]['fields']));_0x494630['attributes']=_0x494630['attributes'][_0xab86('0x45')]?_0x494630[_0xab86('0x46')]:_0x4de432[_0xab86('0x40')];if(!_0x4422e8[_0xab86('0x41')][_0xab86('0x47')]('nolimit')){_0x494630[_0xab86('0x2f')]=qs[_0xab86('0x2f')](_0x4422e8[_0xab86('0x41')][_0xab86('0x2f')]);_0x494630[_0xab86('0x31')]=qs[_0xab86('0x31')](_0x4422e8[_0xab86('0x41')][_0xab86('0x31')]);}_0x494630['order']=qs[_0xab86('0x48')](_0x4422e8['query'][_0xab86('0x48')]);_0x494630['where']=qs[_0xab86('0x43')](_[_0xab86('0x49')](_0x4422e8[_0xab86('0x41')],_0x4de432[_0xab86('0x43')]),_0x842c9f);if(_0x4422e8[_0xab86('0x41')]['filter']){_0x494630['where']=_[_0xab86('0x4a')](_0x494630[_0xab86('0x4b')],{'$or':_[_0xab86('0x3b')](_0x842c9f,function(_0x53089a){if(_0x53089a['type']!=='VIRTUAL'){var _0xba5c96={};_0xba5c96[_0x53089a['name']]={'$like':'%'+_0x4422e8[_0xab86('0x41')][_0xab86('0x4c')]+'%'};return _0xba5c96;}})});}_0x494630=_[_0xab86('0x4a')]({},_0x494630,_0x4422e8[_0xab86('0x4d')]);var _0x416e1f={'where':_0x494630[_0xab86('0x4b')]};return db[_0xab86('0x3c')]['count'](_0x416e1f)['then'](function(_0x1a23a7){_0x3cb75b[_0xab86('0x32')]=_0x1a23a7;if(_0x4422e8[_0xab86('0x41')][_0xab86('0x4e')]){_0x494630['include']=[{'all':!![]}];}return db[_0xab86('0x3c')][_0xab86('0x4f')](_0x494630);})[_0xab86('0x1f')](function(_0x5b24f4){_0x3cb75b[_0xab86('0x50')]=_0x5b24f4;return _0x3cb75b;})[_0xab86('0x1f')](respondWithFilteredResult(_0x41eec8,_0x494630))[_0xab86('0x2a')](handleError(_0x41eec8,null));};exports[_0xab86('0x51')]=function(_0x25e86a,_0x1ad999){var _0xcb8b4a={'raw':!![],'where':{'id':_0x25e86a[_0xab86('0x52')]['id']}},_0x5ca930={};_0x5ca930[_0xab86('0x40')]=_[_0xab86('0x42')](db['FaxMessage'][_0xab86('0x3d')]);_0x5ca930['query']=_[_0xab86('0x42')](_0x25e86a[_0xab86('0x41')]);_0x5ca930[_0xab86('0x43')]=_[_0xab86('0x44')](_0x5ca930[_0xab86('0x40')],_0x5ca930[_0xab86('0x41')]);_0xcb8b4a[_0xab86('0x46')]=_[_0xab86('0x44')](_0x5ca930[_0xab86('0x40')],qs[_0xab86('0x53')](_0x25e86a[_0xab86('0x41')][_0xab86('0x53')]));_0xcb8b4a[_0xab86('0x46')]=_0xcb8b4a[_0xab86('0x46')]['length']?_0xcb8b4a[_0xab86('0x46')]:_0x5ca930[_0xab86('0x40')];if(_0x25e86a[_0xab86('0x41')][_0xab86('0x4e')]){_0xcb8b4a[_0xab86('0x54')]=[{'all':!![]}];}_0xcb8b4a=_[_0xab86('0x4a')]({},_0xcb8b4a,_0x25e86a[_0xab86('0x4d')]);return db[_0xab86('0x3c')][_0xab86('0x55')](_0xcb8b4a)['then'](handleEntityNotFound(_0x1ad999,null))[_0xab86('0x1f')](respondWithResult(_0x1ad999,null))[_0xab86('0x2a')](handleError(_0x1ad999,null));};exports[_0xab86('0x37')]=function(_0x40c396,_0x2db8f5){if(_0x40c396[_0xab86('0x56')]['id']){delete _0x40c396[_0xab86('0x56')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x40c396[_0xab86('0x52')]['id']}})['then'](handleEntityNotFound(_0x2db8f5,null))[_0xab86('0x1f')](saveUpdates(_0x40c396['body'],null))['then'](respondWithResult(_0x2db8f5,null))[_0xab86('0x2a')](handleError(_0x2db8f5,null));};exports['destroy']=function(_0x2a354e,_0x2c2855){return db['FaxMessage']['find']({'where':{'id':_0x2a354e[_0xab86('0x52')]['id']}})[_0xab86('0x1f')](handleEntityNotFound(_0x2c2855,null))[_0xab86('0x1f')](removeEntity(_0x2c2855,null))[_0xab86('0x2a')](handleError(_0x2c2855,null));};exports[_0xab86('0x57')]=function(_0x40d8b5,_0x365249){return db['FaxMessage']['describe']()[_0xab86('0x1f')](respondWithResult(_0x365249,null))[_0xab86('0x2a')](handleError(_0x365249,null));};var interaction_log=require(_0xab86('0x13'))(_0xab86('0x58'));exports[_0xab86('0x59')]=function(_0x38dae3,_0x2e2db4,_0xbdb217){var _0x42c95e={'agent':{},'channel':_0xab86('0x5a')};if(_0x38dae3[_0xab86('0x56')]['id']){delete _0x38dae3[_0xab86('0x56')]['id'];}_0x38dae3['body'][_0xab86('0x5b')]=!![];_0x38dae3[_0xab86('0x56')][_0xab86('0x5c')]=moment()[_0xab86('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x38dae3[_0xab86('0x56')][_0xab86('0x5e')]=_0x38dae3['body'][_0xab86('0x5e')]||_0x38dae3[_0xab86('0x5f')]['id'];_0x42c95e[_0xab86('0x60')]['id']=_0x38dae3[_0xab86('0x56')][_0xab86('0x5e')];return db[_0xab86('0x3c')]['find']({'where':{'id':_0x38dae3[_0xab86('0x52')]['id'],'UserId':null}})[_0xab86('0x1f')](handleEntityNotFound(_0x2e2db4,null))[_0xab86('0x1f')](saveUpdates(_0x38dae3['body'],null))[_0xab86('0x1f')](function(_0x3905de){if(_0x3905de){_0x42c95e[_0xab86('0x27')]=_0x3905de['get']({'plain':!![]});return db[_0xab86('0x61')][_0xab86('0x55')]({'where':{'id':_0x3905de[_0xab86('0x62')]}});}return null;})[_0xab86('0x1f')](handleEntityNotFound(_0x2e2db4,null))[_0xab86('0x1f')](function(_0x48a7d7){if(_0x48a7d7){return _0x48a7d7[_0xab86('0x37')]({'UserId':_0x38dae3[_0xab86('0x56')][_0xab86('0x5e')],'read1stAt':_[_0xab86('0x63')](_0x48a7d7[_0xab86('0x64')])?moment()[_0xab86('0x5d')](_0xab86('0x65')):undefined});}return null;})[_0xab86('0x1f')](function(_0x56f8c9){if(_0x56f8c9){_0x42c95e[_0xab86('0x66')]=_0x56f8c9[_0xab86('0x67')]({'plain':!![]});interaction_log[_0xab86('0x28')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x38dae3[_0xab86('0x5f')]['id'],_0x38dae3[_0xab86('0x5f')]['name'],_0x38dae3[_0xab86('0x5f')][_0xab86('0x68')],_0x42c95e['interaction']['id'],_0x38dae3[_0xab86('0x56')]?JSON[_0xab86('0x24')](_0x38dae3[_0xab86('0x56')]):_0xab86('0x69'));return respondWithRpcPromise(_0xab86('0x6a'),'acceptMessage',_0x42c95e);}return null;})['then'](function(_0x451e31){var _0x69656a=_0xab86('0x6b')+_0x451e31[_0xab86('0x27')][_0xab86('0x6c')];return db[_0xab86('0x6d')][_0xab86('0x41')](_0x69656a,{'type':db['Sequelize']['QueryTypes'][_0xab86('0x6e')],'raw':!![]})[_0xab86('0x1f')](function(_0x571b18){return _0x571b18;});})[_0xab86('0x1f')](function(_0x6b2295){if(_0x6b2295){_0x42c95e[_0xab86('0x27')]['contact']=_0x6b2295[0x0];if(!_0x38dae3['body'][_0xab86('0x5e')])return;return db[_0xab86('0x6f')][_0xab86('0x55')]({'where':{'id':_0x38dae3[_0xab86('0x56')][_0xab86('0x5e')],'role':_0xab86('0x60')},'attributes':['id',_0xab86('0x39'),_0xab86('0x70'),_0xab86('0x71'),'internal'],'raw':!![]});}return null;})[_0xab86('0x1f')](function(_0x49779b){if(!_0x49779b)return null;_0x42c95e[_0xab86('0x27')][_0xab86('0x60')]=_0x49779b;return _0x42c95e;})[_0xab86('0x1f')](function(_0x4f2fd5){if(_0x4f2fd5){if(_0x38dae3[_0xab86('0x56')][_0xab86('0x72')]){_0x42c95e['message'][_0xab86('0x73')]=util['format'](_0xab86('0x74'),_0x38dae3['user'][_0xab86('0x39')]);_0x42c95e['message'][_0xab86('0x75')]=_0x42c95e[_0xab86('0x75')];_0x42c95e[_0xab86('0x27')]['motionChannel']=_0x42c95e[_0xab86('0x75')];_0x42c95e[_0xab86('0x27')][_0xab86('0x76')]='accept';return respondWithRpcPromise(_0xab86('0x77'),'EventManager',{'event':_0xab86('0x78'),'message':_0x42c95e['message']},client9002)['then'](function(){return _0x42c95e;});}return _0x42c95e;}return null;})['then'](respondWithResult(_0x2e2db4,null))[_0xab86('0x2a')](handleError(_0x2e2db4,null));};var interaction_log=require('../../config/logger')(_0xab86('0x58'));exports[_0xab86('0x35')]=function(_0x4fe730,_0x4b514a,_0x1be783){var _0x5a291a={'agent':{},'channel':_0xab86('0x5a')};if(_0x4fe730['body']['id']){delete _0x4fe730[_0xab86('0x56')]['id'];}_0x4fe730[_0xab86('0x56')]['UserId']=_0x4fe730[_0xab86('0x56')]['UserId']||_0x4fe730[_0xab86('0x5f')]['id'];_0x5a291a['agent']['id']=_0x4fe730[_0xab86('0x56')][_0xab86('0x5e')];return db['FaxMessage']['find']({'where':{'id':_0x4fe730[_0xab86('0x52')]['id'],'UserId':null}})[_0xab86('0x1f')](handleEntityNotFound(_0x4b514a,null))[_0xab86('0x1f')](function(_0x4ea68d){if(_0x4ea68d){_0x5a291a[_0xab86('0x27')]=_0x4ea68d[_0xab86('0x67')]({'plain':!![]});return db[_0xab86('0x61')][_0xab86('0x55')]({'where':{'id':_0x4ea68d[_0xab86('0x62')]}});}return null;})[_0xab86('0x1f')](handleEntityNotFound(_0x4b514a,null))[_0xab86('0x1f')](function(_0x3a22d4){if(_0x3a22d4){_0x5a291a['interaction']=_0x3a22d4[_0xab86('0x67')]({'plain':!![]});interaction_log[_0xab86('0x28')](_0xab86('0x79'),_0x4fe730[_0xab86('0x5f')]['id'],_0x4fe730[_0xab86('0x5f')][_0xab86('0x39')],_0x4fe730[_0xab86('0x5f')][_0xab86('0x68')],_0x5a291a['interaction']['id'],_0x4fe730[_0xab86('0x56')]?JSON[_0xab86('0x24')](_0x4fe730[_0xab86('0x56')]):_0xab86('0x69'));return respondWithRpcPromise(_0xab86('0x7a'),_0xab86('0x7b'),_0x5a291a);}return null;})['then'](function(_0x3667e4){var _0x1fd01b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3667e4[_0xab86('0x27')][_0xab86('0x6c')];return db[_0xab86('0x6d')][_0xab86('0x41')](_0x1fd01b,{'type':db[_0xab86('0x7c')]['QueryTypes'][_0xab86('0x6e')],'raw':!![]})[_0xab86('0x1f')](function(_0x103047){return _0x103047;});})[_0xab86('0x1f')](function(_0x84cb4e){if(_0x84cb4e){_0x5a291a[_0xab86('0x27')][_0xab86('0x7d')]=_0x84cb4e[0x0];if(!_0x4fe730[_0xab86('0x56')][_0xab86('0x5e')])return;return db[_0xab86('0x6f')][_0xab86('0x55')]({'where':{'id':_0x4fe730[_0xab86('0x56')]['UserId'],'role':_0xab86('0x60')},'attributes':['id','name',_0xab86('0x70'),_0xab86('0x71'),_0xab86('0x7e')],'raw':!![]});}return null;})[_0xab86('0x1f')](function(_0x416dd0){if(!_0x416dd0)return null;_0x5a291a['message'][_0xab86('0x60')]=_0x416dd0;return _0x5a291a;})[_0xab86('0x1f')](function(_0x1d7093){if(_0x1d7093){_0x1d7093[_0xab86('0x27')]['interface']=util[_0xab86('0x5d')](_0xab86('0x74'),_0x4fe730[_0xab86('0x5f')][_0xab86('0x39')]);_0x1d7093[_0xab86('0x27')]['channel']=_0x5a291a['channel'];_0x1d7093[_0xab86('0x27')][_0xab86('0x7f')]=_0x5a291a[_0xab86('0x75')];_0x1d7093['message']['event']=_0xab86('0x35');respondWithRpcPromise(_0xab86('0x77'),'EventManager',{'event':_0xab86('0x80'),'message':_0x1d7093[_0xab86('0x27')]},client9002);return _0x5a291a;}return null;})[_0xab86('0x1f')](respondWithResult(_0x4b514a,null))[_0xab86('0x2a')](handleError(_0x4b514a,null));};exports['create']=function(_0x3d9242,_0xac53cb){var _0x59dc26;return db['FaxMessage']['create'](_0x3d9242[_0xab86('0x56')],{})['then'](function(_0x262620){_0x59dc26=_0x262620;return db[_0xab86('0x81')][_0xab86('0x82')]({'where':{'id':_0x59dc26[_0xab86('0x6c')]}});})['then'](function(_0x1d917a){if(_[_0xab86('0x63')](_0x1d917a)){return;}else{_0x59dc26['fax']=_0x1d917a[_0xab86('0x5a')];return db[_0xab86('0x83')]['findOne']({'where':{'id':_0x59dc26[_0xab86('0x84')]}});}})[_0xab86('0x1f')](function(_0x146a95){return respondWithRpcPromise(_0xab86('0x85'),_0xab86('0x85'),{'FaxAccountId':_[_0xab86('0x63')](_0x3d9242[_0xab86('0x56')])?undefined:_0x3d9242[_0xab86('0x56')]['FaxAccountId'],'path':_[_0xab86('0x63')](_0x146a95)?undefined:util[_0xab86('0x5d')](_0xab86('0x86'),_0x146a95[_0xab86('0x87')]),'fax':_['isNil'](_0x59dc26[_0xab86('0x5a')])?undefined:_0x59dc26['fax'],'AttachmentId':_0x59dc26[_0xab86('0x84')]},client9002);})[_0xab86('0x1f')](respondWithResult(_0xac53cb,0xc9))[_0xab86('0x2a')](handleError(_0xac53cb,null));};exports[_0xab86('0x88')]=function(_0x5ece57,_0x39dffe){var _0x37ec54=path[_0xab86('0x89')](config['root'],_0xab86('0x8a'),'files',_0xab86('0x8b'));return db[_0xab86('0x3c')]['find']({'where':{'id':_0x5ece57[_0xab86('0x52')]['id']},'include':[{'model':db['Attachment'],'as':_0xab86('0x83')}]})[_0xab86('0x1f')](handleEntityNotFound(_0x39dffe,null))[_0xab86('0x1f')](function(_0x3b76cd){if(_0x3b76cd){return _0x39dffe[_0xab86('0x88')](path['join'](_0x37ec54,_0x3b76cd[_0xab86('0x83')][_0xab86('0x87')]));}})[_0xab86('0x2a')](handleError(_0x39dffe,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index f266abf..655d935 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 _0x2515=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x456000,_0x21cf68){var _0x2094e2=function(_0x58f3ca){while(--_0x58f3ca){_0x456000['push'](_0x456000['shift']());}};_0x2094e2(++_0x21cf68);}(_0x2515,0x1c2));var _0x5251=function(_0x14f5ed,_0x3fd34d){_0x14f5ed=_0x14f5ed-0x0;var _0x49f682=_0x2515[_0x14f5ed];return _0x49f682;};'use strict';var EventEmitter=require(_0x5251('0x0'));var FaxMessage=require(_0x5251('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x5251('0x2')](0x0);var events={'afterCreate':_0x5251('0x3'),'afterUpdate':_0x5251('0x4'),'afterDestroy':_0x5251('0x5')};function emitEvent(_0x4c95e4){return function(_0x20a3e1,_0x3fe745,_0x570b38){FaxMessageEvents[_0x5251('0x6')](_0x4c95e4+':'+_0x20a3e1['id'],_0x20a3e1);FaxMessageEvents[_0x5251('0x6')](_0x4c95e4,_0x20a3e1);_0x570b38(null);};}for(var e in events){if(events[_0x5251('0x7')](e)){var event=events[e];FaxMessage[_0x5251('0x8')](e,emitEvent(event));}}module[_0x5251('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x3714=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x5dfdc4,_0x4cc0c2){var _0x5227b7=function(_0xa395b2){while(--_0xa395b2){_0x5dfdc4['push'](_0x5dfdc4['shift']());}};_0x5227b7(++_0x4cc0c2);}(_0x3714,0x95));var _0x4371=function(_0x4ede4d,_0x3f4879){_0x4ede4d=_0x4ede4d-0x0;var _0x1d2f86=_0x3714[_0x4ede4d];return _0x1d2f86;};'use strict';var EventEmitter=require(_0x4371('0x0'));var FaxMessage=require(_0x4371('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4371('0x2')](0x0);var events={'afterCreate':_0x4371('0x3'),'afterUpdate':_0x4371('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21bccf){return function(_0x20929e,_0x2c0435,_0x5a2ffa){FaxMessageEvents[_0x4371('0x5')](_0x21bccf+':'+_0x20929e['id'],_0x20929e);FaxMessageEvents['emit'](_0x21bccf,_0x20929e);_0x5a2ffa(null);};}for(var e in events){if(events[_0x4371('0x6')](e)){var event=events[e];FaxMessage[_0x4371('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 8e1b619..9be8619 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 _0x50e8=['get','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','createdAt','catch','error','utf8mb4','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','fax_messages','body','FULLTEXT'];(function(_0x33edaa,_0x1b51f8){var _0x5ac492=function(_0x3099a9){while(--_0x3099a9){_0x33edaa['push'](_0x33edaa['shift']());}};_0x5ac492(++_0x1b51f8);}(_0x50e8,0x1a5));var _0x850e=function(_0xfd5f37,_0x24a79c){_0xfd5f37=_0xfd5f37-0x0;var _0x11bd01=_0x50e8[_0xfd5f37];return _0x11bd01;};'use strict';var _=require(_0x850e('0x0'));var util=require('util');var logger=require(_0x850e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x850e('0x2'));var rp=require(_0x850e('0x3'));var fs=require('fs');var path=require(_0x850e('0x4'));var rimraf=require('rimraf');var config=require(_0x850e('0x5'));var attributes=require('./faxMessage.attributes');module[_0x850e('0x6')]=function(_0x1721eb,_0x25b63a){return _0x1721eb[_0x850e('0x7')]('FaxMessage',attributes,{'tableName':_0x850e('0x8'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x850e('0x9')],'type':_0x850e('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x46c488,_0x5b6a60,_0x268c87){var _0x39b8b3=_0x1721eb['models'];var _0x4156b3=_0x46c488[_0x850e('0xb')]({'plain':!![]});if(_0x4156b3[_0x850e('0xc')][_0x850e('0xd')]()==='in'||_0x4156b3['direction'][_0x850e('0xd')]()===_0x850e('0xe')&&!_0x4156b3[_0x850e('0xf')]&&!_[_0x850e('0x10')](_0x4156b3[_0x850e('0x11')])){_0x39b8b3['FaxInteraction'][_0x850e('0x12')]({'where':{'id':_0x4156b3[_0x850e('0x13')]}})['then'](function(_0x32b28a){if(_0x32b28a){_0x32b28a['update']({'lastMsgAt':_0x4156b3[_0x850e('0x14')],'lastMsgDirection':_0x4156b3[_0x850e('0xc')]['toLowerCase']()});}})[_0x850e('0x15')](function(_0x5e8218){console[_0x850e('0x16')](_0x5e8218);});}_0x268c87();}},'charset':_0x850e('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xea5f=['fti_fax_messages','body','FULLTEXT','models','toLowerCase','direction','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0xea5f,0x8b));var _0xfea5=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xea5f[_0x11ce46];return _0x368a1e;};'use strict';var _=require(_0xfea5('0x0'));var util=require(_0xfea5('0x1'));var logger=require('../../config/logger')(_0xfea5('0x2'));var moment=require('moment');var BPromise=require(_0xfea5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfea5('0x4'));var rimraf=require('rimraf');var config=require(_0xfea5('0x5'));var attributes=require(_0xfea5('0x6'));module[_0xfea5('0x7')]=function(_0x40c9e,_0x4dc692){return _0x40c9e[_0xfea5('0x8')](_0xfea5('0x9'),attributes,{'tableName':_0xfea5('0xa'),'paranoid':![],'indexes':[{'name':_0xfea5('0xb'),'fields':[_0xfea5('0xc')],'type':_0xfea5('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b1f32,_0x665c46,_0x1056f7){var _0x304c57=_0x40c9e[_0xfea5('0xe')];var _0x33b17=_0x2b1f32['get']({'plain':!![]});if(_0x33b17['direction'][_0xfea5('0xf')]()==='in'||_0x33b17[_0xfea5('0x10')][_0xfea5('0xf')]()===_0xfea5('0x11')&&!_0x33b17[_0xfea5('0x12')]&&!_[_0xfea5('0x13')](_0x33b17[_0xfea5('0x14')])){_0x304c57[_0xfea5('0x15')]['findOne']({'where':{'id':_0x33b17[_0xfea5('0x16')]}})[_0xfea5('0x17')](function(_0x5c89a9){if(_0x5c89a9){_0x5c89a9[_0xfea5('0x18')]({'lastMsgAt':_0x33b17[_0xfea5('0x19')],'lastMsgDirection':_0x33b17[_0xfea5('0x10')][_0xfea5('0xf')]()});}})[_0xfea5('0x1a')](function(_0x484065){console[_0xfea5('0x1b')](_0x484065);});}_0x1056f7();}},'charset':_0xfea5('0x1c'),'collate':_0xfea5('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 43802bc..3402203 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 _0x7bae=['request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxMessage,\x20%s,\x20%s','create','body','options','raw','CreateFaxMessage','debug','FaxMessage','update','where','limit','UpdateFaxMessage','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','request','then','info'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x7bae[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});config[_0xe7ba('0xa')]=_[_0xe7ba('0xb')](config[_0xe7ba('0xa')],{'host':_0xe7ba('0xc'),'port':0x18eb});var socket=require(_0xe7ba('0xd'))(new Redis(config[_0xe7ba('0xa')]));require(_0xe7ba('0xe'))['register'](socket);function respondWithRpcPromise(_0x3df8bf,_0xe57e33,_0x375ebb){return new BPromise(function(_0x276bc3,_0x15083a){return client[_0xe7ba('0xf')](_0x3df8bf,_0x375ebb)[_0xe7ba('0x10')](function(_0x448bcc){logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0xe7ba('0x12'));logger['debug'](_0xe7ba('0x13'),_0xe57e33,_0xe7ba('0x12'),JSON[_0xe7ba('0x14')](_0x448bcc));if(_0x448bcc[_0xe7ba('0x15')]){if(_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x16')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x17')]);return _0x15083a(_0x448bcc[_0xe7ba('0x15')]['message']);}logger[_0xe7ba('0x15')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc['error']['message']);return _0x276bc3(_0x448bcc[_0xe7ba('0x15')]['message']);}else{logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,'request\x20sent');_0x276bc3(_0x448bcc['result'][_0xe7ba('0x17')]);}})[_0xe7ba('0x18')](function(_0x39ca38){logger[_0xe7ba('0x15')](_0xe7ba('0x19'),_0xe57e33,_0x39ca38);_0x15083a(_0x39ca38);});});}exports['CreateFaxMessage']=function(_0x149c62){var _0x20c653=this;return new Promise(function(_0x3b40fb,_0x136ec6){return db['FaxMessage'][_0xe7ba('0x1a')](_0x149c62[_0xe7ba('0x1b')],{'raw':_0x149c62['options']?_0x149c62[_0xe7ba('0x1c')][_0xe7ba('0x1d')]===undefined?!![]:![]:!![]})[_0xe7ba('0x10')](function(_0x7ab9e4){logger[_0xe7ba('0x11')](_0xe7ba('0x1e'),_0x149c62);logger[_0xe7ba('0x1f')](_0xe7ba('0x1e'),_0x149c62,JSON[_0xe7ba('0x14')](_0x7ab9e4));_0x3b40fb(_0x7ab9e4);})[_0xe7ba('0x18')](function(_0x58cf43){logger['error']('CreateFaxMessage',_0x58cf43['message'],_0x149c62);_0x136ec6(_0x20c653[_0xe7ba('0x15')](0x1f4,_0x58cf43['message']));});});};exports['UpdateFaxMessage']=function(_0x5ece11){var _0x255def=this;return new Promise(function(_0x32cc00,_0xe32862){return db[_0xe7ba('0x20')][_0xe7ba('0x21')](_0x5ece11[_0xe7ba('0x1b')],{'raw':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11['options'][_0xe7ba('0x22')]||null:null,'attributes':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['attributes']||null:null,'limit':_0x5ece11['options']?_0x5ece11[_0xe7ba('0x1c')][_0xe7ba('0x23')]||null:null})[_0xe7ba('0x10')](function(_0x20b6cd){logger[_0xe7ba('0x11')]('UpdateFaxMessage',_0x5ece11);logger[_0xe7ba('0x1f')](_0xe7ba('0x24'),_0x5ece11,JSON['stringify'](_0x20b6cd));_0x32cc00(_0x20b6cd);})[_0xe7ba('0x18')](function(_0x530227){logger['error'](_0xe7ba('0x24'),_0x530227[_0xe7ba('0x17')],_0x5ece11);_0xe32862(_0x255def[_0xe7ba('0x15')](0x1f4,_0x530227['message']));});});}; \ No newline at end of file +var _0x70e0=['FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','CreateFaxMessage','FaxMessage','create','body','options','stringify','catch','update','raw','where','limit','UpdateFaxMessage','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info'];(function(_0x41a1f5,_0x11b2b0){var _0x3c088c=function(_0x3741f1){while(--_0x3741f1){_0x41a1f5['push'](_0x41a1f5['shift']());}};_0x3c088c(++_0x11b2b0);}(_0x70e0,0x17b));var _0x070e=function(_0x3a6c41,_0x555a8b){_0x3a6c41=_0x3a6c41-0x0;var _0x3a9bb7=_0x70e0[_0x3a6c41];return _0x3a9bb7;};'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});config['redis']=_['defaults'](config[_0x070e('0x9')],{'host':_0x070e('0xa'),'port':0x18eb});var socket=require(_0x070e('0xb'))(new Redis(config[_0x070e('0x9')]));require(_0x070e('0xc'))[_0x070e('0xd')](socket);function respondWithRpcPromise(_0x11ffa8,_0x4e99e6,_0x49b2fb){return new BPromise(function(_0x50f4eb,_0x2e3e5e){return client[_0x070e('0xe')](_0x11ffa8,_0x49b2fb)[_0x070e('0xf')](function(_0xa927a2){logger[_0x070e('0x10')](_0x070e('0x11'),_0x4e99e6,_0x070e('0x12'));logger[_0x070e('0x13')](_0x070e('0x14'),_0x4e99e6,_0x070e('0x12'),JSON['stringify'](_0xa927a2));if(_0xa927a2['error']){if(_0xa927a2[_0x070e('0x15')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x4e99e6,_0xa927a2[_0x070e('0x15')][_0x070e('0x16')]);return _0x2e3e5e(_0xa927a2['error']['message']);}logger[_0x070e('0x15')](_0x070e('0x11'),_0x4e99e6,_0xa927a2[_0x070e('0x15')][_0x070e('0x16')]);return _0x50f4eb(_0xa927a2['error']['message']);}else{logger[_0x070e('0x10')](_0x070e('0x11'),_0x4e99e6,_0x070e('0x12'));_0x50f4eb(_0xa927a2[_0x070e('0x17')][_0x070e('0x16')]);}})['catch'](function(_0x3938b5){logger[_0x070e('0x15')](_0x070e('0x11'),_0x4e99e6,_0x3938b5);_0x2e3e5e(_0x3938b5);});});}exports[_0x070e('0x18')]=function(_0x259893){var _0x5c16fd=this;return new Promise(function(_0x5b2f48,_0x4e958f){return db[_0x070e('0x19')][_0x070e('0x1a')](_0x259893[_0x070e('0x1b')],{'raw':_0x259893['options']?_0x259893[_0x070e('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x070e('0xf')](function(_0x3f6985){logger[_0x070e('0x10')](_0x070e('0x18'),_0x259893);logger[_0x070e('0x13')](_0x070e('0x18'),_0x259893,JSON[_0x070e('0x1d')](_0x3f6985));_0x5b2f48(_0x3f6985);})[_0x070e('0x1e')](function(_0x595c7e){logger[_0x070e('0x15')](_0x070e('0x18'),_0x595c7e[_0x070e('0x16')],_0x259893);_0x4e958f(_0x5c16fd['error'](0x1f4,_0x595c7e[_0x070e('0x16')]));});});};exports['UpdateFaxMessage']=function(_0x4a2dbd){var _0x2ccbd7=this;return new Promise(function(_0x25f6e,_0x41deb1){return db[_0x070e('0x19')][_0x070e('0x1f')](_0x4a2dbd['body'],{'raw':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')][_0x070e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')][_0x070e('0x21')]||null:null,'attributes':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')]['attributes']||null:null,'limit':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')][_0x070e('0x22')]||null:null})['then'](function(_0x5c5f0d){logger[_0x070e('0x10')](_0x070e('0x23'),_0x4a2dbd);logger[_0x070e('0x13')]('UpdateFaxMessage',_0x4a2dbd,JSON[_0x070e('0x1d')](_0x5c5f0d));_0x25f6e(_0x5c5f0d);})[_0x070e('0x1e')](function(_0x3a9425){logger[_0x070e('0x15')]('UpdateFaxMessage',_0x3a9425['message'],_0x4a2dbd);_0x41deb1(_0x2ccbd7['error'](0x1f4,_0x3a9425['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 7c299ae..2e24854 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 _0x6ca6=['faxMessage:','./faxMessage.events','remove','emit','removeListener','register','length'];(function(_0x5ff517,_0x3e4ee0){var _0x19a245=function(_0x4c00ac){while(--_0x4c00ac){_0x5ff517['push'](_0x5ff517['shift']());}};_0x19a245(++_0x3e4ee0);}(_0x6ca6,0x13c));var _0x66ca=function(_0x19d1d5,_0x1bc696){_0x19d1d5=_0x19d1d5-0x0;var _0x2a38fc=_0x6ca6[_0x19d1d5];return _0x2a38fc;};'use strict';var FaxMessageEvents=require(_0x66ca('0x0'));var events=['save',_0x66ca('0x1'),'update'];function createListener(_0x431098,_0x3222f7){return function(_0x499437){_0x3222f7[_0x66ca('0x2')](_0x431098,_0x499437);};}function removeListener(_0x3668d8,_0x34ec76){return function(){FaxMessageEvents[_0x66ca('0x3')](_0x3668d8,_0x34ec76);};}exports[_0x66ca('0x4')]=function(_0xe93c50){for(var _0x2efa4f=0x0,_0xfc51dd=events[_0x66ca('0x5')];_0x2efa4f<_0xfc51dd;_0x2efa4f++){var _0x40e667=events[_0x2efa4f];var _0x43f3f3=createListener(_0x66ca('0x6')+_0x40e667,_0xe93c50);FaxMessageEvents['on'](_0x40e667,_0x43f3f3);}}; \ No newline at end of file +var _0x2cf1=['length','faxMessage:','./faxMessage.events','save','remove','removeListener','register'];(function(_0x1b5cf4,_0x2afc19){var _0x345752=function(_0xe85401){while(--_0xe85401){_0x1b5cf4['push'](_0x1b5cf4['shift']());}};_0x345752(++_0x2afc19);}(_0x2cf1,0x113));var _0x12cf=function(_0x26a942,_0x3df6d4){_0x26a942=_0x26a942-0x0;var _0x13b9b9=_0x2cf1[_0x26a942];return _0x13b9b9;};'use strict';var FaxMessageEvents=require(_0x12cf('0x0'));var events=[_0x12cf('0x1'),_0x12cf('0x2'),'update'];function createListener(_0x4850cd,_0x2253fc){return function(_0x101fdc){_0x2253fc['emit'](_0x4850cd,_0x101fdc);};}function removeListener(_0x2aa383,_0x350a32){return function(){FaxMessageEvents[_0x12cf('0x3')](_0x2aa383,_0x350a32);};}exports[_0x12cf('0x4')]=function(_0x1b51e6){for(var _0x1c1542=0x0,_0x4c1d1a=events[_0x12cf('0x5')];_0x1c1542<_0x4c1d1a;_0x1c1542++){var _0x484063=events[_0x1c1542];var _0x890a60=createListener(_0x12cf('0x6')+_0x484063,_0x1b51e6);FaxMessageEvents['on'](_0x484063,_0x890a60);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 5911f06..01012ae 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 _0xda3f=['create','put','/:id/accept','/:id/reject','destroy','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create'];(function(_0x1a02cd,_0x469319){var _0x555453=function(_0x17ae4a){while(--_0x17ae4a){_0x1a02cd['push'](_0x1a02cd['shift']());}};_0x555453(++_0x469319);}(_0xda3f,0xec));var _0xfda3=function(_0x5aecfe,_0x1dad8d){_0x5aecfe=_0x5aecfe-0x0;var _0x44de4d=_0xda3f[_0x5aecfe];return _0x44de4d;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./faxMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')]('/',auth['isAuthenticated'](),interaction[_0xfda3('0xe')](_0xfda3('0xf'),_0xfda3('0x10')),controller[_0xfda3('0x11')]);router[_0xfda3('0x12')]('/:id',auth[_0xfda3('0x6')](),controller['update']);router[_0xfda3('0x12')](_0xfda3('0x13'),auth['isAuthenticated'](),controller['accept']);router['put'](_0xfda3('0x14'),auth[_0xfda3('0x6')](),controller['reject']);router['delete']('/:id',auth[_0xfda3('0x6')](),controller[_0xfda3('0x15')]);module[_0xfda3('0x16')]=router; \ No newline at end of file +var _0xdace=['/describe','describe','/:id','show','download','tracked','fax','create','update','put','/:id/accept','accept','reject','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x17ccc8,_0x5e79ed){var _0x23609b=function(_0x512db6){while(--_0x512db6){_0x17ccc8['push'](_0x17ccc8['shift']());}};_0x23609b(++_0x5e79ed);}(_0xdace,0xc5));var _0xedac=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xdace[_0x9fd887];return _0x1a54ab;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var fs_extra=require(_0xedac('0x4'));var auth=require(_0xedac('0x5'));var interaction=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var controller=require('./faxMessage.controller');router[_0xedac('0x8')]('/',auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router['get'](_0xedac('0xb'),auth[_0xedac('0x9')](),controller[_0xedac('0xc')]);router['get'](_0xedac('0xd'),auth[_0xedac('0x9')](),controller[_0xedac('0xe')]);router['get']('/:id/download',auth[_0xedac('0x9')](),controller[_0xedac('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xedac('0x10')](_0xedac('0x11'),'faxmessage:create'),controller[_0xedac('0x12')]);router['put'](_0xedac('0xd'),auth[_0xedac('0x9')](),controller[_0xedac('0x13')]);router[_0xedac('0x14')](_0xedac('0x15'),auth[_0xedac('0x9')](),controller[_0xedac('0x16')]);router[_0xedac('0x14')]('/:id/reject',auth[_0xedac('0x9')](),controller[_0xedac('0x17')]);router[_0xedac('0x18')](_0xedac('0xd'),auth[_0xedac('0x9')](),controller['destroy']);module[_0xedac('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 00406c5..f366065 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 _0xc9b0=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x1bd1f3,_0x3c6601){var _0x359317=function(_0x452d29){while(--_0x452d29){_0x1bd1f3['push'](_0x1bd1f3['shift']());}};_0x359317(++_0x3c6601);}(_0xc9b0,0x14c));var _0x0c9b=function(_0x423e39,_0x3ea4a2){_0x423e39=_0x423e39-0x0;var _0x385fd1=_0xc9b0[_0x423e39];return _0x385fd1;};'use strict';var Sequelize=require(_0x0c9b('0x0'));module[_0x0c9b('0x1')]={'name':{'type':Sequelize[_0x0c9b('0x2')],'unique':_0x0c9b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0c9b('0x2')]},'timeout':{'type':Sequelize[_0x0c9b('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0c9b('0x5')](_0x0c9b('0x6'),_0x0c9b('0x7'),_0x0c9b('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x0c9b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0324=['INTEGER','ENUM','beepall','roundrobin','exports','STRING','name'];(function(_0x584da3,_0x388a44){var _0x37aeb9=function(_0x1f5b77){while(--_0x1f5b77){_0x584da3['push'](_0x584da3['shift']());}};_0x37aeb9(++_0x388a44);}(_0x0324,0x90));var _0x4032=function(_0xc05485,_0x583b36){_0xc05485=_0xc05485-0x0;var _0x535142=_0x0324[_0xc05485];return _0x535142;};'use strict';var Sequelize=require('sequelize');module[_0x4032('0x0')]={'name':{'type':Sequelize[_0x4032('0x1')],'unique':_0x4032('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4032('0x1')]},'timeout':{'type':Sequelize[_0x4032('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4032('0x4')]('rrmemory',_0x4032('0x5'),_0x4032('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x4032('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 3c4bfa4..1530bbb 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 _0xfb1c=['findAndCountAll','UserId','agent','updatedAt','rows','SIP','createdAt','getTeams','Team','addTeams','User','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','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/license/util','redis','./faxQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','FaxQueues','UserProfileResource','sendStatus','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','findAll','catch','show','params','filters','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','FaxQueueId'];(function(_0x2803ab,_0x1c33f2){var _0x3d6e8e=function(_0x8a86f1){while(--_0x8a86f1){_0x2803ab['push'](_0x2803ab['shift']());}};_0x3d6e8e(++_0x1c33f2);}(_0xfb1c,0x150));var _0xcfb1=function(_0x485907,_0x47224d){_0x485907=_0x485907-0x0;var _0x3ed143=_0xfb1c[_0x485907];return _0x3ed143;};'use strict';var emlformat=require(_0xcfb1('0x0'));var rimraf=require(_0xcfb1('0x1'));var zipdir=require(_0xcfb1('0x2'));var jsonpatch=require(_0xcfb1('0x3'));var rp=require('request-promise');var moment=require(_0xcfb1('0x4'));var BPromise=require(_0xcfb1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcfb1('0x6'));var sox=require(_0xcfb1('0x7'));var csv=require(_0xcfb1('0x8'));var ejs=require(_0xcfb1('0x9'));var fs=require('fs');var fs_extra=require(_0xcfb1('0xa'));var _=require(_0xcfb1('0xb'));var squel=require(_0xcfb1('0xc'));var crypto=require(_0xcfb1('0xd'));var jsforce=require(_0xcfb1('0xe'));var deskjs=require(_0xcfb1('0xf'));var toCsv=require(_0xcfb1('0x8'));var querystring=require(_0xcfb1('0x10'));var Papa=require(_0xcfb1('0x11'));var Redis=require(_0xcfb1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xcfb1('0x13'));var as=require(_0xcfb1('0x14'));var hardwareService=require(_0xcfb1('0x15'));var logger=require(_0xcfb1('0x16'))(_0xcfb1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcfb1('0x18'));var db=require('../../mysqldb')['db'];config[_0xcfb1('0x19')]=_['defaults'](config[_0xcfb1('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcfb1('0x19')]));require(_0xcfb1('0x1a'))[_0xcfb1('0x1b')](socket);function respondWithStatusCode(_0x518c13,_0x5efeb8){_0x5efeb8=_0x5efeb8||0xcc;return function(_0x406784){if(_0x406784){return _0x518c13['sendStatus'](_0x5efeb8);}return _0x518c13[_0xcfb1('0x1c')](_0x5efeb8)[_0xcfb1('0x1d')]();};}function respondWithResult(_0x351d53,_0x45473d){_0x45473d=_0x45473d||0xc8;return function(_0x165639){if(_0x165639){return _0x351d53[_0xcfb1('0x1c')](_0x45473d)[_0xcfb1('0x1e')](_0x165639);}};}function respondWithFilteredResult(_0x33d82b,_0x2929ba){return function(_0x3da71d){if(_0x3da71d){var _0x41cc41=typeof _0x2929ba[_0xcfb1('0x1f')]===_0xcfb1('0x20')&&typeof _0x2929ba[_0xcfb1('0x21')]===_0xcfb1('0x20');var _0x27c7c8=_0x3da71d[_0xcfb1('0x22')];var _0x1c9434=_0x41cc41?0x0:_0x2929ba[_0xcfb1('0x1f')];var _0x10e401=_0x41cc41?_0x3da71d[_0xcfb1('0x22')]:_0x2929ba[_0xcfb1('0x1f')]+_0x2929ba[_0xcfb1('0x21')];var _0x3ded68;if(_0x10e401>=_0x27c7c8){_0x10e401=_0x27c7c8;_0x3ded68=0xc8;}else{_0x3ded68=0xce;}_0x33d82b['status'](_0x3ded68);return _0x33d82b[_0xcfb1('0x23')](_0xcfb1('0x24'),_0x1c9434+'-'+_0x10e401+'/'+_0x27c7c8)[_0xcfb1('0x1e')](_0x3da71d);}return null;};}function patchUpdates(_0x460f5a){return function(_0x480f11){try{jsonpatch[_0xcfb1('0x25')](_0x480f11,_0x460f5a,!![]);}catch(_0x4cee4d){return BPromise['reject'](_0x4cee4d);}return _0x480f11[_0xcfb1('0x26')]();};}function saveUpdates(_0x212988,_0x12caf0){return function(_0x21eca4){if(_0x21eca4){return _0x21eca4[_0xcfb1('0x27')](_0x212988)[_0xcfb1('0x28')](function(_0xa3221d){return _0xa3221d;});}return null;};}function removeEntity(_0x29b2b2,_0x171699){return function(_0x567d83){if(_0x567d83){return _0x567d83[_0xcfb1('0x29')]()[_0xcfb1('0x28')](function(){var _0x4f837d=_0x567d83[_0xcfb1('0x2a')]({'plain':!![]});var _0x4924ee=_0xcfb1('0x2b');return db[_0xcfb1('0x2c')][_0xcfb1('0x29')]({'where':{'type':_0x4924ee,'resourceId':_0x4f837d['id']}})[_0xcfb1('0x28')](function(){return _0x567d83;});})['then'](function(){_0x29b2b2[_0xcfb1('0x1c')](0xcc)[_0xcfb1('0x1d')]();});}};}function handleEntityNotFound(_0x3ee5ee,_0x3ae9a4){return function(_0x21030a){if(!_0x21030a){_0x3ee5ee[_0xcfb1('0x2d')](0x194);}return _0x21030a;};}function handleError(_0x257a35,_0x2b3b43){_0x2b3b43=_0x2b3b43||0x1f4;return function(_0x255c13){logger['error'](_0x255c13[_0xcfb1('0x2e')]);if(_0x255c13[_0xcfb1('0x2f')]){delete _0x255c13[_0xcfb1('0x2f')];}_0x257a35[_0xcfb1('0x1c')](_0x2b3b43)[_0xcfb1('0x30')](_0x255c13);};}exports[_0xcfb1('0x31')]=function(_0x5f5d70,_0x441366){var _0x294703={},_0xa3ece2={},_0x328e86={'count':0x0,'rows':[]};var _0x3540ce=_['map'](db[_0xcfb1('0x32')][_0xcfb1('0x33')],function(_0x2e7a9e){return{'name':_0x2e7a9e[_0xcfb1('0x34')],'type':_0x2e7a9e[_0xcfb1('0x35')][_0xcfb1('0x36')]};});_0xa3ece2['model']=_['map'](_0x3540ce,'name');_0xa3ece2[_0xcfb1('0x37')]=_[_0xcfb1('0x38')](_0x5f5d70[_0xcfb1('0x37')]);_0xa3ece2['filters']=_['intersection'](_0xa3ece2[_0xcfb1('0x39')],_0xa3ece2[_0xcfb1('0x37')]);_0x294703['attributes']=_[_0xcfb1('0x3a')](_0xa3ece2['model'],qs[_0xcfb1('0x3b')](_0x5f5d70[_0xcfb1('0x37')]['fields']));_0x294703[_0xcfb1('0x3c')]=_0x294703[_0xcfb1('0x3c')][_0xcfb1('0x3d')]?_0x294703['attributes']:_0xa3ece2[_0xcfb1('0x39')];if(!_0x5f5d70[_0xcfb1('0x37')][_0xcfb1('0x3e')](_0xcfb1('0x3f'))){_0x294703[_0xcfb1('0x21')]=qs[_0xcfb1('0x21')](_0x5f5d70[_0xcfb1('0x37')]['limit']);_0x294703['offset']=qs['offset'](_0x5f5d70['query'][_0xcfb1('0x1f')]);}_0x294703[_0xcfb1('0x40')]=qs['sort'](_0x5f5d70[_0xcfb1('0x37')][_0xcfb1('0x41')]);_0x294703[_0xcfb1('0x42')]=qs['filters'](_[_0xcfb1('0x43')](_0x5f5d70[_0xcfb1('0x37')],_0xa3ece2['filters']),_0x3540ce);if(_0x5f5d70[_0xcfb1('0x37')][_0xcfb1('0x44')]){_0x294703['where']=_[_0xcfb1('0x45')](_0x294703['where'],{'$or':_[_0xcfb1('0x46')](_0x3540ce,function(_0x2caa7b){if(_0x2caa7b['type']!=='VIRTUAL'){var _0x20a756={};_0x20a756[_0x2caa7b[_0xcfb1('0x2f')]]={'$like':'%'+_0x5f5d70[_0xcfb1('0x37')][_0xcfb1('0x44')]+'%'};return _0x20a756;}})});}_0x294703=_['merge']({},_0x294703,_0x5f5d70['options']);var _0xef66c7={'where':_0x294703['where']};return db['FaxQueue'][_0xcfb1('0x22')](_0xef66c7)[_0xcfb1('0x28')](function(_0x46c833){_0x328e86[_0xcfb1('0x22')]=_0x46c833;if(_0x5f5d70[_0xcfb1('0x37')][_0xcfb1('0x47')]){_0x294703['include']=[{'all':!![]}];}return db[_0xcfb1('0x32')][_0xcfb1('0x48')](_0x294703);})[_0xcfb1('0x28')](function(_0x2c2de4){_0x328e86['rows']=_0x2c2de4;return _0x328e86;})[_0xcfb1('0x28')](respondWithFilteredResult(_0x441366,_0x294703))[_0xcfb1('0x49')](handleError(_0x441366,null));};exports[_0xcfb1('0x4a')]=function(_0x16c842,_0x1d9091){var _0x37e874={'raw':!![],'where':{'id':_0x16c842[_0xcfb1('0x4b')]['id']}},_0x3f9785={};_0x3f9785[_0xcfb1('0x39')]=_[_0xcfb1('0x38')](db[_0xcfb1('0x32')][_0xcfb1('0x33')]);_0x3f9785[_0xcfb1('0x37')]=_['keys'](_0x16c842[_0xcfb1('0x37')]);_0x3f9785[_0xcfb1('0x4c')]=_[_0xcfb1('0x3a')](_0x3f9785[_0xcfb1('0x39')],_0x3f9785[_0xcfb1('0x37')]);_0x37e874['attributes']=_[_0xcfb1('0x3a')](_0x3f9785[_0xcfb1('0x39')],qs[_0xcfb1('0x3b')](_0x16c842[_0xcfb1('0x37')][_0xcfb1('0x3b')]));_0x37e874[_0xcfb1('0x3c')]=_0x37e874['attributes'][_0xcfb1('0x3d')]?_0x37e874[_0xcfb1('0x3c')]:_0x3f9785[_0xcfb1('0x39')];if(_0x16c842[_0xcfb1('0x37')][_0xcfb1('0x47')]){_0x37e874['include']=[{'all':!![]}];}_0x37e874=_[_0xcfb1('0x45')]({},_0x37e874,_0x16c842[_0xcfb1('0x4d')]);return db['FaxQueue'][_0xcfb1('0x4e')](_0x37e874)[_0xcfb1('0x28')](handleEntityNotFound(_0x1d9091,null))['then'](respondWithResult(_0x1d9091,null))[_0xcfb1('0x49')](handleError(_0x1d9091,null));};exports['create']=function(_0x3e93e3,_0x3fadaf){return db['FaxQueue']['create'](_0x3e93e3[_0xcfb1('0x4f')],{})['then'](function(_0x435e77){var _0x46b7c1=_0x3e93e3[_0xcfb1('0x50')][_0xcfb1('0x2a')]({'plain':!![]});if(!_0x46b7c1)throw new Error(_0xcfb1('0x51'));if(_0x46b7c1[_0xcfb1('0x52')]===_0xcfb1('0x50')){var _0x5583a0=_0x435e77['get']({'plain':!![]});var _0x6b1970='FaxQueues';return db[_0xcfb1('0x53')][_0xcfb1('0x4e')]({'where':{'name':_0x6b1970,'userProfileId':_0x46b7c1['userProfileId']},'raw':!![]})['then'](function(_0x33cfdd){if(_0x33cfdd&&_0x33cfdd[_0xcfb1('0x54')]===0x0){return db[_0xcfb1('0x2c')][_0xcfb1('0x55')]({'name':_0x5583a0[_0xcfb1('0x2f')],'resourceId':_0x5583a0['id'],'type':_0x33cfdd['name'],'sectionId':_0x33cfdd['id']},{})[_0xcfb1('0x28')](function(){return _0x435e77;});}else{return _0x435e77;}})[_0xcfb1('0x49')](function(_0xe973a9){logger[_0xcfb1('0x56')](_0xcfb1('0x57'),_0xe973a9);throw _0xe973a9;});}return _0x435e77;})[_0xcfb1('0x28')](respondWithResult(_0x3fadaf,0xc9))[_0xcfb1('0x49')](handleError(_0x3fadaf,null));};exports[_0xcfb1('0x27')]=function(_0x1dd34d,_0x224622){if(_0x1dd34d['body']['id']){delete _0x1dd34d['body']['id'];}return db[_0xcfb1('0x32')][_0xcfb1('0x4e')]({'where':{'id':_0x1dd34d['params']['id']}})[_0xcfb1('0x28')](handleEntityNotFound(_0x224622,null))['then'](saveUpdates(_0x1dd34d['body'],null))[_0xcfb1('0x28')](respondWithResult(_0x224622,null))[_0xcfb1('0x49')](handleError(_0x224622,null));};exports[_0xcfb1('0x29')]=function(_0x1efa43,_0x254f4b){return db[_0xcfb1('0x32')][_0xcfb1('0x4e')]({'where':{'id':_0x1efa43[_0xcfb1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x254f4b,null))['then'](removeEntity(_0x254f4b,null))[_0xcfb1('0x49')](handleError(_0x254f4b,null));};exports['describe']=function(_0x6da768,_0x21a87f){return db[_0xcfb1('0x32')][_0xcfb1('0x58')]()[_0xcfb1('0x28')](respondWithResult(_0x21a87f,null))[_0xcfb1('0x49')](handleError(_0x21a87f,null));};exports[_0xcfb1('0x59')]=function(_0x53ddd9,_0x3d3231,_0x5d6815){var _0x1d442a={'raw':!![],'where':{}},_0xdfdf69={},_0x5d861b;return db[_0xcfb1('0x32')][_0xcfb1('0x5a')]({'where':{'id':_0x53ddd9['params']['id']}})['then'](handleEntityNotFound(_0x3d3231,null))[_0xcfb1('0x28')](function(_0x2d1142){if(_0x2d1142){_0x5d861b=_0x2d1142[_0xcfb1('0x2a')]({'plain':!![]});_0xdfdf69[_0xcfb1('0x39')]=_[_0xcfb1('0x38')](db[_0xcfb1('0x5b')][_0xcfb1('0x33')]);_0xdfdf69['query']=_[_0xcfb1('0x38')](_0x53ddd9[_0xcfb1('0x37')]);_0xdfdf69[_0xcfb1('0x4c')]=_[_0xcfb1('0x3a')](_0xdfdf69[_0xcfb1('0x39')],_0xdfdf69[_0xcfb1('0x37')]);_0x1d442a['attributes']=_['intersection'](_0xdfdf69['model'],qs['fields'](_0x53ddd9['query'][_0xcfb1('0x3b')]));_0x1d442a[_0xcfb1('0x3c')]=_0x1d442a[_0xcfb1('0x3c')][_0xcfb1('0x3d')]?_0x1d442a['attributes']:_0xdfdf69[_0xcfb1('0x39')];if(!_0x53ddd9[_0xcfb1('0x37')][_0xcfb1('0x3e')](_0xcfb1('0x3f'))){_0x1d442a[_0xcfb1('0x21')]=qs['limit'](_0x53ddd9[_0xcfb1('0x37')][_0xcfb1('0x21')]);_0x1d442a[_0xcfb1('0x1f')]=qs[_0xcfb1('0x1f')](_0x53ddd9[_0xcfb1('0x37')][_0xcfb1('0x1f')]);}_0x1d442a[_0xcfb1('0x40')]=qs[_0xcfb1('0x41')](_0x53ddd9[_0xcfb1('0x37')][_0xcfb1('0x41')]);_0x1d442a[_0xcfb1('0x42')]=qs[_0xcfb1('0x4c')](_[_0xcfb1('0x43')](_0x53ddd9[_0xcfb1('0x37')],_0xdfdf69[_0xcfb1('0x4c')]));_0x1d442a[_0xcfb1('0x42')][_0xcfb1('0x5c')]=_0x2d1142['id'];if(_0x53ddd9[_0xcfb1('0x37')][_0xcfb1('0x44')]){_0x1d442a[_0xcfb1('0x42')]=_[_0xcfb1('0x45')](_0x1d442a[_0xcfb1('0x42')],{'$or':_[_0xcfb1('0x46')](_0x1d442a[_0xcfb1('0x3c')],function(_0x453fb6){var _0x575569={};_0x575569[_0x453fb6]={'$like':'%'+_0x53ddd9[_0xcfb1('0x37')]['filter']+'%'};return _0x575569;})});}_0x1d442a=_['merge']({},_0x1d442a,_0x53ddd9[_0xcfb1('0x4d')]);return db['UserFaxQueue'][_0xcfb1('0x48')](_0x1d442a);}})['then'](function(_0x5cdf67){if(_0x5cdf67){return db['User'][_0xcfb1('0x5d')]({'where':{'id':_['map'](_0x5cdf67,_0xcfb1('0x5e')),'role':_0xcfb1('0x5f')},'attributes':['id',_0xcfb1('0x2f'),'faxPause',_0xcfb1('0x60'),'createdAt']});}})[_0xcfb1('0x28')](function(_0x450842){if(_0x450842){return{'count':_0x450842[_0xcfb1('0x22')],'rows':_['map'](_0x450842[_0xcfb1('0x61')],function(_0x368a5f){return{'membername':_0x368a5f['name'],'UserId':_0x368a5f['id'],'queue_name':_0x5d861b[_0xcfb1('0x2f')],'FaxQueueId':_0x5d861b['id'],'interface':util['format']('%s/%s',_0xcfb1('0x62'),_0x368a5f[_0xcfb1('0x2f')]),'penalty':0x0,'paused':_0x368a5f['faxPause'],'createdAt':_0x368a5f[_0xcfb1('0x63')],'updatedAt':_0x368a5f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xcfb1('0x28')](respondWithFilteredResult(_0x3d3231,_0x1d442a))[_0xcfb1('0x49')](handleError(_0x3d3231,null));};exports[_0xcfb1('0x64')]=function(_0x56470c,_0x1341a4,_0xc18e3c){var _0x4a654d={};var _0x14a388={};var _0x24e5cb;var _0x57da2d;return db[_0xcfb1('0x32')][_0xcfb1('0x5a')]({'where':{'id':_0x56470c[_0xcfb1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1341a4,null))[_0xcfb1('0x28')](function(_0x51fe24){if(_0x51fe24){_0x24e5cb=_0x51fe24;_0x14a388[_0xcfb1('0x39')]=_[_0xcfb1('0x38')](db[_0xcfb1('0x65')]['rawAttributes']);_0x14a388[_0xcfb1('0x37')]=_['keys'](_0x56470c[_0xcfb1('0x37')]);_0x14a388['filters']=_[_0xcfb1('0x3a')](_0x14a388[_0xcfb1('0x39')],_0x14a388[_0xcfb1('0x37')]);_0x4a654d[_0xcfb1('0x3c')]=_[_0xcfb1('0x3a')](_0x14a388[_0xcfb1('0x39')],qs[_0xcfb1('0x3b')](_0x56470c[_0xcfb1('0x37')]['fields']));_0x4a654d[_0xcfb1('0x3c')]=_0x4a654d[_0xcfb1('0x3c')]['length']?_0x4a654d[_0xcfb1('0x3c')]:_0x14a388['model'];_0x4a654d['order']=qs[_0xcfb1('0x41')](_0x56470c[_0xcfb1('0x37')][_0xcfb1('0x41')]);_0x4a654d[_0xcfb1('0x42')]=qs[_0xcfb1('0x4c')](_['pick'](_0x56470c['query'],_0x14a388[_0xcfb1('0x4c')]));if(_0x56470c[_0xcfb1('0x37')]['filter']){_0x4a654d[_0xcfb1('0x42')]=_['merge'](_0x4a654d['where'],{'$or':_['map'](_0x4a654d['attributes'],function(_0x450538){var _0x2a3675={};_0x2a3675[_0x450538]={'$like':'%'+_0x56470c['query']['filter']+'%'};return _0x2a3675;})});}_0x4a654d=_[_0xcfb1('0x45')]({},_0x4a654d,_0x56470c[_0xcfb1('0x4d')]);return _0x24e5cb[_0xcfb1('0x64')](_0x4a654d);}})[_0xcfb1('0x28')](function(_0x38224f){if(_0x38224f){_0x57da2d=_0x38224f[_0xcfb1('0x3d')];if(!_0x56470c[_0xcfb1('0x37')][_0xcfb1('0x3e')]('nolimit')){_0x4a654d[_0xcfb1('0x21')]=qs[_0xcfb1('0x21')](_0x56470c[_0xcfb1('0x37')]['limit']);_0x4a654d['offset']=qs['offset'](_0x56470c[_0xcfb1('0x37')][_0xcfb1('0x1f')]);}return _0x24e5cb[_0xcfb1('0x64')](_0x4a654d);}})[_0xcfb1('0x28')](function(_0x18b092){if(_0x18b092){return _0x18b092?{'count':_0x57da2d,'rows':_0x18b092}:null;}})['then'](respondWithResult(_0x1341a4,null))[_0xcfb1('0x49')](handleError(_0x1341a4,null));};exports[_0xcfb1('0x66')]=function(_0x718d55,_0x58c17f,_0x12bd4a){var _0x875289=_0x718d55[_0xcfb1('0x4f')]['ids'];return db['Team']['findAll']({'where':{'id':_0x875289},'attributes':['id'],'include':[{'model':db[_0xcfb1('0x67')],'as':_0xcfb1('0x68'),'attributes':['id',_0xcfb1('0x2f'),'online',_0xcfb1('0x69'),_0xcfb1('0x6a')],'raw':!![]}]})['then'](function(_0xcf16ee){if(_0xcf16ee){var _0x43f415=_['flatMap'](_0xcf16ee,function(_0x4e2c1f){var _0x2e7c6f=_0x4e2c1f[_0xcfb1('0x2a')]({'plain':!![]});return _0x2e7c6f[_0xcfb1('0x68')];});return db['FaxQueue']['find']({'where':{'id':_0x718d55[_0xcfb1('0x4b')]['id']}})[_0xcfb1('0x28')](function(_0x4b1c16){return db[_0xcfb1('0x6b')][_0xcfb1('0x6c')](function(_0x3fe515){return _0x4b1c16['addTeams'](_0x875289,{'transaction':_0x3fe515})[_0xcfb1('0x28')](function(){return BPromise[_0xcfb1('0x6d')](_0x43f415,function(_0x371d8b){return db[_0xcfb1('0x5b')][_0xcfb1('0x6e')]({'where':{'UserId':_0x371d8b['id'],'FaxQueueId':_0x718d55[_0xcfb1('0x4b')]['id']},'transaction':_0x3fe515});});})['then'](function(){_0x43f415[_0xcfb1('0x6f')](function(_0x391430){socket['emit'](_0xcfb1('0x70'),{'UserId':_0x391430['id'],'FaxQueueId':_0x4b1c16['id']});});});});});}})['then'](respondWithStatusCode(_0x58c17f,null))['catch'](handleError(_0x58c17f,null));};exports[_0xcfb1('0x71')]=function(_0x592177,_0xe2ebb,_0x976ad3){return db[_0xcfb1('0x65')][_0xcfb1('0x48')]({'where':{'id':_0x592177['query'][_0xcfb1('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcfb1('0x68'),'attributes':['id'],'raw':!![]}]})[_0xcfb1('0x28')](handleEntityNotFound(_0xe2ebb,null))[_0xcfb1('0x28')](function(_0x42ba31){var _0x44186d=_[_0xcfb1('0x46')](_0x42ba31,'id');var _0x9e3b60=[];var _0x8e14b0=[];var _0x239ba7=squel[_0xcfb1('0x73')]();_0x239ba7['field'](_0xcfb1('0x74'))[_0xcfb1('0x75')](_0xcfb1('0x76'),'tq')['join'](_0xcfb1('0x77'),'ut',_0xcfb1('0x78'))[_0xcfb1('0x42')](_0xcfb1('0x79'),_0x592177[_0xcfb1('0x4b')]['id']);for(var _0x4c128c=0x0;_0x4c128c<_0x42ba31[_0xcfb1('0x3d')];_0x4c128c+=0x1){let _0x48c7e7=_0x42ba31[_0x4c128c];for(var _0x54baf0=0x0;_0x54baf0<_0x48c7e7[_0xcfb1('0x68')][_0xcfb1('0x3d')];_0x54baf0+=0x1){let _0x50381f=_0x48c7e7[_0xcfb1('0x68')][_0x54baf0];var _0x5c3a18=_0x239ba7[_0xcfb1('0x7a')]();_0x5c3a18['where'](_0xcfb1('0x7b'),_0x50381f['id']);_0x8e14b0[_0xcfb1('0x7c')](db[_0xcfb1('0x6b')][_0xcfb1('0x37')](_0x5c3a18[_0xcfb1('0x7d')](),{'type':db['sequelize'][_0xcfb1('0x7e')][_0xcfb1('0x7f')]})[_0xcfb1('0x28')](function(_0x362344){if(_0x362344[_0xcfb1('0x3d')]===0x1){return _0x50381f['id'];}else{var _0x248897=_[_0xcfb1('0x80')](_[_0xcfb1('0x46')](_0x362344,'TeamId'),function(_0x290331){return _[_0xcfb1('0x81')](_0x44186d,_0x290331);});if(_0x248897){return _0x50381f['id'];}}}));}}return BPromise[_0xcfb1('0x82')](_0x8e14b0)[_0xcfb1('0x28')](function(_0xe74a4d){_0x9e3b60=_(_0x9e3b60)[_0xcfb1('0x83')](_0xe74a4d)[_0xcfb1('0x84')]()[_0xcfb1('0x85')]();return db[_0xcfb1('0x32')][_0xcfb1('0x4e')]({'where':{'id':_0x592177[_0xcfb1('0x4b')]['id']}})['then'](function(_0x22ca9e){return db[_0xcfb1('0x6b')][_0xcfb1('0x6c')](function(_0x42450c){return _0x22ca9e[_0xcfb1('0x71')](_0x592177[_0xcfb1('0x37')][_0xcfb1('0x72')],{'transaction':_0x42450c})[_0xcfb1('0x28')](function(){if(!_[_0xcfb1('0x86')](_0x9e3b60)){return _0x22ca9e[_0xcfb1('0x87')](_0x9e3b60,{'transaction':_0x42450c});}})[_0xcfb1('0x28')](function(){_0x9e3b60[_0xcfb1('0x6f')](function(_0x2ba0c8){socket[_0xcfb1('0x88')](_0xcfb1('0x89'),{'UserId':_0x2ba0c8,'FaxQueueId':_0x22ca9e['id']});});});});});});})['then'](respondWithStatusCode(_0xe2ebb,null))['catch'](handleError(_0xe2ebb,null));};exports[_0xcfb1('0x8a')]=function(_0x9bb216,_0x2bfb18,_0x484053){return db[_0xcfb1('0x32')][_0xcfb1('0x4e')]({'where':{'id':_0x9bb216['params']['id']}})[_0xcfb1('0x28')](handleEntityNotFound(_0x2bfb18,null))[_0xcfb1('0x28')](function(_0x1fff44){if(_0x1fff44){return _0x1fff44[_0xcfb1('0x8a')](_0x9bb216[_0xcfb1('0x4f')][_0xcfb1('0x72')],_[_0xcfb1('0x8b')](_0x9bb216[_0xcfb1('0x4f')],[_0xcfb1('0x72'),'id'])||{})[_0xcfb1('0x8c')](function(_0x3d9a80){for(var _0x21f73e=0x0;_0x21f73e<_0x9bb216[_0xcfb1('0x4f')][_0xcfb1('0x72')]['length'];_0x21f73e+=0x1){socket[_0xcfb1('0x88')](_0xcfb1('0x70'),{'UserId':Number(_0x9bb216[_0xcfb1('0x4f')][_0xcfb1('0x72')][_0x21f73e]),'FaxQueueId':Number(_0x9bb216[_0xcfb1('0x4b')]['id'])});}return _0x3d9a80;});}})['then'](respondWithResult(_0x2bfb18,null))[_0xcfb1('0x49')](handleError(_0x2bfb18,null));};exports[_0xcfb1('0x87')]=function(_0x3839db,_0x197c33,_0x3cb1c8){return db[_0xcfb1('0x32')]['find']({'where':{'id':_0x3839db[_0xcfb1('0x4b')]['id']}})[_0xcfb1('0x28')](handleEntityNotFound(_0x197c33,null))[_0xcfb1('0x28')](function(_0x1f6d60){if(_0x1f6d60){return _0x1f6d60[_0xcfb1('0x87')](_0x3839db[_0xcfb1('0x37')][_0xcfb1('0x72')])[_0xcfb1('0x28')](function(){if(_[_0xcfb1('0x8d')](_0x3839db[_0xcfb1('0x37')][_0xcfb1('0x72')])){for(var _0x14f51f=0x0;_0x14f51f<_0x3839db[_0xcfb1('0x37')][_0xcfb1('0x72')][_0xcfb1('0x3d')];_0x14f51f+=0x1){socket[_0xcfb1('0x88')](_0xcfb1('0x89'),{'UserId':Number(_0x3839db[_0xcfb1('0x37')][_0xcfb1('0x72')][_0x14f51f]),'FaxQueueId':Number(_0x3839db[_0xcfb1('0x4b')]['id'])});}}else{socket[_0xcfb1('0x88')](_0xcfb1('0x89'),{'UserId':Number(_0x3839db[_0xcfb1('0x37')][_0xcfb1('0x72')]),'FaxQueueId':Number(_0x3839db[_0xcfb1('0x4b')]['id'])});}});}})[_0xcfb1('0x28')](respondWithStatusCode(_0x197c33,null))[_0xcfb1('0x49')](handleError(_0x197c33,null));};exports[_0xcfb1('0x8e')]=function(_0x4af521,_0x22060f,_0x4ca7b1){var _0x32dcce={};var _0x184eb6={};var _0x488e8e;var _0x367752;return db[_0xcfb1('0x32')][_0xcfb1('0x5a')]({'where':{'id':_0x4af521[_0xcfb1('0x4b')]['id']}})[_0xcfb1('0x28')](handleEntityNotFound(_0x22060f,null))['then'](function(_0x410249){if(_0x410249){_0x488e8e=_0x410249;_0x184eb6[_0xcfb1('0x39')]=_[_0xcfb1('0x38')](db[_0xcfb1('0x67')]['rawAttributes']);_0x184eb6[_0xcfb1('0x37')]=_[_0xcfb1('0x38')](_0x4af521[_0xcfb1('0x37')]);_0x184eb6[_0xcfb1('0x4c')]=_['intersection'](_0x184eb6[_0xcfb1('0x39')],_0x184eb6[_0xcfb1('0x37')]);_0x32dcce['attributes']=_[_0xcfb1('0x3a')](_0x184eb6[_0xcfb1('0x39')],qs[_0xcfb1('0x3b')](_0x4af521[_0xcfb1('0x37')][_0xcfb1('0x3b')]));_0x32dcce[_0xcfb1('0x3c')]=_0x32dcce[_0xcfb1('0x3c')][_0xcfb1('0x3d')]?_0x32dcce['attributes']:_0x184eb6[_0xcfb1('0x39')];_0x32dcce[_0xcfb1('0x40')]=qs[_0xcfb1('0x41')](_0x4af521[_0xcfb1('0x37')][_0xcfb1('0x41')]);_0x32dcce['where']=qs[_0xcfb1('0x4c')](_[_0xcfb1('0x43')](_0x4af521['query'],_0x184eb6[_0xcfb1('0x4c')]));if(_0x4af521[_0xcfb1('0x37')]['filter']){_0x32dcce[_0xcfb1('0x42')]=_[_0xcfb1('0x45')](_0x32dcce[_0xcfb1('0x42')],{'$or':_[_0xcfb1('0x46')](_0x32dcce[_0xcfb1('0x3c')],function(_0x484983){var _0xdd9d67={};_0xdd9d67[_0x484983]={'$like':'%'+_0x4af521['query']['filter']+'%'};return _0xdd9d67;})});}_0x32dcce=_[_0xcfb1('0x45')]({},_0x32dcce,_0x4af521['options']);return _0x488e8e['getAgents'](_0x32dcce);}})[_0xcfb1('0x28')](function(_0x4500ac){if(_0x4500ac){_0x367752=_0x4500ac[_0xcfb1('0x3d')];if(!_0x4af521['query'][_0xcfb1('0x3e')](_0xcfb1('0x3f'))){_0x32dcce['limit']=qs[_0xcfb1('0x21')](_0x4af521[_0xcfb1('0x37')]['limit']);_0x32dcce['offset']=qs[_0xcfb1('0x1f')](_0x4af521[_0xcfb1('0x37')]['offset']);}return _0x488e8e[_0xcfb1('0x8e')](_0x32dcce);}})['then'](function(_0x467148){if(_0x467148){return _0x467148?{'count':_0x367752,'rows':_0x467148}:null;}})[_0xcfb1('0x28')](respondWithResult(_0x22060f,null))['catch'](handleError(_0x22060f,null));}; \ No newline at end of file +var _0x8fc8=['TeamId','includes','all','union','compact','value','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','FaxQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','filter','options','FaxQueue','include','findAll','rows','show','params','includeAll','find','catch','create','body','get','role','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','pick','FaxQueueId','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','faxPause','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every'];(function(_0x462489,_0x494e68){var _0x1de42a=function(_0x3e7138){while(--_0x3e7138){_0x462489['push'](_0x462489['shift']());}};_0x1de42a(++_0x494e68);}(_0x8fc8,0x9d));var _0x88fc=function(_0x3a26a3,_0x584f7e){_0x3a26a3=_0x3a26a3-0x0;var _0x4bfd62=_0x8fc8[_0x3a26a3];return _0x4bfd62;};'use strict';var emlformat=require(_0x88fc('0x0'));var rimraf=require(_0x88fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x88fc('0x2'));var rp=require(_0x88fc('0x3'));var moment=require(_0x88fc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x88fc('0x5'));var util=require(_0x88fc('0x6'));var path=require(_0x88fc('0x7'));var sox=require('sox');var csv=require(_0x88fc('0x8'));var ejs=require(_0x88fc('0x9'));var fs=require('fs');var fs_extra=require(_0x88fc('0xa'));var _=require(_0x88fc('0xb'));var squel=require(_0x88fc('0xc'));var crypto=require(_0x88fc('0xd'));var jsforce=require(_0x88fc('0xe'));var deskjs=require(_0x88fc('0xf'));var toCsv=require(_0x88fc('0x8'));var querystring=require(_0x88fc('0x10'));var Papa=require(_0x88fc('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x88fc('0x12'));var as=require(_0x88fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88fc('0x14'))(_0x88fc('0x15'));var utils=require(_0x88fc('0x16'));var config=require(_0x88fc('0x17'));var licenseUtil=require(_0x88fc('0x18'));var db=require(_0x88fc('0x19'))['db'];config[_0x88fc('0x1a')]=_['defaults'](config[_0x88fc('0x1a')],{'host':_0x88fc('0x1b'),'port':0x18eb});var socket=require(_0x88fc('0x1c'))(new Redis(config[_0x88fc('0x1a')]));require('./faxQueue.socket')[_0x88fc('0x1d')](socket);function respondWithStatusCode(_0x3392e8,_0x3a5b28){_0x3a5b28=_0x3a5b28||0xcc;return function(_0x5025cd){if(_0x5025cd){return _0x3392e8[_0x88fc('0x1e')](_0x3a5b28);}return _0x3392e8[_0x88fc('0x1f')](_0x3a5b28)[_0x88fc('0x20')]();};}function respondWithResult(_0x147df5,_0x59a3e6){_0x59a3e6=_0x59a3e6||0xc8;return function(_0x19eb9c){if(_0x19eb9c){return _0x147df5[_0x88fc('0x1f')](_0x59a3e6)[_0x88fc('0x21')](_0x19eb9c);}};}function respondWithFilteredResult(_0x5b4fd1,_0x2f5635){return function(_0x3679bb){if(_0x3679bb){var _0x4ebec3=typeof _0x2f5635[_0x88fc('0x22')]===_0x88fc('0x23')&&typeof _0x2f5635[_0x88fc('0x24')]==='undefined';var _0x5ede52=_0x3679bb[_0x88fc('0x25')];var _0x43dded=_0x4ebec3?0x0:_0x2f5635[_0x88fc('0x22')];var _0x1ae666=_0x4ebec3?_0x3679bb[_0x88fc('0x25')]:_0x2f5635[_0x88fc('0x22')]+_0x2f5635[_0x88fc('0x24')];var _0x14409d;if(_0x1ae666>=_0x5ede52){_0x1ae666=_0x5ede52;_0x14409d=0xc8;}else{_0x14409d=0xce;}_0x5b4fd1[_0x88fc('0x1f')](_0x14409d);return _0x5b4fd1[_0x88fc('0x26')]('Content-Range',_0x43dded+'-'+_0x1ae666+'/'+_0x5ede52)['json'](_0x3679bb);}return null;};}function patchUpdates(_0x23a373){return function(_0x4bc239){try{jsonpatch[_0x88fc('0x27')](_0x4bc239,_0x23a373,!![]);}catch(_0x3bef3c){return BPromise[_0x88fc('0x28')](_0x3bef3c);}return _0x4bc239[_0x88fc('0x29')]();};}function saveUpdates(_0x50b1b8,_0x6657d8){return function(_0x45a2c3){if(_0x45a2c3){return _0x45a2c3['update'](_0x50b1b8)['then'](function(_0x42e21c){return _0x42e21c;});}return null;};}function removeEntity(_0x4e94da,_0x1283a7){return function(_0x17bf34){if(_0x17bf34){return _0x17bf34[_0x88fc('0x2a')]()[_0x88fc('0x2b')](function(){var _0x3c9e77=_0x17bf34['get']({'plain':!![]});var _0xcdf01e=_0x88fc('0x2c');return db[_0x88fc('0x2d')][_0x88fc('0x2a')]({'where':{'type':_0xcdf01e,'resourceId':_0x3c9e77['id']}})['then'](function(){return _0x17bf34;});})['then'](function(){_0x4e94da[_0x88fc('0x1f')](0xcc)[_0x88fc('0x20')]();});}};}function handleEntityNotFound(_0x5b17cb,_0x27f6a5){return function(_0x9be30b){if(!_0x9be30b){_0x5b17cb[_0x88fc('0x1e')](0x194);}return _0x9be30b;};}function handleError(_0x14db2c,_0x208a9e){_0x208a9e=_0x208a9e||0x1f4;return function(_0x4b5e00){logger[_0x88fc('0x2e')](_0x4b5e00[_0x88fc('0x2f')]);if(_0x4b5e00[_0x88fc('0x30')]){delete _0x4b5e00['name'];}_0x14db2c[_0x88fc('0x1f')](_0x208a9e)[_0x88fc('0x31')](_0x4b5e00);};}exports[_0x88fc('0x32')]=function(_0xf0f847,_0x24d21f){var _0x560738={},_0x328eab={},_0x31ee0a={'count':0x0,'rows':[]};var _0xca9838=_[_0x88fc('0x33')](db['FaxQueue'][_0x88fc('0x34')],function(_0x27ee02){return{'name':_0x27ee02[_0x88fc('0x35')],'type':_0x27ee02[_0x88fc('0x36')]['key']};});_0x328eab[_0x88fc('0x37')]=_[_0x88fc('0x33')](_0xca9838,_0x88fc('0x30'));_0x328eab[_0x88fc('0x38')]=_[_0x88fc('0x39')](_0xf0f847['query']);_0x328eab['filters']=_[_0x88fc('0x3a')](_0x328eab[_0x88fc('0x37')],_0x328eab[_0x88fc('0x38')]);_0x560738[_0x88fc('0x3b')]=_['intersection'](_0x328eab[_0x88fc('0x37')],qs[_0x88fc('0x3c')](_0xf0f847[_0x88fc('0x38')][_0x88fc('0x3c')]));_0x560738[_0x88fc('0x3b')]=_0x560738[_0x88fc('0x3b')][_0x88fc('0x3d')]?_0x560738['attributes']:_0x328eab[_0x88fc('0x37')];if(!_0xf0f847[_0x88fc('0x38')]['hasOwnProperty'](_0x88fc('0x3e'))){_0x560738[_0x88fc('0x24')]=qs[_0x88fc('0x24')](_0xf0f847[_0x88fc('0x38')]['limit']);_0x560738['offset']=qs[_0x88fc('0x22')](_0xf0f847['query'][_0x88fc('0x22')]);}_0x560738[_0x88fc('0x3f')]=qs[_0x88fc('0x40')](_0xf0f847[_0x88fc('0x38')][_0x88fc('0x40')]);_0x560738[_0x88fc('0x41')]=qs[_0x88fc('0x42')](_['pick'](_0xf0f847['query'],_0x328eab[_0x88fc('0x42')]),_0xca9838);if(_0xf0f847[_0x88fc('0x38')]['filter']){_0x560738['where']=_[_0x88fc('0x43')](_0x560738['where'],{'$or':_[_0x88fc('0x33')](_0xca9838,function(_0x2c4072){if(_0x2c4072[_0x88fc('0x36')]!=='VIRTUAL'){var _0x4c4e72={};_0x4c4e72[_0x2c4072[_0x88fc('0x30')]]={'$like':'%'+_0xf0f847[_0x88fc('0x38')][_0x88fc('0x44')]+'%'};return _0x4c4e72;}})});}_0x560738=_[_0x88fc('0x43')]({},_0x560738,_0xf0f847[_0x88fc('0x45')]);var _0xb3f38b={'where':_0x560738[_0x88fc('0x41')]};return db[_0x88fc('0x46')]['count'](_0xb3f38b)[_0x88fc('0x2b')](function(_0x2fc0f1){_0x31ee0a[_0x88fc('0x25')]=_0x2fc0f1;if(_0xf0f847[_0x88fc('0x38')]['includeAll']){_0x560738[_0x88fc('0x47')]=[{'all':!![]}];}return db[_0x88fc('0x46')][_0x88fc('0x48')](_0x560738);})[_0x88fc('0x2b')](function(_0x223b5a){_0x31ee0a[_0x88fc('0x49')]=_0x223b5a;return _0x31ee0a;})[_0x88fc('0x2b')](respondWithFilteredResult(_0x24d21f,_0x560738))['catch'](handleError(_0x24d21f,null));};exports[_0x88fc('0x4a')]=function(_0x3b4ae9,_0x57a7fd){var _0x3f6190={'raw':!![],'where':{'id':_0x3b4ae9[_0x88fc('0x4b')]['id']}},_0x158af3={};_0x158af3[_0x88fc('0x37')]=_['keys'](db[_0x88fc('0x46')][_0x88fc('0x34')]);_0x158af3['query']=_[_0x88fc('0x39')](_0x3b4ae9['query']);_0x158af3[_0x88fc('0x42')]=_[_0x88fc('0x3a')](_0x158af3['model'],_0x158af3['query']);_0x3f6190['attributes']=_[_0x88fc('0x3a')](_0x158af3[_0x88fc('0x37')],qs[_0x88fc('0x3c')](_0x3b4ae9[_0x88fc('0x38')][_0x88fc('0x3c')]));_0x3f6190[_0x88fc('0x3b')]=_0x3f6190[_0x88fc('0x3b')][_0x88fc('0x3d')]?_0x3f6190[_0x88fc('0x3b')]:_0x158af3[_0x88fc('0x37')];if(_0x3b4ae9['query'][_0x88fc('0x4c')]){_0x3f6190[_0x88fc('0x47')]=[{'all':!![]}];}_0x3f6190=_[_0x88fc('0x43')]({},_0x3f6190,_0x3b4ae9[_0x88fc('0x45')]);return db['FaxQueue'][_0x88fc('0x4d')](_0x3f6190)[_0x88fc('0x2b')](handleEntityNotFound(_0x57a7fd,null))[_0x88fc('0x2b')](respondWithResult(_0x57a7fd,null))[_0x88fc('0x4e')](handleError(_0x57a7fd,null));};exports['create']=function(_0x10e93d,_0x12bad0){return db[_0x88fc('0x46')][_0x88fc('0x4f')](_0x10e93d[_0x88fc('0x50')],{})[_0x88fc('0x2b')](function(_0x2d2dec){var _0x36aedf=_0x10e93d['user'][_0x88fc('0x51')]({'plain':!![]});if(!_0x36aedf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36aedf[_0x88fc('0x52')]==='user'){var _0x3e691b=_0x2d2dec['get']({'plain':!![]});var _0x18f412='FaxQueues';return db[_0x88fc('0x53')][_0x88fc('0x4d')]({'where':{'name':_0x18f412,'userProfileId':_0x36aedf[_0x88fc('0x54')]},'raw':!![]})[_0x88fc('0x2b')](function(_0x3f2b5f){if(_0x3f2b5f&&_0x3f2b5f[_0x88fc('0x55')]===0x0){return db['UserProfileResource'][_0x88fc('0x4f')]({'name':_0x3e691b[_0x88fc('0x30')],'resourceId':_0x3e691b['id'],'type':_0x3f2b5f['name'],'sectionId':_0x3f2b5f['id']},{})[_0x88fc('0x2b')](function(){return _0x2d2dec;});}else{return _0x2d2dec;}})[_0x88fc('0x4e')](function(_0x11605f){logger[_0x88fc('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11605f);throw _0x11605f;});}return _0x2d2dec;})[_0x88fc('0x2b')](respondWithResult(_0x12bad0,0xc9))['catch'](handleError(_0x12bad0,null));};exports['update']=function(_0x2c218c,_0x2c003e){if(_0x2c218c[_0x88fc('0x50')]['id']){delete _0x2c218c[_0x88fc('0x50')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x2c218c[_0x88fc('0x4b')]['id']}})[_0x88fc('0x2b')](handleEntityNotFound(_0x2c003e,null))[_0x88fc('0x2b')](saveUpdates(_0x2c218c[_0x88fc('0x50')],null))[_0x88fc('0x2b')](respondWithResult(_0x2c003e,null))['catch'](handleError(_0x2c003e,null));};exports['destroy']=function(_0xe95ee5,_0x5dbd11){return db[_0x88fc('0x46')][_0x88fc('0x4d')]({'where':{'id':_0xe95ee5[_0x88fc('0x4b')]['id']}})[_0x88fc('0x2b')](handleEntityNotFound(_0x5dbd11,null))[_0x88fc('0x2b')](removeEntity(_0x5dbd11,null))[_0x88fc('0x4e')](handleError(_0x5dbd11,null));};exports['describe']=function(_0x27fa7f,_0x4251fc){return db[_0x88fc('0x46')][_0x88fc('0x56')]()[_0x88fc('0x2b')](respondWithResult(_0x4251fc,null))[_0x88fc('0x4e')](handleError(_0x4251fc,null));};exports[_0x88fc('0x57')]=function(_0x45f16b,_0x27fda9,_0x4d5a37){var _0x4bd9bb={'raw':!![],'where':{}},_0x219b41={},_0x4f8442;return db['FaxQueue'][_0x88fc('0x58')]({'where':{'id':_0x45f16b[_0x88fc('0x4b')]['id']}})[_0x88fc('0x2b')](handleEntityNotFound(_0x27fda9,null))[_0x88fc('0x2b')](function(_0x1d7d96){if(_0x1d7d96){_0x4f8442=_0x1d7d96[_0x88fc('0x51')]({'plain':!![]});_0x219b41[_0x88fc('0x37')]=_[_0x88fc('0x39')](db[_0x88fc('0x59')][_0x88fc('0x34')]);_0x219b41[_0x88fc('0x38')]=_[_0x88fc('0x39')](_0x45f16b['query']);_0x219b41[_0x88fc('0x42')]=_[_0x88fc('0x3a')](_0x219b41[_0x88fc('0x37')],_0x219b41[_0x88fc('0x38')]);_0x4bd9bb['attributes']=_['intersection'](_0x219b41['model'],qs[_0x88fc('0x3c')](_0x45f16b['query'][_0x88fc('0x3c')]));_0x4bd9bb[_0x88fc('0x3b')]=_0x4bd9bb[_0x88fc('0x3b')][_0x88fc('0x3d')]?_0x4bd9bb['attributes']:_0x219b41[_0x88fc('0x37')];if(!_0x45f16b['query'][_0x88fc('0x5a')](_0x88fc('0x3e'))){_0x4bd9bb[_0x88fc('0x24')]=qs[_0x88fc('0x24')](_0x45f16b[_0x88fc('0x38')][_0x88fc('0x24')]);_0x4bd9bb[_0x88fc('0x22')]=qs['offset'](_0x45f16b[_0x88fc('0x38')][_0x88fc('0x22')]);}_0x4bd9bb[_0x88fc('0x3f')]=qs[_0x88fc('0x40')](_0x45f16b[_0x88fc('0x38')][_0x88fc('0x40')]);_0x4bd9bb[_0x88fc('0x41')]=qs['filters'](_[_0x88fc('0x5b')](_0x45f16b[_0x88fc('0x38')],_0x219b41[_0x88fc('0x42')]));_0x4bd9bb['where'][_0x88fc('0x5c')]=_0x1d7d96['id'];if(_0x45f16b[_0x88fc('0x38')][_0x88fc('0x44')]){_0x4bd9bb[_0x88fc('0x41')]=_['merge'](_0x4bd9bb['where'],{'$or':_[_0x88fc('0x33')](_0x4bd9bb[_0x88fc('0x3b')],function(_0x1384ac){var _0x288d50={};_0x288d50[_0x1384ac]={'$like':'%'+_0x45f16b['query']['filter']+'%'};return _0x288d50;})});}_0x4bd9bb=_[_0x88fc('0x43')]({},_0x4bd9bb,_0x45f16b['options']);return db['UserFaxQueue'][_0x88fc('0x48')](_0x4bd9bb);}})[_0x88fc('0x2b')](function(_0x1b675a){if(_0x1b675a){return db[_0x88fc('0x5d')][_0x88fc('0x5e')]({'where':{'id':_[_0x88fc('0x33')](_0x1b675a,_0x88fc('0x5f')),'role':'agent'},'attributes':['id',_0x88fc('0x30'),'faxPause',_0x88fc('0x60'),_0x88fc('0x61')]});}})['then'](function(_0x19e746){if(_0x19e746){return{'count':_0x19e746[_0x88fc('0x25')],'rows':_['map'](_0x19e746[_0x88fc('0x49')],function(_0x136d4e){return{'membername':_0x136d4e[_0x88fc('0x30')],'UserId':_0x136d4e['id'],'queue_name':_0x4f8442[_0x88fc('0x30')],'FaxQueueId':_0x4f8442['id'],'interface':util[_0x88fc('0x62')](_0x88fc('0x63'),'SIP',_0x136d4e[_0x88fc('0x30')]),'penalty':0x0,'paused':_0x136d4e[_0x88fc('0x64')],'createdAt':_0x136d4e['createdAt'],'updatedAt':_0x136d4e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x88fc('0x2b')](respondWithFilteredResult(_0x27fda9,_0x4bd9bb))[_0x88fc('0x4e')](handleError(_0x27fda9,null));};exports[_0x88fc('0x65')]=function(_0x12250f,_0x346022,_0xa2d9ef){var _0x472644={};var _0x2bc0a7={};var _0x3c6907;var _0x548efc;return db[_0x88fc('0x46')][_0x88fc('0x58')]({'where':{'id':_0x12250f['params']['id']}})[_0x88fc('0x2b')](handleEntityNotFound(_0x346022,null))[_0x88fc('0x2b')](function(_0x3dcd51){if(_0x3dcd51){_0x3c6907=_0x3dcd51;_0x2bc0a7[_0x88fc('0x37')]=_['keys'](db[_0x88fc('0x66')][_0x88fc('0x34')]);_0x2bc0a7[_0x88fc('0x38')]=_['keys'](_0x12250f[_0x88fc('0x38')]);_0x2bc0a7[_0x88fc('0x42')]=_['intersection'](_0x2bc0a7[_0x88fc('0x37')],_0x2bc0a7[_0x88fc('0x38')]);_0x472644['attributes']=_[_0x88fc('0x3a')](_0x2bc0a7[_0x88fc('0x37')],qs[_0x88fc('0x3c')](_0x12250f[_0x88fc('0x38')][_0x88fc('0x3c')]));_0x472644[_0x88fc('0x3b')]=_0x472644[_0x88fc('0x3b')][_0x88fc('0x3d')]?_0x472644[_0x88fc('0x3b')]:_0x2bc0a7[_0x88fc('0x37')];_0x472644['order']=qs[_0x88fc('0x40')](_0x12250f[_0x88fc('0x38')][_0x88fc('0x40')]);_0x472644[_0x88fc('0x41')]=qs[_0x88fc('0x42')](_[_0x88fc('0x5b')](_0x12250f[_0x88fc('0x38')],_0x2bc0a7[_0x88fc('0x42')]));if(_0x12250f[_0x88fc('0x38')][_0x88fc('0x44')]){_0x472644[_0x88fc('0x41')]=_[_0x88fc('0x43')](_0x472644[_0x88fc('0x41')],{'$or':_['map'](_0x472644[_0x88fc('0x3b')],function(_0x4bcc35){var _0x43194f={};_0x43194f[_0x4bcc35]={'$like':'%'+_0x12250f[_0x88fc('0x38')][_0x88fc('0x44')]+'%'};return _0x43194f;})});}_0x472644=_[_0x88fc('0x43')]({},_0x472644,_0x12250f[_0x88fc('0x45')]);return _0x3c6907[_0x88fc('0x65')](_0x472644);}})[_0x88fc('0x2b')](function(_0x570ffd){if(_0x570ffd){_0x548efc=_0x570ffd['length'];if(!_0x12250f[_0x88fc('0x38')][_0x88fc('0x5a')](_0x88fc('0x3e'))){_0x472644['limit']=qs['limit'](_0x12250f[_0x88fc('0x38')][_0x88fc('0x24')]);_0x472644[_0x88fc('0x22')]=qs['offset'](_0x12250f[_0x88fc('0x38')][_0x88fc('0x22')]);}return _0x3c6907[_0x88fc('0x65')](_0x472644);}})['then'](function(_0x455579){if(_0x455579){return _0x455579?{'count':_0x548efc,'rows':_0x455579}:null;}})['then'](respondWithResult(_0x346022,null))[_0x88fc('0x4e')](handleError(_0x346022,null));};exports['addTeams']=function(_0x527e51,_0x1dc8e0,_0x368783){var _0x2eea9a=_0x527e51[_0x88fc('0x50')][_0x88fc('0x67')];return db[_0x88fc('0x66')][_0x88fc('0x48')]({'where':{'id':_0x2eea9a},'attributes':['id'],'include':[{'model':db[_0x88fc('0x5d')],'as':_0x88fc('0x68'),'attributes':['id',_0x88fc('0x30'),_0x88fc('0x69'),_0x88fc('0x6a'),_0x88fc('0x6b')],'raw':!![]}]})[_0x88fc('0x2b')](function(_0x51b8b){if(_0x51b8b){var _0x1e12f7=_[_0x88fc('0x6c')](_0x51b8b,function(_0x543f9d){var _0x1a16a6=_0x543f9d[_0x88fc('0x51')]({'plain':!![]});return _0x1a16a6[_0x88fc('0x68')];});return db[_0x88fc('0x46')][_0x88fc('0x4d')]({'where':{'id':_0x527e51[_0x88fc('0x4b')]['id']}})[_0x88fc('0x2b')](function(_0xb5ada7){return db[_0x88fc('0x6d')][_0x88fc('0x6e')](function(_0x59a006){return _0xb5ada7['addTeams'](_0x2eea9a,{'transaction':_0x59a006})[_0x88fc('0x2b')](function(){return BPromise[_0x88fc('0x6f')](_0x1e12f7,function(_0x1b5643){return db[_0x88fc('0x59')][_0x88fc('0x70')]({'where':{'UserId':_0x1b5643['id'],'FaxQueueId':_0x527e51['params']['id']},'transaction':_0x59a006});});})[_0x88fc('0x2b')](function(){_0x1e12f7[_0x88fc('0x71')](function(_0x1456d2){socket[_0x88fc('0x72')](_0x88fc('0x73'),{'UserId':_0x1456d2['id'],'FaxQueueId':_0xb5ada7['id']});});});});});}})['then'](respondWithStatusCode(_0x1dc8e0,null))['catch'](handleError(_0x1dc8e0,null));};exports[_0x88fc('0x74')]=function(_0x47bb9b,_0x63764e,_0x2f7843){return db[_0x88fc('0x66')][_0x88fc('0x48')]({'where':{'id':_0x47bb9b[_0x88fc('0x38')][_0x88fc('0x67')]},'attributes':['id'],'include':[{'model':db[_0x88fc('0x5d')],'as':_0x88fc('0x68'),'attributes':['id'],'raw':!![]}]})[_0x88fc('0x2b')](handleEntityNotFound(_0x63764e,null))[_0x88fc('0x2b')](function(_0x1a0bbb){var _0x5daa87=_[_0x88fc('0x33')](_0x1a0bbb,'id');var _0xc0b044=[];var _0x599c9f=[];var _0xf98d38=squel[_0x88fc('0x75')]();_0xf98d38[_0x88fc('0x76')](_0x88fc('0x77'))[_0x88fc('0x78')](_0x88fc('0x79'),'tq')[_0x88fc('0x7a')](_0x88fc('0x7b'),'ut',_0x88fc('0x7c'))[_0x88fc('0x41')]('FaxQueueId\x20=\x20?',_0x47bb9b[_0x88fc('0x4b')]['id']);for(var _0x186127=0x0;_0x186127<_0x1a0bbb[_0x88fc('0x3d')];_0x186127+=0x1){let _0x7b15e9=_0x1a0bbb[_0x186127];for(var _0xc6e9f3=0x0;_0xc6e9f3<_0x7b15e9[_0x88fc('0x68')][_0x88fc('0x3d')];_0xc6e9f3+=0x1){let _0x49ec12=_0x7b15e9[_0x88fc('0x68')][_0xc6e9f3];var _0x937584=_0xf98d38[_0x88fc('0x7d')]();_0x937584[_0x88fc('0x41')](_0x88fc('0x7e'),_0x49ec12['id']);_0x599c9f[_0x88fc('0x7f')](db[_0x88fc('0x6d')]['query'](_0x937584['toString'](),{'type':db['sequelize'][_0x88fc('0x80')][_0x88fc('0x81')]})['then'](function(_0x38319a){if(_0x38319a['length']===0x1){return _0x49ec12['id'];}else{var _0x5beab2=_[_0x88fc('0x82')](_['map'](_0x38319a,_0x88fc('0x83')),function(_0x9f17f7){return _[_0x88fc('0x84')](_0x5daa87,_0x9f17f7);});if(_0x5beab2){return _0x49ec12['id'];}}}));}}return BPromise[_0x88fc('0x85')](_0x599c9f)[_0x88fc('0x2b')](function(_0x290754){_0xc0b044=_(_0xc0b044)[_0x88fc('0x86')](_0x290754)[_0x88fc('0x87')]()[_0x88fc('0x88')]();return db[_0x88fc('0x46')][_0x88fc('0x4d')]({'where':{'id':_0x47bb9b[_0x88fc('0x4b')]['id']}})[_0x88fc('0x2b')](function(_0x2a0c70){return db[_0x88fc('0x6d')][_0x88fc('0x6e')](function(_0x930cbf){return _0x2a0c70['removeTeams'](_0x47bb9b[_0x88fc('0x38')]['ids'],{'transaction':_0x930cbf})[_0x88fc('0x2b')](function(){if(!_['isEmpty'](_0xc0b044)){return _0x2a0c70[_0x88fc('0x89')](_0xc0b044,{'transaction':_0x930cbf});}})[_0x88fc('0x2b')](function(){_0xc0b044[_0x88fc('0x71')](function(_0xb845dc){socket[_0x88fc('0x72')](_0x88fc('0x8a'),{'UserId':_0xb845dc,'FaxQueueId':_0x2a0c70['id']});});});});});});})['then'](respondWithStatusCode(_0x63764e,null))['catch'](handleError(_0x63764e,null));};exports['addAgents']=function(_0x2a108e,_0x472621,_0x3854d3){return db[_0x88fc('0x46')][_0x88fc('0x4d')]({'where':{'id':_0x2a108e[_0x88fc('0x4b')]['id']}})[_0x88fc('0x2b')](handleEntityNotFound(_0x472621,null))[_0x88fc('0x2b')](function(_0x5459c8){if(_0x5459c8){return _0x5459c8[_0x88fc('0x8b')](_0x2a108e[_0x88fc('0x50')]['ids'],_[_0x88fc('0x8c')](_0x2a108e[_0x88fc('0x50')],[_0x88fc('0x67'),'id'])||{})[_0x88fc('0x8d')](function(_0x16a86c){for(var _0x3f4cc9=0x0;_0x3f4cc9<_0x2a108e[_0x88fc('0x50')][_0x88fc('0x67')]['length'];_0x3f4cc9+=0x1){socket[_0x88fc('0x72')](_0x88fc('0x73'),{'UserId':Number(_0x2a108e[_0x88fc('0x50')][_0x88fc('0x67')][_0x3f4cc9]),'FaxQueueId':Number(_0x2a108e[_0x88fc('0x4b')]['id'])});}return _0x16a86c;});}})['then'](respondWithResult(_0x472621,null))[_0x88fc('0x4e')](handleError(_0x472621,null));};exports[_0x88fc('0x89')]=function(_0xf4826c,_0x13da02,_0xa04564){return db['FaxQueue'][_0x88fc('0x4d')]({'where':{'id':_0xf4826c['params']['id']}})[_0x88fc('0x2b')](handleEntityNotFound(_0x13da02,null))['then'](function(_0x3a302b){if(_0x3a302b){return _0x3a302b['removeAgents'](_0xf4826c[_0x88fc('0x38')][_0x88fc('0x67')])['then'](function(){if(_[_0x88fc('0x8e')](_0xf4826c[_0x88fc('0x38')]['ids'])){for(var _0x2951ed=0x0;_0x2951ed<_0xf4826c['query'][_0x88fc('0x67')][_0x88fc('0x3d')];_0x2951ed+=0x1){socket[_0x88fc('0x72')](_0x88fc('0x8a'),{'UserId':Number(_0xf4826c[_0x88fc('0x38')]['ids'][_0x2951ed]),'FaxQueueId':Number(_0xf4826c[_0x88fc('0x4b')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0xf4826c['query'][_0x88fc('0x67')]),'FaxQueueId':Number(_0xf4826c['params']['id'])});}});}})['then'](respondWithStatusCode(_0x13da02,null))[_0x88fc('0x4e')](handleError(_0x13da02,null));};exports[_0x88fc('0x8f')]=function(_0x5d886a,_0x49ce60,_0x216fdd){var _0x40ec82={};var _0x590c23={};var _0x378d2b;var _0x419855;return db['FaxQueue'][_0x88fc('0x58')]({'where':{'id':_0x5d886a[_0x88fc('0x4b')]['id']}})[_0x88fc('0x2b')](handleEntityNotFound(_0x49ce60,null))['then'](function(_0x3ee9a2){if(_0x3ee9a2){_0x378d2b=_0x3ee9a2;_0x590c23[_0x88fc('0x37')]=_[_0x88fc('0x39')](db[_0x88fc('0x5d')][_0x88fc('0x34')]);_0x590c23[_0x88fc('0x38')]=_[_0x88fc('0x39')](_0x5d886a['query']);_0x590c23[_0x88fc('0x42')]=_[_0x88fc('0x3a')](_0x590c23[_0x88fc('0x37')],_0x590c23[_0x88fc('0x38')]);_0x40ec82[_0x88fc('0x3b')]=_['intersection'](_0x590c23[_0x88fc('0x37')],qs[_0x88fc('0x3c')](_0x5d886a['query'][_0x88fc('0x3c')]));_0x40ec82[_0x88fc('0x3b')]=_0x40ec82[_0x88fc('0x3b')][_0x88fc('0x3d')]?_0x40ec82[_0x88fc('0x3b')]:_0x590c23[_0x88fc('0x37')];_0x40ec82[_0x88fc('0x3f')]=qs['sort'](_0x5d886a[_0x88fc('0x38')][_0x88fc('0x40')]);_0x40ec82[_0x88fc('0x41')]=qs[_0x88fc('0x42')](_[_0x88fc('0x5b')](_0x5d886a[_0x88fc('0x38')],_0x590c23['filters']));if(_0x5d886a[_0x88fc('0x38')]['filter']){_0x40ec82['where']=_[_0x88fc('0x43')](_0x40ec82['where'],{'$or':_[_0x88fc('0x33')](_0x40ec82[_0x88fc('0x3b')],function(_0x7ae89c){var _0x40ebb5={};_0x40ebb5[_0x7ae89c]={'$like':'%'+_0x5d886a['query']['filter']+'%'};return _0x40ebb5;})});}_0x40ec82=_[_0x88fc('0x43')]({},_0x40ec82,_0x5d886a['options']);return _0x378d2b['getAgents'](_0x40ec82);}})['then'](function(_0x61b83e){if(_0x61b83e){_0x419855=_0x61b83e[_0x88fc('0x3d')];if(!_0x5d886a[_0x88fc('0x38')]['hasOwnProperty'](_0x88fc('0x3e'))){_0x40ec82[_0x88fc('0x24')]=qs['limit'](_0x5d886a[_0x88fc('0x38')][_0x88fc('0x24')]);_0x40ec82['offset']=qs[_0x88fc('0x22')](_0x5d886a[_0x88fc('0x38')][_0x88fc('0x22')]);}return _0x378d2b['getAgents'](_0x40ec82);}})['then'](function(_0x24e0f6){if(_0x24e0f6){return _0x24e0f6?{'count':_0x419855,'rows':_0x24e0f6}:null;}})[_0x88fc('0x2b')](respondWithResult(_0x49ce60,null))[_0x88fc('0x4e')](handleError(_0x49ce60,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 096293e..f2561a8 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 _0x8b90=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x8b90,0x197));var _0x08b9=function(_0x4f724f,_0x29213e){_0x4f724f=_0x4f724f-0x0;var _0x2343c3=_0x8b90[_0x4f724f];return _0x2343c3;};'use strict';var EventEmitter=require(_0x08b9('0x0'));var FaxQueue=require(_0x08b9('0x1'))['db'][_0x08b9('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x08b9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x08b9('0x4'),'afterDestroy':_0x08b9('0x5')};function emitEvent(_0x5ce53d){return function(_0x11ff27,_0x5ec797,_0x5e7e12){FaxQueueEvents[_0x08b9('0x6')](_0x5ce53d+':'+_0x11ff27['id'],_0x11ff27);FaxQueueEvents[_0x08b9('0x6')](_0x5ce53d,_0x11ff27);_0x5e7e12(null);};}for(var e in events){if(events[_0x08b9('0x7')](e)){var event=events[e];FaxQueue[_0x08b9('0x8')](e,emitEvent(event));}}module[_0x08b9('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0xb11a=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb11a,0x1ac));var _0xab11=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xb11a[_0x55e08b];return _0xd1a7ff;};'use strict';var EventEmitter=require(_0xab11('0x0'));var FaxQueue=require(_0xab11('0x1'))['db'][_0xab11('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xab11('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xab11('0x4'),'afterDestroy':_0xab11('0x5')};function emitEvent(_0x39be03){return function(_0x46aa1d,_0x5292de,_0x17cbef){FaxQueueEvents[_0xab11('0x6')](_0x39be03+':'+_0x46aa1d['id'],_0x46aa1d);FaxQueueEvents['emit'](_0x39be03,_0x46aa1d);_0x17cbef(null);};}for(var e in events){if(events[_0xab11('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xab11('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 ab18e5b..2cb72bb 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 _0x3f3a=['path','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','moment','request-promise'];(function(_0x38f737,_0x54f685){var _0x7afda3=function(_0x1ac1d7){while(--_0x1ac1d7){_0x38f737['push'](_0x38f737['shift']());}};_0x7afda3(++_0x54f685);}(_0x3f3a,0x72));var _0xa3f3=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x3f3a[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xa3f3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa3f3('0x1'));var BPromise=require('bluebird');var rp=require(_0xa3f3('0x2'));var fs=require('fs');var path=require(_0xa3f3('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa3f3('0x4'));module[_0xa3f3('0x5')]=function(_0x3b99a5,_0x4d53ce){return _0x3b99a5[_0xa3f3('0x6')](_0xa3f3('0x7'),attributes,{'tableName':_0xa3f3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e27=['moment','request-promise','path','rimraf','../../config/environment','exports','FaxQueue','util','../../config/logger','api'];(function(_0x48b55f,_0x2d47be){var _0x28869d=function(_0x5bf8f2){while(--_0x5bf8f2){_0x48b55f['push'](_0x48b55f['shift']());}};_0x28869d(++_0x2d47be);}(_0x9e27,0x15b));var _0x79e2=function(_0x5d37d8,_0x37c944){_0x5d37d8=_0x5d37d8-0x0;var _0x449cea=_0x9e27[_0x5d37d8];return _0x449cea;};'use strict';var _=require('lodash');var util=require(_0x79e2('0x0'));var logger=require(_0x79e2('0x1'))(_0x79e2('0x2'));var moment=require(_0x79e2('0x3'));var BPromise=require('bluebird');var rp=require(_0x79e2('0x4'));var fs=require('fs');var path=require(_0x79e2('0x5'));var rimraf=require(_0x79e2('0x6'));var config=require(_0x79e2('0x7'));var attributes=require('./faxQueue.attributes');module[_0x79e2('0x8')]=function(_0xb7fc77,_0x360cec){return _0xb7fc77['define'](_0x79e2('0x9'),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 93ca115..0a0230d 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 _0x9488=['FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFaxQueue','options','raw','where','map','include','model','attributes','FaxQueue','find','ShowFaxQueue','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxQueue.socket','register','then','info'];(function(_0x82b1b1,_0x2ab269){var _0x14bac3=function(_0x39f43d){while(--_0x39f43d){_0x82b1b1['push'](_0x82b1b1['shift']());}};_0x14bac3(++_0x2ab269);}(_0x9488,0x1e7));var _0x8948=function(_0x88271d,_0x54a578){_0x88271d=_0x88271d-0x0;var _0x1ad066=_0x9488[_0x88271d];return _0x1ad066;};'use strict';var _=require(_0x8948('0x0'));var util=require('util');var moment=require(_0x8948('0x1'));var BPromise=require(_0x8948('0x2'));var rs=require(_0x8948('0x3'));var fs=require('fs');var Redis=require(_0x8948('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8948('0x5'));var logger=require(_0x8948('0x6'))(_0x8948('0x7'));var config=require(_0x8948('0x8'));var jayson=require(_0x8948('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x8948('0xa')]=_['defaults'](config[_0x8948('0xa')],{'host':_0x8948('0xb'),'port':0x18eb});var socket=require(_0x8948('0xc'))(new Redis(config[_0x8948('0xa')]));require(_0x8948('0xd'))[_0x8948('0xe')](socket);function respondWithRpcPromise(_0x2e877e,_0xd849fd,_0xa3af0c){return new BPromise(function(_0x360a5a,_0x36defe){return client['request'](_0x2e877e,_0xa3af0c)[_0x8948('0xf')](function(_0x4c649a){logger[_0x8948('0x10')](_0x8948('0x11'),_0xd849fd,_0x8948('0x12'));logger[_0x8948('0x13')](_0x8948('0x14'),_0xd849fd,_0x8948('0x12'),JSON[_0x8948('0x15')](_0x4c649a));if(_0x4c649a[_0x8948('0x16')]){if(_0x4c649a[_0x8948('0x16')]['code']===0x1f4){logger['error'](_0x8948('0x11'),_0xd849fd,_0x4c649a['error'][_0x8948('0x17')]);return _0x36defe(_0x4c649a[_0x8948('0x16')][_0x8948('0x17')]);}logger['error'](_0x8948('0x11'),_0xd849fd,_0x4c649a[_0x8948('0x16')][_0x8948('0x17')]);return _0x360a5a(_0x4c649a['error']['message']);}else{logger['info'](_0x8948('0x11'),_0xd849fd,_0x8948('0x12'));_0x360a5a(_0x4c649a['result'][_0x8948('0x17')]);}})[_0x8948('0x18')](function(_0x3c850a){logger['error']('FaxQueue,\x20%s,\x20%s',_0xd849fd,_0x3c850a);_0x36defe(_0x3c850a);});});}exports[_0x8948('0x19')]=function(_0x59c204){var _0x5ef470=this;return new Promise(function(_0x2baa79,_0x54e009){return db['FaxQueue']['findAll']({'raw':_0x59c204[_0x8948('0x1a')]?_0x59c204[_0x8948('0x1a')][_0x8948('0x1b')]===undefined?!![]:![]:!![],'where':_0x59c204[_0x8948('0x1a')]?_0x59c204[_0x8948('0x1a')][_0x8948('0x1c')]||null:null,'attributes':_0x59c204['options']?_0x59c204[_0x8948('0x1a')]['attributes']||null:null,'limit':_0x59c204[_0x8948('0x1a')]?_0x59c204[_0x8948('0x1a')]['limit']||null:null,'include':_0x59c204[_0x8948('0x1a')]?_0x59c204[_0x8948('0x1a')]['include']?_[_0x8948('0x1d')](_0x59c204[_0x8948('0x1a')][_0x8948('0x1e')],function(_0x3aa8eb){return{'model':db[_0x3aa8eb[_0x8948('0x1f')]],'as':_0x3aa8eb['as'],'attributes':_0x3aa8eb[_0x8948('0x20')],'include':_0x3aa8eb['include']?_['map'](_0x3aa8eb[_0x8948('0x1e')],function(_0x5488be){return{'model':db[_0x5488be[_0x8948('0x1f')]],'as':_0x5488be['as'],'attributes':_0x5488be[_0x8948('0x20')],'include':_0x5488be[_0x8948('0x1e')]?_[_0x8948('0x1d')](_0x5488be['include'],function(_0x3689be){return{'model':db[_0x3689be[_0x8948('0x1f')]],'as':_0x3689be['as'],'attributes':_0x3689be[_0x8948('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5478f3){logger['info']('GetFaxQueue',_0x59c204);logger[_0x8948('0x13')](_0x8948('0x19'),_0x59c204,JSON['stringify'](_0x5478f3));_0x2baa79(_0x5478f3);})[_0x8948('0x18')](function(_0x37475d){logger[_0x8948('0x16')]('GetFaxQueue',_0x37475d[_0x8948('0x17')],_0x59c204);_0x54e009(_0x5ef470['error'](0x1f4,_0x37475d[_0x8948('0x17')]));});});};exports['ShowFaxQueue']=function(_0x51d59f){var _0x56875a=this;return new Promise(function(_0x44129f,_0x587dbf){return db[_0x8948('0x21')][_0x8948('0x22')]({'raw':_0x51d59f['options']?_0x51d59f[_0x8948('0x1a')][_0x8948('0x1b')]===undefined?!![]:![]:!![],'where':_0x51d59f['options']?_0x51d59f[_0x8948('0x1a')][_0x8948('0x1c')]||null:null,'attributes':_0x51d59f['options']?_0x51d59f[_0x8948('0x1a')]['attributes']||null:null,'include':_0x51d59f[_0x8948('0x1a')]?_0x51d59f[_0x8948('0x1a')]['include']?_[_0x8948('0x1d')](_0x51d59f[_0x8948('0x1a')][_0x8948('0x1e')],function(_0x15e958){return{'model':db[_0x15e958[_0x8948('0x1f')]],'as':_0x15e958['as'],'attributes':_0x15e958[_0x8948('0x20')],'include':_0x15e958[_0x8948('0x1e')]?_[_0x8948('0x1d')](_0x15e958['include'],function(_0x590227){return{'model':db[_0x590227[_0x8948('0x1f')]],'as':_0x590227['as'],'attributes':_0x590227[_0x8948('0x20')],'include':_0x590227[_0x8948('0x1e')]?_['map'](_0x590227[_0x8948('0x1e')],function(_0x305a0a){return{'model':db[_0x305a0a[_0x8948('0x1f')]],'as':_0x305a0a['as'],'attributes':_0x305a0a[_0x8948('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a9168){logger[_0x8948('0x10')]('ShowFaxQueue',_0x51d59f);logger[_0x8948('0x13')](_0x8948('0x23'),_0x51d59f,JSON['stringify'](_0x3a9168));_0x44129f(_0x3a9168);})['catch'](function(_0x34e9a4){logger[_0x8948('0x16')]('ShowFaxQueue',_0x34e9a4[_0x8948('0x17')],_0x51d59f);_0x587dbf(_0x56875a[_0x8948('0x16')](0x1f4,_0x34e9a4['message']));});});}; \ No newline at end of file +var _0x531f=['request','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','raw','attributes','limit','include','map','model','then','GetFaxQueue','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register'];(function(_0x349bf7,_0x2a251f){var _0x4f08c8=function(_0x19edbb){while(--_0x19edbb){_0x349bf7['push'](_0x349bf7['shift']());}};_0x4f08c8(++_0x2a251f);}(_0x531f,0x1db));var _0xf531=function(_0x52dfa9,_0x306d3f){_0x52dfa9=_0x52dfa9-0x0;var _0xdfaa57=_0x531f[_0x52dfa9];return _0xdfaa57;};'use strict';var _=require(_0xf531('0x0'));var util=require(_0xf531('0x1'));var moment=require(_0xf531('0x2'));var BPromise=require(_0xf531('0x3'));var rs=require(_0xf531('0x4'));var fs=require('fs');var Redis=require(_0xf531('0x5'));var db=require(_0xf531('0x6'))['db'];var utils=require(_0xf531('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf531('0x8'));var jayson=require(_0xf531('0x9'));var client=jayson[_0xf531('0xa')][_0xf531('0xb')]({'port':0x232a});config[_0xf531('0xc')]=_['defaults'](config[_0xf531('0xc')],{'host':_0xf531('0xd'),'port':0x18eb});var socket=require(_0xf531('0xe'))(new Redis(config[_0xf531('0xc')]));require(_0xf531('0xf'))[_0xf531('0x10')](socket);function respondWithRpcPromise(_0x3c4677,_0xa84930,_0x1314e2){return new BPromise(function(_0x3f0b63,_0xb1743a){return client[_0xf531('0x11')](_0x3c4677,_0x1314e2)['then'](function(_0x59114a){logger[_0xf531('0x12')](_0xf531('0x13'),_0xa84930,'request\x20sent');logger[_0xf531('0x14')](_0xf531('0x15'),_0xa84930,_0xf531('0x16'),JSON[_0xf531('0x17')](_0x59114a));if(_0x59114a[_0xf531('0x18')]){if(_0x59114a[_0xf531('0x18')][_0xf531('0x19')]===0x1f4){logger[_0xf531('0x18')](_0xf531('0x13'),_0xa84930,_0x59114a['error'][_0xf531('0x1a')]);return _0xb1743a(_0x59114a[_0xf531('0x18')]['message']);}logger[_0xf531('0x18')](_0xf531('0x13'),_0xa84930,_0x59114a[_0xf531('0x18')][_0xf531('0x1a')]);return _0x3f0b63(_0x59114a['error'][_0xf531('0x1a')]);}else{logger[_0xf531('0x12')](_0xf531('0x13'),_0xa84930,_0xf531('0x16'));_0x3f0b63(_0x59114a[_0xf531('0x1b')][_0xf531('0x1a')]);}})[_0xf531('0x1c')](function(_0x2aea55){logger[_0xf531('0x18')](_0xf531('0x13'),_0xa84930,_0x2aea55);_0xb1743a(_0x2aea55);});});}exports['GetFaxQueue']=function(_0x1459a3){var _0x177e8f=this;return new Promise(function(_0x3a186a,_0x461b65){return db['FaxQueue'][_0xf531('0x1d')]({'raw':_0x1459a3[_0xf531('0x1e')]?_0x1459a3['options'][_0xf531('0x1f')]===undefined?!![]:![]:!![],'where':_0x1459a3[_0xf531('0x1e')]?_0x1459a3[_0xf531('0x1e')]['where']||null:null,'attributes':_0x1459a3[_0xf531('0x1e')]?_0x1459a3[_0xf531('0x1e')][_0xf531('0x20')]||null:null,'limit':_0x1459a3[_0xf531('0x1e')]?_0x1459a3[_0xf531('0x1e')][_0xf531('0x21')]||null:null,'include':_0x1459a3[_0xf531('0x1e')]?_0x1459a3['options'][_0xf531('0x22')]?_['map'](_0x1459a3['options'][_0xf531('0x22')],function(_0x521633){return{'model':db[_0x521633['model']],'as':_0x521633['as'],'attributes':_0x521633['attributes'],'include':_0x521633['include']?_[_0xf531('0x23')](_0x521633['include'],function(_0x185a6a){return{'model':db[_0x185a6a['model']],'as':_0x185a6a['as'],'attributes':_0x185a6a['attributes'],'include':_0x185a6a[_0xf531('0x22')]?_[_0xf531('0x23')](_0x185a6a[_0xf531('0x22')],function(_0x40dca3){return{'model':db[_0x40dca3[_0xf531('0x24')]],'as':_0x40dca3['as'],'attributes':_0x40dca3[_0xf531('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf531('0x25')](function(_0x2bca3f){logger['info'](_0xf531('0x26'),_0x1459a3);logger[_0xf531('0x14')]('GetFaxQueue',_0x1459a3,JSON[_0xf531('0x17')](_0x2bca3f));_0x3a186a(_0x2bca3f);})[_0xf531('0x1c')](function(_0x269405){logger['error']('GetFaxQueue',_0x269405['message'],_0x1459a3);_0x461b65(_0x177e8f[_0xf531('0x18')](0x1f4,_0x269405[_0xf531('0x1a')]));});});};exports[_0xf531('0x27')]=function(_0x22c9e4){var _0x2762c7=this;return new Promise(function(_0x457f64,_0x30aa12){return db['FaxQueue'][_0xf531('0x28')]({'raw':_0x22c9e4[_0xf531('0x1e')]?_0x22c9e4['options'][_0xf531('0x1f')]===undefined?!![]:![]:!![],'where':_0x22c9e4['options']?_0x22c9e4['options']['where']||null:null,'attributes':_0x22c9e4['options']?_0x22c9e4[_0xf531('0x1e')][_0xf531('0x20')]||null:null,'include':_0x22c9e4[_0xf531('0x1e')]?_0x22c9e4['options']['include']?_['map'](_0x22c9e4[_0xf531('0x1e')][_0xf531('0x22')],function(_0x4a9e46){return{'model':db[_0x4a9e46[_0xf531('0x24')]],'as':_0x4a9e46['as'],'attributes':_0x4a9e46[_0xf531('0x20')],'include':_0x4a9e46[_0xf531('0x22')]?_[_0xf531('0x23')](_0x4a9e46[_0xf531('0x22')],function(_0x17b3b7){return{'model':db[_0x17b3b7[_0xf531('0x24')]],'as':_0x17b3b7['as'],'attributes':_0x17b3b7['attributes'],'include':_0x17b3b7['include']?_[_0xf531('0x23')](_0x17b3b7[_0xf531('0x22')],function(_0x22c1e9){return{'model':db[_0x22c1e9['model']],'as':_0x22c1e9['as'],'attributes':_0x22c1e9[_0xf531('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf531('0x25')](function(_0x5dd847){logger['info']('ShowFaxQueue',_0x22c9e4);logger['debug']('ShowFaxQueue',_0x22c9e4,JSON[_0xf531('0x17')](_0x5dd847));_0x457f64(_0x5dd847);})[_0xf531('0x1c')](function(_0x2e9c3d){logger[_0xf531('0x18')](_0xf531('0x27'),_0x2e9c3d['message'],_0x22c9e4);_0x30aa12(_0x2762c7['error'](0x1f4,_0x2e9c3d[_0xf531('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index ece374c..21d48d0 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 _0xa0e9=['emit','length','faxQueue:','save','update'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xa0e9,0xdf));var _0x9a0e=function(_0x67caf,_0x56a915){_0x67caf=_0x67caf-0x0;var _0x57118e=_0xa0e9[_0x67caf];return _0x57118e;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x9a0e('0x0'),'remove',_0x9a0e('0x1')];function createListener(_0x19d5a7,_0x330b0f){return function(_0x24724a){_0x330b0f[_0x9a0e('0x2')](_0x19d5a7,_0x24724a);};}function removeListener(_0x4105d8,_0x5e0a0c){return function(){FaxQueueEvents['removeListener'](_0x4105d8,_0x5e0a0c);};}exports['register']=function(_0x5b6687){for(var _0x291497=0x0,_0x35a632=events[_0x9a0e('0x3')];_0x291497<_0x35a632;_0x291497++){var _0x325f8f=events[_0x291497];var _0x306b51=createListener(_0x9a0e('0x4')+_0x325f8f,_0x5b6687);FaxQueueEvents['on'](_0x325f8f,_0x306b51);}}; \ No newline at end of file +var _0xe733=['./faxQueue.events','update','emit','register'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xe733,0x1cc));var _0x3e73=function(_0x450a95,_0x3b4365){_0x450a95=_0x450a95-0x0;var _0x2a9d9f=_0xe733[_0x450a95];return _0x2a9d9f;};'use strict';var FaxQueueEvents=require(_0x3e73('0x0'));var events=['save','remove',_0x3e73('0x1')];function createListener(_0x12f0e5,_0x3295f2){return function(_0x54151a){_0x3295f2[_0x3e73('0x2')](_0x12f0e5,_0x54151a);};}function removeListener(_0x4a1f48,_0x2f1889){return function(){FaxQueueEvents['removeListener'](_0x4a1f48,_0x2f1889);};}exports[_0x3e73('0x3')]=function(_0x141d30){for(var _0x50055a=0x0,_0x548d19=events['length'];_0x50055a<_0x548d19;_0x50055a++){var _0x29d208=events[_0x50055a];var _0x595f93=createListener('faxQueue:'+_0x29d208,_0x141d30);FaxQueueEvents['on'](_0x29d208,_0x595f93);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 213e8e5..4450ba9 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 _0xe61c=['addAgents','destroy','removeTeams','delete','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams'];(function(_0x1f3064,_0x1bff33){var _0x45979d=function(_0xcc991c){while(--_0xcc991c){_0x1f3064['push'](_0x1f3064['shift']());}};_0x45979d(++_0x1bff33);}(_0xe61c,0xee));var _0xce61=function(_0xf31767,_0x381746){_0xf31767=_0xf31767-0x0;var _0x24bd0c=_0xe61c[_0xf31767];return _0x24bd0c;};'use strict';var multer=require(_0xce61('0x0'));var util=require('util');var path=require(_0xce61('0x1'));var timeout=require(_0xce61('0x2'));var express=require(_0xce61('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xce61('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xce61('0x5'));var controller=require(_0xce61('0x6'));router[_0xce61('0x7')]('/',auth[_0xce61('0x8')](),controller[_0xce61('0x9')]);router[_0xce61('0x7')](_0xce61('0xa'),auth['isAuthenticated'](),controller[_0xce61('0xb')]);router[_0xce61('0x7')](_0xce61('0xc'),auth[_0xce61('0x8')](),controller[_0xce61('0xd')]);router[_0xce61('0x7')](_0xce61('0xe'),auth['isAuthenticated'](),controller[_0xce61('0xf')]);router[_0xce61('0x7')]('/:id/teams',auth[_0xce61('0x8')](),controller[_0xce61('0x10')]);router['get'](_0xce61('0x11'),auth['isAuthenticated'](),controller[_0xce61('0x12')]);router[_0xce61('0x13')]('/',auth['isAuthenticated'](),controller[_0xce61('0x14')]);router['post'](_0xce61('0x15'),auth['isAuthenticated'](),controller[_0xce61('0x16')]);router[_0xce61('0x13')](_0xce61('0x11'),auth[_0xce61('0x8')](),controller[_0xce61('0x17')]);router['put']('/:id',auth[_0xce61('0x8')](),controller['update']);router['delete'](_0xce61('0xc'),auth[_0xce61('0x8')](),controller[_0xce61('0x18')]);router['delete'](_0xce61('0x15'),auth['isAuthenticated'](),controller[_0xce61('0x19')]);router[_0xce61('0x1a')](_0xce61('0x11'),auth[_0xce61('0x8')](),controller[_0xce61('0x1b')]);module[_0xce61('0x1c')]=router; \ No newline at end of file +var _0xb091=['/:id','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','util','path','connect-timeout','express','fs-extra','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','describe'];(function(_0x32bcfe,_0x390d43){var _0x49a0cf=function(_0x19c826){while(--_0x19c826){_0x32bcfe['push'](_0x32bcfe['shift']());}};_0x49a0cf(++_0x390d43);}(_0xb091,0x16e));var _0x1b09=function(_0x38073b,_0x5cee7b){_0x38073b=_0x38073b-0x0;var _0x490398=_0xb091[_0x38073b];return _0x490398;};'use strict';var multer=require('multer');var util=require(_0x1b09('0x0'));var path=require(_0x1b09('0x1'));var timeout=require(_0x1b09('0x2'));var express=require(_0x1b09('0x3'));var router=express['Router']();var fs_extra=require(_0x1b09('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b09('0x5'));var controller=require(_0x1b09('0x6'));router['get']('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x8')]);router[_0x1b09('0x9')]('/describe',auth[_0x1b09('0x7')](),controller[_0x1b09('0xa')]);router[_0x1b09('0x9')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xc')]);router[_0x1b09('0x9')](_0x1b09('0xd'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xe')]);router[_0x1b09('0x9')]('/:id/teams',auth[_0x1b09('0x7')](),controller[_0x1b09('0xf')]);router['get']('/:id/users',auth[_0x1b09('0x7')](),controller[_0x1b09('0x10')]);router[_0x1b09('0x11')]('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x12')]);router[_0x1b09('0x11')](_0x1b09('0x13'),auth['isAuthenticated'](),controller[_0x1b09('0x14')]);router['post'](_0x1b09('0x15'),auth[_0x1b09('0x7')](),controller[_0x1b09('0x16')]);router[_0x1b09('0x17')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0x18')]);router[_0x1b09('0x19')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0x1a')]);router[_0x1b09('0x19')](_0x1b09('0x13'),auth['isAuthenticated'](),controller[_0x1b09('0x1b')]);router[_0x1b09('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x1b09('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 4410568..7482752 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 _0x7789=['STRING','DATE','moment','sequelize','exports'];(function(_0x53aee9,_0x5a22b3){var _0x3e9631=function(_0x57e852){while(--_0x57e852){_0x53aee9['push'](_0x53aee9['shift']());}};_0x3e9631(++_0x5a22b3);}(_0x7789,0x11a));var _0x9778=function(_0x15ceb3,_0x2fa894){_0x15ceb3=_0x15ceb3-0x0;var _0x5593d9=_0x7789[_0x15ceb3];return _0x5593d9;};'use strict';var moment=require(_0x9778('0x0'));var Sequelize=require(_0x9778('0x1'));module[_0x9778('0x2')]={'uniqueid':{'type':Sequelize[_0x9778('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9778('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9778('0x4')]},'acceptAt':{'type':Sequelize[_0x9778('0x4')]},'exitAt':{'type':Sequelize[_0x9778('0x4')]},'reason':{'type':Sequelize[_0x9778('0x3')]}}; \ No newline at end of file +var _0x25ac=['DATE','STRING'];(function(_0x315de3,_0x47fb12){var _0x1d1889=function(_0x54b385){while(--_0x54b385){_0x315de3['push'](_0x315de3['shift']());}};_0x1d1889(++_0x47fb12);}(_0x25ac,0x1d3));var _0xc25a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25ac[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc25a('0x0')]},'joinAt':{'type':Sequelize[_0xc25a('0x1')]},'leaveAt':{'type':Sequelize[_0xc25a('0x1')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc25a('0x1')]},'reason':{'type':Sequelize[_0xc25a('0x0')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 0a372f4..ef36a96 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 _0xfa12=['json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x3f219e,_0x5c0d36){var _0x4e315d=function(_0x2e7581){while(--_0x2e7581){_0x3f219e['push'](_0x3f219e['shift']());}};_0x4e315d(++_0x5c0d36);}(_0xfa12,0x1b2));var _0x2fa1=function(_0x1bd1f1,_0x1ba8cd){_0x1bd1f1=_0x1bd1f1-0x0;var _0x43ba1f=_0xfa12[_0x1bd1f1];return _0x43ba1f;};'use strict';var emlformat=require(_0x2fa1('0x0'));var rimraf=require(_0x2fa1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2fa1('0x2'));var rp=require(_0x2fa1('0x3'));var moment=require(_0x2fa1('0x4'));var BPromise=require(_0x2fa1('0x5'));var Mustache=require('mustache');var util=require(_0x2fa1('0x6'));var path=require(_0x2fa1('0x7'));var sox=require(_0x2fa1('0x8'));var csv=require(_0x2fa1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2fa1('0xa'));var _=require(_0x2fa1('0xb'));var squel=require('squel');var crypto=require(_0x2fa1('0xc'));var jsforce=require(_0x2fa1('0xd'));var deskjs=require(_0x2fa1('0xe'));var toCsv=require(_0x2fa1('0x9'));var querystring=require('querystring');var Papa=require(_0x2fa1('0xf'));var Redis=require(_0x2fa1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2fa1('0x11'));var as=require(_0x2fa1('0x12'));var hardwareService=require(_0x2fa1('0x13'));var logger=require(_0x2fa1('0x14'))(_0x2fa1('0x15'));var utils=require(_0x2fa1('0x16'));var config=require(_0x2fa1('0x17'));var licenseUtil=require(_0x2fa1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x305bb3,_0x4198e1){_0x4198e1=_0x4198e1||0xcc;return function(_0x311441){if(_0x311441){return _0x305bb3[_0x2fa1('0x19')](_0x4198e1);}return _0x305bb3[_0x2fa1('0x1a')](_0x4198e1)[_0x2fa1('0x1b')]();};}function respondWithResult(_0x567bc5,_0xf81957){_0xf81957=_0xf81957||0xc8;return function(_0x409ea0){if(_0x409ea0){return _0x567bc5[_0x2fa1('0x1a')](_0xf81957)[_0x2fa1('0x1c')](_0x409ea0);}};}function respondWithFilteredResult(_0x5e7ed0,_0x3c79b6){return function(_0x3d6647){if(_0x3d6647){var _0x59aa4d=typeof _0x3c79b6[_0x2fa1('0x1d')]===_0x2fa1('0x1e')&&typeof _0x3c79b6[_0x2fa1('0x1f')]===_0x2fa1('0x1e');var _0xaf39c7=_0x3d6647[_0x2fa1('0x20')];var _0x21004a=_0x59aa4d?0x0:_0x3c79b6[_0x2fa1('0x1d')];var _0x4d16ac=_0x59aa4d?_0x3d6647[_0x2fa1('0x20')]:_0x3c79b6['offset']+_0x3c79b6['limit'];var _0x18d225;if(_0x4d16ac>=_0xaf39c7){_0x4d16ac=_0xaf39c7;_0x18d225=0xc8;}else{_0x18d225=0xce;}_0x5e7ed0[_0x2fa1('0x1a')](_0x18d225);return _0x5e7ed0[_0x2fa1('0x21')](_0x2fa1('0x22'),_0x21004a+'-'+_0x4d16ac+'/'+_0xaf39c7)[_0x2fa1('0x1c')](_0x3d6647);}return null;};}function patchUpdates(_0x5c451e){return function(_0x23f0d2){try{jsonpatch['apply'](_0x23f0d2,_0x5c451e,!![]);}catch(_0x22e15f){return BPromise[_0x2fa1('0x23')](_0x22e15f);}return _0x23f0d2[_0x2fa1('0x24')]();};}function saveUpdates(_0x245898,_0x24fe15){return function(_0x3fa70d){if(_0x3fa70d){return _0x3fa70d[_0x2fa1('0x25')](_0x245898)[_0x2fa1('0x26')](function(_0x2e95f0){return _0x2e95f0;});}return null;};}function removeEntity(_0x15037c,_0x5021fb){return function(_0x1eaa57){if(_0x1eaa57){return _0x1eaa57['destroy']()['then'](function(){_0x15037c['status'](0xcc)[_0x2fa1('0x1b')]();});}};}function handleEntityNotFound(_0x5c89fc,_0x4a152c){return function(_0x16a2b0){if(!_0x16a2b0){_0x5c89fc[_0x2fa1('0x19')](0x194);}return _0x16a2b0;};}function handleError(_0xa4be1b,_0x398c53){_0x398c53=_0x398c53||0x1f4;return function(_0x42cc71){logger[_0x2fa1('0x27')](_0x42cc71[_0x2fa1('0x28')]);if(_0x42cc71[_0x2fa1('0x29')]){delete _0x42cc71[_0x2fa1('0x29')];}_0xa4be1b[_0x2fa1('0x1a')](_0x398c53)[_0x2fa1('0x2a')](_0x42cc71);};}exports[_0x2fa1('0x2b')]=function(_0x16c050,_0x44856f){var _0x2a5dda={},_0xdb4308={},_0xd53b8={'count':0x0,'rows':[]};var _0x300970=_['map'](db[_0x2fa1('0x2c')][_0x2fa1('0x2d')],function(_0x4bf6b5){return{'name':_0x4bf6b5[_0x2fa1('0x2e')],'type':_0x4bf6b5[_0x2fa1('0x2f')][_0x2fa1('0x30')]};});_0xdb4308[_0x2fa1('0x31')]=_[_0x2fa1('0x32')](_0x300970,'name');_0xdb4308[_0x2fa1('0x33')]=_[_0x2fa1('0x34')](_0x16c050[_0x2fa1('0x33')]);_0xdb4308[_0x2fa1('0x35')]=_['intersection'](_0xdb4308[_0x2fa1('0x31')],_0xdb4308[_0x2fa1('0x33')]);_0x2a5dda['attributes']=_[_0x2fa1('0x36')](_0xdb4308['model'],qs[_0x2fa1('0x37')](_0x16c050[_0x2fa1('0x33')][_0x2fa1('0x37')]));_0x2a5dda[_0x2fa1('0x38')]=_0x2a5dda[_0x2fa1('0x38')][_0x2fa1('0x39')]?_0x2a5dda[_0x2fa1('0x38')]:_0xdb4308[_0x2fa1('0x31')];if(!_0x16c050['query'][_0x2fa1('0x3a')](_0x2fa1('0x3b'))){_0x2a5dda['limit']=qs[_0x2fa1('0x1f')](_0x16c050[_0x2fa1('0x33')][_0x2fa1('0x1f')]);_0x2a5dda[_0x2fa1('0x1d')]=qs[_0x2fa1('0x1d')](_0x16c050[_0x2fa1('0x33')][_0x2fa1('0x1d')]);}_0x2a5dda[_0x2fa1('0x3c')]=qs['sort'](_0x16c050['query']['sort']);_0x2a5dda[_0x2fa1('0x3d')]=qs[_0x2fa1('0x35')](_['pick'](_0x16c050['query'],_0xdb4308[_0x2fa1('0x35')]),_0x300970);if(_0x16c050['query'][_0x2fa1('0x3e')]){_0x2a5dda['where']=_[_0x2fa1('0x3f')](_0x2a5dda[_0x2fa1('0x3d')],{'$or':_[_0x2fa1('0x32')](_0x300970,function(_0x1b129a){if(_0x1b129a['type']!=='VIRTUAL'){var _0x15c7d7={};_0x15c7d7[_0x1b129a[_0x2fa1('0x29')]]={'$like':'%'+_0x16c050[_0x2fa1('0x33')][_0x2fa1('0x3e')]+'%'};return _0x15c7d7;}})});}_0x2a5dda=_[_0x2fa1('0x3f')]({},_0x2a5dda,_0x16c050[_0x2fa1('0x40')]);var _0xdc1506={'where':_0x2a5dda[_0x2fa1('0x3d')]};return db['FaxQueueReport'][_0x2fa1('0x20')](_0xdc1506)[_0x2fa1('0x26')](function(_0x549dff){_0xd53b8[_0x2fa1('0x20')]=_0x549dff;if(_0x16c050[_0x2fa1('0x33')][_0x2fa1('0x41')]){_0x2a5dda[_0x2fa1('0x42')]=[{'all':!![]}];}return db[_0x2fa1('0x2c')][_0x2fa1('0x43')](_0x2a5dda);})[_0x2fa1('0x26')](function(_0x5154b7){_0xd53b8[_0x2fa1('0x44')]=_0x5154b7;return _0xd53b8;})[_0x2fa1('0x26')](respondWithFilteredResult(_0x44856f,_0x2a5dda))[_0x2fa1('0x45')](handleError(_0x44856f,null));};exports[_0x2fa1('0x46')]=function(_0x587c9e,_0x2f4a0d){var _0x229026={'raw':!![],'where':{'id':_0x587c9e[_0x2fa1('0x47')]['id']}},_0x1180eb={};_0x1180eb['model']=_[_0x2fa1('0x34')](db[_0x2fa1('0x2c')][_0x2fa1('0x2d')]);_0x1180eb[_0x2fa1('0x33')]=_[_0x2fa1('0x34')](_0x587c9e[_0x2fa1('0x33')]);_0x1180eb[_0x2fa1('0x35')]=_[_0x2fa1('0x36')](_0x1180eb[_0x2fa1('0x31')],_0x1180eb[_0x2fa1('0x33')]);_0x229026['attributes']=_['intersection'](_0x1180eb['model'],qs[_0x2fa1('0x37')](_0x587c9e['query']['fields']));_0x229026['attributes']=_0x229026[_0x2fa1('0x38')][_0x2fa1('0x39')]?_0x229026[_0x2fa1('0x38')]:_0x1180eb[_0x2fa1('0x31')];if(_0x587c9e['query'][_0x2fa1('0x41')]){_0x229026[_0x2fa1('0x42')]=[{'all':!![]}];}_0x229026=_[_0x2fa1('0x3f')]({},_0x229026,_0x587c9e[_0x2fa1('0x40')]);return db[_0x2fa1('0x2c')][_0x2fa1('0x48')](_0x229026)[_0x2fa1('0x26')](handleEntityNotFound(_0x2f4a0d,null))[_0x2fa1('0x26')](respondWithResult(_0x2f4a0d,null))[_0x2fa1('0x45')](handleError(_0x2f4a0d,null));};exports[_0x2fa1('0x49')]=function(_0x5ab852,_0x34460a){return db[_0x2fa1('0x2c')][_0x2fa1('0x49')](_0x5ab852[_0x2fa1('0x4a')],{})[_0x2fa1('0x26')](respondWithResult(_0x34460a,0xc9))['catch'](handleError(_0x34460a,null));};exports[_0x2fa1('0x25')]=function(_0x2410e4,_0x1b8556){if(_0x2410e4[_0x2fa1('0x4a')]['id']){delete _0x2410e4['body']['id'];}return db['FaxQueueReport'][_0x2fa1('0x48')]({'where':{'id':_0x2410e4['params']['id']}})[_0x2fa1('0x26')](handleEntityNotFound(_0x1b8556,null))[_0x2fa1('0x26')](saveUpdates(_0x2410e4[_0x2fa1('0x4a')],null))[_0x2fa1('0x26')](respondWithResult(_0x1b8556,null))[_0x2fa1('0x45')](handleError(_0x1b8556,null));};exports[_0x2fa1('0x4b')]=function(_0x5198b1,_0x4d522f){return db['FaxQueueReport']['find']({'where':{'id':_0x5198b1['params']['id']}})[_0x2fa1('0x26')](handleEntityNotFound(_0x4d522f,null))[_0x2fa1('0x26')](removeEntity(_0x4d522f,null))[_0x2fa1('0x45')](handleError(_0x4d522f,null));};exports[_0x2fa1('0x4c')]=function(_0x31b9ab,_0x557cde){return db['FaxQueueReport']['describe']()[_0x2fa1('0x26')](respondWithResult(_0x557cde,null))[_0x2fa1('0x45')](handleError(_0x557cde,null));}; \ No newline at end of file +var _0x2750=['create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','destroy','then','error','stack','name','send','index','map','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','FaxQueueReport','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find'];(function(_0x4ded50,_0x4a6af3){var _0xa92135=function(_0xe09b41){while(--_0xe09b41){_0x4ded50['push'](_0x4ded50['shift']());}};_0xa92135(++_0x4a6af3);}(_0x2750,0x13b));var _0x0275=function(_0x10d812,_0xfdd554){_0x10d812=_0x10d812-0x0;var _0x37dbb1=_0x2750[_0x10d812];return _0x37dbb1;};'use strict';var emlformat=require(_0x0275('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0275('0x1'));var jsonpatch=require(_0x0275('0x2'));var rp=require(_0x0275('0x3'));var moment=require(_0x0275('0x4'));var BPromise=require(_0x0275('0x5'));var Mustache=require(_0x0275('0x6'));var util=require(_0x0275('0x7'));var path=require(_0x0275('0x8'));var sox=require(_0x0275('0x9'));var csv=require(_0x0275('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0275('0xb'));var _=require(_0x0275('0xc'));var squel=require(_0x0275('0xd'));var crypto=require(_0x0275('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0275('0xf'));var toCsv=require(_0x0275('0xa'));var querystring=require(_0x0275('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0275('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0275('0x12'));var hardwareService=require(_0x0275('0x13'));var logger=require(_0x0275('0x14'))(_0x0275('0x15'));var utils=require(_0x0275('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0275('0x17'));var db=require(_0x0275('0x18'))['db'];function respondWithStatusCode(_0x1f128d,_0x4c6ee0){_0x4c6ee0=_0x4c6ee0||0xcc;return function(_0x55ffd6){if(_0x55ffd6){return _0x1f128d[_0x0275('0x19')](_0x4c6ee0);}return _0x1f128d[_0x0275('0x1a')](_0x4c6ee0)[_0x0275('0x1b')]();};}function respondWithResult(_0x46a729,_0x28827b){_0x28827b=_0x28827b||0xc8;return function(_0x36921c){if(_0x36921c){return _0x46a729['status'](_0x28827b)[_0x0275('0x1c')](_0x36921c);}};}function respondWithFilteredResult(_0x3030c0,_0x4aa412){return function(_0x6344fc){if(_0x6344fc){var _0xaae367=typeof _0x4aa412['offset']===_0x0275('0x1d')&&typeof _0x4aa412[_0x0275('0x1e')]==='undefined';var _0x5e7466=_0x6344fc['count'];var _0x591d27=_0xaae367?0x0:_0x4aa412['offset'];var _0x566ad6=_0xaae367?_0x6344fc[_0x0275('0x1f')]:_0x4aa412[_0x0275('0x20')]+_0x4aa412['limit'];var _0x7075c9;if(_0x566ad6>=_0x5e7466){_0x566ad6=_0x5e7466;_0x7075c9=0xc8;}else{_0x7075c9=0xce;}_0x3030c0[_0x0275('0x1a')](_0x7075c9);return _0x3030c0[_0x0275('0x21')]('Content-Range',_0x591d27+'-'+_0x566ad6+'/'+_0x5e7466)[_0x0275('0x1c')](_0x6344fc);}return null;};}function patchUpdates(_0x402f0d){return function(_0x575786){try{jsonpatch['apply'](_0x575786,_0x402f0d,!![]);}catch(_0x31ba9e){return BPromise[_0x0275('0x22')](_0x31ba9e);}return _0x575786[_0x0275('0x23')]();};}function saveUpdates(_0x592a53,_0xf3b68e){return function(_0x5ab9e7){if(_0x5ab9e7){return _0x5ab9e7[_0x0275('0x24')](_0x592a53)['then'](function(_0x26f2c2){return _0x26f2c2;});}return null;};}function removeEntity(_0xfa0081,_0x594321){return function(_0x140a18){if(_0x140a18){return _0x140a18[_0x0275('0x25')]()[_0x0275('0x26')](function(){_0xfa0081['status'](0xcc)[_0x0275('0x1b')]();});}};}function handleEntityNotFound(_0x44bbf8,_0x24c928){return function(_0x15813f){if(!_0x15813f){_0x44bbf8[_0x0275('0x19')](0x194);}return _0x15813f;};}function handleError(_0x437752,_0x56f26c){_0x56f26c=_0x56f26c||0x1f4;return function(_0x35343c){logger[_0x0275('0x27')](_0x35343c[_0x0275('0x28')]);if(_0x35343c[_0x0275('0x29')]){delete _0x35343c[_0x0275('0x29')];}_0x437752['status'](_0x56f26c)[_0x0275('0x2a')](_0x35343c);};}exports[_0x0275('0x2b')]=function(_0x3246ea,_0xe9d730){var _0xe5863c={},_0x49e645={},_0x2d49b4={'count':0x0,'rows':[]};var _0x287be3=_[_0x0275('0x2c')](db['FaxQueueReport']['rawAttributes'],function(_0x3cb2d7){return{'name':_0x3cb2d7[_0x0275('0x2d')],'type':_0x3cb2d7['type'][_0x0275('0x2e')]};});_0x49e645[_0x0275('0x2f')]=_[_0x0275('0x2c')](_0x287be3,_0x0275('0x29'));_0x49e645['query']=_[_0x0275('0x30')](_0x3246ea[_0x0275('0x31')]);_0x49e645[_0x0275('0x32')]=_[_0x0275('0x33')](_0x49e645['model'],_0x49e645[_0x0275('0x31')]);_0xe5863c['attributes']=_[_0x0275('0x33')](_0x49e645['model'],qs[_0x0275('0x34')](_0x3246ea[_0x0275('0x31')]['fields']));_0xe5863c[_0x0275('0x35')]=_0xe5863c[_0x0275('0x35')][_0x0275('0x36')]?_0xe5863c[_0x0275('0x35')]:_0x49e645['model'];if(!_0x3246ea[_0x0275('0x31')][_0x0275('0x37')](_0x0275('0x38'))){_0xe5863c[_0x0275('0x1e')]=qs[_0x0275('0x1e')](_0x3246ea['query'][_0x0275('0x1e')]);_0xe5863c[_0x0275('0x20')]=qs[_0x0275('0x20')](_0x3246ea[_0x0275('0x31')][_0x0275('0x20')]);}_0xe5863c[_0x0275('0x39')]=qs[_0x0275('0x3a')](_0x3246ea[_0x0275('0x31')][_0x0275('0x3a')]);_0xe5863c[_0x0275('0x3b')]=qs[_0x0275('0x32')](_['pick'](_0x3246ea[_0x0275('0x31')],_0x49e645[_0x0275('0x32')]),_0x287be3);if(_0x3246ea[_0x0275('0x31')][_0x0275('0x3c')]){_0xe5863c[_0x0275('0x3b')]=_[_0x0275('0x3d')](_0xe5863c[_0x0275('0x3b')],{'$or':_[_0x0275('0x2c')](_0x287be3,function(_0x34cbe3){if(_0x34cbe3[_0x0275('0x3e')]!==_0x0275('0x3f')){var _0x43417a={};_0x43417a[_0x34cbe3[_0x0275('0x29')]]={'$like':'%'+_0x3246ea[_0x0275('0x31')]['filter']+'%'};return _0x43417a;}})});}_0xe5863c=_[_0x0275('0x3d')]({},_0xe5863c,_0x3246ea[_0x0275('0x40')]);var _0x4d2d59={'where':_0xe5863c[_0x0275('0x3b')]};return db[_0x0275('0x41')][_0x0275('0x1f')](_0x4d2d59)[_0x0275('0x26')](function(_0x3611f5){_0x2d49b4[_0x0275('0x1f')]=_0x3611f5;if(_0x3246ea[_0x0275('0x31')]['includeAll']){_0xe5863c[_0x0275('0x42')]=[{'all':!![]}];}return db[_0x0275('0x41')][_0x0275('0x43')](_0xe5863c);})[_0x0275('0x26')](function(_0x4f888c){_0x2d49b4[_0x0275('0x44')]=_0x4f888c;return _0x2d49b4;})[_0x0275('0x26')](respondWithFilteredResult(_0xe9d730,_0xe5863c))[_0x0275('0x45')](handleError(_0xe9d730,null));};exports[_0x0275('0x46')]=function(_0x4ad75f,_0xcbfe0a){var _0x52f69c={'raw':!![],'where':{'id':_0x4ad75f[_0x0275('0x47')]['id']}},_0x261e66={};_0x261e66[_0x0275('0x2f')]=_[_0x0275('0x30')](db['FaxQueueReport'][_0x0275('0x48')]);_0x261e66[_0x0275('0x31')]=_['keys'](_0x4ad75f[_0x0275('0x31')]);_0x261e66[_0x0275('0x32')]=_[_0x0275('0x33')](_0x261e66['model'],_0x261e66[_0x0275('0x31')]);_0x52f69c[_0x0275('0x35')]=_['intersection'](_0x261e66[_0x0275('0x2f')],qs[_0x0275('0x34')](_0x4ad75f[_0x0275('0x31')][_0x0275('0x34')]));_0x52f69c[_0x0275('0x35')]=_0x52f69c[_0x0275('0x35')][_0x0275('0x36')]?_0x52f69c[_0x0275('0x35')]:_0x261e66[_0x0275('0x2f')];if(_0x4ad75f[_0x0275('0x31')][_0x0275('0x49')]){_0x52f69c['include']=[{'all':!![]}];}_0x52f69c=_[_0x0275('0x3d')]({},_0x52f69c,_0x4ad75f[_0x0275('0x40')]);return db[_0x0275('0x41')][_0x0275('0x4a')](_0x52f69c)[_0x0275('0x26')](handleEntityNotFound(_0xcbfe0a,null))[_0x0275('0x26')](respondWithResult(_0xcbfe0a,null))[_0x0275('0x45')](handleError(_0xcbfe0a,null));};exports[_0x0275('0x4b')]=function(_0x300e40,_0x3ac454){return db[_0x0275('0x41')]['create'](_0x300e40['body'],{})[_0x0275('0x26')](respondWithResult(_0x3ac454,0xc9))[_0x0275('0x45')](handleError(_0x3ac454,null));};exports[_0x0275('0x24')]=function(_0x3bd019,_0x310c6b){if(_0x3bd019['body']['id']){delete _0x3bd019[_0x0275('0x4c')]['id'];}return db['FaxQueueReport'][_0x0275('0x4a')]({'where':{'id':_0x3bd019[_0x0275('0x47')]['id']}})[_0x0275('0x26')](handleEntityNotFound(_0x310c6b,null))[_0x0275('0x26')](saveUpdates(_0x3bd019['body'],null))[_0x0275('0x26')](respondWithResult(_0x310c6b,null))['catch'](handleError(_0x310c6b,null));};exports['destroy']=function(_0x515860,_0x28e90f){return db['FaxQueueReport'][_0x0275('0x4a')]({'where':{'id':_0x515860[_0x0275('0x47')]['id']}})[_0x0275('0x26')](handleEntityNotFound(_0x28e90f,null))[_0x0275('0x26')](removeEntity(_0x28e90f,null))[_0x0275('0x45')](handleError(_0x28e90f,null));};exports[_0x0275('0x4d')]=function(_0x2973d6,_0x591bfd){return db[_0x0275('0x41')]['describe']()[_0x0275('0x26')](respondWithResult(_0x591bfd,null))[_0x0275('0x45')](handleError(_0x591bfd,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 27b4b7d..19f00be 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 _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4816b2,_0x3e581e){var _0x4aa813=function(_0xbe5e11){while(--_0xbe5e11){_0x4816b2['push'](_0x4816b2['shift']());}};_0x4aa813(++_0x3e581e);}(_0x53ec,0x192));var _0xc53e=function(_0x548e1d,_0x3534d3){_0x548e1d=_0x548e1d-0x0;var _0x398584=_0x53ec[_0x548e1d];return _0x398584;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xbd29a8,_0x30ddeb){var _0x447a4c=function(_0x2f6d2e){while(--_0x2f6d2e){_0xbd29a8['push'](_0xbd29a8['shift']());}};_0x447a4c(++_0x30ddeb);}(_0x4975,0x86));var _0x5497=function(_0x573495,_0xbe1e46){_0x573495=_0x573495-0x0;var _0x4c0f76=_0x4975[_0x573495];return _0x4c0f76;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 88baedc..061b71a 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 _0x59ab=['../../config/environment','jayson/promise','http','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','create','options','then','FaxQueueReport','update','raw','where','attributes','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x20713e,_0x44f710){var _0x7d998b=function(_0x5d98ab){while(--_0x5d98ab){_0x20713e['push'](_0x20713e['shift']());}};_0x7d998b(++_0x44f710);}(_0x59ab,0x98));var _0xb59a=function(_0x44295a,_0x465c7a){_0x44295a=_0x44295a-0x0;var _0x4d60a8=_0x59ab[_0x44295a];return _0x4d60a8;};'use strict';var _=require(_0xb59a('0x0'));var util=require(_0xb59a('0x1'));var moment=require(_0xb59a('0x2'));var BPromise=require(_0xb59a('0x3'));var rs=require(_0xb59a('0x4'));var fs=require('fs');var Redis=require(_0xb59a('0x5'));var db=require(_0xb59a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb59a('0x7'))('rpc');var config=require(_0xb59a('0x8'));var jayson=require(_0xb59a('0x9'));var client=jayson['client'][_0xb59a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x188003,_0x4bd7af,_0x54ff24){return new BPromise(function(_0x3fabf2,_0x34a2b0){return client['request'](_0x188003,_0x54ff24)['then'](function(_0x27640c){logger[_0xb59a('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x4bd7af,_0xb59a('0xc'));logger[_0xb59a('0xd')](_0xb59a('0xe'),_0x4bd7af,'request\x20sent',JSON[_0xb59a('0xf')](_0x27640c));if(_0x27640c[_0xb59a('0x10')]){if(_0x27640c[_0xb59a('0x10')][_0xb59a('0x11')]===0x1f4){logger[_0xb59a('0x10')](_0xb59a('0x12'),_0x4bd7af,_0x27640c[_0xb59a('0x10')][_0xb59a('0x13')]);return _0x34a2b0(_0x27640c[_0xb59a('0x10')][_0xb59a('0x13')]);}logger[_0xb59a('0x10')](_0xb59a('0x12'),_0x4bd7af,_0x27640c['error']['message']);return _0x3fabf2(_0x27640c[_0xb59a('0x10')][_0xb59a('0x13')]);}else{logger[_0xb59a('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x4bd7af,'request\x20sent');_0x3fabf2(_0x27640c[_0xb59a('0x14')]['message']);}})[_0xb59a('0x15')](function(_0x5ceaac){logger[_0xb59a('0x10')](_0xb59a('0x12'),_0x4bd7af,_0x5ceaac);_0x34a2b0(_0x5ceaac);});});}exports[_0xb59a('0x16')]=function(_0x32ceff){var _0x4d1988=this;return new Promise(function(_0x2a08e8,_0x1e066e){return db['FaxQueueReport'][_0xb59a('0x17')](_0x32ceff['body'],{'raw':_0x32ceff[_0xb59a('0x18')]?_0x32ceff['options']['raw']===undefined?!![]:![]:!![]})[_0xb59a('0x19')](function(_0x4ffabc){logger['info']('CreateFaxQueueReport',_0x32ceff);logger['debug'](_0xb59a('0x16'),_0x32ceff,JSON[_0xb59a('0xf')](_0x4ffabc));_0x2a08e8(_0x4ffabc);})['catch'](function(_0x5987f7){logger['error'](_0xb59a('0x16'),_0x5987f7[_0xb59a('0x13')],_0x32ceff);_0x1e066e(_0x4d1988[_0xb59a('0x10')](0x1f4,_0x5987f7[_0xb59a('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x2572dd){var _0xd8e3dc=this;return new Promise(function(_0x233498,_0x1c504b){return db[_0xb59a('0x1a')][_0xb59a('0x1b')](_0x2572dd['body'],{'raw':_0x2572dd[_0xb59a('0x18')]?_0x2572dd[_0xb59a('0x18')][_0xb59a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2572dd[_0xb59a('0x18')]?_0x2572dd[_0xb59a('0x18')][_0xb59a('0x1d')]||null:null,'attributes':_0x2572dd[_0xb59a('0x18')]?_0x2572dd[_0xb59a('0x18')][_0xb59a('0x1e')]||null:null,'limit':_0x2572dd[_0xb59a('0x18')]?_0x2572dd[_0xb59a('0x18')]['limit']||null:null})[_0xb59a('0x19')](function(_0x4299c5){logger['info'](_0xb59a('0x1f'),_0x2572dd);logger['debug'](_0xb59a('0x1f'),_0x2572dd,JSON['stringify'](_0x4299c5));_0x233498(_0x4299c5);})[_0xb59a('0x15')](function(_0x1c21cd){logger[_0xb59a('0x10')](_0xb59a('0x1f'),_0x1c21cd[_0xb59a('0x13')],_0x2572dd);_0x1c504b(_0xd8e3dc[_0xb59a('0x10')](0x1f4,_0x1c21cd[_0xb59a('0x13')]));});});}; \ No newline at end of file +var _0x83ee=['../../config/logger','rpc','../../config/environment','jayson/promise','client','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateFaxQueueReport','create','options','then','UpdateFaxQueueReport','update','body','where','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x83ee,0x12e));var _0xe83e=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x83ee[_0x480bc8];return _0x28c245;};'use strict';var _=require(_0xe83e('0x0'));var util=require('util');var moment=require(_0xe83e('0x1'));var BPromise=require(_0xe83e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe83e('0x3'));var db=require(_0xe83e('0x4'))['db'];var utils=require(_0xe83e('0x5'));var logger=require(_0xe83e('0x6'))(_0xe83e('0x7'));var config=require(_0xe83e('0x8'));var jayson=require(_0xe83e('0x9'));var client=jayson[_0xe83e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b0217,_0x5bf6ed,_0x324c2b){return new BPromise(function(_0x26b115,_0x2bf7fb){return client['request'](_0x1b0217,_0x324c2b)['then'](function(_0x26839e){logger[_0xe83e('0xb')](_0xe83e('0xc'),_0x5bf6ed,_0xe83e('0xd'));logger[_0xe83e('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x5bf6ed,_0xe83e('0xd'),JSON[_0xe83e('0xf')](_0x26839e));if(_0x26839e['error']){if(_0x26839e[_0xe83e('0x10')]['code']===0x1f4){logger['error'](_0xe83e('0xc'),_0x5bf6ed,_0x26839e['error'][_0xe83e('0x11')]);return _0x2bf7fb(_0x26839e[_0xe83e('0x10')][_0xe83e('0x11')]);}logger['error'](_0xe83e('0xc'),_0x5bf6ed,_0x26839e[_0xe83e('0x10')][_0xe83e('0x11')]);return _0x26b115(_0x26839e['error'][_0xe83e('0x11')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x5bf6ed,_0xe83e('0xd'));_0x26b115(_0x26839e[_0xe83e('0x12')]['message']);}})['catch'](function(_0x15f741){logger[_0xe83e('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x5bf6ed,_0x15f741);_0x2bf7fb(_0x15f741);});});}exports[_0xe83e('0x13')]=function(_0x5f3710){var _0x213529=this;return new Promise(function(_0x571dd9,_0x2706b4){return db['FaxQueueReport'][_0xe83e('0x14')](_0x5f3710['body'],{'raw':_0x5f3710[_0xe83e('0x15')]?_0x5f3710[_0xe83e('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xe83e('0x16')](function(_0x3be2ca){logger[_0xe83e('0xb')](_0xe83e('0x13'),_0x5f3710);logger['debug'](_0xe83e('0x13'),_0x5f3710,JSON['stringify'](_0x3be2ca));_0x571dd9(_0x3be2ca);})['catch'](function(_0x4e3485){logger['error'](_0xe83e('0x13'),_0x4e3485[_0xe83e('0x11')],_0x5f3710);_0x2706b4(_0x213529[_0xe83e('0x10')](0x1f4,_0x4e3485[_0xe83e('0x11')]));});});};exports[_0xe83e('0x17')]=function(_0x5b1c35){var _0x1cf5d9=this;return new Promise(function(_0x2c4781,_0xf176c0){return db['FaxQueueReport'][_0xe83e('0x18')](_0x5b1c35[_0xe83e('0x19')],{'raw':_0x5b1c35[_0xe83e('0x15')]?_0x5b1c35[_0xe83e('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b1c35['options']?_0x5b1c35[_0xe83e('0x15')][_0xe83e('0x1a')]||null:null,'attributes':_0x5b1c35[_0xe83e('0x15')]?_0x5b1c35[_0xe83e('0x15')]['attributes']||null:null,'limit':_0x5b1c35[_0xe83e('0x15')]?_0x5b1c35[_0xe83e('0x15')]['limit']||null:null})[_0xe83e('0x16')](function(_0x2c6b24){logger['info'](_0xe83e('0x17'),_0x5b1c35);logger[_0xe83e('0xe')]('UpdateFaxQueueReport',_0x5b1c35,JSON[_0xe83e('0xf')](_0x2c6b24));_0x2c4781(_0x2c6b24);})[_0xe83e('0x1b')](function(_0x54f17d){logger[_0xe83e('0x10')](_0xe83e('0x17'),_0x54f17d[_0xe83e('0x11')],_0x5b1c35);_0xf176c0(_0x1cf5d9[_0xe83e('0x10')](0x1f4,_0x54f17d[_0xe83e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 905d80a..f0d7cd8 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 _0x6fd8=['Router','../../components/auth/service','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0x6fd8,0x10d));var _0x86fd=function(_0x1a8167,_0x4e57a4){_0x1a8167=_0x1a8167-0x0;var _0xe8197e=_0x6fd8[_0x1a8167];return _0xe8197e;};'use strict';var multer=require(_0x86fd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x86fd('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x86fd('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x86fd('0x3')]('/',auth[_0x86fd('0x4')](),controller[_0x86fd('0x5')]);router[_0x86fd('0x3')](_0x86fd('0x6'),auth[_0x86fd('0x4')](),controller['describe']);router[_0x86fd('0x3')](_0x86fd('0x7'),auth[_0x86fd('0x4')](),controller[_0x86fd('0x8')]);router[_0x86fd('0x9')]('/',auth['isAuthenticated'](),controller[_0x86fd('0xa')]);router[_0x86fd('0xb')]('/:id',auth[_0x86fd('0x4')](),controller['update']);router[_0x86fd('0xc')]('/:id',auth[_0x86fd('0x4')](),controller[_0x86fd('0xd')]);module[_0x86fd('0xe')]=router; \ No newline at end of file +var _0x108f=['util','path','connect-timeout','Router','../../config/environment','./faxQueueReport.controller','get','/describe','describe','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer'];(function(_0x45ee4f,_0x4c2d17){var _0x44853d=function(_0x478023){while(--_0x478023){_0x45ee4f['push'](_0x45ee4f['shift']());}};_0x44853d(++_0x4c2d17);}(_0x108f,0x1a1));var _0xf108=function(_0x362dca,_0x267f1a){_0x362dca=_0x362dca-0x0;var _0x4f300c=_0x108f[_0x362dca];return _0x4f300c;};'use strict';var multer=require(_0xf108('0x0'));var util=require(_0xf108('0x1'));var path=require(_0xf108('0x2'));var timeout=require(_0xf108('0x3'));var express=require('express');var router=express[_0xf108('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf108('0x5'));var controller=require(_0xf108('0x6'));router[_0xf108('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf108('0x7')](_0xf108('0x8'),auth['isAuthenticated'](),controller[_0xf108('0x9')]);router[_0xf108('0x7')](_0xf108('0xa'),auth[_0xf108('0xb')](),controller[_0xf108('0xc')]);router[_0xf108('0xd')]('/',auth[_0xf108('0xb')](),controller[_0xf108('0xe')]);router['put'](_0xf108('0xa'),auth[_0xf108('0xb')](),controller[_0xf108('0xf')]);router[_0xf108('0x10')]('/:id',auth[_0xf108('0xb')](),controller[_0xf108('0x11')]);module[_0xf108('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 6959d35..ef59bb5 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x5c8aed,_0x3a3c35){var _0x5c2eb0=function(_0x56e067){while(--_0x56e067){_0x5c8aed['push'](_0x5c8aed['shift']());}};_0x5c2eb0(++_0x3a3c35);}(_0x70e0,0x17b));var _0x070e=function(_0x4d1694,_0x4bd1cb){_0x4d1694=_0x4d1694-0x0;var _0x187800=_0x70e0[_0x4d1694];return _0x187800;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x503741,_0x4ead4e){var _0x1f9fc3=function(_0x544506){while(--_0x544506){_0x503741['push'](_0x503741['shift']());}};_0x1f9fc3(++_0x4ead4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 08ee90b..b2643f6 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 _0x5c02=['filter','merge','VIRTUAL','include','rows','show','params','includeAll','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','update','then','destroy','sendStatus','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x31daf3,_0x234429){var _0x53295f=function(_0x1cbca0){while(--_0x1cbca0){_0x31daf3['push'](_0x31daf3['shift']());}};_0x53295f(++_0x234429);}(_0x5c02,0x13a));var _0x25c0=function(_0x263419,_0x2debdc){_0x263419=_0x263419-0x0;var _0x3ceed9=_0x5c02[_0x263419];return _0x3ceed9;};'use strict';var emlformat=require(_0x25c0('0x0'));var rimraf=require(_0x25c0('0x1'));var zipdir=require(_0x25c0('0x2'));var jsonpatch=require(_0x25c0('0x3'));var rp=require(_0x25c0('0x4'));var moment=require(_0x25c0('0x5'));var BPromise=require(_0x25c0('0x6'));var Mustache=require('mustache');var util=require(_0x25c0('0x7'));var path=require('path');var sox=require(_0x25c0('0x8'));var csv=require(_0x25c0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x25c0('0xa'));var squel=require(_0x25c0('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x25c0('0xc'));var toCsv=require(_0x25c0('0x9'));var querystring=require(_0x25c0('0xd'));var Papa=require(_0x25c0('0xe'));var Redis=require(_0x25c0('0xf'));var authService=require(_0x25c0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x25c0('0x11'));var hardwareService=require(_0x25c0('0x12'));var logger=require(_0x25c0('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x25c0('0x14'));var licenseUtil=require(_0x25c0('0x15'));var db=require(_0x25c0('0x16'))['db'];function respondWithStatusCode(_0x39db0f,_0x34b505){_0x34b505=_0x34b505||0xcc;return function(_0x572d1b){if(_0x572d1b){return _0x39db0f['sendStatus'](_0x34b505);}return _0x39db0f[_0x25c0('0x17')](_0x34b505)[_0x25c0('0x18')]();};}function respondWithResult(_0x4bc6b3,_0x316c7d){_0x316c7d=_0x316c7d||0xc8;return function(_0x492183){if(_0x492183){return _0x4bc6b3[_0x25c0('0x17')](_0x316c7d)['json'](_0x492183);}};}function respondWithFilteredResult(_0x1ecc27,_0xeb29d4){return function(_0x21b9ba){if(_0x21b9ba){var _0x19f03b=typeof _0xeb29d4['offset']==='undefined'&&typeof _0xeb29d4[_0x25c0('0x19')]===_0x25c0('0x1a');var _0x5341b6=_0x21b9ba[_0x25c0('0x1b')];var _0x2c98f0=_0x19f03b?0x0:_0xeb29d4[_0x25c0('0x1c')];var _0x3b9722=_0x19f03b?_0x21b9ba['count']:_0xeb29d4['offset']+_0xeb29d4[_0x25c0('0x19')];var _0x3e3507;if(_0x3b9722>=_0x5341b6){_0x3b9722=_0x5341b6;_0x3e3507=0xc8;}else{_0x3e3507=0xce;}_0x1ecc27['status'](_0x3e3507);return _0x1ecc27[_0x25c0('0x1d')](_0x25c0('0x1e'),_0x2c98f0+'-'+_0x3b9722+'/'+_0x5341b6)[_0x25c0('0x1f')](_0x21b9ba);}return null;};}function patchUpdates(_0x45ef56){return function(_0x2158df){try{jsonpatch['apply'](_0x2158df,_0x45ef56,!![]);}catch(_0x22cdac){return BPromise[_0x25c0('0x20')](_0x22cdac);}return _0x2158df['save']();};}function saveUpdates(_0x31eb8f,_0x35aff3){return function(_0x5c2232){if(_0x5c2232){return _0x5c2232[_0x25c0('0x21')](_0x31eb8f)[_0x25c0('0x22')](function(_0x264b0f){return _0x264b0f;});}return null;};}function removeEntity(_0x54415c,_0x4ccd90){return function(_0x173ec1){if(_0x173ec1){return _0x173ec1[_0x25c0('0x23')]()[_0x25c0('0x22')](function(){_0x54415c[_0x25c0('0x17')](0xcc)[_0x25c0('0x18')]();});}};}function handleEntityNotFound(_0x233390,_0x1625f4){return function(_0x30f951){if(!_0x30f951){_0x233390[_0x25c0('0x24')](0x194);}return _0x30f951;};}function handleError(_0x189edf,_0x54e6d6){_0x54e6d6=_0x54e6d6||0x1f4;return function(_0xf0e80e){logger['error'](_0xf0e80e[_0x25c0('0x25')]);if(_0xf0e80e[_0x25c0('0x26')]){delete _0xf0e80e[_0x25c0('0x26')];}_0x189edf[_0x25c0('0x17')](_0x54e6d6)[_0x25c0('0x27')](_0xf0e80e);};}exports[_0x25c0('0x28')]=function(_0x552a23,_0xd9c336){var _0x3cff0d={},_0xda4fb6={},_0x99664a={'count':0x0,'rows':[]};var _0x2e8f87=_[_0x25c0('0x29')](db[_0x25c0('0x2a')][_0x25c0('0x2b')],function(_0x36df96){return{'name':_0x36df96[_0x25c0('0x2c')],'type':_0x36df96[_0x25c0('0x2d')][_0x25c0('0x2e')]};});_0xda4fb6[_0x25c0('0x2f')]=_[_0x25c0('0x29')](_0x2e8f87,_0x25c0('0x26'));_0xda4fb6[_0x25c0('0x30')]=_[_0x25c0('0x31')](_0x552a23[_0x25c0('0x30')]);_0xda4fb6[_0x25c0('0x32')]=_[_0x25c0('0x33')](_0xda4fb6[_0x25c0('0x2f')],_0xda4fb6[_0x25c0('0x30')]);_0x3cff0d[_0x25c0('0x34')]=_[_0x25c0('0x33')](_0xda4fb6[_0x25c0('0x2f')],qs[_0x25c0('0x35')](_0x552a23['query'][_0x25c0('0x35')]));_0x3cff0d['attributes']=_0x3cff0d[_0x25c0('0x34')][_0x25c0('0x36')]?_0x3cff0d[_0x25c0('0x34')]:_0xda4fb6[_0x25c0('0x2f')];if(!_0x552a23[_0x25c0('0x30')][_0x25c0('0x37')](_0x25c0('0x38'))){_0x3cff0d[_0x25c0('0x19')]=qs[_0x25c0('0x19')](_0x552a23[_0x25c0('0x30')][_0x25c0('0x19')]);_0x3cff0d['offset']=qs[_0x25c0('0x1c')](_0x552a23[_0x25c0('0x30')][_0x25c0('0x1c')]);}_0x3cff0d[_0x25c0('0x39')]=qs[_0x25c0('0x3a')](_0x552a23[_0x25c0('0x30')]['sort']);_0x3cff0d[_0x25c0('0x3b')]=qs['filters'](_[_0x25c0('0x3c')](_0x552a23['query'],_0xda4fb6[_0x25c0('0x32')]),_0x2e8f87);if(_0x552a23[_0x25c0('0x30')][_0x25c0('0x3d')]){_0x3cff0d[_0x25c0('0x3b')]=_[_0x25c0('0x3e')](_0x3cff0d[_0x25c0('0x3b')],{'$or':_['map'](_0x2e8f87,function(_0x49f2be){if(_0x49f2be[_0x25c0('0x2d')]!==_0x25c0('0x3f')){var _0x10fd83={};_0x10fd83[_0x49f2be[_0x25c0('0x26')]]={'$like':'%'+_0x552a23[_0x25c0('0x30')][_0x25c0('0x3d')]+'%'};return _0x10fd83;}})});}_0x3cff0d=_[_0x25c0('0x3e')]({},_0x3cff0d,_0x552a23['options']);var _0x192f66={'where':_0x3cff0d['where']};return db[_0x25c0('0x2a')][_0x25c0('0x1b')](_0x192f66)[_0x25c0('0x22')](function(_0x5672d9){_0x99664a['count']=_0x5672d9;if(_0x552a23[_0x25c0('0x30')]['includeAll']){_0x3cff0d[_0x25c0('0x40')]=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x3cff0d);})[_0x25c0('0x22')](function(_0xf90593){_0x99664a[_0x25c0('0x41')]=_0xf90593;return _0x99664a;})[_0x25c0('0x22')](respondWithFilteredResult(_0xd9c336,_0x3cff0d))['catch'](handleError(_0xd9c336,null));};exports[_0x25c0('0x42')]=function(_0xa43eb6,_0x4164c2){var _0x217b0a={'raw':!![],'where':{'id':_0xa43eb6[_0x25c0('0x43')]['id']}},_0x13d323={};_0x13d323['model']=_[_0x25c0('0x31')](db[_0x25c0('0x2a')][_0x25c0('0x2b')]);_0x13d323[_0x25c0('0x30')]=_[_0x25c0('0x31')](_0xa43eb6[_0x25c0('0x30')]);_0x13d323['filters']=_[_0x25c0('0x33')](_0x13d323['model'],_0x13d323[_0x25c0('0x30')]);_0x217b0a[_0x25c0('0x34')]=_[_0x25c0('0x33')](_0x13d323[_0x25c0('0x2f')],qs[_0x25c0('0x35')](_0xa43eb6[_0x25c0('0x30')][_0x25c0('0x35')]));_0x217b0a[_0x25c0('0x34')]=_0x217b0a[_0x25c0('0x34')][_0x25c0('0x36')]?_0x217b0a[_0x25c0('0x34')]:_0x13d323[_0x25c0('0x2f')];if(_0xa43eb6[_0x25c0('0x30')][_0x25c0('0x44')]){_0x217b0a[_0x25c0('0x40')]=[{'all':!![]}];}_0x217b0a=_['merge']({},_0x217b0a,_0xa43eb6[_0x25c0('0x45')]);return db[_0x25c0('0x2a')][_0x25c0('0x46')](_0x217b0a)[_0x25c0('0x22')](handleEntityNotFound(_0x4164c2,null))[_0x25c0('0x22')](respondWithResult(_0x4164c2,null))[_0x25c0('0x47')](handleError(_0x4164c2,null));};exports['create']=function(_0x582102,_0x268362){return db[_0x25c0('0x2a')][_0x25c0('0x48')](_0x582102[_0x25c0('0x49')],{})[_0x25c0('0x22')](respondWithResult(_0x268362,0xc9))['catch'](handleError(_0x268362,null));};exports[_0x25c0('0x21')]=function(_0x466398,_0xd13c77){if(_0x466398[_0x25c0('0x49')]['id']){delete _0x466398[_0x25c0('0x49')]['id'];}return db[_0x25c0('0x2a')][_0x25c0('0x46')]({'where':{'id':_0x466398['params']['id']}})['then'](handleEntityNotFound(_0xd13c77,null))[_0x25c0('0x22')](saveUpdates(_0x466398[_0x25c0('0x49')],null))[_0x25c0('0x22')](respondWithResult(_0xd13c77,null))[_0x25c0('0x47')](handleError(_0xd13c77,null));};exports[_0x25c0('0x23')]=function(_0x2facfe,_0x29073b){return db[_0x25c0('0x2a')][_0x25c0('0x46')]({'where':{'id':_0x2facfe['params']['id']}})[_0x25c0('0x22')](handleEntityNotFound(_0x29073b,null))['then'](removeEntity(_0x29073b,null))['catch'](handleError(_0x29073b,null));};exports[_0x25c0('0x4a')]=function(_0x31b1a4,_0x55b51d){return db['FaxTransferReport'][_0x25c0('0x4a')]()['then'](respondWithResult(_0x55b51d,null))[_0x25c0('0x47')](handleError(_0x55b51d,null));}; \ No newline at end of file +var _0x4f81=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','FaxTransferReport','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x1e7602,_0x1929ee){var _0x3e32d4=function(_0x37f25c){while(--_0x37f25c){_0x1e7602['push'](_0x1e7602['shift']());}};_0x3e32d4(++_0x1929ee);}(_0x4f81,0x101));var _0x14f8=function(_0x4ffad0,_0x203153){_0x4ffad0=_0x4ffad0-0x0;var _0x40a9fa=_0x4f81[_0x4ffad0];return _0x40a9fa;};'use strict';var emlformat=require(_0x14f8('0x0'));var rimraf=require(_0x14f8('0x1'));var zipdir=require(_0x14f8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x14f8('0x3'));var moment=require(_0x14f8('0x4'));var BPromise=require(_0x14f8('0x5'));var Mustache=require(_0x14f8('0x6'));var util=require('util');var path=require(_0x14f8('0x7'));var sox=require(_0x14f8('0x8'));var csv=require(_0x14f8('0x9'));var ejs=require(_0x14f8('0xa'));var fs=require('fs');var fs_extra=require(_0x14f8('0xb'));var _=require(_0x14f8('0xc'));var squel=require('squel');var crypto=require(_0x14f8('0xd'));var jsforce=require(_0x14f8('0xe'));var deskjs=require(_0x14f8('0xf'));var toCsv=require(_0x14f8('0x9'));var querystring=require(_0x14f8('0x10'));var Papa=require(_0x14f8('0x11'));var Redis=require(_0x14f8('0x12'));var authService=require(_0x14f8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x14f8('0x14'));var hardwareService=require(_0x14f8('0x15'));var logger=require(_0x14f8('0x16'))(_0x14f8('0x17'));var utils=require(_0x14f8('0x18'));var config=require(_0x14f8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x14f8('0x1a'))['db'];function respondWithStatusCode(_0x5c9644,_0x39f179){_0x39f179=_0x39f179||0xcc;return function(_0x424876){if(_0x424876){return _0x5c9644[_0x14f8('0x1b')](_0x39f179);}return _0x5c9644[_0x14f8('0x1c')](_0x39f179)[_0x14f8('0x1d')]();};}function respondWithResult(_0x5144cb,_0x34065d){_0x34065d=_0x34065d||0xc8;return function(_0x22e7fb){if(_0x22e7fb){return _0x5144cb[_0x14f8('0x1c')](_0x34065d)['json'](_0x22e7fb);}};}function respondWithFilteredResult(_0x34882f,_0x51a548){return function(_0x37c600){if(_0x37c600){var _0x4973ef=typeof _0x51a548[_0x14f8('0x1e')]===_0x14f8('0x1f')&&typeof _0x51a548[_0x14f8('0x20')]===_0x14f8('0x1f');var _0x5d5743=_0x37c600[_0x14f8('0x21')];var _0x5c8cab=_0x4973ef?0x0:_0x51a548[_0x14f8('0x1e')];var _0x59ad34=_0x4973ef?_0x37c600[_0x14f8('0x21')]:_0x51a548['offset']+_0x51a548[_0x14f8('0x20')];var _0x393694;if(_0x59ad34>=_0x5d5743){_0x59ad34=_0x5d5743;_0x393694=0xc8;}else{_0x393694=0xce;}_0x34882f[_0x14f8('0x1c')](_0x393694);return _0x34882f[_0x14f8('0x22')](_0x14f8('0x23'),_0x5c8cab+'-'+_0x59ad34+'/'+_0x5d5743)['json'](_0x37c600);}return null;};}function patchUpdates(_0x59e767){return function(_0x2ad8fc){try{jsonpatch[_0x14f8('0x24')](_0x2ad8fc,_0x59e767,!![]);}catch(_0x1124b8){return BPromise[_0x14f8('0x25')](_0x1124b8);}return _0x2ad8fc[_0x14f8('0x26')]();};}function saveUpdates(_0x16fd8a,_0x16acc2){return function(_0x83aece){if(_0x83aece){return _0x83aece[_0x14f8('0x27')](_0x16fd8a)[_0x14f8('0x28')](function(_0x397623){return _0x397623;});}return null;};}function removeEntity(_0xe7ba15,_0x506c49){return function(_0x15f76b){if(_0x15f76b){return _0x15f76b[_0x14f8('0x29')]()['then'](function(){_0xe7ba15[_0x14f8('0x1c')](0xcc)[_0x14f8('0x1d')]();});}};}function handleEntityNotFound(_0x316577,_0x578e6e){return function(_0x221c29){if(!_0x221c29){_0x316577[_0x14f8('0x1b')](0x194);}return _0x221c29;};}function handleError(_0x209943,_0x551682){_0x551682=_0x551682||0x1f4;return function(_0xd8c538){logger[_0x14f8('0x2a')](_0xd8c538['stack']);if(_0xd8c538[_0x14f8('0x2b')]){delete _0xd8c538[_0x14f8('0x2b')];}_0x209943[_0x14f8('0x1c')](_0x551682)[_0x14f8('0x2c')](_0xd8c538);};}exports[_0x14f8('0x2d')]=function(_0x3444f8,_0x26697e){var _0xbc0fa8={},_0x2f2d56={},_0xea12c4={'count':0x0,'rows':[]};var _0x98c44a=_[_0x14f8('0x2e')](db['FaxTransferReport'][_0x14f8('0x2f')],function(_0x5d366a){return{'name':_0x5d366a[_0x14f8('0x30')],'type':_0x5d366a[_0x14f8('0x31')][_0x14f8('0x32')]};});_0x2f2d56[_0x14f8('0x33')]=_[_0x14f8('0x2e')](_0x98c44a,'name');_0x2f2d56[_0x14f8('0x34')]=_[_0x14f8('0x35')](_0x3444f8[_0x14f8('0x34')]);_0x2f2d56[_0x14f8('0x36')]=_[_0x14f8('0x37')](_0x2f2d56[_0x14f8('0x33')],_0x2f2d56[_0x14f8('0x34')]);_0xbc0fa8[_0x14f8('0x38')]=_[_0x14f8('0x37')](_0x2f2d56[_0x14f8('0x33')],qs['fields'](_0x3444f8[_0x14f8('0x34')][_0x14f8('0x39')]));_0xbc0fa8[_0x14f8('0x38')]=_0xbc0fa8[_0x14f8('0x38')][_0x14f8('0x3a')]?_0xbc0fa8[_0x14f8('0x38')]:_0x2f2d56[_0x14f8('0x33')];if(!_0x3444f8['query'][_0x14f8('0x3b')](_0x14f8('0x3c'))){_0xbc0fa8['limit']=qs[_0x14f8('0x20')](_0x3444f8['query'][_0x14f8('0x20')]);_0xbc0fa8[_0x14f8('0x1e')]=qs['offset'](_0x3444f8[_0x14f8('0x34')][_0x14f8('0x1e')]);}_0xbc0fa8[_0x14f8('0x3d')]=qs[_0x14f8('0x3e')](_0x3444f8[_0x14f8('0x34')][_0x14f8('0x3e')]);_0xbc0fa8[_0x14f8('0x3f')]=qs[_0x14f8('0x36')](_[_0x14f8('0x40')](_0x3444f8['query'],_0x2f2d56[_0x14f8('0x36')]),_0x98c44a);if(_0x3444f8['query'][_0x14f8('0x41')]){_0xbc0fa8[_0x14f8('0x3f')]=_[_0x14f8('0x42')](_0xbc0fa8[_0x14f8('0x3f')],{'$or':_[_0x14f8('0x2e')](_0x98c44a,function(_0xebc315){if(_0xebc315[_0x14f8('0x31')]!=='VIRTUAL'){var _0xceaf6c={};_0xceaf6c[_0xebc315[_0x14f8('0x2b')]]={'$like':'%'+_0x3444f8[_0x14f8('0x34')][_0x14f8('0x41')]+'%'};return _0xceaf6c;}})});}_0xbc0fa8=_[_0x14f8('0x42')]({},_0xbc0fa8,_0x3444f8['options']);var _0x1e0568={'where':_0xbc0fa8['where']};return db['FaxTransferReport'][_0x14f8('0x21')](_0x1e0568)[_0x14f8('0x28')](function(_0x2d873e){_0xea12c4[_0x14f8('0x21')]=_0x2d873e;if(_0x3444f8[_0x14f8('0x34')]['includeAll']){_0xbc0fa8[_0x14f8('0x43')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x14f8('0x44')](_0xbc0fa8);})['then'](function(_0x4914dc){_0xea12c4[_0x14f8('0x45')]=_0x4914dc;return _0xea12c4;})[_0x14f8('0x28')](respondWithFilteredResult(_0x26697e,_0xbc0fa8))[_0x14f8('0x46')](handleError(_0x26697e,null));};exports['show']=function(_0x3afa43,_0x116cc1){var _0x3cb056={'raw':!![],'where':{'id':_0x3afa43['params']['id']}},_0x4f231f={};_0x4f231f[_0x14f8('0x33')]=_['keys'](db[_0x14f8('0x47')][_0x14f8('0x2f')]);_0x4f231f['query']=_[_0x14f8('0x35')](_0x3afa43['query']);_0x4f231f[_0x14f8('0x36')]=_[_0x14f8('0x37')](_0x4f231f[_0x14f8('0x33')],_0x4f231f[_0x14f8('0x34')]);_0x3cb056['attributes']=_[_0x14f8('0x37')](_0x4f231f['model'],qs[_0x14f8('0x39')](_0x3afa43[_0x14f8('0x34')][_0x14f8('0x39')]));_0x3cb056[_0x14f8('0x38')]=_0x3cb056[_0x14f8('0x38')][_0x14f8('0x3a')]?_0x3cb056[_0x14f8('0x38')]:_0x4f231f[_0x14f8('0x33')];if(_0x3afa43['query'][_0x14f8('0x48')]){_0x3cb056['include']=[{'all':!![]}];}_0x3cb056=_['merge']({},_0x3cb056,_0x3afa43[_0x14f8('0x49')]);return db['FaxTransferReport'][_0x14f8('0x4a')](_0x3cb056)[_0x14f8('0x28')](handleEntityNotFound(_0x116cc1,null))[_0x14f8('0x28')](respondWithResult(_0x116cc1,null))[_0x14f8('0x46')](handleError(_0x116cc1,null));};exports[_0x14f8('0x4b')]=function(_0x3b0e96,_0x47fab9){return db['FaxTransferReport']['create'](_0x3b0e96[_0x14f8('0x4c')],{})[_0x14f8('0x28')](respondWithResult(_0x47fab9,0xc9))[_0x14f8('0x46')](handleError(_0x47fab9,null));};exports[_0x14f8('0x27')]=function(_0x1a215c,_0x439d24){if(_0x1a215c[_0x14f8('0x4c')]['id']){delete _0x1a215c['body']['id'];}return db['FaxTransferReport'][_0x14f8('0x4a')]({'where':{'id':_0x1a215c['params']['id']}})[_0x14f8('0x28')](handleEntityNotFound(_0x439d24,null))[_0x14f8('0x28')](saveUpdates(_0x1a215c[_0x14f8('0x4c')],null))[_0x14f8('0x28')](respondWithResult(_0x439d24,null))['catch'](handleError(_0x439d24,null));};exports[_0x14f8('0x29')]=function(_0x506c7c,_0xba7e36){return db['FaxTransferReport']['find']({'where':{'id':_0x506c7c['params']['id']}})['then'](handleEntityNotFound(_0xba7e36,null))[_0x14f8('0x28')](removeEntity(_0xba7e36,null))[_0x14f8('0x46')](handleError(_0xba7e36,null));};exports[_0x14f8('0x4d')]=function(_0x5a5371,_0x599042){return db[_0x14f8('0x47')][_0x14f8('0x4d')]()[_0x14f8('0x28')](respondWithResult(_0x599042,null))[_0x14f8('0x46')](handleError(_0x599042,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index dc921e1..50c08b1 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 _0xb67f=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define'];(function(_0x2b9e6d,_0x5c54ce){var _0x4d9413=function(_0x189ba7){while(--_0x189ba7){_0x2b9e6d['push'](_0x2b9e6d['shift']());}};_0x4d9413(++_0x5c54ce);}(_0xb67f,0x12d));var _0xfb67=function(_0x2d4dd7,_0x739a55){_0x2d4dd7=_0x2d4dd7-0x0;var _0x14109f=_0xb67f[_0x2d4dd7];return _0x14109f;};'use strict';var _=require('lodash');var util=require(_0xfb67('0x0'));var logger=require(_0xfb67('0x1'))(_0xfb67('0x2'));var moment=require(_0xfb67('0x3'));var BPromise=require(_0xfb67('0x4'));var rp=require(_0xfb67('0x5'));var fs=require('fs');var path=require(_0xfb67('0x6'));var rimraf=require(_0xfb67('0x7'));var config=require('../../config/environment');var attributes=require(_0xfb67('0x8'));module[_0xfb67('0x9')]=function(_0x2dc6bf,_0x43bc06){return _0x2dc6bf[_0xfb67('0xa')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xfb67('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a52=['report_fax_transfer','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport'];(function(_0x129a57,_0x330d03){var _0xa7147c=function(_0x4e6c1f){while(--_0x4e6c1f){_0x129a57['push'](_0x129a57['shift']());}};_0xa7147c(++_0x330d03);}(_0x7a52,0x1bd));var _0x27a5=function(_0x257d68,_0x5d3d75){_0x257d68=_0x257d68-0x0;var _0x1470c1=_0x7a52[_0x257d68];return _0x1470c1;};'use strict';var _=require(_0x27a5('0x0'));var util=require('util');var logger=require(_0x27a5('0x1'))(_0x27a5('0x2'));var moment=require(_0x27a5('0x3'));var BPromise=require(_0x27a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27a5('0x5'));var rimraf=require(_0x27a5('0x6'));var config=require(_0x27a5('0x7'));var attributes=require(_0x27a5('0x8'));module[_0x27a5('0x9')]=function(_0x393c55,_0x23fc7e){return _0x393c55['define'](_0x27a5('0xa'),attributes,{'tableName':_0x27a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 8dbd010..a229755 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 _0x9521=['../../config/environment','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','bluebird','ioredis','rpc'];(function(_0x57a962,_0x847d7c){var _0x2aff26=function(_0x59b1e8){while(--_0x59b1e8){_0x57a962['push'](_0x57a962['shift']());}};_0x2aff26(++_0x847d7c);}(_0x9521,0x13f));var _0x1952=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x9521[_0x56f7e2];return _0x36240b;};'use strict';var _=require(_0x1952('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1952('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1952('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1952('0x3'));var config=require(_0x1952('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x1952('0x5')][_0x1952('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x204d0d,_0x1e4bb9,_0x23bb9f){return new BPromise(function(_0x4ec920,_0x1b94ae){return client[_0x1952('0x7')](_0x204d0d,_0x23bb9f)[_0x1952('0x8')](function(_0x998b44){logger[_0x1952('0x9')](_0x1952('0xa'),_0x1e4bb9,_0x1952('0xb'));logger['debug'](_0x1952('0xc'),_0x1e4bb9,_0x1952('0xb'),JSON[_0x1952('0xd')](_0x998b44));if(_0x998b44['error']){if(_0x998b44[_0x1952('0xe')]['code']===0x1f4){logger[_0x1952('0xe')](_0x1952('0xa'),_0x1e4bb9,_0x998b44[_0x1952('0xe')]['message']);return _0x1b94ae(_0x998b44[_0x1952('0xe')][_0x1952('0xf')]);}logger[_0x1952('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x1e4bb9,_0x998b44[_0x1952('0xe')][_0x1952('0xf')]);return _0x4ec920(_0x998b44[_0x1952('0xe')][_0x1952('0xf')]);}else{logger[_0x1952('0x9')]('FaxTransferReport,\x20%s,\x20%s',_0x1e4bb9,_0x1952('0xb'));_0x4ec920(_0x998b44['result'][_0x1952('0xf')]);}})[_0x1952('0x10')](function(_0x2041a9){logger[_0x1952('0xe')](_0x1952('0xa'),_0x1e4bb9,_0x2041a9);_0x1b94ae(_0x2041a9);});});} \ No newline at end of file +var _0x66b4=['code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4545ac,_0xa7a65c){var _0x4512fb=function(_0x41329f){while(--_0x41329f){_0x4545ac['push'](_0x4545ac['shift']());}};_0x4512fb(++_0xa7a65c);}(_0x66b4,0x16d));var _0x466b=function(_0x4cf94c,_0x12d368){_0x4cf94c=_0x4cf94c-0x0;var _0x3ec73e=_0x66b4[_0x4cf94c];return _0x3ec73e;};'use strict';var _=require(_0x466b('0x0'));var util=require(_0x466b('0x1'));var moment=require(_0x466b('0x2'));var BPromise=require(_0x466b('0x3'));var rs=require(_0x466b('0x4'));var fs=require('fs');var Redis=require(_0x466b('0x5'));var db=require(_0x466b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x466b('0x7'))(_0x466b('0x8'));var config=require(_0x466b('0x9'));var jayson=require(_0x466b('0xa'));var client=jayson[_0x466b('0xb')][_0x466b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12e509,_0x490ce1,_0x2835b3){return new BPromise(function(_0x5f32ac,_0x3d191d){return client['request'](_0x12e509,_0x2835b3)[_0x466b('0xd')](function(_0x3598b9){logger[_0x466b('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x490ce1,_0x466b('0xf'));logger['debug'](_0x466b('0x10'),_0x490ce1,_0x466b('0xf'),JSON[_0x466b('0x11')](_0x3598b9));if(_0x3598b9[_0x466b('0x12')]){if(_0x3598b9['error'][_0x466b('0x13')]===0x1f4){logger[_0x466b('0x12')](_0x466b('0x14'),_0x490ce1,_0x3598b9[_0x466b('0x12')][_0x466b('0x15')]);return _0x3d191d(_0x3598b9[_0x466b('0x12')]['message']);}logger[_0x466b('0x12')](_0x466b('0x14'),_0x490ce1,_0x3598b9[_0x466b('0x12')][_0x466b('0x15')]);return _0x5f32ac(_0x3598b9[_0x466b('0x12')][_0x466b('0x15')]);}else{logger[_0x466b('0xe')](_0x466b('0x14'),_0x490ce1,'request\x20sent');_0x5f32ac(_0x3598b9[_0x466b('0x16')][_0x466b('0x15')]);}})[_0x466b('0x17')](function(_0x25bc1e){logger[_0x466b('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x490ce1,_0x25bc1e);_0x3d191d(_0x25bc1e);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 3dd7878..4aee2c4 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 _0x18d2=['describe','get','/:id','show','post','create','put','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','/describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x18d2,0x1ad));var _0x218d=function(_0x20db6b,_0x2aa394){_0x20db6b=_0x20db6b-0x0;var _0x4846d8=_0x18d2[_0x20db6b];return _0x4846d8;};'use strict';var multer=require('multer');var util=require(_0x218d('0x0'));var path=require('path');var timeout=require(_0x218d('0x1'));var express=require(_0x218d('0x2'));var router=express[_0x218d('0x3')]();var fs_extra=require(_0x218d('0x4'));var auth=require(_0x218d('0x5'));var interaction=require(_0x218d('0x6'));var config=require(_0x218d('0x7'));var controller=require(_0x218d('0x8'));router['get']('/',auth[_0x218d('0x9')](),controller[_0x218d('0xa')]);router['get'](_0x218d('0xb'),auth['isAuthenticated'](),controller[_0x218d('0xc')]);router[_0x218d('0xd')](_0x218d('0xe'),auth[_0x218d('0x9')](),controller[_0x218d('0xf')]);router[_0x218d('0x10')]('/',auth[_0x218d('0x9')](),controller[_0x218d('0x11')]);router[_0x218d('0x12')](_0x218d('0xe'),auth[_0x218d('0x9')](),controller['update']);router[_0x218d('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x218d('0x14')]=router; \ No newline at end of file +var _0x7758=['/:id','post','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x40c2c9,_0xf6e33c){var _0x52452a=function(_0x4dcd6c){while(--_0x4dcd6c){_0x40c2c9['push'](_0x40c2c9['shift']());}};_0x52452a(++_0xf6e33c);}(_0x7758,0x101));var _0x8775=function(_0x4489ee,_0x539e29){_0x4489ee=_0x4489ee-0x0;var _0x1fdff1=_0x7758[_0x4489ee];return _0x1fdff1;};'use strict';var multer=require(_0x8775('0x0'));var util=require(_0x8775('0x1'));var path=require(_0x8775('0x2'));var timeout=require(_0x8775('0x3'));var express=require('express');var router=express[_0x8775('0x4')]();var fs_extra=require(_0x8775('0x5'));var auth=require(_0x8775('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8775('0x7'));router[_0x8775('0x8')]('/',auth[_0x8775('0x9')](),controller[_0x8775('0xa')]);router[_0x8775('0x8')](_0x8775('0xb'),auth['isAuthenticated'](),controller[_0x8775('0xc')]);router[_0x8775('0x8')](_0x8775('0xd'),auth[_0x8775('0x9')](),controller['show']);router[_0x8775('0xe')]('/',auth[_0x8775('0x9')](),controller['create']);router[_0x8775('0xf')](_0x8775('0xd'),auth[_0x8775('0x9')](),controller[_0x8775('0x10')]);router['delete'](_0x8775('0xd'),auth[_0x8775('0x9')](),controller['destroy']);module[_0x8775('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index ad6ab13..5b8490a 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 _0xd472=['/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x2a4412,_0x314034){var _0x36f71e=function(_0x3dd386){while(--_0x3dd386){_0x2a4412['push'](_0x2a4412['shift']());}};_0x36f71e(++_0x314034);}(_0xd472,0x1eb));var _0x2d47=function(_0x4826ca,_0x29aab0){_0x4826ca=_0x4826ca-0x0;var _0x1f3f38=_0xd472[_0x4826ca];return _0x1f3f38;};'use strict';var multer=require(_0x2d47('0x0'));var util=require(_0x2d47('0x1'));var path=require(_0x2d47('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d47('0x3'));var router=express[_0x2d47('0x4')]();var fs_extra=require(_0x2d47('0x5'));var auth=require(_0x2d47('0x6'));var interaction=require(_0x2d47('0x7'));var config=require(_0x2d47('0x8'));var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0x2d47('0x9')](),controller[_0x2d47('0xa')]);router[_0x2d47('0xb')](_0x2d47('0xc'),auth[_0x2d47('0x9')](),controller['show']);router[_0x2d47('0xb')](_0x2d47('0xd'),auth[_0x2d47('0x9')](),controller['getConfigurations']);router['get'](_0x2d47('0xe'),auth[_0x2d47('0x9')](),controller[_0x2d47('0xf')]);router[_0x2d47('0x10')]('/',auth['isAuthenticated'](),controller[_0x2d47('0x11')]);router[_0x2d47('0x10')](_0x2d47('0xd'),auth[_0x2d47('0x9')](),controller[_0x2d47('0x12')]);router[_0x2d47('0x13')](_0x2d47('0xc'),auth[_0x2d47('0x9')](),controller[_0x2d47('0x14')]);router[_0x2d47('0x15')](_0x2d47('0xc'),auth[_0x2d47('0x9')](),controller[_0x2d47('0x16')]);module[_0x2d47('0x17')]=router; \ No newline at end of file +var _0xb96e=['isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get'];(function(_0x64281a,_0x5af55c){var _0x303a6b=function(_0x3048fb){while(--_0x3048fb){_0x64281a['push'](_0x64281a['shift']());}};_0x303a6b(++_0x5af55c);}(_0xb96e,0x108));var _0xeb96=function(_0x46b9d6,_0x4a242c){_0x46b9d6=_0x46b9d6-0x0;var _0x3287c2=_0xb96e[_0x46b9d6];return _0x3287c2;};'use strict';var multer=require('multer');var util=require(_0xeb96('0x0'));var path=require(_0xeb96('0x1'));var timeout=require(_0xeb96('0x2'));var express=require('express');var router=express[_0xeb96('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xeb96('0x4'));var interaction=require(_0xeb96('0x5'));var config=require(_0xeb96('0x6'));var controller=require(_0xeb96('0x7'));router[_0xeb96('0x8')]('/',auth[_0xeb96('0x9')](),controller['index']);router[_0xeb96('0x8')](_0xeb96('0xa'),auth[_0xeb96('0x9')](),controller[_0xeb96('0xb')]);router[_0xeb96('0x8')](_0xeb96('0xc'),auth[_0xeb96('0x9')](),controller[_0xeb96('0xd')]);router[_0xeb96('0x8')](_0xeb96('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xeb96('0xf')]('/',auth['isAuthenticated'](),controller[_0xeb96('0x10')]);router[_0xeb96('0xf')](_0xeb96('0xc'),auth[_0xeb96('0x9')](),controller['addConfiguration']);router[_0xeb96('0x11')](_0xeb96('0xa'),auth['isAuthenticated'](),controller[_0xeb96('0x12')]);router[_0xeb96('0x13')]('/:id',auth[_0xeb96('0x9')](),controller[_0xeb96('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 6cf62c9..959fceb 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 _0x04f8=['integrationTab','exports','STRING','ENUM','basic'];(function(_0x50b2c9,_0x2758a8){var _0x20ae2e=function(_0x31ea5d){while(--_0x31ea5d){_0x50b2c9['push'](_0x50b2c9['shift']());}};_0x20ae2e(++_0x2758a8);}(_0x04f8,0x10f));var _0x804f=function(_0x837a6,_0x1988f6){_0x837a6=_0x837a6-0x0;var _0xea149f=_0x04f8[_0x837a6];return _0xea149f;};'use strict';var Sequelize=require('sequelize');module[_0x804f('0x0')]={'name':{'type':Sequelize[_0x804f('0x1')]},'description':{'type':Sequelize[_0x804f('0x1')]},'username':{'type':Sequelize[_0x804f('0x1')]},'remoteUri':{'type':Sequelize[_0x804f('0x1')]},'authType':{'type':Sequelize[_0x804f('0x2')](_0x804f('0x3')),'defaultValue':_0x804f('0x3')},'password':{'type':Sequelize[_0x804f('0x1')]},'consumerKey':{'type':Sequelize[_0x804f('0x1')]},'consumerSecret':{'type':Sequelize[_0x804f('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x804f('0x1')]},'serverUrl':{'type':Sequelize[_0x804f('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':_0x804f('0x4')}}; \ No newline at end of file +var _0x720d=['ENUM','basic','integrationTab','newTab','exports','STRING'];(function(_0x2a1e87,_0x2667ea){var _0x592037=function(_0x52fbea){while(--_0x52fbea){_0x2a1e87['push'](_0x2a1e87['shift']());}};_0x592037(++_0x2667ea);}(_0x720d,0x6a));var _0xd720=function(_0x4062aa,_0x1e444b){_0x4062aa=_0x4062aa-0x0;var _0x159ff9=_0x720d[_0x4062aa];return _0x159ff9;};'use strict';var Sequelize=require('sequelize');module[_0xd720('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd720('0x1')]},'username':{'type':Sequelize[_0xd720('0x1')]},'remoteUri':{'type':Sequelize[_0xd720('0x1')]},'authType':{'type':Sequelize[_0xd720('0x2')](_0xd720('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xd720('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xd720('0x1')]},'token':{'type':Sequelize[_0xd720('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xd720('0x2')](_0xd720('0x4'),_0xd720('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 3d44f50..b19f993 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 _0x7c5a=['end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','error','stack','name','map','DeskAccount','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','include','findAll','then','rows','catch','show','params','keys','length','includeAll','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','format','headers','Basic\x20%s','%s:%s','password','toString','base64','concat','_embedded','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','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/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c5a,0xc5));var _0xa7c5=function(_0x1c1842,_0x2fad73){_0x1c1842=_0x1c1842-0x0;var _0x2100c3=_0x7c5a[_0x1c1842];return _0x2100c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa7c5('0x0'));var zipdir=require(_0xa7c5('0x1'));var jsonpatch=require(_0xa7c5('0x2'));var rp=require(_0xa7c5('0x3'));var moment=require(_0xa7c5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa7c5('0x5'));var path=require(_0xa7c5('0x6'));var sox=require(_0xa7c5('0x7'));var csv=require('to-csv');var ejs=require(_0xa7c5('0x8'));var fs=require('fs');var fs_extra=require(_0xa7c5('0x9'));var _=require(_0xa7c5('0xa'));var squel=require(_0xa7c5('0xb'));var crypto=require(_0xa7c5('0xc'));var jsforce=require(_0xa7c5('0xd'));var deskjs=require(_0xa7c5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa7c5('0xf'));var Papa=require(_0xa7c5('0x10'));var Redis=require(_0xa7c5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa7c5('0x12'));var as=require(_0xa7c5('0x13'));var hardwareService=require(_0xa7c5('0x14'));var logger=require(_0xa7c5('0x15'))(_0xa7c5('0x16'));var utils=require(_0xa7c5('0x17'));var config=require(_0xa7c5('0x18'));var licenseUtil=require(_0xa7c5('0x19'));var db=require(_0xa7c5('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x53e348,_0x3f8ffe){_0x3f8ffe=_0x3f8ffe||0xcc;return function(_0x3be176){if(_0x3be176){return _0x53e348[_0xa7c5('0x1b')](_0x3f8ffe);}return _0x53e348[_0xa7c5('0x1c')](_0x3f8ffe)[_0xa7c5('0x1d')]();};}function respondWithResult(_0x562cdc,_0xe9a69){_0xe9a69=_0xe9a69||0xc8;return function(_0x4e46d2){if(_0x4e46d2){return _0x562cdc[_0xa7c5('0x1c')](_0xe9a69)[_0xa7c5('0x1e')](_0x4e46d2);}};}function respondWithFilteredResult(_0x237075,_0x48fd49){return function(_0x290957){if(_0x290957){var _0x4ddf73=typeof _0x48fd49[_0xa7c5('0x1f')]===_0xa7c5('0x20')&&typeof _0x48fd49[_0xa7c5('0x21')]===_0xa7c5('0x20');var _0x20f436=_0x290957[_0xa7c5('0x22')];var _0x4310c1=_0x4ddf73?0x0:_0x48fd49['offset'];var _0x476c42=_0x4ddf73?_0x290957[_0xa7c5('0x22')]:_0x48fd49[_0xa7c5('0x1f')]+_0x48fd49['limit'];var _0x12b39a;if(_0x476c42>=_0x20f436){_0x476c42=_0x20f436;_0x12b39a=0xc8;}else{_0x12b39a=0xce;}_0x237075[_0xa7c5('0x1c')](_0x12b39a);return _0x237075['set'](_0xa7c5('0x23'),_0x4310c1+'-'+_0x476c42+'/'+_0x20f436)[_0xa7c5('0x1e')](_0x290957);}return null;};}function patchUpdates(_0x175325){return function(_0x45a650){try{jsonpatch[_0xa7c5('0x24')](_0x45a650,_0x175325,!![]);}catch(_0x34016b){return BPromise['reject'](_0x34016b);}return _0x45a650[_0xa7c5('0x25')]();};}function saveUpdates(_0x38ebde,_0x307658){return function(_0x2cd86a){if(_0x2cd86a){return _0x2cd86a[_0xa7c5('0x26')](_0x38ebde)['then'](function(_0x2cc7d6){return _0x2cc7d6;});}return null;};}function removeEntity(_0x2ccfee,_0x4ce4a5){return function(_0x4f190b){if(_0x4f190b){return _0x4f190b[_0xa7c5('0x27')]()['then'](function(){_0x2ccfee['status'](0xcc)[_0xa7c5('0x1d')]();});}};}function handleEntityNotFound(_0x49852a,_0x5eb9c4){return function(_0x35c64f){if(!_0x35c64f){_0x49852a[_0xa7c5('0x1b')](0x194);}return _0x35c64f;};}function handleError(_0x535ebf,_0x5187ec){_0x5187ec=_0x5187ec||0x1f4;return function(_0x4eb0ae){logger[_0xa7c5('0x28')](_0x4eb0ae[_0xa7c5('0x29')]);if(_0x4eb0ae[_0xa7c5('0x2a')]){delete _0x4eb0ae[_0xa7c5('0x2a')];}_0x535ebf['status'](_0x5187ec)['send'](_0x4eb0ae);};}exports['index']=function(_0x5ab68b,_0x26961f){var _0x537501={},_0x1920f1={},_0x58ffeb={'count':0x0,'rows':[]};var _0x1ed689=_[_0xa7c5('0x2b')](db[_0xa7c5('0x2c')][_0xa7c5('0x2d')],function(_0x5323da){return{'name':_0x5323da['fieldName'],'type':_0x5323da[_0xa7c5('0x2e')][_0xa7c5('0x2f')]};});_0x1920f1[_0xa7c5('0x30')]=_['map'](_0x1ed689,_0xa7c5('0x2a'));_0x1920f1['query']=_['keys'](_0x5ab68b[_0xa7c5('0x31')]);_0x1920f1['filters']=_[_0xa7c5('0x32')](_0x1920f1[_0xa7c5('0x30')],_0x1920f1[_0xa7c5('0x31')]);_0x537501[_0xa7c5('0x33')]=_[_0xa7c5('0x32')](_0x1920f1[_0xa7c5('0x30')],qs[_0xa7c5('0x34')](_0x5ab68b[_0xa7c5('0x31')][_0xa7c5('0x34')]));_0x537501[_0xa7c5('0x33')]=_0x537501[_0xa7c5('0x33')]['length']?_0x537501[_0xa7c5('0x33')]:_0x1920f1[_0xa7c5('0x30')];if(!_0x5ab68b[_0xa7c5('0x31')][_0xa7c5('0x35')](_0xa7c5('0x36'))){_0x537501[_0xa7c5('0x21')]=qs[_0xa7c5('0x21')](_0x5ab68b[_0xa7c5('0x31')][_0xa7c5('0x21')]);_0x537501[_0xa7c5('0x1f')]=qs[_0xa7c5('0x1f')](_0x5ab68b[_0xa7c5('0x31')]['offset']);}_0x537501[_0xa7c5('0x37')]=qs[_0xa7c5('0x38')](_0x5ab68b[_0xa7c5('0x31')]['sort']);_0x537501[_0xa7c5('0x39')]=qs['filters'](_[_0xa7c5('0x3a')](_0x5ab68b['query'],_0x1920f1[_0xa7c5('0x3b')]),_0x1ed689);if(_0x5ab68b[_0xa7c5('0x31')][_0xa7c5('0x3c')]){_0x537501[_0xa7c5('0x39')]=_[_0xa7c5('0x3d')](_0x537501[_0xa7c5('0x39')],{'$or':_[_0xa7c5('0x2b')](_0x1ed689,function(_0x5262f2){if(_0x5262f2[_0xa7c5('0x2e')]!=='VIRTUAL'){var _0x12f76f={};_0x12f76f[_0x5262f2['name']]={'$like':'%'+_0x5ab68b[_0xa7c5('0x31')][_0xa7c5('0x3c')]+'%'};return _0x12f76f;}})});}_0x537501=_[_0xa7c5('0x3d')]({},_0x537501,_0x5ab68b[_0xa7c5('0x3e')]);var _0x5f3e75={'where':_0x537501['where']};return db['DeskAccount'][_0xa7c5('0x22')](_0x5f3e75)['then'](function(_0x4c5f10){_0x58ffeb['count']=_0x4c5f10;if(_0x5ab68b[_0xa7c5('0x31')]['includeAll']){_0x537501[_0xa7c5('0x3f')]=[{'all':!![]}];}return db['DeskAccount'][_0xa7c5('0x40')](_0x537501);})[_0xa7c5('0x41')](function(_0x4f7697){_0x58ffeb[_0xa7c5('0x42')]=_0x4f7697;return _0x58ffeb;})[_0xa7c5('0x41')](respondWithFilteredResult(_0x26961f,_0x537501))[_0xa7c5('0x43')](handleError(_0x26961f,null));};exports[_0xa7c5('0x44')]=function(_0x1d42ef,_0x4f18f3){var _0x3ef5d3={'raw':![],'where':{'id':_0x1d42ef[_0xa7c5('0x45')]['id']}},_0x714a0b={};_0x714a0b['model']=_[_0xa7c5('0x46')](db[_0xa7c5('0x2c')][_0xa7c5('0x2d')]);_0x714a0b[_0xa7c5('0x31')]=_[_0xa7c5('0x46')](_0x1d42ef['query']);_0x714a0b['filters']=_['intersection'](_0x714a0b[_0xa7c5('0x30')],_0x714a0b[_0xa7c5('0x31')]);_0x3ef5d3['attributes']=_[_0xa7c5('0x32')](_0x714a0b['model'],qs[_0xa7c5('0x34')](_0x1d42ef[_0xa7c5('0x31')][_0xa7c5('0x34')]));_0x3ef5d3[_0xa7c5('0x33')]=_0x3ef5d3['attributes'][_0xa7c5('0x47')]?_0x3ef5d3['attributes']:_0x714a0b[_0xa7c5('0x30')];if(_0x1d42ef['query'][_0xa7c5('0x48')]){_0x3ef5d3['include']=[{'all':!![]}];}_0x3ef5d3=_[_0xa7c5('0x3d')]({},_0x3ef5d3,_0x1d42ef[_0xa7c5('0x3e')]);return db[_0xa7c5('0x2c')][_0xa7c5('0x49')](_0x3ef5d3)['then'](handleEntityNotFound(_0x4f18f3,null))[_0xa7c5('0x41')](respondWithResult(_0x4f18f3,null))['catch'](handleError(_0x4f18f3,null));};exports[_0xa7c5('0x4a')]=function(_0x24102e,_0x2cda50){return db[_0xa7c5('0x2c')]['create'](_0x24102e[_0xa7c5('0x4b')],{})[_0xa7c5('0x41')](respondWithResult(_0x2cda50,0xc9))['catch'](handleError(_0x2cda50,null));};exports[_0xa7c5('0x26')]=function(_0x6d5f67,_0x4d6814){if(_0x6d5f67['body']['id']){delete _0x6d5f67[_0xa7c5('0x4b')]['id'];}return db[_0xa7c5('0x2c')][_0xa7c5('0x49')]({'where':{'id':_0x6d5f67[_0xa7c5('0x45')]['id']}})[_0xa7c5('0x41')](handleEntityNotFound(_0x4d6814,null))[_0xa7c5('0x41')](saveUpdates(_0x6d5f67['body'],null))['then'](respondWithResult(_0x4d6814,null))['catch'](handleError(_0x4d6814,null));};exports['destroy']=function(_0x1e6da1,_0x2ae3c2){return db[_0xa7c5('0x2c')]['find']({'where':{'id':_0x1e6da1[_0xa7c5('0x45')]['id']}})[_0xa7c5('0x41')](handleEntityNotFound(_0x2ae3c2,null))[_0xa7c5('0x41')](removeEntity(_0x2ae3c2,null))['catch'](handleError(_0x2ae3c2,null));};exports[_0xa7c5('0x4c')]=function(_0x4b07bc,_0x3df423,_0x14a8d7){var _0x1e0050={};var _0x18ee37={};var _0x3e6d0b;var _0x44b263;return db[_0xa7c5('0x2c')][_0xa7c5('0x4d')]({'where':{'id':_0x4b07bc[_0xa7c5('0x45')]['id']}})[_0xa7c5('0x41')](handleEntityNotFound(_0x3df423,null))[_0xa7c5('0x41')](function(_0x4c1ba3){if(_0x4c1ba3){_0x3e6d0b=_0x4c1ba3;_0x18ee37[_0xa7c5('0x30')]=_[_0xa7c5('0x46')](db['DeskConfiguration'][_0xa7c5('0x2d')]);_0x18ee37[_0xa7c5('0x31')]=_[_0xa7c5('0x46')](_0x4b07bc[_0xa7c5('0x31')]);_0x18ee37[_0xa7c5('0x3b')]=_[_0xa7c5('0x32')](_0x18ee37[_0xa7c5('0x30')],_0x18ee37[_0xa7c5('0x31')]);_0x1e0050['attributes']=_[_0xa7c5('0x32')](_0x18ee37[_0xa7c5('0x30')],qs['fields'](_0x4b07bc[_0xa7c5('0x31')][_0xa7c5('0x34')]));_0x1e0050[_0xa7c5('0x33')]=_0x1e0050[_0xa7c5('0x33')][_0xa7c5('0x47')]?_0x1e0050[_0xa7c5('0x33')]:_0x18ee37[_0xa7c5('0x30')];_0x1e0050[_0xa7c5('0x37')]=qs[_0xa7c5('0x38')](_0x4b07bc[_0xa7c5('0x31')][_0xa7c5('0x38')]);_0x1e0050[_0xa7c5('0x39')]=qs[_0xa7c5('0x3b')](_[_0xa7c5('0x3a')](_0x4b07bc[_0xa7c5('0x31')],_0x18ee37[_0xa7c5('0x3b')]));if(_0x4b07bc['query']['filter']){_0x1e0050[_0xa7c5('0x39')]=_['merge'](_0x1e0050['where'],{'$or':_[_0xa7c5('0x2b')](_0x1e0050[_0xa7c5('0x33')],function(_0x9240d4){var _0x31368f={};_0x31368f[_0x9240d4]={'$like':'%'+_0x4b07bc[_0xa7c5('0x31')][_0xa7c5('0x3c')]+'%'};return _0x31368f;})});}_0x1e0050=_[_0xa7c5('0x3d')]({},_0x1e0050,_0x4b07bc['options']);return _0x3e6d0b[_0xa7c5('0x4c')](_0x1e0050);}})[_0xa7c5('0x41')](function(_0x50a5b4){if(_0x50a5b4){_0x44b263=_0x50a5b4[_0xa7c5('0x47')];if(!_0x4b07bc[_0xa7c5('0x31')]['hasOwnProperty'](_0xa7c5('0x36'))){_0x1e0050[_0xa7c5('0x21')]=qs[_0xa7c5('0x21')](_0x4b07bc[_0xa7c5('0x31')]['limit']);_0x1e0050['offset']=qs[_0xa7c5('0x1f')](_0x4b07bc[_0xa7c5('0x31')][_0xa7c5('0x1f')]);}return _0x3e6d0b[_0xa7c5('0x4c')](_0x1e0050);}})[_0xa7c5('0x41')](function(_0x4892d0){if(_0x4892d0){return _0x4892d0?{'count':_0x44b263,'rows':_0x4892d0}:null;}})[_0xa7c5('0x41')](respondWithResult(_0x3df423,null))[_0xa7c5('0x43')](handleError(_0x3df423,null));};exports[_0xa7c5('0x4e')]=function(_0x409018,_0x2f250e,_0x1ffce3){if(_0x409018[_0xa7c5('0x4b')]['id']){delete _0x409018['body']['id'];}return db[_0xa7c5('0x2c')]['findOne']({'where':{'id':_0x409018[_0xa7c5('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f250e,null))['then'](function(_0x5f4f44){if(_0x5f4f44){_0x409018['body'][_0xa7c5('0x4f')]=_0x5f4f44['id'];_0x409018[_0xa7c5('0x4b')][_0xa7c5('0x50')]=integrations[_0xa7c5('0x51')](_0x409018[_0xa7c5('0x4b')][_0xa7c5('0x52')],_0x409018[_0xa7c5('0x4b')][_0xa7c5('0x2e')]);_0x409018[_0xa7c5('0x4b')][_0xa7c5('0x53')]=integrations['getDescriptions'](_0x409018[_0xa7c5('0x4b')]['channel'],_0x409018['body']['type']);return db[_0xa7c5('0x54')][_0xa7c5('0x4a')](_0x409018[_0xa7c5('0x4b')],{'include':[{'model':db['DeskField'],'as':_0xa7c5('0x50')},{'model':db[_0xa7c5('0x55')],'as':_0xa7c5('0x53')}]});}return null;})[_0xa7c5('0x41')](respondWithResult(_0x2f250e,null))[_0xa7c5('0x43')](handleError(_0x2f250e,null));};exports[_0xa7c5('0x56')]=function(_0x3031b3,_0x210c2a,_0x41b789){var _0x3c7b13=[{'name':'priority','label':_0xa7c5('0x57'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x1ba2f4='';return db[_0xa7c5('0x2c')][_0xa7c5('0x4d')]({'where':{'id':_0x3031b3[_0xa7c5('0x45')]['id']},'attributes':['id',_0xa7c5('0x58'),_0xa7c5('0x59'),_0xa7c5('0x5a'),'password',_0xa7c5('0x5b'),_0xa7c5('0x5c'),_0xa7c5('0x5d'),_0xa7c5('0x5e')]})[_0xa7c5('0x41')](handleEntityNotFound(_0x210c2a,null))[_0xa7c5('0x41')](function(_0x31bbf9){if(_0x31bbf9){_0x1ba2f4=_0x31bbf9[_0xa7c5('0x58')];var _0x1c22c7=_0x1ba2f4['slice'](-0x1);if(_0x1c22c7==='/'){_0x1ba2f4=_0x1ba2f4[_0xa7c5('0x5f')](0x0,_0x1ba2f4[_0xa7c5('0x60')](_0x1c22c7));}var _0x2996a9={'method':'GET','uri':util[_0xa7c5('0x61')]('%s/custom_fields',_0x1ba2f4),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x31bbf9[_0xa7c5('0x59')]==='basic'){_0x2996a9[_0xa7c5('0x62')]['Authorization']=util[_0xa7c5('0x61')](_0xa7c5('0x63'),new Buffer(util[_0xa7c5('0x61')](_0xa7c5('0x64'),_0x31bbf9[_0xa7c5('0x5a')],_0x31bbf9[_0xa7c5('0x65')]))[_0xa7c5('0x66')](_0xa7c5('0x67')));}return rp(_0x2996a9)[_0xa7c5('0x41')](function(_0x3898ef){return _0x3c7b13[_0xa7c5('0x68')](_[_0xa7c5('0x2b')](_0x3898ef[_0xa7c5('0x69')][_0xa7c5('0x6a')],function(_0x10d73d){return{'id':_0x10d73d[_0xa7c5('0x2a')],'name':_0x10d73d['name'],'type':_0x10d73d[_0xa7c5('0x2e')],'active':_0x10d73d[_0xa7c5('0x6b')],'label':_0x10d73d[_0xa7c5('0x6c')],'custom':!![]};}));});}})[_0xa7c5('0x41')](function(_0x324c34){return{'count':_0x324c34[_0xa7c5('0x47')],'rows':_0x324c34};})['then'](respondWithResult(_0x210c2a,null))[_0xa7c5('0x43')](function(_0x3bc6cb){var _0x27677e=_0x3031b3['query'][_0xa7c5('0x6d')]?0x1f4:_0x3bc6cb['statusCode']||0x1f4;logger[_0xa7c5('0x28')](_0xa7c5('0x6e'),_0xa7c5('0x56'),_0x27677e,JSON['stringify'](_0x3bc6cb));delete _0x3bc6cb[_0xa7c5('0x2a')];if(_0x27677e===0x191){_0x27677e=0x190;}_0x210c2a[_0xa7c5('0x1c')](_0x27677e)[_0xa7c5('0x6f')](_0x3031b3[_0xa7c5('0x31')][_0xa7c5('0x6d')]?{'message':_0xa7c5('0x70'),'statusCode':_0x3bc6cb['statusCode']}:_0x3bc6cb);});}; \ No newline at end of file +var _0x120d=['headers','Authorization','Basic\x20%s','%s:%s','concat','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','limit','undefined','count','offset','Content-Range','json','apply','update','then','destroy','status','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','pick','merge','where','type','VIRTUAL','filter','options','includeAll','findAll','show','params','length','include','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','sort','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','username','password','consumerKey','token','remoteUri','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic'];(function(_0x435eed,_0x22da02){var _0x270026=function(_0x3ffa1f){while(--_0x3ffa1f){_0x435eed['push'](_0x435eed['shift']());}};_0x270026(++_0x22da02);}(_0x120d,0x1d3));var _0xd120=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x120d[_0x36c5b0];return _0xf19333;};'use strict';var emlformat=require(_0xd120('0x0'));var rimraf=require(_0xd120('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd120('0x2'));var rp=require(_0xd120('0x3'));var moment=require(_0xd120('0x4'));var BPromise=require(_0xd120('0x5'));var Mustache=require(_0xd120('0x6'));var util=require(_0xd120('0x7'));var path=require(_0xd120('0x8'));var sox=require(_0xd120('0x9'));var csv=require('to-csv');var ejs=require(_0xd120('0xa'));var fs=require('fs');var fs_extra=require(_0xd120('0xb'));var _=require(_0xd120('0xc'));var squel=require(_0xd120('0xd'));var crypto=require(_0xd120('0xe'));var jsforce=require(_0xd120('0xf'));var deskjs=require(_0xd120('0x10'));var toCsv=require(_0xd120('0x11'));var querystring=require('querystring');var Papa=require(_0xd120('0x12'));var Redis=require('ioredis');var authService=require(_0xd120('0x13'));var qs=require(_0xd120('0x14'));var as=require(_0xd120('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd120('0x16'))(_0xd120('0x17'));var utils=require(_0xd120('0x18'));var config=require(_0xd120('0x19'));var licenseUtil=require(_0xd120('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd120('0x1b'));function respondWithStatusCode(_0x6afd8d,_0x24ef1d){_0x24ef1d=_0x24ef1d||0xcc;return function(_0x4b641b){if(_0x4b641b){return _0x6afd8d[_0xd120('0x1c')](_0x24ef1d);}return _0x6afd8d['status'](_0x24ef1d)[_0xd120('0x1d')]();};}function respondWithResult(_0x8f060f,_0x1d70af){_0x1d70af=_0x1d70af||0xc8;return function(_0x346cb8){if(_0x346cb8){return _0x8f060f['status'](_0x1d70af)['json'](_0x346cb8);}};}function respondWithFilteredResult(_0x38bc85,_0x8ff975){return function(_0x5af0df){if(_0x5af0df){var _0x9de20=typeof _0x8ff975['offset']==='undefined'&&typeof _0x8ff975[_0xd120('0x1e')]===_0xd120('0x1f');var _0x2a09fe=_0x5af0df[_0xd120('0x20')];var _0x526f18=_0x9de20?0x0:_0x8ff975[_0xd120('0x21')];var _0x5adc99=_0x9de20?_0x5af0df['count']:_0x8ff975[_0xd120('0x21')]+_0x8ff975['limit'];var _0x171161;if(_0x5adc99>=_0x2a09fe){_0x5adc99=_0x2a09fe;_0x171161=0xc8;}else{_0x171161=0xce;}_0x38bc85['status'](_0x171161);return _0x38bc85['set'](_0xd120('0x22'),_0x526f18+'-'+_0x5adc99+'/'+_0x2a09fe)[_0xd120('0x23')](_0x5af0df);}return null;};}function patchUpdates(_0x4c6def){return function(_0x3bdab0){try{jsonpatch[_0xd120('0x24')](_0x3bdab0,_0x4c6def,!![]);}catch(_0x2a2ea7){return BPromise['reject'](_0x2a2ea7);}return _0x3bdab0['save']();};}function saveUpdates(_0x436414,_0x1b8173){return function(_0x3c0149){if(_0x3c0149){return _0x3c0149[_0xd120('0x25')](_0x436414)[_0xd120('0x26')](function(_0x14e3fb){return _0x14e3fb;});}return null;};}function removeEntity(_0x153b54,_0x2a04d9){return function(_0x556ca2){if(_0x556ca2){return _0x556ca2[_0xd120('0x27')]()[_0xd120('0x26')](function(){_0x153b54[_0xd120('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5931bd,_0x2d786b){return function(_0x1a73d7){if(!_0x1a73d7){_0x5931bd[_0xd120('0x1c')](0x194);}return _0x1a73d7;};}function handleError(_0x4b8ff6,_0x477dc5){_0x477dc5=_0x477dc5||0x1f4;return function(_0x209793){logger[_0xd120('0x29')](_0x209793[_0xd120('0x2a')]);if(_0x209793[_0xd120('0x2b')]){delete _0x209793[_0xd120('0x2b')];}_0x4b8ff6[_0xd120('0x28')](_0x477dc5)[_0xd120('0x2c')](_0x209793);};}exports[_0xd120('0x2d')]=function(_0x4b4748,_0x37fb21){var _0x1911c3={},_0x4ad4ce={},_0x3f2731={'count':0x0,'rows':[]};var _0x35259a=_[_0xd120('0x2e')](db[_0xd120('0x2f')][_0xd120('0x30')],function(_0x15d6f9){return{'name':_0x15d6f9[_0xd120('0x31')],'type':_0x15d6f9['type']['key']};});_0x4ad4ce['model']=_[_0xd120('0x2e')](_0x35259a,_0xd120('0x2b'));_0x4ad4ce[_0xd120('0x32')]=_[_0xd120('0x33')](_0x4b4748[_0xd120('0x32')]);_0x4ad4ce[_0xd120('0x34')]=_['intersection'](_0x4ad4ce[_0xd120('0x35')],_0x4ad4ce[_0xd120('0x32')]);_0x1911c3[_0xd120('0x36')]=_[_0xd120('0x37')](_0x4ad4ce['model'],qs[_0xd120('0x38')](_0x4b4748[_0xd120('0x32')][_0xd120('0x38')]));_0x1911c3[_0xd120('0x36')]=_0x1911c3['attributes']['length']?_0x1911c3['attributes']:_0x4ad4ce['model'];if(!_0x4b4748[_0xd120('0x32')][_0xd120('0x39')](_0xd120('0x3a'))){_0x1911c3[_0xd120('0x1e')]=qs['limit'](_0x4b4748['query'][_0xd120('0x1e')]);_0x1911c3[_0xd120('0x21')]=qs[_0xd120('0x21')](_0x4b4748[_0xd120('0x32')][_0xd120('0x21')]);}_0x1911c3['order']=qs['sort'](_0x4b4748['query']['sort']);_0x1911c3['where']=qs['filters'](_[_0xd120('0x3b')](_0x4b4748['query'],_0x4ad4ce[_0xd120('0x34')]),_0x35259a);if(_0x4b4748[_0xd120('0x32')]['filter']){_0x1911c3['where']=_[_0xd120('0x3c')](_0x1911c3[_0xd120('0x3d')],{'$or':_[_0xd120('0x2e')](_0x35259a,function(_0x4a43a2){if(_0x4a43a2[_0xd120('0x3e')]!==_0xd120('0x3f')){var _0x5e5a98={};_0x5e5a98[_0x4a43a2['name']]={'$like':'%'+_0x4b4748[_0xd120('0x32')][_0xd120('0x40')]+'%'};return _0x5e5a98;}})});}_0x1911c3=_['merge']({},_0x1911c3,_0x4b4748[_0xd120('0x41')]);var _0x4d6db9={'where':_0x1911c3['where']};return db['DeskAccount'][_0xd120('0x20')](_0x4d6db9)[_0xd120('0x26')](function(_0x51a45e){_0x3f2731[_0xd120('0x20')]=_0x51a45e;if(_0x4b4748[_0xd120('0x32')][_0xd120('0x42')]){_0x1911c3['include']=[{'all':!![]}];}return db[_0xd120('0x2f')][_0xd120('0x43')](_0x1911c3);})[_0xd120('0x26')](function(_0x2fbbc){_0x3f2731['rows']=_0x2fbbc;return _0x3f2731;})[_0xd120('0x26')](respondWithFilteredResult(_0x37fb21,_0x1911c3))['catch'](handleError(_0x37fb21,null));};exports[_0xd120('0x44')]=function(_0x1b8f4a,_0x1f47ac){var _0x14a7e4={'raw':![],'where':{'id':_0x1b8f4a[_0xd120('0x45')]['id']}},_0x5e3872={};_0x5e3872['model']=_[_0xd120('0x33')](db[_0xd120('0x2f')]['rawAttributes']);_0x5e3872['query']=_[_0xd120('0x33')](_0x1b8f4a[_0xd120('0x32')]);_0x5e3872[_0xd120('0x34')]=_['intersection'](_0x5e3872[_0xd120('0x35')],_0x5e3872[_0xd120('0x32')]);_0x14a7e4[_0xd120('0x36')]=_['intersection'](_0x5e3872['model'],qs[_0xd120('0x38')](_0x1b8f4a['query'][_0xd120('0x38')]));_0x14a7e4[_0xd120('0x36')]=_0x14a7e4[_0xd120('0x36')][_0xd120('0x46')]?_0x14a7e4[_0xd120('0x36')]:_0x5e3872[_0xd120('0x35')];if(_0x1b8f4a['query'][_0xd120('0x42')]){_0x14a7e4[_0xd120('0x47')]=[{'all':!![]}];}_0x14a7e4=_[_0xd120('0x3c')]({},_0x14a7e4,_0x1b8f4a[_0xd120('0x41')]);return db[_0xd120('0x2f')][_0xd120('0x48')](_0x14a7e4)[_0xd120('0x26')](handleEntityNotFound(_0x1f47ac,null))[_0xd120('0x26')](respondWithResult(_0x1f47ac,null))[_0xd120('0x49')](handleError(_0x1f47ac,null));};exports['create']=function(_0x8a3f7a,_0x4709c0){return db[_0xd120('0x2f')][_0xd120('0x4a')](_0x8a3f7a[_0xd120('0x4b')],{})['then'](respondWithResult(_0x4709c0,0xc9))[_0xd120('0x49')](handleError(_0x4709c0,null));};exports[_0xd120('0x25')]=function(_0x4f0d4a,_0x45f81f){if(_0x4f0d4a[_0xd120('0x4b')]['id']){delete _0x4f0d4a[_0xd120('0x4b')]['id'];}return db[_0xd120('0x2f')][_0xd120('0x48')]({'where':{'id':_0x4f0d4a[_0xd120('0x45')]['id']}})[_0xd120('0x26')](handleEntityNotFound(_0x45f81f,null))[_0xd120('0x26')](saveUpdates(_0x4f0d4a[_0xd120('0x4b')],null))[_0xd120('0x26')](respondWithResult(_0x45f81f,null))[_0xd120('0x49')](handleError(_0x45f81f,null));};exports['destroy']=function(_0x12500e,_0x4372e5){return db[_0xd120('0x2f')][_0xd120('0x48')]({'where':{'id':_0x12500e[_0xd120('0x45')]['id']}})[_0xd120('0x26')](handleEntityNotFound(_0x4372e5,null))[_0xd120('0x26')](removeEntity(_0x4372e5,null))[_0xd120('0x49')](handleError(_0x4372e5,null));};exports[_0xd120('0x4c')]=function(_0x34066d,_0x1716bd,_0x4c593b){var _0xa86c2f={};var _0x52a91c={};var _0x50b156;var _0x4d799d;return db[_0xd120('0x2f')][_0xd120('0x4d')]({'where':{'id':_0x34066d[_0xd120('0x45')]['id']}})['then'](handleEntityNotFound(_0x1716bd,null))[_0xd120('0x26')](function(_0x149f27){if(_0x149f27){_0x50b156=_0x149f27;_0x52a91c[_0xd120('0x35')]=_[_0xd120('0x33')](db[_0xd120('0x4e')][_0xd120('0x30')]);_0x52a91c['query']=_[_0xd120('0x33')](_0x34066d['query']);_0x52a91c[_0xd120('0x34')]=_['intersection'](_0x52a91c[_0xd120('0x35')],_0x52a91c[_0xd120('0x32')]);_0xa86c2f[_0xd120('0x36')]=_[_0xd120('0x37')](_0x52a91c['model'],qs['fields'](_0x34066d[_0xd120('0x32')]['fields']));_0xa86c2f[_0xd120('0x36')]=_0xa86c2f[_0xd120('0x36')][_0xd120('0x46')]?_0xa86c2f[_0xd120('0x36')]:_0x52a91c[_0xd120('0x35')];_0xa86c2f['order']=qs['sort'](_0x34066d[_0xd120('0x32')][_0xd120('0x4f')]);_0xa86c2f[_0xd120('0x3d')]=qs[_0xd120('0x34')](_['pick'](_0x34066d['query'],_0x52a91c['filters']));if(_0x34066d[_0xd120('0x32')][_0xd120('0x40')]){_0xa86c2f['where']=_[_0xd120('0x3c')](_0xa86c2f[_0xd120('0x3d')],{'$or':_[_0xd120('0x2e')](_0xa86c2f['attributes'],function(_0x448bfd){var _0x56aee0={};_0x56aee0[_0x448bfd]={'$like':'%'+_0x34066d[_0xd120('0x32')][_0xd120('0x40')]+'%'};return _0x56aee0;})});}_0xa86c2f=_['merge']({},_0xa86c2f,_0x34066d['options']);return _0x50b156[_0xd120('0x4c')](_0xa86c2f);}})[_0xd120('0x26')](function(_0x112d0b){if(_0x112d0b){_0x4d799d=_0x112d0b[_0xd120('0x46')];if(!_0x34066d[_0xd120('0x32')]['hasOwnProperty']('nolimit')){_0xa86c2f['limit']=qs['limit'](_0x34066d['query'][_0xd120('0x1e')]);_0xa86c2f[_0xd120('0x21')]=qs[_0xd120('0x21')](_0x34066d[_0xd120('0x32')][_0xd120('0x21')]);}return _0x50b156[_0xd120('0x4c')](_0xa86c2f);}})['then'](function(_0x258c33){if(_0x258c33){return _0x258c33?{'count':_0x4d799d,'rows':_0x258c33}:null;}})[_0xd120('0x26')](respondWithResult(_0x1716bd,null))['catch'](handleError(_0x1716bd,null));};exports[_0xd120('0x50')]=function(_0x1f2cc1,_0x18bc61,_0x5815f3){if(_0x1f2cc1[_0xd120('0x4b')]['id']){delete _0x1f2cc1['body']['id'];}return db['DeskAccount'][_0xd120('0x4d')]({'where':{'id':_0x1f2cc1['params']['id']}})['then'](handleEntityNotFound(_0x18bc61,null))[_0xd120('0x26')](function(_0x1595d7){if(_0x1595d7){_0x1f2cc1[_0xd120('0x4b')][_0xd120('0x51')]=_0x1595d7['id'];_0x1f2cc1[_0xd120('0x4b')][_0xd120('0x52')]=integrations['getSubjects'](_0x1f2cc1[_0xd120('0x4b')][_0xd120('0x53')],_0x1f2cc1[_0xd120('0x4b')][_0xd120('0x3e')]);_0x1f2cc1[_0xd120('0x4b')][_0xd120('0x54')]=integrations[_0xd120('0x55')](_0x1f2cc1[_0xd120('0x4b')]['channel'],_0x1f2cc1['body']['type']);return db[_0xd120('0x4e')][_0xd120('0x4a')](_0x1f2cc1['body'],{'include':[{'model':db[_0xd120('0x56')],'as':'Subjects'},{'model':db[_0xd120('0x56')],'as':_0xd120('0x54')}]});}return null;})[_0xd120('0x26')](respondWithResult(_0x18bc61,null))[_0xd120('0x49')](handleError(_0x18bc61,null));};exports[_0xd120('0x57')]=function(_0x4acd3e,_0x3b54b2,_0x2a708b){var _0x3a7191=[{'name':_0xd120('0x58'),'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 _0x1ceb7e='';return db[_0xd120('0x2f')]['findOne']({'where':{'id':_0x4acd3e['params']['id']},'attributes':['id','remoteUri','authType',_0xd120('0x59'),_0xd120('0x5a'),_0xd120('0x5b'),'consumerSecret',_0xd120('0x5c'),'tokenSecret']})[_0xd120('0x26')](handleEntityNotFound(_0x3b54b2,null))[_0xd120('0x26')](function(_0x483327){if(_0x483327){_0x1ceb7e=_0x483327[_0xd120('0x5d')];var _0x365448=_0x1ceb7e[_0xd120('0x5e')](-0x1);if(_0x365448==='/'){_0x1ceb7e=_0x1ceb7e[_0xd120('0x5f')](0x0,_0x1ceb7e[_0xd120('0x60')](_0x365448));}var _0x25d6f8={'method':_0xd120('0x61'),'uri':util[_0xd120('0x62')](_0xd120('0x63'),_0x1ceb7e),'headers':{'Content-Type':'application/json','Accept':_0xd120('0x64')},'json':!![]};if(_0x483327[_0xd120('0x65')]===_0xd120('0x66')){_0x25d6f8[_0xd120('0x67')][_0xd120('0x68')]=util[_0xd120('0x62')](_0xd120('0x69'),new Buffer(util[_0xd120('0x62')](_0xd120('0x6a'),_0x483327['username'],_0x483327[_0xd120('0x5a')]))['toString']('base64'));}return rp(_0x25d6f8)[_0xd120('0x26')](function(_0x49b048){return _0x3a7191[_0xd120('0x6b')](_[_0xd120('0x2e')](_0x49b048['_embedded'][_0xd120('0x6c')],function(_0xae1b5b){return{'id':_0xae1b5b[_0xd120('0x2b')],'name':_0xae1b5b[_0xd120('0x2b')],'type':_0xae1b5b[_0xd120('0x3e')],'active':_0xae1b5b[_0xd120('0x6d')],'label':_0xae1b5b[_0xd120('0x6e')],'custom':!![]};}));});}})[_0xd120('0x26')](function(_0x2f5466){return{'count':_0x2f5466[_0xd120('0x46')],'rows':_0x2f5466};})['then'](respondWithResult(_0x3b54b2,null))[_0xd120('0x49')](function(_0x54fc8a){var _0x113068=_0x4acd3e[_0xd120('0x32')][_0xd120('0x6f')]?0x1f4:_0x54fc8a[_0xd120('0x70')]||0x1f4;logger['error'](_0xd120('0x71'),_0xd120('0x57'),_0x113068,JSON['stringify'](_0x54fc8a));delete _0x54fc8a[_0xd120('0x2b')];if(_0x113068===0x191){_0x113068=0x190;}_0x3b54b2[_0xd120('0x28')](_0x113068)['send'](_0x4acd3e[_0xd120('0x32')][_0xd120('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x54fc8a[_0xd120('0x70')]}:_0x54fc8a);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index d000a17..927b7be 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 _0x3ceb=['moment','bluebird','request-promise','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api'];(function(_0x588489,_0x13e7e3){var _0x1ea6ec=function(_0x1e3fc6){while(--_0x1e3fc6){_0x588489['push'](_0x588489['shift']());}};_0x1ea6ec(++_0x13e7e3);}(_0x3ceb,0x141));var _0xb3ce=function(_0x559587,_0x53504b){_0x559587=_0x559587-0x0;var _0x21f2b0=_0x3ceb[_0x559587];return _0x21f2b0;};'use strict';var _=require(_0xb3ce('0x0'));var util=require(_0xb3ce('0x1'));var logger=require(_0xb3ce('0x2'))(_0xb3ce('0x3'));var moment=require(_0xb3ce('0x4'));var BPromise=require(_0xb3ce('0x5'));var rp=require(_0xb3ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3ce('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xb3ce('0x8'));module[_0xb3ce('0x9')]=function(_0x897e75,_0x5cc9bd){return _0x897e75[_0xb3ce('0xa')](_0xb3ce('0xb'),attributes,{'tableName':_0xb3ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d25=['rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x343c01,_0x1de4af){var _0x5de16d=function(_0x36f143){while(--_0x36f143){_0x343c01['push'](_0x343c01['shift']());}};_0x5de16d(++_0x1de4af);}(_0x6d25,0x158));var _0x56d2=function(_0x73fef5,_0xb8d455){_0x73fef5=_0x73fef5-0x0;var _0x26070b=_0x6d25[_0x73fef5];return _0x26070b;};'use strict';var _=require(_0x56d2('0x0'));var util=require('util');var logger=require(_0x56d2('0x1'))(_0x56d2('0x2'));var moment=require(_0x56d2('0x3'));var BPromise=require(_0x56d2('0x4'));var rp=require(_0x56d2('0x5'));var fs=require('fs');var path=require(_0x56d2('0x6'));var rimraf=require(_0x56d2('0x7'));var config=require(_0x56d2('0x8'));var attributes=require(_0x56d2('0x9'));var integrations=require(_0x56d2('0xa'));module[_0x56d2('0xb')]=function(_0x355cb6,_0x42efe4){return _0x355cb6['define'](_0x56d2('0xc'),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 235bd04..5a6a016 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 _0xdda6=['error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','include','map','model','then','ShowDeskAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xebbc9f,_0x3e35bd){var _0x2f511d=function(_0xb9b3ca){while(--_0xb9b3ca){_0xebbc9f['push'](_0xebbc9f['shift']());}};_0x2f511d(++_0x3e35bd);}(_0xdda6,0xa1));var _0x6dda=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0xdda6[_0x3f4dd9];return _0x31c54a;};'use strict';var _=require(_0x6dda('0x0'));var util=require(_0x6dda('0x1'));var moment=require(_0x6dda('0x2'));var BPromise=require(_0x6dda('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6dda('0x4'));var db=require(_0x6dda('0x5'))['db'];var utils=require(_0x6dda('0x6'));var logger=require(_0x6dda('0x7'))(_0x6dda('0x8'));var config=require(_0x6dda('0x9'));var jayson=require(_0x6dda('0xa'));var client=jayson[_0x6dda('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f7827,_0x262469,_0x8ed81d){return new BPromise(function(_0x268aef,_0xfba9f3){return client[_0x6dda('0xc')](_0x1f7827,_0x8ed81d)['then'](function(_0x288335){logger[_0x6dda('0xd')](_0x6dda('0xe'),_0x262469,_0x6dda('0xf'));logger[_0x6dda('0x10')](_0x6dda('0x11'),_0x262469,_0x6dda('0xf'),JSON[_0x6dda('0x12')](_0x288335));if(_0x288335[_0x6dda('0x13')]){if(_0x288335[_0x6dda('0x13')][_0x6dda('0x14')]===0x1f4){logger[_0x6dda('0x13')](_0x6dda('0xe'),_0x262469,_0x288335['error'][_0x6dda('0x15')]);return _0xfba9f3(_0x288335[_0x6dda('0x13')][_0x6dda('0x15')]);}logger[_0x6dda('0x13')](_0x6dda('0xe'),_0x262469,_0x288335[_0x6dda('0x13')][_0x6dda('0x15')]);return _0x268aef(_0x288335['error'][_0x6dda('0x15')]);}else{logger[_0x6dda('0xd')]('DeskAccount,\x20%s,\x20%s',_0x262469,_0x6dda('0xf'));_0x268aef(_0x288335[_0x6dda('0x16')][_0x6dda('0x15')]);}})[_0x6dda('0x17')](function(_0x51f8ee){logger[_0x6dda('0x13')](_0x6dda('0xe'),_0x262469,_0x51f8ee);_0xfba9f3(_0x51f8ee);});});}exports[_0x6dda('0x18')]=function(_0x47705d){var _0x51e0a0=this;return new Promise(function(_0x587c02,_0x466d71){return db[_0x6dda('0x19')]['findAll']({'raw':_0x47705d[_0x6dda('0x1a')]?_0x47705d[_0x6dda('0x1a')][_0x6dda('0x1b')]===undefined?!![]:![]:!![],'where':_0x47705d[_0x6dda('0x1a')]?_0x47705d[_0x6dda('0x1a')][_0x6dda('0x1c')]||null:null,'attributes':_0x47705d[_0x6dda('0x1a')]?_0x47705d[_0x6dda('0x1a')][_0x6dda('0x1d')]||null:null,'limit':_0x47705d[_0x6dda('0x1a')]?_0x47705d[_0x6dda('0x1a')]['limit']||null:null,'include':_0x47705d[_0x6dda('0x1a')]?_0x47705d[_0x6dda('0x1a')][_0x6dda('0x1e')]?_[_0x6dda('0x1f')](_0x47705d[_0x6dda('0x1a')][_0x6dda('0x1e')],function(_0x2ecff0){return{'model':db[_0x2ecff0[_0x6dda('0x20')]],'as':_0x2ecff0['as'],'attributes':_0x2ecff0[_0x6dda('0x1d')],'include':_0x2ecff0['include']?_[_0x6dda('0x1f')](_0x2ecff0['include'],function(_0x3c8ed1){return{'model':db[_0x3c8ed1['model']],'as':_0x3c8ed1['as'],'attributes':_0x3c8ed1[_0x6dda('0x1d')],'include':_0x3c8ed1[_0x6dda('0x1e')]?_['map'](_0x3c8ed1['include'],function(_0x51d2b0){return{'model':db[_0x51d2b0[_0x6dda('0x20')]],'as':_0x51d2b0['as'],'attributes':_0x51d2b0['attributes']};}):[]};}):[]};}):[]:[]})[_0x6dda('0x21')](function(_0x1e53a5){logger[_0x6dda('0xd')](_0x6dda('0x18'),_0x47705d);logger['debug'](_0x6dda('0x18'),_0x47705d,JSON[_0x6dda('0x12')](_0x1e53a5));_0x587c02(_0x1e53a5);})[_0x6dda('0x17')](function(_0x239011){logger['error'](_0x6dda('0x18'),_0x239011[_0x6dda('0x15')],_0x47705d);_0x466d71(_0x51e0a0[_0x6dda('0x13')](0x1f4,_0x239011[_0x6dda('0x15')]));});});};exports[_0x6dda('0x22')]=function(_0x171ffa){var _0x2e554f=this;return new Promise(function(_0x3fd36f,_0x4a320c){return db['DeskAccount'][_0x6dda('0x23')]({'raw':_0x171ffa[_0x6dda('0x1a')]?_0x171ffa[_0x6dda('0x1a')][_0x6dda('0x1b')]===undefined?!![]:![]:!![],'where':_0x171ffa[_0x6dda('0x1a')]?_0x171ffa[_0x6dda('0x1a')][_0x6dda('0x1c')]||null:null,'attributes':_0x171ffa[_0x6dda('0x1a')]?_0x171ffa[_0x6dda('0x1a')]['attributes']||null:null,'include':_0x171ffa[_0x6dda('0x1a')]?_0x171ffa[_0x6dda('0x1a')][_0x6dda('0x1e')]?_['map'](_0x171ffa[_0x6dda('0x1a')]['include'],function(_0xc7093e){return{'model':db[_0xc7093e[_0x6dda('0x20')]],'as':_0xc7093e['as'],'attributes':_0xc7093e['attributes'],'include':_0xc7093e['include']?_[_0x6dda('0x1f')](_0xc7093e[_0x6dda('0x1e')],function(_0x3f560c){return{'model':db[_0x3f560c[_0x6dda('0x20')]],'as':_0x3f560c['as'],'attributes':_0x3f560c['attributes'],'include':_0x3f560c['include']?_[_0x6dda('0x1f')](_0x3f560c[_0x6dda('0x1e')],function(_0x56cdaf){return{'model':db[_0x56cdaf[_0x6dda('0x20')]],'as':_0x56cdaf['as'],'attributes':_0x56cdaf['attributes']};}):[]};}):[]};}):[]:[]})[_0x6dda('0x21')](function(_0xbf30bb){logger['info'](_0x6dda('0x22'),_0x171ffa);logger[_0x6dda('0x10')](_0x6dda('0x22'),_0x171ffa,JSON[_0x6dda('0x12')](_0xbf30bb));_0x3fd36f(_0xbf30bb);})['catch'](function(_0x2ff498){logger['error']('ShowDeskAccount',_0x2ff498[_0x6dda('0x15')],_0x171ffa);_0x4a320c(_0x2e554f[_0x6dda('0x13')](0x1f4,_0x2ff498[_0x6dda('0x15')]));});});}; \ No newline at end of file +var _0x2dd4=['model','ShowDeskAccount','find','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','include','map'];(function(_0x7bdbc0,_0x1ae8ec){var _0x4b345a=function(_0x16630c){while(--_0x16630c){_0x7bdbc0['push'](_0x7bdbc0['shift']());}};_0x4b345a(++_0x1ae8ec);}(_0x2dd4,0x12c));var _0x42dd=function(_0x33e45a,_0x4f4bbc){_0x33e45a=_0x33e45a-0x0;var _0x8789ac=_0x2dd4[_0x33e45a];return _0x8789ac;};'use strict';var _=require('lodash');var util=require(_0x42dd('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42dd('0x1'));var db=require(_0x42dd('0x2'))['db'];var utils=require(_0x42dd('0x3'));var logger=require(_0x42dd('0x4'))(_0x42dd('0x5'));var config=require(_0x42dd('0x6'));var jayson=require(_0x42dd('0x7'));var client=jayson[_0x42dd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x204406,_0x1c2d25,_0x4a7e73){return new BPromise(function(_0x3f99e1,_0x27d706){return client['request'](_0x204406,_0x4a7e73)[_0x42dd('0x9')](function(_0x878c96){logger['info'](_0x42dd('0xa'),_0x1c2d25,_0x42dd('0xb'));logger[_0x42dd('0xc')](_0x42dd('0xd'),_0x1c2d25,_0x42dd('0xb'),JSON[_0x42dd('0xe')](_0x878c96));if(_0x878c96[_0x42dd('0xf')]){if(_0x878c96['error'][_0x42dd('0x10')]===0x1f4){logger[_0x42dd('0xf')](_0x42dd('0xa'),_0x1c2d25,_0x878c96[_0x42dd('0xf')]['message']);return _0x27d706(_0x878c96[_0x42dd('0xf')]['message']);}logger[_0x42dd('0xf')]('DeskAccount,\x20%s,\x20%s',_0x1c2d25,_0x878c96[_0x42dd('0xf')][_0x42dd('0x11')]);return _0x3f99e1(_0x878c96['error'][_0x42dd('0x11')]);}else{logger[_0x42dd('0x12')](_0x42dd('0xa'),_0x1c2d25,_0x42dd('0xb'));_0x3f99e1(_0x878c96[_0x42dd('0x13')][_0x42dd('0x11')]);}})[_0x42dd('0x14')](function(_0xdc126a){logger[_0x42dd('0xf')]('DeskAccount,\x20%s,\x20%s',_0x1c2d25,_0xdc126a);_0x27d706(_0xdc126a);});});}exports[_0x42dd('0x15')]=function(_0x9a8dac){var _0x39b24b=this;return new Promise(function(_0x3ddf74,_0x255f5d){return db[_0x42dd('0x16')][_0x42dd('0x17')]({'raw':_0x9a8dac[_0x42dd('0x18')]?_0x9a8dac['options'][_0x42dd('0x19')]===undefined?!![]:![]:!![],'where':_0x9a8dac['options']?_0x9a8dac[_0x42dd('0x18')][_0x42dd('0x1a')]||null:null,'attributes':_0x9a8dac[_0x42dd('0x18')]?_0x9a8dac['options'][_0x42dd('0x1b')]||null:null,'limit':_0x9a8dac[_0x42dd('0x18')]?_0x9a8dac[_0x42dd('0x18')]['limit']||null:null,'include':_0x9a8dac[_0x42dd('0x18')]?_0x9a8dac[_0x42dd('0x18')][_0x42dd('0x1c')]?_[_0x42dd('0x1d')](_0x9a8dac[_0x42dd('0x18')][_0x42dd('0x1c')],function(_0x22da01){return{'model':db[_0x22da01[_0x42dd('0x1e')]],'as':_0x22da01['as'],'attributes':_0x22da01[_0x42dd('0x1b')],'include':_0x22da01['include']?_[_0x42dd('0x1d')](_0x22da01['include'],function(_0x74f1c3){return{'model':db[_0x74f1c3[_0x42dd('0x1e')]],'as':_0x74f1c3['as'],'attributes':_0x74f1c3[_0x42dd('0x1b')],'include':_0x74f1c3['include']?_[_0x42dd('0x1d')](_0x74f1c3[_0x42dd('0x1c')],function(_0x1d8f8f){return{'model':db[_0x1d8f8f['model']],'as':_0x1d8f8f['as'],'attributes':_0x1d8f8f[_0x42dd('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x122878){logger[_0x42dd('0x12')](_0x42dd('0x15'),_0x9a8dac);logger[_0x42dd('0xc')](_0x42dd('0x15'),_0x9a8dac,JSON[_0x42dd('0xe')](_0x122878));_0x3ddf74(_0x122878);})['catch'](function(_0x206911){logger['error'](_0x42dd('0x15'),_0x206911[_0x42dd('0x11')],_0x9a8dac);_0x255f5d(_0x39b24b[_0x42dd('0xf')](0x1f4,_0x206911[_0x42dd('0x11')]));});});};exports[_0x42dd('0x1f')]=function(_0x3dc18e){var _0x549661=this;return new Promise(function(_0x4a360c,_0x11a957){return db[_0x42dd('0x16')][_0x42dd('0x20')]({'raw':_0x3dc18e[_0x42dd('0x18')]?_0x3dc18e['options'][_0x42dd('0x19')]===undefined?!![]:![]:!![],'where':_0x3dc18e[_0x42dd('0x18')]?_0x3dc18e[_0x42dd('0x18')][_0x42dd('0x1a')]||null:null,'attributes':_0x3dc18e[_0x42dd('0x18')]?_0x3dc18e[_0x42dd('0x18')][_0x42dd('0x1b')]||null:null,'include':_0x3dc18e['options']?_0x3dc18e[_0x42dd('0x18')][_0x42dd('0x1c')]?_[_0x42dd('0x1d')](_0x3dc18e[_0x42dd('0x18')]['include'],function(_0x1fc3e2){return{'model':db[_0x1fc3e2[_0x42dd('0x1e')]],'as':_0x1fc3e2['as'],'attributes':_0x1fc3e2[_0x42dd('0x1b')],'include':_0x1fc3e2[_0x42dd('0x1c')]?_[_0x42dd('0x1d')](_0x1fc3e2[_0x42dd('0x1c')],function(_0x27a25a){return{'model':db[_0x27a25a[_0x42dd('0x1e')]],'as':_0x27a25a['as'],'attributes':_0x27a25a[_0x42dd('0x1b')],'include':_0x27a25a[_0x42dd('0x1c')]?_['map'](_0x27a25a[_0x42dd('0x1c')],function(_0x126860){return{'model':db[_0x126860[_0x42dd('0x1e')]],'as':_0x126860['as'],'attributes':_0x126860[_0x42dd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x42dd('0x9')](function(_0x513534){logger[_0x42dd('0x12')](_0x42dd('0x1f'),_0x3dc18e);logger['debug'](_0x42dd('0x1f'),_0x3dc18e,JSON[_0x42dd('0xe')](_0x513534));_0x4a360c(_0x513534);})[_0x42dd('0x14')](function(_0x445a86){logger[_0x42dd('0xf')](_0x42dd('0x1f'),_0x445a86[_0x42dd('0x11')],_0x3dc18e);_0x11a957(_0x549661[_0x42dd('0xf')](0x1f4,_0x445a86[_0x42dd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 067102d..2ac0a1f 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x79e32a,_0x1d3a86){var _0x5d1f3f=function(_0x2e28c2){while(--_0x2e28c2){_0x79e32a['push'](_0x79e32a['shift']());}};_0x5d1f3f(++_0x1d3a86);}(_0x7217,0x19e));var _0x7721=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7217[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file +var _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(_0x28ac9d,_0x10c052){var _0x201d5f=function(_0x20d7f1){while(--_0x20d7f1){_0x28ac9d['push'](_0x28ac9d['shift']());}};_0x201d5f(++_0x10c052);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 6d0406e..837b8c7 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 _0x8490=['STRING','sequelize','exports'];(function(_0x701eb2,_0x2d3aba){var _0x2e3bc7=function(_0x98295){while(--_0x98295){_0x701eb2['push'](_0x701eb2['shift']());}};_0x2e3bc7(++_0x2d3aba);}(_0x8490,0x154));var _0x0849=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x8490[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x0849('0x0'));module[_0x0849('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0849('0x2')]}}; \ No newline at end of file +var _0x529a=['exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x529a,0x168));var _0xa529=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0x529a[_0x79b649];return _0x1af9b1;};'use strict';var Sequelize=require('sequelize');module[_0xa529('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa529('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 7da2eda..ebfa16b 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 _0xe77b=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','filter','options','DeskConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','findOne','DeskField','pick','getFields','getSubjects','getDescriptions','getTags','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0x1b4ca5,_0x577148){var _0x15948e=function(_0x453039){while(--_0x453039){_0x1b4ca5['push'](_0x1b4ca5['shift']());}};_0x15948e(++_0x577148);}(_0xe77b,0x97));var _0xbe77=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe77b[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe77('0x0'));var zipdir=require(_0xbe77('0x1'));var jsonpatch=require(_0xbe77('0x2'));var rp=require(_0xbe77('0x3'));var moment=require(_0xbe77('0x4'));var BPromise=require(_0xbe77('0x5'));var Mustache=require('mustache');var util=require(_0xbe77('0x6'));var path=require(_0xbe77('0x7'));var sox=require(_0xbe77('0x8'));var csv=require(_0xbe77('0x9'));var ejs=require(_0xbe77('0xa'));var fs=require('fs');var fs_extra=require(_0xbe77('0xb'));var _=require(_0xbe77('0xc'));var squel=require('squel');var crypto=require(_0xbe77('0xd'));var jsforce=require(_0xbe77('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe77('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbe77('0x10'));var qs=require(_0xbe77('0x11'));var as=require(_0xbe77('0x12'));var hardwareService=require(_0xbe77('0x13'));var logger=require(_0xbe77('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xbe77('0x15'));var licenseUtil=require(_0xbe77('0x16'));var db=require(_0xbe77('0x17'))['db'];function respondWithStatusCode(_0x5769fc,_0x1e5a03){_0x1e5a03=_0x1e5a03||0xcc;return function(_0x41f2d9){if(_0x41f2d9){return _0x5769fc[_0xbe77('0x18')](_0x1e5a03);}return _0x5769fc[_0xbe77('0x19')](_0x1e5a03)[_0xbe77('0x1a')]();};}function respondWithResult(_0x34234b,_0x275a1e){_0x275a1e=_0x275a1e||0xc8;return function(_0x4f6f9c){if(_0x4f6f9c){return _0x34234b[_0xbe77('0x19')](_0x275a1e)['json'](_0x4f6f9c);}};}function respondWithFilteredResult(_0x424639,_0x4d637e){return function(_0x4754db){if(_0x4754db){var _0x744e32=typeof _0x4d637e[_0xbe77('0x1b')]===_0xbe77('0x1c')&&typeof _0x4d637e['limit']===_0xbe77('0x1c');var _0xccf131=_0x4754db[_0xbe77('0x1d')];var _0xcefad4=_0x744e32?0x0:_0x4d637e[_0xbe77('0x1b')];var _0x430d53=_0x744e32?_0x4754db[_0xbe77('0x1d')]:_0x4d637e['offset']+_0x4d637e['limit'];var _0x1d767c;if(_0x430d53>=_0xccf131){_0x430d53=_0xccf131;_0x1d767c=0xc8;}else{_0x1d767c=0xce;}_0x424639['status'](_0x1d767c);return _0x424639[_0xbe77('0x1e')](_0xbe77('0x1f'),_0xcefad4+'-'+_0x430d53+'/'+_0xccf131)[_0xbe77('0x20')](_0x4754db);}return null;};}function patchUpdates(_0x5b477d){return function(_0x582ef4){try{jsonpatch[_0xbe77('0x21')](_0x582ef4,_0x5b477d,!![]);}catch(_0x532d68){return BPromise['reject'](_0x532d68);}return _0x582ef4['save']();};}function saveUpdates(_0x35e1cf,_0x31fd36){return function(_0x37a65e){if(_0x37a65e){return _0x37a65e[_0xbe77('0x22')](_0x35e1cf)[_0xbe77('0x23')](function(_0x2eeeba){return _0x2eeeba;});}return null;};}function removeEntity(_0x115a22,_0xc2f2c6){return function(_0x440b3f){if(_0x440b3f){return _0x440b3f['destroy']()[_0xbe77('0x23')](function(){_0x115a22[_0xbe77('0x19')](0xcc)[_0xbe77('0x1a')]();});}};}function handleEntityNotFound(_0x51f1f6,_0xbf8978){return function(_0x2be818){if(!_0x2be818){_0x51f1f6[_0xbe77('0x18')](0x194);}return _0x2be818;};}function handleError(_0x620d85,_0x31ab3d){_0x31ab3d=_0x31ab3d||0x1f4;return function(_0x598909){logger[_0xbe77('0x24')](_0x598909['stack']);if(_0x598909[_0xbe77('0x25')]){delete _0x598909[_0xbe77('0x25')];}_0x620d85[_0xbe77('0x19')](_0x31ab3d)[_0xbe77('0x26')](_0x598909);};}exports['index']=function(_0x1433e8,_0x2a1ebe){var _0x1739e3={},_0xc52923={},_0x57ffe9={'count':0x0,'rows':[]};var _0x11efcc=_[_0xbe77('0x27')](db['DeskConfiguration'][_0xbe77('0x28')],function(_0x30ad98){return{'name':_0x30ad98[_0xbe77('0x29')],'type':_0x30ad98[_0xbe77('0x2a')][_0xbe77('0x2b')]};});_0xc52923[_0xbe77('0x2c')]=_[_0xbe77('0x27')](_0x11efcc,'name');_0xc52923[_0xbe77('0x2d')]=_['keys'](_0x1433e8[_0xbe77('0x2d')]);_0xc52923[_0xbe77('0x2e')]=_[_0xbe77('0x2f')](_0xc52923[_0xbe77('0x2c')],_0xc52923[_0xbe77('0x2d')]);_0x1739e3[_0xbe77('0x30')]=_['intersection'](_0xc52923['model'],qs[_0xbe77('0x31')](_0x1433e8[_0xbe77('0x2d')][_0xbe77('0x31')]));_0x1739e3[_0xbe77('0x30')]=_0x1739e3['attributes'][_0xbe77('0x32')]?_0x1739e3[_0xbe77('0x30')]:_0xc52923[_0xbe77('0x2c')];if(!_0x1433e8[_0xbe77('0x2d')][_0xbe77('0x33')](_0xbe77('0x34'))){_0x1739e3[_0xbe77('0x35')]=qs['limit'](_0x1433e8['query'][_0xbe77('0x35')]);_0x1739e3['offset']=qs[_0xbe77('0x1b')](_0x1433e8[_0xbe77('0x2d')][_0xbe77('0x1b')]);}_0x1739e3[_0xbe77('0x36')]=qs[_0xbe77('0x37')](_0x1433e8['query'][_0xbe77('0x37')]);_0x1739e3[_0xbe77('0x38')]=qs[_0xbe77('0x2e')](_['pick'](_0x1433e8['query'],_0xc52923[_0xbe77('0x2e')]),_0x11efcc);if(_0x1433e8[_0xbe77('0x2d')]['filter']){_0x1739e3[_0xbe77('0x38')]=_[_0xbe77('0x39')](_0x1739e3[_0xbe77('0x38')],{'$or':_[_0xbe77('0x27')](_0x11efcc,function(_0x4ad1b5){if(_0x4ad1b5['type']!=='VIRTUAL'){var _0x905930={};_0x905930[_0x4ad1b5[_0xbe77('0x25')]]={'$like':'%'+_0x1433e8[_0xbe77('0x2d')][_0xbe77('0x3a')]+'%'};return _0x905930;}})});}_0x1739e3=_[_0xbe77('0x39')]({},_0x1739e3,_0x1433e8[_0xbe77('0x3b')]);var _0x18dc79={'where':_0x1739e3['where']};return db[_0xbe77('0x3c')][_0xbe77('0x1d')](_0x18dc79)[_0xbe77('0x23')](function(_0x3a132a){_0x57ffe9[_0xbe77('0x1d')]=_0x3a132a;if(_0x1433e8['query'][_0xbe77('0x3d')]){_0x1739e3[_0xbe77('0x3e')]=[{'all':!![]}];}return db[_0xbe77('0x3c')][_0xbe77('0x3f')](_0x1739e3);})[_0xbe77('0x23')](function(_0x5d3796){_0x57ffe9[_0xbe77('0x40')]=_0x5d3796;return _0x57ffe9;})[_0xbe77('0x23')](respondWithFilteredResult(_0x2a1ebe,_0x1739e3))[_0xbe77('0x41')](handleError(_0x2a1ebe,null));};exports[_0xbe77('0x42')]=function(_0x959c0e,_0x5859d8){var _0x40dbf2={'raw':![],'where':{'id':_0x959c0e[_0xbe77('0x43')]['id']}},_0x2d7b86={};_0x2d7b86[_0xbe77('0x2c')]=_[_0xbe77('0x44')](db[_0xbe77('0x3c')][_0xbe77('0x28')]);_0x2d7b86[_0xbe77('0x2d')]=_[_0xbe77('0x44')](_0x959c0e[_0xbe77('0x2d')]);_0x2d7b86[_0xbe77('0x2e')]=_[_0xbe77('0x2f')](_0x2d7b86[_0xbe77('0x2c')],_0x2d7b86[_0xbe77('0x2d')]);_0x40dbf2[_0xbe77('0x30')]=_['intersection'](_0x2d7b86[_0xbe77('0x2c')],qs[_0xbe77('0x31')](_0x959c0e[_0xbe77('0x2d')][_0xbe77('0x31')]));_0x40dbf2[_0xbe77('0x30')]=_0x40dbf2[_0xbe77('0x30')]['length']?_0x40dbf2[_0xbe77('0x30')]:_0x2d7b86['model'];if(_0x959c0e[_0xbe77('0x2d')][_0xbe77('0x3d')]){_0x40dbf2[_0xbe77('0x3e')]=[{'all':!![]}];}_0x40dbf2=_['merge']({},_0x40dbf2,_0x959c0e[_0xbe77('0x3b')]);return db[_0xbe77('0x3c')][_0xbe77('0x45')](_0x40dbf2)[_0xbe77('0x23')](handleEntityNotFound(_0x5859d8,null))[_0xbe77('0x23')](respondWithResult(_0x5859d8,null))[_0xbe77('0x41')](handleError(_0x5859d8,null));};exports['create']=function(_0x31bf81,_0x10462b){return db[_0xbe77('0x3c')][_0xbe77('0x46')](_0x31bf81[_0xbe77('0x47')],{})[_0xbe77('0x23')](respondWithResult(_0x10462b,0xc9))[_0xbe77('0x41')](handleError(_0x10462b,null));};exports[_0xbe77('0x22')]=function(_0x23be23,_0x5719e6){if(_0x23be23[_0xbe77('0x47')]['id']){delete _0x23be23['body']['id'];}return db[_0xbe77('0x3c')][_0xbe77('0x45')]({'where':{'id':_0x23be23['params']['id']}})[_0xbe77('0x23')](handleEntityNotFound(_0x5719e6,null))[_0xbe77('0x23')](saveUpdates(_0x23be23[_0xbe77('0x47')],null))[_0xbe77('0x23')](respondWithResult(_0x5719e6,null))[_0xbe77('0x41')](handleError(_0x5719e6,null));};exports['destroy']=function(_0x2f2616,_0x3f40b8){return db['DeskConfiguration'][_0xbe77('0x45')]({'where':{'id':_0x2f2616[_0xbe77('0x43')]['id']}})[_0xbe77('0x23')](handleEntityNotFound(_0x3f40b8,null))['then'](removeEntity(_0x3f40b8,null))[_0xbe77('0x41')](handleError(_0x3f40b8,null));};exports['getFields']=function(_0x14a983,_0x377ed9,_0xdc103){var _0x3b1bee={};var _0x3b0b1d={};var _0x154326;var _0x59154e;return db[_0xbe77('0x3c')][_0xbe77('0x48')]({'where':{'id':_0x14a983[_0xbe77('0x43')]['id']}})[_0xbe77('0x23')](handleEntityNotFound(_0x377ed9,null))[_0xbe77('0x23')](function(_0x574cfa){if(_0x574cfa){_0x154326=_0x574cfa;_0x3b0b1d[_0xbe77('0x2c')]=_[_0xbe77('0x44')](db[_0xbe77('0x49')][_0xbe77('0x28')]);_0x3b0b1d[_0xbe77('0x2d')]=_['keys'](_0x14a983[_0xbe77('0x2d')]);_0x3b0b1d[_0xbe77('0x2e')]=_[_0xbe77('0x2f')](_0x3b0b1d['model'],_0x3b0b1d[_0xbe77('0x2d')]);_0x3b1bee[_0xbe77('0x30')]=_[_0xbe77('0x2f')](_0x3b0b1d[_0xbe77('0x2c')],qs['fields'](_0x14a983['query'][_0xbe77('0x31')]));_0x3b1bee['attributes']=_0x3b1bee[_0xbe77('0x30')]['length']?_0x3b1bee[_0xbe77('0x30')]:_0x3b0b1d[_0xbe77('0x2c')];_0x3b1bee[_0xbe77('0x36')]=qs[_0xbe77('0x37')](_0x14a983['query']['sort']);_0x3b1bee[_0xbe77('0x38')]=qs['filters'](_[_0xbe77('0x4a')](_0x14a983[_0xbe77('0x2d')],_0x3b0b1d[_0xbe77('0x2e')]));if(_0x14a983[_0xbe77('0x2d')][_0xbe77('0x3a')]){_0x3b1bee['where']=_[_0xbe77('0x39')](_0x3b1bee[_0xbe77('0x38')],{'$or':_[_0xbe77('0x27')](_0x3b1bee[_0xbe77('0x30')],function(_0xcd03d5){var _0x2b251b={};_0x2b251b[_0xcd03d5]={'$like':'%'+_0x14a983['query'][_0xbe77('0x3a')]+'%'};return _0x2b251b;})});}_0x3b1bee=_[_0xbe77('0x39')]({},_0x3b1bee,_0x14a983[_0xbe77('0x3b')]);return _0x154326[_0xbe77('0x4b')](_0x3b1bee);}})[_0xbe77('0x23')](function(_0x49c166){if(_0x49c166){_0x59154e=_0x49c166['length'];if(!_0x14a983[_0xbe77('0x2d')][_0xbe77('0x33')](_0xbe77('0x34'))){_0x3b1bee['limit']=qs[_0xbe77('0x35')](_0x14a983['query']['limit']);_0x3b1bee['offset']=qs['offset'](_0x14a983['query'][_0xbe77('0x1b')]);}return _0x154326[_0xbe77('0x4b')](_0x3b1bee);}})[_0xbe77('0x23')](function(_0x123a94){if(_0x123a94){return _0x123a94?{'count':_0x59154e,'rows':_0x123a94}:null;}})[_0xbe77('0x23')](respondWithResult(_0x377ed9,null))[_0xbe77('0x41')](handleError(_0x377ed9,null));};exports['getSubjects']=function(_0x542ab8,_0x5dbc42,_0x442f0d){var _0x128378={};var _0x2b6b6d={};var _0x5efabe;var _0x10b70e;return db[_0xbe77('0x3c')]['findOne']({'where':{'id':_0x542ab8[_0xbe77('0x43')]['id']}})[_0xbe77('0x23')](handleEntityNotFound(_0x5dbc42,null))[_0xbe77('0x23')](function(_0x207166){if(_0x207166){_0x5efabe=_0x207166;_0x2b6b6d['model']=_[_0xbe77('0x44')](db[_0xbe77('0x49')]['rawAttributes']);_0x2b6b6d[_0xbe77('0x2d')]=_[_0xbe77('0x44')](_0x542ab8[_0xbe77('0x2d')]);_0x2b6b6d[_0xbe77('0x2e')]=_[_0xbe77('0x2f')](_0x2b6b6d[_0xbe77('0x2c')],_0x2b6b6d[_0xbe77('0x2d')]);_0x128378['attributes']=_['intersection'](_0x2b6b6d[_0xbe77('0x2c')],qs[_0xbe77('0x31')](_0x542ab8['query']['fields']));_0x128378['attributes']=_0x128378[_0xbe77('0x30')]['length']?_0x128378['attributes']:_0x2b6b6d['model'];_0x128378['order']=qs[_0xbe77('0x37')](_0x542ab8[_0xbe77('0x2d')][_0xbe77('0x37')]);_0x128378[_0xbe77('0x38')]=qs[_0xbe77('0x2e')](_[_0xbe77('0x4a')](_0x542ab8[_0xbe77('0x2d')],_0x2b6b6d['filters']));if(_0x542ab8[_0xbe77('0x2d')][_0xbe77('0x3a')]){_0x128378[_0xbe77('0x38')]=_['merge'](_0x128378['where'],{'$or':_[_0xbe77('0x27')](_0x128378[_0xbe77('0x30')],function(_0x5773f8){var _0x27d35a={};_0x27d35a[_0x5773f8]={'$like':'%'+_0x542ab8[_0xbe77('0x2d')][_0xbe77('0x3a')]+'%'};return _0x27d35a;})});}_0x128378=_['merge']({},_0x128378,_0x542ab8[_0xbe77('0x3b')]);return _0x5efabe[_0xbe77('0x4c')](_0x128378);}})[_0xbe77('0x23')](function(_0x2ef666){if(_0x2ef666){_0x10b70e=_0x2ef666[_0xbe77('0x32')];if(!_0x542ab8[_0xbe77('0x2d')][_0xbe77('0x33')](_0xbe77('0x34'))){_0x128378['limit']=qs[_0xbe77('0x35')](_0x542ab8['query'][_0xbe77('0x35')]);_0x128378['offset']=qs[_0xbe77('0x1b')](_0x542ab8[_0xbe77('0x2d')]['offset']);}return _0x5efabe[_0xbe77('0x4c')](_0x128378);}})['then'](function(_0x3d36d0){if(_0x3d36d0){return _0x3d36d0?{'count':_0x10b70e,'rows':_0x3d36d0}:null;}})[_0xbe77('0x23')](respondWithResult(_0x5dbc42,null))[_0xbe77('0x41')](handleError(_0x5dbc42,null));};exports[_0xbe77('0x4d')]=function(_0x499ca9,_0x1d179,_0x1e3010){var _0xf68f46={};var _0x1d0ca8={};var _0x3b7dde;var _0x28466a;return db[_0xbe77('0x3c')][_0xbe77('0x48')]({'where':{'id':_0x499ca9[_0xbe77('0x43')]['id']}})['then'](handleEntityNotFound(_0x1d179,null))[_0xbe77('0x23')](function(_0x3af8dd){if(_0x3af8dd){_0x3b7dde=_0x3af8dd;_0x1d0ca8[_0xbe77('0x2c')]=_[_0xbe77('0x44')](db['DeskField'][_0xbe77('0x28')]);_0x1d0ca8[_0xbe77('0x2d')]=_[_0xbe77('0x44')](_0x499ca9[_0xbe77('0x2d')]);_0x1d0ca8['filters']=_[_0xbe77('0x2f')](_0x1d0ca8['model'],_0x1d0ca8[_0xbe77('0x2d')]);_0xf68f46[_0xbe77('0x30')]=_['intersection'](_0x1d0ca8[_0xbe77('0x2c')],qs['fields'](_0x499ca9[_0xbe77('0x2d')]['fields']));_0xf68f46[_0xbe77('0x30')]=_0xf68f46[_0xbe77('0x30')][_0xbe77('0x32')]?_0xf68f46[_0xbe77('0x30')]:_0x1d0ca8[_0xbe77('0x2c')];_0xf68f46[_0xbe77('0x36')]=qs[_0xbe77('0x37')](_0x499ca9['query']['sort']);_0xf68f46[_0xbe77('0x38')]=qs[_0xbe77('0x2e')](_[_0xbe77('0x4a')](_0x499ca9[_0xbe77('0x2d')],_0x1d0ca8[_0xbe77('0x2e')]));if(_0x499ca9[_0xbe77('0x2d')][_0xbe77('0x3a')]){_0xf68f46['where']=_[_0xbe77('0x39')](_0xf68f46[_0xbe77('0x38')],{'$or':_[_0xbe77('0x27')](_0xf68f46[_0xbe77('0x30')],function(_0x223305){var _0x19d6c2={};_0x19d6c2[_0x223305]={'$like':'%'+_0x499ca9[_0xbe77('0x2d')][_0xbe77('0x3a')]+'%'};return _0x19d6c2;})});}_0xf68f46=_[_0xbe77('0x39')]({},_0xf68f46,_0x499ca9[_0xbe77('0x3b')]);return _0x3b7dde[_0xbe77('0x4d')](_0xf68f46);}})[_0xbe77('0x23')](function(_0x1c4b80){if(_0x1c4b80){_0x28466a=_0x1c4b80['length'];if(!_0x499ca9[_0xbe77('0x2d')][_0xbe77('0x33')](_0xbe77('0x34'))){_0xf68f46[_0xbe77('0x35')]=qs[_0xbe77('0x35')](_0x499ca9['query'][_0xbe77('0x35')]);_0xf68f46[_0xbe77('0x1b')]=qs[_0xbe77('0x1b')](_0x499ca9['query']['offset']);}return _0x3b7dde[_0xbe77('0x4d')](_0xf68f46);}})[_0xbe77('0x23')](function(_0x5be23c){if(_0x5be23c){return _0x5be23c?{'count':_0x28466a,'rows':_0x5be23c}:null;}})['then'](respondWithResult(_0x1d179,null))[_0xbe77('0x41')](handleError(_0x1d179,null));};exports[_0xbe77('0x4e')]=function(_0xae596f,_0x1204f1,_0x3f7d39){var _0x3a6bc6={};var _0xcfae59={};var _0x2860c4;var _0x1a565c;return db[_0xbe77('0x3c')]['findOne']({'where':{'id':_0xae596f[_0xbe77('0x43')]['id']}})[_0xbe77('0x23')](handleEntityNotFound(_0x1204f1,null))[_0xbe77('0x23')](function(_0x15cea1){if(_0x15cea1){_0x2860c4=_0x15cea1;_0xcfae59['model']=_[_0xbe77('0x44')](db['Tag'][_0xbe77('0x28')]);_0xcfae59['query']=_[_0xbe77('0x44')](_0xae596f['query']);_0xcfae59['filters']=_[_0xbe77('0x2f')](_0xcfae59[_0xbe77('0x2c')],_0xcfae59[_0xbe77('0x2d')]);_0x3a6bc6[_0xbe77('0x30')]=_['intersection'](_0xcfae59[_0xbe77('0x2c')],qs[_0xbe77('0x31')](_0xae596f[_0xbe77('0x2d')][_0xbe77('0x31')]));_0x3a6bc6['attributes']=_0x3a6bc6['attributes']['length']?_0x3a6bc6['attributes']:_0xcfae59[_0xbe77('0x2c')];_0x3a6bc6['order']=qs[_0xbe77('0x37')](_0xae596f[_0xbe77('0x2d')][_0xbe77('0x37')]);_0x3a6bc6[_0xbe77('0x38')]=qs['filters'](_[_0xbe77('0x4a')](_0xae596f[_0xbe77('0x2d')],_0xcfae59['filters']));if(_0xae596f[_0xbe77('0x2d')][_0xbe77('0x3a')]){_0x3a6bc6[_0xbe77('0x38')]=_[_0xbe77('0x39')](_0x3a6bc6[_0xbe77('0x38')],{'$or':_[_0xbe77('0x27')](_0x3a6bc6[_0xbe77('0x30')],function(_0x3179b5){var _0x4a47eb={};_0x4a47eb[_0x3179b5]={'$like':'%'+_0xae596f[_0xbe77('0x2d')][_0xbe77('0x3a')]+'%'};return _0x4a47eb;})});}_0x3a6bc6=_[_0xbe77('0x39')]({},_0x3a6bc6,_0xae596f[_0xbe77('0x3b')]);return _0x2860c4['getTags'](_0x3a6bc6);}})[_0xbe77('0x23')](function(_0x2a19ae){if(_0x2a19ae){_0x1a565c=_0x2a19ae[_0xbe77('0x32')];if(!_0xae596f[_0xbe77('0x2d')]['hasOwnProperty'](_0xbe77('0x34'))){_0x3a6bc6[_0xbe77('0x35')]=qs[_0xbe77('0x35')](_0xae596f[_0xbe77('0x2d')][_0xbe77('0x35')]);_0x3a6bc6[_0xbe77('0x1b')]=qs[_0xbe77('0x1b')](_0xae596f['query'][_0xbe77('0x1b')]);}return _0x2860c4[_0xbe77('0x4e')](_0x3a6bc6);}})[_0xbe77('0x23')](function(_0x3e7840){if(_0x3e7840){return _0x3e7840?{'count':_0x1a565c,'rows':_0x3e7840}:null;}})[_0xbe77('0x23')](respondWithResult(_0x1204f1,null))[_0xbe77('0x41')](handleError(_0x1204f1,null));};exports[_0xbe77('0x4f')]=function(_0x70dac0,_0x5f2f0d,_0x450ad1){if(_0x70dac0[_0xbe77('0x47')]['id']){delete _0x70dac0['body']['id'];}return db[_0xbe77('0x3c')][_0xbe77('0x48')]({'where':{'id':_0x70dac0[_0xbe77('0x43')]['id']}})['then'](handleEntityNotFound(_0x5f2f0d,null))[_0xbe77('0x23')](function(_0xe302ab){if(_0xe302ab){return _0xe302ab[_0xbe77('0x4f')](_0x70dac0['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x5f2f0d,null))[_0xbe77('0x41')](handleError(_0x5f2f0d,null));}; \ No newline at end of file +var _0x0343=['status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','destroy','then','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','DeskConfiguration','count','includeAll','include','findAll','rows','show','catch','create','body','find','params','getFields','findOne','length','nolimit','getSubjects','DeskField','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x14ee98,_0x776446){var _0x494a78=function(_0x5e7d27){while(--_0x5e7d27){_0x14ee98['push'](_0x14ee98['shift']());}};_0x494a78(++_0x776446);}(_0x0343,0xe8));var _0x3034=function(_0x50a1f6,_0x238fd8){_0x50a1f6=_0x50a1f6-0x0;var _0x84f8d4=_0x0343[_0x50a1f6];return _0x84f8d4;};'use strict';var emlformat=require(_0x3034('0x0'));var rimraf=require(_0x3034('0x1'));var zipdir=require(_0x3034('0x2'));var jsonpatch=require(_0x3034('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3034('0x4'));var Mustache=require(_0x3034('0x5'));var util=require(_0x3034('0x6'));var path=require(_0x3034('0x7'));var sox=require(_0x3034('0x8'));var csv=require(_0x3034('0x9'));var ejs=require(_0x3034('0xa'));var fs=require('fs');var fs_extra=require(_0x3034('0xb'));var _=require(_0x3034('0xc'));var squel=require(_0x3034('0xd'));var crypto=require(_0x3034('0xe'));var jsforce=require(_0x3034('0xf'));var deskjs=require(_0x3034('0x10'));var toCsv=require(_0x3034('0x9'));var querystring=require(_0x3034('0x11'));var Papa=require(_0x3034('0x12'));var Redis=require(_0x3034('0x13'));var authService=require(_0x3034('0x14'));var qs=require(_0x3034('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3034('0x16'));var utils=require(_0x3034('0x17'));var config=require(_0x3034('0x18'));var licenseUtil=require(_0x3034('0x19'));var db=require(_0x3034('0x1a'))['db'];function respondWithStatusCode(_0x564584,_0x1ada65){_0x1ada65=_0x1ada65||0xcc;return function(_0x2181ef){if(_0x2181ef){return _0x564584[_0x3034('0x1b')](_0x1ada65);}return _0x564584['status'](_0x1ada65)[_0x3034('0x1c')]();};}function respondWithResult(_0x6f74b4,_0x1997f9){_0x1997f9=_0x1997f9||0xc8;return function(_0x35be9a){if(_0x35be9a){return _0x6f74b4[_0x3034('0x1d')](_0x1997f9)[_0x3034('0x1e')](_0x35be9a);}};}function respondWithFilteredResult(_0x49ede4,_0x830677){return function(_0x24bca6){if(_0x24bca6){var _0x4846ab=typeof _0x830677[_0x3034('0x1f')]==='undefined'&&typeof _0x830677['limit']===_0x3034('0x20');var _0xeaf34b=_0x24bca6['count'];var _0x91c9a5=_0x4846ab?0x0:_0x830677[_0x3034('0x1f')];var _0x2460c0=_0x4846ab?_0x24bca6['count']:_0x830677[_0x3034('0x1f')]+_0x830677[_0x3034('0x21')];var _0x5cd1fe;if(_0x2460c0>=_0xeaf34b){_0x2460c0=_0xeaf34b;_0x5cd1fe=0xc8;}else{_0x5cd1fe=0xce;}_0x49ede4[_0x3034('0x1d')](_0x5cd1fe);return _0x49ede4[_0x3034('0x22')](_0x3034('0x23'),_0x91c9a5+'-'+_0x2460c0+'/'+_0xeaf34b)[_0x3034('0x1e')](_0x24bca6);}return null;};}function patchUpdates(_0x26851f){return function(_0x27e3d3){try{jsonpatch[_0x3034('0x24')](_0x27e3d3,_0x26851f,!![]);}catch(_0x15b15c){return BPromise[_0x3034('0x25')](_0x15b15c);}return _0x27e3d3[_0x3034('0x26')]();};}function saveUpdates(_0x2fa04f,_0x1783d1){return function(_0x70061){if(_0x70061){return _0x70061['update'](_0x2fa04f)['then'](function(_0x229752){return _0x229752;});}return null;};}function removeEntity(_0x5e1d0c,_0xfa9dbc){return function(_0x2c4e0b){if(_0x2c4e0b){return _0x2c4e0b[_0x3034('0x27')]()[_0x3034('0x28')](function(){_0x5e1d0c[_0x3034('0x1d')](0xcc)[_0x3034('0x1c')]();});}};}function handleEntityNotFound(_0xcfd565,_0x1dc22b){return function(_0x32c080){if(!_0x32c080){_0xcfd565[_0x3034('0x1b')](0x194);}return _0x32c080;};}function handleError(_0x98031c,_0x562164){_0x562164=_0x562164||0x1f4;return function(_0x37fd28){logger['error'](_0x37fd28['stack']);if(_0x37fd28[_0x3034('0x29')]){delete _0x37fd28['name'];}_0x98031c[_0x3034('0x1d')](_0x562164)[_0x3034('0x2a')](_0x37fd28);};}exports[_0x3034('0x2b')]=function(_0x52eeab,_0x4dcbed){var _0xb78667={},_0x3d89b9={},_0x405765={'count':0x0,'rows':[]};var _0x556e04=_['map'](db['DeskConfiguration'][_0x3034('0x2c')],function(_0x114526){return{'name':_0x114526[_0x3034('0x2d')],'type':_0x114526[_0x3034('0x2e')][_0x3034('0x2f')]};});_0x3d89b9['model']=_[_0x3034('0x30')](_0x556e04,'name');_0x3d89b9[_0x3034('0x31')]=_[_0x3034('0x32')](_0x52eeab[_0x3034('0x31')]);_0x3d89b9[_0x3034('0x33')]=_[_0x3034('0x34')](_0x3d89b9['model'],_0x3d89b9[_0x3034('0x31')]);_0xb78667['attributes']=_[_0x3034('0x34')](_0x3d89b9[_0x3034('0x35')],qs[_0x3034('0x36')](_0x52eeab[_0x3034('0x31')][_0x3034('0x36')]));_0xb78667['attributes']=_0xb78667[_0x3034('0x37')]['length']?_0xb78667['attributes']:_0x3d89b9[_0x3034('0x35')];if(!_0x52eeab['query'][_0x3034('0x38')]('nolimit')){_0xb78667['limit']=qs['limit'](_0x52eeab[_0x3034('0x31')][_0x3034('0x21')]);_0xb78667[_0x3034('0x1f')]=qs[_0x3034('0x1f')](_0x52eeab[_0x3034('0x31')][_0x3034('0x1f')]);}_0xb78667[_0x3034('0x39')]=qs[_0x3034('0x3a')](_0x52eeab[_0x3034('0x31')]['sort']);_0xb78667['where']=qs[_0x3034('0x33')](_[_0x3034('0x3b')](_0x52eeab[_0x3034('0x31')],_0x3d89b9[_0x3034('0x33')]),_0x556e04);if(_0x52eeab[_0x3034('0x31')][_0x3034('0x3c')]){_0xb78667[_0x3034('0x3d')]=_[_0x3034('0x3e')](_0xb78667[_0x3034('0x3d')],{'$or':_[_0x3034('0x30')](_0x556e04,function(_0x4e1cfc){if(_0x4e1cfc[_0x3034('0x2e')]!==_0x3034('0x3f')){var _0x35ea34={};_0x35ea34[_0x4e1cfc[_0x3034('0x29')]]={'$like':'%'+_0x52eeab[_0x3034('0x31')][_0x3034('0x3c')]+'%'};return _0x35ea34;}})});}_0xb78667=_['merge']({},_0xb78667,_0x52eeab[_0x3034('0x40')]);var _0x54510c={'where':_0xb78667[_0x3034('0x3d')]};return db[_0x3034('0x41')][_0x3034('0x42')](_0x54510c)[_0x3034('0x28')](function(_0x3f80b9){_0x405765[_0x3034('0x42')]=_0x3f80b9;if(_0x52eeab[_0x3034('0x31')][_0x3034('0x43')]){_0xb78667[_0x3034('0x44')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x3034('0x45')](_0xb78667);})[_0x3034('0x28')](function(_0x2d06f9){_0x405765[_0x3034('0x46')]=_0x2d06f9;return _0x405765;})[_0x3034('0x28')](respondWithFilteredResult(_0x4dcbed,_0xb78667))['catch'](handleError(_0x4dcbed,null));};exports[_0x3034('0x47')]=function(_0x493412,_0x3d5f0e){var _0xd736d2={'raw':![],'where':{'id':_0x493412['params']['id']}},_0x4eb2b2={};_0x4eb2b2[_0x3034('0x35')]=_['keys'](db[_0x3034('0x41')][_0x3034('0x2c')]);_0x4eb2b2[_0x3034('0x31')]=_[_0x3034('0x32')](_0x493412['query']);_0x4eb2b2[_0x3034('0x33')]=_[_0x3034('0x34')](_0x4eb2b2['model'],_0x4eb2b2[_0x3034('0x31')]);_0xd736d2[_0x3034('0x37')]=_[_0x3034('0x34')](_0x4eb2b2[_0x3034('0x35')],qs[_0x3034('0x36')](_0x493412[_0x3034('0x31')][_0x3034('0x36')]));_0xd736d2[_0x3034('0x37')]=_0xd736d2[_0x3034('0x37')]['length']?_0xd736d2[_0x3034('0x37')]:_0x4eb2b2[_0x3034('0x35')];if(_0x493412['query'][_0x3034('0x43')]){_0xd736d2[_0x3034('0x44')]=[{'all':!![]}];}_0xd736d2=_[_0x3034('0x3e')]({},_0xd736d2,_0x493412[_0x3034('0x40')]);return db[_0x3034('0x41')]['find'](_0xd736d2)['then'](handleEntityNotFound(_0x3d5f0e,null))[_0x3034('0x28')](respondWithResult(_0x3d5f0e,null))[_0x3034('0x48')](handleError(_0x3d5f0e,null));};exports[_0x3034('0x49')]=function(_0x425fba,_0x505cd0){return db[_0x3034('0x41')][_0x3034('0x49')](_0x425fba['body'],{})['then'](respondWithResult(_0x505cd0,0xc9))['catch'](handleError(_0x505cd0,null));};exports['update']=function(_0x4d2e7b,_0x4c0868){if(_0x4d2e7b[_0x3034('0x4a')]['id']){delete _0x4d2e7b[_0x3034('0x4a')]['id'];}return db[_0x3034('0x41')][_0x3034('0x4b')]({'where':{'id':_0x4d2e7b[_0x3034('0x4c')]['id']}})[_0x3034('0x28')](handleEntityNotFound(_0x4c0868,null))[_0x3034('0x28')](saveUpdates(_0x4d2e7b[_0x3034('0x4a')],null))['then'](respondWithResult(_0x4c0868,null))[_0x3034('0x48')](handleError(_0x4c0868,null));};exports[_0x3034('0x27')]=function(_0x3ac24b,_0x541bdc){return db[_0x3034('0x41')]['find']({'where':{'id':_0x3ac24b[_0x3034('0x4c')]['id']}})[_0x3034('0x28')](handleEntityNotFound(_0x541bdc,null))[_0x3034('0x28')](removeEntity(_0x541bdc,null))[_0x3034('0x48')](handleError(_0x541bdc,null));};exports[_0x3034('0x4d')]=function(_0x68d3bf,_0x4ac76b,_0x59990d){var _0x1619af={};var _0x182586={};var _0x48be88;var _0x2e1c55;return db[_0x3034('0x41')][_0x3034('0x4e')]({'where':{'id':_0x68d3bf[_0x3034('0x4c')]['id']}})[_0x3034('0x28')](handleEntityNotFound(_0x4ac76b,null))[_0x3034('0x28')](function(_0x3aa557){if(_0x3aa557){_0x48be88=_0x3aa557;_0x182586[_0x3034('0x35')]=_['keys'](db['DeskField'][_0x3034('0x2c')]);_0x182586['query']=_[_0x3034('0x32')](_0x68d3bf['query']);_0x182586[_0x3034('0x33')]=_[_0x3034('0x34')](_0x182586['model'],_0x182586[_0x3034('0x31')]);_0x1619af[_0x3034('0x37')]=_[_0x3034('0x34')](_0x182586[_0x3034('0x35')],qs[_0x3034('0x36')](_0x68d3bf[_0x3034('0x31')][_0x3034('0x36')]));_0x1619af['attributes']=_0x1619af['attributes'][_0x3034('0x4f')]?_0x1619af[_0x3034('0x37')]:_0x182586['model'];_0x1619af[_0x3034('0x39')]=qs[_0x3034('0x3a')](_0x68d3bf['query'][_0x3034('0x3a')]);_0x1619af[_0x3034('0x3d')]=qs[_0x3034('0x33')](_[_0x3034('0x3b')](_0x68d3bf['query'],_0x182586[_0x3034('0x33')]));if(_0x68d3bf[_0x3034('0x31')][_0x3034('0x3c')]){_0x1619af[_0x3034('0x3d')]=_[_0x3034('0x3e')](_0x1619af[_0x3034('0x3d')],{'$or':_[_0x3034('0x30')](_0x1619af[_0x3034('0x37')],function(_0x42338e){var _0x1cb686={};_0x1cb686[_0x42338e]={'$like':'%'+_0x68d3bf[_0x3034('0x31')]['filter']+'%'};return _0x1cb686;})});}_0x1619af=_['merge']({},_0x1619af,_0x68d3bf[_0x3034('0x40')]);return _0x48be88['getFields'](_0x1619af);}})['then'](function(_0x3f5541){if(_0x3f5541){_0x2e1c55=_0x3f5541[_0x3034('0x4f')];if(!_0x68d3bf[_0x3034('0x31')]['hasOwnProperty'](_0x3034('0x50'))){_0x1619af[_0x3034('0x21')]=qs[_0x3034('0x21')](_0x68d3bf[_0x3034('0x31')]['limit']);_0x1619af[_0x3034('0x1f')]=qs[_0x3034('0x1f')](_0x68d3bf['query'][_0x3034('0x1f')]);}return _0x48be88[_0x3034('0x4d')](_0x1619af);}})[_0x3034('0x28')](function(_0x4829ab){if(_0x4829ab){return _0x4829ab?{'count':_0x2e1c55,'rows':_0x4829ab}:null;}})[_0x3034('0x28')](respondWithResult(_0x4ac76b,null))[_0x3034('0x48')](handleError(_0x4ac76b,null));};exports[_0x3034('0x51')]=function(_0x37a774,_0x116615,_0x3e9534){var _0x32a95c={};var _0x5be418={};var _0x341b8f;var _0x2e71a7;return db[_0x3034('0x41')][_0x3034('0x4e')]({'where':{'id':_0x37a774[_0x3034('0x4c')]['id']}})[_0x3034('0x28')](handleEntityNotFound(_0x116615,null))['then'](function(_0x2efe9b){if(_0x2efe9b){_0x341b8f=_0x2efe9b;_0x5be418['model']=_[_0x3034('0x32')](db['DeskField'][_0x3034('0x2c')]);_0x5be418['query']=_[_0x3034('0x32')](_0x37a774[_0x3034('0x31')]);_0x5be418[_0x3034('0x33')]=_[_0x3034('0x34')](_0x5be418['model'],_0x5be418[_0x3034('0x31')]);_0x32a95c['attributes']=_[_0x3034('0x34')](_0x5be418[_0x3034('0x35')],qs[_0x3034('0x36')](_0x37a774[_0x3034('0x31')][_0x3034('0x36')]));_0x32a95c['attributes']=_0x32a95c[_0x3034('0x37')]['length']?_0x32a95c['attributes']:_0x5be418[_0x3034('0x35')];_0x32a95c[_0x3034('0x39')]=qs[_0x3034('0x3a')](_0x37a774[_0x3034('0x31')]['sort']);_0x32a95c[_0x3034('0x3d')]=qs[_0x3034('0x33')](_['pick'](_0x37a774['query'],_0x5be418['filters']));if(_0x37a774[_0x3034('0x31')][_0x3034('0x3c')]){_0x32a95c[_0x3034('0x3d')]=_[_0x3034('0x3e')](_0x32a95c[_0x3034('0x3d')],{'$or':_[_0x3034('0x30')](_0x32a95c[_0x3034('0x37')],function(_0x54c6cb){var _0x5a8de5={};_0x5a8de5[_0x54c6cb]={'$like':'%'+_0x37a774[_0x3034('0x31')][_0x3034('0x3c')]+'%'};return _0x5a8de5;})});}_0x32a95c=_['merge']({},_0x32a95c,_0x37a774[_0x3034('0x40')]);return _0x341b8f['getSubjects'](_0x32a95c);}})['then'](function(_0x48a3be){if(_0x48a3be){_0x2e71a7=_0x48a3be[_0x3034('0x4f')];if(!_0x37a774[_0x3034('0x31')]['hasOwnProperty'](_0x3034('0x50'))){_0x32a95c[_0x3034('0x21')]=qs[_0x3034('0x21')](_0x37a774[_0x3034('0x31')][_0x3034('0x21')]);_0x32a95c[_0x3034('0x1f')]=qs[_0x3034('0x1f')](_0x37a774[_0x3034('0x31')][_0x3034('0x1f')]);}return _0x341b8f[_0x3034('0x51')](_0x32a95c);}})[_0x3034('0x28')](function(_0x1d9b9e){if(_0x1d9b9e){return _0x1d9b9e?{'count':_0x2e71a7,'rows':_0x1d9b9e}:null;}})['then'](respondWithResult(_0x116615,null))[_0x3034('0x48')](handleError(_0x116615,null));};exports['getDescriptions']=function(_0x4536cb,_0xd6dfc1,_0x118d75){var _0xb4d69c={};var _0x4308ac={};var _0x22e698;var _0x41e309;return db['DeskConfiguration'][_0x3034('0x4e')]({'where':{'id':_0x4536cb[_0x3034('0x4c')]['id']}})[_0x3034('0x28')](handleEntityNotFound(_0xd6dfc1,null))[_0x3034('0x28')](function(_0x4fa4b2){if(_0x4fa4b2){_0x22e698=_0x4fa4b2;_0x4308ac[_0x3034('0x35')]=_['keys'](db[_0x3034('0x52')][_0x3034('0x2c')]);_0x4308ac[_0x3034('0x31')]=_[_0x3034('0x32')](_0x4536cb[_0x3034('0x31')]);_0x4308ac[_0x3034('0x33')]=_[_0x3034('0x34')](_0x4308ac[_0x3034('0x35')],_0x4308ac[_0x3034('0x31')]);_0xb4d69c[_0x3034('0x37')]=_[_0x3034('0x34')](_0x4308ac['model'],qs[_0x3034('0x36')](_0x4536cb[_0x3034('0x31')][_0x3034('0x36')]));_0xb4d69c['attributes']=_0xb4d69c['attributes'][_0x3034('0x4f')]?_0xb4d69c[_0x3034('0x37')]:_0x4308ac[_0x3034('0x35')];_0xb4d69c[_0x3034('0x39')]=qs[_0x3034('0x3a')](_0x4536cb['query']['sort']);_0xb4d69c[_0x3034('0x3d')]=qs['filters'](_['pick'](_0x4536cb[_0x3034('0x31')],_0x4308ac[_0x3034('0x33')]));if(_0x4536cb['query']['filter']){_0xb4d69c['where']=_['merge'](_0xb4d69c['where'],{'$or':_[_0x3034('0x30')](_0xb4d69c[_0x3034('0x37')],function(_0x3342c8){var _0x38c1fb={};_0x38c1fb[_0x3342c8]={'$like':'%'+_0x4536cb[_0x3034('0x31')][_0x3034('0x3c')]+'%'};return _0x38c1fb;})});}_0xb4d69c=_[_0x3034('0x3e')]({},_0xb4d69c,_0x4536cb['options']);return _0x22e698[_0x3034('0x53')](_0xb4d69c);}})[_0x3034('0x28')](function(_0x2627c5){if(_0x2627c5){_0x41e309=_0x2627c5[_0x3034('0x4f')];if(!_0x4536cb['query'][_0x3034('0x38')](_0x3034('0x50'))){_0xb4d69c[_0x3034('0x21')]=qs[_0x3034('0x21')](_0x4536cb[_0x3034('0x31')][_0x3034('0x21')]);_0xb4d69c[_0x3034('0x1f')]=qs['offset'](_0x4536cb[_0x3034('0x31')][_0x3034('0x1f')]);}return _0x22e698[_0x3034('0x53')](_0xb4d69c);}})[_0x3034('0x28')](function(_0x9456c){if(_0x9456c){return _0x9456c?{'count':_0x41e309,'rows':_0x9456c}:null;}})[_0x3034('0x28')](respondWithResult(_0xd6dfc1,null))['catch'](handleError(_0xd6dfc1,null));};exports[_0x3034('0x54')]=function(_0x507e67,_0xcc5fe0,_0x25f466){var _0x35dcde={};var _0x37a746={};var _0x1baf99;var _0x5b500c;return db[_0x3034('0x41')][_0x3034('0x4e')]({'where':{'id':_0x507e67[_0x3034('0x4c')]['id']}})[_0x3034('0x28')](handleEntityNotFound(_0xcc5fe0,null))[_0x3034('0x28')](function(_0x435015){if(_0x435015){_0x1baf99=_0x435015;_0x37a746[_0x3034('0x35')]=_[_0x3034('0x32')](db['Tag']['rawAttributes']);_0x37a746['query']=_[_0x3034('0x32')](_0x507e67[_0x3034('0x31')]);_0x37a746['filters']=_['intersection'](_0x37a746[_0x3034('0x35')],_0x37a746['query']);_0x35dcde[_0x3034('0x37')]=_[_0x3034('0x34')](_0x37a746['model'],qs[_0x3034('0x36')](_0x507e67[_0x3034('0x31')][_0x3034('0x36')]));_0x35dcde[_0x3034('0x37')]=_0x35dcde['attributes']['length']?_0x35dcde[_0x3034('0x37')]:_0x37a746[_0x3034('0x35')];_0x35dcde[_0x3034('0x39')]=qs[_0x3034('0x3a')](_0x507e67['query'][_0x3034('0x3a')]);_0x35dcde[_0x3034('0x3d')]=qs['filters'](_[_0x3034('0x3b')](_0x507e67[_0x3034('0x31')],_0x37a746['filters']));if(_0x507e67[_0x3034('0x31')][_0x3034('0x3c')]){_0x35dcde['where']=_['merge'](_0x35dcde[_0x3034('0x3d')],{'$or':_[_0x3034('0x30')](_0x35dcde[_0x3034('0x37')],function(_0x127f82){var _0x5dcfbb={};_0x5dcfbb[_0x127f82]={'$like':'%'+_0x507e67['query'][_0x3034('0x3c')]+'%'};return _0x5dcfbb;})});}_0x35dcde=_['merge']({},_0x35dcde,_0x507e67[_0x3034('0x40')]);return _0x1baf99[_0x3034('0x54')](_0x35dcde);}})[_0x3034('0x28')](function(_0x472512){if(_0x472512){_0x5b500c=_0x472512[_0x3034('0x4f')];if(!_0x507e67[_0x3034('0x31')][_0x3034('0x38')](_0x3034('0x50'))){_0x35dcde[_0x3034('0x21')]=qs[_0x3034('0x21')](_0x507e67[_0x3034('0x31')][_0x3034('0x21')]);_0x35dcde[_0x3034('0x1f')]=qs[_0x3034('0x1f')](_0x507e67[_0x3034('0x31')][_0x3034('0x1f')]);}return _0x1baf99[_0x3034('0x54')](_0x35dcde);}})[_0x3034('0x28')](function(_0x2c8509){if(_0x2c8509){return _0x2c8509?{'count':_0x5b500c,'rows':_0x2c8509}:null;}})[_0x3034('0x28')](respondWithResult(_0xcc5fe0,null))[_0x3034('0x48')](handleError(_0xcc5fe0,null));};exports['setTags']=function(_0x1839db,_0x59059e,_0x3adf30){if(_0x1839db['body']['id']){delete _0x1839db[_0x3034('0x4a')]['id'];}return db[_0x3034('0x41')]['findOne']({'where':{'id':_0x1839db[_0x3034('0x4c')]['id']}})[_0x3034('0x28')](handleEntityNotFound(_0x59059e,null))[_0x3034('0x28')](function(_0x80d89d){if(_0x80d89d){return _0x80d89d[_0x3034('0x55')](_0x1839db['body'][_0x3034('0x56')]||[]);}return null;})[_0x3034('0x28')](respondWithResult(_0x59059e,null))[_0x3034('0x48')](handleError(_0x59059e,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 2a8a072..116771c 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 _0xd46e=['moment','bluebird','request-promise','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xd46e,0x1a3));var _0xed46=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd46e[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xed46('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xed46('0x1'));var BPromise=require(_0xed46('0x2'));var rp=require(_0xed46('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed46('0x4'));var config=require('../../config/environment');var attributes=require(_0xed46('0x5'));module[_0xed46('0x6')]=function(_0x10e0d2,_0x5a82ef){return _0x10e0d2[_0xed46('0x7')](_0xed46('0x8'),attributes,{'tableName':_0xed46('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d9b=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations'];(function(_0x599c72,_0x181ffe){var _0xd758b0=function(_0xd608c0){while(--_0xd608c0){_0x599c72['push'](_0x599c72['shift']());}};_0xd758b0(++_0x181ffe);}(_0x2d9b,0xb0));var _0xb2d9=function(_0x550feb,_0x5dab19){_0x550feb=_0x550feb-0x0;var _0x4263df=_0x2d9b[_0x550feb];return _0x4263df;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb2d9('0x0'))('api');var moment=require(_0xb2d9('0x1'));var BPromise=require(_0xb2d9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2d9('0x3'));var rimraf=require(_0xb2d9('0x4'));var config=require(_0xb2d9('0x5'));var attributes=require(_0xb2d9('0x6'));module[_0xb2d9('0x7')]=function(_0x1a789d,_0x421081){return _0x1a789d[_0xb2d9('0x8')](_0xb2d9('0x9'),attributes,{'tableName':_0xb2d9('0xa'),'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 5345584..50f4ab6 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 _0x8a25=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','info','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x158112,_0x392f4d){var _0x44c3ac=function(_0x185e60){while(--_0x185e60){_0x158112['push'](_0x158112['shift']());}};_0x44c3ac(++_0x392f4d);}(_0x8a25,0xb7));var _0x58a2=function(_0x3debfb,_0x4912fd){_0x3debfb=_0x3debfb-0x0;var _0x60e082=_0x8a25[_0x3debfb];return _0x60e082;};'use strict';var _=require(_0x58a2('0x0'));var util=require(_0x58a2('0x1'));var moment=require(_0x58a2('0x2'));var BPromise=require(_0x58a2('0x3'));var rs=require(_0x58a2('0x4'));var fs=require('fs');var Redis=require(_0x58a2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x58a2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x58a2('0x7'));var jayson=require(_0x58a2('0x8'));var client=jayson[_0x58a2('0x9')][_0x58a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fe895,_0x2b6bf0,_0x38712c){return new BPromise(function(_0x4ecc5b,_0x31c4c0){return client[_0x58a2('0xb')](_0x1fe895,_0x38712c)[_0x58a2('0xc')](function(_0x2c17d9){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x2b6bf0,_0x58a2('0xd'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2b6bf0,_0x58a2('0xd'),JSON[_0x58a2('0xe')](_0x2c17d9));if(_0x2c17d9[_0x58a2('0xf')]){if(_0x2c17d9[_0x58a2('0xf')][_0x58a2('0x10')]===0x1f4){logger[_0x58a2('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x2b6bf0,_0x2c17d9['error'][_0x58a2('0x11')]);return _0x31c4c0(_0x2c17d9[_0x58a2('0xf')][_0x58a2('0x11')]);}logger[_0x58a2('0xf')](_0x58a2('0x12'),_0x2b6bf0,_0x2c17d9[_0x58a2('0xf')][_0x58a2('0x11')]);return _0x4ecc5b(_0x2c17d9[_0x58a2('0xf')][_0x58a2('0x11')]);}else{logger[_0x58a2('0x13')](_0x58a2('0x12'),_0x2b6bf0,_0x58a2('0xd'));_0x4ecc5b(_0x2c17d9['result']['message']);}})[_0x58a2('0x14')](function(_0x5a138e){logger[_0x58a2('0xf')](_0x58a2('0x12'),_0x2b6bf0,_0x5a138e);_0x31c4c0(_0x5a138e);});});} \ No newline at end of file +var _0x6f83=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6f83,0x72));var _0x36f8=function(_0x16c59e,_0x53ba99){_0x16c59e=_0x16c59e-0x0;var _0x45271e=_0x6f83[_0x16c59e];return _0x45271e;};'use strict';var _=require('lodash');var util=require(_0x36f8('0x0'));var moment=require(_0x36f8('0x1'));var BPromise=require('bluebird');var rs=require(_0x36f8('0x2'));var fs=require('fs');var Redis=require(_0x36f8('0x3'));var db=require(_0x36f8('0x4'))['db'];var utils=require(_0x36f8('0x5'));var logger=require(_0x36f8('0x6'))(_0x36f8('0x7'));var config=require(_0x36f8('0x8'));var jayson=require(_0x36f8('0x9'));var client=jayson[_0x36f8('0xa')][_0x36f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27d94b,_0x2c0367,_0x370a97){return new BPromise(function(_0x3fe644,_0x22b992){return client[_0x36f8('0xc')](_0x27d94b,_0x370a97)['then'](function(_0x48c7b2){logger['info'](_0x36f8('0xd'),_0x2c0367,_0x36f8('0xe'));logger[_0x36f8('0xf')](_0x36f8('0x10'),_0x2c0367,_0x36f8('0xe'),JSON[_0x36f8('0x11')](_0x48c7b2));if(_0x48c7b2[_0x36f8('0x12')]){if(_0x48c7b2[_0x36f8('0x12')][_0x36f8('0x13')]===0x1f4){logger['error'](_0x36f8('0xd'),_0x2c0367,_0x48c7b2[_0x36f8('0x12')][_0x36f8('0x14')]);return _0x22b992(_0x48c7b2[_0x36f8('0x12')]['message']);}logger[_0x36f8('0x12')](_0x36f8('0xd'),_0x2c0367,_0x48c7b2[_0x36f8('0x12')]['message']);return _0x3fe644(_0x48c7b2[_0x36f8('0x12')][_0x36f8('0x14')]);}else{logger[_0x36f8('0x15')]('DeskConfiguration,\x20%s,\x20%s',_0x2c0367,_0x36f8('0xe'));_0x3fe644(_0x48c7b2[_0x36f8('0x16')][_0x36f8('0x14')]);}})[_0x36f8('0x17')](function(_0x5ec545){logger['error'](_0x36f8('0xd'),_0x2c0367,_0x5ec545);_0x22b992(_0x5ec545);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 2ef87bd..68f37d6 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 _0xbc1d=['../../components/interaction/service','./intDeskField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x3d4612,_0x51f870){var _0x70934b=function(_0x2563c0){while(--_0x2563c0){_0x3d4612['push'](_0x3d4612['shift']());}};_0x70934b(++_0x51f870);}(_0xbc1d,0x12a));var _0xdbc1=function(_0x31b31b,_0x5f044e){_0x31b31b=_0x31b31b-0x0;var _0x2c8fc2=_0xbc1d[_0x31b31b];return _0x2c8fc2;};'use strict';var multer=require(_0xdbc1('0x0'));var util=require(_0xdbc1('0x1'));var path=require(_0xdbc1('0x2'));var timeout=require('connect-timeout');var express=require(_0xdbc1('0x3'));var router=express[_0xdbc1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdbc1('0x5'));var interaction=require(_0xdbc1('0x6'));var config=require('../../config/environment');var controller=require(_0xdbc1('0x7'));router['get']('/',auth[_0xdbc1('0x8')](),controller[_0xdbc1('0x9')]);router[_0xdbc1('0xa')](_0xdbc1('0xb'),auth[_0xdbc1('0x8')](),controller[_0xdbc1('0xc')]);router[_0xdbc1('0xd')]('/',auth[_0xdbc1('0x8')](),controller[_0xdbc1('0xe')]);router['put'](_0xdbc1('0xb'),auth[_0xdbc1('0x8')](),controller[_0xdbc1('0xf')]);router[_0xdbc1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xdbc1('0x11')]);module[_0xdbc1('0x12')]=router; \ No newline at end of file +var _0xbc1d=['isAuthenticated','index','/:id','show','create','update','delete','destroy','util','path','Router','../../config/environment','./intDeskField.controller','get'];(function(_0x340150,_0x20c48b){var _0x541dde=function(_0x20f257){while(--_0x20f257){_0x340150['push'](_0x340150['shift']());}};_0x541dde(++_0x20c48b);}(_0xbc1d,0x19e));var _0xdbc1=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0xbc1d[_0x4715d2];return _0x141811;};'use strict';var multer=require('multer');var util=require(_0xdbc1('0x0'));var path=require(_0xdbc1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdbc1('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdbc1('0x3'));var controller=require(_0xdbc1('0x4'));router[_0xdbc1('0x5')]('/',auth[_0xdbc1('0x6')](),controller[_0xdbc1('0x7')]);router[_0xdbc1('0x5')](_0xdbc1('0x8'),auth[_0xdbc1('0x6')](),controller[_0xdbc1('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdbc1('0xa')]);router['put'](_0xdbc1('0x8'),auth[_0xdbc1('0x6')](),controller[_0xdbc1('0xb')]);router[_0xdbc1('0xc')](_0xdbc1('0x8'),auth['isAuthenticated'](),controller[_0xdbc1('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 1327710..529e96f 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 _0x0453=['STRING','ENUM','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x2671e8,_0x4c937a){var _0x38051a=function(_0x28bdad){while(--_0x28bdad){_0x2671e8['push'](_0x2671e8['shift']());}};_0x38051a(++_0x4c937a);}(_0x0453,0x65));var _0x3045=function(_0x4da31a,_0x435af7){_0x4da31a=_0x4da31a-0x0;var _0x2211f3=_0x0453[_0x4da31a];return _0x2211f3;};'use strict';var Sequelize=require(_0x3045('0x0'));module[_0x3045('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3045('0x2'),_0x3045('0x3'),_0x3045('0x4'),_0x3045('0x5'),_0x3045('0x6')),'defaultValue':_0x3045('0x2')},'content':{'type':Sequelize[_0x3045('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3045('0x8')](_0x3045('0x2'),_0x3045('0x3'),_0x3045('0x4'))},'keyContent':{'type':Sequelize[_0x3045('0x7')]},'idField':{'type':Sequelize[_0x3045('0x7')]},'nameField':{'type':Sequelize[_0x3045('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3045('0x7')]}}; \ No newline at end of file +var _0x96a8=['keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x3cff6c,_0x107a6c){var _0x442fb7=function(_0x40221c){while(--_0x40221c){_0x3cff6c['push'](_0x3cff6c['shift']());}};_0x442fb7(++_0x107a6c);}(_0x96a8,0x175));var _0x896a=function(_0x1f3be6,_0x219ca9){_0x1f3be6=_0x1f3be6-0x0;var _0x4a025c=_0x96a8[_0x1f3be6];return _0x4a025c;};'use strict';var Sequelize=require(_0x896a('0x0'));module['exports']={'type':{'type':Sequelize[_0x896a('0x1')](_0x896a('0x2'),_0x896a('0x3'),_0x896a('0x4'),_0x896a('0x5'),_0x896a('0x6')),'defaultValue':_0x896a('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x896a('0x1')](_0x896a('0x2'),_0x896a('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x896a('0x7')]},'idField':{'type':Sequelize[_0x896a('0x7')]},'nameField':{'type':Sequelize[_0x896a('0x7')]},'customField':{'type':Sequelize[_0x896a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 0012acc..0552594 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 _0xb7ae=['include','find','create','catch','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','show'];(function(_0x2f2b74,_0x58080a){var _0x5ee600=function(_0x434583){while(--_0x434583){_0x2f2b74['push'](_0x2f2b74['shift']());}};_0x5ee600(++_0x58080a);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x90b497,_0x167944){_0x90b497=_0x90b497-0x0;var _0xc6daea=_0xb7ae[_0x90b497];return _0xc6daea;};'use strict';var emlformat=require(_0xeb7a('0x0'));var rimraf=require(_0xeb7a('0x1'));var zipdir=require(_0xeb7a('0x2'));var jsonpatch=require(_0xeb7a('0x3'));var rp=require(_0xeb7a('0x4'));var moment=require('moment');var BPromise=require(_0xeb7a('0x5'));var Mustache=require(_0xeb7a('0x6'));var util=require(_0xeb7a('0x7'));var path=require('path');var sox=require(_0xeb7a('0x8'));var csv=require(_0xeb7a('0x9'));var ejs=require(_0xeb7a('0xa'));var fs=require('fs');var fs_extra=require(_0xeb7a('0xb'));var _=require(_0xeb7a('0xc'));var squel=require('squel');var crypto=require(_0xeb7a('0xd'));var jsforce=require(_0xeb7a('0xe'));var deskjs=require(_0xeb7a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb7a('0x10'));var Papa=require(_0xeb7a('0x11'));var Redis=require(_0xeb7a('0x12'));var authService=require(_0xeb7a('0x13'));var qs=require(_0xeb7a('0x14'));var as=require(_0xeb7a('0x15'));var hardwareService=require(_0xeb7a('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xeb7a('0x17'));var config=require(_0xeb7a('0x18'));var licenseUtil=require(_0xeb7a('0x19'));var db=require(_0xeb7a('0x1a'))['db'];function respondWithStatusCode(_0x13bcf4,_0x203723){_0x203723=_0x203723||0xcc;return function(_0x166e4d){if(_0x166e4d){return _0x13bcf4['sendStatus'](_0x203723);}return _0x13bcf4[_0xeb7a('0x1b')](_0x203723)[_0xeb7a('0x1c')]();};}function respondWithResult(_0x4e86a7,_0x110acb){_0x110acb=_0x110acb||0xc8;return function(_0x186ea3){if(_0x186ea3){return _0x4e86a7['status'](_0x110acb)[_0xeb7a('0x1d')](_0x186ea3);}};}function respondWithFilteredResult(_0x5db84f,_0x5d953f){return function(_0x388666){if(_0x388666){var _0x5e6256=typeof _0x5d953f['offset']===_0xeb7a('0x1e')&&typeof _0x5d953f[_0xeb7a('0x1f')]===_0xeb7a('0x1e');var _0x2d92c7=_0x388666['count'];var _0x4be13e=_0x5e6256?0x0:_0x5d953f[_0xeb7a('0x20')];var _0x26bd85=_0x5e6256?_0x388666['count']:_0x5d953f['offset']+_0x5d953f[_0xeb7a('0x1f')];var _0x25a399;if(_0x26bd85>=_0x2d92c7){_0x26bd85=_0x2d92c7;_0x25a399=0xc8;}else{_0x25a399=0xce;}_0x5db84f[_0xeb7a('0x1b')](_0x25a399);return _0x5db84f[_0xeb7a('0x21')](_0xeb7a('0x22'),_0x4be13e+'-'+_0x26bd85+'/'+_0x2d92c7)[_0xeb7a('0x1d')](_0x388666);}return null;};}function patchUpdates(_0x29fa3f){return function(_0x120128){try{jsonpatch['apply'](_0x120128,_0x29fa3f,!![]);}catch(_0x431d4a){return BPromise[_0xeb7a('0x23')](_0x431d4a);}return _0x120128['save']();};}function saveUpdates(_0x5af915,_0xeab362){return function(_0x434aac){if(_0x434aac){return _0x434aac[_0xeb7a('0x24')](_0x5af915)[_0xeb7a('0x25')](function(_0x29db91){return _0x29db91;});}return null;};}function removeEntity(_0x44cefc,_0xfb62a5){return function(_0x4c4816){if(_0x4c4816){return _0x4c4816[_0xeb7a('0x26')]()[_0xeb7a('0x25')](function(){_0x44cefc[_0xeb7a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10b7d3,_0x1cf8f6){return function(_0x182335){if(!_0x182335){_0x10b7d3[_0xeb7a('0x27')](0x194);}return _0x182335;};}function handleError(_0x53ade4,_0x15199a){_0x15199a=_0x15199a||0x1f4;return function(_0x52e882){logger[_0xeb7a('0x28')](_0x52e882[_0xeb7a('0x29')]);if(_0x52e882[_0xeb7a('0x2a')]){delete _0x52e882[_0xeb7a('0x2a')];}_0x53ade4[_0xeb7a('0x1b')](_0x15199a)[_0xeb7a('0x2b')](_0x52e882);};}exports[_0xeb7a('0x2c')]=function(_0x3917eb,_0x2a492f){var _0x20a197={},_0x2d2f9f={},_0x567bbe={'count':0x0,'rows':[]};var _0x34b88b=_[_0xeb7a('0x2d')](db[_0xeb7a('0x2e')][_0xeb7a('0x2f')],function(_0x14e2e1){return{'name':_0x14e2e1[_0xeb7a('0x30')],'type':_0x14e2e1[_0xeb7a('0x31')][_0xeb7a('0x32')]};});_0x2d2f9f[_0xeb7a('0x33')]=_[_0xeb7a('0x2d')](_0x34b88b,_0xeb7a('0x2a'));_0x2d2f9f['query']=_[_0xeb7a('0x34')](_0x3917eb[_0xeb7a('0x35')]);_0x2d2f9f[_0xeb7a('0x36')]=_[_0xeb7a('0x37')](_0x2d2f9f['model'],_0x2d2f9f[_0xeb7a('0x35')]);_0x20a197[_0xeb7a('0x38')]=_[_0xeb7a('0x37')](_0x2d2f9f[_0xeb7a('0x33')],qs[_0xeb7a('0x39')](_0x3917eb[_0xeb7a('0x35')]['fields']));_0x20a197[_0xeb7a('0x38')]=_0x20a197[_0xeb7a('0x38')][_0xeb7a('0x3a')]?_0x20a197[_0xeb7a('0x38')]:_0x2d2f9f[_0xeb7a('0x33')];if(!_0x3917eb[_0xeb7a('0x35')]['hasOwnProperty'](_0xeb7a('0x3b'))){_0x20a197['limit']=qs[_0xeb7a('0x1f')](_0x3917eb[_0xeb7a('0x35')]['limit']);_0x20a197[_0xeb7a('0x20')]=qs[_0xeb7a('0x20')](_0x3917eb[_0xeb7a('0x35')][_0xeb7a('0x20')]);}_0x20a197[_0xeb7a('0x3c')]=qs[_0xeb7a('0x3d')](_0x3917eb[_0xeb7a('0x35')][_0xeb7a('0x3d')]);_0x20a197['where']=qs[_0xeb7a('0x36')](_[_0xeb7a('0x3e')](_0x3917eb['query'],_0x2d2f9f[_0xeb7a('0x36')]),_0x34b88b);if(_0x3917eb[_0xeb7a('0x35')][_0xeb7a('0x3f')]){_0x20a197[_0xeb7a('0x40')]=_[_0xeb7a('0x41')](_0x20a197[_0xeb7a('0x40')],{'$or':_[_0xeb7a('0x2d')](_0x34b88b,function(_0x573e30){if(_0x573e30[_0xeb7a('0x31')]!==_0xeb7a('0x42')){var _0x308a2e={};_0x308a2e[_0x573e30[_0xeb7a('0x2a')]]={'$like':'%'+_0x3917eb[_0xeb7a('0x35')][_0xeb7a('0x3f')]+'%'};return _0x308a2e;}})});}_0x20a197=_[_0xeb7a('0x41')]({},_0x20a197,_0x3917eb[_0xeb7a('0x43')]);var _0x414580={'where':_0x20a197[_0xeb7a('0x40')]};return db[_0xeb7a('0x2e')][_0xeb7a('0x44')](_0x414580)['then'](function(_0x2d3d4d){_0x567bbe[_0xeb7a('0x44')]=_0x2d3d4d;if(_0x3917eb[_0xeb7a('0x35')][_0xeb7a('0x45')]){_0x20a197['include']=[{'all':!![]}];}return db[_0xeb7a('0x2e')][_0xeb7a('0x46')](_0x20a197);})[_0xeb7a('0x25')](function(_0x1803d6){_0x567bbe[_0xeb7a('0x47')]=_0x1803d6;return _0x567bbe;})[_0xeb7a('0x25')](respondWithFilteredResult(_0x2a492f,_0x20a197))['catch'](handleError(_0x2a492f,null));};exports[_0xeb7a('0x48')]=function(_0x1b1575,_0x48d620){var _0x436346={'raw':!![],'where':{'id':_0x1b1575['params']['id']}},_0x58c004={};_0x58c004['model']=_[_0xeb7a('0x34')](db[_0xeb7a('0x2e')][_0xeb7a('0x2f')]);_0x58c004[_0xeb7a('0x35')]=_[_0xeb7a('0x34')](_0x1b1575[_0xeb7a('0x35')]);_0x58c004['filters']=_['intersection'](_0x58c004[_0xeb7a('0x33')],_0x58c004['query']);_0x436346[_0xeb7a('0x38')]=_[_0xeb7a('0x37')](_0x58c004[_0xeb7a('0x33')],qs[_0xeb7a('0x39')](_0x1b1575['query'][_0xeb7a('0x39')]));_0x436346[_0xeb7a('0x38')]=_0x436346[_0xeb7a('0x38')][_0xeb7a('0x3a')]?_0x436346['attributes']:_0x58c004[_0xeb7a('0x33')];if(_0x1b1575['query'][_0xeb7a('0x45')]){_0x436346[_0xeb7a('0x49')]=[{'all':!![]}];}_0x436346=_[_0xeb7a('0x41')]({},_0x436346,_0x1b1575[_0xeb7a('0x43')]);return db[_0xeb7a('0x2e')][_0xeb7a('0x4a')](_0x436346)[_0xeb7a('0x25')](handleEntityNotFound(_0x48d620,null))['then'](respondWithResult(_0x48d620,null))['catch'](handleError(_0x48d620,null));};exports[_0xeb7a('0x4b')]=function(_0x3d48c8,_0x18c60f){return db[_0xeb7a('0x2e')][_0xeb7a('0x4b')](_0x3d48c8['body'],{})['then'](respondWithResult(_0x18c60f,0xc9))[_0xeb7a('0x4c')](handleError(_0x18c60f,null));};exports['update']=function(_0x202753,_0x5846bc){if(_0x202753[_0xeb7a('0x4d')]['id']){delete _0x202753[_0xeb7a('0x4d')]['id'];}return db[_0xeb7a('0x2e')][_0xeb7a('0x4a')]({'where':{'id':_0x202753[_0xeb7a('0x4e')]['id']}})[_0xeb7a('0x25')](handleEntityNotFound(_0x5846bc,null))[_0xeb7a('0x25')](saveUpdates(_0x202753[_0xeb7a('0x4d')],null))[_0xeb7a('0x25')](respondWithResult(_0x5846bc,null))[_0xeb7a('0x4c')](handleError(_0x5846bc,null));};exports[_0xeb7a('0x26')]=function(_0x466a2f,_0x55eb50){return db[_0xeb7a('0x2e')][_0xeb7a('0x4a')]({'where':{'id':_0x466a2f[_0xeb7a('0x4e')]['id']}})[_0xeb7a('0x25')](handleEntityNotFound(_0x55eb50,null))[_0xeb7a('0x25')](removeEntity(_0x55eb50,null))[_0xeb7a('0x4c')](handleError(_0x55eb50,null));}; \ No newline at end of file +var _0xa647=['api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','DeskField','type','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa647,0x81));var _0x7a64=function(_0x5ab81a,_0x5464f4){_0x5ab81a=_0x5ab81a-0x0;var _0x2a2d21=_0xa647[_0x5ab81a];return _0x2a2d21;};'use strict';var emlformat=require(_0x7a64('0x0'));var rimraf=require(_0x7a64('0x1'));var zipdir=require(_0x7a64('0x2'));var jsonpatch=require(_0x7a64('0x3'));var rp=require(_0x7a64('0x4'));var moment=require(_0x7a64('0x5'));var BPromise=require(_0x7a64('0x6'));var Mustache=require(_0x7a64('0x7'));var util=require(_0x7a64('0x8'));var path=require(_0x7a64('0x9'));var sox=require(_0x7a64('0xa'));var csv=require(_0x7a64('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a64('0xc'));var _=require(_0x7a64('0xd'));var squel=require('squel');var crypto=require(_0x7a64('0xe'));var jsforce=require(_0x7a64('0xf'));var deskjs=require(_0x7a64('0x10'));var toCsv=require(_0x7a64('0xb'));var querystring=require(_0x7a64('0x11'));var Papa=require(_0x7a64('0x12'));var Redis=require(_0x7a64('0x13'));var authService=require(_0x7a64('0x14'));var qs=require(_0x7a64('0x15'));var as=require(_0x7a64('0x16'));var hardwareService=require(_0x7a64('0x17'));var logger=require(_0x7a64('0x18'))(_0x7a64('0x19'));var utils=require('../../config/utils');var config=require(_0x7a64('0x1a'));var licenseUtil=require(_0x7a64('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10d549,_0x5923c){_0x5923c=_0x5923c||0xcc;return function(_0x30a408){if(_0x30a408){return _0x10d549['sendStatus'](_0x5923c);}return _0x10d549[_0x7a64('0x1c')](_0x5923c)[_0x7a64('0x1d')]();};}function respondWithResult(_0x38e79b,_0x293021){_0x293021=_0x293021||0xc8;return function(_0x24f0e3){if(_0x24f0e3){return _0x38e79b[_0x7a64('0x1c')](_0x293021)[_0x7a64('0x1e')](_0x24f0e3);}};}function respondWithFilteredResult(_0x4829f8,_0x136263){return function(_0x5ae1c3){if(_0x5ae1c3){var _0x47a13d=typeof _0x136263[_0x7a64('0x1f')]===_0x7a64('0x20')&&typeof _0x136263[_0x7a64('0x21')]==='undefined';var _0x126eef=_0x5ae1c3['count'];var _0x30c214=_0x47a13d?0x0:_0x136263['offset'];var _0x41e444=_0x47a13d?_0x5ae1c3['count']:_0x136263[_0x7a64('0x1f')]+_0x136263[_0x7a64('0x21')];var _0x5c196a;if(_0x41e444>=_0x126eef){_0x41e444=_0x126eef;_0x5c196a=0xc8;}else{_0x5c196a=0xce;}_0x4829f8['status'](_0x5c196a);return _0x4829f8['set'](_0x7a64('0x22'),_0x30c214+'-'+_0x41e444+'/'+_0x126eef)[_0x7a64('0x1e')](_0x5ae1c3);}return null;};}function patchUpdates(_0x4f56ab){return function(_0x57fa06){try{jsonpatch[_0x7a64('0x23')](_0x57fa06,_0x4f56ab,!![]);}catch(_0x5751b3){return BPromise[_0x7a64('0x24')](_0x5751b3);}return _0x57fa06[_0x7a64('0x25')]();};}function saveUpdates(_0x435abe,_0x2e78af){return function(_0x5dbac4){if(_0x5dbac4){return _0x5dbac4[_0x7a64('0x26')](_0x435abe)[_0x7a64('0x27')](function(_0x5e34d5){return _0x5e34d5;});}return null;};}function removeEntity(_0x2caaa4,_0xdfce54){return function(_0x61efd8){if(_0x61efd8){return _0x61efd8[_0x7a64('0x28')]()['then'](function(){_0x2caaa4['status'](0xcc)[_0x7a64('0x1d')]();});}};}function handleEntityNotFound(_0x40af63,_0x593144){return function(_0x38acec){if(!_0x38acec){_0x40af63['sendStatus'](0x194);}return _0x38acec;};}function handleError(_0x329f34,_0x3cc6a7){_0x3cc6a7=_0x3cc6a7||0x1f4;return function(_0x177132){logger[_0x7a64('0x29')](_0x177132[_0x7a64('0x2a')]);if(_0x177132[_0x7a64('0x2b')]){delete _0x177132[_0x7a64('0x2b')];}_0x329f34[_0x7a64('0x1c')](_0x3cc6a7)[_0x7a64('0x2c')](_0x177132);};}exports[_0x7a64('0x2d')]=function(_0x317183,_0x4e4136){var _0x1ce700={},_0x2dc737={},_0x358916={'count':0x0,'rows':[]};var _0x35a913=_['map'](db[_0x7a64('0x2e')]['rawAttributes'],function(_0x421092){return{'name':_0x421092['fieldName'],'type':_0x421092[_0x7a64('0x2f')]['key']};});_0x2dc737['model']=_[_0x7a64('0x30')](_0x35a913,_0x7a64('0x2b'));_0x2dc737[_0x7a64('0x31')]=_[_0x7a64('0x32')](_0x317183['query']);_0x2dc737[_0x7a64('0x33')]=_[_0x7a64('0x34')](_0x2dc737[_0x7a64('0x35')],_0x2dc737[_0x7a64('0x31')]);_0x1ce700['attributes']=_[_0x7a64('0x34')](_0x2dc737[_0x7a64('0x35')],qs['fields'](_0x317183['query'][_0x7a64('0x36')]));_0x1ce700[_0x7a64('0x37')]=_0x1ce700[_0x7a64('0x37')][_0x7a64('0x38')]?_0x1ce700[_0x7a64('0x37')]:_0x2dc737['model'];if(!_0x317183[_0x7a64('0x31')][_0x7a64('0x39')](_0x7a64('0x3a'))){_0x1ce700[_0x7a64('0x21')]=qs[_0x7a64('0x21')](_0x317183['query'][_0x7a64('0x21')]);_0x1ce700[_0x7a64('0x1f')]=qs[_0x7a64('0x1f')](_0x317183[_0x7a64('0x31')]['offset']);}_0x1ce700[_0x7a64('0x3b')]=qs[_0x7a64('0x3c')](_0x317183[_0x7a64('0x31')]['sort']);_0x1ce700[_0x7a64('0x3d')]=qs[_0x7a64('0x33')](_[_0x7a64('0x3e')](_0x317183[_0x7a64('0x31')],_0x2dc737[_0x7a64('0x33')]),_0x35a913);if(_0x317183['query'][_0x7a64('0x3f')]){_0x1ce700[_0x7a64('0x3d')]=_[_0x7a64('0x40')](_0x1ce700[_0x7a64('0x3d')],{'$or':_[_0x7a64('0x30')](_0x35a913,function(_0x5a1692){if(_0x5a1692[_0x7a64('0x2f')]!=='VIRTUAL'){var _0x255061={};_0x255061[_0x5a1692[_0x7a64('0x2b')]]={'$like':'%'+_0x317183[_0x7a64('0x31')][_0x7a64('0x3f')]+'%'};return _0x255061;}})});}_0x1ce700=_[_0x7a64('0x40')]({},_0x1ce700,_0x317183[_0x7a64('0x41')]);var _0x137b4d={'where':_0x1ce700[_0x7a64('0x3d')]};return db[_0x7a64('0x2e')]['count'](_0x137b4d)[_0x7a64('0x27')](function(_0xf7898a){_0x358916[_0x7a64('0x42')]=_0xf7898a;if(_0x317183[_0x7a64('0x31')][_0x7a64('0x43')]){_0x1ce700[_0x7a64('0x44')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x1ce700);})[_0x7a64('0x27')](function(_0x77b1e1){_0x358916[_0x7a64('0x45')]=_0x77b1e1;return _0x358916;})[_0x7a64('0x27')](respondWithFilteredResult(_0x4e4136,_0x1ce700))[_0x7a64('0x46')](handleError(_0x4e4136,null));};exports[_0x7a64('0x47')]=function(_0x1519a6,_0x306827){var _0x3f0766={'raw':!![],'where':{'id':_0x1519a6[_0x7a64('0x48')]['id']}},_0x5426f1={};_0x5426f1[_0x7a64('0x35')]=_[_0x7a64('0x32')](db[_0x7a64('0x2e')][_0x7a64('0x49')]);_0x5426f1[_0x7a64('0x31')]=_[_0x7a64('0x32')](_0x1519a6[_0x7a64('0x31')]);_0x5426f1['filters']=_[_0x7a64('0x34')](_0x5426f1[_0x7a64('0x35')],_0x5426f1[_0x7a64('0x31')]);_0x3f0766[_0x7a64('0x37')]=_['intersection'](_0x5426f1[_0x7a64('0x35')],qs[_0x7a64('0x36')](_0x1519a6[_0x7a64('0x31')][_0x7a64('0x36')]));_0x3f0766[_0x7a64('0x37')]=_0x3f0766[_0x7a64('0x37')][_0x7a64('0x38')]?_0x3f0766[_0x7a64('0x37')]:_0x5426f1[_0x7a64('0x35')];if(_0x1519a6['query'][_0x7a64('0x43')]){_0x3f0766[_0x7a64('0x44')]=[{'all':!![]}];}_0x3f0766=_[_0x7a64('0x40')]({},_0x3f0766,_0x1519a6[_0x7a64('0x41')]);return db[_0x7a64('0x2e')]['find'](_0x3f0766)[_0x7a64('0x27')](handleEntityNotFound(_0x306827,null))[_0x7a64('0x27')](respondWithResult(_0x306827,null))[_0x7a64('0x46')](handleError(_0x306827,null));};exports[_0x7a64('0x4a')]=function(_0x7d9d89,_0x2b3148){return db[_0x7a64('0x2e')]['create'](_0x7d9d89['body'],{})[_0x7a64('0x27')](respondWithResult(_0x2b3148,0xc9))['catch'](handleError(_0x2b3148,null));};exports[_0x7a64('0x26')]=function(_0x4eaa4f,_0x24b932){if(_0x4eaa4f['body']['id']){delete _0x4eaa4f[_0x7a64('0x4b')]['id'];}return db[_0x7a64('0x2e')][_0x7a64('0x4c')]({'where':{'id':_0x4eaa4f[_0x7a64('0x48')]['id']}})[_0x7a64('0x27')](handleEntityNotFound(_0x24b932,null))[_0x7a64('0x27')](saveUpdates(_0x4eaa4f['body'],null))[_0x7a64('0x27')](respondWithResult(_0x24b932,null))[_0x7a64('0x46')](handleError(_0x24b932,null));};exports[_0x7a64('0x28')]=function(_0x2dbd81,_0xfa8bfe){return db[_0x7a64('0x2e')][_0x7a64('0x4c')]({'where':{'id':_0x2dbd81[_0x7a64('0x48')]['id']}})['then'](handleEntityNotFound(_0xfa8bfe,null))[_0x7a64('0x27')](removeEntity(_0xfa8bfe,null))['catch'](handleError(_0xfa8bfe,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 35f71d6..42474e9 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 _0xe86e=['FieldId','api','request-promise','rimraf','../../config/environment','exports','define','DeskField'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0xe86e,0x159));var _0xee86=function(_0x4f43d4,_0x5c3af2){_0x4f43d4=_0x4f43d4-0x0;var _0x363e9c=_0xe86e[_0x4f43d4];return _0x363e9c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xee86('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xee86('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee86('0x2'));var config=require(_0xee86('0x3'));var attributes=require('./intDeskField.attributes');module[_0xee86('0x4')]=function(_0x201641,_0x1851d1){return _0x201641[_0xee86('0x5')](_0xee86('0x6'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0xee86('0x7')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeab2=['moment','request-promise','path','rimraf','../../config/environment','exports','DeskField','int_desk_fields','FieldId','util','../../config/logger','api'];(function(_0x241c0c,_0x526b8d){var _0x57e443=function(_0x3ad044){while(--_0x3ad044){_0x241c0c['push'](_0x241c0c['shift']());}};_0x57e443(++_0x526b8d);}(_0xeab2,0x189));var _0x2eab=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0xeab2[_0x307086];return _0x699043;};'use strict';var _=require('lodash');var util=require(_0x2eab('0x0'));var logger=require(_0x2eab('0x1'))(_0x2eab('0x2'));var moment=require(_0x2eab('0x3'));var BPromise=require('bluebird');var rp=require(_0x2eab('0x4'));var fs=require('fs');var path=require(_0x2eab('0x5'));var rimraf=require(_0x2eab('0x6'));var config=require(_0x2eab('0x7'));var attributes=require('./intDeskField.attributes');module[_0x2eab('0x8')]=function(_0x5542f5,_0x15783e){return _0x5542f5['define'](_0x2eab('0x9'),attributes,{'tableName':_0x2eab('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0x2eab('0xb')],'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 887251c..fd720ed 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 _0x7987=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result'];(function(_0x2f92d5,_0x1ad1a9){var _0x509020=function(_0x4c12bd){while(--_0x4c12bd){_0x2f92d5['push'](_0x2f92d5['shift']());}};_0x509020(++_0x1ad1a9);}(_0x7987,0x1e5));var _0x7798=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0x7987[_0x5db657];return _0x2d6e70;};'use strict';var _=require(_0x7798('0x0'));var util=require(_0x7798('0x1'));var moment=require(_0x7798('0x2'));var BPromise=require(_0x7798('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7798('0x4'));var db=require(_0x7798('0x5'))['db'];var utils=require(_0x7798('0x6'));var logger=require(_0x7798('0x7'))('rpc');var config=require(_0x7798('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7798('0x9')][_0x7798('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11e616,_0x8acdb2,_0xd033f8){return new BPromise(function(_0x3b10ca,_0x1a5428){return client['request'](_0x11e616,_0xd033f8)[_0x7798('0xb')](function(_0x3b41b9){logger['info'](_0x7798('0xc'),_0x8acdb2,'request\x20sent');logger[_0x7798('0xd')](_0x7798('0xe'),_0x8acdb2,_0x7798('0xf'),JSON[_0x7798('0x10')](_0x3b41b9));if(_0x3b41b9[_0x7798('0x11')]){if(_0x3b41b9['error']['code']===0x1f4){logger[_0x7798('0x11')]('DeskField,\x20%s,\x20%s',_0x8acdb2,_0x3b41b9[_0x7798('0x11')]['message']);return _0x1a5428(_0x3b41b9['error']['message']);}logger[_0x7798('0x11')](_0x7798('0xc'),_0x8acdb2,_0x3b41b9[_0x7798('0x11')][_0x7798('0x12')]);return _0x3b10ca(_0x3b41b9[_0x7798('0x11')][_0x7798('0x12')]);}else{logger[_0x7798('0x13')](_0x7798('0xc'),_0x8acdb2,'request\x20sent');_0x3b10ca(_0x3b41b9[_0x7798('0x14')][_0x7798('0x12')]);}})[_0x7798('0x15')](function(_0x4f483a){logger[_0x7798('0x11')](_0x7798('0xc'),_0x8acdb2,_0x4f483a);_0x1a5428(_0x4f483a);});});} \ No newline at end of file +var _0x32fd=['info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0xf67ee3,_0x415841){var _0xa82064=function(_0x6eae6){while(--_0x6eae6){_0xf67ee3['push'](_0xf67ee3['shift']());}};_0xa82064(++_0x415841);}(_0x32fd,0x1a7));var _0xd32f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x32fd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd32f('0x0'));var util=require(_0xd32f('0x1'));var moment=require(_0xd32f('0x2'));var BPromise=require(_0xd32f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd32f('0x4'));var db=require(_0xd32f('0x5'))['db'];var utils=require(_0xd32f('0x6'));var logger=require(_0xd32f('0x7'))(_0xd32f('0x8'));var config=require('../../config/environment');var jayson=require(_0xd32f('0x9'));var client=jayson[_0xd32f('0xa')][_0xd32f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16d8f9,_0x11f57f,_0x39d099){return new BPromise(function(_0x321ac1,_0x1742fd){return client[_0xd32f('0xc')](_0x16d8f9,_0x39d099)[_0xd32f('0xd')](function(_0x1cc9d7){logger[_0xd32f('0xe')](_0xd32f('0xf'),_0x11f57f,'request\x20sent');logger[_0xd32f('0x10')](_0xd32f('0x11'),_0x11f57f,'request\x20sent',JSON[_0xd32f('0x12')](_0x1cc9d7));if(_0x1cc9d7[_0xd32f('0x13')]){if(_0x1cc9d7[_0xd32f('0x13')]['code']===0x1f4){logger[_0xd32f('0x13')](_0xd32f('0xf'),_0x11f57f,_0x1cc9d7[_0xd32f('0x13')]['message']);return _0x1742fd(_0x1cc9d7[_0xd32f('0x13')]['message']);}logger[_0xd32f('0x13')](_0xd32f('0xf'),_0x11f57f,_0x1cc9d7[_0xd32f('0x13')][_0xd32f('0x14')]);return _0x321ac1(_0x1cc9d7[_0xd32f('0x13')][_0xd32f('0x14')]);}else{logger['info'](_0xd32f('0xf'),_0x11f57f,_0xd32f('0x15'));_0x321ac1(_0x1cc9d7['result'][_0xd32f('0x14')]);}})[_0xd32f('0x16')](function(_0x4e85da){logger[_0xd32f('0x13')](_0xd32f('0xf'),_0x11f57f,_0x4e85da);_0x1742fd(_0x4e85da);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 695713b..0ea63d3 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 _0x0a11=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','index','get','isAuthenticated','show','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0x0a11,0x74));var _0x10a1=function(_0x143cc6,_0xf94536){_0x143cc6=_0x143cc6-0x0;var _0x2cedba=_0x0a11[_0x143cc6];return _0x2cedba;};'use strict';var multer=require(_0x10a1('0x0'));var util=require('util');var path=require(_0x10a1('0x1'));var timeout=require(_0x10a1('0x2'));var express=require(_0x10a1('0x3'));var router=express[_0x10a1('0x4')]();var fs_extra=require(_0x10a1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x10a1('0x6'));var config=require(_0x10a1('0x7'));var controller=require(_0x10a1('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x10a1('0x9')]);router[_0x10a1('0xa')]('/:id',auth[_0x10a1('0xb')](),controller[_0x10a1('0xc')]);router[_0x10a1('0xa')]('/:id/configurations',auth[_0x10a1('0xb')](),controller['getConfigurations']);router[_0x10a1('0xa')](_0x10a1('0xd'),auth[_0x10a1('0xb')](),controller[_0x10a1('0xe')]);router[_0x10a1('0xf')]('/',auth['isAuthenticated'](),controller[_0x10a1('0x10')]);router[_0x10a1('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x10a1('0x11')]);router[_0x10a1('0x12')](_0x10a1('0x13'),auth[_0x10a1('0xb')](),controller[_0x10a1('0x14')]);router[_0x10a1('0x15')](_0x10a1('0x13'),auth[_0x10a1('0xb')](),controller[_0x10a1('0x16')]);module[_0x10a1('0x17')]=router; \ No newline at end of file +var _0x687e=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0xf6c0a3,_0x5deb2d){var _0x400b8b=function(_0xbb63fa){while(--_0xbb63fa){_0xf6c0a3['push'](_0xf6c0a3['shift']());}};_0x400b8b(++_0x5deb2d);}(_0x687e,0x1ee));var _0xe687=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x687e[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xe687('0x0'));var util=require('util');var path=require(_0xe687('0x1'));var timeout=require('connect-timeout');var express=require(_0xe687('0x2'));var router=express[_0xe687('0x3')]();var fs_extra=require(_0xe687('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe687('0x5'));var config=require(_0xe687('0x6'));var controller=require(_0xe687('0x7'));router[_0xe687('0x8')]('/',auth[_0xe687('0x9')](),controller[_0xe687('0xa')]);router[_0xe687('0x8')](_0xe687('0xb'),auth['isAuthenticated'](),controller[_0xe687('0xc')]);router['get'](_0xe687('0xd'),auth[_0xe687('0x9')](),controller[_0xe687('0xe')]);router['get'](_0xe687('0xf'),auth[_0xe687('0x9')](),controller[_0xe687('0x10')]);router[_0xe687('0x11')]('/',auth[_0xe687('0x9')](),controller[_0xe687('0x12')]);router[_0xe687('0x11')](_0xe687('0xd'),auth['isAuthenticated'](),controller[_0xe687('0x13')]);router[_0xe687('0x14')](_0xe687('0xb'),auth[_0xe687('0x9')](),controller[_0xe687('0x15')]);router[_0xe687('0x16')]('/:id',auth[_0xe687('0x9')](),controller[_0xe687('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 77fe8d4..00b11e0 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 _0x5e0a=['exports','STRING','sequelize'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x5e0a,0x16a));var _0xa5e0=function(_0x59754a,_0x2c7eeb){_0x59754a=_0x59754a-0x0;var _0x5171f6=_0x5e0a[_0x59754a];return _0x5171f6;};'use strict';var Sequelize=require(_0xa5e0('0x0'));module[_0xa5e0('0x1')]={'name':{'type':Sequelize[_0xa5e0('0x2')]},'username':{'type':Sequelize[_0xa5e0('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa5e0('0x2')]},'tenantId':{'type':Sequelize[_0xa5e0('0x2')]},'clientId':{'type':Sequelize[_0xa5e0('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa5e0('0x2')]}}; \ No newline at end of file +var _0x7292=['exports','STRING','sequelize'];(function(_0x573836,_0x599996){var _0x3d9709=function(_0x5b9e90){while(--_0x5b9e90){_0x573836['push'](_0x573836['shift']());}};_0x3d9709(++_0x599996);}(_0x7292,0x107));var _0x2729=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x7292[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require(_0x2729('0x0'));module[_0x2729('0x1')]={'name':{'type':Sequelize[_0x2729('0x2')]},'username':{'type':Sequelize[_0x2729('0x2')]},'password':{'type':Sequelize[_0x2729('0x2')]},'remoteUri':{'type':Sequelize[_0x2729('0x2')]},'tenantId':{'type':Sequelize[_0x2729('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x2729('0x2')]},'serverUrl':{'type':Sequelize[_0x2729('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2729('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 7f64ccf..3a09505 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 _0x97d5=[')/Microsoft.Dynamics.CRM.','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','Dynamics365Account','fieldName','type','model','keys','filters','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','then','create','body','getConfigurations','findOne','options','addConfiguration','channel','Descriptions','getDescriptions','Dynamics365Field','Subjects','ticketType','incident','Incident','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','clientSecret','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','push','MetadataId','all','isNil','substring','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','false'];(function(_0x5dc0ed,_0x5c98b4){var _0x54eeab=function(_0x5b7f13){while(--_0x5b7f13){_0x5dc0ed['push'](_0x5dc0ed['shift']());}};_0x54eeab(++_0x5c98b4);}(_0x97d5,0x199));var _0x597d=function(_0x163d57,_0x12852d){_0x163d57=_0x163d57-0x0;var _0x228d41=_0x97d5[_0x163d57];return _0x228d41;};'use strict';var emlformat=require(_0x597d('0x0'));var rimraf=require(_0x597d('0x1'));var zipdir=require(_0x597d('0x2'));var jsonpatch=require(_0x597d('0x3'));var rp=require(_0x597d('0x4'));var moment=require(_0x597d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x597d('0x6'));var util=require(_0x597d('0x7'));var path=require(_0x597d('0x8'));var sox=require('sox');var csv=require(_0x597d('0x9'));var ejs=require(_0x597d('0xa'));var fs=require('fs');var fs_extra=require(_0x597d('0xb'));var _=require(_0x597d('0xc'));var squel=require(_0x597d('0xd'));var crypto=require(_0x597d('0xe'));var jsforce=require(_0x597d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x597d('0x9'));var querystring=require(_0x597d('0x10'));var Papa=require('papaparse');var Redis=require(_0x597d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x597d('0x12'));var as=require(_0x597d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x597d('0x14'));var utils=require(_0x597d('0x15'));var config=require(_0x597d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x597d('0x17'))['db'];var integrations=require(_0x597d('0x18'));function respondWithStatusCode(_0x355fbd,_0x1664e5){_0x1664e5=_0x1664e5||0xcc;return function(_0x517e34){if(_0x517e34){return _0x355fbd[_0x597d('0x19')](_0x1664e5);}return _0x355fbd[_0x597d('0x1a')](_0x1664e5)[_0x597d('0x1b')]();};}function respondWithResult(_0x810dce,_0x11147c){_0x11147c=_0x11147c||0xc8;return function(_0x35850d){if(_0x35850d){return _0x810dce[_0x597d('0x1a')](_0x11147c)[_0x597d('0x1c')](_0x35850d);}};}function respondWithFilteredResult(_0x394d1d,_0x4ca1b1){return function(_0x17b021){if(_0x17b021){var _0x487246=typeof _0x4ca1b1[_0x597d('0x1d')]===_0x597d('0x1e')&&typeof _0x4ca1b1['limit']===_0x597d('0x1e');var _0x52c211=_0x17b021[_0x597d('0x1f')];var _0x1662ec=_0x487246?0x0:_0x4ca1b1['offset'];var _0x5b1e89=_0x487246?_0x17b021['count']:_0x4ca1b1[_0x597d('0x1d')]+_0x4ca1b1[_0x597d('0x20')];var _0x150ee2;if(_0x5b1e89>=_0x52c211){_0x5b1e89=_0x52c211;_0x150ee2=0xc8;}else{_0x150ee2=0xce;}_0x394d1d[_0x597d('0x1a')](_0x150ee2);return _0x394d1d[_0x597d('0x21')](_0x597d('0x22'),_0x1662ec+'-'+_0x5b1e89+'/'+_0x52c211)[_0x597d('0x1c')](_0x17b021);}return null;};}function patchUpdates(_0x1f8966){return function(_0x438a61){try{jsonpatch[_0x597d('0x23')](_0x438a61,_0x1f8966,!![]);}catch(_0x53e7ab){return BPromise[_0x597d('0x24')](_0x53e7ab);}return _0x438a61[_0x597d('0x25')]();};}function saveUpdates(_0x639ac,_0x2d4e7b){return function(_0xeff3c2){if(_0xeff3c2){return _0xeff3c2[_0x597d('0x26')](_0x639ac)['then'](function(_0xc6ca7){return _0xc6ca7;});}return null;};}function removeEntity(_0xa0a6da,_0x104476){return function(_0x4324da){if(_0x4324da){return _0x4324da[_0x597d('0x27')]()['then'](function(){_0xa0a6da[_0x597d('0x1a')](0xcc)[_0x597d('0x1b')]();});}};}function handleEntityNotFound(_0x1379a2,_0x5a551f){return function(_0xcbc4a7){if(!_0xcbc4a7){_0x1379a2[_0x597d('0x19')](0x194);}return _0xcbc4a7;};}function handleError(_0x30d783,_0x6f424f){_0x6f424f=_0x6f424f||0x1f4;return function(_0xd552f2){logger[_0x597d('0x28')](_0xd552f2[_0x597d('0x29')]);if(_0xd552f2[_0x597d('0x2a')]){delete _0xd552f2[_0x597d('0x2a')];}_0x30d783[_0x597d('0x1a')](_0x6f424f)[_0x597d('0x2b')](_0xd552f2);};}exports[_0x597d('0x2c')]=function(_0x25ffc6,_0x2fcb0d){var _0x106b92={},_0x1cd733={},_0x3f928f={'count':0x0,'rows':[]};var _0x4bd607=_[_0x597d('0x2d')](db[_0x597d('0x2e')]['rawAttributes'],function(_0x59eb1c){return{'name':_0x59eb1c[_0x597d('0x2f')],'type':_0x59eb1c[_0x597d('0x30')]['key']};});_0x1cd733[_0x597d('0x31')]=_[_0x597d('0x2d')](_0x4bd607,_0x597d('0x2a'));_0x1cd733['query']=_[_0x597d('0x32')](_0x25ffc6['query']);_0x1cd733[_0x597d('0x33')]=_['intersection'](_0x1cd733['model'],_0x1cd733['query']);_0x106b92['attributes']=_['intersection'](_0x1cd733[_0x597d('0x31')],qs[_0x597d('0x34')](_0x25ffc6[_0x597d('0x35')][_0x597d('0x34')]));_0x106b92[_0x597d('0x36')]=_0x106b92[_0x597d('0x36')][_0x597d('0x37')]?_0x106b92[_0x597d('0x36')]:_0x1cd733['model'];if(!_0x25ffc6[_0x597d('0x35')][_0x597d('0x38')](_0x597d('0x39'))){_0x106b92[_0x597d('0x20')]=qs['limit'](_0x25ffc6[_0x597d('0x35')][_0x597d('0x20')]);_0x106b92[_0x597d('0x1d')]=qs[_0x597d('0x1d')](_0x25ffc6[_0x597d('0x35')][_0x597d('0x1d')]);}_0x106b92[_0x597d('0x3a')]=qs[_0x597d('0x3b')](_0x25ffc6[_0x597d('0x35')][_0x597d('0x3b')]);_0x106b92[_0x597d('0x3c')]=qs[_0x597d('0x33')](_[_0x597d('0x3d')](_0x25ffc6[_0x597d('0x35')],_0x1cd733[_0x597d('0x33')]),_0x4bd607);if(_0x25ffc6[_0x597d('0x35')][_0x597d('0x3e')]){_0x106b92[_0x597d('0x3c')]=_[_0x597d('0x3f')](_0x106b92[_0x597d('0x3c')],{'$or':_['map'](_0x4bd607,function(_0x5c4357){if(_0x5c4357[_0x597d('0x30')]!=='VIRTUAL'){var _0x467169={};_0x467169[_0x5c4357[_0x597d('0x2a')]]={'$like':'%'+_0x25ffc6['query']['filter']+'%'};return _0x467169;}})});}_0x106b92=_[_0x597d('0x3f')]({},_0x106b92,_0x25ffc6['options']);var _0x3dd45e={'where':_0x106b92[_0x597d('0x3c')]};return db[_0x597d('0x2e')][_0x597d('0x1f')](_0x3dd45e)['then'](function(_0x419079){_0x3f928f[_0x597d('0x1f')]=_0x419079;if(_0x25ffc6[_0x597d('0x35')][_0x597d('0x40')]){_0x106b92[_0x597d('0x41')]=[{'all':!![]}];}return db[_0x597d('0x2e')][_0x597d('0x42')](_0x106b92);})['then'](function(_0x2cd4e0){_0x3f928f[_0x597d('0x43')]=_0x2cd4e0;return _0x3f928f;})['then'](respondWithFilteredResult(_0x2fcb0d,_0x106b92))[_0x597d('0x44')](handleError(_0x2fcb0d,null));};exports[_0x597d('0x45')]=function(_0x1fe4ba,_0x1de5d7){var _0x90f83a={'raw':![],'where':{'id':_0x1fe4ba[_0x597d('0x46')]['id']}},_0x34b518={};_0x34b518[_0x597d('0x31')]=_[_0x597d('0x32')](db[_0x597d('0x2e')][_0x597d('0x47')]);_0x34b518[_0x597d('0x35')]=_[_0x597d('0x32')](_0x1fe4ba[_0x597d('0x35')]);_0x34b518['filters']=_['intersection'](_0x34b518[_0x597d('0x31')],_0x34b518['query']);_0x90f83a[_0x597d('0x36')]=_[_0x597d('0x48')](_0x34b518[_0x597d('0x31')],qs[_0x597d('0x34')](_0x1fe4ba[_0x597d('0x35')][_0x597d('0x34')]));_0x90f83a['attributes']=_0x90f83a[_0x597d('0x36')]['length']?_0x90f83a[_0x597d('0x36')]:_0x34b518[_0x597d('0x31')];if(_0x1fe4ba['query']['includeAll']){_0x90f83a[_0x597d('0x41')]=[{'all':!![]}];}_0x90f83a=_[_0x597d('0x3f')]({},_0x90f83a,_0x1fe4ba['options']);return db[_0x597d('0x2e')][_0x597d('0x49')](_0x90f83a)[_0x597d('0x4a')](handleEntityNotFound(_0x1de5d7,null))['then'](respondWithResult(_0x1de5d7,null))[_0x597d('0x44')](handleError(_0x1de5d7,null));};exports[_0x597d('0x4b')]=function(_0x243090,_0x37b46d){return db[_0x597d('0x2e')]['create'](_0x243090[_0x597d('0x4c')],{})[_0x597d('0x4a')](respondWithResult(_0x37b46d,0xc9))[_0x597d('0x44')](handleError(_0x37b46d,null));};exports[_0x597d('0x26')]=function(_0x18b043,_0x2cd5bf){if(_0x18b043['body']['id']){delete _0x18b043[_0x597d('0x4c')]['id'];}return db[_0x597d('0x2e')][_0x597d('0x49')]({'where':{'id':_0x18b043[_0x597d('0x46')]['id']}})['then'](handleEntityNotFound(_0x2cd5bf,null))[_0x597d('0x4a')](saveUpdates(_0x18b043[_0x597d('0x4c')],null))[_0x597d('0x4a')](respondWithResult(_0x2cd5bf,null))[_0x597d('0x44')](handleError(_0x2cd5bf,null));};exports[_0x597d('0x27')]=function(_0x3d8368,_0x59e284){return db[_0x597d('0x2e')][_0x597d('0x49')]({'where':{'id':_0x3d8368[_0x597d('0x46')]['id']}})[_0x597d('0x4a')](handleEntityNotFound(_0x59e284,null))[_0x597d('0x4a')](removeEntity(_0x59e284,null))[_0x597d('0x44')](handleError(_0x59e284,null));};exports[_0x597d('0x4d')]=function(_0x42e76f,_0x93c010,_0x5620f5){var _0x22fc7d={};var _0x432953={};var _0x1eacdd;var _0x55fedb;return db['Dynamics365Account'][_0x597d('0x4e')]({'where':{'id':_0x42e76f['params']['id']}})[_0x597d('0x4a')](handleEntityNotFound(_0x93c010,null))[_0x597d('0x4a')](function(_0x173a3b){if(_0x173a3b){_0x1eacdd=_0x173a3b;_0x432953['model']=_[_0x597d('0x32')](db['Dynamics365Configuration'][_0x597d('0x47')]);_0x432953[_0x597d('0x35')]=_[_0x597d('0x32')](_0x42e76f[_0x597d('0x35')]);_0x432953[_0x597d('0x33')]=_['intersection'](_0x432953[_0x597d('0x31')],_0x432953['query']);_0x22fc7d[_0x597d('0x36')]=_['intersection'](_0x432953[_0x597d('0x31')],qs[_0x597d('0x34')](_0x42e76f[_0x597d('0x35')]['fields']));_0x22fc7d[_0x597d('0x36')]=_0x22fc7d[_0x597d('0x36')][_0x597d('0x37')]?_0x22fc7d['attributes']:_0x432953[_0x597d('0x31')];_0x22fc7d[_0x597d('0x3a')]=qs[_0x597d('0x3b')](_0x42e76f[_0x597d('0x35')][_0x597d('0x3b')]);_0x22fc7d['where']=qs['filters'](_[_0x597d('0x3d')](_0x42e76f[_0x597d('0x35')],_0x432953['filters']));if(_0x42e76f[_0x597d('0x35')][_0x597d('0x3e')]){_0x22fc7d[_0x597d('0x3c')]=_[_0x597d('0x3f')](_0x22fc7d[_0x597d('0x3c')],{'$or':_[_0x597d('0x2d')](_0x22fc7d[_0x597d('0x36')],function(_0x3e2ec8){var _0x1dd9ab={};_0x1dd9ab[_0x3e2ec8]={'$like':'%'+_0x42e76f['query'][_0x597d('0x3e')]+'%'};return _0x1dd9ab;})});}_0x22fc7d=_[_0x597d('0x3f')]({},_0x22fc7d,_0x42e76f[_0x597d('0x4f')]);return _0x1eacdd['getConfigurations'](_0x22fc7d);}})[_0x597d('0x4a')](function(_0x4594bc){if(_0x4594bc){_0x55fedb=_0x4594bc['length'];if(!_0x42e76f[_0x597d('0x35')]['hasOwnProperty'](_0x597d('0x39'))){_0x22fc7d[_0x597d('0x20')]=qs[_0x597d('0x20')](_0x42e76f[_0x597d('0x35')][_0x597d('0x20')]);_0x22fc7d[_0x597d('0x1d')]=qs[_0x597d('0x1d')](_0x42e76f[_0x597d('0x35')][_0x597d('0x1d')]);}return _0x1eacdd[_0x597d('0x4d')](_0x22fc7d);}})[_0x597d('0x4a')](function(_0x455813){if(_0x455813){return _0x455813?{'count':_0x55fedb,'rows':_0x455813}:null;}})[_0x597d('0x4a')](respondWithResult(_0x93c010,null))[_0x597d('0x44')](handleError(_0x93c010,null));};exports[_0x597d('0x50')]=function(_0x53971d,_0x535719,_0x496765){if(_0x53971d[_0x597d('0x4c')]['id']){delete _0x53971d[_0x597d('0x4c')]['id'];}return db['Dynamics365Account'][_0x597d('0x4e')]({'where':{'id':_0x53971d['params']['id']}})[_0x597d('0x4a')](handleEntityNotFound(_0x535719,null))[_0x597d('0x4a')](function(_0x3fad43){if(_0x3fad43){_0x53971d[_0x597d('0x4c')]['AccountId']=_0x3fad43['id'];_0x53971d[_0x597d('0x4c')]['Subjects']=integrations['getSubjects'](_0x53971d[_0x597d('0x4c')][_0x597d('0x51')],_0x53971d[_0x597d('0x4c')][_0x597d('0x30')]);_0x53971d[_0x597d('0x4c')][_0x597d('0x52')]=integrations[_0x597d('0x53')](_0x53971d[_0x597d('0x4c')]['channel'],_0x53971d[_0x597d('0x4c')][_0x597d('0x30')]);return db['Dynamics365Configuration'][_0x597d('0x4b')](_0x53971d['body'],{'include':[{'model':db[_0x597d('0x54')],'as':_0x597d('0x55')},{'model':db[_0x597d('0x54')],'as':_0x597d('0x52')}]});}return null;})[_0x597d('0x4a')](respondWithResult(_0x535719,null))[_0x597d('0x44')](handleError(_0x535719,null));};exports['getFields']=function(_0x1ab7e9,_0x1a6d44,_0x5dbd8e){var _0x37a02e=_0x1ab7e9[_0x597d('0x35')][_0x597d('0x56')];var _0x1ef698=_0x37a02e===_0x597d('0x57')?_0x597d('0x58'):'PhoneCall';var _0x257643='';var _0x5a328d='';var _0x4a1c20='';var _0x4164c6='';var _0x3054a0='';var _0x1e4c39='';var _0x4c50d0='';var _0x62692c='';var _0x99da9c=['title','description',_0x597d('0x59'),_0x597d('0x5a'),_0x597d('0x5b'),_0x597d('0x5c'),_0x597d('0x5d'),_0x597d('0x5e'),_0x597d('0x5f'),'phonecall_activity_parties'];var _0x134a1b=[_0x597d('0x60'),_0x597d('0x61'),_0x597d('0x62'),_0x597d('0x63'),_0x597d('0x64'),_0x597d('0x65'),_0x597d('0x66'),_0x597d('0x67'),_0x597d('0x68'),_0x597d('0x69'),_0x597d('0x6a'),'createdbyyominame',_0x597d('0x6b'),'createdonbehalfbyname',_0x597d('0x6c'),_0x597d('0x6d'),_0x597d('0x6e'),_0x597d('0x6f'),'emailaddress',_0x597d('0x70'),_0x597d('0x71'),_0x597d('0x72'),'escalatedon',_0x597d('0x73'),_0x597d('0x74'),_0x597d('0x75'),_0x597d('0x76'),_0x597d('0x77'),_0x597d('0x78'),_0x597d('0x79'),_0x597d('0x7a'),_0x597d('0x7b'),_0x597d('0x7c'),_0x597d('0x7d'),_0x597d('0x7e'),'modifiedon','modifiedonbehalfbyname',_0x597d('0x7f'),_0x597d('0x80'),'msdyn_iotalertname',_0x597d('0x81'),_0x597d('0x82'),_0x597d('0x83'),_0x597d('0x84'),_0x597d('0x85'),_0x597d('0x86'),_0x597d('0x87'),_0x597d('0x88'),_0x597d('0x89'),_0x597d('0x8a'),'productidname',_0x597d('0x8b'),'resolveby',_0x597d('0x8c'),_0x597d('0x8d'),_0x597d('0x8e'),_0x597d('0x8f'),_0x597d('0x90'),'slainvokedidname',_0x597d('0x91'),_0x597d('0x92'),'statecode','statuscode','subjectidname',_0x597d('0x93'),_0x597d('0x94'),_0x597d('0x95'),_0x597d('0x96'),_0x597d('0x97'),'versionnumber'];var _0x15651a=_0x99da9c[_0x597d('0x98')](_0x134a1b);return db['Dynamics365Account']['findOne']({'where':{'id':_0x1ab7e9[_0x597d('0x46')]['id']},'attributes':['id',_0x597d('0x99'),_0x597d('0x9a'),_0x597d('0x9b'),_0x597d('0x9c'),_0x597d('0x9d'),_0x597d('0x9e')]})[_0x597d('0x4a')](handleEntityNotFound(_0x1a6d44,null))[_0x597d('0x4a')](function(_0x1d162e){if(_0x1d162e){_0x62692c=_0x1d162e['remoteUri'];var _0x36c8be=_0x62692c[_0x597d('0x9f')](-0x1);if(_0x36c8be==='/'){_0x62692c=_0x62692c['substring'](0x0,_0x62692c[_0x597d('0xa0')](_0x36c8be));}_0x4c50d0=util[_0x597d('0xa1')](_0x597d('0xa2'),_0x62692c);var _0x225c80={'method':_0x597d('0xa3'),'uri':_0x597d('0xa4')+_0x1d162e[_0x597d('0x9c')]+_0x597d('0xa5'),'form':{'client_id':_0x1d162e[_0x597d('0x9d')],'resource':_0x62692c,'username':_0x1d162e[_0x597d('0x99')],'password':_0x1d162e[_0x597d('0x9a')],'grant_type':_0x597d('0x9a'),'client_secret':_0x1d162e[_0x597d('0x9e')]},'json':!![]};return rp(_0x225c80);}})[_0x597d('0x4a')](function(_0x483250){_0x1e4c39=_0x483250[_0x597d('0xa6')];var _0x4419a0={'method':_0x597d('0xa7'),'uri':encodeURI(_0x4c50d0+_0x597d('0xa8')+_0x1ef698+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1e4c39,'If-None-Match':null,'OData-Version':_0x597d('0xa9')},'json':!![]};return rp(_0x4419a0);})[_0x597d('0x4a')](function(_0x1cdfb4){var _0x525f28=_0x1cdfb4['value'][0x0];var _0x2325b5=_0x525f28['MetadataId'];var _0x4e6364={'method':'GET','uri':_0x4c50d0+_0x597d('0xaa')+_0x2325b5+_0x597d('0xab'),'headers':{'Authorization':_0x597d('0xac')+_0x1e4c39,'If-None-Match':null,'OData-Version':_0x597d('0xa9')},'json':!![]};return rp(_0x4e6364);})[_0x597d('0x4a')](function(_0x2fa306){_0x257643=_0x2fa306;_0x5a328d=_0x257643[_0x597d('0xad')];_0x5a328d=_[_0x597d('0xae')](_0x5a328d,function(_0x5244e1){return!_0x15651a[_0x597d('0xaf')](_0x5244e1[_0x597d('0xb0')]);});var _0x48afad=[];var _0x5a4a32=[];_0x5a328d[_0x597d('0xb1')](function(_0x377996){if(_0x377996['@odata.type']){var _0x5a9b51=_0x377996[_0x597d('0xb2')]['substring'](_0x377996['@odata.type'][_0x597d('0xa0')]('.')+0x1);if(_0x5a9b51==='PicklistAttributeMetadata'){_0x48afad[_0x597d('0xb3')](getSelectList(_0x4c50d0,_0x37a02e,_0x5a4a32,_0x257643[_0x597d('0xb4')],_0x377996[_0x597d('0xb4')],_0x1e4c39));}}});return Promise[_0x597d('0xb5')](_0x48afad);})[_0x597d('0x4a')](function(_0x6ec31b){_0x4a1c20=_0x6ec31b[0x0];var _0x4bae54=[];var _0x5c2349=[];_0x5a328d['forEach'](function(_0x83821f){if(!_[_0x597d('0xb6')](_0x83821f[_0x597d('0xb2')])){var _0x2dce4d=_0x83821f[_0x597d('0xb2')]['substring'](_0x83821f[_0x597d('0xb2')][_0x597d('0xa0')]('.')+0x1);if(_0x2dce4d==='BooleanAttributeMetadata'){_0x4bae54[_0x597d('0xb3')](getBooleanList(_0x4c50d0,_0x37a02e,_0x5c2349,_0x257643[_0x597d('0xb4')],_0x83821f['MetadataId'],_0x1e4c39));}}});return Promise['all'](_0x4bae54);})[_0x597d('0x4a')](function(_0x2c5d6c){_0x4164c6=_0x2c5d6c[0x0];var _0x134def=[];var _0x350bd7=[];_0x5a328d[_0x597d('0xb1')](function(_0x10d145){if(_0x10d145[_0x597d('0xb2')]){var _0x551d9b=_0x10d145['@odata.type'][_0x597d('0xb7')](_0x10d145[_0x597d('0xb2')][_0x597d('0xa0')]('.')+0x1);if(_0x551d9b===_0x597d('0xb8')||_0x551d9b===_0x597d('0xb9')||_0x551d9b===_0x597d('0xba')||_0x551d9b===_0x597d('0xbb')||_0x551d9b===_0x597d('0xbc')||_0x551d9b===_0x597d('0xbd')||_0x551d9b===_0x597d('0xbe')||_0x551d9b==='EntityNameAttributeMetadata'||_0x551d9b===_0x597d('0xbf')||_0x551d9b===_0x597d('0xc0')){_0x134def[_0x597d('0xb3')](getInputList(_0x4c50d0,_0x37a02e,_0x551d9b,_0x350bd7,_0x257643[_0x597d('0xb4')],_0x10d145[_0x597d('0xb4')],_0x1e4c39));}}});return Promise[_0x597d('0xb5')](_0x134def);})[_0x597d('0x4a')](function(_0x57cc10){_0x3054a0=_0x57cc10[0x0];var _0xb358fd=_0x4a1c20[_0x597d('0x98')](_0x4164c6)[_0x597d('0x98')](_0x3054a0);var _0x2795e4={'count':_0xb358fd[_0x597d('0x37')],'rows':_0xb358fd};return _0x2795e4;})[_0x597d('0x4a')](respondWithResult(_0x1a6d44,null))[_0x597d('0x44')](function(_0x33220f){var _0x2114a4=_0x1ab7e9['query']['test']?0x1f4:_0x33220f[_0x597d('0xc1')]||0x1f4;logger[_0x597d('0x28')](_0x33220f[_0x597d('0x29')]);delete _0x33220f[_0x597d('0x2a')];if(_0x2114a4===0x191){_0x2114a4=0x190;}_0x1a6d44[_0x597d('0x1a')](_0x2114a4)[_0x597d('0x2b')](_0x1ab7e9[_0x597d('0x35')]['test']?{'message':_0x597d('0xc2'),'statusCode':_0x33220f['statusCode']}:_0x33220f);});};function getSelectList(_0xf9f253,_0x5c56d3,_0x2a1ce6,_0x400a03,_0x5c7221,_0xf73a9e){var _0x1d3355={'method':_0x597d('0xa7'),'uri':_0xf9f253+'EntityDefinitions('+_0x400a03+_0x597d('0xc3')+_0x5c7221+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x597d('0xc4'),'headers':{'Authorization':_0x597d('0xac')+_0xf73a9e,'If-None-Match':null,'OData-Version':_0x597d('0xa9')},'json':!![]};return rp(_0x1d3355)[_0x597d('0x4a')](function(_0x1b3706){var _0x5e701c=[];var _0xbf3185=_0x1b3706[_0x597d('0xc5')]['Options'];_0xbf3185[_0x597d('0xb1')](function(_0x37097c){_0x5e701c[_0x597d('0xb3')]({'name':_0x37097c[_0x597d('0xc6')][_0x597d('0xc7')]['Label'],'value':String(_0x37097c['Value'])});});var _0x32b562={'id':_0x5c56d3+'_'+_0x1b3706[_0x597d('0xb0')],'name':_0x1b3706[_0x597d('0xc8')]['UserLocalizedLabel'][_0x597d('0xc6')],'custom':![],'options':_0x5e701c};_0x2a1ce6[_0x597d('0xb3')](_0x32b562);return _0x2a1ce6;});}function getBooleanList(_0x202b99,_0x2c6a0d,_0x2dd8f6,_0x3276e7,_0x430039,_0x439084){var _0x3cec5a={'method':'GET','uri':_0x202b99+_0x597d('0xaa')+_0x3276e7+_0x597d('0xc3')+_0x430039+_0x597d('0xc9'),'headers':{'Authorization':'Bearer\x20'+_0x439084,'If-None-Match':null,'OData-Version':_0x597d('0xa9')},'json':!![]};return rp(_0x3cec5a)[_0x597d('0x4a')](function(_0x5ada0f){var _0x4c41a9=[];_0x4c41a9[_0x597d('0xb3')]({'name':_0x5ada0f[_0x597d('0xc5')]['TrueOption']['Label'][_0x597d('0xc7')]['Label'],'value':'true'},{'name':_0x5ada0f[_0x597d('0xc5')]['FalseOption']['Label'][_0x597d('0xc7')][_0x597d('0xc6')],'value':_0x597d('0xca')});var _0x3201b1={'id':_0x2c6a0d+'_'+_0x5ada0f[_0x597d('0xb0')],'name':_0x5ada0f[_0x597d('0xc8')][_0x597d('0xc7')][_0x597d('0xc6')],'custom':![],'options':_0x4c41a9};_0x2dd8f6[_0x597d('0xb3')](_0x3201b1);return _0x2dd8f6;});}function getInputList(_0x385189,_0xe63706,_0x16fb1d,_0x5bf87b,_0x2d5625,_0x15ff27,_0x5bee9e){var _0x22cefa={'method':_0x597d('0xa7'),'uri':_0x385189+_0x597d('0xaa')+_0x2d5625+_0x597d('0xc3')+_0x15ff27+_0x597d('0xcb')+_0x16fb1d+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x5bee9e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x22cefa)[_0x597d('0x4a')](function(_0x5e9fd6){var _0x316bd4={'id':_0xe63706+'_'+_0x5e9fd6['LogicalName'],'name':_0x5e9fd6['DisplayName'][_0x597d('0xc7')]?_0x5e9fd6[_0x597d('0xc8')][_0x597d('0xc7')][_0x597d('0xc6')]:_0x5e9fd6[_0x597d('0xb0')],'custom':![],'options':[]};_0x5bf87b[_0x597d('0xb3')](_0x316bd4);return _0x5bf87b;});} \ No newline at end of file +var _0x815b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','Dynamics365Account','includeAll','include','catch','show','params','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','order','addConfiguration','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','ticketType','customerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','followupby','importsequencenumber','influencescore','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','concat','password','remoteUri','tenantId','clientId','slice','substring','format','%s/api/data/v9.0/','username','clientSecret','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','lastIndexOf','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','test','statusCode','Wrong\x20credentials','GET','OptionSet','Options','Label','UserLocalizedLabel','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','ioredis'];(function(_0x413f0b,_0x217db7){var _0x8d50c5=function(_0x2c37e7){while(--_0x2c37e7){_0x413f0b['push'](_0x413f0b['shift']());}};_0x8d50c5(++_0x217db7);}(_0x815b,0xb4));var _0xb815=function(_0x14dd4e,_0x6b5a38){_0x14dd4e=_0x14dd4e-0x0;var _0x550361=_0x815b[_0x14dd4e];return _0x550361;};'use strict';var emlformat=require(_0xb815('0x0'));var rimraf=require(_0xb815('0x1'));var zipdir=require(_0xb815('0x2'));var jsonpatch=require(_0xb815('0x3'));var rp=require(_0xb815('0x4'));var moment=require('moment');var BPromise=require(_0xb815('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb815('0x6'));var sox=require(_0xb815('0x7'));var csv=require(_0xb815('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb815('0x9'));var _=require(_0xb815('0xa'));var squel=require('squel');var crypto=require(_0xb815('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb815('0x8'));var querystring=require(_0xb815('0xc'));var Papa=require(_0xb815('0xd'));var Redis=require(_0xb815('0xe'));var authService=require(_0xb815('0xf'));var qs=require(_0xb815('0x10'));var as=require(_0xb815('0x11'));var hardwareService=require(_0xb815('0x12'));var logger=require('../../config/logger')(_0xb815('0x13'));var utils=require(_0xb815('0x14'));var config=require(_0xb815('0x15'));var licenseUtil=require(_0xb815('0x16'));var db=require(_0xb815('0x17'))['db'];var integrations=require(_0xb815('0x18'));function respondWithStatusCode(_0x3e5c50,_0x5af22a){_0x5af22a=_0x5af22a||0xcc;return function(_0x5f360b){if(_0x5f360b){return _0x3e5c50[_0xb815('0x19')](_0x5af22a);}return _0x3e5c50[_0xb815('0x1a')](_0x5af22a)[_0xb815('0x1b')]();};}function respondWithResult(_0xff2720,_0x32b50a){_0x32b50a=_0x32b50a||0xc8;return function(_0x1d130f){if(_0x1d130f){return _0xff2720[_0xb815('0x1a')](_0x32b50a)[_0xb815('0x1c')](_0x1d130f);}};}function respondWithFilteredResult(_0x966544,_0xf456ca){return function(_0x3fd87d){if(_0x3fd87d){var _0x4db18b=typeof _0xf456ca[_0xb815('0x1d')]==='undefined'&&typeof _0xf456ca['limit']===_0xb815('0x1e');var _0xfedf2d=_0x3fd87d[_0xb815('0x1f')];var _0x422327=_0x4db18b?0x0:_0xf456ca[_0xb815('0x1d')];var _0x3ddc81=_0x4db18b?_0x3fd87d[_0xb815('0x1f')]:_0xf456ca[_0xb815('0x1d')]+_0xf456ca[_0xb815('0x20')];var _0x587cb7;if(_0x3ddc81>=_0xfedf2d){_0x3ddc81=_0xfedf2d;_0x587cb7=0xc8;}else{_0x587cb7=0xce;}_0x966544['status'](_0x587cb7);return _0x966544[_0xb815('0x21')]('Content-Range',_0x422327+'-'+_0x3ddc81+'/'+_0xfedf2d)[_0xb815('0x1c')](_0x3fd87d);}return null;};}function patchUpdates(_0x1ebe78){return function(_0x1343f8){try{jsonpatch[_0xb815('0x22')](_0x1343f8,_0x1ebe78,!![]);}catch(_0x4a1650){return BPromise[_0xb815('0x23')](_0x4a1650);}return _0x1343f8[_0xb815('0x24')]();};}function saveUpdates(_0x590eff,_0x3f0f44){return function(_0x26e7d9){if(_0x26e7d9){return _0x26e7d9[_0xb815('0x25')](_0x590eff)[_0xb815('0x26')](function(_0x2ecffe){return _0x2ecffe;});}return null;};}function removeEntity(_0x19877b,_0x100113){return function(_0x1f8df1){if(_0x1f8df1){return _0x1f8df1[_0xb815('0x27')]()[_0xb815('0x26')](function(){_0x19877b[_0xb815('0x1a')](0xcc)[_0xb815('0x1b')]();});}};}function handleEntityNotFound(_0x55b714,_0x1a07cc){return function(_0x1ad94c){if(!_0x1ad94c){_0x55b714[_0xb815('0x19')](0x194);}return _0x1ad94c;};}function handleError(_0x33211e,_0x5f2eaf){_0x5f2eaf=_0x5f2eaf||0x1f4;return function(_0x22f594){logger[_0xb815('0x28')](_0x22f594[_0xb815('0x29')]);if(_0x22f594['name']){delete _0x22f594[_0xb815('0x2a')];}_0x33211e[_0xb815('0x1a')](_0x5f2eaf)[_0xb815('0x2b')](_0x22f594);};}exports[_0xb815('0x2c')]=function(_0x2e9199,_0x3b0152){var _0x7e8a20={},_0xd22488={},_0x46c545={'count':0x0,'rows':[]};var _0x4f3277=_['map'](db['Dynamics365Account'][_0xb815('0x2d')],function(_0x209c1c){return{'name':_0x209c1c['fieldName'],'type':_0x209c1c[_0xb815('0x2e')][_0xb815('0x2f')]};});_0xd22488[_0xb815('0x30')]=_[_0xb815('0x31')](_0x4f3277,'name');_0xd22488[_0xb815('0x32')]=_[_0xb815('0x33')](_0x2e9199['query']);_0xd22488['filters']=_[_0xb815('0x34')](_0xd22488['model'],_0xd22488[_0xb815('0x32')]);_0x7e8a20['attributes']=_[_0xb815('0x34')](_0xd22488['model'],qs[_0xb815('0x35')](_0x2e9199[_0xb815('0x32')][_0xb815('0x35')]));_0x7e8a20['attributes']=_0x7e8a20[_0xb815('0x36')][_0xb815('0x37')]?_0x7e8a20['attributes']:_0xd22488[_0xb815('0x30')];if(!_0x2e9199[_0xb815('0x32')][_0xb815('0x38')](_0xb815('0x39'))){_0x7e8a20[_0xb815('0x20')]=qs[_0xb815('0x20')](_0x2e9199['query'][_0xb815('0x20')]);_0x7e8a20[_0xb815('0x1d')]=qs[_0xb815('0x1d')](_0x2e9199[_0xb815('0x32')][_0xb815('0x1d')]);}_0x7e8a20['order']=qs['sort'](_0x2e9199['query'][_0xb815('0x3a')]);_0x7e8a20['where']=qs[_0xb815('0x3b')](_[_0xb815('0x3c')](_0x2e9199[_0xb815('0x32')],_0xd22488[_0xb815('0x3b')]),_0x4f3277);if(_0x2e9199[_0xb815('0x32')][_0xb815('0x3d')]){_0x7e8a20[_0xb815('0x3e')]=_[_0xb815('0x3f')](_0x7e8a20[_0xb815('0x3e')],{'$or':_[_0xb815('0x31')](_0x4f3277,function(_0x115770){if(_0x115770[_0xb815('0x2e')]!==_0xb815('0x40')){var _0x267285={};_0x267285[_0x115770[_0xb815('0x2a')]]={'$like':'%'+_0x2e9199[_0xb815('0x32')][_0xb815('0x3d')]+'%'};return _0x267285;}})});}_0x7e8a20=_[_0xb815('0x3f')]({},_0x7e8a20,_0x2e9199['options']);var _0x5c0379={'where':_0x7e8a20['where']};return db[_0xb815('0x41')][_0xb815('0x1f')](_0x5c0379)['then'](function(_0x20d512){_0x46c545[_0xb815('0x1f')]=_0x20d512;if(_0x2e9199[_0xb815('0x32')][_0xb815('0x42')]){_0x7e8a20[_0xb815('0x43')]=[{'all':!![]}];}return db[_0xb815('0x41')]['findAll'](_0x7e8a20);})['then'](function(_0xd5c2df){_0x46c545['rows']=_0xd5c2df;return _0x46c545;})['then'](respondWithFilteredResult(_0x3b0152,_0x7e8a20))[_0xb815('0x44')](handleError(_0x3b0152,null));};exports[_0xb815('0x45')]=function(_0x2ff7a7,_0x388754){var _0x4c8655={'raw':![],'where':{'id':_0x2ff7a7[_0xb815('0x46')]['id']}},_0x49e448={};_0x49e448[_0xb815('0x30')]=_[_0xb815('0x33')](db[_0xb815('0x41')][_0xb815('0x2d')]);_0x49e448[_0xb815('0x32')]=_[_0xb815('0x33')](_0x2ff7a7[_0xb815('0x32')]);_0x49e448[_0xb815('0x3b')]=_['intersection'](_0x49e448[_0xb815('0x30')],_0x49e448['query']);_0x4c8655[_0xb815('0x36')]=_['intersection'](_0x49e448[_0xb815('0x30')],qs[_0xb815('0x35')](_0x2ff7a7[_0xb815('0x32')]['fields']));_0x4c8655['attributes']=_0x4c8655[_0xb815('0x36')][_0xb815('0x37')]?_0x4c8655[_0xb815('0x36')]:_0x49e448['model'];if(_0x2ff7a7[_0xb815('0x32')][_0xb815('0x42')]){_0x4c8655[_0xb815('0x43')]=[{'all':!![]}];}_0x4c8655=_[_0xb815('0x3f')]({},_0x4c8655,_0x2ff7a7[_0xb815('0x47')]);return db[_0xb815('0x41')][_0xb815('0x48')](_0x4c8655)[_0xb815('0x26')](handleEntityNotFound(_0x388754,null))['then'](respondWithResult(_0x388754,null))['catch'](handleError(_0x388754,null));};exports[_0xb815('0x49')]=function(_0x3a46f3,_0x1ffc95){return db[_0xb815('0x41')]['create'](_0x3a46f3['body'],{})[_0xb815('0x26')](respondWithResult(_0x1ffc95,0xc9))[_0xb815('0x44')](handleError(_0x1ffc95,null));};exports['update']=function(_0xfb3946,_0x5ce4f3){if(_0xfb3946[_0xb815('0x4a')]['id']){delete _0xfb3946['body']['id'];}return db['Dynamics365Account'][_0xb815('0x48')]({'where':{'id':_0xfb3946['params']['id']}})[_0xb815('0x26')](handleEntityNotFound(_0x5ce4f3,null))[_0xb815('0x26')](saveUpdates(_0xfb3946[_0xb815('0x4a')],null))['then'](respondWithResult(_0x5ce4f3,null))[_0xb815('0x44')](handleError(_0x5ce4f3,null));};exports[_0xb815('0x27')]=function(_0x1ce83d,_0x37cfd9){return db[_0xb815('0x41')][_0xb815('0x48')]({'where':{'id':_0x1ce83d[_0xb815('0x46')]['id']}})['then'](handleEntityNotFound(_0x37cfd9,null))[_0xb815('0x26')](removeEntity(_0x37cfd9,null))[_0xb815('0x44')](handleError(_0x37cfd9,null));};exports[_0xb815('0x4b')]=function(_0x4d74fc,_0x51f350,_0x1bc6ff){var _0x8d56c5={};var _0x29ee4c={};var _0x2266e3;var _0x3d79c1;return db[_0xb815('0x41')][_0xb815('0x4c')]({'where':{'id':_0x4d74fc[_0xb815('0x46')]['id']}})[_0xb815('0x26')](handleEntityNotFound(_0x51f350,null))[_0xb815('0x26')](function(_0x5de127){if(_0x5de127){_0x2266e3=_0x5de127;_0x29ee4c[_0xb815('0x30')]=_[_0xb815('0x33')](db[_0xb815('0x4d')][_0xb815('0x2d')]);_0x29ee4c[_0xb815('0x32')]=_[_0xb815('0x33')](_0x4d74fc['query']);_0x29ee4c[_0xb815('0x3b')]=_[_0xb815('0x34')](_0x29ee4c[_0xb815('0x30')],_0x29ee4c['query']);_0x8d56c5['attributes']=_[_0xb815('0x34')](_0x29ee4c[_0xb815('0x30')],qs['fields'](_0x4d74fc[_0xb815('0x32')]['fields']));_0x8d56c5[_0xb815('0x36')]=_0x8d56c5[_0xb815('0x36')][_0xb815('0x37')]?_0x8d56c5[_0xb815('0x36')]:_0x29ee4c[_0xb815('0x30')];_0x8d56c5[_0xb815('0x4e')]=qs['sort'](_0x4d74fc[_0xb815('0x32')][_0xb815('0x3a')]);_0x8d56c5[_0xb815('0x3e')]=qs[_0xb815('0x3b')](_[_0xb815('0x3c')](_0x4d74fc['query'],_0x29ee4c['filters']));if(_0x4d74fc[_0xb815('0x32')][_0xb815('0x3d')]){_0x8d56c5[_0xb815('0x3e')]=_['merge'](_0x8d56c5[_0xb815('0x3e')],{'$or':_[_0xb815('0x31')](_0x8d56c5['attributes'],function(_0x58b9b7){var _0x4bf05a={};_0x4bf05a[_0x58b9b7]={'$like':'%'+_0x4d74fc['query'][_0xb815('0x3d')]+'%'};return _0x4bf05a;})});}_0x8d56c5=_['merge']({},_0x8d56c5,_0x4d74fc[_0xb815('0x47')]);return _0x2266e3[_0xb815('0x4b')](_0x8d56c5);}})['then'](function(_0x4bb7ab){if(_0x4bb7ab){_0x3d79c1=_0x4bb7ab[_0xb815('0x37')];if(!_0x4d74fc[_0xb815('0x32')]['hasOwnProperty'](_0xb815('0x39'))){_0x8d56c5['limit']=qs[_0xb815('0x20')](_0x4d74fc[_0xb815('0x32')][_0xb815('0x20')]);_0x8d56c5[_0xb815('0x1d')]=qs[_0xb815('0x1d')](_0x4d74fc[_0xb815('0x32')][_0xb815('0x1d')]);}return _0x2266e3['getConfigurations'](_0x8d56c5);}})[_0xb815('0x26')](function(_0x17aa49){if(_0x17aa49){return _0x17aa49?{'count':_0x3d79c1,'rows':_0x17aa49}:null;}})[_0xb815('0x26')](respondWithResult(_0x51f350,null))[_0xb815('0x44')](handleError(_0x51f350,null));};exports[_0xb815('0x4f')]=function(_0x4a4520,_0x179a62,_0x21b6c7){if(_0x4a4520[_0xb815('0x4a')]['id']){delete _0x4a4520['body']['id'];}return db[_0xb815('0x41')]['findOne']({'where':{'id':_0x4a4520[_0xb815('0x46')]['id']}})[_0xb815('0x26')](handleEntityNotFound(_0x179a62,null))[_0xb815('0x26')](function(_0x40d0a0){if(_0x40d0a0){_0x4a4520[_0xb815('0x4a')]['AccountId']=_0x40d0a0['id'];_0x4a4520[_0xb815('0x4a')][_0xb815('0x50')]=integrations[_0xb815('0x51')](_0x4a4520['body'][_0xb815('0x52')],_0x4a4520[_0xb815('0x4a')][_0xb815('0x2e')]);_0x4a4520[_0xb815('0x4a')]['Descriptions']=integrations[_0xb815('0x53')](_0x4a4520[_0xb815('0x4a')][_0xb815('0x52')],_0x4a4520['body']['type']);return db['Dynamics365Configuration'][_0xb815('0x49')](_0x4a4520['body'],{'include':[{'model':db[_0xb815('0x54')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0xb815('0x26')](respondWithResult(_0x179a62,null))[_0xb815('0x44')](handleError(_0x179a62,null));};exports['getFields']=function(_0x221901,_0x56fb5c,_0x348c46){var _0x4127b0=_0x221901[_0xb815('0x32')][_0xb815('0x55')];var _0x1d6b30=_0x4127b0==='incident'?'Incident':'PhoneCall';var _0x43ab02='';var _0x1af9e4='';var _0x38fa3e='';var _0x5af65c='';var _0x3fdf43='';var _0x56fabe='';var _0x2e1c91='';var _0x1da9ec='';var _0x1b3cb8=['title','description',_0xb815('0x56'),'ownerid',_0xb815('0x57'),'subject',_0xb815('0x58'),_0xb815('0x59'),_0xb815('0x5a'),_0xb815('0x5b')];var _0x2cf83b=[_0xb815('0x5c'),'accountidyominame',_0xb815('0x5d'),_0xb815('0x5e'),'contactidname',_0xb815('0x5f'),'contractdetailidname',_0xb815('0x60'),_0xb815('0x61'),_0xb815('0x62'),'createdbyname',_0xb815('0x63'),_0xb815('0x64'),_0xb815('0x65'),_0xb815('0x66'),_0xb815('0x67'),_0xb815('0x68'),'customeridyominame',_0xb815('0x69'),_0xb815('0x6a'),_0xb815('0x6b'),_0xb815('0x6c'),_0xb815('0x6d'),'exchangerate','firstresponsebykpiidname',_0xb815('0x6e'),_0xb815('0x6f'),_0xb815('0x70'),'kbarticleidname',_0xb815('0x71'),'masteridname','modifiedbyexternalpartyname',_0xb815('0x72'),_0xb815('0x73'),_0xb815('0x74'),_0xb815('0x75'),_0xb815('0x76'),'modifiedonbehalfbyyominame',_0xb815('0x77'),_0xb815('0x78'),_0xb815('0x79'),_0xb815('0x7a'),_0xb815('0x7b'),'owneridname',_0xb815('0x7c'),'owneridyominame',_0xb815('0x7d'),_0xb815('0x7e'),_0xb815('0x7f'),'prioritycodename',_0xb815('0x80'),_0xb815('0x81'),_0xb815('0x82'),_0xb815('0x83'),_0xb815('0x84'),_0xb815('0x85'),_0xb815('0x86'),_0xb815('0x87'),_0xb815('0x88'),_0xb815('0x89'),'socialprofileidname','statecode',_0xb815('0x8a'),_0xb815('0x8b'),_0xb815('0x8c'),_0xb815('0x8d'),'transactioncurrencyidname',_0xb815('0x8e'),_0xb815('0x8f'),'versionnumber'];var _0x3e7323=_0x1b3cb8[_0xb815('0x90')](_0x2cf83b);return db[_0xb815('0x41')][_0xb815('0x4c')]({'where':{'id':_0x221901['params']['id']},'attributes':['id','username',_0xb815('0x91'),_0xb815('0x92'),_0xb815('0x93'),_0xb815('0x94'),'clientSecret']})[_0xb815('0x26')](handleEntityNotFound(_0x56fb5c,null))[_0xb815('0x26')](function(_0x5a28b3){if(_0x5a28b3){_0x1da9ec=_0x5a28b3['remoteUri'];var _0x4c645c=_0x1da9ec[_0xb815('0x95')](-0x1);if(_0x4c645c==='/'){_0x1da9ec=_0x1da9ec[_0xb815('0x96')](0x0,_0x1da9ec['lastIndexOf'](_0x4c645c));}_0x2e1c91=util[_0xb815('0x97')](_0xb815('0x98'),_0x1da9ec);var _0x5d0792={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x5a28b3[_0xb815('0x93')]+'/oauth2/token','form':{'client_id':_0x5a28b3[_0xb815('0x94')],'resource':_0x1da9ec,'username':_0x5a28b3[_0xb815('0x99')],'password':_0x5a28b3['password'],'grant_type':'password','client_secret':_0x5a28b3[_0xb815('0x9a')]},'json':!![]};return rp(_0x5d0792);}})[_0xb815('0x26')](function(_0x513ab4){_0x56fabe=_0x513ab4[_0xb815('0x9b')];var _0x212376={'method':'GET','uri':encodeURI(_0x2e1c91+_0xb815('0x9c')+_0x1d6b30+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x56fabe,'If-None-Match':null,'OData-Version':_0xb815('0x9d')},'json':!![]};return rp(_0x212376);})[_0xb815('0x26')](function(_0x5537e1){var _0x4e9f6d=_0x5537e1[_0xb815('0x9e')][0x0];var _0x139d52=_0x4e9f6d[_0xb815('0x9f')];var _0x188f6a={'method':'GET','uri':_0x2e1c91+_0xb815('0xa0')+_0x139d52+_0xb815('0xa1'),'headers':{'Authorization':_0xb815('0xa2')+_0x56fabe,'If-None-Match':null,'OData-Version':_0xb815('0x9d')},'json':!![]};return rp(_0x188f6a);})['then'](function(_0x321919){_0x43ab02=_0x321919;_0x1af9e4=_0x43ab02['Attributes'];_0x1af9e4=_[_0xb815('0xa3')](_0x1af9e4,function(_0x335c68){return!_0x3e7323[_0xb815('0xa4')](_0x335c68[_0xb815('0xa5')]);});var _0x4789bc=[];var _0x5ace19=[];_0x1af9e4[_0xb815('0xa6')](function(_0x105259){if(_0x105259[_0xb815('0xa7')]){var _0x41d405=_0x105259[_0xb815('0xa7')]['substring'](_0x105259['@odata.type']['lastIndexOf']('.')+0x1);if(_0x41d405===_0xb815('0xa8')){_0x4789bc[_0xb815('0xa9')](getSelectList(_0x2e1c91,_0x4127b0,_0x5ace19,_0x43ab02[_0xb815('0x9f')],_0x105259[_0xb815('0x9f')],_0x56fabe));}}});return Promise[_0xb815('0xaa')](_0x4789bc);})[_0xb815('0x26')](function(_0x29cb36){_0x38fa3e=_0x29cb36[0x0];var _0x2f3284=[];var _0x25584a=[];_0x1af9e4[_0xb815('0xa6')](function(_0x20fe0e){if(!_[_0xb815('0xab')](_0x20fe0e[_0xb815('0xa7')])){var _0x466a28=_0x20fe0e[_0xb815('0xa7')]['substring'](_0x20fe0e[_0xb815('0xa7')][_0xb815('0xac')]('.')+0x1);if(_0x466a28===_0xb815('0xad')){_0x2f3284[_0xb815('0xa9')](getBooleanList(_0x2e1c91,_0x4127b0,_0x25584a,_0x43ab02[_0xb815('0x9f')],_0x20fe0e[_0xb815('0x9f')],_0x56fabe));}}});return Promise[_0xb815('0xaa')](_0x2f3284);})['then'](function(_0x14b1ef){_0x5af65c=_0x14b1ef[0x0];var _0x3d4109=[];var _0x2db875=[];_0x1af9e4[_0xb815('0xa6')](function(_0x1ebac6){if(_0x1ebac6[_0xb815('0xa7')]){var _0x47a477=_0x1ebac6[_0xb815('0xa7')][_0xb815('0x96')](_0x1ebac6[_0xb815('0xa7')][_0xb815('0xac')]('.')+0x1);if(_0x47a477===_0xb815('0xae')||_0x47a477===_0xb815('0xaf')||_0x47a477==='BigIntAttributeMetadata'||_0x47a477===_0xb815('0xb0')||_0x47a477===_0xb815('0xb1')||_0x47a477===_0xb815('0xb2')||_0x47a477==='StatusAttributeMetadata'||_0x47a477===_0xb815('0xb3')||_0x47a477==='StateAttributeMetadata'||_0x47a477==='DecimalAttributeMetadata'){_0x3d4109['push'](getInputList(_0x2e1c91,_0x4127b0,_0x47a477,_0x2db875,_0x43ab02[_0xb815('0x9f')],_0x1ebac6[_0xb815('0x9f')],_0x56fabe));}}});return Promise[_0xb815('0xaa')](_0x3d4109);})[_0xb815('0x26')](function(_0xd8acb2){_0x3fdf43=_0xd8acb2[0x0];var _0x305491=_0x38fa3e[_0xb815('0x90')](_0x5af65c)[_0xb815('0x90')](_0x3fdf43);var _0x253d83={'count':_0x305491[_0xb815('0x37')],'rows':_0x305491};return _0x253d83;})['then'](respondWithResult(_0x56fb5c,null))[_0xb815('0x44')](function(_0x596851){var _0x352883=_0x221901[_0xb815('0x32')][_0xb815('0xb4')]?0x1f4:_0x596851[_0xb815('0xb5')]||0x1f4;logger[_0xb815('0x28')](_0x596851['stack']);delete _0x596851[_0xb815('0x2a')];if(_0x352883===0x191){_0x352883=0x190;}_0x56fb5c[_0xb815('0x1a')](_0x352883)[_0xb815('0x2b')](_0x221901[_0xb815('0x32')][_0xb815('0xb4')]?{'message':_0xb815('0xb6'),'statusCode':_0x596851[_0xb815('0xb5')]}:_0x596851);});};function getSelectList(_0x4e382e,_0x45d1c0,_0x1ff6c4,_0x40fd54,_0x2c41ce,_0x2ea128){var _0x196922={'method':_0xb815('0xb7'),'uri':_0x4e382e+_0xb815('0xa0')+_0x40fd54+')/Attributes('+_0x2c41ce+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x2ea128,'If-None-Match':null,'OData-Version':_0xb815('0x9d')},'json':!![]};return rp(_0x196922)['then'](function(_0x126712){var _0x2efea5=[];var _0x573a96=_0x126712[_0xb815('0xb8')][_0xb815('0xb9')];_0x573a96['forEach'](function(_0x49bc52){_0x2efea5[_0xb815('0xa9')]({'name':_0x49bc52[_0xb815('0xba')][_0xb815('0xbb')][_0xb815('0xba')],'value':String(_0x49bc52['Value'])});});var _0x1556f2={'id':_0x45d1c0+'_'+_0x126712['LogicalName'],'name':_0x126712[_0xb815('0xbc')][_0xb815('0xbb')]['Label'],'custom':![],'options':_0x2efea5};_0x1ff6c4['push'](_0x1556f2);return _0x1ff6c4;});}function getBooleanList(_0x3f5fea,_0x3797d1,_0x475039,_0x422cc6,_0x2c3115,_0x13e4a2){var _0x1cd15d={'method':'GET','uri':_0x3f5fea+_0xb815('0xa0')+_0x422cc6+_0xb815('0xbd')+_0x2c3115+_0xb815('0xbe'),'headers':{'Authorization':'Bearer\x20'+_0x13e4a2,'If-None-Match':null,'OData-Version':_0xb815('0x9d')},'json':!![]};return rp(_0x1cd15d)[_0xb815('0x26')](function(_0x1f63aa){var _0x556e39=[];_0x556e39[_0xb815('0xa9')]({'name':_0x1f63aa[_0xb815('0xb8')]['TrueOption'][_0xb815('0xba')][_0xb815('0xbb')][_0xb815('0xba')],'value':_0xb815('0xbf')},{'name':_0x1f63aa['OptionSet'][_0xb815('0xc0')][_0xb815('0xba')][_0xb815('0xbb')]['Label'],'value':_0xb815('0xc1')});var _0x1ea12f={'id':_0x3797d1+'_'+_0x1f63aa['LogicalName'],'name':_0x1f63aa['DisplayName'][_0xb815('0xbb')][_0xb815('0xba')],'custom':![],'options':_0x556e39};_0x475039[_0xb815('0xa9')](_0x1ea12f);return _0x475039;});}function getInputList(_0x5e3e65,_0x4fb55b,_0x131062,_0x2dbeb8,_0x279b8a,_0x591a92,_0x2ee9bb){var _0x3f1c80={'method':'GET','uri':_0x5e3e65+'EntityDefinitions('+_0x279b8a+_0xb815('0xbd')+_0x591a92+_0xb815('0xc2')+_0x131062+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xb815('0xa2')+_0x2ee9bb,'If-None-Match':null,'OData-Version':_0xb815('0x9d')},'json':!![]};return rp(_0x3f1c80)[_0xb815('0x26')](function(_0x33a48d){var _0x2b3d07={'id':_0x4fb55b+'_'+_0x33a48d['LogicalName'],'name':_0x33a48d[_0xb815('0xbc')][_0xb815('0xbb')]?_0x33a48d[_0xb815('0xbc')]['UserLocalizedLabel']['Label']:_0x33a48d['LogicalName'],'custom':![],'options':[]};_0x2dbeb8[_0xb815('0xa9')](_0x2b3d07);return _0x2dbeb8;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 1fb1972..c2eb7a9 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(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_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(_0x36c1da,_0x11d653){var _0x5c4efe=function(_0x4023fb){while(--_0x4023fb){_0x36c1da['push'](_0x36c1da['shift']());}};_0x5c4efe(++_0x11d653);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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 cd65cc5..a35df1d 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 _0xe906=['map','model','attributes','debug','ShowDynamics365Account','Dynamics365Account','find','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','options','raw','where','limit','include'];(function(_0x39e85c,_0x3bca61){var _0xf96780=function(_0x3b0708){while(--_0x3b0708){_0x39e85c['push'](_0x39e85c['shift']());}};_0xf96780(++_0x3bca61);}(_0xe906,0x14b));var _0x6e90=function(_0xe30ca7,_0x465221){_0xe30ca7=_0xe30ca7-0x0;var _0x515a39=_0xe906[_0xe30ca7];return _0x515a39;};'use strict';var _=require(_0x6e90('0x0'));var util=require(_0x6e90('0x1'));var moment=require(_0x6e90('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e90('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6e90('0x4'));var logger=require(_0x6e90('0x5'))(_0x6e90('0x6'));var config=require(_0x6e90('0x7'));var jayson=require(_0x6e90('0x8'));var client=jayson[_0x6e90('0x9')][_0x6e90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a6b4e,_0x24a44c,_0x380d3f){return new BPromise(function(_0x582b36,_0x30b77a){return client[_0x6e90('0xb')](_0x1a6b4e,_0x380d3f)[_0x6e90('0xc')](function(_0x249d85){logger[_0x6e90('0xd')](_0x6e90('0xe'),_0x24a44c,_0x6e90('0xf'));logger['debug'](_0x6e90('0x10'),_0x24a44c,_0x6e90('0xf'),JSON[_0x6e90('0x11')](_0x249d85));if(_0x249d85[_0x6e90('0x12')]){if(_0x249d85[_0x6e90('0x12')][_0x6e90('0x13')]===0x1f4){logger[_0x6e90('0x12')](_0x6e90('0xe'),_0x24a44c,_0x249d85[_0x6e90('0x12')]['message']);return _0x30b77a(_0x249d85[_0x6e90('0x12')]['message']);}logger[_0x6e90('0x12')](_0x6e90('0xe'),_0x24a44c,_0x249d85['error'][_0x6e90('0x14')]);return _0x582b36(_0x249d85[_0x6e90('0x12')][_0x6e90('0x14')]);}else{logger[_0x6e90('0xd')](_0x6e90('0xe'),_0x24a44c,'request\x20sent');_0x582b36(_0x249d85[_0x6e90('0x15')]['message']);}})[_0x6e90('0x16')](function(_0x44eb24){logger[_0x6e90('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x24a44c,_0x44eb24);_0x30b77a(_0x44eb24);});});}exports[_0x6e90('0x17')]=function(_0x44d7de){var _0x27fc11=this;return new Promise(function(_0x21e498,_0x6d06f4){return db['Dynamics365Account']['findAll']({'raw':_0x44d7de[_0x6e90('0x18')]?_0x44d7de['options'][_0x6e90('0x19')]===undefined?!![]:![]:!![],'where':_0x44d7de[_0x6e90('0x18')]?_0x44d7de[_0x6e90('0x18')][_0x6e90('0x1a')]||null:null,'attributes':_0x44d7de[_0x6e90('0x18')]?_0x44d7de[_0x6e90('0x18')]['attributes']||null:null,'limit':_0x44d7de[_0x6e90('0x18')]?_0x44d7de[_0x6e90('0x18')][_0x6e90('0x1b')]||null:null,'include':_0x44d7de[_0x6e90('0x18')]?_0x44d7de[_0x6e90('0x18')][_0x6e90('0x1c')]?_[_0x6e90('0x1d')](_0x44d7de[_0x6e90('0x18')][_0x6e90('0x1c')],function(_0x58ecbf){return{'model':db[_0x58ecbf[_0x6e90('0x1e')]],'as':_0x58ecbf['as'],'attributes':_0x58ecbf[_0x6e90('0x1f')],'include':_0x58ecbf['include']?_['map'](_0x58ecbf[_0x6e90('0x1c')],function(_0x1b7d27){return{'model':db[_0x1b7d27[_0x6e90('0x1e')]],'as':_0x1b7d27['as'],'attributes':_0x1b7d27[_0x6e90('0x1f')],'include':_0x1b7d27[_0x6e90('0x1c')]?_[_0x6e90('0x1d')](_0x1b7d27[_0x6e90('0x1c')],function(_0x118916){return{'model':db[_0x118916['model']],'as':_0x118916['as'],'attributes':_0x118916[_0x6e90('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5717e4){logger['info'](_0x6e90('0x17'),_0x44d7de);logger[_0x6e90('0x20')](_0x6e90('0x17'),_0x44d7de,JSON[_0x6e90('0x11')](_0x5717e4));_0x21e498(_0x5717e4);})[_0x6e90('0x16')](function(_0x169d0e){logger[_0x6e90('0x12')](_0x6e90('0x17'),_0x169d0e[_0x6e90('0x14')],_0x44d7de);_0x6d06f4(_0x27fc11[_0x6e90('0x12')](0x1f4,_0x169d0e[_0x6e90('0x14')]));});});};exports[_0x6e90('0x21')]=function(_0x4dd8a8){var _0x5f6ad3=this;return new Promise(function(_0x429e6e,_0x3cf5cd){return db[_0x6e90('0x22')][_0x6e90('0x23')]({'raw':_0x4dd8a8['options']?_0x4dd8a8[_0x6e90('0x18')][_0x6e90('0x19')]===undefined?!![]:![]:!![],'where':_0x4dd8a8[_0x6e90('0x18')]?_0x4dd8a8[_0x6e90('0x18')][_0x6e90('0x1a')]||null:null,'attributes':_0x4dd8a8[_0x6e90('0x18')]?_0x4dd8a8['options'][_0x6e90('0x1f')]||null:null,'include':_0x4dd8a8[_0x6e90('0x18')]?_0x4dd8a8[_0x6e90('0x18')]['include']?_[_0x6e90('0x1d')](_0x4dd8a8[_0x6e90('0x18')][_0x6e90('0x1c')],function(_0x1706b2){return{'model':db[_0x1706b2['model']],'as':_0x1706b2['as'],'attributes':_0x1706b2[_0x6e90('0x1f')],'include':_0x1706b2[_0x6e90('0x1c')]?_[_0x6e90('0x1d')](_0x1706b2['include'],function(_0x54af8e){return{'model':db[_0x54af8e[_0x6e90('0x1e')]],'as':_0x54af8e['as'],'attributes':_0x54af8e['attributes'],'include':_0x54af8e[_0x6e90('0x1c')]?_[_0x6e90('0x1d')](_0x54af8e[_0x6e90('0x1c')],function(_0x282794){return{'model':db[_0x282794[_0x6e90('0x1e')]],'as':_0x282794['as'],'attributes':_0x282794[_0x6e90('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6e90('0xc')](function(_0x581464){logger[_0x6e90('0xd')](_0x6e90('0x21'),_0x4dd8a8);logger[_0x6e90('0x20')](_0x6e90('0x21'),_0x4dd8a8,JSON['stringify'](_0x581464));_0x429e6e(_0x581464);})[_0x6e90('0x16')](function(_0x3c4aae){logger[_0x6e90('0x12')](_0x6e90('0x21'),_0x3c4aae[_0x6e90('0x14')],_0x4dd8a8);_0x3cf5cd(_0x5f6ad3['error'](0x1f4,_0x3c4aae[_0x6e90('0x14')]));});});}; \ No newline at end of file +var _0xae98=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowDynamics365Account','Dynamics365Account','find','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x2108af,_0x225dd0){var _0x439d91=function(_0x29678f){while(--_0x29678f){_0x2108af['push'](_0x2108af['shift']());}};_0x439d91(++_0x225dd0);}(_0xae98,0x8b));var _0x8ae9=function(_0x2388e4,_0x46512e){_0x2388e4=_0x2388e4-0x0;var _0xc7dc74=_0xae98[_0x2388e4];return _0xc7dc74;};'use strict';var _=require(_0x8ae9('0x0'));var util=require('util');var moment=require(_0x8ae9('0x1'));var BPromise=require(_0x8ae9('0x2'));var rs=require(_0x8ae9('0x3'));var fs=require('fs');var Redis=require(_0x8ae9('0x4'));var db=require(_0x8ae9('0x5'))['db'];var utils=require(_0x8ae9('0x6'));var logger=require(_0x8ae9('0x7'))('rpc');var config=require(_0x8ae9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8ae9('0x9')][_0x8ae9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2020f0,_0xc55919,_0x3e8836){return new BPromise(function(_0x1aa312,_0x35763){return client[_0x8ae9('0xb')](_0x2020f0,_0x3e8836)[_0x8ae9('0xc')](function(_0x114426){logger[_0x8ae9('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0xc55919,_0x8ae9('0xe'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xc55919,_0x8ae9('0xe'),JSON['stringify'](_0x114426));if(_0x114426[_0x8ae9('0xf')]){if(_0x114426['error'][_0x8ae9('0x10')]===0x1f4){logger[_0x8ae9('0xf')](_0x8ae9('0x11'),_0xc55919,_0x114426[_0x8ae9('0xf')]['message']);return _0x35763(_0x114426[_0x8ae9('0xf')]['message']);}logger[_0x8ae9('0xf')](_0x8ae9('0x11'),_0xc55919,_0x114426[_0x8ae9('0xf')][_0x8ae9('0x12')]);return _0x1aa312(_0x114426['error']['message']);}else{logger[_0x8ae9('0xd')](_0x8ae9('0x11'),_0xc55919,_0x8ae9('0xe'));_0x1aa312(_0x114426[_0x8ae9('0x13')][_0x8ae9('0x12')]);}})[_0x8ae9('0x14')](function(_0x1945d8){logger[_0x8ae9('0xf')](_0x8ae9('0x11'),_0xc55919,_0x1945d8);_0x35763(_0x1945d8);});});}exports[_0x8ae9('0x15')]=function(_0x2484af){var _0x4c4cc8=this;return new Promise(function(_0x5a01f4,_0x14be37){return db['Dynamics365Account'][_0x8ae9('0x16')]({'raw':_0x2484af[_0x8ae9('0x17')]?_0x2484af[_0x8ae9('0x17')][_0x8ae9('0x18')]===undefined?!![]:![]:!![],'where':_0x2484af[_0x8ae9('0x17')]?_0x2484af[_0x8ae9('0x17')][_0x8ae9('0x19')]||null:null,'attributes':_0x2484af[_0x8ae9('0x17')]?_0x2484af[_0x8ae9('0x17')][_0x8ae9('0x1a')]||null:null,'limit':_0x2484af[_0x8ae9('0x17')]?_0x2484af[_0x8ae9('0x17')][_0x8ae9('0x1b')]||null:null,'include':_0x2484af[_0x8ae9('0x17')]?_0x2484af[_0x8ae9('0x17')][_0x8ae9('0x1c')]?_['map'](_0x2484af[_0x8ae9('0x17')][_0x8ae9('0x1c')],function(_0x54e080){return{'model':db[_0x54e080['model']],'as':_0x54e080['as'],'attributes':_0x54e080[_0x8ae9('0x1a')],'include':_0x54e080['include']?_[_0x8ae9('0x1d')](_0x54e080[_0x8ae9('0x1c')],function(_0xfab1d3){return{'model':db[_0xfab1d3[_0x8ae9('0x1e')]],'as':_0xfab1d3['as'],'attributes':_0xfab1d3['attributes'],'include':_0xfab1d3[_0x8ae9('0x1c')]?_[_0x8ae9('0x1d')](_0xfab1d3[_0x8ae9('0x1c')],function(_0x556406){return{'model':db[_0x556406[_0x8ae9('0x1e')]],'as':_0x556406['as'],'attributes':_0x556406[_0x8ae9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8ae9('0xc')](function(_0x22b7d2){logger['info'](_0x8ae9('0x15'),_0x2484af);logger[_0x8ae9('0x1f')](_0x8ae9('0x15'),_0x2484af,JSON[_0x8ae9('0x20')](_0x22b7d2));_0x5a01f4(_0x22b7d2);})['catch'](function(_0x3da7b0){logger['error'](_0x8ae9('0x15'),_0x3da7b0[_0x8ae9('0x12')],_0x2484af);_0x14be37(_0x4c4cc8['error'](0x1f4,_0x3da7b0[_0x8ae9('0x12')]));});});};exports[_0x8ae9('0x21')]=function(_0x359493){var _0x14743a=this;return new Promise(function(_0x483579,_0x5038ca){return db[_0x8ae9('0x22')][_0x8ae9('0x23')]({'raw':_0x359493[_0x8ae9('0x17')]?_0x359493[_0x8ae9('0x17')][_0x8ae9('0x18')]===undefined?!![]:![]:!![],'where':_0x359493[_0x8ae9('0x17')]?_0x359493[_0x8ae9('0x17')]['where']||null:null,'attributes':_0x359493[_0x8ae9('0x17')]?_0x359493[_0x8ae9('0x17')][_0x8ae9('0x1a')]||null:null,'include':_0x359493[_0x8ae9('0x17')]?_0x359493['options'][_0x8ae9('0x1c')]?_[_0x8ae9('0x1d')](_0x359493[_0x8ae9('0x17')][_0x8ae9('0x1c')],function(_0x6fe351){return{'model':db[_0x6fe351[_0x8ae9('0x1e')]],'as':_0x6fe351['as'],'attributes':_0x6fe351[_0x8ae9('0x1a')],'include':_0x6fe351['include']?_['map'](_0x6fe351[_0x8ae9('0x1c')],function(_0x54e512){return{'model':db[_0x54e512[_0x8ae9('0x1e')]],'as':_0x54e512['as'],'attributes':_0x54e512[_0x8ae9('0x1a')],'include':_0x54e512['include']?_[_0x8ae9('0x1d')](_0x54e512[_0x8ae9('0x1c')],function(_0x503344){return{'model':db[_0x503344[_0x8ae9('0x1e')]],'as':_0x503344['as'],'attributes':_0x503344[_0x8ae9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8ae9('0xc')](function(_0x438716){logger['info'](_0x8ae9('0x21'),_0x359493);logger['debug'](_0x8ae9('0x21'),_0x359493,JSON['stringify'](_0x438716));_0x483579(_0x438716);})[_0x8ae9('0x14')](function(_0x41b243){logger[_0x8ae9('0xf')](_0x8ae9('0x21'),_0x41b243[_0x8ae9('0x12')],_0x359493);_0x5038ca(_0x14743a[_0x8ae9('0xf')](0x1f4,_0x41b243[_0x8ae9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 8bf0adf..f244f8c 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 _0x45c2=['index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x45c2,0x68));var _0x245c=function(_0x54a479,_0x1b321d){_0x54a479=_0x54a479-0x0;var _0x2474ab=_0x45c2[_0x54a479];return _0x2474ab;};'use strict';var multer=require(_0x245c('0x0'));var util=require(_0x245c('0x1'));var path=require(_0x245c('0x2'));var timeout=require(_0x245c('0x3'));var express=require('express');var router=express[_0x245c('0x4')]();var fs_extra=require(_0x245c('0x5'));var auth=require(_0x245c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x245c('0x7'));var controller=require(_0x245c('0x8'));router[_0x245c('0x9')]('/',auth[_0x245c('0xa')](),controller[_0x245c('0xb')]);router[_0x245c('0x9')](_0x245c('0xc'),auth[_0x245c('0xa')](),controller[_0x245c('0xd')]);router[_0x245c('0x9')](_0x245c('0xe'),auth[_0x245c('0xa')](),controller['getFields']);router[_0x245c('0x9')](_0x245c('0xf'),auth[_0x245c('0xa')](),controller['getSubjects']);router['get'](_0x245c('0x10'),auth[_0x245c('0xa')](),controller['getDescriptions']);router[_0x245c('0x11')]('/',auth['isAuthenticated'](),controller[_0x245c('0x12')]);router[_0x245c('0x13')](_0x245c('0xc'),auth[_0x245c('0xa')](),controller[_0x245c('0x14')]);router['delete'](_0x245c('0xc'),auth[_0x245c('0xa')](),controller[_0x245c('0x15')]);module[_0x245c('0x16')]=router; \ No newline at end of file +var _0x806e=['getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x806e,0x1ef));var _0xe806=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x806e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe806('0x0'));var util=require(_0xe806('0x1'));var path=require(_0xe806('0x2'));var timeout=require(_0xe806('0x3'));var express=require(_0xe806('0x4'));var router=express[_0xe806('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe806('0x6'));var interaction=require(_0xe806('0x7'));var config=require(_0xe806('0x8'));var controller=require(_0xe806('0x9'));router[_0xe806('0xa')]('/',auth[_0xe806('0xb')](),controller[_0xe806('0xc')]);router[_0xe806('0xa')](_0xe806('0xd'),auth[_0xe806('0xb')](),controller[_0xe806('0xe')]);router['get'](_0xe806('0xf'),auth[_0xe806('0xb')](),controller[_0xe806('0x10')]);router[_0xe806('0xa')](_0xe806('0x11'),auth[_0xe806('0xb')](),controller[_0xe806('0x12')]);router['get'](_0xe806('0x13'),auth[_0xe806('0xb')](),controller[_0xe806('0x14')]);router[_0xe806('0x15')]('/',auth['isAuthenticated'](),controller[_0xe806('0x16')]);router['put'](_0xe806('0xd'),auth[_0xe806('0xb')](),controller[_0xe806('0x17')]);router[_0xe806('0x18')](_0xe806('0xd'),auth[_0xe806('0xb')](),controller[_0xe806('0x19')]);module[_0xe806('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 1035c91..5f18b03 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 _0xe173=['exports','STRING','ENUM','phonecall','incident','sequelize'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xe173,0xc5));var _0x3e17=function(_0x491220,_0xb4cdc7){_0x491220=_0x491220-0x0;var _0x34a153=_0xe173[_0x491220];return _0x34a153;};'use strict';var Sequelize=require(_0x3e17('0x0'));module[_0x3e17('0x1')]={'name':{'type':Sequelize[_0x3e17('0x2')]},'description':{'type':Sequelize[_0x3e17('0x2')]},'ticketType':{'type':Sequelize[_0x3e17('0x3')]('incident',_0x3e17('0x4')),'defaultValue':_0x3e17('0x5')}}; \ No newline at end of file +var _0xa326=['incident','phonecall','sequelize','exports','STRING','ENUM'];(function(_0x17b398,_0x4bb030){var _0x161e3d=function(_0x526b30){while(--_0x526b30){_0x17b398['push'](_0x17b398['shift']());}};_0x161e3d(++_0x4bb030);}(_0xa326,0x1ac));var _0x6a32=function(_0x3431ca,_0x3ad596){_0x3431ca=_0x3431ca-0x0;var _0x912a8c=_0xa326[_0x3431ca];return _0x912a8c;};'use strict';var Sequelize=require(_0x6a32('0x0'));module[_0x6a32('0x1')]={'name':{'type':Sequelize[_0x6a32('0x2')]},'description':{'type':Sequelize[_0x6a32('0x2')]},'ticketType':{'type':Sequelize[_0x6a32('0x3')](_0x6a32('0x4'),_0x6a32('0x5')),'defaultValue':_0x6a32('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 5a7bbea..a8e7562 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 _0x4662=['undefined','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','getFields','length','getSubjects','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x397a6e,_0x58fb92){var _0x49848b=function(_0x10a229){while(--_0x10a229){_0x397a6e['push'](_0x397a6e['shift']());}};_0x49848b(++_0x58fb92);}(_0x4662,0xd5));var _0x2466=function(_0x55f9ac,_0x480166){_0x55f9ac=_0x55f9ac-0x0;var _0x528f2e=_0x4662[_0x55f9ac];return _0x528f2e;};'use strict';var emlformat=require(_0x2466('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2466('0x1'));var jsonpatch=require(_0x2466('0x2'));var rp=require(_0x2466('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2466('0x4'));var util=require(_0x2466('0x5'));var path=require('path');var sox=require(_0x2466('0x6'));var csv=require(_0x2466('0x7'));var ejs=require(_0x2466('0x8'));var fs=require('fs');var fs_extra=require(_0x2466('0x9'));var _=require(_0x2466('0xa'));var squel=require(_0x2466('0xb'));var crypto=require(_0x2466('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2466('0xd'));var toCsv=require(_0x2466('0x7'));var querystring=require(_0x2466('0xe'));var Papa=require('papaparse');var Redis=require(_0x2466('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2466('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2466('0x11'))(_0x2466('0x12'));var utils=require(_0x2466('0x13'));var config=require(_0x2466('0x14'));var licenseUtil=require(_0x2466('0x15'));var db=require(_0x2466('0x16'))['db'];function respondWithStatusCode(_0x2132e2,_0x5a7a13){_0x5a7a13=_0x5a7a13||0xcc;return function(_0x4a9684){if(_0x4a9684){return _0x2132e2[_0x2466('0x17')](_0x5a7a13);}return _0x2132e2[_0x2466('0x18')](_0x5a7a13)[_0x2466('0x19')]();};}function respondWithResult(_0x36ef05,_0x25eba0){_0x25eba0=_0x25eba0||0xc8;return function(_0x4a723a){if(_0x4a723a){return _0x36ef05[_0x2466('0x18')](_0x25eba0)[_0x2466('0x1a')](_0x4a723a);}};}function respondWithFilteredResult(_0x332bf6,_0xd71eba){return function(_0x5caa4a){if(_0x5caa4a){var _0x57375d=typeof _0xd71eba['offset']===_0x2466('0x1b')&&typeof _0xd71eba['limit']===_0x2466('0x1b');var _0x32e5e0=_0x5caa4a['count'];var _0x419566=_0x57375d?0x0:_0xd71eba['offset'];var _0xfb94f8=_0x57375d?_0x5caa4a[_0x2466('0x1c')]:_0xd71eba['offset']+_0xd71eba['limit'];var _0x2e5da3;if(_0xfb94f8>=_0x32e5e0){_0xfb94f8=_0x32e5e0;_0x2e5da3=0xc8;}else{_0x2e5da3=0xce;}_0x332bf6[_0x2466('0x18')](_0x2e5da3);return _0x332bf6[_0x2466('0x1d')](_0x2466('0x1e'),_0x419566+'-'+_0xfb94f8+'/'+_0x32e5e0)[_0x2466('0x1a')](_0x5caa4a);}return null;};}function patchUpdates(_0x5b79af){return function(_0x52fd76){try{jsonpatch[_0x2466('0x1f')](_0x52fd76,_0x5b79af,!![]);}catch(_0x395a3f){return BPromise[_0x2466('0x20')](_0x395a3f);}return _0x52fd76[_0x2466('0x21')]();};}function saveUpdates(_0x12d228,_0x528ab3){return function(_0x3a2bba){if(_0x3a2bba){return _0x3a2bba['update'](_0x12d228)['then'](function(_0x21467e){return _0x21467e;});}return null;};}function removeEntity(_0x570cf6,_0x1367d2){return function(_0x4d7566){if(_0x4d7566){return _0x4d7566['destroy']()[_0x2466('0x22')](function(){_0x570cf6[_0x2466('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16f265,_0x3517c8){return function(_0x35e31c){if(!_0x35e31c){_0x16f265[_0x2466('0x17')](0x194);}return _0x35e31c;};}function handleError(_0x4ae9e4,_0x466b5d){_0x466b5d=_0x466b5d||0x1f4;return function(_0xa8c08){logger[_0x2466('0x23')](_0xa8c08[_0x2466('0x24')]);if(_0xa8c08[_0x2466('0x25')]){delete _0xa8c08['name'];}_0x4ae9e4[_0x2466('0x18')](_0x466b5d)[_0x2466('0x26')](_0xa8c08);};}exports['index']=function(_0x169054,_0x314162){var _0xc8de54={},_0x55247d={},_0x4b6891={'count':0x0,'rows':[]};var _0x3c3112=_[_0x2466('0x27')](db[_0x2466('0x28')][_0x2466('0x29')],function(_0x106270){return{'name':_0x106270[_0x2466('0x2a')],'type':_0x106270[_0x2466('0x2b')][_0x2466('0x2c')]};});_0x55247d[_0x2466('0x2d')]=_[_0x2466('0x27')](_0x3c3112,'name');_0x55247d[_0x2466('0x2e')]=_[_0x2466('0x2f')](_0x169054[_0x2466('0x2e')]);_0x55247d[_0x2466('0x30')]=_['intersection'](_0x55247d[_0x2466('0x2d')],_0x55247d['query']);_0xc8de54[_0x2466('0x31')]=_[_0x2466('0x32')](_0x55247d[_0x2466('0x2d')],qs['fields'](_0x169054[_0x2466('0x2e')][_0x2466('0x33')]));_0xc8de54[_0x2466('0x31')]=_0xc8de54[_0x2466('0x31')]['length']?_0xc8de54[_0x2466('0x31')]:_0x55247d['model'];if(!_0x169054[_0x2466('0x2e')][_0x2466('0x34')](_0x2466('0x35'))){_0xc8de54[_0x2466('0x36')]=qs[_0x2466('0x36')](_0x169054[_0x2466('0x2e')]['limit']);_0xc8de54[_0x2466('0x37')]=qs['offset'](_0x169054[_0x2466('0x2e')][_0x2466('0x37')]);}_0xc8de54[_0x2466('0x38')]=qs['sort'](_0x169054[_0x2466('0x2e')][_0x2466('0x39')]);_0xc8de54['where']=qs[_0x2466('0x30')](_[_0x2466('0x3a')](_0x169054[_0x2466('0x2e')],_0x55247d[_0x2466('0x30')]),_0x3c3112);if(_0x169054[_0x2466('0x2e')]['filter']){_0xc8de54[_0x2466('0x3b')]=_[_0x2466('0x3c')](_0xc8de54[_0x2466('0x3b')],{'$or':_['map'](_0x3c3112,function(_0x1fdcf3){if(_0x1fdcf3[_0x2466('0x2b')]!==_0x2466('0x3d')){var _0x210e57={};_0x210e57[_0x1fdcf3[_0x2466('0x25')]]={'$like':'%'+_0x169054[_0x2466('0x2e')][_0x2466('0x3e')]+'%'};return _0x210e57;}})});}_0xc8de54=_['merge']({},_0xc8de54,_0x169054[_0x2466('0x3f')]);var _0x5f2fef={'where':_0xc8de54[_0x2466('0x3b')]};return db[_0x2466('0x28')][_0x2466('0x1c')](_0x5f2fef)[_0x2466('0x22')](function(_0x54b581){_0x4b6891[_0x2466('0x1c')]=_0x54b581;if(_0x169054[_0x2466('0x2e')][_0x2466('0x40')]){_0xc8de54[_0x2466('0x41')]=[{'all':!![]}];}return db[_0x2466('0x28')][_0x2466('0x42')](_0xc8de54);})[_0x2466('0x22')](function(_0x185b53){_0x4b6891[_0x2466('0x43')]=_0x185b53;return _0x4b6891;})[_0x2466('0x22')](respondWithFilteredResult(_0x314162,_0xc8de54))['catch'](handleError(_0x314162,null));};exports[_0x2466('0x44')]=function(_0xb57c5c,_0x4312e9){var _0x53fb24={'raw':![],'where':{'id':_0xb57c5c[_0x2466('0x45')]['id']}},_0x53e5e0={};_0x53e5e0[_0x2466('0x2d')]=_[_0x2466('0x2f')](db['Dynamics365Configuration'][_0x2466('0x29')]);_0x53e5e0[_0x2466('0x2e')]=_['keys'](_0xb57c5c[_0x2466('0x2e')]);_0x53e5e0[_0x2466('0x30')]=_['intersection'](_0x53e5e0[_0x2466('0x2d')],_0x53e5e0[_0x2466('0x2e')]);_0x53fb24['attributes']=_[_0x2466('0x32')](_0x53e5e0[_0x2466('0x2d')],qs[_0x2466('0x33')](_0xb57c5c['query'][_0x2466('0x33')]));_0x53fb24['attributes']=_0x53fb24[_0x2466('0x31')]['length']?_0x53fb24[_0x2466('0x31')]:_0x53e5e0[_0x2466('0x2d')];if(_0xb57c5c[_0x2466('0x2e')][_0x2466('0x40')]){_0x53fb24['include']=[{'all':!![]}];}_0x53fb24=_[_0x2466('0x3c')]({},_0x53fb24,_0xb57c5c[_0x2466('0x3f')]);return db[_0x2466('0x28')][_0x2466('0x46')](_0x53fb24)[_0x2466('0x22')](handleEntityNotFound(_0x4312e9,null))[_0x2466('0x22')](respondWithResult(_0x4312e9,null))[_0x2466('0x47')](handleError(_0x4312e9,null));};exports['create']=function(_0x22a894,_0x4f4409){return db['Dynamics365Configuration'][_0x2466('0x48')](_0x22a894[_0x2466('0x49')],{})[_0x2466('0x22')](respondWithResult(_0x4f4409,0xc9))[_0x2466('0x47')](handleError(_0x4f4409,null));};exports[_0x2466('0x4a')]=function(_0x5c10e7,_0xdbaf25){if(_0x5c10e7[_0x2466('0x49')]['id']){delete _0x5c10e7['body']['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x5c10e7[_0x2466('0x45')]['id']}})['then'](handleEntityNotFound(_0xdbaf25,null))['then'](saveUpdates(_0x5c10e7['body'],null))[_0x2466('0x22')](respondWithResult(_0xdbaf25,null))[_0x2466('0x47')](handleError(_0xdbaf25,null));};exports['destroy']=function(_0x13d017,_0x334012){return db['Dynamics365Configuration'][_0x2466('0x46')]({'where':{'id':_0x13d017[_0x2466('0x45')]['id']}})[_0x2466('0x22')](handleEntityNotFound(_0x334012,null))['then'](removeEntity(_0x334012,null))[_0x2466('0x47')](handleError(_0x334012,null));};exports[_0x2466('0x4b')]=function(_0x331e65,_0xf234a4,_0x4cf091){var _0x2ef948={};var _0x4a7e6f={};var _0x3b76e0;var _0x48e75f;return db[_0x2466('0x28')]['findOne']({'where':{'id':_0x331e65[_0x2466('0x45')]['id']}})[_0x2466('0x22')](handleEntityNotFound(_0xf234a4,null))[_0x2466('0x22')](function(_0x280525){if(_0x280525){_0x3b76e0=_0x280525;_0x4a7e6f[_0x2466('0x2d')]=_[_0x2466('0x2f')](db['Dynamics365Field']['rawAttributes']);_0x4a7e6f[_0x2466('0x2e')]=_[_0x2466('0x2f')](_0x331e65['query']);_0x4a7e6f[_0x2466('0x30')]=_[_0x2466('0x32')](_0x4a7e6f['model'],_0x4a7e6f[_0x2466('0x2e')]);_0x2ef948[_0x2466('0x31')]=_['intersection'](_0x4a7e6f[_0x2466('0x2d')],qs[_0x2466('0x33')](_0x331e65['query'][_0x2466('0x33')]));_0x2ef948[_0x2466('0x31')]=_0x2ef948['attributes'][_0x2466('0x4c')]?_0x2ef948['attributes']:_0x4a7e6f[_0x2466('0x2d')];_0x2ef948['order']=qs[_0x2466('0x39')](_0x331e65[_0x2466('0x2e')]['sort']);_0x2ef948['where']=qs[_0x2466('0x30')](_[_0x2466('0x3a')](_0x331e65[_0x2466('0x2e')],_0x4a7e6f['filters']));if(_0x331e65[_0x2466('0x2e')]['filter']){_0x2ef948['where']=_[_0x2466('0x3c')](_0x2ef948[_0x2466('0x3b')],{'$or':_[_0x2466('0x27')](_0x2ef948['attributes'],function(_0x1b553e){var _0x3e131e={};_0x3e131e[_0x1b553e]={'$like':'%'+_0x331e65[_0x2466('0x2e')][_0x2466('0x3e')]+'%'};return _0x3e131e;})});}_0x2ef948=_[_0x2466('0x3c')]({},_0x2ef948,_0x331e65['options']);return _0x3b76e0[_0x2466('0x4b')](_0x2ef948);}})[_0x2466('0x22')](function(_0x5882e1){if(_0x5882e1){_0x48e75f=_0x5882e1[_0x2466('0x4c')];if(!_0x331e65[_0x2466('0x2e')]['hasOwnProperty'](_0x2466('0x35'))){_0x2ef948[_0x2466('0x36')]=qs[_0x2466('0x36')](_0x331e65[_0x2466('0x2e')][_0x2466('0x36')]);_0x2ef948[_0x2466('0x37')]=qs[_0x2466('0x37')](_0x331e65[_0x2466('0x2e')][_0x2466('0x37')]);}return _0x3b76e0[_0x2466('0x4b')](_0x2ef948);}})[_0x2466('0x22')](function(_0x33d837){if(_0x33d837){return _0x33d837?{'count':_0x48e75f,'rows':_0x33d837}:null;}})[_0x2466('0x22')](respondWithResult(_0xf234a4,null))['catch'](handleError(_0xf234a4,null));};exports[_0x2466('0x4d')]=function(_0x215177,_0x5eb15e,_0x79e5a6){var _0x5d9bdf={};var _0x5f51b1={};var _0x375f16;var _0x15e296;return db[_0x2466('0x28')]['findOne']({'where':{'id':_0x215177[_0x2466('0x45')]['id']}})[_0x2466('0x22')](handleEntityNotFound(_0x5eb15e,null))[_0x2466('0x22')](function(_0x3bd98f){if(_0x3bd98f){_0x375f16=_0x3bd98f;_0x5f51b1[_0x2466('0x2d')]=_['keys'](db['Dynamics365Field'][_0x2466('0x29')]);_0x5f51b1['query']=_[_0x2466('0x2f')](_0x215177[_0x2466('0x2e')]);_0x5f51b1[_0x2466('0x30')]=_[_0x2466('0x32')](_0x5f51b1[_0x2466('0x2d')],_0x5f51b1[_0x2466('0x2e')]);_0x5d9bdf[_0x2466('0x31')]=_[_0x2466('0x32')](_0x5f51b1[_0x2466('0x2d')],qs[_0x2466('0x33')](_0x215177[_0x2466('0x2e')][_0x2466('0x33')]));_0x5d9bdf[_0x2466('0x31')]=_0x5d9bdf['attributes']['length']?_0x5d9bdf['attributes']:_0x5f51b1['model'];_0x5d9bdf[_0x2466('0x38')]=qs[_0x2466('0x39')](_0x215177[_0x2466('0x2e')]['sort']);_0x5d9bdf['where']=qs[_0x2466('0x30')](_[_0x2466('0x3a')](_0x215177[_0x2466('0x2e')],_0x5f51b1['filters']));if(_0x215177[_0x2466('0x2e')][_0x2466('0x3e')]){_0x5d9bdf[_0x2466('0x3b')]=_['merge'](_0x5d9bdf[_0x2466('0x3b')],{'$or':_[_0x2466('0x27')](_0x5d9bdf[_0x2466('0x31')],function(_0x516580){var _0x2d80b5={};_0x2d80b5[_0x516580]={'$like':'%'+_0x215177[_0x2466('0x2e')][_0x2466('0x3e')]+'%'};return _0x2d80b5;})});}_0x5d9bdf=_[_0x2466('0x3c')]({},_0x5d9bdf,_0x215177[_0x2466('0x3f')]);return _0x375f16[_0x2466('0x4d')](_0x5d9bdf);}})['then'](function(_0x389a57){if(_0x389a57){_0x15e296=_0x389a57[_0x2466('0x4c')];if(!_0x215177[_0x2466('0x2e')]['hasOwnProperty'](_0x2466('0x35'))){_0x5d9bdf['limit']=qs[_0x2466('0x36')](_0x215177['query'][_0x2466('0x36')]);_0x5d9bdf[_0x2466('0x37')]=qs['offset'](_0x215177[_0x2466('0x2e')][_0x2466('0x37')]);}return _0x375f16[_0x2466('0x4d')](_0x5d9bdf);}})['then'](function(_0x110fcf){if(_0x110fcf){return _0x110fcf?{'count':_0x15e296,'rows':_0x110fcf}:null;}})[_0x2466('0x22')](respondWithResult(_0x5eb15e,null))[_0x2466('0x47')](handleError(_0x5eb15e,null));};exports[_0x2466('0x4e')]=function(_0x5b06a2,_0x2dd85a,_0x260fa8){var _0x157f4a={};var _0x31da00={};var _0xa9ce1f;var _0x5e7282;return db[_0x2466('0x28')][_0x2466('0x4f')]({'where':{'id':_0x5b06a2['params']['id']}})[_0x2466('0x22')](handleEntityNotFound(_0x2dd85a,null))[_0x2466('0x22')](function(_0x295226){if(_0x295226){_0xa9ce1f=_0x295226;_0x31da00[_0x2466('0x2d')]=_[_0x2466('0x2f')](db['Dynamics365Field']['rawAttributes']);_0x31da00[_0x2466('0x2e')]=_[_0x2466('0x2f')](_0x5b06a2[_0x2466('0x2e')]);_0x31da00[_0x2466('0x30')]=_['intersection'](_0x31da00[_0x2466('0x2d')],_0x31da00['query']);_0x157f4a['attributes']=_['intersection'](_0x31da00['model'],qs['fields'](_0x5b06a2[_0x2466('0x2e')]['fields']));_0x157f4a[_0x2466('0x31')]=_0x157f4a[_0x2466('0x31')][_0x2466('0x4c')]?_0x157f4a[_0x2466('0x31')]:_0x31da00[_0x2466('0x2d')];_0x157f4a['order']=qs[_0x2466('0x39')](_0x5b06a2[_0x2466('0x2e')][_0x2466('0x39')]);_0x157f4a[_0x2466('0x3b')]=qs['filters'](_[_0x2466('0x3a')](_0x5b06a2[_0x2466('0x2e')],_0x31da00[_0x2466('0x30')]));if(_0x5b06a2[_0x2466('0x2e')][_0x2466('0x3e')]){_0x157f4a[_0x2466('0x3b')]=_[_0x2466('0x3c')](_0x157f4a[_0x2466('0x3b')],{'$or':_[_0x2466('0x27')](_0x157f4a['attributes'],function(_0x5e964b){var _0x3a7fe6={};_0x3a7fe6[_0x5e964b]={'$like':'%'+_0x5b06a2[_0x2466('0x2e')][_0x2466('0x3e')]+'%'};return _0x3a7fe6;})});}_0x157f4a=_['merge']({},_0x157f4a,_0x5b06a2['options']);return _0xa9ce1f['getDescriptions'](_0x157f4a);}})[_0x2466('0x22')](function(_0x59794b){if(_0x59794b){_0x5e7282=_0x59794b[_0x2466('0x4c')];if(!_0x5b06a2[_0x2466('0x2e')][_0x2466('0x34')](_0x2466('0x35'))){_0x157f4a['limit']=qs[_0x2466('0x36')](_0x5b06a2[_0x2466('0x2e')][_0x2466('0x36')]);_0x157f4a[_0x2466('0x37')]=qs[_0x2466('0x37')](_0x5b06a2[_0x2466('0x2e')][_0x2466('0x37')]);}return _0xa9ce1f['getDescriptions'](_0x157f4a);}})[_0x2466('0x22')](function(_0x5ceabb){if(_0x5ceabb){return _0x5ceabb?{'count':_0x5e7282,'rows':_0x5ceabb}:null;}})[_0x2466('0x22')](respondWithResult(_0x2dd85a,null))['catch'](handleError(_0x2dd85a,null));}; \ No newline at end of file +var _0x0681=['update','then','destroy','error','stack','name','status','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','params','find','catch','create','body','getFields','findOne','Dynamics365Field','length','filter','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','util','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x521998,_0x481f37){var _0xc437e8=function(_0xb30d00){while(--_0xb30d00){_0x521998['push'](_0x521998['shift']());}};_0xc437e8(++_0x481f37);}(_0x0681,0x1f4));var _0x1068=function(_0x28f4c2,_0x1479c4){_0x28f4c2=_0x28f4c2-0x0;var _0x12d573=_0x0681[_0x28f4c2];return _0x12d573;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1068('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1068('0x1'));var rp=require(_0x1068('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1068('0x3'));var path=require('path');var sox=require(_0x1068('0x4'));var csv=require('to-csv');var ejs=require(_0x1068('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1068('0x6'));var crypto=require(_0x1068('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x1068('0x8'));var toCsv=require(_0x1068('0x9'));var querystring=require(_0x1068('0xa'));var Papa=require(_0x1068('0xb'));var Redis=require(_0x1068('0xc'));var authService=require(_0x1068('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x1068('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1068('0xf'))(_0x1068('0x10'));var utils=require(_0x1068('0x11'));var config=require(_0x1068('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x1068('0x13'))['db'];function respondWithStatusCode(_0xc8564a,_0x956a7b){_0x956a7b=_0x956a7b||0xcc;return function(_0x6d4b46){if(_0x6d4b46){return _0xc8564a[_0x1068('0x14')](_0x956a7b);}return _0xc8564a['status'](_0x956a7b)[_0x1068('0x15')]();};}function respondWithResult(_0x4b7774,_0x1114b2){_0x1114b2=_0x1114b2||0xc8;return function(_0x3cd0f9){if(_0x3cd0f9){return _0x4b7774['status'](_0x1114b2)[_0x1068('0x16')](_0x3cd0f9);}};}function respondWithFilteredResult(_0x52cf53,_0x3a9376){return function(_0x4b4aa8){if(_0x4b4aa8){var _0x4639e8=typeof _0x3a9376[_0x1068('0x17')]===_0x1068('0x18')&&typeof _0x3a9376[_0x1068('0x19')]==='undefined';var _0x1b83dd=_0x4b4aa8[_0x1068('0x1a')];var _0x5d696b=_0x4639e8?0x0:_0x3a9376['offset'];var _0x3138d0=_0x4639e8?_0x4b4aa8[_0x1068('0x1a')]:_0x3a9376[_0x1068('0x17')]+_0x3a9376[_0x1068('0x19')];var _0x58b041;if(_0x3138d0>=_0x1b83dd){_0x3138d0=_0x1b83dd;_0x58b041=0xc8;}else{_0x58b041=0xce;}_0x52cf53['status'](_0x58b041);return _0x52cf53[_0x1068('0x1b')](_0x1068('0x1c'),_0x5d696b+'-'+_0x3138d0+'/'+_0x1b83dd)[_0x1068('0x16')](_0x4b4aa8);}return null;};}function patchUpdates(_0x2870a2){return function(_0x56e7c3){try{jsonpatch[_0x1068('0x1d')](_0x56e7c3,_0x2870a2,!![]);}catch(_0x4c96ba){return BPromise[_0x1068('0x1e')](_0x4c96ba);}return _0x56e7c3[_0x1068('0x1f')]();};}function saveUpdates(_0x1e5a1f,_0x5414a0){return function(_0x3fb442){if(_0x3fb442){return _0x3fb442[_0x1068('0x20')](_0x1e5a1f)[_0x1068('0x21')](function(_0x3417d7){return _0x3417d7;});}return null;};}function removeEntity(_0x41ea67,_0x30f320){return function(_0x267891){if(_0x267891){return _0x267891[_0x1068('0x22')]()[_0x1068('0x21')](function(){_0x41ea67['status'](0xcc)[_0x1068('0x15')]();});}};}function handleEntityNotFound(_0xbb9c4e,_0x13bca2){return function(_0x2cc854){if(!_0x2cc854){_0xbb9c4e[_0x1068('0x14')](0x194);}return _0x2cc854;};}function handleError(_0xc2ae57,_0x430834){_0x430834=_0x430834||0x1f4;return function(_0x200bf9){logger[_0x1068('0x23')](_0x200bf9[_0x1068('0x24')]);if(_0x200bf9[_0x1068('0x25')]){delete _0x200bf9[_0x1068('0x25')];}_0xc2ae57[_0x1068('0x26')](_0x430834)['send'](_0x200bf9);};}exports[_0x1068('0x27')]=function(_0x13de8d,_0x3429b0){var _0x28a488={},_0x19a65e={},_0x23271c={'count':0x0,'rows':[]};var _0x5ee2fc=_[_0x1068('0x28')](db[_0x1068('0x29')][_0x1068('0x2a')],function(_0x48c56e){return{'name':_0x48c56e[_0x1068('0x2b')],'type':_0x48c56e[_0x1068('0x2c')]['key']};});_0x19a65e[_0x1068('0x2d')]=_[_0x1068('0x28')](_0x5ee2fc,_0x1068('0x25'));_0x19a65e[_0x1068('0x2e')]=_[_0x1068('0x2f')](_0x13de8d[_0x1068('0x2e')]);_0x19a65e[_0x1068('0x30')]=_[_0x1068('0x31')](_0x19a65e['model'],_0x19a65e[_0x1068('0x2e')]);_0x28a488[_0x1068('0x32')]=_[_0x1068('0x31')](_0x19a65e[_0x1068('0x2d')],qs[_0x1068('0x33')](_0x13de8d[_0x1068('0x2e')]['fields']));_0x28a488[_0x1068('0x32')]=_0x28a488[_0x1068('0x32')]['length']?_0x28a488['attributes']:_0x19a65e[_0x1068('0x2d')];if(!_0x13de8d[_0x1068('0x2e')][_0x1068('0x34')](_0x1068('0x35'))){_0x28a488[_0x1068('0x19')]=qs[_0x1068('0x19')](_0x13de8d['query'][_0x1068('0x19')]);_0x28a488[_0x1068('0x17')]=qs['offset'](_0x13de8d[_0x1068('0x2e')][_0x1068('0x17')]);}_0x28a488[_0x1068('0x36')]=qs[_0x1068('0x37')](_0x13de8d[_0x1068('0x2e')]['sort']);_0x28a488[_0x1068('0x38')]=qs[_0x1068('0x30')](_[_0x1068('0x39')](_0x13de8d['query'],_0x19a65e['filters']),_0x5ee2fc);if(_0x13de8d[_0x1068('0x2e')]['filter']){_0x28a488[_0x1068('0x38')]=_[_0x1068('0x3a')](_0x28a488[_0x1068('0x38')],{'$or':_[_0x1068('0x28')](_0x5ee2fc,function(_0xc976af){if(_0xc976af[_0x1068('0x2c')]!==_0x1068('0x3b')){var _0x50c23d={};_0x50c23d[_0xc976af[_0x1068('0x25')]]={'$like':'%'+_0x13de8d['query']['filter']+'%'};return _0x50c23d;}})});}_0x28a488=_[_0x1068('0x3a')]({},_0x28a488,_0x13de8d[_0x1068('0x3c')]);var _0x13df3f={'where':_0x28a488['where']};return db[_0x1068('0x29')][_0x1068('0x1a')](_0x13df3f)[_0x1068('0x21')](function(_0x5d2e96){_0x23271c[_0x1068('0x1a')]=_0x5d2e96;if(_0x13de8d[_0x1068('0x2e')][_0x1068('0x3d')]){_0x28a488['include']=[{'all':!![]}];}return db[_0x1068('0x29')][_0x1068('0x3e')](_0x28a488);})[_0x1068('0x21')](function(_0x1bf4bb){_0x23271c[_0x1068('0x3f')]=_0x1bf4bb;return _0x23271c;})['then'](respondWithFilteredResult(_0x3429b0,_0x28a488))['catch'](handleError(_0x3429b0,null));};exports['show']=function(_0x182026,_0x5345c7){var _0x259754={'raw':![],'where':{'id':_0x182026[_0x1068('0x40')]['id']}},_0x2bad3a={};_0x2bad3a['model']=_[_0x1068('0x2f')](db['Dynamics365Configuration'][_0x1068('0x2a')]);_0x2bad3a[_0x1068('0x2e')]=_[_0x1068('0x2f')](_0x182026[_0x1068('0x2e')]);_0x2bad3a['filters']=_[_0x1068('0x31')](_0x2bad3a['model'],_0x2bad3a[_0x1068('0x2e')]);_0x259754[_0x1068('0x32')]=_[_0x1068('0x31')](_0x2bad3a[_0x1068('0x2d')],qs['fields'](_0x182026[_0x1068('0x2e')]['fields']));_0x259754['attributes']=_0x259754[_0x1068('0x32')]['length']?_0x259754[_0x1068('0x32')]:_0x2bad3a['model'];if(_0x182026[_0x1068('0x2e')][_0x1068('0x3d')]){_0x259754['include']=[{'all':!![]}];}_0x259754=_['merge']({},_0x259754,_0x182026[_0x1068('0x3c')]);return db[_0x1068('0x29')][_0x1068('0x41')](_0x259754)[_0x1068('0x21')](handleEntityNotFound(_0x5345c7,null))[_0x1068('0x21')](respondWithResult(_0x5345c7,null))[_0x1068('0x42')](handleError(_0x5345c7,null));};exports[_0x1068('0x43')]=function(_0x5439bb,_0x1fcf1c){return db['Dynamics365Configuration'][_0x1068('0x43')](_0x5439bb['body'],{})[_0x1068('0x21')](respondWithResult(_0x1fcf1c,0xc9))['catch'](handleError(_0x1fcf1c,null));};exports['update']=function(_0x47c5a7,_0xcdaa31){if(_0x47c5a7[_0x1068('0x44')]['id']){delete _0x47c5a7[_0x1068('0x44')]['id'];}return db[_0x1068('0x29')][_0x1068('0x41')]({'where':{'id':_0x47c5a7['params']['id']}})['then'](handleEntityNotFound(_0xcdaa31,null))[_0x1068('0x21')](saveUpdates(_0x47c5a7['body'],null))[_0x1068('0x21')](respondWithResult(_0xcdaa31,null))[_0x1068('0x42')](handleError(_0xcdaa31,null));};exports[_0x1068('0x22')]=function(_0x2cc093,_0x39840f){return db[_0x1068('0x29')][_0x1068('0x41')]({'where':{'id':_0x2cc093[_0x1068('0x40')]['id']}})[_0x1068('0x21')](handleEntityNotFound(_0x39840f,null))[_0x1068('0x21')](removeEntity(_0x39840f,null))['catch'](handleError(_0x39840f,null));};exports[_0x1068('0x45')]=function(_0x1f2205,_0x2a43a4,_0x1b8b2d){var _0x54ebf8={};var _0x640b55={};var _0x1dc052;var _0x546b6f;return db[_0x1068('0x29')][_0x1068('0x46')]({'where':{'id':_0x1f2205[_0x1068('0x40')]['id']}})[_0x1068('0x21')](handleEntityNotFound(_0x2a43a4,null))[_0x1068('0x21')](function(_0x1c861f){if(_0x1c861f){_0x1dc052=_0x1c861f;_0x640b55[_0x1068('0x2d')]=_[_0x1068('0x2f')](db[_0x1068('0x47')]['rawAttributes']);_0x640b55[_0x1068('0x2e')]=_[_0x1068('0x2f')](_0x1f2205[_0x1068('0x2e')]);_0x640b55[_0x1068('0x30')]=_[_0x1068('0x31')](_0x640b55[_0x1068('0x2d')],_0x640b55[_0x1068('0x2e')]);_0x54ebf8[_0x1068('0x32')]=_[_0x1068('0x31')](_0x640b55[_0x1068('0x2d')],qs[_0x1068('0x33')](_0x1f2205['query'][_0x1068('0x33')]));_0x54ebf8[_0x1068('0x32')]=_0x54ebf8['attributes'][_0x1068('0x48')]?_0x54ebf8['attributes']:_0x640b55[_0x1068('0x2d')];_0x54ebf8[_0x1068('0x36')]=qs[_0x1068('0x37')](_0x1f2205['query']['sort']);_0x54ebf8[_0x1068('0x38')]=qs[_0x1068('0x30')](_[_0x1068('0x39')](_0x1f2205[_0x1068('0x2e')],_0x640b55[_0x1068('0x30')]));if(_0x1f2205[_0x1068('0x2e')][_0x1068('0x49')]){_0x54ebf8['where']=_[_0x1068('0x3a')](_0x54ebf8['where'],{'$or':_[_0x1068('0x28')](_0x54ebf8[_0x1068('0x32')],function(_0x18612e){var _0x3fa882={};_0x3fa882[_0x18612e]={'$like':'%'+_0x1f2205['query'][_0x1068('0x49')]+'%'};return _0x3fa882;})});}_0x54ebf8=_['merge']({},_0x54ebf8,_0x1f2205[_0x1068('0x3c')]);return _0x1dc052[_0x1068('0x45')](_0x54ebf8);}})[_0x1068('0x21')](function(_0x5c16f6){if(_0x5c16f6){_0x546b6f=_0x5c16f6['length'];if(!_0x1f2205['query']['hasOwnProperty'](_0x1068('0x35'))){_0x54ebf8['limit']=qs[_0x1068('0x19')](_0x1f2205[_0x1068('0x2e')][_0x1068('0x19')]);_0x54ebf8['offset']=qs[_0x1068('0x17')](_0x1f2205['query'][_0x1068('0x17')]);}return _0x1dc052[_0x1068('0x45')](_0x54ebf8);}})[_0x1068('0x21')](function(_0x4dae25){if(_0x4dae25){return _0x4dae25?{'count':_0x546b6f,'rows':_0x4dae25}:null;}})['then'](respondWithResult(_0x2a43a4,null))[_0x1068('0x42')](handleError(_0x2a43a4,null));};exports[_0x1068('0x4a')]=function(_0x496272,_0x248cf8,_0x438e9e){var _0x2ee98e={};var _0x3a3730={};var _0x18f027;var _0x45a237;return db[_0x1068('0x29')][_0x1068('0x46')]({'where':{'id':_0x496272[_0x1068('0x40')]['id']}})['then'](handleEntityNotFound(_0x248cf8,null))[_0x1068('0x21')](function(_0x3d680b){if(_0x3d680b){_0x18f027=_0x3d680b;_0x3a3730[_0x1068('0x2d')]=_['keys'](db[_0x1068('0x47')]['rawAttributes']);_0x3a3730[_0x1068('0x2e')]=_[_0x1068('0x2f')](_0x496272[_0x1068('0x2e')]);_0x3a3730[_0x1068('0x30')]=_[_0x1068('0x31')](_0x3a3730[_0x1068('0x2d')],_0x3a3730[_0x1068('0x2e')]);_0x2ee98e['attributes']=_['intersection'](_0x3a3730[_0x1068('0x2d')],qs[_0x1068('0x33')](_0x496272[_0x1068('0x2e')]['fields']));_0x2ee98e[_0x1068('0x32')]=_0x2ee98e[_0x1068('0x32')]['length']?_0x2ee98e[_0x1068('0x32')]:_0x3a3730[_0x1068('0x2d')];_0x2ee98e[_0x1068('0x36')]=qs[_0x1068('0x37')](_0x496272[_0x1068('0x2e')]['sort']);_0x2ee98e[_0x1068('0x38')]=qs[_0x1068('0x30')](_[_0x1068('0x39')](_0x496272[_0x1068('0x2e')],_0x3a3730['filters']));if(_0x496272['query'][_0x1068('0x49')]){_0x2ee98e['where']=_[_0x1068('0x3a')](_0x2ee98e[_0x1068('0x38')],{'$or':_[_0x1068('0x28')](_0x2ee98e[_0x1068('0x32')],function(_0x569642){var _0x2bc3ae={};_0x2bc3ae[_0x569642]={'$like':'%'+_0x496272[_0x1068('0x2e')][_0x1068('0x49')]+'%'};return _0x2bc3ae;})});}_0x2ee98e=_[_0x1068('0x3a')]({},_0x2ee98e,_0x496272[_0x1068('0x3c')]);return _0x18f027[_0x1068('0x4a')](_0x2ee98e);}})['then'](function(_0x41895a){if(_0x41895a){_0x45a237=_0x41895a[_0x1068('0x48')];if(!_0x496272['query']['hasOwnProperty']('nolimit')){_0x2ee98e['limit']=qs[_0x1068('0x19')](_0x496272[_0x1068('0x2e')][_0x1068('0x19')]);_0x2ee98e[_0x1068('0x17')]=qs[_0x1068('0x17')](_0x496272['query']['offset']);}return _0x18f027[_0x1068('0x4a')](_0x2ee98e);}})[_0x1068('0x21')](function(_0xe43c58){if(_0xe43c58){return _0xe43c58?{'count':_0x45a237,'rows':_0xe43c58}:null;}})[_0x1068('0x21')](respondWithResult(_0x248cf8,null))['catch'](handleError(_0x248cf8,null));};exports['getDescriptions']=function(_0x3b090c,_0x54ada4,_0x3fbb41){var _0x1bd29d={};var _0x334fae={};var _0x124a90;var _0x42daef;return db[_0x1068('0x29')][_0x1068('0x46')]({'where':{'id':_0x3b090c[_0x1068('0x40')]['id']}})[_0x1068('0x21')](handleEntityNotFound(_0x54ada4,null))[_0x1068('0x21')](function(_0x26fd65){if(_0x26fd65){_0x124a90=_0x26fd65;_0x334fae[_0x1068('0x2d')]=_[_0x1068('0x2f')](db[_0x1068('0x47')][_0x1068('0x2a')]);_0x334fae[_0x1068('0x2e')]=_[_0x1068('0x2f')](_0x3b090c[_0x1068('0x2e')]);_0x334fae[_0x1068('0x30')]=_[_0x1068('0x31')](_0x334fae['model'],_0x334fae[_0x1068('0x2e')]);_0x1bd29d[_0x1068('0x32')]=_[_0x1068('0x31')](_0x334fae['model'],qs[_0x1068('0x33')](_0x3b090c[_0x1068('0x2e')][_0x1068('0x33')]));_0x1bd29d[_0x1068('0x32')]=_0x1bd29d[_0x1068('0x32')][_0x1068('0x48')]?_0x1bd29d['attributes']:_0x334fae['model'];_0x1bd29d['order']=qs[_0x1068('0x37')](_0x3b090c['query'][_0x1068('0x37')]);_0x1bd29d[_0x1068('0x38')]=qs[_0x1068('0x30')](_['pick'](_0x3b090c[_0x1068('0x2e')],_0x334fae[_0x1068('0x30')]));if(_0x3b090c[_0x1068('0x2e')]['filter']){_0x1bd29d[_0x1068('0x38')]=_['merge'](_0x1bd29d[_0x1068('0x38')],{'$or':_['map'](_0x1bd29d[_0x1068('0x32')],function(_0x56b322){var _0x43c9c5={};_0x43c9c5[_0x56b322]={'$like':'%'+_0x3b090c[_0x1068('0x2e')]['filter']+'%'};return _0x43c9c5;})});}_0x1bd29d=_['merge']({},_0x1bd29d,_0x3b090c['options']);return _0x124a90[_0x1068('0x4b')](_0x1bd29d);}})['then'](function(_0xd5dc59){if(_0xd5dc59){_0x42daef=_0xd5dc59[_0x1068('0x48')];if(!_0x3b090c[_0x1068('0x2e')]['hasOwnProperty'](_0x1068('0x35'))){_0x1bd29d[_0x1068('0x19')]=qs[_0x1068('0x19')](_0x3b090c[_0x1068('0x2e')][_0x1068('0x19')]);_0x1bd29d['offset']=qs[_0x1068('0x17')](_0x3b090c['query'][_0x1068('0x17')]);}return _0x124a90[_0x1068('0x4b')](_0x1bd29d);}})['then'](function(_0x5dce1b){if(_0x5dce1b){return _0x5dce1b?{'count':_0x42daef,'rows':_0x5dce1b}:null;}})[_0x1068('0x21')](respondWithResult(_0x54ada4,null))[_0x1068('0x42')](handleError(_0x54ada4,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 673f3a2..5eb06bd 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['int_dynamics365_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0xff01d2,_0x55806d){var _0xde0945=function(_0x1423fe){while(--_0x1423fe){_0xff01d2['push'](_0xff01d2['shift']());}};_0xde0945(++_0x55806d);}(_0x70e0,0x17b));var _0x070e=function(_0x364ed2,_0x54a329){_0x364ed2=_0x364ed2-0x0;var _0x3333f9=_0x70e0[_0x364ed2];return _0x3333f9;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('Dynamics365Configuration',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b84=['moment','path','rimraf','../../config/environment','Dynamics365Configuration','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3be0c4,_0x5b7eff){_0x3be0c4=_0x3be0c4-0x0;var _0x11af9f=_0x4b84[_0x3be0c4];return _0x11af9f;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 24ea829..07a5165 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 _0x817b=['../../config/logger','rpc','../../config/environment','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x21830c,_0x5d6f6a){var _0x5efa39=function(_0x13d850){while(--_0x13d850){_0x21830c['push'](_0x21830c['shift']());}};_0x5efa39(++_0x5d6f6a);}(_0x817b,0x1a9));var _0xb817=function(_0x2c704c,_0x43be3c){_0x2c704c=_0x2c704c-0x0;var _0x24b747=_0x817b[_0x2c704c];return _0x24b747;};'use strict';var _=require(_0xb817('0x0'));var util=require(_0xb817('0x1'));var moment=require(_0xb817('0x2'));var BPromise=require(_0xb817('0x3'));var rs=require(_0xb817('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb817('0x5'))['db'];var utils=require(_0xb817('0x6'));var logger=require(_0xb817('0x7'))(_0xb817('0x8'));var config=require(_0xb817('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb817('0xa')][_0xb817('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e5d3,_0x4a1bb7,_0x56fd50){return new BPromise(function(_0x43ef94,_0x4a85bb){return client[_0xb817('0xc')](_0x4e5d3,_0x56fd50)[_0xb817('0xd')](function(_0x2a338c){logger['info'](_0xb817('0xe'),_0x4a1bb7,_0xb817('0xf'));logger[_0xb817('0x10')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x4a1bb7,_0xb817('0xf'),JSON[_0xb817('0x11')](_0x2a338c));if(_0x2a338c['error']){if(_0x2a338c[_0xb817('0x12')][_0xb817('0x13')]===0x1f4){logger['error'](_0xb817('0xe'),_0x4a1bb7,_0x2a338c[_0xb817('0x12')][_0xb817('0x14')]);return _0x4a85bb(_0x2a338c[_0xb817('0x12')][_0xb817('0x14')]);}logger[_0xb817('0x12')](_0xb817('0xe'),_0x4a1bb7,_0x2a338c[_0xb817('0x12')][_0xb817('0x14')]);return _0x43ef94(_0x2a338c[_0xb817('0x12')][_0xb817('0x14')]);}else{logger[_0xb817('0x15')](_0xb817('0xe'),_0x4a1bb7,_0xb817('0xf'));_0x43ef94(_0x2a338c[_0xb817('0x16')][_0xb817('0x14')]);}})[_0xb817('0x17')](function(_0x5f4ee8){logger['error'](_0xb817('0xe'),_0x4a1bb7,_0x5f4ee8);_0x4a85bb(_0x5f4ee8);});});} \ No newline at end of file +var _0x362e=['error','code','message','info','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1b593e,_0x199764){var _0x4a81ff=function(_0x5f4463){while(--_0x5f4463){_0x1b593e['push'](_0x1b593e['shift']());}};_0x4a81ff(++_0x199764);}(_0x362e,0x6f));var _0xe362=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0x362e[_0x1aba25];return _0x47d997;};'use strict';var _=require(_0xe362('0x0'));var util=require('util');var moment=require(_0xe362('0x1'));var BPromise=require('bluebird');var rs=require(_0xe362('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe362('0x3'))['db'];var utils=require(_0xe362('0x4'));var logger=require(_0xe362('0x5'))(_0xe362('0x6'));var config=require(_0xe362('0x7'));var jayson=require(_0xe362('0x8'));var client=jayson[_0xe362('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3243ff,_0x289159,_0x502419){return new BPromise(function(_0x57a752,_0x47c60e){return client['request'](_0x3243ff,_0x502419)[_0xe362('0xa')](function(_0x39963a){logger['info'](_0xe362('0xb'),_0x289159,_0xe362('0xc'));logger[_0xe362('0xd')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x289159,'request\x20sent',JSON[_0xe362('0xe')](_0x39963a));if(_0x39963a[_0xe362('0xf')]){if(_0x39963a['error'][_0xe362('0x10')]===0x1f4){logger[_0xe362('0xf')](_0xe362('0xb'),_0x289159,_0x39963a['error'][_0xe362('0x11')]);return _0x47c60e(_0x39963a[_0xe362('0xf')][_0xe362('0x11')]);}logger[_0xe362('0xf')](_0xe362('0xb'),_0x289159,_0x39963a[_0xe362('0xf')][_0xe362('0x11')]);return _0x57a752(_0x39963a[_0xe362('0xf')][_0xe362('0x11')]);}else{logger[_0xe362('0x12')](_0xe362('0xb'),_0x289159,_0xe362('0xc'));_0x57a752(_0x39963a[_0xe362('0x13')][_0xe362('0x11')]);}})[_0xe362('0x14')](function(_0xc1eb6d){logger['error'](_0xe362('0xb'),_0x289159,_0xc1eb6d);_0x47c60e(_0xc1eb6d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index f950442..9c95171 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 _0x2381=['exports','util','path','express','Router','fs-extra','../../components/auth/service','./intDynamics365Field.controller','get','isAuthenticated','/:id','post','create','delete'];(function(_0x2efed6,_0x4881e1){var _0xd9da51=function(_0x1e8dc6){while(--_0x1e8dc6){_0x2efed6['push'](_0x2efed6['shift']());}};_0xd9da51(++_0x4881e1);}(_0x2381,0x1cf));var _0x1238=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x2381[_0x5bd426];return _0x23a7eb;};'use strict';var multer=require('multer');var util=require(_0x1238('0x0'));var path=require(_0x1238('0x1'));var timeout=require('connect-timeout');var express=require(_0x1238('0x2'));var router=express[_0x1238('0x3')]();var fs_extra=require(_0x1238('0x4'));var auth=require(_0x1238('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1238('0x6'));router[_0x1238('0x7')]('/',auth[_0x1238('0x8')](),controller['index']);router[_0x1238('0x7')](_0x1238('0x9'),auth[_0x1238('0x8')](),controller['show']);router[_0x1238('0xa')]('/',auth[_0x1238('0x8')](),controller[_0x1238('0xb')]);router['put'](_0x1238('0x9'),auth[_0x1238('0x8')](),controller['update']);router[_0x1238('0xc')](_0x1238('0x9'),auth[_0x1238('0x8')](),controller['destroy']);module[_0x1238('0xd')]=router; \ No newline at end of file +var _0xec40=['connect-timeout','express','fs-extra','../../components/auth/service','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','path'];(function(_0x42f687,_0x558724){var _0x108838=function(_0x725814){while(--_0x725814){_0x42f687['push'](_0x42f687['shift']());}};_0x108838(++_0x558724);}(_0xec40,0x64));var _0x0ec4=function(_0x28c7a7,_0x55a356){_0x28c7a7=_0x28c7a7-0x0;var _0x50610f=_0xec40[_0x28c7a7];return _0x50610f;};'use strict';var multer=require(_0x0ec4('0x0'));var util=require('util');var path=require(_0x0ec4('0x1'));var timeout=require(_0x0ec4('0x2'));var express=require(_0x0ec4('0x3'));var router=express['Router']();var fs_extra=require(_0x0ec4('0x4'));var auth=require(_0x0ec4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0ec4('0x6'));router[_0x0ec4('0x7')]('/',auth['isAuthenticated'](),controller[_0x0ec4('0x8')]);router[_0x0ec4('0x7')](_0x0ec4('0x9'),auth[_0x0ec4('0xa')](),controller[_0x0ec4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0ec4('0xc')](_0x0ec4('0x9'),auth[_0x0ec4('0xa')](),controller[_0x0ec4('0xd')]);router[_0x0ec4('0xe')](_0x0ec4('0x9'),auth[_0x0ec4('0xa')](),controller[_0x0ec4('0xf')]);module[_0x0ec4('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index ff85587..5b5eaf5 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 _0x2dab=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue','picklist','STRING','variable'];(function(_0x4cafb1,_0x2954df){var _0x5d0869=function(_0x43667a){while(--_0x43667a){_0x4cafb1['push'](_0x4cafb1['shift']());}};_0x5d0869(++_0x2954df);}(_0x2dab,0x12e));var _0xb2da=function(_0xe18851,_0x12dee9){_0xe18851=_0xe18851-0x0;var _0x4522f2=_0x2dab[_0xe18851];return _0x4522f2;};'use strict';var Sequelize=require(_0xb2da('0x0'));module[_0xb2da('0x1')]={'type':{'type':Sequelize[_0xb2da('0x2')](_0xb2da('0x3'),'variable','customVariable',_0xb2da('0x4'),_0xb2da('0x5')),'defaultValue':_0xb2da('0x3')},'content':{'type':Sequelize[_0xb2da('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb2da('0x2')](_0xb2da('0x3'),_0xb2da('0x7'),_0xb2da('0x8'))},'keyContent':{'type':Sequelize[_0xb2da('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x68cb=['customVariable','keyValue','picklist','string','STRING','variable','BOOLEAN','sequelize','ENUM'];(function(_0x1ea053,_0x22aecc){var _0x444b08=function(_0x14576a){while(--_0x14576a){_0x1ea053['push'](_0x1ea053['shift']());}};_0x444b08(++_0x22aecc);}(_0x68cb,0x14b));var _0xb68c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x68cb[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xb68c('0x0'));module['exports']={'type':{'type':Sequelize[_0xb68c('0x1')]('string','variable',_0xb68c('0x2'),_0xb68c('0x3'),_0xb68c('0x4')),'defaultValue':_0xb68c('0x5')},'content':{'type':Sequelize[_0xb68c('0x6')]},'key':{'type':Sequelize[_0xb68c('0x6')]},'keyType':{'type':Sequelize[_0xb68c('0x1')]('string',_0xb68c('0x7'),_0xb68c('0x2'))},'keyContent':{'type':Sequelize[_0xb68c('0x6')]},'idField':{'type':Sequelize[_0xb68c('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb68c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb68c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index da0c5c7..f02cb14 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 _0x2607=['type','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','Dynamics365Field','fieldName'];(function(_0x411e71,_0xf9652){var _0x226ae3=function(_0x1339f6){while(--_0x1339f6){_0x411e71['push'](_0x411e71['shift']());}};_0x226ae3(++_0xf9652);}(_0x2607,0x69));var _0x7260=function(_0x70fd53,_0x2a95a6){_0x70fd53=_0x70fd53-0x0;var _0x4b71c5=_0x2607[_0x70fd53];return _0x4b71c5;};'use strict';var emlformat=require(_0x7260('0x0'));var rimraf=require(_0x7260('0x1'));var zipdir=require(_0x7260('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7260('0x3'));var moment=require(_0x7260('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7260('0x5'));var util=require(_0x7260('0x6'));var path=require('path');var sox=require(_0x7260('0x7'));var csv=require(_0x7260('0x8'));var ejs=require(_0x7260('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7260('0xa'));var squel=require(_0x7260('0xb'));var crypto=require(_0x7260('0xc'));var jsforce=require(_0x7260('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7260('0x8'));var querystring=require(_0x7260('0xe'));var Papa=require('papaparse');var Redis=require(_0x7260('0xf'));var authService=require(_0x7260('0x10'));var qs=require(_0x7260('0x11'));var as=require(_0x7260('0x12'));var hardwareService=require(_0x7260('0x13'));var logger=require(_0x7260('0x14'))(_0x7260('0x15'));var utils=require(_0x7260('0x16'));var config=require(_0x7260('0x17'));var licenseUtil=require(_0x7260('0x18'));var db=require(_0x7260('0x19'))['db'];function respondWithStatusCode(_0x5f3e21,_0x218712){_0x218712=_0x218712||0xcc;return function(_0x1ea9fb){if(_0x1ea9fb){return _0x5f3e21[_0x7260('0x1a')](_0x218712);}return _0x5f3e21[_0x7260('0x1b')](_0x218712)[_0x7260('0x1c')]();};}function respondWithResult(_0x6b659e,_0x39ba0f){_0x39ba0f=_0x39ba0f||0xc8;return function(_0x198ffc){if(_0x198ffc){return _0x6b659e[_0x7260('0x1b')](_0x39ba0f)[_0x7260('0x1d')](_0x198ffc);}};}function respondWithFilteredResult(_0x2d8be9,_0x165b47){return function(_0x5525e0){if(_0x5525e0){var _0x4c45ec=typeof _0x165b47[_0x7260('0x1e')]===_0x7260('0x1f')&&typeof _0x165b47[_0x7260('0x20')]===_0x7260('0x1f');var _0x413ff1=_0x5525e0['count'];var _0x29136d=_0x4c45ec?0x0:_0x165b47[_0x7260('0x1e')];var _0x2f6510=_0x4c45ec?_0x5525e0[_0x7260('0x21')]:_0x165b47[_0x7260('0x1e')]+_0x165b47[_0x7260('0x20')];var _0x55e650;if(_0x2f6510>=_0x413ff1){_0x2f6510=_0x413ff1;_0x55e650=0xc8;}else{_0x55e650=0xce;}_0x2d8be9[_0x7260('0x1b')](_0x55e650);return _0x2d8be9['set'](_0x7260('0x22'),_0x29136d+'-'+_0x2f6510+'/'+_0x413ff1)[_0x7260('0x1d')](_0x5525e0);}return null;};}function patchUpdates(_0x23d681){return function(_0x127beb){try{jsonpatch['apply'](_0x127beb,_0x23d681,!![]);}catch(_0x44a04c){return BPromise[_0x7260('0x23')](_0x44a04c);}return _0x127beb[_0x7260('0x24')]();};}function saveUpdates(_0x1e279e,_0x2821cc){return function(_0x258092){if(_0x258092){return _0x258092['update'](_0x1e279e)[_0x7260('0x25')](function(_0x59f4de){return _0x59f4de;});}return null;};}function removeEntity(_0x1aba40,_0xf080bb){return function(_0x11095d){if(_0x11095d){return _0x11095d[_0x7260('0x26')]()['then'](function(){_0x1aba40[_0x7260('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26378e,_0x504bb6){return function(_0x3d3f8a){if(!_0x3d3f8a){_0x26378e[_0x7260('0x1a')](0x194);}return _0x3d3f8a;};}function handleError(_0xe350e8,_0xa9d1f){_0xa9d1f=_0xa9d1f||0x1f4;return function(_0x3a492d){logger[_0x7260('0x27')](_0x3a492d[_0x7260('0x28')]);if(_0x3a492d['name']){delete _0x3a492d[_0x7260('0x29')];}_0xe350e8[_0x7260('0x1b')](_0xa9d1f)[_0x7260('0x2a')](_0x3a492d);};}exports[_0x7260('0x2b')]=function(_0x25f139,_0x33f479){var _0x59dee2={},_0x11209c={},_0x790b5a={'count':0x0,'rows':[]};var _0x61236c=_[_0x7260('0x2c')](db[_0x7260('0x2d')]['rawAttributes'],function(_0x437981){return{'name':_0x437981[_0x7260('0x2e')],'type':_0x437981[_0x7260('0x2f')][_0x7260('0x30')]};});_0x11209c[_0x7260('0x31')]=_[_0x7260('0x2c')](_0x61236c,_0x7260('0x29'));_0x11209c[_0x7260('0x32')]=_[_0x7260('0x33')](_0x25f139[_0x7260('0x32')]);_0x11209c[_0x7260('0x34')]=_[_0x7260('0x35')](_0x11209c['model'],_0x11209c[_0x7260('0x32')]);_0x59dee2[_0x7260('0x36')]=_[_0x7260('0x35')](_0x11209c['model'],qs['fields'](_0x25f139[_0x7260('0x32')]['fields']));_0x59dee2[_0x7260('0x36')]=_0x59dee2[_0x7260('0x36')]['length']?_0x59dee2[_0x7260('0x36')]:_0x11209c[_0x7260('0x31')];if(!_0x25f139['query']['hasOwnProperty'](_0x7260('0x37'))){_0x59dee2[_0x7260('0x20')]=qs['limit'](_0x25f139[_0x7260('0x32')][_0x7260('0x20')]);_0x59dee2[_0x7260('0x1e')]=qs[_0x7260('0x1e')](_0x25f139[_0x7260('0x32')][_0x7260('0x1e')]);}_0x59dee2[_0x7260('0x38')]=qs['sort'](_0x25f139[_0x7260('0x32')][_0x7260('0x39')]);_0x59dee2[_0x7260('0x3a')]=qs['filters'](_[_0x7260('0x3b')](_0x25f139[_0x7260('0x32')],_0x11209c[_0x7260('0x34')]),_0x61236c);if(_0x25f139[_0x7260('0x32')]['filter']){_0x59dee2[_0x7260('0x3a')]=_[_0x7260('0x3c')](_0x59dee2[_0x7260('0x3a')],{'$or':_[_0x7260('0x2c')](_0x61236c,function(_0x4b1264){if(_0x4b1264[_0x7260('0x2f')]!=='VIRTUAL'){var _0x5a21e4={};_0x5a21e4[_0x4b1264[_0x7260('0x29')]]={'$like':'%'+_0x25f139[_0x7260('0x32')][_0x7260('0x3d')]+'%'};return _0x5a21e4;}})});}_0x59dee2=_[_0x7260('0x3c')]({},_0x59dee2,_0x25f139[_0x7260('0x3e')]);var _0x20bda1={'where':_0x59dee2[_0x7260('0x3a')]};return db[_0x7260('0x2d')][_0x7260('0x21')](_0x20bda1)[_0x7260('0x25')](function(_0x47ad69){_0x790b5a[_0x7260('0x21')]=_0x47ad69;if(_0x25f139[_0x7260('0x32')][_0x7260('0x3f')]){_0x59dee2[_0x7260('0x40')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x7260('0x41')](_0x59dee2);})[_0x7260('0x25')](function(_0x44a541){_0x790b5a[_0x7260('0x42')]=_0x44a541;return _0x790b5a;})[_0x7260('0x25')](respondWithFilteredResult(_0x33f479,_0x59dee2))[_0x7260('0x43')](handleError(_0x33f479,null));};exports[_0x7260('0x44')]=function(_0x6f1dab,_0x254d34){var _0x47357a={'raw':!![],'where':{'id':_0x6f1dab[_0x7260('0x45')]['id']}},_0x26b5b5={};_0x26b5b5[_0x7260('0x31')]=_[_0x7260('0x33')](db[_0x7260('0x2d')][_0x7260('0x46')]);_0x26b5b5['query']=_[_0x7260('0x33')](_0x6f1dab[_0x7260('0x32')]);_0x26b5b5[_0x7260('0x34')]=_[_0x7260('0x35')](_0x26b5b5[_0x7260('0x31')],_0x26b5b5[_0x7260('0x32')]);_0x47357a[_0x7260('0x36')]=_[_0x7260('0x35')](_0x26b5b5[_0x7260('0x31')],qs['fields'](_0x6f1dab[_0x7260('0x32')][_0x7260('0x47')]));_0x47357a['attributes']=_0x47357a['attributes'][_0x7260('0x48')]?_0x47357a[_0x7260('0x36')]:_0x26b5b5[_0x7260('0x31')];if(_0x6f1dab[_0x7260('0x32')][_0x7260('0x3f')]){_0x47357a[_0x7260('0x40')]=[{'all':!![]}];}_0x47357a=_['merge']({},_0x47357a,_0x6f1dab['options']);return db[_0x7260('0x2d')][_0x7260('0x49')](_0x47357a)[_0x7260('0x25')](handleEntityNotFound(_0x254d34,null))[_0x7260('0x25')](respondWithResult(_0x254d34,null))[_0x7260('0x43')](handleError(_0x254d34,null));};exports['create']=function(_0x307128,_0x529648){return db['Dynamics365Field'][_0x7260('0x4a')](_0x307128[_0x7260('0x4b')],{})[_0x7260('0x25')](respondWithResult(_0x529648,0xc9))['catch'](handleError(_0x529648,null));};exports['update']=function(_0x1230b4,_0x2e7ec0){if(_0x1230b4[_0x7260('0x4b')]['id']){delete _0x1230b4[_0x7260('0x4b')]['id'];}return db[_0x7260('0x2d')][_0x7260('0x49')]({'where':{'id':_0x1230b4[_0x7260('0x45')]['id']}})[_0x7260('0x25')](handleEntityNotFound(_0x2e7ec0,null))[_0x7260('0x25')](saveUpdates(_0x1230b4[_0x7260('0x4b')],null))['then'](respondWithResult(_0x2e7ec0,null))['catch'](handleError(_0x2e7ec0,null));};exports[_0x7260('0x26')]=function(_0xe19f82,_0x56588e){return db[_0x7260('0x2d')][_0x7260('0x49')]({'where':{'id':_0xe19f82['params']['id']}})[_0x7260('0x25')](handleEntityNotFound(_0x56588e,null))[_0x7260('0x25')](removeEntity(_0x56588e,null))[_0x7260('0x43')](handleError(_0x56588e,null));}; \ No newline at end of file +var _0xe5d1=['show','params','keys','find','catch','body','eml-format','zip-dir','fast-json-patch','bluebird','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','VIRTUAL','merge','options','count','includeAll','include','Dynamics365Field','findAll','rows'];(function(_0x55deec,_0x130e1f){var _0x2a071a=function(_0x292388){while(--_0x292388){_0x55deec['push'](_0x55deec['shift']());}};_0x2a071a(++_0x130e1f);}(_0xe5d1,0x12e));var _0x1e5d=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xe5d1[_0x3070dc];return _0x431489;};'use strict';var emlformat=require(_0x1e5d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e5d('0x1'));var jsonpatch=require(_0x1e5d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1e5d('0x3'));var Mustache=require('mustache');var util=require(_0x1e5d('0x4'));var path=require(_0x1e5d('0x5'));var sox=require(_0x1e5d('0x6'));var csv=require(_0x1e5d('0x7'));var ejs=require(_0x1e5d('0x8'));var fs=require('fs');var fs_extra=require(_0x1e5d('0x9'));var _=require(_0x1e5d('0xa'));var squel=require(_0x1e5d('0xb'));var crypto=require(_0x1e5d('0xc'));var jsforce=require(_0x1e5d('0xd'));var deskjs=require(_0x1e5d('0xe'));var toCsv=require(_0x1e5d('0x7'));var querystring=require(_0x1e5d('0xf'));var Papa=require(_0x1e5d('0x10'));var Redis=require(_0x1e5d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1e5d('0x12'));var as=require(_0x1e5d('0x13'));var hardwareService=require(_0x1e5d('0x14'));var logger=require(_0x1e5d('0x15'))(_0x1e5d('0x16'));var utils=require(_0x1e5d('0x17'));var config=require(_0x1e5d('0x18'));var licenseUtil=require(_0x1e5d('0x19'));var db=require(_0x1e5d('0x1a'))['db'];function respondWithStatusCode(_0x4fa4c4,_0x4347c8){_0x4347c8=_0x4347c8||0xcc;return function(_0x1c1124){if(_0x1c1124){return _0x4fa4c4[_0x1e5d('0x1b')](_0x4347c8);}return _0x4fa4c4['status'](_0x4347c8)[_0x1e5d('0x1c')]();};}function respondWithResult(_0x5667ea,_0x4c2592){_0x4c2592=_0x4c2592||0xc8;return function(_0x20288c){if(_0x20288c){return _0x5667ea[_0x1e5d('0x1d')](_0x4c2592)[_0x1e5d('0x1e')](_0x20288c);}};}function respondWithFilteredResult(_0x387152,_0x15e936){return function(_0x198c60){if(_0x198c60){var _0x3c2584=typeof _0x15e936[_0x1e5d('0x1f')]==='undefined'&&typeof _0x15e936[_0x1e5d('0x20')]==='undefined';var _0x1695d0=_0x198c60['count'];var _0x1fcdd2=_0x3c2584?0x0:_0x15e936['offset'];var _0x30ac7b=_0x3c2584?_0x198c60['count']:_0x15e936[_0x1e5d('0x1f')]+_0x15e936[_0x1e5d('0x20')];var _0x1faf77;if(_0x30ac7b>=_0x1695d0){_0x30ac7b=_0x1695d0;_0x1faf77=0xc8;}else{_0x1faf77=0xce;}_0x387152['status'](_0x1faf77);return _0x387152['set']('Content-Range',_0x1fcdd2+'-'+_0x30ac7b+'/'+_0x1695d0)[_0x1e5d('0x1e')](_0x198c60);}return null;};}function patchUpdates(_0x50bb82){return function(_0x315e8a){try{jsonpatch[_0x1e5d('0x21')](_0x315e8a,_0x50bb82,!![]);}catch(_0x7f82f0){return BPromise[_0x1e5d('0x22')](_0x7f82f0);}return _0x315e8a[_0x1e5d('0x23')]();};}function saveUpdates(_0x2ec801,_0x3355a2){return function(_0x438bc7){if(_0x438bc7){return _0x438bc7[_0x1e5d('0x24')](_0x2ec801)[_0x1e5d('0x25')](function(_0x40dae5){return _0x40dae5;});}return null;};}function removeEntity(_0x338f79,_0x43762f){return function(_0x3afe17){if(_0x3afe17){return _0x3afe17[_0x1e5d('0x26')]()[_0x1e5d('0x25')](function(){_0x338f79[_0x1e5d('0x1d')](0xcc)[_0x1e5d('0x1c')]();});}};}function handleEntityNotFound(_0x3d8467,_0x3821a2){return function(_0x21766d){if(!_0x21766d){_0x3d8467[_0x1e5d('0x1b')](0x194);}return _0x21766d;};}function handleError(_0x4186a8,_0x42ef2f){_0x42ef2f=_0x42ef2f||0x1f4;return function(_0x456246){logger[_0x1e5d('0x27')](_0x456246[_0x1e5d('0x28')]);if(_0x456246[_0x1e5d('0x29')]){delete _0x456246[_0x1e5d('0x29')];}_0x4186a8[_0x1e5d('0x1d')](_0x42ef2f)[_0x1e5d('0x2a')](_0x456246);};}exports[_0x1e5d('0x2b')]=function(_0x16f028,_0x23de16){var _0x3eee0b={},_0x37e71f={},_0x45a813={'count':0x0,'rows':[]};var _0x295028=_[_0x1e5d('0x2c')](db['Dynamics365Field'][_0x1e5d('0x2d')],function(_0x2bd480){return{'name':_0x2bd480['fieldName'],'type':_0x2bd480[_0x1e5d('0x2e')]['key']};});_0x37e71f[_0x1e5d('0x2f')]=_['map'](_0x295028,_0x1e5d('0x29'));_0x37e71f[_0x1e5d('0x30')]=_['keys'](_0x16f028[_0x1e5d('0x30')]);_0x37e71f['filters']=_[_0x1e5d('0x31')](_0x37e71f[_0x1e5d('0x2f')],_0x37e71f['query']);_0x3eee0b[_0x1e5d('0x32')]=_['intersection'](_0x37e71f['model'],qs[_0x1e5d('0x33')](_0x16f028[_0x1e5d('0x30')][_0x1e5d('0x33')]));_0x3eee0b[_0x1e5d('0x32')]=_0x3eee0b[_0x1e5d('0x32')][_0x1e5d('0x34')]?_0x3eee0b[_0x1e5d('0x32')]:_0x37e71f[_0x1e5d('0x2f')];if(!_0x16f028[_0x1e5d('0x30')][_0x1e5d('0x35')]('nolimit')){_0x3eee0b['limit']=qs['limit'](_0x16f028[_0x1e5d('0x30')][_0x1e5d('0x20')]);_0x3eee0b[_0x1e5d('0x1f')]=qs[_0x1e5d('0x1f')](_0x16f028[_0x1e5d('0x30')]['offset']);}_0x3eee0b[_0x1e5d('0x36')]=qs[_0x1e5d('0x37')](_0x16f028['query'][_0x1e5d('0x37')]);_0x3eee0b['where']=qs['filters'](_['pick'](_0x16f028['query'],_0x37e71f[_0x1e5d('0x38')]),_0x295028);if(_0x16f028[_0x1e5d('0x30')][_0x1e5d('0x39')]){_0x3eee0b[_0x1e5d('0x3a')]=_['merge'](_0x3eee0b[_0x1e5d('0x3a')],{'$or':_[_0x1e5d('0x2c')](_0x295028,function(_0xe02196){if(_0xe02196[_0x1e5d('0x2e')]!==_0x1e5d('0x3b')){var _0x298cc9={};_0x298cc9[_0xe02196[_0x1e5d('0x29')]]={'$like':'%'+_0x16f028[_0x1e5d('0x30')][_0x1e5d('0x39')]+'%'};return _0x298cc9;}})});}_0x3eee0b=_[_0x1e5d('0x3c')]({},_0x3eee0b,_0x16f028[_0x1e5d('0x3d')]);var _0x24fb8f={'where':_0x3eee0b['where']};return db['Dynamics365Field'][_0x1e5d('0x3e')](_0x24fb8f)['then'](function(_0x19c058){_0x45a813[_0x1e5d('0x3e')]=_0x19c058;if(_0x16f028[_0x1e5d('0x30')][_0x1e5d('0x3f')]){_0x3eee0b[_0x1e5d('0x40')]=[{'all':!![]}];}return db[_0x1e5d('0x41')][_0x1e5d('0x42')](_0x3eee0b);})[_0x1e5d('0x25')](function(_0x23c94c){_0x45a813[_0x1e5d('0x43')]=_0x23c94c;return _0x45a813;})[_0x1e5d('0x25')](respondWithFilteredResult(_0x23de16,_0x3eee0b))['catch'](handleError(_0x23de16,null));};exports[_0x1e5d('0x44')]=function(_0x121a88,_0x561a40){var _0x2ba78f={'raw':!![],'where':{'id':_0x121a88[_0x1e5d('0x45')]['id']}},_0x4c58b3={};_0x4c58b3['model']=_[_0x1e5d('0x46')](db[_0x1e5d('0x41')]['rawAttributes']);_0x4c58b3[_0x1e5d('0x30')]=_[_0x1e5d('0x46')](_0x121a88[_0x1e5d('0x30')]);_0x4c58b3[_0x1e5d('0x38')]=_[_0x1e5d('0x31')](_0x4c58b3[_0x1e5d('0x2f')],_0x4c58b3[_0x1e5d('0x30')]);_0x2ba78f[_0x1e5d('0x32')]=_[_0x1e5d('0x31')](_0x4c58b3['model'],qs['fields'](_0x121a88[_0x1e5d('0x30')][_0x1e5d('0x33')]));_0x2ba78f[_0x1e5d('0x32')]=_0x2ba78f[_0x1e5d('0x32')][_0x1e5d('0x34')]?_0x2ba78f['attributes']:_0x4c58b3[_0x1e5d('0x2f')];if(_0x121a88['query'][_0x1e5d('0x3f')]){_0x2ba78f[_0x1e5d('0x40')]=[{'all':!![]}];}_0x2ba78f=_['merge']({},_0x2ba78f,_0x121a88[_0x1e5d('0x3d')]);return db[_0x1e5d('0x41')][_0x1e5d('0x47')](_0x2ba78f)[_0x1e5d('0x25')](handleEntityNotFound(_0x561a40,null))[_0x1e5d('0x25')](respondWithResult(_0x561a40,null))[_0x1e5d('0x48')](handleError(_0x561a40,null));};exports['create']=function(_0x59ef06,_0x51abf4){return db[_0x1e5d('0x41')]['create'](_0x59ef06[_0x1e5d('0x49')],{})[_0x1e5d('0x25')](respondWithResult(_0x51abf4,0xc9))[_0x1e5d('0x48')](handleError(_0x51abf4,null));};exports['update']=function(_0x2470f1,_0x5afdba){if(_0x2470f1[_0x1e5d('0x49')]['id']){delete _0x2470f1[_0x1e5d('0x49')]['id'];}return db[_0x1e5d('0x41')][_0x1e5d('0x47')]({'where':{'id':_0x2470f1[_0x1e5d('0x45')]['id']}})[_0x1e5d('0x25')](handleEntityNotFound(_0x5afdba,null))['then'](saveUpdates(_0x2470f1[_0x1e5d('0x49')],null))['then'](respondWithResult(_0x5afdba,null))[_0x1e5d('0x48')](handleError(_0x5afdba,null));};exports[_0x1e5d('0x26')]=function(_0x4d8087,_0x6c1998){return db[_0x1e5d('0x41')][_0x1e5d('0x47')]({'where':{'id':_0x4d8087[_0x1e5d('0x45')]['id']}})[_0x1e5d('0x25')](handleEntityNotFound(_0x6c1998,null))[_0x1e5d('0x25')](removeEntity(_0x6c1998,null))['catch'](handleError(_0x6c1998,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 5c0715c..127d948 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 _0xfc09=['dynamics365_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0xfc09,0xa8));var _0x9fc0=function(_0x1935e1,_0xdaca61){_0x1935e1=_0x1935e1-0x0;var _0x132b50=_0xfc09[_0x1935e1];return _0x132b50;};'use strict';var _=require(_0x9fc0('0x0'));var util=require(_0x9fc0('0x1'));var logger=require('../../config/logger')(_0x9fc0('0x2'));var moment=require(_0x9fc0('0x3'));var BPromise=require(_0x9fc0('0x4'));var rp=require(_0x9fc0('0x5'));var fs=require('fs');var path=require(_0x9fc0('0x6'));var rimraf=require(_0x9fc0('0x7'));var config=require('../../config/environment');var attributes=require(_0x9fc0('0x8'));module[_0x9fc0('0x9')]=function(_0x5d4d3f,_0x134064){return _0x5d4d3f['define'](_0x9fc0('0xa'),attributes,{'tableName':_0x9fc0('0xb'),'paranoid':![],'indexes':[{'name':_0x9fc0('0xc'),'fields':[_0x9fc0('0xd'),_0x9fc0('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdfef=['../../config/logger','api','moment','request-promise','rimraf','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xdfef,0x1cc));var _0xfdfe=function(_0x2caaa7,_0x360cf4){_0x2caaa7=_0x2caaa7-0x0;var _0x493016=_0xdfef[_0x2caaa7];return _0x493016;};'use strict';var _=require(_0xfdfe('0x0'));var util=require(_0xfdfe('0x1'));var logger=require(_0xfdfe('0x2'))(_0xfdfe('0x3'));var moment=require(_0xfdfe('0x4'));var BPromise=require('bluebird');var rp=require(_0xfdfe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfdfe('0x6'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0xfdfe('0x7')]=function(_0x24b407,_0x489187){return _0x24b407[_0xfdfe('0x8')](_0xfdfe('0x9'),attributes,{'tableName':_0xfdfe('0xa'),'paranoid':![],'indexes':[{'name':_0xfdfe('0xb'),'fields':[_0xfdfe('0xc'),_0xfdfe('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 4ef1bab..e60c4d9 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 _0xfeb3=['error','code','message','result','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x108866,_0x5c6e14){var _0x53e5db=function(_0x23bc23){while(--_0x23bc23){_0x108866['push'](_0x108866['shift']());}};_0x53e5db(++_0x5c6e14);}(_0xfeb3,0xca));var _0x3feb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfeb3[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x3feb('0x0'));var util=require(_0x3feb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3feb('0x2'));var db=require(_0x3feb('0x3'))['db'];var utils=require(_0x3feb('0x4'));var logger=require(_0x3feb('0x5'))(_0x3feb('0x6'));var config=require('../../config/environment');var jayson=require(_0x3feb('0x7'));var client=jayson[_0x3feb('0x8')][_0x3feb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x240752,_0x4b0262,_0x3deb89){return new BPromise(function(_0x36ea16,_0x13d622){return client['request'](_0x240752,_0x3deb89)['then'](function(_0x3529de){logger[_0x3feb('0xa')](_0x3feb('0xb'),_0x4b0262,'request\x20sent');logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4b0262,_0x3feb('0xc'),JSON[_0x3feb('0xd')](_0x3529de));if(_0x3529de['error']){if(_0x3529de[_0x3feb('0xe')][_0x3feb('0xf')]===0x1f4){logger[_0x3feb('0xe')](_0x3feb('0xb'),_0x4b0262,_0x3529de[_0x3feb('0xe')][_0x3feb('0x10')]);return _0x13d622(_0x3529de[_0x3feb('0xe')][_0x3feb('0x10')]);}logger['error'](_0x3feb('0xb'),_0x4b0262,_0x3529de[_0x3feb('0xe')][_0x3feb('0x10')]);return _0x36ea16(_0x3529de[_0x3feb('0xe')][_0x3feb('0x10')]);}else{logger['info'](_0x3feb('0xb'),_0x4b0262,_0x3feb('0xc'));_0x36ea16(_0x3529de[_0x3feb('0x11')][_0x3feb('0x10')]);}})['catch'](function(_0x557551){logger[_0x3feb('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x4b0262,_0x557551);_0x13d622(_0x557551);});});} \ No newline at end of file +var _0xcf4e=['request\x20sent','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x57fc2a,_0x14bbe5){var _0xa839b=function(_0x26572c){while(--_0x26572c){_0x57fc2a['push'](_0x57fc2a['shift']());}};_0xa839b(++_0x14bbe5);}(_0xcf4e,0x191));var _0xecf4=function(_0x36dd33,_0x24bc83){_0x36dd33=_0x36dd33-0x0;var _0x573813=_0xcf4e[_0x36dd33];return _0x573813;};'use strict';var _=require(_0xecf4('0x0'));var util=require(_0xecf4('0x1'));var moment=require(_0xecf4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecf4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xecf4('0x4'));var logger=require(_0xecf4('0x5'))(_0xecf4('0x6'));var config=require('../../config/environment');var jayson=require(_0xecf4('0x7'));var client=jayson[_0xecf4('0x8')][_0xecf4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x251c24,_0x599eff,_0x642d6b){return new BPromise(function(_0x54b8a4,_0x36a295){return client['request'](_0x251c24,_0x642d6b)['then'](function(_0x519b98){logger[_0xecf4('0xa')](_0xecf4('0xb'),_0x599eff,'request\x20sent');logger['debug'](_0xecf4('0xc'),_0x599eff,_0xecf4('0xd'),JSON['stringify'](_0x519b98));if(_0x519b98[_0xecf4('0xe')]){if(_0x519b98['error']['code']===0x1f4){logger[_0xecf4('0xe')](_0xecf4('0xb'),_0x599eff,_0x519b98['error'][_0xecf4('0xf')]);return _0x36a295(_0x519b98[_0xecf4('0xe')]['message']);}logger[_0xecf4('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x599eff,_0x519b98[_0xecf4('0xe')][_0xecf4('0xf')]);return _0x54b8a4(_0x519b98['error'][_0xecf4('0xf')]);}else{logger[_0xecf4('0xa')](_0xecf4('0xb'),_0x599eff,'request\x20sent');_0x54b8a4(_0x519b98[_0xecf4('0x10')][_0xecf4('0xf')]);}})[_0xecf4('0x11')](function(_0x4a1214){logger[_0xecf4('0xe')](_0xecf4('0xb'),_0x599eff,_0x4a1214);_0x36a295(_0x4a1214);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index dd2c78c..981265e 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 _0x2abc=['getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','isAuthenticated','get','/:id','/:id/configurations','getConfigurations','/:id/fields'];(function(_0xc5e02a,_0xd9da3c){var _0xbeca77=function(_0x2a7d11){while(--_0x2a7d11){_0xc5e02a['push'](_0xc5e02a['shift']());}};_0xbeca77(++_0xd9da3c);}(_0x2abc,0xe4));var _0xc2ab=function(_0x293880,_0x444dd1){_0x293880=_0x293880-0x0;var _0x478d27=_0x2abc[_0x293880];return _0x478d27;};'use strict';var multer=require(_0xc2ab('0x0'));var util=require(_0xc2ab('0x1'));var path=require(_0xc2ab('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc2ab('0x3')]();var fs_extra=require(_0xc2ab('0x4'));var auth=require(_0xc2ab('0x5'));var interaction=require(_0xc2ab('0x6'));var config=require('../../config/environment');var controller=require(_0xc2ab('0x7'));router['get']('/',auth[_0xc2ab('0x8')](),controller['index']);router[_0xc2ab('0x9')](_0xc2ab('0xa'),auth[_0xc2ab('0x8')](),controller['show']);router[_0xc2ab('0x9')](_0xc2ab('0xb'),auth[_0xc2ab('0x8')](),controller[_0xc2ab('0xc')]);router['get'](_0xc2ab('0xd'),auth[_0xc2ab('0x8')](),controller[_0xc2ab('0xe')]);router[_0xc2ab('0xf')]('/',auth[_0xc2ab('0x8')](),controller['create']);router[_0xc2ab('0xf')](_0xc2ab('0xb'),auth['isAuthenticated'](),controller[_0xc2ab('0x10')]);router[_0xc2ab('0x11')](_0xc2ab('0xa'),auth['isAuthenticated'](),controller[_0xc2ab('0x12')]);router[_0xc2ab('0x13')](_0xc2ab('0xa'),auth['isAuthenticated'](),controller[_0xc2ab('0x14')]);module[_0xc2ab('0x15')]=router; \ No newline at end of file +var _0x4ae2=['path','connect-timeout','Router','fs-extra','../../components/auth/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x4d837c,_0x221707){var _0x2dcb6a=function(_0x393a35){while(--_0x393a35){_0x4d837c['push'](_0x4d837c['shift']());}};_0x2dcb6a(++_0x221707);}(_0x4ae2,0x133));var _0x24ae=function(_0x408758,_0x548c1f){_0x408758=_0x408758-0x0;var _0x2e25ae=_0x4ae2[_0x408758];return _0x2e25ae;};'use strict';var multer=require(_0x24ae('0x0'));var util=require('util');var path=require(_0x24ae('0x1'));var timeout=require(_0x24ae('0x2'));var express=require('express');var router=express[_0x24ae('0x3')]();var fs_extra=require(_0x24ae('0x4'));var auth=require(_0x24ae('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x24ae('0x6'));router[_0x24ae('0x7')]('/',auth[_0x24ae('0x8')](),controller[_0x24ae('0x9')]);router[_0x24ae('0x7')](_0x24ae('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x24ae('0x7')](_0x24ae('0xb'),auth[_0x24ae('0x8')](),controller[_0x24ae('0xc')]);router[_0x24ae('0x7')]('/:id/fields',auth[_0x24ae('0x8')](),controller[_0x24ae('0xd')]);router[_0x24ae('0xe')]('/',auth['isAuthenticated'](),controller[_0x24ae('0xf')]);router['post']('/:id/configurations',auth[_0x24ae('0x8')](),controller[_0x24ae('0x10')]);router[_0x24ae('0x11')](_0x24ae('0xa'),auth[_0x24ae('0x8')](),controller[_0x24ae('0x12')]);router[_0x24ae('0x13')](_0x24ae('0xa'),auth['isAuthenticated'](),controller[_0x24ae('0x14')]);module[_0x24ae('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 8cc7aac..bd9f154 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 _0xef0f=['sequelize','STRING','remoteUri'];(function(_0xcb5f3c,_0x3f602c){var _0x1056e0=function(_0x31473f){while(--_0x31473f){_0xcb5f3c['push'](_0xcb5f3c['shift']());}};_0x1056e0(++_0x3f602c);}(_0xef0f,0x168));var _0xfef0=function(_0x170cb7,_0x209645){_0x170cb7=_0x170cb7-0x0;var _0x54fad9=_0xef0f[_0x170cb7];return _0x54fad9;};'use strict';var Sequelize=require(_0xfef0('0x0'));module['exports']={'name':{'type':Sequelize[_0xfef0('0x1')]},'description':{'type':Sequelize[_0xfef0('0x1')]},'username':{'type':Sequelize[_0xfef0('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xfef0('0x1')]},'remoteUri':{'type':Sequelize[_0xfef0('0x1')],'unique':_0xfef0('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4e2e=['username','remoteUri','exports','STRING'];(function(_0xe6dfeb,_0x9f06df){var _0x1e05c6=function(_0x1ae114){while(--_0x1ae114){_0xe6dfeb['push'](_0xe6dfeb['shift']());}};_0x1e05c6(++_0x9f06df);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x258e88,_0x56f568){_0x258e88=_0x258e88-0x0;var _0x5f5856=_0x4e2e[_0x258e88];return _0x5f5856;};'use strict';var Sequelize=require('sequelize');module[_0xe4e2('0x0')]={'name':{'type':Sequelize[_0xe4e2('0x1')]},'description':{'type':Sequelize[_0xe4e2('0x1')]},'username':{'type':Sequelize[_0xe4e2('0x1')],'unique':_0xe4e2('0x2')},'apiKey':{'type':Sequelize[_0xe4e2('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe4e2('0x3')},'serverUrl':{'type':Sequelize[_0xe4e2('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 3afa516..ae73dea 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 _0x4d6e=['stringify','send','test','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','end','error','index','map','fieldName','key','model','name','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','type','options','FreshdeskAccount','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','destroy','params','getConfigurations','FreshdeskConfiguration','sort','addConfiguration','findOne','AccountId','channel','getDescriptions','Subjects','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','agent','priority','group','ticket_type','company','remove','includes','default','custom_text','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x591db7,_0x150445){var _0x4ad760=function(_0x5dd24e){while(--_0x5dd24e){_0x591db7['push'](_0x591db7['shift']());}};_0x4ad760(++_0x150445);}(_0x4d6e,0x77));var _0xe4d6=function(_0x595add,_0x15feb9){_0x595add=_0x595add-0x0;var _0x52eb1a=_0x4d6e[_0x595add];return _0x52eb1a;};'use strict';var emlformat=require(_0xe4d6('0x0'));var rimraf=require(_0xe4d6('0x1'));var zipdir=require(_0xe4d6('0x2'));var jsonpatch=require(_0xe4d6('0x3'));var rp=require(_0xe4d6('0x4'));var moment=require('moment');var BPromise=require(_0xe4d6('0x5'));var Mustache=require(_0xe4d6('0x6'));var util=require(_0xe4d6('0x7'));var path=require(_0xe4d6('0x8'));var sox=require(_0xe4d6('0x9'));var csv=require(_0xe4d6('0xa'));var ejs=require(_0xe4d6('0xb'));var fs=require('fs');var fs_extra=require(_0xe4d6('0xc'));var _=require(_0xe4d6('0xd'));var squel=require(_0xe4d6('0xe'));var crypto=require(_0xe4d6('0xf'));var jsforce=require(_0xe4d6('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe4d6('0xa'));var querystring=require(_0xe4d6('0x11'));var Papa=require('papaparse');var Redis=require(_0xe4d6('0x12'));var authService=require(_0xe4d6('0x13'));var qs=require(_0xe4d6('0x14'));var as=require(_0xe4d6('0x15'));var hardwareService=require(_0xe4d6('0x16'));var logger=require(_0xe4d6('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xe4d6('0x18'));var licenseUtil=require(_0xe4d6('0x19'));var db=require(_0xe4d6('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1a80eb,_0x3f7441){_0x3f7441=_0x3f7441||0xcc;return function(_0x53eac7){if(_0x53eac7){return _0x1a80eb[_0xe4d6('0x1b')](_0x3f7441);}return _0x1a80eb[_0xe4d6('0x1c')](_0x3f7441)['end']();};}function respondWithResult(_0xdc7f40,_0x780caa){_0x780caa=_0x780caa||0xc8;return function(_0x178f59){if(_0x178f59){return _0xdc7f40[_0xe4d6('0x1c')](_0x780caa)['json'](_0x178f59);}};}function respondWithFilteredResult(_0x2e04a9,_0x28e001){return function(_0x3dbe31){if(_0x3dbe31){var _0x1ca3fb=typeof _0x28e001['offset']===_0xe4d6('0x1d')&&typeof _0x28e001['limit']==='undefined';var _0x24e9cb=_0x3dbe31[_0xe4d6('0x1e')];var _0x68b15f=_0x1ca3fb?0x0:_0x28e001[_0xe4d6('0x1f')];var _0xe99d00=_0x1ca3fb?_0x3dbe31['count']:_0x28e001[_0xe4d6('0x1f')]+_0x28e001[_0xe4d6('0x20')];var _0xab15c8;if(_0xe99d00>=_0x24e9cb){_0xe99d00=_0x24e9cb;_0xab15c8=0xc8;}else{_0xab15c8=0xce;}_0x2e04a9[_0xe4d6('0x1c')](_0xab15c8);return _0x2e04a9[_0xe4d6('0x21')](_0xe4d6('0x22'),_0x68b15f+'-'+_0xe99d00+'/'+_0x24e9cb)[_0xe4d6('0x23')](_0x3dbe31);}return null;};}function patchUpdates(_0x27e824){return function(_0x52d88d){try{jsonpatch[_0xe4d6('0x24')](_0x52d88d,_0x27e824,!![]);}catch(_0x48a404){return BPromise[_0xe4d6('0x25')](_0x48a404);}return _0x52d88d[_0xe4d6('0x26')]();};}function saveUpdates(_0x31f569,_0x162b57){return function(_0x185b9e){if(_0x185b9e){return _0x185b9e[_0xe4d6('0x27')](_0x31f569)[_0xe4d6('0x28')](function(_0x202f67){return _0x202f67;});}return null;};}function removeEntity(_0x59233f,_0x404fe1){return function(_0x12b159){if(_0x12b159){return _0x12b159['destroy']()[_0xe4d6('0x28')](function(){_0x59233f[_0xe4d6('0x1c')](0xcc)[_0xe4d6('0x29')]();});}};}function handleEntityNotFound(_0x3e8f41,_0x13aeec){return function(_0x2f467f){if(!_0x2f467f){_0x3e8f41[_0xe4d6('0x1b')](0x194);}return _0x2f467f;};}function handleError(_0xb4fe6a,_0x53110a){_0x53110a=_0x53110a||0x1f4;return function(_0x16d492){logger[_0xe4d6('0x2a')](_0x16d492['stack']);if(_0x16d492['name']){delete _0x16d492['name'];}_0xb4fe6a[_0xe4d6('0x1c')](_0x53110a)['send'](_0x16d492);};}exports[_0xe4d6('0x2b')]=function(_0x4b83fa,_0x4f0485){var _0x39f7d5={},_0x4e45f0={},_0x54ae70={'count':0x0,'rows':[]};var _0x112cbd=_[_0xe4d6('0x2c')](db['FreshdeskAccount']['rawAttributes'],function(_0x3fd34f){return{'name':_0x3fd34f[_0xe4d6('0x2d')],'type':_0x3fd34f['type'][_0xe4d6('0x2e')]};});_0x4e45f0[_0xe4d6('0x2f')]=_[_0xe4d6('0x2c')](_0x112cbd,_0xe4d6('0x30'));_0x4e45f0[_0xe4d6('0x31')]=_[_0xe4d6('0x32')](_0x4b83fa['query']);_0x4e45f0['filters']=_[_0xe4d6('0x33')](_0x4e45f0[_0xe4d6('0x2f')],_0x4e45f0['query']);_0x39f7d5[_0xe4d6('0x34')]=_['intersection'](_0x4e45f0[_0xe4d6('0x2f')],qs['fields'](_0x4b83fa['query'][_0xe4d6('0x35')]));_0x39f7d5['attributes']=_0x39f7d5['attributes'][_0xe4d6('0x36')]?_0x39f7d5[_0xe4d6('0x34')]:_0x4e45f0[_0xe4d6('0x2f')];if(!_0x4b83fa[_0xe4d6('0x31')]['hasOwnProperty'](_0xe4d6('0x37'))){_0x39f7d5[_0xe4d6('0x20')]=qs[_0xe4d6('0x20')](_0x4b83fa[_0xe4d6('0x31')][_0xe4d6('0x20')]);_0x39f7d5[_0xe4d6('0x1f')]=qs[_0xe4d6('0x1f')](_0x4b83fa[_0xe4d6('0x31')][_0xe4d6('0x1f')]);}_0x39f7d5[_0xe4d6('0x38')]=qs['sort'](_0x4b83fa[_0xe4d6('0x31')]['sort']);_0x39f7d5[_0xe4d6('0x39')]=qs[_0xe4d6('0x3a')](_[_0xe4d6('0x3b')](_0x4b83fa[_0xe4d6('0x31')],_0x4e45f0['filters']),_0x112cbd);if(_0x4b83fa['query'][_0xe4d6('0x3c')]){_0x39f7d5[_0xe4d6('0x39')]=_[_0xe4d6('0x3d')](_0x39f7d5[_0xe4d6('0x39')],{'$or':_[_0xe4d6('0x2c')](_0x112cbd,function(_0x20c286){if(_0x20c286[_0xe4d6('0x3e')]!=='VIRTUAL'){var _0x252dfd={};_0x252dfd[_0x20c286[_0xe4d6('0x30')]]={'$like':'%'+_0x4b83fa['query']['filter']+'%'};return _0x252dfd;}})});}_0x39f7d5=_[_0xe4d6('0x3d')]({},_0x39f7d5,_0x4b83fa[_0xe4d6('0x3f')]);var _0x4950cf={'where':_0x39f7d5[_0xe4d6('0x39')]};return db[_0xe4d6('0x40')][_0xe4d6('0x1e')](_0x4950cf)[_0xe4d6('0x28')](function(_0x48207b){_0x54ae70[_0xe4d6('0x1e')]=_0x48207b;if(_0x4b83fa[_0xe4d6('0x31')][_0xe4d6('0x41')]){_0x39f7d5[_0xe4d6('0x42')]=[{'all':!![]}];}return db[_0xe4d6('0x40')][_0xe4d6('0x43')](_0x39f7d5);})['then'](function(_0x5002dc){_0x54ae70['rows']=_0x5002dc;return _0x54ae70;})[_0xe4d6('0x28')](respondWithFilteredResult(_0x4f0485,_0x39f7d5))[_0xe4d6('0x44')](handleError(_0x4f0485,null));};exports[_0xe4d6('0x45')]=function(_0x314ad6,_0x4bc768){var _0x3d2516={'raw':![],'where':{'id':_0x314ad6['params']['id']}},_0x526593={};_0x526593[_0xe4d6('0x2f')]=_[_0xe4d6('0x32')](db[_0xe4d6('0x40')][_0xe4d6('0x46')]);_0x526593[_0xe4d6('0x31')]=_[_0xe4d6('0x32')](_0x314ad6['query']);_0x526593[_0xe4d6('0x3a')]=_[_0xe4d6('0x33')](_0x526593[_0xe4d6('0x2f')],_0x526593[_0xe4d6('0x31')]);_0x3d2516[_0xe4d6('0x34')]=_[_0xe4d6('0x33')](_0x526593[_0xe4d6('0x2f')],qs[_0xe4d6('0x35')](_0x314ad6['query'][_0xe4d6('0x35')]));_0x3d2516[_0xe4d6('0x34')]=_0x3d2516[_0xe4d6('0x34')]['length']?_0x3d2516['attributes']:_0x526593[_0xe4d6('0x2f')];if(_0x314ad6[_0xe4d6('0x31')][_0xe4d6('0x41')]){_0x3d2516[_0xe4d6('0x42')]=[{'all':!![]}];}_0x3d2516=_[_0xe4d6('0x3d')]({},_0x3d2516,_0x314ad6[_0xe4d6('0x3f')]);return db[_0xe4d6('0x40')][_0xe4d6('0x47')](_0x3d2516)[_0xe4d6('0x28')](handleEntityNotFound(_0x4bc768,null))[_0xe4d6('0x28')](respondWithResult(_0x4bc768,null))[_0xe4d6('0x44')](handleError(_0x4bc768,null));};exports[_0xe4d6('0x48')]=function(_0xe6fb2c,_0x194307){return db[_0xe4d6('0x40')][_0xe4d6('0x48')](_0xe6fb2c['body'],{})[_0xe4d6('0x28')](respondWithResult(_0x194307,0xc9))[_0xe4d6('0x44')](handleError(_0x194307,null));};exports['update']=function(_0x2bea52,_0x538e25){if(_0x2bea52[_0xe4d6('0x49')]['id']){delete _0x2bea52[_0xe4d6('0x49')]['id'];}return db['FreshdeskAccount'][_0xe4d6('0x47')]({'where':{'id':_0x2bea52['params']['id']}})['then'](handleEntityNotFound(_0x538e25,null))[_0xe4d6('0x28')](saveUpdates(_0x2bea52[_0xe4d6('0x49')],null))['then'](respondWithResult(_0x538e25,null))[_0xe4d6('0x44')](handleError(_0x538e25,null));};exports[_0xe4d6('0x4a')]=function(_0x24ed6b,_0x278c96){return db[_0xe4d6('0x40')]['find']({'where':{'id':_0x24ed6b[_0xe4d6('0x4b')]['id']}})[_0xe4d6('0x28')](handleEntityNotFound(_0x278c96,null))['then'](removeEntity(_0x278c96,null))['catch'](handleError(_0x278c96,null));};exports[_0xe4d6('0x4c')]=function(_0x12ecaf,_0x30612c,_0x478827){var _0x14f615={};var _0xc55241={};var _0x1da5e9;var _0x427575;return db[_0xe4d6('0x40')]['findOne']({'where':{'id':_0x12ecaf[_0xe4d6('0x4b')]['id']}})[_0xe4d6('0x28')](handleEntityNotFound(_0x30612c,null))[_0xe4d6('0x28')](function(_0x1b22c2){if(_0x1b22c2){_0x1da5e9=_0x1b22c2;_0xc55241[_0xe4d6('0x2f')]=_['keys'](db[_0xe4d6('0x4d')][_0xe4d6('0x46')]);_0xc55241[_0xe4d6('0x31')]=_[_0xe4d6('0x32')](_0x12ecaf[_0xe4d6('0x31')]);_0xc55241[_0xe4d6('0x3a')]=_['intersection'](_0xc55241[_0xe4d6('0x2f')],_0xc55241[_0xe4d6('0x31')]);_0x14f615[_0xe4d6('0x34')]=_[_0xe4d6('0x33')](_0xc55241[_0xe4d6('0x2f')],qs[_0xe4d6('0x35')](_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x35')]));_0x14f615[_0xe4d6('0x34')]=_0x14f615[_0xe4d6('0x34')][_0xe4d6('0x36')]?_0x14f615['attributes']:_0xc55241[_0xe4d6('0x2f')];_0x14f615[_0xe4d6('0x38')]=qs[_0xe4d6('0x4e')](_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x4e')]);_0x14f615[_0xe4d6('0x39')]=qs['filters'](_['pick'](_0x12ecaf[_0xe4d6('0x31')],_0xc55241[_0xe4d6('0x3a')]));if(_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x3c')]){_0x14f615['where']=_['merge'](_0x14f615[_0xe4d6('0x39')],{'$or':_[_0xe4d6('0x2c')](_0x14f615[_0xe4d6('0x34')],function(_0x2b6451){var _0x4b8047={};_0x4b8047[_0x2b6451]={'$like':'%'+_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x3c')]+'%'};return _0x4b8047;})});}_0x14f615=_['merge']({},_0x14f615,_0x12ecaf[_0xe4d6('0x3f')]);return _0x1da5e9['getConfigurations'](_0x14f615);}})[_0xe4d6('0x28')](function(_0x3b155b){if(_0x3b155b){_0x427575=_0x3b155b['length'];if(!_0x12ecaf[_0xe4d6('0x31')]['hasOwnProperty'](_0xe4d6('0x37'))){_0x14f615[_0xe4d6('0x20')]=qs['limit'](_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x20')]);_0x14f615[_0xe4d6('0x1f')]=qs['offset'](_0x12ecaf['query']['offset']);}return _0x1da5e9[_0xe4d6('0x4c')](_0x14f615);}})[_0xe4d6('0x28')](function(_0x2ae27f){if(_0x2ae27f){return _0x2ae27f?{'count':_0x427575,'rows':_0x2ae27f}:null;}})[_0xe4d6('0x28')](respondWithResult(_0x30612c,null))[_0xe4d6('0x44')](handleError(_0x30612c,null));};exports[_0xe4d6('0x4f')]=function(_0x520608,_0x2d780d,_0x17d129){if(_0x520608[_0xe4d6('0x49')]['id']){delete _0x520608[_0xe4d6('0x49')]['id'];}return db[_0xe4d6('0x40')][_0xe4d6('0x50')]({'where':{'id':_0x520608[_0xe4d6('0x4b')]['id']}})[_0xe4d6('0x28')](handleEntityNotFound(_0x2d780d,null))[_0xe4d6('0x28')](function(_0x4fde5e){if(_0x4fde5e){_0x520608['body'][_0xe4d6('0x51')]=_0x4fde5e['id'];_0x520608[_0xe4d6('0x49')]['Subjects']=integrations['getSubjects'](_0x520608[_0xe4d6('0x49')][_0xe4d6('0x52')],_0x520608[_0xe4d6('0x49')][_0xe4d6('0x3e')]);_0x520608[_0xe4d6('0x49')]['Descriptions']=integrations[_0xe4d6('0x53')](_0x520608[_0xe4d6('0x49')][_0xe4d6('0x52')],_0x520608[_0xe4d6('0x49')][_0xe4d6('0x3e')]);return db[_0xe4d6('0x4d')]['create'](_0x520608[_0xe4d6('0x49')],{'include':[{'model':db['FreshdeskField'],'as':_0xe4d6('0x54')},{'model':db[_0xe4d6('0x55')],'as':_0xe4d6('0x56')}]});}return null;})[_0xe4d6('0x28')](respondWithResult(_0x2d780d,null))['catch'](handleError(_0x2d780d,null));};exports[_0xe4d6('0x57')]=function(_0xea686f,_0x3da67a,_0x309421){var _0x5e10ca='';return db[_0xe4d6('0x40')][_0xe4d6('0x50')]({'where':{'id':_0xea686f[_0xe4d6('0x4b')]['id']},'attributes':['id',_0xe4d6('0x58'),_0xe4d6('0x59')]})[_0xe4d6('0x28')](handleEntityNotFound(_0x3da67a,null))[_0xe4d6('0x28')](function(_0xc91476){if(_0xc91476){_0x5e10ca=_0xc91476[_0xe4d6('0x58')];var _0xeaa39=_0x5e10ca[_0xe4d6('0x5a')](-0x1);if(_0xeaa39==='/'){_0x5e10ca=_0x5e10ca[_0xe4d6('0x5b')](0x0,_0x5e10ca[_0xe4d6('0x5c')](_0xeaa39));}return rp({'method':_0xe4d6('0x5d'),'uri':util[_0xe4d6('0x5e')](_0xe4d6('0x5f'),_0x5e10ca,_0xe4d6('0x60')),'headers':{'Authorization':util[_0xe4d6('0x5e')]('Basic\x20%s',new Buffer(util[_0xe4d6('0x5e')](_0xe4d6('0x61'),_0xc91476[_0xe4d6('0x59')]))[_0xe4d6('0x62')]('base64'))},'json':!![]});}})[_0xe4d6('0x28')](function(_0x36a77f){if(_0x36a77f){var _0x256541=['requester','subject',_0xe4d6('0x63'),'description',_0xe4d6('0x1c'),_0xe4d6('0x64'),_0xe4d6('0x65'),'source',_0xe4d6('0x66'),_0xe4d6('0x65'),_0xe4d6('0x67')];_[_0xe4d6('0x68')](_0x36a77f,function(_0x2b2bdc){return _0x256541[_0xe4d6('0x69')](_0x2b2bdc[_0xe4d6('0x30')])||!_0x2b2bdc[_0xe4d6('0x6a')]&&_0x2b2bdc[_0xe4d6('0x3e')]!==_0xe4d6('0x6b')&&_0x2b2bdc[_0xe4d6('0x3e')]!=='custom_dropdown';});return{'count':_0x36a77f[_0xe4d6('0x36')],'rows':_['map'](_0x36a77f,function(_0x1ea6b7){return{'id':_0x1ea6b7['name'],'name':_0x1ea6b7[_0xe4d6('0x6c')],'custom':!_0x1ea6b7[_0xe4d6('0x6a')],'options':_0x1ea6b7[_0xe4d6('0x6d')]?_[_0xe4d6('0x2c')](_0x1ea6b7[_0xe4d6('0x6d')],function(_0x258f2d){return{'name':_[_0xe4d6('0x6e')](_0x258f2d),'value':_0x258f2d};}):[]};})};}})[_0xe4d6('0x28')](respondWithResult(_0x3da67a,null))[_0xe4d6('0x44')](function(_0x55e95c){var _0x87d700=_0xea686f[_0xe4d6('0x31')]['test']?0x1f4:_0x55e95c[_0xe4d6('0x6f')]||0x1f4;logger[_0xe4d6('0x2a')](_0xe4d6('0x70'),'getFields',_0x87d700,JSON[_0xe4d6('0x71')](_0x55e95c));delete _0x55e95c['name'];if(_0x87d700===0x191){_0x87d700=0x190;}_0x3da67a[_0xe4d6('0x1c')](_0x87d700)[_0xe4d6('0x72')](_0xea686f[_0xe4d6('0x31')][_0xe4d6('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x55e95c[_0xe4d6('0x6f')]}:_0x55e95c);});}; \ No newline at end of file +var _0x2be0=['findAll','rows','show','params','create','body','catch','find','getConfigurations','findOne','FreshdeskConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','FreshdeskField','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','toString','base64','requester','subject','agent','description','group','ticket_type','company','remove','includes','default','custom_dropdown','label','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','statusCode','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','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','FreshdeskAccount','includeAll','include'];(function(_0x4b96bd,_0xe341d){var _0x515ad8=function(_0x166deb){while(--_0x166deb){_0x4b96bd['push'](_0x4b96bd['shift']());}};_0x515ad8(++_0xe341d);}(_0x2be0,0x128));var _0x02be=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x2be0[_0xc0a3d3];return _0x3386e8;};'use strict';var emlformat=require(_0x02be('0x0'));var rimraf=require(_0x02be('0x1'));var zipdir=require(_0x02be('0x2'));var jsonpatch=require(_0x02be('0x3'));var rp=require(_0x02be('0x4'));var moment=require('moment');var BPromise=require(_0x02be('0x5'));var Mustache=require(_0x02be('0x6'));var util=require(_0x02be('0x7'));var path=require('path');var sox=require(_0x02be('0x8'));var csv=require(_0x02be('0x9'));var ejs=require(_0x02be('0xa'));var fs=require('fs');var fs_extra=require(_0x02be('0xb'));var _=require('lodash');var squel=require(_0x02be('0xc'));var crypto=require(_0x02be('0xd'));var jsforce=require(_0x02be('0xe'));var deskjs=require(_0x02be('0xf'));var toCsv=require(_0x02be('0x9'));var querystring=require(_0x02be('0x10'));var Papa=require(_0x02be('0x11'));var Redis=require(_0x02be('0x12'));var authService=require(_0x02be('0x13'));var qs=require(_0x02be('0x14'));var as=require(_0x02be('0x15'));var hardwareService=require(_0x02be('0x16'));var logger=require(_0x02be('0x17'))(_0x02be('0x18'));var utils=require('../../config/utils');var config=require(_0x02be('0x19'));var licenseUtil=require(_0x02be('0x1a'));var db=require(_0x02be('0x1b'))['db'];var integrations=require(_0x02be('0x1c'));function respondWithStatusCode(_0x52493d,_0xd4e8a0){_0xd4e8a0=_0xd4e8a0||0xcc;return function(_0x519b91){if(_0x519b91){return _0x52493d[_0x02be('0x1d')](_0xd4e8a0);}return _0x52493d[_0x02be('0x1e')](_0xd4e8a0)[_0x02be('0x1f')]();};}function respondWithResult(_0x3179b3,_0x36ff34){_0x36ff34=_0x36ff34||0xc8;return function(_0x27d450){if(_0x27d450){return _0x3179b3[_0x02be('0x1e')](_0x36ff34)[_0x02be('0x20')](_0x27d450);}};}function respondWithFilteredResult(_0x4e7fad,_0x3aa477){return function(_0x242dac){if(_0x242dac){var _0x5ed522=typeof _0x3aa477['offset']===_0x02be('0x21')&&typeof _0x3aa477['limit']==='undefined';var _0x410584=_0x242dac['count'];var _0x2afd83=_0x5ed522?0x0:_0x3aa477[_0x02be('0x22')];var _0x172a40=_0x5ed522?_0x242dac[_0x02be('0x23')]:_0x3aa477[_0x02be('0x22')]+_0x3aa477[_0x02be('0x24')];var _0x3ad936;if(_0x172a40>=_0x410584){_0x172a40=_0x410584;_0x3ad936=0xc8;}else{_0x3ad936=0xce;}_0x4e7fad['status'](_0x3ad936);return _0x4e7fad[_0x02be('0x25')](_0x02be('0x26'),_0x2afd83+'-'+_0x172a40+'/'+_0x410584)[_0x02be('0x20')](_0x242dac);}return null;};}function patchUpdates(_0xb0d70a){return function(_0x423d1d){try{jsonpatch[_0x02be('0x27')](_0x423d1d,_0xb0d70a,!![]);}catch(_0x114b79){return BPromise[_0x02be('0x28')](_0x114b79);}return _0x423d1d[_0x02be('0x29')]();};}function saveUpdates(_0x26a8ec,_0x2357ab){return function(_0x55ffc9){if(_0x55ffc9){return _0x55ffc9[_0x02be('0x2a')](_0x26a8ec)['then'](function(_0x2b73ae){return _0x2b73ae;});}return null;};}function removeEntity(_0x11ea4e,_0x7f4b6e){return function(_0x3c644b){if(_0x3c644b){return _0x3c644b[_0x02be('0x2b')]()[_0x02be('0x2c')](function(){_0x11ea4e['status'](0xcc)[_0x02be('0x1f')]();});}};}function handleEntityNotFound(_0x301348,_0x4c2ed7){return function(_0x4a1bcb){if(!_0x4a1bcb){_0x301348[_0x02be('0x1d')](0x194);}return _0x4a1bcb;};}function handleError(_0xb1614b,_0x283cd0){_0x283cd0=_0x283cd0||0x1f4;return function(_0x1b8dc7){logger[_0x02be('0x2d')](_0x1b8dc7['stack']);if(_0x1b8dc7[_0x02be('0x2e')]){delete _0x1b8dc7[_0x02be('0x2e')];}_0xb1614b[_0x02be('0x1e')](_0x283cd0)[_0x02be('0x2f')](_0x1b8dc7);};}exports[_0x02be('0x30')]=function(_0x251ee8,_0x4255ed){var _0x20eb4b={},_0x3a7e53={},_0x59a04d={'count':0x0,'rows':[]};var _0x39d6b3=_[_0x02be('0x31')](db['FreshdeskAccount'][_0x02be('0x32')],function(_0x5117ed){return{'name':_0x5117ed[_0x02be('0x33')],'type':_0x5117ed['type']['key']};});_0x3a7e53[_0x02be('0x34')]=_['map'](_0x39d6b3,'name');_0x3a7e53[_0x02be('0x35')]=_[_0x02be('0x36')](_0x251ee8[_0x02be('0x35')]);_0x3a7e53[_0x02be('0x37')]=_[_0x02be('0x38')](_0x3a7e53[_0x02be('0x34')],_0x3a7e53[_0x02be('0x35')]);_0x20eb4b['attributes']=_[_0x02be('0x38')](_0x3a7e53['model'],qs[_0x02be('0x39')](_0x251ee8[_0x02be('0x35')][_0x02be('0x39')]));_0x20eb4b[_0x02be('0x3a')]=_0x20eb4b['attributes'][_0x02be('0x3b')]?_0x20eb4b[_0x02be('0x3a')]:_0x3a7e53[_0x02be('0x34')];if(!_0x251ee8['query'][_0x02be('0x3c')](_0x02be('0x3d'))){_0x20eb4b['limit']=qs[_0x02be('0x24')](_0x251ee8[_0x02be('0x35')][_0x02be('0x24')]);_0x20eb4b[_0x02be('0x22')]=qs[_0x02be('0x22')](_0x251ee8[_0x02be('0x35')][_0x02be('0x22')]);}_0x20eb4b[_0x02be('0x3e')]=qs[_0x02be('0x3f')](_0x251ee8[_0x02be('0x35')][_0x02be('0x3f')]);_0x20eb4b['where']=qs[_0x02be('0x37')](_[_0x02be('0x40')](_0x251ee8['query'],_0x3a7e53[_0x02be('0x37')]),_0x39d6b3);if(_0x251ee8[_0x02be('0x35')][_0x02be('0x41')]){_0x20eb4b[_0x02be('0x42')]=_[_0x02be('0x43')](_0x20eb4b[_0x02be('0x42')],{'$or':_['map'](_0x39d6b3,function(_0x3f8adb){if(_0x3f8adb['type']!==_0x02be('0x44')){var _0x54a19a={};_0x54a19a[_0x3f8adb[_0x02be('0x2e')]]={'$like':'%'+_0x251ee8['query'][_0x02be('0x41')]+'%'};return _0x54a19a;}})});}_0x20eb4b=_[_0x02be('0x43')]({},_0x20eb4b,_0x251ee8[_0x02be('0x45')]);var _0x1a45db={'where':_0x20eb4b[_0x02be('0x42')]};return db[_0x02be('0x46')][_0x02be('0x23')](_0x1a45db)[_0x02be('0x2c')](function(_0x1552ec){_0x59a04d[_0x02be('0x23')]=_0x1552ec;if(_0x251ee8[_0x02be('0x35')][_0x02be('0x47')]){_0x20eb4b[_0x02be('0x48')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x02be('0x49')](_0x20eb4b);})[_0x02be('0x2c')](function(_0x577b0d){_0x59a04d[_0x02be('0x4a')]=_0x577b0d;return _0x59a04d;})[_0x02be('0x2c')](respondWithFilteredResult(_0x4255ed,_0x20eb4b))['catch'](handleError(_0x4255ed,null));};exports[_0x02be('0x4b')]=function(_0x5318c7,_0x59d186){var _0x38802c={'raw':![],'where':{'id':_0x5318c7[_0x02be('0x4c')]['id']}},_0x322f4e={};_0x322f4e[_0x02be('0x34')]=_[_0x02be('0x36')](db[_0x02be('0x46')]['rawAttributes']);_0x322f4e[_0x02be('0x35')]=_[_0x02be('0x36')](_0x5318c7['query']);_0x322f4e['filters']=_[_0x02be('0x38')](_0x322f4e[_0x02be('0x34')],_0x322f4e[_0x02be('0x35')]);_0x38802c[_0x02be('0x3a')]=_[_0x02be('0x38')](_0x322f4e[_0x02be('0x34')],qs[_0x02be('0x39')](_0x5318c7[_0x02be('0x35')][_0x02be('0x39')]));_0x38802c[_0x02be('0x3a')]=_0x38802c['attributes'][_0x02be('0x3b')]?_0x38802c[_0x02be('0x3a')]:_0x322f4e[_0x02be('0x34')];if(_0x5318c7[_0x02be('0x35')]['includeAll']){_0x38802c['include']=[{'all':!![]}];}_0x38802c=_['merge']({},_0x38802c,_0x5318c7[_0x02be('0x45')]);return db[_0x02be('0x46')]['find'](_0x38802c)[_0x02be('0x2c')](handleEntityNotFound(_0x59d186,null))['then'](respondWithResult(_0x59d186,null))['catch'](handleError(_0x59d186,null));};exports[_0x02be('0x4d')]=function(_0x185e57,_0x3a281e){return db[_0x02be('0x46')]['create'](_0x185e57[_0x02be('0x4e')],{})[_0x02be('0x2c')](respondWithResult(_0x3a281e,0xc9))['catch'](handleError(_0x3a281e,null));};exports[_0x02be('0x2a')]=function(_0x48711a,_0x1708da){if(_0x48711a[_0x02be('0x4e')]['id']){delete _0x48711a['body']['id'];}return db[_0x02be('0x46')]['find']({'where':{'id':_0x48711a['params']['id']}})[_0x02be('0x2c')](handleEntityNotFound(_0x1708da,null))[_0x02be('0x2c')](saveUpdates(_0x48711a[_0x02be('0x4e')],null))[_0x02be('0x2c')](respondWithResult(_0x1708da,null))[_0x02be('0x4f')](handleError(_0x1708da,null));};exports['destroy']=function(_0x4c57cf,_0x45cbc1){return db['FreshdeskAccount'][_0x02be('0x50')]({'where':{'id':_0x4c57cf['params']['id']}})[_0x02be('0x2c')](handleEntityNotFound(_0x45cbc1,null))[_0x02be('0x2c')](removeEntity(_0x45cbc1,null))[_0x02be('0x4f')](handleError(_0x45cbc1,null));};exports[_0x02be('0x51')]=function(_0x43aea7,_0x1f39d9,_0x5d0dab){var _0x5ef5e2={};var _0x548983={};var _0x30a01e;var _0x100c29;return db['FreshdeskAccount'][_0x02be('0x52')]({'where':{'id':_0x43aea7[_0x02be('0x4c')]['id']}})[_0x02be('0x2c')](handleEntityNotFound(_0x1f39d9,null))[_0x02be('0x2c')](function(_0x1cd45a){if(_0x1cd45a){_0x30a01e=_0x1cd45a;_0x548983[_0x02be('0x34')]=_[_0x02be('0x36')](db[_0x02be('0x53')][_0x02be('0x32')]);_0x548983[_0x02be('0x35')]=_[_0x02be('0x36')](_0x43aea7[_0x02be('0x35')]);_0x548983[_0x02be('0x37')]=_['intersection'](_0x548983[_0x02be('0x34')],_0x548983['query']);_0x5ef5e2[_0x02be('0x3a')]=_[_0x02be('0x38')](_0x548983['model'],qs[_0x02be('0x39')](_0x43aea7[_0x02be('0x35')][_0x02be('0x39')]));_0x5ef5e2[_0x02be('0x3a')]=_0x5ef5e2['attributes']['length']?_0x5ef5e2[_0x02be('0x3a')]:_0x548983[_0x02be('0x34')];_0x5ef5e2[_0x02be('0x3e')]=qs[_0x02be('0x3f')](_0x43aea7['query'][_0x02be('0x3f')]);_0x5ef5e2[_0x02be('0x42')]=qs[_0x02be('0x37')](_[_0x02be('0x40')](_0x43aea7['query'],_0x548983['filters']));if(_0x43aea7[_0x02be('0x35')]['filter']){_0x5ef5e2[_0x02be('0x42')]=_['merge'](_0x5ef5e2[_0x02be('0x42')],{'$or':_['map'](_0x5ef5e2[_0x02be('0x3a')],function(_0x34bbb6){var _0x3fb410={};_0x3fb410[_0x34bbb6]={'$like':'%'+_0x43aea7['query'][_0x02be('0x41')]+'%'};return _0x3fb410;})});}_0x5ef5e2=_[_0x02be('0x43')]({},_0x5ef5e2,_0x43aea7[_0x02be('0x45')]);return _0x30a01e[_0x02be('0x51')](_0x5ef5e2);}})[_0x02be('0x2c')](function(_0x893fa){if(_0x893fa){_0x100c29=_0x893fa['length'];if(!_0x43aea7['query'][_0x02be('0x3c')](_0x02be('0x3d'))){_0x5ef5e2[_0x02be('0x24')]=qs[_0x02be('0x24')](_0x43aea7[_0x02be('0x35')][_0x02be('0x24')]);_0x5ef5e2[_0x02be('0x22')]=qs['offset'](_0x43aea7[_0x02be('0x35')][_0x02be('0x22')]);}return _0x30a01e[_0x02be('0x51')](_0x5ef5e2);}})[_0x02be('0x2c')](function(_0x9a968){if(_0x9a968){return _0x9a968?{'count':_0x100c29,'rows':_0x9a968}:null;}})[_0x02be('0x2c')](respondWithResult(_0x1f39d9,null))[_0x02be('0x4f')](handleError(_0x1f39d9,null));};exports['addConfiguration']=function(_0x394a9b,_0x4109cc,_0x4171df){if(_0x394a9b[_0x02be('0x4e')]['id']){delete _0x394a9b[_0x02be('0x4e')]['id'];}return db['FreshdeskAccount'][_0x02be('0x52')]({'where':{'id':_0x394a9b['params']['id']}})[_0x02be('0x2c')](handleEntityNotFound(_0x4109cc,null))[_0x02be('0x2c')](function(_0x21f1d5){if(_0x21f1d5){_0x394a9b[_0x02be('0x4e')][_0x02be('0x54')]=_0x21f1d5['id'];_0x394a9b[_0x02be('0x4e')][_0x02be('0x55')]=integrations[_0x02be('0x56')](_0x394a9b[_0x02be('0x4e')][_0x02be('0x57')],_0x394a9b['body'][_0x02be('0x58')]);_0x394a9b[_0x02be('0x4e')][_0x02be('0x59')]=integrations[_0x02be('0x5a')](_0x394a9b['body'][_0x02be('0x57')],_0x394a9b[_0x02be('0x4e')][_0x02be('0x58')]);return db[_0x02be('0x53')][_0x02be('0x4d')](_0x394a9b[_0x02be('0x4e')],{'include':[{'model':db[_0x02be('0x5b')],'as':_0x02be('0x55')},{'model':db[_0x02be('0x5b')],'as':_0x02be('0x59')}]});}return null;})[_0x02be('0x2c')](respondWithResult(_0x4109cc,null))[_0x02be('0x4f')](handleError(_0x4109cc,null));};exports['getFields']=function(_0x2dce48,_0x439386,_0x418df8){var _0x2d1bd1='';return db[_0x02be('0x46')][_0x02be('0x52')]({'where':{'id':_0x2dce48[_0x02be('0x4c')]['id']},'attributes':['id','remoteUri',_0x02be('0x5c')]})['then'](handleEntityNotFound(_0x439386,null))[_0x02be('0x2c')](function(_0xd74368){if(_0xd74368){_0x2d1bd1=_0xd74368[_0x02be('0x5d')];var _0x1bd16f=_0x2d1bd1[_0x02be('0x5e')](-0x1);if(_0x1bd16f==='/'){_0x2d1bd1=_0x2d1bd1[_0x02be('0x5f')](0x0,_0x2d1bd1[_0x02be('0x60')](_0x1bd16f));}return rp({'method':_0x02be('0x61'),'uri':util[_0x02be('0x62')](_0x02be('0x63'),_0x2d1bd1,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x02be('0x62')](_0x02be('0x64'),new Buffer(util[_0x02be('0x62')]('%s:X',_0xd74368[_0x02be('0x5c')]))[_0x02be('0x65')](_0x02be('0x66')))},'json':!![]});}})[_0x02be('0x2c')](function(_0x4ad0cc){if(_0x4ad0cc){var _0x3f7dd5=[_0x02be('0x67'),_0x02be('0x68'),_0x02be('0x69'),_0x02be('0x6a'),_0x02be('0x1e'),'priority',_0x02be('0x6b'),'source',_0x02be('0x6c'),_0x02be('0x6b'),_0x02be('0x6d')];_[_0x02be('0x6e')](_0x4ad0cc,function(_0x4529ad){return _0x3f7dd5[_0x02be('0x6f')](_0x4529ad[_0x02be('0x2e')])||!_0x4529ad[_0x02be('0x70')]&&_0x4529ad[_0x02be('0x58')]!=='custom_text'&&_0x4529ad[_0x02be('0x58')]!==_0x02be('0x71');});return{'count':_0x4ad0cc[_0x02be('0x3b')],'rows':_[_0x02be('0x31')](_0x4ad0cc,function(_0x39881a){return{'id':_0x39881a[_0x02be('0x2e')],'name':_0x39881a[_0x02be('0x72')],'custom':!_0x39881a[_0x02be('0x70')],'options':_0x39881a[_0x02be('0x73')]?_[_0x02be('0x31')](_0x39881a[_0x02be('0x73')],function(_0x14f2fe){return{'name':_[_0x02be('0x74')](_0x14f2fe),'value':_0x14f2fe};}):[]};})};}})[_0x02be('0x2c')](respondWithResult(_0x439386,null))[_0x02be('0x4f')](function(_0x49246c){var _0x466594=_0x2dce48[_0x02be('0x35')]['test']?0x1f4:_0x49246c['statusCode']||0x1f4;logger[_0x02be('0x2d')](_0x02be('0x75'),_0x02be('0x76'),_0x466594,JSON[_0x02be('0x77')](_0x49246c));delete _0x49246c[_0x02be('0x2e')];if(_0x466594===0x191){_0x466594=0x190;}_0x439386[_0x02be('0x1e')](_0x466594)[_0x02be('0x2f')](_0x2dce48[_0x02be('0x35')][_0x02be('0x78')]?{'message':_0x02be('0x79'),'statusCode':_0x49246c[_0x02be('0x7a')]}:_0x49246c);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 6bfcbb5..4890d72 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 _0x79db=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','FreshdeskAccount','lodash'];(function(_0x1d9c1b,_0x4e8ceb){var _0x4eef3b=function(_0xdd6cf3){while(--_0xdd6cf3){_0x1d9c1b['push'](_0x1d9c1b['shift']());}};_0x4eef3b(++_0x4e8ceb);}(_0x79db,0x1a3));var _0xb79d=function(_0x28b7ab,_0x16a764){_0x28b7ab=_0x28b7ab-0x0;var _0x56791b=_0x79db[_0x28b7ab];return _0x56791b;};'use strict';var _=require(_0xb79d('0x0'));var util=require(_0xb79d('0x1'));var logger=require('../../config/logger')(_0xb79d('0x2'));var moment=require(_0xb79d('0x3'));var BPromise=require(_0xb79d('0x4'));var rp=require(_0xb79d('0x5'));var fs=require('fs');var path=require(_0xb79d('0x6'));var rimraf=require(_0xb79d('0x7'));var config=require(_0xb79d('0x8'));var attributes=require(_0xb79d('0x9'));var integrations=require(_0xb79d('0xa'));module['exports']=function(_0x3e90c1,_0x2de1ae){return _0x3e90c1['define'](_0xb79d('0xb'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd145=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','util','../../config/logger'];(function(_0x3f36cd,_0x488a8b){var _0x1a83c2=function(_0x53644a){while(--_0x53644a){_0x3f36cd['push'](_0x3f36cd['shift']());}};_0x1a83c2(++_0x488a8b);}(_0xd145,0x129));var _0x5d14=function(_0x203e1c,_0x249eea){_0x203e1c=_0x203e1c-0x0;var _0x363bfb=_0xd145[_0x203e1c];return _0x363bfb;};'use strict';var _=require('lodash');var util=require(_0x5d14('0x0'));var logger=require(_0x5d14('0x1'))(_0x5d14('0x2'));var moment=require(_0x5d14('0x3'));var BPromise=require(_0x5d14('0x4'));var rp=require(_0x5d14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d14('0x6'));var config=require(_0x5d14('0x7'));var attributes=require(_0x5d14('0x8'));var integrations=require(_0x5d14('0x9'));module[_0x5d14('0xa')]=function(_0x479886,_0x4a8c35){return _0x479886[_0x5d14('0xb')](_0x5d14('0xc'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 37975e9..8b1b208 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 _0x4e03=['then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFreshdeskAccount','findAll','options','raw','where','include','map','attributes','ShowFreshdeskAccount','FreshdeskAccount','model','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0x13b524,_0x1bbdc4){var _0x2babdb=function(_0x55d190){while(--_0x55d190){_0x13b524['push'](_0x13b524['shift']());}};_0x2babdb(++_0x1bbdc4);}(_0x4e03,0x1e5));var _0x34e0=function(_0x3fad4f,_0x58525f){_0x3fad4f=_0x3fad4f-0x0;var _0x2b4ec3=_0x4e03[_0x3fad4f];return _0x2b4ec3;};'use strict';var _=require(_0x34e0('0x0'));var util=require('util');var moment=require(_0x34e0('0x1'));var BPromise=require('bluebird');var rs=require(_0x34e0('0x2'));var fs=require('fs');var Redis=require(_0x34e0('0x3'));var db=require(_0x34e0('0x4'))['db'];var utils=require(_0x34e0('0x5'));var logger=require(_0x34e0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x34e0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x243e68,_0x185d0c,_0x29b28c){return new BPromise(function(_0x3e80ac,_0x522047){return client['request'](_0x243e68,_0x29b28c)[_0x34e0('0x8')](function(_0x15d7d3){logger[_0x34e0('0x9')](_0x34e0('0xa'),_0x185d0c,_0x34e0('0xb'));logger[_0x34e0('0xc')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x185d0c,_0x34e0('0xb'),JSON[_0x34e0('0xd')](_0x15d7d3));if(_0x15d7d3[_0x34e0('0xe')]){if(_0x15d7d3[_0x34e0('0xe')][_0x34e0('0xf')]===0x1f4){logger[_0x34e0('0xe')](_0x34e0('0xa'),_0x185d0c,_0x15d7d3[_0x34e0('0xe')][_0x34e0('0x10')]);return _0x522047(_0x15d7d3['error']['message']);}logger[_0x34e0('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x185d0c,_0x15d7d3[_0x34e0('0xe')][_0x34e0('0x10')]);return _0x3e80ac(_0x15d7d3['error'][_0x34e0('0x10')]);}else{logger[_0x34e0('0x9')](_0x34e0('0xa'),_0x185d0c,_0x34e0('0xb'));_0x3e80ac(_0x15d7d3['result'][_0x34e0('0x10')]);}})[_0x34e0('0x11')](function(_0x17674c){logger[_0x34e0('0xe')](_0x34e0('0xa'),_0x185d0c,_0x17674c);_0x522047(_0x17674c);});});}exports[_0x34e0('0x12')]=function(_0x2da208){var _0x18e396=this;return new Promise(function(_0x360031,_0x170652){return db['FreshdeskAccount'][_0x34e0('0x13')]({'raw':_0x2da208[_0x34e0('0x14')]?_0x2da208[_0x34e0('0x14')][_0x34e0('0x15')]===undefined?!![]:![]:!![],'where':_0x2da208[_0x34e0('0x14')]?_0x2da208[_0x34e0('0x14')][_0x34e0('0x16')]||null:null,'attributes':_0x2da208['options']?_0x2da208['options']['attributes']||null:null,'limit':_0x2da208[_0x34e0('0x14')]?_0x2da208[_0x34e0('0x14')]['limit']||null:null,'include':_0x2da208[_0x34e0('0x14')]?_0x2da208[_0x34e0('0x14')][_0x34e0('0x17')]?_[_0x34e0('0x18')](_0x2da208['options']['include'],function(_0x2d4854){return{'model':db[_0x2d4854['model']],'as':_0x2d4854['as'],'attributes':_0x2d4854[_0x34e0('0x19')],'include':_0x2d4854['include']?_[_0x34e0('0x18')](_0x2d4854[_0x34e0('0x17')],function(_0x5d75c5){return{'model':db[_0x5d75c5['model']],'as':_0x5d75c5['as'],'attributes':_0x5d75c5[_0x34e0('0x19')],'include':_0x5d75c5[_0x34e0('0x17')]?_['map'](_0x5d75c5[_0x34e0('0x17')],function(_0x53790b){return{'model':db[_0x53790b['model']],'as':_0x53790b['as'],'attributes':_0x53790b[_0x34e0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x34e0('0x8')](function(_0x27743f){logger['info'](_0x34e0('0x12'),_0x2da208);logger[_0x34e0('0xc')](_0x34e0('0x12'),_0x2da208,JSON[_0x34e0('0xd')](_0x27743f));_0x360031(_0x27743f);})['catch'](function(_0x577ffd){logger[_0x34e0('0xe')]('GetFreshdeskAccount',_0x577ffd[_0x34e0('0x10')],_0x2da208);_0x170652(_0x18e396[_0x34e0('0xe')](0x1f4,_0x577ffd[_0x34e0('0x10')]));});});};exports[_0x34e0('0x1a')]=function(_0x53ea2){var _0x40f332=this;return new Promise(function(_0x2fa97,_0x4c7bc5){return db[_0x34e0('0x1b')]['find']({'raw':_0x53ea2[_0x34e0('0x14')]?_0x53ea2[_0x34e0('0x14')][_0x34e0('0x15')]===undefined?!![]:![]:!![],'where':_0x53ea2['options']?_0x53ea2[_0x34e0('0x14')]['where']||null:null,'attributes':_0x53ea2[_0x34e0('0x14')]?_0x53ea2[_0x34e0('0x14')][_0x34e0('0x19')]||null:null,'include':_0x53ea2[_0x34e0('0x14')]?_0x53ea2[_0x34e0('0x14')][_0x34e0('0x17')]?_[_0x34e0('0x18')](_0x53ea2[_0x34e0('0x14')][_0x34e0('0x17')],function(_0x2d119f){return{'model':db[_0x2d119f[_0x34e0('0x1c')]],'as':_0x2d119f['as'],'attributes':_0x2d119f[_0x34e0('0x19')],'include':_0x2d119f[_0x34e0('0x17')]?_['map'](_0x2d119f[_0x34e0('0x17')],function(_0x54d75a){return{'model':db[_0x54d75a[_0x34e0('0x1c')]],'as':_0x54d75a['as'],'attributes':_0x54d75a[_0x34e0('0x19')],'include':_0x54d75a[_0x34e0('0x17')]?_['map'](_0x54d75a[_0x34e0('0x17')],function(_0x2c9bdb){return{'model':db[_0x2c9bdb[_0x34e0('0x1c')]],'as':_0x2c9bdb['as'],'attributes':_0x2c9bdb[_0x34e0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x34e0('0x8')](function(_0x5a2331){logger['info'](_0x34e0('0x1a'),_0x53ea2);logger[_0x34e0('0xc')](_0x34e0('0x1a'),_0x53ea2,JSON[_0x34e0('0xd')](_0x5a2331));_0x2fa97(_0x5a2331);})[_0x34e0('0x11')](function(_0x5c5343){logger[_0x34e0('0xe')](_0x34e0('0x1a'),_0x5c5343[_0x34e0('0x10')],_0x53ea2);_0x4c7bc5(_0x40f332[_0x34e0('0xe')](0x1f4,_0x5c5343[_0x34e0('0x10')]));});});}; \ No newline at end of file +var _0xd4ba=['request\x20sent','error','message','result','FreshdeskAccount','findAll','options','where','attributes','limit','include','map','model','GetFreshdeskAccount','debug','stringify','catch','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x263663,_0xab2cc7){var _0x469792=function(_0x440aea){while(--_0x440aea){_0x263663['push'](_0x263663['shift']());}};_0x469792(++_0xab2cc7);}(_0xd4ba,0x7c));var _0xad4b=function(_0x5ed7ed,_0x57a9ce){_0x5ed7ed=_0x5ed7ed-0x0;var _0x4c31fe=_0xd4ba[_0x5ed7ed];return _0x4c31fe;};'use strict';var _=require(_0xad4b('0x0'));var util=require(_0xad4b('0x1'));var moment=require(_0xad4b('0x2'));var BPromise=require(_0xad4b('0x3'));var rs=require(_0xad4b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xad4b('0x5'));var logger=require(_0xad4b('0x6'))(_0xad4b('0x7'));var config=require(_0xad4b('0x8'));var jayson=require(_0xad4b('0x9'));var client=jayson[_0xad4b('0xa')][_0xad4b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39988b,_0x4d16e2,_0x21198c){return new BPromise(function(_0x2054db,_0x27badc){return client[_0xad4b('0xc')](_0x39988b,_0x21198c)[_0xad4b('0xd')](function(_0x34f962){logger[_0xad4b('0xe')](_0xad4b('0xf'),_0x4d16e2,_0xad4b('0x10'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x4d16e2,_0xad4b('0x10'),JSON['stringify'](_0x34f962));if(_0x34f962[_0xad4b('0x11')]){if(_0x34f962[_0xad4b('0x11')]['code']===0x1f4){logger['error'](_0xad4b('0xf'),_0x4d16e2,_0x34f962[_0xad4b('0x11')]['message']);return _0x27badc(_0x34f962[_0xad4b('0x11')][_0xad4b('0x12')]);}logger[_0xad4b('0x11')](_0xad4b('0xf'),_0x4d16e2,_0x34f962[_0xad4b('0x11')][_0xad4b('0x12')]);return _0x2054db(_0x34f962[_0xad4b('0x11')]['message']);}else{logger[_0xad4b('0xe')](_0xad4b('0xf'),_0x4d16e2,_0xad4b('0x10'));_0x2054db(_0x34f962[_0xad4b('0x13')][_0xad4b('0x12')]);}})['catch'](function(_0x53d56f){logger[_0xad4b('0x11')](_0xad4b('0xf'),_0x4d16e2,_0x53d56f);_0x27badc(_0x53d56f);});});}exports['GetFreshdeskAccount']=function(_0x207c05){var _0x1041e4=this;return new Promise(function(_0x46c8fc,_0x69cee8){return db[_0xad4b('0x14')][_0xad4b('0x15')]({'raw':_0x207c05[_0xad4b('0x16')]?_0x207c05[_0xad4b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x207c05[_0xad4b('0x16')]?_0x207c05['options'][_0xad4b('0x17')]||null:null,'attributes':_0x207c05[_0xad4b('0x16')]?_0x207c05[_0xad4b('0x16')][_0xad4b('0x18')]||null:null,'limit':_0x207c05[_0xad4b('0x16')]?_0x207c05[_0xad4b('0x16')][_0xad4b('0x19')]||null:null,'include':_0x207c05['options']?_0x207c05[_0xad4b('0x16')][_0xad4b('0x1a')]?_[_0xad4b('0x1b')](_0x207c05['options'][_0xad4b('0x1a')],function(_0x432132){return{'model':db[_0x432132[_0xad4b('0x1c')]],'as':_0x432132['as'],'attributes':_0x432132[_0xad4b('0x18')],'include':_0x432132[_0xad4b('0x1a')]?_[_0xad4b('0x1b')](_0x432132[_0xad4b('0x1a')],function(_0x31bd0){return{'model':db[_0x31bd0[_0xad4b('0x1c')]],'as':_0x31bd0['as'],'attributes':_0x31bd0[_0xad4b('0x18')],'include':_0x31bd0[_0xad4b('0x1a')]?_[_0xad4b('0x1b')](_0x31bd0[_0xad4b('0x1a')],function(_0x591c2a){return{'model':db[_0x591c2a[_0xad4b('0x1c')]],'as':_0x591c2a['as'],'attributes':_0x591c2a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x32b2a2){logger[_0xad4b('0xe')](_0xad4b('0x1d'),_0x207c05);logger[_0xad4b('0x1e')]('GetFreshdeskAccount',_0x207c05,JSON[_0xad4b('0x1f')](_0x32b2a2));_0x46c8fc(_0x32b2a2);})[_0xad4b('0x20')](function(_0x29fe04){logger[_0xad4b('0x11')](_0xad4b('0x1d'),_0x29fe04[_0xad4b('0x12')],_0x207c05);_0x69cee8(_0x1041e4[_0xad4b('0x11')](0x1f4,_0x29fe04[_0xad4b('0x12')]));});});};exports[_0xad4b('0x21')]=function(_0x26624d){var _0x13a53a=this;return new Promise(function(_0x3e4203,_0x322cce){return db[_0xad4b('0x14')][_0xad4b('0x22')]({'raw':_0x26624d[_0xad4b('0x16')]?_0x26624d[_0xad4b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x26624d[_0xad4b('0x16')]?_0x26624d[_0xad4b('0x16')][_0xad4b('0x17')]||null:null,'attributes':_0x26624d[_0xad4b('0x16')]?_0x26624d[_0xad4b('0x16')]['attributes']||null:null,'include':_0x26624d[_0xad4b('0x16')]?_0x26624d[_0xad4b('0x16')]['include']?_[_0xad4b('0x1b')](_0x26624d['options'][_0xad4b('0x1a')],function(_0x3f0b1a){return{'model':db[_0x3f0b1a[_0xad4b('0x1c')]],'as':_0x3f0b1a['as'],'attributes':_0x3f0b1a[_0xad4b('0x18')],'include':_0x3f0b1a[_0xad4b('0x1a')]?_['map'](_0x3f0b1a[_0xad4b('0x1a')],function(_0x1b4e02){return{'model':db[_0x1b4e02[_0xad4b('0x1c')]],'as':_0x1b4e02['as'],'attributes':_0x1b4e02[_0xad4b('0x18')],'include':_0x1b4e02[_0xad4b('0x1a')]?_[_0xad4b('0x1b')](_0x1b4e02[_0xad4b('0x1a')],function(_0x778f33){return{'model':db[_0x778f33[_0xad4b('0x1c')]],'as':_0x778f33['as'],'attributes':_0x778f33[_0xad4b('0x18')]};}):[]};}):[]};}):[]:[]})[_0xad4b('0xd')](function(_0x17378f){logger['info'](_0xad4b('0x21'),_0x26624d);logger[_0xad4b('0x1e')](_0xad4b('0x21'),_0x26624d,JSON[_0xad4b('0x1f')](_0x17378f));_0x3e4203(_0x17378f);})[_0xad4b('0x20')](function(_0x3ca490){logger['error'](_0xad4b('0x21'),_0x3ca490['message'],_0x26624d);_0x322cce(_0x13a53a['error'](0x1f4,_0x3ca490['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 312cd82..b07ff4e 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 _0x5dcf=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','show','/:id/fields','isAuthenticated','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','update','delete'];(function(_0x13d93b,_0x577f4b){var _0x2aa740=function(_0x31af30){while(--_0x31af30){_0x13d93b['push'](_0x13d93b['shift']());}};_0x2aa740(++_0x577f4b);}(_0x5dcf,0x17c));var _0xf5dc=function(_0x46d467,_0x440580){_0x46d467=_0x46d467-0x0;var _0x6b892f=_0x5dcf[_0x46d467];return _0x6b892f;};'use strict';var multer=require('multer');var util=require(_0xf5dc('0x0'));var path=require('path');var timeout=require(_0xf5dc('0x1'));var express=require(_0xf5dc('0x2'));var router=express[_0xf5dc('0x3')]();var fs_extra=require(_0xf5dc('0x4'));var auth=require(_0xf5dc('0x5'));var interaction=require(_0xf5dc('0x6'));var config=require(_0xf5dc('0x7'));var controller=require(_0xf5dc('0x8'));router[_0xf5dc('0x9')]('/',auth['isAuthenticated'](),controller[_0xf5dc('0xa')]);router[_0xf5dc('0x9')](_0xf5dc('0xb'),auth['isAuthenticated'](),controller[_0xf5dc('0xc')]);router[_0xf5dc('0x9')](_0xf5dc('0xd'),auth[_0xf5dc('0xe')](),controller['getFields']);router[_0xf5dc('0x9')](_0xf5dc('0xf'),auth[_0xf5dc('0xe')](),controller['getSubjects']);router['get'](_0xf5dc('0x10'),auth[_0xf5dc('0xe')](),controller[_0xf5dc('0x11')]);router[_0xf5dc('0x9')](_0xf5dc('0x12'),auth[_0xf5dc('0xe')](),controller['getTags']);router[_0xf5dc('0x13')]('/',auth['isAuthenticated'](),controller[_0xf5dc('0x14')]);router[_0xf5dc('0x13')](_0xf5dc('0x12'),auth[_0xf5dc('0xe')](),controller[_0xf5dc('0x15')]);router[_0xf5dc('0x16')](_0xf5dc('0xb'),auth[_0xf5dc('0xe')](),controller[_0xf5dc('0x17')]);router[_0xf5dc('0x18')](_0xf5dc('0xb'),auth['isAuthenticated'](),controller[_0xf5dc('0x19')]);module[_0xf5dc('0x1a')]=router; \ No newline at end of file +var _0x2a34=['show','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','create','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','isAuthenticated','get','/:id'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0x2a34,0x1ac));var _0x42a3=function(_0x2ce9bf,_0x2b04fd){_0x2ce9bf=_0x2ce9bf-0x0;var _0x4251f9=_0x2a34[_0x2ce9bf];return _0x4251f9;};'use strict';var multer=require(_0x42a3('0x0'));var util=require(_0x42a3('0x1'));var path=require(_0x42a3('0x2'));var timeout=require(_0x42a3('0x3'));var express=require(_0x42a3('0x4'));var router=express['Router']();var fs_extra=require(_0x42a3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x42a3('0x6')](),controller['index']);router[_0x42a3('0x7')](_0x42a3('0x8'),auth[_0x42a3('0x6')](),controller[_0x42a3('0x9')]);router[_0x42a3('0x7')]('/:id/fields',auth[_0x42a3('0x6')](),controller[_0x42a3('0xa')]);router['get']('/:id/subjects',auth[_0x42a3('0x6')](),controller[_0x42a3('0xb')]);router[_0x42a3('0x7')](_0x42a3('0xc'),auth[_0x42a3('0x6')](),controller[_0x42a3('0xd')]);router[_0x42a3('0x7')]('/:id/tags',auth['isAuthenticated'](),controller[_0x42a3('0xe')]);router['post']('/',auth[_0x42a3('0x6')](),controller[_0x42a3('0xf')]);router[_0x42a3('0x10')]('/:id/tags',auth[_0x42a3('0x6')](),controller[_0x42a3('0x11')]);router[_0x42a3('0x12')](_0x42a3('0x8'),auth[_0x42a3('0x6')](),controller[_0x42a3('0x13')]);router[_0x42a3('0x14')](_0x42a3('0x8'),auth[_0x42a3('0x6')](),controller[_0x42a3('0x15')]);module[_0x42a3('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index f83d97c..e47ca20 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 _0xe075=['STRING','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe075,0x1c3));var _0x5e07=function(_0x52aaae,_0x32765a){_0x52aaae=_0x52aaae-0x0;var _0xbd1fe3=_0xe075[_0x52aaae];return _0xbd1fe3;};'use strict';var Sequelize=require('sequelize');module[_0x5e07('0x0')]={'name':{'type':Sequelize[_0x5e07('0x1')]},'description':{'type':Sequelize[_0x5e07('0x1')]}}; \ No newline at end of file +var _0x0dcf=['exports'];(function(_0x5c69cd,_0x4b63bd){var _0x6577d4=function(_0x47c0a7){while(--_0x47c0a7){_0x5c69cd['push'](_0x5c69cd['shift']());}};_0x6577d4(++_0x4b63bd);}(_0x0dcf,0xec));var _0xf0dc=function(_0x130d4e,_0x9eba4d){_0x130d4e=_0x130d4e-0x0;var _0x2f34bf=_0x0dcf[_0x130d4e];return _0x2f34bf;};'use strict';var Sequelize=require('sequelize');module[_0xf0dc('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 7539342..3821637 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 _0x2d18=['sort','where','merge','filter','options','includeAll','findAll','rows','catch','params','keys','include','find','create','body','destroy','getFields','findOne','FreshdeskField','rawAttributes','map','getSubjects','pick','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','stack','name','send','index','FreshdeskConfiguration','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x2d18,0x1bb));var _0x82d1=function(_0x297fc4,_0x540792){_0x297fc4=_0x297fc4-0x0;var _0x8f774=_0x2d18[_0x297fc4];return _0x8f774;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x82d1('0x0'));var jsonpatch=require(_0x82d1('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x82d1('0x2'));var Mustache=require('mustache');var util=require(_0x82d1('0x3'));var path=require('path');var sox=require(_0x82d1('0x4'));var csv=require('to-csv');var ejs=require(_0x82d1('0x5'));var fs=require('fs');var fs_extra=require(_0x82d1('0x6'));var _=require(_0x82d1('0x7'));var squel=require(_0x82d1('0x8'));var crypto=require(_0x82d1('0x9'));var jsforce=require(_0x82d1('0xa'));var deskjs=require(_0x82d1('0xb'));var toCsv=require(_0x82d1('0xc'));var querystring=require(_0x82d1('0xd'));var Papa=require(_0x82d1('0xe'));var Redis=require(_0x82d1('0xf'));var authService=require(_0x82d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x82d1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x82d1('0x12'))(_0x82d1('0x13'));var utils=require('../../config/utils');var config=require(_0x82d1('0x14'));var licenseUtil=require(_0x82d1('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a4a8e,_0x3662d1){_0x3662d1=_0x3662d1||0xcc;return function(_0x4732d5){if(_0x4732d5){return _0x1a4a8e[_0x82d1('0x16')](_0x3662d1);}return _0x1a4a8e[_0x82d1('0x17')](_0x3662d1)['end']();};}function respondWithResult(_0x12077b,_0x22f967){_0x22f967=_0x22f967||0xc8;return function(_0x20ad68){if(_0x20ad68){return _0x12077b[_0x82d1('0x17')](_0x22f967)[_0x82d1('0x18')](_0x20ad68);}};}function respondWithFilteredResult(_0x3ee3c8,_0x3883e6){return function(_0x3639af){if(_0x3639af){var _0x7fe439=typeof _0x3883e6[_0x82d1('0x19')]===_0x82d1('0x1a')&&typeof _0x3883e6[_0x82d1('0x1b')]==='undefined';var _0x1b0619=_0x3639af['count'];var _0x439455=_0x7fe439?0x0:_0x3883e6['offset'];var _0x3ecf56=_0x7fe439?_0x3639af[_0x82d1('0x1c')]:_0x3883e6['offset']+_0x3883e6[_0x82d1('0x1b')];var _0x405a81;if(_0x3ecf56>=_0x1b0619){_0x3ecf56=_0x1b0619;_0x405a81=0xc8;}else{_0x405a81=0xce;}_0x3ee3c8[_0x82d1('0x17')](_0x405a81);return _0x3ee3c8[_0x82d1('0x1d')]('Content-Range',_0x439455+'-'+_0x3ecf56+'/'+_0x1b0619)[_0x82d1('0x18')](_0x3639af);}return null;};}function patchUpdates(_0x1d6287){return function(_0x5c44f9){try{jsonpatch[_0x82d1('0x1e')](_0x5c44f9,_0x1d6287,!![]);}catch(_0x220942){return BPromise[_0x82d1('0x1f')](_0x220942);}return _0x5c44f9[_0x82d1('0x20')]();};}function saveUpdates(_0x41c23f,_0x827b7d){return function(_0x56405d){if(_0x56405d){return _0x56405d[_0x82d1('0x21')](_0x41c23f)[_0x82d1('0x22')](function(_0x168d79){return _0x168d79;});}return null;};}function removeEntity(_0xddb31e,_0x5a4b26){return function(_0x416392){if(_0x416392){return _0x416392['destroy']()['then'](function(){_0xddb31e[_0x82d1('0x17')](0xcc)[_0x82d1('0x23')]();});}};}function handleEntityNotFound(_0x4d3cfb,_0x316c30){return function(_0x474426){if(!_0x474426){_0x4d3cfb[_0x82d1('0x16')](0x194);}return _0x474426;};}function handleError(_0x21b6ab,_0x16520e){_0x16520e=_0x16520e||0x1f4;return function(_0x17c710){logger[_0x82d1('0x24')](_0x17c710[_0x82d1('0x25')]);if(_0x17c710[_0x82d1('0x26')]){delete _0x17c710[_0x82d1('0x26')];}_0x21b6ab['status'](_0x16520e)[_0x82d1('0x27')](_0x17c710);};}exports[_0x82d1('0x28')]=function(_0x417a82,_0x2f65e9){var _0xde8b5c={},_0x1fbce5={},_0xff2bb1={'count':0x0,'rows':[]};var _0x503c7c=_['map'](db[_0x82d1('0x29')]['rawAttributes'],function(_0x25f1f7){return{'name':_0x25f1f7[_0x82d1('0x2a')],'type':_0x25f1f7[_0x82d1('0x2b')][_0x82d1('0x2c')]};});_0x1fbce5[_0x82d1('0x2d')]=_['map'](_0x503c7c,_0x82d1('0x26'));_0x1fbce5[_0x82d1('0x2e')]=_['keys'](_0x417a82[_0x82d1('0x2e')]);_0x1fbce5[_0x82d1('0x2f')]=_[_0x82d1('0x30')](_0x1fbce5[_0x82d1('0x2d')],_0x1fbce5[_0x82d1('0x2e')]);_0xde8b5c['attributes']=_[_0x82d1('0x30')](_0x1fbce5[_0x82d1('0x2d')],qs[_0x82d1('0x31')](_0x417a82['query'][_0x82d1('0x31')]));_0xde8b5c[_0x82d1('0x32')]=_0xde8b5c[_0x82d1('0x32')][_0x82d1('0x33')]?_0xde8b5c[_0x82d1('0x32')]:_0x1fbce5['model'];if(!_0x417a82[_0x82d1('0x2e')][_0x82d1('0x34')](_0x82d1('0x35'))){_0xde8b5c['limit']=qs[_0x82d1('0x1b')](_0x417a82[_0x82d1('0x2e')][_0x82d1('0x1b')]);_0xde8b5c[_0x82d1('0x19')]=qs[_0x82d1('0x19')](_0x417a82['query'][_0x82d1('0x19')]);}_0xde8b5c[_0x82d1('0x36')]=qs[_0x82d1('0x37')](_0x417a82[_0x82d1('0x2e')][_0x82d1('0x37')]);_0xde8b5c[_0x82d1('0x38')]=qs[_0x82d1('0x2f')](_['pick'](_0x417a82[_0x82d1('0x2e')],_0x1fbce5[_0x82d1('0x2f')]),_0x503c7c);if(_0x417a82[_0x82d1('0x2e')]['filter']){_0xde8b5c[_0x82d1('0x38')]=_[_0x82d1('0x39')](_0xde8b5c[_0x82d1('0x38')],{'$or':_['map'](_0x503c7c,function(_0x23d74f){if(_0x23d74f[_0x82d1('0x2b')]!=='VIRTUAL'){var _0x18c0f1={};_0x18c0f1[_0x23d74f['name']]={'$like':'%'+_0x417a82['query'][_0x82d1('0x3a')]+'%'};return _0x18c0f1;}})});}_0xde8b5c=_[_0x82d1('0x39')]({},_0xde8b5c,_0x417a82[_0x82d1('0x3b')]);var _0x5ad7fe={'where':_0xde8b5c[_0x82d1('0x38')]};return db[_0x82d1('0x29')]['count'](_0x5ad7fe)[_0x82d1('0x22')](function(_0xb8458b){_0xff2bb1['count']=_0xb8458b;if(_0x417a82['query'][_0x82d1('0x3c')]){_0xde8b5c['include']=[{'all':!![]}];}return db[_0x82d1('0x29')][_0x82d1('0x3d')](_0xde8b5c);})[_0x82d1('0x22')](function(_0x599344){_0xff2bb1[_0x82d1('0x3e')]=_0x599344;return _0xff2bb1;})[_0x82d1('0x22')](respondWithFilteredResult(_0x2f65e9,_0xde8b5c))[_0x82d1('0x3f')](handleError(_0x2f65e9,null));};exports['show']=function(_0x1fc003,_0x2e3abc){var _0x2b7d02={'raw':![],'where':{'id':_0x1fc003[_0x82d1('0x40')]['id']}},_0x24638d={};_0x24638d[_0x82d1('0x2d')]=_[_0x82d1('0x41')](db[_0x82d1('0x29')]['rawAttributes']);_0x24638d[_0x82d1('0x2e')]=_['keys'](_0x1fc003[_0x82d1('0x2e')]);_0x24638d[_0x82d1('0x2f')]=_[_0x82d1('0x30')](_0x24638d[_0x82d1('0x2d')],_0x24638d[_0x82d1('0x2e')]);_0x2b7d02[_0x82d1('0x32')]=_[_0x82d1('0x30')](_0x24638d['model'],qs['fields'](_0x1fc003[_0x82d1('0x2e')]['fields']));_0x2b7d02[_0x82d1('0x32')]=_0x2b7d02[_0x82d1('0x32')][_0x82d1('0x33')]?_0x2b7d02['attributes']:_0x24638d['model'];if(_0x1fc003[_0x82d1('0x2e')][_0x82d1('0x3c')]){_0x2b7d02[_0x82d1('0x42')]=[{'all':!![]}];}_0x2b7d02=_[_0x82d1('0x39')]({},_0x2b7d02,_0x1fc003[_0x82d1('0x3b')]);return db[_0x82d1('0x29')][_0x82d1('0x43')](_0x2b7d02)['then'](handleEntityNotFound(_0x2e3abc,null))[_0x82d1('0x22')](respondWithResult(_0x2e3abc,null))[_0x82d1('0x3f')](handleError(_0x2e3abc,null));};exports[_0x82d1('0x44')]=function(_0x438a52,_0xe73153){return db[_0x82d1('0x29')]['create'](_0x438a52[_0x82d1('0x45')],{})[_0x82d1('0x22')](respondWithResult(_0xe73153,0xc9))[_0x82d1('0x3f')](handleError(_0xe73153,null));};exports[_0x82d1('0x21')]=function(_0x248579,_0xceae46){if(_0x248579[_0x82d1('0x45')]['id']){delete _0x248579[_0x82d1('0x45')]['id'];}return db[_0x82d1('0x29')][_0x82d1('0x43')]({'where':{'id':_0x248579['params']['id']}})[_0x82d1('0x22')](handleEntityNotFound(_0xceae46,null))[_0x82d1('0x22')](saveUpdates(_0x248579[_0x82d1('0x45')],null))['then'](respondWithResult(_0xceae46,null))[_0x82d1('0x3f')](handleError(_0xceae46,null));};exports[_0x82d1('0x46')]=function(_0x44b9ff,_0xb5b8f7){return db['FreshdeskConfiguration'][_0x82d1('0x43')]({'where':{'id':_0x44b9ff[_0x82d1('0x40')]['id']}})['then'](handleEntityNotFound(_0xb5b8f7,null))[_0x82d1('0x22')](removeEntity(_0xb5b8f7,null))['catch'](handleError(_0xb5b8f7,null));};exports[_0x82d1('0x47')]=function(_0x46b42,_0x236108,_0x27e513){var _0x15817e={};var _0x521d31={};var _0x2b9314;var _0x2c8325;return db[_0x82d1('0x29')][_0x82d1('0x48')]({'where':{'id':_0x46b42[_0x82d1('0x40')]['id']}})[_0x82d1('0x22')](handleEntityNotFound(_0x236108,null))[_0x82d1('0x22')](function(_0x1b984d){if(_0x1b984d){_0x2b9314=_0x1b984d;_0x521d31['model']=_['keys'](db[_0x82d1('0x49')][_0x82d1('0x4a')]);_0x521d31[_0x82d1('0x2e')]=_[_0x82d1('0x41')](_0x46b42[_0x82d1('0x2e')]);_0x521d31[_0x82d1('0x2f')]=_[_0x82d1('0x30')](_0x521d31[_0x82d1('0x2d')],_0x521d31[_0x82d1('0x2e')]);_0x15817e[_0x82d1('0x32')]=_[_0x82d1('0x30')](_0x521d31[_0x82d1('0x2d')],qs[_0x82d1('0x31')](_0x46b42[_0x82d1('0x2e')]['fields']));_0x15817e[_0x82d1('0x32')]=_0x15817e[_0x82d1('0x32')][_0x82d1('0x33')]?_0x15817e[_0x82d1('0x32')]:_0x521d31[_0x82d1('0x2d')];_0x15817e[_0x82d1('0x36')]=qs[_0x82d1('0x37')](_0x46b42[_0x82d1('0x2e')][_0x82d1('0x37')]);_0x15817e[_0x82d1('0x38')]=qs['filters'](_['pick'](_0x46b42['query'],_0x521d31[_0x82d1('0x2f')]));if(_0x46b42[_0x82d1('0x2e')][_0x82d1('0x3a')]){_0x15817e[_0x82d1('0x38')]=_['merge'](_0x15817e[_0x82d1('0x38')],{'$or':_[_0x82d1('0x4b')](_0x15817e[_0x82d1('0x32')],function(_0x249c07){var _0x1ae06f={};_0x1ae06f[_0x249c07]={'$like':'%'+_0x46b42[_0x82d1('0x2e')]['filter']+'%'};return _0x1ae06f;})});}_0x15817e=_[_0x82d1('0x39')]({},_0x15817e,_0x46b42[_0x82d1('0x3b')]);return _0x2b9314['getFields'](_0x15817e);}})[_0x82d1('0x22')](function(_0x44e241){if(_0x44e241){_0x2c8325=_0x44e241[_0x82d1('0x33')];if(!_0x46b42[_0x82d1('0x2e')]['hasOwnProperty'](_0x82d1('0x35'))){_0x15817e[_0x82d1('0x1b')]=qs[_0x82d1('0x1b')](_0x46b42['query'][_0x82d1('0x1b')]);_0x15817e['offset']=qs[_0x82d1('0x19')](_0x46b42[_0x82d1('0x2e')][_0x82d1('0x19')]);}return _0x2b9314[_0x82d1('0x47')](_0x15817e);}})['then'](function(_0x425d9d){if(_0x425d9d){return _0x425d9d?{'count':_0x2c8325,'rows':_0x425d9d}:null;}})['then'](respondWithResult(_0x236108,null))[_0x82d1('0x3f')](handleError(_0x236108,null));};exports[_0x82d1('0x4c')]=function(_0x37fd09,_0x4e30bf,_0x2d8843){var _0x40eb7b={};var _0x3652d8={};var _0x32da5d;var _0x127e03;return db[_0x82d1('0x29')][_0x82d1('0x48')]({'where':{'id':_0x37fd09[_0x82d1('0x40')]['id']}})[_0x82d1('0x22')](handleEntityNotFound(_0x4e30bf,null))[_0x82d1('0x22')](function(_0x42142f){if(_0x42142f){_0x32da5d=_0x42142f;_0x3652d8[_0x82d1('0x2d')]=_['keys'](db[_0x82d1('0x49')][_0x82d1('0x4a')]);_0x3652d8[_0x82d1('0x2e')]=_[_0x82d1('0x41')](_0x37fd09[_0x82d1('0x2e')]);_0x3652d8[_0x82d1('0x2f')]=_['intersection'](_0x3652d8[_0x82d1('0x2d')],_0x3652d8[_0x82d1('0x2e')]);_0x40eb7b[_0x82d1('0x32')]=_[_0x82d1('0x30')](_0x3652d8[_0x82d1('0x2d')],qs[_0x82d1('0x31')](_0x37fd09[_0x82d1('0x2e')][_0x82d1('0x31')]));_0x40eb7b['attributes']=_0x40eb7b[_0x82d1('0x32')][_0x82d1('0x33')]?_0x40eb7b[_0x82d1('0x32')]:_0x3652d8[_0x82d1('0x2d')];_0x40eb7b[_0x82d1('0x36')]=qs[_0x82d1('0x37')](_0x37fd09['query'][_0x82d1('0x37')]);_0x40eb7b['where']=qs[_0x82d1('0x2f')](_[_0x82d1('0x4d')](_0x37fd09[_0x82d1('0x2e')],_0x3652d8[_0x82d1('0x2f')]));if(_0x37fd09[_0x82d1('0x2e')]['filter']){_0x40eb7b[_0x82d1('0x38')]=_[_0x82d1('0x39')](_0x40eb7b[_0x82d1('0x38')],{'$or':_[_0x82d1('0x4b')](_0x40eb7b['attributes'],function(_0x591656){var _0x9b8a68={};_0x9b8a68[_0x591656]={'$like':'%'+_0x37fd09[_0x82d1('0x2e')][_0x82d1('0x3a')]+'%'};return _0x9b8a68;})});}_0x40eb7b=_[_0x82d1('0x39')]({},_0x40eb7b,_0x37fd09[_0x82d1('0x3b')]);return _0x32da5d[_0x82d1('0x4c')](_0x40eb7b);}})['then'](function(_0x393872){if(_0x393872){_0x127e03=_0x393872[_0x82d1('0x33')];if(!_0x37fd09['query'][_0x82d1('0x34')]('nolimit')){_0x40eb7b['limit']=qs['limit'](_0x37fd09[_0x82d1('0x2e')][_0x82d1('0x1b')]);_0x40eb7b['offset']=qs[_0x82d1('0x19')](_0x37fd09[_0x82d1('0x2e')][_0x82d1('0x19')]);}return _0x32da5d[_0x82d1('0x4c')](_0x40eb7b);}})[_0x82d1('0x22')](function(_0x14cced){if(_0x14cced){return _0x14cced?{'count':_0x127e03,'rows':_0x14cced}:null;}})['then'](respondWithResult(_0x4e30bf,null))[_0x82d1('0x3f')](handleError(_0x4e30bf,null));};exports[_0x82d1('0x4e')]=function(_0x3c337f,_0x544ac8,_0x184ccf){var _0x197773={};var _0x5b8379={};var _0x44a6f5;var _0x4066f3;return db[_0x82d1('0x29')][_0x82d1('0x48')]({'where':{'id':_0x3c337f['params']['id']}})[_0x82d1('0x22')](handleEntityNotFound(_0x544ac8,null))[_0x82d1('0x22')](function(_0x2ea3e1){if(_0x2ea3e1){_0x44a6f5=_0x2ea3e1;_0x5b8379[_0x82d1('0x2d')]=_[_0x82d1('0x41')](db[_0x82d1('0x49')][_0x82d1('0x4a')]);_0x5b8379[_0x82d1('0x2e')]=_['keys'](_0x3c337f['query']);_0x5b8379[_0x82d1('0x2f')]=_[_0x82d1('0x30')](_0x5b8379[_0x82d1('0x2d')],_0x5b8379['query']);_0x197773[_0x82d1('0x32')]=_[_0x82d1('0x30')](_0x5b8379[_0x82d1('0x2d')],qs[_0x82d1('0x31')](_0x3c337f[_0x82d1('0x2e')][_0x82d1('0x31')]));_0x197773[_0x82d1('0x32')]=_0x197773[_0x82d1('0x32')][_0x82d1('0x33')]?_0x197773['attributes']:_0x5b8379[_0x82d1('0x2d')];_0x197773[_0x82d1('0x36')]=qs[_0x82d1('0x37')](_0x3c337f[_0x82d1('0x2e')][_0x82d1('0x37')]);_0x197773[_0x82d1('0x38')]=qs['filters'](_[_0x82d1('0x4d')](_0x3c337f[_0x82d1('0x2e')],_0x5b8379['filters']));if(_0x3c337f[_0x82d1('0x2e')][_0x82d1('0x3a')]){_0x197773[_0x82d1('0x38')]=_[_0x82d1('0x39')](_0x197773[_0x82d1('0x38')],{'$or':_[_0x82d1('0x4b')](_0x197773[_0x82d1('0x32')],function(_0x26a2cf){var _0x41a99a={};_0x41a99a[_0x26a2cf]={'$like':'%'+_0x3c337f[_0x82d1('0x2e')][_0x82d1('0x3a')]+'%'};return _0x41a99a;})});}_0x197773=_['merge']({},_0x197773,_0x3c337f[_0x82d1('0x3b')]);return _0x44a6f5['getDescriptions'](_0x197773);}})[_0x82d1('0x22')](function(_0x4dd5d8){if(_0x4dd5d8){_0x4066f3=_0x4dd5d8[_0x82d1('0x33')];if(!_0x3c337f['query'][_0x82d1('0x34')]('nolimit')){_0x197773[_0x82d1('0x1b')]=qs[_0x82d1('0x1b')](_0x3c337f['query'][_0x82d1('0x1b')]);_0x197773[_0x82d1('0x19')]=qs[_0x82d1('0x19')](_0x3c337f['query'][_0x82d1('0x19')]);}return _0x44a6f5['getDescriptions'](_0x197773);}})[_0x82d1('0x22')](function(_0x3fce61){if(_0x3fce61){return _0x3fce61?{'count':_0x4066f3,'rows':_0x3fce61}:null;}})[_0x82d1('0x22')](respondWithResult(_0x544ac8,null))[_0x82d1('0x3f')](handleError(_0x544ac8,null));};exports[_0x82d1('0x4f')]=function(_0x38da4c,_0x531557,_0x1eaba3){var _0x47d150={};var _0x39c925={};var _0x19bd9d;var _0x97b2f6;return db[_0x82d1('0x29')][_0x82d1('0x48')]({'where':{'id':_0x38da4c['params']['id']}})[_0x82d1('0x22')](handleEntityNotFound(_0x531557,null))[_0x82d1('0x22')](function(_0x5d1389){if(_0x5d1389){_0x19bd9d=_0x5d1389;_0x39c925['model']=_[_0x82d1('0x41')](db[_0x82d1('0x50')]['rawAttributes']);_0x39c925['query']=_[_0x82d1('0x41')](_0x38da4c[_0x82d1('0x2e')]);_0x39c925[_0x82d1('0x2f')]=_[_0x82d1('0x30')](_0x39c925[_0x82d1('0x2d')],_0x39c925[_0x82d1('0x2e')]);_0x47d150['attributes']=_[_0x82d1('0x30')](_0x39c925[_0x82d1('0x2d')],qs[_0x82d1('0x31')](_0x38da4c[_0x82d1('0x2e')][_0x82d1('0x31')]));_0x47d150['attributes']=_0x47d150[_0x82d1('0x32')][_0x82d1('0x33')]?_0x47d150[_0x82d1('0x32')]:_0x39c925[_0x82d1('0x2d')];_0x47d150['order']=qs[_0x82d1('0x37')](_0x38da4c['query'][_0x82d1('0x37')]);_0x47d150['where']=qs[_0x82d1('0x2f')](_[_0x82d1('0x4d')](_0x38da4c['query'],_0x39c925['filters']));if(_0x38da4c[_0x82d1('0x2e')][_0x82d1('0x3a')]){_0x47d150[_0x82d1('0x38')]=_[_0x82d1('0x39')](_0x47d150[_0x82d1('0x38')],{'$or':_[_0x82d1('0x4b')](_0x47d150[_0x82d1('0x32')],function(_0x16a43e){var _0x2813a8={};_0x2813a8[_0x16a43e]={'$like':'%'+_0x38da4c['query'][_0x82d1('0x3a')]+'%'};return _0x2813a8;})});}_0x47d150=_[_0x82d1('0x39')]({},_0x47d150,_0x38da4c[_0x82d1('0x3b')]);return _0x19bd9d[_0x82d1('0x4f')](_0x47d150);}})['then'](function(_0x1c9b16){if(_0x1c9b16){_0x97b2f6=_0x1c9b16[_0x82d1('0x33')];if(!_0x38da4c[_0x82d1('0x2e')][_0x82d1('0x34')](_0x82d1('0x35'))){_0x47d150['limit']=qs[_0x82d1('0x1b')](_0x38da4c[_0x82d1('0x2e')][_0x82d1('0x1b')]);_0x47d150[_0x82d1('0x19')]=qs['offset'](_0x38da4c[_0x82d1('0x2e')][_0x82d1('0x19')]);}return _0x19bd9d['getTags'](_0x47d150);}})[_0x82d1('0x22')](function(_0x83f030){if(_0x83f030){return _0x83f030?{'count':_0x97b2f6,'rows':_0x83f030}:null;}})[_0x82d1('0x22')](respondWithResult(_0x531557,null))[_0x82d1('0x3f')](handleError(_0x531557,null));};exports[_0x82d1('0x51')]=function(_0x30c1e0,_0x109de2,_0x170ade){if(_0x30c1e0[_0x82d1('0x45')]['id']){delete _0x30c1e0[_0x82d1('0x45')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x30c1e0[_0x82d1('0x40')]['id']}})[_0x82d1('0x22')](handleEntityNotFound(_0x109de2,null))[_0x82d1('0x22')](function(_0x3e3727){if(_0x3e3727){return _0x3e3727['setTags'](_0x30c1e0['body'][_0x82d1('0x52')]||[]);}return null;})[_0x82d1('0x22')](respondWithResult(_0x109de2,null))[_0x82d1('0x3f')](handleError(_0x109de2,null));}; \ No newline at end of file +var _0xa052=['getTags','setTags','ids','eml-format','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','save','update','then','destroy','stack','name','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','body','getFields','findOne','getSubjects','hasOwnProperty','getDescriptions','FreshdeskField','Tag'];(function(_0x260eef,_0x3c5ad7){var _0x1e1fd8=function(_0x145ccc){while(--_0x145ccc){_0x260eef['push'](_0x260eef['shift']());}};_0x1e1fd8(++_0x3c5ad7);}(_0xa052,0x198));var _0x2a05=function(_0x41e5f4,_0x51bd75){_0x41e5f4=_0x41e5f4-0x0;var _0x357771=_0xa052[_0x41e5f4];return _0x357771;};'use strict';var emlformat=require(_0x2a05('0x0'));var rimraf=require(_0x2a05('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2a05('0x2'));var moment=require(_0x2a05('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2a05('0x4'));var util=require(_0x2a05('0x5'));var path=require(_0x2a05('0x6'));var sox=require('sox');var csv=require(_0x2a05('0x7'));var ejs=require(_0x2a05('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a05('0x9'));var squel=require(_0x2a05('0xa'));var crypto=require('crypto');var jsforce=require(_0x2a05('0xb'));var deskjs=require(_0x2a05('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2a05('0xd'));var Papa=require('papaparse');var Redis=require(_0x2a05('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2a05('0xf'));var as=require(_0x2a05('0x10'));var hardwareService=require(_0x2a05('0x11'));var logger=require(_0x2a05('0x12'))(_0x2a05('0x13'));var utils=require(_0x2a05('0x14'));var config=require(_0x2a05('0x15'));var licenseUtil=require(_0x2a05('0x16'));var db=require(_0x2a05('0x17'))['db'];function respondWithStatusCode(_0x1a99f3,_0x3f43e1){_0x3f43e1=_0x3f43e1||0xcc;return function(_0x36f9db){if(_0x36f9db){return _0x1a99f3[_0x2a05('0x18')](_0x3f43e1);}return _0x1a99f3[_0x2a05('0x19')](_0x3f43e1)[_0x2a05('0x1a')]();};}function respondWithResult(_0xabdad1,_0x521d56){_0x521d56=_0x521d56||0xc8;return function(_0x27a6ec){if(_0x27a6ec){return _0xabdad1[_0x2a05('0x19')](_0x521d56)['json'](_0x27a6ec);}};}function respondWithFilteredResult(_0x33d33f,_0x3c330d){return function(_0x315cca){if(_0x315cca){var _0x1064c4=typeof _0x3c330d[_0x2a05('0x1b')]===_0x2a05('0x1c')&&typeof _0x3c330d['limit']===_0x2a05('0x1c');var _0xd07db3=_0x315cca[_0x2a05('0x1d')];var _0x2fa131=_0x1064c4?0x0:_0x3c330d[_0x2a05('0x1b')];var _0x2ab7be=_0x1064c4?_0x315cca[_0x2a05('0x1d')]:_0x3c330d[_0x2a05('0x1b')]+_0x3c330d[_0x2a05('0x1e')];var _0x326546;if(_0x2ab7be>=_0xd07db3){_0x2ab7be=_0xd07db3;_0x326546=0xc8;}else{_0x326546=0xce;}_0x33d33f[_0x2a05('0x19')](_0x326546);return _0x33d33f['set'](_0x2a05('0x1f'),_0x2fa131+'-'+_0x2ab7be+'/'+_0xd07db3)[_0x2a05('0x20')](_0x315cca);}return null;};}function patchUpdates(_0x2a4ad1){return function(_0x26e0bc){try{jsonpatch[_0x2a05('0x21')](_0x26e0bc,_0x2a4ad1,!![]);}catch(_0x4b18f4){return BPromise['reject'](_0x4b18f4);}return _0x26e0bc[_0x2a05('0x22')]();};}function saveUpdates(_0x3e0e52,_0x548a25){return function(_0xa60926){if(_0xa60926){return _0xa60926[_0x2a05('0x23')](_0x3e0e52)[_0x2a05('0x24')](function(_0x414abd){return _0x414abd;});}return null;};}function removeEntity(_0x847458,_0x2d55df){return function(_0x35925a){if(_0x35925a){return _0x35925a[_0x2a05('0x25')]()[_0x2a05('0x24')](function(){_0x847458['status'](0xcc)[_0x2a05('0x1a')]();});}};}function handleEntityNotFound(_0x23d5d2,_0x113ecf){return function(_0x2e03a7){if(!_0x2e03a7){_0x23d5d2[_0x2a05('0x18')](0x194);}return _0x2e03a7;};}function handleError(_0x57f432,_0x21b614){_0x21b614=_0x21b614||0x1f4;return function(_0x290b5d){logger['error'](_0x290b5d[_0x2a05('0x26')]);if(_0x290b5d[_0x2a05('0x27')]){delete _0x290b5d[_0x2a05('0x27')];}_0x57f432[_0x2a05('0x19')](_0x21b614)['send'](_0x290b5d);};}exports['index']=function(_0x543d00,_0x1a4521){var _0x4ec33b={},_0x4fea3e={},_0x3dff93={'count':0x0,'rows':[]};var _0x1c201e=_[_0x2a05('0x28')](db[_0x2a05('0x29')][_0x2a05('0x2a')],function(_0x56fd69){return{'name':_0x56fd69[_0x2a05('0x2b')],'type':_0x56fd69[_0x2a05('0x2c')][_0x2a05('0x2d')]};});_0x4fea3e['model']=_[_0x2a05('0x28')](_0x1c201e,_0x2a05('0x27'));_0x4fea3e[_0x2a05('0x2e')]=_[_0x2a05('0x2f')](_0x543d00[_0x2a05('0x2e')]);_0x4fea3e['filters']=_[_0x2a05('0x30')](_0x4fea3e['model'],_0x4fea3e[_0x2a05('0x2e')]);_0x4ec33b[_0x2a05('0x31')]=_[_0x2a05('0x30')](_0x4fea3e[_0x2a05('0x32')],qs[_0x2a05('0x33')](_0x543d00[_0x2a05('0x2e')][_0x2a05('0x33')]));_0x4ec33b[_0x2a05('0x31')]=_0x4ec33b[_0x2a05('0x31')][_0x2a05('0x34')]?_0x4ec33b[_0x2a05('0x31')]:_0x4fea3e[_0x2a05('0x32')];if(!_0x543d00[_0x2a05('0x2e')]['hasOwnProperty'](_0x2a05('0x35'))){_0x4ec33b[_0x2a05('0x1e')]=qs[_0x2a05('0x1e')](_0x543d00[_0x2a05('0x2e')][_0x2a05('0x1e')]);_0x4ec33b['offset']=qs['offset'](_0x543d00[_0x2a05('0x2e')][_0x2a05('0x1b')]);}_0x4ec33b[_0x2a05('0x36')]=qs[_0x2a05('0x37')](_0x543d00['query']['sort']);_0x4ec33b[_0x2a05('0x38')]=qs[_0x2a05('0x39')](_[_0x2a05('0x3a')](_0x543d00[_0x2a05('0x2e')],_0x4fea3e[_0x2a05('0x39')]),_0x1c201e);if(_0x543d00['query'][_0x2a05('0x3b')]){_0x4ec33b['where']=_['merge'](_0x4ec33b[_0x2a05('0x38')],{'$or':_['map'](_0x1c201e,function(_0x19d46){if(_0x19d46[_0x2a05('0x2c')]!==_0x2a05('0x3c')){var _0x2cb5e9={};_0x2cb5e9[_0x19d46[_0x2a05('0x27')]]={'$like':'%'+_0x543d00['query'][_0x2a05('0x3b')]+'%'};return _0x2cb5e9;}})});}_0x4ec33b=_[_0x2a05('0x3d')]({},_0x4ec33b,_0x543d00[_0x2a05('0x3e')]);var _0x4ed15f={'where':_0x4ec33b[_0x2a05('0x38')]};return db['FreshdeskConfiguration'][_0x2a05('0x1d')](_0x4ed15f)[_0x2a05('0x24')](function(_0x5458bc){_0x3dff93['count']=_0x5458bc;if(_0x543d00[_0x2a05('0x2e')][_0x2a05('0x3f')]){_0x4ec33b[_0x2a05('0x40')]=[{'all':!![]}];}return db[_0x2a05('0x29')]['findAll'](_0x4ec33b);})[_0x2a05('0x24')](function(_0x954d95){_0x3dff93[_0x2a05('0x41')]=_0x954d95;return _0x3dff93;})[_0x2a05('0x24')](respondWithFilteredResult(_0x1a4521,_0x4ec33b))[_0x2a05('0x42')](handleError(_0x1a4521,null));};exports['show']=function(_0x1861af,_0x11974f){var _0xe4be44={'raw':![],'where':{'id':_0x1861af[_0x2a05('0x43')]['id']}},_0x20a82b={};_0x20a82b[_0x2a05('0x32')]=_['keys'](db['FreshdeskConfiguration'][_0x2a05('0x2a')]);_0x20a82b['query']=_[_0x2a05('0x2f')](_0x1861af['query']);_0x20a82b[_0x2a05('0x39')]=_[_0x2a05('0x30')](_0x20a82b[_0x2a05('0x32')],_0x20a82b['query']);_0xe4be44['attributes']=_[_0x2a05('0x30')](_0x20a82b[_0x2a05('0x32')],qs[_0x2a05('0x33')](_0x1861af[_0x2a05('0x2e')][_0x2a05('0x33')]));_0xe4be44[_0x2a05('0x31')]=_0xe4be44[_0x2a05('0x31')][_0x2a05('0x34')]?_0xe4be44[_0x2a05('0x31')]:_0x20a82b['model'];if(_0x1861af[_0x2a05('0x2e')][_0x2a05('0x3f')]){_0xe4be44[_0x2a05('0x40')]=[{'all':!![]}];}_0xe4be44=_[_0x2a05('0x3d')]({},_0xe4be44,_0x1861af[_0x2a05('0x3e')]);return db['FreshdeskConfiguration'][_0x2a05('0x44')](_0xe4be44)[_0x2a05('0x24')](handleEntityNotFound(_0x11974f,null))[_0x2a05('0x24')](respondWithResult(_0x11974f,null))['catch'](handleError(_0x11974f,null));};exports[_0x2a05('0x45')]=function(_0x31bd8c,_0x15210c){return db[_0x2a05('0x29')][_0x2a05('0x45')](_0x31bd8c[_0x2a05('0x46')],{})['then'](respondWithResult(_0x15210c,0xc9))[_0x2a05('0x42')](handleError(_0x15210c,null));};exports[_0x2a05('0x23')]=function(_0x1c1736,_0x54fb30){if(_0x1c1736['body']['id']){delete _0x1c1736[_0x2a05('0x46')]['id'];}return db['FreshdeskConfiguration'][_0x2a05('0x44')]({'where':{'id':_0x1c1736[_0x2a05('0x43')]['id']}})[_0x2a05('0x24')](handleEntityNotFound(_0x54fb30,null))[_0x2a05('0x24')](saveUpdates(_0x1c1736[_0x2a05('0x46')],null))[_0x2a05('0x24')](respondWithResult(_0x54fb30,null))[_0x2a05('0x42')](handleError(_0x54fb30,null));};exports[_0x2a05('0x25')]=function(_0x2b2c92,_0x61f1d8){return db[_0x2a05('0x29')][_0x2a05('0x44')]({'where':{'id':_0x2b2c92[_0x2a05('0x43')]['id']}})[_0x2a05('0x24')](handleEntityNotFound(_0x61f1d8,null))[_0x2a05('0x24')](removeEntity(_0x61f1d8,null))[_0x2a05('0x42')](handleError(_0x61f1d8,null));};exports[_0x2a05('0x47')]=function(_0x1bc599,_0x47c314,_0x537b70){var _0x3b8e46={};var _0x4a9045={};var _0x4f290e;var _0x2d47b7;return db[_0x2a05('0x29')][_0x2a05('0x48')]({'where':{'id':_0x1bc599[_0x2a05('0x43')]['id']}})[_0x2a05('0x24')](handleEntityNotFound(_0x47c314,null))[_0x2a05('0x24')](function(_0x54a80c){if(_0x54a80c){_0x4f290e=_0x54a80c;_0x4a9045[_0x2a05('0x32')]=_[_0x2a05('0x2f')](db['FreshdeskField'][_0x2a05('0x2a')]);_0x4a9045[_0x2a05('0x2e')]=_[_0x2a05('0x2f')](_0x1bc599['query']);_0x4a9045[_0x2a05('0x39')]=_[_0x2a05('0x30')](_0x4a9045['model'],_0x4a9045[_0x2a05('0x2e')]);_0x3b8e46['attributes']=_['intersection'](_0x4a9045[_0x2a05('0x32')],qs[_0x2a05('0x33')](_0x1bc599[_0x2a05('0x2e')]['fields']));_0x3b8e46['attributes']=_0x3b8e46[_0x2a05('0x31')]['length']?_0x3b8e46[_0x2a05('0x31')]:_0x4a9045[_0x2a05('0x32')];_0x3b8e46['order']=qs[_0x2a05('0x37')](_0x1bc599[_0x2a05('0x2e')]['sort']);_0x3b8e46[_0x2a05('0x38')]=qs[_0x2a05('0x39')](_['pick'](_0x1bc599['query'],_0x4a9045['filters']));if(_0x1bc599[_0x2a05('0x2e')][_0x2a05('0x3b')]){_0x3b8e46[_0x2a05('0x38')]=_[_0x2a05('0x3d')](_0x3b8e46['where'],{'$or':_[_0x2a05('0x28')](_0x3b8e46[_0x2a05('0x31')],function(_0x227c1c){var _0x2a3e11={};_0x2a3e11[_0x227c1c]={'$like':'%'+_0x1bc599[_0x2a05('0x2e')][_0x2a05('0x3b')]+'%'};return _0x2a3e11;})});}_0x3b8e46=_[_0x2a05('0x3d')]({},_0x3b8e46,_0x1bc599[_0x2a05('0x3e')]);return _0x4f290e[_0x2a05('0x47')](_0x3b8e46);}})[_0x2a05('0x24')](function(_0x140d9a){if(_0x140d9a){_0x2d47b7=_0x140d9a[_0x2a05('0x34')];if(!_0x1bc599[_0x2a05('0x2e')]['hasOwnProperty'](_0x2a05('0x35'))){_0x3b8e46['limit']=qs[_0x2a05('0x1e')](_0x1bc599[_0x2a05('0x2e')][_0x2a05('0x1e')]);_0x3b8e46['offset']=qs[_0x2a05('0x1b')](_0x1bc599['query'][_0x2a05('0x1b')]);}return _0x4f290e[_0x2a05('0x47')](_0x3b8e46);}})['then'](function(_0xb3abfb){if(_0xb3abfb){return _0xb3abfb?{'count':_0x2d47b7,'rows':_0xb3abfb}:null;}})[_0x2a05('0x24')](respondWithResult(_0x47c314,null))[_0x2a05('0x42')](handleError(_0x47c314,null));};exports['getSubjects']=function(_0x5bbaf0,_0x42eab7,_0x111f3f){var _0x2019a1={};var _0x10da15={};var _0x4fb688;var _0x36482b;return db[_0x2a05('0x29')][_0x2a05('0x48')]({'where':{'id':_0x5bbaf0[_0x2a05('0x43')]['id']}})['then'](handleEntityNotFound(_0x42eab7,null))[_0x2a05('0x24')](function(_0x795b9b){if(_0x795b9b){_0x4fb688=_0x795b9b;_0x10da15[_0x2a05('0x32')]=_['keys'](db['FreshdeskField'][_0x2a05('0x2a')]);_0x10da15[_0x2a05('0x2e')]=_[_0x2a05('0x2f')](_0x5bbaf0[_0x2a05('0x2e')]);_0x10da15['filters']=_[_0x2a05('0x30')](_0x10da15[_0x2a05('0x32')],_0x10da15['query']);_0x2019a1[_0x2a05('0x31')]=_[_0x2a05('0x30')](_0x10da15[_0x2a05('0x32')],qs['fields'](_0x5bbaf0[_0x2a05('0x2e')][_0x2a05('0x33')]));_0x2019a1[_0x2a05('0x31')]=_0x2019a1[_0x2a05('0x31')][_0x2a05('0x34')]?_0x2019a1['attributes']:_0x10da15[_0x2a05('0x32')];_0x2019a1[_0x2a05('0x36')]=qs['sort'](_0x5bbaf0[_0x2a05('0x2e')][_0x2a05('0x37')]);_0x2019a1[_0x2a05('0x38')]=qs['filters'](_[_0x2a05('0x3a')](_0x5bbaf0[_0x2a05('0x2e')],_0x10da15[_0x2a05('0x39')]));if(_0x5bbaf0[_0x2a05('0x2e')][_0x2a05('0x3b')]){_0x2019a1[_0x2a05('0x38')]=_['merge'](_0x2019a1[_0x2a05('0x38')],{'$or':_[_0x2a05('0x28')](_0x2019a1[_0x2a05('0x31')],function(_0x8ade71){var _0x5958dd={};_0x5958dd[_0x8ade71]={'$like':'%'+_0x5bbaf0[_0x2a05('0x2e')][_0x2a05('0x3b')]+'%'};return _0x5958dd;})});}_0x2019a1=_[_0x2a05('0x3d')]({},_0x2019a1,_0x5bbaf0[_0x2a05('0x3e')]);return _0x4fb688[_0x2a05('0x49')](_0x2019a1);}})[_0x2a05('0x24')](function(_0xce2e50){if(_0xce2e50){_0x36482b=_0xce2e50[_0x2a05('0x34')];if(!_0x5bbaf0[_0x2a05('0x2e')][_0x2a05('0x4a')](_0x2a05('0x35'))){_0x2019a1[_0x2a05('0x1e')]=qs[_0x2a05('0x1e')](_0x5bbaf0[_0x2a05('0x2e')][_0x2a05('0x1e')]);_0x2019a1['offset']=qs[_0x2a05('0x1b')](_0x5bbaf0['query'][_0x2a05('0x1b')]);}return _0x4fb688[_0x2a05('0x49')](_0x2019a1);}})[_0x2a05('0x24')](function(_0x4d9e4b){if(_0x4d9e4b){return _0x4d9e4b?{'count':_0x36482b,'rows':_0x4d9e4b}:null;}})[_0x2a05('0x24')](respondWithResult(_0x42eab7,null))[_0x2a05('0x42')](handleError(_0x42eab7,null));};exports[_0x2a05('0x4b')]=function(_0x5dfac0,_0x3f653e,_0x471cb4){var _0x113ffb={};var _0x1cad35={};var _0x10d92e;var _0x13fc5c;return db[_0x2a05('0x29')][_0x2a05('0x48')]({'where':{'id':_0x5dfac0[_0x2a05('0x43')]['id']}})[_0x2a05('0x24')](handleEntityNotFound(_0x3f653e,null))['then'](function(_0x2c8368){if(_0x2c8368){_0x10d92e=_0x2c8368;_0x1cad35[_0x2a05('0x32')]=_['keys'](db[_0x2a05('0x4c')][_0x2a05('0x2a')]);_0x1cad35[_0x2a05('0x2e')]=_['keys'](_0x5dfac0[_0x2a05('0x2e')]);_0x1cad35[_0x2a05('0x39')]=_['intersection'](_0x1cad35[_0x2a05('0x32')],_0x1cad35['query']);_0x113ffb['attributes']=_['intersection'](_0x1cad35[_0x2a05('0x32')],qs[_0x2a05('0x33')](_0x5dfac0['query'][_0x2a05('0x33')]));_0x113ffb[_0x2a05('0x31')]=_0x113ffb[_0x2a05('0x31')][_0x2a05('0x34')]?_0x113ffb[_0x2a05('0x31')]:_0x1cad35['model'];_0x113ffb['order']=qs['sort'](_0x5dfac0[_0x2a05('0x2e')][_0x2a05('0x37')]);_0x113ffb[_0x2a05('0x38')]=qs[_0x2a05('0x39')](_[_0x2a05('0x3a')](_0x5dfac0[_0x2a05('0x2e')],_0x1cad35[_0x2a05('0x39')]));if(_0x5dfac0[_0x2a05('0x2e')]['filter']){_0x113ffb[_0x2a05('0x38')]=_[_0x2a05('0x3d')](_0x113ffb[_0x2a05('0x38')],{'$or':_['map'](_0x113ffb[_0x2a05('0x31')],function(_0x2649bf){var _0xbc02da={};_0xbc02da[_0x2649bf]={'$like':'%'+_0x5dfac0['query']['filter']+'%'};return _0xbc02da;})});}_0x113ffb=_[_0x2a05('0x3d')]({},_0x113ffb,_0x5dfac0[_0x2a05('0x3e')]);return _0x10d92e['getDescriptions'](_0x113ffb);}})[_0x2a05('0x24')](function(_0x3159cc){if(_0x3159cc){_0x13fc5c=_0x3159cc[_0x2a05('0x34')];if(!_0x5dfac0[_0x2a05('0x2e')]['hasOwnProperty'](_0x2a05('0x35'))){_0x113ffb['limit']=qs[_0x2a05('0x1e')](_0x5dfac0[_0x2a05('0x2e')][_0x2a05('0x1e')]);_0x113ffb['offset']=qs[_0x2a05('0x1b')](_0x5dfac0['query']['offset']);}return _0x10d92e[_0x2a05('0x4b')](_0x113ffb);}})[_0x2a05('0x24')](function(_0x33c372){if(_0x33c372){return _0x33c372?{'count':_0x13fc5c,'rows':_0x33c372}:null;}})[_0x2a05('0x24')](respondWithResult(_0x3f653e,null))[_0x2a05('0x42')](handleError(_0x3f653e,null));};exports['getTags']=function(_0x3b3554,_0x34ea87,_0x2c935a){var _0x5c820d={};var _0x41a925={};var _0x52e59e;var _0x57c3d7;return db[_0x2a05('0x29')][_0x2a05('0x48')]({'where':{'id':_0x3b3554[_0x2a05('0x43')]['id']}})['then'](handleEntityNotFound(_0x34ea87,null))[_0x2a05('0x24')](function(_0x55b9c4){if(_0x55b9c4){_0x52e59e=_0x55b9c4;_0x41a925['model']=_[_0x2a05('0x2f')](db[_0x2a05('0x4d')][_0x2a05('0x2a')]);_0x41a925[_0x2a05('0x2e')]=_[_0x2a05('0x2f')](_0x3b3554[_0x2a05('0x2e')]);_0x41a925['filters']=_[_0x2a05('0x30')](_0x41a925[_0x2a05('0x32')],_0x41a925[_0x2a05('0x2e')]);_0x5c820d[_0x2a05('0x31')]=_[_0x2a05('0x30')](_0x41a925['model'],qs['fields'](_0x3b3554[_0x2a05('0x2e')][_0x2a05('0x33')]));_0x5c820d[_0x2a05('0x31')]=_0x5c820d[_0x2a05('0x31')][_0x2a05('0x34')]?_0x5c820d[_0x2a05('0x31')]:_0x41a925['model'];_0x5c820d[_0x2a05('0x36')]=qs['sort'](_0x3b3554[_0x2a05('0x2e')][_0x2a05('0x37')]);_0x5c820d[_0x2a05('0x38')]=qs['filters'](_['pick'](_0x3b3554[_0x2a05('0x2e')],_0x41a925[_0x2a05('0x39')]));if(_0x3b3554[_0x2a05('0x2e')]['filter']){_0x5c820d['where']=_['merge'](_0x5c820d[_0x2a05('0x38')],{'$or':_[_0x2a05('0x28')](_0x5c820d[_0x2a05('0x31')],function(_0x72a53e){var _0x495c1e={};_0x495c1e[_0x72a53e]={'$like':'%'+_0x3b3554[_0x2a05('0x2e')]['filter']+'%'};return _0x495c1e;})});}_0x5c820d=_[_0x2a05('0x3d')]({},_0x5c820d,_0x3b3554[_0x2a05('0x3e')]);return _0x52e59e[_0x2a05('0x4e')](_0x5c820d);}})['then'](function(_0x5b19eb){if(_0x5b19eb){_0x57c3d7=_0x5b19eb[_0x2a05('0x34')];if(!_0x3b3554[_0x2a05('0x2e')][_0x2a05('0x4a')]('nolimit')){_0x5c820d[_0x2a05('0x1e')]=qs[_0x2a05('0x1e')](_0x3b3554[_0x2a05('0x2e')][_0x2a05('0x1e')]);_0x5c820d[_0x2a05('0x1b')]=qs[_0x2a05('0x1b')](_0x3b3554[_0x2a05('0x2e')][_0x2a05('0x1b')]);}return _0x52e59e[_0x2a05('0x4e')](_0x5c820d);}})['then'](function(_0x53783f){if(_0x53783f){return _0x53783f?{'count':_0x57c3d7,'rows':_0x53783f}:null;}})['then'](respondWithResult(_0x34ea87,null))[_0x2a05('0x42')](handleError(_0x34ea87,null));};exports[_0x2a05('0x4f')]=function(_0x17c11e,_0x5e4836,_0x49847d){if(_0x17c11e[_0x2a05('0x46')]['id']){delete _0x17c11e['body']['id'];}return db[_0x2a05('0x29')]['findOne']({'where':{'id':_0x17c11e[_0x2a05('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e4836,null))[_0x2a05('0x24')](function(_0x5593ab){if(_0x5593ab){return _0x5593ab[_0x2a05('0x4f')](_0x17c11e[_0x2a05('0x46')][_0x2a05('0x50')]||[]);}return null;})[_0x2a05('0x24')](respondWithResult(_0x5e4836,null))[_0x2a05('0x42')](handleError(_0x5e4836,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index bfad04c..ad4d797 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 _0xf1a5=['int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x14e201,_0x31e6d7){var _0x1f0fa0=function(_0x1a7da9){while(--_0x1a7da9){_0x14e201['push'](_0x14e201['shift']());}};_0x1f0fa0(++_0x31e6d7);}(_0xf1a5,0x151));var _0x5f1a=function(_0x18f88b,_0x18f637){_0x18f88b=_0x18f88b-0x0;var _0x3512bd=_0xf1a5[_0x18f88b];return _0x3512bd;};'use strict';var _=require(_0x5f1a('0x0'));var util=require('util');var logger=require(_0x5f1a('0x1'))(_0x5f1a('0x2'));var moment=require(_0x5f1a('0x3'));var BPromise=require(_0x5f1a('0x4'));var rp=require(_0x5f1a('0x5'));var fs=require('fs');var path=require(_0x5f1a('0x6'));var rimraf=require('rimraf');var config=require(_0x5f1a('0x7'));var attributes=require(_0x5f1a('0x8'));module[_0x5f1a('0x9')]=function(_0x40f1b9,_0x4c2abe){return _0x40f1b9[_0x5f1a('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0x5f1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d5a=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x4d5a,0x1e3));var _0xa4d5=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4d5a[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xa4d5('0x0'));var util=require(_0xa4d5('0x1'));var logger=require('../../config/logger')(_0xa4d5('0x2'));var moment=require(_0xa4d5('0x3'));var BPromise=require(_0xa4d5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa4d5('0x5'));var rimraf=require(_0xa4d5('0x6'));var config=require(_0xa4d5('0x7'));var attributes=require(_0xa4d5('0x8'));module[_0xa4d5('0x9')]=function(_0x52ad32,_0xac9c7e){return _0x52ad32[_0xa4d5('0xa')](_0xa4d5('0xb'),attributes,{'tableName':_0xa4d5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 431d441..2a8c30e 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 _0xc7a2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0xc027db,_0x1ee3c8){var _0x1a2189=function(_0x1c4c83){while(--_0x1c4c83){_0xc027db['push'](_0xc027db['shift']());}};_0x1a2189(++_0x1ee3c8);}(_0xc7a2,0x106));var _0x2c7a=function(_0x5ec09b,_0x12d654){_0x5ec09b=_0x5ec09b-0x0;var _0x5a8482=_0xc7a2[_0x5ec09b];return _0x5a8482;};'use strict';var _=require(_0x2c7a('0x0'));var util=require(_0x2c7a('0x1'));var moment=require('moment');var BPromise=require(_0x2c7a('0x2'));var rs=require(_0x2c7a('0x3'));var fs=require('fs');var Redis=require(_0x2c7a('0x4'));var db=require(_0x2c7a('0x5'))['db'];var utils=require(_0x2c7a('0x6'));var logger=require(_0x2c7a('0x7'))(_0x2c7a('0x8'));var config=require(_0x2c7a('0x9'));var jayson=require(_0x2c7a('0xa'));var client=jayson['client'][_0x2c7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d3589,_0x63a461,_0x36ce38){return new BPromise(function(_0x39e019,_0x5b2bbd){return client['request'](_0x3d3589,_0x36ce38)[_0x2c7a('0xc')](function(_0x49fbc3){logger[_0x2c7a('0xd')](_0x2c7a('0xe'),_0x63a461,_0x2c7a('0xf'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x63a461,_0x2c7a('0xf'),JSON[_0x2c7a('0x10')](_0x49fbc3));if(_0x49fbc3[_0x2c7a('0x11')]){if(_0x49fbc3[_0x2c7a('0x11')][_0x2c7a('0x12')]===0x1f4){logger['error'](_0x2c7a('0xe'),_0x63a461,_0x49fbc3[_0x2c7a('0x11')][_0x2c7a('0x13')]);return _0x5b2bbd(_0x49fbc3['error'][_0x2c7a('0x13')]);}logger[_0x2c7a('0x11')](_0x2c7a('0xe'),_0x63a461,_0x49fbc3[_0x2c7a('0x11')][_0x2c7a('0x13')]);return _0x39e019(_0x49fbc3['error'][_0x2c7a('0x13')]);}else{logger[_0x2c7a('0xd')](_0x2c7a('0xe'),_0x63a461,_0x2c7a('0xf'));_0x39e019(_0x49fbc3[_0x2c7a('0x14')][_0x2c7a('0x13')]);}})[_0x2c7a('0x15')](function(_0x3dcef8){logger[_0x2c7a('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x63a461,_0x3dcef8);_0x5b2bbd(_0x3dcef8);});});} \ No newline at end of file +var _0x927e=['message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x3e6ea0,_0x44a38a){var _0x1c485a=function(_0x39cf23){while(--_0x39cf23){_0x3e6ea0['push'](_0x3e6ea0['shift']());}};_0x1c485a(++_0x44a38a);}(_0x927e,0x64));var _0xe927=function(_0xfd5f37,_0x24a79c){_0xfd5f37=_0xfd5f37-0x0;var _0x11bd01=_0x927e[_0xfd5f37];return _0x11bd01;};'use strict';var _=require(_0xe927('0x0'));var util=require(_0xe927('0x1'));var moment=require(_0xe927('0x2'));var BPromise=require(_0xe927('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe927('0x4'));var db=require(_0xe927('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe927('0x6'))(_0xe927('0x7'));var config=require(_0xe927('0x8'));var jayson=require(_0xe927('0x9'));var client=jayson['client'][_0xe927('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x433c81,_0x204eb5,_0xf091e5){return new BPromise(function(_0x7749a6,_0x2d75fa){return client[_0xe927('0xb')](_0x433c81,_0xf091e5)[_0xe927('0xc')](function(_0x42aa7a){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x204eb5,'request\x20sent');logger[_0xe927('0xd')](_0xe927('0xe'),_0x204eb5,_0xe927('0xf'),JSON[_0xe927('0x10')](_0x42aa7a));if(_0x42aa7a['error']){if(_0x42aa7a[_0xe927('0x11')][_0xe927('0x12')]===0x1f4){logger[_0xe927('0x11')](_0xe927('0x13'),_0x204eb5,_0x42aa7a['error'][_0xe927('0x14')]);return _0x2d75fa(_0x42aa7a[_0xe927('0x11')]['message']);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x204eb5,_0x42aa7a[_0xe927('0x11')][_0xe927('0x14')]);return _0x7749a6(_0x42aa7a[_0xe927('0x11')][_0xe927('0x14')]);}else{logger[_0xe927('0x15')](_0xe927('0x13'),_0x204eb5,_0xe927('0xf'));_0x7749a6(_0x42aa7a[_0xe927('0x16')][_0xe927('0x14')]);}})[_0xe927('0x17')](function(_0x395cff){logger[_0xe927('0x11')](_0xe927('0x13'),_0x204eb5,_0x395cff);_0x2d75fa(_0x395cff);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 65f8bce..247be48 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 _0xf1a8=['index','/:id','post','create','put','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x3a54c1,_0x1b19a7){var _0x532e71=function(_0x232423){while(--_0x232423){_0x3a54c1['push'](_0x3a54c1['shift']());}};_0x532e71(++_0x1b19a7);}(_0xf1a8,0x181));var _0x8f1a=function(_0x4a5d14,_0x1c8043){_0x4a5d14=_0x4a5d14-0x0;var _0x9e05e7=_0xf1a8[_0x4a5d14];return _0x9e05e7;};'use strict';var multer=require(_0x8f1a('0x0'));var util=require(_0x8f1a('0x1'));var path=require(_0x8f1a('0x2'));var timeout=require(_0x8f1a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8f1a('0x4'));var auth=require(_0x8f1a('0x5'));var interaction=require(_0x8f1a('0x6'));var config=require(_0x8f1a('0x7'));var controller=require(_0x8f1a('0x8'));router[_0x8f1a('0x9')]('/',auth[_0x8f1a('0xa')](),controller[_0x8f1a('0xb')]);router[_0x8f1a('0x9')](_0x8f1a('0xc'),auth[_0x8f1a('0xa')](),controller['show']);router[_0x8f1a('0xd')]('/',auth['isAuthenticated'](),controller[_0x8f1a('0xe')]);router[_0x8f1a('0xf')](_0x8f1a('0xc'),auth[_0x8f1a('0xa')](),controller['update']);router['delete'](_0x8f1a('0xc'),auth['isAuthenticated'](),controller[_0x8f1a('0x10')]);module[_0x8f1a('0x11')]=router; \ No newline at end of file +var _0xbbb5=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','create','put','update','exports','util'];(function(_0x34c242,_0x3a88f2){var _0x1efcae=function(_0x5dce7b){while(--_0x5dce7b){_0x34c242['push'](_0x34c242['shift']());}};_0x1efcae(++_0x3a88f2);}(_0xbbb5,0x10d));var _0x5bbb=function(_0x3e3904,_0x1d4282){_0x3e3904=_0x3e3904-0x0;var _0x55d8e6=_0xbbb5[_0x3e3904];return _0x55d8e6;};'use strict';var multer=require('multer');var util=require(_0x5bbb('0x0'));var path=require(_0x5bbb('0x1'));var timeout=require(_0x5bbb('0x2'));var express=require(_0x5bbb('0x3'));var router=express[_0x5bbb('0x4')]();var fs_extra=require(_0x5bbb('0x5'));var auth=require(_0x5bbb('0x6'));var interaction=require(_0x5bbb('0x7'));var config=require(_0x5bbb('0x8'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0x5bbb('0x9')](),controller[_0x5bbb('0xa')]);router[_0x5bbb('0xb')](_0x5bbb('0xc'),auth['isAuthenticated'](),controller[_0x5bbb('0xd')]);router['post']('/',auth[_0x5bbb('0x9')](),controller[_0x5bbb('0xe')]);router[_0x5bbb('0xf')](_0x5bbb('0xc'),auth[_0x5bbb('0x9')](),controller[_0x5bbb('0x10')]);router['delete'](_0x5bbb('0xc'),auth[_0x5bbb('0x9')](),controller['destroy']);module[_0x5bbb('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index ebed05c..63d464d 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 _0x9cf2=['STRING','sequelize','exports','ENUM','variable','keyValue','picklist','string'];(function(_0x388f8b,_0x1435d3){var _0x1a1fc7=function(_0x1f2c31){while(--_0x1f2c31){_0x388f8b['push'](_0x388f8b['shift']());}};_0x1a1fc7(++_0x1435d3);}(_0x9cf2,0x169));var _0x29cf=function(_0x363370,_0x219c1e){_0x363370=_0x363370-0x0;var _0x30ec47=_0x9cf2[_0x363370];return _0x30ec47;};'use strict';var Sequelize=require(_0x29cf('0x0'));module[_0x29cf('0x1')]={'type':{'type':Sequelize[_0x29cf('0x2')]('string',_0x29cf('0x3'),'customVariable',_0x29cf('0x4'),_0x29cf('0x5')),'defaultValue':_0x29cf('0x6')},'content':{'type':Sequelize[_0x29cf('0x7')]},'key':{'type':Sequelize[_0x29cf('0x7')]},'keyType':{'type':Sequelize[_0x29cf('0x2')](_0x29cf('0x6'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x29cf('0x7')]},'idField':{'type':Sequelize[_0x29cf('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x29cf('0x7')]}}; \ No newline at end of file +var _0xe7b5=['BOOLEAN','sequelize','exports','string','variable','keyValue','picklist','STRING','ENUM','customVariable'];(function(_0x52aafd,_0x54fc93){var _0x1e6b80=function(_0x262ca1){while(--_0x262ca1){_0x52aafd['push'](_0x52aafd['shift']());}};_0x1e6b80(++_0x54fc93);}(_0xe7b5,0x1a5));var _0x5e7b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe7b5[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x5e7b('0x0'));module[_0x5e7b('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5e7b('0x2'),_0x5e7b('0x3'),'customVariable',_0x5e7b('0x4'),_0x5e7b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5e7b('0x6')]},'key':{'type':Sequelize[_0x5e7b('0x6')]},'keyType':{'type':Sequelize[_0x5e7b('0x7')](_0x5e7b('0x2'),_0x5e7b('0x3'),_0x5e7b('0x8'))},'keyContent':{'type':Sequelize[_0x5e7b('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5e7b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5e7b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 9eab689..5cf8a1b 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 _0x422f=['update','destroy','then','error','stack','name','map','FreshdeskField','fieldName','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','type','VIRTUAL','findAll','rows','show','params','rawAttributes','length','includeAll','include','merge','options','find','body','catch','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x422f,0x1c7));var _0xf422=function(_0xb012e3,_0x33b165){_0xb012e3=_0xb012e3-0x0;var _0x195c7e=_0x422f[_0xb012e3];return _0x195c7e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf422('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf422('0x1'));var rp=require(_0xf422('0x2'));var moment=require('moment');var BPromise=require(_0xf422('0x3'));var Mustache=require(_0xf422('0x4'));var util=require(_0xf422('0x5'));var path=require(_0xf422('0x6'));var sox=require(_0xf422('0x7'));var csv=require(_0xf422('0x8'));var ejs=require(_0xf422('0x9'));var fs=require('fs');var fs_extra=require(_0xf422('0xa'));var _=require(_0xf422('0xb'));var squel=require('squel');var crypto=require(_0xf422('0xc'));var jsforce=require(_0xf422('0xd'));var deskjs=require(_0xf422('0xe'));var toCsv=require(_0xf422('0x8'));var querystring=require(_0xf422('0xf'));var Papa=require('papaparse');var Redis=require(_0xf422('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf422('0x11'));var hardwareService=require(_0xf422('0x12'));var logger=require(_0xf422('0x13'))(_0xf422('0x14'));var utils=require(_0xf422('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf422('0x16'));var db=require(_0xf422('0x17'))['db'];function respondWithStatusCode(_0x4d56d1,_0x133a6a){_0x133a6a=_0x133a6a||0xcc;return function(_0x8aa9cc){if(_0x8aa9cc){return _0x4d56d1[_0xf422('0x18')](_0x133a6a);}return _0x4d56d1[_0xf422('0x19')](_0x133a6a)[_0xf422('0x1a')]();};}function respondWithResult(_0x28a6a8,_0x223b21){_0x223b21=_0x223b21||0xc8;return function(_0x272430){if(_0x272430){return _0x28a6a8[_0xf422('0x19')](_0x223b21)['json'](_0x272430);}};}function respondWithFilteredResult(_0x54bb9c,_0x52f96b){return function(_0x1c81e1){if(_0x1c81e1){var _0x30b70a=typeof _0x52f96b[_0xf422('0x1b')]===_0xf422('0x1c')&&typeof _0x52f96b['limit']===_0xf422('0x1c');var _0x264964=_0x1c81e1[_0xf422('0x1d')];var _0x2ae133=_0x30b70a?0x0:_0x52f96b[_0xf422('0x1b')];var _0x29b0b1=_0x30b70a?_0x1c81e1['count']:_0x52f96b['offset']+_0x52f96b[_0xf422('0x1e')];var _0x4b657;if(_0x29b0b1>=_0x264964){_0x29b0b1=_0x264964;_0x4b657=0xc8;}else{_0x4b657=0xce;}_0x54bb9c[_0xf422('0x19')](_0x4b657);return _0x54bb9c['set'](_0xf422('0x1f'),_0x2ae133+'-'+_0x29b0b1+'/'+_0x264964)['json'](_0x1c81e1);}return null;};}function patchUpdates(_0x22afe7){return function(_0x15833b){try{jsonpatch[_0xf422('0x20')](_0x15833b,_0x22afe7,!![]);}catch(_0x4d6717){return BPromise[_0xf422('0x21')](_0x4d6717);}return _0x15833b[_0xf422('0x22')]();};}function saveUpdates(_0x511529,_0x4b80a0){return function(_0x268575){if(_0x268575){return _0x268575[_0xf422('0x23')](_0x511529)['then'](function(_0x25b6a5){return _0x25b6a5;});}return null;};}function removeEntity(_0x570ea2,_0x3b21a5){return function(_0x32ceee){if(_0x32ceee){return _0x32ceee[_0xf422('0x24')]()[_0xf422('0x25')](function(){_0x570ea2[_0xf422('0x19')](0xcc)[_0xf422('0x1a')]();});}};}function handleEntityNotFound(_0xd8d70f,_0x11d10b){return function(_0x5dcab4){if(!_0x5dcab4){_0xd8d70f[_0xf422('0x18')](0x194);}return _0x5dcab4;};}function handleError(_0x59d03d,_0x2f0f9f){_0x2f0f9f=_0x2f0f9f||0x1f4;return function(_0x7d36e7){logger[_0xf422('0x26')](_0x7d36e7[_0xf422('0x27')]);if(_0x7d36e7[_0xf422('0x28')]){delete _0x7d36e7[_0xf422('0x28')];}_0x59d03d[_0xf422('0x19')](_0x2f0f9f)['send'](_0x7d36e7);};}exports['index']=function(_0x35d1fa,_0x10d51b){var _0x266fb8={},_0x33ef63={},_0xefb99e={'count':0x0,'rows':[]};var _0x48e0c7=_[_0xf422('0x29')](db[_0xf422('0x2a')]['rawAttributes'],function(_0x5f0186){return{'name':_0x5f0186[_0xf422('0x2b')],'type':_0x5f0186['type']['key']};});_0x33ef63[_0xf422('0x2c')]=_[_0xf422('0x29')](_0x48e0c7,'name');_0x33ef63[_0xf422('0x2d')]=_[_0xf422('0x2e')](_0x35d1fa[_0xf422('0x2d')]);_0x33ef63[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x33ef63['model'],_0x33ef63[_0xf422('0x2d')]);_0x266fb8['attributes']=_[_0xf422('0x30')](_0x33ef63[_0xf422('0x2c')],qs[_0xf422('0x31')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x31')]));_0x266fb8[_0xf422('0x32')]=_0x266fb8[_0xf422('0x32')]['length']?_0x266fb8['attributes']:_0x33ef63[_0xf422('0x2c')];if(!_0x35d1fa[_0xf422('0x2d')]['hasOwnProperty'](_0xf422('0x33'))){_0x266fb8[_0xf422('0x1e')]=qs[_0xf422('0x1e')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x1e')]);_0x266fb8[_0xf422('0x1b')]=qs[_0xf422('0x1b')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x1b')]);}_0x266fb8[_0xf422('0x34')]=qs[_0xf422('0x35')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x35')]);_0x266fb8[_0xf422('0x36')]=qs['filters'](_['pick'](_0x35d1fa['query'],_0x33ef63[_0xf422('0x2f')]),_0x48e0c7);if(_0x35d1fa[_0xf422('0x2d')]['filter']){_0x266fb8[_0xf422('0x36')]=_['merge'](_0x266fb8[_0xf422('0x36')],{'$or':_[_0xf422('0x29')](_0x48e0c7,function(_0x55ac68){if(_0x55ac68[_0xf422('0x37')]!==_0xf422('0x38')){var _0x174f6f={};_0x174f6f[_0x55ac68['name']]={'$like':'%'+_0x35d1fa[_0xf422('0x2d')]['filter']+'%'};return _0x174f6f;}})});}_0x266fb8=_['merge']({},_0x266fb8,_0x35d1fa['options']);var _0x112bce={'where':_0x266fb8[_0xf422('0x36')]};return db[_0xf422('0x2a')][_0xf422('0x1d')](_0x112bce)[_0xf422('0x25')](function(_0x2f82a0){_0xefb99e[_0xf422('0x1d')]=_0x2f82a0;if(_0x35d1fa[_0xf422('0x2d')]['includeAll']){_0x266fb8['include']=[{'all':!![]}];}return db[_0xf422('0x2a')][_0xf422('0x39')](_0x266fb8);})[_0xf422('0x25')](function(_0xb3955){_0xefb99e[_0xf422('0x3a')]=_0xb3955;return _0xefb99e;})[_0xf422('0x25')](respondWithFilteredResult(_0x10d51b,_0x266fb8))['catch'](handleError(_0x10d51b,null));};exports[_0xf422('0x3b')]=function(_0x4f453a,_0x17c1f2){var _0x391e3c={'raw':!![],'where':{'id':_0x4f453a[_0xf422('0x3c')]['id']}},_0x564041={};_0x564041[_0xf422('0x2c')]=_[_0xf422('0x2e')](db[_0xf422('0x2a')][_0xf422('0x3d')]);_0x564041['query']=_[_0xf422('0x2e')](_0x4f453a[_0xf422('0x2d')]);_0x564041[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x564041[_0xf422('0x2c')],_0x564041['query']);_0x391e3c[_0xf422('0x32')]=_[_0xf422('0x30')](_0x564041['model'],qs[_0xf422('0x31')](_0x4f453a['query'][_0xf422('0x31')]));_0x391e3c[_0xf422('0x32')]=_0x391e3c[_0xf422('0x32')][_0xf422('0x3e')]?_0x391e3c[_0xf422('0x32')]:_0x564041[_0xf422('0x2c')];if(_0x4f453a[_0xf422('0x2d')][_0xf422('0x3f')]){_0x391e3c[_0xf422('0x40')]=[{'all':!![]}];}_0x391e3c=_[_0xf422('0x41')]({},_0x391e3c,_0x4f453a[_0xf422('0x42')]);return db[_0xf422('0x2a')][_0xf422('0x43')](_0x391e3c)[_0xf422('0x25')](handleEntityNotFound(_0x17c1f2,null))[_0xf422('0x25')](respondWithResult(_0x17c1f2,null))['catch'](handleError(_0x17c1f2,null));};exports['create']=function(_0x3c59dd,_0x2c2ce9){return db[_0xf422('0x2a')]['create'](_0x3c59dd[_0xf422('0x44')],{})[_0xf422('0x25')](respondWithResult(_0x2c2ce9,0xc9))[_0xf422('0x45')](handleError(_0x2c2ce9,null));};exports[_0xf422('0x23')]=function(_0x1f3a30,_0x259e24){if(_0x1f3a30[_0xf422('0x44')]['id']){delete _0x1f3a30['body']['id'];}return db[_0xf422('0x2a')]['find']({'where':{'id':_0x1f3a30[_0xf422('0x3c')]['id']}})[_0xf422('0x25')](handleEntityNotFound(_0x259e24,null))['then'](saveUpdates(_0x1f3a30[_0xf422('0x44')],null))[_0xf422('0x25')](respondWithResult(_0x259e24,null))[_0xf422('0x45')](handleError(_0x259e24,null));};exports[_0xf422('0x24')]=function(_0x2df71a,_0x5c3cb8){return db['FreshdeskField'][_0xf422('0x43')]({'where':{'id':_0x2df71a['params']['id']}})[_0xf422('0x25')](handleEntityNotFound(_0x5c3cb8,null))[_0xf422('0x25')](removeEntity(_0x5c3cb8,null))[_0xf422('0x45')](handleError(_0x5c3cb8,null));}; \ No newline at end of file +var _0x1b73=['include','options','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/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','error','stack','name','map','FreshdeskField','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','findAll','rows','show','params','includeAll'];(function(_0x57096d,_0x15799e){var _0x7c7c44=function(_0x49a40b){while(--_0x49a40b){_0x57096d['push'](_0x57096d['shift']());}};_0x7c7c44(++_0x15799e);}(_0x1b73,0x1d5));var _0x31b7=function(_0x2fe943,_0x390c57){_0x2fe943=_0x2fe943-0x0;var _0x2dc877=_0x1b73[_0x2fe943];return _0x2dc877;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x31b7('0x0'));var zipdir=require(_0x31b7('0x1'));var jsonpatch=require(_0x31b7('0x2'));var rp=require(_0x31b7('0x3'));var moment=require('moment');var BPromise=require(_0x31b7('0x4'));var Mustache=require('mustache');var util=require(_0x31b7('0x5'));var path=require(_0x31b7('0x6'));var sox=require('sox');var csv=require(_0x31b7('0x7'));var ejs=require(_0x31b7('0x8'));var fs=require('fs');var fs_extra=require(_0x31b7('0x9'));var _=require('lodash');var squel=require(_0x31b7('0xa'));var crypto=require(_0x31b7('0xb'));var jsforce=require(_0x31b7('0xc'));var deskjs=require(_0x31b7('0xd'));var toCsv=require(_0x31b7('0x7'));var querystring=require(_0x31b7('0xe'));var Papa=require(_0x31b7('0xf'));var Redis=require('ioredis');var authService=require(_0x31b7('0x10'));var qs=require(_0x31b7('0x11'));var as=require(_0x31b7('0x12'));var hardwareService=require(_0x31b7('0x13'));var logger=require(_0x31b7('0x14'))(_0x31b7('0x15'));var utils=require(_0x31b7('0x16'));var config=require(_0x31b7('0x17'));var licenseUtil=require(_0x31b7('0x18'));var db=require(_0x31b7('0x19'))['db'];function respondWithStatusCode(_0x492612,_0x32afeb){_0x32afeb=_0x32afeb||0xcc;return function(_0x55e1bb){if(_0x55e1bb){return _0x492612[_0x31b7('0x1a')](_0x32afeb);}return _0x492612[_0x31b7('0x1b')](_0x32afeb)[_0x31b7('0x1c')]();};}function respondWithResult(_0x1969d2,_0x7988e2){_0x7988e2=_0x7988e2||0xc8;return function(_0x34e917){if(_0x34e917){return _0x1969d2[_0x31b7('0x1b')](_0x7988e2)['json'](_0x34e917);}};}function respondWithFilteredResult(_0x1e93fb,_0x491c98){return function(_0x210f18){if(_0x210f18){var _0xf213c9=typeof _0x491c98['offset']===_0x31b7('0x1d')&&typeof _0x491c98[_0x31b7('0x1e')]===_0x31b7('0x1d');var _0x39eee9=_0x210f18[_0x31b7('0x1f')];var _0x5f3245=_0xf213c9?0x0:_0x491c98[_0x31b7('0x20')];var _0x437eba=_0xf213c9?_0x210f18[_0x31b7('0x1f')]:_0x491c98[_0x31b7('0x20')]+_0x491c98[_0x31b7('0x1e')];var _0x4b8ab1;if(_0x437eba>=_0x39eee9){_0x437eba=_0x39eee9;_0x4b8ab1=0xc8;}else{_0x4b8ab1=0xce;}_0x1e93fb[_0x31b7('0x1b')](_0x4b8ab1);return _0x1e93fb[_0x31b7('0x21')](_0x31b7('0x22'),_0x5f3245+'-'+_0x437eba+'/'+_0x39eee9)[_0x31b7('0x23')](_0x210f18);}return null;};}function patchUpdates(_0x5b56bc){return function(_0x892fe4){try{jsonpatch[_0x31b7('0x24')](_0x892fe4,_0x5b56bc,!![]);}catch(_0x424318){return BPromise[_0x31b7('0x25')](_0x424318);}return _0x892fe4['save']();};}function saveUpdates(_0x33dd04,_0x20cb03){return function(_0x250574){if(_0x250574){return _0x250574[_0x31b7('0x26')](_0x33dd04)[_0x31b7('0x27')](function(_0x2d24bf){return _0x2d24bf;});}return null;};}function removeEntity(_0x36492c,_0x20e5b0){return function(_0x3b0eff){if(_0x3b0eff){return _0x3b0eff['destroy']()[_0x31b7('0x27')](function(){_0x36492c[_0x31b7('0x1b')](0xcc)[_0x31b7('0x1c')]();});}};}function handleEntityNotFound(_0x2c993b,_0x4e5673){return function(_0xb8a998){if(!_0xb8a998){_0x2c993b['sendStatus'](0x194);}return _0xb8a998;};}function handleError(_0x3dd60d,_0x2da751){_0x2da751=_0x2da751||0x1f4;return function(_0x14b63f){logger[_0x31b7('0x28')](_0x14b63f[_0x31b7('0x29')]);if(_0x14b63f[_0x31b7('0x2a')]){delete _0x14b63f[_0x31b7('0x2a')];}_0x3dd60d[_0x31b7('0x1b')](_0x2da751)['send'](_0x14b63f);};}exports['index']=function(_0x503549,_0x46508a){var _0x39521d={},_0x2a7c54={},_0x4f5e1d={'count':0x0,'rows':[]};var _0x169238=_[_0x31b7('0x2b')](db[_0x31b7('0x2c')][_0x31b7('0x2d')],function(_0x58a87e){return{'name':_0x58a87e[_0x31b7('0x2e')],'type':_0x58a87e[_0x31b7('0x2f')]['key']};});_0x2a7c54['model']=_[_0x31b7('0x2b')](_0x169238,_0x31b7('0x2a'));_0x2a7c54[_0x31b7('0x30')]=_[_0x31b7('0x31')](_0x503549['query']);_0x2a7c54['filters']=_[_0x31b7('0x32')](_0x2a7c54[_0x31b7('0x33')],_0x2a7c54[_0x31b7('0x30')]);_0x39521d[_0x31b7('0x34')]=_[_0x31b7('0x32')](_0x2a7c54['model'],qs['fields'](_0x503549[_0x31b7('0x30')][_0x31b7('0x35')]));_0x39521d['attributes']=_0x39521d[_0x31b7('0x34')][_0x31b7('0x36')]?_0x39521d['attributes']:_0x2a7c54[_0x31b7('0x33')];if(!_0x503549[_0x31b7('0x30')][_0x31b7('0x37')](_0x31b7('0x38'))){_0x39521d[_0x31b7('0x1e')]=qs[_0x31b7('0x1e')](_0x503549[_0x31b7('0x30')][_0x31b7('0x1e')]);_0x39521d[_0x31b7('0x20')]=qs[_0x31b7('0x20')](_0x503549[_0x31b7('0x30')][_0x31b7('0x20')]);}_0x39521d[_0x31b7('0x39')]=qs['sort'](_0x503549['query'][_0x31b7('0x3a')]);_0x39521d[_0x31b7('0x3b')]=qs[_0x31b7('0x3c')](_[_0x31b7('0x3d')](_0x503549[_0x31b7('0x30')],_0x2a7c54[_0x31b7('0x3c')]),_0x169238);if(_0x503549[_0x31b7('0x30')][_0x31b7('0x3e')]){_0x39521d[_0x31b7('0x3b')]=_[_0x31b7('0x3f')](_0x39521d['where'],{'$or':_[_0x31b7('0x2b')](_0x169238,function(_0xfd4863){if(_0xfd4863[_0x31b7('0x2f')]!==_0x31b7('0x40')){var _0x5c9cec={};_0x5c9cec[_0xfd4863[_0x31b7('0x2a')]]={'$like':'%'+_0x503549[_0x31b7('0x30')]['filter']+'%'};return _0x5c9cec;}})});}_0x39521d=_[_0x31b7('0x3f')]({},_0x39521d,_0x503549['options']);var _0x587506={'where':_0x39521d[_0x31b7('0x3b')]};return db[_0x31b7('0x2c')][_0x31b7('0x1f')](_0x587506)[_0x31b7('0x27')](function(_0x3d0413){_0x4f5e1d['count']=_0x3d0413;if(_0x503549[_0x31b7('0x30')]['includeAll']){_0x39521d['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x31b7('0x41')](_0x39521d);})[_0x31b7('0x27')](function(_0x1527b3){_0x4f5e1d[_0x31b7('0x42')]=_0x1527b3;return _0x4f5e1d;})[_0x31b7('0x27')](respondWithFilteredResult(_0x46508a,_0x39521d))['catch'](handleError(_0x46508a,null));};exports[_0x31b7('0x43')]=function(_0x5d1f25,_0xef2b18){var _0x3caab0={'raw':!![],'where':{'id':_0x5d1f25[_0x31b7('0x44')]['id']}},_0x41c92e={};_0x41c92e['model']=_[_0x31b7('0x31')](db[_0x31b7('0x2c')][_0x31b7('0x2d')]);_0x41c92e['query']=_[_0x31b7('0x31')](_0x5d1f25['query']);_0x41c92e[_0x31b7('0x3c')]=_[_0x31b7('0x32')](_0x41c92e['model'],_0x41c92e[_0x31b7('0x30')]);_0x3caab0[_0x31b7('0x34')]=_[_0x31b7('0x32')](_0x41c92e[_0x31b7('0x33')],qs['fields'](_0x5d1f25[_0x31b7('0x30')]['fields']));_0x3caab0['attributes']=_0x3caab0[_0x31b7('0x34')][_0x31b7('0x36')]?_0x3caab0[_0x31b7('0x34')]:_0x41c92e[_0x31b7('0x33')];if(_0x5d1f25['query'][_0x31b7('0x45')]){_0x3caab0[_0x31b7('0x46')]=[{'all':!![]}];}_0x3caab0=_['merge']({},_0x3caab0,_0x5d1f25[_0x31b7('0x47')]);return db[_0x31b7('0x2c')][_0x31b7('0x48')](_0x3caab0)['then'](handleEntityNotFound(_0xef2b18,null))[_0x31b7('0x27')](respondWithResult(_0xef2b18,null))[_0x31b7('0x49')](handleError(_0xef2b18,null));};exports[_0x31b7('0x4a')]=function(_0x164115,_0x345059){return db[_0x31b7('0x2c')][_0x31b7('0x4a')](_0x164115[_0x31b7('0x4b')],{})['then'](respondWithResult(_0x345059,0xc9))[_0x31b7('0x49')](handleError(_0x345059,null));};exports['update']=function(_0x5a72ee,_0x22cc77){if(_0x5a72ee[_0x31b7('0x4b')]['id']){delete _0x5a72ee[_0x31b7('0x4b')]['id'];}return db[_0x31b7('0x2c')]['find']({'where':{'id':_0x5a72ee[_0x31b7('0x44')]['id']}})[_0x31b7('0x27')](handleEntityNotFound(_0x22cc77,null))[_0x31b7('0x27')](saveUpdates(_0x5a72ee['body'],null))[_0x31b7('0x27')](respondWithResult(_0x22cc77,null))[_0x31b7('0x49')](handleError(_0x22cc77,null));};exports[_0x31b7('0x4c')]=function(_0x3b5868,_0x2bf59c){return db[_0x31b7('0x2c')][_0x31b7('0x48')]({'where':{'id':_0x3b5868[_0x31b7('0x44')]['id']}})['then'](handleEntityNotFound(_0x2bf59c,null))['then'](removeEntity(_0x2bf59c,null))[_0x31b7('0x49')](handleError(_0x2bf59c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index c3f60f3..f29000e 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 _0xdeee=['path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc7fdff,_0x109fc1){var _0x178754=function(_0x37fb70){while(--_0x37fb70){_0xc7fdff['push'](_0xc7fdff['shift']());}};_0x178754(++_0x109fc1);}(_0xdeee,0x10a));var _0xedee=function(_0x121d4c,_0x52c595){_0x121d4c=_0x121d4c-0x0;var _0x16b686=_0xdeee[_0x121d4c];return _0x16b686;};'use strict';var _=require('lodash');var util=require(_0xedee('0x0'));var logger=require(_0xedee('0x1'))(_0xedee('0x2'));var moment=require(_0xedee('0x3'));var BPromise=require(_0xedee('0x4'));var rp=require(_0xedee('0x5'));var fs=require('fs');var path=require(_0xedee('0x6'));var rimraf=require(_0xedee('0x7'));var config=require(_0xedee('0x8'));var attributes=require(_0xedee('0x9'));module[_0xedee('0xa')]=function(_0x16ee4b,_0x86834a){return _0x16ee4b[_0xedee('0xb')](_0xedee('0xc'),attributes,{'tableName':_0xedee('0xd'),'paranoid':![],'indexes':[{'name':_0xedee('0xe'),'fields':['idField',_0xedee('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb0fc=['util','api','moment','bluebird','path','rimraf','../../config/environment','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0x47bdca,_0x2a9acc){var _0x2dc5a4=function(_0x5ad6b4){while(--_0x5ad6b4){_0x47bdca['push'](_0x47bdca['shift']());}};_0x2dc5a4(++_0x2a9acc);}(_0xb0fc,0xf6));var _0xcb0f=function(_0xe56fcb,_0x42f237){_0xe56fcb=_0xe56fcb-0x0;var _0x6037c7=_0xb0fc[_0xe56fcb];return _0x6037c7;};'use strict';var _=require(_0xcb0f('0x0'));var util=require(_0xcb0f('0x1'));var logger=require('../../config/logger')(_0xcb0f('0x2'));var moment=require(_0xcb0f('0x3'));var BPromise=require(_0xcb0f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb0f('0x5'));var rimraf=require(_0xcb0f('0x6'));var config=require(_0xcb0f('0x7'));var attributes=require('./intFreshdeskField.attributes');module['exports']=function(_0x22d67f,_0x6a9923){return _0x22d67f['define'](_0xcb0f('0x8'),attributes,{'tableName':_0xcb0f('0x9'),'paranoid':![],'indexes':[{'name':_0xcb0f('0xa'),'fields':[_0xcb0f('0xb'),_0xcb0f('0xc')],'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 5d10e3f..606a92e 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 _0xad21=['FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xad21,0x84));var _0x1ad2=function(_0x10a212,_0x579d85){_0x10a212=_0x10a212-0x0;var _0x23c82b=_0xad21[_0x10a212];return _0x23c82b;};'use strict';var _=require('lodash');var util=require(_0x1ad2('0x0'));var moment=require(_0x1ad2('0x1'));var BPromise=require('bluebird');var rs=require(_0x1ad2('0x2'));var fs=require('fs');var Redis=require(_0x1ad2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1ad2('0x4'));var logger=require(_0x1ad2('0x5'))(_0x1ad2('0x6'));var config=require('../../config/environment');var jayson=require(_0x1ad2('0x7'));var client=jayson[_0x1ad2('0x8')][_0x1ad2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2572c1,_0x1b6fad,_0x453432){return new BPromise(function(_0x34a9ac,_0x208d0a){return client['request'](_0x2572c1,_0x453432)[_0x1ad2('0xa')](function(_0xfec730){logger[_0x1ad2('0xb')](_0x1ad2('0xc'),_0x1b6fad,_0x1ad2('0xd'));logger[_0x1ad2('0xe')](_0x1ad2('0xf'),_0x1b6fad,_0x1ad2('0xd'),JSON['stringify'](_0xfec730));if(_0xfec730[_0x1ad2('0x10')]){if(_0xfec730[_0x1ad2('0x10')][_0x1ad2('0x11')]===0x1f4){logger[_0x1ad2('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x1b6fad,_0xfec730[_0x1ad2('0x10')][_0x1ad2('0x12')]);return _0x208d0a(_0xfec730[_0x1ad2('0x10')]['message']);}logger[_0x1ad2('0x10')](_0x1ad2('0xc'),_0x1b6fad,_0xfec730[_0x1ad2('0x10')]['message']);return _0x34a9ac(_0xfec730[_0x1ad2('0x10')][_0x1ad2('0x12')]);}else{logger[_0x1ad2('0xb')]('FreshdeskField,\x20%s,\x20%s',_0x1b6fad,_0x1ad2('0xd'));_0x34a9ac(_0xfec730[_0x1ad2('0x13')][_0x1ad2('0x12')]);}})[_0x1ad2('0x14')](function(_0x4de8bd){logger[_0x1ad2('0x10')](_0x1ad2('0xc'),_0x1b6fad,_0x4de8bd);_0x208d0a(_0x4de8bd);});});} \ No newline at end of file +var _0x6096=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xfc873c,_0x278dd7){var _0x495153=function(_0x50d91a){while(--_0x50d91a){_0xfc873c['push'](_0xfc873c['shift']());}};_0x495153(++_0x278dd7);}(_0x6096,0x1a1));var _0x6609=function(_0x8181f0,_0x275175){_0x8181f0=_0x8181f0-0x0;var _0x31f51e=_0x6096[_0x8181f0];return _0x31f51e;};'use strict';var _=require(_0x6609('0x0'));var util=require(_0x6609('0x1'));var moment=require(_0x6609('0x2'));var BPromise=require(_0x6609('0x3'));var rs=require(_0x6609('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6609('0x5'))['db'];var utils=require(_0x6609('0x6'));var logger=require(_0x6609('0x7'))(_0x6609('0x8'));var config=require(_0x6609('0x9'));var jayson=require(_0x6609('0xa'));var client=jayson[_0x6609('0xb')][_0x6609('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x48b987,_0x44f916,_0x460d1a){return new BPromise(function(_0x256f09,_0x4ccd58){return client[_0x6609('0xd')](_0x48b987,_0x460d1a)[_0x6609('0xe')](function(_0x566f89){logger[_0x6609('0xf')](_0x6609('0x10'),_0x44f916,_0x6609('0x11'));logger[_0x6609('0x12')](_0x6609('0x13'),_0x44f916,_0x6609('0x11'),JSON[_0x6609('0x14')](_0x566f89));if(_0x566f89['error']){if(_0x566f89[_0x6609('0x15')][_0x6609('0x16')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x44f916,_0x566f89[_0x6609('0x15')]['message']);return _0x4ccd58(_0x566f89[_0x6609('0x15')][_0x6609('0x17')]);}logger['error'](_0x6609('0x10'),_0x44f916,_0x566f89[_0x6609('0x15')][_0x6609('0x17')]);return _0x256f09(_0x566f89[_0x6609('0x15')][_0x6609('0x17')]);}else{logger[_0x6609('0xf')](_0x6609('0x10'),_0x44f916,_0x6609('0x11'));_0x256f09(_0x566f89[_0x6609('0x18')][_0x6609('0x17')]);}})['catch'](function(_0x4c6da5){logger[_0x6609('0x15')]('FreshdeskField,\x20%s,\x20%s',_0x44f916,_0x4c6da5);_0x4ccd58(_0x4c6da5);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 4614cf4..e4b3796 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 _0x04b8=['get','index','/:id','show','isAuthenticated','getConfigurations','/:id/fields','post','create','/:id/configurations','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x04b8,0x159));var _0x804b=function(_0x28d9ef,_0x126431){_0x28d9ef=_0x28d9ef-0x0;var _0x482782=_0x04b8[_0x28d9ef];return _0x482782;};'use strict';var multer=require('multer');var util=require(_0x804b('0x0'));var path=require('path');var timeout=require(_0x804b('0x1'));var express=require(_0x804b('0x2'));var router=express['Router']();var fs_extra=require(_0x804b('0x3'));var auth=require(_0x804b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x804b('0x5'));var controller=require(_0x804b('0x6'));router[_0x804b('0x7')]('/',auth['isAuthenticated'](),controller[_0x804b('0x8')]);router[_0x804b('0x7')](_0x804b('0x9'),auth['isAuthenticated'](),controller[_0x804b('0xa')]);router[_0x804b('0x7')]('/:id/configurations',auth[_0x804b('0xb')](),controller[_0x804b('0xc')]);router[_0x804b('0x7')](_0x804b('0xd'),auth[_0x804b('0xb')](),controller['getFields']);router[_0x804b('0xe')]('/',auth[_0x804b('0xb')](),controller[_0x804b('0xf')]);router[_0x804b('0xe')](_0x804b('0x10'),auth[_0x804b('0xb')](),controller['addConfiguration']);router[_0x804b('0x11')]('/:id',auth[_0x804b('0xb')](),controller[_0x804b('0x12')]);router[_0x804b('0x13')](_0x804b('0x9'),auth['isAuthenticated'](),controller[_0x804b('0x14')]);module[_0x804b('0x15')]=router; \ No newline at end of file +var _0x9ffd=['../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getFields','post','create','addConfiguration','update','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0x2351c4,_0x1dca54){var _0x1dd3f8=function(_0x4c3fa2){while(--_0x4c3fa2){_0x2351c4['push'](_0x2351c4['shift']());}};_0x1dd3f8(++_0x1dca54);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4ccf6c,_0x4c0f23){_0x4ccf6c=_0x4ccf6c-0x0;var _0x1da907=_0x9ffd[_0x4ccf6c];return _0x1da907;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['getConfigurations']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0x10')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0x10')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x12')]);router['put']('/:id',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x14')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller['destroy']);module[_0xd9ff('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index baba003..0c57304 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 _0x8603=['remoteUri','exports','STRING'];(function(_0x6ed9b,_0x49dd9d){var _0x548761=function(_0xd533d2){while(--_0xd533d2){_0x6ed9b['push'](_0x6ed9b['shift']());}};_0x548761(++_0x49dd9d);}(_0x8603,0x190));var _0x3860=function(_0x1ef08e,_0x918ebf){_0x1ef08e=_0x1ef08e-0x0;var _0x43e915=_0x8603[_0x1ef08e];return _0x43e915;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'name':{'type':Sequelize[_0x3860('0x1')]},'description':{'type':Sequelize[_0x3860('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x3860('0x1')]},'remoteUri':{'type':Sequelize[_0x3860('0x1')],'unique':_0x3860('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x627e=['STRING','remoteUri','sequelize','exports'];(function(_0x52e2a8,_0x47fe56){var _0x102d40=function(_0x2e2db5){while(--_0x2e2db5){_0x52e2a8['push'](_0x52e2a8['shift']());}};_0x102d40(++_0x47fe56);}(_0x627e,0x14a));var _0xe627=function(_0x52a198,_0x8368eb){_0x52a198=_0x52a198-0x0;var _0x419741=_0x627e[_0x52a198];return _0x419741;};'use strict';var Sequelize=require(_0xe627('0x0'));module[_0xe627('0x1')]={'name':{'type':Sequelize[_0xe627('0x2')]},'description':{'type':Sequelize[_0xe627('0x2')]},'username':{'type':Sequelize[_0xe627('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xe627('0x2')]},'remoteUri':{'type':Sequelize[_0xe627('0x2')],'unique':_0xe627('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 4874918..da8b1e0 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 _0xa898=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','offset','count','apply','update','then','end','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','apiKey','username','remoteUri','slice','format','%s%s','/api/selector/owners','users','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x21a3df,_0x3bcd8e){var _0xaf4d38=function(_0xe103e8){while(--_0xe103e8){_0x21a3df['push'](_0x21a3df['shift']());}};_0xaf4d38(++_0x3bcd8e);}(_0xa898,0x17e));var _0x8a89=function(_0x1e5b1b,_0x1e8c99){_0x1e5b1b=_0x1e5b1b-0x0;var _0x3c0a42=_0xa898[_0x1e5b1b];return _0x3c0a42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a89('0x0'));var zipdir=require(_0x8a89('0x1'));var jsonpatch=require(_0x8a89('0x2'));var rp=require('request-promise');var moment=require(_0x8a89('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8a89('0x4'));var util=require(_0x8a89('0x5'));var path=require(_0x8a89('0x6'));var sox=require(_0x8a89('0x7'));var csv=require('to-csv');var ejs=require(_0x8a89('0x8'));var fs=require('fs');var fs_extra=require(_0x8a89('0x9'));var _=require(_0x8a89('0xa'));var squel=require(_0x8a89('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8a89('0xc'));var toCsv=require(_0x8a89('0xd'));var querystring=require(_0x8a89('0xe'));var Papa=require('papaparse');var Redis=require(_0x8a89('0xf'));var authService=require(_0x8a89('0x10'));var qs=require(_0x8a89('0x11'));var as=require(_0x8a89('0x12'));var hardwareService=require(_0x8a89('0x13'));var logger=require(_0x8a89('0x14'))('api');var utils=require(_0x8a89('0x15'));var config=require(_0x8a89('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1b18e6,_0x128d74){_0x128d74=_0x128d74||0xcc;return function(_0x4137a0){if(_0x4137a0){return _0x1b18e6[_0x8a89('0x17')](_0x128d74);}return _0x1b18e6['status'](_0x128d74)['end']();};}function respondWithResult(_0x2a08d7,_0x574b3f){_0x574b3f=_0x574b3f||0xc8;return function(_0x13742e){if(_0x13742e){return _0x2a08d7[_0x8a89('0x18')](_0x574b3f)[_0x8a89('0x19')](_0x13742e);}};}function respondWithFilteredResult(_0x6e1b79,_0x4c2d52){return function(_0x39c23e){if(_0x39c23e){var _0x1a94bd=typeof _0x4c2d52['offset']===_0x8a89('0x1a')&&typeof _0x4c2d52[_0x8a89('0x1b')]===_0x8a89('0x1a');var _0x4a2ed8=_0x39c23e['count'];var _0x286f28=_0x1a94bd?0x0:_0x4c2d52[_0x8a89('0x1c')];var _0x45421c=_0x1a94bd?_0x39c23e[_0x8a89('0x1d')]:_0x4c2d52[_0x8a89('0x1c')]+_0x4c2d52[_0x8a89('0x1b')];var _0x8a169d;if(_0x45421c>=_0x4a2ed8){_0x45421c=_0x4a2ed8;_0x8a169d=0xc8;}else{_0x8a169d=0xce;}_0x6e1b79[_0x8a89('0x18')](_0x8a169d);return _0x6e1b79['set']('Content-Range',_0x286f28+'-'+_0x45421c+'/'+_0x4a2ed8)[_0x8a89('0x19')](_0x39c23e);}return null;};}function patchUpdates(_0x1c9dfb){return function(_0x81d4a9){try{jsonpatch[_0x8a89('0x1e')](_0x81d4a9,_0x1c9dfb,!![]);}catch(_0x353da2){return BPromise['reject'](_0x353da2);}return _0x81d4a9['save']();};}function saveUpdates(_0x3092f2,_0x4aafe7){return function(_0x15ec69){if(_0x15ec69){return _0x15ec69[_0x8a89('0x1f')](_0x3092f2)[_0x8a89('0x20')](function(_0x2737d7){return _0x2737d7;});}return null;};}function removeEntity(_0xeaa57b,_0x560f34){return function(_0x25c12d){if(_0x25c12d){return _0x25c12d['destroy']()['then'](function(){_0xeaa57b[_0x8a89('0x18')](0xcc)[_0x8a89('0x21')]();});}};}function handleEntityNotFound(_0x8d820b,_0xb35241){return function(_0x49663d){if(!_0x49663d){_0x8d820b[_0x8a89('0x17')](0x194);}return _0x49663d;};}function handleError(_0x27add8,_0x41d499){_0x41d499=_0x41d499||0x1f4;return function(_0x45cbd2){logger[_0x8a89('0x22')](_0x45cbd2[_0x8a89('0x23')]);if(_0x45cbd2['name']){delete _0x45cbd2[_0x8a89('0x24')];}_0x27add8[_0x8a89('0x18')](_0x41d499)[_0x8a89('0x25')](_0x45cbd2);};}exports[_0x8a89('0x26')]=function(_0x27fd1e,_0x5bde6a){var _0x58ff02={},_0x31d025={},_0x41e7d7={'count':0x0,'rows':[]};var _0x504ee8=_[_0x8a89('0x27')](db[_0x8a89('0x28')][_0x8a89('0x29')],function(_0x56847c){return{'name':_0x56847c[_0x8a89('0x2a')],'type':_0x56847c[_0x8a89('0x2b')][_0x8a89('0x2c')]};});_0x31d025['model']=_[_0x8a89('0x27')](_0x504ee8,_0x8a89('0x24'));_0x31d025[_0x8a89('0x2d')]=_[_0x8a89('0x2e')](_0x27fd1e[_0x8a89('0x2d')]);_0x31d025[_0x8a89('0x2f')]=_[_0x8a89('0x30')](_0x31d025[_0x8a89('0x31')],_0x31d025[_0x8a89('0x2d')]);_0x58ff02['attributes']=_[_0x8a89('0x30')](_0x31d025['model'],qs[_0x8a89('0x32')](_0x27fd1e['query'][_0x8a89('0x32')]));_0x58ff02['attributes']=_0x58ff02[_0x8a89('0x33')][_0x8a89('0x34')]?_0x58ff02[_0x8a89('0x33')]:_0x31d025['model'];if(!_0x27fd1e[_0x8a89('0x2d')][_0x8a89('0x35')](_0x8a89('0x36'))){_0x58ff02['limit']=qs[_0x8a89('0x1b')](_0x27fd1e['query']['limit']);_0x58ff02[_0x8a89('0x1c')]=qs[_0x8a89('0x1c')](_0x27fd1e[_0x8a89('0x2d')]['offset']);}_0x58ff02[_0x8a89('0x37')]=qs['sort'](_0x27fd1e['query'][_0x8a89('0x38')]);_0x58ff02['where']=qs['filters'](_['pick'](_0x27fd1e[_0x8a89('0x2d')],_0x31d025[_0x8a89('0x2f')]),_0x504ee8);if(_0x27fd1e['query'][_0x8a89('0x39')]){_0x58ff02[_0x8a89('0x3a')]=_['merge'](_0x58ff02[_0x8a89('0x3a')],{'$or':_[_0x8a89('0x27')](_0x504ee8,function(_0x3c8e47){if(_0x3c8e47[_0x8a89('0x2b')]!==_0x8a89('0x3b')){var _0x4c786e={};_0x4c786e[_0x3c8e47['name']]={'$like':'%'+_0x27fd1e[_0x8a89('0x2d')][_0x8a89('0x39')]+'%'};return _0x4c786e;}})});}_0x58ff02=_[_0x8a89('0x3c')]({},_0x58ff02,_0x27fd1e[_0x8a89('0x3d')]);var _0x3261bc={'where':_0x58ff02[_0x8a89('0x3a')]};return db[_0x8a89('0x28')][_0x8a89('0x1d')](_0x3261bc)['then'](function(_0x429698){_0x41e7d7[_0x8a89('0x1d')]=_0x429698;if(_0x27fd1e[_0x8a89('0x2d')][_0x8a89('0x3e')]){_0x58ff02[_0x8a89('0x3f')]=[{'all':!![]}];}return db[_0x8a89('0x28')][_0x8a89('0x40')](_0x58ff02);})[_0x8a89('0x20')](function(_0x5c50f0){_0x41e7d7[_0x8a89('0x41')]=_0x5c50f0;return _0x41e7d7;})[_0x8a89('0x20')](respondWithFilteredResult(_0x5bde6a,_0x58ff02))[_0x8a89('0x42')](handleError(_0x5bde6a,null));};exports[_0x8a89('0x43')]=function(_0x195a4b,_0x311fe7){var _0x353e6d={'raw':![],'where':{'id':_0x195a4b[_0x8a89('0x44')]['id']}},_0x5550c0={};_0x5550c0[_0x8a89('0x31')]=_['keys'](db[_0x8a89('0x28')]['rawAttributes']);_0x5550c0[_0x8a89('0x2d')]=_[_0x8a89('0x2e')](_0x195a4b[_0x8a89('0x2d')]);_0x5550c0[_0x8a89('0x2f')]=_[_0x8a89('0x30')](_0x5550c0[_0x8a89('0x31')],_0x5550c0[_0x8a89('0x2d')]);_0x353e6d['attributes']=_[_0x8a89('0x30')](_0x5550c0[_0x8a89('0x31')],qs[_0x8a89('0x32')](_0x195a4b['query'][_0x8a89('0x32')]));_0x353e6d[_0x8a89('0x33')]=_0x353e6d[_0x8a89('0x33')][_0x8a89('0x34')]?_0x353e6d[_0x8a89('0x33')]:_0x5550c0[_0x8a89('0x31')];if(_0x195a4b['query'][_0x8a89('0x3e')]){_0x353e6d[_0x8a89('0x3f')]=[{'all':!![]}];}_0x353e6d=_[_0x8a89('0x3c')]({},_0x353e6d,_0x195a4b[_0x8a89('0x3d')]);return db[_0x8a89('0x28')][_0x8a89('0x45')](_0x353e6d)['then'](handleEntityNotFound(_0x311fe7,null))[_0x8a89('0x20')](respondWithResult(_0x311fe7,null))[_0x8a89('0x42')](handleError(_0x311fe7,null));};exports[_0x8a89('0x46')]=function(_0x58d740,_0x22b612){return db[_0x8a89('0x28')][_0x8a89('0x46')](_0x58d740[_0x8a89('0x47')],{})[_0x8a89('0x20')](respondWithResult(_0x22b612,0xc9))[_0x8a89('0x42')](handleError(_0x22b612,null));};exports['update']=function(_0x3c852d,_0x3be918){if(_0x3c852d[_0x8a89('0x47')]['id']){delete _0x3c852d[_0x8a89('0x47')]['id'];}return db[_0x8a89('0x28')]['find']({'where':{'id':_0x3c852d['params']['id']}})[_0x8a89('0x20')](handleEntityNotFound(_0x3be918,null))[_0x8a89('0x20')](saveUpdates(_0x3c852d['body'],null))[_0x8a89('0x20')](respondWithResult(_0x3be918,null))[_0x8a89('0x42')](handleError(_0x3be918,null));};exports[_0x8a89('0x48')]=function(_0x5c92a1,_0x12c9e4){return db[_0x8a89('0x28')]['find']({'where':{'id':_0x5c92a1[_0x8a89('0x44')]['id']}})[_0x8a89('0x20')](handleEntityNotFound(_0x12c9e4,null))[_0x8a89('0x20')](removeEntity(_0x12c9e4,null))['catch'](handleError(_0x12c9e4,null));};exports[_0x8a89('0x49')]=function(_0x5de811,_0x1b6790,_0x44365d){var _0xb9553f={};var _0x2dd9d9={};var _0x49dc26;var _0x4573bb;return db['FreshsalesAccount'][_0x8a89('0x4a')]({'where':{'id':_0x5de811[_0x8a89('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b6790,null))['then'](function(_0xf7ab9a){if(_0xf7ab9a){_0x49dc26=_0xf7ab9a;_0x2dd9d9['model']=_[_0x8a89('0x2e')](db[_0x8a89('0x4b')][_0x8a89('0x29')]);_0x2dd9d9[_0x8a89('0x2d')]=_['keys'](_0x5de811[_0x8a89('0x2d')]);_0x2dd9d9[_0x8a89('0x2f')]=_[_0x8a89('0x30')](_0x2dd9d9[_0x8a89('0x31')],_0x2dd9d9[_0x8a89('0x2d')]);_0xb9553f[_0x8a89('0x33')]=_[_0x8a89('0x30')](_0x2dd9d9[_0x8a89('0x31')],qs[_0x8a89('0x32')](_0x5de811[_0x8a89('0x2d')]['fields']));_0xb9553f[_0x8a89('0x33')]=_0xb9553f[_0x8a89('0x33')][_0x8a89('0x34')]?_0xb9553f[_0x8a89('0x33')]:_0x2dd9d9[_0x8a89('0x31')];_0xb9553f[_0x8a89('0x37')]=qs[_0x8a89('0x38')](_0x5de811[_0x8a89('0x2d')][_0x8a89('0x38')]);_0xb9553f['where']=qs['filters'](_[_0x8a89('0x4c')](_0x5de811['query'],_0x2dd9d9[_0x8a89('0x2f')]));if(_0x5de811[_0x8a89('0x2d')][_0x8a89('0x39')]){_0xb9553f[_0x8a89('0x3a')]=_[_0x8a89('0x3c')](_0xb9553f[_0x8a89('0x3a')],{'$or':_[_0x8a89('0x27')](_0xb9553f[_0x8a89('0x33')],function(_0x5ae93c){var _0x69b0d5={};_0x69b0d5[_0x5ae93c]={'$like':'%'+_0x5de811[_0x8a89('0x2d')][_0x8a89('0x39')]+'%'};return _0x69b0d5;})});}_0xb9553f=_['merge']({},_0xb9553f,_0x5de811[_0x8a89('0x3d')]);return _0x49dc26['getConfigurations'](_0xb9553f);}})[_0x8a89('0x20')](function(_0x4fa4e0){if(_0x4fa4e0){_0x4573bb=_0x4fa4e0[_0x8a89('0x34')];if(!_0x5de811[_0x8a89('0x2d')][_0x8a89('0x35')](_0x8a89('0x36'))){_0xb9553f[_0x8a89('0x1b')]=qs[_0x8a89('0x1b')](_0x5de811[_0x8a89('0x2d')][_0x8a89('0x1b')]);_0xb9553f['offset']=qs[_0x8a89('0x1c')](_0x5de811[_0x8a89('0x2d')]['offset']);}return _0x49dc26[_0x8a89('0x49')](_0xb9553f);}})[_0x8a89('0x20')](function(_0x4678ef){if(_0x4678ef){return _0x4678ef?{'count':_0x4573bb,'rows':_0x4678ef}:null;}})[_0x8a89('0x20')](respondWithResult(_0x1b6790,null))['catch'](handleError(_0x1b6790,null));};exports[_0x8a89('0x4d')]=function(_0x2dccc8,_0x5e6f73,_0x220e2c){if(_0x2dccc8['body']['id']){delete _0x2dccc8[_0x8a89('0x47')]['id'];}return db['FreshsalesAccount'][_0x8a89('0x4a')]({'where':{'id':_0x2dccc8['params']['id']}})[_0x8a89('0x20')](handleEntityNotFound(_0x5e6f73,null))['then'](function(_0x50012d){if(_0x50012d){_0x2dccc8['body'][_0x8a89('0x4e')]=_0x50012d['id'];_0x2dccc8[_0x8a89('0x47')][_0x8a89('0x4f')]=integrations[_0x8a89('0x50')](_0x2dccc8[_0x8a89('0x47')][_0x8a89('0x51')],_0x2dccc8['body'][_0x8a89('0x2b')]);_0x2dccc8['body'][_0x8a89('0x52')]=integrations[_0x8a89('0x53')](_0x2dccc8['body'][_0x8a89('0x51')],_0x2dccc8[_0x8a89('0x47')][_0x8a89('0x2b')]);return db[_0x8a89('0x4b')][_0x8a89('0x46')](_0x2dccc8['body'],{'include':[{'model':db[_0x8a89('0x54')],'as':'Subjects'},{'model':db[_0x8a89('0x54')],'as':_0x8a89('0x52')}]});}return null;})['then'](respondWithResult(_0x5e6f73,null))[_0x8a89('0x42')](handleError(_0x5e6f73,null));};exports[_0x8a89('0x55')]=function(_0x4c0add,_0x1ca234,_0x1f2b83){var _0x441d1f='';var _0x4ace2f='';return db[_0x8a89('0x28')]['findOne']({'where':{'id':_0x4c0add[_0x8a89('0x44')]['id']},'attributes':['id','username','remoteUri',_0x8a89('0x56')]})[_0x8a89('0x20')](handleEntityNotFound(_0x1ca234,null))[_0x8a89('0x20')](function(_0x212e0b){if(_0x212e0b){_0x4ace2f=_0x212e0b[_0x8a89('0x57')];_0x441d1f=_0x212e0b[_0x8a89('0x58')];var _0x53c330=_0x212e0b['remoteUri'][_0x8a89('0x59')](-0x1);if(_0x53c330==='/'){_0x441d1f=_0x441d1f['substring'](0x0,_0x441d1f['lastIndexOf'](_0x53c330));}return rp({'method':'GET','uri':util[_0x8a89('0x5a')](_0x8a89('0x5b'),_0x441d1f,_0x8a89('0x5c')),'headers':{'Authorization':'Token\x20token='+_0x212e0b[_0x8a89('0x56')]},'json':!![]});}})['then'](function(_0x442714){if(_0x442714){var _0x120a39=_0x442714[_0x8a89('0x5d')];var _0x49e431=![];var _0xa9a835=null;for(_0xa9a835=0x0;_0xa9a835<_0x120a39[_0x8a89('0x34')];_0xa9a835++){if(_0x120a39[_0xa9a835][_0x8a89('0x5e')]===_0x4ace2f){_0x49e431=!![];}}if(_0x49e431){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x1ca234,null))[_0x8a89('0x42')](function(_0x900ab){var _0x1ba3fe=_0x4c0add[_0x8a89('0x2d')][_0x8a89('0x5f')]?0x1f4:_0x900ab[_0x8a89('0x60')]||0x1f4;logger['error'](_0x8a89('0x61'),_0x8a89('0x55'),_0x1ba3fe,JSON[_0x8a89('0x62')](_0x900ab));delete _0x900ab['name'];if(_0x1ba3fe===0x191){_0x1ba3fe=0x190;}_0x1ca234['status'](_0x1ba3fe)[_0x8a89('0x25')](_0x4c0add['query'][_0x8a89('0x5f')]?{'message':_0x8a89('0x63'),'statusCode':_0x900ab['statusCode']}:_0x900ab);});}; \ No newline at end of file +var _0xfb8e=['apply','save','update','then','error','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','params','keys','find','catch','create','body','getConfigurations','findOne','FreshsalesConfiguration','nolimit','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','set','Content-Range'];(function(_0x2ca9dd,_0x5cc5d5){var _0x5bc969=function(_0x4a3558){while(--_0x4a3558){_0x2ca9dd['push'](_0x2ca9dd['shift']());}};_0x5bc969(++_0x5cc5d5);}(_0xfb8e,0x15b));var _0xefb8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfb8e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xefb8('0x0'));var rimraf=require(_0xefb8('0x1'));var zipdir=require(_0xefb8('0x2'));var jsonpatch=require(_0xefb8('0x3'));var rp=require('request-promise');var moment=require(_0xefb8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xefb8('0x5'));var util=require(_0xefb8('0x6'));var path=require(_0xefb8('0x7'));var sox=require('sox');var csv=require(_0xefb8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xefb8('0x9'));var _=require(_0xefb8('0xa'));var squel=require(_0xefb8('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xefb8('0xc'));var toCsv=require(_0xefb8('0x8'));var querystring=require('querystring');var Papa=require(_0xefb8('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xefb8('0xe'));var as=require(_0xefb8('0xf'));var hardwareService=require(_0xefb8('0x10'));var logger=require(_0xefb8('0x11'))('api');var utils=require(_0xefb8('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xefb8('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0xefb8('0x14'));function respondWithStatusCode(_0x163900,_0x4c19d9){_0x4c19d9=_0x4c19d9||0xcc;return function(_0xa5ac90){if(_0xa5ac90){return _0x163900[_0xefb8('0x15')](_0x4c19d9);}return _0x163900[_0xefb8('0x16')](_0x4c19d9)[_0xefb8('0x17')]();};}function respondWithResult(_0xcb48cf,_0x5ca76c){_0x5ca76c=_0x5ca76c||0xc8;return function(_0x52ca7b){if(_0x52ca7b){return _0xcb48cf[_0xefb8('0x16')](_0x5ca76c)['json'](_0x52ca7b);}};}function respondWithFilteredResult(_0xac28e,_0x324c7a){return function(_0x1f86ab){if(_0x1f86ab){var _0x4325c4=typeof _0x324c7a[_0xefb8('0x18')]===_0xefb8('0x19')&&typeof _0x324c7a['limit']===_0xefb8('0x19');var _0x12a661=_0x1f86ab[_0xefb8('0x1a')];var _0x10bc5e=_0x4325c4?0x0:_0x324c7a[_0xefb8('0x18')];var _0x5e7f83=_0x4325c4?_0x1f86ab['count']:_0x324c7a[_0xefb8('0x18')]+_0x324c7a['limit'];var _0x53e8f7;if(_0x5e7f83>=_0x12a661){_0x5e7f83=_0x12a661;_0x53e8f7=0xc8;}else{_0x53e8f7=0xce;}_0xac28e[_0xefb8('0x16')](_0x53e8f7);return _0xac28e[_0xefb8('0x1b')](_0xefb8('0x1c'),_0x10bc5e+'-'+_0x5e7f83+'/'+_0x12a661)['json'](_0x1f86ab);}return null;};}function patchUpdates(_0x3b4ce6){return function(_0x221784){try{jsonpatch[_0xefb8('0x1d')](_0x221784,_0x3b4ce6,!![]);}catch(_0x1f4c75){return BPromise['reject'](_0x1f4c75);}return _0x221784[_0xefb8('0x1e')]();};}function saveUpdates(_0x4a4cb2,_0x1eabb2){return function(_0x4b8224){if(_0x4b8224){return _0x4b8224[_0xefb8('0x1f')](_0x4a4cb2)[_0xefb8('0x20')](function(_0x2236c6){return _0x2236c6;});}return null;};}function removeEntity(_0x144b26,_0x43ec54){return function(_0x455800){if(_0x455800){return _0x455800['destroy']()[_0xefb8('0x20')](function(){_0x144b26[_0xefb8('0x16')](0xcc)[_0xefb8('0x17')]();});}};}function handleEntityNotFound(_0x158770,_0x2748c5){return function(_0x3259da){if(!_0x3259da){_0x158770[_0xefb8('0x15')](0x194);}return _0x3259da;};}function handleError(_0x4e2194,_0x2e23d0){_0x2e23d0=_0x2e23d0||0x1f4;return function(_0x4e9559){logger[_0xefb8('0x21')](_0x4e9559['stack']);if(_0x4e9559[_0xefb8('0x22')]){delete _0x4e9559[_0xefb8('0x22')];}_0x4e2194[_0xefb8('0x16')](_0x2e23d0)[_0xefb8('0x23')](_0x4e9559);};}exports[_0xefb8('0x24')]=function(_0x1f7ceb,_0x559215){var _0xcaf61f={},_0x3e1038={},_0x2b1b8a={'count':0x0,'rows':[]};var _0x3116ef=_[_0xefb8('0x25')](db[_0xefb8('0x26')][_0xefb8('0x27')],function(_0x46a556){return{'name':_0x46a556[_0xefb8('0x28')],'type':_0x46a556[_0xefb8('0x29')]['key']};});_0x3e1038['model']=_[_0xefb8('0x25')](_0x3116ef,_0xefb8('0x22'));_0x3e1038['query']=_['keys'](_0x1f7ceb[_0xefb8('0x2a')]);_0x3e1038[_0xefb8('0x2b')]=_['intersection'](_0x3e1038[_0xefb8('0x2c')],_0x3e1038[_0xefb8('0x2a')]);_0xcaf61f[_0xefb8('0x2d')]=_[_0xefb8('0x2e')](_0x3e1038[_0xefb8('0x2c')],qs[_0xefb8('0x2f')](_0x1f7ceb[_0xefb8('0x2a')]['fields']));_0xcaf61f[_0xefb8('0x2d')]=_0xcaf61f['attributes'][_0xefb8('0x30')]?_0xcaf61f[_0xefb8('0x2d')]:_0x3e1038['model'];if(!_0x1f7ceb[_0xefb8('0x2a')][_0xefb8('0x31')]('nolimit')){_0xcaf61f[_0xefb8('0x32')]=qs[_0xefb8('0x32')](_0x1f7ceb[_0xefb8('0x2a')][_0xefb8('0x32')]);_0xcaf61f[_0xefb8('0x18')]=qs['offset'](_0x1f7ceb[_0xefb8('0x2a')][_0xefb8('0x18')]);}_0xcaf61f[_0xefb8('0x33')]=qs[_0xefb8('0x34')](_0x1f7ceb[_0xefb8('0x2a')][_0xefb8('0x34')]);_0xcaf61f[_0xefb8('0x35')]=qs[_0xefb8('0x2b')](_[_0xefb8('0x36')](_0x1f7ceb[_0xefb8('0x2a')],_0x3e1038[_0xefb8('0x2b')]),_0x3116ef);if(_0x1f7ceb[_0xefb8('0x2a')]['filter']){_0xcaf61f[_0xefb8('0x35')]=_[_0xefb8('0x37')](_0xcaf61f[_0xefb8('0x35')],{'$or':_[_0xefb8('0x25')](_0x3116ef,function(_0x37d7d1){if(_0x37d7d1['type']!=='VIRTUAL'){var _0x2ec0f1={};_0x2ec0f1[_0x37d7d1[_0xefb8('0x22')]]={'$like':'%'+_0x1f7ceb[_0xefb8('0x2a')][_0xefb8('0x38')]+'%'};return _0x2ec0f1;}})});}_0xcaf61f=_['merge']({},_0xcaf61f,_0x1f7ceb[_0xefb8('0x39')]);var _0xf3062d={'where':_0xcaf61f[_0xefb8('0x35')]};return db[_0xefb8('0x26')][_0xefb8('0x1a')](_0xf3062d)[_0xefb8('0x20')](function(_0x4240d3){_0x2b1b8a['count']=_0x4240d3;if(_0x1f7ceb[_0xefb8('0x2a')][_0xefb8('0x3a')]){_0xcaf61f[_0xefb8('0x3b')]=[{'all':!![]}];}return db[_0xefb8('0x26')]['findAll'](_0xcaf61f);})[_0xefb8('0x20')](function(_0x499c5b){_0x2b1b8a[_0xefb8('0x3c')]=_0x499c5b;return _0x2b1b8a;})[_0xefb8('0x20')](respondWithFilteredResult(_0x559215,_0xcaf61f))['catch'](handleError(_0x559215,null));};exports['show']=function(_0x1f286b,_0x5c3a8a){var _0x5e2ac1={'raw':![],'where':{'id':_0x1f286b[_0xefb8('0x3d')]['id']}},_0x1b8817={};_0x1b8817['model']=_[_0xefb8('0x3e')](db['FreshsalesAccount'][_0xefb8('0x27')]);_0x1b8817[_0xefb8('0x2a')]=_[_0xefb8('0x3e')](_0x1f286b['query']);_0x1b8817['filters']=_[_0xefb8('0x2e')](_0x1b8817[_0xefb8('0x2c')],_0x1b8817[_0xefb8('0x2a')]);_0x5e2ac1[_0xefb8('0x2d')]=_[_0xefb8('0x2e')](_0x1b8817[_0xefb8('0x2c')],qs[_0xefb8('0x2f')](_0x1f286b[_0xefb8('0x2a')][_0xefb8('0x2f')]));_0x5e2ac1['attributes']=_0x5e2ac1[_0xefb8('0x2d')][_0xefb8('0x30')]?_0x5e2ac1[_0xefb8('0x2d')]:_0x1b8817['model'];if(_0x1f286b[_0xefb8('0x2a')][_0xefb8('0x3a')]){_0x5e2ac1[_0xefb8('0x3b')]=[{'all':!![]}];}_0x5e2ac1=_[_0xefb8('0x37')]({},_0x5e2ac1,_0x1f286b['options']);return db[_0xefb8('0x26')][_0xefb8('0x3f')](_0x5e2ac1)[_0xefb8('0x20')](handleEntityNotFound(_0x5c3a8a,null))[_0xefb8('0x20')](respondWithResult(_0x5c3a8a,null))[_0xefb8('0x40')](handleError(_0x5c3a8a,null));};exports['create']=function(_0x29b8cb,_0x29b5d2){return db[_0xefb8('0x26')][_0xefb8('0x41')](_0x29b8cb[_0xefb8('0x42')],{})[_0xefb8('0x20')](respondWithResult(_0x29b5d2,0xc9))[_0xefb8('0x40')](handleError(_0x29b5d2,null));};exports['update']=function(_0x54fd4f,_0x21b590){if(_0x54fd4f[_0xefb8('0x42')]['id']){delete _0x54fd4f[_0xefb8('0x42')]['id'];}return db[_0xefb8('0x26')][_0xefb8('0x3f')]({'where':{'id':_0x54fd4f[_0xefb8('0x3d')]['id']}})['then'](handleEntityNotFound(_0x21b590,null))[_0xefb8('0x20')](saveUpdates(_0x54fd4f['body'],null))[_0xefb8('0x20')](respondWithResult(_0x21b590,null))['catch'](handleError(_0x21b590,null));};exports['destroy']=function(_0x5b671e,_0x14d5cd){return db['FreshsalesAccount'][_0xefb8('0x3f')]({'where':{'id':_0x5b671e['params']['id']}})[_0xefb8('0x20')](handleEntityNotFound(_0x14d5cd,null))[_0xefb8('0x20')](removeEntity(_0x14d5cd,null))[_0xefb8('0x40')](handleError(_0x14d5cd,null));};exports[_0xefb8('0x43')]=function(_0x4bb2c4,_0xfb01,_0x349521){var _0x5df63d={};var _0x5b3bc3={};var _0x478a45;var _0x3bfbea;return db['FreshsalesAccount'][_0xefb8('0x44')]({'where':{'id':_0x4bb2c4[_0xefb8('0x3d')]['id']}})[_0xefb8('0x20')](handleEntityNotFound(_0xfb01,null))['then'](function(_0x59746a){if(_0x59746a){_0x478a45=_0x59746a;_0x5b3bc3['model']=_[_0xefb8('0x3e')](db[_0xefb8('0x45')][_0xefb8('0x27')]);_0x5b3bc3['query']=_['keys'](_0x4bb2c4[_0xefb8('0x2a')]);_0x5b3bc3[_0xefb8('0x2b')]=_[_0xefb8('0x2e')](_0x5b3bc3[_0xefb8('0x2c')],_0x5b3bc3[_0xefb8('0x2a')]);_0x5df63d[_0xefb8('0x2d')]=_['intersection'](_0x5b3bc3[_0xefb8('0x2c')],qs[_0xefb8('0x2f')](_0x4bb2c4[_0xefb8('0x2a')][_0xefb8('0x2f')]));_0x5df63d[_0xefb8('0x2d')]=_0x5df63d[_0xefb8('0x2d')][_0xefb8('0x30')]?_0x5df63d[_0xefb8('0x2d')]:_0x5b3bc3[_0xefb8('0x2c')];_0x5df63d[_0xefb8('0x33')]=qs[_0xefb8('0x34')](_0x4bb2c4[_0xefb8('0x2a')]['sort']);_0x5df63d['where']=qs[_0xefb8('0x2b')](_['pick'](_0x4bb2c4['query'],_0x5b3bc3['filters']));if(_0x4bb2c4[_0xefb8('0x2a')][_0xefb8('0x38')]){_0x5df63d[_0xefb8('0x35')]=_[_0xefb8('0x37')](_0x5df63d['where'],{'$or':_[_0xefb8('0x25')](_0x5df63d[_0xefb8('0x2d')],function(_0x708c82){var _0x1494d3={};_0x1494d3[_0x708c82]={'$like':'%'+_0x4bb2c4[_0xefb8('0x2a')]['filter']+'%'};return _0x1494d3;})});}_0x5df63d=_[_0xefb8('0x37')]({},_0x5df63d,_0x4bb2c4[_0xefb8('0x39')]);return _0x478a45[_0xefb8('0x43')](_0x5df63d);}})['then'](function(_0x207f56){if(_0x207f56){_0x3bfbea=_0x207f56[_0xefb8('0x30')];if(!_0x4bb2c4[_0xefb8('0x2a')][_0xefb8('0x31')](_0xefb8('0x46'))){_0x5df63d['limit']=qs['limit'](_0x4bb2c4[_0xefb8('0x2a')][_0xefb8('0x32')]);_0x5df63d[_0xefb8('0x18')]=qs[_0xefb8('0x18')](_0x4bb2c4[_0xefb8('0x2a')][_0xefb8('0x18')]);}return _0x478a45[_0xefb8('0x43')](_0x5df63d);}})['then'](function(_0x511de0){if(_0x511de0){return _0x511de0?{'count':_0x3bfbea,'rows':_0x511de0}:null;}})['then'](respondWithResult(_0xfb01,null))[_0xefb8('0x40')](handleError(_0xfb01,null));};exports['addConfiguration']=function(_0x4d897e,_0x289779,_0x284b2d){if(_0x4d897e[_0xefb8('0x42')]['id']){delete _0x4d897e[_0xefb8('0x42')]['id'];}return db[_0xefb8('0x26')]['findOne']({'where':{'id':_0x4d897e['params']['id']}})[_0xefb8('0x20')](handleEntityNotFound(_0x289779,null))[_0xefb8('0x20')](function(_0x608b92){if(_0x608b92){_0x4d897e[_0xefb8('0x42')]['AccountId']=_0x608b92['id'];_0x4d897e[_0xefb8('0x42')][_0xefb8('0x47')]=integrations[_0xefb8('0x48')](_0x4d897e['body'][_0xefb8('0x49')],_0x4d897e[_0xefb8('0x42')][_0xefb8('0x29')]);_0x4d897e[_0xefb8('0x42')][_0xefb8('0x4a')]=integrations['getDescriptions'](_0x4d897e[_0xefb8('0x42')][_0xefb8('0x49')],_0x4d897e[_0xefb8('0x42')][_0xefb8('0x29')]);return db[_0xefb8('0x45')][_0xefb8('0x41')](_0x4d897e['body'],{'include':[{'model':db['FreshsalesField'],'as':_0xefb8('0x47')},{'model':db[_0xefb8('0x4b')],'as':_0xefb8('0x4a')}]});}return null;})[_0xefb8('0x20')](respondWithResult(_0x289779,null))['catch'](handleError(_0x289779,null));};exports[_0xefb8('0x4c')]=function(_0x571219,_0x281e12,_0x547431){var _0x1a2fa0='';var _0x75b166='';return db['FreshsalesAccount'][_0xefb8('0x44')]({'where':{'id':_0x571219[_0xefb8('0x3d')]['id']},'attributes':['id',_0xefb8('0x4d'),_0xefb8('0x4e'),_0xefb8('0x4f')]})['then'](handleEntityNotFound(_0x281e12,null))[_0xefb8('0x20')](function(_0x45d1b1){if(_0x45d1b1){_0x75b166=_0x45d1b1['username'];_0x1a2fa0=_0x45d1b1[_0xefb8('0x4e')];var _0x2d5666=_0x45d1b1[_0xefb8('0x4e')][_0xefb8('0x50')](-0x1);if(_0x2d5666==='/'){_0x1a2fa0=_0x1a2fa0[_0xefb8('0x51')](0x0,_0x1a2fa0[_0xefb8('0x52')](_0x2d5666));}return rp({'method':_0xefb8('0x53'),'uri':util[_0xefb8('0x54')](_0xefb8('0x55'),_0x1a2fa0,_0xefb8('0x56')),'headers':{'Authorization':_0xefb8('0x57')+_0x45d1b1[_0xefb8('0x4f')]},'json':!![]});}})['then'](function(_0x166454){if(_0x166454){var _0x4d8931=_0x166454[_0xefb8('0x58')];var _0x5a5c19=![];var _0x41c128=null;for(_0x41c128=0x0;_0x41c128<_0x4d8931[_0xefb8('0x30')];_0x41c128++){if(_0x4d8931[_0x41c128]['email']===_0x75b166){_0x5a5c19=!![];}}if(_0x5a5c19){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xefb8('0x59')});}}})[_0xefb8('0x20')](respondWithResult(_0x281e12,null))[_0xefb8('0x40')](function(_0x4a5d12){var _0x38abab=_0x571219[_0xefb8('0x2a')][_0xefb8('0x5a')]?0x1f4:_0x4a5d12[_0xefb8('0x5b')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xefb8('0x4c'),_0x38abab,JSON[_0xefb8('0x5c')](_0x4a5d12));delete _0x4a5d12[_0xefb8('0x22')];if(_0x38abab===0x191){_0x38abab=0x190;}_0x281e12[_0xefb8('0x16')](_0x38abab)[_0xefb8('0x23')](_0x571219[_0xefb8('0x2a')][_0xefb8('0x5a')]?{'message':_0xefb8('0x5d'),'statusCode':_0x4a5d12[_0xefb8('0x5b')]}:_0x4a5d12);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 0ed7ab0..6efadda 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 _0x2a07=['moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x26a5a2,_0x29591b){var _0x2800a4=function(_0x5a7c90){while(--_0x5a7c90){_0x26a5a2['push'](_0x26a5a2['shift']());}};_0x2800a4(++_0x29591b);}(_0x2a07,0x74));var _0x72a0=function(_0x215ea3,_0x24d78){_0x215ea3=_0x215ea3-0x0;var _0x542d1d=_0x2a07[_0x215ea3];return _0x542d1d;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));var integrations=require(_0x72a0('0xa'));module[_0x72a0('0xb')]=function(_0x20dab9,_0x193e3b){return _0x20dab9[_0x72a0('0xc')](_0x72a0('0xd'),attributes,{'tableName':_0x72a0('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x627e=['path','rimraf','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x296ccf,_0x37a6ce){var _0x2d6390=function(_0x13e87c){while(--_0x13e87c){_0x296ccf['push'](_0x296ccf['shift']());}};_0x2d6390(++_0x37a6ce);}(_0x627e,0x14a));var _0xe627=function(_0x22b122,_0x357d10){_0x22b122=_0x22b122-0x0;var _0x194b8c=_0x627e[_0x22b122];return _0x194b8c;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var logger=require(_0xe627('0x2'))(_0xe627('0x3'));var moment=require(_0xe627('0x4'));var BPromise=require('bluebird');var rp=require(_0xe627('0x5'));var fs=require('fs');var path=require(_0xe627('0x6'));var rimraf=require(_0xe627('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xe627('0x8')]=function(_0x3f2791,_0x45e49a){return _0x3f2791[_0xe627('0x9')](_0xe627('0xa'),attributes,{'tableName':_0xe627('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 1227716..cb0cdb7 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 _0xbff5=['attributes','limit','include','map','model','GetFreshsalesAccount','FreshsalesAccount','find','raw','ShowFreshsalesAccount','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','findAll','options','where'];(function(_0x5b3e06,_0x91af7b){var _0x5bf864=function(_0x154dc0){while(--_0x154dc0){_0x5b3e06['push'](_0x5b3e06['shift']());}};_0x5bf864(++_0x91af7b);}(_0xbff5,0x1bc));var _0x5bff=function(_0xfcc34a,_0x1dcef9){_0xfcc34a=_0xfcc34a-0x0;var _0x50ff8c=_0xbff5[_0xfcc34a];return _0x50ff8c;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var moment=require(_0x5bff('0x2'));var BPromise=require(_0x5bff('0x3'));var rs=require(_0x5bff('0x4'));var fs=require('fs');var Redis=require(_0x5bff('0x5'));var db=require(_0x5bff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bff('0x8'));var client=jayson[_0x5bff('0x9')][_0x5bff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa54c57,_0x43605a,_0xd4b9dc){return new BPromise(function(_0x1acb49,_0x139c99){return client[_0x5bff('0xb')](_0xa54c57,_0xd4b9dc)['then'](function(_0x20e26f){logger['info'](_0x5bff('0xc'),_0x43605a,_0x5bff('0xd'));logger['debug'](_0x5bff('0xe'),_0x43605a,'request\x20sent',JSON[_0x5bff('0xf')](_0x20e26f));if(_0x20e26f['error']){if(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x11')]===0x1f4){logger['error'](_0x5bff('0xc'),_0x43605a,_0x20e26f['error'][_0x5bff('0x12')]);return _0x139c99(_0x20e26f[_0x5bff('0x10')]['message']);}logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x20e26f['error']['message']);return _0x1acb49(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x12')]);}else{logger[_0x5bff('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x43605a,_0x5bff('0xd'));_0x1acb49(_0x20e26f[_0x5bff('0x14')][_0x5bff('0x12')]);}})['catch'](function(_0x3ffbbc){logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x3ffbbc);_0x139c99(_0x3ffbbc);});});}exports['GetFreshsalesAccount']=function(_0xc9fbc3){var _0x279c22=this;return new Promise(function(_0x36653b,_0x32cf60){return db['FreshsalesAccount'][_0x5bff('0x15')]({'raw':_0xc9fbc3['options']?_0xc9fbc3[_0x5bff('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x17')]||null:null,'attributes':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x18')]||null:null,'limit':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x19')]||null:null,'include':_0xc9fbc3['options']?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x1a')],function(_0x31d26b){return{'model':db[_0x31d26b[_0x5bff('0x1c')]],'as':_0x31d26b['as'],'attributes':_0x31d26b[_0x5bff('0x18')],'include':_0x31d26b['include']?_['map'](_0x31d26b[_0x5bff('0x1a')],function(_0x53bd97){return{'model':db[_0x53bd97[_0x5bff('0x1c')]],'as':_0x53bd97['as'],'attributes':_0x53bd97[_0x5bff('0x18')],'include':_0x53bd97[_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0x53bd97[_0x5bff('0x1a')],function(_0x1140eb){return{'model':db[_0x1140eb[_0x5bff('0x1c')]],'as':_0x1140eb['as'],'attributes':_0x1140eb[_0x5bff('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4df57a){logger[_0x5bff('0x13')](_0x5bff('0x1d'),_0xc9fbc3);logger['debug'](_0x5bff('0x1d'),_0xc9fbc3,JSON['stringify'](_0x4df57a));_0x36653b(_0x4df57a);})['catch'](function(_0x3eda3a){logger['error'](_0x5bff('0x1d'),_0x3eda3a[_0x5bff('0x12')],_0xc9fbc3);_0x32cf60(_0x279c22[_0x5bff('0x10')](0x1f4,_0x3eda3a[_0x5bff('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x71783){var _0x4ee6f1=this;return new Promise(function(_0x3c1405,_0x5a7873){return db[_0x5bff('0x1e')][_0x5bff('0x1f')]({'raw':_0x71783[_0x5bff('0x16')]?_0x71783[_0x5bff('0x16')][_0x5bff('0x20')]===undefined?!![]:![]:!![],'where':_0x71783[_0x5bff('0x16')]?_0x71783['options'][_0x5bff('0x17')]||null:null,'attributes':_0x71783[_0x5bff('0x16')]?_0x71783[_0x5bff('0x16')][_0x5bff('0x18')]||null:null,'include':_0x71783[_0x5bff('0x16')]?_0x71783[_0x5bff('0x16')][_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0x71783['options'][_0x5bff('0x1a')],function(_0x16042d){return{'model':db[_0x16042d[_0x5bff('0x1c')]],'as':_0x16042d['as'],'attributes':_0x16042d[_0x5bff('0x18')],'include':_0x16042d['include']?_[_0x5bff('0x1b')](_0x16042d[_0x5bff('0x1a')],function(_0x5a24be){return{'model':db[_0x5a24be[_0x5bff('0x1c')]],'as':_0x5a24be['as'],'attributes':_0x5a24be[_0x5bff('0x18')],'include':_0x5a24be[_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0x5a24be['include'],function(_0x38245d){return{'model':db[_0x38245d[_0x5bff('0x1c')]],'as':_0x38245d['as'],'attributes':_0x38245d[_0x5bff('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1065d1){logger['info'](_0x5bff('0x21'),_0x71783);logger[_0x5bff('0x22')](_0x5bff('0x21'),_0x71783,JSON['stringify'](_0x1065d1));_0x3c1405(_0x1065d1);})[_0x5bff('0x23')](function(_0x1ec079){logger[_0x5bff('0x10')]('ShowFreshsalesAccount',_0x1ec079[_0x5bff('0x12')],_0x71783);_0x5a7873(_0x4ee6f1[_0x5bff('0x10')](0x1f4,_0x1ec079['message']));});});}; \ No newline at end of file +var _0x32b6=['raw','where','attributes','limit','include','map','model','catch','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','info','GetFreshsalesAccount','FreshsalesAccount','findAll','options'];(function(_0x26d4b0,_0x39d0c2){var _0x53c17d=function(_0xaccbba){while(--_0xaccbba){_0x26d4b0['push'](_0x26d4b0['shift']());}};_0x53c17d(++_0x39d0c2);}(_0x32b6,0x1d1));var _0x632b=function(_0x15e6a1,_0x39f5a9){_0x15e6a1=_0x15e6a1-0x0;var _0x374eba=_0x32b6[_0x15e6a1];return _0x374eba;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});}exports[_0x632b('0x15')]=function(_0x3bb27f){var _0x28c472=this;return new Promise(function(_0x51c894,_0x2f3e88){return db[_0x632b('0x16')][_0x632b('0x17')]({'raw':_0x3bb27f[_0x632b('0x18')]?_0x3bb27f['options'][_0x632b('0x19')]===undefined?!![]:![]:!![],'where':_0x3bb27f[_0x632b('0x18')]?_0x3bb27f['options'][_0x632b('0x1a')]||null:null,'attributes':_0x3bb27f['options']?_0x3bb27f['options'][_0x632b('0x1b')]||null:null,'limit':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x18')][_0x632b('0x1c')]||null:null,'include':_0x3bb27f[_0x632b('0x18')]?_0x3bb27f['options'][_0x632b('0x1d')]?_[_0x632b('0x1e')](_0x3bb27f['options'][_0x632b('0x1d')],function(_0x379dc2){return{'model':db[_0x379dc2[_0x632b('0x1f')]],'as':_0x379dc2['as'],'attributes':_0x379dc2[_0x632b('0x1b')],'include':_0x379dc2[_0x632b('0x1d')]?_[_0x632b('0x1e')](_0x379dc2['include'],function(_0x5e7b20){return{'model':db[_0x5e7b20[_0x632b('0x1f')]],'as':_0x5e7b20['as'],'attributes':_0x5e7b20['attributes'],'include':_0x5e7b20[_0x632b('0x1d')]?_[_0x632b('0x1e')](_0x5e7b20['include'],function(_0x273e89){return{'model':db[_0x273e89[_0x632b('0x1f')]],'as':_0x273e89['as'],'attributes':_0x273e89[_0x632b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x632b('0xc')](function(_0x4728a8){logger[_0x632b('0x14')](_0x632b('0x15'),_0x3bb27f);logger[_0x632b('0xd')](_0x632b('0x15'),_0x3bb27f,JSON['stringify'](_0x4728a8));_0x51c894(_0x4728a8);})[_0x632b('0x20')](function(_0x35348e){logger[_0x632b('0x10')](_0x632b('0x15'),_0x35348e[_0x632b('0x13')],_0x3bb27f);_0x2f3e88(_0x28c472[_0x632b('0x10')](0x1f4,_0x35348e[_0x632b('0x13')]));});});};exports[_0x632b('0x21')]=function(_0x1ace1b){var _0x319df3=this;return new Promise(function(_0x417793,_0x35584f){return db[_0x632b('0x16')][_0x632b('0x22')]({'raw':_0x1ace1b[_0x632b('0x18')]?_0x1ace1b[_0x632b('0x18')][_0x632b('0x19')]===undefined?!![]:![]:!![],'where':_0x1ace1b[_0x632b('0x18')]?_0x1ace1b[_0x632b('0x18')][_0x632b('0x1a')]||null:null,'attributes':_0x1ace1b['options']?_0x1ace1b[_0x632b('0x18')][_0x632b('0x1b')]||null:null,'include':_0x1ace1b[_0x632b('0x18')]?_0x1ace1b[_0x632b('0x18')]['include']?_[_0x632b('0x1e')](_0x1ace1b['options'][_0x632b('0x1d')],function(_0x15b22d){return{'model':db[_0x15b22d['model']],'as':_0x15b22d['as'],'attributes':_0x15b22d[_0x632b('0x1b')],'include':_0x15b22d[_0x632b('0x1d')]?_[_0x632b('0x1e')](_0x15b22d[_0x632b('0x1d')],function(_0x27bbf5){return{'model':db[_0x27bbf5[_0x632b('0x1f')]],'as':_0x27bbf5['as'],'attributes':_0x27bbf5[_0x632b('0x1b')],'include':_0x27bbf5[_0x632b('0x1d')]?_['map'](_0x27bbf5['include'],function(_0x22ae6a){return{'model':db[_0x22ae6a[_0x632b('0x1f')]],'as':_0x22ae6a['as'],'attributes':_0x22ae6a[_0x632b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x632b('0xc')](function(_0x384420){logger[_0x632b('0x14')](_0x632b('0x21'),_0x1ace1b);logger[_0x632b('0xd')]('ShowFreshsalesAccount',_0x1ace1b,JSON['stringify'](_0x384420));_0x417793(_0x384420);})[_0x632b('0x20')](function(_0x581b92){logger[_0x632b('0x10')](_0x632b('0x21'),_0x581b92[_0x632b('0x13')],_0x1ace1b);_0x35584f(_0x319df3[_0x632b('0x10')](0x1f4,_0x581b92[_0x632b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index c8e8f71..e5f60f3 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 _0x157a=['/:id/descriptions','/:id/fields','getFields','create','put','exports','multer','util','path','express','Router','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects'];(function(_0x15d178,_0x533561){var _0xc73785=function(_0x30674c){while(--_0x30674c){_0x15d178['push'](_0x15d178['shift']());}};_0xc73785(++_0x533561);}(_0x157a,0x84));var _0xa157=function(_0x32cce8,_0x18762f){_0x32cce8=_0x32cce8-0x0;var _0x4a732b=_0x157a[_0x32cce8];return _0x4a732b;};'use strict';var multer=require(_0xa157('0x0'));var util=require(_0xa157('0x1'));var path=require(_0xa157('0x2'));var timeout=require('connect-timeout');var express=require(_0xa157('0x3'));var router=express[_0xa157('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(_0xa157('0x5'));router[_0xa157('0x6')]('/',auth[_0xa157('0x7')](),controller[_0xa157('0x8')]);router[_0xa157('0x6')](_0xa157('0x9'),auth['isAuthenticated'](),controller[_0xa157('0xa')]);router[_0xa157('0x6')](_0xa157('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xa157('0x6')](_0xa157('0xc'),auth[_0xa157('0x7')](),controller['getDescriptions']);router[_0xa157('0x6')](_0xa157('0xd'),auth[_0xa157('0x7')](),controller[_0xa157('0xe')]);router['post']('/',auth[_0xa157('0x7')](),controller[_0xa157('0xf')]);router[_0xa157('0x10')](_0xa157('0x9'),auth[_0xa157('0x7')](),controller['update']);router['delete']('/:id',auth[_0xa157('0x7')](),controller['destroy']);module[_0xa157('0x11')]=router; \ No newline at end of file +var _0xb04d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x3a11bd,_0x8efa14){var _0x5c582c=function(_0x4fae19){while(--_0x4fae19){_0x3a11bd['push'](_0x3a11bd['shift']());}};_0x5c582c(++_0x8efa14);}(_0xb04d,0x1b7));var _0xdb04=function(_0x4aa230,_0x2eb136){_0x4aa230=_0x4aa230-0x0;var _0x8c275f=_0xb04d[_0x4aa230];return _0x8c275f;};'use strict';var multer=require(_0xdb04('0x0'));var util=require(_0xdb04('0x1'));var path=require('path');var timeout=require(_0xdb04('0x2'));var express=require(_0xdb04('0x3'));var router=express[_0xdb04('0x4')]();var fs_extra=require(_0xdb04('0x5'));var auth=require(_0xdb04('0x6'));var interaction=require(_0xdb04('0x7'));var config=require(_0xdb04('0x8'));var controller=require(_0xdb04('0x9'));router[_0xdb04('0xa')]('/',auth[_0xdb04('0xb')](),controller[_0xdb04('0xc')]);router[_0xdb04('0xa')](_0xdb04('0xd'),auth[_0xdb04('0xb')](),controller[_0xdb04('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xdb04('0xf')]);router[_0xdb04('0xa')]('/:id/descriptions',auth[_0xdb04('0xb')](),controller[_0xdb04('0x10')]);router[_0xdb04('0xa')](_0xdb04('0x11'),auth[_0xdb04('0xb')](),controller[_0xdb04('0x12')]);router[_0xdb04('0x13')]('/',auth['isAuthenticated'](),controller[_0xdb04('0x14')]);router[_0xdb04('0x15')](_0xdb04('0xd'),auth[_0xdb04('0xb')](),controller[_0xdb04('0x16')]);router[_0xdb04('0x17')](_0xdb04('0xd'),auth[_0xdb04('0xb')](),controller[_0xdb04('0x18')]);module[_0xdb04('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 3853239..5cf53d4 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 _0xcacd=['sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcacd,0x108));var _0xdcac=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xcacd[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xdcac('0x0'));module[_0xdcac('0x1')]={'name':{'type':Sequelize[_0xdcac('0x2')]},'description':{'type':Sequelize[_0xdcac('0x2')]}}; \ No newline at end of file +var _0xb0ef=['exports','STRING','sequelize'];(function(_0x13cf5e,_0x216f0b){var _0xb26f15=function(_0x5b5e60){while(--_0x5b5e60){_0x13cf5e['push'](_0x13cf5e['shift']());}};_0xb26f15(++_0x216f0b);}(_0xb0ef,0x14c));var _0xfb0e=function(_0x497c06,_0x5768b2){_0x497c06=_0x497c06-0x0;var _0x12f052=_0xb0ef[_0x497c06];return _0x12f052;};'use strict';var Sequelize=require(_0xfb0e('0x0'));module[_0xfb0e('0x1')]={'name':{'type':Sequelize[_0xfb0e('0x2')]},'description':{'type':Sequelize[_0xfb0e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 87ca532..759fe68 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 _0x8678=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','FreshsalesConfiguration','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','includeAll','include','findAll','catch','show','options','create','body','find','params','getSubjects','rawAttributes','order','pick','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0x8678,0x90));var _0x8867=function(_0x5b2f5b,_0x5a38d8){_0x5b2f5b=_0x5b2f5b-0x0;var _0x330b3b=_0x8678[_0x5b2f5b];return _0x330b3b;};'use strict';var emlformat=require(_0x8867('0x0'));var rimraf=require(_0x8867('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8867('0x2'));var rp=require(_0x8867('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8867('0x4'));var util=require(_0x8867('0x5'));var path=require(_0x8867('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8867('0x7'));var fs=require('fs');var fs_extra=require(_0x8867('0x8'));var _=require('lodash');var squel=require(_0x8867('0x9'));var crypto=require(_0x8867('0xa'));var jsforce=require(_0x8867('0xb'));var deskjs=require(_0x8867('0xc'));var toCsv=require(_0x8867('0xd'));var querystring=require(_0x8867('0xe'));var Papa=require(_0x8867('0xf'));var Redis=require(_0x8867('0x10'));var authService=require(_0x8867('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8867('0x12'));var logger=require(_0x8867('0x13'))('api');var utils=require(_0x8867('0x14'));var config=require(_0x8867('0x15'));var licenseUtil=require(_0x8867('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50e745,_0x51b6bb){_0x51b6bb=_0x51b6bb||0xcc;return function(_0x57e1c3){if(_0x57e1c3){return _0x50e745['sendStatus'](_0x51b6bb);}return _0x50e745[_0x8867('0x17')](_0x51b6bb)['end']();};}function respondWithResult(_0x5244e5,_0x3b1ecd){_0x3b1ecd=_0x3b1ecd||0xc8;return function(_0x4fa69c){if(_0x4fa69c){return _0x5244e5[_0x8867('0x17')](_0x3b1ecd)[_0x8867('0x18')](_0x4fa69c);}};}function respondWithFilteredResult(_0x50f762,_0x2d771a){return function(_0x14186f){if(_0x14186f){var _0x27737b=typeof _0x2d771a[_0x8867('0x19')]===_0x8867('0x1a')&&typeof _0x2d771a[_0x8867('0x1b')]===_0x8867('0x1a');var _0x4fdead=_0x14186f['count'];var _0x201943=_0x27737b?0x0:_0x2d771a['offset'];var _0x5e852a=_0x27737b?_0x14186f[_0x8867('0x1c')]:_0x2d771a['offset']+_0x2d771a[_0x8867('0x1b')];var _0x4b05de;if(_0x5e852a>=_0x4fdead){_0x5e852a=_0x4fdead;_0x4b05de=0xc8;}else{_0x4b05de=0xce;}_0x50f762['status'](_0x4b05de);return _0x50f762[_0x8867('0x1d')](_0x8867('0x1e'),_0x201943+'-'+_0x5e852a+'/'+_0x4fdead)[_0x8867('0x18')](_0x14186f);}return null;};}function patchUpdates(_0x55b16c){return function(_0xf8b0cc){try{jsonpatch[_0x8867('0x1f')](_0xf8b0cc,_0x55b16c,!![]);}catch(_0x2b9b77){return BPromise[_0x8867('0x20')](_0x2b9b77);}return _0xf8b0cc['save']();};}function saveUpdates(_0x125524,_0x24f7d7){return function(_0x5df5b1){if(_0x5df5b1){return _0x5df5b1[_0x8867('0x21')](_0x125524)[_0x8867('0x22')](function(_0x489a87){return _0x489a87;});}return null;};}function removeEntity(_0x18a58e,_0xa22e96){return function(_0x890928){if(_0x890928){return _0x890928[_0x8867('0x23')]()[_0x8867('0x22')](function(){_0x18a58e[_0x8867('0x17')](0xcc)[_0x8867('0x24')]();});}};}function handleEntityNotFound(_0x497eca,_0x27d796){return function(_0x37e5d2){if(!_0x37e5d2){_0x497eca[_0x8867('0x25')](0x194);}return _0x37e5d2;};}function handleError(_0x1470db,_0x5e2dc9){_0x5e2dc9=_0x5e2dc9||0x1f4;return function(_0xef5c05){logger[_0x8867('0x26')](_0xef5c05['stack']);if(_0xef5c05[_0x8867('0x27')]){delete _0xef5c05[_0x8867('0x27')];}_0x1470db[_0x8867('0x17')](_0x5e2dc9)[_0x8867('0x28')](_0xef5c05);};}exports['index']=function(_0x45b2b5,_0x4cfba1){var _0x2d0fe8={},_0x474d71={},_0x3f27f7={'count':0x0,'rows':[]};var _0x5c4484=_['map'](db[_0x8867('0x29')]['rawAttributes'],function(_0x402b06){return{'name':_0x402b06[_0x8867('0x2a')],'type':_0x402b06[_0x8867('0x2b')][_0x8867('0x2c')]};});_0x474d71[_0x8867('0x2d')]=_[_0x8867('0x2e')](_0x5c4484,_0x8867('0x27'));_0x474d71[_0x8867('0x2f')]=_[_0x8867('0x30')](_0x45b2b5[_0x8867('0x2f')]);_0x474d71['filters']=_[_0x8867('0x31')](_0x474d71[_0x8867('0x2d')],_0x474d71[_0x8867('0x2f')]);_0x2d0fe8['attributes']=_['intersection'](_0x474d71[_0x8867('0x2d')],qs[_0x8867('0x32')](_0x45b2b5[_0x8867('0x2f')][_0x8867('0x32')]));_0x2d0fe8[_0x8867('0x33')]=_0x2d0fe8[_0x8867('0x33')][_0x8867('0x34')]?_0x2d0fe8[_0x8867('0x33')]:_0x474d71['model'];if(!_0x45b2b5[_0x8867('0x2f')][_0x8867('0x35')](_0x8867('0x36'))){_0x2d0fe8[_0x8867('0x1b')]=qs[_0x8867('0x1b')](_0x45b2b5[_0x8867('0x2f')][_0x8867('0x1b')]);_0x2d0fe8[_0x8867('0x19')]=qs['offset'](_0x45b2b5[_0x8867('0x2f')][_0x8867('0x19')]);}_0x2d0fe8['order']=qs[_0x8867('0x37')](_0x45b2b5[_0x8867('0x2f')][_0x8867('0x37')]);_0x2d0fe8[_0x8867('0x38')]=qs[_0x8867('0x39')](_['pick'](_0x45b2b5[_0x8867('0x2f')],_0x474d71['filters']),_0x5c4484);if(_0x45b2b5[_0x8867('0x2f')][_0x8867('0x3a')]){_0x2d0fe8[_0x8867('0x38')]=_[_0x8867('0x3b')](_0x2d0fe8['where'],{'$or':_[_0x8867('0x2e')](_0x5c4484,function(_0x280677){if(_0x280677['type']!=='VIRTUAL'){var _0x4f2dc1={};_0x4f2dc1[_0x280677['name']]={'$like':'%'+_0x45b2b5[_0x8867('0x2f')][_0x8867('0x3a')]+'%'};return _0x4f2dc1;}})});}_0x2d0fe8=_['merge']({},_0x2d0fe8,_0x45b2b5['options']);var _0x368680={'where':_0x2d0fe8[_0x8867('0x38')]};return db[_0x8867('0x29')]['count'](_0x368680)['then'](function(_0xc6f70){_0x3f27f7[_0x8867('0x1c')]=_0xc6f70;if(_0x45b2b5[_0x8867('0x2f')][_0x8867('0x3c')]){_0x2d0fe8[_0x8867('0x3d')]=[{'all':!![]}];}return db[_0x8867('0x29')][_0x8867('0x3e')](_0x2d0fe8);})['then'](function(_0x2089d1){_0x3f27f7['rows']=_0x2089d1;return _0x3f27f7;})[_0x8867('0x22')](respondWithFilteredResult(_0x4cfba1,_0x2d0fe8))[_0x8867('0x3f')](handleError(_0x4cfba1,null));};exports[_0x8867('0x40')]=function(_0x28159f,_0x1f1476){var _0x1fe902={'raw':![],'where':{'id':_0x28159f['params']['id']}},_0x5d1b24={};_0x5d1b24['model']=_['keys'](db[_0x8867('0x29')]['rawAttributes']);_0x5d1b24[_0x8867('0x2f')]=_[_0x8867('0x30')](_0x28159f[_0x8867('0x2f')]);_0x5d1b24['filters']=_[_0x8867('0x31')](_0x5d1b24[_0x8867('0x2d')],_0x5d1b24[_0x8867('0x2f')]);_0x1fe902[_0x8867('0x33')]=_[_0x8867('0x31')](_0x5d1b24[_0x8867('0x2d')],qs[_0x8867('0x32')](_0x28159f[_0x8867('0x2f')][_0x8867('0x32')]));_0x1fe902[_0x8867('0x33')]=_0x1fe902[_0x8867('0x33')]['length']?_0x1fe902[_0x8867('0x33')]:_0x5d1b24[_0x8867('0x2d')];if(_0x28159f[_0x8867('0x2f')]['includeAll']){_0x1fe902['include']=[{'all':!![]}];}_0x1fe902=_['merge']({},_0x1fe902,_0x28159f[_0x8867('0x41')]);return db['FreshsalesConfiguration']['find'](_0x1fe902)[_0x8867('0x22')](handleEntityNotFound(_0x1f1476,null))['then'](respondWithResult(_0x1f1476,null))[_0x8867('0x3f')](handleError(_0x1f1476,null));};exports[_0x8867('0x42')]=function(_0xf68536,_0x173db9){return db[_0x8867('0x29')]['create'](_0xf68536[_0x8867('0x43')],{})[_0x8867('0x22')](respondWithResult(_0x173db9,0xc9))[_0x8867('0x3f')](handleError(_0x173db9,null));};exports['update']=function(_0x8d77fa,_0x17b058){if(_0x8d77fa[_0x8867('0x43')]['id']){delete _0x8d77fa[_0x8867('0x43')]['id'];}return db[_0x8867('0x29')][_0x8867('0x44')]({'where':{'id':_0x8d77fa[_0x8867('0x45')]['id']}})['then'](handleEntityNotFound(_0x17b058,null))[_0x8867('0x22')](saveUpdates(_0x8d77fa[_0x8867('0x43')],null))[_0x8867('0x22')](respondWithResult(_0x17b058,null))[_0x8867('0x3f')](handleError(_0x17b058,null));};exports[_0x8867('0x23')]=function(_0x10646e,_0x3bf910){return db[_0x8867('0x29')]['find']({'where':{'id':_0x10646e['params']['id']}})['then'](handleEntityNotFound(_0x3bf910,null))['then'](removeEntity(_0x3bf910,null))['catch'](handleError(_0x3bf910,null));};exports[_0x8867('0x46')]=function(_0x2290f1,_0x430bfc,_0x2f61e0){var _0x51fa90={};var _0x1723ca={};var _0x5d6ee5;var _0x1f6284;return db[_0x8867('0x29')]['findOne']({'where':{'id':_0x2290f1[_0x8867('0x45')]['id']}})[_0x8867('0x22')](handleEntityNotFound(_0x430bfc,null))[_0x8867('0x22')](function(_0x2b294b){if(_0x2b294b){_0x5d6ee5=_0x2b294b;_0x1723ca[_0x8867('0x2d')]=_[_0x8867('0x30')](db['FreshsalesField'][_0x8867('0x47')]);_0x1723ca[_0x8867('0x2f')]=_['keys'](_0x2290f1[_0x8867('0x2f')]);_0x1723ca[_0x8867('0x39')]=_['intersection'](_0x1723ca[_0x8867('0x2d')],_0x1723ca['query']);_0x51fa90[_0x8867('0x33')]=_[_0x8867('0x31')](_0x1723ca[_0x8867('0x2d')],qs[_0x8867('0x32')](_0x2290f1[_0x8867('0x2f')][_0x8867('0x32')]));_0x51fa90[_0x8867('0x33')]=_0x51fa90[_0x8867('0x33')]['length']?_0x51fa90[_0x8867('0x33')]:_0x1723ca['model'];_0x51fa90[_0x8867('0x48')]=qs['sort'](_0x2290f1[_0x8867('0x2f')][_0x8867('0x37')]);_0x51fa90[_0x8867('0x38')]=qs[_0x8867('0x39')](_[_0x8867('0x49')](_0x2290f1[_0x8867('0x2f')],_0x1723ca[_0x8867('0x39')]));if(_0x2290f1[_0x8867('0x2f')][_0x8867('0x3a')]){_0x51fa90[_0x8867('0x38')]=_[_0x8867('0x3b')](_0x51fa90['where'],{'$or':_[_0x8867('0x2e')](_0x51fa90[_0x8867('0x33')],function(_0x35d99c){var _0x15154d={};_0x15154d[_0x35d99c]={'$like':'%'+_0x2290f1[_0x8867('0x2f')][_0x8867('0x3a')]+'%'};return _0x15154d;})});}_0x51fa90=_['merge']({},_0x51fa90,_0x2290f1[_0x8867('0x41')]);return _0x5d6ee5[_0x8867('0x46')](_0x51fa90);}})['then'](function(_0x1d1371){if(_0x1d1371){_0x1f6284=_0x1d1371['length'];if(!_0x2290f1['query'][_0x8867('0x35')](_0x8867('0x36'))){_0x51fa90[_0x8867('0x1b')]=qs[_0x8867('0x1b')](_0x2290f1[_0x8867('0x2f')][_0x8867('0x1b')]);_0x51fa90[_0x8867('0x19')]=qs['offset'](_0x2290f1[_0x8867('0x2f')]['offset']);}return _0x5d6ee5[_0x8867('0x46')](_0x51fa90);}})[_0x8867('0x22')](function(_0x2f61e7){if(_0x2f61e7){return _0x2f61e7?{'count':_0x1f6284,'rows':_0x2f61e7}:null;}})[_0x8867('0x22')](respondWithResult(_0x430bfc,null))[_0x8867('0x3f')](handleError(_0x430bfc,null));};exports['getDescriptions']=function(_0x53fa98,_0x2c18eb,_0x5385e2){var _0x13489d={};var _0x2eb66c={};var _0x483d39;var _0x2efdbe;return db[_0x8867('0x29')][_0x8867('0x4a')]({'where':{'id':_0x53fa98[_0x8867('0x45')]['id']}})[_0x8867('0x22')](handleEntityNotFound(_0x2c18eb,null))[_0x8867('0x22')](function(_0x4c25c4){if(_0x4c25c4){_0x483d39=_0x4c25c4;_0x2eb66c[_0x8867('0x2d')]=_['keys'](db[_0x8867('0x4b')]['rawAttributes']);_0x2eb66c[_0x8867('0x2f')]=_[_0x8867('0x30')](_0x53fa98['query']);_0x2eb66c['filters']=_[_0x8867('0x31')](_0x2eb66c[_0x8867('0x2d')],_0x2eb66c[_0x8867('0x2f')]);_0x13489d['attributes']=_[_0x8867('0x31')](_0x2eb66c[_0x8867('0x2d')],qs[_0x8867('0x32')](_0x53fa98['query'][_0x8867('0x32')]));_0x13489d[_0x8867('0x33')]=_0x13489d[_0x8867('0x33')][_0x8867('0x34')]?_0x13489d[_0x8867('0x33')]:_0x2eb66c[_0x8867('0x2d')];_0x13489d[_0x8867('0x48')]=qs[_0x8867('0x37')](_0x53fa98[_0x8867('0x2f')][_0x8867('0x37')]);_0x13489d[_0x8867('0x38')]=qs[_0x8867('0x39')](_[_0x8867('0x49')](_0x53fa98[_0x8867('0x2f')],_0x2eb66c['filters']));if(_0x53fa98[_0x8867('0x2f')][_0x8867('0x3a')]){_0x13489d[_0x8867('0x38')]=_[_0x8867('0x3b')](_0x13489d['where'],{'$or':_['map'](_0x13489d[_0x8867('0x33')],function(_0x472fe5){var _0x477099={};_0x477099[_0x472fe5]={'$like':'%'+_0x53fa98[_0x8867('0x2f')][_0x8867('0x3a')]+'%'};return _0x477099;})});}_0x13489d=_[_0x8867('0x3b')]({},_0x13489d,_0x53fa98['options']);return _0x483d39['getDescriptions'](_0x13489d);}})[_0x8867('0x22')](function(_0xbd3693){if(_0xbd3693){_0x2efdbe=_0xbd3693[_0x8867('0x34')];if(!_0x53fa98['query'][_0x8867('0x35')]('nolimit')){_0x13489d[_0x8867('0x1b')]=qs['limit'](_0x53fa98['query']['limit']);_0x13489d[_0x8867('0x19')]=qs[_0x8867('0x19')](_0x53fa98['query'][_0x8867('0x19')]);}return _0x483d39[_0x8867('0x4c')](_0x13489d);}})[_0x8867('0x22')](function(_0x351253){if(_0x351253){return _0x351253?{'count':_0x2efdbe,'rows':_0x351253}:null;}})[_0x8867('0x22')](respondWithResult(_0x2c18eb,null))[_0x8867('0x3f')](handleError(_0x2c18eb,null));};exports[_0x8867('0x4d')]=function(_0x29f265,_0x358aa9,_0x2cf4b6){var _0x2f6c12={};var _0x37ada5={};var _0x2dea3c;var _0x41228e;return db[_0x8867('0x29')][_0x8867('0x4a')]({'where':{'id':_0x29f265[_0x8867('0x45')]['id']}})['then'](handleEntityNotFound(_0x358aa9,null))[_0x8867('0x22')](function(_0x4181e3){if(_0x4181e3){_0x2dea3c=_0x4181e3;_0x37ada5[_0x8867('0x2d')]=_[_0x8867('0x30')](db['FreshsalesField'][_0x8867('0x47')]);_0x37ada5[_0x8867('0x2f')]=_[_0x8867('0x30')](_0x29f265[_0x8867('0x2f')]);_0x37ada5[_0x8867('0x39')]=_[_0x8867('0x31')](_0x37ada5[_0x8867('0x2d')],_0x37ada5[_0x8867('0x2f')]);_0x2f6c12[_0x8867('0x33')]=_[_0x8867('0x31')](_0x37ada5[_0x8867('0x2d')],qs[_0x8867('0x32')](_0x29f265[_0x8867('0x2f')][_0x8867('0x32')]));_0x2f6c12[_0x8867('0x33')]=_0x2f6c12[_0x8867('0x33')]['length']?_0x2f6c12['attributes']:_0x37ada5[_0x8867('0x2d')];_0x2f6c12[_0x8867('0x48')]=qs[_0x8867('0x37')](_0x29f265[_0x8867('0x2f')][_0x8867('0x37')]);_0x2f6c12[_0x8867('0x38')]=qs[_0x8867('0x39')](_[_0x8867('0x49')](_0x29f265['query'],_0x37ada5[_0x8867('0x39')]));if(_0x29f265['query'][_0x8867('0x3a')]){_0x2f6c12[_0x8867('0x38')]=_[_0x8867('0x3b')](_0x2f6c12[_0x8867('0x38')],{'$or':_[_0x8867('0x2e')](_0x2f6c12[_0x8867('0x33')],function(_0x4cb931){var _0x44df7d={};_0x44df7d[_0x4cb931]={'$like':'%'+_0x29f265[_0x8867('0x2f')][_0x8867('0x3a')]+'%'};return _0x44df7d;})});}_0x2f6c12=_[_0x8867('0x3b')]({},_0x2f6c12,_0x29f265[_0x8867('0x41')]);return _0x2dea3c['getFields'](_0x2f6c12);}})[_0x8867('0x22')](function(_0x15092d){if(_0x15092d){_0x41228e=_0x15092d[_0x8867('0x34')];if(!_0x29f265[_0x8867('0x2f')][_0x8867('0x35')](_0x8867('0x36'))){_0x2f6c12[_0x8867('0x1b')]=qs['limit'](_0x29f265[_0x8867('0x2f')][_0x8867('0x1b')]);_0x2f6c12[_0x8867('0x19')]=qs['offset'](_0x29f265[_0x8867('0x2f')]['offset']);}return _0x2dea3c[_0x8867('0x4d')](_0x2f6c12);}})[_0x8867('0x22')](function(_0x432466){if(_0x432466){return _0x432466?{'count':_0x41228e,'rows':_0x432466}:null;}})[_0x8867('0x22')](respondWithResult(_0x358aa9,null))['catch'](handleError(_0x358aa9,null));}; \ No newline at end of file +var _0x4ae5=['mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','create','body','find','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x1d2f3e,_0x3d9931){var _0x7aaf40=function(_0xefbdda){while(--_0xefbdda){_0x1d2f3e['push'](_0x1d2f3e['shift']());}};_0x7aaf40(++_0x3d9931);}(_0x4ae5,0x1a4));var _0x54ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4ae5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x54ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x54ae('0x1'));var jsonpatch=require(_0x54ae('0x2'));var rp=require(_0x54ae('0x3'));var moment=require('moment');var BPromise=require(_0x54ae('0x4'));var Mustache=require(_0x54ae('0x5'));var util=require(_0x54ae('0x6'));var path=require(_0x54ae('0x7'));var sox=require(_0x54ae('0x8'));var csv=require('to-csv');var ejs=require(_0x54ae('0x9'));var fs=require('fs');var fs_extra=require(_0x54ae('0xa'));var _=require(_0x54ae('0xb'));var squel=require(_0x54ae('0xc'));var crypto=require(_0x54ae('0xd'));var jsforce=require(_0x54ae('0xe'));var deskjs=require(_0x54ae('0xf'));var toCsv=require(_0x54ae('0x10'));var querystring=require(_0x54ae('0x11'));var Papa=require(_0x54ae('0x12'));var Redis=require(_0x54ae('0x13'));var authService=require(_0x54ae('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x54ae('0x15'));var logger=require(_0x54ae('0x16'))(_0x54ae('0x17'));var utils=require(_0x54ae('0x18'));var config=require(_0x54ae('0x19'));var licenseUtil=require(_0x54ae('0x1a'));var db=require(_0x54ae('0x1b'))['db'];function respondWithStatusCode(_0x5f17fc,_0x12df20){_0x12df20=_0x12df20||0xcc;return function(_0x5a5911){if(_0x5a5911){return _0x5f17fc[_0x54ae('0x1c')](_0x12df20);}return _0x5f17fc[_0x54ae('0x1d')](_0x12df20)[_0x54ae('0x1e')]();};}function respondWithResult(_0x14e37f,_0x4c416e){_0x4c416e=_0x4c416e||0xc8;return function(_0x3396b2){if(_0x3396b2){return _0x14e37f[_0x54ae('0x1d')](_0x4c416e)[_0x54ae('0x1f')](_0x3396b2);}};}function respondWithFilteredResult(_0x338178,_0x1ffa5b){return function(_0x5e59f8){if(_0x5e59f8){var _0x172178=typeof _0x1ffa5b[_0x54ae('0x20')]==='undefined'&&typeof _0x1ffa5b[_0x54ae('0x21')]==='undefined';var _0x181f68=_0x5e59f8[_0x54ae('0x22')];var _0x57b102=_0x172178?0x0:_0x1ffa5b[_0x54ae('0x20')];var _0x3358a0=_0x172178?_0x5e59f8[_0x54ae('0x22')]:_0x1ffa5b[_0x54ae('0x20')]+_0x1ffa5b[_0x54ae('0x21')];var _0x837547;if(_0x3358a0>=_0x181f68){_0x3358a0=_0x181f68;_0x837547=0xc8;}else{_0x837547=0xce;}_0x338178[_0x54ae('0x1d')](_0x837547);return _0x338178[_0x54ae('0x23')](_0x54ae('0x24'),_0x57b102+'-'+_0x3358a0+'/'+_0x181f68)[_0x54ae('0x1f')](_0x5e59f8);}return null;};}function patchUpdates(_0xc212ff){return function(_0x482d86){try{jsonpatch[_0x54ae('0x25')](_0x482d86,_0xc212ff,!![]);}catch(_0x43500d){return BPromise[_0x54ae('0x26')](_0x43500d);}return _0x482d86[_0x54ae('0x27')]();};}function saveUpdates(_0x478d55,_0x108ba0){return function(_0x5f075d){if(_0x5f075d){return _0x5f075d[_0x54ae('0x28')](_0x478d55)[_0x54ae('0x29')](function(_0x15f140){return _0x15f140;});}return null;};}function removeEntity(_0x2cdf48,_0xd34c8f){return function(_0x535207){if(_0x535207){return _0x535207[_0x54ae('0x2a')]()[_0x54ae('0x29')](function(){_0x2cdf48[_0x54ae('0x1d')](0xcc)[_0x54ae('0x1e')]();});}};}function handleEntityNotFound(_0x15ee38,_0x4e7538){return function(_0x4e54d7){if(!_0x4e54d7){_0x15ee38[_0x54ae('0x1c')](0x194);}return _0x4e54d7;};}function handleError(_0x21acd4,_0x383f28){_0x383f28=_0x383f28||0x1f4;return function(_0x2ad780){logger[_0x54ae('0x2b')](_0x2ad780[_0x54ae('0x2c')]);if(_0x2ad780[_0x54ae('0x2d')]){delete _0x2ad780[_0x54ae('0x2d')];}_0x21acd4['status'](_0x383f28)['send'](_0x2ad780);};}exports[_0x54ae('0x2e')]=function(_0x259863,_0x38d1c1){var _0x24defd={},_0x33b24d={},_0x3b2ade={'count':0x0,'rows':[]};var _0x1de7fd=_['map'](db[_0x54ae('0x2f')][_0x54ae('0x30')],function(_0x20c1d1){return{'name':_0x20c1d1[_0x54ae('0x31')],'type':_0x20c1d1[_0x54ae('0x32')][_0x54ae('0x33')]};});_0x33b24d[_0x54ae('0x34')]=_[_0x54ae('0x35')](_0x1de7fd,_0x54ae('0x2d'));_0x33b24d[_0x54ae('0x36')]=_['keys'](_0x259863[_0x54ae('0x36')]);_0x33b24d[_0x54ae('0x37')]=_[_0x54ae('0x38')](_0x33b24d['model'],_0x33b24d[_0x54ae('0x36')]);_0x24defd[_0x54ae('0x39')]=_[_0x54ae('0x38')](_0x33b24d[_0x54ae('0x34')],qs[_0x54ae('0x3a')](_0x259863[_0x54ae('0x36')][_0x54ae('0x3a')]));_0x24defd[_0x54ae('0x39')]=_0x24defd[_0x54ae('0x39')][_0x54ae('0x3b')]?_0x24defd[_0x54ae('0x39')]:_0x33b24d[_0x54ae('0x34')];if(!_0x259863['query'][_0x54ae('0x3c')](_0x54ae('0x3d'))){_0x24defd[_0x54ae('0x21')]=qs[_0x54ae('0x21')](_0x259863[_0x54ae('0x36')][_0x54ae('0x21')]);_0x24defd[_0x54ae('0x20')]=qs[_0x54ae('0x20')](_0x259863[_0x54ae('0x36')][_0x54ae('0x20')]);}_0x24defd[_0x54ae('0x3e')]=qs[_0x54ae('0x3f')](_0x259863[_0x54ae('0x36')][_0x54ae('0x3f')]);_0x24defd['where']=qs[_0x54ae('0x37')](_[_0x54ae('0x40')](_0x259863[_0x54ae('0x36')],_0x33b24d[_0x54ae('0x37')]),_0x1de7fd);if(_0x259863[_0x54ae('0x36')][_0x54ae('0x41')]){_0x24defd[_0x54ae('0x42')]=_[_0x54ae('0x43')](_0x24defd[_0x54ae('0x42')],{'$or':_['map'](_0x1de7fd,function(_0x1fcf0c){if(_0x1fcf0c[_0x54ae('0x32')]!==_0x54ae('0x44')){var _0x542e44={};_0x542e44[_0x1fcf0c[_0x54ae('0x2d')]]={'$like':'%'+_0x259863[_0x54ae('0x36')][_0x54ae('0x41')]+'%'};return _0x542e44;}})});}_0x24defd=_[_0x54ae('0x43')]({},_0x24defd,_0x259863[_0x54ae('0x45')]);var _0x2d9aee={'where':_0x24defd[_0x54ae('0x42')]};return db[_0x54ae('0x2f')]['count'](_0x2d9aee)[_0x54ae('0x29')](function(_0x3d37f5){_0x3b2ade[_0x54ae('0x22')]=_0x3d37f5;if(_0x259863[_0x54ae('0x36')][_0x54ae('0x46')]){_0x24defd[_0x54ae('0x47')]=[{'all':!![]}];}return db[_0x54ae('0x2f')][_0x54ae('0x48')](_0x24defd);})[_0x54ae('0x29')](function(_0x28d9f8){_0x3b2ade[_0x54ae('0x49')]=_0x28d9f8;return _0x3b2ade;})[_0x54ae('0x29')](respondWithFilteredResult(_0x38d1c1,_0x24defd))[_0x54ae('0x4a')](handleError(_0x38d1c1,null));};exports['show']=function(_0xdde41,_0x1df05d){var _0x5c0e35={'raw':![],'where':{'id':_0xdde41[_0x54ae('0x4b')]['id']}},_0x565ba1={};_0x565ba1[_0x54ae('0x34')]=_[_0x54ae('0x4c')](db[_0x54ae('0x2f')][_0x54ae('0x30')]);_0x565ba1[_0x54ae('0x36')]=_[_0x54ae('0x4c')](_0xdde41['query']);_0x565ba1['filters']=_['intersection'](_0x565ba1[_0x54ae('0x34')],_0x565ba1['query']);_0x5c0e35[_0x54ae('0x39')]=_[_0x54ae('0x38')](_0x565ba1[_0x54ae('0x34')],qs[_0x54ae('0x3a')](_0xdde41[_0x54ae('0x36')][_0x54ae('0x3a')]));_0x5c0e35[_0x54ae('0x39')]=_0x5c0e35[_0x54ae('0x39')][_0x54ae('0x3b')]?_0x5c0e35[_0x54ae('0x39')]:_0x565ba1['model'];if(_0xdde41[_0x54ae('0x36')][_0x54ae('0x46')]){_0x5c0e35[_0x54ae('0x47')]=[{'all':!![]}];}_0x5c0e35=_['merge']({},_0x5c0e35,_0xdde41[_0x54ae('0x45')]);return db[_0x54ae('0x2f')]['find'](_0x5c0e35)[_0x54ae('0x29')](handleEntityNotFound(_0x1df05d,null))[_0x54ae('0x29')](respondWithResult(_0x1df05d,null))[_0x54ae('0x4a')](handleError(_0x1df05d,null));};exports[_0x54ae('0x4d')]=function(_0x43a6d5,_0x42ef86){return db[_0x54ae('0x2f')][_0x54ae('0x4d')](_0x43a6d5[_0x54ae('0x4e')],{})[_0x54ae('0x29')](respondWithResult(_0x42ef86,0xc9))['catch'](handleError(_0x42ef86,null));};exports['update']=function(_0x2ffcaf,_0x5a5d45){if(_0x2ffcaf[_0x54ae('0x4e')]['id']){delete _0x2ffcaf[_0x54ae('0x4e')]['id'];}return db['FreshsalesConfiguration'][_0x54ae('0x4f')]({'where':{'id':_0x2ffcaf['params']['id']}})['then'](handleEntityNotFound(_0x5a5d45,null))[_0x54ae('0x29')](saveUpdates(_0x2ffcaf[_0x54ae('0x4e')],null))['then'](respondWithResult(_0x5a5d45,null))[_0x54ae('0x4a')](handleError(_0x5a5d45,null));};exports[_0x54ae('0x2a')]=function(_0x1c0107,_0x20b109){return db[_0x54ae('0x2f')][_0x54ae('0x4f')]({'where':{'id':_0x1c0107[_0x54ae('0x4b')]['id']}})[_0x54ae('0x29')](handleEntityNotFound(_0x20b109,null))[_0x54ae('0x29')](removeEntity(_0x20b109,null))[_0x54ae('0x4a')](handleError(_0x20b109,null));};exports[_0x54ae('0x50')]=function(_0x41cba6,_0x360888,_0x5284fb){var _0x5be808={};var _0x1eee77={};var _0x333305;var _0x2d9207;return db[_0x54ae('0x2f')][_0x54ae('0x51')]({'where':{'id':_0x41cba6[_0x54ae('0x4b')]['id']}})[_0x54ae('0x29')](handleEntityNotFound(_0x360888,null))[_0x54ae('0x29')](function(_0x1f4b30){if(_0x1f4b30){_0x333305=_0x1f4b30;_0x1eee77[_0x54ae('0x34')]=_['keys'](db[_0x54ae('0x52')][_0x54ae('0x30')]);_0x1eee77[_0x54ae('0x36')]=_[_0x54ae('0x4c')](_0x41cba6[_0x54ae('0x36')]);_0x1eee77[_0x54ae('0x37')]=_[_0x54ae('0x38')](_0x1eee77[_0x54ae('0x34')],_0x1eee77['query']);_0x5be808[_0x54ae('0x39')]=_[_0x54ae('0x38')](_0x1eee77[_0x54ae('0x34')],qs[_0x54ae('0x3a')](_0x41cba6['query'][_0x54ae('0x3a')]));_0x5be808[_0x54ae('0x39')]=_0x5be808[_0x54ae('0x39')]['length']?_0x5be808[_0x54ae('0x39')]:_0x1eee77[_0x54ae('0x34')];_0x5be808['order']=qs[_0x54ae('0x3f')](_0x41cba6[_0x54ae('0x36')][_0x54ae('0x3f')]);_0x5be808[_0x54ae('0x42')]=qs[_0x54ae('0x37')](_['pick'](_0x41cba6[_0x54ae('0x36')],_0x1eee77[_0x54ae('0x37')]));if(_0x41cba6[_0x54ae('0x36')][_0x54ae('0x41')]){_0x5be808[_0x54ae('0x42')]=_['merge'](_0x5be808[_0x54ae('0x42')],{'$or':_[_0x54ae('0x35')](_0x5be808['attributes'],function(_0x46271a){var _0x512681={};_0x512681[_0x46271a]={'$like':'%'+_0x41cba6[_0x54ae('0x36')]['filter']+'%'};return _0x512681;})});}_0x5be808=_['merge']({},_0x5be808,_0x41cba6[_0x54ae('0x45')]);return _0x333305[_0x54ae('0x50')](_0x5be808);}})[_0x54ae('0x29')](function(_0x2b1351){if(_0x2b1351){_0x2d9207=_0x2b1351[_0x54ae('0x3b')];if(!_0x41cba6[_0x54ae('0x36')][_0x54ae('0x3c')](_0x54ae('0x3d'))){_0x5be808['limit']=qs[_0x54ae('0x21')](_0x41cba6[_0x54ae('0x36')][_0x54ae('0x21')]);_0x5be808[_0x54ae('0x20')]=qs[_0x54ae('0x20')](_0x41cba6[_0x54ae('0x36')][_0x54ae('0x20')]);}return _0x333305[_0x54ae('0x50')](_0x5be808);}})[_0x54ae('0x29')](function(_0xaba122){if(_0xaba122){return _0xaba122?{'count':_0x2d9207,'rows':_0xaba122}:null;}})[_0x54ae('0x29')](respondWithResult(_0x360888,null))['catch'](handleError(_0x360888,null));};exports[_0x54ae('0x53')]=function(_0x14b1cc,_0xa1f85b,_0x503310){var _0x52dd21={};var _0x6a11cc={};var _0x55bdcc;var _0x112a7b;return db[_0x54ae('0x2f')][_0x54ae('0x51')]({'where':{'id':_0x14b1cc[_0x54ae('0x4b')]['id']}})[_0x54ae('0x29')](handleEntityNotFound(_0xa1f85b,null))[_0x54ae('0x29')](function(_0x52a94e){if(_0x52a94e){_0x55bdcc=_0x52a94e;_0x6a11cc[_0x54ae('0x34')]=_[_0x54ae('0x4c')](db[_0x54ae('0x52')][_0x54ae('0x30')]);_0x6a11cc[_0x54ae('0x36')]=_[_0x54ae('0x4c')](_0x14b1cc[_0x54ae('0x36')]);_0x6a11cc[_0x54ae('0x37')]=_[_0x54ae('0x38')](_0x6a11cc[_0x54ae('0x34')],_0x6a11cc[_0x54ae('0x36')]);_0x52dd21[_0x54ae('0x39')]=_[_0x54ae('0x38')](_0x6a11cc[_0x54ae('0x34')],qs[_0x54ae('0x3a')](_0x14b1cc[_0x54ae('0x36')][_0x54ae('0x3a')]));_0x52dd21[_0x54ae('0x39')]=_0x52dd21[_0x54ae('0x39')][_0x54ae('0x3b')]?_0x52dd21[_0x54ae('0x39')]:_0x6a11cc[_0x54ae('0x34')];_0x52dd21[_0x54ae('0x3e')]=qs['sort'](_0x14b1cc[_0x54ae('0x36')]['sort']);_0x52dd21[_0x54ae('0x42')]=qs[_0x54ae('0x37')](_['pick'](_0x14b1cc[_0x54ae('0x36')],_0x6a11cc['filters']));if(_0x14b1cc[_0x54ae('0x36')][_0x54ae('0x41')]){_0x52dd21[_0x54ae('0x42')]=_['merge'](_0x52dd21['where'],{'$or':_[_0x54ae('0x35')](_0x52dd21[_0x54ae('0x39')],function(_0x393ee3){var _0x5b76ad={};_0x5b76ad[_0x393ee3]={'$like':'%'+_0x14b1cc[_0x54ae('0x36')][_0x54ae('0x41')]+'%'};return _0x5b76ad;})});}_0x52dd21=_[_0x54ae('0x43')]({},_0x52dd21,_0x14b1cc[_0x54ae('0x45')]);return _0x55bdcc[_0x54ae('0x53')](_0x52dd21);}})[_0x54ae('0x29')](function(_0x40a889){if(_0x40a889){_0x112a7b=_0x40a889[_0x54ae('0x3b')];if(!_0x14b1cc[_0x54ae('0x36')][_0x54ae('0x3c')](_0x54ae('0x3d'))){_0x52dd21[_0x54ae('0x21')]=qs[_0x54ae('0x21')](_0x14b1cc[_0x54ae('0x36')][_0x54ae('0x21')]);_0x52dd21[_0x54ae('0x20')]=qs['offset'](_0x14b1cc[_0x54ae('0x36')][_0x54ae('0x20')]);}return _0x55bdcc['getDescriptions'](_0x52dd21);}})[_0x54ae('0x29')](function(_0x58c9a1){if(_0x58c9a1){return _0x58c9a1?{'count':_0x112a7b,'rows':_0x58c9a1}:null;}})[_0x54ae('0x29')](respondWithResult(_0xa1f85b,null))['catch'](handleError(_0xa1f85b,null));};exports[_0x54ae('0x54')]=function(_0x1d8ce1,_0x3e26af,_0x2930b1){var _0x5f11b7={};var _0x326a53={};var _0x4012cd;var _0x29cf12;return db[_0x54ae('0x2f')][_0x54ae('0x51')]({'where':{'id':_0x1d8ce1[_0x54ae('0x4b')]['id']}})[_0x54ae('0x29')](handleEntityNotFound(_0x3e26af,null))[_0x54ae('0x29')](function(_0x13c451){if(_0x13c451){_0x4012cd=_0x13c451;_0x326a53[_0x54ae('0x34')]=_[_0x54ae('0x4c')](db[_0x54ae('0x52')][_0x54ae('0x30')]);_0x326a53[_0x54ae('0x36')]=_['keys'](_0x1d8ce1['query']);_0x326a53['filters']=_[_0x54ae('0x38')](_0x326a53['model'],_0x326a53[_0x54ae('0x36')]);_0x5f11b7['attributes']=_[_0x54ae('0x38')](_0x326a53['model'],qs[_0x54ae('0x3a')](_0x1d8ce1[_0x54ae('0x36')][_0x54ae('0x3a')]));_0x5f11b7[_0x54ae('0x39')]=_0x5f11b7[_0x54ae('0x39')][_0x54ae('0x3b')]?_0x5f11b7['attributes']:_0x326a53[_0x54ae('0x34')];_0x5f11b7[_0x54ae('0x3e')]=qs[_0x54ae('0x3f')](_0x1d8ce1[_0x54ae('0x36')][_0x54ae('0x3f')]);_0x5f11b7[_0x54ae('0x42')]=qs[_0x54ae('0x37')](_[_0x54ae('0x40')](_0x1d8ce1[_0x54ae('0x36')],_0x326a53[_0x54ae('0x37')]));if(_0x1d8ce1[_0x54ae('0x36')][_0x54ae('0x41')]){_0x5f11b7[_0x54ae('0x42')]=_[_0x54ae('0x43')](_0x5f11b7[_0x54ae('0x42')],{'$or':_[_0x54ae('0x35')](_0x5f11b7[_0x54ae('0x39')],function(_0x294a8b){var _0x39784a={};_0x39784a[_0x294a8b]={'$like':'%'+_0x1d8ce1['query'][_0x54ae('0x41')]+'%'};return _0x39784a;})});}_0x5f11b7=_['merge']({},_0x5f11b7,_0x1d8ce1[_0x54ae('0x45')]);return _0x4012cd[_0x54ae('0x54')](_0x5f11b7);}})['then'](function(_0x661c68){if(_0x661c68){_0x29cf12=_0x661c68[_0x54ae('0x3b')];if(!_0x1d8ce1['query'][_0x54ae('0x3c')](_0x54ae('0x3d'))){_0x5f11b7['limit']=qs[_0x54ae('0x21')](_0x1d8ce1[_0x54ae('0x36')]['limit']);_0x5f11b7[_0x54ae('0x20')]=qs['offset'](_0x1d8ce1[_0x54ae('0x36')][_0x54ae('0x20')]);}return _0x4012cd['getFields'](_0x5f11b7);}})[_0x54ae('0x29')](function(_0x5bd1db){if(_0x5bd1db){return _0x5bd1db?{'count':_0x29cf12,'rows':_0x5bd1db}:null;}})['then'](respondWithResult(_0x3e26af,null))[_0x54ae('0x4a')](handleError(_0x3e26af,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index cb74d08..b371dce 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 _0x4a62=['FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define'];(function(_0x5709e7,_0x3359e2){var _0xe1fbcf=function(_0x25977b){while(--_0x25977b){_0x5709e7['push'](_0x5709e7['shift']());}};_0xe1fbcf(++_0x3359e2);}(_0x4a62,0xf4));var _0x24a6=function(_0x255380,_0x2924a9){_0x255380=_0x255380-0x0;var _0x8c8de=_0x4a62[_0x255380];return _0x8c8de;};'use strict';var _=require(_0x24a6('0x0'));var util=require('util');var logger=require(_0x24a6('0x1'))(_0x24a6('0x2'));var moment=require(_0x24a6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x24a6('0x4'));var rimraf=require(_0x24a6('0x5'));var config=require(_0x24a6('0x6'));var attributes=require(_0x24a6('0x7'));module['exports']=function(_0x273b0b,_0x537e3e){return _0x273b0b[_0x24a6('0x8')](_0x24a6('0x9'),attributes,{'tableName':_0x24a6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4711=['lodash','api','moment','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x306ecf,_0x5a0d68){var _0x285599=function(_0x5130ad){while(--_0x5130ad){_0x306ecf['push'](_0x306ecf['shift']());}};_0x285599(++_0x5a0d68);}(_0x4711,0x168));var _0x1471=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4711[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1471('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1471('0x1'));var moment=require(_0x1471('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1471('0x3'));var rimraf=require(_0x1471('0x4'));var config=require(_0x1471('0x5'));var attributes=require(_0x1471('0x6'));module[_0x1471('0x7')]=function(_0x3a6fe4,_0x16b93e){return _0x3a6fe4[_0x1471('0x8')](_0x1471('0x9'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 4e84ef7..39976ee 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 _0x893a=['request','info','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x35a59c,_0x3c08ef){var _0x11bf0e=function(_0x154cec){while(--_0x154cec){_0x35a59c['push'](_0x35a59c['shift']());}};_0x11bf0e(++_0x3c08ef);}(_0x893a,0x14d));var _0xa893=function(_0xa941ac,_0x1ace99){_0xa941ac=_0xa941ac-0x0;var _0x499906=_0x893a[_0xa941ac];return _0x499906;};'use strict';var _=require(_0xa893('0x0'));var util=require(_0xa893('0x1'));var moment=require(_0xa893('0x2'));var BPromise=require(_0xa893('0x3'));var rs=require(_0xa893('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa893('0x5'))['db'];var utils=require(_0xa893('0x6'));var logger=require(_0xa893('0x7'))(_0xa893('0x8'));var config=require(_0xa893('0x9'));var jayson=require(_0xa893('0xa'));var client=jayson['client'][_0xa893('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x252b60,_0x610815,_0x1003c7){return new BPromise(function(_0x15017a,_0x241c6c){return client[_0xa893('0xc')](_0x252b60,_0x1003c7)['then'](function(_0x10d2e3){logger[_0xa893('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x610815,'request\x20sent');logger['debug'](_0xa893('0xe'),_0x610815,'request\x20sent',JSON[_0xa893('0xf')](_0x10d2e3));if(_0x10d2e3['error']){if(_0x10d2e3[_0xa893('0x10')][_0xa893('0x11')]===0x1f4){logger[_0xa893('0x10')](_0xa893('0x12'),_0x610815,_0x10d2e3[_0xa893('0x10')]['message']);return _0x241c6c(_0x10d2e3['error'][_0xa893('0x13')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x610815,_0x10d2e3[_0xa893('0x10')][_0xa893('0x13')]);return _0x15017a(_0x10d2e3[_0xa893('0x10')]['message']);}else{logger[_0xa893('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x610815,_0xa893('0x14'));_0x15017a(_0x10d2e3[_0xa893('0x15')]['message']);}})[_0xa893('0x16')](function(_0x531b3a){logger[_0xa893('0x10')](_0xa893('0x12'),_0x610815,_0x531b3a);_0x241c6c(_0x531b3a);});});} \ No newline at end of file +var _0x3065=['rpc','../../config/environment','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x453583,_0x5ca1e8){var _0x3e9101=function(_0x421947){while(--_0x421947){_0x453583['push'](_0x453583['shift']());}};_0x3e9101(++_0x5ca1e8);}(_0x3065,0x118));var _0x5306=function(_0x58aa9c,_0x4fe7e6){_0x58aa9c=_0x58aa9c-0x0;var _0x5cbd51=_0x3065[_0x58aa9c];return _0x5cbd51;};'use strict';var _=require(_0x5306('0x0'));var util=require('util');var moment=require(_0x5306('0x1'));var BPromise=require(_0x5306('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5306('0x3'));var db=require(_0x5306('0x4'))['db'];var utils=require(_0x5306('0x5'));var logger=require('../../config/logger')(_0x5306('0x6'));var config=require(_0x5306('0x7'));var jayson=require(_0x5306('0x8'));var client=jayson[_0x5306('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4aeae9,_0x2fc481,_0x165294){return new BPromise(function(_0xa9d987,_0x591241){return client[_0x5306('0xa')](_0x4aeae9,_0x165294)[_0x5306('0xb')](function(_0x4209e2){logger[_0x5306('0xc')](_0x5306('0xd'),_0x2fc481,_0x5306('0xe'));logger[_0x5306('0xf')](_0x5306('0x10'),_0x2fc481,_0x5306('0xe'),JSON[_0x5306('0x11')](_0x4209e2));if(_0x4209e2[_0x5306('0x12')]){if(_0x4209e2['error']['code']===0x1f4){logger['error'](_0x5306('0xd'),_0x2fc481,_0x4209e2[_0x5306('0x12')][_0x5306('0x13')]);return _0x591241(_0x4209e2[_0x5306('0x12')][_0x5306('0x13')]);}logger[_0x5306('0x12')](_0x5306('0xd'),_0x2fc481,_0x4209e2[_0x5306('0x12')][_0x5306('0x13')]);return _0xa9d987(_0x4209e2['error'][_0x5306('0x13')]);}else{logger['info'](_0x5306('0xd'),_0x2fc481,'request\x20sent');_0xa9d987(_0x4209e2[_0x5306('0x14')]['message']);}})[_0x5306('0x15')](function(_0x5a5862){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x2fc481,_0x5a5862);_0x591241(_0x5a5862);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index e1007be..4691b24 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 _0x22fb=['./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x11066a,_0x347efe){var _0x58d875=function(_0x45d3f8){while(--_0x45d3f8){_0x11066a['push'](_0x11066a['shift']());}};_0x58d875(++_0x347efe);}(_0x22fb,0x192));var _0xb22f=function(_0x59d3e6,_0x3cf4d3){_0x59d3e6=_0x59d3e6-0x0;var _0x713379=_0x22fb[_0x59d3e6];return _0x713379;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0xc')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xe')](_0xb22f('0xa'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')](_0xb22f('0xa'),auth[_0xb22f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x861c=['get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x4ac761,_0x228735){var _0x4de38d=function(_0x430d65){while(--_0x430d65){_0x4ac761['push'](_0x4ac761['shift']());}};_0x4de38d(++_0x228735);}(_0x861c,0xdb));var _0xc861=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x861c[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xc861('0x0'));var util=require(_0xc861('0x1'));var path=require(_0xc861('0x2'));var timeout=require(_0xc861('0x3'));var express=require(_0xc861('0x4'));var router=express[_0xc861('0x5')]();var fs_extra=require(_0xc861('0x6'));var auth=require(_0xc861('0x7'));var interaction=require(_0xc861('0x8'));var config=require(_0xc861('0x9'));var controller=require(_0xc861('0xa'));router[_0xc861('0xb')]('/',auth['isAuthenticated'](),controller[_0xc861('0xc')]);router[_0xc861('0xb')](_0xc861('0xd'),auth[_0xc861('0xe')](),controller[_0xc861('0xf')]);router[_0xc861('0x10')]('/',auth[_0xc861('0xe')](),controller[_0xc861('0x11')]);router[_0xc861('0x12')](_0xc861('0xd'),auth[_0xc861('0xe')](),controller[_0xc861('0x13')]);router[_0xc861('0x14')]('/:id',auth[_0xc861('0xe')](),controller[_0xc861('0x15')]);module[_0xc861('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index bdeb878..c151d55 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 _0x9c7a=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','string','variable'];(function(_0x58fe5b,_0x4ee0fd){var _0x1bedc7=function(_0x3e5d2d){while(--_0x3e5d2d){_0x58fe5b['push'](_0x58fe5b['shift']());}};_0x1bedc7(++_0x4ee0fd);}(_0x9c7a,0xec));var _0xa9c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c7a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa9c7('0x0'));module[_0xa9c7('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa9c7('0x2'),_0xa9c7('0x3'),_0xa9c7('0x4'),_0xa9c7('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa9c7('0x6')]},'key':{'type':Sequelize[_0xa9c7('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xa9c7('0x2'),_0xa9c7('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xa9c7('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa9c7('0x6')]},'customField':{'type':Sequelize[_0xa9c7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa9c7('0x6')]}}; \ No newline at end of file +var _0xa4a8=['customVariable','keyValue','STRING','string','BOOLEAN','exports','ENUM'];(function(_0x97385e,_0x17e853){var _0x5d337e=function(_0x356c96){while(--_0x356c96){_0x97385e['push'](_0x97385e['shift']());}};_0x5d337e(++_0x17e853);}(_0xa4a8,0x98));var _0x8a4a=function(_0x9488c0,_0x1bfe3c){_0x9488c0=_0x9488c0-0x0;var _0x536f41=_0xa4a8[_0x9488c0];return _0x536f41;};'use strict';var Sequelize=require('sequelize');module[_0x8a4a('0x0')]={'type':{'type':Sequelize[_0x8a4a('0x1')]('string','variable',_0x8a4a('0x2'),_0x8a4a('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8a4a('0x4')]},'keyType':{'type':Sequelize[_0x8a4a('0x1')](_0x8a4a('0x5'),'variable',_0x8a4a('0x2'))},'keyContent':{'type':Sequelize[_0x8a4a('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8a4a('0x4')]},'customField':{'type':Sequelize[_0x8a4a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8a4a('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 04b90ac..b33133d 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 _0x7f49=['count','set','Content-Range','save','update','destroy','then','end','error','stack','name','index','map','FreshsalesField','fieldName','model','query','keys','intersection','attributes','fields','order','sort','where','filters','filter','type','merge','options','includeAll','include','findAll','catch','show','rawAttributes','length','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit'];(function(_0x5f46c3,_0x28fcd4){var _0x1ac590=function(_0x237286){while(--_0x237286){_0x5f46c3['push'](_0x5f46c3['shift']());}};_0x1ac590(++_0x28fcd4);}(_0x7f49,0x1c6));var _0x97f4=function(_0x15be8b,_0x2be876){_0x15be8b=_0x15be8b-0x0;var _0x121d14=_0x7f49[_0x15be8b];return _0x121d14;};'use strict';var emlformat=require(_0x97f4('0x0'));var rimraf=require(_0x97f4('0x1'));var zipdir=require(_0x97f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97f4('0x3'));var moment=require(_0x97f4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x97f4('0x5'));var path=require(_0x97f4('0x6'));var sox=require(_0x97f4('0x7'));var csv=require(_0x97f4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97f4('0x9'));var _=require('lodash');var squel=require(_0x97f4('0xa'));var crypto=require(_0x97f4('0xb'));var jsforce=require(_0x97f4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x97f4('0x8'));var querystring=require(_0x97f4('0xd'));var Papa=require(_0x97f4('0xe'));var Redis=require(_0x97f4('0xf'));var authService=require(_0x97f4('0x10'));var qs=require(_0x97f4('0x11'));var as=require(_0x97f4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97f4('0x13'))(_0x97f4('0x14'));var utils=require(_0x97f4('0x15'));var config=require(_0x97f4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x97f4('0x17'))['db'];function respondWithStatusCode(_0x56e30b,_0x238422){_0x238422=_0x238422||0xcc;return function(_0x31120c){if(_0x31120c){return _0x56e30b['sendStatus'](_0x238422);}return _0x56e30b[_0x97f4('0x18')](_0x238422)['end']();};}function respondWithResult(_0x2605ae,_0x89651e){_0x89651e=_0x89651e||0xc8;return function(_0x2fcdb9){if(_0x2fcdb9){return _0x2605ae[_0x97f4('0x18')](_0x89651e)[_0x97f4('0x19')](_0x2fcdb9);}};}function respondWithFilteredResult(_0x181a89,_0x294d89){return function(_0x76c740){if(_0x76c740){var _0x298873=typeof _0x294d89[_0x97f4('0x1a')]===_0x97f4('0x1b')&&typeof _0x294d89[_0x97f4('0x1c')]==='undefined';var _0x4a3dc9=_0x76c740[_0x97f4('0x1d')];var _0x2a95ab=_0x298873?0x0:_0x294d89[_0x97f4('0x1a')];var _0x46c7c6=_0x298873?_0x76c740['count']:_0x294d89[_0x97f4('0x1a')]+_0x294d89[_0x97f4('0x1c')];var _0x49e9ea;if(_0x46c7c6>=_0x4a3dc9){_0x46c7c6=_0x4a3dc9;_0x49e9ea=0xc8;}else{_0x49e9ea=0xce;}_0x181a89[_0x97f4('0x18')](_0x49e9ea);return _0x181a89[_0x97f4('0x1e')](_0x97f4('0x1f'),_0x2a95ab+'-'+_0x46c7c6+'/'+_0x4a3dc9)[_0x97f4('0x19')](_0x76c740);}return null;};}function patchUpdates(_0x1446d2){return function(_0x3a4c3e){try{jsonpatch['apply'](_0x3a4c3e,_0x1446d2,!![]);}catch(_0x4723e6){return BPromise['reject'](_0x4723e6);}return _0x3a4c3e[_0x97f4('0x20')]();};}function saveUpdates(_0x2fb8ba,_0x4292b5){return function(_0x45787f){if(_0x45787f){return _0x45787f[_0x97f4('0x21')](_0x2fb8ba)['then'](function(_0x1dbd0b){return _0x1dbd0b;});}return null;};}function removeEntity(_0x1d884d,_0x423e22){return function(_0x39f2c7){if(_0x39f2c7){return _0x39f2c7[_0x97f4('0x22')]()[_0x97f4('0x23')](function(){_0x1d884d[_0x97f4('0x18')](0xcc)[_0x97f4('0x24')]();});}};}function handleEntityNotFound(_0x5a19a7,_0x38211c){return function(_0xa0a04c){if(!_0xa0a04c){_0x5a19a7['sendStatus'](0x194);}return _0xa0a04c;};}function handleError(_0x45abb6,_0x555041){_0x555041=_0x555041||0x1f4;return function(_0x9359d6){logger[_0x97f4('0x25')](_0x9359d6[_0x97f4('0x26')]);if(_0x9359d6[_0x97f4('0x27')]){delete _0x9359d6[_0x97f4('0x27')];}_0x45abb6[_0x97f4('0x18')](_0x555041)['send'](_0x9359d6);};}exports[_0x97f4('0x28')]=function(_0x973ad7,_0x1574d){var _0xeb6779={},_0x1021b3={},_0x5cd7cd={'count':0x0,'rows':[]};var _0x4a48eb=_[_0x97f4('0x29')](db[_0x97f4('0x2a')]['rawAttributes'],function(_0x3c11f3){return{'name':_0x3c11f3[_0x97f4('0x2b')],'type':_0x3c11f3['type']['key']};});_0x1021b3[_0x97f4('0x2c')]=_[_0x97f4('0x29')](_0x4a48eb,'name');_0x1021b3[_0x97f4('0x2d')]=_[_0x97f4('0x2e')](_0x973ad7[_0x97f4('0x2d')]);_0x1021b3['filters']=_[_0x97f4('0x2f')](_0x1021b3[_0x97f4('0x2c')],_0x1021b3['query']);_0xeb6779[_0x97f4('0x30')]=_['intersection'](_0x1021b3[_0x97f4('0x2c')],qs[_0x97f4('0x31')](_0x973ad7['query'][_0x97f4('0x31')]));_0xeb6779[_0x97f4('0x30')]=_0xeb6779[_0x97f4('0x30')]['length']?_0xeb6779[_0x97f4('0x30')]:_0x1021b3[_0x97f4('0x2c')];if(!_0x973ad7[_0x97f4('0x2d')]['hasOwnProperty']('nolimit')){_0xeb6779[_0x97f4('0x1c')]=qs['limit'](_0x973ad7[_0x97f4('0x2d')][_0x97f4('0x1c')]);_0xeb6779[_0x97f4('0x1a')]=qs['offset'](_0x973ad7[_0x97f4('0x2d')][_0x97f4('0x1a')]);}_0xeb6779[_0x97f4('0x32')]=qs[_0x97f4('0x33')](_0x973ad7['query'][_0x97f4('0x33')]);_0xeb6779[_0x97f4('0x34')]=qs['filters'](_['pick'](_0x973ad7[_0x97f4('0x2d')],_0x1021b3[_0x97f4('0x35')]),_0x4a48eb);if(_0x973ad7[_0x97f4('0x2d')][_0x97f4('0x36')]){_0xeb6779['where']=_['merge'](_0xeb6779[_0x97f4('0x34')],{'$or':_[_0x97f4('0x29')](_0x4a48eb,function(_0x19f404){if(_0x19f404[_0x97f4('0x37')]!=='VIRTUAL'){var _0x1076f8={};_0x1076f8[_0x19f404['name']]={'$like':'%'+_0x973ad7[_0x97f4('0x2d')][_0x97f4('0x36')]+'%'};return _0x1076f8;}})});}_0xeb6779=_[_0x97f4('0x38')]({},_0xeb6779,_0x973ad7[_0x97f4('0x39')]);var _0x396b49={'where':_0xeb6779['where']};return db['FreshsalesField'][_0x97f4('0x1d')](_0x396b49)['then'](function(_0x1c9252){_0x5cd7cd[_0x97f4('0x1d')]=_0x1c9252;if(_0x973ad7[_0x97f4('0x2d')][_0x97f4('0x3a')]){_0xeb6779[_0x97f4('0x3b')]=[{'all':!![]}];}return db[_0x97f4('0x2a')][_0x97f4('0x3c')](_0xeb6779);})[_0x97f4('0x23')](function(_0x2997aa){_0x5cd7cd['rows']=_0x2997aa;return _0x5cd7cd;})[_0x97f4('0x23')](respondWithFilteredResult(_0x1574d,_0xeb6779))[_0x97f4('0x3d')](handleError(_0x1574d,null));};exports[_0x97f4('0x3e')]=function(_0x175d04,_0xadd6a8){var _0x39ce0c={'raw':!![],'where':{'id':_0x175d04['params']['id']}},_0x2a042a={};_0x2a042a[_0x97f4('0x2c')]=_[_0x97f4('0x2e')](db['FreshsalesField'][_0x97f4('0x3f')]);_0x2a042a[_0x97f4('0x2d')]=_['keys'](_0x175d04['query']);_0x2a042a[_0x97f4('0x35')]=_[_0x97f4('0x2f')](_0x2a042a[_0x97f4('0x2c')],_0x2a042a['query']);_0x39ce0c['attributes']=_[_0x97f4('0x2f')](_0x2a042a[_0x97f4('0x2c')],qs[_0x97f4('0x31')](_0x175d04[_0x97f4('0x2d')][_0x97f4('0x31')]));_0x39ce0c[_0x97f4('0x30')]=_0x39ce0c[_0x97f4('0x30')][_0x97f4('0x40')]?_0x39ce0c['attributes']:_0x2a042a[_0x97f4('0x2c')];if(_0x175d04[_0x97f4('0x2d')][_0x97f4('0x3a')]){_0x39ce0c[_0x97f4('0x3b')]=[{'all':!![]}];}_0x39ce0c=_[_0x97f4('0x38')]({},_0x39ce0c,_0x175d04[_0x97f4('0x39')]);return db[_0x97f4('0x2a')][_0x97f4('0x41')](_0x39ce0c)['then'](handleEntityNotFound(_0xadd6a8,null))[_0x97f4('0x23')](respondWithResult(_0xadd6a8,null))[_0x97f4('0x3d')](handleError(_0xadd6a8,null));};exports[_0x97f4('0x42')]=function(_0x3e260b,_0x1cb0a6){return db[_0x97f4('0x2a')]['create'](_0x3e260b[_0x97f4('0x43')],{})[_0x97f4('0x23')](respondWithResult(_0x1cb0a6,0xc9))[_0x97f4('0x3d')](handleError(_0x1cb0a6,null));};exports[_0x97f4('0x21')]=function(_0x1f0a1b,_0x25881a){if(_0x1f0a1b[_0x97f4('0x43')]['id']){delete _0x1f0a1b['body']['id'];}return db[_0x97f4('0x2a')][_0x97f4('0x41')]({'where':{'id':_0x1f0a1b[_0x97f4('0x44')]['id']}})[_0x97f4('0x23')](handleEntityNotFound(_0x25881a,null))['then'](saveUpdates(_0x1f0a1b[_0x97f4('0x43')],null))['then'](respondWithResult(_0x25881a,null))[_0x97f4('0x3d')](handleError(_0x25881a,null));};exports[_0x97f4('0x22')]=function(_0x2f2c6e,_0x3174ca){return db['FreshsalesField'][_0x97f4('0x41')]({'where':{'id':_0x2f2c6e['params']['id']}})[_0x97f4('0x23')](handleEntityNotFound(_0x3174ca,null))[_0x97f4('0x23')](removeEntity(_0x3174ca,null))[_0x97f4('0x3d')](handleError(_0x3174ca,null));}; \ No newline at end of file +var _0x7403=['fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','FreshsalesField','rows','catch','show','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x3fd273,_0x337d32){var _0x157b1d=function(_0x47ef4b){while(--_0x47ef4b){_0x3fd273['push'](_0x3fd273['shift']());}};_0x157b1d(++_0x337d32);}(_0x7403,0xdc));var _0x3740=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7403[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3740('0x0'));var rimraf=require(_0x3740('0x1'));var zipdir=require(_0x3740('0x2'));var jsonpatch=require(_0x3740('0x3'));var rp=require('request-promise');var moment=require(_0x3740('0x4'));var BPromise=require(_0x3740('0x5'));var Mustache=require(_0x3740('0x6'));var util=require(_0x3740('0x7'));var path=require(_0x3740('0x8'));var sox=require('sox');var csv=require(_0x3740('0x9'));var ejs=require(_0x3740('0xa'));var fs=require('fs');var fs_extra=require(_0x3740('0xb'));var _=require(_0x3740('0xc'));var squel=require('squel');var crypto=require(_0x3740('0xd'));var jsforce=require(_0x3740('0xe'));var deskjs=require(_0x3740('0xf'));var toCsv=require(_0x3740('0x9'));var querystring=require('querystring');var Papa=require(_0x3740('0x10'));var Redis=require('ioredis');var authService=require(_0x3740('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3740('0x12'));var hardwareService=require(_0x3740('0x13'));var logger=require(_0x3740('0x14'))(_0x3740('0x15'));var utils=require(_0x3740('0x16'));var config=require(_0x3740('0x17'));var licenseUtil=require(_0x3740('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43dd7e,_0x6a80ab){_0x6a80ab=_0x6a80ab||0xcc;return function(_0x5128fe){if(_0x5128fe){return _0x43dd7e['sendStatus'](_0x6a80ab);}return _0x43dd7e[_0x3740('0x19')](_0x6a80ab)['end']();};}function respondWithResult(_0x1aa7eb,_0x4ee11e){_0x4ee11e=_0x4ee11e||0xc8;return function(_0x96ac53){if(_0x96ac53){return _0x1aa7eb[_0x3740('0x19')](_0x4ee11e)[_0x3740('0x1a')](_0x96ac53);}};}function respondWithFilteredResult(_0x5a40e3,_0x84400c){return function(_0x506115){if(_0x506115){var _0x40b4da=typeof _0x84400c[_0x3740('0x1b')]===_0x3740('0x1c')&&typeof _0x84400c[_0x3740('0x1d')]===_0x3740('0x1c');var _0x625230=_0x506115[_0x3740('0x1e')];var _0x5adcc4=_0x40b4da?0x0:_0x84400c['offset'];var _0x144f69=_0x40b4da?_0x506115[_0x3740('0x1e')]:_0x84400c['offset']+_0x84400c['limit'];var _0x5743d0;if(_0x144f69>=_0x625230){_0x144f69=_0x625230;_0x5743d0=0xc8;}else{_0x5743d0=0xce;}_0x5a40e3[_0x3740('0x19')](_0x5743d0);return _0x5a40e3[_0x3740('0x1f')](_0x3740('0x20'),_0x5adcc4+'-'+_0x144f69+'/'+_0x625230)[_0x3740('0x1a')](_0x506115);}return null;};}function patchUpdates(_0x5778da){return function(_0x147e22){try{jsonpatch[_0x3740('0x21')](_0x147e22,_0x5778da,!![]);}catch(_0x5dd801){return BPromise[_0x3740('0x22')](_0x5dd801);}return _0x147e22[_0x3740('0x23')]();};}function saveUpdates(_0x3ce865,_0x594df3){return function(_0x65fdd7){if(_0x65fdd7){return _0x65fdd7[_0x3740('0x24')](_0x3ce865)['then'](function(_0x543474){return _0x543474;});}return null;};}function removeEntity(_0x4ac85c,_0x2dbd35){return function(_0x9cee23){if(_0x9cee23){return _0x9cee23[_0x3740('0x25')]()[_0x3740('0x26')](function(){_0x4ac85c[_0x3740('0x19')](0xcc)[_0x3740('0x27')]();});}};}function handleEntityNotFound(_0x1c1872,_0x2de6e7){return function(_0xf2a3d1){if(!_0xf2a3d1){_0x1c1872[_0x3740('0x28')](0x194);}return _0xf2a3d1;};}function handleError(_0x3d3c4b,_0x169699){_0x169699=_0x169699||0x1f4;return function(_0x459f74){logger['error'](_0x459f74[_0x3740('0x29')]);if(_0x459f74[_0x3740('0x2a')]){delete _0x459f74['name'];}_0x3d3c4b['status'](_0x169699)[_0x3740('0x2b')](_0x459f74);};}exports[_0x3740('0x2c')]=function(_0x17812d,_0x386862){var _0x37b96f={},_0x53fefb={},_0x90dd01={'count':0x0,'rows':[]};var _0x14ff28=_[_0x3740('0x2d')](db['FreshsalesField'][_0x3740('0x2e')],function(_0x5a96cf){return{'name':_0x5a96cf[_0x3740('0x2f')],'type':_0x5a96cf['type'][_0x3740('0x30')]};});_0x53fefb[_0x3740('0x31')]=_[_0x3740('0x2d')](_0x14ff28,_0x3740('0x2a'));_0x53fefb[_0x3740('0x32')]=_[_0x3740('0x33')](_0x17812d[_0x3740('0x32')]);_0x53fefb[_0x3740('0x34')]=_[_0x3740('0x35')](_0x53fefb[_0x3740('0x31')],_0x53fefb['query']);_0x37b96f[_0x3740('0x36')]=_[_0x3740('0x35')](_0x53fefb[_0x3740('0x31')],qs[_0x3740('0x37')](_0x17812d[_0x3740('0x32')][_0x3740('0x37')]));_0x37b96f[_0x3740('0x36')]=_0x37b96f[_0x3740('0x36')][_0x3740('0x38')]?_0x37b96f['attributes']:_0x53fefb['model'];if(!_0x17812d[_0x3740('0x32')][_0x3740('0x39')]('nolimit')){_0x37b96f['limit']=qs[_0x3740('0x1d')](_0x17812d[_0x3740('0x32')][_0x3740('0x1d')]);_0x37b96f[_0x3740('0x1b')]=qs['offset'](_0x17812d[_0x3740('0x32')][_0x3740('0x1b')]);}_0x37b96f[_0x3740('0x3a')]=qs[_0x3740('0x3b')](_0x17812d[_0x3740('0x32')][_0x3740('0x3b')]);_0x37b96f[_0x3740('0x3c')]=qs[_0x3740('0x34')](_[_0x3740('0x3d')](_0x17812d['query'],_0x53fefb[_0x3740('0x34')]),_0x14ff28);if(_0x17812d[_0x3740('0x32')]['filter']){_0x37b96f[_0x3740('0x3c')]=_[_0x3740('0x3e')](_0x37b96f[_0x3740('0x3c')],{'$or':_['map'](_0x14ff28,function(_0x3e00c6){if(_0x3e00c6[_0x3740('0x3f')]!==_0x3740('0x40')){var _0x23465e={};_0x23465e[_0x3e00c6['name']]={'$like':'%'+_0x17812d[_0x3740('0x32')][_0x3740('0x41')]+'%'};return _0x23465e;}})});}_0x37b96f=_['merge']({},_0x37b96f,_0x17812d[_0x3740('0x42')]);var _0x5b3653={'where':_0x37b96f[_0x3740('0x3c')]};return db['FreshsalesField'][_0x3740('0x1e')](_0x5b3653)[_0x3740('0x26')](function(_0x464b80){_0x90dd01['count']=_0x464b80;if(_0x17812d[_0x3740('0x32')][_0x3740('0x43')]){_0x37b96f['include']=[{'all':!![]}];}return db[_0x3740('0x44')]['findAll'](_0x37b96f);})['then'](function(_0x1749fa){_0x90dd01[_0x3740('0x45')]=_0x1749fa;return _0x90dd01;})[_0x3740('0x26')](respondWithFilteredResult(_0x386862,_0x37b96f))[_0x3740('0x46')](handleError(_0x386862,null));};exports[_0x3740('0x47')]=function(_0x4ddb02,_0x4f6ce2){var _0x2e8fd9={'raw':!![],'where':{'id':_0x4ddb02['params']['id']}},_0x4ce119={};_0x4ce119[_0x3740('0x31')]=_[_0x3740('0x33')](db[_0x3740('0x44')][_0x3740('0x2e')]);_0x4ce119['query']=_[_0x3740('0x33')](_0x4ddb02[_0x3740('0x32')]);_0x4ce119[_0x3740('0x34')]=_[_0x3740('0x35')](_0x4ce119[_0x3740('0x31')],_0x4ce119[_0x3740('0x32')]);_0x2e8fd9[_0x3740('0x36')]=_[_0x3740('0x35')](_0x4ce119[_0x3740('0x31')],qs[_0x3740('0x37')](_0x4ddb02[_0x3740('0x32')][_0x3740('0x37')]));_0x2e8fd9[_0x3740('0x36')]=_0x2e8fd9[_0x3740('0x36')][_0x3740('0x38')]?_0x2e8fd9[_0x3740('0x36')]:_0x4ce119[_0x3740('0x31')];if(_0x4ddb02[_0x3740('0x32')][_0x3740('0x43')]){_0x2e8fd9[_0x3740('0x48')]=[{'all':!![]}];}_0x2e8fd9=_[_0x3740('0x3e')]({},_0x2e8fd9,_0x4ddb02['options']);return db[_0x3740('0x44')][_0x3740('0x49')](_0x2e8fd9)[_0x3740('0x26')](handleEntityNotFound(_0x4f6ce2,null))[_0x3740('0x26')](respondWithResult(_0x4f6ce2,null))['catch'](handleError(_0x4f6ce2,null));};exports[_0x3740('0x4a')]=function(_0x3581cf,_0x475663){return db['FreshsalesField'][_0x3740('0x4a')](_0x3581cf[_0x3740('0x4b')],{})[_0x3740('0x26')](respondWithResult(_0x475663,0xc9))[_0x3740('0x46')](handleError(_0x475663,null));};exports['update']=function(_0x5a2592,_0x2c6a94){if(_0x5a2592['body']['id']){delete _0x5a2592[_0x3740('0x4b')]['id'];}return db[_0x3740('0x44')]['find']({'where':{'id':_0x5a2592[_0x3740('0x4c')]['id']}})[_0x3740('0x26')](handleEntityNotFound(_0x2c6a94,null))['then'](saveUpdates(_0x5a2592['body'],null))[_0x3740('0x26')](respondWithResult(_0x2c6a94,null))['catch'](handleError(_0x2c6a94,null));};exports[_0x3740('0x25')]=function(_0x1291ad,_0x5ec7e3){return db[_0x3740('0x44')][_0x3740('0x49')]({'where':{'id':_0x1291ad['params']['id']}})[_0x3740('0x26')](handleEntityNotFound(_0x5ec7e3,null))[_0x3740('0x26')](removeEntity(_0x5ec7e3,null))[_0x3740('0x46')](handleError(_0x5ec7e3,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 17bd280..4354234 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 _0x1c3d=['api','moment','bluebird','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','idField','FieldId','util','../../config/logger'];(function(_0x27a49e,_0x1cb0b0){var _0x350480=function(_0x4a60b6){while(--_0x4a60b6){_0x27a49e['push'](_0x27a49e['shift']());}};_0x350480(++_0x1cb0b0);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0xe7d24e,_0x235022){_0xe7d24e=_0xe7d24e-0x0;var _0x42c6e3=_0x1c3d[_0xe7d24e];return _0x42c6e3;};'use strict';var _=require('lodash');var util=require(_0xd1c3('0x0'));var logger=require(_0xd1c3('0x1'))(_0xd1c3('0x2'));var moment=require(_0xd1c3('0x3'));var BPromise=require(_0xd1c3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd1c3('0x5'));var config=require(_0xd1c3('0x6'));var attributes=require(_0xd1c3('0x7'));module[_0xd1c3('0x8')]=function(_0x14093d,_0x391a41){return _0x14093d['define'](_0xd1c3('0x9'),attributes,{'tableName':_0xd1c3('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xd1c3('0xb'),_0xd1c3('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf55c=['moment','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','../../config/logger','api'];(function(_0x4266b4,_0x4859ad){var _0x1442aa=function(_0x21f8c1){while(--_0x21f8c1){_0x4266b4['push'](_0x4266b4['shift']());}};_0x1442aa(++_0x4859ad);}(_0xf55c,0x1e7));var _0xcf55=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xf55c[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0xcf55('0x0'));var util=require('util');var logger=require(_0xcf55('0x1'))(_0xcf55('0x2'));var moment=require(_0xcf55('0x3'));var BPromise=require(_0xcf55('0x4'));var rp=require(_0xcf55('0x5'));var fs=require('fs');var path=require(_0xcf55('0x6'));var rimraf=require(_0xcf55('0x7'));var config=require('../../config/environment');var attributes=require(_0xcf55('0x8'));module[_0xcf55('0x9')]=function(_0x14574c,_0x3a6de7){return _0x14574c['define'](_0xcf55('0xa'),attributes,{'tableName':_0xcf55('0xb'),'paranoid':![],'indexes':[{'name':_0xcf55('0xc'),'fields':[_0xcf55('0xd'),'FieldId'],'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 2ac5d00..47286c7 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 _0xe3da=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s'];(function(_0x10ba7f,_0x4519f3){var _0x5e55ea=function(_0x4c7953){while(--_0x4c7953){_0x10ba7f['push'](_0x10ba7f['shift']());}};_0x5e55ea(++_0x4519f3);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});} \ No newline at end of file +var _0xafc4=['error','code','message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3e7998,_0x39b0fa){var _0x3c361e=function(_0x2ef996){while(--_0x2ef996){_0x3e7998['push'](_0x3e7998['shift']());}};_0x3c361e(++_0x39b0fa);}(_0xafc4,0x69));var _0x4afc=function(_0x1d4486,_0x28a64b){_0x1d4486=_0x1d4486-0x0;var _0x2fbaa9=_0xafc4[_0x1d4486];return _0x2fbaa9;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bb281,_0xc828d9,_0xaf053d){return new BPromise(function(_0x5e1e29,_0x31e165){return client[_0x4afc('0x9')](_0x1bb281,_0xaf053d)[_0x4afc('0xa')](function(_0x1e6bf5){logger[_0x4afc('0xb')](_0x4afc('0xc'),_0xc828d9,'request\x20sent');logger['debug'](_0x4afc('0xd'),_0xc828d9,'request\x20sent',JSON[_0x4afc('0xe')](_0x1e6bf5));if(_0x1e6bf5[_0x4afc('0xf')]){if(_0x1e6bf5['error'][_0x4afc('0x10')]===0x1f4){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x31e165(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}logger[_0x4afc('0xf')]('FreshsalesField,\x20%s,\x20%s',_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x5e1e29(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0xc828d9,_0x4afc('0x12'));_0x5e1e29(_0x1e6bf5['result'][_0x4afc('0x11')]);}})[_0x4afc('0x13')](function(_0x2b928b){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x2b928b);_0x31e165(_0x2b928b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index f55d440..7e0474b 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(_0x499c31,_0x3ead9e){var _0x237677=function(_0x1d0927){while(--_0x1d0927){_0x499c31['push'](_0x499c31['shift']());}};_0x237677(++_0x3ead9e);}(_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 +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(_0x394643,_0x344d16){var _0x2565ef=function(_0x59ea47){while(--_0x59ea47){_0x394643['push'](_0x394643['shift']());}};_0x2565ef(++_0x344d16);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index c1f8e01..e327ec0 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 _0x5cc3=['integrationTab','newTab','sequelize','exports','STRING','username','ENUM'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5cc3,0x144));var _0x35cc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5cc3[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x35cc('0x0'));module[_0x35cc('0x1')]={'name':{'type':Sequelize[_0x35cc('0x2')]},'description':{'type':Sequelize[_0x35cc('0x2')]},'username':{'type':Sequelize[_0x35cc('0x2')],'unique':_0x35cc('0x3')},'remoteUri':{'type':Sequelize[_0x35cc('0x2')]},'password':{'type':Sequelize[_0x35cc('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x35cc('0x2')]},'serverUrl':{'type':Sequelize[_0x35cc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x35cc('0x4')](_0x35cc('0x5'),_0x35cc('0x6')),'defaultValue':_0x35cc('0x5')}}; \ No newline at end of file +var _0x97ce=['newTab','sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x3baefa,_0x479d76){var _0x328407=function(_0x3edb67){while(--_0x3edb67){_0x3baefa['push'](_0x3baefa['shift']());}};_0x328407(++_0x479d76);}(_0x97ce,0x151));var _0xe97c=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x97ce[_0x1c8c28];return _0x1f59b4;};'use strict';var Sequelize=require(_0xe97c('0x0'));module[_0xe97c('0x1')]={'name':{'type':Sequelize[_0xe97c('0x2')]},'description':{'type':Sequelize[_0xe97c('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xe97c('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe97c('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xe97c('0x2')]},'securityToken':{'type':Sequelize[_0xe97c('0x2')]},'serverUrl':{'type':Sequelize[_0xe97c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe97c('0x4')](_0xe97c('0x5'),_0xe97c('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 14439fe..53d85b9 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 _0xf87a=['show','params','filters','find','body','getConfigurations','findOne','SalesforceConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','SalesforceField','getFields','Task','clientId','clientSecret','password','securityToken','remoteUri','substring','lastIndexOf','login','username','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','boolean','email','phone','remove','includes','custom','picklistValues','label','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf87a,0x1be));var _0xaf87=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf87a[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xaf87('0x0'));var rimraf=require(_0xaf87('0x1'));var zipdir=require(_0xaf87('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf87('0x3'));var moment=require(_0xaf87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaf87('0x5'));var util=require(_0xaf87('0x6'));var path=require(_0xaf87('0x7'));var sox=require(_0xaf87('0x8'));var csv=require('to-csv');var ejs=require(_0xaf87('0x9'));var fs=require('fs');var fs_extra=require(_0xaf87('0xa'));var _=require(_0xaf87('0xb'));var squel=require(_0xaf87('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaf87('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaf87('0xe'));var Redis=require(_0xaf87('0xf'));var authService=require(_0xaf87('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xaf87('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf87('0x12'))(_0xaf87('0x13'));var utils=require('../../config/utils');var config=require(_0xaf87('0x14'));var licenseUtil=require(_0xaf87('0x15'));var db=require(_0xaf87('0x16'))['db'];var integrations=require(_0xaf87('0x17'));function respondWithStatusCode(_0xf99ba3,_0x1d6261){_0x1d6261=_0x1d6261||0xcc;return function(_0xbe3cc1){if(_0xbe3cc1){return _0xf99ba3['sendStatus'](_0x1d6261);}return _0xf99ba3[_0xaf87('0x18')](_0x1d6261)[_0xaf87('0x19')]();};}function respondWithResult(_0x1a506d,_0x57825c){_0x57825c=_0x57825c||0xc8;return function(_0x404c59){if(_0x404c59){return _0x1a506d['status'](_0x57825c)[_0xaf87('0x1a')](_0x404c59);}};}function respondWithFilteredResult(_0x4a1def,_0x14a5b8){return function(_0x56e235){if(_0x56e235){var _0x79da5a=typeof _0x14a5b8[_0xaf87('0x1b')]===_0xaf87('0x1c')&&typeof _0x14a5b8[_0xaf87('0x1d')]===_0xaf87('0x1c');var _0x45d80a=_0x56e235[_0xaf87('0x1e')];var _0x1a88f0=_0x79da5a?0x0:_0x14a5b8[_0xaf87('0x1b')];var _0x175f9a=_0x79da5a?_0x56e235[_0xaf87('0x1e')]:_0x14a5b8[_0xaf87('0x1b')]+_0x14a5b8[_0xaf87('0x1d')];var _0x3aa6ec;if(_0x175f9a>=_0x45d80a){_0x175f9a=_0x45d80a;_0x3aa6ec=0xc8;}else{_0x3aa6ec=0xce;}_0x4a1def[_0xaf87('0x18')](_0x3aa6ec);return _0x4a1def[_0xaf87('0x1f')](_0xaf87('0x20'),_0x1a88f0+'-'+_0x175f9a+'/'+_0x45d80a)['json'](_0x56e235);}return null;};}function patchUpdates(_0xedb665){return function(_0x5d1649){try{jsonpatch['apply'](_0x5d1649,_0xedb665,!![]);}catch(_0x3634f9){return BPromise['reject'](_0x3634f9);}return _0x5d1649[_0xaf87('0x21')]();};}function saveUpdates(_0x367b66,_0x4201ab){return function(_0x231828){if(_0x231828){return _0x231828[_0xaf87('0x22')](_0x367b66)[_0xaf87('0x23')](function(_0x4d16c9){return _0x4d16c9;});}return null;};}function removeEntity(_0x13c0d9,_0x1bbd55){return function(_0x564b04){if(_0x564b04){return _0x564b04[_0xaf87('0x24')]()['then'](function(){_0x13c0d9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x57a718,_0x4daf91){return function(_0x1291cf){if(!_0x1291cf){_0x57a718[_0xaf87('0x25')](0x194);}return _0x1291cf;};}function handleError(_0x5f45bc,_0x3eec9a){_0x3eec9a=_0x3eec9a||0x1f4;return function(_0x5ab03b){logger[_0xaf87('0x26')](_0x5ab03b[_0xaf87('0x27')]);if(_0x5ab03b['name']){delete _0x5ab03b[_0xaf87('0x28')];}_0x5f45bc[_0xaf87('0x18')](_0x3eec9a)[_0xaf87('0x29')](_0x5ab03b);};}exports[_0xaf87('0x2a')]=function(_0x41fc32,_0x35be4d){var _0x25c030={},_0x412c58={},_0x51e9ea={'count':0x0,'rows':[]};var _0x2a7b86=_['map'](db[_0xaf87('0x2b')][_0xaf87('0x2c')],function(_0x4af729){return{'name':_0x4af729[_0xaf87('0x2d')],'type':_0x4af729['type'][_0xaf87('0x2e')]};});_0x412c58[_0xaf87('0x2f')]=_[_0xaf87('0x30')](_0x2a7b86,_0xaf87('0x28'));_0x412c58[_0xaf87('0x31')]=_[_0xaf87('0x32')](_0x41fc32[_0xaf87('0x31')]);_0x412c58['filters']=_[_0xaf87('0x33')](_0x412c58['model'],_0x412c58['query']);_0x25c030[_0xaf87('0x34')]=_[_0xaf87('0x33')](_0x412c58[_0xaf87('0x2f')],qs[_0xaf87('0x35')](_0x41fc32[_0xaf87('0x31')][_0xaf87('0x35')]));_0x25c030['attributes']=_0x25c030[_0xaf87('0x34')][_0xaf87('0x36')]?_0x25c030[_0xaf87('0x34')]:_0x412c58[_0xaf87('0x2f')];if(!_0x41fc32[_0xaf87('0x31')][_0xaf87('0x37')]('nolimit')){_0x25c030['limit']=qs[_0xaf87('0x1d')](_0x41fc32[_0xaf87('0x31')][_0xaf87('0x1d')]);_0x25c030[_0xaf87('0x1b')]=qs[_0xaf87('0x1b')](_0x41fc32[_0xaf87('0x31')]['offset']);}_0x25c030[_0xaf87('0x38')]=qs[_0xaf87('0x39')](_0x41fc32[_0xaf87('0x31')][_0xaf87('0x39')]);_0x25c030[_0xaf87('0x3a')]=qs['filters'](_[_0xaf87('0x3b')](_0x41fc32[_0xaf87('0x31')],_0x412c58['filters']),_0x2a7b86);if(_0x41fc32[_0xaf87('0x31')][_0xaf87('0x3c')]){_0x25c030[_0xaf87('0x3a')]=_[_0xaf87('0x3d')](_0x25c030['where'],{'$or':_[_0xaf87('0x30')](_0x2a7b86,function(_0xfa91fd){if(_0xfa91fd[_0xaf87('0x3e')]!==_0xaf87('0x3f')){var _0x4cec5a={};_0x4cec5a[_0xfa91fd[_0xaf87('0x28')]]={'$like':'%'+_0x41fc32['query'][_0xaf87('0x3c')]+'%'};return _0x4cec5a;}})});}_0x25c030=_[_0xaf87('0x3d')]({},_0x25c030,_0x41fc32[_0xaf87('0x40')]);var _0x1fcd06={'where':_0x25c030[_0xaf87('0x3a')]};return db[_0xaf87('0x2b')]['count'](_0x1fcd06)[_0xaf87('0x23')](function(_0x13f508){_0x51e9ea['count']=_0x13f508;if(_0x41fc32[_0xaf87('0x31')][_0xaf87('0x41')]){_0x25c030[_0xaf87('0x42')]=[{'all':!![]}];}return db[_0xaf87('0x2b')][_0xaf87('0x43')](_0x25c030);})['then'](function(_0x38f96e){_0x51e9ea[_0xaf87('0x44')]=_0x38f96e;return _0x51e9ea;})[_0xaf87('0x23')](respondWithFilteredResult(_0x35be4d,_0x25c030))[_0xaf87('0x45')](handleError(_0x35be4d,null));};exports[_0xaf87('0x46')]=function(_0x482c97,_0x10e489){var _0x1617af={'raw':![],'where':{'id':_0x482c97[_0xaf87('0x47')]['id']}},_0x3b02ad={};_0x3b02ad[_0xaf87('0x2f')]=_[_0xaf87('0x32')](db[_0xaf87('0x2b')][_0xaf87('0x2c')]);_0x3b02ad['query']=_[_0xaf87('0x32')](_0x482c97['query']);_0x3b02ad[_0xaf87('0x48')]=_[_0xaf87('0x33')](_0x3b02ad[_0xaf87('0x2f')],_0x3b02ad[_0xaf87('0x31')]);_0x1617af[_0xaf87('0x34')]=_[_0xaf87('0x33')](_0x3b02ad['model'],qs[_0xaf87('0x35')](_0x482c97[_0xaf87('0x31')][_0xaf87('0x35')]));_0x1617af[_0xaf87('0x34')]=_0x1617af[_0xaf87('0x34')][_0xaf87('0x36')]?_0x1617af[_0xaf87('0x34')]:_0x3b02ad[_0xaf87('0x2f')];if(_0x482c97[_0xaf87('0x31')][_0xaf87('0x41')]){_0x1617af[_0xaf87('0x42')]=[{'all':!![]}];}_0x1617af=_[_0xaf87('0x3d')]({},_0x1617af,_0x482c97[_0xaf87('0x40')]);return db[_0xaf87('0x2b')][_0xaf87('0x49')](_0x1617af)[_0xaf87('0x23')](handleEntityNotFound(_0x10e489,null))[_0xaf87('0x23')](respondWithResult(_0x10e489,null))[_0xaf87('0x45')](handleError(_0x10e489,null));};exports['create']=function(_0x58ae59,_0x4a1eea){return db[_0xaf87('0x2b')]['create'](_0x58ae59['body'],{})[_0xaf87('0x23')](respondWithResult(_0x4a1eea,0xc9))['catch'](handleError(_0x4a1eea,null));};exports[_0xaf87('0x22')]=function(_0x3a7e66,_0x427400){if(_0x3a7e66[_0xaf87('0x4a')]['id']){delete _0x3a7e66[_0xaf87('0x4a')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x3a7e66[_0xaf87('0x47')]['id']}})[_0xaf87('0x23')](handleEntityNotFound(_0x427400,null))['then'](saveUpdates(_0x3a7e66[_0xaf87('0x4a')],null))[_0xaf87('0x23')](respondWithResult(_0x427400,null))[_0xaf87('0x45')](handleError(_0x427400,null));};exports[_0xaf87('0x24')]=function(_0x573962,_0x14c6d5){return db[_0xaf87('0x2b')][_0xaf87('0x49')]({'where':{'id':_0x573962[_0xaf87('0x47')]['id']}})[_0xaf87('0x23')](handleEntityNotFound(_0x14c6d5,null))['then'](removeEntity(_0x14c6d5,null))[_0xaf87('0x45')](handleError(_0x14c6d5,null));};exports[_0xaf87('0x4b')]=function(_0xde2df9,_0x15dcd4,_0x184fc3){var _0x187b39={};var _0x146d56={};var _0x25d253;var _0x4238e5;return db[_0xaf87('0x2b')][_0xaf87('0x4c')]({'where':{'id':_0xde2df9[_0xaf87('0x47')]['id']}})[_0xaf87('0x23')](handleEntityNotFound(_0x15dcd4,null))[_0xaf87('0x23')](function(_0x421948){if(_0x421948){_0x25d253=_0x421948;_0x146d56[_0xaf87('0x2f')]=_[_0xaf87('0x32')](db[_0xaf87('0x4d')]['rawAttributes']);_0x146d56[_0xaf87('0x31')]=_[_0xaf87('0x32')](_0xde2df9[_0xaf87('0x31')]);_0x146d56[_0xaf87('0x48')]=_['intersection'](_0x146d56[_0xaf87('0x2f')],_0x146d56[_0xaf87('0x31')]);_0x187b39[_0xaf87('0x34')]=_['intersection'](_0x146d56[_0xaf87('0x2f')],qs[_0xaf87('0x35')](_0xde2df9['query'][_0xaf87('0x35')]));_0x187b39['attributes']=_0x187b39['attributes']['length']?_0x187b39['attributes']:_0x146d56[_0xaf87('0x2f')];_0x187b39[_0xaf87('0x38')]=qs['sort'](_0xde2df9[_0xaf87('0x31')][_0xaf87('0x39')]);_0x187b39[_0xaf87('0x3a')]=qs['filters'](_[_0xaf87('0x3b')](_0xde2df9[_0xaf87('0x31')],_0x146d56['filters']));if(_0xde2df9['query'][_0xaf87('0x3c')]){_0x187b39[_0xaf87('0x3a')]=_[_0xaf87('0x3d')](_0x187b39['where'],{'$or':_['map'](_0x187b39['attributes'],function(_0x1bf72a){var _0x1106db={};_0x1106db[_0x1bf72a]={'$like':'%'+_0xde2df9[_0xaf87('0x31')][_0xaf87('0x3c')]+'%'};return _0x1106db;})});}_0x187b39=_['merge']({},_0x187b39,_0xde2df9[_0xaf87('0x40')]);return _0x25d253['getConfigurations'](_0x187b39);}})['then'](function(_0x471436){if(_0x471436){_0x4238e5=_0x471436[_0xaf87('0x36')];if(!_0xde2df9['query'][_0xaf87('0x37')](_0xaf87('0x4e'))){_0x187b39['limit']=qs[_0xaf87('0x1d')](_0xde2df9['query']['limit']);_0x187b39['offset']=qs[_0xaf87('0x1b')](_0xde2df9[_0xaf87('0x31')][_0xaf87('0x1b')]);}return _0x25d253['getConfigurations'](_0x187b39);}})['then'](function(_0x1ff0bb){if(_0x1ff0bb){return _0x1ff0bb?{'count':_0x4238e5,'rows':_0x1ff0bb}:null;}})[_0xaf87('0x23')](respondWithResult(_0x15dcd4,null))[_0xaf87('0x45')](handleError(_0x15dcd4,null));};exports[_0xaf87('0x4f')]=function(_0xbd1b0f,_0x1dab03,_0x270e48){if(_0xbd1b0f['body']['id']){delete _0xbd1b0f[_0xaf87('0x4a')]['id'];}return db[_0xaf87('0x2b')][_0xaf87('0x4c')]({'where':{'id':_0xbd1b0f[_0xaf87('0x47')]['id']}})[_0xaf87('0x23')](handleEntityNotFound(_0x1dab03,null))[_0xaf87('0x23')](function(_0x4bcc95){if(_0x4bcc95){_0xbd1b0f[_0xaf87('0x4a')][_0xaf87('0x50')]=_0x4bcc95['id'];_0xbd1b0f['body'][_0xaf87('0x51')]=integrations[_0xaf87('0x52')](_0xbd1b0f['body']['channel'],_0xbd1b0f[_0xaf87('0x4a')]['type']);_0xbd1b0f[_0xaf87('0x4a')][_0xaf87('0x53')]=integrations[_0xaf87('0x54')](_0xbd1b0f[_0xaf87('0x4a')][_0xaf87('0x55')],_0xbd1b0f['body'][_0xaf87('0x3e')]);return db['SalesforceConfiguration'][_0xaf87('0x56')](_0xbd1b0f['body'],{'include':[{'model':db['SalesforceField'],'as':_0xaf87('0x51')},{'model':db[_0xaf87('0x57')],'as':_0xaf87('0x53')}]});}return null;})['then'](respondWithResult(_0x1dab03,null))[_0xaf87('0x45')](handleError(_0x1dab03,null));};exports[_0xaf87('0x58')]=function(_0x421fb5,_0x452ed8,_0x477690){var _0x1abb9c;var _0x16e205='';var _0x2bf15e=_0xaf87('0x59');return db['SalesforceAccount'][_0xaf87('0x4c')]({'where':{'id':_0x421fb5[_0xaf87('0x47')]['id']},'attributes':['id','remoteUri',_0xaf87('0x5a'),_0xaf87('0x5b'),'username',_0xaf87('0x5c'),_0xaf87('0x5d')]})[_0xaf87('0x23')](handleEntityNotFound(_0x452ed8,null))[_0xaf87('0x23')](function(_0x25989e){if(_0x25989e){_0x16e205=_0x25989e[_0xaf87('0x5e')];var _0xde5495=_0x16e205['slice'](-0x1);if(_0xde5495==='/'){_0x16e205=_0x16e205[_0xaf87('0x5f')](0x0,_0x16e205[_0xaf87('0x60')](_0xde5495));}_0x1abb9c=new jsforce['Connection']({'oauth2':{'loginUrl':_0x16e205,'clientId':_0x25989e[_0xaf87('0x5a')],'clientSecret':_0x25989e['clientSecret']}});return _0x1abb9c[_0xaf87('0x61')](_0x25989e[_0xaf87('0x62')],_0x25989e['password'][_0xaf87('0x63')](_0x25989e[_0xaf87('0x5d')]));}})['then'](function(_0x5ef974){if(_0x5ef974){if(!_['isNil'](_0x421fb5[_0xaf87('0x31')][_0xaf87('0x64')])){_0x2bf15e=_0x421fb5[_0xaf87('0x31')][_0xaf87('0x64')];}return _0x1abb9c[_0xaf87('0x65')](_0x2bf15e)[_0xaf87('0x66')]();}})[_0xaf87('0x23')](function(_0x508584){var _0x5a4606=[_0xaf87('0x67'),_0xaf87('0x68'),_0xaf87('0x69'),_0xaf87('0x6a'),_0xaf87('0x6b'),_0xaf87('0x6c')];var _0x403b01=['string',_0xaf87('0x6d'),_0xaf87('0x6e'),_0xaf87('0x6f'),_0xaf87('0x70'),'textarea',_0xaf87('0x71')];if(_0x508584){_[_0xaf87('0x72')](_0x508584[_0xaf87('0x35')],function(_0x39d6ac){return _0x5a4606[_0xaf87('0x73')](_0x39d6ac['name'])||!_0x403b01[_0xaf87('0x73')](_0x39d6ac[_0xaf87('0x3e')]);});return{'count':_0x508584[_0xaf87('0x35')]['length'],'rows':_[_0xaf87('0x30')](_0x508584[_0xaf87('0x35')],function(_0x5c9740){return{'id':_0x5c9740[_0xaf87('0x28')],'name':_0x5c9740['label'],'custom':_0x5c9740[_0xaf87('0x74')],'options':_0x5c9740[_0xaf87('0x75')]['length']>0x0?_[_0xaf87('0x30')](_0x5c9740[_0xaf87('0x75')],function(_0x2340b5){return{'name':_0x2340b5[_0xaf87('0x76')],'value':_0x2340b5[_0xaf87('0x77')]};}):_0x5c9740['type']==_0xaf87('0x6f')?[{'name':_0xaf87('0x78'),'value':_0xaf87('0x79')},{'name':_0xaf87('0x7a'),'value':_0xaf87('0x7b')}]:[]};})};}})[_0xaf87('0x23')](respondWithResult(_0x452ed8,null))['catch'](function(_0x109d14){var _0x4cd77f=_0x421fb5[_0xaf87('0x31')][_0xaf87('0x7c')]?0x1f4:_0x109d14[_0xaf87('0x7d')]||0x1f4;logger[_0xaf87('0x26')](_0xaf87('0x7e'),_0xaf87('0x58'),_0x4cd77f,JSON[_0xaf87('0x7f')](_0x109d14));delete _0x109d14[_0xaf87('0x28')];if(_0x4cd77f===0x191){_0x4cd77f=0x190;}_0x452ed8[_0xaf87('0x18')](_0x4cd77f)[_0xaf87('0x29')](_0x421fb5[_0xaf87('0x31')][_0xaf87('0x7c')]?{'message':_0xaf87('0x80'),'statusCode':_0x109d14[_0xaf87('0x7d')]}:_0x109d14);});}; \ No newline at end of file +var _0xe685=['securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','describe','OwnerId','IsReminderSet','string','int','picklist','textarea','phone','remove','includes','picklistValues','label','value','boolean','True','true','False','false','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','sendStatus','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','SalesforceAccount','includeAll','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','AccountId','Subjects','Descriptions','getDescriptions','channel','SalesforceConfiguration','SalesforceField','getFields','Task','clientId','clientSecret','username','password'];(function(_0x1cd342,_0x8bd1d7){var _0x215f8a=function(_0x2c73a3){while(--_0x2c73a3){_0x1cd342['push'](_0x1cd342['shift']());}};_0x215f8a(++_0x8bd1d7);}(_0xe685,0x115));var _0x5e68=function(_0x576d2e,_0x30a997){_0x576d2e=_0x576d2e-0x0;var _0x516186=_0xe685[_0x576d2e];return _0x516186;};'use strict';var emlformat=require(_0x5e68('0x0'));var rimraf=require(_0x5e68('0x1'));var zipdir=require(_0x5e68('0x2'));var jsonpatch=require(_0x5e68('0x3'));var rp=require(_0x5e68('0x4'));var moment=require(_0x5e68('0x5'));var BPromise=require(_0x5e68('0x6'));var Mustache=require('mustache');var util=require(_0x5e68('0x7'));var path=require(_0x5e68('0x8'));var sox=require(_0x5e68('0x9'));var csv=require(_0x5e68('0xa'));var ejs=require(_0x5e68('0xb'));var fs=require('fs');var fs_extra=require(_0x5e68('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e68('0xd'));var jsforce=require(_0x5e68('0xe'));var deskjs=require(_0x5e68('0xf'));var toCsv=require(_0x5e68('0xa'));var querystring=require(_0x5e68('0x10'));var Papa=require(_0x5e68('0x11'));var Redis=require(_0x5e68('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5e68('0x13'));var as=require(_0x5e68('0x14'));var hardwareService=require(_0x5e68('0x15'));var logger=require('../../config/logger')(_0x5e68('0x16'));var utils=require(_0x5e68('0x17'));var config=require(_0x5e68('0x18'));var licenseUtil=require(_0x5e68('0x19'));var db=require(_0x5e68('0x1a'))['db'];var integrations=require(_0x5e68('0x1b'));function respondWithStatusCode(_0x5dc1eb,_0x3926f2){_0x3926f2=_0x3926f2||0xcc;return function(_0x295f54){if(_0x295f54){return _0x5dc1eb['sendStatus'](_0x3926f2);}return _0x5dc1eb[_0x5e68('0x1c')](_0x3926f2)[_0x5e68('0x1d')]();};}function respondWithResult(_0x28a555,_0x34ffed){_0x34ffed=_0x34ffed||0xc8;return function(_0x5ac20a){if(_0x5ac20a){return _0x28a555[_0x5e68('0x1c')](_0x34ffed)['json'](_0x5ac20a);}};}function respondWithFilteredResult(_0x257e91,_0xbc709a){return function(_0xd6313d){if(_0xd6313d){var _0x49ffb0=typeof _0xbc709a[_0x5e68('0x1e')]===_0x5e68('0x1f')&&typeof _0xbc709a[_0x5e68('0x20')]===_0x5e68('0x1f');var _0x1edca6=_0xd6313d[_0x5e68('0x21')];var _0x367c43=_0x49ffb0?0x0:_0xbc709a['offset'];var _0x529d6d=_0x49ffb0?_0xd6313d[_0x5e68('0x21')]:_0xbc709a[_0x5e68('0x1e')]+_0xbc709a['limit'];var _0x49f9cf;if(_0x529d6d>=_0x1edca6){_0x529d6d=_0x1edca6;_0x49f9cf=0xc8;}else{_0x49f9cf=0xce;}_0x257e91['status'](_0x49f9cf);return _0x257e91['set'](_0x5e68('0x22'),_0x367c43+'-'+_0x529d6d+'/'+_0x1edca6)[_0x5e68('0x23')](_0xd6313d);}return null;};}function patchUpdates(_0x42695c){return function(_0x43dba7){try{jsonpatch[_0x5e68('0x24')](_0x43dba7,_0x42695c,!![]);}catch(_0x4d80e2){return BPromise['reject'](_0x4d80e2);}return _0x43dba7[_0x5e68('0x25')]();};}function saveUpdates(_0x1b6eb0,_0x1b56c1){return function(_0x5195b6){if(_0x5195b6){return _0x5195b6[_0x5e68('0x26')](_0x1b6eb0)[_0x5e68('0x27')](function(_0x1fb737){return _0x1fb737;});}return null;};}function removeEntity(_0x2ac261,_0x38410e){return function(_0x3a41dc){if(_0x3a41dc){return _0x3a41dc['destroy']()[_0x5e68('0x27')](function(){_0x2ac261[_0x5e68('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c44aa,_0x213fbd){return function(_0x3317d3){if(!_0x3317d3){_0x5c44aa[_0x5e68('0x28')](0x194);}return _0x3317d3;};}function handleError(_0xf6cb80,_0x10d0cd){_0x10d0cd=_0x10d0cd||0x1f4;return function(_0x1afee1){logger[_0x5e68('0x29')](_0x1afee1[_0x5e68('0x2a')]);if(_0x1afee1['name']){delete _0x1afee1[_0x5e68('0x2b')];}_0xf6cb80[_0x5e68('0x1c')](_0x10d0cd)[_0x5e68('0x2c')](_0x1afee1);};}exports['index']=function(_0x28023c,_0x492b55){var _0x6c3e50={},_0x4e7bd8={},_0x493b56={'count':0x0,'rows':[]};var _0x482c98=_[_0x5e68('0x2d')](db['SalesforceAccount'][_0x5e68('0x2e')],function(_0x2b5b5e){return{'name':_0x2b5b5e['fieldName'],'type':_0x2b5b5e[_0x5e68('0x2f')][_0x5e68('0x30')]};});_0x4e7bd8[_0x5e68('0x31')]=_[_0x5e68('0x2d')](_0x482c98,'name');_0x4e7bd8[_0x5e68('0x32')]=_[_0x5e68('0x33')](_0x28023c[_0x5e68('0x32')]);_0x4e7bd8[_0x5e68('0x34')]=_[_0x5e68('0x35')](_0x4e7bd8[_0x5e68('0x31')],_0x4e7bd8[_0x5e68('0x32')]);_0x6c3e50[_0x5e68('0x36')]=_[_0x5e68('0x35')](_0x4e7bd8[_0x5e68('0x31')],qs['fields'](_0x28023c['query'][_0x5e68('0x37')]));_0x6c3e50['attributes']=_0x6c3e50[_0x5e68('0x36')][_0x5e68('0x38')]?_0x6c3e50[_0x5e68('0x36')]:_0x4e7bd8['model'];if(!_0x28023c[_0x5e68('0x32')]['hasOwnProperty'](_0x5e68('0x39'))){_0x6c3e50[_0x5e68('0x20')]=qs[_0x5e68('0x20')](_0x28023c[_0x5e68('0x32')][_0x5e68('0x20')]);_0x6c3e50[_0x5e68('0x1e')]=qs[_0x5e68('0x1e')](_0x28023c[_0x5e68('0x32')][_0x5e68('0x1e')]);}_0x6c3e50[_0x5e68('0x3a')]=qs[_0x5e68('0x3b')](_0x28023c[_0x5e68('0x32')][_0x5e68('0x3b')]);_0x6c3e50['where']=qs[_0x5e68('0x34')](_[_0x5e68('0x3c')](_0x28023c[_0x5e68('0x32')],_0x4e7bd8[_0x5e68('0x34')]),_0x482c98);if(_0x28023c[_0x5e68('0x32')][_0x5e68('0x3d')]){_0x6c3e50[_0x5e68('0x3e')]=_[_0x5e68('0x3f')](_0x6c3e50['where'],{'$or':_[_0x5e68('0x2d')](_0x482c98,function(_0x406d68){if(_0x406d68[_0x5e68('0x2f')]!==_0x5e68('0x40')){var _0x545236={};_0x545236[_0x406d68['name']]={'$like':'%'+_0x28023c[_0x5e68('0x32')][_0x5e68('0x3d')]+'%'};return _0x545236;}})});}_0x6c3e50=_['merge']({},_0x6c3e50,_0x28023c[_0x5e68('0x41')]);var _0x12dbad={'where':_0x6c3e50[_0x5e68('0x3e')]};return db[_0x5e68('0x42')][_0x5e68('0x21')](_0x12dbad)[_0x5e68('0x27')](function(_0xb55a55){_0x493b56[_0x5e68('0x21')]=_0xb55a55;if(_0x28023c['query'][_0x5e68('0x43')]){_0x6c3e50['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0x5e68('0x44')](_0x6c3e50);})['then'](function(_0x31e054){_0x493b56[_0x5e68('0x45')]=_0x31e054;return _0x493b56;})[_0x5e68('0x27')](respondWithFilteredResult(_0x492b55,_0x6c3e50))[_0x5e68('0x46')](handleError(_0x492b55,null));};exports[_0x5e68('0x47')]=function(_0x4550df,_0x577987){var _0x2f0ac2={'raw':![],'where':{'id':_0x4550df[_0x5e68('0x48')]['id']}},_0x30b270={};_0x30b270[_0x5e68('0x31')]=_['keys'](db['SalesforceAccount'][_0x5e68('0x2e')]);_0x30b270[_0x5e68('0x32')]=_[_0x5e68('0x33')](_0x4550df[_0x5e68('0x32')]);_0x30b270[_0x5e68('0x34')]=_[_0x5e68('0x35')](_0x30b270[_0x5e68('0x31')],_0x30b270['query']);_0x2f0ac2[_0x5e68('0x36')]=_[_0x5e68('0x35')](_0x30b270[_0x5e68('0x31')],qs['fields'](_0x4550df['query'][_0x5e68('0x37')]));_0x2f0ac2[_0x5e68('0x36')]=_0x2f0ac2[_0x5e68('0x36')][_0x5e68('0x38')]?_0x2f0ac2[_0x5e68('0x36')]:_0x30b270['model'];if(_0x4550df['query'][_0x5e68('0x43')]){_0x2f0ac2['include']=[{'all':!![]}];}_0x2f0ac2=_[_0x5e68('0x3f')]({},_0x2f0ac2,_0x4550df[_0x5e68('0x41')]);return db[_0x5e68('0x42')][_0x5e68('0x49')](_0x2f0ac2)['then'](handleEntityNotFound(_0x577987,null))[_0x5e68('0x27')](respondWithResult(_0x577987,null))[_0x5e68('0x46')](handleError(_0x577987,null));};exports[_0x5e68('0x4a')]=function(_0x20a358,_0x72a96a){return db['SalesforceAccount'][_0x5e68('0x4a')](_0x20a358[_0x5e68('0x4b')],{})[_0x5e68('0x27')](respondWithResult(_0x72a96a,0xc9))['catch'](handleError(_0x72a96a,null));};exports[_0x5e68('0x26')]=function(_0x14bcc1,_0x2cfd32){if(_0x14bcc1[_0x5e68('0x4b')]['id']){delete _0x14bcc1['body']['id'];}return db[_0x5e68('0x42')][_0x5e68('0x49')]({'where':{'id':_0x14bcc1[_0x5e68('0x48')]['id']}})['then'](handleEntityNotFound(_0x2cfd32,null))[_0x5e68('0x27')](saveUpdates(_0x14bcc1['body'],null))[_0x5e68('0x27')](respondWithResult(_0x2cfd32,null))[_0x5e68('0x46')](handleError(_0x2cfd32,null));};exports[_0x5e68('0x4c')]=function(_0x42d7ce,_0xba0c0b){return db[_0x5e68('0x42')][_0x5e68('0x49')]({'where':{'id':_0x42d7ce[_0x5e68('0x48')]['id']}})[_0x5e68('0x27')](handleEntityNotFound(_0xba0c0b,null))[_0x5e68('0x27')](removeEntity(_0xba0c0b,null))[_0x5e68('0x46')](handleError(_0xba0c0b,null));};exports[_0x5e68('0x4d')]=function(_0xdbd100,_0x5d8540,_0x1e108a){var _0xd3bd8a={};var _0x582dfb={};var _0x275730;var _0x5892ed;return db[_0x5e68('0x42')][_0x5e68('0x4e')]({'where':{'id':_0xdbd100['params']['id']}})[_0x5e68('0x27')](handleEntityNotFound(_0x5d8540,null))['then'](function(_0x3ebd32){if(_0x3ebd32){_0x275730=_0x3ebd32;_0x582dfb[_0x5e68('0x31')]=_[_0x5e68('0x33')](db['SalesforceConfiguration'][_0x5e68('0x2e')]);_0x582dfb[_0x5e68('0x32')]=_[_0x5e68('0x33')](_0xdbd100[_0x5e68('0x32')]);_0x582dfb[_0x5e68('0x34')]=_[_0x5e68('0x35')](_0x582dfb['model'],_0x582dfb[_0x5e68('0x32')]);_0xd3bd8a[_0x5e68('0x36')]=_[_0x5e68('0x35')](_0x582dfb[_0x5e68('0x31')],qs[_0x5e68('0x37')](_0xdbd100[_0x5e68('0x32')][_0x5e68('0x37')]));_0xd3bd8a['attributes']=_0xd3bd8a[_0x5e68('0x36')][_0x5e68('0x38')]?_0xd3bd8a['attributes']:_0x582dfb[_0x5e68('0x31')];_0xd3bd8a[_0x5e68('0x3a')]=qs['sort'](_0xdbd100[_0x5e68('0x32')][_0x5e68('0x3b')]);_0xd3bd8a[_0x5e68('0x3e')]=qs[_0x5e68('0x34')](_[_0x5e68('0x3c')](_0xdbd100[_0x5e68('0x32')],_0x582dfb[_0x5e68('0x34')]));if(_0xdbd100[_0x5e68('0x32')][_0x5e68('0x3d')]){_0xd3bd8a[_0x5e68('0x3e')]=_['merge'](_0xd3bd8a[_0x5e68('0x3e')],{'$or':_[_0x5e68('0x2d')](_0xd3bd8a[_0x5e68('0x36')],function(_0x5792f1){var _0x1e6cdb={};_0x1e6cdb[_0x5792f1]={'$like':'%'+_0xdbd100['query']['filter']+'%'};return _0x1e6cdb;})});}_0xd3bd8a=_[_0x5e68('0x3f')]({},_0xd3bd8a,_0xdbd100['options']);return _0x275730[_0x5e68('0x4d')](_0xd3bd8a);}})['then'](function(_0x534d83){if(_0x534d83){_0x5892ed=_0x534d83['length'];if(!_0xdbd100[_0x5e68('0x32')]['hasOwnProperty'](_0x5e68('0x39'))){_0xd3bd8a[_0x5e68('0x20')]=qs[_0x5e68('0x20')](_0xdbd100['query']['limit']);_0xd3bd8a[_0x5e68('0x1e')]=qs['offset'](_0xdbd100[_0x5e68('0x32')][_0x5e68('0x1e')]);}return _0x275730[_0x5e68('0x4d')](_0xd3bd8a);}})[_0x5e68('0x27')](function(_0x1a72a4){if(_0x1a72a4){return _0x1a72a4?{'count':_0x5892ed,'rows':_0x1a72a4}:null;}})['then'](respondWithResult(_0x5d8540,null))[_0x5e68('0x46')](handleError(_0x5d8540,null));};exports['addConfiguration']=function(_0x113752,_0x2fdd35,_0x152aba){if(_0x113752['body']['id']){delete _0x113752[_0x5e68('0x4b')]['id'];}return db[_0x5e68('0x42')][_0x5e68('0x4e')]({'where':{'id':_0x113752[_0x5e68('0x48')]['id']}})[_0x5e68('0x27')](handleEntityNotFound(_0x2fdd35,null))[_0x5e68('0x27')](function(_0x474660){if(_0x474660){_0x113752['body'][_0x5e68('0x4f')]=_0x474660['id'];_0x113752[_0x5e68('0x4b')][_0x5e68('0x50')]=integrations['getSubjects'](_0x113752[_0x5e68('0x4b')]['channel'],_0x113752[_0x5e68('0x4b')]['type']);_0x113752[_0x5e68('0x4b')][_0x5e68('0x51')]=integrations[_0x5e68('0x52')](_0x113752[_0x5e68('0x4b')][_0x5e68('0x53')],_0x113752[_0x5e68('0x4b')][_0x5e68('0x2f')]);return db[_0x5e68('0x54')][_0x5e68('0x4a')](_0x113752['body'],{'include':[{'model':db[_0x5e68('0x55')],'as':_0x5e68('0x50')},{'model':db[_0x5e68('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2fdd35,null))[_0x5e68('0x46')](handleError(_0x2fdd35,null));};exports[_0x5e68('0x56')]=function(_0x1c9c30,_0x5b6cbd,_0x33576d){var _0x1be6ef;var _0x376e40='';var _0x133e72=_0x5e68('0x57');return db[_0x5e68('0x42')]['findOne']({'where':{'id':_0x1c9c30[_0x5e68('0x48')]['id']},'attributes':['id','remoteUri',_0x5e68('0x58'),_0x5e68('0x59'),_0x5e68('0x5a'),_0x5e68('0x5b'),_0x5e68('0x5c')]})[_0x5e68('0x27')](handleEntityNotFound(_0x5b6cbd,null))[_0x5e68('0x27')](function(_0x156182){if(_0x156182){_0x376e40=_0x156182['remoteUri'];var _0x33276b=_0x376e40[_0x5e68('0x5d')](-0x1);if(_0x33276b==='/'){_0x376e40=_0x376e40[_0x5e68('0x5e')](0x0,_0x376e40[_0x5e68('0x5f')](_0x33276b));}_0x1be6ef=new jsforce[(_0x5e68('0x60'))]({'oauth2':{'loginUrl':_0x376e40,'clientId':_0x156182[_0x5e68('0x58')],'clientSecret':_0x156182[_0x5e68('0x59')]}});return _0x1be6ef[_0x5e68('0x61')](_0x156182[_0x5e68('0x5a')],_0x156182['password'][_0x5e68('0x62')](_0x156182[_0x5e68('0x5c')]));}})[_0x5e68('0x27')](function(_0x44d501){if(_0x44d501){if(!_[_0x5e68('0x63')](_0x1c9c30[_0x5e68('0x32')]['ticketType'])){_0x133e72=_0x1c9c30[_0x5e68('0x32')][_0x5e68('0x64')];}return _0x1be6ef['sobject'](_0x133e72)[_0x5e68('0x65')]();}})['then'](function(_0x345315){var _0x514a56=[_0x5e68('0x66'),'ActivityDate',_0x5e68('0x67'),'IsRecurrence','Subject','Description'];var _0x3c2e71=[_0x5e68('0x68'),_0x5e68('0x69'),_0x5e68('0x6a'),'boolean','email',_0x5e68('0x6b'),_0x5e68('0x6c')];if(_0x345315){_[_0x5e68('0x6d')](_0x345315[_0x5e68('0x37')],function(_0x4d9989){return _0x514a56[_0x5e68('0x6e')](_0x4d9989[_0x5e68('0x2b')])||!_0x3c2e71[_0x5e68('0x6e')](_0x4d9989['type']);});return{'count':_0x345315['fields'][_0x5e68('0x38')],'rows':_[_0x5e68('0x2d')](_0x345315[_0x5e68('0x37')],function(_0x125308){return{'id':_0x125308['name'],'name':_0x125308['label'],'custom':_0x125308['custom'],'options':_0x125308[_0x5e68('0x6f')][_0x5e68('0x38')]>0x0?_[_0x5e68('0x2d')](_0x125308[_0x5e68('0x6f')],function(_0x34108d){return{'name':_0x34108d[_0x5e68('0x70')],'value':_0x34108d[_0x5e68('0x71')]};}):_0x125308[_0x5e68('0x2f')]==_0x5e68('0x72')?[{'name':_0x5e68('0x73'),'value':_0x5e68('0x74')},{'name':_0x5e68('0x75'),'value':_0x5e68('0x76')}]:[]};})};}})['then'](respondWithResult(_0x5b6cbd,null))[_0x5e68('0x46')](function(_0x30ec00){var _0x5b6609=_0x1c9c30[_0x5e68('0x32')]['test']?0x1f4:_0x30ec00[_0x5e68('0x77')]||0x1f4;logger[_0x5e68('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0x5e68('0x56'),_0x5b6609,JSON[_0x5e68('0x78')](_0x30ec00));delete _0x30ec00['name'];if(_0x5b6609===0x191){_0x5b6609=0x190;}_0x5b6cbd[_0x5e68('0x1c')](_0x5b6609)['send'](_0x1c9c30[_0x5e68('0x32')][_0x5e68('0x79')]?{'message':_0x5e68('0x7a'),'statusCode':_0x30ec00[_0x5e68('0x77')]}:_0x30ec00);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 24e572a..c52c286 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 _0x3b02=['api','moment','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger'];(function(_0x430228,_0x11206a){var _0x4e19aa=function(_0x1d01b2){while(--_0x1d01b2){_0x430228['push'](_0x430228['shift']());}};_0x4e19aa(++_0x11206a);}(_0x3b02,0x1d2));var _0x23b0=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x3b02[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x23b0('0x0'));var util=require('util');var logger=require(_0x23b0('0x1'))(_0x23b0('0x2'));var moment=require(_0x23b0('0x3'));var BPromise=require(_0x23b0('0x4'));var rp=require(_0x23b0('0x5'));var fs=require('fs');var path=require(_0x23b0('0x6'));var rimraf=require(_0x23b0('0x7'));var config=require('../../config/environment');var attributes=require(_0x23b0('0x8'));var integrations=require(_0x23b0('0x9'));module[_0x23b0('0xa')]=function(_0x2b06ac,_0x460155){return _0x2b06ac['define'](_0x23b0('0xb'),attributes,{'tableName':_0x23b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cc1=['define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x13e807,_0x921d42){var _0x254a67=function(_0x31b361){while(--_0x31b361){_0x13e807['push'](_0x13e807['shift']());}};_0x254a67(++_0x921d42);}(_0x2cc1,0x1bd));var _0x12cc=function(_0x208749,_0x2b7b66){_0x208749=_0x208749-0x0;var _0x3e0042=_0x2cc1[_0x208749];return _0x3e0042;};'use strict';var _=require(_0x12cc('0x0'));var util=require(_0x12cc('0x1'));var logger=require(_0x12cc('0x2'))(_0x12cc('0x3'));var moment=require(_0x12cc('0x4'));var BPromise=require(_0x12cc('0x5'));var rp=require(_0x12cc('0x6'));var fs=require('fs');var path=require(_0x12cc('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x12cc('0x8'));var integrations=require(_0x12cc('0x9'));module['exports']=function(_0x496867,_0x3dee73){return _0x496867[_0x12cc('0xa')](_0x12cc('0xb'),attributes,{'tableName':_0x12cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 6d28282..4fc3d89 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 _0xa6f8=['catch','ShowSalesforceAccount','find','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','debug','request\x20sent','error','code','SalesforceAccount,\x20%s,\x20%s','message','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','info'];(function(_0x263558,_0x2cd536){var _0x53f63f=function(_0x30fdf1){while(--_0x30fdf1){_0x263558['push'](_0x263558['shift']());}};_0x53f63f(++_0x2cd536);}(_0xa6f8,0x94));var _0x8a6f=function(_0x2446ef,_0x5b42d5){_0x2446ef=_0x2446ef-0x0;var _0x53e0a9=_0xa6f8[_0x2446ef];return _0x53e0a9;};'use strict';var _=require(_0x8a6f('0x0'));var util=require('util');var moment=require(_0x8a6f('0x1'));var BPromise=require(_0x8a6f('0x2'));var rs=require(_0x8a6f('0x3'));var fs=require('fs');var Redis=require(_0x8a6f('0x4'));var db=require(_0x8a6f('0x5'))['db'];var utils=require(_0x8a6f('0x6'));var logger=require(_0x8a6f('0x7'))(_0x8a6f('0x8'));var config=require(_0x8a6f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8a6f('0xa')][_0x8a6f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25915f,_0x482f58,_0x7dcd55){return new BPromise(function(_0x3f035c,_0x1a4577){return client[_0x8a6f('0xc')](_0x25915f,_0x7dcd55)[_0x8a6f('0xd')](function(_0x32a38b){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x482f58,'request\x20sent');logger[_0x8a6f('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x482f58,_0x8a6f('0xf'),JSON['stringify'](_0x32a38b));if(_0x32a38b[_0x8a6f('0x10')]){if(_0x32a38b['error'][_0x8a6f('0x11')]===0x1f4){logger['error'](_0x8a6f('0x12'),_0x482f58,_0x32a38b[_0x8a6f('0x10')][_0x8a6f('0x13')]);return _0x1a4577(_0x32a38b['error'][_0x8a6f('0x13')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x482f58,_0x32a38b[_0x8a6f('0x10')]['message']);return _0x3f035c(_0x32a38b[_0x8a6f('0x10')][_0x8a6f('0x13')]);}else{logger['info'](_0x8a6f('0x12'),_0x482f58,_0x8a6f('0xf'));_0x3f035c(_0x32a38b['result']['message']);}})['catch'](function(_0x47a614){logger[_0x8a6f('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x482f58,_0x47a614);_0x1a4577(_0x47a614);});});}exports[_0x8a6f('0x14')]=function(_0x3f7760){var _0x368bd6=this;return new Promise(function(_0x4ec3fb,_0x333907){return db[_0x8a6f('0x15')][_0x8a6f('0x16')]({'raw':_0x3f7760[_0x8a6f('0x17')]?_0x3f7760[_0x8a6f('0x17')][_0x8a6f('0x18')]===undefined?!![]:![]:!![],'where':_0x3f7760['options']?_0x3f7760['options'][_0x8a6f('0x19')]||null:null,'attributes':_0x3f7760['options']?_0x3f7760[_0x8a6f('0x17')][_0x8a6f('0x1a')]||null:null,'limit':_0x3f7760[_0x8a6f('0x17')]?_0x3f7760[_0x8a6f('0x17')][_0x8a6f('0x1b')]||null:null,'include':_0x3f7760[_0x8a6f('0x17')]?_0x3f7760['options'][_0x8a6f('0x1c')]?_[_0x8a6f('0x1d')](_0x3f7760[_0x8a6f('0x17')][_0x8a6f('0x1c')],function(_0xf124b2){return{'model':db[_0xf124b2[_0x8a6f('0x1e')]],'as':_0xf124b2['as'],'attributes':_0xf124b2['attributes'],'include':_0xf124b2[_0x8a6f('0x1c')]?_[_0x8a6f('0x1d')](_0xf124b2[_0x8a6f('0x1c')],function(_0x245007){return{'model':db[_0x245007[_0x8a6f('0x1e')]],'as':_0x245007['as'],'attributes':_0x245007[_0x8a6f('0x1a')],'include':_0x245007[_0x8a6f('0x1c')]?_[_0x8a6f('0x1d')](_0x245007['include'],function(_0x3ac959){return{'model':db[_0x3ac959[_0x8a6f('0x1e')]],'as':_0x3ac959['as'],'attributes':_0x3ac959[_0x8a6f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b591a){logger[_0x8a6f('0x1f')](_0x8a6f('0x14'),_0x3f7760);logger[_0x8a6f('0xe')](_0x8a6f('0x14'),_0x3f7760,JSON['stringify'](_0x3b591a));_0x4ec3fb(_0x3b591a);})[_0x8a6f('0x20')](function(_0x5b87b4){logger[_0x8a6f('0x10')](_0x8a6f('0x14'),_0x5b87b4[_0x8a6f('0x13')],_0x3f7760);_0x333907(_0x368bd6[_0x8a6f('0x10')](0x1f4,_0x5b87b4[_0x8a6f('0x13')]));});});};exports[_0x8a6f('0x21')]=function(_0x348516){var _0x404faa=this;return new Promise(function(_0x4b4464,_0x19070c){return db[_0x8a6f('0x15')][_0x8a6f('0x22')]({'raw':_0x348516[_0x8a6f('0x17')]?_0x348516[_0x8a6f('0x17')][_0x8a6f('0x18')]===undefined?!![]:![]:!![],'where':_0x348516[_0x8a6f('0x17')]?_0x348516[_0x8a6f('0x17')][_0x8a6f('0x19')]||null:null,'attributes':_0x348516[_0x8a6f('0x17')]?_0x348516[_0x8a6f('0x17')][_0x8a6f('0x1a')]||null:null,'include':_0x348516['options']?_0x348516[_0x8a6f('0x17')][_0x8a6f('0x1c')]?_[_0x8a6f('0x1d')](_0x348516[_0x8a6f('0x17')][_0x8a6f('0x1c')],function(_0x213947){return{'model':db[_0x213947[_0x8a6f('0x1e')]],'as':_0x213947['as'],'attributes':_0x213947[_0x8a6f('0x1a')],'include':_0x213947[_0x8a6f('0x1c')]?_[_0x8a6f('0x1d')](_0x213947[_0x8a6f('0x1c')],function(_0x4cd4f6){return{'model':db[_0x4cd4f6[_0x8a6f('0x1e')]],'as':_0x4cd4f6['as'],'attributes':_0x4cd4f6[_0x8a6f('0x1a')],'include':_0x4cd4f6['include']?_[_0x8a6f('0x1d')](_0x4cd4f6[_0x8a6f('0x1c')],function(_0x52118f){return{'model':db[_0x52118f[_0x8a6f('0x1e')]],'as':_0x52118f['as'],'attributes':_0x52118f[_0x8a6f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8a6f('0xd')](function(_0x5d3648){logger[_0x8a6f('0x1f')](_0x8a6f('0x21'),_0x348516);logger['debug'](_0x8a6f('0x21'),_0x348516,JSON[_0x8a6f('0x23')](_0x5d3648));_0x4b4464(_0x5d3648);})[_0x8a6f('0x20')](function(_0x112e9c){logger['error'](_0x8a6f('0x21'),_0x112e9c[_0x8a6f('0x13')],_0x348516);_0x19070c(_0x404faa[_0x8a6f('0x10')](0x1f4,_0x112e9c[_0x8a6f('0x13')]));});});}; \ No newline at end of file +var _0x970d=['SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','find','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info'];(function(_0x30b3ef,_0x10467b){var _0x4df9c4=function(_0x1896c3){while(--_0x1896c3){_0x30b3ef['push'](_0x30b3ef['shift']());}};_0x4df9c4(++_0x10467b);}(_0x970d,0xfd));var _0xd970=function(_0x32c8ed,_0x45fef2){_0x32c8ed=_0x32c8ed-0x0;var _0x580764=_0x970d[_0x32c8ed];return _0x580764;};'use strict';var _=require(_0xd970('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd970('0x1'));var rs=require(_0xd970('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd970('0x3'))['db'];var utils=require(_0xd970('0x4'));var logger=require('../../config/logger')(_0xd970('0x5'));var config=require('../../config/environment');var jayson=require(_0xd970('0x6'));var client=jayson[_0xd970('0x7')][_0xd970('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12b088,_0x2c2c69,_0x3fdd98){return new BPromise(function(_0x35a58d,_0x53d5ee){return client['request'](_0x12b088,_0x3fdd98)[_0xd970('0x9')](function(_0x36d0b7){logger[_0xd970('0xa')](_0xd970('0xb'),_0x2c2c69,'request\x20sent');logger[_0xd970('0xc')](_0xd970('0xd'),_0x2c2c69,_0xd970('0xe'),JSON['stringify'](_0x36d0b7));if(_0x36d0b7['error']){if(_0x36d0b7[_0xd970('0xf')]['code']===0x1f4){logger[_0xd970('0xf')](_0xd970('0xb'),_0x2c2c69,_0x36d0b7[_0xd970('0xf')]['message']);return _0x53d5ee(_0x36d0b7[_0xd970('0xf')][_0xd970('0x10')]);}logger[_0xd970('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x2c2c69,_0x36d0b7[_0xd970('0xf')]['message']);return _0x35a58d(_0x36d0b7[_0xd970('0xf')][_0xd970('0x10')]);}else{logger['info'](_0xd970('0xb'),_0x2c2c69,'request\x20sent');_0x35a58d(_0x36d0b7[_0xd970('0x11')]['message']);}})[_0xd970('0x12')](function(_0x58793a){logger[_0xd970('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x2c2c69,_0x58793a);_0x53d5ee(_0x58793a);});});}exports[_0xd970('0x13')]=function(_0x2e59ce){var _0x149660=this;return new Promise(function(_0x175568,_0xf862f6){return db[_0xd970('0x14')][_0xd970('0x15')]({'raw':_0x2e59ce[_0xd970('0x16')]?_0x2e59ce[_0xd970('0x16')][_0xd970('0x17')]===undefined?!![]:![]:!![],'where':_0x2e59ce[_0xd970('0x16')]?_0x2e59ce[_0xd970('0x16')][_0xd970('0x18')]||null:null,'attributes':_0x2e59ce[_0xd970('0x16')]?_0x2e59ce[_0xd970('0x16')][_0xd970('0x19')]||null:null,'limit':_0x2e59ce[_0xd970('0x16')]?_0x2e59ce[_0xd970('0x16')][_0xd970('0x1a')]||null:null,'include':_0x2e59ce[_0xd970('0x16')]?_0x2e59ce['options'][_0xd970('0x1b')]?_[_0xd970('0x1c')](_0x2e59ce[_0xd970('0x16')]['include'],function(_0x1c0e5e){return{'model':db[_0x1c0e5e[_0xd970('0x1d')]],'as':_0x1c0e5e['as'],'attributes':_0x1c0e5e['attributes'],'include':_0x1c0e5e['include']?_[_0xd970('0x1c')](_0x1c0e5e[_0xd970('0x1b')],function(_0x5c1648){return{'model':db[_0x5c1648['model']],'as':_0x5c1648['as'],'attributes':_0x5c1648[_0xd970('0x19')],'include':_0x5c1648['include']?_[_0xd970('0x1c')](_0x5c1648[_0xd970('0x1b')],function(_0x3b86e7){return{'model':db[_0x3b86e7[_0xd970('0x1d')]],'as':_0x3b86e7['as'],'attributes':_0x3b86e7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x310291){logger[_0xd970('0xa')]('GetSalesforceAccount',_0x2e59ce);logger[_0xd970('0xc')](_0xd970('0x13'),_0x2e59ce,JSON['stringify'](_0x310291));_0x175568(_0x310291);})[_0xd970('0x12')](function(_0x44a472){logger[_0xd970('0xf')](_0xd970('0x13'),_0x44a472['message'],_0x2e59ce);_0xf862f6(_0x149660['error'](0x1f4,_0x44a472[_0xd970('0x10')]));});});};exports[_0xd970('0x1e')]=function(_0x1dc768){var _0x155e9c=this;return new Promise(function(_0x5d1b92,_0x234473){return db[_0xd970('0x14')][_0xd970('0x1f')]({'raw':_0x1dc768['options']?_0x1dc768[_0xd970('0x16')][_0xd970('0x17')]===undefined?!![]:![]:!![],'where':_0x1dc768[_0xd970('0x16')]?_0x1dc768[_0xd970('0x16')]['where']||null:null,'attributes':_0x1dc768[_0xd970('0x16')]?_0x1dc768[_0xd970('0x16')][_0xd970('0x19')]||null:null,'include':_0x1dc768['options']?_0x1dc768[_0xd970('0x16')]['include']?_['map'](_0x1dc768['options'][_0xd970('0x1b')],function(_0x1ffb0f){return{'model':db[_0x1ffb0f[_0xd970('0x1d')]],'as':_0x1ffb0f['as'],'attributes':_0x1ffb0f[_0xd970('0x19')],'include':_0x1ffb0f['include']?_[_0xd970('0x1c')](_0x1ffb0f[_0xd970('0x1b')],function(_0x4f0cbd){return{'model':db[_0x4f0cbd[_0xd970('0x1d')]],'as':_0x4f0cbd['as'],'attributes':_0x4f0cbd['attributes'],'include':_0x4f0cbd['include']?_[_0xd970('0x1c')](_0x4f0cbd[_0xd970('0x1b')],function(_0x2dddd6){return{'model':db[_0x2dddd6[_0xd970('0x1d')]],'as':_0x2dddd6['as'],'attributes':_0x2dddd6[_0xd970('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd970('0x9')](function(_0x1181d3){logger[_0xd970('0xa')]('ShowSalesforceAccount',_0x1dc768);logger[_0xd970('0xc')](_0xd970('0x1e'),_0x1dc768,JSON[_0xd970('0x20')](_0x1181d3));_0x5d1b92(_0x1181d3);})['catch'](function(_0x5494ad){logger[_0xd970('0xf')]('ShowSalesforceAccount',_0x5494ad[_0xd970('0x10')],_0x1dc768);_0x234473(_0x155e9c[_0xd970('0xf')](0x1f4,_0x5494ad[_0xd970('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index ea26d29..cf677bb 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4f9d26,_0x641341){_0x4f9d26=_0x4f9d26-0x0;var _0x57debc=_0x0b0e[_0x4f9d26];return _0x57debc;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x259037,_0xa451a6){var _0x2277f9=function(_0x304b21){while(--_0x304b21){_0x259037['push'](_0x259037['shift']());}};_0x2277f9(++_0xa451a6);}(_0x7a54,0x106));var _0x47a5=function(_0x330eb1,_0x534f8e){_0x330eb1=_0x330eb1-0x0;var _0xcb1237=_0x7a54[_0x330eb1];return _0xcb1237;};'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('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 951494c..e31ba73 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 _0xf60b=['ENUM','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING','Task','Case'];(function(_0x41898a,_0x4a3d56){var _0x32124f=function(_0x1faec4){while(--_0x1faec4){_0x41898a['push'](_0x41898a['shift']());}};_0x32124f(++_0x4a3d56);}(_0xf60b,0x17b));var _0xbf60=function(_0xec034,_0x16c358){_0xec034=_0xec034-0x0;var _0x2c5a19=_0xf60b[_0xec034];return _0x2c5a19;};'use strict';var Sequelize=require(_0xbf60('0x0'));module[_0xbf60('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbf60('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xbf60('0x3'),_0xbf60('0x4')),'defaultValue':_0xbf60('0x3')},'moduleSearch':{'type':Sequelize[_0xbf60('0x5')](_0xbf60('0x6'),_0xbf60('0x7'),_0xbf60('0x8'),_0xbf60('0x9'),_0xbf60('0xa')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xbf60('0x5')](_0xbf60('0xb'),'contact',_0xbf60('0x8'),'account'),'defaultValue':_0xbf60('0x8')},'leadId':{'type':Sequelize[_0xbf60('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xbf60('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xbf60('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xbf60('0x2')]}}; \ No newline at end of file +var _0xe7a3=['account','sequelize','exports','STRING','Task','Case','ENUM','contact','account_contact_lead','contact_lead','lead'];(function(_0x4d69a3,_0xf5447){var _0x3aa10c=function(_0x50f64b){while(--_0x50f64b){_0x4d69a3['push'](_0x4d69a3['shift']());}};_0x3aa10c(++_0xf5447);}(_0xe7a3,0x198));var _0x3e7a=function(_0x5eec1d,_0x306902){_0x5eec1d=_0x5eec1d-0x0;var _0x1f6433=_0xe7a3[_0x5eec1d];return _0x1f6433;};'use strict';var Sequelize=require(_0x3e7a('0x0'));module[_0x3e7a('0x1')]={'name':{'type':Sequelize[_0x3e7a('0x2')]},'description':{'type':Sequelize[_0x3e7a('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x3e7a('0x3'),_0x3e7a('0x4')),'defaultValue':_0x3e7a('0x3')},'moduleSearch':{'type':Sequelize[_0x3e7a('0x5')]('contact_lead',_0x3e7a('0x6'),'lead',_0x3e7a('0x7'),'account'),'defaultValue':_0x3e7a('0x8')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0x3e7a('0x6'),_0x3e7a('0x9'),_0x3e7a('0xa')),'defaultValue':_0x3e7a('0x9')},'leadId':{'type':Sequelize[_0x3e7a('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x3e7a('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x3e7a('0x2')]},'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 ee21be5..7affa43 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 _0x2982=['ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','end','stack','name','send','index','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SalesforceConfiguration','includeAll','findAll','catch','rawAttributes','include','create','body','find','params','getFields','findOne','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2982,0x8d));var _0x2298=function(_0x16377f,_0x1aa6da){_0x16377f=_0x16377f-0x0;var _0x4c9878=_0x2982[_0x16377f];return _0x4c9878;};'use strict';var emlformat=require(_0x2298('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2298('0x1'));var jsonpatch=require(_0x2298('0x2'));var rp=require(_0x2298('0x3'));var moment=require(_0x2298('0x4'));var BPromise=require(_0x2298('0x5'));var Mustache=require('mustache');var util=require(_0x2298('0x6'));var path=require(_0x2298('0x7'));var sox=require('sox');var csv=require(_0x2298('0x8'));var ejs=require(_0x2298('0x9'));var fs=require('fs');var fs_extra=require(_0x2298('0xa'));var _=require('lodash');var squel=require(_0x2298('0xb'));var crypto=require(_0x2298('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2298('0xd'));var Papa=require('papaparse');var Redis=require(_0x2298('0xe'));var authService=require(_0x2298('0xf'));var qs=require(_0x2298('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2298('0x11'));var logger=require(_0x2298('0x12'))(_0x2298('0x13'));var utils=require(_0x2298('0x14'));var config=require(_0x2298('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2298('0x16'))['db'];function respondWithStatusCode(_0x444fe9,_0x2adf04){_0x2adf04=_0x2adf04||0xcc;return function(_0x139c9a){if(_0x139c9a){return _0x444fe9[_0x2298('0x17')](_0x2adf04);}return _0x444fe9[_0x2298('0x18')](_0x2adf04)['end']();};}function respondWithResult(_0x2d5e0d,_0x57fcd8){_0x57fcd8=_0x57fcd8||0xc8;return function(_0x47436b){if(_0x47436b){return _0x2d5e0d[_0x2298('0x18')](_0x57fcd8)[_0x2298('0x19')](_0x47436b);}};}function respondWithFilteredResult(_0x569ee5,_0x8208a4){return function(_0x37e120){if(_0x37e120){var _0x46d9dc=typeof _0x8208a4[_0x2298('0x1a')]===_0x2298('0x1b')&&typeof _0x8208a4[_0x2298('0x1c')]===_0x2298('0x1b');var _0x207af9=_0x37e120[_0x2298('0x1d')];var _0x474903=_0x46d9dc?0x0:_0x8208a4[_0x2298('0x1a')];var _0xc9e163=_0x46d9dc?_0x37e120[_0x2298('0x1d')]:_0x8208a4[_0x2298('0x1a')]+_0x8208a4[_0x2298('0x1c')];var _0x4c6484;if(_0xc9e163>=_0x207af9){_0xc9e163=_0x207af9;_0x4c6484=0xc8;}else{_0x4c6484=0xce;}_0x569ee5['status'](_0x4c6484);return _0x569ee5['set'](_0x2298('0x1e'),_0x474903+'-'+_0xc9e163+'/'+_0x207af9)[_0x2298('0x19')](_0x37e120);}return null;};}function patchUpdates(_0x599e9f){return function(_0xc6eb11){try{jsonpatch['apply'](_0xc6eb11,_0x599e9f,!![]);}catch(_0x4e49ba){return BPromise[_0x2298('0x1f')](_0x4e49ba);}return _0xc6eb11[_0x2298('0x20')]();};}function saveUpdates(_0x5cb8e9,_0x30e084){return function(_0x4ddb2e){if(_0x4ddb2e){return _0x4ddb2e[_0x2298('0x21')](_0x5cb8e9)['then'](function(_0x14ffd2){return _0x14ffd2;});}return null;};}function removeEntity(_0x3368d6,_0x1acb8c){return function(_0x355460){if(_0x355460){return _0x355460['destroy']()[_0x2298('0x22')](function(){_0x3368d6[_0x2298('0x18')](0xcc)[_0x2298('0x23')]();});}};}function handleEntityNotFound(_0x36a9a2,_0x258e4f){return function(_0x23527d){if(!_0x23527d){_0x36a9a2[_0x2298('0x17')](0x194);}return _0x23527d;};}function handleError(_0x523f78,_0x3fa24e){_0x3fa24e=_0x3fa24e||0x1f4;return function(_0x331137){logger['error'](_0x331137[_0x2298('0x24')]);if(_0x331137[_0x2298('0x25')]){delete _0x331137[_0x2298('0x25')];}_0x523f78[_0x2298('0x18')](_0x3fa24e)[_0x2298('0x26')](_0x331137);};}exports[_0x2298('0x27')]=function(_0x135947,_0x8f3aff){var _0xbeb77f={},_0x35709c={},_0x1ab40e={'count':0x0,'rows':[]};var _0x2fec89=_['map'](db['SalesforceConfiguration']['rawAttributes'],function(_0xa80495){return{'name':_0xa80495[_0x2298('0x28')],'type':_0xa80495['type'][_0x2298('0x29')]};});_0x35709c[_0x2298('0x2a')]=_[_0x2298('0x2b')](_0x2fec89,'name');_0x35709c[_0x2298('0x2c')]=_[_0x2298('0x2d')](_0x135947[_0x2298('0x2c')]);_0x35709c[_0x2298('0x2e')]=_[_0x2298('0x2f')](_0x35709c[_0x2298('0x2a')],_0x35709c[_0x2298('0x2c')]);_0xbeb77f['attributes']=_['intersection'](_0x35709c[_0x2298('0x2a')],qs[_0x2298('0x30')](_0x135947[_0x2298('0x2c')]['fields']));_0xbeb77f[_0x2298('0x31')]=_0xbeb77f[_0x2298('0x31')][_0x2298('0x32')]?_0xbeb77f['attributes']:_0x35709c[_0x2298('0x2a')];if(!_0x135947[_0x2298('0x2c')][_0x2298('0x33')](_0x2298('0x34'))){_0xbeb77f[_0x2298('0x1c')]=qs[_0x2298('0x1c')](_0x135947['query'][_0x2298('0x1c')]);_0xbeb77f[_0x2298('0x1a')]=qs[_0x2298('0x1a')](_0x135947[_0x2298('0x2c')]['offset']);}_0xbeb77f[_0x2298('0x35')]=qs[_0x2298('0x36')](_0x135947[_0x2298('0x2c')]['sort']);_0xbeb77f[_0x2298('0x37')]=qs[_0x2298('0x2e')](_[_0x2298('0x38')](_0x135947[_0x2298('0x2c')],_0x35709c['filters']),_0x2fec89);if(_0x135947[_0x2298('0x2c')]['filter']){_0xbeb77f[_0x2298('0x37')]=_[_0x2298('0x39')](_0xbeb77f[_0x2298('0x37')],{'$or':_['map'](_0x2fec89,function(_0x59a587){if(_0x59a587['type']!==_0x2298('0x3a')){var _0x14d6e8={};_0x14d6e8[_0x59a587['name']]={'$like':'%'+_0x135947[_0x2298('0x2c')][_0x2298('0x3b')]+'%'};return _0x14d6e8;}})});}_0xbeb77f=_[_0x2298('0x39')]({},_0xbeb77f,_0x135947[_0x2298('0x3c')]);var _0x3f1b1c={'where':_0xbeb77f[_0x2298('0x37')]};return db[_0x2298('0x3d')][_0x2298('0x1d')](_0x3f1b1c)['then'](function(_0x5461a0){_0x1ab40e[_0x2298('0x1d')]=_0x5461a0;if(_0x135947['query'][_0x2298('0x3e')]){_0xbeb77f['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x2298('0x3f')](_0xbeb77f);})[_0x2298('0x22')](function(_0x5a1124){_0x1ab40e['rows']=_0x5a1124;return _0x1ab40e;})[_0x2298('0x22')](respondWithFilteredResult(_0x8f3aff,_0xbeb77f))[_0x2298('0x40')](handleError(_0x8f3aff,null));};exports['show']=function(_0xc3d8f2,_0x56e75a){var _0x3877d4={'raw':![],'where':{'id':_0xc3d8f2['params']['id']}},_0x48c25c={};_0x48c25c['model']=_['keys'](db[_0x2298('0x3d')][_0x2298('0x41')]);_0x48c25c[_0x2298('0x2c')]=_[_0x2298('0x2d')](_0xc3d8f2[_0x2298('0x2c')]);_0x48c25c[_0x2298('0x2e')]=_[_0x2298('0x2f')](_0x48c25c[_0x2298('0x2a')],_0x48c25c[_0x2298('0x2c')]);_0x3877d4[_0x2298('0x31')]=_[_0x2298('0x2f')](_0x48c25c['model'],qs[_0x2298('0x30')](_0xc3d8f2[_0x2298('0x2c')]['fields']));_0x3877d4[_0x2298('0x31')]=_0x3877d4[_0x2298('0x31')]['length']?_0x3877d4['attributes']:_0x48c25c[_0x2298('0x2a')];if(_0xc3d8f2['query'][_0x2298('0x3e')]){_0x3877d4[_0x2298('0x42')]=[{'all':!![]}];}_0x3877d4=_[_0x2298('0x39')]({},_0x3877d4,_0xc3d8f2[_0x2298('0x3c')]);return db[_0x2298('0x3d')]['find'](_0x3877d4)['then'](handleEntityNotFound(_0x56e75a,null))[_0x2298('0x22')](respondWithResult(_0x56e75a,null))[_0x2298('0x40')](handleError(_0x56e75a,null));};exports[_0x2298('0x43')]=function(_0x40de4b,_0x256088){return db[_0x2298('0x3d')]['create'](_0x40de4b[_0x2298('0x44')],{})['then'](respondWithResult(_0x256088,0xc9))[_0x2298('0x40')](handleError(_0x256088,null));};exports[_0x2298('0x21')]=function(_0x2381c7,_0x33543b){if(_0x2381c7[_0x2298('0x44')]['id']){delete _0x2381c7['body']['id'];}return db['SalesforceConfiguration'][_0x2298('0x45')]({'where':{'id':_0x2381c7[_0x2298('0x46')]['id']}})[_0x2298('0x22')](handleEntityNotFound(_0x33543b,null))['then'](saveUpdates(_0x2381c7['body'],null))[_0x2298('0x22')](respondWithResult(_0x33543b,null))[_0x2298('0x40')](handleError(_0x33543b,null));};exports['destroy']=function(_0x430861,_0x29cc53){return db[_0x2298('0x3d')][_0x2298('0x45')]({'where':{'id':_0x430861['params']['id']}})['then'](handleEntityNotFound(_0x29cc53,null))[_0x2298('0x22')](removeEntity(_0x29cc53,null))[_0x2298('0x40')](handleError(_0x29cc53,null));};exports[_0x2298('0x47')]=function(_0x5bd8cf,_0x53abaf,_0x642f6b){var _0x1a3896={};var _0x340a7f={};var _0xcc1301;var _0x373302;return db[_0x2298('0x3d')][_0x2298('0x48')]({'where':{'id':_0x5bd8cf[_0x2298('0x46')]['id']}})[_0x2298('0x22')](handleEntityNotFound(_0x53abaf,null))[_0x2298('0x22')](function(_0x2ff544){if(_0x2ff544){_0xcc1301=_0x2ff544;_0x340a7f[_0x2298('0x2a')]=_[_0x2298('0x2d')](db['SalesforceField'][_0x2298('0x41')]);_0x340a7f['query']=_['keys'](_0x5bd8cf['query']);_0x340a7f[_0x2298('0x2e')]=_[_0x2298('0x2f')](_0x340a7f[_0x2298('0x2a')],_0x340a7f['query']);_0x1a3896['attributes']=_['intersection'](_0x340a7f[_0x2298('0x2a')],qs[_0x2298('0x30')](_0x5bd8cf['query'][_0x2298('0x30')]));_0x1a3896['attributes']=_0x1a3896['attributes'][_0x2298('0x32')]?_0x1a3896['attributes']:_0x340a7f[_0x2298('0x2a')];_0x1a3896[_0x2298('0x35')]=qs[_0x2298('0x36')](_0x5bd8cf['query'][_0x2298('0x36')]);_0x1a3896[_0x2298('0x37')]=qs[_0x2298('0x2e')](_[_0x2298('0x38')](_0x5bd8cf[_0x2298('0x2c')],_0x340a7f[_0x2298('0x2e')]));if(_0x5bd8cf[_0x2298('0x2c')][_0x2298('0x3b')]){_0x1a3896[_0x2298('0x37')]=_[_0x2298('0x39')](_0x1a3896[_0x2298('0x37')],{'$or':_[_0x2298('0x2b')](_0x1a3896[_0x2298('0x31')],function(_0x28cc68){var _0x488710={};_0x488710[_0x28cc68]={'$like':'%'+_0x5bd8cf[_0x2298('0x2c')][_0x2298('0x3b')]+'%'};return _0x488710;})});}_0x1a3896=_[_0x2298('0x39')]({},_0x1a3896,_0x5bd8cf['options']);return _0xcc1301[_0x2298('0x47')](_0x1a3896);}})[_0x2298('0x22')](function(_0x3b26a5){if(_0x3b26a5){_0x373302=_0x3b26a5[_0x2298('0x32')];if(!_0x5bd8cf[_0x2298('0x2c')]['hasOwnProperty'](_0x2298('0x34'))){_0x1a3896[_0x2298('0x1c')]=qs[_0x2298('0x1c')](_0x5bd8cf[_0x2298('0x2c')][_0x2298('0x1c')]);_0x1a3896[_0x2298('0x1a')]=qs[_0x2298('0x1a')](_0x5bd8cf['query'][_0x2298('0x1a')]);}return _0xcc1301[_0x2298('0x47')](_0x1a3896);}})[_0x2298('0x22')](function(_0x5bb4fc){if(_0x5bb4fc){return _0x5bb4fc?{'count':_0x373302,'rows':_0x5bb4fc}:null;}})['then'](respondWithResult(_0x53abaf,null))['catch'](handleError(_0x53abaf,null));};exports[_0x2298('0x49')]=function(_0xc3eea,_0x37c2c2,_0x2e092f){var _0x9951ed={};var _0x10b036={};var _0x409c4a;var _0x593ec0;return db[_0x2298('0x3d')][_0x2298('0x48')]({'where':{'id':_0xc3eea[_0x2298('0x46')]['id']}})[_0x2298('0x22')](handleEntityNotFound(_0x37c2c2,null))['then'](function(_0x34f914){if(_0x34f914){_0x409c4a=_0x34f914;_0x10b036[_0x2298('0x2a')]=_[_0x2298('0x2d')](db['SalesforceField'][_0x2298('0x41')]);_0x10b036['query']=_[_0x2298('0x2d')](_0xc3eea[_0x2298('0x2c')]);_0x10b036[_0x2298('0x2e')]=_[_0x2298('0x2f')](_0x10b036[_0x2298('0x2a')],_0x10b036['query']);_0x9951ed[_0x2298('0x31')]=_['intersection'](_0x10b036[_0x2298('0x2a')],qs['fields'](_0xc3eea['query']['fields']));_0x9951ed[_0x2298('0x31')]=_0x9951ed['attributes'][_0x2298('0x32')]?_0x9951ed[_0x2298('0x31')]:_0x10b036['model'];_0x9951ed[_0x2298('0x35')]=qs[_0x2298('0x36')](_0xc3eea['query']['sort']);_0x9951ed[_0x2298('0x37')]=qs[_0x2298('0x2e')](_['pick'](_0xc3eea[_0x2298('0x2c')],_0x10b036['filters']));if(_0xc3eea[_0x2298('0x2c')]['filter']){_0x9951ed['where']=_[_0x2298('0x39')](_0x9951ed[_0x2298('0x37')],{'$or':_['map'](_0x9951ed['attributes'],function(_0x18fed4){var _0x52ef1b={};_0x52ef1b[_0x18fed4]={'$like':'%'+_0xc3eea['query'][_0x2298('0x3b')]+'%'};return _0x52ef1b;})});}_0x9951ed=_[_0x2298('0x39')]({},_0x9951ed,_0xc3eea[_0x2298('0x3c')]);return _0x409c4a[_0x2298('0x49')](_0x9951ed);}})[_0x2298('0x22')](function(_0x3040de){if(_0x3040de){_0x593ec0=_0x3040de[_0x2298('0x32')];if(!_0xc3eea[_0x2298('0x2c')][_0x2298('0x33')](_0x2298('0x34'))){_0x9951ed[_0x2298('0x1c')]=qs[_0x2298('0x1c')](_0xc3eea[_0x2298('0x2c')][_0x2298('0x1c')]);_0x9951ed['offset']=qs[_0x2298('0x1a')](_0xc3eea[_0x2298('0x2c')][_0x2298('0x1a')]);}return _0x409c4a['getSubjects'](_0x9951ed);}})[_0x2298('0x22')](function(_0x1e785e){if(_0x1e785e){return _0x1e785e?{'count':_0x593ec0,'rows':_0x1e785e}:null;}})[_0x2298('0x22')](respondWithResult(_0x37c2c2,null))[_0x2298('0x40')](handleError(_0x37c2c2,null));};exports[_0x2298('0x4a')]=function(_0x2c29db,_0x2abd41,_0x191511){var _0x1686af={};var _0x2f47d7={};var _0x30f79e;var _0x5862e1;return db[_0x2298('0x3d')][_0x2298('0x48')]({'where':{'id':_0x2c29db['params']['id']}})[_0x2298('0x22')](handleEntityNotFound(_0x2abd41,null))[_0x2298('0x22')](function(_0x1da421){if(_0x1da421){_0x30f79e=_0x1da421;_0x2f47d7[_0x2298('0x2a')]=_[_0x2298('0x2d')](db['SalesforceField']['rawAttributes']);_0x2f47d7[_0x2298('0x2c')]=_[_0x2298('0x2d')](_0x2c29db['query']);_0x2f47d7[_0x2298('0x2e')]=_['intersection'](_0x2f47d7[_0x2298('0x2a')],_0x2f47d7[_0x2298('0x2c')]);_0x1686af['attributes']=_['intersection'](_0x2f47d7[_0x2298('0x2a')],qs[_0x2298('0x30')](_0x2c29db[_0x2298('0x2c')][_0x2298('0x30')]));_0x1686af['attributes']=_0x1686af[_0x2298('0x31')]['length']?_0x1686af['attributes']:_0x2f47d7[_0x2298('0x2a')];_0x1686af[_0x2298('0x35')]=qs[_0x2298('0x36')](_0x2c29db['query']['sort']);_0x1686af[_0x2298('0x37')]=qs[_0x2298('0x2e')](_[_0x2298('0x38')](_0x2c29db[_0x2298('0x2c')],_0x2f47d7[_0x2298('0x2e')]));if(_0x2c29db[_0x2298('0x2c')][_0x2298('0x3b')]){_0x1686af[_0x2298('0x37')]=_[_0x2298('0x39')](_0x1686af['where'],{'$or':_[_0x2298('0x2b')](_0x1686af['attributes'],function(_0x286a7a){var _0x3bafe4={};_0x3bafe4[_0x286a7a]={'$like':'%'+_0x2c29db[_0x2298('0x2c')][_0x2298('0x3b')]+'%'};return _0x3bafe4;})});}_0x1686af=_[_0x2298('0x39')]({},_0x1686af,_0x2c29db[_0x2298('0x3c')]);return _0x30f79e[_0x2298('0x4a')](_0x1686af);}})[_0x2298('0x22')](function(_0x1fed62){if(_0x1fed62){_0x5862e1=_0x1fed62[_0x2298('0x32')];if(!_0x2c29db[_0x2298('0x2c')][_0x2298('0x33')](_0x2298('0x34'))){_0x1686af[_0x2298('0x1c')]=qs[_0x2298('0x1c')](_0x2c29db['query']['limit']);_0x1686af['offset']=qs[_0x2298('0x1a')](_0x2c29db[_0x2298('0x2c')][_0x2298('0x1a')]);}return _0x30f79e[_0x2298('0x4a')](_0x1686af);}})[_0x2298('0x22')](function(_0x969e56){if(_0x969e56){return _0x969e56?{'count':_0x5862e1,'rows':_0x969e56}:null;}})['then'](respondWithResult(_0x2abd41,null))[_0x2298('0x40')](handleError(_0x2abd41,null));}; \ No newline at end of file +var _0xecd9=['sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','model','map','keys','filters','query','fields','hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','params','intersection','attributes','length','find','catch','create','body','getFields','findOne','SalesforceField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x373a31,_0x506e31){var _0x141311=function(_0x51365b){while(--_0x51365b){_0x373a31['push'](_0x373a31['shift']());}};_0x141311(++_0x506e31);}(_0xecd9,0x13f));var _0x9ecd=function(_0x4f7de9,_0x33ffd1){_0x4f7de9=_0x4f7de9-0x0;var _0x85d7e2=_0xecd9[_0x4f7de9];return _0x85d7e2;};'use strict';var emlformat=require(_0x9ecd('0x0'));var rimraf=require(_0x9ecd('0x1'));var zipdir=require(_0x9ecd('0x2'));var jsonpatch=require(_0x9ecd('0x3'));var rp=require(_0x9ecd('0x4'));var moment=require(_0x9ecd('0x5'));var BPromise=require(_0x9ecd('0x6'));var Mustache=require(_0x9ecd('0x7'));var util=require('util');var path=require(_0x9ecd('0x8'));var sox=require(_0x9ecd('0x9'));var csv=require(_0x9ecd('0xa'));var ejs=require(_0x9ecd('0xb'));var fs=require('fs');var fs_extra=require(_0x9ecd('0xc'));var _=require('lodash');var squel=require(_0x9ecd('0xd'));var crypto=require(_0x9ecd('0xe'));var jsforce=require(_0x9ecd('0xf'));var deskjs=require(_0x9ecd('0x10'));var toCsv=require(_0x9ecd('0xa'));var querystring=require(_0x9ecd('0x11'));var Papa=require(_0x9ecd('0x12'));var Redis=require(_0x9ecd('0x13'));var authService=require(_0x9ecd('0x14'));var qs=require(_0x9ecd('0x15'));var as=require(_0x9ecd('0x16'));var hardwareService=require(_0x9ecd('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x9ecd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9ecd('0x19'));var db=require(_0x9ecd('0x1a'))['db'];function respondWithStatusCode(_0x1b4c13,_0x113e2b){_0x113e2b=_0x113e2b||0xcc;return function(_0x4ed277){if(_0x4ed277){return _0x1b4c13[_0x9ecd('0x1b')](_0x113e2b);}return _0x1b4c13[_0x9ecd('0x1c')](_0x113e2b)[_0x9ecd('0x1d')]();};}function respondWithResult(_0x24270c,_0x4f2ef4){_0x4f2ef4=_0x4f2ef4||0xc8;return function(_0x294067){if(_0x294067){return _0x24270c[_0x9ecd('0x1c')](_0x4f2ef4)[_0x9ecd('0x1e')](_0x294067);}};}function respondWithFilteredResult(_0x54a721,_0x3e8ce1){return function(_0xa2f35c){if(_0xa2f35c){var _0xb23770=typeof _0x3e8ce1[_0x9ecd('0x1f')]===_0x9ecd('0x20')&&typeof _0x3e8ce1['limit']===_0x9ecd('0x20');var _0x13c029=_0xa2f35c[_0x9ecd('0x21')];var _0x1e8c92=_0xb23770?0x0:_0x3e8ce1[_0x9ecd('0x1f')];var _0x2d2220=_0xb23770?_0xa2f35c[_0x9ecd('0x21')]:_0x3e8ce1[_0x9ecd('0x1f')]+_0x3e8ce1[_0x9ecd('0x22')];var _0x168287;if(_0x2d2220>=_0x13c029){_0x2d2220=_0x13c029;_0x168287=0xc8;}else{_0x168287=0xce;}_0x54a721[_0x9ecd('0x1c')](_0x168287);return _0x54a721[_0x9ecd('0x23')]('Content-Range',_0x1e8c92+'-'+_0x2d2220+'/'+_0x13c029)[_0x9ecd('0x1e')](_0xa2f35c);}return null;};}function patchUpdates(_0x188965){return function(_0x5a864e){try{jsonpatch[_0x9ecd('0x24')](_0x5a864e,_0x188965,!![]);}catch(_0x17d184){return BPromise[_0x9ecd('0x25')](_0x17d184);}return _0x5a864e['save']();};}function saveUpdates(_0x1b8dbc,_0x425490){return function(_0x1074f4){if(_0x1074f4){return _0x1074f4[_0x9ecd('0x26')](_0x1b8dbc)[_0x9ecd('0x27')](function(_0x3f6bbc){return _0x3f6bbc;});}return null;};}function removeEntity(_0x2485cf,_0x284341){return function(_0x575ec4){if(_0x575ec4){return _0x575ec4[_0x9ecd('0x28')]()[_0x9ecd('0x27')](function(){_0x2485cf['status'](0xcc)[_0x9ecd('0x1d')]();});}};}function handleEntityNotFound(_0x28e541,_0x6d44cf){return function(_0x35ab14){if(!_0x35ab14){_0x28e541['sendStatus'](0x194);}return _0x35ab14;};}function handleError(_0x1522ab,_0x52be78){_0x52be78=_0x52be78||0x1f4;return function(_0x54d9ae){logger[_0x9ecd('0x29')](_0x54d9ae[_0x9ecd('0x2a')]);if(_0x54d9ae[_0x9ecd('0x2b')]){delete _0x54d9ae[_0x9ecd('0x2b')];}_0x1522ab[_0x9ecd('0x1c')](_0x52be78)[_0x9ecd('0x2c')](_0x54d9ae);};}exports[_0x9ecd('0x2d')]=function(_0x2de3b1,_0x207bd0){var _0x5b7e6d={},_0x1d96f9={},_0x5a9308={'count':0x0,'rows':[]};var _0x33b293=_['map'](db[_0x9ecd('0x2e')][_0x9ecd('0x2f')],function(_0x1aef6e){return{'name':_0x1aef6e[_0x9ecd('0x30')],'type':_0x1aef6e['type']['key']};});_0x1d96f9[_0x9ecd('0x31')]=_[_0x9ecd('0x32')](_0x33b293,_0x9ecd('0x2b'));_0x1d96f9['query']=_[_0x9ecd('0x33')](_0x2de3b1['query']);_0x1d96f9[_0x9ecd('0x34')]=_['intersection'](_0x1d96f9[_0x9ecd('0x31')],_0x1d96f9[_0x9ecd('0x35')]);_0x5b7e6d['attributes']=_['intersection'](_0x1d96f9[_0x9ecd('0x31')],qs['fields'](_0x2de3b1[_0x9ecd('0x35')][_0x9ecd('0x36')]));_0x5b7e6d['attributes']=_0x5b7e6d['attributes']['length']?_0x5b7e6d['attributes']:_0x1d96f9[_0x9ecd('0x31')];if(!_0x2de3b1[_0x9ecd('0x35')][_0x9ecd('0x37')]('nolimit')){_0x5b7e6d[_0x9ecd('0x22')]=qs['limit'](_0x2de3b1[_0x9ecd('0x35')][_0x9ecd('0x22')]);_0x5b7e6d[_0x9ecd('0x1f')]=qs[_0x9ecd('0x1f')](_0x2de3b1[_0x9ecd('0x35')][_0x9ecd('0x1f')]);}_0x5b7e6d[_0x9ecd('0x38')]=qs['sort'](_0x2de3b1['query'][_0x9ecd('0x39')]);_0x5b7e6d['where']=qs[_0x9ecd('0x34')](_[_0x9ecd('0x3a')](_0x2de3b1[_0x9ecd('0x35')],_0x1d96f9[_0x9ecd('0x34')]),_0x33b293);if(_0x2de3b1[_0x9ecd('0x35')]['filter']){_0x5b7e6d[_0x9ecd('0x3b')]=_[_0x9ecd('0x3c')](_0x5b7e6d[_0x9ecd('0x3b')],{'$or':_[_0x9ecd('0x32')](_0x33b293,function(_0x13a2b6){if(_0x13a2b6[_0x9ecd('0x3d')]!==_0x9ecd('0x3e')){var _0x298df1={};_0x298df1[_0x13a2b6[_0x9ecd('0x2b')]]={'$like':'%'+_0x2de3b1['query'][_0x9ecd('0x3f')]+'%'};return _0x298df1;}})});}_0x5b7e6d=_[_0x9ecd('0x3c')]({},_0x5b7e6d,_0x2de3b1[_0x9ecd('0x40')]);var _0x567c05={'where':_0x5b7e6d[_0x9ecd('0x3b')]};return db[_0x9ecd('0x2e')][_0x9ecd('0x21')](_0x567c05)[_0x9ecd('0x27')](function(_0x5686cf){_0x5a9308[_0x9ecd('0x21')]=_0x5686cf;if(_0x2de3b1[_0x9ecd('0x35')][_0x9ecd('0x41')]){_0x5b7e6d[_0x9ecd('0x42')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x9ecd('0x43')](_0x5b7e6d);})['then'](function(_0xa7ac58){_0x5a9308['rows']=_0xa7ac58;return _0x5a9308;})[_0x9ecd('0x27')](respondWithFilteredResult(_0x207bd0,_0x5b7e6d))['catch'](handleError(_0x207bd0,null));};exports['show']=function(_0x343f86,_0x8b573){var _0x13cfb1={'raw':![],'where':{'id':_0x343f86[_0x9ecd('0x44')]['id']}},_0x5edc13={};_0x5edc13[_0x9ecd('0x31')]=_[_0x9ecd('0x33')](db[_0x9ecd('0x2e')][_0x9ecd('0x2f')]);_0x5edc13[_0x9ecd('0x35')]=_[_0x9ecd('0x33')](_0x343f86['query']);_0x5edc13[_0x9ecd('0x34')]=_[_0x9ecd('0x45')](_0x5edc13[_0x9ecd('0x31')],_0x5edc13[_0x9ecd('0x35')]);_0x13cfb1[_0x9ecd('0x46')]=_[_0x9ecd('0x45')](_0x5edc13[_0x9ecd('0x31')],qs[_0x9ecd('0x36')](_0x343f86[_0x9ecd('0x35')]['fields']));_0x13cfb1[_0x9ecd('0x46')]=_0x13cfb1['attributes'][_0x9ecd('0x47')]?_0x13cfb1[_0x9ecd('0x46')]:_0x5edc13[_0x9ecd('0x31')];if(_0x343f86[_0x9ecd('0x35')]['includeAll']){_0x13cfb1[_0x9ecd('0x42')]=[{'all':!![]}];}_0x13cfb1=_['merge']({},_0x13cfb1,_0x343f86['options']);return db['SalesforceConfiguration'][_0x9ecd('0x48')](_0x13cfb1)[_0x9ecd('0x27')](handleEntityNotFound(_0x8b573,null))['then'](respondWithResult(_0x8b573,null))[_0x9ecd('0x49')](handleError(_0x8b573,null));};exports[_0x9ecd('0x4a')]=function(_0x5f01e3,_0x31c294){return db[_0x9ecd('0x2e')]['create'](_0x5f01e3['body'],{})[_0x9ecd('0x27')](respondWithResult(_0x31c294,0xc9))['catch'](handleError(_0x31c294,null));};exports[_0x9ecd('0x26')]=function(_0x5b8315,_0x9c5563){if(_0x5b8315[_0x9ecd('0x4b')]['id']){delete _0x5b8315['body']['id'];}return db[_0x9ecd('0x2e')]['find']({'where':{'id':_0x5b8315[_0x9ecd('0x44')]['id']}})[_0x9ecd('0x27')](handleEntityNotFound(_0x9c5563,null))['then'](saveUpdates(_0x5b8315[_0x9ecd('0x4b')],null))[_0x9ecd('0x27')](respondWithResult(_0x9c5563,null))[_0x9ecd('0x49')](handleError(_0x9c5563,null));};exports[_0x9ecd('0x28')]=function(_0x51d15c,_0xf8807a){return db['SalesforceConfiguration'][_0x9ecd('0x48')]({'where':{'id':_0x51d15c[_0x9ecd('0x44')]['id']}})['then'](handleEntityNotFound(_0xf8807a,null))[_0x9ecd('0x27')](removeEntity(_0xf8807a,null))[_0x9ecd('0x49')](handleError(_0xf8807a,null));};exports[_0x9ecd('0x4c')]=function(_0x56afc5,_0x1dec31,_0x57e4c){var _0x261490={};var _0x4314d3={};var _0x4e2e4b;var _0x411b04;return db[_0x9ecd('0x2e')][_0x9ecd('0x4d')]({'where':{'id':_0x56afc5[_0x9ecd('0x44')]['id']}})[_0x9ecd('0x27')](handleEntityNotFound(_0x1dec31,null))[_0x9ecd('0x27')](function(_0x128b34){if(_0x128b34){_0x4e2e4b=_0x128b34;_0x4314d3[_0x9ecd('0x31')]=_[_0x9ecd('0x33')](db[_0x9ecd('0x4e')][_0x9ecd('0x2f')]);_0x4314d3[_0x9ecd('0x35')]=_[_0x9ecd('0x33')](_0x56afc5['query']);_0x4314d3[_0x9ecd('0x34')]=_[_0x9ecd('0x45')](_0x4314d3[_0x9ecd('0x31')],_0x4314d3['query']);_0x261490[_0x9ecd('0x46')]=_[_0x9ecd('0x45')](_0x4314d3[_0x9ecd('0x31')],qs[_0x9ecd('0x36')](_0x56afc5[_0x9ecd('0x35')][_0x9ecd('0x36')]));_0x261490[_0x9ecd('0x46')]=_0x261490[_0x9ecd('0x46')]['length']?_0x261490[_0x9ecd('0x46')]:_0x4314d3[_0x9ecd('0x31')];_0x261490['order']=qs[_0x9ecd('0x39')](_0x56afc5[_0x9ecd('0x35')][_0x9ecd('0x39')]);_0x261490['where']=qs[_0x9ecd('0x34')](_['pick'](_0x56afc5[_0x9ecd('0x35')],_0x4314d3[_0x9ecd('0x34')]));if(_0x56afc5[_0x9ecd('0x35')]['filter']){_0x261490[_0x9ecd('0x3b')]=_[_0x9ecd('0x3c')](_0x261490[_0x9ecd('0x3b')],{'$or':_['map'](_0x261490['attributes'],function(_0x20bb91){var _0x5196cb={};_0x5196cb[_0x20bb91]={'$like':'%'+_0x56afc5[_0x9ecd('0x35')][_0x9ecd('0x3f')]+'%'};return _0x5196cb;})});}_0x261490=_[_0x9ecd('0x3c')]({},_0x261490,_0x56afc5[_0x9ecd('0x40')]);return _0x4e2e4b[_0x9ecd('0x4c')](_0x261490);}})['then'](function(_0x2adde7){if(_0x2adde7){_0x411b04=_0x2adde7[_0x9ecd('0x47')];if(!_0x56afc5[_0x9ecd('0x35')][_0x9ecd('0x37')](_0x9ecd('0x4f'))){_0x261490[_0x9ecd('0x22')]=qs[_0x9ecd('0x22')](_0x56afc5[_0x9ecd('0x35')][_0x9ecd('0x22')]);_0x261490[_0x9ecd('0x1f')]=qs[_0x9ecd('0x1f')](_0x56afc5[_0x9ecd('0x35')][_0x9ecd('0x1f')]);}return _0x4e2e4b[_0x9ecd('0x4c')](_0x261490);}})[_0x9ecd('0x27')](function(_0x11fe5a){if(_0x11fe5a){return _0x11fe5a?{'count':_0x411b04,'rows':_0x11fe5a}:null;}})[_0x9ecd('0x27')](respondWithResult(_0x1dec31,null))['catch'](handleError(_0x1dec31,null));};exports[_0x9ecd('0x50')]=function(_0x36aa7a,_0x23d1f3,_0x54245c){var _0x2fc416={};var _0x37f923={};var _0x4aec27;var _0x576d4f;return db[_0x9ecd('0x2e')][_0x9ecd('0x4d')]({'where':{'id':_0x36aa7a['params']['id']}})[_0x9ecd('0x27')](handleEntityNotFound(_0x23d1f3,null))[_0x9ecd('0x27')](function(_0x3d62aa){if(_0x3d62aa){_0x4aec27=_0x3d62aa;_0x37f923[_0x9ecd('0x31')]=_[_0x9ecd('0x33')](db[_0x9ecd('0x4e')][_0x9ecd('0x2f')]);_0x37f923[_0x9ecd('0x35')]=_[_0x9ecd('0x33')](_0x36aa7a[_0x9ecd('0x35')]);_0x37f923[_0x9ecd('0x34')]=_[_0x9ecd('0x45')](_0x37f923[_0x9ecd('0x31')],_0x37f923[_0x9ecd('0x35')]);_0x2fc416[_0x9ecd('0x46')]=_[_0x9ecd('0x45')](_0x37f923['model'],qs['fields'](_0x36aa7a[_0x9ecd('0x35')][_0x9ecd('0x36')]));_0x2fc416[_0x9ecd('0x46')]=_0x2fc416['attributes'][_0x9ecd('0x47')]?_0x2fc416[_0x9ecd('0x46')]:_0x37f923[_0x9ecd('0x31')];_0x2fc416[_0x9ecd('0x38')]=qs[_0x9ecd('0x39')](_0x36aa7a[_0x9ecd('0x35')][_0x9ecd('0x39')]);_0x2fc416[_0x9ecd('0x3b')]=qs[_0x9ecd('0x34')](_[_0x9ecd('0x3a')](_0x36aa7a['query'],_0x37f923[_0x9ecd('0x34')]));if(_0x36aa7a[_0x9ecd('0x35')][_0x9ecd('0x3f')]){_0x2fc416[_0x9ecd('0x3b')]=_[_0x9ecd('0x3c')](_0x2fc416[_0x9ecd('0x3b')],{'$or':_['map'](_0x2fc416[_0x9ecd('0x46')],function(_0x2538cd){var _0x504c8b={};_0x504c8b[_0x2538cd]={'$like':'%'+_0x36aa7a['query'][_0x9ecd('0x3f')]+'%'};return _0x504c8b;})});}_0x2fc416=_['merge']({},_0x2fc416,_0x36aa7a['options']);return _0x4aec27['getSubjects'](_0x2fc416);}})[_0x9ecd('0x27')](function(_0x598bc8){if(_0x598bc8){_0x576d4f=_0x598bc8[_0x9ecd('0x47')];if(!_0x36aa7a['query'][_0x9ecd('0x37')]('nolimit')){_0x2fc416[_0x9ecd('0x22')]=qs['limit'](_0x36aa7a[_0x9ecd('0x35')][_0x9ecd('0x22')]);_0x2fc416['offset']=qs['offset'](_0x36aa7a[_0x9ecd('0x35')]['offset']);}return _0x4aec27['getSubjects'](_0x2fc416);}})[_0x9ecd('0x27')](function(_0x196b1f){if(_0x196b1f){return _0x196b1f?{'count':_0x576d4f,'rows':_0x196b1f}:null;}})[_0x9ecd('0x27')](respondWithResult(_0x23d1f3,null))[_0x9ecd('0x49')](handleError(_0x23d1f3,null));};exports[_0x9ecd('0x51')]=function(_0x5df1b0,_0x18fc9e,_0x26d557){var _0x5825fc={};var _0x5887d7={};var _0x597815;var _0x3bd8e8;return db[_0x9ecd('0x2e')][_0x9ecd('0x4d')]({'where':{'id':_0x5df1b0[_0x9ecd('0x44')]['id']}})[_0x9ecd('0x27')](handleEntityNotFound(_0x18fc9e,null))[_0x9ecd('0x27')](function(_0x3474c7){if(_0x3474c7){_0x597815=_0x3474c7;_0x5887d7[_0x9ecd('0x31')]=_[_0x9ecd('0x33')](db[_0x9ecd('0x4e')]['rawAttributes']);_0x5887d7[_0x9ecd('0x35')]=_[_0x9ecd('0x33')](_0x5df1b0[_0x9ecd('0x35')]);_0x5887d7['filters']=_[_0x9ecd('0x45')](_0x5887d7['model'],_0x5887d7[_0x9ecd('0x35')]);_0x5825fc['attributes']=_[_0x9ecd('0x45')](_0x5887d7['model'],qs[_0x9ecd('0x36')](_0x5df1b0[_0x9ecd('0x35')]['fields']));_0x5825fc[_0x9ecd('0x46')]=_0x5825fc['attributes']['length']?_0x5825fc[_0x9ecd('0x46')]:_0x5887d7[_0x9ecd('0x31')];_0x5825fc[_0x9ecd('0x38')]=qs['sort'](_0x5df1b0[_0x9ecd('0x35')][_0x9ecd('0x39')]);_0x5825fc[_0x9ecd('0x3b')]=qs[_0x9ecd('0x34')](_[_0x9ecd('0x3a')](_0x5df1b0[_0x9ecd('0x35')],_0x5887d7[_0x9ecd('0x34')]));if(_0x5df1b0[_0x9ecd('0x35')][_0x9ecd('0x3f')]){_0x5825fc[_0x9ecd('0x3b')]=_['merge'](_0x5825fc['where'],{'$or':_[_0x9ecd('0x32')](_0x5825fc[_0x9ecd('0x46')],function(_0x144efe){var _0x1e9a6c={};_0x1e9a6c[_0x144efe]={'$like':'%'+_0x5df1b0['query'][_0x9ecd('0x3f')]+'%'};return _0x1e9a6c;})});}_0x5825fc=_['merge']({},_0x5825fc,_0x5df1b0[_0x9ecd('0x40')]);return _0x597815[_0x9ecd('0x51')](_0x5825fc);}})[_0x9ecd('0x27')](function(_0x51ff96){if(_0x51ff96){_0x3bd8e8=_0x51ff96[_0x9ecd('0x47')];if(!_0x5df1b0[_0x9ecd('0x35')]['hasOwnProperty'](_0x9ecd('0x4f'))){_0x5825fc[_0x9ecd('0x22')]=qs[_0x9ecd('0x22')](_0x5df1b0[_0x9ecd('0x35')][_0x9ecd('0x22')]);_0x5825fc['offset']=qs[_0x9ecd('0x1f')](_0x5df1b0[_0x9ecd('0x35')][_0x9ecd('0x1f')]);}return _0x597815[_0x9ecd('0x51')](_0x5825fc);}})[_0x9ecd('0x27')](function(_0x14cddb){if(_0x14cddb){return _0x14cddb?{'count':_0x3bd8e8,'rows':_0x14cddb}:null;}})[_0x9ecd('0x27')](respondWithResult(_0x18fc9e,null))[_0x9ecd('0x49')](handleError(_0x18fc9e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 767e7a4..fb45dc7 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 _0xdef0=['exports','define','int_salesforce_configurations','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x5e58f5,_0x16896a){var _0x5e3df3=function(_0x23114d){while(--_0x23114d){_0x5e58f5['push'](_0x5e58f5['shift']());}};_0x5e3df3(++_0x16896a);}(_0xdef0,0x111));var _0x0def=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdef0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x0def('0x0'));var logger=require(_0x0def('0x1'))(_0x0def('0x2'));var moment=require(_0x0def('0x3'));var BPromise=require('bluebird');var rp=require(_0x0def('0x4'));var fs=require('fs');var path=require(_0x0def('0x5'));var rimraf=require('rimraf');var config=require(_0x0def('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x0def('0x7')]=function(_0x4ad800,_0x5963ca){return _0x4ad800[_0x0def('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0x0def('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ae5=['lodash','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','int_salesforce_configurations'];(function(_0x2d520e,_0x287652){var _0x4ccfc4=function(_0x3ae3fe){while(--_0x3ae3fe){_0x2d520e['push'](_0x2d520e['shift']());}};_0x4ccfc4(++_0x287652);}(_0x2ae5,0x105));var _0x52ae=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x2ae5[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x52ae('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x52ae('0x1'));var BPromise=require(_0x52ae('0x2'));var rp=require(_0x52ae('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x52ae('0x4'));var config=require(_0x52ae('0x5'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x52ae('0x6')]=function(_0x9bd26,_0x3336ea){return _0x9bd26[_0x52ae('0x7')]('SalesforceConfiguration',attributes,{'tableName':_0x52ae('0x8'),'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 f0ab95d..d380565 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 _0xcc58=['result','catch','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x5e4fdc,_0x183475){var _0xe2d401=function(_0x59ac98){while(--_0x59ac98){_0x5e4fdc['push'](_0x5e4fdc['shift']());}};_0xe2d401(++_0x183475);}(_0xcc58,0x16a));var _0x8cc5=function(_0x5010a0,_0x27c207){_0x5010a0=_0x5010a0-0x0;var _0x3777bc=_0xcc58[_0x5010a0];return _0x3777bc;};'use strict';var _=require('lodash');var util=require(_0x8cc5('0x0'));var moment=require(_0x8cc5('0x1'));var BPromise=require('bluebird');var rs=require(_0x8cc5('0x2'));var fs=require('fs');var Redis=require(_0x8cc5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8cc5('0x4'))(_0x8cc5('0x5'));var config=require('../../config/environment');var jayson=require(_0x8cc5('0x6'));var client=jayson[_0x8cc5('0x7')][_0x8cc5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3395b4,_0x486182,_0x30aca2){return new BPromise(function(_0x3c110a,_0x517535){return client[_0x8cc5('0x9')](_0x3395b4,_0x30aca2)['then'](function(_0x289fd7){logger['info'](_0x8cc5('0xa'),_0x486182,'request\x20sent');logger[_0x8cc5('0xb')](_0x8cc5('0xc'),_0x486182,_0x8cc5('0xd'),JSON['stringify'](_0x289fd7));if(_0x289fd7[_0x8cc5('0xe')]){if(_0x289fd7[_0x8cc5('0xe')]['code']===0x1f4){logger['error'](_0x8cc5('0xa'),_0x486182,_0x289fd7['error'][_0x8cc5('0xf')]);return _0x517535(_0x289fd7[_0x8cc5('0xe')][_0x8cc5('0xf')]);}logger[_0x8cc5('0xe')](_0x8cc5('0xa'),_0x486182,_0x289fd7[_0x8cc5('0xe')][_0x8cc5('0xf')]);return _0x3c110a(_0x289fd7[_0x8cc5('0xe')][_0x8cc5('0xf')]);}else{logger['info'](_0x8cc5('0xa'),_0x486182,_0x8cc5('0xd'));_0x3c110a(_0x289fd7[_0x8cc5('0x10')][_0x8cc5('0xf')]);}})[_0x8cc5('0x11')](function(_0x55c134){logger[_0x8cc5('0xe')](_0x8cc5('0xa'),_0x486182,_0x55c134);_0x517535(_0x55c134);});});} \ No newline at end of file +var _0x5189=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent'];(function(_0x351dbe,_0x4e433){var _0x4fa677=function(_0x1716fb){while(--_0x1716fb){_0x351dbe['push'](_0x351dbe['shift']());}};_0x4fa677(++_0x4e433);}(_0x5189,0xd0));var _0x9518=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0x5189[_0x27beea];return _0x122645;};'use strict';var _=require(_0x9518('0x0'));var util=require(_0x9518('0x1'));var moment=require(_0x9518('0x2'));var BPromise=require(_0x9518('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9518('0x4'));var logger=require('../../config/logger')(_0x9518('0x5'));var config=require(_0x9518('0x6'));var jayson=require(_0x9518('0x7'));var client=jayson[_0x9518('0x8')][_0x9518('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c058e,_0x20c70b,_0x2cb141){return new BPromise(function(_0x564aa3,_0x439297){return client['request'](_0x3c058e,_0x2cb141)[_0x9518('0xa')](function(_0x395a8a){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x20c70b,_0x9518('0xb'));logger[_0x9518('0xc')](_0x9518('0xd'),_0x20c70b,'request\x20sent',JSON[_0x9518('0xe')](_0x395a8a));if(_0x395a8a[_0x9518('0xf')]){if(_0x395a8a['error'][_0x9518('0x10')]===0x1f4){logger[_0x9518('0xf')](_0x9518('0x11'),_0x20c70b,_0x395a8a['error'][_0x9518('0x12')]);return _0x439297(_0x395a8a[_0x9518('0xf')][_0x9518('0x12')]);}logger[_0x9518('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x20c70b,_0x395a8a[_0x9518('0xf')][_0x9518('0x12')]);return _0x564aa3(_0x395a8a[_0x9518('0xf')]['message']);}else{logger[_0x9518('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x20c70b,_0x9518('0xb'));_0x564aa3(_0x395a8a[_0x9518('0x14')]['message']);}})[_0x9518('0x15')](function(_0x5a9f7c){logger['error'](_0x9518('0x11'),_0x20c70b,_0x5a9f7c);_0x439297(_0x5a9f7c);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index e0e3c57..5661453 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 _0x9bec=['/:id','show','post','create','put','update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0x9bec,0x1c1));var _0xc9be=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x9bec[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc9be('0x0'));var timeout=require(_0xc9be('0x1'));var express=require(_0xc9be('0x2'));var router=express[_0xc9be('0x3')]();var fs_extra=require(_0xc9be('0x4'));var auth=require(_0xc9be('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc9be('0x6'));var controller=require(_0xc9be('0x7'));router[_0xc9be('0x8')]('/',auth[_0xc9be('0x9')](),controller['index']);router[_0xc9be('0x8')](_0xc9be('0xa'),auth[_0xc9be('0x9')](),controller[_0xc9be('0xb')]);router[_0xc9be('0xc')]('/',auth[_0xc9be('0x9')](),controller[_0xc9be('0xd')]);router[_0xc9be('0xe')](_0xc9be('0xa'),auth['isAuthenticated'](),controller[_0xc9be('0xf')]);router['delete']('/:id',auth[_0xc9be('0x9')](),controller[_0xc9be('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0222=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','create','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x21ea5f,_0x931dc3){var _0x4c0eee=function(_0x41ae27){while(--_0x41ae27){_0x21ea5f['push'](_0x21ea5f['shift']());}};_0x4c0eee(++_0x931dc3);}(_0x0222,0x9e));var _0x2022=function(_0x7f290f,_0x9407fa){_0x7f290f=_0x7f290f-0x0;var _0x4c120b=_0x0222[_0x7f290f];return _0x4c120b;};'use strict';var multer=require(_0x2022('0x0'));var util=require(_0x2022('0x1'));var path=require('path');var timeout=require(_0x2022('0x2'));var express=require(_0x2022('0x3'));var router=express[_0x2022('0x4')]();var fs_extra=require(_0x2022('0x5'));var auth=require(_0x2022('0x6'));var interaction=require(_0x2022('0x7'));var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x2022('0x8')](),controller[_0x2022('0x9')]);router[_0x2022('0xa')](_0x2022('0xb'),auth[_0x2022('0x8')](),controller[_0x2022('0xc')]);router['post']('/',auth[_0x2022('0x8')](),controller[_0x2022('0xd')]);router['put'](_0x2022('0xb'),auth['isAuthenticated'](),controller[_0x2022('0xe')]);router[_0x2022('0xf')](_0x2022('0xb'),auth[_0x2022('0x8')](),controller[_0x2022('0x10')]);module[_0x2022('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index f1dbb92..e2c8bbb 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 _0x63d9=['string','variable','customVariable','picklist','STRING','sequelize','ENUM'];(function(_0x4c00a3,_0x2d23e2){var _0x893854=function(_0x6f552c){while(--_0x6f552c){_0x4c00a3['push'](_0x4c00a3['shift']());}};_0x893854(++_0x2d23e2);}(_0x63d9,0x1c5));var _0x963d=function(_0x2e0dca,_0x45a901){_0x2e0dca=_0x2e0dca-0x0;var _0x31605b=_0x63d9[_0x2e0dca];return _0x31605b;};'use strict';var Sequelize=require(_0x963d('0x0'));module['exports']={'type':{'type':Sequelize[_0x963d('0x1')](_0x963d('0x2'),_0x963d('0x3'),_0x963d('0x4'),'keyValue',_0x963d('0x5')),'defaultValue':_0x963d('0x2')},'content':{'type':Sequelize[_0x963d('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x963d('0x2'),_0x963d('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x963d('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6884=['string','variable','customVariable','keyValue','STRING','sequelize','exports'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x6884,0x139));var _0x4688=function(_0x474c2b,_0x180093){_0x474c2b=_0x474c2b-0x0;var _0x51b142=_0x6884[_0x474c2b];return _0x51b142;};'use strict';var Sequelize=require(_0x4688('0x0'));module[_0x4688('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4688('0x2'),_0x4688('0x3'),_0x4688('0x4'),_0x4688('0x5'),'picklist'),'defaultValue':_0x4688('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x4688('0x2'),_0x4688('0x3'),_0x4688('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4688('0x6')]},'variableName':{'type':Sequelize[_0x4688('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index be2ea09..734c5c2 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 _0x0644=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','type','model','keys','filters','intersection','query','attributes','fields','length','nolimit','pick','filter','where','merge','VIRTUAL','SalesforceField','findAll','rows','catch','show','includeAll','include','options','create','body','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware'];(function(_0x4b0746,_0x340908){var _0x4da05f=function(_0x20bc41){while(--_0x20bc41){_0x4b0746['push'](_0x4b0746['shift']());}};_0x4da05f(++_0x340908);}(_0x0644,0x111));var _0x4064=function(_0x1bdf08,_0x4a22a9){_0x1bdf08=_0x1bdf08-0x0;var _0x212e0d=_0x0644[_0x1bdf08];return _0x212e0d;};'use strict';var emlformat=require(_0x4064('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4064('0x1'));var jsonpatch=require(_0x4064('0x2'));var rp=require(_0x4064('0x3'));var moment=require(_0x4064('0x4'));var BPromise=require(_0x4064('0x5'));var Mustache=require(_0x4064('0x6'));var util=require(_0x4064('0x7'));var path=require(_0x4064('0x8'));var sox=require('sox');var csv=require(_0x4064('0x9'));var ejs=require(_0x4064('0xa'));var fs=require('fs');var fs_extra=require(_0x4064('0xb'));var _=require('lodash');var squel=require(_0x4064('0xc'));var crypto=require(_0x4064('0xd'));var jsforce=require(_0x4064('0xe'));var deskjs=require(_0x4064('0xf'));var toCsv=require(_0x4064('0x9'));var querystring=require('querystring');var Papa=require(_0x4064('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4064('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4064('0x12'));var logger=require(_0x4064('0x13'))(_0x4064('0x14'));var utils=require(_0x4064('0x15'));var config=require(_0x4064('0x16'));var licenseUtil=require(_0x4064('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422ff3,_0x1266a7){_0x1266a7=_0x1266a7||0xcc;return function(_0x410a5e){if(_0x410a5e){return _0x422ff3[_0x4064('0x18')](_0x1266a7);}return _0x422ff3[_0x4064('0x19')](_0x1266a7)[_0x4064('0x1a')]();};}function respondWithResult(_0x2543f8,_0x2cfece){_0x2cfece=_0x2cfece||0xc8;return function(_0x47b726){if(_0x47b726){return _0x2543f8[_0x4064('0x19')](_0x2cfece)[_0x4064('0x1b')](_0x47b726);}};}function respondWithFilteredResult(_0x16d1cc,_0x464b47){return function(_0x425b71){if(_0x425b71){var _0x4b4370=typeof _0x464b47[_0x4064('0x1c')]===_0x4064('0x1d')&&typeof _0x464b47[_0x4064('0x1e')]==='undefined';var _0x126367=_0x425b71[_0x4064('0x1f')];var _0xfd2cba=_0x4b4370?0x0:_0x464b47[_0x4064('0x1c')];var _0x4e489f=_0x4b4370?_0x425b71[_0x4064('0x1f')]:_0x464b47[_0x4064('0x1c')]+_0x464b47[_0x4064('0x1e')];var _0x5b7577;if(_0x4e489f>=_0x126367){_0x4e489f=_0x126367;_0x5b7577=0xc8;}else{_0x5b7577=0xce;}_0x16d1cc['status'](_0x5b7577);return _0x16d1cc[_0x4064('0x20')](_0x4064('0x21'),_0xfd2cba+'-'+_0x4e489f+'/'+_0x126367)[_0x4064('0x1b')](_0x425b71);}return null;};}function patchUpdates(_0x16844e){return function(_0x32995e){try{jsonpatch[_0x4064('0x22')](_0x32995e,_0x16844e,!![]);}catch(_0x56ce36){return BPromise[_0x4064('0x23')](_0x56ce36);}return _0x32995e[_0x4064('0x24')]();};}function saveUpdates(_0x5b1b1d,_0x5d116a){return function(_0x46fc97){if(_0x46fc97){return _0x46fc97[_0x4064('0x25')](_0x5b1b1d)['then'](function(_0x2956b7){return _0x2956b7;});}return null;};}function removeEntity(_0x174e6c,_0x563b82){return function(_0x4cb5fa){if(_0x4cb5fa){return _0x4cb5fa['destroy']()[_0x4064('0x26')](function(){_0x174e6c[_0x4064('0x19')](0xcc)[_0x4064('0x1a')]();});}};}function handleEntityNotFound(_0x542b06,_0x229f8a){return function(_0x221025){if(!_0x221025){_0x542b06[_0x4064('0x18')](0x194);}return _0x221025;};}function handleError(_0x33cafe,_0x5ddcd5){_0x5ddcd5=_0x5ddcd5||0x1f4;return function(_0x5827b2){logger[_0x4064('0x27')](_0x5827b2[_0x4064('0x28')]);if(_0x5827b2[_0x4064('0x29')]){delete _0x5827b2[_0x4064('0x29')];}_0x33cafe[_0x4064('0x19')](_0x5ddcd5)[_0x4064('0x2a')](_0x5827b2);};}exports[_0x4064('0x2b')]=function(_0x2ab293,_0x3b0c46){var _0x3288c1={},_0x2da098={},_0x49d184={'count':0x0,'rows':[]};var _0x1aa0a3=_[_0x4064('0x2c')](db['SalesforceField'][_0x4064('0x2d')],function(_0x58c155){return{'name':_0x58c155['fieldName'],'type':_0x58c155[_0x4064('0x2e')]['key']};});_0x2da098[_0x4064('0x2f')]=_[_0x4064('0x2c')](_0x1aa0a3,_0x4064('0x29'));_0x2da098['query']=_[_0x4064('0x30')](_0x2ab293['query']);_0x2da098[_0x4064('0x31')]=_[_0x4064('0x32')](_0x2da098[_0x4064('0x2f')],_0x2da098[_0x4064('0x33')]);_0x3288c1[_0x4064('0x34')]=_[_0x4064('0x32')](_0x2da098['model'],qs[_0x4064('0x35')](_0x2ab293[_0x4064('0x33')][_0x4064('0x35')]));_0x3288c1[_0x4064('0x34')]=_0x3288c1[_0x4064('0x34')][_0x4064('0x36')]?_0x3288c1[_0x4064('0x34')]:_0x2da098[_0x4064('0x2f')];if(!_0x2ab293[_0x4064('0x33')]['hasOwnProperty'](_0x4064('0x37'))){_0x3288c1[_0x4064('0x1e')]=qs[_0x4064('0x1e')](_0x2ab293[_0x4064('0x33')][_0x4064('0x1e')]);_0x3288c1[_0x4064('0x1c')]=qs[_0x4064('0x1c')](_0x2ab293[_0x4064('0x33')][_0x4064('0x1c')]);}_0x3288c1['order']=qs['sort'](_0x2ab293[_0x4064('0x33')]['sort']);_0x3288c1['where']=qs['filters'](_[_0x4064('0x38')](_0x2ab293[_0x4064('0x33')],_0x2da098[_0x4064('0x31')]),_0x1aa0a3);if(_0x2ab293[_0x4064('0x33')][_0x4064('0x39')]){_0x3288c1[_0x4064('0x3a')]=_[_0x4064('0x3b')](_0x3288c1[_0x4064('0x3a')],{'$or':_[_0x4064('0x2c')](_0x1aa0a3,function(_0x26e959){if(_0x26e959[_0x4064('0x2e')]!==_0x4064('0x3c')){var _0x51f9d3={};_0x51f9d3[_0x26e959[_0x4064('0x29')]]={'$like':'%'+_0x2ab293[_0x4064('0x33')][_0x4064('0x39')]+'%'};return _0x51f9d3;}})});}_0x3288c1=_[_0x4064('0x3b')]({},_0x3288c1,_0x2ab293['options']);var _0x423255={'where':_0x3288c1['where']};return db[_0x4064('0x3d')][_0x4064('0x1f')](_0x423255)[_0x4064('0x26')](function(_0x17dd4c){_0x49d184[_0x4064('0x1f')]=_0x17dd4c;if(_0x2ab293[_0x4064('0x33')]['includeAll']){_0x3288c1['include']=[{'all':!![]}];}return db[_0x4064('0x3d')][_0x4064('0x3e')](_0x3288c1);})[_0x4064('0x26')](function(_0x519de6){_0x49d184[_0x4064('0x3f')]=_0x519de6;return _0x49d184;})[_0x4064('0x26')](respondWithFilteredResult(_0x3b0c46,_0x3288c1))[_0x4064('0x40')](handleError(_0x3b0c46,null));};exports[_0x4064('0x41')]=function(_0x1cba76,_0x4a5643){var _0x4874b7={'raw':!![],'where':{'id':_0x1cba76['params']['id']}},_0x559e18={};_0x559e18[_0x4064('0x2f')]=_[_0x4064('0x30')](db[_0x4064('0x3d')]['rawAttributes']);_0x559e18[_0x4064('0x33')]=_['keys'](_0x1cba76[_0x4064('0x33')]);_0x559e18['filters']=_['intersection'](_0x559e18[_0x4064('0x2f')],_0x559e18[_0x4064('0x33')]);_0x4874b7[_0x4064('0x34')]=_[_0x4064('0x32')](_0x559e18[_0x4064('0x2f')],qs[_0x4064('0x35')](_0x1cba76[_0x4064('0x33')]['fields']));_0x4874b7[_0x4064('0x34')]=_0x4874b7[_0x4064('0x34')][_0x4064('0x36')]?_0x4874b7[_0x4064('0x34')]:_0x559e18[_0x4064('0x2f')];if(_0x1cba76['query'][_0x4064('0x42')]){_0x4874b7[_0x4064('0x43')]=[{'all':!![]}];}_0x4874b7=_['merge']({},_0x4874b7,_0x1cba76[_0x4064('0x44')]);return db[_0x4064('0x3d')]['find'](_0x4874b7)['then'](handleEntityNotFound(_0x4a5643,null))[_0x4064('0x26')](respondWithResult(_0x4a5643,null))[_0x4064('0x40')](handleError(_0x4a5643,null));};exports['create']=function(_0x165541,_0x42b659){return db['SalesforceField'][_0x4064('0x45')](_0x165541[_0x4064('0x46')],{})['then'](respondWithResult(_0x42b659,0xc9))[_0x4064('0x40')](handleError(_0x42b659,null));};exports[_0x4064('0x25')]=function(_0x221312,_0x52e589){if(_0x221312[_0x4064('0x46')]['id']){delete _0x221312['body']['id'];}return db[_0x4064('0x3d')]['find']({'where':{'id':_0x221312[_0x4064('0x47')]['id']}})['then'](handleEntityNotFound(_0x52e589,null))[_0x4064('0x26')](saveUpdates(_0x221312[_0x4064('0x46')],null))[_0x4064('0x26')](respondWithResult(_0x52e589,null))[_0x4064('0x40')](handleError(_0x52e589,null));};exports[_0x4064('0x48')]=function(_0x22d77a,_0x165dda){return db['SalesforceField']['find']({'where':{'id':_0x22d77a['params']['id']}})[_0x4064('0x26')](handleEntityNotFound(_0x165dda,null))['then'](removeEntity(_0x165dda,null))[_0x4064('0x40')](handleError(_0x165dda,null));}; \ No newline at end of file +var _0xd907=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','name','send','index','SalesforceField','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','length','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x356127,_0x4873ac){var _0x5d4c75=function(_0x4fe60c){while(--_0x4fe60c){_0x356127['push'](_0x356127['shift']());}};_0x5d4c75(++_0x4873ac);}(_0xd907,0x10c));var _0x7d90=function(_0x2bc8e0,_0x38204a){_0x2bc8e0=_0x2bc8e0-0x0;var _0xca8f97=_0xd907[_0x2bc8e0];return _0xca8f97;};'use strict';var emlformat=require(_0x7d90('0x0'));var rimraf=require(_0x7d90('0x1'));var zipdir=require(_0x7d90('0x2'));var jsonpatch=require(_0x7d90('0x3'));var rp=require('request-promise');var moment=require(_0x7d90('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7d90('0x5'));var util=require(_0x7d90('0x6'));var path=require(_0x7d90('0x7'));var sox=require('sox');var csv=require(_0x7d90('0x8'));var ejs=require(_0x7d90('0x9'));var fs=require('fs');var fs_extra=require(_0x7d90('0xa'));var _=require('lodash');var squel=require(_0x7d90('0xb'));var crypto=require(_0x7d90('0xc'));var jsforce=require(_0x7d90('0xd'));var deskjs=require(_0x7d90('0xe'));var toCsv=require(_0x7d90('0x8'));var querystring=require(_0x7d90('0xf'));var Papa=require(_0x7d90('0x10'));var Redis=require(_0x7d90('0x11'));var authService=require(_0x7d90('0x12'));var qs=require(_0x7d90('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d90('0x14'));var utils=require(_0x7d90('0x15'));var config=require(_0x7d90('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d90('0x17'))['db'];function respondWithStatusCode(_0x3eee29,_0x23789f){_0x23789f=_0x23789f||0xcc;return function(_0x2245a3){if(_0x2245a3){return _0x3eee29[_0x7d90('0x18')](_0x23789f);}return _0x3eee29[_0x7d90('0x19')](_0x23789f)['end']();};}function respondWithResult(_0x2744ec,_0x170add){_0x170add=_0x170add||0xc8;return function(_0xa959f4){if(_0xa959f4){return _0x2744ec[_0x7d90('0x19')](_0x170add)[_0x7d90('0x1a')](_0xa959f4);}};}function respondWithFilteredResult(_0xe07fbd,_0x229e10){return function(_0x168d43){if(_0x168d43){var _0x116cd1=typeof _0x229e10[_0x7d90('0x1b')]===_0x7d90('0x1c')&&typeof _0x229e10[_0x7d90('0x1d')]===_0x7d90('0x1c');var _0x5a3a7e=_0x168d43[_0x7d90('0x1e')];var _0x19cd3a=_0x116cd1?0x0:_0x229e10[_0x7d90('0x1b')];var _0x15fec0=_0x116cd1?_0x168d43['count']:_0x229e10[_0x7d90('0x1b')]+_0x229e10['limit'];var _0x2725ed;if(_0x15fec0>=_0x5a3a7e){_0x15fec0=_0x5a3a7e;_0x2725ed=0xc8;}else{_0x2725ed=0xce;}_0xe07fbd['status'](_0x2725ed);return _0xe07fbd[_0x7d90('0x1f')](_0x7d90('0x20'),_0x19cd3a+'-'+_0x15fec0+'/'+_0x5a3a7e)[_0x7d90('0x1a')](_0x168d43);}return null;};}function patchUpdates(_0x2a8535){return function(_0xa7d71f){try{jsonpatch[_0x7d90('0x21')](_0xa7d71f,_0x2a8535,!![]);}catch(_0x1207a2){return BPromise[_0x7d90('0x22')](_0x1207a2);}return _0xa7d71f[_0x7d90('0x23')]();};}function saveUpdates(_0x451a91,_0x3f1c25){return function(_0x38044f){if(_0x38044f){return _0x38044f['update'](_0x451a91)[_0x7d90('0x24')](function(_0x2fb3fc){return _0x2fb3fc;});}return null;};}function removeEntity(_0x25edab,_0x49830e){return function(_0x4a4c8a){if(_0x4a4c8a){return _0x4a4c8a[_0x7d90('0x25')]()[_0x7d90('0x24')](function(){_0x25edab[_0x7d90('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44a95f,_0x122d68){return function(_0x18db26){if(!_0x18db26){_0x44a95f[_0x7d90('0x18')](0x194);}return _0x18db26;};}function handleError(_0x58fea0,_0x1b7794){_0x1b7794=_0x1b7794||0x1f4;return function(_0x549d75){logger['error'](_0x549d75['stack']);if(_0x549d75[_0x7d90('0x26')]){delete _0x549d75[_0x7d90('0x26')];}_0x58fea0[_0x7d90('0x19')](_0x1b7794)[_0x7d90('0x27')](_0x549d75);};}exports[_0x7d90('0x28')]=function(_0x382f9b,_0x55c4b0){var _0x478261={},_0xb21231={},_0x312de3={'count':0x0,'rows':[]};var _0xc61432=_['map'](db[_0x7d90('0x29')][_0x7d90('0x2a')],function(_0x10e2f8){return{'name':_0x10e2f8[_0x7d90('0x2b')],'type':_0x10e2f8['type'][_0x7d90('0x2c')]};});_0xb21231[_0x7d90('0x2d')]=_['map'](_0xc61432,_0x7d90('0x26'));_0xb21231[_0x7d90('0x2e')]=_[_0x7d90('0x2f')](_0x382f9b[_0x7d90('0x2e')]);_0xb21231['filters']=_[_0x7d90('0x30')](_0xb21231[_0x7d90('0x2d')],_0xb21231[_0x7d90('0x2e')]);_0x478261[_0x7d90('0x31')]=_['intersection'](_0xb21231['model'],qs[_0x7d90('0x32')](_0x382f9b[_0x7d90('0x2e')][_0x7d90('0x32')]));_0x478261[_0x7d90('0x31')]=_0x478261['attributes']['length']?_0x478261[_0x7d90('0x31')]:_0xb21231['model'];if(!_0x382f9b['query'][_0x7d90('0x33')]('nolimit')){_0x478261[_0x7d90('0x1d')]=qs[_0x7d90('0x1d')](_0x382f9b[_0x7d90('0x2e')][_0x7d90('0x1d')]);_0x478261[_0x7d90('0x1b')]=qs[_0x7d90('0x1b')](_0x382f9b['query'][_0x7d90('0x1b')]);}_0x478261[_0x7d90('0x34')]=qs[_0x7d90('0x35')](_0x382f9b[_0x7d90('0x2e')][_0x7d90('0x35')]);_0x478261['where']=qs[_0x7d90('0x36')](_['pick'](_0x382f9b['query'],_0xb21231['filters']),_0xc61432);if(_0x382f9b[_0x7d90('0x2e')][_0x7d90('0x37')]){_0x478261[_0x7d90('0x38')]=_[_0x7d90('0x39')](_0x478261['where'],{'$or':_['map'](_0xc61432,function(_0x896584){if(_0x896584[_0x7d90('0x3a')]!==_0x7d90('0x3b')){var _0xfd89fb={};_0xfd89fb[_0x896584[_0x7d90('0x26')]]={'$like':'%'+_0x382f9b[_0x7d90('0x2e')][_0x7d90('0x37')]+'%'};return _0xfd89fb;}})});}_0x478261=_[_0x7d90('0x39')]({},_0x478261,_0x382f9b[_0x7d90('0x3c')]);var _0x4fe402={'where':_0x478261[_0x7d90('0x38')]};return db[_0x7d90('0x29')][_0x7d90('0x1e')](_0x4fe402)[_0x7d90('0x24')](function(_0x5c14ee){_0x312de3[_0x7d90('0x1e')]=_0x5c14ee;if(_0x382f9b['query'][_0x7d90('0x3d')]){_0x478261[_0x7d90('0x3e')]=[{'all':!![]}];}return db[_0x7d90('0x29')]['findAll'](_0x478261);})[_0x7d90('0x24')](function(_0x2805ca){_0x312de3[_0x7d90('0x3f')]=_0x2805ca;return _0x312de3;})[_0x7d90('0x24')](respondWithFilteredResult(_0x55c4b0,_0x478261))['catch'](handleError(_0x55c4b0,null));};exports[_0x7d90('0x40')]=function(_0x41d225,_0x27c7bd){var _0x4ecd8d={'raw':!![],'where':{'id':_0x41d225[_0x7d90('0x41')]['id']}},_0x330b68={};_0x330b68['model']=_[_0x7d90('0x2f')](db['SalesforceField'][_0x7d90('0x2a')]);_0x330b68[_0x7d90('0x2e')]=_[_0x7d90('0x2f')](_0x41d225[_0x7d90('0x2e')]);_0x330b68[_0x7d90('0x36')]=_[_0x7d90('0x30')](_0x330b68[_0x7d90('0x2d')],_0x330b68[_0x7d90('0x2e')]);_0x4ecd8d[_0x7d90('0x31')]=_[_0x7d90('0x30')](_0x330b68[_0x7d90('0x2d')],qs[_0x7d90('0x32')](_0x41d225['query'][_0x7d90('0x32')]));_0x4ecd8d[_0x7d90('0x31')]=_0x4ecd8d['attributes'][_0x7d90('0x42')]?_0x4ecd8d[_0x7d90('0x31')]:_0x330b68[_0x7d90('0x2d')];if(_0x41d225[_0x7d90('0x2e')]['includeAll']){_0x4ecd8d[_0x7d90('0x3e')]=[{'all':!![]}];}_0x4ecd8d=_[_0x7d90('0x39')]({},_0x4ecd8d,_0x41d225[_0x7d90('0x3c')]);return db[_0x7d90('0x29')][_0x7d90('0x43')](_0x4ecd8d)[_0x7d90('0x24')](handleEntityNotFound(_0x27c7bd,null))['then'](respondWithResult(_0x27c7bd,null))[_0x7d90('0x44')](handleError(_0x27c7bd,null));};exports[_0x7d90('0x45')]=function(_0x1b1f50,_0x10e712){return db[_0x7d90('0x29')][_0x7d90('0x45')](_0x1b1f50[_0x7d90('0x46')],{})['then'](respondWithResult(_0x10e712,0xc9))[_0x7d90('0x44')](handleError(_0x10e712,null));};exports[_0x7d90('0x47')]=function(_0x22897e,_0x367a4c){if(_0x22897e['body']['id']){delete _0x22897e[_0x7d90('0x46')]['id'];}return db['SalesforceField'][_0x7d90('0x43')]({'where':{'id':_0x22897e[_0x7d90('0x41')]['id']}})[_0x7d90('0x24')](handleEntityNotFound(_0x367a4c,null))[_0x7d90('0x24')](saveUpdates(_0x22897e[_0x7d90('0x46')],null))[_0x7d90('0x24')](respondWithResult(_0x367a4c,null))[_0x7d90('0x44')](handleError(_0x367a4c,null));};exports[_0x7d90('0x25')]=function(_0x1d5c7a,_0x2613b0){return db['SalesforceField'][_0x7d90('0x43')]({'where':{'id':_0x1d5c7a[_0x7d90('0x41')]['id']}})[_0x7d90('0x24')](handleEntityNotFound(_0x2613b0,null))[_0x7d90('0x24')](removeEntity(_0x2613b0,null))[_0x7d90('0x44')](handleError(_0x2613b0,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index dfe19a4..2f4fb96 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 _0x60e4=['request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','../../config/logger','api','bluebird'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x60e4,0x122));var _0x460e=function(_0x164546,_0x31e578){_0x164546=_0x164546-0x0;var _0x369e58=_0x60e4[_0x164546];return _0x369e58;};'use strict';var _=require(_0x460e('0x0'));var util=require('util');var logger=require(_0x460e('0x1'))(_0x460e('0x2'));var moment=require('moment');var BPromise=require(_0x460e('0x3'));var rp=require(_0x460e('0x4'));var fs=require('fs');var path=require(_0x460e('0x5'));var rimraf=require(_0x460e('0x6'));var config=require(_0x460e('0x7'));var attributes=require(_0x460e('0x8'));module['exports']=function(_0x160a2b,_0x54e910){return _0x160a2b[_0x460e('0x9')](_0x460e('0xa'),attributes,{'tableName':_0x460e('0xb'),'paranoid':![],'indexes':[{'name':_0x460e('0xc'),'fields':['idField',_0x460e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf19d=['idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields'];(function(_0x1b3dea,_0x171085){var _0x202293=function(_0x4e9c19){while(--_0x4e9c19){_0x1b3dea['push'](_0x1b3dea['shift']());}};_0x202293(++_0x171085);}(_0xf19d,0xf2));var _0xdf19=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xf19d[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0xdf19('0x0'));var util=require(_0xdf19('0x1'));var logger=require('../../config/logger')(_0xdf19('0x2'));var moment=require(_0xdf19('0x3'));var BPromise=require(_0xdf19('0x4'));var rp=require(_0xdf19('0x5'));var fs=require('fs');var path=require(_0xdf19('0x6'));var rimraf=require(_0xdf19('0x7'));var config=require('../../config/environment');var attributes=require(_0xdf19('0x8'));module[_0xdf19('0x9')]=function(_0x4cbf4e,_0x2e0dd0){return _0x4cbf4e[_0xdf19('0xa')](_0xdf19('0xb'),attributes,{'tableName':_0xdf19('0xc'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xdf19('0xd'),_0xdf19('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 32349e4..2b3ddd6 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 _0x19a3=['SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x19a3,0x1be));var _0x319a=function(_0x53342e,_0x49614e){_0x53342e=_0x53342e-0x0;var _0x44a8d7=_0x19a3[_0x53342e];return _0x44a8d7;};'use strict';var _=require('lodash');var util=require(_0x319a('0x0'));var moment=require(_0x319a('0x1'));var BPromise=require(_0x319a('0x2'));var rs=require(_0x319a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x319a('0x4'))['db'];var utils=require(_0x319a('0x5'));var logger=require(_0x319a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x319a('0x7'));var client=jayson[_0x319a('0x8')][_0x319a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e1fe5,_0xc39b48,_0x5b0ccd){return new BPromise(function(_0x4aa6d8,_0x4f2d82){return client[_0x319a('0xa')](_0x3e1fe5,_0x5b0ccd)[_0x319a('0xb')](function(_0x24f416){logger['info']('SalesforceField,\x20%s,\x20%s',_0xc39b48,_0x319a('0xc'));logger[_0x319a('0xd')](_0x319a('0xe'),_0xc39b48,_0x319a('0xc'),JSON[_0x319a('0xf')](_0x24f416));if(_0x24f416[_0x319a('0x10')]){if(_0x24f416['error'][_0x319a('0x11')]===0x1f4){logger[_0x319a('0x10')](_0x319a('0x12'),_0xc39b48,_0x24f416[_0x319a('0x10')]['message']);return _0x4f2d82(_0x24f416[_0x319a('0x10')][_0x319a('0x13')]);}logger[_0x319a('0x10')]('SalesforceField,\x20%s,\x20%s',_0xc39b48,_0x24f416[_0x319a('0x10')][_0x319a('0x13')]);return _0x4aa6d8(_0x24f416[_0x319a('0x10')][_0x319a('0x13')]);}else{logger[_0x319a('0x14')](_0x319a('0x12'),_0xc39b48,_0x319a('0xc'));_0x4aa6d8(_0x24f416[_0x319a('0x15')][_0x319a('0x13')]);}})[_0x319a('0x16')](function(_0x407e38){logger[_0x319a('0x10')](_0x319a('0x12'),_0xc39b48,_0x407e38);_0x4f2d82(_0x407e38);});});} \ No newline at end of file +var _0xe5b1=['result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','SalesforceField,\x20%s,\x20%s','message'];(function(_0x10de7a,_0x222aab){var _0x30d1b0=function(_0x2f945c){while(--_0x2f945c){_0x10de7a['push'](_0x10de7a['shift']());}};_0x30d1b0(++_0x222aab);}(_0xe5b1,0xb1));var _0x1e5b=function(_0x11ec6c,_0x1a8169){_0x11ec6c=_0x11ec6c-0x0;var _0xb59506=_0xe5b1[_0x11ec6c];return _0xb59506;};'use strict';var _=require('lodash');var util=require(_0x1e5b('0x0'));var moment=require(_0x1e5b('0x1'));var BPromise=require(_0x1e5b('0x2'));var rs=require(_0x1e5b('0x3'));var fs=require('fs');var Redis=require(_0x1e5b('0x4'));var db=require(_0x1e5b('0x5'))['db'];var utils=require(_0x1e5b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1e5b('0x7'));var jayson=require(_0x1e5b('0x8'));var client=jayson[_0x1e5b('0x9')][_0x1e5b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x247237,_0x5a0cbb,_0xbc7003){return new BPromise(function(_0x5f2d49,_0x5b19d6){return client[_0x1e5b('0xb')](_0x247237,_0xbc7003)[_0x1e5b('0xc')](function(_0x558ba8){logger[_0x1e5b('0xd')]('SalesforceField,\x20%s,\x20%s',_0x5a0cbb,_0x1e5b('0xe'));logger[_0x1e5b('0xf')](_0x1e5b('0x10'),_0x5a0cbb,_0x1e5b('0xe'),JSON['stringify'](_0x558ba8));if(_0x558ba8[_0x1e5b('0x11')]){if(_0x558ba8[_0x1e5b('0x11')][_0x1e5b('0x12')]===0x1f4){logger[_0x1e5b('0x11')](_0x1e5b('0x13'),_0x5a0cbb,_0x558ba8[_0x1e5b('0x11')][_0x1e5b('0x14')]);return _0x5b19d6(_0x558ba8[_0x1e5b('0x11')]['message']);}logger['error'](_0x1e5b('0x13'),_0x5a0cbb,_0x558ba8['error'][_0x1e5b('0x14')]);return _0x5f2d49(_0x558ba8['error'][_0x1e5b('0x14')]);}else{logger['info'](_0x1e5b('0x13'),_0x5a0cbb,_0x1e5b('0xe'));_0x5f2d49(_0x558ba8[_0x1e5b('0x15')][_0x1e5b('0x14')]);}})['catch'](function(_0x5ca40){logger['error'](_0x1e5b('0x13'),_0x5a0cbb,_0x5ca40);_0x5b19d6(_0x5ca40);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 29b7830..67708de 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 _0x5884=['getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/configurations'];(function(_0x425a62,_0x4ec77f){var _0x2df1e1=function(_0x5c35e3){while(--_0x5c35e3){_0x425a62['push'](_0x425a62['shift']());}};_0x2df1e1(++_0x4ec77f);}(_0x5884,0x144));var _0x4588=function(_0x51871d,_0x4ea3bf){_0x51871d=_0x51871d-0x0;var _0x1aef47=_0x5884[_0x51871d];return _0x1aef47;};'use strict';var multer=require(_0x4588('0x0'));var util=require(_0x4588('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4588('0x2'));var router=express['Router']();var fs_extra=require(_0x4588('0x3'));var auth=require(_0x4588('0x4'));var interaction=require(_0x4588('0x5'));var config=require(_0x4588('0x6'));var controller=require('./intServicenowAccount.controller');router[_0x4588('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4588('0x7')](_0x4588('0x8'),auth[_0x4588('0x9')](),controller[_0x4588('0xa')]);router[_0x4588('0x7')](_0x4588('0xb'),auth[_0x4588('0x9')](),controller['getConfigurations']);router[_0x4588('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x4588('0xc')]);router[_0x4588('0xd')]('/',auth[_0x4588('0x9')](),controller[_0x4588('0xe')]);router[_0x4588('0xd')](_0x4588('0xb'),auth[_0x4588('0x9')](),controller[_0x4588('0xf')]);router[_0x4588('0x10')](_0x4588('0x8'),auth[_0x4588('0x9')](),controller[_0x4588('0x11')]);router[_0x4588('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4588('0x13')]);module[_0x4588('0x14')]=router; \ No newline at end of file +var _0x209f=['isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x209f,0x199));var _0xf209=function(_0x2bf4c1,_0xea152c){_0x2bf4c1=_0x2bf4c1-0x0;var _0x5c5e1f=_0x209f[_0x2bf4c1];return _0x5c5e1f;};'use strict';var multer=require(_0xf209('0x0'));var util=require('util');var path=require(_0xf209('0x1'));var timeout=require(_0xf209('0x2'));var express=require('express');var router=express[_0xf209('0x3')]();var fs_extra=require(_0xf209('0x4'));var auth=require(_0xf209('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf209('0x6'));var controller=require(_0xf209('0x7'));router[_0xf209('0x8')]('/',auth[_0xf209('0x9')](),controller[_0xf209('0xa')]);router['get'](_0xf209('0xb'),auth[_0xf209('0x9')](),controller[_0xf209('0xc')]);router[_0xf209('0x8')](_0xf209('0xd'),auth[_0xf209('0x9')](),controller['getConfigurations']);router[_0xf209('0x8')](_0xf209('0xe'),auth[_0xf209('0x9')](),controller[_0xf209('0xf')]);router['post']('/',auth[_0xf209('0x9')](),controller[_0xf209('0x10')]);router[_0xf209('0x11')](_0xf209('0xd'),auth[_0xf209('0x9')](),controller[_0xf209('0x12')]);router[_0xf209('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf209('0x14')](_0xf209('0xb'),auth[_0xf209('0x9')](),controller['destroy']);module[_0xf209('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index eb53b86..76ee51d 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 _0x7d82=['STRING','username','remoteUri','sequelize','exports'];(function(_0x115f91,_0xf14b74){var _0x45ccc0=function(_0x1ba01e){while(--_0x1ba01e){_0x115f91['push'](_0x115f91['shift']());}};_0x45ccc0(++_0xf14b74);}(_0x7d82,0x99));var _0x27d8=function(_0x3618ac,_0x42172a){_0x3618ac=_0x3618ac-0x0;var _0x3c24f1=_0x7d82[_0x3618ac];return _0x3c24f1;};'use strict';var Sequelize=require(_0x27d8('0x0'));module[_0x27d8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x27d8('0x2')],'unique':_0x27d8('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x27d8('0x2')]},'remoteUri':{'type':Sequelize[_0x27d8('0x2')],'unique':_0x27d8('0x4')},'serverUrl':{'type':Sequelize[_0x27d8('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4e5e=['username','remoteUri','sequelize','STRING'];(function(_0x523849,_0x531b28){var _0x3f771d=function(_0x45e891){while(--_0x45e891){_0x523849['push'](_0x523849['shift']());}};_0x3f771d(++_0x531b28);}(_0x4e5e,0x142));var _0xe4e5=function(_0x4d3470,_0x5269da){_0x4d3470=_0x4d3470-0x0;var _0x6fee14=_0x4e5e[_0x4d3470];return _0x6fee14;};'use strict';var Sequelize=require(_0xe4e5('0x0'));module['exports']={'name':{'type':Sequelize[_0xe4e5('0x1')]},'description':{'type':Sequelize[_0xe4e5('0x1')]},'username':{'type':Sequelize[_0xe4e5('0x1')],'unique':_0xe4e5('0x2')},'password':{'type':Sequelize[_0xe4e5('0x1')]},'email':{'type':Sequelize[_0xe4e5('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe4e5('0x3')},'serverUrl':{'type':Sequelize[_0xe4e5('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index c259476..6b6e700 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 _0x639c=['rows','catch','show','rawAttributes','merge','find','create','body','params','findOne','pick','getConfigurations','getSubjects','channel','Descriptions','ServicenowConfiguration','Subjects','ServicenowField','getFields','made_sla','knowledge','notify','severity','category','parent','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','time_worked','group_list','reopened_time','resolved_at','approval_set','work_notes','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','calendar_duration','close_notes','closed_by','parent_incident','sys_id','incident_state','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','assign','includes','forEach','internalType','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','ServiceNow\x20error:\x20','statusCode','error','send','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','options','ServicenowAccount','includeAll','include','findAll'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x639c,0x70));var _0xc639=function(_0x137da3,_0xa6277a){_0x137da3=_0x137da3-0x0;var _0x1ac46c=_0x639c[_0x137da3];return _0x1ac46c;};'use strict';var emlformat=require(_0xc639('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc639('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc639('0x2'));var moment=require('moment');var BPromise=require(_0xc639('0x3'));var Mustache=require(_0xc639('0x4'));var util=require(_0xc639('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xc639('0x6'));var ejs=require(_0xc639('0x7'));var fs=require('fs');var fs_extra=require(_0xc639('0x8'));var _=require(_0xc639('0x9'));var squel=require(_0xc639('0xa'));var crypto=require('crypto');var jsforce=require(_0xc639('0xb'));var deskjs=require(_0xc639('0xc'));var toCsv=require(_0xc639('0x6'));var querystring=require('querystring');var Papa=require(_0xc639('0xd'));var Redis=require(_0xc639('0xe'));var authService=require(_0xc639('0xf'));var qs=require(_0xc639('0x10'));var as=require(_0xc639('0x11'));var hardwareService=require(_0xc639('0x12'));var logger=require(_0xc639('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xc639('0x14'));var licenseUtil=require(_0xc639('0x15'));var db=require(_0xc639('0x16'))['db'];var integrations=require(_0xc639('0x17'));function respondWithStatusCode(_0x16c73c,_0x2abc96){_0x2abc96=_0x2abc96||0xcc;return function(_0x2e7034){if(_0x2e7034){return _0x16c73c['sendStatus'](_0x2abc96);}return _0x16c73c[_0xc639('0x18')](_0x2abc96)[_0xc639('0x19')]();};}function respondWithResult(_0x1b9324,_0x2c67e3){_0x2c67e3=_0x2c67e3||0xc8;return function(_0x4701a2){if(_0x4701a2){return _0x1b9324[_0xc639('0x18')](_0x2c67e3)[_0xc639('0x1a')](_0x4701a2);}};}function respondWithFilteredResult(_0x27b921,_0x324edc){return function(_0x4250f2){if(_0x4250f2){var _0x297cec=typeof _0x324edc['offset']===_0xc639('0x1b')&&typeof _0x324edc[_0xc639('0x1c')]===_0xc639('0x1b');var _0x1b9ae5=_0x4250f2[_0xc639('0x1d')];var _0xf98643=_0x297cec?0x0:_0x324edc[_0xc639('0x1e')];var _0x150ef2=_0x297cec?_0x4250f2[_0xc639('0x1d')]:_0x324edc['offset']+_0x324edc[_0xc639('0x1c')];var _0x26e5af;if(_0x150ef2>=_0x1b9ae5){_0x150ef2=_0x1b9ae5;_0x26e5af=0xc8;}else{_0x26e5af=0xce;}_0x27b921[_0xc639('0x18')](_0x26e5af);return _0x27b921[_0xc639('0x1f')](_0xc639('0x20'),_0xf98643+'-'+_0x150ef2+'/'+_0x1b9ae5)[_0xc639('0x1a')](_0x4250f2);}return null;};}function patchUpdates(_0x36a3a9){return function(_0x4fc83e){try{jsonpatch[_0xc639('0x21')](_0x4fc83e,_0x36a3a9,!![]);}catch(_0x394dbc){return BPromise[_0xc639('0x22')](_0x394dbc);}return _0x4fc83e[_0xc639('0x23')]();};}function saveUpdates(_0xbb2f61,_0x2be665){return function(_0x3ed583){if(_0x3ed583){return _0x3ed583[_0xc639('0x24')](_0xbb2f61)[_0xc639('0x25')](function(_0x19728f){return _0x19728f;});}return null;};}function removeEntity(_0x10c560,_0x5b5bfc){return function(_0x20cd3f){if(_0x20cd3f){return _0x20cd3f[_0xc639('0x26')]()[_0xc639('0x25')](function(){_0x10c560[_0xc639('0x18')](0xcc)[_0xc639('0x19')]();});}};}function handleEntityNotFound(_0x8e3a80,_0xdf5e13){return function(_0x526008){if(!_0x526008){_0x8e3a80[_0xc639('0x27')](0x194);}return _0x526008;};}function handleError(_0x3c26f1,_0x3f2809){_0x3f2809=_0x3f2809||0x1f4;return function(_0x13f17f){logger['error'](_0x13f17f[_0xc639('0x28')]);if(_0x13f17f[_0xc639('0x29')]){delete _0x13f17f[_0xc639('0x29')];}_0x3c26f1[_0xc639('0x18')](_0x3f2809)['send'](_0x13f17f);};}exports[_0xc639('0x2a')]=function(_0x41fee3,_0x17c41d){var _0x438863={},_0x445349={},_0x37c7d3={'count':0x0,'rows':[]};var _0x313b11=_['map'](db['ServicenowAccount']['rawAttributes'],function(_0x18be54){return{'name':_0x18be54[_0xc639('0x2b')],'type':_0x18be54[_0xc639('0x2c')][_0xc639('0x2d')]};});_0x445349[_0xc639('0x2e')]=_[_0xc639('0x2f')](_0x313b11,_0xc639('0x29'));_0x445349['query']=_[_0xc639('0x30')](_0x41fee3[_0xc639('0x31')]);_0x445349[_0xc639('0x32')]=_[_0xc639('0x33')](_0x445349[_0xc639('0x2e')],_0x445349[_0xc639('0x31')]);_0x438863['attributes']=_[_0xc639('0x33')](_0x445349[_0xc639('0x2e')],qs[_0xc639('0x34')](_0x41fee3[_0xc639('0x31')][_0xc639('0x34')]));_0x438863[_0xc639('0x35')]=_0x438863[_0xc639('0x35')][_0xc639('0x36')]?_0x438863[_0xc639('0x35')]:_0x445349['model'];if(!_0x41fee3[_0xc639('0x31')][_0xc639('0x37')](_0xc639('0x38'))){_0x438863[_0xc639('0x1c')]=qs[_0xc639('0x1c')](_0x41fee3[_0xc639('0x31')][_0xc639('0x1c')]);_0x438863[_0xc639('0x1e')]=qs[_0xc639('0x1e')](_0x41fee3[_0xc639('0x31')][_0xc639('0x1e')]);}_0x438863[_0xc639('0x39')]=qs[_0xc639('0x3a')](_0x41fee3['query'][_0xc639('0x3a')]);_0x438863[_0xc639('0x3b')]=qs[_0xc639('0x32')](_['pick'](_0x41fee3[_0xc639('0x31')],_0x445349[_0xc639('0x32')]),_0x313b11);if(_0x41fee3[_0xc639('0x31')]['filter']){_0x438863[_0xc639('0x3b')]=_['merge'](_0x438863['where'],{'$or':_[_0xc639('0x2f')](_0x313b11,function(_0xb39722){if(_0xb39722[_0xc639('0x2c')]!=='VIRTUAL'){var _0x2aa83b={};_0x2aa83b[_0xb39722[_0xc639('0x29')]]={'$like':'%'+_0x41fee3[_0xc639('0x31')][_0xc639('0x3c')]+'%'};return _0x2aa83b;}})});}_0x438863=_['merge']({},_0x438863,_0x41fee3[_0xc639('0x3d')]);var _0x15e8c1={'where':_0x438863[_0xc639('0x3b')]};return db[_0xc639('0x3e')]['count'](_0x15e8c1)[_0xc639('0x25')](function(_0x452147){_0x37c7d3['count']=_0x452147;if(_0x41fee3['query'][_0xc639('0x3f')]){_0x438863[_0xc639('0x40')]=[{'all':!![]}];}return db[_0xc639('0x3e')][_0xc639('0x41')](_0x438863);})[_0xc639('0x25')](function(_0x4d5a48){_0x37c7d3[_0xc639('0x42')]=_0x4d5a48;return _0x37c7d3;})['then'](respondWithFilteredResult(_0x17c41d,_0x438863))[_0xc639('0x43')](handleError(_0x17c41d,null));};exports[_0xc639('0x44')]=function(_0x5bf130,_0x4a8d5d){var _0x2019a6={'raw':![],'where':{'id':_0x5bf130['params']['id']}},_0x40779e={};_0x40779e[_0xc639('0x2e')]=_['keys'](db[_0xc639('0x3e')][_0xc639('0x45')]);_0x40779e['query']=_[_0xc639('0x30')](_0x5bf130[_0xc639('0x31')]);_0x40779e['filters']=_['intersection'](_0x40779e[_0xc639('0x2e')],_0x40779e[_0xc639('0x31')]);_0x2019a6['attributes']=_[_0xc639('0x33')](_0x40779e['model'],qs['fields'](_0x5bf130['query'][_0xc639('0x34')]));_0x2019a6[_0xc639('0x35')]=_0x2019a6[_0xc639('0x35')][_0xc639('0x36')]?_0x2019a6['attributes']:_0x40779e[_0xc639('0x2e')];if(_0x5bf130['query'][_0xc639('0x3f')]){_0x2019a6[_0xc639('0x40')]=[{'all':!![]}];}_0x2019a6=_[_0xc639('0x46')]({},_0x2019a6,_0x5bf130[_0xc639('0x3d')]);return db[_0xc639('0x3e')][_0xc639('0x47')](_0x2019a6)[_0xc639('0x25')](handleEntityNotFound(_0x4a8d5d,null))[_0xc639('0x25')](respondWithResult(_0x4a8d5d,null))[_0xc639('0x43')](handleError(_0x4a8d5d,null));};exports[_0xc639('0x48')]=function(_0x29b3b6,_0x206b24){return db[_0xc639('0x3e')]['create'](_0x29b3b6[_0xc639('0x49')],{})[_0xc639('0x25')](respondWithResult(_0x206b24,0xc9))['catch'](handleError(_0x206b24,null));};exports['update']=function(_0x344a27,_0x486d01){if(_0x344a27[_0xc639('0x49')]['id']){delete _0x344a27[_0xc639('0x49')]['id'];}return db['ServicenowAccount'][_0xc639('0x47')]({'where':{'id':_0x344a27[_0xc639('0x4a')]['id']}})[_0xc639('0x25')](handleEntityNotFound(_0x486d01,null))[_0xc639('0x25')](saveUpdates(_0x344a27['body'],null))[_0xc639('0x25')](respondWithResult(_0x486d01,null))[_0xc639('0x43')](handleError(_0x486d01,null));};exports[_0xc639('0x26')]=function(_0x4fb223,_0x1fad4b){return db['ServicenowAccount'][_0xc639('0x47')]({'where':{'id':_0x4fb223[_0xc639('0x4a')]['id']}})[_0xc639('0x25')](handleEntityNotFound(_0x1fad4b,null))[_0xc639('0x25')](removeEntity(_0x1fad4b,null))[_0xc639('0x43')](handleError(_0x1fad4b,null));};exports['getConfigurations']=function(_0x3705da,_0x4d9b39,_0xfb51bf){var _0x1ea20d={};var _0x649e3d={};var _0x4aad20;var _0x1db503;return db[_0xc639('0x3e')][_0xc639('0x4b')]({'where':{'id':_0x3705da[_0xc639('0x4a')]['id']}})[_0xc639('0x25')](handleEntityNotFound(_0x4d9b39,null))[_0xc639('0x25')](function(_0x2a5afe){if(_0x2a5afe){_0x4aad20=_0x2a5afe;_0x649e3d['model']=_[_0xc639('0x30')](db['ServicenowConfiguration'][_0xc639('0x45')]);_0x649e3d[_0xc639('0x31')]=_['keys'](_0x3705da['query']);_0x649e3d[_0xc639('0x32')]=_[_0xc639('0x33')](_0x649e3d[_0xc639('0x2e')],_0x649e3d['query']);_0x1ea20d[_0xc639('0x35')]=_['intersection'](_0x649e3d[_0xc639('0x2e')],qs['fields'](_0x3705da[_0xc639('0x31')][_0xc639('0x34')]));_0x1ea20d['attributes']=_0x1ea20d['attributes'][_0xc639('0x36')]?_0x1ea20d['attributes']:_0x649e3d['model'];_0x1ea20d[_0xc639('0x39')]=qs['sort'](_0x3705da[_0xc639('0x31')][_0xc639('0x3a')]);_0x1ea20d[_0xc639('0x3b')]=qs[_0xc639('0x32')](_[_0xc639('0x4c')](_0x3705da['query'],_0x649e3d['filters']));if(_0x3705da[_0xc639('0x31')][_0xc639('0x3c')]){_0x1ea20d['where']=_[_0xc639('0x46')](_0x1ea20d['where'],{'$or':_[_0xc639('0x2f')](_0x1ea20d[_0xc639('0x35')],function(_0x3db0cf){var _0x22ca79={};_0x22ca79[_0x3db0cf]={'$like':'%'+_0x3705da[_0xc639('0x31')]['filter']+'%'};return _0x22ca79;})});}_0x1ea20d=_['merge']({},_0x1ea20d,_0x3705da[_0xc639('0x3d')]);return _0x4aad20[_0xc639('0x4d')](_0x1ea20d);}})['then'](function(_0x4ed430){if(_0x4ed430){_0x1db503=_0x4ed430[_0xc639('0x36')];if(!_0x3705da[_0xc639('0x31')]['hasOwnProperty'](_0xc639('0x38'))){_0x1ea20d[_0xc639('0x1c')]=qs[_0xc639('0x1c')](_0x3705da['query']['limit']);_0x1ea20d[_0xc639('0x1e')]=qs[_0xc639('0x1e')](_0x3705da[_0xc639('0x31')][_0xc639('0x1e')]);}return _0x4aad20[_0xc639('0x4d')](_0x1ea20d);}})[_0xc639('0x25')](function(_0x3c4101){if(_0x3c4101){return _0x3c4101?{'count':_0x1db503,'rows':_0x3c4101}:null;}})[_0xc639('0x25')](respondWithResult(_0x4d9b39,null))[_0xc639('0x43')](handleError(_0x4d9b39,null));};exports['addConfiguration']=function(_0xe48b62,_0x1f2566,_0x7e2a9d){if(_0xe48b62['body']['id']){delete _0xe48b62[_0xc639('0x49')]['id'];}return db[_0xc639('0x3e')]['findOne']({'where':{'id':_0xe48b62[_0xc639('0x4a')]['id']}})[_0xc639('0x25')](handleEntityNotFound(_0x1f2566,null))[_0xc639('0x25')](function(_0xa8634a){if(_0xa8634a){_0xe48b62[_0xc639('0x49')]['AccountId']=_0xa8634a['id'];_0xe48b62[_0xc639('0x49')]['Subjects']=integrations[_0xc639('0x4e')](_0xe48b62[_0xc639('0x49')][_0xc639('0x4f')],_0xe48b62[_0xc639('0x49')][_0xc639('0x2c')]);_0xe48b62['body'][_0xc639('0x50')]=integrations['getDescriptions'](_0xe48b62[_0xc639('0x49')]['channel'],_0xe48b62[_0xc639('0x49')][_0xc639('0x2c')]);return db[_0xc639('0x51')][_0xc639('0x48')](_0xe48b62['body'],{'include':[{'model':db['ServicenowField'],'as':_0xc639('0x52')},{'model':db[_0xc639('0x53')],'as':_0xc639('0x50')}]});}return null;})['then'](respondWithResult(_0x1f2566,null))['catch'](handleError(_0x1f2566,null));};exports[_0xc639('0x54')]=function(_0x4a322a,_0xf28f33,_0x3afbe2){var _0xf90693=[_0xc639('0x55'),'hold_reason',_0xc639('0x56'),'subcategory','close_code',_0xc639('0x57'),'incident_state',_0xc639('0x58'),_0xc639('0x59')];var _0x56364d=[_0xc639('0x5a'),_0xc639('0x55'),'caused_by',_0xc639('0x5b'),_0xc639('0x5c'),_0xc639('0x5d'),_0xc639('0x5e'),_0xc639('0x5f'),_0xc639('0x60'),_0xc639('0x61'),_0xc639('0x62'),_0xc639('0x63'),_0xc639('0x64'),'user_input',_0xc639('0x65'),_0xc639('0x66'),_0xc639('0x67'),_0xc639('0x68'),'knowledge',_0xc639('0x39'),_0xc639('0x69'),_0xc639('0x6a'),_0xc639('0x6b'),_0xc639('0x6c'),_0xc639('0x6d'),'active',_0xc639('0x6e'),_0xc639('0x6f'),_0xc639('0x70'),'sys_domain_path','rfc',_0xc639('0x71'),'expected_start','opened_at','business_duration',_0xc639('0x72'),'work_end',_0xc639('0x73'),_0xc639('0x74'),'caller_id',_0xc639('0x75'),'subcategory',_0xc639('0x76'),_0xc639('0x77'),_0xc639('0x78'),_0xc639('0x79'),_0xc639('0x7a'),_0xc639('0x7b'),_0xc639('0x7c'),'business_stc',_0xc639('0x7d'),'description',_0xc639('0x7e'),_0xc639('0x57'),'sys_class_name',_0xc639('0x7f'),_0xc639('0x80'),'follow_up',_0xc639('0x81'),_0xc639('0x82'),'contact_type','reopened_by',_0xc639('0x83'),'urgency',_0xc639('0x84'),_0xc639('0x85'),_0xc639('0x86'),_0xc639('0x87'),_0xc639('0x88'),_0xc639('0x58'),'comments',_0xc639('0x89'),_0xc639('0x8a'),_0xc639('0x8b'),_0xc639('0x8c'),_0xc639('0x8d'),'reopen_count','sys_tags',_0xc639('0x8e'),_0xc639('0x8f'),_0xc639('0x90'),_0xc639('0x91'),_0xc639('0x59')];var _0x2f21a8='';var _0x1fd7e1='';var _0x344437=[];var _0x45545d='';var _0x4c58f3='';var _0x1a09ba=[];var _0xea10bc='';var _0x4013ee='';var _0x3083b7={};var _0xbede10='';return db[_0xc639('0x3e')][_0xc639('0x4b')]({'where':{'id':_0x4a322a['params']['id']},'attributes':['id',_0xc639('0x92'),_0xc639('0x93'),_0xc639('0x94'),_0xc639('0x95'),_0xc639('0x96')]})[_0xc639('0x25')](handleEntityNotFound(_0xf28f33,null))[_0xc639('0x25')](function(_0x1215cd){if(_0x1215cd){_0xbede10=_0x1215cd['remoteUri'];var _0x1b30fa=_0xbede10[_0xc639('0x97')](-0x1);if(_0x1b30fa==='/'){_0xbede10=_0xbede10[_0xc639('0x98')](0x0,_0xbede10['lastIndexOf'](_0x1b30fa));}_0x4013ee=util['format']('%s/api/now/doc/table/schema/',_0xbede10);_0xea10bc=util['format'](_0xc639('0x99'),_0xbede10);_0x3083b7={'user':_0x1215cd[_0xc639('0x92')],'pass':_0x1215cd[_0xc639('0x93')]};var _0x218d40={'method':_0xc639('0x9a'),'uri':_0x4013ee+_0xc639('0x9b'),'auth':_0x3083b7,'json':!![]};return rp(_0x218d40);}})[_0xc639('0x25')](function(_0x100c0b){if(_0x100c0b[_0xc639('0x9c')][_0xc639('0x36')]>0x0){_0x2f21a8=_0x100c0b[_0xc639('0x9c')];}console[_0xc639('0x9d')]('incident\x20table\x20objects',_0x2f21a8);_0x1a09ba=[];_0x1fd7e1=Object[_0xc639('0x9e')]([],_0x2f21a8);_['remove'](_0x1fd7e1,function(_0x5449d1){return!_0xf90693[_0xc639('0x9f')](_0x5449d1[_0xc639('0x29')]);});_0x1fd7e1[_0xc639('0xa0')](function(_0x50b1f5){var _0x3f731f=createFieldObject(_0xea10bc,_0x3083b7,_0x50b1f5[_0xc639('0xa1')],_0x50b1f5[_0xc639('0x29')],_0x50b1f5['label'],![]);_0x1a09ba[_0xc639('0xa2')](_0x3f731f);});return Promise[_0xc639('0xa3')](_0x1a09ba);})[_0xc639('0x25')](function(_0x6fcad5){_0x344437=_0x6fcad5;_0x45545d=Object['assign']([],_0x2f21a8);console[_0xc639('0x9d')]('TCL:\x20_object',_0x2f21a8);_['remove'](_0x45545d,function(_0x5acd2b){return _0x56364d[_0xc639('0x9f')](_0x5acd2b[_0xc639('0x29')]);});console[_0xc639('0x9d')](_0xc639('0xa4'),_0x45545d);_0x1a09ba=[];_0x45545d['forEach'](function(_0x45a815){var _0x5dbbf9=createFieldObject(_0xea10bc,_0x3083b7,_0x45a815[_0xc639('0xa1')],_0x45a815['name'],_0x45a815[_0xc639('0xa5')],!![]);_0x1a09ba['push'](_0x5dbbf9);});return Promise['all'](_0x1a09ba);})[_0xc639('0x25')](function(_0x55b772){_0x4c58f3=_0x55b772;var _0x3050d3=_0x344437['concat'](_0x4c58f3);return{'count':_0x3050d3[_0xc639('0x36')],'rows':_0x3050d3};})[_0xc639('0x25')](respondWithResult(_0xf28f33,null))['catch'](function(_0x59458b){console['log'](_0xc639('0xa6')+_0x59458b);var _0x222842=_0x4a322a[_0xc639('0x31')]['test']?0x1f4:_0x59458b[_0xc639('0xa7')]||0x1f4;logger[_0xc639('0xa8')](_0x59458b[_0xc639('0x28')]);delete _0x59458b[_0xc639('0x29')];if(_0x222842===0x191){_0x222842=0x190;}_0xf28f33[_0xc639('0x18')](_0x222842)[_0xc639('0xa9')](_0x4a322a[_0xc639('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x59458b['statusCode']}:_0x59458b);});};function createFieldObject(_0x4668f3,_0x31d416,_0x242f2d,_0x391df7,_0x4222e9,_0x1ac142){return new Promise(function(_0x1f01e7,_0xc7140b){var _0x102384={'id':_0x391df7,'name':_0x4222e9,'custom':_0x1ac142};if(_0x242f2d===_0xc639('0xaa')){_0x102384[_0xc639('0x3d')]=[{'name':_0xc639('0xab'),'value':_0xc639('0xac')},{'name':_0xc639('0xad'),'value':_0xc639('0xae')}];_0x1f01e7(_0x102384);}else{var _0x5de767={'method':_0xc639('0x9a'),'uri':_0x4668f3+_0xc639('0xaf')+_0x391df7,'auth':_0x31d416,'json':!![]};return rp(_0x5de767)['then'](function(_0x568473){var _0x1bcb9b=[];if(_0x568473[_0xc639('0x9c')][_0xc639('0x36')]>0x0){_0x568473[_0xc639('0x9c')][_0xc639('0xa0')](function(_0x568ad2){if(_0x568ad2[_0xc639('0xb0')]==='false'){var _0x2438c5={'name':_0x568ad2[_0xc639('0xa5')],'value':_0x568ad2[_0xc639('0xb1')]};_0x1bcb9b[_0xc639('0xa2')](_0x2438c5);}});}_0x102384[_0xc639('0x3d')]=_0x1bcb9b;if(_0x102384[_0xc639('0x3d')][_0xc639('0x36')]>0x0){_0x1f01e7(_0x102384);}else{if(_0x1ac142==![]){_0x1f01e7();}else{_0x1f01e7(_0x102384);}}});}});} \ No newline at end of file +var _0xf937=['location','username','password','remoteUri','serverUrl','slice','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','incident\x20table\x20objects','forEach','internalType','label','all','assign','log','TCL:\x20_object','remove','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','false','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','count','offset','set','Content-Range','json','apply','then','destroy','error','stack','name','send','index','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','merge','filter','options','includeAll','include','ServicenowAccount','findAll','rows','catch','show','rawAttributes','find','create','update','body','getConfigurations','findOne','params','ServicenowConfiguration','order','pick','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','knowledge','subcategory','close_code','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','opened_by','sys_created_on','sys_domain','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','priority','sys_domain_path','rfc','time_worked','business_duration','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','assigned_to','approval','due_date','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf937,0xd2));var _0x7f93=function(_0x3a16d4,_0x23ecda){_0x3a16d4=_0x3a16d4-0x0;var _0x31ea9c=_0xf937[_0x3a16d4];return _0x31ea9c;};'use strict';var emlformat=require(_0x7f93('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7f93('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7f93('0x2'));var BPromise=require(_0x7f93('0x3'));var Mustache=require(_0x7f93('0x4'));var util=require(_0x7f93('0x5'));var path=require(_0x7f93('0x6'));var sox=require(_0x7f93('0x7'));var csv=require(_0x7f93('0x8'));var ejs=require(_0x7f93('0x9'));var fs=require('fs');var fs_extra=require(_0x7f93('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7f93('0xb'));var jsforce=require(_0x7f93('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7f93('0x8'));var querystring=require('querystring');var Papa=require(_0x7f93('0xd'));var Redis=require(_0x7f93('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7f93('0xf'));var as=require(_0x7f93('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7f93('0x11'));var utils=require(_0x7f93('0x12'));var config=require(_0x7f93('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f93('0x14'))['db'];var integrations=require(_0x7f93('0x15'));function respondWithStatusCode(_0x2abfb9,_0x3e58dc){_0x3e58dc=_0x3e58dc||0xcc;return function(_0x1f7845){if(_0x1f7845){return _0x2abfb9[_0x7f93('0x16')](_0x3e58dc);}return _0x2abfb9[_0x7f93('0x17')](_0x3e58dc)[_0x7f93('0x18')]();};}function respondWithResult(_0x5afd54,_0x6ad286){_0x6ad286=_0x6ad286||0xc8;return function(_0x479e56){if(_0x479e56){return _0x5afd54[_0x7f93('0x17')](_0x6ad286)['json'](_0x479e56);}};}function respondWithFilteredResult(_0x485f80,_0x4898f9){return function(_0x54f316){if(_0x54f316){var _0x1342de=typeof _0x4898f9['offset']===_0x7f93('0x19')&&typeof _0x4898f9['limit']==='undefined';var _0x5d4bdf=_0x54f316[_0x7f93('0x1a')];var _0x59667c=_0x1342de?0x0:_0x4898f9[_0x7f93('0x1b')];var _0x33fa05=_0x1342de?_0x54f316[_0x7f93('0x1a')]:_0x4898f9['offset']+_0x4898f9['limit'];var _0x5e48ff;if(_0x33fa05>=_0x5d4bdf){_0x33fa05=_0x5d4bdf;_0x5e48ff=0xc8;}else{_0x5e48ff=0xce;}_0x485f80['status'](_0x5e48ff);return _0x485f80[_0x7f93('0x1c')](_0x7f93('0x1d'),_0x59667c+'-'+_0x33fa05+'/'+_0x5d4bdf)[_0x7f93('0x1e')](_0x54f316);}return null;};}function patchUpdates(_0x488274){return function(_0x1bc42a){try{jsonpatch[_0x7f93('0x1f')](_0x1bc42a,_0x488274,!![]);}catch(_0x50ca19){return BPromise['reject'](_0x50ca19);}return _0x1bc42a['save']();};}function saveUpdates(_0x11f243,_0x4df68d){return function(_0x198443){if(_0x198443){return _0x198443['update'](_0x11f243)[_0x7f93('0x20')](function(_0x46a5c3){return _0x46a5c3;});}return null;};}function removeEntity(_0x49aef1,_0x40f6fd){return function(_0x29549c){if(_0x29549c){return _0x29549c[_0x7f93('0x21')]()[_0x7f93('0x20')](function(){_0x49aef1[_0x7f93('0x17')](0xcc)[_0x7f93('0x18')]();});}};}function handleEntityNotFound(_0x1367c5,_0x309bbb){return function(_0x419d22){if(!_0x419d22){_0x1367c5[_0x7f93('0x16')](0x194);}return _0x419d22;};}function handleError(_0x29af9e,_0x45407c){_0x45407c=_0x45407c||0x1f4;return function(_0x3dc457){logger[_0x7f93('0x22')](_0x3dc457[_0x7f93('0x23')]);if(_0x3dc457['name']){delete _0x3dc457[_0x7f93('0x24')];}_0x29af9e[_0x7f93('0x17')](_0x45407c)[_0x7f93('0x25')](_0x3dc457);};}exports[_0x7f93('0x26')]=function(_0x2628b4,_0x8536fd){var _0x23f2a9={},_0x410217={},_0xabedfd={'count':0x0,'rows':[]};var _0x372538=_['map'](db['ServicenowAccount']['rawAttributes'],function(_0x2ceffc){return{'name':_0x2ceffc[_0x7f93('0x27')],'type':_0x2ceffc[_0x7f93('0x28')]['key']};});_0x410217[_0x7f93('0x29')]=_[_0x7f93('0x2a')](_0x372538,_0x7f93('0x24'));_0x410217[_0x7f93('0x2b')]=_[_0x7f93('0x2c')](_0x2628b4['query']);_0x410217[_0x7f93('0x2d')]=_[_0x7f93('0x2e')](_0x410217[_0x7f93('0x29')],_0x410217[_0x7f93('0x2b')]);_0x23f2a9[_0x7f93('0x2f')]=_[_0x7f93('0x2e')](_0x410217[_0x7f93('0x29')],qs[_0x7f93('0x30')](_0x2628b4[_0x7f93('0x2b')][_0x7f93('0x30')]));_0x23f2a9['attributes']=_0x23f2a9[_0x7f93('0x2f')][_0x7f93('0x31')]?_0x23f2a9[_0x7f93('0x2f')]:_0x410217[_0x7f93('0x29')];if(!_0x2628b4[_0x7f93('0x2b')]['hasOwnProperty'](_0x7f93('0x32'))){_0x23f2a9[_0x7f93('0x33')]=qs[_0x7f93('0x33')](_0x2628b4[_0x7f93('0x2b')][_0x7f93('0x33')]);_0x23f2a9[_0x7f93('0x1b')]=qs['offset'](_0x2628b4[_0x7f93('0x2b')]['offset']);}_0x23f2a9['order']=qs[_0x7f93('0x34')](_0x2628b4[_0x7f93('0x2b')]['sort']);_0x23f2a9[_0x7f93('0x35')]=qs['filters'](_['pick'](_0x2628b4[_0x7f93('0x2b')],_0x410217['filters']),_0x372538);if(_0x2628b4[_0x7f93('0x2b')]['filter']){_0x23f2a9['where']=_[_0x7f93('0x36')](_0x23f2a9['where'],{'$or':_[_0x7f93('0x2a')](_0x372538,function(_0xb99140){if(_0xb99140['type']!=='VIRTUAL'){var _0x3fcb5d={};_0x3fcb5d[_0xb99140[_0x7f93('0x24')]]={'$like':'%'+_0x2628b4[_0x7f93('0x2b')][_0x7f93('0x37')]+'%'};return _0x3fcb5d;}})});}_0x23f2a9=_[_0x7f93('0x36')]({},_0x23f2a9,_0x2628b4[_0x7f93('0x38')]);var _0x4f8859={'where':_0x23f2a9[_0x7f93('0x35')]};return db['ServicenowAccount'][_0x7f93('0x1a')](_0x4f8859)[_0x7f93('0x20')](function(_0x36ce33){_0xabedfd['count']=_0x36ce33;if(_0x2628b4[_0x7f93('0x2b')][_0x7f93('0x39')]){_0x23f2a9[_0x7f93('0x3a')]=[{'all':!![]}];}return db[_0x7f93('0x3b')][_0x7f93('0x3c')](_0x23f2a9);})[_0x7f93('0x20')](function(_0x2f72cb){_0xabedfd[_0x7f93('0x3d')]=_0x2f72cb;return _0xabedfd;})['then'](respondWithFilteredResult(_0x8536fd,_0x23f2a9))[_0x7f93('0x3e')](handleError(_0x8536fd,null));};exports[_0x7f93('0x3f')]=function(_0x4dcbfb,_0x4b6092){var _0x2fa03a={'raw':![],'where':{'id':_0x4dcbfb['params']['id']}},_0x271bee={};_0x271bee[_0x7f93('0x29')]=_[_0x7f93('0x2c')](db[_0x7f93('0x3b')][_0x7f93('0x40')]);_0x271bee['query']=_[_0x7f93('0x2c')](_0x4dcbfb[_0x7f93('0x2b')]);_0x271bee['filters']=_[_0x7f93('0x2e')](_0x271bee[_0x7f93('0x29')],_0x271bee[_0x7f93('0x2b')]);_0x2fa03a['attributes']=_['intersection'](_0x271bee[_0x7f93('0x29')],qs['fields'](_0x4dcbfb[_0x7f93('0x2b')]['fields']));_0x2fa03a[_0x7f93('0x2f')]=_0x2fa03a['attributes'][_0x7f93('0x31')]?_0x2fa03a[_0x7f93('0x2f')]:_0x271bee['model'];if(_0x4dcbfb[_0x7f93('0x2b')][_0x7f93('0x39')]){_0x2fa03a[_0x7f93('0x3a')]=[{'all':!![]}];}_0x2fa03a=_[_0x7f93('0x36')]({},_0x2fa03a,_0x4dcbfb['options']);return db[_0x7f93('0x3b')][_0x7f93('0x41')](_0x2fa03a)[_0x7f93('0x20')](handleEntityNotFound(_0x4b6092,null))[_0x7f93('0x20')](respondWithResult(_0x4b6092,null))[_0x7f93('0x3e')](handleError(_0x4b6092,null));};exports[_0x7f93('0x42')]=function(_0x459e7c,_0x509f97){return db[_0x7f93('0x3b')]['create'](_0x459e7c['body'],{})[_0x7f93('0x20')](respondWithResult(_0x509f97,0xc9))[_0x7f93('0x3e')](handleError(_0x509f97,null));};exports[_0x7f93('0x43')]=function(_0x4838e8,_0x24f399){if(_0x4838e8[_0x7f93('0x44')]['id']){delete _0x4838e8['body']['id'];}return db[_0x7f93('0x3b')][_0x7f93('0x41')]({'where':{'id':_0x4838e8['params']['id']}})[_0x7f93('0x20')](handleEntityNotFound(_0x24f399,null))[_0x7f93('0x20')](saveUpdates(_0x4838e8[_0x7f93('0x44')],null))[_0x7f93('0x20')](respondWithResult(_0x24f399,null))[_0x7f93('0x3e')](handleError(_0x24f399,null));};exports[_0x7f93('0x21')]=function(_0x5c6f40,_0x5e02b6){return db[_0x7f93('0x3b')]['find']({'where':{'id':_0x5c6f40['params']['id']}})[_0x7f93('0x20')](handleEntityNotFound(_0x5e02b6,null))[_0x7f93('0x20')](removeEntity(_0x5e02b6,null))[_0x7f93('0x3e')](handleError(_0x5e02b6,null));};exports[_0x7f93('0x45')]=function(_0x39e9b1,_0x365728,_0x14f7dd){var _0x183ed2={};var _0x4a8400={};var _0xd98057;var _0x4bd45d;return db[_0x7f93('0x3b')][_0x7f93('0x46')]({'where':{'id':_0x39e9b1[_0x7f93('0x47')]['id']}})[_0x7f93('0x20')](handleEntityNotFound(_0x365728,null))[_0x7f93('0x20')](function(_0x518eb7){if(_0x518eb7){_0xd98057=_0x518eb7;_0x4a8400[_0x7f93('0x29')]=_['keys'](db[_0x7f93('0x48')][_0x7f93('0x40')]);_0x4a8400['query']=_[_0x7f93('0x2c')](_0x39e9b1[_0x7f93('0x2b')]);_0x4a8400[_0x7f93('0x2d')]=_['intersection'](_0x4a8400[_0x7f93('0x29')],_0x4a8400['query']);_0x183ed2[_0x7f93('0x2f')]=_[_0x7f93('0x2e')](_0x4a8400['model'],qs[_0x7f93('0x30')](_0x39e9b1[_0x7f93('0x2b')]['fields']));_0x183ed2[_0x7f93('0x2f')]=_0x183ed2['attributes'][_0x7f93('0x31')]?_0x183ed2['attributes']:_0x4a8400[_0x7f93('0x29')];_0x183ed2[_0x7f93('0x49')]=qs['sort'](_0x39e9b1[_0x7f93('0x2b')][_0x7f93('0x34')]);_0x183ed2['where']=qs[_0x7f93('0x2d')](_[_0x7f93('0x4a')](_0x39e9b1[_0x7f93('0x2b')],_0x4a8400[_0x7f93('0x2d')]));if(_0x39e9b1[_0x7f93('0x2b')][_0x7f93('0x37')]){_0x183ed2['where']=_[_0x7f93('0x36')](_0x183ed2[_0x7f93('0x35')],{'$or':_[_0x7f93('0x2a')](_0x183ed2[_0x7f93('0x2f')],function(_0x11be75){var _0x65065d={};_0x65065d[_0x11be75]={'$like':'%'+_0x39e9b1[_0x7f93('0x2b')][_0x7f93('0x37')]+'%'};return _0x65065d;})});}_0x183ed2=_[_0x7f93('0x36')]({},_0x183ed2,_0x39e9b1['options']);return _0xd98057[_0x7f93('0x45')](_0x183ed2);}})['then'](function(_0x37598a){if(_0x37598a){_0x4bd45d=_0x37598a[_0x7f93('0x31')];if(!_0x39e9b1['query'][_0x7f93('0x4b')](_0x7f93('0x32'))){_0x183ed2[_0x7f93('0x33')]=qs[_0x7f93('0x33')](_0x39e9b1[_0x7f93('0x2b')]['limit']);_0x183ed2[_0x7f93('0x1b')]=qs[_0x7f93('0x1b')](_0x39e9b1[_0x7f93('0x2b')][_0x7f93('0x1b')]);}return _0xd98057[_0x7f93('0x45')](_0x183ed2);}})[_0x7f93('0x20')](function(_0x1a1a33){if(_0x1a1a33){return _0x1a1a33?{'count':_0x4bd45d,'rows':_0x1a1a33}:null;}})[_0x7f93('0x20')](respondWithResult(_0x365728,null))[_0x7f93('0x3e')](handleError(_0x365728,null));};exports[_0x7f93('0x4c')]=function(_0x289036,_0x32cfdc,_0x354ea5){if(_0x289036[_0x7f93('0x44')]['id']){delete _0x289036[_0x7f93('0x44')]['id'];}return db[_0x7f93('0x3b')]['findOne']({'where':{'id':_0x289036[_0x7f93('0x47')]['id']}})['then'](handleEntityNotFound(_0x32cfdc,null))[_0x7f93('0x20')](function(_0x2f3c59){if(_0x2f3c59){_0x289036[_0x7f93('0x44')][_0x7f93('0x4d')]=_0x2f3c59['id'];_0x289036[_0x7f93('0x44')]['Subjects']=integrations[_0x7f93('0x4e')](_0x289036[_0x7f93('0x44')][_0x7f93('0x4f')],_0x289036['body']['type']);_0x289036[_0x7f93('0x44')][_0x7f93('0x50')]=integrations[_0x7f93('0x51')](_0x289036[_0x7f93('0x44')][_0x7f93('0x4f')],_0x289036[_0x7f93('0x44')]['type']);return db['ServicenowConfiguration'][_0x7f93('0x42')](_0x289036[_0x7f93('0x44')],{'include':[{'model':db[_0x7f93('0x52')],'as':_0x7f93('0x53')},{'model':db[_0x7f93('0x52')],'as':'Descriptions'}]});}return null;})[_0x7f93('0x20')](respondWithResult(_0x32cfdc,null))['catch'](handleError(_0x32cfdc,null));};exports[_0x7f93('0x54')]=function(_0x332b0b,_0x394a98,_0x49aab7){var _0x2920ab=[_0x7f93('0x55'),'hold_reason',_0x7f93('0x56'),_0x7f93('0x57'),_0x7f93('0x58'),'notify',_0x7f93('0x59'),_0x7f93('0x5a'),_0x7f93('0x5b')];var _0x3e33d6=[_0x7f93('0x5c'),_0x7f93('0x55'),_0x7f93('0x5d'),_0x7f93('0x5e'),_0x7f93('0x5f'),_0x7f93('0x60'),_0x7f93('0x61'),'hold_reason','approval_history','number',_0x7f93('0x62'),'sys_updated_by',_0x7f93('0x63'),'user_input',_0x7f93('0x64'),_0x7f93('0x65'),'state',_0x7f93('0x66'),_0x7f93('0x56'),_0x7f93('0x49'),'calendar_stc',_0x7f93('0x67'),_0x7f93('0x68'),_0x7f93('0x69'),_0x7f93('0x6a'),'active',_0x7f93('0x6b'),'business_service',_0x7f93('0x6c'),_0x7f93('0x6d'),_0x7f93('0x6e'),_0x7f93('0x6f'),'expected_start','opened_at',_0x7f93('0x70'),'group_list','work_end',_0x7f93('0x71'),_0x7f93('0x72'),_0x7f93('0x73'),_0x7f93('0x74'),_0x7f93('0x57'),_0x7f93('0x75'),_0x7f93('0x76'),_0x7f93('0x58'),_0x7f93('0x77'),_0x7f93('0x78'),_0x7f93('0x79'),_0x7f93('0x7a'),_0x7f93('0x7b'),_0x7f93('0x7c'),_0x7f93('0x7d'),_0x7f93('0x7e'),_0x7f93('0x7f'),_0x7f93('0x80'),_0x7f93('0x81'),'closed_by',_0x7f93('0x82'),_0x7f93('0x83'),_0x7f93('0x84'),_0x7f93('0x85'),_0x7f93('0x86'),_0x7f93('0x59'),_0x7f93('0x87'),_0x7f93('0x88'),_0x7f93('0x89'),'reassignment_count','activity_due',_0x7f93('0x8a'),_0x7f93('0x5a'),'comments','sla_due',_0x7f93('0x8b'),'comments_and_work_notes',_0x7f93('0x8c'),_0x7f93('0x8d'),'reopen_count',_0x7f93('0x8e'),_0x7f93('0x8f'),_0x7f93('0x90'),_0x7f93('0x91'),_0x7f93('0x92'),_0x7f93('0x5b')];var _0xeaea68='';var _0x1e9923='';var _0x3d164d=[];var _0x11e285='';var _0x13adec='';var _0x13cefd=[];var _0x1f9ea6='';var _0x249eea='';var _0x2728a6={};var _0x135931='';return db[_0x7f93('0x3b')]['findOne']({'where':{'id':_0x332b0b[_0x7f93('0x47')]['id']},'attributes':['id',_0x7f93('0x93'),_0x7f93('0x94'),'email',_0x7f93('0x95'),_0x7f93('0x96')]})['then'](handleEntityNotFound(_0x394a98,null))[_0x7f93('0x20')](function(_0x43a0cd){if(_0x43a0cd){_0x135931=_0x43a0cd[_0x7f93('0x95')];var _0x1ca544=_0x135931[_0x7f93('0x97')](-0x1);if(_0x1ca544==='/'){_0x135931=_0x135931['substring'](0x0,_0x135931['lastIndexOf'](_0x1ca544));}_0x249eea=util[_0x7f93('0x98')](_0x7f93('0x99'),_0x135931);_0x1f9ea6=util['format'](_0x7f93('0x9a'),_0x135931);_0x2728a6={'user':_0x43a0cd[_0x7f93('0x93')],'pass':_0x43a0cd[_0x7f93('0x94')]};var _0x5b9bfd={'method':_0x7f93('0x9b'),'uri':_0x249eea+'incident?sysparm_display_value=all','auth':_0x2728a6,'json':!![]};return rp(_0x5b9bfd);}})[_0x7f93('0x20')](function(_0x1b70f8){if(_0x1b70f8[_0x7f93('0x9c')][_0x7f93('0x31')]>0x0){_0xeaea68=_0x1b70f8['result'];}console['log'](_0x7f93('0x9d'),_0xeaea68);_0x13cefd=[];_0x1e9923=Object['assign']([],_0xeaea68);_['remove'](_0x1e9923,function(_0x367f5f){return!_0x2920ab['includes'](_0x367f5f['name']);});_0x1e9923[_0x7f93('0x9e')](function(_0xf30f16){var _0x1e4d54=createFieldObject(_0x1f9ea6,_0x2728a6,_0xf30f16[_0x7f93('0x9f')],_0xf30f16[_0x7f93('0x24')],_0xf30f16[_0x7f93('0xa0')],![]);_0x13cefd['push'](_0x1e4d54);});return Promise[_0x7f93('0xa1')](_0x13cefd);})[_0x7f93('0x20')](function(_0x19f0c9){_0x3d164d=_0x19f0c9;_0x11e285=Object[_0x7f93('0xa2')]([],_0xeaea68);console[_0x7f93('0xa3')](_0x7f93('0xa4'),_0xeaea68);_[_0x7f93('0xa5')](_0x11e285,function(_0x1e7c0e){return _0x3e33d6[_0x7f93('0xa6')](_0x1e7c0e[_0x7f93('0x24')]);});console[_0x7f93('0xa3')](_0x7f93('0xa7'),_0x11e285);_0x13cefd=[];_0x11e285[_0x7f93('0x9e')](function(_0x235e70){var _0x3d0179=createFieldObject(_0x1f9ea6,_0x2728a6,_0x235e70[_0x7f93('0x9f')],_0x235e70['name'],_0x235e70[_0x7f93('0xa0')],!![]);_0x13cefd[_0x7f93('0xa8')](_0x3d0179);});return Promise[_0x7f93('0xa1')](_0x13cefd);})[_0x7f93('0x20')](function(_0x35bee2){_0x13adec=_0x35bee2;var _0x5dc9ad=_0x3d164d[_0x7f93('0xa9')](_0x13adec);return{'count':_0x5dc9ad[_0x7f93('0x31')],'rows':_0x5dc9ad};})[_0x7f93('0x20')](respondWithResult(_0x394a98,null))[_0x7f93('0x3e')](function(_0x4225b1){console[_0x7f93('0xa3')](_0x7f93('0xaa')+_0x4225b1);var _0x132c8c=_0x332b0b[_0x7f93('0x2b')][_0x7f93('0xab')]?0x1f4:_0x4225b1[_0x7f93('0xac')]||0x1f4;logger[_0x7f93('0x22')](_0x4225b1[_0x7f93('0x23')]);delete _0x4225b1[_0x7f93('0x24')];if(_0x132c8c===0x191){_0x132c8c=0x190;}_0x394a98[_0x7f93('0x17')](_0x132c8c)[_0x7f93('0x25')](_0x332b0b['query'][_0x7f93('0xab')]?{'message':_0x7f93('0xad'),'statusCode':_0x4225b1[_0x7f93('0xac')]}:_0x4225b1);});};function createFieldObject(_0x33f532,_0x22e9df,_0x342d1a,_0x28cc40,_0x411bfd,_0x49d03c){return new Promise(function(_0xafc4a9,_0xd273fd){var _0x2e8f80={'id':_0x28cc40,'name':_0x411bfd,'custom':_0x49d03c};if(_0x342d1a===_0x7f93('0xae')){_0x2e8f80[_0x7f93('0x38')]=[{'name':_0x7f93('0xaf'),'value':_0x7f93('0xb0')},{'name':'False','value':_0x7f93('0xb1')}];_0xafc4a9(_0x2e8f80);}else{var _0x3f76f8={'method':_0x7f93('0x9b'),'uri':_0x33f532+'sys_choice?sysparm_query=name=incident^element='+_0x28cc40,'auth':_0x22e9df,'json':!![]};return rp(_0x3f76f8)['then'](function(_0x1df433){var _0x1b7fc6=[];if(_0x1df433[_0x7f93('0x9c')][_0x7f93('0x31')]>0x0){_0x1df433[_0x7f93('0x9c')]['forEach'](function(_0x52d9da){if(_0x52d9da['inactive']===_0x7f93('0xb1')){var _0xf14a92={'name':_0x52d9da[_0x7f93('0xa0')],'value':_0x52d9da['value']};_0x1b7fc6[_0x7f93('0xa8')](_0xf14a92);}});}_0x2e8f80[_0x7f93('0x38')]=_0x1b7fc6;if(_0x2e8f80[_0x7f93('0x38')][_0x7f93('0x31')]>0x0){_0xafc4a9(_0x2e8f80);}else{if(_0x49d03c==![]){_0xafc4a9();}else{_0xafc4a9(_0x2e8f80);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index d36052a..6d496b8 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 _0xd8fb=['../../components/integrations/configuration','define','int_servicenow_accounts','lodash','util','../../config/logger','api','path','rimraf','./intServicenowAccount.attributes'];(function(_0xf32e32,_0xb683ed){var _0x301682=function(_0x520d13){while(--_0x520d13){_0xf32e32['push'](_0xf32e32['shift']());}};_0x301682(++_0xb683ed);}(_0xd8fb,0x99));var _0xbd8f=function(_0x426a54,_0x45eda9){_0x426a54=_0x426a54-0x0;var _0x51c7e9=_0xd8fb[_0x426a54];return _0x51c7e9;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));var integrations=require(_0xbd8f('0x7'));module['exports']=function(_0x33d541,_0x4e97cf){return _0x33d541[_0xbd8f('0x8')]('ServicenowAccount',attributes,{'tableName':_0xbd8f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc97=['request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash','util','../../config/logger','moment'];(function(_0x2ee195,_0x339e65){var _0x51358a=function(_0x139a8f){while(--_0x139a8f){_0x2ee195['push'](_0x2ee195['shift']());}};_0x51358a(++_0x339e65);}(_0xdc97,0x13b));var _0x7dc9=function(_0x46d889,_0x35cf66){_0x46d889=_0x46d889-0x0;var _0x3a6de1=_0xdc97[_0x46d889];return _0x3a6de1;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));var integrations=require(_0x7dc9('0x8'));module[_0x7dc9('0x9')]=function(_0x589f02,_0x2636ef){return _0x589f02['define']('ServicenowAccount',attributes,{'tableName':_0x7dc9('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 845d5e6..18f1d33 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 _0x8695=['catch','ShowServicenowAccount','find','where','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','limit','include','map','model','attributes','stringify'];(function(_0x54435b,_0x5f2492){var _0x38c044=function(_0x456002){while(--_0x456002){_0x54435b['push'](_0x54435b['shift']());}};_0x38c044(++_0x5f2492);}(_0x8695,0x1cc));var _0x5869=function(_0x55e659,_0x233aa4){_0x55e659=_0x55e659-0x0;var _0xca08c7=_0x8695[_0x55e659];return _0xca08c7;};'use strict';var _=require(_0x5869('0x0'));var util=require(_0x5869('0x1'));var moment=require('moment');var BPromise=require(_0x5869('0x2'));var rs=require(_0x5869('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5869('0x4'))['db'];var utils=require(_0x5869('0x5'));var logger=require(_0x5869('0x6'))('rpc');var config=require(_0x5869('0x7'));var jayson=require(_0x5869('0x8'));var client=jayson['client'][_0x5869('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ca13b,_0x419c40,_0x35668b){return new BPromise(function(_0xbf47d8,_0xe81fcb){return client[_0x5869('0xa')](_0x5ca13b,_0x35668b)['then'](function(_0x133e23){logger[_0x5869('0xb')](_0x5869('0xc'),_0x419c40,_0x5869('0xd'));logger[_0x5869('0xe')](_0x5869('0xf'),_0x419c40,_0x5869('0xd'),JSON['stringify'](_0x133e23));if(_0x133e23['error']){if(_0x133e23[_0x5869('0x10')]['code']===0x1f4){logger[_0x5869('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x419c40,_0x133e23['error']['message']);return _0xe81fcb(_0x133e23[_0x5869('0x10')][_0x5869('0x11')]);}logger[_0x5869('0x10')](_0x5869('0xc'),_0x419c40,_0x133e23[_0x5869('0x10')][_0x5869('0x11')]);return _0xbf47d8(_0x133e23['error'][_0x5869('0x11')]);}else{logger['info'](_0x5869('0xc'),_0x419c40,_0x5869('0xd'));_0xbf47d8(_0x133e23[_0x5869('0x12')][_0x5869('0x11')]);}})['catch'](function(_0x107577){logger['error'](_0x5869('0xc'),_0x419c40,_0x107577);_0xe81fcb(_0x107577);});});}exports[_0x5869('0x13')]=function(_0x580fb8){var _0x19b48f=this;return new Promise(function(_0x521696,_0x57b756){return db[_0x5869('0x14')][_0x5869('0x15')]({'raw':_0x580fb8[_0x5869('0x16')]?_0x580fb8[_0x5869('0x16')][_0x5869('0x17')]===undefined?!![]:![]:!![],'where':_0x580fb8[_0x5869('0x16')]?_0x580fb8[_0x5869('0x16')]['where']||null:null,'attributes':_0x580fb8['options']?_0x580fb8[_0x5869('0x16')]['attributes']||null:null,'limit':_0x580fb8['options']?_0x580fb8[_0x5869('0x16')][_0x5869('0x18')]||null:null,'include':_0x580fb8[_0x5869('0x16')]?_0x580fb8[_0x5869('0x16')][_0x5869('0x19')]?_[_0x5869('0x1a')](_0x580fb8['options']['include'],function(_0xc6d51c){return{'model':db[_0xc6d51c[_0x5869('0x1b')]],'as':_0xc6d51c['as'],'attributes':_0xc6d51c[_0x5869('0x1c')],'include':_0xc6d51c[_0x5869('0x19')]?_[_0x5869('0x1a')](_0xc6d51c[_0x5869('0x19')],function(_0x2a942c){return{'model':db[_0x2a942c[_0x5869('0x1b')]],'as':_0x2a942c['as'],'attributes':_0x2a942c['attributes'],'include':_0x2a942c[_0x5869('0x19')]?_['map'](_0x2a942c[_0x5869('0x19')],function(_0x41d5e7){return{'model':db[_0x41d5e7[_0x5869('0x1b')]],'as':_0x41d5e7['as'],'attributes':_0x41d5e7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x21d64a){logger[_0x5869('0xb')](_0x5869('0x13'),_0x580fb8);logger['debug'](_0x5869('0x13'),_0x580fb8,JSON[_0x5869('0x1d')](_0x21d64a));_0x521696(_0x21d64a);})[_0x5869('0x1e')](function(_0x3b4c9f){logger['error']('GetServicenowAccount',_0x3b4c9f[_0x5869('0x11')],_0x580fb8);_0x57b756(_0x19b48f[_0x5869('0x10')](0x1f4,_0x3b4c9f[_0x5869('0x11')]));});});};exports[_0x5869('0x1f')]=function(_0xd4373c){var _0x148f8b=this;return new Promise(function(_0x5a2780,_0x3619be){return db['ServicenowAccount'][_0x5869('0x20')]({'raw':_0xd4373c[_0x5869('0x16')]?_0xd4373c['options'][_0x5869('0x17')]===undefined?!![]:![]:!![],'where':_0xd4373c['options']?_0xd4373c[_0x5869('0x16')][_0x5869('0x21')]||null:null,'attributes':_0xd4373c[_0x5869('0x16')]?_0xd4373c['options'][_0x5869('0x1c')]||null:null,'include':_0xd4373c[_0x5869('0x16')]?_0xd4373c['options'][_0x5869('0x19')]?_[_0x5869('0x1a')](_0xd4373c[_0x5869('0x16')][_0x5869('0x19')],function(_0xf26e3a){return{'model':db[_0xf26e3a['model']],'as':_0xf26e3a['as'],'attributes':_0xf26e3a[_0x5869('0x1c')],'include':_0xf26e3a[_0x5869('0x19')]?_[_0x5869('0x1a')](_0xf26e3a[_0x5869('0x19')],function(_0x14e422){return{'model':db[_0x14e422[_0x5869('0x1b')]],'as':_0x14e422['as'],'attributes':_0x14e422[_0x5869('0x1c')],'include':_0x14e422[_0x5869('0x19')]?_['map'](_0x14e422[_0x5869('0x19')],function(_0x1f7de1){return{'model':db[_0x1f7de1[_0x5869('0x1b')]],'as':_0x1f7de1['as'],'attributes':_0x1f7de1['attributes']};}):[]};}):[]};}):[]:[]})[_0x5869('0x22')](function(_0x3f6c1a){logger['info'](_0x5869('0x1f'),_0xd4373c);logger[_0x5869('0xe')](_0x5869('0x1f'),_0xd4373c,JSON['stringify'](_0x3f6c1a));_0x5a2780(_0x3f6c1a);})[_0x5869('0x1e')](function(_0x5a73a7){logger[_0x5869('0x10')]('ShowServicenowAccount',_0x5a73a7['message'],_0xd4373c);_0x3619be(_0x148f8b[_0x5869('0x10')](0x1f4,_0x5a73a7[_0x5869('0x11')]));});});}; \ No newline at end of file +var _0xd3d6=['model','ShowServicenowAccount','find','where','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','attributes','limit','include','map'];(function(_0x367921,_0x540b9b){var _0x28d13a=function(_0x4915e7){while(--_0x4915e7){_0x367921['push'](_0x367921['shift']());}};_0x28d13a(++_0x540b9b);}(_0xd3d6,0x6a));var _0x6d3d=function(_0x3f6ed4,_0xcf67ea){_0x3f6ed4=_0x3f6ed4-0x0;var _0x3d0be8=_0xd3d6[_0x3f6ed4];return _0x3d0be8;};'use strict';var _=require(_0x6d3d('0x0'));var util=require(_0x6d3d('0x1'));var moment=require(_0x6d3d('0x2'));var BPromise=require(_0x6d3d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d3d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d3d('0x5'))(_0x6d3d('0x6'));var config=require('../../config/environment');var jayson=require(_0x6d3d('0x7'));var client=jayson[_0x6d3d('0x8')][_0x6d3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x535eb3,_0x5ec15b,_0x47904a){return new BPromise(function(_0xff9399,_0x49dae9){return client[_0x6d3d('0xa')](_0x535eb3,_0x47904a)[_0x6d3d('0xb')](function(_0x13e66a){logger[_0x6d3d('0xc')](_0x6d3d('0xd'),_0x5ec15b,_0x6d3d('0xe'));logger[_0x6d3d('0xf')](_0x6d3d('0x10'),_0x5ec15b,'request\x20sent',JSON[_0x6d3d('0x11')](_0x13e66a));if(_0x13e66a[_0x6d3d('0x12')]){if(_0x13e66a[_0x6d3d('0x12')]['code']===0x1f4){logger[_0x6d3d('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x5ec15b,_0x13e66a[_0x6d3d('0x12')][_0x6d3d('0x13')]);return _0x49dae9(_0x13e66a['error']['message']);}logger[_0x6d3d('0x12')](_0x6d3d('0xd'),_0x5ec15b,_0x13e66a[_0x6d3d('0x12')][_0x6d3d('0x13')]);return _0xff9399(_0x13e66a[_0x6d3d('0x12')]['message']);}else{logger['info'](_0x6d3d('0xd'),_0x5ec15b,_0x6d3d('0xe'));_0xff9399(_0x13e66a[_0x6d3d('0x14')][_0x6d3d('0x13')]);}})[_0x6d3d('0x15')](function(_0xb462bd){logger[_0x6d3d('0x12')](_0x6d3d('0xd'),_0x5ec15b,_0xb462bd);_0x49dae9(_0xb462bd);});});}exports[_0x6d3d('0x16')]=function(_0xeb380e){var _0xcb1f81=this;return new Promise(function(_0x34ba00,_0x522ce7){return db[_0x6d3d('0x17')]['findAll']({'raw':_0xeb380e[_0x6d3d('0x18')]?_0xeb380e[_0x6d3d('0x18')][_0x6d3d('0x19')]===undefined?!![]:![]:!![],'where':_0xeb380e[_0x6d3d('0x18')]?_0xeb380e['options']['where']||null:null,'attributes':_0xeb380e[_0x6d3d('0x18')]?_0xeb380e[_0x6d3d('0x18')][_0x6d3d('0x1a')]||null:null,'limit':_0xeb380e[_0x6d3d('0x18')]?_0xeb380e[_0x6d3d('0x18')][_0x6d3d('0x1b')]||null:null,'include':_0xeb380e[_0x6d3d('0x18')]?_0xeb380e[_0x6d3d('0x18')][_0x6d3d('0x1c')]?_[_0x6d3d('0x1d')](_0xeb380e['options'][_0x6d3d('0x1c')],function(_0x39b427){return{'model':db[_0x39b427['model']],'as':_0x39b427['as'],'attributes':_0x39b427['attributes'],'include':_0x39b427[_0x6d3d('0x1c')]?_[_0x6d3d('0x1d')](_0x39b427[_0x6d3d('0x1c')],function(_0x89ca3b){return{'model':db[_0x89ca3b[_0x6d3d('0x1e')]],'as':_0x89ca3b['as'],'attributes':_0x89ca3b[_0x6d3d('0x1a')],'include':_0x89ca3b[_0x6d3d('0x1c')]?_[_0x6d3d('0x1d')](_0x89ca3b['include'],function(_0xd841){return{'model':db[_0xd841['model']],'as':_0xd841['as'],'attributes':_0xd841['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d3d('0xb')](function(_0x23b652){logger['info'](_0x6d3d('0x16'),_0xeb380e);logger[_0x6d3d('0xf')](_0x6d3d('0x16'),_0xeb380e,JSON[_0x6d3d('0x11')](_0x23b652));_0x34ba00(_0x23b652);})[_0x6d3d('0x15')](function(_0x328cb7){logger['error'](_0x6d3d('0x16'),_0x328cb7['message'],_0xeb380e);_0x522ce7(_0xcb1f81['error'](0x1f4,_0x328cb7[_0x6d3d('0x13')]));});});};exports[_0x6d3d('0x1f')]=function(_0x2dea72){var _0x336f85=this;return new Promise(function(_0x959bc6,_0x13147c){return db[_0x6d3d('0x17')][_0x6d3d('0x20')]({'raw':_0x2dea72['options']?_0x2dea72[_0x6d3d('0x18')][_0x6d3d('0x19')]===undefined?!![]:![]:!![],'where':_0x2dea72['options']?_0x2dea72[_0x6d3d('0x18')][_0x6d3d('0x21')]||null:null,'attributes':_0x2dea72['options']?_0x2dea72[_0x6d3d('0x18')]['attributes']||null:null,'include':_0x2dea72['options']?_0x2dea72['options'][_0x6d3d('0x1c')]?_[_0x6d3d('0x1d')](_0x2dea72['options'][_0x6d3d('0x1c')],function(_0x4ad092){return{'model':db[_0x4ad092[_0x6d3d('0x1e')]],'as':_0x4ad092['as'],'attributes':_0x4ad092['attributes'],'include':_0x4ad092[_0x6d3d('0x1c')]?_[_0x6d3d('0x1d')](_0x4ad092[_0x6d3d('0x1c')],function(_0x436f83){return{'model':db[_0x436f83[_0x6d3d('0x1e')]],'as':_0x436f83['as'],'attributes':_0x436f83[_0x6d3d('0x1a')],'include':_0x436f83[_0x6d3d('0x1c')]?_[_0x6d3d('0x1d')](_0x436f83[_0x6d3d('0x1c')],function(_0x2d0be5){return{'model':db[_0x2d0be5[_0x6d3d('0x1e')]],'as':_0x2d0be5['as'],'attributes':_0x2d0be5['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d3d('0xb')](function(_0x3b303b){logger[_0x6d3d('0xc')](_0x6d3d('0x1f'),_0x2dea72);logger[_0x6d3d('0xf')]('ShowServicenowAccount',_0x2dea72,JSON[_0x6d3d('0x11')](_0x3b303b));_0x959bc6(_0x3b303b);})[_0x6d3d('0x15')](function(_0x1c3a67){logger['error'](_0x6d3d('0x1f'),_0x1c3a67['message'],_0x2dea72);_0x13147c(_0x336f85[_0x6d3d('0x12')](0x1f4,_0x1c3a67[_0x6d3d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 31e09e5..02dc9be 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 _0x3c25=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update'];(function(_0xffd8b0,_0x12c51f){var _0x301ba0=function(_0x103c05){while(--_0x103c05){_0xffd8b0['push'](_0xffd8b0['shift']());}};_0x301ba0(++_0x12c51f);}(_0x3c25,0x19a));var _0x53c2=function(_0x2251cf,_0xb30177){_0x2251cf=_0x2251cf-0x0;var _0x4f99ee=_0x3c25[_0x2251cf];return _0x4f99ee;};'use strict';var multer=require(_0x53c2('0x0'));var util=require(_0x53c2('0x1'));var path=require(_0x53c2('0x2'));var timeout=require(_0x53c2('0x3'));var express=require(_0x53c2('0x4'));var router=express[_0x53c2('0x5')]();var fs_extra=require(_0x53c2('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x53c2('0x7'));var controller=require(_0x53c2('0x8'));router[_0x53c2('0x9')]('/',auth['isAuthenticated'](),controller[_0x53c2('0xa')]);router[_0x53c2('0x9')](_0x53c2('0xb'),auth[_0x53c2('0xc')](),controller[_0x53c2('0xd')]);router[_0x53c2('0x9')]('/:id/fields',auth[_0x53c2('0xc')](),controller[_0x53c2('0xe')]);router[_0x53c2('0x9')](_0x53c2('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x53c2('0x9')](_0x53c2('0x10'),auth[_0x53c2('0xc')](),controller[_0x53c2('0x11')]);router[_0x53c2('0x12')]('/',auth[_0x53c2('0xc')](),controller[_0x53c2('0x13')]);router[_0x53c2('0x14')]('/:id',auth[_0x53c2('0xc')](),controller[_0x53c2('0x15')]);router[_0x53c2('0x16')](_0x53c2('0xb'),auth[_0x53c2('0xc')](),controller[_0x53c2('0x17')]);module['exports']=router; \ No newline at end of file +var _0x20f9=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x1b6348,_0x3c4e44){var _0x1a5e40=function(_0x1950ba){while(--_0x1950ba){_0x1b6348['push'](_0x1b6348['shift']());}};_0x1a5e40(++_0x3c4e44);}(_0x20f9,0x10e));var _0x920f=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x20f9[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require(_0x920f('0x0'));var util=require(_0x920f('0x1'));var path=require(_0x920f('0x2'));var timeout=require(_0x920f('0x3'));var express=require('express');var router=express[_0x920f('0x4')]();var fs_extra=require(_0x920f('0x5'));var auth=require(_0x920f('0x6'));var interaction=require(_0x920f('0x7'));var config=require(_0x920f('0x8'));var controller=require(_0x920f('0x9'));router['get']('/',auth[_0x920f('0xa')](),controller[_0x920f('0xb')]);router[_0x920f('0xc')](_0x920f('0xd'),auth[_0x920f('0xa')](),controller[_0x920f('0xe')]);router[_0x920f('0xc')](_0x920f('0xf'),auth[_0x920f('0xa')](),controller[_0x920f('0x10')]);router['get'](_0x920f('0x11'),auth[_0x920f('0xa')](),controller[_0x920f('0x12')]);router[_0x920f('0xc')](_0x920f('0x13'),auth[_0x920f('0xa')](),controller['getDescriptions']);router[_0x920f('0x14')]('/',auth[_0x920f('0xa')](),controller['create']);router[_0x920f('0x15')]('/:id',auth[_0x920f('0xa')](),controller[_0x920f('0x16')]);router[_0x920f('0x17')](_0x920f('0xd'),auth[_0x920f('0xa')](),controller['destroy']);module[_0x920f('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index bd20beb..03d6782 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 _0xf25d=['STRING'];(function(_0x1c63a9,_0x49726c){var _0x4a3b03=function(_0x1eda26){while(--_0x1eda26){_0x1c63a9['push'](_0x1c63a9['shift']());}};_0x4a3b03(++_0x49726c);}(_0xf25d,0x11b));var _0xdf25=function(_0x25dbcb,_0x40eb18){_0x25dbcb=_0x25dbcb-0x0;var _0x329d76=_0xf25d[_0x25dbcb];return _0x329d76;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdf25('0x0')]},'description':{'type':Sequelize[_0xdf25('0x0')]}}; \ No newline at end of file +var _0x4b5a=['sequelize','exports','STRING'];(function(_0x3d76d2,_0x428a7){var _0x522d97=function(_0x1de7bb){while(--_0x1de7bb){_0x3d76d2['push'](_0x3d76d2['shift']());}};_0x522d97(++_0x428a7);}(_0x4b5a,0xdb));var _0xa4b5=function(_0x568059,_0x5414c0){_0x568059=_0x568059-0x0;var _0x2d6fb2=_0x4b5a[_0x568059];return _0x2d6fb2;};'use strict';var Sequelize=require(_0xa4b5('0x0'));module[_0xa4b5('0x1')]={'name':{'type':Sequelize[_0xa4b5('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 42a7de4..d36bff5 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 _0xfde8=['mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','error','stack','send','index','ServicenowConfiguration','rawAttributes','fieldName','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','includeAll','findAll','catch','params','keys','length','include','options','find','create','body','getFields','findOne','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3f4b60,_0x11b53c){var _0x153731=function(_0x3529bb){while(--_0x3529bb){_0x3f4b60['push'](_0x3f4b60['shift']());}};_0x153731(++_0x11b53c);}(_0xfde8,0x13e));var _0x8fde=function(_0x2cde4f,_0x48aee8){_0x2cde4f=_0x2cde4f-0x0;var _0x195e22=_0xfde8[_0x2cde4f];return _0x195e22;};'use strict';var emlformat=require(_0x8fde('0x0'));var rimraf=require(_0x8fde('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8fde('0x2'));var rp=require(_0x8fde('0x3'));var moment=require(_0x8fde('0x4'));var BPromise=require(_0x8fde('0x5'));var Mustache=require(_0x8fde('0x6'));var util=require(_0x8fde('0x7'));var path=require(_0x8fde('0x8'));var sox=require(_0x8fde('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8fde('0xa'));var _=require(_0x8fde('0xb'));var squel=require('squel');var crypto=require(_0x8fde('0xc'));var jsforce=require(_0x8fde('0xd'));var deskjs=require(_0x8fde('0xe'));var toCsv=require(_0x8fde('0xf'));var querystring=require('querystring');var Papa=require(_0x8fde('0x10'));var Redis=require('ioredis');var authService=require(_0x8fde('0x11'));var qs=require(_0x8fde('0x12'));var as=require(_0x8fde('0x13'));var hardwareService=require(_0x8fde('0x14'));var logger=require(_0x8fde('0x15'))(_0x8fde('0x16'));var utils=require(_0x8fde('0x17'));var config=require(_0x8fde('0x18'));var licenseUtil=require(_0x8fde('0x19'));var db=require(_0x8fde('0x1a'))['db'];function respondWithStatusCode(_0x419a63,_0x1c6b28){_0x1c6b28=_0x1c6b28||0xcc;return function(_0x3553e8){if(_0x3553e8){return _0x419a63[_0x8fde('0x1b')](_0x1c6b28);}return _0x419a63['status'](_0x1c6b28)[_0x8fde('0x1c')]();};}function respondWithResult(_0x1f2056,_0x3f58c4){_0x3f58c4=_0x3f58c4||0xc8;return function(_0x35fc3b){if(_0x35fc3b){return _0x1f2056[_0x8fde('0x1d')](_0x3f58c4)[_0x8fde('0x1e')](_0x35fc3b);}};}function respondWithFilteredResult(_0x360d82,_0x203f4f){return function(_0x20266f){if(_0x20266f){var _0x2b78b5=typeof _0x203f4f['offset']===_0x8fde('0x1f')&&typeof _0x203f4f[_0x8fde('0x20')]===_0x8fde('0x1f');var _0x4a7d08=_0x20266f['count'];var _0x2d8113=_0x2b78b5?0x0:_0x203f4f['offset'];var _0x60079f=_0x2b78b5?_0x20266f[_0x8fde('0x21')]:_0x203f4f[_0x8fde('0x22')]+_0x203f4f['limit'];var _0x2c7f5e;if(_0x60079f>=_0x4a7d08){_0x60079f=_0x4a7d08;_0x2c7f5e=0xc8;}else{_0x2c7f5e=0xce;}_0x360d82[_0x8fde('0x1d')](_0x2c7f5e);return _0x360d82[_0x8fde('0x23')](_0x8fde('0x24'),_0x2d8113+'-'+_0x60079f+'/'+_0x4a7d08)[_0x8fde('0x1e')](_0x20266f);}return null;};}function patchUpdates(_0x4f3119){return function(_0x3d3e42){try{jsonpatch['apply'](_0x3d3e42,_0x4f3119,!![]);}catch(_0x5321f6){return BPromise['reject'](_0x5321f6);}return _0x3d3e42[_0x8fde('0x25')]();};}function saveUpdates(_0x2a003a,_0x598881){return function(_0x235729){if(_0x235729){return _0x235729[_0x8fde('0x26')](_0x2a003a)[_0x8fde('0x27')](function(_0x21f513){return _0x21f513;});}return null;};}function removeEntity(_0x589852,_0x3a24e6){return function(_0x271b9f){if(_0x271b9f){return _0x271b9f[_0x8fde('0x28')]()['then'](function(){_0x589852['status'](0xcc)[_0x8fde('0x1c')]();});}};}function handleEntityNotFound(_0x5aba30,_0x49e840){return function(_0x117a29){if(!_0x117a29){_0x5aba30['sendStatus'](0x194);}return _0x117a29;};}function handleError(_0x2fd948,_0x2a013a){_0x2a013a=_0x2a013a||0x1f4;return function(_0x224f34){logger[_0x8fde('0x29')](_0x224f34[_0x8fde('0x2a')]);if(_0x224f34['name']){delete _0x224f34['name'];}_0x2fd948[_0x8fde('0x1d')](_0x2a013a)[_0x8fde('0x2b')](_0x224f34);};}exports[_0x8fde('0x2c')]=function(_0x2ca85f,_0x446863){var _0x3ed901={},_0x265806={},_0x4b9702={'count':0x0,'rows':[]};var _0x1e8d2c=_['map'](db[_0x8fde('0x2d')][_0x8fde('0x2e')],function(_0x7ee7e0){return{'name':_0x7ee7e0[_0x8fde('0x2f')],'type':_0x7ee7e0['type']['key']};});_0x265806[_0x8fde('0x30')]=_['map'](_0x1e8d2c,_0x8fde('0x31'));_0x265806[_0x8fde('0x32')]=_['keys'](_0x2ca85f[_0x8fde('0x32')]);_0x265806[_0x8fde('0x33')]=_[_0x8fde('0x34')](_0x265806[_0x8fde('0x30')],_0x265806['query']);_0x3ed901[_0x8fde('0x35')]=_[_0x8fde('0x34')](_0x265806[_0x8fde('0x30')],qs[_0x8fde('0x36')](_0x2ca85f['query'][_0x8fde('0x36')]));_0x3ed901[_0x8fde('0x35')]=_0x3ed901[_0x8fde('0x35')]['length']?_0x3ed901['attributes']:_0x265806['model'];if(!_0x2ca85f[_0x8fde('0x32')][_0x8fde('0x37')](_0x8fde('0x38'))){_0x3ed901[_0x8fde('0x20')]=qs[_0x8fde('0x20')](_0x2ca85f['query'][_0x8fde('0x20')]);_0x3ed901['offset']=qs[_0x8fde('0x22')](_0x2ca85f[_0x8fde('0x32')][_0x8fde('0x22')]);}_0x3ed901[_0x8fde('0x39')]=qs[_0x8fde('0x3a')](_0x2ca85f[_0x8fde('0x32')][_0x8fde('0x3a')]);_0x3ed901['where']=qs['filters'](_[_0x8fde('0x3b')](_0x2ca85f[_0x8fde('0x32')],_0x265806['filters']),_0x1e8d2c);if(_0x2ca85f[_0x8fde('0x32')][_0x8fde('0x3c')]){_0x3ed901[_0x8fde('0x3d')]=_[_0x8fde('0x3e')](_0x3ed901[_0x8fde('0x3d')],{'$or':_[_0x8fde('0x3f')](_0x1e8d2c,function(_0x86cce){if(_0x86cce[_0x8fde('0x40')]!=='VIRTUAL'){var _0x137af0={};_0x137af0[_0x86cce[_0x8fde('0x31')]]={'$like':'%'+_0x2ca85f[_0x8fde('0x32')]['filter']+'%'};return _0x137af0;}})});}_0x3ed901=_[_0x8fde('0x3e')]({},_0x3ed901,_0x2ca85f['options']);var _0x23656e={'where':_0x3ed901[_0x8fde('0x3d')]};return db[_0x8fde('0x2d')][_0x8fde('0x21')](_0x23656e)[_0x8fde('0x27')](function(_0x55cb0c){_0x4b9702['count']=_0x55cb0c;if(_0x2ca85f[_0x8fde('0x32')][_0x8fde('0x41')]){_0x3ed901['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x8fde('0x42')](_0x3ed901);})[_0x8fde('0x27')](function(_0x5170dc){_0x4b9702['rows']=_0x5170dc;return _0x4b9702;})[_0x8fde('0x27')](respondWithFilteredResult(_0x446863,_0x3ed901))[_0x8fde('0x43')](handleError(_0x446863,null));};exports['show']=function(_0x446826,_0xe0414c){var _0x512e48={'raw':![],'where':{'id':_0x446826[_0x8fde('0x44')]['id']}},_0x30fdba={};_0x30fdba[_0x8fde('0x30')]=_[_0x8fde('0x45')](db[_0x8fde('0x2d')]['rawAttributes']);_0x30fdba[_0x8fde('0x32')]=_[_0x8fde('0x45')](_0x446826[_0x8fde('0x32')]);_0x30fdba['filters']=_['intersection'](_0x30fdba[_0x8fde('0x30')],_0x30fdba[_0x8fde('0x32')]);_0x512e48[_0x8fde('0x35')]=_[_0x8fde('0x34')](_0x30fdba['model'],qs['fields'](_0x446826[_0x8fde('0x32')][_0x8fde('0x36')]));_0x512e48[_0x8fde('0x35')]=_0x512e48[_0x8fde('0x35')][_0x8fde('0x46')]?_0x512e48[_0x8fde('0x35')]:_0x30fdba[_0x8fde('0x30')];if(_0x446826[_0x8fde('0x32')][_0x8fde('0x41')]){_0x512e48[_0x8fde('0x47')]=[{'all':!![]}];}_0x512e48=_[_0x8fde('0x3e')]({},_0x512e48,_0x446826[_0x8fde('0x48')]);return db[_0x8fde('0x2d')][_0x8fde('0x49')](_0x512e48)[_0x8fde('0x27')](handleEntityNotFound(_0xe0414c,null))['then'](respondWithResult(_0xe0414c,null))[_0x8fde('0x43')](handleError(_0xe0414c,null));};exports[_0x8fde('0x4a')]=function(_0x47da5f,_0x1bd9f1){return db[_0x8fde('0x2d')][_0x8fde('0x4a')](_0x47da5f[_0x8fde('0x4b')],{})[_0x8fde('0x27')](respondWithResult(_0x1bd9f1,0xc9))[_0x8fde('0x43')](handleError(_0x1bd9f1,null));};exports[_0x8fde('0x26')]=function(_0x54ac6b,_0x415907){if(_0x54ac6b[_0x8fde('0x4b')]['id']){delete _0x54ac6b[_0x8fde('0x4b')]['id'];}return db[_0x8fde('0x2d')][_0x8fde('0x49')]({'where':{'id':_0x54ac6b[_0x8fde('0x44')]['id']}})[_0x8fde('0x27')](handleEntityNotFound(_0x415907,null))[_0x8fde('0x27')](saveUpdates(_0x54ac6b[_0x8fde('0x4b')],null))['then'](respondWithResult(_0x415907,null))[_0x8fde('0x43')](handleError(_0x415907,null));};exports['destroy']=function(_0x544622,_0x203424){return db[_0x8fde('0x2d')][_0x8fde('0x49')]({'where':{'id':_0x544622['params']['id']}})[_0x8fde('0x27')](handleEntityNotFound(_0x203424,null))[_0x8fde('0x27')](removeEntity(_0x203424,null))[_0x8fde('0x43')](handleError(_0x203424,null));};exports[_0x8fde('0x4c')]=function(_0x63b658,_0x1544c2,_0x4e7767){var _0x1661e8={};var _0x5e26ae={};var _0x4b2e78;var _0x54d227;return db[_0x8fde('0x2d')][_0x8fde('0x4d')]({'where':{'id':_0x63b658[_0x8fde('0x44')]['id']}})[_0x8fde('0x27')](handleEntityNotFound(_0x1544c2,null))[_0x8fde('0x27')](function(_0x113283){if(_0x113283){_0x4b2e78=_0x113283;_0x5e26ae[_0x8fde('0x30')]=_[_0x8fde('0x45')](db['ServicenowField'][_0x8fde('0x2e')]);_0x5e26ae['query']=_[_0x8fde('0x45')](_0x63b658['query']);_0x5e26ae[_0x8fde('0x33')]=_[_0x8fde('0x34')](_0x5e26ae['model'],_0x5e26ae[_0x8fde('0x32')]);_0x1661e8[_0x8fde('0x35')]=_['intersection'](_0x5e26ae[_0x8fde('0x30')],qs[_0x8fde('0x36')](_0x63b658['query'][_0x8fde('0x36')]));_0x1661e8['attributes']=_0x1661e8['attributes'][_0x8fde('0x46')]?_0x1661e8[_0x8fde('0x35')]:_0x5e26ae[_0x8fde('0x30')];_0x1661e8['order']=qs['sort'](_0x63b658[_0x8fde('0x32')][_0x8fde('0x3a')]);_0x1661e8[_0x8fde('0x3d')]=qs['filters'](_['pick'](_0x63b658[_0x8fde('0x32')],_0x5e26ae[_0x8fde('0x33')]));if(_0x63b658[_0x8fde('0x32')][_0x8fde('0x3c')]){_0x1661e8['where']=_[_0x8fde('0x3e')](_0x1661e8['where'],{'$or':_[_0x8fde('0x3f')](_0x1661e8['attributes'],function(_0x1ba997){var _0x3a1e07={};_0x3a1e07[_0x1ba997]={'$like':'%'+_0x63b658['query'][_0x8fde('0x3c')]+'%'};return _0x3a1e07;})});}_0x1661e8=_[_0x8fde('0x3e')]({},_0x1661e8,_0x63b658['options']);return _0x4b2e78[_0x8fde('0x4c')](_0x1661e8);}})[_0x8fde('0x27')](function(_0x22c27b){if(_0x22c27b){_0x54d227=_0x22c27b[_0x8fde('0x46')];if(!_0x63b658[_0x8fde('0x32')][_0x8fde('0x37')]('nolimit')){_0x1661e8[_0x8fde('0x20')]=qs['limit'](_0x63b658[_0x8fde('0x32')][_0x8fde('0x20')]);_0x1661e8[_0x8fde('0x22')]=qs[_0x8fde('0x22')](_0x63b658[_0x8fde('0x32')][_0x8fde('0x22')]);}return _0x4b2e78[_0x8fde('0x4c')](_0x1661e8);}})['then'](function(_0x1ce4fc){if(_0x1ce4fc){return _0x1ce4fc?{'count':_0x54d227,'rows':_0x1ce4fc}:null;}})[_0x8fde('0x27')](respondWithResult(_0x1544c2,null))[_0x8fde('0x43')](handleError(_0x1544c2,null));};exports[_0x8fde('0x4e')]=function(_0x9f8e6c,_0x443d56,_0x19b3cf){var _0x590049={};var _0x5459f0={};var _0x586567;var _0x50d91d;return db[_0x8fde('0x2d')][_0x8fde('0x4d')]({'where':{'id':_0x9f8e6c[_0x8fde('0x44')]['id']}})[_0x8fde('0x27')](handleEntityNotFound(_0x443d56,null))[_0x8fde('0x27')](function(_0x59fe8c){if(_0x59fe8c){_0x586567=_0x59fe8c;_0x5459f0[_0x8fde('0x30')]=_[_0x8fde('0x45')](db[_0x8fde('0x4f')]['rawAttributes']);_0x5459f0['query']=_[_0x8fde('0x45')](_0x9f8e6c['query']);_0x5459f0[_0x8fde('0x33')]=_[_0x8fde('0x34')](_0x5459f0[_0x8fde('0x30')],_0x5459f0[_0x8fde('0x32')]);_0x590049[_0x8fde('0x35')]=_[_0x8fde('0x34')](_0x5459f0['model'],qs['fields'](_0x9f8e6c[_0x8fde('0x32')][_0x8fde('0x36')]));_0x590049[_0x8fde('0x35')]=_0x590049[_0x8fde('0x35')][_0x8fde('0x46')]?_0x590049[_0x8fde('0x35')]:_0x5459f0['model'];_0x590049[_0x8fde('0x39')]=qs[_0x8fde('0x3a')](_0x9f8e6c[_0x8fde('0x32')][_0x8fde('0x3a')]);_0x590049[_0x8fde('0x3d')]=qs[_0x8fde('0x33')](_[_0x8fde('0x3b')](_0x9f8e6c[_0x8fde('0x32')],_0x5459f0[_0x8fde('0x33')]));if(_0x9f8e6c['query'][_0x8fde('0x3c')]){_0x590049[_0x8fde('0x3d')]=_[_0x8fde('0x3e')](_0x590049['where'],{'$or':_[_0x8fde('0x3f')](_0x590049[_0x8fde('0x35')],function(_0x417829){var _0x93acc6={};_0x93acc6[_0x417829]={'$like':'%'+_0x9f8e6c[_0x8fde('0x32')]['filter']+'%'};return _0x93acc6;})});}_0x590049=_[_0x8fde('0x3e')]({},_0x590049,_0x9f8e6c['options']);return _0x586567[_0x8fde('0x4e')](_0x590049);}})[_0x8fde('0x27')](function(_0x374e07){if(_0x374e07){_0x50d91d=_0x374e07[_0x8fde('0x46')];if(!_0x9f8e6c[_0x8fde('0x32')][_0x8fde('0x37')]('nolimit')){_0x590049[_0x8fde('0x20')]=qs['limit'](_0x9f8e6c[_0x8fde('0x32')][_0x8fde('0x20')]);_0x590049[_0x8fde('0x22')]=qs[_0x8fde('0x22')](_0x9f8e6c['query'][_0x8fde('0x22')]);}return _0x586567[_0x8fde('0x4e')](_0x590049);}})[_0x8fde('0x27')](function(_0x4b274d){if(_0x4b274d){return _0x4b274d?{'count':_0x50d91d,'rows':_0x4b274d}:null;}})[_0x8fde('0x27')](respondWithResult(_0x443d56,null))[_0x8fde('0x43')](handleError(_0x443d56,null));};exports['getDescriptions']=function(_0x124278,_0xf07048,_0xbcfa8b){var _0x4c82fa={};var _0x580175={};var _0x557d97;var _0x2854d1;return db['ServicenowConfiguration'][_0x8fde('0x4d')]({'where':{'id':_0x124278[_0x8fde('0x44')]['id']}})[_0x8fde('0x27')](handleEntityNotFound(_0xf07048,null))['then'](function(_0x15b69f){if(_0x15b69f){_0x557d97=_0x15b69f;_0x580175[_0x8fde('0x30')]=_[_0x8fde('0x45')](db[_0x8fde('0x4f')][_0x8fde('0x2e')]);_0x580175[_0x8fde('0x32')]=_[_0x8fde('0x45')](_0x124278['query']);_0x580175['filters']=_[_0x8fde('0x34')](_0x580175[_0x8fde('0x30')],_0x580175[_0x8fde('0x32')]);_0x4c82fa[_0x8fde('0x35')]=_[_0x8fde('0x34')](_0x580175[_0x8fde('0x30')],qs[_0x8fde('0x36')](_0x124278[_0x8fde('0x32')][_0x8fde('0x36')]));_0x4c82fa[_0x8fde('0x35')]=_0x4c82fa[_0x8fde('0x35')][_0x8fde('0x46')]?_0x4c82fa[_0x8fde('0x35')]:_0x580175[_0x8fde('0x30')];_0x4c82fa['order']=qs[_0x8fde('0x3a')](_0x124278[_0x8fde('0x32')]['sort']);_0x4c82fa[_0x8fde('0x3d')]=qs['filters'](_['pick'](_0x124278[_0x8fde('0x32')],_0x580175['filters']));if(_0x124278[_0x8fde('0x32')]['filter']){_0x4c82fa['where']=_[_0x8fde('0x3e')](_0x4c82fa[_0x8fde('0x3d')],{'$or':_[_0x8fde('0x3f')](_0x4c82fa[_0x8fde('0x35')],function(_0x3343f9){var _0x29f148={};_0x29f148[_0x3343f9]={'$like':'%'+_0x124278[_0x8fde('0x32')][_0x8fde('0x3c')]+'%'};return _0x29f148;})});}_0x4c82fa=_[_0x8fde('0x3e')]({},_0x4c82fa,_0x124278[_0x8fde('0x48')]);return _0x557d97[_0x8fde('0x50')](_0x4c82fa);}})['then'](function(_0x3372d9){if(_0x3372d9){_0x2854d1=_0x3372d9[_0x8fde('0x46')];if(!_0x124278['query'][_0x8fde('0x37')](_0x8fde('0x38'))){_0x4c82fa[_0x8fde('0x20')]=qs[_0x8fde('0x20')](_0x124278[_0x8fde('0x32')][_0x8fde('0x20')]);_0x4c82fa[_0x8fde('0x22')]=qs[_0x8fde('0x22')](_0x124278['query'][_0x8fde('0x22')]);}return _0x557d97[_0x8fde('0x50')](_0x4c82fa);}})[_0x8fde('0x27')](function(_0x56d364){if(_0x56d364){return _0x56d364?{'count':_0x2854d1,'rows':_0x56d364}:null;}})[_0x8fde('0x27')](respondWithResult(_0xf07048,null))[_0x8fde('0x43')](handleError(_0xf07048,null));}; \ No newline at end of file +var _0x584a=['offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','ServicenowConfiguration','includeAll','findAll','catch','show','params','filters','include','find','create','update','body','getFields','findOne','ServicenowField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end'];(function(_0xe6c97f,_0x4c93d2){var _0x5cdced=function(_0x51fe60){while(--_0x51fe60){_0xe6c97f['push'](_0xe6c97f['shift']());}};_0x5cdced(++_0x4c93d2);}(_0x584a,0x182));var _0xa584=function(_0x19a49f,_0x444d74){_0x19a49f=_0x19a49f-0x0;var _0x5351ae=_0x584a[_0x19a49f];return _0x5351ae;};'use strict';var emlformat=require(_0xa584('0x0'));var rimraf=require(_0xa584('0x1'));var zipdir=require(_0xa584('0x2'));var jsonpatch=require(_0xa584('0x3'));var rp=require(_0xa584('0x4'));var moment=require(_0xa584('0x5'));var BPromise=require(_0xa584('0x6'));var Mustache=require(_0xa584('0x7'));var util=require('util');var path=require(_0xa584('0x8'));var sox=require(_0xa584('0x9'));var csv=require('to-csv');var ejs=require(_0xa584('0xa'));var fs=require('fs');var fs_extra=require(_0xa584('0xb'));var _=require(_0xa584('0xc'));var squel=require(_0xa584('0xd'));var crypto=require(_0xa584('0xe'));var jsforce=require(_0xa584('0xf'));var deskjs=require(_0xa584('0x10'));var toCsv=require(_0xa584('0x11'));var querystring=require(_0xa584('0x12'));var Papa=require(_0xa584('0x13'));var Redis=require(_0xa584('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xa584('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa584('0x16'));var logger=require(_0xa584('0x17'))(_0xa584('0x18'));var utils=require('../../config/utils');var config=require(_0xa584('0x19'));var licenseUtil=require(_0xa584('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f1d7a,_0x35c3ea){_0x35c3ea=_0x35c3ea||0xcc;return function(_0x220fcc){if(_0x220fcc){return _0x4f1d7a['sendStatus'](_0x35c3ea);}return _0x4f1d7a[_0xa584('0x1b')](_0x35c3ea)[_0xa584('0x1c')]();};}function respondWithResult(_0x2f72b8,_0x531b49){_0x531b49=_0x531b49||0xc8;return function(_0x2368dc){if(_0x2368dc){return _0x2f72b8[_0xa584('0x1b')](_0x531b49)['json'](_0x2368dc);}};}function respondWithFilteredResult(_0x2ce891,_0x4bd72e){return function(_0x5ade65){if(_0x5ade65){var _0x4e4d60=typeof _0x4bd72e[_0xa584('0x1d')]===_0xa584('0x1e')&&typeof _0x4bd72e[_0xa584('0x1f')]===_0xa584('0x1e');var _0x5c2f07=_0x5ade65['count'];var _0x139aff=_0x4e4d60?0x0:_0x4bd72e[_0xa584('0x1d')];var _0x5b5fc8=_0x4e4d60?_0x5ade65[_0xa584('0x20')]:_0x4bd72e[_0xa584('0x1d')]+_0x4bd72e['limit'];var _0x353307;if(_0x5b5fc8>=_0x5c2f07){_0x5b5fc8=_0x5c2f07;_0x353307=0xc8;}else{_0x353307=0xce;}_0x2ce891[_0xa584('0x1b')](_0x353307);return _0x2ce891[_0xa584('0x21')](_0xa584('0x22'),_0x139aff+'-'+_0x5b5fc8+'/'+_0x5c2f07)[_0xa584('0x23')](_0x5ade65);}return null;};}function patchUpdates(_0x541f14){return function(_0x597ce1){try{jsonpatch[_0xa584('0x24')](_0x597ce1,_0x541f14,!![]);}catch(_0x266bf1){return BPromise['reject'](_0x266bf1);}return _0x597ce1[_0xa584('0x25')]();};}function saveUpdates(_0x4639a2,_0x854a9c){return function(_0x4d17fb){if(_0x4d17fb){return _0x4d17fb['update'](_0x4639a2)[_0xa584('0x26')](function(_0x2b75dc){return _0x2b75dc;});}return null;};}function removeEntity(_0x4c1812,_0x4f9149){return function(_0x42e6a8){if(_0x42e6a8){return _0x42e6a8[_0xa584('0x27')]()['then'](function(){_0x4c1812[_0xa584('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x431462,_0x17a313){return function(_0x418a85){if(!_0x418a85){_0x431462[_0xa584('0x28')](0x194);}return _0x418a85;};}function handleError(_0x3176c7,_0x6ecf99){_0x6ecf99=_0x6ecf99||0x1f4;return function(_0x365093){logger['error'](_0x365093[_0xa584('0x29')]);if(_0x365093[_0xa584('0x2a')]){delete _0x365093[_0xa584('0x2a')];}_0x3176c7['status'](_0x6ecf99)[_0xa584('0x2b')](_0x365093);};}exports[_0xa584('0x2c')]=function(_0x504735,_0x1b54cd){var _0x567254={},_0x59da37={},_0x4b193e={'count':0x0,'rows':[]};var _0x1f63a2=_[_0xa584('0x2d')](db['ServicenowConfiguration'][_0xa584('0x2e')],function(_0x536c4c){return{'name':_0x536c4c['fieldName'],'type':_0x536c4c[_0xa584('0x2f')][_0xa584('0x30')]};});_0x59da37[_0xa584('0x31')]=_['map'](_0x1f63a2,'name');_0x59da37[_0xa584('0x32')]=_[_0xa584('0x33')](_0x504735[_0xa584('0x32')]);_0x59da37['filters']=_['intersection'](_0x59da37['model'],_0x59da37[_0xa584('0x32')]);_0x567254['attributes']=_[_0xa584('0x34')](_0x59da37[_0xa584('0x31')],qs[_0xa584('0x35')](_0x504735[_0xa584('0x32')][_0xa584('0x35')]));_0x567254['attributes']=_0x567254[_0xa584('0x36')][_0xa584('0x37')]?_0x567254['attributes']:_0x59da37[_0xa584('0x31')];if(!_0x504735['query'][_0xa584('0x38')](_0xa584('0x39'))){_0x567254[_0xa584('0x1f')]=qs[_0xa584('0x1f')](_0x504735['query'][_0xa584('0x1f')]);_0x567254['offset']=qs[_0xa584('0x1d')](_0x504735[_0xa584('0x32')][_0xa584('0x1d')]);}_0x567254['order']=qs[_0xa584('0x3a')](_0x504735[_0xa584('0x32')][_0xa584('0x3a')]);_0x567254[_0xa584('0x3b')]=qs['filters'](_[_0xa584('0x3c')](_0x504735[_0xa584('0x32')],_0x59da37['filters']),_0x1f63a2);if(_0x504735[_0xa584('0x32')]['filter']){_0x567254['where']=_[_0xa584('0x3d')](_0x567254[_0xa584('0x3b')],{'$or':_[_0xa584('0x2d')](_0x1f63a2,function(_0x400e4a){if(_0x400e4a[_0xa584('0x2f')]!==_0xa584('0x3e')){var _0x3a3a1a={};_0x3a3a1a[_0x400e4a[_0xa584('0x2a')]]={'$like':'%'+_0x504735['query'][_0xa584('0x3f')]+'%'};return _0x3a3a1a;}})});}_0x567254=_[_0xa584('0x3d')]({},_0x567254,_0x504735[_0xa584('0x40')]);var _0x212be1={'where':_0x567254[_0xa584('0x3b')]};return db[_0xa584('0x41')][_0xa584('0x20')](_0x212be1)[_0xa584('0x26')](function(_0x5d001d){_0x4b193e['count']=_0x5d001d;if(_0x504735[_0xa584('0x32')][_0xa584('0x42')]){_0x567254['include']=[{'all':!![]}];}return db[_0xa584('0x41')][_0xa584('0x43')](_0x567254);})[_0xa584('0x26')](function(_0x2780b1){_0x4b193e['rows']=_0x2780b1;return _0x4b193e;})['then'](respondWithFilteredResult(_0x1b54cd,_0x567254))[_0xa584('0x44')](handleError(_0x1b54cd,null));};exports[_0xa584('0x45')]=function(_0x169aa6,_0x2d5a91){var _0x1352f6={'raw':![],'where':{'id':_0x169aa6[_0xa584('0x46')]['id']}},_0x566739={};_0x566739[_0xa584('0x31')]=_['keys'](db[_0xa584('0x41')][_0xa584('0x2e')]);_0x566739[_0xa584('0x32')]=_['keys'](_0x169aa6[_0xa584('0x32')]);_0x566739[_0xa584('0x47')]=_[_0xa584('0x34')](_0x566739[_0xa584('0x31')],_0x566739[_0xa584('0x32')]);_0x1352f6[_0xa584('0x36')]=_['intersection'](_0x566739[_0xa584('0x31')],qs[_0xa584('0x35')](_0x169aa6['query']['fields']));_0x1352f6['attributes']=_0x1352f6[_0xa584('0x36')][_0xa584('0x37')]?_0x1352f6[_0xa584('0x36')]:_0x566739[_0xa584('0x31')];if(_0x169aa6['query'][_0xa584('0x42')]){_0x1352f6[_0xa584('0x48')]=[{'all':!![]}];}_0x1352f6=_['merge']({},_0x1352f6,_0x169aa6[_0xa584('0x40')]);return db[_0xa584('0x41')][_0xa584('0x49')](_0x1352f6)[_0xa584('0x26')](handleEntityNotFound(_0x2d5a91,null))[_0xa584('0x26')](respondWithResult(_0x2d5a91,null))[_0xa584('0x44')](handleError(_0x2d5a91,null));};exports['create']=function(_0x3c725c,_0xc04109){return db['ServicenowConfiguration'][_0xa584('0x4a')](_0x3c725c['body'],{})[_0xa584('0x26')](respondWithResult(_0xc04109,0xc9))['catch'](handleError(_0xc04109,null));};exports[_0xa584('0x4b')]=function(_0x45eba1,_0xb1cbb8){if(_0x45eba1['body']['id']){delete _0x45eba1[_0xa584('0x4c')]['id'];}return db['ServicenowConfiguration'][_0xa584('0x49')]({'where':{'id':_0x45eba1['params']['id']}})[_0xa584('0x26')](handleEntityNotFound(_0xb1cbb8,null))['then'](saveUpdates(_0x45eba1['body'],null))[_0xa584('0x26')](respondWithResult(_0xb1cbb8,null))[_0xa584('0x44')](handleError(_0xb1cbb8,null));};exports[_0xa584('0x27')]=function(_0x4677ea,_0x1ceef9){return db[_0xa584('0x41')][_0xa584('0x49')]({'where':{'id':_0x4677ea['params']['id']}})[_0xa584('0x26')](handleEntityNotFound(_0x1ceef9,null))[_0xa584('0x26')](removeEntity(_0x1ceef9,null))[_0xa584('0x44')](handleError(_0x1ceef9,null));};exports[_0xa584('0x4d')]=function(_0x4779db,_0x219a1d,_0x2427f0){var _0x26482d={};var _0x1e5264={};var _0x427ce8;var _0x49ce60;return db[_0xa584('0x41')][_0xa584('0x4e')]({'where':{'id':_0x4779db[_0xa584('0x46')]['id']}})[_0xa584('0x26')](handleEntityNotFound(_0x219a1d,null))['then'](function(_0x85432c){if(_0x85432c){_0x427ce8=_0x85432c;_0x1e5264[_0xa584('0x31')]=_['keys'](db[_0xa584('0x4f')][_0xa584('0x2e')]);_0x1e5264[_0xa584('0x32')]=_['keys'](_0x4779db[_0xa584('0x32')]);_0x1e5264['filters']=_[_0xa584('0x34')](_0x1e5264[_0xa584('0x31')],_0x1e5264['query']);_0x26482d[_0xa584('0x36')]=_[_0xa584('0x34')](_0x1e5264[_0xa584('0x31')],qs[_0xa584('0x35')](_0x4779db[_0xa584('0x32')]['fields']));_0x26482d[_0xa584('0x36')]=_0x26482d[_0xa584('0x36')][_0xa584('0x37')]?_0x26482d[_0xa584('0x36')]:_0x1e5264['model'];_0x26482d[_0xa584('0x50')]=qs[_0xa584('0x3a')](_0x4779db['query'][_0xa584('0x3a')]);_0x26482d[_0xa584('0x3b')]=qs[_0xa584('0x47')](_[_0xa584('0x3c')](_0x4779db[_0xa584('0x32')],_0x1e5264[_0xa584('0x47')]));if(_0x4779db[_0xa584('0x32')]['filter']){_0x26482d[_0xa584('0x3b')]=_[_0xa584('0x3d')](_0x26482d[_0xa584('0x3b')],{'$or':_[_0xa584('0x2d')](_0x26482d[_0xa584('0x36')],function(_0x55d43f){var _0x3841f1={};_0x3841f1[_0x55d43f]={'$like':'%'+_0x4779db[_0xa584('0x32')][_0xa584('0x3f')]+'%'};return _0x3841f1;})});}_0x26482d=_['merge']({},_0x26482d,_0x4779db[_0xa584('0x40')]);return _0x427ce8[_0xa584('0x4d')](_0x26482d);}})[_0xa584('0x26')](function(_0x59760c){if(_0x59760c){_0x49ce60=_0x59760c[_0xa584('0x37')];if(!_0x4779db[_0xa584('0x32')]['hasOwnProperty'](_0xa584('0x39'))){_0x26482d[_0xa584('0x1f')]=qs[_0xa584('0x1f')](_0x4779db[_0xa584('0x32')]['limit']);_0x26482d['offset']=qs['offset'](_0x4779db[_0xa584('0x32')]['offset']);}return _0x427ce8[_0xa584('0x4d')](_0x26482d);}})['then'](function(_0x7592f9){if(_0x7592f9){return _0x7592f9?{'count':_0x49ce60,'rows':_0x7592f9}:null;}})['then'](respondWithResult(_0x219a1d,null))[_0xa584('0x44')](handleError(_0x219a1d,null));};exports[_0xa584('0x51')]=function(_0x4e991b,_0x4460fa,_0xbc25c6){var _0x1688eb={};var _0x2f5c93={};var _0xbb0af0;var _0x5f331f;return db[_0xa584('0x41')][_0xa584('0x4e')]({'where':{'id':_0x4e991b[_0xa584('0x46')]['id']}})['then'](handleEntityNotFound(_0x4460fa,null))[_0xa584('0x26')](function(_0x2ab91c){if(_0x2ab91c){_0xbb0af0=_0x2ab91c;_0x2f5c93['model']=_[_0xa584('0x33')](db[_0xa584('0x4f')][_0xa584('0x2e')]);_0x2f5c93[_0xa584('0x32')]=_['keys'](_0x4e991b[_0xa584('0x32')]);_0x2f5c93[_0xa584('0x47')]=_[_0xa584('0x34')](_0x2f5c93[_0xa584('0x31')],_0x2f5c93[_0xa584('0x32')]);_0x1688eb[_0xa584('0x36')]=_[_0xa584('0x34')](_0x2f5c93[_0xa584('0x31')],qs[_0xa584('0x35')](_0x4e991b[_0xa584('0x32')][_0xa584('0x35')]));_0x1688eb[_0xa584('0x36')]=_0x1688eb[_0xa584('0x36')][_0xa584('0x37')]?_0x1688eb['attributes']:_0x2f5c93[_0xa584('0x31')];_0x1688eb[_0xa584('0x50')]=qs[_0xa584('0x3a')](_0x4e991b['query']['sort']);_0x1688eb['where']=qs[_0xa584('0x47')](_[_0xa584('0x3c')](_0x4e991b['query'],_0x2f5c93[_0xa584('0x47')]));if(_0x4e991b[_0xa584('0x32')]['filter']){_0x1688eb['where']=_[_0xa584('0x3d')](_0x1688eb[_0xa584('0x3b')],{'$or':_[_0xa584('0x2d')](_0x1688eb[_0xa584('0x36')],function(_0x3d5215){var _0x26e851={};_0x26e851[_0x3d5215]={'$like':'%'+_0x4e991b['query'][_0xa584('0x3f')]+'%'};return _0x26e851;})});}_0x1688eb=_[_0xa584('0x3d')]({},_0x1688eb,_0x4e991b[_0xa584('0x40')]);return _0xbb0af0[_0xa584('0x51')](_0x1688eb);}})['then'](function(_0x3a6502){if(_0x3a6502){_0x5f331f=_0x3a6502[_0xa584('0x37')];if(!_0x4e991b[_0xa584('0x32')][_0xa584('0x38')]('nolimit')){_0x1688eb[_0xa584('0x1f')]=qs[_0xa584('0x1f')](_0x4e991b[_0xa584('0x32')][_0xa584('0x1f')]);_0x1688eb[_0xa584('0x1d')]=qs[_0xa584('0x1d')](_0x4e991b[_0xa584('0x32')][_0xa584('0x1d')]);}return _0xbb0af0[_0xa584('0x51')](_0x1688eb);}})[_0xa584('0x26')](function(_0xfec16f){if(_0xfec16f){return _0xfec16f?{'count':_0x5f331f,'rows':_0xfec16f}:null;}})['then'](respondWithResult(_0x4460fa,null))[_0xa584('0x44')](handleError(_0x4460fa,null));};exports[_0xa584('0x52')]=function(_0x4389fc,_0x3b979c,_0x4ef644){var _0x530ad3={};var _0x261b12={};var _0x52e217;var _0x517a3a;return db[_0xa584('0x41')][_0xa584('0x4e')]({'where':{'id':_0x4389fc['params']['id']}})[_0xa584('0x26')](handleEntityNotFound(_0x3b979c,null))['then'](function(_0x592f41){if(_0x592f41){_0x52e217=_0x592f41;_0x261b12['model']=_['keys'](db['ServicenowField'][_0xa584('0x2e')]);_0x261b12[_0xa584('0x32')]=_['keys'](_0x4389fc[_0xa584('0x32')]);_0x261b12[_0xa584('0x47')]=_['intersection'](_0x261b12[_0xa584('0x31')],_0x261b12[_0xa584('0x32')]);_0x530ad3['attributes']=_['intersection'](_0x261b12[_0xa584('0x31')],qs[_0xa584('0x35')](_0x4389fc[_0xa584('0x32')][_0xa584('0x35')]));_0x530ad3[_0xa584('0x36')]=_0x530ad3[_0xa584('0x36')][_0xa584('0x37')]?_0x530ad3[_0xa584('0x36')]:_0x261b12[_0xa584('0x31')];_0x530ad3[_0xa584('0x50')]=qs[_0xa584('0x3a')](_0x4389fc[_0xa584('0x32')][_0xa584('0x3a')]);_0x530ad3['where']=qs[_0xa584('0x47')](_[_0xa584('0x3c')](_0x4389fc[_0xa584('0x32')],_0x261b12[_0xa584('0x47')]));if(_0x4389fc[_0xa584('0x32')][_0xa584('0x3f')]){_0x530ad3[_0xa584('0x3b')]=_[_0xa584('0x3d')](_0x530ad3['where'],{'$or':_[_0xa584('0x2d')](_0x530ad3[_0xa584('0x36')],function(_0x3aa01d){var _0x496fbd={};_0x496fbd[_0x3aa01d]={'$like':'%'+_0x4389fc[_0xa584('0x32')][_0xa584('0x3f')]+'%'};return _0x496fbd;})});}_0x530ad3=_[_0xa584('0x3d')]({},_0x530ad3,_0x4389fc[_0xa584('0x40')]);return _0x52e217['getDescriptions'](_0x530ad3);}})['then'](function(_0x2533ae){if(_0x2533ae){_0x517a3a=_0x2533ae[_0xa584('0x37')];if(!_0x4389fc[_0xa584('0x32')][_0xa584('0x38')](_0xa584('0x39'))){_0x530ad3[_0xa584('0x1f')]=qs['limit'](_0x4389fc['query']['limit']);_0x530ad3[_0xa584('0x1d')]=qs['offset'](_0x4389fc['query'][_0xa584('0x1d')]);}return _0x52e217[_0xa584('0x52')](_0x530ad3);}})[_0xa584('0x26')](function(_0x665ad3){if(_0x665ad3){return _0x665ad3?{'count':_0x517a3a,'rows':_0x665ad3}:null;}})['then'](respondWithResult(_0x3b979c,null))[_0xa584('0x44')](handleError(_0x3b979c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index a876505..988cc6c 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 _0x867f=['exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./intServicenowConfiguration.attributes'];(function(_0xddcb3c,_0x188628){var _0xf39702=function(_0x4a6f61){while(--_0x4a6f61){_0xddcb3c['push'](_0xddcb3c['shift']());}};_0xf39702(++_0x188628);}(_0x867f,0xdc));var _0xf867=function(_0x2c6991,_0x4b5775){_0x2c6991=_0x2c6991-0x0;var _0x4de9fa=_0x867f[_0x2c6991];return _0x4de9fa;};'use strict';var _=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var logger=require(_0xf867('0x2'))('api');var moment=require(_0xf867('0x3'));var BPromise=require(_0xf867('0x4'));var rp=require(_0xf867('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf867('0x6'));var config=require('../../config/environment');var attributes=require(_0xf867('0x7'));module[_0xf867('0x8')]=function(_0x2708d5,_0x287b67){return _0x2708d5[_0xf867('0x9')](_0xf867('0xa'),attributes,{'tableName':_0xf867('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7a7=['moment','bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x4bf7c0,_0x32aff9){var _0x1ecdc9=function(_0x516a9f){while(--_0x516a9f){_0x4bf7c0['push'](_0x4bf7c0['shift']());}};_0x1ecdc9(++_0x32aff9);}(_0xc7a7,0x171));var _0x7c7a=function(_0x5f43db,_0x41580e){_0x5f43db=_0x5f43db-0x0;var _0x100799=_0xc7a7[_0x5f43db];return _0x100799;};'use strict';var _=require(_0x7c7a('0x0'));var util=require(_0x7c7a('0x1'));var logger=require(_0x7c7a('0x2'))('api');var moment=require(_0x7c7a('0x3'));var BPromise=require(_0x7c7a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c7a('0x5'));var rimraf=require(_0x7c7a('0x6'));var config=require(_0x7c7a('0x7'));var attributes=require(_0x7c7a('0x8'));module[_0x7c7a('0x9')]=function(_0xc84abf,_0x346f96){return _0xc84abf[_0x7c7a('0xa')]('ServicenowConfiguration',attributes,{'tableName':_0x7c7a('0xb'),'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 cce15fd..c1c9637 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 _0xa897=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2f57b2,_0xa8e91a){var _0x5ace77=function(_0x59c00a){while(--_0x59c00a){_0x2f57b2['push'](_0x2f57b2['shift']());}};_0x5ace77(++_0xa8e91a);}(_0xa897,0x17c));var _0x7a89=function(_0x5c5f81,_0xf044ad){_0x5c5f81=_0x5c5f81-0x0;var _0x495355=_0xa897[_0x5c5f81];return _0x495355;};'use strict';var _=require(_0x7a89('0x0'));var util=require('util');var moment=require(_0x7a89('0x1'));var BPromise=require(_0x7a89('0x2'));var rs=require(_0x7a89('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a89('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a89('0x5'))('rpc');var config=require(_0x7a89('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7a89('0x7')][_0x7a89('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x340a28,_0x1ef066,_0x2f1c93){return new BPromise(function(_0x46798d,_0x4cbc83){return client[_0x7a89('0x9')](_0x340a28,_0x2f1c93)[_0x7a89('0xa')](function(_0x47dff0){logger[_0x7a89('0xb')](_0x7a89('0xc'),_0x1ef066,_0x7a89('0xd'));logger[_0x7a89('0xe')](_0x7a89('0xf'),_0x1ef066,_0x7a89('0xd'),JSON['stringify'](_0x47dff0));if(_0x47dff0[_0x7a89('0x10')]){if(_0x47dff0[_0x7a89('0x10')][_0x7a89('0x11')]===0x1f4){logger[_0x7a89('0x10')](_0x7a89('0xc'),_0x1ef066,_0x47dff0['error']['message']);return _0x4cbc83(_0x47dff0[_0x7a89('0x10')][_0x7a89('0x12')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x1ef066,_0x47dff0[_0x7a89('0x10')]['message']);return _0x46798d(_0x47dff0['error'][_0x7a89('0x12')]);}else{logger[_0x7a89('0xb')](_0x7a89('0xc'),_0x1ef066,_0x7a89('0xd'));_0x46798d(_0x47dff0[_0x7a89('0x13')][_0x7a89('0x12')]);}})[_0x7a89('0x14')](function(_0x49ec85){logger[_0x7a89('0x10')](_0x7a89('0xc'),_0x1ef066,_0x49ec85);_0x4cbc83(_0x49ec85);});});} \ No newline at end of file +var _0x2b87=['info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x221448,_0xd8a150){var _0x436694=function(_0xe22057){while(--_0xe22057){_0x221448['push'](_0x221448['shift']());}};_0x436694(++_0xd8a150);}(_0x2b87,0x72));var _0x72b8=function(_0x4415ca,_0x20b432){_0x4415ca=_0x4415ca-0x0;var _0x1c1bbb=_0x2b87[_0x4415ca];return _0x1c1bbb;};'use strict';var _=require(_0x72b8('0x0'));var util=require(_0x72b8('0x1'));var moment=require(_0x72b8('0x2'));var BPromise=require(_0x72b8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72b8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x72b8('0x5'))(_0x72b8('0x6'));var config=require(_0x72b8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x72b8('0x8')][_0x72b8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x120fb9,_0x2ef3be,_0x4ddad3){return new BPromise(function(_0xb4e27c,_0x22d64f){return client[_0x72b8('0xa')](_0x120fb9,_0x4ddad3)[_0x72b8('0xb')](function(_0x5ffea0){logger[_0x72b8('0xc')](_0x72b8('0xd'),_0x2ef3be,'request\x20sent');logger[_0x72b8('0xe')](_0x72b8('0xf'),_0x2ef3be,_0x72b8('0x10'),JSON[_0x72b8('0x11')](_0x5ffea0));if(_0x5ffea0[_0x72b8('0x12')]){if(_0x5ffea0[_0x72b8('0x12')]['code']===0x1f4){logger[_0x72b8('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2ef3be,_0x5ffea0[_0x72b8('0x12')][_0x72b8('0x13')]);return _0x22d64f(_0x5ffea0['error'][_0x72b8('0x13')]);}logger[_0x72b8('0x12')](_0x72b8('0xd'),_0x2ef3be,_0x5ffea0[_0x72b8('0x12')][_0x72b8('0x13')]);return _0xb4e27c(_0x5ffea0[_0x72b8('0x12')][_0x72b8('0x13')]);}else{logger[_0x72b8('0xc')](_0x72b8('0xd'),_0x2ef3be,_0x72b8('0x10'));_0xb4e27c(_0x5ffea0[_0x72b8('0x14')]['message']);}})['catch'](function(_0x3cfd0a){logger['error'](_0x72b8('0xd'),_0x2ef3be,_0x3cfd0a);_0x22d64f(_0x3cfd0a);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 86eefde..658c4d0 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 _0x7f97=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x7f97,0xee));var _0x77f9=function(_0x5262c1,_0x37bc37){_0x5262c1=_0x5262c1-0x0;var _0x179e58=_0x7f97[_0x5262c1];return _0x179e58;};'use strict';var multer=require('multer');var util=require(_0x77f9('0x0'));var path=require(_0x77f9('0x1'));var timeout=require('connect-timeout');var express=require(_0x77f9('0x2'));var router=express[_0x77f9('0x3')]();var fs_extra=require(_0x77f9('0x4'));var auth=require(_0x77f9('0x5'));var interaction=require(_0x77f9('0x6'));var config=require(_0x77f9('0x7'));var controller=require(_0x77f9('0x8'));router[_0x77f9('0x9')]('/',auth[_0x77f9('0xa')](),controller[_0x77f9('0xb')]);router['get'](_0x77f9('0xc'),auth[_0x77f9('0xa')](),controller[_0x77f9('0xd')]);router[_0x77f9('0xe')]('/',auth[_0x77f9('0xa')](),controller[_0x77f9('0xf')]);router[_0x77f9('0x10')](_0x77f9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x77f9('0x11')](_0x77f9('0xc'),auth[_0x77f9('0xa')](),controller[_0x77f9('0x12')]);module[_0x77f9('0x13')]=router; \ No newline at end of file +var _0x0344=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create'];(function(_0x290612,_0x264e17){var _0x44aade=function(_0x3358d9){while(--_0x3358d9){_0x290612['push'](_0x290612['shift']());}};_0x44aade(++_0x264e17);}(_0x0344,0xcd));var _0x4034=function(_0xf7ad8d,_0x8aa151){_0xf7ad8d=_0xf7ad8d-0x0;var _0x538a53=_0x0344[_0xf7ad8d];return _0x538a53;};'use strict';var multer=require(_0x4034('0x0'));var util=require('util');var path=require(_0x4034('0x1'));var timeout=require(_0x4034('0x2'));var express=require(_0x4034('0x3'));var router=express[_0x4034('0x4')]();var fs_extra=require(_0x4034('0x5'));var auth=require(_0x4034('0x6'));var interaction=require(_0x4034('0x7'));var config=require(_0x4034('0x8'));var controller=require('./intServicenowField.controller');router[_0x4034('0x9')]('/',auth[_0x4034('0xa')](),controller['index']);router[_0x4034('0x9')](_0x4034('0xb'),auth[_0x4034('0xa')](),controller[_0x4034('0xc')]);router[_0x4034('0xd')]('/',auth[_0x4034('0xa')](),controller[_0x4034('0xe')]);router[_0x4034('0xf')](_0x4034('0xb'),auth[_0x4034('0xa')](),controller[_0x4034('0x10')]);router[_0x4034('0x11')](_0x4034('0xb'),auth[_0x4034('0xa')](),controller[_0x4034('0x12')]);module[_0x4034('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 0375a53..b032946 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 _0x1901=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x1901,0x187));var _0x1190=function(_0x2715cf,_0x517bb2){_0x2715cf=_0x2715cf-0x0;var _0x1bdcb8=_0x1901[_0x2715cf];return _0x1bdcb8;};'use strict';var Sequelize=require(_0x1190('0x0'));module['exports']={'type':{'type':Sequelize[_0x1190('0x1')](_0x1190('0x2'),_0x1190('0x3'),_0x1190('0x4'),_0x1190('0x5'),_0x1190('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1190('0x7')]},'keyType':{'type':Sequelize[_0x1190('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x1190('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1190('0x7')]}}; \ No newline at end of file +var _0x8a06=['customVariable','keyValue','picklist','string','STRING','ENUM','variable','BOOLEAN','exports'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0x8a06,0x170));var _0x68a0=function(_0x5a4b42,_0x2b9c18){_0x5a4b42=_0x5a4b42-0x0;var _0x5e81d6=_0x8a06[_0x5a4b42];return _0x5e81d6;};'use strict';var Sequelize=require('sequelize');module[_0x68a0('0x0')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x68a0('0x1'),_0x68a0('0x2'),_0x68a0('0x3')),'defaultValue':_0x68a0('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x68a0('0x5')]},'keyType':{'type':Sequelize[_0x68a0('0x6')](_0x68a0('0x4'),_0x68a0('0x7'),_0x68a0('0x1'))},'keyContent':{'type':Sequelize[_0x68a0('0x5')]},'idField':{'type':Sequelize[_0x68a0('0x5')]},'nameField':{'type':Sequelize[_0x68a0('0x5')]},'customField':{'type':Sequelize[_0x68a0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x68a0('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 9d8c82e..f71fb39 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 _0x1d89=['query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','find','create','body','update','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','model'];(function(_0x18b9e9,_0x20f5fb){var _0x384505=function(_0x2d94e4){while(--_0x2d94e4){_0x18b9e9['push'](_0x18b9e9['shift']());}};_0x384505(++_0x20f5fb);}(_0x1d89,0x6b));var _0x91d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d89[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x91d8('0x0'));var rimraf=require(_0x91d8('0x1'));var zipdir=require(_0x91d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x91d8('0x3'));var moment=require(_0x91d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91d8('0x5'));var util=require(_0x91d8('0x6'));var path=require(_0x91d8('0x7'));var sox=require('sox');var csv=require(_0x91d8('0x8'));var ejs=require(_0x91d8('0x9'));var fs=require('fs');var fs_extra=require(_0x91d8('0xa'));var _=require(_0x91d8('0xb'));var squel=require(_0x91d8('0xc'));var crypto=require(_0x91d8('0xd'));var jsforce=require(_0x91d8('0xe'));var deskjs=require(_0x91d8('0xf'));var toCsv=require(_0x91d8('0x8'));var querystring=require(_0x91d8('0x10'));var Papa=require(_0x91d8('0x11'));var Redis=require(_0x91d8('0x12'));var authService=require(_0x91d8('0x13'));var qs=require(_0x91d8('0x14'));var as=require(_0x91d8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x91d8('0x16'))(_0x91d8('0x17'));var utils=require(_0x91d8('0x18'));var config=require(_0x91d8('0x19'));var licenseUtil=require(_0x91d8('0x1a'));var db=require(_0x91d8('0x1b'))['db'];function respondWithStatusCode(_0x23f7b3,_0x12ed28){_0x12ed28=_0x12ed28||0xcc;return function(_0x526203){if(_0x526203){return _0x23f7b3[_0x91d8('0x1c')](_0x12ed28);}return _0x23f7b3['status'](_0x12ed28)[_0x91d8('0x1d')]();};}function respondWithResult(_0x284d59,_0x2f3029){_0x2f3029=_0x2f3029||0xc8;return function(_0x58ff3b){if(_0x58ff3b){return _0x284d59[_0x91d8('0x1e')](_0x2f3029)[_0x91d8('0x1f')](_0x58ff3b);}};}function respondWithFilteredResult(_0x1e60f9,_0x57ed63){return function(_0x420b1e){if(_0x420b1e){var _0x25a109=typeof _0x57ed63['offset']==='undefined'&&typeof _0x57ed63['limit']===_0x91d8('0x20');var _0x1d8631=_0x420b1e['count'];var _0x512a10=_0x25a109?0x0:_0x57ed63[_0x91d8('0x21')];var _0x166a5b=_0x25a109?_0x420b1e['count']:_0x57ed63[_0x91d8('0x21')]+_0x57ed63[_0x91d8('0x22')];var _0x134b01;if(_0x166a5b>=_0x1d8631){_0x166a5b=_0x1d8631;_0x134b01=0xc8;}else{_0x134b01=0xce;}_0x1e60f9[_0x91d8('0x1e')](_0x134b01);return _0x1e60f9[_0x91d8('0x23')](_0x91d8('0x24'),_0x512a10+'-'+_0x166a5b+'/'+_0x1d8631)[_0x91d8('0x1f')](_0x420b1e);}return null;};}function patchUpdates(_0x4231ad){return function(_0x300549){try{jsonpatch[_0x91d8('0x25')](_0x300549,_0x4231ad,!![]);}catch(_0x2d1577){return BPromise[_0x91d8('0x26')](_0x2d1577);}return _0x300549[_0x91d8('0x27')]();};}function saveUpdates(_0x2c0591,_0x713d0c){return function(_0x67fe89){if(_0x67fe89){return _0x67fe89['update'](_0x2c0591)['then'](function(_0x3e2087){return _0x3e2087;});}return null;};}function removeEntity(_0x1d5f89,_0x2b2ee0){return function(_0x41cd14){if(_0x41cd14){return _0x41cd14[_0x91d8('0x28')]()[_0x91d8('0x29')](function(){_0x1d5f89[_0x91d8('0x1e')](0xcc)[_0x91d8('0x1d')]();});}};}function handleEntityNotFound(_0x124c0d,_0x265349){return function(_0x56723f){if(!_0x56723f){_0x124c0d[_0x91d8('0x1c')](0x194);}return _0x56723f;};}function handleError(_0x297e06,_0x3f1315){_0x3f1315=_0x3f1315||0x1f4;return function(_0xa88da3){logger[_0x91d8('0x2a')](_0xa88da3[_0x91d8('0x2b')]);if(_0xa88da3[_0x91d8('0x2c')]){delete _0xa88da3[_0x91d8('0x2c')];}_0x297e06[_0x91d8('0x1e')](_0x3f1315)[_0x91d8('0x2d')](_0xa88da3);};}exports[_0x91d8('0x2e')]=function(_0x2a67bf,_0x33f020){var _0x1e1152={},_0x50eabd={},_0x107d6c={'count':0x0,'rows':[]};var _0xc51e27=_[_0x91d8('0x2f')](db[_0x91d8('0x30')][_0x91d8('0x31')],function(_0x13eece){return{'name':_0x13eece[_0x91d8('0x32')],'type':_0x13eece[_0x91d8('0x33')]['key']};});_0x50eabd[_0x91d8('0x34')]=_['map'](_0xc51e27,_0x91d8('0x2c'));_0x50eabd[_0x91d8('0x35')]=_[_0x91d8('0x36')](_0x2a67bf[_0x91d8('0x35')]);_0x50eabd['filters']=_[_0x91d8('0x37')](_0x50eabd['model'],_0x50eabd[_0x91d8('0x35')]);_0x1e1152[_0x91d8('0x38')]=_[_0x91d8('0x37')](_0x50eabd['model'],qs[_0x91d8('0x39')](_0x2a67bf[_0x91d8('0x35')][_0x91d8('0x39')]));_0x1e1152[_0x91d8('0x38')]=_0x1e1152['attributes'][_0x91d8('0x3a')]?_0x1e1152[_0x91d8('0x38')]:_0x50eabd[_0x91d8('0x34')];if(!_0x2a67bf['query']['hasOwnProperty'](_0x91d8('0x3b'))){_0x1e1152[_0x91d8('0x22')]=qs['limit'](_0x2a67bf['query'][_0x91d8('0x22')]);_0x1e1152[_0x91d8('0x21')]=qs[_0x91d8('0x21')](_0x2a67bf['query'][_0x91d8('0x21')]);}_0x1e1152[_0x91d8('0x3c')]=qs[_0x91d8('0x3d')](_0x2a67bf[_0x91d8('0x35')]['sort']);_0x1e1152[_0x91d8('0x3e')]=qs['filters'](_[_0x91d8('0x3f')](_0x2a67bf[_0x91d8('0x35')],_0x50eabd[_0x91d8('0x40')]),_0xc51e27);if(_0x2a67bf[_0x91d8('0x35')]['filter']){_0x1e1152[_0x91d8('0x3e')]=_['merge'](_0x1e1152['where'],{'$or':_[_0x91d8('0x2f')](_0xc51e27,function(_0x442b55){if(_0x442b55[_0x91d8('0x33')]!==_0x91d8('0x41')){var _0x37ee79={};_0x37ee79[_0x442b55[_0x91d8('0x2c')]]={'$like':'%'+_0x2a67bf[_0x91d8('0x35')][_0x91d8('0x42')]+'%'};return _0x37ee79;}})});}_0x1e1152=_[_0x91d8('0x43')]({},_0x1e1152,_0x2a67bf[_0x91d8('0x44')]);var _0x3930e2={'where':_0x1e1152[_0x91d8('0x3e')]};return db[_0x91d8('0x30')][_0x91d8('0x45')](_0x3930e2)[_0x91d8('0x29')](function(_0x252dbe){_0x107d6c[_0x91d8('0x45')]=_0x252dbe;if(_0x2a67bf[_0x91d8('0x35')][_0x91d8('0x46')]){_0x1e1152[_0x91d8('0x47')]=[{'all':!![]}];}return db[_0x91d8('0x30')][_0x91d8('0x48')](_0x1e1152);})[_0x91d8('0x29')](function(_0x9775e7){_0x107d6c[_0x91d8('0x49')]=_0x9775e7;return _0x107d6c;})[_0x91d8('0x29')](respondWithFilteredResult(_0x33f020,_0x1e1152))[_0x91d8('0x4a')](handleError(_0x33f020,null));};exports['show']=function(_0x518049,_0x4a8945){var _0x3305bc={'raw':!![],'where':{'id':_0x518049['params']['id']}},_0x2ba9c8={};_0x2ba9c8['model']=_[_0x91d8('0x36')](db[_0x91d8('0x30')][_0x91d8('0x31')]);_0x2ba9c8[_0x91d8('0x35')]=_[_0x91d8('0x36')](_0x518049[_0x91d8('0x35')]);_0x2ba9c8[_0x91d8('0x40')]=_[_0x91d8('0x37')](_0x2ba9c8[_0x91d8('0x34')],_0x2ba9c8[_0x91d8('0x35')]);_0x3305bc[_0x91d8('0x38')]=_[_0x91d8('0x37')](_0x2ba9c8[_0x91d8('0x34')],qs[_0x91d8('0x39')](_0x518049[_0x91d8('0x35')][_0x91d8('0x39')]));_0x3305bc['attributes']=_0x3305bc[_0x91d8('0x38')][_0x91d8('0x3a')]?_0x3305bc[_0x91d8('0x38')]:_0x2ba9c8['model'];if(_0x518049['query'][_0x91d8('0x46')]){_0x3305bc[_0x91d8('0x47')]=[{'all':!![]}];}_0x3305bc=_[_0x91d8('0x43')]({},_0x3305bc,_0x518049[_0x91d8('0x44')]);return db[_0x91d8('0x30')][_0x91d8('0x4b')](_0x3305bc)[_0x91d8('0x29')](handleEntityNotFound(_0x4a8945,null))['then'](respondWithResult(_0x4a8945,null))[_0x91d8('0x4a')](handleError(_0x4a8945,null));};exports['create']=function(_0x2f0eaf,_0x28b416){return db[_0x91d8('0x30')][_0x91d8('0x4c')](_0x2f0eaf[_0x91d8('0x4d')],{})[_0x91d8('0x29')](respondWithResult(_0x28b416,0xc9))['catch'](handleError(_0x28b416,null));};exports[_0x91d8('0x4e')]=function(_0x6b8ffe,_0x4ac41a){if(_0x6b8ffe['body']['id']){delete _0x6b8ffe[_0x91d8('0x4d')]['id'];}return db[_0x91d8('0x30')][_0x91d8('0x4b')]({'where':{'id':_0x6b8ffe['params']['id']}})[_0x91d8('0x29')](handleEntityNotFound(_0x4ac41a,null))['then'](saveUpdates(_0x6b8ffe[_0x91d8('0x4d')],null))['then'](respondWithResult(_0x4ac41a,null))[_0x91d8('0x4a')](handleError(_0x4ac41a,null));};exports[_0x91d8('0x28')]=function(_0x1ed525,_0x27c023){return db[_0x91d8('0x30')][_0x91d8('0x4b')]({'where':{'id':_0x1ed525[_0x91d8('0x4f')]['id']}})[_0x91d8('0x29')](handleEntityNotFound(_0x27c023,null))[_0x91d8('0x29')](removeEntity(_0x27c023,null))[_0x91d8('0x4a')](handleError(_0x27c023,null));}; \ No newline at end of file +var _0x3562=['bluebird','mustache','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','rows','catch','show','params','options','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5f15cd,_0x15ec73){var _0x3b7b7d=function(_0x157ead){while(--_0x157ead){_0x5f15cd['push'](_0x5f15cd['shift']());}};_0x3b7b7d(++_0x15ec73);}(_0x3562,0xde));var _0x2356=function(_0xff3357,_0x3b4152){_0xff3357=_0xff3357-0x0;var _0x16d529=_0x3562[_0xff3357];return _0x16d529;};'use strict';var emlformat=require(_0x2356('0x0'));var rimraf=require(_0x2356('0x1'));var zipdir=require(_0x2356('0x2'));var jsonpatch=require(_0x2356('0x3'));var rp=require(_0x2356('0x4'));var moment=require(_0x2356('0x5'));var BPromise=require(_0x2356('0x6'));var Mustache=require(_0x2356('0x7'));var util=require('util');var path=require(_0x2356('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2356('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2356('0xa'));var squel=require(_0x2356('0xb'));var crypto=require(_0x2356('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2356('0xd'));var toCsv=require(_0x2356('0xe'));var querystring=require(_0x2356('0xf'));var Papa=require(_0x2356('0x10'));var Redis=require(_0x2356('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2356('0x12'));var hardwareService=require(_0x2356('0x13'));var logger=require(_0x2356('0x14'))(_0x2356('0x15'));var utils=require('../../config/utils');var config=require(_0x2356('0x16'));var licenseUtil=require(_0x2356('0x17'));var db=require(_0x2356('0x18'))['db'];function respondWithStatusCode(_0x1fcf58,_0x2b2d9b){_0x2b2d9b=_0x2b2d9b||0xcc;return function(_0x53e632){if(_0x53e632){return _0x1fcf58[_0x2356('0x19')](_0x2b2d9b);}return _0x1fcf58[_0x2356('0x1a')](_0x2b2d9b)[_0x2356('0x1b')]();};}function respondWithResult(_0x122f4d,_0x3d6e54){_0x3d6e54=_0x3d6e54||0xc8;return function(_0x7b9fde){if(_0x7b9fde){return _0x122f4d[_0x2356('0x1a')](_0x3d6e54)[_0x2356('0x1c')](_0x7b9fde);}};}function respondWithFilteredResult(_0x9e63d8,_0x555bca){return function(_0x3fede1){if(_0x3fede1){var _0x5c243b=typeof _0x555bca[_0x2356('0x1d')]==='undefined'&&typeof _0x555bca[_0x2356('0x1e')]===_0x2356('0x1f');var _0x1aeb83=_0x3fede1[_0x2356('0x20')];var _0x4fbbea=_0x5c243b?0x0:_0x555bca[_0x2356('0x1d')];var _0x189273=_0x5c243b?_0x3fede1[_0x2356('0x20')]:_0x555bca[_0x2356('0x1d')]+_0x555bca[_0x2356('0x1e')];var _0x2af451;if(_0x189273>=_0x1aeb83){_0x189273=_0x1aeb83;_0x2af451=0xc8;}else{_0x2af451=0xce;}_0x9e63d8['status'](_0x2af451);return _0x9e63d8[_0x2356('0x21')]('Content-Range',_0x4fbbea+'-'+_0x189273+'/'+_0x1aeb83)['json'](_0x3fede1);}return null;};}function patchUpdates(_0x85c241){return function(_0x10e4c7){try{jsonpatch[_0x2356('0x22')](_0x10e4c7,_0x85c241,!![]);}catch(_0x50c03b){return BPromise[_0x2356('0x23')](_0x50c03b);}return _0x10e4c7[_0x2356('0x24')]();};}function saveUpdates(_0x2671a0,_0x50cab2){return function(_0x3ebbe2){if(_0x3ebbe2){return _0x3ebbe2['update'](_0x2671a0)[_0x2356('0x25')](function(_0x243a0a){return _0x243a0a;});}return null;};}function removeEntity(_0x5b6272,_0x332c20){return function(_0x221193){if(_0x221193){return _0x221193[_0x2356('0x26')]()[_0x2356('0x25')](function(){_0x5b6272[_0x2356('0x1a')](0xcc)[_0x2356('0x1b')]();});}};}function handleEntityNotFound(_0x3e1a5a,_0x534acf){return function(_0x5b2341){if(!_0x5b2341){_0x3e1a5a[_0x2356('0x19')](0x194);}return _0x5b2341;};}function handleError(_0x25db20,_0x4dd486){_0x4dd486=_0x4dd486||0x1f4;return function(_0x1c32d1){logger[_0x2356('0x27')](_0x1c32d1[_0x2356('0x28')]);if(_0x1c32d1[_0x2356('0x29')]){delete _0x1c32d1[_0x2356('0x29')];}_0x25db20[_0x2356('0x1a')](_0x4dd486)['send'](_0x1c32d1);};}exports[_0x2356('0x2a')]=function(_0xbbce0b,_0x455a11){var _0x1a172a={},_0x7d1288={},_0x1d9d01={'count':0x0,'rows':[]};var _0x567c4a=_[_0x2356('0x2b')](db[_0x2356('0x2c')][_0x2356('0x2d')],function(_0x2a78de){return{'name':_0x2a78de[_0x2356('0x2e')],'type':_0x2a78de['type'][_0x2356('0x2f')]};});_0x7d1288[_0x2356('0x30')]=_[_0x2356('0x2b')](_0x567c4a,_0x2356('0x29'));_0x7d1288[_0x2356('0x31')]=_[_0x2356('0x32')](_0xbbce0b[_0x2356('0x31')]);_0x7d1288[_0x2356('0x33')]=_[_0x2356('0x34')](_0x7d1288['model'],_0x7d1288['query']);_0x1a172a[_0x2356('0x35')]=_[_0x2356('0x34')](_0x7d1288[_0x2356('0x30')],qs['fields'](_0xbbce0b[_0x2356('0x31')][_0x2356('0x36')]));_0x1a172a[_0x2356('0x35')]=_0x1a172a[_0x2356('0x35')][_0x2356('0x37')]?_0x1a172a[_0x2356('0x35')]:_0x7d1288['model'];if(!_0xbbce0b[_0x2356('0x31')][_0x2356('0x38')]('nolimit')){_0x1a172a[_0x2356('0x1e')]=qs[_0x2356('0x1e')](_0xbbce0b[_0x2356('0x31')][_0x2356('0x1e')]);_0x1a172a[_0x2356('0x1d')]=qs[_0x2356('0x1d')](_0xbbce0b[_0x2356('0x31')][_0x2356('0x1d')]);}_0x1a172a[_0x2356('0x39')]=qs[_0x2356('0x3a')](_0xbbce0b[_0x2356('0x31')]['sort']);_0x1a172a[_0x2356('0x3b')]=qs[_0x2356('0x33')](_[_0x2356('0x3c')](_0xbbce0b[_0x2356('0x31')],_0x7d1288[_0x2356('0x33')]),_0x567c4a);if(_0xbbce0b[_0x2356('0x31')][_0x2356('0x3d')]){_0x1a172a[_0x2356('0x3b')]=_['merge'](_0x1a172a['where'],{'$or':_[_0x2356('0x2b')](_0x567c4a,function(_0x24ac04){if(_0x24ac04[_0x2356('0x3e')]!==_0x2356('0x3f')){var _0x471493={};_0x471493[_0x24ac04[_0x2356('0x29')]]={'$like':'%'+_0xbbce0b[_0x2356('0x31')][_0x2356('0x3d')]+'%'};return _0x471493;}})});}_0x1a172a=_[_0x2356('0x40')]({},_0x1a172a,_0xbbce0b['options']);var _0x5c66a1={'where':_0x1a172a[_0x2356('0x3b')]};return db[_0x2356('0x2c')][_0x2356('0x20')](_0x5c66a1)[_0x2356('0x25')](function(_0x2c5eac){_0x1d9d01[_0x2356('0x20')]=_0x2c5eac;if(_0xbbce0b[_0x2356('0x31')][_0x2356('0x41')]){_0x1a172a[_0x2356('0x42')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x1a172a);})[_0x2356('0x25')](function(_0x6cc0f4){_0x1d9d01[_0x2356('0x43')]=_0x6cc0f4;return _0x1d9d01;})['then'](respondWithFilteredResult(_0x455a11,_0x1a172a))[_0x2356('0x44')](handleError(_0x455a11,null));};exports[_0x2356('0x45')]=function(_0x4b2be5,_0x1ace77){var _0x5a94a9={'raw':!![],'where':{'id':_0x4b2be5[_0x2356('0x46')]['id']}},_0x482e6a={};_0x482e6a[_0x2356('0x30')]=_['keys'](db['ServicenowField'][_0x2356('0x2d')]);_0x482e6a[_0x2356('0x31')]=_['keys'](_0x4b2be5['query']);_0x482e6a[_0x2356('0x33')]=_[_0x2356('0x34')](_0x482e6a[_0x2356('0x30')],_0x482e6a[_0x2356('0x31')]);_0x5a94a9[_0x2356('0x35')]=_[_0x2356('0x34')](_0x482e6a['model'],qs[_0x2356('0x36')](_0x4b2be5['query']['fields']));_0x5a94a9[_0x2356('0x35')]=_0x5a94a9[_0x2356('0x35')][_0x2356('0x37')]?_0x5a94a9['attributes']:_0x482e6a[_0x2356('0x30')];if(_0x4b2be5[_0x2356('0x31')][_0x2356('0x41')]){_0x5a94a9[_0x2356('0x42')]=[{'all':!![]}];}_0x5a94a9=_[_0x2356('0x40')]({},_0x5a94a9,_0x4b2be5[_0x2356('0x47')]);return db[_0x2356('0x2c')]['find'](_0x5a94a9)['then'](handleEntityNotFound(_0x1ace77,null))[_0x2356('0x25')](respondWithResult(_0x1ace77,null))[_0x2356('0x44')](handleError(_0x1ace77,null));};exports[_0x2356('0x48')]=function(_0x2f0466,_0x4566ae){return db[_0x2356('0x2c')]['create'](_0x2f0466[_0x2356('0x49')],{})['then'](respondWithResult(_0x4566ae,0xc9))[_0x2356('0x44')](handleError(_0x4566ae,null));};exports[_0x2356('0x4a')]=function(_0x4159e9,_0x16b501){if(_0x4159e9[_0x2356('0x49')]['id']){delete _0x4159e9[_0x2356('0x49')]['id'];}return db[_0x2356('0x2c')][_0x2356('0x4b')]({'where':{'id':_0x4159e9['params']['id']}})[_0x2356('0x25')](handleEntityNotFound(_0x16b501,null))[_0x2356('0x25')](saveUpdates(_0x4159e9['body'],null))[_0x2356('0x25')](respondWithResult(_0x16b501,null))[_0x2356('0x44')](handleError(_0x16b501,null));};exports[_0x2356('0x26')]=function(_0x34bfbb,_0x56a09a){return db['ServicenowField']['find']({'where':{'id':_0x34bfbb['params']['id']}})['then'](handleEntityNotFound(_0x56a09a,null))[_0x2356('0x25')](removeEntity(_0x56a09a,null))[_0x2356('0x44')](handleError(_0x56a09a,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 69e7113..424209e 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 _0x0880=['servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0880,0x16b));var _0x0088=function(_0x1fb038,_0xc3f69b){_0x1fb038=_0x1fb038-0x0;var _0x1600dc=_0x0880[_0x1fb038];return _0x1600dc;};'use strict';var _=require(_0x0088('0x0'));var util=require(_0x0088('0x1'));var logger=require('../../config/logger')(_0x0088('0x2'));var moment=require(_0x0088('0x3'));var BPromise=require(_0x0088('0x4'));var rp=require(_0x0088('0x5'));var fs=require('fs');var path=require(_0x0088('0x6'));var rimraf=require('rimraf');var config=require(_0x0088('0x7'));var attributes=require(_0x0088('0x8'));module[_0x0088('0x9')]=function(_0x2d302c,_0x4b22e8){return _0x2d302c[_0x0088('0xa')](_0x0088('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x0088('0xc'),'fields':[_0x0088('0xd'),_0x0088('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x475d=['path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x475d,0x136));var _0xd475=function(_0x4045ff,_0x46cbcd){_0x4045ff=_0x4045ff-0x0;var _0x5797ac=_0x475d[_0x4045ff];return _0x5797ac;};'use strict';var _=require('lodash');var util=require(_0xd475('0x0'));var logger=require(_0xd475('0x1'))(_0xd475('0x2'));var moment=require(_0xd475('0x3'));var BPromise=require(_0xd475('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd475('0x5'));var rimraf=require(_0xd475('0x6'));var config=require(_0xd475('0x7'));var attributes=require(_0xd475('0x8'));module[_0xd475('0x9')]=function(_0x229591,_0x4442f1){return _0x229591[_0xd475('0xa')](_0xd475('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xd475('0xc'),'fields':[_0xd475('0xd'),_0xd475('0xe')],'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 ad2b8c7..4d66407 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 _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x1e3fac,_0xa43e1d){var _0x596d94=function(_0x91e510){while(--_0x91e510){_0x1e3fac['push'](_0x1e3fac['shift']());}};_0x596d94(++_0xa43e1d);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1782ce,_0x248d45){_0x1782ce=_0x1782ce-0x0;var _0x21b855=_0x9ffd[_0x1782ce];return _0x21b855;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xac4a,0x13f));var _0xaac4=function(_0x57e893,_0x4e5b3c){_0x57e893=_0x57e893-0x0;var _0x4522e2=_0xac4a[_0x57e893];return _0x4522e2;};'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 diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 1b5ce19..cc1d009 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x196bfc,_0x10ff6e){var _0x5a032f=function(_0x28ffb){while(--_0x28ffb){_0x196bfc['push'](_0x196bfc['shift']());}};_0x5a032f(++_0x10ff6e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3b8170,_0x3f8a3f){var _0xbd0a3b=function(_0x54fe63){while(--_0x54fe63){_0x3b8170['push'](_0x3b8170['shift']());}};_0xbd0a3b(++_0x3f8a3f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 59086d8..a452a49 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(_0xc4b405,_0x230ff6){var _0x5ea0a9=function(_0x5105f2){while(--_0x5105f2){_0xc4b405['push'](_0xc4b405['shift']());}};_0x5ea0a9(++_0x230ff6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x2665e6,_0x2e074d){var _0x2a4bd2=function(_0x3f9b06){while(--_0x3f9b06){_0x2665e6['push'](_0x2665e6['shift']());}};_0x2a4bd2(++_0x2e074d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 a667aa5..5bc40b1 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 _0xffba=['nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','keys','length','include','catch','create','body','find','params','getConfigurations','findOne','SugarcrmConfiguration','rawAttributes','order','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Calls','module_fields','remove','includes','label','endsWith','values','value','getFields','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','crypto','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','SugarcrmAccount','type','key','model','filters','intersection','query','attributes','fields','hasOwnProperty'];(function(_0x2a723e,_0x61bb43){var _0x48a0e1=function(_0x470e57){while(--_0x470e57){_0x2a723e['push'](_0x2a723e['shift']());}};_0x48a0e1(++_0x61bb43);}(_0xffba,0x19b));var _0xaffb=function(_0x59b2e9,_0x1497aa){_0x59b2e9=_0x59b2e9-0x0;var _0x17c132=_0xffba[_0x59b2e9];return _0x17c132;};'use strict';var emlformat=require(_0xaffb('0x0'));var rimraf=require(_0xaffb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaffb('0x2'));var rp=require(_0xaffb('0x3'));var moment=require(_0xaffb('0x4'));var BPromise=require(_0xaffb('0x5'));var Mustache=require('mustache');var util=require(_0xaffb('0x6'));var path=require('path');var sox=require(_0xaffb('0x7'));var csv=require(_0xaffb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaffb('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xaffb('0xa'));var toCsv=require(_0xaffb('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaffb('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaffb('0xc'));var logger=require(_0xaffb('0xd'))(_0xaffb('0xe'));var utils=require(_0xaffb('0xf'));var config=require(_0xaffb('0x10'));var licenseUtil=require(_0xaffb('0x11'));var db=require(_0xaffb('0x12'))['db'];var integrations=require(_0xaffb('0x13'));function respondWithStatusCode(_0x4398cb,_0x16e652){_0x16e652=_0x16e652||0xcc;return function(_0x19d8aa){if(_0x19d8aa){return _0x4398cb[_0xaffb('0x14')](_0x16e652);}return _0x4398cb['status'](_0x16e652)[_0xaffb('0x15')]();};}function respondWithResult(_0x48a184,_0x5cb01e){_0x5cb01e=_0x5cb01e||0xc8;return function(_0x1bf86b){if(_0x1bf86b){return _0x48a184['status'](_0x5cb01e)['json'](_0x1bf86b);}};}function respondWithFilteredResult(_0x4631d0,_0xe2e4be){return function(_0x134ddc){if(_0x134ddc){var _0x4f5153=typeof _0xe2e4be[_0xaffb('0x16')]===_0xaffb('0x17')&&typeof _0xe2e4be[_0xaffb('0x18')]===_0xaffb('0x17');var _0x33c2e8=_0x134ddc[_0xaffb('0x19')];var _0x46e119=_0x4f5153?0x0:_0xe2e4be['offset'];var _0x2ab183=_0x4f5153?_0x134ddc[_0xaffb('0x19')]:_0xe2e4be[_0xaffb('0x16')]+_0xe2e4be[_0xaffb('0x18')];var _0x9509a1;if(_0x2ab183>=_0x33c2e8){_0x2ab183=_0x33c2e8;_0x9509a1=0xc8;}else{_0x9509a1=0xce;}_0x4631d0[_0xaffb('0x1a')](_0x9509a1);return _0x4631d0[_0xaffb('0x1b')](_0xaffb('0x1c'),_0x46e119+'-'+_0x2ab183+'/'+_0x33c2e8)['json'](_0x134ddc);}return null;};}function patchUpdates(_0x2525ce){return function(_0x6196a1){try{jsonpatch[_0xaffb('0x1d')](_0x6196a1,_0x2525ce,!![]);}catch(_0x233043){return BPromise[_0xaffb('0x1e')](_0x233043);}return _0x6196a1['save']();};}function saveUpdates(_0x25c9a4,_0x40207a){return function(_0x3cc168){if(_0x3cc168){return _0x3cc168[_0xaffb('0x1f')](_0x25c9a4)[_0xaffb('0x20')](function(_0x112c5f){return _0x112c5f;});}return null;};}function removeEntity(_0x311d28,_0x4275bd){return function(_0x125234){if(_0x125234){return _0x125234[_0xaffb('0x21')]()[_0xaffb('0x20')](function(){_0x311d28['status'](0xcc)[_0xaffb('0x15')]();});}};}function handleEntityNotFound(_0x58e28b,_0x1b50b1){return function(_0x3c0d5a){if(!_0x3c0d5a){_0x58e28b[_0xaffb('0x14')](0x194);}return _0x3c0d5a;};}function handleError(_0xfb3910,_0x5d1c47){_0x5d1c47=_0x5d1c47||0x1f4;return function(_0x508995){logger['error'](_0x508995[_0xaffb('0x22')]);if(_0x508995[_0xaffb('0x23')]){delete _0x508995[_0xaffb('0x23')];}_0xfb3910[_0xaffb('0x1a')](_0x5d1c47)[_0xaffb('0x24')](_0x508995);};}exports[_0xaffb('0x25')]=function(_0x318a07,_0x553e5c){var _0x12960f={},_0xb8dfb8={},_0x3b24e3={'count':0x0,'rows':[]};var _0x35b7de=_[_0xaffb('0x26')](db[_0xaffb('0x27')]['rawAttributes'],function(_0x348763){return{'name':_0x348763['fieldName'],'type':_0x348763[_0xaffb('0x28')][_0xaffb('0x29')]};});_0xb8dfb8[_0xaffb('0x2a')]=_[_0xaffb('0x26')](_0x35b7de,_0xaffb('0x23'));_0xb8dfb8['query']=_['keys'](_0x318a07['query']);_0xb8dfb8[_0xaffb('0x2b')]=_[_0xaffb('0x2c')](_0xb8dfb8['model'],_0xb8dfb8[_0xaffb('0x2d')]);_0x12960f[_0xaffb('0x2e')]=_['intersection'](_0xb8dfb8[_0xaffb('0x2a')],qs[_0xaffb('0x2f')](_0x318a07[_0xaffb('0x2d')][_0xaffb('0x2f')]));_0x12960f[_0xaffb('0x2e')]=_0x12960f[_0xaffb('0x2e')]['length']?_0x12960f[_0xaffb('0x2e')]:_0xb8dfb8[_0xaffb('0x2a')];if(!_0x318a07[_0xaffb('0x2d')][_0xaffb('0x30')](_0xaffb('0x31'))){_0x12960f[_0xaffb('0x18')]=qs['limit'](_0x318a07[_0xaffb('0x2d')][_0xaffb('0x18')]);_0x12960f[_0xaffb('0x16')]=qs[_0xaffb('0x16')](_0x318a07[_0xaffb('0x2d')][_0xaffb('0x16')]);}_0x12960f['order']=qs[_0xaffb('0x32')](_0x318a07[_0xaffb('0x2d')]['sort']);_0x12960f[_0xaffb('0x33')]=qs[_0xaffb('0x2b')](_['pick'](_0x318a07[_0xaffb('0x2d')],_0xb8dfb8['filters']),_0x35b7de);if(_0x318a07[_0xaffb('0x2d')]['filter']){_0x12960f['where']=_[_0xaffb('0x34')](_0x12960f[_0xaffb('0x33')],{'$or':_[_0xaffb('0x26')](_0x35b7de,function(_0x34fd1a){if(_0x34fd1a[_0xaffb('0x28')]!==_0xaffb('0x35')){var _0x36f344={};_0x36f344[_0x34fd1a[_0xaffb('0x23')]]={'$like':'%'+_0x318a07[_0xaffb('0x2d')][_0xaffb('0x36')]+'%'};return _0x36f344;}})});}_0x12960f=_[_0xaffb('0x34')]({},_0x12960f,_0x318a07[_0xaffb('0x37')]);var _0x3e9394={'where':_0x12960f[_0xaffb('0x33')]};return db['SugarcrmAccount'][_0xaffb('0x19')](_0x3e9394)['then'](function(_0x282b11){_0x3b24e3[_0xaffb('0x19')]=_0x282b11;if(_0x318a07[_0xaffb('0x2d')][_0xaffb('0x38')]){_0x12960f['include']=[{'all':!![]}];}return db[_0xaffb('0x27')][_0xaffb('0x39')](_0x12960f);})['then'](function(_0x538619){_0x3b24e3[_0xaffb('0x3a')]=_0x538619;return _0x3b24e3;})[_0xaffb('0x20')](respondWithFilteredResult(_0x553e5c,_0x12960f))['catch'](handleError(_0x553e5c,null));};exports[_0xaffb('0x3b')]=function(_0x55357d,_0x329eed){var _0x4bd019={'raw':![],'where':{'id':_0x55357d['params']['id']}},_0x3d7dae={};_0x3d7dae[_0xaffb('0x2a')]=_[_0xaffb('0x3c')](db[_0xaffb('0x27')]['rawAttributes']);_0x3d7dae[_0xaffb('0x2d')]=_[_0xaffb('0x3c')](_0x55357d[_0xaffb('0x2d')]);_0x3d7dae['filters']=_[_0xaffb('0x2c')](_0x3d7dae['model'],_0x3d7dae[_0xaffb('0x2d')]);_0x4bd019[_0xaffb('0x2e')]=_['intersection'](_0x3d7dae[_0xaffb('0x2a')],qs[_0xaffb('0x2f')](_0x55357d[_0xaffb('0x2d')][_0xaffb('0x2f')]));_0x4bd019[_0xaffb('0x2e')]=_0x4bd019[_0xaffb('0x2e')][_0xaffb('0x3d')]?_0x4bd019[_0xaffb('0x2e')]:_0x3d7dae[_0xaffb('0x2a')];if(_0x55357d[_0xaffb('0x2d')][_0xaffb('0x38')]){_0x4bd019[_0xaffb('0x3e')]=[{'all':!![]}];}_0x4bd019=_[_0xaffb('0x34')]({},_0x4bd019,_0x55357d['options']);return db[_0xaffb('0x27')]['find'](_0x4bd019)[_0xaffb('0x20')](handleEntityNotFound(_0x329eed,null))[_0xaffb('0x20')](respondWithResult(_0x329eed,null))[_0xaffb('0x3f')](handleError(_0x329eed,null));};exports[_0xaffb('0x40')]=function(_0x28b96d,_0x571728){return db[_0xaffb('0x27')][_0xaffb('0x40')](_0x28b96d[_0xaffb('0x41')],{})[_0xaffb('0x20')](respondWithResult(_0x571728,0xc9))['catch'](handleError(_0x571728,null));};exports[_0xaffb('0x1f')]=function(_0x5e42f3,_0x529ffb){if(_0x5e42f3[_0xaffb('0x41')]['id']){delete _0x5e42f3[_0xaffb('0x41')]['id'];}return db[_0xaffb('0x27')][_0xaffb('0x42')]({'where':{'id':_0x5e42f3[_0xaffb('0x43')]['id']}})[_0xaffb('0x20')](handleEntityNotFound(_0x529ffb,null))['then'](saveUpdates(_0x5e42f3['body'],null))['then'](respondWithResult(_0x529ffb,null))[_0xaffb('0x3f')](handleError(_0x529ffb,null));};exports[_0xaffb('0x21')]=function(_0x2d89c5,_0x1b9c34){return db[_0xaffb('0x27')]['find']({'where':{'id':_0x2d89c5['params']['id']}})[_0xaffb('0x20')](handleEntityNotFound(_0x1b9c34,null))[_0xaffb('0x20')](removeEntity(_0x1b9c34,null))[_0xaffb('0x3f')](handleError(_0x1b9c34,null));};exports[_0xaffb('0x44')]=function(_0xfaa074,_0x33e7ea,_0x1c7086){var _0x573045={};var _0xa73331={};var _0x4f9583;var _0x458624;return db['SugarcrmAccount'][_0xaffb('0x45')]({'where':{'id':_0xfaa074[_0xaffb('0x43')]['id']}})[_0xaffb('0x20')](handleEntityNotFound(_0x33e7ea,null))[_0xaffb('0x20')](function(_0x3768cc){if(_0x3768cc){_0x4f9583=_0x3768cc;_0xa73331['model']=_[_0xaffb('0x3c')](db[_0xaffb('0x46')][_0xaffb('0x47')]);_0xa73331[_0xaffb('0x2d')]=_[_0xaffb('0x3c')](_0xfaa074[_0xaffb('0x2d')]);_0xa73331[_0xaffb('0x2b')]=_[_0xaffb('0x2c')](_0xa73331[_0xaffb('0x2a')],_0xa73331[_0xaffb('0x2d')]);_0x573045['attributes']=_[_0xaffb('0x2c')](_0xa73331[_0xaffb('0x2a')],qs[_0xaffb('0x2f')](_0xfaa074['query']['fields']));_0x573045[_0xaffb('0x2e')]=_0x573045['attributes'][_0xaffb('0x3d')]?_0x573045[_0xaffb('0x2e')]:_0xa73331[_0xaffb('0x2a')];_0x573045[_0xaffb('0x48')]=qs['sort'](_0xfaa074[_0xaffb('0x2d')][_0xaffb('0x32')]);_0x573045['where']=qs[_0xaffb('0x2b')](_['pick'](_0xfaa074['query'],_0xa73331[_0xaffb('0x2b')]));if(_0xfaa074['query']['filter']){_0x573045[_0xaffb('0x33')]=_[_0xaffb('0x34')](_0x573045[_0xaffb('0x33')],{'$or':_[_0xaffb('0x26')](_0x573045[_0xaffb('0x2e')],function(_0x4bb39a){var _0x51c74d={};_0x51c74d[_0x4bb39a]={'$like':'%'+_0xfaa074[_0xaffb('0x2d')][_0xaffb('0x36')]+'%'};return _0x51c74d;})});}_0x573045=_[_0xaffb('0x34')]({},_0x573045,_0xfaa074['options']);return _0x4f9583[_0xaffb('0x44')](_0x573045);}})[_0xaffb('0x20')](function(_0x31cfd1){if(_0x31cfd1){_0x458624=_0x31cfd1[_0xaffb('0x3d')];if(!_0xfaa074[_0xaffb('0x2d')][_0xaffb('0x30')](_0xaffb('0x31'))){_0x573045[_0xaffb('0x18')]=qs[_0xaffb('0x18')](_0xfaa074[_0xaffb('0x2d')][_0xaffb('0x18')]);_0x573045['offset']=qs[_0xaffb('0x16')](_0xfaa074[_0xaffb('0x2d')]['offset']);}return _0x4f9583[_0xaffb('0x44')](_0x573045);}})[_0xaffb('0x20')](function(_0x3a677c){if(_0x3a677c){return _0x3a677c?{'count':_0x458624,'rows':_0x3a677c}:null;}})[_0xaffb('0x20')](respondWithResult(_0x33e7ea,null))[_0xaffb('0x3f')](handleError(_0x33e7ea,null));};exports[_0xaffb('0x49')]=function(_0x1ab6d0,_0xa83e17,_0x9e2b0d){if(_0x1ab6d0['body']['id']){delete _0x1ab6d0[_0xaffb('0x41')]['id'];}return db[_0xaffb('0x27')][_0xaffb('0x45')]({'where':{'id':_0x1ab6d0[_0xaffb('0x43')]['id']}})[_0xaffb('0x20')](handleEntityNotFound(_0xa83e17,null))[_0xaffb('0x20')](function(_0x334efb){if(_0x334efb){_0x1ab6d0[_0xaffb('0x41')][_0xaffb('0x4a')]=_0x334efb['id'];_0x1ab6d0[_0xaffb('0x41')][_0xaffb('0x4b')]=integrations[_0xaffb('0x4c')](_0x1ab6d0[_0xaffb('0x41')]['channel'],_0x1ab6d0['body']['type']);_0x1ab6d0[_0xaffb('0x41')][_0xaffb('0x4d')]=integrations['getDescriptions'](_0x1ab6d0[_0xaffb('0x41')][_0xaffb('0x4e')],_0x1ab6d0[_0xaffb('0x41')][_0xaffb('0x28')]);return db[_0xaffb('0x46')][_0xaffb('0x40')](_0x1ab6d0[_0xaffb('0x41')],{'include':[{'model':db[_0xaffb('0x4f')],'as':_0xaffb('0x4b')},{'model':db['SugarcrmField'],'as':_0xaffb('0x4d')}]});}return null;})['then'](respondWithResult(_0xa83e17,null))[_0xaffb('0x3f')](handleError(_0xa83e17,null));};exports['getFields']=function(_0x4ebf8b,_0x463904,_0x1c6e5b){var _0x24f4e4='';var _0x32a3df=['id',_0xaffb('0x23'),_0xaffb('0x50'),_0xaffb('0x51'),_0xaffb('0x52'),_0xaffb('0x53'),_0xaffb('0x54'),_0xaffb('0x55'),_0xaffb('0x56'),_0xaffb('0x57'),'parent_name',_0xaffb('0x58')];return db[_0xaffb('0x27')][_0xaffb('0x45')]({'where':{'id':_0x4ebf8b[_0xaffb('0x43')]['id']},'attributes':['id',_0xaffb('0x59'),_0xaffb('0x5a'),_0xaffb('0x5b')]})[_0xaffb('0x20')](handleEntityNotFound(_0x463904,null))['then'](function(_0x459c8b){if(_0x459c8b){_0x24f4e4=_0x459c8b[_0xaffb('0x5b')];var _0x2c6f93=_0x24f4e4[_0xaffb('0x5c')](-0x1);if(_0x2c6f93==='/'){_0x24f4e4=_0x24f4e4[_0xaffb('0x5d')](0x0,_0x24f4e4[_0xaffb('0x5e')](_0x2c6f93));}return rp({'method':_0xaffb('0x5f'),'uri':util[_0xaffb('0x60')](_0xaffb('0x61'),_0x24f4e4,_0xaffb('0x62')),'json':!![],'form':{'method':_0xaffb('0x63'),'input_type':_0xaffb('0x64'),'response_type':'JSON','rest_data':JSON[_0xaffb('0x65')]({'user_auth':{'user_name':_0x459c8b[_0xaffb('0x59')],'password':_0x459c8b[_0xaffb('0x5a')],'encryption':_0xaffb('0x66')},'application':_0xaffb('0x67')})}});}})[_0xaffb('0x20')](function(_0x3b6bc1){if(_0x3b6bc1&&_0x3b6bc1[_0xaffb('0x23')]!==_0xaffb('0x68')&&_0x3b6bc1[_0xaffb('0x23')]!=='Password\x20Expired'){return rp({'method':_0xaffb('0x5f'),'uri':util[_0xaffb('0x60')](_0xaffb('0x61'),_0x24f4e4,_0xaffb('0x62')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xaffb('0x64'),'response_type':'JSON','rest_data':JSON[_0xaffb('0x65')]({'session':_0x3b6bc1['id'],'module_name':_0xaffb('0x69')})}})['then'](function(_0x148e58){if(_0x148e58){var _0x4b115c=_['values'](_0x148e58[_0xaffb('0x6a')]);_[_0xaffb('0x6b')](_0x4b115c,function(_0x4617a3){return _0x32a3df[_0xaffb('0x6c')](_0x4617a3[_0xaffb('0x23')]);});return{'count':_0x4b115c['length'],'rows':_[_0xaffb('0x26')](_0x4b115c,function(_0x3c65eb){return{'id':_0x3c65eb[_0xaffb('0x23')],'name':_0x3c65eb[_0xaffb('0x6d')],'custom':_[_0xaffb('0x6e')](_0x3c65eb[_0xaffb('0x23')],'_c')?!![]:![],'options':_0x3c65eb['options']?_[_0xaffb('0x26')](_[_0xaffb('0x6f')](_0x3c65eb[_0xaffb('0x37')]),function(_0x1b5510){return{'name':_0x1b5510[_0xaffb('0x70')],'value':_0x1b5510['name']};}):[]};})};}})[_0xaffb('0x20')](respondWithResult(_0x463904,null))['catch'](function(_0x14d122){var _0x41af64=_0x4ebf8b[_0xaffb('0x2d')]['test']?0x1f4:_0x14d122['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xaffb('0x71'),_0x41af64,JSON[_0xaffb('0x65')](_0x14d122));delete _0x14d122[_0xaffb('0x23')];if(_0x41af64===0x191){_0x41af64=0x190;}_0x463904['status'](_0x41af64)['send'](_0x4ebf8b[_0xaffb('0x2d')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x14d122[_0xaffb('0x72')]}:_0x14d122);});}else{var _0x3f309a=0x1f4;_0x463904[_0xaffb('0x1a')](_0x3f309a)[_0xaffb('0x24')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x9d00=['rows','catch','show','params','options','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','length','order','pick','hasOwnProperty','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','values','module_fields','remove','includes','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','filter','type','VIRTUAL','merge','SugarcrmAccount','includeAll','include','findAll'];(function(_0x55d911,_0x2b768c){var _0x3104c2=function(_0x1b4386){while(--_0x1b4386){_0x55d911['push'](_0x55d911['shift']());}};_0x3104c2(++_0x2b768c);}(_0x9d00,0x1ab));var _0x09d0=function(_0x35610b,_0x6422d4){_0x35610b=_0x35610b-0x0;var _0x3db3ee=_0x9d00[_0x35610b];return _0x3db3ee;};'use strict';var emlformat=require(_0x09d0('0x0'));var rimraf=require(_0x09d0('0x1'));var zipdir=require(_0x09d0('0x2'));var jsonpatch=require(_0x09d0('0x3'));var rp=require(_0x09d0('0x4'));var moment=require(_0x09d0('0x5'));var BPromise=require(_0x09d0('0x6'));var Mustache=require(_0x09d0('0x7'));var util=require('util');var path=require(_0x09d0('0x8'));var sox=require('sox');var csv=require(_0x09d0('0x9'));var ejs=require(_0x09d0('0xa'));var fs=require('fs');var fs_extra=require(_0x09d0('0xb'));var _=require(_0x09d0('0xc'));var squel=require(_0x09d0('0xd'));var crypto=require(_0x09d0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x09d0('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x09d0('0x10'));var Redis=require('ioredis');var authService=require(_0x09d0('0x11'));var qs=require(_0x09d0('0x12'));var as=require(_0x09d0('0x13'));var hardwareService=require(_0x09d0('0x14'));var logger=require(_0x09d0('0x15'))(_0x09d0('0x16'));var utils=require('../../config/utils');var config=require(_0x09d0('0x17'));var licenseUtil=require(_0x09d0('0x18'));var db=require(_0x09d0('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3a0651,_0x25ca01){_0x25ca01=_0x25ca01||0xcc;return function(_0x104153){if(_0x104153){return _0x3a0651[_0x09d0('0x1a')](_0x25ca01);}return _0x3a0651[_0x09d0('0x1b')](_0x25ca01)['end']();};}function respondWithResult(_0x49ded2,_0x43b7db){_0x43b7db=_0x43b7db||0xc8;return function(_0x4fcc30){if(_0x4fcc30){return _0x49ded2[_0x09d0('0x1b')](_0x43b7db)[_0x09d0('0x1c')](_0x4fcc30);}};}function respondWithFilteredResult(_0x37bde6,_0xabe6ba){return function(_0x422cab){if(_0x422cab){var _0x466014=typeof _0xabe6ba[_0x09d0('0x1d')]===_0x09d0('0x1e')&&typeof _0xabe6ba['limit']==='undefined';var _0x129e9d=_0x422cab[_0x09d0('0x1f')];var _0x56ba84=_0x466014?0x0:_0xabe6ba['offset'];var _0x37f9de=_0x466014?_0x422cab[_0x09d0('0x1f')]:_0xabe6ba[_0x09d0('0x1d')]+_0xabe6ba[_0x09d0('0x20')];var _0xb2a30d;if(_0x37f9de>=_0x129e9d){_0x37f9de=_0x129e9d;_0xb2a30d=0xc8;}else{_0xb2a30d=0xce;}_0x37bde6[_0x09d0('0x1b')](_0xb2a30d);return _0x37bde6[_0x09d0('0x21')](_0x09d0('0x22'),_0x56ba84+'-'+_0x37f9de+'/'+_0x129e9d)[_0x09d0('0x1c')](_0x422cab);}return null;};}function patchUpdates(_0x280982){return function(_0xb4ce7c){try{jsonpatch['apply'](_0xb4ce7c,_0x280982,!![]);}catch(_0x98ac5b){return BPromise[_0x09d0('0x23')](_0x98ac5b);}return _0xb4ce7c[_0x09d0('0x24')]();};}function saveUpdates(_0x484116,_0x2a01c0){return function(_0x56f231){if(_0x56f231){return _0x56f231[_0x09d0('0x25')](_0x484116)[_0x09d0('0x26')](function(_0x471f15){return _0x471f15;});}return null;};}function removeEntity(_0x568aba,_0x4bc121){return function(_0x512277){if(_0x512277){return _0x512277[_0x09d0('0x27')]()['then'](function(){_0x568aba[_0x09d0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46bb8b,_0x2b7414){return function(_0x42013c){if(!_0x42013c){_0x46bb8b[_0x09d0('0x1a')](0x194);}return _0x42013c;};}function handleError(_0x2b50f6,_0x580f78){_0x580f78=_0x580f78||0x1f4;return function(_0x405c3b){logger[_0x09d0('0x28')](_0x405c3b[_0x09d0('0x29')]);if(_0x405c3b['name']){delete _0x405c3b[_0x09d0('0x2a')];}_0x2b50f6[_0x09d0('0x1b')](_0x580f78)[_0x09d0('0x2b')](_0x405c3b);};}exports['index']=function(_0x154a3a,_0x3b0224){var _0x17c423={},_0x3eb58e={},_0x4ca384={'count':0x0,'rows':[]};var _0x38a3f3=_['map'](db['SugarcrmAccount'][_0x09d0('0x2c')],function(_0x41c076){return{'name':_0x41c076['fieldName'],'type':_0x41c076['type'][_0x09d0('0x2d')]};});_0x3eb58e[_0x09d0('0x2e')]=_[_0x09d0('0x2f')](_0x38a3f3,'name');_0x3eb58e[_0x09d0('0x30')]=_[_0x09d0('0x31')](_0x154a3a[_0x09d0('0x30')]);_0x3eb58e[_0x09d0('0x32')]=_[_0x09d0('0x33')](_0x3eb58e[_0x09d0('0x2e')],_0x3eb58e[_0x09d0('0x30')]);_0x17c423[_0x09d0('0x34')]=_[_0x09d0('0x33')](_0x3eb58e['model'],qs['fields'](_0x154a3a['query'][_0x09d0('0x35')]));_0x17c423[_0x09d0('0x34')]=_0x17c423[_0x09d0('0x34')]['length']?_0x17c423['attributes']:_0x3eb58e['model'];if(!_0x154a3a[_0x09d0('0x30')]['hasOwnProperty'](_0x09d0('0x36'))){_0x17c423[_0x09d0('0x20')]=qs['limit'](_0x154a3a[_0x09d0('0x30')][_0x09d0('0x20')]);_0x17c423[_0x09d0('0x1d')]=qs['offset'](_0x154a3a[_0x09d0('0x30')][_0x09d0('0x1d')]);}_0x17c423['order']=qs['sort'](_0x154a3a[_0x09d0('0x30')][_0x09d0('0x37')]);_0x17c423[_0x09d0('0x38')]=qs[_0x09d0('0x32')](_['pick'](_0x154a3a['query'],_0x3eb58e[_0x09d0('0x32')]),_0x38a3f3);if(_0x154a3a[_0x09d0('0x30')][_0x09d0('0x39')]){_0x17c423[_0x09d0('0x38')]=_['merge'](_0x17c423['where'],{'$or':_['map'](_0x38a3f3,function(_0x3b1380){if(_0x3b1380[_0x09d0('0x3a')]!==_0x09d0('0x3b')){var _0x18e665={};_0x18e665[_0x3b1380[_0x09d0('0x2a')]]={'$like':'%'+_0x154a3a['query'][_0x09d0('0x39')]+'%'};return _0x18e665;}})});}_0x17c423=_[_0x09d0('0x3c')]({},_0x17c423,_0x154a3a['options']);var _0x552fd1={'where':_0x17c423[_0x09d0('0x38')]};return db[_0x09d0('0x3d')][_0x09d0('0x1f')](_0x552fd1)['then'](function(_0x44f322){_0x4ca384[_0x09d0('0x1f')]=_0x44f322;if(_0x154a3a[_0x09d0('0x30')][_0x09d0('0x3e')]){_0x17c423[_0x09d0('0x3f')]=[{'all':!![]}];}return db[_0x09d0('0x3d')][_0x09d0('0x40')](_0x17c423);})['then'](function(_0xb5d274){_0x4ca384[_0x09d0('0x41')]=_0xb5d274;return _0x4ca384;})['then'](respondWithFilteredResult(_0x3b0224,_0x17c423))[_0x09d0('0x42')](handleError(_0x3b0224,null));};exports[_0x09d0('0x43')]=function(_0x2c2988,_0x4a6701){var _0x423865={'raw':![],'where':{'id':_0x2c2988[_0x09d0('0x44')]['id']}},_0x576f7a={};_0x576f7a[_0x09d0('0x2e')]=_[_0x09d0('0x31')](db[_0x09d0('0x3d')][_0x09d0('0x2c')]);_0x576f7a[_0x09d0('0x30')]=_[_0x09d0('0x31')](_0x2c2988[_0x09d0('0x30')]);_0x576f7a['filters']=_[_0x09d0('0x33')](_0x576f7a[_0x09d0('0x2e')],_0x576f7a[_0x09d0('0x30')]);_0x423865[_0x09d0('0x34')]=_['intersection'](_0x576f7a[_0x09d0('0x2e')],qs[_0x09d0('0x35')](_0x2c2988[_0x09d0('0x30')][_0x09d0('0x35')]));_0x423865['attributes']=_0x423865[_0x09d0('0x34')]['length']?_0x423865[_0x09d0('0x34')]:_0x576f7a[_0x09d0('0x2e')];if(_0x2c2988[_0x09d0('0x30')][_0x09d0('0x3e')]){_0x423865[_0x09d0('0x3f')]=[{'all':!![]}];}_0x423865=_[_0x09d0('0x3c')]({},_0x423865,_0x2c2988[_0x09d0('0x45')]);return db[_0x09d0('0x3d')][_0x09d0('0x46')](_0x423865)[_0x09d0('0x26')](handleEntityNotFound(_0x4a6701,null))[_0x09d0('0x26')](respondWithResult(_0x4a6701,null))[_0x09d0('0x42')](handleError(_0x4a6701,null));};exports[_0x09d0('0x47')]=function(_0xe2b896,_0xd07da){return db[_0x09d0('0x3d')][_0x09d0('0x47')](_0xe2b896[_0x09d0('0x48')],{})[_0x09d0('0x26')](respondWithResult(_0xd07da,0xc9))[_0x09d0('0x42')](handleError(_0xd07da,null));};exports[_0x09d0('0x25')]=function(_0x335931,_0xd4a12){if(_0x335931[_0x09d0('0x48')]['id']){delete _0x335931[_0x09d0('0x48')]['id'];}return db[_0x09d0('0x3d')]['find']({'where':{'id':_0x335931[_0x09d0('0x44')]['id']}})['then'](handleEntityNotFound(_0xd4a12,null))[_0x09d0('0x26')](saveUpdates(_0x335931[_0x09d0('0x48')],null))[_0x09d0('0x26')](respondWithResult(_0xd4a12,null))[_0x09d0('0x42')](handleError(_0xd4a12,null));};exports[_0x09d0('0x27')]=function(_0x3465c4,_0x5802ee){return db[_0x09d0('0x3d')][_0x09d0('0x46')]({'where':{'id':_0x3465c4[_0x09d0('0x44')]['id']}})[_0x09d0('0x26')](handleEntityNotFound(_0x5802ee,null))['then'](removeEntity(_0x5802ee,null))[_0x09d0('0x42')](handleError(_0x5802ee,null));};exports[_0x09d0('0x49')]=function(_0x26aa04,_0x5cbb20,_0x4c3c5f){var _0xc09fda={};var _0x30e0de={};var _0x1b0009;var _0x46ae9f;return db[_0x09d0('0x3d')][_0x09d0('0x4a')]({'where':{'id':_0x26aa04['params']['id']}})[_0x09d0('0x26')](handleEntityNotFound(_0x5cbb20,null))['then'](function(_0x18f85c){if(_0x18f85c){_0x1b0009=_0x18f85c;_0x30e0de[_0x09d0('0x2e')]=_[_0x09d0('0x31')](db[_0x09d0('0x4b')][_0x09d0('0x2c')]);_0x30e0de['query']=_['keys'](_0x26aa04[_0x09d0('0x30')]);_0x30e0de[_0x09d0('0x32')]=_[_0x09d0('0x33')](_0x30e0de[_0x09d0('0x2e')],_0x30e0de[_0x09d0('0x30')]);_0xc09fda['attributes']=_[_0x09d0('0x33')](_0x30e0de[_0x09d0('0x2e')],qs[_0x09d0('0x35')](_0x26aa04['query'][_0x09d0('0x35')]));_0xc09fda['attributes']=_0xc09fda['attributes'][_0x09d0('0x4c')]?_0xc09fda['attributes']:_0x30e0de[_0x09d0('0x2e')];_0xc09fda[_0x09d0('0x4d')]=qs[_0x09d0('0x37')](_0x26aa04[_0x09d0('0x30')][_0x09d0('0x37')]);_0xc09fda[_0x09d0('0x38')]=qs['filters'](_[_0x09d0('0x4e')](_0x26aa04[_0x09d0('0x30')],_0x30e0de[_0x09d0('0x32')]));if(_0x26aa04[_0x09d0('0x30')][_0x09d0('0x39')]){_0xc09fda[_0x09d0('0x38')]=_[_0x09d0('0x3c')](_0xc09fda[_0x09d0('0x38')],{'$or':_['map'](_0xc09fda['attributes'],function(_0x1afd34){var _0x1febe1={};_0x1febe1[_0x1afd34]={'$like':'%'+_0x26aa04['query'][_0x09d0('0x39')]+'%'};return _0x1febe1;})});}_0xc09fda=_['merge']({},_0xc09fda,_0x26aa04['options']);return _0x1b0009['getConfigurations'](_0xc09fda);}})['then'](function(_0x3272de){if(_0x3272de){_0x46ae9f=_0x3272de[_0x09d0('0x4c')];if(!_0x26aa04[_0x09d0('0x30')][_0x09d0('0x4f')](_0x09d0('0x36'))){_0xc09fda[_0x09d0('0x20')]=qs['limit'](_0x26aa04['query'][_0x09d0('0x20')]);_0xc09fda[_0x09d0('0x1d')]=qs[_0x09d0('0x1d')](_0x26aa04[_0x09d0('0x30')][_0x09d0('0x1d')]);}return _0x1b0009[_0x09d0('0x49')](_0xc09fda);}})[_0x09d0('0x26')](function(_0x258114){if(_0x258114){return _0x258114?{'count':_0x46ae9f,'rows':_0x258114}:null;}})[_0x09d0('0x26')](respondWithResult(_0x5cbb20,null))[_0x09d0('0x42')](handleError(_0x5cbb20,null));};exports['addConfiguration']=function(_0x3fcec4,_0x1cfcaa,_0x341bd8){if(_0x3fcec4[_0x09d0('0x48')]['id']){delete _0x3fcec4[_0x09d0('0x48')]['id'];}return db['SugarcrmAccount'][_0x09d0('0x4a')]({'where':{'id':_0x3fcec4[_0x09d0('0x44')]['id']}})[_0x09d0('0x26')](handleEntityNotFound(_0x1cfcaa,null))[_0x09d0('0x26')](function(_0x345610){if(_0x345610){_0x3fcec4[_0x09d0('0x48')][_0x09d0('0x50')]=_0x345610['id'];_0x3fcec4[_0x09d0('0x48')][_0x09d0('0x51')]=integrations[_0x09d0('0x52')](_0x3fcec4[_0x09d0('0x48')]['channel'],_0x3fcec4[_0x09d0('0x48')][_0x09d0('0x3a')]);_0x3fcec4[_0x09d0('0x48')][_0x09d0('0x53')]=integrations[_0x09d0('0x54')](_0x3fcec4[_0x09d0('0x48')][_0x09d0('0x55')],_0x3fcec4[_0x09d0('0x48')][_0x09d0('0x3a')]);return db[_0x09d0('0x4b')][_0x09d0('0x47')](_0x3fcec4['body'],{'include':[{'model':db[_0x09d0('0x56')],'as':_0x09d0('0x51')},{'model':db[_0x09d0('0x56')],'as':_0x09d0('0x53')}]});}return null;})[_0x09d0('0x26')](respondWithResult(_0x1cfcaa,null))[_0x09d0('0x42')](handleError(_0x1cfcaa,null));};exports['getFields']=function(_0x530a3b,_0x598a43,_0x51a19e){var _0x1a3b66='';var _0x268d2f=['id',_0x09d0('0x2a'),_0x09d0('0x57'),_0x09d0('0x58'),_0x09d0('0x59'),_0x09d0('0x5a'),_0x09d0('0x5b'),_0x09d0('0x5c'),_0x09d0('0x5d'),'parent_type','parent_name',_0x09d0('0x5e')];return db[_0x09d0('0x3d')]['findOne']({'where':{'id':_0x530a3b[_0x09d0('0x44')]['id']},'attributes':['id',_0x09d0('0x5f'),_0x09d0('0x60'),'remoteUri']})[_0x09d0('0x26')](handleEntityNotFound(_0x598a43,null))[_0x09d0('0x26')](function(_0x1d9b2f){if(_0x1d9b2f){_0x1a3b66=_0x1d9b2f[_0x09d0('0x61')];var _0x3dbd5a=_0x1a3b66[_0x09d0('0x62')](-0x1);if(_0x3dbd5a==='/'){_0x1a3b66=_0x1a3b66[_0x09d0('0x63')](0x0,_0x1a3b66[_0x09d0('0x64')](_0x3dbd5a));}return rp({'method':_0x09d0('0x65'),'uri':util[_0x09d0('0x66')](_0x09d0('0x67'),_0x1a3b66,_0x09d0('0x68')),'json':!![],'form':{'method':_0x09d0('0x69'),'input_type':_0x09d0('0x6a'),'response_type':_0x09d0('0x6a'),'rest_data':JSON[_0x09d0('0x6b')]({'user_auth':{'user_name':_0x1d9b2f[_0x09d0('0x5f')],'password':_0x1d9b2f['password'],'encryption':_0x09d0('0x6c')},'application':_0x09d0('0x6d')})}});}})['then'](function(_0x4bb9ad){if(_0x4bb9ad&&_0x4bb9ad[_0x09d0('0x2a')]!==_0x09d0('0x6e')&&_0x4bb9ad[_0x09d0('0x2a')]!==_0x09d0('0x6f')){return rp({'method':_0x09d0('0x65'),'uri':util[_0x09d0('0x66')](_0x09d0('0x67'),_0x1a3b66,_0x09d0('0x68')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x09d0('0x6a'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4bb9ad['id'],'module_name':_0x09d0('0x70')})}})['then'](function(_0x2d06cc){if(_0x2d06cc){var _0x479c89=_[_0x09d0('0x71')](_0x2d06cc[_0x09d0('0x72')]);_[_0x09d0('0x73')](_0x479c89,function(_0xa1863f){return _0x268d2f[_0x09d0('0x74')](_0xa1863f[_0x09d0('0x2a')]);});return{'count':_0x479c89[_0x09d0('0x4c')],'rows':_['map'](_0x479c89,function(_0x325194){return{'id':_0x325194[_0x09d0('0x2a')],'name':_0x325194['label'],'custom':_[_0x09d0('0x75')](_0x325194[_0x09d0('0x2a')],'_c')?!![]:![],'options':_0x325194[_0x09d0('0x45')]?_[_0x09d0('0x2f')](_[_0x09d0('0x71')](_0x325194['options']),function(_0x5c86a0){return{'name':_0x5c86a0[_0x09d0('0x76')],'value':_0x5c86a0[_0x09d0('0x2a')]};}):[]};})};}})[_0x09d0('0x26')](respondWithResult(_0x598a43,null))[_0x09d0('0x42')](function(_0x3b86a6){var _0x14778e=_0x530a3b[_0x09d0('0x30')][_0x09d0('0x77')]?0x1f4:_0x3b86a6[_0x09d0('0x78')]||0x1f4;logger['error'](_0x09d0('0x79'),'getFields',_0x14778e,JSON[_0x09d0('0x6b')](_0x3b86a6));delete _0x3b86a6['name'];if(_0x14778e===0x191){_0x14778e=0x190;}_0x598a43[_0x09d0('0x1b')](_0x14778e)['send'](_0x530a3b[_0x09d0('0x30')]['test']?{'message':_0x09d0('0x7a'),'statusCode':_0x3b86a6['statusCode']}:_0x3b86a6);});}else{var _0x3bc6d4=0x1f4;_0x598a43[_0x09d0('0x1b')](_0x3bc6d4)[_0x09d0('0x2b')]({'message':_0x09d0('0x7a'),'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 76be5a9..e82fa54 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 _0x2323=['int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x5c9f2d,_0xeee094){var _0x4007f0=function(_0xf9dac4){while(--_0xf9dac4){_0x5c9f2d['push'](_0x5c9f2d['shift']());}};_0x4007f0(++_0xeee094);}(_0x2323,0x7f));var _0x3232=function(_0x76faa4,_0x4a8b9c){_0x76faa4=_0x76faa4-0x0;var _0x5cab58=_0x2323[_0x76faa4];return _0x5cab58;};'use strict';var _=require(_0x3232('0x0'));var util=require('util');var logger=require(_0x3232('0x1'))(_0x3232('0x2'));var moment=require(_0x3232('0x3'));var BPromise=require(_0x3232('0x4'));var rp=require(_0x3232('0x5'));var fs=require('fs');var path=require(_0x3232('0x6'));var rimraf=require(_0x3232('0x7'));var config=require(_0x3232('0x8'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x3232('0x9'));module[_0x3232('0xa')]=function(_0x3a2c4f,_0x50a374){return _0x3a2c4f[_0x3232('0xb')](_0x3232('0xc'),attributes,{'tableName':_0x3232('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75ff=['rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x381144,_0x80d3b4){var _0x177a4a=function(_0x1114a1){while(--_0x1114a1){_0x381144['push'](_0x381144['shift']());}};_0x177a4a(++_0x80d3b4);}(_0x75ff,0x131));var _0xf75f=function(_0x420282,_0x1f941f){_0x420282=_0x420282-0x0;var _0x535480=_0x75ff[_0x420282];return _0x535480;};'use strict';var _=require(_0xf75f('0x0'));var util=require(_0xf75f('0x1'));var logger=require(_0xf75f('0x2'))(_0xf75f('0x3'));var moment=require(_0xf75f('0x4'));var BPromise=require('bluebird');var rp=require(_0xf75f('0x5'));var fs=require('fs');var path=require(_0xf75f('0x6'));var rimraf=require(_0xf75f('0x7'));var config=require('../../config/environment');var attributes=require(_0xf75f('0x8'));var integrations=require(_0xf75f('0x9'));module[_0xf75f('0xa')]=function(_0x549e9f,_0x52eed0){return _0x549e9f[_0xf75f('0xb')]('SugarcrmAccount',attributes,{'tableName':_0xf75f('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 f42b557..e9517ae 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 _0xbb22=['model','ShowSugarcrmAccount','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit','map','include'];(function(_0x2d1d94,_0x480325){var _0x1d7064=function(_0x425184){while(--_0x425184){_0x2d1d94['push'](_0x2d1d94['shift']());}};_0x1d7064(++_0x480325);}(_0xbb22,0x12b));var _0x2bb2=function(_0x458050,_0xaeb1b2){_0x458050=_0x458050-0x0;var _0x9df646=_0xbb22[_0x458050];return _0x9df646;};'use strict';var _=require(_0x2bb2('0x0'));var util=require(_0x2bb2('0x1'));var moment=require(_0x2bb2('0x2'));var BPromise=require('bluebird');var rs=require(_0x2bb2('0x3'));var fs=require('fs');var Redis=require(_0x2bb2('0x4'));var db=require(_0x2bb2('0x5'))['db'];var utils=require(_0x2bb2('0x6'));var logger=require(_0x2bb2('0x7'))(_0x2bb2('0x8'));var config=require(_0x2bb2('0x9'));var jayson=require(_0x2bb2('0xa'));var client=jayson[_0x2bb2('0xb')][_0x2bb2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38c39f,_0x298f19,_0x2caee2){return new BPromise(function(_0x4948ed,_0x171a84){return client['request'](_0x38c39f,_0x2caee2)[_0x2bb2('0xd')](function(_0x2464bf){logger['info'](_0x2bb2('0xe'),_0x298f19,_0x2bb2('0xf'));logger[_0x2bb2('0x10')](_0x2bb2('0x11'),_0x298f19,'request\x20sent',JSON[_0x2bb2('0x12')](_0x2464bf));if(_0x2464bf['error']){if(_0x2464bf['error'][_0x2bb2('0x13')]===0x1f4){logger['error'](_0x2bb2('0xe'),_0x298f19,_0x2464bf[_0x2bb2('0x14')]['message']);return _0x171a84(_0x2464bf[_0x2bb2('0x14')][_0x2bb2('0x15')]);}logger[_0x2bb2('0x14')](_0x2bb2('0xe'),_0x298f19,_0x2464bf[_0x2bb2('0x14')][_0x2bb2('0x15')]);return _0x4948ed(_0x2464bf[_0x2bb2('0x14')][_0x2bb2('0x15')]);}else{logger[_0x2bb2('0x16')](_0x2bb2('0xe'),_0x298f19,_0x2bb2('0xf'));_0x4948ed(_0x2464bf[_0x2bb2('0x17')][_0x2bb2('0x15')]);}})[_0x2bb2('0x18')](function(_0x451001){logger[_0x2bb2('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x298f19,_0x451001);_0x171a84(_0x451001);});});}exports[_0x2bb2('0x19')]=function(_0xf01fc6){var _0x951cbb=this;return new Promise(function(_0x4a2d29,_0x23f9ec){return db[_0x2bb2('0x1a')][_0x2bb2('0x1b')]({'raw':_0xf01fc6[_0x2bb2('0x1c')]?_0xf01fc6['options']['raw']===undefined?!![]:![]:!![],'where':_0xf01fc6[_0x2bb2('0x1c')]?_0xf01fc6['options'][_0x2bb2('0x1d')]||null:null,'attributes':_0xf01fc6[_0x2bb2('0x1c')]?_0xf01fc6['options'][_0x2bb2('0x1e')]||null:null,'limit':_0xf01fc6[_0x2bb2('0x1c')]?_0xf01fc6[_0x2bb2('0x1c')][_0x2bb2('0x1f')]||null:null,'include':_0xf01fc6[_0x2bb2('0x1c')]?_0xf01fc6[_0x2bb2('0x1c')]['include']?_[_0x2bb2('0x20')](_0xf01fc6[_0x2bb2('0x1c')][_0x2bb2('0x21')],function(_0x5b9125){return{'model':db[_0x5b9125['model']],'as':_0x5b9125['as'],'attributes':_0x5b9125['attributes'],'include':_0x5b9125['include']?_[_0x2bb2('0x20')](_0x5b9125[_0x2bb2('0x21')],function(_0x1c9d3f){return{'model':db[_0x1c9d3f[_0x2bb2('0x22')]],'as':_0x1c9d3f['as'],'attributes':_0x1c9d3f['attributes'],'include':_0x1c9d3f['include']?_[_0x2bb2('0x20')](_0x1c9d3f[_0x2bb2('0x21')],function(_0x56d3e4){return{'model':db[_0x56d3e4[_0x2bb2('0x22')]],'as':_0x56d3e4['as'],'attributes':_0x56d3e4[_0x2bb2('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32acfd){logger['info'](_0x2bb2('0x19'),_0xf01fc6);logger[_0x2bb2('0x10')]('GetSugarcrmAccount',_0xf01fc6,JSON[_0x2bb2('0x12')](_0x32acfd));_0x4a2d29(_0x32acfd);})[_0x2bb2('0x18')](function(_0x5bcf41){logger[_0x2bb2('0x14')]('GetSugarcrmAccount',_0x5bcf41[_0x2bb2('0x15')],_0xf01fc6);_0x23f9ec(_0x951cbb['error'](0x1f4,_0x5bcf41[_0x2bb2('0x15')]));});});};exports[_0x2bb2('0x23')]=function(_0x38556a){var _0x81a860=this;return new Promise(function(_0x2d8183,_0x4c7595){return db[_0x2bb2('0x1a')]['find']({'raw':_0x38556a[_0x2bb2('0x1c')]?_0x38556a[_0x2bb2('0x1c')][_0x2bb2('0x24')]===undefined?!![]:![]:!![],'where':_0x38556a['options']?_0x38556a['options'][_0x2bb2('0x1d')]||null:null,'attributes':_0x38556a[_0x2bb2('0x1c')]?_0x38556a[_0x2bb2('0x1c')][_0x2bb2('0x1e')]||null:null,'include':_0x38556a[_0x2bb2('0x1c')]?_0x38556a['options'][_0x2bb2('0x21')]?_[_0x2bb2('0x20')](_0x38556a[_0x2bb2('0x1c')]['include'],function(_0x677d){return{'model':db[_0x677d[_0x2bb2('0x22')]],'as':_0x677d['as'],'attributes':_0x677d[_0x2bb2('0x1e')],'include':_0x677d[_0x2bb2('0x21')]?_[_0x2bb2('0x20')](_0x677d[_0x2bb2('0x21')],function(_0x391b44){return{'model':db[_0x391b44[_0x2bb2('0x22')]],'as':_0x391b44['as'],'attributes':_0x391b44[_0x2bb2('0x1e')],'include':_0x391b44[_0x2bb2('0x21')]?_['map'](_0x391b44[_0x2bb2('0x21')],function(_0x42e0a4){return{'model':db[_0x42e0a4[_0x2bb2('0x22')]],'as':_0x42e0a4['as'],'attributes':_0x42e0a4[_0x2bb2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2bb2('0xd')](function(_0x2ae29c){logger[_0x2bb2('0x16')](_0x2bb2('0x23'),_0x38556a);logger['debug'](_0x2bb2('0x23'),_0x38556a,JSON['stringify'](_0x2ae29c));_0x2d8183(_0x2ae29c);})[_0x2bb2('0x18')](function(_0x5f28ff){logger[_0x2bb2('0x14')]('ShowSugarcrmAccount',_0x5f28ff[_0x2bb2('0x15')],_0x38556a);_0x4c7595(_0x81a860[_0x2bb2('0x14')](0x1f4,_0x5f28ff[_0x2bb2('0x15')]));});});}; \ No newline at end of file +var _0x1107=['GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','model','map','debug','stringify','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','rpc','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x229178,_0x12ca77){var _0x95cfe8=function(_0x4e6ad3){while(--_0x4e6ad3){_0x229178['push'](_0x229178['shift']());}};_0x95cfe8(++_0x12ca77);}(_0x1107,0x1eb));var _0x7110=function(_0x508685,_0x9f94af){_0x508685=_0x508685-0x0;var _0x976a76=_0x1107[_0x508685];return _0x976a76;};'use strict';var _=require(_0x7110('0x0'));var util=require(_0x7110('0x1'));var moment=require(_0x7110('0x2'));var BPromise=require(_0x7110('0x3'));var rs=require(_0x7110('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7110('0x5'));var config=require('../../config/environment');var jayson=require(_0x7110('0x6'));var client=jayson[_0x7110('0x7')][_0x7110('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22cdfd,_0x16fd06,_0x5c34bb){return new BPromise(function(_0x1ac528,_0x558ba7){return client[_0x7110('0x9')](_0x22cdfd,_0x5c34bb)[_0x7110('0xa')](function(_0x6f1001){logger[_0x7110('0xb')](_0x7110('0xc'),_0x16fd06,_0x7110('0xd'));logger['debug'](_0x7110('0xe'),_0x16fd06,_0x7110('0xd'),JSON['stringify'](_0x6f1001));if(_0x6f1001[_0x7110('0xf')]){if(_0x6f1001[_0x7110('0xf')][_0x7110('0x10')]===0x1f4){logger['error'](_0x7110('0xc'),_0x16fd06,_0x6f1001[_0x7110('0xf')]['message']);return _0x558ba7(_0x6f1001['error']['message']);}logger[_0x7110('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x16fd06,_0x6f1001[_0x7110('0xf')][_0x7110('0x11')]);return _0x1ac528(_0x6f1001[_0x7110('0xf')]['message']);}else{logger[_0x7110('0xb')](_0x7110('0xc'),_0x16fd06,_0x7110('0xd'));_0x1ac528(_0x6f1001['result'][_0x7110('0x11')]);}})[_0x7110('0x12')](function(_0x23e781){logger['error'](_0x7110('0xc'),_0x16fd06,_0x23e781);_0x558ba7(_0x23e781);});});}exports[_0x7110('0x13')]=function(_0x3b4b3b){var _0x1c0d8d=this;return new Promise(function(_0x1bdb37,_0x29ac55){return db[_0x7110('0x14')][_0x7110('0x15')]({'raw':_0x3b4b3b[_0x7110('0x16')]?_0x3b4b3b[_0x7110('0x16')][_0x7110('0x17')]===undefined?!![]:![]:!![],'where':_0x3b4b3b['options']?_0x3b4b3b['options'][_0x7110('0x18')]||null:null,'attributes':_0x3b4b3b['options']?_0x3b4b3b[_0x7110('0x16')][_0x7110('0x19')]||null:null,'limit':_0x3b4b3b[_0x7110('0x16')]?_0x3b4b3b[_0x7110('0x16')][_0x7110('0x1a')]||null:null,'include':_0x3b4b3b[_0x7110('0x16')]?_0x3b4b3b['options']['include']?_['map'](_0x3b4b3b[_0x7110('0x16')][_0x7110('0x1b')],function(_0x507cb0){return{'model':db[_0x507cb0[_0x7110('0x1c')]],'as':_0x507cb0['as'],'attributes':_0x507cb0[_0x7110('0x19')],'include':_0x507cb0[_0x7110('0x1b')]?_[_0x7110('0x1d')](_0x507cb0[_0x7110('0x1b')],function(_0x4e0b2a){return{'model':db[_0x4e0b2a[_0x7110('0x1c')]],'as':_0x4e0b2a['as'],'attributes':_0x4e0b2a['attributes'],'include':_0x4e0b2a[_0x7110('0x1b')]?_[_0x7110('0x1d')](_0x4e0b2a[_0x7110('0x1b')],function(_0x1d0265){return{'model':db[_0x1d0265['model']],'as':_0x1d0265['as'],'attributes':_0x1d0265[_0x7110('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1fc92b){logger['info'](_0x7110('0x13'),_0x3b4b3b);logger[_0x7110('0x1e')](_0x7110('0x13'),_0x3b4b3b,JSON[_0x7110('0x1f')](_0x1fc92b));_0x1bdb37(_0x1fc92b);})[_0x7110('0x12')](function(_0x3a39fe){logger['error']('GetSugarcrmAccount',_0x3a39fe[_0x7110('0x11')],_0x3b4b3b);_0x29ac55(_0x1c0d8d[_0x7110('0xf')](0x1f4,_0x3a39fe[_0x7110('0x11')]));});});};exports[_0x7110('0x20')]=function(_0x5ad6bc){var _0x5d4664=this;return new Promise(function(_0x18d4b5,_0x1556f2){return db[_0x7110('0x14')][_0x7110('0x21')]({'raw':_0x5ad6bc[_0x7110('0x16')]?_0x5ad6bc[_0x7110('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5ad6bc[_0x7110('0x16')]?_0x5ad6bc[_0x7110('0x16')][_0x7110('0x18')]||null:null,'attributes':_0x5ad6bc[_0x7110('0x16')]?_0x5ad6bc[_0x7110('0x16')][_0x7110('0x19')]||null:null,'include':_0x5ad6bc[_0x7110('0x16')]?_0x5ad6bc[_0x7110('0x16')][_0x7110('0x1b')]?_[_0x7110('0x1d')](_0x5ad6bc[_0x7110('0x16')]['include'],function(_0x4d6267){return{'model':db[_0x4d6267['model']],'as':_0x4d6267['as'],'attributes':_0x4d6267[_0x7110('0x19')],'include':_0x4d6267[_0x7110('0x1b')]?_[_0x7110('0x1d')](_0x4d6267[_0x7110('0x1b')],function(_0x31c6ab){return{'model':db[_0x31c6ab['model']],'as':_0x31c6ab['as'],'attributes':_0x31c6ab[_0x7110('0x19')],'include':_0x31c6ab[_0x7110('0x1b')]?_[_0x7110('0x1d')](_0x31c6ab[_0x7110('0x1b')],function(_0x1d7ae3){return{'model':db[_0x1d7ae3[_0x7110('0x1c')]],'as':_0x1d7ae3['as'],'attributes':_0x1d7ae3[_0x7110('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xeff353){logger[_0x7110('0xb')](_0x7110('0x20'),_0x5ad6bc);logger[_0x7110('0x1e')](_0x7110('0x20'),_0x5ad6bc,JSON[_0x7110('0x1f')](_0xeff353));_0x18d4b5(_0xeff353);})[_0x7110('0x12')](function(_0x137d81){logger[_0x7110('0xf')](_0x7110('0x20'),_0x137d81['message'],_0x5ad6bc);_0x1556f2(_0x5d4664[_0x7110('0xf')](0x1f4,_0x137d81[_0x7110('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 40ee9fd..50c7438 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 _0x5274=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','update','destroy','exports','multer','path','connect-timeout'];(function(_0xec5805,_0x20fb30){var _0x5d4868=function(_0x8f0c9e){while(--_0x8f0c9e){_0xec5805['push'](_0xec5805['shift']());}};_0x5d4868(++_0x20fb30);}(_0x5274,0x9e));var _0x4527=function(_0x2616de,_0x56dab8){_0x2616de=_0x2616de-0x0;var _0x19f21a=_0x5274[_0x2616de];return _0x19f21a;};'use strict';var multer=require(_0x4527('0x0'));var util=require('util');var path=require(_0x4527('0x1'));var timeout=require(_0x4527('0x2'));var express=require(_0x4527('0x3'));var router=express[_0x4527('0x4')]();var fs_extra=require(_0x4527('0x5'));var auth=require(_0x4527('0x6'));var interaction=require(_0x4527('0x7'));var config=require(_0x4527('0x8'));var controller=require(_0x4527('0x9'));router[_0x4527('0xa')]('/',auth[_0x4527('0xb')](),controller[_0x4527('0xc')]);router['get'](_0x4527('0xd'),auth[_0x4527('0xb')](),controller[_0x4527('0xe')]);router[_0x4527('0xa')](_0x4527('0xf'),auth[_0x4527('0xb')](),controller[_0x4527('0x10')]);router[_0x4527('0xa')]('/:id/subjects',auth[_0x4527('0xb')](),controller['getSubjects']);router['get'](_0x4527('0x11'),auth[_0x4527('0xb')](),controller[_0x4527('0x12')]);router[_0x4527('0x13')]('/',auth[_0x4527('0xb')](),controller['create']);router['put'](_0x4527('0xd'),auth[_0x4527('0xb')](),controller[_0x4527('0x14')]);router['delete'](_0x4527('0xd'),auth[_0x4527('0xb')](),controller[_0x4527('0x15')]);module[_0x4527('0x16')]=router; \ No newline at end of file +var _0x1fc6=['../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2ae4f7,_0x5e96c6){var _0x28e9e1=function(_0x5ae093){while(--_0x5ae093){_0x2ae4f7['push'](_0x2ae4f7['shift']());}};_0x28e9e1(++_0x5e96c6);}(_0x1fc6,0x169));var _0x61fc=function(_0x19e928,_0x26a0e4){_0x19e928=_0x19e928-0x0;var _0x4e941f=_0x1fc6[_0x19e928];return _0x4e941f;};'use strict';var multer=require(_0x61fc('0x0'));var util=require(_0x61fc('0x1'));var path=require('path');var timeout=require(_0x61fc('0x2'));var express=require(_0x61fc('0x3'));var router=express[_0x61fc('0x4')]();var fs_extra=require(_0x61fc('0x5'));var auth=require(_0x61fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x61fc('0x7'));var controller=require(_0x61fc('0x8'));router[_0x61fc('0x9')]('/',auth[_0x61fc('0xa')](),controller['index']);router['get'](_0x61fc('0xb'),auth[_0x61fc('0xa')](),controller[_0x61fc('0xc')]);router[_0x61fc('0x9')](_0x61fc('0xd'),auth[_0x61fc('0xa')](),controller['getFields']);router['get'](_0x61fc('0xe'),auth['isAuthenticated'](),controller[_0x61fc('0xf')]);router['get'](_0x61fc('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x61fc('0x11')]('/',auth[_0x61fc('0xa')](),controller[_0x61fc('0x12')]);router['put'](_0x61fc('0xb'),auth[_0x61fc('0xa')](),controller[_0x61fc('0x13')]);router[_0x61fc('0x14')](_0x61fc('0xb'),auth[_0x61fc('0xa')](),controller[_0x61fc('0x15')]);module[_0x61fc('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index d26ce86..6b048bf 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 _0x55ea=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55ea,0xb8));var _0xa55e=function(_0x368f94,_0x8355fb){_0x368f94=_0x368f94-0x0;var _0x157211=_0x55ea[_0x368f94];return _0x157211;};'use strict';var Sequelize=require(_0xa55e('0x0'));module[_0xa55e('0x1')]={'name':{'type':Sequelize[_0xa55e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x50c8=['STRING','sequelize','exports'];(function(_0x260562,_0x1f9729){var _0x57637b=function(_0x37b713){while(--_0x37b713){_0x260562['push'](_0x260562['shift']());}};_0x57637b(++_0x1f9729);}(_0x50c8,0x9d));var _0x850c=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x50c8[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0x850c('0x0'));module[_0x850c('0x1')]={'name':{'type':Sequelize[_0x850c('0x2')]},'description':{'type':Sequelize[_0x850c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index de566b1..8fb0305 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 _0x4051=['body','destroy','getFields','findOne','SugarcrmField','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','include','rows','catch','show','params','fields','includeAll','find','create'];(function(_0xabf623,_0x2a2c3c){var _0x3529a2=function(_0x3ae77c){while(--_0x3ae77c){_0xabf623['push'](_0xabf623['shift']());}};_0x3529a2(++_0x2a2c3c);}(_0x4051,0xf5));var _0x1405=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x4051[_0x5f1391];return _0x50ebe3;};'use strict';var emlformat=require(_0x1405('0x0'));var rimraf=require(_0x1405('0x1'));var zipdir=require(_0x1405('0x2'));var jsonpatch=require(_0x1405('0x3'));var rp=require('request-promise');var moment=require(_0x1405('0x4'));var BPromise=require(_0x1405('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1405('0x6'));var csv=require('to-csv');var ejs=require(_0x1405('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1405('0x8'));var squel=require(_0x1405('0x9'));var crypto=require(_0x1405('0xa'));var jsforce=require(_0x1405('0xb'));var deskjs=require(_0x1405('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1405('0xd'));var Papa=require('papaparse');var Redis=require(_0x1405('0xe'));var authService=require(_0x1405('0xf'));var qs=require(_0x1405('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1405('0x11'));var logger=require('../../config/logger')(_0x1405('0x12'));var utils=require(_0x1405('0x13'));var config=require(_0x1405('0x14'));var licenseUtil=require(_0x1405('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe9afcb,_0x5c8525){_0x5c8525=_0x5c8525||0xcc;return function(_0x3ea452){if(_0x3ea452){return _0xe9afcb[_0x1405('0x16')](_0x5c8525);}return _0xe9afcb[_0x1405('0x17')](_0x5c8525)[_0x1405('0x18')]();};}function respondWithResult(_0xfc0e25,_0x4a6fa0){_0x4a6fa0=_0x4a6fa0||0xc8;return function(_0x5ddbfb){if(_0x5ddbfb){return _0xfc0e25[_0x1405('0x17')](_0x4a6fa0)['json'](_0x5ddbfb);}};}function respondWithFilteredResult(_0xffd95e,_0x5df50){return function(_0x182a3a){if(_0x182a3a){var _0xa2ce35=typeof _0x5df50[_0x1405('0x19')]==='undefined'&&typeof _0x5df50[_0x1405('0x1a')]===_0x1405('0x1b');var _0x50f3a2=_0x182a3a['count'];var _0x320c88=_0xa2ce35?0x0:_0x5df50[_0x1405('0x19')];var _0x478c16=_0xa2ce35?_0x182a3a[_0x1405('0x1c')]:_0x5df50[_0x1405('0x19')]+_0x5df50[_0x1405('0x1a')];var _0x54e4f7;if(_0x478c16>=_0x50f3a2){_0x478c16=_0x50f3a2;_0x54e4f7=0xc8;}else{_0x54e4f7=0xce;}_0xffd95e[_0x1405('0x17')](_0x54e4f7);return _0xffd95e[_0x1405('0x1d')](_0x1405('0x1e'),_0x320c88+'-'+_0x478c16+'/'+_0x50f3a2)[_0x1405('0x1f')](_0x182a3a);}return null;};}function patchUpdates(_0x32e08f){return function(_0x33f07d){try{jsonpatch[_0x1405('0x20')](_0x33f07d,_0x32e08f,!![]);}catch(_0x40d955){return BPromise[_0x1405('0x21')](_0x40d955);}return _0x33f07d[_0x1405('0x22')]();};}function saveUpdates(_0x2363d4,_0x41d49d){return function(_0xf9a52f){if(_0xf9a52f){return _0xf9a52f[_0x1405('0x23')](_0x2363d4)['then'](function(_0x53f57f){return _0x53f57f;});}return null;};}function removeEntity(_0x45e245,_0x36a52c){return function(_0x772bf3){if(_0x772bf3){return _0x772bf3['destroy']()[_0x1405('0x24')](function(){_0x45e245[_0x1405('0x17')](0xcc)[_0x1405('0x18')]();});}};}function handleEntityNotFound(_0x38b3d8,_0xc18eb5){return function(_0xc0a55d){if(!_0xc0a55d){_0x38b3d8[_0x1405('0x16')](0x194);}return _0xc0a55d;};}function handleError(_0x363bf4,_0x33cab4){_0x33cab4=_0x33cab4||0x1f4;return function(_0x408c93){logger[_0x1405('0x25')](_0x408c93[_0x1405('0x26')]);if(_0x408c93[_0x1405('0x27')]){delete _0x408c93['name'];}_0x363bf4[_0x1405('0x17')](_0x33cab4)['send'](_0x408c93);};}exports[_0x1405('0x28')]=function(_0x346f2a,_0xe41411){var _0x33891e={},_0x5ec008={},_0x31f8b0={'count':0x0,'rows':[]};var _0x1e5199=_[_0x1405('0x29')](db[_0x1405('0x2a')][_0x1405('0x2b')],function(_0x333e2c){return{'name':_0x333e2c[_0x1405('0x2c')],'type':_0x333e2c[_0x1405('0x2d')]['key']};});_0x5ec008[_0x1405('0x2e')]=_[_0x1405('0x29')](_0x1e5199,_0x1405('0x27'));_0x5ec008[_0x1405('0x2f')]=_[_0x1405('0x30')](_0x346f2a['query']);_0x5ec008[_0x1405('0x31')]=_[_0x1405('0x32')](_0x5ec008['model'],_0x5ec008[_0x1405('0x2f')]);_0x33891e[_0x1405('0x33')]=_['intersection'](_0x5ec008[_0x1405('0x2e')],qs['fields'](_0x346f2a['query']['fields']));_0x33891e[_0x1405('0x33')]=_0x33891e[_0x1405('0x33')][_0x1405('0x34')]?_0x33891e[_0x1405('0x33')]:_0x5ec008['model'];if(!_0x346f2a[_0x1405('0x2f')][_0x1405('0x35')](_0x1405('0x36'))){_0x33891e['limit']=qs[_0x1405('0x1a')](_0x346f2a['query'][_0x1405('0x1a')]);_0x33891e['offset']=qs[_0x1405('0x19')](_0x346f2a['query'][_0x1405('0x19')]);}_0x33891e[_0x1405('0x37')]=qs[_0x1405('0x38')](_0x346f2a[_0x1405('0x2f')][_0x1405('0x38')]);_0x33891e['where']=qs[_0x1405('0x31')](_['pick'](_0x346f2a[_0x1405('0x2f')],_0x5ec008[_0x1405('0x31')]),_0x1e5199);if(_0x346f2a[_0x1405('0x2f')][_0x1405('0x39')]){_0x33891e['where']=_['merge'](_0x33891e[_0x1405('0x3a')],{'$or':_[_0x1405('0x29')](_0x1e5199,function(_0x455124){if(_0x455124['type']!==_0x1405('0x3b')){var _0xcf6edf={};_0xcf6edf[_0x455124[_0x1405('0x27')]]={'$like':'%'+_0x346f2a[_0x1405('0x2f')][_0x1405('0x39')]+'%'};return _0xcf6edf;}})});}_0x33891e=_[_0x1405('0x3c')]({},_0x33891e,_0x346f2a[_0x1405('0x3d')]);var _0x1eda77={'where':_0x33891e[_0x1405('0x3a')]};return db[_0x1405('0x2a')][_0x1405('0x1c')](_0x1eda77)['then'](function(_0x26f625){_0x31f8b0[_0x1405('0x1c')]=_0x26f625;if(_0x346f2a[_0x1405('0x2f')]['includeAll']){_0x33891e[_0x1405('0x3e')]=[{'all':!![]}];}return db[_0x1405('0x2a')]['findAll'](_0x33891e);})[_0x1405('0x24')](function(_0x330b21){_0x31f8b0[_0x1405('0x3f')]=_0x330b21;return _0x31f8b0;})[_0x1405('0x24')](respondWithFilteredResult(_0xe41411,_0x33891e))[_0x1405('0x40')](handleError(_0xe41411,null));};exports[_0x1405('0x41')]=function(_0x202d2b,_0x3c8b26){var _0x3f4885={'raw':![],'where':{'id':_0x202d2b[_0x1405('0x42')]['id']}},_0x4cd24f={};_0x4cd24f['model']=_[_0x1405('0x30')](db[_0x1405('0x2a')][_0x1405('0x2b')]);_0x4cd24f[_0x1405('0x2f')]=_[_0x1405('0x30')](_0x202d2b['query']);_0x4cd24f['filters']=_[_0x1405('0x32')](_0x4cd24f['model'],_0x4cd24f[_0x1405('0x2f')]);_0x3f4885[_0x1405('0x33')]=_[_0x1405('0x32')](_0x4cd24f[_0x1405('0x2e')],qs[_0x1405('0x43')](_0x202d2b[_0x1405('0x2f')][_0x1405('0x43')]));_0x3f4885[_0x1405('0x33')]=_0x3f4885[_0x1405('0x33')]['length']?_0x3f4885[_0x1405('0x33')]:_0x4cd24f[_0x1405('0x2e')];if(_0x202d2b[_0x1405('0x2f')][_0x1405('0x44')]){_0x3f4885[_0x1405('0x3e')]=[{'all':!![]}];}_0x3f4885=_[_0x1405('0x3c')]({},_0x3f4885,_0x202d2b[_0x1405('0x3d')]);return db[_0x1405('0x2a')][_0x1405('0x45')](_0x3f4885)[_0x1405('0x24')](handleEntityNotFound(_0x3c8b26,null))[_0x1405('0x24')](respondWithResult(_0x3c8b26,null))[_0x1405('0x40')](handleError(_0x3c8b26,null));};exports[_0x1405('0x46')]=function(_0x2dcd8d,_0x22ed43){return db[_0x1405('0x2a')]['create'](_0x2dcd8d[_0x1405('0x47')],{})[_0x1405('0x24')](respondWithResult(_0x22ed43,0xc9))['catch'](handleError(_0x22ed43,null));};exports[_0x1405('0x23')]=function(_0x59b069,_0x29824f){if(_0x59b069[_0x1405('0x47')]['id']){delete _0x59b069[_0x1405('0x47')]['id'];}return db[_0x1405('0x2a')][_0x1405('0x45')]({'where':{'id':_0x59b069[_0x1405('0x42')]['id']}})['then'](handleEntityNotFound(_0x29824f,null))[_0x1405('0x24')](saveUpdates(_0x59b069['body'],null))[_0x1405('0x24')](respondWithResult(_0x29824f,null))[_0x1405('0x40')](handleError(_0x29824f,null));};exports[_0x1405('0x48')]=function(_0x5e4392,_0x390139){return db[_0x1405('0x2a')][_0x1405('0x45')]({'where':{'id':_0x5e4392[_0x1405('0x42')]['id']}})[_0x1405('0x24')](handleEntityNotFound(_0x390139,null))['then'](removeEntity(_0x390139,null))['catch'](handleError(_0x390139,null));};exports[_0x1405('0x49')]=function(_0x28c39b,_0x235659,_0x4b9f86){var _0x40d316={};var _0x34bdbf={};var _0x5af2ad;var _0x32feec;return db['SugarcrmConfiguration'][_0x1405('0x4a')]({'where':{'id':_0x28c39b[_0x1405('0x42')]['id']}})[_0x1405('0x24')](handleEntityNotFound(_0x235659,null))[_0x1405('0x24')](function(_0x5cc95a){if(_0x5cc95a){_0x5af2ad=_0x5cc95a;_0x34bdbf['model']=_['keys'](db[_0x1405('0x4b')][_0x1405('0x2b')]);_0x34bdbf['query']=_[_0x1405('0x30')](_0x28c39b[_0x1405('0x2f')]);_0x34bdbf['filters']=_[_0x1405('0x32')](_0x34bdbf[_0x1405('0x2e')],_0x34bdbf[_0x1405('0x2f')]);_0x40d316[_0x1405('0x33')]=_[_0x1405('0x32')](_0x34bdbf[_0x1405('0x2e')],qs[_0x1405('0x43')](_0x28c39b[_0x1405('0x2f')][_0x1405('0x43')]));_0x40d316[_0x1405('0x33')]=_0x40d316[_0x1405('0x33')]['length']?_0x40d316[_0x1405('0x33')]:_0x34bdbf[_0x1405('0x2e')];_0x40d316[_0x1405('0x37')]=qs['sort'](_0x28c39b[_0x1405('0x2f')]['sort']);_0x40d316[_0x1405('0x3a')]=qs[_0x1405('0x31')](_['pick'](_0x28c39b[_0x1405('0x2f')],_0x34bdbf['filters']));if(_0x28c39b[_0x1405('0x2f')]['filter']){_0x40d316[_0x1405('0x3a')]=_[_0x1405('0x3c')](_0x40d316[_0x1405('0x3a')],{'$or':_[_0x1405('0x29')](_0x40d316[_0x1405('0x33')],function(_0x2de42d){var _0x5a5139={};_0x5a5139[_0x2de42d]={'$like':'%'+_0x28c39b['query']['filter']+'%'};return _0x5a5139;})});}_0x40d316=_[_0x1405('0x3c')]({},_0x40d316,_0x28c39b[_0x1405('0x3d')]);return _0x5af2ad[_0x1405('0x49')](_0x40d316);}})[_0x1405('0x24')](function(_0x4f435){if(_0x4f435){_0x32feec=_0x4f435[_0x1405('0x34')];if(!_0x28c39b['query']['hasOwnProperty'](_0x1405('0x36'))){_0x40d316['limit']=qs[_0x1405('0x1a')](_0x28c39b[_0x1405('0x2f')][_0x1405('0x1a')]);_0x40d316[_0x1405('0x19')]=qs[_0x1405('0x19')](_0x28c39b[_0x1405('0x2f')]['offset']);}return _0x5af2ad[_0x1405('0x49')](_0x40d316);}})[_0x1405('0x24')](function(_0x4abd32){if(_0x4abd32){return _0x4abd32?{'count':_0x32feec,'rows':_0x4abd32}:null;}})[_0x1405('0x24')](respondWithResult(_0x235659,null))['catch'](handleError(_0x235659,null));};exports[_0x1405('0x4c')]=function(_0x34ea85,_0x4338ce,_0xa86781){var _0x34710a={};var _0x2c35e9={};var _0x335f8d;var _0x3e33a4;return db[_0x1405('0x2a')][_0x1405('0x4a')]({'where':{'id':_0x34ea85[_0x1405('0x42')]['id']}})[_0x1405('0x24')](handleEntityNotFound(_0x4338ce,null))[_0x1405('0x24')](function(_0xed979){if(_0xed979){_0x335f8d=_0xed979;_0x2c35e9['model']=_[_0x1405('0x30')](db[_0x1405('0x4b')]['rawAttributes']);_0x2c35e9[_0x1405('0x2f')]=_[_0x1405('0x30')](_0x34ea85[_0x1405('0x2f')]);_0x2c35e9[_0x1405('0x31')]=_[_0x1405('0x32')](_0x2c35e9['model'],_0x2c35e9[_0x1405('0x2f')]);_0x34710a[_0x1405('0x33')]=_['intersection'](_0x2c35e9[_0x1405('0x2e')],qs[_0x1405('0x43')](_0x34ea85[_0x1405('0x2f')][_0x1405('0x43')]));_0x34710a['attributes']=_0x34710a[_0x1405('0x33')]['length']?_0x34710a['attributes']:_0x2c35e9[_0x1405('0x2e')];_0x34710a[_0x1405('0x37')]=qs[_0x1405('0x38')](_0x34ea85[_0x1405('0x2f')][_0x1405('0x38')]);_0x34710a[_0x1405('0x3a')]=qs[_0x1405('0x31')](_['pick'](_0x34ea85[_0x1405('0x2f')],_0x2c35e9[_0x1405('0x31')]));if(_0x34ea85[_0x1405('0x2f')][_0x1405('0x39')]){_0x34710a[_0x1405('0x3a')]=_[_0x1405('0x3c')](_0x34710a[_0x1405('0x3a')],{'$or':_[_0x1405('0x29')](_0x34710a['attributes'],function(_0xa886e2){var _0x3ee430={};_0x3ee430[_0xa886e2]={'$like':'%'+_0x34ea85[_0x1405('0x2f')][_0x1405('0x39')]+'%'};return _0x3ee430;})});}_0x34710a=_[_0x1405('0x3c')]({},_0x34710a,_0x34ea85[_0x1405('0x3d')]);return _0x335f8d['getSubjects'](_0x34710a);}})[_0x1405('0x24')](function(_0x43b3be){if(_0x43b3be){_0x3e33a4=_0x43b3be[_0x1405('0x34')];if(!_0x34ea85['query'][_0x1405('0x35')](_0x1405('0x36'))){_0x34710a['limit']=qs['limit'](_0x34ea85[_0x1405('0x2f')][_0x1405('0x1a')]);_0x34710a[_0x1405('0x19')]=qs[_0x1405('0x19')](_0x34ea85[_0x1405('0x2f')][_0x1405('0x19')]);}return _0x335f8d[_0x1405('0x4c')](_0x34710a);}})[_0x1405('0x24')](function(_0x223223){if(_0x223223){return _0x223223?{'count':_0x3e33a4,'rows':_0x223223}:null;}})[_0x1405('0x24')](respondWithResult(_0x4338ce,null))['catch'](handleError(_0x4338ce,null));};exports['getDescriptions']=function(_0x1b43d9,_0xf440c1,_0x453fd8){var _0x85bd52={};var _0x1a1091={};var _0x1349f2;var _0x48cf66;return db['SugarcrmConfiguration'][_0x1405('0x4a')]({'where':{'id':_0x1b43d9[_0x1405('0x42')]['id']}})[_0x1405('0x24')](handleEntityNotFound(_0xf440c1,null))['then'](function(_0x374b33){if(_0x374b33){_0x1349f2=_0x374b33;_0x1a1091[_0x1405('0x2e')]=_[_0x1405('0x30')](db['SugarcrmField'][_0x1405('0x2b')]);_0x1a1091[_0x1405('0x2f')]=_['keys'](_0x1b43d9[_0x1405('0x2f')]);_0x1a1091[_0x1405('0x31')]=_[_0x1405('0x32')](_0x1a1091[_0x1405('0x2e')],_0x1a1091[_0x1405('0x2f')]);_0x85bd52[_0x1405('0x33')]=_[_0x1405('0x32')](_0x1a1091['model'],qs[_0x1405('0x43')](_0x1b43d9['query'][_0x1405('0x43')]));_0x85bd52[_0x1405('0x33')]=_0x85bd52[_0x1405('0x33')][_0x1405('0x34')]?_0x85bd52[_0x1405('0x33')]:_0x1a1091[_0x1405('0x2e')];_0x85bd52[_0x1405('0x37')]=qs[_0x1405('0x38')](_0x1b43d9[_0x1405('0x2f')][_0x1405('0x38')]);_0x85bd52[_0x1405('0x3a')]=qs[_0x1405('0x31')](_[_0x1405('0x4d')](_0x1b43d9[_0x1405('0x2f')],_0x1a1091[_0x1405('0x31')]));if(_0x1b43d9[_0x1405('0x2f')][_0x1405('0x39')]){_0x85bd52[_0x1405('0x3a')]=_[_0x1405('0x3c')](_0x85bd52[_0x1405('0x3a')],{'$or':_[_0x1405('0x29')](_0x85bd52[_0x1405('0x33')],function(_0x3399e6){var _0x51eaa2={};_0x51eaa2[_0x3399e6]={'$like':'%'+_0x1b43d9[_0x1405('0x2f')][_0x1405('0x39')]+'%'};return _0x51eaa2;})});}_0x85bd52=_[_0x1405('0x3c')]({},_0x85bd52,_0x1b43d9[_0x1405('0x3d')]);return _0x1349f2[_0x1405('0x4e')](_0x85bd52);}})[_0x1405('0x24')](function(_0x4b3b57){if(_0x4b3b57){_0x48cf66=_0x4b3b57[_0x1405('0x34')];if(!_0x1b43d9[_0x1405('0x2f')]['hasOwnProperty'](_0x1405('0x36'))){_0x85bd52['limit']=qs[_0x1405('0x1a')](_0x1b43d9['query'][_0x1405('0x1a')]);_0x85bd52[_0x1405('0x19')]=qs[_0x1405('0x19')](_0x1b43d9[_0x1405('0x2f')]['offset']);}return _0x1349f2['getDescriptions'](_0x85bd52);}})[_0x1405('0x24')](function(_0x1d3fc4){if(_0x1d3fc4){return _0x1d3fc4?{'count':_0x48cf66,'rows':_0x1d3fc4}:null;}})[_0x1405('0x24')](respondWithResult(_0xf440c1,null))['catch'](handleError(_0xf440c1,null));}; \ No newline at end of file +var _0xbfd7=['moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','sendStatus','error','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','catch','show','length','options','find','create','update','body','params','getFields','SugarcrmField','filter','nolimit','getSubjects','findOne','getDescriptions','eml-format'];(function(_0x3a1d40,_0x1242d1){var _0x535931=function(_0x27106c){while(--_0x27106c){_0x3a1d40['push'](_0x3a1d40['shift']());}};_0x535931(++_0x1242d1);}(_0xbfd7,0x1d9));var _0x7bfd=function(_0x748d77,_0x1d499d){_0x748d77=_0x748d77-0x0;var _0x580a14=_0xbfd7[_0x748d77];return _0x580a14;};'use strict';var emlformat=require(_0x7bfd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7bfd('0x1'));var BPromise=require(_0x7bfd('0x2'));var Mustache=require('mustache');var util=require(_0x7bfd('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x7bfd('0x4'));var ejs=require(_0x7bfd('0x5'));var fs=require('fs');var fs_extra=require(_0x7bfd('0x6'));var _=require(_0x7bfd('0x7'));var squel=require(_0x7bfd('0x8'));var crypto=require(_0x7bfd('0x9'));var jsforce=require(_0x7bfd('0xa'));var deskjs=require(_0x7bfd('0xb'));var toCsv=require(_0x7bfd('0x4'));var querystring=require('querystring');var Papa=require(_0x7bfd('0xc'));var Redis=require(_0x7bfd('0xd'));var authService=require(_0x7bfd('0xe'));var qs=require(_0x7bfd('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bfd('0x10'));var logger=require(_0x7bfd('0x11'))(_0x7bfd('0x12'));var utils=require(_0x7bfd('0x13'));var config=require(_0x7bfd('0x14'));var licenseUtil=require(_0x7bfd('0x15'));var db=require(_0x7bfd('0x16'))['db'];function respondWithStatusCode(_0x43607e,_0x5a980e){_0x5a980e=_0x5a980e||0xcc;return function(_0x2426d3){if(_0x2426d3){return _0x43607e['sendStatus'](_0x5a980e);}return _0x43607e[_0x7bfd('0x17')](_0x5a980e)['end']();};}function respondWithResult(_0x499fa7,_0x3892fd){_0x3892fd=_0x3892fd||0xc8;return function(_0x427edd){if(_0x427edd){return _0x499fa7[_0x7bfd('0x17')](_0x3892fd)[_0x7bfd('0x18')](_0x427edd);}};}function respondWithFilteredResult(_0x310fc3,_0x547dfa){return function(_0x5d370c){if(_0x5d370c){var _0x3daf3a=typeof _0x547dfa[_0x7bfd('0x19')]===_0x7bfd('0x1a')&&typeof _0x547dfa['limit']===_0x7bfd('0x1a');var _0x3dd4c0=_0x5d370c[_0x7bfd('0x1b')];var _0x4a0e29=_0x3daf3a?0x0:_0x547dfa[_0x7bfd('0x19')];var _0x426a86=_0x3daf3a?_0x5d370c[_0x7bfd('0x1b')]:_0x547dfa[_0x7bfd('0x19')]+_0x547dfa[_0x7bfd('0x1c')];var _0x41ff33;if(_0x426a86>=_0x3dd4c0){_0x426a86=_0x3dd4c0;_0x41ff33=0xc8;}else{_0x41ff33=0xce;}_0x310fc3[_0x7bfd('0x17')](_0x41ff33);return _0x310fc3[_0x7bfd('0x1d')](_0x7bfd('0x1e'),_0x4a0e29+'-'+_0x426a86+'/'+_0x3dd4c0)[_0x7bfd('0x18')](_0x5d370c);}return null;};}function patchUpdates(_0x5ed426){return function(_0x3d28ec){try{jsonpatch[_0x7bfd('0x1f')](_0x3d28ec,_0x5ed426,!![]);}catch(_0x1d3434){return BPromise[_0x7bfd('0x20')](_0x1d3434);}return _0x3d28ec['save']();};}function saveUpdates(_0x1e64a2,_0x37a4dd){return function(_0x3c24d8){if(_0x3c24d8){return _0x3c24d8['update'](_0x1e64a2)[_0x7bfd('0x21')](function(_0x20a7a6){return _0x20a7a6;});}return null;};}function removeEntity(_0x2e5fa1,_0x3b35ac){return function(_0x39aa2e){if(_0x39aa2e){return _0x39aa2e[_0x7bfd('0x22')]()[_0x7bfd('0x21')](function(){_0x2e5fa1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x453f2b,_0x4232aa){return function(_0x3bfabc){if(!_0x3bfabc){_0x453f2b[_0x7bfd('0x23')](0x194);}return _0x3bfabc;};}function handleError(_0x187055,_0x4f984f){_0x4f984f=_0x4f984f||0x1f4;return function(_0x5ae8a8){logger[_0x7bfd('0x24')](_0x5ae8a8['stack']);if(_0x5ae8a8[_0x7bfd('0x25')]){delete _0x5ae8a8[_0x7bfd('0x25')];}_0x187055[_0x7bfd('0x17')](_0x4f984f)[_0x7bfd('0x26')](_0x5ae8a8);};}exports[_0x7bfd('0x27')]=function(_0x1d053a,_0x4b0c25){var _0x1df3db={},_0x2bd545={},_0x240c85={'count':0x0,'rows':[]};var _0x262803=_[_0x7bfd('0x28')](db[_0x7bfd('0x29')][_0x7bfd('0x2a')],function(_0x33c16f){return{'name':_0x33c16f[_0x7bfd('0x2b')],'type':_0x33c16f[_0x7bfd('0x2c')][_0x7bfd('0x2d')]};});_0x2bd545[_0x7bfd('0x2e')]=_['map'](_0x262803,_0x7bfd('0x25'));_0x2bd545[_0x7bfd('0x2f')]=_[_0x7bfd('0x30')](_0x1d053a[_0x7bfd('0x2f')]);_0x2bd545[_0x7bfd('0x31')]=_['intersection'](_0x2bd545[_0x7bfd('0x2e')],_0x2bd545[_0x7bfd('0x2f')]);_0x1df3db['attributes']=_[_0x7bfd('0x32')](_0x2bd545[_0x7bfd('0x2e')],qs[_0x7bfd('0x33')](_0x1d053a[_0x7bfd('0x2f')][_0x7bfd('0x33')]));_0x1df3db['attributes']=_0x1df3db[_0x7bfd('0x34')]['length']?_0x1df3db[_0x7bfd('0x34')]:_0x2bd545[_0x7bfd('0x2e')];if(!_0x1d053a[_0x7bfd('0x2f')][_0x7bfd('0x35')]('nolimit')){_0x1df3db[_0x7bfd('0x1c')]=qs['limit'](_0x1d053a[_0x7bfd('0x2f')]['limit']);_0x1df3db['offset']=qs[_0x7bfd('0x19')](_0x1d053a[_0x7bfd('0x2f')]['offset']);}_0x1df3db[_0x7bfd('0x36')]=qs[_0x7bfd('0x37')](_0x1d053a[_0x7bfd('0x2f')]['sort']);_0x1df3db[_0x7bfd('0x38')]=qs[_0x7bfd('0x31')](_[_0x7bfd('0x39')](_0x1d053a['query'],_0x2bd545[_0x7bfd('0x31')]),_0x262803);if(_0x1d053a['query']['filter']){_0x1df3db['where']=_[_0x7bfd('0x3a')](_0x1df3db[_0x7bfd('0x38')],{'$or':_[_0x7bfd('0x28')](_0x262803,function(_0x47912f){if(_0x47912f[_0x7bfd('0x2c')]!==_0x7bfd('0x3b')){var _0x10c365={};_0x10c365[_0x47912f[_0x7bfd('0x25')]]={'$like':'%'+_0x1d053a[_0x7bfd('0x2f')]['filter']+'%'};return _0x10c365;}})});}_0x1df3db=_['merge']({},_0x1df3db,_0x1d053a['options']);var _0x4a241b={'where':_0x1df3db[_0x7bfd('0x38')]};return db[_0x7bfd('0x29')][_0x7bfd('0x1b')](_0x4a241b)['then'](function(_0x41e09c){_0x240c85[_0x7bfd('0x1b')]=_0x41e09c;if(_0x1d053a['query'][_0x7bfd('0x3c')]){_0x1df3db[_0x7bfd('0x3d')]=[{'all':!![]}];}return db[_0x7bfd('0x29')][_0x7bfd('0x3e')](_0x1df3db);})[_0x7bfd('0x21')](function(_0x119282){_0x240c85['rows']=_0x119282;return _0x240c85;})[_0x7bfd('0x21')](respondWithFilteredResult(_0x4b0c25,_0x1df3db))[_0x7bfd('0x3f')](handleError(_0x4b0c25,null));};exports[_0x7bfd('0x40')]=function(_0x5746fc,_0x47d4e7){var _0x1f823f={'raw':![],'where':{'id':_0x5746fc['params']['id']}},_0x322168={};_0x322168[_0x7bfd('0x2e')]=_[_0x7bfd('0x30')](db['SugarcrmConfiguration'][_0x7bfd('0x2a')]);_0x322168[_0x7bfd('0x2f')]=_['keys'](_0x5746fc[_0x7bfd('0x2f')]);_0x322168['filters']=_[_0x7bfd('0x32')](_0x322168[_0x7bfd('0x2e')],_0x322168[_0x7bfd('0x2f')]);_0x1f823f['attributes']=_['intersection'](_0x322168[_0x7bfd('0x2e')],qs['fields'](_0x5746fc[_0x7bfd('0x2f')][_0x7bfd('0x33')]));_0x1f823f[_0x7bfd('0x34')]=_0x1f823f[_0x7bfd('0x34')][_0x7bfd('0x41')]?_0x1f823f[_0x7bfd('0x34')]:_0x322168[_0x7bfd('0x2e')];if(_0x5746fc[_0x7bfd('0x2f')]['includeAll']){_0x1f823f[_0x7bfd('0x3d')]=[{'all':!![]}];}_0x1f823f=_['merge']({},_0x1f823f,_0x5746fc[_0x7bfd('0x42')]);return db[_0x7bfd('0x29')][_0x7bfd('0x43')](_0x1f823f)[_0x7bfd('0x21')](handleEntityNotFound(_0x47d4e7,null))[_0x7bfd('0x21')](respondWithResult(_0x47d4e7,null))[_0x7bfd('0x3f')](handleError(_0x47d4e7,null));};exports[_0x7bfd('0x44')]=function(_0x5b0200,_0x487a5e){return db['SugarcrmConfiguration']['create'](_0x5b0200['body'],{})[_0x7bfd('0x21')](respondWithResult(_0x487a5e,0xc9))[_0x7bfd('0x3f')](handleError(_0x487a5e,null));};exports[_0x7bfd('0x45')]=function(_0x32cb01,_0xc16079){if(_0x32cb01[_0x7bfd('0x46')]['id']){delete _0x32cb01['body']['id'];}return db[_0x7bfd('0x29')][_0x7bfd('0x43')]({'where':{'id':_0x32cb01[_0x7bfd('0x47')]['id']}})[_0x7bfd('0x21')](handleEntityNotFound(_0xc16079,null))['then'](saveUpdates(_0x32cb01[_0x7bfd('0x46')],null))[_0x7bfd('0x21')](respondWithResult(_0xc16079,null))['catch'](handleError(_0xc16079,null));};exports['destroy']=function(_0x35604e,_0x36deec){return db[_0x7bfd('0x29')][_0x7bfd('0x43')]({'where':{'id':_0x35604e['params']['id']}})[_0x7bfd('0x21')](handleEntityNotFound(_0x36deec,null))[_0x7bfd('0x21')](removeEntity(_0x36deec,null))[_0x7bfd('0x3f')](handleError(_0x36deec,null));};exports[_0x7bfd('0x48')]=function(_0x346e02,_0x2d0af8,_0x44b2e2){var _0x1fe90f={};var _0x42ad14={};var _0x883a1;var _0x52f037;return db[_0x7bfd('0x29')]['findOne']({'where':{'id':_0x346e02['params']['id']}})[_0x7bfd('0x21')](handleEntityNotFound(_0x2d0af8,null))[_0x7bfd('0x21')](function(_0xebca51){if(_0xebca51){_0x883a1=_0xebca51;_0x42ad14[_0x7bfd('0x2e')]=_[_0x7bfd('0x30')](db[_0x7bfd('0x49')][_0x7bfd('0x2a')]);_0x42ad14[_0x7bfd('0x2f')]=_['keys'](_0x346e02['query']);_0x42ad14[_0x7bfd('0x31')]=_['intersection'](_0x42ad14[_0x7bfd('0x2e')],_0x42ad14['query']);_0x1fe90f[_0x7bfd('0x34')]=_['intersection'](_0x42ad14[_0x7bfd('0x2e')],qs[_0x7bfd('0x33')](_0x346e02[_0x7bfd('0x2f')][_0x7bfd('0x33')]));_0x1fe90f['attributes']=_0x1fe90f['attributes'][_0x7bfd('0x41')]?_0x1fe90f[_0x7bfd('0x34')]:_0x42ad14['model'];_0x1fe90f[_0x7bfd('0x36')]=qs[_0x7bfd('0x37')](_0x346e02[_0x7bfd('0x2f')][_0x7bfd('0x37')]);_0x1fe90f['where']=qs[_0x7bfd('0x31')](_[_0x7bfd('0x39')](_0x346e02['query'],_0x42ad14[_0x7bfd('0x31')]));if(_0x346e02['query'][_0x7bfd('0x4a')]){_0x1fe90f[_0x7bfd('0x38')]=_['merge'](_0x1fe90f[_0x7bfd('0x38')],{'$or':_[_0x7bfd('0x28')](_0x1fe90f[_0x7bfd('0x34')],function(_0x3dfff6){var _0x4b5adf={};_0x4b5adf[_0x3dfff6]={'$like':'%'+_0x346e02['query'][_0x7bfd('0x4a')]+'%'};return _0x4b5adf;})});}_0x1fe90f=_[_0x7bfd('0x3a')]({},_0x1fe90f,_0x346e02[_0x7bfd('0x42')]);return _0x883a1['getFields'](_0x1fe90f);}})[_0x7bfd('0x21')](function(_0x1bbbe8){if(_0x1bbbe8){_0x52f037=_0x1bbbe8['length'];if(!_0x346e02[_0x7bfd('0x2f')][_0x7bfd('0x35')](_0x7bfd('0x4b'))){_0x1fe90f[_0x7bfd('0x1c')]=qs[_0x7bfd('0x1c')](_0x346e02[_0x7bfd('0x2f')][_0x7bfd('0x1c')]);_0x1fe90f[_0x7bfd('0x19')]=qs[_0x7bfd('0x19')](_0x346e02[_0x7bfd('0x2f')][_0x7bfd('0x19')]);}return _0x883a1['getFields'](_0x1fe90f);}})[_0x7bfd('0x21')](function(_0x529052){if(_0x529052){return _0x529052?{'count':_0x52f037,'rows':_0x529052}:null;}})[_0x7bfd('0x21')](respondWithResult(_0x2d0af8,null))[_0x7bfd('0x3f')](handleError(_0x2d0af8,null));};exports[_0x7bfd('0x4c')]=function(_0x3505e0,_0x3c3df7,_0x3ddb6f){var _0x50391e={};var _0xcf4df5={};var _0x1ada6b;var _0xfacdbe;return db[_0x7bfd('0x29')][_0x7bfd('0x4d')]({'where':{'id':_0x3505e0[_0x7bfd('0x47')]['id']}})[_0x7bfd('0x21')](handleEntityNotFound(_0x3c3df7,null))[_0x7bfd('0x21')](function(_0x2c042f){if(_0x2c042f){_0x1ada6b=_0x2c042f;_0xcf4df5['model']=_[_0x7bfd('0x30')](db['SugarcrmField'][_0x7bfd('0x2a')]);_0xcf4df5['query']=_[_0x7bfd('0x30')](_0x3505e0[_0x7bfd('0x2f')]);_0xcf4df5[_0x7bfd('0x31')]=_[_0x7bfd('0x32')](_0xcf4df5[_0x7bfd('0x2e')],_0xcf4df5[_0x7bfd('0x2f')]);_0x50391e[_0x7bfd('0x34')]=_[_0x7bfd('0x32')](_0xcf4df5[_0x7bfd('0x2e')],qs['fields'](_0x3505e0['query'][_0x7bfd('0x33')]));_0x50391e[_0x7bfd('0x34')]=_0x50391e[_0x7bfd('0x34')][_0x7bfd('0x41')]?_0x50391e[_0x7bfd('0x34')]:_0xcf4df5['model'];_0x50391e['order']=qs[_0x7bfd('0x37')](_0x3505e0[_0x7bfd('0x2f')]['sort']);_0x50391e['where']=qs[_0x7bfd('0x31')](_[_0x7bfd('0x39')](_0x3505e0['query'],_0xcf4df5['filters']));if(_0x3505e0[_0x7bfd('0x2f')]['filter']){_0x50391e[_0x7bfd('0x38')]=_[_0x7bfd('0x3a')](_0x50391e[_0x7bfd('0x38')],{'$or':_[_0x7bfd('0x28')](_0x50391e['attributes'],function(_0x422d97){var _0x5c2db0={};_0x5c2db0[_0x422d97]={'$like':'%'+_0x3505e0[_0x7bfd('0x2f')][_0x7bfd('0x4a')]+'%'};return _0x5c2db0;})});}_0x50391e=_['merge']({},_0x50391e,_0x3505e0['options']);return _0x1ada6b[_0x7bfd('0x4c')](_0x50391e);}})['then'](function(_0x43611d){if(_0x43611d){_0xfacdbe=_0x43611d[_0x7bfd('0x41')];if(!_0x3505e0['query']['hasOwnProperty']('nolimit')){_0x50391e['limit']=qs[_0x7bfd('0x1c')](_0x3505e0[_0x7bfd('0x2f')][_0x7bfd('0x1c')]);_0x50391e[_0x7bfd('0x19')]=qs[_0x7bfd('0x19')](_0x3505e0['query'][_0x7bfd('0x19')]);}return _0x1ada6b[_0x7bfd('0x4c')](_0x50391e);}})[_0x7bfd('0x21')](function(_0x41be5e){if(_0x41be5e){return _0x41be5e?{'count':_0xfacdbe,'rows':_0x41be5e}:null;}})[_0x7bfd('0x21')](respondWithResult(_0x3c3df7,null))[_0x7bfd('0x3f')](handleError(_0x3c3df7,null));};exports[_0x7bfd('0x4e')]=function(_0x43f8b7,_0x44cdcf,_0x584619){var _0x15dd4d={};var _0x3169bd={};var _0x203e7e;var _0x497d18;return db[_0x7bfd('0x29')][_0x7bfd('0x4d')]({'where':{'id':_0x43f8b7[_0x7bfd('0x47')]['id']}})[_0x7bfd('0x21')](handleEntityNotFound(_0x44cdcf,null))[_0x7bfd('0x21')](function(_0x3ce097){if(_0x3ce097){_0x203e7e=_0x3ce097;_0x3169bd[_0x7bfd('0x2e')]=_[_0x7bfd('0x30')](db['SugarcrmField'][_0x7bfd('0x2a')]);_0x3169bd[_0x7bfd('0x2f')]=_[_0x7bfd('0x30')](_0x43f8b7['query']);_0x3169bd[_0x7bfd('0x31')]=_[_0x7bfd('0x32')](_0x3169bd['model'],_0x3169bd[_0x7bfd('0x2f')]);_0x15dd4d[_0x7bfd('0x34')]=_[_0x7bfd('0x32')](_0x3169bd['model'],qs['fields'](_0x43f8b7[_0x7bfd('0x2f')][_0x7bfd('0x33')]));_0x15dd4d[_0x7bfd('0x34')]=_0x15dd4d[_0x7bfd('0x34')]['length']?_0x15dd4d['attributes']:_0x3169bd['model'];_0x15dd4d[_0x7bfd('0x36')]=qs[_0x7bfd('0x37')](_0x43f8b7[_0x7bfd('0x2f')][_0x7bfd('0x37')]);_0x15dd4d['where']=qs[_0x7bfd('0x31')](_['pick'](_0x43f8b7[_0x7bfd('0x2f')],_0x3169bd['filters']));if(_0x43f8b7[_0x7bfd('0x2f')][_0x7bfd('0x4a')]){_0x15dd4d[_0x7bfd('0x38')]=_[_0x7bfd('0x3a')](_0x15dd4d[_0x7bfd('0x38')],{'$or':_[_0x7bfd('0x28')](_0x15dd4d[_0x7bfd('0x34')],function(_0x4ee61e){var _0x4cba5d={};_0x4cba5d[_0x4ee61e]={'$like':'%'+_0x43f8b7['query']['filter']+'%'};return _0x4cba5d;})});}_0x15dd4d=_['merge']({},_0x15dd4d,_0x43f8b7['options']);return _0x203e7e[_0x7bfd('0x4e')](_0x15dd4d);}})[_0x7bfd('0x21')](function(_0x1fa124){if(_0x1fa124){_0x497d18=_0x1fa124['length'];if(!_0x43f8b7[_0x7bfd('0x2f')][_0x7bfd('0x35')]('nolimit')){_0x15dd4d[_0x7bfd('0x1c')]=qs['limit'](_0x43f8b7[_0x7bfd('0x2f')][_0x7bfd('0x1c')]);_0x15dd4d['offset']=qs[_0x7bfd('0x19')](_0x43f8b7[_0x7bfd('0x2f')]['offset']);}return _0x203e7e[_0x7bfd('0x4e')](_0x15dd4d);}})[_0x7bfd('0x21')](function(_0x32e7ac){if(_0x32e7ac){return _0x32e7ac?{'count':_0x497d18,'rows':_0x32e7ac}:null;}})[_0x7bfd('0x21')](respondWithResult(_0x44cdcf,null))[_0x7bfd('0x3f')](handleError(_0x44cdcf,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index df8d4d1..4328000 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 _0x5460=['bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x2dcef2,_0x1727a8){var _0x4d65da=function(_0x1b70ef){while(--_0x1b70ef){_0x2dcef2['push'](_0x2dcef2['shift']());}};_0x4d65da(++_0x1727a8);}(_0x5460,0x1dc));var _0x0546=function(_0x36b67c,_0x137421){_0x36b67c=_0x36b67c-0x0;var _0x21777a=_0x5460[_0x36b67c];return _0x21777a;};'use strict';var _=require(_0x0546('0x0'));var util=require(_0x0546('0x1'));var logger=require(_0x0546('0x2'))(_0x0546('0x3'));var moment=require(_0x0546('0x4'));var BPromise=require(_0x0546('0x5'));var rp=require(_0x0546('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0546('0x7'));var config=require(_0x0546('0x8'));var attributes=require(_0x0546('0x9'));module[_0x0546('0xa')]=function(_0x330bcf,_0x2d0a6f){return _0x330bcf['define'](_0x0546('0xb'),attributes,{'tableName':_0x0546('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9e5=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','int_sugarcrm_configurations'];(function(_0x58fbb0,_0xe497b5){var _0x1783d2=function(_0x5554a8){while(--_0x5554a8){_0x58fbb0['push'](_0x58fbb0['shift']());}};_0x1783d2(++_0xe497b5);}(_0xc9e5,0x1c3));var _0x5c9e=function(_0x21beff,_0x15be63){_0x21beff=_0x21beff-0x0;var _0x3e26a5=_0xc9e5[_0x21beff];return _0x3e26a5;};'use strict';var _=require(_0x5c9e('0x0'));var util=require(_0x5c9e('0x1'));var logger=require(_0x5c9e('0x2'))(_0x5c9e('0x3'));var moment=require(_0x5c9e('0x4'));var BPromise=require(_0x5c9e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c9e('0x6'));var rimraf=require(_0x5c9e('0x7'));var config=require(_0x5c9e('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x4cb513,_0x503ab0){return _0x4cb513[_0x5c9e('0x9')]('SugarcrmConfiguration',attributes,{'tableName':_0x5c9e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 8475e63..47b9685 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 _0x21ef=['jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xd1788c,_0x4830a2){var _0x9ce47f=function(_0x150888){while(--_0x150888){_0xd1788c['push'](_0xd1788c['shift']());}};_0x9ce47f(++_0x4830a2);}(_0x21ef,0xa3));var _0xf21e=function(_0x1cd5b1,_0x58dd23){_0x1cd5b1=_0x1cd5b1-0x0;var _0x25b4c7=_0x21ef[_0x1cd5b1];return _0x25b4c7;};'use strict';var _=require(_0xf21e('0x0'));var util=require(_0xf21e('0x1'));var moment=require(_0xf21e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf21e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf21e('0x4'));var logger=require(_0xf21e('0x5'))(_0xf21e('0x6'));var config=require(_0xf21e('0x7'));var jayson=require(_0xf21e('0x8'));var client=jayson['client'][_0xf21e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3207a3,_0x4dbe14,_0x28412c){return new BPromise(function(_0x5c6a2a,_0x1a1dec){return client[_0xf21e('0xa')](_0x3207a3,_0x28412c)[_0xf21e('0xb')](function(_0x2a2cf7){logger[_0xf21e('0xc')](_0xf21e('0xd'),_0x4dbe14,_0xf21e('0xe'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x4dbe14,_0xf21e('0xe'),JSON['stringify'](_0x2a2cf7));if(_0x2a2cf7[_0xf21e('0xf')]){if(_0x2a2cf7['error'][_0xf21e('0x10')]===0x1f4){logger[_0xf21e('0xf')](_0xf21e('0xd'),_0x4dbe14,_0x2a2cf7['error']['message']);return _0x1a1dec(_0x2a2cf7[_0xf21e('0xf')][_0xf21e('0x11')]);}logger[_0xf21e('0xf')](_0xf21e('0xd'),_0x4dbe14,_0x2a2cf7['error'][_0xf21e('0x11')]);return _0x5c6a2a(_0x2a2cf7[_0xf21e('0xf')]['message']);}else{logger[_0xf21e('0xc')](_0xf21e('0xd'),_0x4dbe14,'request\x20sent');_0x5c6a2a(_0x2a2cf7['result']['message']);}})[_0xf21e('0x12')](function(_0x43bf5b){logger[_0xf21e('0xf')](_0xf21e('0xd'),_0x4dbe14,_0x43bf5b);_0x1a1dec(_0x43bf5b);});});} \ No newline at end of file +var _0xc7c3=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xc7c3,0xcd));var _0x3c7c=function(_0x666226,_0x3db4e){_0x666226=_0x666226-0x0;var _0x5e1b47=_0xc7c3[_0x666226];return _0x5e1b47;};'use strict';var _=require(_0x3c7c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3c7c('0x1'));var rs=require(_0x3c7c('0x2'));var fs=require('fs');var Redis=require(_0x3c7c('0x3'));var db=require(_0x3c7c('0x4'))['db'];var utils=require(_0x3c7c('0x5'));var logger=require(_0x3c7c('0x6'))(_0x3c7c('0x7'));var config=require(_0x3c7c('0x8'));var jayson=require(_0x3c7c('0x9'));var client=jayson['client'][_0x3c7c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x132aed,_0x390df1,_0x130a94){return new BPromise(function(_0x8c08d7,_0x1a4526){return client['request'](_0x132aed,_0x130a94)[_0x3c7c('0xb')](function(_0x30debc){logger[_0x3c7c('0xc')](_0x3c7c('0xd'),_0x390df1,'request\x20sent');logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x390df1,_0x3c7c('0xe'),JSON[_0x3c7c('0xf')](_0x30debc));if(_0x30debc['error']){if(_0x30debc[_0x3c7c('0x10')][_0x3c7c('0x11')]===0x1f4){logger[_0x3c7c('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x390df1,_0x30debc[_0x3c7c('0x10')][_0x3c7c('0x12')]);return _0x1a4526(_0x30debc['error']['message']);}logger[_0x3c7c('0x10')](_0x3c7c('0xd'),_0x390df1,_0x30debc[_0x3c7c('0x10')]['message']);return _0x8c08d7(_0x30debc[_0x3c7c('0x10')]['message']);}else{logger[_0x3c7c('0xc')](_0x3c7c('0xd'),_0x390df1,_0x3c7c('0xe'));_0x8c08d7(_0x30debc[_0x3c7c('0x13')][_0x3c7c('0x12')]);}})[_0x3c7c('0x14')](function(_0x57cfcf){logger[_0x3c7c('0x10')](_0x3c7c('0xd'),_0x390df1,_0x57cfcf);_0x1a4526(_0x57cfcf);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 8aaab19..ef362eb 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 _0x02f3=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x02f3,0xc8));var _0x302f=function(_0x51e3cf,_0x1054b8){_0x51e3cf=_0x51e3cf-0x0;var _0x58ae52=_0x02f3[_0x51e3cf];return _0x58ae52;};'use strict';var multer=require(_0x302f('0x0'));var util=require(_0x302f('0x1'));var path=require('path');var timeout=require(_0x302f('0x2'));var express=require(_0x302f('0x3'));var router=express[_0x302f('0x4')]();var fs_extra=require(_0x302f('0x5'));var auth=require(_0x302f('0x6'));var interaction=require(_0x302f('0x7'));var config=require(_0x302f('0x8'));var controller=require(_0x302f('0x9'));router[_0x302f('0xa')]('/',auth[_0x302f('0xb')](),controller[_0x302f('0xc')]);router[_0x302f('0xa')](_0x302f('0xd'),auth[_0x302f('0xb')](),controller[_0x302f('0xe')]);router[_0x302f('0xf')]('/',auth[_0x302f('0xb')](),controller['create']);router[_0x302f('0x10')](_0x302f('0xd'),auth[_0x302f('0xb')](),controller[_0x302f('0x11')]);router['delete'](_0x302f('0xd'),auth[_0x302f('0xb')](),controller[_0x302f('0x12')]);module[_0x302f('0x13')]=router; \ No newline at end of file +var _0xf995=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','show','post','create','/:id','update','delete','multer','connect-timeout','express','Router'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xf995,0xfb));var _0x5f99=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf995[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x5f99('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5f99('0x1'));var express=require(_0x5f99('0x2'));var router=express[_0x5f99('0x3')]();var fs_extra=require(_0x5f99('0x4'));var auth=require(_0x5f99('0x5'));var interaction=require(_0x5f99('0x6'));var config=require(_0x5f99('0x7'));var controller=require(_0x5f99('0x8'));router[_0x5f99('0x9')]('/',auth[_0x5f99('0xa')](),controller['index']);router[_0x5f99('0x9')]('/:id',auth[_0x5f99('0xa')](),controller[_0x5f99('0xb')]);router[_0x5f99('0xc')]('/',auth[_0x5f99('0xa')](),controller[_0x5f99('0xd')]);router['put'](_0x5f99('0xe'),auth[_0x5f99('0xa')](),controller[_0x5f99('0xf')]);router[_0x5f99('0x10')](_0x5f99('0xe'),auth[_0x5f99('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index a674bc6..f56a7d4 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 _0x78f0=['STRING','ENUM','BOOLEAN','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x313df3,_0x4fca45){var _0x241d59=function(_0x452786){while(--_0x452786){_0x313df3['push'](_0x313df3['shift']());}};_0x241d59(++_0x4fca45);}(_0x78f0,0x186));var _0x078f=function(_0x393328,_0x54f281){_0x393328=_0x393328-0x0;var _0x5d0be5=_0x78f0[_0x393328];return _0x5d0be5;};'use strict';var Sequelize=require('sequelize');module[_0x078f('0x0')]={'type':{'type':Sequelize['ENUM'](_0x078f('0x1'),_0x078f('0x2'),_0x078f('0x3'),_0x078f('0x4'),_0x078f('0x5')),'defaultValue':_0x078f('0x1')},'content':{'type':Sequelize[_0x078f('0x6')]},'key':{'type':Sequelize[_0x078f('0x6')]},'keyType':{'type':Sequelize[_0x078f('0x7')](_0x078f('0x1'),_0x078f('0x2'),_0x078f('0x3'))},'keyContent':{'type':Sequelize[_0x078f('0x6')]},'idField':{'type':Sequelize[_0x078f('0x6')]},'nameField':{'type':Sequelize[_0x078f('0x6')]},'customField':{'type':Sequelize[_0x078f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x078f('0x6')]}}; \ No newline at end of file +var _0xbaa0=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x201e07,_0x2dacc6){var _0x519a0f=function(_0x10a35f){while(--_0x10a35f){_0x201e07['push'](_0x201e07['shift']());}};_0x519a0f(++_0x2dacc6);}(_0xbaa0,0xb5));var _0x0baa=function(_0x583080,_0x3de25b){_0x583080=_0x583080-0x0;var _0x169819=_0xbaa0[_0x583080];return _0x169819;};'use strict';var Sequelize=require(_0x0baa('0x0'));module[_0x0baa('0x1')]={'type':{'type':Sequelize[_0x0baa('0x2')](_0x0baa('0x3'),_0x0baa('0x4'),_0x0baa('0x5'),_0x0baa('0x6'),'picklist'),'defaultValue':_0x0baa('0x3')},'content':{'type':Sequelize[_0x0baa('0x7')]},'key':{'type':Sequelize[_0x0baa('0x7')]},'keyType':{'type':Sequelize[_0x0baa('0x2')](_0x0baa('0x3'),_0x0baa('0x4'),_0x0baa('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0baa('0x7')]},'nameField':{'type':Sequelize[_0x0baa('0x7')]},'customField':{'type':Sequelize[_0x0baa('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0baa('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 389954c..b47b976 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 _0xb912=['offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','name','send','map','SugarcrmField','query','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','where','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','merge','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb912,0xfb));var _0x2b91=function(_0x32574c,_0x42b146){_0x32574c=_0x32574c-0x0;var _0xee363a=_0xb912[_0x32574c];return _0xee363a;};'use strict';var emlformat=require(_0x2b91('0x0'));var rimraf=require(_0x2b91('0x1'));var zipdir=require(_0x2b91('0x2'));var jsonpatch=require(_0x2b91('0x3'));var rp=require('request-promise');var moment=require(_0x2b91('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2b91('0x5'));var util=require(_0x2b91('0x6'));var path=require(_0x2b91('0x7'));var sox=require(_0x2b91('0x8'));var csv=require(_0x2b91('0x9'));var ejs=require(_0x2b91('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b91('0xb'));var squel=require(_0x2b91('0xc'));var crypto=require(_0x2b91('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2b91('0xe'));var toCsv=require(_0x2b91('0x9'));var querystring=require('querystring');var Papa=require(_0x2b91('0xf'));var Redis=require('ioredis');var authService=require(_0x2b91('0x10'));var qs=require(_0x2b91('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b91('0x12'));var logger=require(_0x2b91('0x13'))(_0x2b91('0x14'));var utils=require(_0x2b91('0x15'));var config=require(_0x2b91('0x16'));var licenseUtil=require(_0x2b91('0x17'));var db=require(_0x2b91('0x18'))['db'];function respondWithStatusCode(_0x18dea3,_0x43df86){_0x43df86=_0x43df86||0xcc;return function(_0x3df196){if(_0x3df196){return _0x18dea3[_0x2b91('0x19')](_0x43df86);}return _0x18dea3[_0x2b91('0x1a')](_0x43df86)[_0x2b91('0x1b')]();};}function respondWithResult(_0x5b4324,_0x5c7d27){_0x5c7d27=_0x5c7d27||0xc8;return function(_0x43d412){if(_0x43d412){return _0x5b4324['status'](_0x5c7d27)[_0x2b91('0x1c')](_0x43d412);}};}function respondWithFilteredResult(_0x33dcfe,_0x2c9528){return function(_0x5590c6){if(_0x5590c6){var _0x5dc7a0=typeof _0x2c9528[_0x2b91('0x1d')]===_0x2b91('0x1e')&&typeof _0x2c9528[_0x2b91('0x1f')]===_0x2b91('0x1e');var _0x69d036=_0x5590c6[_0x2b91('0x20')];var _0x52b727=_0x5dc7a0?0x0:_0x2c9528[_0x2b91('0x1d')];var _0xa86cd2=_0x5dc7a0?_0x5590c6[_0x2b91('0x20')]:_0x2c9528[_0x2b91('0x1d')]+_0x2c9528[_0x2b91('0x1f')];var _0x16efca;if(_0xa86cd2>=_0x69d036){_0xa86cd2=_0x69d036;_0x16efca=0xc8;}else{_0x16efca=0xce;}_0x33dcfe[_0x2b91('0x1a')](_0x16efca);return _0x33dcfe[_0x2b91('0x21')](_0x2b91('0x22'),_0x52b727+'-'+_0xa86cd2+'/'+_0x69d036)['json'](_0x5590c6);}return null;};}function patchUpdates(_0x1c3ed5){return function(_0x90ee1f){try{jsonpatch[_0x2b91('0x23')](_0x90ee1f,_0x1c3ed5,!![]);}catch(_0x16ae2a){return BPromise['reject'](_0x16ae2a);}return _0x90ee1f['save']();};}function saveUpdates(_0x2ceea3,_0x5a7ceb){return function(_0x271577){if(_0x271577){return _0x271577[_0x2b91('0x24')](_0x2ceea3)[_0x2b91('0x25')](function(_0x5ce791){return _0x5ce791;});}return null;};}function removeEntity(_0x2141bd,_0x58584c){return function(_0x2d750e){if(_0x2d750e){return _0x2d750e[_0x2b91('0x26')]()['then'](function(){_0x2141bd[_0x2b91('0x1a')](0xcc)[_0x2b91('0x1b')]();});}};}function handleEntityNotFound(_0x1f03b2,_0x21d134){return function(_0x47d56f){if(!_0x47d56f){_0x1f03b2[_0x2b91('0x19')](0x194);}return _0x47d56f;};}function handleError(_0x44e50e,_0x4528ed){_0x4528ed=_0x4528ed||0x1f4;return function(_0x2f4b52){logger['error'](_0x2f4b52['stack']);if(_0x2f4b52['name']){delete _0x2f4b52[_0x2b91('0x27')];}_0x44e50e[_0x2b91('0x1a')](_0x4528ed)[_0x2b91('0x28')](_0x2f4b52);};}exports['index']=function(_0x3813fb,_0x1aa64c){var _0x6bae14={},_0x2fc972={},_0x2e5622={'count':0x0,'rows':[]};var _0x3f9895=_[_0x2b91('0x29')](db[_0x2b91('0x2a')]['rawAttributes'],function(_0x26f917){return{'name':_0x26f917['fieldName'],'type':_0x26f917['type']['key']};});_0x2fc972['model']=_['map'](_0x3f9895,_0x2b91('0x27'));_0x2fc972[_0x2b91('0x2b')]=_['keys'](_0x3813fb[_0x2b91('0x2b')]);_0x2fc972[_0x2b91('0x2c')]=_[_0x2b91('0x2d')](_0x2fc972[_0x2b91('0x2e')],_0x2fc972[_0x2b91('0x2b')]);_0x6bae14[_0x2b91('0x2f')]=_['intersection'](_0x2fc972['model'],qs[_0x2b91('0x30')](_0x3813fb[_0x2b91('0x2b')]['fields']));_0x6bae14[_0x2b91('0x2f')]=_0x6bae14[_0x2b91('0x2f')][_0x2b91('0x31')]?_0x6bae14[_0x2b91('0x2f')]:_0x2fc972[_0x2b91('0x2e')];if(!_0x3813fb['query']['hasOwnProperty'](_0x2b91('0x32'))){_0x6bae14['limit']=qs['limit'](_0x3813fb[_0x2b91('0x2b')]['limit']);_0x6bae14[_0x2b91('0x1d')]=qs[_0x2b91('0x1d')](_0x3813fb[_0x2b91('0x2b')][_0x2b91('0x1d')]);}_0x6bae14['order']=qs[_0x2b91('0x33')](_0x3813fb[_0x2b91('0x2b')]['sort']);_0x6bae14['where']=qs[_0x2b91('0x2c')](_[_0x2b91('0x34')](_0x3813fb[_0x2b91('0x2b')],_0x2fc972[_0x2b91('0x2c')]),_0x3f9895);if(_0x3813fb['query']['filter']){_0x6bae14['where']=_['merge'](_0x6bae14[_0x2b91('0x35')],{'$or':_['map'](_0x3f9895,function(_0x509a7d){if(_0x509a7d[_0x2b91('0x36')]!==_0x2b91('0x37')){var _0x1bba55={};_0x1bba55[_0x509a7d[_0x2b91('0x27')]]={'$like':'%'+_0x3813fb['query'][_0x2b91('0x38')]+'%'};return _0x1bba55;}})});}_0x6bae14=_['merge']({},_0x6bae14,_0x3813fb[_0x2b91('0x39')]);var _0x8c9590={'where':_0x6bae14['where']};return db['SugarcrmField'][_0x2b91('0x20')](_0x8c9590)[_0x2b91('0x25')](function(_0x39d59f){_0x2e5622[_0x2b91('0x20')]=_0x39d59f;if(_0x3813fb[_0x2b91('0x2b')][_0x2b91('0x3a')]){_0x6bae14[_0x2b91('0x3b')]=[{'all':!![]}];}return db[_0x2b91('0x2a')][_0x2b91('0x3c')](_0x6bae14);})[_0x2b91('0x25')](function(_0x11eae7){_0x2e5622['rows']=_0x11eae7;return _0x2e5622;})[_0x2b91('0x25')](respondWithFilteredResult(_0x1aa64c,_0x6bae14))[_0x2b91('0x3d')](handleError(_0x1aa64c,null));};exports[_0x2b91('0x3e')]=function(_0x248cef,_0x1853fe){var _0x413135={'raw':!![],'where':{'id':_0x248cef[_0x2b91('0x3f')]['id']}},_0x123c4e={};_0x123c4e['model']=_[_0x2b91('0x40')](db[_0x2b91('0x2a')][_0x2b91('0x41')]);_0x123c4e[_0x2b91('0x2b')]=_[_0x2b91('0x40')](_0x248cef[_0x2b91('0x2b')]);_0x123c4e[_0x2b91('0x2c')]=_[_0x2b91('0x2d')](_0x123c4e[_0x2b91('0x2e')],_0x123c4e[_0x2b91('0x2b')]);_0x413135[_0x2b91('0x2f')]=_[_0x2b91('0x2d')](_0x123c4e[_0x2b91('0x2e')],qs[_0x2b91('0x30')](_0x248cef[_0x2b91('0x2b')][_0x2b91('0x30')]));_0x413135[_0x2b91('0x2f')]=_0x413135[_0x2b91('0x2f')]['length']?_0x413135['attributes']:_0x123c4e[_0x2b91('0x2e')];if(_0x248cef['query'][_0x2b91('0x3a')]){_0x413135[_0x2b91('0x3b')]=[{'all':!![]}];}_0x413135=_[_0x2b91('0x42')]({},_0x413135,_0x248cef[_0x2b91('0x39')]);return db[_0x2b91('0x2a')]['find'](_0x413135)[_0x2b91('0x25')](handleEntityNotFound(_0x1853fe,null))['then'](respondWithResult(_0x1853fe,null))[_0x2b91('0x3d')](handleError(_0x1853fe,null));};exports[_0x2b91('0x43')]=function(_0x3a197f,_0x1bb2c8){return db[_0x2b91('0x2a')][_0x2b91('0x43')](_0x3a197f['body'],{})[_0x2b91('0x25')](respondWithResult(_0x1bb2c8,0xc9))[_0x2b91('0x3d')](handleError(_0x1bb2c8,null));};exports['update']=function(_0x44689e,_0x30cd26){if(_0x44689e[_0x2b91('0x44')]['id']){delete _0x44689e[_0x2b91('0x44')]['id'];}return db[_0x2b91('0x2a')]['find']({'where':{'id':_0x44689e['params']['id']}})['then'](handleEntityNotFound(_0x30cd26,null))[_0x2b91('0x25')](saveUpdates(_0x44689e[_0x2b91('0x44')],null))[_0x2b91('0x25')](respondWithResult(_0x30cd26,null))[_0x2b91('0x3d')](handleError(_0x30cd26,null));};exports['destroy']=function(_0x3ad717,_0xede7f9){return db[_0x2b91('0x2a')][_0x2b91('0x45')]({'where':{'id':_0x3ad717['params']['id']}})[_0x2b91('0x25')](handleEntityNotFound(_0xede7f9,null))[_0x2b91('0x25')](removeEntity(_0xede7f9,null))[_0x2b91('0x3d')](handleError(_0xede7f9,null));}; \ No newline at end of file +var _0xee75=['count','set','Content-Range','json','save','update','then','destroy','error','name','map','SugarcrmField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xee75,0x106));var _0x5ee7=function(_0x4d4398,_0x423756){_0x4d4398=_0x4d4398-0x0;var _0x5a3f86=_0xee75[_0x4d4398];return _0x5a3f86;};'use strict';var emlformat=require(_0x5ee7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5ee7('0x1'));var jsonpatch=require(_0x5ee7('0x2'));var rp=require(_0x5ee7('0x3'));var moment=require(_0x5ee7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5ee7('0x5'));var sox=require(_0x5ee7('0x6'));var csv=require(_0x5ee7('0x7'));var ejs=require(_0x5ee7('0x8'));var fs=require('fs');var fs_extra=require(_0x5ee7('0x9'));var _=require(_0x5ee7('0xa'));var squel=require(_0x5ee7('0xb'));var crypto=require(_0x5ee7('0xc'));var jsforce=require(_0x5ee7('0xd'));var deskjs=require(_0x5ee7('0xe'));var toCsv=require(_0x5ee7('0x7'));var querystring=require('querystring');var Papa=require(_0x5ee7('0xf'));var Redis=require(_0x5ee7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5ee7('0x11'));var as=require(_0x5ee7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ee7('0x13'))(_0x5ee7('0x14'));var utils=require('../../config/utils');var config=require(_0x5ee7('0x15'));var licenseUtil=require(_0x5ee7('0x16'));var db=require(_0x5ee7('0x17'))['db'];function respondWithStatusCode(_0x541c38,_0x5e661a){_0x5e661a=_0x5e661a||0xcc;return function(_0xf5eb06){if(_0xf5eb06){return _0x541c38[_0x5ee7('0x18')](_0x5e661a);}return _0x541c38['status'](_0x5e661a)[_0x5ee7('0x19')]();};}function respondWithResult(_0x513f05,_0x600fee){_0x600fee=_0x600fee||0xc8;return function(_0x23834d){if(_0x23834d){return _0x513f05[_0x5ee7('0x1a')](_0x600fee)['json'](_0x23834d);}};}function respondWithFilteredResult(_0x544a06,_0x4121d4){return function(_0x59797a){if(_0x59797a){var _0x58b7de=typeof _0x4121d4[_0x5ee7('0x1b')]===_0x5ee7('0x1c')&&typeof _0x4121d4[_0x5ee7('0x1d')]===_0x5ee7('0x1c');var _0xea8fa0=_0x59797a[_0x5ee7('0x1e')];var _0x3d3a73=_0x58b7de?0x0:_0x4121d4['offset'];var _0x31c61f=_0x58b7de?_0x59797a['count']:_0x4121d4['offset']+_0x4121d4[_0x5ee7('0x1d')];var _0x55f2ab;if(_0x31c61f>=_0xea8fa0){_0x31c61f=_0xea8fa0;_0x55f2ab=0xc8;}else{_0x55f2ab=0xce;}_0x544a06[_0x5ee7('0x1a')](_0x55f2ab);return _0x544a06[_0x5ee7('0x1f')](_0x5ee7('0x20'),_0x3d3a73+'-'+_0x31c61f+'/'+_0xea8fa0)[_0x5ee7('0x21')](_0x59797a);}return null;};}function patchUpdates(_0x5085e9){return function(_0x115176){try{jsonpatch['apply'](_0x115176,_0x5085e9,!![]);}catch(_0x5580aa){return BPromise['reject'](_0x5580aa);}return _0x115176[_0x5ee7('0x22')]();};}function saveUpdates(_0x1df268,_0x27608b){return function(_0x36894c){if(_0x36894c){return _0x36894c[_0x5ee7('0x23')](_0x1df268)[_0x5ee7('0x24')](function(_0x20c425){return _0x20c425;});}return null;};}function removeEntity(_0x3a1f52,_0x30bd9d){return function(_0xf66f29){if(_0xf66f29){return _0xf66f29[_0x5ee7('0x25')]()[_0x5ee7('0x24')](function(){_0x3a1f52[_0x5ee7('0x1a')](0xcc)[_0x5ee7('0x19')]();});}};}function handleEntityNotFound(_0x50db05,_0x10960b){return function(_0x164e90){if(!_0x164e90){_0x50db05[_0x5ee7('0x18')](0x194);}return _0x164e90;};}function handleError(_0x1b6b98,_0xb3d4b){_0xb3d4b=_0xb3d4b||0x1f4;return function(_0x585c4d){logger[_0x5ee7('0x26')](_0x585c4d['stack']);if(_0x585c4d[_0x5ee7('0x27')]){delete _0x585c4d[_0x5ee7('0x27')];}_0x1b6b98[_0x5ee7('0x1a')](_0xb3d4b)['send'](_0x585c4d);};}exports['index']=function(_0xac67c,_0xef624f){var _0xcdd4b4={},_0x2f8075={},_0x363d3f={'count':0x0,'rows':[]};var _0x2c1329=_[_0x5ee7('0x28')](db[_0x5ee7('0x29')][_0x5ee7('0x2a')],function(_0x6962ab){return{'name':_0x6962ab[_0x5ee7('0x2b')],'type':_0x6962ab['type'][_0x5ee7('0x2c')]};});_0x2f8075[_0x5ee7('0x2d')]=_[_0x5ee7('0x28')](_0x2c1329,_0x5ee7('0x27'));_0x2f8075[_0x5ee7('0x2e')]=_[_0x5ee7('0x2f')](_0xac67c[_0x5ee7('0x2e')]);_0x2f8075[_0x5ee7('0x30')]=_[_0x5ee7('0x31')](_0x2f8075[_0x5ee7('0x2d')],_0x2f8075[_0x5ee7('0x2e')]);_0xcdd4b4[_0x5ee7('0x32')]=_[_0x5ee7('0x31')](_0x2f8075[_0x5ee7('0x2d')],qs[_0x5ee7('0x33')](_0xac67c[_0x5ee7('0x2e')][_0x5ee7('0x33')]));_0xcdd4b4[_0x5ee7('0x32')]=_0xcdd4b4[_0x5ee7('0x32')]['length']?_0xcdd4b4['attributes']:_0x2f8075[_0x5ee7('0x2d')];if(!_0xac67c[_0x5ee7('0x2e')][_0x5ee7('0x34')](_0x5ee7('0x35'))){_0xcdd4b4[_0x5ee7('0x1d')]=qs[_0x5ee7('0x1d')](_0xac67c[_0x5ee7('0x2e')][_0x5ee7('0x1d')]);_0xcdd4b4[_0x5ee7('0x1b')]=qs['offset'](_0xac67c['query']['offset']);}_0xcdd4b4['order']=qs[_0x5ee7('0x36')](_0xac67c[_0x5ee7('0x2e')][_0x5ee7('0x36')]);_0xcdd4b4[_0x5ee7('0x37')]=qs['filters'](_[_0x5ee7('0x38')](_0xac67c[_0x5ee7('0x2e')],_0x2f8075['filters']),_0x2c1329);if(_0xac67c['query']['filter']){_0xcdd4b4[_0x5ee7('0x37')]=_[_0x5ee7('0x39')](_0xcdd4b4[_0x5ee7('0x37')],{'$or':_[_0x5ee7('0x28')](_0x2c1329,function(_0x2aea27){if(_0x2aea27[_0x5ee7('0x3a')]!==_0x5ee7('0x3b')){var _0x3dcc69={};_0x3dcc69[_0x2aea27[_0x5ee7('0x27')]]={'$like':'%'+_0xac67c['query'][_0x5ee7('0x3c')]+'%'};return _0x3dcc69;}})});}_0xcdd4b4=_[_0x5ee7('0x39')]({},_0xcdd4b4,_0xac67c[_0x5ee7('0x3d')]);var _0x4e8da5={'where':_0xcdd4b4[_0x5ee7('0x37')]};return db[_0x5ee7('0x29')]['count'](_0x4e8da5)[_0x5ee7('0x24')](function(_0x5b3c53){_0x363d3f[_0x5ee7('0x1e')]=_0x5b3c53;if(_0xac67c[_0x5ee7('0x2e')][_0x5ee7('0x3e')]){_0xcdd4b4[_0x5ee7('0x3f')]=[{'all':!![]}];}return db['SugarcrmField'][_0x5ee7('0x40')](_0xcdd4b4);})[_0x5ee7('0x24')](function(_0x54d8b9){_0x363d3f[_0x5ee7('0x41')]=_0x54d8b9;return _0x363d3f;})[_0x5ee7('0x24')](respondWithFilteredResult(_0xef624f,_0xcdd4b4))[_0x5ee7('0x42')](handleError(_0xef624f,null));};exports[_0x5ee7('0x43')]=function(_0x1d1452,_0x2c8417){var _0x1c261d={'raw':!![],'where':{'id':_0x1d1452[_0x5ee7('0x44')]['id']}},_0x2a6edd={};_0x2a6edd[_0x5ee7('0x2d')]=_['keys'](db[_0x5ee7('0x29')]['rawAttributes']);_0x2a6edd[_0x5ee7('0x2e')]=_['keys'](_0x1d1452['query']);_0x2a6edd[_0x5ee7('0x30')]=_[_0x5ee7('0x31')](_0x2a6edd[_0x5ee7('0x2d')],_0x2a6edd[_0x5ee7('0x2e')]);_0x1c261d[_0x5ee7('0x32')]=_[_0x5ee7('0x31')](_0x2a6edd[_0x5ee7('0x2d')],qs[_0x5ee7('0x33')](_0x1d1452[_0x5ee7('0x2e')][_0x5ee7('0x33')]));_0x1c261d[_0x5ee7('0x32')]=_0x1c261d['attributes'][_0x5ee7('0x45')]?_0x1c261d[_0x5ee7('0x32')]:_0x2a6edd['model'];if(_0x1d1452[_0x5ee7('0x2e')][_0x5ee7('0x3e')]){_0x1c261d['include']=[{'all':!![]}];}_0x1c261d=_[_0x5ee7('0x39')]({},_0x1c261d,_0x1d1452[_0x5ee7('0x3d')]);return db[_0x5ee7('0x29')][_0x5ee7('0x46')](_0x1c261d)[_0x5ee7('0x24')](handleEntityNotFound(_0x2c8417,null))['then'](respondWithResult(_0x2c8417,null))[_0x5ee7('0x42')](handleError(_0x2c8417,null));};exports[_0x5ee7('0x47')]=function(_0x2c1f26,_0x1c8955){return db[_0x5ee7('0x29')][_0x5ee7('0x47')](_0x2c1f26[_0x5ee7('0x48')],{})[_0x5ee7('0x24')](respondWithResult(_0x1c8955,0xc9))[_0x5ee7('0x42')](handleError(_0x1c8955,null));};exports[_0x5ee7('0x23')]=function(_0x59d82f,_0x5cf38a){if(_0x59d82f[_0x5ee7('0x48')]['id']){delete _0x59d82f[_0x5ee7('0x48')]['id'];}return db[_0x5ee7('0x29')]['find']({'where':{'id':_0x59d82f[_0x5ee7('0x44')]['id']}})[_0x5ee7('0x24')](handleEntityNotFound(_0x5cf38a,null))[_0x5ee7('0x24')](saveUpdates(_0x59d82f[_0x5ee7('0x48')],null))[_0x5ee7('0x24')](respondWithResult(_0x5cf38a,null))[_0x5ee7('0x42')](handleError(_0x5cf38a,null));};exports['destroy']=function(_0x5d6a4f,_0x239f6d){return db[_0x5ee7('0x29')][_0x5ee7('0x46')]({'where':{'id':_0x5d6a4f[_0x5ee7('0x44')]['id']}})[_0x5ee7('0x24')](handleEntityNotFound(_0x239f6d,null))[_0x5ee7('0x24')](removeEntity(_0x239f6d,null))['catch'](handleError(_0x239f6d,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index f3a0f7f..ab2878b 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 _0x4174=['../../config/logger','api','moment','bluebird','path','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util'];(function(_0x37563f,_0x3cf11a){var _0x79b3e3=function(_0x576532){while(--_0x576532){_0x37563f['push'](_0x37563f['shift']());}};_0x79b3e3(++_0x3cf11a);}(_0x4174,0x1b1));var _0x4417=function(_0x56a3b1,_0x1c59b5){_0x56a3b1=_0x56a3b1-0x0;var _0x3b8897=_0x4174[_0x56a3b1];return _0x3b8897;};'use strict';var _=require(_0x4417('0x0'));var util=require(_0x4417('0x1'));var logger=require(_0x4417('0x2'))(_0x4417('0x3'));var moment=require(_0x4417('0x4'));var BPromise=require(_0x4417('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4417('0x6'));var rimraf=require(_0x4417('0x7'));var config=require('../../config/environment');var attributes=require(_0x4417('0x8'));module[_0x4417('0x9')]=function(_0x3243c4,_0x1391a8){return _0x3243c4[_0x4417('0xa')](_0x4417('0xb'),attributes,{'tableName':_0x4417('0xc'),'paranoid':![],'indexes':[{'name':_0x4417('0xd'),'fields':[_0x4417('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6e08=['rimraf','./intSugarcrmField.attributes','define','SugarcrmField','idField','FieldId','lodash','util','api','moment','bluebird','path'];(function(_0x23b962,_0x34cb96){var _0x163ab2=function(_0x26be41){while(--_0x26be41){_0x23b962['push'](_0x23b962['shift']());}};_0x163ab2(++_0x34cb96);}(_0x6e08,0x192));var _0x86e0=function(_0x2c2954,_0x3cadf4){_0x2c2954=_0x2c2954-0x0;var _0x1e834e=_0x6e08[_0x2c2954];return _0x1e834e;};'use strict';var _=require(_0x86e0('0x0'));var util=require(_0x86e0('0x1'));var logger=require('../../config/logger')(_0x86e0('0x2'));var moment=require(_0x86e0('0x3'));var BPromise=require(_0x86e0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x86e0('0x5'));var rimraf=require(_0x86e0('0x6'));var config=require('../../config/environment');var attributes=require(_0x86e0('0x7'));module['exports']=function(_0x3cf61d,_0x29de7e){return _0x3cf61d[_0x86e0('0x8')](_0x86e0('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x86e0('0xa'),_0x86e0('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 4e6f147..2a1ed2f 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 _0x67dc=['debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent'];(function(_0x504e13,_0x291b50){var _0xeb0f14=function(_0x3144a1){while(--_0x3144a1){_0x504e13['push'](_0x504e13['shift']());}};_0xeb0f14(++_0x291b50);}(_0x67dc,0x15f));var _0xc67d=function(_0x58ee19,_0xdf0765){_0x58ee19=_0x58ee19-0x0;var _0x49af25=_0x67dc[_0x58ee19];return _0x49af25;};'use strict';var _=require(_0xc67d('0x0'));var util=require(_0xc67d('0x1'));var moment=require(_0xc67d('0x2'));var BPromise=require(_0xc67d('0x3'));var rs=require(_0xc67d('0x4'));var fs=require('fs');var Redis=require(_0xc67d('0x5'));var db=require(_0xc67d('0x6'))['db'];var utils=require(_0xc67d('0x7'));var logger=require('../../config/logger')(_0xc67d('0x8'));var config=require(_0xc67d('0x9'));var jayson=require(_0xc67d('0xa'));var client=jayson[_0xc67d('0xb')][_0xc67d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3241e7,_0x3d1fa9,_0x15fe1c){return new BPromise(function(_0xaa4e83,_0x283d14){return client['request'](_0x3241e7,_0x15fe1c)[_0xc67d('0xd')](function(_0x1bcfb8){logger[_0xc67d('0xe')](_0xc67d('0xf'),_0x3d1fa9,_0xc67d('0x10'));logger[_0xc67d('0x11')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x3d1fa9,_0xc67d('0x10'),JSON[_0xc67d('0x12')](_0x1bcfb8));if(_0x1bcfb8['error']){if(_0x1bcfb8['error']['code']===0x1f4){logger[_0xc67d('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x3d1fa9,_0x1bcfb8[_0xc67d('0x13')][_0xc67d('0x14')]);return _0x283d14(_0x1bcfb8[_0xc67d('0x13')][_0xc67d('0x14')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x3d1fa9,_0x1bcfb8['error'][_0xc67d('0x14')]);return _0xaa4e83(_0x1bcfb8[_0xc67d('0x13')][_0xc67d('0x14')]);}else{logger[_0xc67d('0xe')](_0xc67d('0xf'),_0x3d1fa9,_0xc67d('0x10'));_0xaa4e83(_0x1bcfb8[_0xc67d('0x15')][_0xc67d('0x14')]);}})[_0xc67d('0x16')](function(_0x4090a3){logger[_0xc67d('0x13')](_0xc67d('0xf'),_0x3d1fa9,_0x4090a3);_0x283d14(_0x4090a3);});});} \ No newline at end of file +var _0xd2cb=['../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','SugarcrmField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd2cb,0x1c4));var _0xbd2c=function(_0x4fb001,_0x3f9e2e){_0x4fb001=_0x4fb001-0x0;var _0x207eda=_0xd2cb[_0x4fb001];return _0x207eda;};'use strict';var _=require(_0xbd2c('0x0'));var util=require(_0xbd2c('0x1'));var moment=require(_0xbd2c('0x2'));var BPromise=require(_0xbd2c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd2c('0x4'))['db'];var utils=require(_0xbd2c('0x5'));var logger=require(_0xbd2c('0x6'))(_0xbd2c('0x7'));var config=require(_0xbd2c('0x8'));var jayson=require(_0xbd2c('0x9'));var client=jayson['client'][_0xbd2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58d691,_0xe2ba41,_0x5be86e){return new BPromise(function(_0x54ef24,_0x3813c8){return client[_0xbd2c('0xb')](_0x58d691,_0x5be86e)['then'](function(_0x2089a2){logger[_0xbd2c('0xc')]('SugarcrmField,\x20%s,\x20%s',_0xe2ba41,_0xbd2c('0xd'));logger[_0xbd2c('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0xe2ba41,'request\x20sent',JSON[_0xbd2c('0xf')](_0x2089a2));if(_0x2089a2[_0xbd2c('0x10')]){if(_0x2089a2[_0xbd2c('0x10')]['code']===0x1f4){logger[_0xbd2c('0x10')](_0xbd2c('0x11'),_0xe2ba41,_0x2089a2[_0xbd2c('0x10')][_0xbd2c('0x12')]);return _0x3813c8(_0x2089a2[_0xbd2c('0x10')][_0xbd2c('0x12')]);}logger[_0xbd2c('0x10')](_0xbd2c('0x11'),_0xe2ba41,_0x2089a2[_0xbd2c('0x10')]['message']);return _0x54ef24(_0x2089a2['error'][_0xbd2c('0x12')]);}else{logger[_0xbd2c('0xc')](_0xbd2c('0x11'),_0xe2ba41,_0xbd2c('0xd'));_0x54ef24(_0x2089a2['result'][_0xbd2c('0x12')]);}})[_0xbd2c('0x13')](function(_0x996b0d){logger['error'](_0xbd2c('0x11'),_0xe2ba41,_0x996b0d);_0x3813c8(_0x996b0d);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 1491a3c..31062c8 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 _0xf808=['/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','delete','destroy','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x10540b,_0x41547b){var _0x21733e=function(_0x5a78c2){while(--_0x5a78c2){_0x10540b['push'](_0x10540b['shift']());}};_0x21733e(++_0x41547b);}(_0xf808,0x83));var _0x8f80=function(_0x5838d8,_0x3bf753){_0x5838d8=_0x5838d8-0x0;var _0x4be2af=_0xf808[_0x5838d8];return _0x4be2af;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8f80('0x0'));var timeout=require(_0x8f80('0x1'));var express=require(_0x8f80('0x2'));var router=express['Router']();var fs_extra=require(_0x8f80('0x3'));var auth=require(_0x8f80('0x4'));var interaction=require(_0x8f80('0x5'));var config=require(_0x8f80('0x6'));var controller=require('./intVtigerAccount.controller');router[_0x8f80('0x7')]('/',auth['isAuthenticated'](),controller[_0x8f80('0x8')]);router['get'](_0x8f80('0x9'),auth[_0x8f80('0xa')](),controller['show']);router[_0x8f80('0x7')](_0x8f80('0xb'),auth[_0x8f80('0xa')](),controller[_0x8f80('0xc')]);router[_0x8f80('0x7')](_0x8f80('0xd'),auth[_0x8f80('0xa')](),controller['getFields']);router[_0x8f80('0xe')]('/',auth[_0x8f80('0xa')](),controller[_0x8f80('0xf')]);router['post']('/:id/configurations',auth[_0x8f80('0xa')](),controller[_0x8f80('0x10')]);router['put'](_0x8f80('0x9'),auth[_0x8f80('0xa')](),controller[_0x8f80('0x11')]);router[_0x8f80('0x12')](_0x8f80('0x9'),auth[_0x8f80('0xa')](),controller[_0x8f80('0x13')]);module['exports']=router; \ No newline at end of file +var _0x38c3=['./intVtigerAccount.controller','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','get','/:id/fields','getFields','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x38c3,0x13d));var _0x338c=function(_0x1964b4,_0x5796f4){_0x1964b4=_0x1964b4-0x0;var _0x509a77=_0x38c3[_0x1964b4];return _0x509a77;};'use strict';var multer=require(_0x338c('0x0'));var util=require(_0x338c('0x1'));var path=require('path');var timeout=require(_0x338c('0x2'));var express=require(_0x338c('0x3'));var router=express[_0x338c('0x4')]();var fs_extra=require(_0x338c('0x5'));var auth=require(_0x338c('0x6'));var interaction=require(_0x338c('0x7'));var config=require('../../config/environment');var controller=require(_0x338c('0x8'));router['get']('/',auth[_0x338c('0x9')](),controller[_0x338c('0xa')]);router['get'](_0x338c('0xb'),auth[_0x338c('0x9')](),controller[_0x338c('0xc')]);router['get'](_0x338c('0xd'),auth[_0x338c('0x9')](),controller[_0x338c('0xe')]);router[_0x338c('0xf')](_0x338c('0x10'),auth[_0x338c('0x9')](),controller[_0x338c('0x11')]);router['post']('/',auth[_0x338c('0x9')](),controller[_0x338c('0x12')]);router['post'](_0x338c('0xd'),auth['isAuthenticated'](),controller[_0x338c('0x13')]);router[_0x338c('0x14')]('/:id',auth[_0x338c('0x9')](),controller[_0x338c('0x15')]);router[_0x338c('0x16')](_0x338c('0xb'),auth[_0x338c('0x9')](),controller[_0x338c('0x17')]);module[_0x338c('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 9697314..dcbe024 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 _0x43d8=['exports','STRING','HelpDesk','sequelize'];(function(_0x2855ea,_0x46a9f5){var _0x56bb43=function(_0x2d9ea8){while(--_0x2d9ea8){_0x2855ea['push'](_0x2855ea['shift']());}};_0x56bb43(++_0x46a9f5);}(_0x43d8,0xff));var _0x843d=function(_0x206096,_0x1c6cfd){_0x206096=_0x206096-0x0;var _0x3f3b50=_0x43d8[_0x206096];return _0x3f3b50;};'use strict';var Sequelize=require(_0x843d('0x0'));module[_0x843d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x843d('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x843d('0x2')],'allowNull':![],'defaultValue':_0x843d('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x843d('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x843d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb89c=['sequelize','exports','STRING','HelpDesk'];(function(_0x1b9e78,_0x3f5553){var _0x3d6493=function(_0x562e28){while(--_0x562e28){_0x1b9e78['push'](_0x1b9e78['shift']());}};_0x3d6493(++_0x3f5553);}(_0xb89c,0x6c));var _0xcb89=function(_0x5cf92f,_0x5b4f48){_0x5cf92f=_0x5cf92f-0x0;var _0x40e037=_0xb89c[_0x5cf92f];return _0x40e037;};'use strict';var Sequelize=require(_0xcb89('0x0'));module[_0xcb89('0x1')]={'name':{'type':Sequelize[_0xcb89('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcb89('0x2')]},'username':{'type':Sequelize[_0xcb89('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xcb89('0x2')],'allowNull':![],'defaultValue':_0xcb89('0x3')},'remoteUri':{'type':Sequelize[_0xcb89('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xcb89('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 6c65387..dc05225 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 _0x6a83=['map','VtigerAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','update','getConfigurations','findOne','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','create','VtigerField','getFields','username','moduleName','serverUrl','accessKey','slice','lastIndexOf','format','GET','getchallenge','POST','login','result','token','success','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','destroy','then','error','stack','name','send'];(function(_0x3d5daa,_0xdbb491){var _0x161588=function(_0x2c28f9){while(--_0x2c28f9){_0x3d5daa['push'](_0x3d5daa['shift']());}};_0x161588(++_0xdbb491);}(_0x6a83,0x1a4));var _0x36a8=function(_0x10d3b5,_0x453611){_0x10d3b5=_0x10d3b5-0x0;var _0x4c385e=_0x6a83[_0x10d3b5];return _0x4c385e;};'use strict';var emlformat=require(_0x36a8('0x0'));var rimraf=require(_0x36a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x36a8('0x2'));var rp=require(_0x36a8('0x3'));var moment=require(_0x36a8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x36a8('0x5'));var util=require(_0x36a8('0x6'));var path=require(_0x36a8('0x7'));var sox=require(_0x36a8('0x8'));var csv=require(_0x36a8('0x9'));var ejs=require(_0x36a8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x36a8('0xb'));var squel=require(_0x36a8('0xc'));var crypto=require(_0x36a8('0xd'));var jsforce=require(_0x36a8('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x36a8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x36a8('0x10'));var as=require(_0x36a8('0x11'));var hardwareService=require(_0x36a8('0x12'));var logger=require('../../config/logger')(_0x36a8('0x13'));var utils=require(_0x36a8('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x36a8('0x15'))['db'];var integrations=require(_0x36a8('0x16'));function respondWithStatusCode(_0x33d83a,_0x580de9){_0x580de9=_0x580de9||0xcc;return function(_0x223821){if(_0x223821){return _0x33d83a[_0x36a8('0x17')](_0x580de9);}return _0x33d83a['status'](_0x580de9)[_0x36a8('0x18')]();};}function respondWithResult(_0x5a003d,_0x51a95e){_0x51a95e=_0x51a95e||0xc8;return function(_0x360429){if(_0x360429){return _0x5a003d[_0x36a8('0x19')](_0x51a95e)[_0x36a8('0x1a')](_0x360429);}};}function respondWithFilteredResult(_0x5d9a08,_0x2b61d6){return function(_0x225baa){if(_0x225baa){var _0x278b63=typeof _0x2b61d6[_0x36a8('0x1b')]===_0x36a8('0x1c')&&typeof _0x2b61d6[_0x36a8('0x1d')]===_0x36a8('0x1c');var _0x1e14bd=_0x225baa[_0x36a8('0x1e')];var _0x21a28b=_0x278b63?0x0:_0x2b61d6[_0x36a8('0x1b')];var _0x5ae6a6=_0x278b63?_0x225baa[_0x36a8('0x1e')]:_0x2b61d6['offset']+_0x2b61d6['limit'];var _0x12a21e;if(_0x5ae6a6>=_0x1e14bd){_0x5ae6a6=_0x1e14bd;_0x12a21e=0xc8;}else{_0x12a21e=0xce;}_0x5d9a08[_0x36a8('0x19')](_0x12a21e);return _0x5d9a08[_0x36a8('0x1f')](_0x36a8('0x20'),_0x21a28b+'-'+_0x5ae6a6+'/'+_0x1e14bd)['json'](_0x225baa);}return null;};}function patchUpdates(_0x127d31){return function(_0x27428f){try{jsonpatch['apply'](_0x27428f,_0x127d31,!![]);}catch(_0x13be09){return BPromise['reject'](_0x13be09);}return _0x27428f[_0x36a8('0x21')]();};}function saveUpdates(_0x1ae46b,_0x5c874f){return function(_0x49cf18){if(_0x49cf18){return _0x49cf18['update'](_0x1ae46b)['then'](function(_0x94af7a){return _0x94af7a;});}return null;};}function removeEntity(_0x27de79,_0x54cd1d){return function(_0x4df5e1){if(_0x4df5e1){return _0x4df5e1[_0x36a8('0x22')]()[_0x36a8('0x23')](function(){_0x27de79[_0x36a8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f62c,_0x3b182a){return function(_0x24f881){if(!_0x24f881){_0x12f62c[_0x36a8('0x17')](0x194);}return _0x24f881;};}function handleError(_0x2f045c,_0x152958){_0x152958=_0x152958||0x1f4;return function(_0x4bb33e){logger[_0x36a8('0x24')](_0x4bb33e[_0x36a8('0x25')]);if(_0x4bb33e[_0x36a8('0x26')]){delete _0x4bb33e[_0x36a8('0x26')];}_0x2f045c['status'](_0x152958)[_0x36a8('0x27')](_0x4bb33e);};}exports['index']=function(_0x198ecf,_0x44d1b3){var _0x15c6ec={},_0x1abe64={},_0x2c392e={'count':0x0,'rows':[]};var _0x317c03=_[_0x36a8('0x28')](db[_0x36a8('0x29')]['rawAttributes'],function(_0x3fad4e){return{'name':_0x3fad4e[_0x36a8('0x2a')],'type':_0x3fad4e[_0x36a8('0x2b')][_0x36a8('0x2c')]};});_0x1abe64[_0x36a8('0x2d')]=_[_0x36a8('0x28')](_0x317c03,_0x36a8('0x26'));_0x1abe64[_0x36a8('0x2e')]=_[_0x36a8('0x2f')](_0x198ecf[_0x36a8('0x2e')]);_0x1abe64[_0x36a8('0x30')]=_[_0x36a8('0x31')](_0x1abe64[_0x36a8('0x2d')],_0x1abe64['query']);_0x15c6ec[_0x36a8('0x32')]=_[_0x36a8('0x31')](_0x1abe64[_0x36a8('0x2d')],qs[_0x36a8('0x33')](_0x198ecf[_0x36a8('0x2e')]['fields']));_0x15c6ec[_0x36a8('0x32')]=_0x15c6ec[_0x36a8('0x32')][_0x36a8('0x34')]?_0x15c6ec['attributes']:_0x1abe64[_0x36a8('0x2d')];if(!_0x198ecf['query']['hasOwnProperty'](_0x36a8('0x35'))){_0x15c6ec[_0x36a8('0x1d')]=qs[_0x36a8('0x1d')](_0x198ecf['query'][_0x36a8('0x1d')]);_0x15c6ec[_0x36a8('0x1b')]=qs[_0x36a8('0x1b')](_0x198ecf[_0x36a8('0x2e')][_0x36a8('0x1b')]);}_0x15c6ec[_0x36a8('0x36')]=qs[_0x36a8('0x37')](_0x198ecf[_0x36a8('0x2e')]['sort']);_0x15c6ec['where']=qs[_0x36a8('0x30')](_[_0x36a8('0x38')](_0x198ecf[_0x36a8('0x2e')],_0x1abe64[_0x36a8('0x30')]),_0x317c03);if(_0x198ecf[_0x36a8('0x2e')][_0x36a8('0x39')]){_0x15c6ec[_0x36a8('0x3a')]=_[_0x36a8('0x3b')](_0x15c6ec[_0x36a8('0x3a')],{'$or':_[_0x36a8('0x28')](_0x317c03,function(_0x29ff39){if(_0x29ff39[_0x36a8('0x2b')]!==_0x36a8('0x3c')){var _0x1524d7={};_0x1524d7[_0x29ff39[_0x36a8('0x26')]]={'$like':'%'+_0x198ecf[_0x36a8('0x2e')][_0x36a8('0x39')]+'%'};return _0x1524d7;}})});}_0x15c6ec=_[_0x36a8('0x3b')]({},_0x15c6ec,_0x198ecf[_0x36a8('0x3d')]);var _0x8c5948={'where':_0x15c6ec[_0x36a8('0x3a')]};return db[_0x36a8('0x29')][_0x36a8('0x1e')](_0x8c5948)[_0x36a8('0x23')](function(_0xa7e595){_0x2c392e[_0x36a8('0x1e')]=_0xa7e595;if(_0x198ecf[_0x36a8('0x2e')][_0x36a8('0x3e')]){_0x15c6ec[_0x36a8('0x3f')]=[{'all':!![]}];}return db[_0x36a8('0x29')][_0x36a8('0x40')](_0x15c6ec);})[_0x36a8('0x23')](function(_0x46cff4){_0x2c392e[_0x36a8('0x41')]=_0x46cff4;return _0x2c392e;})[_0x36a8('0x23')](respondWithFilteredResult(_0x44d1b3,_0x15c6ec))[_0x36a8('0x42')](handleError(_0x44d1b3,null));};exports[_0x36a8('0x43')]=function(_0x3df200,_0x383cd3){var _0x4ded8c={'raw':![],'where':{'id':_0x3df200[_0x36a8('0x44')]['id']}},_0x50233e={};_0x50233e[_0x36a8('0x2d')]=_[_0x36a8('0x2f')](db[_0x36a8('0x29')][_0x36a8('0x45')]);_0x50233e[_0x36a8('0x2e')]=_['keys'](_0x3df200[_0x36a8('0x2e')]);_0x50233e[_0x36a8('0x30')]=_[_0x36a8('0x31')](_0x50233e[_0x36a8('0x2d')],_0x50233e[_0x36a8('0x2e')]);_0x4ded8c[_0x36a8('0x32')]=_['intersection'](_0x50233e[_0x36a8('0x2d')],qs[_0x36a8('0x33')](_0x3df200['query'][_0x36a8('0x33')]));_0x4ded8c[_0x36a8('0x32')]=_0x4ded8c['attributes'][_0x36a8('0x34')]?_0x4ded8c[_0x36a8('0x32')]:_0x50233e[_0x36a8('0x2d')];if(_0x3df200[_0x36a8('0x2e')][_0x36a8('0x3e')]){_0x4ded8c[_0x36a8('0x3f')]=[{'all':!![]}];}_0x4ded8c=_[_0x36a8('0x3b')]({},_0x4ded8c,_0x3df200['options']);return db[_0x36a8('0x29')][_0x36a8('0x46')](_0x4ded8c)['then'](handleEntityNotFound(_0x383cd3,null))[_0x36a8('0x23')](respondWithResult(_0x383cd3,null))[_0x36a8('0x42')](handleError(_0x383cd3,null));};exports['create']=function(_0x1e9d2b,_0x90a0be){return db['VtigerAccount']['create'](_0x1e9d2b[_0x36a8('0x47')],{})['then'](respondWithResult(_0x90a0be,0xc9))[_0x36a8('0x42')](handleError(_0x90a0be,null));};exports[_0x36a8('0x48')]=function(_0x183824,_0x5b3239){if(_0x183824[_0x36a8('0x47')]['id']){delete _0x183824[_0x36a8('0x47')]['id'];}return db[_0x36a8('0x29')][_0x36a8('0x46')]({'where':{'id':_0x183824[_0x36a8('0x44')]['id']}})[_0x36a8('0x23')](handleEntityNotFound(_0x5b3239,null))[_0x36a8('0x23')](saveUpdates(_0x183824['body'],null))[_0x36a8('0x23')](respondWithResult(_0x5b3239,null))[_0x36a8('0x42')](handleError(_0x5b3239,null));};exports['destroy']=function(_0x4c4c06,_0x3e6305){return db['VtigerAccount']['find']({'where':{'id':_0x4c4c06[_0x36a8('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e6305,null))[_0x36a8('0x23')](removeEntity(_0x3e6305,null))['catch'](handleError(_0x3e6305,null));};exports[_0x36a8('0x49')]=function(_0x6a46ef,_0x2a9f07,_0x27edd3){var _0x2e3570={};var _0x6a172d={};var _0x2092b7;var _0x4a8d86;return db['VtigerAccount'][_0x36a8('0x4a')]({'where':{'id':_0x6a46ef[_0x36a8('0x44')]['id']}})[_0x36a8('0x23')](handleEntityNotFound(_0x2a9f07,null))['then'](function(_0x503ca0){if(_0x503ca0){_0x2092b7=_0x503ca0;_0x6a172d[_0x36a8('0x2d')]=_[_0x36a8('0x2f')](db['VtigerConfiguration'][_0x36a8('0x45')]);_0x6a172d[_0x36a8('0x2e')]=_[_0x36a8('0x2f')](_0x6a46ef['query']);_0x6a172d[_0x36a8('0x30')]=_[_0x36a8('0x31')](_0x6a172d['model'],_0x6a172d[_0x36a8('0x2e')]);_0x2e3570['attributes']=_['intersection'](_0x6a172d[_0x36a8('0x2d')],qs[_0x36a8('0x33')](_0x6a46ef['query']['fields']));_0x2e3570[_0x36a8('0x32')]=_0x2e3570[_0x36a8('0x32')][_0x36a8('0x34')]?_0x2e3570[_0x36a8('0x32')]:_0x6a172d['model'];_0x2e3570[_0x36a8('0x36')]=qs[_0x36a8('0x37')](_0x6a46ef[_0x36a8('0x2e')][_0x36a8('0x37')]);_0x2e3570[_0x36a8('0x3a')]=qs['filters'](_[_0x36a8('0x38')](_0x6a46ef[_0x36a8('0x2e')],_0x6a172d[_0x36a8('0x30')]));if(_0x6a46ef[_0x36a8('0x2e')][_0x36a8('0x39')]){_0x2e3570[_0x36a8('0x3a')]=_[_0x36a8('0x3b')](_0x2e3570[_0x36a8('0x3a')],{'$or':_[_0x36a8('0x28')](_0x2e3570['attributes'],function(_0x321346){var _0x15fddf={};_0x15fddf[_0x321346]={'$like':'%'+_0x6a46ef[_0x36a8('0x2e')]['filter']+'%'};return _0x15fddf;})});}_0x2e3570=_[_0x36a8('0x3b')]({},_0x2e3570,_0x6a46ef[_0x36a8('0x3d')]);return _0x2092b7[_0x36a8('0x49')](_0x2e3570);}})['then'](function(_0x4a4e00){if(_0x4a4e00){_0x4a8d86=_0x4a4e00[_0x36a8('0x34')];if(!_0x6a46ef[_0x36a8('0x2e')][_0x36a8('0x4b')](_0x36a8('0x35'))){_0x2e3570[_0x36a8('0x1d')]=qs['limit'](_0x6a46ef[_0x36a8('0x2e')][_0x36a8('0x1d')]);_0x2e3570[_0x36a8('0x1b')]=qs['offset'](_0x6a46ef['query']['offset']);}return _0x2092b7['getConfigurations'](_0x2e3570);}})[_0x36a8('0x23')](function(_0x2ea445){if(_0x2ea445){return _0x2ea445?{'count':_0x4a8d86,'rows':_0x2ea445}:null;}})['then'](respondWithResult(_0x2a9f07,null))[_0x36a8('0x42')](handleError(_0x2a9f07,null));};exports[_0x36a8('0x4c')]=function(_0x362f5c,_0x476285,_0x2efa7f){if(_0x362f5c[_0x36a8('0x47')]['id']){delete _0x362f5c[_0x36a8('0x47')]['id'];}return db[_0x36a8('0x29')][_0x36a8('0x4a')]({'where':{'id':_0x362f5c[_0x36a8('0x44')]['id']}})[_0x36a8('0x23')](handleEntityNotFound(_0x476285,null))[_0x36a8('0x23')](function(_0x404402){if(_0x404402){_0x362f5c['body']['AccountId']=_0x404402['id'];_0x362f5c[_0x36a8('0x47')][_0x36a8('0x4d')]=integrations[_0x36a8('0x4e')](_0x362f5c[_0x36a8('0x47')][_0x36a8('0x4f')],_0x362f5c[_0x36a8('0x47')][_0x36a8('0x2b')]);_0x362f5c[_0x36a8('0x47')][_0x36a8('0x50')]=integrations['getDescriptions'](_0x362f5c['body'][_0x36a8('0x4f')],_0x362f5c[_0x36a8('0x47')][_0x36a8('0x2b')]);return db['VtigerConfiguration'][_0x36a8('0x51')](_0x362f5c[_0x36a8('0x47')],{'include':[{'model':db[_0x36a8('0x52')],'as':_0x36a8('0x4d')},{'model':db[_0x36a8('0x52')],'as':_0x36a8('0x50')}]});}return null;})[_0x36a8('0x23')](respondWithResult(_0x476285,null))[_0x36a8('0x42')](handleError(_0x476285,null));};var md5=require('md5');exports[_0x36a8('0x53')]=function(_0x719a16,_0x712cb0,_0x5485d4){var _0x1d9694=null;var _0x5eae85=null;var _0x29486d=null;var _0x26bdb1=null;var _0x9d3931='';return db[_0x36a8('0x29')]['findOne']({'where':{'id':_0x719a16[_0x36a8('0x44')]['id']},'attributes':['id',_0x36a8('0x26'),_0x36a8('0x54'),'description',_0x36a8('0x55'),'remoteUri',_0x36a8('0x56'),_0x36a8('0x57')]})['then'](handleEntityNotFound(_0x712cb0,null))[_0x36a8('0x23')](function(_0x49d788){if(_0x49d788){_0x1d9694=_0x49d788[_0x36a8('0x54')];_0x5eae85=_0x49d788['accessKey'];_0x29486d=_0x49d788[_0x36a8('0x55')];_0x9d3931=_0x49d788['remoteUri'];var _0x1bcf87=_0x9d3931[_0x36a8('0x58')](-0x1);if(_0x1bcf87==='/'){_0x9d3931=_0x9d3931['substring'](0x0,_0x9d3931[_0x36a8('0x59')](_0x1bcf87));}_0x26bdb1=util[_0x36a8('0x5a')]('%s/webservice.php',_0x9d3931);var _0x1c038d={'method':_0x36a8('0x5b'),'uri':_0x26bdb1,'qs':{'operation':_0x36a8('0x5c'),'username':_0x49d788['username']},'json':!![]};return rp(_0x1c038d);}})['then'](function(_0x21ec12){if(_0x21ec12['success']){var _0x2a5934={'method':_0x36a8('0x5d'),'uri':_0x26bdb1,'form':{'operation':_0x36a8('0x5e'),'username':_0x1d9694,'accessKey':md5(_0x21ec12[_0x36a8('0x5f')][_0x36a8('0x60')]+_0x5eae85)},'json':!![]};return rp(_0x2a5934);}})[_0x36a8('0x23')](function(_0x57f96b){if(_0x57f96b[_0x36a8('0x61')]){var _0x355ec1={'method':_0x36a8('0x5b'),'uri':_0x26bdb1,'qs':{'operation':'describe','username':_0x1d9694,'sessionName':_0x57f96b[_0x36a8('0x5f')]['sessionName'],'elementType':_0x29486d},'json':!![]};return rp(_0x355ec1);}})[_0x36a8('0x23')](function(_0x4edefe){if(_0x4edefe[_0x36a8('0x61')]){var _0x36e292=[_0x36a8('0x62'),_0x36a8('0x63'),_0x36a8('0x64')];_[_0x36a8('0x65')](_0x4edefe[_0x36a8('0x5f')][_0x36a8('0x33')],function(_0x443671){return _0x36e292[_0x36a8('0x66')](_0x443671[_0x36a8('0x2b')][_0x36a8('0x26')]);});_['remove'](_0x4edefe[_0x36a8('0x5f')]['fields'],function(_0x37437a){return _0x37437a[_0x36a8('0x67')]===_0x36a8('0x68');});return{'count':_0x4edefe[_0x36a8('0x5f')][_0x36a8('0x33')]['length'],'rows':_[_0x36a8('0x28')](_0x4edefe[_0x36a8('0x5f')][_0x36a8('0x33')],function(_0x111642){return{'id':_0x111642[_0x36a8('0x26')],'name':_0x111642[_0x36a8('0x69')],'custom':_[_0x36a8('0x6a')](_0x111642[_0x36a8('0x26')],_0x36a8('0x6b'))?!![]:![],'options':_0x111642[_0x36a8('0x2b')]['name']===_0x36a8('0x6c')&&_0x111642['type'][_0x36a8('0x6d')]['length']>0x0?_[_0x36a8('0x28')](_0x111642[_0x36a8('0x2b')][_0x36a8('0x6d')],function(_0x23a5ac){return{'name':_0x23a5ac[_0x36a8('0x69')],'value':_0x23a5ac[_0x36a8('0x6e')]};}):[]};})};}})[_0x36a8('0x23')](respondWithResult(_0x712cb0,null))[_0x36a8('0x42')](function(_0x1f5dd0){console[_0x36a8('0x6f')](_0x36a8('0x70')+_0x1f5dd0);var _0x143408=_0x719a16[_0x36a8('0x2e')][_0x36a8('0x71')]?0x1f4:_0x1f5dd0[_0x36a8('0x72')]||0x1f4;logger[_0x36a8('0x24')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x143408,JSON['stringify'](_0x1f5dd0));delete _0x1f5dd0[_0x36a8('0x26')];if(_0x143408===0x191){_0x143408=0x190;}_0x712cb0[_0x36a8('0x19')](_0x143408)[_0x36a8('0x27')](_0x719a16['query'][_0x36a8('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x1f5dd0[_0x36a8('0x72')]}:_0x1f5dd0);});}; \ No newline at end of file +var _0x7436=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','then','destroy','error','stack','name','send','index','VtigerAccount','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','findAll','rows','params','keys','includeAll','include','catch','create','body','find','findOne','VtigerConfiguration','hasOwnProperty','nolimit','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','result','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox'];(function(_0x52485d,_0x40b3ff){var _0x3dab23=function(_0x23645e){while(--_0x23645e){_0x52485d['push'](_0x52485d['shift']());}};_0x3dab23(++_0x40b3ff);}(_0x7436,0x73));var _0x6743=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x7436[_0x4ab3fb];return _0x34fe1e;};'use strict';var emlformat=require(_0x6743('0x0'));var rimraf=require(_0x6743('0x1'));var zipdir=require(_0x6743('0x2'));var jsonpatch=require(_0x6743('0x3'));var rp=require('request-promise');var moment=require(_0x6743('0x4'));var BPromise=require(_0x6743('0x5'));var Mustache=require(_0x6743('0x6'));var util=require('util');var path=require(_0x6743('0x7'));var sox=require(_0x6743('0x8'));var csv=require(_0x6743('0x9'));var ejs=require(_0x6743('0xa'));var fs=require('fs');var fs_extra=require(_0x6743('0xb'));var _=require(_0x6743('0xc'));var squel=require(_0x6743('0xd'));var crypto=require('crypto');var jsforce=require(_0x6743('0xe'));var deskjs=require(_0x6743('0xf'));var toCsv=require(_0x6743('0x9'));var querystring=require(_0x6743('0x10'));var Papa=require(_0x6743('0x11'));var Redis=require(_0x6743('0x12'));var authService=require(_0x6743('0x13'));var qs=require(_0x6743('0x14'));var as=require(_0x6743('0x15'));var hardwareService=require(_0x6743('0x16'));var logger=require(_0x6743('0x17'))(_0x6743('0x18'));var utils=require('../../config/utils');var config=require(_0x6743('0x19'));var licenseUtil=require(_0x6743('0x1a'));var db=require(_0x6743('0x1b'))['db'];var integrations=require(_0x6743('0x1c'));function respondWithStatusCode(_0x21ddf4,_0x5b8724){_0x5b8724=_0x5b8724||0xcc;return function(_0x40d5e8){if(_0x40d5e8){return _0x21ddf4['sendStatus'](_0x5b8724);}return _0x21ddf4['status'](_0x5b8724)[_0x6743('0x1d')]();};}function respondWithResult(_0x60bdf0,_0x4506f8){_0x4506f8=_0x4506f8||0xc8;return function(_0x3631e4){if(_0x3631e4){return _0x60bdf0['status'](_0x4506f8)[_0x6743('0x1e')](_0x3631e4);}};}function respondWithFilteredResult(_0x52d654,_0x27a93a){return function(_0x1e4da4){if(_0x1e4da4){var _0x12b14b=typeof _0x27a93a[_0x6743('0x1f')]===_0x6743('0x20')&&typeof _0x27a93a[_0x6743('0x21')]===_0x6743('0x20');var _0x2de59a=_0x1e4da4['count'];var _0x48f3bf=_0x12b14b?0x0:_0x27a93a[_0x6743('0x1f')];var _0x28a64c=_0x12b14b?_0x1e4da4[_0x6743('0x22')]:_0x27a93a[_0x6743('0x1f')]+_0x27a93a['limit'];var _0x40205b;if(_0x28a64c>=_0x2de59a){_0x28a64c=_0x2de59a;_0x40205b=0xc8;}else{_0x40205b=0xce;}_0x52d654[_0x6743('0x23')](_0x40205b);return _0x52d654[_0x6743('0x24')](_0x6743('0x25'),_0x48f3bf+'-'+_0x28a64c+'/'+_0x2de59a)[_0x6743('0x1e')](_0x1e4da4);}return null;};}function patchUpdates(_0x3333f3){return function(_0x2c4235){try{jsonpatch['apply'](_0x2c4235,_0x3333f3,!![]);}catch(_0x1a5a2b){return BPromise[_0x6743('0x26')](_0x1a5a2b);}return _0x2c4235['save']();};}function saveUpdates(_0x38bc14,_0x1d82e8){return function(_0x17d94a){if(_0x17d94a){return _0x17d94a['update'](_0x38bc14)[_0x6743('0x27')](function(_0x569a8a){return _0x569a8a;});}return null;};}function removeEntity(_0x3f8aef,_0x46923c){return function(_0x342e41){if(_0x342e41){return _0x342e41[_0x6743('0x28')]()['then'](function(){_0x3f8aef[_0x6743('0x23')](0xcc)[_0x6743('0x1d')]();});}};}function handleEntityNotFound(_0x2af5f4,_0x3cc847){return function(_0x58d0ec){if(!_0x58d0ec){_0x2af5f4['sendStatus'](0x194);}return _0x58d0ec;};}function handleError(_0x574625,_0x392e84){_0x392e84=_0x392e84||0x1f4;return function(_0x1567b3){logger[_0x6743('0x29')](_0x1567b3[_0x6743('0x2a')]);if(_0x1567b3[_0x6743('0x2b')]){delete _0x1567b3[_0x6743('0x2b')];}_0x574625[_0x6743('0x23')](_0x392e84)[_0x6743('0x2c')](_0x1567b3);};}exports[_0x6743('0x2d')]=function(_0x2e6b07,_0x4d3465){var _0x30f6a0={},_0x33a8df={},_0xa71dae={'count':0x0,'rows':[]};var _0x4967aa=_['map'](db[_0x6743('0x2e')][_0x6743('0x2f')],function(_0x3d3a0f){return{'name':_0x3d3a0f['fieldName'],'type':_0x3d3a0f[_0x6743('0x30')][_0x6743('0x31')]};});_0x33a8df[_0x6743('0x32')]=_[_0x6743('0x33')](_0x4967aa,'name');_0x33a8df[_0x6743('0x34')]=_['keys'](_0x2e6b07[_0x6743('0x34')]);_0x33a8df['filters']=_[_0x6743('0x35')](_0x33a8df[_0x6743('0x32')],_0x33a8df[_0x6743('0x34')]);_0x30f6a0[_0x6743('0x36')]=_[_0x6743('0x35')](_0x33a8df[_0x6743('0x32')],qs[_0x6743('0x37')](_0x2e6b07['query']['fields']));_0x30f6a0[_0x6743('0x36')]=_0x30f6a0['attributes'][_0x6743('0x38')]?_0x30f6a0[_0x6743('0x36')]:_0x33a8df['model'];if(!_0x2e6b07[_0x6743('0x34')]['hasOwnProperty']('nolimit')){_0x30f6a0[_0x6743('0x21')]=qs[_0x6743('0x21')](_0x2e6b07['query'][_0x6743('0x21')]);_0x30f6a0[_0x6743('0x1f')]=qs[_0x6743('0x1f')](_0x2e6b07['query'][_0x6743('0x1f')]);}_0x30f6a0[_0x6743('0x39')]=qs['sort'](_0x2e6b07[_0x6743('0x34')][_0x6743('0x3a')]);_0x30f6a0[_0x6743('0x3b')]=qs[_0x6743('0x3c')](_[_0x6743('0x3d')](_0x2e6b07['query'],_0x33a8df[_0x6743('0x3c')]),_0x4967aa);if(_0x2e6b07[_0x6743('0x34')][_0x6743('0x3e')]){_0x30f6a0[_0x6743('0x3b')]=_['merge'](_0x30f6a0[_0x6743('0x3b')],{'$or':_[_0x6743('0x33')](_0x4967aa,function(_0x24b1d7){if(_0x24b1d7[_0x6743('0x30')]!==_0x6743('0x3f')){var _0x3ef55a={};_0x3ef55a[_0x24b1d7[_0x6743('0x2b')]]={'$like':'%'+_0x2e6b07['query'][_0x6743('0x3e')]+'%'};return _0x3ef55a;}})});}_0x30f6a0=_[_0x6743('0x40')]({},_0x30f6a0,_0x2e6b07[_0x6743('0x41')]);var _0x34209a={'where':_0x30f6a0['where']};return db['VtigerAccount'][_0x6743('0x22')](_0x34209a)[_0x6743('0x27')](function(_0x42dac3){_0xa71dae[_0x6743('0x22')]=_0x42dac3;if(_0x2e6b07[_0x6743('0x34')]['includeAll']){_0x30f6a0['include']=[{'all':!![]}];}return db[_0x6743('0x2e')][_0x6743('0x42')](_0x30f6a0);})['then'](function(_0x241e07){_0xa71dae[_0x6743('0x43')]=_0x241e07;return _0xa71dae;})[_0x6743('0x27')](respondWithFilteredResult(_0x4d3465,_0x30f6a0))['catch'](handleError(_0x4d3465,null));};exports['show']=function(_0x4cdfa0,_0x21886e){var _0x11664d={'raw':![],'where':{'id':_0x4cdfa0[_0x6743('0x44')]['id']}},_0x4e340d={};_0x4e340d[_0x6743('0x32')]=_[_0x6743('0x45')](db[_0x6743('0x2e')]['rawAttributes']);_0x4e340d['query']=_['keys'](_0x4cdfa0[_0x6743('0x34')]);_0x4e340d[_0x6743('0x3c')]=_[_0x6743('0x35')](_0x4e340d['model'],_0x4e340d[_0x6743('0x34')]);_0x11664d[_0x6743('0x36')]=_['intersection'](_0x4e340d['model'],qs[_0x6743('0x37')](_0x4cdfa0['query']['fields']));_0x11664d[_0x6743('0x36')]=_0x11664d[_0x6743('0x36')][_0x6743('0x38')]?_0x11664d[_0x6743('0x36')]:_0x4e340d[_0x6743('0x32')];if(_0x4cdfa0[_0x6743('0x34')][_0x6743('0x46')]){_0x11664d[_0x6743('0x47')]=[{'all':!![]}];}_0x11664d=_[_0x6743('0x40')]({},_0x11664d,_0x4cdfa0[_0x6743('0x41')]);return db[_0x6743('0x2e')]['find'](_0x11664d)['then'](handleEntityNotFound(_0x21886e,null))['then'](respondWithResult(_0x21886e,null))[_0x6743('0x48')](handleError(_0x21886e,null));};exports['create']=function(_0x144b1b,_0x4da314){return db['VtigerAccount'][_0x6743('0x49')](_0x144b1b[_0x6743('0x4a')],{})[_0x6743('0x27')](respondWithResult(_0x4da314,0xc9))[_0x6743('0x48')](handleError(_0x4da314,null));};exports['update']=function(_0x118b50,_0x3a907b){if(_0x118b50['body']['id']){delete _0x118b50['body']['id'];}return db[_0x6743('0x2e')][_0x6743('0x4b')]({'where':{'id':_0x118b50[_0x6743('0x44')]['id']}})[_0x6743('0x27')](handleEntityNotFound(_0x3a907b,null))[_0x6743('0x27')](saveUpdates(_0x118b50[_0x6743('0x4a')],null))[_0x6743('0x27')](respondWithResult(_0x3a907b,null))[_0x6743('0x48')](handleError(_0x3a907b,null));};exports[_0x6743('0x28')]=function(_0x534740,_0x12fbb1){return db[_0x6743('0x2e')][_0x6743('0x4b')]({'where':{'id':_0x534740[_0x6743('0x44')]['id']}})['then'](handleEntityNotFound(_0x12fbb1,null))[_0x6743('0x27')](removeEntity(_0x12fbb1,null))['catch'](handleError(_0x12fbb1,null));};exports['getConfigurations']=function(_0xac9bd8,_0x1ea3a4,_0xb8a455){var _0x28c011={};var _0x30f665={};var _0xabd9d8;var _0x55393a;return db[_0x6743('0x2e')][_0x6743('0x4c')]({'where':{'id':_0xac9bd8[_0x6743('0x44')]['id']}})[_0x6743('0x27')](handleEntityNotFound(_0x1ea3a4,null))[_0x6743('0x27')](function(_0x4aa64b){if(_0x4aa64b){_0xabd9d8=_0x4aa64b;_0x30f665['model']=_[_0x6743('0x45')](db[_0x6743('0x4d')][_0x6743('0x2f')]);_0x30f665[_0x6743('0x34')]=_[_0x6743('0x45')](_0xac9bd8[_0x6743('0x34')]);_0x30f665[_0x6743('0x3c')]=_['intersection'](_0x30f665[_0x6743('0x32')],_0x30f665[_0x6743('0x34')]);_0x28c011[_0x6743('0x36')]=_[_0x6743('0x35')](_0x30f665[_0x6743('0x32')],qs[_0x6743('0x37')](_0xac9bd8[_0x6743('0x34')]['fields']));_0x28c011[_0x6743('0x36')]=_0x28c011[_0x6743('0x36')][_0x6743('0x38')]?_0x28c011[_0x6743('0x36')]:_0x30f665['model'];_0x28c011[_0x6743('0x39')]=qs[_0x6743('0x3a')](_0xac9bd8[_0x6743('0x34')][_0x6743('0x3a')]);_0x28c011['where']=qs[_0x6743('0x3c')](_[_0x6743('0x3d')](_0xac9bd8['query'],_0x30f665[_0x6743('0x3c')]));if(_0xac9bd8[_0x6743('0x34')][_0x6743('0x3e')]){_0x28c011[_0x6743('0x3b')]=_[_0x6743('0x40')](_0x28c011[_0x6743('0x3b')],{'$or':_[_0x6743('0x33')](_0x28c011[_0x6743('0x36')],function(_0x17efd2){var _0x3f266f={};_0x3f266f[_0x17efd2]={'$like':'%'+_0xac9bd8[_0x6743('0x34')]['filter']+'%'};return _0x3f266f;})});}_0x28c011=_['merge']({},_0x28c011,_0xac9bd8[_0x6743('0x41')]);return _0xabd9d8['getConfigurations'](_0x28c011);}})[_0x6743('0x27')](function(_0x20e39c){if(_0x20e39c){_0x55393a=_0x20e39c[_0x6743('0x38')];if(!_0xac9bd8[_0x6743('0x34')][_0x6743('0x4e')](_0x6743('0x4f'))){_0x28c011[_0x6743('0x21')]=qs[_0x6743('0x21')](_0xac9bd8[_0x6743('0x34')]['limit']);_0x28c011['offset']=qs[_0x6743('0x1f')](_0xac9bd8[_0x6743('0x34')][_0x6743('0x1f')]);}return _0xabd9d8[_0x6743('0x50')](_0x28c011);}})[_0x6743('0x27')](function(_0x38fc0d){if(_0x38fc0d){return _0x38fc0d?{'count':_0x55393a,'rows':_0x38fc0d}:null;}})['then'](respondWithResult(_0x1ea3a4,null))[_0x6743('0x48')](handleError(_0x1ea3a4,null));};exports[_0x6743('0x51')]=function(_0x1df59d,_0x2bd8db,_0x1ae1d7){if(_0x1df59d['body']['id']){delete _0x1df59d[_0x6743('0x4a')]['id'];}return db[_0x6743('0x2e')]['findOne']({'where':{'id':_0x1df59d[_0x6743('0x44')]['id']}})[_0x6743('0x27')](handleEntityNotFound(_0x2bd8db,null))[_0x6743('0x27')](function(_0x291d87){if(_0x291d87){_0x1df59d[_0x6743('0x4a')][_0x6743('0x52')]=_0x291d87['id'];_0x1df59d['body'][_0x6743('0x53')]=integrations[_0x6743('0x54')](_0x1df59d[_0x6743('0x4a')][_0x6743('0x55')],_0x1df59d[_0x6743('0x4a')][_0x6743('0x30')]);_0x1df59d[_0x6743('0x4a')][_0x6743('0x56')]=integrations[_0x6743('0x57')](_0x1df59d['body'][_0x6743('0x55')],_0x1df59d[_0x6743('0x4a')][_0x6743('0x30')]);return db[_0x6743('0x4d')][_0x6743('0x49')](_0x1df59d[_0x6743('0x4a')],{'include':[{'model':db[_0x6743('0x58')],'as':_0x6743('0x53')},{'model':db[_0x6743('0x58')],'as':_0x6743('0x56')}]});}return null;})[_0x6743('0x27')](respondWithResult(_0x2bd8db,null))[_0x6743('0x48')](handleError(_0x2bd8db,null));};var md5=require(_0x6743('0x59'));exports[_0x6743('0x5a')]=function(_0x394a76,_0x5d04c2,_0x23cb2c){var _0x159d4b=null;var _0x305a0e=null;var _0x1d1a9e=null;var _0x142248=null;var _0x939aa7='';return db[_0x6743('0x2e')][_0x6743('0x4c')]({'where':{'id':_0x394a76['params']['id']},'attributes':['id',_0x6743('0x2b'),_0x6743('0x5b'),_0x6743('0x5c'),'moduleName','remoteUri',_0x6743('0x5d'),_0x6743('0x5e')]})[_0x6743('0x27')](handleEntityNotFound(_0x5d04c2,null))[_0x6743('0x27')](function(_0x59664e){if(_0x59664e){_0x159d4b=_0x59664e[_0x6743('0x5b')];_0x305a0e=_0x59664e[_0x6743('0x5e')];_0x1d1a9e=_0x59664e['moduleName'];_0x939aa7=_0x59664e[_0x6743('0x5f')];var _0x5982bd=_0x939aa7[_0x6743('0x60')](-0x1);if(_0x5982bd==='/'){_0x939aa7=_0x939aa7[_0x6743('0x61')](0x0,_0x939aa7[_0x6743('0x62')](_0x5982bd));}_0x142248=util[_0x6743('0x63')](_0x6743('0x64'),_0x939aa7);var _0x160221={'method':_0x6743('0x65'),'uri':_0x142248,'qs':{'operation':'getchallenge','username':_0x59664e[_0x6743('0x5b')]},'json':!![]};return rp(_0x160221);}})['then'](function(_0x28398e){if(_0x28398e[_0x6743('0x66')]){var _0x4a2829={'method':'POST','uri':_0x142248,'form':{'operation':'login','username':_0x159d4b,'accessKey':md5(_0x28398e[_0x6743('0x67')]['token']+_0x305a0e)},'json':!![]};return rp(_0x4a2829);}})['then'](function(_0x444816){if(_0x444816[_0x6743('0x66')]){var _0x4f9e62={'method':'GET','uri':_0x142248,'qs':{'operation':_0x6743('0x68'),'username':_0x159d4b,'sessionName':_0x444816[_0x6743('0x67')][_0x6743('0x69')],'elementType':_0x1d1a9e},'json':!![]};return rp(_0x4f9e62);}})[_0x6743('0x27')](function(_0x50ea07){if(_0x50ea07[_0x6743('0x66')]){var _0x173d65=[_0x6743('0x6a'),_0x6743('0x6b'),_0x6743('0x6c')];_[_0x6743('0x6d')](_0x50ea07[_0x6743('0x67')]['fields'],function(_0x49787f){return _0x173d65[_0x6743('0x6e')](_0x49787f[_0x6743('0x30')][_0x6743('0x2b')]);});_[_0x6743('0x6d')](_0x50ea07['result'][_0x6743('0x37')],function(_0x507b45){return _0x507b45[_0x6743('0x6f')]==='false';});return{'count':_0x50ea07['result'][_0x6743('0x37')][_0x6743('0x38')],'rows':_[_0x6743('0x33')](_0x50ea07[_0x6743('0x67')][_0x6743('0x37')],function(_0xd26a33){return{'id':_0xd26a33['name'],'name':_0xd26a33[_0x6743('0x70')],'custom':_[_0x6743('0x71')](_0xd26a33[_0x6743('0x2b')],_0x6743('0x72'))?!![]:![],'options':_0xd26a33[_0x6743('0x30')][_0x6743('0x2b')]==='picklist'&&_0xd26a33[_0x6743('0x30')][_0x6743('0x73')][_0x6743('0x38')]>0x0?_[_0x6743('0x33')](_0xd26a33[_0x6743('0x30')][_0x6743('0x73')],function(_0x65c799){return{'name':_0x65c799[_0x6743('0x70')],'value':_0x65c799[_0x6743('0x74')]};}):[]};})};}})[_0x6743('0x27')](respondWithResult(_0x5d04c2,null))[_0x6743('0x48')](function(_0x4dd123){console[_0x6743('0x75')](_0x6743('0x76')+_0x4dd123);var _0x35dd66=_0x394a76[_0x6743('0x34')][_0x6743('0x77')]?0x1f4:_0x4dd123[_0x6743('0x78')]||0x1f4;logger[_0x6743('0x29')](_0x6743('0x79'),_0x6743('0x5a'),_0x35dd66,JSON[_0x6743('0x7a')](_0x4dd123));delete _0x4dd123['name'];if(_0x35dd66===0x191){_0x35dd66=0x190;}_0x5d04c2['status'](_0x35dd66)['send'](_0x394a76['query'][_0x6743('0x77')]?{'message':_0x6743('0x7b'),'statusCode':_0x4dd123['statusCode']}:_0x4dd123);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 9cee2ff..5224621 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 _0xaa3d=['request-promise','path','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x4f5519,_0x346fdc){var _0x1ae5c2=function(_0xd97be7){while(--_0xd97be7){_0x4f5519['push'](_0x4f5519['shift']());}};_0x1ae5c2(++_0x346fdc);}(_0xaa3d,0x177));var _0xdaa3=function(_0x484ac5,_0x552a1d){_0x484ac5=_0x484ac5-0x0;var _0x5a3c31=_0xaa3d[_0x484ac5];return _0x5a3c31;};'use strict';var _=require('lodash');var util=require(_0xdaa3('0x0'));var logger=require(_0xdaa3('0x1'))(_0xdaa3('0x2'));var moment=require(_0xdaa3('0x3'));var BPromise=require(_0xdaa3('0x4'));var rp=require(_0xdaa3('0x5'));var fs=require('fs');var path=require(_0xdaa3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x31ac34,_0x118a75){return _0x31ac34[_0xdaa3('0x7')](_0xdaa3('0x8'),attributes,{'tableName':_0xdaa3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f9a=['exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x333020,_0x5ebec7){var _0x4bfca6=function(_0x4d1594){while(--_0x4d1594){_0x333020['push'](_0x333020['shift']());}};_0x4bfca6(++_0x5ebec7);}(_0x7f9a,0x19a));var _0xa7f9=function(_0x3738e8,_0x167034){_0x3738e8=_0x3738e8-0x0;var _0x46a357=_0x7f9a[_0x3738e8];return _0x46a357;};'use strict';var _=require(_0xa7f9('0x0'));var util=require(_0xa7f9('0x1'));var logger=require(_0xa7f9('0x2'))(_0xa7f9('0x3'));var moment=require(_0xa7f9('0x4'));var BPromise=require(_0xa7f9('0x5'));var rp=require(_0xa7f9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa7f9('0x7'));var config=require(_0xa7f9('0x8'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xa7f9('0x9'));module[_0xa7f9('0xa')]=function(_0x5bd264,_0x13c928){return _0x5bd264[_0xa7f9('0xb')](_0xa7f9('0xc'),attributes,{'tableName':_0xa7f9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 6b13d55..fbc1bb5 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 _0x69d3=['debug','stringify','error','code','message','result','catch','VtigerAccount','options','raw','attributes','limit','include','model','map','then','GetVtigerAccount','ShowVtigerAccount','find','where','lodash','util','moment','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x3c6edd,_0x57b795){var _0x73e901=function(_0x3a1da3){while(--_0x3a1da3){_0x3c6edd['push'](_0x3c6edd['shift']());}};_0x73e901(++_0x57b795);}(_0x69d3,0xda));var _0x369d=function(_0x3b2f85,_0x596bea){_0x3b2f85=_0x3b2f85-0x0;var _0x547e41=_0x69d3[_0x3b2f85];return _0x547e41;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var moment=require(_0x369d('0x2'));var BPromise=require('bluebird');var rs=require(_0x369d('0x3'));var fs=require('fs');var Redis=require(_0x369d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x369d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x369d('0x6'));var client=jayson[_0x369d('0x7')][_0x369d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x424d8c,_0x1bd94c,_0x186302){return new BPromise(function(_0x3adb26,_0x2ac0ec){return client[_0x369d('0x9')](_0x424d8c,_0x186302)['then'](function(_0x5d2ded){logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,_0x369d('0xc'));logger[_0x369d('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1bd94c,'request\x20sent',JSON[_0x369d('0xe')](_0x5d2ded));if(_0x5d2ded[_0x369d('0xf')]){if(_0x5d2ded[_0x369d('0xf')][_0x369d('0x10')]===0x1f4){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error'][_0x369d('0x11')]);return _0x2ac0ec(_0x5d2ded[_0x369d('0xf')][_0x369d('0x11')]);}logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error']['message']);return _0x3adb26(_0x5d2ded['error'][_0x369d('0x11')]);}else{logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,'request\x20sent');_0x3adb26(_0x5d2ded[_0x369d('0x12')][_0x369d('0x11')]);}})[_0x369d('0x13')](function(_0x4e234e){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x4e234e);_0x2ac0ec(_0x4e234e);});});}exports['GetVtigerAccount']=function(_0x572513){var _0x597b67=this;return new Promise(function(_0x2946be,_0x4494b3){return db[_0x369d('0x14')]['findAll']({'raw':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x16')]===undefined?!![]:![]:!![],'where':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')]['where']||null:null,'attributes':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x17')]||null:null,'limit':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x18')]||null:null,'include':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')]['include']?_['map'](_0x572513[_0x369d('0x15')][_0x369d('0x19')],function(_0xf7bc3a){return{'model':db[_0xf7bc3a[_0x369d('0x1a')]],'as':_0xf7bc3a['as'],'attributes':_0xf7bc3a[_0x369d('0x17')],'include':_0xf7bc3a[_0x369d('0x19')]?_[_0x369d('0x1b')](_0xf7bc3a['include'],function(_0x4dfe83){return{'model':db[_0x4dfe83[_0x369d('0x1a')]],'as':_0x4dfe83['as'],'attributes':_0x4dfe83[_0x369d('0x17')],'include':_0x4dfe83[_0x369d('0x19')]?_[_0x369d('0x1b')](_0x4dfe83[_0x369d('0x19')],function(_0x41e0cf){return{'model':db[_0x41e0cf[_0x369d('0x1a')]],'as':_0x41e0cf['as'],'attributes':_0x41e0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x369d('0x1c')](function(_0xe95742){logger[_0x369d('0xa')](_0x369d('0x1d'),_0x572513);logger[_0x369d('0xd')](_0x369d('0x1d'),_0x572513,JSON[_0x369d('0xe')](_0xe95742));_0x2946be(_0xe95742);})['catch'](function(_0x157291){logger['error']('GetVtigerAccount',_0x157291[_0x369d('0x11')],_0x572513);_0x4494b3(_0x597b67[_0x369d('0xf')](0x1f4,_0x157291['message']));});});};exports[_0x369d('0x1e')]=function(_0x5a14ce){var _0x37274f=this;return new Promise(function(_0x39d656,_0xe45219){return db[_0x369d('0x14')][_0x369d('0x1f')]({'raw':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')][_0x369d('0x20')]||null:null,'attributes':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')][_0x369d('0x17')]||null:null,'include':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')]['include']?_[_0x369d('0x1b')](_0x5a14ce[_0x369d('0x15')][_0x369d('0x19')],function(_0x1b4453){return{'model':db[_0x1b4453[_0x369d('0x1a')]],'as':_0x1b4453['as'],'attributes':_0x1b4453['attributes'],'include':_0x1b4453[_0x369d('0x19')]?_[_0x369d('0x1b')](_0x1b4453[_0x369d('0x19')],function(_0x3a0277){return{'model':db[_0x3a0277[_0x369d('0x1a')]],'as':_0x3a0277['as'],'attributes':_0x3a0277[_0x369d('0x17')],'include':_0x3a0277['include']?_[_0x369d('0x1b')](_0x3a0277[_0x369d('0x19')],function(_0x40afb2){return{'model':db[_0x40afb2[_0x369d('0x1a')]],'as':_0x40afb2['as'],'attributes':_0x40afb2[_0x369d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x369d('0x1c')](function(_0xfa13da){logger[_0x369d('0xa')](_0x369d('0x1e'),_0x5a14ce);logger[_0x369d('0xd')](_0x369d('0x1e'),_0x5a14ce,JSON[_0x369d('0xe')](_0xfa13da));_0x39d656(_0xfa13da);})[_0x369d('0x13')](function(_0x43d734){logger[_0x369d('0xf')](_0x369d('0x1e'),_0x43d734[_0x369d('0x11')],_0x5a14ce);_0xe45219(_0x37274f[_0x369d('0xf')](0x1f4,_0x43d734[_0x369d('0x11')]));});});}; \ No newline at end of file +var _0x757a=['stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','ShowVtigerAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x1141b5,_0x134308){var _0x1dccc6=function(_0x12f81c){while(--_0x12f81c){_0x1141b5['push'](_0x1141b5['shift']());}};_0x1dccc6(++_0x134308);}(_0x757a,0xde));var _0xa757=function(_0x4a31b9,_0x4c1039){_0x4a31b9=_0x4a31b9-0x0;var _0x293199=_0x757a[_0x4a31b9];return _0x293199;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetVtigerAccount',_0x4d9f58);logger['debug']('GetVtigerAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetVtigerAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index b4c3fb5..7735a47 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 _0x7ffc=['path','express','Router','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','create','put','update','exports','multer','util'];(function(_0x317d61,_0x5e6335){var _0x3abc20=function(_0x556876){while(--_0x556876){_0x317d61['push'](_0x317d61['shift']());}};_0x3abc20(++_0x5e6335);}(_0x7ffc,0xe5));var _0xc7ff=function(_0x14d4eb,_0x1dff6b){_0x14d4eb=_0x14d4eb-0x0;var _0x58426a=_0x7ffc[_0x14d4eb];return _0x58426a;};'use strict';var multer=require(_0xc7ff('0x0'));var util=require(_0xc7ff('0x1'));var path=require(_0xc7ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xc7ff('0x3'));var router=express[_0xc7ff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc7ff('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc7ff('0x6'));var controller=require(_0xc7ff('0x7'));router[_0xc7ff('0x8')]('/',auth[_0xc7ff('0x9')](),controller[_0xc7ff('0xa')]);router[_0xc7ff('0x8')](_0xc7ff('0xb'),auth[_0xc7ff('0x9')](),controller[_0xc7ff('0xc')]);router[_0xc7ff('0x8')](_0xc7ff('0xd'),auth[_0xc7ff('0x9')](),controller[_0xc7ff('0xe')]);router[_0xc7ff('0x8')](_0xc7ff('0xf'),auth[_0xc7ff('0x9')](),controller[_0xc7ff('0x10')]);router[_0xc7ff('0x8')]('/:id/descriptions',auth[_0xc7ff('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0xc7ff('0x9')](),controller[_0xc7ff('0x11')]);router[_0xc7ff('0x12')](_0xc7ff('0xb'),auth[_0xc7ff('0x9')](),controller[_0xc7ff('0x13')]);router['delete'](_0xc7ff('0xb'),auth[_0xc7ff('0x9')](),controller['destroy']);module[_0xc7ff('0x14')]=router; \ No newline at end of file +var _0x393e=['../../config/environment','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','post','create','put','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xcfc44,_0x179bc1){var _0x307a25=function(_0x2b64de){while(--_0x2b64de){_0xcfc44['push'](_0xcfc44['shift']());}};_0x307a25(++_0x179bc1);}(_0x393e,0x13e));var _0xe393=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x393e[_0x1589dd];return _0x1bddd1;};'use strict';var multer=require(_0xe393('0x0'));var util=require(_0xe393('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe393('0x2'));var router=express['Router']();var fs_extra=require(_0xe393('0x3'));var auth=require(_0xe393('0x4'));var interaction=require(_0xe393('0x5'));var config=require(_0xe393('0x6'));var controller=require('./intVtigerConfiguration.controller');router[_0xe393('0x7')]('/',auth[_0xe393('0x8')](),controller['index']);router[_0xe393('0x7')](_0xe393('0x9'),auth[_0xe393('0x8')](),controller[_0xe393('0xa')]);router[_0xe393('0x7')]('/:id/fields',auth[_0xe393('0x8')](),controller['getFields']);router['get'](_0xe393('0xb'),auth[_0xe393('0x8')](),controller[_0xe393('0xc')]);router['get']('/:id/descriptions',auth[_0xe393('0x8')](),controller['getDescriptions']);router[_0xe393('0xd')]('/',auth['isAuthenticated'](),controller[_0xe393('0xe')]);router[_0xe393('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe393('0x10')]('/:id',auth[_0xe393('0x8')](),controller[_0xe393('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 4b39cee..1deef7a 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 _0xf004=['sequelize','STRING'];(function(_0x28ff30,_0x342f9c){var _0x453c8b=function(_0x40e323){while(--_0x40e323){_0x28ff30['push'](_0x28ff30['shift']());}};_0x453c8b(++_0x342f9c);}(_0xf004,0x132));var _0x4f00=function(_0x57f076,_0x56f86d){_0x57f076=_0x57f076-0x0;var _0x373010=_0xf004[_0x57f076];return _0x373010;};'use strict';var Sequelize=require(_0x4f00('0x0'));module['exports']={'name':{'type':Sequelize[_0x4f00('0x1')]},'description':{'type':Sequelize[_0x4f00('0x1')]}}; \ No newline at end of file +var _0x42b9=['STRING','sequelize'];(function(_0x313e62,_0x51d3a1){var _0x568cdc=function(_0x3120fc){while(--_0x3120fc){_0x313e62['push'](_0x313e62['shift']());}};_0x568cdc(++_0x51d3a1);}(_0x42b9,0x17d));var _0x942b=function(_0x2725cb,_0x4af1c9){_0x2725cb=_0x2725cb-0x0;var _0xf4bac1=_0x42b9[_0x2725cb];return _0xf4bac1;};'use strict';var Sequelize=require(_0x942b('0x0'));module['exports']={'name':{'type':Sequelize[_0x942b('0x1')]},'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 a4fa020..095a46d 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 _0xdcc2=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','VtigerConfiguration','include','findAll','rows','catch','show','length','includeAll','create','body','params','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x4e7a18,_0x5940c3){var _0x721285=function(_0x10fab2){while(--_0x10fab2){_0x4e7a18['push'](_0x4e7a18['shift']());}};_0x721285(++_0x5940c3);}(_0xdcc2,0x16b));var _0x2dcc=function(_0x51504d,_0x58bf5a){_0x51504d=_0x51504d-0x0;var _0x5b52c3=_0xdcc2[_0x51504d];return _0x5b52c3;};'use strict';var emlformat=require(_0x2dcc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2dcc('0x1'));var jsonpatch=require(_0x2dcc('0x2'));var rp=require(_0x2dcc('0x3'));var moment=require(_0x2dcc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2dcc('0x5'));var csv=require(_0x2dcc('0x6'));var ejs=require(_0x2dcc('0x7'));var fs=require('fs');var fs_extra=require(_0x2dcc('0x8'));var _=require(_0x2dcc('0x9'));var squel=require('squel');var crypto=require(_0x2dcc('0xa'));var jsforce=require(_0x2dcc('0xb'));var deskjs=require(_0x2dcc('0xc'));var toCsv=require(_0x2dcc('0x6'));var querystring=require(_0x2dcc('0xd'));var Papa=require(_0x2dcc('0xe'));var Redis=require(_0x2dcc('0xf'));var authService=require(_0x2dcc('0x10'));var qs=require(_0x2dcc('0x11'));var as=require(_0x2dcc('0x12'));var hardwareService=require(_0x2dcc('0x13'));var logger=require(_0x2dcc('0x14'))(_0x2dcc('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23d785,_0x25df45){_0x25df45=_0x25df45||0xcc;return function(_0x6127f9){if(_0x6127f9){return _0x23d785[_0x2dcc('0x16')](_0x25df45);}return _0x23d785[_0x2dcc('0x17')](_0x25df45)[_0x2dcc('0x18')]();};}function respondWithResult(_0xb821e8,_0x260da9){_0x260da9=_0x260da9||0xc8;return function(_0xf04393){if(_0xf04393){return _0xb821e8[_0x2dcc('0x17')](_0x260da9)[_0x2dcc('0x19')](_0xf04393);}};}function respondWithFilteredResult(_0x4e1e94,_0x50679b){return function(_0x6d284a){if(_0x6d284a){var _0x7d06ce=typeof _0x50679b[_0x2dcc('0x1a')]===_0x2dcc('0x1b')&&typeof _0x50679b[_0x2dcc('0x1c')]===_0x2dcc('0x1b');var _0x44f90b=_0x6d284a[_0x2dcc('0x1d')];var _0x7577f7=_0x7d06ce?0x0:_0x50679b['offset'];var _0x95066e=_0x7d06ce?_0x6d284a[_0x2dcc('0x1d')]:_0x50679b[_0x2dcc('0x1a')]+_0x50679b['limit'];var _0x577ea3;if(_0x95066e>=_0x44f90b){_0x95066e=_0x44f90b;_0x577ea3=0xc8;}else{_0x577ea3=0xce;}_0x4e1e94[_0x2dcc('0x17')](_0x577ea3);return _0x4e1e94['set'](_0x2dcc('0x1e'),_0x7577f7+'-'+_0x95066e+'/'+_0x44f90b)[_0x2dcc('0x19')](_0x6d284a);}return null;};}function patchUpdates(_0x418d14){return function(_0x5709c6){try{jsonpatch[_0x2dcc('0x1f')](_0x5709c6,_0x418d14,!![]);}catch(_0x1713d8){return BPromise['reject'](_0x1713d8);}return _0x5709c6['save']();};}function saveUpdates(_0x5505de,_0x478824){return function(_0x226cb3){if(_0x226cb3){return _0x226cb3[_0x2dcc('0x20')](_0x5505de)[_0x2dcc('0x21')](function(_0x4ad266){return _0x4ad266;});}return null;};}function removeEntity(_0x2e6753,_0x25b9d8){return function(_0x42b580){if(_0x42b580){return _0x42b580['destroy']()[_0x2dcc('0x21')](function(){_0x2e6753[_0x2dcc('0x17')](0xcc)[_0x2dcc('0x18')]();});}};}function handleEntityNotFound(_0x24063d,_0x4ae921){return function(_0x286598){if(!_0x286598){_0x24063d[_0x2dcc('0x16')](0x194);}return _0x286598;};}function handleError(_0x1a9aa5,_0x143c48){_0x143c48=_0x143c48||0x1f4;return function(_0x5d5436){logger['error'](_0x5d5436[_0x2dcc('0x22')]);if(_0x5d5436[_0x2dcc('0x23')]){delete _0x5d5436[_0x2dcc('0x23')];}_0x1a9aa5[_0x2dcc('0x17')](_0x143c48)['send'](_0x5d5436);};}exports[_0x2dcc('0x24')]=function(_0x5b6d9d,_0xd36fb7){var _0x3918fc={},_0xc91504={},_0x55c7e4={'count':0x0,'rows':[]};var _0x6d563f=_[_0x2dcc('0x25')](db['VtigerConfiguration'][_0x2dcc('0x26')],function(_0x5aac66){return{'name':_0x5aac66[_0x2dcc('0x27')],'type':_0x5aac66[_0x2dcc('0x28')][_0x2dcc('0x29')]};});_0xc91504[_0x2dcc('0x2a')]=_[_0x2dcc('0x25')](_0x6d563f,'name');_0xc91504[_0x2dcc('0x2b')]=_[_0x2dcc('0x2c')](_0x5b6d9d[_0x2dcc('0x2b')]);_0xc91504[_0x2dcc('0x2d')]=_[_0x2dcc('0x2e')](_0xc91504[_0x2dcc('0x2a')],_0xc91504[_0x2dcc('0x2b')]);_0x3918fc['attributes']=_[_0x2dcc('0x2e')](_0xc91504['model'],qs['fields'](_0x5b6d9d[_0x2dcc('0x2b')][_0x2dcc('0x2f')]));_0x3918fc[_0x2dcc('0x30')]=_0x3918fc[_0x2dcc('0x30')]['length']?_0x3918fc[_0x2dcc('0x30')]:_0xc91504[_0x2dcc('0x2a')];if(!_0x5b6d9d[_0x2dcc('0x2b')][_0x2dcc('0x31')](_0x2dcc('0x32'))){_0x3918fc[_0x2dcc('0x1c')]=qs['limit'](_0x5b6d9d[_0x2dcc('0x2b')]['limit']);_0x3918fc[_0x2dcc('0x1a')]=qs['offset'](_0x5b6d9d[_0x2dcc('0x2b')]['offset']);}_0x3918fc[_0x2dcc('0x33')]=qs[_0x2dcc('0x34')](_0x5b6d9d[_0x2dcc('0x2b')][_0x2dcc('0x34')]);_0x3918fc[_0x2dcc('0x35')]=qs[_0x2dcc('0x2d')](_[_0x2dcc('0x36')](_0x5b6d9d['query'],_0xc91504[_0x2dcc('0x2d')]),_0x6d563f);if(_0x5b6d9d['query']['filter']){_0x3918fc[_0x2dcc('0x35')]=_['merge'](_0x3918fc[_0x2dcc('0x35')],{'$or':_[_0x2dcc('0x25')](_0x6d563f,function(_0x2928de){if(_0x2928de[_0x2dcc('0x28')]!==_0x2dcc('0x37')){var _0x548018={};_0x548018[_0x2928de[_0x2dcc('0x23')]]={'$like':'%'+_0x5b6d9d[_0x2dcc('0x2b')][_0x2dcc('0x38')]+'%'};return _0x548018;}})});}_0x3918fc=_[_0x2dcc('0x39')]({},_0x3918fc,_0x5b6d9d[_0x2dcc('0x3a')]);var _0x260b67={'where':_0x3918fc[_0x2dcc('0x35')]};return db[_0x2dcc('0x3b')][_0x2dcc('0x1d')](_0x260b67)['then'](function(_0x5e543e){_0x55c7e4['count']=_0x5e543e;if(_0x5b6d9d[_0x2dcc('0x2b')]['includeAll']){_0x3918fc[_0x2dcc('0x3c')]=[{'all':!![]}];}return db[_0x2dcc('0x3b')][_0x2dcc('0x3d')](_0x3918fc);})[_0x2dcc('0x21')](function(_0x24fed9){_0x55c7e4[_0x2dcc('0x3e')]=_0x24fed9;return _0x55c7e4;})[_0x2dcc('0x21')](respondWithFilteredResult(_0xd36fb7,_0x3918fc))[_0x2dcc('0x3f')](handleError(_0xd36fb7,null));};exports[_0x2dcc('0x40')]=function(_0x337820,_0x372d77){var _0x317a3c={'raw':![],'where':{'id':_0x337820['params']['id']}},_0x11eb31={};_0x11eb31[_0x2dcc('0x2a')]=_[_0x2dcc('0x2c')](db[_0x2dcc('0x3b')][_0x2dcc('0x26')]);_0x11eb31[_0x2dcc('0x2b')]=_[_0x2dcc('0x2c')](_0x337820[_0x2dcc('0x2b')]);_0x11eb31['filters']=_['intersection'](_0x11eb31[_0x2dcc('0x2a')],_0x11eb31[_0x2dcc('0x2b')]);_0x317a3c[_0x2dcc('0x30')]=_['intersection'](_0x11eb31[_0x2dcc('0x2a')],qs[_0x2dcc('0x2f')](_0x337820[_0x2dcc('0x2b')][_0x2dcc('0x2f')]));_0x317a3c['attributes']=_0x317a3c[_0x2dcc('0x30')][_0x2dcc('0x41')]?_0x317a3c[_0x2dcc('0x30')]:_0x11eb31[_0x2dcc('0x2a')];if(_0x337820['query'][_0x2dcc('0x42')]){_0x317a3c['include']=[{'all':!![]}];}_0x317a3c=_[_0x2dcc('0x39')]({},_0x317a3c,_0x337820['options']);return db[_0x2dcc('0x3b')]['find'](_0x317a3c)[_0x2dcc('0x21')](handleEntityNotFound(_0x372d77,null))[_0x2dcc('0x21')](respondWithResult(_0x372d77,null))[_0x2dcc('0x3f')](handleError(_0x372d77,null));};exports['create']=function(_0x5a94a3,_0x5c9f73){return db[_0x2dcc('0x3b')][_0x2dcc('0x43')](_0x5a94a3[_0x2dcc('0x44')],{})[_0x2dcc('0x21')](respondWithResult(_0x5c9f73,0xc9))[_0x2dcc('0x3f')](handleError(_0x5c9f73,null));};exports[_0x2dcc('0x20')]=function(_0x994d75,_0x90f04c){if(_0x994d75[_0x2dcc('0x44')]['id']){delete _0x994d75[_0x2dcc('0x44')]['id'];}return db[_0x2dcc('0x3b')]['find']({'where':{'id':_0x994d75[_0x2dcc('0x45')]['id']}})[_0x2dcc('0x21')](handleEntityNotFound(_0x90f04c,null))[_0x2dcc('0x21')](saveUpdates(_0x994d75['body'],null))['then'](respondWithResult(_0x90f04c,null))[_0x2dcc('0x3f')](handleError(_0x90f04c,null));};exports['destroy']=function(_0x7e8711,_0x19bcb4){return db[_0x2dcc('0x3b')]['find']({'where':{'id':_0x7e8711[_0x2dcc('0x45')]['id']}})[_0x2dcc('0x21')](handleEntityNotFound(_0x19bcb4,null))[_0x2dcc('0x21')](removeEntity(_0x19bcb4,null))[_0x2dcc('0x3f')](handleError(_0x19bcb4,null));};exports[_0x2dcc('0x46')]=function(_0x170d7d,_0x23dca4,_0x2b5271){var _0x7853fc={};var _0x3701b9={};var _0x24570b;var _0x3e9229;return db[_0x2dcc('0x3b')][_0x2dcc('0x47')]({'where':{'id':_0x170d7d[_0x2dcc('0x45')]['id']}})[_0x2dcc('0x21')](handleEntityNotFound(_0x23dca4,null))['then'](function(_0x4595ff){if(_0x4595ff){_0x24570b=_0x4595ff;_0x3701b9[_0x2dcc('0x2a')]=_[_0x2dcc('0x2c')](db[_0x2dcc('0x48')][_0x2dcc('0x26')]);_0x3701b9['query']=_[_0x2dcc('0x2c')](_0x170d7d[_0x2dcc('0x2b')]);_0x3701b9[_0x2dcc('0x2d')]=_['intersection'](_0x3701b9[_0x2dcc('0x2a')],_0x3701b9[_0x2dcc('0x2b')]);_0x7853fc['attributes']=_[_0x2dcc('0x2e')](_0x3701b9[_0x2dcc('0x2a')],qs['fields'](_0x170d7d[_0x2dcc('0x2b')][_0x2dcc('0x2f')]));_0x7853fc[_0x2dcc('0x30')]=_0x7853fc['attributes'][_0x2dcc('0x41')]?_0x7853fc[_0x2dcc('0x30')]:_0x3701b9[_0x2dcc('0x2a')];_0x7853fc[_0x2dcc('0x33')]=qs[_0x2dcc('0x34')](_0x170d7d[_0x2dcc('0x2b')][_0x2dcc('0x34')]);_0x7853fc[_0x2dcc('0x35')]=qs['filters'](_[_0x2dcc('0x36')](_0x170d7d[_0x2dcc('0x2b')],_0x3701b9['filters']));if(_0x170d7d['query'][_0x2dcc('0x38')]){_0x7853fc[_0x2dcc('0x35')]=_[_0x2dcc('0x39')](_0x7853fc['where'],{'$or':_['map'](_0x7853fc['attributes'],function(_0x1d42bb){var _0x403845={};_0x403845[_0x1d42bb]={'$like':'%'+_0x170d7d['query'][_0x2dcc('0x38')]+'%'};return _0x403845;})});}_0x7853fc=_['merge']({},_0x7853fc,_0x170d7d[_0x2dcc('0x3a')]);return _0x24570b['getFields'](_0x7853fc);}})['then'](function(_0x5990b7){if(_0x5990b7){_0x3e9229=_0x5990b7[_0x2dcc('0x41')];if(!_0x170d7d[_0x2dcc('0x2b')][_0x2dcc('0x31')](_0x2dcc('0x32'))){_0x7853fc[_0x2dcc('0x1c')]=qs[_0x2dcc('0x1c')](_0x170d7d[_0x2dcc('0x2b')][_0x2dcc('0x1c')]);_0x7853fc[_0x2dcc('0x1a')]=qs[_0x2dcc('0x1a')](_0x170d7d[_0x2dcc('0x2b')]['offset']);}return _0x24570b[_0x2dcc('0x46')](_0x7853fc);}})[_0x2dcc('0x21')](function(_0x214456){if(_0x214456){return _0x214456?{'count':_0x3e9229,'rows':_0x214456}:null;}})[_0x2dcc('0x21')](respondWithResult(_0x23dca4,null))[_0x2dcc('0x3f')](handleError(_0x23dca4,null));};exports[_0x2dcc('0x49')]=function(_0x21148c,_0x20639c,_0x288007){var _0x5593b5={};var _0x4b10d5={};var _0x38cbc5;var _0x1a1265;return db['VtigerConfiguration'][_0x2dcc('0x47')]({'where':{'id':_0x21148c['params']['id']}})['then'](handleEntityNotFound(_0x20639c,null))[_0x2dcc('0x21')](function(_0x253a65){if(_0x253a65){_0x38cbc5=_0x253a65;_0x4b10d5[_0x2dcc('0x2a')]=_[_0x2dcc('0x2c')](db[_0x2dcc('0x48')][_0x2dcc('0x26')]);_0x4b10d5['query']=_['keys'](_0x21148c[_0x2dcc('0x2b')]);_0x4b10d5[_0x2dcc('0x2d')]=_[_0x2dcc('0x2e')](_0x4b10d5['model'],_0x4b10d5[_0x2dcc('0x2b')]);_0x5593b5[_0x2dcc('0x30')]=_[_0x2dcc('0x2e')](_0x4b10d5[_0x2dcc('0x2a')],qs[_0x2dcc('0x2f')](_0x21148c['query']['fields']));_0x5593b5[_0x2dcc('0x30')]=_0x5593b5[_0x2dcc('0x30')][_0x2dcc('0x41')]?_0x5593b5[_0x2dcc('0x30')]:_0x4b10d5['model'];_0x5593b5[_0x2dcc('0x33')]=qs[_0x2dcc('0x34')](_0x21148c[_0x2dcc('0x2b')][_0x2dcc('0x34')]);_0x5593b5[_0x2dcc('0x35')]=qs[_0x2dcc('0x2d')](_[_0x2dcc('0x36')](_0x21148c[_0x2dcc('0x2b')],_0x4b10d5['filters']));if(_0x21148c[_0x2dcc('0x2b')][_0x2dcc('0x38')]){_0x5593b5['where']=_['merge'](_0x5593b5['where'],{'$or':_[_0x2dcc('0x25')](_0x5593b5[_0x2dcc('0x30')],function(_0x32c633){var _0x394797={};_0x394797[_0x32c633]={'$like':'%'+_0x21148c[_0x2dcc('0x2b')][_0x2dcc('0x38')]+'%'};return _0x394797;})});}_0x5593b5=_[_0x2dcc('0x39')]({},_0x5593b5,_0x21148c['options']);return _0x38cbc5[_0x2dcc('0x49')](_0x5593b5);}})[_0x2dcc('0x21')](function(_0x5a457b){if(_0x5a457b){_0x1a1265=_0x5a457b['length'];if(!_0x21148c[_0x2dcc('0x2b')][_0x2dcc('0x31')](_0x2dcc('0x32'))){_0x5593b5['limit']=qs[_0x2dcc('0x1c')](_0x21148c['query'][_0x2dcc('0x1c')]);_0x5593b5[_0x2dcc('0x1a')]=qs[_0x2dcc('0x1a')](_0x21148c[_0x2dcc('0x2b')][_0x2dcc('0x1a')]);}return _0x38cbc5[_0x2dcc('0x49')](_0x5593b5);}})[_0x2dcc('0x21')](function(_0x2af897){if(_0x2af897){return _0x2af897?{'count':_0x1a1265,'rows':_0x2af897}:null;}})[_0x2dcc('0x21')](respondWithResult(_0x20639c,null))[_0x2dcc('0x3f')](handleError(_0x20639c,null));};exports[_0x2dcc('0x4a')]=function(_0x76cbd6,_0x422cdb,_0x5e1255){var _0x3096b5={};var _0x3eb5e7={};var _0x16e1ed;var _0x1e224a;return db['VtigerConfiguration'][_0x2dcc('0x47')]({'where':{'id':_0x76cbd6[_0x2dcc('0x45')]['id']}})[_0x2dcc('0x21')](handleEntityNotFound(_0x422cdb,null))['then'](function(_0x5b07f4){if(_0x5b07f4){_0x16e1ed=_0x5b07f4;_0x3eb5e7['model']=_['keys'](db[_0x2dcc('0x48')]['rawAttributes']);_0x3eb5e7[_0x2dcc('0x2b')]=_['keys'](_0x76cbd6['query']);_0x3eb5e7[_0x2dcc('0x2d')]=_[_0x2dcc('0x2e')](_0x3eb5e7[_0x2dcc('0x2a')],_0x3eb5e7[_0x2dcc('0x2b')]);_0x3096b5[_0x2dcc('0x30')]=_[_0x2dcc('0x2e')](_0x3eb5e7[_0x2dcc('0x2a')],qs[_0x2dcc('0x2f')](_0x76cbd6['query'][_0x2dcc('0x2f')]));_0x3096b5[_0x2dcc('0x30')]=_0x3096b5[_0x2dcc('0x30')][_0x2dcc('0x41')]?_0x3096b5[_0x2dcc('0x30')]:_0x3eb5e7['model'];_0x3096b5[_0x2dcc('0x33')]=qs[_0x2dcc('0x34')](_0x76cbd6[_0x2dcc('0x2b')][_0x2dcc('0x34')]);_0x3096b5['where']=qs[_0x2dcc('0x2d')](_[_0x2dcc('0x36')](_0x76cbd6['query'],_0x3eb5e7[_0x2dcc('0x2d')]));if(_0x76cbd6['query'][_0x2dcc('0x38')]){_0x3096b5[_0x2dcc('0x35')]=_['merge'](_0x3096b5[_0x2dcc('0x35')],{'$or':_[_0x2dcc('0x25')](_0x3096b5['attributes'],function(_0x36400d){var _0x434b9d={};_0x434b9d[_0x36400d]={'$like':'%'+_0x76cbd6['query'][_0x2dcc('0x38')]+'%'};return _0x434b9d;})});}_0x3096b5=_[_0x2dcc('0x39')]({},_0x3096b5,_0x76cbd6[_0x2dcc('0x3a')]);return _0x16e1ed[_0x2dcc('0x4a')](_0x3096b5);}})[_0x2dcc('0x21')](function(_0xd31086){if(_0xd31086){_0x1e224a=_0xd31086[_0x2dcc('0x41')];if(!_0x76cbd6[_0x2dcc('0x2b')]['hasOwnProperty'](_0x2dcc('0x32'))){_0x3096b5[_0x2dcc('0x1c')]=qs['limit'](_0x76cbd6[_0x2dcc('0x2b')][_0x2dcc('0x1c')]);_0x3096b5[_0x2dcc('0x1a')]=qs[_0x2dcc('0x1a')](_0x76cbd6['query'][_0x2dcc('0x1a')]);}return _0x16e1ed[_0x2dcc('0x4a')](_0x3096b5);}})[_0x2dcc('0x21')](function(_0x594660){if(_0x594660){return _0x594660?{'count':_0x1e224a,'rows':_0x594660}:null;}})[_0x2dcc('0x21')](respondWithResult(_0x422cdb,null))['catch'](handleError(_0x422cdb,null));}; \ No newline at end of file +var _0x6f1e=['includeAll','include','rows','catch','show','params','keys','rawAttributes','length','find','body','getFields','VtigerField','order','getSubjects','findOne','getDescriptions','hasOwnProperty','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','VtigerConfiguration','fieldName','type','model','query','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options'];(function(_0x5bf420,_0x2d068d){var _0x1c5255=function(_0x4964a2){while(--_0x4964a2){_0x5bf420['push'](_0x5bf420['shift']());}};_0x1c5255(++_0x2d068d);}(_0x6f1e,0x1e0));var _0xe6f1=function(_0x156b7b,_0xf7e428){_0x156b7b=_0x156b7b-0x0;var _0x2702a0=_0x6f1e[_0x156b7b];return _0x2702a0;};'use strict';var emlformat=require(_0xe6f1('0x0'));var rimraf=require(_0xe6f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe6f1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe6f1('0x3'));var util=require(_0xe6f1('0x4'));var path=require(_0xe6f1('0x5'));var sox=require(_0xe6f1('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe6f1('0x7'));var _=require('lodash');var squel=require(_0xe6f1('0x8'));var crypto=require(_0xe6f1('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe6f1('0xa'));var toCsv=require(_0xe6f1('0xb'));var querystring=require(_0xe6f1('0xc'));var Papa=require(_0xe6f1('0xd'));var Redis=require(_0xe6f1('0xe'));var authService=require(_0xe6f1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe6f1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe6f1('0x11'))(_0xe6f1('0x12'));var utils=require('../../config/utils');var config=require(_0xe6f1('0x13'));var licenseUtil=require(_0xe6f1('0x14'));var db=require(_0xe6f1('0x15'))['db'];function respondWithStatusCode(_0x75e7c1,_0x5a7976){_0x5a7976=_0x5a7976||0xcc;return function(_0x4efd49){if(_0x4efd49){return _0x75e7c1[_0xe6f1('0x16')](_0x5a7976);}return _0x75e7c1[_0xe6f1('0x17')](_0x5a7976)[_0xe6f1('0x18')]();};}function respondWithResult(_0x1e61e9,_0x568d65){_0x568d65=_0x568d65||0xc8;return function(_0x26be82){if(_0x26be82){return _0x1e61e9[_0xe6f1('0x17')](_0x568d65)[_0xe6f1('0x19')](_0x26be82);}};}function respondWithFilteredResult(_0x55bacd,_0x44d55f){return function(_0x4b6b99){if(_0x4b6b99){var _0x2f8585=typeof _0x44d55f[_0xe6f1('0x1a')]===_0xe6f1('0x1b')&&typeof _0x44d55f[_0xe6f1('0x1c')]==='undefined';var _0x265a03=_0x4b6b99[_0xe6f1('0x1d')];var _0x5b6052=_0x2f8585?0x0:_0x44d55f['offset'];var _0x4208ee=_0x2f8585?_0x4b6b99['count']:_0x44d55f[_0xe6f1('0x1a')]+_0x44d55f[_0xe6f1('0x1c')];var _0x512ef8;if(_0x4208ee>=_0x265a03){_0x4208ee=_0x265a03;_0x512ef8=0xc8;}else{_0x512ef8=0xce;}_0x55bacd[_0xe6f1('0x17')](_0x512ef8);return _0x55bacd['set'](_0xe6f1('0x1e'),_0x5b6052+'-'+_0x4208ee+'/'+_0x265a03)[_0xe6f1('0x19')](_0x4b6b99);}return null;};}function patchUpdates(_0x15843e){return function(_0x3f3691){try{jsonpatch[_0xe6f1('0x1f')](_0x3f3691,_0x15843e,!![]);}catch(_0x437fb2){return BPromise[_0xe6f1('0x20')](_0x437fb2);}return _0x3f3691['save']();};}function saveUpdates(_0x294f93,_0x4d1635){return function(_0x38f22f){if(_0x38f22f){return _0x38f22f[_0xe6f1('0x21')](_0x294f93)['then'](function(_0x2914ec){return _0x2914ec;});}return null;};}function removeEntity(_0x49bf4a,_0x20fd37){return function(_0x346ca3){if(_0x346ca3){return _0x346ca3[_0xe6f1('0x22')]()[_0xe6f1('0x23')](function(){_0x49bf4a[_0xe6f1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe415f,_0x5f4531){return function(_0x461007){if(!_0x461007){_0xe415f[_0xe6f1('0x16')](0x194);}return _0x461007;};}function handleError(_0x4295a9,_0x282eed){_0x282eed=_0x282eed||0x1f4;return function(_0x407c1a){logger[_0xe6f1('0x24')](_0x407c1a[_0xe6f1('0x25')]);if(_0x407c1a[_0xe6f1('0x26')]){delete _0x407c1a[_0xe6f1('0x26')];}_0x4295a9[_0xe6f1('0x17')](_0x282eed)[_0xe6f1('0x27')](_0x407c1a);};}exports[_0xe6f1('0x28')]=function(_0x40afd8,_0x54cfa5){var _0x3a8ab8={},_0x4f35a4={},_0x202505={'count':0x0,'rows':[]};var _0x5553f3=_[_0xe6f1('0x29')](db[_0xe6f1('0x2a')]['rawAttributes'],function(_0x2ca0f3){return{'name':_0x2ca0f3[_0xe6f1('0x2b')],'type':_0x2ca0f3[_0xe6f1('0x2c')]['key']};});_0x4f35a4[_0xe6f1('0x2d')]=_[_0xe6f1('0x29')](_0x5553f3,_0xe6f1('0x26'));_0x4f35a4['query']=_['keys'](_0x40afd8[_0xe6f1('0x2e')]);_0x4f35a4['filters']=_[_0xe6f1('0x2f')](_0x4f35a4[_0xe6f1('0x2d')],_0x4f35a4[_0xe6f1('0x2e')]);_0x3a8ab8[_0xe6f1('0x30')]=_[_0xe6f1('0x2f')](_0x4f35a4['model'],qs[_0xe6f1('0x31')](_0x40afd8[_0xe6f1('0x2e')][_0xe6f1('0x31')]));_0x3a8ab8[_0xe6f1('0x30')]=_0x3a8ab8[_0xe6f1('0x30')]['length']?_0x3a8ab8[_0xe6f1('0x30')]:_0x4f35a4['model'];if(!_0x40afd8['query']['hasOwnProperty'](_0xe6f1('0x32'))){_0x3a8ab8[_0xe6f1('0x1c')]=qs[_0xe6f1('0x1c')](_0x40afd8[_0xe6f1('0x2e')][_0xe6f1('0x1c')]);_0x3a8ab8[_0xe6f1('0x1a')]=qs[_0xe6f1('0x1a')](_0x40afd8[_0xe6f1('0x2e')]['offset']);}_0x3a8ab8['order']=qs[_0xe6f1('0x33')](_0x40afd8[_0xe6f1('0x2e')]['sort']);_0x3a8ab8[_0xe6f1('0x34')]=qs[_0xe6f1('0x35')](_[_0xe6f1('0x36')](_0x40afd8[_0xe6f1('0x2e')],_0x4f35a4[_0xe6f1('0x35')]),_0x5553f3);if(_0x40afd8[_0xe6f1('0x2e')][_0xe6f1('0x37')]){_0x3a8ab8[_0xe6f1('0x34')]=_[_0xe6f1('0x38')](_0x3a8ab8[_0xe6f1('0x34')],{'$or':_[_0xe6f1('0x29')](_0x5553f3,function(_0x3c7485){if(_0x3c7485[_0xe6f1('0x2c')]!==_0xe6f1('0x39')){var _0x600023={};_0x600023[_0x3c7485['name']]={'$like':'%'+_0x40afd8[_0xe6f1('0x2e')]['filter']+'%'};return _0x600023;}})});}_0x3a8ab8=_['merge']({},_0x3a8ab8,_0x40afd8[_0xe6f1('0x3a')]);var _0x47e3c9={'where':_0x3a8ab8['where']};return db[_0xe6f1('0x2a')][_0xe6f1('0x1d')](_0x47e3c9)[_0xe6f1('0x23')](function(_0x256b6b){_0x202505[_0xe6f1('0x1d')]=_0x256b6b;if(_0x40afd8['query'][_0xe6f1('0x3b')]){_0x3a8ab8[_0xe6f1('0x3c')]=[{'all':!![]}];}return db[_0xe6f1('0x2a')]['findAll'](_0x3a8ab8);})[_0xe6f1('0x23')](function(_0x29e225){_0x202505[_0xe6f1('0x3d')]=_0x29e225;return _0x202505;})[_0xe6f1('0x23')](respondWithFilteredResult(_0x54cfa5,_0x3a8ab8))[_0xe6f1('0x3e')](handleError(_0x54cfa5,null));};exports[_0xe6f1('0x3f')]=function(_0x44c4ca,_0x571ccf){var _0x20888d={'raw':![],'where':{'id':_0x44c4ca[_0xe6f1('0x40')]['id']}},_0x56fb67={};_0x56fb67[_0xe6f1('0x2d')]=_[_0xe6f1('0x41')](db[_0xe6f1('0x2a')][_0xe6f1('0x42')]);_0x56fb67[_0xe6f1('0x2e')]=_[_0xe6f1('0x41')](_0x44c4ca[_0xe6f1('0x2e')]);_0x56fb67[_0xe6f1('0x35')]=_[_0xe6f1('0x2f')](_0x56fb67[_0xe6f1('0x2d')],_0x56fb67['query']);_0x20888d[_0xe6f1('0x30')]=_[_0xe6f1('0x2f')](_0x56fb67[_0xe6f1('0x2d')],qs['fields'](_0x44c4ca['query'][_0xe6f1('0x31')]));_0x20888d[_0xe6f1('0x30')]=_0x20888d[_0xe6f1('0x30')][_0xe6f1('0x43')]?_0x20888d['attributes']:_0x56fb67[_0xe6f1('0x2d')];if(_0x44c4ca[_0xe6f1('0x2e')][_0xe6f1('0x3b')]){_0x20888d['include']=[{'all':!![]}];}_0x20888d=_[_0xe6f1('0x38')]({},_0x20888d,_0x44c4ca[_0xe6f1('0x3a')]);return db[_0xe6f1('0x2a')][_0xe6f1('0x44')](_0x20888d)[_0xe6f1('0x23')](handleEntityNotFound(_0x571ccf,null))[_0xe6f1('0x23')](respondWithResult(_0x571ccf,null))[_0xe6f1('0x3e')](handleError(_0x571ccf,null));};exports['create']=function(_0x28d79f,_0x1e94d9){return db['VtigerConfiguration']['create'](_0x28d79f[_0xe6f1('0x45')],{})[_0xe6f1('0x23')](respondWithResult(_0x1e94d9,0xc9))[_0xe6f1('0x3e')](handleError(_0x1e94d9,null));};exports[_0xe6f1('0x21')]=function(_0x512b69,_0x787a4d){if(_0x512b69[_0xe6f1('0x45')]['id']){delete _0x512b69[_0xe6f1('0x45')]['id'];}return db[_0xe6f1('0x2a')][_0xe6f1('0x44')]({'where':{'id':_0x512b69['params']['id']}})[_0xe6f1('0x23')](handleEntityNotFound(_0x787a4d,null))[_0xe6f1('0x23')](saveUpdates(_0x512b69[_0xe6f1('0x45')],null))[_0xe6f1('0x23')](respondWithResult(_0x787a4d,null))[_0xe6f1('0x3e')](handleError(_0x787a4d,null));};exports[_0xe6f1('0x22')]=function(_0x1b85b6,_0x3d6d24){return db['VtigerConfiguration'][_0xe6f1('0x44')]({'where':{'id':_0x1b85b6[_0xe6f1('0x40')]['id']}})['then'](handleEntityNotFound(_0x3d6d24,null))[_0xe6f1('0x23')](removeEntity(_0x3d6d24,null))[_0xe6f1('0x3e')](handleError(_0x3d6d24,null));};exports[_0xe6f1('0x46')]=function(_0x2e7f59,_0x4335e7,_0xfd5081){var _0xbed08c={};var _0xffa636={};var _0x51bc11;var _0x2fe6f2;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x2e7f59[_0xe6f1('0x40')]['id']}})['then'](handleEntityNotFound(_0x4335e7,null))[_0xe6f1('0x23')](function(_0x5b2fae){if(_0x5b2fae){_0x51bc11=_0x5b2fae;_0xffa636[_0xe6f1('0x2d')]=_[_0xe6f1('0x41')](db[_0xe6f1('0x47')][_0xe6f1('0x42')]);_0xffa636['query']=_[_0xe6f1('0x41')](_0x2e7f59[_0xe6f1('0x2e')]);_0xffa636[_0xe6f1('0x35')]=_['intersection'](_0xffa636[_0xe6f1('0x2d')],_0xffa636[_0xe6f1('0x2e')]);_0xbed08c['attributes']=_['intersection'](_0xffa636[_0xe6f1('0x2d')],qs['fields'](_0x2e7f59[_0xe6f1('0x2e')][_0xe6f1('0x31')]));_0xbed08c[_0xe6f1('0x30')]=_0xbed08c[_0xe6f1('0x30')][_0xe6f1('0x43')]?_0xbed08c['attributes']:_0xffa636['model'];_0xbed08c[_0xe6f1('0x48')]=qs[_0xe6f1('0x33')](_0x2e7f59['query']['sort']);_0xbed08c[_0xe6f1('0x34')]=qs['filters'](_[_0xe6f1('0x36')](_0x2e7f59['query'],_0xffa636[_0xe6f1('0x35')]));if(_0x2e7f59[_0xe6f1('0x2e')][_0xe6f1('0x37')]){_0xbed08c[_0xe6f1('0x34')]=_[_0xe6f1('0x38')](_0xbed08c[_0xe6f1('0x34')],{'$or':_[_0xe6f1('0x29')](_0xbed08c[_0xe6f1('0x30')],function(_0x3e6862){var _0x3f5bea={};_0x3f5bea[_0x3e6862]={'$like':'%'+_0x2e7f59['query']['filter']+'%'};return _0x3f5bea;})});}_0xbed08c=_[_0xe6f1('0x38')]({},_0xbed08c,_0x2e7f59[_0xe6f1('0x3a')]);return _0x51bc11['getFields'](_0xbed08c);}})['then'](function(_0x44a7be){if(_0x44a7be){_0x2fe6f2=_0x44a7be[_0xe6f1('0x43')];if(!_0x2e7f59['query']['hasOwnProperty'](_0xe6f1('0x32'))){_0xbed08c[_0xe6f1('0x1c')]=qs[_0xe6f1('0x1c')](_0x2e7f59[_0xe6f1('0x2e')][_0xe6f1('0x1c')]);_0xbed08c[_0xe6f1('0x1a')]=qs[_0xe6f1('0x1a')](_0x2e7f59['query'][_0xe6f1('0x1a')]);}return _0x51bc11['getFields'](_0xbed08c);}})[_0xe6f1('0x23')](function(_0x3131dc){if(_0x3131dc){return _0x3131dc?{'count':_0x2fe6f2,'rows':_0x3131dc}:null;}})[_0xe6f1('0x23')](respondWithResult(_0x4335e7,null))[_0xe6f1('0x3e')](handleError(_0x4335e7,null));};exports[_0xe6f1('0x49')]=function(_0x35037c,_0x4414a7,_0x1b751b){var _0xff7a96={};var _0x5219b3={};var _0x573dc2;var _0x4672c6;return db[_0xe6f1('0x2a')][_0xe6f1('0x4a')]({'where':{'id':_0x35037c[_0xe6f1('0x40')]['id']}})[_0xe6f1('0x23')](handleEntityNotFound(_0x4414a7,null))[_0xe6f1('0x23')](function(_0x4f7a6e){if(_0x4f7a6e){_0x573dc2=_0x4f7a6e;_0x5219b3[_0xe6f1('0x2d')]=_[_0xe6f1('0x41')](db[_0xe6f1('0x47')][_0xe6f1('0x42')]);_0x5219b3[_0xe6f1('0x2e')]=_[_0xe6f1('0x41')](_0x35037c[_0xe6f1('0x2e')]);_0x5219b3[_0xe6f1('0x35')]=_['intersection'](_0x5219b3[_0xe6f1('0x2d')],_0x5219b3[_0xe6f1('0x2e')]);_0xff7a96[_0xe6f1('0x30')]=_[_0xe6f1('0x2f')](_0x5219b3[_0xe6f1('0x2d')],qs[_0xe6f1('0x31')](_0x35037c[_0xe6f1('0x2e')]['fields']));_0xff7a96[_0xe6f1('0x30')]=_0xff7a96[_0xe6f1('0x30')]['length']?_0xff7a96['attributes']:_0x5219b3[_0xe6f1('0x2d')];_0xff7a96['order']=qs[_0xe6f1('0x33')](_0x35037c[_0xe6f1('0x2e')][_0xe6f1('0x33')]);_0xff7a96['where']=qs[_0xe6f1('0x35')](_[_0xe6f1('0x36')](_0x35037c[_0xe6f1('0x2e')],_0x5219b3['filters']));if(_0x35037c[_0xe6f1('0x2e')][_0xe6f1('0x37')]){_0xff7a96['where']=_[_0xe6f1('0x38')](_0xff7a96[_0xe6f1('0x34')],{'$or':_['map'](_0xff7a96['attributes'],function(_0xdd2c34){var _0x31a68a={};_0x31a68a[_0xdd2c34]={'$like':'%'+_0x35037c['query'][_0xe6f1('0x37')]+'%'};return _0x31a68a;})});}_0xff7a96=_[_0xe6f1('0x38')]({},_0xff7a96,_0x35037c[_0xe6f1('0x3a')]);return _0x573dc2[_0xe6f1('0x49')](_0xff7a96);}})['then'](function(_0x15f2ac){if(_0x15f2ac){_0x4672c6=_0x15f2ac['length'];if(!_0x35037c[_0xe6f1('0x2e')]['hasOwnProperty'](_0xe6f1('0x32'))){_0xff7a96[_0xe6f1('0x1c')]=qs[_0xe6f1('0x1c')](_0x35037c[_0xe6f1('0x2e')][_0xe6f1('0x1c')]);_0xff7a96[_0xe6f1('0x1a')]=qs['offset'](_0x35037c[_0xe6f1('0x2e')][_0xe6f1('0x1a')]);}return _0x573dc2[_0xe6f1('0x49')](_0xff7a96);}})['then'](function(_0x4be761){if(_0x4be761){return _0x4be761?{'count':_0x4672c6,'rows':_0x4be761}:null;}})[_0xe6f1('0x23')](respondWithResult(_0x4414a7,null))['catch'](handleError(_0x4414a7,null));};exports[_0xe6f1('0x4b')]=function(_0x15aadf,_0x2ba4f9,_0x216b69){var _0x5825ef={};var _0x26a112={};var _0x52cd41;var _0x5a1277;return db[_0xe6f1('0x2a')][_0xe6f1('0x4a')]({'where':{'id':_0x15aadf[_0xe6f1('0x40')]['id']}})[_0xe6f1('0x23')](handleEntityNotFound(_0x2ba4f9,null))[_0xe6f1('0x23')](function(_0x18c25f){if(_0x18c25f){_0x52cd41=_0x18c25f;_0x26a112[_0xe6f1('0x2d')]=_[_0xe6f1('0x41')](db['VtigerField'][_0xe6f1('0x42')]);_0x26a112['query']=_[_0xe6f1('0x41')](_0x15aadf['query']);_0x26a112[_0xe6f1('0x35')]=_[_0xe6f1('0x2f')](_0x26a112['model'],_0x26a112[_0xe6f1('0x2e')]);_0x5825ef[_0xe6f1('0x30')]=_[_0xe6f1('0x2f')](_0x26a112[_0xe6f1('0x2d')],qs[_0xe6f1('0x31')](_0x15aadf[_0xe6f1('0x2e')][_0xe6f1('0x31')]));_0x5825ef[_0xe6f1('0x30')]=_0x5825ef[_0xe6f1('0x30')][_0xe6f1('0x43')]?_0x5825ef[_0xe6f1('0x30')]:_0x26a112[_0xe6f1('0x2d')];_0x5825ef[_0xe6f1('0x48')]=qs[_0xe6f1('0x33')](_0x15aadf['query'][_0xe6f1('0x33')]);_0x5825ef[_0xe6f1('0x34')]=qs[_0xe6f1('0x35')](_[_0xe6f1('0x36')](_0x15aadf[_0xe6f1('0x2e')],_0x26a112['filters']));if(_0x15aadf[_0xe6f1('0x2e')][_0xe6f1('0x37')]){_0x5825ef[_0xe6f1('0x34')]=_[_0xe6f1('0x38')](_0x5825ef['where'],{'$or':_['map'](_0x5825ef['attributes'],function(_0x1afe78){var _0x3e6d01={};_0x3e6d01[_0x1afe78]={'$like':'%'+_0x15aadf[_0xe6f1('0x2e')]['filter']+'%'};return _0x3e6d01;})});}_0x5825ef=_['merge']({},_0x5825ef,_0x15aadf[_0xe6f1('0x3a')]);return _0x52cd41[_0xe6f1('0x4b')](_0x5825ef);}})[_0xe6f1('0x23')](function(_0x541167){if(_0x541167){_0x5a1277=_0x541167[_0xe6f1('0x43')];if(!_0x15aadf[_0xe6f1('0x2e')][_0xe6f1('0x4c')]('nolimit')){_0x5825ef[_0xe6f1('0x1c')]=qs['limit'](_0x15aadf['query'][_0xe6f1('0x1c')]);_0x5825ef['offset']=qs['offset'](_0x15aadf['query'][_0xe6f1('0x1a')]);}return _0x52cd41[_0xe6f1('0x4b')](_0x5825ef);}})['then'](function(_0x544175){if(_0x544175){return _0x544175?{'count':_0x5a1277,'rows':_0x544175}:null;}})[_0xe6f1('0x23')](respondWithResult(_0x2ba4f9,null))[_0xe6f1('0x3e')](handleError(_0x2ba4f9,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 2acb984..dc830a3 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 _0xd849=['path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','moment','bluebird','request-promise'];(function(_0x450d48,_0x381552){var _0x419404=function(_0x5caf85){while(--_0x5caf85){_0x450d48['push'](_0x450d48['shift']());}};_0x419404(++_0x381552);}(_0xd849,0x157));var _0x9d84=function(_0x120830,_0x4d996a){_0x120830=_0x120830-0x0;var _0x4d4a32=_0xd849[_0x120830];return _0x4d4a32;};'use strict';var _=require(_0x9d84('0x0'));var util=require(_0x9d84('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9d84('0x2'));var BPromise=require(_0x9d84('0x3'));var rp=require(_0x9d84('0x4'));var fs=require('fs');var path=require(_0x9d84('0x5'));var rimraf=require('rimraf');var config=require(_0x9d84('0x6'));var attributes=require(_0x9d84('0x7'));module[_0x9d84('0x8')]=function(_0x2d20db,_0x176ce2){return _0x2d20db[_0x9d84('0x9')](_0x9d84('0xa'),attributes,{'tableName':_0x9d84('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x057f=['bluebird','path','rimraf','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x057f,0x146));var _0xf057=function(_0x5db890,_0x45ec21){_0x5db890=_0x5db890-0x0;var _0x2ca8ee=_0x057f[_0x5db890];return _0x2ca8ee;};'use strict';var _=require('lodash');var util=require(_0xf057('0x0'));var logger=require(_0xf057('0x1'))(_0xf057('0x2'));var moment=require(_0xf057('0x3'));var BPromise=require(_0xf057('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf057('0x5'));var rimraf=require(_0xf057('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x1a9044,_0x27302d){return _0x1a9044[_0xf057('0x7')](_0xf057('0x8'),attributes,{'tableName':_0xf057('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index f9f1ed4..d494721 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 _0x6140=['jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xfb736e,_0x35e328){var _0x5df606=function(_0x246831){while(--_0x246831){_0xfb736e['push'](_0xfb736e['shift']());}};_0x5df606(++_0x35e328);}(_0x6140,0x6e));var _0x0614=function(_0x16c8a3,_0x211c55){_0x16c8a3=_0x16c8a3-0x0;var _0x500f71=_0x6140[_0x16c8a3];return _0x500f71;};'use strict';var _=require(_0x0614('0x0'));var util=require('util');var moment=require(_0x0614('0x1'));var BPromise=require(_0x0614('0x2'));var rs=require(_0x0614('0x3'));var fs=require('fs');var Redis=require(_0x0614('0x4'));var db=require(_0x0614('0x5'))['db'];var utils=require(_0x0614('0x6'));var logger=require(_0x0614('0x7'))(_0x0614('0x8'));var config=require(_0x0614('0x9'));var jayson=require(_0x0614('0xa'));var client=jayson[_0x0614('0xb')][_0x0614('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b64dd,_0xc5b583,_0x1bcade){return new BPromise(function(_0x2a9113,_0x14f3ab){return client[_0x0614('0xd')](_0x3b64dd,_0x1bcade)['then'](function(_0x3ab6e6){logger[_0x0614('0xe')](_0x0614('0xf'),_0xc5b583,_0x0614('0x10'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xc5b583,_0x0614('0x10'),JSON['stringify'](_0x3ab6e6));if(_0x3ab6e6[_0x0614('0x11')]){if(_0x3ab6e6['error']['code']===0x1f4){logger[_0x0614('0x11')](_0x0614('0xf'),_0xc5b583,_0x3ab6e6[_0x0614('0x11')][_0x0614('0x12')]);return _0x14f3ab(_0x3ab6e6['error'][_0x0614('0x12')]);}logger[_0x0614('0x11')](_0x0614('0xf'),_0xc5b583,_0x3ab6e6['error'][_0x0614('0x12')]);return _0x2a9113(_0x3ab6e6[_0x0614('0x11')][_0x0614('0x12')]);}else{logger['info'](_0x0614('0xf'),_0xc5b583,_0x0614('0x10'));_0x2a9113(_0x3ab6e6[_0x0614('0x13')][_0x0614('0x12')]);}})['catch'](function(_0x67a333){logger[_0x0614('0x11')](_0x0614('0xf'),_0xc5b583,_0x67a333);_0x14f3ab(_0x67a333);});});} \ No newline at end of file +var _0x87a2=['VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info'];(function(_0xf130d,_0x3bc2c9){var _0x58c72c=function(_0x3cfa9){while(--_0x3cfa9){_0xf130d['push'](_0xf130d['shift']());}};_0x58c72c(++_0x3bc2c9);}(_0x87a2,0x1ab));var _0x287a=function(_0x2ac5f8,_0x4c3a9f){_0x2ac5f8=_0x2ac5f8-0x0;var _0x3b8229=_0x87a2[_0x2ac5f8];return _0x3b8229;};'use strict';var _=require('lodash');var util=require(_0x287a('0x0'));var moment=require(_0x287a('0x1'));var BPromise=require('bluebird');var rs=require(_0x287a('0x2'));var fs=require('fs');var Redis=require(_0x287a('0x3'));var db=require(_0x287a('0x4'))['db'];var utils=require(_0x287a('0x5'));var logger=require(_0x287a('0x6'))(_0x287a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x287a('0x8')][_0x287a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13f0d7,_0x18b80a,_0x4c450a){return new BPromise(function(_0x5ec8bc,_0x498824){return client[_0x287a('0xa')](_0x13f0d7,_0x4c450a)[_0x287a('0xb')](function(_0x1f1c6f){logger[_0x287a('0xc')](_0x287a('0xd'),_0x18b80a,_0x287a('0xe'));logger['debug'](_0x287a('0xf'),_0x18b80a,_0x287a('0xe'),JSON['stringify'](_0x1f1c6f));if(_0x1f1c6f[_0x287a('0x10')]){if(_0x1f1c6f['error'][_0x287a('0x11')]===0x1f4){logger[_0x287a('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x18b80a,_0x1f1c6f[_0x287a('0x10')][_0x287a('0x12')]);return _0x498824(_0x1f1c6f[_0x287a('0x10')]['message']);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x18b80a,_0x1f1c6f[_0x287a('0x10')]['message']);return _0x5ec8bc(_0x1f1c6f[_0x287a('0x10')]['message']);}else{logger[_0x287a('0xc')](_0x287a('0xd'),_0x18b80a,'request\x20sent');_0x5ec8bc(_0x1f1c6f['result']['message']);}})[_0x287a('0x13')](function(_0x3a65f2){logger[_0x287a('0x10')](_0x287a('0xd'),_0x18b80a,_0x3a65f2);_0x498824(_0x3a65f2);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index a9d1017..dca7769 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 _0x8a8a=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','isAuthenticated','get','/:id','show','create','put','update','destroy','exports'];(function(_0x47f1f3,_0x150f55){var _0x50d8e7=function(_0x15d671){while(--_0x15d671){_0x47f1f3['push'](_0x47f1f3['shift']());}};_0x50d8e7(++_0x150f55);}(_0x8a8a,0x18c));var _0xa8a8=function(_0x4e803d,_0x3dc487){_0x4e803d=_0x4e803d-0x0;var _0x5c6ae8=_0x8a8a[_0x4e803d];return _0x5c6ae8;};'use strict';var multer=require(_0xa8a8('0x0'));var util=require(_0xa8a8('0x1'));var path=require('path');var timeout=require(_0xa8a8('0x2'));var express=require(_0xa8a8('0x3'));var router=express[_0xa8a8('0x4')]();var fs_extra=require(_0xa8a8('0x5'));var auth=require(_0xa8a8('0x6'));var interaction=require(_0xa8a8('0x7'));var config=require('../../config/environment');var controller=require(_0xa8a8('0x8'));router['get']('/',auth[_0xa8a8('0x9')](),controller['index']);router[_0xa8a8('0xa')](_0xa8a8('0xb'),auth[_0xa8a8('0x9')](),controller[_0xa8a8('0xc')]);router['post']('/',auth[_0xa8a8('0x9')](),controller[_0xa8a8('0xd')]);router[_0xa8a8('0xe')](_0xa8a8('0xb'),auth['isAuthenticated'](),controller[_0xa8a8('0xf')]);router['delete'](_0xa8a8('0xb'),auth[_0xa8a8('0x9')](),controller[_0xa8a8('0x10')]);module[_0xa8a8('0x11')]=router; \ No newline at end of file +var _0x5253=['/:id','show','create','put','delete','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated'];(function(_0x426f54,_0x58d9f4){var _0x227708=function(_0xe71224){while(--_0xe71224){_0x426f54['push'](_0x426f54['shift']());}};_0x227708(++_0x58d9f4);}(_0x5253,0x1a7));var _0x3525=function(_0x471301,_0xe26f32){_0x471301=_0x471301-0x0;var _0x51c6d7=_0x5253[_0x471301];return _0x51c6d7;};'use strict';var multer=require(_0x3525('0x0'));var util=require(_0x3525('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3525('0x2')]();var fs_extra=require(_0x3525('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3525('0x4'));var config=require(_0x3525('0x5'));var controller=require(_0x3525('0x6'));router[_0x3525('0x7')]('/',auth[_0x3525('0x8')](),controller['index']);router[_0x3525('0x7')](_0x3525('0x9'),auth[_0x3525('0x8')](),controller[_0x3525('0xa')]);router['post']('/',auth[_0x3525('0x8')](),controller[_0x3525('0xb')]);router[_0x3525('0xc')](_0x3525('0x9'),auth[_0x3525('0x8')](),controller['update']);router[_0x3525('0xd')](_0x3525('0x9'),auth['isAuthenticated'](),controller[_0x3525('0xe')]);module[_0x3525('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index beea6a9..2da86ff 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 _0x66c2=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x1fc9ad,_0x54b320){var _0x351fd4=function(_0x2843a0){while(--_0x2843a0){_0x1fc9ad['push'](_0x1fc9ad['shift']());}};_0x351fd4(++_0x54b320);}(_0x66c2,0xd0));var _0x266c=function(_0x4c6346,_0x14b39b){_0x4c6346=_0x4c6346-0x0;var _0x1414a9=_0x66c2[_0x4c6346];return _0x1414a9;};'use strict';var Sequelize=require(_0x266c('0x0'));module[_0x266c('0x1')]={'type':{'type':Sequelize[_0x266c('0x2')](_0x266c('0x3'),_0x266c('0x4'),_0x266c('0x5'),_0x266c('0x6'),_0x266c('0x7')),'defaultValue':_0x266c('0x3')},'content':{'type':Sequelize[_0x266c('0x8')]},'key':{'type':Sequelize[_0x266c('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x266c('0x3'),'variable',_0x266c('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x266c('0x8')]},'nameField':{'type':Sequelize[_0x266c('0x8')]},'customField':{'type':Sequelize[_0x266c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb640=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x182394,_0xc13ead){var _0x23a459=function(_0x332ac7){while(--_0x332ac7){_0x182394['push'](_0x182394['shift']());}};_0x23a459(++_0xc13ead);}(_0xb640,0x14d));var _0x0b64=function(_0xd4af6d,_0x658f81){_0xd4af6d=_0xd4af6d-0x0;var _0x3a50e9=_0xb640[_0xd4af6d];return _0x3a50e9;};'use strict';var Sequelize=require(_0x0b64('0x0'));module[_0x0b64('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0b64('0x2'),_0x0b64('0x3'),_0x0b64('0x4'),_0x0b64('0x5'),_0x0b64('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0b64('0x7')]},'keyType':{'type':Sequelize[_0x0b64('0x8')](_0x0b64('0x2'),_0x0b64('0x3'),_0x0b64('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0b64('0x7')]},'nameField':{'type':Sequelize[_0x0b64('0x7')]},'customField':{'type':Sequelize[_0x0b64('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0b64('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index c32eea6..c0e4b96 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 _0xa633=['create','update','body','find','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','VtigerField','include','findAll','catch','show','params','rawAttributes','includeAll','options'];(function(_0x514568,_0xe8c1b0){var _0x2aa28d=function(_0xdb6985){while(--_0xdb6985){_0x514568['push'](_0x514568['shift']());}};_0x2aa28d(++_0xe8c1b0);}(_0xa633,0x171));var _0x3a63=function(_0x47e14c,_0x1f5fc6){_0x47e14c=_0x47e14c-0x0;var _0x2c295d=_0xa633[_0x47e14c];return _0x2c295d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3a63('0x0'));var jsonpatch=require(_0x3a63('0x1'));var rp=require(_0x3a63('0x2'));var moment=require(_0x3a63('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3a63('0x4'));var util=require(_0x3a63('0x5'));var path=require(_0x3a63('0x6'));var sox=require(_0x3a63('0x7'));var csv=require('to-csv');var ejs=require(_0x3a63('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3a63('0x9'));var crypto=require(_0x3a63('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3a63('0xb'));var querystring=require('querystring');var Papa=require(_0x3a63('0xc'));var Redis=require(_0x3a63('0xd'));var authService=require(_0x3a63('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3a63('0xf'));var hardwareService=require(_0x3a63('0x10'));var logger=require(_0x3a63('0x11'))(_0x3a63('0x12'));var utils=require(_0x3a63('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3a63('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb2c1cc,_0x2339e7){_0x2339e7=_0x2339e7||0xcc;return function(_0x4987dc){if(_0x4987dc){return _0xb2c1cc[_0x3a63('0x15')](_0x2339e7);}return _0xb2c1cc['status'](_0x2339e7)[_0x3a63('0x16')]();};}function respondWithResult(_0xd8413f,_0x4590a1){_0x4590a1=_0x4590a1||0xc8;return function(_0x619f24){if(_0x619f24){return _0xd8413f[_0x3a63('0x17')](_0x4590a1)[_0x3a63('0x18')](_0x619f24);}};}function respondWithFilteredResult(_0x2e159c,_0x26747a){return function(_0x26bfc2){if(_0x26bfc2){var _0x31b69b=typeof _0x26747a[_0x3a63('0x19')]===_0x3a63('0x1a')&&typeof _0x26747a[_0x3a63('0x1b')]===_0x3a63('0x1a');var _0x20d592=_0x26bfc2[_0x3a63('0x1c')];var _0xd8d4b5=_0x31b69b?0x0:_0x26747a[_0x3a63('0x19')];var _0x517c70=_0x31b69b?_0x26bfc2[_0x3a63('0x1c')]:_0x26747a['offset']+_0x26747a[_0x3a63('0x1b')];var _0x2b11e0;if(_0x517c70>=_0x20d592){_0x517c70=_0x20d592;_0x2b11e0=0xc8;}else{_0x2b11e0=0xce;}_0x2e159c[_0x3a63('0x17')](_0x2b11e0);return _0x2e159c[_0x3a63('0x1d')](_0x3a63('0x1e'),_0xd8d4b5+'-'+_0x517c70+'/'+_0x20d592)['json'](_0x26bfc2);}return null;};}function patchUpdates(_0x2fb1f0){return function(_0x2e3200){try{jsonpatch[_0x3a63('0x1f')](_0x2e3200,_0x2fb1f0,!![]);}catch(_0x2ca201){return BPromise['reject'](_0x2ca201);}return _0x2e3200[_0x3a63('0x20')]();};}function saveUpdates(_0xe5571a,_0x1ee6e1){return function(_0x3dc207){if(_0x3dc207){return _0x3dc207['update'](_0xe5571a)[_0x3a63('0x21')](function(_0x56f82d){return _0x56f82d;});}return null;};}function removeEntity(_0x4edec0,_0x44392e){return function(_0x220ab7){if(_0x220ab7){return _0x220ab7[_0x3a63('0x22')]()[_0x3a63('0x21')](function(){_0x4edec0[_0x3a63('0x17')](0xcc)[_0x3a63('0x16')]();});}};}function handleEntityNotFound(_0x5c1d7b,_0x1a418f){return function(_0x3453ff){if(!_0x3453ff){_0x5c1d7b[_0x3a63('0x15')](0x194);}return _0x3453ff;};}function handleError(_0x42c981,_0x2624e7){_0x2624e7=_0x2624e7||0x1f4;return function(_0x2bc8fd){logger['error'](_0x2bc8fd[_0x3a63('0x23')]);if(_0x2bc8fd[_0x3a63('0x24')]){delete _0x2bc8fd[_0x3a63('0x24')];}_0x42c981[_0x3a63('0x17')](_0x2624e7)[_0x3a63('0x25')](_0x2bc8fd);};}exports[_0x3a63('0x26')]=function(_0x32833b,_0x5e8cd1){var _0x38fe94={},_0x14dacc={},_0x3d4e07={'count':0x0,'rows':[]};var _0x397a1d=_[_0x3a63('0x27')](db['VtigerField']['rawAttributes'],function(_0x565017){return{'name':_0x565017[_0x3a63('0x28')],'type':_0x565017[_0x3a63('0x29')][_0x3a63('0x2a')]};});_0x14dacc[_0x3a63('0x2b')]=_['map'](_0x397a1d,_0x3a63('0x24'));_0x14dacc['query']=_[_0x3a63('0x2c')](_0x32833b[_0x3a63('0x2d')]);_0x14dacc[_0x3a63('0x2e')]=_[_0x3a63('0x2f')](_0x14dacc[_0x3a63('0x2b')],_0x14dacc[_0x3a63('0x2d')]);_0x38fe94[_0x3a63('0x30')]=_[_0x3a63('0x2f')](_0x14dacc[_0x3a63('0x2b')],qs['fields'](_0x32833b[_0x3a63('0x2d')][_0x3a63('0x31')]));_0x38fe94['attributes']=_0x38fe94[_0x3a63('0x30')][_0x3a63('0x32')]?_0x38fe94[_0x3a63('0x30')]:_0x14dacc[_0x3a63('0x2b')];if(!_0x32833b['query'][_0x3a63('0x33')](_0x3a63('0x34'))){_0x38fe94['limit']=qs[_0x3a63('0x1b')](_0x32833b['query'][_0x3a63('0x1b')]);_0x38fe94[_0x3a63('0x19')]=qs['offset'](_0x32833b[_0x3a63('0x2d')][_0x3a63('0x19')]);}_0x38fe94[_0x3a63('0x35')]=qs['sort'](_0x32833b['query'][_0x3a63('0x36')]);_0x38fe94['where']=qs['filters'](_[_0x3a63('0x37')](_0x32833b[_0x3a63('0x2d')],_0x14dacc['filters']),_0x397a1d);if(_0x32833b['query']['filter']){_0x38fe94[_0x3a63('0x38')]=_[_0x3a63('0x39')](_0x38fe94['where'],{'$or':_[_0x3a63('0x27')](_0x397a1d,function(_0x176bf9){if(_0x176bf9[_0x3a63('0x29')]!==_0x3a63('0x3a')){var _0x525696={};_0x525696[_0x176bf9[_0x3a63('0x24')]]={'$like':'%'+_0x32833b[_0x3a63('0x2d')][_0x3a63('0x3b')]+'%'};return _0x525696;}})});}_0x38fe94=_[_0x3a63('0x39')]({},_0x38fe94,_0x32833b['options']);var _0x33c479={'where':_0x38fe94['where']};return db[_0x3a63('0x3c')][_0x3a63('0x1c')](_0x33c479)['then'](function(_0x478953){_0x3d4e07[_0x3a63('0x1c')]=_0x478953;if(_0x32833b[_0x3a63('0x2d')]['includeAll']){_0x38fe94[_0x3a63('0x3d')]=[{'all':!![]}];}return db[_0x3a63('0x3c')][_0x3a63('0x3e')](_0x38fe94);})[_0x3a63('0x21')](function(_0x344fee){_0x3d4e07['rows']=_0x344fee;return _0x3d4e07;})['then'](respondWithFilteredResult(_0x5e8cd1,_0x38fe94))[_0x3a63('0x3f')](handleError(_0x5e8cd1,null));};exports[_0x3a63('0x40')]=function(_0x133bd9,_0x30e2aa){var _0x1dce3e={'raw':!![],'where':{'id':_0x133bd9[_0x3a63('0x41')]['id']}},_0x2e99cd={};_0x2e99cd[_0x3a63('0x2b')]=_[_0x3a63('0x2c')](db['VtigerField'][_0x3a63('0x42')]);_0x2e99cd[_0x3a63('0x2d')]=_['keys'](_0x133bd9[_0x3a63('0x2d')]);_0x2e99cd[_0x3a63('0x2e')]=_['intersection'](_0x2e99cd[_0x3a63('0x2b')],_0x2e99cd[_0x3a63('0x2d')]);_0x1dce3e[_0x3a63('0x30')]=_[_0x3a63('0x2f')](_0x2e99cd['model'],qs[_0x3a63('0x31')](_0x133bd9[_0x3a63('0x2d')][_0x3a63('0x31')]));_0x1dce3e[_0x3a63('0x30')]=_0x1dce3e[_0x3a63('0x30')][_0x3a63('0x32')]?_0x1dce3e[_0x3a63('0x30')]:_0x2e99cd['model'];if(_0x133bd9[_0x3a63('0x2d')][_0x3a63('0x43')]){_0x1dce3e['include']=[{'all':!![]}];}_0x1dce3e=_[_0x3a63('0x39')]({},_0x1dce3e,_0x133bd9[_0x3a63('0x44')]);return db[_0x3a63('0x3c')]['find'](_0x1dce3e)[_0x3a63('0x21')](handleEntityNotFound(_0x30e2aa,null))['then'](respondWithResult(_0x30e2aa,null))[_0x3a63('0x3f')](handleError(_0x30e2aa,null));};exports[_0x3a63('0x45')]=function(_0x3658fe,_0x11122f){return db[_0x3a63('0x3c')][_0x3a63('0x45')](_0x3658fe['body'],{})[_0x3a63('0x21')](respondWithResult(_0x11122f,0xc9))['catch'](handleError(_0x11122f,null));};exports[_0x3a63('0x46')]=function(_0x5ea6fe,_0x322987){if(_0x5ea6fe[_0x3a63('0x47')]['id']){delete _0x5ea6fe[_0x3a63('0x47')]['id'];}return db[_0x3a63('0x3c')][_0x3a63('0x48')]({'where':{'id':_0x5ea6fe[_0x3a63('0x41')]['id']}})['then'](handleEntityNotFound(_0x322987,null))[_0x3a63('0x21')](saveUpdates(_0x5ea6fe[_0x3a63('0x47')],null))[_0x3a63('0x21')](respondWithResult(_0x322987,null))[_0x3a63('0x3f')](handleError(_0x322987,null));};exports['destroy']=function(_0x51a0a0,_0x3545f2){return db[_0x3a63('0x3c')]['find']({'where':{'id':_0x51a0a0['params']['id']}})['then'](handleEntityNotFound(_0x3545f2,null))[_0x3a63('0x21')](removeEntity(_0x3545f2,null))[_0x3a63('0x3f')](handleError(_0x3545f2,null));}; \ No newline at end of file +var _0xf4f5=['destroy','error','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','VtigerField','find','create','update','body','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','then'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf4f5,0x165));var _0x5f4f=function(_0x182e03,_0x3f6d0c){_0x182e03=_0x182e03-0x0;var _0x38a8b7=_0xf4f5[_0x182e03];return _0x38a8b7;};'use strict';var emlformat=require(_0x5f4f('0x0'));var rimraf=require(_0x5f4f('0x1'));var zipdir=require(_0x5f4f('0x2'));var jsonpatch=require(_0x5f4f('0x3'));var rp=require(_0x5f4f('0x4'));var moment=require(_0x5f4f('0x5'));var BPromise=require(_0x5f4f('0x6'));var Mustache=require(_0x5f4f('0x7'));var util=require(_0x5f4f('0x8'));var path=require(_0x5f4f('0x9'));var sox=require(_0x5f4f('0xa'));var csv=require(_0x5f4f('0xb'));var ejs=require(_0x5f4f('0xc'));var fs=require('fs');var fs_extra=require(_0x5f4f('0xd'));var _=require(_0x5f4f('0xe'));var squel=require(_0x5f4f('0xf'));var crypto=require(_0x5f4f('0x10'));var jsforce=require(_0x5f4f('0x11'));var deskjs=require(_0x5f4f('0x12'));var toCsv=require(_0x5f4f('0xb'));var querystring=require(_0x5f4f('0x13'));var Papa=require(_0x5f4f('0x14'));var Redis=require(_0x5f4f('0x15'));var authService=require(_0x5f4f('0x16'));var qs=require(_0x5f4f('0x17'));var as=require(_0x5f4f('0x18'));var hardwareService=require(_0x5f4f('0x19'));var logger=require(_0x5f4f('0x1a'))(_0x5f4f('0x1b'));var utils=require(_0x5f4f('0x1c'));var config=require(_0x5f4f('0x1d'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f4f('0x1e'))['db'];function respondWithStatusCode(_0x18c582,_0x5637fd){_0x5637fd=_0x5637fd||0xcc;return function(_0x25055b){if(_0x25055b){return _0x18c582[_0x5f4f('0x1f')](_0x5637fd);}return _0x18c582['status'](_0x5637fd)[_0x5f4f('0x20')]();};}function respondWithResult(_0x4a73b7,_0x55c32a){_0x55c32a=_0x55c32a||0xc8;return function(_0x334fc7){if(_0x334fc7){return _0x4a73b7[_0x5f4f('0x21')](_0x55c32a)[_0x5f4f('0x22')](_0x334fc7);}};}function respondWithFilteredResult(_0x26a33a,_0x5477a6){return function(_0x17fb75){if(_0x17fb75){var _0x3a4b60=typeof _0x5477a6[_0x5f4f('0x23')]===_0x5f4f('0x24')&&typeof _0x5477a6[_0x5f4f('0x25')]===_0x5f4f('0x24');var _0x26cb40=_0x17fb75[_0x5f4f('0x26')];var _0x2e312b=_0x3a4b60?0x0:_0x5477a6[_0x5f4f('0x23')];var _0x1fd240=_0x3a4b60?_0x17fb75[_0x5f4f('0x26')]:_0x5477a6['offset']+_0x5477a6[_0x5f4f('0x25')];var _0xf04506;if(_0x1fd240>=_0x26cb40){_0x1fd240=_0x26cb40;_0xf04506=0xc8;}else{_0xf04506=0xce;}_0x26a33a['status'](_0xf04506);return _0x26a33a[_0x5f4f('0x27')](_0x5f4f('0x28'),_0x2e312b+'-'+_0x1fd240+'/'+_0x26cb40)[_0x5f4f('0x22')](_0x17fb75);}return null;};}function patchUpdates(_0x13e58b){return function(_0x38a464){try{jsonpatch['apply'](_0x38a464,_0x13e58b,!![]);}catch(_0x1fb4f7){return BPromise[_0x5f4f('0x29')](_0x1fb4f7);}return _0x38a464['save']();};}function saveUpdates(_0x4d0a57,_0x54821f){return function(_0x39a386){if(_0x39a386){return _0x39a386['update'](_0x4d0a57)[_0x5f4f('0x2a')](function(_0x93a2f1){return _0x93a2f1;});}return null;};}function removeEntity(_0x1bd011,_0xf1f602){return function(_0x7ed73d){if(_0x7ed73d){return _0x7ed73d[_0x5f4f('0x2b')]()[_0x5f4f('0x2a')](function(){_0x1bd011[_0x5f4f('0x21')](0xcc)[_0x5f4f('0x20')]();});}};}function handleEntityNotFound(_0x311f59,_0x4b6f48){return function(_0x4b6f55){if(!_0x4b6f55){_0x311f59[_0x5f4f('0x1f')](0x194);}return _0x4b6f55;};}function handleError(_0x2b55f8,_0x25054d){_0x25054d=_0x25054d||0x1f4;return function(_0x30914b){logger[_0x5f4f('0x2c')](_0x30914b['stack']);if(_0x30914b[_0x5f4f('0x2d')]){delete _0x30914b[_0x5f4f('0x2d')];}_0x2b55f8[_0x5f4f('0x21')](_0x25054d)[_0x5f4f('0x2e')](_0x30914b);};}exports['index']=function(_0x461933,_0x54a56a){var _0x48dd37={},_0x22e15e={},_0x246598={'count':0x0,'rows':[]};var _0x809e97=_['map'](db['VtigerField'][_0x5f4f('0x2f')],function(_0x578d6){return{'name':_0x578d6[_0x5f4f('0x30')],'type':_0x578d6['type'][_0x5f4f('0x31')]};});_0x22e15e[_0x5f4f('0x32')]=_[_0x5f4f('0x33')](_0x809e97,_0x5f4f('0x2d'));_0x22e15e[_0x5f4f('0x34')]=_['keys'](_0x461933[_0x5f4f('0x34')]);_0x22e15e[_0x5f4f('0x35')]=_[_0x5f4f('0x36')](_0x22e15e[_0x5f4f('0x32')],_0x22e15e[_0x5f4f('0x34')]);_0x48dd37[_0x5f4f('0x37')]=_[_0x5f4f('0x36')](_0x22e15e[_0x5f4f('0x32')],qs[_0x5f4f('0x38')](_0x461933['query'][_0x5f4f('0x38')]));_0x48dd37['attributes']=_0x48dd37[_0x5f4f('0x37')][_0x5f4f('0x39')]?_0x48dd37[_0x5f4f('0x37')]:_0x22e15e[_0x5f4f('0x32')];if(!_0x461933['query']['hasOwnProperty'](_0x5f4f('0x3a'))){_0x48dd37[_0x5f4f('0x25')]=qs[_0x5f4f('0x25')](_0x461933['query']['limit']);_0x48dd37['offset']=qs[_0x5f4f('0x23')](_0x461933[_0x5f4f('0x34')][_0x5f4f('0x23')]);}_0x48dd37[_0x5f4f('0x3b')]=qs[_0x5f4f('0x3c')](_0x461933[_0x5f4f('0x34')]['sort']);_0x48dd37[_0x5f4f('0x3d')]=qs[_0x5f4f('0x35')](_[_0x5f4f('0x3e')](_0x461933[_0x5f4f('0x34')],_0x22e15e[_0x5f4f('0x35')]),_0x809e97);if(_0x461933[_0x5f4f('0x34')][_0x5f4f('0x3f')]){_0x48dd37[_0x5f4f('0x3d')]=_[_0x5f4f('0x40')](_0x48dd37[_0x5f4f('0x3d')],{'$or':_[_0x5f4f('0x33')](_0x809e97,function(_0x2b7d26){if(_0x2b7d26[_0x5f4f('0x41')]!==_0x5f4f('0x42')){var _0x2e89c8={};_0x2e89c8[_0x2b7d26[_0x5f4f('0x2d')]]={'$like':'%'+_0x461933['query'][_0x5f4f('0x3f')]+'%'};return _0x2e89c8;}})});}_0x48dd37=_['merge']({},_0x48dd37,_0x461933['options']);var _0x104078={'where':_0x48dd37[_0x5f4f('0x3d')]};return db['VtigerField'][_0x5f4f('0x26')](_0x104078)[_0x5f4f('0x2a')](function(_0x5836c2){_0x246598[_0x5f4f('0x26')]=_0x5836c2;if(_0x461933[_0x5f4f('0x34')][_0x5f4f('0x43')]){_0x48dd37[_0x5f4f('0x44')]=[{'all':!![]}];}return db['VtigerField'][_0x5f4f('0x45')](_0x48dd37);})[_0x5f4f('0x2a')](function(_0x2834d5){_0x246598['rows']=_0x2834d5;return _0x246598;})[_0x5f4f('0x2a')](respondWithFilteredResult(_0x54a56a,_0x48dd37))[_0x5f4f('0x46')](handleError(_0x54a56a,null));};exports[_0x5f4f('0x47')]=function(_0x276a6b,_0x53b8df){var _0x1e9cc4={'raw':!![],'where':{'id':_0x276a6b[_0x5f4f('0x48')]['id']}},_0x4b64c2={};_0x4b64c2[_0x5f4f('0x32')]=_[_0x5f4f('0x49')](db['VtigerField'][_0x5f4f('0x2f')]);_0x4b64c2[_0x5f4f('0x34')]=_[_0x5f4f('0x49')](_0x276a6b[_0x5f4f('0x34')]);_0x4b64c2[_0x5f4f('0x35')]=_[_0x5f4f('0x36')](_0x4b64c2[_0x5f4f('0x32')],_0x4b64c2[_0x5f4f('0x34')]);_0x1e9cc4['attributes']=_[_0x5f4f('0x36')](_0x4b64c2[_0x5f4f('0x32')],qs['fields'](_0x276a6b[_0x5f4f('0x34')][_0x5f4f('0x38')]));_0x1e9cc4[_0x5f4f('0x37')]=_0x1e9cc4[_0x5f4f('0x37')][_0x5f4f('0x39')]?_0x1e9cc4['attributes']:_0x4b64c2[_0x5f4f('0x32')];if(_0x276a6b[_0x5f4f('0x34')][_0x5f4f('0x43')]){_0x1e9cc4['include']=[{'all':!![]}];}_0x1e9cc4=_['merge']({},_0x1e9cc4,_0x276a6b[_0x5f4f('0x4a')]);return db[_0x5f4f('0x4b')][_0x5f4f('0x4c')](_0x1e9cc4)['then'](handleEntityNotFound(_0x53b8df,null))[_0x5f4f('0x2a')](respondWithResult(_0x53b8df,null))[_0x5f4f('0x46')](handleError(_0x53b8df,null));};exports[_0x5f4f('0x4d')]=function(_0x101999,_0x21479b){return db['VtigerField'][_0x5f4f('0x4d')](_0x101999['body'],{})['then'](respondWithResult(_0x21479b,0xc9))[_0x5f4f('0x46')](handleError(_0x21479b,null));};exports[_0x5f4f('0x4e')]=function(_0x2933be,_0x21825f){if(_0x2933be[_0x5f4f('0x4f')]['id']){delete _0x2933be[_0x5f4f('0x4f')]['id'];}return db[_0x5f4f('0x4b')][_0x5f4f('0x4c')]({'where':{'id':_0x2933be[_0x5f4f('0x48')]['id']}})[_0x5f4f('0x2a')](handleEntityNotFound(_0x21825f,null))[_0x5f4f('0x2a')](saveUpdates(_0x2933be[_0x5f4f('0x4f')],null))[_0x5f4f('0x2a')](respondWithResult(_0x21825f,null))[_0x5f4f('0x46')](handleError(_0x21825f,null));};exports['destroy']=function(_0x54ea1f,_0x439dd7){return db[_0x5f4f('0x4b')]['find']({'where':{'id':_0x54ea1f[_0x5f4f('0x48')]['id']}})['then'](handleEntityNotFound(_0x439dd7,null))[_0x5f4f('0x2a')](removeEntity(_0x439dd7,null))['catch'](handleError(_0x439dd7,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 5410fa6..1e32a7f 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 _0x06f0=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','./intVtigerField.attributes','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId'];(function(_0x38430a,_0x123894){var _0x4bef92=function(_0x555081){while(--_0x555081){_0x38430a['push'](_0x38430a['shift']());}};_0x4bef92(++_0x123894);}(_0x06f0,0x8f));var _0x006f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06f0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x006f('0x0'));var util=require(_0x006f('0x1'));var logger=require(_0x006f('0x2'))('api');var moment=require(_0x006f('0x3'));var BPromise=require(_0x006f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x006f('0x5'));var rimraf=require(_0x006f('0x6'));var config=require('../../config/environment');var attributes=require(_0x006f('0x7'));module['exports']=function(_0x3b095d,_0x1e55fc){return _0x3b095d['define'](_0x006f('0x8'),attributes,{'tableName':_0x006f('0x9'),'paranoid':![],'indexes':[{'name':_0x006f('0xa'),'fields':[_0x006f('0xb'),_0x006f('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc429=['rimraf','./intVtigerField.attributes','define','VtigerField','vtiger_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xc429,0x1f1));var _0x9c42=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xc429[_0x556bb1];return _0x45455f;};'use strict';var _=require('lodash');var util=require(_0x9c42('0x0'));var logger=require(_0x9c42('0x1'))(_0x9c42('0x2'));var moment=require(_0x9c42('0x3'));var BPromise=require(_0x9c42('0x4'));var rp=require(_0x9c42('0x5'));var fs=require('fs');var path=require(_0x9c42('0x6'));var rimraf=require(_0x9c42('0x7'));var config=require('../../config/environment');var attributes=require(_0x9c42('0x8'));module['exports']=function(_0x1be8c0,_0x1dc586){return _0x1be8c0[_0x9c42('0x9')](_0x9c42('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x9c42('0xb'),'fields':[_0x9c42('0xc'),_0x9c42('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 6062c0d..db86466 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 _0x6af6=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','message','VtigerField,\x20%s,\x20%s','info','result','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6af6,0x1a3));var _0x66af=function(_0x52cdfb,_0x853ef4){_0x52cdfb=_0x52cdfb-0x0;var _0x5aad59=_0x6af6[_0x52cdfb];return _0x5aad59;};'use strict';var _=require(_0x66af('0x0'));var util=require(_0x66af('0x1'));var moment=require(_0x66af('0x2'));var BPromise=require('bluebird');var rs=require(_0x66af('0x3'));var fs=require('fs');var Redis=require(_0x66af('0x4'));var db=require(_0x66af('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x66af('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x66af('0x7'));var client=jayson[_0x66af('0x8')][_0x66af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ce14e,_0x55ba72,_0xc14e2a){return new BPromise(function(_0x3f1aec,_0x4142fd){return client[_0x66af('0xa')](_0x2ce14e,_0xc14e2a)[_0x66af('0xb')](function(_0x28a58a){logger['info']('VtigerField,\x20%s,\x20%s',_0x55ba72,_0x66af('0xc'));logger[_0x66af('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x55ba72,_0x66af('0xc'),JSON[_0x66af('0xe')](_0x28a58a));if(_0x28a58a[_0x66af('0xf')]){if(_0x28a58a[_0x66af('0xf')][_0x66af('0x10')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x55ba72,_0x28a58a[_0x66af('0xf')][_0x66af('0x11')]);return _0x4142fd(_0x28a58a[_0x66af('0xf')][_0x66af('0x11')]);}logger[_0x66af('0xf')](_0x66af('0x12'),_0x55ba72,_0x28a58a['error'][_0x66af('0x11')]);return _0x3f1aec(_0x28a58a[_0x66af('0xf')][_0x66af('0x11')]);}else{logger[_0x66af('0x13')](_0x66af('0x12'),_0x55ba72,_0x66af('0xc'));_0x3f1aec(_0x28a58a[_0x66af('0x14')][_0x66af('0x11')]);}})['catch'](function(_0x1ab1aa){logger['error']('VtigerField,\x20%s,\x20%s',_0x55ba72,_0x1ab1aa);_0x4142fd(_0x1ab1aa);});});} \ No newline at end of file +var _0x9e01=['http','request','then','info','VtigerField,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x3292b8,_0x481e14){var _0x3c0b1a=function(_0x5a80ef){while(--_0x5a80ef){_0x3292b8['push'](_0x3292b8['shift']());}};_0x3c0b1a(++_0x481e14);}(_0x9e01,0x186));var _0x19e0=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x9e01[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x19e0('0x0'));var moment=require('moment');var BPromise=require(_0x19e0('0x1'));var rs=require(_0x19e0('0x2'));var fs=require('fs');var Redis=require(_0x19e0('0x3'));var db=require(_0x19e0('0x4'))['db'];var utils=require(_0x19e0('0x5'));var logger=require(_0x19e0('0x6'))(_0x19e0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x19e0('0x8')][_0x19e0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e7428,_0x769b02,_0x15c3c3){return new BPromise(function(_0x585eb8,_0x352de9){return client[_0x19e0('0xa')](_0x2e7428,_0x15c3c3)[_0x19e0('0xb')](function(_0xaacef8){logger[_0x19e0('0xc')](_0x19e0('0xd'),_0x769b02,'request\x20sent');logger[_0x19e0('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x769b02,_0x19e0('0xf'),JSON['stringify'](_0xaacef8));if(_0xaacef8[_0x19e0('0x10')]){if(_0xaacef8[_0x19e0('0x10')][_0x19e0('0x11')]===0x1f4){logger['error'](_0x19e0('0xd'),_0x769b02,_0xaacef8[_0x19e0('0x10')][_0x19e0('0x12')]);return _0x352de9(_0xaacef8['error']['message']);}logger[_0x19e0('0x10')]('VtigerField,\x20%s,\x20%s',_0x769b02,_0xaacef8['error'][_0x19e0('0x12')]);return _0x585eb8(_0xaacef8['error'][_0x19e0('0x12')]);}else{logger[_0x19e0('0xc')]('VtigerField,\x20%s,\x20%s',_0x769b02,_0x19e0('0xf'));_0x585eb8(_0xaacef8[_0x19e0('0x13')][_0x19e0('0x12')]);}})[_0x19e0('0x14')](function(_0x495e20){logger[_0x19e0('0x10')](_0x19e0('0xd'),_0x769b02,_0x495e20);_0x352de9(_0x495e20);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 12c8de7..2187436 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 _0x71f1=['multer','util','connect-timeout','express','../../config/environment','./intZendeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','create','post','put','update','destroy','exports'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x71f1,0xea));var _0x171f=function(_0x3ba57e,_0x2e6810){_0x3ba57e=_0x3ba57e-0x0;var _0x5d95cf=_0x71f1[_0x3ba57e];return _0x5d95cf;};'use strict';var multer=require(_0x171f('0x0'));var util=require(_0x171f('0x1'));var path=require('path');var timeout=require(_0x171f('0x2'));var express=require(_0x171f('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(_0x171f('0x4'));var controller=require(_0x171f('0x5'));router[_0x171f('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x171f('0x6')](_0x171f('0x7'),auth[_0x171f('0x8')](),controller[_0x171f('0x9')]);router[_0x171f('0x6')](_0x171f('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x171f('0x6')](_0x171f('0xb'),auth[_0x171f('0x8')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x171f('0xc')]);router[_0x171f('0xd')](_0x171f('0xa'),auth[_0x171f('0x8')](),controller['addConfiguration']);router[_0x171f('0xe')]('/:id',auth[_0x171f('0x8')](),controller[_0x171f('0xf')]);router['delete'](_0x171f('0x7'),auth[_0x171f('0x8')](),controller[_0x171f('0x10')]);module[_0x171f('0x11')]=router; \ No newline at end of file +var _0x9f9c=['Router','fs-extra','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','express'];(function(_0x57b670,_0x20d754){var _0x1b7b8a=function(_0x87c8c7){while(--_0x87c8c7){_0x57b670['push'](_0x57b670['shift']());}};_0x1b7b8a(++_0x20d754);}(_0x9f9c,0x18c));var _0xc9f9=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x9f9c[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0xc9f9('0x0'));var util=require(_0xc9f9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc9f9('0x2'));var router=express[_0xc9f9('0x3')]();var fs_extra=require(_0xc9f9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc9f9('0x5'));var config=require('../../config/environment');var controller=require(_0xc9f9('0x6'));router[_0xc9f9('0x7')]('/',auth[_0xc9f9('0x8')](),controller[_0xc9f9('0x9')]);router[_0xc9f9('0x7')](_0xc9f9('0xa'),auth[_0xc9f9('0x8')](),controller[_0xc9f9('0xb')]);router['get']('/:id/configurations',auth[_0xc9f9('0x8')](),controller[_0xc9f9('0xc')]);router[_0xc9f9('0x7')](_0xc9f9('0xd'),auth['isAuthenticated'](),controller[_0xc9f9('0xe')]);router[_0xc9f9('0xf')]('/',auth[_0xc9f9('0x8')](),controller['create']);router['post']('/:id/configurations',auth[_0xc9f9('0x8')](),controller['addConfiguration']);router[_0xc9f9('0x10')]('/:id',auth[_0xc9f9('0x8')](),controller[_0xc9f9('0x11')]);router[_0xc9f9('0x12')](_0xc9f9('0xa'),auth[_0xc9f9('0x8')](),controller[_0xc9f9('0x13')]);module[_0xc9f9('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index f6f18be..5688cae 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 _0x553a=['exports','STRING','username','password','ENUM','integrationTab'];(function(_0x1f9a7a,_0x2cecf6){var _0x2672ce=function(_0x2d7535){while(--_0x2d7535){_0x1f9a7a['push'](_0x1f9a7a['shift']());}};_0x2672ce(++_0x2cecf6);}(_0x553a,0x192));var _0xa553=function(_0x75aebf,_0xb132d7){_0x75aebf=_0x75aebf-0x0;var _0x148756=_0x553a[_0x75aebf];return _0x148756;};'use strict';var Sequelize=require('sequelize');module[_0xa553('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa553('0x1')]},'username':{'type':Sequelize[_0xa553('0x1')],'unique':_0xa553('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa553('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0xa553('0x3'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xa553('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa553('0x4')](_0xa553('0x5'),'newTab'),'defaultValue':_0xa553('0x5')}}; \ No newline at end of file +var _0xf06c=['password','token','integrationTab','sequelize','exports','STRING','ENUM'];(function(_0x34fce4,_0x10b55b){var _0x3abede=function(_0x483d98){while(--_0x483d98){_0x34fce4['push'](_0x34fce4['shift']());}};_0x3abede(++_0x10b55b);}(_0xf06c,0xc7));var _0xcf06=function(_0x5a9af1,_0x870a9d){_0x5a9af1=_0x5a9af1-0x0;var _0x2cb6c6=_0xf06c[_0x5a9af1];return _0x2cb6c6;};'use strict';var Sequelize=require(_0xcf06('0x0'));module[_0xcf06('0x1')]={'name':{'type':Sequelize[_0xcf06('0x2')]},'description':{'type':Sequelize[_0xcf06('0x2')]},'username':{'type':Sequelize[_0xcf06('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xcf06('0x2')]},'token':{'type':Sequelize[_0xcf06('0x2')]},'remoteUri':{'type':Sequelize[_0xcf06('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xcf06('0x3')](_0xcf06('0x4'),_0xcf06('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xcf06('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xcf06('0x6'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index c38963c..f7d59c0 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 _0xbc9d=['merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','find','create','update','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','getSubjects','channel','ZendeskField','Subjects','Descriptions','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','stack','send','index','ZendeskAccount','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick'];(function(_0x1b9cd5,_0x103dc4){var _0x4c74ca=function(_0x460b5e){while(--_0x460b5e){_0x1b9cd5['push'](_0x1b9cd5['shift']());}};_0x4c74ca(++_0x103dc4);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x497d6d,_0xff7558){_0x497d6d=_0x497d6d-0x0;var _0x4a1d9a=_0xbc9d[_0x497d6d];return _0x4a1d9a;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];var integrations=require(_0xdbc9('0x19'));function respondWithStatusCode(_0x48bc83,_0x567e71){_0x567e71=_0x567e71||0xcc;return function(_0x3d0fdd){if(_0x3d0fdd){return _0x48bc83[_0xdbc9('0x1a')](_0x567e71);}return _0x48bc83[_0xdbc9('0x1b')](_0x567e71)[_0xdbc9('0x1c')]();};}function respondWithResult(_0x53495d,_0x4a9dcb){_0x4a9dcb=_0x4a9dcb||0xc8;return function(_0x2b7bd){if(_0x2b7bd){return _0x53495d[_0xdbc9('0x1b')](_0x4a9dcb)[_0xdbc9('0x1d')](_0x2b7bd);}};}function respondWithFilteredResult(_0x4c7b4f,_0x1b4616){return function(_0x1abee8){if(_0x1abee8){var _0x4fdb81=typeof _0x1b4616[_0xdbc9('0x1e')]===_0xdbc9('0x1f')&&typeof _0x1b4616[_0xdbc9('0x20')]===_0xdbc9('0x1f');var _0x1f22f4=_0x1abee8[_0xdbc9('0x21')];var _0x9f343d=_0x4fdb81?0x0:_0x1b4616[_0xdbc9('0x1e')];var _0x2ad952=_0x4fdb81?_0x1abee8[_0xdbc9('0x21')]:_0x1b4616['offset']+_0x1b4616[_0xdbc9('0x20')];var _0x497be2;if(_0x2ad952>=_0x1f22f4){_0x2ad952=_0x1f22f4;_0x497be2=0xc8;}else{_0x497be2=0xce;}_0x4c7b4f[_0xdbc9('0x1b')](_0x497be2);return _0x4c7b4f[_0xdbc9('0x22')]('Content-Range',_0x9f343d+'-'+_0x2ad952+'/'+_0x1f22f4)[_0xdbc9('0x1d')](_0x1abee8);}return null;};}function patchUpdates(_0x5367dc){return function(_0x569f32){try{jsonpatch['apply'](_0x569f32,_0x5367dc,!![]);}catch(_0x4f3b5d){return BPromise[_0xdbc9('0x23')](_0x4f3b5d);}return _0x569f32[_0xdbc9('0x24')]();};}function saveUpdates(_0x570ad9,_0x16dcf7){return function(_0x20563e){if(_0x20563e){return _0x20563e['update'](_0x570ad9)[_0xdbc9('0x25')](function(_0x6b788){return _0x6b788;});}return null;};}function removeEntity(_0x1b1c0d,_0x119230){return function(_0x3400e7){if(_0x3400e7){return _0x3400e7[_0xdbc9('0x26')]()[_0xdbc9('0x25')](function(){_0x1b1c0d[_0xdbc9('0x1b')](0xcc)[_0xdbc9('0x1c')]();});}};}function handleEntityNotFound(_0x4a868b,_0x550bef){return function(_0xe309ae){if(!_0xe309ae){_0x4a868b[_0xdbc9('0x1a')](0x194);}return _0xe309ae;};}function handleError(_0x1053ca,_0x24fdec){_0x24fdec=_0x24fdec||0x1f4;return function(_0x50c3ee){logger[_0xdbc9('0x27')](_0x50c3ee[_0xdbc9('0x28')]);if(_0x50c3ee['name']){delete _0x50c3ee['name'];}_0x1053ca[_0xdbc9('0x1b')](_0x24fdec)[_0xdbc9('0x29')](_0x50c3ee);};}exports[_0xdbc9('0x2a')]=function(_0x59bfd2,_0x13a432){var _0x539e57={},_0x561f8e={},_0x210a40={'count':0x0,'rows':[]};var _0x49da36=_['map'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')],function(_0x1cb557){return{'name':_0x1cb557['fieldName'],'type':_0x1cb557[_0xdbc9('0x2d')][_0xdbc9('0x2e')]};});_0x561f8e['model']=_['map'](_0x49da36,_0xdbc9('0x2f'));_0x561f8e[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x59bfd2[_0xdbc9('0x30')]);_0x561f8e[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],_0x561f8e['query']);_0x539e57[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],qs[_0xdbc9('0x36')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x539e57['attributes']=_0x539e57[_0xdbc9('0x35')]['length']?_0x539e57['attributes']:_0x561f8e['model'];if(!_0x59bfd2['query']['hasOwnProperty'](_0xdbc9('0x37'))){_0x539e57[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x59bfd2['query'][_0xdbc9('0x20')]);_0x539e57[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x1e')]);}_0x539e57[_0xdbc9('0x38')]=qs['sort'](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x39')]);_0x539e57[_0xdbc9('0x3a')]=qs['filters'](_[_0xdbc9('0x3b')](_0x59bfd2[_0xdbc9('0x30')],_0x561f8e[_0xdbc9('0x32')]),_0x49da36);if(_0x59bfd2[_0xdbc9('0x30')]['filter']){_0x539e57['where']=_[_0xdbc9('0x3c')](_0x539e57[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x49da36,function(_0x1ef970){if(_0x1ef970['type']!==_0xdbc9('0x3e')){var _0x3827be={};_0x3827be[_0x1ef970[_0xdbc9('0x2f')]]={'$like':'%'+_0x59bfd2['query'][_0xdbc9('0x3f')]+'%'};return _0x3827be;}})});}_0x539e57=_[_0xdbc9('0x3c')]({},_0x539e57,_0x59bfd2[_0xdbc9('0x40')]);var _0x523c79={'where':_0x539e57[_0xdbc9('0x3a')]};return db[_0xdbc9('0x2b')]['count'](_0x523c79)['then'](function(_0xfc34d5){_0x210a40[_0xdbc9('0x21')]=_0xfc34d5;if(_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x41')]){_0x539e57['include']=[{'all':!![]}];}return db[_0xdbc9('0x2b')][_0xdbc9('0x42')](_0x539e57);})['then'](function(_0x8445b8){_0x210a40[_0xdbc9('0x43')]=_0x8445b8;return _0x210a40;})['then'](respondWithFilteredResult(_0x13a432,_0x539e57))[_0xdbc9('0x44')](handleError(_0x13a432,null));};exports[_0xdbc9('0x45')]=function(_0x2adb23,_0x3415c3){var _0x3ed4de={'raw':![],'where':{'id':_0x2adb23[_0xdbc9('0x46')]['id']}},_0x1cd538={};_0x1cd538['model']=_['keys'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')]);_0x1cd538[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x2adb23[_0xdbc9('0x30')]);_0x1cd538[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x1cd538[_0xdbc9('0x34')],_0x1cd538[_0xdbc9('0x30')]);_0x3ed4de[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x1cd538['model'],qs['fields'](_0x2adb23[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x3ed4de[_0xdbc9('0x35')]=_0x3ed4de[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x3ed4de[_0xdbc9('0x35')]:_0x1cd538[_0xdbc9('0x34')];if(_0x2adb23[_0xdbc9('0x30')]['includeAll']){_0x3ed4de['include']=[{'all':!![]}];}_0x3ed4de=_[_0xdbc9('0x3c')]({},_0x3ed4de,_0x2adb23[_0xdbc9('0x40')]);return db[_0xdbc9('0x2b')][_0xdbc9('0x48')](_0x3ed4de)[_0xdbc9('0x25')](handleEntityNotFound(_0x3415c3,null))[_0xdbc9('0x25')](respondWithResult(_0x3415c3,null))[_0xdbc9('0x44')](handleError(_0x3415c3,null));};exports[_0xdbc9('0x49')]=function(_0x43e3ec,_0x589557){return db[_0xdbc9('0x2b')][_0xdbc9('0x49')](_0x43e3ec['body'],{})['then'](respondWithResult(_0x589557,0xc9))[_0xdbc9('0x44')](handleError(_0x589557,null));};exports[_0xdbc9('0x4a')]=function(_0x133a13,_0x49a55c){if(_0x133a13[_0xdbc9('0x4b')]['id']){delete _0x133a13[_0xdbc9('0x4b')]['id'];}return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x133a13['params']['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x49a55c,null))[_0xdbc9('0x25')](saveUpdates(_0x133a13[_0xdbc9('0x4b')],null))[_0xdbc9('0x25')](respondWithResult(_0x49a55c,null))['catch'](handleError(_0x49a55c,null));};exports[_0xdbc9('0x26')]=function(_0x36c70e,_0x3f49b7){return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x36c70e[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3f49b7,null))[_0xdbc9('0x25')](removeEntity(_0x3f49b7,null))['catch'](handleError(_0x3f49b7,null));};exports[_0xdbc9('0x4c')]=function(_0x4d09e1,_0x3f493e,_0x4279bc){var _0x53771a={};var _0x561737={};var _0xc7335d;var _0x4b55df;return db[_0xdbc9('0x2b')][_0xdbc9('0x4d')]({'where':{'id':_0x4d09e1[_0xdbc9('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f493e,null))[_0xdbc9('0x25')](function(_0x1c52e6){if(_0x1c52e6){_0xc7335d=_0x1c52e6;_0x561737[_0xdbc9('0x34')]=_[_0xdbc9('0x31')](db[_0xdbc9('0x4e')][_0xdbc9('0x2c')]);_0x561737[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x4d09e1['query']);_0x561737['filters']=_['intersection'](_0x561737[_0xdbc9('0x34')],_0x561737[_0xdbc9('0x30')]);_0x53771a[_0xdbc9('0x35')]=_['intersection'](_0x561737['model'],qs[_0xdbc9('0x36')](_0x4d09e1[_0xdbc9('0x30')]['fields']));_0x53771a['attributes']=_0x53771a[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x53771a[_0xdbc9('0x35')]:_0x561737[_0xdbc9('0x34')];_0x53771a[_0xdbc9('0x38')]=qs[_0xdbc9('0x39')](_0x4d09e1['query'][_0xdbc9('0x39')]);_0x53771a[_0xdbc9('0x3a')]=qs[_0xdbc9('0x32')](_['pick'](_0x4d09e1[_0xdbc9('0x30')],_0x561737[_0xdbc9('0x32')]));if(_0x4d09e1[_0xdbc9('0x30')]['filter']){_0x53771a[_0xdbc9('0x3a')]=_['merge'](_0x53771a[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x53771a[_0xdbc9('0x35')],function(_0x26ed1c){var _0x148061={};_0x148061[_0x26ed1c]={'$like':'%'+_0x4d09e1[_0xdbc9('0x30')]['filter']+'%'};return _0x148061;})});}_0x53771a=_[_0xdbc9('0x3c')]({},_0x53771a,_0x4d09e1['options']);return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})[_0xdbc9('0x25')](function(_0x53fcd6){if(_0x53fcd6){_0x4b55df=_0x53fcd6[_0xdbc9('0x47')];if(!_0x4d09e1[_0xdbc9('0x30')]['hasOwnProperty']('nolimit')){_0x53771a[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x4d09e1[_0xdbc9('0x30')]['limit']);_0x53771a[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x4d09e1['query'][_0xdbc9('0x1e')]);}return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})['then'](function(_0x4876f9){if(_0x4876f9){return _0x4876f9?{'count':_0x4b55df,'rows':_0x4876f9}:null;}})[_0xdbc9('0x25')](respondWithResult(_0x3f493e,null))[_0xdbc9('0x44')](handleError(_0x3f493e,null));};exports[_0xdbc9('0x4f')]=function(_0xa8b4d9,_0x3e93d3,_0x14cbf4){if(_0xa8b4d9[_0xdbc9('0x4b')]['id']){delete _0xa8b4d9[_0xdbc9('0x4b')]['id'];}return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0xa8b4d9[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3e93d3,null))[_0xdbc9('0x25')](function(_0x38f7da){if(_0x38f7da){_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x50')]=_0x38f7da['id'];_0xa8b4d9[_0xdbc9('0x4b')]['Subjects']=integrations[_0xdbc9('0x51')](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9['body'][_0xdbc9('0x2d')]);_0xa8b4d9[_0xdbc9('0x4b')]['Descriptions']=integrations['getDescriptions'](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x2d')]);return db['ZendeskConfiguration'][_0xdbc9('0x49')](_0xa8b4d9[_0xdbc9('0x4b')],{'include':[{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x54')},{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x55')}]});}return null;})[_0xdbc9('0x25')](respondWithResult(_0x3e93d3,null))[_0xdbc9('0x44')](handleError(_0x3e93d3,null));};exports[_0xdbc9('0x56')]=function(_0x5e6522,_0x2787d9,_0x2c3223){var _0x511778='';return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0x5e6522[_0xdbc9('0x46')]['id']},'attributes':['id',_0xdbc9('0x57'),_0xdbc9('0x58'),_0xdbc9('0x59'),_0xdbc9('0x5a'),_0xdbc9('0x5b')]})['then'](handleEntityNotFound(_0x2787d9,null))[_0xdbc9('0x25')](function(_0x19af46){if(_0x19af46){_0x511778=_0x19af46[_0xdbc9('0x5b')];var _0x4a412e=_0x511778[_0xdbc9('0x5c')](-0x1);if(_0x4a412e==='/'){_0x511778=_0x511778[_0xdbc9('0x5d')](0x0,_0x511778[_0xdbc9('0x5e')](_0x4a412e));}var _0x2b4905={'method':_0xdbc9('0x5f'),'uri':util[_0xdbc9('0x60')](_0xdbc9('0x61'),_0x511778,_0xdbc9('0x62')),'json':!![]};switch(_0x19af46[_0xdbc9('0x5a')]){case _0xdbc9('0x58'):_0x2b4905[_0xdbc9('0x63')]={'Authorization':util[_0xdbc9('0x60')]('Basic\x20%s',new Buffer(util['format'](_0xdbc9('0x64'),_0x19af46['username'],_0x19af46['password']))[_0xdbc9('0x65')](_0xdbc9('0x66')))};break;case _0xdbc9('0x59'):_0x2b4905['headers']={'Authorization':util[_0xdbc9('0x60')](_0xdbc9('0x67'),new Buffer(util[_0xdbc9('0x60')]('%s/token:%s',_0x19af46[_0xdbc9('0x57')],_0x19af46[_0xdbc9('0x59')]))['toString'](_0xdbc9('0x66')))};break;default:throw new db[(_0xdbc9('0x68'))][(_0xdbc9('0x69'))](_0xdbc9('0x6a'));}return rp(_0x2b4905);}})[_0xdbc9('0x25')](function(_0x501754){if(_0x501754){var _0x4f984b=[_0xdbc9('0x6b'),_0xdbc9('0x6c'),'group',_0xdbc9('0x6d')];_[_0xdbc9('0x6e')](_0x501754[_0xdbc9('0x62')],function(_0x5802fc){return _0x4f984b[_0xdbc9('0x6f')](_0x5802fc[_0xdbc9('0x2d')]);});return{'count':_0x501754[_0xdbc9('0x62')][_0xdbc9('0x47')],'rows':_[_0xdbc9('0x3d')](_0x501754[_0xdbc9('0x62')],function(_0x1b053a){return{'id':_0x1b053a['id'],'name':_0x1b053a[_0xdbc9('0x70')]>0x7?_0x1b053a['title']:_0x1b053a[_0xdbc9('0x2d')],'custom':_0x1b053a[_0xdbc9('0x70')]>0x7?!![]:![],'options':_0x1b053a[_0xdbc9('0x71')]?_0x1b053a[_0xdbc9('0x71')]:_0x1b053a['custom_field_options']?_0x1b053a[_0xdbc9('0x72')]:[]};})};}})['then'](respondWithResult(_0x2787d9,null))['catch'](function(_0x34ebeb){var _0x3400d0=_0x5e6522['query'][_0xdbc9('0x73')]?0x1f4:_0x34ebeb[_0xdbc9('0x74')]||0x1f4;logger[_0xdbc9('0x27')](_0xdbc9('0x75'),_0xdbc9('0x56'),_0x3400d0,JSON[_0xdbc9('0x76')](_0x34ebeb));delete _0x34ebeb[_0xdbc9('0x2f')];if(_0x3400d0===0x191){_0x3400d0=0x190;}_0x2787d9['status'](_0x3400d0)['send'](_0x5e6522[_0xdbc9('0x30')][_0xdbc9('0x73')]?{'message':_0xdbc9('0x77'),'statusCode':_0x34ebeb['statusCode']}:_0x34ebeb);});}; \ No newline at end of file +var _0x04b8=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','ZendeskAccount','findAll','rows','catch','keys','include','find','create','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x5a80ce,_0x9a5ba3){var _0x50f4df=function(_0x4a9faa){while(--_0x4a9faa){_0x5a80ce['push'](_0x5a80ce['shift']());}};_0x50f4df(++_0x9a5ba3);}(_0x04b8,0x159));var _0x804b=function(_0x5ad9a9,_0x6398d8){_0x5ad9a9=_0x5ad9a9-0x0;var _0x1e7c85=_0x04b8[_0x5ad9a9];return _0x1e7c85;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x804b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x804b('0x1'));var rp=require(_0x804b('0x2'));var moment=require('moment');var BPromise=require(_0x804b('0x3'));var Mustache=require(_0x804b('0x4'));var util=require('util');var path=require(_0x804b('0x5'));var sox=require(_0x804b('0x6'));var csv=require(_0x804b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x804b('0x8'));var _=require(_0x804b('0x9'));var squel=require(_0x804b('0xa'));var crypto=require('crypto');var jsforce=require(_0x804b('0xb'));var deskjs=require(_0x804b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x804b('0xd'));var Papa=require(_0x804b('0xe'));var Redis=require(_0x804b('0xf'));var authService=require(_0x804b('0x10'));var qs=require(_0x804b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x804b('0x12'));var logger=require(_0x804b('0x13'))(_0x804b('0x14'));var utils=require(_0x804b('0x15'));var config=require(_0x804b('0x16'));var licenseUtil=require(_0x804b('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x804b('0x18'));function respondWithStatusCode(_0x5303cc,_0x23ee57){_0x23ee57=_0x23ee57||0xcc;return function(_0x3a2702){if(_0x3a2702){return _0x5303cc[_0x804b('0x19')](_0x23ee57);}return _0x5303cc[_0x804b('0x1a')](_0x23ee57)['end']();};}function respondWithResult(_0x215825,_0x1b01a7){_0x1b01a7=_0x1b01a7||0xc8;return function(_0x274bb8){if(_0x274bb8){return _0x215825[_0x804b('0x1a')](_0x1b01a7)['json'](_0x274bb8);}};}function respondWithFilteredResult(_0x2fd593,_0x8ccbe0){return function(_0x5e1cfe){if(_0x5e1cfe){var _0x3c5986=typeof _0x8ccbe0['offset']===_0x804b('0x1b')&&typeof _0x8ccbe0[_0x804b('0x1c')]===_0x804b('0x1b');var _0x1760f8=_0x5e1cfe[_0x804b('0x1d')];var _0x5a0a82=_0x3c5986?0x0:_0x8ccbe0[_0x804b('0x1e')];var _0x50b4fe=_0x3c5986?_0x5e1cfe[_0x804b('0x1d')]:_0x8ccbe0[_0x804b('0x1e')]+_0x8ccbe0[_0x804b('0x1c')];var _0x469251;if(_0x50b4fe>=_0x1760f8){_0x50b4fe=_0x1760f8;_0x469251=0xc8;}else{_0x469251=0xce;}_0x2fd593['status'](_0x469251);return _0x2fd593[_0x804b('0x1f')](_0x804b('0x20'),_0x5a0a82+'-'+_0x50b4fe+'/'+_0x1760f8)[_0x804b('0x21')](_0x5e1cfe);}return null;};}function patchUpdates(_0x11eaf6){return function(_0x27844b){try{jsonpatch[_0x804b('0x22')](_0x27844b,_0x11eaf6,!![]);}catch(_0x3241a0){return BPromise[_0x804b('0x23')](_0x3241a0);}return _0x27844b[_0x804b('0x24')]();};}function saveUpdates(_0x2b7271,_0x1acc48){return function(_0x5a968b){if(_0x5a968b){return _0x5a968b[_0x804b('0x25')](_0x2b7271)[_0x804b('0x26')](function(_0x5585f8){return _0x5585f8;});}return null;};}function removeEntity(_0x44a921,_0x367024){return function(_0x115b8f){if(_0x115b8f){return _0x115b8f[_0x804b('0x27')]()[_0x804b('0x26')](function(){_0x44a921['status'](0xcc)[_0x804b('0x28')]();});}};}function handleEntityNotFound(_0x7d9c33,_0x4e7266){return function(_0x12b6a6){if(!_0x12b6a6){_0x7d9c33[_0x804b('0x19')](0x194);}return _0x12b6a6;};}function handleError(_0x1117a5,_0x27d5ec){_0x27d5ec=_0x27d5ec||0x1f4;return function(_0x2d88da){logger['error'](_0x2d88da[_0x804b('0x29')]);if(_0x2d88da[_0x804b('0x2a')]){delete _0x2d88da[_0x804b('0x2a')];}_0x1117a5[_0x804b('0x1a')](_0x27d5ec)[_0x804b('0x2b')](_0x2d88da);};}exports['index']=function(_0x3eb531,_0x2931ff){var _0x410871={},_0x5c7026={},_0x3dbd41={'count':0x0,'rows':[]};var _0x407357=_[_0x804b('0x2c')](db['ZendeskAccount'][_0x804b('0x2d')],function(_0x471c04){return{'name':_0x471c04['fieldName'],'type':_0x471c04[_0x804b('0x2e')][_0x804b('0x2f')]};});_0x5c7026[_0x804b('0x30')]=_[_0x804b('0x2c')](_0x407357,_0x804b('0x2a'));_0x5c7026[_0x804b('0x31')]=_['keys'](_0x3eb531[_0x804b('0x31')]);_0x5c7026[_0x804b('0x32')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],_0x5c7026[_0x804b('0x31')]);_0x410871[_0x804b('0x34')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],qs[_0x804b('0x35')](_0x3eb531[_0x804b('0x31')][_0x804b('0x35')]));_0x410871[_0x804b('0x34')]=_0x410871[_0x804b('0x34')][_0x804b('0x36')]?_0x410871[_0x804b('0x34')]:_0x5c7026[_0x804b('0x30')];if(!_0x3eb531[_0x804b('0x31')][_0x804b('0x37')](_0x804b('0x38'))){_0x410871[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3eb531[_0x804b('0x31')][_0x804b('0x1c')]);_0x410871[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3eb531['query']['offset']);}_0x410871['order']=qs[_0x804b('0x39')](_0x3eb531[_0x804b('0x31')][_0x804b('0x39')]);_0x410871['where']=qs['filters'](_['pick'](_0x3eb531[_0x804b('0x31')],_0x5c7026[_0x804b('0x32')]),_0x407357);if(_0x3eb531[_0x804b('0x31')][_0x804b('0x3a')]){_0x410871[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x410871[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x407357,function(_0x27ba88){if(_0x27ba88[_0x804b('0x2e')]!==_0x804b('0x3d')){var _0x22a3fa={};_0x22a3fa[_0x27ba88[_0x804b('0x2a')]]={'$like':'%'+_0x3eb531['query'][_0x804b('0x3a')]+'%'};return _0x22a3fa;}})});}_0x410871=_[_0x804b('0x3c')]({},_0x410871,_0x3eb531[_0x804b('0x3e')]);var _0x3d6d8a={'where':_0x410871[_0x804b('0x3b')]};return db['ZendeskAccount']['count'](_0x3d6d8a)[_0x804b('0x26')](function(_0x2afafd){_0x3dbd41[_0x804b('0x1d')]=_0x2afafd;if(_0x3eb531['query'][_0x804b('0x3f')]){_0x410871['include']=[{'all':!![]}];}return db[_0x804b('0x40')][_0x804b('0x41')](_0x410871);})[_0x804b('0x26')](function(_0x304710){_0x3dbd41[_0x804b('0x42')]=_0x304710;return _0x3dbd41;})[_0x804b('0x26')](respondWithFilteredResult(_0x2931ff,_0x410871))[_0x804b('0x43')](handleError(_0x2931ff,null));};exports['show']=function(_0x17972a,_0x1c0363){var _0x1dcec8={'raw':![],'where':{'id':_0x17972a['params']['id']}},_0x1d25f6={};_0x1d25f6[_0x804b('0x30')]=_[_0x804b('0x44')](db[_0x804b('0x40')][_0x804b('0x2d')]);_0x1d25f6[_0x804b('0x31')]=_[_0x804b('0x44')](_0x17972a[_0x804b('0x31')]);_0x1d25f6[_0x804b('0x32')]=_['intersection'](_0x1d25f6[_0x804b('0x30')],_0x1d25f6['query']);_0x1dcec8['attributes']=_['intersection'](_0x1d25f6[_0x804b('0x30')],qs['fields'](_0x17972a[_0x804b('0x31')][_0x804b('0x35')]));_0x1dcec8[_0x804b('0x34')]=_0x1dcec8[_0x804b('0x34')]['length']?_0x1dcec8[_0x804b('0x34')]:_0x1d25f6[_0x804b('0x30')];if(_0x17972a[_0x804b('0x31')]['includeAll']){_0x1dcec8[_0x804b('0x45')]=[{'all':!![]}];}_0x1dcec8=_[_0x804b('0x3c')]({},_0x1dcec8,_0x17972a[_0x804b('0x3e')]);return db['ZendeskAccount'][_0x804b('0x46')](_0x1dcec8)[_0x804b('0x26')](handleEntityNotFound(_0x1c0363,null))[_0x804b('0x26')](respondWithResult(_0x1c0363,null))[_0x804b('0x43')](handleError(_0x1c0363,null));};exports[_0x804b('0x47')]=function(_0x3a39f5,_0x392bc0){return db[_0x804b('0x40')][_0x804b('0x47')](_0x3a39f5[_0x804b('0x48')],{})[_0x804b('0x26')](respondWithResult(_0x392bc0,0xc9))[_0x804b('0x43')](handleError(_0x392bc0,null));};exports[_0x804b('0x25')]=function(_0x2c1796,_0x578e92){if(_0x2c1796['body']['id']){delete _0x2c1796[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x46')]({'where':{'id':_0x2c1796[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x578e92,null))['then'](saveUpdates(_0x2c1796[_0x804b('0x48')],null))[_0x804b('0x26')](respondWithResult(_0x578e92,null))[_0x804b('0x43')](handleError(_0x578e92,null));};exports[_0x804b('0x27')]=function(_0x47247c,_0x111e3f){return db['ZendeskAccount']['find']({'where':{'id':_0x47247c[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x111e3f,null))['then'](removeEntity(_0x111e3f,null))['catch'](handleError(_0x111e3f,null));};exports[_0x804b('0x4a')]=function(_0x3d56bb,_0x4a5068,_0x4efe2a){var _0x164c5d={};var _0x38c2c0={};var _0x54cc99;var _0x2756de;return db['ZendeskAccount'][_0x804b('0x4b')]({'where':{'id':_0x3d56bb['params']['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4a5068,null))[_0x804b('0x26')](function(_0x47c835){if(_0x47c835){_0x54cc99=_0x47c835;_0x38c2c0[_0x804b('0x30')]=_['keys'](db[_0x804b('0x4c')][_0x804b('0x2d')]);_0x38c2c0[_0x804b('0x31')]=_[_0x804b('0x44')](_0x3d56bb[_0x804b('0x31')]);_0x38c2c0[_0x804b('0x32')]=_[_0x804b('0x33')](_0x38c2c0[_0x804b('0x30')],_0x38c2c0[_0x804b('0x31')]);_0x164c5d[_0x804b('0x34')]=_['intersection'](_0x38c2c0['model'],qs[_0x804b('0x35')](_0x3d56bb['query']['fields']));_0x164c5d[_0x804b('0x34')]=_0x164c5d[_0x804b('0x34')][_0x804b('0x36')]?_0x164c5d[_0x804b('0x34')]:_0x38c2c0['model'];_0x164c5d['order']=qs[_0x804b('0x39')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x39')]);_0x164c5d[_0x804b('0x3b')]=qs[_0x804b('0x32')](_[_0x804b('0x4d')](_0x3d56bb[_0x804b('0x31')],_0x38c2c0[_0x804b('0x32')]));if(_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]){_0x164c5d[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x164c5d[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x164c5d[_0x804b('0x34')],function(_0x3d98a2){var _0x524291={};_0x524291[_0x3d98a2]={'$like':'%'+_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]+'%'};return _0x524291;})});}_0x164c5d=_['merge']({},_0x164c5d,_0x3d56bb[_0x804b('0x3e')]);return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})[_0x804b('0x26')](function(_0x2576a4){if(_0x2576a4){_0x2756de=_0x2576a4['length'];if(!_0x3d56bb[_0x804b('0x31')][_0x804b('0x37')]('nolimit')){_0x164c5d[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3d56bb[_0x804b('0x31')]['limit']);_0x164c5d[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x1e')]);}return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})['then'](function(_0xb08c4e){if(_0xb08c4e){return _0xb08c4e?{'count':_0x2756de,'rows':_0xb08c4e}:null;}})[_0x804b('0x26')](respondWithResult(_0x4a5068,null))[_0x804b('0x43')](handleError(_0x4a5068,null));};exports[_0x804b('0x4e')]=function(_0x5dcc63,_0x4f8a81,_0x183796){if(_0x5dcc63['body']['id']){delete _0x5dcc63[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x4b')]({'where':{'id':_0x5dcc63[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4f8a81,null))['then'](function(_0x27f06c){if(_0x27f06c){_0x5dcc63[_0x804b('0x48')][_0x804b('0x4f')]=_0x27f06c['id'];_0x5dcc63['body'][_0x804b('0x50')]=integrations[_0x804b('0x51')](_0x5dcc63['body'][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);_0x5dcc63[_0x804b('0x48')]['Descriptions']=integrations[_0x804b('0x53')](_0x5dcc63[_0x804b('0x48')][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);return db['ZendeskConfiguration'][_0x804b('0x47')](_0x5dcc63[_0x804b('0x48')],{'include':[{'model':db[_0x804b('0x54')],'as':_0x804b('0x50')},{'model':db['ZendeskField'],'as':_0x804b('0x55')}]});}return null;})[_0x804b('0x26')](respondWithResult(_0x4f8a81,null))[_0x804b('0x43')](handleError(_0x4f8a81,null));};exports[_0x804b('0x56')]=function(_0x17e21c,_0x1bb4ec,_0x5b3b79){var _0x39ed3c='';return db[_0x804b('0x40')]['findOne']({'where':{'id':_0x17e21c[_0x804b('0x49')]['id']},'attributes':['id',_0x804b('0x57'),_0x804b('0x58'),_0x804b('0x59'),'authType',_0x804b('0x5a')]})[_0x804b('0x26')](handleEntityNotFound(_0x1bb4ec,null))['then'](function(_0x2541cd){if(_0x2541cd){_0x39ed3c=_0x2541cd[_0x804b('0x5a')];var _0x549504=_0x39ed3c[_0x804b('0x5b')](-0x1);if(_0x549504==='/'){_0x39ed3c=_0x39ed3c['substring'](0x0,_0x39ed3c[_0x804b('0x5c')](_0x549504));}var _0x3e2813={'method':_0x804b('0x5d'),'uri':util[_0x804b('0x5e')](_0x804b('0x5f'),_0x39ed3c,_0x804b('0x60')),'json':!![]};switch(_0x2541cd[_0x804b('0x61')]){case'password':_0x3e2813[_0x804b('0x62')]={'Authorization':util['format'](_0x804b('0x63'),new Buffer(util[_0x804b('0x5e')](_0x804b('0x64'),_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x58')]))[_0x804b('0x65')](_0x804b('0x66')))};break;case _0x804b('0x59'):_0x3e2813[_0x804b('0x62')]={'Authorization':util[_0x804b('0x5e')](_0x804b('0x63'),new Buffer(util['format']('%s/token:%s',_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x59')]))[_0x804b('0x65')](_0x804b('0x66')))};break;default:throw new db['Sequelize'][(_0x804b('0x67'))](_0x804b('0x68'));}return rp(_0x3e2813);}})[_0x804b('0x26')](function(_0x3dda89){if(_0x3dda89){var _0x260419=[_0x804b('0x69'),_0x804b('0x6a'),_0x804b('0x6b'),_0x804b('0x6c')];_[_0x804b('0x6d')](_0x3dda89['ticket_fields'],function(_0x5a6661){return _0x260419[_0x804b('0x6e')](_0x5a6661[_0x804b('0x2e')]);});return{'count':_0x3dda89['ticket_fields'][_0x804b('0x36')],'rows':_[_0x804b('0x2c')](_0x3dda89['ticket_fields'],function(_0x345bf7){return{'id':_0x345bf7['id'],'name':_0x345bf7['position']>0x7?_0x345bf7['title']:_0x345bf7[_0x804b('0x2e')],'custom':_0x345bf7[_0x804b('0x6f')]>0x7?!![]:![],'options':_0x345bf7['system_field_options']?_0x345bf7['system_field_options']:_0x345bf7[_0x804b('0x70')]?_0x345bf7[_0x804b('0x70')]:[]};})};}})['then'](respondWithResult(_0x1bb4ec,null))[_0x804b('0x43')](function(_0x5e2756){var _0x42dfc3=_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?0x1f4:_0x5e2756['statusCode']||0x1f4;logger[_0x804b('0x72')](_0x804b('0x73'),_0x804b('0x56'),_0x42dfc3,JSON[_0x804b('0x74')](_0x5e2756));delete _0x5e2756[_0x804b('0x2a')];if(_0x42dfc3===0x191){_0x42dfc3=0x190;}_0x1bb4ec[_0x804b('0x1a')](_0x42dfc3)[_0x804b('0x2b')](_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?{'message':_0x804b('0x75'),'statusCode':_0x5e2756['statusCode']}:_0x5e2756);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index d60a97f..f2b5913 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 _0x7fdc=['path','rimraf','./intZendeskAccount.attributes','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment','bluebird'];(function(_0x1569fc,_0x115095){var _0x277783=function(_0x49e9c1){while(--_0x49e9c1){_0x1569fc['push'](_0x1569fc['shift']());}};_0x277783(++_0x115095);}(_0x7fdc,0x1cf));var _0xc7fd=function(_0x37845e,_0x7dde25){_0x37845e=_0x37845e-0x0;var _0x105579=_0x7fdc[_0x37845e];return _0x105579;};'use strict';var _=require(_0xc7fd('0x0'));var util=require(_0xc7fd('0x1'));var logger=require('../../config/logger')(_0xc7fd('0x2'));var moment=require(_0xc7fd('0x3'));var BPromise=require(_0xc7fd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc7fd('0x5'));var rimraf=require(_0xc7fd('0x6'));var config=require('../../config/environment');var attributes=require(_0xc7fd('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xc7fd('0x8')]=function(_0xb23375,_0x1c190d){return _0xb23375[_0xc7fd('0x9')](_0xc7fd('0xa'),attributes,{'tableName':_0xc7fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dc0=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts'];(function(_0x5b0eef,_0xd1a98a){var _0x4ccd97=function(_0x2628bb){while(--_0x2628bb){_0x5b0eef['push'](_0x5b0eef['shift']());}};_0x4ccd97(++_0xd1a98a);}(_0x1dc0,0x1ce));var _0x01dc=function(_0x42c54f,_0x1c371c){_0x42c54f=_0x42c54f-0x0;var _0x6bf835=_0x1dc0[_0x42c54f];return _0x6bf835;};'use strict';var _=require('lodash');var util=require(_0x01dc('0x0'));var logger=require(_0x01dc('0x1'))(_0x01dc('0x2'));var moment=require(_0x01dc('0x3'));var BPromise=require('bluebird');var rp=require(_0x01dc('0x4'));var fs=require('fs');var path=require(_0x01dc('0x5'));var rimraf=require(_0x01dc('0x6'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x01dc('0x7'));module[_0x01dc('0x8')]=function(_0x4f66db,_0x40b175){return _0x4f66db['define'](_0x01dc('0x9'),attributes,{'tableName':_0x01dc('0xa'),'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 c4fd3a4..bc41334 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 _0x9b06=['ZendeskAccount,\x20%s,\x20%s','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','info','ShowZendeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error'];(function(_0x43fc59,_0x4f2c63){var _0x2306e2=function(_0x10ee79){while(--_0x10ee79){_0x43fc59['push'](_0x43fc59['shift']());}};_0x2306e2(++_0x4f2c63);}(_0x9b06,0x193));var _0x69b0=function(_0x20f289,_0x3a355b){_0x20f289=_0x20f289-0x0;var _0x511cd3=_0x9b06[_0x20f289];return _0x511cd3;};'use strict';var _=require(_0x69b0('0x0'));var util=require(_0x69b0('0x1'));var moment=require(_0x69b0('0x2'));var BPromise=require('bluebird');var rs=require(_0x69b0('0x3'));var fs=require('fs');var Redis=require(_0x69b0('0x4'));var db=require(_0x69b0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x69b0('0x6'))(_0x69b0('0x7'));var config=require(_0x69b0('0x8'));var jayson=require(_0x69b0('0x9'));var client=jayson[_0x69b0('0xa')][_0x69b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x551b2e,_0x3f880b,_0x53a5a1){return new BPromise(function(_0x9f0d39,_0x24ba5d){return client[_0x69b0('0xc')](_0x551b2e,_0x53a5a1)['then'](function(_0x4d16f2){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x3f880b,_0x69b0('0xd'));logger[_0x69b0('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x3f880b,_0x69b0('0xd'),JSON[_0x69b0('0xf')](_0x4d16f2));if(_0x4d16f2[_0x69b0('0x10')]){if(_0x4d16f2[_0x69b0('0x10')]['code']===0x1f4){logger[_0x69b0('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x3f880b,_0x4d16f2[_0x69b0('0x10')]['message']);return _0x24ba5d(_0x4d16f2[_0x69b0('0x10')]['message']);}logger[_0x69b0('0x10')](_0x69b0('0x11'),_0x3f880b,_0x4d16f2['error'][_0x69b0('0x12')]);return _0x9f0d39(_0x4d16f2[_0x69b0('0x10')][_0x69b0('0x12')]);}else{logger['info'](_0x69b0('0x11'),_0x3f880b,_0x69b0('0xd'));_0x9f0d39(_0x4d16f2['result']['message']);}})[_0x69b0('0x13')](function(_0x2ede23){logger[_0x69b0('0x10')](_0x69b0('0x11'),_0x3f880b,_0x2ede23);_0x24ba5d(_0x2ede23);});});}exports[_0x69b0('0x14')]=function(_0x506d20){var _0x3eb2c5=this;return new Promise(function(_0x4e1041,_0x4e5998){return db[_0x69b0('0x15')][_0x69b0('0x16')]({'raw':_0x506d20[_0x69b0('0x17')]?_0x506d20[_0x69b0('0x17')][_0x69b0('0x18')]===undefined?!![]:![]:!![],'where':_0x506d20['options']?_0x506d20[_0x69b0('0x17')][_0x69b0('0x19')]||null:null,'attributes':_0x506d20[_0x69b0('0x17')]?_0x506d20['options'][_0x69b0('0x1a')]||null:null,'limit':_0x506d20[_0x69b0('0x17')]?_0x506d20['options'][_0x69b0('0x1b')]||null:null,'include':_0x506d20[_0x69b0('0x17')]?_0x506d20[_0x69b0('0x17')]['include']?_[_0x69b0('0x1c')](_0x506d20[_0x69b0('0x17')][_0x69b0('0x1d')],function(_0x5d167a){return{'model':db[_0x5d167a[_0x69b0('0x1e')]],'as':_0x5d167a['as'],'attributes':_0x5d167a[_0x69b0('0x1a')],'include':_0x5d167a[_0x69b0('0x1d')]?_[_0x69b0('0x1c')](_0x5d167a['include'],function(_0x17a95a){return{'model':db[_0x17a95a['model']],'as':_0x17a95a['as'],'attributes':_0x17a95a[_0x69b0('0x1a')],'include':_0x17a95a[_0x69b0('0x1d')]?_[_0x69b0('0x1c')](_0x17a95a[_0x69b0('0x1d')],function(_0x228cca){return{'model':db[_0x228cca[_0x69b0('0x1e')]],'as':_0x228cca['as'],'attributes':_0x228cca[_0x69b0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x69b0('0x1f')](function(_0x388aa4){logger[_0x69b0('0x20')](_0x69b0('0x14'),_0x506d20);logger[_0x69b0('0xe')]('GetZendeskAccount',_0x506d20,JSON['stringify'](_0x388aa4));_0x4e1041(_0x388aa4);})[_0x69b0('0x13')](function(_0x7303f4){logger[_0x69b0('0x10')](_0x69b0('0x14'),_0x7303f4[_0x69b0('0x12')],_0x506d20);_0x4e5998(_0x3eb2c5['error'](0x1f4,_0x7303f4['message']));});});};exports[_0x69b0('0x21')]=function(_0x4a03f2){var _0x15f31f=this;return new Promise(function(_0x4e6d9f,_0x5ed7e0){return db[_0x69b0('0x15')][_0x69b0('0x22')]({'raw':_0x4a03f2[_0x69b0('0x17')]?_0x4a03f2[_0x69b0('0x17')][_0x69b0('0x18')]===undefined?!![]:![]:!![],'where':_0x4a03f2[_0x69b0('0x17')]?_0x4a03f2[_0x69b0('0x17')]['where']||null:null,'attributes':_0x4a03f2['options']?_0x4a03f2[_0x69b0('0x17')][_0x69b0('0x1a')]||null:null,'include':_0x4a03f2[_0x69b0('0x17')]?_0x4a03f2[_0x69b0('0x17')]['include']?_[_0x69b0('0x1c')](_0x4a03f2[_0x69b0('0x17')][_0x69b0('0x1d')],function(_0x5ab892){return{'model':db[_0x5ab892[_0x69b0('0x1e')]],'as':_0x5ab892['as'],'attributes':_0x5ab892[_0x69b0('0x1a')],'include':_0x5ab892[_0x69b0('0x1d')]?_[_0x69b0('0x1c')](_0x5ab892['include'],function(_0x39c556){return{'model':db[_0x39c556[_0x69b0('0x1e')]],'as':_0x39c556['as'],'attributes':_0x39c556[_0x69b0('0x1a')],'include':_0x39c556[_0x69b0('0x1d')]?_[_0x69b0('0x1c')](_0x39c556[_0x69b0('0x1d')],function(_0x221b77){return{'model':db[_0x221b77[_0x69b0('0x1e')]],'as':_0x221b77['as'],'attributes':_0x221b77[_0x69b0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x69b0('0x1f')](function(_0x6cf43d){logger[_0x69b0('0x20')]('ShowZendeskAccount',_0x4a03f2);logger[_0x69b0('0xe')]('ShowZendeskAccount',_0x4a03f2,JSON['stringify'](_0x6cf43d));_0x4e6d9f(_0x6cf43d);})[_0x69b0('0x13')](function(_0x44166e){logger[_0x69b0('0x10')]('ShowZendeskAccount',_0x44166e[_0x69b0('0x12')],_0x4a03f2);_0x5ed7e0(_0x15f31f['error'](0x1f4,_0x44166e[_0x69b0('0x12')]));});});}; \ No newline at end of file +var _0x6d49=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','include','model','attributes','map','debug','ShowZendeskAccount','find','where'];(function(_0xbf8c84,_0xc878c){var _0x456334=function(_0x3a25af){while(--_0x3a25af){_0xbf8c84['push'](_0xbf8c84['shift']());}};_0x456334(++_0xc878c);}(_0x6d49,0x155));var _0x96d4=function(_0xd9865a,_0x2d6405){_0xd9865a=_0xd9865a-0x0;var _0x252b1f=_0x6d49[_0xd9865a];return _0x252b1f;};'use strict';var _=require(_0x96d4('0x0'));var util=require(_0x96d4('0x1'));var moment=require(_0x96d4('0x2'));var BPromise=require(_0x96d4('0x3'));var rs=require(_0x96d4('0x4'));var fs=require('fs');var Redis=require(_0x96d4('0x5'));var db=require(_0x96d4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x96d4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x96d4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29a361,_0x160038,_0x36883f){return new BPromise(function(_0x47b1be,_0x329a67){return client[_0x96d4('0x9')](_0x29a361,_0x36883f)[_0x96d4('0xa')](function(_0x3c4183){logger['info'](_0x96d4('0xb'),_0x160038,_0x96d4('0xc'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x160038,_0x96d4('0xc'),JSON[_0x96d4('0xd')](_0x3c4183));if(_0x3c4183[_0x96d4('0xe')]){if(_0x3c4183['error']['code']===0x1f4){logger[_0x96d4('0xe')](_0x96d4('0xb'),_0x160038,_0x3c4183[_0x96d4('0xe')][_0x96d4('0xf')]);return _0x329a67(_0x3c4183[_0x96d4('0xe')]['message']);}logger[_0x96d4('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x160038,_0x3c4183['error'][_0x96d4('0xf')]);return _0x47b1be(_0x3c4183[_0x96d4('0xe')]['message']);}else{logger[_0x96d4('0x10')](_0x96d4('0xb'),_0x160038,_0x96d4('0xc'));_0x47b1be(_0x3c4183[_0x96d4('0x11')][_0x96d4('0xf')]);}})[_0x96d4('0x12')](function(_0x80e020){logger[_0x96d4('0xe')](_0x96d4('0xb'),_0x160038,_0x80e020);_0x329a67(_0x80e020);});});}exports[_0x96d4('0x13')]=function(_0x183308){var _0x1d9976=this;return new Promise(function(_0x3bb90a,_0x1d0061){return db[_0x96d4('0x14')]['findAll']({'raw':_0x183308[_0x96d4('0x15')]?_0x183308['options'][_0x96d4('0x16')]===undefined?!![]:![]:!![],'where':_0x183308[_0x96d4('0x15')]?_0x183308[_0x96d4('0x15')]['where']||null:null,'attributes':_0x183308['options']?_0x183308['options']['attributes']||null:null,'limit':_0x183308['options']?_0x183308[_0x96d4('0x15')]['limit']||null:null,'include':_0x183308[_0x96d4('0x15')]?_0x183308[_0x96d4('0x15')][_0x96d4('0x17')]?_['map'](_0x183308[_0x96d4('0x15')][_0x96d4('0x17')],function(_0x48e184){return{'model':db[_0x48e184[_0x96d4('0x18')]],'as':_0x48e184['as'],'attributes':_0x48e184['attributes'],'include':_0x48e184[_0x96d4('0x17')]?_['map'](_0x48e184[_0x96d4('0x17')],function(_0x2ef730){return{'model':db[_0x2ef730[_0x96d4('0x18')]],'as':_0x2ef730['as'],'attributes':_0x2ef730[_0x96d4('0x19')],'include':_0x2ef730[_0x96d4('0x17')]?_[_0x96d4('0x1a')](_0x2ef730[_0x96d4('0x17')],function(_0x154a57){return{'model':db[_0x154a57['model']],'as':_0x154a57['as'],'attributes':_0x154a57[_0x96d4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x96d4('0xa')](function(_0x3012a1){logger['info'](_0x96d4('0x13'),_0x183308);logger[_0x96d4('0x1b')](_0x96d4('0x13'),_0x183308,JSON['stringify'](_0x3012a1));_0x3bb90a(_0x3012a1);})[_0x96d4('0x12')](function(_0x4c9af5){logger[_0x96d4('0xe')](_0x96d4('0x13'),_0x4c9af5[_0x96d4('0xf')],_0x183308);_0x1d0061(_0x1d9976[_0x96d4('0xe')](0x1f4,_0x4c9af5['message']));});});};exports[_0x96d4('0x1c')]=function(_0x52ee0a){var _0x42421f=this;return new Promise(function(_0x156b7a,_0x30fb39){return db[_0x96d4('0x14')][_0x96d4('0x1d')]({'raw':_0x52ee0a[_0x96d4('0x15')]?_0x52ee0a[_0x96d4('0x15')][_0x96d4('0x16')]===undefined?!![]:![]:!![],'where':_0x52ee0a['options']?_0x52ee0a[_0x96d4('0x15')][_0x96d4('0x1e')]||null:null,'attributes':_0x52ee0a[_0x96d4('0x15')]?_0x52ee0a[_0x96d4('0x15')]['attributes']||null:null,'include':_0x52ee0a[_0x96d4('0x15')]?_0x52ee0a['options'][_0x96d4('0x17')]?_[_0x96d4('0x1a')](_0x52ee0a['options'][_0x96d4('0x17')],function(_0x1e94ff){return{'model':db[_0x1e94ff[_0x96d4('0x18')]],'as':_0x1e94ff['as'],'attributes':_0x1e94ff[_0x96d4('0x19')],'include':_0x1e94ff['include']?_[_0x96d4('0x1a')](_0x1e94ff[_0x96d4('0x17')],function(_0x33f572){return{'model':db[_0x33f572[_0x96d4('0x18')]],'as':_0x33f572['as'],'attributes':_0x33f572['attributes'],'include':_0x33f572['include']?_[_0x96d4('0x1a')](_0x33f572[_0x96d4('0x17')],function(_0x2e946c){return{'model':db[_0x2e946c[_0x96d4('0x18')]],'as':_0x2e946c['as'],'attributes':_0x2e946c[_0x96d4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x96d4('0xa')](function(_0xeb6199){logger[_0x96d4('0x10')](_0x96d4('0x1c'),_0x52ee0a);logger[_0x96d4('0x1b')](_0x96d4('0x1c'),_0x52ee0a,JSON[_0x96d4('0xd')](_0xeb6199));_0x156b7a(_0xeb6199);})['catch'](function(_0xdb00e6){logger[_0x96d4('0xe')](_0x96d4('0x1c'),_0xdb00e6[_0x96d4('0xf')],_0x52ee0a);_0x30fb39(_0x42421f['error'](0x1f4,_0xdb00e6['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 7dc254a..2557e50 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 _0x36ee=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','update','delete','destroy','exports','path','express'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x8')](_0xe36e('0x13'),auth[_0xe36e('0x9')](),controller['getTags']);router[_0xe36e('0x14')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x14')]('/:id/tags',auth[_0xe36e('0x9')](),controller['setTags']);router['put'](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x16')]);router[_0xe36e('0x17')](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x18')]);module[_0xe36e('0x19')]=router; \ No newline at end of file +var _0xbaf0=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x5891d6,_0x2c848b){var _0x3a3ac9=function(_0x52a85c){while(--_0x52a85c){_0x5891d6['push'](_0x5891d6['shift']());}};_0x3a3ac9(++_0x2c848b);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'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('0x9')]('/:id/fields',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['post'](_0x0baf('0x15'),auth['isAuthenticated'](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);module[_0x0baf('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index de0f04f..769c247 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 _0xfe01=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe01,0xfe));var _0x1fe0=function(_0x4bdc40,_0x5b9dc9){_0x4bdc40=_0x4bdc40-0x0;var _0x4dbd59=_0xfe01[_0x4bdc40];return _0x4dbd59;};'use strict';var Sequelize=require(_0x1fe0('0x0'));module[_0x1fe0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1fe0('0x2')]}}; \ No newline at end of file +var _0xf63d=['sequelize','STRING'];(function(_0x1e48d3,_0x5d8c43){var _0x2852b1=function(_0x11d7b3){while(--_0x11d7b3){_0x1e48d3['push'](_0x1e48d3['shift']());}};_0x2852b1(++_0x5d8c43);}(_0xf63d,0xb4));var _0xdf63=function(_0x16f775,_0x45b10f){_0x16f775=_0x16f775-0x0;var _0x17d9e2=_0xf63d[_0x16f775];return _0x17d9e2;};'use strict';var Sequelize=require(_0xdf63('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdf63('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 61b578a..94c0130 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 _0xd250=['attributes','fields','nolimit','limit','sort','where','pick','filters','filter','VIRTUAL','merge','options','ZendeskConfiguration','include','findAll','catch','show','length','includeAll','create','body','find','params','getFields','ZendeskField','getSubjects','findOne','order','hasOwnProperty','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','intersection'];(function(_0x1aee5e,_0x8671){var _0x4911d=function(_0x47b25a){while(--_0x47b25a){_0x1aee5e['push'](_0x1aee5e['shift']());}};_0x4911d(++_0x8671);}(_0xd250,0x75));var _0x0d25=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0xd250[_0x301dab];return _0x2500a2;};'use strict';var emlformat=require(_0x0d25('0x0'));var rimraf=require(_0x0d25('0x1'));var zipdir=require(_0x0d25('0x2'));var jsonpatch=require(_0x0d25('0x3'));var rp=require(_0x0d25('0x4'));var moment=require('moment');var BPromise=require(_0x0d25('0x5'));var Mustache=require(_0x0d25('0x6'));var util=require(_0x0d25('0x7'));var path=require(_0x0d25('0x8'));var sox=require(_0x0d25('0x9'));var csv=require(_0x0d25('0xa'));var ejs=require(_0x0d25('0xb'));var fs=require('fs');var fs_extra=require(_0x0d25('0xc'));var _=require(_0x0d25('0xd'));var squel=require(_0x0d25('0xe'));var crypto=require(_0x0d25('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x0d25('0x10'));var toCsv=require(_0x0d25('0xa'));var querystring=require(_0x0d25('0x11'));var Papa=require(_0x0d25('0x12'));var Redis=require(_0x0d25('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0d25('0x14'));var as=require(_0x0d25('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d25('0x16'))(_0x0d25('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0d25('0x18'));var db=require(_0x0d25('0x19'))['db'];function respondWithStatusCode(_0x5b5d89,_0x53418d){_0x53418d=_0x53418d||0xcc;return function(_0x90d693){if(_0x90d693){return _0x5b5d89[_0x0d25('0x1a')](_0x53418d);}return _0x5b5d89[_0x0d25('0x1b')](_0x53418d)[_0x0d25('0x1c')]();};}function respondWithResult(_0x5a8b32,_0x54a84d){_0x54a84d=_0x54a84d||0xc8;return function(_0x57df53){if(_0x57df53){return _0x5a8b32[_0x0d25('0x1b')](_0x54a84d)[_0x0d25('0x1d')](_0x57df53);}};}function respondWithFilteredResult(_0x5b6076,_0x45efbc){return function(_0x3c15d7){if(_0x3c15d7){var _0x3ffd30=typeof _0x45efbc[_0x0d25('0x1e')]===_0x0d25('0x1f')&&typeof _0x45efbc['limit']===_0x0d25('0x1f');var _0x5a826c=_0x3c15d7[_0x0d25('0x20')];var _0x1cb0a9=_0x3ffd30?0x0:_0x45efbc['offset'];var _0x4be88c=_0x3ffd30?_0x3c15d7[_0x0d25('0x20')]:_0x45efbc['offset']+_0x45efbc['limit'];var _0x86f333;if(_0x4be88c>=_0x5a826c){_0x4be88c=_0x5a826c;_0x86f333=0xc8;}else{_0x86f333=0xce;}_0x5b6076[_0x0d25('0x1b')](_0x86f333);return _0x5b6076[_0x0d25('0x21')]('Content-Range',_0x1cb0a9+'-'+_0x4be88c+'/'+_0x5a826c)[_0x0d25('0x1d')](_0x3c15d7);}return null;};}function patchUpdates(_0x442ec5){return function(_0x2cad21){try{jsonpatch[_0x0d25('0x22')](_0x2cad21,_0x442ec5,!![]);}catch(_0x367f0f){return BPromise['reject'](_0x367f0f);}return _0x2cad21[_0x0d25('0x23')]();};}function saveUpdates(_0x51a790,_0x869757){return function(_0x471c29){if(_0x471c29){return _0x471c29[_0x0d25('0x24')](_0x51a790)[_0x0d25('0x25')](function(_0x3e23f0){return _0x3e23f0;});}return null;};}function removeEntity(_0xbba298,_0x338a15){return function(_0x15ba1f){if(_0x15ba1f){return _0x15ba1f[_0x0d25('0x26')]()[_0x0d25('0x25')](function(){_0xbba298[_0x0d25('0x1b')](0xcc)[_0x0d25('0x1c')]();});}};}function handleEntityNotFound(_0x16d4e3,_0x3dd5b9){return function(_0x175048){if(!_0x175048){_0x16d4e3[_0x0d25('0x1a')](0x194);}return _0x175048;};}function handleError(_0x4e5fcf,_0x13f2d4){_0x13f2d4=_0x13f2d4||0x1f4;return function(_0x4430ae){logger[_0x0d25('0x27')](_0x4430ae[_0x0d25('0x28')]);if(_0x4430ae[_0x0d25('0x29')]){delete _0x4430ae['name'];}_0x4e5fcf[_0x0d25('0x1b')](_0x13f2d4)[_0x0d25('0x2a')](_0x4430ae);};}exports['index']=function(_0x5d914a,_0x5345b2){var _0x2bac3d={},_0x512a5c={},_0x7d6ce5={'count':0x0,'rows':[]};var _0x76155f=_[_0x0d25('0x2b')](db['ZendeskConfiguration'][_0x0d25('0x2c')],function(_0x507b90){return{'name':_0x507b90[_0x0d25('0x2d')],'type':_0x507b90[_0x0d25('0x2e')]['key']};});_0x512a5c[_0x0d25('0x2f')]=_[_0x0d25('0x2b')](_0x76155f,'name');_0x512a5c[_0x0d25('0x30')]=_[_0x0d25('0x31')](_0x5d914a[_0x0d25('0x30')]);_0x512a5c['filters']=_[_0x0d25('0x32')](_0x512a5c[_0x0d25('0x2f')],_0x512a5c[_0x0d25('0x30')]);_0x2bac3d[_0x0d25('0x33')]=_['intersection'](_0x512a5c[_0x0d25('0x2f')],qs['fields'](_0x5d914a['query'][_0x0d25('0x34')]));_0x2bac3d[_0x0d25('0x33')]=_0x2bac3d['attributes']['length']?_0x2bac3d['attributes']:_0x512a5c['model'];if(!_0x5d914a[_0x0d25('0x30')]['hasOwnProperty'](_0x0d25('0x35'))){_0x2bac3d[_0x0d25('0x36')]=qs[_0x0d25('0x36')](_0x5d914a[_0x0d25('0x30')][_0x0d25('0x36')]);_0x2bac3d[_0x0d25('0x1e')]=qs['offset'](_0x5d914a[_0x0d25('0x30')]['offset']);}_0x2bac3d['order']=qs[_0x0d25('0x37')](_0x5d914a['query']['sort']);_0x2bac3d[_0x0d25('0x38')]=qs['filters'](_[_0x0d25('0x39')](_0x5d914a[_0x0d25('0x30')],_0x512a5c[_0x0d25('0x3a')]),_0x76155f);if(_0x5d914a['query'][_0x0d25('0x3b')]){_0x2bac3d['where']=_['merge'](_0x2bac3d[_0x0d25('0x38')],{'$or':_[_0x0d25('0x2b')](_0x76155f,function(_0x2de166){if(_0x2de166[_0x0d25('0x2e')]!==_0x0d25('0x3c')){var _0x1408d4={};_0x1408d4[_0x2de166['name']]={'$like':'%'+_0x5d914a[_0x0d25('0x30')][_0x0d25('0x3b')]+'%'};return _0x1408d4;}})});}_0x2bac3d=_[_0x0d25('0x3d')]({},_0x2bac3d,_0x5d914a[_0x0d25('0x3e')]);var _0x29927e={'where':_0x2bac3d[_0x0d25('0x38')]};return db[_0x0d25('0x3f')][_0x0d25('0x20')](_0x29927e)[_0x0d25('0x25')](function(_0x308d8c){_0x7d6ce5[_0x0d25('0x20')]=_0x308d8c;if(_0x5d914a[_0x0d25('0x30')]['includeAll']){_0x2bac3d[_0x0d25('0x40')]=[{'all':!![]}];}return db[_0x0d25('0x3f')][_0x0d25('0x41')](_0x2bac3d);})[_0x0d25('0x25')](function(_0x556ae2){_0x7d6ce5['rows']=_0x556ae2;return _0x7d6ce5;})[_0x0d25('0x25')](respondWithFilteredResult(_0x5345b2,_0x2bac3d))[_0x0d25('0x42')](handleError(_0x5345b2,null));};exports[_0x0d25('0x43')]=function(_0x37816d,_0x2fd31c){var _0x23bdc0={'raw':![],'where':{'id':_0x37816d['params']['id']}},_0x307826={};_0x307826[_0x0d25('0x2f')]=_['keys'](db[_0x0d25('0x3f')][_0x0d25('0x2c')]);_0x307826['query']=_[_0x0d25('0x31')](_0x37816d[_0x0d25('0x30')]);_0x307826[_0x0d25('0x3a')]=_[_0x0d25('0x32')](_0x307826[_0x0d25('0x2f')],_0x307826[_0x0d25('0x30')]);_0x23bdc0[_0x0d25('0x33')]=_[_0x0d25('0x32')](_0x307826['model'],qs[_0x0d25('0x34')](_0x37816d['query']['fields']));_0x23bdc0[_0x0d25('0x33')]=_0x23bdc0[_0x0d25('0x33')][_0x0d25('0x44')]?_0x23bdc0[_0x0d25('0x33')]:_0x307826['model'];if(_0x37816d[_0x0d25('0x30')][_0x0d25('0x45')]){_0x23bdc0[_0x0d25('0x40')]=[{'all':!![]}];}_0x23bdc0=_[_0x0d25('0x3d')]({},_0x23bdc0,_0x37816d[_0x0d25('0x3e')]);return db['ZendeskConfiguration']['find'](_0x23bdc0)[_0x0d25('0x25')](handleEntityNotFound(_0x2fd31c,null))[_0x0d25('0x25')](respondWithResult(_0x2fd31c,null))[_0x0d25('0x42')](handleError(_0x2fd31c,null));};exports[_0x0d25('0x46')]=function(_0x3ca915,_0x55e46d){return db[_0x0d25('0x3f')][_0x0d25('0x46')](_0x3ca915['body'],{})[_0x0d25('0x25')](respondWithResult(_0x55e46d,0xc9))['catch'](handleError(_0x55e46d,null));};exports[_0x0d25('0x24')]=function(_0x53cfe9,_0x2d9e37){if(_0x53cfe9[_0x0d25('0x47')]['id']){delete _0x53cfe9[_0x0d25('0x47')]['id'];}return db[_0x0d25('0x3f')]['find']({'where':{'id':_0x53cfe9['params']['id']}})[_0x0d25('0x25')](handleEntityNotFound(_0x2d9e37,null))['then'](saveUpdates(_0x53cfe9[_0x0d25('0x47')],null))['then'](respondWithResult(_0x2d9e37,null))[_0x0d25('0x42')](handleError(_0x2d9e37,null));};exports[_0x0d25('0x26')]=function(_0x4a7658,_0x26e4ba){return db[_0x0d25('0x3f')][_0x0d25('0x48')]({'where':{'id':_0x4a7658[_0x0d25('0x49')]['id']}})[_0x0d25('0x25')](handleEntityNotFound(_0x26e4ba,null))['then'](removeEntity(_0x26e4ba,null))['catch'](handleError(_0x26e4ba,null));};exports[_0x0d25('0x4a')]=function(_0x43f0b9,_0x20c3c1,_0xf7537b){var _0x389090={};var _0x14d5dc={};var _0x362057;var _0xde728e;return db[_0x0d25('0x3f')]['findOne']({'where':{'id':_0x43f0b9[_0x0d25('0x49')]['id']}})[_0x0d25('0x25')](handleEntityNotFound(_0x20c3c1,null))['then'](function(_0x178f05){if(_0x178f05){_0x362057=_0x178f05;_0x14d5dc['model']=_[_0x0d25('0x31')](db[_0x0d25('0x4b')][_0x0d25('0x2c')]);_0x14d5dc[_0x0d25('0x30')]=_['keys'](_0x43f0b9[_0x0d25('0x30')]);_0x14d5dc['filters']=_[_0x0d25('0x32')](_0x14d5dc[_0x0d25('0x2f')],_0x14d5dc[_0x0d25('0x30')]);_0x389090['attributes']=_[_0x0d25('0x32')](_0x14d5dc[_0x0d25('0x2f')],qs[_0x0d25('0x34')](_0x43f0b9[_0x0d25('0x30')][_0x0d25('0x34')]));_0x389090[_0x0d25('0x33')]=_0x389090[_0x0d25('0x33')][_0x0d25('0x44')]?_0x389090[_0x0d25('0x33')]:_0x14d5dc[_0x0d25('0x2f')];_0x389090['order']=qs[_0x0d25('0x37')](_0x43f0b9['query']['sort']);_0x389090['where']=qs[_0x0d25('0x3a')](_[_0x0d25('0x39')](_0x43f0b9[_0x0d25('0x30')],_0x14d5dc[_0x0d25('0x3a')]));if(_0x43f0b9[_0x0d25('0x30')][_0x0d25('0x3b')]){_0x389090[_0x0d25('0x38')]=_[_0x0d25('0x3d')](_0x389090['where'],{'$or':_[_0x0d25('0x2b')](_0x389090['attributes'],function(_0x2b20b5){var _0x3d703e={};_0x3d703e[_0x2b20b5]={'$like':'%'+_0x43f0b9[_0x0d25('0x30')]['filter']+'%'};return _0x3d703e;})});}_0x389090=_[_0x0d25('0x3d')]({},_0x389090,_0x43f0b9[_0x0d25('0x3e')]);return _0x362057[_0x0d25('0x4a')](_0x389090);}})[_0x0d25('0x25')](function(_0x474469){if(_0x474469){_0xde728e=_0x474469[_0x0d25('0x44')];if(!_0x43f0b9[_0x0d25('0x30')]['hasOwnProperty'](_0x0d25('0x35'))){_0x389090['limit']=qs[_0x0d25('0x36')](_0x43f0b9[_0x0d25('0x30')][_0x0d25('0x36')]);_0x389090[_0x0d25('0x1e')]=qs[_0x0d25('0x1e')](_0x43f0b9[_0x0d25('0x30')][_0x0d25('0x1e')]);}return _0x362057[_0x0d25('0x4a')](_0x389090);}})[_0x0d25('0x25')](function(_0x431a1c){if(_0x431a1c){return _0x431a1c?{'count':_0xde728e,'rows':_0x431a1c}:null;}})[_0x0d25('0x25')](respondWithResult(_0x20c3c1,null))[_0x0d25('0x42')](handleError(_0x20c3c1,null));};exports[_0x0d25('0x4c')]=function(_0x38d7ea,_0x249ac7,_0x2ac98c){var _0x3b7d2f={};var _0x375abc={};var _0x33184f;var _0x1f3e5d;return db[_0x0d25('0x3f')][_0x0d25('0x4d')]({'where':{'id':_0x38d7ea[_0x0d25('0x49')]['id']}})['then'](handleEntityNotFound(_0x249ac7,null))[_0x0d25('0x25')](function(_0x54b4fe){if(_0x54b4fe){_0x33184f=_0x54b4fe;_0x375abc[_0x0d25('0x2f')]=_[_0x0d25('0x31')](db['ZendeskField'][_0x0d25('0x2c')]);_0x375abc[_0x0d25('0x30')]=_[_0x0d25('0x31')](_0x38d7ea['query']);_0x375abc['filters']=_[_0x0d25('0x32')](_0x375abc[_0x0d25('0x2f')],_0x375abc[_0x0d25('0x30')]);_0x3b7d2f[_0x0d25('0x33')]=_[_0x0d25('0x32')](_0x375abc[_0x0d25('0x2f')],qs[_0x0d25('0x34')](_0x38d7ea[_0x0d25('0x30')][_0x0d25('0x34')]));_0x3b7d2f['attributes']=_0x3b7d2f[_0x0d25('0x33')][_0x0d25('0x44')]?_0x3b7d2f[_0x0d25('0x33')]:_0x375abc[_0x0d25('0x2f')];_0x3b7d2f[_0x0d25('0x4e')]=qs[_0x0d25('0x37')](_0x38d7ea[_0x0d25('0x30')][_0x0d25('0x37')]);_0x3b7d2f[_0x0d25('0x38')]=qs[_0x0d25('0x3a')](_['pick'](_0x38d7ea[_0x0d25('0x30')],_0x375abc[_0x0d25('0x3a')]));if(_0x38d7ea[_0x0d25('0x30')]['filter']){_0x3b7d2f[_0x0d25('0x38')]=_['merge'](_0x3b7d2f[_0x0d25('0x38')],{'$or':_[_0x0d25('0x2b')](_0x3b7d2f['attributes'],function(_0x87c182){var _0x2e316b={};_0x2e316b[_0x87c182]={'$like':'%'+_0x38d7ea['query'][_0x0d25('0x3b')]+'%'};return _0x2e316b;})});}_0x3b7d2f=_[_0x0d25('0x3d')]({},_0x3b7d2f,_0x38d7ea[_0x0d25('0x3e')]);return _0x33184f[_0x0d25('0x4c')](_0x3b7d2f);}})['then'](function(_0x543cd3){if(_0x543cd3){_0x1f3e5d=_0x543cd3[_0x0d25('0x44')];if(!_0x38d7ea[_0x0d25('0x30')][_0x0d25('0x4f')]('nolimit')){_0x3b7d2f['limit']=qs[_0x0d25('0x36')](_0x38d7ea[_0x0d25('0x30')]['limit']);_0x3b7d2f['offset']=qs[_0x0d25('0x1e')](_0x38d7ea[_0x0d25('0x30')][_0x0d25('0x1e')]);}return _0x33184f[_0x0d25('0x4c')](_0x3b7d2f);}})[_0x0d25('0x25')](function(_0x20c287){if(_0x20c287){return _0x20c287?{'count':_0x1f3e5d,'rows':_0x20c287}:null;}})['then'](respondWithResult(_0x249ac7,null))[_0x0d25('0x42')](handleError(_0x249ac7,null));};exports[_0x0d25('0x50')]=function(_0x3d88cd,_0x42242d,_0x3c9925){var _0x4b3884={};var _0x59f7ac={};var _0x2eade9;var _0x4926cd;return db[_0x0d25('0x3f')]['findOne']({'where':{'id':_0x3d88cd[_0x0d25('0x49')]['id']}})[_0x0d25('0x25')](handleEntityNotFound(_0x42242d,null))['then'](function(_0x258f08){if(_0x258f08){_0x2eade9=_0x258f08;_0x59f7ac[_0x0d25('0x2f')]=_['keys'](db[_0x0d25('0x4b')]['rawAttributes']);_0x59f7ac[_0x0d25('0x30')]=_[_0x0d25('0x31')](_0x3d88cd['query']);_0x59f7ac['filters']=_['intersection'](_0x59f7ac['model'],_0x59f7ac[_0x0d25('0x30')]);_0x4b3884[_0x0d25('0x33')]=_['intersection'](_0x59f7ac[_0x0d25('0x2f')],qs[_0x0d25('0x34')](_0x3d88cd[_0x0d25('0x30')][_0x0d25('0x34')]));_0x4b3884[_0x0d25('0x33')]=_0x4b3884[_0x0d25('0x33')][_0x0d25('0x44')]?_0x4b3884[_0x0d25('0x33')]:_0x59f7ac[_0x0d25('0x2f')];_0x4b3884[_0x0d25('0x4e')]=qs[_0x0d25('0x37')](_0x3d88cd[_0x0d25('0x30')][_0x0d25('0x37')]);_0x4b3884[_0x0d25('0x38')]=qs[_0x0d25('0x3a')](_[_0x0d25('0x39')](_0x3d88cd[_0x0d25('0x30')],_0x59f7ac[_0x0d25('0x3a')]));if(_0x3d88cd['query']['filter']){_0x4b3884[_0x0d25('0x38')]=_[_0x0d25('0x3d')](_0x4b3884[_0x0d25('0x38')],{'$or':_[_0x0d25('0x2b')](_0x4b3884[_0x0d25('0x33')],function(_0x1bacd9){var _0x45dde4={};_0x45dde4[_0x1bacd9]={'$like':'%'+_0x3d88cd[_0x0d25('0x30')][_0x0d25('0x3b')]+'%'};return _0x45dde4;})});}_0x4b3884=_[_0x0d25('0x3d')]({},_0x4b3884,_0x3d88cd['options']);return _0x2eade9['getDescriptions'](_0x4b3884);}})[_0x0d25('0x25')](function(_0x58f47e){if(_0x58f47e){_0x4926cd=_0x58f47e['length'];if(!_0x3d88cd[_0x0d25('0x30')][_0x0d25('0x4f')](_0x0d25('0x35'))){_0x4b3884[_0x0d25('0x36')]=qs['limit'](_0x3d88cd[_0x0d25('0x30')][_0x0d25('0x36')]);_0x4b3884[_0x0d25('0x1e')]=qs[_0x0d25('0x1e')](_0x3d88cd[_0x0d25('0x30')][_0x0d25('0x1e')]);}return _0x2eade9[_0x0d25('0x50')](_0x4b3884);}})['then'](function(_0x317ee2){if(_0x317ee2){return _0x317ee2?{'count':_0x4926cd,'rows':_0x317ee2}:null;}})[_0x0d25('0x25')](respondWithResult(_0x42242d,null))[_0x0d25('0x42')](handleError(_0x42242d,null));};exports[_0x0d25('0x51')]=function(_0x38feb8,_0x42ecbf,_0x3b95f6){var _0x18d387={};var _0x3a497a={};var _0x4db1b4;var _0x295bd7;return db['ZendeskConfiguration'][_0x0d25('0x4d')]({'where':{'id':_0x38feb8[_0x0d25('0x49')]['id']}})[_0x0d25('0x25')](handleEntityNotFound(_0x42ecbf,null))[_0x0d25('0x25')](function(_0x376e7d){if(_0x376e7d){_0x4db1b4=_0x376e7d;_0x3a497a[_0x0d25('0x2f')]=_[_0x0d25('0x31')](db[_0x0d25('0x52')][_0x0d25('0x2c')]);_0x3a497a[_0x0d25('0x30')]=_[_0x0d25('0x31')](_0x38feb8[_0x0d25('0x30')]);_0x3a497a[_0x0d25('0x3a')]=_[_0x0d25('0x32')](_0x3a497a[_0x0d25('0x2f')],_0x3a497a[_0x0d25('0x30')]);_0x18d387[_0x0d25('0x33')]=_[_0x0d25('0x32')](_0x3a497a[_0x0d25('0x2f')],qs['fields'](_0x38feb8[_0x0d25('0x30')]['fields']));_0x18d387[_0x0d25('0x33')]=_0x18d387[_0x0d25('0x33')]['length']?_0x18d387[_0x0d25('0x33')]:_0x3a497a[_0x0d25('0x2f')];_0x18d387[_0x0d25('0x4e')]=qs['sort'](_0x38feb8[_0x0d25('0x30')][_0x0d25('0x37')]);_0x18d387[_0x0d25('0x38')]=qs[_0x0d25('0x3a')](_[_0x0d25('0x39')](_0x38feb8[_0x0d25('0x30')],_0x3a497a[_0x0d25('0x3a')]));if(_0x38feb8[_0x0d25('0x30')][_0x0d25('0x3b')]){_0x18d387[_0x0d25('0x38')]=_['merge'](_0x18d387[_0x0d25('0x38')],{'$or':_[_0x0d25('0x2b')](_0x18d387[_0x0d25('0x33')],function(_0x58ca62){var _0x504fac={};_0x504fac[_0x58ca62]={'$like':'%'+_0x38feb8['query'][_0x0d25('0x3b')]+'%'};return _0x504fac;})});}_0x18d387=_[_0x0d25('0x3d')]({},_0x18d387,_0x38feb8[_0x0d25('0x3e')]);return _0x4db1b4['getTags'](_0x18d387);}})[_0x0d25('0x25')](function(_0x102238){if(_0x102238){_0x295bd7=_0x102238['length'];if(!_0x38feb8[_0x0d25('0x30')][_0x0d25('0x4f')]('nolimit')){_0x18d387[_0x0d25('0x36')]=qs[_0x0d25('0x36')](_0x38feb8[_0x0d25('0x30')][_0x0d25('0x36')]);_0x18d387['offset']=qs[_0x0d25('0x1e')](_0x38feb8[_0x0d25('0x30')][_0x0d25('0x1e')]);}return _0x4db1b4['getTags'](_0x18d387);}})['then'](function(_0x11a863){if(_0x11a863){return _0x11a863?{'count':_0x295bd7,'rows':_0x11a863}:null;}})[_0x0d25('0x25')](respondWithResult(_0x42ecbf,null))[_0x0d25('0x42')](handleError(_0x42ecbf,null));};exports[_0x0d25('0x53')]=function(_0x5b5262,_0x3f7b0a,_0x34ad10){if(_0x5b5262[_0x0d25('0x47')]['id']){delete _0x5b5262[_0x0d25('0x47')]['id'];}return db[_0x0d25('0x3f')][_0x0d25('0x4d')]({'where':{'id':_0x5b5262['params']['id']}})[_0x0d25('0x25')](handleEntityNotFound(_0x3f7b0a,null))[_0x0d25('0x25')](function(_0x4fbb14){if(_0x4fbb14){return _0x4fbb14[_0x0d25('0x53')](_0x5b5262[_0x0d25('0x47')]['ids']||[]);}return null;})[_0x0d25('0x25')](respondWithResult(_0x3f7b0a,null))[_0x0d25('0x42')](handleError(_0x3f7b0a,null));}; \ No newline at end of file +var _0x3be8=['getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','includeAll','include','ZendeskConfiguration','findAll','rows','show','params','keys','options','catch','create','body','find','findOne','ZendeskField','order','sort','getFields'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x3be8,0x1c3));var _0x83be=function(_0x1f3d15,_0x5176a8){_0x1f3d15=_0x1f3d15-0x0;var _0x48617b=_0x3be8[_0x1f3d15];return _0x48617b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x83be('0x0'));var zipdir=require(_0x83be('0x1'));var jsonpatch=require(_0x83be('0x2'));var rp=require(_0x83be('0x3'));var moment=require(_0x83be('0x4'));var BPromise=require(_0x83be('0x5'));var Mustache=require('mustache');var util=require(_0x83be('0x6'));var path=require(_0x83be('0x7'));var sox=require(_0x83be('0x8'));var csv=require(_0x83be('0x9'));var ejs=require(_0x83be('0xa'));var fs=require('fs');var fs_extra=require(_0x83be('0xb'));var _=require(_0x83be('0xc'));var squel=require('squel');var crypto=require(_0x83be('0xd'));var jsforce=require(_0x83be('0xe'));var deskjs=require(_0x83be('0xf'));var toCsv=require(_0x83be('0x9'));var querystring=require(_0x83be('0x10'));var Papa=require(_0x83be('0x11'));var Redis=require('ioredis');var authService=require(_0x83be('0x12'));var qs=require(_0x83be('0x13'));var as=require(_0x83be('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x83be('0x15'))(_0x83be('0x16'));var utils=require('../../config/utils');var config=require(_0x83be('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x83be('0x18'))['db'];function respondWithStatusCode(_0x24af45,_0x5adca3){_0x5adca3=_0x5adca3||0xcc;return function(_0x53df26){if(_0x53df26){return _0x24af45[_0x83be('0x19')](_0x5adca3);}return _0x24af45[_0x83be('0x1a')](_0x5adca3)[_0x83be('0x1b')]();};}function respondWithResult(_0x217903,_0x3a51ce){_0x3a51ce=_0x3a51ce||0xc8;return function(_0x109045){if(_0x109045){return _0x217903[_0x83be('0x1a')](_0x3a51ce)[_0x83be('0x1c')](_0x109045);}};}function respondWithFilteredResult(_0x35c864,_0x556b5e){return function(_0x297316){if(_0x297316){var _0x2ea103=typeof _0x556b5e['offset']===_0x83be('0x1d')&&typeof _0x556b5e[_0x83be('0x1e')]==='undefined';var _0x162ebd=_0x297316[_0x83be('0x1f')];var _0x4ce69a=_0x2ea103?0x0:_0x556b5e['offset'];var _0x4f6bb8=_0x2ea103?_0x297316[_0x83be('0x1f')]:_0x556b5e[_0x83be('0x20')]+_0x556b5e[_0x83be('0x1e')];var _0x18fb71;if(_0x4f6bb8>=_0x162ebd){_0x4f6bb8=_0x162ebd;_0x18fb71=0xc8;}else{_0x18fb71=0xce;}_0x35c864[_0x83be('0x1a')](_0x18fb71);return _0x35c864[_0x83be('0x21')](_0x83be('0x22'),_0x4ce69a+'-'+_0x4f6bb8+'/'+_0x162ebd)[_0x83be('0x1c')](_0x297316);}return null;};}function patchUpdates(_0x4527eb){return function(_0x11c4dc){try{jsonpatch[_0x83be('0x23')](_0x11c4dc,_0x4527eb,!![]);}catch(_0x20280c){return BPromise[_0x83be('0x24')](_0x20280c);}return _0x11c4dc[_0x83be('0x25')]();};}function saveUpdates(_0x1adae5,_0x12b4dc){return function(_0x2e4879){if(_0x2e4879){return _0x2e4879[_0x83be('0x26')](_0x1adae5)[_0x83be('0x27')](function(_0x468630){return _0x468630;});}return null;};}function removeEntity(_0x473610,_0x4ac99d){return function(_0x273f27){if(_0x273f27){return _0x273f27[_0x83be('0x28')]()[_0x83be('0x27')](function(){_0x473610[_0x83be('0x1a')](0xcc)[_0x83be('0x1b')]();});}};}function handleEntityNotFound(_0x5e8613,_0x725a64){return function(_0x2b079f){if(!_0x2b079f){_0x5e8613[_0x83be('0x19')](0x194);}return _0x2b079f;};}function handleError(_0x394e05,_0x5436b4){_0x5436b4=_0x5436b4||0x1f4;return function(_0x3bd360){logger[_0x83be('0x29')](_0x3bd360[_0x83be('0x2a')]);if(_0x3bd360[_0x83be('0x2b')]){delete _0x3bd360[_0x83be('0x2b')];}_0x394e05['status'](_0x5436b4)[_0x83be('0x2c')](_0x3bd360);};}exports[_0x83be('0x2d')]=function(_0x3a17df,_0x4aa06f){var _0x44fc06={},_0x182ca1={},_0x57f94f={'count':0x0,'rows':[]};var _0x4c53d6=_[_0x83be('0x2e')](db['ZendeskConfiguration'][_0x83be('0x2f')],function(_0x3f542d){return{'name':_0x3f542d[_0x83be('0x30')],'type':_0x3f542d[_0x83be('0x31')][_0x83be('0x32')]};});_0x182ca1[_0x83be('0x33')]=_['map'](_0x4c53d6,_0x83be('0x2b'));_0x182ca1[_0x83be('0x34')]=_['keys'](_0x3a17df[_0x83be('0x34')]);_0x182ca1[_0x83be('0x35')]=_[_0x83be('0x36')](_0x182ca1[_0x83be('0x33')],_0x182ca1['query']);_0x44fc06[_0x83be('0x37')]=_[_0x83be('0x36')](_0x182ca1[_0x83be('0x33')],qs[_0x83be('0x38')](_0x3a17df[_0x83be('0x34')]['fields']));_0x44fc06[_0x83be('0x37')]=_0x44fc06[_0x83be('0x37')][_0x83be('0x39')]?_0x44fc06[_0x83be('0x37')]:_0x182ca1[_0x83be('0x33')];if(!_0x3a17df['query'][_0x83be('0x3a')](_0x83be('0x3b'))){_0x44fc06[_0x83be('0x1e')]=qs[_0x83be('0x1e')](_0x3a17df[_0x83be('0x34')]['limit']);_0x44fc06[_0x83be('0x20')]=qs[_0x83be('0x20')](_0x3a17df['query']['offset']);}_0x44fc06['order']=qs['sort'](_0x3a17df[_0x83be('0x34')]['sort']);_0x44fc06[_0x83be('0x3c')]=qs[_0x83be('0x35')](_[_0x83be('0x3d')](_0x3a17df[_0x83be('0x34')],_0x182ca1[_0x83be('0x35')]),_0x4c53d6);if(_0x3a17df[_0x83be('0x34')][_0x83be('0x3e')]){_0x44fc06[_0x83be('0x3c')]=_[_0x83be('0x3f')](_0x44fc06[_0x83be('0x3c')],{'$or':_['map'](_0x4c53d6,function(_0x34176e){if(_0x34176e[_0x83be('0x31')]!==_0x83be('0x40')){var _0x12e1e9={};_0x12e1e9[_0x34176e[_0x83be('0x2b')]]={'$like':'%'+_0x3a17df[_0x83be('0x34')][_0x83be('0x3e')]+'%'};return _0x12e1e9;}})});}_0x44fc06=_[_0x83be('0x3f')]({},_0x44fc06,_0x3a17df['options']);var _0x5b961a={'where':_0x44fc06['where']};return db['ZendeskConfiguration'][_0x83be('0x1f')](_0x5b961a)[_0x83be('0x27')](function(_0x116116){_0x57f94f[_0x83be('0x1f')]=_0x116116;if(_0x3a17df[_0x83be('0x34')][_0x83be('0x41')]){_0x44fc06[_0x83be('0x42')]=[{'all':!![]}];}return db[_0x83be('0x43')][_0x83be('0x44')](_0x44fc06);})[_0x83be('0x27')](function(_0x52451f){_0x57f94f[_0x83be('0x45')]=_0x52451f;return _0x57f94f;})[_0x83be('0x27')](respondWithFilteredResult(_0x4aa06f,_0x44fc06))['catch'](handleError(_0x4aa06f,null));};exports[_0x83be('0x46')]=function(_0x237c43,_0x36ba33){var _0x3c511d={'raw':![],'where':{'id':_0x237c43[_0x83be('0x47')]['id']}},_0x17f1e6={};_0x17f1e6[_0x83be('0x33')]=_['keys'](db['ZendeskConfiguration'][_0x83be('0x2f')]);_0x17f1e6['query']=_[_0x83be('0x48')](_0x237c43['query']);_0x17f1e6[_0x83be('0x35')]=_[_0x83be('0x36')](_0x17f1e6[_0x83be('0x33')],_0x17f1e6[_0x83be('0x34')]);_0x3c511d['attributes']=_[_0x83be('0x36')](_0x17f1e6[_0x83be('0x33')],qs[_0x83be('0x38')](_0x237c43[_0x83be('0x34')][_0x83be('0x38')]));_0x3c511d[_0x83be('0x37')]=_0x3c511d['attributes'][_0x83be('0x39')]?_0x3c511d[_0x83be('0x37')]:_0x17f1e6['model'];if(_0x237c43[_0x83be('0x34')]['includeAll']){_0x3c511d['include']=[{'all':!![]}];}_0x3c511d=_['merge']({},_0x3c511d,_0x237c43[_0x83be('0x49')]);return db['ZendeskConfiguration']['find'](_0x3c511d)[_0x83be('0x27')](handleEntityNotFound(_0x36ba33,null))[_0x83be('0x27')](respondWithResult(_0x36ba33,null))[_0x83be('0x4a')](handleError(_0x36ba33,null));};exports[_0x83be('0x4b')]=function(_0x321261,_0x38c2a2){return db[_0x83be('0x43')][_0x83be('0x4b')](_0x321261[_0x83be('0x4c')],{})['then'](respondWithResult(_0x38c2a2,0xc9))[_0x83be('0x4a')](handleError(_0x38c2a2,null));};exports[_0x83be('0x26')]=function(_0x5a93e8,_0x53a710){if(_0x5a93e8['body']['id']){delete _0x5a93e8[_0x83be('0x4c')]['id'];}return db[_0x83be('0x43')][_0x83be('0x4d')]({'where':{'id':_0x5a93e8[_0x83be('0x47')]['id']}})[_0x83be('0x27')](handleEntityNotFound(_0x53a710,null))[_0x83be('0x27')](saveUpdates(_0x5a93e8[_0x83be('0x4c')],null))[_0x83be('0x27')](respondWithResult(_0x53a710,null))[_0x83be('0x4a')](handleError(_0x53a710,null));};exports[_0x83be('0x28')]=function(_0x20e943,_0xc509a4){return db[_0x83be('0x43')][_0x83be('0x4d')]({'where':{'id':_0x20e943[_0x83be('0x47')]['id']}})['then'](handleEntityNotFound(_0xc509a4,null))[_0x83be('0x27')](removeEntity(_0xc509a4,null))['catch'](handleError(_0xc509a4,null));};exports['getFields']=function(_0x5e995f,_0x2de292,_0x30d1fe){var _0x5c6d8b={};var _0x221b78={};var _0x1cbddc;var _0x1b8f1c;return db[_0x83be('0x43')][_0x83be('0x4e')]({'where':{'id':_0x5e995f['params']['id']}})['then'](handleEntityNotFound(_0x2de292,null))['then'](function(_0x2655d5){if(_0x2655d5){_0x1cbddc=_0x2655d5;_0x221b78[_0x83be('0x33')]=_['keys'](db[_0x83be('0x4f')]['rawAttributes']);_0x221b78[_0x83be('0x34')]=_[_0x83be('0x48')](_0x5e995f[_0x83be('0x34')]);_0x221b78['filters']=_[_0x83be('0x36')](_0x221b78['model'],_0x221b78['query']);_0x5c6d8b[_0x83be('0x37')]=_[_0x83be('0x36')](_0x221b78[_0x83be('0x33')],qs[_0x83be('0x38')](_0x5e995f[_0x83be('0x34')]['fields']));_0x5c6d8b[_0x83be('0x37')]=_0x5c6d8b[_0x83be('0x37')][_0x83be('0x39')]?_0x5c6d8b[_0x83be('0x37')]:_0x221b78[_0x83be('0x33')];_0x5c6d8b[_0x83be('0x50')]=qs[_0x83be('0x51')](_0x5e995f[_0x83be('0x34')][_0x83be('0x51')]);_0x5c6d8b['where']=qs['filters'](_[_0x83be('0x3d')](_0x5e995f[_0x83be('0x34')],_0x221b78['filters']));if(_0x5e995f[_0x83be('0x34')][_0x83be('0x3e')]){_0x5c6d8b[_0x83be('0x3c')]=_[_0x83be('0x3f')](_0x5c6d8b[_0x83be('0x3c')],{'$or':_[_0x83be('0x2e')](_0x5c6d8b['attributes'],function(_0x34a7e2){var _0x324cd0={};_0x324cd0[_0x34a7e2]={'$like':'%'+_0x5e995f[_0x83be('0x34')][_0x83be('0x3e')]+'%'};return _0x324cd0;})});}_0x5c6d8b=_[_0x83be('0x3f')]({},_0x5c6d8b,_0x5e995f[_0x83be('0x49')]);return _0x1cbddc[_0x83be('0x52')](_0x5c6d8b);}})['then'](function(_0x56d0bf){if(_0x56d0bf){_0x1b8f1c=_0x56d0bf[_0x83be('0x39')];if(!_0x5e995f['query'][_0x83be('0x3a')](_0x83be('0x3b'))){_0x5c6d8b[_0x83be('0x1e')]=qs[_0x83be('0x1e')](_0x5e995f['query']['limit']);_0x5c6d8b[_0x83be('0x20')]=qs[_0x83be('0x20')](_0x5e995f['query'][_0x83be('0x20')]);}return _0x1cbddc[_0x83be('0x52')](_0x5c6d8b);}})[_0x83be('0x27')](function(_0x91b265){if(_0x91b265){return _0x91b265?{'count':_0x1b8f1c,'rows':_0x91b265}:null;}})['then'](respondWithResult(_0x2de292,null))[_0x83be('0x4a')](handleError(_0x2de292,null));};exports[_0x83be('0x53')]=function(_0x321e99,_0x2f8da9,_0xcd4c22){var _0x371c69={};var _0x1164be={};var _0x16bd02;var _0x18ef32;return db[_0x83be('0x43')][_0x83be('0x4e')]({'where':{'id':_0x321e99[_0x83be('0x47')]['id']}})[_0x83be('0x27')](handleEntityNotFound(_0x2f8da9,null))['then'](function(_0x5e4a85){if(_0x5e4a85){_0x16bd02=_0x5e4a85;_0x1164be[_0x83be('0x33')]=_['keys'](db[_0x83be('0x4f')][_0x83be('0x2f')]);_0x1164be['query']=_['keys'](_0x321e99['query']);_0x1164be[_0x83be('0x35')]=_[_0x83be('0x36')](_0x1164be[_0x83be('0x33')],_0x1164be[_0x83be('0x34')]);_0x371c69['attributes']=_['intersection'](_0x1164be[_0x83be('0x33')],qs[_0x83be('0x38')](_0x321e99[_0x83be('0x34')]['fields']));_0x371c69[_0x83be('0x37')]=_0x371c69[_0x83be('0x37')][_0x83be('0x39')]?_0x371c69[_0x83be('0x37')]:_0x1164be[_0x83be('0x33')];_0x371c69['order']=qs[_0x83be('0x51')](_0x321e99['query'][_0x83be('0x51')]);_0x371c69[_0x83be('0x3c')]=qs[_0x83be('0x35')](_['pick'](_0x321e99[_0x83be('0x34')],_0x1164be[_0x83be('0x35')]));if(_0x321e99['query'][_0x83be('0x3e')]){_0x371c69[_0x83be('0x3c')]=_[_0x83be('0x3f')](_0x371c69['where'],{'$or':_['map'](_0x371c69[_0x83be('0x37')],function(_0x13fe12){var _0x383490={};_0x383490[_0x13fe12]={'$like':'%'+_0x321e99['query'][_0x83be('0x3e')]+'%'};return _0x383490;})});}_0x371c69=_['merge']({},_0x371c69,_0x321e99[_0x83be('0x49')]);return _0x16bd02['getSubjects'](_0x371c69);}})[_0x83be('0x27')](function(_0x32a36e){if(_0x32a36e){_0x18ef32=_0x32a36e['length'];if(!_0x321e99['query']['hasOwnProperty']('nolimit')){_0x371c69[_0x83be('0x1e')]=qs[_0x83be('0x1e')](_0x321e99[_0x83be('0x34')][_0x83be('0x1e')]);_0x371c69['offset']=qs[_0x83be('0x20')](_0x321e99[_0x83be('0x34')][_0x83be('0x20')]);}return _0x16bd02[_0x83be('0x53')](_0x371c69);}})['then'](function(_0x1b4309){if(_0x1b4309){return _0x1b4309?{'count':_0x18ef32,'rows':_0x1b4309}:null;}})[_0x83be('0x27')](respondWithResult(_0x2f8da9,null))[_0x83be('0x4a')](handleError(_0x2f8da9,null));};exports[_0x83be('0x54')]=function(_0x2bc64b,_0x527911,_0x4263fa){var _0x329267={};var _0x556b72={};var _0x19bb0f;var _0x4b1101;return db[_0x83be('0x43')][_0x83be('0x4e')]({'where':{'id':_0x2bc64b[_0x83be('0x47')]['id']}})[_0x83be('0x27')](handleEntityNotFound(_0x527911,null))[_0x83be('0x27')](function(_0x592bfd){if(_0x592bfd){_0x19bb0f=_0x592bfd;_0x556b72[_0x83be('0x33')]=_[_0x83be('0x48')](db[_0x83be('0x4f')][_0x83be('0x2f')]);_0x556b72['query']=_[_0x83be('0x48')](_0x2bc64b[_0x83be('0x34')]);_0x556b72[_0x83be('0x35')]=_[_0x83be('0x36')](_0x556b72[_0x83be('0x33')],_0x556b72[_0x83be('0x34')]);_0x329267[_0x83be('0x37')]=_['intersection'](_0x556b72[_0x83be('0x33')],qs[_0x83be('0x38')](_0x2bc64b[_0x83be('0x34')][_0x83be('0x38')]));_0x329267[_0x83be('0x37')]=_0x329267[_0x83be('0x37')]['length']?_0x329267['attributes']:_0x556b72[_0x83be('0x33')];_0x329267[_0x83be('0x50')]=qs[_0x83be('0x51')](_0x2bc64b['query']['sort']);_0x329267[_0x83be('0x3c')]=qs['filters'](_['pick'](_0x2bc64b[_0x83be('0x34')],_0x556b72['filters']));if(_0x2bc64b['query'][_0x83be('0x3e')]){_0x329267[_0x83be('0x3c')]=_[_0x83be('0x3f')](_0x329267[_0x83be('0x3c')],{'$or':_[_0x83be('0x2e')](_0x329267[_0x83be('0x37')],function(_0x5a18c5){var _0x4bbcea={};_0x4bbcea[_0x5a18c5]={'$like':'%'+_0x2bc64b[_0x83be('0x34')][_0x83be('0x3e')]+'%'};return _0x4bbcea;})});}_0x329267=_[_0x83be('0x3f')]({},_0x329267,_0x2bc64b[_0x83be('0x49')]);return _0x19bb0f['getDescriptions'](_0x329267);}})[_0x83be('0x27')](function(_0x17ab4c){if(_0x17ab4c){_0x4b1101=_0x17ab4c[_0x83be('0x39')];if(!_0x2bc64b[_0x83be('0x34')][_0x83be('0x3a')](_0x83be('0x3b'))){_0x329267[_0x83be('0x1e')]=qs[_0x83be('0x1e')](_0x2bc64b[_0x83be('0x34')]['limit']);_0x329267[_0x83be('0x20')]=qs[_0x83be('0x20')](_0x2bc64b[_0x83be('0x34')][_0x83be('0x20')]);}return _0x19bb0f[_0x83be('0x54')](_0x329267);}})['then'](function(_0x1e4651){if(_0x1e4651){return _0x1e4651?{'count':_0x4b1101,'rows':_0x1e4651}:null;}})[_0x83be('0x27')](respondWithResult(_0x527911,null))[_0x83be('0x4a')](handleError(_0x527911,null));};exports[_0x83be('0x55')]=function(_0x3b6239,_0x5315c5,_0x5833bb){var _0x539e2d={};var _0x394bb4={};var _0x1bb0bd;var _0x32b61a;return db[_0x83be('0x43')]['findOne']({'where':{'id':_0x3b6239[_0x83be('0x47')]['id']}})['then'](handleEntityNotFound(_0x5315c5,null))['then'](function(_0x3c198f){if(_0x3c198f){_0x1bb0bd=_0x3c198f;_0x394bb4['model']=_['keys'](db[_0x83be('0x56')]['rawAttributes']);_0x394bb4['query']=_[_0x83be('0x48')](_0x3b6239[_0x83be('0x34')]);_0x394bb4['filters']=_[_0x83be('0x36')](_0x394bb4[_0x83be('0x33')],_0x394bb4[_0x83be('0x34')]);_0x539e2d[_0x83be('0x37')]=_[_0x83be('0x36')](_0x394bb4[_0x83be('0x33')],qs[_0x83be('0x38')](_0x3b6239['query']['fields']));_0x539e2d[_0x83be('0x37')]=_0x539e2d[_0x83be('0x37')][_0x83be('0x39')]?_0x539e2d[_0x83be('0x37')]:_0x394bb4[_0x83be('0x33')];_0x539e2d[_0x83be('0x50')]=qs['sort'](_0x3b6239['query'][_0x83be('0x51')]);_0x539e2d[_0x83be('0x3c')]=qs[_0x83be('0x35')](_[_0x83be('0x3d')](_0x3b6239[_0x83be('0x34')],_0x394bb4['filters']));if(_0x3b6239[_0x83be('0x34')][_0x83be('0x3e')]){_0x539e2d[_0x83be('0x3c')]=_['merge'](_0x539e2d['where'],{'$or':_[_0x83be('0x2e')](_0x539e2d[_0x83be('0x37')],function(_0x4889ba){var _0x18f36d={};_0x18f36d[_0x4889ba]={'$like':'%'+_0x3b6239['query'][_0x83be('0x3e')]+'%'};return _0x18f36d;})});}_0x539e2d=_[_0x83be('0x3f')]({},_0x539e2d,_0x3b6239[_0x83be('0x49')]);return _0x1bb0bd[_0x83be('0x55')](_0x539e2d);}})[_0x83be('0x27')](function(_0x5854f7){if(_0x5854f7){_0x32b61a=_0x5854f7[_0x83be('0x39')];if(!_0x3b6239['query']['hasOwnProperty'](_0x83be('0x3b'))){_0x539e2d[_0x83be('0x1e')]=qs[_0x83be('0x1e')](_0x3b6239['query'][_0x83be('0x1e')]);_0x539e2d[_0x83be('0x20')]=qs[_0x83be('0x20')](_0x3b6239[_0x83be('0x34')][_0x83be('0x20')]);}return _0x1bb0bd[_0x83be('0x55')](_0x539e2d);}})[_0x83be('0x27')](function(_0x1a6b98){if(_0x1a6b98){return _0x1a6b98?{'count':_0x32b61a,'rows':_0x1a6b98}:null;}})[_0x83be('0x27')](respondWithResult(_0x5315c5,null))['catch'](handleError(_0x5315c5,null));};exports[_0x83be('0x57')]=function(_0x43cc4c,_0x439d31,_0x5105ee){if(_0x43cc4c[_0x83be('0x4c')]['id']){delete _0x43cc4c[_0x83be('0x4c')]['id'];}return db['ZendeskConfiguration'][_0x83be('0x4e')]({'where':{'id':_0x43cc4c[_0x83be('0x47')]['id']}})[_0x83be('0x27')](handleEntityNotFound(_0x439d31,null))[_0x83be('0x27')](function(_0x507997){if(_0x507997){return _0x507997[_0x83be('0x57')](_0x43cc4c[_0x83be('0x4c')][_0x83be('0x58')]||[]);}return null;})[_0x83be('0x27')](respondWithResult(_0x439d31,null))[_0x83be('0x4a')](handleError(_0x439d31,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 61fad8d..709b15c 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 _0x5204=['request-promise','path','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','moment','bluebird'];(function(_0xbac1ec,_0x2f59dc){var _0x1d5ce9=function(_0x18c604){while(--_0x18c604){_0xbac1ec['push'](_0xbac1ec['shift']());}};_0x1d5ce9(++_0x2f59dc);}(_0x5204,0xdf));var _0x4520=function(_0x5ff517,_0x3e4ee0){_0x5ff517=_0x5ff517-0x0;var _0x19a245=_0x5204[_0x5ff517];return _0x19a245;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var logger=require('../../config/logger')(_0x4520('0x2'));var moment=require(_0x4520('0x3'));var BPromise=require(_0x4520('0x4'));var rp=require(_0x4520('0x5'));var fs=require('fs');var path=require(_0x4520('0x6'));var rimraf=require('rimraf');var config=require(_0x4520('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x4520('0x8')]=function(_0x209381,_0xe0a256){return _0x209381[_0x4520('0x9')](_0x4520('0xa'),attributes,{'tableName':_0x4520('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd824=['rimraf','../../config/environment','ZendeskConfiguration','int_zendesk_configurations','lodash','util','moment','bluebird','request-promise','path'];(function(_0x256b4d,_0x5b40f1){var _0x15f239=function(_0x2134d2){while(--_0x2134d2){_0x256b4d['push'](_0x256b4d['shift']());}};_0x15f239(++_0x5b40f1);}(_0xd824,0xc2));var _0x4d82=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd824[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4d82('0x2'));var BPromise=require(_0x4d82('0x3'));var rp=require(_0x4d82('0x4'));var fs=require('fs');var path=require(_0x4d82('0x5'));var rimraf=require(_0x4d82('0x6'));var config=require(_0x4d82('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0xd00023,_0x583c7c){return _0xd00023['define'](_0x4d82('0x8'),attributes,{'tableName':_0x4d82('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 2d109bc..76ea103 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 _0xf0c8=['../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x52cf62,_0x5de2c5){var _0x55b3d8=function(_0x2d586f){while(--_0x2d586f){_0x52cf62['push'](_0x52cf62['shift']());}};_0x55b3d8(++_0x5de2c5);}(_0xf0c8,0xaa));var _0x8f0c=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0xf0c8[_0x5d30b4];return _0x1acfb8;};'use strict';var _=require(_0x8f0c('0x0'));var util=require(_0x8f0c('0x1'));var moment=require(_0x8f0c('0x2'));var BPromise=require(_0x8f0c('0x3'));var rs=require(_0x8f0c('0x4'));var fs=require('fs');var Redis=require(_0x8f0c('0x5'));var db=require(_0x8f0c('0x6'))['db'];var utils=require(_0x8f0c('0x7'));var logger=require('../../config/logger')(_0x8f0c('0x8'));var config=require(_0x8f0c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8f0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fdb62,_0x8d802,_0x42b132){return new BPromise(function(_0x4e8edb,_0x195495){return client[_0x8f0c('0xb')](_0x1fdb62,_0x42b132)[_0x8f0c('0xc')](function(_0x28d423){logger[_0x8f0c('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x8d802,_0x8f0c('0xe'));logger[_0x8f0c('0xf')](_0x8f0c('0x10'),_0x8d802,_0x8f0c('0xe'),JSON['stringify'](_0x28d423));if(_0x28d423[_0x8f0c('0x11')]){if(_0x28d423[_0x8f0c('0x11')]['code']===0x1f4){logger['error'](_0x8f0c('0x12'),_0x8d802,_0x28d423[_0x8f0c('0x11')][_0x8f0c('0x13')]);return _0x195495(_0x28d423[_0x8f0c('0x11')][_0x8f0c('0x13')]);}logger[_0x8f0c('0x11')](_0x8f0c('0x12'),_0x8d802,_0x28d423[_0x8f0c('0x11')]['message']);return _0x4e8edb(_0x28d423[_0x8f0c('0x11')][_0x8f0c('0x13')]);}else{logger[_0x8f0c('0xd')](_0x8f0c('0x12'),_0x8d802,_0x8f0c('0xe'));_0x4e8edb(_0x28d423[_0x8f0c('0x14')]['message']);}})[_0x8f0c('0x15')](function(_0x50a03e){logger[_0x8f0c('0x11')](_0x8f0c('0x12'),_0x8d802,_0x50a03e);_0x195495(_0x50a03e);});});} \ No newline at end of file +var _0x1afb=['client','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x121718,_0x5f1531){var _0x2a84c8=function(_0x873654){while(--_0x873654){_0x121718['push'](_0x121718['shift']());}};_0x2a84c8(++_0x5f1531);}(_0x1afb,0xb2));var _0xb1af=function(_0x7a70dc,_0x899a7d){_0x7a70dc=_0x7a70dc-0x0;var _0x24ba20=_0x1afb[_0x7a70dc];return _0x24ba20;};'use strict';var _=require(_0xb1af('0x0'));var util=require(_0xb1af('0x1'));var moment=require(_0xb1af('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1af('0x3'));var fs=require('fs');var Redis=require(_0xb1af('0x4'));var db=require(_0xb1af('0x5'))['db'];var utils=require(_0xb1af('0x6'));var logger=require(_0xb1af('0x7'))(_0xb1af('0x8'));var config=require(_0xb1af('0x9'));var jayson=require(_0xb1af('0xa'));var client=jayson[_0xb1af('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x84286e,_0x59efda,_0x41a28b){return new BPromise(function(_0xb34814,_0x53d1bd){return client['request'](_0x84286e,_0x41a28b)[_0xb1af('0xc')](function(_0x43bdd8){logger[_0xb1af('0xd')](_0xb1af('0xe'),_0x59efda,_0xb1af('0xf'));logger['debug'](_0xb1af('0x10'),_0x59efda,_0xb1af('0xf'),JSON['stringify'](_0x43bdd8));if(_0x43bdd8[_0xb1af('0x11')]){if(_0x43bdd8['error'][_0xb1af('0x12')]===0x1f4){logger[_0xb1af('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x59efda,_0x43bdd8[_0xb1af('0x11')]['message']);return _0x53d1bd(_0x43bdd8[_0xb1af('0x11')][_0xb1af('0x13')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x59efda,_0x43bdd8[_0xb1af('0x11')][_0xb1af('0x13')]);return _0xb34814(_0x43bdd8[_0xb1af('0x11')]['message']);}else{logger[_0xb1af('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x59efda,_0xb1af('0xf'));_0xb34814(_0x43bdd8[_0xb1af('0x14')][_0xb1af('0x13')]);}})['catch'](function(_0x4386ba){logger[_0xb1af('0x11')](_0xb1af('0xe'),_0x59efda,_0x4386ba);_0x53d1bd(_0x4386ba);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 8ef5b90..4b68e4e 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 _0xaeae=['post','create','put','/:id','update','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','show'];(function(_0x4605dc,_0x3f7ae5){var _0x5d3e81=function(_0x1d0375){while(--_0x1d0375){_0x4605dc['push'](_0x4605dc['shift']());}};_0x5d3e81(++_0x3f7ae5);}(_0xaeae,0x166));var _0xeaea=function(_0x5be475,_0x43892e){_0x5be475=_0x5be475-0x0;var _0x47e579=_0xaeae[_0x5be475];return _0x47e579;};'use strict';var multer=require('multer');var util=require(_0xeaea('0x0'));var path=require('path');var timeout=require(_0xeaea('0x1'));var express=require(_0xeaea('0x2'));var router=express[_0xeaea('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xeaea('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xeaea('0x5'));var controller=require(_0xeaea('0x6'));router[_0xeaea('0x7')]('/',auth[_0xeaea('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xeaea('0x9')]);router[_0xeaea('0xa')]('/',auth[_0xeaea('0x8')](),controller[_0xeaea('0xb')]);router[_0xeaea('0xc')](_0xeaea('0xd'),auth[_0xeaea('0x8')](),controller[_0xeaea('0xe')]);router['delete'](_0xeaea('0xd'),auth[_0xeaea('0x8')](),controller['destroy']);module[_0xeaea('0xf')]=router; \ No newline at end of file +var _0xc999=['Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','express'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xc999,0x1de));var _0x9c99=function(_0x492af5,_0xd51471){_0x492af5=_0x492af5-0x0;var _0x59f529=_0xc999[_0x492af5];return _0x59f529;};'use strict';var multer=require(_0x9c99('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9c99('0x1'));var router=express[_0x9c99('0x2')]();var fs_extra=require(_0x9c99('0x3'));var auth=require(_0x9c99('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9c99('0x5'));var controller=require(_0x9c99('0x6'));router['get']('/',auth[_0x9c99('0x7')](),controller[_0x9c99('0x8')]);router['get'](_0x9c99('0x9'),auth[_0x9c99('0x7')](),controller[_0x9c99('0xa')]);router['post']('/',auth[_0x9c99('0x7')](),controller[_0x9c99('0xb')]);router[_0x9c99('0xc')](_0x9c99('0x9'),auth[_0x9c99('0x7')](),controller['update']);router[_0x9c99('0xd')](_0x9c99('0x9'),auth[_0x9c99('0x7')](),controller[_0x9c99('0xe')]);module[_0x9c99('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 38cb43e..0bc90b1 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 _0x932c=['picklist','STRING','string','customVariable','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x2110d4,_0x20b1d5){var _0x2bcdf6=function(_0x1e9204){while(--_0x1e9204){_0x2110d4['push'](_0x2110d4['shift']());}};_0x2bcdf6(++_0x20b1d5);}(_0x932c,0xb9));var _0xc932=function(_0x2c6810,_0x23c079){_0x2c6810=_0x2c6810-0x0;var _0x213881=_0x932c[_0x2c6810];return _0x213881;};'use strict';var Sequelize=require(_0xc932('0x0'));module[_0xc932('0x1')]={'type':{'type':Sequelize[_0xc932('0x2')]('string',_0xc932('0x3'),'customVariable','keyValue',_0xc932('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc932('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc932('0x2')](_0xc932('0x6'),_0xc932('0x3'),_0xc932('0x7'))},'keyContent':{'type':Sequelize[_0xc932('0x5')]},'idField':{'type':Sequelize[_0xc932('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc932('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc932('0x5')]}}; \ No newline at end of file +var _0x0d50=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','STRING','string','BOOLEAN'];(function(_0x2b1870,_0x4ac37c){var _0x8815ab=function(_0x5bc306){while(--_0x5bc306){_0x2b1870['push'](_0x2b1870['shift']());}};_0x8815ab(++_0x4ac37c);}(_0x0d50,0x14a));var _0x00d5=function(_0xfb29db,_0x4d36bf){_0xfb29db=_0xfb29db-0x0;var _0x4823e1=_0x0d50[_0xfb29db];return _0x4823e1;};'use strict';var Sequelize=require(_0x00d5('0x0'));module[_0x00d5('0x1')]={'type':{'type':Sequelize[_0x00d5('0x2')]('string',_0x00d5('0x3'),_0x00d5('0x4'),_0x00d5('0x5'),_0x00d5('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x00d5('0x7')]},'key':{'type':Sequelize[_0x00d5('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x00d5('0x8'),_0x00d5('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x00d5('0x7')]},'idField':{'type':Sequelize[_0x00d5('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x00d5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x00d5('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index b8f2234..ab43295 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 _0x8d53=['lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','ZendeskField','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x1f6a76,_0x1d89c0){var _0x5bd07d=function(_0x2d9bb7){while(--_0x2d9bb7){_0x1f6a76['push'](_0x1f6a76['shift']());}};_0x5bd07d(++_0x1d89c0);}(_0x8d53,0x1c2));var _0x38d5=function(_0x2e8889,_0xcd72f9){_0x2e8889=_0x2e8889-0x0;var _0x19dae6=_0x8d53[_0x2e8889];return _0x19dae6;};'use strict';var emlformat=require(_0x38d5('0x0'));var rimraf=require(_0x38d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38d5('0x2'));var rp=require(_0x38d5('0x3'));var moment=require(_0x38d5('0x4'));var BPromise=require(_0x38d5('0x5'));var Mustache=require(_0x38d5('0x6'));var util=require(_0x38d5('0x7'));var path=require(_0x38d5('0x8'));var sox=require(_0x38d5('0x9'));var csv=require('to-csv');var ejs=require(_0x38d5('0xa'));var fs=require('fs');var fs_extra=require(_0x38d5('0xb'));var _=require(_0x38d5('0xc'));var squel=require('squel');var crypto=require(_0x38d5('0xd'));var jsforce=require(_0x38d5('0xe'));var deskjs=require(_0x38d5('0xf'));var toCsv=require(_0x38d5('0x10'));var querystring=require(_0x38d5('0x11'));var Papa=require('papaparse');var Redis=require(_0x38d5('0x12'));var authService=require(_0x38d5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x38d5('0x14'));var hardwareService=require(_0x38d5('0x15'));var logger=require(_0x38d5('0x16'))(_0x38d5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x38d5('0x18'));var db=require(_0x38d5('0x19'))['db'];function respondWithStatusCode(_0x53c236,_0x421410){_0x421410=_0x421410||0xcc;return function(_0x4dbccf){if(_0x4dbccf){return _0x53c236[_0x38d5('0x1a')](_0x421410);}return _0x53c236[_0x38d5('0x1b')](_0x421410)[_0x38d5('0x1c')]();};}function respondWithResult(_0x413055,_0x217a90){_0x217a90=_0x217a90||0xc8;return function(_0x3115b5){if(_0x3115b5){return _0x413055['status'](_0x217a90)[_0x38d5('0x1d')](_0x3115b5);}};}function respondWithFilteredResult(_0x4c8f0f,_0xa455d1){return function(_0x53e995){if(_0x53e995){var _0x44cfa8=typeof _0xa455d1[_0x38d5('0x1e')]===_0x38d5('0x1f')&&typeof _0xa455d1['limit']===_0x38d5('0x1f');var _0x2a2b7d=_0x53e995[_0x38d5('0x20')];var _0xdc1374=_0x44cfa8?0x0:_0xa455d1[_0x38d5('0x1e')];var _0x380904=_0x44cfa8?_0x53e995['count']:_0xa455d1[_0x38d5('0x1e')]+_0xa455d1['limit'];var _0x55c0e1;if(_0x380904>=_0x2a2b7d){_0x380904=_0x2a2b7d;_0x55c0e1=0xc8;}else{_0x55c0e1=0xce;}_0x4c8f0f['status'](_0x55c0e1);return _0x4c8f0f[_0x38d5('0x21')](_0x38d5('0x22'),_0xdc1374+'-'+_0x380904+'/'+_0x2a2b7d)[_0x38d5('0x1d')](_0x53e995);}return null;};}function patchUpdates(_0x4c7ce3){return function(_0x48eb53){try{jsonpatch[_0x38d5('0x23')](_0x48eb53,_0x4c7ce3,!![]);}catch(_0x1c5289){return BPromise[_0x38d5('0x24')](_0x1c5289);}return _0x48eb53['save']();};}function saveUpdates(_0x3eb7d1,_0x58d42a){return function(_0x83a6be){if(_0x83a6be){return _0x83a6be[_0x38d5('0x25')](_0x3eb7d1)['then'](function(_0x567ef9){return _0x567ef9;});}return null;};}function removeEntity(_0x34d764,_0x4e1b5f){return function(_0x3d1c85){if(_0x3d1c85){return _0x3d1c85['destroy']()[_0x38d5('0x26')](function(){_0x34d764[_0x38d5('0x1b')](0xcc)[_0x38d5('0x1c')]();});}};}function handleEntityNotFound(_0x5b9552,_0x4b33ea){return function(_0x44b0d5){if(!_0x44b0d5){_0x5b9552['sendStatus'](0x194);}return _0x44b0d5;};}function handleError(_0x35e2ff,_0x1f8d11){_0x1f8d11=_0x1f8d11||0x1f4;return function(_0x12d220){logger[_0x38d5('0x27')](_0x12d220[_0x38d5('0x28')]);if(_0x12d220[_0x38d5('0x29')]){delete _0x12d220[_0x38d5('0x29')];}_0x35e2ff[_0x38d5('0x1b')](_0x1f8d11)[_0x38d5('0x2a')](_0x12d220);};}exports[_0x38d5('0x2b')]=function(_0x33d883,_0x3a8879){var _0x341af1={},_0x5dd0c1={},_0x514d2f={'count':0x0,'rows':[]};var _0x55a6d7=_[_0x38d5('0x2c')](db[_0x38d5('0x2d')]['rawAttributes'],function(_0x2f44be){return{'name':_0x2f44be[_0x38d5('0x2e')],'type':_0x2f44be[_0x38d5('0x2f')][_0x38d5('0x30')]};});_0x5dd0c1[_0x38d5('0x31')]=_['map'](_0x55a6d7,_0x38d5('0x29'));_0x5dd0c1[_0x38d5('0x32')]=_[_0x38d5('0x33')](_0x33d883[_0x38d5('0x32')]);_0x5dd0c1['filters']=_[_0x38d5('0x34')](_0x5dd0c1['model'],_0x5dd0c1[_0x38d5('0x32')]);_0x341af1['attributes']=_[_0x38d5('0x34')](_0x5dd0c1[_0x38d5('0x31')],qs['fields'](_0x33d883[_0x38d5('0x32')][_0x38d5('0x35')]));_0x341af1[_0x38d5('0x36')]=_0x341af1['attributes'][_0x38d5('0x37')]?_0x341af1['attributes']:_0x5dd0c1[_0x38d5('0x31')];if(!_0x33d883[_0x38d5('0x32')][_0x38d5('0x38')](_0x38d5('0x39'))){_0x341af1['limit']=qs[_0x38d5('0x3a')](_0x33d883[_0x38d5('0x32')]['limit']);_0x341af1[_0x38d5('0x1e')]=qs[_0x38d5('0x1e')](_0x33d883[_0x38d5('0x32')][_0x38d5('0x1e')]);}_0x341af1[_0x38d5('0x3b')]=qs[_0x38d5('0x3c')](_0x33d883[_0x38d5('0x32')][_0x38d5('0x3c')]);_0x341af1['where']=qs[_0x38d5('0x3d')](_['pick'](_0x33d883[_0x38d5('0x32')],_0x5dd0c1[_0x38d5('0x3d')]),_0x55a6d7);if(_0x33d883[_0x38d5('0x32')]['filter']){_0x341af1['where']=_[_0x38d5('0x3e')](_0x341af1[_0x38d5('0x3f')],{'$or':_[_0x38d5('0x2c')](_0x55a6d7,function(_0x4affd3){if(_0x4affd3['type']!==_0x38d5('0x40')){var _0x34b7ca={};_0x34b7ca[_0x4affd3[_0x38d5('0x29')]]={'$like':'%'+_0x33d883[_0x38d5('0x32')]['filter']+'%'};return _0x34b7ca;}})});}_0x341af1=_[_0x38d5('0x3e')]({},_0x341af1,_0x33d883[_0x38d5('0x41')]);var _0x3d16eb={'where':_0x341af1[_0x38d5('0x3f')]};return db['ZendeskField']['count'](_0x3d16eb)['then'](function(_0x13ef36){_0x514d2f[_0x38d5('0x20')]=_0x13ef36;if(_0x33d883[_0x38d5('0x32')][_0x38d5('0x42')]){_0x341af1[_0x38d5('0x43')]=[{'all':!![]}];}return db[_0x38d5('0x2d')]['findAll'](_0x341af1);})[_0x38d5('0x26')](function(_0x2d8122){_0x514d2f[_0x38d5('0x44')]=_0x2d8122;return _0x514d2f;})[_0x38d5('0x26')](respondWithFilteredResult(_0x3a8879,_0x341af1))[_0x38d5('0x45')](handleError(_0x3a8879,null));};exports[_0x38d5('0x46')]=function(_0x5bbada,_0x38d4cf){var _0xdd589e={'raw':!![],'where':{'id':_0x5bbada[_0x38d5('0x47')]['id']}},_0x48612c={};_0x48612c[_0x38d5('0x31')]=_[_0x38d5('0x33')](db[_0x38d5('0x2d')][_0x38d5('0x48')]);_0x48612c[_0x38d5('0x32')]=_[_0x38d5('0x33')](_0x5bbada[_0x38d5('0x32')]);_0x48612c['filters']=_[_0x38d5('0x34')](_0x48612c['model'],_0x48612c['query']);_0xdd589e[_0x38d5('0x36')]=_['intersection'](_0x48612c['model'],qs['fields'](_0x5bbada['query']['fields']));_0xdd589e['attributes']=_0xdd589e['attributes']['length']?_0xdd589e[_0x38d5('0x36')]:_0x48612c[_0x38d5('0x31')];if(_0x5bbada[_0x38d5('0x32')][_0x38d5('0x42')]){_0xdd589e[_0x38d5('0x43')]=[{'all':!![]}];}_0xdd589e=_[_0x38d5('0x3e')]({},_0xdd589e,_0x5bbada[_0x38d5('0x41')]);return db[_0x38d5('0x2d')][_0x38d5('0x49')](_0xdd589e)[_0x38d5('0x26')](handleEntityNotFound(_0x38d4cf,null))[_0x38d5('0x26')](respondWithResult(_0x38d4cf,null))[_0x38d5('0x45')](handleError(_0x38d4cf,null));};exports[_0x38d5('0x4a')]=function(_0x11f266,_0x22b866){return db[_0x38d5('0x2d')][_0x38d5('0x4a')](_0x11f266[_0x38d5('0x4b')],{})[_0x38d5('0x26')](respondWithResult(_0x22b866,0xc9))['catch'](handleError(_0x22b866,null));};exports['update']=function(_0x4bdd78,_0x91cd1d){if(_0x4bdd78[_0x38d5('0x4b')]['id']){delete _0x4bdd78[_0x38d5('0x4b')]['id'];}return db[_0x38d5('0x2d')][_0x38d5('0x49')]({'where':{'id':_0x4bdd78[_0x38d5('0x47')]['id']}})[_0x38d5('0x26')](handleEntityNotFound(_0x91cd1d,null))[_0x38d5('0x26')](saveUpdates(_0x4bdd78[_0x38d5('0x4b')],null))[_0x38d5('0x26')](respondWithResult(_0x91cd1d,null))[_0x38d5('0x45')](handleError(_0x91cd1d,null));};exports[_0x38d5('0x4c')]=function(_0x2810c4,_0x2aa73d){return db['ZendeskField'][_0x38d5('0x49')]({'where':{'id':_0x2810c4[_0x38d5('0x47')]['id']}})[_0x38d5('0x26')](handleEntityNotFound(_0x2aa73d,null))[_0x38d5('0x26')](removeEntity(_0x2aa73d,null))['catch'](handleError(_0x2aa73d,null));}; \ No newline at end of file +var _0x048c=['eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','undefined','offset','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','ZendeskField','count','includeAll','include','findAll','catch','show','params','keys','find','create','body'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x048c,0xdb));var _0xc048=function(_0x59cb5d,_0x40bcc9){_0x59cb5d=_0x59cb5d-0x0;var _0x40be84=_0x048c[_0x59cb5d];return _0x40be84;};'use strict';var emlformat=require(_0xc048('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc048('0x1'));var rp=require('request-promise');var moment=require(_0xc048('0x2'));var BPromise=require(_0xc048('0x3'));var Mustache=require('mustache');var util=require(_0xc048('0x4'));var path=require(_0xc048('0x5'));var sox=require(_0xc048('0x6'));var csv=require(_0xc048('0x7'));var ejs=require(_0xc048('0x8'));var fs=require('fs');var fs_extra=require(_0xc048('0x9'));var _=require(_0xc048('0xa'));var squel=require(_0xc048('0xb'));var crypto=require('crypto');var jsforce=require(_0xc048('0xc'));var deskjs=require(_0xc048('0xd'));var toCsv=require(_0xc048('0x7'));var querystring=require(_0xc048('0xe'));var Papa=require(_0xc048('0xf'));var Redis=require(_0xc048('0x10'));var authService=require(_0xc048('0x11'));var qs=require(_0xc048('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc048('0x13'));var logger=require(_0xc048('0x14'))(_0xc048('0x15'));var utils=require(_0xc048('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc048('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x215da1,_0x51bb57){_0x51bb57=_0x51bb57||0xcc;return function(_0x44e03f){if(_0x44e03f){return _0x215da1[_0xc048('0x18')](_0x51bb57);}return _0x215da1[_0xc048('0x19')](_0x51bb57)[_0xc048('0x1a')]();};}function respondWithResult(_0x3c0a79,_0x3c7e07){_0x3c7e07=_0x3c7e07||0xc8;return function(_0x20b0bc){if(_0x20b0bc){return _0x3c0a79[_0xc048('0x19')](_0x3c7e07)[_0xc048('0x1b')](_0x20b0bc);}};}function respondWithFilteredResult(_0x180a5b,_0x1505ef){return function(_0x7a8ac6){if(_0x7a8ac6){var _0x17f007=typeof _0x1505ef['offset']==='undefined'&&typeof _0x1505ef[_0xc048('0x1c')]===_0xc048('0x1d');var _0x193a74=_0x7a8ac6['count'];var _0xb76ff8=_0x17f007?0x0:_0x1505ef[_0xc048('0x1e')];var _0x32d229=_0x17f007?_0x7a8ac6['count']:_0x1505ef[_0xc048('0x1e')]+_0x1505ef[_0xc048('0x1c')];var _0x11531b;if(_0x32d229>=_0x193a74){_0x32d229=_0x193a74;_0x11531b=0xc8;}else{_0x11531b=0xce;}_0x180a5b[_0xc048('0x19')](_0x11531b);return _0x180a5b['set'](_0xc048('0x1f'),_0xb76ff8+'-'+_0x32d229+'/'+_0x193a74)['json'](_0x7a8ac6);}return null;};}function patchUpdates(_0x2efc0b){return function(_0x3d55fb){try{jsonpatch['apply'](_0x3d55fb,_0x2efc0b,!![]);}catch(_0x49bdc4){return BPromise[_0xc048('0x20')](_0x49bdc4);}return _0x3d55fb[_0xc048('0x21')]();};}function saveUpdates(_0x401bb5,_0x58973c){return function(_0x2ba571){if(_0x2ba571){return _0x2ba571[_0xc048('0x22')](_0x401bb5)['then'](function(_0x1a854d){return _0x1a854d;});}return null;};}function removeEntity(_0x35160c,_0xa2a309){return function(_0x4f4d3c){if(_0x4f4d3c){return _0x4f4d3c[_0xc048('0x23')]()[_0xc048('0x24')](function(){_0x35160c['status'](0xcc)[_0xc048('0x1a')]();});}};}function handleEntityNotFound(_0x44c3a0,_0x23c014){return function(_0xf2b8f3){if(!_0xf2b8f3){_0x44c3a0[_0xc048('0x18')](0x194);}return _0xf2b8f3;};}function handleError(_0x18a03a,_0x24b4e6){_0x24b4e6=_0x24b4e6||0x1f4;return function(_0x41de32){logger[_0xc048('0x25')](_0x41de32[_0xc048('0x26')]);if(_0x41de32['name']){delete _0x41de32[_0xc048('0x27')];}_0x18a03a['status'](_0x24b4e6)[_0xc048('0x28')](_0x41de32);};}exports[_0xc048('0x29')]=function(_0x312d00,_0x1cda79){var _0x3a421a={},_0x338747={},_0xd1883e={'count':0x0,'rows':[]};var _0x36f75c=_['map'](db['ZendeskField'][_0xc048('0x2a')],function(_0x25be0f){return{'name':_0x25be0f[_0xc048('0x2b')],'type':_0x25be0f[_0xc048('0x2c')]['key']};});_0x338747[_0xc048('0x2d')]=_[_0xc048('0x2e')](_0x36f75c,_0xc048('0x27'));_0x338747[_0xc048('0x2f')]=_['keys'](_0x312d00[_0xc048('0x2f')]);_0x338747[_0xc048('0x30')]=_[_0xc048('0x31')](_0x338747['model'],_0x338747['query']);_0x3a421a[_0xc048('0x32')]=_[_0xc048('0x31')](_0x338747[_0xc048('0x2d')],qs['fields'](_0x312d00[_0xc048('0x2f')][_0xc048('0x33')]));_0x3a421a['attributes']=_0x3a421a[_0xc048('0x32')]['length']?_0x3a421a[_0xc048('0x32')]:_0x338747[_0xc048('0x2d')];if(!_0x312d00[_0xc048('0x2f')][_0xc048('0x34')](_0xc048('0x35'))){_0x3a421a['limit']=qs['limit'](_0x312d00[_0xc048('0x2f')][_0xc048('0x1c')]);_0x3a421a[_0xc048('0x1e')]=qs[_0xc048('0x1e')](_0x312d00['query'][_0xc048('0x1e')]);}_0x3a421a[_0xc048('0x36')]=qs[_0xc048('0x37')](_0x312d00[_0xc048('0x2f')][_0xc048('0x37')]);_0x3a421a[_0xc048('0x38')]=qs[_0xc048('0x30')](_[_0xc048('0x39')](_0x312d00[_0xc048('0x2f')],_0x338747['filters']),_0x36f75c);if(_0x312d00[_0xc048('0x2f')]['filter']){_0x3a421a[_0xc048('0x38')]=_[_0xc048('0x3a')](_0x3a421a[_0xc048('0x38')],{'$or':_[_0xc048('0x2e')](_0x36f75c,function(_0x39e2de){if(_0x39e2de['type']!==_0xc048('0x3b')){var _0x11317c={};_0x11317c[_0x39e2de[_0xc048('0x27')]]={'$like':'%'+_0x312d00['query'][_0xc048('0x3c')]+'%'};return _0x11317c;}})});}_0x3a421a=_['merge']({},_0x3a421a,_0x312d00['options']);var _0x13a9a0={'where':_0x3a421a[_0xc048('0x38')]};return db[_0xc048('0x3d')][_0xc048('0x3e')](_0x13a9a0)['then'](function(_0x5b51b6){_0xd1883e[_0xc048('0x3e')]=_0x5b51b6;if(_0x312d00[_0xc048('0x2f')][_0xc048('0x3f')]){_0x3a421a[_0xc048('0x40')]=[{'all':!![]}];}return db['ZendeskField'][_0xc048('0x41')](_0x3a421a);})[_0xc048('0x24')](function(_0xbc32ba){_0xd1883e['rows']=_0xbc32ba;return _0xd1883e;})[_0xc048('0x24')](respondWithFilteredResult(_0x1cda79,_0x3a421a))[_0xc048('0x42')](handleError(_0x1cda79,null));};exports[_0xc048('0x43')]=function(_0x46808e,_0x45af30){var _0x3846f6={'raw':!![],'where':{'id':_0x46808e[_0xc048('0x44')]['id']}},_0xbdbf98={};_0xbdbf98[_0xc048('0x2d')]=_[_0xc048('0x45')](db[_0xc048('0x3d')][_0xc048('0x2a')]);_0xbdbf98[_0xc048('0x2f')]=_[_0xc048('0x45')](_0x46808e[_0xc048('0x2f')]);_0xbdbf98[_0xc048('0x30')]=_[_0xc048('0x31')](_0xbdbf98['model'],_0xbdbf98[_0xc048('0x2f')]);_0x3846f6[_0xc048('0x32')]=_[_0xc048('0x31')](_0xbdbf98[_0xc048('0x2d')],qs[_0xc048('0x33')](_0x46808e['query'][_0xc048('0x33')]));_0x3846f6[_0xc048('0x32')]=_0x3846f6[_0xc048('0x32')]['length']?_0x3846f6[_0xc048('0x32')]:_0xbdbf98[_0xc048('0x2d')];if(_0x46808e[_0xc048('0x2f')][_0xc048('0x3f')]){_0x3846f6[_0xc048('0x40')]=[{'all':!![]}];}_0x3846f6=_['merge']({},_0x3846f6,_0x46808e['options']);return db[_0xc048('0x3d')][_0xc048('0x46')](_0x3846f6)['then'](handleEntityNotFound(_0x45af30,null))[_0xc048('0x24')](respondWithResult(_0x45af30,null))[_0xc048('0x42')](handleError(_0x45af30,null));};exports['create']=function(_0x24f338,_0x57c3aa){return db['ZendeskField'][_0xc048('0x47')](_0x24f338[_0xc048('0x48')],{})['then'](respondWithResult(_0x57c3aa,0xc9))[_0xc048('0x42')](handleError(_0x57c3aa,null));};exports[_0xc048('0x22')]=function(_0x2ce0e6,_0x1de5a1){if(_0x2ce0e6[_0xc048('0x48')]['id']){delete _0x2ce0e6['body']['id'];}return db['ZendeskField']['find']({'where':{'id':_0x2ce0e6['params']['id']}})['then'](handleEntityNotFound(_0x1de5a1,null))[_0xc048('0x24')](saveUpdates(_0x2ce0e6[_0xc048('0x48')],null))['then'](respondWithResult(_0x1de5a1,null))[_0xc048('0x42')](handleError(_0x1de5a1,null));};exports[_0xc048('0x23')]=function(_0x42e6d8,_0xc0a463){return db[_0xc048('0x3d')][_0xc048('0x46')]({'where':{'id':_0x42e6d8[_0xc048('0x44')]['id']}})[_0xc048('0x24')](handleEntityNotFound(_0xc0a463,null))[_0xc048('0x24')](removeEntity(_0xc0a463,null))[_0xc048('0x42')](handleError(_0xc0a463,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 1e2ac10..619e796 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 _0x1e4e=['bluebird','request-promise','path','rimraf','../../config/environment','define','ZendeskField','int_zendesk_fields','FieldId','../../config/logger','api'];(function(_0x43fe0a,_0x4af4de){var _0x1d1f67=function(_0x3d6d0d){while(--_0x3d6d0d){_0x43fe0a['push'](_0x43fe0a['shift']());}};_0x1d1f67(++_0x4af4de);}(_0x1e4e,0x82));var _0xe1e4=function(_0x518f96,_0x1942b2){_0x518f96=_0x518f96-0x0;var _0x48d7b9=_0x1e4e[_0x518f96];return _0x48d7b9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe1e4('0x0'))(_0xe1e4('0x1'));var moment=require('moment');var BPromise=require(_0xe1e4('0x2'));var rp=require(_0xe1e4('0x3'));var fs=require('fs');var path=require(_0xe1e4('0x4'));var rimraf=require(_0xe1e4('0x5'));var config=require(_0xe1e4('0x6'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x2bfadb,_0x5f185b){return _0x2bfadb[_0xe1e4('0x7')](_0xe1e4('0x8'),attributes,{'tableName':_0xe1e4('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xe1e4('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x03b8=['path','rimraf','../../config/environment','define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x2d6e95,_0x15c8eb){var _0x90e3c9=function(_0x4a3b47){while(--_0x4a3b47){_0x2d6e95['push'](_0x2d6e95['shift']());}};_0x90e3c9(++_0x15c8eb);}(_0x03b8,0x1ac));var _0x803b=function(_0x50fc46,_0x150573){_0x50fc46=_0x50fc46-0x0;var _0x3888b0=_0x03b8[_0x50fc46];return _0x3888b0;};'use strict';var _=require(_0x803b('0x0'));var util=require(_0x803b('0x1'));var logger=require(_0x803b('0x2'))(_0x803b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x803b('0x4'));var rimraf=require(_0x803b('0x5'));var config=require(_0x803b('0x6'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0xa7437b,_0x28901e){return _0xa7437b[_0x803b('0x7')](_0x803b('0x8'),attributes,{'tableName':_0x803b('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x803b('0xa'),_0x803b('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 295446d..e46f4a6 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 _0x46d2=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x262c5f,_0x5ed814){var _0x14a0bc=function(_0x519217){while(--_0x519217){_0x262c5f['push'](_0x262c5f['shift']());}};_0x14a0bc(++_0x5ed814);}(_0x46d2,0xbf));var _0x246d=function(_0x262f19,_0x34e866){_0x262f19=_0x262f19-0x0;var _0xf0ae2f=_0x46d2[_0x262f19];return _0xf0ae2f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x246d('0x0'));var BPromise=require(_0x246d('0x1'));var rs=require(_0x246d('0x2'));var fs=require('fs');var Redis=require(_0x246d('0x3'));var db=require(_0x246d('0x4'))['db'];var utils=require(_0x246d('0x5'));var logger=require(_0x246d('0x6'))('rpc');var config=require(_0x246d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x246d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d3288,_0x162cf0,_0x457f7){return new BPromise(function(_0x20d754,_0x54366a){return client[_0x246d('0x9')](_0x3d3288,_0x457f7)[_0x246d('0xa')](function(_0x451197){logger['info'](_0x246d('0xb'),_0x162cf0,_0x246d('0xc'));logger[_0x246d('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x162cf0,'request\x20sent',JSON[_0x246d('0xe')](_0x451197));if(_0x451197[_0x246d('0xf')]){if(_0x451197[_0x246d('0xf')]['code']===0x1f4){logger['error'](_0x246d('0xb'),_0x162cf0,_0x451197[_0x246d('0xf')]['message']);return _0x54366a(_0x451197['error'][_0x246d('0x10')]);}logger[_0x246d('0xf')](_0x246d('0xb'),_0x162cf0,_0x451197[_0x246d('0xf')][_0x246d('0x10')]);return _0x20d754(_0x451197[_0x246d('0xf')]['message']);}else{logger['info'](_0x246d('0xb'),_0x162cf0,'request\x20sent');_0x20d754(_0x451197[_0x246d('0x11')][_0x246d('0x10')]);}})[_0x246d('0x12')](function(_0x1e4c56){logger[_0x246d('0xf')](_0x246d('0xb'),_0x162cf0,_0x1e4c56);_0x54366a(_0x1e4c56);});});} \ No newline at end of file +var _0x669b=['ZendeskField,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3878e9,_0x14fcf2){var _0x2ad526=function(_0x1bd76b){while(--_0x1bd76b){_0x3878e9['push'](_0x3878e9['shift']());}};_0x2ad526(++_0x14fcf2);}(_0x669b,0x10b));var _0xb669=function(_0x4cdf63,_0x44fffc){_0x4cdf63=_0x4cdf63-0x0;var _0xdf043b=_0x669b[_0x4cdf63];return _0xdf043b;};'use strict';var _=require(_0xb669('0x0'));var util=require(_0xb669('0x1'));var moment=require('moment');var BPromise=require(_0xb669('0x2'));var rs=require(_0xb669('0x3'));var fs=require('fs');var Redis=require(_0xb669('0x4'));var db=require(_0xb669('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb669('0x6'))(_0xb669('0x7'));var config=require(_0xb669('0x8'));var jayson=require(_0xb669('0x9'));var client=jayson[_0xb669('0xa')][_0xb669('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfe9d56,_0x34e11d,_0x30be44){return new BPromise(function(_0x6a0fae,_0x36c93e){return client[_0xb669('0xc')](_0xfe9d56,_0x30be44)[_0xb669('0xd')](function(_0x1bc930){logger[_0xb669('0xe')]('ZendeskField,\x20%s,\x20%s',_0x34e11d,_0xb669('0xf'));logger[_0xb669('0x10')](_0xb669('0x11'),_0x34e11d,_0xb669('0xf'),JSON[_0xb669('0x12')](_0x1bc930));if(_0x1bc930[_0xb669('0x13')]){if(_0x1bc930['error'][_0xb669('0x14')]===0x1f4){logger[_0xb669('0x13')](_0xb669('0x15'),_0x34e11d,_0x1bc930[_0xb669('0x13')][_0xb669('0x16')]);return _0x36c93e(_0x1bc930[_0xb669('0x13')]['message']);}logger[_0xb669('0x13')](_0xb669('0x15'),_0x34e11d,_0x1bc930[_0xb669('0x13')]['message']);return _0x6a0fae(_0x1bc930[_0xb669('0x13')][_0xb669('0x16')]);}else{logger[_0xb669('0xe')](_0xb669('0x15'),_0x34e11d,_0xb669('0xf'));_0x6a0fae(_0x1bc930[_0xb669('0x17')]['message']);}})['catch'](function(_0x479536){logger[_0xb669('0x13')](_0xb669('0x15'),_0x34e11d,_0x479536);_0x36c93e(_0x479536);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 54b678f..b12eb0d 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 _0x6324=['create','post','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields'];(function(_0x433b8c,_0xa246f1){var _0x37d1a2=function(_0x75df79){while(--_0x75df79){_0x433b8c['push'](_0x433b8c['shift']());}};_0x37d1a2(++_0xa246f1);}(_0x6324,0x110));var _0x4632=function(_0x14909f,_0xe25f2e){_0x14909f=_0x14909f-0x0;var _0x19698c=_0x6324[_0x14909f];return _0x19698c;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require(_0x4632('0x5'));var auth=require(_0x4632('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x7'));var controller=require('./intZohoAccount.controller');router[_0x4632('0x8')]('/',auth[_0x4632('0x9')](),controller[_0x4632('0xa')]);router[_0x4632('0x8')](_0x4632('0xb'),auth[_0x4632('0x9')](),controller[_0x4632('0xc')]);router[_0x4632('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4632('0xd')]);router['get'](_0x4632('0xe'),auth['isAuthenticated'](),controller[_0x4632('0xf')]);router['post']('/',auth[_0x4632('0x9')](),controller[_0x4632('0x10')]);router[_0x4632('0x11')](_0x4632('0x12'),auth[_0x4632('0x9')](),controller[_0x4632('0x13')]);router[_0x4632('0x14')](_0x4632('0xb'),auth[_0x4632('0x9')](),controller['update']);router[_0x4632('0x15')](_0x4632('0xb'),auth[_0x4632('0x9')](),controller[_0x4632('0x16')]);module[_0x4632('0x17')]=router; \ No newline at end of file +var _0xa971=['get','/:id','show','/:id/fields','getFields','create','put','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','isAuthenticated','index'];(function(_0x2c79e2,_0x2a09b4){var _0x78fb1e=function(_0x26c0b5){while(--_0x26c0b5){_0x2c79e2['push'](_0x2c79e2['shift']());}};_0x78fb1e(++_0x2a09b4);}(_0xa971,0x9a));var _0x1a97=function(_0x619e8f,_0x2cdb21){_0x619e8f=_0x619e8f-0x0;var _0x251072=_0xa971[_0x619e8f];return _0x251072;};'use strict';var multer=require(_0x1a97('0x0'));var util=require(_0x1a97('0x1'));var path=require('path');var timeout=require(_0x1a97('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1a97('0x3'));var interaction=require(_0x1a97('0x4'));var config=require('../../config/environment');var controller=require(_0x1a97('0x5'));router['get']('/',auth[_0x1a97('0x6')](),controller[_0x1a97('0x7')]);router[_0x1a97('0x8')](_0x1a97('0x9'),auth[_0x1a97('0x6')](),controller[_0x1a97('0xa')]);router[_0x1a97('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x1a97('0xb'),auth[_0x1a97('0x6')](),controller[_0x1a97('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1a97('0xd')]);router['post']('/:id/configurations',auth[_0x1a97('0x6')](),controller['addConfiguration']);router[_0x1a97('0xe')]('/:id',auth[_0x1a97('0x6')](),controller['update']);router[_0x1a97('0xf')]('/:id',auth[_0x1a97('0x6')](),controller[_0x1a97('0x10')]);module[_0x1a97('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index b70d47f..b473c5a 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 _0x4522=['STRING'];(function(_0x4f7083,_0x12577a){var _0x3e30f8=function(_0x96847e){while(--_0x96847e){_0x4f7083['push'](_0x4f7083['shift']());}};_0x3e30f8(++_0x12577a);}(_0x4522,0x1a0));var _0x2452=function(_0x180b9c,_0x663206){_0x180b9c=_0x180b9c-0x0;var _0x51baad=_0x4522[_0x180b9c];return _0x51baad;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2452('0x0')]},'description':{'type':Sequelize[_0x2452('0x0')]},'host':{'type':Sequelize[_0x2452('0x0')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2452('0x0')]},'clientSecret':{'type':Sequelize[_0x2452('0x0')]},'serverUrl':{'type':Sequelize[_0x2452('0x0')],'allowNull':![]},'code':{'type':Sequelize[_0x2452('0x0')]},'refreshToken':{'type':Sequelize[_0x2452('0x0')]}}; \ No newline at end of file +var _0xbec5=['STRING','sequelize','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbec5,0xe5));var _0x5bec=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0xbec5[_0x4709c8];return _0x478cdd;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5bec('0x2')]},'host':{'type':Sequelize[_0x5bec('0x2')]},'zone':{'type':Sequelize[_0x5bec('0x2')]},'clientId':{'type':Sequelize[_0x5bec('0x2')]},'clientSecret':{'type':Sequelize[_0x5bec('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x5bec('0x2')]},'refreshToken':{'type':Sequelize[_0x5bec('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index f45f1fb..a1313cf 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 _0x8ef1=['access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','code','zoho.eu','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','ZohoAccount','includeAll','include','show','params','create','body','find','catch','findOne','ZohoConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ef1,0x190));var _0x18ef=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x8ef1[_0x40a825];return _0x273a54;};'use strict';var emlformat=require(_0x18ef('0x0'));var rimraf=require(_0x18ef('0x1'));var zipdir=require(_0x18ef('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x18ef('0x3'));var moment=require(_0x18ef('0x4'));var BPromise=require(_0x18ef('0x5'));var Mustache=require(_0x18ef('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x18ef('0x7'));var ejs=require(_0x18ef('0x8'));var fs=require('fs');var fs_extra=require(_0x18ef('0x9'));var _=require('lodash');var squel=require(_0x18ef('0xa'));var crypto=require(_0x18ef('0xb'));var jsforce=require(_0x18ef('0xc'));var deskjs=require(_0x18ef('0xd'));var toCsv=require(_0x18ef('0x7'));var querystring=require(_0x18ef('0xe'));var Papa=require(_0x18ef('0xf'));var Redis=require(_0x18ef('0x10'));var authService=require(_0x18ef('0x11'));var qs=require(_0x18ef('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x18ef('0x13'));var logger=require(_0x18ef('0x14'))(_0x18ef('0x15'));var utils=require(_0x18ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x18ef('0x17'));var db=require(_0x18ef('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1bea0e,_0x3d9f90){_0x3d9f90=_0x3d9f90||0xcc;return function(_0x1b820b){if(_0x1b820b){return _0x1bea0e[_0x18ef('0x19')](_0x3d9f90);}return _0x1bea0e[_0x18ef('0x1a')](_0x3d9f90)[_0x18ef('0x1b')]();};}function respondWithResult(_0x3c7457,_0x181c97){_0x181c97=_0x181c97||0xc8;return function(_0x13ca6a){if(_0x13ca6a){return _0x3c7457[_0x18ef('0x1a')](_0x181c97)[_0x18ef('0x1c')](_0x13ca6a);}};}function respondWithFilteredResult(_0xf71486,_0x31528d){return function(_0x5b48a8){if(_0x5b48a8){var _0x308163=typeof _0x31528d[_0x18ef('0x1d')]===_0x18ef('0x1e')&&typeof _0x31528d[_0x18ef('0x1f')]===_0x18ef('0x1e');var _0x2b41ad=_0x5b48a8['count'];var _0x27a08e=_0x308163?0x0:_0x31528d[_0x18ef('0x1d')];var _0xc854e5=_0x308163?_0x5b48a8[_0x18ef('0x20')]:_0x31528d[_0x18ef('0x1d')]+_0x31528d[_0x18ef('0x1f')];var _0x4dbd52;if(_0xc854e5>=_0x2b41ad){_0xc854e5=_0x2b41ad;_0x4dbd52=0xc8;}else{_0x4dbd52=0xce;}_0xf71486[_0x18ef('0x1a')](_0x4dbd52);return _0xf71486[_0x18ef('0x21')](_0x18ef('0x22'),_0x27a08e+'-'+_0xc854e5+'/'+_0x2b41ad)[_0x18ef('0x1c')](_0x5b48a8);}return null;};}function patchUpdates(_0x3bff33){return function(_0x51995b){try{jsonpatch['apply'](_0x51995b,_0x3bff33,!![]);}catch(_0x14b271){return BPromise[_0x18ef('0x23')](_0x14b271);}return _0x51995b[_0x18ef('0x24')]();};}function saveUpdates(_0x401d36,_0x329032){return function(_0x5e783d){if(_0x5e783d){return _0x5e783d[_0x18ef('0x25')](_0x401d36)[_0x18ef('0x26')](function(_0xa3fa16){return _0xa3fa16;});}return null;};}function removeEntity(_0x2d84b3,_0x4262d1){return function(_0x318479){if(_0x318479){return _0x318479[_0x18ef('0x27')]()['then'](function(){_0x2d84b3[_0x18ef('0x1a')](0xcc)[_0x18ef('0x1b')]();});}};}function handleEntityNotFound(_0x29c818,_0x8e8c67){return function(_0x4ff7c1){if(!_0x4ff7c1){_0x29c818[_0x18ef('0x19')](0x194);}return _0x4ff7c1;};}function handleError(_0x34ddc3,_0x5e5538){_0x5e5538=_0x5e5538||0x1f4;return function(_0x324907){logger['error'](_0x324907[_0x18ef('0x28')]);if(_0x324907[_0x18ef('0x29')]){delete _0x324907[_0x18ef('0x29')];}_0x34ddc3[_0x18ef('0x1a')](_0x5e5538)[_0x18ef('0x2a')](_0x324907);};}exports['index']=function(_0x4e72e3,_0x2cc46e){var _0x3b081e={},_0x4fb5bf={},_0x37e570={'count':0x0,'rows':[]};var _0x59dfd1=_[_0x18ef('0x2b')](db['ZohoAccount'][_0x18ef('0x2c')],function(_0x27ffed){return{'name':_0x27ffed['fieldName'],'type':_0x27ffed[_0x18ef('0x2d')]['key']};});_0x4fb5bf[_0x18ef('0x2e')]=_[_0x18ef('0x2b')](_0x59dfd1,_0x18ef('0x29'));_0x4fb5bf[_0x18ef('0x2f')]=_[_0x18ef('0x30')](_0x4e72e3[_0x18ef('0x2f')]);_0x4fb5bf[_0x18ef('0x31')]=_['intersection'](_0x4fb5bf[_0x18ef('0x2e')],_0x4fb5bf[_0x18ef('0x2f')]);_0x3b081e[_0x18ef('0x32')]=_[_0x18ef('0x33')](_0x4fb5bf[_0x18ef('0x2e')],qs[_0x18ef('0x34')](_0x4e72e3[_0x18ef('0x2f')][_0x18ef('0x34')]));_0x3b081e[_0x18ef('0x32')]=_0x3b081e[_0x18ef('0x32')][_0x18ef('0x35')]?_0x3b081e[_0x18ef('0x32')]:_0x4fb5bf[_0x18ef('0x2e')];if(!_0x4e72e3['query'][_0x18ef('0x36')]('nolimit')){_0x3b081e[_0x18ef('0x1f')]=qs[_0x18ef('0x1f')](_0x4e72e3[_0x18ef('0x2f')][_0x18ef('0x1f')]);_0x3b081e[_0x18ef('0x1d')]=qs[_0x18ef('0x1d')](_0x4e72e3[_0x18ef('0x2f')][_0x18ef('0x1d')]);}_0x3b081e[_0x18ef('0x37')]=qs[_0x18ef('0x38')](_0x4e72e3[_0x18ef('0x2f')][_0x18ef('0x38')]);_0x3b081e['where']=qs[_0x18ef('0x31')](_[_0x18ef('0x39')](_0x4e72e3[_0x18ef('0x2f')],_0x4fb5bf[_0x18ef('0x31')]),_0x59dfd1);if(_0x4e72e3[_0x18ef('0x2f')][_0x18ef('0x3a')]){_0x3b081e[_0x18ef('0x3b')]=_['merge'](_0x3b081e[_0x18ef('0x3b')],{'$or':_['map'](_0x59dfd1,function(_0x107cb0){if(_0x107cb0['type']!==_0x18ef('0x3c')){var _0x39d2a5={};_0x39d2a5[_0x107cb0['name']]={'$like':'%'+_0x4e72e3[_0x18ef('0x2f')][_0x18ef('0x3a')]+'%'};return _0x39d2a5;}})});}_0x3b081e=_[_0x18ef('0x3d')]({},_0x3b081e,_0x4e72e3[_0x18ef('0x3e')]);var _0x300731={'where':_0x3b081e[_0x18ef('0x3b')]};return db[_0x18ef('0x3f')][_0x18ef('0x20')](_0x300731)[_0x18ef('0x26')](function(_0x4b9603){_0x37e570[_0x18ef('0x20')]=_0x4b9603;if(_0x4e72e3[_0x18ef('0x2f')][_0x18ef('0x40')]){_0x3b081e[_0x18ef('0x41')]=[{'all':!![]}];}return db[_0x18ef('0x3f')]['findAll'](_0x3b081e);})[_0x18ef('0x26')](function(_0x3a21b7){_0x37e570['rows']=_0x3a21b7;return _0x37e570;})['then'](respondWithFilteredResult(_0x2cc46e,_0x3b081e))['catch'](handleError(_0x2cc46e,null));};exports[_0x18ef('0x42')]=function(_0x319197,_0x501544){var _0xf62526={'raw':![],'where':{'id':_0x319197[_0x18ef('0x43')]['id']}},_0x376a70={};_0x376a70['model']=_[_0x18ef('0x30')](db[_0x18ef('0x3f')][_0x18ef('0x2c')]);_0x376a70[_0x18ef('0x2f')]=_[_0x18ef('0x30')](_0x319197[_0x18ef('0x2f')]);_0x376a70[_0x18ef('0x31')]=_[_0x18ef('0x33')](_0x376a70[_0x18ef('0x2e')],_0x376a70[_0x18ef('0x2f')]);_0xf62526[_0x18ef('0x32')]=_[_0x18ef('0x33')](_0x376a70[_0x18ef('0x2e')],qs[_0x18ef('0x34')](_0x319197[_0x18ef('0x2f')]['fields']));_0xf62526['attributes']=_0xf62526[_0x18ef('0x32')]['length']?_0xf62526['attributes']:_0x376a70['model'];if(_0x319197['query'][_0x18ef('0x40')]){_0xf62526[_0x18ef('0x41')]=[{'all':!![]}];}_0xf62526=_[_0x18ef('0x3d')]({},_0xf62526,_0x319197[_0x18ef('0x3e')]);return db[_0x18ef('0x3f')]['find'](_0xf62526)[_0x18ef('0x26')](handleEntityNotFound(_0x501544,null))[_0x18ef('0x26')](respondWithResult(_0x501544,null))['catch'](handleError(_0x501544,null));};exports[_0x18ef('0x44')]=function(_0x4b083d,_0x21f781){return db[_0x18ef('0x3f')][_0x18ef('0x44')](_0x4b083d[_0x18ef('0x45')],{})[_0x18ef('0x26')](respondWithResult(_0x21f781,0xc9))['catch'](handleError(_0x21f781,null));};exports[_0x18ef('0x25')]=function(_0x113123,_0x165c13){if(_0x113123[_0x18ef('0x45')]['id']){delete _0x113123['body']['id'];}return db[_0x18ef('0x3f')][_0x18ef('0x46')]({'where':{'id':_0x113123['params']['id']}})[_0x18ef('0x26')](handleEntityNotFound(_0x165c13,null))[_0x18ef('0x26')](saveUpdates(_0x113123[_0x18ef('0x45')],null))[_0x18ef('0x26')](respondWithResult(_0x165c13,null))[_0x18ef('0x47')](handleError(_0x165c13,null));};exports['destroy']=function(_0x30242f,_0x2e053d){return db[_0x18ef('0x3f')][_0x18ef('0x46')]({'where':{'id':_0x30242f[_0x18ef('0x43')]['id']}})[_0x18ef('0x26')](handleEntityNotFound(_0x2e053d,null))[_0x18ef('0x26')](removeEntity(_0x2e053d,null))[_0x18ef('0x47')](handleError(_0x2e053d,null));};exports['getConfigurations']=function(_0x399ae4,_0x278631,_0x4b9acd){var _0x48f9d1={};var _0x512ac5={};var _0x6ee08a;var _0x1387ed;return db['ZohoAccount'][_0x18ef('0x48')]({'where':{'id':_0x399ae4[_0x18ef('0x43')]['id']}})[_0x18ef('0x26')](handleEntityNotFound(_0x278631,null))[_0x18ef('0x26')](function(_0x5c87b8){if(_0x5c87b8){_0x6ee08a=_0x5c87b8;_0x512ac5['model']=_[_0x18ef('0x30')](db[_0x18ef('0x49')][_0x18ef('0x2c')]);_0x512ac5['query']=_[_0x18ef('0x30')](_0x399ae4[_0x18ef('0x2f')]);_0x512ac5['filters']=_[_0x18ef('0x33')](_0x512ac5['model'],_0x512ac5[_0x18ef('0x2f')]);_0x48f9d1[_0x18ef('0x32')]=_[_0x18ef('0x33')](_0x512ac5[_0x18ef('0x2e')],qs[_0x18ef('0x34')](_0x399ae4[_0x18ef('0x2f')][_0x18ef('0x34')]));_0x48f9d1[_0x18ef('0x32')]=_0x48f9d1[_0x18ef('0x32')][_0x18ef('0x35')]?_0x48f9d1[_0x18ef('0x32')]:_0x512ac5[_0x18ef('0x2e')];_0x48f9d1[_0x18ef('0x37')]=qs['sort'](_0x399ae4[_0x18ef('0x2f')][_0x18ef('0x38')]);_0x48f9d1[_0x18ef('0x3b')]=qs[_0x18ef('0x31')](_['pick'](_0x399ae4[_0x18ef('0x2f')],_0x512ac5[_0x18ef('0x31')]));if(_0x399ae4[_0x18ef('0x2f')]['filter']){_0x48f9d1[_0x18ef('0x3b')]=_['merge'](_0x48f9d1[_0x18ef('0x3b')],{'$or':_['map'](_0x48f9d1['attributes'],function(_0x2c0d75){var _0xab4daf={};_0xab4daf[_0x2c0d75]={'$like':'%'+_0x399ae4['query']['filter']+'%'};return _0xab4daf;})});}_0x48f9d1=_[_0x18ef('0x3d')]({},_0x48f9d1,_0x399ae4[_0x18ef('0x3e')]);return _0x6ee08a[_0x18ef('0x4a')](_0x48f9d1);}})['then'](function(_0x18e437){if(_0x18e437){_0x1387ed=_0x18e437[_0x18ef('0x35')];if(!_0x399ae4[_0x18ef('0x2f')]['hasOwnProperty'](_0x18ef('0x4b'))){_0x48f9d1['limit']=qs[_0x18ef('0x1f')](_0x399ae4[_0x18ef('0x2f')][_0x18ef('0x1f')]);_0x48f9d1[_0x18ef('0x1d')]=qs[_0x18ef('0x1d')](_0x399ae4[_0x18ef('0x2f')][_0x18ef('0x1d')]);}return _0x6ee08a[_0x18ef('0x4a')](_0x48f9d1);}})[_0x18ef('0x26')](function(_0x4f816a){if(_0x4f816a){return _0x4f816a?{'count':_0x1387ed,'rows':_0x4f816a}:null;}})[_0x18ef('0x26')](respondWithResult(_0x278631,null))[_0x18ef('0x47')](handleError(_0x278631,null));};exports[_0x18ef('0x4c')]=function(_0x386b42,_0x41e07e,_0x1b6b21){if(_0x386b42[_0x18ef('0x45')]['id']){delete _0x386b42[_0x18ef('0x45')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x386b42[_0x18ef('0x43')]['id']}})[_0x18ef('0x26')](handleEntityNotFound(_0x41e07e,null))[_0x18ef('0x26')](function(_0x68942d){if(_0x68942d){_0x386b42['body'][_0x18ef('0x4d')]=_0x68942d['id'];_0x386b42[_0x18ef('0x45')][_0x18ef('0x4e')]=integrations['getSubjects'](_0x386b42['body'][_0x18ef('0x4f')],_0x386b42[_0x18ef('0x45')][_0x18ef('0x2d')]);_0x386b42[_0x18ef('0x45')][_0x18ef('0x50')]=integrations[_0x18ef('0x51')](_0x386b42[_0x18ef('0x45')]['channel'],_0x386b42[_0x18ef('0x45')][_0x18ef('0x2d')]);return db[_0x18ef('0x49')][_0x18ef('0x44')](_0x386b42['body'],{'include':[{'model':db[_0x18ef('0x52')],'as':_0x18ef('0x4e')},{'model':db[_0x18ef('0x52')],'as':_0x18ef('0x50')}]});}return null;})['then'](respondWithResult(_0x41e07e,null))[_0x18ef('0x47')](handleError(_0x41e07e,null));};function getAccessToken(_0x34d2f1){return new Promise(function(_0x34f315,_0x5f2d52){var _0x20465b;switch(_0x34d2f1[_0x18ef('0x53')]){case'US':_0x20465b='https://accounts.zoho.com';break;case'AU':_0x20465b='https://accounts.zoho.com.au';break;case'EU':_0x20465b=_0x18ef('0x54');break;case'IN':_0x20465b=_0x18ef('0x55');break;case'CN':_0x20465b=_0x18ef('0x56');break;default:_0x20465b=_0x18ef('0x54');break;}var _0x15efff={'method':_0x18ef('0x57'),'uri':_0x20465b+_0x18ef('0x58'),'qs':{'refresh_token':_0x34d2f1[_0x18ef('0x59')],'client_id':_0x34d2f1[_0x18ef('0x5a')],'client_secret':_0x34d2f1[_0x18ef('0x5b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x15efff)[_0x18ef('0x26')](function(_0x511b1c){if(_0x511b1c['access_token']){_0x34f315(_0x511b1c[_0x18ef('0x5c')]);}else{_0x5f2d52(_0x18ef('0x5d'));}})['catch'](function(_0x16d218){_0x5f2d52(_0x16d218);});});}exports['getFields']=function(_0x14f33f,_0x40be07,_0x29179c){var _0x32dbce,_0x62bfdd,_0xd25533,_0xb72f4c,_0x191607;return db[_0x18ef('0x3f')][_0x18ef('0x48')]({'where':{'id':_0x14f33f[_0x18ef('0x43')]['id']},'attributes':['id',_0x18ef('0x5e'),_0x18ef('0x53'),_0x18ef('0x5a'),'clientSecret','serverUrl',_0x18ef('0x5f'),'refreshToken']})[_0x18ef('0x26')](handleEntityNotFound(_0x40be07,null))[_0x18ef('0x26')](function(_0x4ed9cc){_0x191607=_0x4ed9cc;_0x32dbce=_0x191607['host'];_0x62bfdd=_0x32dbce===_0x18ef('0x60')?'eu':'com';_0xd25533=_0x191607['serverUrl'];var _0x5c7a2a=_0xd25533['slice'](-0x1);if(_0x5c7a2a==='/'||_0x5c7a2a==='\x5c'||_0x5c7a2a===':'){_0xd25533=_0xd25533['substring'](0x0,_0xd25533['lastIndexOf'](_0x5c7a2a));}if(!_0x191607[_0x18ef('0x59')]){throw new Error(_0x18ef('0x61'));}return getAccessToken(_0x191607);})[_0x18ef('0x26')](function(_0x1d9b56){if(_0x1d9b56){return rp({'method':_0x18ef('0x62'),'uri':util['format'](_0x18ef('0x63'),_0x62bfdd),'qs':{'module':_0x18ef('0x64')},'headers':{'Authorization':_0x18ef('0x65')+_0x1d9b56},'json':!![]});}})['then'](function(_0x303ccd){if(_0x303ccd){if(_0x303ccd[_0x18ef('0x66')]&&_0x303ccd['response']['error']){throw new Error(_0x303ccd['response'][_0x18ef('0x67')][_0x18ef('0x68')]);}var _0x2c8e31=[];var _0x52f063=[];var _0x56feee=[_0x18ef('0x69'),'Subject',_0x18ef('0x6a'),_0x18ef('0x6b'),_0x18ef('0x6c'),_0x18ef('0x6d'),_0x18ef('0x6e'),'Call_Type'];_0x52f063=_[_0x18ef('0x6f')](_0x303ccd[_0x18ef('0x34')],function(_0x3467e6){return _0x56feee[_0x18ef('0x70')](_0x3467e6[_0x18ef('0x71')]);});for(var _0x50c8a=0x0;_0x50c8a<_0x52f063[_0x18ef('0x35')];_0x50c8a++){if(_0x52f063[_0x50c8a][_0x18ef('0x72')]===![]){_0x2c8e31['push']({'id':_0x52f063[_0x50c8a]['id'],'name':_0x52f063[_0x50c8a]['display_label'],'custom':_0x52f063[_0x50c8a][_0x18ef('0x73')],'options':_0x52f063[_0x50c8a][_0x18ef('0x74')]==='picklist'&&_0x52f063[_0x50c8a][_0x18ef('0x75')][_0x18ef('0x35')]>-0x1?_[_0x18ef('0x2b')](_0x52f063[_0x50c8a]['pick_list_values'],function(_0x452f21){return{'name':_0x452f21,'value':_0x452f21};}):[]});}}return{'count':_0x2c8e31[_0x18ef('0x35')],'rows':_0x2c8e31};}else{return{'count':0x0,'rows':[]};}})[_0x18ef('0x26')](respondWithResult(_0x40be07,null))[_0x18ef('0x47')](function(_0x4e2bbe){var _0x54e9fa=_0x14f33f[_0x18ef('0x2f')]['test']?0x1f4:_0x4e2bbe[_0x18ef('0x76')]||0x1f4;logger['error'](_0x18ef('0x77'),_0x18ef('0x78'),_0x54e9fa,JSON[_0x18ef('0x79')](_0x4e2bbe));delete _0x4e2bbe['name'];if(_0x54e9fa===0x191){_0x54e9fa=0x190;}_0x40be07[_0x18ef('0x1a')](_0x54e9fa)[_0x18ef('0x2a')](_0x14f33f[_0x18ef('0x2f')][_0x18ef('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x4e2bbe['statusCode']}:_0x4e2bbe);});}; \ No newline at end of file +var _0xe72e=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','stack','name','send','map','rawAttributes','model','filters','intersection','query','attributes','fields','length','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','ZohoAccount','findAll','rows','catch','params','keys','create','body','find','destroy','findOne','getConfigurations','hasOwnProperty','nolimit','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientSecret','access_token','getFields','host','zone','clientId','serverUrl','code','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe72e,0x16b));var _0xee72=function(_0x392c2c,_0x3514a2){_0x392c2c=_0x392c2c-0x0;var _0x50e298=_0xe72e[_0x392c2c];return _0x50e298;};'use strict';var emlformat=require(_0xee72('0x0'));var rimraf=require(_0xee72('0x1'));var zipdir=require(_0xee72('0x2'));var jsonpatch=require(_0xee72('0x3'));var rp=require(_0xee72('0x4'));var moment=require(_0xee72('0x5'));var BPromise=require(_0xee72('0x6'));var Mustache=require(_0xee72('0x7'));var util=require('util');var path=require(_0xee72('0x8'));var sox=require(_0xee72('0x9'));var csv=require(_0xee72('0xa'));var ejs=require(_0xee72('0xb'));var fs=require('fs');var fs_extra=require(_0xee72('0xc'));var _=require(_0xee72('0xd'));var squel=require(_0xee72('0xe'));var crypto=require('crypto');var jsforce=require(_0xee72('0xf'));var deskjs=require(_0xee72('0x10'));var toCsv=require(_0xee72('0xa'));var querystring=require(_0xee72('0x11'));var Papa=require('papaparse');var Redis=require(_0xee72('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee72('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xee72('0x14'));var licenseUtil=require(_0xee72('0x15'));var db=require(_0xee72('0x16'))['db'];var integrations=require(_0xee72('0x17'));function respondWithStatusCode(_0x46ba8a,_0x82fd0e){_0x82fd0e=_0x82fd0e||0xcc;return function(_0x197dfe){if(_0x197dfe){return _0x46ba8a[_0xee72('0x18')](_0x82fd0e);}return _0x46ba8a[_0xee72('0x19')](_0x82fd0e)[_0xee72('0x1a')]();};}function respondWithResult(_0x4ed1ff,_0x3f7bb5){_0x3f7bb5=_0x3f7bb5||0xc8;return function(_0xc1acc1){if(_0xc1acc1){return _0x4ed1ff[_0xee72('0x19')](_0x3f7bb5)['json'](_0xc1acc1);}};}function respondWithFilteredResult(_0x2bb5dc,_0x490c7c){return function(_0x4194e1){if(_0x4194e1){var _0x1a9390=typeof _0x490c7c[_0xee72('0x1b')]===_0xee72('0x1c')&&typeof _0x490c7c[_0xee72('0x1d')]===_0xee72('0x1c');var _0x419d31=_0x4194e1[_0xee72('0x1e')];var _0x3eb680=_0x1a9390?0x0:_0x490c7c['offset'];var _0x2ea22c=_0x1a9390?_0x4194e1[_0xee72('0x1e')]:_0x490c7c['offset']+_0x490c7c[_0xee72('0x1d')];var _0x44f1f8;if(_0x2ea22c>=_0x419d31){_0x2ea22c=_0x419d31;_0x44f1f8=0xc8;}else{_0x44f1f8=0xce;}_0x2bb5dc[_0xee72('0x19')](_0x44f1f8);return _0x2bb5dc[_0xee72('0x1f')](_0xee72('0x20'),_0x3eb680+'-'+_0x2ea22c+'/'+_0x419d31)['json'](_0x4194e1);}return null;};}function patchUpdates(_0x14fa84){return function(_0x3d4f76){try{jsonpatch[_0xee72('0x21')](_0x3d4f76,_0x14fa84,!![]);}catch(_0x222a85){return BPromise['reject'](_0x222a85);}return _0x3d4f76[_0xee72('0x22')]();};}function saveUpdates(_0x1575f1,_0x51b0b8){return function(_0x265f92){if(_0x265f92){return _0x265f92[_0xee72('0x23')](_0x1575f1)[_0xee72('0x24')](function(_0x307347){return _0x307347;});}return null;};}function removeEntity(_0x566dda,_0x1e5503){return function(_0x9cd269){if(_0x9cd269){return _0x9cd269['destroy']()[_0xee72('0x24')](function(){_0x566dda[_0xee72('0x19')](0xcc)[_0xee72('0x1a')]();});}};}function handleEntityNotFound(_0x569e73,_0x4f4216){return function(_0x21f884){if(!_0x21f884){_0x569e73[_0xee72('0x18')](0x194);}return _0x21f884;};}function handleError(_0x36d75e,_0x27f476){_0x27f476=_0x27f476||0x1f4;return function(_0x19a760){logger['error'](_0x19a760[_0xee72('0x25')]);if(_0x19a760[_0xee72('0x26')]){delete _0x19a760[_0xee72('0x26')];}_0x36d75e['status'](_0x27f476)[_0xee72('0x27')](_0x19a760);};}exports['index']=function(_0x5b944d,_0x521fb8){var _0x3e2fc8={},_0x3bef1e={},_0x5205b2={'count':0x0,'rows':[]};var _0x272194=_[_0xee72('0x28')](db['ZohoAccount'][_0xee72('0x29')],function(_0x10d5c8){return{'name':_0x10d5c8['fieldName'],'type':_0x10d5c8['type']['key']};});_0x3bef1e[_0xee72('0x2a')]=_[_0xee72('0x28')](_0x272194,_0xee72('0x26'));_0x3bef1e['query']=_['keys'](_0x5b944d['query']);_0x3bef1e[_0xee72('0x2b')]=_[_0xee72('0x2c')](_0x3bef1e[_0xee72('0x2a')],_0x3bef1e[_0xee72('0x2d')]);_0x3e2fc8[_0xee72('0x2e')]=_[_0xee72('0x2c')](_0x3bef1e[_0xee72('0x2a')],qs[_0xee72('0x2f')](_0x5b944d[_0xee72('0x2d')][_0xee72('0x2f')]));_0x3e2fc8[_0xee72('0x2e')]=_0x3e2fc8['attributes'][_0xee72('0x30')]?_0x3e2fc8[_0xee72('0x2e')]:_0x3bef1e[_0xee72('0x2a')];if(!_0x5b944d[_0xee72('0x2d')]['hasOwnProperty']('nolimit')){_0x3e2fc8['limit']=qs[_0xee72('0x1d')](_0x5b944d['query']['limit']);_0x3e2fc8[_0xee72('0x1b')]=qs[_0xee72('0x1b')](_0x5b944d[_0xee72('0x2d')]['offset']);}_0x3e2fc8[_0xee72('0x31')]=qs[_0xee72('0x32')](_0x5b944d[_0xee72('0x2d')]['sort']);_0x3e2fc8[_0xee72('0x33')]=qs['filters'](_[_0xee72('0x34')](_0x5b944d[_0xee72('0x2d')],_0x3bef1e[_0xee72('0x2b')]),_0x272194);if(_0x5b944d[_0xee72('0x2d')][_0xee72('0x35')]){_0x3e2fc8[_0xee72('0x33')]=_['merge'](_0x3e2fc8['where'],{'$or':_[_0xee72('0x28')](_0x272194,function(_0x5bce8c){if(_0x5bce8c[_0xee72('0x36')]!==_0xee72('0x37')){var _0x3663e0={};_0x3663e0[_0x5bce8c['name']]={'$like':'%'+_0x5b944d[_0xee72('0x2d')][_0xee72('0x35')]+'%'};return _0x3663e0;}})});}_0x3e2fc8=_[_0xee72('0x38')]({},_0x3e2fc8,_0x5b944d['options']);var _0x31f780={'where':_0x3e2fc8['where']};return db['ZohoAccount'][_0xee72('0x1e')](_0x31f780)[_0xee72('0x24')](function(_0x54dd39){_0x5205b2[_0xee72('0x1e')]=_0x54dd39;if(_0x5b944d['query'][_0xee72('0x39')]){_0x3e2fc8[_0xee72('0x3a')]=[{'all':!![]}];}return db[_0xee72('0x3b')][_0xee72('0x3c')](_0x3e2fc8);})[_0xee72('0x24')](function(_0x4ec479){_0x5205b2[_0xee72('0x3d')]=_0x4ec479;return _0x5205b2;})[_0xee72('0x24')](respondWithFilteredResult(_0x521fb8,_0x3e2fc8))[_0xee72('0x3e')](handleError(_0x521fb8,null));};exports['show']=function(_0x3b3b4b,_0x3648e8){var _0x2e2d1c={'raw':![],'where':{'id':_0x3b3b4b[_0xee72('0x3f')]['id']}},_0xe3f8d0={};_0xe3f8d0[_0xee72('0x2a')]=_[_0xee72('0x40')](db[_0xee72('0x3b')][_0xee72('0x29')]);_0xe3f8d0[_0xee72('0x2d')]=_[_0xee72('0x40')](_0x3b3b4b[_0xee72('0x2d')]);_0xe3f8d0[_0xee72('0x2b')]=_['intersection'](_0xe3f8d0[_0xee72('0x2a')],_0xe3f8d0[_0xee72('0x2d')]);_0x2e2d1c['attributes']=_[_0xee72('0x2c')](_0xe3f8d0[_0xee72('0x2a')],qs['fields'](_0x3b3b4b[_0xee72('0x2d')][_0xee72('0x2f')]));_0x2e2d1c[_0xee72('0x2e')]=_0x2e2d1c[_0xee72('0x2e')][_0xee72('0x30')]?_0x2e2d1c[_0xee72('0x2e')]:_0xe3f8d0[_0xee72('0x2a')];if(_0x3b3b4b[_0xee72('0x2d')]['includeAll']){_0x2e2d1c[_0xee72('0x3a')]=[{'all':!![]}];}_0x2e2d1c=_['merge']({},_0x2e2d1c,_0x3b3b4b['options']);return db['ZohoAccount']['find'](_0x2e2d1c)[_0xee72('0x24')](handleEntityNotFound(_0x3648e8,null))[_0xee72('0x24')](respondWithResult(_0x3648e8,null))[_0xee72('0x3e')](handleError(_0x3648e8,null));};exports[_0xee72('0x41')]=function(_0x5208b7,_0x587d1b){return db[_0xee72('0x3b')]['create'](_0x5208b7[_0xee72('0x42')],{})[_0xee72('0x24')](respondWithResult(_0x587d1b,0xc9))[_0xee72('0x3e')](handleError(_0x587d1b,null));};exports['update']=function(_0x49b488,_0x34dd7a){if(_0x49b488[_0xee72('0x42')]['id']){delete _0x49b488[_0xee72('0x42')]['id'];}return db[_0xee72('0x3b')][_0xee72('0x43')]({'where':{'id':_0x49b488[_0xee72('0x3f')]['id']}})[_0xee72('0x24')](handleEntityNotFound(_0x34dd7a,null))[_0xee72('0x24')](saveUpdates(_0x49b488['body'],null))[_0xee72('0x24')](respondWithResult(_0x34dd7a,null))[_0xee72('0x3e')](handleError(_0x34dd7a,null));};exports[_0xee72('0x44')]=function(_0x16e812,_0x22fbb7){return db[_0xee72('0x3b')][_0xee72('0x43')]({'where':{'id':_0x16e812[_0xee72('0x3f')]['id']}})['then'](handleEntityNotFound(_0x22fbb7,null))[_0xee72('0x24')](removeEntity(_0x22fbb7,null))[_0xee72('0x3e')](handleError(_0x22fbb7,null));};exports['getConfigurations']=function(_0x2d189a,_0x469446,_0x4f40c1){var _0x1b4a7a={};var _0x207a3d={};var _0x614980;var _0x54580c;return db['ZohoAccount'][_0xee72('0x45')]({'where':{'id':_0x2d189a[_0xee72('0x3f')]['id']}})[_0xee72('0x24')](handleEntityNotFound(_0x469446,null))[_0xee72('0x24')](function(_0xb1f694){if(_0xb1f694){_0x614980=_0xb1f694;_0x207a3d[_0xee72('0x2a')]=_[_0xee72('0x40')](db['ZohoConfiguration'][_0xee72('0x29')]);_0x207a3d[_0xee72('0x2d')]=_[_0xee72('0x40')](_0x2d189a[_0xee72('0x2d')]);_0x207a3d[_0xee72('0x2b')]=_[_0xee72('0x2c')](_0x207a3d[_0xee72('0x2a')],_0x207a3d['query']);_0x1b4a7a['attributes']=_[_0xee72('0x2c')](_0x207a3d[_0xee72('0x2a')],qs[_0xee72('0x2f')](_0x2d189a[_0xee72('0x2d')][_0xee72('0x2f')]));_0x1b4a7a[_0xee72('0x2e')]=_0x1b4a7a['attributes'][_0xee72('0x30')]?_0x1b4a7a[_0xee72('0x2e')]:_0x207a3d[_0xee72('0x2a')];_0x1b4a7a[_0xee72('0x31')]=qs[_0xee72('0x32')](_0x2d189a['query'][_0xee72('0x32')]);_0x1b4a7a['where']=qs[_0xee72('0x2b')](_['pick'](_0x2d189a[_0xee72('0x2d')],_0x207a3d[_0xee72('0x2b')]));if(_0x2d189a[_0xee72('0x2d')][_0xee72('0x35')]){_0x1b4a7a[_0xee72('0x33')]=_[_0xee72('0x38')](_0x1b4a7a[_0xee72('0x33')],{'$or':_[_0xee72('0x28')](_0x1b4a7a[_0xee72('0x2e')],function(_0x4a04ee){var _0x590d67={};_0x590d67[_0x4a04ee]={'$like':'%'+_0x2d189a[_0xee72('0x2d')][_0xee72('0x35')]+'%'};return _0x590d67;})});}_0x1b4a7a=_[_0xee72('0x38')]({},_0x1b4a7a,_0x2d189a['options']);return _0x614980[_0xee72('0x46')](_0x1b4a7a);}})[_0xee72('0x24')](function(_0x31b32a){if(_0x31b32a){_0x54580c=_0x31b32a['length'];if(!_0x2d189a['query'][_0xee72('0x47')](_0xee72('0x48'))){_0x1b4a7a[_0xee72('0x1d')]=qs[_0xee72('0x1d')](_0x2d189a['query'][_0xee72('0x1d')]);_0x1b4a7a[_0xee72('0x1b')]=qs['offset'](_0x2d189a[_0xee72('0x2d')][_0xee72('0x1b')]);}return _0x614980[_0xee72('0x46')](_0x1b4a7a);}})['then'](function(_0x5c8fa9){if(_0x5c8fa9){return _0x5c8fa9?{'count':_0x54580c,'rows':_0x5c8fa9}:null;}})[_0xee72('0x24')](respondWithResult(_0x469446,null))[_0xee72('0x3e')](handleError(_0x469446,null));};exports[_0xee72('0x49')]=function(_0x3b375c,_0x346f9f,_0x10719f){if(_0x3b375c[_0xee72('0x42')]['id']){delete _0x3b375c['body']['id'];}return db[_0xee72('0x3b')][_0xee72('0x45')]({'where':{'id':_0x3b375c[_0xee72('0x3f')]['id']}})['then'](handleEntityNotFound(_0x346f9f,null))[_0xee72('0x24')](function(_0xc8b935){if(_0xc8b935){_0x3b375c[_0xee72('0x42')]['AccountId']=_0xc8b935['id'];_0x3b375c[_0xee72('0x42')][_0xee72('0x4a')]=integrations['getSubjects'](_0x3b375c[_0xee72('0x42')][_0xee72('0x4b')],_0x3b375c[_0xee72('0x42')]['type']);_0x3b375c[_0xee72('0x42')][_0xee72('0x4c')]=integrations[_0xee72('0x4d')](_0x3b375c['body'][_0xee72('0x4b')],_0x3b375c['body'][_0xee72('0x36')]);return db['ZohoConfiguration'][_0xee72('0x41')](_0x3b375c[_0xee72('0x42')],{'include':[{'model':db[_0xee72('0x4e')],'as':'Subjects'},{'model':db[_0xee72('0x4e')],'as':_0xee72('0x4c')}]});}return null;})['then'](respondWithResult(_0x346f9f,null))[_0xee72('0x3e')](handleError(_0x346f9f,null));};function getAccessToken(_0x92aefd){return new Promise(function(_0x379a2d,_0x8b8f88){var _0x42b6a6;switch(_0x92aefd['zone']){case'US':_0x42b6a6=_0xee72('0x4f');break;case'AU':_0x42b6a6='https://accounts.zoho.com.au';break;case'EU':_0x42b6a6='https://accounts.zoho.eu';break;case'IN':_0x42b6a6=_0xee72('0x50');break;case'CN':_0x42b6a6='https://accounts.zoho.com.cn';break;default:_0x42b6a6='https://accounts.zoho.eu';break;}var _0x322851={'method':_0xee72('0x51'),'uri':_0x42b6a6+_0xee72('0x52'),'qs':{'refresh_token':_0x92aefd[_0xee72('0x53')],'client_id':_0x92aefd['clientId'],'client_secret':_0x92aefd[_0xee72('0x54')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x322851)[_0xee72('0x24')](function(_0xd2d07d){if(_0xd2d07d[_0xee72('0x55')]){_0x379a2d(_0xd2d07d['access_token']);}else{_0x8b8f88('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xee72('0x3e')](function(_0x56bba8){_0x8b8f88(_0x56bba8);});});}exports[_0xee72('0x56')]=function(_0x36d1a0,_0x3e9056,_0x10b29f){var _0x350e83,_0x446516,_0x597eaa,_0x5eac1a,_0x1022ab;return db['ZohoAccount'][_0xee72('0x45')]({'where':{'id':_0x36d1a0[_0xee72('0x3f')]['id']},'attributes':['id',_0xee72('0x57'),_0xee72('0x58'),_0xee72('0x59'),_0xee72('0x54'),_0xee72('0x5a'),_0xee72('0x5b'),_0xee72('0x53')]})['then'](handleEntityNotFound(_0x3e9056,null))[_0xee72('0x24')](function(_0x536666){_0x1022ab=_0x536666;_0x350e83=_0x1022ab[_0xee72('0x57')];_0x446516=_0x350e83==='zoho.eu'?'eu':_0xee72('0x5c');_0x597eaa=_0x1022ab[_0xee72('0x5a')];var _0x5bb5ac=_0x597eaa[_0xee72('0x5d')](-0x1);if(_0x5bb5ac==='/'||_0x5bb5ac==='\x5c'||_0x5bb5ac===':'){_0x597eaa=_0x597eaa[_0xee72('0x5e')](0x0,_0x597eaa[_0xee72('0x5f')](_0x5bb5ac));}if(!_0x1022ab[_0xee72('0x53')]){throw new Error(_0xee72('0x60'));}return getAccessToken(_0x1022ab);})[_0xee72('0x24')](function(_0x18ea53){if(_0x18ea53){return rp({'method':_0xee72('0x61'),'uri':util[_0xee72('0x62')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x446516),'qs':{'module':_0xee72('0x63')},'headers':{'Authorization':_0xee72('0x64')+_0x18ea53},'json':!![]});}})[_0xee72('0x24')](function(_0x289157){if(_0x289157){if(_0x289157[_0xee72('0x65')]&&_0x289157[_0xee72('0x65')][_0xee72('0x66')]){throw new Error(_0x289157['response'][_0xee72('0x66')][_0xee72('0x67')]);}var _0xa51adf=[];var _0x18ba6f=[];var _0x2d8bdd=[_0xee72('0x68'),_0xee72('0x69'),'Description','WhoId',_0xee72('0x6a'),_0xee72('0x6b'),_0xee72('0x6c'),_0xee72('0x6d')];_0x18ba6f=_[_0xee72('0x6e')](_0x289157['fields'],function(_0x315189){return _0x2d8bdd['includes'](_0x315189[_0xee72('0x6f')]);});for(var _0xc211c2=0x0;_0xc211c2<_0x18ba6f[_0xee72('0x30')];_0xc211c2++){if(_0x18ba6f[_0xc211c2][_0xee72('0x70')]===![]){_0xa51adf[_0xee72('0x71')]({'id':_0x18ba6f[_0xc211c2]['id'],'name':_0x18ba6f[_0xc211c2][_0xee72('0x72')],'custom':_0x18ba6f[_0xc211c2][_0xee72('0x73')],'options':_0x18ba6f[_0xc211c2][_0xee72('0x74')]===_0xee72('0x75')&&_0x18ba6f[_0xc211c2][_0xee72('0x76')]['length']>-0x1?_[_0xee72('0x28')](_0x18ba6f[_0xc211c2][_0xee72('0x76')],function(_0x2ae0cd){return{'name':_0x2ae0cd,'value':_0x2ae0cd};}):[]});}}return{'count':_0xa51adf[_0xee72('0x30')],'rows':_0xa51adf};}else{return{'count':0x0,'rows':[]};}})[_0xee72('0x24')](respondWithResult(_0x3e9056,null))[_0xee72('0x3e')](function(_0xbcd5ef){var _0xf87387=_0x36d1a0[_0xee72('0x2d')][_0xee72('0x77')]?0x1f4:_0xbcd5ef[_0xee72('0x78')]||0x1f4;logger[_0xee72('0x66')](_0xee72('0x79'),_0xee72('0x56'),_0xf87387,JSON[_0xee72('0x7a')](_0xbcd5ef));delete _0xbcd5ef[_0xee72('0x26')];if(_0xf87387===0x191){_0xf87387=0x190;}_0x3e9056[_0xee72('0x19')](_0xf87387)[_0xee72('0x27')](_0x36d1a0[_0xee72('0x2d')][_0xee72('0x77')]?{'message':_0xee72('0x7b'),'statusCode':_0xbcd5ef[_0xee72('0x78')]}:_0xbcd5ef);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 1981c03..b6244c0 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 _0x37f6=['lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','authorization_code','clientId','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','zone','https://accounts.zoho.eu','/oauth/v2/token','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientSecret','code','host','slice','substring'];(function(_0x149eb2,_0x467466){var _0x47d529=function(_0x348abc){while(--_0x348abc){_0x149eb2['push'](_0x149eb2['shift']());}};_0x47d529(++_0x467466);}(_0x37f6,0x19b));var _0x637f=function(_0x24e364,_0x22c22c){_0x24e364=_0x24e364-0x0;var _0x3921b0=_0x37f6[_0x24e364];return _0x3921b0;};'use strict';var _=require(_0x637f('0x0'));var util=require('util');var logger=require(_0x637f('0x1'))(_0x637f('0x2'));var moment=require(_0x637f('0x3'));var BPromise=require(_0x637f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x637f('0x5'));var rimraf=require('rimraf');var config=require(_0x637f('0x6'));var attributes=require(_0x637f('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x637f('0x8')]=function(_0x4d0cea,_0x2ce2fe){return _0x4d0cea[_0x637f('0x9')](_0x637f('0xa'),attributes,{'tableName':_0x637f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4ced03,_0x395073,_0x1290e0){if(_0x4ced03[_0x637f('0xc')]('zone')||_0x4ced03[_0x637f('0xc')](_0x637f('0xd'))||_0x4ced03[_0x637f('0xc')]('clientId')||_0x4ced03[_0x637f('0xc')](_0x637f('0xe'))||_0x4ced03[_0x637f('0xc')](_0x637f('0xf'))||_0x4ced03['changed'](_0x637f('0x10'))){var _0x4d1762,_0x4acab5;_0x4d1762=_0x4ced03['serverUrl'];var _0x5e16f5=_0x4d1762[_0x637f('0x11')](-0x1);if(_0x5e16f5==='/'||_0x5e16f5==='\x5c'||_0x5e16f5===':'){_0x4d1762=_0x4d1762[_0x637f('0x12')](0x0,_0x4d1762[_0x637f('0x13')](_0x5e16f5));}switch(_0x4ced03['zone']){case'US':_0x4acab5=_0x637f('0x14');break;case'AU':_0x4acab5=_0x637f('0x15');break;case'IN':_0x4acab5=_0x637f('0x16');break;case'CN':_0x4acab5=_0x637f('0x17');break;default:_0x4acab5='https://accounts.zoho.eu';break;}var _0x298055={'method':_0x637f('0x18'),'uri':_0x4acab5+'/oauth/v2/token','form':{'grant_type':_0x637f('0x19'),'client_id':_0x4ced03[_0x637f('0x1a')],'client_secret':_0x4ced03[_0x637f('0xe')],'redirect_uri':_0x4ced03[_0x637f('0xd')],'code':_0x4ced03[_0x637f('0xf')]},'headers':{'Content-Type':_0x637f('0x1b')}};return rp(_0x298055)[_0x637f('0x1c')](function(_0x12bc21){var _0x287392=JSON[_0x637f('0x1d')](_0x12bc21);if(_0x287392[_0x637f('0x1e')]){_0x4ced03[_0x637f('0x1f')]=_0x287392[_0x637f('0x1e')];logger[_0x637f('0x20')](util[_0x637f('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4ced03[_0x637f('0x22')],_0x4ced03['id']));}else{logger[_0x637f('0x23')](util[_0x637f('0x21')](_0x637f('0x24'),_0x4ced03['name'],_0x4ced03['id']),util[_0x637f('0x25')](_0x287392,{'showHidden':![],'depth':null}));}return _0x1290e0(null,_0x395073);})[_0x637f('0x26')](function(_0xcb67cf){logger[_0x637f('0x23')](util['format'](_0x637f('0x24'),_0x4ced03['name'],_0x4ced03['id']),util[_0x637f('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x1290e0(_0xcb67cf);});}else{return _0x1290e0(null,_0x395073);}},'beforeUpdate':function(_0x35ad4c,_0x5c4039,_0x55dae3){if(_0x35ad4c[_0x637f('0xc')](_0x637f('0x27'))||_0x35ad4c[_0x637f('0xc')](_0x637f('0xd'))||_0x35ad4c['changed'](_0x637f('0x1a'))||_0x35ad4c[_0x637f('0xc')]('clientSecret')||_0x35ad4c['changed'](_0x637f('0xf'))||_0x35ad4c[_0x637f('0xc')]('host')){var _0x5791ab,_0x458beb;_0x5791ab=_0x35ad4c['serverUrl'];var _0x5ab060=_0x5791ab[_0x637f('0x11')](-0x1);if(_0x5ab060==='/'||_0x5ab060==='\x5c'||_0x5ab060===':'){_0x5791ab=_0x5791ab[_0x637f('0x12')](0x0,_0x5791ab[_0x637f('0x13')](_0x5ab060));}switch(_0x35ad4c['zone']){case'US':_0x458beb=_0x637f('0x14');break;case'AU':_0x458beb=_0x637f('0x15');break;case'IN':_0x458beb=_0x637f('0x16');break;case'CN':_0x458beb=_0x637f('0x17');break;default:_0x458beb=_0x637f('0x28');break;}var _0x19b79f={'method':_0x637f('0x18'),'uri':_0x458beb+_0x637f('0x29'),'form':{'grant_type':'authorization_code','client_id':_0x35ad4c[_0x637f('0x1a')],'client_secret':_0x35ad4c['clientSecret'],'redirect_uri':_0x35ad4c['serverUrl'],'code':_0x35ad4c[_0x637f('0xf')]},'headers':{'Content-Type':_0x637f('0x1b')}};return rp(_0x19b79f)[_0x637f('0x1c')](function(_0x39a26c){var _0x49f9f4=JSON[_0x637f('0x1d')](_0x39a26c);if(_0x49f9f4[_0x637f('0x1e')]){_0x35ad4c[_0x637f('0x1f')]=_0x49f9f4[_0x637f('0x1e')];logger['info'](util[_0x637f('0x21')](_0x637f('0x2a'),_0x35ad4c['name'],_0x35ad4c['id']));}else{logger[_0x637f('0x23')](util[_0x637f('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x35ad4c[_0x637f('0x22')],_0x35ad4c['id']),util['inspect'](_0x49f9f4,{'showHidden':![],'depth':null}));}return _0x55dae3(null,_0x5c4039);})[_0x637f('0x26')](function(_0x903f74){logger['error'](util[_0x637f('0x21')](_0x637f('0x24'),_0x35ad4c[_0x637f('0x22')],_0x35ad4c['id']),util[_0x637f('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x55dae3(_0x903f74);});}else{return _0x55dae3(null,_0x5c4039);}}}});}; \ No newline at end of file +var _0xb484=['exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','https://accounts.zoho.com','https://accounts.zoho.com.au','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','substring','lastIndexOf','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration'];(function(_0x3e2086,_0x5e93e0){var _0x45d7e1=function(_0xe43d7c){while(--_0xe43d7c){_0x3e2086['push'](_0x3e2086['shift']());}};_0x45d7e1(++_0x5e93e0);}(_0xb484,0x78));var _0x4b48=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xb484[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0x4b48('0x0'));var util=require(_0x4b48('0x1'));var logger=require(_0x4b48('0x2'))('api');var moment=require(_0x4b48('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b48('0x4'));var fs=require('fs');var path=require(_0x4b48('0x5'));var rimraf=require(_0x4b48('0x6'));var config=require('../../config/environment');var attributes=require(_0x4b48('0x7'));var integrations=require(_0x4b48('0x8'));module[_0x4b48('0x9')]=function(_0x1f2beb,_0x16b171){return _0x1f2beb['define'](_0x4b48('0xa'),attributes,{'tableName':_0x4b48('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x265da5,_0x3fd8b0,_0x1d48ae){if(_0x265da5[_0x4b48('0xc')](_0x4b48('0xd'))||_0x265da5[_0x4b48('0xc')](_0x4b48('0xe'))||_0x265da5[_0x4b48('0xc')](_0x4b48('0xf'))||_0x265da5[_0x4b48('0xc')](_0x4b48('0x10'))||_0x265da5[_0x4b48('0xc')](_0x4b48('0x11'))||_0x265da5[_0x4b48('0xc')](_0x4b48('0x12'))){var _0x122521,_0x33cd7d;_0x122521=_0x265da5[_0x4b48('0xe')];var _0x2363ec=_0x122521[_0x4b48('0x13')](-0x1);if(_0x2363ec==='/'||_0x2363ec==='\x5c'||_0x2363ec===':'){_0x122521=_0x122521['substring'](0x0,_0x122521['lastIndexOf'](_0x2363ec));}switch(_0x265da5['zone']){case'US':_0x33cd7d=_0x4b48('0x14');break;case'AU':_0x33cd7d=_0x4b48('0x15');break;case'IN':_0x33cd7d='https://accounts.zoho.in';break;case'CN':_0x33cd7d='https://accounts.zoho.com.cn';break;default:_0x33cd7d='https://accounts.zoho.eu';break;}var _0x143f4a={'method':_0x4b48('0x16'),'uri':_0x33cd7d+_0x4b48('0x17'),'form':{'grant_type':_0x4b48('0x18'),'client_id':_0x265da5[_0x4b48('0xf')],'client_secret':_0x265da5['clientSecret'],'redirect_uri':_0x265da5[_0x4b48('0xe')],'code':_0x265da5[_0x4b48('0x11')]},'headers':{'Content-Type':_0x4b48('0x19')}};return rp(_0x143f4a)[_0x4b48('0x1a')](function(_0x52cd97){var _0x533195=JSON[_0x4b48('0x1b')](_0x52cd97);if(_0x533195['refresh_token']){_0x265da5[_0x4b48('0x1c')]=_0x533195[_0x4b48('0x1d')];logger[_0x4b48('0x1e')](util[_0x4b48('0x1f')](_0x4b48('0x20'),_0x265da5[_0x4b48('0x21')],_0x265da5['id']));}else{logger[_0x4b48('0x22')](util[_0x4b48('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x265da5[_0x4b48('0x21')],_0x265da5['id']),util[_0x4b48('0x23')](_0x533195,{'showHidden':![],'depth':null}));}return _0x1d48ae(null,_0x3fd8b0);})['catch'](function(_0x39f2fc){logger[_0x4b48('0x22')](util[_0x4b48('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x265da5[_0x4b48('0x21')],_0x265da5['id']),util[_0x4b48('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x1d48ae(_0x39f2fc);});}else{return _0x1d48ae(null,_0x3fd8b0);}},'beforeUpdate':function(_0xd52fd4,_0x159ba,_0x1032fd){if(_0xd52fd4['changed'](_0x4b48('0xd'))||_0xd52fd4[_0x4b48('0xc')](_0x4b48('0xe'))||_0xd52fd4['changed']('clientId')||_0xd52fd4['changed'](_0x4b48('0x10'))||_0xd52fd4[_0x4b48('0xc')](_0x4b48('0x11'))||_0xd52fd4[_0x4b48('0xc')](_0x4b48('0x12'))){var _0x348bb9,_0x36f70b;_0x348bb9=_0xd52fd4[_0x4b48('0xe')];var _0x32d520=_0x348bb9[_0x4b48('0x13')](-0x1);if(_0x32d520==='/'||_0x32d520==='\x5c'||_0x32d520===':'){_0x348bb9=_0x348bb9[_0x4b48('0x24')](0x0,_0x348bb9[_0x4b48('0x25')](_0x32d520));}switch(_0xd52fd4[_0x4b48('0xd')]){case'US':_0x36f70b=_0x4b48('0x14');break;case'AU':_0x36f70b='https://accounts.zoho.com.au';break;case'IN':_0x36f70b=_0x4b48('0x26');break;case'CN':_0x36f70b=_0x4b48('0x27');break;default:_0x36f70b=_0x4b48('0x28');break;}var _0x41332f={'method':_0x4b48('0x16'),'uri':_0x36f70b+_0x4b48('0x17'),'form':{'grant_type':_0x4b48('0x18'),'client_id':_0xd52fd4['clientId'],'client_secret':_0xd52fd4['clientSecret'],'redirect_uri':_0xd52fd4[_0x4b48('0xe')],'code':_0xd52fd4[_0x4b48('0x11')]},'headers':{'Content-Type':_0x4b48('0x19')}};return rp(_0x41332f)[_0x4b48('0x1a')](function(_0x306eb9){var _0x5b39bc=JSON[_0x4b48('0x1b')](_0x306eb9);if(_0x5b39bc[_0x4b48('0x1d')]){_0xd52fd4[_0x4b48('0x1c')]=_0x5b39bc[_0x4b48('0x1d')];logger[_0x4b48('0x1e')](util[_0x4b48('0x1f')](_0x4b48('0x20'),_0xd52fd4['name'],_0xd52fd4['id']));}else{logger[_0x4b48('0x22')](util[_0x4b48('0x1f')](_0x4b48('0x29'),_0xd52fd4[_0x4b48('0x21')],_0xd52fd4['id']),util[_0x4b48('0x23')](_0x5b39bc,{'showHidden':![],'depth':null}));}return _0x1032fd(null,_0x159ba);})[_0x4b48('0x2a')](function(_0x4139d3){logger[_0x4b48('0x22')](util[_0x4b48('0x1f')](_0x4b48('0x29'),_0xd52fd4[_0x4b48('0x21')],_0xd52fd4['id']),util[_0x4b48('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x1032fd(_0x4139d3);});}else{return _0x1032fd(null,_0x159ba);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 0f1f4bf..1bc69f2 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 _0xc177=['catch','GetZohoAccount','findAll','options','raw','where','include','attributes','model','map','debug','ZohoAccount','find','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xc177,0x1b2));var _0x7c17=function(_0x59b405,_0x221cbc){_0x59b405=_0x59b405-0x0;var _0x4ddae7=_0xc177[_0x59b405];return _0x4ddae7;};'use strict';var _=require(_0x7c17('0x0'));var util=require(_0x7c17('0x1'));var moment=require(_0x7c17('0x2'));var BPromise=require(_0x7c17('0x3'));var rs=require(_0x7c17('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c17('0x5'))['db'];var utils=require(_0x7c17('0x6'));var logger=require(_0x7c17('0x7'))(_0x7c17('0x8'));var config=require('../../config/environment');var jayson=require(_0x7c17('0x9'));var client=jayson[_0x7c17('0xa')][_0x7c17('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4810b7,_0x3ab87c,_0x3aa79e){return new BPromise(function(_0x33dd1e,_0x3854dd){return client[_0x7c17('0xc')](_0x4810b7,_0x3aa79e)[_0x7c17('0xd')](function(_0x44e782){logger[_0x7c17('0xe')](_0x7c17('0xf'),_0x3ab87c,_0x7c17('0x10'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3ab87c,'request\x20sent',JSON[_0x7c17('0x11')](_0x44e782));if(_0x44e782[_0x7c17('0x12')]){if(_0x44e782[_0x7c17('0x12')]['code']===0x1f4){logger[_0x7c17('0x12')](_0x7c17('0xf'),_0x3ab87c,_0x44e782[_0x7c17('0x12')]['message']);return _0x3854dd(_0x44e782['error'][_0x7c17('0x13')]);}logger[_0x7c17('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x3ab87c,_0x44e782[_0x7c17('0x12')]['message']);return _0x33dd1e(_0x44e782[_0x7c17('0x12')]['message']);}else{logger[_0x7c17('0xe')](_0x7c17('0xf'),_0x3ab87c,_0x7c17('0x10'));_0x33dd1e(_0x44e782[_0x7c17('0x14')][_0x7c17('0x13')]);}})[_0x7c17('0x15')](function(_0x87715a){logger[_0x7c17('0x12')](_0x7c17('0xf'),_0x3ab87c,_0x87715a);_0x3854dd(_0x87715a);});});}exports[_0x7c17('0x16')]=function(_0x24a25d){var _0x47307a=this;return new Promise(function(_0x2092b8,_0x41440d){return db['ZohoAccount'][_0x7c17('0x17')]({'raw':_0x24a25d[_0x7c17('0x18')]?_0x24a25d['options'][_0x7c17('0x19')]===undefined?!![]:![]:!![],'where':_0x24a25d['options']?_0x24a25d['options'][_0x7c17('0x1a')]||null:null,'attributes':_0x24a25d[_0x7c17('0x18')]?_0x24a25d[_0x7c17('0x18')]['attributes']||null:null,'limit':_0x24a25d[_0x7c17('0x18')]?_0x24a25d[_0x7c17('0x18')]['limit']||null:null,'include':_0x24a25d[_0x7c17('0x18')]?_0x24a25d[_0x7c17('0x18')][_0x7c17('0x1b')]?_['map'](_0x24a25d[_0x7c17('0x18')][_0x7c17('0x1b')],function(_0x394866){return{'model':db[_0x394866['model']],'as':_0x394866['as'],'attributes':_0x394866[_0x7c17('0x1c')],'include':_0x394866[_0x7c17('0x1b')]?_['map'](_0x394866['include'],function(_0x42260f){return{'model':db[_0x42260f[_0x7c17('0x1d')]],'as':_0x42260f['as'],'attributes':_0x42260f[_0x7c17('0x1c')],'include':_0x42260f[_0x7c17('0x1b')]?_[_0x7c17('0x1e')](_0x42260f[_0x7c17('0x1b')],function(_0x5605c6){return{'model':db[_0x5605c6[_0x7c17('0x1d')]],'as':_0x5605c6['as'],'attributes':_0x5605c6[_0x7c17('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7c17('0xd')](function(_0xf2c46c){logger[_0x7c17('0xe')](_0x7c17('0x16'),_0x24a25d);logger[_0x7c17('0x1f')](_0x7c17('0x16'),_0x24a25d,JSON[_0x7c17('0x11')](_0xf2c46c));_0x2092b8(_0xf2c46c);})[_0x7c17('0x15')](function(_0x4776cc){logger[_0x7c17('0x12')](_0x7c17('0x16'),_0x4776cc[_0x7c17('0x13')],_0x24a25d);_0x41440d(_0x47307a[_0x7c17('0x12')](0x1f4,_0x4776cc[_0x7c17('0x13')]));});});};exports['ShowZohoAccount']=function(_0x1378e7){var _0x61a143=this;return new Promise(function(_0x4dd018,_0x98f8f4){return db[_0x7c17('0x20')][_0x7c17('0x21')]({'raw':_0x1378e7['options']?_0x1378e7[_0x7c17('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1378e7[_0x7c17('0x18')]?_0x1378e7[_0x7c17('0x18')][_0x7c17('0x1a')]||null:null,'attributes':_0x1378e7[_0x7c17('0x18')]?_0x1378e7['options'][_0x7c17('0x1c')]||null:null,'include':_0x1378e7[_0x7c17('0x18')]?_0x1378e7[_0x7c17('0x18')][_0x7c17('0x1b')]?_[_0x7c17('0x1e')](_0x1378e7[_0x7c17('0x18')]['include'],function(_0x8c237f){return{'model':db[_0x8c237f[_0x7c17('0x1d')]],'as':_0x8c237f['as'],'attributes':_0x8c237f['attributes'],'include':_0x8c237f[_0x7c17('0x1b')]?_[_0x7c17('0x1e')](_0x8c237f['include'],function(_0x37a986){return{'model':db[_0x37a986['model']],'as':_0x37a986['as'],'attributes':_0x37a986[_0x7c17('0x1c')],'include':_0x37a986[_0x7c17('0x1b')]?_[_0x7c17('0x1e')](_0x37a986['include'],function(_0x8f24cc){return{'model':db[_0x8f24cc[_0x7c17('0x1d')]],'as':_0x8f24cc['as'],'attributes':_0x8f24cc[_0x7c17('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x502e36){logger[_0x7c17('0xe')]('ShowZohoAccount',_0x1378e7);logger[_0x7c17('0x1f')](_0x7c17('0x22'),_0x1378e7,JSON[_0x7c17('0x11')](_0x502e36));_0x4dd018(_0x502e36);})['catch'](function(_0x369c70){logger[_0x7c17('0x12')](_0x7c17('0x22'),_0x369c70[_0x7c17('0x13')],_0x1378e7);_0x98f8f4(_0x61a143[_0x7c17('0x12')](0x1f4,_0x369c70[_0x7c17('0x13')]));});});}; \ No newline at end of file +var _0x4732=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','map','include','model','stringify','ShowZohoAccount','find','lodash','moment','randomstring','ioredis'];(function(_0x4d818b,_0x59d31b){var _0x1e54c8=function(_0x3d267c){while(--_0x3d267c){_0x4d818b['push'](_0x4d818b['shift']());}};_0x1e54c8(++_0x59d31b);}(_0x4732,0x17d));var _0x2473=function(_0x5a64eb,_0x286782){_0x5a64eb=_0x5a64eb-0x0;var _0x3ad930=_0x4732[_0x5a64eb];return _0x3ad930;};'use strict';var _=require(_0x2473('0x0'));var util=require('util');var moment=require(_0x2473('0x1'));var BPromise=require('bluebird');var rs=require(_0x2473('0x2'));var fs=require('fs');var Redis=require(_0x2473('0x3'));var db=require(_0x2473('0x4'))['db'];var utils=require(_0x2473('0x5'));var logger=require(_0x2473('0x6'))(_0x2473('0x7'));var config=require(_0x2473('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2473('0x9')][_0x2473('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50e340,_0x4be81c,_0x593eba){return new BPromise(function(_0x10da0a,_0x29765a){return client[_0x2473('0xb')](_0x50e340,_0x593eba)[_0x2473('0xc')](function(_0x52fffe){logger['info'](_0x2473('0xd'),_0x4be81c,'request\x20sent');logger[_0x2473('0xe')](_0x2473('0xf'),_0x4be81c,'request\x20sent',JSON['stringify'](_0x52fffe));if(_0x52fffe[_0x2473('0x10')]){if(_0x52fffe[_0x2473('0x10')][_0x2473('0x11')]===0x1f4){logger[_0x2473('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x4be81c,_0x52fffe[_0x2473('0x10')][_0x2473('0x12')]);return _0x29765a(_0x52fffe[_0x2473('0x10')][_0x2473('0x12')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x4be81c,_0x52fffe['error'][_0x2473('0x12')]);return _0x10da0a(_0x52fffe[_0x2473('0x10')][_0x2473('0x12')]);}else{logger[_0x2473('0x13')](_0x2473('0xd'),_0x4be81c,_0x2473('0x14'));_0x10da0a(_0x52fffe['result'][_0x2473('0x12')]);}})[_0x2473('0x15')](function(_0x14fcf2){logger[_0x2473('0x10')](_0x2473('0xd'),_0x4be81c,_0x14fcf2);_0x29765a(_0x14fcf2);});});}exports[_0x2473('0x16')]=function(_0x28d995){var _0x481bc2=this;return new Promise(function(_0x2dcaf1,_0x3c5b55){return db[_0x2473('0x17')][_0x2473('0x18')]({'raw':_0x28d995[_0x2473('0x19')]?_0x28d995[_0x2473('0x19')][_0x2473('0x1a')]===undefined?!![]:![]:!![],'where':_0x28d995['options']?_0x28d995[_0x2473('0x19')][_0x2473('0x1b')]||null:null,'attributes':_0x28d995[_0x2473('0x19')]?_0x28d995['options'][_0x2473('0x1c')]||null:null,'limit':_0x28d995[_0x2473('0x19')]?_0x28d995[_0x2473('0x19')]['limit']||null:null,'include':_0x28d995[_0x2473('0x19')]?_0x28d995[_0x2473('0x19')]['include']?_[_0x2473('0x1d')](_0x28d995[_0x2473('0x19')][_0x2473('0x1e')],function(_0x3c2d1d){return{'model':db[_0x3c2d1d['model']],'as':_0x3c2d1d['as'],'attributes':_0x3c2d1d['attributes'],'include':_0x3c2d1d[_0x2473('0x1e')]?_[_0x2473('0x1d')](_0x3c2d1d[_0x2473('0x1e')],function(_0x3c4df9){return{'model':db[_0x3c4df9[_0x2473('0x1f')]],'as':_0x3c4df9['as'],'attributes':_0x3c4df9[_0x2473('0x1c')],'include':_0x3c4df9[_0x2473('0x1e')]?_[_0x2473('0x1d')](_0x3c4df9[_0x2473('0x1e')],function(_0x5d9aaf){return{'model':db[_0x5d9aaf[_0x2473('0x1f')]],'as':_0x5d9aaf['as'],'attributes':_0x5d9aaf[_0x2473('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cfda0){logger[_0x2473('0x13')](_0x2473('0x16'),_0x28d995);logger['debug'](_0x2473('0x16'),_0x28d995,JSON[_0x2473('0x20')](_0x2cfda0));_0x2dcaf1(_0x2cfda0);})[_0x2473('0x15')](function(_0x50fd3b){logger[_0x2473('0x10')]('GetZohoAccount',_0x50fd3b[_0x2473('0x12')],_0x28d995);_0x3c5b55(_0x481bc2[_0x2473('0x10')](0x1f4,_0x50fd3b['message']));});});};exports[_0x2473('0x21')]=function(_0x41fcbf){var _0x5b1787=this;return new Promise(function(_0x5b9094,_0x26d3c4){return db[_0x2473('0x17')][_0x2473('0x22')]({'raw':_0x41fcbf[_0x2473('0x19')]?_0x41fcbf[_0x2473('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x41fcbf[_0x2473('0x19')]?_0x41fcbf[_0x2473('0x19')][_0x2473('0x1b')]||null:null,'attributes':_0x41fcbf[_0x2473('0x19')]?_0x41fcbf[_0x2473('0x19')][_0x2473('0x1c')]||null:null,'include':_0x41fcbf[_0x2473('0x19')]?_0x41fcbf['options'][_0x2473('0x1e')]?_[_0x2473('0x1d')](_0x41fcbf[_0x2473('0x19')]['include'],function(_0x117b94){return{'model':db[_0x117b94[_0x2473('0x1f')]],'as':_0x117b94['as'],'attributes':_0x117b94[_0x2473('0x1c')],'include':_0x117b94['include']?_[_0x2473('0x1d')](_0x117b94[_0x2473('0x1e')],function(_0x437882){return{'model':db[_0x437882[_0x2473('0x1f')]],'as':_0x437882['as'],'attributes':_0x437882[_0x2473('0x1c')],'include':_0x437882['include']?_[_0x2473('0x1d')](_0x437882[_0x2473('0x1e')],function(_0x332410){return{'model':db[_0x332410['model']],'as':_0x332410['as'],'attributes':_0x332410['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c83bb){logger['info'](_0x2473('0x21'),_0x41fcbf);logger[_0x2473('0xe')](_0x2473('0x21'),_0x41fcbf,JSON[_0x2473('0x20')](_0x2c83bb));_0x5b9094(_0x2c83bb);})[_0x2473('0x15')](function(_0x2d114f){logger[_0x2473('0x10')](_0x2473('0x21'),_0x2d114f[_0x2473('0x12')],_0x41fcbf);_0x26d3c4(_0x5b1787[_0x2473('0x10')](0x1f4,_0x2d114f['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 40702d9..7cd0331 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 _0x7155=['/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x453d8b,_0x3c3e28){var _0x5a23c1=function(_0x3eeb22){while(--_0x3eeb22){_0x453d8b['push'](_0x453d8b['shift']());}};_0x5a23c1(++_0x3c3e28);}(_0x7155,0x19f));var _0x5715=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7155[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x5715('0x0'));var path=require(_0x5715('0x1'));var timeout=require(_0x5715('0x2'));var express=require(_0x5715('0x3'));var router=express[_0x5715('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5715('0x5'));var config=require(_0x5715('0x6'));var controller=require(_0x5715('0x7'));router[_0x5715('0x8')]('/',auth[_0x5715('0x9')](),controller[_0x5715('0xa')]);router[_0x5715('0x8')](_0x5715('0xb'),auth[_0x5715('0x9')](),controller[_0x5715('0xc')]);router[_0x5715('0x8')](_0x5715('0xd'),auth['isAuthenticated'](),controller[_0x5715('0xe')]);router[_0x5715('0x8')](_0x5715('0xf'),auth[_0x5715('0x9')](),controller[_0x5715('0x10')]);router[_0x5715('0x8')](_0x5715('0x11'),auth['isAuthenticated'](),controller[_0x5715('0x12')]);router['post']('/',auth[_0x5715('0x9')](),controller['create']);router[_0x5715('0x13')](_0x5715('0xb'),auth[_0x5715('0x9')](),controller[_0x5715('0x14')]);router[_0x5715('0x15')](_0x5715('0xb'),auth[_0x5715('0x9')](),controller[_0x5715('0x16')]);module[_0x5715('0x17')]=router; \ No newline at end of file +var _0x9586=['../../config/environment','./intZohoConfiguration.controller','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9586,0x19e));var _0x6958=function(_0x4e824e,_0x4e7b08){_0x4e824e=_0x4e824e-0x0;var _0x2d8c3b=_0x9586[_0x4e824e];return _0x2d8c3b;};'use strict';var multer=require(_0x6958('0x0'));var util=require(_0x6958('0x1'));var path=require('path');var timeout=require(_0x6958('0x2'));var express=require(_0x6958('0x3'));var router=express[_0x6958('0x4')]();var fs_extra=require(_0x6958('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6958('0x6'));var controller=require(_0x6958('0x7'));router[_0x6958('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6958('0x9'),auth[_0x6958('0xa')](),controller['show']);router[_0x6958('0x8')](_0x6958('0xb'),auth[_0x6958('0xa')](),controller[_0x6958('0xc')]);router[_0x6958('0x8')](_0x6958('0xd'),auth[_0x6958('0xa')](),controller[_0x6958('0xe')]);router[_0x6958('0x8')]('/:id/descriptions',auth[_0x6958('0xa')](),controller[_0x6958('0xf')]);router[_0x6958('0x10')]('/',auth[_0x6958('0xa')](),controller[_0x6958('0x11')]);router['put']('/:id',auth[_0x6958('0xa')](),controller['update']);router[_0x6958('0x12')](_0x6958('0x9'),auth[_0x6958('0xa')](),controller[_0x6958('0x13')]);module[_0x6958('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 8713efa..96f2e07 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 _0xfdc5=['sequelize','exports','STRING','ENUM','lead','contact','nothing','contact_lead'];(function(_0x3d6bab,_0x3242db){var _0x348415=function(_0x324f3b){while(--_0x324f3b){_0x3d6bab['push'](_0x3d6bab['shift']());}};_0x348415(++_0x3242db);}(_0xfdc5,0xa8));var _0x5fdc=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfdc5[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x5fdc('0x0'));module[_0x5fdc('0x1')]={'name':{'type':Sequelize[_0x5fdc('0x2')]},'moduleCreate':{'type':Sequelize[_0x5fdc('0x3')](_0x5fdc('0x4'),_0x5fdc('0x5'),_0x5fdc('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x5fdc('0x3')]('contact_lead',_0x5fdc('0x5'),_0x5fdc('0x4')),'defaultValue':_0x5fdc('0x7')},'description':{'type':Sequelize[_0x5fdc('0x2')]}}; \ No newline at end of file +var _0x55a8=['sequelize','exports','STRING','ENUM','lead','contact','nothing','contact_lead'];(function(_0x76ced3,_0x8abc01){var _0x4fea70=function(_0x519c04){while(--_0x519c04){_0x76ced3['push'](_0x76ced3['shift']());}};_0x4fea70(++_0x8abc01);}(_0x55a8,0x148));var _0x855a=function(_0x363b5e,_0x3d92d2){_0x363b5e=_0x363b5e-0x0;var _0x2fb0e2=_0x55a8[_0x363b5e];return _0x2fb0e2;};'use strict';var Sequelize=require(_0x855a('0x0'));module[_0x855a('0x1')]={'name':{'type':Sequelize[_0x855a('0x2')]},'moduleCreate':{'type':Sequelize[_0x855a('0x3')](_0x855a('0x4'),_0x855a('0x5'),_0x855a('0x6')),'defaultValue':_0x855a('0x4')},'moduleSearch':{'type':Sequelize[_0x855a('0x3')](_0x855a('0x7'),'contact','lead'),'defaultValue':_0x855a('0x7')},'description':{'type':Sequelize[_0x855a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 9c8937e..7680a38 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 _0x458d=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','getFields','findOne','pick','options','ZohoField','getSubjects','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','model','query'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x458d,0x6c));var _0xd458=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x458d[_0x2112d4];return _0x434972;};'use strict';var emlformat=require(_0xd458('0x0'));var rimraf=require(_0xd458('0x1'));var zipdir=require(_0xd458('0x2'));var jsonpatch=require(_0xd458('0x3'));var rp=require(_0xd458('0x4'));var moment=require('moment');var BPromise=require(_0xd458('0x5'));var Mustache=require(_0xd458('0x6'));var util=require(_0xd458('0x7'));var path=require(_0xd458('0x8'));var sox=require(_0xd458('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd458('0xa'));var _=require('lodash');var squel=require(_0xd458('0xb'));var crypto=require(_0xd458('0xc'));var jsforce=require(_0xd458('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd458('0xe'));var Papa=require(_0xd458('0xf'));var Redis=require(_0xd458('0x10'));var authService=require(_0xd458('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd458('0x12'));var hardwareService=require(_0xd458('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd458('0x14'));var config=require(_0xd458('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd458('0x16'))['db'];function respondWithStatusCode(_0x1498f6,_0x2c8d30){_0x2c8d30=_0x2c8d30||0xcc;return function(_0x3d76aa){if(_0x3d76aa){return _0x1498f6['sendStatus'](_0x2c8d30);}return _0x1498f6[_0xd458('0x17')](_0x2c8d30)[_0xd458('0x18')]();};}function respondWithResult(_0x29e884,_0x29154c){_0x29154c=_0x29154c||0xc8;return function(_0x89cf34){if(_0x89cf34){return _0x29e884['status'](_0x29154c)[_0xd458('0x19')](_0x89cf34);}};}function respondWithFilteredResult(_0x427db7,_0x4eb0d5){return function(_0x301ee1){if(_0x301ee1){var _0x203a67=typeof _0x4eb0d5[_0xd458('0x1a')]==='undefined'&&typeof _0x4eb0d5[_0xd458('0x1b')]===_0xd458('0x1c');var _0x5e217=_0x301ee1[_0xd458('0x1d')];var _0x3925f7=_0x203a67?0x0:_0x4eb0d5['offset'];var _0x1a9587=_0x203a67?_0x301ee1[_0xd458('0x1d')]:_0x4eb0d5[_0xd458('0x1a')]+_0x4eb0d5[_0xd458('0x1b')];var _0x32d48c;if(_0x1a9587>=_0x5e217){_0x1a9587=_0x5e217;_0x32d48c=0xc8;}else{_0x32d48c=0xce;}_0x427db7['status'](_0x32d48c);return _0x427db7[_0xd458('0x1e')](_0xd458('0x1f'),_0x3925f7+'-'+_0x1a9587+'/'+_0x5e217)[_0xd458('0x19')](_0x301ee1);}return null;};}function patchUpdates(_0x93681f){return function(_0x15fb95){try{jsonpatch[_0xd458('0x20')](_0x15fb95,_0x93681f,!![]);}catch(_0x28c998){return BPromise['reject'](_0x28c998);}return _0x15fb95[_0xd458('0x21')]();};}function saveUpdates(_0x4eac97,_0x51d20f){return function(_0x1ff75c){if(_0x1ff75c){return _0x1ff75c[_0xd458('0x22')](_0x4eac97)[_0xd458('0x23')](function(_0x341caa){return _0x341caa;});}return null;};}function removeEntity(_0x17e357,_0x99fbbe){return function(_0x242bfa){if(_0x242bfa){return _0x242bfa[_0xd458('0x24')]()[_0xd458('0x23')](function(){_0x17e357[_0xd458('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x350c53,_0x398cfa){return function(_0x120082){if(!_0x120082){_0x350c53[_0xd458('0x25')](0x194);}return _0x120082;};}function handleError(_0x12644d,_0x35986b){_0x35986b=_0x35986b||0x1f4;return function(_0x107c13){logger[_0xd458('0x26')](_0x107c13[_0xd458('0x27')]);if(_0x107c13['name']){delete _0x107c13[_0xd458('0x28')];}_0x12644d[_0xd458('0x17')](_0x35986b)[_0xd458('0x29')](_0x107c13);};}exports[_0xd458('0x2a')]=function(_0x5567f8,_0x2a52e6){var _0x54c082={},_0x456ed5={},_0x319270={'count':0x0,'rows':[]};var _0x5e3b00=_[_0xd458('0x2b')](db[_0xd458('0x2c')][_0xd458('0x2d')],function(_0x5609a7){return{'name':_0x5609a7['fieldName'],'type':_0x5609a7[_0xd458('0x2e')][_0xd458('0x2f')]};});_0x456ed5[_0xd458('0x30')]=_[_0xd458('0x2b')](_0x5e3b00,_0xd458('0x28'));_0x456ed5[_0xd458('0x31')]=_['keys'](_0x5567f8['query']);_0x456ed5['filters']=_[_0xd458('0x32')](_0x456ed5['model'],_0x456ed5['query']);_0x54c082['attributes']=_['intersection'](_0x456ed5['model'],qs[_0xd458('0x33')](_0x5567f8[_0xd458('0x31')][_0xd458('0x33')]));_0x54c082[_0xd458('0x34')]=_0x54c082['attributes'][_0xd458('0x35')]?_0x54c082['attributes']:_0x456ed5[_0xd458('0x30')];if(!_0x5567f8['query'][_0xd458('0x36')](_0xd458('0x37'))){_0x54c082['limit']=qs['limit'](_0x5567f8['query'][_0xd458('0x1b')]);_0x54c082[_0xd458('0x1a')]=qs[_0xd458('0x1a')](_0x5567f8[_0xd458('0x31')][_0xd458('0x1a')]);}_0x54c082[_0xd458('0x38')]=qs[_0xd458('0x39')](_0x5567f8[_0xd458('0x31')][_0xd458('0x39')]);_0x54c082[_0xd458('0x3a')]=qs['filters'](_['pick'](_0x5567f8[_0xd458('0x31')],_0x456ed5[_0xd458('0x3b')]),_0x5e3b00);if(_0x5567f8[_0xd458('0x31')][_0xd458('0x3c')]){_0x54c082['where']=_[_0xd458('0x3d')](_0x54c082[_0xd458('0x3a')],{'$or':_['map'](_0x5e3b00,function(_0x2727ea){if(_0x2727ea[_0xd458('0x2e')]!=='VIRTUAL'){var _0x4a9c61={};_0x4a9c61[_0x2727ea[_0xd458('0x28')]]={'$like':'%'+_0x5567f8[_0xd458('0x31')][_0xd458('0x3c')]+'%'};return _0x4a9c61;}})});}_0x54c082=_[_0xd458('0x3d')]({},_0x54c082,_0x5567f8['options']);var _0x160f3b={'where':_0x54c082[_0xd458('0x3a')]};return db['ZohoConfiguration'][_0xd458('0x1d')](_0x160f3b)['then'](function(_0x48660d){_0x319270[_0xd458('0x1d')]=_0x48660d;if(_0x5567f8[_0xd458('0x31')][_0xd458('0x3e')]){_0x54c082[_0xd458('0x3f')]=[{'all':!![]}];}return db[_0xd458('0x2c')][_0xd458('0x40')](_0x54c082);})[_0xd458('0x23')](function(_0x596ea3){_0x319270[_0xd458('0x41')]=_0x596ea3;return _0x319270;})['then'](respondWithFilteredResult(_0x2a52e6,_0x54c082))['catch'](handleError(_0x2a52e6,null));};exports[_0xd458('0x42')]=function(_0xd9ac40,_0x2422ac){var _0x4395f3={'raw':![],'where':{'id':_0xd9ac40[_0xd458('0x43')]['id']}},_0x50de6a={};_0x50de6a[_0xd458('0x30')]=_[_0xd458('0x44')](db[_0xd458('0x2c')][_0xd458('0x2d')]);_0x50de6a[_0xd458('0x31')]=_[_0xd458('0x44')](_0xd9ac40[_0xd458('0x31')]);_0x50de6a[_0xd458('0x3b')]=_[_0xd458('0x32')](_0x50de6a[_0xd458('0x30')],_0x50de6a['query']);_0x4395f3[_0xd458('0x34')]=_['intersection'](_0x50de6a[_0xd458('0x30')],qs[_0xd458('0x33')](_0xd9ac40[_0xd458('0x31')][_0xd458('0x33')]));_0x4395f3[_0xd458('0x34')]=_0x4395f3[_0xd458('0x34')]['length']?_0x4395f3[_0xd458('0x34')]:_0x50de6a[_0xd458('0x30')];if(_0xd9ac40[_0xd458('0x31')][_0xd458('0x3e')]){_0x4395f3[_0xd458('0x3f')]=[{'all':!![]}];}_0x4395f3=_['merge']({},_0x4395f3,_0xd9ac40['options']);return db[_0xd458('0x2c')]['find'](_0x4395f3)[_0xd458('0x23')](handleEntityNotFound(_0x2422ac,null))['then'](respondWithResult(_0x2422ac,null))[_0xd458('0x45')](handleError(_0x2422ac,null));};exports[_0xd458('0x46')]=function(_0x29e1c0,_0x4fcddb){return db[_0xd458('0x2c')][_0xd458('0x46')](_0x29e1c0['body'],{})[_0xd458('0x23')](respondWithResult(_0x4fcddb,0xc9))['catch'](handleError(_0x4fcddb,null));};exports['update']=function(_0x5bf624,_0x44f8f4){if(_0x5bf624[_0xd458('0x47')]['id']){delete _0x5bf624[_0xd458('0x47')]['id'];}return db[_0xd458('0x2c')][_0xd458('0x48')]({'where':{'id':_0x5bf624['params']['id']}})[_0xd458('0x23')](handleEntityNotFound(_0x44f8f4,null))[_0xd458('0x23')](saveUpdates(_0x5bf624[_0xd458('0x47')],null))['then'](respondWithResult(_0x44f8f4,null))[_0xd458('0x45')](handleError(_0x44f8f4,null));};exports[_0xd458('0x24')]=function(_0x52326c,_0x5a8baa){return db[_0xd458('0x2c')][_0xd458('0x48')]({'where':{'id':_0x52326c[_0xd458('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a8baa,null))[_0xd458('0x23')](removeEntity(_0x5a8baa,null))[_0xd458('0x45')](handleError(_0x5a8baa,null));};exports[_0xd458('0x49')]=function(_0x41d166,_0x5e637d,_0x8f7596){var _0x53ec26={};var _0x3b0785={};var _0x447dbd;var _0x3169e4;return db[_0xd458('0x2c')][_0xd458('0x4a')]({'where':{'id':_0x41d166[_0xd458('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e637d,null))['then'](function(_0x43084b){if(_0x43084b){_0x447dbd=_0x43084b;_0x3b0785[_0xd458('0x30')]=_['keys'](db['ZohoField'][_0xd458('0x2d')]);_0x3b0785[_0xd458('0x31')]=_[_0xd458('0x44')](_0x41d166['query']);_0x3b0785[_0xd458('0x3b')]=_['intersection'](_0x3b0785[_0xd458('0x30')],_0x3b0785[_0xd458('0x31')]);_0x53ec26[_0xd458('0x34')]=_['intersection'](_0x3b0785['model'],qs['fields'](_0x41d166[_0xd458('0x31')][_0xd458('0x33')]));_0x53ec26[_0xd458('0x34')]=_0x53ec26[_0xd458('0x34')][_0xd458('0x35')]?_0x53ec26[_0xd458('0x34')]:_0x3b0785[_0xd458('0x30')];_0x53ec26[_0xd458('0x38')]=qs[_0xd458('0x39')](_0x41d166['query'][_0xd458('0x39')]);_0x53ec26['where']=qs['filters'](_[_0xd458('0x4b')](_0x41d166[_0xd458('0x31')],_0x3b0785[_0xd458('0x3b')]));if(_0x41d166[_0xd458('0x31')][_0xd458('0x3c')]){_0x53ec26[_0xd458('0x3a')]=_[_0xd458('0x3d')](_0x53ec26[_0xd458('0x3a')],{'$or':_[_0xd458('0x2b')](_0x53ec26[_0xd458('0x34')],function(_0x148cbd){var _0x1ce674={};_0x1ce674[_0x148cbd]={'$like':'%'+_0x41d166[_0xd458('0x31')]['filter']+'%'};return _0x1ce674;})});}_0x53ec26=_[_0xd458('0x3d')]({},_0x53ec26,_0x41d166[_0xd458('0x4c')]);return _0x447dbd[_0xd458('0x49')](_0x53ec26);}})[_0xd458('0x23')](function(_0x4fb9f4){if(_0x4fb9f4){_0x3169e4=_0x4fb9f4[_0xd458('0x35')];if(!_0x41d166[_0xd458('0x31')][_0xd458('0x36')](_0xd458('0x37'))){_0x53ec26[_0xd458('0x1b')]=qs[_0xd458('0x1b')](_0x41d166[_0xd458('0x31')][_0xd458('0x1b')]);_0x53ec26['offset']=qs[_0xd458('0x1a')](_0x41d166[_0xd458('0x31')][_0xd458('0x1a')]);}return _0x447dbd[_0xd458('0x49')](_0x53ec26);}})[_0xd458('0x23')](function(_0xef7ca6){if(_0xef7ca6){return _0xef7ca6?{'count':_0x3169e4,'rows':_0xef7ca6}:null;}})[_0xd458('0x23')](respondWithResult(_0x5e637d,null))[_0xd458('0x45')](handleError(_0x5e637d,null));};exports['getSubjects']=function(_0x482ec6,_0x5bf319,_0x5730a){var _0x36a7a7={};var _0xd37548={};var _0x307ff9;var _0x31d20f;return db[_0xd458('0x2c')][_0xd458('0x4a')]({'where':{'id':_0x482ec6[_0xd458('0x43')]['id']}})[_0xd458('0x23')](handleEntityNotFound(_0x5bf319,null))['then'](function(_0x5c2d83){if(_0x5c2d83){_0x307ff9=_0x5c2d83;_0xd37548['model']=_[_0xd458('0x44')](db[_0xd458('0x4d')][_0xd458('0x2d')]);_0xd37548[_0xd458('0x31')]=_[_0xd458('0x44')](_0x482ec6[_0xd458('0x31')]);_0xd37548['filters']=_[_0xd458('0x32')](_0xd37548[_0xd458('0x30')],_0xd37548[_0xd458('0x31')]);_0x36a7a7[_0xd458('0x34')]=_[_0xd458('0x32')](_0xd37548[_0xd458('0x30')],qs[_0xd458('0x33')](_0x482ec6[_0xd458('0x31')][_0xd458('0x33')]));_0x36a7a7['attributes']=_0x36a7a7[_0xd458('0x34')][_0xd458('0x35')]?_0x36a7a7[_0xd458('0x34')]:_0xd37548[_0xd458('0x30')];_0x36a7a7[_0xd458('0x38')]=qs['sort'](_0x482ec6['query'][_0xd458('0x39')]);_0x36a7a7[_0xd458('0x3a')]=qs[_0xd458('0x3b')](_[_0xd458('0x4b')](_0x482ec6[_0xd458('0x31')],_0xd37548[_0xd458('0x3b')]));if(_0x482ec6[_0xd458('0x31')]['filter']){_0x36a7a7[_0xd458('0x3a')]=_[_0xd458('0x3d')](_0x36a7a7[_0xd458('0x3a')],{'$or':_[_0xd458('0x2b')](_0x36a7a7['attributes'],function(_0x3be5b5){var _0x577e1b={};_0x577e1b[_0x3be5b5]={'$like':'%'+_0x482ec6[_0xd458('0x31')][_0xd458('0x3c')]+'%'};return _0x577e1b;})});}_0x36a7a7=_[_0xd458('0x3d')]({},_0x36a7a7,_0x482ec6[_0xd458('0x4c')]);return _0x307ff9[_0xd458('0x4e')](_0x36a7a7);}})[_0xd458('0x23')](function(_0x280576){if(_0x280576){_0x31d20f=_0x280576[_0xd458('0x35')];if(!_0x482ec6[_0xd458('0x31')][_0xd458('0x36')](_0xd458('0x37'))){_0x36a7a7[_0xd458('0x1b')]=qs['limit'](_0x482ec6['query']['limit']);_0x36a7a7[_0xd458('0x1a')]=qs[_0xd458('0x1a')](_0x482ec6[_0xd458('0x31')][_0xd458('0x1a')]);}return _0x307ff9[_0xd458('0x4e')](_0x36a7a7);}})[_0xd458('0x23')](function(_0x5d224b){if(_0x5d224b){return _0x5d224b?{'count':_0x31d20f,'rows':_0x5d224b}:null;}})['then'](respondWithResult(_0x5bf319,null))[_0xd458('0x45')](handleError(_0x5bf319,null));};exports['getDescriptions']=function(_0x695a7d,_0x52fa4b,_0x4748e1){var _0x220bdd={};var _0x11a171={};var _0x3dd8ac;var _0x16c238;return db[_0xd458('0x2c')][_0xd458('0x4a')]({'where':{'id':_0x695a7d['params']['id']}})[_0xd458('0x23')](handleEntityNotFound(_0x52fa4b,null))[_0xd458('0x23')](function(_0xc80b88){if(_0xc80b88){_0x3dd8ac=_0xc80b88;_0x11a171['model']=_[_0xd458('0x44')](db['ZohoField']['rawAttributes']);_0x11a171['query']=_[_0xd458('0x44')](_0x695a7d['query']);_0x11a171[_0xd458('0x3b')]=_[_0xd458('0x32')](_0x11a171[_0xd458('0x30')],_0x11a171[_0xd458('0x31')]);_0x220bdd[_0xd458('0x34')]=_[_0xd458('0x32')](_0x11a171[_0xd458('0x30')],qs[_0xd458('0x33')](_0x695a7d[_0xd458('0x31')][_0xd458('0x33')]));_0x220bdd[_0xd458('0x34')]=_0x220bdd['attributes'][_0xd458('0x35')]?_0x220bdd['attributes']:_0x11a171[_0xd458('0x30')];_0x220bdd[_0xd458('0x38')]=qs['sort'](_0x695a7d[_0xd458('0x31')][_0xd458('0x39')]);_0x220bdd[_0xd458('0x3a')]=qs['filters'](_['pick'](_0x695a7d[_0xd458('0x31')],_0x11a171[_0xd458('0x3b')]));if(_0x695a7d[_0xd458('0x31')]['filter']){_0x220bdd[_0xd458('0x3a')]=_[_0xd458('0x3d')](_0x220bdd[_0xd458('0x3a')],{'$or':_[_0xd458('0x2b')](_0x220bdd[_0xd458('0x34')],function(_0x1e8d99){var _0x1f95cb={};_0x1f95cb[_0x1e8d99]={'$like':'%'+_0x695a7d['query']['filter']+'%'};return _0x1f95cb;})});}_0x220bdd=_[_0xd458('0x3d')]({},_0x220bdd,_0x695a7d[_0xd458('0x4c')]);return _0x3dd8ac['getDescriptions'](_0x220bdd);}})[_0xd458('0x23')](function(_0x1c2ef4){if(_0x1c2ef4){_0x16c238=_0x1c2ef4[_0xd458('0x35')];if(!_0x695a7d['query'][_0xd458('0x36')]('nolimit')){_0x220bdd[_0xd458('0x1b')]=qs[_0xd458('0x1b')](_0x695a7d[_0xd458('0x31')][_0xd458('0x1b')]);_0x220bdd[_0xd458('0x1a')]=qs[_0xd458('0x1a')](_0x695a7d[_0xd458('0x31')][_0xd458('0x1a')]);}return _0x3dd8ac['getDescriptions'](_0x220bdd);}})[_0xd458('0x23')](function(_0x4e83e8){if(_0x4e83e8){return _0x4e83e8?{'count':_0x16c238,'rows':_0x4e83e8}:null;}})[_0xd458('0x23')](respondWithResult(_0x52fa4b,null))[_0xd458('0x45')](handleError(_0x52fa4b,null));}; \ No newline at end of file +var _0xee15=['order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','then','catch','show','params','find','create','body','destroy','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','Content-Range','reject','save','update','error','stack','name','map','ZohoConfiguration','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xee15,0x190));var _0x5ee1=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0xee15[_0x223461];return _0x4dbe0a;};'use strict';var emlformat=require(_0x5ee1('0x0'));var rimraf=require(_0x5ee1('0x1'));var zipdir=require(_0x5ee1('0x2'));var jsonpatch=require(_0x5ee1('0x3'));var rp=require(_0x5ee1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5ee1('0x5'));var sox=require(_0x5ee1('0x6'));var csv=require(_0x5ee1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ee1('0x8'));var _=require(_0x5ee1('0x9'));var squel=require(_0x5ee1('0xa'));var crypto=require(_0x5ee1('0xb'));var jsforce=require(_0x5ee1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5ee1('0x7'));var querystring=require(_0x5ee1('0xd'));var Papa=require(_0x5ee1('0xe'));var Redis=require(_0x5ee1('0xf'));var authService=require(_0x5ee1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5ee1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ee1('0x12'))('api');var utils=require(_0x5ee1('0x13'));var config=require(_0x5ee1('0x14'));var licenseUtil=require(_0x5ee1('0x15'));var db=require(_0x5ee1('0x16'))['db'];function respondWithStatusCode(_0x59a3c5,_0x3d75f3){_0x3d75f3=_0x3d75f3||0xcc;return function(_0x346a71){if(_0x346a71){return _0x59a3c5[_0x5ee1('0x17')](_0x3d75f3);}return _0x59a3c5['status'](_0x3d75f3)[_0x5ee1('0x18')]();};}function respondWithResult(_0x153815,_0x122e27){_0x122e27=_0x122e27||0xc8;return function(_0x298a74){if(_0x298a74){return _0x153815['status'](_0x122e27)['json'](_0x298a74);}};}function respondWithFilteredResult(_0x2b10aa,_0x221edf){return function(_0x124feb){if(_0x124feb){var _0x510508=typeof _0x221edf[_0x5ee1('0x19')]===_0x5ee1('0x1a')&&typeof _0x221edf[_0x5ee1('0x1b')]===_0x5ee1('0x1a');var _0x16f12a=_0x124feb[_0x5ee1('0x1c')];var _0x65b881=_0x510508?0x0:_0x221edf['offset'];var _0x19a6c5=_0x510508?_0x124feb['count']:_0x221edf['offset']+_0x221edf[_0x5ee1('0x1b')];var _0x86fcc;if(_0x19a6c5>=_0x16f12a){_0x19a6c5=_0x16f12a;_0x86fcc=0xc8;}else{_0x86fcc=0xce;}_0x2b10aa[_0x5ee1('0x1d')](_0x86fcc);return _0x2b10aa['set'](_0x5ee1('0x1e'),_0x65b881+'-'+_0x19a6c5+'/'+_0x16f12a)['json'](_0x124feb);}return null;};}function patchUpdates(_0x5b8566){return function(_0x283616){try{jsonpatch['apply'](_0x283616,_0x5b8566,!![]);}catch(_0x249702){return BPromise[_0x5ee1('0x1f')](_0x249702);}return _0x283616[_0x5ee1('0x20')]();};}function saveUpdates(_0x466564,_0x2eb6b8){return function(_0x4d74b1){if(_0x4d74b1){return _0x4d74b1[_0x5ee1('0x21')](_0x466564)['then'](function(_0x1d3e3d){return _0x1d3e3d;});}return null;};}function removeEntity(_0x2cd442,_0x3e5393){return function(_0xf39db6){if(_0xf39db6){return _0xf39db6['destroy']()['then'](function(){_0x2cd442[_0x5ee1('0x1d')](0xcc)[_0x5ee1('0x18')]();});}};}function handleEntityNotFound(_0x867503,_0x2e57ce){return function(_0x45f08d){if(!_0x45f08d){_0x867503[_0x5ee1('0x17')](0x194);}return _0x45f08d;};}function handleError(_0x5f1372,_0x6c475a){_0x6c475a=_0x6c475a||0x1f4;return function(_0x43fad5){logger[_0x5ee1('0x22')](_0x43fad5[_0x5ee1('0x23')]);if(_0x43fad5[_0x5ee1('0x24')]){delete _0x43fad5['name'];}_0x5f1372[_0x5ee1('0x1d')](_0x6c475a)['send'](_0x43fad5);};}exports['index']=function(_0x378a49,_0x21e02e){var _0x5c084b={},_0xc379a3={},_0x200c51={'count':0x0,'rows':[]};var _0x21b4ab=_[_0x5ee1('0x25')](db[_0x5ee1('0x26')][_0x5ee1('0x27')],function(_0x1cff74){return{'name':_0x1cff74['fieldName'],'type':_0x1cff74['type'][_0x5ee1('0x28')]};});_0xc379a3[_0x5ee1('0x29')]=_[_0x5ee1('0x25')](_0x21b4ab,_0x5ee1('0x24'));_0xc379a3[_0x5ee1('0x2a')]=_[_0x5ee1('0x2b')](_0x378a49[_0x5ee1('0x2a')]);_0xc379a3[_0x5ee1('0x2c')]=_[_0x5ee1('0x2d')](_0xc379a3[_0x5ee1('0x29')],_0xc379a3[_0x5ee1('0x2a')]);_0x5c084b[_0x5ee1('0x2e')]=_[_0x5ee1('0x2d')](_0xc379a3[_0x5ee1('0x29')],qs[_0x5ee1('0x2f')](_0x378a49[_0x5ee1('0x2a')][_0x5ee1('0x2f')]));_0x5c084b[_0x5ee1('0x2e')]=_0x5c084b[_0x5ee1('0x2e')][_0x5ee1('0x30')]?_0x5c084b[_0x5ee1('0x2e')]:_0xc379a3[_0x5ee1('0x29')];if(!_0x378a49[_0x5ee1('0x2a')]['hasOwnProperty'](_0x5ee1('0x31'))){_0x5c084b['limit']=qs[_0x5ee1('0x1b')](_0x378a49['query']['limit']);_0x5c084b['offset']=qs[_0x5ee1('0x19')](_0x378a49[_0x5ee1('0x2a')]['offset']);}_0x5c084b[_0x5ee1('0x32')]=qs[_0x5ee1('0x33')](_0x378a49[_0x5ee1('0x2a')]['sort']);_0x5c084b[_0x5ee1('0x34')]=qs[_0x5ee1('0x2c')](_[_0x5ee1('0x35')](_0x378a49[_0x5ee1('0x2a')],_0xc379a3[_0x5ee1('0x2c')]),_0x21b4ab);if(_0x378a49[_0x5ee1('0x2a')][_0x5ee1('0x36')]){_0x5c084b[_0x5ee1('0x34')]=_[_0x5ee1('0x37')](_0x5c084b[_0x5ee1('0x34')],{'$or':_['map'](_0x21b4ab,function(_0x49bba6){if(_0x49bba6[_0x5ee1('0x38')]!==_0x5ee1('0x39')){var _0x389a6a={};_0x389a6a[_0x49bba6['name']]={'$like':'%'+_0x378a49[_0x5ee1('0x2a')][_0x5ee1('0x36')]+'%'};return _0x389a6a;}})});}_0x5c084b=_[_0x5ee1('0x37')]({},_0x5c084b,_0x378a49[_0x5ee1('0x3a')]);var _0x1a2015={'where':_0x5c084b[_0x5ee1('0x34')]};return db[_0x5ee1('0x26')]['count'](_0x1a2015)['then'](function(_0xd28071){_0x200c51[_0x5ee1('0x1c')]=_0xd28071;if(_0x378a49[_0x5ee1('0x2a')][_0x5ee1('0x3b')]){_0x5c084b[_0x5ee1('0x3c')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x5ee1('0x3d')](_0x5c084b);})[_0x5ee1('0x3e')](function(_0x4281d9){_0x200c51['rows']=_0x4281d9;return _0x200c51;})[_0x5ee1('0x3e')](respondWithFilteredResult(_0x21e02e,_0x5c084b))[_0x5ee1('0x3f')](handleError(_0x21e02e,null));};exports[_0x5ee1('0x40')]=function(_0x55e270,_0x29cda2){var _0x27d581={'raw':![],'where':{'id':_0x55e270[_0x5ee1('0x41')]['id']}},_0x451bed={};_0x451bed[_0x5ee1('0x29')]=_['keys'](db[_0x5ee1('0x26')]['rawAttributes']);_0x451bed[_0x5ee1('0x2a')]=_['keys'](_0x55e270[_0x5ee1('0x2a')]);_0x451bed['filters']=_[_0x5ee1('0x2d')](_0x451bed[_0x5ee1('0x29')],_0x451bed['query']);_0x27d581['attributes']=_[_0x5ee1('0x2d')](_0x451bed[_0x5ee1('0x29')],qs[_0x5ee1('0x2f')](_0x55e270[_0x5ee1('0x2a')][_0x5ee1('0x2f')]));_0x27d581[_0x5ee1('0x2e')]=_0x27d581[_0x5ee1('0x2e')][_0x5ee1('0x30')]?_0x27d581['attributes']:_0x451bed['model'];if(_0x55e270[_0x5ee1('0x2a')][_0x5ee1('0x3b')]){_0x27d581[_0x5ee1('0x3c')]=[{'all':!![]}];}_0x27d581=_[_0x5ee1('0x37')]({},_0x27d581,_0x55e270[_0x5ee1('0x3a')]);return db[_0x5ee1('0x26')][_0x5ee1('0x42')](_0x27d581)[_0x5ee1('0x3e')](handleEntityNotFound(_0x29cda2,null))['then'](respondWithResult(_0x29cda2,null))[_0x5ee1('0x3f')](handleError(_0x29cda2,null));};exports['create']=function(_0x5c5e30,_0x5225cc){return db[_0x5ee1('0x26')][_0x5ee1('0x43')](_0x5c5e30[_0x5ee1('0x44')],{})[_0x5ee1('0x3e')](respondWithResult(_0x5225cc,0xc9))[_0x5ee1('0x3f')](handleError(_0x5225cc,null));};exports[_0x5ee1('0x21')]=function(_0x506cc8,_0x102bb5){if(_0x506cc8[_0x5ee1('0x44')]['id']){delete _0x506cc8['body']['id'];}return db[_0x5ee1('0x26')][_0x5ee1('0x42')]({'where':{'id':_0x506cc8[_0x5ee1('0x41')]['id']}})['then'](handleEntityNotFound(_0x102bb5,null))[_0x5ee1('0x3e')](saveUpdates(_0x506cc8['body'],null))[_0x5ee1('0x3e')](respondWithResult(_0x102bb5,null))[_0x5ee1('0x3f')](handleError(_0x102bb5,null));};exports[_0x5ee1('0x45')]=function(_0x27d134,_0x16f973){return db[_0x5ee1('0x26')][_0x5ee1('0x42')]({'where':{'id':_0x27d134[_0x5ee1('0x41')]['id']}})[_0x5ee1('0x3e')](handleEntityNotFound(_0x16f973,null))[_0x5ee1('0x3e')](removeEntity(_0x16f973,null))[_0x5ee1('0x3f')](handleError(_0x16f973,null));};exports['getFields']=function(_0x2e0d31,_0x1c9a80,_0x2e70f6){var _0x44f960={};var _0x4ca54e={};var _0x1635e6;var _0x110fa8;return db[_0x5ee1('0x26')][_0x5ee1('0x46')]({'where':{'id':_0x2e0d31[_0x5ee1('0x41')]['id']}})[_0x5ee1('0x3e')](handleEntityNotFound(_0x1c9a80,null))['then'](function(_0x3e6f02){if(_0x3e6f02){_0x1635e6=_0x3e6f02;_0x4ca54e[_0x5ee1('0x29')]=_[_0x5ee1('0x2b')](db[_0x5ee1('0x47')]['rawAttributes']);_0x4ca54e[_0x5ee1('0x2a')]=_[_0x5ee1('0x2b')](_0x2e0d31[_0x5ee1('0x2a')]);_0x4ca54e[_0x5ee1('0x2c')]=_[_0x5ee1('0x2d')](_0x4ca54e[_0x5ee1('0x29')],_0x4ca54e[_0x5ee1('0x2a')]);_0x44f960[_0x5ee1('0x2e')]=_['intersection'](_0x4ca54e[_0x5ee1('0x29')],qs['fields'](_0x2e0d31['query']['fields']));_0x44f960[_0x5ee1('0x2e')]=_0x44f960[_0x5ee1('0x2e')][_0x5ee1('0x30')]?_0x44f960[_0x5ee1('0x2e')]:_0x4ca54e['model'];_0x44f960['order']=qs[_0x5ee1('0x33')](_0x2e0d31['query'][_0x5ee1('0x33')]);_0x44f960[_0x5ee1('0x34')]=qs[_0x5ee1('0x2c')](_[_0x5ee1('0x35')](_0x2e0d31['query'],_0x4ca54e['filters']));if(_0x2e0d31[_0x5ee1('0x2a')]['filter']){_0x44f960[_0x5ee1('0x34')]=_['merge'](_0x44f960['where'],{'$or':_[_0x5ee1('0x25')](_0x44f960[_0x5ee1('0x2e')],function(_0x338003){var _0x1404fa={};_0x1404fa[_0x338003]={'$like':'%'+_0x2e0d31[_0x5ee1('0x2a')][_0x5ee1('0x36')]+'%'};return _0x1404fa;})});}_0x44f960=_[_0x5ee1('0x37')]({},_0x44f960,_0x2e0d31[_0x5ee1('0x3a')]);return _0x1635e6['getFields'](_0x44f960);}})[_0x5ee1('0x3e')](function(_0x37145b){if(_0x37145b){_0x110fa8=_0x37145b['length'];if(!_0x2e0d31['query'][_0x5ee1('0x48')](_0x5ee1('0x31'))){_0x44f960[_0x5ee1('0x1b')]=qs[_0x5ee1('0x1b')](_0x2e0d31[_0x5ee1('0x2a')][_0x5ee1('0x1b')]);_0x44f960[_0x5ee1('0x19')]=qs[_0x5ee1('0x19')](_0x2e0d31[_0x5ee1('0x2a')][_0x5ee1('0x19')]);}return _0x1635e6['getFields'](_0x44f960);}})[_0x5ee1('0x3e')](function(_0x5d2d1d){if(_0x5d2d1d){return _0x5d2d1d?{'count':_0x110fa8,'rows':_0x5d2d1d}:null;}})[_0x5ee1('0x3e')](respondWithResult(_0x1c9a80,null))[_0x5ee1('0x3f')](handleError(_0x1c9a80,null));};exports['getSubjects']=function(_0x240afe,_0x200716,_0x3b5da7){var _0x4d29ac={};var _0x1f0df6={};var _0x2404ec;var _0x2c9413;return db['ZohoConfiguration'][_0x5ee1('0x46')]({'where':{'id':_0x240afe[_0x5ee1('0x41')]['id']}})[_0x5ee1('0x3e')](handleEntityNotFound(_0x200716,null))[_0x5ee1('0x3e')](function(_0x365188){if(_0x365188){_0x2404ec=_0x365188;_0x1f0df6[_0x5ee1('0x29')]=_[_0x5ee1('0x2b')](db[_0x5ee1('0x47')]['rawAttributes']);_0x1f0df6[_0x5ee1('0x2a')]=_['keys'](_0x240afe[_0x5ee1('0x2a')]);_0x1f0df6[_0x5ee1('0x2c')]=_['intersection'](_0x1f0df6['model'],_0x1f0df6[_0x5ee1('0x2a')]);_0x4d29ac[_0x5ee1('0x2e')]=_[_0x5ee1('0x2d')](_0x1f0df6[_0x5ee1('0x29')],qs[_0x5ee1('0x2f')](_0x240afe[_0x5ee1('0x2a')][_0x5ee1('0x2f')]));_0x4d29ac[_0x5ee1('0x2e')]=_0x4d29ac[_0x5ee1('0x2e')][_0x5ee1('0x30')]?_0x4d29ac[_0x5ee1('0x2e')]:_0x1f0df6[_0x5ee1('0x29')];_0x4d29ac[_0x5ee1('0x32')]=qs[_0x5ee1('0x33')](_0x240afe[_0x5ee1('0x2a')][_0x5ee1('0x33')]);_0x4d29ac['where']=qs[_0x5ee1('0x2c')](_[_0x5ee1('0x35')](_0x240afe[_0x5ee1('0x2a')],_0x1f0df6['filters']));if(_0x240afe[_0x5ee1('0x2a')][_0x5ee1('0x36')]){_0x4d29ac[_0x5ee1('0x34')]=_['merge'](_0x4d29ac[_0x5ee1('0x34')],{'$or':_[_0x5ee1('0x25')](_0x4d29ac['attributes'],function(_0x5dcb46){var _0x230959={};_0x230959[_0x5dcb46]={'$like':'%'+_0x240afe['query'][_0x5ee1('0x36')]+'%'};return _0x230959;})});}_0x4d29ac=_['merge']({},_0x4d29ac,_0x240afe['options']);return _0x2404ec[_0x5ee1('0x49')](_0x4d29ac);}})[_0x5ee1('0x3e')](function(_0xfe9060){if(_0xfe9060){_0x2c9413=_0xfe9060[_0x5ee1('0x30')];if(!_0x240afe['query'][_0x5ee1('0x48')]('nolimit')){_0x4d29ac[_0x5ee1('0x1b')]=qs[_0x5ee1('0x1b')](_0x240afe[_0x5ee1('0x2a')][_0x5ee1('0x1b')]);_0x4d29ac[_0x5ee1('0x19')]=qs[_0x5ee1('0x19')](_0x240afe[_0x5ee1('0x2a')][_0x5ee1('0x19')]);}return _0x2404ec[_0x5ee1('0x49')](_0x4d29ac);}})[_0x5ee1('0x3e')](function(_0x1b6a01){if(_0x1b6a01){return _0x1b6a01?{'count':_0x2c9413,'rows':_0x1b6a01}:null;}})[_0x5ee1('0x3e')](respondWithResult(_0x200716,null))['catch'](handleError(_0x200716,null));};exports[_0x5ee1('0x4a')]=function(_0x336cb4,_0x20ed0d,_0x300453){var _0x2efddb={};var _0x2311c0={};var _0x2e6e86;var _0x503b25;return db[_0x5ee1('0x26')]['findOne']({'where':{'id':_0x336cb4[_0x5ee1('0x41')]['id']}})['then'](handleEntityNotFound(_0x20ed0d,null))['then'](function(_0x187e78){if(_0x187e78){_0x2e6e86=_0x187e78;_0x2311c0['model']=_['keys'](db['ZohoField']['rawAttributes']);_0x2311c0[_0x5ee1('0x2a')]=_[_0x5ee1('0x2b')](_0x336cb4['query']);_0x2311c0['filters']=_['intersection'](_0x2311c0[_0x5ee1('0x29')],_0x2311c0[_0x5ee1('0x2a')]);_0x2efddb[_0x5ee1('0x2e')]=_[_0x5ee1('0x2d')](_0x2311c0[_0x5ee1('0x29')],qs[_0x5ee1('0x2f')](_0x336cb4[_0x5ee1('0x2a')][_0x5ee1('0x2f')]));_0x2efddb['attributes']=_0x2efddb[_0x5ee1('0x2e')]['length']?_0x2efddb[_0x5ee1('0x2e')]:_0x2311c0[_0x5ee1('0x29')];_0x2efddb['order']=qs[_0x5ee1('0x33')](_0x336cb4[_0x5ee1('0x2a')][_0x5ee1('0x33')]);_0x2efddb[_0x5ee1('0x34')]=qs[_0x5ee1('0x2c')](_[_0x5ee1('0x35')](_0x336cb4[_0x5ee1('0x2a')],_0x2311c0['filters']));if(_0x336cb4[_0x5ee1('0x2a')]['filter']){_0x2efddb['where']=_['merge'](_0x2efddb[_0x5ee1('0x34')],{'$or':_[_0x5ee1('0x25')](_0x2efddb[_0x5ee1('0x2e')],function(_0x40cb43){var _0x584626={};_0x584626[_0x40cb43]={'$like':'%'+_0x336cb4[_0x5ee1('0x2a')][_0x5ee1('0x36')]+'%'};return _0x584626;})});}_0x2efddb=_[_0x5ee1('0x37')]({},_0x2efddb,_0x336cb4[_0x5ee1('0x3a')]);return _0x2e6e86[_0x5ee1('0x4a')](_0x2efddb);}})[_0x5ee1('0x3e')](function(_0x56194f){if(_0x56194f){_0x503b25=_0x56194f[_0x5ee1('0x30')];if(!_0x336cb4[_0x5ee1('0x2a')][_0x5ee1('0x48')]('nolimit')){_0x2efddb[_0x5ee1('0x1b')]=qs[_0x5ee1('0x1b')](_0x336cb4['query']['limit']);_0x2efddb['offset']=qs['offset'](_0x336cb4['query'][_0x5ee1('0x19')]);}return _0x2e6e86[_0x5ee1('0x4a')](_0x2efddb);}})[_0x5ee1('0x3e')](function(_0x3b3509){if(_0x3b3509){return _0x3b3509?{'count':_0x503b25,'rows':_0x3b3509}:null;}})[_0x5ee1('0x3e')](respondWithResult(_0x20ed0d,null))[_0x5ee1('0x3f')](handleError(_0x20ed0d,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 6e6ef27..104c940 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 _0x68fd=['ZohoConfiguration','lodash','util','api','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x51dd21,_0x5b54a7){var _0x258c57=function(_0x5bcdb8){while(--_0x5bcdb8){_0x51dd21['push'](_0x51dd21['shift']());}};_0x258c57(++_0x5b54a7);}(_0x68fd,0x14b));var _0xd68f=function(_0x3ae8d8,_0x588442){_0x3ae8d8=_0x3ae8d8-0x0;var _0x38628e=_0x68fd[_0x3ae8d8];return _0x38628e;};'use strict';var _=require(_0xd68f('0x0'));var util=require(_0xd68f('0x1'));var logger=require('../../config/logger')(_0xd68f('0x2'));var moment=require('moment');var BPromise=require(_0xd68f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd68f('0x4'));var rimraf=require(_0xd68f('0x5'));var config=require(_0xd68f('0x6'));var attributes=require(_0xd68f('0x7'));module[_0xd68f('0x8')]=function(_0x321c59,_0x4755f7){return _0x321c59[_0xd68f('0x9')](_0xd68f('0xa'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b73=['rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','bluebird','path'];(function(_0x3583c3,_0x5e0e5a){var _0x5a89d7=function(_0x24e536){while(--_0x24e536){_0x3583c3['push'](_0x3583c3['shift']());}};_0x5a89d7(++_0x5e0e5a);}(_0x1b73,0xd7));var _0x31b7=function(_0x1ac6a0,_0x498d55){_0x1ac6a0=_0x1ac6a0-0x0;var _0xa4f0c3=_0x1b73[_0x1ac6a0];return _0xa4f0c3;};'use strict';var _=require('lodash');var util=require(_0x31b7('0x0'));var logger=require(_0x31b7('0x1'))(_0x31b7('0x2'));var moment=require('moment');var BPromise=require(_0x31b7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31b7('0x4'));var rimraf=require(_0x31b7('0x5'));var config=require(_0x31b7('0x6'));var attributes=require(_0x31b7('0x7'));module[_0x31b7('0x8')]=function(_0x694933,_0x29b920){return _0x694933['define'](_0x31b7('0x9'),attributes,{'tableName':_0x31b7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 39679da..306237b 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 _0x5ecd=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x43afd8,_0x3e571c){var _0x50a859=function(_0x33c1ea){while(--_0x33c1ea){_0x43afd8['push'](_0x43afd8['shift']());}};_0x50a859(++_0x3e571c);}(_0x5ecd,0xcd));var _0xd5ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ecd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5ec('0x0'));var util=require('util');var moment=require(_0xd5ec('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5ec('0x2'));var db=require(_0xd5ec('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd5ec('0x4'))(_0xd5ec('0x5'));var config=require('../../config/environment');var jayson=require(_0xd5ec('0x6'));var client=jayson['client'][_0xd5ec('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xa362cb,_0x1c5f18,_0x468237){return new BPromise(function(_0x5ce5f3,_0x3e376b){return client[_0xd5ec('0x8')](_0xa362cb,_0x468237)[_0xd5ec('0x9')](function(_0x542ea1){logger[_0xd5ec('0xa')](_0xd5ec('0xb'),_0x1c5f18,_0xd5ec('0xc'));logger['debug'](_0xd5ec('0xd'),_0x1c5f18,_0xd5ec('0xc'),JSON['stringify'](_0x542ea1));if(_0x542ea1[_0xd5ec('0xe')]){if(_0x542ea1[_0xd5ec('0xe')][_0xd5ec('0xf')]===0x1f4){logger['error'](_0xd5ec('0xb'),_0x1c5f18,_0x542ea1[_0xd5ec('0xe')][_0xd5ec('0x10')]);return _0x3e376b(_0x542ea1[_0xd5ec('0xe')][_0xd5ec('0x10')]);}logger[_0xd5ec('0xe')](_0xd5ec('0xb'),_0x1c5f18,_0x542ea1[_0xd5ec('0xe')][_0xd5ec('0x10')]);return _0x5ce5f3(_0x542ea1['error'][_0xd5ec('0x10')]);}else{logger['info'](_0xd5ec('0xb'),_0x1c5f18,_0xd5ec('0xc'));_0x5ce5f3(_0x542ea1['result']['message']);}})[_0xd5ec('0x11')](function(_0xccd534){logger[_0xd5ec('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x1c5f18,_0xccd534);_0x3e376b(_0xccd534);});});} \ No newline at end of file +var _0x1b89=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x559442,_0xf02afc){var _0x21929c=function(_0x32c8a9){while(--_0x32c8a9){_0x559442['push'](_0x559442['shift']());}};_0x21929c(++_0xf02afc);}(_0x1b89,0x183));var _0x91b8=function(_0x4d95a7,_0x39419c){_0x4d95a7=_0x4d95a7-0x0;var _0x2f65af=_0x1b89[_0x4d95a7];return _0x2f65af;};'use strict';var _=require(_0x91b8('0x0'));var util=require(_0x91b8('0x1'));var moment=require(_0x91b8('0x2'));var BPromise=require(_0x91b8('0x3'));var rs=require(_0x91b8('0x4'));var fs=require('fs');var Redis=require(_0x91b8('0x5'));var db=require(_0x91b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x91b8('0x7'))('rpc');var config=require(_0x91b8('0x8'));var jayson=require(_0x91b8('0x9'));var client=jayson[_0x91b8('0xa')][_0x91b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x418408,_0x942774,_0x17e0ca){return new BPromise(function(_0x55b1ab,_0x1b63b8){return client[_0x91b8('0xc')](_0x418408,_0x17e0ca)[_0x91b8('0xd')](function(_0x1f8db8){logger[_0x91b8('0xe')](_0x91b8('0xf'),_0x942774,'request\x20sent');logger[_0x91b8('0x10')](_0x91b8('0x11'),_0x942774,_0x91b8('0x12'),JSON['stringify'](_0x1f8db8));if(_0x1f8db8['error']){if(_0x1f8db8[_0x91b8('0x13')][_0x91b8('0x14')]===0x1f4){logger[_0x91b8('0x13')](_0x91b8('0xf'),_0x942774,_0x1f8db8[_0x91b8('0x13')]['message']);return _0x1b63b8(_0x1f8db8['error'][_0x91b8('0x15')]);}logger[_0x91b8('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x942774,_0x1f8db8[_0x91b8('0x13')][_0x91b8('0x15')]);return _0x55b1ab(_0x1f8db8[_0x91b8('0x13')]['message']);}else{logger[_0x91b8('0xe')](_0x91b8('0xf'),_0x942774,_0x91b8('0x12'));_0x55b1ab(_0x1f8db8[_0x91b8('0x16')][_0x91b8('0x15')]);}})['catch'](function(_0x145aae){logger[_0x91b8('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x942774,_0x145aae);_0x1b63b8(_0x145aae);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 227e361..6aea72d 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 _0xb195=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','get','/:id','show','post','create','put','update'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xb195,0x12e));var _0x5b19=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xb195[_0x45d55e];return _0x29812a;};'use strict';var multer=require(_0x5b19('0x0'));var util=require('util');var path=require(_0x5b19('0x1'));var timeout=require(_0x5b19('0x2'));var express=require(_0x5b19('0x3'));var router=express[_0x5b19('0x4')]();var fs_extra=require(_0x5b19('0x5'));var auth=require(_0x5b19('0x6'));var interaction=require(_0x5b19('0x7'));var config=require(_0x5b19('0x8'));var controller=require(_0x5b19('0x9'));router['get']('/',auth[_0x5b19('0xa')](),controller['index']);router[_0x5b19('0xb')](_0x5b19('0xc'),auth[_0x5b19('0xa')](),controller[_0x5b19('0xd')]);router[_0x5b19('0xe')]('/',auth['isAuthenticated'](),controller[_0x5b19('0xf')]);router[_0x5b19('0x10')](_0x5b19('0xc'),auth[_0x5b19('0xa')](),controller[_0x5b19('0x11')]);router[_0x5b19('0x12')](_0x5b19('0xc'),auth[_0x5b19('0xa')](),controller['destroy']);module[_0x5b19('0x13')]=router; \ No newline at end of file +var _0x6ee8=['isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get'];(function(_0x539c99,_0x3295eb){var _0x4890e7=function(_0x9fe6f6){while(--_0x9fe6f6){_0x539c99['push'](_0x539c99['shift']());}};_0x4890e7(++_0x3295eb);}(_0x6ee8,0xcf));var _0x86ee=function(_0x4e65fc,_0x4aa435){_0x4e65fc=_0x4e65fc-0x0;var _0x3b3ca1=_0x6ee8[_0x4e65fc];return _0x3b3ca1;};'use strict';var multer=require(_0x86ee('0x0'));var util=require('util');var path=require(_0x86ee('0x1'));var timeout=require('connect-timeout');var express=require(_0x86ee('0x2'));var router=express['Router']();var fs_extra=require(_0x86ee('0x3'));var auth=require(_0x86ee('0x4'));var interaction=require(_0x86ee('0x5'));var config=require(_0x86ee('0x6'));var controller=require(_0x86ee('0x7'));router[_0x86ee('0x8')]('/',auth[_0x86ee('0x9')](),controller[_0x86ee('0xa')]);router[_0x86ee('0x8')](_0x86ee('0xb'),auth[_0x86ee('0x9')](),controller[_0x86ee('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x86ee('0xd')]);router[_0x86ee('0xe')](_0x86ee('0xb'),auth[_0x86ee('0x9')](),controller[_0x86ee('0xf')]);router[_0x86ee('0x10')](_0x86ee('0xb'),auth['isAuthenticated'](),controller[_0x86ee('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 422fd3d..bf0cd80 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 _0x1be6=['variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','exports','ENUM'];(function(_0x2641be,_0x481a5e){var _0x53429e=function(_0x2391ea){while(--_0x2391ea){_0x2641be['push'](_0x2641be['shift']());}};_0x53429e(++_0x481a5e);}(_0x1be6,0x1ed));var _0x61be=function(_0x2112b8,_0x11d37b){_0x2112b8=_0x2112b8-0x0;var _0x24f917=_0x1be6[_0x2112b8];return _0x24f917;};'use strict';var Sequelize=require('sequelize');module[_0x61be('0x0')]={'type':{'type':Sequelize[_0x61be('0x1')]('string',_0x61be('0x2'),_0x61be('0x3'),_0x61be('0x4'),_0x61be('0x5')),'defaultValue':_0x61be('0x6')},'content':{'type':Sequelize[_0x61be('0x7')]},'key':{'type':Sequelize[_0x61be('0x7')]},'keyType':{'type':Sequelize[_0x61be('0x1')](_0x61be('0x6'),_0x61be('0x2'),_0x61be('0x3'))},'keyContent':{'type':Sequelize[_0x61be('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x61be('0x7')]},'customField':{'type':Sequelize[_0x61be('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2904=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','ENUM'];(function(_0x304241,_0x4c73ac){var _0x3d80b4=function(_0x98c459){while(--_0x98c459){_0x304241['push'](_0x304241['shift']());}};_0x3d80b4(++_0x4c73ac);}(_0x2904,0x1c7));var _0x4290=function(_0x924eaa,_0x58ad4a){_0x924eaa=_0x924eaa-0x0;var _0x42a54a=_0x2904[_0x924eaa];return _0x42a54a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x4290('0x0')](_0x4290('0x1'),_0x4290('0x2'),_0x4290('0x3'),_0x4290('0x4'),_0x4290('0x5')),'defaultValue':_0x4290('0x1')},'content':{'type':Sequelize[_0x4290('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4290('0x0')](_0x4290('0x1'),'variable',_0x4290('0x3'))},'keyContent':{'type':Sequelize[_0x4290('0x6')]},'idField':{'type':Sequelize[_0x4290('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4290('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 0ca27b2..b346215 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 _0x38f9=['sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','filters','filter','where','merge','type','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x475bf1,_0x5235b6){var _0x4095d1=function(_0x30fe72){while(--_0x30fe72){_0x475bf1['push'](_0x475bf1['shift']());}};_0x4095d1(++_0x5235b6);}(_0x38f9,0x1af));var _0x938f=function(_0x2341c6,_0x3af092){_0x2341c6=_0x2341c6-0x0;var _0x54c34d=_0x38f9[_0x2341c6];return _0x54c34d;};'use strict';var emlformat=require(_0x938f('0x0'));var rimraf=require(_0x938f('0x1'));var zipdir=require(_0x938f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x938f('0x3'));var moment=require(_0x938f('0x4'));var BPromise=require(_0x938f('0x5'));var Mustache=require(_0x938f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x938f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x938f('0x8'));var _=require(_0x938f('0x9'));var squel=require(_0x938f('0xa'));var crypto=require(_0x938f('0xb'));var jsforce=require(_0x938f('0xc'));var deskjs=require(_0x938f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x938f('0xe'));var Papa=require(_0x938f('0xf'));var Redis=require(_0x938f('0x10'));var authService=require(_0x938f('0x11'));var qs=require(_0x938f('0x12'));var as=require(_0x938f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x938f('0x14'))(_0x938f('0x15'));var utils=require('../../config/utils');var config=require(_0x938f('0x16'));var licenseUtil=require(_0x938f('0x17'));var db=require(_0x938f('0x18'))['db'];function respondWithStatusCode(_0x48d70e,_0x7ba7e0){_0x7ba7e0=_0x7ba7e0||0xcc;return function(_0x15b582){if(_0x15b582){return _0x48d70e[_0x938f('0x19')](_0x7ba7e0);}return _0x48d70e[_0x938f('0x1a')](_0x7ba7e0)[_0x938f('0x1b')]();};}function respondWithResult(_0x2efa4a,_0x4d3f94){_0x4d3f94=_0x4d3f94||0xc8;return function(_0x5c3f97){if(_0x5c3f97){return _0x2efa4a[_0x938f('0x1a')](_0x4d3f94)['json'](_0x5c3f97);}};}function respondWithFilteredResult(_0x4d946a,_0xdd3f82){return function(_0x36edf5){if(_0x36edf5){var _0x1c5f9e=typeof _0xdd3f82[_0x938f('0x1c')]===_0x938f('0x1d')&&typeof _0xdd3f82['limit']===_0x938f('0x1d');var _0x17afee=_0x36edf5[_0x938f('0x1e')];var _0x1dbdce=_0x1c5f9e?0x0:_0xdd3f82['offset'];var _0x5915a5=_0x1c5f9e?_0x36edf5[_0x938f('0x1e')]:_0xdd3f82[_0x938f('0x1c')]+_0xdd3f82[_0x938f('0x1f')];var _0x19ae6d;if(_0x5915a5>=_0x17afee){_0x5915a5=_0x17afee;_0x19ae6d=0xc8;}else{_0x19ae6d=0xce;}_0x4d946a[_0x938f('0x1a')](_0x19ae6d);return _0x4d946a['set'](_0x938f('0x20'),_0x1dbdce+'-'+_0x5915a5+'/'+_0x17afee)[_0x938f('0x21')](_0x36edf5);}return null;};}function patchUpdates(_0x54394c){return function(_0x50c6c9){try{jsonpatch['apply'](_0x50c6c9,_0x54394c,!![]);}catch(_0x46547e){return BPromise[_0x938f('0x22')](_0x46547e);}return _0x50c6c9[_0x938f('0x23')]();};}function saveUpdates(_0x5445fd,_0x44001e){return function(_0x2495b){if(_0x2495b){return _0x2495b[_0x938f('0x24')](_0x5445fd)[_0x938f('0x25')](function(_0x5ed7fd){return _0x5ed7fd;});}return null;};}function removeEntity(_0x5f2ce8,_0x55d5ff){return function(_0x2f6ba7){if(_0x2f6ba7){return _0x2f6ba7[_0x938f('0x26')]()[_0x938f('0x25')](function(){_0x5f2ce8[_0x938f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42312e,_0x1f0294){return function(_0x2c44cd){if(!_0x2c44cd){_0x42312e[_0x938f('0x19')](0x194);}return _0x2c44cd;};}function handleError(_0x5c70a9,_0x158d97){_0x158d97=_0x158d97||0x1f4;return function(_0x57cdd7){logger[_0x938f('0x27')](_0x57cdd7[_0x938f('0x28')]);if(_0x57cdd7[_0x938f('0x29')]){delete _0x57cdd7['name'];}_0x5c70a9[_0x938f('0x1a')](_0x158d97)[_0x938f('0x2a')](_0x57cdd7);};}exports[_0x938f('0x2b')]=function(_0x2a2814,_0x2c5d38){var _0x2914d3={},_0x219e9c={},_0x11bada={'count':0x0,'rows':[]};var _0x3abb0f=_[_0x938f('0x2c')](db[_0x938f('0x2d')][_0x938f('0x2e')],function(_0xbc26b9){return{'name':_0xbc26b9['fieldName'],'type':_0xbc26b9['type']['key']};});_0x219e9c['model']=_[_0x938f('0x2c')](_0x3abb0f,_0x938f('0x29'));_0x219e9c[_0x938f('0x2f')]=_[_0x938f('0x30')](_0x2a2814[_0x938f('0x2f')]);_0x219e9c['filters']=_[_0x938f('0x31')](_0x219e9c[_0x938f('0x32')],_0x219e9c[_0x938f('0x2f')]);_0x2914d3[_0x938f('0x33')]=_[_0x938f('0x31')](_0x219e9c[_0x938f('0x32')],qs[_0x938f('0x34')](_0x2a2814[_0x938f('0x2f')][_0x938f('0x34')]));_0x2914d3[_0x938f('0x33')]=_0x2914d3[_0x938f('0x33')][_0x938f('0x35')]?_0x2914d3['attributes']:_0x219e9c['model'];if(!_0x2a2814['query'][_0x938f('0x36')](_0x938f('0x37'))){_0x2914d3['limit']=qs['limit'](_0x2a2814[_0x938f('0x2f')][_0x938f('0x1f')]);_0x2914d3[_0x938f('0x1c')]=qs[_0x938f('0x1c')](_0x2a2814['query']['offset']);}_0x2914d3[_0x938f('0x38')]=qs['sort'](_0x2a2814[_0x938f('0x2f')]['sort']);_0x2914d3['where']=qs[_0x938f('0x39')](_['pick'](_0x2a2814[_0x938f('0x2f')],_0x219e9c['filters']),_0x3abb0f);if(_0x2a2814['query'][_0x938f('0x3a')]){_0x2914d3[_0x938f('0x3b')]=_[_0x938f('0x3c')](_0x2914d3[_0x938f('0x3b')],{'$or':_[_0x938f('0x2c')](_0x3abb0f,function(_0x3c9d9c){if(_0x3c9d9c[_0x938f('0x3d')]!=='VIRTUAL'){var _0x23d19c={};_0x23d19c[_0x3c9d9c[_0x938f('0x29')]]={'$like':'%'+_0x2a2814[_0x938f('0x2f')][_0x938f('0x3a')]+'%'};return _0x23d19c;}})});}_0x2914d3=_[_0x938f('0x3c')]({},_0x2914d3,_0x2a2814[_0x938f('0x3e')]);var _0x1e92e9={'where':_0x2914d3[_0x938f('0x3b')]};return db[_0x938f('0x2d')][_0x938f('0x1e')](_0x1e92e9)[_0x938f('0x25')](function(_0xca2cd4){_0x11bada[_0x938f('0x1e')]=_0xca2cd4;if(_0x2a2814[_0x938f('0x2f')][_0x938f('0x3f')]){_0x2914d3['include']=[{'all':!![]}];}return db[_0x938f('0x2d')][_0x938f('0x40')](_0x2914d3);})[_0x938f('0x25')](function(_0x2f39c2){_0x11bada[_0x938f('0x41')]=_0x2f39c2;return _0x11bada;})[_0x938f('0x25')](respondWithFilteredResult(_0x2c5d38,_0x2914d3))[_0x938f('0x42')](handleError(_0x2c5d38,null));};exports[_0x938f('0x43')]=function(_0x7f0b37,_0x3ce242){var _0x599dfe={'raw':!![],'where':{'id':_0x7f0b37[_0x938f('0x44')]['id']}},_0x1c03a5={};_0x1c03a5[_0x938f('0x32')]=_['keys'](db['ZohoField'][_0x938f('0x2e')]);_0x1c03a5[_0x938f('0x2f')]=_['keys'](_0x7f0b37['query']);_0x1c03a5[_0x938f('0x39')]=_['intersection'](_0x1c03a5[_0x938f('0x32')],_0x1c03a5[_0x938f('0x2f')]);_0x599dfe[_0x938f('0x33')]=_[_0x938f('0x31')](_0x1c03a5[_0x938f('0x32')],qs[_0x938f('0x34')](_0x7f0b37['query'][_0x938f('0x34')]));_0x599dfe[_0x938f('0x33')]=_0x599dfe[_0x938f('0x33')]['length']?_0x599dfe['attributes']:_0x1c03a5[_0x938f('0x32')];if(_0x7f0b37[_0x938f('0x2f')]['includeAll']){_0x599dfe[_0x938f('0x45')]=[{'all':!![]}];}_0x599dfe=_[_0x938f('0x3c')]({},_0x599dfe,_0x7f0b37[_0x938f('0x3e')]);return db[_0x938f('0x2d')][_0x938f('0x46')](_0x599dfe)['then'](handleEntityNotFound(_0x3ce242,null))[_0x938f('0x25')](respondWithResult(_0x3ce242,null))[_0x938f('0x42')](handleError(_0x3ce242,null));};exports[_0x938f('0x47')]=function(_0x1b727b,_0x4e60cf){return db[_0x938f('0x2d')][_0x938f('0x47')](_0x1b727b[_0x938f('0x48')],{})[_0x938f('0x25')](respondWithResult(_0x4e60cf,0xc9))[_0x938f('0x42')](handleError(_0x4e60cf,null));};exports[_0x938f('0x24')]=function(_0x23ebfd,_0x570e0c){if(_0x23ebfd[_0x938f('0x48')]['id']){delete _0x23ebfd[_0x938f('0x48')]['id'];}return db['ZohoField'][_0x938f('0x46')]({'where':{'id':_0x23ebfd[_0x938f('0x44')]['id']}})[_0x938f('0x25')](handleEntityNotFound(_0x570e0c,null))['then'](saveUpdates(_0x23ebfd[_0x938f('0x48')],null))['then'](respondWithResult(_0x570e0c,null))[_0x938f('0x42')](handleError(_0x570e0c,null));};exports[_0x938f('0x26')]=function(_0x3bcabd,_0x38d16a){return db[_0x938f('0x2d')][_0x938f('0x46')]({'where':{'id':_0x3bcabd[_0x938f('0x44')]['id']}})['then'](handleEntityNotFound(_0x38d16a,null))[_0x938f('0x25')](removeEntity(_0x38d16a,null))[_0x938f('0x42')](handleError(_0x38d16a,null));}; \ No newline at end of file +var _0x0e38=['../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','name','index','ZohoField','rawAttributes','fieldName','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','include','findAll','rows','show','params','intersection','find','catch','body','destroy','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xf806ff,_0x15cf0c){var _0x57cfff=function(_0x457aff){while(--_0x457aff){_0xf806ff['push'](_0xf806ff['shift']());}};_0x57cfff(++_0x15cf0c);}(_0x0e38,0x1a9));var _0x80e3=function(_0x562d21,_0xfbdf11){_0x562d21=_0x562d21-0x0;var _0x332b6a=_0x0e38[_0x562d21];return _0x332b6a;};'use strict';var emlformat=require(_0x80e3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x80e3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x80e3('0x2'));var moment=require('moment');var BPromise=require(_0x80e3('0x3'));var Mustache=require(_0x80e3('0x4'));var util=require(_0x80e3('0x5'));var path=require(_0x80e3('0x6'));var sox=require(_0x80e3('0x7'));var csv=require(_0x80e3('0x8'));var ejs=require(_0x80e3('0x9'));var fs=require('fs');var fs_extra=require(_0x80e3('0xa'));var _=require(_0x80e3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x80e3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x80e3('0x8'));var querystring=require(_0x80e3('0xd'));var Papa=require(_0x80e3('0xe'));var Redis=require(_0x80e3('0xf'));var authService=require(_0x80e3('0x10'));var qs=require(_0x80e3('0x11'));var as=require(_0x80e3('0x12'));var hardwareService=require(_0x80e3('0x13'));var logger=require('../../config/logger')(_0x80e3('0x14'));var utils=require(_0x80e3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x80e3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32c814,_0x3ee3c0){_0x3ee3c0=_0x3ee3c0||0xcc;return function(_0x55a0c7){if(_0x55a0c7){return _0x32c814[_0x80e3('0x17')](_0x3ee3c0);}return _0x32c814[_0x80e3('0x18')](_0x3ee3c0)[_0x80e3('0x19')]();};}function respondWithResult(_0x3a83b8,_0x3061df){_0x3061df=_0x3061df||0xc8;return function(_0x25b501){if(_0x25b501){return _0x3a83b8['status'](_0x3061df)['json'](_0x25b501);}};}function respondWithFilteredResult(_0x1e7d81,_0x156702){return function(_0x58b572){if(_0x58b572){var _0x27e663=typeof _0x156702['offset']===_0x80e3('0x1a')&&typeof _0x156702[_0x80e3('0x1b')]===_0x80e3('0x1a');var _0x27a8d6=_0x58b572[_0x80e3('0x1c')];var _0x1ae03d=_0x27e663?0x0:_0x156702[_0x80e3('0x1d')];var _0x1197c0=_0x27e663?_0x58b572['count']:_0x156702[_0x80e3('0x1d')]+_0x156702[_0x80e3('0x1b')];var _0x31e2a3;if(_0x1197c0>=_0x27a8d6){_0x1197c0=_0x27a8d6;_0x31e2a3=0xc8;}else{_0x31e2a3=0xce;}_0x1e7d81[_0x80e3('0x18')](_0x31e2a3);return _0x1e7d81[_0x80e3('0x1e')](_0x80e3('0x1f'),_0x1ae03d+'-'+_0x1197c0+'/'+_0x27a8d6)[_0x80e3('0x20')](_0x58b572);}return null;};}function patchUpdates(_0x1d1062){return function(_0xa9f4b){try{jsonpatch[_0x80e3('0x21')](_0xa9f4b,_0x1d1062,!![]);}catch(_0x33d98b){return BPromise[_0x80e3('0x22')](_0x33d98b);}return _0xa9f4b[_0x80e3('0x23')]();};}function saveUpdates(_0x37f531,_0x16d927){return function(_0x3fb760){if(_0x3fb760){return _0x3fb760[_0x80e3('0x24')](_0x37f531)[_0x80e3('0x25')](function(_0x45fba2){return _0x45fba2;});}return null;};}function removeEntity(_0x3a0c09,_0x591df1){return function(_0x44a17e){if(_0x44a17e){return _0x44a17e['destroy']()[_0x80e3('0x25')](function(){_0x3a0c09[_0x80e3('0x18')](0xcc)[_0x80e3('0x19')]();});}};}function handleEntityNotFound(_0x33097b,_0x1e6c76){return function(_0x412930){if(!_0x412930){_0x33097b[_0x80e3('0x17')](0x194);}return _0x412930;};}function handleError(_0x32f9dd,_0x3bced7){_0x3bced7=_0x3bced7||0x1f4;return function(_0x348e81){logger[_0x80e3('0x26')](_0x348e81['stack']);if(_0x348e81[_0x80e3('0x27')]){delete _0x348e81[_0x80e3('0x27')];}_0x32f9dd[_0x80e3('0x18')](_0x3bced7)['send'](_0x348e81);};}exports[_0x80e3('0x28')]=function(_0x1e2095,_0x5af56c){var _0x49aa1e={},_0x5b06d9={},_0x37a145={'count':0x0,'rows':[]};var _0x3bd038=_['map'](db[_0x80e3('0x29')][_0x80e3('0x2a')],function(_0x531d12){return{'name':_0x531d12[_0x80e3('0x2b')],'type':_0x531d12['type'][_0x80e3('0x2c')]};});_0x5b06d9[_0x80e3('0x2d')]=_['map'](_0x3bd038,_0x80e3('0x27'));_0x5b06d9[_0x80e3('0x2e')]=_[_0x80e3('0x2f')](_0x1e2095['query']);_0x5b06d9[_0x80e3('0x30')]=_['intersection'](_0x5b06d9[_0x80e3('0x2d')],_0x5b06d9[_0x80e3('0x2e')]);_0x49aa1e['attributes']=_['intersection'](_0x5b06d9[_0x80e3('0x2d')],qs['fields'](_0x1e2095[_0x80e3('0x2e')][_0x80e3('0x31')]));_0x49aa1e[_0x80e3('0x32')]=_0x49aa1e[_0x80e3('0x32')][_0x80e3('0x33')]?_0x49aa1e[_0x80e3('0x32')]:_0x5b06d9[_0x80e3('0x2d')];if(!_0x1e2095['query'][_0x80e3('0x34')](_0x80e3('0x35'))){_0x49aa1e[_0x80e3('0x1b')]=qs['limit'](_0x1e2095[_0x80e3('0x2e')][_0x80e3('0x1b')]);_0x49aa1e[_0x80e3('0x1d')]=qs[_0x80e3('0x1d')](_0x1e2095[_0x80e3('0x2e')][_0x80e3('0x1d')]);}_0x49aa1e[_0x80e3('0x36')]=qs[_0x80e3('0x37')](_0x1e2095[_0x80e3('0x2e')][_0x80e3('0x37')]);_0x49aa1e[_0x80e3('0x38')]=qs[_0x80e3('0x30')](_[_0x80e3('0x39')](_0x1e2095['query'],_0x5b06d9[_0x80e3('0x30')]),_0x3bd038);if(_0x1e2095[_0x80e3('0x2e')][_0x80e3('0x3a')]){_0x49aa1e[_0x80e3('0x38')]=_['merge'](_0x49aa1e[_0x80e3('0x38')],{'$or':_[_0x80e3('0x3b')](_0x3bd038,function(_0x1d178d){if(_0x1d178d[_0x80e3('0x3c')]!==_0x80e3('0x3d')){var _0x150978={};_0x150978[_0x1d178d[_0x80e3('0x27')]]={'$like':'%'+_0x1e2095['query']['filter']+'%'};return _0x150978;}})});}_0x49aa1e=_[_0x80e3('0x3e')]({},_0x49aa1e,_0x1e2095[_0x80e3('0x3f')]);var _0x1dab26={'where':_0x49aa1e[_0x80e3('0x38')]};return db['ZohoField']['count'](_0x1dab26)[_0x80e3('0x25')](function(_0x95f16b){_0x37a145[_0x80e3('0x1c')]=_0x95f16b;if(_0x1e2095[_0x80e3('0x2e')]['includeAll']){_0x49aa1e[_0x80e3('0x40')]=[{'all':!![]}];}return db[_0x80e3('0x29')][_0x80e3('0x41')](_0x49aa1e);})[_0x80e3('0x25')](function(_0x6ae9e4){_0x37a145[_0x80e3('0x42')]=_0x6ae9e4;return _0x37a145;})['then'](respondWithFilteredResult(_0x5af56c,_0x49aa1e))['catch'](handleError(_0x5af56c,null));};exports[_0x80e3('0x43')]=function(_0x348b92,_0x91e1e){var _0x23b12e={'raw':!![],'where':{'id':_0x348b92[_0x80e3('0x44')]['id']}},_0x286d08={};_0x286d08[_0x80e3('0x2d')]=_[_0x80e3('0x2f')](db[_0x80e3('0x29')][_0x80e3('0x2a')]);_0x286d08[_0x80e3('0x2e')]=_[_0x80e3('0x2f')](_0x348b92[_0x80e3('0x2e')]);_0x286d08[_0x80e3('0x30')]=_['intersection'](_0x286d08[_0x80e3('0x2d')],_0x286d08[_0x80e3('0x2e')]);_0x23b12e['attributes']=_[_0x80e3('0x45')](_0x286d08['model'],qs[_0x80e3('0x31')](_0x348b92[_0x80e3('0x2e')][_0x80e3('0x31')]));_0x23b12e[_0x80e3('0x32')]=_0x23b12e[_0x80e3('0x32')][_0x80e3('0x33')]?_0x23b12e[_0x80e3('0x32')]:_0x286d08[_0x80e3('0x2d')];if(_0x348b92[_0x80e3('0x2e')]['includeAll']){_0x23b12e['include']=[{'all':!![]}];}_0x23b12e=_['merge']({},_0x23b12e,_0x348b92[_0x80e3('0x3f')]);return db[_0x80e3('0x29')][_0x80e3('0x46')](_0x23b12e)[_0x80e3('0x25')](handleEntityNotFound(_0x91e1e,null))[_0x80e3('0x25')](respondWithResult(_0x91e1e,null))[_0x80e3('0x47')](handleError(_0x91e1e,null));};exports['create']=function(_0x187920,_0x13b6b3){return db[_0x80e3('0x29')]['create'](_0x187920[_0x80e3('0x48')],{})['then'](respondWithResult(_0x13b6b3,0xc9))[_0x80e3('0x47')](handleError(_0x13b6b3,null));};exports[_0x80e3('0x24')]=function(_0x4403b5,_0x3ff1de){if(_0x4403b5['body']['id']){delete _0x4403b5['body']['id'];}return db['ZohoField'][_0x80e3('0x46')]({'where':{'id':_0x4403b5[_0x80e3('0x44')]['id']}})[_0x80e3('0x25')](handleEntityNotFound(_0x3ff1de,null))[_0x80e3('0x25')](saveUpdates(_0x4403b5[_0x80e3('0x48')],null))[_0x80e3('0x25')](respondWithResult(_0x3ff1de,null))[_0x80e3('0x47')](handleError(_0x3ff1de,null));};exports[_0x80e3('0x49')]=function(_0x3a22a2,_0x30a333){return db[_0x80e3('0x29')]['find']({'where':{'id':_0x3a22a2[_0x80e3('0x44')]['id']}})[_0x80e3('0x25')](handleEntityNotFound(_0x30a333,null))['then'](removeEntity(_0x30a333,null))['catch'](handleError(_0x30a333,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 8808fa8..3e09606 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 _0x2542=['../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x2542,0x169));var _0x2254=function(_0x10ddd8,_0x1c44f5){_0x10ddd8=_0x10ddd8-0x0;var _0x2ac3b2=_0x2542[_0x10ddd8];return _0x2ac3b2;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));module[_0x2254('0x9')]=function(_0x508183,_0x19ad3c){return _0x508183[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[{'name':_0x2254('0xd'),'fields':[_0x2254('0xe'),_0x2254('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0adf=['idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index'];(function(_0x440994,_0x5d8ac2){var _0x3ff9a2=function(_0x547b88){while(--_0x547b88){_0x440994['push'](_0x440994['shift']());}};_0x3ff9a2(++_0x5d8ac2);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x103f68,_0x1fd8d0){_0x103f68=_0x103f68-0x0;var _0x5d4053=_0x0adf[_0x103f68];return _0x5d4053;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var logger=require(_0xf0ad('0x2'))('api');var moment=require(_0xf0ad('0x3'));var BPromise=require(_0xf0ad('0x4'));var rp=require(_0xf0ad('0x5'));var fs=require('fs');var path=require(_0xf0ad('0x6'));var rimraf=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var attributes=require(_0xf0ad('0x9'));module['exports']=function(_0x3bbf85,_0x53221f){return _0x3bbf85[_0xf0ad('0xa')](_0xf0ad('0xb'),attributes,{'tableName':_0xf0ad('0xc'),'paranoid':![],'indexes':[{'name':_0xf0ad('0xd'),'fields':[_0xf0ad('0xe'),_0xf0ad('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index b1f7019..fdb3edd 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 _0x3e6a=['http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1d612c,_0x41b4db){var _0x4ac39a=function(_0x36846b){while(--_0x36846b){_0x1d612c['push'](_0x1d612c['shift']());}};_0x4ac39a(++_0x41b4db);}(_0x3e6a,0x1d6));var _0xa3e6=function(_0x5244bc,_0xbeed11){_0x5244bc=_0x5244bc-0x0;var _0x3ae51c=_0x3e6a[_0x5244bc];return _0x3ae51c;};'use strict';var _=require('lodash');var util=require(_0xa3e6('0x0'));var moment=require('moment');var BPromise=require(_0xa3e6('0x1'));var rs=require(_0xa3e6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3e6('0x3'))['db'];var utils=require(_0xa3e6('0x4'));var logger=require(_0xa3e6('0x5'))(_0xa3e6('0x6'));var config=require(_0xa3e6('0x7'));var jayson=require(_0xa3e6('0x8'));var client=jayson[_0xa3e6('0x9')][_0xa3e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48ad10,_0x4d1b18,_0x3a5902){return new BPromise(function(_0x439694,_0x140f50){return client[_0xa3e6('0xb')](_0x48ad10,_0x3a5902)[_0xa3e6('0xc')](function(_0x2660f1){logger[_0xa3e6('0xd')](_0xa3e6('0xe'),_0x4d1b18,_0xa3e6('0xf'));logger[_0xa3e6('0x10')](_0xa3e6('0x11'),_0x4d1b18,_0xa3e6('0xf'),JSON[_0xa3e6('0x12')](_0x2660f1));if(_0x2660f1[_0xa3e6('0x13')]){if(_0x2660f1[_0xa3e6('0x13')][_0xa3e6('0x14')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x4d1b18,_0x2660f1[_0xa3e6('0x13')]['message']);return _0x140f50(_0x2660f1[_0xa3e6('0x13')][_0xa3e6('0x15')]);}logger[_0xa3e6('0x13')]('ZohoField,\x20%s,\x20%s',_0x4d1b18,_0x2660f1['error'][_0xa3e6('0x15')]);return _0x439694(_0x2660f1['error'][_0xa3e6('0x15')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x4d1b18,'request\x20sent');_0x439694(_0x2660f1[_0xa3e6('0x16')][_0xa3e6('0x15')]);}})[_0xa3e6('0x17')](function(_0x1e4a34){logger[_0xa3e6('0x13')](_0xa3e6('0xe'),_0x4d1b18,_0x1e4a34);_0x140f50(_0x1e4a34);});});} \ No newline at end of file +var _0xde62=['debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoField,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','rpc','../../config/environment','http','then','info','request\x20sent'];(function(_0x543242,_0xeac9fd){var _0x4c99b6=function(_0x47d087){while(--_0x47d087){_0x543242['push'](_0x543242['shift']());}};_0x4c99b6(++_0xeac9fd);}(_0xde62,0xf2));var _0x2de6=function(_0x1f52ab,_0x38b683){_0x1f52ab=_0x1f52ab-0x0;var _0x33f8ed=_0xde62[_0x1f52ab];return _0x33f8ed;};'use strict';var _=require(_0x2de6('0x0'));var util=require('util');var moment=require(_0x2de6('0x1'));var BPromise=require(_0x2de6('0x2'));var rs=require(_0x2de6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2de6('0x4'));var config=require(_0x2de6('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2de6('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1c4119,_0x3f24f9,_0x3d3806){return new BPromise(function(_0x7de009,_0x2e4fe9){return client['request'](_0x1c4119,_0x3d3806)[_0x2de6('0x7')](function(_0x41d381){logger[_0x2de6('0x8')]('ZohoField,\x20%s,\x20%s',_0x3f24f9,_0x2de6('0x9'));logger[_0x2de6('0xa')](_0x2de6('0xb'),_0x3f24f9,_0x2de6('0x9'),JSON[_0x2de6('0xc')](_0x41d381));if(_0x41d381[_0x2de6('0xd')]){if(_0x41d381[_0x2de6('0xd')]['code']===0x1f4){logger[_0x2de6('0xd')]('ZohoField,\x20%s,\x20%s',_0x3f24f9,_0x41d381[_0x2de6('0xd')]['message']);return _0x2e4fe9(_0x41d381[_0x2de6('0xd')][_0x2de6('0xe')]);}logger[_0x2de6('0xd')](_0x2de6('0xf'),_0x3f24f9,_0x41d381[_0x2de6('0xd')]['message']);return _0x7de009(_0x41d381[_0x2de6('0xd')][_0x2de6('0xe')]);}else{logger[_0x2de6('0x8')](_0x2de6('0xf'),_0x3f24f9,_0x2de6('0x9'));_0x7de009(_0x41d381[_0x2de6('0x10')][_0x2de6('0xe')]);}})[_0x2de6('0x11')](function(_0xddf40b){logger[_0x2de6('0xd')](_0x2de6('0xf'),_0x3f24f9,_0xddf40b);_0x2e4fe9(_0xddf40b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index e1e1b64..d8f5252 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1afe3e,_0x4bf84a){var _0x25645f=function(_0x1a8eb1){while(--_0x1a8eb1){_0x1afe3e['push'](_0x1afe3e['shift']());}};_0x25645f(++_0x4bf84a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5627f5,_0x3c9376){var _0x52a656=function(_0xe7a7c5){while(--_0xe7a7c5){_0x5627f5['push'](_0x5627f5['shift']());}};_0x52a656(++_0x3c9376);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4a82ac,_0x1fb931){_0x4a82ac=_0x4a82ac-0x0;var _0x58ee97=_0xcb91[_0x4a82ac];return _0x58ee97;};'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 8739b03..662d536 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 _0x6f21=['unique_name_and_version','INTEGER','BOOLEAN','state','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6f21,0x1da));var _0x16f2=function(_0x56ddd3,_0x5a931d){_0x56ddd3=_0x56ddd3-0x0;var _0x62cf7b=_0x6f21[_0x56ddd3];return _0x62cf7b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x16f2('0x0')],'allowNull':![],'unique':_0x16f2('0x1')},'version':{'type':Sequelize[_0x16f2('0x0')],'allowNull':![],'unique':_0x16f2('0x1')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x16f2('0x0')]},'path':{'type':Sequelize[_0x16f2('0x0')]},'type':{'type':Sequelize[_0x16f2('0x0')]},'size':{'type':Sequelize[_0x16f2('0x2')]},'active':{'type':Sequelize[_0x16f2('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x16f2('0x0')]},'logo':{'type':Sequelize[_0x16f2('0x0')]},'state':{'type':Sequelize[_0x16f2('0x0')],'unique':_0x16f2('0x4')},'description':{'type':Sequelize[_0x16f2('0x0')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x16f2('0x0')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xe235=['app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x464146,_0x42f12d){var _0x2f98b8=function(_0x46d5d2){while(--_0x46d5d2){_0x464146['push'](_0x464146['shift']());}};_0x2f98b8(++_0x42f12d);}(_0xe235,0xe4));var _0x5e23=function(_0x2cf733,_0x194b88){_0x2cf733=_0x2cf733-0x0;var _0x57d504=_0xe235[_0x2cf733];return _0x57d504;};'use strict';var Sequelize=require(_0x5e23('0x0'));module[_0x5e23('0x1')]={'name':{'type':Sequelize[_0x5e23('0x2')],'allowNull':![],'unique':_0x5e23('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x5e23('0x2')],'defaultValue':_0x5e23('0x4')},'filename':{'type':Sequelize[_0x5e23('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x5e23('0x5')]},'active':{'type':Sequelize[_0x5e23('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x5e23('0x2')]},'logo':{'type':Sequelize[_0x5e23('0x2')]},'state':{'type':Sequelize[_0x5e23('0x2')],'unique':_0x5e23('0x7')},'description':{'type':Sequelize[_0x5e23('0x2')]},'title':{'type':Sequelize[_0x5e23('0x2')]},'remoteUri':{'type':Sequelize[_0x5e23('0x2')]},'link':{'type':Sequelize[_0x5e23('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index d4f1a59..8866eac 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 _0xc1c6=['type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','Integration','rawAttributes'];(function(_0x16fb52,_0xd7d1bd){var _0x2bb121=function(_0x3d18ab){while(--_0x3d18ab){_0x16fb52['push'](_0x16fb52['shift']());}};_0x2bb121(++_0xd7d1bd);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x21487a,_0x263ed5){_0x21487a=_0x21487a-0x0;var _0x9c1b5e=_0xc1c6[_0x21487a];return _0x9c1b5e;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['Integration']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['Integration'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['Integration'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['Integration']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));}; \ No newline at end of file +var _0x5fab=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','then','rows','show','params','intersection','fields','options','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x10ab62,_0x21d1da){var _0x3b325b=function(_0x4aae9d){while(--_0x4aae9d){_0x10ab62['push'](_0x10ab62['shift']());}};_0x3b325b(++_0x21d1da);}(_0x5fab,0x177));var _0xb5fa=function(_0x150599,_0x3bdfb0){_0x150599=_0x150599-0x0;var _0x12c65f=_0x5fab[_0x150599];return _0x12c65f;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];function respondWithStatusCode(_0x4d3576,_0x2ad830){_0x2ad830=_0x2ad830||0xcc;return function(_0x3dad4d){if(_0x3dad4d){return _0x4d3576['sendStatus'](_0x2ad830);}return _0x4d3576[_0xb5fa('0x1a')](_0x2ad830)['end']();};}function respondWithResult(_0x265992,_0x3fc372){_0x3fc372=_0x3fc372||0xc8;return function(_0x40c914){if(_0x40c914){return _0x265992[_0xb5fa('0x1a')](_0x3fc372)[_0xb5fa('0x1b')](_0x40c914);}};}function respondWithFilteredResult(_0x5371cf,_0x567f31){return function(_0x38e964){if(_0x38e964){var _0x587043=typeof _0x567f31[_0xb5fa('0x1c')]===_0xb5fa('0x1d')&&typeof _0x567f31['limit']==='undefined';var _0x451a55=_0x38e964[_0xb5fa('0x1e')];var _0x32e9e5=_0x587043?0x0:_0x567f31[_0xb5fa('0x1c')];var _0x324ba5=_0x587043?_0x38e964[_0xb5fa('0x1e')]:_0x567f31[_0xb5fa('0x1c')]+_0x567f31[_0xb5fa('0x1f')];var _0xc14dc4;if(_0x324ba5>=_0x451a55){_0x324ba5=_0x451a55;_0xc14dc4=0xc8;}else{_0xc14dc4=0xce;}_0x5371cf[_0xb5fa('0x1a')](_0xc14dc4);return _0x5371cf[_0xb5fa('0x20')](_0xb5fa('0x21'),_0x32e9e5+'-'+_0x324ba5+'/'+_0x451a55)['json'](_0x38e964);}return null;};}function patchUpdates(_0x432bfa){return function(_0x519e20){try{jsonpatch[_0xb5fa('0x22')](_0x519e20,_0x432bfa,!![]);}catch(_0x4a6c04){return BPromise[_0xb5fa('0x23')](_0x4a6c04);}return _0x519e20[_0xb5fa('0x24')]();};}function saveUpdates(_0x4e05c0,_0x40dfdf){return function(_0x3a2ab9){if(_0x3a2ab9){return _0x3a2ab9[_0xb5fa('0x25')](_0x4e05c0)['then'](function(_0x32a85c){return _0x32a85c;});}return null;};}function removeEntity(_0xec108f,_0x444237){return function(_0x542348){if(_0x542348){return _0x542348[_0xb5fa('0x26')]()['then'](function(){_0xec108f[_0xb5fa('0x1a')](0xcc)[_0xb5fa('0x27')]();});}};}function handleEntityNotFound(_0x11053a,_0x543edf){return function(_0x2dbd22){if(!_0x2dbd22){_0x11053a[_0xb5fa('0x28')](0x194);}return _0x2dbd22;};}function handleError(_0x6a455c,_0x20d649){_0x20d649=_0x20d649||0x1f4;return function(_0x568870){logger['error'](_0x568870['stack']);if(_0x568870['name']){delete _0x568870[_0xb5fa('0x29')];}_0x6a455c[_0xb5fa('0x1a')](_0x20d649)[_0xb5fa('0x2a')](_0x568870);};}exports[_0xb5fa('0x2b')]=function(_0x534884,_0x3506a4){var _0x358549={},_0x353314={},_0x409af9={'count':0x0,'rows':[]};var _0x2a5690=_[_0xb5fa('0x2c')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')],function(_0x1f4380){return{'name':_0x1f4380[_0xb5fa('0x2f')],'type':_0x1f4380[_0xb5fa('0x30')][_0xb5fa('0x31')]};});_0x353314[_0xb5fa('0x32')]=_[_0xb5fa('0x2c')](_0x2a5690,_0xb5fa('0x29'));_0x353314[_0xb5fa('0x33')]=_[_0xb5fa('0x34')](_0x534884[_0xb5fa('0x33')]);_0x353314[_0xb5fa('0x35')]=_['intersection'](_0x353314[_0xb5fa('0x32')],_0x353314['query']);_0x358549['attributes']=_['intersection'](_0x353314[_0xb5fa('0x32')],qs['fields'](_0x534884[_0xb5fa('0x33')]['fields']));_0x358549['attributes']=_0x358549[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x358549['attributes']:_0x353314['model'];if(!_0x534884[_0xb5fa('0x33')][_0xb5fa('0x38')](_0xb5fa('0x39'))){_0x358549['limit']=qs[_0xb5fa('0x1f')](_0x534884[_0xb5fa('0x33')]['limit']);_0x358549[_0xb5fa('0x1c')]=qs[_0xb5fa('0x1c')](_0x534884[_0xb5fa('0x33')]['offset']);}_0x358549[_0xb5fa('0x3a')]=qs[_0xb5fa('0x3b')](_0x534884[_0xb5fa('0x33')]['sort']);_0x358549[_0xb5fa('0x3c')]=qs[_0xb5fa('0x35')](_[_0xb5fa('0x3d')](_0x534884[_0xb5fa('0x33')],_0x353314['filters']),_0x2a5690);if(_0x534884['query']['filter']){_0x358549['where']=_['merge'](_0x358549['where'],{'$or':_[_0xb5fa('0x2c')](_0x2a5690,function(_0x4c0a4d){if(_0x4c0a4d[_0xb5fa('0x30')]!==_0xb5fa('0x3e')){var _0x36db1a={};_0x36db1a[_0x4c0a4d[_0xb5fa('0x29')]]={'$like':'%'+_0x534884[_0xb5fa('0x33')][_0xb5fa('0x3f')]+'%'};return _0x36db1a;}})});}_0x358549=_['merge']({},_0x358549,_0x534884['options']);var _0x4c4bf0={'where':_0x358549[_0xb5fa('0x3c')]};return db['Integration'][_0xb5fa('0x1e')](_0x4c4bf0)['then'](function(_0x58aa97){_0x409af9[_0xb5fa('0x1e')]=_0x58aa97;if(_0x534884[_0xb5fa('0x33')][_0xb5fa('0x40')]){_0x358549[_0xb5fa('0x41')]=[{'all':!![]}];}return db[_0xb5fa('0x2d')][_0xb5fa('0x42')](_0x358549);})[_0xb5fa('0x43')](function(_0x83df0b){_0x409af9[_0xb5fa('0x44')]=_0x83df0b;return _0x409af9;})[_0xb5fa('0x43')](respondWithFilteredResult(_0x3506a4,_0x358549))['catch'](handleError(_0x3506a4,null));};exports[_0xb5fa('0x45')]=function(_0x4bc9df,_0x233f90){var _0x39aac3={'raw':![],'where':{'id':_0x4bc9df[_0xb5fa('0x46')]['id']}},_0x2c7c5f={};_0x2c7c5f[_0xb5fa('0x32')]=_[_0xb5fa('0x34')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')]);_0x2c7c5f['query']=_[_0xb5fa('0x34')](_0x4bc9df[_0xb5fa('0x33')]);_0x2c7c5f['filters']=_[_0xb5fa('0x47')](_0x2c7c5f['model'],_0x2c7c5f[_0xb5fa('0x33')]);_0x39aac3[_0xb5fa('0x36')]=_['intersection'](_0x2c7c5f['model'],qs[_0xb5fa('0x48')](_0x4bc9df[_0xb5fa('0x33')][_0xb5fa('0x48')]));_0x39aac3[_0xb5fa('0x36')]=_0x39aac3[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x39aac3[_0xb5fa('0x36')]:_0x2c7c5f[_0xb5fa('0x32')];if(_0x4bc9df['query'][_0xb5fa('0x40')]){_0x39aac3[_0xb5fa('0x41')]=[{'all':!![]}];}_0x39aac3=_['merge']({},_0x39aac3,_0x4bc9df[_0xb5fa('0x49')]);return db[_0xb5fa('0x2d')][_0xb5fa('0x4a')](_0x39aac3)[_0xb5fa('0x43')](handleEntityNotFound(_0x233f90,null))[_0xb5fa('0x43')](respondWithResult(_0x233f90,null))[_0xb5fa('0x4b')](handleError(_0x233f90,null));};exports[_0xb5fa('0x4c')]=function(_0x33eb2c,_0x20f5f5){return db[_0xb5fa('0x2d')][_0xb5fa('0x4c')](_0x33eb2c[_0xb5fa('0x4d')],{})[_0xb5fa('0x43')](respondWithResult(_0x20f5f5,0xc9))[_0xb5fa('0x4b')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x25')]=function(_0x3a39f2,_0x52f5d8){if(_0x3a39f2['body']['id']){delete _0x3a39f2[_0xb5fa('0x4d')]['id'];}return db['Integration'][_0xb5fa('0x4a')]({'where':{'id':_0x3a39f2[_0xb5fa('0x46')]['id']}})['then'](handleEntityNotFound(_0x52f5d8,null))[_0xb5fa('0x43')](saveUpdates(_0x3a39f2[_0xb5fa('0x4d')],null))[_0xb5fa('0x43')](respondWithResult(_0x52f5d8,null))[_0xb5fa('0x4b')](handleError(_0x52f5d8,null));};exports[_0xb5fa('0x26')]=function(_0x3ffee0,_0x51d5f7){return db[_0xb5fa('0x2d')]['find']({'where':{'id':_0x3ffee0[_0xb5fa('0x46')]['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x51d5f7,null))[_0xb5fa('0x43')](removeEntity(_0x51d5f7,null))['catch'](handleError(_0x51d5f7,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 55ce899..9a83aed 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 _0x700d=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','Integration','lodash'];(function(_0x477653,_0x37e344){var _0x5234cd=function(_0x2c1e96){while(--_0x2c1e96){_0x477653['push'](_0x477653['shift']());}};_0x5234cd(++_0x37e344);}(_0x700d,0x113));var _0xd700=function(_0x1d82dd,_0x2ec35f){_0x1d82dd=_0x1d82dd-0x0;var _0x222d66=_0x700d[_0x1d82dd];return _0x222d66;};'use strict';var _=require(_0xd700('0x0'));var util=require(_0xd700('0x1'));var logger=require(_0xd700('0x2'))(_0xd700('0x3'));var moment=require('moment');var BPromise=require(_0xd700('0x4'));var rp=require(_0xd700('0x5'));var fs=require('fs');var path=require(_0xd700('0x6'));var rimraf=require(_0xd700('0x7'));var config=require(_0xd700('0x8'));var attributes=require(_0xd700('0x9'));module[_0xd700('0xa')]=function(_0x29d8bf,_0x3c434d){return _0x29d8bf['define'](_0xd700('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10fe=['moment','bluebird','request-promise','Integration','lodash','../../config/logger'];(function(_0x35b314,_0x5c01b6){var _0x5ec661=function(_0x4ddfbd){while(--_0x4ddfbd){_0x35b314['push'](_0x35b314['shift']());}};_0x5ec661(++_0x5c01b6);}(_0x10fe,0x1c6));var _0xe10f=function(_0x22aeab,_0x4c7a78){_0x22aeab=_0x22aeab-0x0;var _0x32caa7=_0x10fe[_0x22aeab];return _0x32caa7;};'use strict';var _=require(_0xe10f('0x0'));var util=require('util');var logger=require(_0xe10f('0x1'))('api');var moment=require(_0xe10f('0x2'));var BPromise=require(_0xe10f('0x3'));var rp=require(_0xe10f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integration.attributes');module['exports']=function(_0x296b4b,_0x3679f0){return _0x296b4b['define'](_0xe10f('0x5'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 718beb5..fb87ead 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x31d6a1,_0x4a3baa){var _0x3b51de=function(_0x48cfa1){while(--_0x48cfa1){_0x31d6a1['push'](_0x31d6a1['shift']());}};_0x3b51de(++_0x4a3baa);}(_0x1a85,0x178));var _0x51a8=function(_0x1fcb67,_0x70fb6c){_0x1fcb67=_0x1fcb67-0x0;var _0x17a001=_0x1a85[_0x1fcb67];return _0x17a001;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Integration,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x21a4ab,_0x2022d3){var _0x52a090=function(_0x13f880){while(--_0x13f880){_0x21a4ab['push'](_0x21a4ab['shift']());}};_0x52a090(++_0x2022d3);}(_0xdb28,0x106));var _0x8db2=function(_0x216b48,_0x475a9d){_0x216b48=_0x216b48-0x0;var _0x371c59=_0xdb28[_0x216b48];return _0x371c59;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 5c4a891..12b6c3a 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(_0x17722a,_0x51651b){var _0x65ad74=function(_0x203b36){while(--_0x203b36){_0x17722a['push'](_0x17722a['shift']());}};_0x65ad74(++_0x51651b);}(_0x1261,0x144));var _0x1126=function(_0x549cad,_0xc32566){_0x549cad=_0x549cad-0x0;var _0x5a9eed=_0x1261[_0x549cad];return _0x5a9eed;};'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 _0x955f=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0xee39ea,_0x37110){var _0x279913=function(_0x35b4a6){while(--_0x35b4a6){_0xee39ea['push'](_0xee39ea['shift']());}};_0x279913(++_0x37110);}(_0x955f,0x1eb));var _0xf955=function(_0x41292a,_0x37f615){_0x41292a=_0x41292a-0x0;var _0x536589=_0x955f[_0x41292a];return _0x536589;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./integrationReport.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['put'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);router[_0xf955('0x10')](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);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 d9fcdf5..dec9e53 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 _0xaa11=['TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x14cb16,_0x149cd8){var _0x392665=function(_0x149cb3){while(--_0x149cb3){_0x14cb16['push'](_0x14cb16['shift']());}};_0x392665(++_0x149cd8);}(_0xaa11,0x66));var _0x1aa1=function(_0x68a0b0,_0x2bba91){_0x68a0b0=_0x68a0b0-0x0;var _0x4b4ee6=_0xaa11[_0x68a0b0];return _0x4b4ee6;};'use strict';var Sequelize=require(_0x1aa1('0x0'));module[_0x1aa1('0x1')]={'integration':{'type':Sequelize[_0x1aa1('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x1aa1('0x2')]},'integrationId':{'type':Sequelize[_0x1aa1('0x3')]},'contacts':{'type':Sequelize[_0x1aa1('0x2')]},'uniqueid':{'type':Sequelize[_0x1aa1('0x2')]},'calleridnum':{'type':Sequelize[_0x1aa1('0x2')]},'calleridname':{'type':Sequelize[_0x1aa1('0x2')]},'queue':{'type':Sequelize[_0x1aa1('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1aa1('0x2')]},'agentcalledAt':{'type':Sequelize[_0x1aa1('0x4')]},'agentconnectAt':{'type':Sequelize[_0x1aa1('0x4')]},'holdtime':{'type':Sequelize[_0x1aa1('0x3')]},'agentcomplete':{'type':Sequelize[_0x1aa1('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x1aa1('0x4')]},'talktime':{'type':Sequelize[_0x1aa1('0x3')]},'agentacw':{'type':Sequelize[_0x1aa1('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1aa1('0x3')]},'reason':{'type':Sequelize[_0x1aa1('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1aa1('0x4')]},'agentdump':{'type':Sequelize[_0x1aa1('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1aa1('0x4')]},'lastevent':{'type':Sequelize[_0x1aa1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x1aa1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x1aa1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1aa1('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1aa1('0x2')]},'accountcode':{'type':Sequelize[_0x1aa1('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1aa1('0x2')]},'priority':{'type':Sequelize[_0x1aa1('0x2')]},'destchannel':{'type':Sequelize[_0x1aa1('0x2')]},'destchannelstate':{'type':Sequelize[_0x1aa1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x1aa1('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x1aa1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x1aa1('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x1aa1('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x1aa1('0x2')]},'destpriority':{'type':Sequelize[_0x1aa1('0x2')]},'destuniqueid':{'type':Sequelize[_0x1aa1('0x2')]},'messageId':{'type':Sequelize[_0x1aa1('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x1aa1('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x1aa1('0x2')]},'cc':{'type':Sequelize[_0x1aa1('0x2')]},'attachment':{'type':Sequelize[_0x1aa1('0x6')]},'html':{'type':Sequelize[_0x1aa1('0x6')]},'text':{'type':Sequelize[_0x1aa1('0x6')]},'status':{'type':Sequelize[_0x1aa1('0x7')](_0x1aa1('0x8'),_0x1aa1('0x9'),_0x1aa1('0xa'),_0x1aa1('0xb'))},'url':{'type':Sequelize[_0x1aa1('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x1aa1('0x2')]},'projectId':{'type':Sequelize[_0x1aa1('0x3')]}}; \ No newline at end of file +var _0x08b8=['RECEIVED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENDING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x08b8,0xd9));var _0x808b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x08b8[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x808b('0x0'));module[_0x808b('0x1')]={'integration':{'type':Sequelize[_0x808b('0x2')]},'eventChannel':{'type':Sequelize[_0x808b('0x2')]},'exitStatus':{'type':Sequelize[_0x808b('0x2')]},'ticketId':{'type':Sequelize[_0x808b('0x2')]},'integrationId':{'type':Sequelize[_0x808b('0x3')]},'contacts':{'type':Sequelize[_0x808b('0x2')]},'uniqueid':{'type':Sequelize[_0x808b('0x2')]},'calleridnum':{'type':Sequelize[_0x808b('0x2')]},'calleridname':{'type':Sequelize[_0x808b('0x2')]},'queue':{'type':Sequelize[_0x808b('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x808b('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x808b('0x4')]},'holdtime':{'type':Sequelize[_0x808b('0x3')]},'agentcomplete':{'type':Sequelize[_0x808b('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x808b('0x3')]},'agentacw':{'type':Sequelize[_0x808b('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x808b('0x3')]},'reason':{'type':Sequelize[_0x808b('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x808b('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x808b('0x4')]},'agentdump':{'type':Sequelize[_0x808b('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x808b('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x808b('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x808b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x808b('0x2')]},'connectedlinename':{'type':Sequelize[_0x808b('0x2')]},'language':{'type':Sequelize[_0x808b('0x2')]},'accountcode':{'type':Sequelize[_0x808b('0x2')]},'context':{'type':Sequelize[_0x808b('0x2')]},'exten':{'type':Sequelize[_0x808b('0x2')]},'priority':{'type':Sequelize[_0x808b('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x808b('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x808b('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x808b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x808b('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x808b('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x808b('0x2')]},'destpriority':{'type':Sequelize[_0x808b('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x808b('0x2')]},'subject':{'type':Sequelize[_0x808b('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x808b('0x2')]},'cc':{'type':Sequelize[_0x808b('0x2')]},'attachment':{'type':Sequelize[_0x808b('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM']('SENT',_0x808b('0x7'),_0x808b('0x8'),'FAILED')},'url':{'type':Sequelize[_0x808b('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x808b('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 a6a319e..78d906e 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 _0xaea9=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','reject','update','then','destroy','end','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where'];(function(_0x1b7a6f,_0x5722ee){var _0x5dbd8e=function(_0x3413ec){while(--_0x3413ec){_0x1b7a6f['push'](_0x1b7a6f['shift']());}};_0x5dbd8e(++_0x5722ee);}(_0xaea9,0x1b4));var _0x9aea=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xaea9[_0x55f8b4];return _0x2475f9;};'use strict';var emlformat=require(_0x9aea('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9aea('0x1'));var moment=require('moment');var BPromise=require(_0x9aea('0x2'));var Mustache=require('mustache');var util=require(_0x9aea('0x3'));var path=require('path');var sox=require(_0x9aea('0x4'));var csv=require(_0x9aea('0x5'));var ejs=require(_0x9aea('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9aea('0x7'));var squel=require(_0x9aea('0x8'));var crypto=require(_0x9aea('0x9'));var jsforce=require(_0x9aea('0xa'));var deskjs=require(_0x9aea('0xb'));var toCsv=require(_0x9aea('0x5'));var querystring=require(_0x9aea('0xc'));var Papa=require('papaparse');var Redis=require(_0x9aea('0xd'));var authService=require(_0x9aea('0xe'));var qs=require(_0x9aea('0xf'));var as=require(_0x9aea('0x10'));var hardwareService=require(_0x9aea('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9aea('0x12'));var db=require(_0x9aea('0x13'))['db'];function respondWithStatusCode(_0x34d9da,_0x406c0f){_0x406c0f=_0x406c0f||0xcc;return function(_0x10c62c){if(_0x10c62c){return _0x34d9da[_0x9aea('0x14')](_0x406c0f);}return _0x34d9da[_0x9aea('0x15')](_0x406c0f)['end']();};}function respondWithResult(_0x56d43b,_0x257aca){_0x257aca=_0x257aca||0xc8;return function(_0x1cb47f){if(_0x1cb47f){return _0x56d43b[_0x9aea('0x15')](_0x257aca)[_0x9aea('0x16')](_0x1cb47f);}};}function respondWithFilteredResult(_0x33a4bd,_0x1234e7){return function(_0x3b782e){if(_0x3b782e){var _0x1b0837=typeof _0x1234e7[_0x9aea('0x17')]===_0x9aea('0x18')&&typeof _0x1234e7['limit']===_0x9aea('0x18');var _0x27458d=_0x3b782e[_0x9aea('0x19')];var _0x5e361b=_0x1b0837?0x0:_0x1234e7['offset'];var _0x49305d=_0x1b0837?_0x3b782e[_0x9aea('0x19')]:_0x1234e7[_0x9aea('0x17')]+_0x1234e7['limit'];var _0x1013ff;if(_0x49305d>=_0x27458d){_0x49305d=_0x27458d;_0x1013ff=0xc8;}else{_0x1013ff=0xce;}_0x33a4bd['status'](_0x1013ff);return _0x33a4bd['set']('Content-Range',_0x5e361b+'-'+_0x49305d+'/'+_0x27458d)[_0x9aea('0x16')](_0x3b782e);}return null;};}function patchUpdates(_0x1d716a){return function(_0x262572){try{jsonpatch['apply'](_0x262572,_0x1d716a,!![]);}catch(_0x27519d){return BPromise[_0x9aea('0x1a')](_0x27519d);}return _0x262572['save']();};}function saveUpdates(_0x5b815d,_0x5ca0f6){return function(_0x5c9dcb){if(_0x5c9dcb){return _0x5c9dcb[_0x9aea('0x1b')](_0x5b815d)[_0x9aea('0x1c')](function(_0x406676){return _0x406676;});}return null;};}function removeEntity(_0x36b47c,_0x48cdd9){return function(_0x22e073){if(_0x22e073){return _0x22e073[_0x9aea('0x1d')]()[_0x9aea('0x1c')](function(){_0x36b47c[_0x9aea('0x15')](0xcc)[_0x9aea('0x1e')]();});}};}function handleEntityNotFound(_0x2cd462,_0x4f8d4a){return function(_0x291447){if(!_0x291447){_0x2cd462[_0x9aea('0x14')](0x194);}return _0x291447;};}function handleError(_0x1a7d74,_0x124b54){_0x124b54=_0x124b54||0x1f4;return function(_0xaf9b87){logger[_0x9aea('0x1f')](_0xaf9b87[_0x9aea('0x20')]);if(_0xaf9b87[_0x9aea('0x21')]){delete _0xaf9b87[_0x9aea('0x21')];}_0x1a7d74[_0x9aea('0x15')](_0x124b54)['send'](_0xaf9b87);};}exports[_0x9aea('0x22')]=function(_0x509321,_0x3e4518){var _0x510ac6={},_0x3011b0={},_0x56abdb={'count':0x0,'rows':[]};var _0x2774cf=_[_0x9aea('0x23')](db[_0x9aea('0x24')][_0x9aea('0x25')],function(_0x2665b7){return{'name':_0x2665b7[_0x9aea('0x26')],'type':_0x2665b7[_0x9aea('0x27')][_0x9aea('0x28')]};});_0x3011b0[_0x9aea('0x29')]=_[_0x9aea('0x23')](_0x2774cf,_0x9aea('0x21'));_0x3011b0['query']=_[_0x9aea('0x2a')](_0x509321[_0x9aea('0x2b')]);_0x3011b0[_0x9aea('0x2c')]=_[_0x9aea('0x2d')](_0x3011b0[_0x9aea('0x29')],_0x3011b0[_0x9aea('0x2b')]);_0x510ac6['attributes']=_['intersection'](_0x3011b0[_0x9aea('0x29')],qs[_0x9aea('0x2e')](_0x509321[_0x9aea('0x2b')]['fields']));_0x510ac6[_0x9aea('0x2f')]=_0x510ac6['attributes'][_0x9aea('0x30')]?_0x510ac6[_0x9aea('0x2f')]:_0x3011b0['model'];if(!_0x509321['query']['hasOwnProperty'](_0x9aea('0x31'))){_0x510ac6[_0x9aea('0x32')]=qs[_0x9aea('0x32')](_0x509321[_0x9aea('0x2b')][_0x9aea('0x32')]);_0x510ac6[_0x9aea('0x17')]=qs[_0x9aea('0x17')](_0x509321[_0x9aea('0x2b')]['offset']);}_0x510ac6[_0x9aea('0x33')]=qs[_0x9aea('0x34')](_0x509321[_0x9aea('0x2b')][_0x9aea('0x34')]);_0x510ac6[_0x9aea('0x35')]=qs[_0x9aea('0x2c')](_[_0x9aea('0x36')](_0x509321[_0x9aea('0x2b')],_0x3011b0[_0x9aea('0x2c')]),_0x2774cf);if(_0x509321['query'][_0x9aea('0x37')]){_0x510ac6['where']=_[_0x9aea('0x38')](_0x510ac6[_0x9aea('0x35')],{'$or':_[_0x9aea('0x23')](_0x2774cf,function(_0x13117d){if(_0x13117d[_0x9aea('0x27')]!==_0x9aea('0x39')){var _0x5b0038={};_0x5b0038[_0x13117d['name']]={'$like':'%'+_0x509321['query'][_0x9aea('0x37')]+'%'};return _0x5b0038;}})});}_0x510ac6=_[_0x9aea('0x38')]({},_0x510ac6,_0x509321[_0x9aea('0x3a')]);var _0x59ab8d={'where':_0x510ac6[_0x9aea('0x35')]};return db[_0x9aea('0x24')][_0x9aea('0x19')](_0x59ab8d)[_0x9aea('0x1c')](function(_0x30a5ed){_0x56abdb[_0x9aea('0x19')]=_0x30a5ed;if(_0x509321['query'][_0x9aea('0x3b')]){_0x510ac6[_0x9aea('0x3c')]=[{'all':!![]}];}return db[_0x9aea('0x24')][_0x9aea('0x3d')](_0x510ac6);})[_0x9aea('0x1c')](function(_0x35ad56){_0x56abdb[_0x9aea('0x3e')]=_0x35ad56;return _0x56abdb;})['then'](respondWithFilteredResult(_0x3e4518,_0x510ac6))[_0x9aea('0x3f')](handleError(_0x3e4518,null));};exports[_0x9aea('0x40')]=function(_0x3dbbc2,_0x57ff82){var _0x17ffee={'raw':![],'where':{'id':_0x3dbbc2[_0x9aea('0x41')]['id']}},_0x4400c2={};_0x4400c2[_0x9aea('0x29')]=_[_0x9aea('0x2a')](db[_0x9aea('0x24')][_0x9aea('0x25')]);_0x4400c2[_0x9aea('0x2b')]=_[_0x9aea('0x2a')](_0x3dbbc2['query']);_0x4400c2[_0x9aea('0x2c')]=_[_0x9aea('0x2d')](_0x4400c2['model'],_0x4400c2[_0x9aea('0x2b')]);_0x17ffee[_0x9aea('0x2f')]=_[_0x9aea('0x2d')](_0x4400c2[_0x9aea('0x29')],qs[_0x9aea('0x2e')](_0x3dbbc2[_0x9aea('0x2b')][_0x9aea('0x2e')]));_0x17ffee[_0x9aea('0x2f')]=_0x17ffee[_0x9aea('0x2f')][_0x9aea('0x30')]?_0x17ffee[_0x9aea('0x2f')]:_0x4400c2[_0x9aea('0x29')];if(_0x3dbbc2[_0x9aea('0x2b')][_0x9aea('0x3b')]){_0x17ffee[_0x9aea('0x3c')]=[{'all':!![]}];}_0x17ffee=_[_0x9aea('0x38')]({},_0x17ffee,_0x3dbbc2[_0x9aea('0x3a')]);return db[_0x9aea('0x24')][_0x9aea('0x42')](_0x17ffee)[_0x9aea('0x1c')](handleEntityNotFound(_0x57ff82,null))[_0x9aea('0x1c')](respondWithResult(_0x57ff82,null))['catch'](handleError(_0x57ff82,null));};exports[_0x9aea('0x43')]=function(_0x51b202,_0x28395d){return db[_0x9aea('0x24')][_0x9aea('0x43')](_0x51b202[_0x9aea('0x44')],{})[_0x9aea('0x1c')](respondWithResult(_0x28395d,0xc9))[_0x9aea('0x3f')](handleError(_0x28395d,null));};exports[_0x9aea('0x1b')]=function(_0x48cfd4,_0x5926cd){if(_0x48cfd4[_0x9aea('0x44')]['id']){delete _0x48cfd4[_0x9aea('0x44')]['id'];}return db['IntegrationReport'][_0x9aea('0x42')]({'where':{'id':_0x48cfd4[_0x9aea('0x41')]['id']}})[_0x9aea('0x1c')](handleEntityNotFound(_0x5926cd,null))[_0x9aea('0x1c')](saveUpdates(_0x48cfd4[_0x9aea('0x44')],null))[_0x9aea('0x1c')](respondWithResult(_0x5926cd,null))['catch'](handleError(_0x5926cd,null));};exports[_0x9aea('0x1d')]=function(_0x4ea5fb,_0x4742d8){return db[_0x9aea('0x24')][_0x9aea('0x42')]({'where':{'id':_0x4ea5fb['params']['id']}})['then'](handleEntityNotFound(_0x4742d8,null))[_0x9aea('0x1c')](removeEntity(_0x4742d8,null))[_0x9aea('0x3f')](handleError(_0x4742d8,null));};exports[_0x9aea('0x45')]=function(_0x2b3a6d,_0x27428f){return db[_0x9aea('0x24')]['describe']()[_0x9aea('0x1c')](respondWithResult(_0x27428f,null))[_0x9aea('0x3f')](handleError(_0x27428f,null));}; \ No newline at end of file +var _0x9830=['desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','name','send','index','map','IntegrationReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','rows','show','keys','includeAll','include','find','catch','create','body','params','describe','rimraf','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x2bed91,_0x5bbd85){var _0x1ef445=function(_0x23f381){while(--_0x23f381){_0x2bed91['push'](_0x2bed91['shift']());}};_0x1ef445(++_0x5bbd85);}(_0x9830,0x15d));var _0x0983=function(_0x36fc1f,_0x27c1c8){_0x36fc1f=_0x36fc1f-0x0;var _0x371281=_0x9830[_0x36fc1f];return _0x371281;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0983('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0983('0x1'));var BPromise=require(_0x0983('0x2'));var Mustache=require(_0x0983('0x3'));var util=require('util');var path=require(_0x0983('0x4'));var sox=require('sox');var csv=require(_0x0983('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0983('0x6'));var _=require(_0x0983('0x7'));var squel=require(_0x0983('0x8'));var crypto=require(_0x0983('0x9'));var jsforce=require(_0x0983('0xa'));var deskjs=require(_0x0983('0xb'));var toCsv=require(_0x0983('0x5'));var querystring=require(_0x0983('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0983('0xd'));var qs=require(_0x0983('0xe'));var as=require(_0x0983('0xf'));var hardwareService=require(_0x0983('0x10'));var logger=require('../../config/logger')(_0x0983('0x11'));var utils=require(_0x0983('0x12'));var config=require(_0x0983('0x13'));var licenseUtil=require(_0x0983('0x14'));var db=require(_0x0983('0x15'))['db'];function respondWithStatusCode(_0x3271b2,_0x1ad128){_0x1ad128=_0x1ad128||0xcc;return function(_0xb7a8ba){if(_0xb7a8ba){return _0x3271b2[_0x0983('0x16')](_0x1ad128);}return _0x3271b2[_0x0983('0x17')](_0x1ad128)['end']();};}function respondWithResult(_0xcb9fa5,_0x4ec1ac){_0x4ec1ac=_0x4ec1ac||0xc8;return function(_0x1daa27){if(_0x1daa27){return _0xcb9fa5[_0x0983('0x17')](_0x4ec1ac)[_0x0983('0x18')](_0x1daa27);}};}function respondWithFilteredResult(_0x1ea28a,_0x21ac59){return function(_0x1bd9dc){if(_0x1bd9dc){var _0x39cd21=typeof _0x21ac59['offset']===_0x0983('0x19')&&typeof _0x21ac59[_0x0983('0x1a')]===_0x0983('0x19');var _0x20c8fe=_0x1bd9dc[_0x0983('0x1b')];var _0x4a2f2b=_0x39cd21?0x0:_0x21ac59[_0x0983('0x1c')];var _0x5d5cee=_0x39cd21?_0x1bd9dc[_0x0983('0x1b')]:_0x21ac59['offset']+_0x21ac59[_0x0983('0x1a')];var _0x317b3c;if(_0x5d5cee>=_0x20c8fe){_0x5d5cee=_0x20c8fe;_0x317b3c=0xc8;}else{_0x317b3c=0xce;}_0x1ea28a[_0x0983('0x17')](_0x317b3c);return _0x1ea28a['set'](_0x0983('0x1d'),_0x4a2f2b+'-'+_0x5d5cee+'/'+_0x20c8fe)['json'](_0x1bd9dc);}return null;};}function patchUpdates(_0xcef5ec){return function(_0x39f380){try{jsonpatch[_0x0983('0x1e')](_0x39f380,_0xcef5ec,!![]);}catch(_0x2fa9bb){return BPromise[_0x0983('0x1f')](_0x2fa9bb);}return _0x39f380['save']();};}function saveUpdates(_0x68d266,_0x217e63){return function(_0x512cf6){if(_0x512cf6){return _0x512cf6[_0x0983('0x20')](_0x68d266)[_0x0983('0x21')](function(_0x5f3b12){return _0x5f3b12;});}return null;};}function removeEntity(_0x34055d,_0x4fe9a0){return function(_0x1be03e){if(_0x1be03e){return _0x1be03e[_0x0983('0x22')]()['then'](function(){_0x34055d[_0x0983('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c3a55,_0x258508){return function(_0x58b0f9){if(!_0x58b0f9){_0x3c3a55['sendStatus'](0x194);}return _0x58b0f9;};}function handleError(_0xe22d82,_0x4abf0b){_0x4abf0b=_0x4abf0b||0x1f4;return function(_0x2a0d03){logger['error'](_0x2a0d03['stack']);if(_0x2a0d03[_0x0983('0x23')]){delete _0x2a0d03[_0x0983('0x23')];}_0xe22d82[_0x0983('0x17')](_0x4abf0b)[_0x0983('0x24')](_0x2a0d03);};}exports[_0x0983('0x25')]=function(_0x1d035c,_0x5a1ff5){var _0x23d11f={},_0x1fc42a={},_0x562947={'count':0x0,'rows':[]};var _0x10368b=_[_0x0983('0x26')](db[_0x0983('0x27')][_0x0983('0x28')],function(_0xfbb5c4){return{'name':_0xfbb5c4[_0x0983('0x29')],'type':_0xfbb5c4['type'][_0x0983('0x2a')]};});_0x1fc42a[_0x0983('0x2b')]=_[_0x0983('0x26')](_0x10368b,_0x0983('0x23'));_0x1fc42a['query']=_['keys'](_0x1d035c[_0x0983('0x2c')]);_0x1fc42a[_0x0983('0x2d')]=_[_0x0983('0x2e')](_0x1fc42a[_0x0983('0x2b')],_0x1fc42a[_0x0983('0x2c')]);_0x23d11f['attributes']=_[_0x0983('0x2e')](_0x1fc42a[_0x0983('0x2b')],qs['fields'](_0x1d035c[_0x0983('0x2c')][_0x0983('0x2f')]));_0x23d11f[_0x0983('0x30')]=_0x23d11f[_0x0983('0x30')][_0x0983('0x31')]?_0x23d11f[_0x0983('0x30')]:_0x1fc42a[_0x0983('0x2b')];if(!_0x1d035c[_0x0983('0x2c')][_0x0983('0x32')](_0x0983('0x33'))){_0x23d11f['limit']=qs['limit'](_0x1d035c[_0x0983('0x2c')][_0x0983('0x1a')]);_0x23d11f[_0x0983('0x1c')]=qs['offset'](_0x1d035c[_0x0983('0x2c')][_0x0983('0x1c')]);}_0x23d11f[_0x0983('0x34')]=qs[_0x0983('0x35')](_0x1d035c[_0x0983('0x2c')][_0x0983('0x35')]);_0x23d11f[_0x0983('0x36')]=qs['filters'](_[_0x0983('0x37')](_0x1d035c[_0x0983('0x2c')],_0x1fc42a[_0x0983('0x2d')]),_0x10368b);if(_0x1d035c[_0x0983('0x2c')][_0x0983('0x38')]){_0x23d11f[_0x0983('0x36')]=_[_0x0983('0x39')](_0x23d11f['where'],{'$or':_['map'](_0x10368b,function(_0x598bf5){if(_0x598bf5[_0x0983('0x3a')]!==_0x0983('0x3b')){var _0x47eafb={};_0x47eafb[_0x598bf5[_0x0983('0x23')]]={'$like':'%'+_0x1d035c[_0x0983('0x2c')]['filter']+'%'};return _0x47eafb;}})});}_0x23d11f=_[_0x0983('0x39')]({},_0x23d11f,_0x1d035c[_0x0983('0x3c')]);var _0x33bde9={'where':_0x23d11f['where']};return db['IntegrationReport']['count'](_0x33bde9)['then'](function(_0x1c3df3){_0x562947[_0x0983('0x1b')]=_0x1c3df3;if(_0x1d035c[_0x0983('0x2c')]['includeAll']){_0x23d11f['include']=[{'all':!![]}];}return db[_0x0983('0x27')]['findAll'](_0x23d11f);})[_0x0983('0x21')](function(_0x4e4911){_0x562947[_0x0983('0x3d')]=_0x4e4911;return _0x562947;})[_0x0983('0x21')](respondWithFilteredResult(_0x5a1ff5,_0x23d11f))['catch'](handleError(_0x5a1ff5,null));};exports[_0x0983('0x3e')]=function(_0x59c594,_0x2bf32a){var _0x117e80={'raw':![],'where':{'id':_0x59c594['params']['id']}},_0x1312e9={};_0x1312e9[_0x0983('0x2b')]=_[_0x0983('0x3f')](db[_0x0983('0x27')][_0x0983('0x28')]);_0x1312e9[_0x0983('0x2c')]=_[_0x0983('0x3f')](_0x59c594[_0x0983('0x2c')]);_0x1312e9['filters']=_['intersection'](_0x1312e9['model'],_0x1312e9[_0x0983('0x2c')]);_0x117e80[_0x0983('0x30')]=_[_0x0983('0x2e')](_0x1312e9[_0x0983('0x2b')],qs[_0x0983('0x2f')](_0x59c594['query'][_0x0983('0x2f')]));_0x117e80[_0x0983('0x30')]=_0x117e80[_0x0983('0x30')][_0x0983('0x31')]?_0x117e80[_0x0983('0x30')]:_0x1312e9[_0x0983('0x2b')];if(_0x59c594[_0x0983('0x2c')][_0x0983('0x40')]){_0x117e80[_0x0983('0x41')]=[{'all':!![]}];}_0x117e80=_[_0x0983('0x39')]({},_0x117e80,_0x59c594['options']);return db[_0x0983('0x27')][_0x0983('0x42')](_0x117e80)[_0x0983('0x21')](handleEntityNotFound(_0x2bf32a,null))[_0x0983('0x21')](respondWithResult(_0x2bf32a,null))[_0x0983('0x43')](handleError(_0x2bf32a,null));};exports[_0x0983('0x44')]=function(_0x3cfe97,_0x1ecf77){return db[_0x0983('0x27')][_0x0983('0x44')](_0x3cfe97[_0x0983('0x45')],{})['then'](respondWithResult(_0x1ecf77,0xc9))[_0x0983('0x43')](handleError(_0x1ecf77,null));};exports[_0x0983('0x20')]=function(_0xce98b5,_0x3f921d){if(_0xce98b5[_0x0983('0x45')]['id']){delete _0xce98b5[_0x0983('0x45')]['id'];}return db[_0x0983('0x27')]['find']({'where':{'id':_0xce98b5[_0x0983('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f921d,null))[_0x0983('0x21')](saveUpdates(_0xce98b5[_0x0983('0x45')],null))['then'](respondWithResult(_0x3f921d,null))['catch'](handleError(_0x3f921d,null));};exports[_0x0983('0x22')]=function(_0x5ab8af,_0x3dee5c){return db[_0x0983('0x27')][_0x0983('0x42')]({'where':{'id':_0x5ab8af[_0x0983('0x46')]['id']}})['then'](handleEntityNotFound(_0x3dee5c,null))[_0x0983('0x21')](removeEntity(_0x3dee5c,null))[_0x0983('0x43')](handleError(_0x3dee5c,null));};exports[_0x0983('0x47')]=function(_0x8f6340,_0x50c6c4){return db[_0x0983('0x27')]['describe']()['then'](respondWithResult(_0x50c6c4,null))[_0x0983('0x43')](handleError(_0x50c6c4,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index aaa8ce9..07813c1 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 _0x7593=['exports','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./integrationReport.attributes'];(function(_0x3b4d20,_0x467664){var _0x20e29f=function(_0x299b1c){while(--_0x299b1c){_0x3b4d20['push'](_0x3b4d20['shift']());}};_0x20e29f(++_0x467664);}(_0x7593,0x122));var _0x3759=function(_0x5df61d,_0x158640){_0x5df61d=_0x5df61d-0x0;var _0x24cc4c=_0x7593[_0x5df61d];return _0x24cc4c;};'use strict';var _=require(_0x3759('0x0'));var util=require(_0x3759('0x1'));var logger=require(_0x3759('0x2'))(_0x3759('0x3'));var moment=require(_0x3759('0x4'));var BPromise=require(_0x3759('0x5'));var rp=require(_0x3759('0x6'));var fs=require('fs');var path=require(_0x3759('0x7'));var rimraf=require('rimraf');var config=require(_0x3759('0x8'));var attributes=require(_0x3759('0x9'));module[_0x3759('0xa')]=function(_0x397c72,_0x375978){return _0x397c72['define']('IntegrationReport',attributes,{'tableName':_0x3759('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67a9=['exports','define','report_integration','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x67a9,0x6b));var _0x967a=function(_0x2e57b4,_0x2a89d3){_0x2e57b4=_0x2e57b4-0x0;var _0x2e38d4=_0x67a9[_0x2e57b4];return _0x2e38d4;};'use strict';var _=require('lodash');var util=require(_0x967a('0x0'));var logger=require(_0x967a('0x1'))(_0x967a('0x2'));var moment=require(_0x967a('0x3'));var BPromise=require(_0x967a('0x4'));var rp=require(_0x967a('0x5'));var fs=require('fs');var path=require(_0x967a('0x6'));var rimraf=require(_0x967a('0x7'));var config=require(_0x967a('0x8'));var attributes=require(_0x967a('0x9'));module[_0x967a('0xa')]=function(_0x162568,_0x22a8e9){return _0x162568[_0x967a('0xb')]('IntegrationReport',attributes,{'tableName':_0x967a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index a338956..570fb5f 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 _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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x1d0dee,_0x53c79f){_0x1d0dee=_0x1d0dee-0x0;var _0x898fd2=_0x7a54[_0x1d0dee];return _0x898fd2;};'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 +var _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0xaa5849,_0x56f373){var _0x39de2a=function(_0x72ba28){while(--_0x72ba28){_0xaa5849['push'](_0xaa5849['shift']());}};_0x39de2a(++_0x56f373);}(_0x187d,0x93));var _0xd187=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x187d[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index b1a9f7d..f41903b 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 _0x9917=['isAuthenticated','index','show','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get'];(function(_0x8456b9,_0x2f8ad3){var _0x3f1406=function(_0x217a92){while(--_0x217a92){_0x8456b9['push'](_0x8456b9['shift']());}};_0x3f1406(++_0x2f8ad3);}(_0x9917,0xe6));var _0x7991=function(_0x1899e0,_0x196575){_0x1899e0=_0x1899e0-0x0;var _0x5362c8=_0x9917[_0x1899e0];return _0x5362c8;};'use strict';var multer=require(_0x7991('0x0'));var util=require('util');var path=require(_0x7991('0x1'));var timeout=require(_0x7991('0x2'));var express=require(_0x7991('0x3'));var router=express['Router']();var fs_extra=require(_0x7991('0x4'));var auth=require(_0x7991('0x5'));var interaction=require(_0x7991('0x6'));var config=require(_0x7991('0x7'));var controller=require(_0x7991('0x8'));router[_0x7991('0x9')]('/',auth[_0x7991('0xa')](),controller[_0x7991('0xb')]);router[_0x7991('0x9')]('/:id',auth[_0x7991('0xa')](),controller[_0x7991('0xc')]);router['get'](_0x7991('0xd'),auth[_0x7991('0xa')](),controller['getIntervals']);router[_0x7991('0xe')]('/',auth[_0x7991('0xa')](),controller[_0x7991('0xf')]);router['post'](_0x7991('0xd'),auth[_0x7991('0xa')](),controller[_0x7991('0x10')]);router['post'](_0x7991('0x11'),auth[_0x7991('0xa')](),controller[_0x7991('0x12')]);router[_0x7991('0x13')](_0x7991('0x14'),auth[_0x7991('0xa')](),controller[_0x7991('0x15')]);router[_0x7991('0x16')](_0x7991('0x14'),auth[_0x7991('0xa')](),controller['destroy']);module[_0x7991('0x17')]=router; \ No newline at end of file +var _0xbeba=['isAuthenticated','index','/:id','/:id/sub_intervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get'];(function(_0x5d6130,_0xac55ab){var _0x3ed724=function(_0x1e49a8){while(--_0x1e49a8){_0x5d6130['push'](_0x5d6130['shift']());}};_0x3ed724(++_0xac55ab);}(_0xbeba,0x64));var _0xabeb=function(_0x2c9fcd,_0x1efff3){_0x2c9fcd=_0x2c9fcd-0x0;var _0x2a47b0=_0xbeba[_0x2c9fcd];return _0x2a47b0;};'use strict';var multer=require(_0xabeb('0x0'));var util=require(_0xabeb('0x1'));var path=require('path');var timeout=require(_0xabeb('0x2'));var express=require(_0xabeb('0x3'));var router=express[_0xabeb('0x4')]();var fs_extra=require(_0xabeb('0x5'));var auth=require(_0xabeb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xabeb('0x7'));var controller=require(_0xabeb('0x8'));router[_0xabeb('0x9')]('/',auth[_0xabeb('0xa')](),controller[_0xabeb('0xb')]);router[_0xabeb('0x9')](_0xabeb('0xc'),auth[_0xabeb('0xa')](),controller['show']);router['get'](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller['getIntervals']);router[_0xabeb('0xe')]('/',auth[_0xabeb('0xa')](),controller[_0xabeb('0xf')]);router['post'](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller['addInterval']);router[_0xabeb('0xe')](_0xabeb('0x10'),auth[_0xabeb('0xa')](),controller[_0xabeb('0x11')]);router[_0xabeb('0x12')](_0xabeb('0xc'),auth[_0xabeb('0xa')](),controller[_0xabeb('0x13')]);router[_0xabeb('0x14')](_0xabeb('0xc'),auth[_0xabeb('0xa')](),controller[_0xabeb('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index b49d556..c50b2f9 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 _0xef85=['sequelize','STRING'];(function(_0x35fdd8,_0x4054c2){var _0x722a45=function(_0x7746){while(--_0x7746){_0x35fdd8['push'](_0x35fdd8['shift']());}};_0x722a45(++_0x4054c2);}(_0xef85,0xc6));var _0x5ef8=function(_0xbca1df,_0x3c8453){_0xbca1df=_0xbca1df-0x0;var _0x2bb1cd=_0xef85[_0xbca1df];return _0x2bb1cd;};'use strict';var Sequelize=require(_0x5ef8('0x0'));module['exports']={'name':{'type':Sequelize[_0x5ef8('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5ef8('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x8ff7=['exports','STRING','sequelize'];(function(_0x4eec7c,_0x286448){var _0x479603=function(_0x1361a7){while(--_0x1361a7){_0x4eec7c['push'](_0x4eec7c['shift']());}};_0x479603(++_0x286448);}(_0x8ff7,0x143));var _0x78ff=function(_0x562a4c,_0x3f81cb){_0x562a4c=_0x562a4c-0x0;var _0x4ee543=_0x8ff7[_0x562a4c];return _0x4ee543;};'use strict';var Sequelize=require(_0x78ff('0x0'));module[_0x78ff('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x78ff('0x2')]},'interval':{'type':Sequelize[_0x78ff('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 7b9fa6b..4822fa5 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 _0xf366=['where','filters','pick','filter','merge','type','options','Interval','includeAll','include','findAll','catch','show','params','keys','find','body','user','role','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','rawAttributes','findOne','sequelize','transaction','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','update','destroy','get','Intervals','UserProfileResource','then','name','send','fieldName','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x45ea3c,_0x465a35){var _0x5bc6ba=function(_0x2c7ab9){while(--_0x2c7ab9){_0x45ea3c['push'](_0x45ea3c['shift']());}};_0x5bc6ba(++_0x465a35);}(_0xf366,0x1dd));var _0x6f36=function(_0x3a5276,_0x43ce45){_0x3a5276=_0x3a5276-0x0;var _0x293e8e=_0xf366[_0x3a5276];return _0x293e8e;};'use strict';var emlformat=require(_0x6f36('0x0'));var rimraf=require(_0x6f36('0x1'));var zipdir=require(_0x6f36('0x2'));var jsonpatch=require(_0x6f36('0x3'));var rp=require('request-promise');var moment=require(_0x6f36('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6f36('0x5'));var util=require(_0x6f36('0x6'));var path=require(_0x6f36('0x7'));var sox=require(_0x6f36('0x8'));var csv=require(_0x6f36('0x9'));var ejs=require(_0x6f36('0xa'));var fs=require('fs');var fs_extra=require(_0x6f36('0xb'));var _=require(_0x6f36('0xc'));var squel=require(_0x6f36('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6f36('0xe'));var toCsv=require(_0x6f36('0x9'));var querystring=require(_0x6f36('0xf'));var Papa=require(_0x6f36('0x10'));var Redis=require(_0x6f36('0x11'));var authService=require(_0x6f36('0x12'));var qs=require(_0x6f36('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f36('0x14'));var logger=require(_0x6f36('0x15'))(_0x6f36('0x16'));var utils=require(_0x6f36('0x17'));var config=require(_0x6f36('0x18'));var licenseUtil=require(_0x6f36('0x19'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0xc1fcc0,_0x1cf871){_0x1cf871=_0x1cf871||0xcc;return function(_0x4e6b93){if(_0x4e6b93){return _0xc1fcc0[_0x6f36('0x1a')](_0x1cf871);}return _0xc1fcc0[_0x6f36('0x1b')](_0x1cf871)[_0x6f36('0x1c')]();};}function respondWithResult(_0x2473d2,_0x3b453b){_0x3b453b=_0x3b453b||0xc8;return function(_0x4ef631){if(_0x4ef631){return _0x2473d2[_0x6f36('0x1b')](_0x3b453b)['json'](_0x4ef631);}};}function respondWithFilteredResult(_0x187771,_0x2510ef){return function(_0x3ccf20){if(_0x3ccf20){var _0x5be098=typeof _0x2510ef[_0x6f36('0x1d')]===_0x6f36('0x1e')&&typeof _0x2510ef[_0x6f36('0x1f')]==='undefined';var _0x77a7c0=_0x3ccf20[_0x6f36('0x20')];var _0x126282=_0x5be098?0x0:_0x2510ef['offset'];var _0x21b6f8=_0x5be098?_0x3ccf20[_0x6f36('0x20')]:_0x2510ef[_0x6f36('0x1d')]+_0x2510ef['limit'];var _0xef213;if(_0x21b6f8>=_0x77a7c0){_0x21b6f8=_0x77a7c0;_0xef213=0xc8;}else{_0xef213=0xce;}_0x187771['status'](_0xef213);return _0x187771[_0x6f36('0x21')]('Content-Range',_0x126282+'-'+_0x21b6f8+'/'+_0x77a7c0)[_0x6f36('0x22')](_0x3ccf20);}return null;};}function patchUpdates(_0x33cb22){return function(_0xf056dd){try{jsonpatch['apply'](_0xf056dd,_0x33cb22,!![]);}catch(_0x5a8434){return BPromise[_0x6f36('0x23')](_0x5a8434);}return _0xf056dd['save']();};}function saveUpdates(_0x4a3be0,_0x4a76c4){return function(_0x4151b9){if(_0x4151b9){return _0x4151b9[_0x6f36('0x24')](_0x4a3be0)['then'](function(_0x26b470){return _0x26b470;});}return null;};}function removeEntity(_0x30bed0,_0xa56d03){return function(_0x780bb3){if(_0x780bb3){return _0x780bb3[_0x6f36('0x25')]()['then'](function(){var _0x8d129f=_0x780bb3[_0x6f36('0x26')]({'plain':!![]});var _0xca19e8=_0x6f36('0x27');return db[_0x6f36('0x28')]['destroy']({'where':{'type':_0xca19e8,'resourceId':_0x8d129f['id']}})[_0x6f36('0x29')](function(){return _0x780bb3;});})['then'](function(){_0x30bed0[_0x6f36('0x1b')](0xcc)[_0x6f36('0x1c')]();});}};}function handleEntityNotFound(_0x3442c4,_0x482f15){return function(_0x4d8980){if(!_0x4d8980){_0x3442c4[_0x6f36('0x1a')](0x194);}return _0x4d8980;};}function handleError(_0x34397d,_0x20f9d8){_0x20f9d8=_0x20f9d8||0x1f4;return function(_0x4fcb61){logger['error'](_0x4fcb61['stack']);if(_0x4fcb61[_0x6f36('0x2a')]){delete _0x4fcb61[_0x6f36('0x2a')];}_0x34397d[_0x6f36('0x1b')](_0x20f9d8)[_0x6f36('0x2b')](_0x4fcb61);};}exports['index']=function(_0x5573fb,_0x573e6d){var _0x94ef11={},_0xc288fa={},_0x542c2e={'count':0x0,'rows':[]};var _0xb548ff=_['map'](db['Interval']['rawAttributes'],function(_0x4b9836){return{'name':_0x4b9836[_0x6f36('0x2c')],'type':_0x4b9836['type'][_0x6f36('0x2d')]};});_0xc288fa[_0x6f36('0x2e')]=_[_0x6f36('0x2f')](_0xb548ff,_0x6f36('0x2a'));_0xc288fa[_0x6f36('0x30')]=_['keys'](_0x5573fb[_0x6f36('0x30')]);_0xc288fa['filters']=_[_0x6f36('0x31')](_0xc288fa[_0x6f36('0x2e')],_0xc288fa[_0x6f36('0x30')]);_0x94ef11['attributes']=_[_0x6f36('0x31')](_0xc288fa[_0x6f36('0x2e')],qs[_0x6f36('0x32')](_0x5573fb[_0x6f36('0x30')][_0x6f36('0x32')]));_0x94ef11[_0x6f36('0x33')]=_0x94ef11[_0x6f36('0x33')][_0x6f36('0x34')]?_0x94ef11[_0x6f36('0x33')]:_0xc288fa[_0x6f36('0x2e')];if(!_0x5573fb[_0x6f36('0x30')][_0x6f36('0x35')](_0x6f36('0x36'))){_0x94ef11['limit']=qs[_0x6f36('0x1f')](_0x5573fb[_0x6f36('0x30')][_0x6f36('0x1f')]);_0x94ef11[_0x6f36('0x1d')]=qs[_0x6f36('0x1d')](_0x5573fb['query']['offset']);}_0x94ef11[_0x6f36('0x37')]=qs[_0x6f36('0x38')](_0x5573fb['query'][_0x6f36('0x38')]);_0x94ef11[_0x6f36('0x39')]=qs[_0x6f36('0x3a')](_[_0x6f36('0x3b')](_0x5573fb[_0x6f36('0x30')],_0xc288fa[_0x6f36('0x3a')]),_0xb548ff);if(_0x5573fb[_0x6f36('0x30')][_0x6f36('0x3c')]){_0x94ef11[_0x6f36('0x39')]=_[_0x6f36('0x3d')](_0x94ef11[_0x6f36('0x39')],{'$or':_[_0x6f36('0x2f')](_0xb548ff,function(_0x3b1061){if(_0x3b1061[_0x6f36('0x3e')]!=='VIRTUAL'){var _0x71bad2={};_0x71bad2[_0x3b1061[_0x6f36('0x2a')]]={'$like':'%'+_0x5573fb[_0x6f36('0x30')][_0x6f36('0x3c')]+'%'};return _0x71bad2;}})});}_0x94ef11=_[_0x6f36('0x3d')]({},_0x94ef11,_0x5573fb[_0x6f36('0x3f')]);var _0x5da005={'where':_0x94ef11[_0x6f36('0x39')]};return db[_0x6f36('0x40')][_0x6f36('0x20')](_0x5da005)[_0x6f36('0x29')](function(_0x148f9d){_0x542c2e[_0x6f36('0x20')]=_0x148f9d;if(_0x5573fb[_0x6f36('0x30')][_0x6f36('0x41')]){_0x94ef11[_0x6f36('0x42')]=[{'all':!![]}];}return db[_0x6f36('0x40')][_0x6f36('0x43')](_0x94ef11);})[_0x6f36('0x29')](function(_0x334a1e){_0x542c2e['rows']=_0x334a1e;return _0x542c2e;})['then'](respondWithFilteredResult(_0x573e6d,_0x94ef11))[_0x6f36('0x44')](handleError(_0x573e6d,null));};exports[_0x6f36('0x45')]=function(_0x17a454,_0x2ff7ed){var _0x4b202a={'raw':!![],'where':{'id':_0x17a454[_0x6f36('0x46')]['id']}},_0x43fb92={};_0x43fb92['model']=_[_0x6f36('0x47')](db[_0x6f36('0x40')]['rawAttributes']);_0x43fb92[_0x6f36('0x30')]=_[_0x6f36('0x47')](_0x17a454[_0x6f36('0x30')]);_0x43fb92[_0x6f36('0x3a')]=_['intersection'](_0x43fb92[_0x6f36('0x2e')],_0x43fb92[_0x6f36('0x30')]);_0x4b202a[_0x6f36('0x33')]=_['intersection'](_0x43fb92[_0x6f36('0x2e')],qs[_0x6f36('0x32')](_0x17a454[_0x6f36('0x30')][_0x6f36('0x32')]));_0x4b202a[_0x6f36('0x33')]=_0x4b202a[_0x6f36('0x33')]['length']?_0x4b202a['attributes']:_0x43fb92['model'];if(_0x17a454[_0x6f36('0x30')]['includeAll']){_0x4b202a[_0x6f36('0x42')]=[{'all':!![]}];}_0x4b202a=_['merge']({},_0x4b202a,_0x17a454['options']);return db[_0x6f36('0x40')][_0x6f36('0x48')](_0x4b202a)[_0x6f36('0x29')](handleEntityNotFound(_0x2ff7ed,null))[_0x6f36('0x29')](respondWithResult(_0x2ff7ed,null))['catch'](handleError(_0x2ff7ed,null));};exports['create']=function(_0x58522e,_0x276c37){return db[_0x6f36('0x40')]['create'](_0x58522e[_0x6f36('0x49')],{})[_0x6f36('0x29')](function(_0x53acfe){var _0x478a16=_0x58522e[_0x6f36('0x4a')][_0x6f36('0x26')]({'plain':!![]});if(!_0x478a16)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x478a16[_0x6f36('0x4b')]===_0x6f36('0x4a')){var _0x18026d=_0x53acfe['get']({'plain':!![]});var _0xd9a241=_0x6f36('0x27');return db[_0x6f36('0x4c')][_0x6f36('0x48')]({'where':{'name':_0xd9a241,'userProfileId':_0x478a16[_0x6f36('0x4d')]},'raw':!![]})['then'](function(_0xc5389b){if(_0xc5389b&&_0xc5389b[_0x6f36('0x4e')]===0x0){return db[_0x6f36('0x28')][_0x6f36('0x4f')]({'name':_0x18026d['name'],'resourceId':_0x18026d['id'],'type':_0xc5389b['name'],'sectionId':_0xc5389b['id']},{})['then'](function(){return _0x53acfe;});}else{return _0x53acfe;}})[_0x6f36('0x44')](function(_0x3e36b1){logger[_0x6f36('0x50')](_0x6f36('0x51'),_0x3e36b1);throw _0x3e36b1;});}return _0x53acfe;})[_0x6f36('0x29')](respondWithResult(_0x276c37,0xc9))[_0x6f36('0x44')](handleError(_0x276c37,null));};exports[_0x6f36('0x24')]=function(_0x3caa62,_0x1c7c48){if(_0x3caa62['body']['id']){delete _0x3caa62[_0x6f36('0x49')]['id'];}return db['Interval'][_0x6f36('0x48')]({'where':{'id':_0x3caa62['params']['id']}})[_0x6f36('0x29')](handleEntityNotFound(_0x1c7c48,null))[_0x6f36('0x29')](saveUpdates(_0x3caa62['body'],null))[_0x6f36('0x29')](respondWithResult(_0x1c7c48,null))[_0x6f36('0x44')](handleError(_0x1c7c48,null));};exports[_0x6f36('0x25')]=function(_0x33a3f7,_0x2e3156){return db[_0x6f36('0x40')]['find']({'where':{'id':_0x33a3f7[_0x6f36('0x46')]['id']}})[_0x6f36('0x29')](handleEntityNotFound(_0x2e3156,null))[_0x6f36('0x29')](removeEntity(_0x2e3156,null))[_0x6f36('0x44')](handleError(_0x2e3156,null));};exports[_0x6f36('0x52')]=function(_0x106337,_0x58e1a3,_0x5e31c3){if(_0x106337[_0x6f36('0x49')]['id']){delete _0x106337[_0x6f36('0x49')]['id'];}return db['Interval']['find']({'where':{'id':_0x106337[_0x6f36('0x46')]['id']}})['then'](handleEntityNotFound(_0x58e1a3,null))[_0x6f36('0x29')](function(_0x3bc4ef){if(_0x3bc4ef){_0x106337[_0x6f36('0x49')][_0x6f36('0x53')]=_0x3bc4ef['id'];return db[_0x6f36('0x40')][_0x6f36('0x4f')](_0x106337['body']);}})['then'](respondWithResult(_0x58e1a3,null))[_0x6f36('0x44')](handleError(_0x58e1a3,null));};exports[_0x6f36('0x54')]=function(_0x191ca4,_0x593a4c,_0x2f26a5){var _0x348470={};var _0x26268a={};var _0x5e70b7;var _0x2c1911;return db[_0x6f36('0x40')]['findOne']({'where':{'id':_0x191ca4[_0x6f36('0x46')]['id']}})[_0x6f36('0x29')](handleEntityNotFound(_0x593a4c,null))['then'](function(_0x54f66b){if(_0x54f66b){_0x5e70b7=_0x54f66b;_0x26268a['model']=_[_0x6f36('0x47')](db[_0x6f36('0x40')][_0x6f36('0x55')]);_0x26268a[_0x6f36('0x30')]=_[_0x6f36('0x47')](_0x191ca4[_0x6f36('0x30')]);_0x26268a[_0x6f36('0x3a')]=_['intersection'](_0x26268a[_0x6f36('0x2e')],_0x26268a[_0x6f36('0x30')]);_0x348470[_0x6f36('0x33')]=_[_0x6f36('0x31')](_0x26268a[_0x6f36('0x2e')],qs['fields'](_0x191ca4[_0x6f36('0x30')][_0x6f36('0x32')]));_0x348470[_0x6f36('0x33')]=_0x348470[_0x6f36('0x33')][_0x6f36('0x34')]?_0x348470[_0x6f36('0x33')]:_0x26268a[_0x6f36('0x2e')];_0x348470[_0x6f36('0x37')]=qs['sort'](_0x191ca4['query'][_0x6f36('0x38')]);_0x348470['where']=qs[_0x6f36('0x3a')](_[_0x6f36('0x3b')](_0x191ca4[_0x6f36('0x30')],_0x26268a['filters']));if(_0x191ca4[_0x6f36('0x30')][_0x6f36('0x3c')]){_0x348470[_0x6f36('0x39')]=_['merge'](_0x348470[_0x6f36('0x39')],{'$or':_[_0x6f36('0x2f')](_0x348470[_0x6f36('0x33')],function(_0x1147bb){var _0x54ca15={};_0x54ca15[_0x1147bb]={'$like':'%'+_0x191ca4[_0x6f36('0x30')][_0x6f36('0x3c')]+'%'};return _0x54ca15;})});}_0x348470=_[_0x6f36('0x3d')]({},_0x348470,_0x191ca4[_0x6f36('0x3f')]);return _0x5e70b7[_0x6f36('0x54')](_0x348470);}})['then'](function(_0x4024a5){if(_0x4024a5){_0x2c1911=_0x4024a5[_0x6f36('0x34')];if(!_0x191ca4[_0x6f36('0x30')]['hasOwnProperty']('nolimit')){_0x348470[_0x6f36('0x1f')]=qs[_0x6f36('0x1f')](_0x191ca4[_0x6f36('0x30')][_0x6f36('0x1f')]);_0x348470[_0x6f36('0x1d')]=qs['offset'](_0x191ca4[_0x6f36('0x30')][_0x6f36('0x1d')]);}return _0x5e70b7[_0x6f36('0x54')](_0x348470);}})[_0x6f36('0x29')](function(_0xa09d14){if(_0xa09d14){return _0xa09d14?{'count':_0x2c1911,'rows':_0xa09d14}:null;}})[_0x6f36('0x29')](respondWithResult(_0x593a4c,null))['catch'](handleError(_0x593a4c,null));};exports['addIntervals']=function(_0x4b250a,_0x4fc9df,_0x2f7e93){return db[_0x6f36('0x40')][_0x6f36('0x56')]({'where':{'id':_0x4b250a['params']['id']}})[_0x6f36('0x29')](handleEntityNotFound(_0x4fc9df,null))[_0x6f36('0x29')](function(_0x595020){if(_0x595020){return db[_0x6f36('0x57')][_0x6f36('0x58')](function(_0x69773a){return db[_0x6f36('0x40')]['destroy']({'where':{'IntervalId':_0x4b250a[_0x6f36('0x46')]['id']},'transaction':_0x69773a})[_0x6f36('0x29')](function(_0x4162bd){var _0x375dc5=_['map'](_0x4b250a[_0x6f36('0x49')],function(_0x5f5917){delete _0x5f5917['id'];_0x5f5917[_0x6f36('0x53')]=_0x4b250a[_0x6f36('0x46')]['id'];return _0x5f5917;});return db['Interval']['bulkCreate'](_0x375dc5,{'transaction':_0x69773a});});})['then'](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x4b250a['params']['id']}});});}})[_0x6f36('0x29')](respondWithResult(_0x4fc9df,null))['catch'](handleError(_0x4fc9df,null));}; \ No newline at end of file +var _0x2515=['hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','getIntervals','options','addIntervals','findOne','sequelize','transaction','bulkCreate','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','json','offset','undefined','count','limit','set','reject','save','update','then','get','Intervals','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x2515,0x7f));var _0x5251=function(_0x958e33,_0x573749){_0x958e33=_0x958e33-0x0;var _0x4b736d=_0x2515[_0x958e33];return _0x4b736d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5251('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5251('0x1'));var moment=require(_0x5251('0x2'));var BPromise=require(_0x5251('0x3'));var Mustache=require('mustache');var util=require(_0x5251('0x4'));var path=require(_0x5251('0x5'));var sox=require(_0x5251('0x6'));var csv=require(_0x5251('0x7'));var ejs=require(_0x5251('0x8'));var fs=require('fs');var fs_extra=require(_0x5251('0x9'));var _=require('lodash');var squel=require(_0x5251('0xa'));var crypto=require(_0x5251('0xb'));var jsforce=require(_0x5251('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5251('0x7'));var querystring=require(_0x5251('0xd'));var Papa=require(_0x5251('0xe'));var Redis=require(_0x5251('0xf'));var authService=require(_0x5251('0x10'));var qs=require(_0x5251('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5251('0x12'))(_0x5251('0x13'));var utils=require('../../config/utils');var config=require(_0x5251('0x14'));var licenseUtil=require(_0x5251('0x15'));var db=require(_0x5251('0x16'))['db'];var extensions=require(_0x5251('0x17'));function respondWithStatusCode(_0x444076,_0x111d92){_0x111d92=_0x111d92||0xcc;return function(_0x54ea7e){if(_0x54ea7e){return _0x444076['sendStatus'](_0x111d92);}return _0x444076[_0x5251('0x18')](_0x111d92)['end']();};}function respondWithResult(_0x3c91fb,_0x262d93){_0x262d93=_0x262d93||0xc8;return function(_0x2afc0a){if(_0x2afc0a){return _0x3c91fb[_0x5251('0x18')](_0x262d93)[_0x5251('0x19')](_0x2afc0a);}};}function respondWithFilteredResult(_0x1485f0,_0x128086){return function(_0x4528af){if(_0x4528af){var _0x284b13=typeof _0x128086[_0x5251('0x1a')]===_0x5251('0x1b')&&typeof _0x128086['limit']===_0x5251('0x1b');var _0xed5a8a=_0x4528af[_0x5251('0x1c')];var _0x12fec3=_0x284b13?0x0:_0x128086[_0x5251('0x1a')];var _0x112567=_0x284b13?_0x4528af[_0x5251('0x1c')]:_0x128086[_0x5251('0x1a')]+_0x128086[_0x5251('0x1d')];var _0x16225f;if(_0x112567>=_0xed5a8a){_0x112567=_0xed5a8a;_0x16225f=0xc8;}else{_0x16225f=0xce;}_0x1485f0[_0x5251('0x18')](_0x16225f);return _0x1485f0[_0x5251('0x1e')]('Content-Range',_0x12fec3+'-'+_0x112567+'/'+_0xed5a8a)[_0x5251('0x19')](_0x4528af);}return null;};}function patchUpdates(_0x34c74c){return function(_0x5b90a6){try{jsonpatch['apply'](_0x5b90a6,_0x34c74c,!![]);}catch(_0x30abe0){return BPromise[_0x5251('0x1f')](_0x30abe0);}return _0x5b90a6[_0x5251('0x20')]();};}function saveUpdates(_0x2fcf3c,_0x53823c){return function(_0x23e2ef){if(_0x23e2ef){return _0x23e2ef[_0x5251('0x21')](_0x2fcf3c)[_0x5251('0x22')](function(_0x90a63c){return _0x90a63c;});}return null;};}function removeEntity(_0xfb9919,_0x10a174){return function(_0xffb6e1){if(_0xffb6e1){return _0xffb6e1['destroy']()[_0x5251('0x22')](function(){var _0x35a0ce=_0xffb6e1[_0x5251('0x23')]({'plain':!![]});var _0x2d5a33=_0x5251('0x24');return db[_0x5251('0x25')][_0x5251('0x26')]({'where':{'type':_0x2d5a33,'resourceId':_0x35a0ce['id']}})[_0x5251('0x22')](function(){return _0xffb6e1;});})[_0x5251('0x22')](function(){_0xfb9919[_0x5251('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19802c,_0x5c78c5){return function(_0x65c920){if(!_0x65c920){_0x19802c[_0x5251('0x27')](0x194);}return _0x65c920;};}function handleError(_0x39ac5b,_0x537aa1){_0x537aa1=_0x537aa1||0x1f4;return function(_0x451db0){logger[_0x5251('0x28')](_0x451db0[_0x5251('0x29')]);if(_0x451db0[_0x5251('0x2a')]){delete _0x451db0[_0x5251('0x2a')];}_0x39ac5b[_0x5251('0x18')](_0x537aa1)[_0x5251('0x2b')](_0x451db0);};}exports[_0x5251('0x2c')]=function(_0x581b94,_0x39f196){var _0x1f6bea={},_0x1af882={},_0x591841={'count':0x0,'rows':[]};var _0x3a2786=_[_0x5251('0x2d')](db[_0x5251('0x2e')][_0x5251('0x2f')],function(_0x37cec6){return{'name':_0x37cec6[_0x5251('0x30')],'type':_0x37cec6[_0x5251('0x31')][_0x5251('0x32')]};});_0x1af882[_0x5251('0x33')]=_[_0x5251('0x2d')](_0x3a2786,_0x5251('0x2a'));_0x1af882[_0x5251('0x34')]=_[_0x5251('0x35')](_0x581b94[_0x5251('0x34')]);_0x1af882[_0x5251('0x36')]=_[_0x5251('0x37')](_0x1af882[_0x5251('0x33')],_0x1af882[_0x5251('0x34')]);_0x1f6bea[_0x5251('0x38')]=_[_0x5251('0x37')](_0x1af882[_0x5251('0x33')],qs['fields'](_0x581b94[_0x5251('0x34')][_0x5251('0x39')]));_0x1f6bea['attributes']=_0x1f6bea[_0x5251('0x38')][_0x5251('0x3a')]?_0x1f6bea[_0x5251('0x38')]:_0x1af882[_0x5251('0x33')];if(!_0x581b94[_0x5251('0x34')][_0x5251('0x3b')](_0x5251('0x3c'))){_0x1f6bea[_0x5251('0x1d')]=qs[_0x5251('0x1d')](_0x581b94['query'][_0x5251('0x1d')]);_0x1f6bea[_0x5251('0x1a')]=qs[_0x5251('0x1a')](_0x581b94['query'][_0x5251('0x1a')]);}_0x1f6bea[_0x5251('0x3d')]=qs[_0x5251('0x3e')](_0x581b94['query'][_0x5251('0x3e')]);_0x1f6bea[_0x5251('0x3f')]=qs[_0x5251('0x36')](_[_0x5251('0x40')](_0x581b94['query'],_0x1af882[_0x5251('0x36')]),_0x3a2786);if(_0x581b94[_0x5251('0x34')]['filter']){_0x1f6bea[_0x5251('0x3f')]=_[_0x5251('0x41')](_0x1f6bea[_0x5251('0x3f')],{'$or':_['map'](_0x3a2786,function(_0x1bd157){if(_0x1bd157['type']!=='VIRTUAL'){var _0x9b57f6={};_0x9b57f6[_0x1bd157['name']]={'$like':'%'+_0x581b94[_0x5251('0x34')][_0x5251('0x42')]+'%'};return _0x9b57f6;}})});}_0x1f6bea=_[_0x5251('0x41')]({},_0x1f6bea,_0x581b94['options']);var _0x270499={'where':_0x1f6bea['where']};return db[_0x5251('0x2e')]['count'](_0x270499)[_0x5251('0x22')](function(_0x244c25){_0x591841['count']=_0x244c25;if(_0x581b94[_0x5251('0x34')][_0x5251('0x43')]){_0x1f6bea[_0x5251('0x44')]=[{'all':!![]}];}return db[_0x5251('0x2e')][_0x5251('0x45')](_0x1f6bea);})[_0x5251('0x22')](function(_0x2c2a69){_0x591841[_0x5251('0x46')]=_0x2c2a69;return _0x591841;})['then'](respondWithFilteredResult(_0x39f196,_0x1f6bea))['catch'](handleError(_0x39f196,null));};exports[_0x5251('0x47')]=function(_0x4960a4,_0x1b3300){var _0x3c5816={'raw':!![],'where':{'id':_0x4960a4[_0x5251('0x48')]['id']}},_0x1014ab={};_0x1014ab[_0x5251('0x33')]=_[_0x5251('0x35')](db['Interval']['rawAttributes']);_0x1014ab[_0x5251('0x34')]=_[_0x5251('0x35')](_0x4960a4[_0x5251('0x34')]);_0x1014ab[_0x5251('0x36')]=_[_0x5251('0x37')](_0x1014ab[_0x5251('0x33')],_0x1014ab['query']);_0x3c5816[_0x5251('0x38')]=_['intersection'](_0x1014ab[_0x5251('0x33')],qs[_0x5251('0x39')](_0x4960a4[_0x5251('0x34')][_0x5251('0x39')]));_0x3c5816[_0x5251('0x38')]=_0x3c5816[_0x5251('0x38')]['length']?_0x3c5816['attributes']:_0x1014ab['model'];if(_0x4960a4[_0x5251('0x34')][_0x5251('0x43')]){_0x3c5816['include']=[{'all':!![]}];}_0x3c5816=_[_0x5251('0x41')]({},_0x3c5816,_0x4960a4['options']);return db[_0x5251('0x2e')][_0x5251('0x49')](_0x3c5816)[_0x5251('0x22')](handleEntityNotFound(_0x1b3300,null))['then'](respondWithResult(_0x1b3300,null))[_0x5251('0x4a')](handleError(_0x1b3300,null));};exports[_0x5251('0x4b')]=function(_0x5dd286,_0x5b8bc0){return db[_0x5251('0x2e')][_0x5251('0x4b')](_0x5dd286['body'],{})['then'](function(_0x3634e0){var _0xbd02f3=_0x5dd286[_0x5251('0x4c')][_0x5251('0x23')]({'plain':!![]});if(!_0xbd02f3)throw new Error(_0x5251('0x4d'));if(_0xbd02f3[_0x5251('0x4e')]===_0x5251('0x4c')){var _0x45996f=_0x3634e0[_0x5251('0x23')]({'plain':!![]});var _0x1e569d=_0x5251('0x24');return db[_0x5251('0x4f')]['find']({'where':{'name':_0x1e569d,'userProfileId':_0xbd02f3[_0x5251('0x50')]},'raw':!![]})[_0x5251('0x22')](function(_0x8a662b){if(_0x8a662b&&_0x8a662b[_0x5251('0x51')]===0x0){return db[_0x5251('0x25')][_0x5251('0x4b')]({'name':_0x45996f[_0x5251('0x2a')],'resourceId':_0x45996f['id'],'type':_0x8a662b['name'],'sectionId':_0x8a662b['id']},{})[_0x5251('0x22')](function(){return _0x3634e0;});}else{return _0x3634e0;}})[_0x5251('0x4a')](function(_0x43cf37){logger[_0x5251('0x28')](_0x5251('0x52'),_0x43cf37);throw _0x43cf37;});}return _0x3634e0;})[_0x5251('0x22')](respondWithResult(_0x5b8bc0,0xc9))[_0x5251('0x4a')](handleError(_0x5b8bc0,null));};exports[_0x5251('0x21')]=function(_0x2f6beb,_0x5a1896){if(_0x2f6beb['body']['id']){delete _0x2f6beb[_0x5251('0x53')]['id'];}return db[_0x5251('0x2e')][_0x5251('0x49')]({'where':{'id':_0x2f6beb['params']['id']}})[_0x5251('0x22')](handleEntityNotFound(_0x5a1896,null))[_0x5251('0x22')](saveUpdates(_0x2f6beb[_0x5251('0x53')],null))[_0x5251('0x22')](respondWithResult(_0x5a1896,null))[_0x5251('0x4a')](handleError(_0x5a1896,null));};exports[_0x5251('0x26')]=function(_0xe92b,_0x48e338){return db['Interval']['find']({'where':{'id':_0xe92b[_0x5251('0x48')]['id']}})[_0x5251('0x22')](handleEntityNotFound(_0x48e338,null))[_0x5251('0x22')](removeEntity(_0x48e338,null))['catch'](handleError(_0x48e338,null));};exports[_0x5251('0x54')]=function(_0x4234d9,_0x58c88c,_0x37966c){if(_0x4234d9[_0x5251('0x53')]['id']){delete _0x4234d9[_0x5251('0x53')]['id'];}return db[_0x5251('0x2e')]['find']({'where':{'id':_0x4234d9[_0x5251('0x48')]['id']}})['then'](handleEntityNotFound(_0x58c88c,null))[_0x5251('0x22')](function(_0x2e49e3){if(_0x2e49e3){_0x4234d9[_0x5251('0x53')][_0x5251('0x55')]=_0x2e49e3['id'];return db[_0x5251('0x2e')][_0x5251('0x4b')](_0x4234d9['body']);}})[_0x5251('0x22')](respondWithResult(_0x58c88c,null))['catch'](handleError(_0x58c88c,null));};exports[_0x5251('0x56')]=function(_0x42972c,_0x4c3783,_0x46ed52){var _0x3ed9b9={};var _0x4c767={};var _0x78657e;var _0x314b87;return db[_0x5251('0x2e')]['findOne']({'where':{'id':_0x42972c['params']['id']}})['then'](handleEntityNotFound(_0x4c3783,null))[_0x5251('0x22')](function(_0x58329d){if(_0x58329d){_0x78657e=_0x58329d;_0x4c767[_0x5251('0x33')]=_[_0x5251('0x35')](db[_0x5251('0x2e')][_0x5251('0x2f')]);_0x4c767[_0x5251('0x34')]=_[_0x5251('0x35')](_0x42972c[_0x5251('0x34')]);_0x4c767['filters']=_[_0x5251('0x37')](_0x4c767[_0x5251('0x33')],_0x4c767['query']);_0x3ed9b9[_0x5251('0x38')]=_[_0x5251('0x37')](_0x4c767['model'],qs[_0x5251('0x39')](_0x42972c[_0x5251('0x34')][_0x5251('0x39')]));_0x3ed9b9[_0x5251('0x38')]=_0x3ed9b9['attributes']['length']?_0x3ed9b9['attributes']:_0x4c767[_0x5251('0x33')];_0x3ed9b9[_0x5251('0x3d')]=qs[_0x5251('0x3e')](_0x42972c[_0x5251('0x34')][_0x5251('0x3e')]);_0x3ed9b9[_0x5251('0x3f')]=qs[_0x5251('0x36')](_[_0x5251('0x40')](_0x42972c['query'],_0x4c767['filters']));if(_0x42972c[_0x5251('0x34')][_0x5251('0x42')]){_0x3ed9b9['where']=_[_0x5251('0x41')](_0x3ed9b9[_0x5251('0x3f')],{'$or':_[_0x5251('0x2d')](_0x3ed9b9[_0x5251('0x38')],function(_0x28c7b0){var _0x44b7bc={};_0x44b7bc[_0x28c7b0]={'$like':'%'+_0x42972c['query'][_0x5251('0x42')]+'%'};return _0x44b7bc;})});}_0x3ed9b9=_[_0x5251('0x41')]({},_0x3ed9b9,_0x42972c[_0x5251('0x57')]);return _0x78657e[_0x5251('0x56')](_0x3ed9b9);}})[_0x5251('0x22')](function(_0x207675){if(_0x207675){_0x314b87=_0x207675[_0x5251('0x3a')];if(!_0x42972c[_0x5251('0x34')][_0x5251('0x3b')](_0x5251('0x3c'))){_0x3ed9b9[_0x5251('0x1d')]=qs['limit'](_0x42972c[_0x5251('0x34')][_0x5251('0x1d')]);_0x3ed9b9[_0x5251('0x1a')]=qs[_0x5251('0x1a')](_0x42972c[_0x5251('0x34')][_0x5251('0x1a')]);}return _0x78657e[_0x5251('0x56')](_0x3ed9b9);}})[_0x5251('0x22')](function(_0x1f40d1){if(_0x1f40d1){return _0x1f40d1?{'count':_0x314b87,'rows':_0x1f40d1}:null;}})[_0x5251('0x22')](respondWithResult(_0x4c3783,null))[_0x5251('0x4a')](handleError(_0x4c3783,null));};exports[_0x5251('0x58')]=function(_0x1364ce,_0x466a35,_0x282180){return db['Interval'][_0x5251('0x59')]({'where':{'id':_0x1364ce[_0x5251('0x48')]['id']}})[_0x5251('0x22')](handleEntityNotFound(_0x466a35,null))['then'](function(_0x21db17){if(_0x21db17){return db[_0x5251('0x5a')][_0x5251('0x5b')](function(_0x5a543b){return db[_0x5251('0x2e')]['destroy']({'where':{'IntervalId':_0x1364ce[_0x5251('0x48')]['id']},'transaction':_0x5a543b})[_0x5251('0x22')](function(_0x871d1e){var _0xb3e33c=_['map'](_0x1364ce[_0x5251('0x53')],function(_0x1ba994){delete _0x1ba994['id'];_0x1ba994['IntervalId']=_0x1364ce[_0x5251('0x48')]['id'];return _0x1ba994;});return db[_0x5251('0x2e')][_0x5251('0x5c')](_0xb3e33c,{'transaction':_0x5a543b});});})[_0x5251('0x22')](function(){return db[_0x5251('0x2e')][_0x5251('0x45')]({'where':{'IntervalId':_0x1364ce['params']['id']}});});}})[_0x5251('0x22')](respondWithResult(_0x466a35,null))['catch'](handleError(_0x466a35,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index a098a71..e7a689e 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 _0x1377=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','exports','Interval','rewrite','lodash','util','../../config/logger'];(function(_0x260f96,_0xef220c){var _0x4cb97b=function(_0x14c5ce){while(--_0x14c5ce){_0x260f96['push'](_0x260f96['shift']());}};_0x4cb97b(++_0xef220c);}(_0x1377,0x101));var _0x7137=function(_0xf81ab2,_0x347423){_0xf81ab2=_0xf81ab2-0x0;var _0x4dd0ff=_0x1377[_0xf81ab2];return _0x4dd0ff;};'use strict';var _=require(_0x7137('0x0'));var util=require(_0x7137('0x1'));var logger=require(_0x7137('0x2'))('api');var moment=require(_0x7137('0x3'));var BPromise=require(_0x7137('0x4'));var rp=require(_0x7137('0x5'));var fs=require('fs');var path=require(_0x7137('0x6'));var rimraf=require(_0x7137('0x7'));var config=require(_0x7137('0x8'));var attributes=require(_0x7137('0x9'));var extensions=require('../../components/extensions/rewrite');module[_0x7137('0xa')]=function(_0x1fca09,_0x429ddf){return _0x1fca09['define'](_0x7137('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5bf077,_0x21be16){extensions[_0x7137('0xc')](_0x1fca09,_0x5bf077);},'afterBulkCreate':function(_0x2425ac,_0x52dfee,_0x4f82ba){_0x4f82ba();extensions[_0x7137('0xc')](_0x1fca09,_0x2425ac[0x0]);},'afterUpdate':function(_0x1d628c,_0x168d96){extensions['rewrite'](_0x1fca09,_0x1d628c);},'afterDestroy':function(_0x5a772d,_0x18861c){extensions[_0x7137('0xc')](_0x1fca09,_0x5a772d);}}});}; \ No newline at end of file +var _0xecc5=['define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite'];(function(_0x28c76e,_0x4e57c){var _0x4d03b0=function(_0x4836a2){while(--_0x4836a2){_0x28c76e['push'](_0x28c76e['shift']());}};_0x4d03b0(++_0x4e57c);}(_0xecc5,0x16c));var _0x5ecc=function(_0xa266ff,_0x228ea6){_0xa266ff=_0xa266ff-0x0;var _0x5e18d1=_0xecc5[_0xa266ff];return _0x5e18d1;};'use strict';var _=require(_0x5ecc('0x0'));var util=require(_0x5ecc('0x1'));var logger=require(_0x5ecc('0x2'))(_0x5ecc('0x3'));var moment=require(_0x5ecc('0x4'));var BPromise=require(_0x5ecc('0x5'));var rp=require(_0x5ecc('0x6'));var fs=require('fs');var path=require(_0x5ecc('0x7'));var rimraf=require('rimraf');var config=require(_0x5ecc('0x8'));var attributes=require(_0x5ecc('0x9'));var extensions=require(_0x5ecc('0xa'));module['exports']=function(_0x421c23,_0x495429){return _0x421c23[_0x5ecc('0xb')](_0x5ecc('0xc'),attributes,{'tableName':_0x5ecc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x107ad3,_0x58532c){extensions[_0x5ecc('0xe')](_0x421c23,_0x107ad3);},'afterBulkCreate':function(_0x5eb274,_0xf30b04,_0x1ac2b7){_0x1ac2b7();extensions[_0x5ecc('0xe')](_0x421c23,_0x5eb274[0x0]);},'afterUpdate':function(_0x20b40e,_0x480332){extensions['rewrite'](_0x421c23,_0x20b40e);},'afterDestroy':function(_0x121f56,_0x52d5ff){extensions[_0x5ecc('0xe')](_0x421c23,_0x121f56);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index f43baab..538c390 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_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);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 5a93c54..f565f2a 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(_0x1d061e,_0x3c68c7){var _0x5aa7aa=function(_0x4b1ae1){while(--_0x4b1ae1){_0x1d061e['push'](_0x1d061e['shift']());}};_0x5aa7aa(++_0x3c68c7);}(_0xdb28,0x106));var _0x8db2=function(_0x4276d0,_0x5201cb){_0x4276d0=_0x4276d0-0x0;var _0x159dda=_0xdb28[_0x4276d0];return _0x159dda;};'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 _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x0b0e,0x187));var _0xe0b0=function(_0x35c2fc,_0xabea37){_0x35c2fc=_0x35c2fc-0x0;var _0x4727fd=_0x0b0e[_0x35c2fc];return _0x4727fd;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 3373c73..920ff93 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 _0xabbf=['description','stringify','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','base64','setEncoding','utf8','data','statusCode','parse','status','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','../../config/logger','3eAmWpBVP0','Report','\x20from\x20'];(function(_0x4214d3,_0xfcc2b1){var _0x3385f3=function(_0x43d181){while(--_0x43d181){_0x4214d3['push'](_0x4214d3['shift']());}};_0x3385f3(++_0xfcc2b1);}(_0xabbf,0xcc));var _0xfabb=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0xabbf[_0x3712e2];return _0x1faff4;};'use strict';var BPromise=require(_0xfabb('0x0'));var https=require(_0xfabb('0x1'));var logger=require(_0xfabb('0x2'))('api');var USERNAME='support';var PASSWORD=_0xfabb('0x3');function openIssue(_0x170423,_0x261608){var _0x121a4a={'fields':{'project':{'key':_0x170423['key']||'MOTGUI'},'summary':(_0x170423['summary']||_0xfabb('0x4'))+_0xfabb('0x5')+_0x170423['ip'],'description':_0x170423[_0xfabb('0x6')]||JSON[_0xfabb('0x7')](_0x170423),'issuetype':{'name':_0x170423[_0xfabb('0x8')]||'Bug'}}};_0x121a4a[_0xfabb('0x9')][_0xfabb('0xa')]=_0x170423[_0xfabb('0xb')];_0x121a4a['fields'][_0xfabb('0xc')]=_0x170423[_0xfabb('0xd')];_0x121a4a[_0xfabb('0x9')]['customfield_11502']=_0x170423['newToken'];_0x121a4a[_0xfabb('0x9')]['customfield_11503']=_0x170423[_0xfabb('0xe')];_0x121a4a[_0xfabb('0x9')][_0xfabb('0xf')]=_0x170423[_0xfabb('0x10')];_0x121a4a[_0xfabb('0x9')][_0xfabb('0x11')]=_0x170423['ip'];var _0x11f350={'host':_0xfabb('0x12'),'port':0x1bb,'path':_0xfabb('0x13'),'method':_0xfabb('0x14'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xfabb('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0xfabb('0x16')](_0xfabb('0x17'))}};var _0x5d9753=JSON[_0xfabb('0x7')](_0x121a4a);var _0x4ab50c=https['request'](_0x11f350,function(_0x1bc2d7){_0x1bc2d7[_0xfabb('0x18')](_0xfabb('0x19'));var _0x245b09='';_0x1bc2d7['on'](_0xfabb('0x1a'),function(_0x3ee952){_0x245b09+=_0x3ee952;});_0x1bc2d7['on']('end',function(){if(_0x261608){return _0x261608['status'](_0x1bc2d7[_0xfabb('0x1b')])['json'](JSON[_0xfabb('0x1c')](_0x245b09));}});});_0x4ab50c['on']('error',function(_0x1a4916){if(_0x261608){return _0x261608[_0xfabb('0x1d')](0x1f4)[_0xfabb('0x1e')]({'errors':[{'message':_0xfabb('0x1f'),'type':_0xfabb('0x20')}]});}});_0x4ab50c[_0xfabb('0x21')](_0x5d9753);_0x4ab50c['end']();}exports[_0xfabb('0x22')]=openIssue;exports[_0xfabb('0x23')]=function(_0x36b0a3,_0x22b3c0){_0x36b0a3[_0xfabb('0x24')]['ip']=_0x36b0a3[_0xfabb('0x25')][_0xfabb('0x26')]||_0x36b0a3['connection'][_0xfabb('0x27')]||_0x36b0a3[_0xfabb('0x28')]['remoteAddress']||_0x36b0a3[_0xfabb('0x29')][_0xfabb('0x28')][_0xfabb('0x27')];return openIssue(_0x36b0a3[_0xfabb('0x24')],_0x22b3c0);}; \ No newline at end of file +var _0xa7bd=['headers','x-forwarded-for','connection','remoteAddress','socket','../../config/logger','api','support','key','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','customfield_11501','oldToken','fields','customfield_11502','newToken','name','customfield_11504','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','utf8','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','body'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0xa7bd,0x1a9));var _0xda7b=function(_0xee5d2a,_0x534134){_0xee5d2a=_0xee5d2a-0x0;var _0x346948=_0xa7bd[_0xee5d2a];return _0x346948;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0xda7b('0x0'))(_0xda7b('0x1'));var USERNAME=_0xda7b('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x3c1016,_0x4a07df){var _0x5c8d61={'fields':{'project':{'key':_0x3c1016[_0xda7b('0x3')]||'MOTGUI'},'summary':(_0x3c1016[_0xda7b('0x4')]||_0xda7b('0x5'))+_0xda7b('0x6')+_0x3c1016['ip'],'description':_0x3c1016[_0xda7b('0x7')]||JSON[_0xda7b('0x8')](_0x3c1016),'issuetype':{'name':_0x3c1016[_0xda7b('0x9')]||_0xda7b('0xa')}}};_0x5c8d61['fields']['customfield_11500']=_0x3c1016['email'];_0x5c8d61['fields'][_0xda7b('0xb')]=_0x3c1016[_0xda7b('0xc')];_0x5c8d61[_0xda7b('0xd')][_0xda7b('0xe')]=_0x3c1016[_0xda7b('0xf')];_0x5c8d61['fields']['customfield_11503']=_0x3c1016[_0xda7b('0x10')];_0x5c8d61[_0xda7b('0xd')][_0xda7b('0x11')]=_0x3c1016['reason'];_0x5c8d61[_0xda7b('0xd')]['customfield_10102']=_0x3c1016['ip'];var _0x463228={'host':_0xda7b('0x12'),'port':0x1bb,'path':_0xda7b('0x13'),'method':_0xda7b('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xda7b('0x15'),'Authorization':_0xda7b('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xda7b('0x17')](_0xda7b('0x18'))}};var _0x28668d=JSON['stringify'](_0x5c8d61);var _0x286a3b=https['request'](_0x463228,function(_0x7d4be0){_0x7d4be0['setEncoding'](_0xda7b('0x19'));var _0x8d719a='';_0x7d4be0['on']('data',function(_0x33d05d){_0x8d719a+=_0x33d05d;});_0x7d4be0['on'](_0xda7b('0x1a'),function(){if(_0x4a07df){return _0x4a07df[_0xda7b('0x1b')](_0x7d4be0[_0xda7b('0x1c')])[_0xda7b('0x1d')](JSON[_0xda7b('0x1e')](_0x8d719a));}});});_0x286a3b['on'](_0xda7b('0x1f'),function(_0x34d83f){if(_0x4a07df){return _0x4a07df[_0xda7b('0x1b')](0x1f4)['json']({'errors':[{'message':_0xda7b('0x20'),'type':_0xda7b('0x21')}]});}});_0x286a3b[_0xda7b('0x22')](_0x28668d);_0x286a3b[_0xda7b('0x1a')]();}exports['openIssue']=openIssue;exports[_0xda7b('0x23')]=function(_0x4d7814,_0x2ba988){_0x4d7814[_0xda7b('0x24')]['ip']=_0x4d7814[_0xda7b('0x25')][_0xda7b('0x26')]||_0x4d7814[_0xda7b('0x27')][_0xda7b('0x28')]||_0x4d7814[_0xda7b('0x29')]['remoteAddress']||_0x4d7814[_0xda7b('0x27')][_0xda7b('0x29')][_0xda7b('0x28')];return openIssue(_0x4d7814[_0xda7b('0x24')],_0x2ba988);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index d3ba8a6..ea2a331 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 _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x42f6e8,_0x5295ca){var _0x535ec0=function(_0x152021){while(--_0x152021){_0x42f6e8['push'](_0x42f6e8['shift']());}};_0x535ec0(++_0x5295ca);}(_0xe706,0xa3));var _0x6e70=function(_0x1dc2b4,_0x573a04){_0x1dc2b4=_0x1dc2b4-0x0;var _0x18af92=_0xe706[_0x1dc2b4];return _0x18af92;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','show','post'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index da0d774..44843cb 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(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7a54,0x106));var _0x47a5=function(_0x355798,_0x4887c7){_0x355798=_0x355798-0x0;var _0x1d9da7=_0x7a54[_0x355798];return _0x1d9da7;};'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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7a54,0x106));var _0x47a5=function(_0x1c2c3a,_0x1b0cdc){_0x1c2c3a=_0x1c2c3a-0x0;var _0x4ed9a2=_0x7a54[_0x1c2c3a];return _0x4ed9a2;};'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 77cd847..ae2abbb 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 _0x4e83=['fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','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','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x4e83,0x1ae));var _0x34e8=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0x4e83[_0x38b2d9];return _0x23a3e1;};'use strict';var emlformat=require(_0x34e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x34e8('0x1'));var jsonpatch=require(_0x34e8('0x2'));var rp=require(_0x34e8('0x3'));var moment=require(_0x34e8('0x4'));var BPromise=require(_0x34e8('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x34e8('0x6'));var ejs=require(_0x34e8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34e8('0x8'));var squel=require(_0x34e8('0x9'));var crypto=require(_0x34e8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x34e8('0xb'));var toCsv=require(_0x34e8('0x6'));var querystring=require(_0x34e8('0xc'));var Papa=require('papaparse');var Redis=require(_0x34e8('0xd'));var authService=require(_0x34e8('0xe'));var qs=require(_0x34e8('0xf'));var as=require(_0x34e8('0x10'));var hardwareService=require(_0x34e8('0x11'));var logger=require(_0x34e8('0x12'))(_0x34e8('0x13'));var utils=require(_0x34e8('0x14'));var config=require(_0x34e8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x34e8('0x16'))['db'];function respondWithStatusCode(_0x60b6b6,_0x516f49){_0x516f49=_0x516f49||0xcc;return function(_0x6454fd){if(_0x6454fd){return _0x60b6b6[_0x34e8('0x17')](_0x516f49);}return _0x60b6b6[_0x34e8('0x18')](_0x516f49)[_0x34e8('0x19')]();};}function respondWithResult(_0xc4ac78,_0x70f65a){_0x70f65a=_0x70f65a||0xc8;return function(_0x21f234){if(_0x21f234){return _0xc4ac78[_0x34e8('0x18')](_0x70f65a)[_0x34e8('0x1a')](_0x21f234);}};}function respondWithFilteredResult(_0x4c516a,_0xeb505){return function(_0x4447d3){if(_0x4447d3){var _0x36adfb=typeof _0xeb505[_0x34e8('0x1b')]===_0x34e8('0x1c')&&typeof _0xeb505['limit']===_0x34e8('0x1c');var _0x37b6ae=_0x4447d3[_0x34e8('0x1d')];var _0x708dd4=_0x36adfb?0x0:_0xeb505[_0x34e8('0x1b')];var _0x11543c=_0x36adfb?_0x4447d3[_0x34e8('0x1d')]:_0xeb505[_0x34e8('0x1b')]+_0xeb505[_0x34e8('0x1e')];var _0x19b9a4;if(_0x11543c>=_0x37b6ae){_0x11543c=_0x37b6ae;_0x19b9a4=0xc8;}else{_0x19b9a4=0xce;}_0x4c516a[_0x34e8('0x18')](_0x19b9a4);return _0x4c516a['set'](_0x34e8('0x1f'),_0x708dd4+'-'+_0x11543c+'/'+_0x37b6ae)[_0x34e8('0x1a')](_0x4447d3);}return null;};}function patchUpdates(_0xe42e15){return function(_0x8ecd4c){try{jsonpatch[_0x34e8('0x20')](_0x8ecd4c,_0xe42e15,!![]);}catch(_0x188055){return BPromise[_0x34e8('0x21')](_0x188055);}return _0x8ecd4c[_0x34e8('0x22')]();};}function saveUpdates(_0x4967f4,_0xc9fb93){return function(_0x20c7d3){if(_0x20c7d3){return _0x20c7d3['update'](_0x4967f4)[_0x34e8('0x23')](function(_0x592c0e){return _0x592c0e;});}return null;};}function removeEntity(_0x300b94,_0x381d0e){return function(_0x43c689){if(_0x43c689){return _0x43c689['destroy']()['then'](function(){_0x300b94[_0x34e8('0x18')](0xcc)[_0x34e8('0x19')]();});}};}function handleEntityNotFound(_0xb8c9f,_0x2dad57){return function(_0x2e29fb){if(!_0x2e29fb){_0xb8c9f[_0x34e8('0x17')](0x194);}return _0x2e29fb;};}function handleError(_0x31d68a,_0x5c93e5){_0x5c93e5=_0x5c93e5||0x1f4;return function(_0x29be75){logger[_0x34e8('0x24')](_0x29be75[_0x34e8('0x25')]);if(_0x29be75[_0x34e8('0x26')]){delete _0x29be75[_0x34e8('0x26')];}_0x31d68a[_0x34e8('0x18')](_0x5c93e5)[_0x34e8('0x27')](_0x29be75);};}exports[_0x34e8('0x28')]=function(_0x2b445a,_0x18490b){var _0x3f5421={},_0x6f4428={},_0x1df399={'count':0x0,'rows':[]};var _0x1e0d5e=_[_0x34e8('0x29')](db[_0x34e8('0x2a')][_0x34e8('0x2b')],function(_0x5c20db){return{'name':_0x5c20db[_0x34e8('0x2c')],'type':_0x5c20db[_0x34e8('0x2d')]['key']};});_0x6f4428[_0x34e8('0x2e')]=_[_0x34e8('0x29')](_0x1e0d5e,_0x34e8('0x26'));_0x6f4428[_0x34e8('0x2f')]=_[_0x34e8('0x30')](_0x2b445a[_0x34e8('0x2f')]);_0x6f4428[_0x34e8('0x31')]=_[_0x34e8('0x32')](_0x6f4428[_0x34e8('0x2e')],_0x6f4428[_0x34e8('0x2f')]);_0x3f5421[_0x34e8('0x33')]=_[_0x34e8('0x32')](_0x6f4428[_0x34e8('0x2e')],qs[_0x34e8('0x34')](_0x2b445a[_0x34e8('0x2f')][_0x34e8('0x34')]));_0x3f5421[_0x34e8('0x33')]=_0x3f5421['attributes'][_0x34e8('0x35')]?_0x3f5421[_0x34e8('0x33')]:_0x6f4428['model'];if(!_0x2b445a[_0x34e8('0x2f')][_0x34e8('0x36')](_0x34e8('0x37'))){_0x3f5421[_0x34e8('0x1e')]=qs[_0x34e8('0x1e')](_0x2b445a[_0x34e8('0x2f')][_0x34e8('0x1e')]);_0x3f5421['offset']=qs['offset'](_0x2b445a[_0x34e8('0x2f')][_0x34e8('0x1b')]);}_0x3f5421[_0x34e8('0x38')]=qs['sort'](_0x2b445a[_0x34e8('0x2f')][_0x34e8('0x39')]);_0x3f5421[_0x34e8('0x3a')]=qs[_0x34e8('0x31')](_[_0x34e8('0x3b')](_0x2b445a[_0x34e8('0x2f')],_0x6f4428[_0x34e8('0x31')]),_0x1e0d5e);if(_0x2b445a[_0x34e8('0x2f')]['filter']){_0x3f5421[_0x34e8('0x3a')]=_[_0x34e8('0x3c')](_0x3f5421[_0x34e8('0x3a')],{'$or':_['map'](_0x1e0d5e,function(_0x1caf4b){if(_0x1caf4b[_0x34e8('0x2d')]!=='VIRTUAL'){var _0x5d7ff7={};_0x5d7ff7[_0x1caf4b[_0x34e8('0x26')]]={'$like':'%'+_0x2b445a[_0x34e8('0x2f')]['filter']+'%'};return _0x5d7ff7;}})});}_0x3f5421=_[_0x34e8('0x3c')]({},_0x3f5421,_0x2b445a[_0x34e8('0x3d')]);var _0x29fb22={'where':_0x3f5421[_0x34e8('0x3a')]};return db[_0x34e8('0x2a')][_0x34e8('0x1d')](_0x29fb22)[_0x34e8('0x23')](function(_0x1221e2){_0x1df399[_0x34e8('0x1d')]=_0x1221e2;if(_0x2b445a['query']['includeAll']){_0x3f5421[_0x34e8('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x34e8('0x3f')](_0x3f5421);})[_0x34e8('0x23')](function(_0x29d2fb){_0x1df399[_0x34e8('0x40')]=_0x29d2fb;return _0x1df399;})['then'](respondWithFilteredResult(_0x18490b,_0x3f5421))[_0x34e8('0x41')](handleError(_0x18490b,null));};exports[_0x34e8('0x42')]=function(_0x18a158,_0x91a70f){var _0xb00838={'raw':!![],'where':{'id':_0x18a158[_0x34e8('0x43')]['id']}},_0x58b74f={};_0x58b74f['model']=_[_0x34e8('0x30')](db[_0x34e8('0x2a')]['rawAttributes']);_0x58b74f[_0x34e8('0x2f')]=_[_0x34e8('0x30')](_0x18a158[_0x34e8('0x2f')]);_0x58b74f[_0x34e8('0x31')]=_['intersection'](_0x58b74f[_0x34e8('0x2e')],_0x58b74f[_0x34e8('0x2f')]);_0xb00838['attributes']=_['intersection'](_0x58b74f[_0x34e8('0x2e')],qs['fields'](_0x18a158[_0x34e8('0x2f')]['fields']));_0xb00838[_0x34e8('0x33')]=_0xb00838[_0x34e8('0x33')]['length']?_0xb00838[_0x34e8('0x33')]:_0x58b74f['model'];if(_0x18a158[_0x34e8('0x2f')]['includeAll']){_0xb00838[_0x34e8('0x3e')]=[{'all':!![]}];}_0xb00838=_[_0x34e8('0x3c')]({},_0xb00838,_0x18a158[_0x34e8('0x3d')]);return db[_0x34e8('0x2a')][_0x34e8('0x44')](_0xb00838)['then'](handleEntityNotFound(_0x91a70f,null))['then'](respondWithResult(_0x91a70f,null))[_0x34e8('0x41')](handleError(_0x91a70f,null));};exports[_0x34e8('0x45')]=function(_0x49a755,_0x1cc23c){return db[_0x34e8('0x2a')][_0x34e8('0x45')](_0x49a755['body'],{})[_0x34e8('0x23')](respondWithResult(_0x1cc23c,0xc9))[_0x34e8('0x41')](handleError(_0x1cc23c,null));};exports['update']=function(_0x51a814,_0x2de2e9){if(_0x51a814['body']['id']){delete _0x51a814[_0x34e8('0x46')]['id'];}return db[_0x34e8('0x2a')][_0x34e8('0x44')]({'where':{'id':_0x51a814[_0x34e8('0x43')]['id']}})[_0x34e8('0x23')](handleEntityNotFound(_0x2de2e9,null))[_0x34e8('0x23')](saveUpdates(_0x51a814[_0x34e8('0x46')],null))[_0x34e8('0x23')](respondWithResult(_0x2de2e9,null))[_0x34e8('0x41')](handleError(_0x2de2e9,null));};exports['destroy']=function(_0x5a1a1e,_0x345e83){return db[_0x34e8('0x2a')][_0x34e8('0x44')]({'where':{'id':_0x5a1a1e[_0x34e8('0x43')]['id']}})[_0x34e8('0x23')](handleEntityNotFound(_0x345e83,null))[_0x34e8('0x23')](removeEntity(_0x345e83,null))[_0x34e8('0x41')](handleError(_0x345e83,null));};exports[_0x34e8('0x47')]=function(_0x2b70a7,_0x4bf30e){return db['JscriptyAnswerReport'][_0x34e8('0x47')]()[_0x34e8('0x23')](respondWithResult(_0x4bf30e,null))[_0x34e8('0x41')](handleError(_0x4bf30e,null));}; \ No newline at end of file +var _0x96aa=['attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../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','then','destroy','stack','name','send','map','JscriptyAnswerReport','fieldName','type','key','model','query','filters','intersection'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x96aa,0x67));var _0xa96a=function(_0x1ec252,_0xa9782f){_0x1ec252=_0x1ec252-0x0;var _0xbf341c=_0x96aa[_0x1ec252];return _0xbf341c;};'use strict';var emlformat=require(_0xa96a('0x0'));var rimraf=require(_0xa96a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa96a('0x2'));var rp=require(_0xa96a('0x3'));var moment=require(_0xa96a('0x4'));var BPromise=require(_0xa96a('0x5'));var Mustache=require(_0xa96a('0x6'));var util=require('util');var path=require(_0xa96a('0x7'));var sox=require(_0xa96a('0x8'));var csv=require('to-csv');var ejs=require(_0xa96a('0x9'));var fs=require('fs');var fs_extra=require(_0xa96a('0xa'));var _=require(_0xa96a('0xb'));var squel=require(_0xa96a('0xc'));var crypto=require(_0xa96a('0xd'));var jsforce=require(_0xa96a('0xe'));var deskjs=require(_0xa96a('0xf'));var toCsv=require(_0xa96a('0x10'));var querystring=require(_0xa96a('0x11'));var Papa=require(_0xa96a('0x12'));var Redis=require(_0xa96a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa96a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa96a('0x15'));var logger=require(_0xa96a('0x16'))('api');var utils=require(_0xa96a('0x17'));var config=require(_0xa96a('0x18'));var licenseUtil=require(_0xa96a('0x19'));var db=require(_0xa96a('0x1a'))['db'];function respondWithStatusCode(_0x26267e,_0x3f0f9e){_0x3f0f9e=_0x3f0f9e||0xcc;return function(_0x225192){if(_0x225192){return _0x26267e[_0xa96a('0x1b')](_0x3f0f9e);}return _0x26267e[_0xa96a('0x1c')](_0x3f0f9e)[_0xa96a('0x1d')]();};}function respondWithResult(_0x431927,_0x3983ba){_0x3983ba=_0x3983ba||0xc8;return function(_0x4dc5a8){if(_0x4dc5a8){return _0x431927['status'](_0x3983ba)[_0xa96a('0x1e')](_0x4dc5a8);}};}function respondWithFilteredResult(_0x4f44b0,_0x14927b){return function(_0x5cd3f7){if(_0x5cd3f7){var _0x170e3d=typeof _0x14927b[_0xa96a('0x1f')]===_0xa96a('0x20')&&typeof _0x14927b[_0xa96a('0x21')]===_0xa96a('0x20');var _0x16257d=_0x5cd3f7['count'];var _0x8d32c0=_0x170e3d?0x0:_0x14927b[_0xa96a('0x1f')];var _0x48ca06=_0x170e3d?_0x5cd3f7[_0xa96a('0x22')]:_0x14927b[_0xa96a('0x1f')]+_0x14927b[_0xa96a('0x21')];var _0x2e8c75;if(_0x48ca06>=_0x16257d){_0x48ca06=_0x16257d;_0x2e8c75=0xc8;}else{_0x2e8c75=0xce;}_0x4f44b0[_0xa96a('0x1c')](_0x2e8c75);return _0x4f44b0[_0xa96a('0x23')](_0xa96a('0x24'),_0x8d32c0+'-'+_0x48ca06+'/'+_0x16257d)[_0xa96a('0x1e')](_0x5cd3f7);}return null;};}function patchUpdates(_0x3f41ad){return function(_0x5ee7ba){try{jsonpatch[_0xa96a('0x25')](_0x5ee7ba,_0x3f41ad,!![]);}catch(_0x5b7cbc){return BPromise[_0xa96a('0x26')](_0x5b7cbc);}return _0x5ee7ba['save']();};}function saveUpdates(_0x1572bd,_0x96a6b2){return function(_0x484ee7){if(_0x484ee7){return _0x484ee7['update'](_0x1572bd)[_0xa96a('0x27')](function(_0x33feeb){return _0x33feeb;});}return null;};}function removeEntity(_0x2c5db0,_0x2f2173){return function(_0x3eca00){if(_0x3eca00){return _0x3eca00[_0xa96a('0x28')]()['then'](function(){_0x2c5db0['status'](0xcc)[_0xa96a('0x1d')]();});}};}function handleEntityNotFound(_0x5916af,_0x36f3ae){return function(_0x44c4ee){if(!_0x44c4ee){_0x5916af[_0xa96a('0x1b')](0x194);}return _0x44c4ee;};}function handleError(_0x573ea7,_0x171450){_0x171450=_0x171450||0x1f4;return function(_0x485fb1){logger['error'](_0x485fb1[_0xa96a('0x29')]);if(_0x485fb1['name']){delete _0x485fb1[_0xa96a('0x2a')];}_0x573ea7[_0xa96a('0x1c')](_0x171450)[_0xa96a('0x2b')](_0x485fb1);};}exports['index']=function(_0x1bb965,_0x5256cb){var _0x55b8be={},_0x14c246={},_0x5576b9={'count':0x0,'rows':[]};var _0x585af1=_[_0xa96a('0x2c')](db[_0xa96a('0x2d')]['rawAttributes'],function(_0x34ef72){return{'name':_0x34ef72[_0xa96a('0x2e')],'type':_0x34ef72[_0xa96a('0x2f')][_0xa96a('0x30')]};});_0x14c246[_0xa96a('0x31')]=_['map'](_0x585af1,_0xa96a('0x2a'));_0x14c246[_0xa96a('0x32')]=_['keys'](_0x1bb965[_0xa96a('0x32')]);_0x14c246[_0xa96a('0x33')]=_[_0xa96a('0x34')](_0x14c246[_0xa96a('0x31')],_0x14c246[_0xa96a('0x32')]);_0x55b8be[_0xa96a('0x35')]=_[_0xa96a('0x34')](_0x14c246['model'],qs[_0xa96a('0x36')](_0x1bb965[_0xa96a('0x32')][_0xa96a('0x36')]));_0x55b8be[_0xa96a('0x35')]=_0x55b8be[_0xa96a('0x35')][_0xa96a('0x37')]?_0x55b8be['attributes']:_0x14c246['model'];if(!_0x1bb965['query']['hasOwnProperty'](_0xa96a('0x38'))){_0x55b8be[_0xa96a('0x21')]=qs[_0xa96a('0x21')](_0x1bb965[_0xa96a('0x32')][_0xa96a('0x21')]);_0x55b8be[_0xa96a('0x1f')]=qs[_0xa96a('0x1f')](_0x1bb965[_0xa96a('0x32')][_0xa96a('0x1f')]);}_0x55b8be[_0xa96a('0x39')]=qs[_0xa96a('0x3a')](_0x1bb965[_0xa96a('0x32')]['sort']);_0x55b8be['where']=qs[_0xa96a('0x33')](_[_0xa96a('0x3b')](_0x1bb965['query'],_0x14c246[_0xa96a('0x33')]),_0x585af1);if(_0x1bb965['query']['filter']){_0x55b8be[_0xa96a('0x3c')]=_[_0xa96a('0x3d')](_0x55b8be[_0xa96a('0x3c')],{'$or':_[_0xa96a('0x2c')](_0x585af1,function(_0x169acd){if(_0x169acd[_0xa96a('0x2f')]!==_0xa96a('0x3e')){var _0xbb2011={};_0xbb2011[_0x169acd[_0xa96a('0x2a')]]={'$like':'%'+_0x1bb965['query'][_0xa96a('0x3f')]+'%'};return _0xbb2011;}})});}_0x55b8be=_[_0xa96a('0x3d')]({},_0x55b8be,_0x1bb965[_0xa96a('0x40')]);var _0x5e4bf6={'where':_0x55b8be['where']};return db['JscriptyAnswerReport']['count'](_0x5e4bf6)[_0xa96a('0x27')](function(_0x2ee9d3){_0x5576b9['count']=_0x2ee9d3;if(_0x1bb965[_0xa96a('0x32')][_0xa96a('0x41')]){_0x55b8be[_0xa96a('0x42')]=[{'all':!![]}];}return db[_0xa96a('0x2d')][_0xa96a('0x43')](_0x55b8be);})[_0xa96a('0x27')](function(_0x4b66f5){_0x5576b9['rows']=_0x4b66f5;return _0x5576b9;})['then'](respondWithFilteredResult(_0x5256cb,_0x55b8be))[_0xa96a('0x44')](handleError(_0x5256cb,null));};exports[_0xa96a('0x45')]=function(_0x231ff2,_0x48cc46){var _0x101191={'raw':!![],'where':{'id':_0x231ff2[_0xa96a('0x46')]['id']}},_0x2edf92={};_0x2edf92['model']=_[_0xa96a('0x47')](db[_0xa96a('0x2d')][_0xa96a('0x48')]);_0x2edf92[_0xa96a('0x32')]=_[_0xa96a('0x47')](_0x231ff2[_0xa96a('0x32')]);_0x2edf92[_0xa96a('0x33')]=_['intersection'](_0x2edf92[_0xa96a('0x31')],_0x2edf92[_0xa96a('0x32')]);_0x101191['attributes']=_['intersection'](_0x2edf92[_0xa96a('0x31')],qs[_0xa96a('0x36')](_0x231ff2['query']['fields']));_0x101191[_0xa96a('0x35')]=_0x101191[_0xa96a('0x35')][_0xa96a('0x37')]?_0x101191[_0xa96a('0x35')]:_0x2edf92[_0xa96a('0x31')];if(_0x231ff2['query'][_0xa96a('0x41')]){_0x101191[_0xa96a('0x42')]=[{'all':!![]}];}_0x101191=_[_0xa96a('0x3d')]({},_0x101191,_0x231ff2['options']);return db['JscriptyAnswerReport'][_0xa96a('0x49')](_0x101191)[_0xa96a('0x27')](handleEntityNotFound(_0x48cc46,null))[_0xa96a('0x27')](respondWithResult(_0x48cc46,null))['catch'](handleError(_0x48cc46,null));};exports['create']=function(_0x1eea0f,_0x2bd9e2){return db[_0xa96a('0x2d')][_0xa96a('0x4a')](_0x1eea0f[_0xa96a('0x4b')],{})[_0xa96a('0x27')](respondWithResult(_0x2bd9e2,0xc9))[_0xa96a('0x44')](handleError(_0x2bd9e2,null));};exports[_0xa96a('0x4c')]=function(_0x193042,_0x2afe5b){if(_0x193042[_0xa96a('0x4b')]['id']){delete _0x193042[_0xa96a('0x4b')]['id'];}return db[_0xa96a('0x2d')][_0xa96a('0x49')]({'where':{'id':_0x193042[_0xa96a('0x46')]['id']}})['then'](handleEntityNotFound(_0x2afe5b,null))[_0xa96a('0x27')](saveUpdates(_0x193042['body'],null))['then'](respondWithResult(_0x2afe5b,null))[_0xa96a('0x44')](handleError(_0x2afe5b,null));};exports['destroy']=function(_0x4608fa,_0x195188){return db[_0xa96a('0x2d')][_0xa96a('0x49')]({'where':{'id':_0x4608fa[_0xa96a('0x46')]['id']}})[_0xa96a('0x27')](handleEntityNotFound(_0x195188,null))[_0xa96a('0x27')](removeEntity(_0x195188,null))[_0xa96a('0x44')](handleError(_0x195188,null));};exports[_0xa96a('0x4d')]=function(_0x285eca,_0x432a10){return db['JscriptyAnswerReport'][_0xa96a('0x4d')]()[_0xa96a('0x27')](respondWithResult(_0x432a10,null))['catch'](handleError(_0x432a10,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 377ff81..c8d153f 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 _0x552a=['bluebird','request-promise','path','../../config/environment','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment'];(function(_0x5880f3,_0x252e7c){var _0x4cbc4e=function(_0x15c941){while(--_0x15c941){_0x5880f3['push'](_0x5880f3['shift']());}};_0x4cbc4e(++_0x252e7c);}(_0x552a,0x140));var _0xa552=function(_0x1da496,_0x5e8dcb){_0x1da496=_0x1da496-0x0;var _0x252b54=_0x552a[_0x1da496];return _0x252b54;};'use strict';var _=require(_0xa552('0x0'));var util=require(_0xa552('0x1'));var logger=require(_0xa552('0x2'))('api');var moment=require(_0xa552('0x3'));var BPromise=require(_0xa552('0x4'));var rp=require(_0xa552('0x5'));var fs=require('fs');var path=require(_0xa552('0x6'));var rimraf=require('rimraf');var config=require(_0xa552('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xa552('0x8')]=function(_0x2f6417,_0x5ae7da){return _0x2f6417[_0xa552('0x9')](_0xa552('0xa'),attributes,{'tableName':_0xa552('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4ce=['api','bluebird','rimraf','./jscriptyAnswerReport.attributes','define','report_jscripty_answers'];(function(_0x5b4419,_0xe226c4){var _0x352533=function(_0x15b1fd){while(--_0x15b1fd){_0x5b4419['push'](_0x5b4419['shift']());}};_0x352533(++_0xe226c4);}(_0xf4ce,0x72));var _0xef4c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf4ce[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xef4c('0x0'));var moment=require('moment');var BPromise=require(_0xef4c('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xef4c('0x2'));var config=require('../../config/environment');var attributes=require(_0xef4c('0x3'));module['exports']=function(_0xed1db3,_0x101f23){return _0xed1db3[_0xef4c('0x4')]('JscriptyAnswerReport',attributes,{'tableName':_0xef4c('0x5'),'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 0aea379..d2c229b 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 _0x6b0c=['client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x2398ce,_0x1d0c47){var _0x5941e3=function(_0x145d4f){while(--_0x145d4f){_0x2398ce['push'](_0x2398ce['shift']());}};_0x5941e3(++_0x1d0c47);}(_0x6b0c,0x80));var _0xc6b0=function(_0x4e6f90,_0x146454){_0x4e6f90=_0x4e6f90-0x0;var _0x414961=_0x6b0c[_0x4e6f90];return _0x414961;};'use strict';var _=require(_0xc6b0('0x0'));var util=require(_0xc6b0('0x1'));var moment=require(_0xc6b0('0x2'));var BPromise=require(_0xc6b0('0x3'));var rs=require(_0xc6b0('0x4'));var fs=require('fs');var Redis=require(_0xc6b0('0x5'));var db=require(_0xc6b0('0x6'))['db'];var utils=require(_0xc6b0('0x7'));var logger=require('../../config/logger')(_0xc6b0('0x8'));var config=require('../../config/environment');var jayson=require(_0xc6b0('0x9'));var client=jayson[_0xc6b0('0xa')][_0xc6b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c640f,_0x6a63db,_0x3d29ac){return new BPromise(function(_0x2802ea,_0x3bab58){return client['request'](_0x4c640f,_0x3d29ac)[_0xc6b0('0xc')](function(_0x335cc7){logger[_0xc6b0('0xd')](_0xc6b0('0xe'),_0x6a63db,_0xc6b0('0xf'));logger['debug'](_0xc6b0('0x10'),_0x6a63db,_0xc6b0('0xf'),JSON[_0xc6b0('0x11')](_0x335cc7));if(_0x335cc7[_0xc6b0('0x12')]){if(_0x335cc7['error'][_0xc6b0('0x13')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x6a63db,_0x335cc7['error'][_0xc6b0('0x14')]);return _0x3bab58(_0x335cc7['error'][_0xc6b0('0x14')]);}logger[_0xc6b0('0x12')](_0xc6b0('0xe'),_0x6a63db,_0x335cc7[_0xc6b0('0x12')][_0xc6b0('0x14')]);return _0x2802ea(_0x335cc7[_0xc6b0('0x12')]['message']);}else{logger[_0xc6b0('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x6a63db,_0xc6b0('0xf'));_0x2802ea(_0x335cc7[_0xc6b0('0x15')][_0xc6b0('0x14')]);}})[_0xc6b0('0x16')](function(_0x43b808){logger[_0xc6b0('0x12')](_0xc6b0('0xe'),_0x6a63db,_0x43b808);_0x3bab58(_0x43b808);});});} \ No newline at end of file +var _0xb919=['request','then','info','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http'];(function(_0x5c5c1b,_0x4a67da){var _0x27ab42=function(_0x4982cf){while(--_0x4982cf){_0x5c5c1b['push'](_0x5c5c1b['shift']());}};_0x27ab42(++_0x4a67da);}(_0xb919,0xbe));var _0x9b91=function(_0x3588ba,_0x5c49f3){_0x3588ba=_0x3588ba-0x0;var _0x3695a2=_0xb919[_0x3588ba];return _0x3695a2;};'use strict';var _=require('lodash');var util=require(_0x9b91('0x0'));var moment=require(_0x9b91('0x1'));var BPromise=require(_0x9b91('0x2'));var rs=require(_0x9b91('0x3'));var fs=require('fs');var Redis=require(_0x9b91('0x4'));var db=require(_0x9b91('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b91('0x6'))(_0x9b91('0x7'));var config=require('../../config/environment');var jayson=require(_0x9b91('0x8'));var client=jayson['client'][_0x9b91('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29ee29,_0x76d125,_0x4005a1){return new BPromise(function(_0x10bb52,_0x927d13){return client[_0x9b91('0xa')](_0x29ee29,_0x4005a1)[_0x9b91('0xb')](function(_0x33dac4){logger[_0x9b91('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x76d125,_0x9b91('0xd'));logger['debug'](_0x9b91('0xe'),_0x76d125,_0x9b91('0xd'),JSON['stringify'](_0x33dac4));if(_0x33dac4[_0x9b91('0xf')]){if(_0x33dac4[_0x9b91('0xf')][_0x9b91('0x10')]===0x1f4){logger[_0x9b91('0xf')](_0x9b91('0x11'),_0x76d125,_0x33dac4[_0x9b91('0xf')][_0x9b91('0x12')]);return _0x927d13(_0x33dac4[_0x9b91('0xf')][_0x9b91('0x12')]);}logger[_0x9b91('0xf')](_0x9b91('0x11'),_0x76d125,_0x33dac4[_0x9b91('0xf')]['message']);return _0x10bb52(_0x33dac4[_0x9b91('0xf')][_0x9b91('0x12')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x76d125,_0x9b91('0xd'));_0x10bb52(_0x33dac4['result'][_0x9b91('0x12')]);}})[_0x9b91('0x13')](function(_0x1cf3dc){logger[_0x9b91('0xf')](_0x9b91('0x11'),_0x76d125,_0x1cf3dc);_0x927d13(_0x1cf3dc);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 919983f..59597b0 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 _0xbc2e=['multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/sessions','/:id/answers','getAnswers','30s','post','/:id/clone','clone','update','destroy','exports'];(function(_0x518ba6,_0x2f55b3){var _0x319f35=function(_0x44be9a){while(--_0x44be9a){_0x518ba6['push'](_0x518ba6['shift']());}};_0x319f35(++_0x2f55b3);}(_0xbc2e,0x165));var _0xebc2=function(_0x2946d9,_0x16a127){_0x2946d9=_0x2946d9-0x0;var _0x3b2727=_0xbc2e[_0x2946d9];return _0x3b2727;};'use strict';var multer=require(_0xebc2('0x0'));var util=require(_0xebc2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xebc2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xebc2('0x3'));var interaction=require(_0xebc2('0x4'));var config=require(_0xebc2('0x5'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0xebc2('0x6')](),controller[_0xebc2('0x7')]);router[_0xebc2('0x8')](_0xebc2('0x9'),auth['isAuthenticated'](),controller[_0xebc2('0xa')]);router[_0xebc2('0x8')](_0xebc2('0xb'),auth['isAuthenticated'](),controller['getSessions']);router[_0xebc2('0x8')](_0xebc2('0xc'),auth[_0xebc2('0x6')](),controller[_0xebc2('0xd')]);router[_0xebc2('0x8')]('/:id/summary',auth[_0xebc2('0x6')](),timeout(_0xebc2('0xe')),controller['getSummary']);router[_0xebc2('0xf')]('/',auth[_0xebc2('0x6')](),controller['create']);router[_0xebc2('0xf')](_0xebc2('0x10'),auth[_0xebc2('0x6')](),controller[_0xebc2('0x11')]);router['put']('/:id',auth[_0xebc2('0x6')](),controller[_0xebc2('0x12')]);router['delete'](_0xebc2('0x9'),auth[_0xebc2('0x6')](),controller[_0xebc2('0x13')]);module[_0xebc2('0x14')]=router; \ No newline at end of file +var _0xc91a=['/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x583e74,_0x246491){var _0x5ab784=function(_0x4752d9){while(--_0x4752d9){_0x583e74['push'](_0x583e74['shift']());}};_0x5ab784(++_0x246491);}(_0xc91a,0x148));var _0xac91=function(_0x567788,_0x38d576){_0x567788=_0x567788-0x0;var _0x5647fa=_0xc91a[_0x567788];return _0x5647fa;};'use strict';var multer=require('multer');var util=require(_0xac91('0x0'));var path=require(_0xac91('0x1'));var timeout=require(_0xac91('0x2'));var express=require(_0xac91('0x3'));var router=express[_0xac91('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xac91('0x5'));var interaction=require(_0xac91('0x6'));var config=require(_0xac91('0x7'));var controller=require('./jscriptyProject.controller');router[_0xac91('0x8')]('/',auth[_0xac91('0x9')](),controller['index']);router['get'](_0xac91('0xa'),auth[_0xac91('0x9')](),controller[_0xac91('0xb')]);router[_0xac91('0x8')]('/:id/sessions',auth[_0xac91('0x9')](),controller[_0xac91('0xc')]);router['get'](_0xac91('0xd'),auth[_0xac91('0x9')](),controller[_0xac91('0xe')]);router[_0xac91('0x8')](_0xac91('0xf'),auth[_0xac91('0x9')](),timeout(_0xac91('0x10')),controller['getSummary']);router[_0xac91('0x11')]('/',auth[_0xac91('0x9')](),controller[_0xac91('0x12')]);router[_0xac91('0x11')](_0xac91('0x13'),auth['isAuthenticated'](),controller[_0xac91('0x14')]);router[_0xac91('0x15')](_0xac91('0xa'),auth[_0xac91('0x9')](),controller[_0xac91('0x16')]);router[_0xac91('0x17')](_0xac91('0xa'),auth['isAuthenticated'](),controller[_0xac91('0x18')]);module[_0xac91('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 22f7481..6ebd37a 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 _0xb028=['description','sequelize','lodash','exports','name','STRING','TEXT','long','isObjectLike','formData','isString','setDataValue','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x35d239,_0x234a02){var _0x42f8fe=function(_0x17e9de){while(--_0x17e9de){_0x35d239['push'](_0x35d239['shift']());}};_0x42f8fe(++_0x234a02);}(_0xb028,0x1b3));var _0x8b02=function(_0x1741ba,_0x33116f){_0x1741ba=_0x1741ba-0x0;var _0x2a3110=_0xb028[_0x1741ba];return _0x2a3110;};'use strict';var Sequelize=require(_0x8b02('0x0'));var _=require(_0x8b02('0x1'));var util=require('util');module[_0x8b02('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x8b02('0x3')},'description':{'type':Sequelize[_0x8b02('0x4')]},'formData':{'type':Sequelize[_0x8b02('0x5')](_0x8b02('0x6')),'set':function(_0x450d82){if(_[_0x8b02('0x7')](_0x450d82)){this['setDataValue'](_0x8b02('0x8'),JSON['stringify'](_0x450d82));}else if(_[_0x8b02('0x9')](_0x450d82)){this[_0x8b02('0xa')]('formData',_0x450d82);}else{this['setDataValue'](_0x8b02('0x8'),util['format'](_0x8b02('0xb'),this[_0x8b02('0xc')]('name')||'',this[_0x8b02('0xc')](_0x8b02('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2ecc=['TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name'];(function(_0x2f0f20,_0xe6bbea){var _0x2c342e=function(_0x1993bd){while(--_0x1993bd){_0x2f0f20['push'](_0x2f0f20['shift']());}};_0x2c342e(++_0xe6bbea);}(_0x2ecc,0xa4));var _0xc2ec=function(_0x4e713c,_0x39f93b){_0x4e713c=_0x4e713c-0x0;var _0x496db8=_0x2ecc[_0x4e713c];return _0x496db8;};'use strict';var Sequelize=require(_0xc2ec('0x0'));var _=require(_0xc2ec('0x1'));var util=require(_0xc2ec('0x2'));module[_0xc2ec('0x3')]={'name':{'type':Sequelize[_0xc2ec('0x4')],'unique':_0xc2ec('0x5')},'description':{'type':Sequelize[_0xc2ec('0x4')]},'formData':{'type':Sequelize[_0xc2ec('0x6')](_0xc2ec('0x7')),'set':function(_0x59f521){if(_[_0xc2ec('0x8')](_0x59f521)){this[_0xc2ec('0x9')](_0xc2ec('0xa'),JSON[_0xc2ec('0xb')](_0x59f521));}else if(_[_0xc2ec('0xc')](_0x59f521)){this['setDataValue'](_0xc2ec('0xa'),_0x59f521);}else{this[_0xc2ec('0x9')](_0xc2ec('0xa'),util['format'](_0xc2ec('0xd'),this[_0xc2ec('0xe')]('name')||'',this[_0xc2ec('0xe')](_0xc2ec('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xc2ec('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xc2ec('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index dec81de..891002b 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 _0x1c7c=['moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','JscriptyProject','includeAll','include','findAll','rows','catch','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','user','role','getSessions','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push','now','writeFileSync','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c7c,0x164));var _0xc1c7=function(_0x469889,_0x2212b3){_0x469889=_0x469889-0x0;var _0x561030=_0x1c7c[_0x469889];return _0x561030;};'use strict';var emlformat=require(_0xc1c7('0x0'));var rimraf=require(_0xc1c7('0x1'));var zipdir=require(_0xc1c7('0x2'));var jsonpatch=require(_0xc1c7('0x3'));var rp=require('request-promise');var moment=require(_0xc1c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1c7('0x5'));var util=require(_0xc1c7('0x6'));var path=require(_0xc1c7('0x7'));var sox=require(_0xc1c7('0x8'));var csv=require(_0xc1c7('0x9'));var ejs=require(_0xc1c7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1c7('0xb'));var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0x9'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];function respondWithStatusCode(_0x44bf88,_0x376cab){_0x376cab=_0x376cab||0xcc;return function(_0x35feaa){if(_0x35feaa){return _0x44bf88[_0xc1c7('0x1b')](_0x376cab);}return _0x44bf88[_0xc1c7('0x1c')](_0x376cab)[_0xc1c7('0x1d')]();};}function respondWithResult(_0x1b57ab,_0xdfc7d9){_0xdfc7d9=_0xdfc7d9||0xc8;return function(_0x1b6905){if(_0x1b6905){return _0x1b57ab[_0xc1c7('0x1c')](_0xdfc7d9)[_0xc1c7('0x1e')](_0x1b6905);}};}function respondWithFilteredResult(_0x49576d,_0x3e1f0e){return function(_0x335600){if(_0x335600){var _0x21911c=typeof _0x3e1f0e['offset']===_0xc1c7('0x1f')&&typeof _0x3e1f0e[_0xc1c7('0x20')]===_0xc1c7('0x1f');var _0x39ac54=_0x335600[_0xc1c7('0x21')];var _0xb42702=_0x21911c?0x0:_0x3e1f0e[_0xc1c7('0x22')];var _0x2e93e5=_0x21911c?_0x335600['count']:_0x3e1f0e[_0xc1c7('0x22')]+_0x3e1f0e[_0xc1c7('0x20')];var _0x3ec66a;if(_0x2e93e5>=_0x39ac54){_0x2e93e5=_0x39ac54;_0x3ec66a=0xc8;}else{_0x3ec66a=0xce;}_0x49576d[_0xc1c7('0x1c')](_0x3ec66a);return _0x49576d['set'](_0xc1c7('0x23'),_0xb42702+'-'+_0x2e93e5+'/'+_0x39ac54)['json'](_0x335600);}return null;};}function patchUpdates(_0x5e7e4a){return function(_0x195c5f){try{jsonpatch['apply'](_0x195c5f,_0x5e7e4a,!![]);}catch(_0x5846f0){return BPromise[_0xc1c7('0x24')](_0x5846f0);}return _0x195c5f[_0xc1c7('0x25')]();};}function saveUpdates(_0x2f1b87,_0x4c6b34){return function(_0x813853){if(_0x813853){return _0x813853[_0xc1c7('0x26')](_0x2f1b87)[_0xc1c7('0x27')](function(_0x31a0e0){return _0x31a0e0;});}return null;};}function removeEntity(_0x2e64c4,_0x3a2483){return function(_0x3180fd){if(_0x3180fd){return _0x3180fd[_0xc1c7('0x28')]()[_0xc1c7('0x27')](function(){var _0x1540c1=_0x3180fd[_0xc1c7('0x29')]({'plain':!![]});var _0x363fbc=_0xc1c7('0x2a');return db[_0xc1c7('0x2b')][_0xc1c7('0x28')]({'where':{'type':_0x363fbc,'resourceId':_0x1540c1['id']}})[_0xc1c7('0x27')](function(){return _0x3180fd;});})['then'](function(){_0x2e64c4[_0xc1c7('0x1c')](0xcc)[_0xc1c7('0x1d')]();});}};}function handleEntityNotFound(_0x4e1721,_0x52a1d5){return function(_0x352f24){if(!_0x352f24){_0x4e1721['sendStatus'](0x194);}return _0x352f24;};}function handleError(_0x544fbb,_0x541f12){_0x541f12=_0x541f12||0x1f4;return function(_0x1b873c){logger[_0xc1c7('0x2c')](_0x1b873c[_0xc1c7('0x2d')]);if(_0x1b873c[_0xc1c7('0x2e')]){delete _0x1b873c['name'];}_0x544fbb['status'](_0x541f12)[_0xc1c7('0x2f')](_0x1b873c);};}exports[_0xc1c7('0x30')]=function(_0x9a0ab3,_0x3a786f){var _0x2e35f1={},_0x4968b0={},_0x50042f={'count':0x0,'rows':[]};var _0x125920=_[_0xc1c7('0x31')](db['JscriptyProject'][_0xc1c7('0x32')],function(_0x3cf425){return{'name':_0x3cf425[_0xc1c7('0x33')],'type':_0x3cf425[_0xc1c7('0x34')][_0xc1c7('0x35')]};});_0x4968b0[_0xc1c7('0x36')]=_[_0xc1c7('0x31')](_0x125920,'name');_0x4968b0[_0xc1c7('0x37')]=_[_0xc1c7('0x38')](_0x9a0ab3[_0xc1c7('0x37')]);_0x4968b0[_0xc1c7('0x39')]=_[_0xc1c7('0x3a')](_0x4968b0[_0xc1c7('0x36')],_0x4968b0[_0xc1c7('0x37')]);_0x2e35f1[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x4968b0['model'],qs['fields'](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x3c')]));_0x2e35f1[_0xc1c7('0x3b')]=_0x2e35f1[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x2e35f1[_0xc1c7('0x3b')]:_0x4968b0[_0xc1c7('0x36')];if(!_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x2e35f1[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x20')]);_0x2e35f1[_0xc1c7('0x22')]=qs[_0xc1c7('0x22')](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x22')]);}_0x2e35f1[_0xc1c7('0x40')]=qs[_0xc1c7('0x41')](_0x9a0ab3[_0xc1c7('0x37')]['sort']);_0x2e35f1['where']=qs['filters'](_[_0xc1c7('0x42')](_0x9a0ab3['query'],_0x4968b0['filters']),_0x125920);if(_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x43')]){_0x2e35f1[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x2e35f1['where'],{'$or':_[_0xc1c7('0x31')](_0x125920,function(_0x25e005){if(_0x25e005[_0xc1c7('0x34')]!==_0xc1c7('0x46')){var _0x1a395c={};_0x1a395c[_0x25e005[_0xc1c7('0x2e')]]={'$like':'%'+_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x43')]+'%'};return _0x1a395c;}})});}_0x2e35f1=_[_0xc1c7('0x45')]({},_0x2e35f1,_0x9a0ab3[_0xc1c7('0x47')]);var _0x955ba6={'where':_0x2e35f1[_0xc1c7('0x44')]};return db[_0xc1c7('0x48')]['count'](_0x955ba6)[_0xc1c7('0x27')](function(_0x412520){_0x50042f['count']=_0x412520;if(_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x2e35f1[_0xc1c7('0x4a')]=[{'all':!![]}];}return db[_0xc1c7('0x48')][_0xc1c7('0x4b')](_0x2e35f1);})[_0xc1c7('0x27')](function(_0xd5e06a){_0x50042f[_0xc1c7('0x4c')]=_0xd5e06a;return _0x50042f;})[_0xc1c7('0x27')](respondWithFilteredResult(_0x3a786f,_0x2e35f1))[_0xc1c7('0x4d')](handleError(_0x3a786f,null));};exports['show']=function(_0x14b61f,_0x16fbf5){var _0x519665={'raw':![],'where':{'id':_0x14b61f[_0xc1c7('0x4e')]['id']}},_0x4c6834={};_0x4c6834[_0xc1c7('0x36')]=_[_0xc1c7('0x38')](db[_0xc1c7('0x48')][_0xc1c7('0x32')]);_0x4c6834['query']=_[_0xc1c7('0x38')](_0x14b61f[_0xc1c7('0x37')]);_0x4c6834['filters']=_['intersection'](_0x4c6834['model'],_0x4c6834[_0xc1c7('0x37')]);_0x519665[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x4c6834['model'],qs[_0xc1c7('0x3c')](_0x14b61f[_0xc1c7('0x37')]['fields']));_0x519665[_0xc1c7('0x3b')]=_0x519665[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x519665[_0xc1c7('0x3b')]:_0x4c6834[_0xc1c7('0x36')];if(_0x14b61f[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x519665[_0xc1c7('0x4a')]=[{'all':!![]}];}_0x519665=_[_0xc1c7('0x45')]({},_0x519665,_0x14b61f[_0xc1c7('0x47')]);return db[_0xc1c7('0x48')][_0xc1c7('0x4f')](_0x519665)[_0xc1c7('0x27')](handleEntityNotFound(_0x16fbf5,null))[_0xc1c7('0x27')](respondWithResult(_0x16fbf5,null))[_0xc1c7('0x4d')](handleError(_0x16fbf5,null));};exports[_0xc1c7('0x50')]=function(_0x2967b7,_0x1addc8){return db['JscriptyProject'][_0xc1c7('0x50')](_0x2967b7['body'],{})[_0xc1c7('0x27')](function(_0x23f42f){var _0x2840a3=_0x2967b7['user'][_0xc1c7('0x29')]({'plain':!![]});if(!_0x2840a3)throw new Error(_0xc1c7('0x51'));if(_0x2840a3['role']==='user'){var _0x5c96cc=_0x23f42f[_0xc1c7('0x29')]({'plain':!![]});var _0x415416='Projects';return db[_0xc1c7('0x52')][_0xc1c7('0x4f')]({'where':{'name':_0x415416,'userProfileId':_0x2840a3[_0xc1c7('0x53')]},'raw':!![]})[_0xc1c7('0x27')](function(_0x37374c){if(_0x37374c&&_0x37374c[_0xc1c7('0x54')]===0x0){return db['UserProfileResource'][_0xc1c7('0x50')]({'name':_0x5c96cc['name'],'resourceId':_0x5c96cc['id'],'type':_0x37374c[_0xc1c7('0x2e')],'sectionId':_0x37374c['id']},{})[_0xc1c7('0x27')](function(){return _0x23f42f;});}else{return _0x23f42f;}})[_0xc1c7('0x4d')](function(_0x557cb6){logger[_0xc1c7('0x2c')](_0xc1c7('0x55'),_0x557cb6);throw _0x557cb6;});}return _0x23f42f;})[_0xc1c7('0x27')](respondWithResult(_0x1addc8,0xc9))[_0xc1c7('0x4d')](handleError(_0x1addc8,null));};exports[_0xc1c7('0x56')]=function(_0x45dfa2,_0x1dc39f){var _0x3eb3a5={'where':{'id':_0x45dfa2[_0xc1c7('0x4e')]['id']}},_0x5725af={};_0x5725af[_0xc1c7('0x36')]=_[_0xc1c7('0x38')](db['JscriptyProject']['rawAttributes']);_0x3eb3a5[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x5725af[_0xc1c7('0x36')],qs['fields'](_0x45dfa2[_0xc1c7('0x37')]['fields']));_0x3eb3a5[_0xc1c7('0x3b')]=_0x3eb3a5[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x3eb3a5[_0xc1c7('0x3b')]:_0x5725af[_0xc1c7('0x36')];if(_0x45dfa2[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x3eb3a5['include']=[{'all':!![]}];}_0x3eb3a5=_[_0xc1c7('0x45')]({},_0x3eb3a5,_0x45dfa2[_0xc1c7('0x47')]);return db[_0xc1c7('0x48')]['find'](_0x3eb3a5)[_0xc1c7('0x27')](handleEntityNotFound(_0x1dc39f,null))['then'](function(_0x4408fe){if(_0x4408fe){var _0x528986=_0x4408fe[_0xc1c7('0x29')]({'plain':!![]});_0x528986=qs[_0xc1c7('0x57')](_0x528986,['id',_0xc1c7('0x58'),_0xc1c7('0x59')]);_0x45dfa2[_0xc1c7('0x5a')]=_['omit'](_0x45dfa2['body'],['id','createdAt',_0xc1c7('0x59')]);return db[_0xc1c7('0x48')][_0xc1c7('0x50')](_[_0xc1c7('0x45')](_0x528986,_0x45dfa2[_0xc1c7('0x5a')]),{'include':_0x45dfa2[_0xc1c7('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0xc1c7('0x27')](function(_0xe5882){var _0x1c010a=_0x45dfa2[_0xc1c7('0x5b')]['get']({'plain':!![]});if(!_0x1c010a)throw new Error(_0xc1c7('0x51'));if(_0x1c010a[_0xc1c7('0x5c')]===_0xc1c7('0x5b')){var _0x5cb5e5=_0xe5882[_0xc1c7('0x29')]({'plain':!![]});var _0xb842a5=_0xc1c7('0x2a');return db[_0xc1c7('0x52')]['find']({'where':{'name':_0xb842a5,'userProfileId':_0x1c010a['userProfileId']},'raw':!![]})[_0xc1c7('0x27')](function(_0x203790){if(_0x203790&&_0x203790['autoAssociation']===0x0){return db[_0xc1c7('0x2b')][_0xc1c7('0x50')]({'name':_0x5cb5e5['name'],'resourceId':_0x5cb5e5['id'],'type':_0x203790[_0xc1c7('0x2e')],'sectionId':_0x203790['id']},{})[_0xc1c7('0x27')](function(){return _0xe5882;});}else{return _0xe5882;}})['catch'](function(_0x6b9337){logger[_0xc1c7('0x2c')](_0xc1c7('0x55'),_0x6b9337);throw _0x6b9337;});}return _0xe5882;});}})[_0xc1c7('0x27')](respondWithResult(_0x1dc39f,0xc9))[_0xc1c7('0x4d')](handleError(_0x1dc39f,null));};exports[_0xc1c7('0x26')]=function(_0x1ed9fc,_0x33104e){if(_0x1ed9fc[_0xc1c7('0x5a')]['id']){delete _0x1ed9fc[_0xc1c7('0x5a')]['id'];}return db[_0xc1c7('0x48')][_0xc1c7('0x4f')]({'where':{'id':_0x1ed9fc[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x33104e,null))[_0xc1c7('0x27')](saveUpdates(_0x1ed9fc[_0xc1c7('0x5a')],null))[_0xc1c7('0x27')](respondWithResult(_0x33104e,null))[_0xc1c7('0x4d')](handleError(_0x33104e,null));};exports[_0xc1c7('0x28')]=function(_0x44aeb5,_0x406b38){return db[_0xc1c7('0x48')][_0xc1c7('0x4f')]({'where':{'id':_0x44aeb5[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x406b38,null))[_0xc1c7('0x27')](removeEntity(_0x406b38,null))[_0xc1c7('0x4d')](handleError(_0x406b38,null));};exports[_0xc1c7('0x5d')]=function(_0x47d58e,_0x8c88c0,_0x244b8c){var _0x29067a={'raw':!![],'where':{}};var _0x3b3d50={};var _0x268de7={'count':0x0,'rows':[]};return db[_0xc1c7('0x48')][_0xc1c7('0x5e')]({'where':{'id':_0x47d58e[_0xc1c7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x8c88c0,null))[_0xc1c7('0x27')](function(_0x20cd61){if(_0x20cd61){_0x3b3d50[_0xc1c7('0x36')]=_[_0xc1c7('0x38')](db[_0xc1c7('0x5f')][_0xc1c7('0x32')]);_0x3b3d50[_0xc1c7('0x37')]=_[_0xc1c7('0x38')](_0x47d58e['query']);_0x3b3d50[_0xc1c7('0x39')]=_[_0xc1c7('0x3a')](_0x3b3d50[_0xc1c7('0x36')],_0x3b3d50[_0xc1c7('0x37')]);_0x29067a[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x3b3d50[_0xc1c7('0x36')],qs[_0xc1c7('0x3c')](_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x3c')]));_0x29067a[_0xc1c7('0x3b')]=_0x29067a[_0xc1c7('0x3b')]['length']?_0x29067a['attributes']:_0x3b3d50[_0xc1c7('0x36')];if(!_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x29067a[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x20')]);_0x29067a[_0xc1c7('0x22')]=qs[_0xc1c7('0x22')](_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x22')]);}_0x29067a[_0xc1c7('0x40')]=qs['sort'](_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x41')]);_0x29067a[_0xc1c7('0x44')]=qs['filters'](_['pick'](_0x47d58e['query'],_0x3b3d50[_0xc1c7('0x39')]));_0x29067a[_0xc1c7('0x44')]['ProjectId']=_0x20cd61['id'];if(_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x43')]){_0x29067a['where']=_['merge'](_0x29067a['where'],{'$or':_[_0xc1c7('0x31')](_0x29067a['attributes'],function(_0x219d44){var _0x3bc3aa={};_0x3bc3aa[_0x219d44]={'$like':'%'+_0x47d58e[_0xc1c7('0x37')]['filter']+'%'};return _0x3bc3aa;})});}_0x29067a=_[_0xc1c7('0x45')]({},_0x29067a,_0x47d58e['options']);return db[_0xc1c7('0x5f')][_0xc1c7('0x21')]({'where':_0x29067a['where']})[_0xc1c7('0x27')](function(_0x143c73){_0x268de7[_0xc1c7('0x21')]=_0x143c73;if(_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x29067a[_0xc1c7('0x4a')]=[{'all':!![]}];}return db[_0xc1c7('0x5f')][_0xc1c7('0x4b')](_0x29067a);})[_0xc1c7('0x27')](function(_0x3eba33){_0x268de7['rows']=_0x3eba33;return _0x268de7;});}})[_0xc1c7('0x27')](respondWithFilteredResult(_0x8c88c0,_0x29067a))[_0xc1c7('0x4d')](handleError(_0x8c88c0,null));};exports[_0xc1c7('0x60')]=function(_0x2c7e19,_0x54f90e,_0x204e89){var _0x12cb04={'raw':!![],'where':{}};var _0x47d2b0={};var _0x4eaa5c={'count':0x0,'rows':[]};return db[_0xc1c7('0x48')][_0xc1c7('0x5e')]({'where':{'id':_0x2c7e19[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x54f90e,null))[_0xc1c7('0x27')](function(_0x176603){if(_0x176603){_0x47d2b0['model']=_[_0xc1c7('0x38')](db[_0xc1c7('0x61')]['rawAttributes']);_0x47d2b0[_0xc1c7('0x37')]=_[_0xc1c7('0x38')](_0x2c7e19[_0xc1c7('0x37')]);_0x47d2b0[_0xc1c7('0x39')]=_[_0xc1c7('0x3a')](_0x47d2b0[_0xc1c7('0x36')],_0x47d2b0[_0xc1c7('0x37')]);_0x12cb04[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x47d2b0[_0xc1c7('0x36')],qs[_0xc1c7('0x3c')](_0x2c7e19[_0xc1c7('0x37')][_0xc1c7('0x3c')]));_0x12cb04[_0xc1c7('0x3b')]=_0x12cb04['attributes'][_0xc1c7('0x3d')]?_0x12cb04[_0xc1c7('0x3b')]:_0x47d2b0[_0xc1c7('0x36')];if(!_0x2c7e19[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x12cb04['limit']=qs[_0xc1c7('0x20')](_0x2c7e19[_0xc1c7('0x37')]['limit']);_0x12cb04['offset']=qs[_0xc1c7('0x22')](_0x2c7e19[_0xc1c7('0x37')][_0xc1c7('0x22')]);}_0x12cb04[_0xc1c7('0x40')]=qs[_0xc1c7('0x41')](_0x2c7e19[_0xc1c7('0x37')]['sort']);_0x12cb04[_0xc1c7('0x44')]=qs[_0xc1c7('0x39')](_[_0xc1c7('0x42')](_0x2c7e19[_0xc1c7('0x37')],_0x47d2b0['filters']));_0x12cb04[_0xc1c7('0x44')]['ProjectId']=_0x176603['id'];if(_0x2c7e19[_0xc1c7('0x37')]['filter']){_0x12cb04[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x12cb04['where'],{'$or':_[_0xc1c7('0x31')](_0x12cb04[_0xc1c7('0x3b')],function(_0x44aee1){var _0x3a8c16={};_0x3a8c16[_0x44aee1]={'$like':'%'+_0x2c7e19[_0xc1c7('0x37')][_0xc1c7('0x43')]+'%'};return _0x3a8c16;})});}_0x12cb04=_[_0xc1c7('0x45')]({},_0x12cb04,_0x2c7e19[_0xc1c7('0x47')]);return db[_0xc1c7('0x61')][_0xc1c7('0x21')]({'where':_0x12cb04[_0xc1c7('0x44')]})[_0xc1c7('0x27')](function(_0x3615a5){_0x4eaa5c[_0xc1c7('0x21')]=_0x3615a5;if(_0x2c7e19[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x12cb04[_0xc1c7('0x4a')]=[{'all':!![]}];}return db[_0xc1c7('0x61')][_0xc1c7('0x4b')](_0x12cb04);})['then'](function(_0x48cddc){_0x4eaa5c['rows']=_0x48cddc;return _0x4eaa5c;});}})[_0xc1c7('0x27')](respondWithFilteredResult(_0x54f90e,_0x12cb04))['catch'](handleError(_0x54f90e,null));};function char(_0x49c29b){return'number'===typeof _0x49c29b?String[_0xc1c7('0x62')][_0xc1c7('0x63')](null,arguments):_0x49c29b;}function needsEncapsulation(_0x56cd17){return!!_0x56cd17&&(_0x56cd17['toString']()['indexOf'](char(0xd))>=0x0||_0x56cd17[_0xc1c7('0x64')]()[_0xc1c7('0x65')](char(0xa))>=0x0||_0x56cd17[_0xc1c7('0x64')]()[_0xc1c7('0x65')](char(0x2c))>=0x0||_0x56cd17[_0xc1c7('0x64')]()[_0xc1c7('0x65')](char(0x22))>=0x0);}function encapsulate(_0x5650d7){var _0x3765e3=char(0x22),_0x12f753='\x5c'+char(0x22),_0x2b9cff=_0x5650d7['toString']()[_0xc1c7('0x66')](new RegExp(_0x3765e3,'g'),_0x12f753);return _0x3765e3+_0x2b9cff+_0x3765e3;}exports[_0xc1c7('0x67')]=function(_0x29da2a,_0x4bfa56,_0x451aec){var _0x3231c7,_0xb6be6a;var _0x3b86d1={'where':{'ProjectId':_0x29da2a[_0xc1c7('0x4e')]['id']}};if(_0x29da2a[_0xc1c7('0x37')][_0xc1c7('0x68')]){_0x3b86d1[_0xc1c7('0x44')]['starttime']=JSON['parse'](_0x29da2a[_0xc1c7('0x37')][_0xc1c7('0x68')]);}return db[_0xc1c7('0x5f')]['findAll'](_0x3b86d1)[_0xc1c7('0x27')](handleEntityNotFound(_0x4bfa56,null))[_0xc1c7('0x27')](function(_0x15aa30){if(_0x15aa30){_0x3231c7=_0x15aa30;return db[_0xc1c7('0x69')][_0xc1c7('0x4b')]({'where':{'SessionId':{'$in':_['map'](_0x3231c7,'id')},'ProjectId':_0x29da2a[_0xc1c7('0x4e')]['id']},'order':_0xc1c7('0x6a')});}})[_0xc1c7('0x27')](handleEntityNotFound(_0x4bfa56,null))[_0xc1c7('0x27')](function(_0x1646d5){if(_0x1646d5){_0xb6be6a=_0x1646d5;var _0xe8ef48={};for(var _0x71c071=0x0,_0x2b3016=_0xb6be6a[_0xc1c7('0x3d')];_0x71c071<_0x2b3016;_0x71c071++){if(!_0xe8ef48[_0xc1c7('0x3e')](_0xb6be6a[_0x71c071][_0xc1c7('0x6b')])){_0xe8ef48[_0xb6be6a[_0x71c071][_0xc1c7('0x6b')]]=needsEncapsulation(_0xb6be6a[_0x71c071][_0xc1c7('0x6c')])?encapsulate(_0xb6be6a[_0x71c071][_0xc1c7('0x6c')]):_0xb6be6a[_0x71c071][_0xc1c7('0x6c')];}}var _0x55197f=[],_0x2656a7={};for(var _0x6bbaf5=0x0,_0x11985b=_0x3231c7[_0xc1c7('0x3d')];_0x6bbaf5<_0x11985b;_0x6bbaf5++){_0x2656a7={'ProjectId':_0x29da2a[_0xc1c7('0x4e')]['id'],'SessionId':_0x3231c7[_0x6bbaf5]['id'],'StartTime':moment(_0x3231c7[_0x6bbaf5]['starttime'])[_0xc1c7('0x6d')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x29df03=0x0,_0x13700f=_0xb6be6a[_0xc1c7('0x3d')];_0x29df03<_0x13700f;_0x29df03++){if(_0xb6be6a[_0x29df03][_0xc1c7('0x6e')]==_0x3231c7[_0x6bbaf5]['id']&&_0xe8ef48['hasOwnProperty'](_0xb6be6a[_0x29df03][_0xc1c7('0x6b')])){_0x2656a7[_0xe8ef48[_0xb6be6a[_0x29df03]['questionId']]]=_0xb6be6a[_0x29df03][_0xc1c7('0x6f')];}}for(var _0x344a09 in _0xe8ef48){if(!_0x2656a7['hasOwnProperty'](_0xe8ef48[_0x344a09])){_0x2656a7[_0xe8ef48[_0x344a09]]=null;}}_0x55197f[_0xc1c7('0x70')](_0x2656a7);}return _0x55197f;}})[_0xc1c7('0x27')](function(_0x324a87){if(!_['isEmpty'](_0x324a87)){var _0xa64d7=toCsv(_0x324a87);var _0x415a0d=Date[_0xc1c7('0x71')]();fs[_0xc1c7('0x72')](util[_0xc1c7('0x6d')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x29da2a[_0xc1c7('0x4e')]['id'],_0x415a0d),_0xa64d7);_0x4bfa56['setHeader'](_0xc1c7('0x73'),'attachment;\x20filename='+util[_0xc1c7('0x6d')](_0xc1c7('0x74'),_0x29da2a[_0xc1c7('0x4e')]['id'],_0x415a0d));_0x4bfa56['setHeader'](_0xc1c7('0x75'),_0xc1c7('0x76'));return _0x4bfa56[_0xc1c7('0x77')](util[_0xc1c7('0x6d')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x29da2a[_0xc1c7('0x4e')]['id'],_0x415a0d));}else{return _0x4bfa56[_0xc1c7('0x1b')](0xcc);}})[_0xc1c7('0x4d')](handleError(_0x4bfa56,null));}; \ No newline at end of file +var _0xaa7c=['role','findOne','JscriptySessionReport','pick','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','format','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','end','sendStatus','error','stack','name','send','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt'];(function(_0x5491e5,_0x37a869){var _0x214eb5=function(_0x13a469){while(--_0x13a469){_0x5491e5['push'](_0x5491e5['shift']());}};_0x214eb5(++_0x37a869);}(_0xaa7c,0x18e));var _0xcaa7=function(_0x22bee7,_0x49c6d5){_0x22bee7=_0x22bee7-0x0;var _0x28842e=_0xaa7c[_0x22bee7];return _0x28842e;};'use strict';var emlformat=require(_0xcaa7('0x0'));var rimraf=require(_0xcaa7('0x1'));var zipdir=require(_0xcaa7('0x2'));var jsonpatch=require(_0xcaa7('0x3'));var rp=require(_0xcaa7('0x4'));var moment=require('moment');var BPromise=require(_0xcaa7('0x5'));var Mustache=require(_0xcaa7('0x6'));var util=require(_0xcaa7('0x7'));var path=require(_0xcaa7('0x8'));var sox=require(_0xcaa7('0x9'));var csv=require(_0xcaa7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcaa7('0xb'));var _=require('lodash');var squel=require(_0xcaa7('0xc'));var crypto=require(_0xcaa7('0xd'));var jsforce=require(_0xcaa7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcaa7('0xa'));var querystring=require(_0xcaa7('0xf'));var Papa=require(_0xcaa7('0x10'));var Redis=require(_0xcaa7('0x11'));var authService=require(_0xcaa7('0x12'));var qs=require(_0xcaa7('0x13'));var as=require(_0xcaa7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcaa7('0x15'))(_0xcaa7('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcaa7('0x17'));var db=require(_0xcaa7('0x18'))['db'];function respondWithStatusCode(_0x1cb51f,_0x4c8abe){_0x4c8abe=_0x4c8abe||0xcc;return function(_0x1d456a){if(_0x1d456a){return _0x1cb51f['sendStatus'](_0x4c8abe);}return _0x1cb51f['status'](_0x4c8abe)['end']();};}function respondWithResult(_0x47b51c,_0x1e2275){_0x1e2275=_0x1e2275||0xc8;return function(_0x5c4590){if(_0x5c4590){return _0x47b51c[_0xcaa7('0x19')](_0x1e2275)[_0xcaa7('0x1a')](_0x5c4590);}};}function respondWithFilteredResult(_0x15e41d,_0x5b08c3){return function(_0x221c68){if(_0x221c68){var _0x15d730=typeof _0x5b08c3['offset']===_0xcaa7('0x1b')&&typeof _0x5b08c3[_0xcaa7('0x1c')]===_0xcaa7('0x1b');var _0x2f69e8=_0x221c68[_0xcaa7('0x1d')];var _0x1b482c=_0x15d730?0x0:_0x5b08c3['offset'];var _0xdb154d=_0x15d730?_0x221c68[_0xcaa7('0x1d')]:_0x5b08c3[_0xcaa7('0x1e')]+_0x5b08c3[_0xcaa7('0x1c')];var _0x43bd9e;if(_0xdb154d>=_0x2f69e8){_0xdb154d=_0x2f69e8;_0x43bd9e=0xc8;}else{_0x43bd9e=0xce;}_0x15e41d[_0xcaa7('0x19')](_0x43bd9e);return _0x15e41d[_0xcaa7('0x1f')](_0xcaa7('0x20'),_0x1b482c+'-'+_0xdb154d+'/'+_0x2f69e8)['json'](_0x221c68);}return null;};}function patchUpdates(_0x123ef4){return function(_0x500b6f){try{jsonpatch[_0xcaa7('0x21')](_0x500b6f,_0x123ef4,!![]);}catch(_0x16437c){return BPromise[_0xcaa7('0x22')](_0x16437c);}return _0x500b6f[_0xcaa7('0x23')]();};}function saveUpdates(_0x59f6c6,_0x3751f6){return function(_0x229f2f){if(_0x229f2f){return _0x229f2f[_0xcaa7('0x24')](_0x59f6c6)[_0xcaa7('0x25')](function(_0x48f766){return _0x48f766;});}return null;};}function removeEntity(_0x33965d,_0x129fa9){return function(_0x45aacb){if(_0x45aacb){return _0x45aacb[_0xcaa7('0x26')]()[_0xcaa7('0x25')](function(){var _0x2fb1d4=_0x45aacb[_0xcaa7('0x27')]({'plain':!![]});var _0x438047=_0xcaa7('0x28');return db['UserProfileResource'][_0xcaa7('0x26')]({'where':{'type':_0x438047,'resourceId':_0x2fb1d4['id']}})[_0xcaa7('0x25')](function(){return _0x45aacb;});})[_0xcaa7('0x25')](function(){_0x33965d[_0xcaa7('0x19')](0xcc)[_0xcaa7('0x29')]();});}};}function handleEntityNotFound(_0xe46152,_0x473e74){return function(_0x454ee7){if(!_0x454ee7){_0xe46152[_0xcaa7('0x2a')](0x194);}return _0x454ee7;};}function handleError(_0x56c4ed,_0x23ed50){_0x23ed50=_0x23ed50||0x1f4;return function(_0x56e9c4){logger[_0xcaa7('0x2b')](_0x56e9c4[_0xcaa7('0x2c')]);if(_0x56e9c4[_0xcaa7('0x2d')]){delete _0x56e9c4['name'];}_0x56c4ed['status'](_0x23ed50)[_0xcaa7('0x2e')](_0x56e9c4);};}exports['index']=function(_0x36f380,_0x414c38){var _0x43a3d3={},_0x1626ce={},_0xa12bf2={'count':0x0,'rows':[]};var _0x37b157=_[_0xcaa7('0x2f')](db[_0xcaa7('0x30')][_0xcaa7('0x31')],function(_0x31ea70){return{'name':_0x31ea70[_0xcaa7('0x32')],'type':_0x31ea70[_0xcaa7('0x33')][_0xcaa7('0x34')]};});_0x1626ce[_0xcaa7('0x35')]=_['map'](_0x37b157,'name');_0x1626ce[_0xcaa7('0x36')]=_[_0xcaa7('0x37')](_0x36f380['query']);_0x1626ce['filters']=_[_0xcaa7('0x38')](_0x1626ce['model'],_0x1626ce[_0xcaa7('0x36')]);_0x43a3d3[_0xcaa7('0x39')]=_['intersection'](_0x1626ce['model'],qs[_0xcaa7('0x3a')](_0x36f380['query'][_0xcaa7('0x3a')]));_0x43a3d3[_0xcaa7('0x39')]=_0x43a3d3[_0xcaa7('0x39')][_0xcaa7('0x3b')]?_0x43a3d3[_0xcaa7('0x39')]:_0x1626ce['model'];if(!_0x36f380[_0xcaa7('0x36')][_0xcaa7('0x3c')](_0xcaa7('0x3d'))){_0x43a3d3['limit']=qs[_0xcaa7('0x1c')](_0x36f380['query'][_0xcaa7('0x1c')]);_0x43a3d3['offset']=qs['offset'](_0x36f380['query'][_0xcaa7('0x1e')]);}_0x43a3d3[_0xcaa7('0x3e')]=qs['sort'](_0x36f380[_0xcaa7('0x36')][_0xcaa7('0x3f')]);_0x43a3d3[_0xcaa7('0x40')]=qs[_0xcaa7('0x41')](_['pick'](_0x36f380[_0xcaa7('0x36')],_0x1626ce[_0xcaa7('0x41')]),_0x37b157);if(_0x36f380[_0xcaa7('0x36')][_0xcaa7('0x42')]){_0x43a3d3[_0xcaa7('0x40')]=_['merge'](_0x43a3d3[_0xcaa7('0x40')],{'$or':_[_0xcaa7('0x2f')](_0x37b157,function(_0x59fb39){if(_0x59fb39[_0xcaa7('0x33')]!==_0xcaa7('0x43')){var _0x5846ce={};_0x5846ce[_0x59fb39[_0xcaa7('0x2d')]]={'$like':'%'+_0x36f380[_0xcaa7('0x36')][_0xcaa7('0x42')]+'%'};return _0x5846ce;}})});}_0x43a3d3=_[_0xcaa7('0x44')]({},_0x43a3d3,_0x36f380[_0xcaa7('0x45')]);var _0x25fd83={'where':_0x43a3d3[_0xcaa7('0x40')]};return db[_0xcaa7('0x30')][_0xcaa7('0x1d')](_0x25fd83)[_0xcaa7('0x25')](function(_0x5307ea){_0xa12bf2[_0xcaa7('0x1d')]=_0x5307ea;if(_0x36f380[_0xcaa7('0x36')][_0xcaa7('0x46')]){_0x43a3d3[_0xcaa7('0x47')]=[{'all':!![]}];}return db[_0xcaa7('0x30')][_0xcaa7('0x48')](_0x43a3d3);})[_0xcaa7('0x25')](function(_0x4ab424){_0xa12bf2['rows']=_0x4ab424;return _0xa12bf2;})[_0xcaa7('0x25')](respondWithFilteredResult(_0x414c38,_0x43a3d3))[_0xcaa7('0x49')](handleError(_0x414c38,null));};exports[_0xcaa7('0x4a')]=function(_0xc54dad,_0x1d5416){var _0x24019a={'raw':![],'where':{'id':_0xc54dad[_0xcaa7('0x4b')]['id']}},_0x1f7cd2={};_0x1f7cd2[_0xcaa7('0x35')]=_[_0xcaa7('0x37')](db[_0xcaa7('0x30')][_0xcaa7('0x31')]);_0x1f7cd2[_0xcaa7('0x36')]=_[_0xcaa7('0x37')](_0xc54dad[_0xcaa7('0x36')]);_0x1f7cd2[_0xcaa7('0x41')]=_[_0xcaa7('0x38')](_0x1f7cd2['model'],_0x1f7cd2[_0xcaa7('0x36')]);_0x24019a['attributes']=_[_0xcaa7('0x38')](_0x1f7cd2['model'],qs[_0xcaa7('0x3a')](_0xc54dad[_0xcaa7('0x36')][_0xcaa7('0x3a')]));_0x24019a['attributes']=_0x24019a[_0xcaa7('0x39')][_0xcaa7('0x3b')]?_0x24019a[_0xcaa7('0x39')]:_0x1f7cd2['model'];if(_0xc54dad[_0xcaa7('0x36')][_0xcaa7('0x46')]){_0x24019a[_0xcaa7('0x47')]=[{'all':!![]}];}_0x24019a=_[_0xcaa7('0x44')]({},_0x24019a,_0xc54dad[_0xcaa7('0x45')]);return db['JscriptyProject'][_0xcaa7('0x4c')](_0x24019a)[_0xcaa7('0x25')](handleEntityNotFound(_0x1d5416,null))['then'](respondWithResult(_0x1d5416,null))[_0xcaa7('0x49')](handleError(_0x1d5416,null));};exports[_0xcaa7('0x4d')]=function(_0x154ecc,_0xb6900f){return db[_0xcaa7('0x30')][_0xcaa7('0x4d')](_0x154ecc[_0xcaa7('0x4e')],{})[_0xcaa7('0x25')](function(_0x37fc5a){var _0x522fc3=_0x154ecc['user'][_0xcaa7('0x27')]({'plain':!![]});if(!_0x522fc3)throw new Error(_0xcaa7('0x4f'));if(_0x522fc3['role']===_0xcaa7('0x50')){var _0x3b2df9=_0x37fc5a['get']({'plain':!![]});var _0x5d9ade=_0xcaa7('0x28');return db[_0xcaa7('0x51')][_0xcaa7('0x4c')]({'where':{'name':_0x5d9ade,'userProfileId':_0x522fc3[_0xcaa7('0x52')]},'raw':!![]})[_0xcaa7('0x25')](function(_0x17501b){if(_0x17501b&&_0x17501b[_0xcaa7('0x53')]===0x0){return db[_0xcaa7('0x54')][_0xcaa7('0x4d')]({'name':_0x3b2df9[_0xcaa7('0x2d')],'resourceId':_0x3b2df9['id'],'type':_0x17501b[_0xcaa7('0x2d')],'sectionId':_0x17501b['id']},{})[_0xcaa7('0x25')](function(){return _0x37fc5a;});}else{return _0x37fc5a;}})[_0xcaa7('0x49')](function(_0x21603d){logger['error'](_0xcaa7('0x55'),_0x21603d);throw _0x21603d;});}return _0x37fc5a;})[_0xcaa7('0x25')](respondWithResult(_0xb6900f,0xc9))[_0xcaa7('0x49')](handleError(_0xb6900f,null));};exports[_0xcaa7('0x56')]=function(_0x238e39,_0x5d40ef){var _0x366c8e={'where':{'id':_0x238e39[_0xcaa7('0x4b')]['id']}},_0x33b8e2={};_0x33b8e2[_0xcaa7('0x35')]=_[_0xcaa7('0x37')](db[_0xcaa7('0x30')][_0xcaa7('0x31')]);_0x366c8e[_0xcaa7('0x39')]=_['intersection'](_0x33b8e2[_0xcaa7('0x35')],qs['fields'](_0x238e39[_0xcaa7('0x36')][_0xcaa7('0x3a')]));_0x366c8e[_0xcaa7('0x39')]=_0x366c8e[_0xcaa7('0x39')]['length']?_0x366c8e['attributes']:_0x33b8e2['model'];if(_0x238e39['query'][_0xcaa7('0x46')]){_0x366c8e['include']=[{'all':!![]}];}_0x366c8e=_['merge']({},_0x366c8e,_0x238e39[_0xcaa7('0x45')]);return db[_0xcaa7('0x30')]['find'](_0x366c8e)[_0xcaa7('0x25')](handleEntityNotFound(_0x5d40ef,null))[_0xcaa7('0x25')](function(_0x30c542){if(_0x30c542){var _0x1a0de2=_0x30c542[_0xcaa7('0x27')]({'plain':!![]});_0x1a0de2=qs[_0xcaa7('0x57')](_0x1a0de2,['id','createdAt',_0xcaa7('0x58')]);_0x238e39[_0xcaa7('0x4e')]=_['omit'](_0x238e39[_0xcaa7('0x4e')],['id',_0xcaa7('0x59'),_0xcaa7('0x58')]);return db[_0xcaa7('0x30')][_0xcaa7('0x4d')](_[_0xcaa7('0x44')](_0x1a0de2,_0x238e39[_0xcaa7('0x4e')]),{'include':_0x238e39[_0xcaa7('0x36')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x49169b){var _0x19271a=_0x238e39['user']['get']({'plain':!![]});if(!_0x19271a)throw new Error(_0xcaa7('0x4f'));if(_0x19271a[_0xcaa7('0x5a')]===_0xcaa7('0x50')){var _0x46621e=_0x49169b[_0xcaa7('0x27')]({'plain':!![]});var _0x2a25d0=_0xcaa7('0x28');return db[_0xcaa7('0x51')][_0xcaa7('0x4c')]({'where':{'name':_0x2a25d0,'userProfileId':_0x19271a[_0xcaa7('0x52')]},'raw':!![]})[_0xcaa7('0x25')](function(_0x493ac8){if(_0x493ac8&&_0x493ac8[_0xcaa7('0x53')]===0x0){return db[_0xcaa7('0x54')][_0xcaa7('0x4d')]({'name':_0x46621e[_0xcaa7('0x2d')],'resourceId':_0x46621e['id'],'type':_0x493ac8[_0xcaa7('0x2d')],'sectionId':_0x493ac8['id']},{})['then'](function(){return _0x49169b;});}else{return _0x49169b;}})[_0xcaa7('0x49')](function(_0x35771b){logger[_0xcaa7('0x2b')](_0xcaa7('0x55'),_0x35771b);throw _0x35771b;});}return _0x49169b;});}})[_0xcaa7('0x25')](respondWithResult(_0x5d40ef,0xc9))['catch'](handleError(_0x5d40ef,null));};exports[_0xcaa7('0x24')]=function(_0x4c3b1e,_0x20e697){if(_0x4c3b1e[_0xcaa7('0x4e')]['id']){delete _0x4c3b1e[_0xcaa7('0x4e')]['id'];}return db[_0xcaa7('0x30')][_0xcaa7('0x4c')]({'where':{'id':_0x4c3b1e[_0xcaa7('0x4b')]['id']}})[_0xcaa7('0x25')](handleEntityNotFound(_0x20e697,null))[_0xcaa7('0x25')](saveUpdates(_0x4c3b1e[_0xcaa7('0x4e')],null))[_0xcaa7('0x25')](respondWithResult(_0x20e697,null))[_0xcaa7('0x49')](handleError(_0x20e697,null));};exports[_0xcaa7('0x26')]=function(_0x457d53,_0x4ec6b3){return db[_0xcaa7('0x30')][_0xcaa7('0x4c')]({'where':{'id':_0x457d53[_0xcaa7('0x4b')]['id']}})[_0xcaa7('0x25')](handleEntityNotFound(_0x4ec6b3,null))[_0xcaa7('0x25')](removeEntity(_0x4ec6b3,null))[_0xcaa7('0x49')](handleError(_0x4ec6b3,null));};exports['getSessions']=function(_0x576e4e,_0x4c15d5,_0x386c9e){var _0x1d5978={'raw':!![],'where':{}};var _0x170367={};var _0x919b9={'count':0x0,'rows':[]};return db[_0xcaa7('0x30')][_0xcaa7('0x5b')]({'where':{'id':_0x576e4e[_0xcaa7('0x4b')]['id']}})[_0xcaa7('0x25')](handleEntityNotFound(_0x4c15d5,null))[_0xcaa7('0x25')](function(_0x90313f){if(_0x90313f){_0x170367['model']=_[_0xcaa7('0x37')](db[_0xcaa7('0x5c')]['rawAttributes']);_0x170367['query']=_['keys'](_0x576e4e['query']);_0x170367[_0xcaa7('0x41')]=_[_0xcaa7('0x38')](_0x170367['model'],_0x170367['query']);_0x1d5978[_0xcaa7('0x39')]=_['intersection'](_0x170367[_0xcaa7('0x35')],qs['fields'](_0x576e4e[_0xcaa7('0x36')]['fields']));_0x1d5978[_0xcaa7('0x39')]=_0x1d5978[_0xcaa7('0x39')]['length']?_0x1d5978[_0xcaa7('0x39')]:_0x170367[_0xcaa7('0x35')];if(!_0x576e4e[_0xcaa7('0x36')]['hasOwnProperty'](_0xcaa7('0x3d'))){_0x1d5978['limit']=qs[_0xcaa7('0x1c')](_0x576e4e[_0xcaa7('0x36')][_0xcaa7('0x1c')]);_0x1d5978[_0xcaa7('0x1e')]=qs[_0xcaa7('0x1e')](_0x576e4e[_0xcaa7('0x36')][_0xcaa7('0x1e')]);}_0x1d5978[_0xcaa7('0x3e')]=qs[_0xcaa7('0x3f')](_0x576e4e[_0xcaa7('0x36')]['sort']);_0x1d5978['where']=qs[_0xcaa7('0x41')](_[_0xcaa7('0x5d')](_0x576e4e['query'],_0x170367[_0xcaa7('0x41')]));_0x1d5978[_0xcaa7('0x40')][_0xcaa7('0x5e')]=_0x90313f['id'];if(_0x576e4e[_0xcaa7('0x36')][_0xcaa7('0x42')]){_0x1d5978[_0xcaa7('0x40')]=_[_0xcaa7('0x44')](_0x1d5978[_0xcaa7('0x40')],{'$or':_[_0xcaa7('0x2f')](_0x1d5978[_0xcaa7('0x39')],function(_0x416f44){var _0x2444ea={};_0x2444ea[_0x416f44]={'$like':'%'+_0x576e4e[_0xcaa7('0x36')][_0xcaa7('0x42')]+'%'};return _0x2444ea;})});}_0x1d5978=_[_0xcaa7('0x44')]({},_0x1d5978,_0x576e4e['options']);return db[_0xcaa7('0x5c')]['count']({'where':_0x1d5978[_0xcaa7('0x40')]})[_0xcaa7('0x25')](function(_0xcc844e){_0x919b9[_0xcaa7('0x1d')]=_0xcc844e;if(_0x576e4e[_0xcaa7('0x36')][_0xcaa7('0x46')]){_0x1d5978[_0xcaa7('0x47')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xcaa7('0x48')](_0x1d5978);})[_0xcaa7('0x25')](function(_0x4bef55){_0x919b9[_0xcaa7('0x5f')]=_0x4bef55;return _0x919b9;});}})['then'](respondWithFilteredResult(_0x4c15d5,_0x1d5978))[_0xcaa7('0x49')](handleError(_0x4c15d5,null));};exports[_0xcaa7('0x60')]=function(_0x483ca1,_0x53c72f,_0x4ca5ca){var _0xfab4f0={'raw':!![],'where':{}};var _0x51dd4d={};var _0x4e77e4={'count':0x0,'rows':[]};return db[_0xcaa7('0x30')][_0xcaa7('0x5b')]({'where':{'id':_0x483ca1[_0xcaa7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x53c72f,null))[_0xcaa7('0x25')](function(_0x32b5a0){if(_0x32b5a0){_0x51dd4d[_0xcaa7('0x35')]=_[_0xcaa7('0x37')](db['JscriptyAnswerReport']['rawAttributes']);_0x51dd4d[_0xcaa7('0x36')]=_[_0xcaa7('0x37')](_0x483ca1[_0xcaa7('0x36')]);_0x51dd4d[_0xcaa7('0x41')]=_['intersection'](_0x51dd4d[_0xcaa7('0x35')],_0x51dd4d[_0xcaa7('0x36')]);_0xfab4f0[_0xcaa7('0x39')]=_[_0xcaa7('0x38')](_0x51dd4d['model'],qs['fields'](_0x483ca1[_0xcaa7('0x36')][_0xcaa7('0x3a')]));_0xfab4f0[_0xcaa7('0x39')]=_0xfab4f0[_0xcaa7('0x39')]['length']?_0xfab4f0[_0xcaa7('0x39')]:_0x51dd4d['model'];if(!_0x483ca1[_0xcaa7('0x36')][_0xcaa7('0x3c')](_0xcaa7('0x3d'))){_0xfab4f0[_0xcaa7('0x1c')]=qs[_0xcaa7('0x1c')](_0x483ca1[_0xcaa7('0x36')]['limit']);_0xfab4f0[_0xcaa7('0x1e')]=qs['offset'](_0x483ca1[_0xcaa7('0x36')][_0xcaa7('0x1e')]);}_0xfab4f0['order']=qs[_0xcaa7('0x3f')](_0x483ca1[_0xcaa7('0x36')]['sort']);_0xfab4f0[_0xcaa7('0x40')]=qs[_0xcaa7('0x41')](_[_0xcaa7('0x5d')](_0x483ca1[_0xcaa7('0x36')],_0x51dd4d[_0xcaa7('0x41')]));_0xfab4f0[_0xcaa7('0x40')][_0xcaa7('0x5e')]=_0x32b5a0['id'];if(_0x483ca1[_0xcaa7('0x36')]['filter']){_0xfab4f0[_0xcaa7('0x40')]=_[_0xcaa7('0x44')](_0xfab4f0[_0xcaa7('0x40')],{'$or':_[_0xcaa7('0x2f')](_0xfab4f0['attributes'],function(_0x420d8c){var _0x12b528={};_0x12b528[_0x420d8c]={'$like':'%'+_0x483ca1[_0xcaa7('0x36')]['filter']+'%'};return _0x12b528;})});}_0xfab4f0=_[_0xcaa7('0x44')]({},_0xfab4f0,_0x483ca1[_0xcaa7('0x45')]);return db[_0xcaa7('0x61')][_0xcaa7('0x1d')]({'where':_0xfab4f0['where']})[_0xcaa7('0x25')](function(_0x1331d2){_0x4e77e4[_0xcaa7('0x1d')]=_0x1331d2;if(_0x483ca1[_0xcaa7('0x36')]['includeAll']){_0xfab4f0[_0xcaa7('0x47')]=[{'all':!![]}];}return db[_0xcaa7('0x61')][_0xcaa7('0x48')](_0xfab4f0);})[_0xcaa7('0x25')](function(_0x384ab1){_0x4e77e4[_0xcaa7('0x5f')]=_0x384ab1;return _0x4e77e4;});}})[_0xcaa7('0x25')](respondWithFilteredResult(_0x53c72f,_0xfab4f0))['catch'](handleError(_0x53c72f,null));};function char(_0x5943a3){return _0xcaa7('0x62')===typeof _0x5943a3?String[_0xcaa7('0x63')]['apply'](null,arguments):_0x5943a3;}function needsEncapsulation(_0x1cb29d){return!!_0x1cb29d&&(_0x1cb29d[_0xcaa7('0x64')]()[_0xcaa7('0x65')](char(0xd))>=0x0||_0x1cb29d['toString']()[_0xcaa7('0x65')](char(0xa))>=0x0||_0x1cb29d[_0xcaa7('0x64')]()[_0xcaa7('0x65')](char(0x2c))>=0x0||_0x1cb29d[_0xcaa7('0x64')]()[_0xcaa7('0x65')](char(0x22))>=0x0);}function encapsulate(_0x42b118){var _0x10be97=char(0x22),_0x3d7ba8='\x5c'+char(0x22),_0xbf181c=_0x42b118[_0xcaa7('0x64')]()[_0xcaa7('0x66')](new RegExp(_0x10be97,'g'),_0x3d7ba8);return _0x10be97+_0xbf181c+_0x10be97;}exports[_0xcaa7('0x67')]=function(_0x1cb017,_0x27c5e6,_0x19fa50){var _0x3e17f6,_0x29cf83;var _0x21e971={'where':{'ProjectId':_0x1cb017['params']['id']}};if(_0x1cb017[_0xcaa7('0x36')]['startTime']){_0x21e971[_0xcaa7('0x40')]['starttime']=JSON[_0xcaa7('0x68')](_0x1cb017[_0xcaa7('0x36')][_0xcaa7('0x69')]);}return db['JscriptySessionReport'][_0xcaa7('0x48')](_0x21e971)[_0xcaa7('0x25')](handleEntityNotFound(_0x27c5e6,null))['then'](function(_0x2fad0e){if(_0x2fad0e){_0x3e17f6=_0x2fad0e;return db[_0xcaa7('0x6a')][_0xcaa7('0x48')]({'where':{'SessionId':{'$in':_[_0xcaa7('0x2f')](_0x3e17f6,'id')},'ProjectId':_0x1cb017[_0xcaa7('0x4b')]['id']},'order':_0xcaa7('0x6b')});}})[_0xcaa7('0x25')](handleEntityNotFound(_0x27c5e6,null))[_0xcaa7('0x25')](function(_0x37a165){if(_0x37a165){_0x29cf83=_0x37a165;var _0x1cd578={};for(var _0x5cb5bd=0x0,_0x9c9254=_0x29cf83[_0xcaa7('0x3b')];_0x5cb5bd<_0x9c9254;_0x5cb5bd++){if(!_0x1cd578[_0xcaa7('0x3c')](_0x29cf83[_0x5cb5bd]['questionId'])){_0x1cd578[_0x29cf83[_0x5cb5bd][_0xcaa7('0x6c')]]=needsEncapsulation(_0x29cf83[_0x5cb5bd]['question'])?encapsulate(_0x29cf83[_0x5cb5bd]['question']):_0x29cf83[_0x5cb5bd]['question'];}}var _0xb141e6=[],_0x284786={};for(var _0x2ed523=0x0,_0x3e4c78=_0x3e17f6[_0xcaa7('0x3b')];_0x2ed523<_0x3e4c78;_0x2ed523++){_0x284786={'ProjectId':_0x1cb017[_0xcaa7('0x4b')]['id'],'SessionId':_0x3e17f6[_0x2ed523]['id'],'StartTime':moment(_0x3e17f6[_0x2ed523]['starttime'])['format'](_0xcaa7('0x6d'))};for(var _0x7f2fe6=0x0,_0x26a871=_0x29cf83['length'];_0x7f2fe6<_0x26a871;_0x7f2fe6++){if(_0x29cf83[_0x7f2fe6][_0xcaa7('0x6e')]==_0x3e17f6[_0x2ed523]['id']&&_0x1cd578[_0xcaa7('0x3c')](_0x29cf83[_0x7f2fe6][_0xcaa7('0x6c')])){_0x284786[_0x1cd578[_0x29cf83[_0x7f2fe6]['questionId']]]=_0x29cf83[_0x7f2fe6][_0xcaa7('0x6f')];}}for(var _0x125e82 in _0x1cd578){if(!_0x284786[_0xcaa7('0x3c')](_0x1cd578[_0x125e82])){_0x284786[_0x1cd578[_0x125e82]]=null;}}_0xb141e6['push'](_0x284786);}return _0xb141e6;}})[_0xcaa7('0x25')](function(_0x357bae){if(!_[_0xcaa7('0x70')](_0x357bae)){var _0x297935=toCsv(_0x357bae);var _0x33eaa9=Date[_0xcaa7('0x71')]();fs[_0xcaa7('0x72')](util['format'](_0xcaa7('0x73'),_0x1cb017[_0xcaa7('0x4b')]['id'],_0x33eaa9),_0x297935);_0x27c5e6[_0xcaa7('0x74')](_0xcaa7('0x75'),'attachment;\x20filename='+util[_0xcaa7('0x76')]('Jscripty_Project_%d_Summary_%s.csv',_0x1cb017['params']['id'],_0x33eaa9));_0x27c5e6[_0xcaa7('0x74')](_0xcaa7('0x77'),_0xcaa7('0x78'));return _0x27c5e6[_0xcaa7('0x79')](util[_0xcaa7('0x76')](_0xcaa7('0x73'),_0x1cb017['params']['id'],_0x33eaa9));}else{return _0x27c5e6[_0xcaa7('0x2a')](0xcc);}})[_0xcaa7('0x49')](handleError(_0x27c5e6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index f99a5ae..95280ba 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 _0x96aa=['request-promise','path','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','api','moment','bluebird'];(function(_0x2b9bfe,_0x5b6168){var _0x5cfdfb=function(_0x4a8022){while(--_0x4a8022){_0x2b9bfe['push'](_0x2b9bfe['shift']());}};_0x5cfdfb(++_0x5b6168);}(_0x96aa,0x67));var _0xa96a=function(_0x42e565,_0x2bbfa3){_0x42e565=_0x42e565-0x0;var _0x1815e8=_0x96aa[_0x42e565];return _0x1815e8;};'use strict';var _=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var logger=require('../../config/logger')(_0xa96a('0x2'));var moment=require(_0xa96a('0x3'));var BPromise=require(_0xa96a('0x4'));var rp=require(_0xa96a('0x5'));var fs=require('fs');var path=require(_0xa96a('0x6'));var rimraf=require('rimraf');var config=require(_0xa96a('0x7'));var attributes=require(_0xa96a('0x8'));module['exports']=function(_0x464684,_0x2e9a41){return _0x464684[_0xa96a('0x9')](_0xa96a('0xa'),attributes,{'tableName':_0xa96a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f5d=['define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports'];(function(_0x559b28,_0x17f820){var _0x25b7dd=function(_0x1b3d0d){while(--_0x1b3d0d){_0x559b28['push'](_0x559b28['shift']());}};_0x25b7dd(++_0x17f820);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4f5d[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd4f5('0x0'));var util=require(_0xd4f5('0x1'));var logger=require(_0xd4f5('0x2'))(_0xd4f5('0x3'));var moment=require(_0xd4f5('0x4'));var BPromise=require(_0xd4f5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4f5('0x6'));var rimraf=require(_0xd4f5('0x7'));var config=require(_0xd4f5('0x8'));var attributes=require(_0xd4f5('0x9'));module[_0xd4f5('0xa')]=function(_0x2c44bb,_0x121bfd){return _0x2c44bb[_0xd4f5('0xb')](_0xd4f5('0xc'),attributes,{'tableName':_0xd4f5('0xd'),'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 832dfa1..e36626f 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x316904,_0x1e8b77){var _0xfa9a21=function(_0x2b75ae){while(--_0x2b75ae){_0x316904['push'](_0x316904['shift']());}};_0xfa9a21(++_0x1e8b77);}(_0xda3f,0xec));var _0xfda3=function(_0x59d7aa,_0x1330c5){_0x59d7aa=_0x59d7aa-0x0;var _0x3d3f1e=_0xda3f[_0x59d7aa];return _0x3d3f1e;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _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(_0xb2f8fd,_0x197eae){var _0x5f5001=function(_0x20202c){while(--_0x20202c){_0xb2f8fd['push'](_0xb2f8fd['shift']());}};_0x5f5001(++_0x197eae);}(_0x70e0,0x17b));var _0x070e=function(_0x485ad5,_0x13e5a0){_0x485ad5=_0x485ad5-0x0;var _0x30eb92=_0x70e0[_0x485ad5];return _0x30eb92;};'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 diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 5d64e34..f052e73 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 _0x8501=['multer','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/describe','describe','show','post','put','/:id','update','destroy','exports'];(function(_0x16b1b8,_0x432d03){var _0x558b1e=function(_0xf47f2f){while(--_0xf47f2f){_0x16b1b8['push'](_0x16b1b8['shift']());}};_0x558b1e(++_0x432d03);}(_0x8501,0x96));var _0x1850=function(_0x52949d,_0x5750ec){_0x52949d=_0x52949d-0x0;var _0x570250=_0x8501[_0x52949d];return _0x570250;};'use strict';var multer=require(_0x1850('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1850('0x1')]();var fs_extra=require(_0x1850('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1850('0x3'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0x1850('0x4')]('/',auth[_0x1850('0x5')](),controller['index']);router[_0x1850('0x4')](_0x1850('0x6'),auth['isAuthenticated'](),controller[_0x1850('0x7')]);router[_0x1850('0x4')]('/:id',auth[_0x1850('0x5')](),controller[_0x1850('0x8')]);router[_0x1850('0x9')]('/',auth[_0x1850('0x5')](),controller['create']);router[_0x1850('0xa')](_0x1850('0xb'),auth['isAuthenticated'](),controller[_0x1850('0xc')]);router['delete']('/:id',auth[_0x1850('0x5')](),controller[_0x1850('0xd')]);module[_0x1850('0xe')]=router; \ No newline at end of file +var _0x68a9=['/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x44bf8b,_0x3c8bef){var _0x158f48=function(_0x49cd01){while(--_0x49cd01){_0x44bf8b['push'](_0x44bf8b['shift']());}};_0x158f48(++_0x3c8bef);}(_0x68a9,0xbb));var _0x968a=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x68a9[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x968a('0x0'));var util=require(_0x968a('0x1'));var path=require(_0x968a('0x2'));var timeout=require(_0x968a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x968a('0x4'));var auth=require(_0x968a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x968a('0x6'));var controller=require('./jscriptyQuestionReport.controller');router[_0x968a('0x7')]('/',auth[_0x968a('0x8')](),controller[_0x968a('0x9')]);router[_0x968a('0x7')](_0x968a('0xa'),auth[_0x968a('0x8')](),controller['describe']);router[_0x968a('0x7')](_0x968a('0xb'),auth[_0x968a('0x8')](),controller[_0x968a('0xc')]);router[_0x968a('0xd')]('/',auth[_0x968a('0x8')](),controller[_0x968a('0xe')]);router['put'](_0x968a('0xb'),auth[_0x968a('0x8')](),controller[_0x968a('0xf')]);router[_0x968a('0x10')]('/:id',auth[_0x968a('0x8')](),controller['destroy']);module[_0x968a('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 2c824c3..e7086ac 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x2e7d9c,_0x4b3bd7){_0x2e7d9c=_0x2e7d9c-0x0;var _0x295b81=_0x7a54[_0x2e7d9c];return _0x295b81;};'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(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x7a54,0x106));var _0x47a5=function(_0x3dea64,_0xf310ea){_0x3dea64=_0x3dea64-0x0;var _0x22a5d2=_0x7a54[_0x3dea64];return _0x22a5d2;};'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 e5ea60f..d7a958f 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 _0x276b=['limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','find','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0x451254,_0x494da1){var _0x262acb=function(_0x5af3e8){while(--_0x5af3e8){_0x451254['push'](_0x451254['shift']());}};_0x262acb(++_0x494da1);}(_0x276b,0x7c));var _0xb276=function(_0x4f1c24,_0x31a667){_0x4f1c24=_0x4f1c24-0x0;var _0x220baa=_0x276b[_0x4f1c24];return _0x220baa;};'use strict';var emlformat=require(_0xb276('0x0'));var rimraf=require(_0xb276('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb276('0x2'));var rp=require(_0xb276('0x3'));var moment=require(_0xb276('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb276('0x5'));var path=require(_0xb276('0x6'));var sox=require(_0xb276('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb276('0x8'));var _=require('lodash');var squel=require(_0xb276('0x9'));var crypto=require(_0xb276('0xa'));var jsforce=require(_0xb276('0xb'));var deskjs=require(_0xb276('0xc'));var toCsv=require(_0xb276('0xd'));var querystring=require(_0xb276('0xe'));var Papa=require('papaparse');var Redis=require(_0xb276('0xf'));var authService=require(_0xb276('0x10'));var qs=require(_0xb276('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb276('0x12'))('api');var utils=require(_0xb276('0x13'));var config=require(_0xb276('0x14'));var licenseUtil=require(_0xb276('0x15'));var db=require(_0xb276('0x16'))['db'];function respondWithStatusCode(_0x1896e7,_0x3ffd00){_0x3ffd00=_0x3ffd00||0xcc;return function(_0x22d861){if(_0x22d861){return _0x1896e7[_0xb276('0x17')](_0x3ffd00);}return _0x1896e7[_0xb276('0x18')](_0x3ffd00)[_0xb276('0x19')]();};}function respondWithResult(_0x1700da,_0x1ad578){_0x1ad578=_0x1ad578||0xc8;return function(_0x504643){if(_0x504643){return _0x1700da['status'](_0x1ad578)[_0xb276('0x1a')](_0x504643);}};}function respondWithFilteredResult(_0x2690d1,_0x3fd6a7){return function(_0x1dc5b7){if(_0x1dc5b7){var _0x3eaf7c=typeof _0x3fd6a7[_0xb276('0x1b')]===_0xb276('0x1c')&&typeof _0x3fd6a7['limit']==='undefined';var _0x2ae712=_0x1dc5b7[_0xb276('0x1d')];var _0x156849=_0x3eaf7c?0x0:_0x3fd6a7[_0xb276('0x1b')];var _0x4b2d43=_0x3eaf7c?_0x1dc5b7[_0xb276('0x1d')]:_0x3fd6a7[_0xb276('0x1b')]+_0x3fd6a7[_0xb276('0x1e')];var _0x57351f;if(_0x4b2d43>=_0x2ae712){_0x4b2d43=_0x2ae712;_0x57351f=0xc8;}else{_0x57351f=0xce;}_0x2690d1[_0xb276('0x18')](_0x57351f);return _0x2690d1[_0xb276('0x1f')](_0xb276('0x20'),_0x156849+'-'+_0x4b2d43+'/'+_0x2ae712)[_0xb276('0x1a')](_0x1dc5b7);}return null;};}function patchUpdates(_0xfed44a){return function(_0x413e00){try{jsonpatch[_0xb276('0x21')](_0x413e00,_0xfed44a,!![]);}catch(_0x42f0b9){return BPromise[_0xb276('0x22')](_0x42f0b9);}return _0x413e00[_0xb276('0x23')]();};}function saveUpdates(_0x502322,_0x4db267){return function(_0x2dd820){if(_0x2dd820){return _0x2dd820[_0xb276('0x24')](_0x502322)[_0xb276('0x25')](function(_0x90f9da){return _0x90f9da;});}return null;};}function removeEntity(_0x173bed,_0x44310e){return function(_0x447784){if(_0x447784){return _0x447784['destroy']()['then'](function(){_0x173bed[_0xb276('0x18')](0xcc)[_0xb276('0x19')]();});}};}function handleEntityNotFound(_0x2e4873,_0x17dab8){return function(_0x2db8c6){if(!_0x2db8c6){_0x2e4873[_0xb276('0x17')](0x194);}return _0x2db8c6;};}function handleError(_0x1e5ba0,_0x1b7811){_0x1b7811=_0x1b7811||0x1f4;return function(_0x2d87bc){logger[_0xb276('0x26')](_0x2d87bc[_0xb276('0x27')]);if(_0x2d87bc[_0xb276('0x28')]){delete _0x2d87bc[_0xb276('0x28')];}_0x1e5ba0[_0xb276('0x18')](_0x1b7811)[_0xb276('0x29')](_0x2d87bc);};}exports[_0xb276('0x2a')]=function(_0xcaf09,_0x206c77){var _0x17ed9b={},_0x386c89={},_0x59fc0c={'count':0x0,'rows':[]};var _0x41e458=_[_0xb276('0x2b')](db[_0xb276('0x2c')][_0xb276('0x2d')],function(_0x271f62){return{'name':_0x271f62[_0xb276('0x2e')],'type':_0x271f62[_0xb276('0x2f')][_0xb276('0x30')]};});_0x386c89['model']=_[_0xb276('0x2b')](_0x41e458,'name');_0x386c89['query']=_[_0xb276('0x31')](_0xcaf09[_0xb276('0x32')]);_0x386c89[_0xb276('0x33')]=_[_0xb276('0x34')](_0x386c89[_0xb276('0x35')],_0x386c89[_0xb276('0x32')]);_0x17ed9b[_0xb276('0x36')]=_['intersection'](_0x386c89[_0xb276('0x35')],qs[_0xb276('0x37')](_0xcaf09[_0xb276('0x32')][_0xb276('0x37')]));_0x17ed9b[_0xb276('0x36')]=_0x17ed9b[_0xb276('0x36')][_0xb276('0x38')]?_0x17ed9b[_0xb276('0x36')]:_0x386c89[_0xb276('0x35')];if(!_0xcaf09[_0xb276('0x32')][_0xb276('0x39')](_0xb276('0x3a'))){_0x17ed9b[_0xb276('0x1e')]=qs[_0xb276('0x1e')](_0xcaf09[_0xb276('0x32')][_0xb276('0x1e')]);_0x17ed9b[_0xb276('0x1b')]=qs[_0xb276('0x1b')](_0xcaf09[_0xb276('0x32')][_0xb276('0x1b')]);}_0x17ed9b[_0xb276('0x3b')]=qs[_0xb276('0x3c')](_0xcaf09[_0xb276('0x32')][_0xb276('0x3c')]);_0x17ed9b[_0xb276('0x3d')]=qs[_0xb276('0x33')](_['pick'](_0xcaf09[_0xb276('0x32')],_0x386c89[_0xb276('0x33')]),_0x41e458);if(_0xcaf09[_0xb276('0x32')]['filter']){_0x17ed9b['where']=_[_0xb276('0x3e')](_0x17ed9b[_0xb276('0x3d')],{'$or':_['map'](_0x41e458,function(_0x2c7af7){if(_0x2c7af7[_0xb276('0x2f')]!==_0xb276('0x3f')){var _0x110e38={};_0x110e38[_0x2c7af7[_0xb276('0x28')]]={'$like':'%'+_0xcaf09[_0xb276('0x32')][_0xb276('0x40')]+'%'};return _0x110e38;}})});}_0x17ed9b=_['merge']({},_0x17ed9b,_0xcaf09[_0xb276('0x41')]);var _0x1f1e5a={'where':_0x17ed9b[_0xb276('0x3d')]};return db[_0xb276('0x2c')][_0xb276('0x1d')](_0x1f1e5a)['then'](function(_0x23b3ee){_0x59fc0c[_0xb276('0x1d')]=_0x23b3ee;if(_0xcaf09[_0xb276('0x32')][_0xb276('0x42')]){_0x17ed9b[_0xb276('0x43')]=[{'all':!![]}];}return db[_0xb276('0x2c')]['findAll'](_0x17ed9b);})[_0xb276('0x25')](function(_0x14abee){_0x59fc0c[_0xb276('0x44')]=_0x14abee;return _0x59fc0c;})['then'](respondWithFilteredResult(_0x206c77,_0x17ed9b))[_0xb276('0x45')](handleError(_0x206c77,null));};exports[_0xb276('0x46')]=function(_0x245e09,_0x361cff){var _0x359a30={'raw':!![],'where':{'id':_0x245e09['params']['id']}},_0x322288={};_0x322288[_0xb276('0x35')]=_[_0xb276('0x31')](db[_0xb276('0x2c')]['rawAttributes']);_0x322288['query']=_[_0xb276('0x31')](_0x245e09['query']);_0x322288['filters']=_[_0xb276('0x34')](_0x322288['model'],_0x322288[_0xb276('0x32')]);_0x359a30['attributes']=_[_0xb276('0x34')](_0x322288['model'],qs[_0xb276('0x37')](_0x245e09['query']['fields']));_0x359a30[_0xb276('0x36')]=_0x359a30[_0xb276('0x36')][_0xb276('0x38')]?_0x359a30[_0xb276('0x36')]:_0x322288['model'];if(_0x245e09['query'][_0xb276('0x42')]){_0x359a30['include']=[{'all':!![]}];}_0x359a30=_[_0xb276('0x3e')]({},_0x359a30,_0x245e09[_0xb276('0x41')]);return db[_0xb276('0x2c')][_0xb276('0x47')](_0x359a30)['then'](handleEntityNotFound(_0x361cff,null))[_0xb276('0x25')](respondWithResult(_0x361cff,null))[_0xb276('0x45')](handleError(_0x361cff,null));};exports[_0xb276('0x48')]=function(_0x152c8d,_0x3524f6){return db[_0xb276('0x2c')][_0xb276('0x48')](_0x152c8d[_0xb276('0x49')],{})[_0xb276('0x25')](respondWithResult(_0x3524f6,0xc9))[_0xb276('0x45')](handleError(_0x3524f6,null));};exports[_0xb276('0x24')]=function(_0x387dc8,_0x45b0d2){if(_0x387dc8[_0xb276('0x49')]['id']){delete _0x387dc8[_0xb276('0x49')]['id'];}return db[_0xb276('0x2c')][_0xb276('0x47')]({'where':{'id':_0x387dc8[_0xb276('0x4a')]['id']}})[_0xb276('0x25')](handleEntityNotFound(_0x45b0d2,null))['then'](saveUpdates(_0x387dc8[_0xb276('0x49')],null))[_0xb276('0x25')](respondWithResult(_0x45b0d2,null))['catch'](handleError(_0x45b0d2,null));};exports[_0xb276('0x4b')]=function(_0x5769fc,_0x17a25c){return db[_0xb276('0x2c')][_0xb276('0x47')]({'where':{'id':_0x5769fc[_0xb276('0x4a')]['id']}})[_0xb276('0x25')](handleEntityNotFound(_0x17a25c,null))[_0xb276('0x25')](removeEntity(_0x17a25c,null))[_0xb276('0x45')](handleError(_0x17a25c,null));};exports[_0xb276('0x4c')]=function(_0xf30f0a,_0x3eb1b5){return db[_0xb276('0x2c')][_0xb276('0x4c')]()['then'](respondWithResult(_0x3eb1b5,null))[_0xb276('0x45')](handleError(_0x3eb1b5,null));}; \ No newline at end of file +var _0x6d0b=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x4ff346,_0x146e5d){var _0x9c63a4=function(_0x253d24){while(--_0x253d24){_0x4ff346['push'](_0x4ff346['shift']());}};_0x9c63a4(++_0x146e5d);}(_0x6d0b,0x168));var _0xb6d0=function(_0x34627f,_0x1d51a1){_0x34627f=_0x34627f-0x0;var _0x915bff=_0x6d0b[_0x34627f];return _0x915bff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb6d0('0x0'));var zipdir=require(_0xb6d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6d0('0x2'));var moment=require(_0xb6d0('0x3'));var BPromise=require(_0xb6d0('0x4'));var Mustache=require(_0xb6d0('0x5'));var util=require(_0xb6d0('0x6'));var path=require(_0xb6d0('0x7'));var sox=require(_0xb6d0('0x8'));var csv=require('to-csv');var ejs=require(_0xb6d0('0x9'));var fs=require('fs');var fs_extra=require(_0xb6d0('0xa'));var _=require('lodash');var squel=require(_0xb6d0('0xb'));var crypto=require(_0xb6d0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb6d0('0xd'));var toCsv=require(_0xb6d0('0xe'));var querystring=require(_0xb6d0('0xf'));var Papa=require(_0xb6d0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb6d0('0x11'));var as=require(_0xb6d0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb6d0('0x13'))(_0xb6d0('0x14'));var utils=require('../../config/utils');var config=require(_0xb6d0('0x15'));var licenseUtil=require(_0xb6d0('0x16'));var db=require(_0xb6d0('0x17'))['db'];function respondWithStatusCode(_0x2625e4,_0x4c1ea7){_0x4c1ea7=_0x4c1ea7||0xcc;return function(_0x2a4072){if(_0x2a4072){return _0x2625e4[_0xb6d0('0x18')](_0x4c1ea7);}return _0x2625e4['status'](_0x4c1ea7)[_0xb6d0('0x19')]();};}function respondWithResult(_0x4dc123,_0x479cd3){_0x479cd3=_0x479cd3||0xc8;return function(_0x3062da){if(_0x3062da){return _0x4dc123[_0xb6d0('0x1a')](_0x479cd3)['json'](_0x3062da);}};}function respondWithFilteredResult(_0x4c3d6d,_0x44bec3){return function(_0x5b50ec){if(_0x5b50ec){var _0x3be43e=typeof _0x44bec3['offset']===_0xb6d0('0x1b')&&typeof _0x44bec3[_0xb6d0('0x1c')]==='undefined';var _0x1e3988=_0x5b50ec[_0xb6d0('0x1d')];var _0x319318=_0x3be43e?0x0:_0x44bec3['offset'];var _0x1745da=_0x3be43e?_0x5b50ec[_0xb6d0('0x1d')]:_0x44bec3[_0xb6d0('0x1e')]+_0x44bec3[_0xb6d0('0x1c')];var _0x5be57f;if(_0x1745da>=_0x1e3988){_0x1745da=_0x1e3988;_0x5be57f=0xc8;}else{_0x5be57f=0xce;}_0x4c3d6d[_0xb6d0('0x1a')](_0x5be57f);return _0x4c3d6d[_0xb6d0('0x1f')](_0xb6d0('0x20'),_0x319318+'-'+_0x1745da+'/'+_0x1e3988)[_0xb6d0('0x21')](_0x5b50ec);}return null;};}function patchUpdates(_0x370bd2){return function(_0x1499db){try{jsonpatch[_0xb6d0('0x22')](_0x1499db,_0x370bd2,!![]);}catch(_0x42bcde){return BPromise['reject'](_0x42bcde);}return _0x1499db[_0xb6d0('0x23')]();};}function saveUpdates(_0x152831,_0x2b8588){return function(_0xd9d21e){if(_0xd9d21e){return _0xd9d21e[_0xb6d0('0x24')](_0x152831)[_0xb6d0('0x25')](function(_0x39a88f){return _0x39a88f;});}return null;};}function removeEntity(_0x30e946,_0x3bf581){return function(_0x292a08){if(_0x292a08){return _0x292a08[_0xb6d0('0x26')]()[_0xb6d0('0x25')](function(){_0x30e946[_0xb6d0('0x1a')](0xcc)[_0xb6d0('0x19')]();});}};}function handleEntityNotFound(_0x217b7e,_0x1454b0){return function(_0x2d1efe){if(!_0x2d1efe){_0x217b7e['sendStatus'](0x194);}return _0x2d1efe;};}function handleError(_0x8e9602,_0x57ee68){_0x57ee68=_0x57ee68||0x1f4;return function(_0x19f4ec){logger['error'](_0x19f4ec[_0xb6d0('0x27')]);if(_0x19f4ec[_0xb6d0('0x28')]){delete _0x19f4ec[_0xb6d0('0x28')];}_0x8e9602[_0xb6d0('0x1a')](_0x57ee68)['send'](_0x19f4ec);};}exports[_0xb6d0('0x29')]=function(_0x18ad8a,_0x3d0618){var _0x364efe={},_0x2ba33c={},_0x11935e={'count':0x0,'rows':[]};var _0x113a70=_[_0xb6d0('0x2a')](db[_0xb6d0('0x2b')][_0xb6d0('0x2c')],function(_0x108ce3){return{'name':_0x108ce3[_0xb6d0('0x2d')],'type':_0x108ce3[_0xb6d0('0x2e')]['key']};});_0x2ba33c[_0xb6d0('0x2f')]=_[_0xb6d0('0x2a')](_0x113a70,_0xb6d0('0x28'));_0x2ba33c[_0xb6d0('0x30')]=_[_0xb6d0('0x31')](_0x18ad8a[_0xb6d0('0x30')]);_0x2ba33c[_0xb6d0('0x32')]=_[_0xb6d0('0x33')](_0x2ba33c[_0xb6d0('0x2f')],_0x2ba33c[_0xb6d0('0x30')]);_0x364efe[_0xb6d0('0x34')]=_[_0xb6d0('0x33')](_0x2ba33c['model'],qs[_0xb6d0('0x35')](_0x18ad8a[_0xb6d0('0x30')][_0xb6d0('0x35')]));_0x364efe[_0xb6d0('0x34')]=_0x364efe[_0xb6d0('0x34')][_0xb6d0('0x36')]?_0x364efe[_0xb6d0('0x34')]:_0x2ba33c['model'];if(!_0x18ad8a[_0xb6d0('0x30')][_0xb6d0('0x37')](_0xb6d0('0x38'))){_0x364efe[_0xb6d0('0x1c')]=qs[_0xb6d0('0x1c')](_0x18ad8a[_0xb6d0('0x30')]['limit']);_0x364efe[_0xb6d0('0x1e')]=qs[_0xb6d0('0x1e')](_0x18ad8a[_0xb6d0('0x30')][_0xb6d0('0x1e')]);}_0x364efe[_0xb6d0('0x39')]=qs[_0xb6d0('0x3a')](_0x18ad8a[_0xb6d0('0x30')][_0xb6d0('0x3a')]);_0x364efe[_0xb6d0('0x3b')]=qs['filters'](_[_0xb6d0('0x3c')](_0x18ad8a[_0xb6d0('0x30')],_0x2ba33c[_0xb6d0('0x32')]),_0x113a70);if(_0x18ad8a[_0xb6d0('0x30')]['filter']){_0x364efe['where']=_['merge'](_0x364efe[_0xb6d0('0x3b')],{'$or':_[_0xb6d0('0x2a')](_0x113a70,function(_0x37ac12){if(_0x37ac12[_0xb6d0('0x2e')]!==_0xb6d0('0x3d')){var _0x19a1e8={};_0x19a1e8[_0x37ac12['name']]={'$like':'%'+_0x18ad8a[_0xb6d0('0x30')][_0xb6d0('0x3e')]+'%'};return _0x19a1e8;}})});}_0x364efe=_[_0xb6d0('0x3f')]({},_0x364efe,_0x18ad8a['options']);var _0x3f45ad={'where':_0x364efe['where']};return db[_0xb6d0('0x2b')]['count'](_0x3f45ad)[_0xb6d0('0x25')](function(_0x58ffce){_0x11935e[_0xb6d0('0x1d')]=_0x58ffce;if(_0x18ad8a['query']['includeAll']){_0x364efe[_0xb6d0('0x40')]=[{'all':!![]}];}return db[_0xb6d0('0x2b')][_0xb6d0('0x41')](_0x364efe);})['then'](function(_0x526fdc){_0x11935e[_0xb6d0('0x42')]=_0x526fdc;return _0x11935e;})[_0xb6d0('0x25')](respondWithFilteredResult(_0x3d0618,_0x364efe))[_0xb6d0('0x43')](handleError(_0x3d0618,null));};exports[_0xb6d0('0x44')]=function(_0x371621,_0x57d0ed){var _0x25cf5a={'raw':!![],'where':{'id':_0x371621[_0xb6d0('0x45')]['id']}},_0x3c4677={};_0x3c4677[_0xb6d0('0x2f')]=_[_0xb6d0('0x31')](db[_0xb6d0('0x2b')]['rawAttributes']);_0x3c4677[_0xb6d0('0x30')]=_[_0xb6d0('0x31')](_0x371621[_0xb6d0('0x30')]);_0x3c4677[_0xb6d0('0x32')]=_[_0xb6d0('0x33')](_0x3c4677[_0xb6d0('0x2f')],_0x3c4677[_0xb6d0('0x30')]);_0x25cf5a[_0xb6d0('0x34')]=_[_0xb6d0('0x33')](_0x3c4677[_0xb6d0('0x2f')],qs['fields'](_0x371621[_0xb6d0('0x30')]['fields']));_0x25cf5a[_0xb6d0('0x34')]=_0x25cf5a[_0xb6d0('0x34')][_0xb6d0('0x36')]?_0x25cf5a['attributes']:_0x3c4677[_0xb6d0('0x2f')];if(_0x371621[_0xb6d0('0x30')][_0xb6d0('0x46')]){_0x25cf5a[_0xb6d0('0x40')]=[{'all':!![]}];}_0x25cf5a=_[_0xb6d0('0x3f')]({},_0x25cf5a,_0x371621[_0xb6d0('0x47')]);return db[_0xb6d0('0x2b')][_0xb6d0('0x48')](_0x25cf5a)[_0xb6d0('0x25')](handleEntityNotFound(_0x57d0ed,null))[_0xb6d0('0x25')](respondWithResult(_0x57d0ed,null))[_0xb6d0('0x43')](handleError(_0x57d0ed,null));};exports[_0xb6d0('0x49')]=function(_0x10c757,_0x80213d){return db[_0xb6d0('0x2b')][_0xb6d0('0x49')](_0x10c757[_0xb6d0('0x4a')],{})['then'](respondWithResult(_0x80213d,0xc9))[_0xb6d0('0x43')](handleError(_0x80213d,null));};exports[_0xb6d0('0x24')]=function(_0x21a5db,_0x67897c){if(_0x21a5db[_0xb6d0('0x4a')]['id']){delete _0x21a5db[_0xb6d0('0x4a')]['id'];}return db[_0xb6d0('0x2b')]['find']({'where':{'id':_0x21a5db[_0xb6d0('0x45')]['id']}})[_0xb6d0('0x25')](handleEntityNotFound(_0x67897c,null))['then'](saveUpdates(_0x21a5db[_0xb6d0('0x4a')],null))[_0xb6d0('0x25')](respondWithResult(_0x67897c,null))[_0xb6d0('0x43')](handleError(_0x67897c,null));};exports[_0xb6d0('0x26')]=function(_0x2494f5,_0x3f9615){return db[_0xb6d0('0x2b')][_0xb6d0('0x48')]({'where':{'id':_0x2494f5[_0xb6d0('0x45')]['id']}})['then'](handleEntityNotFound(_0x3f9615,null))[_0xb6d0('0x25')](removeEntity(_0x3f9615,null))['catch'](handleError(_0x3f9615,null));};exports[_0xb6d0('0x4b')]=function(_0x5ddc34,_0x2603bb){return db[_0xb6d0('0x2b')][_0xb6d0('0x4b')]()[_0xb6d0('0x25')](respondWithResult(_0x2603bb,null))[_0xb6d0('0x43')](handleError(_0x2603bb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index ccb18d8..1da4dcb 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 _0xf75d=['path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xf75d,0x13c));var _0xdf75=function(_0x508926,_0xa05b4f){_0x508926=_0x508926-0x0;var _0x49ab00=_0xf75d[_0x508926];return _0x49ab00;};'use strict';var _=require(_0xdf75('0x0'));var util=require(_0xdf75('0x1'));var logger=require(_0xdf75('0x2'))(_0xdf75('0x3'));var moment=require(_0xdf75('0x4'));var BPromise=require(_0xdf75('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf75('0x6'));var rimraf=require(_0xdf75('0x7'));var config=require(_0xdf75('0x8'));var attributes=require(_0xdf75('0x9'));module[_0xdf75('0xa')]=function(_0x5580b9,_0x27ca8f){return _0x5580b9[_0xdf75('0xb')](_0xdf75('0xc'),attributes,{'tableName':_0xdf75('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2aa6=['lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','JscriptyQuestionReport','report_jscripty_questions'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0x2aa6,0x17c));var _0x62aa=function(_0xe6e78c,_0x582369){_0xe6e78c=_0xe6e78c-0x0;var _0x2a09c8=_0x2aa6[_0xe6e78c];return _0x2a09c8;};'use strict';var _=require(_0x62aa('0x0'));var util=require(_0x62aa('0x1'));var logger=require(_0x62aa('0x2'))('api');var moment=require(_0x62aa('0x3'));var BPromise=require('bluebird');var rp=require(_0x62aa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x62aa('0x5'));var config=require(_0x62aa('0x6'));var attributes=require(_0x62aa('0x7'));module['exports']=function(_0x4711c5,_0x259486){return _0x4711c5['define'](_0x62aa('0x8'),attributes,{'tableName':_0x62aa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 878c474..51a0ef9 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 _0x830a=['request','then','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyQuestionReport,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x395c06,_0x47df99){var _0x44ef35=function(_0xe0c390){while(--_0xe0c390){_0x395c06['push'](_0x395c06['shift']());}};_0x44ef35(++_0x47df99);}(_0x830a,0x145));var _0xa830=function(_0x35ad1d,_0x139af2){_0x35ad1d=_0x35ad1d-0x0;var _0x178bde=_0x830a[_0x35ad1d];return _0x178bde;};'use strict';var _=require(_0xa830('0x0'));var util=require(_0xa830('0x1'));var moment=require(_0xa830('0x2'));var BPromise=require(_0xa830('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa830('0x4'));var db=require(_0xa830('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa830('0x6'))(_0xa830('0x7'));var config=require('../../config/environment');var jayson=require(_0xa830('0x8'));var client=jayson[_0xa830('0x9')][_0xa830('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x218a22,_0x1f33df,_0x295dc9){return new BPromise(function(_0x43c3c8,_0x12a4fc){return client[_0xa830('0xb')](_0x218a22,_0x295dc9)[_0xa830('0xc')](function(_0x1bc23d){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x1f33df,_0xa830('0xd'));logger[_0xa830('0xe')](_0xa830('0xf'),_0x1f33df,_0xa830('0xd'),JSON[_0xa830('0x10')](_0x1bc23d));if(_0x1bc23d[_0xa830('0x11')]){if(_0x1bc23d['error'][_0xa830('0x12')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x1f33df,_0x1bc23d['error'][_0xa830('0x13')]);return _0x12a4fc(_0x1bc23d[_0xa830('0x11')][_0xa830('0x13')]);}logger[_0xa830('0x11')](_0xa830('0x14'),_0x1f33df,_0x1bc23d[_0xa830('0x11')][_0xa830('0x13')]);return _0x43c3c8(_0x1bc23d[_0xa830('0x11')][_0xa830('0x13')]);}else{logger[_0xa830('0x15')](_0xa830('0x14'),_0x1f33df,_0xa830('0xd'));_0x43c3c8(_0x1bc23d[_0xa830('0x16')][_0xa830('0x13')]);}})[_0xa830('0x17')](function(_0x428e9e){logger[_0xa830('0x11')](_0xa830('0x14'),_0x1f33df,_0x428e9e);_0x12a4fc(_0x428e9e);});});} \ No newline at end of file +var _0x9df4=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x296983,_0x1cb26c){var _0xf9edeb=function(_0x4651aa){while(--_0x4651aa){_0x296983['push'](_0x296983['shift']());}};_0xf9edeb(++_0x1cb26c);}(_0x9df4,0x1a3));var _0x49df=function(_0x4c3f7d,_0x56ce39){_0x4c3f7d=_0x4c3f7d-0x0;var _0x48c013=_0x9df4[_0x4c3f7d];return _0x48c013;};'use strict';var _=require('lodash');var util=require(_0x49df('0x0'));var moment=require(_0x49df('0x1'));var BPromise=require(_0x49df('0x2'));var rs=require(_0x49df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x49df('0x4'))['db'];var utils=require(_0x49df('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49df('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49df('0x7')][_0x49df('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42343e,_0x19f14a,_0x587697){return new BPromise(function(_0x8eeccf,_0x5da927){return client['request'](_0x42343e,_0x587697)[_0x49df('0x9')](function(_0x12bdd0){logger['info'](_0x49df('0xa'),_0x19f14a,_0x49df('0xb'));logger[_0x49df('0xc')](_0x49df('0xd'),_0x19f14a,'request\x20sent',JSON['stringify'](_0x12bdd0));if(_0x12bdd0[_0x49df('0xe')]){if(_0x12bdd0[_0x49df('0xe')][_0x49df('0xf')]===0x1f4){logger[_0x49df('0xe')](_0x49df('0xa'),_0x19f14a,_0x12bdd0[_0x49df('0xe')][_0x49df('0x10')]);return _0x5da927(_0x12bdd0[_0x49df('0xe')]['message']);}logger['error'](_0x49df('0xa'),_0x19f14a,_0x12bdd0[_0x49df('0xe')][_0x49df('0x10')]);return _0x8eeccf(_0x12bdd0[_0x49df('0xe')][_0x49df('0x10')]);}else{logger[_0x49df('0x11')](_0x49df('0xa'),_0x19f14a,_0x49df('0xb'));_0x8eeccf(_0x12bdd0['result']['message']);}})['catch'](function(_0x5512e3){logger[_0x49df('0xe')](_0x49df('0xa'),_0x19f14a,_0x5512e3);_0x5da927(_0x5512e3);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 2167ceb..9fd4f5b 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 _0xa0bb=['./jscriptySessionReport.controller','get','isAuthenticated','describe','/:id','show','/:id/questions','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x329d31,_0x14e8ae){var _0x4b3cfc=function(_0x1d2659){while(--_0x1d2659){_0x329d31['push'](_0x329d31['shift']());}};_0x4b3cfc(++_0x14e8ae);}(_0xa0bb,0x7a));var _0xba0b=function(_0x3d9c5d,_0x594ced){_0x3d9c5d=_0x3d9c5d-0x0;var _0x2cafb5=_0xa0bb[_0x3d9c5d];return _0x2cafb5;};'use strict';var multer=require(_0xba0b('0x0'));var util=require(_0xba0b('0x1'));var path=require(_0xba0b('0x2'));var timeout=require(_0xba0b('0x3'));var express=require(_0xba0b('0x4'));var router=express[_0xba0b('0x5')]();var fs_extra=require(_0xba0b('0x6'));var auth=require(_0xba0b('0x7'));var interaction=require(_0xba0b('0x8'));var config=require(_0xba0b('0x9'));var controller=require(_0xba0b('0xa'));router[_0xba0b('0xb')]('/',auth[_0xba0b('0xc')](),controller['index']);router['get']('/describe',auth[_0xba0b('0xc')](),controller[_0xba0b('0xd')]);router[_0xba0b('0xb')](_0xba0b('0xe'),auth[_0xba0b('0xc')](),controller[_0xba0b('0xf')]);router[_0xba0b('0xb')](_0xba0b('0x10'),auth[_0xba0b('0xc')](),controller['getQuestions']);router[_0xba0b('0x11')]('/',auth[_0xba0b('0xc')](),controller[_0xba0b('0x12')]);router['put'](_0xba0b('0xe'),auth[_0xba0b('0xc')](),controller[_0xba0b('0x13')]);router[_0xba0b('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xba0b('0x15')]=router; \ No newline at end of file +var _0xa682=['destroy','exports','util','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete'];(function(_0x48e568,_0x1df774){var _0x1970e0=function(_0x434a81){while(--_0x434a81){_0x48e568['push'](_0x48e568['shift']());}};_0x1970e0(++_0x1df774);}(_0xa682,0x132));var _0x2a68=function(_0x287779,_0x1c2a07){_0x287779=_0x287779-0x0;var _0x53d5a2=_0xa682[_0x287779];return _0x53d5a2;};'use strict';var multer=require('multer');var util=require(_0x2a68('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2a68('0x1')]();var fs_extra=require(_0x2a68('0x2'));var auth=require(_0x2a68('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2a68('0x4'));var controller=require(_0x2a68('0x5'));router[_0x2a68('0x6')]('/',auth['isAuthenticated'](),controller[_0x2a68('0x7')]);router[_0x2a68('0x6')](_0x2a68('0x8'),auth[_0x2a68('0x9')](),controller[_0x2a68('0xa')]);router['get'](_0x2a68('0xb'),auth['isAuthenticated'](),controller[_0x2a68('0xc')]);router['get']('/:id/questions',auth[_0x2a68('0x9')](),controller['getQuestions']);router[_0x2a68('0xd')]('/',auth['isAuthenticated'](),controller[_0x2a68('0xe')]);router[_0x2a68('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2a68('0x10')](_0x2a68('0xb'),auth[_0x2a68('0x9')](),controller[_0x2a68('0x11')]);module[_0x2a68('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 2d795a5..6fed3e6 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 _0x6219=['exports','DATE','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize'];(function(_0x5e7c14,_0x9b9484){var _0x48fb3b=function(_0x53bda0){while(--_0x53bda0){_0x5e7c14['push'](_0x5e7c14['shift']());}};_0x48fb3b(++_0x9b9484);}(_0x6219,0xc4));var _0x9621=function(_0x1f62c3,_0x1ff95b){_0x1f62c3=_0x1f62c3-0x0;var _0x385c1c=_0x6219[_0x1f62c3];return _0x385c1c;};'use strict';var moment=require(_0x9621('0x0'));var Sequelize=require(_0x9621('0x1'));module[_0x9621('0x2')]={'starttime':{'type':Sequelize[_0x9621('0x3')],'set':function(_0x195d9f){this[_0x9621('0x4')]('starttime',_0x195d9f);this[_0x9621('0x4')](_0x9621('0x5'),moment()['format'](_0x9621('0x6')));}},'endtime':{'type':Sequelize[_0x9621('0x3')]},'membername':{'type':Sequelize[_0x9621('0x7')]},'projectname':{'type':Sequelize[_0x9621('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9621('0x7')]},'calleridname':{'type':Sequelize[_0x9621('0x7')]},'calleridnum':{'type':Sequelize[_0x9621('0x7')]},'completed':{'type':Sequelize[_0x9621('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x6ccf=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','setDataValue','starttime','endtime','format'];(function(_0x23ffa0,_0x3d39bc){var _0x237ab3=function(_0x375185){while(--_0x375185){_0x23ffa0['push'](_0x23ffa0['shift']());}};_0x237ab3(++_0x3d39bc);}(_0x6ccf,0xdb));var _0xf6cc=function(_0x154983,_0xc29edf){_0x154983=_0x154983-0x0;var _0x3d1243=_0x6ccf[_0x154983];return _0x3d1243;};'use strict';var moment=require(_0xf6cc('0x0'));var Sequelize=require(_0xf6cc('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x52383c){this[_0xf6cc('0x2')](_0xf6cc('0x3'),_0x52383c);this['setDataValue'](_0xf6cc('0x4'),moment()[_0xf6cc('0x5')](_0xf6cc('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xf6cc('0x7')]},'projectname':{'type':Sequelize[_0xf6cc('0x7')]},'queue':{'type':Sequelize[_0xf6cc('0x7')]},'uniqueid':{'type':Sequelize[_0xf6cc('0x7')]},'calleridname':{'type':Sequelize[_0xf6cc('0x7')]},'calleridnum':{'type':Sequelize[_0xf6cc('0x7')]},'completed':{'type':Sequelize[_0xf6cc('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index ac17c5c..4da5d73 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 _0x3a8b=['fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x5150aa,_0x572726){var _0x17abee=function(_0x1a447c){while(--_0x1a447c){_0x5150aa['push'](_0x5150aa['shift']());}};_0x17abee(++_0x572726);}(_0x3a8b,0x9c));var _0xb3a8=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x3a8b[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require(_0xb3a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb3a8('0x1'));var jsonpatch=require(_0xb3a8('0x2'));var rp=require('request-promise');var moment=require(_0xb3a8('0x3'));var BPromise=require(_0xb3a8('0x4'));var Mustache=require(_0xb3a8('0x5'));var util=require(_0xb3a8('0x6'));var path=require('path');var sox=require(_0xb3a8('0x7'));var csv=require(_0xb3a8('0x8'));var ejs=require(_0xb3a8('0x9'));var fs=require('fs');var fs_extra=require(_0xb3a8('0xa'));var _=require(_0xb3a8('0xb'));var squel=require(_0xb3a8('0xc'));var crypto=require(_0xb3a8('0xd'));var jsforce=require(_0xb3a8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb3a8('0x8'));var querystring=require(_0xb3a8('0xf'));var Papa=require(_0xb3a8('0x10'));var Redis=require(_0xb3a8('0x11'));var authService=require(_0xb3a8('0x12'));var qs=require(_0xb3a8('0x13'));var as=require(_0xb3a8('0x14'));var hardwareService=require(_0xb3a8('0x15'));var logger=require(_0xb3a8('0x16'))(_0xb3a8('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb3a8('0x18'));var db=require(_0xb3a8('0x19'))['db'];function respondWithStatusCode(_0x5ce080,_0x1b5198){_0x1b5198=_0x1b5198||0xcc;return function(_0xba217f){if(_0xba217f){return _0x5ce080['sendStatus'](_0x1b5198);}return _0x5ce080[_0xb3a8('0x1a')](_0x1b5198)['end']();};}function respondWithResult(_0xfaf75a,_0x562a81){_0x562a81=_0x562a81||0xc8;return function(_0x19b3d5){if(_0x19b3d5){return _0xfaf75a[_0xb3a8('0x1a')](_0x562a81)[_0xb3a8('0x1b')](_0x19b3d5);}};}function respondWithFilteredResult(_0x14d060,_0x13140e){return function(_0x4bc9d1){if(_0x4bc9d1){var _0x1f36cc=typeof _0x13140e[_0xb3a8('0x1c')]==='undefined'&&typeof _0x13140e[_0xb3a8('0x1d')]===_0xb3a8('0x1e');var _0xfc3d04=_0x4bc9d1[_0xb3a8('0x1f')];var _0x4f9e12=_0x1f36cc?0x0:_0x13140e[_0xb3a8('0x1c')];var _0x4a6b5d=_0x1f36cc?_0x4bc9d1[_0xb3a8('0x1f')]:_0x13140e['offset']+_0x13140e[_0xb3a8('0x1d')];var _0x29f1ff;if(_0x4a6b5d>=_0xfc3d04){_0x4a6b5d=_0xfc3d04;_0x29f1ff=0xc8;}else{_0x29f1ff=0xce;}_0x14d060['status'](_0x29f1ff);return _0x14d060['set'](_0xb3a8('0x20'),_0x4f9e12+'-'+_0x4a6b5d+'/'+_0xfc3d04)['json'](_0x4bc9d1);}return null;};}function patchUpdates(_0x50f102){return function(_0x5e0dd4){try{jsonpatch[_0xb3a8('0x21')](_0x5e0dd4,_0x50f102,!![]);}catch(_0x4c5d93){return BPromise[_0xb3a8('0x22')](_0x4c5d93);}return _0x5e0dd4[_0xb3a8('0x23')]();};}function saveUpdates(_0xe1869c,_0x4599e0){return function(_0x97dbd){if(_0x97dbd){return _0x97dbd[_0xb3a8('0x24')](_0xe1869c)['then'](function(_0x130478){return _0x130478;});}return null;};}function removeEntity(_0x56bef7,_0x2fb7f6){return function(_0x342835){if(_0x342835){return _0x342835[_0xb3a8('0x25')]()[_0xb3a8('0x26')](function(){_0x56bef7[_0xb3a8('0x1a')](0xcc)[_0xb3a8('0x27')]();});}};}function handleEntityNotFound(_0xda79c4,_0x1ba1c9){return function(_0xc978db){if(!_0xc978db){_0xda79c4[_0xb3a8('0x28')](0x194);}return _0xc978db;};}function handleError(_0x473ea3,_0x482126){_0x482126=_0x482126||0x1f4;return function(_0x16e557){logger[_0xb3a8('0x29')](_0x16e557[_0xb3a8('0x2a')]);if(_0x16e557[_0xb3a8('0x2b')]){delete _0x16e557[_0xb3a8('0x2b')];}_0x473ea3[_0xb3a8('0x1a')](_0x482126)[_0xb3a8('0x2c')](_0x16e557);};}exports[_0xb3a8('0x2d')]=function(_0x19c265,_0x4b4503){var _0x4fa9ed={},_0x45217d={},_0x8f032d={'count':0x0,'rows':[]};var _0x232dd0=_[_0xb3a8('0x2e')](db[_0xb3a8('0x2f')][_0xb3a8('0x30')],function(_0x4a3995){return{'name':_0x4a3995[_0xb3a8('0x31')],'type':_0x4a3995[_0xb3a8('0x32')][_0xb3a8('0x33')]};});_0x45217d['model']=_['map'](_0x232dd0,_0xb3a8('0x2b'));_0x45217d['query']=_[_0xb3a8('0x34')](_0x19c265['query']);_0x45217d['filters']=_[_0xb3a8('0x35')](_0x45217d[_0xb3a8('0x36')],_0x45217d[_0xb3a8('0x37')]);_0x4fa9ed[_0xb3a8('0x38')]=_[_0xb3a8('0x35')](_0x45217d[_0xb3a8('0x36')],qs[_0xb3a8('0x39')](_0x19c265[_0xb3a8('0x37')]['fields']));_0x4fa9ed['attributes']=_0x4fa9ed['attributes'][_0xb3a8('0x3a')]?_0x4fa9ed[_0xb3a8('0x38')]:_0x45217d[_0xb3a8('0x36')];if(!_0x19c265[_0xb3a8('0x37')][_0xb3a8('0x3b')]('nolimit')){_0x4fa9ed[_0xb3a8('0x1d')]=qs[_0xb3a8('0x1d')](_0x19c265['query'][_0xb3a8('0x1d')]);_0x4fa9ed['offset']=qs[_0xb3a8('0x1c')](_0x19c265[_0xb3a8('0x37')]['offset']);}_0x4fa9ed[_0xb3a8('0x3c')]=qs[_0xb3a8('0x3d')](_0x19c265[_0xb3a8('0x37')][_0xb3a8('0x3d')]);_0x4fa9ed[_0xb3a8('0x3e')]=qs[_0xb3a8('0x3f')](_[_0xb3a8('0x40')](_0x19c265[_0xb3a8('0x37')],_0x45217d['filters']),_0x232dd0);if(_0x19c265[_0xb3a8('0x37')][_0xb3a8('0x41')]){_0x4fa9ed[_0xb3a8('0x3e')]=_['merge'](_0x4fa9ed[_0xb3a8('0x3e')],{'$or':_[_0xb3a8('0x2e')](_0x232dd0,function(_0x5a79cf){if(_0x5a79cf[_0xb3a8('0x32')]!=='VIRTUAL'){var _0x304f38={};_0x304f38[_0x5a79cf[_0xb3a8('0x2b')]]={'$like':'%'+_0x19c265[_0xb3a8('0x37')]['filter']+'%'};return _0x304f38;}})});}_0x4fa9ed=_[_0xb3a8('0x42')]({},_0x4fa9ed,_0x19c265[_0xb3a8('0x43')]);var _0x3dc277={'where':_0x4fa9ed[_0xb3a8('0x3e')]};return db[_0xb3a8('0x2f')][_0xb3a8('0x1f')](_0x3dc277)['then'](function(_0x5f04ba){_0x8f032d['count']=_0x5f04ba;if(_0x19c265[_0xb3a8('0x37')][_0xb3a8('0x44')]){_0x4fa9ed[_0xb3a8('0x45')]=[{'all':!![]}];}return db[_0xb3a8('0x2f')][_0xb3a8('0x46')](_0x4fa9ed);})[_0xb3a8('0x26')](function(_0x44a9b6){_0x8f032d[_0xb3a8('0x47')]=_0x44a9b6;return _0x8f032d;})[_0xb3a8('0x26')](respondWithFilteredResult(_0x4b4503,_0x4fa9ed))[_0xb3a8('0x48')](handleError(_0x4b4503,null));};exports[_0xb3a8('0x49')]=function(_0x3a7930,_0x506d97){var _0x55814a={'raw':!![],'where':{'id':_0x3a7930[_0xb3a8('0x4a')]['id']}},_0x1fe589={};_0x1fe589[_0xb3a8('0x36')]=_[_0xb3a8('0x34')](db[_0xb3a8('0x2f')][_0xb3a8('0x30')]);_0x1fe589[_0xb3a8('0x37')]=_[_0xb3a8('0x34')](_0x3a7930['query']);_0x1fe589['filters']=_[_0xb3a8('0x35')](_0x1fe589['model'],_0x1fe589[_0xb3a8('0x37')]);_0x55814a[_0xb3a8('0x38')]=_[_0xb3a8('0x35')](_0x1fe589[_0xb3a8('0x36')],qs['fields'](_0x3a7930['query'][_0xb3a8('0x39')]));_0x55814a[_0xb3a8('0x38')]=_0x55814a[_0xb3a8('0x38')]['length']?_0x55814a[_0xb3a8('0x38')]:_0x1fe589[_0xb3a8('0x36')];if(_0x3a7930[_0xb3a8('0x37')][_0xb3a8('0x44')]){_0x55814a[_0xb3a8('0x45')]=[{'all':!![]}];}_0x55814a=_[_0xb3a8('0x42')]({},_0x55814a,_0x3a7930[_0xb3a8('0x43')]);return db[_0xb3a8('0x2f')][_0xb3a8('0x4b')](_0x55814a)[_0xb3a8('0x26')](handleEntityNotFound(_0x506d97,null))[_0xb3a8('0x26')](respondWithResult(_0x506d97,null))['catch'](handleError(_0x506d97,null));};exports[_0xb3a8('0x4c')]=function(_0x32c5de,_0x1e705a){return db[_0xb3a8('0x2f')][_0xb3a8('0x4c')](_0x32c5de[_0xb3a8('0x4d')],{})[_0xb3a8('0x26')](respondWithResult(_0x1e705a,0xc9))['catch'](handleError(_0x1e705a,null));};exports[_0xb3a8('0x24')]=function(_0x15e427,_0x43cb8d){if(_0x15e427[_0xb3a8('0x4d')]['id']){delete _0x15e427[_0xb3a8('0x4d')]['id'];}return db[_0xb3a8('0x2f')][_0xb3a8('0x4b')]({'where':{'id':_0x15e427[_0xb3a8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x43cb8d,null))['then'](saveUpdates(_0x15e427[_0xb3a8('0x4d')],null))['then'](respondWithResult(_0x43cb8d,null))[_0xb3a8('0x48')](handleError(_0x43cb8d,null));};exports[_0xb3a8('0x25')]=function(_0x1fab6a,_0x11f584){return db['JscriptySessionReport'][_0xb3a8('0x4b')]({'where':{'id':_0x1fab6a[_0xb3a8('0x4a')]['id']}})[_0xb3a8('0x26')](handleEntityNotFound(_0x11f584,null))['then'](removeEntity(_0x11f584,null))[_0xb3a8('0x48')](handleError(_0x11f584,null));};exports[_0xb3a8('0x4e')]=function(_0x96e7b0,_0x3e8f3b){return db[_0xb3a8('0x2f')][_0xb3a8('0x4e')]()[_0xb3a8('0x26')](respondWithResult(_0x3e8f3b,null))[_0xb3a8('0x48')](handleError(_0x3e8f3b,null));};exports[_0xb3a8('0x4f')]=function(_0x1ebc08,_0x5d0bb3,_0xf9820a){var _0x17c9bd={'raw':!![],'where':{}};var _0x3feff7={};var _0x22de18={'count':0x0,'rows':[]};return db[_0xb3a8('0x2f')][_0xb3a8('0x50')]({'where':{'id':_0x1ebc08['params']['id']}})[_0xb3a8('0x26')](handleEntityNotFound(_0x5d0bb3,null))[_0xb3a8('0x26')](function(_0x32df8c){if(_0x32df8c){_0x3feff7[_0xb3a8('0x36')]=_[_0xb3a8('0x34')](db[_0xb3a8('0x51')]['rawAttributes']);_0x3feff7[_0xb3a8('0x37')]=_[_0xb3a8('0x34')](_0x1ebc08[_0xb3a8('0x37')]);_0x3feff7[_0xb3a8('0x3f')]=_[_0xb3a8('0x35')](_0x3feff7[_0xb3a8('0x36')],_0x3feff7['query']);_0x17c9bd[_0xb3a8('0x38')]=_['intersection'](_0x3feff7[_0xb3a8('0x36')],qs['fields'](_0x1ebc08[_0xb3a8('0x37')][_0xb3a8('0x39')]));_0x17c9bd[_0xb3a8('0x38')]=_0x17c9bd[_0xb3a8('0x38')][_0xb3a8('0x3a')]?_0x17c9bd[_0xb3a8('0x38')]:_0x3feff7[_0xb3a8('0x36')];if(!_0x1ebc08['query'][_0xb3a8('0x3b')](_0xb3a8('0x52'))){_0x17c9bd['limit']=qs[_0xb3a8('0x1d')](_0x1ebc08['query'][_0xb3a8('0x1d')]);_0x17c9bd[_0xb3a8('0x1c')]=qs[_0xb3a8('0x1c')](_0x1ebc08[_0xb3a8('0x37')][_0xb3a8('0x1c')]);}_0x17c9bd[_0xb3a8('0x3c')]=qs[_0xb3a8('0x3d')](_0x1ebc08[_0xb3a8('0x37')][_0xb3a8('0x3d')]);_0x17c9bd[_0xb3a8('0x3e')]=qs['filters'](_['pick'](_0x1ebc08[_0xb3a8('0x37')],_0x3feff7[_0xb3a8('0x3f')]));_0x17c9bd[_0xb3a8('0x3e')]['SessionId']=_0x32df8c['id'];if(_0x1ebc08['query'][_0xb3a8('0x41')]){_0x17c9bd[_0xb3a8('0x3e')]=_[_0xb3a8('0x42')](_0x17c9bd[_0xb3a8('0x3e')],{'$or':_[_0xb3a8('0x2e')](_0x17c9bd[_0xb3a8('0x38')],function(_0xda6565){var _0xfb9a6b={};_0xfb9a6b[_0xda6565]={'$like':'%'+_0x1ebc08[_0xb3a8('0x37')][_0xb3a8('0x41')]+'%'};return _0xfb9a6b;})});}_0x17c9bd=_[_0xb3a8('0x42')]({},_0x17c9bd,_0x1ebc08[_0xb3a8('0x43')]);return db[_0xb3a8('0x51')][_0xb3a8('0x1f')]({'where':_0x17c9bd[_0xb3a8('0x3e')]})['then'](function(_0x15496f){_0x22de18[_0xb3a8('0x1f')]=_0x15496f;if(_0x1ebc08[_0xb3a8('0x37')]['includeAll']){_0x17c9bd['include']=[{'all':!![]}];}return db[_0xb3a8('0x51')][_0xb3a8('0x46')](_0x17c9bd);})[_0xb3a8('0x26')](function(_0x33fd22){_0x22de18['rows']=_0x33fd22;return _0x22de18;});}})[_0xb3a8('0x26')](respondWithFilteredResult(_0x5d0bb3,_0x17c9bd))[_0xb3a8('0x48')](handleError(_0x5d0bb3,null));}; \ No newline at end of file +var _0xe363=['filters','intersection','model','attributes','fields','length','sort','where','pick','merge','filter','includeAll','include','rows','catch','params','options','find','create','body','update','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','order','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','sendStatus','error','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','map','query','keys'];(function(_0x440dc7,_0x3ed415){var _0x3b8633=function(_0x2e016c){while(--_0x2e016c){_0x440dc7['push'](_0x440dc7['shift']());}};_0x3b8633(++_0x3ed415);}(_0xe363,0x68));var _0x3e36=function(_0x18ac31,_0x41f8ba){_0x18ac31=_0x18ac31-0x0;var _0x25b038=_0xe363[_0x18ac31];return _0x25b038;};'use strict';var emlformat=require(_0x3e36('0x0'));var rimraf=require(_0x3e36('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e36('0x2'));var rp=require(_0x3e36('0x3'));var moment=require(_0x3e36('0x4'));var BPromise=require(_0x3e36('0x5'));var Mustache=require('mustache');var util=require(_0x3e36('0x6'));var path=require(_0x3e36('0x7'));var sox=require(_0x3e36('0x8'));var csv=require(_0x3e36('0x9'));var ejs=require(_0x3e36('0xa'));var fs=require('fs');var fs_extra=require(_0x3e36('0xb'));var _=require(_0x3e36('0xc'));var squel=require(_0x3e36('0xd'));var crypto=require('crypto');var jsforce=require(_0x3e36('0xe'));var deskjs=require(_0x3e36('0xf'));var toCsv=require(_0x3e36('0x9'));var querystring=require(_0x3e36('0x10'));var Papa=require('papaparse');var Redis=require(_0x3e36('0x11'));var authService=require(_0x3e36('0x12'));var qs=require(_0x3e36('0x13'));var as=require(_0x3e36('0x14'));var hardwareService=require(_0x3e36('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x3e36('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3e36('0x17'))['db'];function respondWithStatusCode(_0xe15c13,_0x133761){_0x133761=_0x133761||0xcc;return function(_0x35a3ce){if(_0x35a3ce){return _0xe15c13['sendStatus'](_0x133761);}return _0xe15c13[_0x3e36('0x18')](_0x133761)[_0x3e36('0x19')]();};}function respondWithResult(_0x191bb7,_0x280758){_0x280758=_0x280758||0xc8;return function(_0x4c5f9c){if(_0x4c5f9c){return _0x191bb7[_0x3e36('0x18')](_0x280758)[_0x3e36('0x1a')](_0x4c5f9c);}};}function respondWithFilteredResult(_0x50af7d,_0x1476ba){return function(_0xbbb6a6){if(_0xbbb6a6){var _0x1cd40b=typeof _0x1476ba['offset']===_0x3e36('0x1b')&&typeof _0x1476ba[_0x3e36('0x1c')]==='undefined';var _0x24e62f=_0xbbb6a6[_0x3e36('0x1d')];var _0x1ee7ba=_0x1cd40b?0x0:_0x1476ba['offset'];var _0x4f50eb=_0x1cd40b?_0xbbb6a6[_0x3e36('0x1d')]:_0x1476ba[_0x3e36('0x1e')]+_0x1476ba[_0x3e36('0x1c')];var _0x320ebb;if(_0x4f50eb>=_0x24e62f){_0x4f50eb=_0x24e62f;_0x320ebb=0xc8;}else{_0x320ebb=0xce;}_0x50af7d[_0x3e36('0x18')](_0x320ebb);return _0x50af7d[_0x3e36('0x1f')](_0x3e36('0x20'),_0x1ee7ba+'-'+_0x4f50eb+'/'+_0x24e62f)[_0x3e36('0x1a')](_0xbbb6a6);}return null;};}function patchUpdates(_0xa27120){return function(_0x1830ba){try{jsonpatch[_0x3e36('0x21')](_0x1830ba,_0xa27120,!![]);}catch(_0x1f5630){return BPromise['reject'](_0x1f5630);}return _0x1830ba[_0x3e36('0x22')]();};}function saveUpdates(_0x4dcdfd,_0x59e54d){return function(_0x1cad89){if(_0x1cad89){return _0x1cad89['update'](_0x4dcdfd)[_0x3e36('0x23')](function(_0x785cc2){return _0x785cc2;});}return null;};}function removeEntity(_0x491887,_0x18d755){return function(_0x45060e){if(_0x45060e){return _0x45060e['destroy']()[_0x3e36('0x23')](function(){_0x491887[_0x3e36('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46d3c0,_0x1428ef){return function(_0x5268ef){if(!_0x5268ef){_0x46d3c0[_0x3e36('0x24')](0x194);}return _0x5268ef;};}function handleError(_0x5c11be,_0x38f8e1){_0x38f8e1=_0x38f8e1||0x1f4;return function(_0x1e9422){logger[_0x3e36('0x25')](_0x1e9422[_0x3e36('0x26')]);if(_0x1e9422[_0x3e36('0x27')]){delete _0x1e9422['name'];}_0x5c11be[_0x3e36('0x18')](_0x38f8e1)[_0x3e36('0x28')](_0x1e9422);};}exports[_0x3e36('0x29')]=function(_0x26eb10,_0x65e1ed){var _0x5222d4={},_0x12e407={},_0x1d8fcc={'count':0x0,'rows':[]};var _0x132ac9=_['map'](db[_0x3e36('0x2a')][_0x3e36('0x2b')],function(_0x2bf406){return{'name':_0x2bf406[_0x3e36('0x2c')],'type':_0x2bf406[_0x3e36('0x2d')][_0x3e36('0x2e')]};});_0x12e407['model']=_[_0x3e36('0x2f')](_0x132ac9,'name');_0x12e407[_0x3e36('0x30')]=_[_0x3e36('0x31')](_0x26eb10['query']);_0x12e407[_0x3e36('0x32')]=_[_0x3e36('0x33')](_0x12e407[_0x3e36('0x34')],_0x12e407[_0x3e36('0x30')]);_0x5222d4[_0x3e36('0x35')]=_[_0x3e36('0x33')](_0x12e407[_0x3e36('0x34')],qs[_0x3e36('0x36')](_0x26eb10['query'][_0x3e36('0x36')]));_0x5222d4[_0x3e36('0x35')]=_0x5222d4[_0x3e36('0x35')][_0x3e36('0x37')]?_0x5222d4[_0x3e36('0x35')]:_0x12e407[_0x3e36('0x34')];if(!_0x26eb10[_0x3e36('0x30')]['hasOwnProperty']('nolimit')){_0x5222d4['limit']=qs['limit'](_0x26eb10[_0x3e36('0x30')][_0x3e36('0x1c')]);_0x5222d4[_0x3e36('0x1e')]=qs['offset'](_0x26eb10[_0x3e36('0x30')][_0x3e36('0x1e')]);}_0x5222d4['order']=qs['sort'](_0x26eb10[_0x3e36('0x30')][_0x3e36('0x38')]);_0x5222d4[_0x3e36('0x39')]=qs['filters'](_[_0x3e36('0x3a')](_0x26eb10[_0x3e36('0x30')],_0x12e407[_0x3e36('0x32')]),_0x132ac9);if(_0x26eb10[_0x3e36('0x30')]['filter']){_0x5222d4[_0x3e36('0x39')]=_[_0x3e36('0x3b')](_0x5222d4['where'],{'$or':_['map'](_0x132ac9,function(_0x5b2060){if(_0x5b2060['type']!=='VIRTUAL'){var _0x513cba={};_0x513cba[_0x5b2060[_0x3e36('0x27')]]={'$like':'%'+_0x26eb10[_0x3e36('0x30')][_0x3e36('0x3c')]+'%'};return _0x513cba;}})});}_0x5222d4=_[_0x3e36('0x3b')]({},_0x5222d4,_0x26eb10['options']);var _0x2030d6={'where':_0x5222d4[_0x3e36('0x39')]};return db[_0x3e36('0x2a')][_0x3e36('0x1d')](_0x2030d6)[_0x3e36('0x23')](function(_0x45a113){_0x1d8fcc[_0x3e36('0x1d')]=_0x45a113;if(_0x26eb10[_0x3e36('0x30')][_0x3e36('0x3d')]){_0x5222d4[_0x3e36('0x3e')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x5222d4);})[_0x3e36('0x23')](function(_0x26de50){_0x1d8fcc[_0x3e36('0x3f')]=_0x26de50;return _0x1d8fcc;})['then'](respondWithFilteredResult(_0x65e1ed,_0x5222d4))[_0x3e36('0x40')](handleError(_0x65e1ed,null));};exports['show']=function(_0x258358,_0xd25582){var _0x7e98e0={'raw':!![],'where':{'id':_0x258358[_0x3e36('0x41')]['id']}},_0x45a2a1={};_0x45a2a1['model']=_[_0x3e36('0x31')](db[_0x3e36('0x2a')][_0x3e36('0x2b')]);_0x45a2a1['query']=_[_0x3e36('0x31')](_0x258358[_0x3e36('0x30')]);_0x45a2a1[_0x3e36('0x32')]=_[_0x3e36('0x33')](_0x45a2a1['model'],_0x45a2a1[_0x3e36('0x30')]);_0x7e98e0[_0x3e36('0x35')]=_[_0x3e36('0x33')](_0x45a2a1[_0x3e36('0x34')],qs['fields'](_0x258358[_0x3e36('0x30')]['fields']));_0x7e98e0['attributes']=_0x7e98e0[_0x3e36('0x35')]['length']?_0x7e98e0[_0x3e36('0x35')]:_0x45a2a1[_0x3e36('0x34')];if(_0x258358['query'][_0x3e36('0x3d')]){_0x7e98e0[_0x3e36('0x3e')]=[{'all':!![]}];}_0x7e98e0=_[_0x3e36('0x3b')]({},_0x7e98e0,_0x258358[_0x3e36('0x42')]);return db[_0x3e36('0x2a')][_0x3e36('0x43')](_0x7e98e0)['then'](handleEntityNotFound(_0xd25582,null))[_0x3e36('0x23')](respondWithResult(_0xd25582,null))[_0x3e36('0x40')](handleError(_0xd25582,null));};exports['create']=function(_0x4aa835,_0x26e9f2){return db['JscriptySessionReport'][_0x3e36('0x44')](_0x4aa835[_0x3e36('0x45')],{})[_0x3e36('0x23')](respondWithResult(_0x26e9f2,0xc9))[_0x3e36('0x40')](handleError(_0x26e9f2,null));};exports[_0x3e36('0x46')]=function(_0xe27bda,_0x3718ec){if(_0xe27bda[_0x3e36('0x45')]['id']){delete _0xe27bda[_0x3e36('0x45')]['id'];}return db[_0x3e36('0x2a')][_0x3e36('0x43')]({'where':{'id':_0xe27bda[_0x3e36('0x41')]['id']}})['then'](handleEntityNotFound(_0x3718ec,null))[_0x3e36('0x23')](saveUpdates(_0xe27bda[_0x3e36('0x45')],null))[_0x3e36('0x23')](respondWithResult(_0x3718ec,null))['catch'](handleError(_0x3718ec,null));};exports['destroy']=function(_0x52aa14,_0x7b6fc0){return db[_0x3e36('0x2a')][_0x3e36('0x43')]({'where':{'id':_0x52aa14[_0x3e36('0x41')]['id']}})[_0x3e36('0x23')](handleEntityNotFound(_0x7b6fc0,null))['then'](removeEntity(_0x7b6fc0,null))[_0x3e36('0x40')](handleError(_0x7b6fc0,null));};exports[_0x3e36('0x47')]=function(_0x1fd498,_0x3d65fe){return db['JscriptySessionReport']['describe']()[_0x3e36('0x23')](respondWithResult(_0x3d65fe,null))[_0x3e36('0x40')](handleError(_0x3d65fe,null));};exports[_0x3e36('0x48')]=function(_0x75026e,_0x4debee,_0x3dcf6d){var _0x3b7443={'raw':!![],'where':{}};var _0x4a15bd={};var _0x1858cb={'count':0x0,'rows':[]};return db[_0x3e36('0x2a')][_0x3e36('0x49')]({'where':{'id':_0x75026e[_0x3e36('0x41')]['id']}})[_0x3e36('0x23')](handleEntityNotFound(_0x4debee,null))['then'](function(_0x187e6c){if(_0x187e6c){_0x4a15bd[_0x3e36('0x34')]=_[_0x3e36('0x31')](db[_0x3e36('0x4a')][_0x3e36('0x2b')]);_0x4a15bd[_0x3e36('0x30')]=_[_0x3e36('0x31')](_0x75026e[_0x3e36('0x30')]);_0x4a15bd['filters']=_[_0x3e36('0x33')](_0x4a15bd['model'],_0x4a15bd[_0x3e36('0x30')]);_0x3b7443[_0x3e36('0x35')]=_['intersection'](_0x4a15bd['model'],qs[_0x3e36('0x36')](_0x75026e[_0x3e36('0x30')]['fields']));_0x3b7443[_0x3e36('0x35')]=_0x3b7443[_0x3e36('0x35')][_0x3e36('0x37')]?_0x3b7443['attributes']:_0x4a15bd[_0x3e36('0x34')];if(!_0x75026e[_0x3e36('0x30')][_0x3e36('0x4b')]('nolimit')){_0x3b7443[_0x3e36('0x1c')]=qs['limit'](_0x75026e[_0x3e36('0x30')]['limit']);_0x3b7443[_0x3e36('0x1e')]=qs[_0x3e36('0x1e')](_0x75026e[_0x3e36('0x30')][_0x3e36('0x1e')]);}_0x3b7443[_0x3e36('0x4c')]=qs[_0x3e36('0x38')](_0x75026e[_0x3e36('0x30')][_0x3e36('0x38')]);_0x3b7443[_0x3e36('0x39')]=qs['filters'](_['pick'](_0x75026e[_0x3e36('0x30')],_0x4a15bd[_0x3e36('0x32')]));_0x3b7443[_0x3e36('0x39')]['SessionId']=_0x187e6c['id'];if(_0x75026e[_0x3e36('0x30')][_0x3e36('0x3c')]){_0x3b7443[_0x3e36('0x39')]=_['merge'](_0x3b7443[_0x3e36('0x39')],{'$or':_[_0x3e36('0x2f')](_0x3b7443['attributes'],function(_0x1e2e5f){var _0x85bcfd={};_0x85bcfd[_0x1e2e5f]={'$like':'%'+_0x75026e[_0x3e36('0x30')][_0x3e36('0x3c')]+'%'};return _0x85bcfd;})});}_0x3b7443=_[_0x3e36('0x3b')]({},_0x3b7443,_0x75026e[_0x3e36('0x42')]);return db[_0x3e36('0x4a')][_0x3e36('0x1d')]({'where':_0x3b7443[_0x3e36('0x39')]})[_0x3e36('0x23')](function(_0x4287fd){_0x1858cb[_0x3e36('0x1d')]=_0x4287fd;if(_0x75026e[_0x3e36('0x30')][_0x3e36('0x3d')]){_0x3b7443['include']=[{'all':!![]}];}return db[_0x3e36('0x4a')]['findAll'](_0x3b7443);})['then'](function(_0x5ad8b4){_0x1858cb[_0x3e36('0x3f')]=_0x5ad8b4;return _0x1858cb;});}})[_0x3e36('0x23')](respondWithFilteredResult(_0x4debee,_0x3b7443))[_0x3e36('0x40')](handleError(_0x4debee,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index d559797..d5735f4 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 _0xc1c6=['moment','request-promise','path','rimraf','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x5c9965,_0x4dca91){var _0x34f916=function(_0x436dce){while(--_0x436dce){_0x5c9965['push'](_0x5c9965['shift']());}};_0x34f916(++_0x4dca91);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x564c7b,_0x9fea9c){_0x564c7b=_0x564c7b-0x0;var _0x1a1fa4=_0xc1c6[_0x564c7b];return _0x1a1fa4;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa3f=['rimraf','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x399d51,_0x4d920a){var _0x2395cb=function(_0x561bdf){while(--_0x561bdf){_0x399d51['push'](_0x399d51['shift']());}};_0x2395cb(++_0x4d920a);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x30a66a,_0x299265){_0x30a66a=_0x30a66a-0x0;var _0x5f3bbc=_0xaa3f[_0x30a66a];return _0x5f3bbc;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var logger=require(_0xfaa3('0x2'))(_0xfaa3('0x3'));var moment=require(_0xfaa3('0x4'));var BPromise=require(_0xfaa3('0x5'));var rp=require(_0xfaa3('0x6'));var fs=require('fs');var path=require(_0xfaa3('0x7'));var rimraf=require(_0xfaa3('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0xfaa3('0x9')]=function(_0x4bac92,_0x3d09aa){return _0x4bac92[_0xfaa3('0xa')](_0xfaa3('0xb'),attributes,{'tableName':_0xfaa3('0xc'),'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 105a96c..0e758d9 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 _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x201c3d,_0x3958fa){var _0x49e93c=function(_0x55efe0){while(--_0x55efe0){_0x201c3d['push'](_0x201c3d['shift']());}};_0x49e93c(++_0x3958fa);}(_0x1623,0xab));var _0x3162=function(_0x5d8716,_0x433b80){_0x5d8716=_0x5d8716-0x0;var _0x57b83d=_0x1623[_0x5d8716];return _0x57b83d;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});} \ No newline at end of file +var _0x9536=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x1d0782,_0x2f7f0b){var _0x366dd8=function(_0x1aea1a){while(--_0x1aea1a){_0x1d0782['push'](_0x1d0782['shift']());}};_0x366dd8(++_0x2f7f0b);}(_0x9536,0x179));var _0x6953=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0x9536[_0x2d2ca2];return _0x48489d;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 3881b3b..f29519d 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 _0x9f75=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','update','exports','multer','path'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0x9f75,0x15a));var _0x59f7=function(_0x26fe57,_0x3761dc){_0x26fe57=_0x26fe57-0x0;var _0x127267=_0x9f75[_0x26fe57];return _0x127267;};'use strict';var multer=require(_0x59f7('0x0'));var util=require('util');var path=require(_0x59f7('0x1'));var timeout=require(_0x59f7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x59f7('0x3'));var auth=require(_0x59f7('0x4'));var interaction=require(_0x59f7('0x5'));var config=require(_0x59f7('0x6'));var controller=require('./license.controller');router[_0x59f7('0x7')]('/',controller[_0x59f7('0x8')]);router['put']('/:id',auth[_0x59f7('0x9')](),controller[_0x59f7('0xa')]);module[_0x59f7('0xb')]=router; \ No newline at end of file +var _0x87cb=['update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./license.controller','get','index','put'];(function(_0x4d5fb7,_0x48b3bd){var _0x350859=function(_0x262d74){while(--_0x262d74){_0x4d5fb7['push'](_0x4d5fb7['shift']());}};_0x350859(++_0x48b3bd);}(_0x87cb,0xaa));var _0xb87c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x87cb[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xb87c('0x0'));var util=require(_0xb87c('0x1'));var path=require(_0xb87c('0x2'));var timeout=require(_0xb87c('0x3'));var express=require(_0xb87c('0x4'));var router=express[_0xb87c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb87c('0x6'));var config=require(_0xb87c('0x7'));var controller=require(_0xb87c('0x8'));router[_0xb87c('0x9')]('/',controller[_0xb87c('0xa')]);router[_0xb87c('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xb87c('0xc')]);module[_0xb87c('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index e7a1f91..0e50a8a 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 _0xc6e1=['STRING','INTEGER','sequelize','TEXT'];(function(_0x57aeda,_0x446504){var _0x139dec=function(_0x5bd869){while(--_0x5bd869){_0x57aeda['push'](_0x57aeda['shift']());}};_0x139dec(++_0x446504);}(_0xc6e1,0x126));var _0x1c6e=function(_0x5bd5bc,_0x4027d9){_0x5bd5bc=_0x5bd5bc-0x0;var _0x405214=_0xc6e1[_0x5bd5bc];return _0x405214;};'use strict';var Sequelize=require(_0x1c6e('0x0'));module['exports']={'license':{'type':Sequelize[_0x1c6e('0x1')]},'data1':{'type':Sequelize[_0x1c6e('0x2')]},'data2':{'type':Sequelize[_0x1c6e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x1c6e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbae7=['STRING','sequelize','TEXT'];(function(_0x2999ff,_0x6b3e7c){var _0x5df247=function(_0x4ed41c){while(--_0x4ed41c){_0x2999ff['push'](_0x2999ff['shift']());}};_0x5df247(++_0x6b3e7c);}(_0xbae7,0x112));var _0x7bae=function(_0x3e000a,_0x84f846){_0x3e000a=_0x3e000a-0x0;var _0x2e119e=_0xbae7[_0x3e000a];return _0x2e119e;};'use strict';var Sequelize=require(_0x7bae('0x0'));module['exports']={'license':{'type':Sequelize[_0x7bae('0x1')]},'data1':{'type':Sequelize[_0x7bae('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 89ccec0..ab3b3d8 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 _0x5fab=['checkLicense','key','demo','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','merge','then','catch','body','find','params'];(function(_0x4fd332,_0x33a45e){var _0x3d5795=function(_0x3d05b5){while(--_0x3d05b5){_0x4fd332['push'](_0x4fd332['shift']());}};_0x3d5795(++_0x33a45e);}(_0x5fab,0x177));var _0xb5fa=function(_0x36147b,_0x57f40b){_0x36147b=_0x36147b-0x0;var _0x141351=_0x5fab[_0x36147b];return _0x141351;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];function respondWithStatusCode(_0x4d3576,_0x2ad830){_0x2ad830=_0x2ad830||0xcc;return function(_0x3dad4d){if(_0x3dad4d){return _0x4d3576['sendStatus'](_0x2ad830);}return _0x4d3576[_0xb5fa('0x1a')](_0x2ad830)['end']();};}function respondWithResult(_0x265992,_0x3fc372){_0x3fc372=_0x3fc372||0xc8;return function(_0x40c914){if(_0x40c914){return _0x265992[_0xb5fa('0x1a')](_0x3fc372)[_0xb5fa('0x1b')](_0x40c914);}};}function respondWithFilteredResult(_0x5371cf,_0x567f31){return function(_0x38e964){if(_0x38e964){var _0x587043=typeof _0x567f31[_0xb5fa('0x1c')]===_0xb5fa('0x1d')&&typeof _0x567f31['limit']==='undefined';var _0x451a55=_0x38e964[_0xb5fa('0x1e')];var _0x32e9e5=_0x587043?0x0:_0x567f31[_0xb5fa('0x1c')];var _0x324ba5=_0x587043?_0x38e964[_0xb5fa('0x1e')]:_0x567f31[_0xb5fa('0x1c')]+_0x567f31[_0xb5fa('0x1f')];var _0xc14dc4;if(_0x324ba5>=_0x451a55){_0x324ba5=_0x451a55;_0xc14dc4=0xc8;}else{_0xc14dc4=0xce;}_0x5371cf[_0xb5fa('0x1a')](_0xc14dc4);return _0x5371cf[_0xb5fa('0x20')](_0xb5fa('0x21'),_0x32e9e5+'-'+_0x324ba5+'/'+_0x451a55)['json'](_0x38e964);}return null;};}function patchUpdates(_0x432bfa){return function(_0x519e20){try{jsonpatch[_0xb5fa('0x22')](_0x519e20,_0x432bfa,!![]);}catch(_0x4a6c04){return BPromise[_0xb5fa('0x23')](_0x4a6c04);}return _0x519e20[_0xb5fa('0x24')]();};}function saveUpdates(_0x4e05c0,_0x40dfdf){return function(_0x3a2ab9){if(_0x3a2ab9){return _0x3a2ab9[_0xb5fa('0x25')](_0x4e05c0)['then'](function(_0x32a85c){return _0x32a85c;});}return null;};}function removeEntity(_0xec108f,_0x444237){return function(_0x542348){if(_0x542348){return _0x542348[_0xb5fa('0x26')]()['then'](function(){_0xec108f[_0xb5fa('0x1a')](0xcc)[_0xb5fa('0x27')]();});}};}function handleEntityNotFound(_0x11053a,_0x543edf){return function(_0x2dbd22){if(!_0x2dbd22){_0x11053a[_0xb5fa('0x28')](0x194);}return _0x2dbd22;};}function handleError(_0x6a455c,_0x20d649){_0x20d649=_0x20d649||0x1f4;return function(_0x568870){logger['error'](_0x568870['stack']);if(_0x568870['name']){delete _0x568870[_0xb5fa('0x29')];}_0x6a455c[_0xb5fa('0x1a')](_0x20d649)[_0xb5fa('0x2a')](_0x568870);};}var utilLicense=require(_0xb5fa('0x18'));exports[_0xb5fa('0x2b')]=function(_0x3506a4,_0x358549){var _0x353314={'raw':!![],'where':{'id':0x1}},_0x409af9={};_0x409af9[_0xb5fa('0x2c')]=_[_0xb5fa('0x2d')](db[_0xb5fa('0x2e')][_0xb5fa('0x2f')]);_0x409af9[_0xb5fa('0x30')]=_[_0xb5fa('0x2d')](_0x3506a4[_0xb5fa('0x30')]);_0x409af9[_0xb5fa('0x31')]=_[_0xb5fa('0x32')](_0x409af9[_0xb5fa('0x2c')],_0x409af9[_0xb5fa('0x30')]);_0x353314[_0xb5fa('0x33')]=_[_0xb5fa('0x32')](_0x409af9[_0xb5fa('0x2c')],qs[_0xb5fa('0x34')](_0x3506a4['query'][_0xb5fa('0x34')]));_0x353314['attributes']=_0x353314['attributes']['length']?_0x353314[_0xb5fa('0x33')]:_0x409af9['model'];_0x353314=_[_0xb5fa('0x35')]({},_0x353314,_0x3506a4['options']);return utilLicense['getLicense'](_0x353314)[_0xb5fa('0x36')](respondWithResult(_0x358549,null))[_0xb5fa('0x37')](handleError(_0x358549,null));};exports['update']=function(_0x59f41d,_0x3d73c2){if(_0x59f41d[_0xb5fa('0x38')]['id']){delete _0x59f41d[_0xb5fa('0x38')]['id'];}return db['License'][_0xb5fa('0x39')]({'where':{'id':_0x59f41d[_0xb5fa('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3d73c2,null))[_0xb5fa('0x36')](function(_0x2056de){var _0x204d6b=_0x2056de['get']({'plain':!![]});return utilLicense[_0xb5fa('0x3b')](_0x204d6b,_0x59f41d[_0xb5fa('0x38')][_0xb5fa('0x3c')]);})['then'](function(_0x117694){if(!_0x117694[_0xb5fa('0x3d')]){return saveUpdates(_0x59f41d[_0xb5fa('0x38')],null);}return _0x117694;})[_0xb5fa('0x36')](respondWithResult(_0x3d73c2,null))['catch'](handleError(_0x3d73c2,null));}; \ No newline at end of file +var _0x57ca=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','model','keys','License','query','intersection','fields','attributes','merge','options','getLicense','catch','body','find','get','checkLicense','key','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x57ca,0x108));var _0xa57c=function(_0x403496,_0x396061){_0x403496=_0x403496-0x0;var _0x20078d=_0x57ca[_0x403496];return _0x20078d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}var utilLicense=require(_0xa57c('0x15'));exports['index']=function(_0x54a18b,_0x257661){var _0x7d10ec={'raw':!![],'where':{'id':0x1}},_0x5a3e03={};_0x5a3e03[_0xa57c('0x28')]=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes']);_0x5a3e03[_0xa57c('0x2b')]=_['keys'](_0x54a18b[_0xa57c('0x2b')]);_0x5a3e03['filters']=_[_0xa57c('0x2c')](_0x5a3e03['model'],_0x5a3e03[_0xa57c('0x2b')]);_0x7d10ec['attributes']=_[_0xa57c('0x2c')](_0x5a3e03[_0xa57c('0x28')],qs[_0xa57c('0x2d')](_0x54a18b[_0xa57c('0x2b')][_0xa57c('0x2d')]));_0x7d10ec[_0xa57c('0x2e')]=_0x7d10ec[_0xa57c('0x2e')]['length']?_0x7d10ec[_0xa57c('0x2e')]:_0x5a3e03['model'];_0x7d10ec=_[_0xa57c('0x2f')]({},_0x7d10ec,_0x54a18b[_0xa57c('0x30')]);return utilLicense[_0xa57c('0x31')](_0x7d10ec)['then'](respondWithResult(_0x257661,null))[_0xa57c('0x32')](handleError(_0x257661,null));};exports['update']=function(_0x24a087,_0x501a4c){if(_0x24a087[_0xa57c('0x33')]['id']){delete _0x24a087['body']['id'];}return db[_0xa57c('0x2a')][_0xa57c('0x34')]({'where':{'id':_0x24a087['params']['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x501a4c,null))['then'](function(_0x1eeeb8){var _0x5c56d3=_0x1eeeb8[_0xa57c('0x35')]({'plain':!![]});return utilLicense[_0xa57c('0x36')](_0x5c56d3,_0x24a087[_0xa57c('0x33')][_0xa57c('0x37')]);})[_0xa57c('0x21')](function(_0x44350f){if(!_0x44350f['demo']){return saveUpdates(_0x24a087['body'],null);}return _0x44350f;})[_0xa57c('0x21')](respondWithResult(_0x501a4c,null))[_0xa57c('0x32')](handleError(_0x501a4c,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 98a0701..f476d34 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 _0x6f07=['bluebird','request-promise','path','../../config/environment','./license.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x33fc83,_0x1ff55c){var _0x19911d=function(_0x2da152){while(--_0x2da152){_0x33fc83['push'](_0x33fc83['shift']());}};_0x19911d(++_0x1ff55c);}(_0x6f07,0x14b));var _0x76f0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6f07[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x76f0('0x0'));var util=require(_0x76f0('0x1'));var logger=require(_0x76f0('0x2'))(_0x76f0('0x3'));var moment=require(_0x76f0('0x4'));var BPromise=require(_0x76f0('0x5'));var rp=require(_0x76f0('0x6'));var fs=require('fs');var path=require(_0x76f0('0x7'));var rimraf=require('rimraf');var config=require(_0x76f0('0x8'));var attributes=require(_0x76f0('0x9'));module[_0x76f0('0xa')]=function(_0x50e892,_0x12f7a0){return _0x50e892[_0x76f0('0xb')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c61=['exports','License','license','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./license.attributes'];(function(_0x2cb3eb,_0x4d83aa){var _0x2759ee=function(_0x4108a0){while(--_0x4108a0){_0x2cb3eb['push'](_0x2cb3eb['shift']());}};_0x2759ee(++_0x4d83aa);}(_0x0c61,0x16e));var _0x10c6=function(_0x4afac5,_0x1ab4ed){_0x4afac5=_0x4afac5-0x0;var _0x2404b3=_0x0c61[_0x4afac5];return _0x2404b3;};'use strict';var _=require(_0x10c6('0x0'));var util=require(_0x10c6('0x1'));var logger=require(_0x10c6('0x2'))(_0x10c6('0x3'));var moment=require('moment');var BPromise=require(_0x10c6('0x4'));var rp=require(_0x10c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x10c6('0x6'));var attributes=require(_0x10c6('0x7'));module[_0x10c6('0x8')]=function(_0x19b6f7,_0x2db1ea){return _0x19b6f7['define'](_0x10c6('0x9'),attributes,{'tableName':_0x10c6('0xa'),'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 a9214a8..3bc50d1 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 _0x25b9=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','request\x20sent','debug','error','code','License,\x20%s,\x20%s','message','lodash','bluebird','randomstring','ioredis'];(function(_0x4b609c,_0x53d9aa){var _0x2335c3=function(_0xe0b977){while(--_0xe0b977){_0x4b609c['push'](_0x4b609c['shift']());}};_0x2335c3(++_0x53d9aa);}(_0x25b9,0xb7));var _0x925b=function(_0x2c23af,_0x1ef6ec){_0x2c23af=_0x2c23af-0x0;var _0x31d4f7=_0x25b9[_0x2c23af];return _0x31d4f7;};'use strict';var _=require(_0x925b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x925b('0x1'));var rs=require(_0x925b('0x2'));var fs=require('fs');var Redis=require(_0x925b('0x3'));var db=require(_0x925b('0x4'))['db'];var utils=require(_0x925b('0x5'));var logger=require(_0x925b('0x6'))(_0x925b('0x7'));var config=require('../../config/environment');var jayson=require(_0x925b('0x8'));var client=jayson[_0x925b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26e2f8,_0x1b3bcb,_0x237a34){return new BPromise(function(_0x356a13,_0xe646f1){return client['request'](_0x26e2f8,_0x237a34)['then'](function(_0x45ae70){logger[_0x925b('0xa')]('License,\x20%s,\x20%s',_0x1b3bcb,_0x925b('0xb'));logger[_0x925b('0xc')]('License,\x20%s,\x20%s,\x20%s',_0x1b3bcb,_0x925b('0xb'),JSON['stringify'](_0x45ae70));if(_0x45ae70[_0x925b('0xd')]){if(_0x45ae70[_0x925b('0xd')][_0x925b('0xe')]===0x1f4){logger['error'](_0x925b('0xf'),_0x1b3bcb,_0x45ae70[_0x925b('0xd')]['message']);return _0xe646f1(_0x45ae70[_0x925b('0xd')][_0x925b('0x10')]);}logger['error'](_0x925b('0xf'),_0x1b3bcb,_0x45ae70[_0x925b('0xd')]['message']);return _0x356a13(_0x45ae70['error'][_0x925b('0x10')]);}else{logger[_0x925b('0xa')](_0x925b('0xf'),_0x1b3bcb,'request\x20sent');_0x356a13(_0x45ae70['result']['message']);}})['catch'](function(_0x376914){logger[_0x925b('0xd')]('License,\x20%s,\x20%s',_0x1b3bcb,_0x376914);_0xe646f1(_0x376914);});});} \ No newline at end of file +var _0x4a34=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x450393,_0x5fe7e){var _0x2039c7=function(_0x3192b6){while(--_0x3192b6){_0x450393['push'](_0x450393['shift']());}};_0x2039c7(++_0x5fe7e);}(_0x4a34,0xd0));var _0x44a3=function(_0x1156c0,_0x44c723){_0x1156c0=_0x1156c0-0x0;var _0x3644b4=_0x4a34[_0x1156c0];return _0x3644b4;};'use strict';var _=require(_0x44a3('0x0'));var util=require(_0x44a3('0x1'));var moment=require(_0x44a3('0x2'));var BPromise=require(_0x44a3('0x3'));var rs=require(_0x44a3('0x4'));var fs=require('fs');var Redis=require(_0x44a3('0x5'));var db=require(_0x44a3('0x6'))['db'];var utils=require(_0x44a3('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x44a3('0x8'));var jayson=require(_0x44a3('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x238d21,_0x18ea8a,_0x5ba4e7){return new BPromise(function(_0x5ad94a,_0x1439ef){return client[_0x44a3('0xa')](_0x238d21,_0x5ba4e7)[_0x44a3('0xb')](function(_0x42d162){logger[_0x44a3('0xc')](_0x44a3('0xd'),_0x18ea8a,'request\x20sent');logger[_0x44a3('0xe')](_0x44a3('0xf'),_0x18ea8a,_0x44a3('0x10'),JSON[_0x44a3('0x11')](_0x42d162));if(_0x42d162[_0x44a3('0x12')]){if(_0x42d162[_0x44a3('0x12')][_0x44a3('0x13')]===0x1f4){logger[_0x44a3('0x12')](_0x44a3('0xd'),_0x18ea8a,_0x42d162[_0x44a3('0x12')][_0x44a3('0x14')]);return _0x1439ef(_0x42d162['error'][_0x44a3('0x14')]);}logger[_0x44a3('0x12')](_0x44a3('0xd'),_0x18ea8a,_0x42d162['error'][_0x44a3('0x14')]);return _0x5ad94a(_0x42d162['error']['message']);}else{logger[_0x44a3('0xc')](_0x44a3('0xd'),_0x18ea8a,_0x44a3('0x10'));_0x5ad94a(_0x42d162[_0x44a3('0x15')]['message']);}})[_0x44a3('0x16')](function(_0x4a9b28){logger[_0x44a3('0x12')](_0x44a3('0xd'),_0x18ea8a,_0x4a9b28);_0x1439ef(_0x4a9b28);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 3312668..d492f07 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 _0x240f=['update','removeDispositions','delete','removeAnswers','removeImap','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','create','addSmtp','addInteraction','addApplications','/:id/send','/:id/users','addAgents','put'];(function(_0x23730a,_0x8aad83){var _0x1c5bb5=function(_0x4e95fc){while(--_0x4e95fc){_0x23730a['push'](_0x23730a['shift']());}};_0x1c5bb5(++_0x8aad83);}(_0x240f,0x12e));var _0xf240=function(_0x125c7b,_0x13929f){_0x125c7b=_0x125c7b-0x0;var _0xd7b82d=_0x240f[_0x125c7b];return _0xd7b82d;};'use strict';var multer=require(_0xf240('0x0'));var util=require(_0xf240('0x1'));var path=require(_0xf240('0x2'));var timeout=require(_0xf240('0x3'));var express=require('express');var router=express[_0xf240('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf240('0x5'));var config=require(_0xf240('0x6'));var controller=require(_0xf240('0x7'));router[_0xf240('0x8')]('/',auth[_0xf240('0x9')](),controller[_0xf240('0xa')]);router[_0xf240('0x8')](_0xf240('0xb'),auth['isAuthenticated'](),controller[_0xf240('0xc')]);router[_0xf240('0x8')](_0xf240('0xd'),auth['isAuthenticated'](),controller[_0xf240('0xe')]);router[_0xf240('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf240('0xf')]);router[_0xf240('0x8')]('/:id/canned_answers',auth[_0xf240('0x9')](),controller[_0xf240('0x10')]);router['get'](_0xf240('0x11'),auth[_0xf240('0x9')](),controller[_0xf240('0x12')]);router['get'](_0xf240('0x13'),auth[_0xf240('0x9')](),controller[_0xf240('0x14')]);router[_0xf240('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xf240('0x15')]);router[_0xf240('0x8')](_0xf240('0x16'),auth[_0xf240('0x9')](),controller[_0xf240('0x17')]);router['get'](_0xf240('0x18'),auth[_0xf240('0x9')](),controller[_0xf240('0x19')]);router[_0xf240('0x8')]('/:id/verify',auth['isAuthenticated'](),controller[_0xf240('0x1a')]);router['get']('/:id/users',auth[_0xf240('0x9')](),controller[_0xf240('0x1b')]);router[_0xf240('0x1c')](_0xf240('0x1d'),auth[_0xf240('0x9')](),controller[_0xf240('0x1e')]);router[_0xf240('0x1c')](_0xf240('0x1f'),auth['isAuthenticated'](),controller[_0xf240('0x20')]);router['post']('/',auth[_0xf240('0x9')](),controller[_0xf240('0x21')]);router[_0xf240('0x1c')](_0xf240('0x11'),auth[_0xf240('0x9')](),controller['addImap']);router[_0xf240('0x1c')](_0xf240('0x13'),auth['isAuthenticated'](),controller[_0xf240('0x22')]);router['post']('/:id/interactions',auth[_0xf240('0x9')](),controller[_0xf240('0x23')]);router[_0xf240('0x1c')](_0xf240('0x16'),auth[_0xf240('0x9')](),controller[_0xf240('0x24')]);router[_0xf240('0x1c')](_0xf240('0x25'),auth[_0xf240('0x9')](),controller['send']);router['post'](_0xf240('0x26'),auth[_0xf240('0x9')](),controller[_0xf240('0x27')]);router[_0xf240('0x28')]('/:id',auth[_0xf240('0x9')](),controller[_0xf240('0x29')]);router['delete']('/:id/dispositions',auth[_0xf240('0x9')](),controller[_0xf240('0x2a')]);router[_0xf240('0x2b')](_0xf240('0x1f'),auth[_0xf240('0x9')](),controller[_0xf240('0x2c')]);router['delete'](_0xf240('0x11'),auth[_0xf240('0x9')](),controller[_0xf240('0x2d')]);router[_0xf240('0x2b')](_0xf240('0x13'),auth['isAuthenticated'](),controller['removeSmtp']);router['delete'](_0xf240('0xd'),auth[_0xf240('0x9')](),controller[_0xf240('0x2e')]);router['delete'](_0xf240('0x26'),auth[_0xf240('0x9')](),controller[_0xf240('0x2f')]);module[_0xf240('0x30')]=router; \ No newline at end of file +var _0xa43f=['/:id/send','/:id','update','removeDispositions','delete','removeAnswers','removeSmtp','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addImap','addApplications'];(function(_0x1bdbed,_0x27b1ae){var _0x3308f6=function(_0x2e7c94){while(--_0x2e7c94){_0x1bdbed['push'](_0x1bdbed['shift']());}};_0x3308f6(++_0x27b1ae);}(_0xa43f,0x19e));var _0xfa43=function(_0x1f0b3c,_0x2ac0f7){_0x1f0b3c=_0x1f0b3c-0x0;var _0x52137e=_0xa43f[_0x1f0b3c];return _0x52137e;};'use strict';var multer=require(_0xfa43('0x0'));var util=require(_0xfa43('0x1'));var path=require(_0xfa43('0x2'));var timeout=require('connect-timeout');var express=require(_0xfa43('0x3'));var router=express[_0xfa43('0x4')]();var fs_extra=require(_0xfa43('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfa43('0x6'));var config=require(_0xfa43('0x7'));var controller=require('./mailAccount.controller');router[_0xfa43('0x8')]('/',auth[_0xfa43('0x9')](),controller[_0xfa43('0xa')]);router[_0xfa43('0x8')]('/describe',auth[_0xfa43('0x9')](),controller['describe']);router[_0xfa43('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xfa43('0xb')]);router[_0xfa43('0x8')](_0xfa43('0xc'),auth['isAuthenticated'](),controller[_0xfa43('0xd')]);router[_0xfa43('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xfa43('0xe')]);router[_0xfa43('0x8')](_0xfa43('0xf'),auth[_0xfa43('0x9')](),controller[_0xfa43('0x10')]);router[_0xfa43('0x8')](_0xfa43('0x11'),auth[_0xfa43('0x9')](),controller[_0xfa43('0x12')]);router[_0xfa43('0x8')](_0xfa43('0x13'),auth['isAuthenticated'](),controller[_0xfa43('0x14')]);router[_0xfa43('0x8')](_0xfa43('0x15'),auth['isAuthenticated'](),controller[_0xfa43('0x16')]);router[_0xfa43('0x8')](_0xfa43('0x17'),auth[_0xfa43('0x9')](),controller[_0xfa43('0x18')]);router[_0xfa43('0x8')](_0xfa43('0x19'),auth[_0xfa43('0x9')](),controller[_0xfa43('0x1a')]);router[_0xfa43('0x8')](_0xfa43('0x1b'),auth[_0xfa43('0x9')](),controller[_0xfa43('0x1c')]);router[_0xfa43('0x1d')]('/:id/dispositions',auth[_0xfa43('0x9')](),controller[_0xfa43('0x1e')]);router[_0xfa43('0x1d')](_0xfa43('0x1f'),auth[_0xfa43('0x9')](),controller[_0xfa43('0x20')]);router[_0xfa43('0x1d')]('/',auth['isAuthenticated'](),controller[_0xfa43('0x21')]);router[_0xfa43('0x1d')](_0xfa43('0xf'),auth[_0xfa43('0x9')](),controller[_0xfa43('0x22')]);router['post']('/:id/out_servers',auth[_0xfa43('0x9')](),controller['addSmtp']);router[_0xfa43('0x1d')](_0xfa43('0x13'),auth[_0xfa43('0x9')](),controller['addInteraction']);router['post'](_0xfa43('0x15'),auth['isAuthenticated'](),controller[_0xfa43('0x23')]);router[_0xfa43('0x1d')](_0xfa43('0x24'),auth[_0xfa43('0x9')](),controller['send']);router['post']('/:id/users',auth[_0xfa43('0x9')](),controller['addAgents']);router['put'](_0xfa43('0x25'),auth[_0xfa43('0x9')](),controller[_0xfa43('0x26')]);router['delete']('/:id/dispositions',auth[_0xfa43('0x9')](),controller[_0xfa43('0x27')]);router[_0xfa43('0x28')]('/:id/canned_answers',auth[_0xfa43('0x9')](),controller[_0xfa43('0x29')]);router[_0xfa43('0x28')](_0xfa43('0xf'),auth[_0xfa43('0x9')](),controller['removeImap']);router['delete']('/:id/out_servers',auth[_0xfa43('0x9')](),controller[_0xfa43('0x2a')]);router[_0xfa43('0x28')](_0xfa43('0x25'),auth['isAuthenticated'](),controller['destroy']);router[_0xfa43('0x28')](_0xfa43('0x1b'),auth[_0xfa43('0x9')](),controller[_0xfa43('0x2b')]);module[_0xfa43('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index cc08668..a3c9377 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 _0x00bb=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x1188f2,_0x234698){var _0xfebdd=function(_0x3c2924){while(--_0x3c2924){_0x1188f2['push'](_0x1188f2['shift']());}};_0xfebdd(++_0x234698);}(_0x00bb,0x1d8));var _0xb00b=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x00bb[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'description':{'type':Sequelize[_0xb00b('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xb00b('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xb00b('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xb00b('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xb00b('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xb00b('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xb00b('0x4')],'defaultValue':function(){return _0xb00b('0x5');}},'notificationSound':{'type':Sequelize[_0xb00b('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb00b('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb00b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb00b('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb00b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb00b('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xb00b('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xb00b('0x3')],'defaultValue':![],'comment':_0xb00b('0x8'),'set':function(_0x48e125){if(!_0x48e125)this[_0xb00b('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x48e125);}}}; \ No newline at end of file +var _0x0f89=['STRING','BOOLEAN','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports'];(function(_0x4f8974,_0x16b514){var _0x526e9b=function(_0x47d55d){while(--_0x47d55d){_0x4f8974['push'](_0x4f8974['shift']());}};_0x526e9b(++_0x16b514);}(_0x0f89,0x111));var _0x90f8=function(_0xbea70,_0x17b155){_0xbea70=_0xbea70-0x0;var _0x3babb8=_0x0f89[_0xbea70];return _0x3babb8;};'use strict';var Sequelize=require(_0x90f8('0x0'));module[_0x90f8('0x1')]={'description':{'type':Sequelize[_0x90f8('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x90f8('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x90f8('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x90f8('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x90f8('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x90f8('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x90f8('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x90f8('0x4')](0x2)[_0x90f8('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x90f8('0x6')],'defaultValue':function(){return _0x90f8('0x7');}},'notificationSound':{'type':Sequelize[_0x90f8('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x90f8('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x90f8('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x90f8('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x90f8('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x90f8('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x90f8('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x90f8('0x3')],'defaultValue':![],'comment':_0x90f8('0x8'),'set':function(_0x37126f){if(!_0x37126f)this[_0x90f8('0x9')](_0x90f8('0xa'),null);this[_0x90f8('0x9')]('mandatoryDisposition',_0x37126f);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 5c23b84..abbc6c5 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 _0xc1b4=['sendStatus','stack','name','send','index','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','MailServerIn','find','update','body','describe','addDisposition','create','getDispositions','findOne','Disposition','rawAttributes','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','pick','removeAnswers','key','email','ListId','description','isNil','cservice','cauthentication','user','cuser','password','authentication','port','host','service','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','getImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','Tag','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','Contacts','updatedAt','from','%s\x20<%s>','attachments','join','root','server/files/attachments','auth','pass','secure','SendMail','sendMail','List\x20not\x20found','List','CmContact','messageId','subject','attach','out','Interaction','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','MailAccounts','UserProfileResource'];(function(_0x152bdc,_0x3d0f53){var _0x514c4f=function(_0x4e4970){while(--_0x4e4970){_0x152bdc['push'](_0x152bdc['shift']());}};_0x514c4f(++_0x3d0f53);}(_0xc1b4,0x87));var _0x4c1b=function(_0x5aaf42,_0x2e14f2){_0x5aaf42=_0x5aaf42-0x0;var _0x547a37=_0xc1b4[_0x5aaf42];return _0x547a37;};'use strict';var emlformat=require(_0x4c1b('0x0'));var rimraf=require(_0x4c1b('0x1'));var zipdir=require(_0x4c1b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c1b('0x3'));var moment=require(_0x4c1b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4c1b('0x5'));var util=require(_0x4c1b('0x6'));var path=require(_0x4c1b('0x7'));var sox=require(_0x4c1b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c1b('0x9'));var squel=require(_0x4c1b('0xa'));var crypto=require(_0x4c1b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4c1b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require(_0x4c1b('0xd'));var juice=require(_0x4c1b('0xe'));var Redis=require(_0x4c1b('0xf'));var authService=require(_0x4c1b('0x10'));var qs=require(_0x4c1b('0x11'));var as=require(_0x4c1b('0x12'));var hardwareService=require(_0x4c1b('0x13'));var logger=require('../../config/logger')(_0x4c1b('0x14'));var utils=require(_0x4c1b('0x15'));var config=require(_0x4c1b('0x16'));var licenseUtil=require(_0x4c1b('0x17'));var db=require(_0x4c1b('0x18'))['db'];config[_0x4c1b('0x19')]=_[_0x4c1b('0x1a')](config[_0x4c1b('0x19')],{'host':_0x4c1b('0x1b'),'port':0x18eb});var socket=require(_0x4c1b('0x1c'))(new Redis(config[_0x4c1b('0x19')]));require(_0x4c1b('0x1d'))[_0x4c1b('0x1e')](socket);var jayson=require(_0x4c1b('0x1f'));var client=jayson[_0x4c1b('0x20')][_0x4c1b('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x2ef264,_0x4c92c2,_0xc78c6e,_0x59be0f){return new BPromise(function(_0x3d08be,_0x357160){var _0x49bdea=_0x59be0f||client;return _0x49bdea[_0x4c1b('0x22')](_0x2ef264,_0xc78c6e)[_0x4c1b('0x23')](function(_0x86f884){logger[_0x4c1b('0x24')](_0x4c1b('0x25'),_0x4c92c2,_0x4c1b('0x26'));logger[_0x4c1b('0x27')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x4c92c2,_0x4c1b('0x26'),JSON[_0x4c1b('0x28')](_0x86f884));if(_0x86f884['error']){if(_0x86f884[_0x4c1b('0x29')][_0x4c1b('0x2a')]===0x1f4){logger[_0x4c1b('0x29')](_0x4c1b('0x25'),_0x4c92c2,_0x86f884[_0x4c1b('0x29')][_0x4c1b('0x2b')]);return _0x357160(_0x86f884[_0x4c1b('0x29')]['message']);}logger['error'](_0x4c1b('0x25'),_0x4c92c2,_0x86f884['error'][_0x4c1b('0x2b')]);return _0x3d08be(_0x86f884[_0x4c1b('0x29')][_0x4c1b('0x2b')]);}else{logger[_0x4c1b('0x24')]('MailAccount,\x20%s,\x20%s',_0x4c92c2,_0x4c1b('0x26'));_0x3d08be(_0x86f884[_0x4c1b('0x2c')]['message']);}})[_0x4c1b('0x2d')](function(_0x3ba621){logger[_0x4c1b('0x29')](_0x4c1b('0x25'),_0x4c92c2,_0x3ba621);_0x357160(_0x3ba621);});});}function respondWithStatusCode(_0x517051,_0x5f16ef){_0x5f16ef=_0x5f16ef||0xcc;return function(_0x5ef9f8){if(_0x5ef9f8){return _0x517051['sendStatus'](_0x5f16ef);}return _0x517051[_0x4c1b('0x2e')](_0x5f16ef)[_0x4c1b('0x2f')]();};}function respondWithResult(_0x113446,_0x16f30a){_0x16f30a=_0x16f30a||0xc8;return function(_0x13a140){if(_0x13a140){return _0x113446[_0x4c1b('0x2e')](_0x16f30a)[_0x4c1b('0x30')](_0x13a140);}};}function respondWithFilteredResult(_0x5f3f06,_0x5cba9e){return function(_0x3e32c2){if(_0x3e32c2){var _0x34a4bb=typeof _0x5cba9e['offset']==='undefined'&&typeof _0x5cba9e['limit']===_0x4c1b('0x31');var _0x3244b5=_0x3e32c2[_0x4c1b('0x32')];var _0x562cc6=_0x34a4bb?0x0:_0x5cba9e[_0x4c1b('0x33')];var _0x13039f=_0x34a4bb?_0x3e32c2[_0x4c1b('0x32')]:_0x5cba9e[_0x4c1b('0x33')]+_0x5cba9e[_0x4c1b('0x34')];var _0x10e855;if(_0x13039f>=_0x3244b5){_0x13039f=_0x3244b5;_0x10e855=0xc8;}else{_0x10e855=0xce;}_0x5f3f06['status'](_0x10e855);return _0x5f3f06[_0x4c1b('0x35')](_0x4c1b('0x36'),_0x562cc6+'-'+_0x13039f+'/'+_0x3244b5)[_0x4c1b('0x30')](_0x3e32c2);}return null;};}function patchUpdates(_0x19c7b){return function(_0x216fc6){try{jsonpatch[_0x4c1b('0x37')](_0x216fc6,_0x19c7b,!![]);}catch(_0xf87415){return BPromise[_0x4c1b('0x38')](_0xf87415);}return _0x216fc6[_0x4c1b('0x39')]();};}function saveUpdates(_0x38bd0c,_0x324d5f){return function(_0x1c197c){if(_0x1c197c){return _0x1c197c['update'](_0x38bd0c)[_0x4c1b('0x23')](function(_0x183f1a){return _0x183f1a;});}return null;};}function removeEntity(_0x394ce4,_0x1bb79e){return function(_0x2ae75e){if(_0x2ae75e){return _0x2ae75e[_0x4c1b('0x3a')]()['then'](function(){var _0x59cc95=_0x2ae75e[_0x4c1b('0x3b')]({'plain':!![]});var _0x4a2e66=_0x4c1b('0x3c');return db[_0x4c1b('0x3d')][_0x4c1b('0x3a')]({'where':{'type':_0x4a2e66,'resourceId':_0x59cc95['id']}})[_0x4c1b('0x23')](function(){return _0x2ae75e;});})[_0x4c1b('0x23')](function(){_0x394ce4[_0x4c1b('0x2e')](0xcc)[_0x4c1b('0x2f')]();});}};}function handleEntityNotFound(_0x3ec050,_0x153bb2){return function(_0x1cf872){if(!_0x1cf872){_0x3ec050[_0x4c1b('0x3e')](0x194);}return _0x1cf872;};}function handleError(_0x516fe7,_0x1d568e){_0x1d568e=_0x1d568e||0x1f4;return function(_0x851198){logger['error'](_0x851198[_0x4c1b('0x3f')]);if(_0x851198[_0x4c1b('0x40')]){delete _0x851198['name'];}_0x516fe7[_0x4c1b('0x2e')](_0x1d568e)[_0x4c1b('0x41')](_0x851198);};}exports[_0x4c1b('0x42')]=function(_0x5c06c7,_0x26e973){var _0x3140a9={'include':[{'model':db['MailServerIn'],'as':_0x4c1b('0x43')},{'model':db[_0x4c1b('0x44')],'as':_0x4c1b('0x45')},{'model':db[_0x4c1b('0x46')],'as':_0x4c1b('0x47')}]},_0x247398={},_0x2740d6={'count':0x0,'rows':[]};var _0x5e3d64=_[_0x4c1b('0x48')](db[_0x4c1b('0x49')]['rawAttributes'],function(_0x1e699c){return{'name':_0x1e699c[_0x4c1b('0x4a')],'type':_0x1e699c[_0x4c1b('0x4b')]['key']};});_0x247398['model']=_[_0x4c1b('0x48')](_0x5e3d64,_0x4c1b('0x40'));_0x247398[_0x4c1b('0x4c')]=_[_0x4c1b('0x4d')](_0x5c06c7[_0x4c1b('0x4c')]);_0x247398['filters']=_['intersection'](_0x247398[_0x4c1b('0x4e')],_0x247398[_0x4c1b('0x4c')]);_0x3140a9[_0x4c1b('0x4f')]=_[_0x4c1b('0x50')](_0x247398['model'],qs[_0x4c1b('0x51')](_0x5c06c7[_0x4c1b('0x4c')][_0x4c1b('0x51')]));_0x3140a9[_0x4c1b('0x4f')]=_0x3140a9['attributes'][_0x4c1b('0x52')]?_0x3140a9[_0x4c1b('0x4f')]:_0x247398[_0x4c1b('0x4e')];if(!_0x5c06c7['query'][_0x4c1b('0x53')](_0x4c1b('0x54'))){_0x3140a9['limit']=qs[_0x4c1b('0x34')](_0x5c06c7[_0x4c1b('0x4c')][_0x4c1b('0x34')]);_0x3140a9[_0x4c1b('0x33')]=qs['offset'](_0x5c06c7[_0x4c1b('0x4c')][_0x4c1b('0x33')]);}_0x3140a9[_0x4c1b('0x55')]=qs['sort'](_0x5c06c7[_0x4c1b('0x4c')][_0x4c1b('0x56')]);_0x3140a9[_0x4c1b('0x57')]=qs[_0x4c1b('0x58')](_['pick'](_0x5c06c7[_0x4c1b('0x4c')],_0x247398['filters']),_0x5e3d64);if(_0x5c06c7[_0x4c1b('0x4c')][_0x4c1b('0x59')]){_0x3140a9[_0x4c1b('0x57')]=_[_0x4c1b('0x5a')](_0x3140a9[_0x4c1b('0x57')],{'$or':_[_0x4c1b('0x48')](_0x5e3d64,function(_0x152148){if(_0x152148['type']!==_0x4c1b('0x5b')){var _0x66860c={};_0x66860c[_0x152148[_0x4c1b('0x40')]]={'$like':'%'+_0x5c06c7[_0x4c1b('0x4c')]['filter']+'%'};return _0x66860c;}})});}_0x3140a9=_['merge']({},_0x3140a9,_0x5c06c7[_0x4c1b('0x5c')]);var _0x8631b3={'where':_0x3140a9[_0x4c1b('0x57')]};return db[_0x4c1b('0x49')][_0x4c1b('0x32')](_0x8631b3)['then'](function(_0x3bcb97){_0x2740d6['count']=_0x3bcb97;if(_0x5c06c7[_0x4c1b('0x4c')][_0x4c1b('0x5d')]){_0x3140a9[_0x4c1b('0x5e')]=[{'all':!![]}];}return db[_0x4c1b('0x49')][_0x4c1b('0x5f')](_0x3140a9);})['then'](function(_0x38ae34){_0x2740d6[_0x4c1b('0x60')]=_0x38ae34;return _0x2740d6;})[_0x4c1b('0x23')](respondWithFilteredResult(_0x26e973,_0x3140a9))[_0x4c1b('0x2d')](handleError(_0x26e973,null));};exports['show']=function(_0x26e785,_0x356d28){var _0x281165={'raw':![],'where':{'id':_0x26e785[_0x4c1b('0x61')]['id']},'include':[{'model':db[_0x4c1b('0x62')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x4c1b('0x45')},{'model':db[_0x4c1b('0x46')],'as':_0x4c1b('0x47')}]},_0x4966d3={};_0x4966d3['model']=_[_0x4c1b('0x4d')](db[_0x4c1b('0x49')]['rawAttributes']);_0x4966d3[_0x4c1b('0x4c')]=_[_0x4c1b('0x4d')](_0x26e785[_0x4c1b('0x4c')]);_0x4966d3[_0x4c1b('0x58')]=_['intersection'](_0x4966d3['model'],_0x4966d3[_0x4c1b('0x4c')]);_0x281165['attributes']=_[_0x4c1b('0x50')](_0x4966d3['model'],qs[_0x4c1b('0x51')](_0x26e785[_0x4c1b('0x4c')][_0x4c1b('0x51')]));_0x281165[_0x4c1b('0x4f')]=_0x281165[_0x4c1b('0x4f')][_0x4c1b('0x52')]?_0x281165[_0x4c1b('0x4f')]:_0x4966d3[_0x4c1b('0x4e')];if(_0x26e785[_0x4c1b('0x4c')]['includeAll']){_0x281165[_0x4c1b('0x5e')]=[{'all':!![]}];}_0x281165=_[_0x4c1b('0x5a')]({},_0x281165,_0x26e785[_0x4c1b('0x5c')]);return db[_0x4c1b('0x49')][_0x4c1b('0x63')](_0x281165)[_0x4c1b('0x23')](handleEntityNotFound(_0x356d28,null))[_0x4c1b('0x23')](respondWithResult(_0x356d28,null))[_0x4c1b('0x2d')](handleError(_0x356d28,null));};exports[_0x4c1b('0x64')]=function(_0x41d50e,_0x16e0a2){if(_0x41d50e[_0x4c1b('0x65')]['id']){delete _0x41d50e[_0x4c1b('0x65')]['id'];}return db[_0x4c1b('0x49')]['find']({'where':{'id':_0x41d50e[_0x4c1b('0x61')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x4c1b('0x43')},{'model':db[_0x4c1b('0x44')],'as':_0x4c1b('0x45')},{'model':db[_0x4c1b('0x46')],'as':_0x4c1b('0x47')}]})[_0x4c1b('0x23')](handleEntityNotFound(_0x16e0a2,null))[_0x4c1b('0x23')](saveUpdates(_0x41d50e[_0x4c1b('0x65')],null))[_0x4c1b('0x23')](function(_0x24aa46){if(_0x24aa46&&_0x41d50e[_0x4c1b('0x65')][_0x4c1b('0x43')]){return db[_0x4c1b('0x62')][_0x4c1b('0x64')](_0x41d50e[_0x4c1b('0x65')]['Imap'],{'where':{'MailAccountId':_0x24aa46['id']}})[_0x4c1b('0x23')](function(){return _0x24aa46;});}return _0x24aa46;})[_0x4c1b('0x23')](function(_0x1203b7){if(_0x1203b7&&_0x41d50e[_0x4c1b('0x65')][_0x4c1b('0x45')]){return db[_0x4c1b('0x44')]['update'](_0x41d50e[_0x4c1b('0x65')][_0x4c1b('0x45')],{'where':{'MailAccountId':_0x1203b7['id']}})[_0x4c1b('0x23')](function(){return _0x1203b7;});}return _0x1203b7;})[_0x4c1b('0x23')](respondWithResult(_0x16e0a2,null))[_0x4c1b('0x2d')](handleError(_0x16e0a2,null));};exports[_0x4c1b('0x66')]=function(_0x56c08a,_0x1599ca){return db[_0x4c1b('0x49')][_0x4c1b('0x66')]()[_0x4c1b('0x23')](respondWithResult(_0x1599ca,null))[_0x4c1b('0x2d')](handleError(_0x1599ca,null));};exports[_0x4c1b('0x67')]=function(_0x33e07c,_0x340e34,_0x456642){if(_0x33e07c[_0x4c1b('0x65')]['id']){delete _0x33e07c[_0x4c1b('0x65')]['id'];}return db[_0x4c1b('0x49')]['find']({'where':{'id':_0x33e07c[_0x4c1b('0x61')]['id']}})['then'](handleEntityNotFound(_0x340e34,null))[_0x4c1b('0x23')](function(_0x2b073f){if(_0x2b073f){_0x33e07c['body']['MailAccountId']=_0x2b073f['id'];return db['Disposition'][_0x4c1b('0x68')](_0x33e07c['body']);}})['then'](respondWithResult(_0x340e34,null))[_0x4c1b('0x2d')](handleError(_0x340e34,null));};exports[_0x4c1b('0x69')]=function(_0x2f2de2,_0x53ecf0,_0x4ff539){var _0x16ba42={'raw':![],'where':{}};var _0x270c97={};var _0x2e1019={'count':0x0,'rows':[]};return db[_0x4c1b('0x49')][_0x4c1b('0x6a')]({'where':{'id':_0x2f2de2['params']['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x53ecf0,null))[_0x4c1b('0x23')](function(_0x8ec6e1){if(_0x8ec6e1){_0x270c97[_0x4c1b('0x4e')]=_[_0x4c1b('0x4d')](db[_0x4c1b('0x6b')][_0x4c1b('0x6c')]);_0x270c97['query']=_[_0x4c1b('0x4d')](_0x2f2de2[_0x4c1b('0x4c')]);_0x270c97[_0x4c1b('0x58')]=_[_0x4c1b('0x50')](_0x270c97['model'],_0x270c97['query']);_0x16ba42[_0x4c1b('0x4f')]=_[_0x4c1b('0x50')](_0x270c97['model'],qs['fields'](_0x2f2de2[_0x4c1b('0x4c')][_0x4c1b('0x51')]));_0x16ba42['attributes']=_0x16ba42[_0x4c1b('0x4f')]['length']?_0x16ba42['attributes']:_0x270c97[_0x4c1b('0x4e')];if(!_0x2f2de2[_0x4c1b('0x4c')][_0x4c1b('0x53')](_0x4c1b('0x54'))){_0x16ba42[_0x4c1b('0x34')]=qs[_0x4c1b('0x34')](_0x2f2de2[_0x4c1b('0x4c')][_0x4c1b('0x34')]);_0x16ba42[_0x4c1b('0x33')]=qs[_0x4c1b('0x33')](_0x2f2de2['query']['offset']);}_0x16ba42[_0x4c1b('0x55')]=qs['sort'](_0x2f2de2[_0x4c1b('0x4c')]['sort']);_0x16ba42[_0x4c1b('0x57')]=qs['filters'](_['pick'](_0x2f2de2[_0x4c1b('0x4c')],_0x270c97['filters']));_0x16ba42[_0x4c1b('0x57')][_0x4c1b('0x6d')]=_0x8ec6e1['id'];if(_0x2f2de2[_0x4c1b('0x4c')][_0x4c1b('0x59')]){_0x16ba42[_0x4c1b('0x57')]=_[_0x4c1b('0x5a')](_0x16ba42['where'],{'$or':_[_0x4c1b('0x48')](_0x16ba42['attributes'],function(_0x547d54){var _0x4ab264={};_0x4ab264[_0x547d54]={'$like':'%'+_0x2f2de2[_0x4c1b('0x4c')][_0x4c1b('0x59')]+'%'};return _0x4ab264;})});}_0x16ba42=_[_0x4c1b('0x5a')]({},_0x16ba42,_0x2f2de2[_0x4c1b('0x5c')]);return db['Disposition'][_0x4c1b('0x32')]({'where':_0x16ba42[_0x4c1b('0x57')]})[_0x4c1b('0x23')](function(_0x4ec1c1){_0x2e1019[_0x4c1b('0x32')]=_0x4ec1c1;if(_0x2f2de2[_0x4c1b('0x4c')][_0x4c1b('0x5d')]){_0x16ba42['include']=[{'all':!![]}];}return db['Disposition'][_0x4c1b('0x5f')](_0x16ba42);})[_0x4c1b('0x23')](function(_0x5d8dd3){_0x2e1019[_0x4c1b('0x60')]=_0x5d8dd3;return _0x2e1019;});}})[_0x4c1b('0x23')](respondWithFilteredResult(_0x53ecf0,_0x16ba42))['catch'](handleError(_0x53ecf0,null));};exports[_0x4c1b('0x6e')]=function(_0x34fc5b,_0x195a65,_0x2f9f5d){return db[_0x4c1b('0x49')][_0x4c1b('0x63')]({'where':{'id':_0x34fc5b[_0x4c1b('0x61')]['id']}})['then'](handleEntityNotFound(_0x195a65,null))[_0x4c1b('0x23')](function(_0x3d3275){if(_0x3d3275){return _0x3d3275['removeDispositions'](_0x34fc5b[_0x4c1b('0x4c')][_0x4c1b('0x6f')]);}})[_0x4c1b('0x23')](respondWithStatusCode(_0x195a65,null))[_0x4c1b('0x2d')](handleError(_0x195a65,null));};exports[_0x4c1b('0x70')]=function(_0x35ad55,_0x260ada,_0x4f23d5){if(_0x35ad55['body']['id']){delete _0x35ad55['body']['id'];}return db[_0x4c1b('0x49')][_0x4c1b('0x63')]({'where':{'id':_0x35ad55['params']['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x260ada,null))[_0x4c1b('0x23')](function(_0x4eda8f){if(_0x4eda8f){_0x35ad55[_0x4c1b('0x65')]['MailAccountId']=_0x4eda8f['id'];return db[_0x4c1b('0x71')][_0x4c1b('0x68')](_0x35ad55['body']);}})[_0x4c1b('0x23')](respondWithResult(_0x260ada,null))['catch'](handleError(_0x260ada,null));};exports['getAnswers']=function(_0x293c31,_0x39b909,_0x3aeba4){var _0x41d31a={'raw':![],'where':{}};var _0x32c7c5={};var _0x40e1b6={'count':0x0,'rows':[]};return db[_0x4c1b('0x49')][_0x4c1b('0x6a')]({'where':{'id':_0x293c31[_0x4c1b('0x61')]['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x39b909,null))['then'](function(_0x4fe52b){if(_0x4fe52b){_0x32c7c5['model']=_['keys'](db[_0x4c1b('0x71')][_0x4c1b('0x6c')]);_0x32c7c5[_0x4c1b('0x4c')]=_['keys'](_0x293c31[_0x4c1b('0x4c')]);_0x32c7c5[_0x4c1b('0x58')]=_[_0x4c1b('0x50')](_0x32c7c5['model'],_0x32c7c5[_0x4c1b('0x4c')]);_0x41d31a[_0x4c1b('0x4f')]=_[_0x4c1b('0x50')](_0x32c7c5[_0x4c1b('0x4e')],qs[_0x4c1b('0x51')](_0x293c31[_0x4c1b('0x4c')]['fields']));_0x41d31a[_0x4c1b('0x4f')]=_0x41d31a['attributes'][_0x4c1b('0x52')]?_0x41d31a[_0x4c1b('0x4f')]:_0x32c7c5[_0x4c1b('0x4e')];if(!_0x293c31[_0x4c1b('0x4c')]['hasOwnProperty'](_0x4c1b('0x54'))){_0x41d31a[_0x4c1b('0x34')]=qs['limit'](_0x293c31[_0x4c1b('0x4c')]['limit']);_0x41d31a[_0x4c1b('0x33')]=qs[_0x4c1b('0x33')](_0x293c31[_0x4c1b('0x4c')][_0x4c1b('0x33')]);}_0x41d31a['order']=qs[_0x4c1b('0x56')](_0x293c31[_0x4c1b('0x4c')][_0x4c1b('0x56')]);_0x41d31a['where']=qs[_0x4c1b('0x58')](_[_0x4c1b('0x72')](_0x293c31[_0x4c1b('0x4c')],_0x32c7c5[_0x4c1b('0x58')]));_0x41d31a[_0x4c1b('0x57')]['MailAccountId']=_0x4fe52b['id'];if(_0x293c31[_0x4c1b('0x4c')]['filter']){_0x41d31a[_0x4c1b('0x57')]=_['merge'](_0x41d31a[_0x4c1b('0x57')],{'$or':_[_0x4c1b('0x48')](_0x41d31a[_0x4c1b('0x4f')],function(_0x40302f){var _0x14173f={};_0x14173f[_0x40302f]={'$like':'%'+_0x293c31[_0x4c1b('0x4c')]['filter']+'%'};return _0x14173f;})});}_0x41d31a=_[_0x4c1b('0x5a')]({},_0x41d31a,_0x293c31[_0x4c1b('0x5c')]);return db[_0x4c1b('0x71')]['count']({'where':_0x41d31a[_0x4c1b('0x57')]})[_0x4c1b('0x23')](function(_0x3b05fb){_0x40e1b6[_0x4c1b('0x32')]=_0x3b05fb;if(_0x293c31[_0x4c1b('0x4c')]['includeAll']){_0x41d31a[_0x4c1b('0x5e')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x41d31a);})[_0x4c1b('0x23')](function(_0x37cb8f){_0x40e1b6[_0x4c1b('0x60')]=_0x37cb8f;return _0x40e1b6;});}})['then'](respondWithFilteredResult(_0x39b909,_0x41d31a))[_0x4c1b('0x2d')](handleError(_0x39b909,null));};exports[_0x4c1b('0x73')]=function(_0x5ec3f4,_0x163a13,_0x5e6ca1){return db[_0x4c1b('0x49')]['find']({'where':{'id':_0x5ec3f4['params']['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x163a13,null))[_0x4c1b('0x23')](function(_0x4a281b){if(_0x4a281b){return _0x4a281b[_0x4c1b('0x73')](_0x5ec3f4['query'][_0x4c1b('0x6f')]);}})[_0x4c1b('0x23')](respondWithStatusCode(_0x163a13,null))[_0x4c1b('0x2d')](handleError(_0x163a13,null));};exports[_0x4c1b('0x68')]=function(_0x2c3502,_0x33418f){var _0x38faa7={'name':_0x2c3502['body']['name'],'key':_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x74')],'email':_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x75')],'ListId':_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x76')],'active':!_['isNil'](_0x2c3502[_0x4c1b('0x65')]['active'])?_0x2c3502['body']['active']:!![],'description':_0x2c3502['body'][_0x4c1b('0x77')]||null,'Imap':{},'Smtp':{}};if(_[_0x4c1b('0x78')](_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x79')])){if(_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x7a')]){_0x38faa7[_0x4c1b('0x43')]['user']=_0x38faa7[_0x4c1b('0x45')][_0x4c1b('0x7b')]=_0x2c3502['body'][_0x4c1b('0x7c')];_0x38faa7[_0x4c1b('0x43')][_0x4c1b('0x7d')]=_0x38faa7[_0x4c1b('0x45')]['pass']=_0x2c3502['body']['cpassword'];}else{_0x38faa7['Imap'][_0x4c1b('0x7e')]=_0x38faa7[_0x4c1b('0x45')][_0x4c1b('0x7e')]=![];}_0x38faa7[_0x4c1b('0x43')]['host']=_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x43')]['host'];_0x38faa7[_0x4c1b('0x43')]['port']=_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x43')][_0x4c1b('0x7f')];_0x38faa7[_0x4c1b('0x45')][_0x4c1b('0x80')]=_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x45')][_0x4c1b('0x80')];_0x38faa7[_0x4c1b('0x45')][_0x4c1b('0x7f')]=_0x2c3502[_0x4c1b('0x65')]['Smtp'][_0x4c1b('0x7f')];}else{_0x38faa7['Imap'][_0x4c1b('0x81')]=_0x38faa7['Smtp'][_0x4c1b('0x81')]=_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x79')];_0x38faa7[_0x4c1b('0x43')][_0x4c1b('0x7b')]=_0x38faa7['Smtp']['user']=_0x2c3502[_0x4c1b('0x65')][_0x4c1b('0x7c')];_0x38faa7['Imap']['password']=_0x38faa7['Smtp']['pass']=_0x2c3502['body'][_0x4c1b('0x82')];}return db[_0x4c1b('0x49')]['create'](_0x38faa7,{'include':[{'model':db[_0x4c1b('0x44')],'as':'Smtp'},{'model':db[_0x4c1b('0x62')],'as':'Imap'}]})[_0x4c1b('0x23')](function(_0x8b9d3c){var _0x1ea6b3=_0x2c3502[_0x4c1b('0x7b')][_0x4c1b('0x3b')]({'plain':!![]});if(!_0x1ea6b3)throw new Error(_0x4c1b('0x83'));if(_0x1ea6b3['role']===_0x4c1b('0x7b')){var _0x7692e=_0x8b9d3c[_0x4c1b('0x3b')]({'plain':!![]});return db['UserProfileSection'][_0x4c1b('0x63')]({'where':{'name':_0x4c1b('0x3c'),'userProfileId':_0x1ea6b3[_0x4c1b('0x84')]},'raw':!![]})[_0x4c1b('0x23')](function(_0x59fba4){if(_0x59fba4&&_0x59fba4['autoAssociation']===0x0){return db[_0x4c1b('0x3d')][_0x4c1b('0x68')]({'name':_0x7692e[_0x4c1b('0x40')],'resourceId':_0x7692e['id'],'type':_0x59fba4['name'],'sectionId':_0x59fba4['id']},{})[_0x4c1b('0x23')](function(){return _0x8b9d3c;});}else{return _0x8b9d3c;}})['catch'](function(_0x55cf3a){logger[_0x4c1b('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55cf3a);throw _0x55cf3a;});}return _0x8b9d3c;})['then'](respondWithResult(_0x33418f,0xc9))[_0x4c1b('0x2d')](handleError(_0x33418f,null));};exports[_0x4c1b('0x85')]=function(_0x12fc61,_0x4e0aff,_0x20a9bd){return db[_0x4c1b('0x49')][_0x4c1b('0x6a')]({'where':{'id':_0x12fc61[_0x4c1b('0x61')]['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x4e0aff,null))['then'](function(_0xba9ba1){if(_0xba9ba1){return _0xba9ba1[_0x4c1b('0x85')]();}return null;})[_0x4c1b('0x23')](respondWithResult(_0x4e0aff,null))[_0x4c1b('0x2d')](handleError(_0x4e0aff,null));};exports['addImap']=function(_0x373adc,_0x158fa0,_0x5a3bca){if(_0x373adc[_0x4c1b('0x65')]['id']){delete _0x373adc[_0x4c1b('0x65')]['id'];}return db[_0x4c1b('0x49')][_0x4c1b('0x63')]({'where':{'id':_0x373adc[_0x4c1b('0x61')]['id']}})['then'](handleEntityNotFound(_0x158fa0,null))[_0x4c1b('0x23')](function(_0x2d1275){if(_0x2d1275){_0x373adc[_0x4c1b('0x65')][_0x4c1b('0x6d')]=_0x2d1275['id'];return db['MailServerIn'][_0x4c1b('0x68')](_0x373adc['body']);}})[_0x4c1b('0x23')](respondWithResult(_0x158fa0,null))[_0x4c1b('0x2d')](handleError(_0x158fa0,null));};exports[_0x4c1b('0x86')]=function(_0x1a6043,_0x36b799,_0x2f18d1){return db[_0x4c1b('0x49')][_0x4c1b('0x6a')]({'where':{'id':_0x1a6043['params']['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x36b799,null))[_0x4c1b('0x23')](function(_0x189e6d){if(_0x189e6d){return _0x189e6d[_0x4c1b('0x87')](null);}return null;})[_0x4c1b('0x23')](respondWithStatusCode(_0x36b799,null))[_0x4c1b('0x2d')](handleError(_0x36b799,null));};exports[_0x4c1b('0x88')]=function(_0x46c9c2,_0x323b39,_0x5741fe){return db[_0x4c1b('0x49')][_0x4c1b('0x6a')]({'where':{'id':_0x46c9c2[_0x4c1b('0x61')]['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x323b39,null))[_0x4c1b('0x23')](function(_0x47f887){if(_0x47f887){return _0x47f887[_0x4c1b('0x88')]();}return null;})[_0x4c1b('0x23')](respondWithResult(_0x323b39,null))[_0x4c1b('0x2d')](handleError(_0x323b39,null));};exports[_0x4c1b('0x89')]=function(_0x227c24,_0x3af0ef,_0x34988f){if(_0x227c24['body']['id']){delete _0x227c24[_0x4c1b('0x65')]['id'];}return db['MailAccount'][_0x4c1b('0x63')]({'where':{'id':_0x227c24[_0x4c1b('0x61')]['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x3af0ef,null))[_0x4c1b('0x23')](function(_0x4eb783){if(_0x4eb783){_0x227c24[_0x4c1b('0x65')]['MailAccountId']=_0x4eb783['id'];return db['MailServerOut'][_0x4c1b('0x68')](_0x227c24[_0x4c1b('0x65')]);}})[_0x4c1b('0x23')](respondWithResult(_0x3af0ef,null))[_0x4c1b('0x2d')](handleError(_0x3af0ef,null));};exports['removeSmtp']=function(_0x2f5e52,_0x17ef14,_0x371bc3){return db['MailAccount'][_0x4c1b('0x6a')]({'where':{'id':_0x2f5e52[_0x4c1b('0x61')]['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x17ef14,null))[_0x4c1b('0x23')](function(_0x4d60b9){if(_0x4d60b9){return _0x4d60b9[_0x4c1b('0x8a')](null);}return null;})['then'](respondWithStatusCode(_0x17ef14,null))[_0x4c1b('0x2d')](handleError(_0x17ef14,null));};exports[_0x4c1b('0x8b')]=function(_0x2fd9a9,_0x372ac3,_0x1be14a){return db[_0x4c1b('0x8c')][_0x4c1b('0x63')]({'where':{'id':_0x2fd9a9['params']['id']}})['then'](handleEntityNotFound(_0x372ac3,null))[_0x4c1b('0x23')](function(_0x1543cd){if(_0x1543cd){return _0x1543cd['addInteraction'](_0x2fd9a9[_0x4c1b('0x65')][_0x4c1b('0x6f')],_[_0x4c1b('0x8d')](_0x2fd9a9['body'],[_0x4c1b('0x6f'),'id'])||{});}})[_0x4c1b('0x23')](respondWithResult(_0x372ac3,null))[_0x4c1b('0x2d')](handleError(_0x372ac3,null));};exports[_0x4c1b('0x8e')]=function(_0xd18207,_0x4d52a7,_0x385b4e){var _0x54d326={'raw':![],'where':{}};var _0x53cd91={};var _0x565587={'count':0x0,'rows':[]};return db[_0x4c1b('0x49')][_0x4c1b('0x6a')]({'where':{'id':_0xd18207['params']['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x4d52a7,null))['then'](function(_0xcb87e0){if(_0xcb87e0){_0x53cd91['model']=_[_0x4c1b('0x4d')](db[_0x4c1b('0x8c')]['rawAttributes']);_0x53cd91[_0x4c1b('0x4c')]=_['keys'](_0xd18207[_0x4c1b('0x4c')]);_0x53cd91[_0x4c1b('0x58')]=_[_0x4c1b('0x50')](_0x53cd91[_0x4c1b('0x4e')],_0x53cd91[_0x4c1b('0x4c')]);_0x54d326[_0x4c1b('0x4f')]=_['intersection'](_0x53cd91[_0x4c1b('0x4e')],qs[_0x4c1b('0x51')](_0xd18207[_0x4c1b('0x4c')][_0x4c1b('0x51')]));_0x54d326['attributes']=_0x54d326['attributes'][_0x4c1b('0x52')]?_0x54d326[_0x4c1b('0x4f')]:_0x53cd91[_0x4c1b('0x4e')];if(!_0xd18207[_0x4c1b('0x4c')][_0x4c1b('0x53')](_0x4c1b('0x54'))){_0x54d326['limit']=qs[_0x4c1b('0x34')](_0xd18207[_0x4c1b('0x4c')]['limit']);_0x54d326[_0x4c1b('0x33')]=qs['offset'](_0xd18207[_0x4c1b('0x4c')][_0x4c1b('0x33')]);}_0x54d326[_0x4c1b('0x55')]=qs[_0x4c1b('0x56')](_0xd18207['query']['sort']);_0x54d326[_0x4c1b('0x57')]=qs[_0x4c1b('0x58')](_[_0x4c1b('0x72')](_0xd18207[_0x4c1b('0x4c')],_0x53cd91[_0x4c1b('0x58')]));_0x54d326[_0x4c1b('0x57')][_0x4c1b('0x6d')]=_0xcb87e0['id'];if(_0xd18207[_0x4c1b('0x4c')][_0x4c1b('0x59')]){_0x54d326['where']=_['merge'](_0x54d326['where'],{'$or':_[_0x4c1b('0x48')](_0x54d326['attributes'],function(_0x15c01f){var _0x57e3fb={};_0x57e3fb[_0x15c01f]={'$like':'%'+_0xd18207['query'][_0x4c1b('0x59')]+'%'};return _0x57e3fb;})});}_0x54d326=_[_0x4c1b('0x5a')]({},_0x54d326,_0xd18207[_0x4c1b('0x5c')]);return db['MailInteraction'][_0x4c1b('0x32')]({'where':_0x54d326['where']})[_0x4c1b('0x23')](function(_0x1a4610){_0x565587['count']=_0x1a4610;if(_0xd18207['query']['includeAll']){_0x54d326[_0x4c1b('0x5e')]=[{'model':db['CmContact'],'as':_0x4c1b('0x8f'),'required':![]},{'model':db[_0x4c1b('0x90')],'as':_0x4c1b('0x91'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0x4c1b('0x92')],'as':'Tags','attributes':['id',_0x4c1b('0x40'),'color'],'where':_0xd18207[_0x4c1b('0x4c')]['tag']?{'id':_0xd18207[_0x4c1b('0x4c')]['tag']}:undefined,'required':_0xd18207[_0x4c1b('0x4c')][_0x4c1b('0x93')]?!![]:![]}];}return db[_0x4c1b('0x8c')]['findAll'](_0x54d326);})[_0x4c1b('0x23')](function(_0x211d25){_0x565587[_0x4c1b('0x60')]=_0x211d25;return _0x565587;});}})['then'](respondWithFilteredResult(_0x4d52a7,_0x54d326))[_0x4c1b('0x2d')](handleError(_0x4d52a7,null));};exports[_0x4c1b('0x94')]=function(_0x1ce312,_0x46873d,_0x21f0ff){return db[_0x4c1b('0x49')]['findOne']({'where':{'id':_0x1ce312[_0x4c1b('0x61')]['id']}})['then'](handleEntityNotFound(_0x46873d,null))[_0x4c1b('0x23')](function(_0x2028aa){if(_0x2028aa){return db[_0x4c1b('0x95')][_0x4c1b('0x96')](function(_0x78f493){return db['MailApplication'][_0x4c1b('0x3a')]({'where':{'MailAccountId':_0x1ce312['params']['id']},'transaction':_0x78f493})[_0x4c1b('0x23')](function(_0x55d757){var _0x1365a0=_[_0x4c1b('0x48')](_0x1ce312[_0x4c1b('0x65')],function(_0x36002e){_0x36002e[_0x4c1b('0x6d')]=_0x1ce312['params']['id'];return _0x36002e;});return db[_0x4c1b('0x97')][_0x4c1b('0x98')](_0x1365a0,{'transaction':_0x78f493});});})[_0x4c1b('0x23')](function(){return db[_0x4c1b('0x97')][_0x4c1b('0x99')]({'where':{'MailAccountId':_0x1ce312['params']['id']},'order':_0x4c1b('0x9a')});});}})[_0x4c1b('0x23')](respondWithResult(_0x46873d,null))[_0x4c1b('0x2d')](handleError(_0x46873d,null));};exports[_0x4c1b('0x9b')]=function(_0x1f1482,_0x2f518c,_0x81fcde){var _0x49d34b={};var _0x288501={};var _0x209c37;var _0x4a9d7e;return db['MailAccount']['findOne']({'where':{'id':_0x1f1482[_0x4c1b('0x61')]['id']}})['then'](handleEntityNotFound(_0x2f518c,null))[_0x4c1b('0x23')](function(_0x251c48){if(_0x251c48){_0x209c37=_0x251c48;_0x288501['model']=_[_0x4c1b('0x4d')](db[_0x4c1b('0x97')]['rawAttributes']);_0x288501[_0x4c1b('0x4c')]=_[_0x4c1b('0x4d')](_0x1f1482['query']);_0x288501[_0x4c1b('0x58')]=_[_0x4c1b('0x50')](_0x288501['model'],_0x288501['query']);_0x49d34b[_0x4c1b('0x4f')]=_[_0x4c1b('0x50')](_0x288501[_0x4c1b('0x4e')],qs[_0x4c1b('0x51')](_0x1f1482[_0x4c1b('0x4c')]['fields']));_0x49d34b['attributes']=_0x49d34b['attributes'][_0x4c1b('0x52')]?_0x49d34b[_0x4c1b('0x4f')]:_0x288501[_0x4c1b('0x4e')];_0x49d34b[_0x4c1b('0x55')]=qs[_0x4c1b('0x56')](_0x1f1482[_0x4c1b('0x4c')][_0x4c1b('0x56')]);_0x49d34b[_0x4c1b('0x57')]=qs[_0x4c1b('0x58')](_['pick'](_0x1f1482[_0x4c1b('0x4c')],_0x288501[_0x4c1b('0x58')]));if(_0x1f1482['query'][_0x4c1b('0x59')]){_0x49d34b[_0x4c1b('0x57')]=_['merge'](_0x49d34b[_0x4c1b('0x57')],{'$or':_['map'](_0x49d34b['attributes'],function(_0x55a6ba){var _0x26f391={};_0x26f391[_0x55a6ba]={'$like':'%'+_0x1f1482['query']['filter']+'%'};return _0x26f391;})});}_0x49d34b=_['merge']({},_0x49d34b,_0x1f1482['options']);return _0x209c37[_0x4c1b('0x9b')](_0x49d34b);}})[_0x4c1b('0x23')](function(_0xa63924){if(_0xa63924){_0x4a9d7e=_0xa63924[_0x4c1b('0x52')];if(!_0x1f1482['query'][_0x4c1b('0x53')](_0x4c1b('0x54'))){_0x49d34b['limit']=qs[_0x4c1b('0x34')](_0x1f1482[_0x4c1b('0x4c')][_0x4c1b('0x34')]);_0x49d34b['offset']=qs['offset'](_0x1f1482['query'][_0x4c1b('0x33')]);}return _0x209c37[_0x4c1b('0x9b')](_0x49d34b);}})[_0x4c1b('0x23')](function(_0x3cc525){if(_0x3cc525){return _0x3cc525?{'count':_0x4a9d7e,'rows':_0x3cc525}:null;}})[_0x4c1b('0x23')](respondWithResult(_0x2f518c,null))[_0x4c1b('0x2d')](handleError(_0x2f518c,null));};exports[_0x4c1b('0x9c')]=function(_0x26dd08,_0xe841ec,_0x4cac24){var _0x5e9c56={'raw':!![],'where':{}};var _0x180a1e={};var _0x3a107a={'count':0x0,'rows':[]};return db['MailAccount'][_0x4c1b('0x6a')]({'where':{'id':_0x26dd08[_0x4c1b('0x61')]['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0xe841ec,null))['then'](function(_0x346b6e){if(_0x346b6e){_0x180a1e[_0x4c1b('0x4e')]=_['keys'](db[_0x4c1b('0x9d')][_0x4c1b('0x6c')]);_0x180a1e[_0x4c1b('0x4c')]=_['keys'](_0x26dd08['query']);_0x180a1e[_0x4c1b('0x58')]=_[_0x4c1b('0x50')](_0x180a1e['model'],_0x180a1e['query']);_0x5e9c56['attributes']=_[_0x4c1b('0x50')](_0x180a1e[_0x4c1b('0x4e')],qs[_0x4c1b('0x51')](_0x26dd08[_0x4c1b('0x4c')][_0x4c1b('0x51')]));_0x5e9c56['attributes']=_0x5e9c56[_0x4c1b('0x4f')]['length']?_0x5e9c56[_0x4c1b('0x4f')]:_0x180a1e[_0x4c1b('0x4e')];if(!_0x26dd08[_0x4c1b('0x4c')][_0x4c1b('0x53')](_0x4c1b('0x54'))){_0x5e9c56['limit']=qs[_0x4c1b('0x34')](_0x26dd08['query'][_0x4c1b('0x34')]);_0x5e9c56[_0x4c1b('0x33')]=qs[_0x4c1b('0x33')](_0x26dd08[_0x4c1b('0x4c')][_0x4c1b('0x33')]);}_0x5e9c56[_0x4c1b('0x55')]=qs[_0x4c1b('0x56')](_0x26dd08['query'][_0x4c1b('0x56')]);_0x5e9c56['where']=qs[_0x4c1b('0x58')](_['pick'](_0x26dd08[_0x4c1b('0x4c')],_0x180a1e[_0x4c1b('0x58')]));_0x5e9c56[_0x4c1b('0x57')][_0x4c1b('0x6d')]=_0x346b6e['id'];if(_0x26dd08['query']['filter']){_0x5e9c56[_0x4c1b('0x57')]=_[_0x4c1b('0x5a')](_0x5e9c56[_0x4c1b('0x57')],{'$or':_['map'](_0x5e9c56[_0x4c1b('0x4f')],function(_0x4f3b86){var _0x38f368={};_0x38f368[_0x4f3b86]={'$like':'%'+_0x26dd08[_0x4c1b('0x4c')]['filter']+'%'};return _0x38f368;})});}if(_0x26dd08[_0x4c1b('0x4c')][_0x4c1b('0x9e')]){var _0x1ab512=_0x26dd08[_0x4c1b('0x4c')][_0x4c1b('0x9e')][_0x4c1b('0x9f')](',');var _0x24fe1d={};_0x24fe1d[_0x1ab512[0x0]]={'$gte':moment(_0x1ab512[0x1])[_0x4c1b('0xa0')](_0x4c1b('0xa1'))};_0x5e9c56[_0x4c1b('0x57')]=_['merge'](_0x5e9c56[_0x4c1b('0x57')],_0x24fe1d);}_0x5e9c56=_[_0x4c1b('0x5a')]({},_0x5e9c56,_0x26dd08[_0x4c1b('0x5c')]);return db[_0x4c1b('0x9d')]['count']({'where':_0x5e9c56[_0x4c1b('0x57')]})[_0x4c1b('0x23')](function(_0x1651ed){_0x3a107a['count']=_0x1651ed;if(_0x26dd08['query'][_0x4c1b('0x5d')]){_0x5e9c56[_0x4c1b('0x5e')]=[{'all':!![]}];}return db[_0x4c1b('0x9d')][_0x4c1b('0x5f')](_0x5e9c56);})[_0x4c1b('0x23')](function(_0x4f3d37){if(_0x26dd08['query'][_0x4c1b('0xa2')]===_0x4c1b('0xa3')){for(var _0x26bf55=0x0;_0x26bf55<_0x4f3d37['length'];_0x26bf55++){_0x4f3d37[_0x26bf55][_0x4c1b('0x65')]=juice(_0x4f3d37[_0x26bf55][_0x4c1b('0x65')]);}}_0x3a107a[_0x4c1b('0x60')]=_0x4f3d37;return _0x3a107a;});}})['then'](respondWithFilteredResult(_0xe841ec,_0x5e9c56))[_0x4c1b('0x2d')](handleError(_0xe841ec,null));};exports[_0x4c1b('0x41')]=function(_0x57d048,_0xc22a0a,_0x59e057){var _0x35f675,_0x1abb6d={},_0x31c8d0;if(_0x57d048[_0x4c1b('0x65')]['to']){_0x31c8d0=_0x57d048[_0x4c1b('0x65')]['to'][_0x4c1b('0x9f')](',')[0x0];}return db[_0x4c1b('0x49')]['find']({'where':{'id':_0x57d048[_0x4c1b('0x61')]['id']},'include':[{'model':db[_0x4c1b('0xa4')],'as':'List','include':[{'model':db['CmContact'],'as':_0x4c1b('0xa5'),'where':{'email':_0x31c8d0},'limit':0x1,'order':[[_0x4c1b('0xa6'),'DESC']]}]},{'model':db[_0x4c1b('0x44')],'as':_0x4c1b('0x45'),'raw':!![]}]})[_0x4c1b('0x23')](handleEntityNotFound(_0xc22a0a,null))[_0x4c1b('0x23')](function(_0x5eb46e){if(_0x5eb46e){_0x35f675=_0x5eb46e;if(_0x5eb46e[_0x4c1b('0x45')]){if(_[_0x4c1b('0x78')](_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xa7')])){_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xa7')]=util[_0x4c1b('0xa0')](_0x4c1b('0xa8'),_0x5eb46e[_0x4c1b('0x40')],_0x5eb46e[_0x4c1b('0x75')]||_0x5eb46e[_0x4c1b('0x45')][_0x4c1b('0x7b')]);}if(_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xa9')]&&_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xa9')][_0x4c1b('0x52')]){for(var _0x2894b1=0x0;_0x2894b1<_0x57d048['body'][_0x4c1b('0xa9')][_0x4c1b('0x52')];_0x2894b1+=0x1){_0x57d048['body'][_0x4c1b('0xa9')][_0x2894b1]={'filename':_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xa9')][_0x2894b1]['name'],'path':path[_0x4c1b('0xaa')](config[_0x4c1b('0xab')],_0x4c1b('0xac'),_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xa9')][_0x2894b1]['basename'])};}}var _0xe0732={'tls':{'rejectUnauthorized':![]}};if(_[_0x4c1b('0x78')](_0x5eb46e[_0x4c1b('0x45')][_0x4c1b('0x81')])){if(_0x5eb46e[_0x4c1b('0x45')]['authentication']){_0xe0732[_0x4c1b('0xad')]={'user':_0x5eb46e['Smtp'][_0x4c1b('0x7b')],'pass':_0x5eb46e[_0x4c1b('0x45')][_0x4c1b('0xae')]};}_0xe0732[_0x4c1b('0x80')]=_0x5eb46e[_0x4c1b('0x45')]['host'];_0xe0732[_0x4c1b('0x7f')]=_0x5eb46e['Smtp'][_0x4c1b('0x7f')];_0xe0732['secure']=_0x5eb46e['Smtp'][_0x4c1b('0xaf')];}else{_0xe0732[_0x4c1b('0x81')]=_0x5eb46e[_0x4c1b('0x45')][_0x4c1b('0x81')];_0xe0732[_0x4c1b('0xad')]={'user':_0x5eb46e[_0x4c1b('0x45')][_0x4c1b('0x7b')],'pass':_0x5eb46e[_0x4c1b('0x45')][_0x4c1b('0xae')]};}return respondWithRpcPromise(_0x4c1b('0xb0'),_0x4c1b('0xb1'),{'account':_0xe0732,'message':_0x57d048['body']});}else{throw new Error(_0x4c1b('0xb2'));}}})[_0x4c1b('0x23')](function(_0x90bbd9){if(_0x90bbd9){_0x1abb6d=_0x90bbd9;if(_0x35f675[_0x4c1b('0xb3')]){if(_0x35f675['List'][_0x4c1b('0xa5')]['length']){return _0x35f675['List'][_0x4c1b('0xa5')][0x0];}else{return db[_0x4c1b('0xb4')]['create'](_['defaults'](_0x57d048[_0x4c1b('0x65')],{'firstName':_0x57d048['body']['to'],'email':_0x57d048[_0x4c1b('0x65')]['to'],'phone':_0x57d048[_0x4c1b('0x65')]['to'],'ListId':_0x35f675[_0x4c1b('0x76')]}));}}else{throw new Error(_0x4c1b('0xb2'));}}})[_0x4c1b('0x23')](function(_0x4b4853){if(_0x4b4853){var _0x137302={'UserId':_0x57d048['user']['id'],'ContactId':_0x4b4853['id'],'MailAccountId':_0x35f675['id'],'inReplyTo':_0x1abb6d[_0x4c1b('0xb5')],'to':_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xa7')],'cc':_0x57d048[_0x4c1b('0x65')]['cc'],'subject':_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xb6')],'attach':_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xb7')],'firstMsgDirection':_0x4c1b('0xb8'),'lastMsgAt':moment()[_0x4c1b('0xa0')](_0x4c1b('0xa1')),'lastMsgDirection':_0x4c1b('0xb8'),'Messages':[_[_0x4c1b('0x5a')](_0x57d048['body'],{'messageId':_0x1abb6d[_0x4c1b('0xb5')],'sentAt':moment()['format'](_0x4c1b('0xa1')),'read':!![],'MailAccountId':_0x35f675['id'],'UserId':_0x57d048[_0x4c1b('0x7b')]['id'],'ContactId':_0x4b4853['id']})]};if(_0x57d048[_0x4c1b('0x65')][_0x4c1b('0xb9')]){_0x137302=_[_0x4c1b('0x5a')](_0x137302,_0x57d048['body'][_0x4c1b('0xb9')]);}return db[_0x4c1b('0x8c')][_0x4c1b('0x68')](_0x137302,{'include':[{'model':db['MailMessage'],'as':_0x4c1b('0xba')}]});}})[_0x4c1b('0x23')](respondWithResult(_0xc22a0a,null))['catch'](handleError(_0xc22a0a,null));};exports[_0x4c1b('0xbb')]=function(_0xe9adeb,_0x28d420,_0x4e598a){return db['MailAccount']['find']({'where':{'id':_0xe9adeb[_0x4c1b('0x61')]['id']},'include':[{'model':db[_0x4c1b('0x44')],'as':'Smtp','raw':!![]}]})[_0x4c1b('0x23')](handleEntityNotFound(_0x28d420,null))[_0x4c1b('0x23')](function(_0x3fc015){if(_0x3fc015&&_0x3fc015[_0x4c1b('0x45')]){var _0x376fb0={'id':_0x3fc015['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3fc015[_0x4c1b('0x45')][_0x4c1b('0x81')]){_0x376fb0['service']=_0x3fc015[_0x4c1b('0x45')][_0x4c1b('0x81')];}else{_0x376fb0[_0x4c1b('0x80')]=_0x3fc015['Smtp'][_0x4c1b('0x80')];_0x376fb0['port']=_0x3fc015[_0x4c1b('0x45')][_0x4c1b('0x7f')];_0x376fb0[_0x4c1b('0xaf')]=_0x3fc015[_0x4c1b('0x45')]['secure'];}if(_0x3fc015['Smtp']['authentication']){_0x376fb0[_0x4c1b('0xad')]={'user':_0x3fc015[_0x4c1b('0x45')][_0x4c1b('0x7b')],'pass':_0x3fc015[_0x4c1b('0x45')]['pass']};}return respondWithRpcPromise('VerifySmtp',_0x4c1b('0xbb'),{'account':_0x376fb0});}})[_0x4c1b('0x23')](respondWithResult(_0x28d420,null))[_0x4c1b('0x2d')](handleError(_0x28d420,null));};exports[_0x4c1b('0x3a')]=function(_0x2a9c25,_0xa9197){return db['MailAccount'][_0x4c1b('0x63')]({'where':{'id':_0x2a9c25[_0x4c1b('0x61')]['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0xa9197,null))[_0x4c1b('0x23')](function(_0x4a5d4f){if(_0x4a5d4f&&_0x4a5d4f[_0x4c1b('0x81')]){throw new db[(_0x4c1b('0xbc'))][(_0x4c1b('0xbd'))](_0x4c1b('0xbe'));}return _0x4a5d4f;})[_0x4c1b('0x23')](removeEntity(_0xa9197,null))[_0x4c1b('0x2d')](handleError(_0xa9197,null));};exports[_0x4c1b('0xbf')]=function(_0x259928,_0x43813d,_0x103e7d){return db[_0x4c1b('0x49')][_0x4c1b('0x63')]({'where':{'id':_0x259928[_0x4c1b('0x61')]['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x43813d,null))['then'](function(_0x1d4fb1){if(_0x1d4fb1){return _0x1d4fb1[_0x4c1b('0xbf')](_0x259928[_0x4c1b('0x65')][_0x4c1b('0x6f')],_[_0x4c1b('0x8d')](_0x259928[_0x4c1b('0x65')],[_0x4c1b('0x6f'),'id'])||{})['spread'](function(_0x572372){for(var _0x3ac570=0x0;_0x3ac570<_0x259928[_0x4c1b('0x65')][_0x4c1b('0x6f')][_0x4c1b('0x52')];_0x3ac570+=0x1){socket[_0x4c1b('0xc0')]('userMailAccount:save',{'UserId':Number(_0x259928['body'][_0x4c1b('0x6f')][_0x3ac570]),'MailAccountId':Number(_0x259928[_0x4c1b('0x61')]['id'])});}return _0x572372;});}})[_0x4c1b('0x23')](respondWithResult(_0x43813d,null))[_0x4c1b('0x2d')](handleError(_0x43813d,null));};exports[_0x4c1b('0xc1')]=function(_0x94e19c,_0x2b2c99,_0x20e260){return db[_0x4c1b('0x49')][_0x4c1b('0x63')]({'where':{'id':_0x94e19c['params']['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0x2b2c99,null))[_0x4c1b('0x23')](function(_0x2710a7){if(_0x2710a7){return _0x2710a7[_0x4c1b('0xc1')](_0x94e19c[_0x4c1b('0x4c')][_0x4c1b('0x6f')])[_0x4c1b('0x23')](function(){if(_[_0x4c1b('0xc2')](_0x94e19c[_0x4c1b('0x4c')][_0x4c1b('0x6f')])){for(var _0x114fa2=0x0;_0x114fa2<_0x94e19c[_0x4c1b('0x4c')]['ids'][_0x4c1b('0x52')];_0x114fa2+=0x1){socket[_0x4c1b('0xc0')](_0x4c1b('0xc3'),{'UserId':Number(_0x94e19c[_0x4c1b('0x4c')][_0x4c1b('0x6f')][_0x114fa2]),'MailAccountId':Number(_0x94e19c[_0x4c1b('0x61')]['id'])});}}else{socket[_0x4c1b('0xc0')](_0x4c1b('0xc3'),{'UserId':Number(_0x94e19c[_0x4c1b('0x4c')]['ids']),'MailAccountId':Number(_0x94e19c[_0x4c1b('0x61')]['id'])});}});}})[_0x4c1b('0x23')](respondWithStatusCode(_0x2b2c99,null))[_0x4c1b('0x2d')](handleError(_0x2b2c99,null));};exports[_0x4c1b('0xc4')]=function(_0x35ba8c,_0xccf973,_0x21ec00){var _0x473a27={};var _0x546a87={};var _0x244eb7;var _0x379c46;return db[_0x4c1b('0x49')][_0x4c1b('0x6a')]({'where':{'id':_0x35ba8c['params']['id']}})[_0x4c1b('0x23')](handleEntityNotFound(_0xccf973,null))['then'](function(_0x557d8d){if(_0x557d8d){_0x244eb7=_0x557d8d;_0x546a87['model']=_['keys'](db[_0x4c1b('0x90')][_0x4c1b('0x6c')]);_0x546a87[_0x4c1b('0x4c')]=_[_0x4c1b('0x4d')](_0x35ba8c[_0x4c1b('0x4c')]);_0x546a87['filters']=_[_0x4c1b('0x50')](_0x546a87['model'],_0x546a87[_0x4c1b('0x4c')]);_0x473a27[_0x4c1b('0x4f')]=_[_0x4c1b('0x50')](_0x546a87[_0x4c1b('0x4e')],qs['fields'](_0x35ba8c[_0x4c1b('0x4c')][_0x4c1b('0x51')]));_0x473a27[_0x4c1b('0x4f')]=_0x473a27['attributes'][_0x4c1b('0x52')]?_0x473a27[_0x4c1b('0x4f')]:_0x546a87['model'];_0x473a27['order']=qs['sort'](_0x35ba8c[_0x4c1b('0x4c')]['sort']);_0x473a27['where']=qs[_0x4c1b('0x58')](_[_0x4c1b('0x72')](_0x35ba8c['query'],_0x546a87[_0x4c1b('0x58')]));if(_0x35ba8c[_0x4c1b('0x4c')]['filter']){_0x473a27['where']=_[_0x4c1b('0x5a')](_0x473a27[_0x4c1b('0x57')],{'$or':_['map'](_0x473a27[_0x4c1b('0x4f')],function(_0x1868cc){var _0x288f55={};_0x288f55[_0x1868cc]={'$like':'%'+_0x35ba8c[_0x4c1b('0x4c')][_0x4c1b('0x59')]+'%'};return _0x288f55;})});}_0x473a27=_['merge']({},_0x473a27,_0x35ba8c['options']);return _0x244eb7[_0x4c1b('0xc4')](_0x473a27);}})[_0x4c1b('0x23')](function(_0x3c7ff9){if(_0x3c7ff9){_0x379c46=_0x3c7ff9['length'];if(!_0x35ba8c['query'][_0x4c1b('0x53')]('nolimit')){_0x473a27[_0x4c1b('0x34')]=qs['limit'](_0x35ba8c[_0x4c1b('0x4c')][_0x4c1b('0x34')]);_0x473a27['offset']=qs[_0x4c1b('0x33')](_0x35ba8c[_0x4c1b('0x4c')][_0x4c1b('0x33')]);}return _0x244eb7[_0x4c1b('0xc4')](_0x473a27);}})[_0x4c1b('0x23')](function(_0x137a78){if(_0x137a78){return _0x137a78?{'count':_0x379c46,'rows':_0x137a78}:null;}})['then'](respondWithResult(_0xccf973,null))[_0x4c1b('0x2d')](handleError(_0xccf973,null));}; \ No newline at end of file +var _0xda65=['update','get','MailAccounts','UserProfileResource','destroy','stack','name','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','keys','includeAll','find','body','params','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','create','email','ListId','isNil','active','cservice','cauthentication','user','password','cpassword','authentication','host','port','service','cuser','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','color','tag','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','Contacts','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','sendMail','List\x20not\x20found','subject','attach','out','messageId','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','removeAgents','isArray','userMailAccount:remove','emit','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','html-to-text','juice','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save'];(function(_0x5aaa60,_0xd31e1e){var _0x36e34b=function(_0x4d7cb9){while(--_0x4d7cb9){_0x5aaa60['push'](_0x5aaa60['shift']());}};_0x36e34b(++_0xd31e1e);}(_0xda65,0x91));var _0x5da6=function(_0x4e5ddd,_0x3e8e84){_0x4e5ddd=_0x4e5ddd-0x0;var _0x152a16=_0xda65[_0x4e5ddd];return _0x152a16;};'use strict';var emlformat=require(_0x5da6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5da6('0x1'));var jsonpatch=require(_0x5da6('0x2'));var rp=require(_0x5da6('0x3'));var moment=require(_0x5da6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5da6('0x5'));var util=require(_0x5da6('0x6'));var path=require(_0x5da6('0x7'));var sox=require(_0x5da6('0x8'));var csv=require(_0x5da6('0x9'));var ejs=require(_0x5da6('0xa'));var fs=require('fs');var fs_extra=require(_0x5da6('0xb'));var _=require('lodash');var squel=require(_0x5da6('0xc'));var crypto=require(_0x5da6('0xd'));var jsforce=require(_0x5da6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5da6('0x9'));var querystring=require('querystring');var Papa=require(_0x5da6('0xf'));var htmlToText=require(_0x5da6('0x10'));var juice=require(_0x5da6('0x11'));var Redis=require('ioredis');var authService=require(_0x5da6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5da6('0x13'));var hardwareService=require(_0x5da6('0x14'));var logger=require(_0x5da6('0x15'))(_0x5da6('0x16'));var utils=require('../../config/utils');var config=require(_0x5da6('0x17'));var licenseUtil=require(_0x5da6('0x18'));var db=require(_0x5da6('0x19'))['db'];config[_0x5da6('0x1a')]=_[_0x5da6('0x1b')](config[_0x5da6('0x1a')],{'host':_0x5da6('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailAccount.socket')[_0x5da6('0x1d')](socket);var jayson=require(_0x5da6('0x1e'));var client=jayson[_0x5da6('0x1f')][_0x5da6('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x164d93,_0x22a995,_0x3b547a,_0xb7942e){return new BPromise(function(_0x518bf4,_0x50e4cf){var _0x3608de=_0xb7942e||client;return _0x3608de[_0x5da6('0x21')](_0x164d93,_0x3b547a)[_0x5da6('0x22')](function(_0x4f9a97){logger['info'](_0x5da6('0x23'),_0x22a995,_0x5da6('0x24'));logger[_0x5da6('0x25')](_0x5da6('0x26'),_0x22a995,_0x5da6('0x24'),JSON[_0x5da6('0x27')](_0x4f9a97));if(_0x4f9a97[_0x5da6('0x28')]){if(_0x4f9a97['error'][_0x5da6('0x29')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x22a995,_0x4f9a97[_0x5da6('0x28')]['message']);return _0x50e4cf(_0x4f9a97[_0x5da6('0x28')][_0x5da6('0x2a')]);}logger[_0x5da6('0x28')]('MailAccount,\x20%s,\x20%s',_0x22a995,_0x4f9a97[_0x5da6('0x28')]['message']);return _0x518bf4(_0x4f9a97[_0x5da6('0x28')][_0x5da6('0x2a')]);}else{logger['info'](_0x5da6('0x23'),_0x22a995,_0x5da6('0x24'));_0x518bf4(_0x4f9a97['result']['message']);}})['catch'](function(_0x1f0840){logger[_0x5da6('0x28')](_0x5da6('0x23'),_0x22a995,_0x1f0840);_0x50e4cf(_0x1f0840);});});}function respondWithStatusCode(_0x2b0e8f,_0x2051cf){_0x2051cf=_0x2051cf||0xcc;return function(_0x56976d){if(_0x56976d){return _0x2b0e8f[_0x5da6('0x2b')](_0x2051cf);}return _0x2b0e8f[_0x5da6('0x2c')](_0x2051cf)[_0x5da6('0x2d')]();};}function respondWithResult(_0x3a061e,_0x477114){_0x477114=_0x477114||0xc8;return function(_0x563537){if(_0x563537){return _0x3a061e['status'](_0x477114)[_0x5da6('0x2e')](_0x563537);}};}function respondWithFilteredResult(_0x2dba46,_0x1abb6b){return function(_0x50bd45){if(_0x50bd45){var _0x62a3a7=typeof _0x1abb6b[_0x5da6('0x2f')]==='undefined'&&typeof _0x1abb6b['limit']===_0x5da6('0x30');var _0x504a12=_0x50bd45[_0x5da6('0x31')];var _0x3e78bb=_0x62a3a7?0x0:_0x1abb6b[_0x5da6('0x2f')];var _0x23e017=_0x62a3a7?_0x50bd45[_0x5da6('0x31')]:_0x1abb6b[_0x5da6('0x2f')]+_0x1abb6b[_0x5da6('0x32')];var _0x17fd38;if(_0x23e017>=_0x504a12){_0x23e017=_0x504a12;_0x17fd38=0xc8;}else{_0x17fd38=0xce;}_0x2dba46[_0x5da6('0x2c')](_0x17fd38);return _0x2dba46[_0x5da6('0x33')](_0x5da6('0x34'),_0x3e78bb+'-'+_0x23e017+'/'+_0x504a12)['json'](_0x50bd45);}return null;};}function patchUpdates(_0x525024){return function(_0xb0ee90){try{jsonpatch[_0x5da6('0x35')](_0xb0ee90,_0x525024,!![]);}catch(_0x3a1136){return BPromise['reject'](_0x3a1136);}return _0xb0ee90[_0x5da6('0x36')]();};}function saveUpdates(_0x5b09c4,_0x7969ea){return function(_0xa87e91){if(_0xa87e91){return _0xa87e91[_0x5da6('0x37')](_0x5b09c4)[_0x5da6('0x22')](function(_0x461aa9){return _0x461aa9;});}return null;};}function removeEntity(_0x23eabe,_0x3e0060){return function(_0x359b46){if(_0x359b46){return _0x359b46['destroy']()[_0x5da6('0x22')](function(){var _0x40913c=_0x359b46[_0x5da6('0x38')]({'plain':!![]});var _0x3e9e9a=_0x5da6('0x39');return db[_0x5da6('0x3a')][_0x5da6('0x3b')]({'where':{'type':_0x3e9e9a,'resourceId':_0x40913c['id']}})[_0x5da6('0x22')](function(){return _0x359b46;});})[_0x5da6('0x22')](function(){_0x23eabe['status'](0xcc)[_0x5da6('0x2d')]();});}};}function handleEntityNotFound(_0x567394,_0x367f73){return function(_0xb15521){if(!_0xb15521){_0x567394[_0x5da6('0x2b')](0x194);}return _0xb15521;};}function handleError(_0x35df50,_0x4947f2){_0x4947f2=_0x4947f2||0x1f4;return function(_0x44c00f){logger[_0x5da6('0x28')](_0x44c00f[_0x5da6('0x3c')]);if(_0x44c00f[_0x5da6('0x3d')]){delete _0x44c00f[_0x5da6('0x3d')];}_0x35df50[_0x5da6('0x2c')](_0x4947f2)['send'](_0x44c00f);};}exports[_0x5da6('0x3e')]=function(_0x49441d,_0xb00035){var _0x4d7906={'include':[{'model':db[_0x5da6('0x3f')],'as':_0x5da6('0x40')},{'model':db[_0x5da6('0x41')],'as':_0x5da6('0x42')},{'model':db[_0x5da6('0x43')],'as':_0x5da6('0x44')}]},_0x246153={},_0x1341f3={'count':0x0,'rows':[]};var _0x298c5c=_[_0x5da6('0x45')](db[_0x5da6('0x46')][_0x5da6('0x47')],function(_0x516af4){return{'name':_0x516af4[_0x5da6('0x48')],'type':_0x516af4[_0x5da6('0x49')]['key']};});_0x246153[_0x5da6('0x4a')]=_[_0x5da6('0x45')](_0x298c5c,_0x5da6('0x3d'));_0x246153[_0x5da6('0x4b')]=_['keys'](_0x49441d[_0x5da6('0x4b')]);_0x246153[_0x5da6('0x4c')]=_['intersection'](_0x246153[_0x5da6('0x4a')],_0x246153[_0x5da6('0x4b')]);_0x4d7906[_0x5da6('0x4d')]=_[_0x5da6('0x4e')](_0x246153[_0x5da6('0x4a')],qs[_0x5da6('0x4f')](_0x49441d[_0x5da6('0x4b')]['fields']));_0x4d7906[_0x5da6('0x4d')]=_0x4d7906[_0x5da6('0x4d')][_0x5da6('0x50')]?_0x4d7906['attributes']:_0x246153['model'];if(!_0x49441d[_0x5da6('0x4b')][_0x5da6('0x51')](_0x5da6('0x52'))){_0x4d7906[_0x5da6('0x32')]=qs[_0x5da6('0x32')](_0x49441d['query'][_0x5da6('0x32')]);_0x4d7906[_0x5da6('0x2f')]=qs['offset'](_0x49441d[_0x5da6('0x4b')][_0x5da6('0x2f')]);}_0x4d7906[_0x5da6('0x53')]=qs[_0x5da6('0x54')](_0x49441d['query'][_0x5da6('0x54')]);_0x4d7906[_0x5da6('0x55')]=qs[_0x5da6('0x4c')](_[_0x5da6('0x56')](_0x49441d['query'],_0x246153[_0x5da6('0x4c')]),_0x298c5c);if(_0x49441d[_0x5da6('0x4b')][_0x5da6('0x57')]){_0x4d7906[_0x5da6('0x55')]=_['merge'](_0x4d7906[_0x5da6('0x55')],{'$or':_[_0x5da6('0x45')](_0x298c5c,function(_0x55eafd){if(_0x55eafd[_0x5da6('0x49')]!==_0x5da6('0x58')){var _0x2b545b={};_0x2b545b[_0x55eafd[_0x5da6('0x3d')]]={'$like':'%'+_0x49441d[_0x5da6('0x4b')][_0x5da6('0x57')]+'%'};return _0x2b545b;}})});}_0x4d7906=_[_0x5da6('0x59')]({},_0x4d7906,_0x49441d[_0x5da6('0x5a')]);var _0x5410d3={'where':_0x4d7906['where']};return db[_0x5da6('0x46')]['count'](_0x5410d3)[_0x5da6('0x22')](function(_0x25d0a5){_0x1341f3[_0x5da6('0x31')]=_0x25d0a5;if(_0x49441d['query']['includeAll']){_0x4d7906[_0x5da6('0x5b')]=[{'all':!![]}];}return db[_0x5da6('0x46')]['findAll'](_0x4d7906);})[_0x5da6('0x22')](function(_0x5baf91){_0x1341f3[_0x5da6('0x5c')]=_0x5baf91;return _0x1341f3;})['then'](respondWithFilteredResult(_0xb00035,_0x4d7906))[_0x5da6('0x5d')](handleError(_0xb00035,null));};exports[_0x5da6('0x5e')]=function(_0x1e09e3,_0x2e228e){var _0x3608b0={'raw':![],'where':{'id':_0x1e09e3['params']['id']},'include':[{'model':db[_0x5da6('0x3f')],'as':_0x5da6('0x40')},{'model':db[_0x5da6('0x41')],'as':_0x5da6('0x42')},{'model':db[_0x5da6('0x43')],'as':_0x5da6('0x44')}]},_0x4a93d1={};_0x4a93d1[_0x5da6('0x4a')]=_[_0x5da6('0x5f')](db['MailAccount'][_0x5da6('0x47')]);_0x4a93d1[_0x5da6('0x4b')]=_['keys'](_0x1e09e3[_0x5da6('0x4b')]);_0x4a93d1[_0x5da6('0x4c')]=_[_0x5da6('0x4e')](_0x4a93d1[_0x5da6('0x4a')],_0x4a93d1[_0x5da6('0x4b')]);_0x3608b0['attributes']=_['intersection'](_0x4a93d1[_0x5da6('0x4a')],qs[_0x5da6('0x4f')](_0x1e09e3[_0x5da6('0x4b')][_0x5da6('0x4f')]));_0x3608b0[_0x5da6('0x4d')]=_0x3608b0['attributes']['length']?_0x3608b0[_0x5da6('0x4d')]:_0x4a93d1[_0x5da6('0x4a')];if(_0x1e09e3[_0x5da6('0x4b')][_0x5da6('0x60')]){_0x3608b0['include']=[{'all':!![]}];}_0x3608b0=_[_0x5da6('0x59')]({},_0x3608b0,_0x1e09e3[_0x5da6('0x5a')]);return db[_0x5da6('0x46')][_0x5da6('0x61')](_0x3608b0)[_0x5da6('0x22')](handleEntityNotFound(_0x2e228e,null))[_0x5da6('0x22')](respondWithResult(_0x2e228e,null))['catch'](handleError(_0x2e228e,null));};exports[_0x5da6('0x37')]=function(_0x48b8ac,_0x7947d2){if(_0x48b8ac[_0x5da6('0x62')]['id']){delete _0x48b8ac[_0x5da6('0x62')]['id'];}return db[_0x5da6('0x46')][_0x5da6('0x61')]({'where':{'id':_0x48b8ac[_0x5da6('0x63')]['id']},'include':[{'model':db[_0x5da6('0x3f')],'as':_0x5da6('0x40')},{'model':db[_0x5da6('0x41')],'as':'Smtp'},{'model':db[_0x5da6('0x43')],'as':_0x5da6('0x44')}]})[_0x5da6('0x22')](handleEntityNotFound(_0x7947d2,null))['then'](saveUpdates(_0x48b8ac[_0x5da6('0x62')],null))['then'](function(_0x33d888){if(_0x33d888&&_0x48b8ac[_0x5da6('0x62')][_0x5da6('0x40')]){return db[_0x5da6('0x3f')][_0x5da6('0x37')](_0x48b8ac[_0x5da6('0x62')][_0x5da6('0x40')],{'where':{'MailAccountId':_0x33d888['id']}})[_0x5da6('0x22')](function(){return _0x33d888;});}return _0x33d888;})[_0x5da6('0x22')](function(_0xc89715){if(_0xc89715&&_0x48b8ac[_0x5da6('0x62')][_0x5da6('0x42')]){return db['MailServerOut'][_0x5da6('0x37')](_0x48b8ac[_0x5da6('0x62')][_0x5da6('0x42')],{'where':{'MailAccountId':_0xc89715['id']}})[_0x5da6('0x22')](function(){return _0xc89715;});}return _0xc89715;})[_0x5da6('0x22')](respondWithResult(_0x7947d2,null))['catch'](handleError(_0x7947d2,null));};exports[_0x5da6('0x64')]=function(_0x2c9bc4,_0x1c6d4f){return db[_0x5da6('0x46')][_0x5da6('0x64')]()[_0x5da6('0x22')](respondWithResult(_0x1c6d4f,null))[_0x5da6('0x5d')](handleError(_0x1c6d4f,null));};exports[_0x5da6('0x65')]=function(_0x5bdace,_0x32846c,_0x912060){if(_0x5bdace[_0x5da6('0x62')]['id']){delete _0x5bdace[_0x5da6('0x62')]['id'];}return db[_0x5da6('0x46')][_0x5da6('0x61')]({'where':{'id':_0x5bdace[_0x5da6('0x63')]['id']}})[_0x5da6('0x22')](handleEntityNotFound(_0x32846c,null))[_0x5da6('0x22')](function(_0x11c20b){if(_0x11c20b){_0x5bdace['body'][_0x5da6('0x66')]=_0x11c20b['id'];return db[_0x5da6('0x67')]['create'](_0x5bdace['body']);}})['then'](respondWithResult(_0x32846c,null))[_0x5da6('0x5d')](handleError(_0x32846c,null));};exports[_0x5da6('0x68')]=function(_0x46c8cd,_0x3d2383,_0x7c9d98){var _0x3a828f={'raw':![],'where':{}};var _0x371159={};var _0x553c0b={'count':0x0,'rows':[]};return db[_0x5da6('0x46')][_0x5da6('0x69')]({'where':{'id':_0x46c8cd[_0x5da6('0x63')]['id']}})[_0x5da6('0x22')](handleEntityNotFound(_0x3d2383,null))[_0x5da6('0x22')](function(_0x49e4b8){if(_0x49e4b8){_0x371159['model']=_[_0x5da6('0x5f')](db['Disposition'][_0x5da6('0x47')]);_0x371159[_0x5da6('0x4b')]=_[_0x5da6('0x5f')](_0x46c8cd[_0x5da6('0x4b')]);_0x371159[_0x5da6('0x4c')]=_[_0x5da6('0x4e')](_0x371159[_0x5da6('0x4a')],_0x371159['query']);_0x3a828f[_0x5da6('0x4d')]=_[_0x5da6('0x4e')](_0x371159[_0x5da6('0x4a')],qs[_0x5da6('0x4f')](_0x46c8cd[_0x5da6('0x4b')][_0x5da6('0x4f')]));_0x3a828f[_0x5da6('0x4d')]=_0x3a828f[_0x5da6('0x4d')][_0x5da6('0x50')]?_0x3a828f['attributes']:_0x371159['model'];if(!_0x46c8cd['query'][_0x5da6('0x51')]('nolimit')){_0x3a828f[_0x5da6('0x32')]=qs[_0x5da6('0x32')](_0x46c8cd[_0x5da6('0x4b')][_0x5da6('0x32')]);_0x3a828f[_0x5da6('0x2f')]=qs[_0x5da6('0x2f')](_0x46c8cd['query']['offset']);}_0x3a828f['order']=qs['sort'](_0x46c8cd[_0x5da6('0x4b')][_0x5da6('0x54')]);_0x3a828f[_0x5da6('0x55')]=qs[_0x5da6('0x4c')](_['pick'](_0x46c8cd[_0x5da6('0x4b')],_0x371159['filters']));_0x3a828f[_0x5da6('0x55')]['MailAccountId']=_0x49e4b8['id'];if(_0x46c8cd[_0x5da6('0x4b')][_0x5da6('0x57')]){_0x3a828f[_0x5da6('0x55')]=_['merge'](_0x3a828f[_0x5da6('0x55')],{'$or':_[_0x5da6('0x45')](_0x3a828f[_0x5da6('0x4d')],function(_0x3d01cd){var _0x25e635={};_0x25e635[_0x3d01cd]={'$like':'%'+_0x46c8cd['query'][_0x5da6('0x57')]+'%'};return _0x25e635;})});}_0x3a828f=_['merge']({},_0x3a828f,_0x46c8cd[_0x5da6('0x5a')]);return db[_0x5da6('0x67')]['count']({'where':_0x3a828f[_0x5da6('0x55')]})['then'](function(_0x3fba30){_0x553c0b[_0x5da6('0x31')]=_0x3fba30;if(_0x46c8cd[_0x5da6('0x4b')][_0x5da6('0x60')]){_0x3a828f['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3a828f);})[_0x5da6('0x22')](function(_0x5a0e47){_0x553c0b[_0x5da6('0x5c')]=_0x5a0e47;return _0x553c0b;});}})[_0x5da6('0x22')](respondWithFilteredResult(_0x3d2383,_0x3a828f))[_0x5da6('0x5d')](handleError(_0x3d2383,null));};exports[_0x5da6('0x6a')]=function(_0x53a7c8,_0x5e9b8e,_0x21a24f){return db[_0x5da6('0x46')]['find']({'where':{'id':_0x53a7c8['params']['id']}})['then'](handleEntityNotFound(_0x5e9b8e,null))[_0x5da6('0x22')](function(_0xbf60c){if(_0xbf60c){return _0xbf60c[_0x5da6('0x6a')](_0x53a7c8[_0x5da6('0x4b')][_0x5da6('0x6b')]);}})['then'](respondWithStatusCode(_0x5e9b8e,null))[_0x5da6('0x5d')](handleError(_0x5e9b8e,null));};exports[_0x5da6('0x6c')]=function(_0x5a7ce2,_0x4d3644,_0x2cb7d4){if(_0x5a7ce2[_0x5da6('0x62')]['id']){delete _0x5a7ce2[_0x5da6('0x62')]['id'];}return db[_0x5da6('0x46')][_0x5da6('0x61')]({'where':{'id':_0x5a7ce2[_0x5da6('0x63')]['id']}})[_0x5da6('0x22')](handleEntityNotFound(_0x4d3644,null))[_0x5da6('0x22')](function(_0x3a9a31){if(_0x3a9a31){_0x5a7ce2[_0x5da6('0x62')][_0x5da6('0x66')]=_0x3a9a31['id'];return db[_0x5da6('0x6d')]['create'](_0x5a7ce2[_0x5da6('0x62')]);}})[_0x5da6('0x22')](respondWithResult(_0x4d3644,null))['catch'](handleError(_0x4d3644,null));};exports[_0x5da6('0x6e')]=function(_0x24511e,_0x53eedb,_0x198e2d){var _0x2b21ac={'raw':![],'where':{}};var _0x10664f={};var _0x85eb6e={'count':0x0,'rows':[]};return db[_0x5da6('0x46')]['findOne']({'where':{'id':_0x24511e['params']['id']}})[_0x5da6('0x22')](handleEntityNotFound(_0x53eedb,null))['then'](function(_0x2a3194){if(_0x2a3194){_0x10664f[_0x5da6('0x4a')]=_[_0x5da6('0x5f')](db[_0x5da6('0x6d')][_0x5da6('0x47')]);_0x10664f[_0x5da6('0x4b')]=_[_0x5da6('0x5f')](_0x24511e[_0x5da6('0x4b')]);_0x10664f[_0x5da6('0x4c')]=_[_0x5da6('0x4e')](_0x10664f[_0x5da6('0x4a')],_0x10664f['query']);_0x2b21ac[_0x5da6('0x4d')]=_[_0x5da6('0x4e')](_0x10664f['model'],qs[_0x5da6('0x4f')](_0x24511e[_0x5da6('0x4b')][_0x5da6('0x4f')]));_0x2b21ac[_0x5da6('0x4d')]=_0x2b21ac[_0x5da6('0x4d')]['length']?_0x2b21ac[_0x5da6('0x4d')]:_0x10664f[_0x5da6('0x4a')];if(!_0x24511e['query'][_0x5da6('0x51')](_0x5da6('0x52'))){_0x2b21ac[_0x5da6('0x32')]=qs[_0x5da6('0x32')](_0x24511e[_0x5da6('0x4b')]['limit']);_0x2b21ac[_0x5da6('0x2f')]=qs[_0x5da6('0x2f')](_0x24511e['query'][_0x5da6('0x2f')]);}_0x2b21ac[_0x5da6('0x53')]=qs[_0x5da6('0x54')](_0x24511e['query'][_0x5da6('0x54')]);_0x2b21ac['where']=qs[_0x5da6('0x4c')](_['pick'](_0x24511e[_0x5da6('0x4b')],_0x10664f[_0x5da6('0x4c')]));_0x2b21ac[_0x5da6('0x55')][_0x5da6('0x66')]=_0x2a3194['id'];if(_0x24511e[_0x5da6('0x4b')]['filter']){_0x2b21ac[_0x5da6('0x55')]=_[_0x5da6('0x59')](_0x2b21ac[_0x5da6('0x55')],{'$or':_['map'](_0x2b21ac['attributes'],function(_0x1bbfe8){var _0x395db0={};_0x395db0[_0x1bbfe8]={'$like':'%'+_0x24511e[_0x5da6('0x4b')][_0x5da6('0x57')]+'%'};return _0x395db0;})});}_0x2b21ac=_[_0x5da6('0x59')]({},_0x2b21ac,_0x24511e[_0x5da6('0x5a')]);return db[_0x5da6('0x6d')][_0x5da6('0x31')]({'where':_0x2b21ac[_0x5da6('0x55')]})['then'](function(_0x8759d9){_0x85eb6e['count']=_0x8759d9;if(_0x24511e[_0x5da6('0x4b')][_0x5da6('0x60')]){_0x2b21ac[_0x5da6('0x5b')]=[{'all':!![]}];}return db[_0x5da6('0x6d')][_0x5da6('0x6f')](_0x2b21ac);})['then'](function(_0x1f3396){_0x85eb6e[_0x5da6('0x5c')]=_0x1f3396;return _0x85eb6e;});}})[_0x5da6('0x22')](respondWithFilteredResult(_0x53eedb,_0x2b21ac))[_0x5da6('0x5d')](handleError(_0x53eedb,null));};exports['removeAnswers']=function(_0x537850,_0x46df5d,_0x6b9883){return db[_0x5da6('0x46')][_0x5da6('0x61')]({'where':{'id':_0x537850[_0x5da6('0x63')]['id']}})[_0x5da6('0x22')](handleEntityNotFound(_0x46df5d,null))[_0x5da6('0x22')](function(_0x4d3343){if(_0x4d3343){return _0x4d3343[_0x5da6('0x70')](_0x537850['query'][_0x5da6('0x6b')]);}})[_0x5da6('0x22')](respondWithStatusCode(_0x46df5d,null))[_0x5da6('0x5d')](handleError(_0x46df5d,null));};exports[_0x5da6('0x71')]=function(_0x36c0b5,_0x89584e){var _0x3736c2={'name':_0x36c0b5[_0x5da6('0x62')]['name'],'key':_0x36c0b5['body']['key'],'email':_0x36c0b5[_0x5da6('0x62')][_0x5da6('0x72')],'ListId':_0x36c0b5[_0x5da6('0x62')][_0x5da6('0x73')],'active':!_[_0x5da6('0x74')](_0x36c0b5['body'][_0x5da6('0x75')])?_0x36c0b5[_0x5da6('0x62')][_0x5da6('0x75')]:!![],'description':_0x36c0b5['body']['description']||null,'Imap':{},'Smtp':{}};if(_[_0x5da6('0x74')](_0x36c0b5[_0x5da6('0x62')][_0x5da6('0x76')])){if(_0x36c0b5[_0x5da6('0x62')][_0x5da6('0x77')]){_0x3736c2[_0x5da6('0x40')][_0x5da6('0x78')]=_0x3736c2['Smtp'][_0x5da6('0x78')]=_0x36c0b5[_0x5da6('0x62')]['cuser'];_0x3736c2[_0x5da6('0x40')][_0x5da6('0x79')]=_0x3736c2[_0x5da6('0x42')]['pass']=_0x36c0b5[_0x5da6('0x62')][_0x5da6('0x7a')];}else{_0x3736c2[_0x5da6('0x40')][_0x5da6('0x7b')]=_0x3736c2['Smtp'][_0x5da6('0x7b')]=![];}_0x3736c2[_0x5da6('0x40')][_0x5da6('0x7c')]=_0x36c0b5['body'][_0x5da6('0x40')]['host'];_0x3736c2[_0x5da6('0x40')][_0x5da6('0x7d')]=_0x36c0b5[_0x5da6('0x62')][_0x5da6('0x40')][_0x5da6('0x7d')];_0x3736c2[_0x5da6('0x42')][_0x5da6('0x7c')]=_0x36c0b5['body']['Smtp'][_0x5da6('0x7c')];_0x3736c2[_0x5da6('0x42')][_0x5da6('0x7d')]=_0x36c0b5['body'][_0x5da6('0x42')][_0x5da6('0x7d')];}else{_0x3736c2[_0x5da6('0x40')][_0x5da6('0x7e')]=_0x3736c2[_0x5da6('0x42')][_0x5da6('0x7e')]=_0x36c0b5[_0x5da6('0x62')]['cservice'];_0x3736c2[_0x5da6('0x40')][_0x5da6('0x78')]=_0x3736c2['Smtp'][_0x5da6('0x78')]=_0x36c0b5[_0x5da6('0x62')][_0x5da6('0x7f')];_0x3736c2[_0x5da6('0x40')][_0x5da6('0x79')]=_0x3736c2[_0x5da6('0x42')][_0x5da6('0x80')]=_0x36c0b5[_0x5da6('0x62')][_0x5da6('0x7a')];}return db['MailAccount']['create'](_0x3736c2,{'include':[{'model':db[_0x5da6('0x41')],'as':'Smtp'},{'model':db[_0x5da6('0x3f')],'as':'Imap'}]})[_0x5da6('0x22')](function(_0x237d79){var _0x1e045c=_0x36c0b5['user'][_0x5da6('0x38')]({'plain':!![]});if(!_0x1e045c)throw new Error(_0x5da6('0x81'));if(_0x1e045c[_0x5da6('0x82')]===_0x5da6('0x78')){var _0x6492fb=_0x237d79[_0x5da6('0x38')]({'plain':!![]});return db[_0x5da6('0x83')][_0x5da6('0x61')]({'where':{'name':_0x5da6('0x39'),'userProfileId':_0x1e045c[_0x5da6('0x84')]},'raw':!![]})['then'](function(_0x32bad5){if(_0x32bad5&&_0x32bad5[_0x5da6('0x85')]===0x0){return db[_0x5da6('0x3a')][_0x5da6('0x71')]({'name':_0x6492fb[_0x5da6('0x3d')],'resourceId':_0x6492fb['id'],'type':_0x32bad5['name'],'sectionId':_0x32bad5['id']},{})[_0x5da6('0x22')](function(){return _0x237d79;});}else{return _0x237d79;}})[_0x5da6('0x5d')](function(_0x2c748b){logger[_0x5da6('0x28')](_0x5da6('0x86'),_0x2c748b);throw _0x2c748b;});}return _0x237d79;})['then'](respondWithResult(_0x89584e,0xc9))[_0x5da6('0x5d')](handleError(_0x89584e,null));};exports[_0x5da6('0x87')]=function(_0x41e4de,_0x5dd7e6,_0x72cc6f){return db[_0x5da6('0x46')][_0x5da6('0x69')]({'where':{'id':_0x41e4de['params']['id']}})[_0x5da6('0x22')](handleEntityNotFound(_0x5dd7e6,null))[_0x5da6('0x22')](function(_0x5e608d){if(_0x5e608d){return _0x5e608d[_0x5da6('0x87')]();}return null;})[_0x5da6('0x22')](respondWithResult(_0x5dd7e6,null))[_0x5da6('0x5d')](handleError(_0x5dd7e6,null));};exports[_0x5da6('0x88')]=function(_0x7c32cc,_0x264797,_0x5e1bcf){if(_0x7c32cc[_0x5da6('0x62')]['id']){delete _0x7c32cc[_0x5da6('0x62')]['id'];}return db[_0x5da6('0x46')][_0x5da6('0x61')]({'where':{'id':_0x7c32cc[_0x5da6('0x63')]['id']}})[_0x5da6('0x22')](handleEntityNotFound(_0x264797,null))[_0x5da6('0x22')](function(_0x3b7409){if(_0x3b7409){_0x7c32cc[_0x5da6('0x62')][_0x5da6('0x66')]=_0x3b7409['id'];return db[_0x5da6('0x3f')][_0x5da6('0x71')](_0x7c32cc[_0x5da6('0x62')]);}})[_0x5da6('0x22')](respondWithResult(_0x264797,null))[_0x5da6('0x5d')](handleError(_0x264797,null));};exports[_0x5da6('0x89')]=function(_0x1002f0,_0x3e432e,_0x10c1d6){return db['MailAccount'][_0x5da6('0x69')]({'where':{'id':_0x1002f0[_0x5da6('0x63')]['id']}})['then'](handleEntityNotFound(_0x3e432e,null))[_0x5da6('0x22')](function(_0x5d675e){if(_0x5d675e){return _0x5d675e['setImap'](null);}return null;})[_0x5da6('0x22')](respondWithStatusCode(_0x3e432e,null))['catch'](handleError(_0x3e432e,null));};exports['getSmtp']=function(_0x28d598,_0x3678f9,_0x5c3cb8){return db[_0x5da6('0x46')]['findOne']({'where':{'id':_0x28d598[_0x5da6('0x63')]['id']}})[_0x5da6('0x22')](handleEntityNotFound(_0x3678f9,null))[_0x5da6('0x22')](function(_0x55d6b){if(_0x55d6b){return _0x55d6b['getSmtp']();}return null;})['then'](respondWithResult(_0x3678f9,null))['catch'](handleError(_0x3678f9,null));};exports[_0x5da6('0x8a')]=function(_0x283fc9,_0x3ad76f,_0x2c429e){if(_0x283fc9[_0x5da6('0x62')]['id']){delete _0x283fc9[_0x5da6('0x62')]['id'];}return db[_0x5da6('0x46')][_0x5da6('0x61')]({'where':{'id':_0x283fc9[_0x5da6('0x63')]['id']}})['then'](handleEntityNotFound(_0x3ad76f,null))[_0x5da6('0x22')](function(_0x168a4b){if(_0x168a4b){_0x283fc9[_0x5da6('0x62')][_0x5da6('0x66')]=_0x168a4b['id'];return db[_0x5da6('0x41')][_0x5da6('0x71')](_0x283fc9[_0x5da6('0x62')]);}})['then'](respondWithResult(_0x3ad76f,null))[_0x5da6('0x5d')](handleError(_0x3ad76f,null));};exports[_0x5da6('0x8b')]=function(_0x1b8e1f,_0x257f3f,_0x5b7f1d){return db['MailAccount']['findOne']({'where':{'id':_0x1b8e1f['params']['id']}})['then'](handleEntityNotFound(_0x257f3f,null))['then'](function(_0x4acb6c){if(_0x4acb6c){return _0x4acb6c[_0x5da6('0x8c')](null);}return null;})['then'](respondWithStatusCode(_0x257f3f,null))[_0x5da6('0x5d')](handleError(_0x257f3f,null));};exports['addInteraction']=function(_0x5caf0d,_0x447a32,_0x229f95){return db[_0x5da6('0x8d')][_0x5da6('0x61')]({'where':{'id':_0x5caf0d[_0x5da6('0x63')]['id']}})[_0x5da6('0x22')](handleEntityNotFound(_0x447a32,null))[_0x5da6('0x22')](function(_0x6b9310){if(_0x6b9310){return _0x6b9310[_0x5da6('0x8e')](_0x5caf0d[_0x5da6('0x62')][_0x5da6('0x6b')],_[_0x5da6('0x8f')](_0x5caf0d['body'],[_0x5da6('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x447a32,null))['catch'](handleError(_0x447a32,null));};exports[_0x5da6('0x90')]=function(_0x4dc1ef,_0x4e63d2,_0x4f4301){var _0x56ddae={'raw':![],'where':{}};var _0x4aef67={};var _0x57f069={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x4dc1ef[_0x5da6('0x63')]['id']}})['then'](handleEntityNotFound(_0x4e63d2,null))[_0x5da6('0x22')](function(_0x575cb4){if(_0x575cb4){_0x4aef67[_0x5da6('0x4a')]=_['keys'](db['MailInteraction'][_0x5da6('0x47')]);_0x4aef67[_0x5da6('0x4b')]=_[_0x5da6('0x5f')](_0x4dc1ef[_0x5da6('0x4b')]);_0x4aef67[_0x5da6('0x4c')]=_[_0x5da6('0x4e')](_0x4aef67[_0x5da6('0x4a')],_0x4aef67[_0x5da6('0x4b')]);_0x56ddae['attributes']=_[_0x5da6('0x4e')](_0x4aef67[_0x5da6('0x4a')],qs[_0x5da6('0x4f')](_0x4dc1ef[_0x5da6('0x4b')]['fields']));_0x56ddae['attributes']=_0x56ddae[_0x5da6('0x4d')]['length']?_0x56ddae[_0x5da6('0x4d')]:_0x4aef67[_0x5da6('0x4a')];if(!_0x4dc1ef[_0x5da6('0x4b')][_0x5da6('0x51')]('nolimit')){_0x56ddae[_0x5da6('0x32')]=qs[_0x5da6('0x32')](_0x4dc1ef[_0x5da6('0x4b')][_0x5da6('0x32')]);_0x56ddae[_0x5da6('0x2f')]=qs[_0x5da6('0x2f')](_0x4dc1ef[_0x5da6('0x4b')][_0x5da6('0x2f')]);}_0x56ddae['order']=qs['sort'](_0x4dc1ef['query'][_0x5da6('0x54')]);_0x56ddae[_0x5da6('0x55')]=qs[_0x5da6('0x4c')](_[_0x5da6('0x56')](_0x4dc1ef[_0x5da6('0x4b')],_0x4aef67[_0x5da6('0x4c')]));_0x56ddae[_0x5da6('0x55')]['MailAccountId']=_0x575cb4['id'];if(_0x4dc1ef[_0x5da6('0x4b')][_0x5da6('0x57')]){_0x56ddae[_0x5da6('0x55')]=_[_0x5da6('0x59')](_0x56ddae[_0x5da6('0x55')],{'$or':_[_0x5da6('0x45')](_0x56ddae[_0x5da6('0x4d')],function(_0x38e8bb){var _0x5380ed={};_0x5380ed[_0x38e8bb]={'$like':'%'+_0x4dc1ef['query'][_0x5da6('0x57')]+'%'};return _0x5380ed;})});}_0x56ddae=_[_0x5da6('0x59')]({},_0x56ddae,_0x4dc1ef['options']);return db[_0x5da6('0x8d')][_0x5da6('0x31')]({'where':_0x56ddae[_0x5da6('0x55')]})['then'](function(_0xc8ad1){_0x57f069[_0x5da6('0x31')]=_0xc8ad1;if(_0x4dc1ef[_0x5da6('0x4b')]['includeAll']){_0x56ddae[_0x5da6('0x5b')]=[{'model':db[_0x5da6('0x91')],'as':_0x5da6('0x92'),'required':![]},{'model':db['User'],'as':_0x5da6('0x93'),'attributes':[_0x5da6('0x3d'),_0x5da6('0x94'),_0x5da6('0x95')],'required':![]},{'model':db[_0x5da6('0x96')],'as':'Tags','attributes':['id','name',_0x5da6('0x97')],'where':_0x4dc1ef[_0x5da6('0x4b')][_0x5da6('0x98')]?{'id':_0x4dc1ef['query'][_0x5da6('0x98')]}:undefined,'required':_0x4dc1ef[_0x5da6('0x4b')]['tag']?!![]:![]}];}return db[_0x5da6('0x8d')]['findAll'](_0x56ddae);})['then'](function(_0x5ba7b4){_0x57f069[_0x5da6('0x5c')]=_0x5ba7b4;return _0x57f069;});}})[_0x5da6('0x22')](respondWithFilteredResult(_0x4e63d2,_0x56ddae))[_0x5da6('0x5d')](handleError(_0x4e63d2,null));};exports['addApplications']=function(_0x4c4a8e,_0x11d27a,_0x19dc48){return db[_0x5da6('0x46')][_0x5da6('0x69')]({'where':{'id':_0x4c4a8e['params']['id']}})[_0x5da6('0x22')](handleEntityNotFound(_0x11d27a,null))[_0x5da6('0x22')](function(_0x4ee1e6){if(_0x4ee1e6){return db[_0x5da6('0x99')][_0x5da6('0x9a')](function(_0x527f14){return db[_0x5da6('0x9b')][_0x5da6('0x3b')]({'where':{'MailAccountId':_0x4c4a8e[_0x5da6('0x63')]['id']},'transaction':_0x527f14})[_0x5da6('0x22')](function(_0x21662f){var _0x2baa9b=_['map'](_0x4c4a8e[_0x5da6('0x62')],function(_0x3eae17){_0x3eae17['MailAccountId']=_0x4c4a8e['params']['id'];return _0x3eae17;});return db[_0x5da6('0x9b')][_0x5da6('0x9c')](_0x2baa9b,{'transaction':_0x527f14});});})[_0x5da6('0x22')](function(){return db['MailApplication'][_0x5da6('0x9d')]({'where':{'MailAccountId':_0x4c4a8e[_0x5da6('0x63')]['id']},'order':_0x5da6('0x9e')});});}})[_0x5da6('0x22')](respondWithResult(_0x11d27a,null))[_0x5da6('0x5d')](handleError(_0x11d27a,null));};exports[_0x5da6('0x9f')]=function(_0x498bec,_0x179d12,_0x213d1d){var _0x4b3846={};var _0x3c9c02={};var _0xca349e;var _0xc81b34;return db[_0x5da6('0x46')][_0x5da6('0x69')]({'where':{'id':_0x498bec[_0x5da6('0x63')]['id']}})[_0x5da6('0x22')](handleEntityNotFound(_0x179d12,null))[_0x5da6('0x22')](function(_0x3c6f6e){if(_0x3c6f6e){_0xca349e=_0x3c6f6e;_0x3c9c02['model']=_['keys'](db[_0x5da6('0x9b')]['rawAttributes']);_0x3c9c02[_0x5da6('0x4b')]=_[_0x5da6('0x5f')](_0x498bec['query']);_0x3c9c02[_0x5da6('0x4c')]=_[_0x5da6('0x4e')](_0x3c9c02[_0x5da6('0x4a')],_0x3c9c02[_0x5da6('0x4b')]);_0x4b3846[_0x5da6('0x4d')]=_[_0x5da6('0x4e')](_0x3c9c02[_0x5da6('0x4a')],qs['fields'](_0x498bec[_0x5da6('0x4b')][_0x5da6('0x4f')]));_0x4b3846[_0x5da6('0x4d')]=_0x4b3846[_0x5da6('0x4d')][_0x5da6('0x50')]?_0x4b3846[_0x5da6('0x4d')]:_0x3c9c02[_0x5da6('0x4a')];_0x4b3846[_0x5da6('0x53')]=qs['sort'](_0x498bec[_0x5da6('0x4b')][_0x5da6('0x54')]);_0x4b3846[_0x5da6('0x55')]=qs[_0x5da6('0x4c')](_[_0x5da6('0x56')](_0x498bec[_0x5da6('0x4b')],_0x3c9c02[_0x5da6('0x4c')]));if(_0x498bec[_0x5da6('0x4b')][_0x5da6('0x57')]){_0x4b3846[_0x5da6('0x55')]=_[_0x5da6('0x59')](_0x4b3846['where'],{'$or':_[_0x5da6('0x45')](_0x4b3846[_0x5da6('0x4d')],function(_0xfb5f5a){var _0x1cec12={};_0x1cec12[_0xfb5f5a]={'$like':'%'+_0x498bec[_0x5da6('0x4b')][_0x5da6('0x57')]+'%'};return _0x1cec12;})});}_0x4b3846=_[_0x5da6('0x59')]({},_0x4b3846,_0x498bec[_0x5da6('0x5a')]);return _0xca349e['getApplications'](_0x4b3846);}})[_0x5da6('0x22')](function(_0x32b87d){if(_0x32b87d){_0xc81b34=_0x32b87d[_0x5da6('0x50')];if(!_0x498bec['query'][_0x5da6('0x51')](_0x5da6('0x52'))){_0x4b3846[_0x5da6('0x32')]=qs[_0x5da6('0x32')](_0x498bec[_0x5da6('0x4b')][_0x5da6('0x32')]);_0x4b3846['offset']=qs['offset'](_0x498bec[_0x5da6('0x4b')][_0x5da6('0x2f')]);}return _0xca349e['getApplications'](_0x4b3846);}})[_0x5da6('0x22')](function(_0x45034c){if(_0x45034c){return _0x45034c?{'count':_0xc81b34,'rows':_0x45034c}:null;}})[_0x5da6('0x22')](respondWithResult(_0x179d12,null))[_0x5da6('0x5d')](handleError(_0x179d12,null));};exports[_0x5da6('0xa0')]=function(_0x1b61da,_0x4f302a,_0x55952b){var _0xc79dda={'raw':!![],'where':{}};var _0x383828={};var _0x406749={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1b61da[_0x5da6('0x63')]['id']}})[_0x5da6('0x22')](handleEntityNotFound(_0x4f302a,null))['then'](function(_0x1dd0f5){if(_0x1dd0f5){_0x383828['model']=_[_0x5da6('0x5f')](db[_0x5da6('0xa1')][_0x5da6('0x47')]);_0x383828[_0x5da6('0x4b')]=_[_0x5da6('0x5f')](_0x1b61da[_0x5da6('0x4b')]);_0x383828[_0x5da6('0x4c')]=_[_0x5da6('0x4e')](_0x383828[_0x5da6('0x4a')],_0x383828[_0x5da6('0x4b')]);_0xc79dda[_0x5da6('0x4d')]=_[_0x5da6('0x4e')](_0x383828[_0x5da6('0x4a')],qs['fields'](_0x1b61da[_0x5da6('0x4b')][_0x5da6('0x4f')]));_0xc79dda[_0x5da6('0x4d')]=_0xc79dda[_0x5da6('0x4d')][_0x5da6('0x50')]?_0xc79dda['attributes']:_0x383828[_0x5da6('0x4a')];if(!_0x1b61da[_0x5da6('0x4b')]['hasOwnProperty'](_0x5da6('0x52'))){_0xc79dda[_0x5da6('0x32')]=qs[_0x5da6('0x32')](_0x1b61da[_0x5da6('0x4b')][_0x5da6('0x32')]);_0xc79dda['offset']=qs[_0x5da6('0x2f')](_0x1b61da[_0x5da6('0x4b')][_0x5da6('0x2f')]);}_0xc79dda['order']=qs['sort'](_0x1b61da[_0x5da6('0x4b')][_0x5da6('0x54')]);_0xc79dda[_0x5da6('0x55')]=qs[_0x5da6('0x4c')](_[_0x5da6('0x56')](_0x1b61da[_0x5da6('0x4b')],_0x383828['filters']));_0xc79dda[_0x5da6('0x55')][_0x5da6('0x66')]=_0x1dd0f5['id'];if(_0x1b61da['query']['filter']){_0xc79dda[_0x5da6('0x55')]=_['merge'](_0xc79dda[_0x5da6('0x55')],{'$or':_['map'](_0xc79dda[_0x5da6('0x4d')],function(_0x2a2aa2){var _0x3fc89a={};_0x3fc89a[_0x2a2aa2]={'$like':'%'+_0x1b61da[_0x5da6('0x4b')][_0x5da6('0x57')]+'%'};return _0x3fc89a;})});}if(_0x1b61da[_0x5da6('0x4b')][_0x5da6('0xa2')]){var _0x4f45fc=_0x1b61da['query'][_0x5da6('0xa2')][_0x5da6('0xa3')](',');var _0x41a843={};_0x41a843[_0x4f45fc[0x0]]={'$gte':moment(_0x4f45fc[0x1])[_0x5da6('0xa4')](_0x5da6('0xa5'))};_0xc79dda['where']=_[_0x5da6('0x59')](_0xc79dda[_0x5da6('0x55')],_0x41a843);}_0xc79dda=_[_0x5da6('0x59')]({},_0xc79dda,_0x1b61da['options']);return db[_0x5da6('0xa1')][_0x5da6('0x31')]({'where':_0xc79dda[_0x5da6('0x55')]})[_0x5da6('0x22')](function(_0xd60d5a){_0x406749['count']=_0xd60d5a;if(_0x1b61da[_0x5da6('0x4b')][_0x5da6('0x60')]){_0xc79dda['include']=[{'all':!![]}];}return db[_0x5da6('0xa1')][_0x5da6('0x6f')](_0xc79dda);})[_0x5da6('0x22')](function(_0x2f7fdd){if(_0x1b61da[_0x5da6('0x4b')]['inlineCss']==='true'){for(var _0xc1a339=0x0;_0xc1a339<_0x2f7fdd[_0x5da6('0x50')];_0xc1a339++){_0x2f7fdd[_0xc1a339][_0x5da6('0x62')]=juice(_0x2f7fdd[_0xc1a339][_0x5da6('0x62')]);}}_0x406749[_0x5da6('0x5c')]=_0x2f7fdd;return _0x406749;});}})[_0x5da6('0x22')](respondWithFilteredResult(_0x4f302a,_0xc79dda))[_0x5da6('0x5d')](handleError(_0x4f302a,null));};exports[_0x5da6('0xa6')]=function(_0x19fe35,_0x4f0e8b,_0x3abff1){var _0x4ea13f,_0x54e48e={},_0x23274c;if(_0x19fe35[_0x5da6('0x62')]['to']){_0x23274c=_0x19fe35[_0x5da6('0x62')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x5da6('0x61')]({'where':{'id':_0x19fe35['params']['id']},'include':[{'model':db[_0x5da6('0xa7')],'as':_0x5da6('0xa8'),'include':[{'model':db[_0x5da6('0x91')],'as':_0x5da6('0xa9'),'where':{'email':_0x23274c},'limit':0x1,'order':[['updatedAt',_0x5da6('0xaa')]]}]},{'model':db[_0x5da6('0x41')],'as':_0x5da6('0x42'),'raw':!![]}]})[_0x5da6('0x22')](handleEntityNotFound(_0x4f0e8b,null))[_0x5da6('0x22')](function(_0x2ad524){if(_0x2ad524){_0x4ea13f=_0x2ad524;if(_0x2ad524[_0x5da6('0x42')]){if(_['isNil'](_0x19fe35[_0x5da6('0x62')][_0x5da6('0xab')])){_0x19fe35['body'][_0x5da6('0xab')]=util['format'](_0x5da6('0xac'),_0x2ad524[_0x5da6('0x3d')],_0x2ad524[_0x5da6('0x72')]||_0x2ad524[_0x5da6('0x42')][_0x5da6('0x78')]);}if(_0x19fe35[_0x5da6('0x62')][_0x5da6('0xad')]&&_0x19fe35[_0x5da6('0x62')][_0x5da6('0xad')][_0x5da6('0x50')]){for(var _0x3c921e=0x0;_0x3c921e<_0x19fe35[_0x5da6('0x62')][_0x5da6('0xad')][_0x5da6('0x50')];_0x3c921e+=0x1){_0x19fe35[_0x5da6('0x62')][_0x5da6('0xad')][_0x3c921e]={'filename':_0x19fe35[_0x5da6('0x62')]['attachments'][_0x3c921e][_0x5da6('0x3d')],'path':path[_0x5da6('0xae')](config[_0x5da6('0xaf')],_0x5da6('0xb0'),_0x19fe35[_0x5da6('0x62')][_0x5da6('0xad')][_0x3c921e][_0x5da6('0xb1')])};}}var _0xf45173={'tls':{'rejectUnauthorized':![]}};if(_[_0x5da6('0x74')](_0x2ad524[_0x5da6('0x42')][_0x5da6('0x7e')])){if(_0x2ad524[_0x5da6('0x42')][_0x5da6('0x7b')]){_0xf45173[_0x5da6('0xb2')]={'user':_0x2ad524['Smtp']['user'],'pass':_0x2ad524[_0x5da6('0x42')][_0x5da6('0x80')]};}_0xf45173[_0x5da6('0x7c')]=_0x2ad524['Smtp'][_0x5da6('0x7c')];_0xf45173[_0x5da6('0x7d')]=_0x2ad524[_0x5da6('0x42')][_0x5da6('0x7d')];_0xf45173['secure']=_0x2ad524[_0x5da6('0x42')][_0x5da6('0xb3')];}else{_0xf45173[_0x5da6('0x7e')]=_0x2ad524[_0x5da6('0x42')][_0x5da6('0x7e')];_0xf45173[_0x5da6('0xb2')]={'user':_0x2ad524[_0x5da6('0x42')][_0x5da6('0x78')],'pass':_0x2ad524[_0x5da6('0x42')][_0x5da6('0x80')]};}return respondWithRpcPromise('SendMail',_0x5da6('0xb4'),{'account':_0xf45173,'message':_0x19fe35[_0x5da6('0x62')]});}else{throw new Error('List\x20not\x20found');}}})[_0x5da6('0x22')](function(_0x461c22){if(_0x461c22){_0x54e48e=_0x461c22;if(_0x4ea13f[_0x5da6('0xa8')]){if(_0x4ea13f[_0x5da6('0xa8')][_0x5da6('0xa9')][_0x5da6('0x50')]){return _0x4ea13f[_0x5da6('0xa8')][_0x5da6('0xa9')][0x0];}else{return db[_0x5da6('0x91')][_0x5da6('0x71')](_[_0x5da6('0x1b')](_0x19fe35[_0x5da6('0x62')],{'firstName':_0x19fe35[_0x5da6('0x62')]['to'],'email':_0x19fe35[_0x5da6('0x62')]['to'],'phone':_0x19fe35[_0x5da6('0x62')]['to'],'ListId':_0x4ea13f['ListId']}));}}else{throw new Error(_0x5da6('0xb5'));}}})['then'](function(_0x43794f){if(_0x43794f){var _0x7d1b10={'UserId':_0x19fe35[_0x5da6('0x78')]['id'],'ContactId':_0x43794f['id'],'MailAccountId':_0x4ea13f['id'],'inReplyTo':_0x54e48e['messageId'],'to':_0x19fe35[_0x5da6('0x62')][_0x5da6('0xab')],'cc':_0x19fe35[_0x5da6('0x62')]['cc'],'subject':_0x19fe35['body'][_0x5da6('0xb6')],'attach':_0x19fe35[_0x5da6('0x62')][_0x5da6('0xb7')],'firstMsgDirection':_0x5da6('0xb8'),'lastMsgAt':moment()[_0x5da6('0xa4')](_0x5da6('0xa5')),'lastMsgDirection':_0x5da6('0xb8'),'Messages':[_[_0x5da6('0x59')](_0x19fe35[_0x5da6('0x62')],{'messageId':_0x54e48e[_0x5da6('0xb9')],'sentAt':moment()[_0x5da6('0xa4')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x4ea13f['id'],'UserId':_0x19fe35[_0x5da6('0x78')]['id'],'ContactId':_0x43794f['id']})]};if(_0x19fe35[_0x5da6('0x62')][_0x5da6('0xba')]){_0x7d1b10=_[_0x5da6('0x59')](_0x7d1b10,_0x19fe35[_0x5da6('0x62')]['Interaction']);}return db[_0x5da6('0x8d')]['create'](_0x7d1b10,{'include':[{'model':db[_0x5da6('0xa1')],'as':'Messages'}]});}})[_0x5da6('0x22')](respondWithResult(_0x4f0e8b,null))[_0x5da6('0x5d')](handleError(_0x4f0e8b,null));};exports[_0x5da6('0xbb')]=function(_0x170743,_0x5be8fc,_0x316ec8){return db[_0x5da6('0x46')][_0x5da6('0x61')]({'where':{'id':_0x170743['params']['id']},'include':[{'model':db[_0x5da6('0x41')],'as':_0x5da6('0x42'),'raw':!![]}]})[_0x5da6('0x22')](handleEntityNotFound(_0x5be8fc,null))[_0x5da6('0x22')](function(_0x8aa974){if(_0x8aa974&&_0x8aa974[_0x5da6('0x42')]){var _0x36b6cb={'id':_0x8aa974['id'],'tls':{'rejectUnauthorized':![]}};if(_0x8aa974[_0x5da6('0x42')][_0x5da6('0x7e')]){_0x36b6cb['service']=_0x8aa974[_0x5da6('0x42')][_0x5da6('0x7e')];}else{_0x36b6cb[_0x5da6('0x7c')]=_0x8aa974['Smtp'][_0x5da6('0x7c')];_0x36b6cb[_0x5da6('0x7d')]=_0x8aa974[_0x5da6('0x42')]['port'];_0x36b6cb[_0x5da6('0xb3')]=_0x8aa974[_0x5da6('0x42')][_0x5da6('0xb3')];}if(_0x8aa974[_0x5da6('0x42')][_0x5da6('0x7b')]){_0x36b6cb[_0x5da6('0xb2')]={'user':_0x8aa974[_0x5da6('0x42')][_0x5da6('0x78')],'pass':_0x8aa974[_0x5da6('0x42')]['pass']};}return respondWithRpcPromise(_0x5da6('0xbc'),_0x5da6('0xbb'),{'account':_0x36b6cb});}})[_0x5da6('0x22')](respondWithResult(_0x5be8fc,null))[_0x5da6('0x5d')](handleError(_0x5be8fc,null));};exports['destroy']=function(_0x2ed932,_0x41c257){return db[_0x5da6('0x46')][_0x5da6('0x61')]({'where':{'id':_0x2ed932[_0x5da6('0x63')]['id']}})[_0x5da6('0x22')](handleEntityNotFound(_0x41c257,null))[_0x5da6('0x22')](function(_0x1d6901){if(_0x1d6901&&_0x1d6901['service']){throw new db[(_0x5da6('0xbd'))][(_0x5da6('0xbe'))](_0x5da6('0xbf'));}return _0x1d6901;})[_0x5da6('0x22')](removeEntity(_0x41c257,null))[_0x5da6('0x5d')](handleError(_0x41c257,null));};exports['addAgents']=function(_0x225682,_0x3e0b45,_0x2ef4d0){return db[_0x5da6('0x46')][_0x5da6('0x61')]({'where':{'id':_0x225682[_0x5da6('0x63')]['id']}})[_0x5da6('0x22')](handleEntityNotFound(_0x3e0b45,null))[_0x5da6('0x22')](function(_0x3cd4fb){if(_0x3cd4fb){return _0x3cd4fb[_0x5da6('0xc0')](_0x225682[_0x5da6('0x62')][_0x5da6('0x6b')],_[_0x5da6('0x8f')](_0x225682[_0x5da6('0x62')],['ids','id'])||{})[_0x5da6('0xc1')](function(_0x3bdfec){for(var _0xb58082=0x0;_0xb58082<_0x225682[_0x5da6('0x62')][_0x5da6('0x6b')][_0x5da6('0x50')];_0xb58082+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x225682[_0x5da6('0x62')][_0x5da6('0x6b')][_0xb58082]),'MailAccountId':Number(_0x225682[_0x5da6('0x63')]['id'])});}return _0x3bdfec;});}})[_0x5da6('0x22')](respondWithResult(_0x3e0b45,null))['catch'](handleError(_0x3e0b45,null));};exports[_0x5da6('0xc2')]=function(_0x4faa7a,_0x46c686,_0x76a0d1){return db[_0x5da6('0x46')][_0x5da6('0x61')]({'where':{'id':_0x4faa7a[_0x5da6('0x63')]['id']}})[_0x5da6('0x22')](handleEntityNotFound(_0x46c686,null))[_0x5da6('0x22')](function(_0x458dfb){if(_0x458dfb){return _0x458dfb[_0x5da6('0xc2')](_0x4faa7a[_0x5da6('0x4b')][_0x5da6('0x6b')])[_0x5da6('0x22')](function(){if(_[_0x5da6('0xc3')](_0x4faa7a[_0x5da6('0x4b')][_0x5da6('0x6b')])){for(var _0x2c96a7=0x0;_0x2c96a7<_0x4faa7a['query']['ids']['length'];_0x2c96a7+=0x1){socket['emit'](_0x5da6('0xc4'),{'UserId':Number(_0x4faa7a[_0x5da6('0x4b')][_0x5da6('0x6b')][_0x2c96a7]),'MailAccountId':Number(_0x4faa7a[_0x5da6('0x63')]['id'])});}}else{socket[_0x5da6('0xc5')](_0x5da6('0xc4'),{'UserId':Number(_0x4faa7a[_0x5da6('0x4b')]['ids']),'MailAccountId':Number(_0x4faa7a[_0x5da6('0x63')]['id'])});}});}})[_0x5da6('0x22')](respondWithStatusCode(_0x46c686,null))[_0x5da6('0x5d')](handleError(_0x46c686,null));};exports[_0x5da6('0xc6')]=function(_0x40191d,_0xf561ea,_0x888058){var _0x2312ef={};var _0x52cf1e={};var _0x2d8a11;var _0x2f95cc;return db[_0x5da6('0x46')]['findOne']({'where':{'id':_0x40191d[_0x5da6('0x63')]['id']}})[_0x5da6('0x22')](handleEntityNotFound(_0xf561ea,null))[_0x5da6('0x22')](function(_0x11a852){if(_0x11a852){_0x2d8a11=_0x11a852;_0x52cf1e['model']=_[_0x5da6('0x5f')](db[_0x5da6('0xc7')][_0x5da6('0x47')]);_0x52cf1e[_0x5da6('0x4b')]=_[_0x5da6('0x5f')](_0x40191d[_0x5da6('0x4b')]);_0x52cf1e[_0x5da6('0x4c')]=_[_0x5da6('0x4e')](_0x52cf1e['model'],_0x52cf1e['query']);_0x2312ef[_0x5da6('0x4d')]=_[_0x5da6('0x4e')](_0x52cf1e[_0x5da6('0x4a')],qs[_0x5da6('0x4f')](_0x40191d[_0x5da6('0x4b')][_0x5da6('0x4f')]));_0x2312ef[_0x5da6('0x4d')]=_0x2312ef[_0x5da6('0x4d')]['length']?_0x2312ef[_0x5da6('0x4d')]:_0x52cf1e[_0x5da6('0x4a')];_0x2312ef[_0x5da6('0x53')]=qs[_0x5da6('0x54')](_0x40191d['query'][_0x5da6('0x54')]);_0x2312ef[_0x5da6('0x55')]=qs['filters'](_[_0x5da6('0x56')](_0x40191d['query'],_0x52cf1e[_0x5da6('0x4c')]));if(_0x40191d[_0x5da6('0x4b')][_0x5da6('0x57')]){_0x2312ef[_0x5da6('0x55')]=_['merge'](_0x2312ef['where'],{'$or':_[_0x5da6('0x45')](_0x2312ef[_0x5da6('0x4d')],function(_0x1743e2){var _0x284017={};_0x284017[_0x1743e2]={'$like':'%'+_0x40191d[_0x5da6('0x4b')][_0x5da6('0x57')]+'%'};return _0x284017;})});}_0x2312ef=_['merge']({},_0x2312ef,_0x40191d[_0x5da6('0x5a')]);return _0x2d8a11['getAgents'](_0x2312ef);}})[_0x5da6('0x22')](function(_0x2d0065){if(_0x2d0065){_0x2f95cc=_0x2d0065[_0x5da6('0x50')];if(!_0x40191d[_0x5da6('0x4b')][_0x5da6('0x51')](_0x5da6('0x52'))){_0x2312ef[_0x5da6('0x32')]=qs[_0x5da6('0x32')](_0x40191d[_0x5da6('0x4b')][_0x5da6('0x32')]);_0x2312ef[_0x5da6('0x2f')]=qs[_0x5da6('0x2f')](_0x40191d[_0x5da6('0x4b')][_0x5da6('0x2f')]);}return _0x2d8a11['getAgents'](_0x2312ef);}})['then'](function(_0x4e9fc3){if(_0x4e9fc3){return _0x4e9fc3?{'count':_0x2f95cc,'rows':_0x4e9fc3}:null;}})[_0x5da6('0x22')](respondWithResult(_0xf561ea,null))[_0x5da6('0x5d')](handleError(_0xf561ea,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index fdcc37d..410bc6d 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 _0x043b=['../../mysqldb','save','update','remove','hook','exports','events'];(function(_0x31da28,_0x36983f){var _0x2539fe=function(_0x1980b3){while(--_0x1980b3){_0x31da28['push'](_0x31da28['shift']());}};_0x2539fe(++_0x36983f);}(_0x043b,0xa0));var _0xb043=function(_0xa1cb28,_0x101594){_0xa1cb28=_0xa1cb28-0x0;var _0x3a04cf=_0x043b[_0xa1cb28];return _0x3a04cf;};'use strict';var EventEmitter=require(_0xb043('0x0'));var MailAccount=require(_0xb043('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb043('0x2'),'afterUpdate':_0xb043('0x3'),'afterDestroy':_0xb043('0x4')};function emitEvent(_0x334a6c){return function(_0x2e1e4b,_0x213ee5,_0x29025b){MailAccountEvents['emit'](_0x334a6c+':'+_0x2e1e4b['id'],_0x2e1e4b);MailAccountEvents['emit'](_0x334a6c,_0x2e1e4b);_0x29025b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xb043('0x5')](e,emitEvent(event));}}module[_0xb043('0x6')]=MailAccountEvents; \ No newline at end of file +var _0x56b9=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x26e727,_0x3e65be){var _0x563800=function(_0xbcf999){while(--_0xbcf999){_0x26e727['push'](_0x26e727['shift']());}};_0x563800(++_0x3e65be);}(_0x56b9,0x196));var _0x956b=function(_0x3d6b5b,_0x163153){_0x3d6b5b=_0x3d6b5b-0x0;var _0x3f8935=_0x56b9[_0x3d6b5b];return _0x3f8935;};'use strict';var EventEmitter=require(_0x956b('0x0'));var MailAccount=require(_0x956b('0x1'))['db'][_0x956b('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x956b('0x3')](0x0);var events={'afterCreate':_0x956b('0x4'),'afterUpdate':_0x956b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x34200b){return function(_0x5d60cd,_0x34051d,_0x1cb24a){MailAccountEvents[_0x956b('0x6')](_0x34200b+':'+_0x5d60cd['id'],_0x5d60cd);MailAccountEvents['emit'](_0x34200b,_0x5d60cd);_0x1cb24a(null);};}for(var e in events){if(events[_0x956b('0x7')](e)){var event=events[e];MailAccount[_0x956b('0x8')](e,emitEvent(event));}}module[_0x956b('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 9c9fcc7..5f57de4 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 _0xee2e=['util','api','moment','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','define','mail_accounts','lodash'];(function(_0x305bbf,_0x5647b3){var _0x4ed772=function(_0x3315ed){while(--_0x3315ed){_0x305bbf['push'](_0x305bbf['shift']());}};_0x4ed772(++_0x5647b3);}(_0xee2e,0x83));var _0xeee2=function(_0x223335,_0x4df342){_0x223335=_0x223335-0x0;var _0x3c9cd4=_0xee2e[_0x223335];return _0x3c9cd4;};'use strict';var _=require(_0xeee2('0x0'));var util=require(_0xeee2('0x1'));var logger=require('../../config/logger')(_0xeee2('0x2'));var moment=require(_0xeee2('0x3'));var BPromise=require('bluebird');var rp=require(_0xeee2('0x4'));var fs=require('fs');var path=require(_0xeee2('0x5'));var rimraf=require(_0xeee2('0x6'));var config=require(_0xeee2('0x7'));var attributes=require(_0xeee2('0x8'));module['exports']=function(_0x301426,_0x5b7d3c){return _0x301426[_0xeee2('0x9')]('MailAccount',attributes,{'tableName':_0xeee2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd415=['path','rimraf','./mailAccount.attributes','exports','mail_accounts','lodash','bluebird','request-promise'];(function(_0x2210f2,_0x21c301){var _0x44152f=function(_0x1b05fc){while(--_0x1b05fc){_0x2210f2['push'](_0x2210f2['shift']());}};_0x44152f(++_0x21c301);}(_0xd415,0xad));var _0x5d41=function(_0x5e0436,_0x18eda7){_0x5e0436=_0x5e0436-0x0;var _0x4b53d6=_0xd415[_0x5e0436];return _0x4b53d6;};'use strict';var _=require(_0x5d41('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5d41('0x1'));var rp=require(_0x5d41('0x2'));var fs=require('fs');var path=require(_0x5d41('0x3'));var rimraf=require(_0x5d41('0x4'));var config=require('../../config/environment');var attributes=require(_0x5d41('0x5'));module[_0x5d41('0x6')]=function(_0x12ad45,_0x388e48){return _0x12ad45['define']('MailAccount',attributes,{'tableName':_0x5d41('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 3e654c6..148957b 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 _0xd9bb=['subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','interaction','created','attach','attachments','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','include','model','map','debug','find','ShowMailAccount','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','Contacts','DESC','MailApplication','Applications','Smtp','List','get','omit','applications','list','priority','asc','close','autoclose','*,*,*,*','length','defaults','create','contact','messageId','generate'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0xd9bb,0x85));var _0xbd9b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd9bb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbd9b('0x0'));var util=require(_0xbd9b('0x1'));var moment=require(_0xbd9b('0x2'));var BPromise=require(_0xbd9b('0x3'));var rs=require(_0xbd9b('0x4'));var fs=require('fs');var Redis=require(_0xbd9b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd9b('0x6'));var logger=require('../../config/logger')(_0xbd9b('0x7'));var config=require(_0xbd9b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbd9b('0x9')][_0xbd9b('0xa')]({'port':0x232c});config['redis']=_['defaults'](config[_0xbd9b('0xb')],{'host':_0xbd9b('0xc'),'port':0x18eb});var socket=require(_0xbd9b('0xd'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xbd9b('0xe')](socket);function respondWithRpcPromise(_0x59c606,_0x54fd4d,_0x201863){return new BPromise(function(_0x3d1ad5,_0x5a8372){return client[_0xbd9b('0xf')](_0x59c606,_0x201863)[_0xbd9b('0x10')](function(_0x239c87){logger[_0xbd9b('0x11')](_0xbd9b('0x12'),_0x54fd4d,_0xbd9b('0x13'));logger['debug'](_0xbd9b('0x14'),_0x54fd4d,_0xbd9b('0x13'),JSON[_0xbd9b('0x15')](_0x239c87));if(_0x239c87[_0xbd9b('0x16')]){if(_0x239c87[_0xbd9b('0x16')][_0xbd9b('0x17')]===0x1f4){logger[_0xbd9b('0x16')](_0xbd9b('0x12'),_0x54fd4d,_0x239c87[_0xbd9b('0x16')][_0xbd9b('0x18')]);return _0x5a8372(_0x239c87[_0xbd9b('0x16')][_0xbd9b('0x18')]);}logger[_0xbd9b('0x16')](_0xbd9b('0x12'),_0x54fd4d,_0x239c87[_0xbd9b('0x16')]['message']);return _0x3d1ad5(_0x239c87[_0xbd9b('0x16')][_0xbd9b('0x18')]);}else{logger[_0xbd9b('0x11')](_0xbd9b('0x12'),_0x54fd4d,_0xbd9b('0x13'));_0x3d1ad5(_0x239c87[_0xbd9b('0x19')][_0xbd9b('0x18')]);}})[_0xbd9b('0x1a')](function(_0x18397c){logger[_0xbd9b('0x16')]('MailAccount,\x20%s,\x20%s',_0x54fd4d,_0x18397c);_0x5a8372(_0x18397c);});});}exports[_0xbd9b('0x1b')]=function(_0x173f4d){var _0x4af110=this;return new Promise(function(_0x27391e,_0x1c1921){return db[_0xbd9b('0x1c')]['findAll']({'raw':_0x173f4d[_0xbd9b('0x1d')]?_0x173f4d[_0xbd9b('0x1d')][_0xbd9b('0x1e')]===undefined?!![]:![]:!![],'where':_0x173f4d[_0xbd9b('0x1d')]?_0x173f4d[_0xbd9b('0x1d')][_0xbd9b('0x1f')]||null:null,'attributes':_0x173f4d[_0xbd9b('0x1d')]?_0x173f4d[_0xbd9b('0x1d')][_0xbd9b('0x20')]||null:null,'limit':_0x173f4d[_0xbd9b('0x1d')]?_0x173f4d['options']['limit']||null:null,'include':_0x173f4d[_0xbd9b('0x1d')]?_0x173f4d[_0xbd9b('0x1d')][_0xbd9b('0x21')]?_['map'](_0x173f4d[_0xbd9b('0x1d')][_0xbd9b('0x21')],function(_0x362ba3){return{'model':db[_0x362ba3[_0xbd9b('0x22')]],'as':_0x362ba3['as'],'attributes':_0x362ba3['attributes'],'include':_0x362ba3[_0xbd9b('0x21')]?_[_0xbd9b('0x23')](_0x362ba3[_0xbd9b('0x21')],function(_0x5bba4f){return{'model':db[_0x5bba4f[_0xbd9b('0x22')]],'as':_0x5bba4f['as'],'attributes':_0x5bba4f[_0xbd9b('0x20')],'include':_0x5bba4f[_0xbd9b('0x21')]?_['map'](_0x5bba4f[_0xbd9b('0x21')],function(_0x5853d6){return{'model':db[_0x5853d6[_0xbd9b('0x22')]],'as':_0x5853d6['as'],'attributes':_0x5853d6[_0xbd9b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbd9b('0x10')](function(_0x1ec089){logger[_0xbd9b('0x11')]('GetMailAccount',_0x173f4d);logger[_0xbd9b('0x24')](_0xbd9b('0x1b'),_0x173f4d,JSON['stringify'](_0x1ec089));_0x27391e(_0x1ec089);})[_0xbd9b('0x1a')](function(_0x9d89bb){logger['error'](_0xbd9b('0x1b'),_0x9d89bb['message'],_0x173f4d);_0x1c1921(_0x4af110['error'](0x1f4,_0x9d89bb['message']));});});};exports['ShowMailAccount']=function(_0x36fb3c){var _0x511c8b=this;return new Promise(function(_0x93124d,_0x5a403c){return db[_0xbd9b('0x1c')][_0xbd9b('0x25')]({'raw':_0x36fb3c[_0xbd9b('0x1d')]?_0x36fb3c['options'][_0xbd9b('0x1e')]===undefined?!![]:![]:!![],'where':_0x36fb3c[_0xbd9b('0x1d')]?_0x36fb3c[_0xbd9b('0x1d')][_0xbd9b('0x1f')]||null:null,'attributes':_0x36fb3c['options']?_0x36fb3c[_0xbd9b('0x1d')][_0xbd9b('0x20')]||null:null,'include':_0x36fb3c[_0xbd9b('0x1d')]?_0x36fb3c[_0xbd9b('0x1d')][_0xbd9b('0x21')]?_[_0xbd9b('0x23')](_0x36fb3c[_0xbd9b('0x1d')]['include'],function(_0x51a548){return{'model':db[_0x51a548[_0xbd9b('0x22')]],'as':_0x51a548['as'],'attributes':_0x51a548[_0xbd9b('0x20')],'include':_0x51a548[_0xbd9b('0x21')]?_[_0xbd9b('0x23')](_0x51a548[_0xbd9b('0x21')],function(_0x49d4af){return{'model':db[_0x49d4af[_0xbd9b('0x22')]],'as':_0x49d4af['as'],'attributes':_0x49d4af[_0xbd9b('0x20')],'include':_0x49d4af[_0xbd9b('0x21')]?_[_0xbd9b('0x23')](_0x49d4af[_0xbd9b('0x21')],function(_0xd378ee){return{'model':db[_0xd378ee[_0xbd9b('0x22')]],'as':_0xd378ee['as'],'attributes':_0xd378ee[_0xbd9b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbd9b('0x10')](function(_0x29c4df){logger[_0xbd9b('0x11')](_0xbd9b('0x26'),_0x36fb3c);logger[_0xbd9b('0x24')](_0xbd9b('0x26'),_0x36fb3c,JSON[_0xbd9b('0x15')](_0x29c4df));_0x93124d(_0x29c4df);})[_0xbd9b('0x1a')](function(_0x1d20ca){logger['error'](_0xbd9b('0x26'),_0x1d20ca[_0xbd9b('0x18')],_0x36fb3c);_0x5a403c(_0x511c8b[_0xbd9b('0x16')](0x1f4,_0x1d20ca[_0xbd9b('0x18')]));});});};exports[_0xbd9b('0x27')]=function(_0x50be94){var _0x195abf=this;return new Promise(function(_0x1768a5,_0x3998e2){var _0x2ea7b7={'body':_0x50be94['body'],'channel':_0xbd9b('0x28')};var _0x4125b3=_[_0xbd9b('0x29')](_[_0xbd9b('0x2a')](db[_0xbd9b('0x2b')][_0xbd9b('0x2c')]),[_0xbd9b('0x2d'),_0xbd9b('0x2e'),_0xbd9b('0x2f'),_0xbd9b('0x30')]);var _0x4dc753=![];if(_0x50be94[_0xbd9b('0x31')]['id']){delete _0x50be94[_0xbd9b('0x31')]['id'];}if(_[_0xbd9b('0x32')](_0x50be94[_0xbd9b('0x31')]['from'])){return _0x3998e2(_0x195abf['error'](0x1f4,_0xbd9b('0x33')));}if(_['isNil'](_0x50be94[_0xbd9b('0x31')]['body'])||_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x31')]===''){return _0x3998e2(_0x195abf[_0xbd9b('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xbd9b('0x32')](_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x34')])){return _0x3998e2(_0x195abf[_0xbd9b('0x16')](0x1f4,_0xbd9b('0x35')+_0x4125b3));}if(!_['includes'](_0x4125b3,_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x34')])){return _0x3998e2(_0x195abf[_0xbd9b('0x16')](0x1f4,_0xbd9b('0x36')+_0x4125b3));}var _0x4f1807={};_0x4f1807[_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x34')]]=_0x50be94['body'][_0xbd9b('0x37')];return db['MailAccount']['find']({'where':{'id':_0x50be94[_0xbd9b('0x38')]['id']},'include':[{'model':db[_0xbd9b('0x39')],'as':'List','include':[{'model':db[_0xbd9b('0x2b')],'as':_0xbd9b('0x3a'),'where':_0x4f1807,'limit':0x1,'order':[['updatedAt',_0xbd9b('0x3b')]]}]},{'model':db[_0xbd9b('0x3c')],'as':_0xbd9b('0x3d')},{'model':db['MailServerOut'],'as':_0xbd9b('0x3e')}]})[_0xbd9b('0x10')](function(_0x3cbd7a){if(_0x3cbd7a&&_0x3cbd7a[_0xbd9b('0x3f')]){var _0x2efa09=_0x3cbd7a[_0xbd9b('0x40')]({'plain':!![]});_0x2ea7b7[_0xbd9b('0x38')]=_[_0xbd9b('0x41')](_0x2efa09,[_0xbd9b('0x3d'),_0xbd9b('0x3f')]);_0x2ea7b7[_0xbd9b('0x42')]=_0x2efa09[_0xbd9b('0x3d')];_0x2ea7b7[_0xbd9b('0x43')]=_0x2efa09[_0xbd9b('0x3f')];_0x2ea7b7[_0xbd9b('0x42')]=_['orderBy'](_0x2ea7b7[_0xbd9b('0x42')],[_0xbd9b('0x44')],[_0xbd9b('0x45')]);if(_0x2ea7b7[_0xbd9b('0x38')]&&_0x2ea7b7[_0xbd9b('0x38')]['autoclose']){_0x2ea7b7['applications']['push']({'id':0x0,'priority':_0x2ea7b7[_0xbd9b('0x42')]['length']+0x1,'app':_0xbd9b('0x46'),'appdata':_0xbd9b('0x47'),'interval':_0xbd9b('0x48')});}if(_0x2ea7b7[_0xbd9b('0x38')]['Applications']){delete _0x2ea7b7[_0xbd9b('0x38')][_0xbd9b('0x3d')];}if(_0x2ea7b7[_0xbd9b('0x38')][_0xbd9b('0x3f')]){delete _0x2ea7b7[_0xbd9b('0x38')]['List'];}if(_0x2efa09['List'][_0xbd9b('0x3a')][_0xbd9b('0x49')]){return _0x2efa09[_0xbd9b('0x3f')][_0xbd9b('0x3a')][0x0];}var _0x1edf28=_[_0xbd9b('0x4a')](_0x50be94[_0xbd9b('0x31')],{'firstName':_0x50be94['body'][_0xbd9b('0x37')],'ListId':_0x2efa09['ListId']});_0x1edf28[_0x50be94['body'][_0xbd9b('0x34')]]=_0x50be94['body'][_0xbd9b('0x37')];return db[_0xbd9b('0x2b')][_0xbd9b('0x4b')](_0x1edf28);}else{throw new Error('List\x20not\x20found');}})[_0xbd9b('0x10')](function(_0x27aec4){_0x2ea7b7[_0xbd9b('0x4c')]=_0x27aec4;if(_0x27aec4){if(!_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x4d')]){_0x50be94[_0xbd9b('0x31')]['message']['messageId']=rs[_0xbd9b('0x4e')]()+'\x20'+_0x50be94[_0xbd9b('0x31')]['message'][_0xbd9b('0x37')];}var _0x2fcb7a={'ContactId':_0x27aec4['id'],'MailAccountId':_0x50be94[_0xbd9b('0x38')]['id'],'inReplyTo':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x4d')],'to':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')]['from'],'cc':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')]['cc'],'subject':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x4f')],'attach':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')]['attach'],'lastMsgAt':moment()[_0xbd9b('0x50')](_0xbd9b('0x51')),'lastMsgDirection':'in'};return db[_0xbd9b('0x52')][_0xbd9b('0x25')]({'where':{'closed':![],'MailAccountId':_0x50be94['account']['id']},'include':[{'model':db[_0xbd9b('0x53')],'as':_0xbd9b('0x54'),'attributes':['messageId'],'where':{'messageId':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x55')]}}]})['then'](function(_0x400c73){if(_0x400c73){return[_0x400c73,![]];}return db[_0xbd9b('0x52')][_0xbd9b('0x4b')](_0x2fcb7a)[_0xbd9b('0x10')](function(_0x197695){return[_0x197695,!![]];});});}else{throw new Error(_0xbd9b('0x56'));}})['spread'](function(_0x3e6802,_0x4950f4){if(_0x3e6802){_0x4dc753=_0x4950f4;if(!_0x4950f4){return _0x3e6802[_0xbd9b('0x57')]({'inReplyTo':_0x50be94[_0xbd9b('0x31')]['message']['messageId'],'to':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x37')],'cc':_0x50be94['body'][_0xbd9b('0x18')]['cc'],'subject':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x4f')],'attach':_0x3e6802['attach']?_0x3e6802['attach']:_0x50be94['body'][_0xbd9b('0x18')]['attach'],'substatus':null,'substatusAt':moment()[_0xbd9b('0x50')](_0xbd9b('0x51')),'lastMsgAt':moment()[_0xbd9b('0x50')](_0xbd9b('0x51')),'lastMsgDirection':'in'});}else{return _0x3e6802;}}})[_0xbd9b('0x10')](function(_0x12d7c5){_0x2ea7b7[_0xbd9b('0x58')]=_0x12d7c5[_0xbd9b('0x40')]({'plain':!![]});_0x2ea7b7[_0xbd9b('0x58')][_0xbd9b('0x59')]=_0x4dc753;return db[_0xbd9b('0x53')]['create']({'body':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x31')],'MailAccountId':_0x50be94[_0xbd9b('0x38')]['id'],'MailInteractionId':_0x12d7c5['id'],'direction':'in','ContactId':_0x2ea7b7[_0xbd9b('0x4c')]['id'],'messageId':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x4d')],'from':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x37')],'to':_0x50be94['body']['message']['to'],'cc':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')]['cc'],'subject':_0x50be94[_0xbd9b('0x31')]['message'][_0xbd9b('0x4f')],'attach':_0x50be94[_0xbd9b('0x31')]['message'][_0xbd9b('0x5a')],'Attachments':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x5b')],'originTo':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')]['originTo'],'originCc':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x5c')],'bcc':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x5d')],'ChatWebsiteId':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x5e')]||null,'originChannel':_0x50be94[_0xbd9b('0x31')]['message'][_0xbd9b('0x5f')]||_0xbd9b('0x60'),'ChatOfflineMessageId':_0x50be94[_0xbd9b('0x31')][_0xbd9b('0x18')][_0xbd9b('0x61')]||null},{'include':[{'model':db['Attachment'],'as':_0xbd9b('0x62')}]});})[_0xbd9b('0x10')](function(_0x41fa28){_0x2ea7b7[_0xbd9b('0x18')]=_0x41fa28;if(_0x2ea7b7['interaction'][_0xbd9b('0x63')]){return db[_0xbd9b('0x64')][_0xbd9b('0x25')]({'attributes':['id',_0xbd9b('0x65')],'where':{'id':_0x2ea7b7['interaction'][_0xbd9b('0x63')]}})[_0xbd9b('0x10')](function(_0x194ea5){if(_0x194ea5){_0x2ea7b7[_0xbd9b('0x42')][_0xbd9b('0x66')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x194ea5['name']+','+(_0x2ea7b7[_0xbd9b('0x38')][_0xbd9b('0x67')]||0xa),'interval':_0xbd9b('0x48')});}return respondWithRpcPromise(_0xbd9b('0x68'),_0xbd9b('0x69'),_0x2ea7b7);});}return respondWithRpcPromise(_0xbd9b('0x68'),_0xbd9b('0x69'),_0x2ea7b7);})[_0xbd9b('0x10')](function(_0x2d9a85){_0x1768a5(_0x2d9a85);})[_0xbd9b('0x1a')](function(_0x52ecba){_0x3998e2(_0x195abf[_0xbd9b('0x16')](0x1f4,_0x52ecba['message']));});});}; \ No newline at end of file +var _0x8411=['MailApplication','Applications','MailServerOut','Smtp','omit','applications','list','orderBy','priority','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','subject','format','MailMessage','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','get','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailAccount,\x20%s,\x20%s','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','map','model','find','ShowMailAccount','NotifyMailAccount','body','mail','CmContact','rawAttributes','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC'];(function(_0x30a67e,_0x4619e1){var _0x580a52=function(_0x61c0a8){while(--_0x61c0a8){_0x30a67e['push'](_0x30a67e['shift']());}};_0x580a52(++_0x4619e1);}(_0x8411,0x10c));var _0x1841=function(_0x3d7f36,_0x6d0981){_0x3d7f36=_0x3d7f36-0x0;var _0x580f55=_0x8411[_0x3d7f36];return _0x580f55;};'use strict';var _=require('lodash');var util=require(_0x1841('0x0'));var moment=require('moment');var BPromise=require(_0x1841('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1841('0x2'));var db=require(_0x1841('0x3'))['db'];var utils=require(_0x1841('0x4'));var logger=require('../../config/logger')(_0x1841('0x5'));var config=require(_0x1841('0x6'));var jayson=require(_0x1841('0x7'));var client=jayson[_0x1841('0x8')][_0x1841('0x9')]({'port':0x232c});config[_0x1841('0xa')]=_[_0x1841('0xb')](config[_0x1841('0xa')],{'host':_0x1841('0xc'),'port':0x18eb});var socket=require(_0x1841('0xd'))(new Redis(config[_0x1841('0xa')]));require(_0x1841('0xe'))[_0x1841('0xf')](socket);function respondWithRpcPromise(_0x5c9948,_0x13561f,_0x4edcf0){return new BPromise(function(_0x6e9b4b,_0xe5ac3e){return client[_0x1841('0x10')](_0x5c9948,_0x4edcf0)[_0x1841('0x11')](function(_0x10ae99){logger[_0x1841('0x12')]('MailAccount,\x20%s,\x20%s',_0x13561f,_0x1841('0x13'));logger[_0x1841('0x14')](_0x1841('0x15'),_0x13561f,_0x1841('0x13'),JSON[_0x1841('0x16')](_0x10ae99));if(_0x10ae99[_0x1841('0x17')]){if(_0x10ae99[_0x1841('0x17')][_0x1841('0x18')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x13561f,_0x10ae99['error'][_0x1841('0x19')]);return _0xe5ac3e(_0x10ae99[_0x1841('0x17')][_0x1841('0x19')]);}logger['error'](_0x1841('0x1a'),_0x13561f,_0x10ae99['error'][_0x1841('0x19')]);return _0x6e9b4b(_0x10ae99[_0x1841('0x17')][_0x1841('0x19')]);}else{logger[_0x1841('0x12')](_0x1841('0x1a'),_0x13561f,_0x1841('0x13'));_0x6e9b4b(_0x10ae99[_0x1841('0x1b')][_0x1841('0x19')]);}})['catch'](function(_0x20501e){logger[_0x1841('0x17')]('MailAccount,\x20%s,\x20%s',_0x13561f,_0x20501e);_0xe5ac3e(_0x20501e);});});}exports[_0x1841('0x1c')]=function(_0x374bd3){var _0x2e247b=this;return new Promise(function(_0x114e44,_0x58b680){return db[_0x1841('0x1d')][_0x1841('0x1e')]({'raw':_0x374bd3['options']?_0x374bd3[_0x1841('0x1f')][_0x1841('0x20')]===undefined?!![]:![]:!![],'where':_0x374bd3[_0x1841('0x1f')]?_0x374bd3[_0x1841('0x1f')][_0x1841('0x21')]||null:null,'attributes':_0x374bd3[_0x1841('0x1f')]?_0x374bd3[_0x1841('0x1f')][_0x1841('0x22')]||null:null,'limit':_0x374bd3[_0x1841('0x1f')]?_0x374bd3[_0x1841('0x1f')]['limit']||null:null,'include':_0x374bd3[_0x1841('0x1f')]?_0x374bd3[_0x1841('0x1f')][_0x1841('0x23')]?_[_0x1841('0x24')](_0x374bd3[_0x1841('0x1f')][_0x1841('0x23')],function(_0x7a8ecb){return{'model':db[_0x7a8ecb[_0x1841('0x25')]],'as':_0x7a8ecb['as'],'attributes':_0x7a8ecb[_0x1841('0x22')],'include':_0x7a8ecb[_0x1841('0x23')]?_[_0x1841('0x24')](_0x7a8ecb[_0x1841('0x23')],function(_0x591c0d){return{'model':db[_0x591c0d[_0x1841('0x25')]],'as':_0x591c0d['as'],'attributes':_0x591c0d[_0x1841('0x22')],'include':_0x591c0d[_0x1841('0x23')]?_[_0x1841('0x24')](_0x591c0d[_0x1841('0x23')],function(_0x1a91bf){return{'model':db[_0x1a91bf[_0x1841('0x25')]],'as':_0x1a91bf['as'],'attributes':_0x1a91bf[_0x1841('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1841('0x11')](function(_0x40adb0){logger['info'](_0x1841('0x1c'),_0x374bd3);logger[_0x1841('0x14')](_0x1841('0x1c'),_0x374bd3,JSON[_0x1841('0x16')](_0x40adb0));_0x114e44(_0x40adb0);})['catch'](function(_0x3d8451){logger[_0x1841('0x17')](_0x1841('0x1c'),_0x3d8451[_0x1841('0x19')],_0x374bd3);_0x58b680(_0x2e247b[_0x1841('0x17')](0x1f4,_0x3d8451['message']));});});};exports['ShowMailAccount']=function(_0x223236){var _0x395bbb=this;return new Promise(function(_0x83968d,_0x33e316){return db[_0x1841('0x1d')][_0x1841('0x26')]({'raw':_0x223236[_0x1841('0x1f')]?_0x223236['options'][_0x1841('0x20')]===undefined?!![]:![]:!![],'where':_0x223236['options']?_0x223236['options'][_0x1841('0x21')]||null:null,'attributes':_0x223236[_0x1841('0x1f')]?_0x223236[_0x1841('0x1f')][_0x1841('0x22')]||null:null,'include':_0x223236['options']?_0x223236[_0x1841('0x1f')]['include']?_[_0x1841('0x24')](_0x223236['options'][_0x1841('0x23')],function(_0x319efa){return{'model':db[_0x319efa[_0x1841('0x25')]],'as':_0x319efa['as'],'attributes':_0x319efa[_0x1841('0x22')],'include':_0x319efa[_0x1841('0x23')]?_['map'](_0x319efa[_0x1841('0x23')],function(_0x3051ce){return{'model':db[_0x3051ce[_0x1841('0x25')]],'as':_0x3051ce['as'],'attributes':_0x3051ce[_0x1841('0x22')],'include':_0x3051ce['include']?_[_0x1841('0x24')](_0x3051ce[_0x1841('0x23')],function(_0xd498c5){return{'model':db[_0xd498c5[_0x1841('0x25')]],'as':_0xd498c5['as'],'attributes':_0xd498c5[_0x1841('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1841('0x11')](function(_0x4c1b61){logger[_0x1841('0x12')](_0x1841('0x27'),_0x223236);logger[_0x1841('0x14')]('ShowMailAccount',_0x223236,JSON[_0x1841('0x16')](_0x4c1b61));_0x83968d(_0x4c1b61);})['catch'](function(_0x272439){logger[_0x1841('0x17')](_0x1841('0x27'),_0x272439['message'],_0x223236);_0x33e316(_0x395bbb[_0x1841('0x17')](0x1f4,_0x272439[_0x1841('0x19')]));});});};exports[_0x1841('0x28')]=function(_0x48e30e){var _0x5cf9a9=this;return new Promise(function(_0x49d15b,_0x3132eb){var _0x17fd1d={'body':_0x48e30e[_0x1841('0x29')],'channel':_0x1841('0x2a')};var _0x2c30cf=_['difference'](_['keys'](db[_0x1841('0x2b')][_0x1841('0x2c')]),[_0x1841('0x2d'),'updatedAt',_0x1841('0x2e'),_0x1841('0x2f')]);var _0x3b30ac=![];if(_0x48e30e[_0x1841('0x29')]['id']){delete _0x48e30e[_0x1841('0x29')]['id'];}if(_[_0x1841('0x30')](_0x48e30e[_0x1841('0x29')][_0x1841('0x31')])){return _0x3132eb(_0x5cf9a9['error'](0x1f4,_0x1841('0x32')));}if(_['isNil'](_0x48e30e[_0x1841('0x29')][_0x1841('0x29')])||_0x48e30e[_0x1841('0x29')][_0x1841('0x29')]===''){return _0x3132eb(_0x5cf9a9['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x1841('0x30')](_0x48e30e[_0x1841('0x29')][_0x1841('0x33')])){return _0x3132eb(_0x5cf9a9['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2c30cf));}if(!_[_0x1841('0x34')](_0x2c30cf,_0x48e30e[_0x1841('0x29')][_0x1841('0x33')])){return _0x3132eb(_0x5cf9a9['error'](0x1f4,_0x1841('0x35')+_0x2c30cf));}var _0x47fabc={};_0x47fabc[_0x48e30e['body'][_0x1841('0x33')]]=_0x48e30e[_0x1841('0x29')][_0x1841('0x31')];return db[_0x1841('0x1d')][_0x1841('0x26')]({'where':{'id':_0x48e30e[_0x1841('0x36')]['id']},'include':[{'model':db[_0x1841('0x37')],'as':_0x1841('0x38'),'include':[{'model':db[_0x1841('0x2b')],'as':_0x1841('0x39'),'where':_0x47fabc,'limit':0x1,'order':[['updatedAt',_0x1841('0x3a')]]}]},{'model':db[_0x1841('0x3b')],'as':_0x1841('0x3c')},{'model':db[_0x1841('0x3d')],'as':_0x1841('0x3e')}]})[_0x1841('0x11')](function(_0x2a9f9b){if(_0x2a9f9b&&_0x2a9f9b[_0x1841('0x38')]){var _0x432979=_0x2a9f9b['get']({'plain':!![]});_0x17fd1d[_0x1841('0x36')]=_[_0x1841('0x3f')](_0x432979,[_0x1841('0x3c'),'List']);_0x17fd1d[_0x1841('0x40')]=_0x432979[_0x1841('0x3c')];_0x17fd1d[_0x1841('0x41')]=_0x432979[_0x1841('0x38')];_0x17fd1d[_0x1841('0x40')]=_[_0x1841('0x42')](_0x17fd1d[_0x1841('0x40')],[_0x1841('0x43')],['asc']);if(_0x17fd1d[_0x1841('0x36')]&&_0x17fd1d['account'][_0x1841('0x44')]){_0x17fd1d['applications'][_0x1841('0x45')]({'id':0x0,'priority':_0x17fd1d[_0x1841('0x40')][_0x1841('0x46')]+0x1,'app':_0x1841('0x47'),'appdata':'autoclose','interval':_0x1841('0x48')});}if(_0x17fd1d[_0x1841('0x36')]['Applications']){delete _0x17fd1d['account']['Applications'];}if(_0x17fd1d[_0x1841('0x36')][_0x1841('0x38')]){delete _0x17fd1d[_0x1841('0x36')]['List'];}if(_0x432979[_0x1841('0x38')][_0x1841('0x39')][_0x1841('0x46')]){return _0x432979[_0x1841('0x38')][_0x1841('0x39')][0x0];}var _0x43dcad=_[_0x1841('0xb')](_0x48e30e['body'],{'firstName':_0x48e30e['body'][_0x1841('0x31')],'ListId':_0x432979[_0x1841('0x2f')]});_0x43dcad[_0x48e30e[_0x1841('0x29')][_0x1841('0x33')]]=_0x48e30e[_0x1841('0x29')][_0x1841('0x31')];return db['CmContact'][_0x1841('0x49')](_0x43dcad);}else{throw new Error(_0x1841('0x4a'));}})[_0x1841('0x11')](function(_0x4e98e3){_0x17fd1d[_0x1841('0x4b')]=_0x4e98e3;if(_0x4e98e3){if(!_0x48e30e['body']['message']['messageId']){_0x48e30e['body'][_0x1841('0x19')][_0x1841('0x4c')]=rs['generate']()+'\x20'+_0x48e30e['body'][_0x1841('0x19')][_0x1841('0x31')];}var _0x4e5ede={'ContactId':_0x4e98e3['id'],'MailAccountId':_0x48e30e[_0x1841('0x36')]['id'],'inReplyTo':_0x48e30e[_0x1841('0x29')][_0x1841('0x19')][_0x1841('0x4c')],'to':_0x48e30e['body']['message'][_0x1841('0x31')],'cc':_0x48e30e[_0x1841('0x29')]['message']['cc'],'subject':_0x48e30e[_0x1841('0x29')][_0x1841('0x19')][_0x1841('0x4d')],'attach':_0x48e30e[_0x1841('0x29')][_0x1841('0x19')]['attach'],'lastMsgAt':moment()[_0x1841('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x1841('0x26')]({'where':{'closed':![],'MailAccountId':_0x48e30e[_0x1841('0x36')]['id']},'include':[{'model':db[_0x1841('0x4f')],'as':_0x1841('0x50'),'attributes':[_0x1841('0x4c')],'where':{'messageId':_0x48e30e['body'][_0x1841('0x19')][_0x1841('0x51')]}}]})[_0x1841('0x11')](function(_0x420ce4){if(_0x420ce4){return[_0x420ce4,![]];}return db[_0x1841('0x52')][_0x1841('0x49')](_0x4e5ede)['then'](function(_0x47adf6){return[_0x47adf6,!![]];});});}else{throw new Error(_0x1841('0x53'));}})[_0x1841('0x54')](function(_0x2496cb,_0x57a20a){if(_0x2496cb){_0x3b30ac=_0x57a20a;if(!_0x57a20a){return _0x2496cb[_0x1841('0x55')]({'inReplyTo':_0x48e30e['body'][_0x1841('0x19')][_0x1841('0x4c')],'to':_0x48e30e[_0x1841('0x29')][_0x1841('0x19')][_0x1841('0x31')],'cc':_0x48e30e[_0x1841('0x29')][_0x1841('0x19')]['cc'],'subject':_0x48e30e[_0x1841('0x29')][_0x1841('0x19')][_0x1841('0x4d')],'attach':_0x2496cb[_0x1841('0x56')]?_0x2496cb['attach']:_0x48e30e[_0x1841('0x29')][_0x1841('0x19')][_0x1841('0x56')],'substatus':null,'substatusAt':moment()[_0x1841('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x1841('0x4e')](_0x1841('0x57')),'lastMsgDirection':'in'});}else{return _0x2496cb;}}})[_0x1841('0x11')](function(_0x4b1cef){_0x17fd1d[_0x1841('0x58')]=_0x4b1cef[_0x1841('0x59')]({'plain':!![]});_0x17fd1d['interaction'][_0x1841('0x5a')]=_0x3b30ac;return db[_0x1841('0x4f')][_0x1841('0x49')]({'body':_0x48e30e[_0x1841('0x29')][_0x1841('0x29')],'MailAccountId':_0x48e30e['account']['id'],'MailInteractionId':_0x4b1cef['id'],'direction':'in','ContactId':_0x17fd1d['contact']['id'],'messageId':_0x48e30e[_0x1841('0x29')]['message'][_0x1841('0x4c')],'from':_0x48e30e[_0x1841('0x29')][_0x1841('0x19')][_0x1841('0x31')],'to':_0x48e30e[_0x1841('0x29')][_0x1841('0x19')]['to'],'cc':_0x48e30e[_0x1841('0x29')][_0x1841('0x19')]['cc'],'subject':_0x48e30e[_0x1841('0x29')][_0x1841('0x19')][_0x1841('0x4d')],'attach':_0x48e30e['body'][_0x1841('0x19')][_0x1841('0x56')],'Attachments':_0x48e30e['body']['message'][_0x1841('0x5b')],'originTo':_0x48e30e['body'][_0x1841('0x19')][_0x1841('0x5c')],'originCc':_0x48e30e['body'][_0x1841('0x19')][_0x1841('0x5d')],'bcc':_0x48e30e[_0x1841('0x29')][_0x1841('0x19')][_0x1841('0x5e')],'ChatWebsiteId':_0x48e30e[_0x1841('0x29')][_0x1841('0x19')][_0x1841('0x5f')]||null,'originChannel':_0x48e30e[_0x1841('0x29')][_0x1841('0x19')][_0x1841('0x60')]||_0x1841('0x61'),'ChatOfflineMessageId':_0x48e30e['body'][_0x1841('0x19')][_0x1841('0x62')]||null},{'include':[{'model':db['Attachment'],'as':_0x1841('0x63')}]});})['then'](function(_0x481f56){_0x17fd1d[_0x1841('0x19')]=_0x481f56;if(_0x17fd1d['interaction'][_0x1841('0x64')]){return db[_0x1841('0x65')][_0x1841('0x26')]({'attributes':['id',_0x1841('0x66')],'where':{'id':_0x17fd1d[_0x1841('0x58')][_0x1841('0x64')]}})[_0x1841('0x11')](function(_0x5e5492){if(_0x5e5492){_0x17fd1d[_0x1841('0x40')][_0x1841('0x67')]({'id':0x0,'priority':0x0,'app':_0x1841('0x68'),'appdata':_0x5e5492['name']+','+(_0x17fd1d[_0x1841('0x36')][_0x1841('0x69')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1841('0x6a'),_0x1841('0x6b'),_0x17fd1d);});}return respondWithRpcPromise(_0x1841('0x6a'),_0x1841('0x6b'),_0x17fd1d);})[_0x1841('0x11')](function(_0x49ce07){_0x49d15b(_0x49ce07);})[_0x1841('0x6c')](function(_0x19aa2b){_0x3132eb(_0x5cf9a9[_0x1841('0x17')](0x1f4,_0x19aa2b[_0x1841('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 2c6b611..c4e1361 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 _0x62b8=['./mailAccount.events','save','update','emit','register','length','mailAccount:'];(function(_0x2f0057,_0x448b27){var _0x17f2c3=function(_0x12efc3){while(--_0x12efc3){_0x2f0057['push'](_0x2f0057['shift']());}};_0x17f2c3(++_0x448b27);}(_0x62b8,0x142));var _0x862b=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x62b8[_0x119d5a];return _0x15bff4;};'use strict';var MailAccountEvents=require(_0x862b('0x0'));var events=[_0x862b('0x1'),'remove',_0x862b('0x2')];function createListener(_0x52a853,_0x58ad1d){return function(_0x53d9e8){_0x58ad1d[_0x862b('0x3')](_0x52a853,_0x53d9e8);};}function removeListener(_0x179f02,_0x2dfb4b){return function(){MailAccountEvents['removeListener'](_0x179f02,_0x2dfb4b);};}exports[_0x862b('0x4')]=function(_0x3de814){for(var _0x5c8137=0x0,_0x58aa3b=events[_0x862b('0x5')];_0x5c8137<_0x58aa3b;_0x5c8137++){var _0x301f27=events[_0x5c8137];var _0x2a66d1=createListener(_0x862b('0x6')+_0x301f27,_0x3de814);MailAccountEvents['on'](_0x301f27,_0x2a66d1);}}; \ No newline at end of file +var _0xeae7=['emit','removeListener','register','length','save','remove','update'];(function(_0x3891b0,_0x1a36f3){var _0x44221e=function(_0x55963a){while(--_0x55963a){_0x3891b0['push'](_0x3891b0['shift']());}};_0x44221e(++_0x1a36f3);}(_0xeae7,0x1a1));var _0x7eae=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0xeae7[_0xa1e3ca];return _0x5005ab;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x7eae('0x0'),_0x7eae('0x1'),_0x7eae('0x2')];function createListener(_0x50f398,_0x358d75){return function(_0x2b3e5e){_0x358d75[_0x7eae('0x3')](_0x50f398,_0x2b3e5e);};}function removeListener(_0x31f436,_0x37759f){return function(){MailAccountEvents[_0x7eae('0x4')](_0x31f436,_0x37759f);};}exports[_0x7eae('0x5')]=function(_0x4d8a11){for(var _0x5b33bd=0x0,_0xd01591=events[_0x7eae('0x6')];_0x5b33bd<_0xd01591;_0x5b33bd++){var _0x4acf71=events[_0x5b33bd];var _0x3141b7=createListener('mailAccount:'+_0x4acf71,_0x4d8a11);MailAccountEvents['on'](_0x4acf71,_0x3141b7);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 8a39403..e73c847 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 _0xae7c=['destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete'];(function(_0x3d69f9,_0x24daed){var _0x386964=function(_0x2d04fe){while(--_0x2d04fe){_0x3d69f9['push'](_0x3d69f9['shift']());}};_0x386964(++_0x24daed);}(_0xae7c,0x1ef));var _0xcae7=function(_0x5c32ff,_0x29830e){_0x5c32ff=_0x5c32ff-0x0;var _0x1744b8=_0xae7c[_0x5c32ff];return _0x1744b8;};'use strict';var multer=require(_0xcae7('0x0'));var util=require('util');var path=require(_0xcae7('0x1'));var timeout=require(_0xcae7('0x2'));var express=require(_0xcae7('0x3'));var router=express['Router']();var fs_extra=require(_0xcae7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcae7('0x5'));var config=require(_0xcae7('0x6'));var controller=require(_0xcae7('0x7'));router[_0xcae7('0x8')](_0xcae7('0x9'),auth[_0xcae7('0xa')](),controller[_0xcae7('0xb')]);router[_0xcae7('0xc')](_0xcae7('0x9'),auth[_0xcae7('0xa')](),controller[_0xcae7('0xd')]);router[_0xcae7('0xe')](_0xcae7('0x9'),auth['isAuthenticated'](),controller[_0xcae7('0xf')]);module[_0xcae7('0x10')]=router; \ No newline at end of file +var _0xfd42=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update'];(function(_0x218e18,_0xd11109){var _0x159e42=function(_0x20c85d){while(--_0x20c85d){_0x218e18['push'](_0x218e18['shift']());}};_0x159e42(++_0xd11109);}(_0xfd42,0x68));var _0x2fd4=function(_0x2f384c,_0x36a291){_0x2f384c=_0x2f384c-0x0;var _0x1acc94=_0xfd42[_0x2f384c];return _0x1acc94;};'use strict';var multer=require(_0x2fd4('0x0'));var util=require(_0x2fd4('0x1'));var path=require('path');var timeout=require(_0x2fd4('0x2'));var express=require(_0x2fd4('0x3'));var router=express[_0x2fd4('0x4')]();var fs_extra=require(_0x2fd4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2fd4('0x6'));var config=require(_0x2fd4('0x7'));var controller=require(_0x2fd4('0x8'));router[_0x2fd4('0x9')](_0x2fd4('0xa'),auth[_0x2fd4('0xb')](),controller[_0x2fd4('0xc')]);router[_0x2fd4('0xd')]('/:id',auth[_0x2fd4('0xb')](),controller[_0x2fd4('0xe')]);router['delete'](_0x2fd4('0xa'),auth[_0x2fd4('0xb')](),controller[_0x2fd4('0xf')]);module[_0x2fd4('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 62f1828..a4d29b6 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 _0x702c=['noop','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x5bb6f2,_0x2ee4eb){var _0xf5b571=function(_0xa801b3){while(--_0xa801b3){_0x5bb6f2['push'](_0x5bb6f2['shift']());}};_0xf5b571(++_0x2ee4eb);}(_0x702c,0x112));var _0xc702=function(_0x339202,_0x409b45){_0x339202=_0x339202-0x0;var _0x365e0b=_0x702c[_0x339202];return _0x365e0b;};'use strict';var Sequelize=require(_0xc702('0x0'));module[_0xc702('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc702('0x2')},'appdata':{'type':Sequelize[_0xc702('0x3')]()},'description':{'type':Sequelize[_0xc702('0x4')]},'interval':{'type':Sequelize[_0xc702('0x4')],'defaultValue':_0xc702('0x5')}}; \ No newline at end of file +var _0xe5f0=['sequelize','exports','INTEGER','STRING'];(function(_0x339604,_0x6c0775){var _0x3dbde0=function(_0x28a1f9){while(--_0x28a1f9){_0x339604['push'](_0x339604['shift']());}};_0x3dbde0(++_0x6c0775);}(_0xe5f0,0xa8));var _0x0e5f=function(_0x4cd6cb,_0x3f4157){_0x4cd6cb=_0x4cd6cb-0x0;var _0x13b46f=_0xe5f0[_0x4cd6cb];return _0x13b46f;};'use strict';var Sequelize=require(_0x0e5f('0x0'));module[_0x0e5f('0x1')]={'priority':{'type':Sequelize[_0x0e5f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0e5f('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0e5f('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 41befa9..06e7c80 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 _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x55695c,_0x1b581f){var _0xe22b98=function(_0x2faf57){while(--_0x2faf57){_0x55695c['push'](_0x55695c['shift']());}};_0xe22b98(++_0x1b581f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3ad6e3,_0x3ca9fa){_0x3ad6e3=_0x3ad6e3-0x0;var _0x3f4dbd=_0xb43b[_0x3ad6e3];return _0x3f4dbd;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file +var _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x4c9c5b,_0x210cbb){var _0x4088ab=function(_0x3f1d0a){while(--_0x3f1d0a){_0x4c9c5b['push'](_0x4c9c5b['shift']());}};_0x4088ab(++_0x210cbb);}(_0xe706,0xa3));var _0x6e70=function(_0x2fab67,_0x510e24){_0x2fab67=_0x2fab67-0x0;var _0x3b0237=_0xe706[_0x2fab67];return _0x3b0237;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['MailApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 37d52b7..7e5fe6d 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 _0xe813=['api','moment','request-promise','path','../../config/environment','./mailApplication.attributes','define','mail_applications','utf8mb4_unicode_ci','util'];(function(_0x109070,_0x326fad){var _0x31b9bb=function(_0x2b757a){while(--_0x2b757a){_0x109070['push'](_0x109070['shift']());}};_0x31b9bb(++_0x326fad);}(_0xe813,0xdb));var _0x3e81=function(_0x1bc445,_0x2d6fe0){_0x1bc445=_0x1bc445-0x0;var _0x589e6b=_0xe813[_0x1bc445];return _0x589e6b;};'use strict';var _=require('lodash');var util=require(_0x3e81('0x0'));var logger=require('../../config/logger')(_0x3e81('0x1'));var moment=require(_0x3e81('0x2'));var BPromise=require('bluebird');var rp=require(_0x3e81('0x3'));var fs=require('fs');var path=require(_0x3e81('0x4'));var rimraf=require('rimraf');var config=require(_0x3e81('0x5'));var attributes=require(_0x3e81('0x6'));module['exports']=function(_0x5ef5cc,_0x2f81a1){return _0x5ef5cc[_0x3e81('0x7')]('MailApplication',attributes,{'tableName':_0x3e81('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3e81('0x9')});}; \ No newline at end of file +var _0x6ee8=['api','moment','bluebird','request-promise','rimraf','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash'];(function(_0x3aae15,_0x3a7457){var _0x42bd66=function(_0xefa01c){while(--_0xefa01c){_0x3aae15['push'](_0x3aae15['shift']());}};_0x42bd66(++_0x3a7457);}(_0x6ee8,0x6d));var _0x86ee=function(_0x1470a8,_0x49c3da){_0x1470a8=_0x1470a8-0x0;var _0x4bb523=_0x6ee8[_0x1470a8];return _0x4bb523;};'use strict';var _=require(_0x86ee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x86ee('0x1'));var moment=require(_0x86ee('0x2'));var BPromise=require(_0x86ee('0x3'));var rp=require(_0x86ee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86ee('0x5'));var config=require('../../config/environment');var attributes=require(_0x86ee('0x6'));module[_0x86ee('0x7')]=function(_0x57ef7d,_0x1e3c07){return _0x57ef7d['define'](_0x86ee('0x8'),attributes,{'tableName':_0x86ee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x86ee('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index e995967..50f668c 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 _0xb745=['limit','UpdateMailApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','update','body','options','raw','where','attributes'];(function(_0x560a0d,_0x3f2fe2){var _0x1474eb=function(_0x3da663){while(--_0x3da663){_0x560a0d['push'](_0x560a0d['shift']());}};_0x1474eb(++_0x3f2fe2);}(_0xb745,0x198));var _0x5b74=function(_0x558414,_0x58ea6e){_0x558414=_0x558414-0x0;var _0x343829=_0xb745[_0x558414];return _0x343829;};'use strict';var _=require(_0x5b74('0x0'));var util=require(_0x5b74('0x1'));var moment=require(_0x5b74('0x2'));var BPromise=require(_0x5b74('0x3'));var rs=require(_0x5b74('0x4'));var fs=require('fs');var Redis=require(_0x5b74('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5b74('0x6'))('rpc');var config=require(_0x5b74('0x7'));var jayson=require(_0x5b74('0x8'));var client=jayson[_0x5b74('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54428d,_0x132c72,_0x57d540){return new BPromise(function(_0x1c9f49,_0x521a30){return client['request'](_0x54428d,_0x57d540)[_0x5b74('0xa')](function(_0x3bb7fe){logger['info'](_0x5b74('0xb'),_0x132c72,_0x5b74('0xc'));logger[_0x5b74('0xd')](_0x5b74('0xe'),_0x132c72,_0x5b74('0xc'),JSON[_0x5b74('0xf')](_0x3bb7fe));if(_0x3bb7fe[_0x5b74('0x10')]){if(_0x3bb7fe[_0x5b74('0x10')][_0x5b74('0x11')]===0x1f4){logger['error'](_0x5b74('0xb'),_0x132c72,_0x3bb7fe['error'][_0x5b74('0x12')]);return _0x521a30(_0x3bb7fe[_0x5b74('0x10')][_0x5b74('0x12')]);}logger[_0x5b74('0x10')](_0x5b74('0xb'),_0x132c72,_0x3bb7fe['error']['message']);return _0x1c9f49(_0x3bb7fe[_0x5b74('0x10')][_0x5b74('0x12')]);}else{logger[_0x5b74('0x13')]('MailApplication,\x20%s,\x20%s',_0x132c72,_0x5b74('0xc'));_0x1c9f49(_0x3bb7fe['result']['message']);}})[_0x5b74('0x14')](function(_0x171e23){logger[_0x5b74('0x10')](_0x5b74('0xb'),_0x132c72,_0x171e23);_0x521a30(_0x171e23);});});}exports['UpdateMailApplication']=function(_0x46b2e8){var _0x26a4a8=this;return new Promise(function(_0x4dcf98,_0x21fa4d){return db['MailApplication'][_0x5b74('0x15')](_0x46b2e8[_0x5b74('0x16')],{'raw':_0x46b2e8[_0x5b74('0x17')]?_0x46b2e8[_0x5b74('0x17')][_0x5b74('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46b2e8['options']?_0x46b2e8['options'][_0x5b74('0x19')]||null:null,'attributes':_0x46b2e8[_0x5b74('0x17')]?_0x46b2e8[_0x5b74('0x17')][_0x5b74('0x1a')]||null:null,'limit':_0x46b2e8[_0x5b74('0x17')]?_0x46b2e8[_0x5b74('0x17')][_0x5b74('0x1b')]||null:null})[_0x5b74('0xa')](function(_0x188233){logger[_0x5b74('0x13')](_0x5b74('0x1c'),_0x46b2e8);logger[_0x5b74('0xd')]('UpdateMailApplication',_0x46b2e8,JSON[_0x5b74('0xf')](_0x188233));_0x4dcf98(_0x188233);})[_0x5b74('0x14')](function(_0x541983){logger[_0x5b74('0x10')]('UpdateMailApplication',_0x541983[_0x5b74('0x12')],_0x46b2e8);_0x21fa4d(_0x26a4a8['error'](0x1f4,_0x541983[_0x5b74('0x12')]));});});}; \ No newline at end of file +var _0x6353=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailApplication,\x20%s,\x20%s','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','lodash','util'];(function(_0x1591b0,_0x31909f){var _0x29c8de=function(_0x2f629f){while(--_0x2f629f){_0x1591b0['push'](_0x1591b0['shift']());}};_0x29c8de(++_0x31909f);}(_0x6353,0x166));var _0x3635=function(_0x177c61,_0x26ba86){_0x177c61=_0x177c61-0x0;var _0x188e75=_0x6353[_0x177c61];return _0x188e75;};'use strict';var _=require(_0x3635('0x0'));var util=require(_0x3635('0x1'));var moment=require(_0x3635('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3635('0x3'));var db=require(_0x3635('0x4'))['db'];var utils=require(_0x3635('0x5'));var logger=require(_0x3635('0x6'))('rpc');var config=require(_0x3635('0x7'));var jayson=require(_0x3635('0x8'));var client=jayson[_0x3635('0x9')][_0x3635('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x314d7a,_0x1a33ab,_0xf02bcd){return new BPromise(function(_0x33a3d7,_0x6b1db9){return client[_0x3635('0xb')](_0x314d7a,_0xf02bcd)[_0x3635('0xc')](function(_0x1a4398){logger[_0x3635('0xd')]('MailApplication,\x20%s,\x20%s',_0x1a33ab,_0x3635('0xe'));logger[_0x3635('0xf')](_0x3635('0x10'),_0x1a33ab,_0x3635('0xe'),JSON[_0x3635('0x11')](_0x1a4398));if(_0x1a4398[_0x3635('0x12')]){if(_0x1a4398[_0x3635('0x12')][_0x3635('0x13')]===0x1f4){logger[_0x3635('0x12')]('MailApplication,\x20%s,\x20%s',_0x1a33ab,_0x1a4398[_0x3635('0x12')]['message']);return _0x6b1db9(_0x1a4398[_0x3635('0x12')][_0x3635('0x14')]);}logger['error'](_0x3635('0x15'),_0x1a33ab,_0x1a4398[_0x3635('0x12')][_0x3635('0x14')]);return _0x33a3d7(_0x1a4398['error'][_0x3635('0x14')]);}else{logger[_0x3635('0xd')](_0x3635('0x15'),_0x1a33ab,'request\x20sent');_0x33a3d7(_0x1a4398['result'][_0x3635('0x14')]);}})[_0x3635('0x16')](function(_0x5c76e4){logger[_0x3635('0x12')](_0x3635('0x15'),_0x1a33ab,_0x5c76e4);_0x6b1db9(_0x5c76e4);});});}exports[_0x3635('0x17')]=function(_0x49abe8){var _0x545166=this;return new Promise(function(_0x1f5f4b,_0x55bfbf){return db[_0x3635('0x18')][_0x3635('0x19')](_0x49abe8[_0x3635('0x1a')],{'raw':_0x49abe8[_0x3635('0x1b')]?_0x49abe8[_0x3635('0x1b')][_0x3635('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49abe8[_0x3635('0x1b')]?_0x49abe8[_0x3635('0x1b')][_0x3635('0x1d')]||null:null,'attributes':_0x49abe8[_0x3635('0x1b')]?_0x49abe8[_0x3635('0x1b')]['attributes']||null:null,'limit':_0x49abe8['options']?_0x49abe8[_0x3635('0x1b')]['limit']||null:null})[_0x3635('0xc')](function(_0x24e8e8){logger[_0x3635('0xd')](_0x3635('0x17'),_0x49abe8);logger[_0x3635('0xf')](_0x3635('0x17'),_0x49abe8,JSON['stringify'](_0x24e8e8));_0x1f5f4b(_0x24e8e8);})[_0x3635('0x16')](function(_0x555a53){logger['error'](_0x3635('0x17'),_0x555a53[_0x3635('0x14')],_0x49abe8);_0x55bfbf(_0x545166['error'](0x1f4,_0x555a53[_0x3635('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 6b71b5e..bece375 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 _0x5d7b=['./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','tracked','mailinteraction:addtags','addTags','put','mail','update','delete','mailinteraction:destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3a7116,_0xa08349){var _0x5b53bb=function(_0x1ed39f){while(--_0x1ed39f){_0x3a7116['push'](_0x3a7116['shift']());}};_0x5b53bb(++_0xa08349);}(_0x5d7b,0x1e2));var _0xb5d7=function(_0x4f8cba,_0x51d42b){_0x4f8cba=_0x4f8cba-0x0;var _0xe240a6=_0x5d7b[_0x4f8cba];return _0xe240a6;};'use strict';var express=require(_0xb5d7('0x0'));var router=express[_0xb5d7('0x1')]();var auth=require(_0xb5d7('0x2'));var interaction=require(_0xb5d7('0x3'));var controller=require(_0xb5d7('0x4'));router[_0xb5d7('0x5')]('/',auth[_0xb5d7('0x6')](),controller[_0xb5d7('0x7')]);router['get'](_0xb5d7('0x8'),auth['isAuthenticated'](),controller[_0xb5d7('0x9')]);router[_0xb5d7('0x5')](_0xb5d7('0xa'),auth[_0xb5d7('0x6')](),controller[_0xb5d7('0xb')]);router['get']('/:id/messages',auth[_0xb5d7('0x6')](),controller[_0xb5d7('0xc')]);router[_0xb5d7('0x5')](_0xb5d7('0xd'),auth['isAuthenticated'](),controller[_0xb5d7('0xe')]);router[_0xb5d7('0xf')]('/',auth[_0xb5d7('0x6')](),controller[_0xb5d7('0x10')]);router['post'](_0xb5d7('0x11'),auth['isAuthenticated'](),controller['addMessage']);router[_0xb5d7('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xb5d7('0x12')]('mail',_0xb5d7('0x13')),controller[_0xb5d7('0x14')]);router[_0xb5d7('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0xb5d7('0x12')](_0xb5d7('0x16'),'mailinteraction:update'),controller[_0xb5d7('0x17')]);router[_0xb5d7('0x18')](_0xb5d7('0xa'),auth[_0xb5d7('0x6')](),interaction[_0xb5d7('0x12')](_0xb5d7('0x16'),_0xb5d7('0x19')),controller['destroy']);router[_0xb5d7('0x18')]('/:id/tags',auth[_0xb5d7('0x6')](),controller['removeTags']);module[_0xb5d7('0x1a')]=router; \ No newline at end of file +var _0x04dd=['Router','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','mail','mailinteraction:update','update','delete','/:id','mailinteraction:destroy','destroy','removeTags','exports'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x04dd,0x196));var _0xd04d=function(_0x4dbcd6,_0x34326c){_0x4dbcd6=_0x4dbcd6-0x0;var _0x541e55=_0x04dd[_0x4dbcd6];return _0x541e55;};'use strict';var express=require('express');var router=express[_0xd04d('0x0')]();var auth=require(_0xd04d('0x1'));var interaction=require(_0xd04d('0x2'));var controller=require('./mailInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd04d('0x3')]);router[_0xd04d('0x4')](_0xd04d('0x5'),auth[_0xd04d('0x6')](),controller[_0xd04d('0x7')]);router[_0xd04d('0x4')]('/:id',auth[_0xd04d('0x6')](),controller[_0xd04d('0x8')]);router[_0xd04d('0x4')](_0xd04d('0x9'),auth['isAuthenticated'](),controller[_0xd04d('0xa')]);router['get']('/:id/download',auth[_0xd04d('0x6')](),controller[_0xd04d('0xb')]);router[_0xd04d('0xc')]('/',auth[_0xd04d('0x6')](),controller[_0xd04d('0xd')]);router[_0xd04d('0xc')](_0xd04d('0x9'),auth[_0xd04d('0x6')](),controller[_0xd04d('0xe')]);router[_0xd04d('0xc')](_0xd04d('0xf'),auth[_0xd04d('0x6')](),interaction[_0xd04d('0x10')]('mail',_0xd04d('0x11')),controller[_0xd04d('0x12')]);router[_0xd04d('0x13')]('/:id',auth['isAuthenticated'](),interaction[_0xd04d('0x10')](_0xd04d('0x14'),_0xd04d('0x15')),controller[_0xd04d('0x16')]);router[_0xd04d('0x17')](_0xd04d('0x18'),auth[_0xd04d('0x6')](),interaction[_0xd04d('0x10')](_0xd04d('0x14'),_0xd04d('0x19')),controller[_0xd04d('0x1a')]);router[_0xd04d('0x17')]('/:id/tags',auth[_0xd04d('0x6')](),controller[_0xd04d('0x1b')]);module[_0xd04d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index d1fe9e0..d565e23 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 _0xfdc4=['ENUM','sequelize','BOOLEAN','DATE','STRING','TEXT','long','out'];(function(_0x1d6fb5,_0x431d48){var _0x24bded=function(_0x5b7a7e){while(--_0x5b7a7e){_0x1d6fb5['push'](_0x1d6fb5['shift']());}};_0x24bded(++_0x431d48);}(_0xfdc4,0x81));var _0x4fdc=function(_0x3bcfc1,_0x5c6979){_0x3bcfc1=_0x3bcfc1-0x0;var _0x270cea=_0xfdc4[_0x3bcfc1];return _0x270cea;};'use strict';var Sequelize=require(_0x4fdc('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x4fdc('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4fdc('0x2')]},'disposition':{'type':Sequelize[_0x4fdc('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4fdc('0x3')]},'note':{'type':Sequelize[_0x4fdc('0x3')]},'inReplyTo':{'type':Sequelize[_0x4fdc('0x3')](0x1fe)},'to':{'type':Sequelize[_0x4fdc('0x3')]},'cc':{'type':Sequelize[_0x4fdc('0x4')](_0x4fdc('0x5'))},'subject':{'type':Sequelize[_0x4fdc('0x4')]()},'attach':{'type':Sequelize[_0x4fdc('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x4fdc('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x4fdc('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4fdc('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4fdc('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4fdc('0x7')]('in',_0x4fdc('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8bc2=['out','ENUM','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0x382201,_0x3f8f89){var _0xb375ea=function(_0x1356ef){while(--_0x1356ef){_0x382201['push'](_0x382201['shift']());}};_0xb375ea(++_0x3f8f89);}(_0x8bc2,0x7a));var _0x28bc=function(_0x1a74ed,_0x4b4239){_0x1a74ed=_0x1a74ed-0x0;var _0xe2527=_0x8bc2[_0x1a74ed];return _0xe2527;};'use strict';var Sequelize=require(_0x28bc('0x0'));var iconv=require(_0x28bc('0x1'));module[_0x28bc('0x2')]={'closed':{'type':Sequelize[_0x28bc('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x28bc('0x4')]},'disposition':{'type':Sequelize[_0x28bc('0x5')]},'secondDisposition':{'type':Sequelize[_0x28bc('0x5')]},'thirdDisposition':{'type':Sequelize[_0x28bc('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x28bc('0x5')]},'cc':{'type':Sequelize[_0x28bc('0x6')](_0x28bc('0x7'))},'subject':{'type':Sequelize[_0x28bc('0x6')]()},'attach':{'type':Sequelize[_0x28bc('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x28bc('0x4')]},'substatus':{'type':Sequelize[_0x28bc('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x28bc('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x28bc('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x28bc('0x9')]('in',_0x28bc('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x28bc('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index b325e60..9f7d658 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 _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x16652e,_0x28a210){var _0x31d01e=function(_0x401ad8){while(--_0x401ad8){_0x16652e['push'](_0x16652e['shift']());}};_0x31d01e(++_0x28a210);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_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');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file +var _0xb10b=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','show','params','rawAttributes','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','-id','trimStart','plainBody','catch','index','map','MailInteraction','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','field','color','tools_tags','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_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.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','Contact.firstName','c.email'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xb10b,0x12a));var _0xbb10=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0xb10b[_0x4bc4c8];return _0x3bb121;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var BPromise=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var fs=require('fs');var _=require(_0xbb10('0x5'));var squel=require(_0xbb10('0x6'));var juice=require(_0xbb10('0x7'));var Redis=require(_0xbb10('0x8'));var qs=require(_0xbb10('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xbb10('0xa'))(_0xbb10('0xb'));var config=require('../../config/environment');var db=require(_0xbb10('0xc'))['db'];config[_0xbb10('0xd')]=_[_0xbb10('0xe')](config[_0xbb10('0xd')],{'host':_0xbb10('0xf'),'port':0x18eb});var socket=require(_0xbb10('0x10'))(new Redis(config[_0xbb10('0xd')]));require(_0xbb10('0x11'))['register'](socket);function respondWithStatusCode(_0x4e47f8,_0x20bd61){_0x20bd61=_0x20bd61||0xcc;return function(_0x118a74){if(_0x118a74){return _0x4e47f8[_0xbb10('0x12')](_0x20bd61);}return _0x4e47f8['status'](_0x20bd61)[_0xbb10('0x13')]();};}function respondWithResult(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xc8;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x14')](_0x44fb19)[_0xbb10('0x15')](_0x916a32);}};}function respondWithFilteredResult(_0x442548,_0x147230){return function(_0x58a612){if(_0x58a612){var _0x26e021=typeof _0x147230[_0xbb10('0x16')]===_0xbb10('0x17')&&typeof _0x147230[_0xbb10('0x18')]===_0xbb10('0x17');var _0x2f2ebf=_0x58a612[_0xbb10('0x19')];var _0x36b5e8=_0x26e021?0x0:_0x147230[_0xbb10('0x16')];var _0x2b184e=_0x26e021?_0x58a612['count']:_0x147230[_0xbb10('0x16')]+_0x147230[_0xbb10('0x18')];var _0x133ac2;if(_0x2b184e>=_0x2f2ebf){_0x2b184e=_0x2f2ebf;_0x133ac2=0xc8;}else{_0x133ac2=0xce;}_0x442548[_0xbb10('0x14')](_0x133ac2);return _0x442548[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x36b5e8+'-'+_0x2b184e+'/'+_0x2f2ebf)[_0xbb10('0x15')](_0x58a612);}return null;};}function saveUpdates(_0x30efc6){return function(_0xbf2906){if(_0xbf2906){return _0xbf2906[_0xbb10('0x1c')](_0x30efc6)['then'](function(_0x5ff0cf){return _0x5ff0cf;});}return null;};}function removeEntity(_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x1d')]()[_0xbb10('0x1e')](function(){_0x19f48d[_0xbb10('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f888){return function(_0x12ef77){if(!_0x12ef77){_0x12f888['sendStatus'](0x194);}return _0x12ef77;};}function handleError(_0x4c4b0d,_0x8e2b97){_0x8e2b97=_0x8e2b97||0x1f4;return function(_0x311abe){logger[_0xbb10('0x1f')](_0x311abe[_0xbb10('0x20')]);if(_0x311abe[_0xbb10('0x21')]){delete _0x311abe[_0xbb10('0x21')];}_0x4c4b0d[_0xbb10('0x14')](_0x8e2b97)[_0xbb10('0x22')](_0x311abe);};}function getInteractionUsers(_0x7f2377,_0x395404){return new BPromise(function(_0x3ba6cd,_0x26ad93){try{if(_0x395404[_0x7f2377['id']]){_0x7f2377['Users']=_['map'](_0x395404[_0x7f2377['id']],function(_0x4fb5e0){return{'id':_0x4fb5e0['id'],'fullname':_0x4fb5e0[_0xbb10('0x23')]};});}}catch(_0x3c5ae7){_0x26ad93(_0x3c5ae7);}_0x3ba6cd(_0x7f2377);});}function getInteractionTags(_0x2c89b9,_0x4e25ff){return new BPromise(function(_0x2fdde9,_0x24d586){try{if(_0x2c89b9[_0xbb10('0x24')]){_0x2c89b9[_0xbb10('0x25')]=[];_0x2c89b9[_0xbb10('0x24')][_0xbb10('0x26')](',')[_0xbb10('0x27')](function(_0x4aabb9){_0x2c89b9[_0xbb10('0x25')][_0xbb10('0x28')](_0x4e25ff[_0x4aabb9]);});}delete _0x2c89b9[_0xbb10('0x24')];}catch(_0x2e0249){_0x24d586(_0x2e0249);}_0x2fdde9(_0x2c89b9);});}function getLastMessageText(_0x1d30aa){return new BPromise(function(_0x2ff4c1,_0x5d5c80){return db[_0xbb10('0x29')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1d30aa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbb10('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xbb10('0x2b'),'raw':!![]})[_0xbb10('0x1e')](function(_0x1b59f9){if(_0x1b59f9&&_0x1b59f9['plainBody']){_0x1d30aa['lastMsgText']=_[_0xbb10('0x2c')](_0x1b59f9[_0xbb10('0x2d')]);}_0x2ff4c1(_0x1d30aa);})['catch'](function(_0x359ad4){_0x5d5c80(_0x359ad4);});});}function updateMailInteraction(_0x37dde7,_0x2f653f,_0x1c0b57,_0x37a83f){return new BPromise(function(_0x138bc6,_0xf85197){return getInteractionUsers(_0x37dde7,_0x1c0b57)['then'](function(_0x25acb3){return getInteractionTags(_0x25acb3,_0x2f653f);})[_0xbb10('0x1e')](function(_0x441d15){if(_0x37a83f){_0x138bc6(getLastMessageText(_0x441d15));}else{_0x138bc6(_0x441d15);}})[_0xbb10('0x2e')](function(_0xfb2c5e){_0xf85197(_0xfb2c5e);});});}exports[_0xbb10('0x2f')]=function(_0x188cbd,_0x10202c){var _0x3c8d7d={},_0x56943c={},_0x2b5352={'count':0x0,'rows':[]};var _0x150107=_[_0xbb10('0x30')](db[_0xbb10('0x31')]['rawAttributes'],function(_0x111762){return{'name':_0x111762['fieldName'],'type':_0x111762['type'][_0xbb10('0x32')]};});_0x56943c[_0xbb10('0x33')]=_[_0xbb10('0x30')](_0x150107,_0xbb10('0x21'));_0x56943c[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x188cbd['query']);_0x56943c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x56943c['model'],_0x56943c['query']);_0x3c8d7d['attributes']=_[_0xbb10('0x37')](_0x56943c[_0xbb10('0x33')],qs[_0xbb10('0x38')](_0x188cbd['query'][_0xbb10('0x38')]));_0x3c8d7d[_0xbb10('0x39')]=_0x3c8d7d[_0xbb10('0x39')]['length']?_0x3c8d7d[_0xbb10('0x39')]:_0x56943c[_0xbb10('0x33')];if(!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3a')]('nolimit')){_0x3c8d7d[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x188cbd['query'][_0xbb10('0x18')]);_0x3c8d7d[_0xbb10('0x16')]=qs[_0xbb10('0x16')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x16')]);}_0x3c8d7d[_0xbb10('0x3b')]=qs['sort'](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x3c8d7d[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x188cbd[_0xbb10('0x34')],_0x56943c[_0xbb10('0x36')]),_0x150107);var _0x23dc18=[];var _0x403beb=squel['select']()[_0xbb10('0x3e')]('id')[_0xbb10('0x3e')]('name')['field'](_0xbb10('0x3f'))['from'](_0xbb10('0x40'));var _0x180933=squel['select']()[_0xbb10('0x3e')](_0xbb10('0x41'))[_0xbb10('0x3e')]('u.fullname')[_0xbb10('0x3e')](_0xbb10('0x42'))[_0xbb10('0x43')](_0xbb10('0x44'),'ui')[_0xbb10('0x45')](_0xbb10('0x46'),'u',_0xbb10('0x47'));var _0x3efa96=squel[_0xbb10('0x48')]()[_0xbb10('0x43')](_0xbb10('0x49'),'i')[_0xbb10('0x45')]('cm_contacts','c',_0xbb10('0x4a'))[_0xbb10('0x45')]('users','o',_0xbb10('0x4b'))[_0xbb10('0x45')](_0xbb10('0x4c'),'a',_0xbb10('0x4d'))[_0xbb10('0x45')](_0xbb10('0x4e'),'me',_0xbb10('0x4f'))['left_join']('mail_interaction_has_tags','it',_0xbb10('0x50'))[_0xbb10('0x45')](_0xbb10('0x40'),'t','t.id\x20=\x20it.TagId');var _0x5f0c12=squel[_0xbb10('0x51')]();var _0x34cf4e=[];var _0x1bd054=squel[_0xbb10('0x51')]();var _0x10159b;if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]){_0x10159b=as[_0xbb10('0x53')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]);var _0x550111=_0x10159b['sqlOperator'];for(var _0x412e13=0x0;_0x412e13<_0x10159b[_0xbb10('0x54')][_0xbb10('0x55')];_0x412e13++){var _0xb014b0=_0x10159b[_0xbb10('0x54')][_0x412e13];var _0x440f9e='i';var _0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),_0xb014b0[_0xbb10('0x3e')]]);if(!_0x358e7e){switch(_0xb014b0[_0xbb10('0x3e')]){case _0xbb10('0x57'):if(_0xb014b0[_0xbb10('0x58')]==0x1){_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0[_0xbb10('0x3e')]+'`\x20=\x200');}else{_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0['field']+_0xbb10('0x5a'));}break;case _0xbb10('0x5b'):if(_0xb014b0[_0xbb10('0x5c')]===_0xbb10('0x5d')){if(_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')]('\x20')[_0xbb10('0x55')]>0x1){_0x5f0c12[_0x550111](_0xbb10('0x5e'),qs[_0xbb10('0x5f')](_0xb014b0[_0xbb10('0x58')]),null);}else{var _0x44a056='%'+_0xb014b0[_0xbb10('0x58')]+'%';_0x5f0c12[_0x550111](_0xbb10('0x60'),_0x44a056,_0x44a056,_0x44a056);}}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'ContactId']);_0xb014b0[_0xbb10('0x3e')]=_0xbb10('0x61');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')]['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);}break;case _0xbb10('0x65'):var _0x14fed3=_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')](',')[_0xbb10('0x30')](function(_0x12ec18){return Number(_0x12ec18);});_0x14fed3[_0xbb10('0x27')](function(_0x40c4fb){_0x1bd054['or'](_0xbb10('0x66'),'%,'+_0x40c4fb+',%');});_0x34cf4e=_[_0xbb10('0x67')](_0x34cf4e,_0x14fed3);break;case _0xbb10('0x68'):if(_0xb014b0['operator']==='$substring'){_0x5f0c12[_0x550111](_0xbb10('0x69'),'%'+_0xb014b0[_0xbb10('0x58')]+'%',null);}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'UserId']);_0xb014b0['field']=_0xbb10('0x6a');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}break;case _0xbb10('0x2d'):_0x155dc5=as[_0xbb10('0x62')]('me',null,_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5['value']['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);break;}}else{var _0x155dc5=as['buildExpression'](_0x440f9e,_0x358e7e['type'],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}}}else{var _0xa1bbd9=_(_0x188cbd[_0xbb10('0x34')])['keys']()['map'](function(_0x27d7b9){return _[_0xbb10('0x6c')](_0x150107,[_0xbb10('0x21'),_0x27d7b9])?_0x27d7b9:undefined;})[_0xbb10('0x6d')]()['value']();if(!_[_0xbb10('0x6e')](_0xa1bbd9)){_0xa1bbd9[_0xbb10('0x27')](function(_0xa7179d){if(_0xa7179d==='MailAccountId'){_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),[][_0xbb10('0x70')](_0x188cbd['query'][_0xa7179d]));}else if(_0xa7179d===_0xbb10('0x71')){var _0x31e85e=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])['$gte'];var _0x251417=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])[_0xbb10('0x73')];_0x3efa96['where'](_0xbb10('0x74'),_0x31e85e,_0x251417);}else{if(_0x188cbd[_0xbb10('0x34')][_0xa7179d]===_0xbb10('0x75')){_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x76'));}else{_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x77'),_0x188cbd['query'][_0xa7179d]);}}});}if(_0x188cbd['query']['read']){if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x78')]==0x1){_0x3efa96[_0xbb10('0x59')]('`unreadMessages`\x20=\x200');}else{_0x3efa96['having'](_0xbb10('0x79'));}}if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]){_0x34cf4e=_[_0xbb10('0x7b')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')])?_0x188cbd['query'][_0xbb10('0x7a')]:new Array(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]);_0x34cf4e[_0xbb10('0x27')](function(_0x2aaaa6){_0x1bd054['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2aaaa6+',%');});}if(_0x188cbd['query']['filter']){var _0x329da7=_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7c')][_0xbb10('0x7d')]('\x5c','\x5c\x5c')[_0xbb10('0x7d')](/'/g,'\x27\x27');if(qs[_0xbb10('0x7e')](_0x329da7)){_0x5f0c12['or']('i.id\x20LIKE\x20?',_0x329da7+'%');}else if(qs[_0xbb10('0x7f')](_0x329da7)){_0x5f0c12['or']('c.email\x20LIKE\x20?',_0x329da7+'%');}else{_0x5f0c12['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x329da7))['or'](_0xbb10('0x80'),qs[_0xbb10('0x5f')](_0x329da7));}}}_0x3efa96[_0xbb10('0x3d')](_0x5f0c12);_0x3efa96[_0xbb10('0x81')]('i.id');var _0x122d38={'type':db['Sequelize']['QueryTypes'][_0xbb10('0x82')],'raw':!![]};var _0xfe3db0=_0x3efa96[_0xbb10('0x83')]();_0xfe3db0[_0xbb10('0x3e')](_0xbb10('0x84'));_0xfe3db0['field'](_0xbb10('0x85'),_0xbb10('0x57'));if(_0x3c8d7d[_0xbb10('0x3b')]){_0x3c8d7d[_0xbb10('0x3b')][_0xbb10('0x27')](function(_0x27f42f){var _0x174395=_0x27f42f[0x0]==='contactName'?_0x27f42f[0x0]:'i.'+_0x27f42f[0x0];_0x3efa96[_0xbb10('0x3b')](_0x174395,_0x27f42f[0x1]===_0xbb10('0x86')?![]:!![]);});}if(!_[_0xbb10('0x6e')](_0x34cf4e)){_0x3efa96[_0xbb10('0x59')](_0x1bd054);_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x87'),_0x34cf4e);}BPromise[_0xbb10('0x88')]()[_0xbb10('0x1e')](function(){if(!_0x10159b){if(_0x188cbd['query'][_0xbb10('0x89')])return;_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8a'));_0x3efa96['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x188cbd['user'][_0xbb10('0x8b')]!=='agent')return;return _0x188cbd['user'][_0xbb10('0x8c')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x1e')](function(_0x33ff06){if(_[_0xbb10('0x6e')](_0x33ff06)){_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8d'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x8d'));}else{_0xfe3db0[_0xbb10('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0xbb10('0x30')](_0x33ff06,'id'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),_[_0xbb10('0x30')](_0x33ff06,'id'));}});})['then'](function(){if(_0x188cbd['user'][_0xbb10('0x8b')]===_0xbb10('0x8e')&&!_0x10159b&&!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x89')])return[];return db['sequelize'][_0xbb10('0x34')](_0xfe3db0[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0xf7b3e1){_0x2b5352[_0xbb10('0x19')]=_0xf7b3e1['length'];if(_0x2b5352['count']===0x0)return[];return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x403beb[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x256b35){_0x23dc18=_[_0xbb10('0x91')](_0x256b35,'id');_0x122d38=_['merge'](_0x122d38,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x38')]){_0x3c8d7d[_0xbb10('0x39')]['forEach'](function(_0x32d5a5){_0x3efa96[_0xbb10('0x3e')]('i.'+_0x32d5a5);});}else{_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x85'),_0xbb10('0x57'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x92'),_0xbb10('0x93'));_0x3efa96[_0xbb10('0x3e')]('a.mandatoryDisposition',_0xbb10('0x94'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x95'),_0xbb10('0x96'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x84'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x97'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x98'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x99'));_0x3efa96['field']('i.closedAt');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9a'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9b'));_0x3efa96[_0xbb10('0x3e')]('i.lastMsgDirection');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9c'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9d'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9e'));_0x3efa96['field'](_0xbb10('0x9f'));_0x3efa96[_0xbb10('0x3e')]('i.substatus');_0x3efa96[_0xbb10('0x3e')]('i.to');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa0'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa1'));_0x3efa96[_0xbb10('0x3e')]('i.UserId');_0x3efa96[_0xbb10('0x3e')]('c.firstName',_0xbb10('0xa2'));_0x3efa96[_0xbb10('0x3e')]('c.lastName','Contact.lastName');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa3'),_0xbb10('0xa4'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa5'),_0xbb10('0xa6'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa7'),_0xbb10('0xa8'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa9'),'Contact.fax');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xaa'),_0xbb10('0xab'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xac'),_0xbb10('0xad'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xae'),_0xbb10('0x24'));}if(_0x3c8d7d[_0xbb10('0x18')])_0x3efa96[_0xbb10('0x18')](_0x3c8d7d[_0xbb10('0x18')]);if(_0x3c8d7d['offset'])_0x3efa96[_0xbb10('0x16')](_0x3c8d7d['offset']);return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x3efa96[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0x38d369){if(_0x38d369['length']>0x0)_0x180933[_0xbb10('0x3d')](_0xbb10('0xaf'),_[_0xbb10('0x30')](_0x38d369,'id'));return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x180933[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x4bd470){var _0x5cc9d7=_[_0xbb10('0xb0')](_0x4bd470,_0xbb10('0xb1'));var _0x57d5a1=[];return db[_0xbb10('0xb2')][_0xbb10('0xb3')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xbb10('0x1e')](function(_0xaede56){var _0x5642c3=_0xaede56[_0xbb10('0xb4')];_0x38d369['forEach'](function(_0x34cec7){_0x57d5a1[_0xbb10('0x28')](updateMailInteraction(_0x34cec7,_0x23dc18,_0x5cc9d7,_0x5642c3));});return BPromise['all'](_0x57d5a1);});});});})[_0xbb10('0x1e')](function(_0x28cc74){_0x2b5352['rows']=_0x28cc74;return _0x2b5352;})['then'](respondWithFilteredResult(_0x10202c,_0x3c8d7d))[_0xbb10('0x2e')](handleError(_0x10202c,null));};exports[_0xbb10('0xb5')]=function(_0x3e0e34,_0x3299bc){var _0x3ceb77={'raw':![],'where':{'id':_0x3e0e34[_0xbb10('0xb6')]['id']}},_0x4c3bdc={};_0x4c3bdc[_0xbb10('0x33')]=_[_0xbb10('0x35')](db['MailInteraction'][_0xbb10('0xb7')]);_0x4c3bdc[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x3e0e34[_0xbb10('0x34')]);_0x4c3bdc[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x4c3bdc[_0xbb10('0x33')],_0x4c3bdc[_0xbb10('0x34')]);_0x3ceb77[_0xbb10('0x39')]=_['intersection'](_0x4c3bdc['model'],qs[_0xbb10('0x38')](_0x3e0e34[_0xbb10('0x34')][_0xbb10('0x38')]));_0x3ceb77[_0xbb10('0x39')]=_0x3ceb77[_0xbb10('0x39')][_0xbb10('0x55')]?_0x3ceb77[_0xbb10('0x39')]:_0x4c3bdc[_0xbb10('0x33')];if(_0x3e0e34[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x3ceb77[_0xbb10('0xb9')]=[{'all':!![]}];}_0x3ceb77=_[_0xbb10('0xba')]({},_0x3ceb77,_0x3e0e34[_0xbb10('0xbb')]);return db['MailInteraction'][_0xbb10('0x56')](_0x3ceb77)[_0xbb10('0x1e')](handleEntityNotFound(_0x3299bc,null))[_0xbb10('0x1e')](respondWithResult(_0x3299bc,null))[_0xbb10('0x2e')](handleError(_0x3299bc,null));};exports[_0xbb10('0xbc')]=function(_0xd9284e,_0x4258fc){return db[_0xbb10('0x31')][_0xbb10('0xbc')](_0xd9284e[_0xbb10('0xbd')],{})[_0xbb10('0x1e')](respondWithResult(_0x4258fc,0xc9))['catch'](handleError(_0x4258fc,null));};exports[_0xbb10('0x1c')]=function(_0x5e1ac5,_0x3faaca){if(_0x5e1ac5[_0xbb10('0xbd')]['id']){delete _0x5e1ac5[_0xbb10('0xbd')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5e1ac5[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3faaca,null))[_0xbb10('0x1e')](saveUpdates(_0x5e1ac5['body'],null))[_0xbb10('0x1e')](respondWithResult(_0x3faaca,null))[_0xbb10('0x2e')](handleError(_0x3faaca,null));};exports[_0xbb10('0x1d')]=function(_0x576bb6,_0x2b652c){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x576bb6[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2b652c,null))[_0xbb10('0x1e')](removeEntity(_0x2b652c,null))[_0xbb10('0x2e')](handleError(_0x2b652c,null));};exports[_0xbb10('0xbe')]=function(_0x589565,_0x3696b3){return db['MailInteraction'][_0xbb10('0xbe')]()[_0xbb10('0x1e')](respondWithResult(_0x3696b3,null))[_0xbb10('0x2e')](handleError(_0x3696b3,null));};exports[_0xbb10('0xbf')]=function(_0x44c229,_0x40271f){return db[_0xbb10('0x29')]['find']({'where':{'id':_0x44c229[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x40271f,null))['then'](function(_0x1513e0){if(_0x1513e0){return _0x1513e0[_0xbb10('0xbf')](_0x44c229[_0xbb10('0xbd')][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x44c229[_0xbb10('0xbd')],['ids','id'])||{});}})[_0xbb10('0x1e')](respondWithResult(_0x40271f,null))[_0xbb10('0x2e')](handleError(_0x40271f,null));};exports[_0xbb10('0xc2')]=function(_0xb1b7c8,_0x136520){var _0x28127c={'raw':![],'where':{}};var _0x528aff={};var _0xdfdc42={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0xb3')]({'where':{'id':_0xb1b7c8[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x136520,null))[_0xbb10('0x1e')](function(_0x2764e1){if(_0x2764e1){_0x528aff['model']=_[_0xbb10('0x35')](db['MailMessage'][_0xbb10('0xb7')]);_0x528aff['query']=_['keys'](_0xb1b7c8[_0xbb10('0x34')]);_0x528aff[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x528aff[_0xbb10('0x33')],_0x528aff[_0xbb10('0x34')]);_0x28127c['attributes']=_[_0xbb10('0x37')](_0x528aff['model'],qs['fields'](_0xb1b7c8['query'][_0xbb10('0x38')]));_0x28127c[_0xbb10('0x39')]=_0x28127c[_0xbb10('0x39')][_0xbb10('0x55')]?_0x28127c[_0xbb10('0x39')]:_0x528aff['model'];if(!_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3a')](_0xbb10('0xc3'))){_0x28127c[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x18')]);_0x28127c['offset']=qs['offset'](_0xb1b7c8['query'][_0xbb10('0x16')]);}_0x28127c[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x28127c[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_[_0xbb10('0xc4')](_0xb1b7c8[_0xbb10('0x34')],_0x528aff[_0xbb10('0x36')]));_0x28127c['where']['MailInteractionId']=_0x2764e1['id'];if(_0xb1b7c8['query'][_0xbb10('0x7c')]){_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c['where'],{'$or':_[_0xbb10('0x30')](_0x28127c[_0xbb10('0x39')],function(_0x2c638d){var _0x290280={};_0x290280[_0x2c638d]={'$like':'%'+_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x7c')]+'%'};return _0x290280;})});}if(_0xb1b7c8['query']['$gte']){var _0x356660=_0xb1b7c8['query'][_0xbb10('0xc5')][_0xbb10('0x26')](',');var _0x152ca9={};_0x152ca9[_0x356660[0x0]]={'$gte':moment(_0x356660[0x1])[_0xbb10('0xc6')](_0xbb10('0xc7'))};_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c[_0xbb10('0x3d')],_0x152ca9);}_0x28127c=_[_0xbb10('0xba')]({},_0x28127c,_0xb1b7c8[_0xbb10('0xbb')]);return db['MailMessage'][_0xbb10('0x19')]({'where':_0x28127c['where']})[_0xbb10('0x1e')](function(_0x5547fa){_0xdfdc42[_0xbb10('0x19')]=_0x5547fa;if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x28127c[_0xbb10('0xb9')]=[{'all':!![]}];}return db['MailMessage'][_0xbb10('0xc8')](_0x28127c);})['then'](function(_0xfe1154){if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xc9')]==='true'){for(var _0x298167=0x0;_0x298167<_0xfe1154[_0xbb10('0x55')];_0x298167++){_0xfe1154[_0x298167][_0xbb10('0xbd')]=juice(_0xfe1154[_0x298167][_0xbb10('0xbd')]);}}_0xdfdc42[_0xbb10('0xca')]=_0xfe1154;return _0xdfdc42;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x136520,_0x28127c))['catch'](handleError(_0x136520,null));};exports['addTags']=function(_0x522a88,_0x26a752){return db['MailInteraction'][_0xbb10('0x56')]({'where':{'id':_0x522a88['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x26a752,null))[_0xbb10('0x1e')](function(_0x385ad3){if(_0x385ad3){return _0x385ad3['setTags'](_0x522a88['body'][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x522a88[_0xbb10('0xbd')],['ids','id'])||{})[_0xbb10('0xcb')](function(){return db[_0xbb10('0x65')][_0xbb10('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x522a88['body'][_0xbb10('0xc0')]}});})['then'](function(_0x3dfbcd){socket[_0xbb10('0xcc')](_0xbb10('0xcd'),{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]});return{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]};});}})[_0xbb10('0x1e')](respondWithResult(_0x26a752,null))[_0xbb10('0x2e')](handleError(_0x26a752,null));};exports[_0xbb10('0xce')]=function(_0x2746eb,_0x431792){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x2746eb[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x431792,null))['then'](function(_0x14ef50){if(_0x14ef50){return _0x14ef50['removeTags'](_0x2746eb['query'][_0xbb10('0xc0')]);}})[_0xbb10('0x1e')](respondWithStatusCode(_0x431792,null))[_0xbb10('0x2e')](handleError(_0x431792,null));};exports[_0xbb10('0xcf')]=function(_0x99c4,_0x4ca4ce){var _0x161171=moment()[_0xbb10('0xd0')]()['toString']();var _0xa45726=path[_0xbb10('0xd1')](config['root'],_0xbb10('0xd2'),'files',_0xbb10('0xd3'));var _0x8e8049=path[_0xbb10('0xd1')](config[_0xbb10('0xd4')],_0xbb10('0xd2'),_0xbb10('0xd5'),_0xbb10('0xd6'));var _0x56f902=path[_0xbb10('0xd1')](_0xa45726,_0x161171);var _0x4720a1=util[_0xbb10('0xc6')](_0xbb10('0xd7'),_0x99c4[_0xbb10('0xb6')]['id'],_0x161171);var _0x1301e3=path['join'](_0xa45726,_0x4720a1);var _0x550301=[];if(_0x99c4['query'][_0xbb10('0xd6')]){_0x550301[_0xbb10('0x28')]({'model':db[_0xbb10('0xd8')],'as':_0xbb10('0xd9'),'raw':!![]});}var _0x57700b=[{'model':db[_0xbb10('0x29')],'as':_0xbb10('0xda'),'attributes':['id',_0xbb10('0xbd'),'from','to','cc','bcc',_0xbb10('0xdb'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb10('0x3c')]('id'),'include':_0x550301}];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x99c4[_0xbb10('0xb6')]['id']},'include':_0x57700b})[_0xbb10('0x1e')](handleEntityNotFound(_0x4ca4ce,null))[_0xbb10('0x1e')](function(_0x1fe250){if(_0x1fe250&&_0x1fe250['Messages']){var _0x424371=_0x1fe250[_0xbb10('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x56f902);return BPromise[_0xbb10('0xdd')](_0x424371[_0xbb10('0xda')],function(_0x32f261,_0x5b11a2){var _0x4b490a={'from':_0x32f261['from'],'to':_0x32f261['to'],'subject':_0x32f261[_0xbb10('0xdb')],'html':_0x32f261[_0xbb10('0xbd')],'headers':{'Date':moment(_0x32f261['createdAt'])[_0xbb10('0xc6')](_0xbb10('0xde'))},'attachments':[]};if(_0x32f261['cc']){_0x4b490a[_0xbb10('0xdf')]['Cc']=_0x32f261['cc'];}if(_0x32f261[_0xbb10('0xe0')]){_0x4b490a[_0xbb10('0xdf')][_0xbb10('0xe1')]=_0x32f261[_0xbb10('0xe0')];}return new BPromise(function(_0x48f0eb,_0x304603){if(_0x32f261['Attachments']){for(var _0x5a7c4e=0x0;_0x5a7c4e<_0x32f261['Attachments'][_0xbb10('0x55')];_0x5a7c4e++){var _0x572d73=_0x32f261['Attachments'][_0x5a7c4e];var _0x1f09f1=path['join'](_0x8e8049,_0x572d73[_0xbb10('0xe2')]);if(fs[_0xbb10('0xe3')](_0x1f09f1)){_0x4b490a[_0xbb10('0xd6')]['push']({'name':_0x572d73['name'],'contentType':_0x572d73[_0xbb10('0x63')],'data':fs['readFileSync'](_0x1f09f1)});}}}emlformat[_0xbb10('0xe4')](_0x4b490a,function(_0x211172,_0x589ecb){if(_0x211172)return _0x304603(_0x211172);fs['writeFileSync'](path[_0xbb10('0xd1')](_0x56f902,util[_0xbb10('0xc6')](_0xbb10('0xe5'),_0x5b11a2)),_0x589ecb);return _0x48f0eb(_0x589ecb);});});})['then'](function(){return new BPromise(function(_0x4f4aa8,_0x426a4f){zipdir(_0x56f902,{'saveTo':_0x1301e3},function(_0x22f153,_0x4d47cc){if(_0x22f153)return _0x426a4f(_0x22f153);return _0x4f4aa8(_0x4d47cc);});})[_0xbb10('0x1e')](function(){return new BPromise(function(_0x203e5a,_0xe88e90){rimraf(_0x56f902,function(_0x4845b5){if(_0x4845b5)_0xe88e90(_0x4845b5);return _0x203e5a();});});})[_0xbb10('0x1e')](function(){return _0x4ca4ce[_0xbb10('0xcf')](_0x1301e3,_0x4720a1,function(_0x166f4f){if(!_0x166f4f)fs[_0xbb10('0xe6')](_0x1301e3);});});});}else{return _0x4ca4ce[_0xbb10('0x12')](0xc8);}})[_0xbb10('0x2e')](handleError(_0x4ca4ce,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 2fe0994..d0ac488 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 _0x13a3=['MailMessage','setMaxListeners','save','update','remove','Users','map','then','setDataValue','unreadMessages','length','emit','hook','exports','events','../../mysqldb','MailInteraction'];(function(_0x437fd2,_0x32f589){var _0x56de1b=function(_0x4b9cf9){while(--_0x4b9cf9){_0x437fd2['push'](_0x437fd2['shift']());}};_0x56de1b(++_0x32f589);}(_0x13a3,0x162));var _0x313a=function(_0x1d5d39,_0x5388c2){_0x1d5d39=_0x1d5d39-0x0;var _0x5ad1d0=_0x13a3[_0x1d5d39];return _0x5ad1d0;};'use strict';var EventEmitter=require(_0x313a('0x0'));var MailInteraction=require(_0x313a('0x1'))['db'][_0x313a('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x313a('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x313a('0x4')](0x0);var events={'afterCreate':_0x313a('0x5'),'afterUpdate':_0x313a('0x6'),'afterDestroy':_0x313a('0x7')};function emitEvent(_0x8310b1){return function(_0x3c3934,_0x13def8,_0x1eba8a){_0x3c3934['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x493152){_0x3c3934['setDataValue'](_0x313a('0x8'),_0x493152[_0x313a('0x9')](function(_0x24c434){return{'id':_0x24c434['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3c3934['id'],'direction':'in','read':![]},'raw':!![]});})[_0x313a('0xa')](function(_0x5874ed){_0x3c3934[_0x313a('0xb')](_0x313a('0xc'),_0x5874ed[_0x313a('0xd')]);MailInteractionEvents['emit'](_0x8310b1+':'+_0x3c3934['id'],_0x3c3934);MailInteractionEvents[_0x313a('0xe')](_0x8310b1,_0x3c3934);_0x1eba8a(null);})['catch'](_0x1eba8a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x313a('0xf')](e,emitEvent(event));}}module[_0x313a('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0xd93c=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x15ec35,_0x5b9972){var _0x937cce=function(_0x59326b){while(--_0x59326b){_0x15ec35['push'](_0x15ec35['shift']());}};_0x937cce(++_0x5b9972);}(_0xd93c,0x1bd));var _0xcd93=function(_0x1d8363,_0x19e9f2){_0x1d8363=_0x1d8363-0x0;var _0x53cb81=_0xd93c[_0x1d8363];return _0x53cb81;};'use strict';var EventEmitter=require(_0xcd93('0x0'));var MailInteraction=require(_0xcd93('0x1'))['db'][_0xcd93('0x2')];var MailMessage=require(_0xcd93('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xcd93('0x3')](0x0);var events={'afterCreate':_0xcd93('0x4'),'afterUpdate':_0xcd93('0x5'),'afterDestroy':_0xcd93('0x6')};function emitEvent(_0x550762){return function(_0x7cedc5,_0x5d7990,_0x5c5738){_0x7cedc5[_0xcd93('0x7')]({'attributes':['id'],'raw':!![]})[_0xcd93('0x8')](function(_0x19582a){_0x7cedc5[_0xcd93('0x9')](_0xcd93('0xa'),_0x19582a[_0xcd93('0xb')](function(_0x570f2f){return{'id':_0x570f2f['id']};}));return MailMessage[_0xcd93('0xc')]({'where':{'MailInteractionId':_0x7cedc5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcd93('0x8')](function(_0x3cc5de){_0x7cedc5[_0xcd93('0x9')](_0xcd93('0xd'),_0x3cc5de[_0xcd93('0xe')]);MailInteractionEvents[_0xcd93('0xf')](_0x550762+':'+_0x7cedc5['id'],_0x7cedc5);MailInteractionEvents['emit'](_0x550762,_0x7cedc5);_0x5c5738(null);})[_0xcd93('0x10')](_0x5c5738(null));};}for(var e in events){if(events[_0xcd93('0x11')](e)){var event=events[e];MailInteraction[_0xcd93('0x12')](e,emitEvent(event));}}module[_0xcd93('0x13')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 8e2b9ff..ec96338 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 _0x84cb=['request-promise','path','exports','define','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','catch','utf8mb4','utf8mb4_unicode_ci','../../config/logger','bluebird'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0x84cb,0x18a));var _0xb84c=function(_0x5d0818,_0x188411){_0x5d0818=_0x5d0818-0x0;var _0x37fcdb=_0x84cb[_0x5d0818];return _0x37fcdb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb84c('0x0'))('api');var moment=require('moment');var BPromise=require(_0xb84c('0x1'));var rp=require(_0xb84c('0x2'));var fs=require('fs');var path=require(_0xb84c('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0xb84c('0x4')]=function(_0x2e011e,_0x1c8ef6){return _0x2e011e[_0xb84c('0x5')]('MailInteraction',attributes,{'tableName':_0xb84c('0x6'),'paranoid':![],'indexes':[{'name':_0xb84c('0x7'),'fields':['subject','to'],'type':_0xb84c('0x8')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x24cf3f,_0x460952,_0x20caba){if(_0x24cf3f[_0xb84c('0x9')]){_0x24cf3f[_0xb84c('0xa')]=moment()[_0xb84c('0xb')](_0xb84c('0xc'));}if(_0x24cf3f[_0xb84c('0xd')]){_0x24cf3f[_0xb84c('0xe')]=moment()[_0xb84c('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x20caba(null,_0x460952);},'beforeUpdate':function(_0x1784eb,_0x52a6fd,_0xd9b56e){if(_0x1784eb['changed'](_0xb84c('0x9'))){_0x1784eb[_0xb84c('0xa')]=_0x1784eb[_0xb84c('0x9')]?moment()['format'](_0xb84c('0xc')):null;}if(_0x1784eb[_0xb84c('0xf')](_0xb84c('0xd'))){_0x1784eb[_0xb84c('0xe')]=moment()[_0xb84c('0xb')](_0xb84c('0xc'));_0x1784eb[_0xb84c('0x9')]=null;_0x1784eb[_0xb84c('0xa')]=null;}_0xd9b56e(null,_0x1784eb);},'afterUpdate':function(_0x12aaf0,_0xf511c1,_0x14b670){var _0x9950d2=_0x2e011e[_0xb84c('0x10')];var _0x53d17b=_0x12aaf0[_0xb84c('0x11')]({'plain':!![]});if(_0x53d17b[_0xb84c('0xd')]){return _0x9950d2[_0xb84c('0x12')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x53d17b['id']}})['then'](function(){_0x14b670();})[_0xb84c('0x13')](function(_0x280fc1){_0x14b670(_0x280fc1);});}else{_0x14b670();}}},'charset':_0xb84c('0x14'),'collate':_0xb84c('0x15')});}; \ No newline at end of file +var _0x9865=['./mailInteraction.attributes','exports','define','mail_interactions','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','get','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x283b97,_0x2dd687){var _0xe5cbb9=function(_0xaf9f4a){while(--_0xaf9f4a){_0x283b97['push'](_0x283b97['shift']());}};_0xe5cbb9(++_0x2dd687);}(_0x9865,0x197));var _0x5986=function(_0x1e6b98,_0x293196){_0x1e6b98=_0x1e6b98-0x0;var _0x14dfee=_0x9865[_0x1e6b98];return _0x14dfee;};'use strict';var _=require(_0x5986('0x0'));var util=require(_0x5986('0x1'));var logger=require(_0x5986('0x2'))(_0x5986('0x3'));var moment=require(_0x5986('0x4'));var BPromise=require('bluebird');var rp=require(_0x5986('0x5'));var fs=require('fs');var path=require(_0x5986('0x6'));var rimraf=require(_0x5986('0x7'));var config=require(_0x5986('0x8'));var attributes=require(_0x5986('0x9'));module[_0x5986('0xa')]=function(_0xeaa8fe,_0x3f1443){return _0xeaa8fe[_0x5986('0xb')]('MailInteraction',attributes,{'tableName':_0x5986('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3efd88,_0x93ff3d,_0x506d7b){if(_0x3efd88[_0x5986('0xd')]){_0x3efd88[_0x5986('0xe')]=moment()['format'](_0x5986('0xf'));}if(_0x3efd88[_0x5986('0x10')]){_0x3efd88[_0x5986('0x11')]=moment()[_0x5986('0x12')](_0x5986('0xf'));}_0x506d7b(null,_0x93ff3d);},'beforeUpdate':function(_0x545659,_0x23f34f,_0x55257c){if(_0x545659['changed'](_0x5986('0xd'))){_0x545659['substatusAt']=_0x545659[_0x5986('0xd')]?moment()[_0x5986('0x12')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x545659[_0x5986('0x13')]('closed')){_0x545659[_0x5986('0x11')]=moment()['format'](_0x5986('0xf'));_0x545659['substatus']=null;_0x545659[_0x5986('0xe')]=null;}_0x55257c(null,_0x545659);},'afterUpdate':function(_0x4b84d6,_0x424f46,_0xcc598d){var _0x1e436=_0xeaa8fe['models'];var _0x355570=_0x4b84d6[_0x5986('0x14')]({'plain':!![]});if(_0x355570[_0x5986('0x10')]){return _0x1e436['MailMessage'][_0x5986('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x355570['id']}})[_0x5986('0x16')](function(){_0xcc598d();})[_0x5986('0x17')](function(_0x214696){_0xcc598d(_0x214696);});}else{_0xcc598d();}}},'charset':_0x5986('0x18'),'collate':_0x5986('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 2641dd8..d41e039 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 _0x9d35=['result','UpdateMailInteraction','update','options','raw','where','attributes','limit','then','catch','AddTagsToMailInteraction','MailInteraction','find','addTags','body','ids','omit','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5acdd8,_0x5967ef){var _0x159510=function(_0x2fbf37){while(--_0x2fbf37){_0x5acdd8['push'](_0x5acdd8['shift']());}};_0x159510(++_0x5967ef);}(_0x9d35,0x174));var _0x59d3=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x9d35[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x59d3('0x0'));var util=require(_0x59d3('0x1'));var moment=require(_0x59d3('0x2'));var BPromise=require(_0x59d3('0x3'));var rs=require(_0x59d3('0x4'));var fs=require('fs');var Redis=require(_0x59d3('0x5'));var db=require(_0x59d3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x59d3('0x7'))(_0x59d3('0x8'));var config=require(_0x59d3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x59d3('0xa')]['http']({'port':0x232a});config[_0x59d3('0xb')]=_[_0x59d3('0xc')](config[_0x59d3('0xb')],{'host':_0x59d3('0xd'),'port':0x18eb});var socket=require(_0x59d3('0xe'))(new Redis(config[_0x59d3('0xb')]));require('./mailInteraction.socket')[_0x59d3('0xf')](socket);function respondWithRpcPromise(_0x473a07,_0x1ced67,_0x5d3bed){return new BPromise(function(_0xa51251,_0x544dba){return client['request'](_0x473a07,_0x5d3bed)['then'](function(_0x367ff7){logger[_0x59d3('0x10')](_0x59d3('0x11'),_0x1ced67,_0x59d3('0x12'));logger['debug'](_0x59d3('0x13'),_0x1ced67,'request\x20sent',JSON[_0x59d3('0x14')](_0x367ff7));if(_0x367ff7[_0x59d3('0x15')]){if(_0x367ff7[_0x59d3('0x15')][_0x59d3('0x16')]===0x1f4){logger[_0x59d3('0x15')](_0x59d3('0x11'),_0x1ced67,_0x367ff7[_0x59d3('0x15')][_0x59d3('0x17')]);return _0x544dba(_0x367ff7[_0x59d3('0x15')][_0x59d3('0x17')]);}logger[_0x59d3('0x15')](_0x59d3('0x11'),_0x1ced67,_0x367ff7['error'][_0x59d3('0x17')]);return _0xa51251(_0x367ff7[_0x59d3('0x15')][_0x59d3('0x17')]);}else{logger[_0x59d3('0x10')](_0x59d3('0x11'),_0x1ced67,_0x59d3('0x12'));_0xa51251(_0x367ff7[_0x59d3('0x18')]['message']);}})['catch'](function(_0x39fc89){logger[_0x59d3('0x15')](_0x59d3('0x11'),_0x1ced67,_0x39fc89);_0x544dba(_0x39fc89);});});}exports[_0x59d3('0x19')]=function(_0x3035f1){var _0xd4798e=this;return new Promise(function(_0x3d877b,_0x4cdfec){return db['MailInteraction'][_0x59d3('0x1a')](_0x3035f1['body'],{'raw':_0x3035f1[_0x59d3('0x1b')]?_0x3035f1[_0x59d3('0x1b')][_0x59d3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3035f1[_0x59d3('0x1b')]?_0x3035f1['options'][_0x59d3('0x1d')]||null:null,'attributes':_0x3035f1[_0x59d3('0x1b')]?_0x3035f1[_0x59d3('0x1b')][_0x59d3('0x1e')]||null:null,'limit':_0x3035f1['options']?_0x3035f1[_0x59d3('0x1b')][_0x59d3('0x1f')]||null:null})[_0x59d3('0x20')](function(_0xed7842){logger[_0x59d3('0x10')](_0x59d3('0x19'),_0x3035f1);logger['debug']('UpdateMailInteraction',_0x3035f1,JSON[_0x59d3('0x14')](_0xed7842));_0x3d877b(_0xed7842);})[_0x59d3('0x21')](function(_0x5ab4bf){logger[_0x59d3('0x15')](_0x59d3('0x19'),_0x5ab4bf[_0x59d3('0x17')],_0x3035f1);_0x4cdfec(_0xd4798e[_0x59d3('0x15')](0x1f4,_0x5ab4bf[_0x59d3('0x17')]));});});};exports[_0x59d3('0x22')]=function(_0x3d7e10){return new Promise(function(_0x2dce38,_0x378643){return db[_0x59d3('0x23')][_0x59d3('0x24')]({'where':_0x3d7e10[_0x59d3('0x1b')]?_0x3d7e10[_0x59d3('0x1b')][_0x59d3('0x1d')]||null:null})[_0x59d3('0x20')](function(_0x2aa888){if(_0x2aa888){return _0x2aa888[_0x59d3('0x25')](_0x3d7e10[_0x59d3('0x26')][_0x59d3('0x27')],_[_0x59d3('0x28')](_0x3d7e10[_0x59d3('0x26')],[_0x59d3('0x27'),'id'])||{});}})[_0x59d3('0x29')](function(_0x3f4620){logger[_0x59d3('0x10')](_0x59d3('0x2a'),_0x3d7e10);logger[_0x59d3('0x2b')](_0x59d3('0x2a'),_0x3d7e10,JSON[_0x59d3('0x14')](_0x3f4620));_0x2dce38(_0x3f4620);})[_0x59d3('0x21')](function(_0x573c66){logger[_0x59d3('0x15')]('AddTags',_0x573c66['message'],_0x3d7e10);_0x378643(_this['error'](0x1f4,_0x573c66['message']));});});}; \ No newline at end of file +var _0xa8bf=['result','catch','UpdateMailInteraction','update','body','options','raw','where','attributes','limit','then','debug','stringify','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','request','info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','MailInteraction,\x20%s,\x20%s'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0xa8bf,0x1c2));var _0xfa8b=function(_0x2e2a10,_0x55f9f5){_0x2e2a10=_0x2e2a10-0x0;var _0x5ad6cd=_0xa8bf[_0x2e2a10];return _0x5ad6cd;};'use strict';var _=require(_0xfa8b('0x0'));var util=require(_0xfa8b('0x1'));var moment=require(_0xfa8b('0x2'));var BPromise=require(_0xfa8b('0x3'));var rs=require(_0xfa8b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa8b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfa8b('0x6'))(_0xfa8b('0x7'));var config=require('../../config/environment');var jayson=require(_0xfa8b('0x8'));var client=jayson[_0xfa8b('0x9')][_0xfa8b('0xa')]({'port':0x232a});config[_0xfa8b('0xb')]=_['defaults'](config['redis'],{'host':_0xfa8b('0xc'),'port':0x18eb});var socket=require(_0xfa8b('0xd'))(new Redis(config[_0xfa8b('0xb')]));require(_0xfa8b('0xe'))['register'](socket);function respondWithRpcPromise(_0x19ec1b,_0x32f805,_0x5aaa70){return new BPromise(function(_0x113639,_0x2e7ae7){return client[_0xfa8b('0xf')](_0x19ec1b,_0x5aaa70)['then'](function(_0x4862cd){logger[_0xfa8b('0x10')]('MailInteraction,\x20%s,\x20%s',_0x32f805,_0xfa8b('0x11'));logger['debug'](_0xfa8b('0x12'),_0x32f805,'request\x20sent',JSON['stringify'](_0x4862cd));if(_0x4862cd[_0xfa8b('0x13')]){if(_0x4862cd['error'][_0xfa8b('0x14')]===0x1f4){logger[_0xfa8b('0x13')]('MailInteraction,\x20%s,\x20%s',_0x32f805,_0x4862cd[_0xfa8b('0x13')][_0xfa8b('0x15')]);return _0x2e7ae7(_0x4862cd['error']['message']);}logger['error'](_0xfa8b('0x16'),_0x32f805,_0x4862cd[_0xfa8b('0x13')][_0xfa8b('0x15')]);return _0x113639(_0x4862cd['error'][_0xfa8b('0x15')]);}else{logger[_0xfa8b('0x10')](_0xfa8b('0x16'),_0x32f805,_0xfa8b('0x11'));_0x113639(_0x4862cd[_0xfa8b('0x17')]['message']);}})[_0xfa8b('0x18')](function(_0x96a6a){logger[_0xfa8b('0x13')](_0xfa8b('0x16'),_0x32f805,_0x96a6a);_0x2e7ae7(_0x96a6a);});});}exports[_0xfa8b('0x19')]=function(_0x4cda66){var _0x138c3e=this;return new Promise(function(_0x1cfe4d,_0x34d284){return db['MailInteraction'][_0xfa8b('0x1a')](_0x4cda66[_0xfa8b('0x1b')],{'raw':_0x4cda66[_0xfa8b('0x1c')]?_0x4cda66['options'][_0xfa8b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cda66[_0xfa8b('0x1c')]?_0x4cda66[_0xfa8b('0x1c')][_0xfa8b('0x1e')]||null:null,'attributes':_0x4cda66['options']?_0x4cda66[_0xfa8b('0x1c')][_0xfa8b('0x1f')]||null:null,'limit':_0x4cda66[_0xfa8b('0x1c')]?_0x4cda66['options'][_0xfa8b('0x20')]||null:null})[_0xfa8b('0x21')](function(_0x370cae){logger[_0xfa8b('0x10')](_0xfa8b('0x19'),_0x4cda66);logger[_0xfa8b('0x22')](_0xfa8b('0x19'),_0x4cda66,JSON[_0xfa8b('0x23')](_0x370cae));_0x1cfe4d(_0x370cae);})[_0xfa8b('0x18')](function(_0x237d6b){logger['error'](_0xfa8b('0x19'),_0x237d6b[_0xfa8b('0x15')],_0x4cda66);_0x34d284(_0x138c3e[_0xfa8b('0x13')](0x1f4,_0x237d6b[_0xfa8b('0x15')]));});});};exports[_0xfa8b('0x24')]=function(_0x55b3e3){return new Promise(function(_0x1659fa,_0x1e08c9){return db['MailInteraction'][_0xfa8b('0x25')]({'where':_0x55b3e3[_0xfa8b('0x1c')]?_0x55b3e3['options'][_0xfa8b('0x1e')]||null:null})[_0xfa8b('0x21')](function(_0x268356){if(_0x268356){return _0x268356[_0xfa8b('0x26')](_0x55b3e3[_0xfa8b('0x1b')][_0xfa8b('0x27')],_[_0xfa8b('0x28')](_0x55b3e3[_0xfa8b('0x1b')],[_0xfa8b('0x27'),'id'])||{});}})[_0xfa8b('0x29')](function(_0x27f158){logger['info']('AddTags',_0x55b3e3);logger['debug'](_0xfa8b('0x2a'),_0x55b3e3,JSON[_0xfa8b('0x23')](_0x27f158));_0x1659fa(_0x27f158);})[_0xfa8b('0x18')](function(_0x3a00ea){logger[_0xfa8b('0x13')](_0xfa8b('0x2a'),_0x3a00ea['message'],_0x55b3e3);_0x1e08c9(_this[_0xfa8b('0x13')](0x1f4,_0x3a00ea['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 1d5dcac..0cc34bd 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 _0x8fa9=['register','save','remove','emit','removeListener'];(function(_0x47a188,_0x478e68){var _0x36c294=function(_0x306920){while(--_0x306920){_0x47a188['push'](_0x47a188['shift']());}};_0x36c294(++_0x478e68);}(_0x8fa9,0x119));var _0x98fa=function(_0x1d09ae,_0x499e6f){_0x1d09ae=_0x1d09ae-0x0;var _0x22f895=_0x8fa9[_0x1d09ae];return _0x22f895;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x98fa('0x0'),_0x98fa('0x1'),'update'];function createListener(_0x4a90df,_0x54c8ac){return function(_0x5117aa){_0x54c8ac[_0x98fa('0x2')](_0x4a90df,_0x5117aa);};}function removeListener(_0x445730,_0x554f9b){return function(){MailInteractionEvents[_0x98fa('0x3')](_0x445730,_0x554f9b);};}exports[_0x98fa('0x4')]=function(_0x4ebebc){for(var _0x2a2d5e=0x0,_0x2f2d78=events['length'];_0x2a2d5e<_0x2f2d78;_0x2a2d5e++){var _0x4dab3b=events[_0x2a2d5e];var _0x46b99c=createListener('mailInteraction:'+_0x4dab3b,_0x4ebebc);MailInteractionEvents['on'](_0x4dab3b,_0x46b99c);}}; \ No newline at end of file +var _0x234a=['mailInteraction:','./mailInteraction.events','save','update','emit','removeListener','register','length'];(function(_0x20e32f,_0x1292a5){var _0x181a1e=function(_0x56303e){while(--_0x56303e){_0x20e32f['push'](_0x20e32f['shift']());}};_0x181a1e(++_0x1292a5);}(_0x234a,0x139));var _0xa234=function(_0x3b6648,_0x2d723a){_0x3b6648=_0x3b6648-0x0;var _0x5a0a0d=_0x234a[_0x3b6648];return _0x5a0a0d;};'use strict';var MailInteractionEvents=require(_0xa234('0x0'));var events=[_0xa234('0x1'),'remove',_0xa234('0x2')];function createListener(_0x19b39d,_0x11030e){return function(_0xc0397b){_0x11030e[_0xa234('0x3')](_0x19b39d,_0xc0397b);};}function removeListener(_0x2364cd,_0x4a757f){return function(){MailInteractionEvents[_0xa234('0x4')](_0x2364cd,_0x4a757f);};}exports[_0xa234('0x5')]=function(_0x357743){for(var _0xe99077=0x0,_0x32bf3d=events[_0xa234('0x6')];_0xe99077<_0x32bf3d;_0xe99077++){var _0x1ac260=events[_0xe99077];var _0x49c9a1=createListener(_0xa234('0x7')+_0x1ac260,_0x357743);MailInteractionEvents['on'](_0x1ac260,_0x49c9a1);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 1861822..934f47e 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 _0x60d7=['/:id','/:id/download','post','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe'];(function(_0x4417ef,_0x128047){var _0x4e0166=function(_0x43c091){while(--_0x43c091){_0x4417ef['push'](_0x4417ef['shift']());}};_0x4e0166(++_0x128047);}(_0x60d7,0x139));var _0x760d=function(_0x53a764,_0x50412a){_0x53a764=_0x53a764-0x0;var _0x2bbac0=_0x60d7[_0x53a764];return _0x2bbac0;};'use strict';var multer=require(_0x760d('0x0'));var util=require(_0x760d('0x1'));var path=require('path');var timeout=require(_0x760d('0x2'));var express=require('express');var router=express[_0x760d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x760d('0x4'));var interaction=require(_0x760d('0x5'));var config=require(_0x760d('0x6'));var controller=require(_0x760d('0x7'));router['get']('/',auth[_0x760d('0x8')](),controller[_0x760d('0x9')]);router[_0x760d('0xa')](_0x760d('0xb'),auth[_0x760d('0x8')](),controller['describe']);router[_0x760d('0xa')](_0x760d('0xc'),auth[_0x760d('0x8')](),controller['show']);router[_0x760d('0xa')](_0x760d('0xd'),auth[_0x760d('0x8')](),controller['download']);router[_0x760d('0xe')]('/',auth[_0x760d('0x8')](),interaction['tracked'](_0x760d('0xf'),_0x760d('0x10')),controller[_0x760d('0x11')]);router[_0x760d('0x12')](_0x760d('0xc'),auth[_0x760d('0x8')](),controller[_0x760d('0x13')]);router[_0x760d('0x12')](_0x760d('0x14'),auth[_0x760d('0x8')](),controller[_0x760d('0x15')]);router['put'](_0x760d('0x16'),auth['isAuthenticated'](),controller[_0x760d('0x17')]);router[_0x760d('0x18')](_0x760d('0xc'),auth[_0x760d('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8ec7=['tracked','mail','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download'];(function(_0x2bd0d7,_0x158fb3){var _0x3f3d78=function(_0x204a96){while(--_0x204a96){_0x2bd0d7['push'](_0x2bd0d7['shift']());}};_0x3f3d78(++_0x158fb3);}(_0x8ec7,0x1f1));var _0x78ec=function(_0xb99421,_0xaab133){_0xb99421=_0xb99421-0x0;var _0x4b3ec7=_0x8ec7[_0xb99421];return _0x4b3ec7;};'use strict';var multer=require(_0x78ec('0x0'));var util=require(_0x78ec('0x1'));var path=require('path');var timeout=require(_0x78ec('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x78ec('0x3'));var auth=require(_0x78ec('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x78ec('0x5'));var controller=require(_0x78ec('0x6'));router[_0x78ec('0x7')]('/',auth[_0x78ec('0x8')](),controller[_0x78ec('0x9')]);router['get'](_0x78ec('0xa'),auth['isAuthenticated'](),controller[_0x78ec('0xb')]);router[_0x78ec('0x7')](_0x78ec('0xc'),auth['isAuthenticated'](),controller[_0x78ec('0xd')]);router[_0x78ec('0x7')](_0x78ec('0xe'),auth[_0x78ec('0x8')](),controller[_0x78ec('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x78ec('0x10')](_0x78ec('0x11'),_0x78ec('0x12')),controller['create']);router[_0x78ec('0x13')](_0x78ec('0xc'),auth[_0x78ec('0x8')](),controller[_0x78ec('0x14')]);router[_0x78ec('0x13')](_0x78ec('0x15'),auth[_0x78ec('0x8')](),controller[_0x78ec('0x16')]);router[_0x78ec('0x13')](_0x78ec('0x17'),auth[_0x78ec('0x8')](),controller['reject']);router[_0x78ec('0x18')](_0x78ec('0xc'),auth[_0x78ec('0x8')](),controller[_0x78ec('0x19')]);module[_0x78ec('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 6b00f5e..7ab0f5b 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 _0xcc56=['STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long','BOOLEAN','ENUM','out'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xcc56,0x1a5));var _0x6cc5=function(_0x1e35bd,_0x40ee90){_0x1e35bd=_0x1e35bd-0x0;var _0x2c379d=_0xcc56[_0x1e35bd];return _0x2c379d;};'use strict';var Sequelize=require(_0x6cc5('0x0'));var _=require(_0x6cc5('0x1'));module[_0x6cc5('0x2')]={'body':{'type':Sequelize[_0x6cc5('0x3')](_0x6cc5('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x6cc5('0x3')]('medium')},'read':{'type':Sequelize[_0x6cc5('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6cc5('0x6')]('in',_0x6cc5('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x6cc5('0x8')]},'to':{'type':Sequelize[_0x6cc5('0x3')](_0x6cc5('0x4'))},'cc':{'type':Sequelize['TEXT'](_0x6cc5('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0x6cc5('0x4'))},'subject':{'type':Sequelize[_0x6cc5('0x3')]},'sentAt':{'type':Sequelize[_0x6cc5('0x9')]},'attach':{'type':Sequelize[_0x6cc5('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x6cc5('0x3')](_0x6cc5('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0x6cc5('0x4'))},'originChannel':{'type':Sequelize[_0x6cc5('0x6')](_0x6cc5('0xb'),_0x6cc5('0xc')),'defaultValue':_0x6cc5('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x2ab7=['long','DATE','INTEGER','ENUM','Email','Chat','lodash','TEXT','medium','out','STRING'];(function(_0x26b622,_0x237e9e){var _0x58a028=function(_0xde1652){while(--_0xde1652){_0x26b622['push'](_0x26b622['shift']());}};_0x58a028(++_0x237e9e);}(_0x2ab7,0x187));var _0x72ab=function(_0x18ab9b,_0x5de071){_0x18ab9b=_0x18ab9b-0x0;var _0x15087=_0x2ab7[_0x18ab9b];return _0x15087;};'use strict';var Sequelize=require('sequelize');var _=require(_0x72ab('0x0'));module['exports']={'body':{'type':Sequelize[_0x72ab('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x72ab('0x1')](_0x72ab('0x2'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x72ab('0x3')),'defaultValue':_0x72ab('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x72ab('0x4')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x72ab('0x1')](_0x72ab('0x5'))},'cc':{'type':Sequelize[_0x72ab('0x1')]('long')},'bcc':{'type':Sequelize['TEXT'](_0x72ab('0x5'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x72ab('0x6')]},'attach':{'type':Sequelize[_0x72ab('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x72ab('0x1')](_0x72ab('0x5'))},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0x72ab('0x8')](_0x72ab('0x9'),_0x72ab('0xa')),'defaultValue':_0x72ab('0x9'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index bd28c03..3cb1365 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 _0x20af=['sendStatus','stack','name','map','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','MailMessage','findAll','rows','show','params','keys','find','body','catch','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','QueryTypes','SELECT','contact','UserId','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','rejectmessage','unix','server','tmp','message-%s.eml','from','bcc','Attachment','Attachments','subject','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','download','eml-format','moment','bluebird','util','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end'];(function(_0x396910,_0x397bda){var _0x217d81=function(_0x1e6ab9){while(--_0x1e6ab9){_0x396910['push'](_0x396910['shift']());}};_0x217d81(++_0x397bda);}(_0x20af,0x7b));var _0xf20a=function(_0x302d9a,_0x5bcdcf){_0x302d9a=_0x302d9a-0x0;var _0x90b45=_0x20af[_0x302d9a];return _0x90b45;};'use strict';var emlformat=require(_0xf20a('0x0'));var moment=require(_0xf20a('0x1'));var BPromise=require(_0xf20a('0x2'));var util=require(_0xf20a('0x3'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0xf20a('0x4'));var htmlToText=require(_0xf20a('0x5'));var qs=require(_0xf20a('0x6'));var logger=require(_0xf20a('0x7'))(_0xf20a('0x8'));var interaction_log=require(_0xf20a('0x7'))('mail-interactions');var config=require(_0xf20a('0x9'));var db=require(_0xf20a('0xa'))['db'];config['redis']=_[_0xf20a('0xb')](config[_0xf20a('0xc')],{'host':_0xf20a('0xd'),'port':0x18eb});var socket=require(_0xf20a('0xe'))(new Redis(config[_0xf20a('0xc')]));require(_0xf20a('0xf'))[_0xf20a('0x10')](socket);var jayson=require(_0xf20a('0x11'));var client=jayson[_0xf20a('0x12')]['http']({'port':0x232c});var client9003=jayson[_0xf20a('0x12')]['http']({'port':0x232b});var client9002=jayson[_0xf20a('0x12')][_0xf20a('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x265b05,_0x5d19b1,_0x31572d,_0x283a75){return new BPromise(function(_0x4c14ae,_0x17132f){var _0x520708=_0x283a75||client;return _0x520708[_0xf20a('0x14')](_0x265b05,_0x31572d)['then'](function(_0x4d5075){logger[_0xf20a('0x15')](_0xf20a('0x16'),_0x5d19b1,_0xf20a('0x17'));logger[_0xf20a('0x18')](_0xf20a('0x19'),_0x5d19b1,'request\x20sent',JSON[_0xf20a('0x1a')](_0x4d5075));if(_0x4d5075['error']){if(_0x4d5075[_0xf20a('0x1b')][_0xf20a('0x1c')]===0x1f4){logger['error'](_0xf20a('0x16'),_0x5d19b1,_0x4d5075[_0xf20a('0x1b')]['message']);return _0x17132f(_0x4d5075[_0xf20a('0x1b')][_0xf20a('0x1d')]);}logger[_0xf20a('0x1b')](_0xf20a('0x16'),_0x5d19b1,_0x4d5075['error'][_0xf20a('0x1d')]);return _0x4c14ae(_0x4d5075[_0xf20a('0x1b')][_0xf20a('0x1d')]);}else{logger['info'](_0xf20a('0x16'),_0x5d19b1,_0xf20a('0x17'));_0x4c14ae(_0x4d5075[_0xf20a('0x1e')][_0xf20a('0x1d')]);}})['catch'](function(_0x3129fc){logger[_0xf20a('0x1b')](_0xf20a('0x16'),_0x5d19b1,_0x3129fc);_0x17132f(_0x3129fc);});});}function respondWithResult(_0x47392e,_0x251e43){_0x251e43=_0x251e43||0xc8;return function(_0x5e1967){if(_0x5e1967){return _0x47392e[_0xf20a('0x1f')](_0x251e43)[_0xf20a('0x20')](_0x5e1967);}};}function respondWithFilteredResult(_0x2252bc,_0x6a589b){return function(_0xb00c1c){if(_0xb00c1c){var _0x5e08f9=typeof _0x6a589b[_0xf20a('0x21')]===_0xf20a('0x22')&&typeof _0x6a589b['limit']===_0xf20a('0x22');var _0x4a1edb=_0xb00c1c['count'];var _0x2e7cfd=_0x5e08f9?0x0:_0x6a589b['offset'];var _0x2460ed=_0x5e08f9?_0xb00c1c[_0xf20a('0x23')]:_0x6a589b[_0xf20a('0x21')]+_0x6a589b[_0xf20a('0x24')];var _0x29cac3;if(_0x2460ed>=_0x4a1edb){_0x2460ed=_0x4a1edb;_0x29cac3=0xc8;}else{_0x29cac3=0xce;}_0x2252bc[_0xf20a('0x1f')](_0x29cac3);return _0x2252bc[_0xf20a('0x25')](_0xf20a('0x26'),_0x2e7cfd+'-'+_0x2460ed+'/'+_0x4a1edb)['json'](_0xb00c1c);}return null;};}function saveUpdates(_0x211f90){return function(_0x5e6aa6){if(_0x5e6aa6){return _0x5e6aa6[_0xf20a('0x27')](_0x211f90)[_0xf20a('0x28')](function(_0x20dbf1){return _0x20dbf1;});}return null;};}function removeEntity(_0x1d0286){return function(_0x2a95f8){if(_0x2a95f8){return _0x2a95f8[_0xf20a('0x29')]()[_0xf20a('0x28')](function(){_0x1d0286['status'](0xcc)[_0xf20a('0x2a')]();});}};}function handleEntityNotFound(_0x107179){return function(_0x3ae764){if(!_0x3ae764){_0x107179[_0xf20a('0x2b')](0x194);}return _0x3ae764;};}function handleError(_0x592f57,_0x536333){_0x536333=_0x536333||0x1f4;return function(_0x382e91){logger['error'](_0x382e91[_0xf20a('0x2c')]);if(_0x382e91[_0xf20a('0x2d')]){delete _0x382e91[_0xf20a('0x2d')];}_0x592f57[_0xf20a('0x1f')](_0x536333)['send'](_0x382e91);};}exports['index']=function(_0x46b219,_0x5ec3c4){var _0x247341={},_0x5f3b62={},_0x405329={'count':0x0,'rows':[]};var _0x456d18=_[_0xf20a('0x2e')](db['MailMessage'][_0xf20a('0x2f')],function(_0xce9dc){return{'name':_0xce9dc['fieldName'],'type':_0xce9dc['type']['key']};});_0x5f3b62[_0xf20a('0x30')]=_['map'](_0x456d18,'name');_0x5f3b62[_0xf20a('0x31')]=_['keys'](_0x46b219[_0xf20a('0x31')]);_0x5f3b62[_0xf20a('0x32')]=_[_0xf20a('0x33')](_0x5f3b62[_0xf20a('0x30')],_0x5f3b62[_0xf20a('0x31')]);_0x247341[_0xf20a('0x34')]=_[_0xf20a('0x33')](_0x5f3b62[_0xf20a('0x30')],qs['fields'](_0x46b219['query'][_0xf20a('0x35')]));_0x247341[_0xf20a('0x34')]=_0x247341[_0xf20a('0x34')][_0xf20a('0x36')]?_0x247341[_0xf20a('0x34')]:_0x5f3b62[_0xf20a('0x30')];if(!_0x46b219[_0xf20a('0x31')][_0xf20a('0x37')](_0xf20a('0x38'))){_0x247341[_0xf20a('0x24')]=qs['limit'](_0x46b219[_0xf20a('0x31')][_0xf20a('0x24')]);_0x247341[_0xf20a('0x21')]=qs[_0xf20a('0x21')](_0x46b219[_0xf20a('0x31')][_0xf20a('0x21')]);}_0x247341[_0xf20a('0x39')]=qs[_0xf20a('0x3a')](_0x46b219[_0xf20a('0x31')][_0xf20a('0x3a')]);_0x247341[_0xf20a('0x3b')]=qs['filters'](_['pick'](_0x46b219[_0xf20a('0x31')],_0x5f3b62[_0xf20a('0x32')]),_0x456d18);if(_0x46b219['query'][_0xf20a('0x3c')]){_0x247341[_0xf20a('0x3b')]=_['merge'](_0x247341[_0xf20a('0x3b')],{'$or':_[_0xf20a('0x2e')](_0x456d18,function(_0x2444e2){if(_0x2444e2[_0xf20a('0x3d')]!==_0xf20a('0x3e')){var _0x529784={};_0x529784[_0x2444e2['name']]={'$like':'%'+_0x46b219['query'][_0xf20a('0x3c')]+'%'};return _0x529784;}})});}_0x247341=_[_0xf20a('0x3f')]({},_0x247341,_0x46b219[_0xf20a('0x40')]);var _0xa3e9d0={'where':_0x247341[_0xf20a('0x3b')]};return db['MailMessage']['count'](_0xa3e9d0)[_0xf20a('0x28')](function(_0xad9ed6){_0x405329[_0xf20a('0x23')]=_0xad9ed6;if(_0x46b219[_0xf20a('0x31')][_0xf20a('0x41')]){_0x247341[_0xf20a('0x42')]=[{'all':!![]}];}return db[_0xf20a('0x43')][_0xf20a('0x44')](_0x247341);})[_0xf20a('0x28')](function(_0x1c0991){_0x405329[_0xf20a('0x45')]=_0x1c0991;return _0x405329;})[_0xf20a('0x28')](respondWithFilteredResult(_0x5ec3c4,_0x247341))['catch'](handleError(_0x5ec3c4,null));};exports[_0xf20a('0x46')]=function(_0x2f8a2c,_0x36bbe5){var _0x518788={'raw':!![],'where':{'id':_0x2f8a2c[_0xf20a('0x47')]['id']}},_0x144790={};_0x144790[_0xf20a('0x30')]=_[_0xf20a('0x48')](db['MailMessage'][_0xf20a('0x2f')]);_0x144790[_0xf20a('0x31')]=_[_0xf20a('0x48')](_0x2f8a2c[_0xf20a('0x31')]);_0x144790[_0xf20a('0x32')]=_[_0xf20a('0x33')](_0x144790['model'],_0x144790[_0xf20a('0x31')]);_0x518788[_0xf20a('0x34')]=_[_0xf20a('0x33')](_0x144790[_0xf20a('0x30')],qs[_0xf20a('0x35')](_0x2f8a2c[_0xf20a('0x31')][_0xf20a('0x35')]));_0x518788['attributes']=_0x518788[_0xf20a('0x34')][_0xf20a('0x36')]?_0x518788[_0xf20a('0x34')]:_0x144790[_0xf20a('0x30')];if(_0x2f8a2c[_0xf20a('0x31')][_0xf20a('0x41')]){_0x518788[_0xf20a('0x42')]=[{'all':!![]}];}_0x518788=_['merge']({},_0x518788,_0x2f8a2c[_0xf20a('0x40')]);return db[_0xf20a('0x43')][_0xf20a('0x49')](_0x518788)[_0xf20a('0x28')](handleEntityNotFound(_0x36bbe5,null))[_0xf20a('0x28')](respondWithResult(_0x36bbe5,null))['catch'](handleError(_0x36bbe5,null));};exports[_0xf20a('0x27')]=function(_0x4a18ae,_0x530d8b){if(_0x4a18ae[_0xf20a('0x4a')]['id']){delete _0x4a18ae[_0xf20a('0x4a')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x4a18ae[_0xf20a('0x47')]['id']}})[_0xf20a('0x28')](handleEntityNotFound(_0x530d8b,null))[_0xf20a('0x28')](saveUpdates(_0x4a18ae[_0xf20a('0x4a')],null))[_0xf20a('0x28')](respondWithResult(_0x530d8b,null))[_0xf20a('0x4b')](handleError(_0x530d8b,null));};exports[_0xf20a('0x29')]=function(_0x9191b0,_0x3cc842){return db[_0xf20a('0x43')][_0xf20a('0x49')]({'where':{'id':_0x9191b0[_0xf20a('0x47')]['id']}})[_0xf20a('0x28')](handleEntityNotFound(_0x3cc842,null))[_0xf20a('0x28')](removeEntity(_0x3cc842,null))['catch'](handleError(_0x3cc842,null));};exports[_0xf20a('0x4c')]=function(_0x246651,_0x74b995){return db[_0xf20a('0x43')][_0xf20a('0x4c')]()[_0xf20a('0x28')](respondWithResult(_0x74b995,null))[_0xf20a('0x4b')](handleError(_0x74b995,null));};exports[_0xf20a('0x4d')]=function(_0x3e2f98,_0x5c318a){return db['MailMessage'][_0xf20a('0x4d')](_0x3e2f98[_0xf20a('0x4a')])[_0xf20a('0x28')](function(_0xeed579){if(_0xeed579){if(_0xeed579[_0xf20a('0x4e')]===_0xf20a('0x4f')&&!_0xeed579[_0xf20a('0x50')]){var _0x51341d,_0x372128,_0x53b4d3;if(_0x3e2f98['body']['to']){_0x372128=_0x3e2f98['body']['to'][_0xf20a('0x51')](',')[0x0];}return db[_0xf20a('0x52')][_0xf20a('0x53')]({'where':{'id':_0xeed579[_0xf20a('0x54')]},'include':[{'model':db[_0xf20a('0x55')],'as':_0xf20a('0x56'),'include':[{'model':db[_0xf20a('0x57')],'as':_0xf20a('0x58'),'where':{'email':_0x372128},'limit':0x1,'order':[[_0xf20a('0x59'),_0xf20a('0x5a')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0xf20a('0x28')](function(_0x2008ec){_0x51341d=_0x2008ec;if(_0x51341d&&_0x51341d[_0xf20a('0x5b')]){var _0x3130df={'tls':{'rejectUnauthorized':![]}};if(_[_0xf20a('0x5c')](_0x51341d[_0xf20a('0x5b')][_0xf20a('0x5d')])){_0x3130df[_0xf20a('0x5e')]=_0x51341d['Smtp'][_0xf20a('0x5e')];_0x3130df['port']=_0x51341d[_0xf20a('0x5b')][_0xf20a('0x5f')];_0x3130df[_0xf20a('0x60')]=_0x51341d[_0xf20a('0x5b')][_0xf20a('0x60')];if(_0x51341d[_0xf20a('0x5b')][_0xf20a('0x61')]){_0x3130df[_0xf20a('0x62')]={'user':_0x51341d[_0xf20a('0x5b')][_0xf20a('0x63')],'pass':_0x51341d['Smtp'][_0xf20a('0x64')]};}}else{_0x3130df[_0xf20a('0x5d')]=_0x51341d[_0xf20a('0x5b')]['service'];_0x3130df[_0xf20a('0x62')]={'user':_0x51341d[_0xf20a('0x5b')][_0xf20a('0x63')],'pass':_0x51341d[_0xf20a('0x5b')]['pass']};_0x3130df[_0xf20a('0x60')]=_0x51341d[_0xf20a('0x5b')][_0xf20a('0x60')];}if(_0x3e2f98[_0xf20a('0x4a')][_0xf20a('0x65')]&&_0x3e2f98['body'][_0xf20a('0x65')][_0xf20a('0x36')]){for(var _0x4b3111=0x0;_0x4b3111<_0x3e2f98[_0xf20a('0x4a')][_0xf20a('0x65')][_0xf20a('0x36')];_0x4b3111+=0x1){_0x3e2f98[_0xf20a('0x4a')]['attachments'][_0x4b3111]={'filename':_0x3e2f98[_0xf20a('0x4a')]['attachments'][_0x4b3111][_0xf20a('0x2d')],'path':path[_0xf20a('0x66')](config['root'],_0xf20a('0x67'),_0x3e2f98['body'][_0xf20a('0x65')][_0x4b3111][_0xf20a('0x68')])};}}_0x53b4d3={'account':_0x3130df,'message':_0x3e2f98[_0xf20a('0x4a')]};return;}})[_0xf20a('0x28')](function(){if(_0x51341d[_0xf20a('0x56')]){if(_0x51341d[_0xf20a('0x56')][_0xf20a('0x58')]['length']){return _0x51341d[_0xf20a('0x56')][_0xf20a('0x58')][0x0];}else{return db[_0xf20a('0x57')][_0xf20a('0x4d')](_[_0xf20a('0xb')](_0x3e2f98[_0xf20a('0x4a')],{'firstName':_0x3e2f98[_0xf20a('0x4a')]['to'],'email':_0x3e2f98[_0xf20a('0x4a')]['to'],'phone':_0x3e2f98[_0xf20a('0x4a')]['to'],'ListId':_0x51341d[_0xf20a('0x69')]}));}}else{throw new Error(_0xf20a('0x6a'));}})[_0xf20a('0x28')](function(){if(_0x53b4d3){return respondWithRpcPromise(_0xf20a('0x6b'),_0xf20a('0x6c'),_0x53b4d3,client9003)['then'](function(_0x23f959){return _0xeed579[_0xf20a('0x27')]({'read':!![],'messageId':_0x23f959[_0xf20a('0x6d')],'sentAt':moment()[_0xf20a('0x6e')](_0xf20a('0x6f'))});})[_0xf20a('0x4b')](function(_0x35b156){logger[_0xf20a('0x1b')]('%s',JSON['stringify'](_0x35b156));return _0xeed579;});}return _0xeed579;});}return _0xeed579;}})[_0xf20a('0x28')](respondWithResult(_0x5c318a,0xc9))[_0xf20a('0x4b')](handleError(_0x5c318a,null));};exports[_0xf20a('0x70')]=function(_0x1be717,_0x5618de){var _0xe32b0f={'agent':{},'channel':_0xf20a('0x71')};if(_0x1be717[_0xf20a('0x4a')]['id']){delete _0x1be717['body']['id'];}_0x1be717['body'][_0xf20a('0x72')]=!![];_0x1be717['body'][_0xf20a('0x73')]=moment()[_0xf20a('0x6e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1be717[_0xf20a('0x4a')]['UserId']=_0x1be717['body']['UserId']||_0x1be717[_0xf20a('0x63')]['id'];_0xe32b0f['agent']['id']=_0x1be717[_0xf20a('0x4a')]['UserId'];return db[_0xf20a('0x43')][_0xf20a('0x49')]({'where':{'id':_0x1be717['params']['id'],'UserId':null}})[_0xf20a('0x28')](handleEntityNotFound(_0x5618de,null))[_0xf20a('0x28')](saveUpdates(_0x1be717['body'],null))[_0xf20a('0x28')](function(_0x2a1a2a){if(_0x2a1a2a){_0xe32b0f[_0xf20a('0x1d')]=_0x2a1a2a[_0xf20a('0x74')]({'plain':!![]});return db[_0xf20a('0x75')][_0xf20a('0x49')]({'where':{'id':_0x2a1a2a[_0xf20a('0x76')]}});}return null;})[_0xf20a('0x28')](handleEntityNotFound(_0x5618de,null))[_0xf20a('0x28')](function(_0x1be599){if(_0x1be599){return _0x1be599[_0xf20a('0x27')]({'UserId':_0x1be717[_0xf20a('0x4a')]['UserId'],'read1stAt':_['isNil'](_0x1be599[_0xf20a('0x77')])?moment()[_0xf20a('0x6e')](_0xf20a('0x6f')):undefined});}return null;})['then'](function(_0x47c0a0){if(_0x47c0a0){_0xe32b0f[_0xf20a('0x78')]=_0x47c0a0[_0xf20a('0x74')]({'plain':!![]});interaction_log[_0xf20a('0x15')](_0xf20a('0x79'),_0x1be717[_0xf20a('0x63')]['id'],_0x1be717['user'][_0xf20a('0x2d')],_0x1be717[_0xf20a('0x63')]['role'],_0xe32b0f['interaction']['id'],_0x1be717[_0xf20a('0x4a')]?JSON[_0xf20a('0x1a')](_0x1be717[_0xf20a('0x4a')]):'null');return respondWithRpcPromise(_0xf20a('0x7a'),_0xf20a('0x7b'),_0xe32b0f);}return null;})['then'](function(_0x4ec369){var _0x8db52e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4ec369['message']['ContactId'];return db['sequelize'][_0xf20a('0x31')](_0x8db52e,{'type':db['Sequelize'][_0xf20a('0x7c')][_0xf20a('0x7d')],'raw':!![]})[_0xf20a('0x28')](function(_0x2cbd5c){return _0x2cbd5c;});})[_0xf20a('0x28')](function(_0x1601dd){if(_0x1601dd){_0xe32b0f[_0xf20a('0x1d')][_0xf20a('0x7e')]=_0x1601dd[0x0];if(!_0x1be717[_0xf20a('0x4a')][_0xf20a('0x7f')])return;return db[_0xf20a('0x80')][_0xf20a('0x49')]({'where':{'id':_0x1be717[_0xf20a('0x4a')]['UserId'],'role':_0xf20a('0x81')},'attributes':['id',_0xf20a('0x2d'),_0xf20a('0x82'),_0xf20a('0x83'),_0xf20a('0x84')],'raw':!![]});}return null;})[_0xf20a('0x28')](function(_0x430787){if(!_0x430787)return null;_0xe32b0f[_0xf20a('0x1d')]['agent']=_0x430787;return _0xe32b0f;})[_0xf20a('0x28')](function(_0x164477){if(_0x164477){if(_0x1be717[_0xf20a('0x4a')][_0xf20a('0x85')]){_0xe32b0f[_0xf20a('0x1d')][_0xf20a('0x86')]=util[_0xf20a('0x6e')](_0xf20a('0x87'),_0x1be717['user']['name']);_0xe32b0f[_0xf20a('0x1d')][_0xf20a('0x88')]=_0xe32b0f[_0xf20a('0x88')];_0xe32b0f[_0xf20a('0x1d')][_0xf20a('0x89')]=_0xe32b0f['channel'];_0xe32b0f['message'][_0xf20a('0x8a')]='accept';_0xe32b0f[_0xf20a('0x1d')][_0xf20a('0x4a')]=htmlToText[_0xf20a('0x8b')](_0xe32b0f[_0xf20a('0x1d')][_0xf20a('0x4a')]);return respondWithRpcPromise(_0xf20a('0x8c'),'EventManager',{'event':_0xf20a('0x8d'),'message':_0xe32b0f[_0xf20a('0x1d')]},client9002)[_0xf20a('0x28')](function(){return _0xe32b0f;});}return _0xe32b0f;}return null;})[_0xf20a('0x28')](respondWithResult(_0x5618de,null))[_0xf20a('0x4b')](handleError(_0x5618de,null));};exports[_0xf20a('0x8e')]=function(_0x1f5d17,_0x15890f){var _0x3122e3={'agent':{},'channel':_0xf20a('0x71')};if(_0x1f5d17['body']['id']){delete _0x1f5d17['body']['id'];}_0x1f5d17[_0xf20a('0x4a')][_0xf20a('0x7f')]=_0x1f5d17[_0xf20a('0x4a')][_0xf20a('0x7f')]||_0x1f5d17[_0xf20a('0x63')]['id'];_0x3122e3[_0xf20a('0x81')]['id']=_0x1f5d17['body'][_0xf20a('0x7f')];return db[_0xf20a('0x43')][_0xf20a('0x49')]({'where':{'id':_0x1f5d17[_0xf20a('0x47')]['id'],'UserId':null}})[_0xf20a('0x28')](handleEntityNotFound(_0x15890f,null))[_0xf20a('0x28')](function(_0x1a308c){if(_0x1a308c){_0x3122e3['message']=_0x1a308c[_0xf20a('0x74')]({'plain':!![]});return db[_0xf20a('0x75')][_0xf20a('0x49')]({'where':{'id':_0x1a308c[_0xf20a('0x76')]}});}return null;})[_0xf20a('0x28')](handleEntityNotFound(_0x15890f,null))['then'](function(_0x58ef0c){if(_0x58ef0c){_0x3122e3[_0xf20a('0x78')]=_0x58ef0c['get']({'plain':!![]});interaction_log['info'](_0xf20a('0x8f'),_0x1f5d17[_0xf20a('0x63')]['id'],_0x1f5d17[_0xf20a('0x63')][_0xf20a('0x2d')],_0x1f5d17[_0xf20a('0x63')][_0xf20a('0x90')],_0x3122e3[_0xf20a('0x78')]['id'],_0x1f5d17[_0xf20a('0x4a')]?JSON[_0xf20a('0x1a')](_0x1f5d17[_0xf20a('0x4a')]):'null');return respondWithRpcPromise(_0xf20a('0x91'),_0xf20a('0x92'),_0x3122e3);}return null;})[_0xf20a('0x28')](function(_0x4e5e99){var _0x4e26a0=_0xf20a('0x93')+_0x4e5e99[_0xf20a('0x1d')]['ContactId'];return db['sequelize'][_0xf20a('0x31')](_0x4e26a0,{'type':db[_0xf20a('0x94')]['QueryTypes'][_0xf20a('0x7d')],'raw':!![]})[_0xf20a('0x28')](function(_0x32d716){return _0x32d716;});})[_0xf20a('0x28')](function(_0x363b67){if(_0x363b67){_0x3122e3[_0xf20a('0x1d')][_0xf20a('0x7e')]=_0x363b67[0x0];if(!_0x1f5d17[_0xf20a('0x4a')]['UserId'])return;return db['User'][_0xf20a('0x49')]({'where':{'id':_0x1f5d17[_0xf20a('0x4a')]['UserId'],'role':_0xf20a('0x81')},'attributes':['id',_0xf20a('0x2d'),_0xf20a('0x82'),_0xf20a('0x83'),'internal'],'raw':!![]});}return null;})['then'](function(_0x449720){if(!_0x449720)return null;_0x3122e3[_0xf20a('0x1d')][_0xf20a('0x81')]=_0x449720;return _0x3122e3;})[_0xf20a('0x28')](function(_0x4f26d9){if(_0x4f26d9){_0x4f26d9[_0xf20a('0x1d')][_0xf20a('0x86')]=util[_0xf20a('0x6e')]('SIP/%s',_0x1f5d17[_0xf20a('0x63')][_0xf20a('0x2d')]);_0x4f26d9[_0xf20a('0x1d')][_0xf20a('0x88')]=_0x3122e3[_0xf20a('0x88')];_0x4f26d9[_0xf20a('0x1d')][_0xf20a('0x89')]=_0x3122e3['channel'];_0x4f26d9[_0xf20a('0x1d')][_0xf20a('0x8a')]='reject';_0x4f26d9['message'][_0xf20a('0x4a')]=htmlToText[_0xf20a('0x8b')](_0x3122e3[_0xf20a('0x1d')][_0xf20a('0x4a')]);respondWithRpcPromise('EventManager',_0xf20a('0x8c'),{'event':_0xf20a('0x95'),'message':_0x4f26d9[_0xf20a('0x1d')]},client9002);return _0x3122e3;}return null;})[_0xf20a('0x28')](respondWithResult(_0x15890f,null))[_0xf20a('0x4b')](handleError(_0x15890f,null));};exports['download']=function(_0x37f2bd,_0x1dd9c3){var _0x3d4f69=moment()[_0xf20a('0x96')]()['toString']();var _0x52d5f4=path[_0xf20a('0x66')](config['root'],_0xf20a('0x97'),'files',_0xf20a('0x98'));var _0x5358dc=path[_0xf20a('0x66')](config['root'],_0xf20a('0x97'),'files',_0xf20a('0x65'));var _0x371032=util[_0xf20a('0x6e')](_0xf20a('0x99'),_0x3d4f69);return db[_0xf20a('0x43')][_0xf20a('0x49')]({'where':{'id':_0x37f2bd['params']['id']},'attributes':['id','body',_0xf20a('0x9a'),'to','cc',_0xf20a('0x9b'),'subject','createdAt'],'include':_0x37f2bd[_0xf20a('0x31')][_0xf20a('0x65')]?[{'model':db[_0xf20a('0x9c')],'as':_0xf20a('0x9d')}]:undefined})['then'](handleEntityNotFound(_0x1dd9c3,null))['then'](function(_0x2b97cf){if(_0x2b97cf){var _0x4626c4=_0x2b97cf;var _0x37947f={'from':_0x4626c4[_0xf20a('0x9a')],'to':_0x4626c4['to'],'subject':_0x4626c4[_0xf20a('0x9e')],'html':_0x4626c4[_0xf20a('0x4a')],'headers':{'Date':moment(_0x4626c4[_0xf20a('0x9f')])[_0xf20a('0x6e')](_0xf20a('0xa0'))},'attachments':[]};if(_0x2b97cf['cc']){_0x37947f[_0xf20a('0xa1')]['Cc']=_0x2b97cf['cc'];}if(_0x2b97cf[_0xf20a('0x9b')]){_0x37947f[_0xf20a('0xa1')][_0xf20a('0xa2')]=_0x2b97cf['bcc'];}return new BPromise(function(_0x570f0b,_0x1d4187){if(_0x2b97cf[_0xf20a('0x9d')]){for(var _0x1e6e6e=0x0;_0x1e6e6e<_0x2b97cf[_0xf20a('0x9d')][_0xf20a('0x36')];_0x1e6e6e++){var _0x2ff07a=_0x2b97cf[_0xf20a('0x9d')][_0x1e6e6e];var _0x590d07=path['join'](_0x5358dc,_0x2ff07a[_0xf20a('0x68')]);if(fs[_0xf20a('0xa3')](_0x590d07)){_0x37947f['attachments'][_0xf20a('0xa4')]({'name':_0x2ff07a[_0xf20a('0x2d')],'contentType':_0x2ff07a[_0xf20a('0x3d')],'data':fs['readFileSync'](_0x590d07)});}}}emlformat['build'](_0x37947f,function(_0x7dbaaf,_0xccfb88){if(_0x7dbaaf)return _0x1d4187(_0x7dbaaf);fs['writeFileSync'](path[_0xf20a('0x66')](_0x52d5f4,_0x371032),_0xccfb88);return _0x570f0b(_0xccfb88);});});}})[_0xf20a('0x28')](function(_0x2553d0){if(_0x2553d0){return _0x1dd9c3[_0xf20a('0xa5')](path[_0xf20a('0x66')](_0x52d5f4,_0x371032),_0x371032,function(_0x378983){if(!_0x378983)fs['unlinkSync'](path[_0xf20a('0x66')](_0x52d5f4,_0x371032));});}})[_0xf20a('0x4b')](handleError(_0x1dd9c3,null));}; \ No newline at end of file +var _0xdf87=['length','includeAll','update','body','find','describe','create','direction','out','split','MailAccount','findOne','List','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','auth','pass','user','attachments','join','root','server/files/attachments','Contacts','ListId','List\x20not\x20found','sendMail','messageId','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','interface','channel','fromString','EventManager','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','fullname','internal','motionChannel','event','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','push','build','writeFileSync','unlinkSync','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','json','offset','undefined','limit','Content-Range','destroy','stack','name','send','index','MailMessage','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','options','count','include','rows','catch','params'];(function(_0x46a7bd,_0x285d53){var _0x2be7e5=function(_0xe12c91){while(--_0xe12c91){_0x46a7bd['push'](_0x46a7bd['shift']());}};_0x2be7e5(++_0x285d53);}(_0xdf87,0xfa));var _0x7df8=function(_0x48ea16,_0x2f065a){_0x48ea16=_0x48ea16-0x0;var _0x1ae450=_0xdf87[_0x48ea16];return _0x1ae450;};'use strict';var emlformat=require('eml-format');var moment=require(_0x7df8('0x0'));var BPromise=require(_0x7df8('0x1'));var util=require(_0x7df8('0x2'));var path=require(_0x7df8('0x3'));var fs=require('fs');var _=require(_0x7df8('0x4'));var Redis=require(_0x7df8('0x5'));var htmlToText=require(_0x7df8('0x6'));var qs=require(_0x7df8('0x7'));var logger=require(_0x7df8('0x8'))(_0x7df8('0x9'));var interaction_log=require(_0x7df8('0x8'))('mail-interactions');var config=require(_0x7df8('0xa'));var db=require(_0x7df8('0xb'))['db'];config[_0x7df8('0xc')]=_[_0x7df8('0xd')](config[_0x7df8('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7df8('0xe'))(new Redis(config[_0x7df8('0xc')]));require('./mailMessage.socket')[_0x7df8('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7df8('0x10')][_0x7df8('0x11')]({'port':0x232c});var client9003=jayson[_0x7df8('0x10')][_0x7df8('0x11')]({'port':0x232b});var client9002=jayson['client'][_0x7df8('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x35f3e2,_0xc632bc,_0x68c7ef,_0x3ecd37){return new BPromise(function(_0x34178c,_0x37c6b7){var _0xc73477=_0x3ecd37||client;return _0xc73477[_0x7df8('0x12')](_0x35f3e2,_0x68c7ef)[_0x7df8('0x13')](function(_0x334074){logger[_0x7df8('0x14')](_0x7df8('0x15'),_0xc632bc,_0x7df8('0x16'));logger[_0x7df8('0x17')]('MailMessage,\x20%s,\x20%s,\x20%s',_0xc632bc,'request\x20sent',JSON[_0x7df8('0x18')](_0x334074));if(_0x334074[_0x7df8('0x19')]){if(_0x334074[_0x7df8('0x19')][_0x7df8('0x1a')]===0x1f4){logger[_0x7df8('0x19')](_0x7df8('0x15'),_0xc632bc,_0x334074[_0x7df8('0x19')][_0x7df8('0x1b')]);return _0x37c6b7(_0x334074['error'][_0x7df8('0x1b')]);}logger[_0x7df8('0x19')](_0x7df8('0x15'),_0xc632bc,_0x334074[_0x7df8('0x19')][_0x7df8('0x1b')]);return _0x34178c(_0x334074['error'][_0x7df8('0x1b')]);}else{logger[_0x7df8('0x14')]('MailMessage,\x20%s,\x20%s',_0xc632bc,_0x7df8('0x16'));_0x34178c(_0x334074[_0x7df8('0x1c')]['message']);}})['catch'](function(_0x339ea5){logger['error'](_0x7df8('0x15'),_0xc632bc,_0x339ea5);_0x37c6b7(_0x339ea5);});});}function respondWithResult(_0x5bf2d1,_0xb12b55){_0xb12b55=_0xb12b55||0xc8;return function(_0x4fbe26){if(_0x4fbe26){return _0x5bf2d1[_0x7df8('0x1d')](_0xb12b55)[_0x7df8('0x1e')](_0x4fbe26);}};}function respondWithFilteredResult(_0x5e3bca,_0x1c4c30){return function(_0x6de7bf){if(_0x6de7bf){var _0x59c216=typeof _0x1c4c30[_0x7df8('0x1f')]===_0x7df8('0x20')&&typeof _0x1c4c30[_0x7df8('0x21')]===_0x7df8('0x20');var _0x4c5a21=_0x6de7bf['count'];var _0x36d7fc=_0x59c216?0x0:_0x1c4c30['offset'];var _0x2d2489=_0x59c216?_0x6de7bf['count']:_0x1c4c30[_0x7df8('0x1f')]+_0x1c4c30[_0x7df8('0x21')];var _0x18cf5f;if(_0x2d2489>=_0x4c5a21){_0x2d2489=_0x4c5a21;_0x18cf5f=0xc8;}else{_0x18cf5f=0xce;}_0x5e3bca[_0x7df8('0x1d')](_0x18cf5f);return _0x5e3bca['set'](_0x7df8('0x22'),_0x36d7fc+'-'+_0x2d2489+'/'+_0x4c5a21)[_0x7df8('0x1e')](_0x6de7bf);}return null;};}function saveUpdates(_0x5292a0){return function(_0x28daf1){if(_0x28daf1){return _0x28daf1['update'](_0x5292a0)['then'](function(_0x16a368){return _0x16a368;});}return null;};}function removeEntity(_0x4023e1){return function(_0x5d7a14){if(_0x5d7a14){return _0x5d7a14[_0x7df8('0x23')]()[_0x7df8('0x13')](function(){_0x4023e1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae36a){return function(_0x2ecf15){if(!_0x2ecf15){_0x1ae36a['sendStatus'](0x194);}return _0x2ecf15;};}function handleError(_0x2c2b4e,_0x585692){_0x585692=_0x585692||0x1f4;return function(_0xa09361){logger[_0x7df8('0x19')](_0xa09361[_0x7df8('0x24')]);if(_0xa09361[_0x7df8('0x25')]){delete _0xa09361['name'];}_0x2c2b4e[_0x7df8('0x1d')](_0x585692)[_0x7df8('0x26')](_0xa09361);};}exports[_0x7df8('0x27')]=function(_0x4f839d,_0x5f572a){var _0x383aae={},_0x239b7f={},_0x21b189={'count':0x0,'rows':[]};var _0x171ef6=_['map'](db[_0x7df8('0x28')][_0x7df8('0x29')],function(_0x5f3956){return{'name':_0x5f3956[_0x7df8('0x2a')],'type':_0x5f3956['type'][_0x7df8('0x2b')]};});_0x239b7f[_0x7df8('0x2c')]=_[_0x7df8('0x2d')](_0x171ef6,_0x7df8('0x25'));_0x239b7f[_0x7df8('0x2e')]=_[_0x7df8('0x2f')](_0x4f839d[_0x7df8('0x2e')]);_0x239b7f[_0x7df8('0x30')]=_[_0x7df8('0x31')](_0x239b7f['model'],_0x239b7f[_0x7df8('0x2e')]);_0x383aae[_0x7df8('0x32')]=_['intersection'](_0x239b7f[_0x7df8('0x2c')],qs[_0x7df8('0x33')](_0x4f839d[_0x7df8('0x2e')][_0x7df8('0x33')]));_0x383aae[_0x7df8('0x32')]=_0x383aae[_0x7df8('0x32')]['length']?_0x383aae[_0x7df8('0x32')]:_0x239b7f['model'];if(!_0x4f839d[_0x7df8('0x2e')][_0x7df8('0x34')](_0x7df8('0x35'))){_0x383aae[_0x7df8('0x21')]=qs[_0x7df8('0x21')](_0x4f839d[_0x7df8('0x2e')][_0x7df8('0x21')]);_0x383aae[_0x7df8('0x1f')]=qs[_0x7df8('0x1f')](_0x4f839d['query']['offset']);}_0x383aae[_0x7df8('0x36')]=qs['sort'](_0x4f839d[_0x7df8('0x2e')][_0x7df8('0x37')]);_0x383aae['where']=qs[_0x7df8('0x30')](_['pick'](_0x4f839d[_0x7df8('0x2e')],_0x239b7f['filters']),_0x171ef6);if(_0x4f839d[_0x7df8('0x2e')][_0x7df8('0x38')]){_0x383aae[_0x7df8('0x39')]=_[_0x7df8('0x3a')](_0x383aae['where'],{'$or':_[_0x7df8('0x2d')](_0x171ef6,function(_0x4edecf){if(_0x4edecf[_0x7df8('0x3b')]!=='VIRTUAL'){var _0x10465a={};_0x10465a[_0x4edecf['name']]={'$like':'%'+_0x4f839d[_0x7df8('0x2e')][_0x7df8('0x38')]+'%'};return _0x10465a;}})});}_0x383aae=_['merge']({},_0x383aae,_0x4f839d[_0x7df8('0x3c')]);var _0x4b1bb7={'where':_0x383aae[_0x7df8('0x39')]};return db['MailMessage']['count'](_0x4b1bb7)[_0x7df8('0x13')](function(_0x150831){_0x21b189[_0x7df8('0x3d')]=_0x150831;if(_0x4f839d['query']['includeAll']){_0x383aae[_0x7df8('0x3e')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x383aae);})['then'](function(_0x5d16b8){_0x21b189[_0x7df8('0x3f')]=_0x5d16b8;return _0x21b189;})['then'](respondWithFilteredResult(_0x5f572a,_0x383aae))[_0x7df8('0x40')](handleError(_0x5f572a,null));};exports['show']=function(_0x482ad6,_0x4ee75e){var _0x280df5={'raw':!![],'where':{'id':_0x482ad6[_0x7df8('0x41')]['id']}},_0x2f3b00={};_0x2f3b00[_0x7df8('0x2c')]=_['keys'](db[_0x7df8('0x28')][_0x7df8('0x29')]);_0x2f3b00['query']=_[_0x7df8('0x2f')](_0x482ad6[_0x7df8('0x2e')]);_0x2f3b00[_0x7df8('0x30')]=_[_0x7df8('0x31')](_0x2f3b00[_0x7df8('0x2c')],_0x2f3b00[_0x7df8('0x2e')]);_0x280df5[_0x7df8('0x32')]=_[_0x7df8('0x31')](_0x2f3b00[_0x7df8('0x2c')],qs[_0x7df8('0x33')](_0x482ad6[_0x7df8('0x2e')][_0x7df8('0x33')]));_0x280df5['attributes']=_0x280df5[_0x7df8('0x32')][_0x7df8('0x42')]?_0x280df5[_0x7df8('0x32')]:_0x2f3b00[_0x7df8('0x2c')];if(_0x482ad6[_0x7df8('0x2e')][_0x7df8('0x43')]){_0x280df5['include']=[{'all':!![]}];}_0x280df5=_[_0x7df8('0x3a')]({},_0x280df5,_0x482ad6[_0x7df8('0x3c')]);return db[_0x7df8('0x28')]['find'](_0x280df5)[_0x7df8('0x13')](handleEntityNotFound(_0x4ee75e,null))[_0x7df8('0x13')](respondWithResult(_0x4ee75e,null))[_0x7df8('0x40')](handleError(_0x4ee75e,null));};exports[_0x7df8('0x44')]=function(_0xa9e2dd,_0x59744d){if(_0xa9e2dd['body']['id']){delete _0xa9e2dd[_0x7df8('0x45')]['id'];}return db[_0x7df8('0x28')][_0x7df8('0x46')]({'where':{'id':_0xa9e2dd[_0x7df8('0x41')]['id']}})[_0x7df8('0x13')](handleEntityNotFound(_0x59744d,null))[_0x7df8('0x13')](saveUpdates(_0xa9e2dd[_0x7df8('0x45')],null))[_0x7df8('0x13')](respondWithResult(_0x59744d,null))['catch'](handleError(_0x59744d,null));};exports[_0x7df8('0x23')]=function(_0x53e8d0,_0x1c190e){return db[_0x7df8('0x28')][_0x7df8('0x46')]({'where':{'id':_0x53e8d0[_0x7df8('0x41')]['id']}})[_0x7df8('0x13')](handleEntityNotFound(_0x1c190e,null))[_0x7df8('0x13')](removeEntity(_0x1c190e,null))[_0x7df8('0x40')](handleError(_0x1c190e,null));};exports[_0x7df8('0x47')]=function(_0x5f3b7c,_0x335195){return db[_0x7df8('0x28')]['describe']()[_0x7df8('0x13')](respondWithResult(_0x335195,null))[_0x7df8('0x40')](handleError(_0x335195,null));};exports[_0x7df8('0x48')]=function(_0x434393,_0x16d059){return db[_0x7df8('0x28')][_0x7df8('0x48')](_0x434393['body'])[_0x7df8('0x13')](function(_0x50853a){if(_0x50853a){if(_0x50853a[_0x7df8('0x49')]===_0x7df8('0x4a')&&!_0x50853a['secret']){var _0x47d990,_0x2a796e,_0x245e84;if(_0x434393['body']['to']){_0x2a796e=_0x434393[_0x7df8('0x45')]['to'][_0x7df8('0x4b')](',')[0x0];}return db[_0x7df8('0x4c')][_0x7df8('0x4d')]({'where':{'id':_0x50853a['MailAccountId']},'include':[{'model':db['CmList'],'as':_0x7df8('0x4e'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x2a796e},'limit':0x1,'order':[[_0x7df8('0x4f'),_0x7df8('0x50')]]}]},{'model':db[_0x7df8('0x51')],'as':_0x7df8('0x52'),'raw':!![]}]})[_0x7df8('0x13')](function(_0x3739cb){_0x47d990=_0x3739cb;if(_0x47d990&&_0x47d990['Smtp']){var _0x210848={'tls':{'rejectUnauthorized':![]}};if(_[_0x7df8('0x53')](_0x47d990[_0x7df8('0x52')][_0x7df8('0x54')])){_0x210848[_0x7df8('0x55')]=_0x47d990[_0x7df8('0x52')][_0x7df8('0x55')];_0x210848[_0x7df8('0x56')]=_0x47d990[_0x7df8('0x52')]['port'];_0x210848[_0x7df8('0x57')]=_0x47d990['Smtp'][_0x7df8('0x57')];if(_0x47d990[_0x7df8('0x52')]['authentication']){_0x210848[_0x7df8('0x58')]={'user':_0x47d990[_0x7df8('0x52')]['user'],'pass':_0x47d990[_0x7df8('0x52')][_0x7df8('0x59')]};}}else{_0x210848['service']=_0x47d990['Smtp']['service'];_0x210848[_0x7df8('0x58')]={'user':_0x47d990[_0x7df8('0x52')][_0x7df8('0x5a')],'pass':_0x47d990['Smtp'][_0x7df8('0x59')]};_0x210848[_0x7df8('0x57')]=_0x47d990[_0x7df8('0x52')][_0x7df8('0x57')];}if(_0x434393[_0x7df8('0x45')]['attachments']&&_0x434393[_0x7df8('0x45')]['attachments']['length']){for(var _0x43b72b=0x0;_0x43b72b<_0x434393['body']['attachments']['length'];_0x43b72b+=0x1){_0x434393['body'][_0x7df8('0x5b')][_0x43b72b]={'filename':_0x434393[_0x7df8('0x45')][_0x7df8('0x5b')][_0x43b72b][_0x7df8('0x25')],'path':path[_0x7df8('0x5c')](config[_0x7df8('0x5d')],_0x7df8('0x5e'),_0x434393[_0x7df8('0x45')][_0x7df8('0x5b')][_0x43b72b]['basename'])};}}_0x245e84={'account':_0x210848,'message':_0x434393[_0x7df8('0x45')]};return;}})[_0x7df8('0x13')](function(){if(_0x47d990[_0x7df8('0x4e')]){if(_0x47d990['List'][_0x7df8('0x5f')][_0x7df8('0x42')]){return _0x47d990[_0x7df8('0x4e')][_0x7df8('0x5f')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x434393[_0x7df8('0x45')],{'firstName':_0x434393[_0x7df8('0x45')]['to'],'email':_0x434393[_0x7df8('0x45')]['to'],'phone':_0x434393[_0x7df8('0x45')]['to'],'ListId':_0x47d990[_0x7df8('0x60')]}));}}else{throw new Error(_0x7df8('0x61'));}})[_0x7df8('0x13')](function(){if(_0x245e84){return respondWithRpcPromise('SendMail',_0x7df8('0x62'),_0x245e84,client9003)[_0x7df8('0x13')](function(_0x5ce01e){return _0x50853a[_0x7df8('0x44')]({'read':!![],'messageId':_0x5ce01e[_0x7df8('0x63')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x7df8('0x40')](function(_0x3d514f){logger['error']('%s',JSON[_0x7df8('0x18')](_0x3d514f));return _0x50853a;});}return _0x50853a;});}return _0x50853a;}})[_0x7df8('0x13')](respondWithResult(_0x16d059,0xc9))[_0x7df8('0x40')](handleError(_0x16d059,null));};exports[_0x7df8('0x64')]=function(_0x1d6236,_0xa11e69){var _0x9d5a71={'agent':{},'channel':'mail'};if(_0x1d6236[_0x7df8('0x45')]['id']){delete _0x1d6236[_0x7df8('0x45')]['id'];}_0x1d6236[_0x7df8('0x45')][_0x7df8('0x65')]=!![];_0x1d6236['body'][_0x7df8('0x66')]=moment()[_0x7df8('0x67')](_0x7df8('0x68'));_0x1d6236[_0x7df8('0x45')][_0x7df8('0x69')]=_0x1d6236[_0x7df8('0x45')]['UserId']||_0x1d6236[_0x7df8('0x5a')]['id'];_0x9d5a71[_0x7df8('0x6a')]['id']=_0x1d6236[_0x7df8('0x45')][_0x7df8('0x69')];return db[_0x7df8('0x28')][_0x7df8('0x46')]({'where':{'id':_0x1d6236[_0x7df8('0x41')]['id'],'UserId':null}})[_0x7df8('0x13')](handleEntityNotFound(_0xa11e69,null))[_0x7df8('0x13')](saveUpdates(_0x1d6236[_0x7df8('0x45')],null))['then'](function(_0x5acf38){if(_0x5acf38){_0x9d5a71[_0x7df8('0x1b')]=_0x5acf38[_0x7df8('0x6b')]({'plain':!![]});return db['MailInteraction'][_0x7df8('0x46')]({'where':{'id':_0x5acf38['MailInteractionId']}});}return null;})[_0x7df8('0x13')](handleEntityNotFound(_0xa11e69,null))[_0x7df8('0x13')](function(_0x4479c6){if(_0x4479c6){return _0x4479c6[_0x7df8('0x44')]({'UserId':_0x1d6236[_0x7df8('0x45')][_0x7df8('0x69')],'read1stAt':_[_0x7df8('0x53')](_0x4479c6[_0x7df8('0x6c')])?moment()[_0x7df8('0x67')](_0x7df8('0x68')):undefined});}return null;})[_0x7df8('0x13')](function(_0xb1f252){if(_0xb1f252){_0x9d5a71[_0x7df8('0x6d')]=_0xb1f252['get']({'plain':!![]});interaction_log[_0x7df8('0x14')](_0x7df8('0x6e'),_0x1d6236[_0x7df8('0x5a')]['id'],_0x1d6236[_0x7df8('0x5a')]['name'],_0x1d6236[_0x7df8('0x5a')][_0x7df8('0x6f')],_0x9d5a71[_0x7df8('0x6d')]['id'],_0x1d6236[_0x7df8('0x45')]?JSON[_0x7df8('0x18')](_0x1d6236[_0x7df8('0x45')]):_0x7df8('0x70'));return respondWithRpcPromise(_0x7df8('0x71'),_0x7df8('0x72'),_0x9d5a71);}return null;})['then'](function(_0x3aeada){var _0x175ac3=_0x7df8('0x73')+_0x3aeada[_0x7df8('0x1b')][_0x7df8('0x74')];return db[_0x7df8('0x75')][_0x7df8('0x2e')](_0x175ac3,{'type':db[_0x7df8('0x76')][_0x7df8('0x77')][_0x7df8('0x78')],'raw':!![]})[_0x7df8('0x13')](function(_0x1bd63d){return _0x1bd63d;});})[_0x7df8('0x13')](function(_0x3389c9){if(_0x3389c9){_0x9d5a71[_0x7df8('0x1b')][_0x7df8('0x79')]=_0x3389c9[0x0];if(!_0x1d6236[_0x7df8('0x45')]['UserId'])return;return db[_0x7df8('0x7a')][_0x7df8('0x46')]({'where':{'id':_0x1d6236[_0x7df8('0x45')][_0x7df8('0x69')],'role':_0x7df8('0x6a')},'attributes':['id','name','fullname',_0x7df8('0x7b'),'internal'],'raw':!![]});}return null;})[_0x7df8('0x13')](function(_0x35f858){if(!_0x35f858)return null;_0x9d5a71[_0x7df8('0x1b')][_0x7df8('0x6a')]=_0x35f858;return _0x9d5a71;})[_0x7df8('0x13')](function(_0x2af9ba){if(_0x2af9ba){if(_0x1d6236[_0x7df8('0x45')]['manual']){_0x9d5a71['message'][_0x7df8('0x7c')]=util[_0x7df8('0x67')]('SIP/%s',_0x1d6236[_0x7df8('0x5a')][_0x7df8('0x25')]);_0x9d5a71[_0x7df8('0x1b')][_0x7df8('0x7d')]=_0x9d5a71[_0x7df8('0x7d')];_0x9d5a71[_0x7df8('0x1b')]['motionChannel']=_0x9d5a71['channel'];_0x9d5a71['message']['event']=_0x7df8('0x64');_0x9d5a71[_0x7df8('0x1b')][_0x7df8('0x45')]=htmlToText[_0x7df8('0x7e')](_0x9d5a71[_0x7df8('0x1b')][_0x7df8('0x45')]);return respondWithRpcPromise(_0x7df8('0x7f'),_0x7df8('0x7f'),{'event':'acceptmessage','message':_0x9d5a71[_0x7df8('0x1b')]},client9002)[_0x7df8('0x13')](function(){return _0x9d5a71;});}return _0x9d5a71;}return null;})[_0x7df8('0x13')](respondWithResult(_0xa11e69,null))[_0x7df8('0x40')](handleError(_0xa11e69,null));};exports[_0x7df8('0x80')]=function(_0x2f32c1,_0x228029){var _0x257b04={'agent':{},'channel':'mail'};if(_0x2f32c1[_0x7df8('0x45')]['id']){delete _0x2f32c1[_0x7df8('0x45')]['id'];}_0x2f32c1['body']['UserId']=_0x2f32c1['body'][_0x7df8('0x69')]||_0x2f32c1[_0x7df8('0x5a')]['id'];_0x257b04[_0x7df8('0x6a')]['id']=_0x2f32c1[_0x7df8('0x45')][_0x7df8('0x69')];return db[_0x7df8('0x28')]['find']({'where':{'id':_0x2f32c1[_0x7df8('0x41')]['id'],'UserId':null}})[_0x7df8('0x13')](handleEntityNotFound(_0x228029,null))[_0x7df8('0x13')](function(_0x49040b){if(_0x49040b){_0x257b04[_0x7df8('0x1b')]=_0x49040b[_0x7df8('0x6b')]({'plain':!![]});return db['MailInteraction'][_0x7df8('0x46')]({'where':{'id':_0x49040b[_0x7df8('0x81')]}});}return null;})[_0x7df8('0x13')](handleEntityNotFound(_0x228029,null))[_0x7df8('0x13')](function(_0x53580c){if(_0x53580c){_0x257b04[_0x7df8('0x6d')]=_0x53580c[_0x7df8('0x6b')]({'plain':!![]});interaction_log[_0x7df8('0x14')](_0x7df8('0x82'),_0x2f32c1['user']['id'],_0x2f32c1[_0x7df8('0x5a')]['name'],_0x2f32c1[_0x7df8('0x5a')][_0x7df8('0x6f')],_0x257b04[_0x7df8('0x6d')]['id'],_0x2f32c1[_0x7df8('0x45')]?JSON['stringify'](_0x2f32c1[_0x7df8('0x45')]):'null');return respondWithRpcPromise(_0x7df8('0x83'),'rejectMessage',_0x257b04);}return null;})['then'](function(_0x5771ec){var _0x4d2501=_0x7df8('0x73')+_0x5771ec['message'][_0x7df8('0x74')];return db['sequelize']['query'](_0x4d2501,{'type':db[_0x7df8('0x76')][_0x7df8('0x77')][_0x7df8('0x78')],'raw':!![]})[_0x7df8('0x13')](function(_0xac20db){return _0xac20db;});})[_0x7df8('0x13')](function(_0x37d791){if(_0x37d791){_0x257b04[_0x7df8('0x1b')][_0x7df8('0x79')]=_0x37d791[0x0];if(!_0x2f32c1[_0x7df8('0x45')]['UserId'])return;return db['User']['find']({'where':{'id':_0x2f32c1[_0x7df8('0x45')]['UserId'],'role':_0x7df8('0x6a')},'attributes':['id',_0x7df8('0x25'),_0x7df8('0x84'),_0x7df8('0x7b'),_0x7df8('0x85')],'raw':!![]});}return null;})[_0x7df8('0x13')](function(_0x23843b){if(!_0x23843b)return null;_0x257b04['message'][_0x7df8('0x6a')]=_0x23843b;return _0x257b04;})[_0x7df8('0x13')](function(_0x4cccb6){if(_0x4cccb6){_0x4cccb6['message']['interface']=util[_0x7df8('0x67')]('SIP/%s',_0x2f32c1[_0x7df8('0x5a')][_0x7df8('0x25')]);_0x4cccb6['message'][_0x7df8('0x7d')]=_0x257b04[_0x7df8('0x7d')];_0x4cccb6[_0x7df8('0x1b')][_0x7df8('0x86')]=_0x257b04[_0x7df8('0x7d')];_0x4cccb6[_0x7df8('0x1b')][_0x7df8('0x87')]=_0x7df8('0x80');_0x4cccb6[_0x7df8('0x1b')][_0x7df8('0x45')]=htmlToText[_0x7df8('0x7e')](_0x257b04[_0x7df8('0x1b')][_0x7df8('0x45')]);respondWithRpcPromise('EventManager','EventManager',{'event':_0x7df8('0x88'),'message':_0x4cccb6[_0x7df8('0x1b')]},client9002);return _0x257b04;}return null;})[_0x7df8('0x13')](respondWithResult(_0x228029,null))['catch'](handleError(_0x228029,null));};exports[_0x7df8('0x89')]=function(_0x1c4b81,_0x229f79){var _0x1e403b=moment()[_0x7df8('0x8a')]()[_0x7df8('0x8b')]();var _0x2f5fbb=path[_0x7df8('0x5c')](config[_0x7df8('0x5d')],_0x7df8('0x8c'),_0x7df8('0x8d'),_0x7df8('0x8e'));var _0x586f4a=path[_0x7df8('0x5c')](config[_0x7df8('0x5d')],_0x7df8('0x8c'),_0x7df8('0x8d'),_0x7df8('0x5b'));var _0x11d1cd=util[_0x7df8('0x67')](_0x7df8('0x8f'),_0x1e403b);return db[_0x7df8('0x28')][_0x7df8('0x46')]({'where':{'id':_0x1c4b81[_0x7df8('0x41')]['id']},'attributes':['id','body',_0x7df8('0x90'),'to','cc',_0x7df8('0x91'),_0x7df8('0x92'),_0x7df8('0x93')],'include':_0x1c4b81[_0x7df8('0x2e')][_0x7df8('0x5b')]?[{'model':db[_0x7df8('0x94')],'as':_0x7df8('0x95')}]:undefined})[_0x7df8('0x13')](handleEntityNotFound(_0x229f79,null))[_0x7df8('0x13')](function(_0x590e0f){if(_0x590e0f){var _0x5d375a=_0x590e0f;var _0x505033={'from':_0x5d375a[_0x7df8('0x90')],'to':_0x5d375a['to'],'subject':_0x5d375a['subject'],'html':_0x5d375a['body'],'headers':{'Date':moment(_0x5d375a[_0x7df8('0x93')])[_0x7df8('0x67')](_0x7df8('0x96'))},'attachments':[]};if(_0x590e0f['cc']){_0x505033[_0x7df8('0x97')]['Cc']=_0x590e0f['cc'];}if(_0x590e0f[_0x7df8('0x91')]){_0x505033[_0x7df8('0x97')]['Bcc']=_0x590e0f[_0x7df8('0x91')];}return new BPromise(function(_0x2aee5e,_0x52b77c){if(_0x590e0f[_0x7df8('0x95')]){for(var _0x4eab56=0x0;_0x4eab56<_0x590e0f[_0x7df8('0x95')][_0x7df8('0x42')];_0x4eab56++){var _0x26f5f7=_0x590e0f[_0x7df8('0x95')][_0x4eab56];var _0x135989=path[_0x7df8('0x5c')](_0x586f4a,_0x26f5f7[_0x7df8('0x98')]);if(fs[_0x7df8('0x99')](_0x135989)){_0x505033[_0x7df8('0x5b')][_0x7df8('0x9a')]({'name':_0x26f5f7[_0x7df8('0x25')],'contentType':_0x26f5f7[_0x7df8('0x3b')],'data':fs['readFileSync'](_0x135989)});}}}emlformat[_0x7df8('0x9b')](_0x505033,function(_0xb1fddb,_0x22735c){if(_0xb1fddb)return _0x52b77c(_0xb1fddb);fs[_0x7df8('0x9c')](path[_0x7df8('0x5c')](_0x2f5fbb,_0x11d1cd),_0x22735c);return _0x2aee5e(_0x22735c);});});}})['then'](function(_0x46cfe1){if(_0x46cfe1){return _0x229f79['download'](path[_0x7df8('0x5c')](_0x2f5fbb,_0x11d1cd),_0x11d1cd,function(_0x482f25){if(!_0x482f25)fs[_0x7df8('0x9d')](path[_0x7df8('0x5c')](_0x2f5fbb,_0x11d1cd));});}})[_0x7df8('0x40')](handleError(_0x229f79,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index aacbcd7..abe78a3 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 _0xe898=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','update'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xe898,0x154));var _0x8e89=function(_0xf42142,_0x448cd8){_0xf42142=_0xf42142-0x0;var _0x195537=_0xe898[_0xf42142];return _0x195537;};'use strict';var EventEmitter=require(_0x8e89('0x0'));var MailMessage=require(_0x8e89('0x1'))['db'][_0x8e89('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8e89('0x3'),'afterDestroy':'remove'};function emitEvent(_0x57fac9){return function(_0x2c5cb1,_0x598b47,_0x52b28f){MailMessageEvents[_0x8e89('0x4')](_0x57fac9+':'+_0x2c5cb1['id'],_0x2c5cb1);MailMessageEvents[_0x8e89('0x4')](_0x57fac9,_0x2c5cb1);_0x52b28f(null);};}for(var e in events){if(events[_0x8e89('0x5')](e)){var event=events[e];MailMessage[_0x8e89('0x6')](e,emitEvent(event));}}module[_0x8e89('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x98be=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x52c9d9,_0x27e60c){var _0x3410a8=function(_0xf052cd){while(--_0xf052cd){_0x52c9d9['push'](_0x52c9d9['shift']());}};_0x3410a8(++_0x27e60c);}(_0x98be,0x7e));var _0xe98b=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x98be[_0x125ff8];return _0x2d9ef;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xe98b('0x0'))['db'][_0xe98b('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe98b('0x2')](0x0);var events={'afterCreate':_0xe98b('0x3'),'afterUpdate':_0xe98b('0x4'),'afterDestroy':_0xe98b('0x5')};function emitEvent(_0x4a75cd){return function(_0x42cc84,_0x539853,_0x5df249){MailMessageEvents[_0xe98b('0x6')](_0x4a75cd+':'+_0x42cc84['id'],_0x42cc84);MailMessageEvents[_0xe98b('0x6')](_0x4a75cd,_0x42cc84);_0x5df249(null);};}for(var e in events){if(events[_0xe98b('0x7')](e)){var event=events[e];MailMessage[_0xe98b('0x8')](e,emitEvent(event));}}module[_0xe98b('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index dd33ffd..cfac32a 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 _0x7725=['error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','get','toLowerCase','direction','out','secret','isNil','MailInteraction','findOne','MailInteractionId','then','update','catch'];(function(_0x3fd1b7,_0x397bfc){var _0x258057=function(_0x17b316){while(--_0x17b316){_0x3fd1b7['push'](_0x3fd1b7['shift']());}};_0x258057(++_0x397bfc);}(_0x7725,0xea));var _0x5772=function(_0xf0330b,_0x814253){_0xf0330b=_0xf0330b-0x0;var _0x538518=_0x7725[_0xf0330b];return _0x538518;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5772('0x0'))(_0x5772('0x1'));var moment=require(_0x5772('0x2'));var BPromise=require('bluebird');var rp=require(_0x5772('0x3'));var htmlToText=require(_0x5772('0x4'));var fs=require('fs');var path=require(_0x5772('0x5'));var rimraf=require(_0x5772('0x6'));var config=require(_0x5772('0x7'));var attributes=require(_0x5772('0x8'));module[_0x5772('0x9')]=function(_0x5d789e,_0x3ed448){return _0x5d789e[_0x5772('0xa')]('MailMessage',attributes,{'tableName':_0x5772('0xb'),'paranoid':![],'indexes':[{'name':_0x5772('0xc'),'fields':[_0x5772('0xc')]},{'name':_0x5772('0xd'),'fields':[_0x5772('0xe'),_0x5772('0xf')],'type':_0x5772('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1817af,_0x5723c3,_0x20105b){if(_0x1817af[_0x5772('0x11')]){_0x1817af['plainBody']=htmlToText['fromString'](_0x1817af[_0x5772('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x20105b(null,_0x5723c3);},'afterCreate':function(_0x45c0b2,_0x34b230,_0x481536){var _0x5c467b=_0x5d789e['models'];var _0x3ca732=_0x45c0b2[_0x5772('0x12')]({'plain':!![]});if(_0x3ca732['direction'][_0x5772('0x13')]()==='in'||_0x3ca732[_0x5772('0x14')][_0x5772('0x13')]()===_0x5772('0x15')&&!_0x3ca732[_0x5772('0x16')]&&!_[_0x5772('0x17')](_0x3ca732['UserId'])){_0x5c467b[_0x5772('0x18')][_0x5772('0x19')]({'where':{'id':_0x3ca732[_0x5772('0x1a')]}})[_0x5772('0x1b')](function(_0x565d36){if(_0x565d36){_0x565d36[_0x5772('0x1c')]({'lastMsgAt':_0x3ca732['createdAt'],'lastMsgDirection':_0x3ca732[_0x5772('0x14')]['toLowerCase']()});}})[_0x5772('0x1d')](function(_0x51800c){console[_0x5772('0x1e')](_0x51800c);});}_0x481536();}},'charset':_0x5772('0x1f'),'collate':_0x5772('0x20')});}; \ No newline at end of file +var _0x67fa=['fromString','models','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body'];(function(_0x1fa5aa,_0x32648f){var _0x1c532f=function(_0x58661d){while(--_0x58661d){_0x1fa5aa['push'](_0x1fa5aa['shift']());}};_0x1c532f(++_0x32648f);}(_0x67fa,0xd6));var _0xa67f=function(_0x4b247a,_0x58ec71){_0x4b247a=_0x4b247a-0x0;var _0x54aaf2=_0x67fa[_0x4b247a];return _0x54aaf2;};'use strict';var _=require(_0xa67f('0x0'));var util=require(_0xa67f('0x1'));var logger=require('../../config/logger')(_0xa67f('0x2'));var moment=require(_0xa67f('0x3'));var BPromise=require('bluebird');var rp=require(_0xa67f('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xa67f('0x5'));var rimraf=require(_0xa67f('0x6'));var config=require('../../config/environment');var attributes=require(_0xa67f('0x7'));module[_0xa67f('0x8')]=function(_0x41b799,_0x3b0000){return _0x41b799[_0xa67f('0x9')](_0xa67f('0xa'),attributes,{'tableName':_0xa67f('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xa67f('0xc')]},{'name':'fti_mail_messages','fields':[_0xa67f('0xd'),_0xa67f('0xe')],'type':_0xa67f('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1c84a2,_0x5c8975,_0x45642a){if(_0x1c84a2[_0xa67f('0x10')]){_0x1c84a2[_0xa67f('0xd')]=htmlToText[_0xa67f('0x11')](_0x1c84a2[_0xa67f('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x45642a(null,_0x5c8975);},'afterCreate':function(_0x40262c,_0xbd00c7,_0x102d2d){var _0x404e92=_0x41b799[_0xa67f('0x12')];var _0x32d8c7=_0x40262c[_0xa67f('0x13')]({'plain':!![]});if(_0x32d8c7[_0xa67f('0x14')]['toLowerCase']()==='in'||_0x32d8c7[_0xa67f('0x14')][_0xa67f('0x15')]()==='out'&&!_0x32d8c7[_0xa67f('0x16')]&&!_[_0xa67f('0x17')](_0x32d8c7[_0xa67f('0x18')])){_0x404e92[_0xa67f('0x19')][_0xa67f('0x1a')]({'where':{'id':_0x32d8c7['MailInteractionId']}})[_0xa67f('0x1b')](function(_0x55f29e){if(_0x55f29e){_0x55f29e['update']({'lastMsgAt':_0x32d8c7[_0xa67f('0x1c')],'lastMsgDirection':_0x32d8c7[_0xa67f('0x14')][_0xa67f('0x15')]()});}})[_0xa67f('0x1d')](function(_0x3a730a){console[_0xa67f('0x1e')](_0x3a730a);});}_0x102d2d();}},'charset':_0xa67f('0x1f'),'collate':_0xa67f('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 2b22808..fcc3230 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 _0x1c7c=['then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','CreateMailMessage','MailMessage','options','raw','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x264b03,_0x2249cb){var _0x3a99da=function(_0x25ec0e){while(--_0x25ec0e){_0x264b03['push'](_0x264b03['shift']());}};_0x3a99da(++_0x2249cb);}(_0x1c7c,0x164));var _0xc1c7=function(_0x5a08e9,_0x3dbdd3){_0x5a08e9=_0x5a08e9-0x0;var _0x5c76cf=_0x1c7c[_0x5a08e9];return _0x5c76cf;};'use strict';var _=require(_0xc1c7('0x0'));var util=require(_0xc1c7('0x1'));var moment=require(_0xc1c7('0x2'));var BPromise=require(_0xc1c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1c7('0x5'));var logger=require(_0xc1c7('0x6'))(_0xc1c7('0x7'));var config=require(_0xc1c7('0x8'));var jayson=require(_0xc1c7('0x9'));var client=jayson[_0xc1c7('0xa')][_0xc1c7('0xb')]({'port':0x232a});config[_0xc1c7('0xc')]=_[_0xc1c7('0xd')](config[_0xc1c7('0xc')],{'host':_0xc1c7('0xe'),'port':0x18eb});var socket=require(_0xc1c7('0xf'))(new Redis(config[_0xc1c7('0xc')]));require(_0xc1c7('0x10'))[_0xc1c7('0x11')](socket);function respondWithRpcPromise(_0x301abf,_0x25a669,_0x4df577){return new BPromise(function(_0x3b0748,_0x246ced){return client['request'](_0x301abf,_0x4df577)[_0xc1c7('0x12')](function(_0x5ac140){logger[_0xc1c7('0x13')]('MailMessage,\x20%s,\x20%s',_0x25a669,_0xc1c7('0x14'));logger[_0xc1c7('0x15')](_0xc1c7('0x16'),_0x25a669,_0xc1c7('0x14'),JSON[_0xc1c7('0x17')](_0x5ac140));if(_0x5ac140[_0xc1c7('0x18')]){if(_0x5ac140[_0xc1c7('0x18')][_0xc1c7('0x19')]===0x1f4){logger[_0xc1c7('0x18')](_0xc1c7('0x1a'),_0x25a669,_0x5ac140[_0xc1c7('0x18')][_0xc1c7('0x1b')]);return _0x246ced(_0x5ac140['error'][_0xc1c7('0x1b')]);}logger[_0xc1c7('0x18')](_0xc1c7('0x1a'),_0x25a669,_0x5ac140['error'][_0xc1c7('0x1b')]);return _0x3b0748(_0x5ac140[_0xc1c7('0x18')][_0xc1c7('0x1b')]);}else{logger[_0xc1c7('0x13')](_0xc1c7('0x1a'),_0x25a669,_0xc1c7('0x14'));_0x3b0748(_0x5ac140[_0xc1c7('0x1c')][_0xc1c7('0x1b')]);}})['catch'](function(_0x37d748){logger[_0xc1c7('0x18')](_0xc1c7('0x1a'),_0x25a669,_0x37d748);_0x246ced(_0x37d748);});});}exports[_0xc1c7('0x1d')]=function(_0x4b706e){var _0x124fd8=this;return new Promise(function(_0x4d6171,_0x5e7e4a){return db[_0xc1c7('0x1e')]['create'](_0x4b706e['body'],{'raw':_0x4b706e[_0xc1c7('0x1f')]?_0x4b706e[_0xc1c7('0x1f')][_0xc1c7('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x813853){logger[_0xc1c7('0x13')](_0xc1c7('0x1d'),_0x4b706e);logger[_0xc1c7('0x15')](_0xc1c7('0x1d'),_0x4b706e,JSON[_0xc1c7('0x17')](_0x813853));_0x4d6171(_0x813853);})[_0xc1c7('0x21')](function(_0x120168){logger[_0xc1c7('0x18')](_0xc1c7('0x1d'),_0x120168[_0xc1c7('0x1b')],_0x4b706e);_0x5e7e4a(_0x124fd8[_0xc1c7('0x18')](0x1f4,_0x120168[_0xc1c7('0x1b')]));});});}; \ No newline at end of file +var _0x63a5=['error','message','result','catch','body','options','raw','CreateMailMessage','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x556d6a,_0x5e2996){var _0x59a6a4=function(_0x3ad39b){while(--_0x3ad39b){_0x556d6a['push'](_0x556d6a['shift']());}};_0x59a6a4(++_0x5e2996);}(_0x63a5,0x18e));var _0x563a=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x63a5[_0x381589];return _0x2a075d;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var moment=require(_0x563a('0x2'));var BPromise=require('bluebird');var rs=require(_0x563a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x563a('0x4'))['db'];var utils=require(_0x563a('0x5'));var logger=require(_0x563a('0x6'))(_0x563a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x563a('0x8')]['http']({'port':0x232a});config[_0x563a('0x9')]=_[_0x563a('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x563a('0xb'))(new Redis(config[_0x563a('0x9')]));require(_0x563a('0xc'))[_0x563a('0xd')](socket);function respondWithRpcPromise(_0x255922,_0xa61ffa,_0xd1b480){return new BPromise(function(_0x381fab,_0x3e97a8){return client[_0x563a('0xe')](_0x255922,_0xd1b480)[_0x563a('0xf')](function(_0x2361dd){logger[_0x563a('0x10')](_0x563a('0x11'),_0xa61ffa,'request\x20sent');logger[_0x563a('0x12')](_0x563a('0x13'),_0xa61ffa,_0x563a('0x14'),JSON[_0x563a('0x15')](_0x2361dd));if(_0x2361dd[_0x563a('0x16')]){if(_0x2361dd[_0x563a('0x16')]['code']===0x1f4){logger[_0x563a('0x16')](_0x563a('0x11'),_0xa61ffa,_0x2361dd[_0x563a('0x16')][_0x563a('0x17')]);return _0x3e97a8(_0x2361dd['error']['message']);}logger[_0x563a('0x16')](_0x563a('0x11'),_0xa61ffa,_0x2361dd['error'][_0x563a('0x17')]);return _0x381fab(_0x2361dd[_0x563a('0x16')][_0x563a('0x17')]);}else{logger[_0x563a('0x10')]('MailMessage,\x20%s,\x20%s',_0xa61ffa,'request\x20sent');_0x381fab(_0x2361dd[_0x563a('0x18')][_0x563a('0x17')]);}})[_0x563a('0x19')](function(_0x526a51){logger['error']('MailMessage,\x20%s,\x20%s',_0xa61ffa,_0x526a51);_0x3e97a8(_0x526a51);});});}exports['CreateMailMessage']=function(_0x40916a){var _0x300956=this;return new Promise(function(_0x26061f,_0x43b7a8){return db['MailMessage']['create'](_0x40916a[_0x563a('0x1a')],{'raw':_0x40916a[_0x563a('0x1b')]?_0x40916a[_0x563a('0x1b')][_0x563a('0x1c')]===undefined?!![]:![]:!![]})[_0x563a('0xf')](function(_0x2dc7e2){logger[_0x563a('0x10')](_0x563a('0x1d'),_0x40916a);logger['debug'](_0x563a('0x1d'),_0x40916a,JSON['stringify'](_0x2dc7e2));_0x26061f(_0x2dc7e2);})[_0x563a('0x19')](function(_0xd3e0ae){logger[_0x563a('0x16')](_0x563a('0x1d'),_0xd3e0ae[_0x563a('0x17')],_0x40916a);_0x43b7a8(_0x300956[_0x563a('0x16')](0x1f4,_0xd3e0ae[_0x563a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index ddacd63..423fe03 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 _0x6c52=['register','length','mailMessage:','save','remove','update'];(function(_0x18e3e9,_0x15724c){var _0x253a72=function(_0x201454){while(--_0x201454){_0x18e3e9['push'](_0x18e3e9['shift']());}};_0x253a72(++_0x15724c);}(_0x6c52,0x1b3));var _0x26c5=function(_0x28fdc2,_0x298889){_0x28fdc2=_0x28fdc2-0x0;var _0x437735=_0x6c52[_0x28fdc2];return _0x437735;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x26c5('0x0'),_0x26c5('0x1'),_0x26c5('0x2')];function createListener(_0xd0e0e,_0x3ae944){return function(_0x403968){_0x3ae944['emit'](_0xd0e0e,_0x403968);};}function removeListener(_0x1ea950,_0x2f4c34){return function(){MailMessageEvents['removeListener'](_0x1ea950,_0x2f4c34);};}exports[_0x26c5('0x3')]=function(_0x2146cf){for(var _0x19c420=0x0,_0x1d9594=events[_0x26c5('0x4')];_0x19c420<_0x1d9594;_0x19c420++){var _0x41c356=events[_0x19c420];var _0x3ec8ba=createListener(_0x26c5('0x5')+_0x41c356,_0x2146cf);MailMessageEvents['on'](_0x41c356,_0x3ec8ba);}}; \ No newline at end of file +var _0xe334=['register','length','mailMessage:','./mailMessage.events','remove','update','emit'];(function(_0x3d78d6,_0x114cf3){var _0xf28e17=function(_0x4f96c2){while(--_0x4f96c2){_0x3d78d6['push'](_0x3d78d6['shift']());}};_0xf28e17(++_0x114cf3);}(_0xe334,0x199));var _0x4e33=function(_0x153510,_0x5f0899){_0x153510=_0x153510-0x0;var _0x46336d=_0xe334[_0x153510];return _0x46336d;};'use strict';var MailMessageEvents=require(_0x4e33('0x0'));var events=['save',_0x4e33('0x1'),_0x4e33('0x2')];function createListener(_0x30f918,_0x414092){return function(_0x37a652){_0x414092[_0x4e33('0x3')](_0x30f918,_0x37a652);};}function removeListener(_0x2df811,_0x51804d){return function(){MailMessageEvents['removeListener'](_0x2df811,_0x51804d);};}exports[_0x4e33('0x4')]=function(_0x2d0a90){for(var _0x31d947=0x0,_0x548210=events[_0x4e33('0x5')];_0x31d947<_0x548210;_0x31d947++){var _0x11812c=events[_0x31d947];var _0x71fcf6=createListener(_0x4e33('0x6')+_0x11812c,_0x2d0a90);MailMessageEvents['on'](_0x11812c,_0x71fcf6);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index d86478f..ed1c5e6 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 _0xe722=['/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get'];(function(_0x500785,_0x5b1b06){var _0x5e9ea1=function(_0x17c0c2){while(--_0x17c0c2){_0x500785['push'](_0x500785['shift']());}};_0x5e9ea1(++_0x5b1b06);}(_0xe722,0x189));var _0x2e72=function(_0x323c4b,_0x281826){_0x323c4b=_0x323c4b-0x0;var _0x5264dd=_0xe722[_0x323c4b];return _0x5264dd;};'use strict';var multer=require(_0x2e72('0x0'));var util=require(_0x2e72('0x1'));var path=require(_0x2e72('0x2'));var timeout=require(_0x2e72('0x3'));var express=require(_0x2e72('0x4'));var router=express['Router']();var fs_extra=require(_0x2e72('0x5'));var auth=require(_0x2e72('0x6'));var interaction=require(_0x2e72('0x7'));var config=require(_0x2e72('0x8'));var controller=require(_0x2e72('0x9'));router['get']('/',auth[_0x2e72('0xa')](),controller[_0x2e72('0xb')]);router[_0x2e72('0xc')](_0x2e72('0xd'),auth[_0x2e72('0xa')](),controller['describe']);router[_0x2e72('0xc')](_0x2e72('0xe'),auth['isAuthenticated'](),controller[_0x2e72('0xf')]);router[_0x2e72('0xc')](_0x2e72('0x10'),auth[_0x2e72('0xa')](),controller[_0x2e72('0x11')]);router[_0x2e72('0xc')](_0x2e72('0x12'),auth['isAuthenticated'](),controller[_0x2e72('0x13')]);router[_0x2e72('0xc')](_0x2e72('0x14'),auth[_0x2e72('0xa')](),controller[_0x2e72('0x15')]);router[_0x2e72('0x16')]('/',auth[_0x2e72('0xa')](),controller['create']);router[_0x2e72('0x16')](_0x2e72('0x12'),auth[_0x2e72('0xa')](),controller[_0x2e72('0x17')]);router[_0x2e72('0x16')](_0x2e72('0x14'),auth[_0x2e72('0xa')](),controller['addAgents']);router[_0x2e72('0x18')]('/:id',auth[_0x2e72('0xa')](),controller['update']);router[_0x2e72('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x2e72('0x1a')]);router[_0x2e72('0x19')](_0x2e72('0x12'),auth[_0x2e72('0xa')](),controller[_0x2e72('0x1b')]);router[_0x2e72('0x19')]('/:id/users',auth[_0x2e72('0xa')](),controller['removeAgents']);module[_0x2e72('0x1c')]=router; \ No newline at end of file +var _0x8411=['destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','/:id/users','addAgents','put','update','delete'];(function(_0x3696f4,_0x555a8d){var _0x452f81=function(_0x43d304){while(--_0x43d304){_0x3696f4['push'](_0x3696f4['shift']());}};_0x452f81(++_0x555a8d);}(_0x8411,0x1d5));var _0x1841=function(_0xf074dd,_0xb6974f){_0xf074dd=_0xf074dd-0x0;var _0x9433f6=_0x8411[_0xf074dd];return _0x9433f6;};'use strict';var multer=require('multer');var util=require(_0x1841('0x0'));var path=require(_0x1841('0x1'));var timeout=require(_0x1841('0x2'));var express=require(_0x1841('0x3'));var router=express[_0x1841('0x4')]();var fs_extra=require(_0x1841('0x5'));var auth=require(_0x1841('0x6'));var interaction=require(_0x1841('0x7'));var config=require(_0x1841('0x8'));var controller=require(_0x1841('0x9'));router[_0x1841('0xa')]('/',auth[_0x1841('0xb')](),controller['index']);router['get'](_0x1841('0xc'),auth[_0x1841('0xb')](),controller[_0x1841('0xd')]);router[_0x1841('0xa')](_0x1841('0xe'),auth[_0x1841('0xb')](),controller[_0x1841('0xf')]);router[_0x1841('0xa')](_0x1841('0x10'),auth[_0x1841('0xb')](),controller[_0x1841('0x11')]);router[_0x1841('0xa')](_0x1841('0x12'),auth['isAuthenticated'](),controller[_0x1841('0x13')]);router['get']('/:id/users',auth[_0x1841('0xb')](),controller['getAgents']);router[_0x1841('0x14')]('/',auth['isAuthenticated'](),controller[_0x1841('0x15')]);router[_0x1841('0x14')](_0x1841('0x12'),auth[_0x1841('0xb')](),controller['addTeams']);router[_0x1841('0x14')](_0x1841('0x16'),auth[_0x1841('0xb')](),controller[_0x1841('0x17')]);router[_0x1841('0x18')](_0x1841('0xe'),auth[_0x1841('0xb')](),controller[_0x1841('0x19')]);router[_0x1841('0x1a')]('/:id',auth[_0x1841('0xb')](),controller[_0x1841('0x1b')]);router[_0x1841('0x1a')]('/:id/teams',auth[_0x1841('0xb')](),controller[_0x1841('0x1c')]);router[_0x1841('0x1a')]('/:id/users',auth[_0x1841('0xb')](),controller[_0x1841('0x1d')]);module[_0x1841('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index f10f673..2b7df57 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 _0x1336=['rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x3c0432,_0x1d6c64){var _0x33d2fd=function(_0x283aba){while(--_0x283aba){_0x3c0432['push'](_0x3c0432['shift']());}};_0x33d2fd(++_0x1d6c64);}(_0x1336,0x94));var _0x6133=function(_0x5e8bcf,_0xb28233){_0x5e8bcf=_0x5e8bcf-0x0;var _0x405093=_0x1336[_0x5e8bcf];return _0x405093;};'use strict';var Sequelize=require('sequelize');module[_0x6133('0x0')]={'name':{'type':Sequelize[_0x6133('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6133('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6133('0x2'),_0x6133('0x3'),_0x6133('0x4'))}}; \ No newline at end of file +var _0x9d33=['beepall','roundrobin','exports','name','STRING','INTEGER'];(function(_0xfa39bd,_0x5b27f7){var _0x14c889=function(_0x5ebb4b){while(--_0x5ebb4b){_0xfa39bd['push'](_0xfa39bd['shift']());}};_0x14c889(++_0x5b27f7);}(_0x9d33,0x1ac));var _0x39d3=function(_0x34bf65,_0x28b465){_0x34bf65=_0x34bf65-0x0;var _0x5705df=_0x9d33[_0x34bf65];return _0x5705df;};'use strict';var Sequelize=require('sequelize');module[_0x39d3('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x39d3('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x39d3('0x2')]},'timeout':{'type':Sequelize[_0x39d3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x39d3('0x4'),_0x39d3('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index e6c08ff..3e79ef0 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 _0xd2bb=['userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','nolimit','order','MailQueueId','UserMailQueue','findAndCountAll','UserId','createdAt','rows','format','SIP','mailPause','updatedAt','getTeams','Team','addTeams','ids','User','online','flatMap','Agents','transaction','each','findOrCreate','forEach','userMailQueue:save','select','tq.TeamId','user_has_teams','MailQueueId\x20=\x20?','clone','sequelize','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','emit','userMailQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','./mailQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','MailQueues','UserProfileResource','destroy','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','sort','where','pick','filters','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x31b987,_0x271061){var _0x4017e9=function(_0x4e8dbf){while(--_0x4e8dbf){_0x31b987['push'](_0x31b987['shift']());}};_0x4017e9(++_0x271061);}(_0xd2bb,0x1d2));var _0xbd2b=function(_0x35f375,_0x4a8e2f){_0x35f375=_0x35f375-0x0;var _0x717af4=_0xd2bb[_0x35f375];return _0x717af4;};'use strict';var emlformat=require(_0xbd2b('0x0'));var rimraf=require(_0xbd2b('0x1'));var zipdir=require(_0xbd2b('0x2'));var jsonpatch=require(_0xbd2b('0x3'));var rp=require(_0xbd2b('0x4'));var moment=require('moment');var BPromise=require(_0xbd2b('0x5'));var Mustache=require('mustache');var util=require(_0xbd2b('0x6'));var path=require(_0xbd2b('0x7'));var sox=require(_0xbd2b('0x8'));var csv=require(_0xbd2b('0x9'));var ejs=require(_0xbd2b('0xa'));var fs=require('fs');var fs_extra=require(_0xbd2b('0xb'));var _=require('lodash');var squel=require(_0xbd2b('0xc'));var crypto=require(_0xbd2b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbd2b('0xe'));var toCsv=require(_0xbd2b('0x9'));var querystring=require('querystring');var Papa=require(_0xbd2b('0xf'));var Redis=require(_0xbd2b('0x10'));var authService=require(_0xbd2b('0x11'));var qs=require(_0xbd2b('0x12'));var as=require(_0xbd2b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbd2b('0x14'));var utils=require(_0xbd2b('0x15'));var config=require(_0xbd2b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xbd2b('0x17')](config['redis'],{'host':_0xbd2b('0x18'),'port':0x18eb});var socket=require(_0xbd2b('0x19'))(new Redis(config[_0xbd2b('0x1a')]));require(_0xbd2b('0x1b'))['register'](socket);function respondWithStatusCode(_0x41099e,_0x581b5f){_0x581b5f=_0x581b5f||0xcc;return function(_0x3a5372){if(_0x3a5372){return _0x41099e[_0xbd2b('0x1c')](_0x581b5f);}return _0x41099e[_0xbd2b('0x1d')](_0x581b5f)[_0xbd2b('0x1e')]();};}function respondWithResult(_0xe108d2,_0x4ae305){_0x4ae305=_0x4ae305||0xc8;return function(_0x4e87ce){if(_0x4e87ce){return _0xe108d2['status'](_0x4ae305)[_0xbd2b('0x1f')](_0x4e87ce);}};}function respondWithFilteredResult(_0x3bf12b,_0xe258a0){return function(_0x36856f){if(_0x36856f){var _0x13b14d=typeof _0xe258a0[_0xbd2b('0x20')]===_0xbd2b('0x21')&&typeof _0xe258a0[_0xbd2b('0x22')]===_0xbd2b('0x21');var _0xe0d937=_0x36856f[_0xbd2b('0x23')];var _0x508984=_0x13b14d?0x0:_0xe258a0[_0xbd2b('0x20')];var _0x2236de=_0x13b14d?_0x36856f['count']:_0xe258a0['offset']+_0xe258a0['limit'];var _0x5622ca;if(_0x2236de>=_0xe0d937){_0x2236de=_0xe0d937;_0x5622ca=0xc8;}else{_0x5622ca=0xce;}_0x3bf12b['status'](_0x5622ca);return _0x3bf12b[_0xbd2b('0x24')](_0xbd2b('0x25'),_0x508984+'-'+_0x2236de+'/'+_0xe0d937)[_0xbd2b('0x1f')](_0x36856f);}return null;};}function patchUpdates(_0x243832){return function(_0x4cd741){try{jsonpatch['apply'](_0x4cd741,_0x243832,!![]);}catch(_0x156beb){return BPromise[_0xbd2b('0x26')](_0x156beb);}return _0x4cd741[_0xbd2b('0x27')]();};}function saveUpdates(_0x5a324b,_0x3ea838){return function(_0x44eaaf){if(_0x44eaaf){return _0x44eaaf[_0xbd2b('0x28')](_0x5a324b)['then'](function(_0x341449){return _0x341449;});}return null;};}function removeEntity(_0x56a273,_0x24784a){return function(_0x4d44be){if(_0x4d44be){return _0x4d44be['destroy']()[_0xbd2b('0x29')](function(){var _0x442fd9=_0x4d44be[_0xbd2b('0x2a')]({'plain':!![]});var _0x4d85d6=_0xbd2b('0x2b');return db[_0xbd2b('0x2c')][_0xbd2b('0x2d')]({'where':{'type':_0x4d85d6,'resourceId':_0x442fd9['id']}})[_0xbd2b('0x29')](function(){return _0x4d44be;});})[_0xbd2b('0x29')](function(){_0x56a273[_0xbd2b('0x1d')](0xcc)[_0xbd2b('0x1e')]();});}};}function handleEntityNotFound(_0x5cab22,_0x82ccbd){return function(_0x2c8c89){if(!_0x2c8c89){_0x5cab22[_0xbd2b('0x1c')](0x194);}return _0x2c8c89;};}function handleError(_0x16cb19,_0x47c156){_0x47c156=_0x47c156||0x1f4;return function(_0x1b9d78){logger['error'](_0x1b9d78[_0xbd2b('0x2e')]);if(_0x1b9d78[_0xbd2b('0x2f')]){delete _0x1b9d78[_0xbd2b('0x2f')];}_0x16cb19[_0xbd2b('0x1d')](_0x47c156)[_0xbd2b('0x30')](_0x1b9d78);};}exports[_0xbd2b('0x31')]=function(_0x32e2da,_0x1a0e87){var _0x2a3954={},_0x708c7d={},_0x57b336={'count':0x0,'rows':[]};var _0x54f311=_[_0xbd2b('0x32')](db[_0xbd2b('0x33')][_0xbd2b('0x34')],function(_0x36fc1b){return{'name':_0x36fc1b[_0xbd2b('0x35')],'type':_0x36fc1b['type'][_0xbd2b('0x36')]};});_0x708c7d[_0xbd2b('0x37')]=_[_0xbd2b('0x32')](_0x54f311,'name');_0x708c7d[_0xbd2b('0x38')]=_[_0xbd2b('0x39')](_0x32e2da[_0xbd2b('0x38')]);_0x708c7d['filters']=_[_0xbd2b('0x3a')](_0x708c7d[_0xbd2b('0x37')],_0x708c7d[_0xbd2b('0x38')]);_0x2a3954[_0xbd2b('0x3b')]=_['intersection'](_0x708c7d[_0xbd2b('0x37')],qs[_0xbd2b('0x3c')](_0x32e2da['query']['fields']));_0x2a3954[_0xbd2b('0x3b')]=_0x2a3954['attributes'][_0xbd2b('0x3d')]?_0x2a3954['attributes']:_0x708c7d['model'];if(!_0x32e2da['query']['hasOwnProperty']('nolimit')){_0x2a3954[_0xbd2b('0x22')]=qs['limit'](_0x32e2da[_0xbd2b('0x38')][_0xbd2b('0x22')]);_0x2a3954[_0xbd2b('0x20')]=qs[_0xbd2b('0x20')](_0x32e2da[_0xbd2b('0x38')][_0xbd2b('0x20')]);}_0x2a3954['order']=qs[_0xbd2b('0x3e')](_0x32e2da[_0xbd2b('0x38')][_0xbd2b('0x3e')]);_0x2a3954[_0xbd2b('0x3f')]=qs['filters'](_[_0xbd2b('0x40')](_0x32e2da['query'],_0x708c7d[_0xbd2b('0x41')]),_0x54f311);if(_0x32e2da[_0xbd2b('0x38')]['filter']){_0x2a3954[_0xbd2b('0x3f')]=_['merge'](_0x2a3954[_0xbd2b('0x3f')],{'$or':_['map'](_0x54f311,function(_0xd18be8){if(_0xd18be8[_0xbd2b('0x42')]!==_0xbd2b('0x43')){var _0x27c158={};_0x27c158[_0xd18be8['name']]={'$like':'%'+_0x32e2da[_0xbd2b('0x38')][_0xbd2b('0x44')]+'%'};return _0x27c158;}})});}_0x2a3954=_['merge']({},_0x2a3954,_0x32e2da[_0xbd2b('0x45')]);var _0x26fada={'where':_0x2a3954[_0xbd2b('0x3f')]};return db[_0xbd2b('0x33')][_0xbd2b('0x23')](_0x26fada)['then'](function(_0xedf34){_0x57b336[_0xbd2b('0x23')]=_0xedf34;if(_0x32e2da[_0xbd2b('0x38')][_0xbd2b('0x46')]){_0x2a3954[_0xbd2b('0x47')]=[{'all':!![]}];}return db[_0xbd2b('0x33')][_0xbd2b('0x48')](_0x2a3954);})['then'](function(_0x4ee9c1){_0x57b336['rows']=_0x4ee9c1;return _0x57b336;})[_0xbd2b('0x29')](respondWithFilteredResult(_0x1a0e87,_0x2a3954))[_0xbd2b('0x49')](handleError(_0x1a0e87,null));};exports['show']=function(_0x13f401,_0x170aa5){var _0x42416a={'raw':!![],'where':{'id':_0x13f401[_0xbd2b('0x4a')]['id']}},_0x4e12f3={};_0x4e12f3['model']=_[_0xbd2b('0x39')](db['MailQueue'][_0xbd2b('0x34')]);_0x4e12f3[_0xbd2b('0x38')]=_['keys'](_0x13f401[_0xbd2b('0x38')]);_0x4e12f3[_0xbd2b('0x41')]=_['intersection'](_0x4e12f3[_0xbd2b('0x37')],_0x4e12f3[_0xbd2b('0x38')]);_0x42416a[_0xbd2b('0x3b')]=_[_0xbd2b('0x3a')](_0x4e12f3[_0xbd2b('0x37')],qs['fields'](_0x13f401['query'][_0xbd2b('0x3c')]));_0x42416a[_0xbd2b('0x3b')]=_0x42416a[_0xbd2b('0x3b')][_0xbd2b('0x3d')]?_0x42416a[_0xbd2b('0x3b')]:_0x4e12f3[_0xbd2b('0x37')];if(_0x13f401[_0xbd2b('0x38')][_0xbd2b('0x46')]){_0x42416a[_0xbd2b('0x47')]=[{'all':!![]}];}_0x42416a=_[_0xbd2b('0x4b')]({},_0x42416a,_0x13f401[_0xbd2b('0x45')]);return db['MailQueue'][_0xbd2b('0x4c')](_0x42416a)[_0xbd2b('0x29')](handleEntityNotFound(_0x170aa5,null))['then'](respondWithResult(_0x170aa5,null))[_0xbd2b('0x49')](handleError(_0x170aa5,null));};exports[_0xbd2b('0x4d')]=function(_0x1e26af,_0x99e555){return db[_0xbd2b('0x33')]['create'](_0x1e26af[_0xbd2b('0x4e')],{})[_0xbd2b('0x29')](function(_0x489c8f){var _0x156337=_0x1e26af[_0xbd2b('0x4f')][_0xbd2b('0x2a')]({'plain':!![]});if(!_0x156337)throw new Error(_0xbd2b('0x50'));if(_0x156337['role']==='user'){var _0x4f4756=_0x489c8f['get']({'plain':!![]});var _0x57bedc=_0xbd2b('0x2b');return db[_0xbd2b('0x51')][_0xbd2b('0x4c')]({'where':{'name':_0x57bedc,'userProfileId':_0x156337[_0xbd2b('0x52')]},'raw':!![]})['then'](function(_0x3939e0){if(_0x3939e0&&_0x3939e0[_0xbd2b('0x53')]===0x0){return db[_0xbd2b('0x2c')][_0xbd2b('0x4d')]({'name':_0x4f4756[_0xbd2b('0x2f')],'resourceId':_0x4f4756['id'],'type':_0x3939e0[_0xbd2b('0x2f')],'sectionId':_0x3939e0['id']},{})[_0xbd2b('0x29')](function(){return _0x489c8f;});}else{return _0x489c8f;}})[_0xbd2b('0x49')](function(_0x44db3d){logger[_0xbd2b('0x54')](_0xbd2b('0x55'),_0x44db3d);throw _0x44db3d;});}return _0x489c8f;})['then'](respondWithResult(_0x99e555,0xc9))[_0xbd2b('0x49')](handleError(_0x99e555,null));};exports['update']=function(_0x1a1ad1,_0x9a8bd){if(_0x1a1ad1[_0xbd2b('0x4e')]['id']){delete _0x1a1ad1[_0xbd2b('0x4e')]['id'];}return db[_0xbd2b('0x33')][_0xbd2b('0x4c')]({'where':{'id':_0x1a1ad1[_0xbd2b('0x4a')]['id']}})[_0xbd2b('0x29')](handleEntityNotFound(_0x9a8bd,null))[_0xbd2b('0x29')](saveUpdates(_0x1a1ad1['body'],null))[_0xbd2b('0x29')](respondWithResult(_0x9a8bd,null))[_0xbd2b('0x49')](handleError(_0x9a8bd,null));};exports[_0xbd2b('0x2d')]=function(_0x416c66,_0x2ee678){return db[_0xbd2b('0x33')][_0xbd2b('0x4c')]({'where':{'id':_0x416c66[_0xbd2b('0x4a')]['id']}})[_0xbd2b('0x29')](handleEntityNotFound(_0x2ee678,null))[_0xbd2b('0x29')](removeEntity(_0x2ee678,null))['catch'](handleError(_0x2ee678,null));};exports[_0xbd2b('0x56')]=function(_0x3dc6f9,_0x4f62cc){return db['MailQueue'][_0xbd2b('0x56')]()[_0xbd2b('0x29')](respondWithResult(_0x4f62cc,null))[_0xbd2b('0x49')](handleError(_0x4f62cc,null));};exports[_0xbd2b('0x57')]=function(_0x32d59f,_0x2e789a,_0x47986c){var _0x2b2ac5={'raw':!![],'where':{}},_0x29acab={},_0x3368ff;return db['MailQueue'][_0xbd2b('0x58')]({'where':{'id':_0x32d59f[_0xbd2b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2e789a,null))[_0xbd2b('0x29')](function(_0x2bfa0a){if(_0x2bfa0a){_0x3368ff=_0x2bfa0a['get']({'plain':!![]});_0x29acab['model']=_['keys'](db['UserMailQueue'][_0xbd2b('0x34')]);_0x29acab['query']=_[_0xbd2b('0x39')](_0x32d59f['query']);_0x29acab[_0xbd2b('0x41')]=_[_0xbd2b('0x3a')](_0x29acab[_0xbd2b('0x37')],_0x29acab[_0xbd2b('0x38')]);_0x2b2ac5[_0xbd2b('0x3b')]=_['intersection'](_0x29acab[_0xbd2b('0x37')],qs['fields'](_0x32d59f[_0xbd2b('0x38')][_0xbd2b('0x3c')]));_0x2b2ac5[_0xbd2b('0x3b')]=_0x2b2ac5['attributes']['length']?_0x2b2ac5[_0xbd2b('0x3b')]:_0x29acab[_0xbd2b('0x37')];if(!_0x32d59f['query'][_0xbd2b('0x59')](_0xbd2b('0x5a'))){_0x2b2ac5[_0xbd2b('0x22')]=qs['limit'](_0x32d59f['query'][_0xbd2b('0x22')]);_0x2b2ac5[_0xbd2b('0x20')]=qs['offset'](_0x32d59f[_0xbd2b('0x38')]['offset']);}_0x2b2ac5[_0xbd2b('0x5b')]=qs['sort'](_0x32d59f['query'][_0xbd2b('0x3e')]);_0x2b2ac5[_0xbd2b('0x3f')]=qs[_0xbd2b('0x41')](_['pick'](_0x32d59f['query'],_0x29acab[_0xbd2b('0x41')]));_0x2b2ac5['where'][_0xbd2b('0x5c')]=_0x2bfa0a['id'];if(_0x32d59f[_0xbd2b('0x38')][_0xbd2b('0x44')]){_0x2b2ac5[_0xbd2b('0x3f')]=_[_0xbd2b('0x4b')](_0x2b2ac5[_0xbd2b('0x3f')],{'$or':_[_0xbd2b('0x32')](_0x2b2ac5[_0xbd2b('0x3b')],function(_0x882166){var _0xdf1033={};_0xdf1033[_0x882166]={'$like':'%'+_0x32d59f[_0xbd2b('0x38')][_0xbd2b('0x44')]+'%'};return _0xdf1033;})});}_0x2b2ac5=_['merge']({},_0x2b2ac5,_0x32d59f[_0xbd2b('0x45')]);return db[_0xbd2b('0x5d')][_0xbd2b('0x48')](_0x2b2ac5);}})[_0xbd2b('0x29')](function(_0xc06bb9){if(_0xc06bb9){return db['User'][_0xbd2b('0x5e')]({'where':{'id':_[_0xbd2b('0x32')](_0xc06bb9,_0xbd2b('0x5f')),'role':'agent'},'attributes':['id','name','mailPause','updatedAt',_0xbd2b('0x60')]});}})['then'](function(_0x2d6ccc){if(_0x2d6ccc){return{'count':_0x2d6ccc[_0xbd2b('0x23')],'rows':_[_0xbd2b('0x32')](_0x2d6ccc[_0xbd2b('0x61')],function(_0x25faef){return{'membername':_0x25faef[_0xbd2b('0x2f')],'UserId':_0x25faef['id'],'queue_name':_0x3368ff[_0xbd2b('0x2f')],'MailQueueId':_0x3368ff['id'],'interface':util[_0xbd2b('0x62')]('%s/%s',_0xbd2b('0x63'),_0x25faef['name']),'penalty':0x0,'paused':_0x25faef[_0xbd2b('0x64')],'createdAt':_0x25faef[_0xbd2b('0x60')],'updatedAt':_0x25faef[_0xbd2b('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbd2b('0x29')](respondWithFilteredResult(_0x2e789a,_0x2b2ac5))['catch'](handleError(_0x2e789a,null));};exports[_0xbd2b('0x66')]=function(_0x71d405,_0x532ae1,_0x5f3d61){var _0x4b2387={};var _0x1a3169={};var _0x29e746;var _0x2b2702;return db[_0xbd2b('0x33')][_0xbd2b('0x58')]({'where':{'id':_0x71d405['params']['id']}})[_0xbd2b('0x29')](handleEntityNotFound(_0x532ae1,null))['then'](function(_0x25c0fc){if(_0x25c0fc){_0x29e746=_0x25c0fc;_0x1a3169[_0xbd2b('0x37')]=_[_0xbd2b('0x39')](db[_0xbd2b('0x67')][_0xbd2b('0x34')]);_0x1a3169[_0xbd2b('0x38')]=_[_0xbd2b('0x39')](_0x71d405[_0xbd2b('0x38')]);_0x1a3169[_0xbd2b('0x41')]=_[_0xbd2b('0x3a')](_0x1a3169[_0xbd2b('0x37')],_0x1a3169[_0xbd2b('0x38')]);_0x4b2387[_0xbd2b('0x3b')]=_[_0xbd2b('0x3a')](_0x1a3169['model'],qs[_0xbd2b('0x3c')](_0x71d405[_0xbd2b('0x38')][_0xbd2b('0x3c')]));_0x4b2387[_0xbd2b('0x3b')]=_0x4b2387['attributes'][_0xbd2b('0x3d')]?_0x4b2387[_0xbd2b('0x3b')]:_0x1a3169[_0xbd2b('0x37')];_0x4b2387[_0xbd2b('0x5b')]=qs[_0xbd2b('0x3e')](_0x71d405['query']['sort']);_0x4b2387[_0xbd2b('0x3f')]=qs[_0xbd2b('0x41')](_['pick'](_0x71d405[_0xbd2b('0x38')],_0x1a3169[_0xbd2b('0x41')]));if(_0x71d405[_0xbd2b('0x38')][_0xbd2b('0x44')]){_0x4b2387['where']=_['merge'](_0x4b2387[_0xbd2b('0x3f')],{'$or':_[_0xbd2b('0x32')](_0x4b2387[_0xbd2b('0x3b')],function(_0x54e838){var _0x3305bc={};_0x3305bc[_0x54e838]={'$like':'%'+_0x71d405[_0xbd2b('0x38')]['filter']+'%'};return _0x3305bc;})});}_0x4b2387=_[_0xbd2b('0x4b')]({},_0x4b2387,_0x71d405[_0xbd2b('0x45')]);return _0x29e746[_0xbd2b('0x66')](_0x4b2387);}})[_0xbd2b('0x29')](function(_0x379afe){if(_0x379afe){_0x2b2702=_0x379afe['length'];if(!_0x71d405[_0xbd2b('0x38')][_0xbd2b('0x59')]('nolimit')){_0x4b2387['limit']=qs[_0xbd2b('0x22')](_0x71d405[_0xbd2b('0x38')][_0xbd2b('0x22')]);_0x4b2387[_0xbd2b('0x20')]=qs['offset'](_0x71d405[_0xbd2b('0x38')][_0xbd2b('0x20')]);}return _0x29e746[_0xbd2b('0x66')](_0x4b2387);}})[_0xbd2b('0x29')](function(_0x2baad2){if(_0x2baad2){return _0x2baad2?{'count':_0x2b2702,'rows':_0x2baad2}:null;}})[_0xbd2b('0x29')](respondWithResult(_0x532ae1,null))[_0xbd2b('0x49')](handleError(_0x532ae1,null));};exports[_0xbd2b('0x68')]=function(_0x3e7ee2,_0x564690,_0x5caca7){var _0x2cec43=_0x3e7ee2['body'][_0xbd2b('0x69')];return db['Team'][_0xbd2b('0x48')]({'where':{'id':_0x2cec43},'attributes':['id'],'include':[{'model':db[_0xbd2b('0x6a')],'as':'Agents','attributes':['id',_0xbd2b('0x2f'),_0xbd2b('0x6b'),'voicePause','interface'],'raw':!![]}]})[_0xbd2b('0x29')](function(_0x7b2d46){if(_0x7b2d46){var _0x237df2=_[_0xbd2b('0x6c')](_0x7b2d46,function(_0xe2bd01){var _0x288293=_0xe2bd01['get']({'plain':!![]});return _0x288293[_0xbd2b('0x6d')];});return db[_0xbd2b('0x33')][_0xbd2b('0x4c')]({'where':{'id':_0x3e7ee2[_0xbd2b('0x4a')]['id']}})[_0xbd2b('0x29')](function(_0x293fd9){return db['sequelize'][_0xbd2b('0x6e')](function(_0x195c8a){return _0x293fd9[_0xbd2b('0x68')](_0x2cec43,{'transaction':_0x195c8a})[_0xbd2b('0x29')](function(){return BPromise[_0xbd2b('0x6f')](_0x237df2,function(_0x5dc8b7){return db['UserMailQueue'][_0xbd2b('0x70')]({'where':{'UserId':_0x5dc8b7['id'],'MailQueueId':_0x3e7ee2['params']['id']},'transaction':_0x195c8a});});})[_0xbd2b('0x29')](function(){_0x237df2[_0xbd2b('0x71')](function(_0x555b18){socket['emit'](_0xbd2b('0x72'),{'UserId':_0x555b18['id'],'MailQueueId':_0x293fd9['id']});});});});});}})['then'](respondWithStatusCode(_0x564690,null))[_0xbd2b('0x49')](handleError(_0x564690,null));};exports['removeTeams']=function(_0x5651d3,_0x4978a3,_0x300f47){return db[_0xbd2b('0x67')][_0xbd2b('0x48')]({'where':{'id':_0x5651d3[_0xbd2b('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0xbd2b('0x6a')],'as':_0xbd2b('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xbd2b('0x29')](handleEntityNotFound(_0x4978a3,null))[_0xbd2b('0x29')](function(_0xcb6aa){var _0x111896=_[_0xbd2b('0x32')](_0xcb6aa,'id');var _0x5d4717=[];var _0x3ba3ee=[];var _0x3df15e=squel[_0xbd2b('0x73')]();_0x3df15e['field'](_0xbd2b('0x74'))['from']('team_has_mail_queues','tq')['join'](_0xbd2b('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbd2b('0x3f')](_0xbd2b('0x76'),_0x5651d3[_0xbd2b('0x4a')]['id']);for(var _0x3c6bc8=0x0;_0x3c6bc8<_0xcb6aa[_0xbd2b('0x3d')];_0x3c6bc8+=0x1){let _0x1e5914=_0xcb6aa[_0x3c6bc8];for(var _0x159bae=0x0;_0x159bae<_0x1e5914['Agents'][_0xbd2b('0x3d')];_0x159bae+=0x1){let _0x1c565f=_0x1e5914[_0xbd2b('0x6d')][_0x159bae];var _0x1e6bdd=_0x3df15e[_0xbd2b('0x77')]();_0x1e6bdd[_0xbd2b('0x3f')]('ut.UserId\x20=\x20?',_0x1c565f['id']);_0x3ba3ee['push'](db[_0xbd2b('0x78')][_0xbd2b('0x38')](_0x1e6bdd['toString'](),{'type':db[_0xbd2b('0x78')][_0xbd2b('0x79')][_0xbd2b('0x7a')]})[_0xbd2b('0x29')](function(_0x933ee0){if(_0x933ee0['length']===0x1){return _0x1c565f['id'];}else{var _0x40d4c4=_[_0xbd2b('0x7b')](_[_0xbd2b('0x32')](_0x933ee0,'TeamId'),function(_0x4fe7c1){return _[_0xbd2b('0x7c')](_0x111896,_0x4fe7c1);});if(_0x40d4c4){return _0x1c565f['id'];}}}));}}return BPromise[_0xbd2b('0x7d')](_0x3ba3ee)[_0xbd2b('0x29')](function(_0x495eca){_0x5d4717=_(_0x5d4717)[_0xbd2b('0x7e')](_0x495eca)[_0xbd2b('0x7f')]()[_0xbd2b('0x80')]();return db[_0xbd2b('0x33')][_0xbd2b('0x4c')]({'where':{'id':_0x5651d3[_0xbd2b('0x4a')]['id']}})[_0xbd2b('0x29')](function(_0x42e4e6){return db[_0xbd2b('0x78')][_0xbd2b('0x6e')](function(_0x39bbfe){return _0x42e4e6['removeTeams'](_0x5651d3[_0xbd2b('0x38')][_0xbd2b('0x69')],{'transaction':_0x39bbfe})['then'](function(){if(!_[_0xbd2b('0x81')](_0x5d4717)){return _0x42e4e6['removeAgents'](_0x5d4717,{'transaction':_0x39bbfe});}})[_0xbd2b('0x29')](function(){_0x5d4717['forEach'](function(_0x45d4aa){socket[_0xbd2b('0x82')](_0xbd2b('0x83'),{'UserId':_0x45d4aa,'MailQueueId':_0x42e4e6['id']});});});});});});})[_0xbd2b('0x29')](respondWithStatusCode(_0x4978a3,null))[_0xbd2b('0x49')](handleError(_0x4978a3,null));};exports[_0xbd2b('0x84')]=function(_0xa6dcdf,_0x2934c9,_0x14c053){return db[_0xbd2b('0x33')][_0xbd2b('0x4c')]({'where':{'id':_0xa6dcdf[_0xbd2b('0x4a')]['id']}})[_0xbd2b('0x29')](handleEntityNotFound(_0x2934c9,null))['then'](function(_0x47c95f){if(_0x47c95f){return _0x47c95f['addAgents'](_0xa6dcdf[_0xbd2b('0x4e')][_0xbd2b('0x69')],_['omit'](_0xa6dcdf[_0xbd2b('0x4e')],[_0xbd2b('0x69'),'id'])||{})[_0xbd2b('0x85')](function(_0x1103e3){for(var _0x4a2f71=0x0;_0x4a2f71<_0xa6dcdf[_0xbd2b('0x4e')][_0xbd2b('0x69')]['length'];_0x4a2f71+=0x1){socket['emit'](_0xbd2b('0x72'),{'UserId':Number(_0xa6dcdf[_0xbd2b('0x4e')][_0xbd2b('0x69')][_0x4a2f71]),'MailQueueId':Number(_0xa6dcdf['params']['id'])});}return _0x1103e3;});}})[_0xbd2b('0x29')](respondWithResult(_0x2934c9,null))[_0xbd2b('0x49')](handleError(_0x2934c9,null));};exports[_0xbd2b('0x86')]=function(_0x7be52f,_0x2de838,_0x530693){return db[_0xbd2b('0x33')]['find']({'where':{'id':_0x7be52f[_0xbd2b('0x4a')]['id']}})[_0xbd2b('0x29')](handleEntityNotFound(_0x2de838,null))['then'](function(_0x14cda4){if(_0x14cda4){return _0x14cda4['removeAgents'](_0x7be52f[_0xbd2b('0x38')][_0xbd2b('0x69')])[_0xbd2b('0x29')](function(){if(_[_0xbd2b('0x87')](_0x7be52f[_0xbd2b('0x38')][_0xbd2b('0x69')])){for(var _0x1135ef=0x0;_0x1135ef<_0x7be52f[_0xbd2b('0x38')][_0xbd2b('0x69')][_0xbd2b('0x3d')];_0x1135ef+=0x1){socket[_0xbd2b('0x82')](_0xbd2b('0x83'),{'UserId':Number(_0x7be52f[_0xbd2b('0x38')][_0xbd2b('0x69')][_0x1135ef]),'MailQueueId':Number(_0x7be52f[_0xbd2b('0x4a')]['id'])});}}else{socket['emit'](_0xbd2b('0x83'),{'UserId':Number(_0x7be52f[_0xbd2b('0x38')][_0xbd2b('0x69')]),'MailQueueId':Number(_0x7be52f[_0xbd2b('0x4a')]['id'])});}});}})[_0xbd2b('0x29')](respondWithStatusCode(_0x2de838,null))['catch'](handleError(_0x2de838,null));};exports[_0xbd2b('0x88')]=function(_0x1a573f,_0x45aff5,_0x1c37a3){var _0xb2f8e={};var _0x5b9965={};var _0x21e8c4;var _0x1088d4;return db[_0xbd2b('0x33')]['findOne']({'where':{'id':_0x1a573f[_0xbd2b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x45aff5,null))[_0xbd2b('0x29')](function(_0x262996){if(_0x262996){_0x21e8c4=_0x262996;_0x5b9965[_0xbd2b('0x37')]=_[_0xbd2b('0x39')](db[_0xbd2b('0x6a')][_0xbd2b('0x34')]);_0x5b9965['query']=_['keys'](_0x1a573f['query']);_0x5b9965[_0xbd2b('0x41')]=_[_0xbd2b('0x3a')](_0x5b9965[_0xbd2b('0x37')],_0x5b9965[_0xbd2b('0x38')]);_0xb2f8e[_0xbd2b('0x3b')]=_['intersection'](_0x5b9965[_0xbd2b('0x37')],qs['fields'](_0x1a573f[_0xbd2b('0x38')][_0xbd2b('0x3c')]));_0xb2f8e[_0xbd2b('0x3b')]=_0xb2f8e[_0xbd2b('0x3b')][_0xbd2b('0x3d')]?_0xb2f8e[_0xbd2b('0x3b')]:_0x5b9965[_0xbd2b('0x37')];_0xb2f8e[_0xbd2b('0x5b')]=qs['sort'](_0x1a573f[_0xbd2b('0x38')]['sort']);_0xb2f8e['where']=qs['filters'](_[_0xbd2b('0x40')](_0x1a573f[_0xbd2b('0x38')],_0x5b9965[_0xbd2b('0x41')]));if(_0x1a573f[_0xbd2b('0x38')][_0xbd2b('0x44')]){_0xb2f8e['where']=_[_0xbd2b('0x4b')](_0xb2f8e[_0xbd2b('0x3f')],{'$or':_[_0xbd2b('0x32')](_0xb2f8e[_0xbd2b('0x3b')],function(_0xc83a22){var _0x426c14={};_0x426c14[_0xc83a22]={'$like':'%'+_0x1a573f[_0xbd2b('0x38')][_0xbd2b('0x44')]+'%'};return _0x426c14;})});}_0xb2f8e=_[_0xbd2b('0x4b')]({},_0xb2f8e,_0x1a573f['options']);return _0x21e8c4[_0xbd2b('0x88')](_0xb2f8e);}})['then'](function(_0x128cf4){if(_0x128cf4){_0x1088d4=_0x128cf4[_0xbd2b('0x3d')];if(!_0x1a573f['query'][_0xbd2b('0x59')]('nolimit')){_0xb2f8e[_0xbd2b('0x22')]=qs['limit'](_0x1a573f[_0xbd2b('0x38')][_0xbd2b('0x22')]);_0xb2f8e[_0xbd2b('0x20')]=qs[_0xbd2b('0x20')](_0x1a573f[_0xbd2b('0x38')][_0xbd2b('0x20')]);}return _0x21e8c4['getAgents'](_0xb2f8e);}})['then'](function(_0x5ea508){if(_0x5ea508){return _0x5ea508?{'count':_0x1088d4,'rows':_0x5ea508}:null;}})[_0xbd2b('0x29')](respondWithResult(_0x45aff5,null))['catch'](handleError(_0x45aff5,null));}; \ No newline at end of file +var _0xfc9c=['updatedAt','getTeams','findOne','Team','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','UserMailQueue','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','clone','every','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','userMailQueue:save','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','MailQueues','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','model','keys','query','filters','fields','attributes','nolimit','order','where','pick','filter','merge','VIRTUAL','options','include','MailQueue','findAll','rows','show','params','length','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','intersection','hasOwnProperty','sort','MailQueueId','findAndCountAll','UserId','agent','mailPause','format','%s/%s','SIP','createdAt'];(function(_0x4773e8,_0x301fdb){var _0xb688e4=function(_0x1894db){while(--_0x1894db){_0x4773e8['push'](_0x4773e8['shift']());}};_0xb688e4(++_0x301fdb);}(_0xfc9c,0xb4));var _0xcfc9=function(_0xee65b,_0x5786b2){_0xee65b=_0xee65b-0x0;var _0x303162=_0xfc9c[_0xee65b];return _0x303162;};'use strict';var emlformat=require(_0xcfc9('0x0'));var rimraf=require(_0xcfc9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcfc9('0x2'));var rp=require('request-promise');var moment=require(_0xcfc9('0x3'));var BPromise=require(_0xcfc9('0x4'));var Mustache=require(_0xcfc9('0x5'));var util=require(_0xcfc9('0x6'));var path=require('path');var sox=require(_0xcfc9('0x7'));var csv=require(_0xcfc9('0x8'));var ejs=require(_0xcfc9('0x9'));var fs=require('fs');var fs_extra=require(_0xcfc9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcfc9('0xb'));var jsforce=require(_0xcfc9('0xc'));var deskjs=require(_0xcfc9('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcfc9('0xe'));var Papa=require(_0xcfc9('0xf'));var Redis=require(_0xcfc9('0x10'));var authService=require(_0xcfc9('0x11'));var qs=require(_0xcfc9('0x12'));var as=require(_0xcfc9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcfc9('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xcfc9('0x15'));var licenseUtil=require(_0xcfc9('0x16'));var db=require('../../mysqldb')['db'];config[_0xcfc9('0x17')]=_[_0xcfc9('0x18')](config['redis'],{'host':_0xcfc9('0x19'),'port':0x18eb});var socket=require(_0xcfc9('0x1a'))(new Redis(config[_0xcfc9('0x17')]));require(_0xcfc9('0x1b'))[_0xcfc9('0x1c')](socket);function respondWithStatusCode(_0xcf69c0,_0x1db6ee){_0x1db6ee=_0x1db6ee||0xcc;return function(_0x4605a6){if(_0x4605a6){return _0xcf69c0['sendStatus'](_0x1db6ee);}return _0xcf69c0[_0xcfc9('0x1d')](_0x1db6ee)['end']();};}function respondWithResult(_0x29a4d2,_0x47ea94){_0x47ea94=_0x47ea94||0xc8;return function(_0x20b254){if(_0x20b254){return _0x29a4d2[_0xcfc9('0x1d')](_0x47ea94)[_0xcfc9('0x1e')](_0x20b254);}};}function respondWithFilteredResult(_0x4a6b40,_0x470a59){return function(_0x4cd470){if(_0x4cd470){var _0xf0c03b=typeof _0x470a59[_0xcfc9('0x1f')]===_0xcfc9('0x20')&&typeof _0x470a59[_0xcfc9('0x21')]===_0xcfc9('0x20');var _0x229adf=_0x4cd470['count'];var _0x1c5d6d=_0xf0c03b?0x0:_0x470a59[_0xcfc9('0x1f')];var _0x4de55b=_0xf0c03b?_0x4cd470[_0xcfc9('0x22')]:_0x470a59['offset']+_0x470a59[_0xcfc9('0x21')];var _0x3143c6;if(_0x4de55b>=_0x229adf){_0x4de55b=_0x229adf;_0x3143c6=0xc8;}else{_0x3143c6=0xce;}_0x4a6b40[_0xcfc9('0x1d')](_0x3143c6);return _0x4a6b40[_0xcfc9('0x23')](_0xcfc9('0x24'),_0x1c5d6d+'-'+_0x4de55b+'/'+_0x229adf)['json'](_0x4cd470);}return null;};}function patchUpdates(_0x20b7d4){return function(_0x306dc9){try{jsonpatch[_0xcfc9('0x25')](_0x306dc9,_0x20b7d4,!![]);}catch(_0x6ef77d){return BPromise[_0xcfc9('0x26')](_0x6ef77d);}return _0x306dc9[_0xcfc9('0x27')]();};}function saveUpdates(_0x1db094,_0x3ed24a){return function(_0x65c45f){if(_0x65c45f){return _0x65c45f[_0xcfc9('0x28')](_0x1db094)[_0xcfc9('0x29')](function(_0x3c666b){return _0x3c666b;});}return null;};}function removeEntity(_0x2ba9af,_0x249b6f){return function(_0x19dc57){if(_0x19dc57){return _0x19dc57['destroy']()['then'](function(){var _0x22582e=_0x19dc57['get']({'plain':!![]});var _0x2cac02=_0xcfc9('0x2a');return db[_0xcfc9('0x2b')]['destroy']({'where':{'type':_0x2cac02,'resourceId':_0x22582e['id']}})[_0xcfc9('0x29')](function(){return _0x19dc57;});})['then'](function(){_0x2ba9af[_0xcfc9('0x1d')](0xcc)[_0xcfc9('0x2c')]();});}};}function handleEntityNotFound(_0xa8cbfe,_0x42fb76){return function(_0x4b4672){if(!_0x4b4672){_0xa8cbfe['sendStatus'](0x194);}return _0x4b4672;};}function handleError(_0x5d7c95,_0x5aba12){_0x5aba12=_0x5aba12||0x1f4;return function(_0x2f75fb){logger[_0xcfc9('0x2d')](_0x2f75fb['stack']);if(_0x2f75fb[_0xcfc9('0x2e')]){delete _0x2f75fb[_0xcfc9('0x2e')];}_0x5d7c95[_0xcfc9('0x1d')](_0x5aba12)[_0xcfc9('0x2f')](_0x2f75fb);};}exports[_0xcfc9('0x30')]=function(_0x23130e,_0x4bca83){var _0x51f30a={},_0x320acf={},_0x5d7fb5={'count':0x0,'rows':[]};var _0x4e02e6=_[_0xcfc9('0x31')](db['MailQueue'][_0xcfc9('0x32')],function(_0x50e011){return{'name':_0x50e011[_0xcfc9('0x33')],'type':_0x50e011['type']['key']};});_0x320acf[_0xcfc9('0x34')]=_['map'](_0x4e02e6,_0xcfc9('0x2e'));_0x320acf['query']=_[_0xcfc9('0x35')](_0x23130e[_0xcfc9('0x36')]);_0x320acf[_0xcfc9('0x37')]=_['intersection'](_0x320acf[_0xcfc9('0x34')],_0x320acf[_0xcfc9('0x36')]);_0x51f30a['attributes']=_['intersection'](_0x320acf[_0xcfc9('0x34')],qs[_0xcfc9('0x38')](_0x23130e['query'][_0xcfc9('0x38')]));_0x51f30a[_0xcfc9('0x39')]=_0x51f30a[_0xcfc9('0x39')]['length']?_0x51f30a[_0xcfc9('0x39')]:_0x320acf[_0xcfc9('0x34')];if(!_0x23130e[_0xcfc9('0x36')]['hasOwnProperty'](_0xcfc9('0x3a'))){_0x51f30a[_0xcfc9('0x21')]=qs['limit'](_0x23130e[_0xcfc9('0x36')][_0xcfc9('0x21')]);_0x51f30a[_0xcfc9('0x1f')]=qs[_0xcfc9('0x1f')](_0x23130e[_0xcfc9('0x36')]['offset']);}_0x51f30a[_0xcfc9('0x3b')]=qs['sort'](_0x23130e[_0xcfc9('0x36')]['sort']);_0x51f30a[_0xcfc9('0x3c')]=qs[_0xcfc9('0x37')](_[_0xcfc9('0x3d')](_0x23130e['query'],_0x320acf[_0xcfc9('0x37')]),_0x4e02e6);if(_0x23130e[_0xcfc9('0x36')][_0xcfc9('0x3e')]){_0x51f30a[_0xcfc9('0x3c')]=_[_0xcfc9('0x3f')](_0x51f30a['where'],{'$or':_['map'](_0x4e02e6,function(_0x102f1b){if(_0x102f1b['type']!==_0xcfc9('0x40')){var _0xa6081d={};_0xa6081d[_0x102f1b[_0xcfc9('0x2e')]]={'$like':'%'+_0x23130e['query'][_0xcfc9('0x3e')]+'%'};return _0xa6081d;}})});}_0x51f30a=_['merge']({},_0x51f30a,_0x23130e[_0xcfc9('0x41')]);var _0x44b70f={'where':_0x51f30a[_0xcfc9('0x3c')]};return db['MailQueue'][_0xcfc9('0x22')](_0x44b70f)[_0xcfc9('0x29')](function(_0x59a6e2){_0x5d7fb5[_0xcfc9('0x22')]=_0x59a6e2;if(_0x23130e[_0xcfc9('0x36')]['includeAll']){_0x51f30a[_0xcfc9('0x42')]=[{'all':!![]}];}return db[_0xcfc9('0x43')][_0xcfc9('0x44')](_0x51f30a);})[_0xcfc9('0x29')](function(_0x232959){_0x5d7fb5[_0xcfc9('0x45')]=_0x232959;return _0x5d7fb5;})[_0xcfc9('0x29')](respondWithFilteredResult(_0x4bca83,_0x51f30a))['catch'](handleError(_0x4bca83,null));};exports[_0xcfc9('0x46')]=function(_0x1abc3c,_0x22ed06){var _0x4418d3={'raw':!![],'where':{'id':_0x1abc3c[_0xcfc9('0x47')]['id']}},_0x59197a={};_0x59197a[_0xcfc9('0x34')]=_['keys'](db[_0xcfc9('0x43')][_0xcfc9('0x32')]);_0x59197a[_0xcfc9('0x36')]=_['keys'](_0x1abc3c[_0xcfc9('0x36')]);_0x59197a[_0xcfc9('0x37')]=_['intersection'](_0x59197a['model'],_0x59197a[_0xcfc9('0x36')]);_0x4418d3[_0xcfc9('0x39')]=_['intersection'](_0x59197a[_0xcfc9('0x34')],qs['fields'](_0x1abc3c['query'][_0xcfc9('0x38')]));_0x4418d3['attributes']=_0x4418d3[_0xcfc9('0x39')][_0xcfc9('0x48')]?_0x4418d3['attributes']:_0x59197a['model'];if(_0x1abc3c['query'][_0xcfc9('0x49')]){_0x4418d3[_0xcfc9('0x42')]=[{'all':!![]}];}_0x4418d3=_['merge']({},_0x4418d3,_0x1abc3c[_0xcfc9('0x41')]);return db[_0xcfc9('0x43')][_0xcfc9('0x4a')](_0x4418d3)[_0xcfc9('0x29')](handleEntityNotFound(_0x22ed06,null))['then'](respondWithResult(_0x22ed06,null))[_0xcfc9('0x4b')](handleError(_0x22ed06,null));};exports[_0xcfc9('0x4c')]=function(_0x2596ad,_0x3ceb5d){return db['MailQueue']['create'](_0x2596ad[_0xcfc9('0x4d')],{})[_0xcfc9('0x29')](function(_0x2308da){var _0x1e0550=_0x2596ad[_0xcfc9('0x4e')][_0xcfc9('0x4f')]({'plain':!![]});if(!_0x1e0550)throw new Error(_0xcfc9('0x50'));if(_0x1e0550[_0xcfc9('0x51')]==='user'){var _0x4d1b9c=_0x2308da['get']({'plain':!![]});var _0x28b64c='MailQueues';return db[_0xcfc9('0x52')][_0xcfc9('0x4a')]({'where':{'name':_0x28b64c,'userProfileId':_0x1e0550[_0xcfc9('0x53')]},'raw':!![]})[_0xcfc9('0x29')](function(_0x1d28c3){if(_0x1d28c3&&_0x1d28c3['autoAssociation']===0x0){return db['UserProfileResource'][_0xcfc9('0x4c')]({'name':_0x4d1b9c['name'],'resourceId':_0x4d1b9c['id'],'type':_0x1d28c3[_0xcfc9('0x2e')],'sectionId':_0x1d28c3['id']},{})[_0xcfc9('0x29')](function(){return _0x2308da;});}else{return _0x2308da;}})[_0xcfc9('0x4b')](function(_0xecb0f1){logger[_0xcfc9('0x2d')](_0xcfc9('0x54'),_0xecb0f1);throw _0xecb0f1;});}return _0x2308da;})[_0xcfc9('0x29')](respondWithResult(_0x3ceb5d,0xc9))[_0xcfc9('0x4b')](handleError(_0x3ceb5d,null));};exports[_0xcfc9('0x28')]=function(_0x28b6bc,_0x3b238a){if(_0x28b6bc[_0xcfc9('0x4d')]['id']){delete _0x28b6bc[_0xcfc9('0x4d')]['id'];}return db[_0xcfc9('0x43')][_0xcfc9('0x4a')]({'where':{'id':_0x28b6bc[_0xcfc9('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b238a,null))['then'](saveUpdates(_0x28b6bc[_0xcfc9('0x4d')],null))[_0xcfc9('0x29')](respondWithResult(_0x3b238a,null))[_0xcfc9('0x4b')](handleError(_0x3b238a,null));};exports[_0xcfc9('0x55')]=function(_0x312ec7,_0x43a7c1){return db[_0xcfc9('0x43')][_0xcfc9('0x4a')]({'where':{'id':_0x312ec7[_0xcfc9('0x47')]['id']}})[_0xcfc9('0x29')](handleEntityNotFound(_0x43a7c1,null))['then'](removeEntity(_0x43a7c1,null))[_0xcfc9('0x4b')](handleError(_0x43a7c1,null));};exports[_0xcfc9('0x56')]=function(_0x279c2a,_0x2e72fa){return db[_0xcfc9('0x43')][_0xcfc9('0x56')]()['then'](respondWithResult(_0x2e72fa,null))['catch'](handleError(_0x2e72fa,null));};exports[_0xcfc9('0x57')]=function(_0x494c63,_0x442a81,_0x341d07){var _0x551bd9={'raw':!![],'where':{}},_0x30a9b6={},_0x3e99f6;return db[_0xcfc9('0x43')]['findOne']({'where':{'id':_0x494c63[_0xcfc9('0x47')]['id']}})[_0xcfc9('0x29')](handleEntityNotFound(_0x442a81,null))[_0xcfc9('0x29')](function(_0x4c9b58){if(_0x4c9b58){_0x3e99f6=_0x4c9b58[_0xcfc9('0x4f')]({'plain':!![]});_0x30a9b6['model']=_[_0xcfc9('0x35')](db['UserMailQueue'][_0xcfc9('0x32')]);_0x30a9b6[_0xcfc9('0x36')]=_['keys'](_0x494c63[_0xcfc9('0x36')]);_0x30a9b6['filters']=_[_0xcfc9('0x58')](_0x30a9b6[_0xcfc9('0x34')],_0x30a9b6[_0xcfc9('0x36')]);_0x551bd9[_0xcfc9('0x39')]=_[_0xcfc9('0x58')](_0x30a9b6[_0xcfc9('0x34')],qs[_0xcfc9('0x38')](_0x494c63[_0xcfc9('0x36')][_0xcfc9('0x38')]));_0x551bd9[_0xcfc9('0x39')]=_0x551bd9[_0xcfc9('0x39')][_0xcfc9('0x48')]?_0x551bd9[_0xcfc9('0x39')]:_0x30a9b6[_0xcfc9('0x34')];if(!_0x494c63['query'][_0xcfc9('0x59')](_0xcfc9('0x3a'))){_0x551bd9['limit']=qs[_0xcfc9('0x21')](_0x494c63[_0xcfc9('0x36')]['limit']);_0x551bd9[_0xcfc9('0x1f')]=qs[_0xcfc9('0x1f')](_0x494c63[_0xcfc9('0x36')]['offset']);}_0x551bd9[_0xcfc9('0x3b')]=qs[_0xcfc9('0x5a')](_0x494c63[_0xcfc9('0x36')][_0xcfc9('0x5a')]);_0x551bd9[_0xcfc9('0x3c')]=qs['filters'](_[_0xcfc9('0x3d')](_0x494c63[_0xcfc9('0x36')],_0x30a9b6[_0xcfc9('0x37')]));_0x551bd9[_0xcfc9('0x3c')][_0xcfc9('0x5b')]=_0x4c9b58['id'];if(_0x494c63[_0xcfc9('0x36')]['filter']){_0x551bd9[_0xcfc9('0x3c')]=_[_0xcfc9('0x3f')](_0x551bd9[_0xcfc9('0x3c')],{'$or':_[_0xcfc9('0x31')](_0x551bd9[_0xcfc9('0x39')],function(_0x4a8447){var _0x5f4e12={};_0x5f4e12[_0x4a8447]={'$like':'%'+_0x494c63[_0xcfc9('0x36')][_0xcfc9('0x3e')]+'%'};return _0x5f4e12;})});}_0x551bd9=_[_0xcfc9('0x3f')]({},_0x551bd9,_0x494c63[_0xcfc9('0x41')]);return db['UserMailQueue'][_0xcfc9('0x44')](_0x551bd9);}})[_0xcfc9('0x29')](function(_0x4320fc){if(_0x4320fc){return db['User'][_0xcfc9('0x5c')]({'where':{'id':_['map'](_0x4320fc,_0xcfc9('0x5d')),'role':_0xcfc9('0x5e')},'attributes':['id',_0xcfc9('0x2e'),_0xcfc9('0x5f'),'updatedAt','createdAt']});}})[_0xcfc9('0x29')](function(_0x238adb){if(_0x238adb){return{'count':_0x238adb[_0xcfc9('0x22')],'rows':_[_0xcfc9('0x31')](_0x238adb['rows'],function(_0x33212e){return{'membername':_0x33212e[_0xcfc9('0x2e')],'UserId':_0x33212e['id'],'queue_name':_0x3e99f6[_0xcfc9('0x2e')],'MailQueueId':_0x3e99f6['id'],'interface':util[_0xcfc9('0x60')](_0xcfc9('0x61'),_0xcfc9('0x62'),_0x33212e['name']),'penalty':0x0,'paused':_0x33212e[_0xcfc9('0x5f')],'createdAt':_0x33212e[_0xcfc9('0x63')],'updatedAt':_0x33212e[_0xcfc9('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcfc9('0x29')](respondWithFilteredResult(_0x442a81,_0x551bd9))[_0xcfc9('0x4b')](handleError(_0x442a81,null));};exports[_0xcfc9('0x65')]=function(_0x3b390f,_0xecdda9,_0x4a7e63){var _0xff5f7d={};var _0xeeaee2={};var _0x37d06f;var _0x44b03b;return db['MailQueue'][_0xcfc9('0x66')]({'where':{'id':_0x3b390f[_0xcfc9('0x47')]['id']}})[_0xcfc9('0x29')](handleEntityNotFound(_0xecdda9,null))[_0xcfc9('0x29')](function(_0x42b8fd){if(_0x42b8fd){_0x37d06f=_0x42b8fd;_0xeeaee2['model']=_[_0xcfc9('0x35')](db[_0xcfc9('0x67')][_0xcfc9('0x32')]);_0xeeaee2[_0xcfc9('0x36')]=_[_0xcfc9('0x35')](_0x3b390f[_0xcfc9('0x36')]);_0xeeaee2[_0xcfc9('0x37')]=_[_0xcfc9('0x58')](_0xeeaee2[_0xcfc9('0x34')],_0xeeaee2[_0xcfc9('0x36')]);_0xff5f7d[_0xcfc9('0x39')]=_[_0xcfc9('0x58')](_0xeeaee2[_0xcfc9('0x34')],qs[_0xcfc9('0x38')](_0x3b390f[_0xcfc9('0x36')]['fields']));_0xff5f7d[_0xcfc9('0x39')]=_0xff5f7d[_0xcfc9('0x39')][_0xcfc9('0x48')]?_0xff5f7d[_0xcfc9('0x39')]:_0xeeaee2[_0xcfc9('0x34')];_0xff5f7d[_0xcfc9('0x3b')]=qs[_0xcfc9('0x5a')](_0x3b390f['query'][_0xcfc9('0x5a')]);_0xff5f7d[_0xcfc9('0x3c')]=qs[_0xcfc9('0x37')](_[_0xcfc9('0x3d')](_0x3b390f[_0xcfc9('0x36')],_0xeeaee2[_0xcfc9('0x37')]));if(_0x3b390f['query'][_0xcfc9('0x3e')]){_0xff5f7d['where']=_[_0xcfc9('0x3f')](_0xff5f7d[_0xcfc9('0x3c')],{'$or':_[_0xcfc9('0x31')](_0xff5f7d[_0xcfc9('0x39')],function(_0x9b87cf){var _0x1d1c13={};_0x1d1c13[_0x9b87cf]={'$like':'%'+_0x3b390f['query'][_0xcfc9('0x3e')]+'%'};return _0x1d1c13;})});}_0xff5f7d=_['merge']({},_0xff5f7d,_0x3b390f[_0xcfc9('0x41')]);return _0x37d06f[_0xcfc9('0x65')](_0xff5f7d);}})[_0xcfc9('0x29')](function(_0xaa9dc2){if(_0xaa9dc2){_0x44b03b=_0xaa9dc2[_0xcfc9('0x48')];if(!_0x3b390f[_0xcfc9('0x36')]['hasOwnProperty'](_0xcfc9('0x3a'))){_0xff5f7d[_0xcfc9('0x21')]=qs[_0xcfc9('0x21')](_0x3b390f[_0xcfc9('0x36')]['limit']);_0xff5f7d['offset']=qs[_0xcfc9('0x1f')](_0x3b390f[_0xcfc9('0x36')][_0xcfc9('0x1f')]);}return _0x37d06f['getTeams'](_0xff5f7d);}})['then'](function(_0x5dd64b){if(_0x5dd64b){return _0x5dd64b?{'count':_0x44b03b,'rows':_0x5dd64b}:null;}})[_0xcfc9('0x29')](respondWithResult(_0xecdda9,null))[_0xcfc9('0x4b')](handleError(_0xecdda9,null));};exports['addTeams']=function(_0x5ef82d,_0x2eb49a,_0x554617){var _0x51377a=_0x5ef82d['body'][_0xcfc9('0x68')];return db[_0xcfc9('0x67')][_0xcfc9('0x44')]({'where':{'id':_0x51377a},'attributes':['id'],'include':[{'model':db[_0xcfc9('0x69')],'as':_0xcfc9('0x6a'),'attributes':['id',_0xcfc9('0x2e'),_0xcfc9('0x6b'),_0xcfc9('0x6c'),_0xcfc9('0x6d')],'raw':!![]}]})[_0xcfc9('0x29')](function(_0x28c707){if(_0x28c707){var _0x1679c9=_[_0xcfc9('0x6e')](_0x28c707,function(_0x2740e8){var _0xd29b4b=_0x2740e8['get']({'plain':!![]});return _0xd29b4b[_0xcfc9('0x6a')];});return db[_0xcfc9('0x43')][_0xcfc9('0x4a')]({'where':{'id':_0x5ef82d[_0xcfc9('0x47')]['id']}})['then'](function(_0xbc4f9c){return db[_0xcfc9('0x6f')][_0xcfc9('0x70')](function(_0x5f5d36){return _0xbc4f9c[_0xcfc9('0x71')](_0x51377a,{'transaction':_0x5f5d36})[_0xcfc9('0x29')](function(){return BPromise['each'](_0x1679c9,function(_0x59cc1f){return db[_0xcfc9('0x72')][_0xcfc9('0x73')]({'where':{'UserId':_0x59cc1f['id'],'MailQueueId':_0x5ef82d[_0xcfc9('0x47')]['id']},'transaction':_0x5f5d36});});})[_0xcfc9('0x29')](function(){_0x1679c9[_0xcfc9('0x74')](function(_0x1a2b21){socket[_0xcfc9('0x75')]('userMailQueue:save',{'UserId':_0x1a2b21['id'],'MailQueueId':_0xbc4f9c['id']});});});});});}})[_0xcfc9('0x29')](respondWithStatusCode(_0x2eb49a,null))[_0xcfc9('0x4b')](handleError(_0x2eb49a,null));};exports[_0xcfc9('0x76')]=function(_0x31bef2,_0x3e2e27,_0x4ff4f4){return db[_0xcfc9('0x67')]['findAll']({'where':{'id':_0x31bef2[_0xcfc9('0x36')][_0xcfc9('0x68')]},'attributes':['id'],'include':[{'model':db[_0xcfc9('0x69')],'as':_0xcfc9('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xcfc9('0x29')](handleEntityNotFound(_0x3e2e27,null))['then'](function(_0x515d0d){var _0x485b08=_['map'](_0x515d0d,'id');var _0x263373=[];var _0x1aa8db=[];var _0x5f0ba4=squel[_0xcfc9('0x77')]();_0x5f0ba4[_0xcfc9('0x78')](_0xcfc9('0x79'))['from'](_0xcfc9('0x7a'),'tq')[_0xcfc9('0x7b')](_0xcfc9('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xcfc9('0x3c')]('MailQueueId\x20=\x20?',_0x31bef2[_0xcfc9('0x47')]['id']);for(var _0x5f058c=0x0;_0x5f058c<_0x515d0d[_0xcfc9('0x48')];_0x5f058c+=0x1){let _0x5176b7=_0x515d0d[_0x5f058c];for(var _0x4054fc=0x0;_0x4054fc<_0x5176b7[_0xcfc9('0x6a')][_0xcfc9('0x48')];_0x4054fc+=0x1){let _0x6e0bf2=_0x5176b7[_0xcfc9('0x6a')][_0x4054fc];var _0x205ee2=_0x5f0ba4[_0xcfc9('0x7d')]();_0x205ee2[_0xcfc9('0x3c')]('ut.UserId\x20=\x20?',_0x6e0bf2['id']);_0x1aa8db['push'](db['sequelize'][_0xcfc9('0x36')](_0x205ee2['toString'](),{'type':db[_0xcfc9('0x6f')]['QueryTypes']['SELECT']})[_0xcfc9('0x29')](function(_0x1a8712){if(_0x1a8712[_0xcfc9('0x48')]===0x1){return _0x6e0bf2['id'];}else{var _0x317a7c=_[_0xcfc9('0x7e')](_['map'](_0x1a8712,'TeamId'),function(_0xca2154){return _[_0xcfc9('0x7f')](_0x485b08,_0xca2154);});if(_0x317a7c){return _0x6e0bf2['id'];}}}));}}return BPromise[_0xcfc9('0x80')](_0x1aa8db)[_0xcfc9('0x29')](function(_0x452b8f){_0x263373=_(_0x263373)[_0xcfc9('0x81')](_0x452b8f)[_0xcfc9('0x82')]()[_0xcfc9('0x83')]();return db[_0xcfc9('0x43')]['find']({'where':{'id':_0x31bef2[_0xcfc9('0x47')]['id']}})[_0xcfc9('0x29')](function(_0x4384c3){return db[_0xcfc9('0x6f')][_0xcfc9('0x70')](function(_0x5d2670){return _0x4384c3[_0xcfc9('0x76')](_0x31bef2[_0xcfc9('0x36')]['ids'],{'transaction':_0x5d2670})[_0xcfc9('0x29')](function(){if(!_[_0xcfc9('0x84')](_0x263373)){return _0x4384c3[_0xcfc9('0x85')](_0x263373,{'transaction':_0x5d2670});}})['then'](function(){_0x263373['forEach'](function(_0x3a1171){socket['emit']('userMailQueue:remove',{'UserId':_0x3a1171,'MailQueueId':_0x4384c3['id']});});});});});});})[_0xcfc9('0x29')](respondWithStatusCode(_0x3e2e27,null))[_0xcfc9('0x4b')](handleError(_0x3e2e27,null));};exports[_0xcfc9('0x86')]=function(_0x14fafb,_0x4f1fed,_0x2e0671){return db[_0xcfc9('0x43')][_0xcfc9('0x4a')]({'where':{'id':_0x14fafb[_0xcfc9('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f1fed,null))[_0xcfc9('0x29')](function(_0x291da4){if(_0x291da4){return _0x291da4[_0xcfc9('0x86')](_0x14fafb[_0xcfc9('0x4d')][_0xcfc9('0x68')],_[_0xcfc9('0x87')](_0x14fafb[_0xcfc9('0x4d')],[_0xcfc9('0x68'),'id'])||{})['spread'](function(_0x17b46c){for(var _0x2c2472=0x0;_0x2c2472<_0x14fafb[_0xcfc9('0x4d')][_0xcfc9('0x68')][_0xcfc9('0x48')];_0x2c2472+=0x1){socket[_0xcfc9('0x75')](_0xcfc9('0x88'),{'UserId':Number(_0x14fafb[_0xcfc9('0x4d')][_0xcfc9('0x68')][_0x2c2472]),'MailQueueId':Number(_0x14fafb[_0xcfc9('0x47')]['id'])});}return _0x17b46c;});}})[_0xcfc9('0x29')](respondWithResult(_0x4f1fed,null))[_0xcfc9('0x4b')](handleError(_0x4f1fed,null));};exports[_0xcfc9('0x85')]=function(_0x4d5baf,_0x524cfb,_0x23ac96){return db[_0xcfc9('0x43')][_0xcfc9('0x4a')]({'where':{'id':_0x4d5baf[_0xcfc9('0x47')]['id']}})['then'](handleEntityNotFound(_0x524cfb,null))[_0xcfc9('0x29')](function(_0x3aea00){if(_0x3aea00){return _0x3aea00['removeAgents'](_0x4d5baf[_0xcfc9('0x36')][_0xcfc9('0x68')])['then'](function(){if(_[_0xcfc9('0x89')](_0x4d5baf[_0xcfc9('0x36')]['ids'])){for(var _0x141e6a=0x0;_0x141e6a<_0x4d5baf[_0xcfc9('0x36')]['ids']['length'];_0x141e6a+=0x1){socket[_0xcfc9('0x75')]('userMailQueue:remove',{'UserId':Number(_0x4d5baf[_0xcfc9('0x36')][_0xcfc9('0x68')][_0x141e6a]),'MailQueueId':Number(_0x4d5baf[_0xcfc9('0x47')]['id'])});}}else{socket['emit'](_0xcfc9('0x8a'),{'UserId':Number(_0x4d5baf['query'][_0xcfc9('0x68')]),'MailQueueId':Number(_0x4d5baf[_0xcfc9('0x47')]['id'])});}});}})[_0xcfc9('0x29')](respondWithStatusCode(_0x524cfb,null))[_0xcfc9('0x4b')](handleError(_0x524cfb,null));};exports[_0xcfc9('0x8b')]=function(_0x2fa01f,_0x1f7942,_0x399aa7){var _0x56db42={};var _0x55e2d6={};var _0x4064c5;var _0x25e008;return db[_0xcfc9('0x43')][_0xcfc9('0x66')]({'where':{'id':_0x2fa01f[_0xcfc9('0x47')]['id']}})['then'](handleEntityNotFound(_0x1f7942,null))[_0xcfc9('0x29')](function(_0x2e94cb){if(_0x2e94cb){_0x4064c5=_0x2e94cb;_0x55e2d6[_0xcfc9('0x34')]=_[_0xcfc9('0x35')](db['User'][_0xcfc9('0x32')]);_0x55e2d6['query']=_[_0xcfc9('0x35')](_0x2fa01f[_0xcfc9('0x36')]);_0x55e2d6[_0xcfc9('0x37')]=_[_0xcfc9('0x58')](_0x55e2d6[_0xcfc9('0x34')],_0x55e2d6[_0xcfc9('0x36')]);_0x56db42[_0xcfc9('0x39')]=_[_0xcfc9('0x58')](_0x55e2d6[_0xcfc9('0x34')],qs[_0xcfc9('0x38')](_0x2fa01f['query']['fields']));_0x56db42['attributes']=_0x56db42['attributes'][_0xcfc9('0x48')]?_0x56db42[_0xcfc9('0x39')]:_0x55e2d6['model'];_0x56db42[_0xcfc9('0x3b')]=qs[_0xcfc9('0x5a')](_0x2fa01f['query'][_0xcfc9('0x5a')]);_0x56db42[_0xcfc9('0x3c')]=qs[_0xcfc9('0x37')](_['pick'](_0x2fa01f[_0xcfc9('0x36')],_0x55e2d6[_0xcfc9('0x37')]));if(_0x2fa01f['query'][_0xcfc9('0x3e')]){_0x56db42['where']=_[_0xcfc9('0x3f')](_0x56db42['where'],{'$or':_[_0xcfc9('0x31')](_0x56db42[_0xcfc9('0x39')],function(_0x1fdb17){var _0xbaaed8={};_0xbaaed8[_0x1fdb17]={'$like':'%'+_0x2fa01f[_0xcfc9('0x36')][_0xcfc9('0x3e')]+'%'};return _0xbaaed8;})});}_0x56db42=_[_0xcfc9('0x3f')]({},_0x56db42,_0x2fa01f[_0xcfc9('0x41')]);return _0x4064c5[_0xcfc9('0x8b')](_0x56db42);}})[_0xcfc9('0x29')](function(_0x41a6b7){if(_0x41a6b7){_0x25e008=_0x41a6b7[_0xcfc9('0x48')];if(!_0x2fa01f[_0xcfc9('0x36')][_0xcfc9('0x59')](_0xcfc9('0x3a'))){_0x56db42['limit']=qs[_0xcfc9('0x21')](_0x2fa01f[_0xcfc9('0x36')][_0xcfc9('0x21')]);_0x56db42['offset']=qs[_0xcfc9('0x1f')](_0x2fa01f[_0xcfc9('0x36')][_0xcfc9('0x1f')]);}return _0x4064c5[_0xcfc9('0x8b')](_0x56db42);}})[_0xcfc9('0x29')](function(_0x303c62){if(_0x303c62){return _0x303c62?{'count':_0x25e008,'rows':_0x303c62}:null;}})[_0xcfc9('0x29')](respondWithResult(_0x1f7942,null))[_0xcfc9('0x4b')](handleError(_0x1f7942,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 8a73e91..32dce44 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 _0x3128=['emit','hasOwnProperty','exports','events','MailQueue','setMaxListeners','update'];(function(_0x15f21a,_0x20514d){var _0x8913b3=function(_0x7ddff8){while(--_0x7ddff8){_0x15f21a['push'](_0x15f21a['shift']());}};_0x8913b3(++_0x20514d);}(_0x3128,0xd5));var _0x8312=function(_0xd11385,_0x25b427){_0xd11385=_0xd11385-0x0;var _0xebebe8=_0x3128[_0xd11385];return _0xebebe8;};'use strict';var EventEmitter=require(_0x8312('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x8312('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x8312('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8312('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5e3dfe){return function(_0x59ed47,_0x3906f8,_0xd6b154){MailQueueEvents[_0x8312('0x4')](_0x5e3dfe+':'+_0x59ed47['id'],_0x59ed47);MailQueueEvents[_0x8312('0x4')](_0x5e3dfe,_0x59ed47);_0xd6b154(null);};}for(var e in events){if(events[_0x8312('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x8312('0x6')]=MailQueueEvents; \ No newline at end of file +var _0xa6ad=['remove','emit','hasOwnProperty','exports','../../mysqldb','MailQueue','setMaxListeners','update'];(function(_0x149907,_0xbec2d1){var _0x535b2a=function(_0x4a31b7){while(--_0x4a31b7){_0x149907['push'](_0x149907['shift']());}};_0x535b2a(++_0xbec2d1);}(_0xa6ad,0x1cc));var _0xda6a=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xa6ad[_0x12fc8d];return _0x3f9d04;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xda6a('0x0'))['db'][_0xda6a('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xda6a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xda6a('0x3'),'afterDestroy':_0xda6a('0x4')};function emitEvent(_0x5598ba){return function(_0x2d55e6,_0x1c2fe,_0x266829){MailQueueEvents[_0xda6a('0x5')](_0x5598ba+':'+_0x2d55e6['id'],_0x2d55e6);MailQueueEvents[_0xda6a('0x5')](_0x5598ba,_0x2d55e6);_0x266829(null);};}for(var e in events){if(events[_0xda6a('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xda6a('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 43a6f21..ec77677 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 _0x266f=['bluebird','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','util','../../config/logger','api','moment'];(function(_0xdf21d2,_0x29c2c8){var _0x39c680=function(_0xc73199){while(--_0xc73199){_0xdf21d2['push'](_0xdf21d2['shift']());}};_0x39c680(++_0x29c2c8);}(_0x266f,0x1a9));var _0xf266=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x266f[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require('lodash');var util=require(_0xf266('0x0'));var logger=require(_0xf266('0x1'))(_0xf266('0x2'));var moment=require(_0xf266('0x3'));var BPromise=require(_0xf266('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf266('0x5'));var rimraf=require(_0xf266('0x6'));var config=require(_0xf266('0x7'));var attributes=require(_0xf266('0x8'));module[_0xf266('0x9')]=function(_0xea8b92,_0x4cd6d0){return _0xea8b92['define'](_0xf266('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6969=['./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','util','api','bluebird','rimraf','../../config/environment'];(function(_0xd54451,_0x4c04aa){var _0x3d6592=function(_0xf73b85){while(--_0xf73b85){_0xd54451['push'](_0xd54451['shift']());}};_0x3d6592(++_0x4c04aa);}(_0x6969,0x1e4));var _0x9696=function(_0x1c6067,_0x5bcbe2){_0x1c6067=_0x1c6067-0x0;var _0x3f682f=_0x6969[_0x1c6067];return _0x3f682f;};'use strict';var _=require(_0x9696('0x0'));var util=require(_0x9696('0x1'));var logger=require('../../config/logger')(_0x9696('0x2'));var moment=require('moment');var BPromise=require(_0x9696('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9696('0x4'));var config=require(_0x9696('0x5'));var attributes=require(_0x9696('0x6'));module[_0x9696('0x7')]=function(_0x4b72bb,_0x4fc713){return _0x4b72bb['define'](_0x9696('0x8'),attributes,{'tableName':_0x9696('0x9'),'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 e3d8ee5..349a189 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 _0x0ae3=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailQueue.socket','MailQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetMailQueue','ShowMailQueue','info','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x0ae3,0x99));var _0x30ae=function(_0x341858,_0x43b9b0){_0x341858=_0x341858-0x0;var _0x3c2fd5=_0x0ae3[_0x341858];return _0x3c2fd5;};'use strict';var _=require(_0x30ae('0x0'));var util=require('util');var moment=require(_0x30ae('0x1'));var BPromise=require(_0x30ae('0x2'));var rs=require(_0x30ae('0x3'));var fs=require('fs');var Redis=require(_0x30ae('0x4'));var db=require(_0x30ae('0x5'))['db'];var utils=require(_0x30ae('0x6'));var logger=require(_0x30ae('0x7'))(_0x30ae('0x8'));var config=require(_0x30ae('0x9'));var jayson=require(_0x30ae('0xa'));var client=jayson[_0x30ae('0xb')][_0x30ae('0xc')]({'port':0x232a});config[_0x30ae('0xd')]=_[_0x30ae('0xe')](config[_0x30ae('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x30ae('0xf'))(new Redis(config['redis']));require(_0x30ae('0x10'))['register'](socket);function respondWithRpcPromise(_0x228983,_0x2d3846,_0x497105){return new BPromise(function(_0x1ada33,_0x3a3a76){return client['request'](_0x228983,_0x497105)['then'](function(_0x3a66af){logger['info'](_0x30ae('0x11'),_0x2d3846,'request\x20sent');logger[_0x30ae('0x12')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2d3846,_0x30ae('0x13'),JSON['stringify'](_0x3a66af));if(_0x3a66af[_0x30ae('0x14')]){if(_0x3a66af['error'][_0x30ae('0x15')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x2d3846,_0x3a66af[_0x30ae('0x14')][_0x30ae('0x16')]);return _0x3a3a76(_0x3a66af['error'][_0x30ae('0x16')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x2d3846,_0x3a66af[_0x30ae('0x14')]['message']);return _0x1ada33(_0x3a66af[_0x30ae('0x14')]['message']);}else{logger['info'](_0x30ae('0x11'),_0x2d3846,_0x30ae('0x13'));_0x1ada33(_0x3a66af[_0x30ae('0x17')][_0x30ae('0x16')]);}})['catch'](function(_0x1d2fee){logger['error'](_0x30ae('0x11'),_0x2d3846,_0x1d2fee);_0x3a3a76(_0x1d2fee);});});}exports['GetMailQueue']=function(_0x21f558){var _0x57e4d0=this;return new Promise(function(_0x362e25,_0xfe743a){return db[_0x30ae('0x18')][_0x30ae('0x19')]({'raw':_0x21f558[_0x30ae('0x1a')]?_0x21f558['options'][_0x30ae('0x1b')]===undefined?!![]:![]:!![],'where':_0x21f558[_0x30ae('0x1a')]?_0x21f558[_0x30ae('0x1a')][_0x30ae('0x1c')]||null:null,'attributes':_0x21f558[_0x30ae('0x1a')]?_0x21f558[_0x30ae('0x1a')][_0x30ae('0x1d')]||null:null,'limit':_0x21f558[_0x30ae('0x1a')]?_0x21f558[_0x30ae('0x1a')][_0x30ae('0x1e')]||null:null,'include':_0x21f558[_0x30ae('0x1a')]?_0x21f558[_0x30ae('0x1a')][_0x30ae('0x1f')]?_[_0x30ae('0x20')](_0x21f558[_0x30ae('0x1a')][_0x30ae('0x1f')],function(_0xd6d455){return{'model':db[_0xd6d455[_0x30ae('0x21')]],'as':_0xd6d455['as'],'attributes':_0xd6d455[_0x30ae('0x1d')],'include':_0xd6d455[_0x30ae('0x1f')]?_[_0x30ae('0x20')](_0xd6d455[_0x30ae('0x1f')],function(_0x6003ab){return{'model':db[_0x6003ab[_0x30ae('0x21')]],'as':_0x6003ab['as'],'attributes':_0x6003ab[_0x30ae('0x1d')],'include':_0x6003ab['include']?_['map'](_0x6003ab[_0x30ae('0x1f')],function(_0x2e7987){return{'model':db[_0x2e7987[_0x30ae('0x21')]],'as':_0x2e7987['as'],'attributes':_0x2e7987[_0x30ae('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x30ae('0x22')](function(_0x55dacb){logger['info'](_0x30ae('0x23'),_0x21f558);logger[_0x30ae('0x12')](_0x30ae('0x23'),_0x21f558,JSON['stringify'](_0x55dacb));_0x362e25(_0x55dacb);})['catch'](function(_0x5f27f2){logger[_0x30ae('0x14')](_0x30ae('0x23'),_0x5f27f2['message'],_0x21f558);_0xfe743a(_0x57e4d0['error'](0x1f4,_0x5f27f2[_0x30ae('0x16')]));});});};exports[_0x30ae('0x24')]=function(_0x3203ed){var _0x4e2c3c=this;return new Promise(function(_0x304c84,_0x4916cf){return db[_0x30ae('0x18')]['find']({'raw':_0x3203ed[_0x30ae('0x1a')]?_0x3203ed[_0x30ae('0x1a')][_0x30ae('0x1b')]===undefined?!![]:![]:!![],'where':_0x3203ed['options']?_0x3203ed[_0x30ae('0x1a')]['where']||null:null,'attributes':_0x3203ed[_0x30ae('0x1a')]?_0x3203ed[_0x30ae('0x1a')][_0x30ae('0x1d')]||null:null,'include':_0x3203ed['options']?_0x3203ed[_0x30ae('0x1a')][_0x30ae('0x1f')]?_[_0x30ae('0x20')](_0x3203ed['options'][_0x30ae('0x1f')],function(_0x253533){return{'model':db[_0x253533[_0x30ae('0x21')]],'as':_0x253533['as'],'attributes':_0x253533[_0x30ae('0x1d')],'include':_0x253533['include']?_[_0x30ae('0x20')](_0x253533['include'],function(_0x1ef9e0){return{'model':db[_0x1ef9e0['model']],'as':_0x1ef9e0['as'],'attributes':_0x1ef9e0[_0x30ae('0x1d')],'include':_0x1ef9e0[_0x30ae('0x1f')]?_[_0x30ae('0x20')](_0x1ef9e0['include'],function(_0x73659c){return{'model':db[_0x73659c[_0x30ae('0x21')]],'as':_0x73659c['as'],'attributes':_0x73659c[_0x30ae('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x30ae('0x22')](function(_0x253af8){logger[_0x30ae('0x25')](_0x30ae('0x24'),_0x3203ed);logger[_0x30ae('0x12')](_0x30ae('0x24'),_0x3203ed,JSON[_0x30ae('0x26')](_0x253af8));_0x304c84(_0x253af8);})[_0x30ae('0x27')](function(_0x1632e0){logger[_0x30ae('0x14')](_0x30ae('0x24'),_0x1632e0[_0x30ae('0x16')],_0x3203ed);_0x4916cf(_0x4e2c3c[_0x30ae('0x14')](0x1f4,_0x1632e0[_0x30ae('0x16')]));});});}; \ No newline at end of file +var _0xd89a=['socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include','map','model','catch','ShowMailQueue','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x5b262a,_0xeb3e3c){var _0x224731=function(_0x5be3a9){while(--_0x5be3a9){_0x5b262a['push'](_0x5b262a['shift']());}};_0x224731(++_0xeb3e3c);}(_0xd89a,0x6b));var _0xad89=function(_0x3d0fa1,_0xd57cd6){_0x3d0fa1=_0x3d0fa1-0x0;var _0x4660bc=_0xd89a[_0x3d0fa1];return _0x4660bc;};'use strict';var _=require(_0xad89('0x0'));var util=require('util');var moment=require(_0xad89('0x1'));var BPromise=require(_0xad89('0x2'));var rs=require(_0xad89('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad89('0x4'))['db'];var utils=require(_0xad89('0x5'));var logger=require('../../config/logger')(_0xad89('0x6'));var config=require(_0xad89('0x7'));var jayson=require(_0xad89('0x8'));var client=jayson[_0xad89('0x9')][_0xad89('0xa')]({'port':0x232a});config[_0xad89('0xb')]=_['defaults'](config[_0xad89('0xb')],{'host':_0xad89('0xc'),'port':0x18eb});var socket=require(_0xad89('0xd'))(new Redis(config[_0xad89('0xb')]));require(_0xad89('0xe'))[_0xad89('0xf')](socket);function respondWithRpcPromise(_0x39a06d,_0x41c409,_0x2f5d9b){return new BPromise(function(_0x3ae8bc,_0x326052){return client[_0xad89('0x10')](_0x39a06d,_0x2f5d9b)[_0xad89('0x11')](function(_0x46f9bf){logger[_0xad89('0x12')](_0xad89('0x13'),_0x41c409,_0xad89('0x14'));logger[_0xad89('0x15')](_0xad89('0x16'),_0x41c409,_0xad89('0x14'),JSON[_0xad89('0x17')](_0x46f9bf));if(_0x46f9bf['error']){if(_0x46f9bf['error'][_0xad89('0x18')]===0x1f4){logger[_0xad89('0x19')](_0xad89('0x13'),_0x41c409,_0x46f9bf[_0xad89('0x19')][_0xad89('0x1a')]);return _0x326052(_0x46f9bf['error'][_0xad89('0x1a')]);}logger['error'](_0xad89('0x13'),_0x41c409,_0x46f9bf[_0xad89('0x19')][_0xad89('0x1a')]);return _0x3ae8bc(_0x46f9bf[_0xad89('0x19')][_0xad89('0x1a')]);}else{logger[_0xad89('0x12')](_0xad89('0x13'),_0x41c409,_0xad89('0x14'));_0x3ae8bc(_0x46f9bf[_0xad89('0x1b')][_0xad89('0x1a')]);}})['catch'](function(_0x18dc90){logger[_0xad89('0x19')](_0xad89('0x13'),_0x41c409,_0x18dc90);_0x326052(_0x18dc90);});});}exports[_0xad89('0x1c')]=function(_0x2e0083){var _0x24e921=this;return new Promise(function(_0x5cc7f1,_0x2196c4){return db[_0xad89('0x1d')][_0xad89('0x1e')]({'raw':_0x2e0083[_0xad89('0x1f')]?_0x2e0083[_0xad89('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2e0083[_0xad89('0x1f')]?_0x2e0083['options'][_0xad89('0x20')]||null:null,'attributes':_0x2e0083['options']?_0x2e0083[_0xad89('0x1f')][_0xad89('0x21')]||null:null,'limit':_0x2e0083[_0xad89('0x1f')]?_0x2e0083['options'][_0xad89('0x22')]||null:null,'include':_0x2e0083[_0xad89('0x1f')]?_0x2e0083[_0xad89('0x1f')][_0xad89('0x23')]?_[_0xad89('0x24')](_0x2e0083[_0xad89('0x1f')][_0xad89('0x23')],function(_0x2bc22c){return{'model':db[_0x2bc22c[_0xad89('0x25')]],'as':_0x2bc22c['as'],'attributes':_0x2bc22c[_0xad89('0x21')],'include':_0x2bc22c[_0xad89('0x23')]?_[_0xad89('0x24')](_0x2bc22c[_0xad89('0x23')],function(_0x8d6c00){return{'model':db[_0x8d6c00[_0xad89('0x25')]],'as':_0x8d6c00['as'],'attributes':_0x8d6c00[_0xad89('0x21')],'include':_0x8d6c00[_0xad89('0x23')]?_[_0xad89('0x24')](_0x8d6c00[_0xad89('0x23')],function(_0x818f57){return{'model':db[_0x818f57[_0xad89('0x25')]],'as':_0x818f57['as'],'attributes':_0x818f57[_0xad89('0x21')]};}):[]};}):[]};}):[]:[]})[_0xad89('0x11')](function(_0x3d5250){logger[_0xad89('0x12')]('GetMailQueue',_0x2e0083);logger[_0xad89('0x15')](_0xad89('0x1c'),_0x2e0083,JSON[_0xad89('0x17')](_0x3d5250));_0x5cc7f1(_0x3d5250);})[_0xad89('0x26')](function(_0x2b58d8){logger[_0xad89('0x19')](_0xad89('0x1c'),_0x2b58d8[_0xad89('0x1a')],_0x2e0083);_0x2196c4(_0x24e921[_0xad89('0x19')](0x1f4,_0x2b58d8[_0xad89('0x1a')]));});});};exports['ShowMailQueue']=function(_0x429b52){var _0xd1198d=this;return new Promise(function(_0x1e373e,_0x2c752c){return db[_0xad89('0x1d')]['find']({'raw':_0x429b52['options']?_0x429b52['options']['raw']===undefined?!![]:![]:!![],'where':_0x429b52[_0xad89('0x1f')]?_0x429b52['options'][_0xad89('0x20')]||null:null,'attributes':_0x429b52[_0xad89('0x1f')]?_0x429b52[_0xad89('0x1f')][_0xad89('0x21')]||null:null,'include':_0x429b52['options']?_0x429b52[_0xad89('0x1f')][_0xad89('0x23')]?_['map'](_0x429b52['options'][_0xad89('0x23')],function(_0x135c93){return{'model':db[_0x135c93[_0xad89('0x25')]],'as':_0x135c93['as'],'attributes':_0x135c93[_0xad89('0x21')],'include':_0x135c93[_0xad89('0x23')]?_[_0xad89('0x24')](_0x135c93['include'],function(_0x185fb8){return{'model':db[_0x185fb8[_0xad89('0x25')]],'as':_0x185fb8['as'],'attributes':_0x185fb8[_0xad89('0x21')],'include':_0x185fb8['include']?_['map'](_0x185fb8[_0xad89('0x23')],function(_0x3a8fbd){return{'model':db[_0x3a8fbd['model']],'as':_0x3a8fbd['as'],'attributes':_0x3a8fbd[_0xad89('0x21')]};}):[]};}):[]};}):[]:[]})[_0xad89('0x11')](function(_0x3d16c5){logger[_0xad89('0x12')](_0xad89('0x27'),_0x429b52);logger[_0xad89('0x15')](_0xad89('0x27'),_0x429b52,JSON[_0xad89('0x17')](_0x3d16c5));_0x1e373e(_0x3d16c5);})[_0xad89('0x26')](function(_0x10970a){logger[_0xad89('0x19')]('ShowMailQueue',_0x10970a[_0xad89('0x1a')],_0x429b52);_0x2c752c(_0xd1198d[_0xad89('0x19')](0x1f4,_0x10970a[_0xad89('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 7e52ecd..dcd5873 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 _0x9809=['length','mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0x9809,0x1da));var _0x9980=function(_0x433695,_0x2fde12){_0x433695=_0x433695-0x0;var _0x26ae65=_0x9809[_0x433695];return _0x26ae65;};'use strict';var MailQueueEvents=require(_0x9980('0x0'));var events=[_0x9980('0x1'),_0x9980('0x2'),_0x9980('0x3')];function createListener(_0x14adcb,_0x1d5a4c){return function(_0x17b1c1){_0x1d5a4c[_0x9980('0x4')](_0x14adcb,_0x17b1c1);};}function removeListener(_0x64b7ec,_0xa65852){return function(){MailQueueEvents[_0x9980('0x5')](_0x64b7ec,_0xa65852);};}exports['register']=function(_0x4017d5){for(var _0x477af4=0x0,_0x55914b=events[_0x9980('0x6')];_0x477af4<_0x55914b;_0x477af4++){var _0x483a59=events[_0x477af4];var _0x283d1f=createListener(_0x9980('0x7')+_0x483a59,_0x4017d5);MailQueueEvents['on'](_0x483a59,_0x283d1f);}}; \ No newline at end of file +var _0xeebc=['length','./mailQueue.events','remove','removeListener','register'];(function(_0x5da877,_0x361726){var _0x3f2c10=function(_0x3a2ebc){while(--_0x3a2ebc){_0x5da877['push'](_0x5da877['shift']());}};_0x3f2c10(++_0x361726);}(_0xeebc,0x79));var _0xceeb=function(_0x2bb77b,_0xc4b850){_0x2bb77b=_0x2bb77b-0x0;var _0x343192=_0xeebc[_0x2bb77b];return _0x343192;};'use strict';var MailQueueEvents=require(_0xceeb('0x0'));var events=['save',_0xceeb('0x1'),'update'];function createListener(_0x46e8b0,_0x4f63ff){return function(_0x5f1f13){_0x4f63ff['emit'](_0x46e8b0,_0x5f1f13);};}function removeListener(_0x310358,_0x10dbd4){return function(){MailQueueEvents[_0xceeb('0x2')](_0x310358,_0x10dbd4);};}exports[_0xceeb('0x3')]=function(_0x3bef84){for(var _0x287895=0x0,_0x511d4d=events[_0xceeb('0x4')];_0x287895<_0x511d4d;_0x287895++){var _0x23d0dd=events[_0x287895];var _0x39b2b7=createListener('mailQueue:'+_0x23d0dd,_0x3bef84);MailQueueEvents['on'](_0x23d0dd,_0x39b2b7);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 09dfb01..4a6c70d 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 _0x8d95=['get','isAuthenticated','/describe','describe','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller'];(function(_0x21ceca,_0x1b8681){var _0x51d866=function(_0x3b1c32){while(--_0x3b1c32){_0x21ceca['push'](_0x21ceca['shift']());}};_0x51d866(++_0x1b8681);}(_0x8d95,0x83));var _0x58d9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8d95[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x58d9('0x0'));var util=require(_0x58d9('0x1'));var path=require('path');var timeout=require(_0x58d9('0x2'));var express=require(_0x58d9('0x3'));var router=express['Router']();var fs_extra=require(_0x58d9('0x4'));var auth=require(_0x58d9('0x5'));var interaction=require(_0x58d9('0x6'));var config=require(_0x58d9('0x7'));var controller=require(_0x58d9('0x8'));router[_0x58d9('0x9')]('/',auth[_0x58d9('0xa')](),controller['index']);router[_0x58d9('0x9')](_0x58d9('0xb'),auth[_0x58d9('0xa')](),controller[_0x58d9('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x58d9('0xa')](),controller[_0x58d9('0xd')]);router[_0x58d9('0xe')](_0x58d9('0xf'),auth[_0x58d9('0xa')](),controller[_0x58d9('0x10')]);router[_0x58d9('0x11')](_0x58d9('0xf'),auth[_0x58d9('0xa')](),controller[_0x58d9('0x12')]);module[_0x58d9('0x13')]=router; \ No newline at end of file +var _0xaecf=['create','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','./mailQueueReport.controller','get','index','isAuthenticated','describe','show','post'];(function(_0x18d6af,_0x39f1c9){var _0x12af5b=function(_0x291ded){while(--_0x291ded){_0x18d6af['push'](_0x18d6af['shift']());}};_0x12af5b(++_0x39f1c9);}(_0xaecf,0xf2));var _0xfaec=function(_0x38712e,_0x1d05b8){_0x38712e=_0x38712e-0x0;var _0x47468b=_0xaecf[_0x38712e];return _0x47468b;};'use strict';var multer=require(_0xfaec('0x0'));var util=require(_0xfaec('0x1'));var path=require(_0xfaec('0x2'));var timeout=require(_0xfaec('0x3'));var express=require(_0xfaec('0x4'));var router=express[_0xfaec('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfaec('0x6'));router[_0xfaec('0x7')]('/',auth['isAuthenticated'](),controller[_0xfaec('0x8')]);router[_0xfaec('0x7')]('/describe',auth[_0xfaec('0x9')](),controller[_0xfaec('0xa')]);router[_0xfaec('0x7')]('/:id',auth[_0xfaec('0x9')](),controller[_0xfaec('0xb')]);router[_0xfaec('0xc')]('/',auth[_0xfaec('0x9')](),controller[_0xfaec('0xd')]);router['put'](_0xfaec('0xe'),auth[_0xfaec('0x9')](),controller['update']);router['delete'](_0xfaec('0xe'),auth[_0xfaec('0x9')](),controller[_0xfaec('0xf')]);module[_0xfaec('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index aa1723d..61c855d 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 _0xdabe=['sequelize','exports','STRING','DATE'];(function(_0x1c6860,_0x2bec46){var _0x1c0962=function(_0x5088b8){while(--_0x5088b8){_0x1c6860['push'](_0x1c6860['shift']());}};_0x1c0962(++_0x2bec46);}(_0xdabe,0x1a8));var _0xedab=function(_0x1866b4,_0x157f8c){_0x1866b4=_0x1866b4-0x0;var _0x2fa262=_0xdabe[_0x1866b4];return _0x2fa262;};'use strict';var moment=require('moment');var Sequelize=require(_0xedab('0x0'));module[_0xedab('0x1')]={'uniqueid':{'type':Sequelize[_0xedab('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xedab('0x2')]},'joinAt':{'type':Sequelize[_0xedab('0x3')]},'leaveAt':{'type':Sequelize[_0xedab('0x3')]},'acceptAt':{'type':Sequelize[_0xedab('0x3')]},'exitAt':{'type':Sequelize[_0xedab('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf029=['DATE','moment','STRING'];(function(_0x210d77,_0x209310){var _0x1e3c12=function(_0x186bfb){while(--_0x186bfb){_0x210d77['push'](_0x210d77['shift']());}};_0x1e3c12(++_0x209310);}(_0xf029,0x6d));var _0x9f02=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xf029[_0x25e7cb];return _0x375d92;};'use strict';var moment=require(_0x9f02('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x9f02('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9f02('0x2')]},'leaveAt':{'type':Sequelize[_0x9f02('0x2')]},'acceptAt':{'type':Sequelize[_0x9f02('0x2')]},'exitAt':{'type':Sequelize[_0x9f02('0x2')]},'reason':{'type':Sequelize[_0x9f02('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 3742776..efab7d6 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 _0xeb3b=['destroy','error','stack','name','send','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','MailQueueReport','rawAttributes','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','reject','save','then'];(function(_0x4e8c96,_0x17ad41){var _0x44daa4=function(_0x736d9d){while(--_0x736d9d){_0x4e8c96['push'](_0x4e8c96['shift']());}};_0x44daa4(++_0x17ad41);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x54aea3,_0xae7d81){_0x54aea3=_0x54aea3-0x0;var _0x21ae46=_0xeb3b[_0x54aea3];return _0x21ae46;};'use strict';var emlformat=require(_0xbeb3('0x0'));var rimraf=require(_0xbeb3('0x1'));var zipdir=require(_0xbeb3('0x2'));var jsonpatch=require(_0xbeb3('0x3'));var rp=require(_0xbeb3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbeb3('0x5'));var util=require('util');var path=require(_0xbeb3('0x6'));var sox=require('sox');var csv=require(_0xbeb3('0x7'));var ejs=require(_0xbeb3('0x8'));var fs=require('fs');var fs_extra=require(_0xbeb3('0x9'));var _=require(_0xbeb3('0xa'));var squel=require(_0xbeb3('0xb'));var crypto=require(_0xbeb3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbeb3('0xd'));var toCsv=require(_0xbeb3('0x7'));var querystring=require(_0xbeb3('0xe'));var Papa=require(_0xbeb3('0xf'));var Redis=require(_0xbeb3('0x10'));var authService=require(_0xbeb3('0x11'));var qs=require(_0xbeb3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbeb3('0x13'));var logger=require(_0xbeb3('0x14'))('api');var utils=require(_0xbeb3('0x15'));var config=require(_0xbeb3('0x16'));var licenseUtil=require(_0xbeb3('0x17'));var db=require(_0xbeb3('0x18'))['db'];function respondWithStatusCode(_0x19868e,_0x313296){_0x313296=_0x313296||0xcc;return function(_0x5b9ace){if(_0x5b9ace){return _0x19868e['sendStatus'](_0x313296);}return _0x19868e[_0xbeb3('0x19')](_0x313296)[_0xbeb3('0x1a')]();};}function respondWithResult(_0x5f521b,_0x4dfb28){_0x4dfb28=_0x4dfb28||0xc8;return function(_0xed9879){if(_0xed9879){return _0x5f521b[_0xbeb3('0x19')](_0x4dfb28)[_0xbeb3('0x1b')](_0xed9879);}};}function respondWithFilteredResult(_0x43d58a,_0x26daf2){return function(_0x535836){if(_0x535836){var _0x1aeaee=typeof _0x26daf2['offset']===_0xbeb3('0x1c')&&typeof _0x26daf2['limit']==='undefined';var _0x4f8481=_0x535836[_0xbeb3('0x1d')];var _0x44a4bb=_0x1aeaee?0x0:_0x26daf2[_0xbeb3('0x1e')];var _0x10b15d=_0x1aeaee?_0x535836['count']:_0x26daf2[_0xbeb3('0x1e')]+_0x26daf2[_0xbeb3('0x1f')];var _0xe2cc47;if(_0x10b15d>=_0x4f8481){_0x10b15d=_0x4f8481;_0xe2cc47=0xc8;}else{_0xe2cc47=0xce;}_0x43d58a['status'](_0xe2cc47);return _0x43d58a['set'](_0xbeb3('0x20'),_0x44a4bb+'-'+_0x10b15d+'/'+_0x4f8481)['json'](_0x535836);}return null;};}function patchUpdates(_0x1d917b){return function(_0x50b005){try{jsonpatch['apply'](_0x50b005,_0x1d917b,!![]);}catch(_0xfa2736){return BPromise[_0xbeb3('0x21')](_0xfa2736);}return _0x50b005[_0xbeb3('0x22')]();};}function saveUpdates(_0x4bd89e,_0x301899){return function(_0x18ea0f){if(_0x18ea0f){return _0x18ea0f['update'](_0x4bd89e)[_0xbeb3('0x23')](function(_0x366bdb){return _0x366bdb;});}return null;};}function removeEntity(_0x55a59d,_0xfc384a){return function(_0x278fe4){if(_0x278fe4){return _0x278fe4[_0xbeb3('0x24')]()[_0xbeb3('0x23')](function(){_0x55a59d[_0xbeb3('0x19')](0xcc)[_0xbeb3('0x1a')]();});}};}function handleEntityNotFound(_0x84921a,_0x340581){return function(_0x46fe17){if(!_0x46fe17){_0x84921a['sendStatus'](0x194);}return _0x46fe17;};}function handleError(_0x4e695e,_0x1f36b9){_0x1f36b9=_0x1f36b9||0x1f4;return function(_0x520116){logger[_0xbeb3('0x25')](_0x520116[_0xbeb3('0x26')]);if(_0x520116[_0xbeb3('0x27')]){delete _0x520116[_0xbeb3('0x27')];}_0x4e695e['status'](_0x1f36b9)[_0xbeb3('0x28')](_0x520116);};}exports['index']=function(_0x26cd8f,_0xab301c){var _0x5bd93d={},_0x483198={},_0x9b8f13={'count':0x0,'rows':[]};var _0x585c6f=_['map'](db['MailQueueReport']['rawAttributes'],function(_0xf5dbaf){return{'name':_0xf5dbaf['fieldName'],'type':_0xf5dbaf[_0xbeb3('0x29')][_0xbeb3('0x2a')]};});_0x483198[_0xbeb3('0x2b')]=_[_0xbeb3('0x2c')](_0x585c6f,_0xbeb3('0x27'));_0x483198[_0xbeb3('0x2d')]=_[_0xbeb3('0x2e')](_0x26cd8f[_0xbeb3('0x2d')]);_0x483198[_0xbeb3('0x2f')]=_[_0xbeb3('0x30')](_0x483198['model'],_0x483198[_0xbeb3('0x2d')]);_0x5bd93d[_0xbeb3('0x31')]=_['intersection'](_0x483198[_0xbeb3('0x2b')],qs[_0xbeb3('0x32')](_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x32')]));_0x5bd93d['attributes']=_0x5bd93d[_0xbeb3('0x31')][_0xbeb3('0x33')]?_0x5bd93d[_0xbeb3('0x31')]:_0x483198[_0xbeb3('0x2b')];if(!_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x34')](_0xbeb3('0x35'))){_0x5bd93d[_0xbeb3('0x1f')]=qs[_0xbeb3('0x1f')](_0x26cd8f['query'][_0xbeb3('0x1f')]);_0x5bd93d['offset']=qs[_0xbeb3('0x1e')](_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x1e')]);}_0x5bd93d[_0xbeb3('0x36')]=qs[_0xbeb3('0x37')](_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x37')]);_0x5bd93d[_0xbeb3('0x38')]=qs['filters'](_[_0xbeb3('0x39')](_0x26cd8f['query'],_0x483198['filters']),_0x585c6f);if(_0x26cd8f['query'][_0xbeb3('0x3a')]){_0x5bd93d[_0xbeb3('0x38')]=_[_0xbeb3('0x3b')](_0x5bd93d[_0xbeb3('0x38')],{'$or':_[_0xbeb3('0x2c')](_0x585c6f,function(_0x40f166){if(_0x40f166['type']!==_0xbeb3('0x3c')){var _0x40de8d={};_0x40de8d[_0x40f166[_0xbeb3('0x27')]]={'$like':'%'+_0x26cd8f['query']['filter']+'%'};return _0x40de8d;}})});}_0x5bd93d=_['merge']({},_0x5bd93d,_0x26cd8f[_0xbeb3('0x3d')]);var _0x2a8860={'where':_0x5bd93d[_0xbeb3('0x38')]};return db['MailQueueReport'][_0xbeb3('0x1d')](_0x2a8860)['then'](function(_0x1b6700){_0x9b8f13[_0xbeb3('0x1d')]=_0x1b6700;if(_0x26cd8f[_0xbeb3('0x2d')][_0xbeb3('0x3e')]){_0x5bd93d['include']=[{'all':!![]}];}return db['MailQueueReport'][_0xbeb3('0x3f')](_0x5bd93d);})[_0xbeb3('0x23')](function(_0x3d4262){_0x9b8f13[_0xbeb3('0x40')]=_0x3d4262;return _0x9b8f13;})[_0xbeb3('0x23')](respondWithFilteredResult(_0xab301c,_0x5bd93d))[_0xbeb3('0x41')](handleError(_0xab301c,null));};exports[_0xbeb3('0x42')]=function(_0x4606a6,_0x5758c6){var _0xfcb57f={'raw':!![],'where':{'id':_0x4606a6[_0xbeb3('0x43')]['id']}},_0x39f2d2={};_0x39f2d2[_0xbeb3('0x2b')]=_[_0xbeb3('0x2e')](db[_0xbeb3('0x44')][_0xbeb3('0x45')]);_0x39f2d2['query']=_[_0xbeb3('0x2e')](_0x4606a6[_0xbeb3('0x2d')]);_0x39f2d2[_0xbeb3('0x2f')]=_[_0xbeb3('0x30')](_0x39f2d2[_0xbeb3('0x2b')],_0x39f2d2[_0xbeb3('0x2d')]);_0xfcb57f[_0xbeb3('0x31')]=_[_0xbeb3('0x30')](_0x39f2d2[_0xbeb3('0x2b')],qs[_0xbeb3('0x32')](_0x4606a6[_0xbeb3('0x2d')][_0xbeb3('0x32')]));_0xfcb57f[_0xbeb3('0x31')]=_0xfcb57f['attributes'][_0xbeb3('0x33')]?_0xfcb57f[_0xbeb3('0x31')]:_0x39f2d2[_0xbeb3('0x2b')];if(_0x4606a6['query']['includeAll']){_0xfcb57f[_0xbeb3('0x46')]=[{'all':!![]}];}_0xfcb57f=_[_0xbeb3('0x3b')]({},_0xfcb57f,_0x4606a6[_0xbeb3('0x3d')]);return db[_0xbeb3('0x44')]['find'](_0xfcb57f)[_0xbeb3('0x23')](handleEntityNotFound(_0x5758c6,null))['then'](respondWithResult(_0x5758c6,null))['catch'](handleError(_0x5758c6,null));};exports[_0xbeb3('0x47')]=function(_0x393e60,_0x1ff297){return db[_0xbeb3('0x44')]['create'](_0x393e60[_0xbeb3('0x48')],{})[_0xbeb3('0x23')](respondWithResult(_0x1ff297,0xc9))[_0xbeb3('0x41')](handleError(_0x1ff297,null));};exports['update']=function(_0x3f93ab,_0x58c49f){if(_0x3f93ab['body']['id']){delete _0x3f93ab[_0xbeb3('0x48')]['id'];}return db[_0xbeb3('0x44')][_0xbeb3('0x49')]({'where':{'id':_0x3f93ab['params']['id']}})[_0xbeb3('0x23')](handleEntityNotFound(_0x58c49f,null))[_0xbeb3('0x23')](saveUpdates(_0x3f93ab[_0xbeb3('0x48')],null))['then'](respondWithResult(_0x58c49f,null))[_0xbeb3('0x41')](handleError(_0x58c49f,null));};exports['destroy']=function(_0x39605b,_0x4d8e21){return db[_0xbeb3('0x44')][_0xbeb3('0x49')]({'where':{'id':_0x39605b[_0xbeb3('0x43')]['id']}})[_0xbeb3('0x23')](handleEntityNotFound(_0x4d8e21,null))[_0xbeb3('0x23')](removeEntity(_0x4d8e21,null))[_0xbeb3('0x41')](handleError(_0x4d8e21,null));};exports[_0xbeb3('0x4a')]=function(_0x168434,_0x49fded){return db[_0xbeb3('0x44')][_0xbeb3('0x4a')]()[_0xbeb3('0x23')](respondWithResult(_0x49fded,null))[_0xbeb3('0x41')](handleError(_0x49fded,null));}; \ No newline at end of file +var _0x4975=['to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','MailQueueReport','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x1bedd5,_0x877155){var _0x13c4d4=function(_0x5b9aff){while(--_0x5b9aff){_0x1bedd5['push'](_0x1bedd5['shift']());}};_0x13c4d4(++_0x877155);}(_0x4975,0x86));var _0x5497=function(_0x7c3640,_0x15d541){_0x7c3640=_0x7c3640-0x0;var _0x44e4f7=_0x4975[_0x7c3640];return _0x44e4f7;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['MailQueueReport']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':!![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['MailQueueReport'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));};exports['describe']=function(_0x1f73eb,_0x5b2c22){return db['MailQueueReport'][_0x5497('0x47')]()[_0x5497('0x24')](respondWithResult(_0x5b2c22,null))['catch'](handleError(_0x5b2c22,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index ede7f26..ac87753 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 _0xf301=['report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport'];(function(_0x4c2348,_0x4a369b){var _0x4a3717=function(_0x43e9e5){while(--_0x43e9e5){_0x4c2348['push'](_0x4c2348['shift']());}};_0x4a3717(++_0x4a369b);}(_0xf301,0xe2));var _0x1f30=function(_0xa557d,_0x333655){_0xa557d=_0xa557d-0x0;var _0x5f3a1a=_0xf301[_0xa557d];return _0x5f3a1a;};'use strict';var _=require(_0x1f30('0x0'));var util=require(_0x1f30('0x1'));var logger=require(_0x1f30('0x2'))('api');var moment=require(_0x1f30('0x3'));var BPromise=require(_0x1f30('0x4'));var rp=require(_0x1f30('0x5'));var fs=require('fs');var path=require(_0x1f30('0x6'));var rimraf=require(_0x1f30('0x7'));var config=require(_0x1f30('0x8'));var attributes=require(_0x1f30('0x9'));module[_0x1f30('0xa')]=function(_0x2ebf98,_0x12fe2d){return _0x2ebf98['define'](_0x1f30('0xb'),attributes,{'tableName':_0x1f30('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1f30('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5fb=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x2ae2d1,_0xba1e05){var _0x707b9f=function(_0x5d5e4f){while(--_0x5d5e4f){_0x2ae2d1['push'](_0x2ae2d1['shift']());}};_0x707b9f(++_0xba1e05);}(_0xc5fb,0xa8));var _0xbc5f=function(_0x5e0bfe,_0x747312){_0x5e0bfe=_0x5e0bfe-0x0;var _0x6468b8=_0xc5fb[_0x5e0bfe];return _0x6468b8;};'use strict';var _=require(_0xbc5f('0x0'));var util=require(_0xbc5f('0x1'));var logger=require(_0xbc5f('0x2'))(_0xbc5f('0x3'));var moment=require(_0xbc5f('0x4'));var BPromise=require('bluebird');var rp=require(_0xbc5f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc5f('0x6'));var config=require('../../config/environment');var attributes=require(_0xbc5f('0x7'));module[_0xbc5f('0x8')]=function(_0xcd3336,_0x3a3c7f){return _0xcd3336['define'](_0xbc5f('0x9'),attributes,{'tableName':_0xbc5f('0xa'),'paranoid':![],'indexes':[{'name':_0xbc5f('0xb'),'fields':[_0xbc5f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index d9a46f6..ba8b121 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x121eb4,_0x279712){var _0x1052ef=function(_0x565651){while(--_0x565651){_0x121eb4['push'](_0x121eb4['shift']());}};_0x1052ef(++_0x279712);}(_0xdb28,0x106));var _0x8db2=function(_0x2e8ffa,_0x22a845){_0x2e8ffa=_0x2e8ffa-0x0;var _0x3d25d3=_0xdb28[_0x2e8ffa];return _0x3d25d3;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x1a9283,_0x57eafc){var _0x5353fb=function(_0x3275da){while(--_0x3275da){_0x1a9283['push'](_0x1a9283['shift']());}};_0x5353fb(++_0x57eafc);}(_0xdb28,0x106));var _0x8db2=function(_0x11f088,_0x509165){_0x11f088=_0x11f088-0x0;var _0x3b9793=_0xdb28[_0x11f088];return _0x3b9793;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index b68f838..c68e13c 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(_0x3bd138,_0x3b58a6){var _0x58c6e3=function(_0x5aa7f3){while(--_0x5aa7f3){_0x3bd138['push'](_0x3bd138['shift']());}};_0x58c6e3(++_0x3b58a6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0xcb91[_0x340380];return _0x49ce1c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2c39d3,_0x2bf97b){var _0x1132c0=function(_0x2ce1bd){while(--_0x2ce1bd){_0x2c39d3['push'](_0x2c39d3['shift']());}};_0x1132c0(++_0x2bf97b);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 25be75b..9ece3cb 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 _0x593e=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x593e,0xcb));var _0xe593=function(_0x40834e,_0x12993f){_0x40834e=_0x40834e-0x0;var _0xd2c6bf=_0x593e[_0x40834e];return _0xd2c6bf;};'use strict';var Sequelize=require(_0xe593('0x0'));module[_0xe593('0x1')]={'description':{'type':Sequelize[_0xe593('0x2')]},'host':{'type':Sequelize[_0xe593('0x2')]},'authentication':{'type':Sequelize[_0xe593('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xe593('0x2')]},'password':{'type':Sequelize[_0xe593('0x2')]},'port':{'type':Sequelize[_0xe593('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe593('0x2')],'defaultValue':_0xe593('0x5')},'connTimeout':{'type':Sequelize[_0xe593('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe593('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xe593('0x2')]}}; \ No newline at end of file +var _0x2b65=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2b65,0x131));var _0x52b6=function(_0x4cc03b,_0x299f1c){_0x4cc03b=_0x4cc03b-0x0;var _0xf0358c=_0x2b65[_0x4cc03b];return _0xf0358c;};'use strict';var Sequelize=require(_0x52b6('0x0'));module[_0x52b6('0x1')]={'description':{'type':Sequelize[_0x52b6('0x2')]},'host':{'type':Sequelize[_0x52b6('0x2')]},'authentication':{'type':Sequelize[_0x52b6('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x52b6('0x2')]},'password':{'type':Sequelize[_0x52b6('0x2')]},'port':{'type':Sequelize[_0x52b6('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x52b6('0x2')],'defaultValue':_0x52b6('0x5')},'connTimeout':{'type':Sequelize[_0x52b6('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x52b6('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x52b6('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index f698407..2933e3f 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 _0xe584=['mail_servers_in','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','MailServerIn'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xe584,0xbc));var _0x4e58=function(_0x435b2f,_0x4c44da){_0x435b2f=_0x435b2f-0x0;var _0x181648=_0xe584[_0x435b2f];return _0x181648;};'use strict';var _=require('lodash');var util=require(_0x4e58('0x0'));var logger=require(_0x4e58('0x1'))(_0x4e58('0x2'));var moment=require(_0x4e58('0x3'));var BPromise=require(_0x4e58('0x4'));var rp=require(_0x4e58('0x5'));var fs=require('fs');var path=require(_0x4e58('0x6'));var rimraf=require(_0x4e58('0x7'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x42c824,_0xe3a91b){return _0x42c824[_0x4e58('0x8')](_0x4e58('0x9'),attributes,{'tableName':_0x4e58('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ec5=['exports','define','MailServerIn','mail_servers_in','util','../../config/logger','api','moment','bluebird','path','rimraf','./mailServerIn.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ec5,0xb8));var _0x54ec=function(_0x4076e6,_0x294be6){_0x4076e6=_0x4076e6-0x0;var _0x1eedb0=_0x4ec5[_0x4076e6];return _0x1eedb0;};'use strict';var _=require('lodash');var util=require(_0x54ec('0x0'));var logger=require(_0x54ec('0x1'))(_0x54ec('0x2'));var moment=require(_0x54ec('0x3'));var BPromise=require(_0x54ec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x54ec('0x5'));var rimraf=require(_0x54ec('0x6'));var config=require('../../config/environment');var attributes=require(_0x54ec('0x7'));module[_0x54ec('0x8')]=function(_0x361207,_0x3a3797){return _0x361207[_0x54ec('0x9')](_0x54ec('0xa'),attributes,{'tableName':_0x54ec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 8983a1a..de266a5 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 _0xb821=['MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','MailServerIn','findAll','options','raw','where','attributes','limit','map','model','include','info','GetMailServerIn','catch','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x32a2cf,_0x20b153){var _0x250e9d=function(_0x506bf2){while(--_0x506bf2){_0x32a2cf['push'](_0x32a2cf['shift']());}};_0x250e9d(++_0x20b153);}(_0xb821,0xa7));var _0x1b82=function(_0x54b835,_0x32b109){_0x54b835=_0x54b835-0x0;var _0x385363=_0xb821[_0x54b835];return _0x385363;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});}exports['GetMailServerIn']=function(_0x514082){var _0x415dff=this;return new Promise(function(_0x5d66c3,_0x3def2d){return db[_0x1b82('0x11')][_0x1b82('0x12')]({'raw':_0x514082['options']?_0x514082[_0x1b82('0x13')][_0x1b82('0x14')]===undefined?!![]:![]:!![],'where':_0x514082[_0x1b82('0x13')]?_0x514082[_0x1b82('0x13')][_0x1b82('0x15')]||null:null,'attributes':_0x514082['options']?_0x514082[_0x1b82('0x13')][_0x1b82('0x16')]||null:null,'limit':_0x514082[_0x1b82('0x13')]?_0x514082[_0x1b82('0x13')][_0x1b82('0x17')]||null:null,'include':_0x514082[_0x1b82('0x13')]?_0x514082[_0x1b82('0x13')]['include']?_[_0x1b82('0x18')](_0x514082[_0x1b82('0x13')]['include'],function(_0x561d78){return{'model':db[_0x561d78[_0x1b82('0x19')]],'as':_0x561d78['as'],'attributes':_0x561d78[_0x1b82('0x16')],'include':_0x561d78['include']?_[_0x1b82('0x18')](_0x561d78['include'],function(_0x5cd458){return{'model':db[_0x5cd458['model']],'as':_0x5cd458['as'],'attributes':_0x5cd458[_0x1b82('0x16')],'include':_0x5cd458[_0x1b82('0x1a')]?_[_0x1b82('0x18')](_0x5cd458[_0x1b82('0x1a')],function(_0x548a3b){return{'model':db[_0x548a3b[_0x1b82('0x19')]],'as':_0x548a3b['as'],'attributes':_0x548a3b[_0x1b82('0x16')]};}):[]};}):[]};}):[]:[]})[_0x1b82('0x9')](function(_0x7455e8){logger[_0x1b82('0x1b')](_0x1b82('0x1c'),_0x514082);logger[_0x1b82('0xc')](_0x1b82('0x1c'),_0x514082,JSON[_0x1b82('0xe')](_0x7455e8));_0x5d66c3(_0x7455e8);})[_0x1b82('0x1d')](function(_0x2fe45d){logger[_0x1b82('0xf')](_0x1b82('0x1c'),_0x2fe45d['message'],_0x514082);_0x3def2d(_0x415dff[_0x1b82('0xf')](0x1f4,_0x2fe45d[_0x1b82('0x10')]));});});}; \ No newline at end of file +var _0x2632=['request\x20sent','debug','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','GetMailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x9a51e0,_0x1e90ed){var _0x14b670=function(_0x18f0bc){while(--_0x18f0bc){_0x9a51e0['push'](_0x9a51e0['shift']());}};_0x14b670(++_0x1e90ed);}(_0x2632,0xae));var _0x2263=function(_0x2a8c7d,_0x30cc3c){_0x2a8c7d=_0x2a8c7d-0x0;var _0x16b8df=_0x2632[_0x2a8c7d];return _0x16b8df;};'use strict';var _=require('lodash');var util=require(_0x2263('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2263('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2263('0x2'))['db'];var utils=require(_0x2263('0x3'));var logger=require(_0x2263('0x4'))(_0x2263('0x5'));var config=require(_0x2263('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2263('0x7')][_0x2263('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ebe5e,_0x2173b1,_0x5a5b48){return new BPromise(function(_0x4a6c43,_0x51a169){return client[_0x2263('0x9')](_0x5ebe5e,_0x5a5b48)[_0x2263('0xa')](function(_0x24c04c){logger[_0x2263('0xb')]('MailServerIn,\x20%s,\x20%s',_0x2173b1,_0x2263('0xc'));logger[_0x2263('0xd')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x2173b1,'request\x20sent',JSON[_0x2263('0xe')](_0x24c04c));if(_0x24c04c[_0x2263('0xf')]){if(_0x24c04c[_0x2263('0xf')][_0x2263('0x10')]===0x1f4){logger[_0x2263('0xf')](_0x2263('0x11'),_0x2173b1,_0x24c04c[_0x2263('0xf')][_0x2263('0x12')]);return _0x51a169(_0x24c04c['error']['message']);}logger[_0x2263('0xf')](_0x2263('0x11'),_0x2173b1,_0x24c04c['error'][_0x2263('0x12')]);return _0x4a6c43(_0x24c04c['error'][_0x2263('0x12')]);}else{logger[_0x2263('0xb')]('MailServerIn,\x20%s,\x20%s',_0x2173b1,_0x2263('0xc'));_0x4a6c43(_0x24c04c[_0x2263('0x13')][_0x2263('0x12')]);}})['catch'](function(_0x8dc656){logger['error'](_0x2263('0x11'),_0x2173b1,_0x8dc656);_0x51a169(_0x8dc656);});});}exports[_0x2263('0x14')]=function(_0x3bd16e){var _0x13fb98=this;return new Promise(function(_0x3e0ed6,_0x50a1ee){return db['MailServerIn'][_0x2263('0x15')]({'raw':_0x3bd16e[_0x2263('0x16')]?_0x3bd16e[_0x2263('0x16')][_0x2263('0x17')]===undefined?!![]:![]:!![],'where':_0x3bd16e[_0x2263('0x16')]?_0x3bd16e['options'][_0x2263('0x18')]||null:null,'attributes':_0x3bd16e[_0x2263('0x16')]?_0x3bd16e[_0x2263('0x16')][_0x2263('0x19')]||null:null,'limit':_0x3bd16e[_0x2263('0x16')]?_0x3bd16e[_0x2263('0x16')][_0x2263('0x1a')]||null:null,'include':_0x3bd16e['options']?_0x3bd16e['options'][_0x2263('0x1b')]?_[_0x2263('0x1c')](_0x3bd16e['options']['include'],function(_0x21788d){return{'model':db[_0x21788d[_0x2263('0x1d')]],'as':_0x21788d['as'],'attributes':_0x21788d[_0x2263('0x19')],'include':_0x21788d['include']?_['map'](_0x21788d[_0x2263('0x1b')],function(_0x505655){return{'model':db[_0x505655[_0x2263('0x1d')]],'as':_0x505655['as'],'attributes':_0x505655[_0x2263('0x19')],'include':_0x505655['include']?_[_0x2263('0x1c')](_0x505655['include'],function(_0x42615c){return{'model':db[_0x42615c[_0x2263('0x1d')]],'as':_0x42615c['as'],'attributes':_0x42615c[_0x2263('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2263('0xa')](function(_0x3d4150){logger[_0x2263('0xb')](_0x2263('0x14'),_0x3bd16e);logger[_0x2263('0xd')]('GetMailServerIn',_0x3bd16e,JSON[_0x2263('0xe')](_0x3d4150));_0x3e0ed6(_0x3d4150);})[_0x2263('0x1e')](function(_0x11af5e){logger[_0x2263('0xf')](_0x2263('0x14'),_0x11af5e[_0x2263('0x12')],_0x3bd16e);_0x50a1ee(_0x13fb98[_0x2263('0xf')](0x1f4,_0x11af5e[_0x2263('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index b4f9bbc..4600392 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0x45788a,_0x217c45){_0x45788a=_0x45788a-0x0;var _0x239022=_0x7a54[_0x45788a];return _0x239022;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 325f493..f588f83 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 _0x0295=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0xd40d77,_0x101b68){var _0x5f062a=function(_0x4a2a44){while(--_0x4a2a44){_0xd40d77['push'](_0xd40d77['shift']());}};_0x5f062a(++_0x101b68);}(_0x0295,0x1f0));var _0x5029=function(_0xf61586,_0x56b0c4){_0xf61586=_0xf61586-0x0;var _0x2b6eb3=_0x0295[_0xf61586];return _0x2b6eb3;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5029('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x5029('0x2')]},'secure':{'type':Sequelize[_0x5029('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x5029('0x1')]},'authentication':{'type':Sequelize[_0x5029('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x536e=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x5906a5,_0x48af0a){var _0x1b9a31=function(_0x4b72ac){while(--_0x4b72ac){_0x5906a5['push'](_0x5906a5['shift']());}};_0x1b9a31(++_0x48af0a);}(_0x536e,0x111));var _0xe536=function(_0x545fe3,_0x3b191f){_0x545fe3=_0x545fe3-0x0;var _0x480702=_0x536e[_0x545fe3];return _0x480702;};'use strict';var Sequelize=require('sequelize');module[_0xe536('0x0')]={'description':{'type':Sequelize[_0xe536('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xe536('0x1')]},'port':{'type':Sequelize[_0xe536('0x2')]},'secure':{'type':Sequelize[_0xe536('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xe536('0x1')]},'authentication':{'type':Sequelize[_0xe536('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 ca71fef..b5c653c 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 _0x1bd0=['map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','MailServerOut','findAll','rows','catch','show','includeAll','find','create','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','model'];(function(_0x5073c1,_0x3c0e62){var _0x2f3029=function(_0x246c4f){while(--_0x246c4f){_0x5073c1['push'](_0x5073c1['shift']());}};_0x2f3029(++_0x3c0e62);}(_0x1bd0,0xf7));var _0x01bd=function(_0x3d0002,_0xc001c7){_0x3d0002=_0x3d0002-0x0;var _0x286475=_0x1bd0[_0x3d0002];return _0x286475;};'use strict';var emlformat=require(_0x01bd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x01bd('0x1'));var rp=require(_0x01bd('0x2'));var moment=require(_0x01bd('0x3'));var BPromise=require(_0x01bd('0x4'));var Mustache=require(_0x01bd('0x5'));var util=require(_0x01bd('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x01bd('0x7'));var fs=require('fs');var fs_extra=require(_0x01bd('0x8'));var _=require(_0x01bd('0x9'));var squel=require('squel');var crypto=require(_0x01bd('0xa'));var jsforce=require(_0x01bd('0xb'));var deskjs=require(_0x01bd('0xc'));var toCsv=require(_0x01bd('0xd'));var querystring=require(_0x01bd('0xe'));var Papa=require(_0x01bd('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x01bd('0x10'));var as=require(_0x01bd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x01bd('0x12'))(_0x01bd('0x13'));var utils=require('../../config/utils');var config=require(_0x01bd('0x14'));var licenseUtil=require(_0x01bd('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2aca76,_0x236b72){_0x236b72=_0x236b72||0xcc;return function(_0x4ff028){if(_0x4ff028){return _0x2aca76[_0x01bd('0x16')](_0x236b72);}return _0x2aca76[_0x01bd('0x17')](_0x236b72)['end']();};}function respondWithResult(_0x28b40b,_0x4e0bd4){_0x4e0bd4=_0x4e0bd4||0xc8;return function(_0x143540){if(_0x143540){return _0x28b40b['status'](_0x4e0bd4)[_0x01bd('0x18')](_0x143540);}};}function respondWithFilteredResult(_0x3f626a,_0x4f5a40){return function(_0xff64cc){if(_0xff64cc){var _0x19a522=typeof _0x4f5a40[_0x01bd('0x19')]===_0x01bd('0x1a')&&typeof _0x4f5a40[_0x01bd('0x1b')]===_0x01bd('0x1a');var _0x92e851=_0xff64cc[_0x01bd('0x1c')];var _0x2ebdd6=_0x19a522?0x0:_0x4f5a40[_0x01bd('0x19')];var _0x4568f7=_0x19a522?_0xff64cc['count']:_0x4f5a40[_0x01bd('0x19')]+_0x4f5a40[_0x01bd('0x1b')];var _0x9a1231;if(_0x4568f7>=_0x92e851){_0x4568f7=_0x92e851;_0x9a1231=0xc8;}else{_0x9a1231=0xce;}_0x3f626a[_0x01bd('0x17')](_0x9a1231);return _0x3f626a['set'](_0x01bd('0x1d'),_0x2ebdd6+'-'+_0x4568f7+'/'+_0x92e851)[_0x01bd('0x18')](_0xff64cc);}return null;};}function patchUpdates(_0xaa8b3c){return function(_0x2473e3){try{jsonpatch[_0x01bd('0x1e')](_0x2473e3,_0xaa8b3c,!![]);}catch(_0x19fcfe){return BPromise[_0x01bd('0x1f')](_0x19fcfe);}return _0x2473e3[_0x01bd('0x20')]();};}function saveUpdates(_0x5e7469,_0x37a841){return function(_0x3c358b){if(_0x3c358b){return _0x3c358b[_0x01bd('0x21')](_0x5e7469)[_0x01bd('0x22')](function(_0xe2ae12){return _0xe2ae12;});}return null;};}function removeEntity(_0x349bba,_0x391433){return function(_0x14f4f5){if(_0x14f4f5){return _0x14f4f5[_0x01bd('0x23')]()['then'](function(){_0x349bba[_0x01bd('0x17')](0xcc)[_0x01bd('0x24')]();});}};}function handleEntityNotFound(_0x9f3970,_0x2d837f){return function(_0x596b9a){if(!_0x596b9a){_0x9f3970[_0x01bd('0x16')](0x194);}return _0x596b9a;};}function handleError(_0x284abe,_0x3a2640){_0x3a2640=_0x3a2640||0x1f4;return function(_0x371f8b){logger[_0x01bd('0x25')](_0x371f8b[_0x01bd('0x26')]);if(_0x371f8b[_0x01bd('0x27')]){delete _0x371f8b[_0x01bd('0x27')];}_0x284abe[_0x01bd('0x17')](_0x3a2640)['send'](_0x371f8b);};}exports[_0x01bd('0x28')]=function(_0x17ac2c,_0x121fd2){var _0x55310a={},_0x2aa83c={},_0x5619e1={'count':0x0,'rows':[]};var _0x1b9d10=_['map'](db['MailServerOut'][_0x01bd('0x29')],function(_0x349072){return{'name':_0x349072[_0x01bd('0x2a')],'type':_0x349072[_0x01bd('0x2b')]['key']};});_0x2aa83c[_0x01bd('0x2c')]=_[_0x01bd('0x2d')](_0x1b9d10,_0x01bd('0x27'));_0x2aa83c[_0x01bd('0x2e')]=_[_0x01bd('0x2f')](_0x17ac2c['query']);_0x2aa83c['filters']=_[_0x01bd('0x30')](_0x2aa83c[_0x01bd('0x2c')],_0x2aa83c[_0x01bd('0x2e')]);_0x55310a[_0x01bd('0x31')]=_[_0x01bd('0x30')](_0x2aa83c[_0x01bd('0x2c')],qs[_0x01bd('0x32')](_0x17ac2c[_0x01bd('0x2e')][_0x01bd('0x32')]));_0x55310a[_0x01bd('0x31')]=_0x55310a[_0x01bd('0x31')][_0x01bd('0x33')]?_0x55310a[_0x01bd('0x31')]:_0x2aa83c[_0x01bd('0x2c')];if(!_0x17ac2c[_0x01bd('0x2e')][_0x01bd('0x34')](_0x01bd('0x35'))){_0x55310a[_0x01bd('0x1b')]=qs['limit'](_0x17ac2c['query'][_0x01bd('0x1b')]);_0x55310a[_0x01bd('0x19')]=qs[_0x01bd('0x19')](_0x17ac2c[_0x01bd('0x2e')]['offset']);}_0x55310a['order']=qs['sort'](_0x17ac2c['query'][_0x01bd('0x36')]);_0x55310a[_0x01bd('0x37')]=qs[_0x01bd('0x38')](_[_0x01bd('0x39')](_0x17ac2c[_0x01bd('0x2e')],_0x2aa83c[_0x01bd('0x38')]),_0x1b9d10);if(_0x17ac2c[_0x01bd('0x2e')][_0x01bd('0x3a')]){_0x55310a['where']=_[_0x01bd('0x3b')](_0x55310a['where'],{'$or':_[_0x01bd('0x2d')](_0x1b9d10,function(_0x381b30){if(_0x381b30[_0x01bd('0x2b')]!==_0x01bd('0x3c')){var _0x5666a1={};_0x5666a1[_0x381b30[_0x01bd('0x27')]]={'$like':'%'+_0x17ac2c['query'][_0x01bd('0x3a')]+'%'};return _0x5666a1;}})});}_0x55310a=_[_0x01bd('0x3b')]({},_0x55310a,_0x17ac2c[_0x01bd('0x3d')]);var _0x2f4bd4={'where':_0x55310a['where']};return db['MailServerOut'][_0x01bd('0x1c')](_0x2f4bd4)[_0x01bd('0x22')](function(_0x35ed5f){_0x5619e1[_0x01bd('0x1c')]=_0x35ed5f;if(_0x17ac2c[_0x01bd('0x2e')]['includeAll']){_0x55310a[_0x01bd('0x3e')]=[{'all':!![]}];}return db[_0x01bd('0x3f')][_0x01bd('0x40')](_0x55310a);})[_0x01bd('0x22')](function(_0x20ed8a){_0x5619e1[_0x01bd('0x41')]=_0x20ed8a;return _0x5619e1;})[_0x01bd('0x22')](respondWithFilteredResult(_0x121fd2,_0x55310a))[_0x01bd('0x42')](handleError(_0x121fd2,null));};exports[_0x01bd('0x43')]=function(_0x412132,_0x829563){var _0x117530={'raw':!![],'where':{'id':_0x412132['params']['id']}},_0x2097ec={};_0x2097ec['model']=_[_0x01bd('0x2f')](db[_0x01bd('0x3f')][_0x01bd('0x29')]);_0x2097ec[_0x01bd('0x2e')]=_[_0x01bd('0x2f')](_0x412132[_0x01bd('0x2e')]);_0x2097ec['filters']=_[_0x01bd('0x30')](_0x2097ec[_0x01bd('0x2c')],_0x2097ec[_0x01bd('0x2e')]);_0x117530[_0x01bd('0x31')]=_[_0x01bd('0x30')](_0x2097ec['model'],qs[_0x01bd('0x32')](_0x412132[_0x01bd('0x2e')]['fields']));_0x117530[_0x01bd('0x31')]=_0x117530[_0x01bd('0x31')][_0x01bd('0x33')]?_0x117530[_0x01bd('0x31')]:_0x2097ec[_0x01bd('0x2c')];if(_0x412132['query'][_0x01bd('0x44')]){_0x117530['include']=[{'all':!![]}];}_0x117530=_['merge']({},_0x117530,_0x412132[_0x01bd('0x3d')]);return db['MailServerOut'][_0x01bd('0x45')](_0x117530)[_0x01bd('0x22')](handleEntityNotFound(_0x829563,null))[_0x01bd('0x22')](respondWithResult(_0x829563,null))[_0x01bd('0x42')](handleError(_0x829563,null));};exports[_0x01bd('0x46')]=function(_0x83c152,_0x23ecf7){return db[_0x01bd('0x3f')][_0x01bd('0x46')](_0x83c152[_0x01bd('0x47')],{})[_0x01bd('0x22')](respondWithResult(_0x23ecf7,0xc9))[_0x01bd('0x42')](handleError(_0x23ecf7,null));};exports[_0x01bd('0x21')]=function(_0x2ea854,_0x254549){if(_0x2ea854[_0x01bd('0x47')]['id']){delete _0x2ea854[_0x01bd('0x47')]['id'];}return db[_0x01bd('0x3f')][_0x01bd('0x45')]({'where':{'id':_0x2ea854[_0x01bd('0x48')]['id']}})['then'](handleEntityNotFound(_0x254549,null))[_0x01bd('0x22')](saveUpdates(_0x2ea854['body'],null))['then'](respondWithResult(_0x254549,null))[_0x01bd('0x42')](handleError(_0x254549,null));};exports[_0x01bd('0x23')]=function(_0x4b521f,_0x23aff1){return db[_0x01bd('0x3f')]['find']({'where':{'id':_0x4b521f['params']['id']}})[_0x01bd('0x22')](handleEntityNotFound(_0x23aff1,null))[_0x01bd('0x22')](removeEntity(_0x23aff1,null))['catch'](handleError(_0x23aff1,null));}; \ No newline at end of file +var _0x6c37=['query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','then','findAll','rows','catch','show','params','keys','includeAll','include','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','type','key','model'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x6c37,0x140));var _0x76c3=function(_0x1c0117,_0x233981){_0x1c0117=_0x1c0117-0x0;var _0x2104ad=_0x6c37[_0x1c0117];return _0x2104ad;};'use strict';var emlformat=require(_0x76c3('0x0'));var rimraf=require(_0x76c3('0x1'));var zipdir=require(_0x76c3('0x2'));var jsonpatch=require(_0x76c3('0x3'));var rp=require(_0x76c3('0x4'));var moment=require(_0x76c3('0x5'));var BPromise=require(_0x76c3('0x6'));var Mustache=require(_0x76c3('0x7'));var util=require(_0x76c3('0x8'));var path=require(_0x76c3('0x9'));var sox=require('sox');var csv=require(_0x76c3('0xa'));var ejs=require(_0x76c3('0xb'));var fs=require('fs');var fs_extra=require(_0x76c3('0xc'));var _=require('lodash');var squel=require(_0x76c3('0xd'));var crypto=require(_0x76c3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x76c3('0xf'));var toCsv=require(_0x76c3('0xa'));var querystring=require(_0x76c3('0x10'));var Papa=require(_0x76c3('0x11'));var Redis=require(_0x76c3('0x12'));var authService=require(_0x76c3('0x13'));var qs=require(_0x76c3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76c3('0x15'));var logger=require('../../config/logger')(_0x76c3('0x16'));var utils=require(_0x76c3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x76c3('0x18'));var db=require(_0x76c3('0x19'))['db'];function respondWithStatusCode(_0x298c33,_0x923442){_0x923442=_0x923442||0xcc;return function(_0x22ee58){if(_0x22ee58){return _0x298c33['sendStatus'](_0x923442);}return _0x298c33[_0x76c3('0x1a')](_0x923442)[_0x76c3('0x1b')]();};}function respondWithResult(_0x50c0b8,_0x143621){_0x143621=_0x143621||0xc8;return function(_0x35827c){if(_0x35827c){return _0x50c0b8['status'](_0x143621)[_0x76c3('0x1c')](_0x35827c);}};}function respondWithFilteredResult(_0x351835,_0x548005){return function(_0x13be2d){if(_0x13be2d){var _0x2c127d=typeof _0x548005[_0x76c3('0x1d')]==='undefined'&&typeof _0x548005[_0x76c3('0x1e')]===_0x76c3('0x1f');var _0x327197=_0x13be2d['count'];var _0x10edb6=_0x2c127d?0x0:_0x548005[_0x76c3('0x1d')];var _0x5d7c1b=_0x2c127d?_0x13be2d[_0x76c3('0x20')]:_0x548005[_0x76c3('0x1d')]+_0x548005[_0x76c3('0x1e')];var _0xa0d676;if(_0x5d7c1b>=_0x327197){_0x5d7c1b=_0x327197;_0xa0d676=0xc8;}else{_0xa0d676=0xce;}_0x351835[_0x76c3('0x1a')](_0xa0d676);return _0x351835[_0x76c3('0x21')](_0x76c3('0x22'),_0x10edb6+'-'+_0x5d7c1b+'/'+_0x327197)['json'](_0x13be2d);}return null;};}function patchUpdates(_0x51e26d){return function(_0x3cc401){try{jsonpatch[_0x76c3('0x23')](_0x3cc401,_0x51e26d,!![]);}catch(_0x3c7ee5){return BPromise['reject'](_0x3c7ee5);}return _0x3cc401[_0x76c3('0x24')]();};}function saveUpdates(_0x23ac8d,_0x2002fb){return function(_0x1f42dd){if(_0x1f42dd){return _0x1f42dd[_0x76c3('0x25')](_0x23ac8d)['then'](function(_0x1877de){return _0x1877de;});}return null;};}function removeEntity(_0x2e1f79,_0x1ad2f0){return function(_0x41a16a){if(_0x41a16a){return _0x41a16a[_0x76c3('0x26')]()['then'](function(){_0x2e1f79['status'](0xcc)[_0x76c3('0x1b')]();});}};}function handleEntityNotFound(_0x40c0f5,_0x146815){return function(_0x41eaeb){if(!_0x41eaeb){_0x40c0f5['sendStatus'](0x194);}return _0x41eaeb;};}function handleError(_0x3eda1b,_0x4878a7){_0x4878a7=_0x4878a7||0x1f4;return function(_0x3df428){logger[_0x76c3('0x27')](_0x3df428[_0x76c3('0x28')]);if(_0x3df428['name']){delete _0x3df428[_0x76c3('0x29')];}_0x3eda1b['status'](_0x4878a7)['send'](_0x3df428);};}exports[_0x76c3('0x2a')]=function(_0x196970,_0x2b7750){var _0xd99277={},_0x304d4e={},_0x5e9850={'count':0x0,'rows':[]};var _0x2097f5=_[_0x76c3('0x2b')](db[_0x76c3('0x2c')][_0x76c3('0x2d')],function(_0x5757bc){return{'name':_0x5757bc[_0x76c3('0x2e')],'type':_0x5757bc[_0x76c3('0x2f')][_0x76c3('0x30')]};});_0x304d4e[_0x76c3('0x31')]=_[_0x76c3('0x2b')](_0x2097f5,'name');_0x304d4e[_0x76c3('0x32')]=_['keys'](_0x196970['query']);_0x304d4e[_0x76c3('0x33')]=_[_0x76c3('0x34')](_0x304d4e[_0x76c3('0x31')],_0x304d4e[_0x76c3('0x32')]);_0xd99277[_0x76c3('0x35')]=_[_0x76c3('0x34')](_0x304d4e[_0x76c3('0x31')],qs[_0x76c3('0x36')](_0x196970[_0x76c3('0x32')][_0x76c3('0x36')]));_0xd99277[_0x76c3('0x35')]=_0xd99277['attributes'][_0x76c3('0x37')]?_0xd99277['attributes']:_0x304d4e[_0x76c3('0x31')];if(!_0x196970[_0x76c3('0x32')]['hasOwnProperty'](_0x76c3('0x38'))){_0xd99277[_0x76c3('0x1e')]=qs[_0x76c3('0x1e')](_0x196970[_0x76c3('0x32')][_0x76c3('0x1e')]);_0xd99277[_0x76c3('0x1d')]=qs['offset'](_0x196970['query'][_0x76c3('0x1d')]);}_0xd99277['order']=qs[_0x76c3('0x39')](_0x196970[_0x76c3('0x32')]['sort']);_0xd99277[_0x76c3('0x3a')]=qs[_0x76c3('0x33')](_[_0x76c3('0x3b')](_0x196970[_0x76c3('0x32')],_0x304d4e[_0x76c3('0x33')]),_0x2097f5);if(_0x196970['query'][_0x76c3('0x3c')]){_0xd99277[_0x76c3('0x3a')]=_[_0x76c3('0x3d')](_0xd99277[_0x76c3('0x3a')],{'$or':_[_0x76c3('0x2b')](_0x2097f5,function(_0x1ce870){if(_0x1ce870[_0x76c3('0x2f')]!=='VIRTUAL'){var _0x4c5766={};_0x4c5766[_0x1ce870['name']]={'$like':'%'+_0x196970[_0x76c3('0x32')][_0x76c3('0x3c')]+'%'};return _0x4c5766;}})});}_0xd99277=_['merge']({},_0xd99277,_0x196970[_0x76c3('0x3e')]);var _0x474902={'where':_0xd99277[_0x76c3('0x3a')]};return db['MailServerOut'][_0x76c3('0x20')](_0x474902)[_0x76c3('0x3f')](function(_0x52f22e){_0x5e9850[_0x76c3('0x20')]=_0x52f22e;if(_0x196970['query']['includeAll']){_0xd99277['include']=[{'all':!![]}];}return db[_0x76c3('0x2c')][_0x76c3('0x40')](_0xd99277);})[_0x76c3('0x3f')](function(_0x2eceb4){_0x5e9850[_0x76c3('0x41')]=_0x2eceb4;return _0x5e9850;})['then'](respondWithFilteredResult(_0x2b7750,_0xd99277))[_0x76c3('0x42')](handleError(_0x2b7750,null));};exports[_0x76c3('0x43')]=function(_0x1376e7,_0x2fc472){var _0x140a98={'raw':!![],'where':{'id':_0x1376e7[_0x76c3('0x44')]['id']}},_0x1cad00={};_0x1cad00['model']=_[_0x76c3('0x45')](db['MailServerOut'][_0x76c3('0x2d')]);_0x1cad00[_0x76c3('0x32')]=_[_0x76c3('0x45')](_0x1376e7[_0x76c3('0x32')]);_0x1cad00[_0x76c3('0x33')]=_[_0x76c3('0x34')](_0x1cad00['model'],_0x1cad00[_0x76c3('0x32')]);_0x140a98['attributes']=_[_0x76c3('0x34')](_0x1cad00[_0x76c3('0x31')],qs[_0x76c3('0x36')](_0x1376e7[_0x76c3('0x32')][_0x76c3('0x36')]));_0x140a98['attributes']=_0x140a98[_0x76c3('0x35')]['length']?_0x140a98[_0x76c3('0x35')]:_0x1cad00[_0x76c3('0x31')];if(_0x1376e7[_0x76c3('0x32')][_0x76c3('0x46')]){_0x140a98[_0x76c3('0x47')]=[{'all':!![]}];}_0x140a98=_['merge']({},_0x140a98,_0x1376e7[_0x76c3('0x3e')]);return db[_0x76c3('0x2c')]['find'](_0x140a98)[_0x76c3('0x3f')](handleEntityNotFound(_0x2fc472,null))[_0x76c3('0x3f')](respondWithResult(_0x2fc472,null))['catch'](handleError(_0x2fc472,null));};exports['create']=function(_0xeb22da,_0x4a51ae){return db[_0x76c3('0x2c')]['create'](_0xeb22da['body'],{})[_0x76c3('0x3f')](respondWithResult(_0x4a51ae,0xc9))['catch'](handleError(_0x4a51ae,null));};exports[_0x76c3('0x25')]=function(_0x57051c,_0x55aa8c){if(_0x57051c[_0x76c3('0x48')]['id']){delete _0x57051c[_0x76c3('0x48')]['id'];}return db['MailServerOut'][_0x76c3('0x49')]({'where':{'id':_0x57051c[_0x76c3('0x44')]['id']}})[_0x76c3('0x3f')](handleEntityNotFound(_0x55aa8c,null))[_0x76c3('0x3f')](saveUpdates(_0x57051c['body'],null))[_0x76c3('0x3f')](respondWithResult(_0x55aa8c,null))['catch'](handleError(_0x55aa8c,null));};exports[_0x76c3('0x26')]=function(_0x44a0eb,_0x150258){return db[_0x76c3('0x2c')]['find']({'where':{'id':_0x44a0eb[_0x76c3('0x44')]['id']}})[_0x76c3('0x3f')](handleEntityNotFound(_0x150258,null))[_0x76c3('0x3f')](removeEntity(_0x150258,null))['catch'](handleError(_0x150258,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index d3acdea..ec787f9 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 _0x8d9a=['api','moment','bluebird','request-promise','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','../../config/logger'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x8d9a,0x1d2));var _0xa8d9=function(_0x32889b,_0x381a08){_0x32889b=_0x32889b-0x0;var _0xdc1a12=_0x8d9a[_0x32889b];return _0xdc1a12;};'use strict';var _=require(_0xa8d9('0x0'));var util=require('util');var logger=require(_0xa8d9('0x1'))(_0xa8d9('0x2'));var moment=require(_0xa8d9('0x3'));var BPromise=require(_0xa8d9('0x4'));var rp=require(_0xa8d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa8d9('0x6'));var attributes=require(_0xa8d9('0x7'));module[_0xa8d9('0x8')]=function(_0x2f2900,_0x2cbe68){return _0x2f2900[_0xa8d9('0x9')](_0xa8d9('0xa'),attributes,{'tableName':_0xa8d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d8a=['MailServerOut','mail_servers_out','../../config/logger','moment','bluebird','path','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x273914,_0x337966){var _0xad161a=function(_0x3b020b){while(--_0x3b020b){_0x273914['push'](_0x273914['shift']());}};_0xad161a(++_0x337966);}(_0x9d8a,0x1b0));var _0xa9d8=function(_0x1e6aa0,_0x23c5cd){_0x1e6aa0=_0x1e6aa0-0x0;var _0x2f65e9=_0x9d8a[_0x1e6aa0];return _0x2f65e9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa9d8('0x0'))('api');var moment=require(_0xa9d8('0x1'));var BPromise=require(_0xa9d8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9d8('0x3'));var rimraf=require('rimraf');var config=require(_0xa9d8('0x4'));var attributes=require(_0xa9d8('0x5'));module[_0xa9d8('0x6')]=function(_0xaadb78,_0x47f76a){return _0xaadb78[_0xa9d8('0x7')](_0xa9d8('0x8'),attributes,{'tableName':_0xa9d8('0x9'),'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 cb3e02b..fa9ca52 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x2e4c1f,_0xf0766){var _0x5b1837=function(_0x1c455a){while(--_0x1c455a){_0x2e4c1f['push'](_0x2e4c1f['shift']());}};_0x5b1837(++_0xf0766);}(_0x1261,0x144));var _0x1126=function(_0x1e9992,_0x24a7db){_0x1e9992=_0x1e9992-0x0;var _0x4204e2=_0x1261[_0x1e9992];return _0x4204e2;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4c42ff,_0x3d3d75){var _0x27387f=function(_0x2b0971){while(--_0x2b0971){_0x4c42ff['push'](_0x4c42ff['shift']());}};_0x27387f(++_0x3d3d75);}(_0x2ef3,0xba));var _0x32ef=function(_0x494786,_0x1c6c73){_0x494786=_0x494786-0x0;var _0x33502a=_0x2ef3[_0x494786];return _0x33502a;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index e61f897..d230e1d 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 _0x8057=['put','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x8057,0x8f));var _0x7805=function(_0x587004,_0x2540f8){_0x587004=_0x587004-0x0;var _0x46d357=_0x8057[_0x587004];return _0x46d357;};'use strict';var multer=require(_0x7805('0x0'));var util=require('util');var path=require(_0x7805('0x1'));var timeout=require(_0x7805('0x2'));var express=require(_0x7805('0x3'));var router=express[_0x7805('0x4')]();var fs_extra=require(_0x7805('0x5'));var auth=require(_0x7805('0x6'));var interaction=require(_0x7805('0x7'));var config=require(_0x7805('0x8'));var controller=require(_0x7805('0x9'));router[_0x7805('0xa')]('/',auth[_0x7805('0xb')](),controller[_0x7805('0xc')]);router['get']('/describe',auth[_0x7805('0xb')](),controller['describe']);router[_0x7805('0xa')](_0x7805('0xd'),auth['isAuthenticated'](),controller[_0x7805('0xe')]);router[_0x7805('0xf')]('/',auth[_0x7805('0xb')](),controller[_0x7805('0x10')]);router[_0x7805('0x11')](_0x7805('0xd'),auth[_0x7805('0xb')](),controller['update']);router['delete']('/:id',auth[_0x7805('0xb')](),controller[_0x7805('0x12')]);module[_0x7805('0x13')]=router; \ No newline at end of file +var _0x7b6c=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x4747f7,_0x3a0ecc){var _0x375a59=function(_0x1e56ee){while(--_0x1e56ee){_0x4747f7['push'](_0x4747f7['shift']());}};_0x375a59(++_0x3a0ecc);}(_0x7b6c,0x195));var _0xc7b6=function(_0x2f8a63,_0xbfc045){_0x2f8a63=_0x2f8a63-0x0;var _0x2c089b=_0x7b6c[_0x2f8a63];return _0x2c089b;};'use strict';var multer=require(_0xc7b6('0x0'));var util=require(_0xc7b6('0x1'));var path=require(_0xc7b6('0x2'));var timeout=require(_0xc7b6('0x3'));var express=require(_0xc7b6('0x4'));var router=express['Router']();var fs_extra=require(_0xc7b6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc7b6('0x6'));var config=require(_0xc7b6('0x7'));var controller=require(_0xc7b6('0x8'));router[_0xc7b6('0x9')]('/',auth[_0xc7b6('0xa')](),controller[_0xc7b6('0xb')]);router[_0xc7b6('0x9')](_0xc7b6('0xc'),auth[_0xc7b6('0xa')](),controller['describe']);router[_0xc7b6('0x9')](_0xc7b6('0xd'),auth[_0xc7b6('0xa')](),controller[_0xc7b6('0xe')]);router[_0xc7b6('0xf')]('/',auth[_0xc7b6('0xa')](),controller[_0xc7b6('0x10')]);router[_0xc7b6('0x11')](_0xc7b6('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xc7b6('0x12')](_0xc7b6('0xd'),auth[_0xc7b6('0xa')](),controller[_0xc7b6('0x13')]);module[_0xc7b6('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 7ddf51b..6c1a158 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 _0x3f8a=['name','sequelize','exports','STRING'];(function(_0x40f31a,_0x1fe2e8){var _0x49226b=function(_0x35ef44){while(--_0x35ef44){_0x40f31a['push'](_0x40f31a['shift']());}};_0x49226b(++_0x1fe2e8);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3ef5e4,_0x562317){_0x3ef5e4=_0x3ef5e4-0x0;var _0x10e5d3=_0x3f8a[_0x3ef5e4];return _0x10e5d3;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'unique':_0xa3f8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1db9=['STRING','name','sequelize','exports'];(function(_0x4a448d,_0x322720){var _0x104037=function(_0x4b3e47){while(--_0x4b3e47){_0x4a448d['push'](_0x4a448d['shift']());}};_0x104037(++_0x322720);}(_0x1db9,0x176));var _0x91db=function(_0x597406,_0xa4688e){_0x597406=_0x597406-0x0;var _0x2f52e4=_0x1db9[_0x597406];return _0x2f52e4;};'use strict';var Sequelize=require(_0x91db('0x0'));module[_0x91db('0x1')]={'name':{'type':Sequelize[_0x91db('0x2')],'unique':_0x91db('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x91db('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index d375785..4641884 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 _0x77b3=['hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','MailSubstatus','count','includeAll','include','catch','params','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','Content-Range','json','apply','reject','save','update','then','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length'];(function(_0x21ef3c,_0x14fdfe){var _0x2f8c52=function(_0x31491f){while(--_0x31491f){_0x21ef3c['push'](_0x21ef3c['shift']());}};_0x2f8c52(++_0x14fdfe);}(_0x77b3,0xe4));var _0x377b=function(_0x2f727b,_0x33b2cd){_0x2f727b=_0x2f727b-0x0;var _0x260f8e=_0x77b3[_0x2f727b];return _0x260f8e;};'use strict';var emlformat=require(_0x377b('0x0'));var rimraf=require(_0x377b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x377b('0x2'));var moment=require(_0x377b('0x3'));var BPromise=require(_0x377b('0x4'));var Mustache=require(_0x377b('0x5'));var util=require(_0x377b('0x6'));var path=require(_0x377b('0x7'));var sox=require('sox');var csv=require(_0x377b('0x8'));var ejs=require(_0x377b('0x9'));var fs=require('fs');var fs_extra=require(_0x377b('0xa'));var _=require(_0x377b('0xb'));var squel=require('squel');var crypto=require(_0x377b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x377b('0xd'));var toCsv=require(_0x377b('0x8'));var querystring=require(_0x377b('0xe'));var Papa=require('papaparse');var Redis=require(_0x377b('0xf'));var authService=require(_0x377b('0x10'));var qs=require(_0x377b('0x11'));var as=require(_0x377b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x377b('0x13'));var utils=require(_0x377b('0x14'));var config=require(_0x377b('0x15'));var licenseUtil=require(_0x377b('0x16'));var db=require(_0x377b('0x17'))['db'];function respondWithStatusCode(_0x34583c,_0x3c7af4){_0x3c7af4=_0x3c7af4||0xcc;return function(_0x1d046f){if(_0x1d046f){return _0x34583c[_0x377b('0x18')](_0x3c7af4);}return _0x34583c['status'](_0x3c7af4)[_0x377b('0x19')]();};}function respondWithResult(_0x4e4204,_0x26e6f5){_0x26e6f5=_0x26e6f5||0xc8;return function(_0x59c69f){if(_0x59c69f){return _0x4e4204[_0x377b('0x1a')](_0x26e6f5)['json'](_0x59c69f);}};}function respondWithFilteredResult(_0x34b285,_0x16efac){return function(_0x146166){if(_0x146166){var _0x5a34ed=typeof _0x16efac[_0x377b('0x1b')]===_0x377b('0x1c')&&typeof _0x16efac[_0x377b('0x1d')]==='undefined';var _0x1ab2b6=_0x146166['count'];var _0x23cb80=_0x5a34ed?0x0:_0x16efac[_0x377b('0x1b')];var _0x5458a4=_0x5a34ed?_0x146166['count']:_0x16efac['offset']+_0x16efac[_0x377b('0x1d')];var _0x4ea74c;if(_0x5458a4>=_0x1ab2b6){_0x5458a4=_0x1ab2b6;_0x4ea74c=0xc8;}else{_0x4ea74c=0xce;}_0x34b285[_0x377b('0x1a')](_0x4ea74c);return _0x34b285['set'](_0x377b('0x1e'),_0x23cb80+'-'+_0x5458a4+'/'+_0x1ab2b6)[_0x377b('0x1f')](_0x146166);}return null;};}function patchUpdates(_0xeaa1ba){return function(_0x1652da){try{jsonpatch[_0x377b('0x20')](_0x1652da,_0xeaa1ba,!![]);}catch(_0x16a5d0){return BPromise[_0x377b('0x21')](_0x16a5d0);}return _0x1652da[_0x377b('0x22')]();};}function saveUpdates(_0x58d207,_0x204f5a){return function(_0x4caac7){if(_0x4caac7){return _0x4caac7[_0x377b('0x23')](_0x58d207)[_0x377b('0x24')](function(_0x244522){return _0x244522;});}return null;};}function removeEntity(_0x43994b,_0x3881c7){return function(_0x41b0ad){if(_0x41b0ad){return _0x41b0ad['destroy']()['then'](function(){_0x43994b['status'](0xcc)[_0x377b('0x19')]();});}};}function handleEntityNotFound(_0x17ba50,_0x171d6e){return function(_0x512c56){if(!_0x512c56){_0x17ba50[_0x377b('0x18')](0x194);}return _0x512c56;};}function handleError(_0x266e8d,_0x47eebb){_0x47eebb=_0x47eebb||0x1f4;return function(_0x3ce96c){logger['error'](_0x3ce96c[_0x377b('0x25')]);if(_0x3ce96c[_0x377b('0x26')]){delete _0x3ce96c[_0x377b('0x26')];}_0x266e8d['status'](_0x47eebb)[_0x377b('0x27')](_0x3ce96c);};}exports['index']=function(_0x1b77a0,_0x11908e){var _0x99bc13={},_0x3303e8={},_0xd3cc79={'count':0x0,'rows':[]};var _0x1d55fd=_[_0x377b('0x28')](db['MailSubstatus'][_0x377b('0x29')],function(_0x15ce1b){return{'name':_0x15ce1b[_0x377b('0x2a')],'type':_0x15ce1b[_0x377b('0x2b')]['key']};});_0x3303e8['model']=_[_0x377b('0x28')](_0x1d55fd,_0x377b('0x26'));_0x3303e8[_0x377b('0x2c')]=_[_0x377b('0x2d')](_0x1b77a0[_0x377b('0x2c')]);_0x3303e8[_0x377b('0x2e')]=_[_0x377b('0x2f')](_0x3303e8[_0x377b('0x30')],_0x3303e8[_0x377b('0x2c')]);_0x99bc13['attributes']=_[_0x377b('0x2f')](_0x3303e8[_0x377b('0x30')],qs[_0x377b('0x31')](_0x1b77a0[_0x377b('0x2c')][_0x377b('0x31')]));_0x99bc13['attributes']=_0x99bc13[_0x377b('0x32')][_0x377b('0x33')]?_0x99bc13[_0x377b('0x32')]:_0x3303e8[_0x377b('0x30')];if(!_0x1b77a0['query'][_0x377b('0x34')](_0x377b('0x35'))){_0x99bc13[_0x377b('0x1d')]=qs[_0x377b('0x1d')](_0x1b77a0[_0x377b('0x2c')][_0x377b('0x1d')]);_0x99bc13[_0x377b('0x1b')]=qs[_0x377b('0x1b')](_0x1b77a0[_0x377b('0x2c')]['offset']);}_0x99bc13[_0x377b('0x36')]=qs[_0x377b('0x37')](_0x1b77a0[_0x377b('0x2c')][_0x377b('0x37')]);_0x99bc13['where']=qs[_0x377b('0x2e')](_['pick'](_0x1b77a0[_0x377b('0x2c')],_0x3303e8[_0x377b('0x2e')]),_0x1d55fd);if(_0x1b77a0[_0x377b('0x2c')][_0x377b('0x38')]){_0x99bc13[_0x377b('0x39')]=_['merge'](_0x99bc13[_0x377b('0x39')],{'$or':_[_0x377b('0x28')](_0x1d55fd,function(_0x425fbd){if(_0x425fbd[_0x377b('0x2b')]!==_0x377b('0x3a')){var _0x1514c8={};_0x1514c8[_0x425fbd[_0x377b('0x26')]]={'$like':'%'+_0x1b77a0[_0x377b('0x2c')][_0x377b('0x38')]+'%'};return _0x1514c8;}})});}_0x99bc13=_['merge']({},_0x99bc13,_0x1b77a0[_0x377b('0x3b')]);var _0x56d37c={'where':_0x99bc13[_0x377b('0x39')]};return db[_0x377b('0x3c')][_0x377b('0x3d')](_0x56d37c)['then'](function(_0x23e101){_0xd3cc79[_0x377b('0x3d')]=_0x23e101;if(_0x1b77a0[_0x377b('0x2c')][_0x377b('0x3e')]){_0x99bc13[_0x377b('0x3f')]=[{'all':!![]}];}return db[_0x377b('0x3c')]['findAll'](_0x99bc13);})[_0x377b('0x24')](function(_0x2338ee){_0xd3cc79['rows']=_0x2338ee;return _0xd3cc79;})[_0x377b('0x24')](respondWithFilteredResult(_0x11908e,_0x99bc13))[_0x377b('0x40')](handleError(_0x11908e,null));};exports['show']=function(_0x11fcd4,_0x360f11){var _0x459df4={'raw':!![],'where':{'id':_0x11fcd4[_0x377b('0x41')]['id']}},_0x1e3916={};_0x1e3916[_0x377b('0x30')]=_[_0x377b('0x2d')](db[_0x377b('0x3c')][_0x377b('0x29')]);_0x1e3916[_0x377b('0x2c')]=_['keys'](_0x11fcd4['query']);_0x1e3916[_0x377b('0x2e')]=_[_0x377b('0x2f')](_0x1e3916['model'],_0x1e3916[_0x377b('0x2c')]);_0x459df4[_0x377b('0x32')]=_[_0x377b('0x2f')](_0x1e3916[_0x377b('0x30')],qs['fields'](_0x11fcd4[_0x377b('0x2c')][_0x377b('0x31')]));_0x459df4[_0x377b('0x32')]=_0x459df4[_0x377b('0x32')]['length']?_0x459df4[_0x377b('0x32')]:_0x1e3916[_0x377b('0x30')];if(_0x11fcd4['query'][_0x377b('0x3e')]){_0x459df4[_0x377b('0x3f')]=[{'all':!![]}];}_0x459df4=_['merge']({},_0x459df4,_0x11fcd4[_0x377b('0x3b')]);return db['MailSubstatus'][_0x377b('0x42')](_0x459df4)[_0x377b('0x24')](handleEntityNotFound(_0x360f11,null))[_0x377b('0x24')](respondWithResult(_0x360f11,null))[_0x377b('0x40')](handleError(_0x360f11,null));};exports[_0x377b('0x43')]=function(_0x3afeee,_0x1758cd){return db[_0x377b('0x3c')][_0x377b('0x43')](_0x3afeee[_0x377b('0x44')],{})['then'](respondWithResult(_0x1758cd,0xc9))[_0x377b('0x40')](handleError(_0x1758cd,null));};exports[_0x377b('0x23')]=function(_0x5261b5,_0x2741f6){if(_0x5261b5[_0x377b('0x44')]['id']){delete _0x5261b5['body']['id'];}return db[_0x377b('0x3c')][_0x377b('0x42')]({'where':{'id':_0x5261b5[_0x377b('0x41')]['id']}})[_0x377b('0x24')](handleEntityNotFound(_0x2741f6,null))['then'](saveUpdates(_0x5261b5[_0x377b('0x44')],null))[_0x377b('0x24')](respondWithResult(_0x2741f6,null))[_0x377b('0x40')](handleError(_0x2741f6,null));};exports['destroy']=function(_0x36ad4a,_0x12b236){return db['MailSubstatus'][_0x377b('0x42')]({'where':{'id':_0x36ad4a['params']['id']}})[_0x377b('0x24')](handleEntityNotFound(_0x12b236,null))[_0x377b('0x24')](removeEntity(_0x12b236,null))[_0x377b('0x40')](handleError(_0x12b236,null));};exports[_0x377b('0x45')]=function(_0x57b2f2,_0x3f6531){return db[_0x377b('0x3c')][_0x377b('0x45')]()['then'](respondWithResult(_0x3f6531,null))[_0x377b('0x40')](handleError(_0x3f6531,null));}; \ No newline at end of file +var _0x8101=['fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','map','options','includeAll','rows','catch','show','params','keys','include','find','create','body','destroy','describe','rimraf'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x8101,0x127));var _0x1810=function(_0x515283,_0x813dea){_0x515283=_0x515283-0x0;var _0x38f836=_0x8101[_0x515283];return _0x38f836;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1810('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1810('0x1'));var rp=require('request-promise');var moment=require(_0x1810('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1810('0x3'));var util=require('util');var path=require(_0x1810('0x4'));var sox=require('sox');var csv=require(_0x1810('0x5'));var ejs=require(_0x1810('0x6'));var fs=require('fs');var fs_extra=require(_0x1810('0x7'));var _=require(_0x1810('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1810('0x9'));var toCsv=require(_0x1810('0x5'));var querystring=require(_0x1810('0xa'));var Papa=require('papaparse');var Redis=require(_0x1810('0xb'));var authService=require(_0x1810('0xc'));var qs=require(_0x1810('0xd'));var as=require(_0x1810('0xe'));var hardwareService=require(_0x1810('0xf'));var logger=require(_0x1810('0x10'))(_0x1810('0x11'));var utils=require('../../config/utils');var config=require(_0x1810('0x12'));var licenseUtil=require(_0x1810('0x13'));var db=require(_0x1810('0x14'))['db'];function respondWithStatusCode(_0x5661e0,_0x377e71){_0x377e71=_0x377e71||0xcc;return function(_0x253e07){if(_0x253e07){return _0x5661e0[_0x1810('0x15')](_0x377e71);}return _0x5661e0['status'](_0x377e71)['end']();};}function respondWithResult(_0x3b3f06,_0x5e0706){_0x5e0706=_0x5e0706||0xc8;return function(_0x4025d1){if(_0x4025d1){return _0x3b3f06[_0x1810('0x16')](_0x5e0706)[_0x1810('0x17')](_0x4025d1);}};}function respondWithFilteredResult(_0x5d8e10,_0x58eedf){return function(_0x34ba96){if(_0x34ba96){var _0x1e1efb=typeof _0x58eedf[_0x1810('0x18')]===_0x1810('0x19')&&typeof _0x58eedf[_0x1810('0x1a')]===_0x1810('0x19');var _0x201ba9=_0x34ba96['count'];var _0x5b15ba=_0x1e1efb?0x0:_0x58eedf[_0x1810('0x18')];var _0x370705=_0x1e1efb?_0x34ba96[_0x1810('0x1b')]:_0x58eedf[_0x1810('0x18')]+_0x58eedf['limit'];var _0x35d834;if(_0x370705>=_0x201ba9){_0x370705=_0x201ba9;_0x35d834=0xc8;}else{_0x35d834=0xce;}_0x5d8e10[_0x1810('0x16')](_0x35d834);return _0x5d8e10[_0x1810('0x1c')](_0x1810('0x1d'),_0x5b15ba+'-'+_0x370705+'/'+_0x201ba9)['json'](_0x34ba96);}return null;};}function patchUpdates(_0x18e23c){return function(_0x18dfc0){try{jsonpatch[_0x1810('0x1e')](_0x18dfc0,_0x18e23c,!![]);}catch(_0x2d7f56){return BPromise[_0x1810('0x1f')](_0x2d7f56);}return _0x18dfc0[_0x1810('0x20')]();};}function saveUpdates(_0x1f1083,_0x1055bf){return function(_0x2f9d67){if(_0x2f9d67){return _0x2f9d67[_0x1810('0x21')](_0x1f1083)[_0x1810('0x22')](function(_0x34571d){return _0x34571d;});}return null;};}function removeEntity(_0x4df32e,_0x254108){return function(_0x538dfe){if(_0x538dfe){return _0x538dfe['destroy']()[_0x1810('0x22')](function(){_0x4df32e[_0x1810('0x16')](0xcc)[_0x1810('0x23')]();});}};}function handleEntityNotFound(_0x2cb3ff,_0x1db004){return function(_0x10ac33){if(!_0x10ac33){_0x2cb3ff[_0x1810('0x15')](0x194);}return _0x10ac33;};}function handleError(_0x421f4b,_0x22d167){_0x22d167=_0x22d167||0x1f4;return function(_0x20fa73){logger[_0x1810('0x24')](_0x20fa73[_0x1810('0x25')]);if(_0x20fa73['name']){delete _0x20fa73[_0x1810('0x26')];}_0x421f4b[_0x1810('0x16')](_0x22d167)[_0x1810('0x27')](_0x20fa73);};}exports[_0x1810('0x28')]=function(_0xc4d224,_0x583a0c){var _0x30fc21={},_0x3e54a3={},_0x1a51e2={'count':0x0,'rows':[]};var _0x1d6485=_['map'](db[_0x1810('0x29')][_0x1810('0x2a')],function(_0x153094){return{'name':_0x153094[_0x1810('0x2b')],'type':_0x153094[_0x1810('0x2c')][_0x1810('0x2d')]};});_0x3e54a3[_0x1810('0x2e')]=_['map'](_0x1d6485,_0x1810('0x26'));_0x3e54a3[_0x1810('0x2f')]=_['keys'](_0xc4d224[_0x1810('0x2f')]);_0x3e54a3['filters']=_[_0x1810('0x30')](_0x3e54a3[_0x1810('0x2e')],_0x3e54a3[_0x1810('0x2f')]);_0x30fc21['attributes']=_[_0x1810('0x30')](_0x3e54a3[_0x1810('0x2e')],qs['fields'](_0xc4d224['query'][_0x1810('0x31')]));_0x30fc21[_0x1810('0x32')]=_0x30fc21['attributes'][_0x1810('0x33')]?_0x30fc21[_0x1810('0x32')]:_0x3e54a3[_0x1810('0x2e')];if(!_0xc4d224[_0x1810('0x2f')]['hasOwnProperty'](_0x1810('0x34'))){_0x30fc21[_0x1810('0x1a')]=qs[_0x1810('0x1a')](_0xc4d224[_0x1810('0x2f')][_0x1810('0x1a')]);_0x30fc21[_0x1810('0x18')]=qs[_0x1810('0x18')](_0xc4d224['query'][_0x1810('0x18')]);}_0x30fc21[_0x1810('0x35')]=qs[_0x1810('0x36')](_0xc4d224[_0x1810('0x2f')]['sort']);_0x30fc21[_0x1810('0x37')]=qs[_0x1810('0x38')](_[_0x1810('0x39')](_0xc4d224['query'],_0x3e54a3[_0x1810('0x38')]),_0x1d6485);if(_0xc4d224[_0x1810('0x2f')][_0x1810('0x3a')]){_0x30fc21[_0x1810('0x37')]=_[_0x1810('0x3b')](_0x30fc21[_0x1810('0x37')],{'$or':_[_0x1810('0x3c')](_0x1d6485,function(_0x1abb45){if(_0x1abb45['type']!=='VIRTUAL'){var _0x4af9e6={};_0x4af9e6[_0x1abb45[_0x1810('0x26')]]={'$like':'%'+_0xc4d224[_0x1810('0x2f')][_0x1810('0x3a')]+'%'};return _0x4af9e6;}})});}_0x30fc21=_['merge']({},_0x30fc21,_0xc4d224[_0x1810('0x3d')]);var _0x25718d={'where':_0x30fc21[_0x1810('0x37')]};return db[_0x1810('0x29')][_0x1810('0x1b')](_0x25718d)[_0x1810('0x22')](function(_0x112cbe){_0x1a51e2[_0x1810('0x1b')]=_0x112cbe;if(_0xc4d224[_0x1810('0x2f')][_0x1810('0x3e')]){_0x30fc21['include']=[{'all':!![]}];}return db[_0x1810('0x29')]['findAll'](_0x30fc21);})[_0x1810('0x22')](function(_0xc03ed6){_0x1a51e2[_0x1810('0x3f')]=_0xc03ed6;return _0x1a51e2;})[_0x1810('0x22')](respondWithFilteredResult(_0x583a0c,_0x30fc21))[_0x1810('0x40')](handleError(_0x583a0c,null));};exports[_0x1810('0x41')]=function(_0x58689a,_0x14b9c2){var _0xcbebfe={'raw':!![],'where':{'id':_0x58689a[_0x1810('0x42')]['id']}},_0xd51410={};_0xd51410[_0x1810('0x2e')]=_[_0x1810('0x43')](db['MailSubstatus'][_0x1810('0x2a')]);_0xd51410[_0x1810('0x2f')]=_[_0x1810('0x43')](_0x58689a[_0x1810('0x2f')]);_0xd51410['filters']=_[_0x1810('0x30')](_0xd51410[_0x1810('0x2e')],_0xd51410[_0x1810('0x2f')]);_0xcbebfe[_0x1810('0x32')]=_['intersection'](_0xd51410[_0x1810('0x2e')],qs['fields'](_0x58689a['query'][_0x1810('0x31')]));_0xcbebfe[_0x1810('0x32')]=_0xcbebfe['attributes'][_0x1810('0x33')]?_0xcbebfe['attributes']:_0xd51410['model'];if(_0x58689a[_0x1810('0x2f')][_0x1810('0x3e')]){_0xcbebfe[_0x1810('0x44')]=[{'all':!![]}];}_0xcbebfe=_[_0x1810('0x3b')]({},_0xcbebfe,_0x58689a[_0x1810('0x3d')]);return db[_0x1810('0x29')][_0x1810('0x45')](_0xcbebfe)['then'](handleEntityNotFound(_0x14b9c2,null))[_0x1810('0x22')](respondWithResult(_0x14b9c2,null))[_0x1810('0x40')](handleError(_0x14b9c2,null));};exports[_0x1810('0x46')]=function(_0x28b5f6,_0x3d005d){return db[_0x1810('0x29')]['create'](_0x28b5f6[_0x1810('0x47')],{})[_0x1810('0x22')](respondWithResult(_0x3d005d,0xc9))['catch'](handleError(_0x3d005d,null));};exports[_0x1810('0x21')]=function(_0x2162e9,_0x1c82b2){if(_0x2162e9[_0x1810('0x47')]['id']){delete _0x2162e9['body']['id'];}return db[_0x1810('0x29')][_0x1810('0x45')]({'where':{'id':_0x2162e9[_0x1810('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c82b2,null))['then'](saveUpdates(_0x2162e9[_0x1810('0x47')],null))[_0x1810('0x22')](respondWithResult(_0x1c82b2,null))[_0x1810('0x40')](handleError(_0x1c82b2,null));};exports[_0x1810('0x48')]=function(_0x40c8f1,_0x336c03){return db['MailSubstatus']['find']({'where':{'id':_0x40c8f1[_0x1810('0x42')]['id']}})[_0x1810('0x22')](handleEntityNotFound(_0x336c03,null))['then'](removeEntity(_0x336c03,null))[_0x1810('0x40')](handleError(_0x336c03,null));};exports['describe']=function(_0x1ae896,_0x3f520e){return db['MailSubstatus'][_0x1810('0x49')]()[_0x1810('0x22')](respondWithResult(_0x3f520e,null))[_0x1810('0x40')](handleError(_0x3f520e,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index e00b463..678920a 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 _0x35b5=['./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1b0391,_0x77f637){var _0x4e9765=function(_0x3af47a){while(--_0x3af47a){_0x1b0391['push'](_0x1b0391['shift']());}};_0x4e9765(++_0x77f637);}(_0x35b5,0xe6));var _0x535b=function(_0x2e30d7,_0x2dfa9c){_0x2e30d7=_0x2e30d7-0x0;var _0x49a35b=_0x35b5[_0x2e30d7];return _0x49a35b;};'use strict';var _=require(_0x535b('0x0'));var util=require(_0x535b('0x1'));var logger=require(_0x535b('0x2'))(_0x535b('0x3'));var moment=require(_0x535b('0x4'));var BPromise=require(_0x535b('0x5'));var rp=require(_0x535b('0x6'));var fs=require('fs');var path=require(_0x535b('0x7'));var rimraf=require(_0x535b('0x8'));var config=require(_0x535b('0x9'));var attributes=require(_0x535b('0xa'));module[_0x535b('0xb')]=function(_0x2962b0,_0x34b4c4){return _0x2962b0[_0x535b('0xc')](_0x535b('0xd'),attributes,{'tableName':_0x535b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xede8=['moment','bluebird','path','rimraf','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus','../../config/logger','api'];(function(_0x499084,_0xc40d3f){var _0x2f805a=function(_0x59ede6){while(--_0x59ede6){_0x499084['push'](_0x499084['shift']());}};_0x2f805a(++_0xc40d3f);}(_0xede8,0xe4));var _0x8ede=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xede8[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8ede('0x0'))(_0x8ede('0x1'));var moment=require(_0x8ede('0x2'));var BPromise=require(_0x8ede('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ede('0x4'));var rimraf=require(_0x8ede('0x5'));var config=require(_0x8ede('0x6'));var attributes=require(_0x8ede('0x7'));module['exports']=function(_0x3f7f8b,_0x42d219){return _0x3f7f8b[_0x8ede('0x8')](_0x8ede('0x9'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index af8d1a1..4a5312e 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 _0x49aa=['rpc','jayson/promise','client','http','request','then','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','MailSubstatus,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3782f1,_0xdb9da7){var _0x59aa2c=function(_0x3ecfb1){while(--_0x3ecfb1){_0x3782f1['push'](_0x3782f1['shift']());}};_0x59aa2c(++_0xdb9da7);}(_0x49aa,0x1ad));var _0xa49a=function(_0x9a71e6,_0x17f10c){_0x9a71e6=_0x9a71e6-0x0;var _0x25f77c=_0x49aa[_0x9a71e6];return _0x25f77c;};'use strict';var _=require(_0xa49a('0x0'));var util=require(_0xa49a('0x1'));var moment=require(_0xa49a('0x2'));var BPromise=require(_0xa49a('0x3'));var rs=require(_0xa49a('0x4'));var fs=require('fs');var Redis=require(_0xa49a('0x5'));var db=require(_0xa49a('0x6'))['db'];var utils=require(_0xa49a('0x7'));var logger=require('../../config/logger')(_0xa49a('0x8'));var config=require('../../config/environment');var jayson=require(_0xa49a('0x9'));var client=jayson[_0xa49a('0xa')][_0xa49a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a7f10,_0x248133,_0x1976f7){return new BPromise(function(_0x168a39,_0x47bf72){return client[_0xa49a('0xc')](_0x3a7f10,_0x1976f7)[_0xa49a('0xd')](function(_0x4c3260){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x248133,_0xa49a('0xe'));logger['debug'](_0xa49a('0xf'),_0x248133,'request\x20sent',JSON['stringify'](_0x4c3260));if(_0x4c3260[_0xa49a('0x10')]){if(_0x4c3260['error'][_0xa49a('0x11')]===0x1f4){logger['error'](_0xa49a('0x12'),_0x248133,_0x4c3260[_0xa49a('0x10')][_0xa49a('0x13')]);return _0x47bf72(_0x4c3260['error'][_0xa49a('0x13')]);}logger[_0xa49a('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x248133,_0x4c3260[_0xa49a('0x10')]['message']);return _0x168a39(_0x4c3260['error']['message']);}else{logger[_0xa49a('0x14')](_0xa49a('0x12'),_0x248133,'request\x20sent');_0x168a39(_0x4c3260[_0xa49a('0x15')][_0xa49a('0x13')]);}})[_0xa49a('0x16')](function(_0x428cd0){logger[_0xa49a('0x10')](_0xa49a('0x12'),_0x248133,_0x428cd0);_0x47bf72(_0x428cd0);});});} \ No newline at end of file +var _0x7605=['debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent'];(function(_0xf2f332,_0x299fbf){var _0x56cce3=function(_0x5f37e0){while(--_0x5f37e0){_0xf2f332['push'](_0xf2f332['shift']());}};_0x56cce3(++_0x299fbf);}(_0x7605,0x13f));var _0x5760=function(_0x5eecdf,_0x507bb7){_0x5eecdf=_0x5eecdf-0x0;var _0x13fe66=_0x7605[_0x5eecdf];return _0x13fe66;};'use strict';var _=require(_0x5760('0x0'));var util=require(_0x5760('0x1'));var moment=require(_0x5760('0x2'));var BPromise=require(_0x5760('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5760('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5760('0x5'));var logger=require(_0x5760('0x6'))(_0x5760('0x7'));var config=require(_0x5760('0x8'));var jayson=require(_0x5760('0x9'));var client=jayson[_0x5760('0xa')][_0x5760('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c4063,_0x3ae1b7,_0x40db41){return new BPromise(function(_0x5f41d7,_0x4c3e34){return client[_0x5760('0xc')](_0x5c4063,_0x40db41)[_0x5760('0xd')](function(_0x13d5cd){logger[_0x5760('0xe')](_0x5760('0xf'),_0x3ae1b7,_0x5760('0x10'));logger[_0x5760('0x11')](_0x5760('0x12'),_0x3ae1b7,_0x5760('0x10'),JSON[_0x5760('0x13')](_0x13d5cd));if(_0x13d5cd[_0x5760('0x14')]){if(_0x13d5cd['error']['code']===0x1f4){logger[_0x5760('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x3ae1b7,_0x13d5cd[_0x5760('0x14')]['message']);return _0x4c3e34(_0x13d5cd[_0x5760('0x14')][_0x5760('0x15')]);}logger[_0x5760('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x3ae1b7,_0x13d5cd[_0x5760('0x14')][_0x5760('0x15')]);return _0x5f41d7(_0x13d5cd[_0x5760('0x14')][_0x5760('0x15')]);}else{logger[_0x5760('0xe')](_0x5760('0xf'),_0x3ae1b7,_0x5760('0x10'));_0x5f41d7(_0x13d5cd[_0x5760('0x16')][_0x5760('0x15')]);}})[_0x5760('0x17')](function(_0x4f8ed0){logger[_0x5760('0x14')](_0x5760('0xf'),_0x3ae1b7,_0x4f8ed0);_0x4c3e34(_0x4f8ed0);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index f651957..95c903e 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 _0x8902=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x4b35b6,_0x297824){var _0x149c96=function(_0x5dd2bd){while(--_0x5dd2bd){_0x4b35b6['push'](_0x4b35b6['shift']());}};_0x149c96(++_0x297824);}(_0x8902,0x16f));var _0x2890=function(_0x53aba6,_0x174496){_0x53aba6=_0x53aba6-0x0;var _0x320506=_0x8902[_0x53aba6];return _0x320506;};'use strict';var multer=require(_0x2890('0x0'));var util=require(_0x2890('0x1'));var path=require(_0x2890('0x2'));var timeout=require('connect-timeout');var express=require(_0x2890('0x3'));var router=express[_0x2890('0x4')]();var fs_extra=require(_0x2890('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2890('0x6'));var config=require(_0x2890('0x7'));var controller=require('./mailTransferReport.controller');router[_0x2890('0x8')]('/',auth[_0x2890('0x9')](),controller[_0x2890('0xa')]);router[_0x2890('0x8')]('/describe',auth[_0x2890('0x9')](),controller[_0x2890('0xb')]);router['get'](_0x2890('0xc'),auth['isAuthenticated'](),controller[_0x2890('0xd')]);router[_0x2890('0xe')]('/',auth[_0x2890('0x9')](),controller[_0x2890('0xf')]);router[_0x2890('0x10')](_0x2890('0xc'),auth[_0x2890('0x9')](),controller[_0x2890('0x11')]);router[_0x2890('0x12')](_0x2890('0xc'),auth[_0x2890('0x9')](),controller[_0x2890('0x13')]);module[_0x2890('0x14')]=router; \ No newline at end of file +var _0xf0c0=['put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x4d2744,_0x4bfda2){var _0x2987c5=function(_0x5b0924){while(--_0x5b0924){_0x4d2744['push'](_0x4d2744['shift']());}};_0x2987c5(++_0x4bfda2);}(_0xf0c0,0xa6));var _0x0f0c=function(_0x38b6eb,_0xefc65f){_0x38b6eb=_0x38b6eb-0x0;var _0x37a5db=_0xf0c0[_0x38b6eb];return _0x37a5db;};'use strict';var multer=require(_0x0f0c('0x0'));var util=require(_0x0f0c('0x1'));var path=require(_0x0f0c('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f0c('0x3'));var router=express[_0x0f0c('0x4')]();var fs_extra=require(_0x0f0c('0x5'));var auth=require(_0x0f0c('0x6'));var interaction=require(_0x0f0c('0x7'));var config=require(_0x0f0c('0x8'));var controller=require(_0x0f0c('0x9'));router[_0x0f0c('0xa')]('/',auth[_0x0f0c('0xb')](),controller[_0x0f0c('0xc')]);router['get'](_0x0f0c('0xd'),auth[_0x0f0c('0xb')](),controller[_0x0f0c('0xe')]);router['get'](_0x0f0c('0xf'),auth[_0x0f0c('0xb')](),controller[_0x0f0c('0x10')]);router['post']('/',auth[_0x0f0c('0xb')](),controller[_0x0f0c('0x11')]);router[_0x0f0c('0x12')]('/:id',auth[_0x0f0c('0xb')](),controller[_0x0f0c('0x13')]);router[_0x0f0c('0x14')]('/:id',auth[_0x0f0c('0xb')](),controller[_0x0f0c('0x15')]);module[_0x0f0c('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 90a786d..dcd97ea 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x2c684a,_0x1a8030){var _0xc553b7=function(_0x5227ac){while(--_0x5227ac){_0x2c684a['push'](_0x2c684a['shift']());}};_0xc553b7(++_0x1a8030);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x3add72,_0x5652a4){var _0x599335=function(_0x143498){while(--_0x143498){_0x3add72['push'](_0x3add72['shift']());}};_0x599335(++_0x5652a4);}(_0x70e0,0x17b));var _0x070e=function(_0x7ea132,_0x359355){_0x7ea132=_0x7ea132-0x0;var _0x46f6e3=_0x70e0[_0x7ea132];return _0x46f6e3;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 8f5c5fb..d4b8bdb 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 _0x5a22=['destroy','end','error','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a22,0x133));var _0x25a2=function(_0x22f75e,_0x4a9e06){_0x22f75e=_0x22f75e-0x0;var _0x1f6ab3=_0x5a22[_0x22f75e];return _0x1f6ab3;};'use strict';var emlformat=require(_0x25a2('0x0'));var rimraf=require(_0x25a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x25a2('0x2'));var moment=require(_0x25a2('0x3'));var BPromise=require(_0x25a2('0x4'));var Mustache=require(_0x25a2('0x5'));var util=require(_0x25a2('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x25a2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x25a2('0x8'));var jsforce=require(_0x25a2('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x25a2('0xa'));var Papa=require(_0x25a2('0xb'));var Redis=require(_0x25a2('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x25a2('0xd'));var as=require(_0x25a2('0xe'));var hardwareService=require(_0x25a2('0xf'));var logger=require(_0x25a2('0x10'))(_0x25a2('0x11'));var utils=require('../../config/utils');var config=require(_0x25a2('0x12'));var licenseUtil=require(_0x25a2('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x164f5d,_0x59de34){_0x59de34=_0x59de34||0xcc;return function(_0x2adadf){if(_0x2adadf){return _0x164f5d[_0x25a2('0x14')](_0x59de34);}return _0x164f5d[_0x25a2('0x15')](_0x59de34)['end']();};}function respondWithResult(_0x45b127,_0x2052c6){_0x2052c6=_0x2052c6||0xc8;return function(_0x5f3974){if(_0x5f3974){return _0x45b127['status'](_0x2052c6)[_0x25a2('0x16')](_0x5f3974);}};}function respondWithFilteredResult(_0x4fa26b,_0x47b5ac){return function(_0x5ec453){if(_0x5ec453){var _0x3c4b89=typeof _0x47b5ac[_0x25a2('0x17')]===_0x25a2('0x18')&&typeof _0x47b5ac[_0x25a2('0x19')]===_0x25a2('0x18');var _0xa26399=_0x5ec453[_0x25a2('0x1a')];var _0x316429=_0x3c4b89?0x0:_0x47b5ac[_0x25a2('0x17')];var _0x2bed02=_0x3c4b89?_0x5ec453[_0x25a2('0x1a')]:_0x47b5ac['offset']+_0x47b5ac[_0x25a2('0x19')];var _0x18888b;if(_0x2bed02>=_0xa26399){_0x2bed02=_0xa26399;_0x18888b=0xc8;}else{_0x18888b=0xce;}_0x4fa26b[_0x25a2('0x15')](_0x18888b);return _0x4fa26b[_0x25a2('0x1b')](_0x25a2('0x1c'),_0x316429+'-'+_0x2bed02+'/'+_0xa26399)['json'](_0x5ec453);}return null;};}function patchUpdates(_0x185de1){return function(_0x254a54){try{jsonpatch[_0x25a2('0x1d')](_0x254a54,_0x185de1,!![]);}catch(_0xf2ab2e){return BPromise[_0x25a2('0x1e')](_0xf2ab2e);}return _0x254a54['save']();};}function saveUpdates(_0x37adbb,_0x3b93f2){return function(_0x351afb){if(_0x351afb){return _0x351afb[_0x25a2('0x1f')](_0x37adbb)[_0x25a2('0x20')](function(_0x36db2c){return _0x36db2c;});}return null;};}function removeEntity(_0x3d0646,_0x4d3f63){return function(_0x1fd01e){if(_0x1fd01e){return _0x1fd01e[_0x25a2('0x21')]()[_0x25a2('0x20')](function(){_0x3d0646[_0x25a2('0x15')](0xcc)[_0x25a2('0x22')]();});}};}function handleEntityNotFound(_0x32c23e,_0x37caf9){return function(_0x1762ba){if(!_0x1762ba){_0x32c23e[_0x25a2('0x14')](0x194);}return _0x1762ba;};}function handleError(_0x3b4d9e,_0x163db1){_0x163db1=_0x163db1||0x1f4;return function(_0x594c96){logger[_0x25a2('0x23')](_0x594c96[_0x25a2('0x24')]);if(_0x594c96[_0x25a2('0x25')]){delete _0x594c96['name'];}_0x3b4d9e['status'](_0x163db1)[_0x25a2('0x26')](_0x594c96);};}exports['index']=function(_0x95f3f3,_0x4a8550){var _0x86efd3={},_0x3d73d7={},_0x178ffc={'count':0x0,'rows':[]};var _0x102c82=_[_0x25a2('0x27')](db[_0x25a2('0x28')][_0x25a2('0x29')],function(_0x425e69){return{'name':_0x425e69[_0x25a2('0x2a')],'type':_0x425e69[_0x25a2('0x2b')]['key']};});_0x3d73d7[_0x25a2('0x2c')]=_[_0x25a2('0x27')](_0x102c82,_0x25a2('0x25'));_0x3d73d7[_0x25a2('0x2d')]=_['keys'](_0x95f3f3['query']);_0x3d73d7['filters']=_[_0x25a2('0x2e')](_0x3d73d7[_0x25a2('0x2c')],_0x3d73d7['query']);_0x86efd3['attributes']=_[_0x25a2('0x2e')](_0x3d73d7[_0x25a2('0x2c')],qs[_0x25a2('0x2f')](_0x95f3f3['query'][_0x25a2('0x2f')]));_0x86efd3[_0x25a2('0x30')]=_0x86efd3[_0x25a2('0x30')][_0x25a2('0x31')]?_0x86efd3[_0x25a2('0x30')]:_0x3d73d7['model'];if(!_0x95f3f3['query'][_0x25a2('0x32')](_0x25a2('0x33'))){_0x86efd3['limit']=qs[_0x25a2('0x19')](_0x95f3f3[_0x25a2('0x2d')][_0x25a2('0x19')]);_0x86efd3[_0x25a2('0x17')]=qs[_0x25a2('0x17')](_0x95f3f3[_0x25a2('0x2d')][_0x25a2('0x17')]);}_0x86efd3['order']=qs[_0x25a2('0x34')](_0x95f3f3[_0x25a2('0x2d')]['sort']);_0x86efd3[_0x25a2('0x35')]=qs[_0x25a2('0x36')](_[_0x25a2('0x37')](_0x95f3f3[_0x25a2('0x2d')],_0x3d73d7['filters']),_0x102c82);if(_0x95f3f3[_0x25a2('0x2d')]['filter']){_0x86efd3[_0x25a2('0x35')]=_[_0x25a2('0x38')](_0x86efd3[_0x25a2('0x35')],{'$or':_['map'](_0x102c82,function(_0x4ee1f7){if(_0x4ee1f7[_0x25a2('0x2b')]!==_0x25a2('0x39')){var _0x4dd2ba={};_0x4dd2ba[_0x4ee1f7['name']]={'$like':'%'+_0x95f3f3[_0x25a2('0x2d')]['filter']+'%'};return _0x4dd2ba;}})});}_0x86efd3=_[_0x25a2('0x38')]({},_0x86efd3,_0x95f3f3[_0x25a2('0x3a')]);var _0x1d0b5d={'where':_0x86efd3[_0x25a2('0x35')]};return db['MailTransferReport'][_0x25a2('0x1a')](_0x1d0b5d)[_0x25a2('0x20')](function(_0x4f1c54){_0x178ffc[_0x25a2('0x1a')]=_0x4f1c54;if(_0x95f3f3['query'][_0x25a2('0x3b')]){_0x86efd3[_0x25a2('0x3c')]=[{'all':!![]}];}return db[_0x25a2('0x28')]['findAll'](_0x86efd3);})[_0x25a2('0x20')](function(_0x2db707){_0x178ffc[_0x25a2('0x3d')]=_0x2db707;return _0x178ffc;})[_0x25a2('0x20')](respondWithFilteredResult(_0x4a8550,_0x86efd3))[_0x25a2('0x3e')](handleError(_0x4a8550,null));};exports['show']=function(_0x171232,_0x397ae1){var _0x30537e={'raw':!![],'where':{'id':_0x171232[_0x25a2('0x3f')]['id']}},_0x357258={};_0x357258['model']=_[_0x25a2('0x40')](db[_0x25a2('0x28')][_0x25a2('0x29')]);_0x357258[_0x25a2('0x2d')]=_[_0x25a2('0x40')](_0x171232[_0x25a2('0x2d')]);_0x357258[_0x25a2('0x36')]=_[_0x25a2('0x2e')](_0x357258[_0x25a2('0x2c')],_0x357258[_0x25a2('0x2d')]);_0x30537e[_0x25a2('0x30')]=_['intersection'](_0x357258[_0x25a2('0x2c')],qs[_0x25a2('0x2f')](_0x171232['query'][_0x25a2('0x2f')]));_0x30537e[_0x25a2('0x30')]=_0x30537e[_0x25a2('0x30')][_0x25a2('0x31')]?_0x30537e[_0x25a2('0x30')]:_0x357258[_0x25a2('0x2c')];if(_0x171232[_0x25a2('0x2d')][_0x25a2('0x3b')]){_0x30537e[_0x25a2('0x3c')]=[{'all':!![]}];}_0x30537e=_['merge']({},_0x30537e,_0x171232[_0x25a2('0x3a')]);return db[_0x25a2('0x28')][_0x25a2('0x41')](_0x30537e)[_0x25a2('0x20')](handleEntityNotFound(_0x397ae1,null))[_0x25a2('0x20')](respondWithResult(_0x397ae1,null))['catch'](handleError(_0x397ae1,null));};exports['create']=function(_0x3022d5,_0x15189a){return db['MailTransferReport'][_0x25a2('0x42')](_0x3022d5['body'],{})[_0x25a2('0x20')](respondWithResult(_0x15189a,0xc9))['catch'](handleError(_0x15189a,null));};exports['update']=function(_0x578478,_0x475990){if(_0x578478[_0x25a2('0x43')]['id']){delete _0x578478[_0x25a2('0x43')]['id'];}return db[_0x25a2('0x28')][_0x25a2('0x41')]({'where':{'id':_0x578478[_0x25a2('0x3f')]['id']}})[_0x25a2('0x20')](handleEntityNotFound(_0x475990,null))[_0x25a2('0x20')](saveUpdates(_0x578478['body'],null))['then'](respondWithResult(_0x475990,null))[_0x25a2('0x3e')](handleError(_0x475990,null));};exports['destroy']=function(_0x484a7a,_0x9bd657){return db[_0x25a2('0x28')][_0x25a2('0x41')]({'where':{'id':_0x484a7a['params']['id']}})[_0x25a2('0x20')](handleEntityNotFound(_0x9bd657,null))[_0x25a2('0x20')](removeEntity(_0x9bd657,null))[_0x25a2('0x3e')](handleError(_0x9bd657,null));};exports['describe']=function(_0x4dbfb7,_0x2197a9){return db[_0x25a2('0x28')]['describe']()['then'](respondWithResult(_0x2197a9,null))[_0x25a2('0x3e')](handleError(_0x2197a9,null));}; \ No newline at end of file +var _0x42d9=['index','map','MailTransferReport','rawAttributes','fieldName','type','model','name','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','save','update','then','destroy'];(function(_0x381638,_0x28a0fc){var _0x16d840=function(_0x3ed1c5){while(--_0x3ed1c5){_0x381638['push'](_0x381638['shift']());}};_0x16d840(++_0x28a0fc);}(_0x42d9,0xfa));var _0x942d=function(_0x447f6d,_0x36fc29){_0x447f6d=_0x447f6d-0x0;var _0x56a9b8=_0x42d9[_0x447f6d];return _0x56a9b8;};'use strict';var emlformat=require(_0x942d('0x0'));var rimraf=require(_0x942d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x942d('0x2'));var rp=require(_0x942d('0x3'));var moment=require('moment');var BPromise=require(_0x942d('0x4'));var Mustache=require(_0x942d('0x5'));var util=require(_0x942d('0x6'));var path=require(_0x942d('0x7'));var sox=require(_0x942d('0x8'));var csv=require(_0x942d('0x9'));var ejs=require(_0x942d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x942d('0xb'));var squel=require(_0x942d('0xc'));var crypto=require(_0x942d('0xd'));var jsforce=require(_0x942d('0xe'));var deskjs=require(_0x942d('0xf'));var toCsv=require(_0x942d('0x9'));var querystring=require(_0x942d('0x10'));var Papa=require('papaparse');var Redis=require(_0x942d('0x11'));var authService=require(_0x942d('0x12'));var qs=require(_0x942d('0x13'));var as=require(_0x942d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x942d('0x15'))(_0x942d('0x16'));var utils=require(_0x942d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x942d('0x18'));var db=require(_0x942d('0x19'))['db'];function respondWithStatusCode(_0x4091cf,_0x2a3a16){_0x2a3a16=_0x2a3a16||0xcc;return function(_0xdceef3){if(_0xdceef3){return _0x4091cf[_0x942d('0x1a')](_0x2a3a16);}return _0x4091cf[_0x942d('0x1b')](_0x2a3a16)[_0x942d('0x1c')]();};}function respondWithResult(_0x15ffa5,_0x22c2e1){_0x22c2e1=_0x22c2e1||0xc8;return function(_0x1ec05a){if(_0x1ec05a){return _0x15ffa5[_0x942d('0x1b')](_0x22c2e1)['json'](_0x1ec05a);}};}function respondWithFilteredResult(_0x33be0e,_0x3463a8){return function(_0x327323){if(_0x327323){var _0x3702a1=typeof _0x3463a8[_0x942d('0x1d')]===_0x942d('0x1e')&&typeof _0x3463a8['limit']===_0x942d('0x1e');var _0x4e1280=_0x327323[_0x942d('0x1f')];var _0x43774f=_0x3702a1?0x0:_0x3463a8['offset'];var _0xb303fc=_0x3702a1?_0x327323[_0x942d('0x1f')]:_0x3463a8['offset']+_0x3463a8[_0x942d('0x20')];var _0x1fcc2c;if(_0xb303fc>=_0x4e1280){_0xb303fc=_0x4e1280;_0x1fcc2c=0xc8;}else{_0x1fcc2c=0xce;}_0x33be0e[_0x942d('0x1b')](_0x1fcc2c);return _0x33be0e['set'](_0x942d('0x21'),_0x43774f+'-'+_0xb303fc+'/'+_0x4e1280)['json'](_0x327323);}return null;};}function patchUpdates(_0x4a0860){return function(_0x5350a8){try{jsonpatch['apply'](_0x5350a8,_0x4a0860,!![]);}catch(_0x58d9e0){return BPromise['reject'](_0x58d9e0);}return _0x5350a8[_0x942d('0x22')]();};}function saveUpdates(_0x4be24a,_0x591d9b){return function(_0x2b902e){if(_0x2b902e){return _0x2b902e[_0x942d('0x23')](_0x4be24a)[_0x942d('0x24')](function(_0x4f6ff0){return _0x4f6ff0;});}return null;};}function removeEntity(_0x4a47e4,_0x12eafc){return function(_0x2d1f13){if(_0x2d1f13){return _0x2d1f13[_0x942d('0x25')]()[_0x942d('0x24')](function(){_0x4a47e4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e8c71,_0x497c75){return function(_0xe94430){if(!_0xe94430){_0x4e8c71[_0x942d('0x1a')](0x194);}return _0xe94430;};}function handleError(_0x27bdc7,_0x5dd787){_0x5dd787=_0x5dd787||0x1f4;return function(_0x1ade6d){logger['error'](_0x1ade6d['stack']);if(_0x1ade6d['name']){delete _0x1ade6d['name'];}_0x27bdc7[_0x942d('0x1b')](_0x5dd787)['send'](_0x1ade6d);};}exports[_0x942d('0x26')]=function(_0x351528,_0x1a892a){var _0x2f7526={},_0x599e74={},_0x5e19e9={'count':0x0,'rows':[]};var _0x565cb7=_[_0x942d('0x27')](db[_0x942d('0x28')][_0x942d('0x29')],function(_0x5b6fd9){return{'name':_0x5b6fd9[_0x942d('0x2a')],'type':_0x5b6fd9[_0x942d('0x2b')]['key']};});_0x599e74[_0x942d('0x2c')]=_['map'](_0x565cb7,_0x942d('0x2d'));_0x599e74['query']=_[_0x942d('0x2e')](_0x351528[_0x942d('0x2f')]);_0x599e74[_0x942d('0x30')]=_['intersection'](_0x599e74['model'],_0x599e74['query']);_0x2f7526[_0x942d('0x31')]=_['intersection'](_0x599e74[_0x942d('0x2c')],qs[_0x942d('0x32')](_0x351528[_0x942d('0x2f')][_0x942d('0x32')]));_0x2f7526[_0x942d('0x31')]=_0x2f7526[_0x942d('0x31')][_0x942d('0x33')]?_0x2f7526[_0x942d('0x31')]:_0x599e74[_0x942d('0x2c')];if(!_0x351528[_0x942d('0x2f')][_0x942d('0x34')]('nolimit')){_0x2f7526[_0x942d('0x20')]=qs[_0x942d('0x20')](_0x351528[_0x942d('0x2f')][_0x942d('0x20')]);_0x2f7526[_0x942d('0x1d')]=qs['offset'](_0x351528[_0x942d('0x2f')][_0x942d('0x1d')]);}_0x2f7526[_0x942d('0x35')]=qs[_0x942d('0x36')](_0x351528['query'][_0x942d('0x36')]);_0x2f7526[_0x942d('0x37')]=qs[_0x942d('0x30')](_[_0x942d('0x38')](_0x351528[_0x942d('0x2f')],_0x599e74[_0x942d('0x30')]),_0x565cb7);if(_0x351528[_0x942d('0x2f')][_0x942d('0x39')]){_0x2f7526[_0x942d('0x37')]=_[_0x942d('0x3a')](_0x2f7526[_0x942d('0x37')],{'$or':_['map'](_0x565cb7,function(_0x440fd6){if(_0x440fd6[_0x942d('0x2b')]!==_0x942d('0x3b')){var _0x5713b6={};_0x5713b6[_0x440fd6['name']]={'$like':'%'+_0x351528[_0x942d('0x2f')][_0x942d('0x39')]+'%'};return _0x5713b6;}})});}_0x2f7526=_['merge']({},_0x2f7526,_0x351528[_0x942d('0x3c')]);var _0x17c7c8={'where':_0x2f7526['where']};return db[_0x942d('0x28')][_0x942d('0x1f')](_0x17c7c8)['then'](function(_0x14392c){_0x5e19e9[_0x942d('0x1f')]=_0x14392c;if(_0x351528[_0x942d('0x2f')][_0x942d('0x3d')]){_0x2f7526[_0x942d('0x3e')]=[{'all':!![]}];}return db[_0x942d('0x28')][_0x942d('0x3f')](_0x2f7526);})[_0x942d('0x24')](function(_0xda82e3){_0x5e19e9[_0x942d('0x40')]=_0xda82e3;return _0x5e19e9;})[_0x942d('0x24')](respondWithFilteredResult(_0x1a892a,_0x2f7526))[_0x942d('0x41')](handleError(_0x1a892a,null));};exports['show']=function(_0x59a969,_0x2dd2ff){var _0x3230a2={'raw':!![],'where':{'id':_0x59a969[_0x942d('0x42')]['id']}},_0x39e487={};_0x39e487[_0x942d('0x2c')]=_['keys'](db['MailTransferReport'][_0x942d('0x29')]);_0x39e487[_0x942d('0x2f')]=_[_0x942d('0x2e')](_0x59a969[_0x942d('0x2f')]);_0x39e487[_0x942d('0x30')]=_['intersection'](_0x39e487['model'],_0x39e487['query']);_0x3230a2['attributes']=_[_0x942d('0x43')](_0x39e487['model'],qs[_0x942d('0x32')](_0x59a969[_0x942d('0x2f')][_0x942d('0x32')]));_0x3230a2[_0x942d('0x31')]=_0x3230a2['attributes']['length']?_0x3230a2[_0x942d('0x31')]:_0x39e487[_0x942d('0x2c')];if(_0x59a969['query']['includeAll']){_0x3230a2[_0x942d('0x3e')]=[{'all':!![]}];}_0x3230a2=_['merge']({},_0x3230a2,_0x59a969[_0x942d('0x3c')]);return db[_0x942d('0x28')][_0x942d('0x44')](_0x3230a2)[_0x942d('0x24')](handleEntityNotFound(_0x2dd2ff,null))['then'](respondWithResult(_0x2dd2ff,null))[_0x942d('0x41')](handleError(_0x2dd2ff,null));};exports[_0x942d('0x45')]=function(_0x2afb95,_0x2bd628){return db['MailTransferReport'][_0x942d('0x45')](_0x2afb95[_0x942d('0x46')],{})[_0x942d('0x24')](respondWithResult(_0x2bd628,0xc9))[_0x942d('0x41')](handleError(_0x2bd628,null));};exports[_0x942d('0x23')]=function(_0x115d27,_0x5cc968){if(_0x115d27[_0x942d('0x46')]['id']){delete _0x115d27[_0x942d('0x46')]['id'];}return db[_0x942d('0x28')][_0x942d('0x44')]({'where':{'id':_0x115d27[_0x942d('0x42')]['id']}})[_0x942d('0x24')](handleEntityNotFound(_0x5cc968,null))[_0x942d('0x24')](saveUpdates(_0x115d27[_0x942d('0x46')],null))[_0x942d('0x24')](respondWithResult(_0x5cc968,null))['catch'](handleError(_0x5cc968,null));};exports[_0x942d('0x25')]=function(_0x5086d0,_0x233f51){return db[_0x942d('0x28')]['find']({'where':{'id':_0x5086d0[_0x942d('0x42')]['id']}})[_0x942d('0x24')](handleEntityNotFound(_0x233f51,null))['then'](removeEntity(_0x233f51,null))[_0x942d('0x41')](handleError(_0x233f51,null));};exports[_0x942d('0x47')]=function(_0x36a217,_0x3628fc){return db[_0x942d('0x28')]['describe']()[_0x942d('0x24')](respondWithResult(_0x3628fc,null))[_0x942d('0x41')](handleError(_0x3628fc,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index b281788..75534be 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 _0xe364=['path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','moment','request-promise'];(function(_0x6e64bc,_0x37f5d0){var _0x20c4b9=function(_0x4a8a36){while(--_0x4a8a36){_0x6e64bc['push'](_0x6e64bc['shift']());}};_0x20c4b9(++_0x37f5d0);}(_0xe364,0x1c3));var _0x4e36=function(_0x34e752,_0x32e2a2){_0x34e752=_0x34e752-0x0;var _0x7c6347=_0xe364[_0x34e752];return _0x7c6347;};'use strict';var _=require('lodash');var util=require(_0x4e36('0x0'));var logger=require(_0x4e36('0x1'))('api');var moment=require(_0x4e36('0x2'));var BPromise=require('bluebird');var rp=require(_0x4e36('0x3'));var fs=require('fs');var path=require(_0x4e36('0x4'));var rimraf=require(_0x4e36('0x5'));var config=require(_0x4e36('0x6'));var attributes=require(_0x4e36('0x7'));module[_0x4e36('0x8')]=function(_0x3c5e6b,_0x10019a){return _0x3c5e6b[_0x4e36('0x9')](_0x4e36('0xa'),attributes,{'tableName':_0x4e36('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4e36('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d01=['uniqueid','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer'];(function(_0xb04032,_0x5e0cad){var _0x2b0248=function(_0x80d52f){while(--_0x80d52f){_0xb04032['push'](_0xb04032['shift']());}};_0x2b0248(++_0x5e0cad);}(_0x5d01,0xe5));var _0x15d0=function(_0x4576fb,_0x1731e7){_0x4576fb=_0x4576fb-0x0;var _0x217657=_0x5d01[_0x4576fb];return _0x217657;};'use strict';var _=require(_0x15d0('0x0'));var util=require('util');var logger=require(_0x15d0('0x1'))(_0x15d0('0x2'));var moment=require('moment');var BPromise=require(_0x15d0('0x3'));var rp=require(_0x15d0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x15d0('0x5'));var attributes=require(_0x15d0('0x6'));module[_0x15d0('0x7')]=function(_0x1b0e27,_0x2af55d){return _0x1b0e27[_0x15d0('0x8')](_0x15d0('0x9'),attributes,{'tableName':_0x15d0('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x15d0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 875ebf7..60f74ad 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 _0xc90d=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash'];(function(_0x4f48f0,_0x1ccb32){var _0x255f7b=function(_0x13a95c){while(--_0x13a95c){_0x4f48f0['push'](_0x4f48f0['shift']());}};_0x255f7b(++_0x1ccb32);}(_0xc90d,0x1f3));var _0xdc90=function(_0x458f09,_0xf2ee90){_0x458f09=_0x458f09-0x0;var _0x1ca565=_0xc90d[_0x458f09];return _0x1ca565;};'use strict';var _=require(_0xdc90('0x0'));var util=require('util');var moment=require(_0xdc90('0x1'));var BPromise=require(_0xdc90('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc90('0x3'));var db=require(_0xdc90('0x4'))['db'];var utils=require(_0xdc90('0x5'));var logger=require(_0xdc90('0x6'))(_0xdc90('0x7'));var config=require('../../config/environment');var jayson=require(_0xdc90('0x8'));var client=jayson[_0xdc90('0x9')][_0xdc90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28cf0f,_0x5c9487,_0x2c4869){return new BPromise(function(_0x52b39d,_0x53e147){return client[_0xdc90('0xb')](_0x28cf0f,_0x2c4869)['then'](function(_0x5e25a0){logger[_0xdc90('0xc')](_0xdc90('0xd'),_0x5c9487,_0xdc90('0xe'));logger[_0xdc90('0xf')](_0xdc90('0x10'),_0x5c9487,'request\x20sent',JSON['stringify'](_0x5e25a0));if(_0x5e25a0[_0xdc90('0x11')]){if(_0x5e25a0[_0xdc90('0x11')]['code']===0x1f4){logger[_0xdc90('0x11')](_0xdc90('0xd'),_0x5c9487,_0x5e25a0[_0xdc90('0x11')]['message']);return _0x53e147(_0x5e25a0[_0xdc90('0x11')][_0xdc90('0x12')]);}logger[_0xdc90('0x11')](_0xdc90('0xd'),_0x5c9487,_0x5e25a0[_0xdc90('0x11')]['message']);return _0x52b39d(_0x5e25a0['error'][_0xdc90('0x12')]);}else{logger['info'](_0xdc90('0xd'),_0x5c9487,_0xdc90('0xe'));_0x52b39d(_0x5e25a0[_0xdc90('0x13')][_0xdc90('0x12')]);}})['catch'](function(_0x2a3681){logger[_0xdc90('0x11')](_0xdc90('0xd'),_0x5c9487,_0x2a3681);_0x53e147(_0x2a3681);});});} \ No newline at end of file +var _0xdf79=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x41767b,_0x5ecfbe){var _0x42a71d=function(_0x5e91bd){while(--_0x5e91bd){_0x41767b['push'](_0x41767b['shift']());}};_0x42a71d(++_0x5ecfbe);}(_0xdf79,0x178));var _0x9df7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdf79[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9df7('0x0'));var util=require(_0x9df7('0x1'));var moment=require(_0x9df7('0x2'));var BPromise=require(_0x9df7('0x3'));var rs=require(_0x9df7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9df7('0x5'))['db'];var utils=require(_0x9df7('0x6'));var logger=require(_0x9df7('0x7'))('rpc');var config=require(_0x9df7('0x8'));var jayson=require(_0x9df7('0x9'));var client=jayson[_0x9df7('0xa')][_0x9df7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b2791,_0x3b00b3,_0x2b2a9c){return new BPromise(function(_0x5239b3,_0x3adfd3){return client['request'](_0x3b2791,_0x2b2a9c)[_0x9df7('0xc')](function(_0x18961e){logger['info'](_0x9df7('0xd'),_0x3b00b3,_0x9df7('0xe'));logger['debug'](_0x9df7('0xf'),_0x3b00b3,_0x9df7('0xe'),JSON[_0x9df7('0x10')](_0x18961e));if(_0x18961e[_0x9df7('0x11')]){if(_0x18961e[_0x9df7('0x11')][_0x9df7('0x12')]===0x1f4){logger[_0x9df7('0x11')](_0x9df7('0xd'),_0x3b00b3,_0x18961e[_0x9df7('0x11')]['message']);return _0x3adfd3(_0x18961e[_0x9df7('0x11')][_0x9df7('0x13')]);}logger[_0x9df7('0x11')](_0x9df7('0xd'),_0x3b00b3,_0x18961e[_0x9df7('0x11')][_0x9df7('0x13')]);return _0x5239b3(_0x18961e[_0x9df7('0x11')][_0x9df7('0x13')]);}else{logger['info'](_0x9df7('0xd'),_0x3b00b3,_0x9df7('0xe'));_0x5239b3(_0x18961e[_0x9df7('0x14')][_0x9df7('0x13')]);}})['catch'](function(_0x2dbb01){logger[_0x9df7('0x11')](_0x9df7('0xd'),_0x3b00b3,_0x2dbb01);_0x3adfd3(_0x2dbb01);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 9027bc0..2d6f3ee 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 _0xb8d5=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','multer','path'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xb8d5,0xcf));var _0x5b8d=function(_0x655697,_0x1b33dd){_0x655697=_0x655697-0x0;var _0x4971cc=_0xb8d5[_0x655697];return _0x4971cc;};'use strict';var multer=require(_0x5b8d('0x0'));var util=require('util');var path=require(_0x5b8d('0x1'));var timeout=require(_0x5b8d('0x2'));var express=require(_0x5b8d('0x3'));var router=express['Router']();var fs_extra=require(_0x5b8d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5b8d('0x5'));var config=require(_0x5b8d('0x6'));var controller=require('./memberReport.controller');router[_0x5b8d('0x7')]('/',auth[_0x5b8d('0x8')](),controller[_0x5b8d('0x9')]);router[_0x5b8d('0x7')](_0x5b8d('0xa'),auth[_0x5b8d('0x8')](),controller[_0x5b8d('0xb')]);router[_0x5b8d('0x7')](_0x5b8d('0xc'),auth[_0x5b8d('0x8')](),controller[_0x5b8d('0xd')]);router[_0x5b8d('0xe')]('/',auth['isAuthenticated'](),controller[_0x5b8d('0xf')]);router[_0x5b8d('0x10')](_0x5b8d('0xc'),auth[_0x5b8d('0x8')](),controller['update']);router[_0x5b8d('0x11')](_0x5b8d('0xc'),auth[_0x5b8d('0x8')](),controller[_0x5b8d('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe72d=['describe','/:id','show','post','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index'];(function(_0xe60a9b,_0x130ed6){var _0x2c79f2=function(_0x5962f6){while(--_0x5962f6){_0xe60a9b['push'](_0xe60a9b['shift']());}};_0x2c79f2(++_0x130ed6);}(_0xe72d,0x1e2));var _0xde72=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe72d[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xde72('0x0'));var util=require(_0xde72('0x1'));var path=require(_0xde72('0x2'));var timeout=require(_0xde72('0x3'));var express=require(_0xde72('0x4'));var router=express[_0xde72('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xde72('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xde72('0x7'));var controller=require(_0xde72('0x8'));router[_0xde72('0x9')]('/',auth[_0xde72('0xa')](),controller[_0xde72('0xb')]);router[_0xde72('0x9')]('/describe',auth[_0xde72('0xa')](),controller[_0xde72('0xc')]);router[_0xde72('0x9')](_0xde72('0xd'),auth[_0xde72('0xa')](),controller[_0xde72('0xe')]);router[_0xde72('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xde72('0xa')](),controller[_0xde72('0x10')]);router[_0xde72('0x11')]('/:id',auth[_0xde72('0xa')](),controller[_0xde72('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index e51f66c..df75b33 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 _0x52b2=['talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]'];(function(_0x4e8318,_0x3fe0e6){var _0x30a40b=function(_0x37d390){while(--_0x37d390){_0x4e8318['push'](_0x4e8318['shift']());}};_0x30a40b(++_0x3fe0e6);}(_0x52b2,0x11e));var _0x252b=function(_0x1c6bd5,_0x29ad2f){_0x1c6bd5=_0x1c6bd5-0x0;var _0x4af65f=_0x52b2[_0x1c6bd5];return _0x4af65f;};'use strict';var Sequelize=require(_0x252b('0x0'));var moment=require(_0x252b('0x1'));module[_0x252b('0x2')]={'channel':{'type':Sequelize[_0x252b('0x3')]},'membername':{'type':Sequelize[_0x252b('0x3')]},'interface':{'type':Sequelize[_0x252b('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x252b('0x4'),'comment':_0x252b('0x5')},'duration':{'type':Sequelize[_0x252b('0x6')]},'enterAt':{'type':Sequelize[_0x252b('0x7')]},'exitAt':{'type':Sequelize[_0x252b('0x7')],'set':function(_0x571511){var _0x1025af=moment(_0x571511);var _0x409365=moment(this[_0x252b('0x8')](_0x252b('0x9')));var _0x147e21=_0x1025af[_0x252b('0xa')](_0x409365,'seconds');this[_0x252b('0xb')](_0x252b('0xc'),_0x571511);this['setDataValue'](_0x252b('0xd'),_0x147e21||null);}},'data1':{'type':Sequelize[_0x252b('0x3')],'comment':_0x252b('0xe')},'data2':{'type':Sequelize[_0x252b('0x3')],'comment':_0x252b('0xf')},'data3':{'type':Sequelize[_0x252b('0x3')],'comment':_0x252b('0x10')},'data4':{'type':Sequelize[_0x252b('0x3')],'comment':_0x252b('0x11')},'data5':{'type':Sequelize[_0x252b('0x3')],'comment':_0x252b('0x12')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x252b('0x6')]},'uniqueid':{'type':Sequelize[_0x252b('0x3')]}}; \ No newline at end of file +var _0x6732=['setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','getDataValue','enterAt','diff','seconds'];(function(_0x4ea8d8,_0x490fe8){var _0x6e823f=function(_0x1bc2e9){while(--_0x1bc2e9){_0x4ea8d8['push'](_0x4ea8d8['shift']());}};_0x6e823f(++_0x490fe8);}(_0x6732,0x66));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2673('0x0'));var moment=require(_0x2673('0x1'));module[_0x2673('0x2')]={'channel':{'type':Sequelize[_0x2673('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2673('0x3')]},'type':{'type':Sequelize[_0x2673('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x2673('0x4')},'duration':{'type':Sequelize[_0x2673('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x90d6e5){var _0x2ec408=moment(_0x90d6e5);var _0x513795=moment(this[_0x2673('0x6')](_0x2673('0x7')));var _0xc1ed83=_0x2ec408[_0x2673('0x8')](_0x513795,_0x2673('0x9'));this[_0x2673('0xa')](_0x2673('0xb'),_0x90d6e5);this[_0x2673('0xa')](_0x2673('0xc'),_0xc1ed83||null);}},'data1':{'type':Sequelize[_0x2673('0x3')],'comment':_0x2673('0xd')},'data2':{'type':Sequelize[_0x2673('0x3')],'comment':_0x2673('0xe')},'data3':{'type':Sequelize[_0x2673('0x3')],'comment':_0x2673('0xf')},'data4':{'type':Sequelize[_0x2673('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x2673('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x2673('0x3')]},'internal':{'type':Sequelize[_0x2673('0x5')]},'uniqueid':{'type':Sequelize[_0x2673('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index f95b24a..989655c 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 _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x16ee1c,_0x49a2bb){var _0x52474a=function(_0x3dbd06){while(--_0x3dbd06){_0x16ee1c['push'](_0x16ee1c['shift']());}};_0x52474a(++_0x49a2bb);}(_0x3e74,0x175));var _0x43e7=function(_0x516c7a,_0x52e8ab){_0x516c7a=_0x516c7a-0x0;var _0x3f1ead=_0x3e74[_0x516c7a];return _0x3f1ead;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +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(_0x16438a,_0x3544be){var _0x9d2e74=function(_0x3399e5){while(--_0x3399e5){_0x16438a['push'](_0x16438a['shift']());}};_0x9d2e74(++_0x3544be);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 3778146..5d9881a 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 _0x400f=['membername_interface','membername','interface','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member'];(function(_0x443dde,_0x4eb478){var _0x4b58cd=function(_0x20a78d){while(--_0x20a78d){_0x443dde['push'](_0x443dde['shift']());}};_0x4b58cd(++_0x4eb478);}(_0x400f,0x157));var _0xf400=function(_0x615e22,_0x504616){_0x615e22=_0x615e22-0x0;var _0x49589c=_0x400f[_0x615e22];return _0x49589c;};'use strict';var _=require(_0xf400('0x0'));var util=require(_0xf400('0x1'));var logger=require(_0xf400('0x2'))('api');var moment=require(_0xf400('0x3'));var BPromise=require(_0xf400('0x4'));var rp=require(_0xf400('0x5'));var fs=require('fs');var path=require(_0xf400('0x6'));var rimraf=require(_0xf400('0x7'));var config=require(_0xf400('0x8'));var attributes=require(_0xf400('0x9'));module[_0xf400('0xa')]=function(_0x6b1acb,_0xa5bd50){return _0x6b1acb[_0xf400('0xb')](_0xf400('0xc'),attributes,{'tableName':_0xf400('0xd'),'paranoid':![],'indexes':[{'name':_0xf400('0xe'),'fields':[_0xf400('0xf'),_0xf400('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b9f=['api','moment','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger'];(function(_0x359551,_0x46e556){var _0x59bed7=function(_0x53f54e){while(--_0x53f54e){_0x359551['push'](_0x359551['shift']());}};_0x59bed7(++_0x46e556);}(_0x4b9f,0x18d));var _0xf4b9=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4b9f[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xf4b9('0x0'));var util=require(_0xf4b9('0x1'));var logger=require(_0xf4b9('0x2'))(_0xf4b9('0x3'));var moment=require(_0xf4b9('0x4'));var BPromise=require(_0xf4b9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4b9('0x6'));var rimraf=require(_0xf4b9('0x7'));var config=require(_0xf4b9('0x8'));var attributes=require(_0xf4b9('0x9'));module[_0xf4b9('0xa')]=function(_0x4345b6,_0x4758ee){return _0x4345b6['define'](_0xf4b9('0xb'),attributes,{'tableName':_0xf4b9('0xc'),'paranoid':![],'indexes':[{'name':_0xf4b9('0xd'),'fields':[_0xf4b9('0xe'),_0xf4b9('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 25e7761..f526c59 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 _0x16d8=['map','include','model','CreateMemberReport','UpdateMemberReport','update','body','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','MemberReport,\x20%s,\x20%s','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit'];(function(_0x1520aa,_0x3fbc33){var _0x2425af=function(_0x5350c1){while(--_0x5350c1){_0x1520aa['push'](_0x1520aa['shift']());}};_0x2425af(++_0x3fbc33);}(_0x16d8,0xa3));var _0x816d=function(_0xeba7f0,_0x3d0001){_0xeba7f0=_0xeba7f0-0x0;var _0x4b3c12=_0x16d8[_0xeba7f0];return _0x4b3c12;};'use strict';var _=require('lodash');var util=require(_0x816d('0x0'));var moment=require(_0x816d('0x1'));var BPromise=require(_0x816d('0x2'));var rs=require(_0x816d('0x3'));var fs=require('fs');var Redis=require(_0x816d('0x4'));var db=require(_0x816d('0x5'))['db'];var utils=require(_0x816d('0x6'));var logger=require(_0x816d('0x7'))(_0x816d('0x8'));var config=require('../../config/environment');var jayson=require(_0x816d('0x9'));var client=jayson['client'][_0x816d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cde29,_0x2516ea,_0x2d51f2){return new BPromise(function(_0x44b1ba,_0x5cfc9d){return client[_0x816d('0xb')](_0x5cde29,_0x2d51f2)[_0x816d('0xc')](function(_0xda441e){logger['info']('MemberReport,\x20%s,\x20%s',_0x2516ea,'request\x20sent');logger[_0x816d('0xd')](_0x816d('0xe'),_0x2516ea,_0x816d('0xf'),JSON[_0x816d('0x10')](_0xda441e));if(_0xda441e['error']){if(_0xda441e[_0x816d('0x11')][_0x816d('0x12')]===0x1f4){logger[_0x816d('0x11')]('MemberReport,\x20%s,\x20%s',_0x2516ea,_0xda441e[_0x816d('0x11')][_0x816d('0x13')]);return _0x5cfc9d(_0xda441e['error'][_0x816d('0x13')]);}logger[_0x816d('0x11')]('MemberReport,\x20%s,\x20%s',_0x2516ea,_0xda441e[_0x816d('0x11')][_0x816d('0x13')]);return _0x44b1ba(_0xda441e['error'][_0x816d('0x13')]);}else{logger[_0x816d('0x14')](_0x816d('0x15'),_0x2516ea,_0x816d('0xf'));_0x44b1ba(_0xda441e[_0x816d('0x16')][_0x816d('0x13')]);}})[_0x816d('0x17')](function(_0x2a1be1){logger[_0x816d('0x11')]('MemberReport,\x20%s,\x20%s',_0x2516ea,_0x2a1be1);_0x5cfc9d(_0x2a1be1);});});}exports[_0x816d('0x18')]=function(_0x2cee1c){var _0x175e6d=this;return new Promise(function(_0x52be88,_0x839dcd){return db[_0x816d('0x19')][_0x816d('0x1a')]({'raw':_0x2cee1c[_0x816d('0x1b')]?_0x2cee1c[_0x816d('0x1b')][_0x816d('0x1c')]===undefined?!![]:![]:!![],'where':_0x2cee1c['options']?_0x2cee1c[_0x816d('0x1b')][_0x816d('0x1d')]||null:null,'attributes':_0x2cee1c[_0x816d('0x1b')]?_0x2cee1c[_0x816d('0x1b')][_0x816d('0x1e')]||null:null,'limit':_0x2cee1c[_0x816d('0x1b')]?_0x2cee1c[_0x816d('0x1b')][_0x816d('0x1f')]||null:null,'include':_0x2cee1c['options']?_0x2cee1c[_0x816d('0x1b')]['include']?_[_0x816d('0x20')](_0x2cee1c[_0x816d('0x1b')][_0x816d('0x21')],function(_0x22ee4c){return{'model':db[_0x22ee4c[_0x816d('0x22')]],'as':_0x22ee4c['as'],'attributes':_0x22ee4c[_0x816d('0x1e')],'include':_0x22ee4c[_0x816d('0x21')]?_[_0x816d('0x20')](_0x22ee4c[_0x816d('0x21')],function(_0x3d4410){return{'model':db[_0x3d4410[_0x816d('0x22')]],'as':_0x3d4410['as'],'attributes':_0x3d4410[_0x816d('0x1e')],'include':_0x3d4410[_0x816d('0x21')]?_[_0x816d('0x20')](_0x3d4410[_0x816d('0x21')],function(_0x19e167){return{'model':db[_0x19e167[_0x816d('0x22')]],'as':_0x19e167['as'],'attributes':_0x19e167['attributes']};}):[]};}):[]};}):[]:[]})[_0x816d('0xc')](function(_0x6a4acd){logger[_0x816d('0x14')](_0x816d('0x18'),_0x2cee1c);logger[_0x816d('0xd')]('GetMemberReport',_0x2cee1c,JSON['stringify'](_0x6a4acd));_0x52be88(_0x6a4acd);})['catch'](function(_0x45cd32){logger[_0x816d('0x11')](_0x816d('0x18'),_0x45cd32['message'],_0x2cee1c);_0x839dcd(_0x175e6d[_0x816d('0x11')](0x1f4,_0x45cd32[_0x816d('0x13')]));});});};exports[_0x816d('0x23')]=function(_0x510a6){var _0x548734=this;return new Promise(function(_0x3917a1,_0x1b74a7){return db[_0x816d('0x19')]['create'](_0x510a6['body'],{'raw':_0x510a6['options']?_0x510a6['options'][_0x816d('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x195481){logger[_0x816d('0x14')](_0x816d('0x23'),_0x510a6);logger[_0x816d('0xd')](_0x816d('0x23'),_0x510a6,JSON['stringify'](_0x195481));_0x3917a1(_0x195481);})['catch'](function(_0xd4c621){logger[_0x816d('0x11')](_0x816d('0x23'),_0xd4c621['message'],_0x510a6);_0x1b74a7(_0x548734[_0x816d('0x11')](0x1f4,_0xd4c621[_0x816d('0x13')]));});});};exports[_0x816d('0x24')]=function(_0x41ba53){var _0x58b868=this;return new Promise(function(_0x25b9c3,_0x236558){return db[_0x816d('0x19')][_0x816d('0x25')](_0x41ba53[_0x816d('0x26')],{'raw':_0x41ba53['options']?_0x41ba53[_0x816d('0x1b')][_0x816d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41ba53[_0x816d('0x1b')]?_0x41ba53[_0x816d('0x1b')][_0x816d('0x1d')]||null:null,'attributes':_0x41ba53[_0x816d('0x1b')]?_0x41ba53[_0x816d('0x1b')]['attributes']||null:null,'limit':_0x41ba53[_0x816d('0x1b')]?_0x41ba53[_0x816d('0x1b')][_0x816d('0x1f')]||null:null})[_0x816d('0xc')](function(_0x403ce7){logger[_0x816d('0x14')](_0x816d('0x24'),_0x41ba53);logger[_0x816d('0xd')](_0x816d('0x24'),_0x41ba53,JSON['stringify'](_0x403ce7));_0x25b9c3(_0x403ce7);})[_0x816d('0x17')](function(_0xb81152){logger[_0x816d('0x11')](_0x816d('0x24'),_0xb81152['message'],_0x41ba53);_0x236558(_0x58b868[_0x816d('0x11')](0x1f4,_0xb81152[_0x816d('0x13')]));});});}; \ No newline at end of file +var _0x1115=['model','GetMemberReport','debug','catch','CreateMemberReport','create','body','UpdateMemberReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','info','result','MemberReport','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x1cc2a9,_0x42f877){var _0x578e79=function(_0x3f25d9){while(--_0x3f25d9){_0x1cc2a9['push'](_0x1cc2a9['shift']());}};_0x578e79(++_0x42f877);}(_0x1115,0x1b6));var _0x5111=function(_0x4cac48,_0x42585f){_0x4cac48=_0x4cac48-0x0;var _0x470612=_0x1115[_0x4cac48];return _0x470612;};'use strict';var _=require('lodash');var util=require(_0x5111('0x0'));var moment=require(_0x5111('0x1'));var BPromise=require(_0x5111('0x2'));var rs=require(_0x5111('0x3'));var fs=require('fs');var Redis=require(_0x5111('0x4'));var db=require(_0x5111('0x5'))['db'];var utils=require(_0x5111('0x6'));var logger=require(_0x5111('0x7'))(_0x5111('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5111('0x9')][_0x5111('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50f0a3,_0x400661,_0x2d2777){return new BPromise(function(_0x54d5ae,_0x42a3c5){return client['request'](_0x50f0a3,_0x2d2777)[_0x5111('0xb')](function(_0x3bbc8c){logger['info']('MemberReport,\x20%s,\x20%s',_0x400661,_0x5111('0xc'));logger['debug'](_0x5111('0xd'),_0x400661,'request\x20sent',JSON[_0x5111('0xe')](_0x3bbc8c));if(_0x3bbc8c[_0x5111('0xf')]){if(_0x3bbc8c[_0x5111('0xf')][_0x5111('0x10')]===0x1f4){logger[_0x5111('0xf')](_0x5111('0x11'),_0x400661,_0x3bbc8c[_0x5111('0xf')][_0x5111('0x12')]);return _0x42a3c5(_0x3bbc8c[_0x5111('0xf')][_0x5111('0x12')]);}logger[_0x5111('0xf')](_0x5111('0x11'),_0x400661,_0x3bbc8c[_0x5111('0xf')][_0x5111('0x12')]);return _0x54d5ae(_0x3bbc8c[_0x5111('0xf')][_0x5111('0x12')]);}else{logger[_0x5111('0x13')](_0x5111('0x11'),_0x400661,'request\x20sent');_0x54d5ae(_0x3bbc8c[_0x5111('0x14')]['message']);}})['catch'](function(_0x387e1e){logger[_0x5111('0xf')](_0x5111('0x11'),_0x400661,_0x387e1e);_0x42a3c5(_0x387e1e);});});}exports['GetMemberReport']=function(_0x367f8d){var _0xa3f4ba=this;return new Promise(function(_0x52c614,_0x204c4f){return db[_0x5111('0x15')][_0x5111('0x16')]({'raw':_0x367f8d[_0x5111('0x17')]?_0x367f8d['options'][_0x5111('0x18')]===undefined?!![]:![]:!![],'where':_0x367f8d[_0x5111('0x17')]?_0x367f8d[_0x5111('0x17')][_0x5111('0x19')]||null:null,'attributes':_0x367f8d[_0x5111('0x17')]?_0x367f8d[_0x5111('0x17')][_0x5111('0x1a')]||null:null,'limit':_0x367f8d[_0x5111('0x17')]?_0x367f8d[_0x5111('0x17')][_0x5111('0x1b')]||null:null,'include':_0x367f8d['options']?_0x367f8d[_0x5111('0x17')][_0x5111('0x1c')]?_[_0x5111('0x1d')](_0x367f8d['options'][_0x5111('0x1c')],function(_0x20a4f7){return{'model':db[_0x20a4f7[_0x5111('0x1e')]],'as':_0x20a4f7['as'],'attributes':_0x20a4f7[_0x5111('0x1a')],'include':_0x20a4f7[_0x5111('0x1c')]?_[_0x5111('0x1d')](_0x20a4f7[_0x5111('0x1c')],function(_0x316b39){return{'model':db[_0x316b39[_0x5111('0x1e')]],'as':_0x316b39['as'],'attributes':_0x316b39[_0x5111('0x1a')],'include':_0x316b39['include']?_[_0x5111('0x1d')](_0x316b39[_0x5111('0x1c')],function(_0x151b67){return{'model':db[_0x151b67[_0x5111('0x1e')]],'as':_0x151b67['as'],'attributes':_0x151b67[_0x5111('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5111('0xb')](function(_0x2e24ed){logger['info'](_0x5111('0x1f'),_0x367f8d);logger[_0x5111('0x20')](_0x5111('0x1f'),_0x367f8d,JSON['stringify'](_0x2e24ed));_0x52c614(_0x2e24ed);})[_0x5111('0x21')](function(_0x28efc1){logger[_0x5111('0xf')]('GetMemberReport',_0x28efc1['message'],_0x367f8d);_0x204c4f(_0xa3f4ba[_0x5111('0xf')](0x1f4,_0x28efc1['message']));});});};exports[_0x5111('0x22')]=function(_0x5b5a6d){var _0x35ed41=this;return new Promise(function(_0x5a433c,_0x4bb7e2){return db['MemberReport'][_0x5111('0x23')](_0x5b5a6d[_0x5111('0x24')],{'raw':_0x5b5a6d[_0x5111('0x17')]?_0x5b5a6d[_0x5111('0x17')][_0x5111('0x18')]===undefined?!![]:![]:!![]})[_0x5111('0xb')](function(_0x2aceaa){logger['info'](_0x5111('0x22'),_0x5b5a6d);logger[_0x5111('0x20')](_0x5111('0x22'),_0x5b5a6d,JSON[_0x5111('0xe')](_0x2aceaa));_0x5a433c(_0x2aceaa);})['catch'](function(_0x5ce8c7){logger[_0x5111('0xf')](_0x5111('0x22'),_0x5ce8c7[_0x5111('0x12')],_0x5b5a6d);_0x4bb7e2(_0x35ed41[_0x5111('0xf')](0x1f4,_0x5ce8c7[_0x5111('0x12')]));});});};exports[_0x5111('0x25')]=function(_0x1d8f81){var _0x21f248=this;return new Promise(function(_0x4d4bf5,_0x159cb5){return db[_0x5111('0x15')][_0x5111('0x26')](_0x1d8f81['body'],{'raw':_0x1d8f81[_0x5111('0x17')]?_0x1d8f81[_0x5111('0x17')][_0x5111('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d8f81['options']?_0x1d8f81['options']['where']||null:null,'attributes':_0x1d8f81[_0x5111('0x17')]?_0x1d8f81[_0x5111('0x17')][_0x5111('0x1a')]||null:null,'limit':_0x1d8f81[_0x5111('0x17')]?_0x1d8f81[_0x5111('0x17')]['limit']||null:null})[_0x5111('0xb')](function(_0x222c73){logger[_0x5111('0x13')](_0x5111('0x25'),_0x1d8f81);logger['debug'](_0x5111('0x25'),_0x1d8f81,JSON[_0x5111('0xe')](_0x222c73));_0x4d4bf5(_0x222c73);})[_0x5111('0x21')](function(_0x33bc16){logger[_0x5111('0xf')](_0x5111('0x25'),_0x33bc16[_0x5111('0x12')],_0x1d8f81);_0x159cb5(_0x21f248[_0x5111('0xf')](0x1f4,_0x33bc16[_0x5111('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 865bb61..f9233ae 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 _0xfd64=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','util','path'];(function(_0x486a99,_0x3a5941){var _0x5f171f=function(_0x5bd3ca){while(--_0x5bd3ca){_0x486a99['push'](_0x486a99['shift']());}};_0x5f171f(++_0x3a5941);}(_0xfd64,0x1c5));var _0x4fd6=function(_0x3bf8ac,_0x358931){_0x3bf8ac=_0x3bf8ac-0x0;var _0x2cc39b=_0xfd64[_0x3bf8ac];return _0x2cc39b;};'use strict';var multer=require('multer');var util=require(_0x4fd6('0x0'));var path=require(_0x4fd6('0x1'));var timeout=require(_0x4fd6('0x2'));var express=require(_0x4fd6('0x3'));var router=express[_0x4fd6('0x4')]();var fs_extra=require(_0x4fd6('0x5'));var auth=require(_0x4fd6('0x6'));var interaction=require(_0x4fd6('0x7'));var config=require(_0x4fd6('0x8'));var controller=require(_0x4fd6('0x9'));router[_0x4fd6('0xa')]('/',controller[_0x4fd6('0xb')]);module[_0x4fd6('0xc')]=router; \ No newline at end of file +var _0x4301=['get','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x448c17,_0x417c72){var _0x51e246=function(_0x5d34f5){while(--_0x5d34f5){_0x448c17['push'](_0x448c17['shift']());}};_0x51e246(++_0x417c72);}(_0x4301,0x17a));var _0x1430=function(_0x175b2b,_0x291397){_0x175b2b=_0x175b2b-0x0;var _0x275d0d=_0x4301[_0x175b2b];return _0x275d0d;};'use strict';var multer=require(_0x1430('0x0'));var util=require('util');var path=require(_0x1430('0x1'));var timeout=require(_0x1430('0x2'));var express=require(_0x1430('0x3'));var router=express[_0x1430('0x4')]();var fs_extra=require(_0x1430('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x1430('0x6')]('/',controller['index']);module[_0x1430('0x7')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index cb8b27c..61b02e9 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 _0x9133=['version','sequelize','exports','STRING'];(function(_0xf16836,_0x1ca05e){var _0x1ee290=function(_0x11af9a){while(--_0x11af9a){_0xf16836['push'](_0xf16836['shift']());}};_0x1ee290(++_0x1ca05e);}(_0x9133,0x199));var _0x3913=function(_0x13c4f8,_0x433521){_0x13c4f8=_0x13c4f8-0x0;var _0x5a8f4b=_0x9133[_0x13c4f8];return _0x5a8f4b;};'use strict';var Sequelize=require(_0x3913('0x0'));module[_0x3913('0x1')]={'version':{'type':Sequelize[_0x3913('0x2')],'unique':_0x3913('0x3')}}; \ No newline at end of file +var _0xf4d8=['sequelize','STRING','version'];(function(_0x2b9432,_0x5e1244){var _0xa1b3ce=function(_0x9bc4e3){while(--_0x9bc4e3){_0x2b9432['push'](_0x2b9432['shift']());}};_0xa1b3ce(++_0x5e1244);}(_0xf4d8,0x7b));var _0x8f4d=function(_0x15a4c4,_0x6f33cd){_0x15a4c4=_0x15a4c4-0x0;var _0x1249f2=_0xf4d8[_0x15a4c4];return _0x1249f2;};'use strict';var Sequelize=require(_0x8f4d('0x0'));module['exports']={'version':{'type':Sequelize[_0x8f4d('0x1')],'unique':_0x8f4d('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 83cf94c..4462b9a 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 _0x2d20=['json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','limit','count','offset','set'];(function(_0x1414b3,_0x477031){var _0x5761ab=function(_0x4017cd){while(--_0x4017cd){_0x1414b3['push'](_0x1414b3['shift']());}};_0x5761ab(++_0x477031);}(_0x2d20,0x6c));var _0x02d2=function(_0x525dad,_0x4603bb){_0x525dad=_0x525dad-0x0;var _0x33b8f8=_0x2d20[_0x525dad];return _0x33b8f8;};'use strict';var emlformat=require(_0x02d2('0x0'));var rimraf=require(_0x02d2('0x1'));var zipdir=require(_0x02d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x02d2('0x3'));var moment=require(_0x02d2('0x4'));var BPromise=require(_0x02d2('0x5'));var Mustache=require(_0x02d2('0x6'));var util=require(_0x02d2('0x7'));var path=require(_0x02d2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x02d2('0x9'));var fs=require('fs');var fs_extra=require(_0x02d2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x02d2('0xb'));var jsforce=require(_0x02d2('0xc'));var deskjs=require(_0x02d2('0xd'));var toCsv=require(_0x02d2('0xe'));var querystring=require(_0x02d2('0xf'));var Papa=require(_0x02d2('0x10'));var Redis=require(_0x02d2('0x11'));var authService=require(_0x02d2('0x12'));var qs=require(_0x02d2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x02d2('0x14'));var logger=require(_0x02d2('0x15'))(_0x02d2('0x16'));var utils=require(_0x02d2('0x17'));var config=require(_0x02d2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x253db9,_0x3c6811){_0x3c6811=_0x3c6811||0xcc;return function(_0x26f201){if(_0x26f201){return _0x253db9[_0x02d2('0x19')](_0x3c6811);}return _0x253db9[_0x02d2('0x1a')](_0x3c6811)[_0x02d2('0x1b')]();};}function respondWithResult(_0x1de7e7,_0x5e49f2){_0x5e49f2=_0x5e49f2||0xc8;return function(_0x1cccb3){if(_0x1cccb3){return _0x1de7e7['status'](_0x5e49f2)['json'](_0x1cccb3);}};}function respondWithFilteredResult(_0x4598e9,_0x4e0728){return function(_0xb8bfb9){if(_0xb8bfb9){var _0x1d1370=typeof _0x4e0728['offset']==='undefined'&&typeof _0x4e0728[_0x02d2('0x1c')]==='undefined';var _0x535daa=_0xb8bfb9[_0x02d2('0x1d')];var _0x47c521=_0x1d1370?0x0:_0x4e0728[_0x02d2('0x1e')];var _0x162592=_0x1d1370?_0xb8bfb9['count']:_0x4e0728['offset']+_0x4e0728[_0x02d2('0x1c')];var _0x1c77ba;if(_0x162592>=_0x535daa){_0x162592=_0x535daa;_0x1c77ba=0xc8;}else{_0x1c77ba=0xce;}_0x4598e9[_0x02d2('0x1a')](_0x1c77ba);return _0x4598e9[_0x02d2('0x1f')]('Content-Range',_0x47c521+'-'+_0x162592+'/'+_0x535daa)[_0x02d2('0x20')](_0xb8bfb9);}return null;};}function patchUpdates(_0x1619ef){return function(_0x38e838){try{jsonpatch[_0x02d2('0x21')](_0x38e838,_0x1619ef,!![]);}catch(_0x2e39d5){return BPromise[_0x02d2('0x22')](_0x2e39d5);}return _0x38e838[_0x02d2('0x23')]();};}function saveUpdates(_0x4253ad,_0x1420b3){return function(_0x2b1386){if(_0x2b1386){return _0x2b1386[_0x02d2('0x24')](_0x4253ad)[_0x02d2('0x25')](function(_0x1dd833){return _0x1dd833;});}return null;};}function removeEntity(_0x5d7f6c,_0x5abbb6){return function(_0x490e18){if(_0x490e18){return _0x490e18[_0x02d2('0x26')]()[_0x02d2('0x25')](function(){_0x5d7f6c[_0x02d2('0x1a')](0xcc)[_0x02d2('0x1b')]();});}};}function handleEntityNotFound(_0x17a99d,_0x505ad8){return function(_0xfab672){if(!_0xfab672){_0x17a99d['sendStatus'](0x194);}return _0xfab672;};}function handleError(_0xb593bf,_0x2f3768){_0x2f3768=_0x2f3768||0x1f4;return function(_0x1b3336){logger[_0x02d2('0x27')](_0x1b3336[_0x02d2('0x28')]);if(_0x1b3336[_0x02d2('0x29')]){delete _0x1b3336[_0x02d2('0x29')];}_0xb593bf['status'](_0x2f3768)[_0x02d2('0x2a')](_0x1b3336);};}exports[_0x02d2('0x2b')]=function(_0x1807a5,_0x240a23){var _0x25148f={},_0x5176a5={},_0x51a879={'count':0x0,'rows':[]};var _0x1a77be=_[_0x02d2('0x2c')](db[_0x02d2('0x2d')][_0x02d2('0x2e')],function(_0xbac831){return{'name':_0xbac831[_0x02d2('0x2f')],'type':_0xbac831['type'][_0x02d2('0x30')]};});_0x5176a5[_0x02d2('0x31')]=_[_0x02d2('0x2c')](_0x1a77be,'name');_0x5176a5[_0x02d2('0x32')]=_[_0x02d2('0x33')](_0x1807a5[_0x02d2('0x32')]);_0x5176a5['filters']=_[_0x02d2('0x34')](_0x5176a5['model'],_0x5176a5[_0x02d2('0x32')]);_0x25148f['attributes']=_[_0x02d2('0x34')](_0x5176a5['model'],qs['fields'](_0x1807a5['query'][_0x02d2('0x35')]));_0x25148f[_0x02d2('0x36')]=_0x25148f[_0x02d2('0x36')]['length']?_0x25148f['attributes']:_0x5176a5['model'];if(!_0x1807a5['query'][_0x02d2('0x37')](_0x02d2('0x38'))){_0x25148f[_0x02d2('0x1c')]=qs[_0x02d2('0x1c')](_0x1807a5[_0x02d2('0x32')]['limit']);_0x25148f[_0x02d2('0x1e')]=qs[_0x02d2('0x1e')](_0x1807a5[_0x02d2('0x32')]['offset']);}_0x25148f[_0x02d2('0x39')]=qs[_0x02d2('0x3a')](_0x1807a5[_0x02d2('0x32')][_0x02d2('0x3a')]);_0x25148f[_0x02d2('0x3b')]=qs['filters'](_[_0x02d2('0x3c')](_0x1807a5[_0x02d2('0x32')],_0x5176a5[_0x02d2('0x3d')]),_0x1a77be);if(_0x1807a5[_0x02d2('0x32')][_0x02d2('0x3e')]){_0x25148f[_0x02d2('0x3b')]=_[_0x02d2('0x3f')](_0x25148f['where'],{'$or':_['map'](_0x1a77be,function(_0x2494c0){if(_0x2494c0['type']!==_0x02d2('0x40')){var _0xd003f7={};_0xd003f7[_0x2494c0['name']]={'$like':'%'+_0x1807a5[_0x02d2('0x32')][_0x02d2('0x3e')]+'%'};return _0xd003f7;}})});}_0x25148f=_[_0x02d2('0x3f')]({},_0x25148f,_0x1807a5[_0x02d2('0x41')]);var _0x2380a6={'where':_0x25148f['where']};return db['Migration'][_0x02d2('0x1d')](_0x2380a6)['then'](function(_0x35b530){_0x51a879['count']=_0x35b530;if(_0x1807a5['query'][_0x02d2('0x42')]){_0x25148f['include']=[{'all':!![]}];}return db[_0x02d2('0x2d')][_0x02d2('0x43')](_0x25148f);})[_0x02d2('0x25')](function(_0x20d93d){_0x51a879[_0x02d2('0x44')]=_0x20d93d;return _0x51a879;})[_0x02d2('0x25')](respondWithFilteredResult(_0x240a23,_0x25148f))[_0x02d2('0x45')](handleError(_0x240a23,null));}; \ No newline at end of file +var _0x81a3=['api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','Migration','includeAll','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x21668c,_0xdc61d4){var _0x2655fe=function(_0x42a615){while(--_0x42a615){_0x21668c['push'](_0x21668c['shift']());}};_0x2655fe(++_0xdc61d4);}(_0x81a3,0x1e4));var _0x381a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x81a3[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x381a('0x0'));var rimraf=require(_0x381a('0x1'));var zipdir=require(_0x381a('0x2'));var jsonpatch=require(_0x381a('0x3'));var rp=require(_0x381a('0x4'));var moment=require(_0x381a('0x5'));var BPromise=require(_0x381a('0x6'));var Mustache=require('mustache');var util=require(_0x381a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x381a('0x8'));var ejs=require(_0x381a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x381a('0xa'));var crypto=require(_0x381a('0xb'));var jsforce=require(_0x381a('0xc'));var deskjs=require(_0x381a('0xd'));var toCsv=require(_0x381a('0x8'));var querystring=require('querystring');var Papa=require(_0x381a('0xe'));var Redis=require(_0x381a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x381a('0x10'));var as=require(_0x381a('0x11'));var hardwareService=require(_0x381a('0x12'));var logger=require(_0x381a('0x13'))(_0x381a('0x14'));var utils=require('../../config/utils');var config=require(_0x381a('0x15'));var licenseUtil=require(_0x381a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3726ae,_0x389da9){_0x389da9=_0x389da9||0xcc;return function(_0x458864){if(_0x458864){return _0x3726ae[_0x381a('0x17')](_0x389da9);}return _0x3726ae[_0x381a('0x18')](_0x389da9)['end']();};}function respondWithResult(_0x293ffa,_0x51de21){_0x51de21=_0x51de21||0xc8;return function(_0x51b607){if(_0x51b607){return _0x293ffa['status'](_0x51de21)[_0x381a('0x19')](_0x51b607);}};}function respondWithFilteredResult(_0x5b942a,_0xafd7){return function(_0x47e356){if(_0x47e356){var _0x1683b8=typeof _0xafd7[_0x381a('0x1a')]===_0x381a('0x1b')&&typeof _0xafd7[_0x381a('0x1c')]===_0x381a('0x1b');var _0x84487b=_0x47e356[_0x381a('0x1d')];var _0x1f0b94=_0x1683b8?0x0:_0xafd7['offset'];var _0x2b3706=_0x1683b8?_0x47e356[_0x381a('0x1d')]:_0xafd7[_0x381a('0x1a')]+_0xafd7['limit'];var _0x3fc08d;if(_0x2b3706>=_0x84487b){_0x2b3706=_0x84487b;_0x3fc08d=0xc8;}else{_0x3fc08d=0xce;}_0x5b942a[_0x381a('0x18')](_0x3fc08d);return _0x5b942a['set'](_0x381a('0x1e'),_0x1f0b94+'-'+_0x2b3706+'/'+_0x84487b)['json'](_0x47e356);}return null;};}function patchUpdates(_0x3e15cd){return function(_0x89919c){try{jsonpatch[_0x381a('0x1f')](_0x89919c,_0x3e15cd,!![]);}catch(_0x3a5f5c){return BPromise[_0x381a('0x20')](_0x3a5f5c);}return _0x89919c[_0x381a('0x21')]();};}function saveUpdates(_0x28789a,_0x19ae01){return function(_0x5962f4){if(_0x5962f4){return _0x5962f4[_0x381a('0x22')](_0x28789a)[_0x381a('0x23')](function(_0x19ae07){return _0x19ae07;});}return null;};}function removeEntity(_0x1a81d9,_0x57d763){return function(_0x21ff0d){if(_0x21ff0d){return _0x21ff0d['destroy']()['then'](function(){_0x1a81d9[_0x381a('0x18')](0xcc)[_0x381a('0x24')]();});}};}function handleEntityNotFound(_0x1582f0,_0xc07a0a){return function(_0x965493){if(!_0x965493){_0x1582f0['sendStatus'](0x194);}return _0x965493;};}function handleError(_0x394d46,_0x365d2e){_0x365d2e=_0x365d2e||0x1f4;return function(_0x3cc177){logger[_0x381a('0x25')](_0x3cc177[_0x381a('0x26')]);if(_0x3cc177[_0x381a('0x27')]){delete _0x3cc177[_0x381a('0x27')];}_0x394d46[_0x381a('0x18')](_0x365d2e)['send'](_0x3cc177);};}exports['index']=function(_0x317783,_0x360caf){var _0x158918={},_0x16626f={},_0x4f29d3={'count':0x0,'rows':[]};var _0x4bbaf8=_[_0x381a('0x28')](db['Migration'][_0x381a('0x29')],function(_0x477dca){return{'name':_0x477dca[_0x381a('0x2a')],'type':_0x477dca[_0x381a('0x2b')][_0x381a('0x2c')]};});_0x16626f[_0x381a('0x2d')]=_[_0x381a('0x28')](_0x4bbaf8,_0x381a('0x27'));_0x16626f[_0x381a('0x2e')]=_['keys'](_0x317783['query']);_0x16626f['filters']=_['intersection'](_0x16626f[_0x381a('0x2d')],_0x16626f['query']);_0x158918['attributes']=_[_0x381a('0x2f')](_0x16626f[_0x381a('0x2d')],qs[_0x381a('0x30')](_0x317783[_0x381a('0x2e')][_0x381a('0x30')]));_0x158918['attributes']=_0x158918[_0x381a('0x31')][_0x381a('0x32')]?_0x158918[_0x381a('0x31')]:_0x16626f[_0x381a('0x2d')];if(!_0x317783['query']['hasOwnProperty'](_0x381a('0x33'))){_0x158918[_0x381a('0x1c')]=qs['limit'](_0x317783[_0x381a('0x2e')][_0x381a('0x1c')]);_0x158918[_0x381a('0x1a')]=qs[_0x381a('0x1a')](_0x317783[_0x381a('0x2e')][_0x381a('0x1a')]);}_0x158918[_0x381a('0x34')]=qs[_0x381a('0x35')](_0x317783['query'][_0x381a('0x35')]);_0x158918[_0x381a('0x36')]=qs[_0x381a('0x37')](_[_0x381a('0x38')](_0x317783[_0x381a('0x2e')],_0x16626f['filters']),_0x4bbaf8);if(_0x317783[_0x381a('0x2e')][_0x381a('0x39')]){_0x158918[_0x381a('0x36')]=_[_0x381a('0x3a')](_0x158918['where'],{'$or':_[_0x381a('0x28')](_0x4bbaf8,function(_0x42634b){if(_0x42634b[_0x381a('0x2b')]!==_0x381a('0x3b')){var _0x1289f7={};_0x1289f7[_0x42634b['name']]={'$like':'%'+_0x317783[_0x381a('0x2e')][_0x381a('0x39')]+'%'};return _0x1289f7;}})});}_0x158918=_['merge']({},_0x158918,_0x317783['options']);var _0x31c2d0={'where':_0x158918[_0x381a('0x36')]};return db[_0x381a('0x3c')][_0x381a('0x1d')](_0x31c2d0)[_0x381a('0x23')](function(_0x28c7fc){_0x4f29d3[_0x381a('0x1d')]=_0x28c7fc;if(_0x317783[_0x381a('0x2e')][_0x381a('0x3d')]){_0x158918['include']=[{'all':!![]}];}return db['Migration']['findAll'](_0x158918);})[_0x381a('0x23')](function(_0x23928a){_0x4f29d3['rows']=_0x23928a;return _0x4f29d3;})['then'](respondWithFilteredResult(_0x360caf,_0x158918))[_0x381a('0x3e')](handleError(_0x360caf,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index bf4d9ed..9ce5733 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 _0x2473=['./migration.attributes','exports','migrations','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x2473,0x137));var _0x3247=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2473[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x3247('0x0'));var util=require(_0x3247('0x1'));var logger=require('../../config/logger')(_0x3247('0x2'));var moment=require(_0x3247('0x3'));var BPromise=require(_0x3247('0x4'));var rp=require(_0x3247('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3247('0x6'));var config=require(_0x3247('0x7'));var attributes=require(_0x3247('0x8'));module[_0x3247('0x9')]=function(_0x2038cf,_0x10a9dc){return _0x2038cf['define']('Migration',attributes,{'tableName':_0x3247('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x720e=['Migration','migrations','lodash','util','api','moment','path','rimraf','../../config/environment','./migration.attributes','define'];(function(_0x484cac,_0x30ad3a){var _0x1d6e77=function(_0x4f5f16){while(--_0x4f5f16){_0x484cac['push'](_0x484cac['shift']());}};_0x1d6e77(++_0x30ad3a);}(_0x720e,0x199));var _0xe720=function(_0x27125a,_0x252d0d){_0x27125a=_0x27125a-0x0;var _0x391f7a=_0x720e[_0x27125a];return _0x391f7a;};'use strict';var _=require(_0xe720('0x0'));var util=require(_0xe720('0x1'));var logger=require('../../config/logger')(_0xe720('0x2'));var moment=require(_0xe720('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe720('0x4'));var rimraf=require(_0xe720('0x5'));var config=require(_0xe720('0x6'));var attributes=require(_0xe720('0x7'));module['exports']=function(_0x56aae0,_0x530908){return _0x56aae0[_0xe720('0x8')](_0xe720('0x9'),attributes,{'tableName':_0xe720('0xa'),'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 865e9df..be4512f 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 _0x00b3=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x4a151d,_0x3b1d73){var _0x4c2e94=function(_0xcd729){while(--_0xcd729){_0x4a151d['push'](_0x4a151d['shift']());}};_0x4c2e94(++_0x3b1d73);}(_0x00b3,0x17a));var _0x300b=function(_0x4ca99e,_0x243705){_0x4ca99e=_0x4ca99e-0x0;var _0xd9dd70=_0x00b3[_0x4ca99e];return _0xd9dd70;};'use strict';var _=require('lodash');var util=require(_0x300b('0x0'));var moment=require(_0x300b('0x1'));var BPromise=require(_0x300b('0x2'));var rs=require(_0x300b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x300b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x300b('0x5'))('rpc');var config=require(_0x300b('0x6'));var jayson=require(_0x300b('0x7'));var client=jayson[_0x300b('0x8')][_0x300b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af470,_0x5dabb9,_0x30b3fe){return new BPromise(function(_0x590c4d,_0x5e283c){return client[_0x300b('0xa')](_0x5af470,_0x30b3fe)[_0x300b('0xb')](function(_0x457aa3){logger['info'](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));logger[_0x300b('0xe')](_0x300b('0xf'),_0x5dabb9,'request\x20sent',JSON[_0x300b('0x10')](_0x457aa3));if(_0x457aa3[_0x300b('0x11')]){if(_0x457aa3[_0x300b('0x11')]['code']===0x1f4){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);return _0x5e283c(_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);}logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3['error']['message']);return _0x590c4d(_0x457aa3['error']['message']);}else{logger[_0x300b('0x13')](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));_0x590c4d(_0x457aa3[_0x300b('0x14')]['message']);}})['catch'](function(_0x35b1d7){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x35b1d7);_0x5e283c(_0x35b1d7);});});} \ No newline at end of file +var _0xc368=['client','request','then','request\x20sent','debug','stringify','error','code','Migration,\x20%s,\x20%s','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x52e80b,_0x2eef09){var _0x4fdaef=function(_0x59e379){while(--_0x59e379){_0x52e80b['push'](_0x52e80b['shift']());}};_0x4fdaef(++_0x2eef09);}(_0xc368,0x7b));var _0x8c36=function(_0xb511ed,_0x13dc74){_0xb511ed=_0xb511ed-0x0;var _0x255900=_0xc368[_0xb511ed];return _0x255900;};'use strict';var _=require('lodash');var util=require(_0x8c36('0x0'));var moment=require('moment');var BPromise=require(_0x8c36('0x1'));var rs=require(_0x8c36('0x2'));var fs=require('fs');var Redis=require(_0x8c36('0x3'));var db=require(_0x8c36('0x4'))['db'];var utils=require(_0x8c36('0x5'));var logger=require('../../config/logger')(_0x8c36('0x6'));var config=require(_0x8c36('0x7'));var jayson=require(_0x8c36('0x8'));var client=jayson[_0x8c36('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554022,_0x8ed437,_0x384867){return new BPromise(function(_0x3e76be,_0x26bad1){return client[_0x8c36('0xa')](_0x554022,_0x384867)[_0x8c36('0xb')](function(_0x569f29){logger['info']('Migration,\x20%s,\x20%s',_0x8ed437,_0x8c36('0xc'));logger[_0x8c36('0xd')]('Migration,\x20%s,\x20%s,\x20%s',_0x8ed437,_0x8c36('0xc'),JSON[_0x8c36('0xe')](_0x569f29));if(_0x569f29[_0x8c36('0xf')]){if(_0x569f29[_0x8c36('0xf')][_0x8c36('0x10')]===0x1f4){logger[_0x8c36('0xf')](_0x8c36('0x11'),_0x8ed437,_0x569f29[_0x8c36('0xf')][_0x8c36('0x12')]);return _0x26bad1(_0x569f29[_0x8c36('0xf')][_0x8c36('0x12')]);}logger[_0x8c36('0xf')](_0x8c36('0x11'),_0x8ed437,_0x569f29[_0x8c36('0xf')]['message']);return _0x3e76be(_0x569f29[_0x8c36('0xf')]['message']);}else{logger[_0x8c36('0x13')](_0x8c36('0x11'),_0x8ed437,_0x8c36('0xc'));_0x3e76be(_0x569f29[_0x8c36('0x14')][_0x8c36('0x12')]);}})[_0x8c36('0x15')](function(_0x3c10eb){logger[_0x8c36('0xf')](_0x8c36('0x11'),_0x8ed437,_0x3c10eb);_0x26bad1(_0x3c10eb);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 426fd81..a6bc718 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 _0x36e0=['Router','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index','/:id','create','put','destroy','exports','multer','util','connect-timeout','express'];(function(_0x1190c3,_0x47c90c){var _0x5c94d8=function(_0x559543){while(--_0x559543){_0x1190c3['push'](_0x1190c3['shift']());}};_0x5c94d8(++_0x47c90c);}(_0x36e0,0x15c));var _0x036e=function(_0xf6a090,_0x1cd396){_0xf6a090=_0xf6a090-0x0;var _0x35f264=_0x36e0[_0xf6a090];return _0x35f264;};'use strict';var multer=require(_0x036e('0x0'));var util=require(_0x036e('0x1'));var path=require('path');var timeout=require(_0x036e('0x2'));var express=require(_0x036e('0x3'));var router=express[_0x036e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x036e('0x5'));var interaction=require(_0x036e('0x6'));var config=require('../../config/environment');var controller=require(_0x036e('0x7'));router[_0x036e('0x8')]('/',auth[_0x036e('0x9')](),controller[_0x036e('0xa')]);router[_0x036e('0x8')](_0x036e('0xb'),auth[_0x036e('0x9')](),controller['show']);router['post']('/',auth[_0x036e('0x9')](),controller[_0x036e('0xc')]);router[_0x036e('0xd')](_0x036e('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x036e('0xb'),auth[_0x036e('0x9')](),controller[_0x036e('0xe')]);module[_0x036e('0xf')]=router; \ No newline at end of file +var _0x2c24=['../../components/auth/service','../../components/interaction/service','./network.controller','get','index','/:id','isAuthenticated','show','post','update','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x7986a2,_0x2967e0){var _0x23c61a=function(_0x52c17d){while(--_0x52c17d){_0x7986a2['push'](_0x7986a2['shift']());}};_0x23c61a(++_0x2967e0);}(_0x2c24,0x1e6));var _0x42c2=function(_0x28266c,_0x2a9fbe){_0x28266c=_0x28266c-0x0;var _0x40d553=_0x2c24[_0x28266c];return _0x40d553;};'use strict';var multer=require(_0x42c2('0x0'));var util=require(_0x42c2('0x1'));var path=require(_0x42c2('0x2'));var timeout=require(_0x42c2('0x3'));var express=require(_0x42c2('0x4'));var router=express[_0x42c2('0x5')]();var fs_extra=require(_0x42c2('0x6'));var auth=require(_0x42c2('0x7'));var interaction=require(_0x42c2('0x8'));var config=require('../../config/environment');var controller=require(_0x42c2('0x9'));router[_0x42c2('0xa')]('/',auth['isAuthenticated'](),controller[_0x42c2('0xb')]);router[_0x42c2('0xa')](_0x42c2('0xc'),auth[_0x42c2('0xd')](),controller[_0x42c2('0xe')]);router[_0x42c2('0xf')]('/',auth[_0x42c2('0xd')](),controller['create']);router['put'](_0x42c2('0xc'),auth[_0x42c2('0xd')](),controller[_0x42c2('0x10')]);router['delete'](_0x42c2('0xc'),auth[_0x42c2('0xd')](),controller['destroy']);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 7348c75..f9cb3e7 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 _0x98d1=['sequelize','ENUM','localnet','externip','stun','turn','STRING'];(function(_0x1fca6c,_0x2bbb55){var _0x4583de=function(_0x3cba69){while(--_0x3cba69){_0x1fca6c['push'](_0x1fca6c['shift']());}};_0x4583de(++_0x2bbb55);}(_0x98d1,0x165));var _0x198d=function(_0x2dcd4d,_0x537fd4){_0x2dcd4d=_0x2dcd4d-0x0;var _0x344adc=_0x98d1[_0x2dcd4d];return _0x344adc;};'use strict';var Sequelize=require(_0x198d('0x0'));module['exports']={'type':{'type':Sequelize[_0x198d('0x1')](_0x198d('0x2'),_0x198d('0x3'),_0x198d('0x4'),_0x198d('0x5'))},'value':{'type':Sequelize[_0x198d('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x198d('0x6')]}}; \ No newline at end of file +var _0xcfd6=['STRING','sequelize','exports','ENUM','localnet','stun'];(function(_0x2e55d8,_0x264875){var _0x32dbeb=function(_0x3862a3){while(--_0x3862a3){_0x2e55d8['push'](_0x2e55d8['shift']());}};_0x32dbeb(++_0x264875);}(_0xcfd6,0xf7));var _0x6cfd=function(_0x1c4da0,_0x23e837){_0x1c4da0=_0x1c4da0-0x0;var _0x490200=_0xcfd6[_0x1c4da0];return _0x490200;};'use strict';var Sequelize=require(_0x6cfd('0x0'));module[_0x6cfd('0x1')]={'type':{'type':Sequelize[_0x6cfd('0x2')](_0x6cfd('0x3'),'externip',_0x6cfd('0x4'),'turn')},'value':{'type':Sequelize[_0x6cfd('0x5')]},'username':{'type':Sequelize[_0x6cfd('0x5')]},'password':{'type':Sequelize[_0x6cfd('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index f840c7a..c0a5e77 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 _0x6208=['undefined','limit','count','Content-Range','apply','update','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','rows','show','params','keys','includeAll','find','sequelize','transaction','create','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','chan_sip.so','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','destroy','findAll','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset'];(function(_0x2b47ad,_0x55c7cc){var _0x1a2426=function(_0x47285b){while(--_0x47285b){_0x2b47ad['push'](_0x2b47ad['shift']());}};_0x1a2426(++_0x55c7cc);}(_0x6208,0x17d));var _0x8620=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0x6208[_0x2932cf];return _0x1711dd;};'use strict';var emlformat=require(_0x8620('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8620('0x1'));var jsonpatch=require(_0x8620('0x2'));var rp=require('request-promise');var moment=require(_0x8620('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8620('0x4'));var util=require(_0x8620('0x5'));var path=require(_0x8620('0x6'));var sox=require(_0x8620('0x7'));var csv=require(_0x8620('0x8'));var ejs=require(_0x8620('0x9'));var fs=require('fs');var fs_extra=require(_0x8620('0xa'));var _=require('lodash');var squel=require(_0x8620('0xb'));var crypto=require(_0x8620('0xc'));var jsforce=require(_0x8620('0xd'));var deskjs=require(_0x8620('0xe'));var toCsv=require(_0x8620('0x8'));var querystring=require(_0x8620('0xf'));var Papa=require(_0x8620('0x10'));var Redis=require(_0x8620('0x11'));var authService=require(_0x8620('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8620('0x13'));var hardwareService=require(_0x8620('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x8620('0x15'));var config=require(_0x8620('0x16'));var licenseUtil=require(_0x8620('0x17'));var db=require(_0x8620('0x18'))['db'];var jayson=require(_0x8620('0x19'));var client=jayson[_0x8620('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc51dc4,_0x5a1f8f,_0xdfa354,_0x2747b3){return new BPromise(function(_0x2490bb,_0x1e6721){var _0x592551=_0x2747b3||client;return _0x592551[_0x8620('0x1b')](_0xc51dc4,_0xdfa354)[_0x8620('0x1c')](function(_0x5908c0){logger['info'](_0x8620('0x1d'),_0x5a1f8f,_0x8620('0x1e'));logger['debug'](_0x8620('0x1f'),_0x5a1f8f,'request\x20sent',JSON[_0x8620('0x20')](_0x5908c0));if(_0x5908c0[_0x8620('0x21')]){if(_0x5908c0[_0x8620('0x21')][_0x8620('0x22')]===0x1f4){logger[_0x8620('0x21')](_0x8620('0x1d'),_0x5a1f8f,_0x5908c0[_0x8620('0x21')][_0x8620('0x23')]);return _0x1e6721(_0x5908c0[_0x8620('0x21')][_0x8620('0x23')]);}logger[_0x8620('0x21')](_0x8620('0x1d'),_0x5a1f8f,_0x5908c0[_0x8620('0x21')][_0x8620('0x23')]);return _0x2490bb(_0x5908c0[_0x8620('0x21')][_0x8620('0x23')]);}else{logger[_0x8620('0x24')](_0x8620('0x1d'),_0x5a1f8f,_0x8620('0x1e'));_0x2490bb(_0x5908c0[_0x8620('0x25')]['message']);}})[_0x8620('0x26')](function(_0x3e3f59){logger[_0x8620('0x21')](_0x8620('0x1d'),_0x5a1f8f,_0x3e3f59);_0x1e6721(_0x3e3f59);});});}function respondWithStatusCode(_0xca485e,_0x291e6b){_0x291e6b=_0x291e6b||0xcc;return function(_0x28c3e1){if(_0x28c3e1){return _0xca485e[_0x8620('0x27')](_0x291e6b);}return _0xca485e[_0x8620('0x28')](_0x291e6b)['end']();};}function respondWithResult(_0x4d03cb,_0x5b9e92){_0x5b9e92=_0x5b9e92||0xc8;return function(_0x42a703){if(_0x42a703){return _0x4d03cb[_0x8620('0x28')](_0x5b9e92)[_0x8620('0x29')](_0x42a703);}};}function respondWithFilteredResult(_0x56cf13,_0x2d8cbd){return function(_0x2671fb){if(_0x2671fb){var _0x9943f4=typeof _0x2d8cbd[_0x8620('0x2a')]===_0x8620('0x2b')&&typeof _0x2d8cbd[_0x8620('0x2c')]===_0x8620('0x2b');var _0x5e515c=_0x2671fb[_0x8620('0x2d')];var _0x524fc5=_0x9943f4?0x0:_0x2d8cbd[_0x8620('0x2a')];var _0x40e639=_0x9943f4?_0x2671fb[_0x8620('0x2d')]:_0x2d8cbd['offset']+_0x2d8cbd[_0x8620('0x2c')];var _0x4c48c0;if(_0x40e639>=_0x5e515c){_0x40e639=_0x5e515c;_0x4c48c0=0xc8;}else{_0x4c48c0=0xce;}_0x56cf13[_0x8620('0x28')](_0x4c48c0);return _0x56cf13['set'](_0x8620('0x2e'),_0x524fc5+'-'+_0x40e639+'/'+_0x5e515c)[_0x8620('0x29')](_0x2671fb);}return null;};}function patchUpdates(_0xc1af2b){return function(_0x21eea2){try{jsonpatch[_0x8620('0x2f')](_0x21eea2,_0xc1af2b,!![]);}catch(_0x3d9300){return BPromise['reject'](_0x3d9300);}return _0x21eea2['save']();};}function saveUpdates(_0x5d6693,_0x5d2032){return function(_0x1b919f){if(_0x1b919f){return _0x1b919f[_0x8620('0x30')](_0x5d6693)[_0x8620('0x1c')](function(_0x4e9d1d){return _0x4e9d1d;});}return null;};}function removeEntity(_0x5ec975,_0x572fc2){return function(_0x2f5697){if(_0x2f5697){return _0x2f5697['destroy']()['then'](function(){_0x5ec975['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x132b39,_0x1d527f){return function(_0x119866){if(!_0x119866){_0x132b39[_0x8620('0x27')](0x194);}return _0x119866;};}function handleError(_0x3dd626,_0x24dad0){_0x24dad0=_0x24dad0||0x1f4;return function(_0x202b91){logger[_0x8620('0x21')](_0x202b91[_0x8620('0x31')]);if(_0x202b91['name']){delete _0x202b91[_0x8620('0x32')];}_0x3dd626[_0x8620('0x28')](_0x24dad0)[_0x8620('0x33')](_0x202b91);};}exports[_0x8620('0x34')]=function(_0x597a18,_0x454f34){var _0x2cc394={},_0x22a325={},_0x40b0f7={'count':0x0,'rows':[]};var _0x1cff9f=_[_0x8620('0x35')](db[_0x8620('0x36')][_0x8620('0x37')],function(_0x3aee4a){return{'name':_0x3aee4a[_0x8620('0x38')],'type':_0x3aee4a[_0x8620('0x39')][_0x8620('0x3a')]};});_0x22a325[_0x8620('0x3b')]=_[_0x8620('0x35')](_0x1cff9f,_0x8620('0x32'));_0x22a325[_0x8620('0x3c')]=_['keys'](_0x597a18[_0x8620('0x3c')]);_0x22a325[_0x8620('0x3d')]=_['intersection'](_0x22a325['model'],_0x22a325[_0x8620('0x3c')]);_0x2cc394[_0x8620('0x3e')]=_[_0x8620('0x3f')](_0x22a325[_0x8620('0x3b')],qs[_0x8620('0x40')](_0x597a18['query'][_0x8620('0x40')]));_0x2cc394[_0x8620('0x3e')]=_0x2cc394[_0x8620('0x3e')]['length']?_0x2cc394[_0x8620('0x3e')]:_0x22a325[_0x8620('0x3b')];if(!_0x597a18['query'][_0x8620('0x41')](_0x8620('0x42'))){_0x2cc394['limit']=qs[_0x8620('0x2c')](_0x597a18[_0x8620('0x3c')]['limit']);_0x2cc394[_0x8620('0x2a')]=qs[_0x8620('0x2a')](_0x597a18['query'][_0x8620('0x2a')]);}_0x2cc394['order']=qs[_0x8620('0x43')](_0x597a18[_0x8620('0x3c')]['sort']);_0x2cc394[_0x8620('0x44')]=qs['filters'](_[_0x8620('0x45')](_0x597a18[_0x8620('0x3c')],_0x22a325[_0x8620('0x3d')]),_0x1cff9f);if(_0x597a18['query'][_0x8620('0x46')]){_0x2cc394['where']=_[_0x8620('0x47')](_0x2cc394[_0x8620('0x44')],{'$or':_[_0x8620('0x35')](_0x1cff9f,function(_0xff849a){if(_0xff849a[_0x8620('0x39')]!=='VIRTUAL'){var _0x35bee2={};_0x35bee2[_0xff849a[_0x8620('0x32')]]={'$like':'%'+_0x597a18[_0x8620('0x3c')]['filter']+'%'};return _0x35bee2;}})});}_0x2cc394=_[_0x8620('0x47')]({},_0x2cc394,_0x597a18[_0x8620('0x48')]);var _0x473dc1={'where':_0x2cc394['where']};return db[_0x8620('0x36')][_0x8620('0x2d')](_0x473dc1)[_0x8620('0x1c')](function(_0x375b96){_0x40b0f7['count']=_0x375b96;if(_0x597a18[_0x8620('0x3c')]['includeAll']){_0x2cc394[_0x8620('0x49')]=[{'all':!![]}];}return db[_0x8620('0x36')]['findAll'](_0x2cc394);})[_0x8620('0x1c')](function(_0x1091fe){_0x40b0f7[_0x8620('0x4a')]=_0x1091fe;return _0x40b0f7;})[_0x8620('0x1c')](respondWithFilteredResult(_0x454f34,_0x2cc394))[_0x8620('0x26')](handleError(_0x454f34,null));};exports[_0x8620('0x4b')]=function(_0x3a3358,_0x5b9fff){var _0x2d8ea9={'raw':!![],'where':{'id':_0x3a3358[_0x8620('0x4c')]['id']}},_0x4d5861={};_0x4d5861[_0x8620('0x3b')]=_['keys'](db['Network'][_0x8620('0x37')]);_0x4d5861[_0x8620('0x3c')]=_[_0x8620('0x4d')](_0x3a3358[_0x8620('0x3c')]);_0x4d5861[_0x8620('0x3d')]=_[_0x8620('0x3f')](_0x4d5861[_0x8620('0x3b')],_0x4d5861['query']);_0x2d8ea9[_0x8620('0x3e')]=_[_0x8620('0x3f')](_0x4d5861[_0x8620('0x3b')],qs[_0x8620('0x40')](_0x3a3358['query'][_0x8620('0x40')]));_0x2d8ea9[_0x8620('0x3e')]=_0x2d8ea9[_0x8620('0x3e')]['length']?_0x2d8ea9[_0x8620('0x3e')]:_0x4d5861['model'];if(_0x3a3358['query'][_0x8620('0x4e')]){_0x2d8ea9[_0x8620('0x49')]=[{'all':!![]}];}_0x2d8ea9=_[_0x8620('0x47')]({},_0x2d8ea9,_0x3a3358[_0x8620('0x48')]);return db[_0x8620('0x36')][_0x8620('0x4f')](_0x2d8ea9)[_0x8620('0x1c')](handleEntityNotFound(_0x5b9fff,null))['then'](respondWithResult(_0x5b9fff,null))[_0x8620('0x26')](handleError(_0x5b9fff,null));};exports['create']=function(_0x4ae682,_0x194c9c,_0x3f2411){var _0x1c00da;return db[_0x8620('0x50')][_0x8620('0x51')](function(_0x25c5d7){return db[_0x8620('0x36')][_0x8620('0x52')](_0x4ae682[_0x8620('0x53')],{'raw':!![]})[_0x8620('0x1c')](function(_0x36f8eb){_0x1c00da=_0x36f8eb;return db[_0x8620('0x36')]['findAll']({'where':{'type':_0x4ae682[_0x8620('0x53')]['type']},'raw':!![]});})[_0x8620('0x1c')](function(_0x2e88e1){if(_0x1c00da['type'][_0x8620('0x54')]()==_0x8620('0x55')){var _0x314ce3=fs[_0x8620('0x56')](path['join'](config[_0x8620('0x57')],_0x8620('0x58')),_0x8620('0x59'));var _0x2ef201=ejs[_0x8620('0x5a')](_0x314ce3,{'networks':_0x2e88e1||[]});fs[_0x8620('0x5b')](_0x8620('0x5c'),_0x2ef201);return respondWithRpcPromise(_0x8620('0x5d'),_0x8620('0x52'),{'module':_0x8620('0x5e')});}else if(_0x1c00da['type']['toUpperCase']()==_0x8620('0x5f')){var _0x11648a=fs[_0x8620('0x56')](path[_0x8620('0x60')](config['root'],_0x8620('0x61')),'utf8');var _0x1da705=ejs[_0x8620('0x5a')](_0x11648a,{'networks':_0x2e88e1||[]});fs[_0x8620('0x5b')](_0x8620('0x62'),_0x1da705);return respondWithRpcPromise(_0x8620('0x5d'),_0x8620('0x52'),{'module':_0x8620('0x5e')});}else{var _0xb507cd=fs[_0x8620('0x56')](path[_0x8620('0x60')](config[_0x8620('0x57')],_0x8620('0x63')),_0x8620('0x59'));var _0x7f8dfd=ejs[_0x8620('0x5a')](_0xb507cd,{'networks':_0x2e88e1||[]});fs[_0x8620('0x5b')](util[_0x8620('0x64')]('/etc/asterisk/sip_xcally_%s.conf',_0x4ae682[_0x8620('0x53')][_0x8620('0x39')]['toLowerCase']()),_0x7f8dfd);return respondWithRpcPromise(_0x8620('0x5d'),_0x8620('0x52'),{'module':_0x8620('0x65')});}return null;})[_0x8620('0x1c')](function(){return _0x1c00da;});})[_0x8620('0x1c')](respondWithResult(_0x194c9c,0xc9))[_0x8620('0x26')](handleError(_0x194c9c,null));};exports[_0x8620('0x30')]=function(_0x5007b3,_0x516476,_0x580560){var _0x26aa8b;return db['sequelize'][_0x8620('0x51')](function(_0x2846d9){return db['Network'][_0x8620('0x4f')]({'where':{'id':_0x5007b3[_0x8620('0x4c')]['id']}})[_0x8620('0x1c')](handleEntityNotFound(_0x516476,null))['then'](saveUpdates(_0x5007b3[_0x8620('0x53')],null))['then'](function(_0x53cf47){if(_0x53cf47){_0x26aa8b=_0x53cf47;return db[_0x8620('0x36')]['findAll']({'where':{'type':_0x26aa8b[_0x8620('0x39')]},'raw':!![]});}return null;})[_0x8620('0x1c')](function(_0x2b4c72){if(_0x26aa8b[_0x8620('0x39')][_0x8620('0x54')]()==_0x8620('0x55')){var _0x535717=fs[_0x8620('0x56')](path[_0x8620('0x60')](config[_0x8620('0x57')],_0x8620('0x58')),_0x8620('0x59'));var _0x312df6=ejs[_0x8620('0x5a')](_0x535717,{'networks':_0x2b4c72||[]});fs[_0x8620('0x5b')]('/etc/asterisk/stun_xcally.conf',_0x312df6);return respondWithRpcPromise(_0x8620('0x5d'),_0x8620('0x30'),{'module':_0x8620('0x5e')});}else if(_0x26aa8b[_0x8620('0x39')][_0x8620('0x54')]()==_0x8620('0x5f')){var _0x28e533=fs[_0x8620('0x56')](path[_0x8620('0x60')](config['root'],_0x8620('0x61')),_0x8620('0x59'));var _0x1c06ce=ejs[_0x8620('0x5a')](_0x28e533,{'networks':_0x2b4c72||[]});fs[_0x8620('0x5b')](_0x8620('0x62'),_0x1c06ce);return respondWithRpcPromise(_0x8620('0x5d'),'update',{'module':_0x8620('0x5e')});}else{var _0x4bb535=fs[_0x8620('0x56')](path['join'](config[_0x8620('0x57')],_0x8620('0x63')),_0x8620('0x59'));var _0x5e0e37=ejs[_0x8620('0x5a')](_0x4bb535,{'networks':_0x2b4c72||[]});fs[_0x8620('0x5b')](util[_0x8620('0x64')](_0x8620('0x66'),_0x5007b3['body'][_0x8620('0x39')][_0x8620('0x67')]()),_0x5e0e37);return respondWithRpcPromise(_0x8620('0x5d'),_0x8620('0x30'),{'module':'chan_sip.so'});}return null;})[_0x8620('0x1c')](function(_0xc9c5a){if(_0xc9c5a){return _0x26aa8b;}return null;});})['then'](respondWithResult(_0x516476,null))[_0x8620('0x26')](handleError(_0x516476,null));};exports[_0x8620('0x68')]=function(_0x5b398d,_0x4e803b,_0x1d3d74){var _0x1f03f1;return db['Network'][_0x8620('0x4f')]({'where':{'id':_0x5b398d[_0x8620('0x4c')]['id']}})[_0x8620('0x1c')](function(_0x50081a){_0x1f03f1=_0x50081a;return _0x50081a;})['then'](handleEntityNotFound(_0x4e803b,null))[_0x8620('0x1c')](removeEntity(_0x4e803b,null))[_0x8620('0x1c')](function(){if(_0x1f03f1){return db[_0x8620('0x36')][_0x8620('0x69')]({'where':{'type':_0x1f03f1[_0x8620('0x39')]},'raw':!![]});}})[_0x8620('0x1c')](function(_0x4138bd){if(_0x1f03f1['type'][_0x8620('0x54')]()==_0x8620('0x55')){var _0x5f0644=fs[_0x8620('0x56')](path[_0x8620('0x60')](config[_0x8620('0x57')],_0x8620('0x58')),_0x8620('0x59'));var _0x24d037=ejs[_0x8620('0x5a')](_0x5f0644,{'networks':_0x4138bd||[]});fs[_0x8620('0x5b')](_0x8620('0x5c'),_0x24d037);return respondWithRpcPromise(_0x8620('0x5d'),_0x8620('0x68'),{'module':'res_stun_monitor.so'});}else if(_0x1f03f1[_0x8620('0x39')][_0x8620('0x54')]()==_0x8620('0x5f')){var _0x21bc2b=fs[_0x8620('0x56')](path[_0x8620('0x60')](config[_0x8620('0x57')],_0x8620('0x61')),_0x8620('0x59'));var _0x2dc67a=ejs['render'](_0x21bc2b,{'networks':_0x4138bd||[]});fs['writeFileSync'](_0x8620('0x62'),_0x2dc67a);return respondWithRpcPromise(_0x8620('0x5d'),_0x8620('0x68'),{'module':_0x8620('0x5e')});}else{var _0x13c095=fs[_0x8620('0x56')](path[_0x8620('0x60')](config[_0x8620('0x57')],_0x8620('0x63')),_0x8620('0x59'));var _0x1e5a97=ejs[_0x8620('0x5a')](_0x13c095,{'networks':_0x4138bd||[]});fs[_0x8620('0x5b')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x5b398d['body'][_0x8620('0x39')][_0x8620('0x67')]()),_0x1e5a97);return respondWithRpcPromise(_0x8620('0x5d'),_0x8620('0x68'),{'module':_0x8620('0x65')});}return null;})[_0x8620('0x26')](handleError(_0x4e803b,null));}; \ No newline at end of file +var _0x8363=['stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','show','params','keys','intersection','merge','find','create','sequelize','transaction','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','writeFileSync','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','body','toLowerCase','chan_sip.so','server/files/templates/network.ejs','findAll','server/files/templates/turn_multiple.ejs','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','Network,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','then','destroy'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0x8363,0x1f0));var _0x3836=function(_0x15cd91,_0x31a130){_0x15cd91=_0x15cd91-0x0;var _0x11da35=_0x8363[_0x15cd91];return _0x11da35;};'use strict';var emlformat=require(_0x3836('0x0'));var rimraf=require(_0x3836('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3836('0x2'));var rp=require(_0x3836('0x3'));var moment=require(_0x3836('0x4'));var BPromise=require(_0x3836('0x5'));var Mustache=require(_0x3836('0x6'));var util=require(_0x3836('0x7'));var path=require(_0x3836('0x8'));var sox=require(_0x3836('0x9'));var csv=require(_0x3836('0xa'));var ejs=require(_0x3836('0xb'));var fs=require('fs');var fs_extra=require(_0x3836('0xc'));var _=require(_0x3836('0xd'));var squel=require('squel');var crypto=require(_0x3836('0xe'));var jsforce=require(_0x3836('0xf'));var deskjs=require(_0x3836('0x10'));var toCsv=require(_0x3836('0xa'));var querystring=require(_0x3836('0x11'));var Papa=require('papaparse');var Redis=require(_0x3836('0x12'));var authService=require(_0x3836('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3836('0x14'));var hardwareService=require(_0x3836('0x15'));var logger=require('../../config/logger')(_0x3836('0x16'));var utils=require(_0x3836('0x17'));var config=require(_0x3836('0x18'));var licenseUtil=require(_0x3836('0x19'));var db=require(_0x3836('0x1a'))['db'];var jayson=require(_0x3836('0x1b'));var client=jayson[_0x3836('0x1c')][_0x3836('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x44edf1,_0x25a8e2,_0x45b57b,_0xf68e42){return new BPromise(function(_0x51a73f,_0x2fa30e){var _0x5c90e1=_0xf68e42||client;return _0x5c90e1[_0x3836('0x1e')](_0x44edf1,_0x45b57b)['then'](function(_0x2d5123){logger[_0x3836('0x1f')]('Network,\x20%s,\x20%s',_0x25a8e2,_0x3836('0x20'));logger[_0x3836('0x21')]('Network,\x20%s,\x20%s,\x20%s',_0x25a8e2,_0x3836('0x20'),JSON[_0x3836('0x22')](_0x2d5123));if(_0x2d5123['error']){if(_0x2d5123[_0x3836('0x23')][_0x3836('0x24')]===0x1f4){logger['error'](_0x3836('0x25'),_0x25a8e2,_0x2d5123['error'][_0x3836('0x26')]);return _0x2fa30e(_0x2d5123[_0x3836('0x23')][_0x3836('0x26')]);}logger[_0x3836('0x23')](_0x3836('0x25'),_0x25a8e2,_0x2d5123[_0x3836('0x23')][_0x3836('0x26')]);return _0x51a73f(_0x2d5123[_0x3836('0x23')][_0x3836('0x26')]);}else{logger['info'](_0x3836('0x25'),_0x25a8e2,_0x3836('0x20'));_0x51a73f(_0x2d5123['result'][_0x3836('0x26')]);}})[_0x3836('0x27')](function(_0x33ccbc){logger['error'](_0x3836('0x25'),_0x25a8e2,_0x33ccbc);_0x2fa30e(_0x33ccbc);});});}function respondWithStatusCode(_0x514782,_0x23c6bf){_0x23c6bf=_0x23c6bf||0xcc;return function(_0x35771f){if(_0x35771f){return _0x514782[_0x3836('0x28')](_0x23c6bf);}return _0x514782[_0x3836('0x29')](_0x23c6bf)[_0x3836('0x2a')]();};}function respondWithResult(_0x2e6b7e,_0x307b74){_0x307b74=_0x307b74||0xc8;return function(_0x3fb7be){if(_0x3fb7be){return _0x2e6b7e['status'](_0x307b74)[_0x3836('0x2b')](_0x3fb7be);}};}function respondWithFilteredResult(_0x2efc06,_0x472ec4){return function(_0x42507a){if(_0x42507a){var _0x9ae8b9=typeof _0x472ec4[_0x3836('0x2c')]==='undefined'&&typeof _0x472ec4[_0x3836('0x2d')]==='undefined';var _0x49d9e8=_0x42507a[_0x3836('0x2e')];var _0x38c630=_0x9ae8b9?0x0:_0x472ec4[_0x3836('0x2c')];var _0x59e23a=_0x9ae8b9?_0x42507a[_0x3836('0x2e')]:_0x472ec4[_0x3836('0x2c')]+_0x472ec4[_0x3836('0x2d')];var _0x352eb8;if(_0x59e23a>=_0x49d9e8){_0x59e23a=_0x49d9e8;_0x352eb8=0xc8;}else{_0x352eb8=0xce;}_0x2efc06['status'](_0x352eb8);return _0x2efc06[_0x3836('0x2f')]('Content-Range',_0x38c630+'-'+_0x59e23a+'/'+_0x49d9e8)[_0x3836('0x2b')](_0x42507a);}return null;};}function patchUpdates(_0x501ab1){return function(_0x5945ae){try{jsonpatch[_0x3836('0x30')](_0x5945ae,_0x501ab1,!![]);}catch(_0x4fc22a){return BPromise[_0x3836('0x31')](_0x4fc22a);}return _0x5945ae[_0x3836('0x32')]();};}function saveUpdates(_0x206d5c,_0x561395){return function(_0xe17948){if(_0xe17948){return _0xe17948[_0x3836('0x33')](_0x206d5c)[_0x3836('0x34')](function(_0x3735cf){return _0x3735cf;});}return null;};}function removeEntity(_0x163daa,_0x4b2658){return function(_0x2bc21e){if(_0x2bc21e){return _0x2bc21e[_0x3836('0x35')]()[_0x3836('0x34')](function(){_0x163daa[_0x3836('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x509d04,_0x53af4e){return function(_0x2ae12e){if(!_0x2ae12e){_0x509d04[_0x3836('0x28')](0x194);}return _0x2ae12e;};}function handleError(_0x2cd454,_0x4f0415){_0x4f0415=_0x4f0415||0x1f4;return function(_0x4e1361){logger[_0x3836('0x23')](_0x4e1361[_0x3836('0x36')]);if(_0x4e1361['name']){delete _0x4e1361[_0x3836('0x37')];}_0x2cd454[_0x3836('0x29')](_0x4f0415)[_0x3836('0x38')](_0x4e1361);};}exports[_0x3836('0x39')]=function(_0x39deec,_0x2c9958){var _0x16e92a={},_0x38c580={},_0x15bb66={'count':0x0,'rows':[]};var _0x3d5926=_[_0x3836('0x3a')](db[_0x3836('0x3b')][_0x3836('0x3c')],function(_0x2004cc){return{'name':_0x2004cc[_0x3836('0x3d')],'type':_0x2004cc[_0x3836('0x3e')][_0x3836('0x3f')]};});_0x38c580[_0x3836('0x40')]=_[_0x3836('0x3a')](_0x3d5926,_0x3836('0x37'));_0x38c580[_0x3836('0x41')]=_['keys'](_0x39deec[_0x3836('0x41')]);_0x38c580[_0x3836('0x42')]=_['intersection'](_0x38c580[_0x3836('0x40')],_0x38c580[_0x3836('0x41')]);_0x16e92a[_0x3836('0x43')]=_['intersection'](_0x38c580['model'],qs[_0x3836('0x44')](_0x39deec['query']['fields']));_0x16e92a[_0x3836('0x43')]=_0x16e92a[_0x3836('0x43')][_0x3836('0x45')]?_0x16e92a['attributes']:_0x38c580[_0x3836('0x40')];if(!_0x39deec[_0x3836('0x41')][_0x3836('0x46')](_0x3836('0x47'))){_0x16e92a[_0x3836('0x2d')]=qs[_0x3836('0x2d')](_0x39deec[_0x3836('0x41')][_0x3836('0x2d')]);_0x16e92a[_0x3836('0x2c')]=qs[_0x3836('0x2c')](_0x39deec[_0x3836('0x41')][_0x3836('0x2c')]);}_0x16e92a[_0x3836('0x48')]=qs[_0x3836('0x49')](_0x39deec[_0x3836('0x41')]['sort']);_0x16e92a[_0x3836('0x4a')]=qs[_0x3836('0x42')](_['pick'](_0x39deec[_0x3836('0x41')],_0x38c580[_0x3836('0x42')]),_0x3d5926);if(_0x39deec[_0x3836('0x41')][_0x3836('0x4b')]){_0x16e92a[_0x3836('0x4a')]=_['merge'](_0x16e92a[_0x3836('0x4a')],{'$or':_[_0x3836('0x3a')](_0x3d5926,function(_0x6d5811){if(_0x6d5811[_0x3836('0x3e')]!=='VIRTUAL'){var _0x3dde2f={};_0x3dde2f[_0x6d5811['name']]={'$like':'%'+_0x39deec[_0x3836('0x41')]['filter']+'%'};return _0x3dde2f;}})});}_0x16e92a=_['merge']({},_0x16e92a,_0x39deec[_0x3836('0x4c')]);var _0x24bc80={'where':_0x16e92a[_0x3836('0x4a')]};return db['Network']['count'](_0x24bc80)[_0x3836('0x34')](function(_0x1ef518){_0x15bb66['count']=_0x1ef518;if(_0x39deec[_0x3836('0x41')][_0x3836('0x4d')]){_0x16e92a[_0x3836('0x4e')]=[{'all':!![]}];}return db[_0x3836('0x3b')]['findAll'](_0x16e92a);})[_0x3836('0x34')](function(_0x2f257a){_0x15bb66['rows']=_0x2f257a;return _0x15bb66;})[_0x3836('0x34')](respondWithFilteredResult(_0x2c9958,_0x16e92a))[_0x3836('0x27')](handleError(_0x2c9958,null));};exports[_0x3836('0x4f')]=function(_0x5eb914,_0x4bfe68){var _0x7ee17b={'raw':!![],'where':{'id':_0x5eb914[_0x3836('0x50')]['id']}},_0x39d697={};_0x39d697[_0x3836('0x40')]=_['keys'](db[_0x3836('0x3b')][_0x3836('0x3c')]);_0x39d697[_0x3836('0x41')]=_[_0x3836('0x51')](_0x5eb914['query']);_0x39d697[_0x3836('0x42')]=_['intersection'](_0x39d697['model'],_0x39d697[_0x3836('0x41')]);_0x7ee17b['attributes']=_[_0x3836('0x52')](_0x39d697[_0x3836('0x40')],qs[_0x3836('0x44')](_0x5eb914[_0x3836('0x41')][_0x3836('0x44')]));_0x7ee17b[_0x3836('0x43')]=_0x7ee17b[_0x3836('0x43')]['length']?_0x7ee17b['attributes']:_0x39d697[_0x3836('0x40')];if(_0x5eb914[_0x3836('0x41')][_0x3836('0x4d')]){_0x7ee17b[_0x3836('0x4e')]=[{'all':!![]}];}_0x7ee17b=_[_0x3836('0x53')]({},_0x7ee17b,_0x5eb914[_0x3836('0x4c')]);return db[_0x3836('0x3b')][_0x3836('0x54')](_0x7ee17b)[_0x3836('0x34')](handleEntityNotFound(_0x4bfe68,null))[_0x3836('0x34')](respondWithResult(_0x4bfe68,null))[_0x3836('0x27')](handleError(_0x4bfe68,null));};exports[_0x3836('0x55')]=function(_0x32e562,_0x3cb6c7,_0x45f869){var _0x2fdae7;return db[_0x3836('0x56')][_0x3836('0x57')](function(_0x110045){return db[_0x3836('0x3b')][_0x3836('0x55')](_0x32e562['body'],{'raw':!![]})['then'](function(_0x593433){_0x2fdae7=_0x593433;return db[_0x3836('0x3b')]['findAll']({'where':{'type':_0x32e562['body'][_0x3836('0x3e')]},'raw':!![]});})[_0x3836('0x34')](function(_0x355035){if(_0x2fdae7['type'][_0x3836('0x58')]()==_0x3836('0x59')){var _0x1e1199=fs[_0x3836('0x5a')](path[_0x3836('0x5b')](config[_0x3836('0x5c')],_0x3836('0x5d')),_0x3836('0x5e'));var _0x52a5f6=ejs[_0x3836('0x5f')](_0x1e1199,{'networks':_0x355035||[]});fs['writeFileSync'](_0x3836('0x60'),_0x52a5f6);return respondWithRpcPromise(_0x3836('0x61'),_0x3836('0x55'),{'module':_0x3836('0x62')});}else if(_0x2fdae7['type'][_0x3836('0x58')]()==_0x3836('0x63')){var _0x5ab1bc=fs[_0x3836('0x5a')](path[_0x3836('0x5b')](config[_0x3836('0x5c')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x18315e=ejs['render'](_0x5ab1bc,{'networks':_0x355035||[]});fs[_0x3836('0x64')](_0x3836('0x65'),_0x18315e);return respondWithRpcPromise(_0x3836('0x61'),_0x3836('0x55'),{'module':_0x3836('0x62')});}else{var _0x114407=fs[_0x3836('0x5a')](path[_0x3836('0x5b')](config[_0x3836('0x5c')],'server/files/templates/network.ejs'),_0x3836('0x5e'));var _0x206fbf=ejs[_0x3836('0x5f')](_0x114407,{'networks':_0x355035||[]});fs[_0x3836('0x64')](util[_0x3836('0x66')](_0x3836('0x67'),_0x32e562[_0x3836('0x68')][_0x3836('0x3e')][_0x3836('0x69')]()),_0x206fbf);return respondWithRpcPromise(_0x3836('0x61'),'create',{'module':_0x3836('0x6a')});}return null;})[_0x3836('0x34')](function(){return _0x2fdae7;});})[_0x3836('0x34')](respondWithResult(_0x3cb6c7,0xc9))[_0x3836('0x27')](handleError(_0x3cb6c7,null));};exports[_0x3836('0x33')]=function(_0x1f23cb,_0x151f1c,_0x180402){var _0x4d0594;return db[_0x3836('0x56')][_0x3836('0x57')](function(_0x15f765){return db[_0x3836('0x3b')][_0x3836('0x54')]({'where':{'id':_0x1f23cb['params']['id']}})[_0x3836('0x34')](handleEntityNotFound(_0x151f1c,null))['then'](saveUpdates(_0x1f23cb[_0x3836('0x68')],null))[_0x3836('0x34')](function(_0xc6d84d){if(_0xc6d84d){_0x4d0594=_0xc6d84d;return db[_0x3836('0x3b')]['findAll']({'where':{'type':_0x4d0594[_0x3836('0x3e')]},'raw':!![]});}return null;})[_0x3836('0x34')](function(_0x39300d){if(_0x4d0594['type'][_0x3836('0x58')]()=='STUN'){var _0xc69119=fs[_0x3836('0x5a')](path[_0x3836('0x5b')](config[_0x3836('0x5c')],_0x3836('0x5d')),_0x3836('0x5e'));var _0x5b296f=ejs[_0x3836('0x5f')](_0xc69119,{'networks':_0x39300d||[]});fs[_0x3836('0x64')](_0x3836('0x60'),_0x5b296f);return respondWithRpcPromise(_0x3836('0x61'),'update',{'module':_0x3836('0x62')});}else if(_0x4d0594[_0x3836('0x3e')][_0x3836('0x58')]()=='TURN'){var _0x2a16b5=fs['readFileSync'](path[_0x3836('0x5b')](config[_0x3836('0x5c')],'server/files/templates/turn_multiple.ejs'),_0x3836('0x5e'));var _0x33b714=ejs[_0x3836('0x5f')](_0x2a16b5,{'networks':_0x39300d||[]});fs[_0x3836('0x64')](_0x3836('0x65'),_0x33b714);return respondWithRpcPromise(_0x3836('0x61'),'update',{'module':_0x3836('0x62')});}else{var _0x295ade=fs[_0x3836('0x5a')](path['join'](config['root'],_0x3836('0x6b')),_0x3836('0x5e'));var _0x2780ea=ejs[_0x3836('0x5f')](_0x295ade,{'networks':_0x39300d||[]});fs['writeFileSync'](util[_0x3836('0x66')](_0x3836('0x67'),_0x1f23cb['body'][_0x3836('0x3e')][_0x3836('0x69')]()),_0x2780ea);return respondWithRpcPromise(_0x3836('0x61'),_0x3836('0x33'),{'module':_0x3836('0x6a')});}return null;})[_0x3836('0x34')](function(_0x38b4c6){if(_0x38b4c6){return _0x4d0594;}return null;});})[_0x3836('0x34')](respondWithResult(_0x151f1c,null))[_0x3836('0x27')](handleError(_0x151f1c,null));};exports[_0x3836('0x35')]=function(_0x23d382,_0x3ce065,_0x50fdab){var _0x375765;return db['Network'][_0x3836('0x54')]({'where':{'id':_0x23d382['params']['id']}})[_0x3836('0x34')](function(_0x121523){_0x375765=_0x121523;return _0x121523;})['then'](handleEntityNotFound(_0x3ce065,null))[_0x3836('0x34')](removeEntity(_0x3ce065,null))[_0x3836('0x34')](function(){if(_0x375765){return db[_0x3836('0x3b')][_0x3836('0x6c')]({'where':{'type':_0x375765['type']},'raw':!![]});}})[_0x3836('0x34')](function(_0x4bcdd4){if(_0x375765[_0x3836('0x3e')][_0x3836('0x58')]()==_0x3836('0x59')){var _0x50e948=fs[_0x3836('0x5a')](path[_0x3836('0x5b')](config[_0x3836('0x5c')],_0x3836('0x5d')),_0x3836('0x5e'));var _0x5f3cd9=ejs[_0x3836('0x5f')](_0x50e948,{'networks':_0x4bcdd4||[]});fs[_0x3836('0x64')]('/etc/asterisk/stun_xcally.conf',_0x5f3cd9);return respondWithRpcPromise(_0x3836('0x61'),_0x3836('0x35'),{'module':'res_stun_monitor.so'});}else if(_0x375765['type']['toUpperCase']()==_0x3836('0x63')){var _0x500270=fs[_0x3836('0x5a')](path['join'](config[_0x3836('0x5c')],_0x3836('0x6d')),_0x3836('0x5e'));var _0x72a9d4=ejs['render'](_0x500270,{'networks':_0x4bcdd4||[]});fs[_0x3836('0x64')](_0x3836('0x65'),_0x72a9d4);return respondWithRpcPromise(_0x3836('0x61'),_0x3836('0x35'),{'module':_0x3836('0x62')});}else{var _0x233228=fs[_0x3836('0x5a')](path[_0x3836('0x5b')](config[_0x3836('0x5c')],_0x3836('0x6b')),_0x3836('0x5e'));var _0x1ef52d=ejs[_0x3836('0x5f')](_0x233228,{'networks':_0x4bcdd4||[]});fs[_0x3836('0x64')](util[_0x3836('0x66')]('/etc/asterisk/sip_xcally_%s.conf',_0x23d382[_0x3836('0x68')][_0x3836('0x3e')]['toLowerCase']()),_0x1ef52d);return respondWithRpcPromise(_0x3836('0x61'),'destroy',{'module':_0x3836('0x6a')});}return null;})['catch'](handleError(_0x3ce065,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index bb61154..98f437f 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 _0x049e=['Network','network','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x4871ae,_0x37f505){var _0xdda31f=function(_0x84a296){while(--_0x84a296){_0x4871ae['push'](_0x4871ae['shift']());}};_0xdda31f(++_0x37f505);}(_0x049e,0x16a));var _0xe049=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x049e[_0x2eb5bc];return _0x51c7b1;};'use strict';var _=require(_0xe049('0x0'));var util=require(_0xe049('0x1'));var logger=require('../../config/logger')(_0xe049('0x2'));var moment=require('moment');var BPromise=require(_0xe049('0x3'));var rp=require(_0xe049('0x4'));var fs=require('fs');var path=require(_0xe049('0x5'));var rimraf=require(_0xe049('0x6'));var config=require(_0xe049('0x7'));var attributes=require('./network.attributes');module[_0xe049('0x8')]=function(_0x196af2,_0x22e8f5){return _0x196af2[_0xe049('0x9')](_0xe049('0xa'),attributes,{'tableName':_0xe049('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x702d=['exports','define','Network','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3d08d3,_0x4dd21a){var _0x5eeba1=function(_0x392ec8){while(--_0x392ec8){_0x3d08d3['push'](_0x3d08d3['shift']());}};_0x5eeba1(++_0x4dd21a);}(_0x702d,0x147));var _0xd702=function(_0x30e3f9,_0x14244e){_0x30e3f9=_0x30e3f9-0x0;var _0x59bf90=_0x702d[_0x30e3f9];return _0x59bf90;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./network.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'network','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 5f7fe24..260d9b5 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x24462a,_0x59592d){var _0x513bc8=function(_0x25ee5a){while(--_0x25ee5a){_0x24462a['push'](_0x24462a['shift']());}};_0x513bc8(++_0x59592d);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x50c9a7,_0xd707ff){var _0x30cc5d=function(_0x511d45){while(--_0x511d45){_0x50c9a7['push'](_0x50c9a7['shift']());}};_0x30cc5d(++_0xd707ff);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var 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 60f625d..ff6ae5c 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 _0xdd3c=['/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getAgents','post','create','/:id/dispositions','addDisposition','/:id/notify','/:id/applications','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','getDispositions'];(function(_0x58bec1,_0x42c53f){var _0x16439f=function(_0x19b7ec){while(--_0x19b7ec){_0x58bec1['push'](_0x58bec1['shift']());}};_0x16439f(++_0x42c53f);}(_0xdd3c,0x1de));var _0xcdd3=function(_0xc5cabc,_0x446fe3){_0xc5cabc=_0xc5cabc-0x0;var _0x3cd09c=_0xdd3c[_0xc5cabc];return _0x3cd09c;};'use strict';var multer=require(_0xcdd3('0x0'));var util=require(_0xcdd3('0x1'));var path=require('path');var timeout=require(_0xcdd3('0x2'));var express=require(_0xcdd3('0x3'));var router=express[_0xcdd3('0x4')]();var fs_extra=require(_0xcdd3('0x5'));var auth=require(_0xcdd3('0x6'));var interaction=require(_0xcdd3('0x7'));var config=require('../../config/environment');var controller=require(_0xcdd3('0x8'));router[_0xcdd3('0x9')]('/',auth[_0xcdd3('0xa')](),controller[_0xcdd3('0xb')]);router[_0xcdd3('0x9')](_0xcdd3('0xc'),auth[_0xcdd3('0xa')](),controller[_0xcdd3('0xd')]);router[_0xcdd3('0x9')](_0xcdd3('0xe'),auth[_0xcdd3('0xa')](),controller['show']);router[_0xcdd3('0x9')]('/:id/dispositions',auth[_0xcdd3('0xa')](),controller[_0xcdd3('0xf')]);router[_0xcdd3('0x9')](_0xcdd3('0x10'),auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x11')]);router[_0xcdd3('0x9')]('/:id/applications',auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x12')]);router[_0xcdd3('0x9')](_0xcdd3('0x13'),auth[_0xcdd3('0xa')](),controller['getInteractions']);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xcdd3('0x14')]);router[_0xcdd3('0x15')]('/',auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x16')]);router[_0xcdd3('0x15')](_0xcdd3('0x17'),auth['isAuthenticated'](),controller[_0xcdd3('0x18')]);router[_0xcdd3('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0xcdd3('0x15')](_0xcdd3('0x19'),controller['notify']);router[_0xcdd3('0x15')](_0xcdd3('0x1a'),auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x1b')]);router['post']('/:id/users',auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x1c')]);router['post'](_0xcdd3('0x1d'),auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x1e')]);router[_0xcdd3('0x1f')](_0xcdd3('0xe'),auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x20')]);router[_0xcdd3('0x21')](_0xcdd3('0xe'),auth['isAuthenticated'](),controller[_0xcdd3('0x22')]);router[_0xcdd3('0x21')]('/:id/dispositions',auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x23')]);router[_0xcdd3('0x21')](_0xcdd3('0x10'),auth[_0xcdd3('0xa')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0xcdd3('0xa')](),controller[_0xcdd3('0x24')]);module[_0xcdd3('0x25')]=router; \ No newline at end of file +var _0xf3e4=['get','isAuthenticated','index','/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send','put','/:id','delete','removeDispositions','removeAgents','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4d41dd,_0x306efd){var _0x30eb2b=function(_0x338f1c){while(--_0x338f1c){_0x4d41dd['push'](_0x4d41dd['shift']());}};_0x30eb2b(++_0x306efd);}(_0xf3e4,0xef));var _0x4f3e=function(_0x1f0592,_0x1c7c98){_0x1f0592=_0x1f0592-0x0;var _0x26dfff=_0xf3e4[_0x1f0592];return _0x26dfff;};'use strict';var multer=require('multer');var util=require(_0x4f3e('0x0'));var path=require(_0x4f3e('0x1'));var timeout=require(_0x4f3e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4f3e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4f3e('0x4'));var config=require(_0x4f3e('0x5'));var controller=require('./openchannelAccount.controller');router[_0x4f3e('0x6')]('/',auth[_0x4f3e('0x7')](),controller[_0x4f3e('0x8')]);router[_0x4f3e('0x6')](_0x4f3e('0x9'),auth['isAuthenticated'](),controller[_0x4f3e('0xa')]);router[_0x4f3e('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x4f3e('0xb')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4f3e('0xc')]);router[_0x4f3e('0x6')](_0x4f3e('0xd'),auth[_0x4f3e('0x7')](),controller[_0x4f3e('0xe')]);router['get'](_0x4f3e('0xf'),auth[_0x4f3e('0x7')](),controller['getApplications']);router[_0x4f3e('0x6')](_0x4f3e('0x10'),auth[_0x4f3e('0x7')](),controller[_0x4f3e('0x11')]);router[_0x4f3e('0x6')](_0x4f3e('0x12'),auth['isAuthenticated'](),controller[_0x4f3e('0x13')]);router[_0x4f3e('0x14')]('/',auth['isAuthenticated'](),controller[_0x4f3e('0x15')]);router['post'](_0x4f3e('0x16'),auth[_0x4f3e('0x7')](),controller[_0x4f3e('0x17')]);router[_0x4f3e('0x14')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4f3e('0x18')]);router[_0x4f3e('0x14')]('/:id/notify',controller[_0x4f3e('0x19')]);router['post'](_0x4f3e('0xf'),auth[_0x4f3e('0x7')](),controller[_0x4f3e('0x1a')]);router[_0x4f3e('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0x4f3e('0x1b')]);router[_0x4f3e('0x14')](_0x4f3e('0x1c'),auth[_0x4f3e('0x7')](),controller['send']);router[_0x4f3e('0x1d')](_0x4f3e('0x1e'),auth[_0x4f3e('0x7')](),controller['update']);router[_0x4f3e('0x1f')](_0x4f3e('0x1e'),auth[_0x4f3e('0x7')](),controller['destroy']);router[_0x4f3e('0x1f')](_0x4f3e('0x16'),auth['isAuthenticated'](),controller[_0x4f3e('0x20')]);router[_0x4f3e('0x1f')]('/:id/canned_answers',auth[_0x4f3e('0x7')](),controller['removeAnswers']);router['delete'](_0x4f3e('0x12'),auth[_0x4f3e('0x7')](),controller[_0x4f3e('0x21')]);module[_0x4f3e('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index e2a6d17..63f7430 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 _0x0c9f=['generate','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','sequelize','name','STRING'];(function(_0x3994eb,_0x1fb318){var _0x534f74=function(_0x55ba6c){while(--_0x55ba6c){_0x3994eb['push'](_0x3994eb['shift']());}};_0x534f74(++_0x1fb318);}(_0x0c9f,0x75));var _0xf0c9=function(_0x28c411,_0x14716b){_0x28c411=_0x28c411-0x0;var _0x4cf8be=_0x0c9f[_0x28c411];return _0x4cf8be;};'use strict';var Sequelize=require(_0xf0c9('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xf0c9('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xf0c9('0x2')]},'token':{'type':Sequelize[_0xf0c9('0x2')],'defaultValue':function(){return rs[_0xf0c9('0x3')]();}},'replyUri':{'type':Sequelize[_0xf0c9('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'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[_0xf0c9('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf0c9('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf0c9('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf0c9('0x2')]},'queueTransfer':{'type':Sequelize[_0xf0c9('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf0c9('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf0c9('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf0c9('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xf0c9('0x6')},'mandatoryDisposition':{'type':Sequelize[_0xf0c9('0x4')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2996e9){if(!_0x2996e9)this[_0xf0c9('0x7')]('mandatoryDispositionPauseId',null);this[_0xf0c9('0x7')]('mandatoryDisposition',_0x2996e9);}}}; \ No newline at end of file +var _0x35f0=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x35f0,0x163));var _0x035f=function(_0x271298,_0x1efee7){_0x271298=_0x271298-0x0;var _0x436e22=_0x35f0[_0x271298];return _0x436e22;};'use strict';var Sequelize=require(_0x035f('0x0'));var rs=require(_0x035f('0x1'));module[_0x035f('0x2')]={'name':{'type':Sequelize[_0x035f('0x3')],'unique':_0x035f('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x035f('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x035f('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x035f('0x5')],'defaultValue':function(){return _0x035f('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x035f('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x035f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x035f('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x035f('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x035f('0x7')],'defaultValue':![],'comment':_0x035f('0xa'),'set':function(_0x477372){if(!_0x477372)this[_0x035f('0xb')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x035f('0xc'),_0x477372);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 9be27dc..e3b77ee 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 _0x62b3=['localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','params','keys','fields','includeAll','find','create','body','user','get','role','OpenchannelAccounts','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','getDispositions','findOne','Disposition','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','ValidationError','difference','createdAt','updatedAt','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','Contacts','DESC','Applications','account','applications','list','orderBy','priority','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','messageId','interaction','created','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','spread','emit','isArray','userOpenchannelAccount:remove','getAgents','send','CmList','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis'];(function(_0x295551,_0x163f59){var _0x2c10b4=function(_0x2c65b7){while(--_0x2c65b7){_0x295551['push'](_0x295551['shift']());}};_0x2c10b4(++_0x163f59);}(_0x62b3,0x15b));var _0x362b=function(_0x2190c3,_0x8bd37e){_0x2190c3=_0x2190c3-0x0;var _0x38aae3=_0x62b3[_0x2190c3];return _0x38aae3;};'use strict';var emlformat=require(_0x362b('0x0'));var rimraf=require(_0x362b('0x1'));var zipdir=require(_0x362b('0x2'));var jsonpatch=require(_0x362b('0x3'));var rp=require(_0x362b('0x4'));var moment=require(_0x362b('0x5'));var BPromise=require(_0x362b('0x6'));var Mustache=require(_0x362b('0x7'));var util=require(_0x362b('0x8'));var path=require(_0x362b('0x9'));var sox=require('sox');var csv=require(_0x362b('0xa'));var ejs=require(_0x362b('0xb'));var fs=require('fs');var fs_extra=require(_0x362b('0xc'));var _=require(_0x362b('0xd'));var squel=require(_0x362b('0xe'));var crypto=require(_0x362b('0xf'));var jsforce=require(_0x362b('0x10'));var deskjs=require(_0x362b('0x11'));var toCsv=require('to-csv');var querystring=require(_0x362b('0x12'));var Papa=require(_0x362b('0x13'));var Redis=require(_0x362b('0x14'));var authService=require(_0x362b('0x15'));var qs=require(_0x362b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x362b('0x17'));var config=require(_0x362b('0x18'));var licenseUtil=require(_0x362b('0x19'));var db=require(_0x362b('0x1a'))['db'];config['redis']=_[_0x362b('0x1b')](config[_0x362b('0x1c')],{'host':_0x362b('0x1d'),'port':0x18eb});var socket=require(_0x362b('0x1e'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x362b('0x1f')](socket);var jayson=require(_0x362b('0x20'));var client=jayson[_0x362b('0x21')][_0x362b('0x22')]({'port':0x232c});var client9002=jayson[_0x362b('0x21')][_0x362b('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x5f44cb,_0x10e407,_0x4f92bc,_0x50fff5){return new BPromise(function(_0x3c154b,_0x27a4ac){var _0x183569=_0x50fff5||client;return _0x183569[_0x362b('0x23')](_0x5f44cb,_0x4f92bc)['then'](function(_0x51205d){logger[_0x362b('0x24')](_0x362b('0x25'),_0x10e407,_0x362b('0x26'));logger[_0x362b('0x27')](_0x362b('0x28'),_0x10e407,_0x362b('0x26'),JSON[_0x362b('0x29')](_0x51205d));if(_0x51205d['error']){if(_0x51205d['error'][_0x362b('0x2a')]===0x1f4){logger[_0x362b('0x2b')](_0x362b('0x25'),_0x10e407,_0x51205d['error'][_0x362b('0x2c')]);return _0x27a4ac(_0x51205d['error'][_0x362b('0x2c')]);}logger['error'](_0x362b('0x25'),_0x10e407,_0x51205d[_0x362b('0x2b')][_0x362b('0x2c')]);return _0x3c154b(_0x51205d['error'][_0x362b('0x2c')]);}else{logger[_0x362b('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x10e407,_0x362b('0x26'));_0x3c154b(_0x51205d[_0x362b('0x2d')]['message']);}})[_0x362b('0x2e')](function(_0x14b5dd){logger[_0x362b('0x2b')](_0x362b('0x25'),_0x10e407,_0x14b5dd);_0x27a4ac(_0x14b5dd);});});}function respondWithStatusCode(_0x5944d8,_0x3021da){_0x3021da=_0x3021da||0xcc;return function(_0x51ca00){if(_0x51ca00){return _0x5944d8[_0x362b('0x2f')](_0x3021da);}return _0x5944d8[_0x362b('0x30')](_0x3021da)['end']();};}function respondWithResult(_0x399e2e,_0x5adc4f){_0x5adc4f=_0x5adc4f||0xc8;return function(_0x4e1aab){if(_0x4e1aab){return _0x399e2e[_0x362b('0x30')](_0x5adc4f)['json'](_0x4e1aab);}};}function respondWithFilteredResult(_0x274719,_0x453405){return function(_0x49c1b1){if(_0x49c1b1){var _0x45c5f6=typeof _0x453405[_0x362b('0x31')]===_0x362b('0x32')&&typeof _0x453405[_0x362b('0x33')]===_0x362b('0x32');var _0x2a5a81=_0x49c1b1[_0x362b('0x34')];var _0x546c30=_0x45c5f6?0x0:_0x453405['offset'];var _0x23ce96=_0x45c5f6?_0x49c1b1[_0x362b('0x34')]:_0x453405['offset']+_0x453405['limit'];var _0x4e329a;if(_0x23ce96>=_0x2a5a81){_0x23ce96=_0x2a5a81;_0x4e329a=0xc8;}else{_0x4e329a=0xce;}_0x274719[_0x362b('0x30')](_0x4e329a);return _0x274719[_0x362b('0x35')]('Content-Range',_0x546c30+'-'+_0x23ce96+'/'+_0x2a5a81)['json'](_0x49c1b1);}return null;};}function patchUpdates(_0xb787ae){return function(_0x2ef340){try{jsonpatch[_0x362b('0x36')](_0x2ef340,_0xb787ae,!![]);}catch(_0x45a107){return BPromise[_0x362b('0x37')](_0x45a107);}return _0x2ef340[_0x362b('0x38')]();};}function saveUpdates(_0x318181,_0x10ca43){return function(_0x34c9f6){if(_0x34c9f6){return _0x34c9f6[_0x362b('0x39')](_0x318181)['then'](function(_0x498a7c){return _0x498a7c;});}return null;};}function removeEntity(_0x5e0b08,_0x870cfd){return function(_0x50f2ef){if(_0x50f2ef){return _0x50f2ef['destroy']()[_0x362b('0x3a')](function(){var _0x2e6976=_0x50f2ef['get']({'plain':!![]});var _0x5ef31d='OpenchannelAccounts';return db['UserProfileResource'][_0x362b('0x3b')]({'where':{'type':_0x5ef31d,'resourceId':_0x2e6976['id']}})[_0x362b('0x3a')](function(){return _0x50f2ef;});})['then'](function(){_0x5e0b08[_0x362b('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3195ea,_0x4fcbbd){return function(_0x251ba3){if(!_0x251ba3){_0x3195ea[_0x362b('0x2f')](0x194);}return _0x251ba3;};}function handleError(_0x5bef4a,_0x3b18f7){_0x3b18f7=_0x3b18f7||0x1f4;return function(_0xd7ef73){logger[_0x362b('0x2b')](_0xd7ef73[_0x362b('0x3c')]);if(_0xd7ef73[_0x362b('0x3d')]){delete _0xd7ef73[_0x362b('0x3d')];}_0x5bef4a[_0x362b('0x30')](_0x3b18f7)['send'](_0xd7ef73);};}exports[_0x362b('0x3e')]=function(_0x54eb35,_0xfe2e43){var _0x8f5d67={'include':[{'model':db[_0x362b('0x3f')],'as':_0x362b('0x40')}]},_0xbf6ac2={},_0x18a09e={'count':0x0,'rows':[]};var _0x56715a=_['map'](db[_0x362b('0x41')][_0x362b('0x42')],function(_0x42e201){return{'name':_0x42e201['fieldName'],'type':_0x42e201[_0x362b('0x43')]['key']};});_0xbf6ac2[_0x362b('0x44')]=_[_0x362b('0x45')](_0x56715a,_0x362b('0x3d'));_0xbf6ac2[_0x362b('0x46')]=_['keys'](_0x54eb35[_0x362b('0x46')]);_0xbf6ac2[_0x362b('0x47')]=_[_0x362b('0x48')](_0xbf6ac2[_0x362b('0x44')],_0xbf6ac2[_0x362b('0x46')]);_0x8f5d67[_0x362b('0x49')]=_[_0x362b('0x48')](_0xbf6ac2['model'],qs['fields'](_0x54eb35['query']['fields']));_0x8f5d67['attributes']=_0x8f5d67[_0x362b('0x49')][_0x362b('0x4a')]?_0x8f5d67[_0x362b('0x49')]:_0xbf6ac2[_0x362b('0x44')];if(!_0x54eb35[_0x362b('0x46')][_0x362b('0x4b')](_0x362b('0x4c'))){_0x8f5d67['limit']=qs[_0x362b('0x33')](_0x54eb35[_0x362b('0x46')]['limit']);_0x8f5d67[_0x362b('0x31')]=qs[_0x362b('0x31')](_0x54eb35[_0x362b('0x46')][_0x362b('0x31')]);}_0x8f5d67['order']=qs['sort'](_0x54eb35[_0x362b('0x46')][_0x362b('0x4d')]);_0x8f5d67[_0x362b('0x4e')]=qs[_0x362b('0x47')](_[_0x362b('0x4f')](_0x54eb35[_0x362b('0x46')],_0xbf6ac2[_0x362b('0x47')]),_0x56715a);if(_0x54eb35['query'][_0x362b('0x50')]){_0x8f5d67[_0x362b('0x4e')]=_['merge'](_0x8f5d67['where'],{'$or':_[_0x362b('0x45')](_0x56715a,function(_0x2e859c){if(_0x2e859c[_0x362b('0x43')]!==_0x362b('0x51')){var _0x179bc2={};_0x179bc2[_0x2e859c[_0x362b('0x3d')]]={'$like':'%'+_0x54eb35['query'][_0x362b('0x50')]+'%'};return _0x179bc2;}})});}_0x8f5d67=_[_0x362b('0x52')]({},_0x8f5d67,_0x54eb35[_0x362b('0x53')]);var _0x7b5745={'where':_0x8f5d67[_0x362b('0x4e')]};return db[_0x362b('0x41')][_0x362b('0x34')](_0x7b5745)['then'](function(_0x4695de){_0x18a09e[_0x362b('0x34')]=_0x4695de;if(_0x54eb35[_0x362b('0x46')]['includeAll']){_0x8f5d67[_0x362b('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x362b('0x55')](_0x8f5d67);})['then'](function(_0x5e735b){_0x18a09e[_0x362b('0x56')]=_0x5e735b;return _0x18a09e;})['then'](respondWithFilteredResult(_0xfe2e43,_0x8f5d67))[_0x362b('0x2e')](handleError(_0xfe2e43,null));};exports['show']=function(_0xeb703d,_0x2f3a1a){var _0x375d08={'raw':![],'where':{'id':_0xeb703d[_0x362b('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x362b('0x40')}]},_0x58e68b={};_0x58e68b[_0x362b('0x44')]=_[_0x362b('0x58')](db['OpenchannelAccount']['rawAttributes']);_0x58e68b['query']=_[_0x362b('0x58')](_0xeb703d[_0x362b('0x46')]);_0x58e68b['filters']=_[_0x362b('0x48')](_0x58e68b[_0x362b('0x44')],_0x58e68b[_0x362b('0x46')]);_0x375d08['attributes']=_['intersection'](_0x58e68b[_0x362b('0x44')],qs[_0x362b('0x59')](_0xeb703d[_0x362b('0x46')][_0x362b('0x59')]));_0x375d08[_0x362b('0x49')]=_0x375d08[_0x362b('0x49')]['length']?_0x375d08[_0x362b('0x49')]:_0x58e68b[_0x362b('0x44')];if(_0xeb703d[_0x362b('0x46')][_0x362b('0x5a')]){_0x375d08['include']=[{'all':!![]}];}_0x375d08=_[_0x362b('0x52')]({},_0x375d08,_0xeb703d[_0x362b('0x53')]);return db[_0x362b('0x41')][_0x362b('0x5b')](_0x375d08)[_0x362b('0x3a')](handleEntityNotFound(_0x2f3a1a,null))[_0x362b('0x3a')](respondWithResult(_0x2f3a1a,null))['catch'](handleError(_0x2f3a1a,null));};exports[_0x362b('0x5c')]=function(_0xbfd0d,_0x23ce09){return db['OpenchannelAccount'][_0x362b('0x5c')](_0xbfd0d[_0x362b('0x5d')],{})[_0x362b('0x3a')](function(_0x344281){var _0x36d6f2=_0xbfd0d[_0x362b('0x5e')][_0x362b('0x5f')]({'plain':!![]});if(!_0x36d6f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36d6f2[_0x362b('0x60')]===_0x362b('0x5e')){var _0x245fe7=_0x344281[_0x362b('0x5f')]({'plain':!![]});var _0x1fa92d=_0x362b('0x61');return db['UserProfileSection']['find']({'where':{'name':_0x1fa92d,'userProfileId':_0x36d6f2['userProfileId']},'raw':!![]})['then'](function(_0xcb339c){if(_0xcb339c&&_0xcb339c[_0x362b('0x62')]===0x0){return db[_0x362b('0x63')]['create']({'name':_0x245fe7[_0x362b('0x3d')],'resourceId':_0x245fe7['id'],'type':_0xcb339c[_0x362b('0x3d')],'sectionId':_0xcb339c['id']},{})[_0x362b('0x3a')](function(){return _0x344281;});}else{return _0x344281;}})['catch'](function(_0x4e39e6){logger[_0x362b('0x2b')](_0x362b('0x64'),_0x4e39e6);throw _0x4e39e6;});}return _0x344281;})[_0x362b('0x3a')](respondWithResult(_0x23ce09,0xc9))[_0x362b('0x2e')](handleError(_0x23ce09,null));};exports[_0x362b('0x39')]=function(_0x215861,_0x59ad45){if(_0x215861[_0x362b('0x5d')]['id']){delete _0x215861[_0x362b('0x5d')]['id'];}return db[_0x362b('0x41')][_0x362b('0x5b')]({'where':{'id':_0x215861[_0x362b('0x57')]['id']},'include':[{'model':db[_0x362b('0x3f')],'as':'mandatoryDispositionPause'}]})[_0x362b('0x3a')](handleEntityNotFound(_0x59ad45,null))[_0x362b('0x3a')](saveUpdates(_0x215861[_0x362b('0x5d')],null))[_0x362b('0x3a')](respondWithResult(_0x59ad45,null))[_0x362b('0x2e')](handleError(_0x59ad45,null));};exports[_0x362b('0x3b')]=function(_0x11378b,_0x57fc46){return db['OpenchannelAccount'][_0x362b('0x5b')]({'where':{'id':_0x11378b[_0x362b('0x57')]['id']}})['then'](handleEntityNotFound(_0x57fc46,null))['then'](removeEntity(_0x57fc46,null))['catch'](handleError(_0x57fc46,null));};exports['describe']=function(_0x37a8b9,_0x2ede61){return db[_0x362b('0x41')][_0x362b('0x65')]()['then'](respondWithResult(_0x2ede61,null))[_0x362b('0x2e')](handleError(_0x2ede61,null));};exports['addDisposition']=function(_0x490c95,_0x4ba06e,_0x478100){if(_0x490c95[_0x362b('0x5d')]['id']){delete _0x490c95['body']['id'];}return db[_0x362b('0x41')]['find']({'where':{'id':_0x490c95['params']['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x4ba06e,null))[_0x362b('0x3a')](function(_0x57dffe){if(_0x57dffe){_0x490c95[_0x362b('0x5d')][_0x362b('0x66')]=_0x57dffe['id'];return db['Disposition']['create'](_0x490c95[_0x362b('0x5d')]);}})[_0x362b('0x3a')](respondWithResult(_0x4ba06e,null))[_0x362b('0x2e')](handleError(_0x4ba06e,null));};exports[_0x362b('0x67')]=function(_0x743201,_0x348372,_0x37297f){var _0x250a4e={'raw':![],'where':{}};var _0x1a1792={};var _0x19c2f0={'count':0x0,'rows':[]};return db[_0x362b('0x41')][_0x362b('0x68')]({'where':{'id':_0x743201[_0x362b('0x57')]['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x348372,null))[_0x362b('0x3a')](function(_0x16b487){if(_0x16b487){_0x1a1792['model']=_['keys'](db[_0x362b('0x69')][_0x362b('0x42')]);_0x1a1792[_0x362b('0x46')]=_[_0x362b('0x58')](_0x743201[_0x362b('0x46')]);_0x1a1792[_0x362b('0x47')]=_[_0x362b('0x48')](_0x1a1792['model'],_0x1a1792[_0x362b('0x46')]);_0x250a4e['attributes']=_[_0x362b('0x48')](_0x1a1792[_0x362b('0x44')],qs[_0x362b('0x59')](_0x743201[_0x362b('0x46')][_0x362b('0x59')]));_0x250a4e['attributes']=_0x250a4e[_0x362b('0x49')][_0x362b('0x4a')]?_0x250a4e[_0x362b('0x49')]:_0x1a1792[_0x362b('0x44')];if(!_0x743201[_0x362b('0x46')][_0x362b('0x4b')](_0x362b('0x4c'))){_0x250a4e['limit']=qs[_0x362b('0x33')](_0x743201[_0x362b('0x46')]['limit']);_0x250a4e[_0x362b('0x31')]=qs[_0x362b('0x31')](_0x743201['query'][_0x362b('0x31')]);}_0x250a4e[_0x362b('0x6a')]=qs['sort'](_0x743201['query']['sort']);_0x250a4e[_0x362b('0x4e')]=qs[_0x362b('0x47')](_[_0x362b('0x4f')](_0x743201[_0x362b('0x46')],_0x1a1792[_0x362b('0x47')]));_0x250a4e['where']['OpenchannelAccountId']=_0x16b487['id'];if(_0x743201[_0x362b('0x46')][_0x362b('0x50')]){_0x250a4e['where']=_['merge'](_0x250a4e[_0x362b('0x4e')],{'$or':_[_0x362b('0x45')](_0x250a4e[_0x362b('0x49')],function(_0x1ac01c){var _0x1c0064={};_0x1c0064[_0x1ac01c]={'$like':'%'+_0x743201['query'][_0x362b('0x50')]+'%'};return _0x1c0064;})});}_0x250a4e=_[_0x362b('0x52')]({},_0x250a4e,_0x743201[_0x362b('0x53')]);return db['Disposition'][_0x362b('0x34')]({'where':_0x250a4e[_0x362b('0x4e')]})[_0x362b('0x3a')](function(_0x213fe5){_0x19c2f0[_0x362b('0x34')]=_0x213fe5;if(_0x743201['query'][_0x362b('0x5a')]){_0x250a4e['include']=[{'all':!![]}];}return db['Disposition'][_0x362b('0x55')](_0x250a4e);})['then'](function(_0x48b2d4){_0x19c2f0[_0x362b('0x56')]=_0x48b2d4;return _0x19c2f0;});}})[_0x362b('0x3a')](respondWithFilteredResult(_0x348372,_0x250a4e))['catch'](handleError(_0x348372,null));};exports[_0x362b('0x6b')]=function(_0x2172c4,_0x31fbae,_0x298934){return db[_0x362b('0x41')][_0x362b('0x5b')]({'where':{'id':_0x2172c4[_0x362b('0x57')]['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x31fbae,null))[_0x362b('0x3a')](function(_0x47460b){if(_0x47460b){return _0x47460b[_0x362b('0x6b')](_0x2172c4['query'][_0x362b('0x6c')]);}})[_0x362b('0x3a')](respondWithStatusCode(_0x31fbae,null))['catch'](handleError(_0x31fbae,null));};exports[_0x362b('0x6d')]=function(_0x2c607e,_0xc3868e,_0x257d10){if(_0x2c607e['body']['id']){delete _0x2c607e[_0x362b('0x5d')]['id'];}return db[_0x362b('0x41')][_0x362b('0x5b')]({'where':{'id':_0x2c607e[_0x362b('0x57')]['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0xc3868e,null))[_0x362b('0x3a')](function(_0x4e23d1){if(_0x4e23d1){_0x2c607e['body'][_0x362b('0x66')]=_0x4e23d1['id'];return db[_0x362b('0x6e')][_0x362b('0x5c')](_0x2c607e[_0x362b('0x5d')]);}})['then'](respondWithResult(_0xc3868e,null))[_0x362b('0x2e')](handleError(_0xc3868e,null));};exports[_0x362b('0x6f')]=function(_0x2bf8d3,_0x8f72a9,_0x4fc390){var _0x30c441={'raw':![],'where':{}};var _0x11b4da={};var _0x171c92={'count':0x0,'rows':[]};return db[_0x362b('0x41')][_0x362b('0x68')]({'where':{'id':_0x2bf8d3[_0x362b('0x57')]['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x8f72a9,null))[_0x362b('0x3a')](function(_0x5ab696){if(_0x5ab696){_0x11b4da['model']=_[_0x362b('0x58')](db[_0x362b('0x6e')][_0x362b('0x42')]);_0x11b4da['query']=_['keys'](_0x2bf8d3[_0x362b('0x46')]);_0x11b4da['filters']=_[_0x362b('0x48')](_0x11b4da['model'],_0x11b4da[_0x362b('0x46')]);_0x30c441[_0x362b('0x49')]=_[_0x362b('0x48')](_0x11b4da[_0x362b('0x44')],qs[_0x362b('0x59')](_0x2bf8d3[_0x362b('0x46')]['fields']));_0x30c441[_0x362b('0x49')]=_0x30c441[_0x362b('0x49')]['length']?_0x30c441[_0x362b('0x49')]:_0x11b4da[_0x362b('0x44')];if(!_0x2bf8d3['query'][_0x362b('0x4b')]('nolimit')){_0x30c441[_0x362b('0x33')]=qs[_0x362b('0x33')](_0x2bf8d3['query'][_0x362b('0x33')]);_0x30c441[_0x362b('0x31')]=qs['offset'](_0x2bf8d3[_0x362b('0x46')][_0x362b('0x31')]);}_0x30c441['order']=qs['sort'](_0x2bf8d3['query'][_0x362b('0x4d')]);_0x30c441[_0x362b('0x4e')]=qs[_0x362b('0x47')](_[_0x362b('0x4f')](_0x2bf8d3[_0x362b('0x46')],_0x11b4da[_0x362b('0x47')]));_0x30c441['where']['OpenchannelAccountId']=_0x5ab696['id'];if(_0x2bf8d3[_0x362b('0x46')][_0x362b('0x50')]){_0x30c441['where']=_[_0x362b('0x52')](_0x30c441['where'],{'$or':_[_0x362b('0x45')](_0x30c441[_0x362b('0x49')],function(_0x272b7b){var _0x1b2469={};_0x1b2469[_0x272b7b]={'$like':'%'+_0x2bf8d3[_0x362b('0x46')]['filter']+'%'};return _0x1b2469;})});}_0x30c441=_[_0x362b('0x52')]({},_0x30c441,_0x2bf8d3[_0x362b('0x53')]);return db[_0x362b('0x6e')][_0x362b('0x34')]({'where':_0x30c441['where']})[_0x362b('0x3a')](function(_0x19673c){_0x171c92[_0x362b('0x34')]=_0x19673c;if(_0x2bf8d3['query'][_0x362b('0x5a')]){_0x30c441[_0x362b('0x54')]=[{'all':!![]}];}return db[_0x362b('0x6e')][_0x362b('0x55')](_0x30c441);})['then'](function(_0x5bf971){_0x171c92[_0x362b('0x56')]=_0x5bf971;return _0x171c92;});}})[_0x362b('0x3a')](respondWithFilteredResult(_0x8f72a9,_0x30c441))[_0x362b('0x2e')](handleError(_0x8f72a9,null));};exports[_0x362b('0x70')]=function(_0xf1b48a,_0x477389,_0x37250c){return db[_0x362b('0x41')][_0x362b('0x5b')]({'where':{'id':_0xf1b48a['params']['id']}})['then'](handleEntityNotFound(_0x477389,null))[_0x362b('0x3a')](function(_0x39fcd9){if(_0x39fcd9){return _0x39fcd9[_0x362b('0x70')](_0xf1b48a[_0x362b('0x46')][_0x362b('0x6c')]);}})['then'](respondWithStatusCode(_0x477389,null))[_0x362b('0x2e')](handleError(_0x477389,null));};exports[_0x362b('0x71')]=function(_0x1e2ccc,_0x489e9c,_0x44f2b2){var _0x39f5f2={'body':_0x1e2ccc['body'],'channel':_0x362b('0x72')};var _0x28f2f5=[];var _0x31006b=[];var _0x159656={};var _0x38b060=![];return db['CmContact'][_0x362b('0x65')]()[_0x362b('0x3a')](function(_0x37abc7){if(!_0x37abc7){throw new db['Sequelize'][(_0x362b('0x73'))]('no\x20available\x20attributes');}_0x28f2f5=_[_0x362b('0x74')](_[_0x362b('0x58')](_0x37abc7),[_0x362b('0x75'),'updatedAt']);_0x31006b=_[_0x362b('0x74')](_['keys'](_0x37abc7),[_0x362b('0x75'),_0x362b('0x76'),'CompanyId',_0x362b('0x77')]);if(_0x1e2ccc[_0x362b('0x5d')]['id']){delete _0x1e2ccc[_0x362b('0x5d')]['id'];}if(_[_0x362b('0x78')](_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x79')])){throw new db[(_0x362b('0x7a'))]['ValidationError'](_0x362b('0x7b'));}if(_[_0x362b('0x78')](_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x5d')])||_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x5d')]===''){throw new db[(_0x362b('0x7a'))][(_0x362b('0x73'))](_0x362b('0x7c'));}if(_['isNil'](_0x1e2ccc[_0x362b('0x5d')]['mapKey'])){throw new db['Sequelize'][(_0x362b('0x73'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x31006b);}if(!_[_0x362b('0x7d')](_0x31006b,_0x1e2ccc['body'][_0x362b('0x7e')])){throw new db[(_0x362b('0x7a'))][(_0x362b('0x73'))](_0x362b('0x7f')+_0x31006b);}_0x159656[_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x7e')]]=_0x1e2ccc['body'][_0x362b('0x79')];})[_0x362b('0x3a')](function(){return db[_0x362b('0x41')]['find']({'where':{'id':_0x1e2ccc[_0x362b('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0x362b('0x80'),'include':[{'model':db[_0x362b('0x81')],'as':_0x362b('0x82'),'where':_0x159656,'limit':0x1,'order':[[_0x362b('0x76'),_0x362b('0x83')]]}]},{'model':db['OpenchannelApplication'],'as':_0x362b('0x84')}]});})[_0x362b('0x3a')](handleEntityNotFound(_0x489e9c,null))[_0x362b('0x3a')](function(_0x595c7d){if(_0x595c7d&&_0x595c7d[_0x362b('0x80')]){_0x39f5f2[_0x362b('0x85')]=_0x595c7d;_0x39f5f2[_0x362b('0x86')]=_0x595c7d['Applications'];_0x39f5f2[_0x362b('0x87')]=_0x595c7d[_0x362b('0x80')];_0x39f5f2[_0x362b('0x86')]=_[_0x362b('0x88')](_0x39f5f2[_0x362b('0x86')],[_0x362b('0x89')],['asc']);if(_0x39f5f2['account']['Applications']){delete _0x39f5f2[_0x362b('0x85')][_0x362b('0x84')];}if(_0x39f5f2[_0x362b('0x85')]['List']&&_0x39f5f2[_0x362b('0x85')][_0x362b('0x80')]['Contacts']['length']){return _0x39f5f2['account'][_0x362b('0x80')]['Contacts'][0x0];}var _0x48d3bc=_[_0x362b('0x1b')](_0x1e2ccc['body'],{'firstName':_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x79')],'ListId':_0x595c7d[_0x362b('0x77')]});_0x48d3bc[_0x1e2ccc[_0x362b('0x5d')]['mapKey']]=_0x1e2ccc['body'][_0x362b('0x79')];return db[_0x362b('0x81')][_0x362b('0x5c')](_0x48d3bc,{'fields':_0x28f2f5,'raw':!![]});}})[_0x362b('0x3a')](handleEntityNotFound(_0x489e9c,null))[_0x362b('0x3a')](function(_0x130f59){_0x39f5f2[_0x362b('0x8a')]=_0x130f59;if(_0x130f59){var _0x1881f5={'ContactId':_0x130f59['id'],'OpenchannelAccountId':_0x1e2ccc['params']['id'],'from':(_0x130f59[_0x362b('0x8b')]||'')+'\x20'+(_0x130f59[_0x362b('0x8c')]||'')};var _0x663b62={'OpenchannelAccountId':_0x1e2ccc[_0x362b('0x57')]['id'],'closed':![]};if(_0x1e2ccc[_0x362b('0x5d')]['threadId']){_0x663b62['threadId']=_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x8d')];return db['OpenchannelInteraction']['find']({'where':_0x663b62})[_0x362b('0x3a')](function(_0x3b8461){if(_0x3b8461){return[_0x3b8461,![]];}_0x1881f5[_0x362b('0x8d')]=_0x1e2ccc[_0x362b('0x5d')]['threadId'];_0x1881f5[_0x362b('0x8e')]=_0x1e2ccc[_0x362b('0x5d')]['externalUrl'];return db[_0x362b('0x8f')][_0x362b('0x5c')](_0x1881f5)['then'](function(_0x25e766){return[_0x25e766,!![]];});});}else{_0x663b62[_0x362b('0x8d')]=null;}_0x663b62[_0x362b('0x90')]=_0x130f59['id'];return db[_0x362b('0x8f')][_0x362b('0x5b')]({'where':_0x663b62})[_0x362b('0x3a')](function(_0x517409){if(_0x517409){return[_0x517409,![]];}return db[_0x362b('0x8f')][_0x362b('0x5c')](_0x1881f5)[_0x362b('0x3a')](function(_0x385dee){return[_0x385dee,!![]];});});}})['spread'](function(_0x51880b,_0x4d740a){if(_0x51880b){_0x38b060=_0x4d740a;if(!_0x4d740a){var _0x168e2b={'from':(_0x39f5f2[_0x362b('0x8a')]['firstName']||'')+'\x20'+(_0x39f5f2[_0x362b('0x8a')]['lastName']||'')};if(_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x8d')]&&_0x1e2ccc[_0x362b('0x5d')]['messageId']&&_0x1e2ccc['body'][_0x362b('0x8d')]!=_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x91')]){_0x168e2b[_0x362b('0x8d')]=_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x91')];}return _0x51880b[_0x362b('0x39')](_0x168e2b);}else{return _0x51880b;}}})[_0x362b('0x3a')](function(_0x13a0ab){_0x39f5f2[_0x362b('0x92')]=_0x13a0ab['get']({'plain':!![]});_0x39f5f2[_0x362b('0x92')][_0x362b('0x93')]=_0x38b060;if(_0x39f5f2[_0x362b('0x92')][_0x362b('0x93')]){if(_0x39f5f2['account']['autoclose']){_0x39f5f2['applications']['push']({'id':0x0,'priority':_0x39f5f2[_0x362b('0x86')]['length']+0x1,'app':'close','appdata':_0x362b('0x94'),'interval':_0x362b('0x95')});}}return db[_0x362b('0x96')][_0x362b('0x5c')]({'body':_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x5d')],'OpenchannelAccountId':_0x1e2ccc[_0x362b('0x57')]['id'],'OpenchannelInteractionId':_0x13a0ab['id'],'direction':'in','ContactId':_0x39f5f2[_0x362b('0x8a')]['id'],'AttachmentId':_0x1e2ccc[_0x362b('0x5d')][_0x362b('0x97')]});})[_0x362b('0x3a')](function(_0x33f7b3){_0x39f5f2[_0x362b('0x2c')]=_0x33f7b3;if(_0x39f5f2[_0x362b('0x92')][_0x362b('0x98')]){return db[_0x362b('0x99')][_0x362b('0x5b')]({'attributes':['id','name'],'where':{'id':_0x39f5f2[_0x362b('0x92')][_0x362b('0x98')]}})[_0x362b('0x3a')](function(_0x3a99f3){if(_0x3a99f3){_0x39f5f2[_0x362b('0x86')]['unshift']({'id':0x0,'priority':0x0,'app':_0x362b('0x9a'),'appdata':_0x3a99f3[_0x362b('0x3d')]+','+(_0x39f5f2[_0x362b('0x85')][_0x362b('0x9b')]||0xa),'interval':_0x362b('0x95')});_0x39f5f2[_0x362b('0x9c')]=![];}return respondWithRpcPromise(_0x362b('0x9d'),_0x362b('0x9e'),_0x39f5f2);});}return respondWithRpcPromise(_0x362b('0x9d'),_0x362b('0x9e'),_0x39f5f2);})[_0x362b('0x3a')](function(_0x367bfc){respondWithRpcPromise(_0x362b('0x9f'),'EventManager',{'event':_0x362b('0x71'),'message':_0x367bfc},client9002);return _0x367bfc;})[_0x362b('0x3a')](respondWithResult(_0x489e9c,null))[_0x362b('0x2e')](handleError(_0x489e9c,null));};exports[_0x362b('0xa0')]=function(_0x43021d,_0x34a213,_0xec3f1b){return db[_0x362b('0x41')][_0x362b('0x68')]({'where':{'id':_0x43021d['params']['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x34a213,null))[_0x362b('0x3a')](function(_0x3b3754){if(_0x3b3754){return db[_0x362b('0xa1')][_0x362b('0xa2')](function(_0x36656b){return db[_0x362b('0xa3')][_0x362b('0x3b')]({'where':{'OpenchannelAccountId':_0x43021d[_0x362b('0x57')]['id']},'transaction':_0x36656b})[_0x362b('0x3a')](function(_0x42d5f1){var _0x5bd388=_['map'](_0x43021d[_0x362b('0x5d')],function(_0x2b8157){_0x2b8157[_0x362b('0x66')]=_0x43021d['params']['id'];return _0x2b8157;});return db[_0x362b('0xa3')][_0x362b('0xa4')](_0x5bd388,{'transaction':_0x36656b});});})[_0x362b('0x3a')](function(){return db['OpenchannelApplication'][_0x362b('0xa5')]({'where':{'OpenchannelAccountId':_0x43021d[_0x362b('0x57')]['id']},'order':_0x362b('0x89')});});}})[_0x362b('0x3a')](respondWithResult(_0x34a213,null))[_0x362b('0x2e')](handleError(_0x34a213,null));};exports['getApplications']=function(_0x4d2145,_0x40d269,_0xfa4673){var _0x55e4be={};var _0x3ceb77={};var _0x155e9d;var _0x2abfa0;return db[_0x362b('0x41')][_0x362b('0x68')]({'where':{'id':_0x4d2145[_0x362b('0x57')]['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x40d269,null))['then'](function(_0x2b2386){if(_0x2b2386){_0x155e9d=_0x2b2386;_0x3ceb77['model']=_[_0x362b('0x58')](db[_0x362b('0xa3')][_0x362b('0x42')]);_0x3ceb77[_0x362b('0x46')]=_[_0x362b('0x58')](_0x4d2145[_0x362b('0x46')]);_0x3ceb77[_0x362b('0x47')]=_[_0x362b('0x48')](_0x3ceb77[_0x362b('0x44')],_0x3ceb77[_0x362b('0x46')]);_0x55e4be['attributes']=_[_0x362b('0x48')](_0x3ceb77[_0x362b('0x44')],qs[_0x362b('0x59')](_0x4d2145[_0x362b('0x46')][_0x362b('0x59')]));_0x55e4be[_0x362b('0x49')]=_0x55e4be[_0x362b('0x49')][_0x362b('0x4a')]?_0x55e4be[_0x362b('0x49')]:_0x3ceb77[_0x362b('0x44')];_0x55e4be[_0x362b('0x6a')]=qs[_0x362b('0x4d')](_0x4d2145[_0x362b('0x46')]['sort']);_0x55e4be[_0x362b('0x4e')]=qs[_0x362b('0x47')](_[_0x362b('0x4f')](_0x4d2145[_0x362b('0x46')],_0x3ceb77['filters']));if(_0x4d2145[_0x362b('0x46')]['filter']){_0x55e4be[_0x362b('0x4e')]=_[_0x362b('0x52')](_0x55e4be['where'],{'$or':_['map'](_0x55e4be['attributes'],function(_0xafe935){var _0x5c1eff={};_0x5c1eff[_0xafe935]={'$like':'%'+_0x4d2145[_0x362b('0x46')][_0x362b('0x50')]+'%'};return _0x5c1eff;})});}_0x55e4be=_[_0x362b('0x52')]({},_0x55e4be,_0x4d2145[_0x362b('0x53')]);return _0x155e9d[_0x362b('0xa6')](_0x55e4be);}})[_0x362b('0x3a')](function(_0x2ac0c1){if(_0x2ac0c1){_0x2abfa0=_0x2ac0c1['length'];if(!_0x4d2145[_0x362b('0x46')][_0x362b('0x4b')](_0x362b('0x4c'))){_0x55e4be[_0x362b('0x33')]=qs[_0x362b('0x33')](_0x4d2145[_0x362b('0x46')][_0x362b('0x33')]);_0x55e4be[_0x362b('0x31')]=qs[_0x362b('0x31')](_0x4d2145[_0x362b('0x46')][_0x362b('0x31')]);}return _0x155e9d[_0x362b('0xa6')](_0x55e4be);}})[_0x362b('0x3a')](function(_0x19f349){if(_0x19f349){return _0x19f349?{'count':_0x2abfa0,'rows':_0x19f349}:null;}})[_0x362b('0x3a')](respondWithResult(_0x40d269,null))[_0x362b('0x2e')](handleError(_0x40d269,null));};exports[_0x362b('0xa7')]=function(_0x3faf62,_0x2e33fb,_0x330c1c){var _0x2f1514={'raw':![],'where':{}};var _0x1c6d9e={};var _0x2d4179={'count':0x0,'rows':[]};return db[_0x362b('0x41')][_0x362b('0x68')]({'where':{'id':_0x3faf62[_0x362b('0x57')]['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x2e33fb,null))[_0x362b('0x3a')](function(_0x26cb63){if(_0x26cb63){_0x1c6d9e[_0x362b('0x44')]=_[_0x362b('0x58')](db['OpenchannelInteraction'][_0x362b('0x42')]);_0x1c6d9e[_0x362b('0x46')]=_[_0x362b('0x58')](_0x3faf62[_0x362b('0x46')]);_0x1c6d9e['filters']=_[_0x362b('0x48')](_0x1c6d9e[_0x362b('0x44')],_0x1c6d9e[_0x362b('0x46')]);_0x2f1514[_0x362b('0x49')]=_['intersection'](_0x1c6d9e[_0x362b('0x44')],qs['fields'](_0x3faf62['query']['fields']));_0x2f1514[_0x362b('0x49')]=_0x2f1514[_0x362b('0x49')]['length']?_0x2f1514['attributes']:_0x1c6d9e['model'];if(!_0x3faf62[_0x362b('0x46')][_0x362b('0x4b')](_0x362b('0x4c'))){_0x2f1514[_0x362b('0x33')]=qs[_0x362b('0x33')](_0x3faf62[_0x362b('0x46')]['limit']);_0x2f1514[_0x362b('0x31')]=qs['offset'](_0x3faf62[_0x362b('0x46')][_0x362b('0x31')]);}_0x2f1514['order']=qs[_0x362b('0x4d')](_0x3faf62[_0x362b('0x46')]['sort']);_0x2f1514[_0x362b('0x4e')]=qs[_0x362b('0x47')](_[_0x362b('0x4f')](_0x3faf62[_0x362b('0x46')],_0x1c6d9e['filters']));_0x2f1514[_0x362b('0x4e')]['OpenchannelAccountId']=_0x26cb63['id'];if(_0x3faf62['query'][_0x362b('0x50')]){_0x2f1514[_0x362b('0x4e')]=_[_0x362b('0x52')](_0x2f1514[_0x362b('0x4e')],{'$or':_['map'](_0x2f1514[_0x362b('0x49')],function(_0x9d1d48){var _0x5cf693={};_0x5cf693[_0x9d1d48]={'$like':'%'+_0x3faf62[_0x362b('0x46')][_0x362b('0x50')]+'%'};return _0x5cf693;})});}_0x2f1514=_[_0x362b('0x52')]({},_0x2f1514,_0x3faf62[_0x362b('0x53')]);return db[_0x362b('0x8f')][_0x362b('0x34')]({'where':_0x2f1514['where']})[_0x362b('0x3a')](function(_0x118375){_0x2d4179['count']=_0x118375;if(_0x3faf62[_0x362b('0x46')]['includeAll']){_0x2f1514['include']=[{'model':db[_0x362b('0x81')],'as':_0x362b('0xa8'),'required':![]},{'model':db[_0x362b('0x99')],'as':_0x362b('0xa9'),'attributes':[_0x362b('0x3d'),_0x362b('0xaa'),'internal'],'required':![]},{'model':db[_0x362b('0xab')],'as':_0x362b('0xac'),'attributes':['id','name',_0x362b('0xad')],'where':_0x3faf62[_0x362b('0x46')][_0x362b('0xae')]?{'id':_0x3faf62[_0x362b('0x46')][_0x362b('0xae')]}:undefined,'required':_0x3faf62[_0x362b('0x46')]['tag']?!![]:![]}];}return db[_0x362b('0x8f')][_0x362b('0x55')](_0x2f1514);})[_0x362b('0x3a')](function(_0x3fb574){_0x2d4179['rows']=_0x3fb574;return _0x2d4179;});}})[_0x362b('0x3a')](respondWithFilteredResult(_0x2e33fb,_0x2f1514))[_0x362b('0x2e')](handleError(_0x2e33fb,null));};exports[_0x362b('0xaf')]=function(_0x5d376e,_0x30fcd8,_0xa3a3cd){return db[_0x362b('0x41')][_0x362b('0x5b')]({'where':{'id':_0x5d376e[_0x362b('0x57')]['id']}})['then'](handleEntityNotFound(_0x30fcd8,null))[_0x362b('0x3a')](function(_0x538daa){if(_0x538daa){return _0x538daa[_0x362b('0xaf')](_0x5d376e[_0x362b('0x5d')][_0x362b('0x6c')],_[_0x362b('0xb0')](_0x5d376e[_0x362b('0x5d')],[_0x362b('0x6c'),'id'])||{})[_0x362b('0xb1')](function(_0x570b0a){for(var _0x14a286=0x0;_0x14a286<_0x5d376e[_0x362b('0x5d')][_0x362b('0x6c')][_0x362b('0x4a')];_0x14a286+=0x1){socket[_0x362b('0xb2')]('userOpenchannelAccount:save',{'UserId':Number(_0x5d376e[_0x362b('0x5d')][_0x362b('0x6c')][_0x14a286]),'OpenchannelAccountId':Number(_0x5d376e[_0x362b('0x57')]['id'])});}return _0x570b0a;});}})[_0x362b('0x3a')](respondWithResult(_0x30fcd8,null))[_0x362b('0x2e')](handleError(_0x30fcd8,null));};exports['removeAgents']=function(_0x4b38d7,_0x330faa,_0xace1f9){return db['OpenchannelAccount']['find']({'where':{'id':_0x4b38d7[_0x362b('0x57')]['id']}})['then'](handleEntityNotFound(_0x330faa,null))[_0x362b('0x3a')](function(_0x2ab6cc){if(_0x2ab6cc){return _0x2ab6cc['removeAgents'](_0x4b38d7[_0x362b('0x46')]['ids'])[_0x362b('0x3a')](function(){if(_[_0x362b('0xb3')](_0x4b38d7[_0x362b('0x46')][_0x362b('0x6c')])){for(var _0x392ed8=0x0;_0x392ed8<_0x4b38d7['query']['ids'][_0x362b('0x4a')];_0x392ed8+=0x1){socket[_0x362b('0xb2')](_0x362b('0xb4'),{'UserId':Number(_0x4b38d7[_0x362b('0x46')][_0x362b('0x6c')][_0x392ed8]),'OpenchannelAccountId':Number(_0x4b38d7[_0x362b('0x57')]['id'])});}}else{socket[_0x362b('0xb2')](_0x362b('0xb4'),{'UserId':Number(_0x4b38d7[_0x362b('0x46')]['ids']),'OpenchannelAccountId':Number(_0x4b38d7[_0x362b('0x57')]['id'])});}});}})[_0x362b('0x3a')](respondWithStatusCode(_0x330faa,null))[_0x362b('0x2e')](handleError(_0x330faa,null));};exports['getAgents']=function(_0x1279e5,_0x12a04a,_0x55f49a){var _0x2c5ffb={};var _0x3e3e11={};var _0x549f05;var _0x33bf64;return db['OpenchannelAccount'][_0x362b('0x68')]({'where':{'id':_0x1279e5['params']['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x12a04a,null))['then'](function(_0x2cd252){if(_0x2cd252){_0x549f05=_0x2cd252;_0x3e3e11[_0x362b('0x44')]=_['keys'](db['User'][_0x362b('0x42')]);_0x3e3e11[_0x362b('0x46')]=_[_0x362b('0x58')](_0x1279e5[_0x362b('0x46')]);_0x3e3e11[_0x362b('0x47')]=_['intersection'](_0x3e3e11[_0x362b('0x44')],_0x3e3e11['query']);_0x2c5ffb[_0x362b('0x49')]=_[_0x362b('0x48')](_0x3e3e11['model'],qs['fields'](_0x1279e5[_0x362b('0x46')][_0x362b('0x59')]));_0x2c5ffb[_0x362b('0x49')]=_0x2c5ffb['attributes']['length']?_0x2c5ffb[_0x362b('0x49')]:_0x3e3e11[_0x362b('0x44')];_0x2c5ffb['order']=qs[_0x362b('0x4d')](_0x1279e5['query']['sort']);_0x2c5ffb[_0x362b('0x4e')]=qs[_0x362b('0x47')](_[_0x362b('0x4f')](_0x1279e5[_0x362b('0x46')],_0x3e3e11[_0x362b('0x47')]));if(_0x1279e5[_0x362b('0x46')][_0x362b('0x50')]){_0x2c5ffb[_0x362b('0x4e')]=_[_0x362b('0x52')](_0x2c5ffb[_0x362b('0x4e')],{'$or':_[_0x362b('0x45')](_0x2c5ffb[_0x362b('0x49')],function(_0x4a2144){var _0x478d98={};_0x478d98[_0x4a2144]={'$like':'%'+_0x1279e5[_0x362b('0x46')]['filter']+'%'};return _0x478d98;})});}_0x2c5ffb=_['merge']({},_0x2c5ffb,_0x1279e5[_0x362b('0x53')]);return _0x549f05[_0x362b('0xb5')](_0x2c5ffb);}})[_0x362b('0x3a')](function(_0x43c2eb){if(_0x43c2eb){_0x33bf64=_0x43c2eb[_0x362b('0x4a')];if(!_0x1279e5[_0x362b('0x46')][_0x362b('0x4b')](_0x362b('0x4c'))){_0x2c5ffb[_0x362b('0x33')]=qs['limit'](_0x1279e5['query']['limit']);_0x2c5ffb[_0x362b('0x31')]=qs[_0x362b('0x31')](_0x1279e5[_0x362b('0x46')][_0x362b('0x31')]);}return _0x549f05[_0x362b('0xb5')](_0x2c5ffb);}})['then'](function(_0x15c99c){if(_0x15c99c){return _0x15c99c?{'count':_0x33bf64,'rows':_0x15c99c}:null;}})[_0x362b('0x3a')](respondWithResult(_0x12a04a,null))[_0x362b('0x2e')](handleError(_0x12a04a,null));};exports[_0x362b('0xb6')]=function(_0x22ccdf,_0x1f9be8,_0x1cb893){var _0x2b4af4,_0x2205e8,_0x433e55;if(_[_0x362b('0x78')](_0x22ccdf['body']['body'])||_0x22ccdf[_0x362b('0x5d')]['body']===''){throw new db['Sequelize'][(_0x362b('0x73'))](_0x362b('0x7c'));}if(_[_0x362b('0x78')](_0x22ccdf[_0x362b('0x5d')]['to'])){}_0x2b4af4=_0x22ccdf['body']['to'];return db['OpenchannelAccount'][_0x362b('0x68')]({'where':{'id':_0x22ccdf[_0x362b('0x57')]['id']}})[_0x362b('0x3a')](handleEntityNotFound(_0x1f9be8,null))[_0x362b('0x3a')](function(_0x4ebf12){if(_0x4ebf12){return db[_0x362b('0x41')][_0x362b('0x5b')]({'where':{'id':_0x4ebf12['id']},'include':[{'model':db[_0x362b('0xb7')],'as':'List','include':[{'model':db['CmContact'],'as':_0x362b('0x82'),'where':{[_0x4ebf12[_0x362b('0x7e')]]:_0x2b4af4},'limit':0x1,'order':[['updatedAt',_0x362b('0x83')]]}]}]})[_0x362b('0x3a')](handleEntityNotFound(_0x1f9be8,null))['then'](function(_0x4eb18c){if(_0x4eb18c&&_0x4eb18c['List']){_0x2205e8=_0x4eb18c['get']({'plain':!![]});if(_0x2205e8[_0x362b('0x80')]&&_0x2205e8['List']['Contacts'][_0x362b('0x4a')]){return _0x2205e8['List']['Contacts'][0x0];}return db[_0x362b('0x81')][_0x362b('0x5c')](_[_0x362b('0x1b')](_0x22ccdf[_0x362b('0x5d')],{'firstName':_0x2b4af4,[_0x4eb18c['mapKey']]:_0x2b4af4,'phone':_0x2b4af4,'ListId':_0x2205e8[_0x362b('0x77')]}));}})[_0x362b('0x3a')](handleEntityNotFound(_0x1f9be8,null))['then'](function(_0x41a56){if(_0x41a56){_0x433e55=_0x41a56;return db[_0x362b('0x8f')][_0x362b('0x5b')]({'where':{'ContactId':_0x433e55['id'],'closed':![],'OpenchannelAccountId':_0x2205e8['id']}})[_0x362b('0x3a')](function(_0x143452){if(_0x143452){return[_0x143452,![]];}return db[_0x362b('0x8f')][_0x362b('0x5c')]({'UserId':_0x22ccdf[_0x362b('0x5e')]['id'],'ContactId':_0x433e55['id'],'OpenchannelAccountId':_0x2205e8['id'],'lastMsgDirection':_0x362b('0xb8'),'Messages':[_[_0x362b('0x52')](_0x22ccdf[_0x362b('0x5d')],{'read':![],'body':_0x22ccdf[_0x362b('0x5d')][_0x362b('0x5d')],'OpenchannelAccountId':_0x2205e8['id'],'UserId':_0x22ccdf['user']['id'],'ContactId':_0x433e55['id']})]},{'include':[{'model':db[_0x362b('0x96')],'as':_0x362b('0xb9')}]})[_0x362b('0x3a')](function(_0x3f3862){return[_0x3f3862,!![]];});});}})[_0x362b('0xb1')](function(_0x4d1771,_0x3bd928){if(_0x3bd928){return _0x4d1771;}return db[_0x362b('0x96')][_0x362b('0x5c')](_[_0x362b('0x52')](_0x22ccdf[_0x362b('0x5d')],{'read':![],'body':_0x22ccdf[_0x362b('0x5d')]['body'],'OpenchannelAccountId':_0x2205e8['id'],'OpenchannelInteractionId':_0x4d1771['id'],'UserId':_0x22ccdf[_0x362b('0x5e')]['id'],'ContactId':_0x433e55['id']}))[_0x362b('0x3a')](function(_0x13ab49){_0x4d1771[_0x362b('0xba')][_0x362b('0xb9')]=[];_0x4d1771[_0x362b('0xba')]['Messages'][_0x362b('0xbb')](_0x13ab49['dataValues']);return _0x4d1771;});});}})[_0x362b('0x3a')](respondWithResult(_0x1f9be8,null))[_0x362b('0x2e')](handleError(_0x1f9be8,null));}; \ No newline at end of file +var _0xf729=['OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','end','json','offset','undefined','count','limit','status','set','apply','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','length','OpenchannelAccountId','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','Contacts','DESC','OpenchannelApplication','List','account','applications','Applications','list','orderBy','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./openchannelAccount.socket','client','http','request','info'];(function(_0x45cd42,_0x3f8140){var _0x750010=function(_0x5f417c){while(--_0x5f417c){_0x45cd42['push'](_0x45cd42['shift']());}};_0x750010(++_0x3f8140);}(_0xf729,0xa1));var _0x9f72=function(_0x2c82d2,_0x182be5){_0x2c82d2=_0x2c82d2-0x0;var _0x301802=_0xf729[_0x2c82d2];return _0x301802;};'use strict';var emlformat=require(_0x9f72('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9f72('0x1'));var rp=require(_0x9f72('0x2'));var moment=require(_0x9f72('0x3'));var BPromise=require(_0x9f72('0x4'));var Mustache=require(_0x9f72('0x5'));var util=require('util');var path=require(_0x9f72('0x6'));var sox=require('sox');var csv=require(_0x9f72('0x7'));var ejs=require(_0x9f72('0x8'));var fs=require('fs');var fs_extra=require(_0x9f72('0x9'));var _=require(_0x9f72('0xa'));var squel=require(_0x9f72('0xb'));var crypto=require(_0x9f72('0xc'));var jsforce=require(_0x9f72('0xd'));var deskjs=require(_0x9f72('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9f72('0xf'));var Papa=require(_0x9f72('0x10'));var Redis=require('ioredis');var authService=require(_0x9f72('0x11'));var qs=require(_0x9f72('0x12'));var as=require(_0x9f72('0x13'));var hardwareService=require(_0x9f72('0x14'));var logger=require('../../config/logger')(_0x9f72('0x15'));var utils=require('../../config/utils');var config=require(_0x9f72('0x16'));var licenseUtil=require(_0x9f72('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9f72('0x18')](config[_0x9f72('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9f72('0x1a'))(new Redis(config[_0x9f72('0x19')]));require(_0x9f72('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9f72('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x9f72('0x1c')][_0x9f72('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x386ba0,_0xfe6dae,_0x21bd8e,_0x2a867c){return new BPromise(function(_0x92adce,_0x268521){var _0x542771=_0x2a867c||client;return _0x542771[_0x9f72('0x1e')](_0x386ba0,_0x21bd8e)['then'](function(_0x56874f){logger[_0x9f72('0x1f')](_0x9f72('0x20'),_0xfe6dae,'request\x20sent');logger[_0x9f72('0x21')](_0x9f72('0x22'),_0xfe6dae,'request\x20sent',JSON['stringify'](_0x56874f));if(_0x56874f['error']){if(_0x56874f[_0x9f72('0x23')][_0x9f72('0x24')]===0x1f4){logger['error'](_0x9f72('0x20'),_0xfe6dae,_0x56874f[_0x9f72('0x23')]['message']);return _0x268521(_0x56874f[_0x9f72('0x23')][_0x9f72('0x25')]);}logger['error'](_0x9f72('0x20'),_0xfe6dae,_0x56874f[_0x9f72('0x23')][_0x9f72('0x25')]);return _0x92adce(_0x56874f[_0x9f72('0x23')]['message']);}else{logger[_0x9f72('0x1f')](_0x9f72('0x20'),_0xfe6dae,_0x9f72('0x26'));_0x92adce(_0x56874f[_0x9f72('0x27')]['message']);}})[_0x9f72('0x28')](function(_0xf704e2){logger[_0x9f72('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0xfe6dae,_0xf704e2);_0x268521(_0xf704e2);});});}function respondWithStatusCode(_0x4e435e,_0x21395b){_0x21395b=_0x21395b||0xcc;return function(_0x482337){if(_0x482337){return _0x4e435e['sendStatus'](_0x21395b);}return _0x4e435e['status'](_0x21395b)[_0x9f72('0x29')]();};}function respondWithResult(_0x658cf5,_0x3baf15){_0x3baf15=_0x3baf15||0xc8;return function(_0x3696d3){if(_0x3696d3){return _0x658cf5['status'](_0x3baf15)[_0x9f72('0x2a')](_0x3696d3);}};}function respondWithFilteredResult(_0x37e393,_0x1dcdb5){return function(_0x5d18ed){if(_0x5d18ed){var _0x29e32a=typeof _0x1dcdb5[_0x9f72('0x2b')]===_0x9f72('0x2c')&&typeof _0x1dcdb5['limit']===_0x9f72('0x2c');var _0x4a5b93=_0x5d18ed[_0x9f72('0x2d')];var _0x3733b4=_0x29e32a?0x0:_0x1dcdb5[_0x9f72('0x2b')];var _0x2d2402=_0x29e32a?_0x5d18ed[_0x9f72('0x2d')]:_0x1dcdb5[_0x9f72('0x2b')]+_0x1dcdb5[_0x9f72('0x2e')];var _0x53b75a;if(_0x2d2402>=_0x4a5b93){_0x2d2402=_0x4a5b93;_0x53b75a=0xc8;}else{_0x53b75a=0xce;}_0x37e393[_0x9f72('0x2f')](_0x53b75a);return _0x37e393[_0x9f72('0x30')]('Content-Range',_0x3733b4+'-'+_0x2d2402+'/'+_0x4a5b93)['json'](_0x5d18ed);}return null;};}function patchUpdates(_0x51a29e){return function(_0x588062){try{jsonpatch[_0x9f72('0x31')](_0x588062,_0x51a29e,!![]);}catch(_0x4b31a7){return BPromise['reject'](_0x4b31a7);}return _0x588062['save']();};}function saveUpdates(_0x3bd1fd,_0x322a1e){return function(_0x59df74){if(_0x59df74){return _0x59df74[_0x9f72('0x32')](_0x3bd1fd)[_0x9f72('0x33')](function(_0x91abf7){return _0x91abf7;});}return null;};}function removeEntity(_0x19adb3,_0x3f1aa0){return function(_0x13f54a){if(_0x13f54a){return _0x13f54a[_0x9f72('0x34')]()[_0x9f72('0x33')](function(){var _0x1161da=_0x13f54a[_0x9f72('0x35')]({'plain':!![]});var _0x3c8856=_0x9f72('0x36');return db[_0x9f72('0x37')][_0x9f72('0x34')]({'where':{'type':_0x3c8856,'resourceId':_0x1161da['id']}})[_0x9f72('0x33')](function(){return _0x13f54a;});})[_0x9f72('0x33')](function(){_0x19adb3[_0x9f72('0x2f')](0xcc)[_0x9f72('0x29')]();});}};}function handleEntityNotFound(_0x51978c,_0x4d3224){return function(_0xe8eded){if(!_0xe8eded){_0x51978c[_0x9f72('0x38')](0x194);}return _0xe8eded;};}function handleError(_0x4aaabf,_0x1e1469){_0x1e1469=_0x1e1469||0x1f4;return function(_0x4e2e45){logger[_0x9f72('0x23')](_0x4e2e45[_0x9f72('0x39')]);if(_0x4e2e45[_0x9f72('0x3a')]){delete _0x4e2e45[_0x9f72('0x3a')];}_0x4aaabf[_0x9f72('0x2f')](_0x1e1469)[_0x9f72('0x3b')](_0x4e2e45);};}exports[_0x9f72('0x3c')]=function(_0x4b9f1a,_0x1ecdf0){var _0xc449d9={'include':[{'model':db[_0x9f72('0x3d')],'as':_0x9f72('0x3e')}]},_0x1c0ae3={},_0x244484={'count':0x0,'rows':[]};var _0x59ed39=_[_0x9f72('0x3f')](db[_0x9f72('0x40')][_0x9f72('0x41')],function(_0x57fb77){return{'name':_0x57fb77['fieldName'],'type':_0x57fb77[_0x9f72('0x42')][_0x9f72('0x43')]};});_0x1c0ae3[_0x9f72('0x44')]=_[_0x9f72('0x3f')](_0x59ed39,_0x9f72('0x3a'));_0x1c0ae3[_0x9f72('0x45')]=_[_0x9f72('0x46')](_0x4b9f1a['query']);_0x1c0ae3[_0x9f72('0x47')]=_[_0x9f72('0x48')](_0x1c0ae3[_0x9f72('0x44')],_0x1c0ae3[_0x9f72('0x45')]);_0xc449d9['attributes']=_[_0x9f72('0x48')](_0x1c0ae3['model'],qs[_0x9f72('0x49')](_0x4b9f1a[_0x9f72('0x45')]['fields']));_0xc449d9[_0x9f72('0x4a')]=_0xc449d9[_0x9f72('0x4a')]['length']?_0xc449d9[_0x9f72('0x4a')]:_0x1c0ae3[_0x9f72('0x44')];if(!_0x4b9f1a[_0x9f72('0x45')][_0x9f72('0x4b')](_0x9f72('0x4c'))){_0xc449d9[_0x9f72('0x2e')]=qs[_0x9f72('0x2e')](_0x4b9f1a[_0x9f72('0x45')][_0x9f72('0x2e')]);_0xc449d9[_0x9f72('0x2b')]=qs[_0x9f72('0x2b')](_0x4b9f1a[_0x9f72('0x45')]['offset']);}_0xc449d9[_0x9f72('0x4d')]=qs[_0x9f72('0x4e')](_0x4b9f1a[_0x9f72('0x45')][_0x9f72('0x4e')]);_0xc449d9[_0x9f72('0x4f')]=qs[_0x9f72('0x47')](_[_0x9f72('0x50')](_0x4b9f1a['query'],_0x1c0ae3['filters']),_0x59ed39);if(_0x4b9f1a[_0x9f72('0x45')][_0x9f72('0x51')]){_0xc449d9[_0x9f72('0x4f')]=_[_0x9f72('0x52')](_0xc449d9[_0x9f72('0x4f')],{'$or':_[_0x9f72('0x3f')](_0x59ed39,function(_0x5b0a4b){if(_0x5b0a4b[_0x9f72('0x42')]!==_0x9f72('0x53')){var _0x36a361={};_0x36a361[_0x5b0a4b[_0x9f72('0x3a')]]={'$like':'%'+_0x4b9f1a[_0x9f72('0x45')][_0x9f72('0x51')]+'%'};return _0x36a361;}})});}_0xc449d9=_[_0x9f72('0x52')]({},_0xc449d9,_0x4b9f1a[_0x9f72('0x54')]);var _0xac0ac7={'where':_0xc449d9[_0x9f72('0x4f')]};return db[_0x9f72('0x40')]['count'](_0xac0ac7)['then'](function(_0x45d842){_0x244484[_0x9f72('0x2d')]=_0x45d842;if(_0x4b9f1a[_0x9f72('0x45')][_0x9f72('0x55')]){_0xc449d9[_0x9f72('0x56')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0xc449d9);})[_0x9f72('0x33')](function(_0x2e0008){_0x244484['rows']=_0x2e0008;return _0x244484;})[_0x9f72('0x33')](respondWithFilteredResult(_0x1ecdf0,_0xc449d9))[_0x9f72('0x28')](handleError(_0x1ecdf0,null));};exports[_0x9f72('0x57')]=function(_0x5647b1,_0x1d6854){var _0x1f49ed={'raw':![],'where':{'id':_0x5647b1[_0x9f72('0x58')]['id']},'include':[{'model':db[_0x9f72('0x3d')],'as':_0x9f72('0x3e')}]},_0x4c5bc0={};_0x4c5bc0[_0x9f72('0x44')]=_[_0x9f72('0x46')](db[_0x9f72('0x40')][_0x9f72('0x41')]);_0x4c5bc0['query']=_[_0x9f72('0x46')](_0x5647b1['query']);_0x4c5bc0['filters']=_[_0x9f72('0x48')](_0x4c5bc0['model'],_0x4c5bc0[_0x9f72('0x45')]);_0x1f49ed[_0x9f72('0x4a')]=_['intersection'](_0x4c5bc0['model'],qs[_0x9f72('0x49')](_0x5647b1['query'][_0x9f72('0x49')]));_0x1f49ed[_0x9f72('0x4a')]=_0x1f49ed['attributes']['length']?_0x1f49ed[_0x9f72('0x4a')]:_0x4c5bc0[_0x9f72('0x44')];if(_0x5647b1[_0x9f72('0x45')][_0x9f72('0x55')]){_0x1f49ed['include']=[{'all':!![]}];}_0x1f49ed=_['merge']({},_0x1f49ed,_0x5647b1['options']);return db['OpenchannelAccount']['find'](_0x1f49ed)[_0x9f72('0x33')](handleEntityNotFound(_0x1d6854,null))[_0x9f72('0x33')](respondWithResult(_0x1d6854,null))[_0x9f72('0x28')](handleError(_0x1d6854,null));};exports[_0x9f72('0x59')]=function(_0x1e7d7b,_0xe520a4){return db[_0x9f72('0x40')][_0x9f72('0x59')](_0x1e7d7b[_0x9f72('0x5a')],{})['then'](function(_0x30736e){var _0x3d1a58=_0x1e7d7b['user'][_0x9f72('0x35')]({'plain':!![]});if(!_0x3d1a58)throw new Error(_0x9f72('0x5b'));if(_0x3d1a58[_0x9f72('0x5c')]===_0x9f72('0x5d')){var _0x376967=_0x30736e[_0x9f72('0x35')]({'plain':!![]});var _0x2803ab=_0x9f72('0x36');return db['UserProfileSection'][_0x9f72('0x5e')]({'where':{'name':_0x2803ab,'userProfileId':_0x3d1a58['userProfileId']},'raw':!![]})[_0x9f72('0x33')](function(_0x357809){if(_0x357809&&_0x357809[_0x9f72('0x5f')]===0x0){return db[_0x9f72('0x37')][_0x9f72('0x59')]({'name':_0x376967[_0x9f72('0x3a')],'resourceId':_0x376967['id'],'type':_0x357809[_0x9f72('0x3a')],'sectionId':_0x357809['id']},{})[_0x9f72('0x33')](function(){return _0x30736e;});}else{return _0x30736e;}})[_0x9f72('0x28')](function(_0x2ac725){logger[_0x9f72('0x23')](_0x9f72('0x60'),_0x2ac725);throw _0x2ac725;});}return _0x30736e;})[_0x9f72('0x33')](respondWithResult(_0xe520a4,0xc9))[_0x9f72('0x28')](handleError(_0xe520a4,null));};exports[_0x9f72('0x32')]=function(_0x4f124a,_0x4732c8){if(_0x4f124a['body']['id']){delete _0x4f124a[_0x9f72('0x5a')]['id'];}return db[_0x9f72('0x40')]['find']({'where':{'id':_0x4f124a[_0x9f72('0x58')]['id']},'include':[{'model':db[_0x9f72('0x3d')],'as':_0x9f72('0x3e')}]})[_0x9f72('0x33')](handleEntityNotFound(_0x4732c8,null))['then'](saveUpdates(_0x4f124a[_0x9f72('0x5a')],null))[_0x9f72('0x33')](respondWithResult(_0x4732c8,null))[_0x9f72('0x28')](handleError(_0x4732c8,null));};exports['destroy']=function(_0x1a1aed,_0x30cedf){return db[_0x9f72('0x40')][_0x9f72('0x5e')]({'where':{'id':_0x1a1aed['params']['id']}})['then'](handleEntityNotFound(_0x30cedf,null))[_0x9f72('0x33')](removeEntity(_0x30cedf,null))[_0x9f72('0x28')](handleError(_0x30cedf,null));};exports[_0x9f72('0x61')]=function(_0x385859,_0x36ab41){return db[_0x9f72('0x40')]['describe']()[_0x9f72('0x33')](respondWithResult(_0x36ab41,null))[_0x9f72('0x28')](handleError(_0x36ab41,null));};exports[_0x9f72('0x62')]=function(_0x30ac50,_0x1f85a8,_0x5ea623){if(_0x30ac50['body']['id']){delete _0x30ac50[_0x9f72('0x5a')]['id'];}return db[_0x9f72('0x40')]['find']({'where':{'id':_0x30ac50[_0x9f72('0x58')]['id']}})['then'](handleEntityNotFound(_0x1f85a8,null))[_0x9f72('0x33')](function(_0x5374e3){if(_0x5374e3){_0x30ac50['body']['OpenchannelAccountId']=_0x5374e3['id'];return db['Disposition'][_0x9f72('0x59')](_0x30ac50[_0x9f72('0x5a')]);}})['then'](respondWithResult(_0x1f85a8,null))[_0x9f72('0x28')](handleError(_0x1f85a8,null));};exports[_0x9f72('0x63')]=function(_0x328acd,_0x55954a,_0x1511bd){var _0x33f4a9={'raw':![],'where':{}};var _0x2b12e9={};var _0x5373e7={'count':0x0,'rows':[]};return db[_0x9f72('0x40')][_0x9f72('0x64')]({'where':{'id':_0x328acd[_0x9f72('0x58')]['id']}})[_0x9f72('0x33')](handleEntityNotFound(_0x55954a,null))['then'](function(_0xc26f8c){if(_0xc26f8c){_0x2b12e9['model']=_[_0x9f72('0x46')](db[_0x9f72('0x65')][_0x9f72('0x41')]);_0x2b12e9['query']=_[_0x9f72('0x46')](_0x328acd['query']);_0x2b12e9[_0x9f72('0x47')]=_['intersection'](_0x2b12e9[_0x9f72('0x44')],_0x2b12e9[_0x9f72('0x45')]);_0x33f4a9['attributes']=_['intersection'](_0x2b12e9[_0x9f72('0x44')],qs[_0x9f72('0x49')](_0x328acd[_0x9f72('0x45')][_0x9f72('0x49')]));_0x33f4a9[_0x9f72('0x4a')]=_0x33f4a9[_0x9f72('0x4a')][_0x9f72('0x66')]?_0x33f4a9[_0x9f72('0x4a')]:_0x2b12e9[_0x9f72('0x44')];if(!_0x328acd[_0x9f72('0x45')][_0x9f72('0x4b')](_0x9f72('0x4c'))){_0x33f4a9[_0x9f72('0x2e')]=qs[_0x9f72('0x2e')](_0x328acd['query'][_0x9f72('0x2e')]);_0x33f4a9[_0x9f72('0x2b')]=qs['offset'](_0x328acd[_0x9f72('0x45')][_0x9f72('0x2b')]);}_0x33f4a9['order']=qs[_0x9f72('0x4e')](_0x328acd['query'][_0x9f72('0x4e')]);_0x33f4a9['where']=qs[_0x9f72('0x47')](_[_0x9f72('0x50')](_0x328acd['query'],_0x2b12e9[_0x9f72('0x47')]));_0x33f4a9[_0x9f72('0x4f')][_0x9f72('0x67')]=_0xc26f8c['id'];if(_0x328acd[_0x9f72('0x45')]['filter']){_0x33f4a9[_0x9f72('0x4f')]=_['merge'](_0x33f4a9[_0x9f72('0x4f')],{'$or':_['map'](_0x33f4a9['attributes'],function(_0x5a82e3){var _0x24da87={};_0x24da87[_0x5a82e3]={'$like':'%'+_0x328acd[_0x9f72('0x45')]['filter']+'%'};return _0x24da87;})});}_0x33f4a9=_[_0x9f72('0x52')]({},_0x33f4a9,_0x328acd['options']);return db['Disposition'][_0x9f72('0x2d')]({'where':_0x33f4a9['where']})[_0x9f72('0x33')](function(_0xe16359){_0x5373e7['count']=_0xe16359;if(_0x328acd[_0x9f72('0x45')][_0x9f72('0x55')]){_0x33f4a9['include']=[{'all':!![]}];}return db[_0x9f72('0x65')][_0x9f72('0x68')](_0x33f4a9);})['then'](function(_0x2c36f7){_0x5373e7[_0x9f72('0x69')]=_0x2c36f7;return _0x5373e7;});}})['then'](respondWithFilteredResult(_0x55954a,_0x33f4a9))[_0x9f72('0x28')](handleError(_0x55954a,null));};exports[_0x9f72('0x6a')]=function(_0x414e82,_0x388bd8,_0x50c99d){return db[_0x9f72('0x40')]['find']({'where':{'id':_0x414e82[_0x9f72('0x58')]['id']}})[_0x9f72('0x33')](handleEntityNotFound(_0x388bd8,null))[_0x9f72('0x33')](function(_0x6db1cb){if(_0x6db1cb){return _0x6db1cb[_0x9f72('0x6a')](_0x414e82[_0x9f72('0x45')][_0x9f72('0x6b')]);}})[_0x9f72('0x33')](respondWithStatusCode(_0x388bd8,null))[_0x9f72('0x28')](handleError(_0x388bd8,null));};exports[_0x9f72('0x6c')]=function(_0x493044,_0xd88337,_0x3bb3d6){if(_0x493044[_0x9f72('0x5a')]['id']){delete _0x493044[_0x9f72('0x5a')]['id'];}return db[_0x9f72('0x40')][_0x9f72('0x5e')]({'where':{'id':_0x493044['params']['id']}})[_0x9f72('0x33')](handleEntityNotFound(_0xd88337,null))[_0x9f72('0x33')](function(_0x2bcfe0){if(_0x2bcfe0){_0x493044[_0x9f72('0x5a')][_0x9f72('0x67')]=_0x2bcfe0['id'];return db[_0x9f72('0x6d')][_0x9f72('0x59')](_0x493044[_0x9f72('0x5a')]);}})[_0x9f72('0x33')](respondWithResult(_0xd88337,null))[_0x9f72('0x28')](handleError(_0xd88337,null));};exports[_0x9f72('0x6e')]=function(_0x1d8f6c,_0x278a98,_0x27a943){var _0x4458eb={'raw':![],'where':{}};var _0xa30f5e={};var _0xbc3068={'count':0x0,'rows':[]};return db[_0x9f72('0x40')][_0x9f72('0x64')]({'where':{'id':_0x1d8f6c[_0x9f72('0x58')]['id']}})['then'](handleEntityNotFound(_0x278a98,null))[_0x9f72('0x33')](function(_0x5910dc){if(_0x5910dc){_0xa30f5e[_0x9f72('0x44')]=_['keys'](db['CannedAnswer'][_0x9f72('0x41')]);_0xa30f5e[_0x9f72('0x45')]=_['keys'](_0x1d8f6c['query']);_0xa30f5e[_0x9f72('0x47')]=_[_0x9f72('0x48')](_0xa30f5e[_0x9f72('0x44')],_0xa30f5e['query']);_0x4458eb[_0x9f72('0x4a')]=_[_0x9f72('0x48')](_0xa30f5e[_0x9f72('0x44')],qs['fields'](_0x1d8f6c[_0x9f72('0x45')][_0x9f72('0x49')]));_0x4458eb[_0x9f72('0x4a')]=_0x4458eb[_0x9f72('0x4a')]['length']?_0x4458eb[_0x9f72('0x4a')]:_0xa30f5e[_0x9f72('0x44')];if(!_0x1d8f6c['query'][_0x9f72('0x4b')](_0x9f72('0x4c'))){_0x4458eb[_0x9f72('0x2e')]=qs[_0x9f72('0x2e')](_0x1d8f6c[_0x9f72('0x45')][_0x9f72('0x2e')]);_0x4458eb[_0x9f72('0x2b')]=qs[_0x9f72('0x2b')](_0x1d8f6c[_0x9f72('0x45')]['offset']);}_0x4458eb['order']=qs[_0x9f72('0x4e')](_0x1d8f6c[_0x9f72('0x45')]['sort']);_0x4458eb[_0x9f72('0x4f')]=qs[_0x9f72('0x47')](_[_0x9f72('0x50')](_0x1d8f6c[_0x9f72('0x45')],_0xa30f5e[_0x9f72('0x47')]));_0x4458eb[_0x9f72('0x4f')][_0x9f72('0x67')]=_0x5910dc['id'];if(_0x1d8f6c['query']['filter']){_0x4458eb[_0x9f72('0x4f')]=_[_0x9f72('0x52')](_0x4458eb['where'],{'$or':_[_0x9f72('0x3f')](_0x4458eb[_0x9f72('0x4a')],function(_0x2aa18a){var _0x369100={};_0x369100[_0x2aa18a]={'$like':'%'+_0x1d8f6c[_0x9f72('0x45')][_0x9f72('0x51')]+'%'};return _0x369100;})});}_0x4458eb=_[_0x9f72('0x52')]({},_0x4458eb,_0x1d8f6c['options']);return db['CannedAnswer'][_0x9f72('0x2d')]({'where':_0x4458eb[_0x9f72('0x4f')]})['then'](function(_0x4e48d7){_0xbc3068['count']=_0x4e48d7;if(_0x1d8f6c[_0x9f72('0x45')][_0x9f72('0x55')]){_0x4458eb[_0x9f72('0x56')]=[{'all':!![]}];}return db[_0x9f72('0x6d')][_0x9f72('0x68')](_0x4458eb);})[_0x9f72('0x33')](function(_0x493dd8){_0xbc3068[_0x9f72('0x69')]=_0x493dd8;return _0xbc3068;});}})[_0x9f72('0x33')](respondWithFilteredResult(_0x278a98,_0x4458eb))[_0x9f72('0x28')](handleError(_0x278a98,null));};exports[_0x9f72('0x6f')]=function(_0xdba897,_0x2e903c,_0x549e32){return db[_0x9f72('0x40')]['find']({'where':{'id':_0xdba897[_0x9f72('0x58')]['id']}})[_0x9f72('0x33')](handleEntityNotFound(_0x2e903c,null))[_0x9f72('0x33')](function(_0x3ca898){if(_0x3ca898){return _0x3ca898[_0x9f72('0x6f')](_0xdba897[_0x9f72('0x45')]['ids']);}})[_0x9f72('0x33')](respondWithStatusCode(_0x2e903c,null))['catch'](handleError(_0x2e903c,null));};exports[_0x9f72('0x70')]=function(_0x2c0cf8,_0x4482ea,_0x11f6ad){var _0x3e9a32={'body':_0x2c0cf8[_0x9f72('0x5a')],'channel':_0x9f72('0x71')};var _0x36edd8=[];var _0x597d2a=[];var _0x3aba77={};var _0x5133de=![];return db[_0x9f72('0x72')][_0x9f72('0x61')]()[_0x9f72('0x33')](function(_0x3255db){if(!_0x3255db){throw new db[(_0x9f72('0x73'))]['ValidationError'](_0x9f72('0x74'));}_0x36edd8=_[_0x9f72('0x75')](_[_0x9f72('0x46')](_0x3255db),[_0x9f72('0x76'),'updatedAt']);_0x597d2a=_[_0x9f72('0x75')](_[_0x9f72('0x46')](_0x3255db),[_0x9f72('0x76'),_0x9f72('0x77'),_0x9f72('0x78'),_0x9f72('0x79')]);if(_0x2c0cf8[_0x9f72('0x5a')]['id']){delete _0x2c0cf8[_0x9f72('0x5a')]['id'];}if(_[_0x9f72('0x7a')](_0x2c0cf8[_0x9f72('0x5a')]['from'])){throw new db[(_0x9f72('0x73'))][(_0x9f72('0x7b'))](_0x9f72('0x7c'));}if(_['isNil'](_0x2c0cf8[_0x9f72('0x5a')]['body'])||_0x2c0cf8[_0x9f72('0x5a')][_0x9f72('0x5a')]===''){throw new db[(_0x9f72('0x73'))][(_0x9f72('0x7b'))](_0x9f72('0x7d'));}if(_[_0x9f72('0x7a')](_0x2c0cf8[_0x9f72('0x5a')][_0x9f72('0x7e')])){throw new db[(_0x9f72('0x73'))]['ValidationError'](_0x9f72('0x7f')+_0x597d2a);}if(!_['includes'](_0x597d2a,_0x2c0cf8[_0x9f72('0x5a')][_0x9f72('0x7e')])){throw new db[(_0x9f72('0x73'))][(_0x9f72('0x7b'))](_0x9f72('0x80')+_0x597d2a);}_0x3aba77[_0x2c0cf8['body'][_0x9f72('0x7e')]]=_0x2c0cf8[_0x9f72('0x5a')][_0x9f72('0x81')];})[_0x9f72('0x33')](function(){return db[_0x9f72('0x40')][_0x9f72('0x5e')]({'where':{'id':_0x2c0cf8[_0x9f72('0x58')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x9f72('0x72')],'as':_0x9f72('0x82'),'where':_0x3aba77,'limit':0x1,'order':[[_0x9f72('0x77'),_0x9f72('0x83')]]}]},{'model':db[_0x9f72('0x84')],'as':'Applications'}]});})[_0x9f72('0x33')](handleEntityNotFound(_0x4482ea,null))[_0x9f72('0x33')](function(_0x46a576){if(_0x46a576&&_0x46a576[_0x9f72('0x85')]){_0x3e9a32[_0x9f72('0x86')]=_0x46a576;_0x3e9a32[_0x9f72('0x87')]=_0x46a576[_0x9f72('0x88')];_0x3e9a32[_0x9f72('0x89')]=_0x46a576[_0x9f72('0x85')];_0x3e9a32[_0x9f72('0x87')]=_[_0x9f72('0x8a')](_0x3e9a32[_0x9f72('0x87')],[_0x9f72('0x8b')],[_0x9f72('0x8c')]);if(_0x3e9a32['account'][_0x9f72('0x88')]){delete _0x3e9a32[_0x9f72('0x86')][_0x9f72('0x88')];}if(_0x3e9a32['account']['List']&&_0x3e9a32['account'][_0x9f72('0x85')][_0x9f72('0x82')][_0x9f72('0x66')]){return _0x3e9a32[_0x9f72('0x86')]['List'][_0x9f72('0x82')][0x0];}var _0x262a96=_[_0x9f72('0x18')](_0x2c0cf8['body'],{'firstName':_0x2c0cf8[_0x9f72('0x5a')]['from'],'ListId':_0x46a576[_0x9f72('0x79')]});_0x262a96[_0x2c0cf8['body'][_0x9f72('0x7e')]]=_0x2c0cf8[_0x9f72('0x5a')][_0x9f72('0x81')];return db['CmContact']['create'](_0x262a96,{'fields':_0x36edd8,'raw':!![]});}})['then'](handleEntityNotFound(_0x4482ea,null))['then'](function(_0x59af47){_0x3e9a32[_0x9f72('0x8d')]=_0x59af47;if(_0x59af47){var _0x389ce3={'ContactId':_0x59af47['id'],'OpenchannelAccountId':_0x2c0cf8['params']['id'],'from':(_0x59af47[_0x9f72('0x8e')]||'')+'\x20'+(_0x59af47[_0x9f72('0x8f')]||'')};var _0x2645fe={'OpenchannelAccountId':_0x2c0cf8[_0x9f72('0x58')]['id'],'closed':![]};if(_0x2c0cf8[_0x9f72('0x5a')][_0x9f72('0x90')]){_0x2645fe[_0x9f72('0x90')]=_0x2c0cf8['body'][_0x9f72('0x90')];return db[_0x9f72('0x91')]['find']({'where':_0x2645fe})[_0x9f72('0x33')](function(_0x132617){if(_0x132617){return[_0x132617,![]];}_0x389ce3[_0x9f72('0x90')]=_0x2c0cf8['body'][_0x9f72('0x90')];_0x389ce3[_0x9f72('0x92')]=_0x2c0cf8[_0x9f72('0x5a')]['externalUrl'];return db[_0x9f72('0x91')]['create'](_0x389ce3)[_0x9f72('0x33')](function(_0x10e2c5){return[_0x10e2c5,!![]];});});}else{_0x2645fe[_0x9f72('0x90')]=null;}_0x2645fe['ContactId']=_0x59af47['id'];return db[_0x9f72('0x91')]['find']({'where':_0x2645fe})[_0x9f72('0x33')](function(_0x399d27){if(_0x399d27){return[_0x399d27,![]];}return db[_0x9f72('0x91')][_0x9f72('0x59')](_0x389ce3)[_0x9f72('0x33')](function(_0x31939e){return[_0x31939e,!![]];});});}})['spread'](function(_0x440d0f,_0x1dfdf8){if(_0x440d0f){_0x5133de=_0x1dfdf8;if(!_0x1dfdf8){var _0x7435a={'from':(_0x3e9a32[_0x9f72('0x8d')][_0x9f72('0x8e')]||'')+'\x20'+(_0x3e9a32[_0x9f72('0x8d')][_0x9f72('0x8f')]||'')};if(_0x2c0cf8['body'][_0x9f72('0x90')]&&_0x2c0cf8[_0x9f72('0x5a')][_0x9f72('0x93')]&&_0x2c0cf8[_0x9f72('0x5a')][_0x9f72('0x90')]!=_0x2c0cf8[_0x9f72('0x5a')][_0x9f72('0x93')]){_0x7435a[_0x9f72('0x90')]=_0x2c0cf8['body'][_0x9f72('0x93')];}return _0x440d0f[_0x9f72('0x32')](_0x7435a);}else{return _0x440d0f;}}})[_0x9f72('0x33')](function(_0x3c754d){_0x3e9a32[_0x9f72('0x94')]=_0x3c754d['get']({'plain':!![]});_0x3e9a32[_0x9f72('0x94')]['created']=_0x5133de;if(_0x3e9a32[_0x9f72('0x94')][_0x9f72('0x95')]){if(_0x3e9a32['account']['autoclose']){_0x3e9a32[_0x9f72('0x87')][_0x9f72('0x96')]({'id':0x0,'priority':_0x3e9a32[_0x9f72('0x87')][_0x9f72('0x66')]+0x1,'app':_0x9f72('0x97'),'appdata':_0x9f72('0x98'),'interval':_0x9f72('0x99')});}}return db[_0x9f72('0x9a')][_0x9f72('0x59')]({'body':_0x2c0cf8[_0x9f72('0x5a')][_0x9f72('0x5a')],'OpenchannelAccountId':_0x2c0cf8[_0x9f72('0x58')]['id'],'OpenchannelInteractionId':_0x3c754d['id'],'direction':'in','ContactId':_0x3e9a32[_0x9f72('0x8d')]['id'],'AttachmentId':_0x2c0cf8[_0x9f72('0x5a')][_0x9f72('0x9b')]});})[_0x9f72('0x33')](function(_0x505807){_0x3e9a32['message']=_0x505807;if(_0x3e9a32['interaction'][_0x9f72('0x9c')]){return db[_0x9f72('0x9d')]['find']({'attributes':['id',_0x9f72('0x3a')],'where':{'id':_0x3e9a32[_0x9f72('0x94')][_0x9f72('0x9c')]}})[_0x9f72('0x33')](function(_0x1066cf){if(_0x1066cf){_0x3e9a32['applications'][_0x9f72('0x9e')]({'id':0x0,'priority':0x0,'app':_0x9f72('0x9f'),'appdata':_0x1066cf['name']+','+(_0x3e9a32[_0x9f72('0x86')][_0x9f72('0xa0')]||0xa),'interval':_0x9f72('0x99')});_0x3e9a32[_0x9f72('0xa1')]=![];}return respondWithRpcPromise('Start',_0x9f72('0xa2'),_0x3e9a32);});}return respondWithRpcPromise(_0x9f72('0xa3'),_0x9f72('0xa2'),_0x3e9a32);})[_0x9f72('0x33')](function(_0x524e75){respondWithRpcPromise('EventManager',_0x9f72('0xa4'),{'event':_0x9f72('0x70'),'message':_0x524e75},client9002);return _0x524e75;})[_0x9f72('0x33')](respondWithResult(_0x4482ea,null))[_0x9f72('0x28')](handleError(_0x4482ea,null));};exports[_0x9f72('0xa5')]=function(_0x54ad4b,_0x3e7205,_0x5d2b33){return db[_0x9f72('0x40')][_0x9f72('0x64')]({'where':{'id':_0x54ad4b[_0x9f72('0x58')]['id']}})[_0x9f72('0x33')](handleEntityNotFound(_0x3e7205,null))[_0x9f72('0x33')](function(_0x32a677){if(_0x32a677){return db[_0x9f72('0xa6')][_0x9f72('0xa7')](function(_0x1cdd70){return db[_0x9f72('0x84')]['destroy']({'where':{'OpenchannelAccountId':_0x54ad4b['params']['id']},'transaction':_0x1cdd70})[_0x9f72('0x33')](function(_0xe18caa){var _0x56e9ce=_[_0x9f72('0x3f')](_0x54ad4b['body'],function(_0xd74238){_0xd74238[_0x9f72('0x67')]=_0x54ad4b[_0x9f72('0x58')]['id'];return _0xd74238;});return db[_0x9f72('0x84')][_0x9f72('0xa8')](_0x56e9ce,{'transaction':_0x1cdd70});});})[_0x9f72('0x33')](function(){return db[_0x9f72('0x84')][_0x9f72('0xa9')]({'where':{'OpenchannelAccountId':_0x54ad4b[_0x9f72('0x58')]['id']},'order':'priority'});});}})[_0x9f72('0x33')](respondWithResult(_0x3e7205,null))[_0x9f72('0x28')](handleError(_0x3e7205,null));};exports[_0x9f72('0xaa')]=function(_0x555108,_0x296a3a,_0x10b208){var _0x518465={};var _0x26f59c={};var _0x3c1309;var _0x1a95e5;return db[_0x9f72('0x40')]['findOne']({'where':{'id':_0x555108[_0x9f72('0x58')]['id']}})[_0x9f72('0x33')](handleEntityNotFound(_0x296a3a,null))[_0x9f72('0x33')](function(_0x3a84e0){if(_0x3a84e0){_0x3c1309=_0x3a84e0;_0x26f59c[_0x9f72('0x44')]=_[_0x9f72('0x46')](db[_0x9f72('0x84')][_0x9f72('0x41')]);_0x26f59c[_0x9f72('0x45')]=_['keys'](_0x555108[_0x9f72('0x45')]);_0x26f59c[_0x9f72('0x47')]=_[_0x9f72('0x48')](_0x26f59c[_0x9f72('0x44')],_0x26f59c[_0x9f72('0x45')]);_0x518465[_0x9f72('0x4a')]=_[_0x9f72('0x48')](_0x26f59c[_0x9f72('0x44')],qs[_0x9f72('0x49')](_0x555108[_0x9f72('0x45')][_0x9f72('0x49')]));_0x518465[_0x9f72('0x4a')]=_0x518465[_0x9f72('0x4a')][_0x9f72('0x66')]?_0x518465['attributes']:_0x26f59c['model'];_0x518465[_0x9f72('0x4d')]=qs['sort'](_0x555108[_0x9f72('0x45')][_0x9f72('0x4e')]);_0x518465[_0x9f72('0x4f')]=qs['filters'](_[_0x9f72('0x50')](_0x555108['query'],_0x26f59c[_0x9f72('0x47')]));if(_0x555108[_0x9f72('0x45')][_0x9f72('0x51')]){_0x518465[_0x9f72('0x4f')]=_['merge'](_0x518465[_0x9f72('0x4f')],{'$or':_[_0x9f72('0x3f')](_0x518465[_0x9f72('0x4a')],function(_0x2a6fda){var _0x5c74eb={};_0x5c74eb[_0x2a6fda]={'$like':'%'+_0x555108['query'][_0x9f72('0x51')]+'%'};return _0x5c74eb;})});}_0x518465=_[_0x9f72('0x52')]({},_0x518465,_0x555108[_0x9f72('0x54')]);return _0x3c1309[_0x9f72('0xaa')](_0x518465);}})['then'](function(_0x1644b3){if(_0x1644b3){_0x1a95e5=_0x1644b3[_0x9f72('0x66')];if(!_0x555108[_0x9f72('0x45')][_0x9f72('0x4b')](_0x9f72('0x4c'))){_0x518465[_0x9f72('0x2e')]=qs[_0x9f72('0x2e')](_0x555108[_0x9f72('0x45')]['limit']);_0x518465[_0x9f72('0x2b')]=qs['offset'](_0x555108[_0x9f72('0x45')][_0x9f72('0x2b')]);}return _0x3c1309[_0x9f72('0xaa')](_0x518465);}})[_0x9f72('0x33')](function(_0x1ed6e5){if(_0x1ed6e5){return _0x1ed6e5?{'count':_0x1a95e5,'rows':_0x1ed6e5}:null;}})[_0x9f72('0x33')](respondWithResult(_0x296a3a,null))[_0x9f72('0x28')](handleError(_0x296a3a,null));};exports[_0x9f72('0xab')]=function(_0x3641ff,_0x3796c4,_0x31e42f){var _0x25c875={'raw':![],'where':{}};var _0x23cb19={};var _0x1d29d3={'count':0x0,'rows':[]};return db[_0x9f72('0x40')][_0x9f72('0x64')]({'where':{'id':_0x3641ff[_0x9f72('0x58')]['id']}})[_0x9f72('0x33')](handleEntityNotFound(_0x3796c4,null))[_0x9f72('0x33')](function(_0x120a51){if(_0x120a51){_0x23cb19[_0x9f72('0x44')]=_[_0x9f72('0x46')](db['OpenchannelInteraction'][_0x9f72('0x41')]);_0x23cb19['query']=_[_0x9f72('0x46')](_0x3641ff['query']);_0x23cb19['filters']=_['intersection'](_0x23cb19[_0x9f72('0x44')],_0x23cb19[_0x9f72('0x45')]);_0x25c875[_0x9f72('0x4a')]=_[_0x9f72('0x48')](_0x23cb19['model'],qs['fields'](_0x3641ff[_0x9f72('0x45')]['fields']));_0x25c875['attributes']=_0x25c875[_0x9f72('0x4a')][_0x9f72('0x66')]?_0x25c875[_0x9f72('0x4a')]:_0x23cb19[_0x9f72('0x44')];if(!_0x3641ff[_0x9f72('0x45')][_0x9f72('0x4b')](_0x9f72('0x4c'))){_0x25c875[_0x9f72('0x2e')]=qs['limit'](_0x3641ff['query'][_0x9f72('0x2e')]);_0x25c875[_0x9f72('0x2b')]=qs[_0x9f72('0x2b')](_0x3641ff[_0x9f72('0x45')][_0x9f72('0x2b')]);}_0x25c875[_0x9f72('0x4d')]=qs['sort'](_0x3641ff['query'][_0x9f72('0x4e')]);_0x25c875[_0x9f72('0x4f')]=qs[_0x9f72('0x47')](_['pick'](_0x3641ff['query'],_0x23cb19[_0x9f72('0x47')]));_0x25c875[_0x9f72('0x4f')]['OpenchannelAccountId']=_0x120a51['id'];if(_0x3641ff['query']['filter']){_0x25c875[_0x9f72('0x4f')]=_[_0x9f72('0x52')](_0x25c875['where'],{'$or':_[_0x9f72('0x3f')](_0x25c875[_0x9f72('0x4a')],function(_0x3e828d){var _0x4241f5={};_0x4241f5[_0x3e828d]={'$like':'%'+_0x3641ff[_0x9f72('0x45')][_0x9f72('0x51')]+'%'};return _0x4241f5;})});}_0x25c875=_[_0x9f72('0x52')]({},_0x25c875,_0x3641ff[_0x9f72('0x54')]);return db[_0x9f72('0x91')][_0x9f72('0x2d')]({'where':_0x25c875['where']})[_0x9f72('0x33')](function(_0x3d3866){_0x1d29d3[_0x9f72('0x2d')]=_0x3d3866;if(_0x3641ff[_0x9f72('0x45')][_0x9f72('0x55')]){_0x25c875[_0x9f72('0x56')]=[{'model':db['CmContact'],'as':_0x9f72('0xac'),'required':![]},{'model':db[_0x9f72('0x9d')],'as':_0x9f72('0xad'),'attributes':[_0x9f72('0x3a'),_0x9f72('0xae'),_0x9f72('0xaf')],'required':![]},{'model':db[_0x9f72('0xb0')],'as':_0x9f72('0xb1'),'attributes':['id',_0x9f72('0x3a'),_0x9f72('0xb2')],'where':_0x3641ff[_0x9f72('0x45')][_0x9f72('0xb3')]?{'id':_0x3641ff[_0x9f72('0x45')][_0x9f72('0xb3')]}:undefined,'required':_0x3641ff['query']['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x9f72('0x68')](_0x25c875);})[_0x9f72('0x33')](function(_0x5ddde1){_0x1d29d3[_0x9f72('0x69')]=_0x5ddde1;return _0x1d29d3;});}})['then'](respondWithFilteredResult(_0x3796c4,_0x25c875))[_0x9f72('0x28')](handleError(_0x3796c4,null));};exports[_0x9f72('0xb4')]=function(_0x23bc72,_0x2ddb63,_0x4586ce){return db['OpenchannelAccount'][_0x9f72('0x5e')]({'where':{'id':_0x23bc72[_0x9f72('0x58')]['id']}})[_0x9f72('0x33')](handleEntityNotFound(_0x2ddb63,null))[_0x9f72('0x33')](function(_0x264c91){if(_0x264c91){return _0x264c91[_0x9f72('0xb4')](_0x23bc72[_0x9f72('0x5a')][_0x9f72('0x6b')],_[_0x9f72('0xb5')](_0x23bc72[_0x9f72('0x5a')],['ids','id'])||{})[_0x9f72('0xb6')](function(_0x5ad6ca){for(var _0x96878d=0x0;_0x96878d<_0x23bc72[_0x9f72('0x5a')]['ids'][_0x9f72('0x66')];_0x96878d+=0x1){socket[_0x9f72('0xb7')](_0x9f72('0xb8'),{'UserId':Number(_0x23bc72[_0x9f72('0x5a')]['ids'][_0x96878d]),'OpenchannelAccountId':Number(_0x23bc72['params']['id'])});}return _0x5ad6ca;});}})[_0x9f72('0x33')](respondWithResult(_0x2ddb63,null))[_0x9f72('0x28')](handleError(_0x2ddb63,null));};exports[_0x9f72('0xb9')]=function(_0x21155c,_0x44cdb5,_0x1699bf){return db[_0x9f72('0x40')][_0x9f72('0x5e')]({'where':{'id':_0x21155c[_0x9f72('0x58')]['id']}})[_0x9f72('0x33')](handleEntityNotFound(_0x44cdb5,null))[_0x9f72('0x33')](function(_0x12f864){if(_0x12f864){return _0x12f864[_0x9f72('0xb9')](_0x21155c[_0x9f72('0x45')][_0x9f72('0x6b')])[_0x9f72('0x33')](function(){if(_[_0x9f72('0xba')](_0x21155c[_0x9f72('0x45')][_0x9f72('0x6b')])){for(var _0x1c1cb8=0x0;_0x1c1cb8<_0x21155c['query']['ids'][_0x9f72('0x66')];_0x1c1cb8+=0x1){socket[_0x9f72('0xb7')](_0x9f72('0xbb'),{'UserId':Number(_0x21155c['query'][_0x9f72('0x6b')][_0x1c1cb8]),'OpenchannelAccountId':Number(_0x21155c[_0x9f72('0x58')]['id'])});}}else{socket['emit'](_0x9f72('0xbb'),{'UserId':Number(_0x21155c[_0x9f72('0x45')][_0x9f72('0x6b')]),'OpenchannelAccountId':Number(_0x21155c[_0x9f72('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x44cdb5,null))[_0x9f72('0x28')](handleError(_0x44cdb5,null));};exports[_0x9f72('0xbc')]=function(_0x58389d,_0x5c8226,_0x5f1d1d){var _0x2828d2={};var _0x57c885={};var _0x4d0b63;var _0x4d719d;return db[_0x9f72('0x40')]['findOne']({'where':{'id':_0x58389d[_0x9f72('0x58')]['id']}})[_0x9f72('0x33')](handleEntityNotFound(_0x5c8226,null))['then'](function(_0x3250bd){if(_0x3250bd){_0x4d0b63=_0x3250bd;_0x57c885[_0x9f72('0x44')]=_[_0x9f72('0x46')](db[_0x9f72('0x9d')][_0x9f72('0x41')]);_0x57c885['query']=_[_0x9f72('0x46')](_0x58389d[_0x9f72('0x45')]);_0x57c885[_0x9f72('0x47')]=_['intersection'](_0x57c885[_0x9f72('0x44')],_0x57c885[_0x9f72('0x45')]);_0x2828d2['attributes']=_[_0x9f72('0x48')](_0x57c885[_0x9f72('0x44')],qs['fields'](_0x58389d[_0x9f72('0x45')][_0x9f72('0x49')]));_0x2828d2['attributes']=_0x2828d2[_0x9f72('0x4a')]['length']?_0x2828d2['attributes']:_0x57c885[_0x9f72('0x44')];_0x2828d2[_0x9f72('0x4d')]=qs[_0x9f72('0x4e')](_0x58389d[_0x9f72('0x45')]['sort']);_0x2828d2[_0x9f72('0x4f')]=qs[_0x9f72('0x47')](_[_0x9f72('0x50')](_0x58389d[_0x9f72('0x45')],_0x57c885[_0x9f72('0x47')]));if(_0x58389d[_0x9f72('0x45')][_0x9f72('0x51')]){_0x2828d2[_0x9f72('0x4f')]=_[_0x9f72('0x52')](_0x2828d2[_0x9f72('0x4f')],{'$or':_[_0x9f72('0x3f')](_0x2828d2['attributes'],function(_0x10aa3a){var _0x6aaaf5={};_0x6aaaf5[_0x10aa3a]={'$like':'%'+_0x58389d['query']['filter']+'%'};return _0x6aaaf5;})});}_0x2828d2=_[_0x9f72('0x52')]({},_0x2828d2,_0x58389d[_0x9f72('0x54')]);return _0x4d0b63[_0x9f72('0xbc')](_0x2828d2);}})['then'](function(_0x176eb1){if(_0x176eb1){_0x4d719d=_0x176eb1['length'];if(!_0x58389d['query'][_0x9f72('0x4b')](_0x9f72('0x4c'))){_0x2828d2[_0x9f72('0x2e')]=qs[_0x9f72('0x2e')](_0x58389d[_0x9f72('0x45')][_0x9f72('0x2e')]);_0x2828d2['offset']=qs[_0x9f72('0x2b')](_0x58389d['query'][_0x9f72('0x2b')]);}return _0x4d0b63[_0x9f72('0xbc')](_0x2828d2);}})['then'](function(_0x3a3dd1){if(_0x3a3dd1){return _0x3a3dd1?{'count':_0x4d719d,'rows':_0x3a3dd1}:null;}})[_0x9f72('0x33')](respondWithResult(_0x5c8226,null))[_0x9f72('0x28')](handleError(_0x5c8226,null));};exports[_0x9f72('0x3b')]=function(_0x5e8a6d,_0x5424a0,_0x32da14){var _0x36555f,_0x4b2788,_0x3fb5aa;if(_[_0x9f72('0x7a')](_0x5e8a6d[_0x9f72('0x5a')]['body'])||_0x5e8a6d[_0x9f72('0x5a')]['body']===''){throw new db[(_0x9f72('0x73'))][(_0x9f72('0x7b'))](_0x9f72('0x7d'));}if(_[_0x9f72('0x7a')](_0x5e8a6d[_0x9f72('0x5a')]['to'])){}_0x36555f=_0x5e8a6d[_0x9f72('0x5a')]['to'];return db[_0x9f72('0x40')]['findOne']({'where':{'id':_0x5e8a6d[_0x9f72('0x58')]['id']}})[_0x9f72('0x33')](handleEntityNotFound(_0x5424a0,null))['then'](function(_0x367f99){if(_0x367f99){return db[_0x9f72('0x40')]['find']({'where':{'id':_0x367f99['id']},'include':[{'model':db[_0x9f72('0xbd')],'as':_0x9f72('0x85'),'include':[{'model':db[_0x9f72('0x72')],'as':_0x9f72('0x82'),'where':{[_0x367f99['mapKey']]:_0x36555f},'limit':0x1,'order':[['updatedAt',_0x9f72('0x83')]]}]}]})[_0x9f72('0x33')](handleEntityNotFound(_0x5424a0,null))[_0x9f72('0x33')](function(_0x56b5ca){if(_0x56b5ca&&_0x56b5ca[_0x9f72('0x85')]){_0x4b2788=_0x56b5ca[_0x9f72('0x35')]({'plain':!![]});if(_0x4b2788[_0x9f72('0x85')]&&_0x4b2788['List'][_0x9f72('0x82')][_0x9f72('0x66')]){return _0x4b2788[_0x9f72('0x85')][_0x9f72('0x82')][0x0];}return db[_0x9f72('0x72')][_0x9f72('0x59')](_[_0x9f72('0x18')](_0x5e8a6d['body'],{'firstName':_0x36555f,[_0x56b5ca[_0x9f72('0x7e')]]:_0x36555f,'phone':_0x36555f,'ListId':_0x4b2788[_0x9f72('0x79')]}));}})['then'](handleEntityNotFound(_0x5424a0,null))['then'](function(_0x4739d7){if(_0x4739d7){_0x3fb5aa=_0x4739d7;return db[_0x9f72('0x91')]['find']({'where':{'ContactId':_0x3fb5aa['id'],'closed':![],'OpenchannelAccountId':_0x4b2788['id']}})[_0x9f72('0x33')](function(_0x3b84d4){if(_0x3b84d4){return[_0x3b84d4,![]];}return db[_0x9f72('0x91')][_0x9f72('0x59')]({'UserId':_0x5e8a6d[_0x9f72('0x5d')]['id'],'ContactId':_0x3fb5aa['id'],'OpenchannelAccountId':_0x4b2788['id'],'lastMsgDirection':_0x9f72('0xbe'),'Messages':[_[_0x9f72('0x52')](_0x5e8a6d[_0x9f72('0x5a')],{'read':![],'body':_0x5e8a6d[_0x9f72('0x5a')][_0x9f72('0x5a')],'OpenchannelAccountId':_0x4b2788['id'],'UserId':_0x5e8a6d[_0x9f72('0x5d')]['id'],'ContactId':_0x3fb5aa['id']})]},{'include':[{'model':db[_0x9f72('0x9a')],'as':_0x9f72('0xbf')}]})[_0x9f72('0x33')](function(_0x389c36){return[_0x389c36,!![]];});});}})[_0x9f72('0xb6')](function(_0x4c9f09,_0x6bddf){if(_0x6bddf){return _0x4c9f09;}return db[_0x9f72('0x9a')][_0x9f72('0x59')](_[_0x9f72('0x52')](_0x5e8a6d['body'],{'read':![],'body':_0x5e8a6d[_0x9f72('0x5a')][_0x9f72('0x5a')],'OpenchannelAccountId':_0x4b2788['id'],'OpenchannelInteractionId':_0x4c9f09['id'],'UserId':_0x5e8a6d['user']['id'],'ContactId':_0x3fb5aa['id']}))['then'](function(_0x39d824){_0x4c9f09[_0x9f72('0xc0')]['Messages']=[];_0x4c9f09[_0x9f72('0xc0')]['Messages']['push'](_0x39d824[_0x9f72('0xc0')]);return _0x4c9f09;});});}})['then'](respondWithResult(_0x5424a0,null))[_0x9f72('0x28')](handleError(_0x5424a0,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index f239984..49211c2 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 _0x750a=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x469f97,_0x1d2bd0){var _0x557d30=function(_0xe4d2a5){while(--_0xe4d2a5){_0x469f97['push'](_0x469f97['shift']());}};_0x557d30(++_0x1d2bd0);}(_0x750a,0x140));var _0xa750=function(_0x4cdb27,_0x2a6406){_0x4cdb27=_0x4cdb27-0x0;var _0x1a17aa=_0x750a[_0x4cdb27];return _0x1a17aa;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xa750('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa750('0x1'),'afterUpdate':_0xa750('0x2'),'afterDestroy':_0xa750('0x3')};function emitEvent(_0x19bd5f){return function(_0x457cae,_0x43d704,_0x562911){OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f+':'+_0x457cae['id'],_0x457cae);OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f,_0x457cae);_0x562911(null);};}for(var e in events){if(events[_0xa750('0x5')](e)){var event=events[e];OpenchannelAccount[_0xa750('0x6')](e,emitEvent(event));}}module[_0xa750('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x6f0d=['remove','emit','hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save'];(function(_0x28166d,_0x275cbc){var _0x1812a1=function(_0x221ff0){while(--_0x221ff0){_0x28166d['push'](_0x28166d['shift']());}};_0x1812a1(++_0x275cbc);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x527eb7,_0x250d09){_0x527eb7=_0x527eb7-0x0;var _0x507f55=_0x6f0d[_0x527eb7];return _0x507f55;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xd6f0('0x0'))['db'][_0xd6f0('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xd6f0('0x2')](0x0);var events={'afterCreate':_0xd6f0('0x3'),'afterUpdate':'update','afterDestroy':_0xd6f0('0x4')};function emitEvent(_0x135a93){return function(_0x2f78fb,_0x25344b,_0x3a757f){OpenchannelAccountEvents['emit'](_0x135a93+':'+_0x2f78fb['id'],_0x2f78fb);OpenchannelAccountEvents[_0xd6f0('0x5')](_0x135a93,_0x2f78fb);_0x3a757f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xd6f0('0x6')](e,emitEvent(event));}}module[_0xd6f0('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 c87a14a..8d99315 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(_0x4e0951,_0x394141){var _0x5d2567=function(_0x20ca59){while(--_0x20ca59){_0x4e0951['push'](_0x4e0951['shift']());}};_0x5d2567(++_0x394141);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x3522b5,_0x21f893){var _0x5f2592=function(_0x2230c4){while(--_0x2230c4){_0x3522b5['push'](_0x3522b5['shift']());}};_0x5f2592(++_0x21f893);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 0fd3de6..2e8c486 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 _0x9d5b=['register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./openchannelAccount.socket'];(function(_0x2855f3,_0x1f19db){var _0x562e6a=function(_0x55a4b1){while(--_0x55a4b1){_0x2855f3['push'](_0x2855f3['shift']());}};_0x562e6a(++_0x1f19db);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x3aff82,_0x28e6af){_0x3aff82=_0x3aff82-0x0;var _0x2f7576=_0x9d5b[_0x3aff82];return _0x2f7576;};'use strict';var _=require('lodash');var util=require(_0xb9d5('0x0'));var moment=require(_0xb9d5('0x1'));var BPromise=require(_0xb9d5('0x2'));var rs=require(_0xb9d5('0x3'));var fs=require('fs');var Redis=require(_0xb9d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9d5('0x5'));var logger=require('../../config/logger')(_0xb9d5('0x6'));var config=require(_0xb9d5('0x7'));var jayson=require(_0xb9d5('0x8'));var client=jayson[_0xb9d5('0x9')][_0xb9d5('0xa')]({'port':0x232a});config['redis']=_[_0xb9d5('0xb')](config[_0xb9d5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb9d5('0xd'))(new Redis(config[_0xb9d5('0xc')]));require(_0xb9d5('0xe'))[_0xb9d5('0xf')](socket);function respondWithRpcPromise(_0x5d0fc6,_0x1aec1b,_0x1ae073){return new BPromise(function(_0x4c1ce3,_0x35d69f){return client[_0xb9d5('0x10')](_0x5d0fc6,_0x1ae073)[_0xb9d5('0x11')](function(_0x422b36){logger[_0xb9d5('0x12')](_0xb9d5('0x13'),_0x1aec1b,_0xb9d5('0x14'));logger[_0xb9d5('0x15')](_0xb9d5('0x16'),_0x1aec1b,_0xb9d5('0x14'),JSON[_0xb9d5('0x17')](_0x422b36));if(_0x422b36['error']){if(_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x19')]===0x1f4){logger['error'](_0xb9d5('0x13'),_0x1aec1b,_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x1a')]);return _0x35d69f(_0x422b36['error'][_0xb9d5('0x1a')]);}logger[_0xb9d5('0x18')](_0xb9d5('0x13'),_0x1aec1b,_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x1a')]);return _0x4c1ce3(_0x422b36[_0xb9d5('0x18')][_0xb9d5('0x1a')]);}else{logger[_0xb9d5('0x12')](_0xb9d5('0x13'),_0x1aec1b,_0xb9d5('0x14'));_0x4c1ce3(_0x422b36[_0xb9d5('0x1b')][_0xb9d5('0x1a')]);}})[_0xb9d5('0x1c')](function(_0x171487){logger['error'](_0xb9d5('0x13'),_0x1aec1b,_0x171487);_0x35d69f(_0x171487);});});} \ No newline at end of file +var _0xbf6e=['client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','request','then','info','request\x20sent','debug','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4583a2,_0x2c139b){var _0x4410fa=function(_0x1c62fc){while(--_0x1c62fc){_0x4583a2['push'](_0x4583a2['shift']());}};_0x4410fa(++_0x2c139b);}(_0xbf6e,0x149));var _0xebf6=function(_0x423797,_0x3d393b){_0x423797=_0x423797-0x0;var _0x57ec0c=_0xbf6e[_0x423797];return _0x57ec0c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xebf6('0x0'));var BPromise=require(_0xebf6('0x1'));var rs=require(_0xebf6('0x2'));var fs=require('fs');var Redis=require(_0xebf6('0x3'));var db=require(_0xebf6('0x4'))['db'];var utils=require(_0xebf6('0x5'));var logger=require(_0xebf6('0x6'))('rpc');var config=require(_0xebf6('0x7'));var jayson=require(_0xebf6('0x8'));var client=jayson[_0xebf6('0x9')][_0xebf6('0xa')]({'port':0x232a});config[_0xebf6('0xb')]=_[_0xebf6('0xc')](config[_0xebf6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xebf6('0xd'))(new Redis(config[_0xebf6('0xb')]));require(_0xebf6('0xe'))['register'](socket);function respondWithRpcPromise(_0x38cee4,_0x14f41e,_0x5c6727){return new BPromise(function(_0x3d4b60,_0x231d6b){return client[_0xebf6('0xf')](_0x38cee4,_0x5c6727)[_0xebf6('0x10')](function(_0x1bd481){logger[_0xebf6('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x14f41e,_0xebf6('0x12'));logger[_0xebf6('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x14f41e,_0xebf6('0x12'),JSON[_0xebf6('0x14')](_0x1bd481));if(_0x1bd481[_0xebf6('0x15')]){if(_0x1bd481[_0xebf6('0x15')][_0xebf6('0x16')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x14f41e,_0x1bd481['error'][_0xebf6('0x17')]);return _0x231d6b(_0x1bd481[_0xebf6('0x15')]['message']);}logger[_0xebf6('0x15')](_0xebf6('0x18'),_0x14f41e,_0x1bd481[_0xebf6('0x15')][_0xebf6('0x17')]);return _0x3d4b60(_0x1bd481[_0xebf6('0x15')][_0xebf6('0x17')]);}else{logger[_0xebf6('0x11')](_0xebf6('0x18'),_0x14f41e,_0xebf6('0x12'));_0x3d4b60(_0x1bd481[_0xebf6('0x19')]['message']);}})['catch'](function(_0xe03844){logger[_0xebf6('0x15')](_0xebf6('0x18'),_0x14f41e,_0xe03844);_0x231d6b(_0xe03844);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index a37abf4..54b509b 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 _0x795a=['save','remove','emit','removeListener','register','length'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0x795a,0xa2));var _0xa795=function(_0x1691de,_0x285686){_0x1691de=_0x1691de-0x0;var _0x8611ac=_0x795a[_0x1691de];return _0x8611ac;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xa795('0x0'),_0xa795('0x1'),'update'];function createListener(_0x285f44,_0x4e8f61){return function(_0x237618){_0x4e8f61[_0xa795('0x2')](_0x285f44,_0x237618);};}function removeListener(_0x4ce3a0,_0x4f7e4e){return function(){OpenchannelAccountEvents[_0xa795('0x3')](_0x4ce3a0,_0x4f7e4e);};}exports[_0xa795('0x4')]=function(_0x26a4f2){for(var _0x2efc9b=0x0,_0x553cf3=events[_0xa795('0x5')];_0x2efc9b<_0x553cf3;_0x2efc9b++){var _0x58d69c=events[_0x2efc9b];var _0x36a3a9=createListener('openchannelAccount:'+_0x58d69c,_0x26a4f2);OpenchannelAccountEvents['on'](_0x58d69c,_0x36a3a9);}}; \ No newline at end of file +var _0x50a8=['removeListener','register','openchannelAccount:','./openchannelAccount.events','emit'];(function(_0x5c5429,_0x9a9820){var _0x475cd4=function(_0x328edc){while(--_0x328edc){_0x5c5429['push'](_0x5c5429['shift']());}};_0x475cd4(++_0x9a9820);}(_0x50a8,0x198));var _0x850a=function(_0x2f7aa6,_0x2072e5){_0x2f7aa6=_0x2f7aa6-0x0;var _0x18d006=_0x50a8[_0x2f7aa6];return _0x18d006;};'use strict';var OpenchannelAccountEvents=require(_0x850a('0x0'));var events=['save','remove','update'];function createListener(_0x1d5288,_0x5600ec){return function(_0x204954){_0x5600ec[_0x850a('0x1')](_0x1d5288,_0x204954);};}function removeListener(_0x2109b0,_0x3df4c3){return function(){OpenchannelAccountEvents[_0x850a('0x2')](_0x2109b0,_0x3df4c3);};}exports[_0x850a('0x3')]=function(_0xb85c1a){for(var _0x442316=0x0,_0x3fdb41=events['length'];_0x442316<_0x3fdb41;_0x442316++){var _0x488676=events[_0x442316];var _0x3c138a=createListener(_0x850a('0x4')+_0x488676,_0xb85c1a);OpenchannelAccountEvents['on'](_0x488676,_0x3c138a);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index e2e0657..b6d8180 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 _0xa07f=['multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','isAuthenticated','show','create','/:id','update','delete','destroy','exports'];(function(_0x5cdd3b,_0xfda807){var _0x53d8e7=function(_0x5d7f01){while(--_0x5d7f01){_0x5cdd3b['push'](_0x5cdd3b['shift']());}};_0x53d8e7(++_0xfda807);}(_0xa07f,0x1b0));var _0xfa07=function(_0x16c598,_0x1ab9bb){_0x16c598=_0x16c598-0x0;var _0x2013b8=_0xa07f[_0x16c598];return _0x2013b8;};'use strict';var multer=require(_0xfa07('0x0'));var util=require(_0xfa07('0x1'));var path=require(_0xfa07('0x2'));var timeout=require(_0xfa07('0x3'));var express=require('express');var router=express[_0xfa07('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfa07('0x5'));var config=require(_0xfa07('0x6'));var controller=require(_0xfa07('0x7'));router[_0xfa07('0x8')]('/',auth['isAuthenticated'](),controller[_0xfa07('0x9')]);router[_0xfa07('0x8')]('/:id',auth[_0xfa07('0xa')](),controller[_0xfa07('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfa07('0xc')]);router['put'](_0xfa07('0xd'),auth[_0xfa07('0xa')](),controller[_0xfa07('0xe')]);router[_0xfa07('0xf')](_0xfa07('0xd'),auth[_0xfa07('0xa')](),controller[_0xfa07('0x10')]);module[_0xfa07('0x11')]=router; \ No newline at end of file +var _0xff2a=['put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0xdb9ccc,_0x48a96c){var _0x2398d9=function(_0x52e6f4){while(--_0x52e6f4){_0xdb9ccc['push'](_0xdb9ccc['shift']());}};_0x2398d9(++_0x48a96c);}(_0xff2a,0x71));var _0xaff2=function(_0x27d443,_0x4ee5ec){_0x27d443=_0x27d443-0x0;var _0x21b822=_0xff2a[_0x27d443];return _0x21b822;};'use strict';var multer=require(_0xaff2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaff2('0x1'));var express=require(_0xaff2('0x2'));var router=express['Router']();var fs_extra=require(_0xaff2('0x3'));var auth=require(_0xaff2('0x4'));var interaction=require(_0xaff2('0x5'));var config=require(_0xaff2('0x6'));var controller=require(_0xaff2('0x7'));router[_0xaff2('0x8')]('/',auth[_0xaff2('0x9')](),controller[_0xaff2('0xa')]);router['get'](_0xaff2('0xb'),auth['isAuthenticated'](),controller[_0xaff2('0xc')]);router['post']('/',auth[_0xaff2('0x9')](),controller['create']);router[_0xaff2('0xd')](_0xaff2('0xb'),auth[_0xaff2('0x9')](),controller[_0xaff2('0xe')]);router[_0xaff2('0xf')](_0xaff2('0xb'),auth['isAuthenticated'](),controller[_0xaff2('0x10')]);module[_0xaff2('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 15d31a0..368474b 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 _0xeeb4=['STRING','sequelize','noop','TEXT'];(function(_0x2839a5,_0x1c13cc){var _0x5ee410=function(_0x26947b){while(--_0x26947b){_0x2839a5['push'](_0x2839a5['shift']());}};_0x5ee410(++_0x1c13cc);}(_0xeeb4,0x125));var _0x4eeb=function(_0x5b3f61,_0x5bdade){_0x5b3f61=_0x5b3f61-0x0;var _0x246e19=_0xeeb4[_0x5b3f61];return _0x246e19;};'use strict';var Sequelize=require(_0x4eeb('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4eeb('0x1')},'appdata':{'type':Sequelize[_0x4eeb('0x2')]()},'description':{'type':Sequelize[_0x4eeb('0x3')]},'interval':{'type':Sequelize[_0x4eeb('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x19e1=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x40b7c5,_0x3ea989){var _0x68599f=function(_0x217835){while(--_0x217835){_0x40b7c5['push'](_0x40b7c5['shift']());}};_0x68599f(++_0x3ea989);}(_0x19e1,0x118));var _0x119e=function(_0x4404ff,_0x13d7a9){_0x4404ff=_0x4404ff-0x0;var _0x5e7b19=_0x19e1[_0x4404ff];return _0x5e7b19;};'use strict';var Sequelize=require('sequelize');module[_0x119e('0x0')]={'priority':{'type':Sequelize[_0x119e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x119e('0x2')],'allowNull':![],'defaultValue':_0x119e('0x3')},'appdata':{'type':Sequelize[_0x119e('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x119e('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index b9be730..5d12c91 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 _0xc153=['includeAll','findAll','rows','catch','show','params','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x5cbaaf,_0x299426){var _0x246e96=function(_0x4fc39c){while(--_0x4fc39c){_0x5cbaaf['push'](_0x5cbaaf['shift']());}};_0x246e96(++_0x299426);}(_0xc153,0x17c));var _0x3c15=function(_0x515aa,_0x57cedb){_0x515aa=_0x515aa-0x0;var _0x5476e2=_0xc153[_0x515aa];return _0x5476e2;};'use strict';var emlformat=require(_0x3c15('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3c15('0x1'));var jsonpatch=require(_0x3c15('0x2'));var rp=require(_0x3c15('0x3'));var moment=require('moment');var BPromise=require(_0x3c15('0x4'));var Mustache=require(_0x3c15('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3c15('0x6'));var csv=require(_0x3c15('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c15('0x8'));var _=require(_0x3c15('0x9'));var squel=require('squel');var crypto=require(_0x3c15('0xa'));var jsforce=require(_0x3c15('0xb'));var deskjs=require(_0x3c15('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3c15('0xd'));var Papa=require(_0x3c15('0xe'));var Redis=require(_0x3c15('0xf'));var authService=require(_0x3c15('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3c15('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c15('0x12'))(_0x3c15('0x13'));var utils=require(_0x3c15('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3c15('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8a0ec7,_0x2c1e42){_0x2c1e42=_0x2c1e42||0xcc;return function(_0x5cfe19){if(_0x5cfe19){return _0x8a0ec7[_0x3c15('0x16')](_0x2c1e42);}return _0x8a0ec7['status'](_0x2c1e42)['end']();};}function respondWithResult(_0x5ea38d,_0x2d897e){_0x2d897e=_0x2d897e||0xc8;return function(_0x5a213c){if(_0x5a213c){return _0x5ea38d[_0x3c15('0x17')](_0x2d897e)[_0x3c15('0x18')](_0x5a213c);}};}function respondWithFilteredResult(_0x22c4d5,_0x49df9a){return function(_0x426cf0){if(_0x426cf0){var _0x5403ca=typeof _0x49df9a[_0x3c15('0x19')]===_0x3c15('0x1a')&&typeof _0x49df9a[_0x3c15('0x1b')]===_0x3c15('0x1a');var _0x2e8ac3=_0x426cf0[_0x3c15('0x1c')];var _0x43e23e=_0x5403ca?0x0:_0x49df9a['offset'];var _0x3ab792=_0x5403ca?_0x426cf0['count']:_0x49df9a[_0x3c15('0x19')]+_0x49df9a[_0x3c15('0x1b')];var _0xea5a54;if(_0x3ab792>=_0x2e8ac3){_0x3ab792=_0x2e8ac3;_0xea5a54=0xc8;}else{_0xea5a54=0xce;}_0x22c4d5[_0x3c15('0x17')](_0xea5a54);return _0x22c4d5[_0x3c15('0x1d')](_0x3c15('0x1e'),_0x43e23e+'-'+_0x3ab792+'/'+_0x2e8ac3)[_0x3c15('0x18')](_0x426cf0);}return null;};}function patchUpdates(_0x209b96){return function(_0x18db8e){try{jsonpatch[_0x3c15('0x1f')](_0x18db8e,_0x209b96,!![]);}catch(_0x75386c){return BPromise[_0x3c15('0x20')](_0x75386c);}return _0x18db8e['save']();};}function saveUpdates(_0x3a7158,_0x4a91df){return function(_0x5f1c05){if(_0x5f1c05){return _0x5f1c05[_0x3c15('0x21')](_0x3a7158)[_0x3c15('0x22')](function(_0x71522c){return _0x71522c;});}return null;};}function removeEntity(_0x24a006,_0x3ab6d2){return function(_0x427f79){if(_0x427f79){return _0x427f79[_0x3c15('0x23')]()[_0x3c15('0x22')](function(){_0x24a006[_0x3c15('0x17')](0xcc)[_0x3c15('0x24')]();});}};}function handleEntityNotFound(_0x4dac96,_0x786c08){return function(_0x5ca2c5){if(!_0x5ca2c5){_0x4dac96[_0x3c15('0x16')](0x194);}return _0x5ca2c5;};}function handleError(_0x4d87cc,_0x2f6a7d){_0x2f6a7d=_0x2f6a7d||0x1f4;return function(_0x357a16){logger[_0x3c15('0x25')](_0x357a16[_0x3c15('0x26')]);if(_0x357a16[_0x3c15('0x27')]){delete _0x357a16[_0x3c15('0x27')];}_0x4d87cc['status'](_0x2f6a7d)[_0x3c15('0x28')](_0x357a16);};}exports[_0x3c15('0x29')]=function(_0x186b18,_0x472dc8){var _0x43f6cc={},_0x1e112a={},_0xc79ec3={'count':0x0,'rows':[]};var _0x1dc453=_[_0x3c15('0x2a')](db[_0x3c15('0x2b')][_0x3c15('0x2c')],function(_0x7879dc){return{'name':_0x7879dc[_0x3c15('0x2d')],'type':_0x7879dc[_0x3c15('0x2e')][_0x3c15('0x2f')]};});_0x1e112a[_0x3c15('0x30')]=_['map'](_0x1dc453,'name');_0x1e112a[_0x3c15('0x31')]=_[_0x3c15('0x32')](_0x186b18[_0x3c15('0x31')]);_0x1e112a[_0x3c15('0x33')]=_['intersection'](_0x1e112a[_0x3c15('0x30')],_0x1e112a[_0x3c15('0x31')]);_0x43f6cc[_0x3c15('0x34')]=_[_0x3c15('0x35')](_0x1e112a[_0x3c15('0x30')],qs[_0x3c15('0x36')](_0x186b18['query']['fields']));_0x43f6cc[_0x3c15('0x34')]=_0x43f6cc['attributes'][_0x3c15('0x37')]?_0x43f6cc[_0x3c15('0x34')]:_0x1e112a[_0x3c15('0x30')];if(!_0x186b18[_0x3c15('0x31')][_0x3c15('0x38')](_0x3c15('0x39'))){_0x43f6cc[_0x3c15('0x1b')]=qs[_0x3c15('0x1b')](_0x186b18[_0x3c15('0x31')]['limit']);_0x43f6cc[_0x3c15('0x19')]=qs['offset'](_0x186b18[_0x3c15('0x31')]['offset']);}_0x43f6cc['order']=qs[_0x3c15('0x3a')](_0x186b18[_0x3c15('0x31')][_0x3c15('0x3a')]);_0x43f6cc[_0x3c15('0x3b')]=qs[_0x3c15('0x33')](_[_0x3c15('0x3c')](_0x186b18['query'],_0x1e112a['filters']),_0x1dc453);if(_0x186b18[_0x3c15('0x31')][_0x3c15('0x3d')]){_0x43f6cc[_0x3c15('0x3b')]=_[_0x3c15('0x3e')](_0x43f6cc[_0x3c15('0x3b')],{'$or':_[_0x3c15('0x2a')](_0x1dc453,function(_0x2aca44){if(_0x2aca44[_0x3c15('0x2e')]!==_0x3c15('0x3f')){var _0x11c27d={};_0x11c27d[_0x2aca44['name']]={'$like':'%'+_0x186b18[_0x3c15('0x31')][_0x3c15('0x3d')]+'%'};return _0x11c27d;}})});}_0x43f6cc=_[_0x3c15('0x3e')]({},_0x43f6cc,_0x186b18['options']);var _0x55a9c6={'where':_0x43f6cc[_0x3c15('0x3b')]};return db[_0x3c15('0x2b')]['count'](_0x55a9c6)['then'](function(_0x29f659){_0xc79ec3[_0x3c15('0x1c')]=_0x29f659;if(_0x186b18[_0x3c15('0x31')][_0x3c15('0x40')]){_0x43f6cc['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x3c15('0x41')](_0x43f6cc);})['then'](function(_0x5260c7){_0xc79ec3[_0x3c15('0x42')]=_0x5260c7;return _0xc79ec3;})[_0x3c15('0x22')](respondWithFilteredResult(_0x472dc8,_0x43f6cc))[_0x3c15('0x43')](handleError(_0x472dc8,null));};exports[_0x3c15('0x44')]=function(_0x662ea6,_0x4d1218){var _0x17b2e3={'raw':!![],'where':{'id':_0x662ea6[_0x3c15('0x45')]['id']}},_0x52f4b6={};_0x52f4b6[_0x3c15('0x30')]=_['keys'](db[_0x3c15('0x2b')]['rawAttributes']);_0x52f4b6['query']=_[_0x3c15('0x32')](_0x662ea6[_0x3c15('0x31')]);_0x52f4b6[_0x3c15('0x33')]=_[_0x3c15('0x35')](_0x52f4b6['model'],_0x52f4b6[_0x3c15('0x31')]);_0x17b2e3[_0x3c15('0x34')]=_['intersection'](_0x52f4b6['model'],qs['fields'](_0x662ea6[_0x3c15('0x31')]['fields']));_0x17b2e3[_0x3c15('0x34')]=_0x17b2e3[_0x3c15('0x34')]['length']?_0x17b2e3[_0x3c15('0x34')]:_0x52f4b6['model'];if(_0x662ea6[_0x3c15('0x31')][_0x3c15('0x40')]){_0x17b2e3['include']=[{'all':!![]}];}_0x17b2e3=_[_0x3c15('0x3e')]({},_0x17b2e3,_0x662ea6[_0x3c15('0x46')]);return db[_0x3c15('0x2b')][_0x3c15('0x47')](_0x17b2e3)[_0x3c15('0x22')](handleEntityNotFound(_0x4d1218,null))[_0x3c15('0x22')](respondWithResult(_0x4d1218,null))[_0x3c15('0x43')](handleError(_0x4d1218,null));};exports['create']=function(_0x45dfc7,_0x543e3d){return db[_0x3c15('0x2b')][_0x3c15('0x48')](_0x45dfc7[_0x3c15('0x49')],{})['then'](respondWithResult(_0x543e3d,0xc9))['catch'](handleError(_0x543e3d,null));};exports[_0x3c15('0x21')]=function(_0x57bd65,_0x5ae4ac){if(_0x57bd65['body']['id']){delete _0x57bd65[_0x3c15('0x49')]['id'];}return db[_0x3c15('0x2b')]['find']({'where':{'id':_0x57bd65['params']['id']}})[_0x3c15('0x22')](handleEntityNotFound(_0x5ae4ac,null))['then'](saveUpdates(_0x57bd65[_0x3c15('0x49')],null))['then'](respondWithResult(_0x5ae4ac,null))[_0x3c15('0x43')](handleError(_0x5ae4ac,null));};exports[_0x3c15('0x23')]=function(_0x211850,_0x81fdaf){return db[_0x3c15('0x2b')][_0x3c15('0x47')]({'where':{'id':_0x211850[_0x3c15('0x45')]['id']}})['then'](handleEntityNotFound(_0x81fdaf,null))[_0x3c15('0x22')](removeEntity(_0x81fdaf,null))['catch'](handleError(_0x81fdaf,null));}; \ No newline at end of file +var _0x4527=['reject','update','destroy','end','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','type','filter','options','then','includeAll','include','findAll','rows','catch','show','params','create','body','find','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range'];(function(_0x4997a7,_0x47e5a2){var _0xfb48cd=function(_0x1f5ea1){while(--_0x1f5ea1){_0x4997a7['push'](_0x4997a7['shift']());}};_0xfb48cd(++_0x47e5a2);}(_0x4527,0xb7));var _0x7452=function(_0x3113d7,_0x252213){_0x3113d7=_0x3113d7-0x0;var _0xeefc41=_0x4527[_0x3113d7];return _0xeefc41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7452('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7452('0x1'));var rp=require('request-promise');var moment=require(_0x7452('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7452('0x3'));var path=require(_0x7452('0x4'));var sox=require(_0x7452('0x5'));var csv=require(_0x7452('0x6'));var ejs=require(_0x7452('0x7'));var fs=require('fs');var fs_extra=require(_0x7452('0x8'));var _=require('lodash');var squel=require(_0x7452('0x9'));var crypto=require('crypto');var jsforce=require(_0x7452('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7452('0x6'));var querystring=require(_0x7452('0xb'));var Papa=require(_0x7452('0xc'));var Redis=require(_0x7452('0xd'));var authService=require(_0x7452('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7452('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7452('0x10'))(_0x7452('0x11'));var utils=require(_0x7452('0x12'));var config=require(_0x7452('0x13'));var licenseUtil=require(_0x7452('0x14'));var db=require(_0x7452('0x15'))['db'];function respondWithStatusCode(_0x11842f,_0x111fe8){_0x111fe8=_0x111fe8||0xcc;return function(_0xa7c4ba){if(_0xa7c4ba){return _0x11842f[_0x7452('0x16')](_0x111fe8);}return _0x11842f[_0x7452('0x17')](_0x111fe8)['end']();};}function respondWithResult(_0x4b5910,_0x4b1d73){_0x4b1d73=_0x4b1d73||0xc8;return function(_0x18940b){if(_0x18940b){return _0x4b5910[_0x7452('0x17')](_0x4b1d73)[_0x7452('0x18')](_0x18940b);}};}function respondWithFilteredResult(_0x169dd2,_0x43eea6){return function(_0x787f39){if(_0x787f39){var _0x94e7c2=typeof _0x43eea6[_0x7452('0x19')]===_0x7452('0x1a')&&typeof _0x43eea6[_0x7452('0x1b')]===_0x7452('0x1a');var _0x184b58=_0x787f39[_0x7452('0x1c')];var _0x5c2f73=_0x94e7c2?0x0:_0x43eea6['offset'];var _0x33e623=_0x94e7c2?_0x787f39['count']:_0x43eea6[_0x7452('0x19')]+_0x43eea6['limit'];var _0x29c0c7;if(_0x33e623>=_0x184b58){_0x33e623=_0x184b58;_0x29c0c7=0xc8;}else{_0x29c0c7=0xce;}_0x169dd2[_0x7452('0x17')](_0x29c0c7);return _0x169dd2['set'](_0x7452('0x1d'),_0x5c2f73+'-'+_0x33e623+'/'+_0x184b58)[_0x7452('0x18')](_0x787f39);}return null;};}function patchUpdates(_0x17cdf0){return function(_0x53a112){try{jsonpatch['apply'](_0x53a112,_0x17cdf0,!![]);}catch(_0x25531e){return BPromise[_0x7452('0x1e')](_0x25531e);}return _0x53a112['save']();};}function saveUpdates(_0x57132f,_0x5a9754){return function(_0x2cb1bc){if(_0x2cb1bc){return _0x2cb1bc[_0x7452('0x1f')](_0x57132f)['then'](function(_0x1a8f66){return _0x1a8f66;});}return null;};}function removeEntity(_0x4e2ca8,_0x4718c4){return function(_0x306627){if(_0x306627){return _0x306627[_0x7452('0x20')]()['then'](function(){_0x4e2ca8['status'](0xcc)[_0x7452('0x21')]();});}};}function handleEntityNotFound(_0x1fcf01,_0x7c2ac2){return function(_0xc9abbd){if(!_0xc9abbd){_0x1fcf01['sendStatus'](0x194);}return _0xc9abbd;};}function handleError(_0x84c0c5,_0x5e7bb6){_0x5e7bb6=_0x5e7bb6||0x1f4;return function(_0x282ea1){logger['error'](_0x282ea1[_0x7452('0x22')]);if(_0x282ea1[_0x7452('0x23')]){delete _0x282ea1[_0x7452('0x23')];}_0x84c0c5[_0x7452('0x17')](_0x5e7bb6)[_0x7452('0x24')](_0x282ea1);};}exports[_0x7452('0x25')]=function(_0x20af31,_0x4b0842){var _0x5f5744={},_0x3d55d5={},_0x328c36={'count':0x0,'rows':[]};var _0x533f32=_['map'](db[_0x7452('0x26')][_0x7452('0x27')],function(_0x632bdf){return{'name':_0x632bdf[_0x7452('0x28')],'type':_0x632bdf['type'][_0x7452('0x29')]};});_0x3d55d5['model']=_[_0x7452('0x2a')](_0x533f32,_0x7452('0x23'));_0x3d55d5[_0x7452('0x2b')]=_[_0x7452('0x2c')](_0x20af31[_0x7452('0x2b')]);_0x3d55d5['filters']=_['intersection'](_0x3d55d5[_0x7452('0x2d')],_0x3d55d5[_0x7452('0x2b')]);_0x5f5744[_0x7452('0x2e')]=_[_0x7452('0x2f')](_0x3d55d5['model'],qs[_0x7452('0x30')](_0x20af31[_0x7452('0x2b')][_0x7452('0x30')]));_0x5f5744[_0x7452('0x2e')]=_0x5f5744[_0x7452('0x2e')][_0x7452('0x31')]?_0x5f5744[_0x7452('0x2e')]:_0x3d55d5[_0x7452('0x2d')];if(!_0x20af31[_0x7452('0x2b')][_0x7452('0x32')](_0x7452('0x33'))){_0x5f5744['limit']=qs[_0x7452('0x1b')](_0x20af31[_0x7452('0x2b')][_0x7452('0x1b')]);_0x5f5744[_0x7452('0x19')]=qs['offset'](_0x20af31[_0x7452('0x2b')]['offset']);}_0x5f5744['order']=qs[_0x7452('0x34')](_0x20af31[_0x7452('0x2b')][_0x7452('0x34')]);_0x5f5744['where']=qs[_0x7452('0x35')](_[_0x7452('0x36')](_0x20af31['query'],_0x3d55d5[_0x7452('0x35')]),_0x533f32);if(_0x20af31[_0x7452('0x2b')]['filter']){_0x5f5744[_0x7452('0x37')]=_[_0x7452('0x38')](_0x5f5744[_0x7452('0x37')],{'$or':_['map'](_0x533f32,function(_0x5b6c62){if(_0x5b6c62[_0x7452('0x39')]!=='VIRTUAL'){var _0x38ce48={};_0x38ce48[_0x5b6c62[_0x7452('0x23')]]={'$like':'%'+_0x20af31['query'][_0x7452('0x3a')]+'%'};return _0x38ce48;}})});}_0x5f5744=_[_0x7452('0x38')]({},_0x5f5744,_0x20af31[_0x7452('0x3b')]);var _0x5dc769={'where':_0x5f5744[_0x7452('0x37')]};return db[_0x7452('0x26')]['count'](_0x5dc769)[_0x7452('0x3c')](function(_0x59eab0){_0x328c36['count']=_0x59eab0;if(_0x20af31['query'][_0x7452('0x3d')]){_0x5f5744[_0x7452('0x3e')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x7452('0x3f')](_0x5f5744);})[_0x7452('0x3c')](function(_0x117917){_0x328c36[_0x7452('0x40')]=_0x117917;return _0x328c36;})[_0x7452('0x3c')](respondWithFilteredResult(_0x4b0842,_0x5f5744))[_0x7452('0x41')](handleError(_0x4b0842,null));};exports[_0x7452('0x42')]=function(_0x70c353,_0x425fe6){var _0x144286={'raw':!![],'where':{'id':_0x70c353[_0x7452('0x43')]['id']}},_0x19884d={};_0x19884d[_0x7452('0x2d')]=_[_0x7452('0x2c')](db['OpenchannelApplication'][_0x7452('0x27')]);_0x19884d['query']=_[_0x7452('0x2c')](_0x70c353['query']);_0x19884d['filters']=_[_0x7452('0x2f')](_0x19884d[_0x7452('0x2d')],_0x19884d[_0x7452('0x2b')]);_0x144286[_0x7452('0x2e')]=_[_0x7452('0x2f')](_0x19884d[_0x7452('0x2d')],qs[_0x7452('0x30')](_0x70c353[_0x7452('0x2b')][_0x7452('0x30')]));_0x144286[_0x7452('0x2e')]=_0x144286[_0x7452('0x2e')][_0x7452('0x31')]?_0x144286[_0x7452('0x2e')]:_0x19884d['model'];if(_0x70c353[_0x7452('0x2b')][_0x7452('0x3d')]){_0x144286[_0x7452('0x3e')]=[{'all':!![]}];}_0x144286=_[_0x7452('0x38')]({},_0x144286,_0x70c353['options']);return db[_0x7452('0x26')]['find'](_0x144286)[_0x7452('0x3c')](handleEntityNotFound(_0x425fe6,null))[_0x7452('0x3c')](respondWithResult(_0x425fe6,null))['catch'](handleError(_0x425fe6,null));};exports[_0x7452('0x44')]=function(_0x1f602d,_0x44699b){return db[_0x7452('0x26')][_0x7452('0x44')](_0x1f602d[_0x7452('0x45')],{})[_0x7452('0x3c')](respondWithResult(_0x44699b,0xc9))[_0x7452('0x41')](handleError(_0x44699b,null));};exports[_0x7452('0x1f')]=function(_0xecc4cc,_0x1e789e){if(_0xecc4cc[_0x7452('0x45')]['id']){delete _0xecc4cc['body']['id'];}return db[_0x7452('0x26')]['find']({'where':{'id':_0xecc4cc['params']['id']}})[_0x7452('0x3c')](handleEntityNotFound(_0x1e789e,null))[_0x7452('0x3c')](saveUpdates(_0xecc4cc[_0x7452('0x45')],null))[_0x7452('0x3c')](respondWithResult(_0x1e789e,null))[_0x7452('0x41')](handleError(_0x1e789e,null));};exports['destroy']=function(_0xdc1ce5,_0x3ee419){return db[_0x7452('0x26')][_0x7452('0x46')]({'where':{'id':_0xdc1ce5[_0x7452('0x43')]['id']}})[_0x7452('0x3c')](handleEntityNotFound(_0x3ee419,null))[_0x7452('0x3c')](removeEntity(_0x3ee419,null))[_0x7452('0x41')](handleError(_0x3ee419,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 2c3b345..db87d2f 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 _0x6a62=['../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x2447a6,_0x43740d){var _0x5a1aac=function(_0x9e7ae5){while(--_0x9e7ae5){_0x2447a6['push'](_0x2447a6['shift']());}};_0x5a1aac(++_0x43740d);}(_0x6a62,0x116));var _0x26a6=function(_0x168342,_0x1d02a0){_0x168342=_0x168342-0x0;var _0x23452a=_0x6a62[_0x168342];return _0x23452a;};'use strict';var _=require(_0x26a6('0x0'));var util=require(_0x26a6('0x1'));var logger=require(_0x26a6('0x2'))(_0x26a6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x26a6('0x4'));var fs=require('fs');var path=require(_0x26a6('0x5'));var rimraf=require(_0x26a6('0x6'));var config=require(_0x26a6('0x7'));var attributes=require(_0x26a6('0x8'));module[_0x26a6('0x9')]=function(_0x3d9ef1,_0x34d1f6){return _0x3d9ef1[_0x26a6('0xa')](_0x26a6('0xb'),attributes,{'tableName':_0x26a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x26a6('0xd'),'collate':_0x26a6('0xe')});}; \ No newline at end of file +var _0x9dc2=['utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','exports'];(function(_0x57a069,_0x422932){var _0x103532=function(_0x2634b3){while(--_0x2634b3){_0x57a069['push'](_0x57a069['shift']());}};_0x103532(++_0x422932);}(_0x9dc2,0x141));var _0x29dc=function(_0x48c83b,_0x31dcfb){_0x48c83b=_0x48c83b-0x0;var _0x4cec79=_0x9dc2[_0x48c83b];return _0x4cec79;};'use strict';var _=require(_0x29dc('0x0'));var util=require('util');var logger=require(_0x29dc('0x1'))('api');var moment=require(_0x29dc('0x2'));var BPromise=require(_0x29dc('0x3'));var rp=require(_0x29dc('0x4'));var fs=require('fs');var path=require(_0x29dc('0x5'));var rimraf=require(_0x29dc('0x6'));var config=require('../../config/environment');var attributes=require(_0x29dc('0x7'));module[_0x29dc('0x8')]=function(_0x17bc79,_0x262b04){return _0x17bc79['define']('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x29dc('0x9')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 7903c74..571c661 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 _0x97f9=['rpc','../../config/environment','jayson/promise','http','request','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','limit','then','lodash','util','moment','bluebird','ioredis'];(function(_0x4cec38,_0x2a7b0a){var _0x3f3ea2=function(_0xa47495){while(--_0xa47495){_0x4cec38['push'](_0x4cec38['shift']());}};_0x3f3ea2(++_0x2a7b0a);}(_0x97f9,0x1db));var _0x997f=function(_0xbc9b5b,_0xbc64d){_0xbc9b5b=_0xbc9b5b-0x0;var _0x54ab52=_0x97f9[_0xbc9b5b];return _0x54ab52;};'use strict';var _=require(_0x997f('0x0'));var util=require(_0x997f('0x1'));var moment=require(_0x997f('0x2'));var BPromise=require(_0x997f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x997f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x997f('0x5'));var config=require(_0x997f('0x6'));var jayson=require(_0x997f('0x7'));var client=jayson['client'][_0x997f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2079e5,_0x46823,_0x5903b4){return new BPromise(function(_0x239206,_0x3fcbc8){return client[_0x997f('0x9')](_0x2079e5,_0x5903b4)['then'](function(_0x1fd5ee){logger['info'](_0x997f('0xa'),_0x46823,_0x997f('0xb'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x46823,_0x997f('0xb'),JSON[_0x997f('0xc')](_0x1fd5ee));if(_0x1fd5ee[_0x997f('0xd')]){if(_0x1fd5ee[_0x997f('0xd')][_0x997f('0xe')]===0x1f4){logger[_0x997f('0xd')](_0x997f('0xa'),_0x46823,_0x1fd5ee['error']['message']);return _0x3fcbc8(_0x1fd5ee[_0x997f('0xd')][_0x997f('0xf')]);}logger[_0x997f('0xd')](_0x997f('0xa'),_0x46823,_0x1fd5ee['error']['message']);return _0x239206(_0x1fd5ee[_0x997f('0xd')][_0x997f('0xf')]);}else{logger['info'](_0x997f('0xa'),_0x46823,_0x997f('0xb'));_0x239206(_0x1fd5ee['result'][_0x997f('0xf')]);}})['catch'](function(_0x2c0370){logger[_0x997f('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x46823,_0x2c0370);_0x3fcbc8(_0x2c0370);});});}exports[_0x997f('0x10')]=function(_0x19e54b){var _0x4b90df=this;return new Promise(function(_0x15a448,_0x5c450b){return db[_0x997f('0x11')][_0x997f('0x12')](_0x19e54b['body'],{'raw':_0x19e54b['options']?_0x19e54b[_0x997f('0x13')][_0x997f('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19e54b[_0x997f('0x13')]?_0x19e54b['options'][_0x997f('0x15')]||null:null,'attributes':_0x19e54b[_0x997f('0x13')]?_0x19e54b[_0x997f('0x13')]['attributes']||null:null,'limit':_0x19e54b[_0x997f('0x13')]?_0x19e54b[_0x997f('0x13')][_0x997f('0x16')]||null:null})[_0x997f('0x17')](function(_0x5f1bff){logger['info'](_0x997f('0x10'),_0x19e54b);logger['debug']('UpdateOpenchannelApplication',_0x19e54b,JSON[_0x997f('0xc')](_0x5f1bff));_0x15a448(_0x5f1bff);})['catch'](function(_0x1c44fc){logger[_0x997f('0xd')]('UpdateOpenchannelApplication',_0x1c44fc[_0x997f('0xf')],_0x19e54b);_0x5c450b(_0x4b90df[_0x997f('0xd')](0x1f4,_0x1c44fc['message']));});});}; \ No newline at end of file +var _0xaa85=['update','body','options','raw','where','attributes','limit','UpdateOpenchannelApplication','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','OpenchannelApplication'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xaa85,0xcc));var _0x5aa8=function(_0x2c3257,_0x5ea683){_0x2c3257=_0x2c3257-0x0;var _0x5aae4c=_0xaa85[_0x2c3257];return _0x5aae4c;};'use strict';var _=require('lodash');var util=require(_0x5aa8('0x0'));var moment=require('moment');var BPromise=require(_0x5aa8('0x1'));var rs=require(_0x5aa8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5aa8('0x3'))['db'];var utils=require(_0x5aa8('0x4'));var logger=require('../../config/logger')(_0x5aa8('0x5'));var config=require('../../config/environment');var jayson=require(_0x5aa8('0x6'));var client=jayson['client'][_0x5aa8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3b183e,_0x1e92f3,_0x2c0910){return new BPromise(function(_0x27dd51,_0x1f19fc){return client[_0x5aa8('0x8')](_0x3b183e,_0x2c0910)[_0x5aa8('0x9')](function(_0x180aad){logger[_0x5aa8('0xa')](_0x5aa8('0xb'),_0x1e92f3,_0x5aa8('0xc'));logger[_0x5aa8('0xd')](_0x5aa8('0xe'),_0x1e92f3,_0x5aa8('0xc'),JSON[_0x5aa8('0xf')](_0x180aad));if(_0x180aad['error']){if(_0x180aad[_0x5aa8('0x10')]['code']===0x1f4){logger[_0x5aa8('0x10')](_0x5aa8('0xb'),_0x1e92f3,_0x180aad[_0x5aa8('0x10')][_0x5aa8('0x11')]);return _0x1f19fc(_0x180aad[_0x5aa8('0x10')][_0x5aa8('0x11')]);}logger[_0x5aa8('0x10')](_0x5aa8('0xb'),_0x1e92f3,_0x180aad['error'][_0x5aa8('0x11')]);return _0x27dd51(_0x180aad['error'][_0x5aa8('0x11')]);}else{logger[_0x5aa8('0xa')](_0x5aa8('0xb'),_0x1e92f3,'request\x20sent');_0x27dd51(_0x180aad['result'][_0x5aa8('0x11')]);}})[_0x5aa8('0x12')](function(_0x2e73d7){logger[_0x5aa8('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x1e92f3,_0x2e73d7);_0x1f19fc(_0x2e73d7);});});}exports['UpdateOpenchannelApplication']=function(_0x4a3073){var _0x412e62=this;return new Promise(function(_0x5e4d25,_0x3e5717){return db[_0x5aa8('0x13')][_0x5aa8('0x14')](_0x4a3073[_0x5aa8('0x15')],{'raw':_0x4a3073[_0x5aa8('0x16')]?_0x4a3073[_0x5aa8('0x16')][_0x5aa8('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a3073[_0x5aa8('0x16')]?_0x4a3073[_0x5aa8('0x16')][_0x5aa8('0x18')]||null:null,'attributes':_0x4a3073[_0x5aa8('0x16')]?_0x4a3073[_0x5aa8('0x16')][_0x5aa8('0x19')]||null:null,'limit':_0x4a3073['options']?_0x4a3073['options'][_0x5aa8('0x1a')]||null:null})['then'](function(_0x1a2e7f){logger[_0x5aa8('0xa')]('UpdateOpenchannelApplication',_0x4a3073);logger[_0x5aa8('0xd')](_0x5aa8('0x1b'),_0x4a3073,JSON[_0x5aa8('0xf')](_0x1a2e7f));_0x5e4d25(_0x1a2e7f);})[_0x5aa8('0x12')](function(_0x2e2e23){logger[_0x5aa8('0x10')](_0x5aa8('0x1b'),_0x2e2e23[_0x5aa8('0x11')],_0x4a3073);_0x3e5717(_0x412e62[_0x5aa8('0x10')](0x1f4,_0x2e2e23['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index d7a7432..772a84f 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 _0x3764=['../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:destroy','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x8ada96,_0x3a8434){var _0x1d97aa=function(_0x4a7862){while(--_0x4a7862){_0x8ada96['push'](_0x8ada96['shift']());}};_0x1d97aa(++_0x3a8434);}(_0x3764,0x70));var _0x4376=function(_0x3979c6,_0x2a6197){_0x3979c6=_0x3979c6-0x0;var _0x102daf=_0x3764[_0x3979c6];return _0x102daf;};'use strict';var multer=require(_0x4376('0x0'));var util=require(_0x4376('0x1'));var path=require(_0x4376('0x2'));var timeout=require('connect-timeout');var express=require(_0x4376('0x3'));var router=express[_0x4376('0x4')]();var fs_extra=require(_0x4376('0x5'));var auth=require(_0x4376('0x6'));var interaction=require(_0x4376('0x7'));var config=require(_0x4376('0x8'));var controller=require('./openchannelInteraction.controller');router[_0x4376('0x9')]('/',auth[_0x4376('0xa')](),controller[_0x4376('0xb')]);router[_0x4376('0x9')]('/describe',auth[_0x4376('0xa')](),controller[_0x4376('0xc')]);router[_0x4376('0x9')](_0x4376('0xd'),auth[_0x4376('0xa')](),controller[_0x4376('0xe')]);router[_0x4376('0x9')](_0x4376('0xf'),auth[_0x4376('0xa')](),controller[_0x4376('0x10')]);router[_0x4376('0x9')](_0x4376('0x11'),auth[_0x4376('0xa')](),controller[_0x4376('0x12')]);router['post']('/',auth[_0x4376('0xa')](),controller[_0x4376('0x13')]);router[_0x4376('0x14')]('/:id/messages',auth[_0x4376('0xa')](),controller[_0x4376('0x15')]);router[_0x4376('0x14')](_0x4376('0x16'),auth[_0x4376('0xa')](),interaction[_0x4376('0x17')](_0x4376('0x18'),_0x4376('0x19')),controller['addTags']);router[_0x4376('0x1a')]('/:id',auth[_0x4376('0xa')](),interaction[_0x4376('0x17')](_0x4376('0x18'),'openchannelinteraction:update'),controller['update']);router['delete'](_0x4376('0xd'),auth[_0x4376('0xa')](),interaction[_0x4376('0x17')](_0x4376('0x18'),_0x4376('0x1b')),controller['destroy']);router[_0x4376('0x1c')](_0x4376('0x16'),auth[_0x4376('0xa')](),controller['removeTags']);module[_0x4376('0x1d')]=router; \ No newline at end of file +var _0x1134=['../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','/:id/messages','addMessage','tracked','openchannel','openchannelinteraction:addtags','update','delete','destroy','removeTags','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0x1134,0x113));var _0x4113=function(_0x5a79d2,_0x14cf09){_0x5a79d2=_0x5a79d2-0x0;var _0x3b32ae=_0x1134[_0x5a79d2];return _0x3b32ae;};'use strict';var multer=require(_0x4113('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4113('0x1'));var express=require('express');var router=express[_0x4113('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4113('0x3'));var interaction=require(_0x4113('0x4'));var config=require(_0x4113('0x5'));var controller=require(_0x4113('0x6'));router[_0x4113('0x7')]('/',auth[_0x4113('0x8')](),controller[_0x4113('0x9')]);router[_0x4113('0x7')](_0x4113('0xa'),auth[_0x4113('0x8')](),controller[_0x4113('0xb')]);router[_0x4113('0x7')](_0x4113('0xc'),auth[_0x4113('0x8')](),controller[_0x4113('0xd')]);router['get']('/:id/messages',auth[_0x4113('0x8')](),controller[_0x4113('0xe')]);router['get'](_0x4113('0xf'),auth[_0x4113('0x8')](),controller[_0x4113('0x10')]);router[_0x4113('0x11')]('/',auth[_0x4113('0x8')](),controller['create']);router[_0x4113('0x11')](_0x4113('0x12'),auth[_0x4113('0x8')](),controller[_0x4113('0x13')]);router[_0x4113('0x11')]('/:id/tags',auth[_0x4113('0x8')](),interaction[_0x4113('0x14')](_0x4113('0x15'),_0x4113('0x16')),controller['addTags']);router['put'](_0x4113('0xc'),auth[_0x4113('0x8')](),interaction[_0x4113('0x14')](_0x4113('0x15'),'openchannelinteraction:update'),controller[_0x4113('0x17')]);router[_0x4113('0x18')](_0x4113('0xc'),auth[_0x4113('0x8')](),interaction['tracked'](_0x4113('0x15'),'openchannelinteraction:destroy'),controller[_0x4113('0x19')]);router[_0x4113('0x18')]('/:id/tags',auth[_0x4113('0x8')](),controller[_0x4113('0x1a')]);module[_0x4113('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index e56c391..3ba15c8 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 _0x4944=['out','sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0xb70f60,_0x3b97c6){var _0x251460=function(_0xaad499){while(--_0xaad499){_0xb70f60['push'](_0xb70f60['shift']());}};_0x251460(++_0x3b97c6);}(_0x4944,0x6d));var _0x4494=function(_0x515837,_0x6ed7ac){_0x515837=_0x515837-0x0;var _0x2d1734=_0x4944[_0x515837];return _0x2d1734;};'use strict';var Sequelize=require(_0x4494('0x0'));module['exports']={'closed':{'type':Sequelize[_0x4494('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4494('0x2')]},'disposition':{'type':Sequelize[_0x4494('0x3')]},'secondDisposition':{'type':Sequelize[_0x4494('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4494('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x4494('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x4494('0x3')]},'lastMsgAt':{'type':Sequelize[_0x4494('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4494('0x4')]('in',_0x4494('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x4494('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x4494('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x4fd7=['STRING','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x2585af,_0x594303){var _0x284163=function(_0x51c3b8){while(--_0x51c3b8){_0x2585af['push'](_0x2585af['shift']());}};_0x284163(++_0x594303);}(_0x4fd7,0xe6));var _0x74fd=function(_0x334a38,_0xa4b8d7){_0x334a38=_0x334a38-0x0;var _0x2b576c=_0x4fd7[_0x334a38];return _0x2b576c;};'use strict';var Sequelize=require(_0x74fd('0x0'));module[_0x74fd('0x1')]={'closed':{'type':Sequelize[_0x74fd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x74fd('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x74fd('0x4')]},'note':{'type':Sequelize[_0x74fd('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x74fd('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x74fd('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x74fd('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x74fd('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 594e174..6d696cc 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 _0x29e0=['spread','Tag','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','CmContact','firstName','lastName','Attachment','Messages','direction','OpenchannelAccount','Owner','mkdirSync','Openchannel','N.A.','closed','closedAt','threadId','Public','Private','basename','existsSync','pipe','createWriteStream','out','secret','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','stack','name','Users','map','fullname','split','forEach','Tags','TagIds','catch','OpenchannelInteraction','rawAttributes','type','key','query','keys','model','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filters','select','field','color','tools_tags','u.id','u.fullname','from','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','left_join','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','some','compact','isEmpty','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','t.id\x20IN\x20?','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','user','agent','sequelize','toString','Account.key','a.mandatoryDisposition','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','contactName','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','OpenchannelInteractionId','all','show','params','fields','includeAll','merge','options','create','body','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x29e0,0x117));var _0x029e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x029e('0x0'));var rimraf=require(_0x029e('0x1'));var zipdir=require(_0x029e('0x2'));var jsonpatch=require(_0x029e('0x3'));var rp=require(_0x029e('0x4'));var moment=require(_0x029e('0x5'));var BPromise=require(_0x029e('0x6'));var Mustache=require(_0x029e('0x7'));var util=require(_0x029e('0x8'));var path=require(_0x029e('0x9'));var sox=require(_0x029e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x029e('0xb'));var _=require(_0x029e('0xc'));var squel=require('squel');var crypto=require(_0x029e('0xd'));var jsforce=require(_0x029e('0xe'));var deskjs=require(_0x029e('0xf'));var toCsv=require(_0x029e('0x10'));var querystring=require(_0x029e('0x11'));var Papa=require(_0x029e('0x12'));var Redis=require(_0x029e('0x13'));var authService=require(_0x029e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x029e('0x15'));var pdf=require(_0x029e('0x16'));var hardwareService=require(_0x029e('0x17'));var logger=require(_0x029e('0x18'))(_0x029e('0x19'));var utils=require(_0x029e('0x1a'));var config=require(_0x029e('0x1b'));var licenseUtil=require(_0x029e('0x1c'));var db=require(_0x029e('0x1d'))['db'];config[_0x029e('0x1e')]=_[_0x029e('0x1f')](config[_0x029e('0x1e')],{'host':_0x029e('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x029e('0x1e')]));require(_0x029e('0x21'))[_0x029e('0x22')](socket);function respondWithStatusCode(_0x4a8914,_0x11eab3){_0x11eab3=_0x11eab3||0xcc;return function(_0x311834){if(_0x311834){return _0x4a8914[_0x029e('0x23')](_0x11eab3);}return _0x4a8914[_0x029e('0x24')](_0x11eab3)[_0x029e('0x25')]();};}function respondWithResult(_0x54ef54,_0x261489){_0x261489=_0x261489||0xc8;return function(_0x5613bf){if(_0x5613bf){return _0x54ef54['status'](_0x261489)[_0x029e('0x26')](_0x5613bf);}};}function respondWithFilteredResult(_0xc22c3a,_0x2d362d){return function(_0x52384d){if(_0x52384d){var _0xba84bc=typeof _0x2d362d[_0x029e('0x27')]===_0x029e('0x28')&&typeof _0x2d362d[_0x029e('0x29')]===_0x029e('0x28');var _0xf4bd10=_0x52384d[_0x029e('0x2a')];var _0x4ea2fa=_0xba84bc?0x0:_0x2d362d[_0x029e('0x27')];var _0x4f2e86=_0xba84bc?_0x52384d['count']:_0x2d362d[_0x029e('0x27')]+_0x2d362d[_0x029e('0x29')];var _0x4ce66d;if(_0x4f2e86>=_0xf4bd10){_0x4f2e86=_0xf4bd10;_0x4ce66d=0xc8;}else{_0x4ce66d=0xce;}_0xc22c3a[_0x029e('0x24')](_0x4ce66d);return _0xc22c3a[_0x029e('0x2b')](_0x029e('0x2c'),_0x4ea2fa+'-'+_0x4f2e86+'/'+_0xf4bd10)['json'](_0x52384d);}return null;};}function patchUpdates(_0x4308fb){return function(_0x2d2758){try{jsonpatch[_0x029e('0x2d')](_0x2d2758,_0x4308fb,!![]);}catch(_0x35f98e){return BPromise['reject'](_0x35f98e);}return _0x2d2758['save']();};}function saveUpdates(_0x281ca7,_0x58bd88){return function(_0x19d803){if(_0x19d803){return _0x19d803[_0x029e('0x2e')](_0x281ca7)[_0x029e('0x2f')](function(_0x1df2ef){return _0x1df2ef;});}return null;};}function removeEntity(_0x5d0ffb,_0x434717){return function(_0x4336ac){if(_0x4336ac){return _0x4336ac[_0x029e('0x30')]()['then'](function(){_0x5d0ffb[_0x029e('0x24')](0xcc)[_0x029e('0x25')]();});}};}function handleEntityNotFound(_0x5e459c,_0x1e542c){return function(_0x29ef67){if(!_0x29ef67){_0x5e459c[_0x029e('0x23')](0x194);}return _0x29ef67;};}function handleError(_0x5ae45b,_0xab1de6){_0xab1de6=_0xab1de6||0x1f4;return function(_0x5e96a6){logger['error'](_0x5e96a6[_0x029e('0x31')]);if(_0x5e96a6[_0x029e('0x32')]){delete _0x5e96a6[_0x029e('0x32')];}_0x5ae45b[_0x029e('0x24')](_0xab1de6)['send'](_0x5e96a6);};}function getInteractionUsers(_0x60883,_0x26e30d){return new BPromise(function(_0xc19756,_0x4f5230){try{if(_0x26e30d[_0x60883['id']]){_0x60883[_0x029e('0x33')]=_[_0x029e('0x34')](_0x26e30d[_0x60883['id']],function(_0x1a1c7d){return{'id':_0x1a1c7d['id'],'fullname':_0x1a1c7d[_0x029e('0x35')]};});}}catch(_0x298d0c){_0x4f5230(_0x298d0c);}_0xc19756(_0x60883);});}function getInteractionTags(_0x2709b1,_0x1fee58){return new BPromise(function(_0x1dc6e1,_0x5ba765){try{if(_0x2709b1['TagIds']){_0x2709b1['Tags']=[];_0x2709b1['TagIds'][_0x029e('0x36')](',')[_0x029e('0x37')](function(_0x4e83b2){_0x2709b1[_0x029e('0x38')]['push'](_0x1fee58[_0x4e83b2]);});}delete _0x2709b1[_0x029e('0x39')];}catch(_0x13d850){_0x5ba765(_0x13d850);}_0x1dc6e1(_0x2709b1);});}function updateOpenchannelInteraction(_0x1a2fca,_0x15f6b9,_0x3d4b1b){return new BPromise(function(_0x12ba13,_0x169ceb){return getInteractionUsers(_0x1a2fca,_0x3d4b1b)[_0x029e('0x2f')](function(_0x3870c0){return getInteractionTags(_0x3870c0,_0x15f6b9);})['then'](function(_0x2a3bc2){_0x12ba13(_0x2a3bc2);})[_0x029e('0x3a')](function(_0x6fb20e){_0x169ceb(_0x6fb20e);});});}exports['index']=function(_0x1a8f28,_0x326f06){var _0x4aeb3f={},_0x51532b={},_0x5b78eb={'count':0x0,'rows':[]};var _0x131f12=_[_0x029e('0x34')](db[_0x029e('0x3b')][_0x029e('0x3c')],function(_0x1541f9){return{'name':_0x1541f9['fieldName'],'type':_0x1541f9[_0x029e('0x3d')][_0x029e('0x3e')]};});_0x51532b['model']=_[_0x029e('0x34')](_0x131f12,_0x029e('0x32'));_0x51532b[_0x029e('0x3f')]=_[_0x029e('0x40')](_0x1a8f28[_0x029e('0x3f')]);_0x51532b['filters']=_['intersection'](_0x51532b[_0x029e('0x41')],_0x51532b[_0x029e('0x3f')]);_0x4aeb3f[_0x029e('0x42')]=_[_0x029e('0x43')](_0x51532b['model'],qs['fields'](_0x1a8f28[_0x029e('0x3f')]['fields']));_0x4aeb3f[_0x029e('0x42')]=_0x4aeb3f[_0x029e('0x42')]['length']?_0x4aeb3f[_0x029e('0x42')]:_0x51532b[_0x029e('0x41')];if(!_0x1a8f28[_0x029e('0x3f')][_0x029e('0x44')](_0x029e('0x45'))){_0x4aeb3f['limit']=qs[_0x029e('0x29')](_0x1a8f28['query'][_0x029e('0x29')]);_0x4aeb3f[_0x029e('0x27')]=qs[_0x029e('0x27')](_0x1a8f28['query'][_0x029e('0x27')]);}_0x4aeb3f[_0x029e('0x46')]=qs[_0x029e('0x47')](_0x1a8f28[_0x029e('0x3f')][_0x029e('0x47')]);_0x4aeb3f[_0x029e('0x48')]=qs['filters'](_[_0x029e('0x49')](_0x1a8f28[_0x029e('0x3f')],_0x51532b[_0x029e('0x4a')]),_0x131f12);var _0x388c98=[];var _0x2743d0=squel[_0x029e('0x4b')]()['field']('id')[_0x029e('0x4c')](_0x029e('0x32'))[_0x029e('0x4c')](_0x029e('0x4d'))['from'](_0x029e('0x4e'));var _0x6bf545=squel['select']()[_0x029e('0x4c')](_0x029e('0x4f'))[_0x029e('0x4c')](_0x029e('0x50'))[_0x029e('0x4c')]('ui.OpenchannelInteractionId')[_0x029e('0x51')](_0x029e('0x52'),'ui')['left_join'](_0x029e('0x53'),'u',_0x029e('0x54'));var _0x2c32cd=squel['select']()['from']('openchannel_interactions','i')['left_join'](_0x029e('0x55'),'c',_0x029e('0x56'))['left_join'](_0x029e('0x53'),'o',_0x029e('0x57'))[_0x029e('0x58')](_0x029e('0x59'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0x029e('0x58')](_0x029e('0x5a'),'me',_0x029e('0x5b'))[_0x029e('0x58')](_0x029e('0x5c'),'it',_0x029e('0x5d'))[_0x029e('0x58')](_0x029e('0x4e'),'t','t.id\x20=\x20it.TagId');var _0x160ba0=squel[_0x029e('0x5e')]();var _0x503b88=[];var _0x19a7e2=squel[_0x029e('0x5e')]();var _0x930809;if(_0x1a8f28['query'][_0x029e('0x5f')]){_0x930809=as[_0x029e('0x60')](_0x1a8f28[_0x029e('0x3f')][_0x029e('0x5f')]);var _0x3b2205=_0x930809['sqlOperator'];for(var _0x2b32ba=0x0;_0x2b32ba<_0x930809[_0x029e('0x61')][_0x029e('0x62')];_0x2b32ba++){var _0xb434d0=_0x930809['conditions'][_0x2b32ba];var _0x52a7c7='i';var _0x200064=_[_0x029e('0x63')](_0x131f12,[_0x029e('0x32'),_0xb434d0[_0x029e('0x4c')]]);if(!_0x200064){switch(_0xb434d0[_0x029e('0x4c')]){case _0x029e('0x64'):if(_0xb434d0[_0x029e('0x65')]==0x1){_0x2c32cd[_0x029e('0x66')]('`'+_0xb434d0[_0x029e('0x4c')]+_0x029e('0x67'));}else{_0x2c32cd['having']('`'+_0xb434d0[_0x029e('0x4c')]+_0x029e('0x68'));}break;case _0x029e('0x69'):if(_0xb434d0[_0x029e('0x6a')]===_0x029e('0x6b')){if(_0xb434d0[_0x029e('0x65')][_0x029e('0x36')]('\x20')['length']>0x1){_0x160ba0[_0x3b2205](_0x029e('0x6c'),qs[_0x029e('0x6d')](_0xb434d0[_0x029e('0x65')]),null);}else{var _0xab1e5a='%'+_0xb434d0[_0x029e('0x65')]+'%';_0x160ba0[_0x3b2205](_0x029e('0x6e'),_0xab1e5a,_0xab1e5a,_0xab1e5a);}}else{_0x200064=_[_0x029e('0x63')](_0x131f12,['name',_0x029e('0x6f')]);_0xb434d0[_0x029e('0x4c')]=_0x029e('0x6f');_0x2b0a43=as[_0x029e('0x70')](_0x52a7c7,_0x200064[_0x029e('0x3d')],_0xb434d0);_0x160ba0[_0x3b2205](_0x2b0a43[_0x029e('0x71')],_0x2b0a43[_0x029e('0x65')][_0x029e('0x72')],_0x2b0a43[_0x029e('0x65')][_0x029e('0x25')]);}break;case'Tag':var _0xdbd85=_0xb434d0['value'][_0x029e('0x36')](',')[_0x029e('0x34')](function(_0x57493f){return Number(_0x57493f);});_0xdbd85[_0x029e('0x37')](function(_0x3e8855){_0x19a7e2['or'](_0x029e('0x73'),'%,'+_0x3e8855+',%');});_0x503b88=_[_0x029e('0x74')](_0x503b88,_0xdbd85);break;case _0x029e('0x75'):if(_0xb434d0['operator']===_0x029e('0x6b')){_0x160ba0[_0x3b2205]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xb434d0[_0x029e('0x65')]+'%',null);}else{_0x200064=_[_0x029e('0x63')](_0x131f12,[_0x029e('0x32'),_0x029e('0x76')]);_0xb434d0[_0x029e('0x4c')]='UserId';_0x2b0a43=as[_0x029e('0x70')](_0x52a7c7,_0x200064[_0x029e('0x3d')],_0xb434d0);_0x160ba0[_0x3b2205](_0x2b0a43['text'],_0x2b0a43[_0x029e('0x65')][_0x029e('0x72')],_0x2b0a43[_0x029e('0x65')][_0x029e('0x25')]);}break;case'body':_0x2b0a43=as['buildExpression']('me',null,_0xb434d0);_0x160ba0[_0x3b2205](_0x2b0a43[_0x029e('0x71')],_0x2b0a43[_0x029e('0x65')][_0x029e('0x72')],_0x2b0a43[_0x029e('0x65')][_0x029e('0x25')]);break;}}else{var _0x2b0a43=as[_0x029e('0x70')](_0x52a7c7,_0x200064[_0x029e('0x3d')],_0xb434d0);_0x160ba0[_0x3b2205](_0x2b0a43['text'],_0x2b0a43[_0x029e('0x65')][_0x029e('0x72')],_0x2b0a43[_0x029e('0x65')]['end']);}}}else{var _0x27ff12=_(_0x1a8f28[_0x029e('0x3f')])[_0x029e('0x40')]()[_0x029e('0x34')](function(_0x4a1558){return _[_0x029e('0x77')](_0x131f12,[_0x029e('0x32'),_0x4a1558])?_0x4a1558:undefined;})[_0x029e('0x78')]()[_0x029e('0x65')]();if(!_[_0x029e('0x79')](_0x27ff12)){_0x27ff12['forEach'](function(_0x29afa7){if(_0x29afa7==='OpenchannelAccountId'){_0x2c32cd[_0x029e('0x48')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x029e('0x7a')](_0x1a8f28[_0x029e('0x3f')][_0x29afa7]));}else if(_0x29afa7===_0x029e('0x7b')){var _0x418c2a=JSON[_0x029e('0x7c')](_0x1a8f28[_0x029e('0x3f')][_0x29afa7])[_0x029e('0x7d')];var _0x54d3f7=JSON[_0x029e('0x7c')](_0x1a8f28[_0x029e('0x3f')][_0x29afa7])[_0x029e('0x7e')];_0x2c32cd['where'](_0x029e('0x7f'),_0x418c2a,_0x54d3f7);}else{if(_0x1a8f28[_0x029e('0x3f')][_0x29afa7]===_0x029e('0x80')){_0x2c32cd[_0x029e('0x48')]('i.'+_0x29afa7+_0x029e('0x81'));}else{_0x2c32cd[_0x029e('0x48')]('i.'+_0x29afa7+_0x029e('0x82'),_0x1a8f28['query'][_0x29afa7]);}}});}if(_0x1a8f28['query']['read']){if(_0x1a8f28[_0x029e('0x3f')][_0x029e('0x83')]==0x1){_0x2c32cd[_0x029e('0x66')](_0x029e('0x84'));}else{_0x2c32cd[_0x029e('0x66')]('`unreadMessages`\x20>\x200');}}if(_0x1a8f28[_0x029e('0x3f')][_0x029e('0x85')]){_0x503b88=_[_0x029e('0x86')](_0x1a8f28[_0x029e('0x3f')][_0x029e('0x85')])?_0x1a8f28['query']['tag']:new Array(_0x1a8f28[_0x029e('0x3f')][_0x029e('0x85')]);_0x503b88[_0x029e('0x37')](function(_0x5216f8){_0x19a7e2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5216f8+',%');});}if(_0x1a8f28[_0x029e('0x3f')]['filter']){var _0x3dbfbd=_0x1a8f28[_0x029e('0x3f')][_0x029e('0x87')]['replace']('\x5c','\x5c\x5c')[_0x029e('0x88')](/'/g,'\x27\x27');if(qs[_0x029e('0x89')](_0x3dbfbd)){_0x160ba0['or'](_0x029e('0x8a'),_0x3dbfbd+'%');}else{_0x160ba0['or'](_0x029e('0x8b'),qs[_0x029e('0x6d')](_0x3dbfbd))['or']('i.from\x20LIKE\x20?',_0x3dbfbd+'%')['or'](_0x029e('0x8c'),_0x3dbfbd+'%');}}}_0x2c32cd[_0x029e('0x48')](_0x160ba0);_0x2c32cd['group'](_0x029e('0x8d'));var _0x218b75={'type':db[_0x029e('0x8e')][_0x029e('0x8f')][_0x029e('0x90')],'raw':!![]};var _0x30ae2e=_0x2c32cd[_0x029e('0x91')]();_0x30ae2e['field']('i.id');_0x30ae2e[_0x029e('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x4aeb3f['order']){_0x4aeb3f[_0x029e('0x46')][_0x029e('0x37')](function(_0x3e5a30){var _0x651032=_0x3e5a30[0x0]==='contactName'?_0x3e5a30[0x0]:'i.'+_0x3e5a30[0x0];_0x2c32cd[_0x029e('0x46')](_0x651032,_0x3e5a30[0x1]==='DESC'?![]:!![]);});}if(!_[_0x029e('0x79')](_0x503b88)){_0x2c32cd[_0x029e('0x66')](_0x19a7e2);_0x30ae2e[_0x029e('0x48')](_0x029e('0x92'),_0x503b88);}BPromise['resolve']()['then'](function(){if(!_0x930809){if(_0x1a8f28[_0x029e('0x3f')][_0x029e('0x93')])return;_0x30ae2e[_0x029e('0x48')](_0x029e('0x94'));_0x2c32cd[_0x029e('0x48')](_0x029e('0x94'));return;}if(_0x1a8f28['user'][_0x029e('0x95')]!=='agent')return;return _0x1a8f28['user'][_0x029e('0x96')]({'attributes':['id'],'raw':!![]})[_0x029e('0x2f')](function(_0x533b04){if(_[_0x029e('0x79')](_0x533b04)){_0x30ae2e['where'](_0x029e('0x97'));_0x2c32cd[_0x029e('0x48')](_0x029e('0x97'));}else{_0x30ae2e['where'](_0x029e('0x98'),_[_0x029e('0x34')](_0x533b04,'id'));_0x2c32cd[_0x029e('0x48')](_0x029e('0x98'),_[_0x029e('0x34')](_0x533b04,'id'));}});})['then'](function(){if(_0x1a8f28[_0x029e('0x99')][_0x029e('0x95')]===_0x029e('0x9a')&&!_0x930809&&!_0x1a8f28[_0x029e('0x3f')]['OpenchannelAccountId'])return[];return db[_0x029e('0x9b')][_0x029e('0x3f')](_0x30ae2e[_0x029e('0x9c')](),_0x218b75);})[_0x029e('0x2f')](function(_0x2dd112){_0x5b78eb['count']=_0x2dd112['length'];if(_0x5b78eb[_0x029e('0x2a')]===0x0)return[];return db[_0x029e('0x9b')][_0x029e('0x3f')](_0x2743d0[_0x029e('0x9c')](),_0x218b75)['then'](function(_0x147e40){_0x388c98=_['keyBy'](_0x147e40,'id');_0x218b75=_['merge'](_0x218b75,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1a8f28['query']['fields']){_0x4aeb3f[_0x029e('0x42')][_0x029e('0x37')](function(_0x2b8aad){_0x2c32cd[_0x029e('0x4c')]('i.'+_0x2b8aad);});}else{_0x2c32cd[_0x029e('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x029e('0x64'));_0x2c32cd[_0x029e('0x4c')]('a.key',_0x029e('0x9d'));_0x2c32cd[_0x029e('0x4c')](_0x029e('0x9e'),'Account.mandatoryDisposition');_0x2c32cd[_0x029e('0x4c')](_0x029e('0x9f'),_0x029e('0xa0'));_0x2c32cd['field']('i.*');_0x2c32cd[_0x029e('0x4c')](_0x029e('0xa1'),_0x029e('0xa2'));_0x2c32cd[_0x029e('0x4c')](_0x029e('0xa3'),_0x029e('0xa4'));_0x2c32cd[_0x029e('0x4c')](_0x029e('0xa5'),_0x029e('0xa6'));_0x2c32cd[_0x029e('0x4c')]('c.phone',_0x029e('0xa7'));_0x2c32cd[_0x029e('0x4c')](_0x029e('0xa8'),'Contact.mobile');_0x2c32cd[_0x029e('0x4c')](_0x029e('0xa9'),_0x029e('0xaa'));_0x2c32cd[_0x029e('0x4c')](_0x029e('0xab'),_0x029e('0xac'));_0x2c32cd[_0x029e('0x4c')]('o.internal','Owner.internal');_0x2c32cd[_0x029e('0x4c')](_0x029e('0xad'),'TagIds');}if(_0x4aeb3f['limit'])_0x2c32cd[_0x029e('0x29')](_0x4aeb3f[_0x029e('0x29')]);if(_0x4aeb3f['offset'])_0x2c32cd[_0x029e('0x27')](_0x4aeb3f[_0x029e('0x27')]);return db[_0x029e('0x9b')][_0x029e('0x3f')](_0x2c32cd[_0x029e('0x9c')](),_0x218b75);})[_0x029e('0x2f')](function(_0xe80a2f){if(_0xe80a2f[_0x029e('0x62')]>0x0)_0x6bf545[_0x029e('0x48')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x029e('0x34')](_0xe80a2f,'id'));return db[_0x029e('0x9b')][_0x029e('0x3f')](_0x6bf545[_0x029e('0x9c')](),_0x218b75)[_0x029e('0x2f')](function(_0x176f5d){var _0x34f7cb=_[_0x029e('0xae')](_0x176f5d,_0x029e('0xaf'));var _0x2ca41c=[];_0xe80a2f[_0x029e('0x37')](function(_0x55488a){_0x2ca41c['push'](updateOpenchannelInteraction(_0x55488a,_0x388c98,_0x34f7cb));});return BPromise[_0x029e('0xb0')](_0x2ca41c);});});})[_0x029e('0x2f')](function(_0x4d4294){_0x5b78eb['rows']=_0x4d4294;return _0x5b78eb;})['then'](respondWithFilteredResult(_0x326f06,_0x4aeb3f))[_0x029e('0x3a')](handleError(_0x326f06,null));};exports[_0x029e('0xb1')]=function(_0x321c5b,_0x44b8ef){var _0x3b5dfb={};if(_0x321c5b[_0x029e('0x3f')][_0x029e('0x3d')]&&_0x321c5b['query'][_0x029e('0x3d')]===_0x029e('0x51')){_0x3b5dfb[_0x029e('0x51')]=_0x321c5b[_0x029e('0xb2')]['id'];}else{_0x3b5dfb['id']=_0x321c5b[_0x029e('0xb2')]['id'];}var _0x305c20={'raw':![],'where':_0x3b5dfb},_0x5f3a0e={};_0x5f3a0e[_0x029e('0x41')]=_['keys'](db[_0x029e('0x3b')]['rawAttributes']);_0x5f3a0e[_0x029e('0x3f')]=_['keys'](_0x321c5b[_0x029e('0x3f')]);_0x5f3a0e[_0x029e('0x4a')]=_['intersection'](_0x5f3a0e[_0x029e('0x41')],_0x5f3a0e[_0x029e('0x3f')]);_0x305c20['attributes']=_[_0x029e('0x43')](_0x5f3a0e['model'],qs[_0x029e('0xb3')](_0x321c5b[_0x029e('0x3f')][_0x029e('0xb3')]));_0x305c20[_0x029e('0x42')]=_0x305c20[_0x029e('0x42')]['length']?_0x305c20[_0x029e('0x42')]:_0x5f3a0e[_0x029e('0x41')];if(_0x321c5b[_0x029e('0x3f')][_0x029e('0xb4')]){_0x305c20['include']=[{'all':!![]}];}_0x305c20=_[_0x029e('0xb5')]({},_0x305c20,_0x321c5b[_0x029e('0xb6')]);return db[_0x029e('0x3b')]['find'](_0x305c20)['then'](handleEntityNotFound(_0x44b8ef,null))[_0x029e('0x2f')](respondWithResult(_0x44b8ef,null))['catch'](handleError(_0x44b8ef,null));};exports['create']=function(_0x380e83,_0x26d346){return db['OpenchannelInteraction'][_0x029e('0xb7')](_0x380e83[_0x029e('0xb8')],{})[_0x029e('0x2f')](respondWithResult(_0x26d346,0xc9))[_0x029e('0x3a')](handleError(_0x26d346,null));};exports[_0x029e('0x2e')]=function(_0x17e329,_0x23da5c){if(_0x17e329[_0x029e('0xb8')]['id']){delete _0x17e329[_0x029e('0xb8')]['id'];}return db['OpenchannelInteraction'][_0x029e('0x63')]({'where':{'id':_0x17e329[_0x029e('0xb2')]['id']}})[_0x029e('0x2f')](handleEntityNotFound(_0x23da5c,null))[_0x029e('0x2f')](saveUpdates(_0x17e329[_0x029e('0xb8')],null))[_0x029e('0x2f')](respondWithResult(_0x23da5c,null))[_0x029e('0x3a')](handleError(_0x23da5c,null));};exports[_0x029e('0x30')]=function(_0x3c3e8d,_0x369a12){return db[_0x029e('0x3b')][_0x029e('0x63')]({'where':{'id':_0x3c3e8d[_0x029e('0xb2')]['id']}})[_0x029e('0x2f')](handleEntityNotFound(_0x369a12,null))[_0x029e('0x2f')](removeEntity(_0x369a12,null))[_0x029e('0x3a')](handleError(_0x369a12,null));};exports[_0x029e('0xb9')]=function(_0x243d79,_0x4ca07e){return db[_0x029e('0x3b')][_0x029e('0xb9')]()[_0x029e('0x2f')](respondWithResult(_0x4ca07e,null))[_0x029e('0x3a')](handleError(_0x4ca07e,null));};exports[_0x029e('0xba')]=function(_0x4a7a70,_0x26a984,_0x15dddd){return db[_0x029e('0xbb')]['find']({'where':{'id':_0x4a7a70[_0x029e('0xb2')]['id']}})[_0x029e('0x2f')](handleEntityNotFound(_0x26a984,null))[_0x029e('0x2f')](function(_0x16ec42){if(_0x16ec42){return _0x16ec42[_0x029e('0xba')](_0x4a7a70['body']['ids'],_[_0x029e('0xbc')](_0x4a7a70[_0x029e('0xb8')],[_0x029e('0xbd'),'id'])||{});}})[_0x029e('0x2f')](respondWithResult(_0x26a984,null))['catch'](handleError(_0x26a984,null));};exports[_0x029e('0xbe')]=function(_0x4ceefd,_0x165fe4,_0x490990){var _0x25595c={'raw':![],'where':{}};var _0x4d9fd0={};var _0x590048={'count':0x0,'rows':[]};return db[_0x029e('0x3b')][_0x029e('0xbf')]({'where':{'id':_0x4ceefd[_0x029e('0xb2')]['id']}})[_0x029e('0x2f')](handleEntityNotFound(_0x165fe4,null))['then'](function(_0x5b618e){if(_0x5b618e){_0x4d9fd0[_0x029e('0x41')]=_[_0x029e('0x40')](db[_0x029e('0xbb')][_0x029e('0x3c')]);_0x4d9fd0[_0x029e('0x3f')]=_['keys'](_0x4ceefd[_0x029e('0x3f')]);_0x4d9fd0['filters']=_[_0x029e('0x43')](_0x4d9fd0[_0x029e('0x41')],_0x4d9fd0['query']);_0x25595c[_0x029e('0x42')]=_['intersection'](_0x4d9fd0[_0x029e('0x41')],qs[_0x029e('0xb3')](_0x4ceefd[_0x029e('0x3f')][_0x029e('0xb3')]));_0x25595c[_0x029e('0x42')]=_0x25595c[_0x029e('0x42')][_0x029e('0x62')]?_0x25595c[_0x029e('0x42')]:_0x4d9fd0['model'];if(!_0x4ceefd[_0x029e('0x3f')][_0x029e('0x44')](_0x029e('0x45'))){_0x25595c['limit']=qs[_0x029e('0x29')](_0x4ceefd[_0x029e('0x3f')][_0x029e('0x29')]);_0x25595c[_0x029e('0x27')]=qs[_0x029e('0x27')](_0x4ceefd['query'][_0x029e('0x27')]);}_0x25595c[_0x029e('0x46')]=qs[_0x029e('0x47')](_0x4ceefd[_0x029e('0x3f')][_0x029e('0x47')]);_0x25595c[_0x029e('0x48')]=qs[_0x029e('0x4a')](_['pick'](_0x4ceefd[_0x029e('0x3f')],_0x4d9fd0['filters']));_0x25595c['where'][_0x029e('0xaf')]=_0x5b618e['id'];if(_0x4ceefd[_0x029e('0x3f')][_0x029e('0x87')]){_0x25595c['where']=_[_0x029e('0xb5')](_0x25595c[_0x029e('0x48')],{'$or':_['map'](_0x25595c[_0x029e('0x42')],function(_0x36cde4){var _0xa667c5={};_0xa667c5[_0x36cde4]={'$like':'%'+_0x4ceefd[_0x029e('0x3f')][_0x029e('0x87')]+'%'};return _0xa667c5;})});}if(_0x4ceefd[_0x029e('0x3f')][_0x029e('0x7d')]){var _0x48fcd0=_0x4ceefd[_0x029e('0x3f')][_0x029e('0x7d')][_0x029e('0x36')](',');var _0x46cbf1={};_0x46cbf1[_0x48fcd0[0x0]]={'$gte':moment(_0x48fcd0[0x1])[_0x029e('0xc0')](_0x029e('0xc1'))};_0x25595c['where']=_[_0x029e('0xb5')](_0x25595c[_0x029e('0x48')],_0x46cbf1);}_0x25595c=_[_0x029e('0xb5')]({},_0x25595c,_0x4ceefd[_0x029e('0xb6')]);return db[_0x029e('0xbb')]['count']({'where':_0x25595c['where']})[_0x029e('0x2f')](function(_0x4ce21e){_0x590048[_0x029e('0x2a')]=_0x4ce21e;if(_0x4ceefd[_0x029e('0x3f')][_0x029e('0xb4')]){_0x25595c[_0x029e('0xc2')]=[{'all':!![]}];}return db[_0x029e('0xbb')]['findAll'](_0x25595c);})['then'](function(_0x57ce56){_0x590048['rows']=_0x57ce56;return _0x590048;});}})[_0x029e('0x2f')](respondWithFilteredResult(_0x165fe4,_0x25595c))[_0x029e('0x3a')](handleError(_0x165fe4,null));};exports[_0x029e('0xc3')]=function(_0x64c38d,_0x52a447,_0x22d09d){return db['OpenchannelInteraction'][_0x029e('0x63')]({'where':{'id':_0x64c38d[_0x029e('0xb2')]['id']}})[_0x029e('0x2f')](handleEntityNotFound(_0x52a447,null))[_0x029e('0x2f')](function(_0x40ce30){if(_0x40ce30){return _0x40ce30[_0x029e('0xc4')](_0x64c38d[_0x029e('0xb8')][_0x029e('0xbd')],_[_0x029e('0xbc')](_0x64c38d[_0x029e('0xb8')],[_0x029e('0xbd'),'id'])||{})[_0x029e('0xc5')](function(){return db[_0x029e('0xc6')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x64c38d[_0x029e('0xb8')][_0x029e('0xbd')]}});})['then'](function(_0x41ac30){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x64c38d[_0x029e('0xb2')]['id']),'tags':_0x41ac30||[]});return{'id':Number(_0x64c38d['params']['id']),'tags':_0x41ac30||[]};});}})[_0x029e('0x2f')](respondWithResult(_0x52a447,null))[_0x029e('0x3a')](handleError(_0x52a447,null));};exports['removeTags']=function(_0x2c12fa,_0x3736f4,_0x8e298){return db['OpenchannelInteraction']['find']({'where':{'id':_0x2c12fa[_0x029e('0xb2')]['id']}})['then'](handleEntityNotFound(_0x3736f4,null))[_0x029e('0x2f')](function(_0x183d53){if(_0x183d53){return _0x183d53[_0x029e('0xc7')](_0x2c12fa[_0x029e('0x3f')][_0x029e('0xbd')]);}})[_0x029e('0x2f')](respondWithStatusCode(_0x3736f4,null))[_0x029e('0x3a')](handleError(_0x3736f4,null));};exports[_0x029e('0xc8')]=function(_0x4a6330,_0x5f4aca){var _0x681b60=moment()[_0x029e('0xc9')]()['toString']();var _0x4c62f2=path[_0x029e('0xca')](config[_0x029e('0xcb')],_0x029e('0xcc'),_0x029e('0xcd'),_0x029e('0xce'));var _0x3c7c8e=path[_0x029e('0xca')](config[_0x029e('0xcb')],_0x029e('0xcc'),'files',_0x029e('0xcf'));var _0x10feaa=path[_0x029e('0xca')](_0x4c62f2,_0x681b60);var _0x455af6=util[_0x029e('0xc0')](_0x029e('0xd0'),_0x4a6330['params']['id'],_0x681b60);var _0x2fcaaa=path[_0x029e('0xca')](_0x4c62f2,_0x455af6);var _0x1a15dd=[];_0x1a15dd['push']({'model':db[_0x029e('0x75')],'as':_0x029e('0x75'),'attributes':['id',_0x029e('0x35')],'raw':!![]});_0x1a15dd[_0x029e('0xd1')]({'model':db[_0x029e('0xd2')],'as':_0x029e('0x69'),'attributes':['id',_0x029e('0xd3'),_0x029e('0xd4')],'raw':!![]});if(_0x4a6330[_0x029e('0x3f')][_0x029e('0xcf')]){_0x1a15dd[_0x029e('0xd1')]({'model':db['Attachment'],'as':_0x029e('0xd5'),'raw':!![]});}var _0x4cc623=[{'model':db['OpenchannelMessage'],'as':_0x029e('0xd6'),'attributes':['id',_0x029e('0xb8'),_0x029e('0x7b'),_0x029e('0xd7'),'secret',_0x029e('0x83')],'include':_0x1a15dd}];_0x4cc623[_0x029e('0xd1')]({'model':db[_0x029e('0xd8')],'as':'Account','attributes':['id',_0x029e('0x32')]});_0x4cc623['push']({'model':db['User'],'as':_0x029e('0xd9'),'attributes':['id',_0x029e('0x35')]});return db[_0x029e('0x3b')][_0x029e('0x63')]({'where':{'id':_0x4a6330[_0x029e('0xb2')]['id']},'include':_0x4cc623})[_0x029e('0x2f')](handleEntityNotFound(_0x5f4aca,null))[_0x029e('0x2f')](function(_0x4f7cf3){if(_0x4f7cf3){var _0x561c6b=_0x4f7cf3['get']({'plain':!![]});fs[_0x029e('0xda')](_0x10feaa);var _0x1d6bae={'channel':_0x029e('0xdb'),'account':_0x561c6b['Account'][_0x029e('0x32')],'agent':_0x561c6b['Owner']?_0x561c6b['Owner'][_0x029e('0x35')]:_0x029e('0xdc'),'createdAt':moment(_0x561c6b[_0x029e('0x7b')])['format'](_0x029e('0xc1'))[_0x029e('0x9c')](),'closedAt':_0x561c6b[_0x029e('0xdd')]?moment(_0x561c6b[_0x029e('0xde')])[_0x029e('0xc0')](_0x029e('0xc1'))[_0x029e('0x9c')]():'','disposition':_0x561c6b['disposition'],'visibility':_0x561c6b[_0x029e('0xdf')]?_0x029e('0xe0'):_0x029e('0xe1'),'messages':_(_0x561c6b[_0x029e('0xd6')])[_0x029e('0x87')]({'secret':![]})['map'](function(_0x5322e0){if(_0x5322e0[_0x029e('0xd5')]){var _0x18fb39=path[_0x029e('0xca')](_0x3c7c8e,_0x5322e0['Attachment'][_0x029e('0xe2')]);if(fs[_0x029e('0xe3')](_0x18fb39)){fs['createReadStream'](_0x18fb39)[_0x029e('0xe4')](fs[_0x029e('0xe5')](path[_0x029e('0xca')](_0x10feaa,_0x5322e0['Attachment']['basename'])));}}return{'date':moment(_0x5322e0[_0x029e('0x7b')])[_0x029e('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')[_0x029e('0x9c')](),'sender':_0x5322e0['direction']===_0x029e('0xe6')?_0x5322e0[_0x029e('0x75')]?_0x5322e0['User'][_0x029e('0x35')]:'System':_0x5322e0[_0x029e('0x69')][_0x029e('0xd3')]+(_0x5322e0[_0x029e('0x69')][_0x029e('0xd4')]?'\x20'+_0x5322e0['Contact'][_0x029e('0xd4')]:''),'body':_0x5322e0['Attachment']?_0x5322e0[_0x029e('0xd5')][_0x029e('0xe2')]:_0x5322e0[_0x029e('0xb8')],'direction':_0x5322e0[_0x029e('0xd7')]==='out'?'A':'C','secret':_0x5322e0[_0x029e('0xe7')],'read':_0x5322e0['read'],'attachment':_0x5322e0[_0x029e('0xd5')]};})['value']()};return ejs[_0x029e('0xe8')](path[_0x029e('0xca')](config[_0x029e('0xcb')],_0x029e('0xcc'),_0x029e('0xe9'),_0x029e('0xea')),{'interaction':_0x1d6bae})['then'](function(_0x431979){var _0x177de7=path['join'](_0x10feaa,_0x029e('0xeb')+_0x561c6b['id']+'-'+_0x681b60+'.pdf');var _0x396204={'path':_0x177de7,'channel':_0x029e('0xdb'),'interactionId':_0x561c6b['id']};return pdf[_0x029e('0xec')](_0x431979,_0x396204);})[_0x029e('0x2f')](function(){return new BPromise(function(_0x4d14e8,_0x5e8ffe){zipdir(_0x10feaa,{'saveTo':_0x2fcaaa},function(_0x1fba0c,_0x4b42e9){if(_0x1fba0c)return _0x5e8ffe(_0x1fba0c);return _0x4d14e8(_0x4b42e9);});})[_0x029e('0x2f')](function(){return new BPromise(function(_0x59804a,_0x5b125e){rimraf(_0x10feaa,function(_0x403b24){if(_0x403b24)_0x5b125e(_0x403b24);return _0x59804a();});});})[_0x029e('0x2f')](function(){return _0x5f4aca['download'](_0x2fcaaa,_0x455af6,function(_0x23ec1c){if(_0x23ec1c){console[_0x029e('0xed')]('err',_0x23ec1c);}else{fs['unlinkSync'](_0x2fcaaa);}});});});}else{return _0x5f4aca[_0x029e('0x23')](0xc8);}})['catch'](handleError(_0x5f4aca,null));}; \ No newline at end of file +var _0xaaa2=['then','destroy','sendStatus','error','name','send','fullname','TagIds','Tags','split','forEach','push','catch','OpenchannelInteraction','rawAttributes','type','map','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','field','from','tools_tags','select','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','user','sequelize','toString','count','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','show','params','includeAll','include','merge','options','create','update','describe','addMessage','OpenchannelMessage','omit','ids','findOne','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','join','root','server','files','tmp','attachments','Attachment','direction','secret','OpenchannelAccount','User','Owner','get','mkdirSync','Account','N.A.','closedAt','disposition','threadId','Public','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','lastName','downloadInteraction.ejs','.pdf','Openchannel','createPdfFromHTML','download','log','err','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','offset','undefined','limit','set','apply','save'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xaaa2,0x1a3));var _0x2aaa=function(_0x486e28,_0x98dbe){_0x486e28=_0x486e28-0x0;var _0xa404d0=_0xaaa2[_0x486e28];return _0xa404d0;};'use strict';var emlformat=require(_0x2aaa('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2aaa('0x1'));var rp=require(_0x2aaa('0x2'));var moment=require(_0x2aaa('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2aaa('0x4'));var path=require(_0x2aaa('0x5'));var sox=require(_0x2aaa('0x6'));var csv=require(_0x2aaa('0x7'));var ejs=require(_0x2aaa('0x8'));var fs=require('fs');var fs_extra=require(_0x2aaa('0x9'));var _=require('lodash');var squel=require(_0x2aaa('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2aaa('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2aaa('0xc'));var Papa=require(_0x2aaa('0xd'));var Redis=require(_0x2aaa('0xe'));var authService=require(_0x2aaa('0xf'));var qs=require(_0x2aaa('0x10'));var as=require(_0x2aaa('0x11'));var pdf=require(_0x2aaa('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2aaa('0x13'))(_0x2aaa('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2aaa('0x15'));var db=require(_0x2aaa('0x16'))['db'];config[_0x2aaa('0x17')]=_[_0x2aaa('0x18')](config[_0x2aaa('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x2aaa('0x19'))(new Redis(config[_0x2aaa('0x17')]));require(_0x2aaa('0x1a'))[_0x2aaa('0x1b')](socket);function respondWithStatusCode(_0x45663d,_0x4dcdb1){_0x4dcdb1=_0x4dcdb1||0xcc;return function(_0x339abc){if(_0x339abc){return _0x45663d['sendStatus'](_0x4dcdb1);}return _0x45663d[_0x2aaa('0x1c')](_0x4dcdb1)[_0x2aaa('0x1d')]();};}function respondWithResult(_0x57850a,_0x10d8c1){_0x10d8c1=_0x10d8c1||0xc8;return function(_0x78fae3){if(_0x78fae3){return _0x57850a[_0x2aaa('0x1c')](_0x10d8c1)[_0x2aaa('0x1e')](_0x78fae3);}};}function respondWithFilteredResult(_0x48ed6e,_0x2be293){return function(_0x378452){if(_0x378452){var _0x515134=typeof _0x2be293[_0x2aaa('0x1f')]===_0x2aaa('0x20')&&typeof _0x2be293[_0x2aaa('0x21')]===_0x2aaa('0x20');var _0x36f442=_0x378452['count'];var _0x527a49=_0x515134?0x0:_0x2be293['offset'];var _0x39b061=_0x515134?_0x378452['count']:_0x2be293['offset']+_0x2be293['limit'];var _0x33b1ad;if(_0x39b061>=_0x36f442){_0x39b061=_0x36f442;_0x33b1ad=0xc8;}else{_0x33b1ad=0xce;}_0x48ed6e[_0x2aaa('0x1c')](_0x33b1ad);return _0x48ed6e[_0x2aaa('0x22')]('Content-Range',_0x527a49+'-'+_0x39b061+'/'+_0x36f442)[_0x2aaa('0x1e')](_0x378452);}return null;};}function patchUpdates(_0x180c53){return function(_0x12f436){try{jsonpatch[_0x2aaa('0x23')](_0x12f436,_0x180c53,!![]);}catch(_0x5f1f22){return BPromise['reject'](_0x5f1f22);}return _0x12f436[_0x2aaa('0x24')]();};}function saveUpdates(_0x281ff8,_0x17c83b){return function(_0x22321c){if(_0x22321c){return _0x22321c['update'](_0x281ff8)[_0x2aaa('0x25')](function(_0x320def){return _0x320def;});}return null;};}function removeEntity(_0x1be947,_0x3ff1c8){return function(_0x4e35d3){if(_0x4e35d3){return _0x4e35d3[_0x2aaa('0x26')]()[_0x2aaa('0x25')](function(){_0x1be947[_0x2aaa('0x1c')](0xcc)[_0x2aaa('0x1d')]();});}};}function handleEntityNotFound(_0x91a4b6,_0x3a0c7a){return function(_0x27a292){if(!_0x27a292){_0x91a4b6[_0x2aaa('0x27')](0x194);}return _0x27a292;};}function handleError(_0x3f30f6,_0x53629e){_0x53629e=_0x53629e||0x1f4;return function(_0x12b681){logger[_0x2aaa('0x28')](_0x12b681['stack']);if(_0x12b681['name']){delete _0x12b681[_0x2aaa('0x29')];}_0x3f30f6[_0x2aaa('0x1c')](_0x53629e)[_0x2aaa('0x2a')](_0x12b681);};}function getInteractionUsers(_0x308bed,_0x387070){return new BPromise(function(_0x33e8c2,_0x5c961f){try{if(_0x387070[_0x308bed['id']]){_0x308bed['Users']=_['map'](_0x387070[_0x308bed['id']],function(_0x17f7d5){return{'id':_0x17f7d5['id'],'fullname':_0x17f7d5[_0x2aaa('0x2b')]};});}}catch(_0x25e4cb){_0x5c961f(_0x25e4cb);}_0x33e8c2(_0x308bed);});}function getInteractionTags(_0x288cfb,_0x41306d){return new BPromise(function(_0x44b678,_0x3ea76a){try{if(_0x288cfb[_0x2aaa('0x2c')]){_0x288cfb[_0x2aaa('0x2d')]=[];_0x288cfb[_0x2aaa('0x2c')][_0x2aaa('0x2e')](',')[_0x2aaa('0x2f')](function(_0x20202e){_0x288cfb[_0x2aaa('0x2d')][_0x2aaa('0x30')](_0x41306d[_0x20202e]);});}delete _0x288cfb[_0x2aaa('0x2c')];}catch(_0x1bbbb3){_0x3ea76a(_0x1bbbb3);}_0x44b678(_0x288cfb);});}function updateOpenchannelInteraction(_0x5df2eb,_0x3f0b63,_0x2ebabb){return new BPromise(function(_0x19b3d0,_0x4db034){return getInteractionUsers(_0x5df2eb,_0x2ebabb)['then'](function(_0x31e474){return getInteractionTags(_0x31e474,_0x3f0b63);})['then'](function(_0x3aa92a){_0x19b3d0(_0x3aa92a);})[_0x2aaa('0x31')](function(_0x3ed8d7){_0x4db034(_0x3ed8d7);});});}exports['index']=function(_0x7870e5,_0x34c960){var _0x55dc21={},_0x31df43={},_0x59f5b6={'count':0x0,'rows':[]};var _0x4508e8=_['map'](db[_0x2aaa('0x32')][_0x2aaa('0x33')],function(_0x58806c){return{'name':_0x58806c['fieldName'],'type':_0x58806c[_0x2aaa('0x34')]['key']};});_0x31df43['model']=_[_0x2aaa('0x35')](_0x4508e8,'name');_0x31df43[_0x2aaa('0x36')]=_['keys'](_0x7870e5[_0x2aaa('0x36')]);_0x31df43[_0x2aaa('0x37')]=_['intersection'](_0x31df43[_0x2aaa('0x38')],_0x31df43['query']);_0x55dc21['attributes']=_[_0x2aaa('0x39')](_0x31df43[_0x2aaa('0x38')],qs[_0x2aaa('0x3a')](_0x7870e5[_0x2aaa('0x36')][_0x2aaa('0x3a')]));_0x55dc21[_0x2aaa('0x3b')]=_0x55dc21[_0x2aaa('0x3b')][_0x2aaa('0x3c')]?_0x55dc21['attributes']:_0x31df43[_0x2aaa('0x38')];if(!_0x7870e5[_0x2aaa('0x36')][_0x2aaa('0x3d')](_0x2aaa('0x3e'))){_0x55dc21[_0x2aaa('0x21')]=qs[_0x2aaa('0x21')](_0x7870e5[_0x2aaa('0x36')][_0x2aaa('0x21')]);_0x55dc21[_0x2aaa('0x1f')]=qs[_0x2aaa('0x1f')](_0x7870e5[_0x2aaa('0x36')][_0x2aaa('0x1f')]);}_0x55dc21[_0x2aaa('0x3f')]=qs['sort'](_0x7870e5[_0x2aaa('0x36')][_0x2aaa('0x40')]);_0x55dc21[_0x2aaa('0x41')]=qs['filters'](_[_0x2aaa('0x42')](_0x7870e5['query'],_0x31df43['filters']),_0x4508e8);var _0x46abaf=[];var _0x11410b=squel['select']()[_0x2aaa('0x43')]('id')[_0x2aaa('0x43')](_0x2aaa('0x29'))['field']('color')[_0x2aaa('0x44')](_0x2aaa('0x45'));var _0x46cb67=squel[_0x2aaa('0x46')]()[_0x2aaa('0x43')](_0x2aaa('0x47'))[_0x2aaa('0x43')](_0x2aaa('0x48'))[_0x2aaa('0x43')](_0x2aaa('0x49'))['from'](_0x2aaa('0x4a'),'ui')[_0x2aaa('0x4b')](_0x2aaa('0x4c'),'u','u.id\x20=\x20ui.UserId');var _0x787d0f=squel[_0x2aaa('0x46')]()[_0x2aaa('0x44')](_0x2aaa('0x4d'),'i')[_0x2aaa('0x4b')](_0x2aaa('0x4e'),'c',_0x2aaa('0x4f'))['left_join'](_0x2aaa('0x4c'),'o',_0x2aaa('0x50'))[_0x2aaa('0x4b')]('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')[_0x2aaa('0x4b')](_0x2aaa('0x51'),'me',_0x2aaa('0x52'))[_0x2aaa('0x4b')]('openchannel_interaction_has_tags','it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x2aaa('0x4b')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x4775a5=squel['expr']();var _0xcb96=[];var _0x268e0b=squel[_0x2aaa('0x53')]();var _0x1687f9;if(_0x7870e5[_0x2aaa('0x36')][_0x2aaa('0x54')]){_0x1687f9=as[_0x2aaa('0x55')](_0x7870e5[_0x2aaa('0x36')][_0x2aaa('0x54')]);var _0xd18b9c=_0x1687f9[_0x2aaa('0x56')];for(var _0x4414c1=0x0;_0x4414c1<_0x1687f9[_0x2aaa('0x57')][_0x2aaa('0x3c')];_0x4414c1++){var _0x4bcf73=_0x1687f9[_0x2aaa('0x57')][_0x4414c1];var _0x13cb0e='i';var _0x3bb55f=_[_0x2aaa('0x58')](_0x4508e8,[_0x2aaa('0x29'),_0x4bcf73[_0x2aaa('0x43')]]);if(!_0x3bb55f){switch(_0x4bcf73[_0x2aaa('0x43')]){case _0x2aaa('0x59'):if(_0x4bcf73[_0x2aaa('0x5a')]==0x1){_0x787d0f['having']('`'+_0x4bcf73['field']+'`\x20=\x200');}else{_0x787d0f['having']('`'+_0x4bcf73[_0x2aaa('0x43')]+_0x2aaa('0x5b'));}break;case _0x2aaa('0x5c'):if(_0x4bcf73[_0x2aaa('0x5d')]===_0x2aaa('0x5e')){if(_0x4bcf73[_0x2aaa('0x5a')]['split']('\x20')[_0x2aaa('0x3c')]>0x1){_0x4775a5[_0xd18b9c](_0x2aaa('0x5f'),qs[_0x2aaa('0x60')](_0x4bcf73[_0x2aaa('0x5a')]),null);}else{var _0x1c90c7='%'+_0x4bcf73['value']+'%';_0x4775a5[_0xd18b9c](_0x2aaa('0x61'),_0x1c90c7,_0x1c90c7,_0x1c90c7);}}else{_0x3bb55f=_['find'](_0x4508e8,[_0x2aaa('0x29'),_0x2aaa('0x62')]);_0x4bcf73['field']=_0x2aaa('0x62');_0x518cab=as[_0x2aaa('0x63')](_0x13cb0e,_0x3bb55f['type'],_0x4bcf73);_0x4775a5[_0xd18b9c](_0x518cab[_0x2aaa('0x64')],_0x518cab[_0x2aaa('0x5a')][_0x2aaa('0x65')],_0x518cab[_0x2aaa('0x5a')]['end']);}break;case _0x2aaa('0x66'):var _0x2bb1f1=_0x4bcf73[_0x2aaa('0x5a')][_0x2aaa('0x2e')](',')[_0x2aaa('0x35')](function(_0x194f8b){return Number(_0x194f8b);});_0x2bb1f1[_0x2aaa('0x2f')](function(_0x318827){_0x268e0b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x318827+',%');});_0xcb96=_['union'](_0xcb96,_0x2bb1f1);break;case'User':if(_0x4bcf73[_0x2aaa('0x5d')]===_0x2aaa('0x5e')){_0x4775a5[_0xd18b9c](_0x2aaa('0x67'),'%'+_0x4bcf73[_0x2aaa('0x5a')]+'%',null);}else{_0x3bb55f=_[_0x2aaa('0x58')](_0x4508e8,['name',_0x2aaa('0x68')]);_0x4bcf73[_0x2aaa('0x43')]=_0x2aaa('0x68');_0x518cab=as['buildExpression'](_0x13cb0e,_0x3bb55f[_0x2aaa('0x34')],_0x4bcf73);_0x4775a5[_0xd18b9c](_0x518cab[_0x2aaa('0x64')],_0x518cab[_0x2aaa('0x5a')]['start'],_0x518cab['value'][_0x2aaa('0x1d')]);}break;case _0x2aaa('0x69'):_0x518cab=as[_0x2aaa('0x63')]('me',null,_0x4bcf73);_0x4775a5[_0xd18b9c](_0x518cab[_0x2aaa('0x64')],_0x518cab[_0x2aaa('0x5a')]['start'],_0x518cab[_0x2aaa('0x5a')]['end']);break;}}else{var _0x518cab=as['buildExpression'](_0x13cb0e,_0x3bb55f[_0x2aaa('0x34')],_0x4bcf73);_0x4775a5[_0xd18b9c](_0x518cab[_0x2aaa('0x64')],_0x518cab[_0x2aaa('0x5a')]['start'],_0x518cab[_0x2aaa('0x5a')][_0x2aaa('0x1d')]);}}}else{var _0x516306=_(_0x7870e5[_0x2aaa('0x36')])[_0x2aaa('0x6a')]()[_0x2aaa('0x35')](function(_0x41ea8b){return _[_0x2aaa('0x6b')](_0x4508e8,[_0x2aaa('0x29'),_0x41ea8b])?_0x41ea8b:undefined;})['compact']()['value']();if(!_[_0x2aaa('0x6c')](_0x516306)){_0x516306[_0x2aaa('0x2f')](function(_0x42aa89){if(_0x42aa89===_0x2aaa('0x6d')){_0x787d0f[_0x2aaa('0x41')](_0x2aaa('0x6e'),[]['concat'](_0x7870e5[_0x2aaa('0x36')][_0x42aa89]));}else if(_0x42aa89===_0x2aaa('0x6f')){var _0x2ca97d=JSON[_0x2aaa('0x70')](_0x7870e5['query'][_0x42aa89])[_0x2aaa('0x71')];var _0x4a088f=JSON[_0x2aaa('0x70')](_0x7870e5[_0x2aaa('0x36')][_0x42aa89])['$lte'];_0x787d0f['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2ca97d,_0x4a088f);}else{if(_0x7870e5[_0x2aaa('0x36')][_0x42aa89]==='null'){_0x787d0f[_0x2aaa('0x41')]('i.'+_0x42aa89+_0x2aaa('0x72'));}else{_0x787d0f[_0x2aaa('0x41')]('i.'+_0x42aa89+_0x2aaa('0x73'),_0x7870e5[_0x2aaa('0x36')][_0x42aa89]);}}});}if(_0x7870e5[_0x2aaa('0x36')][_0x2aaa('0x74')]){if(_0x7870e5[_0x2aaa('0x36')][_0x2aaa('0x74')]==0x1){_0x787d0f[_0x2aaa('0x75')](_0x2aaa('0x76'));}else{_0x787d0f[_0x2aaa('0x75')](_0x2aaa('0x77'));}}if(_0x7870e5['query']['tag']){_0xcb96=_[_0x2aaa('0x78')](_0x7870e5[_0x2aaa('0x36')][_0x2aaa('0x79')])?_0x7870e5[_0x2aaa('0x36')][_0x2aaa('0x79')]:new Array(_0x7870e5[_0x2aaa('0x36')][_0x2aaa('0x79')]);_0xcb96['forEach'](function(_0x27d818){_0x268e0b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x27d818+',%');});}if(_0x7870e5['query'][_0x2aaa('0x7a')]){var _0x8b4ed6=_0x7870e5[_0x2aaa('0x36')]['filter'][_0x2aaa('0x7b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x2aaa('0x7c')](_0x8b4ed6)){_0x4775a5['or']('i.id\x20LIKE\x20?',_0x8b4ed6+'%');}else{_0x4775a5['or'](_0x2aaa('0x7d'),qs['getFullTextValue'](_0x8b4ed6))['or'](_0x2aaa('0x7e'),_0x8b4ed6+'%')['or'](_0x2aaa('0x7f'),_0x8b4ed6+'%');}}}_0x787d0f[_0x2aaa('0x41')](_0x4775a5);_0x787d0f[_0x2aaa('0x80')](_0x2aaa('0x81'));var _0x5c350e={'type':db['Sequelize']['QueryTypes'][_0x2aaa('0x82')],'raw':!![]};var _0x1cd50b=_0x787d0f[_0x2aaa('0x83')]();_0x1cd50b['field'](_0x2aaa('0x81'));_0x1cd50b['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2aaa('0x59'));if(_0x55dc21[_0x2aaa('0x3f')]){_0x55dc21[_0x2aaa('0x3f')]['forEach'](function(_0x5bc1ef){var _0x1ffadf=_0x5bc1ef[0x0]===_0x2aaa('0x84')?_0x5bc1ef[0x0]:'i.'+_0x5bc1ef[0x0];_0x787d0f['order'](_0x1ffadf,_0x5bc1ef[0x1]===_0x2aaa('0x85')?![]:!![]);});}if(!_[_0x2aaa('0x6c')](_0xcb96)){_0x787d0f[_0x2aaa('0x75')](_0x268e0b);_0x1cd50b[_0x2aaa('0x41')](_0x2aaa('0x86'),_0xcb96);}BPromise[_0x2aaa('0x87')]()['then'](function(){if(!_0x1687f9){if(_0x7870e5['query'][_0x2aaa('0x6d')])return;_0x1cd50b[_0x2aaa('0x41')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x787d0f['where'](_0x2aaa('0x88'));return;}if(_0x7870e5['user'][_0x2aaa('0x89')]!==_0x2aaa('0x8a'))return;return _0x7870e5['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x2aaa('0x25')](function(_0x2c3134){if(_[_0x2aaa('0x6c')](_0x2c3134)){_0x1cd50b[_0x2aaa('0x41')](_0x2aaa('0x8b'));_0x787d0f['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x1cd50b[_0x2aaa('0x41')](_0x2aaa('0x6e'),_[_0x2aaa('0x35')](_0x2c3134,'id'));_0x787d0f['where'](_0x2aaa('0x6e'),_[_0x2aaa('0x35')](_0x2c3134,'id'));}});})[_0x2aaa('0x25')](function(){if(_0x7870e5[_0x2aaa('0x8c')][_0x2aaa('0x89')]===_0x2aaa('0x8a')&&!_0x1687f9&&!_0x7870e5[_0x2aaa('0x36')]['OpenchannelAccountId'])return[];return db[_0x2aaa('0x8d')][_0x2aaa('0x36')](_0x1cd50b[_0x2aaa('0x8e')](),_0x5c350e);})[_0x2aaa('0x25')](function(_0xefba87){_0x59f5b6['count']=_0xefba87['length'];if(_0x59f5b6[_0x2aaa('0x8f')]===0x0)return[];return db['sequelize'][_0x2aaa('0x36')](_0x11410b['toString'](),_0x5c350e)['then'](function(_0x401a42){_0x46abaf=_[_0x2aaa('0x90')](_0x401a42,'id');_0x5c350e=_['merge'](_0x5c350e,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x7870e5['query'][_0x2aaa('0x3a')]){_0x55dc21[_0x2aaa('0x3b')][_0x2aaa('0x2f')](function(_0x26c02c){_0x787d0f[_0x2aaa('0x43')]('i.'+_0x26c02c);});}else{_0x787d0f[_0x2aaa('0x43')](_0x2aaa('0x91'),'unreadMessages');_0x787d0f[_0x2aaa('0x43')](_0x2aaa('0x92'),_0x2aaa('0x93'));_0x787d0f[_0x2aaa('0x43')](_0x2aaa('0x94'),'Account.mandatoryDisposition');_0x787d0f[_0x2aaa('0x43')]('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',_0x2aaa('0x84'));_0x787d0f[_0x2aaa('0x43')](_0x2aaa('0x95'));_0x787d0f[_0x2aaa('0x43')](_0x2aaa('0x96'),_0x2aaa('0x97'));_0x787d0f[_0x2aaa('0x43')]('c.lastName',_0x2aaa('0x98'));_0x787d0f['field'](_0x2aaa('0x99'),_0x2aaa('0x9a'));_0x787d0f[_0x2aaa('0x43')]('c.phone','Contact.phone');_0x787d0f['field'](_0x2aaa('0x9b'),'Contact.mobile');_0x787d0f[_0x2aaa('0x43')](_0x2aaa('0x9c'),_0x2aaa('0x9d'));_0x787d0f['field'](_0x2aaa('0x9e'),_0x2aaa('0x9f'));_0x787d0f['field']('o.internal',_0x2aaa('0xa0'));_0x787d0f[_0x2aaa('0x43')](_0x2aaa('0xa1'),'TagIds');}if(_0x55dc21['limit'])_0x787d0f[_0x2aaa('0x21')](_0x55dc21['limit']);if(_0x55dc21['offset'])_0x787d0f[_0x2aaa('0x1f')](_0x55dc21[_0x2aaa('0x1f')]);return db[_0x2aaa('0x8d')]['query'](_0x787d0f[_0x2aaa('0x8e')](),_0x5c350e);})[_0x2aaa('0x25')](function(_0x57fe44){if(_0x57fe44['length']>0x0)_0x46cb67[_0x2aaa('0x41')](_0x2aaa('0xa2'),_[_0x2aaa('0x35')](_0x57fe44,'id'));return db[_0x2aaa('0x8d')][_0x2aaa('0x36')](_0x46cb67['toString'](),_0x5c350e)[_0x2aaa('0x25')](function(_0x494dcf){var _0x5cc952=_[_0x2aaa('0xa3')](_0x494dcf,'OpenchannelInteractionId');var _0x4685a2=[];_0x57fe44[_0x2aaa('0x2f')](function(_0x3d5dc6){_0x4685a2[_0x2aaa('0x30')](updateOpenchannelInteraction(_0x3d5dc6,_0x46abaf,_0x5cc952));});return BPromise[_0x2aaa('0xa4')](_0x4685a2);});});})[_0x2aaa('0x25')](function(_0x57ae29){_0x59f5b6['rows']=_0x57ae29;return _0x59f5b6;})[_0x2aaa('0x25')](respondWithFilteredResult(_0x34c960,_0x55dc21))[_0x2aaa('0x31')](handleError(_0x34c960,null));};exports[_0x2aaa('0xa5')]=function(_0x458f47,_0x55d1fc){var _0x3542d3={};if(_0x458f47[_0x2aaa('0x36')][_0x2aaa('0x34')]&&_0x458f47['query'][_0x2aaa('0x34')]===_0x2aaa('0x44')){_0x3542d3[_0x2aaa('0x44')]=_0x458f47[_0x2aaa('0xa6')]['id'];}else{_0x3542d3['id']=_0x458f47['params']['id'];}var _0x5da4d4={'raw':![],'where':_0x3542d3},_0x60e2d={};_0x60e2d[_0x2aaa('0x38')]=_[_0x2aaa('0x6a')](db[_0x2aaa('0x32')]['rawAttributes']);_0x60e2d[_0x2aaa('0x36')]=_['keys'](_0x458f47[_0x2aaa('0x36')]);_0x60e2d[_0x2aaa('0x37')]=_[_0x2aaa('0x39')](_0x60e2d[_0x2aaa('0x38')],_0x60e2d[_0x2aaa('0x36')]);_0x5da4d4[_0x2aaa('0x3b')]=_[_0x2aaa('0x39')](_0x60e2d[_0x2aaa('0x38')],qs[_0x2aaa('0x3a')](_0x458f47[_0x2aaa('0x36')]['fields']));_0x5da4d4['attributes']=_0x5da4d4[_0x2aaa('0x3b')][_0x2aaa('0x3c')]?_0x5da4d4[_0x2aaa('0x3b')]:_0x60e2d[_0x2aaa('0x38')];if(_0x458f47[_0x2aaa('0x36')][_0x2aaa('0xa7')]){_0x5da4d4[_0x2aaa('0xa8')]=[{'all':!![]}];}_0x5da4d4=_[_0x2aaa('0xa9')]({},_0x5da4d4,_0x458f47[_0x2aaa('0xaa')]);return db[_0x2aaa('0x32')][_0x2aaa('0x58')](_0x5da4d4)[_0x2aaa('0x25')](handleEntityNotFound(_0x55d1fc,null))[_0x2aaa('0x25')](respondWithResult(_0x55d1fc,null))[_0x2aaa('0x31')](handleError(_0x55d1fc,null));};exports[_0x2aaa('0xab')]=function(_0xe85afd,_0x5696de){return db[_0x2aaa('0x32')][_0x2aaa('0xab')](_0xe85afd[_0x2aaa('0x69')],{})['then'](respondWithResult(_0x5696de,0xc9))[_0x2aaa('0x31')](handleError(_0x5696de,null));};exports[_0x2aaa('0xac')]=function(_0x5d6b49,_0x39f159){if(_0x5d6b49[_0x2aaa('0x69')]['id']){delete _0x5d6b49[_0x2aaa('0x69')]['id'];}return db[_0x2aaa('0x32')][_0x2aaa('0x58')]({'where':{'id':_0x5d6b49[_0x2aaa('0xa6')]['id']}})[_0x2aaa('0x25')](handleEntityNotFound(_0x39f159,null))[_0x2aaa('0x25')](saveUpdates(_0x5d6b49[_0x2aaa('0x69')],null))['then'](respondWithResult(_0x39f159,null))[_0x2aaa('0x31')](handleError(_0x39f159,null));};exports['destroy']=function(_0x44f672,_0x36ce83){return db[_0x2aaa('0x32')]['find']({'where':{'id':_0x44f672['params']['id']}})[_0x2aaa('0x25')](handleEntityNotFound(_0x36ce83,null))[_0x2aaa('0x25')](removeEntity(_0x36ce83,null))[_0x2aaa('0x31')](handleError(_0x36ce83,null));};exports[_0x2aaa('0xad')]=function(_0x9c9855,_0x379c45){return db[_0x2aaa('0x32')][_0x2aaa('0xad')]()[_0x2aaa('0x25')](respondWithResult(_0x379c45,null))[_0x2aaa('0x31')](handleError(_0x379c45,null));};exports[_0x2aaa('0xae')]=function(_0x5107f1,_0x8f5491,_0x10a318){return db[_0x2aaa('0xaf')][_0x2aaa('0x58')]({'where':{'id':_0x5107f1['params']['id']}})['then'](handleEntityNotFound(_0x8f5491,null))[_0x2aaa('0x25')](function(_0x685cf9){if(_0x685cf9){return _0x685cf9['addMessage'](_0x5107f1['body']['ids'],_[_0x2aaa('0xb0')](_0x5107f1[_0x2aaa('0x69')],[_0x2aaa('0xb1'),'id'])||{});}})[_0x2aaa('0x25')](respondWithResult(_0x8f5491,null))['catch'](handleError(_0x8f5491,null));};exports['getMessages']=function(_0x468013,_0x1892ed,_0x2dd361){var _0x38e875={'raw':![],'where':{}};var _0x28857f={};var _0x33c636={'count':0x0,'rows':[]};return db[_0x2aaa('0x32')][_0x2aaa('0xb2')]({'where':{'id':_0x468013[_0x2aaa('0xa6')]['id']}})[_0x2aaa('0x25')](handleEntityNotFound(_0x1892ed,null))['then'](function(_0xd559a8){if(_0xd559a8){_0x28857f[_0x2aaa('0x38')]=_[_0x2aaa('0x6a')](db[_0x2aaa('0xaf')][_0x2aaa('0x33')]);_0x28857f[_0x2aaa('0x36')]=_[_0x2aaa('0x6a')](_0x468013['query']);_0x28857f['filters']=_[_0x2aaa('0x39')](_0x28857f[_0x2aaa('0x38')],_0x28857f[_0x2aaa('0x36')]);_0x38e875[_0x2aaa('0x3b')]=_['intersection'](_0x28857f['model'],qs[_0x2aaa('0x3a')](_0x468013[_0x2aaa('0x36')]['fields']));_0x38e875[_0x2aaa('0x3b')]=_0x38e875[_0x2aaa('0x3b')][_0x2aaa('0x3c')]?_0x38e875['attributes']:_0x28857f['model'];if(!_0x468013['query']['hasOwnProperty'](_0x2aaa('0x3e'))){_0x38e875[_0x2aaa('0x21')]=qs[_0x2aaa('0x21')](_0x468013['query'][_0x2aaa('0x21')]);_0x38e875[_0x2aaa('0x1f')]=qs[_0x2aaa('0x1f')](_0x468013[_0x2aaa('0x36')][_0x2aaa('0x1f')]);}_0x38e875[_0x2aaa('0x3f')]=qs['sort'](_0x468013['query']['sort']);_0x38e875[_0x2aaa('0x41')]=qs[_0x2aaa('0x37')](_[_0x2aaa('0x42')](_0x468013[_0x2aaa('0x36')],_0x28857f[_0x2aaa('0x37')]));_0x38e875['where'][_0x2aaa('0xb3')]=_0xd559a8['id'];if(_0x468013[_0x2aaa('0x36')][_0x2aaa('0x7a')]){_0x38e875['where']=_[_0x2aaa('0xa9')](_0x38e875[_0x2aaa('0x41')],{'$or':_[_0x2aaa('0x35')](_0x38e875[_0x2aaa('0x3b')],function(_0x355c52){var _0x3f12b3={};_0x3f12b3[_0x355c52]={'$like':'%'+_0x468013[_0x2aaa('0x36')][_0x2aaa('0x7a')]+'%'};return _0x3f12b3;})});}if(_0x468013[_0x2aaa('0x36')][_0x2aaa('0x71')]){var _0xc775fb=_0x468013[_0x2aaa('0x36')][_0x2aaa('0x71')]['split'](',');var _0x124f61={};_0x124f61[_0xc775fb[0x0]]={'$gte':moment(_0xc775fb[0x1])[_0x2aaa('0xb4')](_0x2aaa('0xb5'))};_0x38e875['where']=_['merge'](_0x38e875[_0x2aaa('0x41')],_0x124f61);}_0x38e875=_[_0x2aaa('0xa9')]({},_0x38e875,_0x468013[_0x2aaa('0xaa')]);return db[_0x2aaa('0xaf')]['count']({'where':_0x38e875[_0x2aaa('0x41')]})[_0x2aaa('0x25')](function(_0x17d47b){_0x33c636[_0x2aaa('0x8f')]=_0x17d47b;if(_0x468013['query'][_0x2aaa('0xa7')]){_0x38e875['include']=[{'all':!![]}];}return db[_0x2aaa('0xaf')][_0x2aaa('0xb6')](_0x38e875);})['then'](function(_0x3a3c0a){_0x33c636['rows']=_0x3a3c0a;return _0x33c636;});}})[_0x2aaa('0x25')](respondWithFilteredResult(_0x1892ed,_0x38e875))[_0x2aaa('0x31')](handleError(_0x1892ed,null));};exports[_0x2aaa('0xb7')]=function(_0x3ff626,_0x1b577b,_0x1e0a92){return db[_0x2aaa('0x32')]['find']({'where':{'id':_0x3ff626[_0x2aaa('0xa6')]['id']}})[_0x2aaa('0x25')](handleEntityNotFound(_0x1b577b,null))[_0x2aaa('0x25')](function(_0x337edb){if(_0x337edb){return _0x337edb[_0x2aaa('0xb8')](_0x3ff626[_0x2aaa('0x69')][_0x2aaa('0xb1')],_[_0x2aaa('0xb0')](_0x3ff626[_0x2aaa('0x69')],[_0x2aaa('0xb1'),'id'])||{})[_0x2aaa('0xb9')](function(){return db[_0x2aaa('0x66')][_0x2aaa('0xb6')]({'attributes':['id',_0x2aaa('0x29'),_0x2aaa('0xba')],'where':{'id':_0x3ff626[_0x2aaa('0x69')]['ids']}});})[_0x2aaa('0x25')](function(_0x4c0e80){socket[_0x2aaa('0xbb')](_0x2aaa('0xbc'),{'id':Number(_0x3ff626[_0x2aaa('0xa6')]['id']),'tags':_0x4c0e80||[]});return{'id':Number(_0x3ff626['params']['id']),'tags':_0x4c0e80||[]};});}})['then'](respondWithResult(_0x1b577b,null))[_0x2aaa('0x31')](handleError(_0x1b577b,null));};exports['removeTags']=function(_0x3d66c7,_0x3d83c8,_0x2d4435){return db[_0x2aaa('0x32')][_0x2aaa('0x58')]({'where':{'id':_0x3d66c7['params']['id']}})[_0x2aaa('0x25')](handleEntityNotFound(_0x3d83c8,null))[_0x2aaa('0x25')](function(_0x53f317){if(_0x53f317){return _0x53f317[_0x2aaa('0xbd')](_0x3d66c7[_0x2aaa('0x36')][_0x2aaa('0xb1')]);}})['then'](respondWithStatusCode(_0x3d83c8,null))['catch'](handleError(_0x3d83c8,null));};exports['download']=function(_0x57fa3f,_0x2aebf3){var _0x247afd=moment()['unix']()['toString']();var _0x40234d=path[_0x2aaa('0xbe')](config[_0x2aaa('0xbf')],_0x2aaa('0xc0'),_0x2aaa('0xc1'),_0x2aaa('0xc2'));var _0xdc0437=path[_0x2aaa('0xbe')](config[_0x2aaa('0xbf')],_0x2aaa('0xc0'),_0x2aaa('0xc1'),_0x2aaa('0xc3'));var _0x4a5b86=path[_0x2aaa('0xbe')](_0x40234d,_0x247afd);var _0x199b33=util['format']('transcript-%d-%s.zip',_0x57fa3f[_0x2aaa('0xa6')]['id'],_0x247afd);var _0xc18b3c=path[_0x2aaa('0xbe')](_0x40234d,_0x199b33);var _0x56c938=[];_0x56c938[_0x2aaa('0x30')]({'model':db['User'],'as':'User','attributes':['id',_0x2aaa('0x2b')],'raw':!![]});_0x56c938['push']({'model':db['CmContact'],'as':_0x2aaa('0x5c'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x57fa3f[_0x2aaa('0x36')][_0x2aaa('0xc3')]){_0x56c938[_0x2aaa('0x30')]({'model':db[_0x2aaa('0xc4')],'as':_0x2aaa('0xc4'),'raw':!![]});}var _0x2f433c=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id','body',_0x2aaa('0x6f'),_0x2aaa('0xc5'),_0x2aaa('0xc6'),_0x2aaa('0x74')],'include':_0x56c938}];_0x2f433c['push']({'model':db[_0x2aaa('0xc7')],'as':'Account','attributes':['id',_0x2aaa('0x29')]});_0x2f433c[_0x2aaa('0x30')]({'model':db[_0x2aaa('0xc8')],'as':_0x2aaa('0xc9'),'attributes':['id','fullname']});return db[_0x2aaa('0x32')]['find']({'where':{'id':_0x57fa3f[_0x2aaa('0xa6')]['id']},'include':_0x2f433c})[_0x2aaa('0x25')](handleEntityNotFound(_0x2aebf3,null))[_0x2aaa('0x25')](function(_0x98e737){if(_0x98e737){var _0x37d203=_0x98e737[_0x2aaa('0xca')]({'plain':!![]});fs[_0x2aaa('0xcb')](_0x4a5b86);var _0x14a266={'channel':'Openchannel','account':_0x37d203[_0x2aaa('0xcc')]['name'],'agent':_0x37d203[_0x2aaa('0xc9')]?_0x37d203[_0x2aaa('0xc9')]['fullname']:_0x2aaa('0xcd'),'createdAt':moment(_0x37d203[_0x2aaa('0x6f')])[_0x2aaa('0xb4')](_0x2aaa('0xb5'))[_0x2aaa('0x8e')](),'closedAt':_0x37d203['closed']?moment(_0x37d203[_0x2aaa('0xce')])[_0x2aaa('0xb4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2aaa('0x8e')]():'','disposition':_0x37d203[_0x2aaa('0xcf')],'visibility':_0x37d203[_0x2aaa('0xd0')]?_0x2aaa('0xd1'):_0x2aaa('0xd2'),'messages':_(_0x37d203[_0x2aaa('0xd3')])[_0x2aaa('0x7a')]({'secret':![]})[_0x2aaa('0x35')](function(_0x156360){if(_0x156360['Attachment']){var _0x502a66=path[_0x2aaa('0xbe')](_0xdc0437,_0x156360[_0x2aaa('0xc4')][_0x2aaa('0xd4')]);if(fs[_0x2aaa('0xd5')](_0x502a66)){fs[_0x2aaa('0xd6')](_0x502a66)[_0x2aaa('0xd7')](fs[_0x2aaa('0xd8')](path[_0x2aaa('0xbe')](_0x4a5b86,_0x156360[_0x2aaa('0xc4')][_0x2aaa('0xd4')])));}}return{'date':moment(_0x156360['createdAt'])[_0x2aaa('0xb4')](_0x2aaa('0xb5'))[_0x2aaa('0x8e')](),'sender':_0x156360[_0x2aaa('0xc5')]===_0x2aaa('0xd9')?_0x156360['User']?_0x156360[_0x2aaa('0xc8')]['fullname']:_0x2aaa('0xda'):_0x156360['Contact'][_0x2aaa('0xdb')]+(_0x156360[_0x2aaa('0x5c')][_0x2aaa('0xdc')]?'\x20'+_0x156360['Contact'][_0x2aaa('0xdc')]:''),'body':_0x156360[_0x2aaa('0xc4')]?_0x156360[_0x2aaa('0xc4')][_0x2aaa('0xd4')]:_0x156360[_0x2aaa('0x69')],'direction':_0x156360['direction']===_0x2aaa('0xd9')?'A':'C','secret':_0x156360['secret'],'read':_0x156360[_0x2aaa('0x74')],'attachment':_0x156360[_0x2aaa('0xc4')]};})[_0x2aaa('0x5a')]()};return ejs['renderFile'](path[_0x2aaa('0xbe')](config[_0x2aaa('0xbf')],_0x2aaa('0xc0'),'views',_0x2aaa('0xdd')),{'interaction':_0x14a266})[_0x2aaa('0x25')](function(_0x39f806){var _0x404c8c=path[_0x2aaa('0xbe')](_0x4a5b86,'transcript-'+_0x37d203['id']+'-'+_0x247afd+_0x2aaa('0xde'));var _0x46d50f={'path':_0x404c8c,'channel':_0x2aaa('0xdf'),'interactionId':_0x37d203['id']};return pdf[_0x2aaa('0xe0')](_0x39f806,_0x46d50f);})['then'](function(){return new BPromise(function(_0x24468d,_0x1a7248){zipdir(_0x4a5b86,{'saveTo':_0xc18b3c},function(_0x1eebd1,_0x2b6b38){if(_0x1eebd1)return _0x1a7248(_0x1eebd1);return _0x24468d(_0x2b6b38);});})[_0x2aaa('0x25')](function(){return new BPromise(function(_0x101d24,_0x26df36){rimraf(_0x4a5b86,function(_0x2e1c57){if(_0x2e1c57)_0x26df36(_0x2e1c57);return _0x101d24();});});})[_0x2aaa('0x25')](function(){return _0x2aebf3[_0x2aaa('0xe1')](_0xc18b3c,_0x199b33,function(_0x1c5678){if(_0x1c5678){console[_0x2aaa('0xe2')](_0x2aaa('0xe3'),_0x1c5678);}else{fs['unlinkSync'](_0xc18b3c);}});});});}else{return _0x2aebf3['sendStatus'](0xc8);}})[_0x2aaa('0x31')](handleError(_0x2aebf3,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 503f26d..2bcf327 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 _0x1962=['Users','map','findAll','length','emit','catch','hasOwnProperty','hook','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','setDataValue'];(function(_0x116538,_0x2fc73c){var _0x277543=function(_0x2d6730){while(--_0x2d6730){_0x116538['push'](_0x116538['shift']());}};_0x277543(++_0x2fc73c);}(_0x1962,0xe9));var _0x2196=function(_0x2c84e5,_0x58a7c7){_0x2c84e5=_0x2c84e5-0x0;var _0x4990ec=_0x1962[_0x2c84e5];return _0x4990ec;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x2196('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x2196('0x0'))['db'][_0x2196('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x2196('0x2')](0x0);var events={'afterCreate':_0x2196('0x3'),'afterUpdate':_0x2196('0x4'),'afterDestroy':'remove'};function emitEvent(_0x55431e){return function(_0x7b6f22,_0x44e86e,_0x1177a1){_0x7b6f22[_0x2196('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2c3ee9){_0x7b6f22[_0x2196('0x6')](_0x2196('0x7'),_0x2c3ee9[_0x2196('0x8')](function(_0x4efcba){return{'id':_0x4efcba['id']};}));return OpenchannelMessage[_0x2196('0x9')]({'where':{'OpenchannelInteractionId':_0x7b6f22['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xe9c7ea){_0x7b6f22[_0x2196('0x6')]('unreadMessages',_0xe9c7ea[_0x2196('0xa')]);OpenchannelInteractionEvents[_0x2196('0xb')](_0x55431e+':'+_0x7b6f22['id'],_0x7b6f22);OpenchannelInteractionEvents[_0x2196('0xb')](_0x55431e,_0x7b6f22);_0x1177a1(null);})[_0x2196('0xc')](_0x1177a1(null));};}for(var e in events){if(events[_0x2196('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x2196('0xe')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xbce9=['Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x2c846e,_0x411255){var _0xfa6e17=function(_0x18a67d){while(--_0x18a67d){_0x2c846e['push'](_0x2c846e['shift']());}};_0xfa6e17(++_0x411255);}(_0xbce9,0x13b));var _0x9bce=function(_0x2abf68,_0x4ec499){_0x2abf68=_0x2abf68-0x0;var _0x2adec3=_0xbce9[_0x2abf68];return _0x2adec3;};'use strict';var EventEmitter=require(_0x9bce('0x0'));var OpenchannelInteraction=require(_0x9bce('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x9bce('0x2')](0x0);var events={'afterCreate':_0x9bce('0x3'),'afterUpdate':_0x9bce('0x4'),'afterDestroy':_0x9bce('0x5')};function emitEvent(_0x56f078){return function(_0x310430,_0x4ecfd7,_0x5505e9){_0x310430[_0x9bce('0x6')]({'attributes':['id'],'raw':!![]})[_0x9bce('0x7')](function(_0x406092){_0x310430[_0x9bce('0x8')](_0x9bce('0x9'),_0x406092[_0x9bce('0xa')](function(_0x331f0b){return{'id':_0x331f0b['id']};}));return OpenchannelMessage[_0x9bce('0xb')]({'where':{'OpenchannelInteractionId':_0x310430['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x50fec9){_0x310430[_0x9bce('0x8')](_0x9bce('0xc'),_0x50fec9[_0x9bce('0xd')]);OpenchannelInteractionEvents[_0x9bce('0xe')](_0x56f078+':'+_0x310430['id'],_0x310430);OpenchannelInteractionEvents[_0x9bce('0xe')](_0x56f078,_0x310430);_0x5505e9(null);})[_0x9bce('0xf')](_0x5505e9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x9bce('0x10')](e,emitEvent(event));}}module[_0x9bce('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 e035cc5..d28754d 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 _0x1fe0=['lodash','util','api','moment','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format'];(function(_0x333829,_0x1b5e6c){var _0x1902f6=function(_0x5dc738){while(--_0x5dc738){_0x333829['push'](_0x333829['shift']());}};_0x1902f6(++_0x1b5e6c);}(_0x1fe0,0x1e0));var _0x01fe=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x1fe0[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0x01fe('0x0'));var util=require(_0x01fe('0x1'));var logger=require('../../config/logger')(_0x01fe('0x2'));var moment=require(_0x01fe('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x01fe('0x4'));var rimraf=require(_0x01fe('0x5'));var config=require(_0x01fe('0x6'));var attributes=require(_0x01fe('0x7'));module['exports']=function(_0x581298,_0x557f15){return _0x581298[_0x01fe('0x8')](_0x01fe('0x9'),attributes,{'tableName':_0x01fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x01fe('0xb'),'collate':_0x01fe('0xc'),'hooks':{'beforeUpdate':function(_0x188768,_0x38128a,_0xeef864){if(_0x188768[_0x01fe('0xd')]('closed')){_0x188768[_0x01fe('0xe')]=moment()[_0x01fe('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0xeef864(null,_0x188768);}}});}; \ No newline at end of file +var _0x9077=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9077,0xcf));var _0x7907=function(_0x1f60f1,_0x497861){_0x1f60f1=_0x1f60f1-0x0;var _0x2afe9d=_0x9077[_0x1f60f1];return _0x2afe9d;};'use strict';var _=require(_0x7907('0x0'));var util=require('util');var logger=require(_0x7907('0x1'))(_0x7907('0x2'));var moment=require(_0x7907('0x3'));var BPromise=require(_0x7907('0x4'));var rp=require(_0x7907('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7907('0x6'));var config=require(_0x7907('0x7'));var attributes=require(_0x7907('0x8'));module[_0x7907('0x9')]=function(_0x5120ea,_0x3b6a90){return _0x5120ea[_0x7907('0xa')](_0x7907('0xb'),attributes,{'tableName':_0x7907('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7907('0xd'),'hooks':{'beforeUpdate':function(_0x4934ef,_0x5bc83e,_0x39c66f){if(_0x4934ef[_0x7907('0xe')](_0x7907('0xf'))){_0x4934ef[_0x7907('0x10')]=moment()[_0x7907('0x11')](_0x7907('0x12'));}_0x39c66f(null,_0x4934ef);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 5992825..a95320e 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 _0x0907=['debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','find','addTags','ids','spread','AddTags','lodash','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0x0907,0xcd));var _0x7090=function(_0xee8882,_0x2dc81f){_0xee8882=_0xee8882-0x0;var _0x317486=_0x0907[_0xee8882];return _0x317486;};'use strict';var _=require(_0x7090('0x0'));var util=require('util');var moment=require(_0x7090('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7090('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7090('0x3'));var logger=require(_0x7090('0x4'))('rpc');var config=require(_0x7090('0x5'));var jayson=require(_0x7090('0x6'));var client=jayson[_0x7090('0x7')][_0x7090('0x8')]({'port':0x232a});config[_0x7090('0x9')]=_[_0x7090('0xa')](config[_0x7090('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7090('0xb'))['register'](socket);function respondWithRpcPromise(_0x183e9e,_0x9684f8,_0x218f12){return new BPromise(function(_0x30a9e1,_0x4be2ad){return client[_0x7090('0xc')](_0x183e9e,_0x218f12)[_0x7090('0xd')](function(_0x4cad9){logger[_0x7090('0xe')](_0x7090('0xf'),_0x9684f8,_0x7090('0x10'));logger[_0x7090('0x11')](_0x7090('0x12'),_0x9684f8,_0x7090('0x10'),JSON[_0x7090('0x13')](_0x4cad9));if(_0x4cad9[_0x7090('0x14')]){if(_0x4cad9[_0x7090('0x14')][_0x7090('0x15')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x9684f8,_0x4cad9[_0x7090('0x14')]['message']);return _0x4be2ad(_0x4cad9['error'][_0x7090('0x16')]);}logger['error'](_0x7090('0xf'),_0x9684f8,_0x4cad9[_0x7090('0x14')][_0x7090('0x16')]);return _0x30a9e1(_0x4cad9['error'][_0x7090('0x16')]);}else{logger[_0x7090('0xe')]('OpenchannelInteraction,\x20%s,\x20%s',_0x9684f8,_0x7090('0x10'));_0x30a9e1(_0x4cad9[_0x7090('0x17')]['message']);}})[_0x7090('0x18')](function(_0x333d43){logger[_0x7090('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x9684f8,_0x333d43);_0x4be2ad(_0x333d43);});});}exports[_0x7090('0x19')]=function(_0x147b61){var _0x59e505=this;return new Promise(function(_0x18960a,_0x31466c){return db[_0x7090('0x1a')][_0x7090('0x1b')](_0x147b61[_0x7090('0x1c')],{'raw':_0x147b61[_0x7090('0x1d')]?_0x147b61[_0x7090('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x147b61[_0x7090('0x1d')]?_0x147b61['options'][_0x7090('0x1e')]||null:null,'attributes':_0x147b61[_0x7090('0x1d')]?_0x147b61[_0x7090('0x1d')][_0x7090('0x1f')]||null:null,'limit':_0x147b61[_0x7090('0x1d')]?_0x147b61[_0x7090('0x1d')]['limit']||null:null})[_0x7090('0xd')](function(_0x224849){logger['info'](_0x7090('0x19'),_0x147b61);logger['debug']('UpdateOpenchannelInteraction',_0x147b61,JSON[_0x7090('0x13')](_0x224849));_0x18960a(_0x224849);})[_0x7090('0x18')](function(_0x129eeb){logger['error'](_0x7090('0x19'),_0x129eeb[_0x7090('0x16')],_0x147b61);_0x31466c(_0x59e505[_0x7090('0x14')](0x1f4,_0x129eeb[_0x7090('0x16')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x27ed20){return new Promise(function(_0x1290b9,_0x379316){return db[_0x7090('0x1a')][_0x7090('0x20')]({'where':_0x27ed20[_0x7090('0x1d')]?_0x27ed20[_0x7090('0x1d')][_0x7090('0x1e')]||null:null})['then'](function(_0x468576){if(_0x468576){return _0x468576[_0x7090('0x21')](_0x27ed20[_0x7090('0x1c')][_0x7090('0x22')],_['omit'](_0x27ed20[_0x7090('0x1c')],[_0x7090('0x22'),'id'])||{});}})[_0x7090('0x23')](function(_0x315efa){logger['info'](_0x7090('0x24'),_0x27ed20);logger[_0x7090('0x11')](_0x7090('0x24'),_0x27ed20,JSON[_0x7090('0x13')](_0x315efa));_0x1290b9(_0x315efa);})[_0x7090('0x18')](function(_0x447c5e){logger[_0x7090('0x14')](_0x7090('0x24'),_0x447c5e[_0x7090('0x16')],_0x27ed20);_0x379316(_this['error'](0x1f4,_0x447c5e[_0x7090('0x16')]));});});}; \ No newline at end of file +var _0x3109=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','info','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','omit','ids','spread','AddTags','lodash','util','moment'];(function(_0x54fbff,_0x53470e){var _0x5cf619=function(_0x28765b){while(--_0x28765b){_0x54fbff['push'](_0x54fbff['shift']());}};_0x5cf619(++_0x53470e);}(_0x3109,0xd4));var _0x9310=function(_0x21b052,_0x1abe23){_0x21b052=_0x21b052-0x0;var _0x1358be=_0x3109[_0x21b052];return _0x1358be;};'use strict';var _=require(_0x9310('0x0'));var util=require(_0x9310('0x1'));var moment=require(_0x9310('0x2'));var BPromise=require('bluebird');var rs=require(_0x9310('0x3'));var fs=require('fs');var Redis=require(_0x9310('0x4'));var db=require(_0x9310('0x5'))['db'];var utils=require(_0x9310('0x6'));var logger=require(_0x9310('0x7'))('rpc');var config=require(_0x9310('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9310('0x9')][_0x9310('0xa')]({'port':0x232a});config[_0x9310('0xb')]=_['defaults'](config['redis'],{'host':_0x9310('0xc'),'port':0x18eb});var socket=require(_0x9310('0xd'))(new Redis(config[_0x9310('0xb')]));require(_0x9310('0xe'))[_0x9310('0xf')](socket);function respondWithRpcPromise(_0x3175f4,_0x1731b0,_0x337043){return new BPromise(function(_0x545f2f,_0x37e5f7){return client[_0x9310('0x10')](_0x3175f4,_0x337043)[_0x9310('0x11')](function(_0x56ac56){logger['info'](_0x9310('0x12'),_0x1731b0,_0x9310('0x13'));logger[_0x9310('0x14')](_0x9310('0x15'),_0x1731b0,_0x9310('0x13'),JSON[_0x9310('0x16')](_0x56ac56));if(_0x56ac56[_0x9310('0x17')]){if(_0x56ac56['error'][_0x9310('0x18')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x1731b0,_0x56ac56[_0x9310('0x17')][_0x9310('0x19')]);return _0x37e5f7(_0x56ac56[_0x9310('0x17')]['message']);}logger[_0x9310('0x17')](_0x9310('0x12'),_0x1731b0,_0x56ac56[_0x9310('0x17')]['message']);return _0x545f2f(_0x56ac56[_0x9310('0x17')]['message']);}else{logger['info'](_0x9310('0x12'),_0x1731b0,_0x9310('0x13'));_0x545f2f(_0x56ac56['result']['message']);}})[_0x9310('0x1a')](function(_0x33a698){logger[_0x9310('0x17')](_0x9310('0x12'),_0x1731b0,_0x33a698);_0x37e5f7(_0x33a698);});});}exports['UpdateOpenchannelInteraction']=function(_0x32c98c){var _0xf08bae=this;return new Promise(function(_0x9b6851,_0x290edc){return db[_0x9310('0x1b')][_0x9310('0x1c')](_0x32c98c[_0x9310('0x1d')],{'raw':_0x32c98c['options']?_0x32c98c[_0x9310('0x1e')][_0x9310('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32c98c[_0x9310('0x1e')]?_0x32c98c[_0x9310('0x1e')][_0x9310('0x20')]||null:null,'attributes':_0x32c98c[_0x9310('0x1e')]?_0x32c98c[_0x9310('0x1e')][_0x9310('0x21')]||null:null,'limit':_0x32c98c['options']?_0x32c98c[_0x9310('0x1e')][_0x9310('0x22')]||null:null})[_0x9310('0x11')](function(_0x3401a7){logger[_0x9310('0x23')](_0x9310('0x24'),_0x32c98c);logger['debug'](_0x9310('0x24'),_0x32c98c,JSON['stringify'](_0x3401a7));_0x9b6851(_0x3401a7);})[_0x9310('0x1a')](function(_0x20fb90){logger[_0x9310('0x17')](_0x9310('0x24'),_0x20fb90[_0x9310('0x19')],_0x32c98c);_0x290edc(_0xf08bae[_0x9310('0x17')](0x1f4,_0x20fb90[_0x9310('0x19')]));});});};exports[_0x9310('0x25')]=function(_0x336137){return new Promise(function(_0x2429ea,_0x511642){return db[_0x9310('0x1b')][_0x9310('0x26')]({'where':_0x336137[_0x9310('0x1e')]?_0x336137['options']['where']||null:null})[_0x9310('0x11')](function(_0x57e71d){if(_0x57e71d){return _0x57e71d['addTags'](_0x336137[_0x9310('0x1d')]['ids'],_[_0x9310('0x27')](_0x336137[_0x9310('0x1d')],[_0x9310('0x28'),'id'])||{});}})[_0x9310('0x29')](function(_0x4f7b1a){logger[_0x9310('0x23')](_0x9310('0x2a'),_0x336137);logger[_0x9310('0x14')](_0x9310('0x2a'),_0x336137,JSON[_0x9310('0x16')](_0x4f7b1a));_0x2429ea(_0x4f7b1a);})[_0x9310('0x1a')](function(_0x124260){logger[_0x9310('0x17')]('AddTags',_0x124260[_0x9310('0x19')],_0x336137);_0x511642(_this[_0x9310('0x17')](0x1f4,_0x124260[_0x9310('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index b5f8c72..8ba55b2 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 _0x2a3b=['update','emit','removeListener','register','length','openchannelInteraction:','remove'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2a3b,0x109));var _0xb2a3=function(_0x2a4cdf,_0x411c4b){_0x2a4cdf=_0x2a4cdf-0x0;var _0x2fe1cd=_0x2a3b[_0x2a4cdf];return _0x2fe1cd;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0xb2a3('0x0'),_0xb2a3('0x1')];function createListener(_0x539448,_0x32149c){return function(_0x3f66f2){_0x32149c[_0xb2a3('0x2')](_0x539448,_0x3f66f2);};}function removeListener(_0x2c8074,_0x1d4869){return function(){OpenchannelInteractionEvents[_0xb2a3('0x3')](_0x2c8074,_0x1d4869);};}exports[_0xb2a3('0x4')]=function(_0xcf0db6){for(var _0x14d488=0x0,_0x520091=events[_0xb2a3('0x5')];_0x14d488<_0x520091;_0x14d488++){var _0x469f13=events[_0x14d488];var _0x8a89cc=createListener(_0xb2a3('0x6')+_0x469f13,_0xcf0db6);OpenchannelInteractionEvents['on'](_0x469f13,_0x8a89cc);}}; \ No newline at end of file +var _0x24d5=['./openchannelInteraction.events','save','update','emit','removeListener','register','length','openchannelInteraction:'];(function(_0x5be746,_0x45221b){var _0x316d7d=function(_0x95018e){while(--_0x95018e){_0x5be746['push'](_0x5be746['shift']());}};_0x316d7d(++_0x45221b);}(_0x24d5,0xc0));var _0x524d=function(_0x27bf65,_0x205f1c){_0x27bf65=_0x27bf65-0x0;var _0x7f9e76=_0x24d5[_0x27bf65];return _0x7f9e76;};'use strict';var OpenchannelInteractionEvents=require(_0x524d('0x0'));var events=[_0x524d('0x1'),'remove',_0x524d('0x2')];function createListener(_0x7da4b7,_0x12c98b){return function(_0x27660a){_0x12c98b[_0x524d('0x3')](_0x7da4b7,_0x27660a);};}function removeListener(_0x3d53ff,_0x4c1078){return function(){OpenchannelInteractionEvents[_0x524d('0x4')](_0x3d53ff,_0x4c1078);};}exports[_0x524d('0x5')]=function(_0xd39ad){for(var _0x9f9f39=0x0,_0x147bf0=events[_0x524d('0x6')];_0x9f9f39<_0x147bf0;_0x9f9f39++){var _0x2e1d64=events[_0x9f9f39];var _0x589b20=createListener(_0x524d('0x7')+_0x2e1d64,_0xd39ad);OpenchannelInteractionEvents['on'](_0x2e1d64,_0x589b20);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 0a22a5a..cd5db87 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e0,0x17b));var _0x070e=function(_0x81ba5f,_0x35e0d0){_0x81ba5f=_0x81ba5f-0x0;var _0x2b518b=_0x70e0[_0x81ba5f];return _0x2b518b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x5aa4b5,_0x5bfafa){var _0x4d9917=function(_0xbdc27e){while(--_0xbdc27e){_0x5aa4b5['push'](_0x5aa4b5['shift']());}};_0x4d9917(++_0x5bfafa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 697d502..17dd341 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 _0xefe2=['TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0xefe2,0xd9));var _0x2efe=function(_0x3eb800,_0x263792){_0x3eb800=_0x3eb800-0x0;var _0x32b52f=_0xefe2[_0x3eb800];return _0x32b52f;};'use strict';var Sequelize=require(_0x2efe('0x0'));module[_0x2efe('0x1')]={'body':{'type':Sequelize['TEXT'](_0x2efe('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2efe('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2efe('0x4')]('in','out'),'defaultValue':_0x2efe('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2efe('0x6')]},'providerName':{'type':Sequelize[_0x2efe('0x7')]},'providerResponse':{'type':Sequelize[_0x2efe('0x8')]}}; \ No newline at end of file +var _0x02ce=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','BOOLEAN'];(function(_0x1207d2,_0x4ef3d6){var _0x129332=function(_0xe5db56){while(--_0xe5db56){_0x1207d2['push'](_0x1207d2['shift']());}};_0x129332(++_0x4ef3d6);}(_0x02ce,0x1ac));var _0xe02c=function(_0x1dee5c,_0x39a692){_0x1dee5c=_0x1dee5c-0x0;var _0x172e13=_0x02ce[_0x1dee5c];return _0x172e13;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'body':{'type':Sequelize[_0xe02c('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe02c('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe02c('0x4')]('in',_0xe02c('0x5')),'defaultValue':_0xe02c('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe02c('0x6')]},'providerName':{'type':Sequelize[_0xe02c('0x7')]},'providerResponse':{'type':Sequelize[_0xe02c('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 50045f6..cefd7e3 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 _0x09f3=['sort','where','pick','merge','type','options','includeAll','include','findAll','rows','show','params','fields','length','find','catch','body','describe','openchannel-interactions','accept','openchannel','readAt','format','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','reject','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','destroy','stack','name','index','map','OpenchannelMessage','rawAttributes','key','keys','filters','model','attributes','intersection','query','hasOwnProperty','order'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x09f3,0x1c5));var _0x309f=function(_0x19997d,_0x2c92a4){_0x19997d=_0x19997d-0x0;var _0x49be7f=_0x09f3[_0x19997d];return _0x49be7f;};'use strict';var emlformat=require(_0x309f('0x0'));var rimraf=require(_0x309f('0x1'));var zipdir=require(_0x309f('0x2'));var jsonpatch=require(_0x309f('0x3'));var rp=require(_0x309f('0x4'));var moment=require(_0x309f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x309f('0x6'));var util=require('util');var path=require(_0x309f('0x7'));var sox=require(_0x309f('0x8'));var csv=require(_0x309f('0x9'));var ejs=require(_0x309f('0xa'));var fs=require('fs');var fs_extra=require(_0x309f('0xb'));var _=require(_0x309f('0xc'));var squel=require(_0x309f('0xd'));var crypto=require('crypto');var jsforce=require(_0x309f('0xe'));var deskjs=require(_0x309f('0xf'));var toCsv=require(_0x309f('0x9'));var querystring=require(_0x309f('0x10'));var Papa=require(_0x309f('0x11'));var Redis=require('ioredis');var authService=require(_0x309f('0x12'));var qs=require(_0x309f('0x13'));var as=require(_0x309f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x309f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x309f('0x16'));var db=require(_0x309f('0x17'))['db'];config[_0x309f('0x18')]=_[_0x309f('0x19')](config[_0x309f('0x18')],{'host':_0x309f('0x1a'),'port':0x18eb});var socket=require(_0x309f('0x1b'))(new Redis(config[_0x309f('0x18')]));require(_0x309f('0x1c'))[_0x309f('0x1d')](socket);var jayson=require(_0x309f('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x309f('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32e07d,_0xe7817c,_0x5a7364,_0x1645a6){return new BPromise(function(_0x337eb3,_0x4817c4){var _0x12a65a=_0x1645a6||client;return _0x12a65a[_0x309f('0x20')](_0x32e07d,_0x5a7364)[_0x309f('0x21')](function(_0x1a548a){logger[_0x309f('0x22')](_0x309f('0x23'),_0xe7817c,'request\x20sent');logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xe7817c,'request\x20sent',JSON[_0x309f('0x24')](_0x1a548a));if(_0x1a548a[_0x309f('0x25')]){if(_0x1a548a[_0x309f('0x25')][_0x309f('0x26')]===0x1f4){logger[_0x309f('0x25')](_0x309f('0x23'),_0xe7817c,_0x1a548a[_0x309f('0x25')]['message']);return _0x4817c4(_0x1a548a[_0x309f('0x25')][_0x309f('0x27')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xe7817c,_0x1a548a[_0x309f('0x25')][_0x309f('0x27')]);return _0x337eb3(_0x1a548a[_0x309f('0x25')]['message']);}else{logger[_0x309f('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0xe7817c,_0x309f('0x28'));_0x337eb3(_0x1a548a[_0x309f('0x29')][_0x309f('0x27')]);}})['catch'](function(_0x358769){logger['error'](_0x309f('0x23'),_0xe7817c,_0x358769);_0x4817c4(_0x358769);});});}function respondWithStatusCode(_0x5dd63f,_0x482b7e){_0x482b7e=_0x482b7e||0xcc;return function(_0x3c5016){if(_0x3c5016){return _0x5dd63f[_0x309f('0x2a')](_0x482b7e);}return _0x5dd63f['status'](_0x482b7e)[_0x309f('0x2b')]();};}function respondWithResult(_0x6559ca,_0x551b38){_0x551b38=_0x551b38||0xc8;return function(_0x103ec9){if(_0x103ec9){return _0x6559ca[_0x309f('0x2c')](_0x551b38)['json'](_0x103ec9);}};}function respondWithFilteredResult(_0xeddd52,_0x12806a){return function(_0x1cd5de){if(_0x1cd5de){var _0x56cd95=typeof _0x12806a[_0x309f('0x2d')]==='undefined'&&typeof _0x12806a['limit']===_0x309f('0x2e');var _0x5329df=_0x1cd5de[_0x309f('0x2f')];var _0x5d0bb9=_0x56cd95?0x0:_0x12806a[_0x309f('0x2d')];var _0x341a92=_0x56cd95?_0x1cd5de['count']:_0x12806a[_0x309f('0x2d')]+_0x12806a[_0x309f('0x30')];var _0x2bc487;if(_0x341a92>=_0x5329df){_0x341a92=_0x5329df;_0x2bc487=0xc8;}else{_0x2bc487=0xce;}_0xeddd52[_0x309f('0x2c')](_0x2bc487);return _0xeddd52[_0x309f('0x31')](_0x309f('0x32'),_0x5d0bb9+'-'+_0x341a92+'/'+_0x5329df)[_0x309f('0x33')](_0x1cd5de);}return null;};}function patchUpdates(_0x416d0f){return function(_0x3f99bb){try{jsonpatch[_0x309f('0x34')](_0x3f99bb,_0x416d0f,!![]);}catch(_0x2f8e85){return BPromise['reject'](_0x2f8e85);}return _0x3f99bb[_0x309f('0x35')]();};}function saveUpdates(_0x62f311,_0x312bf8){return function(_0x592cee){if(_0x592cee){return _0x592cee[_0x309f('0x36')](_0x62f311)[_0x309f('0x21')](function(_0xccbe3){return _0xccbe3;});}return null;};}function removeEntity(_0x50029c,_0x5f2b81){return function(_0x451ccf){if(_0x451ccf){return _0x451ccf[_0x309f('0x37')]()[_0x309f('0x21')](function(){_0x50029c[_0x309f('0x2c')](0xcc)[_0x309f('0x2b')]();});}};}function handleEntityNotFound(_0x554c53,_0x5e65df){return function(_0x3ed577){if(!_0x3ed577){_0x554c53['sendStatus'](0x194);}return _0x3ed577;};}function handleError(_0xe3682f,_0x513efe){_0x513efe=_0x513efe||0x1f4;return function(_0x1d0474){logger['error'](_0x1d0474[_0x309f('0x38')]);if(_0x1d0474[_0x309f('0x39')]){delete _0x1d0474[_0x309f('0x39')];}_0xe3682f['status'](_0x513efe)['send'](_0x1d0474);};}exports[_0x309f('0x3a')]=function(_0x23712e,_0x51b55b){var _0x3ed090={},_0x1f120a={},_0x1212d8={'count':0x0,'rows':[]};var _0x59bce4=_[_0x309f('0x3b')](db[_0x309f('0x3c')][_0x309f('0x3d')],function(_0x9d8132){return{'name':_0x9d8132['fieldName'],'type':_0x9d8132['type'][_0x309f('0x3e')]};});_0x1f120a['model']=_['map'](_0x59bce4,_0x309f('0x39'));_0x1f120a['query']=_[_0x309f('0x3f')](_0x23712e['query']);_0x1f120a[_0x309f('0x40')]=_['intersection'](_0x1f120a[_0x309f('0x41')],_0x1f120a['query']);_0x3ed090[_0x309f('0x42')]=_[_0x309f('0x43')](_0x1f120a[_0x309f('0x41')],qs['fields'](_0x23712e[_0x309f('0x44')]['fields']));_0x3ed090[_0x309f('0x42')]=_0x3ed090[_0x309f('0x42')]['length']?_0x3ed090[_0x309f('0x42')]:_0x1f120a[_0x309f('0x41')];if(!_0x23712e[_0x309f('0x44')][_0x309f('0x45')]('nolimit')){_0x3ed090[_0x309f('0x30')]=qs[_0x309f('0x30')](_0x23712e[_0x309f('0x44')][_0x309f('0x30')]);_0x3ed090['offset']=qs[_0x309f('0x2d')](_0x23712e[_0x309f('0x44')]['offset']);}_0x3ed090[_0x309f('0x46')]=qs['sort'](_0x23712e['query'][_0x309f('0x47')]);_0x3ed090[_0x309f('0x48')]=qs[_0x309f('0x40')](_[_0x309f('0x49')](_0x23712e[_0x309f('0x44')],_0x1f120a[_0x309f('0x40')]),_0x59bce4);if(_0x23712e['query']['filter']){_0x3ed090[_0x309f('0x48')]=_[_0x309f('0x4a')](_0x3ed090['where'],{'$or':_[_0x309f('0x3b')](_0x59bce4,function(_0x4e5262){if(_0x4e5262[_0x309f('0x4b')]!=='VIRTUAL'){var _0x16aa73={};_0x16aa73[_0x4e5262[_0x309f('0x39')]]={'$like':'%'+_0x23712e[_0x309f('0x44')]['filter']+'%'};return _0x16aa73;}})});}_0x3ed090=_[_0x309f('0x4a')]({},_0x3ed090,_0x23712e[_0x309f('0x4c')]);var _0x3a0e24={'where':_0x3ed090['where']};return db['OpenchannelMessage'][_0x309f('0x2f')](_0x3a0e24)[_0x309f('0x21')](function(_0x554ad1){_0x1212d8['count']=_0x554ad1;if(_0x23712e[_0x309f('0x44')][_0x309f('0x4d')]){_0x3ed090[_0x309f('0x4e')]=[{'all':!![]}];}return db[_0x309f('0x3c')][_0x309f('0x4f')](_0x3ed090);})[_0x309f('0x21')](function(_0x48bb43){_0x1212d8[_0x309f('0x50')]=_0x48bb43;return _0x1212d8;})[_0x309f('0x21')](respondWithFilteredResult(_0x51b55b,_0x3ed090))['catch'](handleError(_0x51b55b,null));};exports[_0x309f('0x51')]=function(_0x4f16d4,_0x231ac1){var _0x2a4dc2={'raw':!![],'where':{'id':_0x4f16d4[_0x309f('0x52')]['id']}},_0x3206d9={};_0x3206d9['model']=_[_0x309f('0x3f')](db[_0x309f('0x3c')]['rawAttributes']);_0x3206d9[_0x309f('0x44')]=_[_0x309f('0x3f')](_0x4f16d4['query']);_0x3206d9[_0x309f('0x40')]=_[_0x309f('0x43')](_0x3206d9[_0x309f('0x41')],_0x3206d9[_0x309f('0x44')]);_0x2a4dc2[_0x309f('0x42')]=_[_0x309f('0x43')](_0x3206d9[_0x309f('0x41')],qs[_0x309f('0x53')](_0x4f16d4[_0x309f('0x44')][_0x309f('0x53')]));_0x2a4dc2[_0x309f('0x42')]=_0x2a4dc2[_0x309f('0x42')][_0x309f('0x54')]?_0x2a4dc2[_0x309f('0x42')]:_0x3206d9[_0x309f('0x41')];if(_0x4f16d4['query'][_0x309f('0x4d')]){_0x2a4dc2[_0x309f('0x4e')]=[{'all':!![]}];}_0x2a4dc2=_[_0x309f('0x4a')]({},_0x2a4dc2,_0x4f16d4[_0x309f('0x4c')]);return db['OpenchannelMessage'][_0x309f('0x55')](_0x2a4dc2)[_0x309f('0x21')](handleEntityNotFound(_0x231ac1,null))[_0x309f('0x21')](respondWithResult(_0x231ac1,null))[_0x309f('0x56')](handleError(_0x231ac1,null));};exports['create']=function(_0x3f6473,_0x200e3b){return db[_0x309f('0x3c')]['create'](_0x3f6473[_0x309f('0x57')],{})[_0x309f('0x21')](respondWithResult(_0x200e3b,0xc9))[_0x309f('0x56')](handleError(_0x200e3b,null));};exports['update']=function(_0x3f428f,_0x2dc669){if(_0x3f428f[_0x309f('0x57')]['id']){delete _0x3f428f[_0x309f('0x57')]['id'];}return db[_0x309f('0x3c')][_0x309f('0x55')]({'where':{'id':_0x3f428f['params']['id']}})['then'](handleEntityNotFound(_0x2dc669,null))[_0x309f('0x21')](saveUpdates(_0x3f428f['body'],null))[_0x309f('0x21')](respondWithResult(_0x2dc669,null))[_0x309f('0x56')](handleError(_0x2dc669,null));};exports['destroy']=function(_0x3d9075,_0x12d019){return db[_0x309f('0x3c')]['find']({'where':{'id':_0x3d9075['params']['id']}})[_0x309f('0x21')](handleEntityNotFound(_0x12d019,null))[_0x309f('0x21')](removeEntity(_0x12d019,null))[_0x309f('0x56')](handleError(_0x12d019,null));};exports[_0x309f('0x58')]=function(_0x414b39,_0x4969aa){return db[_0x309f('0x3c')][_0x309f('0x58')]()['then'](respondWithResult(_0x4969aa,null))[_0x309f('0x56')](handleError(_0x4969aa,null));};var interaction_log=require('../../config/logger')(_0x309f('0x59'));exports[_0x309f('0x5a')]=function(_0x5f3213,_0x37eea0,_0x4c24d2){var _0x3d56ad={'agent':{},'channel':_0x309f('0x5b')};if(_0x5f3213[_0x309f('0x57')]['id']){delete _0x5f3213['body']['id'];}_0x5f3213[_0x309f('0x57')]['read']=!![];_0x5f3213[_0x309f('0x57')][_0x309f('0x5c')]=moment()[_0x309f('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x5f3213['body'][_0x309f('0x5e')]=_0x5f3213[_0x309f('0x57')]['UserId']||_0x5f3213[_0x309f('0x5f')]['id'];_0x3d56ad[_0x309f('0x60')]['id']=_0x5f3213[_0x309f('0x57')][_0x309f('0x5e')];return db[_0x309f('0x3c')]['find']({'where':{'id':_0x5f3213['params']['id'],'UserId':null}})[_0x309f('0x21')](handleEntityNotFound(_0x37eea0,null))[_0x309f('0x21')](saveUpdates(_0x5f3213['body'],null))[_0x309f('0x21')](function(_0x51218d){if(_0x51218d){_0x3d56ad[_0x309f('0x27')]=_0x51218d['get']({'plain':!![]});return db[_0x309f('0x61')]['find']({'where':{'id':_0x51218d[_0x309f('0x62')]}});}return null;})[_0x309f('0x21')](handleEntityNotFound(_0x37eea0,null))[_0x309f('0x21')](function(_0x4ac202){if(_0x4ac202){return _0x4ac202[_0x309f('0x36')]({'UserId':_0x5f3213[_0x309f('0x57')][_0x309f('0x5e')],'read1stAt':_[_0x309f('0x63')](_0x4ac202['read1stAt'])?moment()[_0x309f('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4ea683){if(_0x4ea683){_0x3d56ad[_0x309f('0x64')]=_0x4ea683['get']({'plain':!![]});interaction_log[_0x309f('0x22')](_0x309f('0x65'),_0x5f3213[_0x309f('0x5f')]['id'],_0x5f3213[_0x309f('0x5f')][_0x309f('0x39')],_0x5f3213[_0x309f('0x5f')][_0x309f('0x66')],_0x3d56ad[_0x309f('0x64')]['id'],_0x5f3213[_0x309f('0x57')]?JSON[_0x309f('0x24')](_0x5f3213[_0x309f('0x57')]):_0x309f('0x67'));return respondWithRpcPromise(_0x309f('0x68'),_0x309f('0x69'),_0x3d56ad);}return null;})[_0x309f('0x21')](function(_0x29b94b){var _0x9b8ea=_0x309f('0x6a')+_0x29b94b['message'][_0x309f('0x6b')];return db[_0x309f('0x6c')][_0x309f('0x44')](_0x9b8ea,{'type':db['Sequelize'][_0x309f('0x6d')]['SELECT'],'raw':!![]})[_0x309f('0x21')](function(_0x47a1ed){return _0x47a1ed;});})['then'](function(_0xe5cc8){if(_0xe5cc8){_0x3d56ad[_0x309f('0x27')][_0x309f('0x6e')]=_0xe5cc8[0x0];if(!_0x5f3213['body']['UserId'])return;return db[_0x309f('0x6f')][_0x309f('0x55')]({'where':{'id':_0x5f3213[_0x309f('0x57')][_0x309f('0x5e')],'role':'agent'},'attributes':['id',_0x309f('0x39'),_0x309f('0x70'),_0x309f('0x71'),_0x309f('0x72')],'raw':!![]});}return null;})[_0x309f('0x21')](function(_0x53af10){if(!_0x53af10)return null;_0x3d56ad[_0x309f('0x27')]['agent']=_0x53af10;return _0x3d56ad;})[_0x309f('0x21')](function(_0x1078d8){if(_0x1078d8){if(_0x5f3213[_0x309f('0x57')][_0x309f('0x73')]){_0x3d56ad[_0x309f('0x27')][_0x309f('0x74')]=util[_0x309f('0x5d')](_0x309f('0x75'),_0x5f3213['user'][_0x309f('0x39')]);_0x3d56ad[_0x309f('0x27')][_0x309f('0x76')]=_0x3d56ad[_0x309f('0x76')];_0x3d56ad[_0x309f('0x27')][_0x309f('0x77')]=_0x3d56ad['channel'];_0x3d56ad['message'][_0x309f('0x78')]=_0x309f('0x5a');return respondWithRpcPromise(_0x309f('0x79'),_0x309f('0x79'),{'event':_0x309f('0x7a'),'message':_0x3d56ad[_0x309f('0x27')]},client9002)['then'](function(){return _0x3d56ad;});}return _0x3d56ad;}return null;})[_0x309f('0x21')](respondWithResult(_0x37eea0,null))['catch'](handleError(_0x37eea0,null));};var interaction_log=require(_0x309f('0x7b'))('openchannel-interactions');exports[_0x309f('0x7c')]=function(_0x554c28,_0x2c235b,_0x5d0690){var _0x5d623c={'agent':{},'channel':_0x309f('0x5b')};if(_0x554c28[_0x309f('0x57')]['id']){delete _0x554c28['body']['id'];}_0x554c28['body']['UserId']=_0x554c28[_0x309f('0x57')]['UserId']||_0x554c28[_0x309f('0x5f')]['id'];_0x5d623c[_0x309f('0x60')]['id']=_0x554c28[_0x309f('0x57')][_0x309f('0x5e')];return db[_0x309f('0x3c')][_0x309f('0x55')]({'where':{'id':_0x554c28['params']['id'],'UserId':null}})[_0x309f('0x21')](handleEntityNotFound(_0x2c235b,null))['then'](function(_0x3ac82d){if(_0x3ac82d){_0x5d623c['message']=_0x3ac82d[_0x309f('0x7d')]({'plain':!![]});return db[_0x309f('0x61')][_0x309f('0x55')]({'where':{'id':_0x3ac82d[_0x309f('0x62')]}});}return null;})[_0x309f('0x21')](handleEntityNotFound(_0x2c235b,null))[_0x309f('0x21')](function(_0x17aa16){if(_0x17aa16){_0x5d623c[_0x309f('0x64')]=_0x17aa16[_0x309f('0x7d')]({'plain':!![]});interaction_log[_0x309f('0x22')](_0x309f('0x7e'),_0x554c28[_0x309f('0x5f')]['id'],_0x554c28[_0x309f('0x5f')][_0x309f('0x39')],_0x554c28[_0x309f('0x5f')][_0x309f('0x66')],_0x5d623c['interaction']['id'],_0x554c28[_0x309f('0x57')]?JSON[_0x309f('0x24')](_0x554c28[_0x309f('0x57')]):_0x309f('0x67'));return respondWithRpcPromise(_0x309f('0x7f'),_0x309f('0x80'),_0x5d623c);}return null;})[_0x309f('0x21')](function(_0x5617ad){var _0x276674='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5617ad[_0x309f('0x27')][_0x309f('0x6b')];return db['sequelize']['query'](_0x276674,{'type':db['Sequelize'][_0x309f('0x6d')][_0x309f('0x81')],'raw':!![]})[_0x309f('0x21')](function(_0x24e660){return _0x24e660;});})['then'](function(_0x51a67b){if(_0x51a67b){_0x5d623c['message'][_0x309f('0x6e')]=_0x51a67b[0x0];if(!_0x554c28['body'][_0x309f('0x5e')])return;return db[_0x309f('0x6f')][_0x309f('0x55')]({'where':{'id':_0x554c28[_0x309f('0x57')][_0x309f('0x5e')],'role':_0x309f('0x60')},'attributes':['id',_0x309f('0x39'),'fullname',_0x309f('0x71'),_0x309f('0x72')],'raw':!![]});}return null;})[_0x309f('0x21')](function(_0x3ddbd5){if(!_0x3ddbd5)return null;_0x5d623c['message'][_0x309f('0x60')]=_0x3ddbd5;return _0x5d623c;})['then'](function(_0x11f274){if(_0x11f274){_0x11f274[_0x309f('0x27')][_0x309f('0x74')]=util[_0x309f('0x5d')]('SIP/%s',_0x554c28[_0x309f('0x5f')][_0x309f('0x39')]);_0x11f274[_0x309f('0x27')][_0x309f('0x76')]=_0x5d623c[_0x309f('0x76')];_0x11f274[_0x309f('0x27')][_0x309f('0x77')]=_0x5d623c['channel'];_0x11f274[_0x309f('0x27')][_0x309f('0x78')]=_0x309f('0x7c');respondWithRpcPromise('EventManager','EventManager',{'event':_0x309f('0x82'),'message':_0x11f274['message']},client9002);return _0x5d623c;}return null;})[_0x309f('0x21')](respondWithResult(_0x2c235b,null))[_0x309f('0x56')](handleError(_0x2c235b,null));}; \ No newline at end of file +var _0xf773=['count','Content-Range','apply','reject','save','destroy','end','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','show','params','include','find','create','update','body','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','fullname','internal','channel','event','EventManager','acceptmessage','../../config/logger','openchannel-interactions','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','User','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','localhost','socket.io-emitter','redis','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit'];(function(_0x1c4865,_0x315345){var _0x545286=function(_0x1191b6){while(--_0x1191b6){_0x1c4865['push'](_0x1c4865['shift']());}};_0x545286(++_0x315345);}(_0xf773,0x154));var _0x3f77=function(_0x370d81,_0x52f5d5){_0x370d81=_0x370d81-0x0;var _0x368f21=_0xf773[_0x370d81];return _0x368f21;};'use strict';var emlformat=require(_0x3f77('0x0'));var rimraf=require(_0x3f77('0x1'));var zipdir=require(_0x3f77('0x2'));var jsonpatch=require(_0x3f77('0x3'));var rp=require(_0x3f77('0x4'));var moment=require(_0x3f77('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3f77('0x6'));var path=require('path');var sox=require(_0x3f77('0x7'));var csv=require('to-csv');var ejs=require(_0x3f77('0x8'));var fs=require('fs');var fs_extra=require(_0x3f77('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3f77('0xa'));var jsforce=require(_0x3f77('0xb'));var deskjs=require(_0x3f77('0xc'));var toCsv=require(_0x3f77('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3f77('0xe'));var authService=require(_0x3f77('0xf'));var qs=require(_0x3f77('0x10'));var as=require(_0x3f77('0x11'));var hardwareService=require(_0x3f77('0x12'));var logger=require('../../config/logger')(_0x3f77('0x13'));var utils=require(_0x3f77('0x14'));var config=require(_0x3f77('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x3f77('0x16'),'port':0x18eb});var socket=require(_0x3f77('0x17'))(new Redis(config[_0x3f77('0x18')]));require('./openchannelMessage.socket')[_0x3f77('0x19')](socket);var jayson=require(_0x3f77('0x1a'));var client=jayson[_0x3f77('0x1b')][_0x3f77('0x1c')]({'port':0x232c});var client9002=jayson[_0x3f77('0x1b')][_0x3f77('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4d459a,_0x9afdb5,_0x43005a,_0x5e2c67){return new BPromise(function(_0x24adba,_0x3784a4){var _0x313d36=_0x5e2c67||client;return _0x313d36[_0x3f77('0x1d')](_0x4d459a,_0x43005a)[_0x3f77('0x1e')](function(_0x4eef1a){logger[_0x3f77('0x1f')](_0x3f77('0x20'),_0x9afdb5,_0x3f77('0x21'));logger[_0x3f77('0x22')](_0x3f77('0x23'),_0x9afdb5,_0x3f77('0x21'),JSON['stringify'](_0x4eef1a));if(_0x4eef1a[_0x3f77('0x24')]){if(_0x4eef1a['error'][_0x3f77('0x25')]===0x1f4){logger[_0x3f77('0x24')](_0x3f77('0x20'),_0x9afdb5,_0x4eef1a[_0x3f77('0x24')][_0x3f77('0x26')]);return _0x3784a4(_0x4eef1a[_0x3f77('0x24')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x9afdb5,_0x4eef1a[_0x3f77('0x24')][_0x3f77('0x26')]);return _0x24adba(_0x4eef1a[_0x3f77('0x24')][_0x3f77('0x26')]);}else{logger[_0x3f77('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x9afdb5,_0x3f77('0x21'));_0x24adba(_0x4eef1a[_0x3f77('0x27')]['message']);}})[_0x3f77('0x28')](function(_0x2f93ec){logger[_0x3f77('0x24')](_0x3f77('0x20'),_0x9afdb5,_0x2f93ec);_0x3784a4(_0x2f93ec);});});}function respondWithStatusCode(_0x43be56,_0x3f49f7){_0x3f49f7=_0x3f49f7||0xcc;return function(_0x3ec98a){if(_0x3ec98a){return _0x43be56[_0x3f77('0x29')](_0x3f49f7);}return _0x43be56[_0x3f77('0x2a')](_0x3f49f7)['end']();};}function respondWithResult(_0x5c13c7,_0x6859f6){_0x6859f6=_0x6859f6||0xc8;return function(_0x22b3ad){if(_0x22b3ad){return _0x5c13c7[_0x3f77('0x2a')](_0x6859f6)[_0x3f77('0x2b')](_0x22b3ad);}};}function respondWithFilteredResult(_0x15e246,_0x28dc12){return function(_0x3c08f6){if(_0x3c08f6){var _0x1f4392=typeof _0x28dc12[_0x3f77('0x2c')]===_0x3f77('0x2d')&&typeof _0x28dc12[_0x3f77('0x2e')]==='undefined';var _0x1fe0c6=_0x3c08f6['count'];var _0x58ef2a=_0x1f4392?0x0:_0x28dc12[_0x3f77('0x2c')];var _0x1d4e4c=_0x1f4392?_0x3c08f6[_0x3f77('0x2f')]:_0x28dc12['offset']+_0x28dc12['limit'];var _0x43253f;if(_0x1d4e4c>=_0x1fe0c6){_0x1d4e4c=_0x1fe0c6;_0x43253f=0xc8;}else{_0x43253f=0xce;}_0x15e246[_0x3f77('0x2a')](_0x43253f);return _0x15e246['set'](_0x3f77('0x30'),_0x58ef2a+'-'+_0x1d4e4c+'/'+_0x1fe0c6)[_0x3f77('0x2b')](_0x3c08f6);}return null;};}function patchUpdates(_0x32f70c){return function(_0x43470b){try{jsonpatch[_0x3f77('0x31')](_0x43470b,_0x32f70c,!![]);}catch(_0x288120){return BPromise[_0x3f77('0x32')](_0x288120);}return _0x43470b[_0x3f77('0x33')]();};}function saveUpdates(_0x2bf8df,_0x2deb22){return function(_0x2237dd){if(_0x2237dd){return _0x2237dd['update'](_0x2bf8df)[_0x3f77('0x1e')](function(_0x2a7ba6){return _0x2a7ba6;});}return null;};}function removeEntity(_0x1b16bb,_0x465174){return function(_0x7feb99){if(_0x7feb99){return _0x7feb99[_0x3f77('0x34')]()['then'](function(){_0x1b16bb['status'](0xcc)[_0x3f77('0x35')]();});}};}function handleEntityNotFound(_0x3f4046,_0x4bb82a){return function(_0x292425){if(!_0x292425){_0x3f4046['sendStatus'](0x194);}return _0x292425;};}function handleError(_0x21b84f,_0x516606){_0x516606=_0x516606||0x1f4;return function(_0x229b9f){logger[_0x3f77('0x24')](_0x229b9f[_0x3f77('0x36')]);if(_0x229b9f['name']){delete _0x229b9f[_0x3f77('0x37')];}_0x21b84f[_0x3f77('0x2a')](_0x516606)['send'](_0x229b9f);};}exports[_0x3f77('0x38')]=function(_0x4e94a9,_0x38caf4){var _0x54845d={},_0x5c5fda={},_0x36e890={'count':0x0,'rows':[]};var _0xec6a06=_[_0x3f77('0x39')](db[_0x3f77('0x3a')][_0x3f77('0x3b')],function(_0x23f946){return{'name':_0x23f946[_0x3f77('0x3c')],'type':_0x23f946[_0x3f77('0x3d')][_0x3f77('0x3e')]};});_0x5c5fda[_0x3f77('0x3f')]=_[_0x3f77('0x39')](_0xec6a06,_0x3f77('0x37'));_0x5c5fda[_0x3f77('0x40')]=_[_0x3f77('0x41')](_0x4e94a9[_0x3f77('0x40')]);_0x5c5fda[_0x3f77('0x42')]=_['intersection'](_0x5c5fda['model'],_0x5c5fda[_0x3f77('0x40')]);_0x54845d[_0x3f77('0x43')]=_[_0x3f77('0x44')](_0x5c5fda[_0x3f77('0x3f')],qs[_0x3f77('0x45')](_0x4e94a9[_0x3f77('0x40')]['fields']));_0x54845d[_0x3f77('0x43')]=_0x54845d[_0x3f77('0x43')][_0x3f77('0x46')]?_0x54845d['attributes']:_0x5c5fda[_0x3f77('0x3f')];if(!_0x4e94a9[_0x3f77('0x40')][_0x3f77('0x47')](_0x3f77('0x48'))){_0x54845d[_0x3f77('0x2e')]=qs['limit'](_0x4e94a9[_0x3f77('0x40')][_0x3f77('0x2e')]);_0x54845d[_0x3f77('0x2c')]=qs['offset'](_0x4e94a9[_0x3f77('0x40')][_0x3f77('0x2c')]);}_0x54845d[_0x3f77('0x49')]=qs[_0x3f77('0x4a')](_0x4e94a9[_0x3f77('0x40')][_0x3f77('0x4a')]);_0x54845d[_0x3f77('0x4b')]=qs[_0x3f77('0x42')](_[_0x3f77('0x4c')](_0x4e94a9[_0x3f77('0x40')],_0x5c5fda[_0x3f77('0x42')]),_0xec6a06);if(_0x4e94a9[_0x3f77('0x40')][_0x3f77('0x4d')]){_0x54845d[_0x3f77('0x4b')]=_['merge'](_0x54845d[_0x3f77('0x4b')],{'$or':_[_0x3f77('0x39')](_0xec6a06,function(_0x526368){if(_0x526368[_0x3f77('0x3d')]!==_0x3f77('0x4e')){var _0x1aa97a={};_0x1aa97a[_0x526368[_0x3f77('0x37')]]={'$like':'%'+_0x4e94a9[_0x3f77('0x40')][_0x3f77('0x4d')]+'%'};return _0x1aa97a;}})});}_0x54845d=_[_0x3f77('0x4f')]({},_0x54845d,_0x4e94a9[_0x3f77('0x50')]);var _0x14547d={'where':_0x54845d['where']};return db[_0x3f77('0x3a')]['count'](_0x14547d)['then'](function(_0x47ece3){_0x36e890['count']=_0x47ece3;if(_0x4e94a9[_0x3f77('0x40')][_0x3f77('0x51')]){_0x54845d['include']=[{'all':!![]}];}return db[_0x3f77('0x3a')]['findAll'](_0x54845d);})[_0x3f77('0x1e')](function(_0x2ed939){_0x36e890['rows']=_0x2ed939;return _0x36e890;})['then'](respondWithFilteredResult(_0x38caf4,_0x54845d))[_0x3f77('0x28')](handleError(_0x38caf4,null));};exports[_0x3f77('0x52')]=function(_0x22f964,_0x132530){var _0x4db6f7={'raw':!![],'where':{'id':_0x22f964[_0x3f77('0x53')]['id']}},_0x183666={};_0x183666['model']=_[_0x3f77('0x41')](db['OpenchannelMessage'][_0x3f77('0x3b')]);_0x183666[_0x3f77('0x40')]=_[_0x3f77('0x41')](_0x22f964[_0x3f77('0x40')]);_0x183666[_0x3f77('0x42')]=_['intersection'](_0x183666[_0x3f77('0x3f')],_0x183666[_0x3f77('0x40')]);_0x4db6f7['attributes']=_[_0x3f77('0x44')](_0x183666[_0x3f77('0x3f')],qs[_0x3f77('0x45')](_0x22f964['query'][_0x3f77('0x45')]));_0x4db6f7['attributes']=_0x4db6f7['attributes'][_0x3f77('0x46')]?_0x4db6f7[_0x3f77('0x43')]:_0x183666['model'];if(_0x22f964[_0x3f77('0x40')][_0x3f77('0x51')]){_0x4db6f7[_0x3f77('0x54')]=[{'all':!![]}];}_0x4db6f7=_['merge']({},_0x4db6f7,_0x22f964[_0x3f77('0x50')]);return db[_0x3f77('0x3a')][_0x3f77('0x55')](_0x4db6f7)[_0x3f77('0x1e')](handleEntityNotFound(_0x132530,null))['then'](respondWithResult(_0x132530,null))['catch'](handleError(_0x132530,null));};exports[_0x3f77('0x56')]=function(_0x1856db,_0x16446d){return db['OpenchannelMessage'][_0x3f77('0x56')](_0x1856db['body'],{})[_0x3f77('0x1e')](respondWithResult(_0x16446d,0xc9))[_0x3f77('0x28')](handleError(_0x16446d,null));};exports[_0x3f77('0x57')]=function(_0x4d54ca,_0x536a10){if(_0x4d54ca[_0x3f77('0x58')]['id']){delete _0x4d54ca[_0x3f77('0x58')]['id'];}return db['OpenchannelMessage'][_0x3f77('0x55')]({'where':{'id':_0x4d54ca[_0x3f77('0x53')]['id']}})[_0x3f77('0x1e')](handleEntityNotFound(_0x536a10,null))[_0x3f77('0x1e')](saveUpdates(_0x4d54ca['body'],null))['then'](respondWithResult(_0x536a10,null))['catch'](handleError(_0x536a10,null));};exports[_0x3f77('0x34')]=function(_0x34a75f,_0xfcb190){return db['OpenchannelMessage'][_0x3f77('0x55')]({'where':{'id':_0x34a75f[_0x3f77('0x53')]['id']}})[_0x3f77('0x1e')](handleEntityNotFound(_0xfcb190,null))[_0x3f77('0x1e')](removeEntity(_0xfcb190,null))[_0x3f77('0x28')](handleError(_0xfcb190,null));};exports[_0x3f77('0x59')]=function(_0x1d58e4,_0x103a07){return db['OpenchannelMessage'][_0x3f77('0x59')]()[_0x3f77('0x1e')](respondWithResult(_0x103a07,null))[_0x3f77('0x28')](handleError(_0x103a07,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x3f77('0x5a')]=function(_0x1aea98,_0x45b4be,_0x535fd3){var _0x34324e={'agent':{},'channel':_0x3f77('0x5b')};if(_0x1aea98[_0x3f77('0x58')]['id']){delete _0x1aea98['body']['id'];}_0x1aea98[_0x3f77('0x58')][_0x3f77('0x5c')]=!![];_0x1aea98['body'][_0x3f77('0x5d')]=moment()[_0x3f77('0x5e')](_0x3f77('0x5f'));_0x1aea98[_0x3f77('0x58')]['UserId']=_0x1aea98[_0x3f77('0x58')][_0x3f77('0x60')]||_0x1aea98[_0x3f77('0x61')]['id'];_0x34324e['agent']['id']=_0x1aea98[_0x3f77('0x58')]['UserId'];return db[_0x3f77('0x3a')]['find']({'where':{'id':_0x1aea98[_0x3f77('0x53')]['id'],'UserId':null}})[_0x3f77('0x1e')](handleEntityNotFound(_0x45b4be,null))[_0x3f77('0x1e')](saveUpdates(_0x1aea98[_0x3f77('0x58')],null))[_0x3f77('0x1e')](function(_0x3314fb){if(_0x3314fb){_0x34324e[_0x3f77('0x26')]=_0x3314fb[_0x3f77('0x62')]({'plain':!![]});return db[_0x3f77('0x63')]['find']({'where':{'id':_0x3314fb[_0x3f77('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x45b4be,null))['then'](function(_0x1a8cf6){if(_0x1a8cf6){return _0x1a8cf6[_0x3f77('0x57')]({'UserId':_0x1aea98[_0x3f77('0x58')][_0x3f77('0x60')],'read1stAt':_[_0x3f77('0x65')](_0x1a8cf6[_0x3f77('0x66')])?moment()[_0x3f77('0x5e')](_0x3f77('0x5f')):undefined});}return null;})['then'](function(_0x1f2028){if(_0x1f2028){_0x34324e['interaction']=_0x1f2028[_0x3f77('0x62')]({'plain':!![]});interaction_log[_0x3f77('0x1f')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1aea98[_0x3f77('0x61')]['id'],_0x1aea98[_0x3f77('0x61')][_0x3f77('0x37')],_0x1aea98[_0x3f77('0x61')]['role'],_0x34324e['interaction']['id'],_0x1aea98[_0x3f77('0x58')]?JSON['stringify'](_0x1aea98[_0x3f77('0x58')]):_0x3f77('0x67'));return respondWithRpcPromise(_0x3f77('0x68'),_0x3f77('0x69'),_0x34324e);}return null;})[_0x3f77('0x1e')](function(_0x2f3d68){var _0x2e7b68=_0x3f77('0x6a')+_0x2f3d68[_0x3f77('0x26')][_0x3f77('0x6b')];return db[_0x3f77('0x6c')]['query'](_0x2e7b68,{'type':db[_0x3f77('0x6d')][_0x3f77('0x6e')][_0x3f77('0x6f')],'raw':!![]})[_0x3f77('0x1e')](function(_0x5aafa1){return _0x5aafa1;});})[_0x3f77('0x1e')](function(_0x1470a1){if(_0x1470a1){_0x34324e[_0x3f77('0x26')][_0x3f77('0x70')]=_0x1470a1[0x0];if(!_0x1aea98['body'][_0x3f77('0x60')])return;return db['User'][_0x3f77('0x55')]({'where':{'id':_0x1aea98[_0x3f77('0x58')][_0x3f77('0x60')],'role':_0x3f77('0x71')},'attributes':['id',_0x3f77('0x37'),_0x3f77('0x72'),'email',_0x3f77('0x73')],'raw':!![]});}return null;})[_0x3f77('0x1e')](function(_0x55233c){if(!_0x55233c)return null;_0x34324e[_0x3f77('0x26')][_0x3f77('0x71')]=_0x55233c;return _0x34324e;})['then'](function(_0x1ca73e){if(_0x1ca73e){if(_0x1aea98[_0x3f77('0x58')]['manual']){_0x34324e['message']['interface']=util[_0x3f77('0x5e')]('SIP/%s',_0x1aea98[_0x3f77('0x61')][_0x3f77('0x37')]);_0x34324e['message'][_0x3f77('0x74')]=_0x34324e[_0x3f77('0x74')];_0x34324e[_0x3f77('0x26')]['motionChannel']=_0x34324e[_0x3f77('0x74')];_0x34324e['message'][_0x3f77('0x75')]=_0x3f77('0x5a');return respondWithRpcPromise(_0x3f77('0x76'),_0x3f77('0x76'),{'event':_0x3f77('0x77'),'message':_0x34324e[_0x3f77('0x26')]},client9002)['then'](function(){return _0x34324e;});}return _0x34324e;}return null;})['then'](respondWithResult(_0x45b4be,null))[_0x3f77('0x28')](handleError(_0x45b4be,null));};var interaction_log=require(_0x3f77('0x78'))(_0x3f77('0x79'));exports[_0x3f77('0x32')]=function(_0x43fc1d,_0x241e24,_0x566ba8){var _0x231ec3={'agent':{},'channel':'openchannel'};if(_0x43fc1d[_0x3f77('0x58')]['id']){delete _0x43fc1d[_0x3f77('0x58')]['id'];}_0x43fc1d[_0x3f77('0x58')][_0x3f77('0x60')]=_0x43fc1d[_0x3f77('0x58')][_0x3f77('0x60')]||_0x43fc1d[_0x3f77('0x61')]['id'];_0x231ec3[_0x3f77('0x71')]['id']=_0x43fc1d[_0x3f77('0x58')][_0x3f77('0x60')];return db[_0x3f77('0x3a')][_0x3f77('0x55')]({'where':{'id':_0x43fc1d[_0x3f77('0x53')]['id'],'UserId':null}})[_0x3f77('0x1e')](handleEntityNotFound(_0x241e24,null))['then'](function(_0x4dc383){if(_0x4dc383){_0x231ec3['message']=_0x4dc383[_0x3f77('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0x3f77('0x55')]({'where':{'id':_0x4dc383[_0x3f77('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x241e24,null))[_0x3f77('0x1e')](function(_0x4cba0a){if(_0x4cba0a){_0x231ec3[_0x3f77('0x7a')]=_0x4cba0a[_0x3f77('0x62')]({'plain':!![]});interaction_log[_0x3f77('0x1f')](_0x3f77('0x7b'),_0x43fc1d[_0x3f77('0x61')]['id'],_0x43fc1d[_0x3f77('0x61')]['name'],_0x43fc1d[_0x3f77('0x61')][_0x3f77('0x7c')],_0x231ec3[_0x3f77('0x7a')]['id'],_0x43fc1d[_0x3f77('0x58')]?JSON['stringify'](_0x43fc1d[_0x3f77('0x58')]):_0x3f77('0x67'));return respondWithRpcPromise(_0x3f77('0x7d'),_0x3f77('0x7e'),_0x231ec3);}return null;})['then'](function(_0x2fcd85){var _0x5c7225=_0x3f77('0x6a')+_0x2fcd85[_0x3f77('0x26')]['ContactId'];return db[_0x3f77('0x6c')][_0x3f77('0x40')](_0x5c7225,{'type':db[_0x3f77('0x6d')]['QueryTypes'][_0x3f77('0x6f')],'raw':!![]})[_0x3f77('0x1e')](function(_0x2616bd){return _0x2616bd;});})[_0x3f77('0x1e')](function(_0x44d425){if(_0x44d425){_0x231ec3[_0x3f77('0x26')][_0x3f77('0x70')]=_0x44d425[0x0];if(!_0x43fc1d[_0x3f77('0x58')]['UserId'])return;return db[_0x3f77('0x7f')][_0x3f77('0x55')]({'where':{'id':_0x43fc1d[_0x3f77('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0x3f77('0x37'),_0x3f77('0x72'),'email',_0x3f77('0x73')],'raw':!![]});}return null;})[_0x3f77('0x1e')](function(_0x262661){if(!_0x262661)return null;_0x231ec3[_0x3f77('0x26')][_0x3f77('0x71')]=_0x262661;return _0x231ec3;})['then'](function(_0x1e256d){if(_0x1e256d){_0x1e256d[_0x3f77('0x26')]['interface']=util['format']('SIP/%s',_0x43fc1d[_0x3f77('0x61')][_0x3f77('0x37')]);_0x1e256d[_0x3f77('0x26')]['channel']=_0x231ec3['channel'];_0x1e256d[_0x3f77('0x26')]['motionChannel']=_0x231ec3['channel'];_0x1e256d[_0x3f77('0x26')]['event']=_0x3f77('0x32');respondWithRpcPromise(_0x3f77('0x76'),_0x3f77('0x76'),{'event':_0x3f77('0x80'),'message':_0x1e256d[_0x3f77('0x26')]},client9002);return _0x231ec3;}return null;})[_0x3f77('0x1e')](respondWithResult(_0x241e24,null))[_0x3f77('0x28')](handleError(_0x241e24,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b4756ef..71af69d 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 _0x1076=['emit','exports','../../mysqldb','setMaxListeners','update','remove'];(function(_0x4bcbc2,_0x46cbff){var _0xe5b888=function(_0xd3a99d){while(--_0xd3a99d){_0x4bcbc2['push'](_0x4bcbc2['shift']());}};_0xe5b888(++_0x46cbff);}(_0x1076,0xec));var _0x6107=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x1076[_0x20a558];return _0x53d3f7;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x6107('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6107('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6107('0x2'),'afterDestroy':_0x6107('0x3')};function emitEvent(_0x479094){return function(_0x2b33e2,_0x2a0b13,_0x577d12){OpenchannelMessageEvents[_0x6107('0x4')](_0x479094+':'+_0x2b33e2['id'],_0x2b33e2);OpenchannelMessageEvents[_0x6107('0x4')](_0x479094,_0x2b33e2);_0x577d12(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x6107('0x5')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x436a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x436a,0x138));var _0xa436=function(_0x1b7f95,_0x4bdec0){_0x1b7f95=_0x1b7f95-0x0;var _0x2b5559=_0x436a[_0x1b7f95];return _0x2b5559;};'use strict';var EventEmitter=require(_0xa436('0x0'));var OpenchannelMessage=require(_0xa436('0x1'))['db'][_0xa436('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa436('0x3')](0x0);var events={'afterCreate':_0xa436('0x4'),'afterUpdate':_0xa436('0x5'),'afterDestroy':_0xa436('0x6')};function emitEvent(_0x58a22c){return function(_0x27ed6b,_0x2a7ca7,_0x2bf0aa){OpenchannelMessageEvents[_0xa436('0x7')](_0x58a22c+':'+_0x27ed6b['id'],_0x27ed6b);OpenchannelMessageEvents[_0xa436('0x7')](_0x58a22c,_0x27ed6b);_0x2bf0aa(null);};}for(var e in events){if(events[_0xa436('0x8')](e)){var event=events[e];OpenchannelMessage[_0xa436('0x9')](e,emitEvent(event));}}module[_0xa436('0xa')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 1bd9b5a..18aa700 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 _0x4fc2=['length','omit','Contact','POST','method','OpenchannelMessage,\x20%s,\x20%s','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','finally','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','keys','info','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','replyUri'];(function(_0x20092b,_0x1feed5){var _0x507104=function(_0x31b87a){while(--_0x31b87a){_0x20092b['push'](_0x20092b['shift']());}};_0x507104(++_0x1feed5);}(_0x4fc2,0x111));var _0x24fc=function(_0x32a22d,_0x17b134){_0x32a22d=_0x32a22d-0x0;var _0x302d10=_0x4fc2[_0x32a22d];return _0x302d10;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'paranoid':![],'indexes':[{'name':_0x24fc('0xb'),'fields':[_0x24fc('0xc')],'type':_0x24fc('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47349b,_0x5afdf1,_0x44caca){var _0x1819a5=_0x26fcc6[_0x24fc('0xe')];var _0x133438=_0x47349b[_0x24fc('0xf')]({'plain':!![]});if(_0x133438[_0x24fc('0x10')][_0x24fc('0x11')]()==='in'||_0x133438[_0x24fc('0x10')]['toLowerCase']()===_0x24fc('0x12')&&!_0x133438[_0x24fc('0x13')]&&!_['isNil'](_0x133438[_0x24fc('0x14')])){_0x1819a5[_0x24fc('0x15')][_0x24fc('0x16')]({'where':{'id':_0x133438[_0x24fc('0x17')]}})[_0x24fc('0x18')](function(_0x326276){if(_0x326276){_0x326276['update']({'lastMsgAt':_0x133438[_0x24fc('0x19')],'lastMsgDirection':_0x133438[_0x24fc('0x10')][_0x24fc('0x11')]()});}})[_0x24fc('0x1a')](function(_0x4acd36){console[_0x24fc('0x1b')](_0x4acd36);});}if(_0x133438['direction']===_0x24fc('0x12')&&!_0x133438[_0x24fc('0x13')]){var _0x218fb6;_0x1819a5[_0x24fc('0x1c')][_0x24fc('0x1d')]()['then'](function(_0x23873c){return _0x1819a5[_0x24fc('0x1e')][_0x24fc('0x1f')]({'where':{'id':_0x133438[_0x24fc('0x20')]},'include':[{'model':_0x1819a5['OpenchannelInteraction'],'as':_0x24fc('0x21'),'where':{'id':_0x133438[_0x24fc('0x17')]},'limit':0x1,'include':[{'model':_0x1819a5[_0x24fc('0x1c')],'as':'Contact','attributes':_[_0x24fc('0x22')](_0x23873c)}]}]});})[_0x24fc('0x18')](function(_0xbf1d6b){_0x218fb6=_0xbf1d6b[_0x24fc('0xf')]({'plain':!![]});if(_0x218fb6&&_0x218fb6['replyUri']){logger[_0x24fc('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x24fc('0x24'),util['format'](_0x24fc('0x25'),_0x133438['id'],_0x218fb6[_0x24fc('0x26')]));if(_0x218fb6[_0x24fc('0x21')]&&_0x218fb6['Interactions'][_0x24fc('0x27')]){_0x133438['Interaction']=_[_0x24fc('0x28')](_0x218fb6[_0x24fc('0x21')][0x0],_0x24fc('0x29'));_0x133438[_0x24fc('0x29')]=_0x218fb6[_0x24fc('0x21')][0x0][_0x24fc('0x29')];}var _0x5afdf1={'method':_0x24fc('0x2a'),'uri':encodeURI(_0x218fb6[_0x24fc('0x26')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5afdf1[_0x24fc('0x2b')]){case'GET':_0x5afdf1['qs']=_0x133438;break;case _0x24fc('0x2a'):_0x5afdf1[_0x24fc('0xc')]=_0x133438;break;}return rp(_0x5afdf1)[_0x24fc('0x18')](function(_0x5bb4c8){logger[_0x24fc('0x23')](_0x24fc('0x2c'),_0x24fc('0x24'),util[_0x24fc('0x2d')](_0x24fc('0x2e'),_0x133438['id'],_0x218fb6[_0x24fc('0x26')]));if(_0x5bb4c8['body'][_0x24fc('0x2f')]&&_0x5bb4c8[_0x24fc('0xc')][_0x24fc('0x2f')]!=_0x133438[_0x24fc('0x30')][_0x24fc('0x2f')]){return _0x1819a5['OpenchannelInteraction']['update']({'threadId':_0x5bb4c8['body'][_0x24fc('0x2f')]},{'logging':!![],'where':{'id':_0x133438['Interaction']['id']}});}else{return;}})[_0x24fc('0x18')](function(){return _0x47349b[_0x24fc('0x31')]({'read':!![]});})[_0x24fc('0x1a')](function(_0x2086c0){logger['error'](_0x24fc('0x2c'),_0x24fc('0x24'),util['inspect'](_0x2086c0,{'showHidden':![],'depth':null}));_0x44caca();});}else{_0x44caca();}})[_0x24fc('0x32')](function(){_0x44caca();});}else{_0x44caca();}}},'charset':_0x24fc('0x33'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb03e=['info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','threadId','inspect','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','get','replyUri'];(function(_0x217ecd,_0x5b35da){var _0x50b480=function(_0x40cb44){while(--_0x40cb44){_0x217ecd['push'](_0x217ecd['shift']());}};_0x50b480(++_0x5b35da);}(_0xb03e,0x1eb));var _0xeb03=function(_0x319a78,_0x33817a){_0x319a78=_0x319a78-0x0;var _0x496e70=_0xb03e[_0x319a78];return _0x496e70;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var logger=require(_0xeb03('0x1'))(_0xeb03('0x2'));var moment=require(_0xeb03('0x3'));var BPromise=require(_0xeb03('0x4'));var rp=require(_0xeb03('0x5'));var fs=require('fs');var path=require(_0xeb03('0x6'));var rimraf=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var attributes=require(_0xeb03('0x9'));module[_0xeb03('0xa')]=function(_0xee2291,_0x4e1cea){return _0xee2291[_0xeb03('0xb')](_0xeb03('0xc'),attributes,{'tableName':_0xeb03('0xd'),'paranoid':![],'indexes':[{'name':_0xeb03('0xe'),'fields':[_0xeb03('0xf')],'type':_0xeb03('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a8491,_0x403b77,_0x99f4e2){var _0x14cfa0=_0xee2291['models'];var _0x31af2c=_0x5a8491['get']({'plain':!![]});if(_0x31af2c[_0xeb03('0x11')][_0xeb03('0x12')]()==='in'||_0x31af2c[_0xeb03('0x11')][_0xeb03('0x12')]()===_0xeb03('0x13')&&!_0x31af2c[_0xeb03('0x14')]&&!_[_0xeb03('0x15')](_0x31af2c[_0xeb03('0x16')])){_0x14cfa0[_0xeb03('0x17')][_0xeb03('0x18')]({'where':{'id':_0x31af2c[_0xeb03('0x19')]}})[_0xeb03('0x1a')](function(_0x4d9c8e){if(_0x4d9c8e){_0x4d9c8e[_0xeb03('0x1b')]({'lastMsgAt':_0x31af2c[_0xeb03('0x1c')],'lastMsgDirection':_0x31af2c[_0xeb03('0x11')][_0xeb03('0x12')]()});}})['catch'](function(_0x15f4fe){console[_0xeb03('0x1d')](_0x15f4fe);});}if(_0x31af2c[_0xeb03('0x11')]==='out'&&!_0x31af2c[_0xeb03('0x14')]){var _0x46dd1b;_0x14cfa0[_0xeb03('0x1e')][_0xeb03('0x1f')]()[_0xeb03('0x1a')](function(_0x1b4cbd){return _0x14cfa0[_0xeb03('0x20')][_0xeb03('0x21')]({'where':{'id':_0x31af2c[_0xeb03('0x22')]},'include':[{'model':_0x14cfa0[_0xeb03('0x17')],'as':_0xeb03('0x23'),'where':{'id':_0x31af2c[_0xeb03('0x19')]},'limit':0x1,'include':[{'model':_0x14cfa0[_0xeb03('0x1e')],'as':_0xeb03('0x24'),'attributes':_['keys'](_0x1b4cbd)}]}]});})[_0xeb03('0x1a')](function(_0x3855dd){_0x46dd1b=_0x3855dd[_0xeb03('0x25')]({'plain':!![]});if(_0x46dd1b&&_0x46dd1b[_0xeb03('0x26')]){logger[_0xeb03('0x27')](_0xeb03('0x28'),_0xeb03('0x29'),util[_0xeb03('0x2a')](_0xeb03('0x2b'),_0x31af2c['id'],_0x46dd1b['replyUri']));if(_0x46dd1b[_0xeb03('0x23')]&&_0x46dd1b[_0xeb03('0x23')][_0xeb03('0x2c')]){_0x31af2c[_0xeb03('0x2d')]=_[_0xeb03('0x2e')](_0x46dd1b['Interactions'][0x0],_0xeb03('0x24'));_0x31af2c[_0xeb03('0x24')]=_0x46dd1b[_0xeb03('0x23')][0x0][_0xeb03('0x24')];}var _0x403b77={'method':_0xeb03('0x2f'),'uri':encodeURI(_0x46dd1b[_0xeb03('0x26')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x403b77[_0xeb03('0x30')]){case _0xeb03('0x31'):_0x403b77['qs']=_0x31af2c;break;case'POST':_0x403b77[_0xeb03('0xf')]=_0x31af2c;break;}return rp(_0x403b77)[_0xeb03('0x1a')](function(_0x2683f9){logger[_0xeb03('0x27')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xeb03('0x2a')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x31af2c['id'],_0x46dd1b[_0xeb03('0x26')]));if(_0x2683f9[_0xeb03('0xf')][_0xeb03('0x32')]&&_0x2683f9['body'][_0xeb03('0x32')]!=_0x31af2c['Interaction']['threadId']){return _0x14cfa0['OpenchannelInteraction']['update']({'threadId':_0x2683f9[_0xeb03('0xf')][_0xeb03('0x32')]},{'logging':!![],'where':{'id':_0x31af2c['Interaction']['id']}});}else{return;}})['then'](function(){return _0x5a8491['update']({'read':!![]});})['catch'](function(_0x1e8009){logger[_0xeb03('0x1d')](_0xeb03('0x28'),_0xeb03('0x29'),util[_0xeb03('0x33')](_0x1e8009,{'showHidden':![],'depth':null}));_0x99f4e2();});}else{_0x99f4e2();}})['finally'](function(){_0x99f4e2();});}else{_0x99f4e2();}}},'charset':_0xeb03('0x34'),'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 baaf4e9..589565f 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x30fd9d,_0x2856a0){var _0x5dae2d=function(_0x50218a){while(--_0x50218a){_0x30fd9d['push'](_0x30fd9d['shift']());}};_0x5dae2d(++_0x2856a0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5972de,_0x2b786b){_0x5972de=_0x5972de-0x0;var _0x5d1f41=_0x5f2f[_0x5972de];return _0x5d1f41;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x51edcd,_0x630b21){var _0x28a7ea=function(_0x3f8b89){while(--_0x3f8b89){_0x51edcd['push'](_0x51edcd['shift']());}};_0x28a7ea(++_0x630b21);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5ee268,_0x4a7bb2){_0x5ee268=_0x5ee268-0x0;var _0x49f494=_0x5f2f[_0x5ee268];return _0x49f494;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index edc2fcc..1a12498 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 _0x5c97=['register','remove','update','emit','removeListener'];(function(_0x3020fe,_0x2d8bb2){var _0x5cbbac=function(_0xeb968a){while(--_0xeb968a){_0x3020fe['push'](_0x3020fe['shift']());}};_0x5cbbac(++_0x2d8bb2);}(_0x5c97,0x164));var _0x75c9=function(_0x2fb561,_0x579dbf){_0x2fb561=_0x2fb561-0x0;var _0x2b7be3=_0x5c97[_0x2fb561];return _0x2b7be3;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x75c9('0x0'),_0x75c9('0x1')];function createListener(_0x31eafa,_0x565899){return function(_0x5ee6ee){_0x565899[_0x75c9('0x2')](_0x31eafa,_0x5ee6ee);};}function removeListener(_0x4b27b9,_0x42b013){return function(){OpenchannelMessageEvents[_0x75c9('0x3')](_0x4b27b9,_0x42b013);};}exports[_0x75c9('0x4')]=function(_0x5a8382){for(var _0x593294=0x0,_0x53b999=events['length'];_0x593294<_0x53b999;_0x593294++){var _0xda1364=events[_0x593294];var _0x59ed56=createListener('openchannelMessage:'+_0xda1364,_0x5a8382);OpenchannelMessageEvents['on'](_0xda1364,_0x59ed56);}}; \ No newline at end of file +var _0x91e7=['save','emit','register'];(function(_0x3d5949,_0x1e152){var _0x4fe99a=function(_0x275c13){while(--_0x275c13){_0x3d5949['push'](_0x3d5949['shift']());}};_0x4fe99a(++_0x1e152);}(_0x91e7,0xf9));var _0x791e=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x91e7[_0x44a64f];return _0x52024b;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x791e('0x0'),'remove','update'];function createListener(_0x2a3537,_0x45cb32){return function(_0x2878bb){_0x45cb32[_0x791e('0x1')](_0x2a3537,_0x2878bb);};}function removeListener(_0x43ac59,_0x521e39){return function(){OpenchannelMessageEvents['removeListener'](_0x43ac59,_0x521e39);};}exports[_0x791e('0x2')]=function(_0x2d8b1f){for(var _0x33117d=0x0,_0xee4cd3=events['length'];_0x33117d<_0xee4cd3;_0x33117d++){var _0xace8b1=events[_0x33117d];var _0x3561e3=createListener('openchannelMessage:'+_0xace8b1,_0x2d8b1f);OpenchannelMessageEvents['on'](_0xace8b1,_0x3561e3);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 9913f09..7263f18 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 _0x72ad=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','get','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents'];(function(_0xa2f83b,_0x1cddc2){var _0x2302ee=function(_0x189bf9){while(--_0x189bf9){_0xa2f83b['push'](_0xa2f83b['shift']());}};_0x2302ee(++_0x1cddc2);}(_0x72ad,0x10f));var _0xd72a=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x72ad[_0x292f93];return _0x5a94b1;};'use strict';var multer=require(_0xd72a('0x0'));var util=require(_0xd72a('0x1'));var path=require(_0xd72a('0x2'));var timeout=require('connect-timeout');var express=require(_0xd72a('0x3'));var router=express['Router']();var fs_extra=require(_0xd72a('0x4'));var auth=require(_0xd72a('0x5'));var interaction=require(_0xd72a('0x6'));var config=require(_0xd72a('0x7'));var controller=require(_0xd72a('0x8'));router['get']('/',auth[_0xd72a('0x9')](),controller['index']);router[_0xd72a('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xd72a('0xb')]);router[_0xd72a('0xa')](_0xd72a('0xc'),auth[_0xd72a('0x9')](),controller[_0xd72a('0xd')]);router['get'](_0xd72a('0xe'),auth[_0xd72a('0x9')](),controller[_0xd72a('0xf')]);router[_0xd72a('0xa')](_0xd72a('0x10'),auth[_0xd72a('0x9')](),controller[_0xd72a('0x11')]);router[_0xd72a('0xa')](_0xd72a('0x12'),auth[_0xd72a('0x9')](),controller[_0xd72a('0x13')]);router[_0xd72a('0x14')]('/',auth['isAuthenticated'](),controller[_0xd72a('0x15')]);router[_0xd72a('0x14')](_0xd72a('0x10'),auth[_0xd72a('0x9')](),controller[_0xd72a('0x16')]);router[_0xd72a('0x14')](_0xd72a('0x12'),auth[_0xd72a('0x9')](),controller[_0xd72a('0x17')]);router['put'](_0xd72a('0xc'),auth[_0xd72a('0x9')](),controller[_0xd72a('0x18')]);router[_0xd72a('0x19')](_0xd72a('0xc'),auth['isAuthenticated'](),controller[_0xd72a('0x1a')]);router[_0xd72a('0x19')](_0xd72a('0x10'),auth[_0xd72a('0x9')](),controller[_0xd72a('0x1b')]);router[_0xd72a('0x19')](_0xd72a('0x12'),auth[_0xd72a('0x9')](),controller[_0xd72a('0x1c')]);module[_0xd72a('0x1d')]=router; \ No newline at end of file +var _0x161c=['getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/teams'];(function(_0x506bef,_0x193367){var _0xa433c7=function(_0x300598){while(--_0x300598){_0x506bef['push'](_0x506bef['shift']());}};_0xa433c7(++_0x193367);}(_0x161c,0x1a1));var _0xc161=function(_0x16d1ec,_0x32f502){_0x16d1ec=_0x16d1ec-0x0;var _0x4bd148=_0x161c[_0x16d1ec];return _0x4bd148;};'use strict';var multer=require(_0xc161('0x0'));var util=require(_0xc161('0x1'));var path=require(_0xc161('0x2'));var timeout=require('connect-timeout');var express=require(_0xc161('0x3'));var router=express[_0xc161('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc161('0x5'));var interaction=require(_0xc161('0x6'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0xc161('0x7')]('/',auth['isAuthenticated'](),controller[_0xc161('0x8')]);router[_0xc161('0x7')](_0xc161('0x9'),auth[_0xc161('0xa')](),controller[_0xc161('0xb')]);router[_0xc161('0x7')](_0xc161('0xc'),auth[_0xc161('0xa')](),controller[_0xc161('0xd')]);router[_0xc161('0x7')]('/:id/members',auth[_0xc161('0xa')](),controller['getMembers']);router[_0xc161('0x7')](_0xc161('0xe'),auth[_0xc161('0xa')](),controller[_0xc161('0xf')]);router[_0xc161('0x7')](_0xc161('0x10'),auth[_0xc161('0xa')](),controller[_0xc161('0x11')]);router[_0xc161('0x12')]('/',auth[_0xc161('0xa')](),controller[_0xc161('0x13')]);router['post'](_0xc161('0xe'),auth[_0xc161('0xa')](),controller[_0xc161('0x14')]);router[_0xc161('0x12')](_0xc161('0x10'),auth[_0xc161('0xa')](),controller[_0xc161('0x15')]);router['put'](_0xc161('0xc'),auth[_0xc161('0xa')](),controller[_0xc161('0x16')]);router[_0xc161('0x17')](_0xc161('0xc'),auth['isAuthenticated'](),controller[_0xc161('0x18')]);router[_0xc161('0x17')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0xc161('0x10'),auth['isAuthenticated'](),controller[_0xc161('0x19')]);module[_0xc161('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 4e82dde..12efe68 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 _0xafa8=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','STRING','name'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xafa8,0xe4));var _0x8afa=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0xafa8[_0x3d4876];return _0x58ca9d;};'use strict';var Sequelize=require(_0x8afa('0x0'));module['exports']={'name':{'type':Sequelize[_0x8afa('0x1')],'unique':_0x8afa('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8afa('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8afa('0x4')](_0x8afa('0x5'),'beepall',_0x8afa('0x6'))}}; \ No newline at end of file +var _0x9158=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x15e749,_0x3f70d0){var _0xf62575=function(_0xfc899){while(--_0xfc899){_0x15e749['push'](_0x15e749['shift']());}};_0xf62575(++_0x3f70d0);}(_0x9158,0x186));var _0x8915=function(_0x28ec87,_0x294f7a){_0x28ec87=_0x28ec87-0x0;var _0x473578=_0x9158[_0x28ec87];return _0x473578;};'use strict';var Sequelize=require(_0x8915('0x0'));module[_0x8915('0x1')]={'name':{'type':Sequelize[_0x8915('0x2')],'unique':_0x8915('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8915('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8915('0x5')](_0x8915('0x6'),_0x8915('0x7'),_0x8915('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index c1f4c97..7dcc1a8 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 _0x136d=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','UserOpenchannelQueue','OpenchannelQueueId','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','ids','select','tq.TeamId','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','isArray','getAgents','eml-format','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','OpenchannelQueue','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','catch','create'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x136d,0xc3));var _0xd136=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x136d[_0x166d93];return _0xba708;};'use strict';var emlformat=require(_0xd136('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd136('0x1'));var rp=require('request-promise');var moment=require(_0xd136('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd136('0x3'));var path=require(_0xd136('0x4'));var sox=require(_0xd136('0x5'));var csv=require(_0xd136('0x6'));var ejs=require(_0xd136('0x7'));var fs=require('fs');var fs_extra=require(_0xd136('0x8'));var _=require('lodash');var squel=require(_0xd136('0x9'));var crypto=require('crypto');var jsforce=require(_0xd136('0xa'));var deskjs=require(_0xd136('0xb'));var toCsv=require(_0xd136('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd136('0xc'));var authService=require(_0xd136('0xd'));var qs=require(_0xd136('0xe'));var as=require(_0xd136('0xf'));var hardwareService=require(_0xd136('0x10'));var logger=require(_0xd136('0x11'))(_0xd136('0x12'));var utils=require(_0xd136('0x13'));var config=require(_0xd136('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd136('0x15'))['db'];config[_0xd136('0x16')]=_['defaults'](config['redis'],{'host':_0xd136('0x17'),'port':0x18eb});var socket=require(_0xd136('0x18'))(new Redis(config[_0xd136('0x16')]));require(_0xd136('0x19'))[_0xd136('0x1a')](socket);function respondWithStatusCode(_0x2a23a5,_0xc85ab8){_0xc85ab8=_0xc85ab8||0xcc;return function(_0x2aab1e){if(_0x2aab1e){return _0x2a23a5[_0xd136('0x1b')](_0xc85ab8);}return _0x2a23a5['status'](_0xc85ab8)[_0xd136('0x1c')]();};}function respondWithResult(_0x1c7e30,_0x340b80){_0x340b80=_0x340b80||0xc8;return function(_0x44767e){if(_0x44767e){return _0x1c7e30['status'](_0x340b80)[_0xd136('0x1d')](_0x44767e);}};}function respondWithFilteredResult(_0xb24620,_0x3992c8){return function(_0x2960b4){if(_0x2960b4){var _0x44b991=typeof _0x3992c8[_0xd136('0x1e')]===_0xd136('0x1f')&&typeof _0x3992c8[_0xd136('0x20')]===_0xd136('0x1f');var _0x377ada=_0x2960b4[_0xd136('0x21')];var _0xd91129=_0x44b991?0x0:_0x3992c8[_0xd136('0x1e')];var _0x159315=_0x44b991?_0x2960b4[_0xd136('0x21')]:_0x3992c8[_0xd136('0x1e')]+_0x3992c8[_0xd136('0x20')];var _0x592039;if(_0x159315>=_0x377ada){_0x159315=_0x377ada;_0x592039=0xc8;}else{_0x592039=0xce;}_0xb24620['status'](_0x592039);return _0xb24620[_0xd136('0x22')](_0xd136('0x23'),_0xd91129+'-'+_0x159315+'/'+_0x377ada)[_0xd136('0x1d')](_0x2960b4);}return null;};}function patchUpdates(_0xd1ac3e){return function(_0x129314){try{jsonpatch['apply'](_0x129314,_0xd1ac3e,!![]);}catch(_0x55ff0e){return BPromise[_0xd136('0x24')](_0x55ff0e);}return _0x129314[_0xd136('0x25')]();};}function saveUpdates(_0x31c092,_0x40ff03){return function(_0x207cde){if(_0x207cde){return _0x207cde[_0xd136('0x26')](_0x31c092)[_0xd136('0x27')](function(_0xc8906c){return _0xc8906c;});}return null;};}function removeEntity(_0x565ef8,_0xba0d7e){return function(_0x100ef0){if(_0x100ef0){return _0x100ef0[_0xd136('0x28')]()[_0xd136('0x27')](function(){var _0x21f1b3=_0x100ef0[_0xd136('0x29')]({'plain':!![]});var _0x4e95a3='OpenchannelQueues';return db[_0xd136('0x2a')][_0xd136('0x28')]({'where':{'type':_0x4e95a3,'resourceId':_0x21f1b3['id']}})[_0xd136('0x27')](function(){return _0x100ef0;});})[_0xd136('0x27')](function(){_0x565ef8['status'](0xcc)[_0xd136('0x1c')]();});}};}function handleEntityNotFound(_0x2d6903,_0x14dd3f){return function(_0x2ef8f5){if(!_0x2ef8f5){_0x2d6903[_0xd136('0x1b')](0x194);}return _0x2ef8f5;};}function handleError(_0x5d0f4d,_0xb61512){_0xb61512=_0xb61512||0x1f4;return function(_0x4f9fcb){logger[_0xd136('0x2b')](_0x4f9fcb[_0xd136('0x2c')]);if(_0x4f9fcb[_0xd136('0x2d')]){delete _0x4f9fcb[_0xd136('0x2d')];}_0x5d0f4d['status'](_0xb61512)[_0xd136('0x2e')](_0x4f9fcb);};}exports['index']=function(_0x551105,_0x5a16a6){var _0x1c6f05={},_0x320ccd={},_0x48361e={'count':0x0,'rows':[]};var _0x20c676=_['map'](db[_0xd136('0x2f')][_0xd136('0x30')],function(_0xb88258){return{'name':_0xb88258['fieldName'],'type':_0xb88258[_0xd136('0x31')]['key']};});_0x320ccd[_0xd136('0x32')]=_[_0xd136('0x33')](_0x20c676,'name');_0x320ccd[_0xd136('0x34')]=_[_0xd136('0x35')](_0x551105[_0xd136('0x34')]);_0x320ccd[_0xd136('0x36')]=_[_0xd136('0x37')](_0x320ccd[_0xd136('0x32')],_0x320ccd['query']);_0x1c6f05[_0xd136('0x38')]=_[_0xd136('0x37')](_0x320ccd['model'],qs['fields'](_0x551105['query'][_0xd136('0x39')]));_0x1c6f05['attributes']=_0x1c6f05[_0xd136('0x38')][_0xd136('0x3a')]?_0x1c6f05[_0xd136('0x38')]:_0x320ccd[_0xd136('0x32')];if(!_0x551105[_0xd136('0x34')][_0xd136('0x3b')](_0xd136('0x3c'))){_0x1c6f05[_0xd136('0x20')]=qs[_0xd136('0x20')](_0x551105[_0xd136('0x34')][_0xd136('0x20')]);_0x1c6f05[_0xd136('0x1e')]=qs[_0xd136('0x1e')](_0x551105['query'][_0xd136('0x1e')]);}_0x1c6f05[_0xd136('0x3d')]=qs[_0xd136('0x3e')](_0x551105[_0xd136('0x34')][_0xd136('0x3e')]);_0x1c6f05[_0xd136('0x3f')]=qs['filters'](_[_0xd136('0x40')](_0x551105[_0xd136('0x34')],_0x320ccd[_0xd136('0x36')]),_0x20c676);if(_0x551105[_0xd136('0x34')]['filter']){_0x1c6f05[_0xd136('0x3f')]=_[_0xd136('0x41')](_0x1c6f05[_0xd136('0x3f')],{'$or':_[_0xd136('0x33')](_0x20c676,function(_0x12a26e){if(_0x12a26e[_0xd136('0x31')]!==_0xd136('0x42')){var _0x55a04d={};_0x55a04d[_0x12a26e['name']]={'$like':'%'+_0x551105[_0xd136('0x34')][_0xd136('0x43')]+'%'};return _0x55a04d;}})});}_0x1c6f05=_[_0xd136('0x41')]({},_0x1c6f05,_0x551105[_0xd136('0x44')]);var _0x526d20={'where':_0x1c6f05[_0xd136('0x3f')]};return db['OpenchannelQueue'][_0xd136('0x21')](_0x526d20)['then'](function(_0x66751a){_0x48361e['count']=_0x66751a;if(_0x551105[_0xd136('0x34')][_0xd136('0x45')]){_0x1c6f05[_0xd136('0x46')]=[{'all':!![]}];}return db[_0xd136('0x2f')][_0xd136('0x47')](_0x1c6f05);})[_0xd136('0x27')](function(_0x22a644){_0x48361e[_0xd136('0x48')]=_0x22a644;return _0x48361e;})[_0xd136('0x27')](respondWithFilteredResult(_0x5a16a6,_0x1c6f05))['catch'](handleError(_0x5a16a6,null));};exports[_0xd136('0x49')]=function(_0x5542cc,_0x4d5a05){var _0x25e043={'raw':!![],'where':{'id':_0x5542cc[_0xd136('0x4a')]['id']}},_0x2ab8ee={};_0x2ab8ee[_0xd136('0x32')]=_[_0xd136('0x35')](db[_0xd136('0x2f')][_0xd136('0x30')]);_0x2ab8ee[_0xd136('0x34')]=_[_0xd136('0x35')](_0x5542cc[_0xd136('0x34')]);_0x2ab8ee[_0xd136('0x36')]=_[_0xd136('0x37')](_0x2ab8ee[_0xd136('0x32')],_0x2ab8ee[_0xd136('0x34')]);_0x25e043[_0xd136('0x38')]=_[_0xd136('0x37')](_0x2ab8ee['model'],qs[_0xd136('0x39')](_0x5542cc[_0xd136('0x34')][_0xd136('0x39')]));_0x25e043['attributes']=_0x25e043['attributes']['length']?_0x25e043[_0xd136('0x38')]:_0x2ab8ee[_0xd136('0x32')];if(_0x5542cc[_0xd136('0x34')][_0xd136('0x45')]){_0x25e043[_0xd136('0x46')]=[{'all':!![]}];}_0x25e043=_[_0xd136('0x41')]({},_0x25e043,_0x5542cc[_0xd136('0x44')]);return db[_0xd136('0x2f')]['find'](_0x25e043)['then'](handleEntityNotFound(_0x4d5a05,null))[_0xd136('0x27')](respondWithResult(_0x4d5a05,null))[_0xd136('0x4b')](handleError(_0x4d5a05,null));};exports[_0xd136('0x4c')]=function(_0x2142be,_0x33ffdf){return db[_0xd136('0x2f')][_0xd136('0x4c')](_0x2142be[_0xd136('0x4d')],{})[_0xd136('0x27')](function(_0x4ce743){var _0x144028=_0x2142be[_0xd136('0x4e')][_0xd136('0x29')]({'plain':!![]});if(!_0x144028)throw new Error(_0xd136('0x4f'));if(_0x144028[_0xd136('0x50')]==='user'){var _0x5d9b7e=_0x4ce743[_0xd136('0x29')]({'plain':!![]});var _0x26e4ea=_0xd136('0x51');return db[_0xd136('0x52')]['find']({'where':{'name':_0x26e4ea,'userProfileId':_0x144028[_0xd136('0x53')]},'raw':!![]})[_0xd136('0x27')](function(_0x2a828d){if(_0x2a828d&&_0x2a828d[_0xd136('0x54')]===0x0){return db[_0xd136('0x2a')][_0xd136('0x4c')]({'name':_0x5d9b7e[_0xd136('0x2d')],'resourceId':_0x5d9b7e['id'],'type':_0x2a828d[_0xd136('0x2d')],'sectionId':_0x2a828d['id']},{})[_0xd136('0x27')](function(){return _0x4ce743;});}else{return _0x4ce743;}})['catch'](function(_0xa08cda){logger[_0xd136('0x2b')](_0xd136('0x55'),_0xa08cda);throw _0xa08cda;});}return _0x4ce743;})[_0xd136('0x27')](respondWithResult(_0x33ffdf,0xc9))[_0xd136('0x4b')](handleError(_0x33ffdf,null));};exports[_0xd136('0x26')]=function(_0x2252ce,_0x3c73f8){if(_0x2252ce['body']['id']){delete _0x2252ce[_0xd136('0x4d')]['id'];}return db[_0xd136('0x2f')][_0xd136('0x56')]({'where':{'id':_0x2252ce[_0xd136('0x4a')]['id']}})[_0xd136('0x27')](handleEntityNotFound(_0x3c73f8,null))[_0xd136('0x27')](saveUpdates(_0x2252ce[_0xd136('0x4d')],null))[_0xd136('0x27')](respondWithResult(_0x3c73f8,null))[_0xd136('0x4b')](handleError(_0x3c73f8,null));};exports['destroy']=function(_0x3d58ea,_0x5ea9e8){return db[_0xd136('0x2f')]['find']({'where':{'id':_0x3d58ea['params']['id']}})['then'](handleEntityNotFound(_0x5ea9e8,null))['then'](removeEntity(_0x5ea9e8,null))[_0xd136('0x4b')](handleError(_0x5ea9e8,null));};exports['describe']=function(_0x3edfc1,_0x50fc59){return db['OpenchannelQueue'][_0xd136('0x57')]()[_0xd136('0x27')](respondWithResult(_0x50fc59,null))[_0xd136('0x4b')](handleError(_0x50fc59,null));};exports[_0xd136('0x58')]=function(_0x31d24c,_0x57c1a5,_0x3ce058){var _0x1a0633={'raw':!![],'where':{}},_0x592684={},_0x172dab;return db[_0xd136('0x2f')]['findOne']({'where':{'id':_0x31d24c[_0xd136('0x4a')]['id']}})[_0xd136('0x27')](handleEntityNotFound(_0x57c1a5,null))[_0xd136('0x27')](function(_0x185776){if(_0x185776){_0x172dab=_0x185776['get']({'plain':!![]});_0x592684['model']=_[_0xd136('0x35')](db[_0xd136('0x59')]['rawAttributes']);_0x592684[_0xd136('0x34')]=_[_0xd136('0x35')](_0x31d24c['query']);_0x592684[_0xd136('0x36')]=_[_0xd136('0x37')](_0x592684[_0xd136('0x32')],_0x592684[_0xd136('0x34')]);_0x1a0633[_0xd136('0x38')]=_[_0xd136('0x37')](_0x592684[_0xd136('0x32')],qs[_0xd136('0x39')](_0x31d24c[_0xd136('0x34')][_0xd136('0x39')]));_0x1a0633[_0xd136('0x38')]=_0x1a0633[_0xd136('0x38')]['length']?_0x1a0633[_0xd136('0x38')]:_0x592684[_0xd136('0x32')];if(!_0x31d24c[_0xd136('0x34')]['hasOwnProperty'](_0xd136('0x3c'))){_0x1a0633[_0xd136('0x20')]=qs[_0xd136('0x20')](_0x31d24c[_0xd136('0x34')][_0xd136('0x20')]);_0x1a0633[_0xd136('0x1e')]=qs[_0xd136('0x1e')](_0x31d24c[_0xd136('0x34')][_0xd136('0x1e')]);}_0x1a0633[_0xd136('0x3d')]=qs[_0xd136('0x3e')](_0x31d24c[_0xd136('0x34')][_0xd136('0x3e')]);_0x1a0633[_0xd136('0x3f')]=qs[_0xd136('0x36')](_['pick'](_0x31d24c[_0xd136('0x34')],_0x592684['filters']));_0x1a0633[_0xd136('0x3f')][_0xd136('0x5a')]=_0x185776['id'];if(_0x31d24c[_0xd136('0x34')]['filter']){_0x1a0633['where']=_[_0xd136('0x41')](_0x1a0633['where'],{'$or':_['map'](_0x1a0633[_0xd136('0x38')],function(_0x3763dd){var _0x2aca2a={};_0x2aca2a[_0x3763dd]={'$like':'%'+_0x31d24c[_0xd136('0x34')]['filter']+'%'};return _0x2aca2a;})});}_0x1a0633=_['merge']({},_0x1a0633,_0x31d24c[_0xd136('0x44')]);return db['UserOpenchannelQueue'][_0xd136('0x47')](_0x1a0633);}})[_0xd136('0x27')](function(_0x4300f5){if(_0x4300f5){return db[_0xd136('0x5b')]['findAndCountAll']({'where':{'id':_['map'](_0x4300f5,_0xd136('0x5c')),'role':_0xd136('0x5d')},'attributes':['id',_0xd136('0x2d'),_0xd136('0x5e'),_0xd136('0x5f'),_0xd136('0x60')]});}})[_0xd136('0x27')](function(_0x4ad64e){if(_0x4ad64e){return{'count':_0x4ad64e[_0xd136('0x21')],'rows':_[_0xd136('0x33')](_0x4ad64e['rows'],function(_0x37b677){return{'membername':_0x37b677[_0xd136('0x2d')],'UserId':_0x37b677['id'],'queue_name':_0x172dab[_0xd136('0x2d')],'OpenchannelQueueId':_0x172dab['id'],'interface':util[_0xd136('0x61')](_0xd136('0x62'),_0xd136('0x63'),_0x37b677['name']),'penalty':0x0,'paused':_0x37b677[_0xd136('0x5e')],'createdAt':_0x37b677[_0xd136('0x60')],'updatedAt':_0x37b677[_0xd136('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd136('0x27')](respondWithFilteredResult(_0x57c1a5,_0x1a0633))[_0xd136('0x4b')](handleError(_0x57c1a5,null));};exports['getTeams']=function(_0x16f298,_0x535a52,_0x2e6398){var _0x3b4d43={};var _0xc02455={};var _0x17662f;var _0x5d41f3;return db[_0xd136('0x2f')]['findOne']({'where':{'id':_0x16f298[_0xd136('0x4a')]['id']}})[_0xd136('0x27')](handleEntityNotFound(_0x535a52,null))[_0xd136('0x27')](function(_0x217682){if(_0x217682){_0x17662f=_0x217682;_0xc02455[_0xd136('0x32')]=_[_0xd136('0x35')](db['Team'][_0xd136('0x30')]);_0xc02455['query']=_[_0xd136('0x35')](_0x16f298[_0xd136('0x34')]);_0xc02455[_0xd136('0x36')]=_[_0xd136('0x37')](_0xc02455['model'],_0xc02455[_0xd136('0x34')]);_0x3b4d43[_0xd136('0x38')]=_[_0xd136('0x37')](_0xc02455[_0xd136('0x32')],qs['fields'](_0x16f298[_0xd136('0x34')][_0xd136('0x39')]));_0x3b4d43[_0xd136('0x38')]=_0x3b4d43['attributes'][_0xd136('0x3a')]?_0x3b4d43[_0xd136('0x38')]:_0xc02455[_0xd136('0x32')];_0x3b4d43[_0xd136('0x3d')]=qs[_0xd136('0x3e')](_0x16f298['query'][_0xd136('0x3e')]);_0x3b4d43[_0xd136('0x3f')]=qs[_0xd136('0x36')](_[_0xd136('0x40')](_0x16f298[_0xd136('0x34')],_0xc02455[_0xd136('0x36')]));if(_0x16f298[_0xd136('0x34')][_0xd136('0x43')]){_0x3b4d43[_0xd136('0x3f')]=_[_0xd136('0x41')](_0x3b4d43[_0xd136('0x3f')],{'$or':_['map'](_0x3b4d43[_0xd136('0x38')],function(_0x30a848){var _0x4dda21={};_0x4dda21[_0x30a848]={'$like':'%'+_0x16f298[_0xd136('0x34')][_0xd136('0x43')]+'%'};return _0x4dda21;})});}_0x3b4d43=_['merge']({},_0x3b4d43,_0x16f298[_0xd136('0x44')]);return _0x17662f[_0xd136('0x64')](_0x3b4d43);}})[_0xd136('0x27')](function(_0xb8a6ee){if(_0xb8a6ee){_0x5d41f3=_0xb8a6ee[_0xd136('0x3a')];if(!_0x16f298[_0xd136('0x34')][_0xd136('0x3b')]('nolimit')){_0x3b4d43['limit']=qs[_0xd136('0x20')](_0x16f298[_0xd136('0x34')][_0xd136('0x20')]);_0x3b4d43[_0xd136('0x1e')]=qs[_0xd136('0x1e')](_0x16f298[_0xd136('0x34')][_0xd136('0x1e')]);}return _0x17662f[_0xd136('0x64')](_0x3b4d43);}})[_0xd136('0x27')](function(_0x4889e0){if(_0x4889e0){return _0x4889e0?{'count':_0x5d41f3,'rows':_0x4889e0}:null;}})[_0xd136('0x27')](respondWithResult(_0x535a52,null))[_0xd136('0x4b')](handleError(_0x535a52,null));};exports[_0xd136('0x65')]=function(_0x2b0e7d,_0x21f4cc,_0x23ad51){var _0x3f7211=_0x2b0e7d[_0xd136('0x4d')]['ids'];return db['Team'][_0xd136('0x47')]({'where':{'id':_0x3f7211},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd136('0x66'),'attributes':['id','name','online',_0xd136('0x67'),_0xd136('0x68')],'raw':!![]}]})[_0xd136('0x27')](function(_0xfca8e){if(_0xfca8e){var _0xfc985c=_[_0xd136('0x69')](_0xfca8e,function(_0x8de6ea){var _0x11016c=_0x8de6ea[_0xd136('0x29')]({'plain':!![]});return _0x11016c['Agents'];});return db['OpenchannelQueue'][_0xd136('0x56')]({'where':{'id':_0x2b0e7d[_0xd136('0x4a')]['id']}})['then'](function(_0x51eada){return db[_0xd136('0x6a')][_0xd136('0x6b')](function(_0x379253){return _0x51eada[_0xd136('0x65')](_0x3f7211,{'transaction':_0x379253})[_0xd136('0x27')](function(){return BPromise[_0xd136('0x6c')](_0xfc985c,function(_0x3e1eea){return db[_0xd136('0x59')][_0xd136('0x6d')]({'where':{'UserId':_0x3e1eea['id'],'OpenchannelQueueId':_0x2b0e7d[_0xd136('0x4a')]['id']},'transaction':_0x379253});});})[_0xd136('0x27')](function(){_0xfc985c['forEach'](function(_0x13d147){socket[_0xd136('0x6e')](_0xd136('0x6f'),{'UserId':_0x13d147['id'],'OpenchannelQueueId':_0x51eada['id']});});});});});}})[_0xd136('0x27')](respondWithStatusCode(_0x21f4cc,null))[_0xd136('0x4b')](handleError(_0x21f4cc,null));};exports[_0xd136('0x70')]=function(_0x1afc94,_0xd7b13e,_0x13598f){return db['Team']['findAll']({'where':{'id':_0x1afc94[_0xd136('0x34')][_0xd136('0x71')]},'attributes':['id'],'include':[{'model':db[_0xd136('0x5b')],'as':_0xd136('0x66'),'attributes':['id'],'raw':!![]}]})[_0xd136('0x27')](handleEntityNotFound(_0xd7b13e,null))[_0xd136('0x27')](function(_0x3c979f){var _0x4f7d05=_[_0xd136('0x33')](_0x3c979f,'id');var _0x58bbb9=[];var _0x4e73e5=[];var _0x547e1d=squel[_0xd136('0x72')]();_0x547e1d['field'](_0xd136('0x73'))['from'](_0xd136('0x74'),'tq')['join'](_0xd136('0x75'),'ut',_0xd136('0x76'))[_0xd136('0x3f')](_0xd136('0x77'),_0x1afc94[_0xd136('0x4a')]['id']);for(var _0x5226d1=0x0;_0x5226d1<_0x3c979f[_0xd136('0x3a')];_0x5226d1+=0x1){let _0x331cca=_0x3c979f[_0x5226d1];for(var _0x33a571=0x0;_0x33a571<_0x331cca['Agents'][_0xd136('0x3a')];_0x33a571+=0x1){let _0x1290bd=_0x331cca[_0xd136('0x66')][_0x33a571];var _0x2e634d=_0x547e1d[_0xd136('0x78')]();_0x2e634d[_0xd136('0x3f')](_0xd136('0x79'),_0x1290bd['id']);_0x4e73e5[_0xd136('0x7a')](db['sequelize']['query'](_0x2e634d['toString'](),{'type':db[_0xd136('0x6a')][_0xd136('0x7b')]['SELECT']})[_0xd136('0x27')](function(_0x194af4){if(_0x194af4[_0xd136('0x3a')]===0x1){return _0x1290bd['id'];}else{var _0x310954=_[_0xd136('0x7c')](_[_0xd136('0x33')](_0x194af4,_0xd136('0x7d')),function(_0x57ce09){return _[_0xd136('0x7e')](_0x4f7d05,_0x57ce09);});if(_0x310954){return _0x1290bd['id'];}}}));}}return BPromise[_0xd136('0x7f')](_0x4e73e5)[_0xd136('0x27')](function(_0x44fe69){_0x58bbb9=_(_0x58bbb9)['union'](_0x44fe69)[_0xd136('0x80')]()[_0xd136('0x81')]();return db['OpenchannelQueue'][_0xd136('0x56')]({'where':{'id':_0x1afc94[_0xd136('0x4a')]['id']}})[_0xd136('0x27')](function(_0x46a61a){return db[_0xd136('0x6a')][_0xd136('0x6b')](function(_0x4f8c51){return _0x46a61a[_0xd136('0x70')](_0x1afc94[_0xd136('0x34')][_0xd136('0x71')],{'transaction':_0x4f8c51})['then'](function(){if(!_[_0xd136('0x82')](_0x58bbb9)){return _0x46a61a[_0xd136('0x83')](_0x58bbb9,{'transaction':_0x4f8c51});}})[_0xd136('0x27')](function(){_0x58bbb9['forEach'](function(_0x1e550f){socket[_0xd136('0x6e')](_0xd136('0x84'),{'UserId':_0x1e550f,'OpenchannelQueueId':_0x46a61a['id']});});});});});});})[_0xd136('0x27')](respondWithStatusCode(_0xd7b13e,null))['catch'](handleError(_0xd7b13e,null));};exports[_0xd136('0x85')]=function(_0x4fa845,_0x1315f9,_0x15570c){return db[_0xd136('0x2f')][_0xd136('0x56')]({'where':{'id':_0x4fa845[_0xd136('0x4a')]['id']}})[_0xd136('0x27')](handleEntityNotFound(_0x1315f9,null))[_0xd136('0x27')](function(_0xbaffd4){if(_0xbaffd4){return _0xbaffd4['addAgents'](_0x4fa845[_0xd136('0x4d')][_0xd136('0x71')],_['omit'](_0x4fa845[_0xd136('0x4d')],['ids','id'])||{})['spread'](function(_0x50d7dd){for(var _0xf3902c=0x0;_0xf3902c<_0x4fa845[_0xd136('0x4d')][_0xd136('0x71')]['length'];_0xf3902c+=0x1){socket['emit'](_0xd136('0x6f'),{'UserId':Number(_0x4fa845[_0xd136('0x4d')]['ids'][_0xf3902c]),'OpenchannelQueueId':Number(_0x4fa845['params']['id'])});}return _0x50d7dd;});}})['then'](respondWithResult(_0x1315f9,null))[_0xd136('0x4b')](handleError(_0x1315f9,null));};exports[_0xd136('0x83')]=function(_0xfe95a2,_0x5d26c5,_0x1cb474){return db['OpenchannelQueue'][_0xd136('0x56')]({'where':{'id':_0xfe95a2['params']['id']}})[_0xd136('0x27')](handleEntityNotFound(_0x5d26c5,null))[_0xd136('0x27')](function(_0x366d42){if(_0x366d42){return _0x366d42['removeAgents'](_0xfe95a2[_0xd136('0x34')][_0xd136('0x71')])[_0xd136('0x27')](function(){if(_[_0xd136('0x86')](_0xfe95a2[_0xd136('0x34')][_0xd136('0x71')])){for(var _0x332c75=0x0;_0x332c75<_0xfe95a2['query'][_0xd136('0x71')][_0xd136('0x3a')];_0x332c75+=0x1){socket['emit'](_0xd136('0x84'),{'UserId':Number(_0xfe95a2['query'][_0xd136('0x71')][_0x332c75]),'OpenchannelQueueId':Number(_0xfe95a2[_0xd136('0x4a')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0xfe95a2['query']['ids']),'OpenchannelQueueId':Number(_0xfe95a2[_0xd136('0x4a')]['id'])});}});}})[_0xd136('0x27')](respondWithStatusCode(_0x5d26c5,null))['catch'](handleError(_0x5d26c5,null));};exports[_0xd136('0x87')]=function(_0x1c6565,_0x5d2ffb,_0x14a5b3){var _0x2fe260={};var _0x31cbe2={};var _0x4454a5;var _0x573332;return db[_0xd136('0x2f')]['findOne']({'where':{'id':_0x1c6565[_0xd136('0x4a')]['id']}})[_0xd136('0x27')](handleEntityNotFound(_0x5d2ffb,null))[_0xd136('0x27')](function(_0x343acf){if(_0x343acf){_0x4454a5=_0x343acf;_0x31cbe2[_0xd136('0x32')]=_[_0xd136('0x35')](db[_0xd136('0x5b')][_0xd136('0x30')]);_0x31cbe2[_0xd136('0x34')]=_[_0xd136('0x35')](_0x1c6565[_0xd136('0x34')]);_0x31cbe2[_0xd136('0x36')]=_['intersection'](_0x31cbe2['model'],_0x31cbe2[_0xd136('0x34')]);_0x2fe260['attributes']=_[_0xd136('0x37')](_0x31cbe2[_0xd136('0x32')],qs[_0xd136('0x39')](_0x1c6565['query'][_0xd136('0x39')]));_0x2fe260[_0xd136('0x38')]=_0x2fe260[_0xd136('0x38')][_0xd136('0x3a')]?_0x2fe260[_0xd136('0x38')]:_0x31cbe2[_0xd136('0x32')];_0x2fe260[_0xd136('0x3d')]=qs['sort'](_0x1c6565[_0xd136('0x34')][_0xd136('0x3e')]);_0x2fe260[_0xd136('0x3f')]=qs[_0xd136('0x36')](_[_0xd136('0x40')](_0x1c6565[_0xd136('0x34')],_0x31cbe2[_0xd136('0x36')]));if(_0x1c6565['query']['filter']){_0x2fe260[_0xd136('0x3f')]=_[_0xd136('0x41')](_0x2fe260[_0xd136('0x3f')],{'$or':_[_0xd136('0x33')](_0x2fe260[_0xd136('0x38')],function(_0xdea290){var _0x44a1d3={};_0x44a1d3[_0xdea290]={'$like':'%'+_0x1c6565[_0xd136('0x34')][_0xd136('0x43')]+'%'};return _0x44a1d3;})});}_0x2fe260=_[_0xd136('0x41')]({},_0x2fe260,_0x1c6565[_0xd136('0x44')]);return _0x4454a5['getAgents'](_0x2fe260);}})['then'](function(_0x2984f3){if(_0x2984f3){_0x573332=_0x2984f3[_0xd136('0x3a')];if(!_0x1c6565[_0xd136('0x34')][_0xd136('0x3b')](_0xd136('0x3c'))){_0x2fe260[_0xd136('0x20')]=qs[_0xd136('0x20')](_0x1c6565[_0xd136('0x34')][_0xd136('0x20')]);_0x2fe260[_0xd136('0x1e')]=qs['offset'](_0x1c6565[_0xd136('0x34')][_0xd136('0x1e')]);}return _0x4454a5[_0xd136('0x87')](_0x2fe260);}})[_0xd136('0x27')](function(_0x4f7b7f){if(_0x4f7b7f){return _0x4f7b7f?{'count':_0x573332,'rows':_0x4f7b7f}:null;}})['then'](respondWithResult(_0x5d2ffb,null))[_0xd136('0x4b')](handleError(_0x5d2ffb,null));}; \ No newline at end of file +var _0x5d2e=['redis','./openchannelQueue.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelQueues','UserProfileResource','then','end','error','stack','name','send','index','map','OpenchannelQueue','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','filters','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','getMembers','findOne','UserOpenchannelQueue','rawAttributes','length','OpenchannelQueueId','findAll','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','openchannelPause','getTeams','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userOpenchannelQueue:remove','omit','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter'];(function(_0x5340d2,_0x3592aa){var _0x381868=function(_0x4a216d){while(--_0x4a216d){_0x5340d2['push'](_0x5340d2['shift']());}};_0x381868(++_0x3592aa);}(_0x5d2e,0x75));var _0xe5d2=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x5d2e[_0x279d37];return _0x530173;};'use strict';var emlformat=require(_0xe5d2('0x0'));var rimraf=require(_0xe5d2('0x1'));var zipdir=require(_0xe5d2('0x2'));var jsonpatch=require(_0xe5d2('0x3'));var rp=require('request-promise');var moment=require(_0xe5d2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe5d2('0x5'));var path=require(_0xe5d2('0x6'));var sox=require(_0xe5d2('0x7'));var csv=require(_0xe5d2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe5d2('0x9'));var _=require(_0xe5d2('0xa'));var squel=require(_0xe5d2('0xb'));var crypto=require(_0xe5d2('0xc'));var jsforce=require(_0xe5d2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe5d2('0x8'));var querystring=require(_0xe5d2('0xe'));var Papa=require(_0xe5d2('0xf'));var Redis=require('ioredis');var authService=require(_0xe5d2('0x10'));var qs=require(_0xe5d2('0x11'));var as=require(_0xe5d2('0x12'));var hardwareService=require(_0xe5d2('0x13'));var logger=require(_0xe5d2('0x14'))(_0xe5d2('0x15'));var utils=require(_0xe5d2('0x16'));var config=require(_0xe5d2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe5d2('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xe5d2('0x19'),'port':0x18eb});var socket=require(_0xe5d2('0x1a'))(new Redis(config[_0xe5d2('0x1b')]));require(_0xe5d2('0x1c'))['register'](socket);function respondWithStatusCode(_0xe4c1e,_0x4cba82){_0x4cba82=_0x4cba82||0xcc;return function(_0x5836b7){if(_0x5836b7){return _0xe4c1e[_0xe5d2('0x1d')](_0x4cba82);}return _0xe4c1e[_0xe5d2('0x1e')](_0x4cba82)['end']();};}function respondWithResult(_0x47a125,_0x3882ca){_0x3882ca=_0x3882ca||0xc8;return function(_0x383b87){if(_0x383b87){return _0x47a125['status'](_0x3882ca)[_0xe5d2('0x1f')](_0x383b87);}};}function respondWithFilteredResult(_0x25a3ed,_0x198d73){return function(_0x31f358){if(_0x31f358){var _0x41482b=typeof _0x198d73[_0xe5d2('0x20')]===_0xe5d2('0x21')&&typeof _0x198d73[_0xe5d2('0x22')]===_0xe5d2('0x21');var _0x3d8e8b=_0x31f358[_0xe5d2('0x23')];var _0x4695ae=_0x41482b?0x0:_0x198d73[_0xe5d2('0x20')];var _0x2ed591=_0x41482b?_0x31f358[_0xe5d2('0x23')]:_0x198d73[_0xe5d2('0x20')]+_0x198d73['limit'];var _0x4e19ed;if(_0x2ed591>=_0x3d8e8b){_0x2ed591=_0x3d8e8b;_0x4e19ed=0xc8;}else{_0x4e19ed=0xce;}_0x25a3ed[_0xe5d2('0x1e')](_0x4e19ed);return _0x25a3ed[_0xe5d2('0x24')](_0xe5d2('0x25'),_0x4695ae+'-'+_0x2ed591+'/'+_0x3d8e8b)[_0xe5d2('0x1f')](_0x31f358);}return null;};}function patchUpdates(_0x2b69ba){return function(_0x3c184a){try{jsonpatch[_0xe5d2('0x26')](_0x3c184a,_0x2b69ba,!![]);}catch(_0x3e59e1){return BPromise[_0xe5d2('0x27')](_0x3e59e1);}return _0x3c184a[_0xe5d2('0x28')]();};}function saveUpdates(_0x527878,_0x541028){return function(_0xe2a7ac){if(_0xe2a7ac){return _0xe2a7ac[_0xe5d2('0x29')](_0x527878)['then'](function(_0x31d61e){return _0x31d61e;});}return null;};}function removeEntity(_0xb061b6,_0x4cb581){return function(_0x277dd6){if(_0x277dd6){return _0x277dd6[_0xe5d2('0x2a')]()['then'](function(){var _0x20d3ce=_0x277dd6[_0xe5d2('0x2b')]({'plain':!![]});var _0x219424=_0xe5d2('0x2c');return db[_0xe5d2('0x2d')][_0xe5d2('0x2a')]({'where':{'type':_0x219424,'resourceId':_0x20d3ce['id']}})[_0xe5d2('0x2e')](function(){return _0x277dd6;});})[_0xe5d2('0x2e')](function(){_0xb061b6['status'](0xcc)[_0xe5d2('0x2f')]();});}};}function handleEntityNotFound(_0x8008de,_0x3a2264){return function(_0x509941){if(!_0x509941){_0x8008de[_0xe5d2('0x1d')](0x194);}return _0x509941;};}function handleError(_0x5ac3d9,_0x47b830){_0x47b830=_0x47b830||0x1f4;return function(_0x3a6291){logger[_0xe5d2('0x30')](_0x3a6291[_0xe5d2('0x31')]);if(_0x3a6291[_0xe5d2('0x32')]){delete _0x3a6291['name'];}_0x5ac3d9[_0xe5d2('0x1e')](_0x47b830)[_0xe5d2('0x33')](_0x3a6291);};}exports[_0xe5d2('0x34')]=function(_0x4e5aec,_0x42bece){var _0xe221c0={},_0xd5c76b={},_0x17ea55={'count':0x0,'rows':[]};var _0x58fcb0=_[_0xe5d2('0x35')](db[_0xe5d2('0x36')]['rawAttributes'],function(_0x3d97a5){return{'name':_0x3d97a5[_0xe5d2('0x37')],'type':_0x3d97a5['type'][_0xe5d2('0x38')]};});_0xd5c76b[_0xe5d2('0x39')]=_[_0xe5d2('0x35')](_0x58fcb0,_0xe5d2('0x32'));_0xd5c76b[_0xe5d2('0x3a')]=_[_0xe5d2('0x3b')](_0x4e5aec[_0xe5d2('0x3a')]);_0xd5c76b['filters']=_[_0xe5d2('0x3c')](_0xd5c76b[_0xe5d2('0x39')],_0xd5c76b[_0xe5d2('0x3a')]);_0xe221c0[_0xe5d2('0x3d')]=_[_0xe5d2('0x3c')](_0xd5c76b[_0xe5d2('0x39')],qs[_0xe5d2('0x3e')](_0x4e5aec[_0xe5d2('0x3a')][_0xe5d2('0x3e')]));_0xe221c0[_0xe5d2('0x3d')]=_0xe221c0['attributes']['length']?_0xe221c0[_0xe5d2('0x3d')]:_0xd5c76b[_0xe5d2('0x39')];if(!_0x4e5aec[_0xe5d2('0x3a')][_0xe5d2('0x3f')](_0xe5d2('0x40'))){_0xe221c0[_0xe5d2('0x22')]=qs['limit'](_0x4e5aec[_0xe5d2('0x3a')][_0xe5d2('0x22')]);_0xe221c0[_0xe5d2('0x20')]=qs['offset'](_0x4e5aec['query'][_0xe5d2('0x20')]);}_0xe221c0[_0xe5d2('0x41')]=qs[_0xe5d2('0x42')](_0x4e5aec[_0xe5d2('0x3a')]['sort']);_0xe221c0[_0xe5d2('0x43')]=qs['filters'](_['pick'](_0x4e5aec[_0xe5d2('0x3a')],_0xd5c76b['filters']),_0x58fcb0);if(_0x4e5aec[_0xe5d2('0x3a')][_0xe5d2('0x44')]){_0xe221c0['where']=_['merge'](_0xe221c0[_0xe5d2('0x43')],{'$or':_[_0xe5d2('0x35')](_0x58fcb0,function(_0x2ff5da){if(_0x2ff5da[_0xe5d2('0x45')]!==_0xe5d2('0x46')){var _0x4580fa={};_0x4580fa[_0x2ff5da[_0xe5d2('0x32')]]={'$like':'%'+_0x4e5aec[_0xe5d2('0x3a')][_0xe5d2('0x44')]+'%'};return _0x4580fa;}})});}_0xe221c0=_[_0xe5d2('0x47')]({},_0xe221c0,_0x4e5aec[_0xe5d2('0x48')]);var _0x5054ea={'where':_0xe221c0[_0xe5d2('0x43')]};return db[_0xe5d2('0x36')][_0xe5d2('0x23')](_0x5054ea)[_0xe5d2('0x2e')](function(_0x1a0172){_0x17ea55[_0xe5d2('0x23')]=_0x1a0172;if(_0x4e5aec[_0xe5d2('0x3a')][_0xe5d2('0x49')]){_0xe221c0[_0xe5d2('0x4a')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0xe221c0);})['then'](function(_0x21281b){_0x17ea55[_0xe5d2('0x4b')]=_0x21281b;return _0x17ea55;})['then'](respondWithFilteredResult(_0x42bece,_0xe221c0))[_0xe5d2('0x4c')](handleError(_0x42bece,null));};exports['show']=function(_0x146fec,_0x1cd41d){var _0x1a86ad={'raw':!![],'where':{'id':_0x146fec['params']['id']}},_0x43b594={};_0x43b594[_0xe5d2('0x39')]=_[_0xe5d2('0x3b')](db[_0xe5d2('0x36')]['rawAttributes']);_0x43b594[_0xe5d2('0x3a')]=_[_0xe5d2('0x3b')](_0x146fec[_0xe5d2('0x3a')]);_0x43b594[_0xe5d2('0x4d')]=_[_0xe5d2('0x3c')](_0x43b594[_0xe5d2('0x39')],_0x43b594[_0xe5d2('0x3a')]);_0x1a86ad[_0xe5d2('0x3d')]=_[_0xe5d2('0x3c')](_0x43b594[_0xe5d2('0x39')],qs[_0xe5d2('0x3e')](_0x146fec[_0xe5d2('0x3a')][_0xe5d2('0x3e')]));_0x1a86ad[_0xe5d2('0x3d')]=_0x1a86ad['attributes']['length']?_0x1a86ad[_0xe5d2('0x3d')]:_0x43b594[_0xe5d2('0x39')];if(_0x146fec['query'][_0xe5d2('0x49')]){_0x1a86ad['include']=[{'all':!![]}];}_0x1a86ad=_[_0xe5d2('0x47')]({},_0x1a86ad,_0x146fec[_0xe5d2('0x48')]);return db[_0xe5d2('0x36')]['find'](_0x1a86ad)['then'](handleEntityNotFound(_0x1cd41d,null))[_0xe5d2('0x2e')](respondWithResult(_0x1cd41d,null))[_0xe5d2('0x4c')](handleError(_0x1cd41d,null));};exports[_0xe5d2('0x4e')]=function(_0x2c7b69,_0x497dcb){return db['OpenchannelQueue']['create'](_0x2c7b69[_0xe5d2('0x4f')],{})[_0xe5d2('0x2e')](function(_0x452e28){var _0x320d35=_0x2c7b69[_0xe5d2('0x50')][_0xe5d2('0x2b')]({'plain':!![]});if(!_0x320d35)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x320d35[_0xe5d2('0x51')]===_0xe5d2('0x50')){var _0x38ed1e=_0x452e28['get']({'plain':!![]});var _0x48c2ba=_0xe5d2('0x2c');return db[_0xe5d2('0x52')]['find']({'where':{'name':_0x48c2ba,'userProfileId':_0x320d35[_0xe5d2('0x53')]},'raw':!![]})[_0xe5d2('0x2e')](function(_0x8c0370){if(_0x8c0370&&_0x8c0370[_0xe5d2('0x54')]===0x0){return db[_0xe5d2('0x2d')][_0xe5d2('0x4e')]({'name':_0x38ed1e[_0xe5d2('0x32')],'resourceId':_0x38ed1e['id'],'type':_0x8c0370[_0xe5d2('0x32')],'sectionId':_0x8c0370['id']},{})[_0xe5d2('0x2e')](function(){return _0x452e28;});}else{return _0x452e28;}})[_0xe5d2('0x4c')](function(_0x50762e){logger['error'](_0xe5d2('0x55'),_0x50762e);throw _0x50762e;});}return _0x452e28;})['then'](respondWithResult(_0x497dcb,0xc9))[_0xe5d2('0x4c')](handleError(_0x497dcb,null));};exports[_0xe5d2('0x29')]=function(_0x2ddd07,_0x4f8ca3){if(_0x2ddd07['body']['id']){delete _0x2ddd07[_0xe5d2('0x4f')]['id'];}return db['OpenchannelQueue'][_0xe5d2('0x56')]({'where':{'id':_0x2ddd07['params']['id']}})[_0xe5d2('0x2e')](handleEntityNotFound(_0x4f8ca3,null))[_0xe5d2('0x2e')](saveUpdates(_0x2ddd07[_0xe5d2('0x4f')],null))[_0xe5d2('0x2e')](respondWithResult(_0x4f8ca3,null))[_0xe5d2('0x4c')](handleError(_0x4f8ca3,null));};exports[_0xe5d2('0x2a')]=function(_0x10ba22,_0x16aa1b){return db[_0xe5d2('0x36')][_0xe5d2('0x56')]({'where':{'id':_0x10ba22[_0xe5d2('0x57')]['id']}})[_0xe5d2('0x2e')](handleEntityNotFound(_0x16aa1b,null))[_0xe5d2('0x2e')](removeEntity(_0x16aa1b,null))[_0xe5d2('0x4c')](handleError(_0x16aa1b,null));};exports[_0xe5d2('0x58')]=function(_0x3f1185,_0x13e421){return db['OpenchannelQueue'][_0xe5d2('0x58')]()[_0xe5d2('0x2e')](respondWithResult(_0x13e421,null))[_0xe5d2('0x4c')](handleError(_0x13e421,null));};exports[_0xe5d2('0x59')]=function(_0x295a52,_0xc971cc,_0x4a842a){var _0x4ecff8={'raw':!![],'where':{}},_0xaf1b5={},_0x311af5;return db[_0xe5d2('0x36')][_0xe5d2('0x5a')]({'where':{'id':_0x295a52[_0xe5d2('0x57')]['id']}})[_0xe5d2('0x2e')](handleEntityNotFound(_0xc971cc,null))['then'](function(_0x393752){if(_0x393752){_0x311af5=_0x393752[_0xe5d2('0x2b')]({'plain':!![]});_0xaf1b5[_0xe5d2('0x39')]=_[_0xe5d2('0x3b')](db[_0xe5d2('0x5b')][_0xe5d2('0x5c')]);_0xaf1b5[_0xe5d2('0x3a')]=_[_0xe5d2('0x3b')](_0x295a52[_0xe5d2('0x3a')]);_0xaf1b5[_0xe5d2('0x4d')]=_['intersection'](_0xaf1b5['model'],_0xaf1b5[_0xe5d2('0x3a')]);_0x4ecff8[_0xe5d2('0x3d')]=_[_0xe5d2('0x3c')](_0xaf1b5[_0xe5d2('0x39')],qs[_0xe5d2('0x3e')](_0x295a52[_0xe5d2('0x3a')][_0xe5d2('0x3e')]));_0x4ecff8[_0xe5d2('0x3d')]=_0x4ecff8[_0xe5d2('0x3d')][_0xe5d2('0x5d')]?_0x4ecff8[_0xe5d2('0x3d')]:_0xaf1b5['model'];if(!_0x295a52[_0xe5d2('0x3a')][_0xe5d2('0x3f')]('nolimit')){_0x4ecff8[_0xe5d2('0x22')]=qs[_0xe5d2('0x22')](_0x295a52[_0xe5d2('0x3a')][_0xe5d2('0x22')]);_0x4ecff8[_0xe5d2('0x20')]=qs[_0xe5d2('0x20')](_0x295a52[_0xe5d2('0x3a')]['offset']);}_0x4ecff8[_0xe5d2('0x41')]=qs['sort'](_0x295a52[_0xe5d2('0x3a')]['sort']);_0x4ecff8[_0xe5d2('0x43')]=qs[_0xe5d2('0x4d')](_['pick'](_0x295a52[_0xe5d2('0x3a')],_0xaf1b5[_0xe5d2('0x4d')]));_0x4ecff8[_0xe5d2('0x43')][_0xe5d2('0x5e')]=_0x393752['id'];if(_0x295a52[_0xe5d2('0x3a')]['filter']){_0x4ecff8[_0xe5d2('0x43')]=_[_0xe5d2('0x47')](_0x4ecff8[_0xe5d2('0x43')],{'$or':_[_0xe5d2('0x35')](_0x4ecff8[_0xe5d2('0x3d')],function(_0x52edf9){var _0x3b6dfb={};_0x3b6dfb[_0x52edf9]={'$like':'%'+_0x295a52['query'][_0xe5d2('0x44')]+'%'};return _0x3b6dfb;})});}_0x4ecff8=_[_0xe5d2('0x47')]({},_0x4ecff8,_0x295a52[_0xe5d2('0x48')]);return db['UserOpenchannelQueue'][_0xe5d2('0x5f')](_0x4ecff8);}})[_0xe5d2('0x2e')](function(_0x47bb78){if(_0x47bb78){return db['User'][_0xe5d2('0x60')]({'where':{'id':_[_0xe5d2('0x35')](_0x47bb78,_0xe5d2('0x61')),'role':_0xe5d2('0x62')},'attributes':['id',_0xe5d2('0x32'),'openchannelPause',_0xe5d2('0x63'),_0xe5d2('0x64')]});}})[_0xe5d2('0x2e')](function(_0x276dcc){if(_0x276dcc){return{'count':_0x276dcc[_0xe5d2('0x23')],'rows':_[_0xe5d2('0x35')](_0x276dcc[_0xe5d2('0x4b')],function(_0x3c0303){return{'membername':_0x3c0303[_0xe5d2('0x32')],'UserId':_0x3c0303['id'],'queue_name':_0x311af5['name'],'OpenchannelQueueId':_0x311af5['id'],'interface':util[_0xe5d2('0x65')](_0xe5d2('0x66'),_0xe5d2('0x67'),_0x3c0303[_0xe5d2('0x32')]),'penalty':0x0,'paused':_0x3c0303[_0xe5d2('0x68')],'createdAt':_0x3c0303['createdAt'],'updatedAt':_0x3c0303[_0xe5d2('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe5d2('0x2e')](respondWithFilteredResult(_0xc971cc,_0x4ecff8))[_0xe5d2('0x4c')](handleError(_0xc971cc,null));};exports['getTeams']=function(_0x1b9b45,_0x13eaf3,_0x150ce8){var _0xf8ec10={};var _0x2ca274={};var _0x3110b0;var _0x3e73ac;return db['OpenchannelQueue'][_0xe5d2('0x5a')]({'where':{'id':_0x1b9b45[_0xe5d2('0x57')]['id']}})[_0xe5d2('0x2e')](handleEntityNotFound(_0x13eaf3,null))[_0xe5d2('0x2e')](function(_0xb33f31){if(_0xb33f31){_0x3110b0=_0xb33f31;_0x2ca274['model']=_[_0xe5d2('0x3b')](db['Team'][_0xe5d2('0x5c')]);_0x2ca274[_0xe5d2('0x3a')]=_[_0xe5d2('0x3b')](_0x1b9b45['query']);_0x2ca274[_0xe5d2('0x4d')]=_['intersection'](_0x2ca274[_0xe5d2('0x39')],_0x2ca274[_0xe5d2('0x3a')]);_0xf8ec10['attributes']=_[_0xe5d2('0x3c')](_0x2ca274[_0xe5d2('0x39')],qs[_0xe5d2('0x3e')](_0x1b9b45['query'][_0xe5d2('0x3e')]));_0xf8ec10[_0xe5d2('0x3d')]=_0xf8ec10['attributes'][_0xe5d2('0x5d')]?_0xf8ec10[_0xe5d2('0x3d')]:_0x2ca274[_0xe5d2('0x39')];_0xf8ec10[_0xe5d2('0x41')]=qs[_0xe5d2('0x42')](_0x1b9b45['query']['sort']);_0xf8ec10['where']=qs[_0xe5d2('0x4d')](_['pick'](_0x1b9b45['query'],_0x2ca274[_0xe5d2('0x4d')]));if(_0x1b9b45['query'][_0xe5d2('0x44')]){_0xf8ec10[_0xe5d2('0x43')]=_['merge'](_0xf8ec10['where'],{'$or':_[_0xe5d2('0x35')](_0xf8ec10[_0xe5d2('0x3d')],function(_0x3b8c6e){var _0x28086d={};_0x28086d[_0x3b8c6e]={'$like':'%'+_0x1b9b45[_0xe5d2('0x3a')][_0xe5d2('0x44')]+'%'};return _0x28086d;})});}_0xf8ec10=_[_0xe5d2('0x47')]({},_0xf8ec10,_0x1b9b45[_0xe5d2('0x48')]);return _0x3110b0[_0xe5d2('0x69')](_0xf8ec10);}})['then'](function(_0x16fb61){if(_0x16fb61){_0x3e73ac=_0x16fb61['length'];if(!_0x1b9b45[_0xe5d2('0x3a')]['hasOwnProperty'](_0xe5d2('0x40'))){_0xf8ec10[_0xe5d2('0x22')]=qs['limit'](_0x1b9b45[_0xe5d2('0x3a')][_0xe5d2('0x22')]);_0xf8ec10[_0xe5d2('0x20')]=qs[_0xe5d2('0x20')](_0x1b9b45['query'][_0xe5d2('0x20')]);}return _0x3110b0[_0xe5d2('0x69')](_0xf8ec10);}})[_0xe5d2('0x2e')](function(_0x28edf5){if(_0x28edf5){return _0x28edf5?{'count':_0x3e73ac,'rows':_0x28edf5}:null;}})['then'](respondWithResult(_0x13eaf3,null))['catch'](handleError(_0x13eaf3,null));};exports['addTeams']=function(_0x26d81b,_0x178fec,_0x3591a0){var _0x328621=_0x26d81b[_0xe5d2('0x4f')]['ids'];return db['Team'][_0xe5d2('0x5f')]({'where':{'id':_0x328621},'attributes':['id'],'include':[{'model':db[_0xe5d2('0x6a')],'as':_0xe5d2('0x6b'),'attributes':['id',_0xe5d2('0x32'),_0xe5d2('0x6c'),_0xe5d2('0x6d'),_0xe5d2('0x6e')],'raw':!![]}]})[_0xe5d2('0x2e')](function(_0x2ee0d8){if(_0x2ee0d8){var _0x313c59=_[_0xe5d2('0x6f')](_0x2ee0d8,function(_0x67cc0f){var _0x49e6c3=_0x67cc0f[_0xe5d2('0x2b')]({'plain':!![]});return _0x49e6c3[_0xe5d2('0x6b')];});return db[_0xe5d2('0x36')]['find']({'where':{'id':_0x26d81b['params']['id']}})['then'](function(_0x4a0774){return db[_0xe5d2('0x70')][_0xe5d2('0x71')](function(_0x2094ae){return _0x4a0774['addTeams'](_0x328621,{'transaction':_0x2094ae})[_0xe5d2('0x2e')](function(){return BPromise[_0xe5d2('0x72')](_0x313c59,function(_0x7597ee){return db[_0xe5d2('0x5b')][_0xe5d2('0x73')]({'where':{'UserId':_0x7597ee['id'],'OpenchannelQueueId':_0x26d81b['params']['id']},'transaction':_0x2094ae});});})['then'](function(){_0x313c59[_0xe5d2('0x74')](function(_0x3a962f){socket[_0xe5d2('0x75')](_0xe5d2('0x76'),{'UserId':_0x3a962f['id'],'OpenchannelQueueId':_0x4a0774['id']});});});});});}})[_0xe5d2('0x2e')](respondWithStatusCode(_0x178fec,null))[_0xe5d2('0x4c')](handleError(_0x178fec,null));};exports[_0xe5d2('0x77')]=function(_0x45cdd7,_0x10042d,_0x431320){return db['Team'][_0xe5d2('0x5f')]({'where':{'id':_0x45cdd7[_0xe5d2('0x3a')][_0xe5d2('0x78')]},'attributes':['id'],'include':[{'model':db[_0xe5d2('0x6a')],'as':_0xe5d2('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x10042d,null))[_0xe5d2('0x2e')](function(_0x24bcd4){var _0x541684=_[_0xe5d2('0x35')](_0x24bcd4,'id');var _0x2cc6df=[];var _0x32438c=[];var _0x51ca45=squel[_0xe5d2('0x79')]();_0x51ca45['field'](_0xe5d2('0x7a'))['from'](_0xe5d2('0x7b'),'tq')[_0xe5d2('0x7c')]('user_has_teams','ut',_0xe5d2('0x7d'))[_0xe5d2('0x43')](_0xe5d2('0x7e'),_0x45cdd7[_0xe5d2('0x57')]['id']);for(var _0x4b7b48=0x0;_0x4b7b48<_0x24bcd4[_0xe5d2('0x5d')];_0x4b7b48+=0x1){let _0x10fdfa=_0x24bcd4[_0x4b7b48];for(var _0x460f6d=0x0;_0x460f6d<_0x10fdfa[_0xe5d2('0x6b')][_0xe5d2('0x5d')];_0x460f6d+=0x1){let _0x617bc8=_0x10fdfa[_0xe5d2('0x6b')][_0x460f6d];var _0x12d9ce=_0x51ca45[_0xe5d2('0x7f')]();_0x12d9ce['where'](_0xe5d2('0x80'),_0x617bc8['id']);_0x32438c['push'](db[_0xe5d2('0x70')]['query'](_0x12d9ce['toString'](),{'type':db['sequelize'][_0xe5d2('0x81')][_0xe5d2('0x82')]})[_0xe5d2('0x2e')](function(_0x486e25){if(_0x486e25[_0xe5d2('0x5d')]===0x1){return _0x617bc8['id'];}else{var _0x4cf5cf=_[_0xe5d2('0x83')](_[_0xe5d2('0x35')](_0x486e25,_0xe5d2('0x84')),function(_0x3e3455){return _[_0xe5d2('0x85')](_0x541684,_0x3e3455);});if(_0x4cf5cf){return _0x617bc8['id'];}}}));}}return BPromise[_0xe5d2('0x86')](_0x32438c)[_0xe5d2('0x2e')](function(_0x4b3b18){_0x2cc6df=_(_0x2cc6df)[_0xe5d2('0x87')](_0x4b3b18)[_0xe5d2('0x88')]()[_0xe5d2('0x89')]();return db[_0xe5d2('0x36')][_0xe5d2('0x56')]({'where':{'id':_0x45cdd7[_0xe5d2('0x57')]['id']}})['then'](function(_0x2bcff9){return db[_0xe5d2('0x70')][_0xe5d2('0x71')](function(_0x456fa0){return _0x2bcff9[_0xe5d2('0x77')](_0x45cdd7['query'][_0xe5d2('0x78')],{'transaction':_0x456fa0})[_0xe5d2('0x2e')](function(){if(!_[_0xe5d2('0x8a')](_0x2cc6df)){return _0x2bcff9['removeAgents'](_0x2cc6df,{'transaction':_0x456fa0});}})['then'](function(){_0x2cc6df[_0xe5d2('0x74')](function(_0x232ef2){socket[_0xe5d2('0x75')](_0xe5d2('0x8b'),{'UserId':_0x232ef2,'OpenchannelQueueId':_0x2bcff9['id']});});});});});});})['then'](respondWithStatusCode(_0x10042d,null))[_0xe5d2('0x4c')](handleError(_0x10042d,null));};exports['addAgents']=function(_0x4693bc,_0x4b8966,_0x466d24){return db['OpenchannelQueue'][_0xe5d2('0x56')]({'where':{'id':_0x4693bc['params']['id']}})[_0xe5d2('0x2e')](handleEntityNotFound(_0x4b8966,null))['then'](function(_0x48c954){if(_0x48c954){return _0x48c954['addAgents'](_0x4693bc[_0xe5d2('0x4f')][_0xe5d2('0x78')],_[_0xe5d2('0x8c')](_0x4693bc[_0xe5d2('0x4f')],[_0xe5d2('0x78'),'id'])||{})['spread'](function(_0x4d20f1){for(var _0x1f5660=0x0;_0x1f5660<_0x4693bc[_0xe5d2('0x4f')][_0xe5d2('0x78')]['length'];_0x1f5660+=0x1){socket[_0xe5d2('0x75')](_0xe5d2('0x76'),{'UserId':Number(_0x4693bc[_0xe5d2('0x4f')][_0xe5d2('0x78')][_0x1f5660]),'OpenchannelQueueId':Number(_0x4693bc[_0xe5d2('0x57')]['id'])});}return _0x4d20f1;});}})['then'](respondWithResult(_0x4b8966,null))[_0xe5d2('0x4c')](handleError(_0x4b8966,null));};exports[_0xe5d2('0x8d')]=function(_0x59b2f2,_0x24dc9d,_0x1cc149){return db[_0xe5d2('0x36')][_0xe5d2('0x56')]({'where':{'id':_0x59b2f2[_0xe5d2('0x57')]['id']}})[_0xe5d2('0x2e')](handleEntityNotFound(_0x24dc9d,null))[_0xe5d2('0x2e')](function(_0x31c041){if(_0x31c041){return _0x31c041[_0xe5d2('0x8d')](_0x59b2f2[_0xe5d2('0x3a')][_0xe5d2('0x78')])[_0xe5d2('0x2e')](function(){if(_[_0xe5d2('0x8e')](_0x59b2f2[_0xe5d2('0x3a')][_0xe5d2('0x78')])){for(var _0x384a77=0x0;_0x384a77<_0x59b2f2[_0xe5d2('0x3a')][_0xe5d2('0x78')][_0xe5d2('0x5d')];_0x384a77+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x59b2f2[_0xe5d2('0x3a')][_0xe5d2('0x78')][_0x384a77]),'OpenchannelQueueId':Number(_0x59b2f2[_0xe5d2('0x57')]['id'])});}}else{socket['emit'](_0xe5d2('0x8b'),{'UserId':Number(_0x59b2f2['query']['ids']),'OpenchannelQueueId':Number(_0x59b2f2[_0xe5d2('0x57')]['id'])});}});}})[_0xe5d2('0x2e')](respondWithStatusCode(_0x24dc9d,null))['catch'](handleError(_0x24dc9d,null));};exports[_0xe5d2('0x8f')]=function(_0x588e51,_0x42030b,_0x44d1a2){var _0x270cfc={};var _0x29988e={};var _0x5e22d1;var _0x397f9d;return db[_0xe5d2('0x36')][_0xe5d2('0x5a')]({'where':{'id':_0x588e51[_0xe5d2('0x57')]['id']}})['then'](handleEntityNotFound(_0x42030b,null))[_0xe5d2('0x2e')](function(_0x349772){if(_0x349772){_0x5e22d1=_0x349772;_0x29988e['model']=_['keys'](db[_0xe5d2('0x6a')]['rawAttributes']);_0x29988e[_0xe5d2('0x3a')]=_[_0xe5d2('0x3b')](_0x588e51['query']);_0x29988e[_0xe5d2('0x4d')]=_[_0xe5d2('0x3c')](_0x29988e[_0xe5d2('0x39')],_0x29988e['query']);_0x270cfc['attributes']=_[_0xe5d2('0x3c')](_0x29988e[_0xe5d2('0x39')],qs[_0xe5d2('0x3e')](_0x588e51[_0xe5d2('0x3a')][_0xe5d2('0x3e')]));_0x270cfc[_0xe5d2('0x3d')]=_0x270cfc[_0xe5d2('0x3d')]['length']?_0x270cfc[_0xe5d2('0x3d')]:_0x29988e[_0xe5d2('0x39')];_0x270cfc[_0xe5d2('0x41')]=qs[_0xe5d2('0x42')](_0x588e51[_0xe5d2('0x3a')]['sort']);_0x270cfc[_0xe5d2('0x43')]=qs[_0xe5d2('0x4d')](_['pick'](_0x588e51[_0xe5d2('0x3a')],_0x29988e[_0xe5d2('0x4d')]));if(_0x588e51[_0xe5d2('0x3a')]['filter']){_0x270cfc['where']=_['merge'](_0x270cfc[_0xe5d2('0x43')],{'$or':_[_0xe5d2('0x35')](_0x270cfc['attributes'],function(_0x2a5b7b){var _0x146d50={};_0x146d50[_0x2a5b7b]={'$like':'%'+_0x588e51[_0xe5d2('0x3a')][_0xe5d2('0x44')]+'%'};return _0x146d50;})});}_0x270cfc=_[_0xe5d2('0x47')]({},_0x270cfc,_0x588e51[_0xe5d2('0x48')]);return _0x5e22d1[_0xe5d2('0x8f')](_0x270cfc);}})['then'](function(_0x51c219){if(_0x51c219){_0x397f9d=_0x51c219['length'];if(!_0x588e51[_0xe5d2('0x3a')]['hasOwnProperty'](_0xe5d2('0x40'))){_0x270cfc[_0xe5d2('0x22')]=qs['limit'](_0x588e51['query']['limit']);_0x270cfc['offset']=qs[_0xe5d2('0x20')](_0x588e51['query'][_0xe5d2('0x20')]);}return _0x5e22d1[_0xe5d2('0x8f')](_0x270cfc);}})[_0xe5d2('0x2e')](function(_0xb0181c){if(_0xb0181c){return _0xb0181c?{'count':_0x397f9d,'rows':_0xb0181c}:null;}})[_0xe5d2('0x2e')](respondWithResult(_0x42030b,null))[_0xe5d2('0x4c')](handleError(_0x42030b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index f2f35fc..4e6ea7f 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 _0x621f=['save','update','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelQueue','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x621f,0xed));var _0xf621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x621f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xf621('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xf621('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xf621('0x2')](0x0);var events={'afterCreate':_0xf621('0x3'),'afterUpdate':_0xf621('0x4'),'afterDestroy':_0xf621('0x5')};function emitEvent(_0x48ec83){return function(_0x4cc792,_0x48a1e1,_0x371494){OpenchannelQueueEvents[_0xf621('0x6')](_0x48ec83+':'+_0x4cc792['id'],_0x4cc792);OpenchannelQueueEvents[_0xf621('0x6')](_0x48ec83,_0x4cc792);_0x371494(null);};}for(var e in events){if(events[_0xf621('0x7')](e)){var event=events[e];OpenchannelQueue[_0xf621('0x8')](e,emitEvent(event));}}module[_0xf621('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x535b=['exports','../../mysqldb','OpenchannelQueue','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5a4f8e,_0x50104d){var _0xf15181=function(_0x4d8a10){while(--_0x4d8a10){_0x5a4f8e['push'](_0x5a4f8e['shift']());}};_0xf15181(++_0x50104d);}(_0x535b,0xd0));var _0xb535=function(_0x3d3d8d,_0x5c3ec6){_0x3d3d8d=_0x3d3d8d-0x0;var _0x1b69c1=_0x535b[_0x3d3d8d];return _0x1b69c1;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xb535('0x0'))['db'][_0xb535('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb535('0x2'),'afterUpdate':_0xb535('0x3'),'afterDestroy':_0xb535('0x4')};function emitEvent(_0x4c29d2){return function(_0x35b6ca,_0x4768e2,_0xb63a8){OpenchannelQueueEvents[_0xb535('0x5')](_0x4c29d2+':'+_0x35b6ca['id'],_0x35b6ca);OpenchannelQueueEvents[_0xb535('0x5')](_0x4c29d2,_0x35b6ca);_0xb63a8(null);};}for(var e in events){if(events[_0xb535('0x6')](e)){var event=events[e];OpenchannelQueue[_0xb535('0x7')](e,emitEvent(event));}}module[_0xb535('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 843e205..665608d 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 _0x1db2=['path','rimraf','../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','../../config/logger','moment','bluebird','request-promise'];(function(_0x5a7cd0,_0x24a81d){var _0x4ab236=function(_0x29c69e){while(--_0x29c69e){_0x5a7cd0['push'](_0x5a7cd0['shift']());}};_0x4ab236(++_0x24a81d);}(_0x1db2,0x6a));var _0x21db=function(_0x35ec08,_0x2461c7){_0x35ec08=_0x35ec08-0x0;var _0x51310d=_0x1db2[_0x35ec08];return _0x51310d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x21db('0x0'))('api');var moment=require(_0x21db('0x1'));var BPromise=require(_0x21db('0x2'));var rp=require(_0x21db('0x3'));var fs=require('fs');var path=require(_0x21db('0x4'));var rimraf=require(_0x21db('0x5'));var config=require(_0x21db('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0x21db('0x7')]=function(_0x326582,_0x4375ed){return _0x326582[_0x21db('0x8')](_0x21db('0x9'),attributes,{'tableName':_0x21db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd430=['OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x5479e7,_0x4fbffa){var _0x2ccff5=function(_0x49dfd1){while(--_0x49dfd1){_0x5479e7['push'](_0x5479e7['shift']());}};_0x2ccff5(++_0x4fbffa);}(_0xd430,0xd3));var _0x0d43=function(_0x7abd7,_0x1ca3f9){_0x7abd7=_0x7abd7-0x0;var _0x3a2577=_0xd430[_0x7abd7];return _0x3a2577;};'use strict';var _=require(_0x0d43('0x0'));var util=require('util');var logger=require(_0x0d43('0x1'))(_0x0d43('0x2'));var moment=require(_0x0d43('0x3'));var BPromise=require(_0x0d43('0x4'));var rp=require(_0x0d43('0x5'));var fs=require('fs');var path=require(_0x0d43('0x6'));var rimraf=require('rimraf');var config=require(_0x0d43('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x0d43('0x8')]=function(_0x2e9169,_0x4b0875){return _0x2e9169['define'](_0x0d43('0x9'),attributes,{'tableName':_0x0d43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 42f2be3..35837a9 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 _0xed29=['findAll','options','where','limit','include','attributes','map','debug','stringify','ShowOpenchannelQueue','find','raw','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','redis','localhost','register','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue'];(function(_0x1251a7,_0x3a990e){var _0x1ea38c=function(_0x59235d){while(--_0x59235d){_0x1251a7['push'](_0x1251a7['shift']());}};_0x1ea38c(++_0x3a990e);}(_0xed29,0xc1));var _0x9ed2=function(_0x257a0,_0x42d2b4){_0x257a0=_0x257a0-0x0;var _0x8a44ed=_0xed29[_0x257a0];return _0x8a44ed;};'use strict';var _=require(_0x9ed2('0x0'));var util=require('util');var moment=require(_0x9ed2('0x1'));var BPromise=require(_0x9ed2('0x2'));var rs=require(_0x9ed2('0x3'));var fs=require('fs');var Redis=require(_0x9ed2('0x4'));var db=require(_0x9ed2('0x5'))['db'];var utils=require(_0x9ed2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9ed2('0x7')][_0x9ed2('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9ed2('0x9')],{'host':_0x9ed2('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x9ed2('0xb')](socket);function respondWithRpcPromise(_0xb3ba4f,_0x4ad5a3,_0x53a304){return new BPromise(function(_0x3198ad,_0x3ba29a){return client['request'](_0xb3ba4f,_0x53a304)[_0x9ed2('0xc')](function(_0x4ecc81){logger['info'](_0x9ed2('0xd'),_0x4ad5a3,_0x9ed2('0xe'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4ad5a3,_0x9ed2('0xe'),JSON['stringify'](_0x4ecc81));if(_0x4ecc81[_0x9ed2('0xf')]){if(_0x4ecc81[_0x9ed2('0xf')][_0x9ed2('0x10')]===0x1f4){logger[_0x9ed2('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x4ad5a3,_0x4ecc81['error'][_0x9ed2('0x11')]);return _0x3ba29a(_0x4ecc81[_0x9ed2('0xf')]['message']);}logger['error'](_0x9ed2('0xd'),_0x4ad5a3,_0x4ecc81[_0x9ed2('0xf')][_0x9ed2('0x11')]);return _0x3198ad(_0x4ecc81['error'][_0x9ed2('0x11')]);}else{logger[_0x9ed2('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x4ad5a3,_0x9ed2('0xe'));_0x3198ad(_0x4ecc81[_0x9ed2('0x13')]['message']);}})[_0x9ed2('0x14')](function(_0x1b7d9f){logger['error'](_0x9ed2('0xd'),_0x4ad5a3,_0x1b7d9f);_0x3ba29a(_0x1b7d9f);});});}exports[_0x9ed2('0x15')]=function(_0x3aa45c){var _0x10fc68=this;return new Promise(function(_0x3a842a,_0xc7582d){return db[_0x9ed2('0x16')][_0x9ed2('0x17')]({'raw':_0x3aa45c[_0x9ed2('0x18')]?_0x3aa45c[_0x9ed2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3aa45c[_0x9ed2('0x18')]?_0x3aa45c[_0x9ed2('0x18')][_0x9ed2('0x19')]||null:null,'attributes':_0x3aa45c[_0x9ed2('0x18')]?_0x3aa45c[_0x9ed2('0x18')]['attributes']||null:null,'limit':_0x3aa45c['options']?_0x3aa45c[_0x9ed2('0x18')][_0x9ed2('0x1a')]||null:null,'include':_0x3aa45c[_0x9ed2('0x18')]?_0x3aa45c['options'][_0x9ed2('0x1b')]?_['map'](_0x3aa45c[_0x9ed2('0x18')][_0x9ed2('0x1b')],function(_0x5b0a3b){return{'model':db[_0x5b0a3b['model']],'as':_0x5b0a3b['as'],'attributes':_0x5b0a3b[_0x9ed2('0x1c')],'include':_0x5b0a3b[_0x9ed2('0x1b')]?_['map'](_0x5b0a3b[_0x9ed2('0x1b')],function(_0x42fb4c){return{'model':db[_0x42fb4c['model']],'as':_0x42fb4c['as'],'attributes':_0x42fb4c[_0x9ed2('0x1c')],'include':_0x42fb4c[_0x9ed2('0x1b')]?_[_0x9ed2('0x1d')](_0x42fb4c['include'],function(_0x1205ff){return{'model':db[_0x1205ff['model']],'as':_0x1205ff['as'],'attributes':_0x1205ff[_0x9ed2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9ed2('0xc')](function(_0x85aadd){logger[_0x9ed2('0x12')](_0x9ed2('0x15'),_0x3aa45c);logger[_0x9ed2('0x1e')](_0x9ed2('0x15'),_0x3aa45c,JSON[_0x9ed2('0x1f')](_0x85aadd));_0x3a842a(_0x85aadd);})[_0x9ed2('0x14')](function(_0xef00f4){logger[_0x9ed2('0xf')](_0x9ed2('0x15'),_0xef00f4[_0x9ed2('0x11')],_0x3aa45c);_0xc7582d(_0x10fc68[_0x9ed2('0xf')](0x1f4,_0xef00f4[_0x9ed2('0x11')]));});});};exports[_0x9ed2('0x20')]=function(_0x48569f){var _0x13a5e2=this;return new Promise(function(_0x44b637,_0x3a3061){return db['OpenchannelQueue'][_0x9ed2('0x21')]({'raw':_0x48569f[_0x9ed2('0x18')]?_0x48569f[_0x9ed2('0x18')][_0x9ed2('0x22')]===undefined?!![]:![]:!![],'where':_0x48569f[_0x9ed2('0x18')]?_0x48569f[_0x9ed2('0x18')][_0x9ed2('0x19')]||null:null,'attributes':_0x48569f['options']?_0x48569f[_0x9ed2('0x18')][_0x9ed2('0x1c')]||null:null,'include':_0x48569f[_0x9ed2('0x18')]?_0x48569f[_0x9ed2('0x18')][_0x9ed2('0x1b')]?_[_0x9ed2('0x1d')](_0x48569f['options']['include'],function(_0x59ba62){return{'model':db[_0x59ba62[_0x9ed2('0x23')]],'as':_0x59ba62['as'],'attributes':_0x59ba62['attributes'],'include':_0x59ba62[_0x9ed2('0x1b')]?_[_0x9ed2('0x1d')](_0x59ba62[_0x9ed2('0x1b')],function(_0x3db250){return{'model':db[_0x3db250[_0x9ed2('0x23')]],'as':_0x3db250['as'],'attributes':_0x3db250[_0x9ed2('0x1c')],'include':_0x3db250['include']?_[_0x9ed2('0x1d')](_0x3db250[_0x9ed2('0x1b')],function(_0x1e9043){return{'model':db[_0x1e9043[_0x9ed2('0x23')]],'as':_0x1e9043['as'],'attributes':_0x1e9043[_0x9ed2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a0bc6){logger[_0x9ed2('0x12')]('ShowOpenchannelQueue',_0x48569f);logger[_0x9ed2('0x1e')]('ShowOpenchannelQueue',_0x48569f,JSON[_0x9ed2('0x1f')](_0x4a0bc6));_0x44b637(_0x4a0bc6);})[_0x9ed2('0x14')](function(_0x20e4d4){logger[_0x9ed2('0xf')](_0x9ed2('0x20'),_0x20e4d4['message'],_0x48569f);_0x3a3061(_0x13a5e2[_0x9ed2('0xf')](0x1f4,_0x20e4d4[_0x9ed2('0x11')]));});});}; \ No newline at end of file +var _0x1a2c=['OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','GetOpenchannelQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a2c,0x10e));var _0xc1a2=function(_0x5001a4,_0x40c316){_0x5001a4=_0x5001a4-0x0;var _0x58aa97=_0x1a2c[_0x5001a4];return _0x58aa97;};'use strict';var _=require(_0xc1a2('0x0'));var util=require('util');var moment=require(_0xc1a2('0x1'));var BPromise=require(_0xc1a2('0x2'));var rs=require(_0xc1a2('0x3'));var fs=require('fs');var Redis=require(_0xc1a2('0x4'));var db=require(_0xc1a2('0x5'))['db'];var utils=require(_0xc1a2('0x6'));var logger=require(_0xc1a2('0x7'))(_0xc1a2('0x8'));var config=require(_0xc1a2('0x9'));var jayson=require(_0xc1a2('0xa'));var client=jayson[_0xc1a2('0xb')][_0xc1a2('0xc')]({'port':0x232a});config[_0xc1a2('0xd')]=_[_0xc1a2('0xe')](config[_0xc1a2('0xd')],{'host':_0xc1a2('0xf'),'port':0x18eb});var socket=require(_0xc1a2('0x10'))(new Redis(config['redis']));require(_0xc1a2('0x11'))[_0xc1a2('0x12')](socket);function respondWithRpcPromise(_0x17e3db,_0xcfea71,_0xb4aa12){return new BPromise(function(_0x104473,_0x57a2fc){return client['request'](_0x17e3db,_0xb4aa12)[_0xc1a2('0x13')](function(_0x4f71dc){logger[_0xc1a2('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0xcfea71,_0xc1a2('0x15'));logger[_0xc1a2('0x16')](_0xc1a2('0x17'),_0xcfea71,'request\x20sent',JSON[_0xc1a2('0x18')](_0x4f71dc));if(_0x4f71dc[_0xc1a2('0x19')]){if(_0x4f71dc[_0xc1a2('0x19')][_0xc1a2('0x1a')]===0x1f4){logger[_0xc1a2('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0xcfea71,_0x4f71dc[_0xc1a2('0x19')][_0xc1a2('0x1b')]);return _0x57a2fc(_0x4f71dc[_0xc1a2('0x19')][_0xc1a2('0x1b')]);}logger['error'](_0xc1a2('0x1c'),_0xcfea71,_0x4f71dc['error'][_0xc1a2('0x1b')]);return _0x104473(_0x4f71dc[_0xc1a2('0x19')][_0xc1a2('0x1b')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0xcfea71,'request\x20sent');_0x104473(_0x4f71dc[_0xc1a2('0x1d')][_0xc1a2('0x1b')]);}})['catch'](function(_0xeadf86){logger['error'](_0xc1a2('0x1c'),_0xcfea71,_0xeadf86);_0x57a2fc(_0xeadf86);});});}exports[_0xc1a2('0x1e')]=function(_0x5093fc){var _0x349d76=this;return new Promise(function(_0x4f7952,_0x580e08){return db[_0xc1a2('0x1f')][_0xc1a2('0x20')]({'raw':_0x5093fc[_0xc1a2('0x21')]?_0x5093fc[_0xc1a2('0x21')][_0xc1a2('0x22')]===undefined?!![]:![]:!![],'where':_0x5093fc[_0xc1a2('0x21')]?_0x5093fc[_0xc1a2('0x21')][_0xc1a2('0x23')]||null:null,'attributes':_0x5093fc['options']?_0x5093fc[_0xc1a2('0x21')][_0xc1a2('0x24')]||null:null,'limit':_0x5093fc[_0xc1a2('0x21')]?_0x5093fc[_0xc1a2('0x21')][_0xc1a2('0x25')]||null:null,'include':_0x5093fc['options']?_0x5093fc[_0xc1a2('0x21')][_0xc1a2('0x26')]?_[_0xc1a2('0x27')](_0x5093fc[_0xc1a2('0x21')][_0xc1a2('0x26')],function(_0x5d6d25){return{'model':db[_0x5d6d25[_0xc1a2('0x28')]],'as':_0x5d6d25['as'],'attributes':_0x5d6d25[_0xc1a2('0x24')],'include':_0x5d6d25[_0xc1a2('0x26')]?_[_0xc1a2('0x27')](_0x5d6d25[_0xc1a2('0x26')],function(_0x2129f4){return{'model':db[_0x2129f4[_0xc1a2('0x28')]],'as':_0x2129f4['as'],'attributes':_0x2129f4['attributes'],'include':_0x2129f4['include']?_[_0xc1a2('0x27')](_0x2129f4[_0xc1a2('0x26')],function(_0x1ad689){return{'model':db[_0x1ad689['model']],'as':_0x1ad689['as'],'attributes':_0x1ad689[_0xc1a2('0x24')]};}):[]};}):[]};}):[]:[]})[_0xc1a2('0x13')](function(_0x4e1c43){logger['info'](_0xc1a2('0x1e'),_0x5093fc);logger[_0xc1a2('0x16')](_0xc1a2('0x1e'),_0x5093fc,JSON[_0xc1a2('0x18')](_0x4e1c43));_0x4f7952(_0x4e1c43);})['catch'](function(_0x5a0f43){logger[_0xc1a2('0x19')]('GetOpenchannelQueue',_0x5a0f43[_0xc1a2('0x1b')],_0x5093fc);_0x580e08(_0x349d76[_0xc1a2('0x19')](0x1f4,_0x5a0f43[_0xc1a2('0x1b')]));});});};exports[_0xc1a2('0x29')]=function(_0xfdd01e){var _0x494b19=this;return new Promise(function(_0x44900b,_0x20386d){return db[_0xc1a2('0x1f')][_0xc1a2('0x2a')]({'raw':_0xfdd01e['options']?_0xfdd01e[_0xc1a2('0x21')][_0xc1a2('0x22')]===undefined?!![]:![]:!![],'where':_0xfdd01e[_0xc1a2('0x21')]?_0xfdd01e[_0xc1a2('0x21')][_0xc1a2('0x23')]||null:null,'attributes':_0xfdd01e['options']?_0xfdd01e[_0xc1a2('0x21')][_0xc1a2('0x24')]||null:null,'include':_0xfdd01e[_0xc1a2('0x21')]?_0xfdd01e[_0xc1a2('0x21')][_0xc1a2('0x26')]?_[_0xc1a2('0x27')](_0xfdd01e[_0xc1a2('0x21')][_0xc1a2('0x26')],function(_0x309559){return{'model':db[_0x309559[_0xc1a2('0x28')]],'as':_0x309559['as'],'attributes':_0x309559['attributes'],'include':_0x309559[_0xc1a2('0x26')]?_[_0xc1a2('0x27')](_0x309559[_0xc1a2('0x26')],function(_0x3b7e9c){return{'model':db[_0x3b7e9c[_0xc1a2('0x28')]],'as':_0x3b7e9c['as'],'attributes':_0x3b7e9c[_0xc1a2('0x24')],'include':_0x3b7e9c[_0xc1a2('0x26')]?_[_0xc1a2('0x27')](_0x3b7e9c[_0xc1a2('0x26')],function(_0x16b063){return{'model':db[_0x16b063[_0xc1a2('0x28')]],'as':_0x16b063['as'],'attributes':_0x16b063[_0xc1a2('0x24')]};}):[]};}):[]};}):[]:[]})[_0xc1a2('0x13')](function(_0x463345){logger[_0xc1a2('0x14')](_0xc1a2('0x29'),_0xfdd01e);logger['debug']('ShowOpenchannelQueue',_0xfdd01e,JSON['stringify'](_0x463345));_0x44900b(_0x463345);})['catch'](function(_0xd26167){logger[_0xc1a2('0x19')](_0xc1a2('0x29'),_0xd26167[_0xc1a2('0x1b')],_0xfdd01e);_0x20386d(_0x494b19['error'](0x1f4,_0xd26167[_0xc1a2('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index a669284..23d72ad 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 _0x8a48=['update','removeListener','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x3ddda7,_0x39eaf3){var _0x38f5b4=function(_0x49be31){while(--_0x49be31){_0x3ddda7['push'](_0x3ddda7['shift']());}};_0x38f5b4(++_0x39eaf3);}(_0x8a48,0xeb));var _0x88a4=function(_0x5d8e34,_0x4c8d47){_0x5d8e34=_0x5d8e34-0x0;var _0x1dfc15=_0x8a48[_0x5d8e34];return _0x1dfc15;};'use strict';var OpenchannelQueueEvents=require(_0x88a4('0x0'));var events=[_0x88a4('0x1'),_0x88a4('0x2'),_0x88a4('0x3')];function createListener(_0x188229,_0x23f187){return function(_0x361247){_0x23f187['emit'](_0x188229,_0x361247);};}function removeListener(_0x220751,_0x346fe3){return function(){OpenchannelQueueEvents[_0x88a4('0x4')](_0x220751,_0x346fe3);};}exports['register']=function(_0x43cc51){for(var _0x117b94=0x0,_0x47b5c2=events[_0x88a4('0x5')];_0x117b94<_0x47b5c2;_0x117b94++){var _0x125fdb=events[_0x117b94];var _0x5318dd=createListener(_0x88a4('0x6')+_0x125fdb,_0x43cc51);OpenchannelQueueEvents['on'](_0x125fdb,_0x5318dd);}}; \ No newline at end of file +var _0x707c=['length','openchannelQueue:','save','remove','update','emit','removeListener'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x707c,0x6b));var _0xc707=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x707c[_0x9df060];return _0x338dfe;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xc707('0x0'),_0xc707('0x1'),_0xc707('0x2')];function createListener(_0x1e3ca2,_0x2b3d83){return function(_0x25b63b){_0x2b3d83[_0xc707('0x3')](_0x1e3ca2,_0x25b63b);};}function removeListener(_0x5bc6b,_0x119d4e){return function(){OpenchannelQueueEvents[_0xc707('0x4')](_0x5bc6b,_0x119d4e);};}exports['register']=function(_0x4f8a1e){for(var _0x1259c5=0x0,_0x5602d7=events[_0xc707('0x5')];_0x1259c5<_0x5602d7;_0x1259c5++){var _0x155c1e=events[_0x1259c5];var _0x45b824=createListener(_0xc707('0x6')+_0x155c1e,_0x4f8a1e);OpenchannelQueueEvents['on'](_0x155c1e,_0x45b824);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index e61d71c..e39fb50 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 _0x87c8=['/describe','/:id','show','create','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','./openchannelQueueReport.controller','get','isAuthenticated','index'];(function(_0x290de6,_0x110fc3){var _0x2f6624=function(_0xf5c137){while(--_0xf5c137){_0x290de6['push'](_0x290de6['shift']());}};_0x2f6624(++_0x110fc3);}(_0x87c8,0x196));var _0x887c=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x87c8[_0x54d4a8];return _0x3b321b;};'use strict';var multer=require(_0x887c('0x0'));var util=require(_0x887c('0x1'));var path=require(_0x887c('0x2'));var timeout=require('connect-timeout');var express=require(_0x887c('0x3'));var router=express['Router']();var fs_extra=require(_0x887c('0x4'));var auth=require(_0x887c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x887c('0x6'));router[_0x887c('0x7')]('/',auth[_0x887c('0x8')](),controller[_0x887c('0x9')]);router[_0x887c('0x7')](_0x887c('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x887c('0xb'),auth[_0x887c('0x8')](),controller[_0x887c('0xc')]);router['post']('/',auth[_0x887c('0x8')](),controller[_0x887c('0xd')]);router['put'](_0x887c('0xb'),auth[_0x887c('0x8')](),controller['update']);router[_0x887c('0xe')](_0x887c('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x887c('0xf')]=router; \ No newline at end of file +var _0xcbcc=['destroy','exports','multer','util','path','connect-timeout','express','get','/describe','isAuthenticated','describe','/:id','post','create','put','delete'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0xcbcc,0x152));var _0xccbc=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xcbcc[_0x39096d];return _0x13da4f;};'use strict';var multer=require(_0xccbc('0x0'));var util=require(_0xccbc('0x1'));var path=require(_0xccbc('0x2'));var timeout=require(_0xccbc('0x3'));var express=require(_0xccbc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xccbc('0x5')](_0xccbc('0x6'),auth[_0xccbc('0x7')](),controller[_0xccbc('0x8')]);router[_0xccbc('0x5')](_0xccbc('0x9'),auth[_0xccbc('0x7')](),controller['show']);router[_0xccbc('0xa')]('/',auth[_0xccbc('0x7')](),controller[_0xccbc('0xb')]);router[_0xccbc('0xc')]('/:id',auth[_0xccbc('0x7')](),controller['update']);router[_0xccbc('0xd')](_0xccbc('0x9'),auth['isAuthenticated'](),controller[_0xccbc('0xe')]);module[_0xccbc('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 16d5d36..db18a23 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 _0xc99e=['moment','sequelize','STRING','DATE'];(function(_0x5ef6a2,_0x19c424){var _0x4aa800=function(_0x494a5d){while(--_0x494a5d){_0x5ef6a2['push'](_0x5ef6a2['shift']());}};_0x4aa800(++_0x19c424);}(_0xc99e,0x1d8));var _0xec99=function(_0xcfd59b,_0x59b11a){_0xcfd59b=_0xcfd59b-0x0;var _0x330e81=_0xc99e[_0xcfd59b];return _0x330e81;};'use strict';var moment=require(_0xec99('0x0'));var Sequelize=require(_0xec99('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xec99('0x2')]},'joinAt':{'type':Sequelize[_0xec99('0x3')]},'leaveAt':{'type':Sequelize[_0xec99('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xec99('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf24b=['exports','STRING','DATE','moment','sequelize'];(function(_0x19f305,_0x3b0a60){var _0x5cab59=function(_0x400d49){while(--_0x400d49){_0x19f305['push'](_0x19f305['shift']());}};_0x5cab59(++_0x3b0a60);}(_0xf24b,0x8a));var _0xbf24=function(_0x644560,_0x1783aa){_0x644560=_0x644560-0x0;var _0x41b76b=_0xf24b[_0x644560];return _0x41b76b;};'use strict';var moment=require(_0xbf24('0x0'));var Sequelize=require(_0xbf24('0x1'));module[_0xbf24('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xbf24('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xbf24('0x4')]},'acceptAt':{'type':Sequelize[_0xbf24('0x4')]},'exitAt':{'type':Sequelize[_0xbf24('0x4')]},'reason':{'type':Sequelize[_0xbf24('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 04b06b3..467543c 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 _0x8ce2=['findAll','params','rawAttributes','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','OpenchannelQueueReport','fieldName','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','map','type','VIRTUAL','options','includeAll','include'];(function(_0x15a729,_0x5aa380){var _0x3bb94d=function(_0x3df862){while(--_0x3df862){_0x15a729['push'](_0x15a729['shift']());}};_0x3bb94d(++_0x5aa380);}(_0x8ce2,0x15c));var _0x28ce=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x8ce2[_0x481bf7];return _0x461787;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28ce('0x0'));var zipdir=require(_0x28ce('0x1'));var jsonpatch=require(_0x28ce('0x2'));var rp=require(_0x28ce('0x3'));var moment=require(_0x28ce('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x28ce('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x28ce('0x6'));var _=require(_0x28ce('0x7'));var squel=require(_0x28ce('0x8'));var crypto=require(_0x28ce('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x28ce('0xa'));var toCsv=require(_0x28ce('0xb'));var querystring=require(_0x28ce('0xc'));var Papa=require(_0x28ce('0xd'));var Redis=require(_0x28ce('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x28ce('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28ce('0x10'));var logger=require(_0x28ce('0x11'))(_0x28ce('0x12'));var utils=require(_0x28ce('0x13'));var config=require(_0x28ce('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x28ce('0x15'))['db'];function respondWithStatusCode(_0x2ab15d,_0x3ecf1b){_0x3ecf1b=_0x3ecf1b||0xcc;return function(_0x3c9236){if(_0x3c9236){return _0x2ab15d['sendStatus'](_0x3ecf1b);}return _0x2ab15d[_0x28ce('0x16')](_0x3ecf1b)[_0x28ce('0x17')]();};}function respondWithResult(_0x5855f4,_0x5d63b0){_0x5d63b0=_0x5d63b0||0xc8;return function(_0x16c4fb){if(_0x16c4fb){return _0x5855f4[_0x28ce('0x16')](_0x5d63b0)['json'](_0x16c4fb);}};}function respondWithFilteredResult(_0x22fbb8,_0x468623){return function(_0xe0d158){if(_0xe0d158){var _0x54f637=typeof _0x468623['offset']==='undefined'&&typeof _0x468623['limit']===_0x28ce('0x18');var _0x5085fe=_0xe0d158[_0x28ce('0x19')];var _0x5b0418=_0x54f637?0x0:_0x468623[_0x28ce('0x1a')];var _0x2fe9ce=_0x54f637?_0xe0d158[_0x28ce('0x19')]:_0x468623['offset']+_0x468623[_0x28ce('0x1b')];var _0x5ea370;if(_0x2fe9ce>=_0x5085fe){_0x2fe9ce=_0x5085fe;_0x5ea370=0xc8;}else{_0x5ea370=0xce;}_0x22fbb8[_0x28ce('0x16')](_0x5ea370);return _0x22fbb8['set'](_0x28ce('0x1c'),_0x5b0418+'-'+_0x2fe9ce+'/'+_0x5085fe)['json'](_0xe0d158);}return null;};}function patchUpdates(_0x2f3842){return function(_0x2fda78){try{jsonpatch[_0x28ce('0x1d')](_0x2fda78,_0x2f3842,!![]);}catch(_0xe5d00a){return BPromise[_0x28ce('0x1e')](_0xe5d00a);}return _0x2fda78[_0x28ce('0x1f')]();};}function saveUpdates(_0x3d633b,_0x34f492){return function(_0x2cd37c){if(_0x2cd37c){return _0x2cd37c[_0x28ce('0x20')](_0x3d633b)[_0x28ce('0x21')](function(_0x211f26){return _0x211f26;});}return null;};}function removeEntity(_0x4f989a,_0xa1f18a){return function(_0x2481d4){if(_0x2481d4){return _0x2481d4[_0x28ce('0x22')]()[_0x28ce('0x21')](function(){_0x4f989a[_0x28ce('0x16')](0xcc)[_0x28ce('0x17')]();});}};}function handleEntityNotFound(_0x3006ad,_0x3296a6){return function(_0x386c12){if(!_0x386c12){_0x3006ad[_0x28ce('0x23')](0x194);}return _0x386c12;};}function handleError(_0x291d8d,_0x16cc2f){_0x16cc2f=_0x16cc2f||0x1f4;return function(_0x57069e){logger['error'](_0x57069e[_0x28ce('0x24')]);if(_0x57069e[_0x28ce('0x25')]){delete _0x57069e['name'];}_0x291d8d[_0x28ce('0x16')](_0x16cc2f)['send'](_0x57069e);};}exports[_0x28ce('0x26')]=function(_0x573964,_0x41ffb8){var _0x3657a0={},_0x4ec9bf={},_0x5be4a6={'count':0x0,'rows':[]};var _0x30df7f=_['map'](db[_0x28ce('0x27')]['rawAttributes'],function(_0x34d608){return{'name':_0x34d608[_0x28ce('0x28')],'type':_0x34d608['type'][_0x28ce('0x29')]};});_0x4ec9bf[_0x28ce('0x2a')]=_['map'](_0x30df7f,_0x28ce('0x25'));_0x4ec9bf[_0x28ce('0x2b')]=_['keys'](_0x573964[_0x28ce('0x2b')]);_0x4ec9bf[_0x28ce('0x2c')]=_[_0x28ce('0x2d')](_0x4ec9bf[_0x28ce('0x2a')],_0x4ec9bf[_0x28ce('0x2b')]);_0x3657a0[_0x28ce('0x2e')]=_[_0x28ce('0x2d')](_0x4ec9bf['model'],qs[_0x28ce('0x2f')](_0x573964['query'][_0x28ce('0x2f')]));_0x3657a0[_0x28ce('0x2e')]=_0x3657a0['attributes'][_0x28ce('0x30')]?_0x3657a0[_0x28ce('0x2e')]:_0x4ec9bf[_0x28ce('0x2a')];if(!_0x573964['query']['hasOwnProperty']('nolimit')){_0x3657a0[_0x28ce('0x1b')]=qs[_0x28ce('0x1b')](_0x573964[_0x28ce('0x2b')][_0x28ce('0x1b')]);_0x3657a0[_0x28ce('0x1a')]=qs['offset'](_0x573964[_0x28ce('0x2b')][_0x28ce('0x1a')]);}_0x3657a0[_0x28ce('0x31')]=qs[_0x28ce('0x32')](_0x573964[_0x28ce('0x2b')]['sort']);_0x3657a0[_0x28ce('0x33')]=qs[_0x28ce('0x2c')](_['pick'](_0x573964[_0x28ce('0x2b')],_0x4ec9bf[_0x28ce('0x2c')]),_0x30df7f);if(_0x573964[_0x28ce('0x2b')][_0x28ce('0x34')]){_0x3657a0[_0x28ce('0x33')]=_[_0x28ce('0x35')](_0x3657a0['where'],{'$or':_[_0x28ce('0x36')](_0x30df7f,function(_0x3949d5){if(_0x3949d5[_0x28ce('0x37')]!==_0x28ce('0x38')){var _0x3c3b63={};_0x3c3b63[_0x3949d5[_0x28ce('0x25')]]={'$like':'%'+_0x573964['query'][_0x28ce('0x34')]+'%'};return _0x3c3b63;}})});}_0x3657a0=_[_0x28ce('0x35')]({},_0x3657a0,_0x573964[_0x28ce('0x39')]);var _0x5d424b={'where':_0x3657a0['where']};return db[_0x28ce('0x27')]['count'](_0x5d424b)[_0x28ce('0x21')](function(_0xf9a32){_0x5be4a6[_0x28ce('0x19')]=_0xf9a32;if(_0x573964[_0x28ce('0x2b')][_0x28ce('0x3a')]){_0x3657a0[_0x28ce('0x3b')]=[{'all':!![]}];}return db[_0x28ce('0x27')][_0x28ce('0x3c')](_0x3657a0);})[_0x28ce('0x21')](function(_0x532863){_0x5be4a6['rows']=_0x532863;return _0x5be4a6;})[_0x28ce('0x21')](respondWithFilteredResult(_0x41ffb8,_0x3657a0))['catch'](handleError(_0x41ffb8,null));};exports['show']=function(_0x284d49,_0x31c6cf){var _0x4309c7={'raw':!![],'where':{'id':_0x284d49[_0x28ce('0x3d')]['id']}},_0x3e1483={};_0x3e1483[_0x28ce('0x2a')]=_['keys'](db[_0x28ce('0x27')][_0x28ce('0x3e')]);_0x3e1483[_0x28ce('0x2b')]=_['keys'](_0x284d49['query']);_0x3e1483['filters']=_[_0x28ce('0x2d')](_0x3e1483['model'],_0x3e1483[_0x28ce('0x2b')]);_0x4309c7['attributes']=_[_0x28ce('0x2d')](_0x3e1483[_0x28ce('0x2a')],qs[_0x28ce('0x2f')](_0x284d49[_0x28ce('0x2b')][_0x28ce('0x2f')]));_0x4309c7['attributes']=_0x4309c7[_0x28ce('0x2e')][_0x28ce('0x30')]?_0x4309c7[_0x28ce('0x2e')]:_0x3e1483[_0x28ce('0x2a')];if(_0x284d49[_0x28ce('0x2b')][_0x28ce('0x3a')]){_0x4309c7['include']=[{'all':!![]}];}_0x4309c7=_[_0x28ce('0x35')]({},_0x4309c7,_0x284d49['options']);return db['OpenchannelQueueReport'][_0x28ce('0x3f')](_0x4309c7)['then'](handleEntityNotFound(_0x31c6cf,null))[_0x28ce('0x21')](respondWithResult(_0x31c6cf,null))[_0x28ce('0x40')](handleError(_0x31c6cf,null));};exports[_0x28ce('0x41')]=function(_0x1959e5,_0x28cff1){return db[_0x28ce('0x27')][_0x28ce('0x41')](_0x1959e5[_0x28ce('0x42')],{})[_0x28ce('0x21')](respondWithResult(_0x28cff1,0xc9))[_0x28ce('0x40')](handleError(_0x28cff1,null));};exports[_0x28ce('0x20')]=function(_0x316eb0,_0x349a06){if(_0x316eb0[_0x28ce('0x42')]['id']){delete _0x316eb0[_0x28ce('0x42')]['id'];}return db['OpenchannelQueueReport'][_0x28ce('0x3f')]({'where':{'id':_0x316eb0[_0x28ce('0x3d')]['id']}})[_0x28ce('0x21')](handleEntityNotFound(_0x349a06,null))[_0x28ce('0x21')](saveUpdates(_0x316eb0['body'],null))['then'](respondWithResult(_0x349a06,null))[_0x28ce('0x40')](handleError(_0x349a06,null));};exports[_0x28ce('0x22')]=function(_0x567773,_0x26c61c){return db[_0x28ce('0x27')][_0x28ce('0x3f')]({'where':{'id':_0x567773[_0x28ce('0x3d')]['id']}})[_0x28ce('0x21')](handleEntityNotFound(_0x26c61c,null))['then'](removeEntity(_0x26c61c,null))[_0x28ce('0x40')](handleError(_0x26c61c,null));};exports['describe']=function(_0x26d3aa,_0x9aa9f6){return db[_0x28ce('0x27')][_0x28ce('0x43')]()[_0x28ce('0x21')](respondWithResult(_0x9aa9f6,null))[_0x28ce('0x40')](handleError(_0x9aa9f6,null));}; \ No newline at end of file +var _0xac7a=['destroy','error','stack','name','OpenchannelQueueReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','filters','filter','merge','map','VIRTUAL','where','includeAll','findAll','rows','catch','show','include','options','find','create','body','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','update','then'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0xac7a,0x13b));var _0xaac7=function(_0x207f67,_0x172ffa){_0x207f67=_0x207f67-0x0;var _0x4d6724=_0xac7a[_0x207f67];return _0x4d6724;};'use strict';var emlformat=require(_0xaac7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaac7('0x1'));var rp=require(_0xaac7('0x2'));var moment=require(_0xaac7('0x3'));var BPromise=require(_0xaac7('0x4'));var Mustache=require(_0xaac7('0x5'));var util=require('util');var path=require(_0xaac7('0x6'));var sox=require(_0xaac7('0x7'));var csv=require(_0xaac7('0x8'));var ejs=require(_0xaac7('0x9'));var fs=require('fs');var fs_extra=require(_0xaac7('0xa'));var _=require(_0xaac7('0xb'));var squel=require(_0xaac7('0xc'));var crypto=require('crypto');var jsforce=require(_0xaac7('0xd'));var deskjs=require(_0xaac7('0xe'));var toCsv=require(_0xaac7('0x8'));var querystring=require('querystring');var Papa=require(_0xaac7('0xf'));var Redis=require(_0xaac7('0x10'));var authService=require(_0xaac7('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaac7('0x12'))(_0xaac7('0x13'));var utils=require(_0xaac7('0x14'));var config=require(_0xaac7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xaac7('0x16'))['db'];function respondWithStatusCode(_0x568a9b,_0x46947f){_0x46947f=_0x46947f||0xcc;return function(_0x105507){if(_0x105507){return _0x568a9b[_0xaac7('0x17')](_0x46947f);}return _0x568a9b[_0xaac7('0x18')](_0x46947f)[_0xaac7('0x19')]();};}function respondWithResult(_0xeb743d,_0xbc5505){_0xbc5505=_0xbc5505||0xc8;return function(_0x3c77c6){if(_0x3c77c6){return _0xeb743d[_0xaac7('0x18')](_0xbc5505)[_0xaac7('0x1a')](_0x3c77c6);}};}function respondWithFilteredResult(_0x468eee,_0x3cf994){return function(_0x894d15){if(_0x894d15){var _0x2e1dfb=typeof _0x3cf994['offset']===_0xaac7('0x1b')&&typeof _0x3cf994['limit']===_0xaac7('0x1b');var _0x102db8=_0x894d15[_0xaac7('0x1c')];var _0x31535b=_0x2e1dfb?0x0:_0x3cf994[_0xaac7('0x1d')];var _0x1afbe6=_0x2e1dfb?_0x894d15['count']:_0x3cf994['offset']+_0x3cf994[_0xaac7('0x1e')];var _0x135448;if(_0x1afbe6>=_0x102db8){_0x1afbe6=_0x102db8;_0x135448=0xc8;}else{_0x135448=0xce;}_0x468eee[_0xaac7('0x18')](_0x135448);return _0x468eee[_0xaac7('0x1f')]('Content-Range',_0x31535b+'-'+_0x1afbe6+'/'+_0x102db8)[_0xaac7('0x1a')](_0x894d15);}return null;};}function patchUpdates(_0x4d420b){return function(_0x286bf9){try{jsonpatch['apply'](_0x286bf9,_0x4d420b,!![]);}catch(_0x4fdffc){return BPromise[_0xaac7('0x20')](_0x4fdffc);}return _0x286bf9['save']();};}function saveUpdates(_0x33f4a7,_0x1fe7e7){return function(_0x59d82e){if(_0x59d82e){return _0x59d82e[_0xaac7('0x21')](_0x33f4a7)[_0xaac7('0x22')](function(_0x1472fa){return _0x1472fa;});}return null;};}function removeEntity(_0x2e093d,_0x265719){return function(_0x2ec383){if(_0x2ec383){return _0x2ec383[_0xaac7('0x23')]()[_0xaac7('0x22')](function(){_0x2e093d[_0xaac7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f1948,_0x105993){return function(_0x1a8e44){if(!_0x1a8e44){_0x5f1948[_0xaac7('0x17')](0x194);}return _0x1a8e44;};}function handleError(_0x37ddba,_0x3b5f13){_0x3b5f13=_0x3b5f13||0x1f4;return function(_0x23ee8b){logger[_0xaac7('0x24')](_0x23ee8b[_0xaac7('0x25')]);if(_0x23ee8b[_0xaac7('0x26')]){delete _0x23ee8b['name'];}_0x37ddba['status'](_0x3b5f13)['send'](_0x23ee8b);};}exports['index']=function(_0x17da48,_0x4ac6c4){var _0x298def={},_0x50e28b={},_0x5289b5={'count':0x0,'rows':[]};var _0x2cfea5=_['map'](db[_0xaac7('0x27')][_0xaac7('0x28')],function(_0x2d6d16){return{'name':_0x2d6d16[_0xaac7('0x29')],'type':_0x2d6d16[_0xaac7('0x2a')][_0xaac7('0x2b')]};});_0x50e28b['model']=_['map'](_0x2cfea5,'name');_0x50e28b[_0xaac7('0x2c')]=_[_0xaac7('0x2d')](_0x17da48['query']);_0x50e28b['filters']=_[_0xaac7('0x2e')](_0x50e28b[_0xaac7('0x2f')],_0x50e28b[_0xaac7('0x2c')]);_0x298def[_0xaac7('0x30')]=_[_0xaac7('0x2e')](_0x50e28b[_0xaac7('0x2f')],qs[_0xaac7('0x31')](_0x17da48[_0xaac7('0x2c')][_0xaac7('0x31')]));_0x298def['attributes']=_0x298def[_0xaac7('0x30')]['length']?_0x298def['attributes']:_0x50e28b[_0xaac7('0x2f')];if(!_0x17da48['query'][_0xaac7('0x32')](_0xaac7('0x33'))){_0x298def[_0xaac7('0x1e')]=qs['limit'](_0x17da48[_0xaac7('0x2c')][_0xaac7('0x1e')]);_0x298def['offset']=qs[_0xaac7('0x1d')](_0x17da48[_0xaac7('0x2c')]['offset']);}_0x298def['order']=qs['sort'](_0x17da48[_0xaac7('0x2c')]['sort']);_0x298def['where']=qs[_0xaac7('0x34')](_['pick'](_0x17da48[_0xaac7('0x2c')],_0x50e28b[_0xaac7('0x34')]),_0x2cfea5);if(_0x17da48[_0xaac7('0x2c')][_0xaac7('0x35')]){_0x298def['where']=_[_0xaac7('0x36')](_0x298def['where'],{'$or':_[_0xaac7('0x37')](_0x2cfea5,function(_0x3e05e3){if(_0x3e05e3[_0xaac7('0x2a')]!==_0xaac7('0x38')){var _0x53baf7={};_0x53baf7[_0x3e05e3['name']]={'$like':'%'+_0x17da48[_0xaac7('0x2c')][_0xaac7('0x35')]+'%'};return _0x53baf7;}})});}_0x298def=_[_0xaac7('0x36')]({},_0x298def,_0x17da48['options']);var _0x38cb3f={'where':_0x298def[_0xaac7('0x39')]};return db[_0xaac7('0x27')][_0xaac7('0x1c')](_0x38cb3f)[_0xaac7('0x22')](function(_0x4f5403){_0x5289b5[_0xaac7('0x1c')]=_0x4f5403;if(_0x17da48[_0xaac7('0x2c')][_0xaac7('0x3a')]){_0x298def['include']=[{'all':!![]}];}return db[_0xaac7('0x27')][_0xaac7('0x3b')](_0x298def);})[_0xaac7('0x22')](function(_0x580c71){_0x5289b5[_0xaac7('0x3c')]=_0x580c71;return _0x5289b5;})[_0xaac7('0x22')](respondWithFilteredResult(_0x4ac6c4,_0x298def))[_0xaac7('0x3d')](handleError(_0x4ac6c4,null));};exports[_0xaac7('0x3e')]=function(_0x15d1ce,_0x5392bc){var _0x5633e1={'raw':!![],'where':{'id':_0x15d1ce['params']['id']}},_0x395a14={};_0x395a14[_0xaac7('0x2f')]=_[_0xaac7('0x2d')](db['OpenchannelQueueReport'][_0xaac7('0x28')]);_0x395a14[_0xaac7('0x2c')]=_[_0xaac7('0x2d')](_0x15d1ce[_0xaac7('0x2c')]);_0x395a14[_0xaac7('0x34')]=_['intersection'](_0x395a14[_0xaac7('0x2f')],_0x395a14['query']);_0x5633e1[_0xaac7('0x30')]=_['intersection'](_0x395a14[_0xaac7('0x2f')],qs[_0xaac7('0x31')](_0x15d1ce[_0xaac7('0x2c')][_0xaac7('0x31')]));_0x5633e1[_0xaac7('0x30')]=_0x5633e1[_0xaac7('0x30')]['length']?_0x5633e1['attributes']:_0x395a14[_0xaac7('0x2f')];if(_0x15d1ce[_0xaac7('0x2c')][_0xaac7('0x3a')]){_0x5633e1[_0xaac7('0x3f')]=[{'all':!![]}];}_0x5633e1=_[_0xaac7('0x36')]({},_0x5633e1,_0x15d1ce[_0xaac7('0x40')]);return db['OpenchannelQueueReport'][_0xaac7('0x41')](_0x5633e1)['then'](handleEntityNotFound(_0x5392bc,null))[_0xaac7('0x22')](respondWithResult(_0x5392bc,null))['catch'](handleError(_0x5392bc,null));};exports[_0xaac7('0x42')]=function(_0x15a77d,_0x1fa3c0){return db[_0xaac7('0x27')]['create'](_0x15a77d['body'],{})[_0xaac7('0x22')](respondWithResult(_0x1fa3c0,0xc9))[_0xaac7('0x3d')](handleError(_0x1fa3c0,null));};exports['update']=function(_0x9e5bb9,_0x2fc0cd){if(_0x9e5bb9[_0xaac7('0x43')]['id']){delete _0x9e5bb9[_0xaac7('0x43')]['id'];}return db[_0xaac7('0x27')]['find']({'where':{'id':_0x9e5bb9[_0xaac7('0x44')]['id']}})[_0xaac7('0x22')](handleEntityNotFound(_0x2fc0cd,null))[_0xaac7('0x22')](saveUpdates(_0x9e5bb9[_0xaac7('0x43')],null))[_0xaac7('0x22')](respondWithResult(_0x2fc0cd,null))['catch'](handleError(_0x2fc0cd,null));};exports[_0xaac7('0x23')]=function(_0x73f2ef,_0x53c524){return db[_0xaac7('0x27')]['find']({'where':{'id':_0x73f2ef[_0xaac7('0x44')]['id']}})[_0xaac7('0x22')](handleEntityNotFound(_0x53c524,null))['then'](removeEntity(_0x53c524,null))['catch'](handleError(_0x53c524,null));};exports[_0xaac7('0x45')]=function(_0xeea28,_0x3b7c14){return db[_0xaac7('0x27')][_0xaac7('0x45')]()['then'](respondWithResult(_0x3b7c14,null))[_0xaac7('0x3d')](handleError(_0x3b7c14,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 0e877a3..bd37d0a 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x337000,_0x5632dc){var _0x2bf2ec=function(_0x4660cb){while(--_0x4660cb){_0x337000['push'](_0x337000['shift']());}};_0x2bf2ec(++_0x5632dc);}(_0x1261,0x144));var _0x1126=function(_0x53f897,_0x539857){_0x53f897=_0x53f897-0x0;var _0x6879f8=_0x1261[_0x53f897];return _0x6879f8;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x49a579,_0x2f86a9){var _0x580285=function(_0x2a839f){while(--_0x2a839f){_0x49a579['push'](_0x49a579['shift']());}};_0x580285(++_0x2f86a9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index bb4389d..1d4b110 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 _0x6a95=['request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then','UpdateOpenchannelQueueReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x4f6880,_0x34d7cd){var _0x586dd0=function(_0x581ee4){while(--_0x581ee4){_0x4f6880['push'](_0x4f6880['shift']());}};_0x586dd0(++_0x34d7cd);}(_0x6a95,0x1db));var _0x56a9=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x6a95[_0x32d457];return _0x338386;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56a9('0x7'));var config=require(_0x56a9('0x8'));var jayson=require(_0x56a9('0x9'));var client=jayson[_0x56a9('0xa')][_0x56a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x365093,_0xd8aa7c,_0x5d3e80){return new BPromise(function(_0x5f0dcb,_0x3ac626){return client[_0x56a9('0xc')](_0x365093,_0x5d3e80)['then'](function(_0xe4b98c){logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));logger[_0x56a9('0x10')](_0x56a9('0x11'),_0xd8aa7c,_0x56a9('0xf'),JSON[_0x56a9('0x12')](_0xe4b98c));if(_0xe4b98c[_0x56a9('0x13')]){if(_0xe4b98c['error'][_0x56a9('0x14')]===0x1f4){logger['error'](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x3ac626(_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);}logger[_0x56a9('0x13')](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x5f0dcb(_0xe4b98c['error']['message']);}else{logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));_0x5f0dcb(_0xe4b98c[_0x56a9('0x16')]['message']);}})[_0x56a9('0x17')](function(_0x4853a3){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xd8aa7c,_0x4853a3);_0x3ac626(_0x4853a3);});});}exports[_0x56a9('0x18')]=function(_0x576bdf){var _0x59c0ec=this;return new Promise(function(_0x105fe5,_0x459a87){return db[_0x56a9('0x19')][_0x56a9('0x1a')](_0x576bdf[_0x56a9('0x1b')],{'raw':_0x576bdf[_0x56a9('0x1c')]?_0x576bdf[_0x56a9('0x1c')][_0x56a9('0x1d')]===undefined?!![]:![]:!![]})[_0x56a9('0x1e')](function(_0x5f145f){logger['info'](_0x56a9('0x18'),_0x576bdf);logger[_0x56a9('0x10')](_0x56a9('0x18'),_0x576bdf,JSON[_0x56a9('0x12')](_0x5f145f));_0x105fe5(_0x5f145f);})['catch'](function(_0x6100fe){logger[_0x56a9('0x13')](_0x56a9('0x18'),_0x6100fe[_0x56a9('0x15')],_0x576bdf);_0x459a87(_0x59c0ec['error'](0x1f4,_0x6100fe[_0x56a9('0x15')]));});});};exports[_0x56a9('0x1f')]=function(_0x21ab38){var _0xd029f7=this;return new Promise(function(_0x497d31,_0x52016c){return db[_0x56a9('0x19')][_0x56a9('0x20')](_0x21ab38[_0x56a9('0x1b')],{'raw':_0x21ab38['options']?_0x21ab38[_0x56a9('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21ab38[_0x56a9('0x1c')]?_0x21ab38[_0x56a9('0x1c')][_0x56a9('0x21')]||null:null,'attributes':_0x21ab38[_0x56a9('0x1c')]?_0x21ab38[_0x56a9('0x1c')][_0x56a9('0x22')]||null:null,'limit':_0x21ab38[_0x56a9('0x1c')]?_0x21ab38[_0x56a9('0x1c')]['limit']||null:null})[_0x56a9('0x1e')](function(_0x2bb1eb){logger['info'](_0x56a9('0x1f'),_0x21ab38);logger['debug']('UpdateOpenchannelQueueReport',_0x21ab38,JSON[_0x56a9('0x12')](_0x2bb1eb));_0x497d31(_0x2bb1eb);})['catch'](function(_0x2f933a){logger[_0x56a9('0x13')](_0x56a9('0x1f'),_0x2f933a[_0x56a9('0x15')],_0x21ab38);_0x52016c(_0xd029f7['error'](0x1f4,_0x2f933a[_0x56a9('0x15')]));});});}; \ No newline at end of file +var _0xe9e8=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','options','then'];(function(_0x386252,_0x5b4a65){var _0x1fb693=function(_0x5b6865){while(--_0x5b6865){_0x386252['push'](_0x386252['shift']());}};_0x1fb693(++_0x5b4a65);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x11d5bd,_0x27ef14){_0x11d5bd=_0x11d5bd-0x0;var _0x3d86ca=_0xe9e8[_0x11d5bd];return _0x3d86ca;};'use strict';var _=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var moment=require(_0x8e9e('0x2'));var BPromise=require(_0x8e9e('0x3'));var rs=require(_0x8e9e('0x4'));var fs=require('fs');var Redis=require(_0x8e9e('0x5'));var db=require(_0x8e9e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e9e('0x7'))(_0x8e9e('0x8'));var config=require(_0x8e9e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e9e('0xa')][_0x8e9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x204f5c,_0x1fb8d3,_0x58f822){return new BPromise(function(_0x3b5d21,_0x2ae896){return client[_0x8e9e('0xc')](_0x204f5c,_0x58f822)['then'](function(_0x39f5e5){logger[_0x8e9e('0xd')](_0x8e9e('0xe'),_0x1fb8d3,'request\x20sent');logger[_0x8e9e('0xf')](_0x8e9e('0x10'),_0x1fb8d3,_0x8e9e('0x11'),JSON[_0x8e9e('0x12')](_0x39f5e5));if(_0x39f5e5[_0x8e9e('0x13')]){if(_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x14')]===0x1f4){logger['error'](_0x8e9e('0xe'),_0x1fb8d3,_0x39f5e5['error'][_0x8e9e('0x15')]);return _0x2ae896(_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x15')]);}logger[_0x8e9e('0x13')](_0x8e9e('0xe'),_0x1fb8d3,_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x15')]);return _0x3b5d21(_0x39f5e5['error']['message']);}else{logger[_0x8e9e('0xd')](_0x8e9e('0xe'),_0x1fb8d3,'request\x20sent');_0x3b5d21(_0x39f5e5[_0x8e9e('0x16')][_0x8e9e('0x15')]);}})[_0x8e9e('0x17')](function(_0x22b2c7){logger[_0x8e9e('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1fb8d3,_0x22b2c7);_0x2ae896(_0x22b2c7);});});}exports['CreateOpenchannelQueueReport']=function(_0x42f8e8){var _0x40f4fd=this;return new Promise(function(_0x41cdc0,_0x28584b){return db[_0x8e9e('0x18')][_0x8e9e('0x19')](_0x42f8e8[_0x8e9e('0x1a')],{'raw':_0x42f8e8['options']?_0x42f8e8[_0x8e9e('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x8e9e('0x1c')](function(_0x19a890){logger['info'](_0x8e9e('0x1d'),_0x42f8e8);logger[_0x8e9e('0xf')](_0x8e9e('0x1d'),_0x42f8e8,JSON[_0x8e9e('0x12')](_0x19a890));_0x41cdc0(_0x19a890);})[_0x8e9e('0x17')](function(_0x6a311b){logger[_0x8e9e('0x13')](_0x8e9e('0x1d'),_0x6a311b['message'],_0x42f8e8);_0x28584b(_0x40f4fd['error'](0x1f4,_0x6a311b[_0x8e9e('0x15')]));});});};exports[_0x8e9e('0x1e')]=function(_0x2ad495){var _0x5a1e59=this;return new Promise(function(_0x2d6190,_0x5d2128){return db[_0x8e9e('0x18')][_0x8e9e('0x1f')](_0x2ad495[_0x8e9e('0x1a')],{'raw':_0x2ad495['options']?_0x2ad495[_0x8e9e('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ad495['options']?_0x2ad495[_0x8e9e('0x1b')]['where']||null:null,'attributes':_0x2ad495[_0x8e9e('0x1b')]?_0x2ad495['options'][_0x8e9e('0x20')]||null:null,'limit':_0x2ad495[_0x8e9e('0x1b')]?_0x2ad495['options'][_0x8e9e('0x21')]||null:null})[_0x8e9e('0x1c')](function(_0x2be576){logger[_0x8e9e('0xd')](_0x8e9e('0x1e'),_0x2ad495);logger[_0x8e9e('0xf')](_0x8e9e('0x1e'),_0x2ad495,JSON[_0x8e9e('0x12')](_0x2be576));_0x2d6190(_0x2be576);})[_0x8e9e('0x17')](function(_0x4ca308){logger[_0x8e9e('0x13')](_0x8e9e('0x1e'),_0x4ca308[_0x8e9e('0x15')],_0x2ad495);_0x5d2128(_0x5a1e59[_0x8e9e('0x13')](0x1f4,_0x4ca308['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 6a5c40f..a8dd649 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 _0xfd77=['/describe','/:id','show','put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index'];(function(_0x221549,_0x3c0d19){var _0x45c389=function(_0x3abba5){while(--_0x3abba5){_0x221549['push'](_0x221549['shift']());}};_0x45c389(++_0x3c0d19);}(_0xfd77,0x15d));var _0x7fd7=function(_0x210bf8,_0x2f2446){_0x210bf8=_0x210bf8-0x0;var _0x1ed644=_0xfd77[_0x210bf8];return _0x1ed644;};'use strict';var multer=require(_0x7fd7('0x0'));var util=require('util');var path=require(_0x7fd7('0x1'));var timeout=require('connect-timeout');var express=require(_0x7fd7('0x2'));var router=express[_0x7fd7('0x3')]();var fs_extra=require(_0x7fd7('0x4'));var auth=require(_0x7fd7('0x5'));var interaction=require(_0x7fd7('0x6'));var config=require('../../config/environment');var controller=require(_0x7fd7('0x7'));router[_0x7fd7('0x8')]('/',auth[_0x7fd7('0x9')](),controller[_0x7fd7('0xa')]);router[_0x7fd7('0x8')](_0x7fd7('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x7fd7('0x8')](_0x7fd7('0xc'),auth[_0x7fd7('0x9')](),controller[_0x7fd7('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7fd7('0xe')](_0x7fd7('0xc'),auth[_0x7fd7('0x9')](),controller[_0x7fd7('0xf')]);router['delete'](_0x7fd7('0xc'),auth[_0x7fd7('0x9')](),controller[_0x7fd7('0x10')]);module[_0x7fd7('0x11')]=router; \ No newline at end of file +var _0x71b5=['describe','/:id','show','post','isAuthenticated','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','index','/describe'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0x71b5,0x179));var _0x571b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x71b5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x571b('0x0'));var util=require(_0x571b('0x1'));var path=require(_0x571b('0x2'));var timeout=require(_0x571b('0x3'));var express=require(_0x571b('0x4'));var router=express[_0x571b('0x5')]();var fs_extra=require(_0x571b('0x6'));var auth=require(_0x571b('0x7'));var interaction=require(_0x571b('0x8'));var config=require(_0x571b('0x9'));var controller=require(_0x571b('0xa'));router[_0x571b('0xb')]('/',auth['isAuthenticated'](),controller[_0x571b('0xc')]);router[_0x571b('0xb')](_0x571b('0xd'),auth['isAuthenticated'](),controller[_0x571b('0xe')]);router[_0x571b('0xb')](_0x571b('0xf'),auth['isAuthenticated'](),controller[_0x571b('0x10')]);router[_0x571b('0x11')]('/',auth[_0x571b('0x12')](),controller[_0x571b('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x571b('0x14')]);router[_0x571b('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x571b('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index ac10515..4bb33b8 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x5eb9e3,_0x50ef15){var _0x58e936=function(_0x516c27){while(--_0x516c27){_0x5eb9e3['push'](_0x5eb9e3['shift']());}};_0x58e936(++_0x50ef15);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x40f991,_0x576819){_0x40f991=_0x40f991-0x0;var _0x38eca2=_0xf3cd[_0x40f991];return _0x38eca2;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x4da572,_0x326408){var _0x378393=function(_0x1357e4){while(--_0x1357e4){_0x4da572['push'](_0x4da572['shift']());}};_0x378393(++_0x326408);}(_0x34e8,0x12c));var _0x834e=function(_0x45fd21,_0xf2861c){_0x45fd21=_0x45fd21-0x0;var _0x5611a1=_0x34e8[_0x45fd21];return _0x5611a1;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index e218301..dbcc585 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 _0x21f1=['stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','OpenchannelTransferReport','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','error'];(function(_0x1df270,_0x4a8f8e){var _0x224d09=function(_0x3eedde){while(--_0x3eedde){_0x1df270['push'](_0x1df270['shift']());}};_0x224d09(++_0x4a8f8e);}(_0x21f1,0x10e));var _0x121f=function(_0x3313a8,_0x17e212){_0x3313a8=_0x3313a8-0x0;var _0x262dfe=_0x21f1[_0x3313a8];return _0x262dfe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x121f('0x0'));var zipdir=require(_0x121f('0x1'));var jsonpatch=require(_0x121f('0x2'));var rp=require(_0x121f('0x3'));var moment=require('moment');var BPromise=require(_0x121f('0x4'));var Mustache=require(_0x121f('0x5'));var util=require(_0x121f('0x6'));var path=require(_0x121f('0x7'));var sox=require(_0x121f('0x8'));var csv=require(_0x121f('0x9'));var ejs=require(_0x121f('0xa'));var fs=require('fs');var fs_extra=require(_0x121f('0xb'));var _=require(_0x121f('0xc'));var squel=require(_0x121f('0xd'));var crypto=require(_0x121f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x121f('0xf'));var toCsv=require(_0x121f('0x9'));var querystring=require('querystring');var Papa=require(_0x121f('0x10'));var Redis=require(_0x121f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x121f('0x12'));var as=require(_0x121f('0x13'));var hardwareService=require(_0x121f('0x14'));var logger=require(_0x121f('0x15'))(_0x121f('0x16'));var utils=require(_0x121f('0x17'));var config=require(_0x121f('0x18'));var licenseUtil=require(_0x121f('0x19'));var db=require(_0x121f('0x1a'))['db'];function respondWithStatusCode(_0x548a05,_0x4a225d){_0x4a225d=_0x4a225d||0xcc;return function(_0x29f4d8){if(_0x29f4d8){return _0x548a05[_0x121f('0x1b')](_0x4a225d);}return _0x548a05[_0x121f('0x1c')](_0x4a225d)[_0x121f('0x1d')]();};}function respondWithResult(_0x74c841,_0xd0e1fa){_0xd0e1fa=_0xd0e1fa||0xc8;return function(_0x3819a4){if(_0x3819a4){return _0x74c841[_0x121f('0x1c')](_0xd0e1fa)['json'](_0x3819a4);}};}function respondWithFilteredResult(_0x43b21b,_0x5e0fb5){return function(_0x282917){if(_0x282917){var _0xa54e83=typeof _0x5e0fb5[_0x121f('0x1e')]===_0x121f('0x1f')&&typeof _0x5e0fb5[_0x121f('0x20')]===_0x121f('0x1f');var _0x35d790=_0x282917[_0x121f('0x21')];var _0x1ec887=_0xa54e83?0x0:_0x5e0fb5['offset'];var _0x3ff4df=_0xa54e83?_0x282917[_0x121f('0x21')]:_0x5e0fb5[_0x121f('0x1e')]+_0x5e0fb5[_0x121f('0x20')];var _0x4bde4e;if(_0x3ff4df>=_0x35d790){_0x3ff4df=_0x35d790;_0x4bde4e=0xc8;}else{_0x4bde4e=0xce;}_0x43b21b[_0x121f('0x1c')](_0x4bde4e);return _0x43b21b[_0x121f('0x22')](_0x121f('0x23'),_0x1ec887+'-'+_0x3ff4df+'/'+_0x35d790)[_0x121f('0x24')](_0x282917);}return null;};}function patchUpdates(_0x45e3d9){return function(_0x62f73c){try{jsonpatch[_0x121f('0x25')](_0x62f73c,_0x45e3d9,!![]);}catch(_0xe86239){return BPromise['reject'](_0xe86239);}return _0x62f73c[_0x121f('0x26')]();};}function saveUpdates(_0x42aff5,_0x42604a){return function(_0x45ad5d){if(_0x45ad5d){return _0x45ad5d[_0x121f('0x27')](_0x42aff5)['then'](function(_0x59f313){return _0x59f313;});}return null;};}function removeEntity(_0x158815,_0x41b7f3){return function(_0x3059ee){if(_0x3059ee){return _0x3059ee['destroy']()[_0x121f('0x28')](function(){_0x158815['status'](0xcc)[_0x121f('0x1d')]();});}};}function handleEntityNotFound(_0x2433a0,_0x2b0a0f){return function(_0x1e8c51){if(!_0x1e8c51){_0x2433a0['sendStatus'](0x194);}return _0x1e8c51;};}function handleError(_0x4a4454,_0x230e1c){_0x230e1c=_0x230e1c||0x1f4;return function(_0x4908be){logger[_0x121f('0x29')](_0x4908be[_0x121f('0x2a')]);if(_0x4908be['name']){delete _0x4908be[_0x121f('0x2b')];}_0x4a4454[_0x121f('0x1c')](_0x230e1c)['send'](_0x4908be);};}exports[_0x121f('0x2c')]=function(_0x57a242,_0x117004){var _0x68914c={},_0x5a0443={},_0x5c28cc={'count':0x0,'rows':[]};var _0x28ecad=_[_0x121f('0x2d')](db['OpenchannelTransferReport'][_0x121f('0x2e')],function(_0x2a6b21){return{'name':_0x2a6b21[_0x121f('0x2f')],'type':_0x2a6b21[_0x121f('0x30')][_0x121f('0x31')]};});_0x5a0443[_0x121f('0x32')]=_['map'](_0x28ecad,_0x121f('0x2b'));_0x5a0443[_0x121f('0x33')]=_[_0x121f('0x34')](_0x57a242['query']);_0x5a0443[_0x121f('0x35')]=_[_0x121f('0x36')](_0x5a0443[_0x121f('0x32')],_0x5a0443[_0x121f('0x33')]);_0x68914c['attributes']=_[_0x121f('0x36')](_0x5a0443[_0x121f('0x32')],qs[_0x121f('0x37')](_0x57a242[_0x121f('0x33')][_0x121f('0x37')]));_0x68914c[_0x121f('0x38')]=_0x68914c[_0x121f('0x38')][_0x121f('0x39')]?_0x68914c[_0x121f('0x38')]:_0x5a0443['model'];if(!_0x57a242[_0x121f('0x33')][_0x121f('0x3a')]('nolimit')){_0x68914c['limit']=qs[_0x121f('0x20')](_0x57a242[_0x121f('0x33')][_0x121f('0x20')]);_0x68914c[_0x121f('0x1e')]=qs['offset'](_0x57a242['query']['offset']);}_0x68914c[_0x121f('0x3b')]=qs[_0x121f('0x3c')](_0x57a242['query'][_0x121f('0x3c')]);_0x68914c['where']=qs[_0x121f('0x35')](_[_0x121f('0x3d')](_0x57a242[_0x121f('0x33')],_0x5a0443[_0x121f('0x35')]),_0x28ecad);if(_0x57a242[_0x121f('0x33')][_0x121f('0x3e')]){_0x68914c[_0x121f('0x3f')]=_['merge'](_0x68914c[_0x121f('0x3f')],{'$or':_[_0x121f('0x2d')](_0x28ecad,function(_0x49a586){if(_0x49a586[_0x121f('0x30')]!=='VIRTUAL'){var _0x263052={};_0x263052[_0x49a586[_0x121f('0x2b')]]={'$like':'%'+_0x57a242[_0x121f('0x33')][_0x121f('0x3e')]+'%'};return _0x263052;}})});}_0x68914c=_[_0x121f('0x40')]({},_0x68914c,_0x57a242[_0x121f('0x41')]);var _0x3f6b3a={'where':_0x68914c[_0x121f('0x3f')]};return db[_0x121f('0x42')][_0x121f('0x21')](_0x3f6b3a)[_0x121f('0x28')](function(_0x15873){_0x5c28cc[_0x121f('0x21')]=_0x15873;if(_0x57a242[_0x121f('0x33')]['includeAll']){_0x68914c[_0x121f('0x43')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x121f('0x44')](_0x68914c);})['then'](function(_0xea7ba0){_0x5c28cc[_0x121f('0x45')]=_0xea7ba0;return _0x5c28cc;})[_0x121f('0x28')](respondWithFilteredResult(_0x117004,_0x68914c))[_0x121f('0x46')](handleError(_0x117004,null));};exports[_0x121f('0x47')]=function(_0x5a31d3,_0x6bd0ff){var _0x35050c={'raw':!![],'where':{'id':_0x5a31d3[_0x121f('0x48')]['id']}},_0x1f3960={};_0x1f3960[_0x121f('0x32')]=_[_0x121f('0x34')](db[_0x121f('0x42')][_0x121f('0x2e')]);_0x1f3960[_0x121f('0x33')]=_[_0x121f('0x34')](_0x5a31d3[_0x121f('0x33')]);_0x1f3960[_0x121f('0x35')]=_[_0x121f('0x36')](_0x1f3960['model'],_0x1f3960['query']);_0x35050c[_0x121f('0x38')]=_['intersection'](_0x1f3960[_0x121f('0x32')],qs['fields'](_0x5a31d3[_0x121f('0x33')][_0x121f('0x37')]));_0x35050c[_0x121f('0x38')]=_0x35050c['attributes'][_0x121f('0x39')]?_0x35050c[_0x121f('0x38')]:_0x1f3960[_0x121f('0x32')];if(_0x5a31d3[_0x121f('0x33')]['includeAll']){_0x35050c['include']=[{'all':!![]}];}_0x35050c=_[_0x121f('0x40')]({},_0x35050c,_0x5a31d3[_0x121f('0x41')]);return db[_0x121f('0x42')][_0x121f('0x49')](_0x35050c)[_0x121f('0x28')](handleEntityNotFound(_0x6bd0ff,null))[_0x121f('0x28')](respondWithResult(_0x6bd0ff,null))[_0x121f('0x46')](handleError(_0x6bd0ff,null));};exports[_0x121f('0x4a')]=function(_0xfb201,_0x2f65b7){return db[_0x121f('0x42')][_0x121f('0x4a')](_0xfb201[_0x121f('0x4b')],{})[_0x121f('0x28')](respondWithResult(_0x2f65b7,0xc9))['catch'](handleError(_0x2f65b7,null));};exports[_0x121f('0x27')]=function(_0x1ee411,_0xaf4e39){if(_0x1ee411['body']['id']){delete _0x1ee411[_0x121f('0x4b')]['id'];}return db[_0x121f('0x42')]['find']({'where':{'id':_0x1ee411[_0x121f('0x48')]['id']}})['then'](handleEntityNotFound(_0xaf4e39,null))['then'](saveUpdates(_0x1ee411[_0x121f('0x4b')],null))['then'](respondWithResult(_0xaf4e39,null))['catch'](handleError(_0xaf4e39,null));};exports[_0x121f('0x4c')]=function(_0x492285,_0x327aab){return db['OpenchannelTransferReport'][_0x121f('0x49')]({'where':{'id':_0x492285['params']['id']}})[_0x121f('0x28')](handleEntityNotFound(_0x327aab,null))[_0x121f('0x28')](removeEntity(_0x327aab,null))[_0x121f('0x46')](handleError(_0x327aab,null));};exports['describe']=function(_0xef4998,_0x3798a2){return db['OpenchannelTransferReport'][_0x121f('0x4d')]()[_0x121f('0x28')](respondWithResult(_0x3798a2,null))['catch'](handleError(_0x3798a2,null));}; \ No newline at end of file +var _0x388c=['query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','includeAll','include','OpenchannelTransferReport','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','fast-json-patch','bluebird','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','type','key','model'];(function(_0x2084f3,_0x423d9a){var _0x1e0ea3=function(_0x24d764){while(--_0x24d764){_0x2084f3['push'](_0x2084f3['shift']());}};_0x1e0ea3(++_0x423d9a);}(_0x388c,0xea));var _0xc388=function(_0x3e20c4,_0x4fd11a){_0x3e20c4=_0x3e20c4-0x0;var _0x37db64=_0x388c[_0x3e20c4];return _0x37db64;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc388('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc388('0x1'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc388('0x2'));var csv=require('to-csv');var ejs=require(_0xc388('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc388('0x4'));var squel=require(_0xc388('0x5'));var crypto=require('crypto');var jsforce=require(_0xc388('0x6'));var deskjs=require(_0xc388('0x7'));var toCsv=require(_0xc388('0x8'));var querystring=require('querystring');var Papa=require(_0xc388('0x9'));var Redis=require('ioredis');var authService=require(_0xc388('0xa'));var qs=require(_0xc388('0xb'));var as=require(_0xc388('0xc'));var hardwareService=require(_0xc388('0xd'));var logger=require(_0xc388('0xe'))(_0xc388('0xf'));var utils=require(_0xc388('0x10'));var config=require(_0xc388('0x11'));var licenseUtil=require(_0xc388('0x12'));var db=require(_0xc388('0x13'))['db'];function respondWithStatusCode(_0x134c4b,_0xd56cd5){_0xd56cd5=_0xd56cd5||0xcc;return function(_0x217f19){if(_0x217f19){return _0x134c4b[_0xc388('0x14')](_0xd56cd5);}return _0x134c4b[_0xc388('0x15')](_0xd56cd5)['end']();};}function respondWithResult(_0x415043,_0x50a3bd){_0x50a3bd=_0x50a3bd||0xc8;return function(_0x8f4b6c){if(_0x8f4b6c){return _0x415043[_0xc388('0x15')](_0x50a3bd)[_0xc388('0x16')](_0x8f4b6c);}};}function respondWithFilteredResult(_0x30f386,_0x335214){return function(_0x7597e1){if(_0x7597e1){var _0x17087a=typeof _0x335214[_0xc388('0x17')]==='undefined'&&typeof _0x335214[_0xc388('0x18')]===_0xc388('0x19');var _0x3dc3c4=_0x7597e1[_0xc388('0x1a')];var _0x18732e=_0x17087a?0x0:_0x335214[_0xc388('0x17')];var _0xf778=_0x17087a?_0x7597e1[_0xc388('0x1a')]:_0x335214['offset']+_0x335214['limit'];var _0xdaeb8;if(_0xf778>=_0x3dc3c4){_0xf778=_0x3dc3c4;_0xdaeb8=0xc8;}else{_0xdaeb8=0xce;}_0x30f386[_0xc388('0x15')](_0xdaeb8);return _0x30f386[_0xc388('0x1b')](_0xc388('0x1c'),_0x18732e+'-'+_0xf778+'/'+_0x3dc3c4)[_0xc388('0x16')](_0x7597e1);}return null;};}function patchUpdates(_0x25e947){return function(_0x55d20b){try{jsonpatch[_0xc388('0x1d')](_0x55d20b,_0x25e947,!![]);}catch(_0x339d1d){return BPromise['reject'](_0x339d1d);}return _0x55d20b[_0xc388('0x1e')]();};}function saveUpdates(_0x352ad9,_0x5a4a9c){return function(_0x24ccf7){if(_0x24ccf7){return _0x24ccf7[_0xc388('0x1f')](_0x352ad9)[_0xc388('0x20')](function(_0x38a556){return _0x38a556;});}return null;};}function removeEntity(_0x599a48,_0xb2e4d8){return function(_0x57628e){if(_0x57628e){return _0x57628e[_0xc388('0x21')]()[_0xc388('0x20')](function(){_0x599a48[_0xc388('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x316d47,_0x4d2ade){return function(_0x366588){if(!_0x366588){_0x316d47[_0xc388('0x14')](0x194);}return _0x366588;};}function handleError(_0x1e59e1,_0x150c71){_0x150c71=_0x150c71||0x1f4;return function(_0x301546){logger[_0xc388('0x22')](_0x301546['stack']);if(_0x301546['name']){delete _0x301546[_0xc388('0x23')];}_0x1e59e1[_0xc388('0x15')](_0x150c71)[_0xc388('0x24')](_0x301546);};}exports[_0xc388('0x25')]=function(_0x3619dc,_0x1fd97f){var _0x46dbb4={},_0x824c92={},_0x357f0e={'count':0x0,'rows':[]};var _0x1d6699=_[_0xc388('0x26')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x33ce07){return{'name':_0x33ce07['fieldName'],'type':_0x33ce07[_0xc388('0x27')][_0xc388('0x28')]};});_0x824c92[_0xc388('0x29')]=_[_0xc388('0x26')](_0x1d6699,_0xc388('0x23'));_0x824c92[_0xc388('0x2a')]=_['keys'](_0x3619dc[_0xc388('0x2a')]);_0x824c92['filters']=_[_0xc388('0x2b')](_0x824c92['model'],_0x824c92[_0xc388('0x2a')]);_0x46dbb4[_0xc388('0x2c')]=_[_0xc388('0x2b')](_0x824c92[_0xc388('0x29')],qs[_0xc388('0x2d')](_0x3619dc[_0xc388('0x2a')][_0xc388('0x2d')]));_0x46dbb4[_0xc388('0x2c')]=_0x46dbb4[_0xc388('0x2c')][_0xc388('0x2e')]?_0x46dbb4[_0xc388('0x2c')]:_0x824c92[_0xc388('0x29')];if(!_0x3619dc[_0xc388('0x2a')][_0xc388('0x2f')](_0xc388('0x30'))){_0x46dbb4[_0xc388('0x18')]=qs['limit'](_0x3619dc[_0xc388('0x2a')][_0xc388('0x18')]);_0x46dbb4['offset']=qs[_0xc388('0x17')](_0x3619dc['query'][_0xc388('0x17')]);}_0x46dbb4['order']=qs[_0xc388('0x31')](_0x3619dc['query'][_0xc388('0x31')]);_0x46dbb4[_0xc388('0x32')]=qs[_0xc388('0x33')](_['pick'](_0x3619dc[_0xc388('0x2a')],_0x824c92[_0xc388('0x33')]),_0x1d6699);if(_0x3619dc[_0xc388('0x2a')][_0xc388('0x34')]){_0x46dbb4[_0xc388('0x32')]=_[_0xc388('0x35')](_0x46dbb4['where'],{'$or':_[_0xc388('0x26')](_0x1d6699,function(_0x3ab33f){if(_0x3ab33f['type']!=='VIRTUAL'){var _0x163fdd={};_0x163fdd[_0x3ab33f[_0xc388('0x23')]]={'$like':'%'+_0x3619dc[_0xc388('0x2a')][_0xc388('0x34')]+'%'};return _0x163fdd;}})});}_0x46dbb4=_[_0xc388('0x35')]({},_0x46dbb4,_0x3619dc[_0xc388('0x36')]);var _0x5736bb={'where':_0x46dbb4[_0xc388('0x32')]};return db['OpenchannelTransferReport']['count'](_0x5736bb)[_0xc388('0x20')](function(_0x56439a){_0x357f0e['count']=_0x56439a;if(_0x3619dc['query'][_0xc388('0x37')]){_0x46dbb4[_0xc388('0x38')]=[{'all':!![]}];}return db[_0xc388('0x39')][_0xc388('0x3a')](_0x46dbb4);})[_0xc388('0x20')](function(_0x3f26b6){_0x357f0e[_0xc388('0x3b')]=_0x3f26b6;return _0x357f0e;})[_0xc388('0x20')](respondWithFilteredResult(_0x1fd97f,_0x46dbb4))[_0xc388('0x3c')](handleError(_0x1fd97f,null));};exports[_0xc388('0x3d')]=function(_0xe7b26f,_0x9b6246){var _0x3c168f={'raw':!![],'where':{'id':_0xe7b26f[_0xc388('0x3e')]['id']}},_0x32189f={};_0x32189f[_0xc388('0x29')]=_[_0xc388('0x3f')](db[_0xc388('0x39')][_0xc388('0x40')]);_0x32189f[_0xc388('0x2a')]=_['keys'](_0xe7b26f[_0xc388('0x2a')]);_0x32189f['filters']=_['intersection'](_0x32189f['model'],_0x32189f[_0xc388('0x2a')]);_0x3c168f[_0xc388('0x2c')]=_['intersection'](_0x32189f['model'],qs['fields'](_0xe7b26f[_0xc388('0x2a')][_0xc388('0x2d')]));_0x3c168f[_0xc388('0x2c')]=_0x3c168f['attributes'][_0xc388('0x2e')]?_0x3c168f[_0xc388('0x2c')]:_0x32189f[_0xc388('0x29')];if(_0xe7b26f[_0xc388('0x2a')][_0xc388('0x37')]){_0x3c168f[_0xc388('0x38')]=[{'all':!![]}];}_0x3c168f=_['merge']({},_0x3c168f,_0xe7b26f[_0xc388('0x36')]);return db[_0xc388('0x39')][_0xc388('0x41')](_0x3c168f)[_0xc388('0x20')](handleEntityNotFound(_0x9b6246,null))[_0xc388('0x20')](respondWithResult(_0x9b6246,null))[_0xc388('0x3c')](handleError(_0x9b6246,null));};exports[_0xc388('0x42')]=function(_0x2d71e4,_0x1375f9){return db[_0xc388('0x39')]['create'](_0x2d71e4[_0xc388('0x43')],{})[_0xc388('0x20')](respondWithResult(_0x1375f9,0xc9))[_0xc388('0x3c')](handleError(_0x1375f9,null));};exports[_0xc388('0x1f')]=function(_0x661f5f,_0x3c7948){if(_0x661f5f['body']['id']){delete _0x661f5f[_0xc388('0x43')]['id'];}return db['OpenchannelTransferReport'][_0xc388('0x41')]({'where':{'id':_0x661f5f[_0xc388('0x3e')]['id']}})[_0xc388('0x20')](handleEntityNotFound(_0x3c7948,null))['then'](saveUpdates(_0x661f5f[_0xc388('0x43')],null))[_0xc388('0x20')](respondWithResult(_0x3c7948,null))[_0xc388('0x3c')](handleError(_0x3c7948,null));};exports[_0xc388('0x21')]=function(_0x46021b,_0x557efd){return db[_0xc388('0x39')][_0xc388('0x41')]({'where':{'id':_0x46021b[_0xc388('0x3e')]['id']}})[_0xc388('0x20')](handleEntityNotFound(_0x557efd,null))['then'](removeEntity(_0x557efd,null))[_0xc388('0x3c')](handleError(_0x557efd,null));};exports[_0xc388('0x44')]=function(_0x5d34a9,_0x8f73a1){return db[_0xc388('0x39')]['describe']()[_0xc388('0x20')](respondWithResult(_0x8f73a1,null))[_0xc388('0x3c')](handleError(_0x8f73a1,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d8a9117..4a5ce0c 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 _0xa581=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x563a3c,_0x2de16d){var _0x226d5a=function(_0xfac336){while(--_0xfac336){_0x563a3c['push'](_0x563a3c['shift']());}};_0x226d5a(++_0x2de16d);}(_0xa581,0x1ec));var _0x1a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa581[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1a58('0x0'));var util=require(_0x1a58('0x1'));var logger=require(_0x1a58('0x2'))(_0x1a58('0x3'));var moment=require(_0x1a58('0x4'));var BPromise=require(_0x1a58('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1a58('0x6'));var config=require(_0x1a58('0x7'));var attributes=require(_0x1a58('0x8'));module['exports']=function(_0xb43fe7,_0x4783f0){return _0xb43fe7[_0x1a58('0x9')](_0x1a58('0xa'),attributes,{'tableName':_0x1a58('0xb'),'paranoid':![],'indexes':[{'name':_0x1a58('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb25=['uniqueid','moment','request-promise','path','rimraf','exports','define'];(function(_0x1556f4,_0x5acf31){var _0xa4d054=function(_0x560a13){while(--_0x560a13){_0x1556f4['push'](_0x1556f4['shift']());}};_0xa4d054(++_0x5acf31);}(_0xbb25,0x158));var _0x5bb2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbb25[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5bb2('0x0'));var BPromise=require('bluebird');var rp=require(_0x5bb2('0x1'));var fs=require('fs');var path=require(_0x5bb2('0x2'));var rimraf=require(_0x5bb2('0x3'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0x5bb2('0x4')]=function(_0x4af1ae,_0xf5d764){return _0x4af1ae[_0x5bb2('0x5')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x5bb2('0x6'),'fields':[_0x5bb2('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index a9ad028..4b462ff 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 _0x1354=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1354,0x95));var _0x4135=function(_0x147c96,_0x309657){_0x147c96=_0x147c96-0x0;var _0x4ec711=_0x1354[_0x147c96];return _0x4ec711;};'use strict';var _=require(_0x4135('0x0'));var util=require(_0x4135('0x1'));var moment=require(_0x4135('0x2'));var BPromise=require(_0x4135('0x3'));var rs=require(_0x4135('0x4'));var fs=require('fs');var Redis=require(_0x4135('0x5'));var db=require(_0x4135('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4135('0x7'))(_0x4135('0x8'));var config=require(_0x4135('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4135('0xa')][_0x4135('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e355d,_0x419ad4,_0x1dcce0){return new BPromise(function(_0x3e7ae3,_0x50ef3f){return client[_0x4135('0xc')](_0x5e355d,_0x1dcce0)['then'](function(_0x365d9b){logger[_0x4135('0xd')](_0x4135('0xe'),_0x419ad4,_0x4135('0xf'));logger['debug'](_0x4135('0x10'),_0x419ad4,'request\x20sent',JSON['stringify'](_0x365d9b));if(_0x365d9b[_0x4135('0x11')]){if(_0x365d9b[_0x4135('0x11')][_0x4135('0x12')]===0x1f4){logger['error'](_0x4135('0xe'),_0x419ad4,_0x365d9b[_0x4135('0x11')][_0x4135('0x13')]);return _0x50ef3f(_0x365d9b[_0x4135('0x11')][_0x4135('0x13')]);}logger[_0x4135('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x419ad4,_0x365d9b['error'][_0x4135('0x13')]);return _0x3e7ae3(_0x365d9b[_0x4135('0x11')][_0x4135('0x13')]);}else{logger[_0x4135('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x419ad4,_0x4135('0xf'));_0x3e7ae3(_0x365d9b[_0x4135('0x14')]['message']);}})['catch'](function(_0x32b4db){logger['error'](_0x4135('0xe'),_0x419ad4,_0x32b4db);_0x50ef3f(_0x32b4db);});});} \ No newline at end of file +var _0x85d0=['../../config/logger','rpc','jayson/promise','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x38a83c,_0x364abc){var _0x29bed5=function(_0x1105e8){while(--_0x1105e8){_0x38a83c['push'](_0x38a83c['shift']());}};_0x29bed5(++_0x364abc);}(_0x85d0,0x164));var _0x085d=function(_0x45b9aa,_0xfc2170){_0x45b9aa=_0x45b9aa-0x0;var _0x429f9c=_0x85d0[_0x45b9aa];return _0x429f9c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x085d('0x0'));var fs=require('fs');var Redis=require(_0x085d('0x1'));var db=require(_0x085d('0x2'))['db'];var utils=require(_0x085d('0x3'));var logger=require(_0x085d('0x4'))(_0x085d('0x5'));var config=require('../../config/environment');var jayson=require(_0x085d('0x6'));var client=jayson['client'][_0x085d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9acc97,_0x2a6902,_0x4a12b7){return new BPromise(function(_0xf65d01,_0xa94124){return client[_0x085d('0x8')](_0x9acc97,_0x4a12b7)[_0x085d('0x9')](function(_0x349271){logger[_0x085d('0xa')](_0x085d('0xb'),_0x2a6902,_0x085d('0xc'));logger[_0x085d('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2a6902,_0x085d('0xc'),JSON[_0x085d('0xe')](_0x349271));if(_0x349271[_0x085d('0xf')]){if(_0x349271[_0x085d('0xf')]['code']===0x1f4){logger[_0x085d('0xf')](_0x085d('0xb'),_0x2a6902,_0x349271['error'][_0x085d('0x10')]);return _0xa94124(_0x349271[_0x085d('0xf')][_0x085d('0x10')]);}logger[_0x085d('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2a6902,_0x349271[_0x085d('0xf')][_0x085d('0x10')]);return _0xf65d01(_0x349271['error']['message']);}else{logger[_0x085d('0xa')](_0x085d('0xb'),_0x2a6902,_0x085d('0xc'));_0xf65d01(_0x349271[_0x085d('0x11')][_0x085d('0x10')]);}})['catch'](function(_0x2b29be){logger[_0x085d('0xf')](_0x085d('0xb'),_0x2a6902,_0x2b29be);_0xa94124(_0x2b29be);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 5a773ab..d714c3e 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 _0x3236=['index','/:id','show','post','isAuthenticated','put','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x4fd5d3,_0x214090){var _0xf62a8b=function(_0x500b1e){while(--_0x500b1e){_0x4fd5d3['push'](_0x4fd5d3['shift']());}};_0xf62a8b(++_0x214090);}(_0x3236,0x69));var _0x6323=function(_0x325814,_0x5632f5){_0x325814=_0x325814-0x0;var _0x2cdf3e=_0x3236[_0x325814];return _0x2cdf3e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6323('0x0'));var timeout=require(_0x6323('0x1'));var express=require('express');var router=express[_0x6323('0x2')]();var fs_extra=require(_0x6323('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6323('0x4'));var config=require(_0x6323('0x5'));var controller=require('./pause.controller');router[_0x6323('0x6')]('/',auth['isAuthenticated'](),controller[_0x6323('0x7')]);router['get'](_0x6323('0x8'),auth['isAuthenticated'](),controller[_0x6323('0x9')]);router[_0x6323('0xa')]('/',auth[_0x6323('0xb')](),controller['create']);router[_0x6323('0xc')]('/:id',auth[_0x6323('0xb')](),controller['update']);router[_0x6323('0xd')](_0x6323('0x8'),auth['isAuthenticated'](),controller[_0x6323('0xe')]);module[_0x6323('0xf')]=router; \ No newline at end of file +var _0xd96d=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','index','isAuthenticated','show','put','/:id','update','delete','exports'];(function(_0x4c4363,_0x45e80e){var _0xc82c91=function(_0x5dc20c){while(--_0x5dc20c){_0x4c4363['push'](_0x4c4363['shift']());}};_0xc82c91(++_0x45e80e);}(_0xd96d,0x180));var _0xdd96=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd96d[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0xdd96('0x0'));var path=require('path');var timeout=require(_0xdd96('0x1'));var express=require(_0xdd96('0x2'));var router=express['Router']();var fs_extra=require(_0xdd96('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdd96('0x4'));var config=require(_0xdd96('0x5'));var controller=require(_0xdd96('0x6'));router[_0xdd96('0x7')]('/',auth['isAuthenticated'](),controller[_0xdd96('0x8')]);router[_0xdd96('0x7')]('/:id',auth[_0xdd96('0x9')](),controller[_0xdd96('0xa')]);router['post']('/',auth[_0xdd96('0x9')](),controller['create']);router[_0xdd96('0xb')](_0xdd96('0xc'),auth[_0xdd96('0x9')](),controller[_0xdd96('0xd')]);router[_0xdd96('0xe')](_0xdd96('0xc'),auth[_0xdd96('0x9')](),controller['destroy']);module[_0xdd96('0xf')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 6ac58d6..337d8f1 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 _0xf8c3=['sequelize','exports','STRING'];(function(_0x4c91da,_0x4bbebb){var _0x172d2a=function(_0x3465b2){while(--_0x3465b2){_0x4c91da['push'](_0x4c91da['shift']());}};_0x172d2a(++_0x4bbebb);}(_0xf8c3,0xa8));var _0x3f8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf8c3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3f8c('0x0'));module[_0x3f8c('0x1')]={'name':{'type':Sequelize[_0x3f8c('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x30b5=['sequelize','exports','STRING','name'];(function(_0x5c8afe,_0x19c587){var _0x1acb52=function(_0xcc52e1){while(--_0xcc52e1){_0x5c8afe['push'](_0x5c8afe['shift']());}};_0x1acb52(++_0x19c587);}(_0x30b5,0x94));var _0x530b=function(_0x3d27ba,_0x2671a3){_0x3d27ba=_0x3d27ba-0x0;var _0xf01885=_0x30b5[_0x3d27ba];return _0xf01885;};'use strict';var Sequelize=require(_0x530b('0x0'));module[_0x530b('0x1')]={'name':{'type':Sequelize[_0x530b('0x2')],'unique':_0x530b('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x530b('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 5abe503..f074a84 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 _0x5eff=['where','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','order','sort'];(function(_0x4ac48d,_0x171a68){var _0x7537af=function(_0x1c6ca6){while(--_0x1c6ca6){_0x4ac48d['push'](_0x4ac48d['shift']());}};_0x7537af(++_0x171a68);}(_0x5eff,0x160));var _0xf5ef=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x5eff[_0x4d613c];return _0x301fe3;};'use strict';var emlformat=require(_0xf5ef('0x0'));var rimraf=require(_0xf5ef('0x1'));var zipdir=require(_0xf5ef('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf5ef('0x3'));var BPromise=require(_0xf5ef('0x4'));var Mustache=require(_0xf5ef('0x5'));var util=require('util');var path=require(_0xf5ef('0x6'));var sox=require(_0xf5ef('0x7'));var csv=require(_0xf5ef('0x8'));var ejs=require(_0xf5ef('0x9'));var fs=require('fs');var fs_extra=require(_0xf5ef('0xa'));var _=require(_0xf5ef('0xb'));var squel=require(_0xf5ef('0xc'));var crypto=require(_0xf5ef('0xd'));var jsforce=require(_0xf5ef('0xe'));var deskjs=require(_0xf5ef('0xf'));var toCsv=require(_0xf5ef('0x8'));var querystring=require(_0xf5ef('0x10'));var Papa=require(_0xf5ef('0x11'));var Redis=require('ioredis');var authService=require(_0xf5ef('0x12'));var qs=require(_0xf5ef('0x13'));var as=require(_0xf5ef('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5ef('0x15'))(_0xf5ef('0x16'));var utils=require(_0xf5ef('0x17'));var config=require(_0xf5ef('0x18'));var licenseUtil=require(_0xf5ef('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x530264,_0x26ab96){_0x26ab96=_0x26ab96||0xcc;return function(_0x27a396){if(_0x27a396){return _0x530264[_0xf5ef('0x1a')](_0x26ab96);}return _0x530264[_0xf5ef('0x1b')](_0x26ab96)[_0xf5ef('0x1c')]();};}function respondWithResult(_0x16861a,_0x5eb4cf){_0x5eb4cf=_0x5eb4cf||0xc8;return function(_0x5adc1b){if(_0x5adc1b){return _0x16861a[_0xf5ef('0x1b')](_0x5eb4cf)[_0xf5ef('0x1d')](_0x5adc1b);}};}function respondWithFilteredResult(_0x2200c7,_0x4ba9fa){return function(_0x567ef3){if(_0x567ef3){var _0x2eaedb=typeof _0x4ba9fa[_0xf5ef('0x1e')]===_0xf5ef('0x1f')&&typeof _0x4ba9fa[_0xf5ef('0x20')]===_0xf5ef('0x1f');var _0xa5ed3f=_0x567ef3['count'];var _0x52b939=_0x2eaedb?0x0:_0x4ba9fa[_0xf5ef('0x1e')];var _0x178b07=_0x2eaedb?_0x567ef3[_0xf5ef('0x21')]:_0x4ba9fa[_0xf5ef('0x1e')]+_0x4ba9fa[_0xf5ef('0x20')];var _0x2f3de8;if(_0x178b07>=_0xa5ed3f){_0x178b07=_0xa5ed3f;_0x2f3de8=0xc8;}else{_0x2f3de8=0xce;}_0x2200c7[_0xf5ef('0x1b')](_0x2f3de8);return _0x2200c7[_0xf5ef('0x22')](_0xf5ef('0x23'),_0x52b939+'-'+_0x178b07+'/'+_0xa5ed3f)[_0xf5ef('0x1d')](_0x567ef3);}return null;};}function patchUpdates(_0x2166f6){return function(_0x3cfa25){try{jsonpatch['apply'](_0x3cfa25,_0x2166f6,!![]);}catch(_0x12f6d4){return BPromise[_0xf5ef('0x24')](_0x12f6d4);}return _0x3cfa25[_0xf5ef('0x25')]();};}function saveUpdates(_0x45e4e4,_0x10b384){return function(_0x34592d){if(_0x34592d){return _0x34592d[_0xf5ef('0x26')](_0x45e4e4)[_0xf5ef('0x27')](function(_0x2b5a47){return _0x2b5a47;});}return null;};}function removeEntity(_0x2fc03a,_0x569f41){return function(_0x434075){if(_0x434075){return _0x434075[_0xf5ef('0x28')]()['then'](function(){var _0x1e89af=_0x434075['get']({'plain':!![]});var _0x5be3f7=_0xf5ef('0x29');return db[_0xf5ef('0x2a')]['destroy']({'where':{'type':_0x5be3f7,'resourceId':_0x1e89af['id']}})['then'](function(){return _0x434075;});})[_0xf5ef('0x27')](function(){_0x2fc03a['status'](0xcc)[_0xf5ef('0x1c')]();});}};}function handleEntityNotFound(_0x5354a4,_0x28200e){return function(_0x3a514a){if(!_0x3a514a){_0x5354a4['sendStatus'](0x194);}return _0x3a514a;};}function handleError(_0x5a5edd,_0x5082d7){_0x5082d7=_0x5082d7||0x1f4;return function(_0x3ac1d5){logger[_0xf5ef('0x2b')](_0x3ac1d5[_0xf5ef('0x2c')]);if(_0x3ac1d5[_0xf5ef('0x2d')]){delete _0x3ac1d5[_0xf5ef('0x2d')];}_0x5a5edd['status'](_0x5082d7)[_0xf5ef('0x2e')](_0x3ac1d5);};}exports[_0xf5ef('0x2f')]=function(_0x2bdfa9,_0xc0c700){var _0x48f135={},_0x2d32a5={},_0x3ae7d8={'count':0x0,'rows':[]};var _0x5e5136=_[_0xf5ef('0x30')](db[_0xf5ef('0x31')][_0xf5ef('0x32')],function(_0x5320b2){return{'name':_0x5320b2[_0xf5ef('0x33')],'type':_0x5320b2[_0xf5ef('0x34')][_0xf5ef('0x35')]};});_0x2d32a5['model']=_[_0xf5ef('0x30')](_0x5e5136,'name');_0x2d32a5[_0xf5ef('0x36')]=_['keys'](_0x2bdfa9[_0xf5ef('0x36')]);_0x2d32a5[_0xf5ef('0x37')]=_[_0xf5ef('0x38')](_0x2d32a5['model'],_0x2d32a5['query']);_0x48f135[_0xf5ef('0x39')]=_[_0xf5ef('0x38')](_0x2d32a5[_0xf5ef('0x3a')],qs[_0xf5ef('0x3b')](_0x2bdfa9[_0xf5ef('0x36')][_0xf5ef('0x3b')]));_0x48f135[_0xf5ef('0x39')]=_0x48f135['attributes'][_0xf5ef('0x3c')]?_0x48f135[_0xf5ef('0x39')]:_0x2d32a5['model'];if(!_0x2bdfa9['query']['hasOwnProperty']('nolimit')){_0x48f135['limit']=qs[_0xf5ef('0x20')](_0x2bdfa9[_0xf5ef('0x36')][_0xf5ef('0x20')]);_0x48f135[_0xf5ef('0x1e')]=qs[_0xf5ef('0x1e')](_0x2bdfa9[_0xf5ef('0x36')][_0xf5ef('0x1e')]);}_0x48f135[_0xf5ef('0x3d')]=qs[_0xf5ef('0x3e')](_0x2bdfa9[_0xf5ef('0x36')][_0xf5ef('0x3e')]);_0x48f135[_0xf5ef('0x3f')]=qs[_0xf5ef('0x37')](_[_0xf5ef('0x40')](_0x2bdfa9[_0xf5ef('0x36')],_0x2d32a5[_0xf5ef('0x37')]),_0x5e5136);if(_0x2bdfa9[_0xf5ef('0x36')][_0xf5ef('0x41')]){_0x48f135[_0xf5ef('0x3f')]=_['merge'](_0x48f135[_0xf5ef('0x3f')],{'$or':_[_0xf5ef('0x30')](_0x5e5136,function(_0x4412f3){if(_0x4412f3[_0xf5ef('0x34')]!==_0xf5ef('0x42')){var _0x295187={};_0x295187[_0x4412f3[_0xf5ef('0x2d')]]={'$like':'%'+_0x2bdfa9[_0xf5ef('0x36')][_0xf5ef('0x41')]+'%'};return _0x295187;}})});}_0x48f135=_[_0xf5ef('0x43')]({},_0x48f135,_0x2bdfa9[_0xf5ef('0x44')]);var _0x557224={'where':_0x48f135[_0xf5ef('0x3f')]};return db[_0xf5ef('0x31')][_0xf5ef('0x21')](_0x557224)['then'](function(_0x22972c){_0x3ae7d8[_0xf5ef('0x21')]=_0x22972c;if(_0x2bdfa9['query']['includeAll']){_0x48f135[_0xf5ef('0x45')]=[{'all':!![]}];}return db[_0xf5ef('0x31')]['findAll'](_0x48f135);})[_0xf5ef('0x27')](function(_0x835cfc){_0x3ae7d8[_0xf5ef('0x46')]=_0x835cfc;return _0x3ae7d8;})['then'](respondWithFilteredResult(_0xc0c700,_0x48f135))[_0xf5ef('0x47')](handleError(_0xc0c700,null));};exports[_0xf5ef('0x48')]=function(_0x3cb195,_0xf3d0e9){var _0x13ce32={'raw':!![],'where':{'id':_0x3cb195[_0xf5ef('0x49')]['id']}},_0x4ad9a2={};_0x4ad9a2[_0xf5ef('0x3a')]=_[_0xf5ef('0x4a')](db[_0xf5ef('0x31')][_0xf5ef('0x32')]);_0x4ad9a2[_0xf5ef('0x36')]=_['keys'](_0x3cb195[_0xf5ef('0x36')]);_0x4ad9a2[_0xf5ef('0x37')]=_[_0xf5ef('0x38')](_0x4ad9a2['model'],_0x4ad9a2[_0xf5ef('0x36')]);_0x13ce32['attributes']=_['intersection'](_0x4ad9a2['model'],qs[_0xf5ef('0x3b')](_0x3cb195[_0xf5ef('0x36')]['fields']));_0x13ce32['attributes']=_0x13ce32[_0xf5ef('0x39')]['length']?_0x13ce32[_0xf5ef('0x39')]:_0x4ad9a2[_0xf5ef('0x3a')];if(_0x3cb195[_0xf5ef('0x36')]['includeAll']){_0x13ce32[_0xf5ef('0x45')]=[{'all':!![]}];}_0x13ce32=_['merge']({},_0x13ce32,_0x3cb195[_0xf5ef('0x44')]);return db['Pause'][_0xf5ef('0x4b')](_0x13ce32)['then'](handleEntityNotFound(_0xf3d0e9,null))['then'](respondWithResult(_0xf3d0e9,null))[_0xf5ef('0x47')](handleError(_0xf3d0e9,null));};exports[_0xf5ef('0x4c')]=function(_0x2c2393,_0x28efdb){return db[_0xf5ef('0x31')]['create'](_0x2c2393[_0xf5ef('0x4d')],{})[_0xf5ef('0x27')](function(_0x5c4602){var _0x5e4a32=_0x2c2393[_0xf5ef('0x4e')][_0xf5ef('0x4f')]({'plain':!![]});if(!_0x5e4a32)throw new Error(_0xf5ef('0x50'));if(_0x5e4a32['role']===_0xf5ef('0x4e')){var _0x3f56e1=_0x5c4602['get']({'plain':!![]});var _0x219350='Pauses';return db['UserProfileSection'][_0xf5ef('0x4b')]({'where':{'name':_0x219350,'userProfileId':_0x5e4a32[_0xf5ef('0x51')]},'raw':!![]})[_0xf5ef('0x27')](function(_0x4ecfa0){if(_0x4ecfa0&&_0x4ecfa0[_0xf5ef('0x52')]===0x0){return db[_0xf5ef('0x2a')][_0xf5ef('0x4c')]({'name':_0x3f56e1['name'],'resourceId':_0x3f56e1['id'],'type':_0x4ecfa0[_0xf5ef('0x2d')],'sectionId':_0x4ecfa0['id']},{})['then'](function(){return _0x5c4602;});}else{return _0x5c4602;}})[_0xf5ef('0x47')](function(_0x3f7f7a){logger[_0xf5ef('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f7f7a);throw _0x3f7f7a;});}return _0x5c4602;})[_0xf5ef('0x27')](respondWithResult(_0x28efdb,0xc9))[_0xf5ef('0x47')](handleError(_0x28efdb,null));};exports[_0xf5ef('0x26')]=function(_0x3657e5,_0x26ce67){if(_0x3657e5['body']['id']){delete _0x3657e5[_0xf5ef('0x4d')]['id'];}return db['Pause'][_0xf5ef('0x4b')]({'where':{'id':_0x3657e5[_0xf5ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x26ce67,null))[_0xf5ef('0x27')](saveUpdates(_0x3657e5['body'],null))['then'](respondWithResult(_0x26ce67,null))[_0xf5ef('0x47')](handleError(_0x26ce67,null));};exports[_0xf5ef('0x28')]=function(_0x7a56de,_0x7118f5){return db[_0xf5ef('0x31')][_0xf5ef('0x4b')]({'where':{'id':_0x7a56de[_0xf5ef('0x49')]['id']}})[_0xf5ef('0x27')](handleEntityNotFound(_0x7118f5,null))[_0xf5ef('0x27')](removeEntity(_0x7118f5,null))[_0xf5ef('0x47')](handleError(_0x7118f5,null));}; \ No newline at end of file +var _0x472d=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','get','Pauses','UserProfileResource','name','send','map','Pause','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x54c6c8,_0x3e5966){var _0x534f31=function(_0x387978){while(--_0x387978){_0x54c6c8['push'](_0x54c6c8['shift']());}};_0x534f31(++_0x3e5966);}(_0x472d,0x137));var _0xd472=function(_0x159b6a,_0x516ade){_0x159b6a=_0x159b6a-0x0;var _0x5de8a4=_0x472d[_0x159b6a];return _0x5de8a4;};'use strict';var emlformat=require(_0xd472('0x0'));var rimraf=require(_0xd472('0x1'));var zipdir=require(_0xd472('0x2'));var jsonpatch=require(_0xd472('0x3'));var rp=require(_0xd472('0x4'));var moment=require(_0xd472('0x5'));var BPromise=require(_0xd472('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd472('0x7'));var csv=require(_0xd472('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd472('0x9'));var _=require('lodash');var squel=require(_0xd472('0xa'));var crypto=require(_0xd472('0xb'));var jsforce=require(_0xd472('0xc'));var deskjs=require(_0xd472('0xd'));var toCsv=require(_0xd472('0x8'));var querystring=require(_0xd472('0xe'));var Papa=require(_0xd472('0xf'));var Redis=require(_0xd472('0x10'));var authService=require(_0xd472('0x11'));var qs=require(_0xd472('0x12'));var as=require(_0xd472('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd472('0x14'))('api');var utils=require(_0xd472('0x15'));var config=require(_0xd472('0x16'));var licenseUtil=require(_0xd472('0x17'));var db=require(_0xd472('0x18'))['db'];function respondWithStatusCode(_0x46ad02,_0x2c3316){_0x2c3316=_0x2c3316||0xcc;return function(_0x5c0264){if(_0x5c0264){return _0x46ad02[_0xd472('0x19')](_0x2c3316);}return _0x46ad02[_0xd472('0x1a')](_0x2c3316)[_0xd472('0x1b')]();};}function respondWithResult(_0x52d2df,_0x35bfb3){_0x35bfb3=_0x35bfb3||0xc8;return function(_0x27bd06){if(_0x27bd06){return _0x52d2df[_0xd472('0x1a')](_0x35bfb3)['json'](_0x27bd06);}};}function respondWithFilteredResult(_0x1520e1,_0xd88dfa){return function(_0x24b657){if(_0x24b657){var _0x33463c=typeof _0xd88dfa['offset']===_0xd472('0x1c')&&typeof _0xd88dfa[_0xd472('0x1d')]===_0xd472('0x1c');var _0x5a005f=_0x24b657['count'];var _0x290f3b=_0x33463c?0x0:_0xd88dfa[_0xd472('0x1e')];var _0x16c3ae=_0x33463c?_0x24b657[_0xd472('0x1f')]:_0xd88dfa['offset']+_0xd88dfa[_0xd472('0x1d')];var _0x413d05;if(_0x16c3ae>=_0x5a005f){_0x16c3ae=_0x5a005f;_0x413d05=0xc8;}else{_0x413d05=0xce;}_0x1520e1[_0xd472('0x1a')](_0x413d05);return _0x1520e1[_0xd472('0x20')](_0xd472('0x21'),_0x290f3b+'-'+_0x16c3ae+'/'+_0x5a005f)['json'](_0x24b657);}return null;};}function patchUpdates(_0x355053){return function(_0x36f8af){try{jsonpatch['apply'](_0x36f8af,_0x355053,!![]);}catch(_0x57df17){return BPromise[_0xd472('0x22')](_0x57df17);}return _0x36f8af[_0xd472('0x23')]();};}function saveUpdates(_0x344bb5,_0x2bc5bf){return function(_0x57dc56){if(_0x57dc56){return _0x57dc56[_0xd472('0x24')](_0x344bb5)[_0xd472('0x25')](function(_0x21225b){return _0x21225b;});}return null;};}function removeEntity(_0x4607ca,_0x25644d){return function(_0x4d3b5d){if(_0x4d3b5d){return _0x4d3b5d[_0xd472('0x26')]()['then'](function(){var _0x4cb625=_0x4d3b5d[_0xd472('0x27')]({'plain':!![]});var _0x385101=_0xd472('0x28');return db[_0xd472('0x29')][_0xd472('0x26')]({'where':{'type':_0x385101,'resourceId':_0x4cb625['id']}})['then'](function(){return _0x4d3b5d;});})[_0xd472('0x25')](function(){_0x4607ca['status'](0xcc)[_0xd472('0x1b')]();});}};}function handleEntityNotFound(_0x7db4c4,_0x5ca424){return function(_0xdf7745){if(!_0xdf7745){_0x7db4c4[_0xd472('0x19')](0x194);}return _0xdf7745;};}function handleError(_0x204e7e,_0x4537cf){_0x4537cf=_0x4537cf||0x1f4;return function(_0x1d6bcf){logger['error'](_0x1d6bcf['stack']);if(_0x1d6bcf[_0xd472('0x2a')]){delete _0x1d6bcf[_0xd472('0x2a')];}_0x204e7e[_0xd472('0x1a')](_0x4537cf)[_0xd472('0x2b')](_0x1d6bcf);};}exports['index']=function(_0x4768af,_0x12fd8a){var _0x30bdc6={},_0x55e5ce={},_0x51cbbe={'count':0x0,'rows':[]};var _0x1ffd8b=_[_0xd472('0x2c')](db[_0xd472('0x2d')][_0xd472('0x2e')],function(_0x3cd8b1){return{'name':_0x3cd8b1[_0xd472('0x2f')],'type':_0x3cd8b1[_0xd472('0x30')][_0xd472('0x31')]};});_0x55e5ce[_0xd472('0x32')]=_['map'](_0x1ffd8b,_0xd472('0x2a'));_0x55e5ce['query']=_[_0xd472('0x33')](_0x4768af[_0xd472('0x34')]);_0x55e5ce[_0xd472('0x35')]=_[_0xd472('0x36')](_0x55e5ce[_0xd472('0x32')],_0x55e5ce['query']);_0x30bdc6[_0xd472('0x37')]=_[_0xd472('0x36')](_0x55e5ce[_0xd472('0x32')],qs[_0xd472('0x38')](_0x4768af[_0xd472('0x34')][_0xd472('0x38')]));_0x30bdc6[_0xd472('0x37')]=_0x30bdc6['attributes']['length']?_0x30bdc6['attributes']:_0x55e5ce[_0xd472('0x32')];if(!_0x4768af['query']['hasOwnProperty'](_0xd472('0x39'))){_0x30bdc6[_0xd472('0x1d')]=qs[_0xd472('0x1d')](_0x4768af[_0xd472('0x34')][_0xd472('0x1d')]);_0x30bdc6[_0xd472('0x1e')]=qs[_0xd472('0x1e')](_0x4768af[_0xd472('0x34')][_0xd472('0x1e')]);}_0x30bdc6['order']=qs[_0xd472('0x3a')](_0x4768af[_0xd472('0x34')]['sort']);_0x30bdc6['where']=qs[_0xd472('0x35')](_[_0xd472('0x3b')](_0x4768af[_0xd472('0x34')],_0x55e5ce[_0xd472('0x35')]),_0x1ffd8b);if(_0x4768af['query'][_0xd472('0x3c')]){_0x30bdc6[_0xd472('0x3d')]=_[_0xd472('0x3e')](_0x30bdc6['where'],{'$or':_['map'](_0x1ffd8b,function(_0x2bc490){if(_0x2bc490['type']!==_0xd472('0x3f')){var _0x12db88={};_0x12db88[_0x2bc490[_0xd472('0x2a')]]={'$like':'%'+_0x4768af['query'][_0xd472('0x3c')]+'%'};return _0x12db88;}})});}_0x30bdc6=_[_0xd472('0x3e')]({},_0x30bdc6,_0x4768af[_0xd472('0x40')]);var _0x96d425={'where':_0x30bdc6[_0xd472('0x3d')]};return db[_0xd472('0x2d')][_0xd472('0x1f')](_0x96d425)['then'](function(_0x298050){_0x51cbbe[_0xd472('0x1f')]=_0x298050;if(_0x4768af[_0xd472('0x34')][_0xd472('0x41')]){_0x30bdc6[_0xd472('0x42')]=[{'all':!![]}];}return db[_0xd472('0x2d')][_0xd472('0x43')](_0x30bdc6);})[_0xd472('0x25')](function(_0x443ab4){_0x51cbbe[_0xd472('0x44')]=_0x443ab4;return _0x51cbbe;})[_0xd472('0x25')](respondWithFilteredResult(_0x12fd8a,_0x30bdc6))[_0xd472('0x45')](handleError(_0x12fd8a,null));};exports[_0xd472('0x46')]=function(_0x1ecf45,_0x265414){var _0x4dd139={'raw':!![],'where':{'id':_0x1ecf45[_0xd472('0x47')]['id']}},_0x57ec7d={};_0x57ec7d[_0xd472('0x32')]=_[_0xd472('0x33')](db[_0xd472('0x2d')][_0xd472('0x2e')]);_0x57ec7d[_0xd472('0x34')]=_[_0xd472('0x33')](_0x1ecf45[_0xd472('0x34')]);_0x57ec7d['filters']=_[_0xd472('0x36')](_0x57ec7d['model'],_0x57ec7d[_0xd472('0x34')]);_0x4dd139['attributes']=_[_0xd472('0x36')](_0x57ec7d[_0xd472('0x32')],qs[_0xd472('0x38')](_0x1ecf45[_0xd472('0x34')][_0xd472('0x38')]));_0x4dd139['attributes']=_0x4dd139['attributes'][_0xd472('0x48')]?_0x4dd139[_0xd472('0x37')]:_0x57ec7d['model'];if(_0x1ecf45[_0xd472('0x34')][_0xd472('0x41')]){_0x4dd139['include']=[{'all':!![]}];}_0x4dd139=_[_0xd472('0x3e')]({},_0x4dd139,_0x1ecf45[_0xd472('0x40')]);return db[_0xd472('0x2d')][_0xd472('0x49')](_0x4dd139)[_0xd472('0x25')](handleEntityNotFound(_0x265414,null))[_0xd472('0x25')](respondWithResult(_0x265414,null))['catch'](handleError(_0x265414,null));};exports[_0xd472('0x4a')]=function(_0x4dd7f4,_0x6adbbc){return db['Pause'][_0xd472('0x4a')](_0x4dd7f4[_0xd472('0x4b')],{})[_0xd472('0x25')](function(_0x5d95b9){var _0x342673=_0x4dd7f4[_0xd472('0x4c')][_0xd472('0x27')]({'plain':!![]});if(!_0x342673)throw new Error(_0xd472('0x4d'));if(_0x342673[_0xd472('0x4e')]===_0xd472('0x4c')){var _0x40e313=_0x5d95b9[_0xd472('0x27')]({'plain':!![]});var _0x77b037='Pauses';return db[_0xd472('0x4f')]['find']({'where':{'name':_0x77b037,'userProfileId':_0x342673[_0xd472('0x50')]},'raw':!![]})['then'](function(_0x5b0f71){if(_0x5b0f71&&_0x5b0f71[_0xd472('0x51')]===0x0){return db[_0xd472('0x29')][_0xd472('0x4a')]({'name':_0x40e313['name'],'resourceId':_0x40e313['id'],'type':_0x5b0f71[_0xd472('0x2a')],'sectionId':_0x5b0f71['id']},{})['then'](function(){return _0x5d95b9;});}else{return _0x5d95b9;}})[_0xd472('0x45')](function(_0x23f3cc){logger[_0xd472('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23f3cc);throw _0x23f3cc;});}return _0x5d95b9;})['then'](respondWithResult(_0x6adbbc,0xc9))[_0xd472('0x45')](handleError(_0x6adbbc,null));};exports['update']=function(_0x469fb7,_0x563ca0){if(_0x469fb7['body']['id']){delete _0x469fb7[_0xd472('0x4b')]['id'];}return db['Pause'][_0xd472('0x49')]({'where':{'id':_0x469fb7[_0xd472('0x47')]['id']}})[_0xd472('0x25')](handleEntityNotFound(_0x563ca0,null))[_0xd472('0x25')](saveUpdates(_0x469fb7[_0xd472('0x4b')],null))[_0xd472('0x25')](respondWithResult(_0x563ca0,null))[_0xd472('0x45')](handleError(_0x563ca0,null));};exports[_0xd472('0x26')]=function(_0x3f2e3,_0x161c01){return db[_0xd472('0x2d')]['find']({'where':{'id':_0x3f2e3['params']['id']}})[_0xd472('0x25')](handleEntityNotFound(_0x161c01,null))[_0xd472('0x25')](removeEntity(_0x161c01,null))[_0xd472('0x45')](handleError(_0x161c01,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 1bf2ef1..40056ac 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 _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x3104ae,_0x2ba4bf){var _0x306c53=function(_0xef4612){while(--_0xef4612){_0x3104ae['push'](_0x3104ae['shift']());}};_0x306c53(++_0x2ba4bf);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5f2593,_0x2943d9){_0x5f2593=_0x5f2593-0x0;var _0x2fe505=_0x8ef6[_0x5f2593];return _0x2fe505;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x279368,_0x41c002){_0x279368=_0x279368-0x0;var _0x40b6d0=_0x7fbe[_0x279368];return _0x40b6d0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'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 99ca48b..6e06f77 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(_0x26ec53,_0x26a758){var _0x571005=function(_0x103bcd){while(--_0x103bcd){_0x26ec53['push'](_0x26ec53['shift']());}};_0x571005(++_0x26a758);}(_0x7a54,0x106));var _0x47a5=function(_0x5b63b3,_0x1e77cd){_0x5b63b3=_0x5b63b3-0x0;var _0x5b5ff7=_0x7a54[_0x5b63b3];return _0x5b5ff7;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x4a3dfc,_0x4124ec){var _0x2f3ba9=function(_0x2f8457){while(--_0x2f8457){_0x4a3dfc['push'](_0x4a3dfc['shift']());}};_0x2f3ba9(++_0x4124ec);}(_0xb10b,0x12a));var _0xbb10=function(_0x4db341,_0xb12794){_0x4db341=_0x4db341-0x0;var _0x193cb0=_0xb10b[_0x4db341];return _0x193cb0;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 4b210a4..9542ebf 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 _0xc3b5=['server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','webhookPost','/:id','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/webhook','webhookGet','show','/:id/download','download','diskStorage','root'];(function(_0x5a2358,_0x16bfff){var _0x2be9f1=function(_0x953797){while(--_0x953797){_0x5a2358['push'](_0x5a2358['shift']());}};_0x2be9f1(++_0x16bfff);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x135a51,_0x1842de){_0x135a51=_0x135a51-0x0;var _0x5dce00=_0xc3b5[_0x135a51];return _0x5dce00;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c3b('0x0'));var timeout=require(_0x5c3b('0x1'));var express=require(_0x5c3b('0x2'));var router=express[_0x5c3b('0x3')]();var fs_extra=require(_0x5c3b('0x4'));var auth=require(_0x5c3b('0x5'));var interaction=require(_0x5c3b('0x6'));var config=require(_0x5c3b('0x7'));var controller=require('./plugin.controller');router[_0x5c3b('0x8')]('/',auth[_0x5c3b('0x9')](),controller['index']);router[_0x5c3b('0x8')](_0x5c3b('0xa'),controller[_0x5c3b('0xb')]);router[_0x5c3b('0x8')]('/:id',auth[_0x5c3b('0x9')](),controller[_0x5c3b('0xc')]);router[_0x5c3b('0x8')](_0x5c3b('0xd'),auth['isAuthenticated'](),controller[_0x5c3b('0xe')]);var upload=multer({'storage':multer[_0x5c3b('0xf')]({'destination':function(_0x30ceca,_0x2e894a,_0x363c3d){_0x363c3d(null,path['join'](config[_0x5c3b('0x10')],_0x5c3b('0x11')));},'filename':function(_0x589c36,_0x1b2815,_0x3b953d){_0x1b2815['originalname']=_0x1b2815[_0x5c3b('0x12')][_0x5c3b('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3b953d(null,util[_0x5c3b('0x14')](_0x5c3b('0x15'),path[_0x5c3b('0x16')](_0x1b2815[_0x5c3b('0x12')],path[_0x5c3b('0x17')](_0x1b2815['originalname'])),Date[_0x5c3b('0x18')](),path['extname'](_0x1b2815['originalname'])));}})});router[_0x5c3b('0x19')]('/',upload[_0x5c3b('0x1a')](_0x5c3b('0x1b')),controller['upload']);router[_0x5c3b('0x19')](_0x5c3b('0xa'),controller[_0x5c3b('0x1c')]);router['put'](_0x5c3b('0x1d'),auth[_0x5c3b('0x9')](),controller['update']);router[_0x5c3b('0x1e')](_0x5c3b('0x1d'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0x1e')]);module[_0x5c3b('0x1f')]=router; \ No newline at end of file +var _0x0ba7=['../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','diskStorage','server/files/plugins','originalname','format','basename','extname','now','post','single','file','upload','webhookPost','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x32a461,_0x3bf1c2){var _0x7524f9=function(_0x22ae93){while(--_0x22ae93){_0x32a461['push'](_0x32a461['shift']());}};_0x7524f9(++_0x3bf1c2);}(_0x0ba7,0x16d));var _0x70ba=function(_0x49c8eb,_0x35c212){_0x49c8eb=_0x49c8eb-0x0;var _0x42dee3=_0x0ba7[_0x49c8eb];return _0x42dee3;};'use strict';var multer=require(_0x70ba('0x0'));var util=require('util');var path=require(_0x70ba('0x1'));var timeout=require(_0x70ba('0x2'));var express=require(_0x70ba('0x3'));var router=express[_0x70ba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x70ba('0x5'));var interaction=require(_0x70ba('0x6'));var config=require(_0x70ba('0x7'));var controller=require(_0x70ba('0x8'));router[_0x70ba('0x9')]('/',auth[_0x70ba('0xa')](),controller[_0x70ba('0xb')]);router[_0x70ba('0x9')](_0x70ba('0xc'),controller[_0x70ba('0xd')]);router[_0x70ba('0x9')](_0x70ba('0xe'),auth[_0x70ba('0xa')](),controller[_0x70ba('0xf')]);router[_0x70ba('0x9')]('/:id/download',auth[_0x70ba('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x70ba('0x10')]({'destination':function(_0x258604,_0xfc4de3,_0x3cf8ab){_0x3cf8ab(null,path['join'](config['root'],_0x70ba('0x11')));},'filename':function(_0x4a2c2e,_0xd6580e,_0x5e94c7){_0xd6580e[_0x70ba('0x12')]=_0xd6580e[_0x70ba('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5e94c7(null,util[_0x70ba('0x13')]('%s-%s%s',path[_0x70ba('0x14')](_0xd6580e[_0x70ba('0x12')],path[_0x70ba('0x15')](_0xd6580e[_0x70ba('0x12')])),Date[_0x70ba('0x16')](),path[_0x70ba('0x15')](_0xd6580e[_0x70ba('0x12')])));}})});router[_0x70ba('0x17')]('/',upload[_0x70ba('0x18')](_0x70ba('0x19')),controller[_0x70ba('0x1a')]);router[_0x70ba('0x17')](_0x70ba('0xc'),controller[_0x70ba('0x1b')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x70ba('0x1c')]);router[_0x70ba('0x1d')](_0x70ba('0xe'),auth[_0x70ba('0xa')](),controller[_0x70ba('0x1d')]);module[_0x70ba('0x1e')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 95d95e9..50cdf71 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 _0x0436=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script','TEXT'];(function(_0x59ddcb,_0x1add6f){var _0x348f84=function(_0x2fd3e6){while(--_0x2fd3e6){_0x59ddcb['push'](_0x59ddcb['shift']());}};_0x348f84(++_0x1add6f);}(_0x0436,0x96));var _0x6043=function(_0x21799b,_0x4694af){_0x21799b=_0x21799b-0x0;var _0x317530=_0x0436[_0x21799b];return _0x317530;};'use strict';var Sequelize=require(_0x6043('0x0'));module[_0x6043('0x1')]={'name':{'type':Sequelize[_0x6043('0x2')]},'type':{'type':Sequelize['ENUM'](_0x6043('0x3'),_0x6043('0x4'))},'description':{'type':Sequelize[_0x6043('0x5')]},'version':{'type':Sequelize[_0x6043('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x6043('0x6')},'active':{'type':Sequelize[_0x6043('0x7')],'defaultValue':0x0,'comment':_0x6043('0x8')},'sidebar':{'type':Sequelize[_0x6043('0x9')](_0x6043('0xa'),'agentOnly',_0x6043('0xb'),'never'),'defaultValue':_0x6043('0xb'),'comment':_0x6043('0xc')},'icon':{'type':Sequelize[_0x6043('0x2')]},'adminUrl':{'type':Sequelize[_0x6043('0x2')]},'agentUrl':{'type':Sequelize[_0x6043('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x6043('0x2')]}}; \ No newline at end of file +var _0xf47b=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT'];(function(_0x195405,_0x28f25e){var _0x1deba1=function(_0x5c2398){while(--_0x5c2398){_0x195405['push'](_0x195405['shift']());}};_0x1deba1(++_0x28f25e);}(_0xf47b,0x7d));var _0xbf47=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xf47b[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0xbf47('0x0'));module[_0xbf47('0x1')]={'name':{'type':Sequelize[_0xbf47('0x2')]},'type':{'type':Sequelize[_0xbf47('0x3')](_0xbf47('0x4'),_0xbf47('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xbf47('0x6')]},'path':{'type':Sequelize[_0xbf47('0x2')],'comment':_0xbf47('0x7')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xbf47('0x3')](_0xbf47('0x8'),_0xbf47('0x9'),'always','never'),'defaultValue':_0xbf47('0xa'),'comment':_0xbf47('0xb')},'icon':{'type':Sequelize[_0xbf47('0x2')]},'adminUrl':{'type':Sequelize[_0xbf47('0x2')]},'agentUrl':{'type':Sequelize[_0xbf47('0x2')]},'scriptName':{'type':Sequelize[_0xbf47('0x2')]},'scriptPath':{'type':Sequelize[_0xbf47('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 30c538f..0522a50 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 _0xce44=['sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','node_modules/**/*','attachments/**/*','finalize','close','existsSync','download','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','icon-apps','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','body','role','user','get','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','method','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','Plugins','UserProfileResource','destroy','error','stack','send','index','Plugin','rawAttributes','fieldName','type','key','model','map','name','query','filters','intersection','attributes','fields','nolimit'];(function(_0x392ea9,_0xfe8969){var _0x389de4=function(_0xf1362f){while(--_0xf1362f){_0x392ea9['push'](_0x392ea9['shift']());}};_0x389de4(++_0xfe8969);}(_0xce44,0x1c5));var _0x4ce4=function(_0x5be264,_0x3d8605){_0x5be264=_0x5be264-0x0;var _0x149d49=_0xce44[_0x5be264];return _0x149d49;};'use strict';var emlformat=require(_0x4ce4('0x0'));var rimraf=require(_0x4ce4('0x1'));var zipdir=require(_0x4ce4('0x2'));var jsonpatch=require(_0x4ce4('0x3'));var rp=require(_0x4ce4('0x4'));var moment=require(_0x4ce4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4ce4('0x6'));var util=require(_0x4ce4('0x7'));var path=require(_0x4ce4('0x8'));var sox=require(_0x4ce4('0x9'));var csv=require('to-csv');var ejs=require(_0x4ce4('0xa'));var fs=require('fs');var fs_extra=require(_0x4ce4('0xb'));var _=require(_0x4ce4('0xc'));var squel=require(_0x4ce4('0xd'));var crypto=require(_0x4ce4('0xe'));var jsforce=require(_0x4ce4('0xf'));var deskjs=require(_0x4ce4('0x10'));var toCsv=require(_0x4ce4('0x11'));var querystring=require('querystring');var Papa=require(_0x4ce4('0x12'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x4ce4('0x13'));var authService=require(_0x4ce4('0x14'));var qs=require(_0x4ce4('0x15'));var as=require(_0x4ce4('0x16'));var hardwareService=require(_0x4ce4('0x17'));var logger=require(_0x4ce4('0x18'))(_0x4ce4('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4ce4('0x1a'));var db=require(_0x4ce4('0x1b'))['db'];config['redis']=_[_0x4ce4('0x1c')](config[_0x4ce4('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4ce4('0x1e'))[_0x4ce4('0x1f')](socket);function respondWithStatusCode(_0x6cf56d,_0x4c3c6c){_0x4c3c6c=_0x4c3c6c||0xcc;return function(_0x104a77){if(_0x104a77){return _0x6cf56d[_0x4ce4('0x20')](_0x4c3c6c);}return _0x6cf56d[_0x4ce4('0x21')](_0x4c3c6c)[_0x4ce4('0x22')]();};}function respondWithResult(_0x5f2273,_0x143852){_0x143852=_0x143852||0xc8;return function(_0x102025){if(_0x102025){return _0x5f2273[_0x4ce4('0x21')](_0x143852)[_0x4ce4('0x23')](_0x102025);}};}function respondWithFilteredResult(_0x94d218,_0x4b7738){return function(_0x35aa0d){if(_0x35aa0d){var _0x531c5d=typeof _0x4b7738[_0x4ce4('0x24')]===_0x4ce4('0x25')&&typeof _0x4b7738['limit']===_0x4ce4('0x25');var _0x1233b3=_0x35aa0d[_0x4ce4('0x26')];var _0x373fba=_0x531c5d?0x0:_0x4b7738['offset'];var _0x3ade13=_0x531c5d?_0x35aa0d[_0x4ce4('0x26')]:_0x4b7738[_0x4ce4('0x24')]+_0x4b7738[_0x4ce4('0x27')];var _0x50994e;if(_0x3ade13>=_0x1233b3){_0x3ade13=_0x1233b3;_0x50994e=0xc8;}else{_0x50994e=0xce;}_0x94d218[_0x4ce4('0x21')](_0x50994e);return _0x94d218['set']('Content-Range',_0x373fba+'-'+_0x3ade13+'/'+_0x1233b3)[_0x4ce4('0x23')](_0x35aa0d);}return null;};}function patchUpdates(_0x191600){return function(_0x14a091){try{jsonpatch[_0x4ce4('0x28')](_0x14a091,_0x191600,!![]);}catch(_0x5637ed){return BPromise[_0x4ce4('0x29')](_0x5637ed);}return _0x14a091[_0x4ce4('0x2a')]();};}function saveUpdates(_0x3c9e11,_0x5eadd0){return function(_0x2b740e){if(_0x2b740e){return _0x2b740e[_0x4ce4('0x2b')](_0x3c9e11)[_0x4ce4('0x2c')](function(_0x557524){return _0x557524;});}return null;};}function removeEntity(_0x18ed49,_0x1399d2){return function(_0x54eb48){if(_0x54eb48){return _0x54eb48['destroy']()['then'](function(){var _0x396ccd=_0x54eb48['get']({'plain':!![]});var _0x48d2e2=_0x4ce4('0x2d');return db[_0x4ce4('0x2e')][_0x4ce4('0x2f')]({'where':{'type':_0x48d2e2,'resourceId':_0x396ccd['id']}})[_0x4ce4('0x2c')](function(){return _0x54eb48;});})[_0x4ce4('0x2c')](function(){_0x18ed49[_0x4ce4('0x21')](0xcc)[_0x4ce4('0x22')]();});}};}function handleEntityNotFound(_0x4dc283,_0x3e0c25){return function(_0x49a675){if(!_0x49a675){_0x4dc283[_0x4ce4('0x20')](0x194);}return _0x49a675;};}function handleError(_0x2dc11a,_0x5bce35){_0x5bce35=_0x5bce35||0x1f4;return function(_0x27960d){logger[_0x4ce4('0x30')](_0x27960d[_0x4ce4('0x31')]);if(_0x27960d['name']){delete _0x27960d['name'];}_0x2dc11a[_0x4ce4('0x21')](_0x5bce35)[_0x4ce4('0x32')](_0x27960d);};}exports[_0x4ce4('0x33')]=function(_0x224f85,_0x11d55e){var _0x48e7fb={},_0x331a7f={},_0x22a509={'count':0x0,'rows':[]};var _0x2fea89=_['map'](db[_0x4ce4('0x34')][_0x4ce4('0x35')],function(_0x2f4062){return{'name':_0x2f4062[_0x4ce4('0x36')],'type':_0x2f4062[_0x4ce4('0x37')][_0x4ce4('0x38')]};});_0x331a7f[_0x4ce4('0x39')]=_[_0x4ce4('0x3a')](_0x2fea89,_0x4ce4('0x3b'));_0x331a7f[_0x4ce4('0x3c')]=_['keys'](_0x224f85['query']);_0x331a7f[_0x4ce4('0x3d')]=_[_0x4ce4('0x3e')](_0x331a7f[_0x4ce4('0x39')],_0x331a7f[_0x4ce4('0x3c')]);_0x48e7fb[_0x4ce4('0x3f')]=_[_0x4ce4('0x3e')](_0x331a7f[_0x4ce4('0x39')],qs[_0x4ce4('0x40')](_0x224f85[_0x4ce4('0x3c')][_0x4ce4('0x40')]));_0x48e7fb[_0x4ce4('0x3f')]=_0x48e7fb[_0x4ce4('0x3f')]['length']?_0x48e7fb[_0x4ce4('0x3f')]:_0x331a7f[_0x4ce4('0x39')];if(!_0x224f85[_0x4ce4('0x3c')]['hasOwnProperty'](_0x4ce4('0x41'))){_0x48e7fb['limit']=qs[_0x4ce4('0x27')](_0x224f85[_0x4ce4('0x3c')]['limit']);_0x48e7fb[_0x4ce4('0x24')]=qs[_0x4ce4('0x24')](_0x224f85[_0x4ce4('0x3c')][_0x4ce4('0x24')]);}_0x48e7fb['order']=qs[_0x4ce4('0x42')](_0x224f85[_0x4ce4('0x3c')][_0x4ce4('0x42')]);_0x48e7fb[_0x4ce4('0x43')]=qs['filters'](_['pick'](_0x224f85[_0x4ce4('0x3c')],_0x331a7f[_0x4ce4('0x3d')]),_0x2fea89);if(_0x224f85[_0x4ce4('0x3c')][_0x4ce4('0x44')]){_0x48e7fb[_0x4ce4('0x43')]=_[_0x4ce4('0x45')](_0x48e7fb['where'],{'$or':_[_0x4ce4('0x3a')](_0x2fea89,function(_0x388ce1){if(_0x388ce1[_0x4ce4('0x37')]!==_0x4ce4('0x46')){var _0x446e5d={};_0x446e5d[_0x388ce1['name']]={'$like':'%'+_0x224f85[_0x4ce4('0x3c')][_0x4ce4('0x44')]+'%'};return _0x446e5d;}})});}_0x48e7fb=_[_0x4ce4('0x45')]({},_0x48e7fb,_0x224f85[_0x4ce4('0x47')]);var _0x10c34b={'where':_0x48e7fb[_0x4ce4('0x43')]};return db[_0x4ce4('0x34')]['count'](_0x10c34b)['then'](function(_0x2696bb){_0x22a509[_0x4ce4('0x26')]=_0x2696bb;if(_0x224f85[_0x4ce4('0x3c')][_0x4ce4('0x48')]){_0x48e7fb[_0x4ce4('0x49')]=[{'all':!![]}];}return db[_0x4ce4('0x34')][_0x4ce4('0x4a')](_0x48e7fb);})[_0x4ce4('0x2c')](function(_0x4f3208){_0x22a509[_0x4ce4('0x4b')]=_0x4f3208;return _0x22a509;})['then'](respondWithFilteredResult(_0x11d55e,_0x48e7fb))[_0x4ce4('0x4c')](handleError(_0x11d55e,null));};exports[_0x4ce4('0x4d')]=function(_0x44f839,_0x8c5a93){var _0x4e88bd={'raw':!![],'where':{'id':_0x44f839[_0x4ce4('0x4e')]['id']}},_0x4edee1={};_0x4edee1[_0x4ce4('0x39')]=_[_0x4ce4('0x4f')](db[_0x4ce4('0x34')][_0x4ce4('0x35')]);_0x4edee1[_0x4ce4('0x3c')]=_[_0x4ce4('0x4f')](_0x44f839[_0x4ce4('0x3c')]);_0x4edee1[_0x4ce4('0x3d')]=_[_0x4ce4('0x3e')](_0x4edee1[_0x4ce4('0x39')],_0x4edee1[_0x4ce4('0x3c')]);_0x4e88bd[_0x4ce4('0x3f')]=_[_0x4ce4('0x3e')](_0x4edee1['model'],qs['fields'](_0x44f839[_0x4ce4('0x3c')][_0x4ce4('0x40')]));_0x4e88bd[_0x4ce4('0x3f')]=_0x4e88bd['attributes'][_0x4ce4('0x50')]?_0x4e88bd['attributes']:_0x4edee1[_0x4ce4('0x39')];if(_0x44f839['query']['includeAll']){_0x4e88bd[_0x4ce4('0x49')]=[{'all':!![]}];}_0x4e88bd=_[_0x4ce4('0x45')]({},_0x4e88bd,_0x44f839[_0x4ce4('0x47')]);return db[_0x4ce4('0x34')][_0x4ce4('0x51')](_0x4e88bd)[_0x4ce4('0x2c')](handleEntityNotFound(_0x8c5a93,null))[_0x4ce4('0x2c')](respondWithResult(_0x8c5a93,null))[_0x4ce4('0x4c')](handleError(_0x8c5a93,null));};exports['download']=function(_0x32eb7f,_0x1b4b60,_0x105649){return db[_0x4ce4('0x34')][_0x4ce4('0x51')]({'where':{'id':_0x32eb7f[_0x4ce4('0x4e')]['id']},'attributes':[_0x4ce4('0x3b'),_0x4ce4('0x8')],'raw':!![]})[_0x4ce4('0x2c')](handleEntityNotFound(_0x1b4b60,null))['then'](function(_0x567c58){if(_0x567c58){var _0x290b64=path[_0x4ce4('0x52')](config[_0x4ce4('0x53')],_0x4ce4('0x54'),util[_0x4ce4('0x55')](_0x4ce4('0x56'),path[_0x4ce4('0x57')](_0x567c58[_0x4ce4('0x8')])));var _0x5a0c07=fs[_0x4ce4('0x58')](_0x290b64);var _0x18f0e0=archiver(_0x4ce4('0x59'),{'zlib':{'level':0x9}});_0x18f0e0['on'](_0x4ce4('0x5a'),function(_0x3e2be2){if(_0x3e2be2[_0x4ce4('0x5b')]===_0x4ce4('0x5c')){logger[_0x4ce4('0x30')](_0x3e2be2);}else{throw new db[(_0x4ce4('0x5d'))][(_0x4ce4('0x5e'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x18f0e0['on'](_0x4ce4('0x30'),function(_0x12c958){throw new db[(_0x4ce4('0x5d'))]['Error'](_0x4ce4('0x5f'));});_0x18f0e0[_0x4ce4('0x60')](_0x5a0c07);_0x18f0e0[_0x4ce4('0x61')](_0x4ce4('0x62'),{'cwd':path[_0x4ce4('0x52')](config['root'],'server/files/plugins',path['dirname'](_0x567c58['path'])),'ignore':[path['join'](path['basename'](_0x567c58[_0x4ce4('0x8')]),_0x4ce4('0x63')),path['join'](path[_0x4ce4('0x57')](_0x567c58[_0x4ce4('0x8')]),_0x4ce4('0x64'))],'nodir':!![]})[_0x4ce4('0x65')]();_0x5a0c07['on'](_0x4ce4('0x66'),function(){if(!fs[_0x4ce4('0x67')](_0x290b64)){throw new db[(_0x4ce4('0x5d'))][(_0x4ce4('0x5e'))]('Plugin\x20not\x20found');}return _0x1b4b60[_0x4ce4('0x68')](_0x290b64,util['format']('%s.zip',path[_0x4ce4('0x57')](_0x567c58[_0x4ce4('0x8')])),function(_0xbfae00){if(_0xbfae00){throw new db[(_0x4ce4('0x5d'))][(_0x4ce4('0x5e'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x290b64);logger[_0x4ce4('0x69')](_0x4ce4('0x6a'));logger['info'](_0x4ce4('0x6b'));});});}return null;})[_0x4ce4('0x4c')](handleError(_0x1b4b60,null));};exports[_0x4ce4('0x6c')]=function(_0x2682b9,_0x3e2708,_0x2e74ec){var _0x12189c=path[_0x4ce4('0x57')](_0x2682b9[_0x4ce4('0x6d')][_0x4ce4('0x6e')],path['extname'](_0x2682b9[_0x4ce4('0x6d')][_0x4ce4('0x6e')]));var _0x2a36ce=path[_0x4ce4('0x52')](config[_0x4ce4('0x53')],_0x4ce4('0x54'),_0x2682b9[_0x4ce4('0x6d')][_0x4ce4('0x6e')]);var _0x423b7d=path['join'](config[_0x4ce4('0x53')],_0x4ce4('0x54'),_0x12189c);logger[_0x4ce4('0x69')]('Plugin\x20upload\x20filepath:\x20%s',_0x2a36ce);logger[_0x4ce4('0x69')]('Plugin\x20upload\x20destination:\x20%s',_0x423b7d);try{fs[_0x4ce4('0x6f')](_0x2a36ce,parseInt(_0x4ce4('0x70'),0x8));extract(_0x2a36ce,{'dir':_0x423b7d},function(_0x58a4d2){if(_0x58a4d2){logger[_0x4ce4('0x30')](_0x58a4d2);handleError(_0x58a4d2,!![]);};var _0x2c2295=fs['readdirSync'](_0x423b7d);if(_0x2c2295['length']>0x1){removeReferences(_0x2a36ce,_0x423b7d);logger[_0x4ce4('0x30')](_0x4ce4('0x71'));return _0x2e74ec(new Error(_0x4ce4('0x71')));}var _0x4df067=fs[_0x4ce4('0x72')](path[_0x4ce4('0x52')](_0x423b7d,_0x2c2295[0x0]));if(_0x4df067[_0x4ce4('0x73')]()){removeReferences(_0x2a36ce,_0x423b7d);logger[_0x4ce4('0x30')](_0x4ce4('0x71'));return _0x2e74ec(new Error('Invalid\x20plugin\x20structure'));}if(_0x4df067[_0x4ce4('0x74')]()){var _0x102ca7=fs[_0x4ce4('0x75')](path['join'](_0x423b7d,_0x2c2295[0x0]));if(_0x102ca7['length']===0x0){removeReferences(_0x2a36ce,_0x423b7d);logger['error'](_0x4ce4('0x71'));return _0x2e74ec(new Error(_0x4ce4('0x71')));}var _0x5ecd05=_0x102ca7[_0x4ce4('0x76')](function(_0x30910b){return _0x30910b===_0x4ce4('0x77');});if(!_0x5ecd05){return _0x2e74ec(new Error(_0x4ce4('0x78')));}var _0x50562a=fs[_0x4ce4('0x79')](path['join'](_0x423b7d,_0x2c2295[0x0],_0x4ce4('0x77')));var _0x289e35=JSON['parse'](_0x50562a);if(_0x4ce4('0x25')==typeof _0x289e35[_0x4ce4('0x3b')]){return _0x2e74ec(new Error(_0x4ce4('0x7a')));}if('undefined'==typeof _0x289e35[_0x4ce4('0x37')]){return _0x2e74ec(new Error(_0x4ce4('0x7b')));}if('undefined'==typeof _0x289e35['version']){return _0x2e74ec(new Error(_0x4ce4('0x7c')));}if(_0x4ce4('0x25')==typeof _0x289e35[_0x4ce4('0x7d')]){return _0x2e74ec(new Error(_0x4ce4('0x7e')));}if(_0x289e35[_0x4ce4('0x37')]==='html'){if(_0x4ce4('0x25')==typeof _0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x7f')]){return _0x2e74ec(new Error(_0x4ce4('0x80')));}if('undefined'==typeof _0x289e35['parameters'][_0x4ce4('0x7f')][_0x4ce4('0x81')]&&_0x4ce4('0x25')==typeof _0x289e35[_0x4ce4('0x7d')]['views'][_0x4ce4('0x82')]){return _0x2e74ec(new Error(_0x4ce4('0x83')));}}else if(_0x289e35[_0x4ce4('0x37')]===_0x4ce4('0x84')){if('undefined'==typeof _0x289e35['parameters'][_0x4ce4('0x85')]){return _0x2e74ec(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x4ce4('0x25')==typeof _0x289e35['parameters'][_0x4ce4('0x86')]){return _0x2e74ec(new Error(_0x4ce4('0x87')));}}else{return _0x2e74ec(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x51b22b=_0x289e35['name'];var _0x2efd8a=_0x289e35['description'];var _0x54e340=_0x289e35['type'];var _0x3a6158=_0x289e35[_0x4ce4('0x88')]?_0x289e35[_0x4ce4('0x88')]:_0x4ce4('0x89');var _0x30cf97=_0x289e35['icon']?_0x289e35[_0x4ce4('0x8a')]:_0x4ce4('0x8b');var _0x50dad1='';var _0x51c610='';var _0x526551='';var _0x53bae5='';var _0x507692=_0x289e35[_0x4ce4('0x8c')];if(_0x54e340==='html'){if('undefined'!=typeof _0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x7f')][_0x4ce4('0x81')]){var _0x23d9eb=_0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x7f')][_0x4ce4('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x4ce4('0x8d')](_0x23d9eb)){_0x50dad1=path['join'](_0x4ce4('0x8e'),_0x12189c,_0x2c2295[0x0],_0x23d9eb);}else{_0x50dad1=_0x23d9eb;}}else{logger[_0x4ce4('0x69')](_0x4ce4('0x8f'));}if('undefined'!=typeof _0x289e35['parameters'][_0x4ce4('0x7f')]['agent']){var _0x15a3cd=_0x289e35[_0x4ce4('0x7d')]['views'][_0x4ce4('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x15a3cd)){_0x51c610=path[_0x4ce4('0x52')](_0x4ce4('0x8e'),_0x12189c,_0x2c2295[0x0],_0x15a3cd);}else{_0x51c610=_0x15a3cd;}}else{logger[_0x4ce4('0x69')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x54e340===_0x4ce4('0x84')){_0x526551=_0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x85')];_0x53bae5=_0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x86')];if('undefined'!=typeof _0x289e35[_0x4ce4('0x7d')]['views']){if(_0x4ce4('0x25')!=typeof _0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x7f')][_0x4ce4('0x81')]){var _0x23d9eb=_0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x7f')][_0x4ce4('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x4ce4('0x8d')](_0x23d9eb)){_0x50dad1=path[_0x4ce4('0x52')]('plugins',_0x12189c,_0x2c2295[0x0],_0x23d9eb);}else{_0x50dad1=_0x23d9eb;}}if(_0x4ce4('0x25')!=typeof _0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x7f')][_0x4ce4('0x82')]){var _0x15a3cd=_0x289e35[_0x4ce4('0x7d')][_0x4ce4('0x7f')][_0x4ce4('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x4ce4('0x8d')](_0x15a3cd)){_0x51c610=path[_0x4ce4('0x52')](_0x4ce4('0x8e'),_0x12189c,_0x2c2295[0x0],_0x15a3cd);}else{_0x51c610=_0x15a3cd;}}}}var _0x451406={'name':_0x51b22b,'description':_0x2efd8a,'path':path[_0x4ce4('0x52')](_0x12189c,_0x2c2295[0x0]),'type':_0x54e340,'sidebar':_0x3a6158,'icon':_0x30cf97,'adminUrl':_0x50dad1,'agentUrl':_0x51c610,'scriptName':_0x526551,'scriptPath':_0x53bae5,'version':_0x507692};removeReferences(_0x2a36ce,null);return db[_0x4ce4('0x34')]['create'](_0x451406)[_0x4ce4('0x2c')](function(_0xc37dfe){var _0x5aeffd={'role':_0x2682b9[_0x4ce4('0x90')][_0x4ce4('0x91')],'userProfileId':_0x2682b9['body']['userProfileId']};if(!_0x5aeffd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5aeffd[_0x4ce4('0x91')]===_0x4ce4('0x92')){var _0x30b94d=_0xc37dfe[_0x4ce4('0x93')]({'plain':!![]});return db[_0x4ce4('0x94')][_0x4ce4('0x51')]({'where':{'name':'Plugins','userProfileId':_0x5aeffd['userProfileId']},'raw':!![]})['then'](function(_0x51469d){if(_0x51469d&&_0x51469d['autoAssociation']===0x0){return db[_0x4ce4('0x2e')][_0x4ce4('0x95')]({'name':_0x30b94d[_0x4ce4('0x3b')],'resourceId':_0x30b94d['id'],'type':_0x51469d[_0x4ce4('0x3b')],'sectionId':_0x51469d['id']},{})[_0x4ce4('0x2c')](function(){return _0xc37dfe;});}else{return _0xc37dfe;}})['catch'](function(_0x4f972a){logger[_0x4ce4('0x30')](_0x4ce4('0x96'),_0x4f972a);throw _0x4f972a;});}return _0xc37dfe;})['then'](respondWithResult(_0x3e2708,null))['catch'](handleError(_0x3e2708,null));}});}catch(_0x2e2225){_0x3e2708[_0x4ce4('0x21')](0x1f4)[_0x4ce4('0x32')](_0x2e2225);}};function removeReferences(_0xd2f275,_0x2b6021){try{if(_0xd2f275){fs[_0x4ce4('0x97')](_0xd2f275);logger[_0x4ce4('0x69')](_0x4ce4('0x98'));}if(_0x2b6021){rimraf(_0x2b6021,function(){});logger[_0x4ce4('0x69')](_0x4ce4('0x99'));}}catch(_0x34e11f){logger[_0x4ce4('0x30')](_0x34e11f);}}exports[_0x4ce4('0x2b')]=function(_0x1cf67d,_0x34d0c4,_0x54028c){return db['Plugin'][_0x4ce4('0x51')]({'where':{'id':_0x1cf67d[_0x4ce4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x34d0c4,null))['then'](saveUpdates(_0x1cf67d[_0x4ce4('0x90')],null))[_0x4ce4('0x2c')](respondWithResult(_0x34d0c4,null))['catch'](handleError(_0x34d0c4,null));};exports[_0x4ce4('0x9a')]=function(_0x30c0b7,_0x2a7d97,_0x179264){return db[_0x4ce4('0x34')]['find']({'where':{'id':_0x30c0b7['params']['id']}})[_0x4ce4('0x2c')](function(_0xa932e){if(_0xa932e){return _0xa932e[_0x4ce4('0x2f')]();}})[_0x4ce4('0x2c')](function(_0xf46b16){rimraf(path[_0x4ce4('0x52')](config[_0x4ce4('0x53')],_0x4ce4('0x54'),path[_0x4ce4('0x9b')](_0xf46b16['path'])),function(){});return _0xf46b16;})['then'](handleEntityNotFound(_0x2a7d97,null))['then'](respondWithStatusCode(_0x2a7d97,null))['catch'](handleError(_0x2a7d97,null));};exports[_0x4ce4('0x9c')]=function(_0x3dc7b0,_0x3253e5,_0xd6e682){return BPromise[_0x4ce4('0x9d')]()[_0x4ce4('0x2c')](function(){if(!_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0x8')]){throw new Error(_0x4ce4('0x9e'));}if(!_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0x9f')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5ea98e=_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0xa0')]?_0x3dc7b0['query'][_0x4ce4('0xa0')]+':'+_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0x9f')]:_0x4ce4('0xa1')+_0x3dc7b0[_0x4ce4('0x3c')]['port'];var _0x40ea24=_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0x23')]?_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0x23')]:!![];var _0x5230f5=_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0xa2')]?_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0xa2')]:null;var _0x5df219={'method':_0x3dc7b0['method'],'uri':util[_0x4ce4('0x55')]('%s%s',_0x5ea98e,_0x3dc7b0[_0x4ce4('0x3c')][_0x4ce4('0x8')]),'json':_0x40ea24,'resolveWithFullResponse':!![],'encoding':_0x5230f5,'qs':_0x3dc7b0['query']};if(_0x3dc7b0[_0x4ce4('0xa3')]){_0x5df219['headers']=_0x3dc7b0[_0x4ce4('0xa3')];if(_0x5df219[_0x4ce4('0xa3')][_0x4ce4('0xa4')]){delete _0x5df219[_0x4ce4('0xa3')][_0x4ce4('0xa4')];}}if(_0x5df219['headers'][_0x4ce4('0xa5')]){delete _0x5df219[_0x4ce4('0xa3')]['content-type'];}return rp(_0x5df219);})[_0x4ce4('0x2c')](function(_0x435ead){if(_0x435ead){_0x3253e5[_0x4ce4('0xa6')](_0x435ead[_0x4ce4('0xa3')]);logger[_0x4ce4('0x69')](_0x435ead[_0x4ce4('0x90')]);if(_[_0x4ce4('0xa7')](_0x3dc7b0[_0x4ce4('0x3c')]['path'],_0x4ce4('0x68'))&&_0x435ead[_0x4ce4('0xa8')]==0x1f4){return _0x3253e5[_0x4ce4('0x20')](_0x435ead[_0x4ce4('0xa8')]);}else{return _0x3253e5[_0x4ce4('0x21')](_0x435ead[_0x4ce4('0xa8')])[_0x4ce4('0x32')](_0x435ead['body']);}}else{return _0x3253e5[_0x4ce4('0x20')](0xc8);}})[_0x4ce4('0x4c')](handleError(_0x3253e5,null));};exports[_0x4ce4('0xa9')]=function(_0x233a87,_0x5523e1,_0x254765){return BPromise[_0x4ce4('0x9d')]()[_0x4ce4('0x2c')](function(){if(!_0x233a87[_0x4ce4('0x3c')]['path']){throw new Error(_0x4ce4('0x9e'));}if(!_0x233a87[_0x4ce4('0x3c')][_0x4ce4('0x9f')]){throw new Error(_0x4ce4('0xaa'));}var _0x4f66ec=_0x233a87[_0x4ce4('0x3c')][_0x4ce4('0xa0')]?_0x233a87[_0x4ce4('0x3c')][_0x4ce4('0xa0')]+':'+_0x233a87['query'][_0x4ce4('0x9f')]:_0x4ce4('0xa1')+_0x233a87['query'][_0x4ce4('0x9f')];var _0x298690=_0x233a87['query'][_0x4ce4('0x23')]?_0x233a87['query']['json']:!![];var _0x18adbc=_0x233a87[_0x4ce4('0x3c')][_0x4ce4('0xa2')]?_0x233a87[_0x4ce4('0x3c')]['encoding']:null;var _0x282733={'method':_0x233a87[_0x4ce4('0xab')],'uri':util[_0x4ce4('0x55')](_0x4ce4('0xac'),_0x4f66ec,_0x233a87['query'][_0x4ce4('0x8')]),'json':_0x298690,'resolveWithFullResponse':!![],'encoding':_0x18adbc,'body':_0x233a87[_0x4ce4('0x90')]};if(_0x233a87[_0x4ce4('0xa3')]){_0x282733[_0x4ce4('0xa3')]=_0x233a87[_0x4ce4('0xa3')];if(_0x282733[_0x4ce4('0xa3')][_0x4ce4('0xa4')]){delete _0x282733['headers'][_0x4ce4('0xa4')];}}if(_0x282733['headers'][_0x4ce4('0xa5')]){delete _0x282733[_0x4ce4('0xa3')]['content-type'];}return rp(_0x282733);})[_0x4ce4('0x2c')](function(_0x1d86ec){if(_0x1d86ec){_0x5523e1[_0x4ce4('0xa6')](_0x1d86ec[_0x4ce4('0xa3')]);logger[_0x4ce4('0x69')](_0x1d86ec[_0x4ce4('0x90')]);return _0x5523e1[_0x4ce4('0x21')](_0x1d86ec['statusCode'])[_0x4ce4('0x32')](_0x1d86ec[_0x4ce4('0x90')]);}else{return _0x5523e1[_0x4ce4('0x20')](0xc8);}})['catch'](handleError(_0x5523e1,null));}; \ No newline at end of file +var _0x0619=['Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','sendStatus','webhookPost','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','%s%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','Plugins','UserProfileResource','destroy','stack','name','Plugin','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','includeAll','include','findAll','show','params','options','find','catch','download','join','root','server/files/plugins','format','basename','createWriteStream','warning','code','ENOENT','error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','info','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some'];(function(_0x23cdcc,_0x350904){var _0x4cb988=function(_0x2c860a){while(--_0x2c860a){_0x23cdcc['push'](_0x23cdcc['shift']());}};_0x4cb988(++_0x350904);}(_0x0619,0x181));var _0x9061=function(_0xdcb6b,_0x2a98a2){_0xdcb6b=_0xdcb6b-0x0;var _0x3494bf=_0x0619[_0xdcb6b];return _0x3494bf;};'use strict';var emlformat=require(_0x9061('0x0'));var rimraf=require(_0x9061('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9061('0x2'));var moment=require(_0x9061('0x3'));var BPromise=require(_0x9061('0x4'));var Mustache=require(_0x9061('0x5'));var util=require(_0x9061('0x6'));var path=require(_0x9061('0x7'));var sox=require(_0x9061('0x8'));var csv=require(_0x9061('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9061('0xa'));var _=require('lodash');var squel=require(_0x9061('0xb'));var crypto=require(_0x9061('0xc'));var jsforce=require(_0x9061('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9061('0x9'));var querystring=require(_0x9061('0xe'));var Papa=require(_0x9061('0xf'));var extract=require(_0x9061('0x10'));var rimraf=require(_0x9061('0x1'));var archiver=require('archiver');var Redis=require(_0x9061('0x11'));var authService=require(_0x9061('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9061('0x13'));var logger=require(_0x9061('0x14'))(_0x9061('0x15'));var utils=require('../../config/utils');var config=require(_0x9061('0x16'));var licenseUtil=require(_0x9061('0x17'));var db=require(_0x9061('0x18'))['db'];config[_0x9061('0x19')]=_[_0x9061('0x1a')](config[_0x9061('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9061('0x1b'))(new Redis(config[_0x9061('0x19')]));require(_0x9061('0x1c'))[_0x9061('0x1d')](socket);function respondWithStatusCode(_0x319171,_0x2151a4){_0x2151a4=_0x2151a4||0xcc;return function(_0x52b850){if(_0x52b850){return _0x319171['sendStatus'](_0x2151a4);}return _0x319171['status'](_0x2151a4)[_0x9061('0x1e')]();};}function respondWithResult(_0x2d3024,_0x449601){_0x449601=_0x449601||0xc8;return function(_0x5c652e){if(_0x5c652e){return _0x2d3024[_0x9061('0x1f')](_0x449601)[_0x9061('0x20')](_0x5c652e);}};}function respondWithFilteredResult(_0x21363e,_0x45c05f){return function(_0x196897){if(_0x196897){var _0x238f1d=typeof _0x45c05f['offset']===_0x9061('0x21')&&typeof _0x45c05f[_0x9061('0x22')]===_0x9061('0x21');var _0x554ef1=_0x196897[_0x9061('0x23')];var _0x19c1db=_0x238f1d?0x0:_0x45c05f[_0x9061('0x24')];var _0x6fd0e0=_0x238f1d?_0x196897['count']:_0x45c05f[_0x9061('0x24')]+_0x45c05f[_0x9061('0x22')];var _0x228124;if(_0x6fd0e0>=_0x554ef1){_0x6fd0e0=_0x554ef1;_0x228124=0xc8;}else{_0x228124=0xce;}_0x21363e[_0x9061('0x1f')](_0x228124);return _0x21363e[_0x9061('0x25')](_0x9061('0x26'),_0x19c1db+'-'+_0x6fd0e0+'/'+_0x554ef1)['json'](_0x196897);}return null;};}function patchUpdates(_0x593bbd){return function(_0x34a651){try{jsonpatch['apply'](_0x34a651,_0x593bbd,!![]);}catch(_0x211bea){return BPromise[_0x9061('0x27')](_0x211bea);}return _0x34a651[_0x9061('0x28')]();};}function saveUpdates(_0x2920e8,_0x594b7a){return function(_0x293f26){if(_0x293f26){return _0x293f26[_0x9061('0x29')](_0x2920e8)['then'](function(_0x3ed97b){return _0x3ed97b;});}return null;};}function removeEntity(_0x8232e6,_0x119815){return function(_0x42a980){if(_0x42a980){return _0x42a980['destroy']()[_0x9061('0x2a')](function(){var _0x24eed9=_0x42a980['get']({'plain':!![]});var _0x40f778=_0x9061('0x2b');return db[_0x9061('0x2c')][_0x9061('0x2d')]({'where':{'type':_0x40f778,'resourceId':_0x24eed9['id']}})[_0x9061('0x2a')](function(){return _0x42a980;});})[_0x9061('0x2a')](function(){_0x8232e6[_0x9061('0x1f')](0xcc)[_0x9061('0x1e')]();});}};}function handleEntityNotFound(_0x57636a,_0x1177d0){return function(_0x3ac4be){if(!_0x3ac4be){_0x57636a['sendStatus'](0x194);}return _0x3ac4be;};}function handleError(_0x16975e,_0x4c2cac){_0x4c2cac=_0x4c2cac||0x1f4;return function(_0x2b0865){logger['error'](_0x2b0865[_0x9061('0x2e')]);if(_0x2b0865['name']){delete _0x2b0865[_0x9061('0x2f')];}_0x16975e['status'](_0x4c2cac)['send'](_0x2b0865);};}exports['index']=function(_0x5b554b,_0x4bc14f){var _0x54c76b={},_0x4b96c5={},_0x4b227a={'count':0x0,'rows':[]};var _0x3916d8=_['map'](db[_0x9061('0x30')]['rawAttributes'],function(_0x4ef882){return{'name':_0x4ef882['fieldName'],'type':_0x4ef882[_0x9061('0x31')]['key']};});_0x4b96c5[_0x9061('0x32')]=_[_0x9061('0x33')](_0x3916d8,_0x9061('0x2f'));_0x4b96c5[_0x9061('0x34')]=_[_0x9061('0x35')](_0x5b554b['query']);_0x4b96c5['filters']=_[_0x9061('0x36')](_0x4b96c5[_0x9061('0x32')],_0x4b96c5['query']);_0x54c76b[_0x9061('0x37')]=_[_0x9061('0x36')](_0x4b96c5['model'],qs[_0x9061('0x38')](_0x5b554b['query'][_0x9061('0x38')]));_0x54c76b[_0x9061('0x37')]=_0x54c76b[_0x9061('0x37')][_0x9061('0x39')]?_0x54c76b[_0x9061('0x37')]:_0x4b96c5[_0x9061('0x32')];if(!_0x5b554b[_0x9061('0x34')][_0x9061('0x3a')](_0x9061('0x3b'))){_0x54c76b[_0x9061('0x22')]=qs[_0x9061('0x22')](_0x5b554b['query'][_0x9061('0x22')]);_0x54c76b[_0x9061('0x24')]=qs[_0x9061('0x24')](_0x5b554b['query']['offset']);}_0x54c76b['order']=qs[_0x9061('0x3c')](_0x5b554b[_0x9061('0x34')][_0x9061('0x3c')]);_0x54c76b[_0x9061('0x3d')]=qs[_0x9061('0x3e')](_['pick'](_0x5b554b[_0x9061('0x34')],_0x4b96c5[_0x9061('0x3e')]),_0x3916d8);if(_0x5b554b['query']['filter']){_0x54c76b[_0x9061('0x3d')]=_[_0x9061('0x3f')](_0x54c76b[_0x9061('0x3d')],{'$or':_[_0x9061('0x33')](_0x3916d8,function(_0x39f1a1){if(_0x39f1a1[_0x9061('0x31')]!==_0x9061('0x40')){var _0x1ede26={};_0x1ede26[_0x39f1a1[_0x9061('0x2f')]]={'$like':'%'+_0x5b554b[_0x9061('0x34')]['filter']+'%'};return _0x1ede26;}})});}_0x54c76b=_['merge']({},_0x54c76b,_0x5b554b['options']);var _0x9591e8={'where':_0x54c76b[_0x9061('0x3d')]};return db[_0x9061('0x30')][_0x9061('0x23')](_0x9591e8)[_0x9061('0x2a')](function(_0x3fce2e){_0x4b227a[_0x9061('0x23')]=_0x3fce2e;if(_0x5b554b[_0x9061('0x34')][_0x9061('0x41')]){_0x54c76b[_0x9061('0x42')]=[{'all':!![]}];}return db['Plugin'][_0x9061('0x43')](_0x54c76b);})['then'](function(_0x4cb26c){_0x4b227a['rows']=_0x4cb26c;return _0x4b227a;})['then'](respondWithFilteredResult(_0x4bc14f,_0x54c76b))['catch'](handleError(_0x4bc14f,null));};exports[_0x9061('0x44')]=function(_0x4a43c6,_0x53571f){var _0x24beb2={'raw':!![],'where':{'id':_0x4a43c6[_0x9061('0x45')]['id']}},_0x2b54e4={};_0x2b54e4[_0x9061('0x32')]=_['keys'](db[_0x9061('0x30')]['rawAttributes']);_0x2b54e4[_0x9061('0x34')]=_[_0x9061('0x35')](_0x4a43c6[_0x9061('0x34')]);_0x2b54e4['filters']=_[_0x9061('0x36')](_0x2b54e4[_0x9061('0x32')],_0x2b54e4[_0x9061('0x34')]);_0x24beb2[_0x9061('0x37')]=_[_0x9061('0x36')](_0x2b54e4[_0x9061('0x32')],qs['fields'](_0x4a43c6[_0x9061('0x34')][_0x9061('0x38')]));_0x24beb2[_0x9061('0x37')]=_0x24beb2[_0x9061('0x37')][_0x9061('0x39')]?_0x24beb2[_0x9061('0x37')]:_0x2b54e4[_0x9061('0x32')];if(_0x4a43c6[_0x9061('0x34')]['includeAll']){_0x24beb2[_0x9061('0x42')]=[{'all':!![]}];}_0x24beb2=_[_0x9061('0x3f')]({},_0x24beb2,_0x4a43c6[_0x9061('0x46')]);return db[_0x9061('0x30')][_0x9061('0x47')](_0x24beb2)[_0x9061('0x2a')](handleEntityNotFound(_0x53571f,null))[_0x9061('0x2a')](respondWithResult(_0x53571f,null))[_0x9061('0x48')](handleError(_0x53571f,null));};exports[_0x9061('0x49')]=function(_0x51b113,_0x4a4628,_0x11640e){return db[_0x9061('0x30')]['find']({'where':{'id':_0x51b113['params']['id']},'attributes':[_0x9061('0x2f'),_0x9061('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x4a4628,null))[_0x9061('0x2a')](function(_0x920878){if(_0x920878){var _0x277954=path[_0x9061('0x4a')](config[_0x9061('0x4b')],_0x9061('0x4c'),util[_0x9061('0x4d')]('%s.zip',path[_0x9061('0x4e')](_0x920878[_0x9061('0x7')])));var _0x49f5f7=fs[_0x9061('0x4f')](_0x277954);var _0x2f4d27=archiver('zip',{'zlib':{'level':0x9}});_0x2f4d27['on'](_0x9061('0x50'),function(_0x37984e){if(_0x37984e[_0x9061('0x51')]===_0x9061('0x52')){logger[_0x9061('0x53')](_0x37984e);}else{throw new db[(_0x9061('0x54'))]['Error'](_0x9061('0x55'));}});_0x2f4d27['on'](_0x9061('0x53'),function(_0x496376){throw new db[(_0x9061('0x54'))][(_0x9061('0x56'))](_0x9061('0x55'));});_0x2f4d27['pipe'](_0x49f5f7);_0x2f4d27[_0x9061('0x57')](_0x9061('0x58'),{'cwd':path[_0x9061('0x4a')](config['root'],_0x9061('0x4c'),path[_0x9061('0x59')](_0x920878[_0x9061('0x7')])),'ignore':[path[_0x9061('0x4a')](path[_0x9061('0x4e')](_0x920878[_0x9061('0x7')]),_0x9061('0x5a')),path[_0x9061('0x4a')](path[_0x9061('0x4e')](_0x920878[_0x9061('0x7')]),_0x9061('0x5b'))],'nodir':!![]})[_0x9061('0x5c')]();_0x49f5f7['on'](_0x9061('0x5d'),function(){if(!fs[_0x9061('0x5e')](_0x277954)){throw new db[(_0x9061('0x54'))][(_0x9061('0x56'))]('Plugin\x20not\x20found');}return _0x4a4628[_0x9061('0x49')](_0x277954,util['format']('%s.zip',path[_0x9061('0x4e')](_0x920878[_0x9061('0x7')])),function(_0x26357a){if(_0x26357a){throw new db[(_0x9061('0x54'))][(_0x9061('0x56'))](_0x9061('0x5f'));}fs['unlinkSync'](_0x277954);logger['info']('Download\x20completed');logger[_0x9061('0x60')]('Temporary\x20file\x20removed');});});}return null;})[_0x9061('0x48')](handleError(_0x4a4628,null));};exports['upload']=function(_0x3f7a5f,_0x13d7c8,_0x3e2c57){var _0x306a3a=path[_0x9061('0x4e')](_0x3f7a5f[_0x9061('0x61')][_0x9061('0x62')],path['extname'](_0x3f7a5f['file'][_0x9061('0x62')]));var _0x18f12f=path['join'](config['root'],_0x9061('0x4c'),_0x3f7a5f[_0x9061('0x61')][_0x9061('0x62')]);var _0x1ee954=path[_0x9061('0x4a')](config[_0x9061('0x4b')],_0x9061('0x4c'),_0x306a3a);logger['info'](_0x9061('0x63'),_0x18f12f);logger[_0x9061('0x60')](_0x9061('0x64'),_0x1ee954);try{fs[_0x9061('0x65')](_0x18f12f,parseInt('0777',0x8));extract(_0x18f12f,{'dir':_0x1ee954},function(_0x503e87){if(_0x503e87){logger[_0x9061('0x53')](_0x503e87);handleError(_0x503e87,!![]);};var _0x4d4891=fs[_0x9061('0x66')](_0x1ee954);if(_0x4d4891[_0x9061('0x39')]>0x1){removeReferences(_0x18f12f,_0x1ee954);logger[_0x9061('0x53')]('Invalid\x20plugin\x20structure');return _0x3e2c57(new Error(_0x9061('0x67')));}var _0x1a7beb=fs['lstatSync'](path[_0x9061('0x4a')](_0x1ee954,_0x4d4891[0x0]));if(_0x1a7beb[_0x9061('0x68')]()){removeReferences(_0x18f12f,_0x1ee954);logger['error'](_0x9061('0x67'));return _0x3e2c57(new Error(_0x9061('0x67')));}if(_0x1a7beb[_0x9061('0x69')]()){var _0x59e5f9=fs[_0x9061('0x66')](path[_0x9061('0x4a')](_0x1ee954,_0x4d4891[0x0]));if(_0x59e5f9[_0x9061('0x39')]===0x0){removeReferences(_0x18f12f,_0x1ee954);logger[_0x9061('0x53')]('Invalid\x20plugin\x20structure');return _0x3e2c57(new Error('Invalid\x20plugin\x20structure'));}var _0x1df8a7=_0x59e5f9[_0x9061('0x6a')](function(_0x300b3e){return _0x300b3e==='manifest.json';});if(!_0x1df8a7){return _0x3e2c57(new Error(_0x9061('0x6b')));}var _0x4b0662=fs[_0x9061('0x6c')](path[_0x9061('0x4a')](_0x1ee954,_0x4d4891[0x0],_0x9061('0x6d')));var _0x18da24=JSON[_0x9061('0x6e')](_0x4b0662);if(_0x9061('0x21')==typeof _0x18da24[_0x9061('0x2f')]){return _0x3e2c57(new Error(_0x9061('0x6f')));}if(_0x9061('0x21')==typeof _0x18da24[_0x9061('0x31')]){return _0x3e2c57(new Error(_0x9061('0x70')));}if(_0x9061('0x21')==typeof _0x18da24[_0x9061('0x71')]){return _0x3e2c57(new Error(_0x9061('0x72')));}if('undefined'==typeof _0x18da24[_0x9061('0x73')]){return _0x3e2c57(new Error(_0x9061('0x74')));}if(_0x18da24[_0x9061('0x31')]===_0x9061('0x75')){if('undefined'==typeof _0x18da24[_0x9061('0x73')][_0x9061('0x76')]){return _0x3e2c57(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x18da24[_0x9061('0x73')][_0x9061('0x76')][_0x9061('0x77')]&&'undefined'==typeof _0x18da24[_0x9061('0x73')][_0x9061('0x76')][_0x9061('0x78')]){return _0x3e2c57(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x18da24['type']===_0x9061('0x79')){if(_0x9061('0x21')==typeof _0x18da24['parameters'][_0x9061('0x7a')]){return _0x3e2c57(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x18da24[_0x9061('0x73')][_0x9061('0x7b')]){return _0x3e2c57(new Error(_0x9061('0x7c')));}}else{return _0x3e2c57(new Error(_0x9061('0x7d')));}var _0x45fc19=_0x18da24[_0x9061('0x2f')];var _0x306754=_0x18da24[_0x9061('0x7e')];var _0x5df79d=_0x18da24[_0x9061('0x31')];var _0x543a55=_0x18da24[_0x9061('0x7f')]?_0x18da24[_0x9061('0x7f')]:_0x9061('0x80');var _0x56d6ec=_0x18da24[_0x9061('0x81')]?_0x18da24[_0x9061('0x81')]:_0x9061('0x82');var _0x5293c8='';var _0xe8907f='';var _0x5c4534='';var _0x5b84c8='';var _0x521c16=_0x18da24[_0x9061('0x71')];if(_0x5df79d===_0x9061('0x75')){if(_0x9061('0x21')!=typeof _0x18da24['parameters']['views'][_0x9061('0x77')]){var _0x114b57=_0x18da24['parameters']['views'][_0x9061('0x77')];if(!/^(f|ht)tps?:\/\//i[_0x9061('0x83')](_0x114b57)){_0x5293c8=path[_0x9061('0x4a')](_0x9061('0x84'),_0x306a3a,_0x4d4891[0x0],_0x114b57);}else{_0x5293c8=_0x114b57;}}else{logger[_0x9061('0x60')](_0x9061('0x85'));}if(_0x9061('0x21')!=typeof _0x18da24[_0x9061('0x73')][_0x9061('0x76')][_0x9061('0x78')]){var _0x5e88ac=_0x18da24[_0x9061('0x73')][_0x9061('0x76')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9061('0x83')](_0x5e88ac)){_0xe8907f=path[_0x9061('0x4a')](_0x9061('0x84'),_0x306a3a,_0x4d4891[0x0],_0x5e88ac);}else{_0xe8907f=_0x5e88ac;}}else{logger[_0x9061('0x60')](_0x9061('0x86'));}}else if(_0x5df79d===_0x9061('0x79')){_0x5c4534=_0x18da24[_0x9061('0x73')][_0x9061('0x7a')];_0x5b84c8=_0x18da24[_0x9061('0x73')][_0x9061('0x7b')];if(_0x9061('0x21')!=typeof _0x18da24['parameters'][_0x9061('0x76')]){if(_0x9061('0x21')!=typeof _0x18da24['parameters'][_0x9061('0x76')][_0x9061('0x77')]){var _0x114b57=_0x18da24[_0x9061('0x73')][_0x9061('0x76')][_0x9061('0x77')];if(!/^(f|ht)tps?:\/\//i[_0x9061('0x83')](_0x114b57)){_0x5293c8=path[_0x9061('0x4a')](_0x9061('0x84'),_0x306a3a,_0x4d4891[0x0],_0x114b57);}else{_0x5293c8=_0x114b57;}}if(_0x9061('0x21')!=typeof _0x18da24[_0x9061('0x73')][_0x9061('0x76')][_0x9061('0x78')]){var _0x5e88ac=_0x18da24[_0x9061('0x73')]['views'][_0x9061('0x78')];if(!/^(f|ht)tps?:\/\//i[_0x9061('0x83')](_0x5e88ac)){_0xe8907f=path[_0x9061('0x4a')](_0x9061('0x84'),_0x306a3a,_0x4d4891[0x0],_0x5e88ac);}else{_0xe8907f=_0x5e88ac;}}}}var _0x15119a={'name':_0x45fc19,'description':_0x306754,'path':path[_0x9061('0x4a')](_0x306a3a,_0x4d4891[0x0]),'type':_0x5df79d,'sidebar':_0x543a55,'icon':_0x56d6ec,'adminUrl':_0x5293c8,'agentUrl':_0xe8907f,'scriptName':_0x5c4534,'scriptPath':_0x5b84c8,'version':_0x521c16};removeReferences(_0x18f12f,null);return db[_0x9061('0x30')][_0x9061('0x87')](_0x15119a)[_0x9061('0x2a')](function(_0x3a6009){var _0x34417e={'role':_0x3f7a5f['body']['role'],'userProfileId':_0x3f7a5f[_0x9061('0x88')]['userProfileId']};if(!_0x34417e)throw new Error(_0x9061('0x89'));if(_0x34417e[_0x9061('0x8a')]===_0x9061('0x8b')){var _0x5a53c0=_0x3a6009['get']({'plain':!![]});return db[_0x9061('0x8c')][_0x9061('0x47')]({'where':{'name':_0x9061('0x2b'),'userProfileId':_0x34417e[_0x9061('0x8d')]},'raw':!![]})['then'](function(_0x5ba03d){if(_0x5ba03d&&_0x5ba03d[_0x9061('0x8e')]===0x0){return db[_0x9061('0x2c')][_0x9061('0x87')]({'name':_0x5a53c0[_0x9061('0x2f')],'resourceId':_0x5a53c0['id'],'type':_0x5ba03d['name'],'sectionId':_0x5ba03d['id']},{})[_0x9061('0x2a')](function(){return _0x3a6009;});}else{return _0x3a6009;}})[_0x9061('0x48')](function(_0x4c4a8e){logger[_0x9061('0x53')](_0x9061('0x8f'),_0x4c4a8e);throw _0x4c4a8e;});}return _0x3a6009;})[_0x9061('0x2a')](respondWithResult(_0x13d7c8,null))[_0x9061('0x48')](handleError(_0x13d7c8,null));}});}catch(_0x1ebada){_0x13d7c8[_0x9061('0x1f')](0x1f4)[_0x9061('0x90')](_0x1ebada);}};function removeReferences(_0x20bc2f,_0x57b5b8){try{if(_0x20bc2f){fs[_0x9061('0x91')](_0x20bc2f);logger[_0x9061('0x60')](_0x9061('0x92'));}if(_0x57b5b8){rimraf(_0x57b5b8,function(){});logger['info'](_0x9061('0x93'));}}catch(_0x2738f4){logger[_0x9061('0x53')](_0x2738f4);}}exports[_0x9061('0x29')]=function(_0xc09a57,_0x43fd54,_0x66bcf7){return db['Plugin'][_0x9061('0x47')]({'where':{'id':_0xc09a57['params']['id']}})[_0x9061('0x2a')](handleEntityNotFound(_0x43fd54,null))['then'](saveUpdates(_0xc09a57['body'],null))['then'](respondWithResult(_0x43fd54,null))[_0x9061('0x48')](handleError(_0x43fd54,null));};exports['delete']=function(_0x24b7d9,_0x877220,_0x2cb23e){return db['Plugin'][_0x9061('0x47')]({'where':{'id':_0x24b7d9[_0x9061('0x45')]['id']}})[_0x9061('0x2a')](function(_0x3e95c6){if(_0x3e95c6){return _0x3e95c6[_0x9061('0x2d')]();}})[_0x9061('0x2a')](function(_0x465b3a){rimraf(path[_0x9061('0x4a')](config['root'],'server/files/plugins',path['dirname'](_0x465b3a['path'])),function(){});return _0x465b3a;})[_0x9061('0x2a')](handleEntityNotFound(_0x877220,null))[_0x9061('0x2a')](respondWithStatusCode(_0x877220,null))['catch'](handleError(_0x877220,null));};exports['webhookGet']=function(_0x41f81b,_0x7fb0c9,_0xb65c4b){return BPromise['resolve']()[_0x9061('0x2a')](function(){if(!_0x41f81b[_0x9061('0x34')][_0x9061('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x41f81b[_0x9061('0x34')]['port']){throw new Error(_0x9061('0x94'));}var _0x543174=_0x41f81b[_0x9061('0x34')][_0x9061('0x95')]?_0x41f81b[_0x9061('0x34')][_0x9061('0x95')]+':'+_0x41f81b[_0x9061('0x34')]['port']:_0x9061('0x96')+_0x41f81b[_0x9061('0x34')]['port'];var _0x3b7fee=_0x41f81b[_0x9061('0x34')][_0x9061('0x20')]?_0x41f81b[_0x9061('0x34')][_0x9061('0x20')]:!![];var _0x308a2b=_0x41f81b[_0x9061('0x34')][_0x9061('0x97')]?_0x41f81b[_0x9061('0x34')][_0x9061('0x97')]:null;var _0x297dc2={'method':_0x41f81b[_0x9061('0x98')],'uri':util[_0x9061('0x4d')]('%s%s',_0x543174,_0x41f81b[_0x9061('0x34')]['path']),'json':_0x3b7fee,'resolveWithFullResponse':!![],'encoding':_0x308a2b,'qs':_0x41f81b[_0x9061('0x34')]};if(_0x41f81b['headers']){_0x297dc2[_0x9061('0x99')]=_0x41f81b['headers'];if(_0x297dc2[_0x9061('0x99')][_0x9061('0x9a')]){delete _0x297dc2['headers']['content-length'];}}if(_0x297dc2[_0x9061('0x99')]['content-type']){delete _0x297dc2[_0x9061('0x99')][_0x9061('0x9b')];}return rp(_0x297dc2);})[_0x9061('0x2a')](function(_0xcb62c4){if(_0xcb62c4){_0x7fb0c9[_0x9061('0x25')](_0xcb62c4[_0x9061('0x99')]);logger[_0x9061('0x60')](_0xcb62c4[_0x9061('0x88')]);if(_[_0x9061('0x9c')](_0x41f81b[_0x9061('0x34')][_0x9061('0x7')],_0x9061('0x49'))&&_0xcb62c4[_0x9061('0x9d')]==0x1f4){return _0x7fb0c9[_0x9061('0x9e')](_0xcb62c4['statusCode']);}else{return _0x7fb0c9[_0x9061('0x1f')](_0xcb62c4['statusCode'])[_0x9061('0x90')](_0xcb62c4['body']);}}else{return _0x7fb0c9[_0x9061('0x9e')](0xc8);}})[_0x9061('0x48')](handleError(_0x7fb0c9,null));};exports[_0x9061('0x9f')]=function(_0x3ddc09,_0x544b60,_0x2465f6){return BPromise[_0x9061('0xa0')]()[_0x9061('0x2a')](function(){if(!_0x3ddc09[_0x9061('0x34')][_0x9061('0x7')]){throw new Error(_0x9061('0xa1'));}if(!_0x3ddc09['query'][_0x9061('0xa2')]){throw new Error(_0x9061('0x94'));}var _0x29c5d6=_0x3ddc09[_0x9061('0x34')]['hostname']?_0x3ddc09[_0x9061('0x34')][_0x9061('0x95')]+':'+_0x3ddc09[_0x9061('0x34')][_0x9061('0xa2')]:_0x9061('0x96')+_0x3ddc09['query'][_0x9061('0xa2')];var _0x3aebd6=_0x3ddc09[_0x9061('0x34')][_0x9061('0x20')]?_0x3ddc09[_0x9061('0x34')]['json']:!![];var _0x220707=_0x3ddc09[_0x9061('0x34')][_0x9061('0x97')]?_0x3ddc09['query'][_0x9061('0x97')]:null;var _0x59c93e={'method':_0x3ddc09[_0x9061('0x98')],'uri':util['format'](_0x9061('0xa3'),_0x29c5d6,_0x3ddc09[_0x9061('0x34')][_0x9061('0x7')]),'json':_0x3aebd6,'resolveWithFullResponse':!![],'encoding':_0x220707,'body':_0x3ddc09['body']};if(_0x3ddc09[_0x9061('0x99')]){_0x59c93e[_0x9061('0x99')]=_0x3ddc09[_0x9061('0x99')];if(_0x59c93e[_0x9061('0x99')][_0x9061('0x9a')]){delete _0x59c93e['headers'][_0x9061('0x9a')];}}if(_0x59c93e[_0x9061('0x99')][_0x9061('0x9b')]){delete _0x59c93e[_0x9061('0x99')][_0x9061('0x9b')];}return rp(_0x59c93e);})[_0x9061('0x2a')](function(_0x4596b4){if(_0x4596b4){_0x544b60[_0x9061('0x25')](_0x4596b4[_0x9061('0x99')]);logger['info'](_0x4596b4[_0x9061('0x88')]);return _0x544b60[_0x9061('0x1f')](_0x4596b4[_0x9061('0x9d')])[_0x9061('0x90')](_0x4596b4[_0x9061('0x88')]);}else{return _0x544b60[_0x9061('0x9e')](0xc8);}})['catch'](handleError(_0x544b60,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index ec24f5e..e1f2c83 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 _0xf981=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xf981,0xe6));var _0x1f98=function(_0x23d366,_0x43733a){_0x23d366=_0x23d366-0x0;var _0x486eee=_0xf981[_0x23d366];return _0x486eee;};'use strict';var EventEmitter=require(_0x1f98('0x0'));var Plugin=require(_0x1f98('0x1'))['db'][_0x1f98('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x1f98('0x3')](0x0);var events={'afterCreate':_0x1f98('0x4'),'afterUpdate':_0x1f98('0x5'),'afterDestroy':_0x1f98('0x6')};function emitEvent(_0xd68165){return function(_0x562a81,_0x14da55,_0x15c6fa){PluginEvents[_0x1f98('0x7')](_0xd68165+':'+_0x562a81['id'],_0x562a81);PluginEvents[_0x1f98('0x7')](_0xd68165,_0x562a81);_0x15c6fa(null);};}for(var e in events){if(events[_0x1f98('0x8')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x0e76=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','update','remove'];(function(_0x2a27d2,_0x1194e5){var _0x18f683=function(_0x553e0d){while(--_0x553e0d){_0x2a27d2['push'](_0x2a27d2['shift']());}};_0x18f683(++_0x1194e5);}(_0x0e76,0xc4));var _0x60e7=function(_0x52ab62,_0x203d25){_0x52ab62=_0x52ab62-0x0;var _0x42f499=_0x0e76[_0x52ab62];return _0x42f499;};'use strict';var EventEmitter=require(_0x60e7('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x60e7('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x60e7('0x2'),'afterDestroy':_0x60e7('0x3')};function emitEvent(_0x16131f){return function(_0xd3886,_0x2f1ad1,_0x4ee126){PluginEvents[_0x60e7('0x4')](_0x16131f+':'+_0xd3886['id'],_0xd3886);PluginEvents[_0x60e7('0x4')](_0x16131f,_0xd3886);_0x4ee126(null);};}for(var e in events){if(events[_0x60e7('0x5')](e)){var event=events[e];Plugin[_0x60e7('0x6')](e,emitEvent(event));}}module[_0x60e7('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 8525179..e2d49de 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 _0xadb2=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','Plugin','plugins'];(function(_0x5d8ad5,_0x95ec33){var _0x1240ce=function(_0x2c7698){while(--_0x2c7698){_0x5d8ad5['push'](_0x5d8ad5['shift']());}};_0x1240ce(++_0x95ec33);}(_0xadb2,0x70));var _0x2adb=function(_0x40d347,_0x15582f){_0x40d347=_0x40d347-0x0;var _0x1175b7=_0xadb2[_0x40d347];return _0x1175b7;};'use strict';var _=require(_0x2adb('0x0'));var util=require(_0x2adb('0x1'));var logger=require(_0x2adb('0x2'))(_0x2adb('0x3'));var moment=require(_0x2adb('0x4'));var BPromise=require(_0x2adb('0x5'));var rp=require(_0x2adb('0x6'));var fs=require('fs');var path=require(_0x2adb('0x7'));var rimraf=require(_0x2adb('0x8'));var config=require(_0x2adb('0x9'));var attributes=require(_0x2adb('0xa'));module[_0x2adb('0xb')]=function(_0x58ff65,_0xecfe4e){return _0x58ff65['define'](_0x2adb('0xc'),attributes,{'tableName':_0x2adb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a1b=['../../config/environment','./plugin.attributes','exports','Plugin','util','../../config/logger','api','moment','bluebird','path'];(function(_0x38ba36,_0x1b931e){var _0x71e0f1=function(_0x2261a8){while(--_0x2261a8){_0x38ba36['push'](_0x38ba36['shift']());}};_0x71e0f1(++_0x1b931e);}(_0x0a1b,0xe0));var _0xb0a1=function(_0x2aeed9,_0x5379a0){_0x2aeed9=_0x2aeed9-0x0;var _0x59b3ec=_0x0a1b[_0x2aeed9];return _0x59b3ec;};'use strict';var _=require('lodash');var util=require(_0xb0a1('0x0'));var logger=require(_0xb0a1('0x1'))(_0xb0a1('0x2'));var moment=require(_0xb0a1('0x3'));var BPromise=require(_0xb0a1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb0a1('0x5'));var rimraf=require('rimraf');var config=require(_0xb0a1('0x6'));var attributes=require(_0xb0a1('0x7'));module[_0xb0a1('0x8')]=function(_0x583f2c,_0x39ebec){return _0x583f2c['define'](_0xb0a1('0x9'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 5c5b1c5..f404420 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 _0x71a0=['request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Plugin,\x20%s,\x20%s','result','CreatePlugin','Plugin','create','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./plugin.socket','register','then','info'];(function(_0xb366e8,_0x57ee03){var _0x20096f=function(_0xc95063){while(--_0xc95063){_0xb366e8['push'](_0xb366e8['shift']());}};_0x20096f(++_0x57ee03);}(_0x71a0,0xba));var _0x071a=function(_0x417a69,_0xef3d6d){_0x417a69=_0x417a69-0x0;var _0x457632=_0x71a0[_0x417a69];return _0x457632;};'use strict';var _=require('lodash');var util=require(_0x071a('0x0'));var moment=require(_0x071a('0x1'));var BPromise=require(_0x071a('0x2'));var rs=require(_0x071a('0x3'));var fs=require('fs');var Redis=require(_0x071a('0x4'));var db=require(_0x071a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x071a('0x6'))(_0x071a('0x7'));var config=require('../../config/environment');var jayson=require(_0x071a('0x8'));var client=jayson[_0x071a('0x9')][_0x071a('0xa')]({'port':0x232a});config[_0x071a('0xb')]=_[_0x071a('0xc')](config['redis'],{'host':_0x071a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x071a('0xb')]));require(_0x071a('0xe'))[_0x071a('0xf')](socket);function respondWithRpcPromise(_0x4c3e4e,_0x49e975,_0xb0258a){return new BPromise(function(_0x4903d6,_0x11687e){return client['request'](_0x4c3e4e,_0xb0258a)[_0x071a('0x10')](function(_0x1ffd79){logger[_0x071a('0x11')]('Plugin,\x20%s,\x20%s',_0x49e975,_0x071a('0x12'));logger[_0x071a('0x13')](_0x071a('0x14'),_0x49e975,_0x071a('0x12'),JSON[_0x071a('0x15')](_0x1ffd79));if(_0x1ffd79[_0x071a('0x16')]){if(_0x1ffd79[_0x071a('0x16')][_0x071a('0x17')]===0x1f4){logger[_0x071a('0x16')]('Plugin,\x20%s,\x20%s',_0x49e975,_0x1ffd79[_0x071a('0x16')][_0x071a('0x18')]);return _0x11687e(_0x1ffd79[_0x071a('0x16')][_0x071a('0x18')]);}logger[_0x071a('0x16')]('Plugin,\x20%s,\x20%s',_0x49e975,_0x1ffd79[_0x071a('0x16')][_0x071a('0x18')]);return _0x4903d6(_0x1ffd79['error'][_0x071a('0x18')]);}else{logger['info'](_0x071a('0x19'),_0x49e975,_0x071a('0x12'));_0x4903d6(_0x1ffd79[_0x071a('0x1a')][_0x071a('0x18')]);}})['catch'](function(_0x2687bd){logger[_0x071a('0x16')](_0x071a('0x19'),_0x49e975,_0x2687bd);_0x11687e(_0x2687bd);});});}exports[_0x071a('0x1b')]=function(_0x4823a7){var _0x28652a=this;return new Promise(function(_0x15684e,_0x3be8df){return db[_0x071a('0x1c')][_0x071a('0x1d')](_0x4823a7[_0x071a('0x1e')],{'raw':_0x4823a7[_0x071a('0x1f')]?_0x4823a7['options'][_0x071a('0x20')]===undefined?!![]:![]:!![]})[_0x071a('0x10')](function(_0x83367e){logger['info'](_0x071a('0x1b'),_0x4823a7);logger[_0x071a('0x13')](_0x071a('0x1b'),_0x4823a7,JSON[_0x071a('0x15')](_0x83367e));_0x15684e(_0x83367e);})[_0x071a('0x21')](function(_0x36a589){logger[_0x071a('0x16')](_0x071a('0x1b'),_0x36a589[_0x071a('0x18')],_0x4823a7);_0x3be8df(_0x28652a[_0x071a('0x16')](0x1f4,_0x36a589[_0x071a('0x18')]));});});}; \ No newline at end of file +var _0x7f0c=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreatePlugin','create','options','raw','debug'];(function(_0x2c2409,_0x4db145){var _0x2f1903=function(_0x3ce9bf){while(--_0x3ce9bf){_0x2c2409['push'](_0x2c2409['shift']());}};_0x2f1903(++_0x4db145);}(_0x7f0c,0xf8));var _0xc7f0=function(_0x175ea7,_0x37a68e){_0x175ea7=_0x175ea7-0x0;var _0x4b1437=_0x7f0c[_0x175ea7];return _0x4b1437;};'use strict';var _=require(_0xc7f0('0x0'));var util=require('util');var moment=require(_0xc7f0('0x1'));var BPromise=require(_0xc7f0('0x2'));var rs=require(_0xc7f0('0x3'));var fs=require('fs');var Redis=require(_0xc7f0('0x4'));var db=require(_0xc7f0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc7f0('0x6'));var config=require(_0xc7f0('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc7f0('0x8')]({'port':0x232a});config['redis']=_[_0xc7f0('0x9')](config[_0xc7f0('0xa')],{'host':_0xc7f0('0xb'),'port':0x18eb});var socket=require(_0xc7f0('0xc'))(new Redis(config[_0xc7f0('0xa')]));require(_0xc7f0('0xd'))[_0xc7f0('0xe')](socket);function respondWithRpcPromise(_0x24a3b9,_0x1802e2,_0x26eb73){return new BPromise(function(_0x5aca95,_0x541b60){return client[_0xc7f0('0xf')](_0x24a3b9,_0x26eb73)[_0xc7f0('0x10')](function(_0x4ed1c8){logger[_0xc7f0('0x11')](_0xc7f0('0x12'),_0x1802e2,_0xc7f0('0x13'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x1802e2,'request\x20sent',JSON[_0xc7f0('0x14')](_0x4ed1c8));if(_0x4ed1c8[_0xc7f0('0x15')]){if(_0x4ed1c8[_0xc7f0('0x15')][_0xc7f0('0x16')]===0x1f4){logger[_0xc7f0('0x15')](_0xc7f0('0x12'),_0x1802e2,_0x4ed1c8[_0xc7f0('0x15')][_0xc7f0('0x17')]);return _0x541b60(_0x4ed1c8['error'][_0xc7f0('0x17')]);}logger[_0xc7f0('0x15')](_0xc7f0('0x12'),_0x1802e2,_0x4ed1c8['error']['message']);return _0x5aca95(_0x4ed1c8[_0xc7f0('0x15')]['message']);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x1802e2,_0xc7f0('0x13'));_0x5aca95(_0x4ed1c8[_0xc7f0('0x18')]['message']);}})[_0xc7f0('0x19')](function(_0x3dd533){logger[_0xc7f0('0x15')]('Plugin,\x20%s,\x20%s',_0x1802e2,_0x3dd533);_0x541b60(_0x3dd533);});});}exports[_0xc7f0('0x1a')]=function(_0xe4cc03){var _0x3ca83b=this;return new Promise(function(_0x465238,_0x581477){return db['Plugin'][_0xc7f0('0x1b')](_0xe4cc03['body'],{'raw':_0xe4cc03[_0xc7f0('0x1c')]?_0xe4cc03[_0xc7f0('0x1c')][_0xc7f0('0x1d')]===undefined?!![]:![]:!![]})[_0xc7f0('0x10')](function(_0x47bb6d){logger[_0xc7f0('0x11')](_0xc7f0('0x1a'),_0xe4cc03);logger[_0xc7f0('0x1e')](_0xc7f0('0x1a'),_0xe4cc03,JSON[_0xc7f0('0x14')](_0x47bb6d));_0x465238(_0x47bb6d);})[_0xc7f0('0x19')](function(_0x705a33){logger['error'](_0xc7f0('0x1a'),_0x705a33[_0xc7f0('0x17')],_0xe4cc03);_0x581477(_0x3ca83b[_0xc7f0('0x15')](0x1f4,_0x705a33['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 54595bc..819bd95 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 _0x4434=['remove','emit','removeListener','register','plugin:'];(function(_0x2efaa3,_0x5f255b){var _0x49a48f=function(_0x54922d){while(--_0x54922d){_0x2efaa3['push'](_0x2efaa3['shift']());}};_0x49a48f(++_0x5f255b);}(_0x4434,0xa0));var _0x4443=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4434[_0x4b369d];return _0x571a98;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0x4443('0x0'),'update'];function createListener(_0x1824b6,_0x2a19c8){return function(_0xe35fa){_0x2a19c8[_0x4443('0x1')](_0x1824b6,_0xe35fa);};}function removeListener(_0x531dad,_0x27869d){return function(){PluginEvents[_0x4443('0x2')](_0x531dad,_0x27869d);};}exports[_0x4443('0x3')]=function(_0x33cfc2){for(var _0x230f87=0x0,_0x422dbc=events['length'];_0x230f87<_0x422dbc;_0x230f87++){var _0x5c79f1=events[_0x230f87];var _0x134c06=createListener(_0x4443('0x4')+_0x5c79f1,_0x33cfc2);PluginEvents['on'](_0x5c79f1,_0x134c06);}}; \ No newline at end of file +var _0xaeea=['removeListener','plugin:','./plugin.events','remove'];(function(_0x37a7d2,_0x4641bd){var _0x53029d=function(_0x56d6d0){while(--_0x56d6d0){_0x37a7d2['push'](_0x37a7d2['shift']());}};_0x53029d(++_0x4641bd);}(_0xaeea,0xbe));var _0xaaee=function(_0x9fd22e,_0x86249b){_0x9fd22e=_0x9fd22e-0x0;var _0x507ddd=_0xaeea[_0x9fd22e];return _0x507ddd;};'use strict';var PluginEvents=require(_0xaaee('0x0'));var events=['save',_0xaaee('0x1'),'update'];function createListener(_0x48619f,_0x13e25f){return function(_0x227a87){_0x13e25f['emit'](_0x48619f,_0x227a87);};}function removeListener(_0x5d308f,_0x3577be){return function(){PluginEvents[_0xaaee('0x2')](_0x5d308f,_0x3577be);};}exports['register']=function(_0x4d6a96){for(var _0x4a1360=0x0,_0x560a8e=events['length'];_0x4a1360<_0x560a8e;_0x4a1360++){var _0x523179=events[_0x4a1360];var _0x482052=createListener(_0xaaee('0x3')+_0x523179,_0x4d6a96);PluginEvents['on'](_0x523179,_0x482052);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 3d929cd..0ba207b 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(_0x280018,_0x54f59e){var _0x13152d=function(_0x3b8a61){while(--_0x3b8a61){_0x280018['push'](_0x280018['shift']());}};_0x13152d(++_0x54f59e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x5807be,_0x4ab16e){var _0xa52eeb=function(_0x1ac982){while(--_0x1ac982){_0x5807be['push'](_0x5807be['shift']());}};_0xa52eeb(++_0x4ab16e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 d7da791..6fc557a 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 _0x0fd9=['error','index','list','reject','express','then','catch','describe','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','hasOwnProperty','Unknown\x20status','params','Unknown\x20id','../../config/pm2','../../config/logger','api','path','bluebird','sendStatus','status','stack','name','send','npm\x20install','info'];(function(_0x510ffc,_0x1faa19){var _0xf4ef62=function(_0x1fec4d){while(--_0x1fec4d){_0x510ffc['push'](_0x510ffc['shift']());}};_0xf4ef62(++_0x1faa19);}(_0x0fd9,0xa3));var _0x90fd=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x0fd9[_0x519756];return _0x37047e;};'use strict';var _=require('lodash');var pm2=require(_0x90fd('0x0'));var logger=require(_0x90fd('0x1'))(_0x90fd('0x2'));var path=require(_0x90fd('0x3'));var exec=require('child_process')['exec'];var BPromise=require(_0x90fd('0x4'));function handleEntityNotFound(_0x2a5f76,_0xb7cf6){return function(_0x37a8be){if(!_0x37a8be){_0x2a5f76[_0x90fd('0x5')](0x194);;}return _0x37a8be;};}function respondWithResult(_0x23e11b,_0x5e2107){_0x5e2107=_0x5e2107||0xc8;return function(_0x4ff2d4){if(_0x4ff2d4){return _0x23e11b[_0x90fd('0x6')](_0x5e2107)['json'](_0x4ff2d4);}return null;};}function handleError(_0x5a604a,_0x2acef7){_0x2acef7=_0x2acef7||0x1f4;return function(_0x1becf2){logger['error'](_0x1becf2[_0x90fd('0x7')]);if(_0x1becf2[_0x90fd('0x8')]){delete _0x1becf2[_0x90fd('0x8')];}_0x5a604a[_0x90fd('0x6')](_0x2acef7)[_0x90fd('0x9')](_0x1becf2);};}function execChildProcess(){return new BPromise(function(_0x3be346,_0x2aae77){exec(_0x90fd('0xa'),function(_0x3c541e,_0x48943e,_0x23c417){logger[_0x90fd('0xb')](_0x48943e);logger['info'](_0x23c417);if(_0x3c541e){logger[_0x90fd('0xc')](_0x3c541e);return _0x2aae77(_0x3c541e);}return _0x3be346(_0x48943e);});});}exports[_0x90fd('0xd')]=function(_0x19a594,_0x5f28ab){return pm2[_0x90fd('0xe')]()['then'](function(_0x1cae40){if(_0x1cae40){var _0xb402d9=_[_0x90fd('0xf')](_0x1cae40,function(_0x1b3f3b){return _0x1b3f3b[_0x90fd('0x8')]===_0x90fd('0x10')||_0x1b3f3b[_0x90fd('0x8')]==='motion2';});return{'rows':_0xb402d9,'count':_0xb402d9['length']};}return null;})[_0x90fd('0x11')](respondWithResult(_0x5f28ab,null))[_0x90fd('0x12')](handleError(_0x5f28ab,null));};exports['show']=function(_0x130489,_0x13a694){return pm2[_0x90fd('0x13')](_0x130489['params']['id'])[_0x90fd('0x11')](respondWithResult(_0x13a694,null))[_0x90fd('0x11')](handleEntityNotFound(_0x13a694,null))[_0x90fd('0x12')](handleError(_0x13a694,null));};exports[_0x90fd('0x14')]=function(_0x251957,_0x58866f){if(_0x251957[_0x90fd('0x15')][_0x90fd('0x8')]&&_0x251957[_0x90fd('0x15')][_0x90fd('0x16')]){var _0x19e79b=path[_0x90fd('0x17')](__dirname,_0x90fd('0x18'),_0x251957[_0x90fd('0x15')][_0x90fd('0x16')]);var _0x493c26=process[_0x90fd('0x19')]();process[_0x90fd('0x1a')](path[_0x90fd('0x1b')](_0x19e79b));return execChildProcess()[_0x90fd('0x11')](function(_0x411a6a){process[_0x90fd('0x1a')](_0x493c26);return pm2[_0x90fd('0x1c')]({'name':_0x251957[_0x90fd('0x15')]['name'],'script':_0x19e79b});})[_0x90fd('0x11')](function(_0x52b066){pm2[_0x90fd('0x1d')]();return _0x52b066[0x0];})[_0x90fd('0x11')](respondWithResult(_0x58866f,0xc9))[_0x90fd('0x12')](handleError(_0x58866f,null));}else{return _0x58866f[_0x90fd('0x6')](0x1f4)[_0x90fd('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x90fd('0x1e')]=function(_0xe333f0,_0x2fffe6){if(_0xe333f0[_0x90fd('0x15')]['id']){delete _0xe333f0[_0x90fd('0x15')]['id'];}var _0x428bc2={'online':'restart','stopped':'stop'};if(_0x428bc2[_0x90fd('0x1f')](_0xe333f0[_0x90fd('0x15')][_0x90fd('0x6')])){return pm2[_0x428bc2[_0xe333f0[_0x90fd('0x15')][_0x90fd('0x6')]]](_0xe333f0['params']['id'])['then'](respondWithResult(_0x2fffe6,0xc8))[_0x90fd('0x12')](handleError(_0x2fffe6,null));}else{return _0x2fffe6[_0x90fd('0x6')](0x1f4)[_0x90fd('0x9')]({'message':_0x90fd('0x20')});}};exports['destroy']=function(_0x59aede,_0x12dea4){if(_0x59aede[_0x90fd('0x15')]['id']){delete _0x59aede[_0x90fd('0x15')]['id'];}if(_0x59aede[_0x90fd('0x21')]['id']){return pm2['delete'](_0x59aede[_0x90fd('0x21')]['id'])[_0x90fd('0x11')](function(_0x7fb8bc){pm2[_0x90fd('0x1d')]();return _0x7fb8bc[0x0];})[_0x90fd('0x11')](respondWithResult(_0x12dea4,null))[_0x90fd('0x12')](handleError(_0x12dea4,null));}else{return _0x12dea4[_0x90fd('0x6')](0x1f4)[_0x90fd('0x9')]({'message':_0x90fd('0x22')});}}; \ No newline at end of file +var _0xd87e=['catch','describe','params','create','body','script','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','api','path','child_process','bluebird','status','json','error','stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length'];(function(_0xdbf27,_0x58a52f){var _0x503cd8=function(_0x3316f5){while(--_0x3316f5){_0xdbf27['push'](_0xdbf27['shift']());}};_0x503cd8(++_0x58a52f);}(_0xd87e,0x1bf));var _0xed87=function(_0x375524,_0x51b2d8){_0x375524=_0x375524-0x0;var _0x4272b2=_0xd87e[_0x375524];return _0x4272b2;};'use strict';var _=require(_0xed87('0x0'));var pm2=require(_0xed87('0x1'));var logger=require('../../config/logger')(_0xed87('0x2'));var path=require(_0xed87('0x3'));var exec=require(_0xed87('0x4'))['exec'];var BPromise=require(_0xed87('0x5'));function handleEntityNotFound(_0x5e960f,_0x11a5d9){return function(_0x41ca7c){if(!_0x41ca7c){_0x5e960f['sendStatus'](0x194);;}return _0x41ca7c;};}function respondWithResult(_0x17adfe,_0x589fb9){_0x589fb9=_0x589fb9||0xc8;return function(_0x5da793){if(_0x5da793){return _0x17adfe[_0xed87('0x6')](_0x589fb9)[_0xed87('0x7')](_0x5da793);}return null;};}function handleError(_0x33e1c1,_0x2f348a){_0x2f348a=_0x2f348a||0x1f4;return function(_0x569d66){logger[_0xed87('0x8')](_0x569d66[_0xed87('0x9')]);if(_0x569d66[_0xed87('0xa')]){delete _0x569d66[_0xed87('0xa')];}_0x33e1c1[_0xed87('0x6')](_0x2f348a)[_0xed87('0xb')](_0x569d66);};}function execChildProcess(){return new BPromise(function(_0x293db4,_0x5b8ab4){exec(_0xed87('0xc'),function(_0xf104cb,_0x5cf4fe,_0x2f642f){logger[_0xed87('0xd')](_0x5cf4fe);logger['info'](_0x2f642f);if(_0xf104cb){logger['error'](_0xf104cb);return _0x5b8ab4(_0xf104cb);}return _0x293db4(_0x5cf4fe);});});}exports[_0xed87('0xe')]=function(_0x32276e,_0x353d46){return pm2[_0xed87('0xf')]()[_0xed87('0x10')](function(_0x3865c5){if(_0x3865c5){var _0x52dfe8=_[_0xed87('0x11')](_0x3865c5,function(_0x19b283){return _0x19b283[_0xed87('0xa')]===_0xed87('0x12')||_0x19b283[_0xed87('0xa')]===_0xed87('0x13');});return{'rows':_0x52dfe8,'count':_0x52dfe8[_0xed87('0x14')]};}return null;})[_0xed87('0x10')](respondWithResult(_0x353d46,null))[_0xed87('0x15')](handleError(_0x353d46,null));};exports['show']=function(_0x3db5ea,_0x18ab7d){return pm2[_0xed87('0x16')](_0x3db5ea[_0xed87('0x17')]['id'])['then'](respondWithResult(_0x18ab7d,null))[_0xed87('0x10')](handleEntityNotFound(_0x18ab7d,null))[_0xed87('0x15')](handleError(_0x18ab7d,null));};exports[_0xed87('0x18')]=function(_0x3f9e08,_0x98a2ca){if(_0x3f9e08[_0xed87('0x19')][_0xed87('0xa')]&&_0x3f9e08[_0xed87('0x19')][_0xed87('0x1a')]){var _0x52e81c=path['join'](__dirname,'../../files/plugins',_0x3f9e08['body'][_0xed87('0x1a')]);var _0x5d3ec8=process[_0xed87('0x1b')]();process[_0xed87('0x1c')](path['dirname'](_0x52e81c));return execChildProcess()[_0xed87('0x10')](function(_0x505733){process[_0xed87('0x1c')](_0x5d3ec8);return pm2[_0xed87('0x1d')]({'name':_0x3f9e08[_0xed87('0x19')][_0xed87('0xa')],'script':_0x52e81c});})[_0xed87('0x10')](function(_0x5d15b3){pm2[_0xed87('0x1e')]();return _0x5d15b3[0x0];})[_0xed87('0x10')](respondWithResult(_0x98a2ca,0xc9))[_0xed87('0x15')](handleError(_0x98a2ca,null));}else{return _0x98a2ca[_0xed87('0x6')](0x1f4)[_0xed87('0xb')]({'message':_0xed87('0x1f')});}};exports[_0xed87('0x20')]=function(_0x4735b3,_0x40b2fa){if(_0x4735b3[_0xed87('0x19')]['id']){delete _0x4735b3[_0xed87('0x19')]['id'];}var _0x341a35={'online':_0xed87('0x21'),'stopped':_0xed87('0x22')};if(_0x341a35['hasOwnProperty'](_0x4735b3[_0xed87('0x19')][_0xed87('0x6')])){return pm2[_0x341a35[_0x4735b3['body'][_0xed87('0x6')]]](_0x4735b3[_0xed87('0x17')]['id'])[_0xed87('0x10')](respondWithResult(_0x40b2fa,0xc8))['catch'](handleError(_0x40b2fa,null));}else{return _0x40b2fa['status'](0x1f4)[_0xed87('0xb')]({'message':_0xed87('0x23')});}};exports[_0xed87('0x24')]=function(_0x549a19,_0x37d45a){if(_0x549a19[_0xed87('0x19')]['id']){delete _0x549a19[_0xed87('0x19')]['id'];}if(_0x549a19[_0xed87('0x17')]['id']){return pm2[_0xed87('0x25')](_0x549a19[_0xed87('0x17')]['id'])[_0xed87('0x10')](function(_0x10509d){pm2[_0xed87('0x1e')]();return _0x10509d[0x0];})['then'](respondWithResult(_0x37d45a,null))[_0xed87('0x15')](handleError(_0x37d45a,null));}else{return _0x37d45a[_0xed87('0x6')](0x1f4)['send']({'message':_0xed87('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index e7705c4..9ed649d 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 _0xf5b6=['get','/queues','getQueues','exports','../../components/auth/service','./realtime.controller'];(function(_0x3c1b2d,_0x23b1b9){var _0x412475=function(_0x1245ad){while(--_0x1245ad){_0x3c1b2d['push'](_0x3c1b2d['shift']());}};_0x412475(++_0x23b1b9);}(_0xf5b6,0x1b4));var _0x6f5b=function(_0x390cc,_0x153450){_0x390cc=_0x390cc-0x0;var _0x1ab51c=_0xf5b6[_0x390cc];return _0x1ab51c;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x6f5b('0x0'));var controller=require(_0x6f5b('0x1'));router[_0x6f5b('0x2')](_0x6f5b('0x3'),auth['isAuthenticated'](),controller[_0x6f5b('0x4')]);module[_0x6f5b('0x5')]=router; \ No newline at end of file +var _0xf4ce=['/queues','isAuthenticated','express','./realtime.controller','get'];(function(_0x1e8ee2,_0x858d8d){var _0x486fbf=function(_0x563829){while(--_0x563829){_0x1e8ee2['push'](_0x1e8ee2['shift']());}};_0x486fbf(++_0x858d8d);}(_0xf4ce,0xf2));var _0xef4c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf4ce[_0x2dafbe];return _0x58a45a;};'use strict';var express=require(_0xef4c('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xef4c('0x1'));router[_0xef4c('0x2')](_0xef4c('0x3'),auth[_0xef4c('0x4')](),controller['getQueues']);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index e29b7ee..3a254f9 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 _0x5334=['Queues','UserProfile','findAndCountAll','voice','request','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','waiting','talking','paused','push','pTalking','originated','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','map','get','agents','pick','getAgents','online','getMembers','length','UserId','loggedInDb','User','Pause','findAll','catch','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','../../mysqldb','http','client','limit','undefined','count','offset','status','Content-Range','error','name','send','mail','chat','openchannel','fax','whatsapp','resolve','query','channel','toLowerCase','startCase','Queue','rawAttributes','fieldName','getOptions','user','userProfileId','type','outbound','QueueCampaigns'];(function(_0x57c6c1,_0x359351){var _0x1b1e7c=function(_0x3b7542){while(--_0x3b7542){_0x57c6c1['push'](_0x57c6c1['shift']());}};_0x1b1e7c(++_0x359351);}(_0x5334,0x84));var _0x4533=function(_0x345e6a,_0x16ef53){_0x345e6a=_0x345e6a-0x0;var _0x186d5b=_0x5334[_0x345e6a];return _0x186d5b;};'use strict';var util=require(_0x4533('0x0'));var _=require(_0x4533('0x1'));var jayson=require(_0x4533('0x2'));var qs=require(_0x4533('0x3'));var logger=require(_0x4533('0x4'))('api');var db=require(_0x4533('0x5'))['db'];var client=jayson['client'][_0x4533('0x6')]({'port':0x232a});var routingClient=jayson[_0x4533('0x7')]['http']({'port':0x232c});function respondWithFilteredResult(_0x4a576a,_0x51b4ce){return function(_0x201673){if(_0x201673){var _0x4dea06=typeof _0x51b4ce['offset']==='undefined'&&typeof _0x51b4ce[_0x4533('0x8')]===_0x4533('0x9');var _0x300877=_0x201673[_0x4533('0xa')];var _0x31018b=_0x4dea06?0x0:_0x51b4ce[_0x4533('0xb')];var _0xd417=_0x4dea06?_0x201673['count']:_0x51b4ce[_0x4533('0xb')]+_0x51b4ce[_0x4533('0x8')];var _0x1b52ee;if(_0xd417>=_0x300877){_0xd417=_0x300877;_0x1b52ee=0xc8;}else{_0x1b52ee=0xce;}_0x4a576a[_0x4533('0xc')](_0x1b52ee);return _0x4a576a['set'](_0x4533('0xd'),_0x31018b+'-'+_0xd417+'/'+_0x300877)['json'](_0x201673);}return null;};}function handleError(_0xc63e3,_0x439210){_0x439210=_0x439210||0x1f4;return function(_0x45ba67){logger[_0x4533('0xe')](_0x45ba67['stack']);if(_0x45ba67[_0x4533('0xf')]){delete _0x45ba67[_0x4533('0xf')];}_0xc63e3[_0x4533('0xc')](_0x439210)[_0x4533('0x10')](_0x45ba67);};}exports['getQueues']=function(_0xe47213,_0x573d84){var _0x4c703c=[_0x4533('0x11'),_0x4533('0x12'),'sms',_0x4533('0x13'),_0x4533('0x14'),_0x4533('0x15'),'voice'];var _0x3ed873={'count':0x0,'rows':[]},_0x4f732e={},_0x3ddb36;Promise[_0x4533('0x16')]()['then'](function(){if(_0xe47213[_0x4533('0x17')]['channel']){if(!_['includes'](_0x4c703c,_0xe47213[_0x4533('0x17')][_0x4533('0x18')]['toLowerCase']()))throw new Error('Invalid\x20channel');_0x3ddb36=_0xe47213[_0x4533('0x17')][_0x4533('0x18')][_0x4533('0x19')]();}var _0x1b08fa=_[_0x4533('0x1a')](_0x3ddb36)+_0x4533('0x1b');var _0x12adde=_['map'](db[_0x1b08fa][_0x4533('0x1c')],function(_0xd55c04){return{'name':_0xd55c04[_0x4533('0x1d')],'type':_0xd55c04['type']['key']};});_0x4f732e=qs[_0x4533('0x1e')](_0x12adde,_0xe47213);if(_0xe47213[_0x4533('0x1f')]['role']==='user'){var _0x307bdd={'params':{'id':_0xe47213[_0x4533('0x1f')][_0x4533('0x20')]},'query':{'section':_0x3ddb36==='voice'&&_0xe47213[_0x4533('0x17')][_0x4533('0x21')]===_0x4533('0x22')?_0x4533('0x23'):_[_0x4533('0x1a')](_0x3ddb36)+_0x4533('0x24'),'type':_0xe47213[_0x4533('0x17')][_0x4533('0x21')],'nolimit':!![],'sort':_0x4533('0xf'),'filter':_0xe47213['query']['filter']}};return db[_0x4533('0x25')]['getResources'](_0x307bdd);}return db[_0x1b08fa][_0x4533('0x26')](_0x4f732e);})['then'](function(_0x159fea){_0x3ed873[_0x4533('0xa')]=_0x159fea[_0x4533('0xa')];var _0x4300c1=_0x3ddb36===_0x4533('0x27')?client:routingClient;return _0x4300c1[_0x4533('0x28')](_[_0x4533('0x1a')](_0x3ddb36)+_0x4533('0x24'),_0xe47213)[_0x4533('0x29')](function(_0x43682f){if(_0x43682f[_0x4533('0xe')])throw new Error(util[_0x4533('0x2a')](_0x4533('0x2b'),_0x3ddb36));var _0x5bea54=_0x43682f[_0x4533('0x2c')];var _0x50e1b8=[_0x4533('0x2d'),_0x4533('0x2e'),_0x4533('0x2f'),_0x4533('0x30'),_0x4533('0x31')];if(_0x3ddb36===_0x4533('0x27')&&_0xe47213[_0x4533('0x17')][_0x4533('0x21')]===_0x4533('0x22')){_0x50e1b8[_0x4533('0x32')](_0x4533('0x33'),_0x4533('0x34'),'message',_0x4533('0x35'),_0x4533('0x36'),_0x4533('0x37'),_0x4533('0x38'),_0x4533('0x39'),'erlangCalls',_0x4533('0x3a'),_0x4533('0x3b'),_0x4533('0x3c'),_0x4533('0x3d'),_0x4533('0x3e'),_0x4533('0x3f'),'predictiveIntervalAvailable',_0x4533('0x40'),_0x4533('0x41'),'predictiveIntervalDroppedCallsTimeout',_0x4533('0x42'),_0x4533('0x43'),_0x4533('0x44'));}var _0x2f4943=_0x159fea[_0x4533('0x45')][_0x4533('0x46')](function(_0x424924){var _0x603753=_0x424924[_0x4533('0x47')]({'plain':!![]});_0x603753[_0x4533('0x31')]=0x0;_0x603753['loggedInDb']=0x0;_0x603753[_0x4533('0x2d')]=0x0;_0x603753[_0x4533('0x2e')]=0x0;_0x603753[_0x4533('0x31')]=0x0;_0x603753[_0x4533('0x2f')]=0x0;if(_0x3ddb36===_0x4533('0x27')){_0x603753[_0x4533('0x30')]=0x0;if(_0xe47213[_0x4533('0x17')][_0x4533('0x21')]===_0x4533('0x22')){_0x603753[_0x4533('0x33')]=0x0;_0x603753[_0x4533('0x34')]=0x0;}}_0x603753[_0x4533('0x48')]=[];var _0x495c26=_['find'](_0x5bea54[_0x4533('0x45')],['id',_0x603753['id']]);if(_0x495c26)_['merge'](_0x603753,_[_0x4533('0x49')](_0x495c26,_0x50e1b8));if(_0x3ddb36===_0x4533('0x27')){return _0x424924[_0x4533('0x4a')]({'attributes':['id',_0x4533('0xf'),_0x4533('0x4b')],'joinTableAttributes':[],'raw':!![]})[_0x4533('0x29')](function(_0x2df795){return _0x424924[_0x4533('0x4c')]({'raw':!![]})[_0x4533('0x29')](function(_0x44e754){for(var _0x44013d=0x0;_0x44013d<_0x2df795[_0x4533('0x4d')];_0x44013d++){var _0x10c03f=_['find'](_0x44e754,[_0x4533('0x4e'),_0x2df795[_0x44013d]['id']]);var _0x556dd9={'id':_0x2df795[_0x44013d]['id'],'name':_0x2df795[_0x44013d]['name'],'online':Boolean(_0x2df795[_0x44013d]['online']),'paused':_0x10c03f?Boolean(_0x10c03f['paused']):![]};if(_0x556dd9[_0x4533('0x4b')])_0x603753[_0x4533('0x4f')]++;if(_0x556dd9[_0x4533('0x31')])_0x603753[_0x4533('0x31')]++;_0x603753['agents'][_0x4533('0x32')](_0x556dd9);}return _0x603753;});});}else{var _0x369284=_0x4533('0x50')+_[_0x4533('0x1a')](_0x3ddb36)+_0x4533('0x1b');var _0x24e8de=_0x3ddb36+_0x4533('0x51');return db[_0x369284]['findAll']({'where':{[_[_0x4533('0x1a')](_0x3ddb36)+'QueueId']:_0x424924['id']},'raw':!![]})['then'](function(_0xbd54df){return db[_0x4533('0x50')][_0x4533('0x52')]({'attributes':['id',_0x4533('0xf'),'online',_0x24e8de],'where':{'id':_['map'](_0xbd54df,_0x4533('0x4e')),'role':'agent'},'raw':!![]});})[_0x4533('0x29')](function(_0x45b729){for(var _0x4e46c5=0x0;_0x4e46c5<_0x45b729['length'];_0x4e46c5++){var _0x55901c={'id':_0x45b729[_0x4e46c5]['id'],'name':_0x45b729[_0x4e46c5]['name'],'online':Boolean(_0x45b729[_0x4e46c5]['online']),'paused':Boolean(_0x45b729[_0x4e46c5][_0x24e8de])};if(_0x55901c[_0x4533('0x4b')])_0x603753['loggedInDb']++;if(_0x55901c[_0x4533('0x31')])_0x603753['paused']++;_0x603753[_0x4533('0x48')]['push'](_0x55901c);}return _0x603753;});}});return Promise['all'](_0x2f4943);});})[_0x4533('0x29')](function(_0x503eb4){_0x3ed873[_0x4533('0x45')]=_0x503eb4;return _0x3ed873;})['then'](respondWithFilteredResult(_0x573d84,_0x4f732e))[_0x4533('0x53')](handleError(_0x573d84,null));}; \ No newline at end of file +var _0x0adf=['talking','pTalking','find','rows','getAgents','online','getMembers','length','agents','Pause','findAll','QueueId','User','UserId','all','catch','util','lodash','jayson/promise','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit','count','status','json','stack','name','getQueues','mail','chat','sms','fax','whatsapp','voice','resolve','then','channel','includes','query','toLowerCase','startCase','Queue','map','rawAttributes','fieldName','type','key','getOptions','user','role','userProfileId','outbound','QueueCampaigns','Queues','filter','UserProfile','getResources','findAndCountAll','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','paused','push','originated','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','get','loggedInDb','waiting'];(function(_0x3be7ff,_0x12e714){var _0x186721=function(_0x2bc9e1){while(--_0x2bc9e1){_0x3be7ff['push'](_0x3be7ff['shift']());}};_0x186721(++_0x12e714);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x193dde,_0x4e2bd4){_0x193dde=_0x193dde-0x0;var _0x2e7546=_0x0adf[_0x193dde];return _0x2e7546;};'use strict';var util=require(_0xf0ad('0x0'));var _=require(_0xf0ad('0x1'));var jayson=require(_0xf0ad('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xf0ad('0x3'))(_0xf0ad('0x4'));var db=require(_0xf0ad('0x5'))['db'];var client=jayson[_0xf0ad('0x6')][_0xf0ad('0x7')]({'port':0x232a});var routingClient=jayson[_0xf0ad('0x6')][_0xf0ad('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x59a588,_0x3bbf85){return function(_0x53221f){if(_0x53221f){var _0x2eca0e=typeof _0x3bbf85[_0xf0ad('0x8')]===_0xf0ad('0x9')&&typeof _0x3bbf85[_0xf0ad('0xa')]===_0xf0ad('0x9');var _0x3bc706=_0x53221f[_0xf0ad('0xb')];var _0x5bdf69=_0x2eca0e?0x0:_0x3bbf85[_0xf0ad('0x8')];var _0x53c81a=_0x2eca0e?_0x53221f[_0xf0ad('0xb')]:_0x3bbf85[_0xf0ad('0x8')]+_0x3bbf85[_0xf0ad('0xa')];var _0x2a5d0e;if(_0x53c81a>=_0x3bc706){_0x53c81a=_0x3bc706;_0x2a5d0e=0xc8;}else{_0x2a5d0e=0xce;}_0x59a588[_0xf0ad('0xc')](_0x2a5d0e);return _0x59a588['set']('Content-Range',_0x5bdf69+'-'+_0x53c81a+'/'+_0x3bc706)[_0xf0ad('0xd')](_0x53221f);}return null;};}function handleError(_0x19892c,_0x3646a2){_0x3646a2=_0x3646a2||0x1f4;return function(_0x238c3b){logger['error'](_0x238c3b[_0xf0ad('0xe')]);if(_0x238c3b[_0xf0ad('0xf')]){delete _0x238c3b['name'];}_0x19892c['status'](_0x3646a2)['send'](_0x238c3b);};}exports[_0xf0ad('0x10')]=function(_0x513237,_0x1dad7b){var _0x313ad6=[_0xf0ad('0x11'),_0xf0ad('0x12'),_0xf0ad('0x13'),'openchannel',_0xf0ad('0x14'),_0xf0ad('0x15'),_0xf0ad('0x16')];var _0x1c9fac={'count':0x0,'rows':[]},_0x47fa2b={},_0x4e9970;Promise[_0xf0ad('0x17')]()[_0xf0ad('0x18')](function(){if(_0x513237['query'][_0xf0ad('0x19')]){if(!_[_0xf0ad('0x1a')](_0x313ad6,_0x513237[_0xf0ad('0x1b')][_0xf0ad('0x19')]['toLowerCase']()))throw new Error('Invalid\x20channel');_0x4e9970=_0x513237[_0xf0ad('0x1b')][_0xf0ad('0x19')][_0xf0ad('0x1c')]();}var _0x20c5f3=_[_0xf0ad('0x1d')](_0x4e9970)+_0xf0ad('0x1e');var _0x4e874a=_[_0xf0ad('0x1f')](db[_0x20c5f3][_0xf0ad('0x20')],function(_0x31635b){return{'name':_0x31635b[_0xf0ad('0x21')],'type':_0x31635b[_0xf0ad('0x22')][_0xf0ad('0x23')]};});_0x47fa2b=qs[_0xf0ad('0x24')](_0x4e874a,_0x513237);if(_0x513237[_0xf0ad('0x25')][_0xf0ad('0x26')]===_0xf0ad('0x25')){var _0x39b3e8={'params':{'id':_0x513237[_0xf0ad('0x25')][_0xf0ad('0x27')]},'query':{'section':_0x4e9970===_0xf0ad('0x16')&&_0x513237[_0xf0ad('0x1b')]['type']===_0xf0ad('0x28')?_0xf0ad('0x29'):_[_0xf0ad('0x1d')](_0x4e9970)+_0xf0ad('0x2a'),'type':_0x513237[_0xf0ad('0x1b')][_0xf0ad('0x22')],'nolimit':!![],'sort':'name','filter':_0x513237[_0xf0ad('0x1b')][_0xf0ad('0x2b')]}};return db[_0xf0ad('0x2c')][_0xf0ad('0x2d')](_0x39b3e8);}return db[_0x20c5f3][_0xf0ad('0x2e')](_0x47fa2b);})[_0xf0ad('0x18')](function(_0x267b7a){_0x1c9fac[_0xf0ad('0xb')]=_0x267b7a[_0xf0ad('0xb')];var _0x39c46c=_0x4e9970===_0xf0ad('0x16')?client:routingClient;return _0x39c46c['request'](_[_0xf0ad('0x1d')](_0x4e9970)+'Queues',_0x513237)[_0xf0ad('0x18')](function(_0x57a1f3){if(_0x57a1f3[_0xf0ad('0x2f')])throw new Error(util[_0xf0ad('0x30')](_0xf0ad('0x31'),_0x4e9970));var _0x3015ce=_0x57a1f3[_0xf0ad('0x32')];var _0xebb70b=[_0xf0ad('0x33'),_0xf0ad('0x34'),'waiting','talking',_0xf0ad('0x35')];if(_0x4e9970===_0xf0ad('0x16')&&_0x513237[_0xf0ad('0x1b')][_0xf0ad('0x22')]==='outbound'){_0xebb70b[_0xf0ad('0x36')]('pTalking',_0xf0ad('0x37'),'message',_0xf0ad('0x38'),'dialMethod',_0xf0ad('0x39'),_0xf0ad('0x3a'),_0xf0ad('0x3b'),_0xf0ad('0x3c'),_0xf0ad('0x3d'),_0xf0ad('0x3e'),_0xf0ad('0x3f'),_0xf0ad('0x40'),'dialPredictiveIntervalMaxThreshold',_0xf0ad('0x41'),'predictiveIntervalAvailable',_0xf0ad('0x42'),'predictiveIntervalAnsweredCalls',_0xf0ad('0x43'),_0xf0ad('0x44'),_0xf0ad('0x45'),_0xf0ad('0x46'));}var _0x82f4e4=_0x267b7a['rows'][_0xf0ad('0x1f')](function(_0x31c955){var _0x1d57d1=_0x31c955[_0xf0ad('0x47')]({'plain':!![]});_0x1d57d1[_0xf0ad('0x35')]=0x0;_0x1d57d1[_0xf0ad('0x48')]=0x0;_0x1d57d1[_0xf0ad('0x33')]=0x0;_0x1d57d1['available']=0x0;_0x1d57d1[_0xf0ad('0x35')]=0x0;_0x1d57d1[_0xf0ad('0x49')]=0x0;if(_0x4e9970===_0xf0ad('0x16')){_0x1d57d1[_0xf0ad('0x4a')]=0x0;if(_0x513237[_0xf0ad('0x1b')][_0xf0ad('0x22')]===_0xf0ad('0x28')){_0x1d57d1[_0xf0ad('0x4b')]=0x0;_0x1d57d1[_0xf0ad('0x37')]=0x0;}}_0x1d57d1['agents']=[];var _0x6b3854=_[_0xf0ad('0x4c')](_0x3015ce[_0xf0ad('0x4d')],['id',_0x1d57d1['id']]);if(_0x6b3854)_['merge'](_0x1d57d1,_['pick'](_0x6b3854,_0xebb70b));if(_0x4e9970==='voice'){return _0x31c955[_0xf0ad('0x4e')]({'attributes':['id',_0xf0ad('0xf'),_0xf0ad('0x4f')],'joinTableAttributes':[],'raw':!![]})[_0xf0ad('0x18')](function(_0x383633){return _0x31c955[_0xf0ad('0x50')]({'raw':!![]})[_0xf0ad('0x18')](function(_0x1dcbd0){for(var _0x3dfedd=0x0;_0x3dfedd<_0x383633[_0xf0ad('0x51')];_0x3dfedd++){var _0x2a7138=_['find'](_0x1dcbd0,['UserId',_0x383633[_0x3dfedd]['id']]);var _0x5cd1dc={'id':_0x383633[_0x3dfedd]['id'],'name':_0x383633[_0x3dfedd][_0xf0ad('0xf')],'online':Boolean(_0x383633[_0x3dfedd][_0xf0ad('0x4f')]),'paused':_0x2a7138?Boolean(_0x2a7138['paused']):![]};if(_0x5cd1dc[_0xf0ad('0x4f')])_0x1d57d1[_0xf0ad('0x48')]++;if(_0x5cd1dc['paused'])_0x1d57d1[_0xf0ad('0x35')]++;_0x1d57d1[_0xf0ad('0x52')][_0xf0ad('0x36')](_0x5cd1dc);}return _0x1d57d1;});});}else{var _0x440291='User'+_[_0xf0ad('0x1d')](_0x4e9970)+_0xf0ad('0x1e');var _0x172e14=_0x4e9970+_0xf0ad('0x53');return db[_0x440291][_0xf0ad('0x54')]({'where':{[_[_0xf0ad('0x1d')](_0x4e9970)+_0xf0ad('0x55')]:_0x31c955['id']},'raw':!![]})[_0xf0ad('0x18')](function(_0x32b020){return db[_0xf0ad('0x56')][_0xf0ad('0x54')]({'attributes':['id','name',_0xf0ad('0x4f'),_0x172e14],'where':{'id':_[_0xf0ad('0x1f')](_0x32b020,_0xf0ad('0x57')),'role':'agent'},'raw':!![]});})['then'](function(_0x2cf742){for(var _0x6b41e8=0x0;_0x6b41e8<_0x2cf742[_0xf0ad('0x51')];_0x6b41e8++){var _0x36500c={'id':_0x2cf742[_0x6b41e8]['id'],'name':_0x2cf742[_0x6b41e8][_0xf0ad('0xf')],'online':Boolean(_0x2cf742[_0x6b41e8][_0xf0ad('0x4f')]),'paused':Boolean(_0x2cf742[_0x6b41e8][_0x172e14])};if(_0x36500c[_0xf0ad('0x4f')])_0x1d57d1['loggedInDb']++;if(_0x36500c[_0xf0ad('0x35')])_0x1d57d1['paused']++;_0x1d57d1[_0xf0ad('0x52')][_0xf0ad('0x36')](_0x36500c);}return _0x1d57d1;});}});return Promise[_0xf0ad('0x58')](_0x82f4e4);});})[_0xf0ad('0x18')](function(_0x3e99db){_0x1c9fac['rows']=_0x3e99db;return _0x1c9fac;})['then'](respondWithFilteredResult(_0x1dad7b,_0x47fa2b))[_0xf0ad('0x59')](handleError(_0x1dad7b,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 82f7d3c..751d5b7 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x265094,_0x18c961){var _0x71f9c2=function(_0x548e38){while(--_0x548e38){_0x265094['push'](_0x265094['shift']());}};_0x71f9c2(++_0x18c961);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5e3227,_0x21b9a0){var _0x58c407=function(_0x46b3e0){while(--_0x46b3e0){_0x5e3227['push'](_0x5e3227['shift']());}};_0x58c407(++_0x21b9a0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0xcb91[_0x2c3255];return _0x282aba;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 7b45a3b..919c866 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 _0x5496=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x3182f0,_0x22236d){var _0x5adfc1=function(_0x28f6e5){while(--_0x28f6e5){_0x3182f0['push'](_0x3182f0['shift']());}};_0x5adfc1(++_0x22236d);}(_0x5496,0x175));var _0x6549=function(_0x35f73b,_0x1f48da){_0x35f73b=_0x35f73b-0x0;var _0x33e129=_0x5496[_0x35f73b];return _0x33e129;};'use strict';var Sequelize=require(_0x6549('0x0'));module[_0x6549('0x1')]={'state':{'type':Sequelize[_0x6549('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6549('0x3')]},'scheduledat':{'type':Sequelize[_0x6549('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6549('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x6549('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6549('0x3')]},'campaigntype':{'type':Sequelize[_0x6549('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7722=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x52eb51,_0x453cce){var _0x2b9cfa=function(_0x7650b4){while(--_0x7650b4){_0x52eb51['push'](_0x52eb51['shift']());}};_0x2b9cfa(++_0x453cce);}(_0x7722,0x14e));var _0x2772=function(_0x36cd4b,_0xebb10c){_0x36cd4b=_0x36cd4b-0x0;var _0x4138eb=_0x7722[_0x36cd4b];return _0x4138eb;};'use strict';var Sequelize=require(_0x2772('0x0'));module[_0x2772('0x1')]={'state':{'type':Sequelize[_0x2772('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x2772('0x3')]},'scheduledat':{'type':Sequelize[_0x2772('0x4')]},'uniqueid':{'type':Sequelize[_0x2772('0x3')]},'starttime':{'type':Sequelize[_0x2772('0x4')]},'responsetime':{'type':Sequelize[_0x2772('0x4')]},'ringtime':{'type':Sequelize[_0x2772('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x2772('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a139442..a35a565 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 _0x89b2=['define','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','exports'];(function(_0x491296,_0x26fef2){var _0x1b0f2b=function(_0x29391b){while(--_0x29391b){_0x491296['push'](_0x491296['shift']());}};_0x1b0f2b(++_0x26fef2);}(_0x89b2,0xd3));var _0x289b=function(_0x7472aa,_0x3971a1){_0x7472aa=_0x7472aa-0x0;var _0x12e552=_0x89b2[_0x7472aa];return _0x12e552;};'use strict';var _=require('lodash');var util=require(_0x289b('0x0'));var logger=require(_0x289b('0x1'))('api');var moment=require(_0x289b('0x2'));var BPromise=require(_0x289b('0x3'));var rp=require(_0x289b('0x4'));var fs=require('fs');var path=require(_0x289b('0x5'));var rimraf=require(_0x289b('0x6'));var config=require('../../config/environment');var attributes=require(_0x289b('0x7'));module[_0x289b('0x8')]=function(_0x269c10,_0x2717a2){return _0x269c10[_0x289b('0x9')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac57=['bluebird','request-promise','path','rimraf','exports','define','ReportAgentPreview','lodash','util','api'];(function(_0x4be880,_0x366e2c){var _0x50efe3=function(_0x5b0b71){while(--_0x5b0b71){_0x4be880['push'](_0x4be880['shift']());}};_0x50efe3(++_0x366e2c);}(_0xac57,0xe3));var _0x7ac5=function(_0x88a94f,_0x3cd27d){_0x88a94f=_0x88a94f-0x0;var _0x4db244=_0xac57[_0x88a94f];return _0x4db244;};'use strict';var _=require(_0x7ac5('0x0'));var util=require(_0x7ac5('0x1'));var logger=require('../../config/logger')(_0x7ac5('0x2'));var moment=require('moment');var BPromise=require(_0x7ac5('0x3'));var rp=require(_0x7ac5('0x4'));var fs=require('fs');var path=require(_0x7ac5('0x5'));var rimraf=require(_0x7ac5('0x6'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0x7ac5('0x7')]=function(_0x1b347a,_0x112f94){return _0x1b347a[_0x7ac5('0x8')](_0x7ac5('0x9'),attributes,{'tableName':'report_agent_preview','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 b832fa4..20a93e9 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 _0x8263=['options','raw','then','CreateReportAgentPreview','stringify','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ReportAgentPreview'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8263,0x1a9));var _0x3826=function(_0x2b9d86,_0x57629b){_0x2b9d86=_0x2b9d86-0x0;var _0x352b60=_0x8263[_0x2b9d86];return _0x352b60;};'use strict';var _=require(_0x3826('0x0'));var util=require('util');var moment=require(_0x3826('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3826('0x2'));var db=require(_0x3826('0x3'))['db'];var utils=require(_0x3826('0x4'));var logger=require(_0x3826('0x5'))(_0x3826('0x6'));var config=require(_0x3826('0x7'));var jayson=require(_0x3826('0x8'));var client=jayson[_0x3826('0x9')][_0x3826('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31f77e,_0x40fa61,_0x4e58f8){return new BPromise(function(_0x4160e5,_0x1cbf90){return client[_0x3826('0xb')](_0x31f77e,_0x4e58f8)['then'](function(_0xc74ed7){logger[_0x3826('0xc')](_0x3826('0xd'),_0x40fa61,_0x3826('0xe'));logger[_0x3826('0xf')](_0x3826('0x10'),_0x40fa61,_0x3826('0xe'),JSON['stringify'](_0xc74ed7));if(_0xc74ed7[_0x3826('0x11')]){if(_0xc74ed7[_0x3826('0x11')][_0x3826('0x12')]===0x1f4){logger['error'](_0x3826('0xd'),_0x40fa61,_0xc74ed7['error'][_0x3826('0x13')]);return _0x1cbf90(_0xc74ed7[_0x3826('0x11')][_0x3826('0x13')]);}logger[_0x3826('0x11')](_0x3826('0xd'),_0x40fa61,_0xc74ed7[_0x3826('0x11')]['message']);return _0x4160e5(_0xc74ed7[_0x3826('0x11')]['message']);}else{logger[_0x3826('0xc')](_0x3826('0xd'),_0x40fa61,_0x3826('0xe'));_0x4160e5(_0xc74ed7[_0x3826('0x14')][_0x3826('0x13')]);}})[_0x3826('0x15')](function(_0x4d4f0d){logger[_0x3826('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x40fa61,_0x4d4f0d);_0x1cbf90(_0x4d4f0d);});});}exports['CreateReportAgentPreview']=function(_0x49df41){var _0x1d42a3=this;return new Promise(function(_0x1e8e1e,_0x4d5df5){return db[_0x3826('0x16')]['create'](_0x49df41['body'],{'raw':_0x49df41[_0x3826('0x17')]?_0x49df41[_0x3826('0x17')][_0x3826('0x18')]===undefined?!![]:![]:!![]})[_0x3826('0x19')](function(_0x38df5e){logger['info'](_0x3826('0x1a'),_0x49df41);logger['debug']('CreateReportAgentPreview',_0x49df41,JSON[_0x3826('0x1b')](_0x38df5e));_0x1e8e1e(_0x38df5e);})[_0x3826('0x15')](function(_0x33d2e0){logger[_0x3826('0x11')](_0x3826('0x1a'),_0x33d2e0[_0x3826('0x13')],_0x49df41);_0x4d5df5(_0x1d42a3[_0x3826('0x11')](0x1f4,_0x33d2e0['message']));});});}; \ No newline at end of file +var _0x3516=['rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','ReportAgentPreview,\x20%s,\x20%s','message','catch','CreateReportAgentPreview','ReportAgentPreview','options','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x1ec8e5,_0x18fb49){var _0x1542f9=function(_0x492151){while(--_0x492151){_0x1ec8e5['push'](_0x1ec8e5['shift']());}};_0x1542f9(++_0x18fb49);}(_0x3516,0xc9));var _0x6351=function(_0x1eb066,_0x17ca51){_0x1eb066=_0x1eb066-0x0;var _0x1daea8=_0x3516[_0x1eb066];return _0x1daea8;};'use strict';var _=require('lodash');var util=require(_0x6351('0x0'));var moment=require(_0x6351('0x1'));var BPromise=require('bluebird');var rs=require(_0x6351('0x2'));var fs=require('fs');var Redis=require(_0x6351('0x3'));var db=require(_0x6351('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6351('0x5'))(_0x6351('0x6'));var config=require(_0x6351('0x7'));var jayson=require(_0x6351('0x8'));var client=jayson['client'][_0x6351('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b7110,_0x2a8ece,_0x332adc){return new BPromise(function(_0x358b62,_0xcf05c2){return client[_0x6351('0xa')](_0x5b7110,_0x332adc)[_0x6351('0xb')](function(_0x1ab9ec){logger[_0x6351('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x2a8ece,'request\x20sent');logger[_0x6351('0xd')](_0x6351('0xe'),_0x2a8ece,_0x6351('0xf'),JSON['stringify'](_0x1ab9ec));if(_0x1ab9ec[_0x6351('0x10')]){if(_0x1ab9ec[_0x6351('0x10')]['code']===0x1f4){logger[_0x6351('0x10')](_0x6351('0x11'),_0x2a8ece,_0x1ab9ec[_0x6351('0x10')][_0x6351('0x12')]);return _0xcf05c2(_0x1ab9ec['error'][_0x6351('0x12')]);}logger['error'](_0x6351('0x11'),_0x2a8ece,_0x1ab9ec[_0x6351('0x10')][_0x6351('0x12')]);return _0x358b62(_0x1ab9ec[_0x6351('0x10')]['message']);}else{logger['info'](_0x6351('0x11'),_0x2a8ece,'request\x20sent');_0x358b62(_0x1ab9ec['result'][_0x6351('0x12')]);}})[_0x6351('0x13')](function(_0x50784b){logger[_0x6351('0x10')](_0x6351('0x11'),_0x2a8ece,_0x50784b);_0xcf05c2(_0x50784b);});});}exports[_0x6351('0x14')]=function(_0x1f1868){var _0x546383=this;return new Promise(function(_0xf0cd0f,_0x305b0b){return db[_0x6351('0x15')]['create'](_0x1f1868['body'],{'raw':_0x1f1868[_0x6351('0x16')]?_0x1f1868[_0x6351('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x6351('0xb')](function(_0x5d5377){logger[_0x6351('0xc')](_0x6351('0x14'),_0x1f1868);logger[_0x6351('0xd')]('CreateReportAgentPreview',_0x1f1868,JSON['stringify'](_0x5d5377));_0xf0cd0f(_0x5d5377);})[_0x6351('0x13')](function(_0x254f3e){logger[_0x6351('0x10')](_0x6351('0x14'),_0x254f3e['message'],_0x1f1868);_0x305b0b(_0x546383[_0x6351('0x10')](0x1f4,_0x254f3e[_0x6351('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index a98cdc8..49d2004 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 _0x1c90=['/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id','/chat/queues/:id/notify','queueNotify','chat','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/agents/:id/notify','agentNotify','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions'];(function(_0x4b9d40,_0x66094f){var _0x4d69ba=function(_0x5ad45b){while(--_0x5ad45b){_0x4b9d40['push'](_0x4b9d40['shift']());}};_0x4d69ba(++_0x66094f);}(_0x1c90,0x188));var _0x01c9=function(_0x529d20,_0x2cc420){_0x529d20=_0x529d20-0x0;var _0x18bc73=_0x1c90[_0x529d20];return _0x18bc73;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x01c9('0x0'));var express=require('express');var router=express[_0x01c9('0x1')]();var auth=require(_0x01c9('0x2'));var controller=require(_0x01c9('0x3'));router[_0x01c9('0x4')](_0x01c9('0x5'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x7')]);router[_0x01c9('0x4')](_0x01c9('0x8'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x9')]);router['get'](_0x01c9('0xa'),auth[_0x01c9('0x6')](),controller[_0x01c9('0xb')]);router[_0x01c9('0x4')](_0x01c9('0xc'),auth['isAuthenticated'](),controller[_0x01c9('0xd')]);router[_0x01c9('0x4')](_0x01c9('0xe'),auth[_0x01c9('0x6')](),controller[_0x01c9('0xf')]);router[_0x01c9('0x4')]('/mail/queues',auth[_0x01c9('0x6')](),controller[_0x01c9('0x10')]);router[_0x01c9('0x4')]('/mail/accounts',auth['isAuthenticated'](),controller[_0x01c9('0x11')]);router[_0x01c9('0x4')](_0x01c9('0x12'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x13')]);router[_0x01c9('0x4')](_0x01c9('0x14'),auth[_0x01c9('0x6')](),controller['smsQueues']);router[_0x01c9('0x4')](_0x01c9('0x15'),auth[_0x01c9('0x6')](),controller['whatsappQueues']);router[_0x01c9('0x4')](_0x01c9('0x16'),auth['isAuthenticated'](),controller[_0x01c9('0x17')]);router[_0x01c9('0x4')](_0x01c9('0x18'),auth['isAuthenticated'](),controller[_0x01c9('0x19')]);router[_0x01c9('0x4')]('/voice/queues/channels',auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0x01c9('0x4')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x01c9('0x1a')]);router['get'](_0x01c9('0x1b'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x1c')]);router[_0x01c9('0x4')](_0x01c9('0x1d'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x1e')]);router['get'](_0x01c9('0x1f'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x20')]);router[_0x01c9('0x21')](_0x01c9('0x1f'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x22')]);router[_0x01c9('0x4')]('/outbound',auth[_0x01c9('0x6')](),controller['outbound']);router[_0x01c9('0x4')](_0x01c9('0x23'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x24')]);router['get'](_0x01c9('0x25'),auth['isAuthenticated'](),controller[_0x01c9('0x26')]);router['put'](_0x01c9('0x27'),auth['isAuthenticated'](),controller[_0x01c9('0x28')]);router[_0x01c9('0x4')](_0x01c9('0x29'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x2a')]);router[_0x01c9('0x4')](_0x01c9('0x2b'),auth[_0x01c9('0x6')](),controller['trunks']);router['get']('/campaigns',auth['isAuthenticated'](),controller['campaigns']);router[_0x01c9('0x4')]('/fax/accounts',auth[_0x01c9('0x6')](),controller['faxAccounts']);router[_0x01c9('0x4')](_0x01c9('0x2c'),auth[_0x01c9('0x6')](),controller['chatQueuesWaitingInteractions']);router[_0x01c9('0x4')](_0x01c9('0x2d'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x2e')]);router[_0x01c9('0x4')](_0x01c9('0x2f'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x30')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x01c9('0x6')](),controller[_0x01c9('0x31')]);router[_0x01c9('0x4')](_0x01c9('0x32'),auth['isAuthenticated'](),controller[_0x01c9('0x33')]);router[_0x01c9('0x4')](_0x01c9('0x34'),auth['isAuthenticated'](),controller[_0x01c9('0x35')]);router['get'](_0x01c9('0x36'),auth['isAuthenticated'](),controller[_0x01c9('0x37')]);router[_0x01c9('0x38')]('/mail/queues/:id/notify',auth[_0x01c9('0x6')](),controller['queueNotify']('mail'));router['get'](_0x01c9('0x39'),auth[_0x01c9('0x6')](),controller['showMailQueues']);router[_0x01c9('0x38')](_0x01c9('0x3a'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x3b')](_0x01c9('0x3c')));router['get']('/chat/queues/:id',auth[_0x01c9('0x6')](),controller[_0x01c9('0x3d')]);router[_0x01c9('0x38')](_0x01c9('0x3e'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x3b')]('fax'));router[_0x01c9('0x4')](_0x01c9('0x3f'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x40')]);router[_0x01c9('0x38')]('/openchannel/queues/:id/notify',auth[_0x01c9('0x6')](),controller[_0x01c9('0x3b')]('openchannel'));router[_0x01c9('0x4')](_0x01c9('0x41'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0x01c9('0x38')](_0x01c9('0x42'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x3b')](_0x01c9('0x43')));router['post'](_0x01c9('0x44'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x3b')](_0x01c9('0x45')));router[_0x01c9('0x4')](_0x01c9('0x46'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x47')]);router[_0x01c9('0x4')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0x01c9('0x38')](_0x01c9('0x48'),auth[_0x01c9('0x6')](),controller[_0x01c9('0x49')]);module['exports']=router; \ No newline at end of file +var _0xee68=['/agents/:id/notify','agentNotify','exports','multer','util','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','isAuthenticated','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/fax/queues','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','agentCapacity','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','/chat/queues/:id/notify','queueNotify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xee68,0x1d7));var _0x8ee6=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0xee68[_0x365be9];return _0x185c12;};'use strict';var multer=require(_0x8ee6('0x0'));var util=require(_0x8ee6('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x8ee6('0x2'));var controller=require(_0x8ee6('0x3'));router[_0x8ee6('0x4')](_0x8ee6('0x5'),auth['isAuthenticated'](),controller[_0x8ee6('0x6')]);router[_0x8ee6('0x4')](_0x8ee6('0x7'),auth['isAuthenticated'](),controller[_0x8ee6('0x8')]);router[_0x8ee6('0x4')](_0x8ee6('0x9'),auth['isAuthenticated'](),controller[_0x8ee6('0xa')]);router[_0x8ee6('0x4')](_0x8ee6('0xb'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0xd')]);router[_0x8ee6('0x4')](_0x8ee6('0xe'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0xf')]);router[_0x8ee6('0x4')]('/mail/queues',auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x10')]);router[_0x8ee6('0x4')](_0x8ee6('0x11'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x12')]);router[_0x8ee6('0x4')](_0x8ee6('0x13'),auth[_0x8ee6('0xc')](),controller['openchannelQueues']);router[_0x8ee6('0x4')](_0x8ee6('0x14'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x15')]);router['get']('/whatsapp/queues',auth[_0x8ee6('0xc')](),controller['whatsappQueues']);router[_0x8ee6('0x4')](_0x8ee6('0x16'),auth['isAuthenticated'](),controller['faxQueues']);router[_0x8ee6('0x4')]('/voice/queues/preview/:id',auth[_0x8ee6('0xc')](),controller['voiceQueuesPreview']);router[_0x8ee6('0x4')](_0x8ee6('0x17'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x18')]);router[_0x8ee6('0x4')](_0x8ee6('0x19'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x1a')]);router[_0x8ee6('0x4')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x1b')]);router[_0x8ee6('0x4')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x1c')]);router[_0x8ee6('0x4')](_0x8ee6('0x1d'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x1e')]);router[_0x8ee6('0x1f')]('/voice/queues/:id',auth[_0x8ee6('0xc')](),controller['updateVoiceQueue']);router[_0x8ee6('0x4')](_0x8ee6('0x20'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x21')]);router[_0x8ee6('0x4')](_0x8ee6('0x22'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x23')]);router['get']('/agents',auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x24')]);router[_0x8ee6('0x1f')](_0x8ee6('0x25'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x26')]);router[_0x8ee6('0x4')]('/telephones',auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x27')]);router[_0x8ee6('0x4')]('/trunks',auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x28')]);router[_0x8ee6('0x4')](_0x8ee6('0x29'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x2a')]);router[_0x8ee6('0x4')](_0x8ee6('0x2b'),auth['isAuthenticated'](),controller[_0x8ee6('0x2c')]);router[_0x8ee6('0x4')](_0x8ee6('0x2d'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x2e')]);router[_0x8ee6('0x4')](_0x8ee6('0x2f'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x30')]);router['get'](_0x8ee6('0x31'),auth['isAuthenticated'](),controller[_0x8ee6('0x32')]);router[_0x8ee6('0x4')](_0x8ee6('0x33'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x34')]);router['get'](_0x8ee6('0x35'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x36')]);router[_0x8ee6('0x4')](_0x8ee6('0x37'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x38')]);router[_0x8ee6('0x4')](_0x8ee6('0x39'),auth[_0x8ee6('0xc')](),controller['faxQueuesWaitingInteractions']);router[_0x8ee6('0x3a')](_0x8ee6('0x3b'),auth[_0x8ee6('0xc')](),controller['queueNotify'](_0x8ee6('0x3c')));router[_0x8ee6('0x4')](_0x8ee6('0x3d'),auth[_0x8ee6('0xc')](),controller['showMailQueues']);router[_0x8ee6('0x3a')](_0x8ee6('0x3e'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x3f')]('chat'));router[_0x8ee6('0x4')]('/chat/queues/:id',auth['isAuthenticated'](),controller['showChatQueues']);router[_0x8ee6('0x3a')]('/fax/queues/:id/notify',auth[_0x8ee6('0xc')](),controller['queueNotify'](_0x8ee6('0x40')));router[_0x8ee6('0x4')](_0x8ee6('0x41'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x42')]);router[_0x8ee6('0x3a')](_0x8ee6('0x43'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x3f')]('openchannel'));router[_0x8ee6('0x4')](_0x8ee6('0x44'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x45')]);router[_0x8ee6('0x3a')](_0x8ee6('0x46'),auth['isAuthenticated'](),controller['queueNotify'](_0x8ee6('0x47')));router['post'](_0x8ee6('0x48'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x3f')]('whatsapp'));router[_0x8ee6('0x4')](_0x8ee6('0x49'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x4a')]);router[_0x8ee6('0x4')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0x8ee6('0x3a')](_0x8ee6('0x4b'),auth[_0x8ee6('0xc')](),controller[_0x8ee6('0x4c')]);module[_0x8ee6('0x4d')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 21813f5..3b90e33 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 _0xeec6=['YYYY-MM-DD\x20HH:mm:ss','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','update','queue','InteractionId','From','QueueId','TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','\x20Message\x20not\x20found','bluebird','moment','lodash','util','../../config/logger','api','jayson/promise','client','http','request','then','error','message','result','status','sendStatus','stack','name','send','isNil','find','rows','VoiceChannels','query','catch','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','interaction','hasOwnProperty','MemberReport','INTERACTION','length','format','SIP/%s','interface'];(function(_0x340c91,_0x468c49){var _0x408fc3=function(_0x439277){while(--_0x439277){_0x340c91['push'](_0x340c91['shift']());}};_0x408fc3(++_0x468c49);}(_0xeec6,0x1c2));var _0x6eec=function(_0x7b173,_0x539d7f){_0x7b173=_0x7b173-0x0;var _0x1c598c=_0xeec6[_0x7b173];return _0x1c598c;};'use strict';var BPromise=require(_0x6eec('0x0'));var moment=require(_0x6eec('0x1'));var _=require(_0x6eec('0x2'));var util=require(_0x6eec('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x6eec('0x4'))(_0x6eec('0x5'));var jayson=require(_0x6eec('0x6'));var amiClient=jayson[_0x6eec('0x7')][_0x6eec('0x8')]({'port':0x232a});var mailClient=jayson[_0x6eec('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0x6eec('0x7')][_0x6eec('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){var _0x56e849=_0x1c810e?_0x1c810e:amiClient;return _0x56e849[_0x6eec('0x9')](_0x48064a,_0x5a5e47)[_0x6eec('0xa')](function(_0x1c774d){if(_0x1c774d['error']){if(_0x1c774d['error']['code']===0x1f4){return _0x834c2(_0x1c774d[_0x6eec('0xb')][_0x6eec('0xc')]);}return _0x3443c2(_0x1c774d['error']['message']);}else{_0x3443c2(_0x1c774d[_0x6eec('0xd')]);}})['catch'](function(_0x3091d0){_0x834c2(_0x3091d0);});});}function respondWithResult(_0x3387c2,_0x162db1){_0x162db1=_0x162db1||0xc8;return function(_0x3fe94b){if(_0x3fe94b){return _0x3387c2[_0x6eec('0xe')](_0x162db1)['json'](_0x3fe94b);}return _0x3387c2[_0x6eec('0xf')](0x194);};}function handleError(_0x3b2972,_0x462dbb){_0x462dbb=_0x462dbb||0x1f4;return function(_0xc35914){logger[_0x6eec('0xb')](_0xc35914[_0x6eec('0x10')]);if(_0xc35914[_0x6eec('0x11')]){delete _0xc35914[_0x6eec('0x11')];}_0x3b2972[_0x6eec('0xe')](_0x462dbb)[_0x6eec('0x12')](_0xc35914);};}function findById(_0x5e2a9b){return function(_0x3c0c1b){if(!_['isNil'](_0x5e2a9b)&&!_[_0x6eec('0x13')](_0x3c0c1b)&&!_[_0x6eec('0x13')](_0x3c0c1b['rows'])){return _[_0x6eec('0x14')](_0x3c0c1b[_0x6eec('0x15')],function(_0xb1eab7){return _0xb1eab7['id']==_0x5e2a9b;});}return null;};}exports['voiceChannels']=function(_0x87f3be,_0x1ed94c){return respondWithRpcPromise(_0x6eec('0x16'),_0x87f3be[_0x6eec('0x17')])[_0x6eec('0xa')](respondWithResult(_0x1ed94c,null))[_0x6eec('0x18')](handleError(_0x1ed94c,null));};exports['voiceChannelMixMonitor']=function(_0x328693,_0x2f843e){return respondWithRpcPromise(_0x6eec('0x19'),_[_0x6eec('0x1a')](_0x328693[_0x6eec('0x17')],_0x328693[_0x6eec('0x1b')]))['then'](respondWithResult(_0x2f843e,null))[_0x6eec('0x18')](handleError(_0x2f843e,null));};exports[_0x6eec('0x1c')]=function(_0x285d41,_0x27785a){return respondWithRpcPromise(_0x6eec('0x1d'),_[_0x6eec('0x1a')](_0x285d41['query'],_0x285d41[_0x6eec('0x1b')]))[_0x6eec('0xa')](respondWithResult(_0x27785a,null))[_0x6eec('0x18')](handleError(_0x27785a,null));};exports[_0x6eec('0x1e')]=function(_0x1d2be9,_0x1f386c){return respondWithRpcPromise(_0x6eec('0x1f'),_0x1d2be9[_0x6eec('0x17')])[_0x6eec('0xa')](respondWithResult(_0x1f386c,null))['catch'](handleError(_0x1f386c,null));};exports[_0x6eec('0x20')]=function(_0x44b31c,_0x30eb98){return respondWithRpcPromise(_0x6eec('0x1f'),_0x44b31c['query'])[_0x6eec('0xa')](findById(_0x44b31c[_0x6eec('0x1b')]['id']))['then'](respondWithResult(_0x30eb98,null))['catch'](handleError(_0x30eb98,null));};exports[_0x6eec('0x21')]=function(_0x47ed95,_0x20a130){return respondWithRpcPromise(_0x6eec('0x22'),_[_0x6eec('0x1a')](_0x47ed95[_0x6eec('0x23')],_0x47ed95[_0x6eec('0x1b')]))[_0x6eec('0xa')](respondWithResult(_0x20a130,null))[_0x6eec('0x18')](handleError(_0x20a130,null));};exports[_0x6eec('0x24')]=function(_0x1abd19,_0x414f5b){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x6eec('0x1a')](_0x1abd19['query'],_0x1abd19[_0x6eec('0x1b')]))[_0x6eec('0xa')](respondWithResult(_0x414f5b,null))[_0x6eec('0x18')](handleError(_0x414f5b,null));};exports['voiceQueuesChannels']=function(_0x57b40b,_0x508735){return respondWithRpcPromise(_0x6eec('0x25'),_0x57b40b[_0x6eec('0x17')])[_0x6eec('0xa')](respondWithResult(_0x508735,null))[_0x6eec('0x18')](handleError(_0x508735,null));};exports[_0x6eec('0x26')]=function(_0x23547d,_0x22e0cb){return respondWithRpcPromise(_0x6eec('0x27'),_[_0x6eec('0x1a')](_0x23547d[_0x6eec('0x17')],_0x23547d[_0x6eec('0x1b')]))[_0x6eec('0xa')](respondWithResult(_0x22e0cb,null))['catch'](handleError(_0x22e0cb,null));};exports[_0x6eec('0x28')]=function(_0x361ab7,_0x2c83d1){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x6eec('0x1a')](_0x361ab7[_0x6eec('0x17')],_0x361ab7[_0x6eec('0x1b')]))[_0x6eec('0xa')](respondWithResult(_0x2c83d1,null))[_0x6eec('0x18')](handleError(_0x2c83d1,null));};exports[_0x6eec('0x29')]=function(_0x4a7699,_0x45cfb6){return respondWithRpcPromise(_0x6eec('0x2a'),_[_0x6eec('0x1a')](_0x4a7699['query'],_0x4a7699['params']))[_0x6eec('0xa')](respondWithResult(_0x45cfb6,null))[_0x6eec('0x18')](handleError(_0x45cfb6,null));};exports[_0x6eec('0x2b')]=function(_0x3f79d1,_0x402bac){return respondWithRpcPromise('Outbound',_0x3f79d1[_0x6eec('0x17')])[_0x6eec('0xa')](respondWithResult(_0x402bac,null))[_0x6eec('0x18')](handleError(_0x402bac,null));};exports[_0x6eec('0x2c')]=function(_0x15918c,_0x2be999){return respondWithRpcPromise(_0x6eec('0x2d'),_0x15918c[_0x6eec('0x17')])['then'](respondWithResult(_0x2be999,null))[_0x6eec('0x18')](handleError(_0x2be999,null));};exports[_0x6eec('0x2e')]=function(_0x4d30c9,_0x5b3283){var _0x160fc0;return respondWithRpcPromise(_0x6eec('0x2f'),_0x4d30c9[_0x6eec('0x17')])[_0x6eec('0xa')](function(_0x4cb50e){_0x160fc0=_0x4cb50e;return respondWithRpcPromise('Agents',_0x4d30c9[_0x6eec('0x17')],routingClient);})['then'](function(_0x5ac8b2){return _[_0x6eec('0x1a')]({},_0x5ac8b2,_0x160fc0);})[_0x6eec('0xa')](respondWithResult(_0x5b3283,null))[_0x6eec('0x18')](handleError(_0x5b3283,null));};exports[_0x6eec('0x30')]=function(_0x25d3f3,_0x58dfe7){if(_0x25d3f3[_0x6eec('0x23')]&&_0x25d3f3[_0x6eec('0x23')]['interaction']&&_0x25d3f3[_0x6eec('0x31')]&&_0x25d3f3[_0x6eec('0x31')]['name']){for(var _0x2d39bf in _0x25d3f3[_0x6eec('0x23')]['interaction']){if(_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x32')][_0x6eec('0x33')](_0x2d39bf)){db[_0x6eec('0x34')]['findAll']({'where':{'channel':_0x2d39bf,'membername':_0x25d3f3[_0x6eec('0x31')][_0x6eec('0x11')],'type':_0x6eec('0x35'),'exitAt':null,'uniqueid':_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x32')][_0x2d39bf]&&_0x25d3f3['body']['interaction'][_0x2d39bf][_0x6eec('0x36')]?{'$notIn':_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x32')][_0x2d39bf]}:{'$ne':null}}})[_0x6eec('0xa')](function(_0x44c7b8){var _0x59d7a7=moment()[_0x6eec('0x37')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x20524a=0x0,_0x408295=_0x44c7b8[_0x6eec('0x36')];_0x20524a<_0x408295;_0x20524a+=0x1){_0x44c7b8[_0x20524a]['updateAttributes']({'exitAt':_0x59d7a7});}});for(var _0x2b83f2=0x0;_0x2b83f2<_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x32')][_0x2d39bf][_0x6eec('0x36')];_0x2b83f2+=0x1){db[_0x6eec('0x34')]['findOrCreate']({'where':{'channel':_0x2d39bf,'membername':_0x25d3f3[_0x6eec('0x31')]['name'],'type':'INTERACTION','uniqueid':_0x25d3f3[_0x6eec('0x23')]['interaction'][_0x2d39bf][_0x2b83f2],'exitAt':null},'defaults':{'channel':_0x2d39bf,'membername':_0x25d3f3[_0x6eec('0x31')][_0x6eec('0x11')],'interface':_[_0x6eec('0x13')](_0x25d3f3['user']['interface'])?util[_0x6eec('0x37')](_0x6eec('0x38'),_0x25d3f3[_0x6eec('0x31')][_0x6eec('0x11')]):_0x25d3f3[_0x6eec('0x31')][_0x6eec('0x39')],'type':_0x6eec('0x35'),'enterAt':moment()[_0x6eec('0x37')](_0x6eec('0x3a')),'role':_0x6eec('0x3b'),'internal':_0x25d3f3['user']['internal'],'uniqueid':_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x32')][_0x2d39bf][_0x2b83f2]}});}}}}return respondWithRpcPromise(_0x6eec('0x3c'),{'id':_0x25d3f3['params']['id'],'capacity':_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x3d')]},routingClient)[_0x6eec('0xa')](respondWithResult(_0x58dfe7,null))[_0x6eec('0x18')](handleError(_0x58dfe7,null));};exports[_0x6eec('0x3e')]=function(_0x43f77a,_0x10c10a){return respondWithRpcPromise(_0x6eec('0x3f'),_0x43f77a['query'])[_0x6eec('0xa')](respondWithResult(_0x10c10a,null))[_0x6eec('0x18')](handleError(_0x10c10a,null));};exports[_0x6eec('0x40')]=function(_0x3e77f3,_0x490d27){return respondWithRpcPromise('Trunks',_0x3e77f3['query'])[_0x6eec('0xa')](respondWithResult(_0x490d27,null))[_0x6eec('0x18')](handleError(_0x490d27,null));};exports[_0x6eec('0x41')]=function(_0x1de626,_0x5178f5){return respondWithRpcPromise('Campaigns',_0x1de626[_0x6eec('0x17')])[_0x6eec('0xa')](respondWithResult(_0x5178f5,null))[_0x6eec('0x18')](handleError(_0x5178f5,null));};exports['chatQueues']=function(_0x238605,_0x35f411){return respondWithRpcPromise(_0x6eec('0x42'),_0x238605[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x35f411,null))[_0x6eec('0x18')](handleError(_0x35f411,null));};exports[_0x6eec('0x43')]=function(_0x19fe55,_0x45fed3){return respondWithRpcPromise('ChatQueues',_0x19fe55[_0x6eec('0x17')],routingClient)['then'](findById(_0x19fe55[_0x6eec('0x1b')]['id']))[_0x6eec('0xa')](respondWithResult(_0x45fed3,null))[_0x6eec('0x18')](handleError(_0x45fed3,null));};exports[_0x6eec('0x44')]=function(_0x248d76,_0x360176){return respondWithRpcPromise(_0x6eec('0x45'),_0x248d76['query'],routingClient)[_0x6eec('0xa')](respondWithResult(_0x360176,null))['catch'](handleError(_0x360176,null));};exports[_0x6eec('0x46')]=function(_0x5c905f,_0x237324){return respondWithRpcPromise(_0x6eec('0x45'),_0x5c905f[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](findById(_0x5c905f[_0x6eec('0x1b')]['id']))[_0x6eec('0xa')](respondWithResult(_0x237324,null))[_0x6eec('0x18')](handleError(_0x237324,null));};exports[_0x6eec('0x47')]=function(_0x130002,_0x4114d1){return respondWithRpcPromise('MailAccounts',_0x130002['query'],mailClient)[_0x6eec('0xa')](respondWithResult(_0x4114d1,null))[_0x6eec('0x18')](handleError(_0x4114d1,null));};exports[_0x6eec('0x48')]=function(_0x2c0644,_0x20b040){return respondWithRpcPromise('OpenchannelQueues',_0x2c0644[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x20b040,null))['catch'](handleError(_0x20b040,null));};exports['showOpenchannelQueues']=function(_0x5dc8b3,_0xaa2a15){return respondWithRpcPromise(_0x6eec('0x49'),_0x5dc8b3['query'],routingClient)[_0x6eec('0xa')](findById(_0x5dc8b3[_0x6eec('0x1b')]['id']))['then'](respondWithResult(_0xaa2a15,null))[_0x6eec('0x18')](handleError(_0xaa2a15,null));};exports[_0x6eec('0x4a')]=function(_0xc852b3,_0x3c1f77){return respondWithRpcPromise('SmsQueues',_0xc852b3['query'],routingClient)[_0x6eec('0xa')](respondWithResult(_0x3c1f77,null))[_0x6eec('0x18')](handleError(_0x3c1f77,null));};exports[_0x6eec('0x4b')]=function(_0x19ca46,_0x34c4b4){return respondWithRpcPromise(_0x6eec('0x4c'),_0x19ca46[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](findById(_0x19ca46[_0x6eec('0x1b')]['id']))[_0x6eec('0xa')](respondWithResult(_0x34c4b4,null))[_0x6eec('0x18')](handleError(_0x34c4b4,null));};exports[_0x6eec('0x4d')]=function(_0x2799ca,_0x386a67){return respondWithRpcPromise(_0x6eec('0x4e'),_0x2799ca[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x386a67,null))['catch'](handleError(_0x386a67,null));};exports[_0x6eec('0x4f')]=function(_0x2236f7,_0x48bb52){return respondWithRpcPromise(_0x6eec('0x4e'),_0x2236f7[_0x6eec('0x17')],routingClient)['then'](findById(_0x2236f7[_0x6eec('0x1b')]['id']))[_0x6eec('0xa')](respondWithResult(_0x48bb52,null))[_0x6eec('0x18')](handleError(_0x48bb52,null));};exports[_0x6eec('0x50')]=function(_0x4c73f2,_0x40a81a){return respondWithRpcPromise(_0x6eec('0x51'),_0x4c73f2[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x40a81a,null))[_0x6eec('0x18')](handleError(_0x40a81a,null));};exports[_0x6eec('0x52')]=function(_0x5ae0a0,_0x1ed47e){return respondWithRpcPromise('FaxQueues',_0x5ae0a0[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](findById(_0x5ae0a0[_0x6eec('0x1b')]['id']))[_0x6eec('0xa')](respondWithResult(_0x1ed47e,null))[_0x6eec('0x18')](handleError(_0x1ed47e,null));};exports[_0x6eec('0x53')]=function(_0x404b64,_0x2ea7fe){return respondWithRpcPromise(_0x6eec('0x54'),_0x404b64['query'])[_0x6eec('0xa')](respondWithResult(_0x2ea7fe,null))[_0x6eec('0x18')](handleError(_0x2ea7fe,null));};exports[_0x6eec('0x55')]=function(_0x4eef6e,_0x19f8e2){return respondWithRpcPromise(_0x6eec('0x56'),_0x4eef6e['query'],routingClient)[_0x6eec('0xa')](respondWithResult(_0x19f8e2,null))[_0x6eec('0x18')](handleError(_0x19f8e2,null));};exports[_0x6eec('0x57')]=function(_0x18e62b,_0x266689){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x18e62b[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x266689,null))[_0x6eec('0x18')](handleError(_0x266689,null));};exports[_0x6eec('0x58')]=function(_0x3894dc,_0x56483b){return respondWithRpcPromise(_0x6eec('0x59'),_0x3894dc[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x56483b,null))[_0x6eec('0x18')](handleError(_0x56483b,null));};exports[_0x6eec('0x5a')]=function(_0x232b3a,_0x7dd5d1){return respondWithRpcPromise(_0x6eec('0x59'),_0x232b3a['query'],routingClient)[_0x6eec('0xa')](function(_0x59341a){if(_0x232b3a[_0x6eec('0x17')][_0x6eec('0x5b')]!==undefined){var _0x7a7288=_(_0x59341a[_0x6eec('0x15')])['filter']([_0x232b3a[_0x6eec('0x17')]['type'],_0x232b3a[_0x6eec('0x1b')]['id']])[_0x6eec('0x5c')](_0x6eec('0x5d'))[_0x6eec('0x5e')]()['value']();return _0x59341a['rows']['filter'](function(_0x1158b1){return _0x7a7288[_0x6eec('0x5f')](_0x1158b1[_0x6eec('0x5d')])>-0x1;});}else{return _0x59341a[_0x6eec('0x15')]['filter'](function(_0x44302a){return _0x44302a['queue_id']===parseInt(_0x232b3a[_0x6eec('0x1b')]['id']);});}})[_0x6eec('0xa')](respondWithResult(_0x7dd5d1,null))['catch'](handleError(_0x7dd5d1,null));};exports[_0x6eec('0x60')]=function(_0x2f9e8a,_0x333280){return respondWithRpcPromise(_0x6eec('0x61'),_0x2f9e8a[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x333280,null))['catch'](handleError(_0x333280,null));};exports[_0x6eec('0x62')]=function(_0x5aa2f3,_0x64c2ef){return respondWithRpcPromise(_0x6eec('0x63'),_0x5aa2f3['query'],routingClient)[_0x6eec('0xa')](respondWithResult(_0x64c2ef,null))['catch'](handleError(_0x64c2ef,null));};exports[_0x6eec('0x64')]=function(_0x1d1683,_0x8a4166){return respondWithRpcPromise(_0x6eec('0x65'),_0x1d1683['query'],routingClient)[_0x6eec('0xa')](respondWithResult(_0x8a4166,null))['catch'](handleError(_0x8a4166,null));};exports[_0x6eec('0x66')]=function(_0x2c0a85){return function(_0x51560c,_0x3dcf9d){var _0x435562,_0x3a90cd;var _0x328f28=_[_0x6eec('0x67')](_0x2c0a85);var _0x514e15=_0x2c0a85===_0x6eec('0x68')?_0x6eec('0x69'):_0x6eec('0x6a');return db[_0x328f28+_0x6eec('0x6b')][_0x6eec('0x6c')]({'raw':!![],'where':{'id':_0x51560c[_0x6eec('0x1b')]['id']}})['then'](function(_0x4a3af3){if(_[_0x6eec('0x13')](_0x4a3af3)){throw new Error(_0x328f28+_0x6eec('0x6d'));}_0x435562=_0x4a3af3;return db[_0x328f28+'Message']['findOne']({'where':{'id':_0x51560c[_0x6eec('0x23')][_0x6eec('0x6e')]},'include':[{'model':db[_0x328f28+'Interaction'],'as':_0x6eec('0x6f')},{'model':db[_0x328f28+_0x514e15],'as':_0x6eec('0x6a')}]});})[_0x6eec('0xa')](function(_0x5042a0){if(_[_0x6eec('0x13')](_0x5042a0)){throw new Error(_0x328f28+'\x20Message\x20not\x20found');}_0x3a90cd=_0x5042a0;return _0x5042a0[_0x6eec('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6eec('0xa')](function(){var _0x585432={'uniqueid':_0x2c0a85+'.'+_0x3a90cd['id']+'.'+_0x3a90cd[_0x6eec('0x6f')]['id'],'FromUserId':_0x51560c[_0x6eec('0x31')]['id'],'type':_0x6eec('0x71')};_0x585432[_0x328f28+'MessageId']=_0x3a90cd['id'];_0x585432[_0x328f28+_0x6eec('0x72')]=_0x3a90cd[_0x6eec('0x6f')]['id'];_0x585432[_0x6eec('0x73')+_0x328f28+_0x514e15+'Id']=_0x3a90cd[_0x6eec('0x6a')]['id'];_0x585432['To'+_0x328f28+_0x6eec('0x74')]=_0x435562['id'];return db[_0x328f28+_0x6eec('0x75')]['create'](_0x585432);})[_0x6eec('0xa')](function(){return respondWithRpcPromise(_0x6eec('0x76'),{'channel':_0x2c0a85,'interaction':_0x3a90cd[_0x6eec('0x6f')],'message':_0x3a90cd,'account':_0x3a90cd[_0x6eec('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6eec('0x71'),'appdata':_0x435562[_0x6eec('0x11')]+','+(_0x3a90cd[_0x6eec('0x6a')][_0x6eec('0x77')]||0x12c),'interval':_0x6eec('0x78')}]},routingClient);})[_0x6eec('0xa')](respondWithResult(_0x3dcf9d,null))[_0x6eec('0x18')](handleError(_0x3dcf9d,null));};};exports[_0x6eec('0x79')]=function(_0x56043a,_0x1419e0){var _0x1d6604,_0x10fad1;if(_[_0x6eec('0x13')](_0x56043a[_0x6eec('0x23')][_0x6eec('0x7a')])){throw new Error(_0x6eec('0x7b'));}var _0xa94ada=_0x56043a[_0x6eec('0x23')][_0x6eec('0x7a')];var _0xaddba4=_[_0x6eec('0x67')](_0xa94ada);var _0x89aace=_0xa94ada===_0x6eec('0x68')?_0x6eec('0x69'):'Account';return db[_0x6eec('0x7c')]['findOne']({'raw':!![],'where':{'id':_0x56043a[_0x6eec('0x1b')]['id'],'role':_0x6eec('0x3b')}})[_0x6eec('0xa')](function(_0x2607ca){if(_['isNil'](_0x2607ca)){throw new Error(_0x6eec('0x7d'));}_0x1d6604=_0x2607ca;return db[_0xaddba4+'Message'][_0x6eec('0x6c')]({'where':{'id':_0x56043a[_0x6eec('0x23')][_0x6eec('0x6e')]},'include':[{'model':db[_0xaddba4+_0x6eec('0x6f')],'as':_0x6eec('0x6f')},{'model':db[_0xaddba4+_0x89aace],'as':_0x6eec('0x6a')}]});})['then'](function(_0x2888f4){if(_[_0x6eec('0x13')](_0x2888f4)){throw new Error(_0xaddba4+_0x6eec('0x7e'));}_0x10fad1=_0x2888f4;return _0x2888f4[_0x6eec('0x70')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5229db={'uniqueid':_0xa94ada+'.'+_0x10fad1['id']+'.'+_0x10fad1[_0x6eec('0x6f')]['id'],'FromUserId':_0x56043a[_0x6eec('0x31')]['id'],'type':'queue','ToUserId':_0x1d6604['id']};_0x5229db[_0xaddba4+'MessageId']=_0x10fad1['id'];_0x5229db[_0xaddba4+_0x6eec('0x72')]=_0x10fad1[_0x6eec('0x6f')]['id'];_0x5229db['From'+_0xaddba4+_0x89aace+'Id']=_0x10fad1[_0x6eec('0x6a')]['id'];return db[_0xaddba4+_0x6eec('0x75')]['create'](_0x5229db);})[_0x6eec('0xa')](function(){return respondWithRpcPromise(_0x6eec('0x76'),{'channel':_0xa94ada,'interaction':_0x10fad1[_0x6eec('0x6f')],'message':_0x10fad1,'account':_0x10fad1['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x1d6604['name']+','+(_0x10fad1[_0x6eec('0x6a')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x6eec('0xa')](respondWithResult(_0x1419e0,null))['catch'](handleError(_0x1419e0,null));}; \ No newline at end of file +var _0xb138=['telephones','Telephones','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','create','Start','queueTransferTimeout','*,*,*,*','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','agent','Agent\x20not\x20found','Message','\x20Message\x20not\x20found','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','error','code','message','result','catch','json','sendStatus','stack','name','status','isNil','rows','find','VoiceChannels','query','then','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','OutboundChannels','Agents','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','INTERACTION','SIP/%s','interface','internal','AgentCapacity','capacity'];(function(_0x45cd35,_0x41147c){var _0x16db84=function(_0x1ce5e9){while(--_0x1ce5e9){_0x45cd35['push'](_0x45cd35['shift']());}};_0x16db84(++_0x41147c);}(_0xb138,0x1dd));var _0x8b13=function(_0xa681dc,_0x3100aa){_0xa681dc=_0xa681dc-0x0;var _0x422441=_0xb138[_0xa681dc];return _0x422441;};'use strict';var BPromise=require(_0x8b13('0x0'));var moment=require(_0x8b13('0x1'));var _=require(_0x8b13('0x2'));var util=require(_0x8b13('0x3'));var db=require(_0x8b13('0x4'))['db'];var logger=require(_0x8b13('0x5'))(_0x8b13('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x8b13('0x7')][_0x8b13('0x8')]({'port':0x232a});var mailClient=jayson[_0x8b13('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0x8b13('0x7')][_0x8b13('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x5d51b1,_0x3fdf4d,_0x33d1a7){return new BPromise(function(_0x22e157,_0x498832){var _0x8570b0=_0x33d1a7?_0x33d1a7:amiClient;return _0x8570b0[_0x8b13('0x9')](_0x5d51b1,_0x3fdf4d)['then'](function(_0x53ae50){if(_0x53ae50[_0x8b13('0xa')]){if(_0x53ae50[_0x8b13('0xa')][_0x8b13('0xb')]===0x1f4){return _0x498832(_0x53ae50[_0x8b13('0xa')][_0x8b13('0xc')]);}return _0x22e157(_0x53ae50['error'][_0x8b13('0xc')]);}else{_0x22e157(_0x53ae50[_0x8b13('0xd')]);}})[_0x8b13('0xe')](function(_0x3f79d5){_0x498832(_0x3f79d5);});});}function respondWithResult(_0xb227e0,_0x1893b1){_0x1893b1=_0x1893b1||0xc8;return function(_0x58f97e){if(_0x58f97e){return _0xb227e0['status'](_0x1893b1)[_0x8b13('0xf')](_0x58f97e);}return _0xb227e0[_0x8b13('0x10')](0x194);};}function handleError(_0x5f12b5,_0x51a935){_0x51a935=_0x51a935||0x1f4;return function(_0x479773){logger[_0x8b13('0xa')](_0x479773[_0x8b13('0x11')]);if(_0x479773[_0x8b13('0x12')]){delete _0x479773[_0x8b13('0x12')];}_0x5f12b5[_0x8b13('0x13')](_0x51a935)['send'](_0x479773);};}function findById(_0x1c6c99){return function(_0xea7881){if(!_[_0x8b13('0x14')](_0x1c6c99)&&!_[_0x8b13('0x14')](_0xea7881)&&!_[_0x8b13('0x14')](_0xea7881[_0x8b13('0x15')])){return _[_0x8b13('0x16')](_0xea7881[_0x8b13('0x15')],function(_0x4989d3){return _0x4989d3['id']==_0x1c6c99;});}return null;};}exports['voiceChannels']=function(_0xae4966,_0x335709){return respondWithRpcPromise(_0x8b13('0x17'),_0xae4966[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0x335709,null))[_0x8b13('0xe')](handleError(_0x335709,null));};exports['voiceChannelMixMonitor']=function(_0x1e8a48,_0x3c4d4f){return respondWithRpcPromise(_0x8b13('0x1a'),_['merge'](_0x1e8a48['query'],_0x1e8a48[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x3c4d4f,null))['catch'](handleError(_0x3c4d4f,null));};exports[_0x8b13('0x1c')]=function(_0x2c3afb,_0x37ca5f){return respondWithRpcPromise(_0x8b13('0x1d'),_[_0x8b13('0x1e')](_0x2c3afb['query'],_0x2c3afb[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x37ca5f,null))['catch'](handleError(_0x37ca5f,null));};exports[_0x8b13('0x1f')]=function(_0x4fdd1c,_0x420772){return respondWithRpcPromise(_0x8b13('0x20'),_0x4fdd1c['query'])[_0x8b13('0x19')](respondWithResult(_0x420772,null))[_0x8b13('0xe')](handleError(_0x420772,null));};exports['showVoiceQueues']=function(_0x134c5e,_0x14a739){return respondWithRpcPromise(_0x8b13('0x20'),_0x134c5e[_0x8b13('0x18')])[_0x8b13('0x19')](findById(_0x134c5e['params']['id']))[_0x8b13('0x19')](respondWithResult(_0x14a739,null))[_0x8b13('0xe')](handleError(_0x14a739,null));};exports[_0x8b13('0x21')]=function(_0x1511bf,_0x114b01){return respondWithRpcPromise(_0x8b13('0x22'),_['merge'](_0x1511bf[_0x8b13('0x23')],_0x1511bf[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x114b01,null))[_0x8b13('0xe')](handleError(_0x114b01,null));};exports[_0x8b13('0x24')]=function(_0x29946e,_0x3304bd){return respondWithRpcPromise(_0x8b13('0x25'),_[_0x8b13('0x1e')](_0x29946e['query'],_0x29946e[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x3304bd,null))[_0x8b13('0xe')](handleError(_0x3304bd,null));};exports[_0x8b13('0x26')]=function(_0x51a334,_0x4f7d91){return respondWithRpcPromise(_0x8b13('0x27'),_0x51a334['query'])['then'](respondWithResult(_0x4f7d91,null))[_0x8b13('0xe')](handleError(_0x4f7d91,null));};exports['voiceQueuesChannel']=function(_0x2ec1ab,_0x408626){return respondWithRpcPromise(_0x8b13('0x28'),_[_0x8b13('0x1e')](_0x2ec1ab[_0x8b13('0x18')],_0x2ec1ab[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x408626,null))[_0x8b13('0xe')](handleError(_0x408626,null));};exports[_0x8b13('0x29')]=function(_0x1b313d,_0x4d45bc){return respondWithRpcPromise(_0x8b13('0x2a'),_[_0x8b13('0x1e')](_0x1b313d[_0x8b13('0x18')],_0x1b313d[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x4d45bc,null))[_0x8b13('0xe')](handleError(_0x4d45bc,null));};exports[_0x8b13('0x2b')]=function(_0x241687,_0x5c67b1){return respondWithRpcPromise(_0x8b13('0x2c'),_['merge'](_0x241687[_0x8b13('0x18')],_0x241687[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x5c67b1,null))[_0x8b13('0xe')](handleError(_0x5c67b1,null));};exports[_0x8b13('0x2d')]=function(_0x327eb1,_0x4ec1a5){return respondWithRpcPromise('Outbound',_0x327eb1[_0x8b13('0x18')])['then'](respondWithResult(_0x4ec1a5,null))[_0x8b13('0xe')](handleError(_0x4ec1a5,null));};exports['outboundChannels']=function(_0x590a23,_0x3a8e06){return respondWithRpcPromise(_0x8b13('0x2e'),_0x590a23[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0x3a8e06,null))['catch'](handleError(_0x3a8e06,null));};exports['agents']=function(_0x230a8c,_0x595d8d){var _0x6ba2f3;return respondWithRpcPromise(_0x8b13('0x2f'),_0x230a8c['query'])[_0x8b13('0x19')](function(_0x41d710){_0x6ba2f3=_0x41d710;return respondWithRpcPromise(_0x8b13('0x2f'),_0x230a8c[_0x8b13('0x18')],routingClient);})[_0x8b13('0x19')](function(_0x38ec75){return _[_0x8b13('0x1e')]({},_0x38ec75,_0x6ba2f3);})['then'](respondWithResult(_0x595d8d,null))['catch'](handleError(_0x595d8d,null));};exports['agentCapacity']=function(_0x3eb3c5,_0x16ec3){if(_0x3eb3c5[_0x8b13('0x23')]&&_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x30')]&&_0x3eb3c5[_0x8b13('0x31')]&&_0x3eb3c5['user'][_0x8b13('0x12')]){for(var _0x50e535 in _0x3eb3c5[_0x8b13('0x23')]['interaction']){if(_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x30')][_0x8b13('0x32')](_0x50e535)){db[_0x8b13('0x33')][_0x8b13('0x34')]({'where':{'channel':_0x50e535,'membername':_0x3eb3c5[_0x8b13('0x31')][_0x8b13('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3eb3c5['body']['interaction'][_0x50e535]&&_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x30')][_0x50e535][_0x8b13('0x35')]?{'$notIn':_0x3eb3c5[_0x8b13('0x23')]['interaction'][_0x50e535]}:{'$ne':null}}})['then'](function(_0x3f420d){var _0x54d19d=moment()[_0x8b13('0x36')](_0x8b13('0x37'));for(var _0x20c363=0x0,_0x28ae75=_0x3f420d[_0x8b13('0x35')];_0x20c363<_0x28ae75;_0x20c363+=0x1){_0x3f420d[_0x20c363]['updateAttributes']({'exitAt':_0x54d19d});}});for(var _0x2df766=0x0;_0x2df766<_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x30')][_0x50e535][_0x8b13('0x35')];_0x2df766+=0x1){db[_0x8b13('0x33')][_0x8b13('0x38')]({'where':{'channel':_0x50e535,'membername':_0x3eb3c5[_0x8b13('0x31')][_0x8b13('0x12')],'type':_0x8b13('0x39'),'uniqueid':_0x3eb3c5['body'][_0x8b13('0x30')][_0x50e535][_0x2df766],'exitAt':null},'defaults':{'channel':_0x50e535,'membername':_0x3eb3c5['user'][_0x8b13('0x12')],'interface':_[_0x8b13('0x14')](_0x3eb3c5[_0x8b13('0x31')]['interface'])?util[_0x8b13('0x36')](_0x8b13('0x3a'),_0x3eb3c5[_0x8b13('0x31')][_0x8b13('0x12')]):_0x3eb3c5[_0x8b13('0x31')][_0x8b13('0x3b')],'type':_0x8b13('0x39'),'enterAt':moment()['format'](_0x8b13('0x37')),'role':'agent','internal':_0x3eb3c5[_0x8b13('0x31')][_0x8b13('0x3c')],'uniqueid':_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x30')][_0x50e535][_0x2df766]}});}}}}return respondWithRpcPromise(_0x8b13('0x3d'),{'id':_0x3eb3c5[_0x8b13('0x1b')]['id'],'capacity':_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x3e')]},routingClient)[_0x8b13('0x19')](respondWithResult(_0x16ec3,null))[_0x8b13('0xe')](handleError(_0x16ec3,null));};exports[_0x8b13('0x3f')]=function(_0xddac8e,_0xd55f3b){return respondWithRpcPromise(_0x8b13('0x40'),_0xddac8e[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0xd55f3b,null))[_0x8b13('0xe')](handleError(_0xd55f3b,null));};exports['trunks']=function(_0x1699c6,_0x20e89c){return respondWithRpcPromise('Trunks',_0x1699c6[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0x20e89c,null))[_0x8b13('0xe')](handleError(_0x20e89c,null));};exports[_0x8b13('0x41')]=function(_0x25cb45,_0x12549b){return respondWithRpcPromise(_0x8b13('0x42'),_0x25cb45[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0x12549b,null))[_0x8b13('0xe')](handleError(_0x12549b,null));};exports[_0x8b13('0x43')]=function(_0x450b47,_0x137e8c){return respondWithRpcPromise(_0x8b13('0x44'),_0x450b47[_0x8b13('0x18')],routingClient)['then'](respondWithResult(_0x137e8c,null))[_0x8b13('0xe')](handleError(_0x137e8c,null));};exports[_0x8b13('0x45')]=function(_0x47a3fa,_0x11e8af){return respondWithRpcPromise(_0x8b13('0x44'),_0x47a3fa[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](findById(_0x47a3fa[_0x8b13('0x1b')]['id']))['then'](respondWithResult(_0x11e8af,null))[_0x8b13('0xe')](handleError(_0x11e8af,null));};exports[_0x8b13('0x46')]=function(_0x46850a,_0x52e2a6){return respondWithRpcPromise(_0x8b13('0x47'),_0x46850a[_0x8b13('0x18')],routingClient)['then'](respondWithResult(_0x52e2a6,null))[_0x8b13('0xe')](handleError(_0x52e2a6,null));};exports[_0x8b13('0x48')]=function(_0x475c8d,_0xd29067){return respondWithRpcPromise('MailQueues',_0x475c8d[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](findById(_0x475c8d['params']['id']))[_0x8b13('0x19')](respondWithResult(_0xd29067,null))[_0x8b13('0xe')](handleError(_0xd29067,null));};exports[_0x8b13('0x49')]=function(_0x23a63c,_0x5d05cb){return respondWithRpcPromise(_0x8b13('0x4a'),_0x23a63c[_0x8b13('0x18')],mailClient)[_0x8b13('0x19')](respondWithResult(_0x5d05cb,null))[_0x8b13('0xe')](handleError(_0x5d05cb,null));};exports[_0x8b13('0x4b')]=function(_0x2fff4e,_0x571e89){return respondWithRpcPromise(_0x8b13('0x4c'),_0x2fff4e[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x571e89,null))['catch'](handleError(_0x571e89,null));};exports[_0x8b13('0x4d')]=function(_0x576c91,_0x122ea2){return respondWithRpcPromise(_0x8b13('0x4c'),_0x576c91['query'],routingClient)['then'](findById(_0x576c91['params']['id']))['then'](respondWithResult(_0x122ea2,null))['catch'](handleError(_0x122ea2,null));};exports[_0x8b13('0x4e')]=function(_0x1bc936,_0x574f98){return respondWithRpcPromise(_0x8b13('0x4f'),_0x1bc936['query'],routingClient)[_0x8b13('0x19')](respondWithResult(_0x574f98,null))[_0x8b13('0xe')](handleError(_0x574f98,null));};exports[_0x8b13('0x50')]=function(_0x22c4d4,_0x43f12a){return respondWithRpcPromise(_0x8b13('0x4f'),_0x22c4d4[_0x8b13('0x18')],routingClient)['then'](findById(_0x22c4d4[_0x8b13('0x1b')]['id']))['then'](respondWithResult(_0x43f12a,null))[_0x8b13('0xe')](handleError(_0x43f12a,null));};exports[_0x8b13('0x51')]=function(_0x207a54,_0x11a4ba){return respondWithRpcPromise(_0x8b13('0x52'),_0x207a54[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x11a4ba,null))['catch'](handleError(_0x11a4ba,null));};exports[_0x8b13('0x53')]=function(_0x5d1174,_0x2b109c){return respondWithRpcPromise(_0x8b13('0x52'),_0x5d1174[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](findById(_0x5d1174[_0x8b13('0x1b')]['id']))['then'](respondWithResult(_0x2b109c,null))['catch'](handleError(_0x2b109c,null));};exports[_0x8b13('0x54')]=function(_0x37a243,_0x5ccf4e){return respondWithRpcPromise(_0x8b13('0x55'),_0x37a243[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x5ccf4e,null))['catch'](handleError(_0x5ccf4e,null));};exports[_0x8b13('0x56')]=function(_0x215a8a,_0x15ce51){return respondWithRpcPromise(_0x8b13('0x55'),_0x215a8a['query'],routingClient)[_0x8b13('0x19')](findById(_0x215a8a[_0x8b13('0x1b')]['id']))['then'](respondWithResult(_0x15ce51,null))[_0x8b13('0xe')](handleError(_0x15ce51,null));};exports[_0x8b13('0x57')]=function(_0x69e237,_0x3734e7){return respondWithRpcPromise(_0x8b13('0x58'),_0x69e237[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0x3734e7,null))[_0x8b13('0xe')](handleError(_0x3734e7,null));};exports[_0x8b13('0x59')]=function(_0x2cace0,_0x2f2bc5){return respondWithRpcPromise(_0x8b13('0x5a'),_0x2cace0[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x2f2bc5,null))['catch'](handleError(_0x2f2bc5,null));};exports[_0x8b13('0x5b')]=function(_0x578469,_0x14dee4){return respondWithRpcPromise(_0x8b13('0x5c'),_0x578469[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x14dee4,null))['catch'](handleError(_0x14dee4,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x27ad64,_0x2236b5){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x27ad64[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x2236b5,null))[_0x8b13('0xe')](handleError(_0x2236b5,null));};exports[_0x8b13('0x5d')]=function(_0x7499cb,_0x12aa48){return respondWithRpcPromise(_0x8b13('0x5e'),_0x7499cb[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](function(_0x24211c){if(_0x7499cb['query'][_0x8b13('0x5f')]!==undefined){var _0x2e7477=_(_0x24211c['rows'])[_0x8b13('0x60')]([_0x7499cb[_0x8b13('0x18')]['type'],_0x7499cb[_0x8b13('0x1b')]['id']])[_0x8b13('0x61')](_0x8b13('0x62'))[_0x8b13('0x63')]()[_0x8b13('0x64')]();return _0x24211c[_0x8b13('0x15')][_0x8b13('0x60')](function(_0x1fde8b){return _0x2e7477['indexOf'](_0x1fde8b[_0x8b13('0x62')])>-0x1;});}else{return _0x24211c[_0x8b13('0x15')][_0x8b13('0x60')](function(_0x5e2b4c){return _0x5e2b4c[_0x8b13('0x62')]===parseInt(_0x7499cb['params']['id']);});}})[_0x8b13('0x19')](respondWithResult(_0x12aa48,null))[_0x8b13('0xe')](handleError(_0x12aa48,null));};exports[_0x8b13('0x65')]=function(_0x40fefa,_0xc74525){return respondWithRpcPromise(_0x8b13('0x66'),_0x40fefa[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0xc74525,null))[_0x8b13('0xe')](handleError(_0xc74525,null));};exports[_0x8b13('0x67')]=function(_0x595f45,_0x3dc732){return respondWithRpcPromise(_0x8b13('0x68'),_0x595f45[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x3dc732,null))[_0x8b13('0xe')](handleError(_0x3dc732,null));};exports[_0x8b13('0x69')]=function(_0x2c69f5,_0x9173d){return respondWithRpcPromise(_0x8b13('0x6a'),_0x2c69f5[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x9173d,null))[_0x8b13('0xe')](handleError(_0x9173d,null));};exports[_0x8b13('0x6b')]=function(_0x4bb71a){return function(_0x491bf8,_0x3870a9){var _0x512f30,_0x22e10a;var _0x38a1de=_['capitalize'](_0x4bb71a);var _0x5319a1=_0x4bb71a===_0x8b13('0x6c')?_0x8b13('0x6d'):_0x8b13('0x6e');return db[_0x38a1de+_0x8b13('0x6f')][_0x8b13('0x70')]({'raw':!![],'where':{'id':_0x491bf8['params']['id']}})[_0x8b13('0x19')](function(_0x5152d0){if(_[_0x8b13('0x14')](_0x5152d0)){throw new Error(_0x38a1de+_0x8b13('0x71'));}_0x512f30=_0x5152d0;return db[_0x38a1de+'Message'][_0x8b13('0x70')]({'where':{'id':_0x491bf8[_0x8b13('0x23')][_0x8b13('0x72')]},'include':[{'model':db[_0x38a1de+_0x8b13('0x73')],'as':_0x8b13('0x73')},{'model':db[_0x38a1de+_0x5319a1],'as':'Account'}]});})[_0x8b13('0x19')](function(_0x202c12){if(_[_0x8b13('0x14')](_0x202c12)){throw new Error(_0x38a1de+'\x20Message\x20not\x20found');}_0x22e10a=_0x202c12;return _0x202c12[_0x8b13('0x74')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3bfb06={'uniqueid':_0x4bb71a+'.'+_0x22e10a['id']+'.'+_0x22e10a[_0x8b13('0x73')]['id'],'FromUserId':_0x491bf8[_0x8b13('0x31')]['id'],'type':_0x8b13('0x75')};_0x3bfb06[_0x38a1de+_0x8b13('0x76')]=_0x22e10a['id'];_0x3bfb06[_0x38a1de+_0x8b13('0x77')]=_0x22e10a[_0x8b13('0x73')]['id'];_0x3bfb06[_0x8b13('0x78')+_0x38a1de+_0x5319a1+'Id']=_0x22e10a[_0x8b13('0x6e')]['id'];_0x3bfb06['To'+_0x38a1de+_0x8b13('0x79')]=_0x512f30['id'];return db[_0x38a1de+'TransferReport'][_0x8b13('0x7a')](_0x3bfb06);})[_0x8b13('0x19')](function(){return respondWithRpcPromise(_0x8b13('0x7b'),{'channel':_0x4bb71a,'interaction':_0x22e10a[_0x8b13('0x73')],'message':_0x22e10a,'account':_0x22e10a[_0x8b13('0x6e')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x512f30[_0x8b13('0x12')]+','+(_0x22e10a[_0x8b13('0x6e')][_0x8b13('0x7c')]||0x12c),'interval':_0x8b13('0x7d')}]},routingClient);})[_0x8b13('0x19')](respondWithResult(_0x3870a9,null))[_0x8b13('0xe')](handleError(_0x3870a9,null));};};exports['agentNotify']=function(_0x24005e,_0xd2b08b){var _0x556a92,_0x1b3a1b;if(_['isNil'](_0x24005e[_0x8b13('0x23')]['channel'])){throw new Error(_0x8b13('0x7e'));}var _0x291a30=_0x24005e[_0x8b13('0x23')][_0x8b13('0x7f')];var _0x13a7ea=_[_0x8b13('0x80')](_0x291a30);var _0x165813=_0x291a30===_0x8b13('0x6c')?'Website':_0x8b13('0x6e');return db[_0x8b13('0x81')]['findOne']({'raw':!![],'where':{'id':_0x24005e[_0x8b13('0x1b')]['id'],'role':_0x8b13('0x82')}})['then'](function(_0xa97f27){if(_[_0x8b13('0x14')](_0xa97f27)){throw new Error(_0x8b13('0x83'));}_0x556a92=_0xa97f27;return db[_0x13a7ea+_0x8b13('0x84')][_0x8b13('0x70')]({'where':{'id':_0x24005e['body']['messageId']},'include':[{'model':db[_0x13a7ea+_0x8b13('0x73')],'as':_0x8b13('0x73')},{'model':db[_0x13a7ea+_0x165813],'as':_0x8b13('0x6e')}]});})[_0x8b13('0x19')](function(_0xcafeff){if(_[_0x8b13('0x14')](_0xcafeff)){throw new Error(_0x13a7ea+_0x8b13('0x85'));}_0x1b3a1b=_0xcafeff;return _0xcafeff[_0x8b13('0x74')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8b13('0x19')](function(){var _0xfac180={'uniqueid':_0x291a30+'.'+_0x1b3a1b['id']+'.'+_0x1b3a1b[_0x8b13('0x73')]['id'],'FromUserId':_0x24005e[_0x8b13('0x31')]['id'],'type':_0x8b13('0x75'),'ToUserId':_0x556a92['id']};_0xfac180[_0x13a7ea+_0x8b13('0x76')]=_0x1b3a1b['id'];_0xfac180[_0x13a7ea+_0x8b13('0x77')]=_0x1b3a1b[_0x8b13('0x73')]['id'];_0xfac180['From'+_0x13a7ea+_0x165813+'Id']=_0x1b3a1b[_0x8b13('0x6e')]['id'];return db[_0x13a7ea+'TransferReport'][_0x8b13('0x7a')](_0xfac180);})[_0x8b13('0x19')](function(){return respondWithRpcPromise(_0x8b13('0x7b'),{'channel':_0x291a30,'interaction':_0x1b3a1b[_0x8b13('0x73')],'message':_0x1b3a1b,'account':_0x1b3a1b[_0x8b13('0x6e')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8b13('0x82'),'appdata':_0x556a92[_0x8b13('0x12')]+','+(_0x1b3a1b['Account'][_0x8b13('0x86')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x8b13('0x19')](respondWithResult(_0xd2b08b,null))[_0x8b13('0xe')](handleError(_0xd2b08b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 18c6180..14f4c41 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 _0x2980=['isAuthenticated','index','/:id','show','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x558036,_0x43e87b){var _0x2dd321=function(_0x4f2c54){while(--_0x4f2c54){_0x558036['push'](_0x558036['shift']());}};_0x2dd321(++_0x43e87b);}(_0x2980,0x148));var _0x0298=function(_0x4b5d59,_0x44858f){_0x4b5d59=_0x4b5d59-0x0;var _0x204914=_0x2980[_0x4b5d59];return _0x204914;};'use strict';var multer=require(_0x0298('0x0'));var util=require(_0x0298('0x1'));var path=require('path');var timeout=require(_0x0298('0x2'));var express=require('express');var router=express[_0x0298('0x3')]();var fs_extra=require(_0x0298('0x4'));var auth=require(_0x0298('0x5'));var interaction=require(_0x0298('0x6'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x0298('0x7')]('/',auth[_0x0298('0x8')](),controller[_0x0298('0x9')]);router[_0x0298('0x7')](_0x0298('0xa'),auth[_0x0298('0x8')](),controller[_0x0298('0xb')]);router[_0x0298('0x7')]('/:id/run',auth['isAuthenticated'](),controller['run']);router['post']('/',auth[_0x0298('0x8')](),controller['create']);router[_0x0298('0xc')]('/:id',auth[_0x0298('0x8')](),controller['update']);router[_0x0298('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x0298('0xe')]);module[_0x0298('0xf')]=router; \ No newline at end of file +var _0x1622=['../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x120581,_0x4ac036){var _0x8be10=function(_0xee2c6b){while(--_0xee2c6b){_0x120581['push'](_0x120581['shift']());}};_0x8be10(++_0x4ac036);}(_0x1622,0xac));var _0x2162=function(_0x2b3432,_0x307757){_0x2b3432=_0x2b3432-0x0;var _0x538cba=_0x1622[_0x2b3432];return _0x538cba;};'use strict';var multer=require('multer');var util=require(_0x2162('0x0'));var path=require(_0x2162('0x1'));var timeout=require(_0x2162('0x2'));var express=require(_0x2162('0x3'));var router=express[_0x2162('0x4')]();var fs_extra=require(_0x2162('0x5'));var auth=require(_0x2162('0x6'));var interaction=require(_0x2162('0x7'));var config=require(_0x2162('0x8'));var controller=require(_0x2162('0x9'));router[_0x2162('0xa')]('/',auth[_0x2162('0xb')](),controller[_0x2162('0xc')]);router[_0x2162('0xa')](_0x2162('0xd'),auth[_0x2162('0xb')](),controller[_0x2162('0xe')]);router[_0x2162('0xa')](_0x2162('0xf'),auth[_0x2162('0xb')](),controller['run']);router['post']('/',auth[_0x2162('0xb')](),controller['create']);router[_0x2162('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2162('0x11')](_0x2162('0xd'),auth['isAuthenticated'](),controller[_0x2162('0x12')]);module[_0x2162('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 0a50f47..454c51a 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 _0xf10f=['days','hours','csv','pdf','ENUM','custom','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','years','quarters','months'];(function(_0x22c118,_0x3aae97){var _0x5e3267=function(_0x45cce0){while(--_0x45cce0){_0x22c118['push'](_0x22c118['shift']());}};_0x5e3267(++_0x3aae97);}(_0xf10f,0x19b));var _0xff10=function(_0x4c2f84,_0x30efcb){_0x4c2f84=_0x4c2f84-0x0;var _0xe4e65f=_0xf10f[_0x4c2f84];return _0xe4e65f;};'use strict';var Sequelize=require(_0xff10('0x0'));module[_0xff10('0x1')]={'name':{'type':Sequelize[_0xff10('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xff10('0x2')]},'active':{'type':Sequelize[_0xff10('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xff10('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xff10('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xff10('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xff10('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xff10('0x6'),_0xff10('0x7'),_0xff10('0x8'),'weeks',_0xff10('0x9'),_0xff10('0xa'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0xff10('0xb'),_0xff10('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0xff10('0xb')},'type':{'type':Sequelize[_0xff10('0xd')](_0xff10('0xe'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xff10('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xff10('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xff10('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7798=['pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','weeks','days'];(function(_0x86f736,_0x30aa59){var _0x45bb99=function(_0x3972b7){while(--_0x3972b7){_0x86f736['push'](_0x86f736['shift']());}};_0x45bb99(++_0x30aa59);}(_0x7798,0x139));var _0x8779=function(_0x226f10,_0x50ffd7){_0x226f10=_0x226f10-0x0;var _0x2f280c=_0x7798[_0x226f10];return _0x2f280c;};'use strict';var Sequelize=require(_0x8779('0x0'));module[_0x8779('0x1')]={'name':{'type':Sequelize[_0x8779('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x8779('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x8779('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x8779('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x8779('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x8779('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x8779('0x6')]('years','quarters','months',_0x8779('0x7'),_0x8779('0x8'),'hours','minutes'),'allowNull':![],'defaultValue':_0x8779('0x8')},'output':{'type':Sequelize['ENUM']('csv',_0x8779('0x9'),_0x8779('0xa')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x8779('0x6')](_0x8779('0xb'),_0x8779('0xc')),'allowNull':![],'defaultValue':_0x8779('0xb')},'sendMail':{'type':Sequelize[_0x8779('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x8779('0x2')]},'cc':{'type':Sequelize[_0x8779('0xd')]},'bcc':{'type':Sequelize[_0x8779('0xd')]},'sendIfEmpty':{'type':Sequelize[_0x8779('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 f36d193..855f38e 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 _0x0072=['apply','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Schedule','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','end','json','offset','undefined','limit','count','set'];(function(_0x27fec2,_0x1d8bd2){var _0x38f21e=function(_0x37452b){while(--_0x37452b){_0x27fec2['push'](_0x27fec2['shift']());}};_0x38f21e(++_0x1d8bd2);}(_0x0072,0x18f));var _0x2007=function(_0x54c2f1,_0x3f7f64){_0x54c2f1=_0x54c2f1-0x0;var _0x40ae59=_0x0072[_0x54c2f1];return _0x40ae59;};'use strict';var emlformat=require(_0x2007('0x0'));var rimraf=require(_0x2007('0x1'));var zipdir=require(_0x2007('0x2'));var jsonpatch=require(_0x2007('0x3'));var rp=require(_0x2007('0x4'));var moment=require(_0x2007('0x5'));var BPromise=require(_0x2007('0x6'));var Mustache=require(_0x2007('0x7'));var util=require(_0x2007('0x8'));var path=require(_0x2007('0x9'));var sox=require(_0x2007('0xa'));var csv=require(_0x2007('0xb'));var ejs=require(_0x2007('0xc'));var fs=require('fs');var fs_extra=require(_0x2007('0xd'));var _=require('lodash');var squel=require(_0x2007('0xe'));var crypto=require('crypto');var jsforce=require(_0x2007('0xf'));var deskjs=require(_0x2007('0x10'));var toCsv=require(_0x2007('0xb'));var querystring=require(_0x2007('0x11'));var Papa=require('papaparse');var Redis=require(_0x2007('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2007('0x13'));var as=require(_0x2007('0x14'));var hardwareService=require(_0x2007('0x15'));var logger=require(_0x2007('0x16'))(_0x2007('0x17'));var utils=require(_0x2007('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2007('0x19'));var db=require(_0x2007('0x1a'))['db'];function respondWithStatusCode(_0x49bd41,_0x1be923){_0x1be923=_0x1be923||0xcc;return function(_0xccb881){if(_0xccb881){return _0x49bd41[_0x2007('0x1b')](_0x1be923);}return _0x49bd41[_0x2007('0x1c')](_0x1be923)[_0x2007('0x1d')]();};}function respondWithResult(_0x109822,_0x3dde62){_0x3dde62=_0x3dde62||0xc8;return function(_0x502cef){if(_0x502cef){return _0x109822[_0x2007('0x1c')](_0x3dde62)[_0x2007('0x1e')](_0x502cef);}};}function respondWithFilteredResult(_0x5c07ab,_0x2f9dd3){return function(_0x743dc5){if(_0x743dc5){var _0x2a2988=typeof _0x2f9dd3[_0x2007('0x1f')]===_0x2007('0x20')&&typeof _0x2f9dd3[_0x2007('0x21')]===_0x2007('0x20');var _0x8cbf3a=_0x743dc5[_0x2007('0x22')];var _0x5385ab=_0x2a2988?0x0:_0x2f9dd3[_0x2007('0x1f')];var _0x3888af=_0x2a2988?_0x743dc5[_0x2007('0x22')]:_0x2f9dd3['offset']+_0x2f9dd3['limit'];var _0x5ee14c;if(_0x3888af>=_0x8cbf3a){_0x3888af=_0x8cbf3a;_0x5ee14c=0xc8;}else{_0x5ee14c=0xce;}_0x5c07ab[_0x2007('0x1c')](_0x5ee14c);return _0x5c07ab[_0x2007('0x23')]('Content-Range',_0x5385ab+'-'+_0x3888af+'/'+_0x8cbf3a)[_0x2007('0x1e')](_0x743dc5);}return null;};}function patchUpdates(_0x4fe3b7){return function(_0x2a925f){try{jsonpatch[_0x2007('0x24')](_0x2a925f,_0x4fe3b7,!![]);}catch(_0x4308c9){return BPromise['reject'](_0x4308c9);}return _0x2a925f[_0x2007('0x25')]();};}function saveUpdates(_0x23dfa0,_0x137553){return function(_0x61aa23){if(_0x61aa23){return _0x61aa23[_0x2007('0x26')](_0x23dfa0)[_0x2007('0x27')](function(_0x48203d){return _0x48203d;});}return null;};}function removeEntity(_0xdf1a00,_0x43e7e9){return function(_0x610b7c){if(_0x610b7c){return _0x610b7c[_0x2007('0x28')]()['then'](function(){var _0x44bc2f=_0x610b7c[_0x2007('0x29')]({'plain':!![]});var _0x526c48=_0x2007('0x2a');return db[_0x2007('0x2b')]['destroy']({'where':{'type':_0x526c48,'resourceId':_0x44bc2f['id']}})[_0x2007('0x27')](function(){return _0x610b7c;});})[_0x2007('0x27')](function(){_0xdf1a00[_0x2007('0x1c')](0xcc)[_0x2007('0x1d')]();});}};}function handleEntityNotFound(_0x47fac6,_0x19b72c){return function(_0x3d79ec){if(!_0x3d79ec){_0x47fac6[_0x2007('0x1b')](0x194);}return _0x3d79ec;};}function handleError(_0x3dbb6e,_0x1f3a25){_0x1f3a25=_0x1f3a25||0x1f4;return function(_0x5dd5e1){logger[_0x2007('0x2c')](_0x5dd5e1[_0x2007('0x2d')]);if(_0x5dd5e1[_0x2007('0x2e')]){delete _0x5dd5e1[_0x2007('0x2e')];}_0x3dbb6e['status'](_0x1f3a25)[_0x2007('0x2f')](_0x5dd5e1);};}exports['index']=function(_0x1d8b9c,_0x32a978){var _0x62152={},_0x1d00b9={},_0x202149={'count':0x0,'rows':[]};var _0x169e01=_[_0x2007('0x30')](db['Schedule'][_0x2007('0x31')],function(_0x2966d7){return{'name':_0x2966d7['fieldName'],'type':_0x2966d7[_0x2007('0x32')]['key']};});_0x1d00b9[_0x2007('0x33')]=_[_0x2007('0x30')](_0x169e01,_0x2007('0x2e'));_0x1d00b9[_0x2007('0x34')]=_[_0x2007('0x35')](_0x1d8b9c[_0x2007('0x34')]);_0x1d00b9[_0x2007('0x36')]=_[_0x2007('0x37')](_0x1d00b9[_0x2007('0x33')],_0x1d00b9[_0x2007('0x34')]);_0x62152[_0x2007('0x38')]=_[_0x2007('0x37')](_0x1d00b9['model'],qs[_0x2007('0x39')](_0x1d8b9c[_0x2007('0x34')][_0x2007('0x39')]));_0x62152['attributes']=_0x62152['attributes']['length']?_0x62152[_0x2007('0x38')]:_0x1d00b9[_0x2007('0x33')];if(!_0x1d8b9c[_0x2007('0x34')][_0x2007('0x3a')](_0x2007('0x3b'))){_0x62152['limit']=qs[_0x2007('0x21')](_0x1d8b9c['query'][_0x2007('0x21')]);_0x62152[_0x2007('0x1f')]=qs[_0x2007('0x1f')](_0x1d8b9c[_0x2007('0x34')][_0x2007('0x1f')]);}_0x62152[_0x2007('0x3c')]=qs[_0x2007('0x3d')](_0x1d8b9c[_0x2007('0x34')][_0x2007('0x3d')]);_0x62152[_0x2007('0x3e')]=qs[_0x2007('0x36')](_['pick'](_0x1d8b9c[_0x2007('0x34')],_0x1d00b9[_0x2007('0x36')]),_0x169e01);if(_0x1d8b9c[_0x2007('0x34')][_0x2007('0x3f')]){_0x62152[_0x2007('0x3e')]=_[_0x2007('0x40')](_0x62152[_0x2007('0x3e')],{'$or':_['map'](_0x169e01,function(_0x16fcef){if(_0x16fcef[_0x2007('0x32')]!==_0x2007('0x41')){var _0x19fdf1={};_0x19fdf1[_0x16fcef['name']]={'$like':'%'+_0x1d8b9c[_0x2007('0x34')][_0x2007('0x3f')]+'%'};return _0x19fdf1;}})});}_0x62152=_[_0x2007('0x40')]({},_0x62152,_0x1d8b9c[_0x2007('0x42')]);var _0x283467={'where':_0x62152[_0x2007('0x3e')]};return db[_0x2007('0x43')][_0x2007('0x22')](_0x283467)[_0x2007('0x27')](function(_0x50081b){_0x202149[_0x2007('0x22')]=_0x50081b;if(_0x1d8b9c['query'][_0x2007('0x44')]){_0x62152[_0x2007('0x45')]=[{'all':!![]}];}return db[_0x2007('0x43')][_0x2007('0x46')](_0x62152);})[_0x2007('0x27')](function(_0x4d3dcd){_0x202149[_0x2007('0x47')]=_0x4d3dcd;return _0x202149;})['then'](respondWithFilteredResult(_0x32a978,_0x62152))[_0x2007('0x48')](handleError(_0x32a978,null));};exports[_0x2007('0x49')]=function(_0x19e63b,_0x1e3b31){var _0x212409={'raw':![],'where':{'id':_0x19e63b[_0x2007('0x4a')]['id']}},_0x3b8db6={};_0x3b8db6[_0x2007('0x33')]=_['keys'](db[_0x2007('0x43')]['rawAttributes']);_0x3b8db6['query']=_[_0x2007('0x35')](_0x19e63b[_0x2007('0x34')]);_0x3b8db6[_0x2007('0x36')]=_[_0x2007('0x37')](_0x3b8db6['model'],_0x3b8db6['query']);_0x212409['attributes']=_[_0x2007('0x37')](_0x3b8db6[_0x2007('0x33')],qs['fields'](_0x19e63b[_0x2007('0x34')]['fields']));_0x212409['attributes']=_0x212409[_0x2007('0x38')][_0x2007('0x4b')]?_0x212409[_0x2007('0x38')]:_0x3b8db6[_0x2007('0x33')];if(_0x19e63b[_0x2007('0x34')][_0x2007('0x44')]){_0x212409[_0x2007('0x45')]=[{'all':!![]}];}_0x212409=_[_0x2007('0x40')]({},_0x212409,_0x19e63b['options']);return db[_0x2007('0x43')][_0x2007('0x4c')](_0x212409)[_0x2007('0x27')](handleEntityNotFound(_0x1e3b31,null))[_0x2007('0x27')](respondWithResult(_0x1e3b31,null))[_0x2007('0x48')](handleError(_0x1e3b31,null));};exports[_0x2007('0x4d')]=function(_0x57091d,_0x23d8b7){return db['Schedule']['create'](_0x57091d[_0x2007('0x4e')],{})[_0x2007('0x27')](function(_0x5e00e1){var _0x31d0c2=_0x57091d['user']['get']({'plain':!![]});if(!_0x31d0c2)throw new Error(_0x2007('0x4f'));if(_0x31d0c2[_0x2007('0x50')]===_0x2007('0x51')){var _0xf8f4d4=_0x5e00e1[_0x2007('0x29')]({'plain':!![]});var _0x371006=_0x2007('0x2a');return db[_0x2007('0x52')]['find']({'where':{'name':_0x371006,'userProfileId':_0x31d0c2[_0x2007('0x53')]},'raw':!![]})[_0x2007('0x27')](function(_0x463198){if(_0x463198&&_0x463198['autoAssociation']===0x0){return db[_0x2007('0x2b')][_0x2007('0x4d')]({'name':_0xf8f4d4['name'],'resourceId':_0xf8f4d4['id'],'type':_0x463198[_0x2007('0x2e')],'sectionId':_0x463198['id']},{})[_0x2007('0x27')](function(){return _0x5e00e1;});}else{return _0x5e00e1;}})[_0x2007('0x48')](function(_0x447f39){logger['error'](_0x2007('0x54'),_0x447f39);throw _0x447f39;});}return _0x5e00e1;})['then'](respondWithResult(_0x23d8b7,0xc9))[_0x2007('0x48')](handleError(_0x23d8b7,null));};exports[_0x2007('0x26')]=function(_0x9217e2,_0x387120){if(_0x9217e2[_0x2007('0x4e')]['id']){delete _0x9217e2[_0x2007('0x4e')]['id'];}return db[_0x2007('0x43')][_0x2007('0x4c')]({'where':{'id':_0x9217e2[_0x2007('0x4a')]['id']}})['then'](handleEntityNotFound(_0x387120,null))[_0x2007('0x27')](saveUpdates(_0x9217e2[_0x2007('0x4e')],null))['then'](respondWithResult(_0x387120,null))['catch'](handleError(_0x387120,null));};exports[_0x2007('0x28')]=function(_0x169b9a,_0x1539bb){return db[_0x2007('0x43')][_0x2007('0x4c')]({'where':{'id':_0x169b9a[_0x2007('0x4a')]['id']}})[_0x2007('0x27')](handleEntityNotFound(_0x1539bb,null))[_0x2007('0x27')](removeEntity(_0x1539bb,null))['catch'](handleError(_0x1539bb,null));};exports[_0x2007('0x55')]=function(_0x3fdbda,_0x5d1fec,_0x4a06ca){var _0x2d5bd=require(_0x2007('0x56'));return db[_0x2007('0x43')][_0x2007('0x4c')]({'where':{'id':_0x3fdbda[_0x2007('0x4a')]['id']},'raw':!![]})[_0x2007('0x27')](handleEntityNotFound(_0x5d1fec,null))[_0x2007('0x27')](function(){_0x2d5bd[_0x2007('0x55')](_0x3fdbda[_0x2007('0x4a')]['id']);})['then'](respondWithStatusCode(_0x5d1fec,null))['catch'](handleError(_0x5d1fec,null));}; \ No newline at end of file +var _0xead8=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','findAll','rows','filters','includeAll','include','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','destroy','Scheduler','UserProfileResource','then','stack','name','send','index','Schedule','rawAttributes','model','query'];(function(_0x21afde,_0x4454ce){var _0x33cde=function(_0x4020fc){while(--_0x4020fc){_0x21afde['push'](_0x21afde['shift']());}};_0x33cde(++_0x4454ce);}(_0xead8,0x11c));var _0x8ead=function(_0x205c11,_0x941d3d){_0x205c11=_0x205c11-0x0;var _0x550e7b=_0xead8[_0x205c11];return _0x550e7b;};'use strict';var emlformat=require(_0x8ead('0x0'));var rimraf=require(_0x8ead('0x1'));var zipdir=require(_0x8ead('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ead('0x3'));var moment=require(_0x8ead('0x4'));var BPromise=require(_0x8ead('0x5'));var Mustache=require('mustache');var util=require(_0x8ead('0x6'));var path=require(_0x8ead('0x7'));var sox=require('sox');var csv=require(_0x8ead('0x8'));var ejs=require(_0x8ead('0x9'));var fs=require('fs');var fs_extra=require(_0x8ead('0xa'));var _=require(_0x8ead('0xb'));var squel=require(_0x8ead('0xc'));var crypto=require(_0x8ead('0xd'));var jsforce=require(_0x8ead('0xe'));var deskjs=require(_0x8ead('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8ead('0x10'));var Papa=require('papaparse');var Redis=require(_0x8ead('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8ead('0x12'));var as=require(_0x8ead('0x13'));var hardwareService=require(_0x8ead('0x14'));var logger=require(_0x8ead('0x15'))(_0x8ead('0x16'));var utils=require(_0x8ead('0x17'));var config=require(_0x8ead('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ead('0x19'))['db'];function respondWithStatusCode(_0x5610f7,_0x2e140a){_0x2e140a=_0x2e140a||0xcc;return function(_0x1a8218){if(_0x1a8218){return _0x5610f7[_0x8ead('0x1a')](_0x2e140a);}return _0x5610f7[_0x8ead('0x1b')](_0x2e140a)[_0x8ead('0x1c')]();};}function respondWithResult(_0x13de43,_0x5aed9a){_0x5aed9a=_0x5aed9a||0xc8;return function(_0xcca8b0){if(_0xcca8b0){return _0x13de43['status'](_0x5aed9a)['json'](_0xcca8b0);}};}function respondWithFilteredResult(_0x5295e8,_0x11766f){return function(_0x1a4649){if(_0x1a4649){var _0x37737a=typeof _0x11766f[_0x8ead('0x1d')]===_0x8ead('0x1e')&&typeof _0x11766f[_0x8ead('0x1f')]===_0x8ead('0x1e');var _0x1d12d5=_0x1a4649[_0x8ead('0x20')];var _0xe95c70=_0x37737a?0x0:_0x11766f[_0x8ead('0x1d')];var _0x20b848=_0x37737a?_0x1a4649[_0x8ead('0x20')]:_0x11766f[_0x8ead('0x1d')]+_0x11766f[_0x8ead('0x1f')];var _0x1b7fda;if(_0x20b848>=_0x1d12d5){_0x20b848=_0x1d12d5;_0x1b7fda=0xc8;}else{_0x1b7fda=0xce;}_0x5295e8[_0x8ead('0x1b')](_0x1b7fda);return _0x5295e8['set']('Content-Range',_0xe95c70+'-'+_0x20b848+'/'+_0x1d12d5)[_0x8ead('0x21')](_0x1a4649);}return null;};}function patchUpdates(_0xd2e19){return function(_0x4c2ec3){try{jsonpatch[_0x8ead('0x22')](_0x4c2ec3,_0xd2e19,!![]);}catch(_0x5a8a30){return BPromise[_0x8ead('0x23')](_0x5a8a30);}return _0x4c2ec3['save']();};}function saveUpdates(_0x292584,_0x308335){return function(_0x1a7513){if(_0x1a7513){return _0x1a7513['update'](_0x292584)['then'](function(_0x41b025){return _0x41b025;});}return null;};}function removeEntity(_0x26533f,_0x37caa2){return function(_0xd7dcfe){if(_0xd7dcfe){return _0xd7dcfe[_0x8ead('0x24')]()['then'](function(){var _0x28c154=_0xd7dcfe['get']({'plain':!![]});var _0x5c0012=_0x8ead('0x25');return db[_0x8ead('0x26')][_0x8ead('0x24')]({'where':{'type':_0x5c0012,'resourceId':_0x28c154['id']}})[_0x8ead('0x27')](function(){return _0xd7dcfe;});})[_0x8ead('0x27')](function(){_0x26533f['status'](0xcc)[_0x8ead('0x1c')]();});}};}function handleEntityNotFound(_0x76b908,_0x32a83c){return function(_0x3a9ad6){if(!_0x3a9ad6){_0x76b908[_0x8ead('0x1a')](0x194);}return _0x3a9ad6;};}function handleError(_0x201581,_0x587bd4){_0x587bd4=_0x587bd4||0x1f4;return function(_0x4c786c){logger['error'](_0x4c786c[_0x8ead('0x28')]);if(_0x4c786c[_0x8ead('0x29')]){delete _0x4c786c['name'];}_0x201581[_0x8ead('0x1b')](_0x587bd4)[_0x8ead('0x2a')](_0x4c786c);};}exports[_0x8ead('0x2b')]=function(_0x418b38,_0x3eb751){var _0x17d056={},_0x5b9f6f={},_0x47662d={'count':0x0,'rows':[]};var _0x4a71ff=_['map'](db[_0x8ead('0x2c')][_0x8ead('0x2d')],function(_0x17a0fc){return{'name':_0x17a0fc['fieldName'],'type':_0x17a0fc['type']['key']};});_0x5b9f6f[_0x8ead('0x2e')]=_['map'](_0x4a71ff,'name');_0x5b9f6f[_0x8ead('0x2f')]=_[_0x8ead('0x30')](_0x418b38[_0x8ead('0x2f')]);_0x5b9f6f['filters']=_[_0x8ead('0x31')](_0x5b9f6f['model'],_0x5b9f6f[_0x8ead('0x2f')]);_0x17d056[_0x8ead('0x32')]=_[_0x8ead('0x31')](_0x5b9f6f[_0x8ead('0x2e')],qs[_0x8ead('0x33')](_0x418b38['query'][_0x8ead('0x33')]));_0x17d056[_0x8ead('0x32')]=_0x17d056['attributes'][_0x8ead('0x34')]?_0x17d056['attributes']:_0x5b9f6f[_0x8ead('0x2e')];if(!_0x418b38['query'][_0x8ead('0x35')](_0x8ead('0x36'))){_0x17d056[_0x8ead('0x1f')]=qs[_0x8ead('0x1f')](_0x418b38[_0x8ead('0x2f')][_0x8ead('0x1f')]);_0x17d056[_0x8ead('0x1d')]=qs[_0x8ead('0x1d')](_0x418b38['query']['offset']);}_0x17d056[_0x8ead('0x37')]=qs[_0x8ead('0x38')](_0x418b38[_0x8ead('0x2f')][_0x8ead('0x38')]);_0x17d056[_0x8ead('0x39')]=qs['filters'](_[_0x8ead('0x3a')](_0x418b38[_0x8ead('0x2f')],_0x5b9f6f['filters']),_0x4a71ff);if(_0x418b38['query'][_0x8ead('0x3b')]){_0x17d056[_0x8ead('0x39')]=_[_0x8ead('0x3c')](_0x17d056['where'],{'$or':_[_0x8ead('0x3d')](_0x4a71ff,function(_0x1d69f6){if(_0x1d69f6[_0x8ead('0x3e')]!==_0x8ead('0x3f')){var _0x752c6e={};_0x752c6e[_0x1d69f6['name']]={'$like':'%'+_0x418b38[_0x8ead('0x2f')]['filter']+'%'};return _0x752c6e;}})});}_0x17d056=_[_0x8ead('0x3c')]({},_0x17d056,_0x418b38[_0x8ead('0x40')]);var _0x11b8f8={'where':_0x17d056[_0x8ead('0x39')]};return db[_0x8ead('0x2c')][_0x8ead('0x20')](_0x11b8f8)[_0x8ead('0x27')](function(_0x2e1f16){_0x47662d[_0x8ead('0x20')]=_0x2e1f16;if(_0x418b38[_0x8ead('0x2f')]['includeAll']){_0x17d056['include']=[{'all':!![]}];}return db[_0x8ead('0x2c')][_0x8ead('0x41')](_0x17d056);})[_0x8ead('0x27')](function(_0xae7ad9){_0x47662d[_0x8ead('0x42')]=_0xae7ad9;return _0x47662d;})[_0x8ead('0x27')](respondWithFilteredResult(_0x3eb751,_0x17d056))['catch'](handleError(_0x3eb751,null));};exports['show']=function(_0x4aab0b,_0x26ce3f){var _0x4c0b36={'raw':![],'where':{'id':_0x4aab0b['params']['id']}},_0x24bac8={};_0x24bac8[_0x8ead('0x2e')]=_[_0x8ead('0x30')](db['Schedule']['rawAttributes']);_0x24bac8[_0x8ead('0x2f')]=_[_0x8ead('0x30')](_0x4aab0b['query']);_0x24bac8[_0x8ead('0x43')]=_[_0x8ead('0x31')](_0x24bac8[_0x8ead('0x2e')],_0x24bac8[_0x8ead('0x2f')]);_0x4c0b36['attributes']=_[_0x8ead('0x31')](_0x24bac8['model'],qs[_0x8ead('0x33')](_0x4aab0b[_0x8ead('0x2f')][_0x8ead('0x33')]));_0x4c0b36[_0x8ead('0x32')]=_0x4c0b36[_0x8ead('0x32')][_0x8ead('0x34')]?_0x4c0b36[_0x8ead('0x32')]:_0x24bac8[_0x8ead('0x2e')];if(_0x4aab0b['query'][_0x8ead('0x44')]){_0x4c0b36[_0x8ead('0x45')]=[{'all':!![]}];}_0x4c0b36=_[_0x8ead('0x3c')]({},_0x4c0b36,_0x4aab0b[_0x8ead('0x40')]);return db['Schedule']['find'](_0x4c0b36)['then'](handleEntityNotFound(_0x26ce3f,null))[_0x8ead('0x27')](respondWithResult(_0x26ce3f,null))[_0x8ead('0x46')](handleError(_0x26ce3f,null));};exports[_0x8ead('0x47')]=function(_0x209390,_0x2bbc6c){return db['Schedule']['create'](_0x209390[_0x8ead('0x48')],{})[_0x8ead('0x27')](function(_0x854343){var _0xb1cdd1=_0x209390['user']['get']({'plain':!![]});if(!_0xb1cdd1)throw new Error(_0x8ead('0x49'));if(_0xb1cdd1['role']===_0x8ead('0x4a')){var _0xf0a93d=_0x854343['get']({'plain':!![]});var _0x1951f3=_0x8ead('0x25');return db[_0x8ead('0x4b')][_0x8ead('0x4c')]({'where':{'name':_0x1951f3,'userProfileId':_0xb1cdd1['userProfileId']},'raw':!![]})[_0x8ead('0x27')](function(_0x2e6fd9){if(_0x2e6fd9&&_0x2e6fd9[_0x8ead('0x4d')]===0x0){return db[_0x8ead('0x26')][_0x8ead('0x47')]({'name':_0xf0a93d[_0x8ead('0x29')],'resourceId':_0xf0a93d['id'],'type':_0x2e6fd9['name'],'sectionId':_0x2e6fd9['id']},{})[_0x8ead('0x27')](function(){return _0x854343;});}else{return _0x854343;}})[_0x8ead('0x46')](function(_0x269401){logger[_0x8ead('0x4e')](_0x8ead('0x4f'),_0x269401);throw _0x269401;});}return _0x854343;})[_0x8ead('0x27')](respondWithResult(_0x2bbc6c,0xc9))['catch'](handleError(_0x2bbc6c,null));};exports['update']=function(_0x503203,_0x4fe9ba){if(_0x503203[_0x8ead('0x48')]['id']){delete _0x503203[_0x8ead('0x48')]['id'];}return db[_0x8ead('0x2c')]['find']({'where':{'id':_0x503203[_0x8ead('0x50')]['id']}})[_0x8ead('0x27')](handleEntityNotFound(_0x4fe9ba,null))[_0x8ead('0x27')](saveUpdates(_0x503203['body'],null))[_0x8ead('0x27')](respondWithResult(_0x4fe9ba,null))['catch'](handleError(_0x4fe9ba,null));};exports[_0x8ead('0x24')]=function(_0xe0a537,_0x1ed062){return db[_0x8ead('0x2c')][_0x8ead('0x4c')]({'where':{'id':_0xe0a537[_0x8ead('0x50')]['id']}})['then'](handleEntityNotFound(_0x1ed062,null))['then'](removeEntity(_0x1ed062,null))[_0x8ead('0x46')](handleError(_0x1ed062,null));};exports[_0x8ead('0x51')]=function(_0x14605f,_0xad7762,_0x2f698a){var _0x556586=require(_0x8ead('0x52'));return db[_0x8ead('0x2c')][_0x8ead('0x4c')]({'where':{'id':_0x14605f['params']['id']},'raw':!![]})[_0x8ead('0x27')](handleEntityNotFound(_0xad7762,null))[_0x8ead('0x27')](function(){_0x556586['run'](_0x14605f[_0x8ead('0x50')]['id']);})[_0x8ead('0x27')](respondWithStatusCode(_0xad7762,null))['catch'](handleError(_0xad7762,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index ef96b0e..1398689 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 _0xa368=['rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4bbc77,_0xf21f8c){var _0x1cf33f=function(_0x7f0ac5){while(--_0x7f0ac5){_0x4bbc77['push'](_0x4bbc77['shift']());}};_0x1cf33f(++_0xf21f8c);}(_0xa368,0x1e7));var _0x8a36=function(_0x8f5b71,_0x5ce395){_0x8f5b71=_0x8f5b71-0x0;var _0x448cbb=_0xa368[_0x8f5b71];return _0x448cbb;};'use strict';var _=require(_0x8a36('0x0'));var util=require(_0x8a36('0x1'));var logger=require(_0x8a36('0x2'))(_0x8a36('0x3'));var moment=require(_0x8a36('0x4'));var BPromise=require(_0x8a36('0x5'));var rp=require(_0x8a36('0x6'));var fs=require('fs');var path=require(_0x8a36('0x7'));var rimraf=require(_0x8a36('0x8'));var config=require(_0x8a36('0x9'));var attributes=require(_0x8a36('0xa'));module[_0x8a36('0xb')]=function(_0x1746c8,_0x4c2a02){return _0x1746c8[_0x8a36('0xc')](_0x8a36('0xd'),attributes,{'tableName':_0x8a36('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dc2=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash'];(function(_0x2687b0,_0x3ea058){var _0x2800f3=function(_0x14e449){while(--_0x14e449){_0x2687b0['push'](_0x2687b0['shift']());}};_0x2800f3(++_0x3ea058);}(_0x7dc2,0x6f));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x27dc('0x0'));var util=require(_0x27dc('0x1'));var logger=require(_0x27dc('0x2'))(_0x27dc('0x3'));var moment=require(_0x27dc('0x4'));var BPromise=require('bluebird');var rp=require(_0x27dc('0x5'));var fs=require('fs');var path=require(_0x27dc('0x6'));var rimraf=require(_0x27dc('0x7'));var config=require(_0x27dc('0x8'));var attributes=require(_0x27dc('0x9'));module[_0x27dc('0xa')]=function(_0x4b7ad7,_0x48c593){return _0x4b7ad7[_0x27dc('0xb')](_0x27dc('0xc'),attributes,{'tableName':_0x27dc('0xd'),'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 d8e20d9..4f36f9f 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 _0xfbb4=['jayson/promise','http','request','then','info','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x3cc2f9,_0xdd8f64){var _0x30304b=function(_0x48b4ae){while(--_0x48b4ae){_0x3cc2f9['push'](_0x3cc2f9['shift']());}};_0x30304b(++_0xdd8f64);}(_0xfbb4,0xe1));var _0x4fbb=function(_0x11f522,_0x4433ef){_0x11f522=_0x11f522-0x0;var _0x3f1d6e=_0xfbb4[_0x11f522];return _0x3f1d6e;};'use strict';var _=require(_0x4fbb('0x0'));var util=require('util');var moment=require(_0x4fbb('0x1'));var BPromise=require('bluebird');var rs=require(_0x4fbb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4fbb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4fbb('0x4'))(_0x4fbb('0x5'));var config=require('../../config/environment');var jayson=require(_0x4fbb('0x6'));var client=jayson['client'][_0x4fbb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3de0e6,_0x7db1ea,_0x1322e6){return new BPromise(function(_0x510282,_0x23680d){return client[_0x4fbb('0x8')](_0x3de0e6,_0x1322e6)[_0x4fbb('0x9')](function(_0x53fe9f){logger[_0x4fbb('0xa')]('Schedule,\x20%s,\x20%s',_0x7db1ea,'request\x20sent');logger[_0x4fbb('0xb')](_0x4fbb('0xc'),_0x7db1ea,'request\x20sent',JSON[_0x4fbb('0xd')](_0x53fe9f));if(_0x53fe9f[_0x4fbb('0xe')]){if(_0x53fe9f[_0x4fbb('0xe')][_0x4fbb('0xf')]===0x1f4){logger[_0x4fbb('0xe')](_0x4fbb('0x10'),_0x7db1ea,_0x53fe9f[_0x4fbb('0xe')]['message']);return _0x23680d(_0x53fe9f[_0x4fbb('0xe')][_0x4fbb('0x11')]);}logger[_0x4fbb('0xe')](_0x4fbb('0x10'),_0x7db1ea,_0x53fe9f[_0x4fbb('0xe')][_0x4fbb('0x11')]);return _0x510282(_0x53fe9f[_0x4fbb('0xe')]['message']);}else{logger['info'](_0x4fbb('0x10'),_0x7db1ea,_0x4fbb('0x12'));_0x510282(_0x53fe9f[_0x4fbb('0x13')][_0x4fbb('0x11')]);}})[_0x4fbb('0x14')](function(_0x277ace){logger[_0x4fbb('0xe')](_0x4fbb('0x10'),_0x7db1ea,_0x277ace);_0x23680d(_0x277ace);});});} \ No newline at end of file +var _0x5a95=['Schedule,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2cf0c1,_0x561bd7){var _0x513945=function(_0x281b39){while(--_0x281b39){_0x2cf0c1['push'](_0x2cf0c1['shift']());}};_0x513945(++_0x561bd7);}(_0x5a95,0x147));var _0x55a9=function(_0x2ace29,_0x12632f){_0x2ace29=_0x2ace29-0x0;var _0x5f52bf=_0x5a95[_0x2ace29];return _0x5f52bf;};'use strict';var _=require(_0x55a9('0x0'));var util=require(_0x55a9('0x1'));var moment=require(_0x55a9('0x2'));var BPromise=require('bluebird');var rs=require(_0x55a9('0x3'));var fs=require('fs');var Redis=require(_0x55a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x55a9('0x5'));var logger=require(_0x55a9('0x6'))(_0x55a9('0x7'));var config=require(_0x55a9('0x8'));var jayson=require(_0x55a9('0x9'));var client=jayson['client'][_0x55a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x312932,_0x5c8bd3,_0x436742){return new BPromise(function(_0x187d02,_0x1e5a22){return client[_0x55a9('0xb')](_0x312932,_0x436742)[_0x55a9('0xc')](function(_0xfa1b95){logger['info']('Schedule,\x20%s,\x20%s',_0x5c8bd3,'request\x20sent');logger[_0x55a9('0xd')](_0x55a9('0xe'),_0x5c8bd3,_0x55a9('0xf'),JSON[_0x55a9('0x10')](_0xfa1b95));if(_0xfa1b95[_0x55a9('0x11')]){if(_0xfa1b95[_0x55a9('0x11')]['code']===0x1f4){logger['error'](_0x55a9('0x12'),_0x5c8bd3,_0xfa1b95[_0x55a9('0x11')]['message']);return _0x1e5a22(_0xfa1b95[_0x55a9('0x11')][_0x55a9('0x13')]);}logger[_0x55a9('0x11')](_0x55a9('0x12'),_0x5c8bd3,_0xfa1b95[_0x55a9('0x11')][_0x55a9('0x13')]);return _0x187d02(_0xfa1b95[_0x55a9('0x11')]['message']);}else{logger[_0x55a9('0x14')](_0x55a9('0x12'),_0x5c8bd3,_0x55a9('0xf'));_0x187d02(_0xfa1b95[_0x55a9('0x15')][_0x55a9('0x13')]);}})[_0x55a9('0x16')](function(_0x173fdb){logger[_0x55a9('0x11')]('Schedule,\x20%s,\x20%s',_0x5c8bd3,_0x173fdb);_0x1e5a22(_0x173fdb);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 19be1dc..12f4758 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 _0xbba0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x26c9fb,_0x4282e2){var _0x3210a8=function(_0x594f6d){while(--_0x594f6d){_0x26c9fb['push'](_0x26c9fb['shift']());}};_0x3210a8(++_0x4282e2);}(_0xbba0,0x7a));var _0x0bba=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xbba0[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require(_0x0bba('0x0'));var path=require(_0x0bba('0x1'));var timeout=require(_0x0bba('0x2'));var express=require(_0x0bba('0x3'));var router=express[_0x0bba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0bba('0x5'));var interaction=require(_0x0bba('0x6'));var config=require(_0x0bba('0x7'));var controller=require('./screenRecording.controller');router[_0x0bba('0x8')]('/',auth[_0x0bba('0x9')](),controller[_0x0bba('0xa')]);router['get']('/describe',auth[_0x0bba('0x9')](),controller[_0x0bba('0xb')]);router['get'](_0x0bba('0xc'),auth['isAuthenticated'](),controller[_0x0bba('0xd')]);router[_0x0bba('0x8')](_0x0bba('0xe'),auth['isAuthenticated'](),controller[_0x0bba('0xf')]);router['post']('/',auth[_0x0bba('0x9')](),controller['create']);router[_0x0bba('0x10')](_0x0bba('0xc'),auth['isAuthenticated'](),controller[_0x0bba('0x11')]);router[_0x0bba('0x12')](_0x0bba('0xc'),auth[_0x0bba('0x9')](),controller[_0x0bba('0x13')]);module[_0x0bba('0x14')]=router; \ No newline at end of file +var _0x7645=['./screenRecording.controller','get','/describe','isAuthenticated','describe','/:id','show','download','post','create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x545dda,_0x577f99){var _0xef8cba=function(_0x3cf2e8){while(--_0x3cf2e8){_0x545dda['push'](_0x545dda['shift']());}};_0xef8cba(++_0x577f99);}(_0x7645,0x1f3));var _0x5764=function(_0x5bd581,_0xc69c5d){_0x5bd581=_0x5bd581-0x0;var _0x4d51ec=_0x7645[_0x5bd581];return _0x4d51ec;};'use strict';var multer=require('multer');var util=require(_0x5764('0x0'));var path=require(_0x5764('0x1'));var timeout=require('connect-timeout');var express=require(_0x5764('0x2'));var router=express[_0x5764('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5764('0x4'));var interaction=require(_0x5764('0x5'));var config=require(_0x5764('0x6'));var controller=require(_0x5764('0x7'));router[_0x5764('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5764('0x8')](_0x5764('0x9'),auth[_0x5764('0xa')](),controller[_0x5764('0xb')]);router[_0x5764('0x8')](_0x5764('0xc'),auth[_0x5764('0xa')](),controller[_0x5764('0xd')]);router[_0x5764('0x8')]('/:id/download',auth[_0x5764('0xa')](),controller[_0x5764('0xe')]);router[_0x5764('0xf')]('/',auth['isAuthenticated'](),controller[_0x5764('0x10')]);router[_0x5764('0x11')]('/:id',auth[_0x5764('0xa')](),controller[_0x5764('0x12')]);router[_0x5764('0x13')](_0x5764('0xc'),auth[_0x5764('0xa')](),controller[_0x5764('0x14')]);module[_0x5764('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index f3fbdfe..3bc69ae 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 _0x96f2=['startedAt','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','sequelize','path','../../config/environment','exports','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER'];(function(_0x2ac3dd,_0x3bc187){var _0x487a05=function(_0x40bce1){while(--_0x40bce1){_0x2ac3dd['push'](_0x2ac3dd['shift']());}};_0x487a05(++_0x3bc187);}(_0x96f2,0xb0));var _0x296f=function(_0x377755,_0x5b6a25){_0x377755=_0x377755-0x0;var _0x22ab73=_0x96f2[_0x377755];return _0x22ab73;};'use strict';var Sequelize=require(_0x296f('0x0'));var moment=require('moment');var path=require(_0x296f('0x1'));var config=require(_0x296f('0x2'));module[_0x296f('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x296f('0x4')](_0x296f('0x5'))?path[_0x296f('0x6')](this['getDataValue'](_0x296f('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x296f('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x164031){var _0x1d019f=_0x164031[_0x296f('0x8')](/\\/g,'/');this[_0x296f('0x9')](_0x296f('0x5'),_0x1d019f);}},'rating':{'type':Sequelize[_0x296f('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x296f('0xa')],'set':function(_0x3ea699){this[_0x296f('0x9')](_0x296f('0xb'),moment()['subtract'](_0x3ea699,'ms'));this[_0x296f('0x9')](_0x296f('0xc'),moment());this[_0x296f('0x9')]('duration',_0x3ea699);}},'startedAt':{'type':Sequelize[_0x296f('0xd')],'get':function(){return moment(this[_0x296f('0x4')](_0x296f('0xb')))[_0x296f('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x296f('0x4')](_0x296f('0xc')))[_0x296f('0xe')](_0x296f('0xf'))['toString']();}},'createdAt':{'type':Sequelize[_0x296f('0xd')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x296f('0xe')](_0x296f('0xf'))[_0x296f('0x10')]();}},'updatedAt':{'type':Sequelize[_0x296f('0xd')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0x296f('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x296f('0x10')]();}}}; \ No newline at end of file +var _0xf777=['MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','subtract','closedAt','duration','startedAt','format'];(function(_0x5e39d2,_0x54f1d8){var _0x5c9826=function(_0xa103c7){while(--_0xa103c7){_0x5e39d2['push'](_0x5e39d2['shift']());}};_0x5c9826(++_0x54f1d8);}(_0xf777,0x1e9));var _0x7f77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf777[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7f77('0x0'));var moment=require(_0x7f77('0x1'));var path=require(_0x7f77('0x2'));var config=require(_0x7f77('0x3'));module[_0x7f77('0x4')]={'format':{'type':Sequelize[_0x7f77('0x5')],'get':function(){return this[_0x7f77('0x6')](_0x7f77('0x7'))?path[_0x7f77('0x8')](this['getDataValue'](_0x7f77('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x7f77('0x9')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x7f77('0x9')],'set':function(_0x53df7d){var _0x7bfea=_0x53df7d['replace'](/\\/g,'/');this[_0x7f77('0xa')](_0x7f77('0x7'),_0x7bfea);}},'rating':{'type':Sequelize[_0x7f77('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x7f77('0xb')],'set':function(_0xc8bbae){this['setDataValue']('startedAt',moment()[_0x7f77('0xc')](_0xc8bbae,'ms'));this[_0x7f77('0xa')](_0x7f77('0xd'),moment());this[_0x7f77('0xa')](_0x7f77('0xe'),_0xc8bbae);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x7f77('0x6')](_0x7f77('0xf')))[_0x7f77('0x10')](_0x7f77('0x11'))[_0x7f77('0x12')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x7f77('0xd')))[_0x7f77('0x10')](_0x7f77('0x11'))[_0x7f77('0x12')]();}},'createdAt':{'type':Sequelize[_0x7f77('0x13')],'get':function(){return moment(this[_0x7f77('0x6')](_0x7f77('0x14')))[_0x7f77('0x10')](_0x7f77('0x11'))[_0x7f77('0x12')]();}},'updatedAt':{'type':Sequelize[_0x7f77('0x13')],'get':function(){return moment(this[_0x7f77('0x6')](_0x7f77('0x15')))[_0x7f77('0x10')](_0x7f77('0x11'))[_0x7f77('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 8d15e9b..0830435 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 _0xe14b=['include','findAll','catch','show','fields','length','includeAll','find','create','body','duration','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x567c05,_0xc4a6df){var _0x4a4111=function(_0x2b6935){while(--_0x2b6935){_0x567c05['push'](_0x567c05['shift']());}};_0x4a4111(++_0xc4a6df);}(_0xe14b,0x93));var _0xbe14=function(_0x5aba66,_0x7cfe5b){_0x5aba66=_0x5aba66-0x0;var _0x2b5ceb=_0xe14b[_0x5aba66];return _0x2b5ceb;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){_0x3d3608['status'](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x5fa043,_0x1ee9c1){return function(_0x39cc81){if(!_0x39cc81){_0x5fa043[_0xbe14('0x16')](0x194);}return _0x39cc81;};}function handleError(_0x2703f5,_0x55d001){_0x55d001=_0x55d001||0x1f4;return function(_0x1822e0){logger[_0xbe14('0x23')](_0x1822e0[_0xbe14('0x24')]);if(_0x1822e0[_0xbe14('0x25')]){delete _0x1822e0['name'];}_0x2703f5[_0xbe14('0x17')](_0x55d001)[_0xbe14('0x26')](_0x1822e0);};}exports['index']=function(_0x3c3613,_0x3b3e84){var _0x1c7cc7={},_0x19252f={},_0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x2a')],'type':_0x16a159[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x19252f[_0xbe14('0x2d')]=_[_0xbe14('0x2e')](_[_0xbe14('0x27')](_0x36d4b2,_0xbe14('0x25')),[_0xbe14('0x2f')]);_0x19252f[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x3c3613['query']);_0x19252f[_0xbe14('0x32')]=_['intersection'](_0x19252f['model'],_0x19252f[_0xbe14('0x30')]);_0x1c7cc7['attributes']=_[_0xbe14('0x33')](_0x19252f[_0xbe14('0x2d')],qs['fields'](_0x3c3613['query']['fields']));_0x1c7cc7[_0xbe14('0x34')]=_0x1c7cc7[_0xbe14('0x34')]['length']?_0x1c7cc7[_0xbe14('0x34')]:_0x19252f[_0xbe14('0x2d')];if(!_0x3c3613[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x1c7cc7['limit']=qs['limit'](_0x3c3613[_0xbe14('0x30')]['limit']);_0x1c7cc7['offset']=qs['offset'](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x1c')]);}_0x1c7cc7[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x38')]);_0x1c7cc7[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x3c3613[_0xbe14('0x30')],_0x19252f[_0xbe14('0x32')]),_0x36d4b2);if(_0x3c3613[_0xbe14('0x30')]['filter']){_0x1c7cc7['where']=_[_0xbe14('0x3b')](_0x1c7cc7[_0xbe14('0x39')],{'$or':_[_0xbe14('0x27')](_0x36d4b2,function(_0x520e09){if(_0x520e09[_0xbe14('0x2b')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x25')]]={'$like':'%'+_0x3c3613[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x1c7cc7=_[_0xbe14('0x3b')]({},_0x1c7cc7,_0x3c3613[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x1c7cc7['where']};return db[_0xbe14('0x28')][_0xbe14('0x1b')](_0x1b2608)[_0xbe14('0x22')](function(_0x1b3118){_0x34d648[_0xbe14('0x1b')]=_0x1b3118;if(_0x3c3613[_0xbe14('0x30')]['includeAll']){_0x1c7cc7[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x28')][_0xbe14('0x40')](_0x1c7cc7);})[_0xbe14('0x22')](function(_0x5cf713){_0x34d648['rows']=_0x5cf713;return _0x34d648;})[_0xbe14('0x22')](respondWithFilteredResult(_0x3b3e84,_0x1c7cc7))[_0xbe14('0x41')](handleError(_0x3b3e84,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2d')]=_[_0xbe14('0x31')](db[_0xbe14('0x28')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2d')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['ScreenRecording'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x22')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['ScreenRecording']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x22')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0xca8cdb,_0x5d3726){if(_0xca8cdb[_0xbe14('0x48')]['id']){delete _0xca8cdb[_0xbe14('0x48')]['id'];}delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x49')];delete _0xca8cdb[_0xbe14('0x48')]['createdAt'];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4a')];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4b')];return db[_0xbe14('0x28')]['find']({'where':{'id':_0xca8cdb[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x5d3726,null))[_0xbe14('0x22')](saveUpdates(_0xca8cdb[_0xbe14('0x48')],null))[_0xbe14('0x22')](respondWithResult(_0x5d3726,null))[_0xbe14('0x41')](handleError(_0x5d3726,null));};exports['describe']=function(_0x5aeea9,_0x3a49f7){return db[_0xbe14('0x28')][_0xbe14('0x4d')]()['then'](respondWithResult(_0x3a49f7,null))['catch'](handleError(_0x3a49f7,null));};exports[_0xbe14('0x4e')]=function(_0x134878,_0x50d78f,_0x339a86){var _0x32496a=require('../../components/encryptor');var _0x28f995=![];var _0x4a40d2={};if(_0x134878[_0xbe14('0x30')][_0xbe14('0x2b')]&&_0x134878[_0xbe14('0x30')]['type']===_0xbe14('0x4f')){_0x4a40d2[_0xbe14('0x4f')]=_0x134878['params']['id'];}else{_0x4a40d2['id']=_0x134878[_0xbe14('0x4c')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':_0x4a40d2,'attributes':['id',_0xbe14('0x4b')],'raw':!![]})[_0xbe14('0x22')](handleEntityNotFound(_0x50d78f,null))['then'](function(_0x42a346){if(_0x42a346){var _0x34cd66=path[_0xbe14('0x50')](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x42a346[_0xbe14('0x4b')]);var _0x1dd6c7=util['format'](_0xbe14('0x53'),_0x34cd66);if(fs[_0xbe14('0x54')](_0x1dd6c7)){_0x28f995=!![];return _0x32496a[_0xbe14('0x55')](_0x1dd6c7,_0x34cd66,config[_0xbe14('0x56')][_0xbe14('0x57')])[_0xbe14('0x22')](function(){return _0x42a346;});}return _0x42a346;}})[_0xbe14('0x22')](function(_0x32df3c){if(_0x32df3c){var _0x285b6e=path[_0xbe14('0x50')](config[_0xbe14('0x51')],'server/files/screen_recordings',_0x32df3c['value']);if(!fs['existsSync'](_0x285b6e)){throw new db[(_0xbe14('0x58'))][(_0xbe14('0x59'))](_0xbe14('0x5a'));}if(_0x32df3c[_0xbe14('0x5b')]){return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,_0x32df3c[_0xbe14('0x5b')]+path[_0xbe14('0x5c')](_0x285b6e),function(){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}else{return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,function(_0x451b0b){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}}})[_0xbe14('0x41')](function(_0x2088e4){if(_0x2088e4[_0xbe14('0x5e')]===_0xbe14('0x5a')){_0x50d78f[_0xbe14('0x17')](0x194)[_0xbe14('0x26')](_0xbe14('0x5f'));}else{return handleError(_0x50d78f,null);}});};exports[_0xbe14('0x60')]=function(_0x1a945b,_0x5f394c){return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':{'id':_0x1a945b[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](function(_0x3ee6b7){if(_[_0xbe14('0x61')](_0x3ee6b7)){throw new ReferenceError(_0xbe14('0x62'));}return _0x3ee6b7;})[_0xbe14('0x22')](function(_0x23cb36){var _0x100d43=path['join'](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x23cb36[_0xbe14('0x4b')]);logger[_0xbe14('0x63')](_0xbe14('0x64'),_0x100d43);if(!_['isNil'](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs['unlinkSync'](_0x100d43);}_0x100d43=_0x100d43+_0xbe14('0x67');if(!_[_0xbe14('0x61')](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs[_0xbe14('0x68')](_0x100d43);}return _0x23cb36;})['then'](function(_0x1bb588){if(!_0x1bb588)throw new InternalError();return _0x1bb588[_0xbe14('0x60')]();})[_0xbe14('0x22')](function(){_0x5f394c[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();})[_0xbe14('0x41')](handleError(_0x5f394c,null));}; \ No newline at end of file +var _0x98a8=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','join','server/files/screen_recordings','value','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x223e2a,_0x3b0296){var _0x8e9c46=function(_0x1ced73){while(--_0x1ced73){_0x223e2a['push'](_0x223e2a['shift']());}};_0x8e9c46(++_0x3b0296);}(_0x98a8,0x12c));var _0x898a=function(_0x2cf112,_0x1c0e02){_0x2cf112=_0x2cf112-0x0;var _0x1e0e77=_0x98a8[_0x2cf112];return _0x1e0e77;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x1426e3,_0x5b7719){return function(_0x20bde0){if(!_0x20bde0){_0x1426e3['sendStatus'](0x194);}return _0x20bde0;};}function handleError(_0x513c6b,_0x53ddb2){_0x53ddb2=_0x53ddb2||0x1f4;return function(_0x3678be){logger[_0x898a('0x25')](_0x3678be[_0x898a('0x26')]);if(_0x3678be[_0x898a('0x27')]){delete _0x3678be[_0x898a('0x27')];}_0x513c6b[_0x898a('0x1a')](_0x53ddb2)[_0x898a('0x28')](_0x3678be);};}exports[_0x898a('0x29')]=function(_0xd31922,_0x58149d){var _0x4b3e68={},_0x47f1ed={},_0xe9c33d={'count':0x0,'rows':[]};var _0x62fe93=_[_0x898a('0x2a')](db[_0x898a('0x2b')][_0x898a('0x2c')],function(_0x560000){return{'name':_0x560000[_0x898a('0x2d')],'type':_0x560000[_0x898a('0x2e')][_0x898a('0x2f')]};});_0x47f1ed[_0x898a('0x30')]=_[_0x898a('0x31')](_[_0x898a('0x2a')](_0x62fe93,'name'),[_0x898a('0x32')]);_0x47f1ed[_0x898a('0x33')]=_[_0x898a('0x34')](_0xd31922[_0x898a('0x33')]);_0x47f1ed[_0x898a('0x35')]=_['intersection'](_0x47f1ed['model'],_0x47f1ed[_0x898a('0x33')]);_0x4b3e68[_0x898a('0x36')]=_[_0x898a('0x37')](_0x47f1ed['model'],qs[_0x898a('0x38')](_0xd31922[_0x898a('0x33')][_0x898a('0x38')]));_0x4b3e68[_0x898a('0x36')]=_0x4b3e68[_0x898a('0x36')][_0x898a('0x39')]?_0x4b3e68[_0x898a('0x36')]:_0x47f1ed[_0x898a('0x30')];if(!_0xd31922['query'][_0x898a('0x3a')]('nolimit')){_0x4b3e68['limit']=qs[_0x898a('0x3b')](_0xd31922['query'][_0x898a('0x3b')]);_0x4b3e68['offset']=qs[_0x898a('0x1e')](_0xd31922['query'][_0x898a('0x1e')]);}_0x4b3e68[_0x898a('0x3c')]=qs[_0x898a('0x3d')](_0xd31922['query']['sort']);_0x4b3e68['where']=qs[_0x898a('0x35')](_[_0x898a('0x3e')](_0xd31922['query'],_0x47f1ed[_0x898a('0x35')]),_0x62fe93);if(_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]){_0x4b3e68[_0x898a('0x40')]=_['merge'](_0x4b3e68['where'],{'$or':_[_0x898a('0x2a')](_0x62fe93,function(_0x454c8c){if(_0x454c8c['type']!=='VIRTUAL'){var _0x168f92={};_0x168f92[_0x454c8c[_0x898a('0x27')]]={'$like':'%'+_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]+'%'};return _0x168f92;}})});}_0x4b3e68=_['merge']({},_0x4b3e68,_0xd31922[_0x898a('0x41')]);var _0x369c02={'where':_0x4b3e68['where']};return db['ScreenRecording']['count'](_0x369c02)[_0x898a('0x23')](function(_0x477a9d){_0xe9c33d[_0x898a('0x1d')]=_0x477a9d;if(_0xd31922[_0x898a('0x33')][_0x898a('0x42')]){_0x4b3e68[_0x898a('0x43')]=[{'all':!![]}];}return db[_0x898a('0x2b')][_0x898a('0x44')](_0x4b3e68);})[_0x898a('0x23')](function(_0x235fcf){_0xe9c33d[_0x898a('0x45')]=_0x235fcf;return _0xe9c33d;})[_0x898a('0x23')](respondWithFilteredResult(_0x58149d,_0x4b3e68))[_0x898a('0x46')](handleError(_0x58149d,null));};exports[_0x898a('0x47')]=function(_0x21f307,_0x4c8628){var _0x26ad34={'raw':![],'where':{'id':_0x21f307[_0x898a('0x48')]['id']}},_0x11c437={};_0x11c437['model']=_[_0x898a('0x34')](db[_0x898a('0x2b')][_0x898a('0x2c')]);_0x11c437[_0x898a('0x33')]=_[_0x898a('0x34')](_0x21f307[_0x898a('0x33')]);_0x11c437[_0x898a('0x35')]=_[_0x898a('0x37')](_0x11c437['model'],_0x11c437[_0x898a('0x33')]);_0x26ad34[_0x898a('0x36')]=_[_0x898a('0x37')](_0x11c437[_0x898a('0x30')],qs['fields'](_0x21f307[_0x898a('0x33')][_0x898a('0x38')]));_0x26ad34['attributes']=_0x26ad34[_0x898a('0x36')]['length']?_0x26ad34[_0x898a('0x36')]:_0x11c437['model'];if(_0x21f307['query'][_0x898a('0x42')]){_0x26ad34['include']=[{'all':!![]}];}_0x26ad34=_[_0x898a('0x49')]({},_0x26ad34,_0x21f307[_0x898a('0x41')]);return db['ScreenRecording'][_0x898a('0x4a')](_0x26ad34)[_0x898a('0x23')](handleEntityNotFound(_0x4c8628,null))['then'](respondWithResult(_0x4c8628,null))[_0x898a('0x46')](handleError(_0x4c8628,null));};exports[_0x898a('0x4b')]=function(_0x11a0a3,_0x118240){return db['ScreenRecording'][_0x898a('0x4b')](_0x11a0a3[_0x898a('0x4c')],{})['then'](respondWithResult(_0x118240,0xc9))[_0x898a('0x46')](handleError(_0x118240,null));};exports[_0x898a('0x22')]=function(_0x4ab441,_0x28525b){if(_0x4ab441['body']['id']){delete _0x4ab441[_0x898a('0x4c')]['id'];}delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4d')];delete _0x4ab441['body'][_0x898a('0x4e')];delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4f')];delete _0x4ab441[_0x898a('0x4c')]['value'];return db[_0x898a('0x2b')]['find']({'where':{'id':_0x4ab441[_0x898a('0x48')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x28525b,null))[_0x898a('0x23')](saveUpdates(_0x4ab441['body'],null))[_0x898a('0x23')](respondWithResult(_0x28525b,null))[_0x898a('0x46')](handleError(_0x28525b,null));};exports[_0x898a('0x50')]=function(_0x5d325a,_0x52f8c6){return db[_0x898a('0x2b')][_0x898a('0x50')]()[_0x898a('0x23')](respondWithResult(_0x52f8c6,null))[_0x898a('0x46')](handleError(_0x52f8c6,null));};exports[_0x898a('0x51')]=function(_0x36b63a,_0x369f33,_0x6c0f07){var _0x289167=require(_0x898a('0x52'));var _0x2382a9=![];var _0x5e9329={};if(_0x36b63a[_0x898a('0x33')][_0x898a('0x2e')]&&_0x36b63a['query'][_0x898a('0x2e')]==='uniqueid'){_0x5e9329['uniqueid']=_0x36b63a[_0x898a('0x48')]['id'];}else{_0x5e9329['id']=_0x36b63a[_0x898a('0x48')]['id'];}return db[_0x898a('0x2b')]['find']({'where':_0x5e9329,'attributes':['id','value'],'raw':!![]})[_0x898a('0x23')](handleEntityNotFound(_0x369f33,null))[_0x898a('0x23')](function(_0x515725){if(_0x515725){var _0xaa96f7=path[_0x898a('0x53')](config['root'],_0x898a('0x54'),_0x515725[_0x898a('0x55')]);var _0x3122cc=util['format'](_0x898a('0x56'),_0xaa96f7);if(fs[_0x898a('0x57')](_0x3122cc)){_0x2382a9=!![];return _0x289167[_0x898a('0x58')](_0x3122cc,_0xaa96f7,config[_0x898a('0x59')][_0x898a('0x5a')])[_0x898a('0x23')](function(){return _0x515725;});}return _0x515725;}})['then'](function(_0x22a08a){if(_0x22a08a){var _0x4df5f0=path[_0x898a('0x53')](config[_0x898a('0x5b')],_0x898a('0x54'),_0x22a08a[_0x898a('0x55')]);if(!fs[_0x898a('0x57')](_0x4df5f0)){throw new db[(_0x898a('0x5c'))][(_0x898a('0x5d'))](_0x898a('0x5e'));}if(_0x22a08a[_0x898a('0x5f')]){return _0x369f33['download'](_0x4df5f0,_0x22a08a[_0x898a('0x5f')]+path[_0x898a('0x60')](_0x4df5f0),function(){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}else{return _0x369f33[_0x898a('0x51')](_0x4df5f0,function(_0x219976){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}}})[_0x898a('0x46')](function(_0x68fd81){if(_0x68fd81[_0x898a('0x62')]===_0x898a('0x5e')){_0x369f33[_0x898a('0x1a')](0x194)[_0x898a('0x28')](_0x898a('0x63'));}else{return handleError(_0x369f33,null);}});};exports[_0x898a('0x24')]=function(_0x22f9ba,_0x5f42ae){return db[_0x898a('0x2b')][_0x898a('0x4a')]({'where':{'id':_0x22f9ba['params']['id']}})[_0x898a('0x23')](function(_0x4583a1){if(_['isNil'](_0x4583a1)){throw new ReferenceError(_0x898a('0x64'));}return _0x4583a1;})[_0x898a('0x23')](function(_0x21f0f8){var _0x1f3f5b=path['join'](config[_0x898a('0x5b')],_0x898a('0x54'),_0x21f0f8[_0x898a('0x55')]);logger[_0x898a('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x1f3f5b);if(!_[_0x898a('0x66')](_0x21f0f8[_0x898a('0x55')])&&fs['existsSync'](_0x1f3f5b)){logger[_0x898a('0x65')](_0x898a('0x67')+_0x1f3f5b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x898a('0x68')](_0x1f3f5b);}_0x1f3f5b=_0x1f3f5b+'.cypher';if(!_[_0x898a('0x66')](_0x21f0f8['value'])&&fs['existsSync'](_0x1f3f5b)){logger['info'](_0x898a('0x67')+_0x1f3f5b+_0x898a('0x69'));fs[_0x898a('0x68')](_0x1f3f5b);}return _0x21f0f8;})[_0x898a('0x23')](function(_0x5e0535){if(!_0x5e0535)throw new InternalError();return _0x5e0535['destroy']();})[_0x898a('0x23')](function(){_0x5f42ae[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();})[_0x898a('0x46')](handleError(_0x5f42ae,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 12decbc..a0b2ea8 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 _0x73b5=['rimraf','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','path'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x73b5,0x19c));var _0x573b=function(_0x44d8f3,_0x45af3c){_0x44d8f3=_0x44d8f3-0x0;var _0x14d137=_0x73b5[_0x44d8f3];return _0x14d137;};'use strict';var _=require(_0x573b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x573b('0x1'));var rimraf=require(_0x573b('0x2'));var config=require(_0x573b('0x3'));var attributes=require(_0x573b('0x4'));module[_0x573b('0x5')]=function(_0x4f2ff6,_0x40baa0){return _0x4f2ff6[_0x573b('0x6')]('ScreenRecording',attributes,{'tableName':_0x573b('0x7'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x573b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a51=['../../config/logger','request-promise','rimraf','../../config/environment','exports','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x4536a4,_0x55af7b){var _0x4fd1c1=function(_0x4c68cd){while(--_0x4c68cd){_0x4536a4['push'](_0x4536a4['shift']());}};_0x4fd1c1(++_0x55af7b);}(_0x4a51,0xbd));var _0x14a5=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x4a51[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x14a5('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x14a5('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x14a5('0x2'));var config=require(_0x14a5('0x3'));var attributes=require('./screenRecording.attributes');module[_0x14a5('0x4')]=function(_0x391ad1,_0xb1899){return _0x391ad1[_0x14a5('0x5')](_0x14a5('0x6'),attributes,{'tableName':_0x14a5('0x7'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x14a5('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index ce1ddc1..fe8e5e6 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 _0x7182=['code','message','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x43cdc9,_0x35df2a){var _0x2933e0=function(_0x480a54){while(--_0x480a54){_0x43cdc9['push'](_0x43cdc9['shift']());}};_0x2933e0(++_0x35df2a);}(_0x7182,0xf9));var _0x2718=function(_0x48fdeb,_0x16b150){_0x48fdeb=_0x48fdeb-0x0;var _0x311289=_0x7182[_0x48fdeb];return _0x311289;};'use strict';var _=require('lodash');var util=require(_0x2718('0x0'));var moment=require(_0x2718('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2718('0x2'));var db=require(_0x2718('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2718('0x4'))('rpc');var config=require(_0x2718('0x5'));var jayson=require(_0x2718('0x6'));var client=jayson['client'][_0x2718('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x27b2c9,_0x34756b,_0x5729a5){return new BPromise(function(_0x2aff71,_0x57578f){return client[_0x2718('0x8')](_0x27b2c9,_0x5729a5)[_0x2718('0x9')](function(_0x42ba7a){logger[_0x2718('0xa')](_0x2718('0xb'),_0x34756b,_0x2718('0xc'));logger[_0x2718('0xd')](_0x2718('0xe'),_0x34756b,_0x2718('0xc'),JSON[_0x2718('0xf')](_0x42ba7a));if(_0x42ba7a[_0x2718('0x10')]){if(_0x42ba7a[_0x2718('0x10')][_0x2718('0x11')]===0x1f4){logger['error'](_0x2718('0xb'),_0x34756b,_0x42ba7a[_0x2718('0x10')][_0x2718('0x12')]);return _0x57578f(_0x42ba7a[_0x2718('0x10')][_0x2718('0x12')]);}logger[_0x2718('0x10')](_0x2718('0xb'),_0x34756b,_0x42ba7a[_0x2718('0x10')][_0x2718('0x12')]);return _0x2aff71(_0x42ba7a[_0x2718('0x10')]['message']);}else{logger[_0x2718('0xa')](_0x2718('0xb'),_0x34756b,_0x2718('0xc'));_0x2aff71(_0x42ba7a['result'][_0x2718('0x12')]);}})['catch'](function(_0x41ad8a){logger[_0x2718('0x10')](_0x2718('0xb'),_0x34756b,_0x41ad8a);_0x57578f(_0x41ad8a);});});} \ No newline at end of file +var _0xab1e=['../../config/environment','jayson/promise','client','http','request','then','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','../../config/logger'];(function(_0x10f117,_0x1a8eeb){var _0x53c77b=function(_0x1c6f55){while(--_0x1c6f55){_0x10f117['push'](_0x10f117['shift']());}};_0x53c77b(++_0x1a8eeb);}(_0xab1e,0x18d));var _0xeab1=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xab1e[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xeab1('0x0'));var util=require(_0xeab1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeab1('0x2'))('rpc');var config=require(_0xeab1('0x3'));var jayson=require(_0xeab1('0x4'));var client=jayson[_0xeab1('0x5')][_0xeab1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xa98409,_0x695f1,_0x1f5758){return new BPromise(function(_0xaac4f8,_0x3bebe7){return client[_0xeab1('0x7')](_0xa98409,_0x1f5758)[_0xeab1('0x8')](function(_0xbb9802){logger['info'](_0xeab1('0x9'),_0x695f1,'request\x20sent');logger[_0xeab1('0xa')](_0xeab1('0xb'),_0x695f1,_0xeab1('0xc'),JSON[_0xeab1('0xd')](_0xbb9802));if(_0xbb9802['error']){if(_0xbb9802[_0xeab1('0xe')][_0xeab1('0xf')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x695f1,_0xbb9802[_0xeab1('0xe')][_0xeab1('0x10')]);return _0x3bebe7(_0xbb9802[_0xeab1('0xe')][_0xeab1('0x10')]);}logger[_0xeab1('0xe')](_0xeab1('0x9'),_0x695f1,_0xbb9802[_0xeab1('0xe')][_0xeab1('0x10')]);return _0xaac4f8(_0xbb9802[_0xeab1('0xe')][_0xeab1('0x10')]);}else{logger[_0xeab1('0x11')](_0xeab1('0x9'),_0x695f1,_0xeab1('0xc'));_0xaac4f8(_0xbb9802[_0xeab1('0x12')][_0xeab1('0x10')]);}})[_0xeab1('0x13')](function(_0x4fd826){logger[_0xeab1('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x695f1,_0x4fd826);_0x3bebe7(_0x4fd826);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index c2c409f..8c8450e 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 _0x0864=['gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','format','%s%s','logo','extname','originalname','post','file','addLogo','server/files/images/logos/','logologin','single','addLogoLogin','preferred','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr'];(function(_0x5007b5,_0x2f194c){var _0x2436ca=function(_0x5f05fd){while(--_0x5f05fd){_0x5007b5['push'](_0x5007b5['shift']());}};_0x2436ca(++_0x2f194c);}(_0x0864,0x188));var _0x4086=function(_0x3a3569,_0x136294){_0x3a3569=_0x3a3569-0x0;var _0x100f11=_0x0864[_0x3a3569];return _0x100f11;};'use strict';var multer=require(_0x4086('0x0'));var util=require(_0x4086('0x1'));var path=require(_0x4086('0x2'));var timeout=require('connect-timeout');var express=require(_0x4086('0x3'));var router=express[_0x4086('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4086('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4086('0x6'));var controller=require('./setting.controller');router[_0x4086('0x7')]('/',auth[_0x4086('0x8')](),controller[_0x4086('0x9')]);router[_0x4086('0x7')](_0x4086('0xa'),controller[_0x4086('0xb')]);router[_0x4086('0x7')](_0x4086('0xc'),controller[_0x4086('0xd')]);router[_0x4086('0x7')](_0x4086('0xe'),controller['getLogo']);router[_0x4086('0x7')](_0x4086('0xf'),controller[_0x4086('0x10')]);router[_0x4086('0x7')](_0x4086('0x11'),controller[_0x4086('0x12')]);router[_0x4086('0x7')](_0x4086('0x13'),controller[_0x4086('0x14')]);router[_0x4086('0x7')](_0x4086('0x15'),controller['getFavicon']);var upload=multer({'storage':multer[_0x4086('0x16')]({'destination':function(_0x425a57,_0x195ba0,_0x3e9950){_0x3e9950(null,path[_0x4086('0x17')](config[_0x4086('0x18')],'server/files/images/logos/'));},'filename':function(_0x1ce9cf,_0x212738,_0x320082){_0x320082(null,util[_0x4086('0x19')](_0x4086('0x1a'),_0x4086('0x1b'),path[_0x4086('0x1c')](_0x212738[_0x4086('0x1d')])));}})});router[_0x4086('0x1e')](_0x4086('0xe'),upload['single'](_0x4086('0x1f')),controller[_0x4086('0x20')]);var upload=multer({'storage':multer[_0x4086('0x16')]({'destination':function(_0x195df3,_0xfcca39,_0x35d7be){_0x35d7be(null,path['join'](config['root'],_0x4086('0x21')));},'filename':function(_0x5740b9,_0x4c055d,_0x207a4f){_0x207a4f(null,util[_0x4086('0x19')]('%s%s',_0x4086('0x22'),path['extname'](_0x4c055d[_0x4086('0x1d')])));}})});router['post'](_0x4086('0xf'),upload[_0x4086('0x23')](_0x4086('0x1f')),controller[_0x4086('0x24')]);var upload=multer({'storage':multer[_0x4086('0x16')]({'destination':function(_0x4a7e97,_0x5926d8,_0x48eccc){_0x48eccc(null,path[_0x4086('0x17')](config[_0x4086('0x18')],'server/files/images/logos/'));},'filename':function(_0x44e9ac,_0x475d86,_0x51796a){_0x51796a(null,util[_0x4086('0x19')](_0x4086('0x1a'),_0x4086('0x25'),path[_0x4086('0x1c')](_0x475d86[_0x4086('0x1d')])));}})});router[_0x4086('0x1e')](_0x4086('0x13'),upload[_0x4086('0x23')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0x4086('0x16')]({'destination':function(_0x21fd9e,_0x45d911,_0x994823){_0x994823(null,path['join'](config[_0x4086('0x18')],'server/files/images/logos/'));},'filename':function(_0xcb06e3,_0x1fe04c,_0x1c6bad){_0x1c6bad(null,util[_0x4086('0x19')](_0x4086('0x1a'),'favicon',path[_0x4086('0x1c')](_0x1fe04c[_0x4086('0x1d')])));}})});router[_0x4086('0x1e')](_0x4086('0x15'),upload[_0x4086('0x23')](_0x4086('0x1f')),controller['addFavicon']);router[_0x4086('0x26')]('/:id',auth[_0x4086('0x8')](),controller[_0x4086('0x27')]);module[_0x4086('0x28')]=router; \ No newline at end of file +var _0x6de9=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/now','/:id','show','getLogo','getLogoLogin','gdpr','diskStorage','join','root','format','%s%s','logo','extname','originalname','single','file','post','/:id/logo_login','addLogoLogin','server/files/images/logos/','preferred','addPreferred','favicon','/:id/favicon','addFavicon','put','update'];(function(_0x23fbd3,_0xe98f8c){var _0x3cb9ee=function(_0x7d4025){while(--_0x7d4025){_0x23fbd3['push'](_0x23fbd3['shift']());}};_0x3cb9ee(++_0xe98f8c);}(_0x6de9,0x191));var _0x96de=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6de9[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x96de('0x0'));var util=require(_0x96de('0x1'));var path=require('path');var timeout=require(_0x96de('0x2'));var express=require(_0x96de('0x3'));var router=express[_0x96de('0x4')]();var fs_extra=require(_0x96de('0x5'));var auth=require(_0x96de('0x6'));var interaction=require(_0x96de('0x7'));var config=require(_0x96de('0x8'));var controller=require(_0x96de('0x9'));router[_0x96de('0xa')]('/',auth[_0x96de('0xb')](),controller['index']);router[_0x96de('0xa')](_0x96de('0xc'),controller['getDate']);router[_0x96de('0xa')](_0x96de('0xd'),controller[_0x96de('0xe')]);router[_0x96de('0xa')]('/:id/logo',controller[_0x96de('0xf')]);router[_0x96de('0xa')]('/:id/logo_login',controller[_0x96de('0x10')]);router[_0x96de('0xa')]('/:id/gdpr',controller[_0x96de('0x11')]);router[_0x96de('0xa')]('/:id/preferred',controller['getPreferred']);router[_0x96de('0xa')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0x96de('0x12')]({'destination':function(_0xf21fb4,_0x3f1fb6,_0x203386){_0x203386(null,path[_0x96de('0x13')](config[_0x96de('0x14')],'server/files/images/logos/'));},'filename':function(_0x321cc0,_0x13efc5,_0x20462b){_0x20462b(null,util[_0x96de('0x15')](_0x96de('0x16'),_0x96de('0x17'),path[_0x96de('0x18')](_0x13efc5[_0x96de('0x19')])));}})});router['post']('/:id/logo',upload[_0x96de('0x1a')](_0x96de('0x1b')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b72f0,_0x138db6,_0x22cc47){_0x22cc47(null,path[_0x96de('0x13')](config[_0x96de('0x14')],'server/files/images/logos/'));},'filename':function(_0x5c2d26,_0x3e8b0e,_0x1d23be){_0x1d23be(null,util[_0x96de('0x15')](_0x96de('0x16'),'logologin',path[_0x96de('0x18')](_0x3e8b0e['originalname'])));}})});router[_0x96de('0x1c')](_0x96de('0x1d'),upload[_0x96de('0x1a')]('file'),controller[_0x96de('0x1e')]);var upload=multer({'storage':multer[_0x96de('0x12')]({'destination':function(_0x69af77,_0x11204c,_0x2da196){_0x2da196(null,path['join'](config['root'],_0x96de('0x1f')));},'filename':function(_0x10c2fd,_0x300bb7,_0xbc79a8){_0xbc79a8(null,util[_0x96de('0x15')](_0x96de('0x16'),_0x96de('0x20'),path[_0x96de('0x18')](_0x300bb7[_0x96de('0x19')])));}})});router[_0x96de('0x1c')]('/:id/preferred',upload[_0x96de('0x1a')](_0x96de('0x1b')),controller[_0x96de('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x397521,_0x2b4eac,_0x279d53){_0x279d53(null,path[_0x96de('0x13')](config[_0x96de('0x14')],_0x96de('0x1f')));},'filename':function(_0x10d96a,_0xdebaf9,_0x4be19e){_0x4be19e(null,util[_0x96de('0x15')](_0x96de('0x16'),_0x96de('0x22'),path['extname'](_0xdebaf9[_0x96de('0x19')])));}})});router[_0x96de('0x1c')](_0x96de('0x23'),upload['single'](_0x96de('0x1b')),controller[_0x96de('0x24')]);router[_0x96de('0x25')](_0x96de('0xd'),auth[_0x96de('0xb')](),controller[_0x96de('0x26')]);module[_0x96de('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 508402c..d01d9b2 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 _0x5f2f=['INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','alternate','UNSIGNED','sequelize','exports'];(function(_0x16fcc1,_0x3320a8){var _0x3a930a=function(_0x150d6f){while(--_0x150d6f){_0x16fcc1['push'](_0x16fcc1['shift']());}};_0x3a930a(++_0x3320a8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x13a33f,_0x4c6994){_0x13a33f=_0x13a33f-0x0;var _0x44a275=_0x5f2f[_0x13a33f];return _0x44a275;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'min_internal':{'type':Sequelize[_0xf5f2('0x2')](0xb),'unique':_0xf5f2('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xf5f2('0x2')](0xb),'unique':_0xf5f2('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf5f2('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xf5f2('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xf5f2('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xf5f2('0x5')]},'turnaddr':{'type':Sequelize[_0xf5f2('0x5')]},'turnusername':{'type':Sequelize[_0xf5f2('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xf5f2('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':_0xf5f2('0x7')},'chatTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xf5f2('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xf5f2('0x2')]},'transcribeRegion':{'type':Sequelize[_0xf5f2('0x5')]},'sentiment':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xf5f2('0x2')]},'sentimentRegion':{'type':Sequelize[_0xf5f2('0x5')]},'language':{'type':Sequelize[_0xf5f2('0x5')]},'bucket':{'type':Sequelize[_0xf5f2('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xf5f2('0x2')](0x2)[_0xf5f2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xf5f2('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xf5f2('0x2')](0x2)[_0xf5f2('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x0b0e=['INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','sequelize'];(function(_0x34166c,_0x12b2af){var _0x16adc2=function(_0x5ac89b){while(--_0x5ac89b){_0x34166c['push'](_0x34166c['shift']());}};_0x16adc2(++_0x12b2af);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3a175b,_0x505d13){_0x3a175b=_0x3a175b-0x0;var _0x9b84fa=_0x0b0e[_0x3a175b];return _0x9b84fa;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xe0b0('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xe0b0('0x1')](0xb),'unique':_0xe0b0('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xe0b0('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':_0xe0b0('0x4')},'logo':{'type':Sequelize[_0xe0b0('0x3')]},'defaultLogo':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xe0b0('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xe0b0('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xe0b0('0x3')]},'turnaddr':{'type':Sequelize[_0xe0b0('0x3')]},'turnusername':{'type':Sequelize[_0xe0b0('0x3')]},'turnpassword':{'type':Sequelize[_0xe0b0('0x3')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':_0xe0b0('0x6')},'chatTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xe0b0('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xe0b0('0x3')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xe0b0('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xe0b0('0x3')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xe0b0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xe0b0('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xe0b0('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 80117cc..7d77dd5 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 _0x79e5=['rimraf','zip-dir','request-promise','moment','bluebird','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/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','Setting','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','update','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','custom','ValidationError','upperFirst','\x20not\x20found','download','defaultFavicon','default_loginLogo.svg','Sequelize','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x79e5,0x79));var _0x579e=function(_0x2b17e6,_0x5cd5ad){_0x2b17e6=_0x2b17e6-0x0;var _0x246aac=_0x79e5[_0x2b17e6];return _0x246aac;};'use strict';var emlformat=require(_0x579e('0x0'));var rimraf=require(_0x579e('0x1'));var zipdir=require(_0x579e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x579e('0x3'));var moment=require(_0x579e('0x4'));var BPromise=require(_0x579e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x579e('0x6'));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(_0x579e('0x7'));var squel=require(_0x579e('0x8'));var crypto=require(_0x579e('0x9'));var jsforce=require(_0x579e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x579e('0xb'));var querystring=require(_0x579e('0xc'));var Papa=require('papaparse');var Redis=require(_0x579e('0xd'));var authService=require(_0x579e('0xe'));var qs=require(_0x579e('0xf'));var as=require(_0x579e('0x10'));var hardwareService=require(_0x579e('0x11'));var logger=require(_0x579e('0x12'))(_0x579e('0x13'));var utils=require(_0x579e('0x14'));var config=require(_0x579e('0x15'));var licenseUtil=require(_0x579e('0x16'));var db=require(_0x579e('0x17'))['db'];var jayson=require(_0x579e('0x18'));var client=jayson[_0x579e('0x19')][_0x579e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xe45d7c,_0x16ddb6,_0x339cac,_0x3d84d0){return new BPromise(function(_0xdcb9fa,_0x1d712a){var _0x159767=_0x3d84d0||client;return _0x159767['request'](_0xe45d7c,_0x339cac)['then'](function(_0x52a897){logger['info'](_0x579e('0x1b'),_0x16ddb6,'request\x20sent');logger['debug'](_0x579e('0x1c'),_0x16ddb6,_0x579e('0x1d'),JSON[_0x579e('0x1e')](_0x52a897));if(_0x52a897[_0x579e('0x1f')]){if(_0x52a897[_0x579e('0x1f')][_0x579e('0x20')]===0x1f4){logger[_0x579e('0x1f')](_0x579e('0x1b'),_0x16ddb6,_0x52a897['error'][_0x579e('0x21')]);return _0x1d712a(_0x52a897[_0x579e('0x1f')]['message']);}logger['error'](_0x579e('0x1b'),_0x16ddb6,_0x52a897[_0x579e('0x1f')][_0x579e('0x21')]);return _0xdcb9fa(_0x52a897[_0x579e('0x1f')][_0x579e('0x21')]);}else{logger[_0x579e('0x22')]('Setting,\x20%s,\x20%s',_0x16ddb6,_0x579e('0x1d'));_0xdcb9fa(_0x52a897[_0x579e('0x23')][_0x579e('0x21')]);}})['catch'](function(_0x4e1faf){logger[_0x579e('0x1f')](_0x579e('0x1b'),_0x16ddb6,_0x4e1faf);_0x1d712a(_0x4e1faf);});});}function respondWithStatusCode(_0x3c24eb,_0x392750){_0x392750=_0x392750||0xcc;return function(_0x5766e5){if(_0x5766e5){return _0x3c24eb[_0x579e('0x24')](_0x392750);}return _0x3c24eb['status'](_0x392750)[_0x579e('0x25')]();};}function respondWithResult(_0x37f5c8,_0x540065){_0x540065=_0x540065||0xc8;return function(_0x1f874){if(_0x1f874){return _0x37f5c8[_0x579e('0x26')](_0x540065)[_0x579e('0x27')](_0x1f874);}};}function respondWithFilteredResult(_0x46c305,_0x3e6f55){return function(_0x345e79){if(_0x345e79){var _0xab79f0=typeof _0x3e6f55[_0x579e('0x28')]==='undefined'&&typeof _0x3e6f55[_0x579e('0x29')]===_0x579e('0x2a');var _0x2da33b=_0x345e79[_0x579e('0x2b')];var _0xf91d53=_0xab79f0?0x0:_0x3e6f55[_0x579e('0x28')];var _0x3a512e=_0xab79f0?_0x345e79[_0x579e('0x2b')]:_0x3e6f55['offset']+_0x3e6f55[_0x579e('0x29')];var _0x536fb7;if(_0x3a512e>=_0x2da33b){_0x3a512e=_0x2da33b;_0x536fb7=0xc8;}else{_0x536fb7=0xce;}_0x46c305[_0x579e('0x26')](_0x536fb7);return _0x46c305[_0x579e('0x2c')](_0x579e('0x2d'),_0xf91d53+'-'+_0x3a512e+'/'+_0x2da33b)[_0x579e('0x27')](_0x345e79);}return null;};}function patchUpdates(_0xc8d69){return function(_0x452423){try{jsonpatch[_0x579e('0x2e')](_0x452423,_0xc8d69,!![]);}catch(_0x542a7f){return BPromise[_0x579e('0x2f')](_0x542a7f);}return _0x452423[_0x579e('0x30')]();};}function saveUpdates(_0x531229,_0x98f151){return function(_0x23138f){if(_0x23138f){return _0x23138f['update'](_0x531229)[_0x579e('0x31')](function(_0x6ca2b8){return _0x6ca2b8;});}return null;};}function removeEntity(_0x1ea184,_0x4ee13d){return function(_0x4b38a5){if(_0x4b38a5){return _0x4b38a5[_0x579e('0x32')]()[_0x579e('0x31')](function(){_0x1ea184[_0x579e('0x26')](0xcc)[_0x579e('0x25')]();});}};}function handleEntityNotFound(_0x144e3a,_0x465509){return function(_0x2f6057){if(!_0x2f6057){_0x144e3a['sendStatus'](0x194);}return _0x2f6057;};}function handleError(_0x9f9562,_0x18bb47){_0x18bb47=_0x18bb47||0x1f4;return function(_0x33d060){logger[_0x579e('0x1f')](_0x33d060[_0x579e('0x33')]);if(_0x33d060[_0x579e('0x34')]){delete _0x33d060[_0x579e('0x34')];}_0x9f9562[_0x579e('0x26')](_0x18bb47)[_0x579e('0x35')](_0x33d060);};}exports['index']=function(_0x1e9764,_0x2caa25){var _0x853791={},_0x4287ee={},_0x2cdc79={'count':0x0,'rows':[]};var _0x68acf6=_[_0x579e('0x36')](db[_0x579e('0x37')][_0x579e('0x38')],function(_0x5a4916){return{'name':_0x5a4916[_0x579e('0x39')],'type':_0x5a4916[_0x579e('0x3a')]['key']};});_0x4287ee[_0x579e('0x3b')]=_[_0x579e('0x36')](_0x68acf6,'name');_0x4287ee[_0x579e('0x3c')]=_[_0x579e('0x3d')](_0x1e9764[_0x579e('0x3c')]);_0x4287ee[_0x579e('0x3e')]=_[_0x579e('0x3f')](_0x4287ee[_0x579e('0x3b')],_0x4287ee[_0x579e('0x3c')]);_0x853791[_0x579e('0x40')]=_[_0x579e('0x3f')](_0x4287ee[_0x579e('0x3b')],qs[_0x579e('0x41')](_0x1e9764[_0x579e('0x3c')][_0x579e('0x41')]));_0x853791['attributes']=_0x853791[_0x579e('0x40')][_0x579e('0x42')]?_0x853791[_0x579e('0x40')]:_0x4287ee['model'];if(!_0x1e9764[_0x579e('0x3c')]['hasOwnProperty'](_0x579e('0x43'))){_0x853791[_0x579e('0x29')]=qs[_0x579e('0x29')](_0x1e9764[_0x579e('0x3c')][_0x579e('0x29')]);_0x853791['offset']=qs[_0x579e('0x28')](_0x1e9764[_0x579e('0x3c')][_0x579e('0x28')]);}_0x853791[_0x579e('0x44')]=qs['sort'](_0x1e9764[_0x579e('0x3c')][_0x579e('0x45')]);_0x853791['where']=qs['filters'](_[_0x579e('0x46')](_0x1e9764[_0x579e('0x3c')],_0x4287ee[_0x579e('0x3e')]),_0x68acf6);if(_0x1e9764[_0x579e('0x3c')][_0x579e('0x47')]){_0x853791[_0x579e('0x48')]=_[_0x579e('0x49')](_0x853791['where'],{'$or':_[_0x579e('0x36')](_0x68acf6,function(_0xbde074){if(_0xbde074[_0x579e('0x3a')]!==_0x579e('0x4a')){var _0xa1b8fa={};_0xa1b8fa[_0xbde074[_0x579e('0x34')]]={'$like':'%'+_0x1e9764[_0x579e('0x3c')][_0x579e('0x47')]+'%'};return _0xa1b8fa;}})});}_0x853791=_[_0x579e('0x49')]({},_0x853791,_0x1e9764[_0x579e('0x4b')]);var _0x51d19={'where':_0x853791[_0x579e('0x48')]};return db[_0x579e('0x37')][_0x579e('0x2b')](_0x51d19)['then'](function(_0x207128){_0x2cdc79['count']=_0x207128;if(_0x1e9764[_0x579e('0x3c')]['includeAll']){_0x853791[_0x579e('0x4c')]=[{'all':!![]}];}return db[_0x579e('0x37')][_0x579e('0x4d')](_0x853791);})[_0x579e('0x31')](function(_0x1011c9){_0x2cdc79[_0x579e('0x4e')]=_0x1011c9;return _0x2cdc79;})[_0x579e('0x31')](respondWithFilteredResult(_0x2caa25,_0x853791))[_0x579e('0x4f')](handleError(_0x2caa25,null));};exports[_0x579e('0x50')]=function(_0x45fa06,_0x4499c6){var _0x3e8cdd={'raw':![],'where':{'id':_0x45fa06[_0x579e('0x51')]['id']}},_0x4277e8={};_0x4277e8[_0x579e('0x3b')]=_[_0x579e('0x3d')](db[_0x579e('0x37')][_0x579e('0x38')]);_0x4277e8[_0x579e('0x3c')]=_['keys'](_0x45fa06[_0x579e('0x3c')]);_0x4277e8['filters']=_[_0x579e('0x3f')](_0x4277e8[_0x579e('0x3b')],_0x4277e8[_0x579e('0x3c')]);_0x3e8cdd[_0x579e('0x40')]=_[_0x579e('0x3f')](_0x4277e8[_0x579e('0x3b')],qs[_0x579e('0x41')](_0x45fa06[_0x579e('0x3c')][_0x579e('0x41')]));_0x3e8cdd[_0x579e('0x40')]=_0x3e8cdd['attributes'][_0x579e('0x42')]?_0x3e8cdd[_0x579e('0x40')]:_0x4277e8[_0x579e('0x3b')];if(_0x45fa06[_0x579e('0x3c')][_0x579e('0x52')]){_0x3e8cdd[_0x579e('0x4c')]=[{'all':!![]}];}_0x3e8cdd=_[_0x579e('0x49')]({},_0x3e8cdd,_0x45fa06[_0x579e('0x4b')]);return db[_0x579e('0x37')][_0x579e('0x53')](_0x3e8cdd)['then'](handleEntityNotFound(_0x4499c6,null))[_0x579e('0x31')](respondWithResult(_0x4499c6,null))[_0x579e('0x4f')](handleError(_0x4499c6,null));};exports[_0x579e('0x54')]=function(_0x4ce021,_0x10f119){if(_0x4ce021[_0x579e('0x55')]['id']){delete _0x4ce021[_0x579e('0x55')]['id'];}return db['Setting']['find']({'where':{'id':_0x4ce021[_0x579e('0x51')]['id']}})['then'](handleEntityNotFound(_0x10f119,null))[_0x579e('0x31')](saveUpdates(_0x4ce021['body'],null))['then'](respondWithResult(_0x10f119,null))['catch'](handleError(_0x10f119,null));};exports[_0x579e('0x56')]=function(_0x531d51,_0x2950ce,_0x3acdb2){if(_0x531d51[_0x579e('0x57')]&&_0x531d51[_0x579e('0x57')][_0x579e('0x58')]){_0x531d51['body'][_0x579e('0x59')]=_0x531d51[_0x579e('0x57')]['filename'];}return db[_0x579e('0x37')][_0x579e('0x53')]({'where':{'id':_0x531d51[_0x579e('0x51')]['id']}})[_0x579e('0x31')](handleEntityNotFound(_0x2950ce,null))[_0x579e('0x31')](saveUpdates(_0x531d51[_0x579e('0x55')],null))[_0x579e('0x31')](respondWithResult(_0x2950ce,null))[_0x579e('0x4f')](handleError(_0x2950ce,null));};exports[_0x579e('0x5a')]=function(_0x2d31ba,_0x837a53,_0x1f2417){if(_0x2d31ba['file']&&_0x2d31ba['file'][_0x579e('0x58')]){_0x2d31ba['body'][_0x579e('0x5b')]=_0x2d31ba[_0x579e('0x57')][_0x579e('0x58')];}return db[_0x579e('0x37')][_0x579e('0x53')]({'where':{'id':_0x2d31ba['params']['id']}})[_0x579e('0x31')](handleEntityNotFound(_0x837a53,null))['then'](saveUpdates(_0x2d31ba['body'],null))[_0x579e('0x31')](respondWithResult(_0x837a53,null))['catch'](handleError(_0x837a53,null));};var utilLicense=require(_0x579e('0x16'));exports['getLogo']=function(_0x565fc5,_0x5a8f68,_0x91a04a){var _0x46d446=_0x579e('0x5c');var _0x15fcc9={'custom':![]};return utilLicense[_0x579e('0x5d')]()['then'](function(_0x58953d){if(_0x58953d){_0x15fcc9=_0x58953d;}return db[_0x579e('0x37')][_0x579e('0x53')]({'where':{'id':_0x565fc5['params']['id']},'attributes':[_0x579e('0x59'),'loginLogo',_0x579e('0x5e'),_0x579e('0x5f'),_0x579e('0x60'),_0x579e('0x61'),_0x579e('0x62'),'defaultFavicon'],'raw':!![]});})[_0x579e('0x31')](handleEntityNotFound(_0x5a8f68,null))[_0x579e('0x31')](function(_0x20c397){if(_0x20c397){var _0x2aecb6=_0x20c397[_0x579e('0x59')]&&fs[_0x579e('0x63')](path[_0x579e('0x64')](config['root'],_0x46d446,_['toLower'](_0x20c397[_0x579e('0x59')])))?path[_0x579e('0x64')](config[_0x579e('0x65')],_0x46d446,_[_0x579e('0x66')](_0x20c397[_0x579e('0x59')])):path[_0x579e('0x64')](config['root'],_0x46d446,_[_0x579e('0x66')](_0x579e('0x67')));var _0x431a3e=_0x579e('0x68')+_['upperFirst']('logo');if(_0x20c397[_0x431a3e]||!_0x15fcc9[_0x579e('0x69')]){_0x2aecb6=path[_0x579e('0x64')](config[_0x579e('0x65')],_0x46d446,_[_0x579e('0x66')](_0x579e('0x67')));}if(!fs['existsSync'](_0x2aecb6)){throw new db['Sequelize'][(_0x579e('0x6a'))](_[_0x579e('0x6b')](_0x579e('0x59'))+_0x579e('0x6c'));}return _0x5a8f68[_0x579e('0x6d')](_0x2aecb6);}})[_0x579e('0x4f')](handleError(_0x5a8f68,null));};var utilLicense=require(_0x579e('0x16'));exports['getLogoLogin']=function(_0x5d834f,_0xefd5c2,_0x6e74ea){var _0x3b5db5=_0x579e('0x5c');var _0x4b1c0a={'custom':![]};return utilLicense[_0x579e('0x5d')]()[_0x579e('0x31')](function(_0x2b4736){if(_0x2b4736){_0x4b1c0a=_0x2b4736;}return db[_0x579e('0x37')][_0x579e('0x53')]({'where':{'id':_0x5d834f[_0x579e('0x51')]['id']},'attributes':['logo',_0x579e('0x5b'),_0x579e('0x5e'),'favicon',_0x579e('0x60'),'defaultLoginLogo',_0x579e('0x62'),_0x579e('0x6e')],'raw':!![]});})[_0x579e('0x31')](handleEntityNotFound(_0xefd5c2,null))[_0x579e('0x31')](function(_0x47d658){if(_0x47d658){var _0x3b2d76=_0x47d658[_0x579e('0x5b')]&&fs[_0x579e('0x63')](path[_0x579e('0x64')](config[_0x579e('0x65')],_0x3b5db5,_['toLower'](_0x47d658['loginLogo'])))?path['join'](config[_0x579e('0x65')],_0x3b5db5,_[_0x579e('0x66')](_0x47d658['loginLogo'])):path[_0x579e('0x64')](config['root'],_0x3b5db5,_[_0x579e('0x66')](_0x579e('0x6f')));var _0x71a47=_0x579e('0x68')+_[_0x579e('0x6b')](_0x579e('0x5b'));if(_0x47d658[_0x71a47]||!_0x4b1c0a[_0x579e('0x69')]){_0x3b2d76=path[_0x579e('0x64')](config['root'],_0x3b5db5,_[_0x579e('0x66')](_0x579e('0x6f')));}if(!fs['existsSync'](_0x3b2d76)){throw new db[(_0x579e('0x70'))][(_0x579e('0x6a'))](_[_0x579e('0x6b')](_0x579e('0x5b'))+_0x579e('0x6c'));}return _0xefd5c2[_0x579e('0x6d')](_0x3b2d76);}})[_0x579e('0x4f')](handleError(_0xefd5c2,null));};exports['gdpr']=function(_0x2c6e60,_0x14d4ae){return db[_0x579e('0x37')][_0x579e('0x53')]({'where':{'id':_0x2c6e60[_0x579e('0x51')]['id']},'attributes':['securePassword']})[_0x579e('0x31')](respondWithResult(_0x14d4ae,null))['catch'](handleError(_0x14d4ae,null));};exports[_0x579e('0x71')]=function(_0x2097a1,_0x18f18f,_0x21ad18){if(_0x2097a1[_0x579e('0x57')]&&_0x2097a1[_0x579e('0x57')][_0x579e('0x58')]){_0x2097a1['body'][_0x579e('0x5e')]=_0x2097a1['file']['filename'];}return db[_0x579e('0x37')]['find']({'where':{'id':_0x2097a1[_0x579e('0x51')]['id']}})['then'](handleEntityNotFound(_0x18f18f,null))[_0x579e('0x31')](saveUpdates(_0x2097a1[_0x579e('0x55')],null))['then'](respondWithResult(_0x18f18f,null))['catch'](handleError(_0x18f18f,null));};var utilLicense=require('../../config/license/util');exports[_0x579e('0x72')]=function(_0x1f720e,_0x5be127,_0x576654){var _0x19d02d=_0x579e('0x5c');var _0x49cc9f={'custom':![]};return utilLicense[_0x579e('0x5d')]()['then'](function(_0x846f65){if(_0x846f65){_0x49cc9f=_0x846f65;}return db[_0x579e('0x37')][_0x579e('0x53')]({'where':{'id':_0x1f720e['params']['id']},'attributes':[_0x579e('0x59'),_0x579e('0x5b'),_0x579e('0x5e'),_0x579e('0x5f'),_0x579e('0x60'),_0x579e('0x61'),_0x579e('0x62'),_0x579e('0x6e')],'raw':!![]});})[_0x579e('0x31')](handleEntityNotFound(_0x5be127,null))[_0x579e('0x31')](function(_0x5439f6){if(_0x5439f6){var _0x130cc4=_0x5439f6['preferred']&&fs[_0x579e('0x63')](path['join'](config[_0x579e('0x65')],_0x19d02d,_[_0x579e('0x66')](_0x5439f6[_0x579e('0x5e')])))?path['join'](config[_0x579e('0x65')],_0x19d02d,_[_0x579e('0x66')](_0x5439f6[_0x579e('0x5e')])):path['join'](config[_0x579e('0x65')],_0x19d02d,_['toLower'](_0x579e('0x73')));var _0x41004a='default'+_['upperFirst'](_0x579e('0x5e'));if(_0x5439f6[_0x41004a]||!_0x49cc9f[_0x579e('0x69')]||!_0x49cc9f[_0x579e('0x5e')]){_0x130cc4=path[_0x579e('0x64')](config[_0x579e('0x65')],_0x19d02d,_[_0x579e('0x66')](_0x579e('0x73')));}if(!fs[_0x579e('0x63')](_0x130cc4)){throw new db['Sequelize']['ValidationError'](_[_0x579e('0x6b')](_0x579e('0x5e'))+_0x579e('0x6c'));}return _0x5be127['download'](_0x130cc4);}})[_0x579e('0x4f')](handleError(_0x5be127,null));};exports[_0x579e('0x74')]=function(_0x361643,_0x3e5cab,_0x585d25){if(_0x361643['file']&&_0x361643[_0x579e('0x57')][_0x579e('0x58')]){_0x361643[_0x579e('0x55')][_0x579e('0x5f')]=_0x361643['file'][_0x579e('0x58')];}return db[_0x579e('0x37')][_0x579e('0x53')]({'where':{'id':_0x361643['params']['id']}})[_0x579e('0x31')](handleEntityNotFound(_0x3e5cab,null))[_0x579e('0x31')](saveUpdates(_0x361643['body'],null))['then'](respondWithResult(_0x3e5cab,null))[_0x579e('0x4f')](handleError(_0x3e5cab,null));};var utilLicense=require(_0x579e('0x16'));exports[_0x579e('0x75')]=function(_0x5345fc,_0x59dc93,_0x5b06bd){var _0x590ab3='server/files/images/logos';var _0x37933b={'custom':![]};return utilLicense['getLicense']()[_0x579e('0x31')](function(_0x14cd9d){if(_0x14cd9d){_0x37933b=_0x14cd9d;}return db['Setting'][_0x579e('0x53')]({'where':{'id':_0x5345fc[_0x579e('0x51')]['id']},'attributes':[_0x579e('0x59'),_0x579e('0x5b'),'preferred',_0x579e('0x5f'),_0x579e('0x60'),_0x579e('0x61'),_0x579e('0x62'),'defaultFavicon'],'raw':!![]});})[_0x579e('0x31')](handleEntityNotFound(_0x59dc93,null))[_0x579e('0x31')](function(_0x1253c0){if(_0x1253c0){var _0x578807=_0x1253c0[_0x579e('0x5f')]&&fs[_0x579e('0x63')](path[_0x579e('0x64')](config[_0x579e('0x65')],_0x590ab3,_['toLower'](_0x1253c0[_0x579e('0x5f')])))?path[_0x579e('0x64')](config[_0x579e('0x65')],_0x590ab3,_[_0x579e('0x66')](_0x1253c0[_0x579e('0x5f')])):path['join'](config[_0x579e('0x65')],_0x590ab3,_['toLower'](_0x579e('0x76')));var _0x1ea5d1='default'+_[_0x579e('0x6b')](_0x579e('0x5f'));if(_0x1253c0[_0x1ea5d1]||!_0x37933b[_0x579e('0x69')]){_0x578807=path[_0x579e('0x64')](config[_0x579e('0x65')],_0x590ab3,_[_0x579e('0x66')]('default_favicon.ico'));}if(!fs[_0x579e('0x63')](_0x578807)){throw new db[(_0x579e('0x70'))][(_0x579e('0x6a'))](_[_0x579e('0x6b')](_0x579e('0x5f'))+_0x579e('0x6c'));}return _0x59dc93['download'](_0x578807);}})[_0x579e('0x4f')](handleError(_0x59dc93,null));};exports['getDate']=function(_0x432633,_0x140487){var _0x51906e={'offset':moment()[_0x579e('0x77')]()};_0x51906e['now']=moment()[_0x579e('0x77')](_0x51906e[_0x579e('0x28')])[_0x579e('0x78')](_0x579e('0x79'));return _0x140487[_0x579e('0x26')](0xc8)[_0x579e('0x35')](_0x51906e);}; \ No newline at end of file +var _0xb000=['length','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','find','body','catch','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultFavicon','default_loginLogo.svg','custom','gdpr','securePassword','addPreferred','preferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','stack','name','send','index','Setting','fieldName','type','key','model','map','keys','filters','intersection','query','fields'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xb000,0x1a7));var _0x0b00=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0xb000[_0x3b7b8a];return _0x441206;};'use strict';var emlformat=require(_0x0b00('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b00('0x1'));var jsonpatch=require(_0x0b00('0x2'));var rp=require('request-promise');var moment=require(_0x0b00('0x3'));var BPromise=require(_0x0b00('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0b00('0x5'));var sox=require(_0x0b00('0x6'));var csv=require(_0x0b00('0x7'));var ejs=require(_0x0b00('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b00('0x9'));var squel=require(_0x0b00('0xa'));var crypto=require(_0x0b00('0xb'));var jsforce=require(_0x0b00('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0b00('0xd'));var Papa=require(_0x0b00('0xe'));var Redis=require(_0x0b00('0xf'));var authService=require(_0x0b00('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0b00('0x11'));var hardwareService=require(_0x0b00('0x12'));var logger=require(_0x0b00('0x13'))(_0x0b00('0x14'));var utils=require(_0x0b00('0x15'));var config=require(_0x0b00('0x16'));var licenseUtil=require(_0x0b00('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0b00('0x18'));var client=jayson[_0x0b00('0x19')][_0x0b00('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5f32e7,_0x1807e8,_0x342524,_0x1fb394){return new BPromise(function(_0x32a482,_0x18fe50){var _0x3b2d26=_0x1fb394||client;return _0x3b2d26[_0x0b00('0x1b')](_0x5f32e7,_0x342524)[_0x0b00('0x1c')](function(_0x3e2a15){logger[_0x0b00('0x1d')](_0x0b00('0x1e'),_0x1807e8,_0x0b00('0x1f'));logger[_0x0b00('0x20')](_0x0b00('0x21'),_0x1807e8,_0x0b00('0x1f'),JSON[_0x0b00('0x22')](_0x3e2a15));if(_0x3e2a15[_0x0b00('0x23')]){if(_0x3e2a15[_0x0b00('0x23')]['code']===0x1f4){logger[_0x0b00('0x23')](_0x0b00('0x1e'),_0x1807e8,_0x3e2a15[_0x0b00('0x23')][_0x0b00('0x24')]);return _0x18fe50(_0x3e2a15[_0x0b00('0x23')][_0x0b00('0x24')]);}logger[_0x0b00('0x23')](_0x0b00('0x1e'),_0x1807e8,_0x3e2a15['error'][_0x0b00('0x24')]);return _0x32a482(_0x3e2a15[_0x0b00('0x23')][_0x0b00('0x24')]);}else{logger[_0x0b00('0x1d')](_0x0b00('0x1e'),_0x1807e8,'request\x20sent');_0x32a482(_0x3e2a15['result']['message']);}})['catch'](function(_0x165566){logger['error'](_0x0b00('0x1e'),_0x1807e8,_0x165566);_0x18fe50(_0x165566);});});}function respondWithStatusCode(_0x2b459e,_0x5cff7e){_0x5cff7e=_0x5cff7e||0xcc;return function(_0x253d0e){if(_0x253d0e){return _0x2b459e[_0x0b00('0x25')](_0x5cff7e);}return _0x2b459e['status'](_0x5cff7e)[_0x0b00('0x26')]();};}function respondWithResult(_0x2864f9,_0x53c664){_0x53c664=_0x53c664||0xc8;return function(_0xf7e5e7){if(_0xf7e5e7){return _0x2864f9[_0x0b00('0x27')](_0x53c664)[_0x0b00('0x28')](_0xf7e5e7);}};}function respondWithFilteredResult(_0x2d655b,_0x1a6227){return function(_0x3492d3){if(_0x3492d3){var _0x4e3dae=typeof _0x1a6227[_0x0b00('0x29')]===_0x0b00('0x2a')&&typeof _0x1a6227[_0x0b00('0x2b')]===_0x0b00('0x2a');var _0x19127b=_0x3492d3['count'];var _0x46a26e=_0x4e3dae?0x0:_0x1a6227['offset'];var _0xa3676e=_0x4e3dae?_0x3492d3[_0x0b00('0x2c')]:_0x1a6227[_0x0b00('0x29')]+_0x1a6227[_0x0b00('0x2b')];var _0x413ff2;if(_0xa3676e>=_0x19127b){_0xa3676e=_0x19127b;_0x413ff2=0xc8;}else{_0x413ff2=0xce;}_0x2d655b['status'](_0x413ff2);return _0x2d655b[_0x0b00('0x2d')](_0x0b00('0x2e'),_0x46a26e+'-'+_0xa3676e+'/'+_0x19127b)[_0x0b00('0x28')](_0x3492d3);}return null;};}function patchUpdates(_0x4678b7){return function(_0x5b94bd){try{jsonpatch['apply'](_0x5b94bd,_0x4678b7,!![]);}catch(_0x542447){return BPromise[_0x0b00('0x2f')](_0x542447);}return _0x5b94bd['save']();};}function saveUpdates(_0x31b343,_0x32584a){return function(_0x1524d6){if(_0x1524d6){return _0x1524d6[_0x0b00('0x30')](_0x31b343)[_0x0b00('0x1c')](function(_0x100151){return _0x100151;});}return null;};}function removeEntity(_0x1e5196,_0x5c7bd3){return function(_0x57f3ee){if(_0x57f3ee){return _0x57f3ee[_0x0b00('0x31')]()[_0x0b00('0x1c')](function(){_0x1e5196[_0x0b00('0x27')](0xcc)[_0x0b00('0x26')]();});}};}function handleEntityNotFound(_0x15dd29,_0x93e0c9){return function(_0x581006){if(!_0x581006){_0x15dd29[_0x0b00('0x25')](0x194);}return _0x581006;};}function handleError(_0x381a5f,_0x36bd42){_0x36bd42=_0x36bd42||0x1f4;return function(_0x48a5ef){logger['error'](_0x48a5ef[_0x0b00('0x32')]);if(_0x48a5ef[_0x0b00('0x33')]){delete _0x48a5ef[_0x0b00('0x33')];}_0x381a5f[_0x0b00('0x27')](_0x36bd42)[_0x0b00('0x34')](_0x48a5ef);};}exports[_0x0b00('0x35')]=function(_0x504aa1,_0x53f75e){var _0x39d516={},_0xb3e5d0={},_0x115c71={'count':0x0,'rows':[]};var _0x541a12=_['map'](db[_0x0b00('0x36')]['rawAttributes'],function(_0x1c1617){return{'name':_0x1c1617[_0x0b00('0x37')],'type':_0x1c1617[_0x0b00('0x38')][_0x0b00('0x39')]};});_0xb3e5d0[_0x0b00('0x3a')]=_[_0x0b00('0x3b')](_0x541a12,_0x0b00('0x33'));_0xb3e5d0['query']=_[_0x0b00('0x3c')](_0x504aa1['query']);_0xb3e5d0[_0x0b00('0x3d')]=_[_0x0b00('0x3e')](_0xb3e5d0[_0x0b00('0x3a')],_0xb3e5d0[_0x0b00('0x3f')]);_0x39d516['attributes']=_[_0x0b00('0x3e')](_0xb3e5d0[_0x0b00('0x3a')],qs['fields'](_0x504aa1[_0x0b00('0x3f')][_0x0b00('0x40')]));_0x39d516['attributes']=_0x39d516['attributes'][_0x0b00('0x41')]?_0x39d516[_0x0b00('0x42')]:_0xb3e5d0[_0x0b00('0x3a')];if(!_0x504aa1[_0x0b00('0x3f')][_0x0b00('0x43')](_0x0b00('0x44'))){_0x39d516[_0x0b00('0x2b')]=qs[_0x0b00('0x2b')](_0x504aa1[_0x0b00('0x3f')][_0x0b00('0x2b')]);_0x39d516[_0x0b00('0x29')]=qs[_0x0b00('0x29')](_0x504aa1['query']['offset']);}_0x39d516['order']=qs[_0x0b00('0x45')](_0x504aa1['query'][_0x0b00('0x45')]);_0x39d516[_0x0b00('0x46')]=qs['filters'](_['pick'](_0x504aa1['query'],_0xb3e5d0['filters']),_0x541a12);if(_0x504aa1[_0x0b00('0x3f')][_0x0b00('0x47')]){_0x39d516[_0x0b00('0x46')]=_[_0x0b00('0x48')](_0x39d516[_0x0b00('0x46')],{'$or':_[_0x0b00('0x3b')](_0x541a12,function(_0x13605b){if(_0x13605b['type']!==_0x0b00('0x49')){var _0x34101e={};_0x34101e[_0x13605b[_0x0b00('0x33')]]={'$like':'%'+_0x504aa1[_0x0b00('0x3f')][_0x0b00('0x47')]+'%'};return _0x34101e;}})});}_0x39d516=_[_0x0b00('0x48')]({},_0x39d516,_0x504aa1[_0x0b00('0x4a')]);var _0x1a621a={'where':_0x39d516[_0x0b00('0x46')]};return db[_0x0b00('0x36')]['count'](_0x1a621a)[_0x0b00('0x1c')](function(_0x1a9f00){_0x115c71[_0x0b00('0x2c')]=_0x1a9f00;if(_0x504aa1[_0x0b00('0x3f')][_0x0b00('0x4b')]){_0x39d516['include']=[{'all':!![]}];}return db[_0x0b00('0x36')][_0x0b00('0x4c')](_0x39d516);})[_0x0b00('0x1c')](function(_0x47d48f){_0x115c71['rows']=_0x47d48f;return _0x115c71;})[_0x0b00('0x1c')](respondWithFilteredResult(_0x53f75e,_0x39d516))['catch'](handleError(_0x53f75e,null));};exports[_0x0b00('0x4d')]=function(_0x11ef21,_0x537c7c){var _0x4f7102={'raw':![],'where':{'id':_0x11ef21[_0x0b00('0x4e')]['id']}},_0x518c68={};_0x518c68[_0x0b00('0x3a')]=_[_0x0b00('0x3c')](db[_0x0b00('0x36')][_0x0b00('0x4f')]);_0x518c68[_0x0b00('0x3f')]=_[_0x0b00('0x3c')](_0x11ef21[_0x0b00('0x3f')]);_0x518c68['filters']=_['intersection'](_0x518c68[_0x0b00('0x3a')],_0x518c68['query']);_0x4f7102[_0x0b00('0x42')]=_[_0x0b00('0x3e')](_0x518c68[_0x0b00('0x3a')],qs['fields'](_0x11ef21['query'][_0x0b00('0x40')]));_0x4f7102[_0x0b00('0x42')]=_0x4f7102[_0x0b00('0x42')][_0x0b00('0x41')]?_0x4f7102['attributes']:_0x518c68['model'];if(_0x11ef21[_0x0b00('0x3f')][_0x0b00('0x4b')]){_0x4f7102['include']=[{'all':!![]}];}_0x4f7102=_[_0x0b00('0x48')]({},_0x4f7102,_0x11ef21[_0x0b00('0x4a')]);return db['Setting'][_0x0b00('0x50')](_0x4f7102)[_0x0b00('0x1c')](handleEntityNotFound(_0x537c7c,null))[_0x0b00('0x1c')](respondWithResult(_0x537c7c,null))['catch'](handleError(_0x537c7c,null));};exports[_0x0b00('0x30')]=function(_0x4eb983,_0x365a58){if(_0x4eb983[_0x0b00('0x51')]['id']){delete _0x4eb983[_0x0b00('0x51')]['id'];}return db[_0x0b00('0x36')][_0x0b00('0x50')]({'where':{'id':_0x4eb983[_0x0b00('0x4e')]['id']}})[_0x0b00('0x1c')](handleEntityNotFound(_0x365a58,null))[_0x0b00('0x1c')](saveUpdates(_0x4eb983[_0x0b00('0x51')],null))['then'](respondWithResult(_0x365a58,null))[_0x0b00('0x52')](handleError(_0x365a58,null));};exports['addLogo']=function(_0x22652d,_0x4bb2d5,_0x383f1b){if(_0x22652d[_0x0b00('0x53')]&&_0x22652d['file'][_0x0b00('0x54')]){_0x22652d[_0x0b00('0x51')][_0x0b00('0x55')]=_0x22652d[_0x0b00('0x53')]['filename'];}return db[_0x0b00('0x36')][_0x0b00('0x50')]({'where':{'id':_0x22652d[_0x0b00('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4bb2d5,null))[_0x0b00('0x1c')](saveUpdates(_0x22652d['body'],null))[_0x0b00('0x1c')](respondWithResult(_0x4bb2d5,null))[_0x0b00('0x52')](handleError(_0x4bb2d5,null));};exports[_0x0b00('0x56')]=function(_0x56f848,_0x56698c,_0x2a1451){if(_0x56f848[_0x0b00('0x53')]&&_0x56f848['file']['filename']){_0x56f848[_0x0b00('0x51')][_0x0b00('0x57')]=_0x56f848[_0x0b00('0x53')][_0x0b00('0x54')];}return db[_0x0b00('0x36')][_0x0b00('0x50')]({'where':{'id':_0x56f848[_0x0b00('0x4e')]['id']}})[_0x0b00('0x1c')](handleEntityNotFound(_0x56698c,null))[_0x0b00('0x1c')](saveUpdates(_0x56f848[_0x0b00('0x51')],null))[_0x0b00('0x1c')](respondWithResult(_0x56698c,null))[_0x0b00('0x52')](handleError(_0x56698c,null));};var utilLicense=require(_0x0b00('0x17'));exports['getLogo']=function(_0x499e8f,_0x47d11c,_0x102b5e){var _0x16815c=_0x0b00('0x58');var _0x28c052={'custom':![]};return utilLicense[_0x0b00('0x59')]()[_0x0b00('0x1c')](function(_0x28eb0e){if(_0x28eb0e){_0x28c052=_0x28eb0e;}return db[_0x0b00('0x36')][_0x0b00('0x50')]({'where':{'id':_0x499e8f[_0x0b00('0x4e')]['id']},'attributes':[_0x0b00('0x55'),_0x0b00('0x57'),'preferred',_0x0b00('0x5a'),_0x0b00('0x5b'),_0x0b00('0x5c'),_0x0b00('0x5d'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x47d11c,null))[_0x0b00('0x1c')](function(_0x2de3fb){if(_0x2de3fb){var _0x3682cb=_0x2de3fb[_0x0b00('0x55')]&&fs[_0x0b00('0x5e')](path[_0x0b00('0x5f')](config['root'],_0x16815c,_['toLower'](_0x2de3fb[_0x0b00('0x55')])))?path[_0x0b00('0x5f')](config[_0x0b00('0x60')],_0x16815c,_[_0x0b00('0x61')](_0x2de3fb[_0x0b00('0x55')])):path['join'](config[_0x0b00('0x60')],_0x16815c,_[_0x0b00('0x61')](_0x0b00('0x62')));var _0x5c1379=_0x0b00('0x63')+_[_0x0b00('0x64')]('logo');if(_0x2de3fb[_0x5c1379]||!_0x28c052['custom']){_0x3682cb=path[_0x0b00('0x5f')](config[_0x0b00('0x60')],_0x16815c,_['toLower']('default_logo.svg'));}if(!fs['existsSync'](_0x3682cb)){throw new db[(_0x0b00('0x65'))][(_0x0b00('0x66'))](_[_0x0b00('0x64')](_0x0b00('0x55'))+_0x0b00('0x67'));}return _0x47d11c[_0x0b00('0x68')](_0x3682cb);}})[_0x0b00('0x52')](handleError(_0x47d11c,null));};var utilLicense=require('../../config/license/util');exports[_0x0b00('0x69')]=function(_0x44d57e,_0x22a525,_0x35339e){var _0x2643fa='server/files/images/logos';var _0x1f95bd={'custom':![]};return utilLicense[_0x0b00('0x59')]()[_0x0b00('0x1c')](function(_0x7fd49){if(_0x7fd49){_0x1f95bd=_0x7fd49;}return db[_0x0b00('0x36')][_0x0b00('0x50')]({'where':{'id':_0x44d57e[_0x0b00('0x4e')]['id']},'attributes':[_0x0b00('0x55'),_0x0b00('0x57'),'preferred','favicon',_0x0b00('0x5b'),_0x0b00('0x5c'),_0x0b00('0x5d'),_0x0b00('0x6a')],'raw':!![]});})[_0x0b00('0x1c')](handleEntityNotFound(_0x22a525,null))[_0x0b00('0x1c')](function(_0xde364c){if(_0xde364c){var _0x47149c=_0xde364c[_0x0b00('0x57')]&&fs[_0x0b00('0x5e')](path[_0x0b00('0x5f')](config[_0x0b00('0x60')],_0x2643fa,_[_0x0b00('0x61')](_0xde364c[_0x0b00('0x57')])))?path[_0x0b00('0x5f')](config[_0x0b00('0x60')],_0x2643fa,_['toLower'](_0xde364c[_0x0b00('0x57')])):path[_0x0b00('0x5f')](config[_0x0b00('0x60')],_0x2643fa,_[_0x0b00('0x61')](_0x0b00('0x6b')));var _0x3c2e19=_0x0b00('0x63')+_[_0x0b00('0x64')](_0x0b00('0x57'));if(_0xde364c[_0x3c2e19]||!_0x1f95bd[_0x0b00('0x6c')]){_0x47149c=path['join'](config[_0x0b00('0x60')],_0x2643fa,_[_0x0b00('0x61')]('default_loginLogo.svg'));}if(!fs[_0x0b00('0x5e')](_0x47149c)){throw new db[(_0x0b00('0x65'))]['ValidationError'](_['upperFirst'](_0x0b00('0x57'))+_0x0b00('0x67'));}return _0x22a525[_0x0b00('0x68')](_0x47149c);}})[_0x0b00('0x52')](handleError(_0x22a525,null));};exports[_0x0b00('0x6d')]=function(_0x889be,_0x5937c4){return db[_0x0b00('0x36')][_0x0b00('0x50')]({'where':{'id':_0x889be[_0x0b00('0x4e')]['id']},'attributes':[_0x0b00('0x6e')]})['then'](respondWithResult(_0x5937c4,null))[_0x0b00('0x52')](handleError(_0x5937c4,null));};exports[_0x0b00('0x6f')]=function(_0x467442,_0x29c619,_0x203eb3){if(_0x467442[_0x0b00('0x53')]&&_0x467442['file'][_0x0b00('0x54')]){_0x467442[_0x0b00('0x51')][_0x0b00('0x70')]=_0x467442[_0x0b00('0x53')][_0x0b00('0x54')];}return db[_0x0b00('0x36')]['find']({'where':{'id':_0x467442[_0x0b00('0x4e')]['id']}})[_0x0b00('0x1c')](handleEntityNotFound(_0x29c619,null))['then'](saveUpdates(_0x467442[_0x0b00('0x51')],null))[_0x0b00('0x1c')](respondWithResult(_0x29c619,null))['catch'](handleError(_0x29c619,null));};var utilLicense=require(_0x0b00('0x17'));exports[_0x0b00('0x71')]=function(_0x39c8ca,_0x28785a,_0x4d6959){var _0x34df28=_0x0b00('0x58');var _0x4cf486={'custom':![]};return utilLicense[_0x0b00('0x59')]()[_0x0b00('0x1c')](function(_0x26b989){if(_0x26b989){_0x4cf486=_0x26b989;}return db[_0x0b00('0x36')][_0x0b00('0x50')]({'where':{'id':_0x39c8ca['params']['id']},'attributes':[_0x0b00('0x55'),_0x0b00('0x57'),'preferred','favicon',_0x0b00('0x5b'),_0x0b00('0x5c'),'defaultPreferred',_0x0b00('0x6a')],'raw':!![]});})[_0x0b00('0x1c')](handleEntityNotFound(_0x28785a,null))[_0x0b00('0x1c')](function(_0x14b36a){if(_0x14b36a){var _0x24eb36=_0x14b36a[_0x0b00('0x70')]&&fs[_0x0b00('0x5e')](path[_0x0b00('0x5f')](config['root'],_0x34df28,_[_0x0b00('0x61')](_0x14b36a[_0x0b00('0x70')])))?path['join'](config[_0x0b00('0x60')],_0x34df28,_['toLower'](_0x14b36a[_0x0b00('0x70')])):path[_0x0b00('0x5f')](config[_0x0b00('0x60')],_0x34df28,_[_0x0b00('0x61')](_0x0b00('0x72')));var _0x457e13=_0x0b00('0x63')+_['upperFirst'](_0x0b00('0x70'));if(_0x14b36a[_0x457e13]||!_0x4cf486[_0x0b00('0x6c')]||!_0x4cf486['preferred']){_0x24eb36=path[_0x0b00('0x5f')](config[_0x0b00('0x60')],_0x34df28,_[_0x0b00('0x61')](_0x0b00('0x72')));}if(!fs[_0x0b00('0x5e')](_0x24eb36)){throw new db['Sequelize'][(_0x0b00('0x66'))](_['upperFirst'](_0x0b00('0x70'))+_0x0b00('0x67'));}return _0x28785a[_0x0b00('0x68')](_0x24eb36);}})[_0x0b00('0x52')](handleError(_0x28785a,null));};exports[_0x0b00('0x73')]=function(_0x29160d,_0x26eac4,_0x4ebe7b){if(_0x29160d[_0x0b00('0x53')]&&_0x29160d['file']['filename']){_0x29160d['body'][_0x0b00('0x5a')]=_0x29160d['file'][_0x0b00('0x54')];}return db[_0x0b00('0x36')][_0x0b00('0x50')]({'where':{'id':_0x29160d[_0x0b00('0x4e')]['id']}})[_0x0b00('0x1c')](handleEntityNotFound(_0x26eac4,null))[_0x0b00('0x1c')](saveUpdates(_0x29160d[_0x0b00('0x51')],null))[_0x0b00('0x1c')](respondWithResult(_0x26eac4,null))[_0x0b00('0x52')](handleError(_0x26eac4,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x3244c5,_0x576a2c,_0x2946ee){var _0x54b865=_0x0b00('0x58');var _0x1de9c4={'custom':![]};return utilLicense[_0x0b00('0x59')]()['then'](function(_0x167780){if(_0x167780){_0x1de9c4=_0x167780;}return db[_0x0b00('0x36')][_0x0b00('0x50')]({'where':{'id':_0x3244c5[_0x0b00('0x4e')]['id']},'attributes':['logo',_0x0b00('0x57'),'preferred',_0x0b00('0x5a'),_0x0b00('0x5b'),_0x0b00('0x5c'),_0x0b00('0x5d'),_0x0b00('0x6a')],'raw':!![]});})[_0x0b00('0x1c')](handleEntityNotFound(_0x576a2c,null))[_0x0b00('0x1c')](function(_0x2792be){if(_0x2792be){var _0x338b62=_0x2792be[_0x0b00('0x5a')]&&fs[_0x0b00('0x5e')](path[_0x0b00('0x5f')](config[_0x0b00('0x60')],_0x54b865,_[_0x0b00('0x61')](_0x2792be['favicon'])))?path['join'](config[_0x0b00('0x60')],_0x54b865,_[_0x0b00('0x61')](_0x2792be[_0x0b00('0x5a')])):path[_0x0b00('0x5f')](config[_0x0b00('0x60')],_0x54b865,_['toLower'](_0x0b00('0x74')));var _0x132037=_0x0b00('0x63')+_[_0x0b00('0x64')]('favicon');if(_0x2792be[_0x132037]||!_0x1de9c4[_0x0b00('0x6c')]){_0x338b62=path['join'](config['root'],_0x54b865,_[_0x0b00('0x61')](_0x0b00('0x74')));}if(!fs[_0x0b00('0x5e')](_0x338b62)){throw new db[(_0x0b00('0x65'))][(_0x0b00('0x66'))](_[_0x0b00('0x64')](_0x0b00('0x5a'))+_0x0b00('0x67'));}return _0x576a2c[_0x0b00('0x68')](_0x338b62);}})[_0x0b00('0x52')](handleError(_0x576a2c,null));};exports[_0x0b00('0x75')]=function(_0x32d261,_0x4402da){var _0x4d07a6={'offset':moment()[_0x0b00('0x76')]()};_0x4d07a6[_0x0b00('0x77')]=moment()['utcOffset'](_0x4d07a6[_0x0b00('0x29')])[_0x0b00('0x78')](_0x0b00('0x79'));return _0x4402da['status'](0xc8)[_0x0b00('0x34')](_0x4d07a6);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index a084200..4362d1b 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 _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x279368,_0x41c002){var _0x40b6d0=function(_0x493776){while(--_0x493776){_0x279368['push'](_0x279368['shift']());}};_0x40b6d0(++_0x41c002);}(_0x55ca,0x126));var _0xa55c=function(_0x1d291d,_0x17314a){_0x1d291d=_0x1d291d-0x0;var _0x44cc4e=_0x55ca[_0x1d291d];return _0x44cc4e;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x4c6ac8,_0x41369c){var _0x23d4ad=function(_0x5bc169){while(--_0x5bc169){_0x4c6ac8['push'](_0x4c6ac8['shift']());}};_0x23d4ad(++_0x41369c);}(_0xedd9,0xfc));var _0x9edd=function(_0x4f7105,_0x30abc6){_0x4f7105=_0x4f7105-0x0;var _0x345844=_0xedd9[_0x4f7105];return _0x345844;};'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 diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 63a12da..e24047c 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 _0xace2=['code','message','catch','ShowSetting','Setting','options','where','attributes','include','map','model','info','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x7f351a,_0x529c4c){var _0x43c2e8=function(_0x3400ce){while(--_0x3400ce){_0x7f351a['push'](_0x7f351a['shift']());}};_0x43c2e8(++_0x529c4c);}(_0xace2,0xa2));var _0x2ace=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0xace2[_0x218994];return _0x3f350b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2ace('0x0'));var BPromise=require(_0x2ace('0x1'));var rs=require(_0x2ace('0x2'));var fs=require('fs');var Redis=require(_0x2ace('0x3'));var db=require(_0x2ace('0x4'))['db'];var utils=require(_0x2ace('0x5'));var logger=require(_0x2ace('0x6'))(_0x2ace('0x7'));var config=require('../../config/environment');var jayson=require(_0x2ace('0x8'));var client=jayson[_0x2ace('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53616f,_0x22e534,_0x179a24){return new BPromise(function(_0x330b09,_0x2a2b14){return client[_0x2ace('0xa')](_0x53616f,_0x179a24)[_0x2ace('0xb')](function(_0x22b8f6){logger['info'](_0x2ace('0xc'),_0x22e534,_0x2ace('0xd'));logger[_0x2ace('0xe')](_0x2ace('0xf'),_0x22e534,_0x2ace('0xd'),JSON[_0x2ace('0x10')](_0x22b8f6));if(_0x22b8f6[_0x2ace('0x11')]){if(_0x22b8f6['error'][_0x2ace('0x12')]===0x1f4){logger[_0x2ace('0x11')]('Setting,\x20%s,\x20%s',_0x22e534,_0x22b8f6[_0x2ace('0x11')][_0x2ace('0x13')]);return _0x2a2b14(_0x22b8f6[_0x2ace('0x11')][_0x2ace('0x13')]);}logger[_0x2ace('0x11')]('Setting,\x20%s,\x20%s',_0x22e534,_0x22b8f6[_0x2ace('0x11')][_0x2ace('0x13')]);return _0x330b09(_0x22b8f6[_0x2ace('0x11')][_0x2ace('0x13')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x22e534,_0x2ace('0xd'));_0x330b09(_0x22b8f6['result'][_0x2ace('0x13')]);}})[_0x2ace('0x14')](function(_0x5ec323){logger[_0x2ace('0x11')]('Setting,\x20%s,\x20%s',_0x22e534,_0x5ec323);_0x2a2b14(_0x5ec323);});});}exports[_0x2ace('0x15')]=function(_0xcba9f7){var _0x81752c=this;return new Promise(function(_0x2b6248,_0x501a14){return db[_0x2ace('0x16')]['find']({'raw':_0xcba9f7['options']?_0xcba9f7[_0x2ace('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xcba9f7['options']?_0xcba9f7[_0x2ace('0x17')][_0x2ace('0x18')]||null:null,'attributes':_0xcba9f7[_0x2ace('0x17')]?_0xcba9f7[_0x2ace('0x17')][_0x2ace('0x19')]||null:null,'include':_0xcba9f7[_0x2ace('0x17')]?_0xcba9f7[_0x2ace('0x17')][_0x2ace('0x1a')]?_['map'](_0xcba9f7['options'][_0x2ace('0x1a')],function(_0x345350){return{'model':db[_0x345350['model']],'as':_0x345350['as'],'attributes':_0x345350[_0x2ace('0x19')],'include':_0x345350['include']?_[_0x2ace('0x1b')](_0x345350[_0x2ace('0x1a')],function(_0x3366a0){return{'model':db[_0x3366a0[_0x2ace('0x1c')]],'as':_0x3366a0['as'],'attributes':_0x3366a0['attributes'],'include':_0x3366a0[_0x2ace('0x1a')]?_['map'](_0x3366a0[_0x2ace('0x1a')],function(_0x2a7214){return{'model':db[_0x2a7214[_0x2ace('0x1c')]],'as':_0x2a7214['as'],'attributes':_0x2a7214['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ace('0xb')](function(_0x2dec28){logger[_0x2ace('0x1d')](_0x2ace('0x15'),_0xcba9f7);logger[_0x2ace('0xe')](_0x2ace('0x15'),_0xcba9f7,JSON[_0x2ace('0x10')](_0x2dec28));_0x2b6248(_0x2dec28);})[_0x2ace('0x14')](function(_0x48f82d){logger[_0x2ace('0x11')](_0x2ace('0x15'),_0x48f82d[_0x2ace('0x13')],_0xcba9f7);_0x501a14(_0x81752c['error'](0x1f4,_0x48f82d[_0x2ace('0x13')]));});});}; \ No newline at end of file +var _0x5db0=['rpc','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','find','options','where','attributes','include','map','model','ShowSetting','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x516961,_0x35b1fc){var _0x4a70ce=function(_0x2e8ef){while(--_0x2e8ef){_0x516961['push'](_0x516961['shift']());}};_0x4a70ce(++_0x35b1fc);}(_0x5db0,0xcb));var _0x05db=function(_0xc1de4b,_0xeae591){_0xc1de4b=_0xc1de4b-0x0;var _0x4cd36a=_0x5db0[_0xc1de4b];return _0x4cd36a;};'use strict';var _=require(_0x05db('0x0'));var util=require(_0x05db('0x1'));var moment=require(_0x05db('0x2'));var BPromise=require('bluebird');var rs=require(_0x05db('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05db('0x4'))['db'];var utils=require(_0x05db('0x5'));var logger=require(_0x05db('0x6'))(_0x05db('0x7'));var config=require('../../config/environment');var jayson=require(_0x05db('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1af753,_0x4a696c,_0x55b243){return new BPromise(function(_0x5e1b4f,_0x2b1958){return client[_0x05db('0x9')](_0x1af753,_0x55b243)[_0x05db('0xa')](function(_0x328cf4){logger[_0x05db('0xb')](_0x05db('0xc'),_0x4a696c,_0x05db('0xd'));logger[_0x05db('0xe')](_0x05db('0xf'),_0x4a696c,_0x05db('0xd'),JSON[_0x05db('0x10')](_0x328cf4));if(_0x328cf4['error']){if(_0x328cf4[_0x05db('0x11')][_0x05db('0x12')]===0x1f4){logger['error'](_0x05db('0xc'),_0x4a696c,_0x328cf4[_0x05db('0x11')][_0x05db('0x13')]);return _0x2b1958(_0x328cf4['error'][_0x05db('0x13')]);}logger[_0x05db('0x11')](_0x05db('0xc'),_0x4a696c,_0x328cf4[_0x05db('0x11')][_0x05db('0x13')]);return _0x5e1b4f(_0x328cf4[_0x05db('0x11')][_0x05db('0x13')]);}else{logger[_0x05db('0xb')](_0x05db('0xc'),_0x4a696c,_0x05db('0xd'));_0x5e1b4f(_0x328cf4[_0x05db('0x14')][_0x05db('0x13')]);}})[_0x05db('0x15')](function(_0x215190){logger['error'](_0x05db('0xc'),_0x4a696c,_0x215190);_0x2b1958(_0x215190);});});}exports['ShowSetting']=function(_0x3b65c7){var _0x4259ef=this;return new Promise(function(_0x1deea0,_0x1869e6){return db['Setting'][_0x05db('0x16')]({'raw':_0x3b65c7['options']?_0x3b65c7[_0x05db('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3b65c7[_0x05db('0x17')]?_0x3b65c7[_0x05db('0x17')][_0x05db('0x18')]||null:null,'attributes':_0x3b65c7['options']?_0x3b65c7['options'][_0x05db('0x19')]||null:null,'include':_0x3b65c7[_0x05db('0x17')]?_0x3b65c7[_0x05db('0x17')][_0x05db('0x1a')]?_[_0x05db('0x1b')](_0x3b65c7[_0x05db('0x17')][_0x05db('0x1a')],function(_0x5c2b61){return{'model':db[_0x5c2b61['model']],'as':_0x5c2b61['as'],'attributes':_0x5c2b61[_0x05db('0x19')],'include':_0x5c2b61[_0x05db('0x1a')]?_[_0x05db('0x1b')](_0x5c2b61[_0x05db('0x1a')],function(_0x2dc54){return{'model':db[_0x2dc54[_0x05db('0x1c')]],'as':_0x2dc54['as'],'attributes':_0x2dc54[_0x05db('0x19')],'include':_0x2dc54[_0x05db('0x1a')]?_[_0x05db('0x1b')](_0x2dc54[_0x05db('0x1a')],function(_0x12d6b3){return{'model':db[_0x12d6b3[_0x05db('0x1c')]],'as':_0x12d6b3['as'],'attributes':_0x12d6b3[_0x05db('0x19')]};}):[]};}):[]};}):[]:[]})[_0x05db('0xa')](function(_0x60ab35){logger[_0x05db('0xb')](_0x05db('0x1d'),_0x3b65c7);logger[_0x05db('0xe')](_0x05db('0x1d'),_0x3b65c7,JSON[_0x05db('0x10')](_0x60ab35));_0x1deea0(_0x60ab35);})[_0x05db('0x15')](function(_0x170973){logger[_0x05db('0x11')](_0x05db('0x1d'),_0x170973[_0x05db('0x13')],_0x3b65c7);_0x1869e6(_0x4259ef[_0x05db('0x11')](0x1f4,_0x170973['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index ad49b97..48d3939 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 _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0x2d3a7a,_0x546f6b){var _0x3974be=function(_0x58fff9){while(--_0x58fff9){_0x2d3a7a['push'](_0x2d3a7a['shift']());}};_0x3974be(++_0x546f6b);}(_0x6aa7,0x178));var _0x76aa=function(_0x30e7fc,_0x473f93){_0x30e7fc=_0x30e7fc-0x0;var _0x51d333=_0x6aa7[_0x30e7fc];return _0x51d333;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=router; \ No newline at end of file +var _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0x1787f8,_0xb87297){var _0x2b6c91=function(_0x36936c){while(--_0x36936c){_0x1787f8['push'](_0x1787f8['shift']());}};_0x2b6c91(++_0xb87297);}(_0x6aa7,0x178));var _0x76aa=function(_0x3936f0,_0x409f9a){_0x3936f0=_0x3936f0-0x0;var _0x3e1179=_0x6aa7[_0x3936f0];return _0x3e1179;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 67d7b5b..0a0c6ea 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 _0x2fb1=['skebby','connectel','clickatell','bandwidth','csc','infobip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','ENUM'];(function(_0x100402,_0x1b61cb){var _0x5d2d56=function(_0xf8898c){while(--_0xf8898c){_0x100402['push'](_0x100402['shift']());}};_0x5d2d56(++_0x1b61cb);}(_0x2fb1,0x13c));var _0x12fb=function(_0x39257a,_0x17f3ee){_0x39257a=_0x39257a-0x0;var _0x1f1c41=_0x2fb1[_0x39257a];return _0x1f1c41;};'use strict';var Sequelize=require(_0x12fb('0x0'));var rs=require(_0x12fb('0x1'));module['exports']={'name':{'type':Sequelize[_0x12fb('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x12fb('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x12fb('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x12fb('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x12fb('0x3')]('twilio',_0x12fb('0x4'),_0x12fb('0x5'),'clicksend','plivo',_0x12fb('0x6'),_0x12fb('0x7'),_0x12fb('0x8'),_0x12fb('0x9'),'intelepeer')},'accountSid':{'type':Sequelize[_0x12fb('0x2')]},'authId':{'type':Sequelize[_0x12fb('0x2')]},'authToken':{'type':Sequelize[_0x12fb('0x2')]},'smsMethod':{'type':Sequelize[_0x12fb('0x3')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x12fb('0x2')]},'applicationId':{'type':Sequelize[_0x12fb('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x12fb('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x12fb('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x12fb('0xa');}},'notificationSound':{'type':Sequelize[_0x12fb('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x12fb('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x12fb('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x12fb('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x12fb('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x12fb('0xc')],'comment':_0x12fb('0xd')},'mandatoryDisposition':{'type':Sequelize[_0x12fb('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x495666){if(!_0x495666)this[_0x12fb('0xe')]('mandatoryDispositionPauseId',null);this[_0x12fb('0xe')](_0x12fb('0xf'),_0x495666);}}}; \ No newline at end of file +var _0xa9fb=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','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'];(function(_0x2d9a44,_0x16bc00){var _0x5093df=function(_0x196402){while(--_0x196402){_0x2d9a44['push'](_0x2d9a44['shift']());}};_0x5093df(++_0x16bc00);}(_0xa9fb,0x1d0));var _0xba9f=function(_0x4511da,_0x481079){_0x4511da=_0x4511da-0x0;var _0x353325=_0xa9fb[_0x4511da];return _0x353325;};'use strict';var Sequelize=require(_0xba9f('0x0'));var rs=require(_0xba9f('0x1'));module[_0xba9f('0x2')]={'name':{'type':Sequelize[_0xba9f('0x3')],'unique':_0xba9f('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xba9f('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xba9f('0x3')],'defaultValue':function(){return rs[_0xba9f('0x5')]();}},'phone':{'type':Sequelize[_0xba9f('0x3')]},'type':{'type':Sequelize[_0xba9f('0x6')](_0xba9f('0x7'),_0xba9f('0x8'),_0xba9f('0x9'),_0xba9f('0xa'),_0xba9f('0xb'),_0xba9f('0xc'),'bandwidth',_0xba9f('0xd'),'infobip','intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xba9f('0x3')]},'authToken':{'type':Sequelize[_0xba9f('0x3')]},'smsMethod':{'type':Sequelize[_0xba9f('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xba9f('0x3')]},'password':{'type':Sequelize[_0xba9f('0x3')]},'apiKey':{'type':Sequelize[_0xba9f('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xba9f('0x3')]},'deliveryReport':{'type':Sequelize[_0xba9f('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xba9f('0x3')]},'notificationTemplate':{'type':Sequelize[_0xba9f('0xf')],'defaultValue':function(){return _0xba9f('0x10');}},'notificationSound':{'type':Sequelize[_0xba9f('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xba9f('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xba9f('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xba9f('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xba9f('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xba9f('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xba9f('0x11')],'comment':_0xba9f('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xba9f('0x13'),'set':function(_0x39609f){if(!_0x39609f)this[_0xba9f('0x14')](_0xba9f('0x15'),null);this[_0xba9f('0x14')](_0xba9f('0x16'),_0x39609f);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index ef7cb4c..4c6d210 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 _0x370a=['SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','out','dataValues','Messages','debug','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','redif','error_code','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','received\x20delivery\x20report\x20from','state','message-id','emit','userSmsAccount:remove','getAgents','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','user','role','UserProfileSection','autoAssociation','describe','addDisposition','Disposition','getDispositions','findOne','SmsAccountId','filter','removeDispositions','ids','CannedAnswer','removeAnswers','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x370a,0x11a));var _0xa370=function(_0x14ed98,_0x54c2e4){_0x14ed98=_0x14ed98-0x0;var _0x2c28d7=_0x370a[_0x14ed98];return _0x2c28d7;};'use strict';var emlformat=require(_0xa370('0x0'));var rimraf=require(_0xa370('0x1'));var zipdir=require(_0xa370('0x2'));var jsonpatch=require(_0xa370('0x3'));var rp=require(_0xa370('0x4'));var moment=require(_0xa370('0x5'));var BPromise=require(_0xa370('0x6'));var Mustache=require('mustache');var util=require(_0xa370('0x7'));var path=require('path');var sox=require(_0xa370('0x8'));var csv=require(_0xa370('0x9'));var ejs=require(_0xa370('0xa'));var fs=require('fs');var fs_extra=require(_0xa370('0xb'));var _=require(_0xa370('0xc'));var squel=require(_0xa370('0xd'));var crypto=require(_0xa370('0xe'));var jsforce=require(_0xa370('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa370('0x9'));var querystring=require(_0xa370('0x10'));var Papa=require(_0xa370('0x11'));var Redis=require(_0xa370('0x12'));var authService=require(_0xa370('0x13'));var qs=require(_0xa370('0x14'));var as=require(_0xa370('0x15'));var hardwareService=require(_0xa370('0x16'));var logger=require(_0xa370('0x17'))('api');var utils=require(_0xa370('0x18'));var config=require(_0xa370('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa370('0x1a')]=_[_0xa370('0x1b')](config[_0xa370('0x1a')],{'host':_0xa370('0x1c'),'port':0x18eb});var socket=require(_0xa370('0x1d'))(new Redis(config[_0xa370('0x1a')]));require(_0xa370('0x1e'))[_0xa370('0x1f')](socket);var jayson=require(_0xa370('0x20'));var client=jayson[_0xa370('0x21')][_0xa370('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x7d3e8c,_0x221f52,_0x1abeb1,_0x160660){return new BPromise(function(_0x35fb25,_0x5277d8){var _0x2ba470=_0x160660||client;return _0x2ba470[_0xa370('0x23')](_0x7d3e8c,_0x1abeb1)[_0xa370('0x24')](function(_0x332abf){logger[_0xa370('0x25')](_0xa370('0x26'),_0x221f52,_0xa370('0x27'));logger['debug'](_0xa370('0x28'),_0x221f52,_0xa370('0x27'),JSON[_0xa370('0x29')](_0x332abf));if(_0x332abf[_0xa370('0x2a')]){if(_0x332abf[_0xa370('0x2a')][_0xa370('0x2b')]===0x1f4){logger[_0xa370('0x2a')](_0xa370('0x26'),_0x221f52,_0x332abf[_0xa370('0x2a')][_0xa370('0x2c')]);return _0x5277d8(_0x332abf['error'][_0xa370('0x2c')]);}logger[_0xa370('0x2a')](_0xa370('0x26'),_0x221f52,_0x332abf[_0xa370('0x2a')]['message']);return _0x35fb25(_0x332abf['error'][_0xa370('0x2c')]);}else{logger[_0xa370('0x25')]('SmsAccount,\x20%s,\x20%s',_0x221f52,_0xa370('0x27'));_0x35fb25(_0x332abf[_0xa370('0x2d')]['message']);}})['catch'](function(_0x155f5f){logger[_0xa370('0x2a')]('SmsAccount,\x20%s,\x20%s',_0x221f52,_0x155f5f);_0x5277d8(_0x155f5f);});});}function respondWithStatusCode(_0x48a891,_0x4dc29d){_0x4dc29d=_0x4dc29d||0xcc;return function(_0x4723bd){if(_0x4723bd){return _0x48a891['sendStatus'](_0x4dc29d);}return _0x48a891[_0xa370('0x2e')](_0x4dc29d)[_0xa370('0x2f')]();};}function respondWithResult(_0x28de4b,_0x4082f9){_0x4082f9=_0x4082f9||0xc8;return function(_0x159875){if(_0x159875){return _0x28de4b['status'](_0x4082f9)['json'](_0x159875);}};}function respondWithFilteredResult(_0x52979e,_0x4069c7){return function(_0x234c6d){if(_0x234c6d){var _0xf020af=typeof _0x4069c7[_0xa370('0x30')]===_0xa370('0x31')&&typeof _0x4069c7[_0xa370('0x32')]===_0xa370('0x31');var _0x1d5fd7=_0x234c6d[_0xa370('0x33')];var _0x4d9806=_0xf020af?0x0:_0x4069c7[_0xa370('0x30')];var _0x308faf=_0xf020af?_0x234c6d[_0xa370('0x33')]:_0x4069c7[_0xa370('0x30')]+_0x4069c7[_0xa370('0x32')];var _0x220a8c;if(_0x308faf>=_0x1d5fd7){_0x308faf=_0x1d5fd7;_0x220a8c=0xc8;}else{_0x220a8c=0xce;}_0x52979e[_0xa370('0x2e')](_0x220a8c);return _0x52979e[_0xa370('0x34')](_0xa370('0x35'),_0x4d9806+'-'+_0x308faf+'/'+_0x1d5fd7)[_0xa370('0x36')](_0x234c6d);}return null;};}function patchUpdates(_0x328c74){return function(_0xffa43e){try{jsonpatch[_0xa370('0x37')](_0xffa43e,_0x328c74,!![]);}catch(_0x21f5b7){return BPromise[_0xa370('0x38')](_0x21f5b7);}return _0xffa43e[_0xa370('0x39')]();};}function saveUpdates(_0x5a0a1b,_0x48fa7a){return function(_0x2968f9){if(_0x2968f9){return _0x2968f9[_0xa370('0x3a')](_0x5a0a1b)[_0xa370('0x24')](function(_0x292b69){return _0x292b69;});}return null;};}function removeEntity(_0x44ab33,_0x345e6f){return function(_0x35058d){if(_0x35058d){return _0x35058d[_0xa370('0x3b')]()['then'](function(){var _0x801c5f=_0x35058d[_0xa370('0x3c')]({'plain':!![]});var _0x28d4b4='SmsAccounts';return db[_0xa370('0x3d')][_0xa370('0x3b')]({'where':{'type':_0x28d4b4,'resourceId':_0x801c5f['id']}})[_0xa370('0x24')](function(){return _0x35058d;});})[_0xa370('0x24')](function(){_0x44ab33[_0xa370('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c019f,_0x1a9536){return function(_0x202660){if(!_0x202660){_0x5c019f[_0xa370('0x3e')](0x194);}return _0x202660;};}function handleError(_0x1e8ba1,_0x5da0b2){_0x5da0b2=_0x5da0b2||0x1f4;return function(_0x45d37b){logger['error'](_0x45d37b[_0xa370('0x3f')]);if(_0x45d37b[_0xa370('0x40')]){delete _0x45d37b[_0xa370('0x40')];}_0x1e8ba1[_0xa370('0x2e')](_0x5da0b2)[_0xa370('0x41')](_0x45d37b);};}exports[_0xa370('0x42')]=function(_0x16a33b,_0x401866){var _0x189232={'include':[{'model':db[_0xa370('0x43')],'as':_0xa370('0x44')}]},_0x5725e9={},_0x415c9e={'count':0x0,'rows':[]};var _0xefdb1d=_[_0xa370('0x45')](db[_0xa370('0x46')][_0xa370('0x47')],function(_0x34e486){return{'name':_0x34e486[_0xa370('0x48')],'type':_0x34e486['type'][_0xa370('0x49')]};});_0x5725e9[_0xa370('0x4a')]=_[_0xa370('0x45')](_0xefdb1d,'name');_0x5725e9[_0xa370('0x4b')]=_[_0xa370('0x4c')](_0x16a33b[_0xa370('0x4b')]);_0x5725e9['filters']=_[_0xa370('0x4d')](_0x5725e9[_0xa370('0x4a')],_0x5725e9[_0xa370('0x4b')]);_0x189232['attributes']=_[_0xa370('0x4d')](_0x5725e9['model'],qs[_0xa370('0x4e')](_0x16a33b[_0xa370('0x4b')][_0xa370('0x4e')]));_0x189232[_0xa370('0x4f')]=_0x189232[_0xa370('0x4f')][_0xa370('0x50')]?_0x189232[_0xa370('0x4f')]:_0x5725e9[_0xa370('0x4a')];if(!_0x16a33b[_0xa370('0x4b')][_0xa370('0x51')](_0xa370('0x52'))){_0x189232['limit']=qs['limit'](_0x16a33b['query'][_0xa370('0x32')]);_0x189232[_0xa370('0x30')]=qs[_0xa370('0x30')](_0x16a33b['query']['offset']);}_0x189232[_0xa370('0x53')]=qs[_0xa370('0x54')](_0x16a33b['query'][_0xa370('0x54')]);_0x189232[_0xa370('0x55')]=qs[_0xa370('0x56')](_[_0xa370('0x57')](_0x16a33b[_0xa370('0x4b')],_0x5725e9[_0xa370('0x56')]),_0xefdb1d);if(_0x16a33b['query']['filter']){_0x189232[_0xa370('0x55')]=_['merge'](_0x189232[_0xa370('0x55')],{'$or':_[_0xa370('0x45')](_0xefdb1d,function(_0x4d7f26){if(_0x4d7f26[_0xa370('0x58')]!==_0xa370('0x59')){var _0x1e6f52={};_0x1e6f52[_0x4d7f26[_0xa370('0x40')]]={'$like':'%'+_0x16a33b['query']['filter']+'%'};return _0x1e6f52;}})});}_0x189232=_['merge']({},_0x189232,_0x16a33b[_0xa370('0x5a')]);var _0x24a8c4={'where':_0x189232[_0xa370('0x55')]};return db['SmsAccount']['count'](_0x24a8c4)[_0xa370('0x24')](function(_0x37f73a){_0x415c9e[_0xa370('0x33')]=_0x37f73a;if(_0x16a33b['query'][_0xa370('0x5b')]){_0x189232[_0xa370('0x5c')]=[{'all':!![]}];}return db[_0xa370('0x46')][_0xa370('0x5d')](_0x189232);})['then'](function(_0x5157b1){_0x415c9e[_0xa370('0x5e')]=_0x5157b1;return _0x415c9e;})[_0xa370('0x24')](respondWithFilteredResult(_0x401866,_0x189232))['catch'](handleError(_0x401866,null));};exports[_0xa370('0x5f')]=function(_0x1a7f67,_0x1b4e59){var _0x2847f1={'raw':![],'where':{'id':_0x1a7f67[_0xa370('0x60')]['id']},'include':[{'model':db['Pause'],'as':_0xa370('0x44')}]},_0x3cba59={};_0x3cba59['model']=_[_0xa370('0x4c')](db[_0xa370('0x46')][_0xa370('0x47')]);_0x3cba59[_0xa370('0x4b')]=_[_0xa370('0x4c')](_0x1a7f67[_0xa370('0x4b')]);_0x3cba59[_0xa370('0x56')]=_['intersection'](_0x3cba59[_0xa370('0x4a')],_0x3cba59[_0xa370('0x4b')]);_0x2847f1[_0xa370('0x4f')]=_[_0xa370('0x4d')](_0x3cba59[_0xa370('0x4a')],qs[_0xa370('0x4e')](_0x1a7f67[_0xa370('0x4b')]['fields']));_0x2847f1[_0xa370('0x4f')]=_0x2847f1['attributes'][_0xa370('0x50')]?_0x2847f1[_0xa370('0x4f')]:_0x3cba59[_0xa370('0x4a')];if(_0x1a7f67[_0xa370('0x4b')][_0xa370('0x5b')]){_0x2847f1[_0xa370('0x5c')]=[{'all':!![]}];}_0x2847f1=_[_0xa370('0x61')]({},_0x2847f1,_0x1a7f67[_0xa370('0x5a')]);return db['SmsAccount'][_0xa370('0x62')](_0x2847f1)[_0xa370('0x24')](handleEntityNotFound(_0x1b4e59,null))[_0xa370('0x24')](respondWithResult(_0x1b4e59,null))[_0xa370('0x63')](handleError(_0x1b4e59,null));};exports[_0xa370('0x64')]=function(_0x4d9fb9,_0x23af71){return db['SmsAccount'][_0xa370('0x64')](_0x4d9fb9[_0xa370('0x65')],{})[_0xa370('0x24')](function(_0x5ac370){var _0x47d5d5=_0x4d9fb9[_0xa370('0x66')]['get']({'plain':!![]});if(!_0x47d5d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47d5d5[_0xa370('0x67')]===_0xa370('0x66')){var _0x7c2d30=_0x5ac370[_0xa370('0x3c')]({'plain':!![]});var _0x44b60a='SmsAccounts';return db[_0xa370('0x68')]['find']({'where':{'name':_0x44b60a,'userProfileId':_0x47d5d5['userProfileId']},'raw':!![]})[_0xa370('0x24')](function(_0x56f790){if(_0x56f790&&_0x56f790[_0xa370('0x69')]===0x0){return db['UserProfileResource'][_0xa370('0x64')]({'name':_0x7c2d30[_0xa370('0x40')],'resourceId':_0x7c2d30['id'],'type':_0x56f790[_0xa370('0x40')],'sectionId':_0x56f790['id']},{})['then'](function(){return _0x5ac370;});}else{return _0x5ac370;}})[_0xa370('0x63')](function(_0x452fda){logger[_0xa370('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x452fda);throw _0x452fda;});}return _0x5ac370;})[_0xa370('0x24')](respondWithResult(_0x23af71,0xc9))[_0xa370('0x63')](handleError(_0x23af71,null));};exports[_0xa370('0x3a')]=function(_0x598f4e,_0x37a159){if(_0x598f4e[_0xa370('0x65')]['id']){delete _0x598f4e[_0xa370('0x65')]['id'];}return db[_0xa370('0x46')][_0xa370('0x62')]({'where':{'id':_0x598f4e['params']['id']},'include':[{'model':db['Pause'],'as':_0xa370('0x44')}]})[_0xa370('0x24')](handleEntityNotFound(_0x37a159,null))[_0xa370('0x24')](saveUpdates(_0x598f4e[_0xa370('0x65')],null))[_0xa370('0x24')](respondWithResult(_0x37a159,null))[_0xa370('0x63')](handleError(_0x37a159,null));};exports['destroy']=function(_0x30ce5a,_0x51506c){return db[_0xa370('0x46')][_0xa370('0x62')]({'where':{'id':_0x30ce5a[_0xa370('0x60')]['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x51506c,null))['then'](removeEntity(_0x51506c,null))[_0xa370('0x63')](handleError(_0x51506c,null));};exports[_0xa370('0x6a')]=function(_0x5a6dfa,_0x1da824){return db[_0xa370('0x46')][_0xa370('0x6a')]()[_0xa370('0x24')](respondWithResult(_0x1da824,null))['catch'](handleError(_0x1da824,null));};exports[_0xa370('0x6b')]=function(_0x140843,_0x5908c4,_0x4e9866){if(_0x140843[_0xa370('0x65')]['id']){delete _0x140843[_0xa370('0x65')]['id'];}return db['SmsAccount'][_0xa370('0x62')]({'where':{'id':_0x140843['params']['id']}})['then'](handleEntityNotFound(_0x5908c4,null))['then'](function(_0x8f0342){if(_0x8f0342){_0x140843['body']['SmsAccountId']=_0x8f0342['id'];return db[_0xa370('0x6c')][_0xa370('0x64')](_0x140843['body']);}})[_0xa370('0x24')](respondWithResult(_0x5908c4,null))[_0xa370('0x63')](handleError(_0x5908c4,null));};exports[_0xa370('0x6d')]=function(_0x203ad9,_0x200973,_0xeda51e){var _0x463dfc={'raw':![],'where':{}};var _0x467d32={};var _0x177ded={'count':0x0,'rows':[]};return db[_0xa370('0x46')][_0xa370('0x6e')]({'where':{'id':_0x203ad9[_0xa370('0x60')]['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x200973,null))['then'](function(_0x28d2b1){if(_0x28d2b1){_0x467d32[_0xa370('0x4a')]=_[_0xa370('0x4c')](db[_0xa370('0x6c')][_0xa370('0x47')]);_0x467d32['query']=_['keys'](_0x203ad9[_0xa370('0x4b')]);_0x467d32[_0xa370('0x56')]=_[_0xa370('0x4d')](_0x467d32[_0xa370('0x4a')],_0x467d32[_0xa370('0x4b')]);_0x463dfc[_0xa370('0x4f')]=_['intersection'](_0x467d32['model'],qs[_0xa370('0x4e')](_0x203ad9[_0xa370('0x4b')][_0xa370('0x4e')]));_0x463dfc['attributes']=_0x463dfc[_0xa370('0x4f')][_0xa370('0x50')]?_0x463dfc[_0xa370('0x4f')]:_0x467d32[_0xa370('0x4a')];if(!_0x203ad9[_0xa370('0x4b')][_0xa370('0x51')](_0xa370('0x52'))){_0x463dfc[_0xa370('0x32')]=qs[_0xa370('0x32')](_0x203ad9[_0xa370('0x4b')][_0xa370('0x32')]);_0x463dfc['offset']=qs[_0xa370('0x30')](_0x203ad9[_0xa370('0x4b')]['offset']);}_0x463dfc[_0xa370('0x53')]=qs[_0xa370('0x54')](_0x203ad9['query']['sort']);_0x463dfc[_0xa370('0x55')]=qs[_0xa370('0x56')](_[_0xa370('0x57')](_0x203ad9[_0xa370('0x4b')],_0x467d32['filters']));_0x463dfc[_0xa370('0x55')][_0xa370('0x6f')]=_0x28d2b1['id'];if(_0x203ad9[_0xa370('0x4b')][_0xa370('0x70')]){_0x463dfc[_0xa370('0x55')]=_[_0xa370('0x61')](_0x463dfc['where'],{'$or':_[_0xa370('0x45')](_0x463dfc[_0xa370('0x4f')],function(_0x4c9aa9){var _0x35f6e5={};_0x35f6e5[_0x4c9aa9]={'$like':'%'+_0x203ad9[_0xa370('0x4b')][_0xa370('0x70')]+'%'};return _0x35f6e5;})});}_0x463dfc=_[_0xa370('0x61')]({},_0x463dfc,_0x203ad9[_0xa370('0x5a')]);return db[_0xa370('0x6c')][_0xa370('0x33')]({'where':_0x463dfc[_0xa370('0x55')]})['then'](function(_0x6dc8a2){_0x177ded[_0xa370('0x33')]=_0x6dc8a2;if(_0x203ad9[_0xa370('0x4b')][_0xa370('0x5b')]){_0x463dfc[_0xa370('0x5c')]=[{'all':!![]}];}return db[_0xa370('0x6c')][_0xa370('0x5d')](_0x463dfc);})[_0xa370('0x24')](function(_0xf5e2d5){_0x177ded['rows']=_0xf5e2d5;return _0x177ded;});}})[_0xa370('0x24')](respondWithFilteredResult(_0x200973,_0x463dfc))[_0xa370('0x63')](handleError(_0x200973,null));};exports[_0xa370('0x71')]=function(_0x15176b,_0x37efc2,_0x16bcd3){return db[_0xa370('0x46')][_0xa370('0x62')]({'where':{'id':_0x15176b[_0xa370('0x60')]['id']}})['then'](handleEntityNotFound(_0x37efc2,null))['then'](function(_0x372714){if(_0x372714){return _0x372714[_0xa370('0x71')](_0x15176b['query'][_0xa370('0x72')]);}})[_0xa370('0x24')](respondWithStatusCode(_0x37efc2,null))[_0xa370('0x63')](handleError(_0x37efc2,null));};exports['addAnswer']=function(_0x218669,_0x55410e,_0x133102){if(_0x218669[_0xa370('0x65')]['id']){delete _0x218669[_0xa370('0x65')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x218669[_0xa370('0x60')]['id']}})['then'](handleEntityNotFound(_0x55410e,null))[_0xa370('0x24')](function(_0x106a82){if(_0x106a82){_0x218669[_0xa370('0x65')][_0xa370('0x6f')]=_0x106a82['id'];return db[_0xa370('0x73')][_0xa370('0x64')](_0x218669[_0xa370('0x65')]);}})[_0xa370('0x24')](respondWithResult(_0x55410e,null))[_0xa370('0x63')](handleError(_0x55410e,null));};exports['getAnswers']=function(_0x2893f0,_0x4f4c4e,_0x58158b){var _0x4870e8={'raw':![],'where':{}};var _0x357a05={};var _0x174028={'count':0x0,'rows':[]};return db[_0xa370('0x46')]['findOne']({'where':{'id':_0x2893f0[_0xa370('0x60')]['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x4f4c4e,null))[_0xa370('0x24')](function(_0x33644c){if(_0x33644c){_0x357a05['model']=_['keys'](db['CannedAnswer'][_0xa370('0x47')]);_0x357a05[_0xa370('0x4b')]=_[_0xa370('0x4c')](_0x2893f0['query']);_0x357a05['filters']=_[_0xa370('0x4d')](_0x357a05['model'],_0x357a05[_0xa370('0x4b')]);_0x4870e8[_0xa370('0x4f')]=_[_0xa370('0x4d')](_0x357a05['model'],qs[_0xa370('0x4e')](_0x2893f0[_0xa370('0x4b')][_0xa370('0x4e')]));_0x4870e8[_0xa370('0x4f')]=_0x4870e8[_0xa370('0x4f')][_0xa370('0x50')]?_0x4870e8[_0xa370('0x4f')]:_0x357a05[_0xa370('0x4a')];if(!_0x2893f0[_0xa370('0x4b')]['hasOwnProperty']('nolimit')){_0x4870e8[_0xa370('0x32')]=qs[_0xa370('0x32')](_0x2893f0[_0xa370('0x4b')][_0xa370('0x32')]);_0x4870e8['offset']=qs[_0xa370('0x30')](_0x2893f0['query'][_0xa370('0x30')]);}_0x4870e8[_0xa370('0x53')]=qs['sort'](_0x2893f0[_0xa370('0x4b')][_0xa370('0x54')]);_0x4870e8[_0xa370('0x55')]=qs[_0xa370('0x56')](_[_0xa370('0x57')](_0x2893f0[_0xa370('0x4b')],_0x357a05[_0xa370('0x56')]));_0x4870e8[_0xa370('0x55')][_0xa370('0x6f')]=_0x33644c['id'];if(_0x2893f0['query'][_0xa370('0x70')]){_0x4870e8[_0xa370('0x55')]=_[_0xa370('0x61')](_0x4870e8['where'],{'$or':_['map'](_0x4870e8['attributes'],function(_0x4ea159){var _0x2a6c8c={};_0x2a6c8c[_0x4ea159]={'$like':'%'+_0x2893f0[_0xa370('0x4b')]['filter']+'%'};return _0x2a6c8c;})});}_0x4870e8=_[_0xa370('0x61')]({},_0x4870e8,_0x2893f0[_0xa370('0x5a')]);return db['CannedAnswer'][_0xa370('0x33')]({'where':_0x4870e8[_0xa370('0x55')]})[_0xa370('0x24')](function(_0x900d2c){_0x174028[_0xa370('0x33')]=_0x900d2c;if(_0x2893f0[_0xa370('0x4b')]['includeAll']){_0x4870e8[_0xa370('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa370('0x5d')](_0x4870e8);})[_0xa370('0x24')](function(_0x6157dc){_0x174028[_0xa370('0x5e')]=_0x6157dc;return _0x174028;});}})[_0xa370('0x24')](respondWithFilteredResult(_0x4f4c4e,_0x4870e8))[_0xa370('0x63')](handleError(_0x4f4c4e,null));};exports[_0xa370('0x74')]=function(_0x57be59,_0x422797,_0x1db566){return db[_0xa370('0x46')]['find']({'where':{'id':_0x57be59[_0xa370('0x60')]['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x422797,null))[_0xa370('0x24')](function(_0x11c102){if(_0x11c102){return _0x11c102[_0xa370('0x74')](_0x57be59[_0xa370('0x4b')][_0xa370('0x72')]);}})[_0xa370('0x24')](respondWithStatusCode(_0x422797,null))[_0xa370('0x63')](handleError(_0x422797,null));};exports['notify']=function(_0x597f1f,_0x3fb7a8,_0x152b37){var _0x4d13d6={'channel':'sms'};var _0x290060=[];var _0x5074f3=[];var _0x706fec={};return db['SmsAccount'][_0xa370('0x62')]({'where':{'id':_0x597f1f[_0xa370('0x60')]['id']},'include':[{'model':db[_0xa370('0x75')],'as':_0xa370('0x76')}]})[_0xa370('0x24')](handleEntityNotFound(_0x3fb7a8,null))[_0xa370('0x24')](function(_0x1cbd39){_0x4d13d6[_0xa370('0x77')]=_0x1cbd39;_0x4d13d6[_0xa370('0x78')]=_[_0xa370('0x79')](_0x1cbd39[_0xa370('0x76')],[_0xa370('0x7a')],[_0xa370('0x7b')]);if(_0x4d13d6['account'][_0xa370('0x76')]){delete _0x4d13d6[_0xa370('0x77')][_0xa370('0x76')];}return db[_0xa370('0x7c')][_0xa370('0x6a')]();})[_0xa370('0x24')](function(_0x301e15){if(!_0x301e15){throw new db[(_0xa370('0x7d'))][(_0xa370('0x7e'))]('no\x20available\x20attributes');}_0x290060=_[_0xa370('0x7f')](_[_0xa370('0x4c')](_0x301e15),[_0xa370('0x80'),_0xa370('0x81')]);_0x5074f3=_[_0xa370('0x7f')](_[_0xa370('0x4c')](_0x301e15),[_0xa370('0x80'),_0xa370('0x81'),_0xa370('0x82'),_0xa370('0x83')]);_0x4d13d6[_0xa370('0x65')]={'mapKey':_0xa370('0x84')};if(_0x4d13d6[_0xa370('0x77')][_0xa370('0x58')]){switch(_0x4d13d6['account'][_0xa370('0x58')]){case _0xa370('0x85'):_0x4d13d6[_0xa370('0x65')][_0xa370('0x86')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x87')];_0x4d13d6[_0xa370('0x65')]['body']=_0x597f1f['body'][_0xa370('0x88')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x89')]=_0x597f1f['body'][_0xa370('0x8a')];break;case _0xa370('0x8b'):_0x4d13d6[_0xa370('0x65')][_0xa370('0x86')]='+'+_0x597f1f['body'][_0xa370('0x8c')];_0x4d13d6[_0xa370('0x65')]['body']=_0x597f1f[_0xa370('0x65')][_0xa370('0x8d')];break;case _0xa370('0x8e'):_0x4d13d6['body'][_0xa370('0x86')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x86')];_0x4d13d6[_0xa370('0x65')]['body']=_0x597f1f[_0xa370('0x65')][_0xa370('0x2c')];break;case _0xa370('0x8f'):_0x4d13d6[_0xa370('0x65')]['from']=_0x597f1f[_0xa370('0x65')][_0xa370('0x86')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x65')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x65')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x89')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x90')];break;case'plivo':_0x4d13d6[_0xa370('0x65')][_0xa370('0x86')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x87')];_0x4d13d6[_0xa370('0x65')]['body']=_0x597f1f[_0xa370('0x65')][_0xa370('0x91')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x89')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x92')];break;case _0xa370('0x93'):_0x4d13d6[_0xa370('0x65')]['from']='+'+_0x597f1f['body'][_0xa370('0x94')][0x0][_0xa370('0x86')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x65')]=_0x597f1f[_0xa370('0x65')]['results'][0x0][_0xa370('0x8d')];_0x4d13d6['body']['messageId']=_0x597f1f[_0xa370('0x65')]['results'][0x0][_0xa370('0x89')];break;case _0xa370('0x95'):_0x4d13d6['body'][_0xa370('0x86')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x96')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x65')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x97')][_0xa370('0x2c')];break;case _0xa370('0x98'):_0x4d13d6['body'][_0xa370('0x86')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x99')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x65')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x8d')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x89')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x9a')];break;case _0xa370('0x9b'):_0x4d13d6[_0xa370('0x65')][_0xa370('0x89')]=_0x597f1f[_0xa370('0x65')][0x0][_0xa370('0x2c')]['id'];_0x4d13d6['body'][_0xa370('0x86')]=_0x597f1f[_0xa370('0x65')][0x0][_0xa370('0x2c')][_0xa370('0x86')];_0x4d13d6[_0xa370('0x65')][_0xa370('0x65')]=_0x597f1f[_0xa370('0x65')][0x0]['message'][_0xa370('0x8d')];break;case _0xa370('0x9c'):_0x4d13d6[_0xa370('0x65')][_0xa370('0x86')]=_0x597f1f['body']['from'];_0x4d13d6[_0xa370('0x65')][_0xa370('0x65')]=_0x597f1f[_0xa370('0x65')][_0xa370('0x2c')];_0x4d13d6[_0xa370('0x65')]['messageId']=_0x597f1f[_0xa370('0x65')][_0xa370('0x9d')];break;}}if(_0x4d13d6['body']['id']){delete _0x4d13d6[_0xa370('0x65')]['id'];}if(_['isNil'](_0x4d13d6[_0xa370('0x65')][_0xa370('0x86')])){throw new db['Sequelize']['ValidationError'](_0xa370('0x9e'));}if(_[_0xa370('0x9f')](_0x4d13d6['body'][_0xa370('0x65')])||_0x4d13d6[_0xa370('0x65')]['body']===''){throw new db['Sequelize']['ValidationError'](_0xa370('0xa0'));}if(_[_0xa370('0x9f')](_0x4d13d6[_0xa370('0x65')][_0xa370('0xa1')])){throw new db[(_0xa370('0x7d'))][(_0xa370('0x7e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5074f3);}if(!_[_0xa370('0xa2')](_0x5074f3,_0x4d13d6[_0xa370('0x65')][_0xa370('0xa1')])){throw new db[(_0xa370('0x7d'))][(_0xa370('0x7e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5074f3);}_0x706fec[_0x4d13d6[_0xa370('0x65')]['mapKey']]=_0x4d13d6[_0xa370('0x65')][_0xa370('0x86')];return db[_0xa370('0xa3')][_0xa370('0x62')]({'where':{'id':_0x4d13d6['account'][_0xa370('0x83')]},'include':[{'model':db[_0xa370('0x7c')],'as':'Contacts','where':_0x706fec,'limit':0x1,'order':[[_0xa370('0x81'),_0xa370('0xa4')]]}]});})[_0xa370('0x24')](handleEntityNotFound(_0x3fb7a8,null))[_0xa370('0x24')](function(_0x1e3205){if(_0x1e3205){_0x4d13d6[_0xa370('0xa5')]=_[_0xa370('0xa6')](_0x1e3205,['Contacts']);if(_0x1e3205[_0xa370('0xa7')][_0xa370('0x50')]){return _0x1e3205[_0xa370('0xa7')][0x0];}var _0xa1bf0f=_[_0xa370('0x1b')](_0x4d13d6[_0xa370('0x65')],{'firstName':_0x4d13d6[_0xa370('0x65')]['from'],'ListId':_0x1e3205['id']});_0xa1bf0f[_0x4d13d6[_0xa370('0x65')][_0xa370('0xa1')]]=_0x4d13d6[_0xa370('0x65')]['from'];return db[_0xa370('0x7c')][_0xa370('0x64')](_0xa1bf0f,{'fields':_0x290060,'raw':!![]});}})[_0xa370('0x24')](handleEntityNotFound(_0x3fb7a8,null))[_0xa370('0x24')](function(_0x384411){if(_0x384411){_0x4d13d6[_0xa370('0xa8')]=_0x384411;var _0x140771={'ContactId':_0x384411['id'],'phone':_0x4d13d6['body'][_0xa370('0x86')],'SmsAccountId':_0x597f1f[_0xa370('0x60')]['id']};var _0x33b4be={'ContactId':_0x384411['id'],'SmsAccountId':_0x597f1f[_0xa370('0x60')]['id'],'closed':![]};return db['SmsInteraction'][_0xa370('0x62')]({'where':_0x33b4be})[_0xa370('0x24')](function(_0x18c459){if(_0x18c459){return[_0x18c459,![]];}return db[_0xa370('0xa9')][_0xa370('0x64')](_0x140771)['then'](function(_0x5adf9a){return[_0x5adf9a,!![]];});});}})[_0xa370('0xaa')](function(_0xf80e0f,_0x2f873b){_0x4d13d6[_0xa370('0xab')]=_0xf80e0f['get']({'plain':!![]});_0x4d13d6[_0xa370('0xab')][_0xa370('0xac')]=![];if(_0x2f873b){if(_0x4d13d6[_0xa370('0x77')][_0xa370('0xad')]){_0x4d13d6[_0xa370('0x78')][_0xa370('0xae')]({'id':0x0,'priority':_0x4d13d6[_0xa370('0x78')]['length']+0x1,'app':_0xa370('0xaf'),'appdata':_0xa370('0xb0'),'interval':_0xa370('0xb1')});}_0x4d13d6[_0xa370('0xab')]['created']=!![];}return db[_0xa370('0xb2')]['create']({'phone':_0x4d13d6['body']['from'],'messageId':_0x4d13d6[_0xa370('0x65')]['messageId'],'body':_0x4d13d6[_0xa370('0x65')]['body'],'SmsAccountId':_0x597f1f[_0xa370('0x60')]['id'],'SmsInteractionId':_0xf80e0f['id'],'direction':'in','ContactId':_0xf80e0f[_0xa370('0xb3')],'AttachmentId':_0x4d13d6[_0xa370('0x65')][_0xa370('0xb4')]});})[_0xa370('0x24')](function(_0x2cf83e){_0x4d13d6['message']=_0x2cf83e;if(_0x4d13d6['interaction'][_0xa370('0xb5')]){return db[_0xa370('0xb6')][_0xa370('0x62')]({'attributes':['id','name'],'where':{'id':_0x4d13d6['interaction'][_0xa370('0xb5')]}})[_0xa370('0x24')](function(_0x534300){if(_0x534300){_0x4d13d6[_0xa370('0x78')][_0xa370('0xb7')]({'id':0x0,'priority':0x0,'app':_0xa370('0xb8'),'appdata':_0x534300['name']+','+(_0x4d13d6[_0xa370('0x77')][_0xa370('0xb9')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xa370('0xba'),_0xa370('0xbb'),_0x4d13d6);});}return respondWithRpcPromise('Start',_0xa370('0xbb'),_0x4d13d6);})[_0xa370('0x24')](function(_0x41083d){if(_0x41083d){var _0x5728d0=0xc8;var _0x1f3372=_0xa370('0xbc');logger[_0xa370('0x25')](_0xa370('0x28'),_0x1f3372,_0x5728d0,_0xa370('0xbd'));logger['debug'](_0xa370('0xbe'),_0x1f3372,_0x5728d0,_0xa370('0xbd'),JSON[_0xa370('0x29')](_0x41083d));if(_0x4d13d6[_0xa370('0x77')][_0xa370('0x58')]==='twilio'){return _0x3fb7a8[_0xa370('0x2e')](_0x5728d0)[_0xa370('0x34')]('Content-Type','text/xml')[_0xa370('0x41')](_0xa370('0xbf'));}else{return _0x3fb7a8[_0xa370('0x2e')](_0x5728d0)[_0xa370('0x36')](_0x41083d);}}})['catch'](handleError(_0x3fb7a8,null));};exports[_0xa370('0xc0')]=function(_0x491496,_0x100cf5,_0x28818d){return db[_0xa370('0x46')][_0xa370('0x6e')]({'where':{'id':_0x491496[_0xa370('0x60')]['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x100cf5,null))[_0xa370('0x24')](function(_0x3435e1){if(_0x3435e1){return db['sequelize'][_0xa370('0xc1')](function(_0x326080){return db['SmsApplication'][_0xa370('0x3b')]({'where':{'SmsAccountId':_0x491496[_0xa370('0x60')]['id']},'transaction':_0x326080})['then'](function(_0x2830d1){var _0x3cb58c=_['map'](_0x491496['body'],function(_0x2a297e){_0x2a297e[_0xa370('0x6f')]=_0x491496[_0xa370('0x60')]['id'];return _0x2a297e;});return db[_0xa370('0x75')][_0xa370('0xc2')](_0x3cb58c,{'transaction':_0x326080});});})['then'](function(){return db[_0xa370('0x75')][_0xa370('0xc3')]({'where':{'SmsAccountId':_0x491496['params']['id']},'order':_0xa370('0x7a')});});}})[_0xa370('0x24')](respondWithResult(_0x100cf5,null))[_0xa370('0x63')](handleError(_0x100cf5,null));};exports['getApplications']=function(_0x4776b9,_0x1afa8f,_0x53731e){var _0x2aa2d0={};var _0x3685ed={};var _0x2b6409;var _0x48aa23;return db[_0xa370('0x46')]['findOne']({'where':{'id':_0x4776b9['params']['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x1afa8f,null))[_0xa370('0x24')](function(_0x2dda63){if(_0x2dda63){_0x2b6409=_0x2dda63;_0x3685ed[_0xa370('0x4a')]=_[_0xa370('0x4c')](db[_0xa370('0x75')][_0xa370('0x47')]);_0x3685ed[_0xa370('0x4b')]=_[_0xa370('0x4c')](_0x4776b9[_0xa370('0x4b')]);_0x3685ed[_0xa370('0x56')]=_[_0xa370('0x4d')](_0x3685ed['model'],_0x3685ed[_0xa370('0x4b')]);_0x2aa2d0[_0xa370('0x4f')]=_[_0xa370('0x4d')](_0x3685ed[_0xa370('0x4a')],qs[_0xa370('0x4e')](_0x4776b9[_0xa370('0x4b')][_0xa370('0x4e')]));_0x2aa2d0[_0xa370('0x4f')]=_0x2aa2d0['attributes'][_0xa370('0x50')]?_0x2aa2d0['attributes']:_0x3685ed[_0xa370('0x4a')];_0x2aa2d0['order']=qs[_0xa370('0x54')](_0x4776b9[_0xa370('0x4b')]['sort']);_0x2aa2d0[_0xa370('0x55')]=qs[_0xa370('0x56')](_[_0xa370('0x57')](_0x4776b9['query'],_0x3685ed['filters']));if(_0x4776b9[_0xa370('0x4b')][_0xa370('0x70')]){_0x2aa2d0[_0xa370('0x55')]=_['merge'](_0x2aa2d0[_0xa370('0x55')],{'$or':_[_0xa370('0x45')](_0x2aa2d0['attributes'],function(_0x414712){var _0x126766={};_0x126766[_0x414712]={'$like':'%'+_0x4776b9['query'][_0xa370('0x70')]+'%'};return _0x126766;})});}_0x2aa2d0=_['merge']({},_0x2aa2d0,_0x4776b9['options']);return _0x2b6409[_0xa370('0xc4')](_0x2aa2d0);}})[_0xa370('0x24')](function(_0xea3fc){if(_0xea3fc){_0x48aa23=_0xea3fc[_0xa370('0x50')];if(!_0x4776b9[_0xa370('0x4b')]['hasOwnProperty'](_0xa370('0x52'))){_0x2aa2d0[_0xa370('0x32')]=qs[_0xa370('0x32')](_0x4776b9[_0xa370('0x4b')][_0xa370('0x32')]);_0x2aa2d0[_0xa370('0x30')]=qs['offset'](_0x4776b9[_0xa370('0x4b')]['offset']);}return _0x2b6409[_0xa370('0xc4')](_0x2aa2d0);}})[_0xa370('0x24')](function(_0x1eb0f0){if(_0x1eb0f0){return _0x1eb0f0?{'count':_0x48aa23,'rows':_0x1eb0f0}:null;}})['then'](respondWithResult(_0x1afa8f,null))['catch'](handleError(_0x1afa8f,null));};exports['getInteractions']=function(_0x36705b,_0x5c115d,_0x5b4622){var _0xbacec6={'raw':![],'where':{}};var _0x578fcc={};var _0x4a0c73={'count':0x0,'rows':[]};return db['SmsAccount'][_0xa370('0x6e')]({'where':{'id':_0x36705b['params']['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x5c115d,null))[_0xa370('0x24')](function(_0x34dd44){if(_0x34dd44){_0x578fcc[_0xa370('0x4a')]=_[_0xa370('0x4c')](db['SmsInteraction'][_0xa370('0x47')]);_0x578fcc['query']=_[_0xa370('0x4c')](_0x36705b[_0xa370('0x4b')]);_0x578fcc[_0xa370('0x56')]=_[_0xa370('0x4d')](_0x578fcc[_0xa370('0x4a')],_0x578fcc[_0xa370('0x4b')]);_0xbacec6[_0xa370('0x4f')]=_[_0xa370('0x4d')](_0x578fcc[_0xa370('0x4a')],qs[_0xa370('0x4e')](_0x36705b[_0xa370('0x4b')][_0xa370('0x4e')]));_0xbacec6[_0xa370('0x4f')]=_0xbacec6[_0xa370('0x4f')][_0xa370('0x50')]?_0xbacec6[_0xa370('0x4f')]:_0x578fcc['model'];if(!_0x36705b['query'][_0xa370('0x51')](_0xa370('0x52'))){_0xbacec6[_0xa370('0x32')]=qs[_0xa370('0x32')](_0x36705b[_0xa370('0x4b')]['limit']);_0xbacec6['offset']=qs[_0xa370('0x30')](_0x36705b[_0xa370('0x4b')][_0xa370('0x30')]);}_0xbacec6[_0xa370('0x53')]=qs['sort'](_0x36705b[_0xa370('0x4b')][_0xa370('0x54')]);_0xbacec6[_0xa370('0x55')]=qs[_0xa370('0x56')](_[_0xa370('0x57')](_0x36705b['query'],_0x578fcc['filters']));_0xbacec6[_0xa370('0x55')][_0xa370('0x6f')]=_0x34dd44['id'];if(_0x36705b[_0xa370('0x4b')]['filter']){_0xbacec6[_0xa370('0x55')]=_[_0xa370('0x61')](_0xbacec6[_0xa370('0x55')],{'$or':_[_0xa370('0x45')](_0xbacec6[_0xa370('0x4f')],function(_0x2a44c5){var _0x434bff={};_0x434bff[_0x2a44c5]={'$like':'%'+_0x36705b[_0xa370('0x4b')][_0xa370('0x70')]+'%'};return _0x434bff;})});}_0xbacec6=_[_0xa370('0x61')]({},_0xbacec6,_0x36705b[_0xa370('0x5a')]);return db[_0xa370('0xa9')][_0xa370('0x33')]({'where':_0xbacec6[_0xa370('0x55')]})[_0xa370('0x24')](function(_0x2ac612){_0x4a0c73['count']=_0x2ac612;if(_0x36705b['query'][_0xa370('0x5b')]){_0xbacec6['include']=[{'model':db['CmContact'],'as':_0xa370('0xc5'),'required':![]},{'model':db[_0xa370('0xb6')],'as':_0xa370('0xc6'),'attributes':[_0xa370('0x40'),_0xa370('0xc7'),_0xa370('0xc8')],'required':![]},{'model':db[_0xa370('0xc9')],'as':'Tags','attributes':['id',_0xa370('0x40'),_0xa370('0xca')],'where':_0x36705b[_0xa370('0x4b')][_0xa370('0xcb')]?{'id':_0x36705b[_0xa370('0x4b')]['tag']}:undefined,'required':_0x36705b[_0xa370('0x4b')][_0xa370('0xcb')]?!![]:![]}];}return db[_0xa370('0xa9')][_0xa370('0x5d')](_0xbacec6);})[_0xa370('0x24')](function(_0x296d10){_0x4a0c73[_0xa370('0x5e')]=_0x296d10;return _0x4a0c73;});}})['then'](respondWithFilteredResult(_0x5c115d,_0xbacec6))[_0xa370('0x63')](handleError(_0x5c115d,null));};exports['send']=function(_0x41ee17,_0x29ac0d,_0x2f1fe4){var _0x38eb5c,_0x2cc3bd,_0x74b097;if(_[_0xa370('0x9f')](_0x41ee17[_0xa370('0x65')][_0xa370('0x65')])||_0x41ee17['body'][_0xa370('0x65')]===''){throw new db[(_0xa370('0x7d'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa370('0x9f')](_0x41ee17[_0xa370('0x65')]['to'])){throw new db[(_0xa370('0x7d'))][(_0xa370('0x7e'))](_0xa370('0xcc'));}_0x38eb5c=_0x41ee17[_0xa370('0x65')]['to'];return db[_0xa370('0x46')][_0xa370('0x62')]({'where':{'id':_0x41ee17[_0xa370('0x60')]['id']},'include':[{'model':db[_0xa370('0xa3')],'as':_0xa370('0xcd'),'include':[{'model':db['CmContact'],'as':_0xa370('0xa7'),'where':{'mobile':_0x38eb5c},'limit':0x1,'order':[['updatedAt',_0xa370('0xa4')]]}]}]})[_0xa370('0x24')](handleEntityNotFound(_0x29ac0d,null))[_0xa370('0x24')](function(_0x1882d5){if(_0x1882d5&&_0x1882d5[_0xa370('0xcd')]){_0x2cc3bd=_0x1882d5[_0xa370('0x3c')]({'plain':!![]});if(_0x2cc3bd[_0xa370('0xcd')]&&_0x2cc3bd[_0xa370('0xcd')][_0xa370('0xa7')]['length']){return _0x2cc3bd[_0xa370('0xcd')][_0xa370('0xa7')][0x0];}return db[_0xa370('0x7c')][_0xa370('0x64')](_[_0xa370('0x1b')](_0x41ee17['body'],{'firstName':_0x38eb5c,'mobile':_0x38eb5c,'phone':_0x38eb5c,'ListId':_0x2cc3bd[_0xa370('0x83')]}));}})[_0xa370('0x24')](handleEntityNotFound(_0x29ac0d,null))[_0xa370('0x24')](function(_0x16b44b){if(_0x16b44b){_0x74b097=_0x16b44b;return db['SmsInteraction'][_0xa370('0x62')]({'where':{'ContactId':_0x74b097['id'],'closed':![],'SmsAccountId':_0x2cc3bd['id']}})['then'](function(_0x10b957){if(_0x10b957){return[_0x10b957,![]];}return db['SmsInteraction'][_0xa370('0x64')]({'UserId':_0x41ee17['user']['id'],'ContactId':_0x74b097['id'],'SmsAccountId':_0x2cc3bd['id'],'phone':_0x38eb5c,'firstMsgDirection':_0xa370('0xce'),'Messages':[_[_0xa370('0x61')](_0x41ee17[_0xa370('0x65')],{'read':![],'body':_0x41ee17[_0xa370('0x65')][_0xa370('0x65')],'phone':_0x38eb5c,'SmsAccountId':_0x2cc3bd['id'],'UserId':_0x41ee17['user']['id'],'ContactId':_0x74b097['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0xa370('0x24')](function(_0x2e90e6){return[_0x2e90e6,!![]];});});}})[_0xa370('0xaa')](function(_0x16958c,_0x34affb){if(_0x34affb){return _0x16958c;}return db[_0xa370('0xb2')][_0xa370('0x64')](_['merge'](_0x41ee17[_0xa370('0x65')],{'read':![],'body':_0x41ee17[_0xa370('0x65')]['body'],'phone':_0x38eb5c,'SmsAccountId':_0x2cc3bd['id'],'SmsInteractionId':_0x16958c['id'],'UserId':_0x41ee17[_0xa370('0x66')]['id'],'ContactId':_0x74b097['id']}))[_0xa370('0x24')](function(_0x4ae5c9){_0x16958c[_0xa370('0xcf')][_0xa370('0xd0')]=[];_0x16958c['dataValues'][_0xa370('0xd0')]['push'](_0x4ae5c9['dataValues']);return _0x16958c;});})[_0xa370('0x24')](respondWithResult(_0x29ac0d,null))[_0xa370('0x63')](handleError(_0x29ac0d,null));};exports[_0xa370('0x2e')]=function(_0x54be0c,_0x5f04bf,_0x135126){if(_0x54be0c['body']['id']){delete _0x54be0c[_0xa370('0x65')]['id'];}var _0x356dce,_0x167775,_0x1685f6;return db[_0xa370('0x46')][_0xa370('0x62')]({'where':{'id':_0x54be0c['params']['id']}})['then'](handleEntityNotFound(_0x5f04bf,null))[_0xa370('0x24')](function(_0x24878c){if(_0x24878c){_0x1685f6=_0x24878c;logger[_0xa370('0xd1')](_0xa370('0x28'),_0xa370('0x2e'),'received\x20delivery\x20report\x20from',_0x24878c[_0xa370('0x58')],util[_0xa370('0xd2')](_0x54be0c[_0xa370('0x65')],{'showHidden':![],'depth':null}));switch(_0x24878c[_0xa370('0x58')]){case _0xa370('0x8b'):if(_0x54be0c[_0xa370('0x65')][_0xa370('0xd3')]&&_0x54be0c[_0xa370('0x65')][_0xa370('0x2e')]){_0x167775=_0x54be0c[_0xa370('0x65')][_0xa370('0x2e')];return db['SmsMessage']['find']({'where':{'messageId':_0x54be0c[_0xa370('0x65')][_0xa370('0xd3')]}});}break;case _0xa370('0x8e'):if(_0x54be0c['body'][_0xa370('0xd4')]&&_0x54be0c[_0xa370('0x65')][_0xa370('0xd5')]){_0x167775=_0x54be0c[_0xa370('0x65')][_0xa370('0xd5')];return db[_0xa370('0xb2')][_0xa370('0x62')]({'where':{'messageId':_0x54be0c['body'][_0xa370('0xd4')]}});}break;case _0xa370('0x8f'):if(_0x54be0c[_0xa370('0x65')][_0xa370('0x90')]&&_0x54be0c[_0xa370('0x65')][_0xa370('0xd6')]){_0x167775=_0x54be0c[_0xa370('0x65')][_0xa370('0xd6')];return db[_0xa370('0xb2')]['find']({'where':{'messageId':_0x54be0c[_0xa370('0x65')]['message_id']}});}break;case _0xa370('0x93'):var _0x398008=_0x54be0c[_0xa370('0x65')]['results'][0x0];if(_0x398008['messageId']&&_0x398008[_0xa370('0x2e')][_0xa370('0xd7')]==='DELIVERED'){_0x167775=_0x398008['status']['groupName'];return db[_0xa370('0xb2')][_0xa370('0x62')]({'where':{'messageId':_0x398008[_0xa370('0x89')]}});}break;case'clickatell':if(_0x54be0c[_0xa370('0x65')][_0xa370('0x89')]&&_0x54be0c[_0xa370('0x65')]['status']){_0x167775=_0x54be0c[_0xa370('0x65')][_0xa370('0x2e')];return db['SmsMessage'][_0xa370('0x62')]({'where':{'messageId':_0x54be0c['body'][_0xa370('0x89')]}});}break;case _0xa370('0x9b'):if(_0x54be0c[_0xa370('0x65')][0x0][_0xa370('0x2c')]['id']){_0x167775=_0x54be0c['body'][0x0]['type'];return db[_0xa370('0xb2')]['find']({'where':{'messageId':_0x54be0c[_0xa370('0x65')][0x0]['message']['id']}});}break;case _0xa370('0x9c'):if(_0x54be0c[_0xa370('0x65')][_0xa370('0xd8')]&&_0x54be0c[_0xa370('0x65')][_0xa370('0x2e')]){_0x167775=_0x54be0c[_0xa370('0x65')][_0xa370('0x2e')];return db['SmsMessage']['find']({'where':{'messageId':_0x54be0c[_0xa370('0x65')]['redif']}});}break;}}})[_0xa370('0x24')](handleEntityNotFound(_0x5f04bf,null))['then'](function(_0x43014a){if(_0x43014a){_0x356dce=_0x43014a;switch(_0x1685f6[_0xa370('0x58')]){case _0xa370('0x8b'):if(_0x167775==='DELIVERED'){return _0x356dce['update']({'read':!![]});}else{logger[_0xa370('0x2a')](_0xa370('0x28'),_0xa370('0x2e'),'skebby',util['inspect'](_0x54be0c['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x167775==='1'){return _0x356dce[_0xa370('0x3a')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa370('0x2e'),_0xa370('0x8b'),util[_0xa370('0xd2')](_0x54be0c['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x54be0c[_0xa370('0x65')][_0xa370('0xd9')]&&_0x167775>=0xc8&&_0x167775<=0xce){return _0x356dce['update']({'read':!![]});}else{logger[_0xa370('0x2a')](_0xa370('0x28'),'status',_0xa370('0x8f'),util[_0xa370('0xd2')](_0x54be0c[_0xa370('0x65')],{'showHidden':![],'depth':null}));}break;case _0xa370('0x93'):var _0x42bcdf=_0x54be0c['body'][_0xa370('0x94')][0x0];if(_0x42bcdf[_0xa370('0x2e')][_0xa370('0xd7')]===_0xa370('0xda')){return _0x356dce[_0xa370('0x3a')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa370('0x2e'),_0xa370('0x93'),util[_0xa370('0xd2')](_0x54be0c[_0xa370('0x65')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x167775==_0xa370('0xdb')||_0x167775==_0xa370('0xdc')){return _0x356dce[_0xa370('0x3a')]({'read':!![]});}else{logger[_0xa370('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa370('0x2e'),_0xa370('0x98'),util[_0xa370('0xd2')](_0x54be0c[_0xa370('0x65')],{'showHidden':![],'depth':null}));}break;case _0xa370('0x9b'):if(_0x167775==_0xa370('0xdd')){return _0x356dce[_0xa370('0x3a')]({'read':!![]});}else{logger[_0xa370('0x2a')](_0xa370('0x28'),_0xa370('0x2e'),_0xa370('0x9b'),util['inspect'](_0x54be0c['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x167775===_0xa370('0xde')||_0x167775===_0xa370('0xdf')){return _0x356dce['update']({'read':!![]});}else{logger[_0xa370('0x2a')](_0xa370('0x28'),'status',_0xa370('0x9c'),util[_0xa370('0xd2')](_0x54be0c['body'],{'showHidden':![],'depth':null}));}break;}return _0x356dce;}})[_0xa370('0x24')](respondWithResult(_0x5f04bf,null))[_0xa370('0x63')](handleError(_0x5f04bf,null));};exports['statusGet']=function(_0x558ff6,_0xe30b55,_0x2f18c3){var _0x3ca58e,_0x1976e0,_0x4a38f2;return db[_0xa370('0x46')][_0xa370('0x62')]({'where':{'id':_0x558ff6['params']['id']}})['then'](handleEntityNotFound(_0xe30b55,null))[_0xa370('0x24')](function(_0x5de016){if(_0x5de016){_0x4a38f2=_0x5de016;logger[_0xa370('0xd1')](_0xa370('0x28'),_0xa370('0x2e'),_0xa370('0xe0'),_0x5de016[_0xa370('0x58')],util[_0xa370('0xd2')](_0x558ff6[_0xa370('0x4b')],{'showHidden':![],'depth':null}));switch(_0x5de016['type']){case _0xa370('0x95'):if(_0x558ff6[_0xa370('0x4b')]['message-id']&&_0x558ff6['query'][_0xa370('0xe1')]){_0x1976e0=_0x558ff6[_0xa370('0x4b')]['state'];return db[_0xa370('0xb2')][_0xa370('0x62')]({'where':{'messageId':_0x558ff6[_0xa370('0x4b')][_0xa370('0xe2')]}});}break;}}})[_0xa370('0x24')](handleEntityNotFound(_0xe30b55,null))[_0xa370('0x24')](function(_0x2e00da){if(_0x2e00da){_0x3ca58e=_0x2e00da;switch(_0x4a38f2['type']){case _0xa370('0x95'):if(_0x1976e0==='2'||_0x1976e0==='6'){return _0x3ca58e[_0xa370('0x3a')]({'read':!![]});}else{logger[_0xa370('0x2a')](_0xa370('0x28'),_0xa370('0x2e'),_0xa370('0x95'),util['inspect'](_0x558ff6['query'],{'showHidden':![],'depth':null}));};break;}return _0x3ca58e;}})[_0xa370('0x24')](respondWithResult(_0xe30b55,null))[_0xa370('0x63')](handleError(_0xe30b55,null));};exports['addAgents']=function(_0x3fcdc0,_0x21a3b0,_0x354017){return db[_0xa370('0x46')][_0xa370('0x62')]({'where':{'id':_0x3fcdc0[_0xa370('0x60')]['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x21a3b0,null))['then'](function(_0x16591b){if(_0x16591b){return _0x16591b['addAgents'](_0x3fcdc0[_0xa370('0x65')]['ids'],_[_0xa370('0xa6')](_0x3fcdc0[_0xa370('0x65')],['ids','id'])||{})[_0xa370('0xaa')](function(_0x331c84){for(var _0x39d1f2=0x0;_0x39d1f2<_0x3fcdc0['body'][_0xa370('0x72')][_0xa370('0x50')];_0x39d1f2+=0x1){socket[_0xa370('0xe3')]('userSmsAccount:save',{'UserId':Number(_0x3fcdc0[_0xa370('0x65')][_0xa370('0x72')][_0x39d1f2]),'SmsAccountId':Number(_0x3fcdc0[_0xa370('0x60')]['id'])});}return _0x331c84;});}})[_0xa370('0x24')](respondWithResult(_0x21a3b0,null))['catch'](handleError(_0x21a3b0,null));};exports['removeAgents']=function(_0x3ab1df,_0x3a8eea,_0x2eedf6){return db['SmsAccount'][_0xa370('0x62')]({'where':{'id':_0x3ab1df[_0xa370('0x60')]['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x3a8eea,null))[_0xa370('0x24')](function(_0x2a693d){if(_0x2a693d){return _0x2a693d['removeAgents'](_0x3ab1df[_0xa370('0x4b')]['ids'])[_0xa370('0x24')](function(){if(_['isArray'](_0x3ab1df['query']['ids'])){for(var _0x18972e=0x0;_0x18972e<_0x3ab1df['query'][_0xa370('0x72')][_0xa370('0x50')];_0x18972e+=0x1){socket[_0xa370('0xe3')](_0xa370('0xe4'),{'UserId':Number(_0x3ab1df[_0xa370('0x4b')][_0xa370('0x72')][_0x18972e]),'SmsAccountId':Number(_0x3ab1df[_0xa370('0x60')]['id'])});}}else{socket[_0xa370('0xe3')](_0xa370('0xe4'),{'UserId':Number(_0x3ab1df[_0xa370('0x4b')][_0xa370('0x72')]),'SmsAccountId':Number(_0x3ab1df[_0xa370('0x60')]['id'])});}});}})[_0xa370('0x24')](respondWithStatusCode(_0x3a8eea,null))[_0xa370('0x63')](handleError(_0x3a8eea,null));};exports[_0xa370('0xe5')]=function(_0x478560,_0x13b0f0,_0x1826e8){var _0x313148={};var _0xf68afc={};var _0x13597e;var _0xd88ce8;return db[_0xa370('0x46')]['findOne']({'where':{'id':_0x478560['params']['id']}})[_0xa370('0x24')](handleEntityNotFound(_0x13b0f0,null))['then'](function(_0x7eecba){if(_0x7eecba){_0x13597e=_0x7eecba;_0xf68afc[_0xa370('0x4a')]=_[_0xa370('0x4c')](db[_0xa370('0xb6')]['rawAttributes']);_0xf68afc[_0xa370('0x4b')]=_['keys'](_0x478560['query']);_0xf68afc[_0xa370('0x56')]=_[_0xa370('0x4d')](_0xf68afc[_0xa370('0x4a')],_0xf68afc[_0xa370('0x4b')]);_0x313148[_0xa370('0x4f')]=_[_0xa370('0x4d')](_0xf68afc[_0xa370('0x4a')],qs[_0xa370('0x4e')](_0x478560['query'][_0xa370('0x4e')]));_0x313148[_0xa370('0x4f')]=_0x313148[_0xa370('0x4f')][_0xa370('0x50')]?_0x313148[_0xa370('0x4f')]:_0xf68afc['model'];_0x313148[_0xa370('0x53')]=qs[_0xa370('0x54')](_0x478560[_0xa370('0x4b')][_0xa370('0x54')]);_0x313148[_0xa370('0x55')]=qs['filters'](_[_0xa370('0x57')](_0x478560['query'],_0xf68afc[_0xa370('0x56')]));if(_0x478560[_0xa370('0x4b')][_0xa370('0x70')]){_0x313148[_0xa370('0x55')]=_[_0xa370('0x61')](_0x313148[_0xa370('0x55')],{'$or':_[_0xa370('0x45')](_0x313148['attributes'],function(_0xbcb6e4){var _0x4624da={};_0x4624da[_0xbcb6e4]={'$like':'%'+_0x478560[_0xa370('0x4b')][_0xa370('0x70')]+'%'};return _0x4624da;})});}_0x313148=_['merge']({},_0x313148,_0x478560[_0xa370('0x5a')]);return _0x13597e[_0xa370('0xe5')](_0x313148);}})[_0xa370('0x24')](function(_0x17a11b){if(_0x17a11b){_0xd88ce8=_0x17a11b[_0xa370('0x50')];if(!_0x478560[_0xa370('0x4b')][_0xa370('0x51')](_0xa370('0x52'))){_0x313148[_0xa370('0x32')]=qs[_0xa370('0x32')](_0x478560[_0xa370('0x4b')][_0xa370('0x32')]);_0x313148['offset']=qs[_0xa370('0x30')](_0x478560[_0xa370('0x4b')][_0xa370('0x30')]);}return _0x13597e[_0xa370('0xe5')](_0x313148);}})['then'](function(_0x378bff){if(_0x378bff){return _0x378bff?{'count':_0xd88ce8,'rows':_0x378bff}:null;}})[_0xa370('0x24')](respondWithResult(_0x13b0f0,null))['catch'](handleError(_0x13b0f0,null));}; \ No newline at end of file +var _0x3a55=['status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','get','role','user','SmsAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','findOne','hasOwnProperty','pick','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','skebby','sender','text','message_id','plivo','Text','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','omit','contact','SmsInteraction','interaction','created','push','close','unmanaged','*,*,*,*','SmsMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','CmContact','fullname','internal','Tag','Tags','tag','send','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','intelepeer','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','then','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch'];(function(_0xc67084,_0x3e2efc){var _0x4d06c6=function(_0x2eb951){while(--_0x2eb951){_0xc67084['push'](_0xc67084['shift']());}};_0x4d06c6(++_0x3e2efc);}(_0x3a55,0xbd));var _0x53a5=function(_0x4e54aa,_0x306ce2){_0x4e54aa=_0x4e54aa-0x0;var _0x1506d7=_0x3a55[_0x4e54aa];return _0x1506d7;};'use strict';var emlformat=require(_0x53a5('0x0'));var rimraf=require(_0x53a5('0x1'));var zipdir=require(_0x53a5('0x2'));var jsonpatch=require(_0x53a5('0x3'));var rp=require(_0x53a5('0x4'));var moment=require(_0x53a5('0x5'));var BPromise=require(_0x53a5('0x6'));var Mustache=require(_0x53a5('0x7'));var util=require('util');var path=require('path');var sox=require(_0x53a5('0x8'));var csv=require(_0x53a5('0x9'));var ejs=require(_0x53a5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x53a5('0xb'));var squel=require(_0x53a5('0xc'));var crypto=require(_0x53a5('0xd'));var jsforce=require(_0x53a5('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x53a5('0xf'));var Papa=require(_0x53a5('0x10'));var Redis=require(_0x53a5('0x11'));var authService=require(_0x53a5('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x53a5('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x53a5('0x14'));var db=require(_0x53a5('0x15'))['db'];config['redis']=_[_0x53a5('0x16')](config['redis'],{'host':_0x53a5('0x17'),'port':0x18eb});var socket=require(_0x53a5('0x18'))(new Redis(config['redis']));require(_0x53a5('0x19'))[_0x53a5('0x1a')](socket);var jayson=require(_0x53a5('0x1b'));var client=jayson['client'][_0x53a5('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x1a0e0a,_0x2ce286,_0x9d17d1,_0x208505){return new BPromise(function(_0x3573d3,_0x1aa5bc){var _0x296428=_0x208505||client;return _0x296428['request'](_0x1a0e0a,_0x9d17d1)[_0x53a5('0x1d')](function(_0x393c8f){logger['info'](_0x53a5('0x1e'),_0x2ce286,'request\x20sent');logger['debug'](_0x53a5('0x1f'),_0x2ce286,_0x53a5('0x20'),JSON[_0x53a5('0x21')](_0x393c8f));if(_0x393c8f[_0x53a5('0x22')]){if(_0x393c8f[_0x53a5('0x22')]['code']===0x1f4){logger[_0x53a5('0x22')](_0x53a5('0x1e'),_0x2ce286,_0x393c8f[_0x53a5('0x22')]['message']);return _0x1aa5bc(_0x393c8f[_0x53a5('0x22')][_0x53a5('0x23')]);}logger[_0x53a5('0x22')](_0x53a5('0x1e'),_0x2ce286,_0x393c8f[_0x53a5('0x22')][_0x53a5('0x23')]);return _0x3573d3(_0x393c8f[_0x53a5('0x22')][_0x53a5('0x23')]);}else{logger[_0x53a5('0x24')](_0x53a5('0x1e'),_0x2ce286,'request\x20sent');_0x3573d3(_0x393c8f[_0x53a5('0x25')][_0x53a5('0x23')]);}})[_0x53a5('0x26')](function(_0x1558b1){logger['error'](_0x53a5('0x1e'),_0x2ce286,_0x1558b1);_0x1aa5bc(_0x1558b1);});});}function respondWithStatusCode(_0x502a48,_0xf2b203){_0xf2b203=_0xf2b203||0xcc;return function(_0x4d0732){if(_0x4d0732){return _0x502a48['sendStatus'](_0xf2b203);}return _0x502a48[_0x53a5('0x27')](_0xf2b203)[_0x53a5('0x28')]();};}function respondWithResult(_0x4cff0a,_0x3c3802){_0x3c3802=_0x3c3802||0xc8;return function(_0x2a4049){if(_0x2a4049){return _0x4cff0a[_0x53a5('0x27')](_0x3c3802)['json'](_0x2a4049);}};}function respondWithFilteredResult(_0x305461,_0xace6e4){return function(_0x1beba8){if(_0x1beba8){var _0x5d6490=typeof _0xace6e4[_0x53a5('0x29')]===_0x53a5('0x2a')&&typeof _0xace6e4[_0x53a5('0x2b')]===_0x53a5('0x2a');var _0x5c87e1=_0x1beba8[_0x53a5('0x2c')];var _0x52e5ce=_0x5d6490?0x0:_0xace6e4['offset'];var _0xcd5f64=_0x5d6490?_0x1beba8['count']:_0xace6e4['offset']+_0xace6e4['limit'];var _0xabf6df;if(_0xcd5f64>=_0x5c87e1){_0xcd5f64=_0x5c87e1;_0xabf6df=0xc8;}else{_0xabf6df=0xce;}_0x305461['status'](_0xabf6df);return _0x305461[_0x53a5('0x2d')](_0x53a5('0x2e'),_0x52e5ce+'-'+_0xcd5f64+'/'+_0x5c87e1)[_0x53a5('0x2f')](_0x1beba8);}return null;};}function patchUpdates(_0x1ab32c){return function(_0x398817){try{jsonpatch[_0x53a5('0x30')](_0x398817,_0x1ab32c,!![]);}catch(_0x73f634){return BPromise['reject'](_0x73f634);}return _0x398817[_0x53a5('0x31')]();};}function saveUpdates(_0x54fd22,_0x3e0a9c){return function(_0x10729f){if(_0x10729f){return _0x10729f[_0x53a5('0x32')](_0x54fd22)[_0x53a5('0x1d')](function(_0x43201f){return _0x43201f;});}return null;};}function removeEntity(_0x29a183,_0x24b6ea){return function(_0x2c340f){if(_0x2c340f){return _0x2c340f[_0x53a5('0x33')]()[_0x53a5('0x1d')](function(){var _0x251cfb=_0x2c340f['get']({'plain':!![]});var _0x362b1d='SmsAccounts';return db[_0x53a5('0x34')]['destroy']({'where':{'type':_0x362b1d,'resourceId':_0x251cfb['id']}})['then'](function(){return _0x2c340f;});})[_0x53a5('0x1d')](function(){_0x29a183[_0x53a5('0x27')](0xcc)[_0x53a5('0x28')]();});}};}function handleEntityNotFound(_0x34ac40,_0x3b80ca){return function(_0x13f550){if(!_0x13f550){_0x34ac40[_0x53a5('0x35')](0x194);}return _0x13f550;};}function handleError(_0x2e8ed0,_0x5678b2){_0x5678b2=_0x5678b2||0x1f4;return function(_0x3c61f7){logger[_0x53a5('0x22')](_0x3c61f7[_0x53a5('0x36')]);if(_0x3c61f7[_0x53a5('0x37')]){delete _0x3c61f7[_0x53a5('0x37')];}_0x2e8ed0[_0x53a5('0x27')](_0x5678b2)['send'](_0x3c61f7);};}exports[_0x53a5('0x38')]=function(_0x58c899,_0x59811a){var _0x201390={'include':[{'model':db[_0x53a5('0x39')],'as':_0x53a5('0x3a')}]},_0xa89c10={},_0x3e379a={'count':0x0,'rows':[]};var _0x260f0b=_[_0x53a5('0x3b')](db[_0x53a5('0x3c')][_0x53a5('0x3d')],function(_0x305833){return{'name':_0x305833[_0x53a5('0x3e')],'type':_0x305833[_0x53a5('0x3f')]['key']};});_0xa89c10[_0x53a5('0x40')]=_[_0x53a5('0x3b')](_0x260f0b,_0x53a5('0x37'));_0xa89c10[_0x53a5('0x41')]=_[_0x53a5('0x42')](_0x58c899[_0x53a5('0x41')]);_0xa89c10['filters']=_[_0x53a5('0x43')](_0xa89c10[_0x53a5('0x40')],_0xa89c10['query']);_0x201390[_0x53a5('0x44')]=_[_0x53a5('0x43')](_0xa89c10[_0x53a5('0x40')],qs[_0x53a5('0x45')](_0x58c899['query'][_0x53a5('0x45')]));_0x201390[_0x53a5('0x44')]=_0x201390['attributes'][_0x53a5('0x46')]?_0x201390[_0x53a5('0x44')]:_0xa89c10[_0x53a5('0x40')];if(!_0x58c899['query']['hasOwnProperty'](_0x53a5('0x47'))){_0x201390[_0x53a5('0x2b')]=qs[_0x53a5('0x2b')](_0x58c899[_0x53a5('0x41')][_0x53a5('0x2b')]);_0x201390[_0x53a5('0x29')]=qs[_0x53a5('0x29')](_0x58c899['query'][_0x53a5('0x29')]);}_0x201390[_0x53a5('0x48')]=qs[_0x53a5('0x49')](_0x58c899[_0x53a5('0x41')]['sort']);_0x201390[_0x53a5('0x4a')]=qs[_0x53a5('0x4b')](_['pick'](_0x58c899[_0x53a5('0x41')],_0xa89c10['filters']),_0x260f0b);if(_0x58c899[_0x53a5('0x41')][_0x53a5('0x4c')]){_0x201390[_0x53a5('0x4a')]=_[_0x53a5('0x4d')](_0x201390[_0x53a5('0x4a')],{'$or':_[_0x53a5('0x3b')](_0x260f0b,function(_0x35efc4){if(_0x35efc4[_0x53a5('0x3f')]!==_0x53a5('0x4e')){var _0x4d6379={};_0x4d6379[_0x35efc4[_0x53a5('0x37')]]={'$like':'%'+_0x58c899[_0x53a5('0x41')]['filter']+'%'};return _0x4d6379;}})});}_0x201390=_[_0x53a5('0x4d')]({},_0x201390,_0x58c899[_0x53a5('0x4f')]);var _0x21e816={'where':_0x201390[_0x53a5('0x4a')]};return db['SmsAccount']['count'](_0x21e816)[_0x53a5('0x1d')](function(_0x57be8d){_0x3e379a[_0x53a5('0x2c')]=_0x57be8d;if(_0x58c899[_0x53a5('0x41')][_0x53a5('0x50')]){_0x201390[_0x53a5('0x51')]=[{'all':!![]}];}return db[_0x53a5('0x3c')][_0x53a5('0x52')](_0x201390);})[_0x53a5('0x1d')](function(_0xe66ff0){_0x3e379a[_0x53a5('0x53')]=_0xe66ff0;return _0x3e379a;})[_0x53a5('0x1d')](respondWithFilteredResult(_0x59811a,_0x201390))[_0x53a5('0x26')](handleError(_0x59811a,null));};exports[_0x53a5('0x54')]=function(_0x5cf6fd,_0x508d32){var _0x2ccc88={'raw':![],'where':{'id':_0x5cf6fd[_0x53a5('0x55')]['id']},'include':[{'model':db[_0x53a5('0x39')],'as':'mandatoryDispositionPause'}]},_0x12e975={};_0x12e975[_0x53a5('0x40')]=_[_0x53a5('0x42')](db[_0x53a5('0x3c')][_0x53a5('0x3d')]);_0x12e975[_0x53a5('0x41')]=_['keys'](_0x5cf6fd[_0x53a5('0x41')]);_0x12e975[_0x53a5('0x4b')]=_[_0x53a5('0x43')](_0x12e975[_0x53a5('0x40')],_0x12e975['query']);_0x2ccc88['attributes']=_[_0x53a5('0x43')](_0x12e975['model'],qs[_0x53a5('0x45')](_0x5cf6fd[_0x53a5('0x41')][_0x53a5('0x45')]));_0x2ccc88['attributes']=_0x2ccc88[_0x53a5('0x44')][_0x53a5('0x46')]?_0x2ccc88[_0x53a5('0x44')]:_0x12e975[_0x53a5('0x40')];if(_0x5cf6fd[_0x53a5('0x41')][_0x53a5('0x50')]){_0x2ccc88[_0x53a5('0x51')]=[{'all':!![]}];}_0x2ccc88=_[_0x53a5('0x4d')]({},_0x2ccc88,_0x5cf6fd[_0x53a5('0x4f')]);return db[_0x53a5('0x3c')][_0x53a5('0x56')](_0x2ccc88)[_0x53a5('0x1d')](handleEntityNotFound(_0x508d32,null))['then'](respondWithResult(_0x508d32,null))['catch'](handleError(_0x508d32,null));};exports[_0x53a5('0x57')]=function(_0x5498f5,_0x1ef7bf){return db['SmsAccount']['create'](_0x5498f5[_0x53a5('0x58')],{})[_0x53a5('0x1d')](function(_0x595a4c){var _0x14efb2=_0x5498f5['user'][_0x53a5('0x59')]({'plain':!![]});if(!_0x14efb2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14efb2[_0x53a5('0x5a')]===_0x53a5('0x5b')){var _0x516825=_0x595a4c[_0x53a5('0x59')]({'plain':!![]});var _0x12a0f1=_0x53a5('0x5c');return db['UserProfileSection'][_0x53a5('0x56')]({'where':{'name':_0x12a0f1,'userProfileId':_0x14efb2[_0x53a5('0x5d')]},'raw':!![]})[_0x53a5('0x1d')](function(_0xb3011f){if(_0xb3011f&&_0xb3011f[_0x53a5('0x5e')]===0x0){return db[_0x53a5('0x34')]['create']({'name':_0x516825[_0x53a5('0x37')],'resourceId':_0x516825['id'],'type':_0xb3011f[_0x53a5('0x37')],'sectionId':_0xb3011f['id']},{})[_0x53a5('0x1d')](function(){return _0x595a4c;});}else{return _0x595a4c;}})[_0x53a5('0x26')](function(_0x508239){logger['error'](_0x53a5('0x5f'),_0x508239);throw _0x508239;});}return _0x595a4c;})['then'](respondWithResult(_0x1ef7bf,0xc9))[_0x53a5('0x26')](handleError(_0x1ef7bf,null));};exports[_0x53a5('0x32')]=function(_0x5e1b1b,_0x3a3ef2){if(_0x5e1b1b[_0x53a5('0x58')]['id']){delete _0x5e1b1b[_0x53a5('0x58')]['id'];}return db[_0x53a5('0x3c')][_0x53a5('0x56')]({'where':{'id':_0x5e1b1b[_0x53a5('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x53a5('0x3a')}]})[_0x53a5('0x1d')](handleEntityNotFound(_0x3a3ef2,null))[_0x53a5('0x1d')](saveUpdates(_0x5e1b1b[_0x53a5('0x58')],null))[_0x53a5('0x1d')](respondWithResult(_0x3a3ef2,null))[_0x53a5('0x26')](handleError(_0x3a3ef2,null));};exports[_0x53a5('0x33')]=function(_0x357452,_0x31a4a4){return db[_0x53a5('0x3c')][_0x53a5('0x56')]({'where':{'id':_0x357452['params']['id']}})['then'](handleEntityNotFound(_0x31a4a4,null))['then'](removeEntity(_0x31a4a4,null))[_0x53a5('0x26')](handleError(_0x31a4a4,null));};exports[_0x53a5('0x60')]=function(_0x3bcd81,_0x2f2918){return db[_0x53a5('0x3c')][_0x53a5('0x60')]()['then'](respondWithResult(_0x2f2918,null))[_0x53a5('0x26')](handleError(_0x2f2918,null));};exports[_0x53a5('0x61')]=function(_0xf90055,_0x5db69e,_0x3581fa){if(_0xf90055[_0x53a5('0x58')]['id']){delete _0xf90055[_0x53a5('0x58')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0xf90055['params']['id']}})[_0x53a5('0x1d')](handleEntityNotFound(_0x5db69e,null))[_0x53a5('0x1d')](function(_0x5a506a){if(_0x5a506a){_0xf90055[_0x53a5('0x58')][_0x53a5('0x62')]=_0x5a506a['id'];return db[_0x53a5('0x63')][_0x53a5('0x57')](_0xf90055[_0x53a5('0x58')]);}})[_0x53a5('0x1d')](respondWithResult(_0x5db69e,null))[_0x53a5('0x26')](handleError(_0x5db69e,null));};exports['getDispositions']=function(_0x5ced6d,_0x2be114,_0x102aa2){var _0x22fa4b={'raw':![],'where':{}};var _0x5027d2={};var _0x55cd73={'count':0x0,'rows':[]};return db['SmsAccount'][_0x53a5('0x64')]({'where':{'id':_0x5ced6d[_0x53a5('0x55')]['id']}})[_0x53a5('0x1d')](handleEntityNotFound(_0x2be114,null))[_0x53a5('0x1d')](function(_0x50d302){if(_0x50d302){_0x5027d2[_0x53a5('0x40')]=_[_0x53a5('0x42')](db[_0x53a5('0x63')][_0x53a5('0x3d')]);_0x5027d2[_0x53a5('0x41')]=_[_0x53a5('0x42')](_0x5ced6d[_0x53a5('0x41')]);_0x5027d2[_0x53a5('0x4b')]=_[_0x53a5('0x43')](_0x5027d2[_0x53a5('0x40')],_0x5027d2['query']);_0x22fa4b[_0x53a5('0x44')]=_[_0x53a5('0x43')](_0x5027d2[_0x53a5('0x40')],qs[_0x53a5('0x45')](_0x5ced6d['query']['fields']));_0x22fa4b[_0x53a5('0x44')]=_0x22fa4b[_0x53a5('0x44')][_0x53a5('0x46')]?_0x22fa4b['attributes']:_0x5027d2[_0x53a5('0x40')];if(!_0x5ced6d[_0x53a5('0x41')][_0x53a5('0x65')](_0x53a5('0x47'))){_0x22fa4b['limit']=qs[_0x53a5('0x2b')](_0x5ced6d['query'][_0x53a5('0x2b')]);_0x22fa4b[_0x53a5('0x29')]=qs['offset'](_0x5ced6d[_0x53a5('0x41')]['offset']);}_0x22fa4b['order']=qs['sort'](_0x5ced6d[_0x53a5('0x41')][_0x53a5('0x49')]);_0x22fa4b[_0x53a5('0x4a')]=qs[_0x53a5('0x4b')](_[_0x53a5('0x66')](_0x5ced6d[_0x53a5('0x41')],_0x5027d2[_0x53a5('0x4b')]));_0x22fa4b['where'][_0x53a5('0x62')]=_0x50d302['id'];if(_0x5ced6d['query'][_0x53a5('0x4c')]){_0x22fa4b[_0x53a5('0x4a')]=_['merge'](_0x22fa4b[_0x53a5('0x4a')],{'$or':_[_0x53a5('0x3b')](_0x22fa4b[_0x53a5('0x44')],function(_0x52c6c2){var _0x4adad4={};_0x4adad4[_0x52c6c2]={'$like':'%'+_0x5ced6d[_0x53a5('0x41')][_0x53a5('0x4c')]+'%'};return _0x4adad4;})});}_0x22fa4b=_['merge']({},_0x22fa4b,_0x5ced6d[_0x53a5('0x4f')]);return db[_0x53a5('0x63')]['count']({'where':_0x22fa4b[_0x53a5('0x4a')]})[_0x53a5('0x1d')](function(_0x258ea5){_0x55cd73['count']=_0x258ea5;if(_0x5ced6d['query'][_0x53a5('0x50')]){_0x22fa4b[_0x53a5('0x51')]=[{'all':!![]}];}return db[_0x53a5('0x63')]['findAll'](_0x22fa4b);})[_0x53a5('0x1d')](function(_0x661299){_0x55cd73['rows']=_0x661299;return _0x55cd73;});}})[_0x53a5('0x1d')](respondWithFilteredResult(_0x2be114,_0x22fa4b))[_0x53a5('0x26')](handleError(_0x2be114,null));};exports[_0x53a5('0x67')]=function(_0x397ea8,_0x2da9f2,_0x2bc74a){return db[_0x53a5('0x3c')][_0x53a5('0x56')]({'where':{'id':_0x397ea8[_0x53a5('0x55')]['id']}})[_0x53a5('0x1d')](handleEntityNotFound(_0x2da9f2,null))['then'](function(_0x174888){if(_0x174888){return _0x174888['removeDispositions'](_0x397ea8[_0x53a5('0x41')][_0x53a5('0x68')]);}})[_0x53a5('0x1d')](respondWithStatusCode(_0x2da9f2,null))[_0x53a5('0x26')](handleError(_0x2da9f2,null));};exports[_0x53a5('0x69')]=function(_0x534aa3,_0x253922,_0x58d6b8){if(_0x534aa3[_0x53a5('0x58')]['id']){delete _0x534aa3[_0x53a5('0x58')]['id'];}return db['SmsAccount'][_0x53a5('0x56')]({'where':{'id':_0x534aa3['params']['id']}})[_0x53a5('0x1d')](handleEntityNotFound(_0x253922,null))[_0x53a5('0x1d')](function(_0x329130){if(_0x329130){_0x534aa3[_0x53a5('0x58')][_0x53a5('0x62')]=_0x329130['id'];return db['CannedAnswer'][_0x53a5('0x57')](_0x534aa3[_0x53a5('0x58')]);}})['then'](respondWithResult(_0x253922,null))[_0x53a5('0x26')](handleError(_0x253922,null));};exports[_0x53a5('0x6a')]=function(_0x2a1a18,_0xfa8e6c,_0x1d19cd){var _0x58f499={'raw':![],'where':{}};var _0x2c4890={};var _0x1b19b9={'count':0x0,'rows':[]};return db[_0x53a5('0x3c')]['findOne']({'where':{'id':_0x2a1a18[_0x53a5('0x55')]['id']}})[_0x53a5('0x1d')](handleEntityNotFound(_0xfa8e6c,null))['then'](function(_0x1980f2){if(_0x1980f2){_0x2c4890[_0x53a5('0x40')]=_[_0x53a5('0x42')](db['CannedAnswer']['rawAttributes']);_0x2c4890[_0x53a5('0x41')]=_[_0x53a5('0x42')](_0x2a1a18['query']);_0x2c4890[_0x53a5('0x4b')]=_[_0x53a5('0x43')](_0x2c4890[_0x53a5('0x40')],_0x2c4890[_0x53a5('0x41')]);_0x58f499[_0x53a5('0x44')]=_['intersection'](_0x2c4890['model'],qs[_0x53a5('0x45')](_0x2a1a18[_0x53a5('0x41')]['fields']));_0x58f499[_0x53a5('0x44')]=_0x58f499[_0x53a5('0x44')][_0x53a5('0x46')]?_0x58f499[_0x53a5('0x44')]:_0x2c4890['model'];if(!_0x2a1a18[_0x53a5('0x41')]['hasOwnProperty'](_0x53a5('0x47'))){_0x58f499[_0x53a5('0x2b')]=qs['limit'](_0x2a1a18[_0x53a5('0x41')]['limit']);_0x58f499['offset']=qs['offset'](_0x2a1a18[_0x53a5('0x41')][_0x53a5('0x29')]);}_0x58f499['order']=qs[_0x53a5('0x49')](_0x2a1a18['query'][_0x53a5('0x49')]);_0x58f499['where']=qs[_0x53a5('0x4b')](_[_0x53a5('0x66')](_0x2a1a18[_0x53a5('0x41')],_0x2c4890[_0x53a5('0x4b')]));_0x58f499['where']['SmsAccountId']=_0x1980f2['id'];if(_0x2a1a18[_0x53a5('0x41')][_0x53a5('0x4c')]){_0x58f499['where']=_[_0x53a5('0x4d')](_0x58f499['where'],{'$or':_[_0x53a5('0x3b')](_0x58f499[_0x53a5('0x44')],function(_0x4702a9){var _0x168379={};_0x168379[_0x4702a9]={'$like':'%'+_0x2a1a18[_0x53a5('0x41')][_0x53a5('0x4c')]+'%'};return _0x168379;})});}_0x58f499=_[_0x53a5('0x4d')]({},_0x58f499,_0x2a1a18['options']);return db['CannedAnswer'][_0x53a5('0x2c')]({'where':_0x58f499['where']})[_0x53a5('0x1d')](function(_0x5edcda){_0x1b19b9[_0x53a5('0x2c')]=_0x5edcda;if(_0x2a1a18[_0x53a5('0x41')]['includeAll']){_0x58f499['include']=[{'all':!![]}];}return db[_0x53a5('0x6b')]['findAll'](_0x58f499);})['then'](function(_0x15fd94){_0x1b19b9[_0x53a5('0x53')]=_0x15fd94;return _0x1b19b9;});}})[_0x53a5('0x1d')](respondWithFilteredResult(_0xfa8e6c,_0x58f499))[_0x53a5('0x26')](handleError(_0xfa8e6c,null));};exports['removeAnswers']=function(_0x1d3b8d,_0x24b186,_0x59a155){return db['SmsAccount']['find']({'where':{'id':_0x1d3b8d[_0x53a5('0x55')]['id']}})['then'](handleEntityNotFound(_0x24b186,null))[_0x53a5('0x1d')](function(_0x456983){if(_0x456983){return _0x456983[_0x53a5('0x6c')](_0x1d3b8d[_0x53a5('0x41')][_0x53a5('0x68')]);}})[_0x53a5('0x1d')](respondWithStatusCode(_0x24b186,null))[_0x53a5('0x26')](handleError(_0x24b186,null));};exports[_0x53a5('0x6d')]=function(_0xe468eb,_0x3324f9,_0x45bda8){var _0x252502={'channel':_0x53a5('0x6e')};var _0x48df10=[];var _0x3b134d=[];var _0x28dae3={};return db['SmsAccount'][_0x53a5('0x56')]({'where':{'id':_0xe468eb[_0x53a5('0x55')]['id']},'include':[{'model':db[_0x53a5('0x6f')],'as':_0x53a5('0x70')}]})[_0x53a5('0x1d')](handleEntityNotFound(_0x3324f9,null))[_0x53a5('0x1d')](function(_0x37d9c8){_0x252502[_0x53a5('0x71')]=_0x37d9c8;_0x252502[_0x53a5('0x72')]=_[_0x53a5('0x73')](_0x37d9c8[_0x53a5('0x70')],[_0x53a5('0x74')],[_0x53a5('0x75')]);if(_0x252502[_0x53a5('0x71')][_0x53a5('0x70')]){delete _0x252502[_0x53a5('0x71')]['Applications'];}return db['CmContact'][_0x53a5('0x60')]();})[_0x53a5('0x1d')](function(_0x2c63a9){if(!_0x2c63a9){throw new db[(_0x53a5('0x76'))][(_0x53a5('0x77'))](_0x53a5('0x78'));}_0x48df10=_['difference'](_[_0x53a5('0x42')](_0x2c63a9),[_0x53a5('0x79'),'updatedAt']);_0x3b134d=_[_0x53a5('0x7a')](_[_0x53a5('0x42')](_0x2c63a9),[_0x53a5('0x79'),_0x53a5('0x7b'),_0x53a5('0x7c'),_0x53a5('0x7d')]);_0x252502['body']={'mapKey':_0x53a5('0x7e')};if(_0x252502['account']['type']){switch(_0x252502[_0x53a5('0x71')][_0x53a5('0x3f')]){case'twilio':_0x252502[_0x53a5('0x58')][_0x53a5('0x7f')]=_0xe468eb[_0x53a5('0x58')][_0x53a5('0x80')];_0x252502[_0x53a5('0x58')][_0x53a5('0x58')]=_0xe468eb[_0x53a5('0x58')][_0x53a5('0x81')];_0x252502[_0x53a5('0x58')][_0x53a5('0x82')]=_0xe468eb[_0x53a5('0x58')][_0x53a5('0x83')];break;case _0x53a5('0x84'):_0x252502[_0x53a5('0x58')][_0x53a5('0x7f')]='+'+_0xe468eb[_0x53a5('0x58')][_0x53a5('0x85')];_0x252502[_0x53a5('0x58')][_0x53a5('0x58')]=_0xe468eb[_0x53a5('0x58')][_0x53a5('0x86')];break;case'connectel':_0x252502[_0x53a5('0x58')][_0x53a5('0x7f')]=_0xe468eb[_0x53a5('0x58')][_0x53a5('0x7f')];_0x252502[_0x53a5('0x58')][_0x53a5('0x58')]=_0xe468eb[_0x53a5('0x58')][_0x53a5('0x23')];break;case'clicksend':_0x252502[_0x53a5('0x58')][_0x53a5('0x7f')]=_0xe468eb[_0x53a5('0x58')][_0x53a5('0x7f')];_0x252502[_0x53a5('0x58')][_0x53a5('0x58')]=_0xe468eb['body'][_0x53a5('0x58')];_0x252502['body'][_0x53a5('0x82')]=_0xe468eb['body'][_0x53a5('0x87')];break;case _0x53a5('0x88'):_0x252502['body']['from']=_0xe468eb[_0x53a5('0x58')][_0x53a5('0x80')];_0x252502[_0x53a5('0x58')][_0x53a5('0x58')]=_0xe468eb[_0x53a5('0x58')][_0x53a5('0x89')];_0x252502[_0x53a5('0x58')][_0x53a5('0x82')]=_0xe468eb[_0x53a5('0x58')]['MessageUUID'];break;case _0x53a5('0x8a'):_0x252502[_0x53a5('0x58')]['from']='+'+_0xe468eb[_0x53a5('0x58')][_0x53a5('0x8b')][0x0]['from'];_0x252502['body'][_0x53a5('0x58')]=_0xe468eb['body'][_0x53a5('0x8b')][0x0][_0x53a5('0x86')];_0x252502[_0x53a5('0x58')][_0x53a5('0x82')]=_0xe468eb[_0x53a5('0x58')][_0x53a5('0x8b')][0x0][_0x53a5('0x82')];break;case _0x53a5('0x8c'):_0x252502[_0x53a5('0x58')][_0x53a5('0x7f')]=_0xe468eb[_0x53a5('0x58')][_0x53a5('0x8d')];_0x252502['body']['body']=_0xe468eb[_0x53a5('0x58')][_0x53a5('0x8e')][_0x53a5('0x23')];break;case _0x53a5('0x8f'):_0x252502[_0x53a5('0x58')][_0x53a5('0x7f')]=_0xe468eb[_0x53a5('0x58')][_0x53a5('0x90')];_0x252502[_0x53a5('0x58')][_0x53a5('0x58')]=_0xe468eb[_0x53a5('0x58')][_0x53a5('0x86')];_0x252502[_0x53a5('0x58')][_0x53a5('0x82')]=_0xe468eb['body'][_0x53a5('0x91')];break;case _0x53a5('0x92'):_0x252502['body'][_0x53a5('0x82')]=_0xe468eb[_0x53a5('0x58')][0x0]['message']['id'];_0x252502[_0x53a5('0x58')][_0x53a5('0x7f')]=_0xe468eb[_0x53a5('0x58')][0x0][_0x53a5('0x23')]['from'];_0x252502['body'][_0x53a5('0x58')]=_0xe468eb[_0x53a5('0x58')][0x0]['message']['text'];break;case'intelepeer':_0x252502[_0x53a5('0x58')][_0x53a5('0x7f')]=_0xe468eb[_0x53a5('0x58')]['from'];_0x252502['body'][_0x53a5('0x58')]=_0xe468eb[_0x53a5('0x58')][_0x53a5('0x23')];_0x252502[_0x53a5('0x58')][_0x53a5('0x82')]=_0xe468eb[_0x53a5('0x58')][_0x53a5('0x93')];break;}}if(_0x252502[_0x53a5('0x58')]['id']){delete _0x252502[_0x53a5('0x58')]['id'];}if(_[_0x53a5('0x94')](_0x252502[_0x53a5('0x58')][_0x53a5('0x7f')])){throw new db[(_0x53a5('0x76'))][(_0x53a5('0x77'))](_0x53a5('0x95'));}if(_[_0x53a5('0x94')](_0x252502[_0x53a5('0x58')][_0x53a5('0x58')])||_0x252502[_0x53a5('0x58')]['body']===''){throw new db[(_0x53a5('0x76'))][(_0x53a5('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x53a5('0x94')](_0x252502[_0x53a5('0x58')][_0x53a5('0x96')])){throw new db[(_0x53a5('0x76'))][(_0x53a5('0x77'))](_0x53a5('0x97')+_0x3b134d);}if(!_[_0x53a5('0x98')](_0x3b134d,_0x252502[_0x53a5('0x58')][_0x53a5('0x96')])){throw new db['Sequelize'][(_0x53a5('0x77'))](_0x53a5('0x99')+_0x3b134d);}_0x28dae3[_0x252502[_0x53a5('0x58')][_0x53a5('0x96')]]=_0x252502['body']['from'];return db[_0x53a5('0x9a')][_0x53a5('0x56')]({'where':{'id':_0x252502[_0x53a5('0x71')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x53a5('0x9b'),'where':_0x28dae3,'limit':0x1,'order':[[_0x53a5('0x7b'),_0x53a5('0x9c')]]}]});})['then'](handleEntityNotFound(_0x3324f9,null))['then'](function(_0x1018c4){if(_0x1018c4){_0x252502['list']=_[_0x53a5('0x9d')](_0x1018c4,['Contacts']);if(_0x1018c4[_0x53a5('0x9b')][_0x53a5('0x46')]){return _0x1018c4[_0x53a5('0x9b')][0x0];}var _0x12dee6=_[_0x53a5('0x16')](_0x252502[_0x53a5('0x58')],{'firstName':_0x252502['body'][_0x53a5('0x7f')],'ListId':_0x1018c4['id']});_0x12dee6[_0x252502[_0x53a5('0x58')][_0x53a5('0x96')]]=_0x252502['body']['from'];return db['CmContact'][_0x53a5('0x57')](_0x12dee6,{'fields':_0x48df10,'raw':!![]});}})['then'](handleEntityNotFound(_0x3324f9,null))['then'](function(_0x102b70){if(_0x102b70){_0x252502[_0x53a5('0x9e')]=_0x102b70;var _0x525801={'ContactId':_0x102b70['id'],'phone':_0x252502['body']['from'],'SmsAccountId':_0xe468eb[_0x53a5('0x55')]['id']};var _0x4ec524={'ContactId':_0x102b70['id'],'SmsAccountId':_0xe468eb[_0x53a5('0x55')]['id'],'closed':![]};return db['SmsInteraction'][_0x53a5('0x56')]({'where':_0x4ec524})['then'](function(_0x2636dd){if(_0x2636dd){return[_0x2636dd,![]];}return db[_0x53a5('0x9f')][_0x53a5('0x57')](_0x525801)[_0x53a5('0x1d')](function(_0x55aa76){return[_0x55aa76,!![]];});});}})['spread'](function(_0x462d5e,_0x322e4d){_0x252502[_0x53a5('0xa0')]=_0x462d5e[_0x53a5('0x59')]({'plain':!![]});_0x252502[_0x53a5('0xa0')][_0x53a5('0xa1')]=![];if(_0x322e4d){if(_0x252502[_0x53a5('0x71')]['autoclose']){_0x252502[_0x53a5('0x72')][_0x53a5('0xa2')]({'id':0x0,'priority':_0x252502['applications'][_0x53a5('0x46')]+0x1,'app':_0x53a5('0xa3'),'appdata':_0x53a5('0xa4'),'interval':_0x53a5('0xa5')});}_0x252502[_0x53a5('0xa0')][_0x53a5('0xa1')]=!![];}return db[_0x53a5('0xa6')][_0x53a5('0x57')]({'phone':_0x252502[_0x53a5('0x58')]['from'],'messageId':_0x252502[_0x53a5('0x58')][_0x53a5('0x82')],'body':_0x252502['body']['body'],'SmsAccountId':_0xe468eb['params']['id'],'SmsInteractionId':_0x462d5e['id'],'direction':'in','ContactId':_0x462d5e['ContactId'],'AttachmentId':_0x252502[_0x53a5('0x58')]['AttachmentId']});})[_0x53a5('0x1d')](function(_0x484667){_0x252502[_0x53a5('0x23')]=_0x484667;if(_0x252502[_0x53a5('0xa0')][_0x53a5('0xa7')]){return db[_0x53a5('0xa8')]['find']({'attributes':['id',_0x53a5('0x37')],'where':{'id':_0x252502[_0x53a5('0xa0')][_0x53a5('0xa7')]}})[_0x53a5('0x1d')](function(_0x486e0a){if(_0x486e0a){_0x252502[_0x53a5('0x72')][_0x53a5('0xa9')]({'id':0x0,'priority':0x0,'app':_0x53a5('0xaa'),'appdata':_0x486e0a[_0x53a5('0x37')]+','+(_0x252502['account'][_0x53a5('0xab')]||0xa),'interval':_0x53a5('0xa5')});}return respondWithRpcPromise(_0x53a5('0xac'),_0x53a5('0xad'),_0x252502);});}return respondWithRpcPromise(_0x53a5('0xac'),_0x53a5('0xad'),_0x252502);})[_0x53a5('0x1d')](function(_0xa91407){if(_0xa91407){var _0x2cf906=0xc8;var _0x5bca6c='receiveMessage';logger[_0x53a5('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5bca6c,_0x2cf906,_0x53a5('0xae'));logger['debug'](_0x53a5('0xaf'),_0x5bca6c,_0x2cf906,_0x53a5('0xae'),JSON['stringify'](_0xa91407));if(_0x252502[_0x53a5('0x71')][_0x53a5('0x3f')]===_0x53a5('0xb0')){return _0x3324f9[_0x53a5('0x27')](_0x2cf906)[_0x53a5('0x2d')](_0x53a5('0xb1'),_0x53a5('0xb2'))['send'](_0x53a5('0xb3'));}else{return _0x3324f9['status'](_0x2cf906)[_0x53a5('0x2f')](_0xa91407);}}})[_0x53a5('0x26')](handleError(_0x3324f9,null));};exports[_0x53a5('0xb4')]=function(_0x1eb350,_0x22cc57,_0x3badf9){return db[_0x53a5('0x3c')][_0x53a5('0x64')]({'where':{'id':_0x1eb350[_0x53a5('0x55')]['id']}})[_0x53a5('0x1d')](handleEntityNotFound(_0x22cc57,null))[_0x53a5('0x1d')](function(_0x30edf5){if(_0x30edf5){return db['sequelize'][_0x53a5('0xb5')](function(_0xacdcf){return db[_0x53a5('0x6f')][_0x53a5('0x33')]({'where':{'SmsAccountId':_0x1eb350[_0x53a5('0x55')]['id']},'transaction':_0xacdcf})['then'](function(_0x2275ac){var _0x3a6525=_[_0x53a5('0x3b')](_0x1eb350['body'],function(_0x5ea545){_0x5ea545['SmsAccountId']=_0x1eb350[_0x53a5('0x55')]['id'];return _0x5ea545;});return db[_0x53a5('0x6f')][_0x53a5('0xb6')](_0x3a6525,{'transaction':_0xacdcf});});})[_0x53a5('0x1d')](function(){return db[_0x53a5('0x6f')][_0x53a5('0xb7')]({'where':{'SmsAccountId':_0x1eb350[_0x53a5('0x55')]['id']},'order':'priority'});});}})[_0x53a5('0x1d')](respondWithResult(_0x22cc57,null))[_0x53a5('0x26')](handleError(_0x22cc57,null));};exports[_0x53a5('0xb8')]=function(_0x1a606c,_0x25d2a5,_0x1726c3){var _0x148bef={};var _0x1deab6={};var _0x372f2e;var _0x204b0b;return db['SmsAccount'][_0x53a5('0x64')]({'where':{'id':_0x1a606c[_0x53a5('0x55')]['id']}})['then'](handleEntityNotFound(_0x25d2a5,null))[_0x53a5('0x1d')](function(_0x24e970){if(_0x24e970){_0x372f2e=_0x24e970;_0x1deab6[_0x53a5('0x40')]=_[_0x53a5('0x42')](db[_0x53a5('0x6f')][_0x53a5('0x3d')]);_0x1deab6[_0x53a5('0x41')]=_[_0x53a5('0x42')](_0x1a606c['query']);_0x1deab6['filters']=_[_0x53a5('0x43')](_0x1deab6[_0x53a5('0x40')],_0x1deab6[_0x53a5('0x41')]);_0x148bef[_0x53a5('0x44')]=_[_0x53a5('0x43')](_0x1deab6[_0x53a5('0x40')],qs[_0x53a5('0x45')](_0x1a606c[_0x53a5('0x41')][_0x53a5('0x45')]));_0x148bef[_0x53a5('0x44')]=_0x148bef[_0x53a5('0x44')]['length']?_0x148bef[_0x53a5('0x44')]:_0x1deab6['model'];_0x148bef['order']=qs['sort'](_0x1a606c[_0x53a5('0x41')][_0x53a5('0x49')]);_0x148bef[_0x53a5('0x4a')]=qs[_0x53a5('0x4b')](_[_0x53a5('0x66')](_0x1a606c['query'],_0x1deab6[_0x53a5('0x4b')]));if(_0x1a606c['query']['filter']){_0x148bef[_0x53a5('0x4a')]=_[_0x53a5('0x4d')](_0x148bef['where'],{'$or':_[_0x53a5('0x3b')](_0x148bef[_0x53a5('0x44')],function(_0x5858b7){var _0xd8b5a8={};_0xd8b5a8[_0x5858b7]={'$like':'%'+_0x1a606c[_0x53a5('0x41')]['filter']+'%'};return _0xd8b5a8;})});}_0x148bef=_['merge']({},_0x148bef,_0x1a606c[_0x53a5('0x4f')]);return _0x372f2e['getApplications'](_0x148bef);}})['then'](function(_0x4ce1c8){if(_0x4ce1c8){_0x204b0b=_0x4ce1c8[_0x53a5('0x46')];if(!_0x1a606c['query'][_0x53a5('0x65')]('nolimit')){_0x148bef['limit']=qs[_0x53a5('0x2b')](_0x1a606c[_0x53a5('0x41')]['limit']);_0x148bef[_0x53a5('0x29')]=qs[_0x53a5('0x29')](_0x1a606c[_0x53a5('0x41')][_0x53a5('0x29')]);}return _0x372f2e[_0x53a5('0xb8')](_0x148bef);}})[_0x53a5('0x1d')](function(_0x340d77){if(_0x340d77){return _0x340d77?{'count':_0x204b0b,'rows':_0x340d77}:null;}})['then'](respondWithResult(_0x25d2a5,null))[_0x53a5('0x26')](handleError(_0x25d2a5,null));};exports[_0x53a5('0xb9')]=function(_0x560684,_0x582704,_0x5c5066){var _0x2142ce={'raw':![],'where':{}};var _0x4da240={};var _0x159de0={'count':0x0,'rows':[]};return db[_0x53a5('0x3c')]['findOne']({'where':{'id':_0x560684[_0x53a5('0x55')]['id']}})['then'](handleEntityNotFound(_0x582704,null))[_0x53a5('0x1d')](function(_0x1bb5fc){if(_0x1bb5fc){_0x4da240[_0x53a5('0x40')]=_[_0x53a5('0x42')](db[_0x53a5('0x9f')][_0x53a5('0x3d')]);_0x4da240['query']=_[_0x53a5('0x42')](_0x560684[_0x53a5('0x41')]);_0x4da240[_0x53a5('0x4b')]=_[_0x53a5('0x43')](_0x4da240[_0x53a5('0x40')],_0x4da240[_0x53a5('0x41')]);_0x2142ce[_0x53a5('0x44')]=_[_0x53a5('0x43')](_0x4da240['model'],qs['fields'](_0x560684['query'][_0x53a5('0x45')]));_0x2142ce[_0x53a5('0x44')]=_0x2142ce['attributes'][_0x53a5('0x46')]?_0x2142ce[_0x53a5('0x44')]:_0x4da240['model'];if(!_0x560684[_0x53a5('0x41')]['hasOwnProperty'](_0x53a5('0x47'))){_0x2142ce['limit']=qs[_0x53a5('0x2b')](_0x560684[_0x53a5('0x41')]['limit']);_0x2142ce[_0x53a5('0x29')]=qs[_0x53a5('0x29')](_0x560684[_0x53a5('0x41')][_0x53a5('0x29')]);}_0x2142ce[_0x53a5('0x48')]=qs[_0x53a5('0x49')](_0x560684[_0x53a5('0x41')][_0x53a5('0x49')]);_0x2142ce[_0x53a5('0x4a')]=qs[_0x53a5('0x4b')](_[_0x53a5('0x66')](_0x560684[_0x53a5('0x41')],_0x4da240['filters']));_0x2142ce['where'][_0x53a5('0x62')]=_0x1bb5fc['id'];if(_0x560684['query'][_0x53a5('0x4c')]){_0x2142ce['where']=_[_0x53a5('0x4d')](_0x2142ce['where'],{'$or':_[_0x53a5('0x3b')](_0x2142ce[_0x53a5('0x44')],function(_0x512c94){var _0x277566={};_0x277566[_0x512c94]={'$like':'%'+_0x560684[_0x53a5('0x41')][_0x53a5('0x4c')]+'%'};return _0x277566;})});}_0x2142ce=_[_0x53a5('0x4d')]({},_0x2142ce,_0x560684[_0x53a5('0x4f')]);return db[_0x53a5('0x9f')][_0x53a5('0x2c')]({'where':_0x2142ce['where']})[_0x53a5('0x1d')](function(_0x421b5e){_0x159de0[_0x53a5('0x2c')]=_0x421b5e;if(_0x560684['query'][_0x53a5('0x50')]){_0x2142ce[_0x53a5('0x51')]=[{'model':db[_0x53a5('0xba')],'as':'Contact','required':![]},{'model':db[_0x53a5('0xa8')],'as':'Owner','attributes':['name',_0x53a5('0xbb'),_0x53a5('0xbc')],'required':![]},{'model':db[_0x53a5('0xbd')],'as':_0x53a5('0xbe'),'attributes':['id',_0x53a5('0x37'),'color'],'where':_0x560684['query']['tag']?{'id':_0x560684[_0x53a5('0x41')][_0x53a5('0xbf')]}:undefined,'required':_0x560684['query'][_0x53a5('0xbf')]?!![]:![]}];}return db[_0x53a5('0x9f')][_0x53a5('0x52')](_0x2142ce);})[_0x53a5('0x1d')](function(_0x56d919){_0x159de0[_0x53a5('0x53')]=_0x56d919;return _0x159de0;});}})['then'](respondWithFilteredResult(_0x582704,_0x2142ce))['catch'](handleError(_0x582704,null));};exports[_0x53a5('0xc0')]=function(_0x1720b8,_0x193ddb,_0x339bca){var _0x213171,_0x403b36,_0x4e5462;if(_[_0x53a5('0x94')](_0x1720b8[_0x53a5('0x58')]['body'])||_0x1720b8[_0x53a5('0x58')][_0x53a5('0x58')]===''){throw new db[(_0x53a5('0x76'))]['ValidationError'](_0x53a5('0xc1'));}if(_[_0x53a5('0x94')](_0x1720b8['body']['to'])){throw new db[(_0x53a5('0x76'))]['ValidationError'](_0x53a5('0xc2'));}_0x213171=_0x1720b8['body']['to'];return db[_0x53a5('0x3c')][_0x53a5('0x56')]({'where':{'id':_0x1720b8[_0x53a5('0x55')]['id']},'include':[{'model':db[_0x53a5('0x9a')],'as':_0x53a5('0xc3'),'include':[{'model':db[_0x53a5('0xba')],'as':_0x53a5('0x9b'),'where':{'mobile':_0x213171},'limit':0x1,'order':[[_0x53a5('0x7b'),'DESC']]}]}]})[_0x53a5('0x1d')](handleEntityNotFound(_0x193ddb,null))[_0x53a5('0x1d')](function(_0x19a95b){if(_0x19a95b&&_0x19a95b[_0x53a5('0xc3')]){_0x403b36=_0x19a95b[_0x53a5('0x59')]({'plain':!![]});if(_0x403b36['List']&&_0x403b36[_0x53a5('0xc3')]['Contacts'][_0x53a5('0x46')]){return _0x403b36['List'][_0x53a5('0x9b')][0x0];}return db[_0x53a5('0xba')][_0x53a5('0x57')](_[_0x53a5('0x16')](_0x1720b8[_0x53a5('0x58')],{'firstName':_0x213171,'mobile':_0x213171,'phone':_0x213171,'ListId':_0x403b36[_0x53a5('0x7d')]}));}})[_0x53a5('0x1d')](handleEntityNotFound(_0x193ddb,null))[_0x53a5('0x1d')](function(_0x4a9612){if(_0x4a9612){_0x4e5462=_0x4a9612;return db['SmsInteraction'][_0x53a5('0x56')]({'where':{'ContactId':_0x4e5462['id'],'closed':![],'SmsAccountId':_0x403b36['id']}})[_0x53a5('0x1d')](function(_0x281034){if(_0x281034){return[_0x281034,![]];}return db[_0x53a5('0x9f')][_0x53a5('0x57')]({'UserId':_0x1720b8[_0x53a5('0x5b')]['id'],'ContactId':_0x4e5462['id'],'SmsAccountId':_0x403b36['id'],'phone':_0x213171,'firstMsgDirection':_0x53a5('0xc4'),'Messages':[_[_0x53a5('0x4d')](_0x1720b8[_0x53a5('0x58')],{'read':![],'body':_0x1720b8[_0x53a5('0x58')][_0x53a5('0x58')],'phone':_0x213171,'SmsAccountId':_0x403b36['id'],'UserId':_0x1720b8[_0x53a5('0x5b')]['id'],'ContactId':_0x4e5462['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x53a5('0xc5')}]})['then'](function(_0xc42108){return[_0xc42108,!![]];});});}})[_0x53a5('0xc6')](function(_0x3b2372,_0x45ddd5){if(_0x45ddd5){return _0x3b2372;}return db[_0x53a5('0xa6')]['create'](_['merge'](_0x1720b8[_0x53a5('0x58')],{'read':![],'body':_0x1720b8[_0x53a5('0x58')][_0x53a5('0x58')],'phone':_0x213171,'SmsAccountId':_0x403b36['id'],'SmsInteractionId':_0x3b2372['id'],'UserId':_0x1720b8[_0x53a5('0x5b')]['id'],'ContactId':_0x4e5462['id']}))[_0x53a5('0x1d')](function(_0x492a74){_0x3b2372[_0x53a5('0xc7')][_0x53a5('0xc5')]=[];_0x3b2372[_0x53a5('0xc7')][_0x53a5('0xc5')]['push'](_0x492a74[_0x53a5('0xc7')]);return _0x3b2372;});})[_0x53a5('0x1d')](respondWithResult(_0x193ddb,null))['catch'](handleError(_0x193ddb,null));};exports['status']=function(_0x49e1ac,_0x9ac5f4,_0x27a83e){if(_0x49e1ac['body']['id']){delete _0x49e1ac[_0x53a5('0x58')]['id'];}var _0x41b6a7,_0x1eec54,_0x445104;return db[_0x53a5('0x3c')][_0x53a5('0x56')]({'where':{'id':_0x49e1ac[_0x53a5('0x55')]['id']}})[_0x53a5('0x1d')](handleEntityNotFound(_0x9ac5f4,null))[_0x53a5('0x1d')](function(_0x4a3a5a){if(_0x4a3a5a){_0x445104=_0x4a3a5a;logger[_0x53a5('0xc8')](_0x53a5('0x1f'),'status',_0x53a5('0xc9'),_0x4a3a5a['type'],util[_0x53a5('0xca')](_0x49e1ac[_0x53a5('0x58')],{'showHidden':![],'depth':null}));switch(_0x4a3a5a[_0x53a5('0x3f')]){case _0x53a5('0x84'):if(_0x49e1ac[_0x53a5('0x58')][_0x53a5('0xcb')]&&_0x49e1ac[_0x53a5('0x58')][_0x53a5('0x27')]){_0x1eec54=_0x49e1ac[_0x53a5('0x58')][_0x53a5('0x27')];return db[_0x53a5('0xa6')][_0x53a5('0x56')]({'where':{'messageId':_0x49e1ac['body'][_0x53a5('0xcb')]}});}break;case _0x53a5('0xcc'):if(_0x49e1ac[_0x53a5('0x58')]['requestid']&&_0x49e1ac[_0x53a5('0x58')]['statusInt']){_0x1eec54=_0x49e1ac[_0x53a5('0x58')][_0x53a5('0xcd')];return db[_0x53a5('0xa6')]['find']({'where':{'messageId':_0x49e1ac[_0x53a5('0x58')][_0x53a5('0xce')]}});}break;case _0x53a5('0xcf'):if(_0x49e1ac[_0x53a5('0x58')][_0x53a5('0x87')]&&_0x49e1ac['body']['status_code']){_0x1eec54=_0x49e1ac['body'][_0x53a5('0xd0')];return db[_0x53a5('0xa6')][_0x53a5('0x56')]({'where':{'messageId':_0x49e1ac[_0x53a5('0x58')][_0x53a5('0x87')]}});}break;case _0x53a5('0x8a'):var _0x14ddd8=_0x49e1ac['body'][_0x53a5('0x8b')][0x0];if(_0x14ddd8[_0x53a5('0x82')]&&_0x14ddd8[_0x53a5('0x27')][_0x53a5('0xd1')]===_0x53a5('0xd2')){_0x1eec54=_0x14ddd8[_0x53a5('0x27')][_0x53a5('0xd1')];return db[_0x53a5('0xa6')][_0x53a5('0x56')]({'where':{'messageId':_0x14ddd8[_0x53a5('0x82')]}});}break;case _0x53a5('0x8f'):if(_0x49e1ac[_0x53a5('0x58')][_0x53a5('0x82')]&&_0x49e1ac[_0x53a5('0x58')]['status']){_0x1eec54=_0x49e1ac[_0x53a5('0x58')][_0x53a5('0x27')];return db[_0x53a5('0xa6')][_0x53a5('0x56')]({'where':{'messageId':_0x49e1ac[_0x53a5('0x58')]['messageId']}});}break;case _0x53a5('0x92'):if(_0x49e1ac[_0x53a5('0x58')][0x0][_0x53a5('0x23')]['id']){_0x1eec54=_0x49e1ac['body'][0x0][_0x53a5('0x3f')];return db[_0x53a5('0xa6')][_0x53a5('0x56')]({'where':{'messageId':_0x49e1ac[_0x53a5('0x58')][0x0][_0x53a5('0x23')]['id']}});}break;case'intelepeer':if(_0x49e1ac[_0x53a5('0x58')][_0x53a5('0xd3')]&&_0x49e1ac['body'][_0x53a5('0x27')]){_0x1eec54=_0x49e1ac[_0x53a5('0x58')][_0x53a5('0x27')];return db['SmsMessage'][_0x53a5('0x56')]({'where':{'messageId':_0x49e1ac[_0x53a5('0x58')][_0x53a5('0xd3')]}});}break;}}})[_0x53a5('0x1d')](handleEntityNotFound(_0x9ac5f4,null))[_0x53a5('0x1d')](function(_0x3908e7){if(_0x3908e7){_0x41b6a7=_0x3908e7;switch(_0x445104[_0x53a5('0x3f')]){case _0x53a5('0x84'):if(_0x1eec54===_0x53a5('0xd2')){return _0x41b6a7[_0x53a5('0x32')]({'read':!![]});}else{logger[_0x53a5('0x22')](_0x53a5('0x1f'),_0x53a5('0x27'),_0x53a5('0x84'),util[_0x53a5('0xca')](_0x49e1ac['body'],{'showHidden':![],'depth':null}));}break;case _0x53a5('0xcc'):if(_0x1eec54==='1'){return _0x41b6a7[_0x53a5('0x32')]({'read':!![]});}else{logger[_0x53a5('0x22')](_0x53a5('0x1f'),'status','skebby',util['inspect'](_0x49e1ac[_0x53a5('0x58')],{'showHidden':![],'depth':null}));}break;case _0x53a5('0xcf'):if(!_0x49e1ac[_0x53a5('0x58')][_0x53a5('0xd4')]&&_0x1eec54>=0xc8&&_0x1eec54<=0xce){return _0x41b6a7[_0x53a5('0x32')]({'read':!![]});}else{logger[_0x53a5('0x22')](_0x53a5('0x1f'),_0x53a5('0x27'),_0x53a5('0xcf'),util['inspect'](_0x49e1ac[_0x53a5('0x58')],{'showHidden':![],'depth':null}));}break;case _0x53a5('0x8a'):var _0x1c274e=_0x49e1ac[_0x53a5('0x58')][_0x53a5('0x8b')][0x0];if(_0x1c274e['status'][_0x53a5('0xd1')]===_0x53a5('0xd2')){return _0x41b6a7[_0x53a5('0x32')]({'read':!![]});}else{logger['error'](_0x53a5('0x1f'),_0x53a5('0x27'),_0x53a5('0x8a'),util[_0x53a5('0xca')](_0x49e1ac[_0x53a5('0x58')],{'showHidden':![],'depth':null}));}break;case _0x53a5('0x8f'):if(_0x1eec54==_0x53a5('0xd5')||_0x1eec54==_0x53a5('0xd6')){return _0x41b6a7[_0x53a5('0x32')]({'read':!![]});}else{logger[_0x53a5('0x22')](_0x53a5('0x1f'),_0x53a5('0x27'),'clickatell',util[_0x53a5('0xca')](_0x49e1ac[_0x53a5('0x58')],{'showHidden':![],'depth':null}));}break;case _0x53a5('0x92'):if(_0x1eec54==_0x53a5('0xd7')){return _0x41b6a7['update']({'read':!![]});}else{logger[_0x53a5('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x53a5('0x27'),_0x53a5('0x92'),util[_0x53a5('0xca')](_0x49e1ac[_0x53a5('0x58')],{'showHidden':![],'depth':null}));}break;case _0x53a5('0xd8'):if(_0x1eec54==='DELIVRD'||_0x1eec54===_0x53a5('0xd9')){return _0x41b6a7[_0x53a5('0x32')]({'read':!![]});}else{logger[_0x53a5('0x22')](_0x53a5('0x1f'),'status','intelepeer',util[_0x53a5('0xca')](_0x49e1ac[_0x53a5('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x41b6a7;}})[_0x53a5('0x1d')](respondWithResult(_0x9ac5f4,null))[_0x53a5('0x26')](handleError(_0x9ac5f4,null));};exports[_0x53a5('0xda')]=function(_0x3ff5ac,_0x289b01,_0x1833b6){var _0x27ee0c,_0x51909c,_0x3d91dd;return db[_0x53a5('0x3c')][_0x53a5('0x56')]({'where':{'id':_0x3ff5ac[_0x53a5('0x55')]['id']}})[_0x53a5('0x1d')](handleEntityNotFound(_0x289b01,null))[_0x53a5('0x1d')](function(_0x26f4e2){if(_0x26f4e2){_0x3d91dd=_0x26f4e2;logger[_0x53a5('0xc8')](_0x53a5('0x1f'),'status',_0x53a5('0xc9'),_0x26f4e2[_0x53a5('0x3f')],util[_0x53a5('0xca')](_0x3ff5ac[_0x53a5('0x41')],{'showHidden':![],'depth':null}));switch(_0x26f4e2['type']){case _0x53a5('0x8c'):if(_0x3ff5ac[_0x53a5('0x41')][_0x53a5('0xdb')]&&_0x3ff5ac[_0x53a5('0x41')]['state']){_0x51909c=_0x3ff5ac[_0x53a5('0x41')][_0x53a5('0xdc')];return db[_0x53a5('0xa6')][_0x53a5('0x56')]({'where':{'messageId':_0x3ff5ac[_0x53a5('0x41')][_0x53a5('0xdb')]}});}break;}}})[_0x53a5('0x1d')](handleEntityNotFound(_0x289b01,null))['then'](function(_0x27f26b){if(_0x27f26b){_0x27ee0c=_0x27f26b;switch(_0x3d91dd[_0x53a5('0x3f')]){case'csc':if(_0x51909c==='2'||_0x51909c==='6'){return _0x27ee0c[_0x53a5('0x32')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x53a5('0x27'),'csc',util[_0x53a5('0xca')](_0x3ff5ac[_0x53a5('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x27ee0c;}})['then'](respondWithResult(_0x289b01,null))[_0x53a5('0x26')](handleError(_0x289b01,null));};exports[_0x53a5('0xdd')]=function(_0xb7e7ad,_0x19f34e,_0x234a58){return db[_0x53a5('0x3c')][_0x53a5('0x56')]({'where':{'id':_0xb7e7ad[_0x53a5('0x55')]['id']}})[_0x53a5('0x1d')](handleEntityNotFound(_0x19f34e,null))[_0x53a5('0x1d')](function(_0x24a014){if(_0x24a014){return _0x24a014[_0x53a5('0xdd')](_0xb7e7ad['body']['ids'],_[_0x53a5('0x9d')](_0xb7e7ad[_0x53a5('0x58')],[_0x53a5('0x68'),'id'])||{})[_0x53a5('0xc6')](function(_0x4b009f){for(var _0x5a0d2b=0x0;_0x5a0d2b<_0xb7e7ad['body'][_0x53a5('0x68')][_0x53a5('0x46')];_0x5a0d2b+=0x1){socket[_0x53a5('0xde')](_0x53a5('0xdf'),{'UserId':Number(_0xb7e7ad[_0x53a5('0x58')][_0x53a5('0x68')][_0x5a0d2b]),'SmsAccountId':Number(_0xb7e7ad[_0x53a5('0x55')]['id'])});}return _0x4b009f;});}})[_0x53a5('0x1d')](respondWithResult(_0x19f34e,null))[_0x53a5('0x26')](handleError(_0x19f34e,null));};exports[_0x53a5('0xe0')]=function(_0x388a52,_0x507951,_0x1261d7){return db[_0x53a5('0x3c')][_0x53a5('0x56')]({'where':{'id':_0x388a52[_0x53a5('0x55')]['id']}})['then'](handleEntityNotFound(_0x507951,null))[_0x53a5('0x1d')](function(_0x133a56){if(_0x133a56){return _0x133a56[_0x53a5('0xe0')](_0x388a52[_0x53a5('0x41')][_0x53a5('0x68')])[_0x53a5('0x1d')](function(){if(_[_0x53a5('0xe1')](_0x388a52[_0x53a5('0x41')][_0x53a5('0x68')])){for(var _0x168aae=0x0;_0x168aae<_0x388a52['query'][_0x53a5('0x68')]['length'];_0x168aae+=0x1){socket[_0x53a5('0xde')](_0x53a5('0xe2'),{'UserId':Number(_0x388a52[_0x53a5('0x41')][_0x53a5('0x68')][_0x168aae]),'SmsAccountId':Number(_0x388a52[_0x53a5('0x55')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x388a52[_0x53a5('0x41')][_0x53a5('0x68')]),'SmsAccountId':Number(_0x388a52[_0x53a5('0x55')]['id'])});}});}})[_0x53a5('0x1d')](respondWithStatusCode(_0x507951,null))[_0x53a5('0x26')](handleError(_0x507951,null));};exports[_0x53a5('0xe3')]=function(_0x18b8f8,_0x2d0913,_0x40aa1b){var _0x5e2e82={};var _0x10b600={};var _0x402c7c;var _0x280a35;return db['SmsAccount'][_0x53a5('0x64')]({'where':{'id':_0x18b8f8[_0x53a5('0x55')]['id']}})['then'](handleEntityNotFound(_0x2d0913,null))[_0x53a5('0x1d')](function(_0xc70e0a){if(_0xc70e0a){_0x402c7c=_0xc70e0a;_0x10b600[_0x53a5('0x40')]=_[_0x53a5('0x42')](db['User'][_0x53a5('0x3d')]);_0x10b600[_0x53a5('0x41')]=_['keys'](_0x18b8f8[_0x53a5('0x41')]);_0x10b600[_0x53a5('0x4b')]=_[_0x53a5('0x43')](_0x10b600[_0x53a5('0x40')],_0x10b600[_0x53a5('0x41')]);_0x5e2e82[_0x53a5('0x44')]=_[_0x53a5('0x43')](_0x10b600[_0x53a5('0x40')],qs['fields'](_0x18b8f8[_0x53a5('0x41')][_0x53a5('0x45')]));_0x5e2e82[_0x53a5('0x44')]=_0x5e2e82[_0x53a5('0x44')][_0x53a5('0x46')]?_0x5e2e82['attributes']:_0x10b600['model'];_0x5e2e82[_0x53a5('0x48')]=qs[_0x53a5('0x49')](_0x18b8f8[_0x53a5('0x41')][_0x53a5('0x49')]);_0x5e2e82[_0x53a5('0x4a')]=qs[_0x53a5('0x4b')](_[_0x53a5('0x66')](_0x18b8f8[_0x53a5('0x41')],_0x10b600['filters']));if(_0x18b8f8[_0x53a5('0x41')][_0x53a5('0x4c')]){_0x5e2e82[_0x53a5('0x4a')]=_['merge'](_0x5e2e82['where'],{'$or':_[_0x53a5('0x3b')](_0x5e2e82[_0x53a5('0x44')],function(_0x280272){var _0x513af7={};_0x513af7[_0x280272]={'$like':'%'+_0x18b8f8[_0x53a5('0x41')][_0x53a5('0x4c')]+'%'};return _0x513af7;})});}_0x5e2e82=_[_0x53a5('0x4d')]({},_0x5e2e82,_0x18b8f8[_0x53a5('0x4f')]);return _0x402c7c[_0x53a5('0xe3')](_0x5e2e82);}})[_0x53a5('0x1d')](function(_0x303637){if(_0x303637){_0x280a35=_0x303637['length'];if(!_0x18b8f8['query'][_0x53a5('0x65')](_0x53a5('0x47'))){_0x5e2e82[_0x53a5('0x2b')]=qs['limit'](_0x18b8f8['query']['limit']);_0x5e2e82[_0x53a5('0x29')]=qs[_0x53a5('0x29')](_0x18b8f8[_0x53a5('0x41')]['offset']);}return _0x402c7c[_0x53a5('0xe3')](_0x5e2e82);}})[_0x53a5('0x1d')](function(_0x3a5bc5){if(_0x3a5bc5){return _0x3a5bc5?{'count':_0x280a35,'rows':_0x3a5bc5}:null;}})['then'](respondWithResult(_0x2d0913,null))['catch'](handleError(_0x2d0913,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 513ea5b..d5ee820 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 _0xd228=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x7a78d7,_0x2ad978){var _0x5b05d1=function(_0x302516){while(--_0x302516){_0x7a78d7['push'](_0x7a78d7['shift']());}};_0x5b05d1(++_0x2ad978);}(_0xd228,0x110));var _0x8d22=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xd228[_0x1abb09];return _0xea1c07;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x8d22('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8d22('0x1')](0x0);var events={'afterCreate':_0x8d22('0x2'),'afterUpdate':_0x8d22('0x3'),'afterDestroy':_0x8d22('0x4')};function emitEvent(_0x3c7959){return function(_0x25646d,_0x5707ba,_0x543f3a){SmsAccountEvents[_0x8d22('0x5')](_0x3c7959+':'+_0x25646d['id'],_0x25646d);SmsAccountEvents[_0x8d22('0x5')](_0x3c7959,_0x25646d);_0x543f3a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x8d22('0x6')](e,emitEvent(event));}}module[_0x8d22('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0xcea1=['../../mysqldb','SmsAccount','setMaxListeners','remove','emit','hook','exports','events'];(function(_0x2d3fcb,_0x4272af){var _0x1fcf8a=function(_0x27efd2){while(--_0x27efd2){_0x2d3fcb['push'](_0x2d3fcb['shift']());}};_0x1fcf8a(++_0x4272af);}(_0xcea1,0x8f));var _0x1cea=function(_0x15482e,_0x25b23c){_0x15482e=_0x15482e-0x0;var _0x4a0651=_0xcea1[_0x15482e];return _0x4a0651;};'use strict';var EventEmitter=require(_0x1cea('0x0'));var SmsAccount=require(_0x1cea('0x1'))['db'][_0x1cea('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x1cea('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1cea('0x4')};function emitEvent(_0x16da83){return function(_0x21b927,_0x2c557f,_0x320e0b){SmsAccountEvents[_0x1cea('0x5')](_0x16da83+':'+_0x21b927['id'],_0x21b927);SmsAccountEvents[_0x1cea('0x5')](_0x16da83,_0x21b927);_0x320e0b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x1cea('0x6')](e,emitEvent(event));}}module[_0x1cea('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index f7c7b62..937d52b 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 _0x4539=['define','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0x1d086f,_0x10d8c9){var _0x3a2538=function(_0x4c54b0){while(--_0x4c54b0){_0x1d086f['push'](_0x1d086f['shift']());}};_0x3a2538(++_0x10d8c9);}(_0x4539,0xf1));var _0x9453=function(_0xfb2ed7,_0x3feb22){_0xfb2ed7=_0xfb2ed7-0x0;var _0x2f0abb=_0x4539[_0xfb2ed7];return _0x2f0abb;};'use strict';var _=require(_0x9453('0x0'));var util=require(_0x9453('0x1'));var logger=require(_0x9453('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9453('0x3'));var rp=require(_0x9453('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9453('0x5'));var config=require(_0x9453('0x6'));var attributes=require(_0x9453('0x7'));module[_0x9453('0x8')]=function(_0x2b0a7d,_0x3b7ed1){return _0x2b0a7d[_0x9453('0x9')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5677=['../../config/logger','api','moment','rimraf','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x5677,0x132));var _0x7567=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0x5677[_0x16dbcd];return _0x34706e;};'use strict';var _=require(_0x7567('0x0'));var util=require(_0x7567('0x1'));var logger=require(_0x7567('0x2'))(_0x7567('0x3'));var moment=require(_0x7567('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7567('0x5'));var config=require('../../config/environment');var attributes=require(_0x7567('0x6'));module[_0x7567('0x7')]=function(_0x25cd46,_0x525f1c){return _0x25cd46[_0x7567('0x8')](_0x7567('0x9'),attributes,{'tableName':_0x7567('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 bc240e3..1cc9355 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 _0x8fe9=['include','map','attributes','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where'];(function(_0x379cb2,_0x5aa51e){var _0x10efa6=function(_0x9e7c7c){while(--_0x9e7c7c){_0x379cb2['push'](_0x379cb2['shift']());}};_0x10efa6(++_0x5aa51e);}(_0x8fe9,0x73));var _0x98fe=function(_0x367361,_0x311488){_0x367361=_0x367361-0x0;var _0x195d2d=_0x8fe9[_0x367361];return _0x195d2d;};'use strict';var _=require(_0x98fe('0x0'));var util=require(_0x98fe('0x1'));var moment=require('moment');var BPromise=require(_0x98fe('0x2'));var rs=require(_0x98fe('0x3'));var fs=require('fs');var Redis=require(_0x98fe('0x4'));var db=require(_0x98fe('0x5'))['db'];var utils=require(_0x98fe('0x6'));var logger=require('../../config/logger')(_0x98fe('0x7'));var config=require('../../config/environment');var jayson=require(_0x98fe('0x8'));var client=jayson[_0x98fe('0x9')][_0x98fe('0xa')]({'port':0x232a});config[_0x98fe('0xb')]=_[_0x98fe('0xc')](config[_0x98fe('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x98fe('0xd'))(new Redis(config[_0x98fe('0xb')]));require(_0x98fe('0xe'))[_0x98fe('0xf')](socket);function respondWithRpcPromise(_0x401571,_0x357a54,_0x25d11a){return new BPromise(function(_0x3cc706,_0x3a3613){return client['request'](_0x401571,_0x25d11a)[_0x98fe('0x10')](function(_0x45ce48){logger[_0x98fe('0x11')](_0x98fe('0x12'),_0x357a54,'request\x20sent');logger[_0x98fe('0x13')](_0x98fe('0x14'),_0x357a54,_0x98fe('0x15'),JSON[_0x98fe('0x16')](_0x45ce48));if(_0x45ce48[_0x98fe('0x17')]){if(_0x45ce48[_0x98fe('0x17')]['code']===0x1f4){logger[_0x98fe('0x17')](_0x98fe('0x12'),_0x357a54,_0x45ce48[_0x98fe('0x17')]['message']);return _0x3a3613(_0x45ce48[_0x98fe('0x17')][_0x98fe('0x18')]);}logger['error'](_0x98fe('0x12'),_0x357a54,_0x45ce48[_0x98fe('0x17')][_0x98fe('0x18')]);return _0x3cc706(_0x45ce48['error']['message']);}else{logger[_0x98fe('0x11')](_0x98fe('0x12'),_0x357a54,_0x98fe('0x15'));_0x3cc706(_0x45ce48[_0x98fe('0x19')]['message']);}})[_0x98fe('0x1a')](function(_0x505b48){logger[_0x98fe('0x17')](_0x98fe('0x12'),_0x357a54,_0x505b48);_0x3a3613(_0x505b48);});});}exports[_0x98fe('0x1b')]=function(_0x2c1340){var _0x1eb25d=this;return new Promise(function(_0x2905ff,_0x241345){return db[_0x98fe('0x1c')][_0x98fe('0x1d')]({'raw':_0x2c1340[_0x98fe('0x1e')]?_0x2c1340[_0x98fe('0x1e')][_0x98fe('0x1f')]===undefined?!![]:![]:!![],'where':_0x2c1340[_0x98fe('0x1e')]?_0x2c1340[_0x98fe('0x1e')][_0x98fe('0x20')]||null:null,'attributes':_0x2c1340[_0x98fe('0x1e')]?_0x2c1340[_0x98fe('0x1e')]['attributes']||null:null,'include':_0x2c1340[_0x98fe('0x1e')]?_0x2c1340[_0x98fe('0x1e')][_0x98fe('0x21')]?_[_0x98fe('0x22')](_0x2c1340['options'][_0x98fe('0x21')],function(_0x5ad128){return{'model':db[_0x5ad128['model']],'as':_0x5ad128['as'],'attributes':_0x5ad128[_0x98fe('0x23')],'include':_0x5ad128[_0x98fe('0x21')]?_['map'](_0x5ad128[_0x98fe('0x21')],function(_0x44e19c){return{'model':db[_0x44e19c[_0x98fe('0x24')]],'as':_0x44e19c['as'],'attributes':_0x44e19c['attributes'],'include':_0x44e19c['include']?_[_0x98fe('0x22')](_0x44e19c['include'],function(_0x58c8e7){return{'model':db[_0x58c8e7[_0x98fe('0x24')]],'as':_0x58c8e7['as'],'attributes':_0x58c8e7[_0x98fe('0x23')]};}):[]};}):[]};}):[]:[]})[_0x98fe('0x10')](function(_0x22bf4c){logger[_0x98fe('0x11')](_0x98fe('0x1b'),_0x2c1340);logger['debug'](_0x98fe('0x1b'),_0x2c1340,JSON[_0x98fe('0x16')](_0x22bf4c));_0x2905ff(_0x22bf4c);})[_0x98fe('0x1a')](function(_0x3977eb){logger[_0x98fe('0x17')](_0x98fe('0x1b'),_0x3977eb[_0x98fe('0x18')],_0x2c1340);_0x241345(_0x1eb25d[_0x98fe('0x17')](0x1f4,_0x3977eb[_0x98fe('0x18')]));});});}; \ No newline at end of file +var _0x74fa=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','ShowSmsAccount','SmsAccount','find','options','raw','include','map','attributes','model','then','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1f2dd1,_0x2f7082){var _0x542adc=function(_0xb7e1a4){while(--_0xb7e1a4){_0x1f2dd1['push'](_0x1f2dd1['shift']());}};_0x542adc(++_0x2f7082);}(_0x74fa,0x6c));var _0xa74f=function(_0x21ad80,_0x1a9b04){_0x21ad80=_0x21ad80-0x0;var _0x503b46=_0x74fa[_0x21ad80];return _0x503b46;};'use strict';var _=require(_0xa74f('0x0'));var util=require('util');var moment=require(_0xa74f('0x1'));var BPromise=require(_0xa74f('0x2'));var rs=require(_0xa74f('0x3'));var fs=require('fs');var Redis=require(_0xa74f('0x4'));var db=require(_0xa74f('0x5'))['db'];var utils=require(_0xa74f('0x6'));var logger=require(_0xa74f('0x7'))(_0xa74f('0x8'));var config=require(_0xa74f('0x9'));var jayson=require(_0xa74f('0xa'));var client=jayson['client'][_0xa74f('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa74f('0xc')],{'host':_0xa74f('0xd'),'port':0x18eb});var socket=require(_0xa74f('0xe'))(new Redis(config['redis']));require(_0xa74f('0xf'))[_0xa74f('0x10')](socket);function respondWithRpcPromise(_0x1e42f3,_0x23dd98,_0x49aaa7){return new BPromise(function(_0x5e683c,_0x4b0d69){return client[_0xa74f('0x11')](_0x1e42f3,_0x49aaa7)['then'](function(_0x1cf071){logger['info'](_0xa74f('0x12'),_0x23dd98,_0xa74f('0x13'));logger['debug'](_0xa74f('0x14'),_0x23dd98,_0xa74f('0x13'),JSON[_0xa74f('0x15')](_0x1cf071));if(_0x1cf071[_0xa74f('0x16')]){if(_0x1cf071[_0xa74f('0x16')][_0xa74f('0x17')]===0x1f4){logger[_0xa74f('0x16')]('SmsAccount,\x20%s,\x20%s',_0x23dd98,_0x1cf071[_0xa74f('0x16')][_0xa74f('0x18')]);return _0x4b0d69(_0x1cf071[_0xa74f('0x16')]['message']);}logger['error'](_0xa74f('0x12'),_0x23dd98,_0x1cf071[_0xa74f('0x16')][_0xa74f('0x18')]);return _0x5e683c(_0x1cf071['error'][_0xa74f('0x18')]);}else{logger[_0xa74f('0x19')](_0xa74f('0x12'),_0x23dd98,_0xa74f('0x13'));_0x5e683c(_0x1cf071[_0xa74f('0x1a')][_0xa74f('0x18')]);}})['catch'](function(_0x560b62){logger[_0xa74f('0x16')]('SmsAccount,\x20%s,\x20%s',_0x23dd98,_0x560b62);_0x4b0d69(_0x560b62);});});}exports[_0xa74f('0x1b')]=function(_0x54c9ad){var _0x300bab=this;return new Promise(function(_0x1a39ea,_0xd1658e){return db[_0xa74f('0x1c')][_0xa74f('0x1d')]({'raw':_0x54c9ad[_0xa74f('0x1e')]?_0x54c9ad[_0xa74f('0x1e')][_0xa74f('0x1f')]===undefined?!![]:![]:!![],'where':_0x54c9ad[_0xa74f('0x1e')]?_0x54c9ad[_0xa74f('0x1e')]['where']||null:null,'attributes':_0x54c9ad['options']?_0x54c9ad['options']['attributes']||null:null,'include':_0x54c9ad[_0xa74f('0x1e')]?_0x54c9ad[_0xa74f('0x1e')][_0xa74f('0x20')]?_[_0xa74f('0x21')](_0x54c9ad['options']['include'],function(_0x592fd4){return{'model':db[_0x592fd4['model']],'as':_0x592fd4['as'],'attributes':_0x592fd4[_0xa74f('0x22')],'include':_0x592fd4[_0xa74f('0x20')]?_['map'](_0x592fd4[_0xa74f('0x20')],function(_0x36bd98){return{'model':db[_0x36bd98[_0xa74f('0x23')]],'as':_0x36bd98['as'],'attributes':_0x36bd98['attributes'],'include':_0x36bd98[_0xa74f('0x20')]?_[_0xa74f('0x21')](_0x36bd98[_0xa74f('0x20')],function(_0x15c44d){return{'model':db[_0x15c44d[_0xa74f('0x23')]],'as':_0x15c44d['as'],'attributes':_0x15c44d[_0xa74f('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa74f('0x24')](function(_0x4ed7a5){logger[_0xa74f('0x19')]('ShowSmsAccount',_0x54c9ad);logger['debug'](_0xa74f('0x1b'),_0x54c9ad,JSON[_0xa74f('0x15')](_0x4ed7a5));_0x1a39ea(_0x4ed7a5);})[_0xa74f('0x25')](function(_0x130f82){logger[_0xa74f('0x16')](_0xa74f('0x1b'),_0x130f82[_0xa74f('0x18')],_0x54c9ad);_0xd1658e(_0x300bab[_0xa74f('0x16')](0x1f4,_0x130f82[_0xa74f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 338918f..e47e2c0 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 3564f9b..65df049 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x54f1dc,_0x863c6b){var _0x257fcb=function(_0x19079c){while(--_0x19079c){_0x54f1dc['push'](_0x54f1dc['shift']());}};_0x257fcb(++_0x863c6b);}(_0x3e74,0x175));var _0x43e7=function(_0x347c8c,_0x584c6b){_0x347c8c=_0x347c8c-0x0;var _0x1e9223=_0x3e74[_0x347c8c];return _0x1e9223;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x59d1ef,_0x3aae86){var _0xb10593=function(_0x40b3da){while(--_0x40b3da){_0x59d1ef['push'](_0x59d1ef['shift']());}};_0xb10593(++_0x3aae86);}(_0x7217,0x19e));var _0x7721=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7217[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index f2c541e..d92c40a 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 _0x489a=['*,*,*,*','sequelize','INTEGER','noop','STRING'];(function(_0x1e37e8,_0x18a60c){var _0x494689=function(_0x469944){while(--_0x469944){_0x1e37e8['push'](_0x1e37e8['shift']());}};_0x494689(++_0x18a60c);}(_0x489a,0x123));var _0xa489=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x489a[_0x351509];return _0x4e9861;};'use strict';var Sequelize=require(_0xa489('0x0'));module['exports']={'priority':{'type':Sequelize[_0xa489('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa489('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa489('0x3')]},'interval':{'type':Sequelize[_0xa489('0x3')],'defaultValue':_0xa489('0x4')}}; \ No newline at end of file +var _0xd1e4=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x5c9f2d,_0xeee094){var _0x4007f0=function(_0xf9dac4){while(--_0xf9dac4){_0x5c9f2d['push'](_0x5c9f2d['shift']());}};_0x4007f0(++_0xeee094);}(_0xd1e4,0xc2));var _0x4d1e=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xd1e4[_0x4ff09b];return _0x3f5c2e;};'use strict';var Sequelize=require(_0x4d1e('0x0'));module[_0x4d1e('0x1')]={'priority':{'type':Sequelize[_0x4d1e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4d1e('0x3')],'allowNull':![],'defaultValue':_0x4d1e('0x4')},'appdata':{'type':Sequelize[_0x4d1e('0x5')]()},'description':{'type':Sequelize[_0x4d1e('0x3')]},'interval':{'type':Sequelize[_0x4d1e('0x3')],'defaultValue':_0x4d1e('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 3eb1586..c210ccc 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 _0x4b5e=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','error','name','send','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','SmsApplication','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x2b051e,_0x3c8d8e){var _0x2d5b3c=function(_0x1ae393){while(--_0x1ae393){_0x2b051e['push'](_0x2b051e['shift']());}};_0x2d5b3c(++_0x3c8d8e);}(_0x4b5e,0x179));var _0xe4b5=function(_0x14e36b,_0x569c2a){_0x14e36b=_0x14e36b-0x0;var _0x11bcd5=_0x4b5e[_0x14e36b];return _0x11bcd5;};'use strict';var emlformat=require(_0xe4b5('0x0'));var rimraf=require(_0xe4b5('0x1'));var zipdir=require(_0xe4b5('0x2'));var jsonpatch=require(_0xe4b5('0x3'));var rp=require(_0xe4b5('0x4'));var moment=require(_0xe4b5('0x5'));var BPromise=require(_0xe4b5('0x6'));var Mustache=require(_0xe4b5('0x7'));var util=require('util');var path=require(_0xe4b5('0x8'));var sox=require(_0xe4b5('0x9'));var csv=require(_0xe4b5('0xa'));var ejs=require(_0xe4b5('0xb'));var fs=require('fs');var fs_extra=require(_0xe4b5('0xc'));var _=require(_0xe4b5('0xd'));var squel=require(_0xe4b5('0xe'));var crypto=require(_0xe4b5('0xf'));var jsforce=require(_0xe4b5('0x10'));var deskjs=require(_0xe4b5('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe4b5('0x12'));var Papa=require(_0xe4b5('0x13'));var Redis=require('ioredis');var authService=require(_0xe4b5('0x14'));var qs=require(_0xe4b5('0x15'));var as=require(_0xe4b5('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe4b5('0x17'))(_0xe4b5('0x18'));var utils=require(_0xe4b5('0x19'));var config=require(_0xe4b5('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4b5('0x1b'))['db'];function respondWithStatusCode(_0x214e83,_0x160ac5){_0x160ac5=_0x160ac5||0xcc;return function(_0x17698f){if(_0x17698f){return _0x214e83[_0xe4b5('0x1c')](_0x160ac5);}return _0x214e83[_0xe4b5('0x1d')](_0x160ac5)['end']();};}function respondWithResult(_0x11c53a,_0x2c0fc0){_0x2c0fc0=_0x2c0fc0||0xc8;return function(_0x181d35){if(_0x181d35){return _0x11c53a[_0xe4b5('0x1d')](_0x2c0fc0)[_0xe4b5('0x1e')](_0x181d35);}};}function respondWithFilteredResult(_0xc4ec19,_0x2b1648){return function(_0x3ed54a){if(_0x3ed54a){var _0x16d417=typeof _0x2b1648[_0xe4b5('0x1f')]===_0xe4b5('0x20')&&typeof _0x2b1648[_0xe4b5('0x21')]===_0xe4b5('0x20');var _0x1143dc=_0x3ed54a[_0xe4b5('0x22')];var _0x5a0261=_0x16d417?0x0:_0x2b1648[_0xe4b5('0x1f')];var _0x2c462c=_0x16d417?_0x3ed54a['count']:_0x2b1648['offset']+_0x2b1648[_0xe4b5('0x21')];var _0x38cc9d;if(_0x2c462c>=_0x1143dc){_0x2c462c=_0x1143dc;_0x38cc9d=0xc8;}else{_0x38cc9d=0xce;}_0xc4ec19[_0xe4b5('0x1d')](_0x38cc9d);return _0xc4ec19[_0xe4b5('0x23')]('Content-Range',_0x5a0261+'-'+_0x2c462c+'/'+_0x1143dc)[_0xe4b5('0x1e')](_0x3ed54a);}return null;};}function patchUpdates(_0x273f89){return function(_0x8dac5d){try{jsonpatch[_0xe4b5('0x24')](_0x8dac5d,_0x273f89,!![]);}catch(_0x22309d){return BPromise[_0xe4b5('0x25')](_0x22309d);}return _0x8dac5d[_0xe4b5('0x26')]();};}function saveUpdates(_0x591722,_0x240d65){return function(_0x42c82f){if(_0x42c82f){return _0x42c82f['update'](_0x591722)[_0xe4b5('0x27')](function(_0x84b031){return _0x84b031;});}return null;};}function removeEntity(_0x5a8da1,_0x1dd94e){return function(_0x4d7539){if(_0x4d7539){return _0x4d7539[_0xe4b5('0x28')]()['then'](function(){_0x5a8da1[_0xe4b5('0x1d')](0xcc)[_0xe4b5('0x29')]();});}};}function handleEntityNotFound(_0x10c669,_0x52c1cd){return function(_0x2d5f10){if(!_0x2d5f10){_0x10c669['sendStatus'](0x194);}return _0x2d5f10;};}function handleError(_0x5b7fd0,_0x22f96b){_0x22f96b=_0x22f96b||0x1f4;return function(_0x17ae35){logger[_0xe4b5('0x2a')](_0x17ae35['stack']);if(_0x17ae35[_0xe4b5('0x2b')]){delete _0x17ae35[_0xe4b5('0x2b')];}_0x5b7fd0[_0xe4b5('0x1d')](_0x22f96b)[_0xe4b5('0x2c')](_0x17ae35);};}exports['index']=function(_0x52b366,_0x1dad60){var _0x1342d5={},_0x374650={},_0xe74b97={'count':0x0,'rows':[]};var _0x8e2cb8=_['map'](db['SmsApplication']['rawAttributes'],function(_0x2c2529){return{'name':_0x2c2529[_0xe4b5('0x2d')],'type':_0x2c2529[_0xe4b5('0x2e')][_0xe4b5('0x2f')]};});_0x374650[_0xe4b5('0x30')]=_[_0xe4b5('0x31')](_0x8e2cb8,'name');_0x374650[_0xe4b5('0x32')]=_[_0xe4b5('0x33')](_0x52b366[_0xe4b5('0x32')]);_0x374650['filters']=_[_0xe4b5('0x34')](_0x374650[_0xe4b5('0x30')],_0x374650[_0xe4b5('0x32')]);_0x1342d5[_0xe4b5('0x35')]=_['intersection'](_0x374650[_0xe4b5('0x30')],qs[_0xe4b5('0x36')](_0x52b366[_0xe4b5('0x32')]['fields']));_0x1342d5['attributes']=_0x1342d5['attributes'][_0xe4b5('0x37')]?_0x1342d5[_0xe4b5('0x35')]:_0x374650[_0xe4b5('0x30')];if(!_0x52b366[_0xe4b5('0x32')][_0xe4b5('0x38')](_0xe4b5('0x39'))){_0x1342d5[_0xe4b5('0x21')]=qs[_0xe4b5('0x21')](_0x52b366['query']['limit']);_0x1342d5[_0xe4b5('0x1f')]=qs[_0xe4b5('0x1f')](_0x52b366[_0xe4b5('0x32')][_0xe4b5('0x1f')]);}_0x1342d5['order']=qs['sort'](_0x52b366[_0xe4b5('0x32')][_0xe4b5('0x3a')]);_0x1342d5[_0xe4b5('0x3b')]=qs[_0xe4b5('0x3c')](_[_0xe4b5('0x3d')](_0x52b366[_0xe4b5('0x32')],_0x374650[_0xe4b5('0x3c')]),_0x8e2cb8);if(_0x52b366['query'][_0xe4b5('0x3e')]){_0x1342d5['where']=_['merge'](_0x1342d5[_0xe4b5('0x3b')],{'$or':_['map'](_0x8e2cb8,function(_0x414aef){if(_0x414aef['type']!=='VIRTUAL'){var _0x34a004={};_0x34a004[_0x414aef[_0xe4b5('0x2b')]]={'$like':'%'+_0x52b366[_0xe4b5('0x32')][_0xe4b5('0x3e')]+'%'};return _0x34a004;}})});}_0x1342d5=_[_0xe4b5('0x3f')]({},_0x1342d5,_0x52b366[_0xe4b5('0x40')]);var _0x4ba56a={'where':_0x1342d5[_0xe4b5('0x3b')]};return db[_0xe4b5('0x41')]['count'](_0x4ba56a)[_0xe4b5('0x27')](function(_0x544312){_0xe74b97[_0xe4b5('0x22')]=_0x544312;if(_0x52b366[_0xe4b5('0x32')][_0xe4b5('0x42')]){_0x1342d5['include']=[{'all':!![]}];}return db[_0xe4b5('0x41')][_0xe4b5('0x43')](_0x1342d5);})[_0xe4b5('0x27')](function(_0x550940){_0xe74b97[_0xe4b5('0x44')]=_0x550940;return _0xe74b97;})[_0xe4b5('0x27')](respondWithFilteredResult(_0x1dad60,_0x1342d5))[_0xe4b5('0x45')](handleError(_0x1dad60,null));};exports[_0xe4b5('0x46')]=function(_0x3845d5,_0x127938){var _0x508497={'raw':!![],'where':{'id':_0x3845d5[_0xe4b5('0x47')]['id']}},_0x442b17={};_0x442b17[_0xe4b5('0x30')]=_[_0xe4b5('0x33')](db[_0xe4b5('0x41')][_0xe4b5('0x48')]);_0x442b17['query']=_['keys'](_0x3845d5[_0xe4b5('0x32')]);_0x442b17['filters']=_[_0xe4b5('0x34')](_0x442b17[_0xe4b5('0x30')],_0x442b17[_0xe4b5('0x32')]);_0x508497[_0xe4b5('0x35')]=_[_0xe4b5('0x34')](_0x442b17[_0xe4b5('0x30')],qs[_0xe4b5('0x36')](_0x3845d5[_0xe4b5('0x32')][_0xe4b5('0x36')]));_0x508497['attributes']=_0x508497[_0xe4b5('0x35')][_0xe4b5('0x37')]?_0x508497[_0xe4b5('0x35')]:_0x442b17[_0xe4b5('0x30')];if(_0x3845d5['query'][_0xe4b5('0x42')]){_0x508497[_0xe4b5('0x49')]=[{'all':!![]}];}_0x508497=_[_0xe4b5('0x3f')]({},_0x508497,_0x3845d5['options']);return db[_0xe4b5('0x41')][_0xe4b5('0x4a')](_0x508497)[_0xe4b5('0x27')](handleEntityNotFound(_0x127938,null))[_0xe4b5('0x27')](respondWithResult(_0x127938,null))[_0xe4b5('0x45')](handleError(_0x127938,null));};exports[_0xe4b5('0x4b')]=function(_0xae28b,_0x2b6fdf){return db[_0xe4b5('0x41')][_0xe4b5('0x4b')](_0xae28b[_0xe4b5('0x4c')],{})[_0xe4b5('0x27')](respondWithResult(_0x2b6fdf,0xc9))['catch'](handleError(_0x2b6fdf,null));};exports[_0xe4b5('0x4d')]=function(_0x11a69a,_0x147fb3){if(_0x11a69a['body']['id']){delete _0x11a69a[_0xe4b5('0x4c')]['id'];}return db['SmsApplication'][_0xe4b5('0x4a')]({'where':{'id':_0x11a69a['params']['id']}})['then'](handleEntityNotFound(_0x147fb3,null))[_0xe4b5('0x27')](saveUpdates(_0x11a69a['body'],null))[_0xe4b5('0x27')](respondWithResult(_0x147fb3,null))[_0xe4b5('0x45')](handleError(_0x147fb3,null));};exports[_0xe4b5('0x28')]=function(_0x566418,_0x313739){return db[_0xe4b5('0x41')][_0xe4b5('0x4a')]({'where':{'id':_0x566418[_0xe4b5('0x47')]['id']}})[_0xe4b5('0x27')](handleEntityNotFound(_0x313739,null))['then'](removeEntity(_0x313739,null))[_0xe4b5('0x45')](handleError(_0x313739,null));}; \ No newline at end of file +var _0x671e=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','name','send','map','SmsApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x19fc4b,_0x325550){var _0x473adb=function(_0x1d6ee2){while(--_0x1d6ee2){_0x19fc4b['push'](_0x19fc4b['shift']());}};_0x473adb(++_0x325550);}(_0x671e,0xc4));var _0xe671=function(_0x459d99,_0x33f980){_0x459d99=_0x459d99-0x0;var _0x449fd2=_0x671e[_0x459d99];return _0x449fd2;};'use strict';var emlformat=require(_0xe671('0x0'));var rimraf=require(_0xe671('0x1'));var zipdir=require(_0xe671('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe671('0x3'));var BPromise=require(_0xe671('0x4'));var Mustache=require(_0xe671('0x5'));var util=require(_0xe671('0x6'));var path=require('path');var sox=require(_0xe671('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe671('0x8'));var _=require(_0xe671('0x9'));var squel=require(_0xe671('0xa'));var crypto=require(_0xe671('0xb'));var jsforce=require(_0xe671('0xc'));var deskjs=require(_0xe671('0xd'));var toCsv=require(_0xe671('0xe'));var querystring=require(_0xe671('0xf'));var Papa=require(_0xe671('0x10'));var Redis=require(_0xe671('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe671('0x12'));var as=require(_0xe671('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe671('0x14'))(_0xe671('0x15'));var utils=require(_0xe671('0x16'));var config=require(_0xe671('0x17'));var licenseUtil=require(_0xe671('0x18'));var db=require(_0xe671('0x19'))['db'];function respondWithStatusCode(_0x333bed,_0x41e713){_0x41e713=_0x41e713||0xcc;return function(_0x14da70){if(_0x14da70){return _0x333bed[_0xe671('0x1a')](_0x41e713);}return _0x333bed[_0xe671('0x1b')](_0x41e713)[_0xe671('0x1c')]();};}function respondWithResult(_0x251dcf,_0x380c51){_0x380c51=_0x380c51||0xc8;return function(_0x186790){if(_0x186790){return _0x251dcf[_0xe671('0x1b')](_0x380c51)[_0xe671('0x1d')](_0x186790);}};}function respondWithFilteredResult(_0x301e16,_0x3b7c53){return function(_0x4aa56e){if(_0x4aa56e){var _0x5e87ee=typeof _0x3b7c53[_0xe671('0x1e')]===_0xe671('0x1f')&&typeof _0x3b7c53[_0xe671('0x20')]==='undefined';var _0x23983f=_0x4aa56e[_0xe671('0x21')];var _0x3ee72b=_0x5e87ee?0x0:_0x3b7c53['offset'];var _0x5f1c55=_0x5e87ee?_0x4aa56e['count']:_0x3b7c53[_0xe671('0x1e')]+_0x3b7c53[_0xe671('0x20')];var _0x21a1b0;if(_0x5f1c55>=_0x23983f){_0x5f1c55=_0x23983f;_0x21a1b0=0xc8;}else{_0x21a1b0=0xce;}_0x301e16[_0xe671('0x1b')](_0x21a1b0);return _0x301e16['set'](_0xe671('0x22'),_0x3ee72b+'-'+_0x5f1c55+'/'+_0x23983f)[_0xe671('0x1d')](_0x4aa56e);}return null;};}function patchUpdates(_0x21f7c8){return function(_0x186066){try{jsonpatch[_0xe671('0x23')](_0x186066,_0x21f7c8,!![]);}catch(_0x970029){return BPromise[_0xe671('0x24')](_0x970029);}return _0x186066[_0xe671('0x25')]();};}function saveUpdates(_0x2f0a31,_0xdb5d43){return function(_0x378fc4){if(_0x378fc4){return _0x378fc4[_0xe671('0x26')](_0x2f0a31)[_0xe671('0x27')](function(_0x14f085){return _0x14f085;});}return null;};}function removeEntity(_0x26fa70,_0x2b9d2c){return function(_0x4d3f88){if(_0x4d3f88){return _0x4d3f88['destroy']()[_0xe671('0x27')](function(){_0x26fa70['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29852a,_0xc5bf3d){return function(_0x1a8dda){if(!_0x1a8dda){_0x29852a['sendStatus'](0x194);}return _0x1a8dda;};}function handleError(_0x16438e,_0x322f0c){_0x322f0c=_0x322f0c||0x1f4;return function(_0x106071){logger['error'](_0x106071['stack']);if(_0x106071[_0xe671('0x28')]){delete _0x106071[_0xe671('0x28')];}_0x16438e[_0xe671('0x1b')](_0x322f0c)[_0xe671('0x29')](_0x106071);};}exports['index']=function(_0x3e5439,_0x33501a){var _0x2ee9a7={},_0x4d5565={},_0x59fe14={'count':0x0,'rows':[]};var _0x3dd217=_[_0xe671('0x2a')](db[_0xe671('0x2b')][_0xe671('0x2c')],function(_0x4459ba){return{'name':_0x4459ba[_0xe671('0x2d')],'type':_0x4459ba[_0xe671('0x2e')][_0xe671('0x2f')]};});_0x4d5565[_0xe671('0x30')]=_[_0xe671('0x2a')](_0x3dd217,_0xe671('0x28'));_0x4d5565['query']=_[_0xe671('0x31')](_0x3e5439[_0xe671('0x32')]);_0x4d5565[_0xe671('0x33')]=_[_0xe671('0x34')](_0x4d5565['model'],_0x4d5565[_0xe671('0x32')]);_0x2ee9a7[_0xe671('0x35')]=_[_0xe671('0x34')](_0x4d5565[_0xe671('0x30')],qs['fields'](_0x3e5439['query'][_0xe671('0x36')]));_0x2ee9a7[_0xe671('0x35')]=_0x2ee9a7[_0xe671('0x35')][_0xe671('0x37')]?_0x2ee9a7[_0xe671('0x35')]:_0x4d5565[_0xe671('0x30')];if(!_0x3e5439[_0xe671('0x32')][_0xe671('0x38')](_0xe671('0x39'))){_0x2ee9a7[_0xe671('0x20')]=qs['limit'](_0x3e5439[_0xe671('0x32')][_0xe671('0x20')]);_0x2ee9a7[_0xe671('0x1e')]=qs[_0xe671('0x1e')](_0x3e5439['query']['offset']);}_0x2ee9a7[_0xe671('0x3a')]=qs['sort'](_0x3e5439[_0xe671('0x32')][_0xe671('0x3b')]);_0x2ee9a7[_0xe671('0x3c')]=qs['filters'](_[_0xe671('0x3d')](_0x3e5439[_0xe671('0x32')],_0x4d5565['filters']),_0x3dd217);if(_0x3e5439['query'][_0xe671('0x3e')]){_0x2ee9a7[_0xe671('0x3c')]=_[_0xe671('0x3f')](_0x2ee9a7[_0xe671('0x3c')],{'$or':_['map'](_0x3dd217,function(_0xed4ac5){if(_0xed4ac5[_0xe671('0x2e')]!=='VIRTUAL'){var _0x48767c={};_0x48767c[_0xed4ac5[_0xe671('0x28')]]={'$like':'%'+_0x3e5439[_0xe671('0x32')]['filter']+'%'};return _0x48767c;}})});}_0x2ee9a7=_['merge']({},_0x2ee9a7,_0x3e5439['options']);var _0x30f130={'where':_0x2ee9a7[_0xe671('0x3c')]};return db[_0xe671('0x2b')][_0xe671('0x21')](_0x30f130)[_0xe671('0x27')](function(_0x3adb3){_0x59fe14['count']=_0x3adb3;if(_0x3e5439[_0xe671('0x32')][_0xe671('0x40')]){_0x2ee9a7[_0xe671('0x41')]=[{'all':!![]}];}return db[_0xe671('0x2b')][_0xe671('0x42')](_0x2ee9a7);})[_0xe671('0x27')](function(_0x3abf6e){_0x59fe14[_0xe671('0x43')]=_0x3abf6e;return _0x59fe14;})[_0xe671('0x27')](respondWithFilteredResult(_0x33501a,_0x2ee9a7))[_0xe671('0x44')](handleError(_0x33501a,null));};exports[_0xe671('0x45')]=function(_0x11a1e6,_0x895b83){var _0x4d447c={'raw':!![],'where':{'id':_0x11a1e6['params']['id']}},_0x2fe1cc={};_0x2fe1cc[_0xe671('0x30')]=_[_0xe671('0x31')](db[_0xe671('0x2b')][_0xe671('0x2c')]);_0x2fe1cc[_0xe671('0x32')]=_['keys'](_0x11a1e6[_0xe671('0x32')]);_0x2fe1cc[_0xe671('0x33')]=_[_0xe671('0x34')](_0x2fe1cc[_0xe671('0x30')],_0x2fe1cc[_0xe671('0x32')]);_0x4d447c[_0xe671('0x35')]=_[_0xe671('0x34')](_0x2fe1cc[_0xe671('0x30')],qs[_0xe671('0x36')](_0x11a1e6[_0xe671('0x32')][_0xe671('0x36')]));_0x4d447c[_0xe671('0x35')]=_0x4d447c[_0xe671('0x35')]['length']?_0x4d447c['attributes']:_0x2fe1cc[_0xe671('0x30')];if(_0x11a1e6[_0xe671('0x32')][_0xe671('0x40')]){_0x4d447c['include']=[{'all':!![]}];}_0x4d447c=_['merge']({},_0x4d447c,_0x11a1e6['options']);return db[_0xe671('0x2b')][_0xe671('0x46')](_0x4d447c)[_0xe671('0x27')](handleEntityNotFound(_0x895b83,null))[_0xe671('0x27')](respondWithResult(_0x895b83,null))[_0xe671('0x44')](handleError(_0x895b83,null));};exports['create']=function(_0x3752b8,_0x387ebf){return db['SmsApplication'][_0xe671('0x47')](_0x3752b8[_0xe671('0x48')],{})[_0xe671('0x27')](respondWithResult(_0x387ebf,0xc9))[_0xe671('0x44')](handleError(_0x387ebf,null));};exports[_0xe671('0x26')]=function(_0x3f731f,_0x2a3897){if(_0x3f731f[_0xe671('0x48')]['id']){delete _0x3f731f['body']['id'];}return db[_0xe671('0x2b')][_0xe671('0x46')]({'where':{'id':_0x3f731f[_0xe671('0x49')]['id']}})[_0xe671('0x27')](handleEntityNotFound(_0x2a3897,null))['then'](saveUpdates(_0x3f731f[_0xe671('0x48')],null))[_0xe671('0x27')](respondWithResult(_0x2a3897,null))['catch'](handleError(_0x2a3897,null));};exports[_0xe671('0x4a')]=function(_0x5d00ec,_0x442e86){return db['SmsApplication']['find']({'where':{'id':_0x5d00ec[_0xe671('0x49')]['id']}})[_0xe671('0x27')](handleEntityNotFound(_0x442e86,null))[_0xe671('0x27')](removeEntity(_0x442e86,null))[_0xe671('0x44')](handleError(_0x442e86,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 94ab610..5418012 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 _0xf8db=['exports','define','sms_applications','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xf8db,0x16b));var _0xbf8d=function(_0x35ad6e,_0x40ad3d){_0x35ad6e=_0x35ad6e-0x0;var _0x1e49ef=_0xf8db[_0x35ad6e];return _0x1e49ef;};'use strict';var _=require(_0xbf8d('0x0'));var util=require('util');var logger=require(_0xbf8d('0x1'))(_0xbf8d('0x2'));var moment=require(_0xbf8d('0x3'));var BPromise=require(_0xbf8d('0x4'));var rp=require(_0xbf8d('0x5'));var fs=require('fs');var path=require(_0xbf8d('0x6'));var rimraf=require('rimraf');var config=require(_0xbf8d('0x7'));var attributes=require(_0xbf8d('0x8'));module[_0xbf8d('0x9')]=function(_0x44c765,_0x288269){return _0x44c765[_0xbf8d('0xa')]('SmsApplication',attributes,{'tableName':_0xbf8d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe501=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','lodash','util','../../config/logger','api'];(function(_0x2af213,_0x163587){var _0x576ac0=function(_0x3456c7){while(--_0x3456c7){_0x2af213['push'](_0x2af213['shift']());}};_0x576ac0(++_0x163587);}(_0xe501,0x106));var _0x1e50=function(_0x1c3186,_0x24126e){_0x1c3186=_0x1c3186-0x0;var _0x5df9ed=_0xe501[_0x1c3186];return _0x5df9ed;};'use strict';var _=require(_0x1e50('0x0'));var util=require(_0x1e50('0x1'));var logger=require(_0x1e50('0x2'))(_0x1e50('0x3'));var moment=require(_0x1e50('0x4'));var BPromise=require(_0x1e50('0x5'));var rp=require(_0x1e50('0x6'));var fs=require('fs');var path=require(_0x1e50('0x7'));var rimraf=require(_0x1e50('0x8'));var config=require(_0x1e50('0x9'));var attributes=require(_0x1e50('0xa'));module['exports']=function(_0x4dfb64,_0x42315e){return _0x4dfb64[_0x1e50('0xb')](_0x1e50('0xc'),attributes,{'tableName':_0x1e50('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 590f11a..e8f5e23 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 _0x11c8=['jayson/promise','client','request\x20sent','debug','stringify','error','code','message','info','SmsApplication,\x20%s,\x20%s','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x11c8,0x19a));var _0x811c=function(_0x37bab4,_0x4fa85e){_0x37bab4=_0x37bab4-0x0;var _0x336d20=_0x11c8[_0x37bab4];return _0x336d20;};'use strict';var _=require('lodash');var util=require(_0x811c('0x0'));var moment=require(_0x811c('0x1'));var BPromise=require('bluebird');var rs=require(_0x811c('0x2'));var fs=require('fs');var Redis=require(_0x811c('0x3'));var db=require(_0x811c('0x4'))['db'];var utils=require(_0x811c('0x5'));var logger=require(_0x811c('0x6'))(_0x811c('0x7'));var config=require('../../config/environment');var jayson=require(_0x811c('0x8'));var client=jayson[_0x811c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x126cc2,_0x8af784,_0x13a95a){return new BPromise(function(_0x3e81ac,_0x57a92d){return client['request'](_0x126cc2,_0x13a95a)['then'](function(_0x5be7fc){logger['info']('SmsApplication,\x20%s,\x20%s',_0x8af784,_0x811c('0xa'));logger[_0x811c('0xb')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x8af784,_0x811c('0xa'),JSON[_0x811c('0xc')](_0x5be7fc));if(_0x5be7fc[_0x811c('0xd')]){if(_0x5be7fc[_0x811c('0xd')][_0x811c('0xe')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x8af784,_0x5be7fc[_0x811c('0xd')]['message']);return _0x57a92d(_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x8af784,_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);return _0x3e81ac(_0x5be7fc[_0x811c('0xd')][_0x811c('0xf')]);}else{logger[_0x811c('0x10')](_0x811c('0x11'),_0x8af784,'request\x20sent');_0x3e81ac(_0x5be7fc['result'][_0x811c('0xf')]);}})[_0x811c('0x12')](function(_0x3b0895){logger[_0x811c('0xd')](_0x811c('0x11'),_0x8af784,_0x3b0895);_0x57a92d(_0x3b0895);});});} \ No newline at end of file +var _0xf894=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','result'];(function(_0x3978fa,_0x49a059){var _0x5eb26b=function(_0x2b8be2){while(--_0x2b8be2){_0x3978fa['push'](_0x3978fa['shift']());}};_0x5eb26b(++_0x49a059);}(_0xf894,0xfd));var _0x4f89=function(_0x4cb65e,_0x462353){_0x4cb65e=_0x4cb65e-0x0;var _0xb85cd2=_0xf894[_0x4cb65e];return _0xb85cd2;};'use strict';var _=require(_0x4f89('0x0'));var util=require(_0x4f89('0x1'));var moment=require(_0x4f89('0x2'));var BPromise=require(_0x4f89('0x3'));var rs=require(_0x4f89('0x4'));var fs=require('fs');var Redis=require(_0x4f89('0x5'));var db=require(_0x4f89('0x6'))['db'];var utils=require(_0x4f89('0x7'));var logger=require(_0x4f89('0x8'))(_0x4f89('0x9'));var config=require(_0x4f89('0xa'));var jayson=require(_0x4f89('0xb'));var client=jayson[_0x4f89('0xc')][_0x4f89('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x324870,_0x33920a,_0x39b492){return new BPromise(function(_0x188d3f,_0x5cb3a5){return client[_0x4f89('0xe')](_0x324870,_0x39b492)[_0x4f89('0xf')](function(_0x2eb8fe){logger[_0x4f89('0x10')](_0x4f89('0x11'),_0x33920a,_0x4f89('0x12'));logger[_0x4f89('0x13')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x33920a,'request\x20sent',JSON['stringify'](_0x2eb8fe));if(_0x2eb8fe[_0x4f89('0x14')]){if(_0x2eb8fe[_0x4f89('0x14')]['code']===0x1f4){logger[_0x4f89('0x14')](_0x4f89('0x11'),_0x33920a,_0x2eb8fe[_0x4f89('0x14')][_0x4f89('0x15')]);return _0x5cb3a5(_0x2eb8fe[_0x4f89('0x14')][_0x4f89('0x15')]);}logger[_0x4f89('0x14')](_0x4f89('0x11'),_0x33920a,_0x2eb8fe[_0x4f89('0x14')]['message']);return _0x188d3f(_0x2eb8fe[_0x4f89('0x14')][_0x4f89('0x15')]);}else{logger[_0x4f89('0x10')](_0x4f89('0x11'),_0x33920a,_0x4f89('0x12'));_0x188d3f(_0x2eb8fe[_0x4f89('0x16')][_0x4f89('0x15')]);}})['catch'](function(_0x9c194){logger['error']('SmsApplication,\x20%s,\x20%s',_0x33920a,_0x9c194);_0x5cb3a5(_0x9c194);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 1e80df2..49b5f9e 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 _0xda3f=['/:id/tags','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','sms','smsinteraction:addtags','tracked','smsinteraction:update','update','delete','destroy'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xda3f,0xec));var _0xfda3=function(_0x5ad5aa,_0x392091){_0x5ad5aa=_0x5ad5aa-0x0;var _0x49680e=_0xda3f[_0x5ad5aa];return _0x49680e;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./smsInteraction.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0x5')]('/:id/download',auth[_0xfda3('0x6')](),controller[_0xfda3('0xd')]);router[_0xfda3('0xe')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xf')]);router['post'](_0xfda3('0xb'),auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0xe')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xfda3('0x11'),_0xfda3('0x12')),controller['addTags']);router['put']('/:id',auth[_0xfda3('0x6')](),interaction[_0xfda3('0x13')](_0xfda3('0x11'),_0xfda3('0x14')),controller[_0xfda3('0x15')]);router[_0xfda3('0x16')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),interaction[_0xfda3('0x13')](_0xfda3('0x11'),'smsinteraction:destroy'),controller[_0xfda3('0x17')]);router[_0xfda3('0x16')](_0xfda3('0x18'),auth[_0xfda3('0x6')](),controller['removeTags']);module[_0xfda3('0x19')]=router; \ No newline at end of file +var _0x4cf8=['/:id','/:id/messages','getMessages','/:id/download','create','post','addMessage','/: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','../../config/environment','./smsInteraction.controller','get','isAuthenticated','describe'];(function(_0x203df3,_0x3febb2){var _0x460194=function(_0x5539a9){while(--_0x5539a9){_0x203df3['push'](_0x203df3['shift']());}};_0x460194(++_0x3febb2);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x4cf8[_0x4dc7b9];return _0x3ab114;};'use strict';var multer=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var path=require(_0x84cf('0x2'));var timeout=require(_0x84cf('0x3'));var express=require(_0x84cf('0x4'));var router=express[_0x84cf('0x5')]();var fs_extra=require(_0x84cf('0x6'));var auth=require(_0x84cf('0x7'));var interaction=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var controller=require(_0x84cf('0xa'));router[_0x84cf('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x84cf('0xb')]('/describe',auth[_0x84cf('0xc')](),controller[_0x84cf('0xd')]);router['get'](_0x84cf('0xe'),auth[_0x84cf('0xc')](),controller['show']);router[_0x84cf('0xb')](_0x84cf('0xf'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x10')]);router['get'](_0x84cf('0x11'),auth[_0x84cf('0xc')](),controller['download']);router['post']('/',auth[_0x84cf('0xc')](),controller[_0x84cf('0x12')]);router[_0x84cf('0x13')](_0x84cf('0xf'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x14')]);router[_0x84cf('0x13')](_0x84cf('0x15'),auth[_0x84cf('0xc')](),interaction[_0x84cf('0x16')](_0x84cf('0x17'),_0x84cf('0x18')),controller[_0x84cf('0x19')]);router[_0x84cf('0x1a')](_0x84cf('0xe'),auth[_0x84cf('0xc')](),interaction[_0x84cf('0x16')](_0x84cf('0x17'),_0x84cf('0x1b')),controller['update']);router[_0x84cf('0x1c')](_0x84cf('0xe'),auth[_0x84cf('0xc')](),interaction[_0x84cf('0x16')](_0x84cf('0x17'),_0x84cf('0x1d')),controller[_0x84cf('0x1e')]);router['delete']('/:id/tags',auth[_0x84cf('0xc')](),controller[_0x84cf('0x1f')]);module[_0x84cf('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 a33beba..b2cbb56 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 _0x6dfa=['STRING','ENUM','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x6dfa,0x7b));var _0xa6df=function(_0x4e5567,_0x4dddcd){_0x4e5567=_0x4e5567-0x0;var _0x25c533=_0x6dfa[_0x4e5567];return _0x25c533;};'use strict';var Sequelize=require(_0xa6df('0x0'));var moment=require(_0xa6df('0x1'));module[_0xa6df('0x2')]={'closed':{'type':Sequelize[_0xa6df('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa6df('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa6df('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa6df('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa6df('0x6')]('in',_0xa6df('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa6df('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xa6df('0x6')]('in',_0xa6df('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa6df('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5334=['sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x39345e,_0x1738fe){var _0x3f07d6=function(_0x25120e){while(--_0x25120e){_0x39345e['push'](_0x39345e['shift']());}};_0x3f07d6(++_0x1738fe);}(_0x5334,0x84));var _0x4533=function(_0x4af10e,_0x2202e2){_0x4af10e=_0x4af10e-0x0;var _0x39f139=_0x5334[_0x4af10e];return _0x39f139;};'use strict';var Sequelize=require(_0x4533('0x0'));var moment=require(_0x4533('0x1'));module[_0x4533('0x2')]={'closed':{'type':Sequelize[_0x4533('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4533('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4533('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4533('0x5')]},'phone':{'type':Sequelize[_0x4533('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4533('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index ec31387..01c9b31 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 _0xceb0=['value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','clone','order','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','i.SmsAccountId\x20IS\x20NULL','agent','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','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','contactName','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','sequelize','groupBy','SmsInteractionId','all','rows','SmsInteraction','includeAll','options','create','body','update','params','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','pick','filter','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','root','server','files','attachments','join','User','CmContact','lastName','Messages','SmsAccount','Account','get','Sms','Owner','N.A.','closed','closedAt','disposition','direction','out','firstName','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','select','field','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages'];(function(_0x47cde9,_0x19d013){var _0x26fdf1=function(_0x32fb69){while(--_0x32fb69){_0x47cde9['push'](_0x47cde9['shift']());}};_0x26fdf1(++_0x19d013);}(_0xceb0,0x173));var _0x0ceb=function(_0x103bff,_0x55040a){_0x103bff=_0x103bff-0x0;var _0x3844fe=_0xceb0[_0x103bff];return _0x3844fe;};'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(_0x0ceb('0x0'));var moment=require('moment');var BPromise=require(_0x0ceb('0x1'));var Mustache=require(_0x0ceb('0x2'));var util=require(_0x0ceb('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x0ceb('0x4'));var ejs=require(_0x0ceb('0x5'));var fs=require('fs');var fs_extra=require(_0x0ceb('0x6'));var _=require('lodash');var squel=require(_0x0ceb('0x7'));var crypto=require(_0x0ceb('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x0ceb('0x9'));var toCsv=require('to-csv');var querystring=require(_0x0ceb('0xa'));var Papa=require(_0x0ceb('0xb'));var Redis=require(_0x0ceb('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0ceb('0xd'));var pdf=require(_0x0ceb('0xe'));var hardwareService=require(_0x0ceb('0xf'));var logger=require(_0x0ceb('0x10'))(_0x0ceb('0x11'));var utils=require(_0x0ceb('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0ceb('0x13'));var db=require(_0x0ceb('0x14'))['db'];config[_0x0ceb('0x15')]=_[_0x0ceb('0x16')](config[_0x0ceb('0x15')],{'host':_0x0ceb('0x17'),'port':0x18eb});var socket=require(_0x0ceb('0x18'))(new Redis(config['redis']));require(_0x0ceb('0x19'))['register'](socket);function respondWithStatusCode(_0x55620b,_0x440f0e){_0x440f0e=_0x440f0e||0xcc;return function(_0x2e6128){if(_0x2e6128){return _0x55620b[_0x0ceb('0x1a')](_0x440f0e);}return _0x55620b['status'](_0x440f0e)[_0x0ceb('0x1b')]();};}function respondWithResult(_0xc02d04,_0x58d580){_0x58d580=_0x58d580||0xc8;return function(_0x1dc6f5){if(_0x1dc6f5){return _0xc02d04[_0x0ceb('0x1c')](_0x58d580)[_0x0ceb('0x1d')](_0x1dc6f5);}};}function respondWithFilteredResult(_0x436a7c,_0x18bed1){return function(_0x27fbeb){if(_0x27fbeb){var _0x2c5a89=typeof _0x18bed1[_0x0ceb('0x1e')]===_0x0ceb('0x1f')&&typeof _0x18bed1[_0x0ceb('0x20')]===_0x0ceb('0x1f');var _0x18f845=_0x27fbeb[_0x0ceb('0x21')];var _0x3988f6=_0x2c5a89?0x0:_0x18bed1[_0x0ceb('0x1e')];var _0x3dd970=_0x2c5a89?_0x27fbeb[_0x0ceb('0x21')]:_0x18bed1['offset']+_0x18bed1['limit'];var _0x25c48a;if(_0x3dd970>=_0x18f845){_0x3dd970=_0x18f845;_0x25c48a=0xc8;}else{_0x25c48a=0xce;}_0x436a7c[_0x0ceb('0x1c')](_0x25c48a);return _0x436a7c['set'](_0x0ceb('0x22'),_0x3988f6+'-'+_0x3dd970+'/'+_0x18f845)['json'](_0x27fbeb);}return null;};}function patchUpdates(_0x38a716){return function(_0xc2b85c){try{jsonpatch[_0x0ceb('0x23')](_0xc2b85c,_0x38a716,!![]);}catch(_0x17efd7){return BPromise[_0x0ceb('0x24')](_0x17efd7);}return _0xc2b85c['save']();};}function saveUpdates(_0x5c41dd,_0x4d29f5){return function(_0x1a1ab3){if(_0x1a1ab3){return _0x1a1ab3['update'](_0x5c41dd)[_0x0ceb('0x25')](function(_0x4c3e4c){return _0x4c3e4c;});}return null;};}function removeEntity(_0x45f2fe,_0xa8be2a){return function(_0x120a47){if(_0x120a47){return _0x120a47[_0x0ceb('0x26')]()['then'](function(){_0x45f2fe[_0x0ceb('0x1c')](0xcc)[_0x0ceb('0x1b')]();});}};}function handleEntityNotFound(_0x15a556,_0x1451d3){return function(_0x2432a8){if(!_0x2432a8){_0x15a556['sendStatus'](0x194);}return _0x2432a8;};}function handleError(_0x2de4f3,_0x3792bb){_0x3792bb=_0x3792bb||0x1f4;return function(_0x3c934b){logger[_0x0ceb('0x27')](_0x3c934b[_0x0ceb('0x28')]);if(_0x3c934b[_0x0ceb('0x29')]){delete _0x3c934b['name'];}_0x2de4f3[_0x0ceb('0x1c')](_0x3792bb)[_0x0ceb('0x2a')](_0x3c934b);};}function getInteractionUsers(_0x1b5337,_0x385d68){return new BPromise(function(_0x331e98,_0x128102){try{if(_0x385d68[_0x1b5337['id']]){_0x1b5337[_0x0ceb('0x2b')]=_[_0x0ceb('0x2c')](_0x385d68[_0x1b5337['id']],function(_0x34a0b3){return{'id':_0x34a0b3['id'],'fullname':_0x34a0b3[_0x0ceb('0x2d')]};});}}catch(_0x5196ad){_0x128102(_0x5196ad);}_0x331e98(_0x1b5337);});}function getInteractionTags(_0x503d0c,_0x3ee0e1){return new BPromise(function(_0x5b121e,_0x2f2b8e){try{if(_0x503d0c[_0x0ceb('0x2e')]){_0x503d0c[_0x0ceb('0x2f')]=[];_0x503d0c['TagIds'][_0x0ceb('0x30')](',')[_0x0ceb('0x31')](function(_0x1725fe){_0x503d0c[_0x0ceb('0x2f')][_0x0ceb('0x32')](_0x3ee0e1[_0x1725fe]);});}delete _0x503d0c[_0x0ceb('0x2e')];}catch(_0x33ab80){_0x2f2b8e(_0x33ab80);}_0x5b121e(_0x503d0c);});}function updateSmsInteraction(_0x1eb2a8,_0x2ad461,_0x3dadbd){return new BPromise(function(_0x133e81,_0x116a47){return getInteractionUsers(_0x1eb2a8,_0x3dadbd)[_0x0ceb('0x25')](function(_0x540851){return getInteractionTags(_0x540851,_0x2ad461);})[_0x0ceb('0x25')](function(_0x39e7e1){_0x133e81(_0x39e7e1);})[_0x0ceb('0x33')](function(_0x6be70d){_0x116a47(_0x6be70d);});});}exports[_0x0ceb('0x34')]=function(_0xa808dc,_0x56182f){var _0x44806d={},_0x48bf08={},_0x4938e2={'count':0x0,'rows':[]};var _0x5e440a=_[_0x0ceb('0x2c')](db['SmsInteraction'][_0x0ceb('0x35')],function(_0x2f5e8a){return{'name':_0x2f5e8a['fieldName'],'type':_0x2f5e8a[_0x0ceb('0x36')][_0x0ceb('0x37')]};});_0x48bf08[_0x0ceb('0x38')]=_['map'](_0x5e440a,_0x0ceb('0x29'));_0x48bf08[_0x0ceb('0x39')]=_[_0x0ceb('0x3a')](_0xa808dc[_0x0ceb('0x39')]);_0x48bf08[_0x0ceb('0x3b')]=_[_0x0ceb('0x3c')](_0x48bf08[_0x0ceb('0x38')],_0x48bf08[_0x0ceb('0x39')]);_0x44806d[_0x0ceb('0x3d')]=_[_0x0ceb('0x3c')](_0x48bf08[_0x0ceb('0x38')],qs[_0x0ceb('0x3e')](_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x3e')]));_0x44806d[_0x0ceb('0x3d')]=_0x44806d[_0x0ceb('0x3d')][_0x0ceb('0x3f')]?_0x44806d[_0x0ceb('0x3d')]:_0x48bf08[_0x0ceb('0x38')];if(!_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x40')](_0x0ceb('0x41'))){_0x44806d[_0x0ceb('0x20')]=qs[_0x0ceb('0x20')](_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x20')]);_0x44806d[_0x0ceb('0x1e')]=qs[_0x0ceb('0x1e')](_0xa808dc['query'][_0x0ceb('0x1e')]);}_0x44806d['order']=qs['sort'](_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x42')]);_0x44806d[_0x0ceb('0x43')]=qs['filters'](_['pick'](_0xa808dc[_0x0ceb('0x39')],_0x48bf08[_0x0ceb('0x3b')]),_0x5e440a);var _0x2cb999=[];var _0x17ab4a=squel[_0x0ceb('0x44')]()[_0x0ceb('0x45')]('id')[_0x0ceb('0x45')](_0x0ceb('0x29'))[_0x0ceb('0x45')]('color')[_0x0ceb('0x46')](_0x0ceb('0x47'));var _0x252daf=squel[_0x0ceb('0x44')]()['field'](_0x0ceb('0x48'))['field'](_0x0ceb('0x49'))['field'](_0x0ceb('0x4a'))[_0x0ceb('0x46')](_0x0ceb('0x4b'),'ui')[_0x0ceb('0x4c')](_0x0ceb('0x4d'),'u',_0x0ceb('0x4e'));var _0x6273bb=squel[_0x0ceb('0x44')]()['from'](_0x0ceb('0x4f'),'i')[_0x0ceb('0x4c')]('cm_contacts','c',_0x0ceb('0x50'))[_0x0ceb('0x4c')](_0x0ceb('0x4d'),'o',_0x0ceb('0x51'))[_0x0ceb('0x4c')]('sms_accounts','a',_0x0ceb('0x52'))[_0x0ceb('0x4c')](_0x0ceb('0x53'),'me',_0x0ceb('0x54'))[_0x0ceb('0x4c')](_0x0ceb('0x55'),'it',_0x0ceb('0x56'))[_0x0ceb('0x4c')](_0x0ceb('0x47'),'t','t.id\x20=\x20it.TagId');var _0x1f5e16=squel[_0x0ceb('0x57')]();var _0x264d7b=[];var _0x42d723=squel['expr']();var _0x4aef77;if(_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x58')]){_0x4aef77=as[_0x0ceb('0x59')](_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x58')]);var _0x59606a=_0x4aef77[_0x0ceb('0x5a')];for(var _0x6c1b83=0x0;_0x6c1b83<_0x4aef77['conditions']['length'];_0x6c1b83++){var _0x483570=_0x4aef77[_0x0ceb('0x5b')][_0x6c1b83];var _0x33a79b='i';var _0x13fa76=_['find'](_0x5e440a,[_0x0ceb('0x29'),_0x483570[_0x0ceb('0x45')]]);if(!_0x13fa76){switch(_0x483570['field']){case _0x0ceb('0x5c'):if(_0x483570[_0x0ceb('0x5d')]==0x1){_0x6273bb[_0x0ceb('0x5e')]('`'+_0x483570['field']+_0x0ceb('0x5f'));}else{_0x6273bb['having']('`'+_0x483570[_0x0ceb('0x45')]+_0x0ceb('0x60'));}break;case _0x0ceb('0x61'):if(_0x483570[_0x0ceb('0x62')]===_0x0ceb('0x63')){if(_0x483570['value'][_0x0ceb('0x30')]('\x20')[_0x0ceb('0x3f')]>0x1){_0x1f5e16[_0x59606a](_0x0ceb('0x64'),qs[_0x0ceb('0x65')](_0x483570[_0x0ceb('0x5d')]),null);}else{var _0x17369d='%'+_0x483570[_0x0ceb('0x5d')]+'%';_0x1f5e16[_0x59606a](_0x0ceb('0x66'),_0x17369d,_0x17369d,_0x17369d);}}else{_0x13fa76=_[_0x0ceb('0x67')](_0x5e440a,[_0x0ceb('0x29'),'ContactId']);_0x483570[_0x0ceb('0x45')]=_0x0ceb('0x68');_0x511f1c=as[_0x0ceb('0x69')](_0x33a79b,_0x13fa76[_0x0ceb('0x36')],_0x483570);_0x1f5e16[_0x59606a](_0x511f1c[_0x0ceb('0x6a')],_0x511f1c[_0x0ceb('0x5d')][_0x0ceb('0x6b')],_0x511f1c['value'][_0x0ceb('0x1b')]);}break;case _0x0ceb('0x6c'):var _0x3dd2d5=_0x483570[_0x0ceb('0x5d')][_0x0ceb('0x30')](',')[_0x0ceb('0x2c')](function(_0x472b5c){return Number(_0x472b5c);});_0x3dd2d5[_0x0ceb('0x31')](function(_0x2bbd32){_0x42d723['or'](_0x0ceb('0x6d'),'%,'+_0x2bbd32+',%');});_0x264d7b=_[_0x0ceb('0x6e')](_0x264d7b,_0x3dd2d5);break;case'User':if(_0x483570[_0x0ceb('0x62')]===_0x0ceb('0x63')){_0x1f5e16[_0x59606a](_0x0ceb('0x6f'),'%'+_0x483570[_0x0ceb('0x5d')]+'%',null);}else{_0x13fa76=_[_0x0ceb('0x67')](_0x5e440a,['name',_0x0ceb('0x70')]);_0x483570[_0x0ceb('0x45')]='UserId';_0x511f1c=as[_0x0ceb('0x69')](_0x33a79b,_0x13fa76['type'],_0x483570);_0x1f5e16[_0x59606a](_0x511f1c[_0x0ceb('0x6a')],_0x511f1c[_0x0ceb('0x5d')][_0x0ceb('0x6b')],_0x511f1c[_0x0ceb('0x5d')][_0x0ceb('0x1b')]);}break;case'body':_0x511f1c=as[_0x0ceb('0x69')]('me',null,_0x483570);_0x1f5e16[_0x59606a](_0x511f1c[_0x0ceb('0x6a')],_0x511f1c[_0x0ceb('0x5d')][_0x0ceb('0x6b')],_0x511f1c[_0x0ceb('0x5d')][_0x0ceb('0x1b')]);break;}}else{var _0x511f1c=as[_0x0ceb('0x69')](_0x33a79b,_0x13fa76[_0x0ceb('0x36')],_0x483570);_0x1f5e16[_0x59606a](_0x511f1c[_0x0ceb('0x6a')],_0x511f1c[_0x0ceb('0x5d')]['start'],_0x511f1c['value'][_0x0ceb('0x1b')]);}}}else{var _0x44f321=_(_0xa808dc[_0x0ceb('0x39')])[_0x0ceb('0x3a')]()[_0x0ceb('0x2c')](function(_0x27bc5e){return _[_0x0ceb('0x71')](_0x5e440a,['name',_0x27bc5e])?_0x27bc5e:undefined;})[_0x0ceb('0x72')]()[_0x0ceb('0x5d')]();if(!_[_0x0ceb('0x73')](_0x44f321)){_0x44f321[_0x0ceb('0x31')](function(_0x21f437){if(_0x21f437===_0x0ceb('0x74')){_0x6273bb[_0x0ceb('0x43')](_0x0ceb('0x75'),[][_0x0ceb('0x76')](_0xa808dc[_0x0ceb('0x39')][_0x21f437]));}else if(_0x21f437===_0x0ceb('0x77')){var _0x56e3a8=JSON[_0x0ceb('0x78')](_0xa808dc[_0x0ceb('0x39')][_0x21f437])[_0x0ceb('0x79')];var _0x12ea30=JSON[_0x0ceb('0x78')](_0xa808dc[_0x0ceb('0x39')][_0x21f437])[_0x0ceb('0x7a')];_0x6273bb['where'](_0x0ceb('0x7b'),_0x56e3a8,_0x12ea30);}else{if(_0xa808dc[_0x0ceb('0x39')][_0x21f437]===_0x0ceb('0x7c')){_0x6273bb['where']('i.'+_0x21f437+_0x0ceb('0x7d'));}else{_0x6273bb[_0x0ceb('0x43')]('i.'+_0x21f437+_0x0ceb('0x7e'),_0xa808dc[_0x0ceb('0x39')][_0x21f437]);}}});}if(_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x7f')]){if(_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x7f')]==0x1){_0x6273bb[_0x0ceb('0x5e')](_0x0ceb('0x80'));}else{_0x6273bb['having'](_0x0ceb('0x81'));}}if(_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x82')]){_0x264d7b=_['isArray'](_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x82')])?_0xa808dc[_0x0ceb('0x39')]['tag']:new Array(_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x82')]);_0x264d7b[_0x0ceb('0x31')](function(_0x21a177){_0x42d723['or'](_0x0ceb('0x6d'),'%,'+_0x21a177+',%');});}if(_0xa808dc['query']['filter']){var _0x58ec94=_0xa808dc[_0x0ceb('0x39')]['filter'][_0x0ceb('0x83')]('\x5c','\x5c\x5c')[_0x0ceb('0x83')](/'/g,'\x27\x27');if(qs[_0x0ceb('0x84')](_0x58ec94)){_0x1f5e16['or'](_0x0ceb('0x85'),_0x58ec94+'%')['or']('i.phone\x20LIKE\x20?',_0x58ec94+'%');}else{_0x1f5e16['or'](_0x0ceb('0x86'),qs[_0x0ceb('0x65')](_0x58ec94))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x58ec94+'%');}}}_0x6273bb[_0x0ceb('0x43')](_0x1f5e16);_0x6273bb['group'](_0x0ceb('0x87'));var _0x339198={'type':db[_0x0ceb('0x88')][_0x0ceb('0x89')]['SELECT'],'raw':!![]};var _0x5839d8=_0x6273bb[_0x0ceb('0x8a')]();_0x5839d8[_0x0ceb('0x45')]('i.id');_0x5839d8[_0x0ceb('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0ceb('0x5c'));if(_0x44806d[_0x0ceb('0x8b')]){_0x44806d[_0x0ceb('0x8b')][_0x0ceb('0x31')](function(_0x2e1fff){var _0x45a8c4=_0x2e1fff[0x0]==='contactName'?_0x2e1fff[0x0]:'i.'+_0x2e1fff[0x0];_0x6273bb[_0x0ceb('0x8b')](_0x45a8c4,_0x2e1fff[0x1]===_0x0ceb('0x8c')?![]:!![]);});}if(!_[_0x0ceb('0x73')](_0x264d7b)){_0x6273bb[_0x0ceb('0x5e')](_0x42d723);_0x5839d8[_0x0ceb('0x43')](_0x0ceb('0x8d'),_0x264d7b);}BPromise[_0x0ceb('0x8e')]()[_0x0ceb('0x25')](function(){if(!_0x4aef77){if(_0xa808dc['query'][_0x0ceb('0x74')])return;_0x5839d8[_0x0ceb('0x43')](_0x0ceb('0x8f'));_0x6273bb['where'](_0x0ceb('0x8f'));return;}if(_0xa808dc[_0x0ceb('0x90')][_0x0ceb('0x91')]!=='agent')return;return _0xa808dc[_0x0ceb('0x90')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x33ba4d){if(_[_0x0ceb('0x73')](_0x33ba4d)){_0x5839d8['where'](_0x0ceb('0x92'));_0x6273bb[_0x0ceb('0x43')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x5839d8[_0x0ceb('0x43')](_0x0ceb('0x75'),_['map'](_0x33ba4d,'id'));_0x6273bb['where'](_0x0ceb('0x75'),_[_0x0ceb('0x2c')](_0x33ba4d,'id'));}});})[_0x0ceb('0x25')](function(){if(_0xa808dc[_0x0ceb('0x90')][_0x0ceb('0x91')]===_0x0ceb('0x93')&&!_0x4aef77&&!_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x74')])return[];return db['sequelize'][_0x0ceb('0x39')](_0x5839d8[_0x0ceb('0x94')](),_0x339198);})[_0x0ceb('0x25')](function(_0x31b748){_0x4938e2[_0x0ceb('0x21')]=_0x31b748[_0x0ceb('0x3f')];if(_0x4938e2[_0x0ceb('0x21')]===0x0)return[];return db['sequelize'][_0x0ceb('0x39')](_0x17ab4a[_0x0ceb('0x94')](),_0x339198)[_0x0ceb('0x25')](function(_0x30b2b8){_0x2cb999=_[_0x0ceb('0x95')](_0x30b2b8,'id');_0x339198=_[_0x0ceb('0x96')](_0x339198,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xa808dc[_0x0ceb('0x39')][_0x0ceb('0x3e')]){_0x44806d[_0x0ceb('0x3d')][_0x0ceb('0x31')](function(_0x1bf592){_0x6273bb[_0x0ceb('0x45')]('i.'+_0x1bf592);});}else{_0x6273bb['field'](_0x0ceb('0x97'),_0x0ceb('0x5c'));_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0x98'),_0x0ceb('0x99'));_0x6273bb['field'](_0x0ceb('0x9a'),'Account.mandatoryDisposition');_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0x9b'),_0x0ceb('0x9c'));_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0x9d'));_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0x9e'),_0x0ceb('0x9f'));_0x6273bb[_0x0ceb('0x45')]('c.lastName',_0x0ceb('0xa0'));_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0xa1'),_0x0ceb('0xa2'));_0x6273bb[_0x0ceb('0x45')]('c.phone',_0x0ceb('0xa3'));_0x6273bb[_0x0ceb('0x45')]('c.mobile','Contact.mobile');_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0xa4'),_0x0ceb('0xa5'));_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0xa6'),_0x0ceb('0xa7'));_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0xa8'),_0x0ceb('0xa9'));_0x6273bb[_0x0ceb('0x45')](_0x0ceb('0xaa'),'TagIds');}if(_0x44806d['limit'])_0x6273bb['limit'](_0x44806d[_0x0ceb('0x20')]);if(_0x44806d[_0x0ceb('0x1e')])_0x6273bb[_0x0ceb('0x1e')](_0x44806d[_0x0ceb('0x1e')]);return db['sequelize'][_0x0ceb('0x39')](_0x6273bb[_0x0ceb('0x94')](),_0x339198);})[_0x0ceb('0x25')](function(_0x88170a){if(_0x88170a[_0x0ceb('0x3f')]>0x0)_0x252daf[_0x0ceb('0x43')](_0x0ceb('0xab'),_[_0x0ceb('0x2c')](_0x88170a,'id'));return db[_0x0ceb('0xac')][_0x0ceb('0x39')](_0x252daf[_0x0ceb('0x94')](),_0x339198)[_0x0ceb('0x25')](function(_0x1b57db){var _0x480465=_[_0x0ceb('0xad')](_0x1b57db,_0x0ceb('0xae'));var _0x3af9de=[];_0x88170a[_0x0ceb('0x31')](function(_0x1235ba){_0x3af9de['push'](updateSmsInteraction(_0x1235ba,_0x2cb999,_0x480465));});return BPromise[_0x0ceb('0xaf')](_0x3af9de);});});})['then'](function(_0x83108d){_0x4938e2[_0x0ceb('0xb0')]=_0x83108d;return _0x4938e2;})[_0x0ceb('0x25')](respondWithFilteredResult(_0x56182f,_0x44806d))[_0x0ceb('0x33')](handleError(_0x56182f,null));};exports['show']=function(_0x959dfa,_0x2d863c){var _0x3a2979={'raw':![],'where':{'id':_0x959dfa['params']['id']}},_0x44e70f={};_0x44e70f[_0x0ceb('0x38')]=_['keys'](db[_0x0ceb('0xb1')]['rawAttributes']);_0x44e70f[_0x0ceb('0x39')]=_['keys'](_0x959dfa[_0x0ceb('0x39')]);_0x44e70f[_0x0ceb('0x3b')]=_['intersection'](_0x44e70f[_0x0ceb('0x38')],_0x44e70f['query']);_0x3a2979[_0x0ceb('0x3d')]=_[_0x0ceb('0x3c')](_0x44e70f[_0x0ceb('0x38')],qs[_0x0ceb('0x3e')](_0x959dfa[_0x0ceb('0x39')][_0x0ceb('0x3e')]));_0x3a2979[_0x0ceb('0x3d')]=_0x3a2979[_0x0ceb('0x3d')]['length']?_0x3a2979[_0x0ceb('0x3d')]:_0x44e70f['model'];if(_0x959dfa[_0x0ceb('0x39')][_0x0ceb('0xb2')]){_0x3a2979['include']=[{'all':!![]}];}_0x3a2979=_[_0x0ceb('0x96')]({},_0x3a2979,_0x959dfa[_0x0ceb('0xb3')]);return db[_0x0ceb('0xb1')][_0x0ceb('0x67')](_0x3a2979)[_0x0ceb('0x25')](handleEntityNotFound(_0x2d863c,null))[_0x0ceb('0x25')](respondWithResult(_0x2d863c,null))[_0x0ceb('0x33')](handleError(_0x2d863c,null));};exports[_0x0ceb('0xb4')]=function(_0x38bc57,_0x428c2b){return db['SmsInteraction'][_0x0ceb('0xb4')](_0x38bc57[_0x0ceb('0xb5')],{})[_0x0ceb('0x25')](respondWithResult(_0x428c2b,0xc9))[_0x0ceb('0x33')](handleError(_0x428c2b,null));};exports[_0x0ceb('0xb6')]=function(_0x5599c0,_0x3a2b20){if(_0x5599c0[_0x0ceb('0xb5')]['id']){delete _0x5599c0[_0x0ceb('0xb5')]['id'];}return db[_0x0ceb('0xb1')][_0x0ceb('0x67')]({'where':{'id':_0x5599c0[_0x0ceb('0xb7')]['id']}})['then'](handleEntityNotFound(_0x3a2b20,null))[_0x0ceb('0x25')](saveUpdates(_0x5599c0[_0x0ceb('0xb5')],null))[_0x0ceb('0x25')](respondWithResult(_0x3a2b20,null))[_0x0ceb('0x33')](handleError(_0x3a2b20,null));};exports['destroy']=function(_0x5b4af6,_0x1acb0c){return db[_0x0ceb('0xb1')][_0x0ceb('0x67')]({'where':{'id':_0x5b4af6[_0x0ceb('0xb7')]['id']}})[_0x0ceb('0x25')](handleEntityNotFound(_0x1acb0c,null))[_0x0ceb('0x25')](removeEntity(_0x1acb0c,null))[_0x0ceb('0x33')](handleError(_0x1acb0c,null));};exports[_0x0ceb('0xb8')]=function(_0x55a75b,_0x25064d){return db[_0x0ceb('0xb1')][_0x0ceb('0xb8')]()[_0x0ceb('0x25')](respondWithResult(_0x25064d,null))['catch'](handleError(_0x25064d,null));};exports[_0x0ceb('0xb9')]=function(_0x281fef,_0x4b4dcc,_0x281781){return db['SmsMessage'][_0x0ceb('0x67')]({'where':{'id':_0x281fef[_0x0ceb('0xb7')]['id']}})[_0x0ceb('0x25')](handleEntityNotFound(_0x4b4dcc,null))[_0x0ceb('0x25')](function(_0x10fa3c){if(_0x10fa3c){return _0x10fa3c[_0x0ceb('0xb9')](_0x281fef['body'][_0x0ceb('0xba')],_[_0x0ceb('0xbb')](_0x281fef['body'],[_0x0ceb('0xba'),'id'])||{});}})[_0x0ceb('0x25')](respondWithResult(_0x4b4dcc,null))['catch'](handleError(_0x4b4dcc,null));};exports[_0x0ceb('0xbc')]=function(_0x30e92d,_0x802af8,_0x33b71e){var _0x309a9c={'raw':![],'where':{}};var _0x6ecc59={};var _0x4f42c0={'count':0x0,'rows':[]};return db[_0x0ceb('0xb1')][_0x0ceb('0xbd')]({'where':{'id':_0x30e92d[_0x0ceb('0xb7')]['id']}})[_0x0ceb('0x25')](handleEntityNotFound(_0x802af8,null))[_0x0ceb('0x25')](function(_0x5dd644){if(_0x5dd644){_0x6ecc59[_0x0ceb('0x38')]=_['keys'](db[_0x0ceb('0xbe')]['rawAttributes']);_0x6ecc59[_0x0ceb('0x39')]=_[_0x0ceb('0x3a')](_0x30e92d[_0x0ceb('0x39')]);_0x6ecc59[_0x0ceb('0x3b')]=_['intersection'](_0x6ecc59[_0x0ceb('0x38')],_0x6ecc59[_0x0ceb('0x39')]);_0x309a9c['attributes']=_['intersection'](_0x6ecc59[_0x0ceb('0x38')],qs[_0x0ceb('0x3e')](_0x30e92d[_0x0ceb('0x39')][_0x0ceb('0x3e')]));_0x309a9c[_0x0ceb('0x3d')]=_0x309a9c[_0x0ceb('0x3d')][_0x0ceb('0x3f')]?_0x309a9c[_0x0ceb('0x3d')]:_0x6ecc59['model'];if(!_0x30e92d[_0x0ceb('0x39')][_0x0ceb('0x40')](_0x0ceb('0x41'))){_0x309a9c[_0x0ceb('0x20')]=qs[_0x0ceb('0x20')](_0x30e92d['query'][_0x0ceb('0x20')]);_0x309a9c[_0x0ceb('0x1e')]=qs['offset'](_0x30e92d[_0x0ceb('0x39')][_0x0ceb('0x1e')]);}_0x309a9c[_0x0ceb('0x8b')]=qs[_0x0ceb('0x42')](_0x30e92d['query']['sort']);_0x309a9c[_0x0ceb('0x43')]=qs[_0x0ceb('0x3b')](_[_0x0ceb('0xbf')](_0x30e92d['query'],_0x6ecc59[_0x0ceb('0x3b')]));_0x309a9c[_0x0ceb('0x43')][_0x0ceb('0xae')]=_0x5dd644['id'];if(_0x30e92d['query'][_0x0ceb('0xc0')]){_0x309a9c[_0x0ceb('0x43')]=_[_0x0ceb('0x96')](_0x309a9c[_0x0ceb('0x43')],{'$or':_[_0x0ceb('0x2c')](_0x309a9c['attributes'],function(_0x21854e){var _0x314ca8={};_0x314ca8[_0x21854e]={'$like':'%'+_0x30e92d[_0x0ceb('0x39')][_0x0ceb('0xc0')]+'%'};return _0x314ca8;})});}if(_0x30e92d[_0x0ceb('0x39')][_0x0ceb('0x79')]){var _0x2a174b=_0x30e92d[_0x0ceb('0x39')][_0x0ceb('0x79')][_0x0ceb('0x30')](',');var _0x68f149={};_0x68f149[_0x2a174b[0x0]]={'$gte':moment(_0x2a174b[0x1])[_0x0ceb('0xc1')](_0x0ceb('0xc2'))};_0x309a9c['where']=_[_0x0ceb('0x96')](_0x309a9c[_0x0ceb('0x43')],_0x68f149);}_0x309a9c=_['merge']({},_0x309a9c,_0x30e92d['options']);return db[_0x0ceb('0xbe')][_0x0ceb('0x21')]({'where':_0x309a9c[_0x0ceb('0x43')]})[_0x0ceb('0x25')](function(_0xf2dab2){_0x4f42c0['count']=_0xf2dab2;if(_0x30e92d[_0x0ceb('0x39')][_0x0ceb('0xb2')]){_0x309a9c[_0x0ceb('0xc3')]=[{'all':!![]}];}return db['SmsMessage'][_0x0ceb('0xc4')](_0x309a9c);})['then'](function(_0x3163ec){_0x4f42c0[_0x0ceb('0xb0')]=_0x3163ec;return _0x4f42c0;});}})[_0x0ceb('0x25')](respondWithFilteredResult(_0x802af8,_0x309a9c))[_0x0ceb('0x33')](handleError(_0x802af8,null));};exports[_0x0ceb('0xc5')]=function(_0xbad546,_0x1c28de,_0x1be9b9){return db['SmsInteraction'][_0x0ceb('0x67')]({'where':{'id':_0xbad546[_0x0ceb('0xb7')]['id']}})[_0x0ceb('0x25')](handleEntityNotFound(_0x1c28de,null))[_0x0ceb('0x25')](function(_0x1bac42){if(_0x1bac42){return _0x1bac42[_0x0ceb('0xc6')](_0xbad546[_0x0ceb('0xb5')][_0x0ceb('0xba')],_[_0x0ceb('0xbb')](_0xbad546['body'],[_0x0ceb('0xba'),'id'])||{})[_0x0ceb('0xc7')](function(){return db[_0x0ceb('0x6c')]['findAll']({'attributes':['id',_0x0ceb('0x29'),'color'],'where':{'id':_0xbad546[_0x0ceb('0xb5')][_0x0ceb('0xba')]}});})['then'](function(_0x3963cb){socket[_0x0ceb('0xc8')](_0x0ceb('0xc9'),{'id':Number(_0xbad546[_0x0ceb('0xb7')]['id']),'tags':_0x3963cb||[]});return{'id':Number(_0xbad546['params']['id']),'tags':_0x3963cb||[]};});}})[_0x0ceb('0x25')](respondWithResult(_0x1c28de,null))[_0x0ceb('0x33')](handleError(_0x1c28de,null));};exports[_0x0ceb('0xca')]=function(_0x54e3f8,_0x590bc6,_0xb4ab9f){return db[_0x0ceb('0xb1')][_0x0ceb('0x67')]({'where':{'id':_0x54e3f8[_0x0ceb('0xb7')]['id']}})[_0x0ceb('0x25')](handleEntityNotFound(_0x590bc6,null))['then'](function(_0xa64391){if(_0xa64391){return _0xa64391['removeTags'](_0x54e3f8[_0x0ceb('0x39')][_0x0ceb('0xba')]);}})[_0x0ceb('0x25')](respondWithStatusCode(_0x590bc6,null))['catch'](handleError(_0x590bc6,null));};exports[_0x0ceb('0xcb')]=function(_0x446aad,_0x54ac00){var _0x453dc9=moment()['unix']()[_0x0ceb('0x94')]();var _0x5c0bdd=path['join'](config[_0x0ceb('0xcc')],_0x0ceb('0xcd'),_0x0ceb('0xce'),'tmp');var _0x35e0af=path['join'](config['root'],_0x0ceb('0xcd'),_0x0ceb('0xce'),_0x0ceb('0xcf'));var _0x5c6d3f=path[_0x0ceb('0xd0')](_0x5c0bdd,_0x453dc9);var _0x2bbffb=util[_0x0ceb('0xc1')]('transcript-%d-%s.zip',_0x446aad[_0x0ceb('0xb7')]['id'],_0x453dc9);var _0x3f070c=path[_0x0ceb('0xd0')](_0x5c0bdd,_0x2bbffb);var _0x36c720=[];_0x36c720['push']({'model':db[_0x0ceb('0xd1')],'as':_0x0ceb('0xd1'),'attributes':['id',_0x0ceb('0x2d')],'raw':!![]});_0x36c720[_0x0ceb('0x32')]({'model':db[_0x0ceb('0xd2')],'as':_0x0ceb('0x61'),'attributes':['id','firstName',_0x0ceb('0xd3')],'raw':!![]});var _0x358779=[{'model':db['SmsMessage'],'as':_0x0ceb('0xd4'),'attributes':['id','body',_0x0ceb('0x77'),'direction','secret','read'],'include':_0x36c720}];_0x358779[_0x0ceb('0x32')]({'model':db[_0x0ceb('0xd5')],'as':_0x0ceb('0xd6'),'attributes':['id',_0x0ceb('0x29')]});_0x358779['push']({'model':db[_0x0ceb('0xd1')],'as':'Owner','attributes':['id',_0x0ceb('0x2d')]});return db['SmsInteraction'][_0x0ceb('0x67')]({'where':{'id':_0x446aad[_0x0ceb('0xb7')]['id']},'include':_0x358779})[_0x0ceb('0x25')](handleEntityNotFound(_0x54ac00,null))[_0x0ceb('0x25')](function(_0x41de22){if(_0x41de22){var _0x39e586=_0x41de22[_0x0ceb('0xd7')]({'plain':!![]});fs['mkdirSync'](_0x5c6d3f);var _0x2a967c={'channel':_0x0ceb('0xd8'),'account':_0x39e586[_0x0ceb('0xd6')][_0x0ceb('0x29')],'agent':_0x39e586[_0x0ceb('0xd9')]?_0x39e586['Owner'][_0x0ceb('0x2d')]:_0x0ceb('0xda'),'createdAt':moment(_0x39e586['createdAt'])['format'](_0x0ceb('0xc2'))[_0x0ceb('0x94')](),'closedAt':_0x39e586[_0x0ceb('0xdb')]?moment(_0x39e586[_0x0ceb('0xdc')])[_0x0ceb('0xc1')](_0x0ceb('0xc2'))[_0x0ceb('0x94')]():'','disposition':_0x39e586[_0x0ceb('0xdd')],'messages':_(_0x39e586['Messages'])[_0x0ceb('0xc0')]({'secret':![]})[_0x0ceb('0x2c')](function(_0x3782b2){return{'date':moment(_0x3782b2['createdAt'])['format'](_0x0ceb('0xc2'))[_0x0ceb('0x94')](),'sender':_0x3782b2[_0x0ceb('0xde')]===_0x0ceb('0xdf')?_0x3782b2[_0x0ceb('0xd1')]?_0x3782b2[_0x0ceb('0xd1')][_0x0ceb('0x2d')]:'System':_0x3782b2[_0x0ceb('0x61')][_0x0ceb('0xe0')]+(_0x3782b2[_0x0ceb('0x61')][_0x0ceb('0xd3')]?'\x20'+_0x3782b2[_0x0ceb('0x61')]['lastName']:''),'body':_0x3782b2[_0x0ceb('0xb5')],'direction':_0x3782b2[_0x0ceb('0xde')]===_0x0ceb('0xdf')?'A':'C','secret':_0x3782b2['secret'],'read':_0x3782b2[_0x0ceb('0x7f')]};})[_0x0ceb('0x5d')]()};return ejs['renderFile'](path['join'](config[_0x0ceb('0xcc')],'server',_0x0ceb('0xe1'),_0x0ceb('0xe2')),{'interaction':_0x2a967c})[_0x0ceb('0x25')](function(_0x5ed271){var _0x17fd66=path[_0x0ceb('0xd0')](_0x5c6d3f,'transcript-'+_0x39e586['id']+'-'+_0x453dc9+_0x0ceb('0xe3'));var _0x1e1e69={'path':_0x17fd66,'channel':_0x0ceb('0xd8'),'interactionId':_0x39e586['id']};return pdf[_0x0ceb('0xe4')](_0x5ed271,_0x1e1e69);})['then'](function(){return new BPromise(function(_0x3b3046,_0x4e92f1){zipdir(_0x5c6d3f,{'saveTo':_0x3f070c},function(_0x1c7b1b,_0x4ade28){if(_0x1c7b1b)return _0x4e92f1(_0x1c7b1b);return _0x3b3046(_0x4ade28);});})[_0x0ceb('0x25')](function(){return new BPromise(function(_0x367d43,_0x258761){rimraf(_0x5c6d3f,function(_0x34dd93){if(_0x34dd93)_0x258761(_0x34dd93);return _0x367d43();});});})['then'](function(){return _0x54ac00[_0x0ceb('0xcb')](_0x3f070c,_0x2bbffb,function(_0x1e48c1){if(_0x1e48c1){console[_0x0ceb('0xe5')](_0x0ceb('0xe6'),_0x1e48c1);}else{fs[_0x0ceb('0xe7')](_0x3f070c);}});});});}else{return _0x54ac00[_0x0ceb('0x1a')](0xc8);}})[_0x0ceb('0x33')](handleError(_0x54ac00,null));}; \ No newline at end of file +var _0xb170=['localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','end','stack','name','send','map','fullname','TagIds','Tags','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','select','field','tools_tags','u.id','u.fullname','ui.SmsInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','unreadMessages','value','having','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','SmsAccountId','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','all','rows','show','params','include','options','create','describe','addMessage','SmsMessage','ids','omit','pick','SmsInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','color','emit','smsInteractionTags:save','removeTags','download','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','createdAt','secret','Owner','mkdirSync','Account','N.A.','closed','closedAt','disposition','Messages','direction','out','System','renderFile','downloadInteraction.ejs','transcript-','.pdf','Sms','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x100831,_0x307925){var _0x9dd1bd=function(_0x16cf1c){while(--_0x16cf1c){_0x100831['push'](_0x100831['shift']());}};_0x9dd1bd(++_0x307925);}(_0xb170,0xd1));var _0x0b17=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xb170[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require(_0x0b17('0x0'));var rimraf=require(_0x0b17('0x1'));var zipdir=require(_0x0b17('0x2'));var jsonpatch=require(_0x0b17('0x3'));var rp=require(_0x0b17('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0b17('0x5'));var util=require(_0x0b17('0x6'));var path=require(_0x0b17('0x7'));var sox=require('sox');var csv=require(_0x0b17('0x8'));var ejs=require(_0x0b17('0x9'));var fs=require('fs');var fs_extra=require(_0x0b17('0xa'));var _=require('lodash');var squel=require(_0x0b17('0xb'));var crypto=require(_0x0b17('0xc'));var jsforce=require(_0x0b17('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0b17('0x8'));var querystring=require(_0x0b17('0xe'));var Papa=require(_0x0b17('0xf'));var Redis=require(_0x0b17('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0b17('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x0b17('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x0b17('0x13'));var config=require(_0x0b17('0x14'));var licenseUtil=require(_0x0b17('0x15'));var db=require(_0x0b17('0x16'))['db'];config[_0x0b17('0x17')]=_[_0x0b17('0x18')](config[_0x0b17('0x17')],{'host':_0x0b17('0x19'),'port':0x18eb});var socket=require(_0x0b17('0x1a'))(new Redis(config['redis']));require(_0x0b17('0x1b'))[_0x0b17('0x1c')](socket);function respondWithStatusCode(_0x239e1e,_0x484af1){_0x484af1=_0x484af1||0xcc;return function(_0x1f0f15){if(_0x1f0f15){return _0x239e1e[_0x0b17('0x1d')](_0x484af1);}return _0x239e1e[_0x0b17('0x1e')](_0x484af1)['end']();};}function respondWithResult(_0x5adec7,_0x485626){_0x485626=_0x485626||0xc8;return function(_0x369941){if(_0x369941){return _0x5adec7[_0x0b17('0x1e')](_0x485626)[_0x0b17('0x1f')](_0x369941);}};}function respondWithFilteredResult(_0x2c45ff,_0x1dbbf1){return function(_0x2faeb5){if(_0x2faeb5){var _0x1fc3c1=typeof _0x1dbbf1[_0x0b17('0x20')]==='undefined'&&typeof _0x1dbbf1[_0x0b17('0x21')]===_0x0b17('0x22');var _0x22f7eb=_0x2faeb5[_0x0b17('0x23')];var _0x2c2389=_0x1fc3c1?0x0:_0x1dbbf1[_0x0b17('0x20')];var _0x5ae4f5=_0x1fc3c1?_0x2faeb5[_0x0b17('0x23')]:_0x1dbbf1[_0x0b17('0x20')]+_0x1dbbf1['limit'];var _0x3d3274;if(_0x5ae4f5>=_0x22f7eb){_0x5ae4f5=_0x22f7eb;_0x3d3274=0xc8;}else{_0x3d3274=0xce;}_0x2c45ff[_0x0b17('0x1e')](_0x3d3274);return _0x2c45ff[_0x0b17('0x24')]('Content-Range',_0x2c2389+'-'+_0x5ae4f5+'/'+_0x22f7eb)[_0x0b17('0x1f')](_0x2faeb5);}return null;};}function patchUpdates(_0x513d78){return function(_0x3c0a3c){try{jsonpatch[_0x0b17('0x25')](_0x3c0a3c,_0x513d78,!![]);}catch(_0x1d4745){return BPromise[_0x0b17('0x26')](_0x1d4745);}return _0x3c0a3c[_0x0b17('0x27')]();};}function saveUpdates(_0x1b9511,_0x5bec9e){return function(_0x414293){if(_0x414293){return _0x414293[_0x0b17('0x28')](_0x1b9511)[_0x0b17('0x29')](function(_0xbf5209){return _0xbf5209;});}return null;};}function removeEntity(_0x53cc3c,_0x397d80){return function(_0x43ab06){if(_0x43ab06){return _0x43ab06[_0x0b17('0x2a')]()[_0x0b17('0x29')](function(){_0x53cc3c['status'](0xcc)[_0x0b17('0x2b')]();});}};}function handleEntityNotFound(_0x27a0cf,_0x579155){return function(_0x4ebbfa){if(!_0x4ebbfa){_0x27a0cf['sendStatus'](0x194);}return _0x4ebbfa;};}function handleError(_0x2eedb7,_0x1c26da){_0x1c26da=_0x1c26da||0x1f4;return function(_0x18f512){logger['error'](_0x18f512[_0x0b17('0x2c')]);if(_0x18f512[_0x0b17('0x2d')]){delete _0x18f512[_0x0b17('0x2d')];}_0x2eedb7[_0x0b17('0x1e')](_0x1c26da)[_0x0b17('0x2e')](_0x18f512);};}function getInteractionUsers(_0x1a3479,_0x4308cf){return new BPromise(function(_0x496996,_0x1b5b76){try{if(_0x4308cf[_0x1a3479['id']]){_0x1a3479['Users']=_[_0x0b17('0x2f')](_0x4308cf[_0x1a3479['id']],function(_0x2bef42){return{'id':_0x2bef42['id'],'fullname':_0x2bef42[_0x0b17('0x30')]};});}}catch(_0x1be5d5){_0x1b5b76(_0x1be5d5);}_0x496996(_0x1a3479);});}function getInteractionTags(_0x3676ec,_0x1d9b18){return new BPromise(function(_0x2bc17e,_0x3fe9d9){try{if(_0x3676ec[_0x0b17('0x31')]){_0x3676ec['Tags']=[];_0x3676ec[_0x0b17('0x31')]['split'](',')['forEach'](function(_0x3b1d15){_0x3676ec[_0x0b17('0x32')][_0x0b17('0x33')](_0x1d9b18[_0x3b1d15]);});}delete _0x3676ec['TagIds'];}catch(_0x4924d3){_0x3fe9d9(_0x4924d3);}_0x2bc17e(_0x3676ec);});}function updateSmsInteraction(_0x20ae52,_0x4f78ad,_0x52ea33){return new BPromise(function(_0x20f83d,_0x12c7af){return getInteractionUsers(_0x20ae52,_0x52ea33)[_0x0b17('0x29')](function(_0x5bb3a0){return getInteractionTags(_0x5bb3a0,_0x4f78ad);})[_0x0b17('0x29')](function(_0x371f7b){_0x20f83d(_0x371f7b);})[_0x0b17('0x34')](function(_0x21c5b9){_0x12c7af(_0x21c5b9);});});}exports[_0x0b17('0x35')]=function(_0x40e47,_0x104ad6){var _0x529402={},_0x33c235={},_0x51b25f={'count':0x0,'rows':[]};var _0x17732e=_[_0x0b17('0x2f')](db[_0x0b17('0x36')][_0x0b17('0x37')],function(_0x404c16){return{'name':_0x404c16[_0x0b17('0x38')],'type':_0x404c16[_0x0b17('0x39')][_0x0b17('0x3a')]};});_0x33c235['model']=_[_0x0b17('0x2f')](_0x17732e,_0x0b17('0x2d'));_0x33c235[_0x0b17('0x3b')]=_[_0x0b17('0x3c')](_0x40e47['query']);_0x33c235[_0x0b17('0x3d')]=_['intersection'](_0x33c235[_0x0b17('0x3e')],_0x33c235[_0x0b17('0x3b')]);_0x529402[_0x0b17('0x3f')]=_[_0x0b17('0x40')](_0x33c235[_0x0b17('0x3e')],qs[_0x0b17('0x41')](_0x40e47[_0x0b17('0x3b')][_0x0b17('0x41')]));_0x529402['attributes']=_0x529402[_0x0b17('0x3f')]['length']?_0x529402[_0x0b17('0x3f')]:_0x33c235[_0x0b17('0x3e')];if(!_0x40e47[_0x0b17('0x3b')][_0x0b17('0x42')](_0x0b17('0x43'))){_0x529402[_0x0b17('0x21')]=qs[_0x0b17('0x21')](_0x40e47[_0x0b17('0x3b')][_0x0b17('0x21')]);_0x529402[_0x0b17('0x20')]=qs[_0x0b17('0x20')](_0x40e47[_0x0b17('0x3b')][_0x0b17('0x20')]);}_0x529402[_0x0b17('0x44')]=qs[_0x0b17('0x45')](_0x40e47[_0x0b17('0x3b')][_0x0b17('0x45')]);_0x529402[_0x0b17('0x46')]=qs[_0x0b17('0x3d')](_['pick'](_0x40e47[_0x0b17('0x3b')],_0x33c235[_0x0b17('0x3d')]),_0x17732e);var _0x123fc8=[];var _0x1e2eae=squel[_0x0b17('0x47')]()[_0x0b17('0x48')]('id')[_0x0b17('0x48')](_0x0b17('0x2d'))[_0x0b17('0x48')]('color')['from'](_0x0b17('0x49'));var _0x3ec632=squel[_0x0b17('0x47')]()[_0x0b17('0x48')](_0x0b17('0x4a'))['field'](_0x0b17('0x4b'))['field'](_0x0b17('0x4c'))[_0x0b17('0x4d')]('user_has_sms_interactions','ui')[_0x0b17('0x4e')](_0x0b17('0x4f'),'u',_0x0b17('0x50'));var _0x58e28=squel[_0x0b17('0x47')]()['from'](_0x0b17('0x51'),'i')[_0x0b17('0x4e')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x0b17('0x4f'),'o','o.id\x20=\x20i.UserId')[_0x0b17('0x4e')](_0x0b17('0x52'),'a',_0x0b17('0x53'))[_0x0b17('0x4e')](_0x0b17('0x54'),'me',_0x0b17('0x55'))[_0x0b17('0x4e')](_0x0b17('0x56'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x0b17('0x4e')]('tools_tags','t',_0x0b17('0x57'));var _0x33a66a=squel[_0x0b17('0x58')]();var _0x3bcc41=[];var _0x410af4=squel[_0x0b17('0x58')]();var _0x1fbcc1;if(_0x40e47[_0x0b17('0x3b')][_0x0b17('0x59')]){_0x1fbcc1=as[_0x0b17('0x5a')](_0x40e47['query'][_0x0b17('0x59')]);var _0x51e34b=_0x1fbcc1[_0x0b17('0x5b')];for(var _0x122a38=0x0;_0x122a38<_0x1fbcc1['conditions'][_0x0b17('0x5c')];_0x122a38++){var _0x1c53c1=_0x1fbcc1[_0x0b17('0x5d')][_0x122a38];var _0x2a5c25='i';var _0x1b91d2=_['find'](_0x17732e,[_0x0b17('0x2d'),_0x1c53c1[_0x0b17('0x48')]]);if(!_0x1b91d2){switch(_0x1c53c1['field']){case _0x0b17('0x5e'):if(_0x1c53c1[_0x0b17('0x5f')]==0x1){_0x58e28[_0x0b17('0x60')]('`'+_0x1c53c1[_0x0b17('0x48')]+'`\x20=\x200');}else{_0x58e28['having']('`'+_0x1c53c1[_0x0b17('0x48')]+'`\x20>\x200');}break;case _0x0b17('0x61'):if(_0x1c53c1[_0x0b17('0x62')]===_0x0b17('0x63')){if(_0x1c53c1['value'][_0x0b17('0x64')]('\x20')['length']>0x1){_0x33a66a[_0x51e34b](_0x0b17('0x65'),qs[_0x0b17('0x66')](_0x1c53c1[_0x0b17('0x5f')]),null);}else{var _0x644e92='%'+_0x1c53c1[_0x0b17('0x5f')]+'%';_0x33a66a[_0x51e34b](_0x0b17('0x67'),_0x644e92,_0x644e92,_0x644e92);}}else{_0x1b91d2=_[_0x0b17('0x68')](_0x17732e,[_0x0b17('0x2d'),'ContactId']);_0x1c53c1['field']=_0x0b17('0x69');_0x1015a6=as[_0x0b17('0x6a')](_0x2a5c25,_0x1b91d2[_0x0b17('0x39')],_0x1c53c1);_0x33a66a[_0x51e34b](_0x1015a6[_0x0b17('0x6b')],_0x1015a6[_0x0b17('0x5f')][_0x0b17('0x6c')],_0x1015a6[_0x0b17('0x5f')][_0x0b17('0x2b')]);}break;case _0x0b17('0x6d'):var _0x146bd2=_0x1c53c1[_0x0b17('0x5f')]['split'](',')[_0x0b17('0x2f')](function(_0xfea5b0){return Number(_0xfea5b0);});_0x146bd2[_0x0b17('0x6e')](function(_0x3a94f9){_0x410af4['or'](_0x0b17('0x6f'),'%,'+_0x3a94f9+',%');});_0x3bcc41=_[_0x0b17('0x70')](_0x3bcc41,_0x146bd2);break;case _0x0b17('0x71'):if(_0x1c53c1[_0x0b17('0x62')]==='$substring'){_0x33a66a[_0x51e34b](_0x0b17('0x72'),'%'+_0x1c53c1[_0x0b17('0x5f')]+'%',null);}else{_0x1b91d2=_['find'](_0x17732e,[_0x0b17('0x2d'),'UserId']);_0x1c53c1[_0x0b17('0x48')]=_0x0b17('0x73');_0x1015a6=as[_0x0b17('0x6a')](_0x2a5c25,_0x1b91d2[_0x0b17('0x39')],_0x1c53c1);_0x33a66a[_0x51e34b](_0x1015a6[_0x0b17('0x6b')],_0x1015a6[_0x0b17('0x5f')][_0x0b17('0x6c')],_0x1015a6[_0x0b17('0x5f')][_0x0b17('0x2b')]);}break;case _0x0b17('0x74'):_0x1015a6=as[_0x0b17('0x6a')]('me',null,_0x1c53c1);_0x33a66a[_0x51e34b](_0x1015a6[_0x0b17('0x6b')],_0x1015a6[_0x0b17('0x5f')][_0x0b17('0x6c')],_0x1015a6[_0x0b17('0x5f')][_0x0b17('0x2b')]);break;}}else{var _0x1015a6=as['buildExpression'](_0x2a5c25,_0x1b91d2[_0x0b17('0x39')],_0x1c53c1);_0x33a66a[_0x51e34b](_0x1015a6[_0x0b17('0x6b')],_0x1015a6['value'][_0x0b17('0x6c')],_0x1015a6[_0x0b17('0x5f')][_0x0b17('0x2b')]);}}}else{var _0x402378=_(_0x40e47[_0x0b17('0x3b')])[_0x0b17('0x3c')]()[_0x0b17('0x2f')](function(_0x1e81fd){return _[_0x0b17('0x75')](_0x17732e,[_0x0b17('0x2d'),_0x1e81fd])?_0x1e81fd:undefined;})[_0x0b17('0x76')]()['value']();if(!_[_0x0b17('0x77')](_0x402378)){_0x402378[_0x0b17('0x6e')](function(_0x56cd41){if(_0x56cd41===_0x0b17('0x78')){_0x58e28[_0x0b17('0x46')]('i.SmsAccountId\x20IN\x20?',[][_0x0b17('0x79')](_0x40e47[_0x0b17('0x3b')][_0x56cd41]));}else if(_0x56cd41==='createdAt'){var _0x2d4c21=JSON['parse'](_0x40e47[_0x0b17('0x3b')][_0x56cd41])[_0x0b17('0x7a')];var _0x2a8527=JSON[_0x0b17('0x7b')](_0x40e47[_0x0b17('0x3b')][_0x56cd41])[_0x0b17('0x7c')];_0x58e28['where'](_0x0b17('0x7d'),_0x2d4c21,_0x2a8527);}else{if(_0x40e47['query'][_0x56cd41]===_0x0b17('0x7e')){_0x58e28[_0x0b17('0x46')]('i.'+_0x56cd41+_0x0b17('0x7f'));}else{_0x58e28[_0x0b17('0x46')]('i.'+_0x56cd41+_0x0b17('0x80'),_0x40e47[_0x0b17('0x3b')][_0x56cd41]);}}});}if(_0x40e47[_0x0b17('0x3b')][_0x0b17('0x81')]){if(_0x40e47[_0x0b17('0x3b')][_0x0b17('0x81')]==0x1){_0x58e28[_0x0b17('0x60')](_0x0b17('0x82'));}else{_0x58e28['having'](_0x0b17('0x83'));}}if(_0x40e47[_0x0b17('0x3b')][_0x0b17('0x84')]){_0x3bcc41=_[_0x0b17('0x85')](_0x40e47[_0x0b17('0x3b')][_0x0b17('0x84')])?_0x40e47[_0x0b17('0x3b')]['tag']:new Array(_0x40e47['query'][_0x0b17('0x84')]);_0x3bcc41[_0x0b17('0x6e')](function(_0x37f0fc){_0x410af4['or'](_0x0b17('0x6f'),'%,'+_0x37f0fc+',%');});}if(_0x40e47['query'][_0x0b17('0x86')]){var _0x3f2603=_0x40e47['query'][_0x0b17('0x86')][_0x0b17('0x87')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x0b17('0x88')](_0x3f2603)){_0x33a66a['or'](_0x0b17('0x89'),_0x3f2603+'%')['or'](_0x0b17('0x8a'),_0x3f2603+'%');}else{_0x33a66a['or'](_0x0b17('0x8b'),qs[_0x0b17('0x66')](_0x3f2603))['or'](_0x0b17('0x8c'),_0x3f2603+'%');}}}_0x58e28[_0x0b17('0x46')](_0x33a66a);_0x58e28['group'](_0x0b17('0x8d'));var _0x4b2cba={'type':db[_0x0b17('0x8e')]['QueryTypes'][_0x0b17('0x8f')],'raw':!![]};var _0x4bab6f=_0x58e28[_0x0b17('0x90')]();_0x4bab6f[_0x0b17('0x48')](_0x0b17('0x8d'));_0x4bab6f[_0x0b17('0x48')](_0x0b17('0x91'),'unreadMessages');if(_0x529402[_0x0b17('0x44')]){_0x529402[_0x0b17('0x44')][_0x0b17('0x6e')](function(_0x581b78){var _0x564ed9=_0x581b78[0x0]===_0x0b17('0x92')?_0x581b78[0x0]:'i.'+_0x581b78[0x0];_0x58e28[_0x0b17('0x44')](_0x564ed9,_0x581b78[0x1]===_0x0b17('0x93')?![]:!![]);});}if(!_['isEmpty'](_0x3bcc41)){_0x58e28[_0x0b17('0x60')](_0x410af4);_0x4bab6f['where']('t.id\x20IN\x20?',_0x3bcc41);}BPromise[_0x0b17('0x94')]()[_0x0b17('0x29')](function(){if(!_0x1fbcc1){if(_0x40e47[_0x0b17('0x3b')][_0x0b17('0x78')])return;_0x4bab6f['where'](_0x0b17('0x95'));_0x58e28[_0x0b17('0x46')](_0x0b17('0x95'));return;}if(_0x40e47[_0x0b17('0x96')][_0x0b17('0x97')]!==_0x0b17('0x98'))return;return _0x40e47[_0x0b17('0x96')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x3c245e){if(_[_0x0b17('0x77')](_0x3c245e)){_0x4bab6f['where'](_0x0b17('0x99'));_0x58e28[_0x0b17('0x46')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x4bab6f[_0x0b17('0x46')]('i.SmsAccountId\x20IN\x20?',_[_0x0b17('0x2f')](_0x3c245e,'id'));_0x58e28[_0x0b17('0x46')]('i.SmsAccountId\x20IN\x20?',_[_0x0b17('0x2f')](_0x3c245e,'id'));}});})[_0x0b17('0x29')](function(){if(_0x40e47['user'][_0x0b17('0x97')]===_0x0b17('0x98')&&!_0x1fbcc1&&!_0x40e47[_0x0b17('0x3b')][_0x0b17('0x78')])return[];return db[_0x0b17('0x9a')][_0x0b17('0x3b')](_0x4bab6f[_0x0b17('0x9b')](),_0x4b2cba);})[_0x0b17('0x29')](function(_0x229990){_0x51b25f[_0x0b17('0x23')]=_0x229990[_0x0b17('0x5c')];if(_0x51b25f[_0x0b17('0x23')]===0x0)return[];return db[_0x0b17('0x9a')][_0x0b17('0x3b')](_0x1e2eae['toString'](),_0x4b2cba)[_0x0b17('0x29')](function(_0x51aa74){_0x123fc8=_['keyBy'](_0x51aa74,'id');_0x4b2cba=_[_0x0b17('0x9c')](_0x4b2cba,{'model':db[_0x0b17('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40e47['query'][_0x0b17('0x41')]){_0x529402['attributes']['forEach'](function(_0x53031d){_0x58e28[_0x0b17('0x48')]('i.'+_0x53031d);});}else{_0x58e28[_0x0b17('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0b17('0x5e'));_0x58e28[_0x0b17('0x48')](_0x0b17('0x9d'),_0x0b17('0x9e'));_0x58e28['field']('a.mandatoryDisposition',_0x0b17('0x9f'));_0x58e28[_0x0b17('0x48')](_0x0b17('0xa0'),_0x0b17('0x92'));_0x58e28[_0x0b17('0x48')](_0x0b17('0xa1'));_0x58e28[_0x0b17('0x48')](_0x0b17('0xa2'),_0x0b17('0xa3'));_0x58e28[_0x0b17('0x48')](_0x0b17('0xa4'),_0x0b17('0xa5'));_0x58e28[_0x0b17('0x48')](_0x0b17('0xa6'),_0x0b17('0xa7'));_0x58e28['field'](_0x0b17('0xa8'),_0x0b17('0xa9'));_0x58e28[_0x0b17('0x48')](_0x0b17('0xaa'),'Contact.mobile');_0x58e28[_0x0b17('0x48')](_0x0b17('0xab'),_0x0b17('0xac'));_0x58e28[_0x0b17('0x48')]('o.fullname',_0x0b17('0xad'));_0x58e28[_0x0b17('0x48')](_0x0b17('0xae'),_0x0b17('0xaf'));_0x58e28[_0x0b17('0x48')](_0x0b17('0xb0'),_0x0b17('0x31'));}if(_0x529402[_0x0b17('0x21')])_0x58e28[_0x0b17('0x21')](_0x529402[_0x0b17('0x21')]);if(_0x529402[_0x0b17('0x20')])_0x58e28[_0x0b17('0x20')](_0x529402['offset']);return db[_0x0b17('0x9a')][_0x0b17('0x3b')](_0x58e28['toString'](),_0x4b2cba);})[_0x0b17('0x29')](function(_0x5d33f6){if(_0x5d33f6[_0x0b17('0x5c')]>0x0)_0x3ec632[_0x0b17('0x46')](_0x0b17('0xb1'),_[_0x0b17('0x2f')](_0x5d33f6,'id'));return db[_0x0b17('0x9a')][_0x0b17('0x3b')](_0x3ec632[_0x0b17('0x9b')](),_0x4b2cba)[_0x0b17('0x29')](function(_0x15f0ce){var _0x1896c3=_[_0x0b17('0xb2')](_0x15f0ce,'SmsInteractionId');var _0x313af4=[];_0x5d33f6[_0x0b17('0x6e')](function(_0x209175){_0x313af4[_0x0b17('0x33')](updateSmsInteraction(_0x209175,_0x123fc8,_0x1896c3));});return BPromise[_0x0b17('0xb3')](_0x313af4);});});})['then'](function(_0x4bf70e){_0x51b25f[_0x0b17('0xb4')]=_0x4bf70e;return _0x51b25f;})['then'](respondWithFilteredResult(_0x104ad6,_0x529402))[_0x0b17('0x34')](handleError(_0x104ad6,null));};exports[_0x0b17('0xb5')]=function(_0x33127f,_0x213220){var _0x3d7df3={'raw':![],'where':{'id':_0x33127f[_0x0b17('0xb6')]['id']}},_0xe06ec5={};_0xe06ec5[_0x0b17('0x3e')]=_['keys'](db[_0x0b17('0x36')][_0x0b17('0x37')]);_0xe06ec5[_0x0b17('0x3b')]=_['keys'](_0x33127f['query']);_0xe06ec5['filters']=_[_0x0b17('0x40')](_0xe06ec5[_0x0b17('0x3e')],_0xe06ec5[_0x0b17('0x3b')]);_0x3d7df3['attributes']=_['intersection'](_0xe06ec5['model'],qs['fields'](_0x33127f[_0x0b17('0x3b')][_0x0b17('0x41')]));_0x3d7df3[_0x0b17('0x3f')]=_0x3d7df3[_0x0b17('0x3f')][_0x0b17('0x5c')]?_0x3d7df3[_0x0b17('0x3f')]:_0xe06ec5['model'];if(_0x33127f[_0x0b17('0x3b')]['includeAll']){_0x3d7df3[_0x0b17('0xb7')]=[{'all':!![]}];}_0x3d7df3=_[_0x0b17('0x9c')]({},_0x3d7df3,_0x33127f[_0x0b17('0xb8')]);return db[_0x0b17('0x36')][_0x0b17('0x68')](_0x3d7df3)[_0x0b17('0x29')](handleEntityNotFound(_0x213220,null))[_0x0b17('0x29')](respondWithResult(_0x213220,null))[_0x0b17('0x34')](handleError(_0x213220,null));};exports['create']=function(_0x4cf654,_0x1676e8){return db[_0x0b17('0x36')][_0x0b17('0xb9')](_0x4cf654[_0x0b17('0x74')],{})['then'](respondWithResult(_0x1676e8,0xc9))[_0x0b17('0x34')](handleError(_0x1676e8,null));};exports['update']=function(_0xf215f8,_0x41bad2){if(_0xf215f8['body']['id']){delete _0xf215f8[_0x0b17('0x74')]['id'];}return db[_0x0b17('0x36')]['find']({'where':{'id':_0xf215f8['params']['id']}})[_0x0b17('0x29')](handleEntityNotFound(_0x41bad2,null))[_0x0b17('0x29')](saveUpdates(_0xf215f8['body'],null))[_0x0b17('0x29')](respondWithResult(_0x41bad2,null))[_0x0b17('0x34')](handleError(_0x41bad2,null));};exports[_0x0b17('0x2a')]=function(_0x4c27fe,_0x3ace36){return db[_0x0b17('0x36')]['find']({'where':{'id':_0x4c27fe[_0x0b17('0xb6')]['id']}})[_0x0b17('0x29')](handleEntityNotFound(_0x3ace36,null))['then'](removeEntity(_0x3ace36,null))['catch'](handleError(_0x3ace36,null));};exports['describe']=function(_0x30668e,_0x6551dc){return db[_0x0b17('0x36')][_0x0b17('0xba')]()[_0x0b17('0x29')](respondWithResult(_0x6551dc,null))['catch'](handleError(_0x6551dc,null));};exports[_0x0b17('0xbb')]=function(_0x425887,_0x121aa4,_0x52d9e9){return db[_0x0b17('0xbc')][_0x0b17('0x68')]({'where':{'id':_0x425887[_0x0b17('0xb6')]['id']}})[_0x0b17('0x29')](handleEntityNotFound(_0x121aa4,null))['then'](function(_0x40dbc9){if(_0x40dbc9){return _0x40dbc9[_0x0b17('0xbb')](_0x425887[_0x0b17('0x74')][_0x0b17('0xbd')],_[_0x0b17('0xbe')](_0x425887[_0x0b17('0x74')],[_0x0b17('0xbd'),'id'])||{});}})[_0x0b17('0x29')](respondWithResult(_0x121aa4,null))[_0x0b17('0x34')](handleError(_0x121aa4,null));};exports['getMessages']=function(_0x3627ad,_0x3f9d72,_0x504481){var _0x49bdc5={'raw':![],'where':{}};var _0x335f34={};var _0x1dad42={'count':0x0,'rows':[]};return db[_0x0b17('0x36')]['findOne']({'where':{'id':_0x3627ad[_0x0b17('0xb6')]['id']}})[_0x0b17('0x29')](handleEntityNotFound(_0x3f9d72,null))[_0x0b17('0x29')](function(_0x46ec6b){if(_0x46ec6b){_0x335f34[_0x0b17('0x3e')]=_['keys'](db['SmsMessage'][_0x0b17('0x37')]);_0x335f34[_0x0b17('0x3b')]=_[_0x0b17('0x3c')](_0x3627ad[_0x0b17('0x3b')]);_0x335f34[_0x0b17('0x3d')]=_[_0x0b17('0x40')](_0x335f34[_0x0b17('0x3e')],_0x335f34[_0x0b17('0x3b')]);_0x49bdc5['attributes']=_[_0x0b17('0x40')](_0x335f34[_0x0b17('0x3e')],qs[_0x0b17('0x41')](_0x3627ad[_0x0b17('0x3b')]['fields']));_0x49bdc5[_0x0b17('0x3f')]=_0x49bdc5['attributes'][_0x0b17('0x5c')]?_0x49bdc5[_0x0b17('0x3f')]:_0x335f34[_0x0b17('0x3e')];if(!_0x3627ad[_0x0b17('0x3b')][_0x0b17('0x42')]('nolimit')){_0x49bdc5[_0x0b17('0x21')]=qs['limit'](_0x3627ad[_0x0b17('0x3b')][_0x0b17('0x21')]);_0x49bdc5[_0x0b17('0x20')]=qs[_0x0b17('0x20')](_0x3627ad[_0x0b17('0x3b')][_0x0b17('0x20')]);}_0x49bdc5['order']=qs[_0x0b17('0x45')](_0x3627ad['query'][_0x0b17('0x45')]);_0x49bdc5[_0x0b17('0x46')]=qs['filters'](_[_0x0b17('0xbf')](_0x3627ad[_0x0b17('0x3b')],_0x335f34[_0x0b17('0x3d')]));_0x49bdc5['where'][_0x0b17('0xc0')]=_0x46ec6b['id'];if(_0x3627ad[_0x0b17('0x3b')][_0x0b17('0x86')]){_0x49bdc5[_0x0b17('0x46')]=_[_0x0b17('0x9c')](_0x49bdc5['where'],{'$or':_[_0x0b17('0x2f')](_0x49bdc5['attributes'],function(_0x17120e){var _0xf7f357={};_0xf7f357[_0x17120e]={'$like':'%'+_0x3627ad['query'][_0x0b17('0x86')]+'%'};return _0xf7f357;})});}if(_0x3627ad[_0x0b17('0x3b')][_0x0b17('0x7a')]){var _0x2e8dee=_0x3627ad[_0x0b17('0x3b')][_0x0b17('0x7a')][_0x0b17('0x64')](',');var _0x4eb36={};_0x4eb36[_0x2e8dee[0x0]]={'$gte':moment(_0x2e8dee[0x1])[_0x0b17('0xc1')](_0x0b17('0xc2'))};_0x49bdc5[_0x0b17('0x46')]=_[_0x0b17('0x9c')](_0x49bdc5[_0x0b17('0x46')],_0x4eb36);}_0x49bdc5=_[_0x0b17('0x9c')]({},_0x49bdc5,_0x3627ad[_0x0b17('0xb8')]);return db[_0x0b17('0xbc')]['count']({'where':_0x49bdc5[_0x0b17('0x46')]})[_0x0b17('0x29')](function(_0x1355d1){_0x1dad42[_0x0b17('0x23')]=_0x1355d1;if(_0x3627ad[_0x0b17('0x3b')]['includeAll']){_0x49bdc5['include']=[{'all':!![]}];}return db[_0x0b17('0xbc')][_0x0b17('0xc3')](_0x49bdc5);})['then'](function(_0x5dccc0){_0x1dad42[_0x0b17('0xb4')]=_0x5dccc0;return _0x1dad42;});}})[_0x0b17('0x29')](respondWithFilteredResult(_0x3f9d72,_0x49bdc5))[_0x0b17('0x34')](handleError(_0x3f9d72,null));};exports[_0x0b17('0xc4')]=function(_0x38de16,_0x1393d7,_0x5374e8){return db[_0x0b17('0x36')]['find']({'where':{'id':_0x38de16[_0x0b17('0xb6')]['id']}})['then'](handleEntityNotFound(_0x1393d7,null))[_0x0b17('0x29')](function(_0x540cdc){if(_0x540cdc){return _0x540cdc[_0x0b17('0xc5')](_0x38de16[_0x0b17('0x74')][_0x0b17('0xbd')],_[_0x0b17('0xbe')](_0x38de16['body'],[_0x0b17('0xbd'),'id'])||{})[_0x0b17('0xc6')](function(){return db[_0x0b17('0x6d')]['findAll']({'attributes':['id',_0x0b17('0x2d'),_0x0b17('0xc7')],'where':{'id':_0x38de16[_0x0b17('0x74')]['ids']}});})['then'](function(_0x29bc5f){socket[_0x0b17('0xc8')](_0x0b17('0xc9'),{'id':Number(_0x38de16[_0x0b17('0xb6')]['id']),'tags':_0x29bc5f||[]});return{'id':Number(_0x38de16[_0x0b17('0xb6')]['id']),'tags':_0x29bc5f||[]};});}})[_0x0b17('0x29')](respondWithResult(_0x1393d7,null))[_0x0b17('0x34')](handleError(_0x1393d7,null));};exports['removeTags']=function(_0xbe3f97,_0x5c9eb2,_0x319708){return db[_0x0b17('0x36')][_0x0b17('0x68')]({'where':{'id':_0xbe3f97[_0x0b17('0xb6')]['id']}})['then'](handleEntityNotFound(_0x5c9eb2,null))[_0x0b17('0x29')](function(_0x1e6c95){if(_0x1e6c95){return _0x1e6c95[_0x0b17('0xca')](_0xbe3f97['query'][_0x0b17('0xbd')]);}})[_0x0b17('0x29')](respondWithStatusCode(_0x5c9eb2,null))[_0x0b17('0x34')](handleError(_0x5c9eb2,null));};exports[_0x0b17('0xcb')]=function(_0x52dc66,_0x3bc09d){var _0x4d4203=moment()['unix']()[_0x0b17('0x9b')]();var _0x208513=path['join'](config[_0x0b17('0xcc')],_0x0b17('0xcd'),_0x0b17('0xce'),_0x0b17('0xcf'));var _0x579cdd=path[_0x0b17('0xd0')](config[_0x0b17('0xcc')],_0x0b17('0xcd'),'files',_0x0b17('0xd1'));var _0x4cfc8a=path['join'](_0x208513,_0x4d4203);var _0x160aa9=util[_0x0b17('0xc1')](_0x0b17('0xd2'),_0x52dc66[_0x0b17('0xb6')]['id'],_0x4d4203);var _0x28bf12=path[_0x0b17('0xd0')](_0x208513,_0x160aa9);var _0x4edd72=[];_0x4edd72['push']({'model':db[_0x0b17('0x71')],'as':_0x0b17('0x71'),'attributes':['id',_0x0b17('0x30')],'raw':!![]});_0x4edd72['push']({'model':db[_0x0b17('0xd3')],'as':_0x0b17('0x61'),'attributes':['id',_0x0b17('0xd4'),_0x0b17('0xd5')],'raw':!![]});var _0x2239d7=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id','body',_0x0b17('0xd6'),'direction',_0x0b17('0xd7'),_0x0b17('0x81')],'include':_0x4edd72}];_0x2239d7[_0x0b17('0x33')]({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x2239d7[_0x0b17('0x33')]({'model':db[_0x0b17('0x71')],'as':_0x0b17('0xd8'),'attributes':['id',_0x0b17('0x30')]});return db['SmsInteraction']['find']({'where':{'id':_0x52dc66['params']['id']},'include':_0x2239d7})[_0x0b17('0x29')](handleEntityNotFound(_0x3bc09d,null))['then'](function(_0x4e4279){if(_0x4e4279){var _0x5000a0=_0x4e4279['get']({'plain':!![]});fs[_0x0b17('0xd9')](_0x4cfc8a);var _0x51470c={'channel':'Sms','account':_0x5000a0[_0x0b17('0xda')][_0x0b17('0x2d')],'agent':_0x5000a0[_0x0b17('0xd8')]?_0x5000a0['Owner'][_0x0b17('0x30')]:_0x0b17('0xdb'),'createdAt':moment(_0x5000a0['createdAt'])[_0x0b17('0xc1')](_0x0b17('0xc2'))[_0x0b17('0x9b')](),'closedAt':_0x5000a0[_0x0b17('0xdc')]?moment(_0x5000a0[_0x0b17('0xdd')])['format'](_0x0b17('0xc2'))[_0x0b17('0x9b')]():'','disposition':_0x5000a0[_0x0b17('0xde')],'messages':_(_0x5000a0[_0x0b17('0xdf')])[_0x0b17('0x86')]({'secret':![]})[_0x0b17('0x2f')](function(_0x15bce3){return{'date':moment(_0x15bce3[_0x0b17('0xd6')])['format'](_0x0b17('0xc2'))[_0x0b17('0x9b')](),'sender':_0x15bce3[_0x0b17('0xe0')]===_0x0b17('0xe1')?_0x15bce3[_0x0b17('0x71')]?_0x15bce3[_0x0b17('0x71')][_0x0b17('0x30')]:_0x0b17('0xe2'):_0x15bce3[_0x0b17('0x61')][_0x0b17('0xd4')]+(_0x15bce3[_0x0b17('0x61')][_0x0b17('0xd5')]?'\x20'+_0x15bce3[_0x0b17('0x61')][_0x0b17('0xd5')]:''),'body':_0x15bce3['body'],'direction':_0x15bce3[_0x0b17('0xe0')]===_0x0b17('0xe1')?'A':'C','secret':_0x15bce3[_0x0b17('0xd7')],'read':_0x15bce3[_0x0b17('0x81')]};})[_0x0b17('0x5f')]()};return ejs[_0x0b17('0xe3')](path[_0x0b17('0xd0')](config[_0x0b17('0xcc')],_0x0b17('0xcd'),'views',_0x0b17('0xe4')),{'interaction':_0x51470c})[_0x0b17('0x29')](function(_0x22c516){var _0x13ae4a=path[_0x0b17('0xd0')](_0x4cfc8a,_0x0b17('0xe5')+_0x5000a0['id']+'-'+_0x4d4203+_0x0b17('0xe6'));var _0x59b000={'path':_0x13ae4a,'channel':_0x0b17('0xe7'),'interactionId':_0x5000a0['id']};return pdf['createPdfFromHTML'](_0x22c516,_0x59b000);})[_0x0b17('0x29')](function(){return new BPromise(function(_0x13261f,_0x50166f){zipdir(_0x4cfc8a,{'saveTo':_0x28bf12},function(_0x69f8fa,_0x2df8f6){if(_0x69f8fa)return _0x50166f(_0x69f8fa);return _0x13261f(_0x2df8f6);});})[_0x0b17('0x29')](function(){return new BPromise(function(_0x589b41,_0x50cfb9){rimraf(_0x4cfc8a,function(_0xbee04){if(_0xbee04)_0x50cfb9(_0xbee04);return _0x589b41();});});})[_0x0b17('0x29')](function(){return _0x3bc09d[_0x0b17('0xcb')](_0x28bf12,_0x160aa9,function(_0x19bd52){if(_0x19bd52){console[_0x0b17('0xe8')]('err',_0x19bd52);}else{fs[_0x0b17('0xe9')](_0x28bf12);}});});});}else{return _0x3bc09d[_0x0b17('0x1d')](0xc8);}})[_0x0b17('0x34')](handleError(_0x3bc09d,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index dd0ccf6..ca86550 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 _0x7916=['Users','findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','SmsInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers'];(function(_0x5d93a4,_0x10fca8){var _0x17b491=function(_0x29189b){while(--_0x29189b){_0x5d93a4['push'](_0x5d93a4['shift']());}};_0x17b491(++_0x10fca8);}(_0x7916,0x128));var _0x6791=function(_0x361187,_0x373ef2){_0x361187=_0x361187-0x0;var _0x432f46=_0x7916[_0x361187];return _0x432f46;};'use strict';var EventEmitter=require(_0x6791('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x6791('0x1')];var SmsMessage=require(_0x6791('0x2'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x6791('0x3')](0x0);var events={'afterCreate':_0x6791('0x4'),'afterUpdate':_0x6791('0x5'),'afterDestroy':_0x6791('0x6')};function emitEvent(_0x5e6303){return function(_0xe98396,_0x5a5726,_0x3ca328){_0xe98396[_0x6791('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x8b85ff){_0xe98396['setDataValue'](_0x6791('0x8'),_0x8b85ff['map'](function(_0x4ef65f){return{'id':_0x4ef65f['id']};}));return SmsMessage[_0x6791('0x9')]({'where':{'SmsInteractionId':_0xe98396['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6791('0xa')](function(_0x579950){_0xe98396[_0x6791('0xb')](_0x6791('0xc'),_0x579950[_0x6791('0xd')]);SmsInteractionEvents['emit'](_0x5e6303+':'+_0xe98396['id'],_0xe98396);SmsInteractionEvents[_0x6791('0xe')](_0x5e6303,_0xe98396);_0x3ca328(null);})[_0x6791('0xf')](_0x3ca328(null));};}for(var e in events){if(events[_0x6791('0x10')](e)){var event=events[e];SmsInteraction[_0x6791('0x11')](e,emitEvent(event));}}module[_0x6791('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0x93e9=['getUsers','then','setDataValue','map','findAll','unreadMessages','emit','hook','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save'];(function(_0x43d45a,_0x50aac7){var _0xbb5d8a=function(_0x375c90){while(--_0x375c90){_0x43d45a['push'](_0x43d45a['shift']());}};_0xbb5d8a(++_0x50aac7);}(_0x93e9,0xcc));var _0x993e=function(_0x54a69d,_0x2e4c47){_0x54a69d=_0x54a69d-0x0;var _0x2b69f0=_0x93e9[_0x54a69d];return _0x2b69f0;};'use strict';var EventEmitter=require(_0x993e('0x0'));var SmsInteraction=require(_0x993e('0x1'))['db'][_0x993e('0x2')];var SmsMessage=require(_0x993e('0x1'))['db'][_0x993e('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x993e('0x4')](0x0);var events={'afterCreate':_0x993e('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b762e){return function(_0x255045,_0x15ce9b,_0x45f52e){_0x255045[_0x993e('0x6')]({'attributes':['id'],'raw':!![]})[_0x993e('0x7')](function(_0x12ac94){_0x255045[_0x993e('0x8')]('Users',_0x12ac94[_0x993e('0x9')](function(_0x69ff1){return{'id':_0x69ff1['id']};}));return SmsMessage[_0x993e('0xa')]({'where':{'SmsInteractionId':_0x255045['id'],'direction':'in','read':![]},'raw':!![]});})[_0x993e('0x7')](function(_0x2cd389){_0x255045[_0x993e('0x8')](_0x993e('0xb'),_0x2cd389['length']);SmsInteractionEvents[_0x993e('0xc')](_0x1b762e+':'+_0x255045['id'],_0x255045);SmsInteractionEvents[_0x993e('0xc')](_0x1b762e,_0x255045);_0x45f52e(null);})['catch'](_0x45f52e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x993e('0xd')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index cf7d967..e11ed74 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 _0x2dab=['path','../../config/environment','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x51376f,_0x3dbff2){var _0x4514e2=function(_0x22b21e){while(--_0x22b21e){_0x51376f['push'](_0x51376f['shift']());}};_0x4514e2(++_0x3dbff2);}(_0x2dab,0x176));var _0xb2da=function(_0x33c9ee,_0x2ee0da){_0x33c9ee=_0x33c9ee-0x0;var _0x20d5fd=_0x2dab[_0x33c9ee];return _0x20d5fd;};'use strict';var _=require(_0xb2da('0x0'));var util=require(_0xb2da('0x1'));var logger=require(_0xb2da('0x2'))(_0xb2da('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2da('0x4'));var rimraf=require('rimraf');var config=require(_0xb2da('0x5'));var attributes=require('./smsInteraction.attributes');module[_0xb2da('0x6')]=function(_0x290964,_0x1e7f1d){return _0x290964[_0xb2da('0x7')](_0xb2da('0x8'),attributes,{'tableName':_0xb2da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1c5e87,_0xdd5946,_0x44b653){if(_0x1c5e87[_0xb2da('0xa')](_0xb2da('0xb'))){_0x1c5e87[_0xb2da('0xc')]=moment()['format'](_0xb2da('0xd'));}_0x44b653(null,_0x1c5e87);}}});}; \ No newline at end of file +var _0x4a58=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x4a58,0x15d));var _0x84a5=function(_0x30e004,_0x46f8c2){_0x30e004=_0x30e004-0x0;var _0x5ca247=_0x4a58[_0x30e004];return _0x5ca247;};'use strict';var _=require(_0x84a5('0x0'));var util=require(_0x84a5('0x1'));var logger=require(_0x84a5('0x2'))(_0x84a5('0x3'));var moment=require(_0x84a5('0x4'));var BPromise=require(_0x84a5('0x5'));var rp=require(_0x84a5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84a5('0x7'));var config=require(_0x84a5('0x8'));var attributes=require(_0x84a5('0x9'));module[_0x84a5('0xa')]=function(_0x22c078,_0x101bf6){return _0x22c078[_0x84a5('0xb')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a7136,_0x2be230,_0x10ba2a){if(_0x1a7136[_0x84a5('0xc')](_0x84a5('0xd'))){_0x1a7136['closedAt']=moment()[_0x84a5('0xe')](_0x84a5('0xf'));}_0x10ba2a(null,_0x1a7136);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d4a5ffe..f2278ad 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 _0xd1df=['find','addTags','ids','omit','AddTags','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./smsInteraction.socket','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','catch','AddTagsToSmsInteraction'];(function(_0x3352e6,_0x3e7124){var _0x495c46=function(_0x4517da){while(--_0x4517da){_0x3352e6['push'](_0x3352e6['shift']());}};_0x495c46(++_0x3e7124);}(_0xd1df,0x18b));var _0xfd1d=function(_0x32175a,_0x1c0f1d){_0x32175a=_0x32175a-0x0;var _0x3180f5=_0xd1df[_0x32175a];return _0x3180f5;};'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(_0xfd1d('0x0'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd1d('0x1'));var logger=require(_0xfd1d('0x2'))(_0xfd1d('0x3'));var config=require(_0xfd1d('0x4'));var jayson=require(_0xfd1d('0x5'));var client=jayson[_0xfd1d('0x6')][_0xfd1d('0x7')]({'port':0x232a});config['redis']=_[_0xfd1d('0x8')](config[_0xfd1d('0x9')],{'host':_0xfd1d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfd1d('0xb'))['register'](socket);function respondWithRpcPromise(_0x2779e0,_0x5c8659,_0xbe4512){return new BPromise(function(_0x911df,_0x3d5525){return client[_0xfd1d('0xc')](_0x2779e0,_0xbe4512)[_0xfd1d('0xd')](function(_0x1b695b){logger['info'](_0xfd1d('0xe'),_0x5c8659,_0xfd1d('0xf'));logger[_0xfd1d('0x10')](_0xfd1d('0x11'),_0x5c8659,_0xfd1d('0xf'),JSON[_0xfd1d('0x12')](_0x1b695b));if(_0x1b695b['error']){if(_0x1b695b[_0xfd1d('0x13')][_0xfd1d('0x14')]===0x1f4){logger[_0xfd1d('0x13')](_0xfd1d('0xe'),_0x5c8659,_0x1b695b[_0xfd1d('0x13')][_0xfd1d('0x15')]);return _0x3d5525(_0x1b695b[_0xfd1d('0x13')]['message']);}logger[_0xfd1d('0x13')](_0xfd1d('0xe'),_0x5c8659,_0x1b695b[_0xfd1d('0x13')][_0xfd1d('0x15')]);return _0x911df(_0x1b695b[_0xfd1d('0x13')][_0xfd1d('0x15')]);}else{logger[_0xfd1d('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x5c8659,_0xfd1d('0xf'));_0x911df(_0x1b695b[_0xfd1d('0x17')][_0xfd1d('0x15')]);}})['catch'](function(_0x4105a7){logger[_0xfd1d('0x13')](_0xfd1d('0xe'),_0x5c8659,_0x4105a7);_0x3d5525(_0x4105a7);});});}exports[_0xfd1d('0x18')]=function(_0x3580d4){var _0x405353=this;return new Promise(function(_0x330069,_0x2b9252){return db[_0xfd1d('0x19')][_0xfd1d('0x1a')](_0x3580d4[_0xfd1d('0x1b')],{'raw':_0x3580d4[_0xfd1d('0x1c')]?_0x3580d4[_0xfd1d('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3580d4['options']?_0x3580d4[_0xfd1d('0x1c')][_0xfd1d('0x1d')]||null:null,'attributes':_0x3580d4[_0xfd1d('0x1c')]?_0x3580d4[_0xfd1d('0x1c')][_0xfd1d('0x1e')]||null:null,'limit':_0x3580d4[_0xfd1d('0x1c')]?_0x3580d4['options'][_0xfd1d('0x1f')]||null:null})[_0xfd1d('0xd')](function(_0x390b95){logger[_0xfd1d('0x16')](_0xfd1d('0x18'),_0x3580d4);logger['debug'](_0xfd1d('0x18'),_0x3580d4,JSON[_0xfd1d('0x12')](_0x390b95));_0x330069(_0x390b95);})[_0xfd1d('0x20')](function(_0x2a6dff){logger['error'](_0xfd1d('0x18'),_0x2a6dff[_0xfd1d('0x15')],_0x3580d4);_0x2b9252(_0x405353[_0xfd1d('0x13')](0x1f4,_0x2a6dff[_0xfd1d('0x15')]));});});};exports[_0xfd1d('0x21')]=function(_0x1de989){return new Promise(function(_0x3c7f35,_0x43c4e2){return db['SmsInteraction'][_0xfd1d('0x22')]({'where':_0x1de989[_0xfd1d('0x1c')]?_0x1de989[_0xfd1d('0x1c')]['where']||null:null})[_0xfd1d('0xd')](function(_0x2d4deb){if(_0x2d4deb){return _0x2d4deb[_0xfd1d('0x23')](_0x1de989[_0xfd1d('0x1b')][_0xfd1d('0x24')],_[_0xfd1d('0x25')](_0x1de989[_0xfd1d('0x1b')],['ids','id'])||{});}})['spread'](function(_0x1a593f){logger[_0xfd1d('0x16')](_0xfd1d('0x26'),_0x1de989);logger[_0xfd1d('0x10')](_0xfd1d('0x26'),_0x1de989,JSON[_0xfd1d('0x12')](_0x1a593f));_0x3c7f35(_0x1a593f);})[_0xfd1d('0x20')](function(_0x5cf061){logger['error'](_0xfd1d('0x26'),_0x5cf061[_0xfd1d('0x15')],_0x1de989);_0x43c4e2(_this[_0xfd1d('0x13')](0x1f4,_0x5cf061[_0xfd1d('0x15')]));});});}; \ No newline at end of file +var _0xc5b7=['catch','SmsInteraction','body','options','raw','where','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','addTags','ids','omit','spread','AddTags','debug','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x36abfd,_0x32068a){var _0x14ab00=function(_0x79ee87){while(--_0x79ee87){_0x36abfd['push'](_0x36abfd['shift']());}};_0x14ab00(++_0x32068a);}(_0xc5b7,0x105));var _0x7c5b=function(_0x42d8a0,_0x473f38){_0x42d8a0=_0x42d8a0-0x0;var _0x211dfb=_0xc5b7[_0x42d8a0];return _0x211dfb;};'use strict';var _=require('lodash');var util=require(_0x7c5b('0x0'));var moment=require(_0x7c5b('0x1'));var BPromise=require('bluebird');var rs=require(_0x7c5b('0x2'));var fs=require('fs');var Redis=require(_0x7c5b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c5b('0x4'));var logger=require('../../config/logger')(_0x7c5b('0x5'));var config=require(_0x7c5b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7c5b('0x7')][_0x7c5b('0x8')]({'port':0x232a});config[_0x7c5b('0x9')]=_[_0x7c5b('0xa')](config[_0x7c5b('0x9')],{'host':_0x7c5b('0xb'),'port':0x18eb});var socket=require(_0x7c5b('0xc'))(new Redis(config[_0x7c5b('0x9')]));require(_0x7c5b('0xd'))[_0x7c5b('0xe')](socket);function respondWithRpcPromise(_0x493d80,_0x335a11,_0x106de2){return new BPromise(function(_0x287e9b,_0x19fd7c){return client[_0x7c5b('0xf')](_0x493d80,_0x106de2)[_0x7c5b('0x10')](function(_0x138c6c){logger[_0x7c5b('0x11')](_0x7c5b('0x12'),_0x335a11,'request\x20sent');logger['debug'](_0x7c5b('0x13'),_0x335a11,_0x7c5b('0x14'),JSON[_0x7c5b('0x15')](_0x138c6c));if(_0x138c6c[_0x7c5b('0x16')]){if(_0x138c6c[_0x7c5b('0x16')][_0x7c5b('0x17')]===0x1f4){logger[_0x7c5b('0x16')](_0x7c5b('0x12'),_0x335a11,_0x138c6c[_0x7c5b('0x16')][_0x7c5b('0x18')]);return _0x19fd7c(_0x138c6c[_0x7c5b('0x16')][_0x7c5b('0x18')]);}logger[_0x7c5b('0x16')](_0x7c5b('0x12'),_0x335a11,_0x138c6c[_0x7c5b('0x16')][_0x7c5b('0x18')]);return _0x287e9b(_0x138c6c[_0x7c5b('0x16')][_0x7c5b('0x18')]);}else{logger[_0x7c5b('0x11')](_0x7c5b('0x12'),_0x335a11,_0x7c5b('0x14'));_0x287e9b(_0x138c6c[_0x7c5b('0x19')][_0x7c5b('0x18')]);}})[_0x7c5b('0x1a')](function(_0x532d0e){logger[_0x7c5b('0x16')](_0x7c5b('0x12'),_0x335a11,_0x532d0e);_0x19fd7c(_0x532d0e);});});}exports['UpdateSmsInteraction']=function(_0x330603){var _0x14df85=this;return new Promise(function(_0x3e19c7,_0x13d4da){return db[_0x7c5b('0x1b')]['update'](_0x330603[_0x7c5b('0x1c')],{'raw':_0x330603[_0x7c5b('0x1d')]?_0x330603['options'][_0x7c5b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x330603[_0x7c5b('0x1d')]?_0x330603[_0x7c5b('0x1d')][_0x7c5b('0x1f')]||null:null,'attributes':_0x330603['options']?_0x330603[_0x7c5b('0x1d')]['attributes']||null:null,'limit':_0x330603[_0x7c5b('0x1d')]?_0x330603[_0x7c5b('0x1d')][_0x7c5b('0x20')]||null:null})[_0x7c5b('0x10')](function(_0x22b0f3){logger['info'](_0x7c5b('0x21'),_0x330603);logger['debug'](_0x7c5b('0x21'),_0x330603,JSON[_0x7c5b('0x15')](_0x22b0f3));_0x3e19c7(_0x22b0f3);})[_0x7c5b('0x1a')](function(_0x51098a){logger['error'](_0x7c5b('0x21'),_0x51098a[_0x7c5b('0x18')],_0x330603);_0x13d4da(_0x14df85['error'](0x1f4,_0x51098a[_0x7c5b('0x18')]));});});};exports[_0x7c5b('0x22')]=function(_0x4fab39){return new Promise(function(_0x268392,_0x297226){return db['SmsInteraction']['find']({'where':_0x4fab39[_0x7c5b('0x1d')]?_0x4fab39[_0x7c5b('0x1d')][_0x7c5b('0x1f')]||null:null})['then'](function(_0x2ca29b){if(_0x2ca29b){return _0x2ca29b[_0x7c5b('0x23')](_0x4fab39['body'][_0x7c5b('0x24')],_[_0x7c5b('0x25')](_0x4fab39[_0x7c5b('0x1c')],[_0x7c5b('0x24'),'id'])||{});}})[_0x7c5b('0x26')](function(_0x15a39b){logger[_0x7c5b('0x11')](_0x7c5b('0x27'),_0x4fab39);logger[_0x7c5b('0x28')](_0x7c5b('0x27'),_0x4fab39,JSON[_0x7c5b('0x15')](_0x15a39b));_0x268392(_0x15a39b);})[_0x7c5b('0x1a')](function(_0x44fa1a){logger['error'](_0x7c5b('0x27'),_0x44fa1a[_0x7c5b('0x18')],_0x4fab39);_0x297226(_this[_0x7c5b('0x16')](0x1f4,_0x44fa1a[_0x7c5b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 4cdf09d..0099f6a 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 _0xdd02=['register','smsInteraction:','remove','update','emit','removeListener'];(function(_0x5d30ba,_0x4e82e1){var _0xa46114=function(_0x50c6ca){while(--_0x50c6ca){_0x5d30ba['push'](_0x5d30ba['shift']());}};_0xa46114(++_0x4e82e1);}(_0xdd02,0x134));var _0x2dd0=function(_0x2d8970,_0xb4c57){_0x2d8970=_0x2d8970-0x0;var _0x1841dd=_0xdd02[_0x2d8970];return _0x1841dd;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0x2dd0('0x0'),_0x2dd0('0x1')];function createListener(_0x471afb,_0x2760da){return function(_0x4fa7a7){_0x2760da[_0x2dd0('0x2')](_0x471afb,_0x4fa7a7);};}function removeListener(_0x3aa3f4,_0x100c95){return function(){SmsInteractionEvents[_0x2dd0('0x3')](_0x3aa3f4,_0x100c95);};}exports[_0x2dd0('0x4')]=function(_0x42abab){for(var _0x460efb=0x0,_0x1ecf97=events['length'];_0x460efb<_0x1ecf97;_0x460efb++){var _0x539c0c=events[_0x460efb];var _0x103a9c=createListener(_0x2dd0('0x5')+_0x539c0c,_0x42abab);SmsInteractionEvents['on'](_0x539c0c,_0x103a9c);}}; \ No newline at end of file +var _0xdb89=['length','./smsInteraction.events','save','remove','update','emit','register'];(function(_0x1477d4,_0x42d6f6){var _0x58fc27=function(_0x3c9ed4){while(--_0x3c9ed4){_0x1477d4['push'](_0x1477d4['shift']());}};_0x58fc27(++_0x42d6f6);}(_0xdb89,0xb0));var _0x9db8=function(_0x2e1afe,_0x33b014){_0x2e1afe=_0x2e1afe-0x0;var _0x25faf8=_0xdb89[_0x2e1afe];return _0x25faf8;};'use strict';var SmsInteractionEvents=require(_0x9db8('0x0'));var events=[_0x9db8('0x1'),_0x9db8('0x2'),_0x9db8('0x3')];function createListener(_0x52f7bf,_0x48fd59){return function(_0x2f04bd){_0x48fd59[_0x9db8('0x4')](_0x52f7bf,_0x2f04bd);};}function removeListener(_0x3f2c9b,_0x4b549b){return function(){SmsInteractionEvents['removeListener'](_0x3f2c9b,_0x4b549b);};}exports[_0x9db8('0x5')]=function(_0x49c777){for(var _0x365b7b=0x0,_0xa82024=events[_0x9db8('0x6')];_0x365b7b<_0xa82024;_0x365b7b++){var _0x554192=events[_0x365b7b];var _0x17e0d1=createListener('smsInteraction:'+_0x554192,_0x49c777);SmsInteractionEvents['on'](_0x554192,_0x17e0d1);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 1482df0..1ac993d 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 _0x75d4=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','describe','show','post','isAuthenticated','tracked','sms','smsmessage:create','create','/:id/status','put','/:id','update','/:id/accept'];(function(_0xdea57b,_0x4edb9f){var _0x2e398c=function(_0xbba711){while(--_0xbba711){_0xdea57b['push'](_0xdea57b['shift']());}};_0x2e398c(++_0x4edb9f);}(_0x75d4,0x16e));var _0x475d=function(_0x4bad1d,_0x1172c7){_0x4bad1d=_0x4bad1d-0x0;var _0x1edd20=_0x75d4[_0x4bad1d];return _0x1edd20;};'use strict';var multer=require(_0x475d('0x0'));var util=require(_0x475d('0x1'));var path=require(_0x475d('0x2'));var timeout=require(_0x475d('0x3'));var express=require(_0x475d('0x4'));var router=express[_0x475d('0x5')]();var fs_extra=require(_0x475d('0x6'));var auth=require(_0x475d('0x7'));var interaction=require(_0x475d('0x8'));var config=require(_0x475d('0x9'));var controller=require('./smsMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x475d('0xa')]);router[_0x475d('0xb')](_0x475d('0xc'),auth['isAuthenticated'](),controller[_0x475d('0xd')]);router[_0x475d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x475d('0xe')]);router[_0x475d('0xf')]('/',auth[_0x475d('0x10')](),interaction[_0x475d('0x11')](_0x475d('0x12'),_0x475d('0x13')),controller[_0x475d('0x14')]);router[_0x475d('0xf')](_0x475d('0x15'),controller['status']);router[_0x475d('0x16')](_0x475d('0x17'),auth[_0x475d('0x10')](),controller[_0x475d('0x18')]);router[_0x475d('0x16')](_0x475d('0x19'),auth['isAuthenticated'](),controller['accept']);router['put']('/:id/reject',auth[_0x475d('0x10')](),controller['reject']);router['delete'](_0x475d('0x17'),auth[_0x475d('0x10')](),controller[_0x475d('0x1a')]);module[_0x475d('0x1b')]=router; \ No newline at end of file +var _0x8daa=['/:id','show','post','sms','smsmessage:create','create','/:id/status','status','put','accept','/:id/reject','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','/describe','isAuthenticated'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0x8daa,0x179));var _0xa8da=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0x8daa[_0x134827];return _0x366671;};'use strict';var multer=require(_0xa8da('0x0'));var util=require(_0xa8da('0x1'));var path=require(_0xa8da('0x2'));var timeout=require(_0xa8da('0x3'));var express=require('express');var router=express[_0xa8da('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa8da('0x5'));var interaction=require(_0xa8da('0x6'));var config=require(_0xa8da('0x7'));var controller=require(_0xa8da('0x8'));router[_0xa8da('0x9')]('/',auth['isAuthenticated'](),controller[_0xa8da('0xa')]);router[_0xa8da('0x9')](_0xa8da('0xb'),auth[_0xa8da('0xc')](),controller['describe']);router[_0xa8da('0x9')](_0xa8da('0xd'),auth[_0xa8da('0xc')](),controller[_0xa8da('0xe')]);router[_0xa8da('0xf')]('/',auth[_0xa8da('0xc')](),interaction['tracked'](_0xa8da('0x10'),_0xa8da('0x11')),controller[_0xa8da('0x12')]);router['post'](_0xa8da('0x13'),controller[_0xa8da('0x14')]);router[_0xa8da('0x15')]('/:id',auth[_0xa8da('0xc')](),controller['update']);router[_0xa8da('0x15')]('/:id/accept',auth[_0xa8da('0xc')](),controller[_0xa8da('0x16')]);router[_0xa8da('0x15')](_0xa8da('0x17'),auth[_0xa8da('0xc')](),controller['reject']);router[_0xa8da('0x18')]('/:id',auth[_0xa8da('0xc')](),controller['destroy']);module[_0xa8da('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 14ddfac..162ba59 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 _0xe2ae=['BOOLEAN','TEXT','exports','medium','ENUM','out','STRING','DATE'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xe2ae,0x82));var _0xee2a=function(_0x1f64be,_0x1c37e5){_0x1f64be=_0x1f64be-0x0;var _0x151cfb=_0xe2ae[_0x1f64be];return _0x151cfb;};'use strict';var Sequelize=require('sequelize');module[_0xee2a('0x0')]={'body':{'type':Sequelize['TEXT'](_0xee2a('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xee2a('0x2')]('in',_0xee2a('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xee2a('0x4')](0xbe)},'phone':{'type':Sequelize[_0xee2a('0x4')]},'readAt':{'type':Sequelize[_0xee2a('0x5')]},'secret':{'type':Sequelize[_0xee2a('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xee2a('0x4')]},'providerResponse':{'type':Sequelize[_0xee2a('0x7')]}}; \ No newline at end of file +var _0x54bb=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x6b15e9,_0x20eaa3){var _0x630fd6=function(_0x2b25a4){while(--_0x2b25a4){_0x6b15e9['push'](_0x6b15e9['shift']());}};_0x630fd6(++_0x20eaa3);}(_0x54bb,0xa0));var _0xb54b=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x54bb[_0x40b3f2];return _0x4ce90c;};'use strict';var Sequelize=require(_0xb54b('0x0'));module[_0xb54b('0x1')]={'body':{'type':Sequelize[_0xb54b('0x2')](_0xb54b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb54b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb54b('0x5')]('in',_0xb54b('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xb54b('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb54b('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 3791b27..5c6f01b 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 _0x1b0e=['sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','destroy','name','send','index','SmsMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','find','create','body','params','describe','sms-interactions','accept','sms','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','update','isNil','read1stAt','format','info','[SMSMESSAGE: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','QueryTypes','SELECT','contact','User','fullname','email','manual','SIP/%s','channel','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','internal','motionChannel','event','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','inspect','plivo','MessageUUID'];(function(_0x2d7dbe,_0x933ff5){var _0x279e5a=function(_0x405b4d){while(--_0x405b4d){_0x2d7dbe['push'](_0x2d7dbe['shift']());}};_0x279e5a(++_0x933ff5);}(_0x1b0e,0x132));var _0xe1b0=function(_0xa4af61,_0xf3637f){_0xa4af61=_0xa4af61-0x0;var _0x476989=_0x1b0e[_0xa4af61];return _0x476989;};'use strict';var emlformat=require(_0xe1b0('0x0'));var rimraf=require(_0xe1b0('0x1'));var zipdir=require(_0xe1b0('0x2'));var jsonpatch=require(_0xe1b0('0x3'));var rp=require(_0xe1b0('0x4'));var moment=require(_0xe1b0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe1b0('0x6'));var path=require(_0xe1b0('0x7'));var sox=require('sox');var csv=require(_0xe1b0('0x8'));var ejs=require(_0xe1b0('0x9'));var fs=require('fs');var fs_extra=require(_0xe1b0('0xa'));var _=require('lodash');var squel=require(_0xe1b0('0xb'));var crypto=require(_0xe1b0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe1b0('0xd'));var toCsv=require(_0xe1b0('0x8'));var querystring=require(_0xe1b0('0xe'));var Papa=require(_0xe1b0('0xf'));var Redis=require(_0xe1b0('0x10'));var authService=require(_0xe1b0('0x11'));var qs=require(_0xe1b0('0x12'));var as=require(_0xe1b0('0x13'));var hardwareService=require(_0xe1b0('0x14'));var logger=require(_0xe1b0('0x15'))('api');var utils=require(_0xe1b0('0x16'));var config=require(_0xe1b0('0x17'));var licenseUtil=require(_0xe1b0('0x18'));var db=require(_0xe1b0('0x19'))['db'];config[_0xe1b0('0x1a')]=_[_0xe1b0('0x1b')](config[_0xe1b0('0x1a')],{'host':_0xe1b0('0x1c'),'port':0x18eb});var socket=require(_0xe1b0('0x1d'))(new Redis(config['redis']));require(_0xe1b0('0x1e'))[_0xe1b0('0x1f')](socket);var jayson=require(_0xe1b0('0x20'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xe1b0('0x21')][_0xe1b0('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2b32b5,_0x3d3c2e,_0x23efb3,_0x10f27d){return new BPromise(function(_0x5dfd78,_0x36e930){var _0x36af39=_0x10f27d||client;return _0x36af39[_0xe1b0('0x23')](_0x2b32b5,_0x23efb3)[_0xe1b0('0x24')](function(_0x349f90){logger['info']('SmsMessage,\x20%s,\x20%s',_0x3d3c2e,'request\x20sent');logger[_0xe1b0('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3d3c2e,_0xe1b0('0x26'),JSON[_0xe1b0('0x27')](_0x349f90));if(_0x349f90[_0xe1b0('0x28')]){if(_0x349f90['error'][_0xe1b0('0x29')]===0x1f4){logger[_0xe1b0('0x28')]('SmsMessage,\x20%s,\x20%s',_0x3d3c2e,_0x349f90[_0xe1b0('0x28')][_0xe1b0('0x2a')]);return _0x36e930(_0x349f90[_0xe1b0('0x28')]['message']);}logger[_0xe1b0('0x28')]('SmsMessage,\x20%s,\x20%s',_0x3d3c2e,_0x349f90['error']['message']);return _0x5dfd78(_0x349f90['error'][_0xe1b0('0x2a')]);}else{logger['info'](_0xe1b0('0x2b'),_0x3d3c2e,_0xe1b0('0x26'));_0x5dfd78(_0x349f90[_0xe1b0('0x2c')]['message']);}})[_0xe1b0('0x2d')](function(_0x3ef159){logger['error'](_0xe1b0('0x2b'),_0x3d3c2e,_0x3ef159);_0x36e930(_0x3ef159);});});}function respondWithStatusCode(_0xb541ea,_0x42fd93){_0x42fd93=_0x42fd93||0xcc;return function(_0x213e7e){if(_0x213e7e){return _0xb541ea[_0xe1b0('0x2e')](_0x42fd93);}return _0xb541ea['status'](_0x42fd93)[_0xe1b0('0x2f')]();};}function respondWithResult(_0x2bb865,_0x1a30d0){_0x1a30d0=_0x1a30d0||0xc8;return function(_0x14fcc4){if(_0x14fcc4){return _0x2bb865[_0xe1b0('0x30')](_0x1a30d0)[_0xe1b0('0x31')](_0x14fcc4);}};}function respondWithFilteredResult(_0x13dc9d,_0x1c19cd){return function(_0x5ea3fe){if(_0x5ea3fe){var _0x2f7b35=typeof _0x1c19cd[_0xe1b0('0x32')]==='undefined'&&typeof _0x1c19cd[_0xe1b0('0x33')]===_0xe1b0('0x34');var _0x4a01d8=_0x5ea3fe['count'];var _0x5cc8e3=_0x2f7b35?0x0:_0x1c19cd[_0xe1b0('0x32')];var _0x3f2f25=_0x2f7b35?_0x5ea3fe[_0xe1b0('0x35')]:_0x1c19cd[_0xe1b0('0x32')]+_0x1c19cd[_0xe1b0('0x33')];var _0x3f6577;if(_0x3f2f25>=_0x4a01d8){_0x3f2f25=_0x4a01d8;_0x3f6577=0xc8;}else{_0x3f6577=0xce;}_0x13dc9d['status'](_0x3f6577);return _0x13dc9d['set'](_0xe1b0('0x36'),_0x5cc8e3+'-'+_0x3f2f25+'/'+_0x4a01d8)[_0xe1b0('0x31')](_0x5ea3fe);}return null;};}function patchUpdates(_0xaf1d7a){return function(_0x18cf32){try{jsonpatch[_0xe1b0('0x37')](_0x18cf32,_0xaf1d7a,!![]);}catch(_0x12cfb8){return BPromise[_0xe1b0('0x38')](_0x12cfb8);}return _0x18cf32[_0xe1b0('0x39')]();};}function saveUpdates(_0x736dd7,_0xa3b6e3){return function(_0x57403f){if(_0x57403f){return _0x57403f['update'](_0x736dd7)['then'](function(_0x8ca16a){return _0x8ca16a;});}return null;};}function removeEntity(_0x536450,_0x43fc52){return function(_0x23aeae){if(_0x23aeae){return _0x23aeae[_0xe1b0('0x3a')]()[_0xe1b0('0x24')](function(){_0x536450[_0xe1b0('0x30')](0xcc)[_0xe1b0('0x2f')]();});}};}function handleEntityNotFound(_0x31d3df,_0x4ac0da){return function(_0x52155d){if(!_0x52155d){_0x31d3df['sendStatus'](0x194);}return _0x52155d;};}function handleError(_0x261002,_0x504523){_0x504523=_0x504523||0x1f4;return function(_0x12c2be){logger['error'](_0x12c2be['stack']);if(_0x12c2be['name']){delete _0x12c2be[_0xe1b0('0x3b')];}_0x261002[_0xe1b0('0x30')](_0x504523)[_0xe1b0('0x3c')](_0x12c2be);};}exports[_0xe1b0('0x3d')]=function(_0x15fd34,_0x3766bf){var _0x4b448e={},_0x54e0b9={},_0x3b22f3={'count':0x0,'rows':[]};var _0x410119=_['map'](db[_0xe1b0('0x3e')][_0xe1b0('0x3f')],function(_0x449df2){return{'name':_0x449df2[_0xe1b0('0x40')],'type':_0x449df2[_0xe1b0('0x41')][_0xe1b0('0x42')]};});_0x54e0b9[_0xe1b0('0x43')]=_[_0xe1b0('0x44')](_0x410119,_0xe1b0('0x3b'));_0x54e0b9[_0xe1b0('0x45')]=_[_0xe1b0('0x46')](_0x15fd34[_0xe1b0('0x45')]);_0x54e0b9[_0xe1b0('0x47')]=_[_0xe1b0('0x48')](_0x54e0b9[_0xe1b0('0x43')],_0x54e0b9['query']);_0x4b448e[_0xe1b0('0x49')]=_[_0xe1b0('0x48')](_0x54e0b9[_0xe1b0('0x43')],qs[_0xe1b0('0x4a')](_0x15fd34[_0xe1b0('0x45')][_0xe1b0('0x4a')]));_0x4b448e[_0xe1b0('0x49')]=_0x4b448e[_0xe1b0('0x49')][_0xe1b0('0x4b')]?_0x4b448e[_0xe1b0('0x49')]:_0x54e0b9[_0xe1b0('0x43')];if(!_0x15fd34[_0xe1b0('0x45')]['hasOwnProperty'](_0xe1b0('0x4c'))){_0x4b448e['limit']=qs[_0xe1b0('0x33')](_0x15fd34[_0xe1b0('0x45')][_0xe1b0('0x33')]);_0x4b448e[_0xe1b0('0x32')]=qs[_0xe1b0('0x32')](_0x15fd34[_0xe1b0('0x45')]['offset']);}_0x4b448e[_0xe1b0('0x4d')]=qs[_0xe1b0('0x4e')](_0x15fd34['query']['sort']);_0x4b448e[_0xe1b0('0x4f')]=qs[_0xe1b0('0x47')](_[_0xe1b0('0x50')](_0x15fd34[_0xe1b0('0x45')],_0x54e0b9['filters']),_0x410119);if(_0x15fd34[_0xe1b0('0x45')]['filter']){_0x4b448e[_0xe1b0('0x4f')]=_[_0xe1b0('0x51')](_0x4b448e[_0xe1b0('0x4f')],{'$or':_[_0xe1b0('0x44')](_0x410119,function(_0x59ab53){if(_0x59ab53['type']!==_0xe1b0('0x52')){var _0x5b28eb={};_0x5b28eb[_0x59ab53[_0xe1b0('0x3b')]]={'$like':'%'+_0x15fd34[_0xe1b0('0x45')][_0xe1b0('0x53')]+'%'};return _0x5b28eb;}})});}_0x4b448e=_[_0xe1b0('0x51')]({},_0x4b448e,_0x15fd34[_0xe1b0('0x54')]);var _0x3f0bee={'where':_0x4b448e[_0xe1b0('0x4f')]};return db[_0xe1b0('0x3e')][_0xe1b0('0x35')](_0x3f0bee)[_0xe1b0('0x24')](function(_0x2b2890){_0x3b22f3[_0xe1b0('0x35')]=_0x2b2890;if(_0x15fd34[_0xe1b0('0x45')][_0xe1b0('0x55')]){_0x4b448e[_0xe1b0('0x56')]=[{'all':!![]}];}return db[_0xe1b0('0x3e')][_0xe1b0('0x57')](_0x4b448e);})[_0xe1b0('0x24')](function(_0x12f000){_0x3b22f3['rows']=_0x12f000;return _0x3b22f3;})[_0xe1b0('0x24')](respondWithFilteredResult(_0x3766bf,_0x4b448e))[_0xe1b0('0x2d')](handleError(_0x3766bf,null));};exports[_0xe1b0('0x58')]=function(_0x2179a3,_0x4f93a9){var _0x41194d={'raw':!![],'where':{'id':_0x2179a3['params']['id']}},_0x28473={};_0x28473['model']=_[_0xe1b0('0x46')](db['SmsMessage']['rawAttributes']);_0x28473[_0xe1b0('0x45')]=_[_0xe1b0('0x46')](_0x2179a3[_0xe1b0('0x45')]);_0x28473['filters']=_['intersection'](_0x28473[_0xe1b0('0x43')],_0x28473['query']);_0x41194d[_0xe1b0('0x49')]=_[_0xe1b0('0x48')](_0x28473[_0xe1b0('0x43')],qs[_0xe1b0('0x4a')](_0x2179a3[_0xe1b0('0x45')]['fields']));_0x41194d[_0xe1b0('0x49')]=_0x41194d['attributes'][_0xe1b0('0x4b')]?_0x41194d[_0xe1b0('0x49')]:_0x28473['model'];if(_0x2179a3[_0xe1b0('0x45')][_0xe1b0('0x55')]){_0x41194d[_0xe1b0('0x56')]=[{'all':!![]}];}_0x41194d=_['merge']({},_0x41194d,_0x2179a3['options']);return db[_0xe1b0('0x3e')][_0xe1b0('0x59')](_0x41194d)[_0xe1b0('0x24')](handleEntityNotFound(_0x4f93a9,null))[_0xe1b0('0x24')](respondWithResult(_0x4f93a9,null))[_0xe1b0('0x2d')](handleError(_0x4f93a9,null));};exports[_0xe1b0('0x5a')]=function(_0x4e4bf3,_0x8156d1){return db['SmsMessage'][_0xe1b0('0x5a')](_0x4e4bf3[_0xe1b0('0x5b')],{})[_0xe1b0('0x24')](respondWithResult(_0x8156d1,0xc9))[_0xe1b0('0x2d')](handleError(_0x8156d1,null));};exports['update']=function(_0x457907,_0x4c3881){if(_0x457907[_0xe1b0('0x5b')]['id']){delete _0x457907[_0xe1b0('0x5b')]['id'];}return db['SmsMessage'][_0xe1b0('0x59')]({'where':{'id':_0x457907[_0xe1b0('0x5c')]['id']}})[_0xe1b0('0x24')](handleEntityNotFound(_0x4c3881,null))[_0xe1b0('0x24')](saveUpdates(_0x457907[_0xe1b0('0x5b')],null))['then'](respondWithResult(_0x4c3881,null))[_0xe1b0('0x2d')](handleError(_0x4c3881,null));};exports[_0xe1b0('0x3a')]=function(_0x11eedb,_0x31dc3e){return db[_0xe1b0('0x3e')][_0xe1b0('0x59')]({'where':{'id':_0x11eedb[_0xe1b0('0x5c')]['id']}})[_0xe1b0('0x24')](handleEntityNotFound(_0x31dc3e,null))['then'](removeEntity(_0x31dc3e,null))['catch'](handleError(_0x31dc3e,null));};exports[_0xe1b0('0x5d')]=function(_0x32403b,_0x132f47){return db[_0xe1b0('0x3e')][_0xe1b0('0x5d')]()[_0xe1b0('0x24')](respondWithResult(_0x132f47,null))['catch'](handleError(_0x132f47,null));};var interaction_log=require(_0xe1b0('0x15'))(_0xe1b0('0x5e'));exports[_0xe1b0('0x5f')]=function(_0x10e25f,_0x1275e5,_0x3ade51){var _0x5dfa02={'agent':{},'channel':_0xe1b0('0x60')};if(_0x10e25f[_0xe1b0('0x5b')]['id']){delete _0x10e25f[_0xe1b0('0x5b')]['id'];}_0x10e25f[_0xe1b0('0x5b')]['read']=!![];_0x10e25f[_0xe1b0('0x5b')][_0xe1b0('0x61')]=moment()['format'](_0xe1b0('0x62'));_0x10e25f[_0xe1b0('0x5b')][_0xe1b0('0x63')]=_0x10e25f[_0xe1b0('0x5b')][_0xe1b0('0x63')]||_0x10e25f[_0xe1b0('0x64')]['id'];_0x5dfa02[_0xe1b0('0x65')]['id']=_0x10e25f[_0xe1b0('0x5b')]['UserId'];return db[_0xe1b0('0x3e')][_0xe1b0('0x59')]({'where':{'id':_0x10e25f[_0xe1b0('0x5c')]['id'],'UserId':null}})[_0xe1b0('0x24')](handleEntityNotFound(_0x1275e5,null))[_0xe1b0('0x24')](saveUpdates(_0x10e25f[_0xe1b0('0x5b')],null))['then'](function(_0x5534b0){if(_0x5534b0){_0x5dfa02[_0xe1b0('0x2a')]=_0x5534b0[_0xe1b0('0x66')]({'plain':!![]});return db[_0xe1b0('0x67')][_0xe1b0('0x59')]({'where':{'id':_0x5534b0[_0xe1b0('0x68')]}});}return null;})[_0xe1b0('0x24')](handleEntityNotFound(_0x1275e5,null))[_0xe1b0('0x24')](function(_0x511f85){if(_0x511f85){return _0x511f85[_0xe1b0('0x69')]({'UserId':_0x10e25f[_0xe1b0('0x5b')][_0xe1b0('0x63')],'read1stAt':_[_0xe1b0('0x6a')](_0x511f85[_0xe1b0('0x6b')])?moment()[_0xe1b0('0x6c')](_0xe1b0('0x62')):undefined});}return null;})[_0xe1b0('0x24')](function(_0x3fcfa2){if(_0x3fcfa2){_0x5dfa02['interaction']=_0x3fcfa2[_0xe1b0('0x66')]({'plain':!![]});interaction_log[_0xe1b0('0x6d')](_0xe1b0('0x6e'),_0x10e25f[_0xe1b0('0x64')]['id'],_0x10e25f[_0xe1b0('0x64')][_0xe1b0('0x3b')],_0x10e25f[_0xe1b0('0x64')][_0xe1b0('0x6f')],_0x5dfa02[_0xe1b0('0x70')]['id'],_0x10e25f[_0xe1b0('0x5b')]?JSON[_0xe1b0('0x27')](_0x10e25f['body']):_0xe1b0('0x71'));return respondWithRpcPromise(_0xe1b0('0x72'),'acceptMessage',_0x5dfa02);}return null;})[_0xe1b0('0x24')](function(_0x20e6e7){var _0x182060=_0xe1b0('0x73')+_0x20e6e7[_0xe1b0('0x2a')][_0xe1b0('0x74')];return db['sequelize']['query'](_0x182060,{'type':db[_0xe1b0('0x75')][_0xe1b0('0x76')][_0xe1b0('0x77')],'raw':!![]})['then'](function(_0x580202){return _0x580202;});})[_0xe1b0('0x24')](function(_0x1e1fcd){if(_0x1e1fcd){_0x5dfa02[_0xe1b0('0x2a')][_0xe1b0('0x78')]=_0x1e1fcd[0x0];if(!_0x10e25f[_0xe1b0('0x5b')][_0xe1b0('0x63')])return;return db[_0xe1b0('0x79')][_0xe1b0('0x59')]({'where':{'id':_0x10e25f[_0xe1b0('0x5b')][_0xe1b0('0x63')],'role':_0xe1b0('0x65')},'attributes':['id',_0xe1b0('0x3b'),_0xe1b0('0x7a'),_0xe1b0('0x7b'),'internal'],'raw':!![]});}return null;})[_0xe1b0('0x24')](function(_0x2c3ed1){if(!_0x2c3ed1)return null;_0x5dfa02[_0xe1b0('0x2a')][_0xe1b0('0x65')]=_0x2c3ed1;return _0x5dfa02;})[_0xe1b0('0x24')](function(_0x28a827){if(_0x28a827){if(_0x10e25f[_0xe1b0('0x5b')][_0xe1b0('0x7c')]){_0x5dfa02[_0xe1b0('0x2a')]['interface']=util['format'](_0xe1b0('0x7d'),_0x10e25f['user'][_0xe1b0('0x3b')]);_0x5dfa02[_0xe1b0('0x2a')][_0xe1b0('0x7e')]=_0x5dfa02[_0xe1b0('0x7e')];_0x5dfa02['message']['motionChannel']=_0x5dfa02['channel'];_0x5dfa02[_0xe1b0('0x2a')]['event']='accept';return respondWithRpcPromise(_0xe1b0('0x7f'),_0xe1b0('0x7f'),{'event':_0xe1b0('0x80'),'message':_0x5dfa02['message']},client9002)[_0xe1b0('0x24')](function(){return _0x5dfa02;});}return _0x5dfa02;}return null;})['then'](respondWithResult(_0x1275e5,null))[_0xe1b0('0x2d')](handleError(_0x1275e5,null));};var interaction_log=require(_0xe1b0('0x15'))('sms-interactions');exports[_0xe1b0('0x38')]=function(_0x5336e3,_0xed0e3a,_0x50125e){var _0x1a57aa={'agent':{},'channel':_0xe1b0('0x60')};if(_0x5336e3['body']['id']){delete _0x5336e3['body']['id'];}_0x5336e3['body'][_0xe1b0('0x63')]=_0x5336e3[_0xe1b0('0x5b')]['UserId']||_0x5336e3[_0xe1b0('0x64')]['id'];_0x1a57aa[_0xe1b0('0x65')]['id']=_0x5336e3[_0xe1b0('0x5b')][_0xe1b0('0x63')];return db[_0xe1b0('0x3e')]['find']({'where':{'id':_0x5336e3[_0xe1b0('0x5c')]['id'],'UserId':null}})[_0xe1b0('0x24')](handleEntityNotFound(_0xed0e3a,null))['then'](function(_0x1b7abc){if(_0x1b7abc){_0x1a57aa['message']=_0x1b7abc[_0xe1b0('0x66')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x1b7abc['SmsInteractionId']}});}return null;})[_0xe1b0('0x24')](handleEntityNotFound(_0xed0e3a,null))[_0xe1b0('0x24')](function(_0x30b2fa){if(_0x30b2fa){_0x1a57aa['interaction']=_0x30b2fa[_0xe1b0('0x66')]({'plain':!![]});interaction_log['info'](_0xe1b0('0x81'),_0x5336e3[_0xe1b0('0x64')]['id'],_0x5336e3[_0xe1b0('0x64')][_0xe1b0('0x3b')],_0x5336e3[_0xe1b0('0x64')]['role'],_0x1a57aa[_0xe1b0('0x70')]['id'],_0x5336e3[_0xe1b0('0x5b')]?JSON[_0xe1b0('0x27')](_0x5336e3[_0xe1b0('0x5b')]):_0xe1b0('0x71'));return respondWithRpcPromise('RejectMessage',_0xe1b0('0x82'),_0x1a57aa);}return null;})[_0xe1b0('0x24')](function(_0xa1f961){var _0x33eb04=_0xe1b0('0x73')+_0xa1f961[_0xe1b0('0x2a')]['ContactId'];return db[_0xe1b0('0x83')][_0xe1b0('0x45')](_0x33eb04,{'type':db[_0xe1b0('0x75')][_0xe1b0('0x76')][_0xe1b0('0x77')],'raw':!![]})[_0xe1b0('0x24')](function(_0x2be2f2){return _0x2be2f2;});})['then'](function(_0x495bfa){if(_0x495bfa){_0x1a57aa['message'][_0xe1b0('0x78')]=_0x495bfa[0x0];if(!_0x5336e3[_0xe1b0('0x5b')]['UserId'])return;return db['User'][_0xe1b0('0x59')]({'where':{'id':_0x5336e3[_0xe1b0('0x5b')][_0xe1b0('0x63')],'role':_0xe1b0('0x65')},'attributes':['id','name',_0xe1b0('0x7a'),'email',_0xe1b0('0x84')],'raw':!![]});}return null;})[_0xe1b0('0x24')](function(_0xf1aba8){if(!_0xf1aba8)return null;_0x1a57aa[_0xe1b0('0x2a')][_0xe1b0('0x65')]=_0xf1aba8;return _0x1a57aa;})[_0xe1b0('0x24')](function(_0x1293ab){if(_0x1293ab){_0x1293ab[_0xe1b0('0x2a')]['interface']=util[_0xe1b0('0x6c')]('SIP/%s',_0x5336e3[_0xe1b0('0x64')]['name']);_0x1293ab['message'][_0xe1b0('0x7e')]=_0x1a57aa[_0xe1b0('0x7e')];_0x1293ab[_0xe1b0('0x2a')][_0xe1b0('0x85')]=_0x1a57aa[_0xe1b0('0x7e')];_0x1293ab['message'][_0xe1b0('0x86')]='reject';respondWithRpcPromise(_0xe1b0('0x7f'),'EventManager',{'event':_0xe1b0('0x87'),'message':_0x1293ab[_0xe1b0('0x2a')]},client9002);return _0x1a57aa;}return null;})[_0xe1b0('0x24')](respondWithResult(_0xed0e3a,null))[_0xe1b0('0x2d')](handleError(_0xed0e3a,null));};exports[_0xe1b0('0x30')]=function(_0x3df14e,_0x3886de,_0x48360e){if(_0x3df14e[_0xe1b0('0x5b')]['id']){delete _0x3df14e[_0xe1b0('0x5b')]['id'];}var _0x52c278;return db[_0xe1b0('0x3e')]['find']({'where':{'id':_0x3df14e['params']['id']}})['then'](handleEntityNotFound(_0x3886de,null))[_0xe1b0('0x24')](function(_0x21161d){if(_0x21161d){_0x52c278=_0x21161d;return db[_0xe1b0('0x88')]['find']({'where':{'id':_0x21161d['SmsAccountId']}});}})[_0xe1b0('0x24')](handleEntityNotFound(_0x3886de,null))[_0xe1b0('0x24')](function(_0x1feb74){if(_0x1feb74){logger[_0xe1b0('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe1b0('0x30'),_0xe1b0('0x89'),_0x1feb74[_0xe1b0('0x41')],util['inspect'](_0x3df14e[_0xe1b0('0x5b')],{'showHidden':![],'depth':null}));switch(_0x1feb74[_0xe1b0('0x41')]){case _0xe1b0('0x8a'):if(_0x3df14e[_0xe1b0('0x5b')][_0xe1b0('0x8b')]&&_0x3df14e[_0xe1b0('0x5b')][_0xe1b0('0x8b')]===_0x52c278[_0xe1b0('0x8c')]){return _0x52c278[_0xe1b0('0x69')]({'read':!![]});}else{logger[_0xe1b0('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0xe1b0('0x8d')](_0x3df14e[_0xe1b0('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe1b0('0x8e'):if(_0x3df14e['body'][_0xe1b0('0x8f')]&&_0x3df14e['body']['MessageUUID']===_0x52c278[_0xe1b0('0x8c')]&&_['indexOf']([_0xe1b0('0x90'),_0xe1b0('0x91')],_0x3df14e[_0xe1b0('0x5b')]['Status'])>=0x0){return _0x52c278[_0xe1b0('0x69')]({'read':!![]});}else{logger[_0xe1b0('0x28')](_0xe1b0('0x92'),'status','plivio',util[_0xe1b0('0x8d')](_0x3df14e[_0xe1b0('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe1b0('0x93'):var _0x4343df=_0x3df14e[_0xe1b0('0x5b')]['results'][0x0];if(_0x4343df[_0xe1b0('0x30')][_0xe1b0('0x94')]===_0xe1b0('0x95')){return _0x52c278['update']({'read':!![]});}else{logger[_0xe1b0('0x28')](_0xe1b0('0x92'),_0xe1b0('0x30'),_0xe1b0('0x93'),util['inspect'](_0x3df14e[_0xe1b0('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x52c278;}})[_0xe1b0('0x24')](respondWithResult(_0x3886de,null))[_0xe1b0('0x2d')](handleError(_0x3886de,null));}; \ No newline at end of file +var _0x0760=['SELECT','User','SIP/%s','motionChannel','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','infobip','DELIVERED','eml-format','zip-dir','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','show','params','intersection','includeAll','options','create','body','find','describe','sms-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','fullname','email','internal','manual','interface','channel','accept','EventManager','acceptmessage','sms','null','RejectMessage','ContactId','Sequelize'];(function(_0x485e27,_0xd9adf0){var _0x5ac0b8=function(_0x589bf5){while(--_0x589bf5){_0x485e27['push'](_0x485e27['shift']());}};_0x5ac0b8(++_0xd9adf0);}(_0x0760,0xa9));var _0x0076=function(_0x4e8bd1,_0x271f9c){_0x4e8bd1=_0x4e8bd1-0x0;var _0x45c437=_0x0760[_0x4e8bd1];return _0x45c437;};'use strict';var emlformat=require(_0x0076('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0076('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0076('0x2'));var Mustache=require(_0x0076('0x3'));var util=require(_0x0076('0x4'));var path=require(_0x0076('0x5'));var sox=require(_0x0076('0x6'));var csv=require('to-csv');var ejs=require(_0x0076('0x7'));var fs=require('fs');var fs_extra=require(_0x0076('0x8'));var _=require(_0x0076('0x9'));var squel=require(_0x0076('0xa'));var crypto=require(_0x0076('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0076('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0076('0xd'));var Papa=require(_0x0076('0xe'));var Redis=require('ioredis');var authService=require(_0x0076('0xf'));var qs=require(_0x0076('0x10'));var as=require(_0x0076('0x11'));var hardwareService=require(_0x0076('0x12'));var logger=require(_0x0076('0x13'))(_0x0076('0x14'));var utils=require('../../config/utils');var config=require(_0x0076('0x15'));var licenseUtil=require(_0x0076('0x16'));var db=require(_0x0076('0x17'))['db'];config[_0x0076('0x18')]=_[_0x0076('0x19')](config[_0x0076('0x18')],{'host':_0x0076('0x1a'),'port':0x18eb});var socket=require(_0x0076('0x1b'))(new Redis(config[_0x0076('0x18')]));require(_0x0076('0x1c'))[_0x0076('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0076('0x1e')]['http']({'port':0x232c});var client9002=jayson['client'][_0x0076('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2a45c6,_0x4ce381,_0x46641d,_0x58c9f9){return new BPromise(function(_0x2ff722,_0x1fa4f0){var _0x5a5623=_0x58c9f9||client;return _0x5a5623['request'](_0x2a45c6,_0x46641d)['then'](function(_0xc0a663){logger[_0x0076('0x20')](_0x0076('0x21'),_0x4ce381,_0x0076('0x22'));logger[_0x0076('0x23')](_0x0076('0x24'),_0x4ce381,_0x0076('0x22'),JSON[_0x0076('0x25')](_0xc0a663));if(_0xc0a663[_0x0076('0x26')]){if(_0xc0a663[_0x0076('0x26')][_0x0076('0x27')]===0x1f4){logger[_0x0076('0x26')](_0x0076('0x21'),_0x4ce381,_0xc0a663[_0x0076('0x26')]['message']);return _0x1fa4f0(_0xc0a663[_0x0076('0x26')][_0x0076('0x28')]);}logger[_0x0076('0x26')]('SmsMessage,\x20%s,\x20%s',_0x4ce381,_0xc0a663[_0x0076('0x26')][_0x0076('0x28')]);return _0x2ff722(_0xc0a663[_0x0076('0x26')][_0x0076('0x28')]);}else{logger[_0x0076('0x20')]('SmsMessage,\x20%s,\x20%s',_0x4ce381,_0x0076('0x22'));_0x2ff722(_0xc0a663[_0x0076('0x29')][_0x0076('0x28')]);}})[_0x0076('0x2a')](function(_0x2c7def){logger[_0x0076('0x26')]('SmsMessage,\x20%s,\x20%s',_0x4ce381,_0x2c7def);_0x1fa4f0(_0x2c7def);});});}function respondWithStatusCode(_0x1fbe92,_0x27c087){_0x27c087=_0x27c087||0xcc;return function(_0x1dbd77){if(_0x1dbd77){return _0x1fbe92[_0x0076('0x2b')](_0x27c087);}return _0x1fbe92[_0x0076('0x2c')](_0x27c087)['end']();};}function respondWithResult(_0xd481f4,_0x712db9){_0x712db9=_0x712db9||0xc8;return function(_0x1a8809){if(_0x1a8809){return _0xd481f4[_0x0076('0x2c')](_0x712db9)[_0x0076('0x2d')](_0x1a8809);}};}function respondWithFilteredResult(_0xd4009d,_0x1635b7){return function(_0x332376){if(_0x332376){var _0x2bc8b7=typeof _0x1635b7[_0x0076('0x2e')]==='undefined'&&typeof _0x1635b7[_0x0076('0x2f')]===_0x0076('0x30');var _0x3366a8=_0x332376[_0x0076('0x31')];var _0x365049=_0x2bc8b7?0x0:_0x1635b7['offset'];var _0x522273=_0x2bc8b7?_0x332376[_0x0076('0x31')]:_0x1635b7[_0x0076('0x2e')]+_0x1635b7[_0x0076('0x2f')];var _0x31fd7a;if(_0x522273>=_0x3366a8){_0x522273=_0x3366a8;_0x31fd7a=0xc8;}else{_0x31fd7a=0xce;}_0xd4009d['status'](_0x31fd7a);return _0xd4009d['set'](_0x0076('0x32'),_0x365049+'-'+_0x522273+'/'+_0x3366a8)[_0x0076('0x2d')](_0x332376);}return null;};}function patchUpdates(_0x1c633c){return function(_0x5ef415){try{jsonpatch[_0x0076('0x33')](_0x5ef415,_0x1c633c,!![]);}catch(_0x2092c2){return BPromise[_0x0076('0x34')](_0x2092c2);}return _0x5ef415[_0x0076('0x35')]();};}function saveUpdates(_0x1e067e,_0x37c684){return function(_0x251d9c){if(_0x251d9c){return _0x251d9c[_0x0076('0x36')](_0x1e067e)[_0x0076('0x37')](function(_0x1dc13a){return _0x1dc13a;});}return null;};}function removeEntity(_0x393107,_0x499c6f){return function(_0x17d180){if(_0x17d180){return _0x17d180[_0x0076('0x38')]()[_0x0076('0x37')](function(){_0x393107[_0x0076('0x2c')](0xcc)[_0x0076('0x39')]();});}};}function handleEntityNotFound(_0x210885,_0x43ebb9){return function(_0x48fda8){if(!_0x48fda8){_0x210885[_0x0076('0x2b')](0x194);}return _0x48fda8;};}function handleError(_0x185033,_0x2c3e4b){_0x2c3e4b=_0x2c3e4b||0x1f4;return function(_0x2c8958){logger['error'](_0x2c8958[_0x0076('0x3a')]);if(_0x2c8958['name']){delete _0x2c8958[_0x0076('0x3b')];}_0x185033[_0x0076('0x2c')](_0x2c3e4b)[_0x0076('0x3c')](_0x2c8958);};}exports[_0x0076('0x3d')]=function(_0x3ac727,_0x2669b7){var _0x1829dd={},_0x14c1df={},_0x4614cd={'count':0x0,'rows':[]};var _0x4e81f6=_[_0x0076('0x3e')](db[_0x0076('0x3f')][_0x0076('0x40')],function(_0x5843e6){return{'name':_0x5843e6[_0x0076('0x41')],'type':_0x5843e6[_0x0076('0x42')][_0x0076('0x43')]};});_0x14c1df[_0x0076('0x44')]=_[_0x0076('0x3e')](_0x4e81f6,_0x0076('0x3b'));_0x14c1df['query']=_[_0x0076('0x45')](_0x3ac727['query']);_0x14c1df[_0x0076('0x46')]=_['intersection'](_0x14c1df[_0x0076('0x44')],_0x14c1df[_0x0076('0x47')]);_0x1829dd[_0x0076('0x48')]=_['intersection'](_0x14c1df[_0x0076('0x44')],qs[_0x0076('0x49')](_0x3ac727['query'][_0x0076('0x49')]));_0x1829dd[_0x0076('0x48')]=_0x1829dd[_0x0076('0x48')][_0x0076('0x4a')]?_0x1829dd[_0x0076('0x48')]:_0x14c1df[_0x0076('0x44')];if(!_0x3ac727[_0x0076('0x47')][_0x0076('0x4b')](_0x0076('0x4c'))){_0x1829dd[_0x0076('0x2f')]=qs[_0x0076('0x2f')](_0x3ac727[_0x0076('0x47')][_0x0076('0x2f')]);_0x1829dd[_0x0076('0x2e')]=qs[_0x0076('0x2e')](_0x3ac727['query'][_0x0076('0x2e')]);}_0x1829dd[_0x0076('0x4d')]=qs[_0x0076('0x4e')](_0x3ac727[_0x0076('0x47')]['sort']);_0x1829dd[_0x0076('0x4f')]=qs[_0x0076('0x46')](_[_0x0076('0x50')](_0x3ac727[_0x0076('0x47')],_0x14c1df['filters']),_0x4e81f6);if(_0x3ac727['query'][_0x0076('0x51')]){_0x1829dd[_0x0076('0x4f')]=_['merge'](_0x1829dd[_0x0076('0x4f')],{'$or':_[_0x0076('0x3e')](_0x4e81f6,function(_0x5a90e2){if(_0x5a90e2[_0x0076('0x42')]!=='VIRTUAL'){var _0x39c568={};_0x39c568[_0x5a90e2[_0x0076('0x3b')]]={'$like':'%'+_0x3ac727[_0x0076('0x47')][_0x0076('0x51')]+'%'};return _0x39c568;}})});}_0x1829dd=_[_0x0076('0x52')]({},_0x1829dd,_0x3ac727['options']);var _0x2cfc6c={'where':_0x1829dd[_0x0076('0x4f')]};return db[_0x0076('0x3f')][_0x0076('0x31')](_0x2cfc6c)[_0x0076('0x37')](function(_0x3670c4){_0x4614cd['count']=_0x3670c4;if(_0x3ac727[_0x0076('0x47')]['includeAll']){_0x1829dd[_0x0076('0x53')]=[{'all':!![]}];}return db['SmsMessage'][_0x0076('0x54')](_0x1829dd);})[_0x0076('0x37')](function(_0x10b808){_0x4614cd['rows']=_0x10b808;return _0x4614cd;})[_0x0076('0x37')](respondWithFilteredResult(_0x2669b7,_0x1829dd))[_0x0076('0x2a')](handleError(_0x2669b7,null));};exports[_0x0076('0x55')]=function(_0x4f6c63,_0xdc72c2){var _0x416f0c={'raw':!![],'where':{'id':_0x4f6c63[_0x0076('0x56')]['id']}},_0x592d66={};_0x592d66[_0x0076('0x44')]=_[_0x0076('0x45')](db[_0x0076('0x3f')]['rawAttributes']);_0x592d66[_0x0076('0x47')]=_[_0x0076('0x45')](_0x4f6c63[_0x0076('0x47')]);_0x592d66[_0x0076('0x46')]=_[_0x0076('0x57')](_0x592d66[_0x0076('0x44')],_0x592d66['query']);_0x416f0c[_0x0076('0x48')]=_[_0x0076('0x57')](_0x592d66['model'],qs[_0x0076('0x49')](_0x4f6c63[_0x0076('0x47')][_0x0076('0x49')]));_0x416f0c[_0x0076('0x48')]=_0x416f0c['attributes'][_0x0076('0x4a')]?_0x416f0c[_0x0076('0x48')]:_0x592d66[_0x0076('0x44')];if(_0x4f6c63[_0x0076('0x47')][_0x0076('0x58')]){_0x416f0c[_0x0076('0x53')]=[{'all':!![]}];}_0x416f0c=_[_0x0076('0x52')]({},_0x416f0c,_0x4f6c63[_0x0076('0x59')]);return db[_0x0076('0x3f')]['find'](_0x416f0c)[_0x0076('0x37')](handleEntityNotFound(_0xdc72c2,null))['then'](respondWithResult(_0xdc72c2,null))[_0x0076('0x2a')](handleError(_0xdc72c2,null));};exports[_0x0076('0x5a')]=function(_0x9482c7,_0xacf00d){return db[_0x0076('0x3f')][_0x0076('0x5a')](_0x9482c7[_0x0076('0x5b')],{})[_0x0076('0x37')](respondWithResult(_0xacf00d,0xc9))[_0x0076('0x2a')](handleError(_0xacf00d,null));};exports[_0x0076('0x36')]=function(_0x2b2e5d,_0x4d4349){if(_0x2b2e5d[_0x0076('0x5b')]['id']){delete _0x2b2e5d['body']['id'];}return db['SmsMessage'][_0x0076('0x5c')]({'where':{'id':_0x2b2e5d['params']['id']}})[_0x0076('0x37')](handleEntityNotFound(_0x4d4349,null))['then'](saveUpdates(_0x2b2e5d['body'],null))[_0x0076('0x37')](respondWithResult(_0x4d4349,null))[_0x0076('0x2a')](handleError(_0x4d4349,null));};exports[_0x0076('0x38')]=function(_0x3a2e50,_0x5e1afb){return db[_0x0076('0x3f')][_0x0076('0x5c')]({'where':{'id':_0x3a2e50['params']['id']}})[_0x0076('0x37')](handleEntityNotFound(_0x5e1afb,null))[_0x0076('0x37')](removeEntity(_0x5e1afb,null))[_0x0076('0x2a')](handleError(_0x5e1afb,null));};exports['describe']=function(_0x2178c5,_0x2799c1){return db['SmsMessage'][_0x0076('0x5d')]()[_0x0076('0x37')](respondWithResult(_0x2799c1,null))[_0x0076('0x2a')](handleError(_0x2799c1,null));};var interaction_log=require(_0x0076('0x13'))(_0x0076('0x5e'));exports['accept']=function(_0x3040ed,_0x97b427,_0x2d4e35){var _0x5122cb={'agent':{},'channel':'sms'};if(_0x3040ed[_0x0076('0x5b')]['id']){delete _0x3040ed[_0x0076('0x5b')]['id'];}_0x3040ed[_0x0076('0x5b')][_0x0076('0x5f')]=!![];_0x3040ed[_0x0076('0x5b')][_0x0076('0x60')]=moment()[_0x0076('0x61')](_0x0076('0x62'));_0x3040ed[_0x0076('0x5b')][_0x0076('0x63')]=_0x3040ed[_0x0076('0x5b')][_0x0076('0x63')]||_0x3040ed[_0x0076('0x64')]['id'];_0x5122cb[_0x0076('0x65')]['id']=_0x3040ed[_0x0076('0x5b')][_0x0076('0x63')];return db[_0x0076('0x3f')][_0x0076('0x5c')]({'where':{'id':_0x3040ed[_0x0076('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x97b427,null))[_0x0076('0x37')](saveUpdates(_0x3040ed[_0x0076('0x5b')],null))[_0x0076('0x37')](function(_0x4394cd){if(_0x4394cd){_0x5122cb[_0x0076('0x28')]=_0x4394cd[_0x0076('0x66')]({'plain':!![]});return db[_0x0076('0x67')][_0x0076('0x5c')]({'where':{'id':_0x4394cd[_0x0076('0x68')]}});}return null;})[_0x0076('0x37')](handleEntityNotFound(_0x97b427,null))[_0x0076('0x37')](function(_0xa9bf7b){if(_0xa9bf7b){return _0xa9bf7b[_0x0076('0x36')]({'UserId':_0x3040ed[_0x0076('0x5b')]['UserId'],'read1stAt':_[_0x0076('0x69')](_0xa9bf7b['read1stAt'])?moment()[_0x0076('0x61')](_0x0076('0x62')):undefined});}return null;})[_0x0076('0x37')](function(_0x44568d){if(_0x44568d){_0x5122cb[_0x0076('0x6a')]=_0x44568d[_0x0076('0x66')]({'plain':!![]});interaction_log['info'](_0x0076('0x6b'),_0x3040ed['user']['id'],_0x3040ed[_0x0076('0x64')][_0x0076('0x3b')],_0x3040ed[_0x0076('0x64')][_0x0076('0x6c')],_0x5122cb[_0x0076('0x6a')]['id'],_0x3040ed['body']?JSON[_0x0076('0x25')](_0x3040ed[_0x0076('0x5b')]):'null');return respondWithRpcPromise(_0x0076('0x6d'),_0x0076('0x6e'),_0x5122cb);}return null;})['then'](function(_0x1ca8e0){var _0x1cce83=_0x0076('0x6f')+_0x1ca8e0[_0x0076('0x28')]['ContactId'];return db[_0x0076('0x70')][_0x0076('0x47')](_0x1cce83,{'type':db['Sequelize'][_0x0076('0x71')]['SELECT'],'raw':!![]})[_0x0076('0x37')](function(_0x48e5b0){return _0x48e5b0;});})['then'](function(_0x434046){if(_0x434046){_0x5122cb[_0x0076('0x28')][_0x0076('0x72')]=_0x434046[0x0];if(!_0x3040ed[_0x0076('0x5b')][_0x0076('0x63')])return;return db['User'][_0x0076('0x5c')]({'where':{'id':_0x3040ed['body'][_0x0076('0x63')],'role':_0x0076('0x65')},'attributes':['id','name',_0x0076('0x73'),_0x0076('0x74'),_0x0076('0x75')],'raw':!![]});}return null;})[_0x0076('0x37')](function(_0x25e733){if(!_0x25e733)return null;_0x5122cb[_0x0076('0x28')][_0x0076('0x65')]=_0x25e733;return _0x5122cb;})[_0x0076('0x37')](function(_0x34bbb7){if(_0x34bbb7){if(_0x3040ed[_0x0076('0x5b')][_0x0076('0x76')]){_0x5122cb[_0x0076('0x28')][_0x0076('0x77')]=util[_0x0076('0x61')]('SIP/%s',_0x3040ed[_0x0076('0x64')][_0x0076('0x3b')]);_0x5122cb[_0x0076('0x28')][_0x0076('0x78')]=_0x5122cb[_0x0076('0x78')];_0x5122cb['message']['motionChannel']=_0x5122cb[_0x0076('0x78')];_0x5122cb[_0x0076('0x28')]['event']=_0x0076('0x79');return respondWithRpcPromise('EventManager',_0x0076('0x7a'),{'event':_0x0076('0x7b'),'message':_0x5122cb[_0x0076('0x28')]},client9002)[_0x0076('0x37')](function(){return _0x5122cb;});}return _0x5122cb;}return null;})[_0x0076('0x37')](respondWithResult(_0x97b427,null))[_0x0076('0x2a')](handleError(_0x97b427,null));};var interaction_log=require(_0x0076('0x13'))(_0x0076('0x5e'));exports['reject']=function(_0x57bd79,_0x276f79,_0x5d99d0){var _0x1e356e={'agent':{},'channel':_0x0076('0x7c')};if(_0x57bd79[_0x0076('0x5b')]['id']){delete _0x57bd79[_0x0076('0x5b')]['id'];}_0x57bd79[_0x0076('0x5b')][_0x0076('0x63')]=_0x57bd79['body'][_0x0076('0x63')]||_0x57bd79[_0x0076('0x64')]['id'];_0x1e356e['agent']['id']=_0x57bd79[_0x0076('0x5b')][_0x0076('0x63')];return db['SmsMessage'][_0x0076('0x5c')]({'where':{'id':_0x57bd79[_0x0076('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x276f79,null))[_0x0076('0x37')](function(_0x27d5ca){if(_0x27d5ca){_0x1e356e[_0x0076('0x28')]=_0x27d5ca[_0x0076('0x66')]({'plain':!![]});return db[_0x0076('0x67')]['find']({'where':{'id':_0x27d5ca[_0x0076('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x276f79,null))[_0x0076('0x37')](function(_0x94cdae){if(_0x94cdae){_0x1e356e[_0x0076('0x6a')]=_0x94cdae[_0x0076('0x66')]({'plain':!![]});interaction_log[_0x0076('0x20')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x57bd79['user']['id'],_0x57bd79[_0x0076('0x64')][_0x0076('0x3b')],_0x57bd79[_0x0076('0x64')][_0x0076('0x6c')],_0x1e356e[_0x0076('0x6a')]['id'],_0x57bd79[_0x0076('0x5b')]?JSON['stringify'](_0x57bd79['body']):_0x0076('0x7d'));return respondWithRpcPromise(_0x0076('0x7e'),'rejectMessage',_0x1e356e);}return null;})[_0x0076('0x37')](function(_0x54cf6d){var _0x5df7b3=_0x0076('0x6f')+_0x54cf6d['message'][_0x0076('0x7f')];return db['sequelize'][_0x0076('0x47')](_0x5df7b3,{'type':db[_0x0076('0x80')]['QueryTypes'][_0x0076('0x81')],'raw':!![]})[_0x0076('0x37')](function(_0x16ea74){return _0x16ea74;});})['then'](function(_0x25b320){if(_0x25b320){_0x1e356e[_0x0076('0x28')][_0x0076('0x72')]=_0x25b320[0x0];if(!_0x57bd79[_0x0076('0x5b')][_0x0076('0x63')])return;return db[_0x0076('0x82')][_0x0076('0x5c')]({'where':{'id':_0x57bd79[_0x0076('0x5b')][_0x0076('0x63')],'role':_0x0076('0x65')},'attributes':['id',_0x0076('0x3b'),_0x0076('0x73'),'email',_0x0076('0x75')],'raw':!![]});}return null;})[_0x0076('0x37')](function(_0x5583f7){if(!_0x5583f7)return null;_0x1e356e['message']['agent']=_0x5583f7;return _0x1e356e;})[_0x0076('0x37')](function(_0x2b48a8){if(_0x2b48a8){_0x2b48a8[_0x0076('0x28')][_0x0076('0x77')]=util[_0x0076('0x61')](_0x0076('0x83'),_0x57bd79[_0x0076('0x64')][_0x0076('0x3b')]);_0x2b48a8['message'][_0x0076('0x78')]=_0x1e356e['channel'];_0x2b48a8['message'][_0x0076('0x84')]=_0x1e356e[_0x0076('0x78')];_0x2b48a8[_0x0076('0x28')]['event']='reject';respondWithRpcPromise(_0x0076('0x7a'),_0x0076('0x7a'),{'event':_0x0076('0x85'),'message':_0x2b48a8[_0x0076('0x28')]},client9002);return _0x1e356e;}return null;})['then'](respondWithResult(_0x276f79,null))['catch'](handleError(_0x276f79,null));};exports[_0x0076('0x2c')]=function(_0x4fcebe,_0xa15810,_0x33f28f){if(_0x4fcebe[_0x0076('0x5b')]['id']){delete _0x4fcebe[_0x0076('0x5b')]['id'];}var _0x2a8785;return db[_0x0076('0x3f')][_0x0076('0x5c')]({'where':{'id':_0x4fcebe[_0x0076('0x56')]['id']}})[_0x0076('0x37')](handleEntityNotFound(_0xa15810,null))['then'](function(_0x56ae7b){if(_0x56ae7b){_0x2a8785=_0x56ae7b;return db[_0x0076('0x86')][_0x0076('0x5c')]({'where':{'id':_0x56ae7b[_0x0076('0x87')]}});}})[_0x0076('0x37')](handleEntityNotFound(_0xa15810,null))['then'](function(_0x2b9b69){if(_0x2b9b69){logger['debug'](_0x0076('0x24'),'status',_0x0076('0x88'),_0x2b9b69[_0x0076('0x42')],util[_0x0076('0x89')](_0x4fcebe[_0x0076('0x5b')],{'showHidden':![],'depth':null}));switch(_0x2b9b69[_0x0076('0x42')]){case _0x0076('0x8a'):if(_0x4fcebe[_0x0076('0x5b')]['MessageSid']&&_0x4fcebe[_0x0076('0x5b')][_0x0076('0x8b')]===_0x2a8785[_0x0076('0x8c')]){return _0x2a8785['update']({'read':!![]});}else{logger[_0x0076('0x26')](_0x0076('0x8d'),'status',_0x0076('0x8a'),util[_0x0076('0x89')](_0x4fcebe[_0x0076('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x0076('0x8e'):if(_0x4fcebe[_0x0076('0x5b')][_0x0076('0x8f')]&&_0x4fcebe[_0x0076('0x5b')]['MessageUUID']===_0x2a8785[_0x0076('0x8c')]&&_[_0x0076('0x90')](['sent',_0x0076('0x91')],_0x4fcebe[_0x0076('0x5b')][_0x0076('0x92')])>=0x0){return _0x2a8785['update']({'read':!![]});}else{logger[_0x0076('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0076('0x2c'),'plivio',util[_0x0076('0x89')](_0x4fcebe['body'],{'showHidden':![],'depth':null}));}break;case _0x0076('0x93'):var _0x26f11c=_0x4fcebe['body']['results'][0x0];if(_0x26f11c[_0x0076('0x2c')]['groupName']===_0x0076('0x94')){return _0x2a8785[_0x0076('0x36')]({'read':!![]});}else{logger[_0x0076('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0076('0x2c'),_0x0076('0x93'),util['inspect'](_0x4fcebe[_0x0076('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x2a8785;}})[_0x0076('0x37')](respondWithResult(_0xa15810,null))[_0x0076('0x2a')](handleError(_0xa15810,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index bda0506..6fb6d11 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 _0x5e49=['hook','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x17bfea,_0x1be4f8){var _0x130fd0=function(_0x21b6d4){while(--_0x21b6d4){_0x17bfea['push'](_0x17bfea['shift']());}};_0x130fd0(++_0x1be4f8);}(_0x5e49,0x94));var _0x95e4=function(_0x522df5,_0x3364ae){_0x522df5=_0x522df5-0x0;var _0x3fffd4=_0x5e49[_0x522df5];return _0x3fffd4;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x95e4('0x0')](0x0);var events={'afterCreate':_0x95e4('0x1'),'afterUpdate':_0x95e4('0x2'),'afterDestroy':_0x95e4('0x3')};function emitEvent(_0x12dc1f){return function(_0x6829ee,_0x5ee877,_0x1454eb){SmsMessageEvents['emit'](_0x12dc1f+':'+_0x6829ee['id'],_0x6829ee);SmsMessageEvents[_0x95e4('0x4')](_0x12dc1f,_0x6829ee);_0x1454eb(null);};}for(var e in events){if(events[_0x95e4('0x5')](e)){var event=events[e];SmsMessage[_0x95e4('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xd744=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xd744,0x7d));var _0x4d74=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd744[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x4d74('0x0'));var SmsMessage=require(_0x4d74('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4d74('0x2')](0x0);var events={'afterCreate':_0x4d74('0x3'),'afterUpdate':_0x4d74('0x4'),'afterDestroy':_0x4d74('0x5')};function emitEvent(_0x45b20b){return function(_0x5ca05f,_0x4a5a1c,_0x415402){SmsMessageEvents[_0x4d74('0x6')](_0x45b20b+':'+_0x5ca05f['id'],_0x5ca05f);SmsMessageEvents[_0x4d74('0x6')](_0x45b20b,_0x5ca05f);_0x415402(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x4d74('0x7')](e,emitEvent(event));}}module[_0x4d74('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 99c9b03..f58bba4 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 _0x195e=['bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','status','intelepeer','Token\x20not\x20received','finally','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','get','direction','toLowerCase','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','createdAt','error','out','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','phone','remote','/api/sms/messages/','/status?token=','token','sid','update','catch','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','body','smsMethod','sender','login?username=','GET','sms','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','Basic\x20%s','toString','base64','http_code','queued_count','data','message_id','clickSend','plivo','%s:%s','authId','POST','https://api.plivo.com/v1/Account/%s/Message/','infobip','baseUrl','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','keys','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid'];(function(_0x5ef9ea,_0x1ab4e7){var _0x361389=function(_0x39aeb5){while(--_0x39aeb5){_0x5ef9ea['push'](_0x5ef9ea['shift']());}};_0x361389(++_0x1ab4e7);}(_0x195e,0xfb));var _0xe195=function(_0x49109e,_0x28a7aa){_0x49109e=_0x49109e-0x0;var _0x2dbaf7=_0x195e[_0x49109e];return _0x2dbaf7;};'use strict';var _=require(_0xe195('0x0'));var util=require(_0xe195('0x1'));var logger=require(_0xe195('0x2'))(_0xe195('0x3'));var moment=require(_0xe195('0x4'));var BPromise=require(_0xe195('0x5'));var rp=require(_0xe195('0x6'));var fs=require('fs');var path=require(_0xe195('0x7'));var rimraf=require(_0xe195('0x8'));var config=require(_0xe195('0x9'));var attributes=require(_0xe195('0xa'));module[_0xe195('0xb')]=function(_0x11cc55,_0x595c13){return _0x11cc55[_0xe195('0xc')](_0xe195('0xd'),attributes,{'tableName':_0xe195('0xe'),'paranoid':![],'indexes':[{'name':_0xe195('0xf'),'fields':[_0xe195('0xf')]},{'name':'fti_sms_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3bf721,_0x3a7b4e,_0x1d8102){var _0xb606ec=_0x11cc55['models'];var _0x26ab2f=_0x3bf721[_0xe195('0x10')]({'plain':!![]});if(_0x26ab2f[_0xe195('0x11')]['toLowerCase']()==='in'||_0x26ab2f[_0xe195('0x11')][_0xe195('0x12')]()==='out'&&!_0x26ab2f[_0xe195('0x13')]&&!_[_0xe195('0x14')](_0x26ab2f[_0xe195('0x15')])){_0xb606ec[_0xe195('0x16')]['findOne']({'where':{'id':_0x26ab2f[_0xe195('0x17')]}})[_0xe195('0x18')](function(_0x555a6a){if(_0x555a6a){_0x555a6a['update']({'lastMsgAt':_0x26ab2f[_0xe195('0x19')],'lastMsgDirection':_0x26ab2f['direction'][_0xe195('0x12')]()});}})['catch'](function(_0x534879){console[_0xe195('0x1a')](_0x534879);});}if(_0x26ab2f[_0xe195('0x11')]===_0xe195('0x1b')&&!_0x26ab2f[_0xe195('0x13')]){var _0x3a042f;_0xb606ec[_0xe195('0x1c')][_0xe195('0x1d')]({'where':{'id':_0x26ab2f[_0xe195('0x1e')]},'raw':!![]})[_0xe195('0x18')](function(_0x25818c){_0x3a042f=_0x25818c;if(_0x3a042f&&_0x3a042f['type']){switch(_0x3a042f[_0xe195('0x1f')]){case _0xe195('0x20'):var _0xdf735a=require(_0xe195('0x20'));if(_0x3a042f[_0xe195('0x21')]&&_0x3a042f[_0xe195('0x22')]&&_0x3a042f['phone']){var _0x1c5ac8=new _0xdf735a(_0x3a042f[_0xe195('0x21')],_0x3a042f[_0xe195('0x22')]);_0x1c5ac8[_0xe195('0x23')]['create']({'body':_0x26ab2f['body'],'to':_0x26ab2f['phone'],'from':_0x3a042f[_0xe195('0x24')],'statusCallback':_0x3a042f[_0xe195('0x25')]+_0xe195('0x26')+_0x26ab2f['id']+_0xe195('0x27')+_0x3a042f[_0xe195('0x28')]})[_0xe195('0x18')](function(_0x40c6a2){if(_0x40c6a2[_0xe195('0x29')]){return _0x3bf721[_0xe195('0x2a')]({'messageId':_0x40c6a2[_0xe195('0x29')]});}})[_0xe195('0x2b')](function(_0x55be2d){logger[_0xe195('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe195('0x2c'),_0xe195('0x20'),util[_0xe195('0x2d')](_0x55be2d,{'showHidden':![],'depth':null}));});}else{logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x20'),_0xe195('0x2f'));}break;case _0xe195('0x30'):var _0x1f1ca7='https://api.skebby.it/API/v1.0/REST/';if(_0x3a042f[_0xe195('0x31')]&&_0x3a042f[_0xe195('0x32')]){var _0x3199d0={'recipient':[_0x26ab2f[_0xe195('0x24')]],'message':_0x26ab2f[_0xe195('0x33')],'message_type':_0x3a042f['smsMethod']};if(_0x3a042f['smsMethod']&&_0x3a042f[_0xe195('0x34')]!=='SI'){_0x3199d0[_0xe195('0x35')]=_0x3a042f[_0xe195('0x24')];}var _0x8c6186={'url':_0x1f1ca7+_0xe195('0x36')+_0x3a042f[_0xe195('0x31')]+'&password='+_0x3a042f[_0xe195('0x32')],'method':_0xe195('0x37')};rp(_0x8c6186)[_0xe195('0x18')](function(_0x59b3bf){var _0x2b399e=_0x59b3bf['split'](';');var _0xca299f={'user_key':_0x2b399e[0x0],'session_key':_0x2b399e[0x1]};_0x8c6186={'url':_0x1f1ca7+_0xe195('0x38'),'method':'POST','headers':{'user_key':_0xca299f[_0xe195('0x39')],'Session_key':_0xca299f[_0xe195('0x3a')]},'json':!![],'body':_0x3199d0};return rp(_0x8c6186);})[_0xe195('0x18')](function(_0x47d184){if(_0x47d184[_0xe195('0x3b')]>=0x1){var _0x1a57d6={'messageId':_0x47d184[_0xe195('0x3c')]};if(_0x3a042f[_0xe195('0x34')]!=='GP'||!_0x3a042f[_0xe195('0x3d')]){_0x1a57d6[_0xe195('0x3e')]=!![];}return _0x3bf721['update'](_0x1a57d6);}else{return logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x30'),util[_0xe195('0x2d')](_0x47d184,{'showHidden':![],'depth':null}));}})[_0xe195('0x2b')](function(_0x22c79a){return logger['error'](_0xe195('0x2e'),_0xe195('0x2c'),'skebby',util[_0xe195('0x2d')](_0x22c79a,{'showHidden':![],'depth':null}));});}else{logger[_0xe195('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe195('0x2c'),'skebby',_0xe195('0x3f'));}break;case _0xe195('0x40'):if(_0x3a042f[_0xe195('0x22')]){var _0x1714fa={'recipient':_0x26ab2f[_0xe195('0x24')],'message':_0x26ab2f[_0xe195('0x33')],'sender':_0x3a042f['senderString']||_0x3a042f[_0xe195('0x24')],'authorization':_0x3a042f[_0xe195('0x22')]};var _0x3a7b4e={'method':'POST','uri':_0xe195('0x41'),'body':_0x1714fa,'json':!![]};rp(_0x3a7b4e)[_0xe195('0x18')](function(_0x5207e3){var _0x2abd78={'messageId':_0x5207e3[_0xe195('0x42')]};if(!_0x3a042f['deliveryReport']){_0x2abd78[_0xe195('0x3e')]=!![];}return _0x3bf721[_0xe195('0x2a')](_0x2abd78);})[_0xe195('0x2b')](function(_0x57f25f){logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x40'),util[_0xe195('0x2d')](_0x57f25f,{'showHidden':![],'depth':null}));});}else{logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x40'),_0xe195('0x43'));}break;case _0xe195('0x44'):if(_0x3a042f[_0xe195('0x31')]&&_0x3a042f['password']){var _0x1714fa={'messages':[{'source':_0xe195('0x45'),'to':_0x26ab2f[_0xe195('0x24')],'body':_0x26ab2f[_0xe195('0x33')],'from':_0x3a042f[_0xe195('0x46')]||_0x3a042f['phone']}]};var _0x3ebf77=util['format']('%s:%s',_0x3a042f[_0xe195('0x31')],_0x3a042f['password']);var _0x3a7b4e={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x1714fa,'headers':{'Authorization':util[_0xe195('0x47')](_0xe195('0x48'),new Buffer(_0x3ebf77)[_0xe195('0x49')](_0xe195('0x4a')))},'json':!![]};rp(_0x3a7b4e)[_0xe195('0x18')](function(_0x411b0d){if(_0x411b0d[_0xe195('0x4b')]>=0xc8&&_0x411b0d[_0xe195('0x4b')]<=0xce){if(_0x411b0d['data']&&_0x411b0d['data'][_0xe195('0x4c')]>0x0){var _0x1b7e8c=_['head'](_0x411b0d[_0xe195('0x4d')][_0xe195('0x23')]);var _0x106c79={'messageId':_0x1b7e8c[_0xe195('0x4e')]};if(!_0x3a042f[_0xe195('0x3d')]){_0x106c79[_0xe195('0x3e')]=!![];}return _0x3bf721[_0xe195('0x2a')](_0x106c79);}else{logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x4f'),util[_0xe195('0x2d')](_0x411b0d,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x4f'),util[_0xe195('0x2d')](_0x411b0d,{'showHidden':![],'depth':null}));}})[_0xe195('0x2b')](function(_0x289782){logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x4f'),util[_0xe195('0x2d')](_0x289782,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe195('0x2e'),'afterCreate',_0xe195('0x4f'),_0xe195('0x3f'));}break;case _0xe195('0x50'):if(_0x3a042f['authId']&&_0x3a042f['authToken']){var _0x1714fa={'dst':_0x26ab2f[_0xe195('0x24')],'text':_0x26ab2f[_0xe195('0x33')],'src':_0x3a042f[_0xe195('0x46')]||_0x3a042f[_0xe195('0x24')],'url':_0x3a042f[_0xe195('0x25')]+_0xe195('0x26')+_0x26ab2f['id']+_0xe195('0x27')+_0x3a042f[_0xe195('0x28')]};var _0x3ebf77=util[_0xe195('0x47')](_0xe195('0x51'),_0x3a042f[_0xe195('0x52')],_0x3a042f[_0xe195('0x22')]);var _0x3a7b4e={'method':_0xe195('0x53'),'uri':util[_0xe195('0x47')](_0xe195('0x54'),_0x3a042f[_0xe195('0x52')]),'body':_0x1714fa,'headers':{'Authorization':util['format'](_0xe195('0x48'),new Buffer(_0x3ebf77)[_0xe195('0x49')](_0xe195('0x4a')))},'json':!![]};rp(_0x3a7b4e)[_0xe195('0x18')](function(_0x397bd1){var _0x36dc3e={'messageId':_0x397bd1['message_uuid'][0x0]};return _0x3bf721['update'](_0x36dc3e);})[_0xe195('0x2b')](function(_0xe88992){logger[_0xe195('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe195('0x2c'),_0xe195('0x50'),util['inspect'](_0xe88992,{'showHidden':![],'depth':null}));});}else{logger[_0xe195('0x1a')](_0xe195('0x2e'),'afterCreate',_0xe195('0x50'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xe195('0x55'):if(_0x3a042f[_0xe195('0x31')]&&_0x3a042f[_0xe195('0x32')]){if(_0x3a042f[_0xe195('0x56')]){var _0x43b5b2={'method':_0xe195('0x53'),'uri':_0x3a042f[_0xe195('0x56')]+'/auth/1/session','body':{'username':_0x3a042f[_0xe195('0x31')],'password':_0x3a042f[_0xe195('0x32')]},'json':!![]};return rp(_0x43b5b2)[_0xe195('0x18')](function(_0x46719a){var _0x2ff60c={'method':_0xe195('0x53'),'uri':_0x3a042f[_0xe195('0x56')]+_0xe195('0x57'),'body':{'messages':[{'from':_0x3a042f[_0xe195('0x24')],'destinations':[{'to':_0x26ab2f[_0xe195('0x24')]}],'text':_0x26ab2f[_0xe195('0x33')],'notifyUrl':_0x3a042f[_0xe195('0x25')]+_0xe195('0x26')+_0x26ab2f['id']+_0xe195('0x27')+_0x3a042f[_0xe195('0x28')],'notifyContentType':'application/json','callbackData':_0x3a042f[_0xe195('0x24')]+';'+_0x26ab2f[_0xe195('0x33')]}]},'headers':{'Authorization':_0xe195('0x58')+_0x46719a[_0xe195('0x28')]},'json':!![]};return rp(_0x2ff60c)[_0xe195('0x18')](function(_0x564f4a){if(_0x564f4a[_0xe195('0x23')]){var _0x943e1={'messageId':_0x564f4a[_0xe195('0x23')][0x0][_0xe195('0xf')]};if(!_0x3a042f[_0xe195('0x3d')]){_0x943e1[_0xe195('0x3e')]=!![];}return _0x3bf721[_0xe195('0x2a')](_0x943e1);}else{return logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x55'),util[_0xe195('0x2d')](_0x564f4a,{'showHidden':![],'depth':null}));}});})[_0xe195('0x2b')](function(_0x3b204a){return logger['error'](_0xe195('0x2e'),'afterCreate',_0xe195('0x55'),util['inspect'](_0x3b204a,{'showHidden':![],'depth':null}));});}else{logger[_0xe195('0x1a')](_0xe195('0x2e'),'afterCreate','infobip',_0xe195('0x59'));}}else{logger[_0xe195('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe195('0x2c'),_0xe195('0x55'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xe195('0x5a'):var _0x6a16ab=require(_0xe195('0x5b'));if(_0x3a042f[_0xe195('0x5c')]){var _0x59a266={};_0x59a266['login']=_0x3a042f['username'];_0x59a266[_0xe195('0x24')]=_0x26ab2f['phone'];_0x59a266['sender']=_0x3a042f[_0xe195('0x24')];_0x59a266[_0xe195('0x5d')]=_0x26ab2f[_0xe195('0x33')];_0x59a266['timestamp']=+new Date();var _0x48f7db='';var _0x184efe='';var _0x46f1a2=Object[_0xe195('0x5e')](_0x59a266);_0x46f1a2['sort']();for(var _0x20dca8=0x0;_0x20dca8<_0x46f1a2[_0xe195('0x5f')];_0x20dca8++){if(_0x48f7db!=''){_0x48f7db+='&';}_0x48f7db+=_0x46f1a2[_0x20dca8]+'='+encodeURIComponent(_0x59a266[_0x46f1a2[_0x20dca8]]);_0x184efe+=_0x59a266[_0x46f1a2[_0x20dca8]];}_0x184efe+=_0x3a042f[_0xe195('0x5c')];_0x184efe=_0x6a16ab[_0xe195('0x60')](_0xe195('0x61'))[_0xe195('0x2a')](_0x184efe)[_0xe195('0x62')](_0xe195('0x63'));if(_0x48f7db!==''){_0x48f7db+='&';}_0x48f7db+=_0xe195('0x64')+_0x184efe;var _0x8c6186={'method':'GET','uri':_0x3a042f[_0xe195('0x56')]+_0xe195('0x65')+_0x48f7db,'json':!![]};return rp(_0x8c6186)[_0xe195('0x18')](function(_0x8c1a4a){var _0x50c4e1=Object[_0xe195('0x5e')](_0x8c1a4a);if(_0x8c1a4a[_0x50c4e1[0x0]][_0xe195('0x1a')]&&parseInt(_0x8c1a4a[_0x50c4e1[0x0]][_0xe195('0x1a')])===0x0){var _0x14ba3c={'messageId':_0x8c1a4a[_0x50c4e1[0x0]][_0xe195('0x66')]};if(!_0x3a042f[_0xe195('0x3d')]){_0x14ba3c[_0xe195('0x3e')]=!![];}return _0x3bf721['update'](_0x14ba3c);}else{return logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x5a'),util['inspect'](_0x8c1a4a['error'],{'showHidden':![],'depth':null}));}})[_0xe195('0x2b')](function(_0x366cb5){return logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x5a'),util['inspect'](_0x366cb5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x5a'),_0xe195('0x67'));}break;case _0xe195('0x68'):if(_0x3a042f[_0xe195('0x5c')]){var _0x1aac2b={'method':_0xe195('0x53'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3a042f[_0xe195('0x5c')]},'body':{'content':_0x26ab2f[_0xe195('0x33')],'to':[_0x26ab2f[_0xe195('0x24')]],'from':_0x3a042f[_0xe195('0x24')],'binary':![],'clientMessageId':_0xe195('0x69'),'charset':'UTF-8'},'json':!![]};rp(_0x1aac2b)[_0xe195('0x18')](function(_0x314896){if(!_0x314896['error']){var _0x120e9e={'messageId':_0x314896[_0xe195('0x23')][0x0]['apiMessageId']};if(!_0x3a042f[_0xe195('0x3d')]){_0x120e9e[_0xe195('0x3e')]=!![];}return _0x3bf721['update'](_0x120e9e);}else{return logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),_0xe195('0x68'),util[_0xe195('0x2d')](_0x314896[_0xe195('0x1a')],{'showHidden':![],'depth':null}));}})[_0xe195('0x2b')](function(_0x371db2){return logger[_0xe195('0x1a')](_0xe195('0x2e'),'afterCreate',_0xe195('0x68'),util['inspect'](_0x371db2,{'showHidden':![],'depth':null}));});}else{logger[_0xe195('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe195('0x68'),_0xe195('0x67'));}break;case _0xe195('0x6a'):if(_0x3a042f['username']&&_0x3a042f[_0xe195('0x32')]){var _0x3ebf77=util[_0xe195('0x47')](_0xe195('0x51'),_0x3a042f[_0xe195('0x31')],_0x3a042f[_0xe195('0x32')]);var _0x3a7b4e={'method':_0xe195('0x53'),'uri':_0xe195('0x6b')+_0x3a042f[_0xe195('0x6c')]+_0xe195('0x6d'),'body':{'to':[_0x26ab2f[_0xe195('0x24')]],'text':_0x26ab2f['body'],'from':_0x3a042f[_0xe195('0x24')],'applicationId':_0x3a042f['applicationId']},'headers':{'Authorization':util[_0xe195('0x47')](_0xe195('0x48'),new Buffer(_0x3ebf77)[_0xe195('0x49')](_0xe195('0x4a')))},'json':!![]};rp(_0x3a7b4e)[_0xe195('0x18')](function(_0x35819b){if(_0x35819b['id']){var _0x3a5f1c={'messageId':_0x35819b['id']};return _0x3bf721[_0xe195('0x2a')](_0x3a5f1c);}else{logger[_0xe195('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe195('0x2c'),_0xe195('0x6a'),util[_0xe195('0x2d')](_0x35819b,{'showHidden':![],'depth':null}));}})[_0xe195('0x2b')](function(_0xdeef1d){logger[_0xe195('0x1a')](_0xe195('0x2e'),_0xe195('0x2c'),'bandwidth',util[_0xe195('0x2d')](_0xdeef1d,{'showHidden':![],'depth':null}));});}else{logger[_0xe195('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe195('0x2c'),'bandwidth',_0xe195('0x3f'));}break;case'intelepeer':if(_0x3a042f[_0xe195('0x5c')]){var _0x5319f6={};var _0x8c6186={'method':_0xe195('0x53'),'uri':_0xe195('0x6e'),'headers':{'Authorization':_0xe195('0x6f')+_0x3a042f['apiKey'],'Content-Type':_0xe195('0x70')},'body':{'from':_0x3a042f[_0xe195('0x24')],'to':_0x26ab2f[_0xe195('0x24')],'text':_0x26ab2f[_0xe195('0x33')]},'json':!![]};return rp(_0x8c6186)[_0xe195('0x18')](function(_0x37fbb9){if(_0x37fbb9[_0xe195('0x71')]==0xca){_0x5319f6[_0xe195('0x72')]=_0x37fbb9;var _0x33d278={'method':_0xe195('0x53'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x3a042f[_0xe195('0x5c')],'Content-Type':'application/json'},'body':{'refid':_0x5319f6[_0xe195('0x72')]['refid']},'json':!![]};return rp(_0x33d278)[_0xe195('0x18')](function(_0x45806b){_0x5319f6[_0xe195('0x73')]=_0x45806b;var _0x35da17={'messageId':_0x5319f6[_0xe195('0x72')]['refid'],'read':!![]};return _0x3bf721[_0xe195('0x2a')](_0x35da17);});}else{return logger[_0xe195('0x1a')](_0xe195('0x2e'),'afterCreate',_0xe195('0x74'),util[_0xe195('0x2d')](_0x37fbb9,{'showHidden':![],'depth':null}));}})[_0xe195('0x2b')](function(_0x1a3411){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe195('0x2c'),'intelepeer',util[_0xe195('0x2d')](_0x1a3411,{'showHidden':![],'depth':null}));});}else{return logger[_0xe195('0x1a')](_0xe195('0x2e'),'afterCreate',_0xe195('0x74'),_0xe195('0x75'));}break;}}})[_0xe195('0x76')](function(){_0x1d8102();});}else{_0x1d8102();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3fb7=['status','Token\x20not\x20received','utf8mb4_unicode_ci','util','api','moment','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','toLowerCase','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','create','/api/sms/messages/','/status?token=','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','token','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','md5','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid'];(function(_0x547e20,_0x284545){var _0x359171=function(_0x590250){while(--_0x590250){_0x547e20['push'](_0x547e20['shift']());}};_0x359171(++_0x284545);}(_0x3fb7,0x189));var _0x73fb=function(_0x273303,_0x4621be){_0x273303=_0x273303-0x0;var _0x35b662=_0x3fb7[_0x273303];return _0x35b662;};'use strict';var _=require('lodash');var util=require(_0x73fb('0x0'));var logger=require('../../config/logger')(_0x73fb('0x1'));var moment=require(_0x73fb('0x2'));var BPromise=require('bluebird');var rp=require(_0x73fb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73fb('0x4'));var config=require(_0x73fb('0x5'));var attributes=require(_0x73fb('0x6'));module[_0x73fb('0x7')]=function(_0x3330e3,_0x423496){return _0x3330e3[_0x73fb('0x8')](_0x73fb('0x9'),attributes,{'tableName':_0x73fb('0xa'),'paranoid':![],'indexes':[{'name':_0x73fb('0xb'),'fields':[_0x73fb('0xb')]},{'name':_0x73fb('0xc'),'fields':[_0x73fb('0xd')],'type':_0x73fb('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x435d63,_0x419445,_0x3652cd){var _0x1052e1=_0x3330e3[_0x73fb('0xf')];var _0x1131cc=_0x435d63[_0x73fb('0x10')]({'plain':!![]});if(_0x1131cc[_0x73fb('0x11')]['toLowerCase']()==='in'||_0x1131cc[_0x73fb('0x11')]['toLowerCase']()===_0x73fb('0x12')&&!_0x1131cc[_0x73fb('0x13')]&&!_[_0x73fb('0x14')](_0x1131cc[_0x73fb('0x15')])){_0x1052e1[_0x73fb('0x16')][_0x73fb('0x17')]({'where':{'id':_0x1131cc[_0x73fb('0x18')]}})[_0x73fb('0x19')](function(_0x743f1a){if(_0x743f1a){_0x743f1a[_0x73fb('0x1a')]({'lastMsgAt':_0x1131cc[_0x73fb('0x1b')],'lastMsgDirection':_0x1131cc[_0x73fb('0x11')][_0x73fb('0x1c')]()});}})['catch'](function(_0x1f679b){console['error'](_0x1f679b);});}if(_0x1131cc['direction']===_0x73fb('0x12')&&!_0x1131cc[_0x73fb('0x13')]){var _0x4f4dda;_0x1052e1[_0x73fb('0x1d')][_0x73fb('0x1e')]({'where':{'id':_0x1131cc[_0x73fb('0x1f')]},'raw':!![]})[_0x73fb('0x19')](function(_0x4ee169){_0x4f4dda=_0x4ee169;if(_0x4f4dda&&_0x4f4dda['type']){switch(_0x4f4dda[_0x73fb('0x20')]){case _0x73fb('0x21'):var _0x338687=require('twilio');if(_0x4f4dda[_0x73fb('0x22')]&&_0x4f4dda[_0x73fb('0x23')]&&_0x4f4dda[_0x73fb('0x24')]){var _0x41b334=new _0x338687(_0x4f4dda[_0x73fb('0x22')],_0x4f4dda[_0x73fb('0x23')]);_0x41b334['messages'][_0x73fb('0x25')]({'body':_0x1131cc[_0x73fb('0xd')],'to':_0x1131cc[_0x73fb('0x24')],'from':_0x4f4dda['phone'],'statusCallback':_0x4f4dda['remote']+_0x73fb('0x26')+_0x1131cc['id']+_0x73fb('0x27')+_0x4f4dda['token']})[_0x73fb('0x19')](function(_0x12c139){if(_0x12c139[_0x73fb('0x28')]){return _0x435d63[_0x73fb('0x1a')]({'messageId':_0x12c139[_0x73fb('0x28')]});}})[_0x73fb('0x29')](function(_0x801c4d){logger[_0x73fb('0x2a')](_0x73fb('0x2b'),'afterCreate','twilio',util[_0x73fb('0x2c')](_0x801c4d,{'showHidden':![],'depth':null}));});}else{logger[_0x73fb('0x2a')](_0x73fb('0x2b'),_0x73fb('0x2d'),_0x73fb('0x21'),_0x73fb('0x2e'));}break;case _0x73fb('0x2f'):var _0x529fcc=_0x73fb('0x30');if(_0x4f4dda[_0x73fb('0x31')]&&_0x4f4dda[_0x73fb('0x32')]){var _0x46034e={'recipient':[_0x1131cc[_0x73fb('0x24')]],'message':_0x1131cc[_0x73fb('0xd')],'message_type':_0x4f4dda[_0x73fb('0x33')]};if(_0x4f4dda[_0x73fb('0x33')]&&_0x4f4dda['smsMethod']!=='SI'){_0x46034e[_0x73fb('0x34')]=_0x4f4dda[_0x73fb('0x24')];}var _0x219ba2={'url':_0x529fcc+'login?username='+_0x4f4dda[_0x73fb('0x31')]+_0x73fb('0x35')+_0x4f4dda[_0x73fb('0x32')],'method':_0x73fb('0x36')};rp(_0x219ba2)[_0x73fb('0x19')](function(_0x47fbf0){var _0x87c631=_0x47fbf0[_0x73fb('0x37')](';');var _0xf396df={'user_key':_0x87c631[0x0],'session_key':_0x87c631[0x1]};_0x219ba2={'url':_0x529fcc+_0x73fb('0x38'),'method':_0x73fb('0x39'),'headers':{'user_key':_0xf396df[_0x73fb('0x3a')],'Session_key':_0xf396df[_0x73fb('0x3b')]},'json':!![],'body':_0x46034e};return rp(_0x219ba2);})[_0x73fb('0x19')](function(_0x9d1fd3){if(_0x9d1fd3[_0x73fb('0x3c')]>=0x1){var _0x4d57fb={'messageId':_0x9d1fd3[_0x73fb('0x3d')]};if(_0x4f4dda[_0x73fb('0x33')]!=='GP'||!_0x4f4dda[_0x73fb('0x3e')]){_0x4d57fb[_0x73fb('0x3f')]=!![];}return _0x435d63[_0x73fb('0x1a')](_0x4d57fb);}else{return logger['error'](_0x73fb('0x2b'),_0x73fb('0x2d'),'skebby',util[_0x73fb('0x2c')](_0x9d1fd3,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2dd41a){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x73fb('0x2d'),_0x73fb('0x2f'),util[_0x73fb('0x2c')](_0x2dd41a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x73fb('0x2b'),_0x73fb('0x2d'),_0x73fb('0x2f'),_0x73fb('0x40'));}break;case _0x73fb('0x41'):if(_0x4f4dda[_0x73fb('0x23')]){var _0x68d1a1={'recipient':_0x1131cc['phone'],'message':_0x1131cc[_0x73fb('0xd')],'sender':_0x4f4dda[_0x73fb('0x42')]||_0x4f4dda[_0x73fb('0x24')],'authorization':_0x4f4dda[_0x73fb('0x23')]};var _0x419445={'method':_0x73fb('0x39'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x68d1a1,'json':!![]};rp(_0x419445)[_0x73fb('0x19')](function(_0x4ec4e7){var _0x1fe37c={'messageId':_0x4ec4e7[_0x73fb('0x43')]};if(!_0x4f4dda[_0x73fb('0x3e')]){_0x1fe37c['read']=!![];}return _0x435d63[_0x73fb('0x1a')](_0x1fe37c);})[_0x73fb('0x29')](function(_0x5e20a4){logger[_0x73fb('0x2a')](_0x73fb('0x2b'),_0x73fb('0x2d'),_0x73fb('0x41'),util[_0x73fb('0x2c')](_0x5e20a4,{'showHidden':![],'depth':null}));});}else{logger[_0x73fb('0x2a')](_0x73fb('0x2b'),_0x73fb('0x2d'),_0x73fb('0x41'),_0x73fb('0x44'));}break;case _0x73fb('0x45'):if(_0x4f4dda[_0x73fb('0x31')]&&_0x4f4dda['password']){var _0x68d1a1={'messages':[{'source':_0x73fb('0x46'),'to':_0x1131cc['phone'],'body':_0x1131cc[_0x73fb('0xd')],'from':_0x4f4dda[_0x73fb('0x42')]||_0x4f4dda[_0x73fb('0x24')]}]};var _0x2c1f46=util[_0x73fb('0x47')](_0x73fb('0x48'),_0x4f4dda[_0x73fb('0x31')],_0x4f4dda[_0x73fb('0x32')]);var _0x419445={'method':_0x73fb('0x39'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x68d1a1,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x2c1f46)[_0x73fb('0x49')]('base64'))},'json':!![]};rp(_0x419445)[_0x73fb('0x19')](function(_0x3b3ca4){if(_0x3b3ca4[_0x73fb('0x4a')]>=0xc8&&_0x3b3ca4['http_code']<=0xce){if(_0x3b3ca4[_0x73fb('0x4b')]&&_0x3b3ca4[_0x73fb('0x4b')][_0x73fb('0x4c')]>0x0){var _0x583eb8=_[_0x73fb('0x4d')](_0x3b3ca4[_0x73fb('0x4b')]['messages']);var _0x14976f={'messageId':_0x583eb8[_0x73fb('0x4e')]};if(!_0x4f4dda['deliveryReport']){_0x14976f[_0x73fb('0x3f')]=!![];}return _0x435d63[_0x73fb('0x1a')](_0x14976f);}else{logger[_0x73fb('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x73fb('0x2d'),'clickSend',util[_0x73fb('0x2c')](_0x3b3ca4,{'showHidden':![],'depth':null}));}}else{logger[_0x73fb('0x2a')](_0x73fb('0x2b'),'afterCreate',_0x73fb('0x4f'),util[_0x73fb('0x2c')](_0x3b3ca4,{'showHidden':![],'depth':null}));}})[_0x73fb('0x29')](function(_0x41afcb){logger[_0x73fb('0x2a')](_0x73fb('0x2b'),_0x73fb('0x2d'),_0x73fb('0x4f'),util[_0x73fb('0x2c')](_0x41afcb,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x73fb('0x2d'),_0x73fb('0x4f'),_0x73fb('0x40'));}break;case _0x73fb('0x50'):if(_0x4f4dda[_0x73fb('0x51')]&&_0x4f4dda['authToken']){var _0x68d1a1={'dst':_0x1131cc[_0x73fb('0x24')],'text':_0x1131cc[_0x73fb('0xd')],'src':_0x4f4dda[_0x73fb('0x42')]||_0x4f4dda[_0x73fb('0x24')],'url':_0x4f4dda[_0x73fb('0x52')]+_0x73fb('0x26')+_0x1131cc['id']+_0x73fb('0x27')+_0x4f4dda['token']};var _0x2c1f46=util['format'](_0x73fb('0x48'),_0x4f4dda[_0x73fb('0x51')],_0x4f4dda['authToken']);var _0x419445={'method':'POST','uri':util[_0x73fb('0x47')](_0x73fb('0x53'),_0x4f4dda[_0x73fb('0x51')]),'body':_0x68d1a1,'headers':{'Authorization':util[_0x73fb('0x47')](_0x73fb('0x54'),new Buffer(_0x2c1f46)[_0x73fb('0x49')](_0x73fb('0x55')))},'json':!![]};rp(_0x419445)[_0x73fb('0x19')](function(_0xee7452){var _0x2c716b={'messageId':_0xee7452[_0x73fb('0x56')][0x0]};return _0x435d63[_0x73fb('0x1a')](_0x2c716b);})['catch'](function(_0x18a9c6){logger['error'](_0x73fb('0x2b'),_0x73fb('0x2d'),'plivo',util[_0x73fb('0x2c')](_0x18a9c6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x73fb('0x2b'),_0x73fb('0x2d'),_0x73fb('0x50'),_0x73fb('0x57'));}break;case _0x73fb('0x58'):if(_0x4f4dda[_0x73fb('0x31')]&&_0x4f4dda[_0x73fb('0x32')]){if(_0x4f4dda[_0x73fb('0x59')]){var _0x376daf={'method':_0x73fb('0x39'),'uri':_0x4f4dda[_0x73fb('0x59')]+_0x73fb('0x5a'),'body':{'username':_0x4f4dda[_0x73fb('0x31')],'password':_0x4f4dda['password']},'json':!![]};return rp(_0x376daf)[_0x73fb('0x19')](function(_0x4d9330){var _0x411040={'method':_0x73fb('0x39'),'uri':_0x4f4dda[_0x73fb('0x59')]+_0x73fb('0x5b'),'body':{'messages':[{'from':_0x4f4dda['phone'],'destinations':[{'to':_0x1131cc[_0x73fb('0x24')]}],'text':_0x1131cc[_0x73fb('0xd')],'notifyUrl':_0x4f4dda[_0x73fb('0x52')]+_0x73fb('0x26')+_0x1131cc['id']+'/status?token='+_0x4f4dda[_0x73fb('0x5c')],'notifyContentType':_0x73fb('0x5d'),'callbackData':_0x4f4dda[_0x73fb('0x24')]+';'+_0x1131cc['body']}]},'headers':{'Authorization':_0x73fb('0x5e')+_0x4d9330[_0x73fb('0x5c')]},'json':!![]};return rp(_0x411040)[_0x73fb('0x19')](function(_0x57640d){if(_0x57640d[_0x73fb('0x5f')]){var _0x1e6267={'messageId':_0x57640d[_0x73fb('0x5f')][0x0][_0x73fb('0xb')]};if(!_0x4f4dda[_0x73fb('0x3e')]){_0x1e6267['read']=!![];}return _0x435d63['update'](_0x1e6267);}else{return logger['error'](_0x73fb('0x2b'),_0x73fb('0x2d'),_0x73fb('0x58'),util[_0x73fb('0x2c')](_0x57640d,{'showHidden':![],'depth':null}));}});})[_0x73fb('0x29')](function(_0x25f6b7){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x73fb('0x2d'),'infobip',util['inspect'](_0x25f6b7,{'showHidden':![],'depth':null}));});}else{logger[_0x73fb('0x2a')](_0x73fb('0x2b'),_0x73fb('0x2d'),'infobip',_0x73fb('0x60'));}}else{logger[_0x73fb('0x2a')](_0x73fb('0x2b'),'afterCreate',_0x73fb('0x58'),_0x73fb('0x40'));}break;case _0x73fb('0x61'):var _0x3aa418=require(_0x73fb('0x62'));if(_0x4f4dda[_0x73fb('0x63')]){var _0x36ac6a={};_0x36ac6a[_0x73fb('0x64')]=_0x4f4dda['username'];_0x36ac6a[_0x73fb('0x24')]=_0x1131cc[_0x73fb('0x24')];_0x36ac6a['sender']=_0x4f4dda[_0x73fb('0x24')];_0x36ac6a[_0x73fb('0x65')]=_0x1131cc[_0x73fb('0xd')];_0x36ac6a[_0x73fb('0x66')]=+new Date();var _0x4472ee='';var _0x345560='';var _0xaa16d0=Object[_0x73fb('0x67')](_0x36ac6a);_0xaa16d0[_0x73fb('0x68')]();for(var _0x397f07=0x0;_0x397f07<_0xaa16d0[_0x73fb('0x69')];_0x397f07++){if(_0x4472ee!=''){_0x4472ee+='&';}_0x4472ee+=_0xaa16d0[_0x397f07]+'='+encodeURIComponent(_0x36ac6a[_0xaa16d0[_0x397f07]]);_0x345560+=_0x36ac6a[_0xaa16d0[_0x397f07]];}_0x345560+=_0x4f4dda['apiKey'];_0x345560=_0x3aa418['createHash'](_0x73fb('0x6a'))[_0x73fb('0x1a')](_0x345560)[_0x73fb('0x6b')](_0x73fb('0x6c'));if(_0x4472ee!==''){_0x4472ee+='&';}_0x4472ee+=_0x73fb('0x6d')+_0x345560;var _0x219ba2={'method':_0x73fb('0x36'),'uri':_0x4f4dda[_0x73fb('0x59')]+'/external/get/send.php?'+_0x4472ee,'json':!![]};return rp(_0x219ba2)[_0x73fb('0x19')](function(_0x454641){var _0x552942=Object[_0x73fb('0x67')](_0x454641);if(_0x454641[_0x552942[0x0]][_0x73fb('0x2a')]&&parseInt(_0x454641[_0x552942[0x0]][_0x73fb('0x2a')])===0x0){var _0x5be28a={'messageId':_0x454641[_0x552942[0x0]][_0x73fb('0x6e')]};if(!_0x4f4dda[_0x73fb('0x3e')]){_0x5be28a['read']=!![];}return _0x435d63[_0x73fb('0x1a')](_0x5be28a);}else{return logger[_0x73fb('0x2a')](_0x73fb('0x2b'),_0x73fb('0x2d'),'csc',util['inspect'](_0x454641[_0x73fb('0x2a')],{'showHidden':![],'depth':null}));}})[_0x73fb('0x29')](function(_0x474e5d){return logger[_0x73fb('0x2a')](_0x73fb('0x2b'),'afterCreate','csc',util[_0x73fb('0x2c')](_0x474e5d,{'showHidden':![],'depth':null}));});}else{logger[_0x73fb('0x2a')](_0x73fb('0x2b'),_0x73fb('0x2d'),_0x73fb('0x61'),_0x73fb('0x6f'));}break;case _0x73fb('0x70'):if(_0x4f4dda[_0x73fb('0x63')]){var _0x3e20cf={'method':'POST','uri':_0x73fb('0x71'),'headers':{'Authorization':_0x4f4dda[_0x73fb('0x63')]},'body':{'content':_0x1131cc['body'],'to':[_0x1131cc[_0x73fb('0x24')]],'from':_0x4f4dda['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x73fb('0x72')},'json':!![]};rp(_0x3e20cf)['then'](function(_0x30a208){if(!_0x30a208[_0x73fb('0x2a')]){var _0x3eef61={'messageId':_0x30a208[_0x73fb('0x5f')][0x0][_0x73fb('0x73')]};if(!_0x4f4dda[_0x73fb('0x3e')]){_0x3eef61[_0x73fb('0x3f')]=!![];}return _0x435d63[_0x73fb('0x1a')](_0x3eef61);}else{return logger['error'](_0x73fb('0x2b'),_0x73fb('0x2d'),_0x73fb('0x70'),util[_0x73fb('0x2c')](_0x30a208[_0x73fb('0x2a')],{'showHidden':![],'depth':null}));}})[_0x73fb('0x29')](function(_0x1e188e){return logger['error'](_0x73fb('0x2b'),_0x73fb('0x2d'),_0x73fb('0x70'),util[_0x73fb('0x2c')](_0x1e188e,{'showHidden':![],'depth':null}));});}else{logger[_0x73fb('0x2a')](_0x73fb('0x2b'),'afterCreate',_0x73fb('0x70'),_0x73fb('0x6f'));}break;case _0x73fb('0x74'):if(_0x4f4dda[_0x73fb('0x31')]&&_0x4f4dda['password']){var _0x2c1f46=util[_0x73fb('0x47')](_0x73fb('0x48'),_0x4f4dda['username'],_0x4f4dda[_0x73fb('0x32')]);var _0x419445={'method':_0x73fb('0x39'),'uri':_0x73fb('0x75')+_0x4f4dda[_0x73fb('0x76')]+_0x73fb('0x77'),'body':{'to':[_0x1131cc[_0x73fb('0x24')]],'text':_0x1131cc[_0x73fb('0xd')],'from':_0x4f4dda[_0x73fb('0x24')],'applicationId':_0x4f4dda[_0x73fb('0x78')]},'headers':{'Authorization':util[_0x73fb('0x47')](_0x73fb('0x54'),new Buffer(_0x2c1f46)[_0x73fb('0x49')](_0x73fb('0x55')))},'json':!![]};rp(_0x419445)['then'](function(_0x2b3039){if(_0x2b3039['id']){var _0x3bfabb={'messageId':_0x2b3039['id']};return _0x435d63[_0x73fb('0x1a')](_0x3bfabb);}else{logger[_0x73fb('0x2a')](_0x73fb('0x2b'),_0x73fb('0x2d'),_0x73fb('0x74'),util['inspect'](_0x2b3039,{'showHidden':![],'depth':null}));}})[_0x73fb('0x29')](function(_0x5eaa1f){logger[_0x73fb('0x2a')](_0x73fb('0x2b'),'afterCreate',_0x73fb('0x74'),util[_0x73fb('0x2c')](_0x5eaa1f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x73fb('0x2b'),_0x73fb('0x2d'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x73fb('0x79'):if(_0x4f4dda[_0x73fb('0x63')]){var _0x450811={};var _0x219ba2={'method':_0x73fb('0x39'),'uri':_0x73fb('0x7a'),'headers':{'Authorization':_0x73fb('0x7b')+_0x4f4dda[_0x73fb('0x63')],'Content-Type':'application/json'},'body':{'from':_0x4f4dda[_0x73fb('0x24')],'to':_0x1131cc[_0x73fb('0x24')],'text':_0x1131cc['body']},'json':!![]};return rp(_0x219ba2)[_0x73fb('0x19')](function(_0x1f2494){if(_0x1f2494[_0x73fb('0x7c')]==0xca){_0x450811['message']=_0x1f2494;var _0x4d2b25={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x73fb('0x7b')+_0x4f4dda[_0x73fb('0x63')],'Content-Type':'application/json'},'body':{'refid':_0x450811[_0x73fb('0x7d')][_0x73fb('0x7e')]},'json':!![]};return rp(_0x4d2b25)['then'](function(_0xe98907){_0x450811[_0x73fb('0x7f')]=_0xe98907;var _0x2f7543={'messageId':_0x450811[_0x73fb('0x7d')]['refid'],'read':!![]};return _0x435d63[_0x73fb('0x1a')](_0x2f7543);});}else{return logger[_0x73fb('0x2a')](_0x73fb('0x2b'),'afterCreate',_0x73fb('0x79'),util['inspect'](_0x1f2494,{'showHidden':![],'depth':null}));}})['catch'](function(_0x44b4b9){return logger[_0x73fb('0x2a')](_0x73fb('0x2b'),_0x73fb('0x2d'),_0x73fb('0x79'),util[_0x73fb('0x2c')](_0x44b4b9,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x73fb('0x2b'),_0x73fb('0x2d'),'intelepeer',_0x73fb('0x80'));}break;}}})['finally'](function(){_0x3652cd();});}else{_0x3652cd();}}},'charset':'utf8mb4','collate':_0x73fb('0x81')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 90f1526..fbc73bd 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 _0xb110=['localhost','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0xb110,0xe7));var _0x0b11=function(_0x4a232,_0x1e0ad8){_0x4a232=_0x4a232-0x0;var _0x4fc120=_0xb110[_0x4a232];return _0x4fc120;};'use strict';var _=require(_0x0b11('0x0'));var util=require(_0x0b11('0x1'));var moment=require(_0x0b11('0x2'));var BPromise=require(_0x0b11('0x3'));var rs=require(_0x0b11('0x4'));var fs=require('fs');var Redis=require(_0x0b11('0x5'));var db=require(_0x0b11('0x6'))['db'];var utils=require(_0x0b11('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0b11('0x8'));var jayson=require(_0x0b11('0x9'));var client=jayson[_0x0b11('0xa')][_0x0b11('0xb')]({'port':0x232a});config[_0x0b11('0xc')]=_[_0x0b11('0xd')](config[_0x0b11('0xc')],{'host':_0x0b11('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0b11('0xc')]));require('./smsMessage.socket')[_0x0b11('0xf')](socket);function respondWithRpcPromise(_0xd716ec,_0x2a13a3,_0x3f6f30){return new BPromise(function(_0x339840,_0x44189a){return client[_0x0b11('0x10')](_0xd716ec,_0x3f6f30)[_0x0b11('0x11')](function(_0x2dd237){logger['info'](_0x0b11('0x12'),_0x2a13a3,_0x0b11('0x13'));logger[_0x0b11('0x14')](_0x0b11('0x15'),_0x2a13a3,_0x0b11('0x13'),JSON[_0x0b11('0x16')](_0x2dd237));if(_0x2dd237[_0x0b11('0x17')]){if(_0x2dd237[_0x0b11('0x17')][_0x0b11('0x18')]===0x1f4){logger[_0x0b11('0x17')](_0x0b11('0x12'),_0x2a13a3,_0x2dd237[_0x0b11('0x17')][_0x0b11('0x19')]);return _0x44189a(_0x2dd237['error']['message']);}logger[_0x0b11('0x17')](_0x0b11('0x12'),_0x2a13a3,_0x2dd237['error'][_0x0b11('0x19')]);return _0x339840(_0x2dd237[_0x0b11('0x17')]['message']);}else{logger[_0x0b11('0x1a')](_0x0b11('0x12'),_0x2a13a3,_0x0b11('0x13'));_0x339840(_0x2dd237[_0x0b11('0x1b')][_0x0b11('0x19')]);}})[_0x0b11('0x1c')](function(_0xa4d14e){logger[_0x0b11('0x17')](_0x0b11('0x12'),_0x2a13a3,_0xa4d14e);_0x44189a(_0xa4d14e);});});}exports[_0x0b11('0x1d')]=function(_0x4556d2){var _0xc0c8c4=this;return new Promise(function(_0x5e081b,_0x54e7e2){return db[_0x0b11('0x1e')][_0x0b11('0x1f')](_0x4556d2[_0x0b11('0x20')],{'raw':_0x4556d2['options']?_0x4556d2[_0x0b11('0x21')][_0x0b11('0x22')]===undefined?!![]:![]:!![]})[_0x0b11('0x11')](function(_0x3df0cf){logger[_0x0b11('0x1a')](_0x0b11('0x1d'),_0x4556d2);logger[_0x0b11('0x14')](_0x0b11('0x1d'),_0x4556d2,JSON[_0x0b11('0x16')](_0x3df0cf));_0x5e081b(_0x3df0cf);})[_0x0b11('0x1c')](function(_0x4e6f04){logger['error'](_0x0b11('0x1d'),_0x4e6f04[_0x0b11('0x19')],_0x4556d2);_0x54e7e2(_0xc0c8c4[_0x0b11('0x17')](0x1f4,_0x4e6f04[_0x0b11('0x19')]));});});}; \ No newline at end of file +var _0x381c=['socket.io-emitter','./smsMessage.socket','register','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','CreateSmsMessage','SmsMessage','body','options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x381c,0x129));var _0xc381=function(_0x4bb3ed,_0x3b38f5){_0x4bb3ed=_0x4bb3ed-0x0;var _0x1064d4=_0x381c[_0x4bb3ed];return _0x1064d4;};'use strict';var _=require(_0xc381('0x0'));var util=require('util');var moment=require(_0xc381('0x1'));var BPromise=require(_0xc381('0x2'));var rs=require(_0xc381('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc381('0x4'))['db'];var utils=require(_0xc381('0x5'));var logger=require(_0xc381('0x6'))(_0xc381('0x7'));var config=require(_0xc381('0x8'));var jayson=require(_0xc381('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xc381('0xa')]=_[_0xc381('0xb')](config[_0xc381('0xa')],{'host':_0xc381('0xc'),'port':0x18eb});var socket=require(_0xc381('0xd'))(new Redis(config[_0xc381('0xa')]));require(_0xc381('0xe'))[_0xc381('0xf')](socket);function respondWithRpcPromise(_0x22ee22,_0x5e80f8,_0x3824c2){return new BPromise(function(_0x44e517,_0x11a543){return client['request'](_0x22ee22,_0x3824c2)[_0xc381('0x10')](function(_0x3bd012){logger[_0xc381('0x11')](_0xc381('0x12'),_0x5e80f8,_0xc381('0x13'));logger[_0xc381('0x14')](_0xc381('0x15'),_0x5e80f8,_0xc381('0x13'),JSON[_0xc381('0x16')](_0x3bd012));if(_0x3bd012['error']){if(_0x3bd012['error'][_0xc381('0x17')]===0x1f4){logger['error'](_0xc381('0x12'),_0x5e80f8,_0x3bd012[_0xc381('0x18')][_0xc381('0x19')]);return _0x11a543(_0x3bd012[_0xc381('0x18')][_0xc381('0x19')]);}logger[_0xc381('0x18')]('SmsMessage,\x20%s,\x20%s',_0x5e80f8,_0x3bd012[_0xc381('0x18')]['message']);return _0x44e517(_0x3bd012[_0xc381('0x18')]['message']);}else{logger['info'](_0xc381('0x12'),_0x5e80f8,_0xc381('0x13'));_0x44e517(_0x3bd012[_0xc381('0x1a')][_0xc381('0x19')]);}})['catch'](function(_0x4fa34a){logger[_0xc381('0x18')](_0xc381('0x12'),_0x5e80f8,_0x4fa34a);_0x11a543(_0x4fa34a);});});}exports[_0xc381('0x1b')]=function(_0x481074){var _0x276006=this;return new Promise(function(_0x15d279,_0x25d0be){return db[_0xc381('0x1c')]['create'](_0x481074[_0xc381('0x1d')],{'raw':_0x481074[_0xc381('0x1e')]?_0x481074[_0xc381('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xc381('0x10')](function(_0x18cff5){logger['info'](_0xc381('0x1b'),_0x481074);logger[_0xc381('0x14')]('CreateSmsMessage',_0x481074,JSON[_0xc381('0x16')](_0x18cff5));_0x15d279(_0x18cff5);})['catch'](function(_0x5db750){logger['error'](_0xc381('0x1b'),_0x5db750[_0xc381('0x19')],_0x481074);_0x25d0be(_0x276006[_0xc381('0x18')](0x1f4,_0x5db750[_0xc381('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 77780b7..4c64bcf 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 _0x08a8=['remove','update','removeListener','register','length','smsMessage:','./smsMessage.events','save'];(function(_0x4c38fb,_0x167177){var _0x2c1eb8=function(_0x1f4691){while(--_0x1f4691){_0x4c38fb['push'](_0x4c38fb['shift']());}};_0x2c1eb8(++_0x167177);}(_0x08a8,0x1de));var _0x808a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x08a8[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require(_0x808a('0x0'));var events=[_0x808a('0x1'),_0x808a('0x2'),_0x808a('0x3')];function createListener(_0x21eac8,_0x6344fd){return function(_0x10dfb7){_0x6344fd['emit'](_0x21eac8,_0x10dfb7);};}function removeListener(_0x493620,_0xaa74f1){return function(){SmsMessageEvents[_0x808a('0x4')](_0x493620,_0xaa74f1);};}exports[_0x808a('0x5')]=function(_0x952c7a){for(var _0x599435=0x0,_0x1eacf6=events[_0x808a('0x6')];_0x599435<_0x1eacf6;_0x599435++){var _0x6de170=events[_0x599435];var _0x3c864f=createListener(_0x808a('0x7')+_0x6de170,_0x952c7a);SmsMessageEvents['on'](_0x6de170,_0x3c864f);}}; \ No newline at end of file +var _0xaf36=['smsMessage:','./smsMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0xaf36,0x109));var _0x6af3=function(_0x406115,_0x19f7a1){_0x406115=_0x406115-0x0;var _0xbbabdb=_0xaf36[_0x406115];return _0xbbabdb;};'use strict';var SmsMessageEvents=require(_0x6af3('0x0'));var events=[_0x6af3('0x1'),_0x6af3('0x2'),_0x6af3('0x3')];function createListener(_0x21fe25,_0x20c1de){return function(_0x478e16){_0x20c1de[_0x6af3('0x4')](_0x21fe25,_0x478e16);};}function removeListener(_0x22d471,_0x379e99){return function(){SmsMessageEvents[_0x6af3('0x5')](_0x22d471,_0x379e99);};}exports[_0x6af3('0x6')]=function(_0xf536e9){for(var _0xfef1c4=0x0,_0x4c6800=events['length'];_0xfef1c4<_0x4c6800;_0xfef1c4++){var _0x3c6821=events[_0xfef1c4];var _0x280514=createListener(_0x6af3('0x7')+_0x3c6821,_0xf536e9);SmsMessageEvents['on'](_0x3c6821,_0x280514);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 8c709e1..5f6a9f7 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 _0xea8e=['create','post','addTeams','addAgents','update','delete','destroy','removeAgents','multer','path','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xea8e,0xb8));var _0xeea8=function(_0x2eb4c0,_0x5806ec){_0x2eb4c0=_0x2eb4c0-0x0;var _0x272172=_0xea8e[_0x2eb4c0];return _0x272172;};'use strict';var multer=require(_0xeea8('0x0'));var util=require('util');var path=require(_0xeea8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xeea8('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xeea8('0x3'));var config=require(_0xeea8('0x4'));var controller=require(_0xeea8('0x5'));router[_0xeea8('0x6')]('/',auth[_0xeea8('0x7')](),controller['index']);router[_0xeea8('0x6')]('/describe',auth[_0xeea8('0x7')](),controller['describe']);router[_0xeea8('0x6')](_0xeea8('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xeea8('0x6')](_0xeea8('0x9'),auth['isAuthenticated'](),controller[_0xeea8('0xa')]);router[_0xeea8('0x6')](_0xeea8('0xb'),auth[_0xeea8('0x7')](),controller['getTeams']);router[_0xeea8('0x6')](_0xeea8('0xc'),auth[_0xeea8('0x7')](),controller[_0xeea8('0xd')]);router['post']('/',auth[_0xeea8('0x7')](),controller[_0xeea8('0xe')]);router[_0xeea8('0xf')](_0xeea8('0xb'),auth[_0xeea8('0x7')](),controller[_0xeea8('0x10')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xeea8('0x11')]);router['put'](_0xeea8('0x8'),auth['isAuthenticated'](),controller[_0xeea8('0x12')]);router[_0xeea8('0x13')](_0xeea8('0x8'),auth[_0xeea8('0x7')](),controller[_0xeea8('0x14')]);router[_0xeea8('0x13')]('/:id/teams',auth[_0xeea8('0x7')](),controller['removeTeams']);router[_0xeea8('0x13')](_0xeea8('0xc'),auth['isAuthenticated'](),controller[_0xeea8('0x15')]);module['exports']=router; \ No newline at end of file +var _0x646a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','Router'];(function(_0x2b5ce3,_0x3df12d){var _0x4f6522=function(_0x4de46e){while(--_0x4de46e){_0x2b5ce3['push'](_0x2b5ce3['shift']());}};_0x4f6522(++_0x3df12d);}(_0x646a,0x182));var _0xa646=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x646a[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require(_0xa646('0x0'));var util=require(_0xa646('0x1'));var path=require(_0xa646('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa646('0x3')]();var fs_extra=require(_0xa646('0x4'));var auth=require(_0xa646('0x5'));var interaction=require(_0xa646('0x6'));var config=require(_0xa646('0x7'));var controller=require(_0xa646('0x8'));router[_0xa646('0x9')]('/',auth[_0xa646('0xa')](),controller[_0xa646('0xb')]);router[_0xa646('0x9')]('/describe',auth[_0xa646('0xa')](),controller['describe']);router[_0xa646('0x9')](_0xa646('0xc'),auth['isAuthenticated'](),controller[_0xa646('0xd')]);router[_0xa646('0x9')]('/:id/members',auth[_0xa646('0xa')](),controller[_0xa646('0xe')]);router[_0xa646('0x9')](_0xa646('0xf'),auth['isAuthenticated'](),controller[_0xa646('0x10')]);router['get'](_0xa646('0x11'),auth['isAuthenticated'](),controller[_0xa646('0x12')]);router[_0xa646('0x13')]('/',auth[_0xa646('0xa')](),controller[_0xa646('0x14')]);router[_0xa646('0x13')]('/:id/teams',auth[_0xa646('0xa')](),controller[_0xa646('0x15')]);router[_0xa646('0x13')](_0xa646('0x11'),auth[_0xa646('0xa')](),controller[_0xa646('0x16')]);router[_0xa646('0x17')](_0xa646('0xc'),auth[_0xa646('0xa')](),controller[_0xa646('0x18')]);router['delete'](_0xa646('0xc'),auth[_0xa646('0xa')](),controller[_0xa646('0x19')]);router[_0xa646('0x1a')](_0xa646('0xf'),auth['isAuthenticated'](),controller[_0xa646('0x1b')]);router[_0xa646('0x1a')](_0xa646('0x11'),auth[_0xa646('0xa')](),controller[_0xa646('0x1c')]);module[_0xa646('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 16e5b5a..27c4958 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 _0xc76b=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x403443,_0x305524){var _0x2a5d14=function(_0x326066){while(--_0x326066){_0x403443['push'](_0x403443['shift']());}};_0x2a5d14(++_0x305524);}(_0xc76b,0x1a2));var _0xbc76=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xc76b[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0xbc76('0x0'));module[_0xbc76('0x1')]={'name':{'type':Sequelize[_0xbc76('0x2')],'unique':_0xbc76('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbc76('0x2')]},'timeout':{'type':Sequelize[_0xbc76('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbc76('0x5')]('rrmemory',_0xbc76('0x6'),_0xbc76('0x7'))}}; \ No newline at end of file +var _0xf4f6=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x2f5249,_0x6bafa2){var _0x22af36=function(_0x4b19b8){while(--_0x4b19b8){_0x2f5249['push'](_0x2f5249['shift']());}};_0x22af36(++_0x6bafa2);}(_0xf4f6,0xa9));var _0x6f4f=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xf4f6[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x6f4f('0x0'));module[_0x6f4f('0x1')]={'name':{'type':Sequelize[_0x6f4f('0x2')],'unique':_0x6f4f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6f4f('0x2')]},'timeout':{'type':Sequelize[_0x6f4f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6f4f('0x5')](_0x6f4f('0x6'),_0x6f4f('0x7'),_0x6f4f('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 178ecfe..be32628 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 _0xbd4e=['find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserSmsQueue','nolimit','pick','findAndCountAll','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','User','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','compact','value','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues'];(function(_0x49df93,_0x2bb7ac){var _0x471bac=function(_0x3dbdc5){while(--_0x3dbdc5){_0x49df93['push'](_0x49df93['shift']());}};_0x471bac(++_0x2bb7ac);}(_0xbd4e,0x1cb));var _0xebd4=function(_0x8c062e,_0xe1cb5d){_0x8c062e=_0x8c062e-0x0;var _0x2351c8=_0xbd4e[_0x8c062e];return _0x2351c8;};'use strict';var emlformat=require(_0xebd4('0x0'));var rimraf=require(_0xebd4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebd4('0x2'));var rp=require(_0xebd4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xebd4('0x4'));var util=require('util');var path=require(_0xebd4('0x5'));var sox=require(_0xebd4('0x6'));var csv=require('to-csv');var ejs=require(_0xebd4('0x7'));var fs=require('fs');var fs_extra=require(_0xebd4('0x8'));var _=require('lodash');var squel=require(_0xebd4('0x9'));var crypto=require(_0xebd4('0xa'));var jsforce=require(_0xebd4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xebd4('0xc'));var Papa=require(_0xebd4('0xd'));var Redis=require('ioredis');var authService=require(_0xebd4('0xe'));var qs=require(_0xebd4('0xf'));var as=require(_0xebd4('0x10'));var hardwareService=require(_0xebd4('0x11'));var logger=require(_0xebd4('0x12'))(_0xebd4('0x13'));var utils=require(_0xebd4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xebd4('0x15'));var db=require('../../mysqldb')['db'];config[_0xebd4('0x16')]=_[_0xebd4('0x17')](config['redis'],{'host':_0xebd4('0x18'),'port':0x18eb});var socket=require(_0xebd4('0x19'))(new Redis(config[_0xebd4('0x16')]));require('./smsQueue.socket')[_0xebd4('0x1a')](socket);function respondWithStatusCode(_0x398811,_0x389963){_0x389963=_0x389963||0xcc;return function(_0x37b9e7){if(_0x37b9e7){return _0x398811[_0xebd4('0x1b')](_0x389963);}return _0x398811[_0xebd4('0x1c')](_0x389963)[_0xebd4('0x1d')]();};}function respondWithResult(_0x4095b1,_0x3c30dd){_0x3c30dd=_0x3c30dd||0xc8;return function(_0x358980){if(_0x358980){return _0x4095b1[_0xebd4('0x1c')](_0x3c30dd)[_0xebd4('0x1e')](_0x358980);}};}function respondWithFilteredResult(_0x2a807b,_0x524204){return function(_0x20cd97){if(_0x20cd97){var _0x20c97f=typeof _0x524204[_0xebd4('0x1f')]===_0xebd4('0x20')&&typeof _0x524204['limit']===_0xebd4('0x20');var _0xd16066=_0x20cd97[_0xebd4('0x21')];var _0x3e3b03=_0x20c97f?0x0:_0x524204[_0xebd4('0x1f')];var _0x5975bf=_0x20c97f?_0x20cd97['count']:_0x524204[_0xebd4('0x1f')]+_0x524204['limit'];var _0x54119b;if(_0x5975bf>=_0xd16066){_0x5975bf=_0xd16066;_0x54119b=0xc8;}else{_0x54119b=0xce;}_0x2a807b[_0xebd4('0x1c')](_0x54119b);return _0x2a807b[_0xebd4('0x22')](_0xebd4('0x23'),_0x3e3b03+'-'+_0x5975bf+'/'+_0xd16066)[_0xebd4('0x1e')](_0x20cd97);}return null;};}function patchUpdates(_0x3b1cdc){return function(_0x4dcd55){try{jsonpatch[_0xebd4('0x24')](_0x4dcd55,_0x3b1cdc,!![]);}catch(_0x42d1b0){return BPromise[_0xebd4('0x25')](_0x42d1b0);}return _0x4dcd55[_0xebd4('0x26')]();};}function saveUpdates(_0xe2e559,_0x1ed549){return function(_0x4c9778){if(_0x4c9778){return _0x4c9778['update'](_0xe2e559)[_0xebd4('0x27')](function(_0x1649ff){return _0x1649ff;});}return null;};}function removeEntity(_0x1b4d10,_0x25c44f){return function(_0x200108){if(_0x200108){return _0x200108[_0xebd4('0x28')]()[_0xebd4('0x27')](function(){var _0x86bb7f=_0x200108[_0xebd4('0x29')]({'plain':!![]});var _0x13001e='SmsQueues';return db[_0xebd4('0x2a')][_0xebd4('0x28')]({'where':{'type':_0x13001e,'resourceId':_0x86bb7f['id']}})[_0xebd4('0x27')](function(){return _0x200108;});})['then'](function(){_0x1b4d10[_0xebd4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x335957,_0x197dd0){return function(_0x233f4b){if(!_0x233f4b){_0x335957[_0xebd4('0x1b')](0x194);}return _0x233f4b;};}function handleError(_0x4d121d,_0x44002d){_0x44002d=_0x44002d||0x1f4;return function(_0x2553b1){logger[_0xebd4('0x2b')](_0x2553b1['stack']);if(_0x2553b1[_0xebd4('0x2c')]){delete _0x2553b1[_0xebd4('0x2c')];}_0x4d121d[_0xebd4('0x1c')](_0x44002d)[_0xebd4('0x2d')](_0x2553b1);};}exports[_0xebd4('0x2e')]=function(_0x392429,_0xfc5591){var _0x3c45a5={},_0xa95c48={},_0x587aba={'count':0x0,'rows':[]};var _0x23c060=_[_0xebd4('0x2f')](db[_0xebd4('0x30')][_0xebd4('0x31')],function(_0x599323){return{'name':_0x599323[_0xebd4('0x32')],'type':_0x599323[_0xebd4('0x33')][_0xebd4('0x34')]};});_0xa95c48[_0xebd4('0x35')]=_['map'](_0x23c060,_0xebd4('0x2c'));_0xa95c48[_0xebd4('0x36')]=_[_0xebd4('0x37')](_0x392429['query']);_0xa95c48[_0xebd4('0x38')]=_[_0xebd4('0x39')](_0xa95c48[_0xebd4('0x35')],_0xa95c48[_0xebd4('0x36')]);_0x3c45a5[_0xebd4('0x3a')]=_[_0xebd4('0x39')](_0xa95c48['model'],qs[_0xebd4('0x3b')](_0x392429[_0xebd4('0x36')][_0xebd4('0x3b')]));_0x3c45a5[_0xebd4('0x3a')]=_0x3c45a5[_0xebd4('0x3a')]['length']?_0x3c45a5[_0xebd4('0x3a')]:_0xa95c48[_0xebd4('0x35')];if(!_0x392429[_0xebd4('0x36')][_0xebd4('0x3c')]('nolimit')){_0x3c45a5[_0xebd4('0x3d')]=qs[_0xebd4('0x3d')](_0x392429['query'][_0xebd4('0x3d')]);_0x3c45a5[_0xebd4('0x1f')]=qs[_0xebd4('0x1f')](_0x392429['query'][_0xebd4('0x1f')]);}_0x3c45a5[_0xebd4('0x3e')]=qs[_0xebd4('0x3f')](_0x392429[_0xebd4('0x36')][_0xebd4('0x3f')]);_0x3c45a5[_0xebd4('0x40')]=qs[_0xebd4('0x38')](_['pick'](_0x392429[_0xebd4('0x36')],_0xa95c48['filters']),_0x23c060);if(_0x392429[_0xebd4('0x36')][_0xebd4('0x41')]){_0x3c45a5[_0xebd4('0x40')]=_[_0xebd4('0x42')](_0x3c45a5[_0xebd4('0x40')],{'$or':_[_0xebd4('0x2f')](_0x23c060,function(_0x26f910){if(_0x26f910[_0xebd4('0x33')]!=='VIRTUAL'){var _0x3447d3={};_0x3447d3[_0x26f910[_0xebd4('0x2c')]]={'$like':'%'+_0x392429[_0xebd4('0x36')][_0xebd4('0x41')]+'%'};return _0x3447d3;}})});}_0x3c45a5=_['merge']({},_0x3c45a5,_0x392429[_0xebd4('0x43')]);var _0x449aa5={'where':_0x3c45a5['where']};return db[_0xebd4('0x30')][_0xebd4('0x21')](_0x449aa5)[_0xebd4('0x27')](function(_0x2e752d){_0x587aba[_0xebd4('0x21')]=_0x2e752d;if(_0x392429[_0xebd4('0x36')][_0xebd4('0x44')]){_0x3c45a5[_0xebd4('0x45')]=[{'all':!![]}];}return db[_0xebd4('0x30')][_0xebd4('0x46')](_0x3c45a5);})[_0xebd4('0x27')](function(_0x2cc595){_0x587aba[_0xebd4('0x47')]=_0x2cc595;return _0x587aba;})[_0xebd4('0x27')](respondWithFilteredResult(_0xfc5591,_0x3c45a5))[_0xebd4('0x48')](handleError(_0xfc5591,null));};exports['show']=function(_0x184d30,_0x292806){var _0xe7b641={'raw':!![],'where':{'id':_0x184d30[_0xebd4('0x49')]['id']}},_0x4466a7={};_0x4466a7[_0xebd4('0x35')]=_[_0xebd4('0x37')](db[_0xebd4('0x30')]['rawAttributes']);_0x4466a7[_0xebd4('0x36')]=_[_0xebd4('0x37')](_0x184d30[_0xebd4('0x36')]);_0x4466a7['filters']=_[_0xebd4('0x39')](_0x4466a7[_0xebd4('0x35')],_0x4466a7['query']);_0xe7b641[_0xebd4('0x3a')]=_[_0xebd4('0x39')](_0x4466a7['model'],qs[_0xebd4('0x3b')](_0x184d30[_0xebd4('0x36')]['fields']));_0xe7b641[_0xebd4('0x3a')]=_0xe7b641[_0xebd4('0x3a')][_0xebd4('0x4a')]?_0xe7b641[_0xebd4('0x3a')]:_0x4466a7[_0xebd4('0x35')];if(_0x184d30[_0xebd4('0x36')]['includeAll']){_0xe7b641[_0xebd4('0x45')]=[{'all':!![]}];}_0xe7b641=_[_0xebd4('0x42')]({},_0xe7b641,_0x184d30[_0xebd4('0x43')]);return db['SmsQueue']['find'](_0xe7b641)[_0xebd4('0x27')](handleEntityNotFound(_0x292806,null))['then'](respondWithResult(_0x292806,null))[_0xebd4('0x48')](handleError(_0x292806,null));};exports[_0xebd4('0x4b')]=function(_0x4db572,_0xfbbf87){return db['SmsQueue'][_0xebd4('0x4b')](_0x4db572[_0xebd4('0x4c')],{})[_0xebd4('0x27')](function(_0x2ee537){var _0x45ec6b=_0x4db572[_0xebd4('0x4d')][_0xebd4('0x29')]({'plain':!![]});if(!_0x45ec6b)throw new Error(_0xebd4('0x4e'));if(_0x45ec6b[_0xebd4('0x4f')]===_0xebd4('0x4d')){var _0x3d8d9a=_0x2ee537[_0xebd4('0x29')]({'plain':!![]});var _0x13c8ad=_0xebd4('0x50');return db['UserProfileSection'][_0xebd4('0x51')]({'where':{'name':_0x13c8ad,'userProfileId':_0x45ec6b[_0xebd4('0x52')]},'raw':!![]})['then'](function(_0x4edae9){if(_0x4edae9&&_0x4edae9['autoAssociation']===0x0){return db[_0xebd4('0x2a')][_0xebd4('0x4b')]({'name':_0x3d8d9a[_0xebd4('0x2c')],'resourceId':_0x3d8d9a['id'],'type':_0x4edae9[_0xebd4('0x2c')],'sectionId':_0x4edae9['id']},{})[_0xebd4('0x27')](function(){return _0x2ee537;});}else{return _0x2ee537;}})['catch'](function(_0x103682){logger[_0xebd4('0x2b')](_0xebd4('0x53'),_0x103682);throw _0x103682;});}return _0x2ee537;})['then'](respondWithResult(_0xfbbf87,0xc9))[_0xebd4('0x48')](handleError(_0xfbbf87,null));};exports[_0xebd4('0x54')]=function(_0x47f740,_0x862ed8){if(_0x47f740[_0xebd4('0x4c')]['id']){delete _0x47f740[_0xebd4('0x4c')]['id'];}return db[_0xebd4('0x30')][_0xebd4('0x51')]({'where':{'id':_0x47f740[_0xebd4('0x49')]['id']}})['then'](handleEntityNotFound(_0x862ed8,null))[_0xebd4('0x27')](saveUpdates(_0x47f740[_0xebd4('0x4c')],null))['then'](respondWithResult(_0x862ed8,null))[_0xebd4('0x48')](handleError(_0x862ed8,null));};exports[_0xebd4('0x28')]=function(_0xdcaacd,_0x50b666){return db['SmsQueue'][_0xebd4('0x51')]({'where':{'id':_0xdcaacd[_0xebd4('0x49')]['id']}})[_0xebd4('0x27')](handleEntityNotFound(_0x50b666,null))[_0xebd4('0x27')](removeEntity(_0x50b666,null))[_0xebd4('0x48')](handleError(_0x50b666,null));};exports['describe']=function(_0x23a793,_0x488a8a){return db[_0xebd4('0x30')][_0xebd4('0x55')]()[_0xebd4('0x27')](respondWithResult(_0x488a8a,null))[_0xebd4('0x48')](handleError(_0x488a8a,null));};exports[_0xebd4('0x56')]=function(_0x2b5169,_0x47ca77,_0x245999){var _0x1d8fbd={'raw':!![],'where':{}},_0x562951={},_0x4b4e64;return db[_0xebd4('0x30')][_0xebd4('0x57')]({'where':{'id':_0x2b5169['params']['id']}})['then'](handleEntityNotFound(_0x47ca77,null))[_0xebd4('0x27')](function(_0x17cea8){if(_0x17cea8){_0x4b4e64=_0x17cea8[_0xebd4('0x29')]({'plain':!![]});_0x562951[_0xebd4('0x35')]=_['keys'](db[_0xebd4('0x58')][_0xebd4('0x31')]);_0x562951[_0xebd4('0x36')]=_[_0xebd4('0x37')](_0x2b5169[_0xebd4('0x36')]);_0x562951['filters']=_[_0xebd4('0x39')](_0x562951[_0xebd4('0x35')],_0x562951[_0xebd4('0x36')]);_0x1d8fbd['attributes']=_[_0xebd4('0x39')](_0x562951[_0xebd4('0x35')],qs[_0xebd4('0x3b')](_0x2b5169[_0xebd4('0x36')][_0xebd4('0x3b')]));_0x1d8fbd[_0xebd4('0x3a')]=_0x1d8fbd['attributes'][_0xebd4('0x4a')]?_0x1d8fbd[_0xebd4('0x3a')]:_0x562951[_0xebd4('0x35')];if(!_0x2b5169[_0xebd4('0x36')]['hasOwnProperty'](_0xebd4('0x59'))){_0x1d8fbd[_0xebd4('0x3d')]=qs[_0xebd4('0x3d')](_0x2b5169[_0xebd4('0x36')][_0xebd4('0x3d')]);_0x1d8fbd['offset']=qs['offset'](_0x2b5169['query'][_0xebd4('0x1f')]);}_0x1d8fbd[_0xebd4('0x3e')]=qs['sort'](_0x2b5169['query'][_0xebd4('0x3f')]);_0x1d8fbd['where']=qs[_0xebd4('0x38')](_[_0xebd4('0x5a')](_0x2b5169[_0xebd4('0x36')],_0x562951['filters']));_0x1d8fbd[_0xebd4('0x40')]['SmsQueueId']=_0x17cea8['id'];if(_0x2b5169[_0xebd4('0x36')]['filter']){_0x1d8fbd['where']=_[_0xebd4('0x42')](_0x1d8fbd[_0xebd4('0x40')],{'$or':_['map'](_0x1d8fbd[_0xebd4('0x3a')],function(_0x31475a){var _0x29df2d={};_0x29df2d[_0x31475a]={'$like':'%'+_0x2b5169['query'][_0xebd4('0x41')]+'%'};return _0x29df2d;})});}_0x1d8fbd=_[_0xebd4('0x42')]({},_0x1d8fbd,_0x2b5169[_0xebd4('0x43')]);return db[_0xebd4('0x58')][_0xebd4('0x46')](_0x1d8fbd);}})['then'](function(_0x8ad2f2){if(_0x8ad2f2){return db['User'][_0xebd4('0x5b')]({'where':{'id':_['map'](_0x8ad2f2,'UserId'),'role':_0xebd4('0x5c')},'attributes':['id',_0xebd4('0x2c'),_0xebd4('0x5d'),_0xebd4('0x5e'),_0xebd4('0x5f')]});}})['then'](function(_0x324523){if(_0x324523){return{'count':_0x324523[_0xebd4('0x21')],'rows':_[_0xebd4('0x2f')](_0x324523[_0xebd4('0x47')],function(_0xe07585){return{'membername':_0xe07585[_0xebd4('0x2c')],'UserId':_0xe07585['id'],'queue_name':_0x4b4e64[_0xebd4('0x2c')],'SmsQueueId':_0x4b4e64['id'],'interface':util[_0xebd4('0x60')](_0xebd4('0x61'),_0xebd4('0x62'),_0xe07585[_0xebd4('0x2c')]),'penalty':0x0,'paused':_0xe07585[_0xebd4('0x5d')],'createdAt':_0xe07585['createdAt'],'updatedAt':_0xe07585['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xebd4('0x27')](respondWithFilteredResult(_0x47ca77,_0x1d8fbd))[_0xebd4('0x48')](handleError(_0x47ca77,null));};exports['getTeams']=function(_0x41db45,_0x189dce,_0xba5425){var _0x50d313={};var _0x1e144a={};var _0x519b80;var _0x5ac21a;return db[_0xebd4('0x30')][_0xebd4('0x57')]({'where':{'id':_0x41db45['params']['id']}})[_0xebd4('0x27')](handleEntityNotFound(_0x189dce,null))[_0xebd4('0x27')](function(_0x5c865b){if(_0x5c865b){_0x519b80=_0x5c865b;_0x1e144a[_0xebd4('0x35')]=_[_0xebd4('0x37')](db[_0xebd4('0x63')][_0xebd4('0x31')]);_0x1e144a[_0xebd4('0x36')]=_[_0xebd4('0x37')](_0x41db45[_0xebd4('0x36')]);_0x1e144a['filters']=_[_0xebd4('0x39')](_0x1e144a['model'],_0x1e144a[_0xebd4('0x36')]);_0x50d313['attributes']=_[_0xebd4('0x39')](_0x1e144a[_0xebd4('0x35')],qs[_0xebd4('0x3b')](_0x41db45[_0xebd4('0x36')]['fields']));_0x50d313[_0xebd4('0x3a')]=_0x50d313[_0xebd4('0x3a')][_0xebd4('0x4a')]?_0x50d313['attributes']:_0x1e144a[_0xebd4('0x35')];_0x50d313['order']=qs[_0xebd4('0x3f')](_0x41db45[_0xebd4('0x36')][_0xebd4('0x3f')]);_0x50d313[_0xebd4('0x40')]=qs[_0xebd4('0x38')](_[_0xebd4('0x5a')](_0x41db45[_0xebd4('0x36')],_0x1e144a[_0xebd4('0x38')]));if(_0x41db45[_0xebd4('0x36')][_0xebd4('0x41')]){_0x50d313[_0xebd4('0x40')]=_[_0xebd4('0x42')](_0x50d313[_0xebd4('0x40')],{'$or':_[_0xebd4('0x2f')](_0x50d313['attributes'],function(_0x44a771){var _0x2b79ff={};_0x2b79ff[_0x44a771]={'$like':'%'+_0x41db45[_0xebd4('0x36')][_0xebd4('0x41')]+'%'};return _0x2b79ff;})});}_0x50d313=_[_0xebd4('0x42')]({},_0x50d313,_0x41db45[_0xebd4('0x43')]);return _0x519b80[_0xebd4('0x64')](_0x50d313);}})[_0xebd4('0x27')](function(_0x42ab5b){if(_0x42ab5b){_0x5ac21a=_0x42ab5b[_0xebd4('0x4a')];if(!_0x41db45[_0xebd4('0x36')][_0xebd4('0x3c')]('nolimit')){_0x50d313[_0xebd4('0x3d')]=qs[_0xebd4('0x3d')](_0x41db45[_0xebd4('0x36')]['limit']);_0x50d313[_0xebd4('0x1f')]=qs['offset'](_0x41db45[_0xebd4('0x36')][_0xebd4('0x1f')]);}return _0x519b80[_0xebd4('0x64')](_0x50d313);}})[_0xebd4('0x27')](function(_0x49afdf){if(_0x49afdf){return _0x49afdf?{'count':_0x5ac21a,'rows':_0x49afdf}:null;}})[_0xebd4('0x27')](respondWithResult(_0x189dce,null))['catch'](handleError(_0x189dce,null));};exports[_0xebd4('0x65')]=function(_0x3bf01a,_0x484968,_0x136334){var _0x28eb2f=_0x3bf01a[_0xebd4('0x4c')][_0xebd4('0x66')];return db['Team'][_0xebd4('0x46')]({'where':{'id':_0x28eb2f},'attributes':['id'],'include':[{'model':db[_0xebd4('0x67')],'as':_0xebd4('0x68'),'attributes':['id',_0xebd4('0x2c'),'online',_0xebd4('0x69'),_0xebd4('0x6a')],'raw':!![]}]})[_0xebd4('0x27')](function(_0x74e1c7){if(_0x74e1c7){var _0x3fd69d=_[_0xebd4('0x6b')](_0x74e1c7,function(_0x10f757){var _0x15fed1=_0x10f757[_0xebd4('0x29')]({'plain':!![]});return _0x15fed1['Agents'];});return db[_0xebd4('0x30')][_0xebd4('0x51')]({'where':{'id':_0x3bf01a[_0xebd4('0x49')]['id']}})['then'](function(_0x537de3){return db[_0xebd4('0x6c')]['transaction'](function(_0x5af329){return _0x537de3[_0xebd4('0x65')](_0x28eb2f,{'transaction':_0x5af329})[_0xebd4('0x27')](function(){return BPromise[_0xebd4('0x6d')](_0x3fd69d,function(_0x53fe51){return db[_0xebd4('0x58')][_0xebd4('0x6e')]({'where':{'UserId':_0x53fe51['id'],'SmsQueueId':_0x3bf01a[_0xebd4('0x49')]['id']},'transaction':_0x5af329});});})[_0xebd4('0x27')](function(){_0x3fd69d['forEach'](function(_0x5402eb){socket['emit'](_0xebd4('0x6f'),{'UserId':_0x5402eb['id'],'SmsQueueId':_0x537de3['id']});});});});});}})[_0xebd4('0x27')](respondWithStatusCode(_0x484968,null))['catch'](handleError(_0x484968,null));};exports[_0xebd4('0x70')]=function(_0x45236a,_0x46fa66,_0x4b4081){return db['Team'][_0xebd4('0x46')]({'where':{'id':_0x45236a[_0xebd4('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xebd4('0x67')],'as':_0xebd4('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x46fa66,null))[_0xebd4('0x27')](function(_0x1ea26e){var _0x261403=_['map'](_0x1ea26e,'id');var _0x259c71=[];var _0x157c61=[];var _0x415bbc=squel[_0xebd4('0x71')]();_0x415bbc[_0xebd4('0x72')](_0xebd4('0x73'))[_0xebd4('0x74')](_0xebd4('0x75'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xebd4('0x40')]('SmsQueueId\x20=\x20?',_0x45236a['params']['id']);for(var _0x27ec86=0x0;_0x27ec86<_0x1ea26e['length'];_0x27ec86+=0x1){let _0x39fed7=_0x1ea26e[_0x27ec86];for(var _0x55a65d=0x0;_0x55a65d<_0x39fed7[_0xebd4('0x68')][_0xebd4('0x4a')];_0x55a65d+=0x1){let _0x489784=_0x39fed7[_0xebd4('0x68')][_0x55a65d];var _0x1b22e4=_0x415bbc[_0xebd4('0x76')]();_0x1b22e4['where'](_0xebd4('0x77'),_0x489784['id']);_0x157c61['push'](db[_0xebd4('0x6c')][_0xebd4('0x36')](_0x1b22e4[_0xebd4('0x78')](),{'type':db[_0xebd4('0x6c')][_0xebd4('0x79')][_0xebd4('0x7a')]})[_0xebd4('0x27')](function(_0x151290){if(_0x151290[_0xebd4('0x4a')]===0x1){return _0x489784['id'];}else{var _0x4614b1=_[_0xebd4('0x7b')](_['map'](_0x151290,_0xebd4('0x7c')),function(_0x1debe6){return _[_0xebd4('0x7d')](_0x261403,_0x1debe6);});if(_0x4614b1){return _0x489784['id'];}}}));}}return BPromise['all'](_0x157c61)['then'](function(_0x99b678){_0x259c71=_(_0x259c71)['union'](_0x99b678)[_0xebd4('0x7e')]()[_0xebd4('0x7f')]();return db[_0xebd4('0x30')]['find']({'where':{'id':_0x45236a['params']['id']}})[_0xebd4('0x27')](function(_0x1dbc32){return db[_0xebd4('0x6c')][_0xebd4('0x80')](function(_0x381dda){return _0x1dbc32['removeTeams'](_0x45236a[_0xebd4('0x36')][_0xebd4('0x66')],{'transaction':_0x381dda})['then'](function(){if(!_[_0xebd4('0x81')](_0x259c71)){return _0x1dbc32[_0xebd4('0x82')](_0x259c71,{'transaction':_0x381dda});}})[_0xebd4('0x27')](function(){_0x259c71['forEach'](function(_0x22b1b4){socket['emit'](_0xebd4('0x83'),{'UserId':_0x22b1b4,'SmsQueueId':_0x1dbc32['id']});});});});});});})[_0xebd4('0x27')](respondWithStatusCode(_0x46fa66,null))[_0xebd4('0x48')](handleError(_0x46fa66,null));};exports[_0xebd4('0x84')]=function(_0x30bb48,_0x67ff26,_0x3f7d1b){return db[_0xebd4('0x30')][_0xebd4('0x51')]({'where':{'id':_0x30bb48[_0xebd4('0x49')]['id']}})['then'](handleEntityNotFound(_0x67ff26,null))[_0xebd4('0x27')](function(_0x4699d5){if(_0x4699d5){return _0x4699d5[_0xebd4('0x84')](_0x30bb48[_0xebd4('0x4c')][_0xebd4('0x66')],_[_0xebd4('0x85')](_0x30bb48[_0xebd4('0x4c')],[_0xebd4('0x66'),'id'])||{})['spread'](function(_0x49f77b){for(var _0x3159a6=0x0;_0x3159a6<_0x30bb48['body'][_0xebd4('0x66')][_0xebd4('0x4a')];_0x3159a6+=0x1){socket['emit'](_0xebd4('0x6f'),{'UserId':Number(_0x30bb48[_0xebd4('0x4c')]['ids'][_0x3159a6]),'SmsQueueId':Number(_0x30bb48[_0xebd4('0x49')]['id'])});}return _0x49f77b;});}})[_0xebd4('0x27')](respondWithResult(_0x67ff26,null))['catch'](handleError(_0x67ff26,null));};exports[_0xebd4('0x82')]=function(_0x36eb82,_0x593381,_0x502dcc){return db['SmsQueue']['find']({'where':{'id':_0x36eb82[_0xebd4('0x49')]['id']}})[_0xebd4('0x27')](handleEntityNotFound(_0x593381,null))[_0xebd4('0x27')](function(_0x48a7ce){if(_0x48a7ce){return _0x48a7ce[_0xebd4('0x82')](_0x36eb82[_0xebd4('0x36')]['ids'])[_0xebd4('0x27')](function(){if(_['isArray'](_0x36eb82['query'][_0xebd4('0x66')])){for(var _0x4e4733=0x0;_0x4e4733<_0x36eb82['query'][_0xebd4('0x66')][_0xebd4('0x4a')];_0x4e4733+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x36eb82[_0xebd4('0x36')][_0xebd4('0x66')][_0x4e4733]),'SmsQueueId':Number(_0x36eb82[_0xebd4('0x49')]['id'])});}}else{socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x36eb82[_0xebd4('0x36')][_0xebd4('0x66')]),'SmsQueueId':Number(_0x36eb82[_0xebd4('0x49')]['id'])});}});}})[_0xebd4('0x27')](respondWithStatusCode(_0x593381,null))[_0xebd4('0x48')](handleError(_0x593381,null));};exports[_0xebd4('0x86')]=function(_0x118331,_0x355ecc,_0x24fa06){var _0x23ff0d={};var _0x20c3e3={};var _0x263e43;var _0x27c0bc;return db[_0xebd4('0x30')][_0xebd4('0x57')]({'where':{'id':_0x118331['params']['id']}})[_0xebd4('0x27')](handleEntityNotFound(_0x355ecc,null))[_0xebd4('0x27')](function(_0x1eea67){if(_0x1eea67){_0x263e43=_0x1eea67;_0x20c3e3[_0xebd4('0x35')]=_[_0xebd4('0x37')](db[_0xebd4('0x67')][_0xebd4('0x31')]);_0x20c3e3['query']=_[_0xebd4('0x37')](_0x118331[_0xebd4('0x36')]);_0x20c3e3[_0xebd4('0x38')]=_[_0xebd4('0x39')](_0x20c3e3['model'],_0x20c3e3[_0xebd4('0x36')]);_0x23ff0d[_0xebd4('0x3a')]=_[_0xebd4('0x39')](_0x20c3e3[_0xebd4('0x35')],qs[_0xebd4('0x3b')](_0x118331[_0xebd4('0x36')][_0xebd4('0x3b')]));_0x23ff0d[_0xebd4('0x3a')]=_0x23ff0d['attributes']['length']?_0x23ff0d[_0xebd4('0x3a')]:_0x20c3e3[_0xebd4('0x35')];_0x23ff0d['order']=qs[_0xebd4('0x3f')](_0x118331[_0xebd4('0x36')]['sort']);_0x23ff0d[_0xebd4('0x40')]=qs[_0xebd4('0x38')](_[_0xebd4('0x5a')](_0x118331['query'],_0x20c3e3['filters']));if(_0x118331['query'][_0xebd4('0x41')]){_0x23ff0d[_0xebd4('0x40')]=_[_0xebd4('0x42')](_0x23ff0d[_0xebd4('0x40')],{'$or':_[_0xebd4('0x2f')](_0x23ff0d[_0xebd4('0x3a')],function(_0x4d10cb){var _0x5367f9={};_0x5367f9[_0x4d10cb]={'$like':'%'+_0x118331[_0xebd4('0x36')][_0xebd4('0x41')]+'%'};return _0x5367f9;})});}_0x23ff0d=_[_0xebd4('0x42')]({},_0x23ff0d,_0x118331[_0xebd4('0x43')]);return _0x263e43[_0xebd4('0x86')](_0x23ff0d);}})[_0xebd4('0x27')](function(_0x50026e){if(_0x50026e){_0x27c0bc=_0x50026e[_0xebd4('0x4a')];if(!_0x118331[_0xebd4('0x36')][_0xebd4('0x3c')](_0xebd4('0x59'))){_0x23ff0d[_0xebd4('0x3d')]=qs[_0xebd4('0x3d')](_0x118331[_0xebd4('0x36')][_0xebd4('0x3d')]);_0x23ff0d[_0xebd4('0x1f')]=qs[_0xebd4('0x1f')](_0x118331[_0xebd4('0x36')][_0xebd4('0x1f')]);}return _0x263e43['getAgents'](_0x23ff0d);}})[_0xebd4('0x27')](function(_0x1b753a){if(_0x1b753a){return _0x1b753a?{'count':_0x27c0bc,'rows':_0x1b753a}:null;}})[_0xebd4('0x27')](respondWithResult(_0x355ecc,null))[_0xebd4('0x48')](handleError(_0x355ecc,null));}; \ No newline at end of file +var _0xd597=['all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','getAgents','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','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','localhost','./smsQueue.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','SmsQueues','sendStatus','error','stack','name','map','SmsQueue','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','create','describe','findOne','SmsQueueId','UserSmsQueue','User','findAndCountAll','agent','smsPause','updatedAt','createdAt','format','getTeams','Team','length','addTeams','Agents','interface','sequelize','transaction','each','forEach','emit','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_sms_queues','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xd597,0x94));var _0x7d59=function(_0x3ad53,_0x5c28ba){_0x3ad53=_0x3ad53-0x0;var _0x488998=_0xd597[_0x3ad53];return _0x488998;};'use strict';var emlformat=require(_0x7d59('0x0'));var rimraf=require(_0x7d59('0x1'));var zipdir=require(_0x7d59('0x2'));var jsonpatch=require(_0x7d59('0x3'));var rp=require(_0x7d59('0x4'));var moment=require(_0x7d59('0x5'));var BPromise=require(_0x7d59('0x6'));var Mustache=require(_0x7d59('0x7'));var util=require(_0x7d59('0x8'));var path=require(_0x7d59('0x9'));var sox=require(_0x7d59('0xa'));var csv=require(_0x7d59('0xb'));var ejs=require(_0x7d59('0xc'));var fs=require('fs');var fs_extra=require(_0x7d59('0xd'));var _=require(_0x7d59('0xe'));var squel=require(_0x7d59('0xf'));var crypto=require(_0x7d59('0x10'));var jsforce=require(_0x7d59('0x11'));var deskjs=require(_0x7d59('0x12'));var toCsv=require(_0x7d59('0xb'));var querystring=require(_0x7d59('0x13'));var Papa=require(_0x7d59('0x14'));var Redis=require('ioredis');var authService=require(_0x7d59('0x15'));var qs=require(_0x7d59('0x16'));var as=require(_0x7d59('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d59('0x18'));var utils=require(_0x7d59('0x19'));var config=require(_0x7d59('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x7d59('0x1b')],{'host':_0x7d59('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7d59('0x1d'))[_0x7d59('0x1e')](socket);function respondWithStatusCode(_0x3c4ab9,_0x1e07a0){_0x1e07a0=_0x1e07a0||0xcc;return function(_0x260c72){if(_0x260c72){return _0x3c4ab9['sendStatus'](_0x1e07a0);}return _0x3c4ab9[_0x7d59('0x1f')](_0x1e07a0)[_0x7d59('0x20')]();};}function respondWithResult(_0xea4239,_0x1c9317){_0x1c9317=_0x1c9317||0xc8;return function(_0x14bd27){if(_0x14bd27){return _0xea4239[_0x7d59('0x1f')](_0x1c9317)[_0x7d59('0x21')](_0x14bd27);}};}function respondWithFilteredResult(_0x1247c2,_0x15304e){return function(_0xb39529){if(_0xb39529){var _0xf83016=typeof _0x15304e[_0x7d59('0x22')]==='undefined'&&typeof _0x15304e['limit']===_0x7d59('0x23');var _0x3463d7=_0xb39529[_0x7d59('0x24')];var _0x432b5a=_0xf83016?0x0:_0x15304e[_0x7d59('0x22')];var _0x14d757=_0xf83016?_0xb39529[_0x7d59('0x24')]:_0x15304e['offset']+_0x15304e[_0x7d59('0x25')];var _0x15c08a;if(_0x14d757>=_0x3463d7){_0x14d757=_0x3463d7;_0x15c08a=0xc8;}else{_0x15c08a=0xce;}_0x1247c2['status'](_0x15c08a);return _0x1247c2[_0x7d59('0x26')](_0x7d59('0x27'),_0x432b5a+'-'+_0x14d757+'/'+_0x3463d7)[_0x7d59('0x21')](_0xb39529);}return null;};}function patchUpdates(_0x530a98){return function(_0x24816c){try{jsonpatch[_0x7d59('0x28')](_0x24816c,_0x530a98,!![]);}catch(_0x18f6cb){return BPromise[_0x7d59('0x29')](_0x18f6cb);}return _0x24816c[_0x7d59('0x2a')]();};}function saveUpdates(_0x2e3d4a,_0x2a613d){return function(_0x309c76){if(_0x309c76){return _0x309c76[_0x7d59('0x2b')](_0x2e3d4a)[_0x7d59('0x2c')](function(_0x4d18d0){return _0x4d18d0;});}return null;};}function removeEntity(_0x1bc100,_0x2459a2){return function(_0x2430be){if(_0x2430be){return _0x2430be[_0x7d59('0x2d')]()[_0x7d59('0x2c')](function(){var _0x1b60e1=_0x2430be['get']({'plain':!![]});var _0x278aca=_0x7d59('0x2e');return db['UserProfileResource'][_0x7d59('0x2d')]({'where':{'type':_0x278aca,'resourceId':_0x1b60e1['id']}})[_0x7d59('0x2c')](function(){return _0x2430be;});})[_0x7d59('0x2c')](function(){_0x1bc100[_0x7d59('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26948c,_0x35ab0b){return function(_0x18e985){if(!_0x18e985){_0x26948c[_0x7d59('0x2f')](0x194);}return _0x18e985;};}function handleError(_0x530c06,_0x20e3a1){_0x20e3a1=_0x20e3a1||0x1f4;return function(_0x291f15){logger[_0x7d59('0x30')](_0x291f15[_0x7d59('0x31')]);if(_0x291f15[_0x7d59('0x32')]){delete _0x291f15[_0x7d59('0x32')];}_0x530c06[_0x7d59('0x1f')](_0x20e3a1)['send'](_0x291f15);};}exports['index']=function(_0x467111,_0x39ba68){var _0x5819b0={},_0x471d22={},_0x30bcfa={'count':0x0,'rows':[]};var _0x5bfe9e=_[_0x7d59('0x33')](db[_0x7d59('0x34')][_0x7d59('0x35')],function(_0x38522f){return{'name':_0x38522f[_0x7d59('0x36')],'type':_0x38522f[_0x7d59('0x37')]['key']};});_0x471d22[_0x7d59('0x38')]=_['map'](_0x5bfe9e,_0x7d59('0x32'));_0x471d22[_0x7d59('0x39')]=_[_0x7d59('0x3a')](_0x467111[_0x7d59('0x39')]);_0x471d22['filters']=_[_0x7d59('0x3b')](_0x471d22['model'],_0x471d22[_0x7d59('0x39')]);_0x5819b0[_0x7d59('0x3c')]=_[_0x7d59('0x3b')](_0x471d22[_0x7d59('0x38')],qs[_0x7d59('0x3d')](_0x467111[_0x7d59('0x39')]['fields']));_0x5819b0[_0x7d59('0x3c')]=_0x5819b0[_0x7d59('0x3c')]['length']?_0x5819b0[_0x7d59('0x3c')]:_0x471d22['model'];if(!_0x467111[_0x7d59('0x39')][_0x7d59('0x3e')](_0x7d59('0x3f'))){_0x5819b0[_0x7d59('0x25')]=qs[_0x7d59('0x25')](_0x467111[_0x7d59('0x39')][_0x7d59('0x25')]);_0x5819b0[_0x7d59('0x22')]=qs['offset'](_0x467111[_0x7d59('0x39')][_0x7d59('0x22')]);}_0x5819b0[_0x7d59('0x40')]=qs['sort'](_0x467111['query'][_0x7d59('0x41')]);_0x5819b0[_0x7d59('0x42')]=qs[_0x7d59('0x43')](_[_0x7d59('0x44')](_0x467111[_0x7d59('0x39')],_0x471d22[_0x7d59('0x43')]),_0x5bfe9e);if(_0x467111[_0x7d59('0x39')][_0x7d59('0x45')]){_0x5819b0[_0x7d59('0x42')]=_[_0x7d59('0x46')](_0x5819b0[_0x7d59('0x42')],{'$or':_['map'](_0x5bfe9e,function(_0x1bd2bc){if(_0x1bd2bc['type']!=='VIRTUAL'){var _0x1263a2={};_0x1263a2[_0x1bd2bc[_0x7d59('0x32')]]={'$like':'%'+_0x467111[_0x7d59('0x39')][_0x7d59('0x45')]+'%'};return _0x1263a2;}})});}_0x5819b0=_['merge']({},_0x5819b0,_0x467111[_0x7d59('0x47')]);var _0x1763e8={'where':_0x5819b0[_0x7d59('0x42')]};return db[_0x7d59('0x34')]['count'](_0x1763e8)[_0x7d59('0x2c')](function(_0x3b4f18){_0x30bcfa[_0x7d59('0x24')]=_0x3b4f18;if(_0x467111[_0x7d59('0x39')]['includeAll']){_0x5819b0[_0x7d59('0x48')]=[{'all':!![]}];}return db[_0x7d59('0x34')][_0x7d59('0x49')](_0x5819b0);})['then'](function(_0x2e4c0b){_0x30bcfa[_0x7d59('0x4a')]=_0x2e4c0b;return _0x30bcfa;})['then'](respondWithFilteredResult(_0x39ba68,_0x5819b0))[_0x7d59('0x4b')](handleError(_0x39ba68,null));};exports[_0x7d59('0x4c')]=function(_0x266d3b,_0x504581){var _0x227f96={'raw':!![],'where':{'id':_0x266d3b[_0x7d59('0x4d')]['id']}},_0x319f37={};_0x319f37[_0x7d59('0x38')]=_['keys'](db['SmsQueue'][_0x7d59('0x35')]);_0x319f37[_0x7d59('0x39')]=_['keys'](_0x266d3b[_0x7d59('0x39')]);_0x319f37['filters']=_[_0x7d59('0x3b')](_0x319f37[_0x7d59('0x38')],_0x319f37[_0x7d59('0x39')]);_0x227f96[_0x7d59('0x3c')]=_[_0x7d59('0x3b')](_0x319f37[_0x7d59('0x38')],qs[_0x7d59('0x3d')](_0x266d3b[_0x7d59('0x39')][_0x7d59('0x3d')]));_0x227f96[_0x7d59('0x3c')]=_0x227f96[_0x7d59('0x3c')]['length']?_0x227f96[_0x7d59('0x3c')]:_0x319f37['model'];if(_0x266d3b[_0x7d59('0x39')][_0x7d59('0x4e')]){_0x227f96[_0x7d59('0x48')]=[{'all':!![]}];}_0x227f96=_[_0x7d59('0x46')]({},_0x227f96,_0x266d3b[_0x7d59('0x47')]);return db[_0x7d59('0x34')][_0x7d59('0x4f')](_0x227f96)[_0x7d59('0x2c')](handleEntityNotFound(_0x504581,null))[_0x7d59('0x2c')](respondWithResult(_0x504581,null))[_0x7d59('0x4b')](handleError(_0x504581,null));};exports['create']=function(_0x2262b3,_0x460052){return db[_0x7d59('0x34')]['create'](_0x2262b3[_0x7d59('0x50')],{})[_0x7d59('0x2c')](function(_0x5986de){var _0x27151e=_0x2262b3[_0x7d59('0x51')][_0x7d59('0x52')]({'plain':!![]});if(!_0x27151e)throw new Error(_0x7d59('0x53'));if(_0x27151e['role']==='user'){var _0x3adab5=_0x5986de['get']({'plain':!![]});var _0x338926='SmsQueues';return db['UserProfileSection'][_0x7d59('0x4f')]({'where':{'name':_0x338926,'userProfileId':_0x27151e[_0x7d59('0x54')]},'raw':!![]})[_0x7d59('0x2c')](function(_0x54a17b){if(_0x54a17b&&_0x54a17b[_0x7d59('0x55')]===0x0){return db[_0x7d59('0x56')][_0x7d59('0x57')]({'name':_0x3adab5['name'],'resourceId':_0x3adab5['id'],'type':_0x54a17b['name'],'sectionId':_0x54a17b['id']},{})['then'](function(){return _0x5986de;});}else{return _0x5986de;}})[_0x7d59('0x4b')](function(_0x4a2593){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a2593);throw _0x4a2593;});}return _0x5986de;})[_0x7d59('0x2c')](respondWithResult(_0x460052,0xc9))[_0x7d59('0x4b')](handleError(_0x460052,null));};exports[_0x7d59('0x2b')]=function(_0x310389,_0x5f319a){if(_0x310389['body']['id']){delete _0x310389[_0x7d59('0x50')]['id'];}return db['SmsQueue'][_0x7d59('0x4f')]({'where':{'id':_0x310389[_0x7d59('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5f319a,null))[_0x7d59('0x2c')](saveUpdates(_0x310389[_0x7d59('0x50')],null))[_0x7d59('0x2c')](respondWithResult(_0x5f319a,null))[_0x7d59('0x4b')](handleError(_0x5f319a,null));};exports[_0x7d59('0x2d')]=function(_0x54a89b,_0x14000a){return db[_0x7d59('0x34')][_0x7d59('0x4f')]({'where':{'id':_0x54a89b[_0x7d59('0x4d')]['id']}})[_0x7d59('0x2c')](handleEntityNotFound(_0x14000a,null))[_0x7d59('0x2c')](removeEntity(_0x14000a,null))[_0x7d59('0x4b')](handleError(_0x14000a,null));};exports[_0x7d59('0x58')]=function(_0x31fff9,_0x20e537){return db[_0x7d59('0x34')][_0x7d59('0x58')]()['then'](respondWithResult(_0x20e537,null))[_0x7d59('0x4b')](handleError(_0x20e537,null));};exports['getMembers']=function(_0x4450a3,_0x4836e7,_0x11d5e2){var _0x1ec40e={'raw':!![],'where':{}},_0x5977c1={},_0x2612c7;return db[_0x7d59('0x34')][_0x7d59('0x59')]({'where':{'id':_0x4450a3[_0x7d59('0x4d')]['id']}})[_0x7d59('0x2c')](handleEntityNotFound(_0x4836e7,null))[_0x7d59('0x2c')](function(_0x540b61){if(_0x540b61){_0x2612c7=_0x540b61['get']({'plain':!![]});_0x5977c1[_0x7d59('0x38')]=_[_0x7d59('0x3a')](db['UserSmsQueue'][_0x7d59('0x35')]);_0x5977c1[_0x7d59('0x39')]=_[_0x7d59('0x3a')](_0x4450a3[_0x7d59('0x39')]);_0x5977c1['filters']=_[_0x7d59('0x3b')](_0x5977c1[_0x7d59('0x38')],_0x5977c1['query']);_0x1ec40e['attributes']=_[_0x7d59('0x3b')](_0x5977c1[_0x7d59('0x38')],qs['fields'](_0x4450a3[_0x7d59('0x39')]['fields']));_0x1ec40e[_0x7d59('0x3c')]=_0x1ec40e[_0x7d59('0x3c')]['length']?_0x1ec40e[_0x7d59('0x3c')]:_0x5977c1['model'];if(!_0x4450a3['query'][_0x7d59('0x3e')](_0x7d59('0x3f'))){_0x1ec40e[_0x7d59('0x25')]=qs[_0x7d59('0x25')](_0x4450a3[_0x7d59('0x39')][_0x7d59('0x25')]);_0x1ec40e['offset']=qs[_0x7d59('0x22')](_0x4450a3['query']['offset']);}_0x1ec40e[_0x7d59('0x40')]=qs[_0x7d59('0x41')](_0x4450a3[_0x7d59('0x39')][_0x7d59('0x41')]);_0x1ec40e[_0x7d59('0x42')]=qs[_0x7d59('0x43')](_[_0x7d59('0x44')](_0x4450a3[_0x7d59('0x39')],_0x5977c1[_0x7d59('0x43')]));_0x1ec40e[_0x7d59('0x42')][_0x7d59('0x5a')]=_0x540b61['id'];if(_0x4450a3['query'][_0x7d59('0x45')]){_0x1ec40e[_0x7d59('0x42')]=_[_0x7d59('0x46')](_0x1ec40e['where'],{'$or':_[_0x7d59('0x33')](_0x1ec40e[_0x7d59('0x3c')],function(_0x4ac00b){var _0x7f0f02={};_0x7f0f02[_0x4ac00b]={'$like':'%'+_0x4450a3['query'][_0x7d59('0x45')]+'%'};return _0x7f0f02;})});}_0x1ec40e=_[_0x7d59('0x46')]({},_0x1ec40e,_0x4450a3[_0x7d59('0x47')]);return db[_0x7d59('0x5b')][_0x7d59('0x49')](_0x1ec40e);}})[_0x7d59('0x2c')](function(_0x41cd28){if(_0x41cd28){return db[_0x7d59('0x5c')][_0x7d59('0x5d')]({'where':{'id':_['map'](_0x41cd28,'UserId'),'role':_0x7d59('0x5e')},'attributes':['id',_0x7d59('0x32'),_0x7d59('0x5f'),_0x7d59('0x60'),_0x7d59('0x61')]});}})['then'](function(_0x2e6399){if(_0x2e6399){return{'count':_0x2e6399[_0x7d59('0x24')],'rows':_['map'](_0x2e6399[_0x7d59('0x4a')],function(_0x5f11f8){return{'membername':_0x5f11f8[_0x7d59('0x32')],'UserId':_0x5f11f8['id'],'queue_name':_0x2612c7[_0x7d59('0x32')],'SmsQueueId':_0x2612c7['id'],'interface':util[_0x7d59('0x62')]('%s/%s','SIP',_0x5f11f8['name']),'penalty':0x0,'paused':_0x5f11f8[_0x7d59('0x5f')],'createdAt':_0x5f11f8[_0x7d59('0x61')],'updatedAt':_0x5f11f8[_0x7d59('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7d59('0x2c')](respondWithFilteredResult(_0x4836e7,_0x1ec40e))['catch'](handleError(_0x4836e7,null));};exports[_0x7d59('0x63')]=function(_0x42aee3,_0x5aa79c,_0x4c28cb){var _0x174f61={};var _0x15c13c={};var _0xe6db28;var _0x4aee0e;return db[_0x7d59('0x34')][_0x7d59('0x59')]({'where':{'id':_0x42aee3['params']['id']}})[_0x7d59('0x2c')](handleEntityNotFound(_0x5aa79c,null))[_0x7d59('0x2c')](function(_0x1c3829){if(_0x1c3829){_0xe6db28=_0x1c3829;_0x15c13c[_0x7d59('0x38')]=_[_0x7d59('0x3a')](db[_0x7d59('0x64')][_0x7d59('0x35')]);_0x15c13c['query']=_[_0x7d59('0x3a')](_0x42aee3['query']);_0x15c13c[_0x7d59('0x43')]=_[_0x7d59('0x3b')](_0x15c13c[_0x7d59('0x38')],_0x15c13c[_0x7d59('0x39')]);_0x174f61[_0x7d59('0x3c')]=_[_0x7d59('0x3b')](_0x15c13c['model'],qs[_0x7d59('0x3d')](_0x42aee3[_0x7d59('0x39')][_0x7d59('0x3d')]));_0x174f61[_0x7d59('0x3c')]=_0x174f61[_0x7d59('0x3c')][_0x7d59('0x65')]?_0x174f61[_0x7d59('0x3c')]:_0x15c13c['model'];_0x174f61[_0x7d59('0x40')]=qs['sort'](_0x42aee3[_0x7d59('0x39')][_0x7d59('0x41')]);_0x174f61['where']=qs['filters'](_[_0x7d59('0x44')](_0x42aee3[_0x7d59('0x39')],_0x15c13c['filters']));if(_0x42aee3[_0x7d59('0x39')][_0x7d59('0x45')]){_0x174f61[_0x7d59('0x42')]=_[_0x7d59('0x46')](_0x174f61[_0x7d59('0x42')],{'$or':_['map'](_0x174f61[_0x7d59('0x3c')],function(_0x218c2c){var _0x266fc7={};_0x266fc7[_0x218c2c]={'$like':'%'+_0x42aee3[_0x7d59('0x39')][_0x7d59('0x45')]+'%'};return _0x266fc7;})});}_0x174f61=_[_0x7d59('0x46')]({},_0x174f61,_0x42aee3[_0x7d59('0x47')]);return _0xe6db28['getTeams'](_0x174f61);}})[_0x7d59('0x2c')](function(_0x5dfa57){if(_0x5dfa57){_0x4aee0e=_0x5dfa57['length'];if(!_0x42aee3['query'][_0x7d59('0x3e')]('nolimit')){_0x174f61[_0x7d59('0x25')]=qs[_0x7d59('0x25')](_0x42aee3['query'][_0x7d59('0x25')]);_0x174f61['offset']=qs[_0x7d59('0x22')](_0x42aee3[_0x7d59('0x39')][_0x7d59('0x22')]);}return _0xe6db28['getTeams'](_0x174f61);}})[_0x7d59('0x2c')](function(_0x596736){if(_0x596736){return _0x596736?{'count':_0x4aee0e,'rows':_0x596736}:null;}})[_0x7d59('0x2c')](respondWithResult(_0x5aa79c,null))[_0x7d59('0x4b')](handleError(_0x5aa79c,null));};exports[_0x7d59('0x66')]=function(_0x3e9ca4,_0x596b1f,_0x14a56e){var _0x969f1=_0x3e9ca4[_0x7d59('0x50')]['ids'];return db[_0x7d59('0x64')]['findAll']({'where':{'id':_0x969f1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7d59('0x67'),'attributes':['id','name','online','voicePause',_0x7d59('0x68')],'raw':!![]}]})[_0x7d59('0x2c')](function(_0x47e395){if(_0x47e395){var _0x167486=_['flatMap'](_0x47e395,function(_0x913ea1){var _0x25ce61=_0x913ea1[_0x7d59('0x52')]({'plain':!![]});return _0x25ce61['Agents'];});return db['SmsQueue'][_0x7d59('0x4f')]({'where':{'id':_0x3e9ca4['params']['id']}})[_0x7d59('0x2c')](function(_0x2ba83f){return db[_0x7d59('0x69')][_0x7d59('0x6a')](function(_0x3f13ce){return _0x2ba83f[_0x7d59('0x66')](_0x969f1,{'transaction':_0x3f13ce})['then'](function(){return BPromise[_0x7d59('0x6b')](_0x167486,function(_0x43be3e){return db[_0x7d59('0x5b')]['findOrCreate']({'where':{'UserId':_0x43be3e['id'],'SmsQueueId':_0x3e9ca4[_0x7d59('0x4d')]['id']},'transaction':_0x3f13ce});});})[_0x7d59('0x2c')](function(){_0x167486[_0x7d59('0x6c')](function(_0x122342){socket[_0x7d59('0x6d')](_0x7d59('0x6e'),{'UserId':_0x122342['id'],'SmsQueueId':_0x2ba83f['id']});});});});});}})[_0x7d59('0x2c')](respondWithStatusCode(_0x596b1f,null))[_0x7d59('0x4b')](handleError(_0x596b1f,null));};exports[_0x7d59('0x6f')]=function(_0x547fb9,_0x5eff6d,_0x211d36){return db[_0x7d59('0x64')][_0x7d59('0x49')]({'where':{'id':_0x547fb9['query'][_0x7d59('0x70')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5eff6d,null))[_0x7d59('0x2c')](function(_0x54ff6b){var _0x58e0f3=_[_0x7d59('0x33')](_0x54ff6b,'id');var _0x2cd30f=[];var _0x1fa473=[];var _0x5a2ba7=squel[_0x7d59('0x71')]();_0x5a2ba7[_0x7d59('0x72')](_0x7d59('0x73'))[_0x7d59('0x74')](_0x7d59('0x75'),'tq')['join']('user_has_teams','ut',_0x7d59('0x76'))[_0x7d59('0x42')](_0x7d59('0x77'),_0x547fb9[_0x7d59('0x4d')]['id']);for(var _0x1e5979=0x0;_0x1e5979<_0x54ff6b[_0x7d59('0x65')];_0x1e5979+=0x1){let _0x139205=_0x54ff6b[_0x1e5979];for(var _0x29d5df=0x0;_0x29d5df<_0x139205[_0x7d59('0x67')][_0x7d59('0x65')];_0x29d5df+=0x1){let _0x53d851=_0x139205[_0x7d59('0x67')][_0x29d5df];var _0x81c429=_0x5a2ba7[_0x7d59('0x78')]();_0x81c429[_0x7d59('0x42')](_0x7d59('0x79'),_0x53d851['id']);_0x1fa473[_0x7d59('0x7a')](db[_0x7d59('0x69')][_0x7d59('0x39')](_0x81c429[_0x7d59('0x7b')](),{'type':db[_0x7d59('0x69')][_0x7d59('0x7c')][_0x7d59('0x7d')]})[_0x7d59('0x2c')](function(_0x54c0e7){if(_0x54c0e7[_0x7d59('0x65')]===0x1){return _0x53d851['id'];}else{var _0x55edd4=_['every'](_['map'](_0x54c0e7,_0x7d59('0x7e')),function(_0x5d1b8d){return _[_0x7d59('0x7f')](_0x58e0f3,_0x5d1b8d);});if(_0x55edd4){return _0x53d851['id'];}}}));}}return BPromise[_0x7d59('0x80')](_0x1fa473)[_0x7d59('0x2c')](function(_0x5a0968){_0x2cd30f=_(_0x2cd30f)[_0x7d59('0x81')](_0x5a0968)[_0x7d59('0x82')]()[_0x7d59('0x83')]();return db['SmsQueue'][_0x7d59('0x4f')]({'where':{'id':_0x547fb9[_0x7d59('0x4d')]['id']}})[_0x7d59('0x2c')](function(_0x2cbd83){return db[_0x7d59('0x69')][_0x7d59('0x6a')](function(_0x4f2568){return _0x2cbd83['removeTeams'](_0x547fb9[_0x7d59('0x39')]['ids'],{'transaction':_0x4f2568})[_0x7d59('0x2c')](function(){if(!_[_0x7d59('0x84')](_0x2cd30f)){return _0x2cbd83[_0x7d59('0x85')](_0x2cd30f,{'transaction':_0x4f2568});}})['then'](function(){_0x2cd30f[_0x7d59('0x6c')](function(_0x404b58){socket[_0x7d59('0x6d')](_0x7d59('0x86'),{'UserId':_0x404b58,'SmsQueueId':_0x2cbd83['id']});});});});});});})[_0x7d59('0x2c')](respondWithStatusCode(_0x5eff6d,null))[_0x7d59('0x4b')](handleError(_0x5eff6d,null));};exports[_0x7d59('0x87')]=function(_0x4ab62a,_0x1db072,_0x188cdf){return db[_0x7d59('0x34')][_0x7d59('0x4f')]({'where':{'id':_0x4ab62a[_0x7d59('0x4d')]['id']}})[_0x7d59('0x2c')](handleEntityNotFound(_0x1db072,null))[_0x7d59('0x2c')](function(_0x147bf4){if(_0x147bf4){return _0x147bf4[_0x7d59('0x87')](_0x4ab62a[_0x7d59('0x50')][_0x7d59('0x70')],_['omit'](_0x4ab62a[_0x7d59('0x50')],[_0x7d59('0x70'),'id'])||{})[_0x7d59('0x88')](function(_0x3db5bf){for(var _0x5e45c8=0x0;_0x5e45c8<_0x4ab62a['body'][_0x7d59('0x70')][_0x7d59('0x65')];_0x5e45c8+=0x1){socket[_0x7d59('0x6d')](_0x7d59('0x6e'),{'UserId':Number(_0x4ab62a['body'][_0x7d59('0x70')][_0x5e45c8]),'SmsQueueId':Number(_0x4ab62a[_0x7d59('0x4d')]['id'])});}return _0x3db5bf;});}})[_0x7d59('0x2c')](respondWithResult(_0x1db072,null))[_0x7d59('0x4b')](handleError(_0x1db072,null));};exports[_0x7d59('0x85')]=function(_0x232836,_0x1c53a9,_0x39b113){return db[_0x7d59('0x34')]['find']({'where':{'id':_0x232836[_0x7d59('0x4d')]['id']}})[_0x7d59('0x2c')](handleEntityNotFound(_0x1c53a9,null))[_0x7d59('0x2c')](function(_0x31664a){if(_0x31664a){return _0x31664a['removeAgents'](_0x232836[_0x7d59('0x39')][_0x7d59('0x70')])[_0x7d59('0x2c')](function(){if(_['isArray'](_0x232836[_0x7d59('0x39')][_0x7d59('0x70')])){for(var _0xb28215=0x0;_0xb28215<_0x232836[_0x7d59('0x39')][_0x7d59('0x70')][_0x7d59('0x65')];_0xb28215+=0x1){socket[_0x7d59('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x232836[_0x7d59('0x39')][_0x7d59('0x70')][_0xb28215]),'SmsQueueId':Number(_0x232836[_0x7d59('0x4d')]['id'])});}}else{socket[_0x7d59('0x6d')](_0x7d59('0x86'),{'UserId':Number(_0x232836[_0x7d59('0x39')][_0x7d59('0x70')]),'SmsQueueId':Number(_0x232836[_0x7d59('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x1c53a9,null))[_0x7d59('0x4b')](handleError(_0x1c53a9,null));};exports[_0x7d59('0x89')]=function(_0x4af6d7,_0x3a7cc3,_0x4b6b4c){var _0x37918a={};var _0x53d062={};var _0x45b529;var _0x3fde88;return db['SmsQueue'][_0x7d59('0x59')]({'where':{'id':_0x4af6d7[_0x7d59('0x4d')]['id']}})[_0x7d59('0x2c')](handleEntityNotFound(_0x3a7cc3,null))[_0x7d59('0x2c')](function(_0x38bc84){if(_0x38bc84){_0x45b529=_0x38bc84;_0x53d062[_0x7d59('0x38')]=_[_0x7d59('0x3a')](db[_0x7d59('0x5c')][_0x7d59('0x35')]);_0x53d062[_0x7d59('0x39')]=_['keys'](_0x4af6d7[_0x7d59('0x39')]);_0x53d062[_0x7d59('0x43')]=_['intersection'](_0x53d062[_0x7d59('0x38')],_0x53d062[_0x7d59('0x39')]);_0x37918a[_0x7d59('0x3c')]=_[_0x7d59('0x3b')](_0x53d062['model'],qs['fields'](_0x4af6d7[_0x7d59('0x39')]['fields']));_0x37918a[_0x7d59('0x3c')]=_0x37918a['attributes']['length']?_0x37918a[_0x7d59('0x3c')]:_0x53d062['model'];_0x37918a['order']=qs[_0x7d59('0x41')](_0x4af6d7[_0x7d59('0x39')][_0x7d59('0x41')]);_0x37918a[_0x7d59('0x42')]=qs[_0x7d59('0x43')](_[_0x7d59('0x44')](_0x4af6d7[_0x7d59('0x39')],_0x53d062['filters']));if(_0x4af6d7[_0x7d59('0x39')][_0x7d59('0x45')]){_0x37918a[_0x7d59('0x42')]=_[_0x7d59('0x46')](_0x37918a['where'],{'$or':_[_0x7d59('0x33')](_0x37918a['attributes'],function(_0x35584c){var _0x1f4d9c={};_0x1f4d9c[_0x35584c]={'$like':'%'+_0x4af6d7[_0x7d59('0x39')][_0x7d59('0x45')]+'%'};return _0x1f4d9c;})});}_0x37918a=_['merge']({},_0x37918a,_0x4af6d7['options']);return _0x45b529['getAgents'](_0x37918a);}})[_0x7d59('0x2c')](function(_0x104754){if(_0x104754){_0x3fde88=_0x104754[_0x7d59('0x65')];if(!_0x4af6d7[_0x7d59('0x39')][_0x7d59('0x3e')](_0x7d59('0x3f'))){_0x37918a[_0x7d59('0x25')]=qs['limit'](_0x4af6d7[_0x7d59('0x39')]['limit']);_0x37918a[_0x7d59('0x22')]=qs[_0x7d59('0x22')](_0x4af6d7[_0x7d59('0x39')][_0x7d59('0x22')]);}return _0x45b529[_0x7d59('0x89')](_0x37918a);}})[_0x7d59('0x2c')](function(_0x5e2c62){if(_0x5e2c62){return _0x5e2c62?{'count':_0x3fde88,'rows':_0x5e2c62}:null;}})[_0x7d59('0x2c')](respondWithResult(_0x3a7cc3,null))[_0x7d59('0x4b')](handleError(_0x3a7cc3,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 1884eca..fb2ce98 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 _0xfdf2=['events','setMaxListeners','save','update','emit','hook','exports'];(function(_0x1b3a09,_0x20c774){var _0x357bb8=function(_0xd7c6d2){while(--_0xd7c6d2){_0x1b3a09['push'](_0x1b3a09['shift']());}};_0x357bb8(++_0x20c774);}(_0xfdf2,0x1f1));var _0x2fdf=function(_0x116b3d,_0x4a6e8b){_0x116b3d=_0x116b3d-0x0;var _0x1a2fe7=_0xfdf2[_0x116b3d];return _0x1a2fe7;};'use strict';var EventEmitter=require(_0x2fdf('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2fdf('0x1')](0x0);var events={'afterCreate':_0x2fdf('0x2'),'afterUpdate':_0x2fdf('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5f1faf){return function(_0x48b862,_0x440100,_0x101638){SmsQueueEvents[_0x2fdf('0x4')](_0x5f1faf+':'+_0x48b862['id'],_0x48b862);SmsQueueEvents[_0x2fdf('0x4')](_0x5f1faf,_0x48b862);_0x101638(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x2fdf('0x5')](e,emitEvent(event));}}module[_0x2fdf('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x1578=['hook','exports','events','save','remove','emit'];(function(_0x36de4f,_0x350d30){var _0x1a91c2=function(_0x475034){while(--_0x475034){_0x36de4f['push'](_0x36de4f['shift']());}};_0x1a91c2(++_0x350d30);}(_0x1578,0x1e8));var _0x8157=function(_0x4a22d7,_0x4c09bc){_0x4a22d7=_0x4a22d7-0x0;var _0x56cfd9=_0x1578[_0x4a22d7];return _0x56cfd9;};'use strict';var EventEmitter=require(_0x8157('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8157('0x1'),'afterUpdate':'update','afterDestroy':_0x8157('0x2')};function emitEvent(_0x2a47dd){return function(_0x1bcc9c,_0x192502,_0x4bd6bb){SmsQueueEvents[_0x8157('0x3')](_0x2a47dd+':'+_0x1bcc9c['id'],_0x1bcc9c);SmsQueueEvents['emit'](_0x2a47dd,_0x1bcc9c);_0x4bd6bb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x8157('0x4')](e,emitEvent(event));}}module[_0x8157('0x5')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 875cc24..0109395 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 _0x5811=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','sms_queues','lodash'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x5811,0x175));var _0x1581=function(_0x258760,_0x55a0b5){_0x258760=_0x258760-0x0;var _0x2d3296=_0x5811[_0x258760];return _0x2d3296;};'use strict';var _=require(_0x1581('0x0'));var util=require(_0x1581('0x1'));var logger=require('../../config/logger')(_0x1581('0x2'));var moment=require(_0x1581('0x3'));var BPromise=require(_0x1581('0x4'));var rp=require(_0x1581('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1581('0x6'));var config=require(_0x1581('0x7'));var attributes=require('./smsQueue.attributes');module[_0x1581('0x8')]=function(_0x1ed23f,_0x16cd6c){return _0x1ed23f[_0x1581('0x9')]('SmsQueue',attributes,{'tableName':_0x1581('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84dd=['../../config/environment','define','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2041f7,_0x2c3837){var _0x256281=function(_0x279aaa){while(--_0x279aaa){_0x2041f7['push'](_0x2041f7['shift']());}};_0x256281(++_0x2c3837);}(_0x84dd,0x1cd));var _0xd84d=function(_0x59ca8e,_0x4c18dd){_0x59ca8e=_0x59ca8e-0x0;var _0x51e5bc=_0x84dd[_0x59ca8e];return _0x51e5bc;};'use strict';var _=require('lodash');var util=require(_0xd84d('0x0'));var logger=require(_0xd84d('0x1'))(_0xd84d('0x2'));var moment=require(_0xd84d('0x3'));var BPromise=require('bluebird');var rp=require(_0xd84d('0x4'));var fs=require('fs');var path=require(_0xd84d('0x5'));var rimraf=require(_0xd84d('0x6'));var config=require(_0xd84d('0x7'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x5310f2,_0x3ba4ff){return _0x5310f2[_0xd84d('0x8')]('SmsQueue',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 3a81f06..20afdab 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 _0x25e3=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','include','map','model','debug','ShowSmsQueue','where','lodash'];(function(_0x2de21f,_0x48c48c){var _0x29864f=function(_0x2e2305){while(--_0x2e2305){_0x2de21f['push'](_0x2de21f['shift']());}};_0x29864f(++_0x48c48c);}(_0x25e3,0x1eb));var _0x325e=function(_0x3657a4,_0x560336){_0x3657a4=_0x3657a4-0x0;var _0x33b41a=_0x25e3[_0x3657a4];return _0x33b41a;};'use strict';var _=require(_0x325e('0x0'));var util=require(_0x325e('0x1'));var moment=require(_0x325e('0x2'));var BPromise=require(_0x325e('0x3'));var rs=require(_0x325e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x325e('0x5'));var logger=require(_0x325e('0x6'))(_0x325e('0x7'));var config=require(_0x325e('0x8'));var jayson=require(_0x325e('0x9'));var client=jayson[_0x325e('0xa')][_0x325e('0xb')]({'port':0x232a});config[_0x325e('0xc')]=_[_0x325e('0xd')](config[_0x325e('0xc')],{'host':_0x325e('0xe'),'port':0x18eb});var socket=require(_0x325e('0xf'))(new Redis(config[_0x325e('0xc')]));require(_0x325e('0x10'))[_0x325e('0x11')](socket);function respondWithRpcPromise(_0x7f34cc,_0x1ec811,_0x539b92){return new BPromise(function(_0xe4845e,_0xc4f1ff){return client[_0x325e('0x12')](_0x7f34cc,_0x539b92)[_0x325e('0x13')](function(_0x192584){logger[_0x325e('0x14')](_0x325e('0x15'),_0x1ec811,'request\x20sent');logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x1ec811,'request\x20sent',JSON[_0x325e('0x16')](_0x192584));if(_0x192584['error']){if(_0x192584[_0x325e('0x17')]['code']===0x1f4){logger[_0x325e('0x17')](_0x325e('0x15'),_0x1ec811,_0x192584[_0x325e('0x17')][_0x325e('0x18')]);return _0xc4f1ff(_0x192584['error']['message']);}logger['error'](_0x325e('0x15'),_0x1ec811,_0x192584[_0x325e('0x17')][_0x325e('0x18')]);return _0xe4845e(_0x192584['error'][_0x325e('0x18')]);}else{logger[_0x325e('0x14')](_0x325e('0x15'),_0x1ec811,_0x325e('0x19'));_0xe4845e(_0x192584[_0x325e('0x1a')][_0x325e('0x18')]);}})[_0x325e('0x1b')](function(_0x292414){logger[_0x325e('0x17')](_0x325e('0x15'),_0x1ec811,_0x292414);_0xc4f1ff(_0x292414);});});}exports[_0x325e('0x1c')]=function(_0x584590){var _0x365219=this;return new Promise(function(_0x12be0a,_0x451e86){return db[_0x325e('0x1d')][_0x325e('0x1e')]({'raw':_0x584590[_0x325e('0x1f')]?_0x584590[_0x325e('0x1f')][_0x325e('0x20')]===undefined?!![]:![]:!![],'where':_0x584590[_0x325e('0x1f')]?_0x584590[_0x325e('0x1f')]['where']||null:null,'attributes':_0x584590['options']?_0x584590[_0x325e('0x1f')][_0x325e('0x21')]||null:null,'limit':_0x584590['options']?_0x584590['options'][_0x325e('0x22')]||null:null,'include':_0x584590['options']?_0x584590['options'][_0x325e('0x23')]?_[_0x325e('0x24')](_0x584590[_0x325e('0x1f')][_0x325e('0x23')],function(_0x185dc1){return{'model':db[_0x185dc1[_0x325e('0x25')]],'as':_0x185dc1['as'],'attributes':_0x185dc1[_0x325e('0x21')],'include':_0x185dc1[_0x325e('0x23')]?_['map'](_0x185dc1[_0x325e('0x23')],function(_0x72c81c){return{'model':db[_0x72c81c[_0x325e('0x25')]],'as':_0x72c81c['as'],'attributes':_0x72c81c[_0x325e('0x21')],'include':_0x72c81c['include']?_[_0x325e('0x24')](_0x72c81c['include'],function(_0x3e4405){return{'model':db[_0x3e4405[_0x325e('0x25')]],'as':_0x3e4405['as'],'attributes':_0x3e4405['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xac853d){logger[_0x325e('0x14')](_0x325e('0x1c'),_0x584590);logger[_0x325e('0x26')](_0x325e('0x1c'),_0x584590,JSON[_0x325e('0x16')](_0xac853d));_0x12be0a(_0xac853d);})[_0x325e('0x1b')](function(_0x4e40f5){logger[_0x325e('0x17')](_0x325e('0x1c'),_0x4e40f5[_0x325e('0x18')],_0x584590);_0x451e86(_0x365219[_0x325e('0x17')](0x1f4,_0x4e40f5[_0x325e('0x18')]));});});};exports[_0x325e('0x27')]=function(_0x50729b){var _0x5c0fa4=this;return new Promise(function(_0x46fa98,_0x1ebcc7){return db[_0x325e('0x1d')]['find']({'raw':_0x50729b[_0x325e('0x1f')]?_0x50729b['options'][_0x325e('0x20')]===undefined?!![]:![]:!![],'where':_0x50729b[_0x325e('0x1f')]?_0x50729b[_0x325e('0x1f')][_0x325e('0x28')]||null:null,'attributes':_0x50729b['options']?_0x50729b['options'][_0x325e('0x21')]||null:null,'include':_0x50729b[_0x325e('0x1f')]?_0x50729b['options'][_0x325e('0x23')]?_['map'](_0x50729b[_0x325e('0x1f')][_0x325e('0x23')],function(_0x3d16cf){return{'model':db[_0x3d16cf[_0x325e('0x25')]],'as':_0x3d16cf['as'],'attributes':_0x3d16cf[_0x325e('0x21')],'include':_0x3d16cf[_0x325e('0x23')]?_[_0x325e('0x24')](_0x3d16cf['include'],function(_0x38b4a3){return{'model':db[_0x38b4a3[_0x325e('0x25')]],'as':_0x38b4a3['as'],'attributes':_0x38b4a3[_0x325e('0x21')],'include':_0x38b4a3[_0x325e('0x23')]?_[_0x325e('0x24')](_0x38b4a3[_0x325e('0x23')],function(_0x177237){return{'model':db[_0x177237[_0x325e('0x25')]],'as':_0x177237['as'],'attributes':_0x177237[_0x325e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x325e('0x13')](function(_0x5ece9d){logger[_0x325e('0x14')](_0x325e('0x27'),_0x50729b);logger['debug'](_0x325e('0x27'),_0x50729b,JSON[_0x325e('0x16')](_0x5ece9d));_0x46fa98(_0x5ece9d);})[_0x325e('0x1b')](function(_0x47cee7){logger['error']('ShowSmsQueue',_0x47cee7[_0x325e('0x18')],_0x50729b);_0x1ebcc7(_0x5c0fa4[_0x325e('0x17')](0x1f4,_0x47cee7[_0x325e('0x18')]));});});}; \ No newline at end of file +var _0x058d=['ShowSmsQueue','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','request','then','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','info','result','catch','findAll','options','where','attributes','limit','include','map','model','GetSmsQueue','debug','SmsQueue','find'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x058d,0xce));var _0xd058=function(_0x38c3ee,_0x3d6dca){_0x38c3ee=_0x38c3ee-0x0;var _0x1bb077=_0x058d[_0x38c3ee];return _0x1bb077;};'use strict';var _=require('lodash');var util=require(_0xd058('0x0'));var moment=require(_0xd058('0x1'));var BPromise=require(_0xd058('0x2'));var rs=require(_0xd058('0x3'));var fs=require('fs');var Redis=require(_0xd058('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd058('0x5'));var logger=require(_0xd058('0x6'))(_0xd058('0x7'));var config=require(_0xd058('0x8'));var jayson=require(_0xd058('0x9'));var client=jayson[_0xd058('0xa')]['http']({'port':0x232a});config[_0xd058('0xb')]=_[_0xd058('0xc')](config['redis'],{'host':_0xd058('0xd'),'port':0x18eb});var socket=require(_0xd058('0xe'))(new Redis(config['redis']));require(_0xd058('0xf'))['register'](socket);function respondWithRpcPromise(_0x3c302c,_0x17bb1a,_0x15253a){return new BPromise(function(_0x274775,_0x907442){return client[_0xd058('0x10')](_0x3c302c,_0x15253a)[_0xd058('0x11')](function(_0x4953b3){logger['info']('SmsQueue,\x20%s,\x20%s',_0x17bb1a,_0xd058('0x12'));logger['debug'](_0xd058('0x13'),_0x17bb1a,_0xd058('0x12'),JSON[_0xd058('0x14')](_0x4953b3));if(_0x4953b3[_0xd058('0x15')]){if(_0x4953b3['error'][_0xd058('0x16')]===0x1f4){logger[_0xd058('0x15')](_0xd058('0x17'),_0x17bb1a,_0x4953b3['error'][_0xd058('0x18')]);return _0x907442(_0x4953b3[_0xd058('0x15')][_0xd058('0x18')]);}logger[_0xd058('0x15')](_0xd058('0x17'),_0x17bb1a,_0x4953b3['error'][_0xd058('0x18')]);return _0x274775(_0x4953b3[_0xd058('0x15')][_0xd058('0x18')]);}else{logger[_0xd058('0x19')](_0xd058('0x17'),_0x17bb1a,'request\x20sent');_0x274775(_0x4953b3[_0xd058('0x1a')][_0xd058('0x18')]);}})[_0xd058('0x1b')](function(_0x39697f){logger[_0xd058('0x15')](_0xd058('0x17'),_0x17bb1a,_0x39697f);_0x907442(_0x39697f);});});}exports['GetSmsQueue']=function(_0x515504){var _0x159565=this;return new Promise(function(_0x43baea,_0x225756){return db['SmsQueue'][_0xd058('0x1c')]({'raw':_0x515504[_0xd058('0x1d')]?_0x515504['options']['raw']===undefined?!![]:![]:!![],'where':_0x515504[_0xd058('0x1d')]?_0x515504[_0xd058('0x1d')][_0xd058('0x1e')]||null:null,'attributes':_0x515504[_0xd058('0x1d')]?_0x515504['options'][_0xd058('0x1f')]||null:null,'limit':_0x515504['options']?_0x515504[_0xd058('0x1d')][_0xd058('0x20')]||null:null,'include':_0x515504['options']?_0x515504[_0xd058('0x1d')][_0xd058('0x21')]?_[_0xd058('0x22')](_0x515504[_0xd058('0x1d')]['include'],function(_0x1f7b31){return{'model':db[_0x1f7b31['model']],'as':_0x1f7b31['as'],'attributes':_0x1f7b31[_0xd058('0x1f')],'include':_0x1f7b31[_0xd058('0x21')]?_['map'](_0x1f7b31['include'],function(_0x19584c){return{'model':db[_0x19584c[_0xd058('0x23')]],'as':_0x19584c['as'],'attributes':_0x19584c['attributes'],'include':_0x19584c[_0xd058('0x21')]?_[_0xd058('0x22')](_0x19584c[_0xd058('0x21')],function(_0x11b66b){return{'model':db[_0x11b66b[_0xd058('0x23')]],'as':_0x11b66b['as'],'attributes':_0x11b66b[_0xd058('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd058('0x11')](function(_0x301516){logger[_0xd058('0x19')](_0xd058('0x24'),_0x515504);logger[_0xd058('0x25')]('GetSmsQueue',_0x515504,JSON[_0xd058('0x14')](_0x301516));_0x43baea(_0x301516);})[_0xd058('0x1b')](function(_0x298f0e){logger[_0xd058('0x15')]('GetSmsQueue',_0x298f0e[_0xd058('0x18')],_0x515504);_0x225756(_0x159565['error'](0x1f4,_0x298f0e[_0xd058('0x18')]));});});};exports['ShowSmsQueue']=function(_0x2d73db){var _0x40bdf7=this;return new Promise(function(_0x5a1e0f,_0x229a96){return db[_0xd058('0x26')][_0xd058('0x27')]({'raw':_0x2d73db[_0xd058('0x1d')]?_0x2d73db['options']['raw']===undefined?!![]:![]:!![],'where':_0x2d73db['options']?_0x2d73db[_0xd058('0x1d')][_0xd058('0x1e')]||null:null,'attributes':_0x2d73db['options']?_0x2d73db[_0xd058('0x1d')]['attributes']||null:null,'include':_0x2d73db['options']?_0x2d73db[_0xd058('0x1d')][_0xd058('0x21')]?_[_0xd058('0x22')](_0x2d73db[_0xd058('0x1d')][_0xd058('0x21')],function(_0x502142){return{'model':db[_0x502142['model']],'as':_0x502142['as'],'attributes':_0x502142[_0xd058('0x1f')],'include':_0x502142[_0xd058('0x21')]?_[_0xd058('0x22')](_0x502142[_0xd058('0x21')],function(_0x2547d3){return{'model':db[_0x2547d3[_0xd058('0x23')]],'as':_0x2547d3['as'],'attributes':_0x2547d3['attributes'],'include':_0x2547d3[_0xd058('0x21')]?_[_0xd058('0x22')](_0x2547d3[_0xd058('0x21')],function(_0x1dba4a){return{'model':db[_0x1dba4a['model']],'as':_0x1dba4a['as'],'attributes':_0x1dba4a[_0xd058('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd058('0x11')](function(_0x35aa9c){logger['info'](_0xd058('0x28'),_0x2d73db);logger[_0xd058('0x25')](_0xd058('0x28'),_0x2d73db,JSON[_0xd058('0x14')](_0x35aa9c));_0x5a1e0f(_0x35aa9c);})[_0xd058('0x1b')](function(_0x3d757c){logger[_0xd058('0x15')]('ShowSmsQueue',_0x3d757c['message'],_0x2d73db);_0x229a96(_0x40bdf7['error'](0x1f4,_0x3d757c['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index a9faa42..1be2d23 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 _0x3e1b=['removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x30d219,_0x2d05f4){var _0x4ad9df=function(_0x47f736){while(--_0x47f736){_0x30d219['push'](_0x30d219['shift']());}};_0x4ad9df(++_0x2d05f4);}(_0x3e1b,0x8c));var _0xb3e1=function(_0x135931,_0x20ff12){_0x135931=_0x135931-0x0;var _0xd06c48=_0x3e1b[_0x135931];return _0xd06c48;};'use strict';var SmsQueueEvents=require(_0xb3e1('0x0'));var events=[_0xb3e1('0x1'),_0xb3e1('0x2'),_0xb3e1('0x3')];function createListener(_0x1cd052,_0x4913a1){return function(_0x2bb03d){_0x4913a1['emit'](_0x1cd052,_0x2bb03d);};}function removeListener(_0x8ca57d,_0x24d717){return function(){SmsQueueEvents[_0xb3e1('0x4')](_0x8ca57d,_0x24d717);};}exports[_0xb3e1('0x5')]=function(_0x17eb37){for(var _0x22e753=0x0,_0x1f95e1=events[_0xb3e1('0x6')];_0x22e753<_0x1f95e1;_0x22e753++){var _0x1d417b=events[_0x22e753];var _0x4f3ccf=createListener(_0xb3e1('0x7')+_0x1d417b,_0x17eb37);SmsQueueEvents['on'](_0x1d417b,_0x4f3ccf);}}; \ No newline at end of file +var _0x3cce=['length','save','remove','update','removeListener'];(function(_0xf389bb,_0x11bce6){var _0xb03f28=function(_0x37578c){while(--_0x37578c){_0xf389bb['push'](_0xf389bb['shift']());}};_0xb03f28(++_0x11bce6);}(_0x3cce,0x1b9));var _0xe3cc=function(_0x5601f6,_0x1651f2){_0x5601f6=_0x5601f6-0x0;var _0x1a3b64=_0x3cce[_0x5601f6];return _0x1a3b64;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xe3cc('0x0'),_0xe3cc('0x1'),_0xe3cc('0x2')];function createListener(_0x20b968,_0x5736b9){return function(_0x18b7e6){_0x5736b9['emit'](_0x20b968,_0x18b7e6);};}function removeListener(_0x35df58,_0x140aae){return function(){SmsQueueEvents[_0xe3cc('0x3')](_0x35df58,_0x140aae);};}exports['register']=function(_0x495cda){for(var _0x5a8519=0x0,_0x255631=events[_0xe3cc('0x4')];_0x5a8519<_0x255631;_0x5a8519++){var _0x3357e1=events[_0x5a8519];var _0x1f4598=createListener('smsQueue:'+_0x3357e1,_0x495cda);SmsQueueEvents['on'](_0x3357e1,_0x1f4598);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index e5928b3..e6d626e 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 _0x6003=['delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','index','isAuthenticated','show','post','put','/:id','update'];(function(_0x3540de,_0x13a960){var _0x5a1c49=function(_0x170437){while(--_0x170437){_0x3540de['push'](_0x3540de['shift']());}};_0x5a1c49(++_0x13a960);}(_0x6003,0xae));var _0x3600=function(_0x163c28,_0xcb1fc5){_0x163c28=_0x163c28-0x0;var _0x389bd8=_0x6003[_0x163c28];return _0x389bd8;};'use strict';var multer=require(_0x3600('0x0'));var util=require(_0x3600('0x1'));var path=require(_0x3600('0x2'));var timeout=require(_0x3600('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3600('0x4'));var auth=require(_0x3600('0x5'));var interaction=require(_0x3600('0x6'));var config=require('../../config/environment');var controller=require(_0x3600('0x7'));router[_0x3600('0x8')]('/',auth['isAuthenticated'](),controller[_0x3600('0x9')]);router['get']('/describe',auth[_0x3600('0xa')](),controller['describe']);router[_0x3600('0x8')]('/:id',auth[_0x3600('0xa')](),controller[_0x3600('0xb')]);router[_0x3600('0xc')]('/',auth[_0x3600('0xa')](),controller['create']);router[_0x3600('0xd')](_0x3600('0xe'),auth[_0x3600('0xa')](),controller[_0x3600('0xf')]);router[_0x3600('0x10')](_0x3600('0xe'),auth[_0x3600('0xa')](),controller[_0x3600('0x11')]);module[_0x3600('0x12')]=router; \ No newline at end of file +var _0x254a=['/:id','show','post','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x5027b1,_0x6c2346){var _0x5ef581=function(_0xb14398){while(--_0xb14398){_0x5027b1['push'](_0x5027b1['shift']());}};_0x5ef581(++_0x6c2346);}(_0x254a,0x138));var _0xa254=function(_0x39ff0c,_0x2069c7){_0x39ff0c=_0x39ff0c-0x0;var _0x5c4ca6=_0x254a[_0x39ff0c];return _0x5c4ca6;};'use strict';var multer=require(_0xa254('0x0'));var util=require(_0xa254('0x1'));var path=require(_0xa254('0x2'));var timeout=require('connect-timeout');var express=require(_0xa254('0x3'));var router=express[_0xa254('0x4')]();var fs_extra=require(_0xa254('0x5'));var auth=require(_0xa254('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa254('0x7'));var controller=require('./smsQueueReport.controller');router[_0xa254('0x8')]('/',auth[_0xa254('0x9')](),controller[_0xa254('0xa')]);router['get']('/describe',auth[_0xa254('0x9')](),controller[_0xa254('0xb')]);router['get'](_0xa254('0xc'),auth['isAuthenticated'](),controller[_0xa254('0xd')]);router[_0xa254('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa254('0xf')](_0xa254('0xc'),auth[_0xa254('0x9')](),controller[_0xa254('0x10')]);router[_0xa254('0x11')]('/:id',auth[_0xa254('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 6d4c3a6..ac3d63f 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 _0x25dd=['sequelize','exports','STRING','DATE'];(function(_0xe39824,_0xbdf61f){var _0x4bc31e=function(_0x594760){while(--_0x594760){_0xe39824['push'](_0xe39824['shift']());}};_0x4bc31e(++_0xbdf61f);}(_0x25dd,0x90));var _0xd25d=function(_0x367fdc,_0x71f9cd){_0x367fdc=_0x367fdc-0x0;var _0x75c4ff=_0x25dd[_0x367fdc];return _0x75c4ff;};'use strict';var moment=require('moment');var Sequelize=require(_0xd25d('0x0'));module[_0xd25d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd25d('0x2')]},'joinAt':{'type':Sequelize[_0xd25d('0x3')]},'leaveAt':{'type':Sequelize[_0xd25d('0x3')]},'acceptAt':{'type':Sequelize[_0xd25d('0x3')]},'exitAt':{'type':Sequelize[_0xd25d('0x3')]},'reason':{'type':Sequelize[_0xd25d('0x2')]}}; \ No newline at end of file +var _0xb64b=['moment','sequelize','exports','DATE','STRING'];(function(_0x577fb4,_0x15da29){var _0xfe4709=function(_0x4cd0d9){while(--_0x4cd0d9){_0x577fb4['push'](_0x577fb4['shift']());}};_0xfe4709(++_0x15da29);}(_0xb64b,0x11d));var _0xbb64=function(_0x45dfd0,_0x43439b){_0x45dfd0=_0x45dfd0-0x0;var _0x1df4a2=_0xb64b[_0x45dfd0];return _0x1df4a2;};'use strict';var moment=require(_0xbb64('0x0'));var Sequelize=require(_0xbb64('0x1'));module[_0xbb64('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xbb64('0x3')]},'leaveAt':{'type':Sequelize[_0xbb64('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xbb64('0x3')]},'reason':{'type':Sequelize[_0xbb64('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 1c50663..883ee49 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 _0x1df4=['set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','SmsQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','catch','create','find','params','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x1df4,0x77));var _0x41df=function(_0x441b71,_0x137953){_0x441b71=_0x441b71-0x0;var _0x30691a=_0x1df4[_0x441b71];return _0x30691a;};'use strict';var emlformat=require(_0x41df('0x0'));var rimraf=require(_0x41df('0x1'));var zipdir=require(_0x41df('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x41df('0x3'));var moment=require(_0x41df('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x41df('0x5'));var util=require(_0x41df('0x6'));var path=require(_0x41df('0x7'));var sox=require(_0x41df('0x8'));var csv=require(_0x41df('0x9'));var ejs=require(_0x41df('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41df('0xb'));var squel=require(_0x41df('0xc'));var crypto=require(_0x41df('0xd'));var jsforce=require(_0x41df('0xe'));var deskjs=require(_0x41df('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x41df('0x10'));var Redis=require(_0x41df('0x11'));var authService=require(_0x41df('0x12'));var qs=require(_0x41df('0x13'));var as=require(_0x41df('0x14'));var hardwareService=require(_0x41df('0x15'));var logger=require('../../config/logger')(_0x41df('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x41df('0x17'));var db=require(_0x41df('0x18'))['db'];function respondWithStatusCode(_0x225595,_0x16daa0){_0x16daa0=_0x16daa0||0xcc;return function(_0x2dd2b1){if(_0x2dd2b1){return _0x225595[_0x41df('0x19')](_0x16daa0);}return _0x225595['status'](_0x16daa0)[_0x41df('0x1a')]();};}function respondWithResult(_0x17358a,_0x1df598){_0x1df598=_0x1df598||0xc8;return function(_0x37ae0f){if(_0x37ae0f){return _0x17358a[_0x41df('0x1b')](_0x1df598)[_0x41df('0x1c')](_0x37ae0f);}};}function respondWithFilteredResult(_0x37d04b,_0x3b73a6){return function(_0x5d579b){if(_0x5d579b){var _0x74aa9c=typeof _0x3b73a6['offset']===_0x41df('0x1d')&&typeof _0x3b73a6['limit']===_0x41df('0x1d');var _0x2a7cae=_0x5d579b[_0x41df('0x1e')];var _0x49ba86=_0x74aa9c?0x0:_0x3b73a6[_0x41df('0x1f')];var _0x27ed72=_0x74aa9c?_0x5d579b[_0x41df('0x1e')]:_0x3b73a6['offset']+_0x3b73a6[_0x41df('0x20')];var _0x2ad096;if(_0x27ed72>=_0x2a7cae){_0x27ed72=_0x2a7cae;_0x2ad096=0xc8;}else{_0x2ad096=0xce;}_0x37d04b['status'](_0x2ad096);return _0x37d04b[_0x41df('0x21')](_0x41df('0x22'),_0x49ba86+'-'+_0x27ed72+'/'+_0x2a7cae)[_0x41df('0x1c')](_0x5d579b);}return null;};}function patchUpdates(_0x520b63){return function(_0xef927d){try{jsonpatch[_0x41df('0x23')](_0xef927d,_0x520b63,!![]);}catch(_0x36f067){return BPromise[_0x41df('0x24')](_0x36f067);}return _0xef927d[_0x41df('0x25')]();};}function saveUpdates(_0x5dc0f0,_0xf6a9cd){return function(_0x490d51){if(_0x490d51){return _0x490d51[_0x41df('0x26')](_0x5dc0f0)[_0x41df('0x27')](function(_0x314c51){return _0x314c51;});}return null;};}function removeEntity(_0x4ca9d3,_0x54c1a2){return function(_0x281031){if(_0x281031){return _0x281031[_0x41df('0x28')]()[_0x41df('0x27')](function(){_0x4ca9d3[_0x41df('0x1b')](0xcc)[_0x41df('0x1a')]();});}};}function handleEntityNotFound(_0x907a0a,_0x1344ae){return function(_0x25ebb8){if(!_0x25ebb8){_0x907a0a[_0x41df('0x19')](0x194);}return _0x25ebb8;};}function handleError(_0x21bb51,_0x5e8c8c){_0x5e8c8c=_0x5e8c8c||0x1f4;return function(_0x55b70b){logger[_0x41df('0x29')](_0x55b70b['stack']);if(_0x55b70b[_0x41df('0x2a')]){delete _0x55b70b[_0x41df('0x2a')];}_0x21bb51[_0x41df('0x1b')](_0x5e8c8c)['send'](_0x55b70b);};}exports[_0x41df('0x2b')]=function(_0x233c5a,_0x1fc50d){var _0x13c14c={},_0x501c3a={},_0x3060e7={'count':0x0,'rows':[]};var _0xbbc3ff=_[_0x41df('0x2c')](db[_0x41df('0x2d')]['rawAttributes'],function(_0x24b8e5){return{'name':_0x24b8e5[_0x41df('0x2e')],'type':_0x24b8e5[_0x41df('0x2f')]['key']};});_0x501c3a[_0x41df('0x30')]=_[_0x41df('0x2c')](_0xbbc3ff,_0x41df('0x2a'));_0x501c3a[_0x41df('0x31')]=_[_0x41df('0x32')](_0x233c5a[_0x41df('0x31')]);_0x501c3a[_0x41df('0x33')]=_[_0x41df('0x34')](_0x501c3a[_0x41df('0x30')],_0x501c3a['query']);_0x13c14c[_0x41df('0x35')]=_[_0x41df('0x34')](_0x501c3a['model'],qs['fields'](_0x233c5a[_0x41df('0x31')][_0x41df('0x36')]));_0x13c14c['attributes']=_0x13c14c['attributes'][_0x41df('0x37')]?_0x13c14c[_0x41df('0x35')]:_0x501c3a[_0x41df('0x30')];if(!_0x233c5a[_0x41df('0x31')][_0x41df('0x38')](_0x41df('0x39'))){_0x13c14c[_0x41df('0x20')]=qs[_0x41df('0x20')](_0x233c5a[_0x41df('0x31')][_0x41df('0x20')]);_0x13c14c[_0x41df('0x1f')]=qs[_0x41df('0x1f')](_0x233c5a[_0x41df('0x31')][_0x41df('0x1f')]);}_0x13c14c[_0x41df('0x3a')]=qs['sort'](_0x233c5a[_0x41df('0x31')]['sort']);_0x13c14c[_0x41df('0x3b')]=qs[_0x41df('0x33')](_['pick'](_0x233c5a[_0x41df('0x31')],_0x501c3a[_0x41df('0x33')]),_0xbbc3ff);if(_0x233c5a[_0x41df('0x31')][_0x41df('0x3c')]){_0x13c14c[_0x41df('0x3b')]=_[_0x41df('0x3d')](_0x13c14c[_0x41df('0x3b')],{'$or':_[_0x41df('0x2c')](_0xbbc3ff,function(_0xa2d297){if(_0xa2d297[_0x41df('0x2f')]!==_0x41df('0x3e')){var _0x692b8={};_0x692b8[_0xa2d297['name']]={'$like':'%'+_0x233c5a[_0x41df('0x31')][_0x41df('0x3c')]+'%'};return _0x692b8;}})});}_0x13c14c=_[_0x41df('0x3d')]({},_0x13c14c,_0x233c5a[_0x41df('0x3f')]);var _0x5c0413={'where':_0x13c14c['where']};return db[_0x41df('0x2d')]['count'](_0x5c0413)['then'](function(_0x4f30a0){_0x3060e7[_0x41df('0x1e')]=_0x4f30a0;if(_0x233c5a[_0x41df('0x31')][_0x41df('0x40')]){_0x13c14c[_0x41df('0x41')]=[{'all':!![]}];}return db[_0x41df('0x2d')][_0x41df('0x42')](_0x13c14c);})['then'](function(_0x1f3d14){_0x3060e7[_0x41df('0x43')]=_0x1f3d14;return _0x3060e7;})[_0x41df('0x27')](respondWithFilteredResult(_0x1fc50d,_0x13c14c))['catch'](handleError(_0x1fc50d,null));};exports[_0x41df('0x44')]=function(_0x2a6d20,_0x5c8d51){var _0x3a8172={'raw':!![],'where':{'id':_0x2a6d20['params']['id']}},_0x3aa58d={};_0x3aa58d[_0x41df('0x30')]=_[_0x41df('0x32')](db[_0x41df('0x2d')][_0x41df('0x45')]);_0x3aa58d[_0x41df('0x31')]=_[_0x41df('0x32')](_0x2a6d20[_0x41df('0x31')]);_0x3aa58d[_0x41df('0x33')]=_[_0x41df('0x34')](_0x3aa58d[_0x41df('0x30')],_0x3aa58d['query']);_0x3a8172[_0x41df('0x35')]=_[_0x41df('0x34')](_0x3aa58d[_0x41df('0x30')],qs[_0x41df('0x36')](_0x2a6d20[_0x41df('0x31')][_0x41df('0x36')]));_0x3a8172[_0x41df('0x35')]=_0x3a8172[_0x41df('0x35')][_0x41df('0x37')]?_0x3a8172[_0x41df('0x35')]:_0x3aa58d['model'];if(_0x2a6d20['query'][_0x41df('0x40')]){_0x3a8172[_0x41df('0x41')]=[{'all':!![]}];}_0x3a8172=_['merge']({},_0x3a8172,_0x2a6d20[_0x41df('0x3f')]);return db[_0x41df('0x2d')]['find'](_0x3a8172)[_0x41df('0x27')](handleEntityNotFound(_0x5c8d51,null))[_0x41df('0x27')](respondWithResult(_0x5c8d51,null))[_0x41df('0x46')](handleError(_0x5c8d51,null));};exports[_0x41df('0x47')]=function(_0x331fba,_0x5a7398){return db[_0x41df('0x2d')][_0x41df('0x47')](_0x331fba['body'],{})[_0x41df('0x27')](respondWithResult(_0x5a7398,0xc9))[_0x41df('0x46')](handleError(_0x5a7398,null));};exports[_0x41df('0x26')]=function(_0x54132f,_0x548011){if(_0x54132f['body']['id']){delete _0x54132f['body']['id'];}return db[_0x41df('0x2d')][_0x41df('0x48')]({'where':{'id':_0x54132f[_0x41df('0x49')]['id']}})[_0x41df('0x27')](handleEntityNotFound(_0x548011,null))['then'](saveUpdates(_0x54132f[_0x41df('0x4a')],null))[_0x41df('0x27')](respondWithResult(_0x548011,null))['catch'](handleError(_0x548011,null));};exports[_0x41df('0x28')]=function(_0x183e3d,_0x3d756a){return db[_0x41df('0x2d')][_0x41df('0x48')]({'where':{'id':_0x183e3d['params']['id']}})['then'](handleEntityNotFound(_0x3d756a,null))[_0x41df('0x27')](removeEntity(_0x3d756a,null))[_0x41df('0x46')](handleError(_0x3d756a,null));};exports[_0x41df('0x4b')]=function(_0x3defa1,_0x6dc695){return db[_0x41df('0x2d')]['describe']()[_0x41df('0x27')](respondWithResult(_0x6dc695,null))[_0x41df('0x46')](handleError(_0x6dc695,null));}; \ No newline at end of file +var _0x1a75=['findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','SmsQueueReport','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x52469e,_0x3579c2){var _0x2e6692=function(_0x3e5576){while(--_0x3e5576){_0x52469e['push'](_0x52469e['shift']());}};_0x2e6692(++_0x3579c2);}(_0x1a75,0xa4));var _0x51a7=function(_0x33f515,_0x2da827){_0x33f515=_0x33f515-0x0;var _0x52b95b=_0x1a75[_0x33f515];return _0x52b95b;};'use strict';var emlformat=require(_0x51a7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x51a7('0x1'));var jsonpatch=require(_0x51a7('0x2'));var rp=require(_0x51a7('0x3'));var moment=require(_0x51a7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x51a7('0x5'));var util=require(_0x51a7('0x6'));var path=require(_0x51a7('0x7'));var sox=require(_0x51a7('0x8'));var csv=require(_0x51a7('0x9'));var ejs=require(_0x51a7('0xa'));var fs=require('fs');var fs_extra=require(_0x51a7('0xb'));var _=require(_0x51a7('0xc'));var squel=require(_0x51a7('0xd'));var crypto=require('crypto');var jsforce=require(_0x51a7('0xe'));var deskjs=require(_0x51a7('0xf'));var toCsv=require(_0x51a7('0x9'));var querystring=require(_0x51a7('0x10'));var Papa=require('papaparse');var Redis=require(_0x51a7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x51a7('0x12'));var as=require(_0x51a7('0x13'));var hardwareService=require(_0x51a7('0x14'));var logger=require(_0x51a7('0x15'))(_0x51a7('0x16'));var utils=require(_0x51a7('0x17'));var config=require(_0x51a7('0x18'));var licenseUtil=require(_0x51a7('0x19'));var db=require(_0x51a7('0x1a'))['db'];function respondWithStatusCode(_0x4c8b88,_0x47cc91){_0x47cc91=_0x47cc91||0xcc;return function(_0x4f2eae){if(_0x4f2eae){return _0x4c8b88[_0x51a7('0x1b')](_0x47cc91);}return _0x4c8b88[_0x51a7('0x1c')](_0x47cc91)['end']();};}function respondWithResult(_0x42daa4,_0x1df237){_0x1df237=_0x1df237||0xc8;return function(_0x38d8da){if(_0x38d8da){return _0x42daa4[_0x51a7('0x1c')](_0x1df237)[_0x51a7('0x1d')](_0x38d8da);}};}function respondWithFilteredResult(_0x3f9c03,_0x575ed4){return function(_0x4875bb){if(_0x4875bb){var _0x20b338=typeof _0x575ed4[_0x51a7('0x1e')]===_0x51a7('0x1f')&&typeof _0x575ed4[_0x51a7('0x20')]===_0x51a7('0x1f');var _0x2fd05d=_0x4875bb[_0x51a7('0x21')];var _0x2b53f4=_0x20b338?0x0:_0x575ed4[_0x51a7('0x1e')];var _0x21b730=_0x20b338?_0x4875bb[_0x51a7('0x21')]:_0x575ed4[_0x51a7('0x1e')]+_0x575ed4[_0x51a7('0x20')];var _0x395012;if(_0x21b730>=_0x2fd05d){_0x21b730=_0x2fd05d;_0x395012=0xc8;}else{_0x395012=0xce;}_0x3f9c03['status'](_0x395012);return _0x3f9c03[_0x51a7('0x22')](_0x51a7('0x23'),_0x2b53f4+'-'+_0x21b730+'/'+_0x2fd05d)[_0x51a7('0x1d')](_0x4875bb);}return null;};}function patchUpdates(_0x55d62e){return function(_0xe6963){try{jsonpatch[_0x51a7('0x24')](_0xe6963,_0x55d62e,!![]);}catch(_0x5f3b37){return BPromise[_0x51a7('0x25')](_0x5f3b37);}return _0xe6963[_0x51a7('0x26')]();};}function saveUpdates(_0x152746,_0x9404bb){return function(_0x52b387){if(_0x52b387){return _0x52b387[_0x51a7('0x27')](_0x152746)[_0x51a7('0x28')](function(_0x59c20e){return _0x59c20e;});}return null;};}function removeEntity(_0x3612ce,_0x45fb37){return function(_0x380381){if(_0x380381){return _0x380381[_0x51a7('0x29')]()[_0x51a7('0x28')](function(){_0x3612ce[_0x51a7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x564d53,_0x3069fc){return function(_0x227927){if(!_0x227927){_0x564d53[_0x51a7('0x1b')](0x194);}return _0x227927;};}function handleError(_0x4dfa4c,_0x3647b5){_0x3647b5=_0x3647b5||0x1f4;return function(_0x263084){logger[_0x51a7('0x2a')](_0x263084[_0x51a7('0x2b')]);if(_0x263084[_0x51a7('0x2c')]){delete _0x263084[_0x51a7('0x2c')];}_0x4dfa4c[_0x51a7('0x1c')](_0x3647b5)['send'](_0x263084);};}exports['index']=function(_0xab8572,_0x479301){var _0x3e463f={},_0x332e8f={},_0x40d9a5={'count':0x0,'rows':[]};var _0x2c4d96=_[_0x51a7('0x2d')](db[_0x51a7('0x2e')][_0x51a7('0x2f')],function(_0x10d1e8){return{'name':_0x10d1e8['fieldName'],'type':_0x10d1e8[_0x51a7('0x30')]['key']};});_0x332e8f[_0x51a7('0x31')]=_[_0x51a7('0x2d')](_0x2c4d96,'name');_0x332e8f[_0x51a7('0x32')]=_[_0x51a7('0x33')](_0xab8572[_0x51a7('0x32')]);_0x332e8f[_0x51a7('0x34')]=_['intersection'](_0x332e8f[_0x51a7('0x31')],_0x332e8f[_0x51a7('0x32')]);_0x3e463f['attributes']=_[_0x51a7('0x35')](_0x332e8f[_0x51a7('0x31')],qs[_0x51a7('0x36')](_0xab8572['query']['fields']));_0x3e463f[_0x51a7('0x37')]=_0x3e463f[_0x51a7('0x37')]['length']?_0x3e463f[_0x51a7('0x37')]:_0x332e8f[_0x51a7('0x31')];if(!_0xab8572[_0x51a7('0x32')][_0x51a7('0x38')](_0x51a7('0x39'))){_0x3e463f[_0x51a7('0x20')]=qs[_0x51a7('0x20')](_0xab8572[_0x51a7('0x32')][_0x51a7('0x20')]);_0x3e463f[_0x51a7('0x1e')]=qs['offset'](_0xab8572[_0x51a7('0x32')][_0x51a7('0x1e')]);}_0x3e463f[_0x51a7('0x3a')]=qs[_0x51a7('0x3b')](_0xab8572[_0x51a7('0x32')][_0x51a7('0x3b')]);_0x3e463f[_0x51a7('0x3c')]=qs['filters'](_['pick'](_0xab8572[_0x51a7('0x32')],_0x332e8f[_0x51a7('0x34')]),_0x2c4d96);if(_0xab8572[_0x51a7('0x32')][_0x51a7('0x3d')]){_0x3e463f['where']=_[_0x51a7('0x3e')](_0x3e463f[_0x51a7('0x3c')],{'$or':_[_0x51a7('0x2d')](_0x2c4d96,function(_0x4cdb33){if(_0x4cdb33[_0x51a7('0x30')]!==_0x51a7('0x3f')){var _0x3415c4={};_0x3415c4[_0x4cdb33[_0x51a7('0x2c')]]={'$like':'%'+_0xab8572[_0x51a7('0x32')][_0x51a7('0x3d')]+'%'};return _0x3415c4;}})});}_0x3e463f=_[_0x51a7('0x3e')]({},_0x3e463f,_0xab8572[_0x51a7('0x40')]);var _0x483350={'where':_0x3e463f[_0x51a7('0x3c')]};return db[_0x51a7('0x2e')][_0x51a7('0x21')](_0x483350)['then'](function(_0x5ba8b9){_0x40d9a5[_0x51a7('0x21')]=_0x5ba8b9;if(_0xab8572['query'][_0x51a7('0x41')]){_0x3e463f[_0x51a7('0x42')]=[{'all':!![]}];}return db[_0x51a7('0x2e')][_0x51a7('0x43')](_0x3e463f);})['then'](function(_0x416730){_0x40d9a5[_0x51a7('0x44')]=_0x416730;return _0x40d9a5;})['then'](respondWithFilteredResult(_0x479301,_0x3e463f))[_0x51a7('0x45')](handleError(_0x479301,null));};exports[_0x51a7('0x46')]=function(_0x395917,_0x24e651){var _0x4ae652={'raw':!![],'where':{'id':_0x395917[_0x51a7('0x47')]['id']}},_0x57a21f={};_0x57a21f[_0x51a7('0x31')]=_[_0x51a7('0x33')](db[_0x51a7('0x2e')][_0x51a7('0x2f')]);_0x57a21f[_0x51a7('0x32')]=_['keys'](_0x395917[_0x51a7('0x32')]);_0x57a21f['filters']=_[_0x51a7('0x35')](_0x57a21f[_0x51a7('0x31')],_0x57a21f[_0x51a7('0x32')]);_0x4ae652[_0x51a7('0x37')]=_[_0x51a7('0x35')](_0x57a21f[_0x51a7('0x31')],qs[_0x51a7('0x36')](_0x395917[_0x51a7('0x32')][_0x51a7('0x36')]));_0x4ae652[_0x51a7('0x37')]=_0x4ae652[_0x51a7('0x37')][_0x51a7('0x48')]?_0x4ae652[_0x51a7('0x37')]:_0x57a21f[_0x51a7('0x31')];if(_0x395917[_0x51a7('0x32')]['includeAll']){_0x4ae652[_0x51a7('0x42')]=[{'all':!![]}];}_0x4ae652=_['merge']({},_0x4ae652,_0x395917[_0x51a7('0x40')]);return db[_0x51a7('0x2e')][_0x51a7('0x49')](_0x4ae652)[_0x51a7('0x28')](handleEntityNotFound(_0x24e651,null))[_0x51a7('0x28')](respondWithResult(_0x24e651,null))[_0x51a7('0x45')](handleError(_0x24e651,null));};exports[_0x51a7('0x4a')]=function(_0x2f5e68,_0x1fc0b6){return db[_0x51a7('0x2e')][_0x51a7('0x4a')](_0x2f5e68['body'],{})[_0x51a7('0x28')](respondWithResult(_0x1fc0b6,0xc9))[_0x51a7('0x45')](handleError(_0x1fc0b6,null));};exports[_0x51a7('0x27')]=function(_0x31ce08,_0x362443){if(_0x31ce08[_0x51a7('0x4b')]['id']){delete _0x31ce08[_0x51a7('0x4b')]['id'];}return db[_0x51a7('0x2e')][_0x51a7('0x49')]({'where':{'id':_0x31ce08[_0x51a7('0x47')]['id']}})[_0x51a7('0x28')](handleEntityNotFound(_0x362443,null))[_0x51a7('0x28')](saveUpdates(_0x31ce08[_0x51a7('0x4b')],null))[_0x51a7('0x28')](respondWithResult(_0x362443,null))['catch'](handleError(_0x362443,null));};exports[_0x51a7('0x29')]=function(_0x5a4170,_0x56bbfb){return db[_0x51a7('0x2e')][_0x51a7('0x49')]({'where':{'id':_0x5a4170[_0x51a7('0x47')]['id']}})[_0x51a7('0x28')](handleEntityNotFound(_0x56bbfb,null))[_0x51a7('0x28')](removeEntity(_0x56bbfb,null))[_0x51a7('0x45')](handleError(_0x56bbfb,null));};exports[_0x51a7('0x4c')]=function(_0x5a4b9e,_0x32c447){return db[_0x51a7('0x2e')][_0x51a7('0x4c')]()[_0x51a7('0x28')](respondWithResult(_0x32c447,null))[_0x51a7('0x45')](handleError(_0x32c447,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 1f58da7..3400e56 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 _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x23e4c0,_0x32473b){var _0x5bc685=function(_0x381972){while(--_0x381972){_0x23e4c0['push'](_0x23e4c0['shift']());}};_0x5bc685(++_0x32473b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x565faf,_0x5f3718){var _0x42292f=function(_0x514b49){while(--_0x514b49){_0x565faf['push'](_0x565faf['shift']());}};_0x42292f(++_0x5f3718);}(_0xe706,0xa3));var _0x6e70=function(_0x5e462b,_0x187b06){_0x5e462b=_0x5e462b-0x0;var _0xb01a65=_0xe706[_0x5e462b];return _0xb01a65;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 0771d1c..ff11162 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 _0xb90a=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','body','options','raw','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes'];(function(_0x2165e5,_0x353e27){var _0x3a29df=function(_0x29730d){while(--_0x29730d){_0x2165e5['push'](_0x2165e5['shift']());}};_0x3a29df(++_0x353e27);}(_0xb90a,0xf0));var _0xab90=function(_0x27d341,_0x4f5479){_0x27d341=_0x27d341-0x0;var _0x422a93=_0xb90a[_0x27d341];return _0x422a93;};'use strict';var _=require(_0xab90('0x0'));var util=require(_0xab90('0x1'));var moment=require('moment');var BPromise=require(_0xab90('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab90('0x3'));var db=require(_0xab90('0x4'))['db'];var utils=require(_0xab90('0x5'));var logger=require(_0xab90('0x6'))(_0xab90('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xab90('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58e40a,_0x46fc6d,_0x57a4df){return new BPromise(function(_0x552a3d,_0x390f56){return client[_0xab90('0x9')](_0x58e40a,_0x57a4df)[_0xab90('0xa')](function(_0x4c8c3d){logger[_0xab90('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x46fc6d,_0xab90('0xc'));logger[_0xab90('0xd')](_0xab90('0xe'),_0x46fc6d,_0xab90('0xc'),JSON[_0xab90('0xf')](_0x4c8c3d));if(_0x4c8c3d[_0xab90('0x10')]){if(_0x4c8c3d[_0xab90('0x10')]['code']===0x1f4){logger[_0xab90('0x10')](_0xab90('0x11'),_0x46fc6d,_0x4c8c3d[_0xab90('0x10')]['message']);return _0x390f56(_0x4c8c3d[_0xab90('0x10')][_0xab90('0x12')]);}logger['error'](_0xab90('0x11'),_0x46fc6d,_0x4c8c3d['error'][_0xab90('0x12')]);return _0x552a3d(_0x4c8c3d[_0xab90('0x10')]['message']);}else{logger['info'](_0xab90('0x11'),_0x46fc6d,_0xab90('0xc'));_0x552a3d(_0x4c8c3d[_0xab90('0x13')][_0xab90('0x12')]);}})[_0xab90('0x14')](function(_0x513abc){logger['error'](_0xab90('0x11'),_0x46fc6d,_0x513abc);_0x390f56(_0x513abc);});});}exports[_0xab90('0x15')]=function(_0x3f0e22){var _0x1bce88=this;return new Promise(function(_0x7b102d,_0x1fe225){return db['SmsQueueReport']['create'](_0x3f0e22[_0xab90('0x16')],{'raw':_0x3f0e22[_0xab90('0x17')]?_0x3f0e22['options'][_0xab90('0x18')]===undefined?!![]:![]:!![]})[_0xab90('0xa')](function(_0x3013ad){logger[_0xab90('0xb')](_0xab90('0x15'),_0x3f0e22);logger['debug'](_0xab90('0x15'),_0x3f0e22,JSON[_0xab90('0xf')](_0x3013ad));_0x7b102d(_0x3013ad);})[_0xab90('0x14')](function(_0x4dc351){logger['error']('CreateSmsQueueReport',_0x4dc351[_0xab90('0x12')],_0x3f0e22);_0x1fe225(_0x1bce88[_0xab90('0x10')](0x1f4,_0x4dc351[_0xab90('0x12')]));});});};exports[_0xab90('0x19')]=function(_0x3ef4bb){var _0xc2ced8=this;return new Promise(function(_0x597520,_0x529e5b){return db[_0xab90('0x1a')][_0xab90('0x1b')](_0x3ef4bb[_0xab90('0x16')],{'raw':_0x3ef4bb[_0xab90('0x17')]?_0x3ef4bb[_0xab90('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ef4bb[_0xab90('0x17')]?_0x3ef4bb['options'][_0xab90('0x1c')]||null:null,'attributes':_0x3ef4bb['options']?_0x3ef4bb[_0xab90('0x17')][_0xab90('0x1d')]||null:null,'limit':_0x3ef4bb[_0xab90('0x17')]?_0x3ef4bb[_0xab90('0x17')]['limit']||null:null})['then'](function(_0x384c29){logger[_0xab90('0xb')]('UpdateSmsQueueReport',_0x3ef4bb);logger[_0xab90('0xd')](_0xab90('0x19'),_0x3ef4bb,JSON[_0xab90('0xf')](_0x384c29));_0x597520(_0x384c29);})[_0xab90('0x14')](function(_0x2a7d32){logger[_0xab90('0x10')](_0xab90('0x19'),_0x2a7d32[_0xab90('0x12')],_0x3ef4bb);_0x529e5b(_0xc2ced8[_0xab90('0x10')](0x1f4,_0x2a7d32[_0xab90('0x12')]));});});}; \ No newline at end of file +var _0x29dd=['UpdateSmsQueueReport','update','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','then','debug','catch'];(function(_0x4fe3a6,_0x56ba30){var _0x50784f=function(_0x4f3a24){while(--_0x4f3a24){_0x4fe3a6['push'](_0x4fe3a6['shift']());}};_0x50784f(++_0x56ba30);}(_0x29dd,0x136));var _0xd29d=function(_0x1714b8,_0x4fca9e){_0x1714b8=_0x1714b8-0x0;var _0x270885=_0x29dd[_0x1714b8];return _0x270885;};'use strict';var _=require('lodash');var util=require(_0xd29d('0x0'));var moment=require(_0xd29d('0x1'));var BPromise=require(_0xd29d('0x2'));var rs=require(_0xd29d('0x3'));var fs=require('fs');var Redis=require(_0xd29d('0x4'));var db=require(_0xd29d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd29d('0x6'))(_0xd29d('0x7'));var config=require(_0xd29d('0x8'));var jayson=require(_0xd29d('0x9'));var client=jayson[_0xd29d('0xa')][_0xd29d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4001bd,_0x4353c0,_0x132da1){return new BPromise(function(_0x430c8c,_0x3c7d67){return client[_0xd29d('0xc')](_0x4001bd,_0x132da1)['then'](function(_0x220d15){logger[_0xd29d('0xd')](_0xd29d('0xe'),_0x4353c0,_0xd29d('0xf'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x4353c0,_0xd29d('0xf'),JSON[_0xd29d('0x10')](_0x220d15));if(_0x220d15['error']){if(_0x220d15[_0xd29d('0x11')][_0xd29d('0x12')]===0x1f4){logger[_0xd29d('0x11')](_0xd29d('0xe'),_0x4353c0,_0x220d15['error'][_0xd29d('0x13')]);return _0x3c7d67(_0x220d15[_0xd29d('0x11')][_0xd29d('0x13')]);}logger[_0xd29d('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x4353c0,_0x220d15[_0xd29d('0x11')][_0xd29d('0x13')]);return _0x430c8c(_0x220d15[_0xd29d('0x11')][_0xd29d('0x13')]);}else{logger[_0xd29d('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x4353c0,'request\x20sent');_0x430c8c(_0x220d15[_0xd29d('0x14')]['message']);}})['catch'](function(_0x119437){logger[_0xd29d('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x4353c0,_0x119437);_0x3c7d67(_0x119437);});});}exports[_0xd29d('0x15')]=function(_0x2969c1){var _0x4f2916=this;return new Promise(function(_0x2ffc04,_0x1f5779){return db[_0xd29d('0x16')][_0xd29d('0x17')](_0x2969c1[_0xd29d('0x18')],{'raw':_0x2969c1['options']?_0x2969c1[_0xd29d('0x19')][_0xd29d('0x1a')]===undefined?!![]:![]:!![]})[_0xd29d('0x1b')](function(_0x2c497d){logger['info']('CreateSmsQueueReport',_0x2969c1);logger[_0xd29d('0x1c')](_0xd29d('0x15'),_0x2969c1,JSON[_0xd29d('0x10')](_0x2c497d));_0x2ffc04(_0x2c497d);})[_0xd29d('0x1d')](function(_0x199f58){logger[_0xd29d('0x11')](_0xd29d('0x15'),_0x199f58[_0xd29d('0x13')],_0x2969c1);_0x1f5779(_0x4f2916[_0xd29d('0x11')](0x1f4,_0x199f58['message']));});});};exports[_0xd29d('0x1e')]=function(_0x360b8f){var _0x3ebe65=this;return new Promise(function(_0x4ac26a,_0x3f5134){return db[_0xd29d('0x16')][_0xd29d('0x1f')](_0x360b8f['body'],{'raw':_0x360b8f[_0xd29d('0x19')]?_0x360b8f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x360b8f[_0xd29d('0x19')]?_0x360b8f['options']['where']||null:null,'attributes':_0x360b8f[_0xd29d('0x19')]?_0x360b8f[_0xd29d('0x19')][_0xd29d('0x20')]||null:null,'limit':_0x360b8f[_0xd29d('0x19')]?_0x360b8f['options'][_0xd29d('0x21')]||null:null})[_0xd29d('0x1b')](function(_0x394608){logger['info'](_0xd29d('0x1e'),_0x360b8f);logger[_0xd29d('0x1c')]('UpdateSmsQueueReport',_0x360b8f,JSON[_0xd29d('0x10')](_0x394608));_0x4ac26a(_0x394608);})[_0xd29d('0x1d')](function(_0x5cecf6){logger['error'](_0xd29d('0x1e'),_0x5cecf6[_0xd29d('0x13')],_0x360b8f);_0x3f5134(_0x3ebe65[_0xd29d('0x11')](0x1f4,_0x5cecf6[_0xd29d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index ac921ac..0be35ec 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 _0xe015=['../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','describe','get','/:id','show','put','update','multer','util','path','Router','../../components/auth/service'];(function(_0x454108,_0x41f787){var _0xb86ac1=function(_0x485880){while(--_0x485880){_0x454108['push'](_0x454108['shift']());}};_0xb86ac1(++_0x41f787);}(_0xe015,0x13b));var _0x5e01=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xe015[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var path=require(_0x5e01('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e01('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5e01('0x4'));var interaction=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var controller=require(_0x5e01('0x7'));router['get']('/',auth[_0x5e01('0x8')](),controller[_0x5e01('0x9')]);router['get']('/describe',auth[_0x5e01('0x8')](),controller[_0x5e01('0xa')]);router[_0x5e01('0xb')](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller[_0x5e01('0xd')]);router['post']('/',auth[_0x5e01('0x8')](),controller['create']);router[_0x5e01('0xe')]('/:id',auth[_0x5e01('0x8')](),controller[_0x5e01('0xf')]);router['delete'](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x207c=['/:id','show','post','isAuthenticated','create','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/describe','describe'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0x207c,0x1e8));var _0xc207=function(_0x22cdda,_0x35cf94){_0x22cdda=_0x22cdda-0x0;var _0x307321=_0x207c[_0x22cdda];return _0x307321;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var fs_extra=require(_0xc207('0x5'));var auth=require(_0xc207('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc207('0x7'));var controller=require('./smsTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc207('0x8')]);router[_0xc207('0x9')](_0xc207('0xa'),auth['isAuthenticated'](),controller[_0xc207('0xb')]);router[_0xc207('0x9')](_0xc207('0xc'),auth['isAuthenticated'](),controller[_0xc207('0xd')]);router[_0xc207('0xe')]('/',auth[_0xc207('0xf')](),controller[_0xc207('0x10')]);router[_0xc207('0x11')](_0xc207('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc207('0xc'),auth['isAuthenticated'](),controller[_0xc207('0x12')]);module[_0xc207('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 2f4a9f7..37c2091 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x1efa5c,_0x4deafb){var _0x4f8376=function(_0x132a82){while(--_0x132a82){_0x1efa5c['push'](_0x1efa5c['shift']());}};_0x4f8376(++_0x4deafb);}(_0x54ef,0x112));var _0xf54e=function(_0xa88782,_0x369e79){_0xa88782=_0xa88782-0x0;var _0x590843=_0x54ef[_0xa88782];return _0x590843;};'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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x40ebff,_0x1dd15e){var _0x40122a=function(_0xae6174){while(--_0xae6174){_0x40ebff['push'](_0x40ebff['shift']());}};_0x40122a(++_0x1dd15e);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1cd547,_0x4b8a04){_0x1cd547=_0x1cd547-0x0;var _0x4e8682=_0x9bde[_0x1cd547];return _0x4e8682;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 547e790..e7598aa 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 _0xe66b=['key','model','keys','filters','attributes','intersection','query','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','Content-Range','reject','save','then','destroy','stack','name','send','index','map','SmsTransferReport','rawAttributes','type'];(function(_0x323479,_0x321fd8){var _0x3068bf=function(_0x10f708){while(--_0x10f708){_0x323479['push'](_0x323479['shift']());}};_0x3068bf(++_0x321fd8);}(_0xe66b,0x17a));var _0xbe66=function(_0x2d5acf,_0x12ffe0){_0x2d5acf=_0x2d5acf-0x0;var _0x5de124=_0xe66b[_0x2d5acf];return _0x5de124;};'use strict';var emlformat=require(_0xbe66('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe66('0x1'));var jsonpatch=require(_0xbe66('0x2'));var rp=require(_0xbe66('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbe66('0x4'));var util=require('util');var path=require(_0xbe66('0x5'));var sox=require(_0xbe66('0x6'));var csv=require(_0xbe66('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe66('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbe66('0x9'));var jsforce=require(_0xbe66('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xbe66('0x7'));var querystring=require(_0xbe66('0xb'));var Papa=require(_0xbe66('0xc'));var Redis=require(_0xbe66('0xd'));var authService=require(_0xbe66('0xe'));var qs=require(_0xbe66('0xf'));var as=require(_0xbe66('0x10'));var hardwareService=require(_0xbe66('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xbe66('0x12'));var config=require(_0xbe66('0x13'));var licenseUtil=require(_0xbe66('0x14'));var db=require(_0xbe66('0x15'))['db'];function respondWithStatusCode(_0x59d785,_0x536218){_0x536218=_0x536218||0xcc;return function(_0x39d8f1){if(_0x39d8f1){return _0x59d785[_0xbe66('0x16')](_0x536218);}return _0x59d785[_0xbe66('0x17')](_0x536218)[_0xbe66('0x18')]();};}function respondWithResult(_0x3168a5,_0x34e9b3){_0x34e9b3=_0x34e9b3||0xc8;return function(_0x34e87f){if(_0x34e87f){return _0x3168a5[_0xbe66('0x17')](_0x34e9b3)[_0xbe66('0x19')](_0x34e87f);}};}function respondWithFilteredResult(_0x221c1e,_0x469a31){return function(_0x55a321){if(_0x55a321){var _0x445419=typeof _0x469a31['offset']==='undefined'&&typeof _0x469a31[_0xbe66('0x1a')]==='undefined';var _0x33be69=_0x55a321[_0xbe66('0x1b')];var _0x45372d=_0x445419?0x0:_0x469a31[_0xbe66('0x1c')];var _0x3faa2c=_0x445419?_0x55a321[_0xbe66('0x1b')]:_0x469a31[_0xbe66('0x1c')]+_0x469a31['limit'];var _0x479ab2;if(_0x3faa2c>=_0x33be69){_0x3faa2c=_0x33be69;_0x479ab2=0xc8;}else{_0x479ab2=0xce;}_0x221c1e['status'](_0x479ab2);return _0x221c1e['set'](_0xbe66('0x1d'),_0x45372d+'-'+_0x3faa2c+'/'+_0x33be69)[_0xbe66('0x19')](_0x55a321);}return null;};}function patchUpdates(_0x222826){return function(_0x46a726){try{jsonpatch['apply'](_0x46a726,_0x222826,!![]);}catch(_0x46c08d){return BPromise[_0xbe66('0x1e')](_0x46c08d);}return _0x46a726[_0xbe66('0x1f')]();};}function saveUpdates(_0x3c6d,_0x50aef9){return function(_0x51cb5f){if(_0x51cb5f){return _0x51cb5f['update'](_0x3c6d)[_0xbe66('0x20')](function(_0x52f323){return _0x52f323;});}return null;};}function removeEntity(_0x1f8625,_0x34076a){return function(_0x4a1ee8){if(_0x4a1ee8){return _0x4a1ee8[_0xbe66('0x21')]()[_0xbe66('0x20')](function(){_0x1f8625[_0xbe66('0x17')](0xcc)[_0xbe66('0x18')]();});}};}function handleEntityNotFound(_0x3af6ef,_0x4d1fb9){return function(_0xa1c38b){if(!_0xa1c38b){_0x3af6ef['sendStatus'](0x194);}return _0xa1c38b;};}function handleError(_0x1df144,_0x591713){_0x591713=_0x591713||0x1f4;return function(_0x124882){logger['error'](_0x124882[_0xbe66('0x22')]);if(_0x124882['name']){delete _0x124882[_0xbe66('0x23')];}_0x1df144[_0xbe66('0x17')](_0x591713)[_0xbe66('0x24')](_0x124882);};}exports[_0xbe66('0x25')]=function(_0x26802a,_0xb46ffc){var _0x5d2d54={},_0xc96767={},_0x1fa7e4={'count':0x0,'rows':[]};var _0x541491=_[_0xbe66('0x26')](db[_0xbe66('0x27')][_0xbe66('0x28')],function(_0x2253a4){return{'name':_0x2253a4['fieldName'],'type':_0x2253a4[_0xbe66('0x29')][_0xbe66('0x2a')]};});_0xc96767[_0xbe66('0x2b')]=_['map'](_0x541491,_0xbe66('0x23'));_0xc96767['query']=_[_0xbe66('0x2c')](_0x26802a['query']);_0xc96767[_0xbe66('0x2d')]=_['intersection'](_0xc96767['model'],_0xc96767['query']);_0x5d2d54[_0xbe66('0x2e')]=_[_0xbe66('0x2f')](_0xc96767[_0xbe66('0x2b')],qs['fields'](_0x26802a[_0xbe66('0x30')][_0xbe66('0x31')]));_0x5d2d54[_0xbe66('0x2e')]=_0x5d2d54['attributes'][_0xbe66('0x32')]?_0x5d2d54['attributes']:_0xc96767[_0xbe66('0x2b')];if(!_0x26802a[_0xbe66('0x30')]['hasOwnProperty'](_0xbe66('0x33'))){_0x5d2d54['limit']=qs[_0xbe66('0x1a')](_0x26802a[_0xbe66('0x30')]['limit']);_0x5d2d54[_0xbe66('0x1c')]=qs[_0xbe66('0x1c')](_0x26802a[_0xbe66('0x30')][_0xbe66('0x1c')]);}_0x5d2d54[_0xbe66('0x34')]=qs['sort'](_0x26802a[_0xbe66('0x30')][_0xbe66('0x35')]);_0x5d2d54['where']=qs['filters'](_['pick'](_0x26802a[_0xbe66('0x30')],_0xc96767[_0xbe66('0x2d')]),_0x541491);if(_0x26802a[_0xbe66('0x30')][_0xbe66('0x36')]){_0x5d2d54[_0xbe66('0x37')]=_['merge'](_0x5d2d54[_0xbe66('0x37')],{'$or':_[_0xbe66('0x26')](_0x541491,function(_0x2d9ca6){if(_0x2d9ca6[_0xbe66('0x29')]!==_0xbe66('0x38')){var _0x724c53={};_0x724c53[_0x2d9ca6[_0xbe66('0x23')]]={'$like':'%'+_0x26802a[_0xbe66('0x30')]['filter']+'%'};return _0x724c53;}})});}_0x5d2d54=_[_0xbe66('0x39')]({},_0x5d2d54,_0x26802a[_0xbe66('0x3a')]);var _0x45e8d1={'where':_0x5d2d54[_0xbe66('0x37')]};return db['SmsTransferReport'][_0xbe66('0x1b')](_0x45e8d1)[_0xbe66('0x20')](function(_0x20aca5){_0x1fa7e4[_0xbe66('0x1b')]=_0x20aca5;if(_0x26802a[_0xbe66('0x30')][_0xbe66('0x3b')]){_0x5d2d54[_0xbe66('0x3c')]=[{'all':!![]}];}return db[_0xbe66('0x27')][_0xbe66('0x3d')](_0x5d2d54);})[_0xbe66('0x20')](function(_0x9c7004){_0x1fa7e4[_0xbe66('0x3e')]=_0x9c7004;return _0x1fa7e4;})['then'](respondWithFilteredResult(_0xb46ffc,_0x5d2d54))['catch'](handleError(_0xb46ffc,null));};exports[_0xbe66('0x3f')]=function(_0x36e0b1,_0x2ee8dc){var _0x460093={'raw':!![],'where':{'id':_0x36e0b1[_0xbe66('0x40')]['id']}},_0xc33302={};_0xc33302[_0xbe66('0x2b')]=_[_0xbe66('0x2c')](db[_0xbe66('0x27')][_0xbe66('0x28')]);_0xc33302[_0xbe66('0x30')]=_[_0xbe66('0x2c')](_0x36e0b1[_0xbe66('0x30')]);_0xc33302[_0xbe66('0x2d')]=_['intersection'](_0xc33302[_0xbe66('0x2b')],_0xc33302[_0xbe66('0x30')]);_0x460093[_0xbe66('0x2e')]=_[_0xbe66('0x2f')](_0xc33302[_0xbe66('0x2b')],qs[_0xbe66('0x31')](_0x36e0b1[_0xbe66('0x30')][_0xbe66('0x31')]));_0x460093[_0xbe66('0x2e')]=_0x460093[_0xbe66('0x2e')][_0xbe66('0x32')]?_0x460093[_0xbe66('0x2e')]:_0xc33302[_0xbe66('0x2b')];if(_0x36e0b1[_0xbe66('0x30')][_0xbe66('0x3b')]){_0x460093[_0xbe66('0x3c')]=[{'all':!![]}];}_0x460093=_[_0xbe66('0x39')]({},_0x460093,_0x36e0b1['options']);return db[_0xbe66('0x27')][_0xbe66('0x41')](_0x460093)[_0xbe66('0x20')](handleEntityNotFound(_0x2ee8dc,null))[_0xbe66('0x20')](respondWithResult(_0x2ee8dc,null))[_0xbe66('0x42')](handleError(_0x2ee8dc,null));};exports[_0xbe66('0x43')]=function(_0x43dce5,_0x4e722f){return db[_0xbe66('0x27')][_0xbe66('0x43')](_0x43dce5[_0xbe66('0x44')],{})['then'](respondWithResult(_0x4e722f,0xc9))[_0xbe66('0x42')](handleError(_0x4e722f,null));};exports['update']=function(_0x63a94e,_0x533255){if(_0x63a94e['body']['id']){delete _0x63a94e[_0xbe66('0x44')]['id'];}return db[_0xbe66('0x27')][_0xbe66('0x41')]({'where':{'id':_0x63a94e['params']['id']}})[_0xbe66('0x20')](handleEntityNotFound(_0x533255,null))['then'](saveUpdates(_0x63a94e[_0xbe66('0x44')],null))[_0xbe66('0x20')](respondWithResult(_0x533255,null))['catch'](handleError(_0x533255,null));};exports['destroy']=function(_0x1da6a6,_0x50fd0a){return db['SmsTransferReport'][_0xbe66('0x41')]({'where':{'id':_0x1da6a6['params']['id']}})[_0xbe66('0x20')](handleEntityNotFound(_0x50fd0a,null))[_0xbe66('0x20')](removeEntity(_0x50fd0a,null))[_0xbe66('0x42')](handleError(_0x50fd0a,null));};exports[_0xbe66('0x45')]=function(_0x2dedeb,_0xe2a788){return db['SmsTransferReport'][_0xbe66('0x45')]()[_0xbe66('0x20')](respondWithResult(_0xe2a788,null))[_0xbe66('0x42')](handleError(_0xe2a788,null));}; \ No newline at end of file +var _0x6465=['mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','SmsTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0x6465,0x92));var _0x5646=function(_0x1d587d,_0x6b1c74){_0x1d587d=_0x1d587d-0x0;var _0x3a0151=_0x6465[_0x1d587d];return _0x3a0151;};'use strict';var emlformat=require(_0x5646('0x0'));var rimraf=require(_0x5646('0x1'));var zipdir=require(_0x5646('0x2'));var jsonpatch=require(_0x5646('0x3'));var rp=require('request-promise');var moment=require(_0x5646('0x4'));var BPromise=require(_0x5646('0x5'));var Mustache=require(_0x5646('0x6'));var util=require(_0x5646('0x7'));var path=require(_0x5646('0x8'));var sox=require('sox');var csv=require(_0x5646('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5646('0xa'));var _=require(_0x5646('0xb'));var squel=require(_0x5646('0xc'));var crypto=require(_0x5646('0xd'));var jsforce=require(_0x5646('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5646('0x9'));var querystring=require(_0x5646('0xf'));var Papa=require(_0x5646('0x10'));var Redis=require(_0x5646('0x11'));var authService=require(_0x5646('0x12'));var qs=require(_0x5646('0x13'));var as=require(_0x5646('0x14'));var hardwareService=require(_0x5646('0x15'));var logger=require('../../config/logger')(_0x5646('0x16'));var utils=require(_0x5646('0x17'));var config=require(_0x5646('0x18'));var licenseUtil=require(_0x5646('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4faef5,_0x582073){_0x582073=_0x582073||0xcc;return function(_0x4fc8af){if(_0x4fc8af){return _0x4faef5[_0x5646('0x1a')](_0x582073);}return _0x4faef5[_0x5646('0x1b')](_0x582073)[_0x5646('0x1c')]();};}function respondWithResult(_0xcd51da,_0x182403){_0x182403=_0x182403||0xc8;return function(_0x27f352){if(_0x27f352){return _0xcd51da[_0x5646('0x1b')](_0x182403)[_0x5646('0x1d')](_0x27f352);}};}function respondWithFilteredResult(_0x4de377,_0x15c368){return function(_0x5eef22){if(_0x5eef22){var _0x83f4bc=typeof _0x15c368['offset']===_0x5646('0x1e')&&typeof _0x15c368[_0x5646('0x1f')]==='undefined';var _0x5da8b3=_0x5eef22[_0x5646('0x20')];var _0x48e48c=_0x83f4bc?0x0:_0x15c368[_0x5646('0x21')];var _0x426524=_0x83f4bc?_0x5eef22[_0x5646('0x20')]:_0x15c368[_0x5646('0x21')]+_0x15c368[_0x5646('0x1f')];var _0x1eba79;if(_0x426524>=_0x5da8b3){_0x426524=_0x5da8b3;_0x1eba79=0xc8;}else{_0x1eba79=0xce;}_0x4de377[_0x5646('0x1b')](_0x1eba79);return _0x4de377['set'](_0x5646('0x22'),_0x48e48c+'-'+_0x426524+'/'+_0x5da8b3)[_0x5646('0x1d')](_0x5eef22);}return null;};}function patchUpdates(_0x12e33f){return function(_0x5f49f7){try{jsonpatch[_0x5646('0x23')](_0x5f49f7,_0x12e33f,!![]);}catch(_0x5c6909){return BPromise[_0x5646('0x24')](_0x5c6909);}return _0x5f49f7[_0x5646('0x25')]();};}function saveUpdates(_0xcb649f,_0x557e1e){return function(_0x2454c6){if(_0x2454c6){return _0x2454c6[_0x5646('0x26')](_0xcb649f)[_0x5646('0x27')](function(_0x35f5bc){return _0x35f5bc;});}return null;};}function removeEntity(_0xb049e3,_0x5577f9){return function(_0x4739a7){if(_0x4739a7){return _0x4739a7[_0x5646('0x28')]()[_0x5646('0x27')](function(){_0xb049e3[_0x5646('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f5c0d,_0x599352){return function(_0x31d15e){if(!_0x31d15e){_0x3f5c0d[_0x5646('0x1a')](0x194);}return _0x31d15e;};}function handleError(_0x2610d6,_0x249e09){_0x249e09=_0x249e09||0x1f4;return function(_0x561aea){logger['error'](_0x561aea[_0x5646('0x29')]);if(_0x561aea[_0x5646('0x2a')]){delete _0x561aea['name'];}_0x2610d6[_0x5646('0x1b')](_0x249e09)['send'](_0x561aea);};}exports['index']=function(_0x230437,_0x222ed0){var _0x3e4fd6={},_0xfed9d8={},_0x57ca65={'count':0x0,'rows':[]};var _0x5a657a=_[_0x5646('0x2b')](db[_0x5646('0x2c')][_0x5646('0x2d')],function(_0x545a8e){return{'name':_0x545a8e['fieldName'],'type':_0x545a8e[_0x5646('0x2e')][_0x5646('0x2f')]};});_0xfed9d8['model']=_[_0x5646('0x2b')](_0x5a657a,'name');_0xfed9d8[_0x5646('0x30')]=_[_0x5646('0x31')](_0x230437[_0x5646('0x30')]);_0xfed9d8[_0x5646('0x32')]=_[_0x5646('0x33')](_0xfed9d8[_0x5646('0x34')],_0xfed9d8[_0x5646('0x30')]);_0x3e4fd6['attributes']=_[_0x5646('0x33')](_0xfed9d8[_0x5646('0x34')],qs['fields'](_0x230437['query'][_0x5646('0x35')]));_0x3e4fd6['attributes']=_0x3e4fd6[_0x5646('0x36')][_0x5646('0x37')]?_0x3e4fd6[_0x5646('0x36')]:_0xfed9d8['model'];if(!_0x230437[_0x5646('0x30')][_0x5646('0x38')](_0x5646('0x39'))){_0x3e4fd6[_0x5646('0x1f')]=qs['limit'](_0x230437[_0x5646('0x30')][_0x5646('0x1f')]);_0x3e4fd6['offset']=qs['offset'](_0x230437[_0x5646('0x30')][_0x5646('0x21')]);}_0x3e4fd6['order']=qs[_0x5646('0x3a')](_0x230437[_0x5646('0x30')]['sort']);_0x3e4fd6[_0x5646('0x3b')]=qs[_0x5646('0x32')](_[_0x5646('0x3c')](_0x230437['query'],_0xfed9d8[_0x5646('0x32')]),_0x5a657a);if(_0x230437[_0x5646('0x30')][_0x5646('0x3d')]){_0x3e4fd6[_0x5646('0x3b')]=_['merge'](_0x3e4fd6[_0x5646('0x3b')],{'$or':_[_0x5646('0x2b')](_0x5a657a,function(_0x5e79f5){if(_0x5e79f5['type']!==_0x5646('0x3e')){var _0x3e91a8={};_0x3e91a8[_0x5e79f5[_0x5646('0x2a')]]={'$like':'%'+_0x230437[_0x5646('0x30')][_0x5646('0x3d')]+'%'};return _0x3e91a8;}})});}_0x3e4fd6=_[_0x5646('0x3f')]({},_0x3e4fd6,_0x230437['options']);var _0x11c792={'where':_0x3e4fd6[_0x5646('0x3b')]};return db[_0x5646('0x2c')][_0x5646('0x20')](_0x11c792)['then'](function(_0x23c656){_0x57ca65[_0x5646('0x20')]=_0x23c656;if(_0x230437[_0x5646('0x30')]['includeAll']){_0x3e4fd6[_0x5646('0x40')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x5646('0x41')](_0x3e4fd6);})[_0x5646('0x27')](function(_0x1ca677){_0x57ca65[_0x5646('0x42')]=_0x1ca677;return _0x57ca65;})[_0x5646('0x27')](respondWithFilteredResult(_0x222ed0,_0x3e4fd6))[_0x5646('0x43')](handleError(_0x222ed0,null));};exports[_0x5646('0x44')]=function(_0x18c724,_0xdf9a87){var _0x15a79={'raw':!![],'where':{'id':_0x18c724['params']['id']}},_0x4eb0ee={};_0x4eb0ee[_0x5646('0x34')]=_[_0x5646('0x31')](db[_0x5646('0x2c')]['rawAttributes']);_0x4eb0ee['query']=_[_0x5646('0x31')](_0x18c724[_0x5646('0x30')]);_0x4eb0ee[_0x5646('0x32')]=_['intersection'](_0x4eb0ee['model'],_0x4eb0ee[_0x5646('0x30')]);_0x15a79[_0x5646('0x36')]=_['intersection'](_0x4eb0ee[_0x5646('0x34')],qs[_0x5646('0x35')](_0x18c724['query'][_0x5646('0x35')]));_0x15a79[_0x5646('0x36')]=_0x15a79[_0x5646('0x36')][_0x5646('0x37')]?_0x15a79[_0x5646('0x36')]:_0x4eb0ee[_0x5646('0x34')];if(_0x18c724['query'][_0x5646('0x45')]){_0x15a79['include']=[{'all':!![]}];}_0x15a79=_['merge']({},_0x15a79,_0x18c724[_0x5646('0x46')]);return db['SmsTransferReport'][_0x5646('0x47')](_0x15a79)[_0x5646('0x27')](handleEntityNotFound(_0xdf9a87,null))[_0x5646('0x27')](respondWithResult(_0xdf9a87,null))[_0x5646('0x43')](handleError(_0xdf9a87,null));};exports[_0x5646('0x48')]=function(_0x19bdcb,_0x227231){return db[_0x5646('0x2c')][_0x5646('0x48')](_0x19bdcb[_0x5646('0x49')],{})[_0x5646('0x27')](respondWithResult(_0x227231,0xc9))[_0x5646('0x43')](handleError(_0x227231,null));};exports['update']=function(_0x3b47f5,_0x7d2482){if(_0x3b47f5[_0x5646('0x49')]['id']){delete _0x3b47f5[_0x5646('0x49')]['id'];}return db[_0x5646('0x2c')][_0x5646('0x47')]({'where':{'id':_0x3b47f5[_0x5646('0x4a')]['id']}})[_0x5646('0x27')](handleEntityNotFound(_0x7d2482,null))[_0x5646('0x27')](saveUpdates(_0x3b47f5[_0x5646('0x49')],null))['then'](respondWithResult(_0x7d2482,null))[_0x5646('0x43')](handleError(_0x7d2482,null));};exports[_0x5646('0x28')]=function(_0xfb8e80,_0x2cb9bf){return db['SmsTransferReport'][_0x5646('0x47')]({'where':{'id':_0xfb8e80[_0x5646('0x4a')]['id']}})[_0x5646('0x27')](handleEntityNotFound(_0x2cb9bf,null))[_0x5646('0x27')](removeEntity(_0x2cb9bf,null))[_0x5646('0x43')](handleError(_0x2cb9bf,null));};exports[_0x5646('0x4b')]=function(_0x2998eb,_0xd5d929){return db['SmsTransferReport'][_0x5646('0x4b')]()['then'](respondWithResult(_0xd5d929,null))[_0x5646('0x43')](handleError(_0xd5d929,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 167727d..d0e01ab 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 _0x8f4e=['../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2b55b5,_0x78505e){var _0x103d28=function(_0x5095a2){while(--_0x5095a2){_0x2b55b5['push'](_0x2b55b5['shift']());}};_0x103d28(++_0x78505e);}(_0x8f4e,0x149));var _0xe8f4=function(_0x5dc568,_0x599a62){_0x5dc568=_0x5dc568-0x0;var _0x354212=_0x8f4e[_0x5dc568];return _0x354212;};'use strict';var _=require(_0xe8f4('0x0'));var util=require('util');var logger=require(_0xe8f4('0x1'))(_0xe8f4('0x2'));var moment=require(_0xe8f4('0x3'));var BPromise=require('bluebird');var rp=require(_0xe8f4('0x4'));var fs=require('fs');var path=require(_0xe8f4('0x5'));var rimraf=require(_0xe8f4('0x6'));var config=require(_0xe8f4('0x7'));var attributes=require(_0xe8f4('0x8'));module[_0xe8f4('0x9')]=function(_0x4d2238,_0x37c911){return _0x4d2238[_0xe8f4('0xa')](_0xe8f4('0xb'),attributes,{'tableName':_0xe8f4('0xc'),'paranoid':![],'indexes':[{'name':_0xe8f4('0xd'),'fields':[_0xe8f4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa5fd=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa5fd,0x90));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xda5f('0x0'));var util=require('util');var logger=require(_0xda5f('0x1'))(_0xda5f('0x2'));var moment=require(_0xda5f('0x3'));var BPromise=require('bluebird');var rp=require(_0xda5f('0x4'));var fs=require('fs');var path=require(_0xda5f('0x5'));var rimraf=require(_0xda5f('0x6'));var config=require(_0xda5f('0x7'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x372ee6,_0x2798db){return _0x372ee6[_0xda5f('0x8')](_0xda5f('0x9'),attributes,{'tableName':_0xda5f('0xa'),'paranoid':![],'indexes':[{'name':_0xda5f('0xb'),'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 441d24e..0ffbc74 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 _0xa7dc=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x1290cd,_0x21aefa){var _0x22e1c3=function(_0x55fc23){while(--_0x55fc23){_0x1290cd['push'](_0x1290cd['shift']());}};_0x22e1c3(++_0x21aefa);}(_0xa7dc,0x11d));var _0xca7d=function(_0x3970e2,_0x131481){_0x3970e2=_0x3970e2-0x0;var _0x4e7588=_0xa7dc[_0x3970e2];return _0x4e7588;};'use strict';var _=require(_0xca7d('0x0'));var util=require(_0xca7d('0x1'));var moment=require(_0xca7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xca7d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca7d('0x4'))['db'];var utils=require(_0xca7d('0x5'));var logger=require(_0xca7d('0x6'))(_0xca7d('0x7'));var config=require(_0xca7d('0x8'));var jayson=require(_0xca7d('0x9'));var client=jayson[_0xca7d('0xa')][_0xca7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5073dd,_0x22223d,_0x820afa){return new BPromise(function(_0x4d5bc7,_0x2920bd){return client[_0xca7d('0xc')](_0x5073dd,_0x820afa)[_0xca7d('0xd')](function(_0x5236ce){logger[_0xca7d('0xe')](_0xca7d('0xf'),_0x22223d,_0xca7d('0x10'));logger[_0xca7d('0x11')](_0xca7d('0x12'),_0x22223d,'request\x20sent',JSON[_0xca7d('0x13')](_0x5236ce));if(_0x5236ce['error']){if(_0x5236ce[_0xca7d('0x14')]['code']===0x1f4){logger[_0xca7d('0x14')](_0xca7d('0xf'),_0x22223d,_0x5236ce[_0xca7d('0x14')][_0xca7d('0x15')]);return _0x2920bd(_0x5236ce['error']['message']);}logger['error'](_0xca7d('0xf'),_0x22223d,_0x5236ce[_0xca7d('0x14')][_0xca7d('0x15')]);return _0x4d5bc7(_0x5236ce[_0xca7d('0x14')][_0xca7d('0x15')]);}else{logger[_0xca7d('0xe')](_0xca7d('0xf'),_0x22223d,_0xca7d('0x10'));_0x4d5bc7(_0x5236ce[_0xca7d('0x16')][_0xca7d('0x15')]);}})[_0xca7d('0x17')](function(_0x245c7c){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x22223d,_0x245c7c);_0x2920bd(_0x245c7c);});});} \ No newline at end of file +var _0x6347=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsTransferReport,\x20%s,\x20%s','message','info'];(function(_0x3d86f5,_0x257914){var _0x2d6881=function(_0x2d912e){while(--_0x2d912e){_0x3d86f5['push'](_0x3d86f5['shift']());}};_0x2d6881(++_0x257914);}(_0x6347,0x1c9));var _0x7634=function(_0x8db153,_0xa31e76){_0x8db153=_0x8db153-0x0;var _0x55499d=_0x6347[_0x8db153];return _0x55499d;};'use strict';var _=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var moment=require('moment');var BPromise=require(_0x7634('0x2'));var rs=require(_0x7634('0x3'));var fs=require('fs');var Redis=require(_0x7634('0x4'));var db=require(_0x7634('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7634('0x6'))('rpc');var config=require(_0x7634('0x7'));var jayson=require(_0x7634('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa1f11a,_0x186db8,_0x33eb7e){return new BPromise(function(_0x453e4b,_0x37dc47){return client[_0x7634('0x9')](_0xa1f11a,_0x33eb7e)['then'](function(_0x3e8332){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x186db8,'request\x20sent');logger[_0x7634('0xa')](_0x7634('0xb'),_0x186db8,_0x7634('0xc'),JSON[_0x7634('0xd')](_0x3e8332));if(_0x3e8332[_0x7634('0xe')]){if(_0x3e8332['error']['code']===0x1f4){logger[_0x7634('0xe')](_0x7634('0xf'),_0x186db8,_0x3e8332[_0x7634('0xe')][_0x7634('0x10')]);return _0x37dc47(_0x3e8332[_0x7634('0xe')][_0x7634('0x10')]);}logger[_0x7634('0xe')](_0x7634('0xf'),_0x186db8,_0x3e8332['error'][_0x7634('0x10')]);return _0x453e4b(_0x3e8332[_0x7634('0xe')][_0x7634('0x10')]);}else{logger[_0x7634('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x186db8,_0x7634('0xc'));_0x453e4b(_0x3e8332['result'][_0x7634('0x10')]);}})[_0x7634('0x12')](function(_0x3b74da){logger[_0x7634('0xe')](_0x7634('0xf'),_0x186db8,_0x3b74da);_0x37dc47(_0x3b74da);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index bad5d07..57a58ec 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 _0x87dd=['multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','download','join','originalname','replace','%s-%s%s','extname','now','post','single','file','create','put','update','delete','exports'];(function(_0x3a0234,_0x568a58){var _0x3b6f13=function(_0x2cbc49){while(--_0x2cbc49){_0x3a0234['push'](_0x3a0234['shift']());}};_0x3b6f13(++_0x568a58);}(_0x87dd,0x104));var _0xd87d=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0x87dd[_0x1344d6];return _0xf45b24;};'use strict';var multer=require(_0xd87d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd87d('0x1'));var express=require('express');var router=express[_0xd87d('0x2')]();var fs_extra=require(_0xd87d('0x3'));var auth=require(_0xd87d('0x4'));var interaction=require(_0xd87d('0x5'));var config=require(_0xd87d('0x6'));var controller=require(_0xd87d('0x7'));router[_0xd87d('0x8')]('/',auth[_0xd87d('0x9')](),controller['index']);router[_0xd87d('0x8')](_0xd87d('0xa'),auth[_0xd87d('0x9')](),controller['show']);router[_0xd87d('0x8')]('/:id/download',auth[_0xd87d('0x9')](),controller[_0xd87d('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5a2ca4,_0x131e4e,_0xb83dd3){_0xb83dd3(null,path[_0xd87d('0xc')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x36659c,_0x5e6db2,_0xadf557){_0x5e6db2[_0xd87d('0xd')]=_0x5e6db2[_0xd87d('0xd')][_0xd87d('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xadf557(null,util['format'](_0xd87d('0xf'),path['basename'](_0x5e6db2[_0xd87d('0xd')],path[_0xd87d('0x10')](_0x5e6db2[_0xd87d('0xd')])),Date[_0xd87d('0x11')](),path[_0xd87d('0x10')](_0x5e6db2['originalname'])));}})});router[_0xd87d('0x12')]('/',upload[_0xd87d('0x13')](_0xd87d('0x14')),controller[_0xd87d('0x15')]);router[_0xd87d('0x16')]('/:id',auth[_0xd87d('0x9')](),controller[_0xd87d('0x17')]);router[_0xd87d('0x18')](_0xd87d('0xa'),auth['isAuthenticated'](),controller[_0xd87d('0x18')]);module[_0xd87d('0x19')]=router; \ No newline at end of file +var _0x7d50=['format','%s-%s%s','basename','extname','now','post','single','file','create','put','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./sound.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname'];(function(_0x1ab4be,_0x48a8b6){var _0x4f1bee=function(_0x393375){while(--_0x393375){_0x1ab4be['push'](_0x1ab4be['shift']());}};_0x4f1bee(++_0x48a8b6);}(_0x7d50,0x1dd));var _0x07d5=function(_0x10b8e0,_0x39a4cd){_0x10b8e0=_0x10b8e0-0x0;var _0x5cb9a7=_0x7d50[_0x10b8e0];return _0x5cb9a7;};'use strict';var multer=require(_0x07d5('0x0'));var util=require(_0x07d5('0x1'));var path=require(_0x07d5('0x2'));var timeout=require(_0x07d5('0x3'));var express=require(_0x07d5('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x07d5('0x5'));var interaction=require(_0x07d5('0x6'));var config=require('../../config/environment');var controller=require(_0x07d5('0x7'));router['get']('/',auth[_0x07d5('0x8')](),controller[_0x07d5('0x9')]);router[_0x07d5('0xa')](_0x07d5('0xb'),auth[_0x07d5('0x8')](),controller[_0x07d5('0xc')]);router['get'](_0x07d5('0xd'),auth[_0x07d5('0x8')](),controller[_0x07d5('0xe')]);var upload=multer({'storage':multer[_0x07d5('0xf')]({'destination':function(_0x3310f9,_0x123f30,_0x22b38f){_0x22b38f(null,path['join'](config[_0x07d5('0x10')],_0x07d5('0x11')));},'filename':function(_0x3c61be,_0x405449,_0x3ad0ea){_0x405449[_0x07d5('0x12')]=_0x405449[_0x07d5('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ad0ea(null,util[_0x07d5('0x13')](_0x07d5('0x14'),path[_0x07d5('0x15')](_0x405449[_0x07d5('0x12')],path[_0x07d5('0x16')](_0x405449[_0x07d5('0x12')])),Date[_0x07d5('0x17')](),path[_0x07d5('0x16')](_0x405449['originalname'])));}})});router[_0x07d5('0x18')]('/',upload[_0x07d5('0x19')](_0x07d5('0x1a')),controller[_0x07d5('0x1b')]);router[_0x07d5('0x1c')](_0x07d5('0xb'),auth[_0x07d5('0x8')](),controller[_0x07d5('0x1d')]);router['delete'](_0x07d5('0xb'),auth['isAuthenticated'](),controller[_0x07d5('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 514464d..9359c79 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 _0x5c82=['BIGINT','INTEGER','sequelize','exports','STRING','FLOAT'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5c82,0x16a));var _0x25c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c82[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x25c8('0x0'));module[_0x25c8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x25c8('0x2')]},'display_name':{'type':Sequelize[_0x25c8('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x25c8('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x25c8('0x3')]},'original_sampleCount':{'type':Sequelize[_0x25c8('0x4')]},'original_channelCount':{'type':Sequelize[_0x25c8('0x5')]},'original_bitRate':{'type':Sequelize[_0x25c8('0x4')]},'original_sampleRate':{'type':Sequelize[_0x25c8('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x25c8('0x5')]},'converted_bitRate':{'type':Sequelize[_0x25c8('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x25c8('0x5')]}}; \ No newline at end of file +var _0x02c6=['BIGINT','INTEGER','sequelize','exports','STRING','FLOAT'];(function(_0x268beb,_0x38ab4f){var _0x4a9fe8=function(_0x15a3af){while(--_0x15a3af){_0x268beb['push'](_0x268beb['shift']());}};_0x4a9fe8(++_0x38ab4f);}(_0x02c6,0x7a));var _0x602c=function(_0x5c697c,_0x294022){_0x5c697c=_0x5c697c-0x0;var _0x2b4ac0=_0x02c6[_0x5c697c];return _0x2b4ac0;};'use strict';var Sequelize=require(_0x602c('0x0'));module[_0x602c('0x1')]={'name':{'type':Sequelize[_0x602c('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x602c('0x2')]},'display_name':{'type':Sequelize[_0x602c('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x602c('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x602c('0x3')]},'original_sampleCount':{'type':Sequelize[_0x602c('0x4')]},'original_channelCount':{'type':Sequelize[_0x602c('0x5')]},'original_bitRate':{'type':Sequelize[_0x602c('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x602c('0x2')]},'converted_duration':{'type':Sequelize[_0x602c('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x602c('0x4')]},'converted_channelCount':{'type':Sequelize[_0x602c('0x5')]},'converted_bitRate':{'type':Sequelize[_0x602c('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x602c('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 73a726a..82aa601 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 _0x9d33=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','then','destroy','Sounds','UserProfileResource','stack','name','send','index','Sound','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','type','filter','options','include','findAll','rows','show','params','includeAll','merge','find','download','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','catch','create','basename','file','originalname','extname','substring','wav','filename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','error','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','start','update','description','delete','original_format','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis'];(function(_0x56a22b,_0x26ceeb){var _0x1ee847=function(_0x581b44){while(--_0x581b44){_0x56a22b['push'](_0x56a22b['shift']());}};_0x1ee847(++_0x26ceeb);}(_0x9d33,0x16c));var _0x39d3=function(_0x5315b8,_0x4501a0){_0x5315b8=_0x5315b8-0x0;var _0x4c6ffc=_0x9d33[_0x5315b8];return _0x4c6ffc;};'use strict';var emlformat=require(_0x39d3('0x0'));var rimraf=require(_0x39d3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x39d3('0x2'));var rp=require(_0x39d3('0x3'));var moment=require(_0x39d3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x39d3('0x5'));var util=require(_0x39d3('0x6'));var path=require(_0x39d3('0x7'));var sox=require(_0x39d3('0x8'));var csv=require(_0x39d3('0x9'));var ejs=require(_0x39d3('0xa'));var fs=require('fs');var fs_extra=require(_0x39d3('0xb'));var _=require(_0x39d3('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x39d3('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x39d3('0xe'));var Papa=require(_0x39d3('0xf'));var Redis=require(_0x39d3('0x10'));var authService=require(_0x39d3('0x11'));var qs=require(_0x39d3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x39d3('0x13'));var logger=require('../../config/logger')(_0x39d3('0x14'));var utils=require(_0x39d3('0x15'));var config=require(_0x39d3('0x16'));var licenseUtil=require(_0x39d3('0x17'));var db=require(_0x39d3('0x18'))['db'];function respondWithStatusCode(_0x1bf705,_0x21a4c5){_0x21a4c5=_0x21a4c5||0xcc;return function(_0x1d19be){if(_0x1d19be){return _0x1bf705[_0x39d3('0x19')](_0x21a4c5);}return _0x1bf705[_0x39d3('0x1a')](_0x21a4c5)[_0x39d3('0x1b')]();};}function respondWithResult(_0x1cb904,_0x2d0af7){_0x2d0af7=_0x2d0af7||0xc8;return function(_0x147df7){if(_0x147df7){return _0x1cb904[_0x39d3('0x1a')](_0x2d0af7)[_0x39d3('0x1c')](_0x147df7);}};}function respondWithFilteredResult(_0x49c3c3,_0x2e0b3b){return function(_0x14c466){if(_0x14c466){var _0x8d178a=typeof _0x2e0b3b[_0x39d3('0x1d')]===_0x39d3('0x1e')&&typeof _0x2e0b3b['limit']==='undefined';var _0xf827fe=_0x14c466[_0x39d3('0x1f')];var _0x2d52b5=_0x8d178a?0x0:_0x2e0b3b['offset'];var _0x26d84e=_0x8d178a?_0x14c466[_0x39d3('0x1f')]:_0x2e0b3b['offset']+_0x2e0b3b['limit'];var _0x4dac52;if(_0x26d84e>=_0xf827fe){_0x26d84e=_0xf827fe;_0x4dac52=0xc8;}else{_0x4dac52=0xce;}_0x49c3c3['status'](_0x4dac52);return _0x49c3c3[_0x39d3('0x20')](_0x39d3('0x21'),_0x2d52b5+'-'+_0x26d84e+'/'+_0xf827fe)['json'](_0x14c466);}return null;};}function patchUpdates(_0x3bea69){return function(_0x6a6780){try{jsonpatch['apply'](_0x6a6780,_0x3bea69,!![]);}catch(_0x32527f){return BPromise[_0x39d3('0x22')](_0x32527f);}return _0x6a6780[_0x39d3('0x23')]();};}function saveUpdates(_0x335d61,_0x2ddd2a){return function(_0x315d96){if(_0x315d96){return _0x315d96['update'](_0x335d61)[_0x39d3('0x24')](function(_0x5b6691){return _0x5b6691;});}return null;};}function removeEntity(_0x47068c,_0x4c9d15){return function(_0x1aaab2){if(_0x1aaab2){return _0x1aaab2[_0x39d3('0x25')]()[_0x39d3('0x24')](function(){var _0x109eaa=_0x1aaab2['get']({'plain':!![]});var _0x3fa465=_0x39d3('0x26');return db[_0x39d3('0x27')][_0x39d3('0x25')]({'where':{'type':_0x3fa465,'resourceId':_0x109eaa['id']}})['then'](function(){return _0x1aaab2;});})[_0x39d3('0x24')](function(){_0x47068c['status'](0xcc)[_0x39d3('0x1b')]();});}};}function handleEntityNotFound(_0x5b4eaf,_0x35a504){return function(_0x5be084){if(!_0x5be084){_0x5b4eaf[_0x39d3('0x19')](0x194);}return _0x5be084;};}function handleError(_0x4a032d,_0x17022b){_0x17022b=_0x17022b||0x1f4;return function(_0x5e57aa){logger['error'](_0x5e57aa[_0x39d3('0x28')]);if(_0x5e57aa[_0x39d3('0x29')]){delete _0x5e57aa[_0x39d3('0x29')];}_0x4a032d[_0x39d3('0x1a')](_0x17022b)[_0x39d3('0x2a')](_0x5e57aa);};}exports[_0x39d3('0x2b')]=function(_0xb31d7f,_0x4c1979){var _0x325d47={},_0x1e6950={},_0x14e9ff={'count':0x0,'rows':[]};var _0x49a550=_['map'](db[_0x39d3('0x2c')][_0x39d3('0x2d')],function(_0x625d6){return{'name':_0x625d6['fieldName'],'type':_0x625d6['type'][_0x39d3('0x2e')]};});_0x1e6950[_0x39d3('0x2f')]=_['map'](_0x49a550,_0x39d3('0x29'));_0x1e6950[_0x39d3('0x30')]=_[_0x39d3('0x31')](_0xb31d7f[_0x39d3('0x30')]);_0x1e6950[_0x39d3('0x32')]=_[_0x39d3('0x33')](_0x1e6950[_0x39d3('0x2f')],_0x1e6950[_0x39d3('0x30')]);_0x325d47[_0x39d3('0x34')]=_[_0x39d3('0x33')](_0x1e6950['model'],qs[_0x39d3('0x35')](_0xb31d7f[_0x39d3('0x30')][_0x39d3('0x35')]));_0x325d47['attributes']=_0x325d47[_0x39d3('0x34')][_0x39d3('0x36')]?_0x325d47[_0x39d3('0x34')]:_0x1e6950['model'];if(!_0xb31d7f[_0x39d3('0x30')][_0x39d3('0x37')](_0x39d3('0x38'))){_0x325d47[_0x39d3('0x39')]=qs[_0x39d3('0x39')](_0xb31d7f[_0x39d3('0x30')][_0x39d3('0x39')]);_0x325d47['offset']=qs[_0x39d3('0x1d')](_0xb31d7f['query']['offset']);}_0x325d47['order']=qs[_0x39d3('0x3a')](_0xb31d7f[_0x39d3('0x30')][_0x39d3('0x3a')]);_0x325d47[_0x39d3('0x3b')]=qs['filters'](_[_0x39d3('0x3c')](_0xb31d7f[_0x39d3('0x30')],_0x1e6950['filters']),_0x49a550);if(_0xb31d7f[_0x39d3('0x30')]['filter']){_0x325d47['where']=_['merge'](_0x325d47[_0x39d3('0x3b')],{'$or':_['map'](_0x49a550,function(_0x199d4a){if(_0x199d4a[_0x39d3('0x3d')]!=='VIRTUAL'){var _0x12cdf1={};_0x12cdf1[_0x199d4a[_0x39d3('0x29')]]={'$like':'%'+_0xb31d7f[_0x39d3('0x30')][_0x39d3('0x3e')]+'%'};return _0x12cdf1;}})});}_0x325d47=_['merge']({},_0x325d47,_0xb31d7f[_0x39d3('0x3f')]);var _0x4be6f6={'where':_0x325d47[_0x39d3('0x3b')]};return db[_0x39d3('0x2c')][_0x39d3('0x1f')](_0x4be6f6)[_0x39d3('0x24')](function(_0x15b2a5){_0x14e9ff['count']=_0x15b2a5;if(_0xb31d7f[_0x39d3('0x30')]['includeAll']){_0x325d47[_0x39d3('0x40')]=[{'all':!![]}];}return db[_0x39d3('0x2c')][_0x39d3('0x41')](_0x325d47);})[_0x39d3('0x24')](function(_0x3a3c56){_0x14e9ff[_0x39d3('0x42')]=_0x3a3c56;return _0x14e9ff;})[_0x39d3('0x24')](respondWithFilteredResult(_0x4c1979,_0x325d47))['catch'](handleError(_0x4c1979,null));};exports[_0x39d3('0x43')]=function(_0x329a04,_0xa01209){var _0x5e56b2={'raw':!![],'where':{'id':_0x329a04[_0x39d3('0x44')]['id']}},_0x1fbbef={};_0x1fbbef[_0x39d3('0x2f')]=_[_0x39d3('0x31')](db[_0x39d3('0x2c')][_0x39d3('0x2d')]);_0x1fbbef[_0x39d3('0x30')]=_['keys'](_0x329a04[_0x39d3('0x30')]);_0x1fbbef[_0x39d3('0x32')]=_[_0x39d3('0x33')](_0x1fbbef[_0x39d3('0x2f')],_0x1fbbef[_0x39d3('0x30')]);_0x5e56b2[_0x39d3('0x34')]=_[_0x39d3('0x33')](_0x1fbbef[_0x39d3('0x2f')],qs['fields'](_0x329a04[_0x39d3('0x30')][_0x39d3('0x35')]));_0x5e56b2[_0x39d3('0x34')]=_0x5e56b2[_0x39d3('0x34')][_0x39d3('0x36')]?_0x5e56b2[_0x39d3('0x34')]:_0x1fbbef[_0x39d3('0x2f')];if(_0x329a04[_0x39d3('0x30')][_0x39d3('0x45')]){_0x5e56b2[_0x39d3('0x40')]=[{'all':!![]}];}_0x5e56b2=_[_0x39d3('0x46')]({},_0x5e56b2,_0x329a04[_0x39d3('0x3f')]);return db['Sound'][_0x39d3('0x47')](_0x5e56b2)[_0x39d3('0x24')](handleEntityNotFound(_0xa01209,null))[_0x39d3('0x24')](respondWithResult(_0xa01209,null))['catch'](handleError(_0xa01209,null));};exports[_0x39d3('0x48')]=function(_0x4438c3,_0x387994,_0x442bf4){return db['Sound'][_0x39d3('0x47')]({'where':{'id':_0x4438c3['params']['id']},'attributes':['name',_0x39d3('0x49'),_0x39d3('0x4a')],'raw':!![]})[_0x39d3('0x24')](handleEntityNotFound(_0x387994,null))['then'](function(_0x49056e){if(_0x49056e){if(!fs['existsSync'](path[_0x39d3('0x4b')](config[_0x39d3('0x4c')],_0x39d3('0x4d'),_0x49056e[_0x39d3('0x49')]+'.'+_0x49056e[_0x39d3('0x4a')]))){throw new db[(_0x39d3('0x4e'))][(_0x39d3('0x4f'))](_0x39d3('0x50'));}return _0x387994[_0x39d3('0x48')](path[_0x39d3('0x4b')](config['root'],'server/files/sounds/converted',util['format'](_0x39d3('0x51'),_0x49056e[_0x39d3('0x49')],_0x49056e[_0x39d3('0x4a')])),util[_0x39d3('0x52')](_0x39d3('0x51'),_0x49056e[_0x39d3('0x29')],_0x49056e[_0x39d3('0x4a')]));}return null;})[_0x39d3('0x53')](handleError(_0x387994,null));};exports[_0x39d3('0x54')]=function(_0x4715c0,_0xab0b56,_0x1a0734){var _0x2fcb4b={'name':path[_0x39d3('0x55')](_0x4715c0[_0x39d3('0x56')][_0x39d3('0x57')],path[_0x39d3('0x58')](_0x4715c0[_0x39d3('0x56')]['originalname'])),'save_name':path[_0x39d3('0x55')](_0x4715c0['file']['filename'],path[_0x39d3('0x58')](_0x4715c0[_0x39d3('0x56')]['filename'])),'original_format':path[_0x39d3('0x58')](_0x4715c0[_0x39d3('0x56')]['originalname'])[_0x39d3('0x59')](0x1),'converted_format':_0x39d3('0x5a')};var _0x265867=path[_0x39d3('0x4b')](config[_0x39d3('0x4c')],'server/files/sounds/original',_0x4715c0[_0x39d3('0x56')][_0x39d3('0x5b')]);var _0xf688fc=path[_0x39d3('0x4b')](config[_0x39d3('0x4c')],_0x39d3('0x4d'),util[_0x39d3('0x52')](_0x39d3('0x51'),path[_0x39d3('0x55')](_0x4715c0[_0x39d3('0x56')]['filename'],path[_0x39d3('0x58')](_0x4715c0['file'][_0x39d3('0x5b')])),_0x2fcb4b[_0x39d3('0x4a')]));logger[_0x39d3('0x5c')](_0x39d3('0x5d'),_0x265867);logger['info'](_0x39d3('0x5e'),_0xf688fc);try{fs[_0x39d3('0x5f')](_0x265867,parseInt('0777',0x8));var _0x594bb8=sox[_0x39d3('0x60')](_0x265867,_0xf688fc,{'sampleRate':0x1f40,'format':_0x39d3('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x594bb8['on'](_0x39d3('0x61'),function(_0x4c5a2c){fs[_0x39d3('0x62')](_0x265867);_0xab0b56[_0x39d3('0x1a')](0x1f4)[_0x39d3('0x2a')](_0x4c5a2c);});_0x594bb8['on']('src',function(_0x1f9509){_0x2fcb4b[_0x39d3('0x63')]=isNaN(_0x1f9509[_0x39d3('0x64')])?null:_0x1f9509[_0x39d3('0x64')]*0x3e8;_0x2fcb4b[_0x39d3('0x65')]=isNaN(_0x1f9509[_0x39d3('0x66')])?null:_0x1f9509[_0x39d3('0x66')];_0x2fcb4b[_0x39d3('0x67')]=isNaN(_0x1f9509[_0x39d3('0x68')])?null:_0x1f9509[_0x39d3('0x68')];_0x2fcb4b['original_bitRate']=isNaN(_0x1f9509['bitRate'])?null:_0x1f9509[_0x39d3('0x69')];_0x2fcb4b['original_sampleRate']=isNaN(_0x1f9509['sampleRate'])?null:_0x1f9509[_0x39d3('0x6a')];});_0x594bb8['on'](_0x39d3('0x6b'),function(_0x5ee67a){_0x2fcb4b[_0x39d3('0x6c')]=isNaN(_0x5ee67a[_0x39d3('0x64')])?null:_0x5ee67a[_0x39d3('0x64')]*0x3e8;_0x2fcb4b[_0x39d3('0x6d')]=isNaN(_0x5ee67a[_0x39d3('0x66')])?null:_0x5ee67a['sampleCount'];_0x2fcb4b[_0x39d3('0x6e')]=isNaN(_0x5ee67a[_0x39d3('0x68')])?null:_0x5ee67a[_0x39d3('0x68')];_0x2fcb4b[_0x39d3('0x6f')]=isNaN(_0x5ee67a['bitRate'])?null:_0x5ee67a[_0x39d3('0x69')];_0x2fcb4b[_0x39d3('0x70')]=isNaN(_0x5ee67a[_0x39d3('0x6a')])?null:_0x5ee67a[_0x39d3('0x6a')];});_0x594bb8['on'](_0x39d3('0x1b'),function(){fs[_0x39d3('0x5f')](_0xf688fc,parseInt(_0x39d3('0x71'),0x8));return db[_0x39d3('0x2c')][_0x39d3('0x54')](_0x2fcb4b)[_0x39d3('0x24')](function(_0x1c5231){var _0x584c5f={'role':_0x4715c0[_0x39d3('0x72')][_0x39d3('0x73')],'userProfileId':_0x4715c0['body']['userProfileId']};if(!_0x584c5f)throw new Error(_0x39d3('0x74'));if(_0x584c5f['role']===_0x39d3('0x75')){var _0x239f44=_0x1c5231[_0x39d3('0x76')]({'plain':!![]});return db[_0x39d3('0x77')][_0x39d3('0x47')]({'where':{'name':_0x39d3('0x26'),'userProfileId':_0x584c5f[_0x39d3('0x78')]},'raw':!![]})[_0x39d3('0x24')](function(_0x464301){if(_0x464301&&_0x464301[_0x39d3('0x79')]===0x0){return db['UserProfileResource'][_0x39d3('0x54')]({'name':_0x239f44[_0x39d3('0x29')],'resourceId':_0x239f44['id'],'type':_0x464301[_0x39d3('0x29')],'sectionId':_0x464301['id']},{})[_0x39d3('0x24')](function(){return _0x1c5231;});}else{return _0x1c5231;}})[_0x39d3('0x53')](function(_0x144cd9){logger[_0x39d3('0x61')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x144cd9);throw _0x144cd9;});}return _0x1c5231;})[_0x39d3('0x24')](respondWithResult(_0xab0b56,null))['catch'](handleError(_0xab0b56,null));});_0x594bb8[_0x39d3('0x7a')]();}catch(_0x7e6c44){_0xab0b56[_0x39d3('0x1a')](0x1f4)['send'](_0x7e6c44);}};exports[_0x39d3('0x7b')]=function(_0x828442,_0x2bcc38,_0x3461a9){return db[_0x39d3('0x2c')][_0x39d3('0x47')]({'where':{'id':_0x828442['params']['id']}})[_0x39d3('0x24')](handleEntityNotFound(_0x2bcc38,null))[_0x39d3('0x24')](saveUpdates(_[_0x39d3('0x3c')](_0x828442['body'],['name',_0x39d3('0x7c')]),null))[_0x39d3('0x24')](respondWithResult(_0x2bcc38,null))['catch'](handleError(_0x2bcc38,null));};exports[_0x39d3('0x7d')]=function(_0x264c41,_0x549831,_0x45afc5){return db[_0x39d3('0x2c')][_0x39d3('0x47')]({'where':{'id':_0x264c41[_0x39d3('0x44')]['id']}})['then'](function(_0x192952){if(_0x192952){return _0x192952['destroy']();}})[_0x39d3('0x24')](function(_0x29fc8e){var _0x5d7d8c=path['join'](config[_0x39d3('0x4c')],'server/files/sounds/original',util[_0x39d3('0x52')](_0x39d3('0x51'),_0x29fc8e[_0x39d3('0x49')],_0x29fc8e[_0x39d3('0x7e')]));var _0xafd356=path[_0x39d3('0x4b')](config[_0x39d3('0x4c')],_0x39d3('0x4d'),util[_0x39d3('0x52')](_0x39d3('0x51'),_0x29fc8e[_0x39d3('0x49')],_0x29fc8e['converted_format']));fs[_0x39d3('0x62')](_0x5d7d8c);fs['unlinkSync'](_0xafd356);return _0x29fc8e;})[_0x39d3('0x24')](function(_0x5e3dbc){if(_0x5e3dbc){return _0x549831[_0x39d3('0x1a')](0xcc)[_0x39d3('0x1b')]();}})[_0x39d3('0x24')](handleEntityNotFound(_0x549831,null))['catch'](handleError(_0x549831,null));}; \ No newline at end of file +var _0xfdb2=['moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','Sounds','error','stack','name','index','map','Sound','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','fields','length','merge','options','find','params','converted_format','existsSync','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','download','root','format','%s.%s','create','basename','file','originalname','extname','filename','join','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','0777','transcode','wav','send','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','unlinkSync','zip-dir','fast-json-patch'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0xfdb2,0x1ee));var _0x2fdb=function(_0x5411ed,_0x7b2190){_0x5411ed=_0x5411ed-0x0;var _0x117f58=_0xfdb2[_0x5411ed];return _0x117f58;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2fdb('0x0'));var jsonpatch=require(_0x2fdb('0x1'));var rp=require('request-promise');var moment=require(_0x2fdb('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2fdb('0x3'));var path=require(_0x2fdb('0x4'));var sox=require(_0x2fdb('0x5'));var csv=require(_0x2fdb('0x6'));var ejs=require(_0x2fdb('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2fdb('0x8'));var squel=require(_0x2fdb('0x9'));var crypto=require('crypto');var jsforce=require(_0x2fdb('0xa'));var deskjs=require(_0x2fdb('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2fdb('0xc'));var Papa=require(_0x2fdb('0xd'));var Redis=require(_0x2fdb('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2fdb('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2fdb('0x10'))('api');var utils=require(_0x2fdb('0x11'));var config=require(_0x2fdb('0x12'));var licenseUtil=require(_0x2fdb('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112ce9,_0x3631b7){_0x3631b7=_0x3631b7||0xcc;return function(_0x4b9160){if(_0x4b9160){return _0x112ce9[_0x2fdb('0x14')](_0x3631b7);}return _0x112ce9[_0x2fdb('0x15')](_0x3631b7)[_0x2fdb('0x16')]();};}function respondWithResult(_0x45ab36,_0x314353){_0x314353=_0x314353||0xc8;return function(_0xe058fe){if(_0xe058fe){return _0x45ab36['status'](_0x314353)[_0x2fdb('0x17')](_0xe058fe);}};}function respondWithFilteredResult(_0x50c1f4,_0x116cfe){return function(_0x16d69a){if(_0x16d69a){var _0x11de2d=typeof _0x116cfe[_0x2fdb('0x18')]===_0x2fdb('0x19')&&typeof _0x116cfe['limit']===_0x2fdb('0x19');var _0x418dad=_0x16d69a[_0x2fdb('0x1a')];var _0x46793b=_0x11de2d?0x0:_0x116cfe[_0x2fdb('0x18')];var _0x2e72a6=_0x11de2d?_0x16d69a['count']:_0x116cfe[_0x2fdb('0x18')]+_0x116cfe[_0x2fdb('0x1b')];var _0x467930;if(_0x2e72a6>=_0x418dad){_0x2e72a6=_0x418dad;_0x467930=0xc8;}else{_0x467930=0xce;}_0x50c1f4[_0x2fdb('0x15')](_0x467930);return _0x50c1f4[_0x2fdb('0x1c')]('Content-Range',_0x46793b+'-'+_0x2e72a6+'/'+_0x418dad)[_0x2fdb('0x17')](_0x16d69a);}return null;};}function patchUpdates(_0x5353c8){return function(_0x3ba63d){try{jsonpatch[_0x2fdb('0x1d')](_0x3ba63d,_0x5353c8,!![]);}catch(_0x2f48ae){return BPromise[_0x2fdb('0x1e')](_0x2f48ae);}return _0x3ba63d[_0x2fdb('0x1f')]();};}function saveUpdates(_0x4b9fa0,_0xc39f64){return function(_0xdfb7f1){if(_0xdfb7f1){return _0xdfb7f1[_0x2fdb('0x20')](_0x4b9fa0)[_0x2fdb('0x21')](function(_0x5f0647){return _0x5f0647;});}return null;};}function removeEntity(_0x39a5fa,_0x3d5f10){return function(_0x32255a){if(_0x32255a){return _0x32255a[_0x2fdb('0x22')]()['then'](function(){var _0x4bb609=_0x32255a[_0x2fdb('0x23')]({'plain':!![]});var _0x32e7b9=_0x2fdb('0x24');return db['UserProfileResource'][_0x2fdb('0x22')]({'where':{'type':_0x32e7b9,'resourceId':_0x4bb609['id']}})['then'](function(){return _0x32255a;});})[_0x2fdb('0x21')](function(){_0x39a5fa[_0x2fdb('0x15')](0xcc)[_0x2fdb('0x16')]();});}};}function handleEntityNotFound(_0x57451d,_0x30c67c){return function(_0x7da789){if(!_0x7da789){_0x57451d[_0x2fdb('0x14')](0x194);}return _0x7da789;};}function handleError(_0xcabe64,_0x54391c){_0x54391c=_0x54391c||0x1f4;return function(_0x3c8ac4){logger[_0x2fdb('0x25')](_0x3c8ac4[_0x2fdb('0x26')]);if(_0x3c8ac4[_0x2fdb('0x27')]){delete _0x3c8ac4[_0x2fdb('0x27')];}_0xcabe64[_0x2fdb('0x15')](_0x54391c)['send'](_0x3c8ac4);};}exports[_0x2fdb('0x28')]=function(_0x23efde,_0x173a9d){var _0xfc2688={},_0x430900={},_0x1cc246={'count':0x0,'rows':[]};var _0x1feabf=_[_0x2fdb('0x29')](db[_0x2fdb('0x2a')]['rawAttributes'],function(_0x15fca5){return{'name':_0x15fca5[_0x2fdb('0x2b')],'type':_0x15fca5[_0x2fdb('0x2c')][_0x2fdb('0x2d')]};});_0x430900[_0x2fdb('0x2e')]=_[_0x2fdb('0x29')](_0x1feabf,_0x2fdb('0x27'));_0x430900[_0x2fdb('0x2f')]=_[_0x2fdb('0x30')](_0x23efde[_0x2fdb('0x2f')]);_0x430900[_0x2fdb('0x31')]=_[_0x2fdb('0x32')](_0x430900[_0x2fdb('0x2e')],_0x430900[_0x2fdb('0x2f')]);_0xfc2688['attributes']=_[_0x2fdb('0x32')](_0x430900[_0x2fdb('0x2e')],qs['fields'](_0x23efde['query']['fields']));_0xfc2688[_0x2fdb('0x33')]=_0xfc2688['attributes']['length']?_0xfc2688[_0x2fdb('0x33')]:_0x430900[_0x2fdb('0x2e')];if(!_0x23efde[_0x2fdb('0x2f')][_0x2fdb('0x34')](_0x2fdb('0x35'))){_0xfc2688[_0x2fdb('0x1b')]=qs[_0x2fdb('0x1b')](_0x23efde[_0x2fdb('0x2f')][_0x2fdb('0x1b')]);_0xfc2688[_0x2fdb('0x18')]=qs['offset'](_0x23efde[_0x2fdb('0x2f')]['offset']);}_0xfc2688[_0x2fdb('0x36')]=qs[_0x2fdb('0x37')](_0x23efde[_0x2fdb('0x2f')][_0x2fdb('0x37')]);_0xfc2688[_0x2fdb('0x38')]=qs['filters'](_[_0x2fdb('0x39')](_0x23efde[_0x2fdb('0x2f')],_0x430900[_0x2fdb('0x31')]),_0x1feabf);if(_0x23efde['query'][_0x2fdb('0x3a')]){_0xfc2688[_0x2fdb('0x38')]=_['merge'](_0xfc2688['where'],{'$or':_[_0x2fdb('0x29')](_0x1feabf,function(_0x1765fe){if(_0x1765fe[_0x2fdb('0x2c')]!==_0x2fdb('0x3b')){var _0x3c1df6={};_0x3c1df6[_0x1765fe['name']]={'$like':'%'+_0x23efde[_0x2fdb('0x2f')][_0x2fdb('0x3a')]+'%'};return _0x3c1df6;}})});}_0xfc2688=_['merge']({},_0xfc2688,_0x23efde['options']);var _0x3f03b8={'where':_0xfc2688[_0x2fdb('0x38')]};return db[_0x2fdb('0x2a')][_0x2fdb('0x1a')](_0x3f03b8)[_0x2fdb('0x21')](function(_0xcb00f){_0x1cc246[_0x2fdb('0x1a')]=_0xcb00f;if(_0x23efde[_0x2fdb('0x2f')][_0x2fdb('0x3c')]){_0xfc2688[_0x2fdb('0x3d')]=[{'all':!![]}];}return db[_0x2fdb('0x2a')][_0x2fdb('0x3e')](_0xfc2688);})[_0x2fdb('0x21')](function(_0x157acf){_0x1cc246[_0x2fdb('0x3f')]=_0x157acf;return _0x1cc246;})[_0x2fdb('0x21')](respondWithFilteredResult(_0x173a9d,_0xfc2688))[_0x2fdb('0x40')](handleError(_0x173a9d,null));};exports['show']=function(_0x2e2ac8,_0x32b227){var _0x273586={'raw':!![],'where':{'id':_0x2e2ac8['params']['id']}},_0x869b16={};_0x869b16[_0x2fdb('0x2e')]=_['keys'](db['Sound']['rawAttributes']);_0x869b16[_0x2fdb('0x2f')]=_[_0x2fdb('0x30')](_0x2e2ac8[_0x2fdb('0x2f')]);_0x869b16[_0x2fdb('0x31')]=_[_0x2fdb('0x32')](_0x869b16[_0x2fdb('0x2e')],_0x869b16[_0x2fdb('0x2f')]);_0x273586[_0x2fdb('0x33')]=_['intersection'](_0x869b16[_0x2fdb('0x2e')],qs[_0x2fdb('0x41')](_0x2e2ac8['query'][_0x2fdb('0x41')]));_0x273586[_0x2fdb('0x33')]=_0x273586['attributes'][_0x2fdb('0x42')]?_0x273586[_0x2fdb('0x33')]:_0x869b16[_0x2fdb('0x2e')];if(_0x2e2ac8[_0x2fdb('0x2f')][_0x2fdb('0x3c')]){_0x273586[_0x2fdb('0x3d')]=[{'all':!![]}];}_0x273586=_[_0x2fdb('0x43')]({},_0x273586,_0x2e2ac8[_0x2fdb('0x44')]);return db[_0x2fdb('0x2a')]['find'](_0x273586)[_0x2fdb('0x21')](handleEntityNotFound(_0x32b227,null))[_0x2fdb('0x21')](respondWithResult(_0x32b227,null))['catch'](handleError(_0x32b227,null));};exports['download']=function(_0x900b22,_0x13e94f,_0x3c03c0){return db[_0x2fdb('0x2a')][_0x2fdb('0x45')]({'where':{'id':_0x900b22[_0x2fdb('0x46')]['id']},'attributes':['name','save_name',_0x2fdb('0x47')],'raw':!![]})[_0x2fdb('0x21')](handleEntityNotFound(_0x13e94f,null))[_0x2fdb('0x21')](function(_0x34c34c){if(_0x34c34c){if(!fs[_0x2fdb('0x48')](path['join'](config['root'],_0x2fdb('0x49'),_0x34c34c[_0x2fdb('0x4a')]+'.'+_0x34c34c['converted_format']))){throw new db[(_0x2fdb('0x4b'))][(_0x2fdb('0x4c'))](_0x2fdb('0x4d'));}return _0x13e94f[_0x2fdb('0x4e')](path['join'](config[_0x2fdb('0x4f')],_0x2fdb('0x49'),util[_0x2fdb('0x50')](_0x2fdb('0x51'),_0x34c34c[_0x2fdb('0x4a')],_0x34c34c[_0x2fdb('0x47')])),util['format'](_0x2fdb('0x51'),_0x34c34c[_0x2fdb('0x27')],_0x34c34c[_0x2fdb('0x47')]));}return null;})[_0x2fdb('0x40')](handleError(_0x13e94f,null));};exports[_0x2fdb('0x52')]=function(_0xbf4101,_0x360bc6,_0x438aa3){var _0x555345={'name':path[_0x2fdb('0x53')](_0xbf4101[_0x2fdb('0x54')][_0x2fdb('0x55')],path[_0x2fdb('0x56')](_0xbf4101[_0x2fdb('0x54')][_0x2fdb('0x55')])),'save_name':path['basename'](_0xbf4101[_0x2fdb('0x54')][_0x2fdb('0x57')],path[_0x2fdb('0x56')](_0xbf4101['file']['filename'])),'original_format':path[_0x2fdb('0x56')](_0xbf4101[_0x2fdb('0x54')][_0x2fdb('0x55')])['substring'](0x1),'converted_format':'wav'};var _0x26bb2c=path[_0x2fdb('0x58')](config['root'],_0x2fdb('0x59'),_0xbf4101[_0x2fdb('0x54')][_0x2fdb('0x57')]);var _0x440dc0=path['join'](config[_0x2fdb('0x4f')],_0x2fdb('0x49'),util['format']('%s.%s',path['basename'](_0xbf4101[_0x2fdb('0x54')][_0x2fdb('0x57')],path[_0x2fdb('0x56')](_0xbf4101[_0x2fdb('0x54')][_0x2fdb('0x57')])),_0x555345[_0x2fdb('0x47')]));logger[_0x2fdb('0x5a')](_0x2fdb('0x5b'),_0x26bb2c);logger[_0x2fdb('0x5a')]('Sound\x20upload\x20destination:\x20%s',_0x440dc0);try{fs['chmodSync'](_0x26bb2c,parseInt(_0x2fdb('0x5c'),0x8));var _0x2f86b8=sox[_0x2fdb('0x5d')](_0x26bb2c,_0x440dc0,{'sampleRate':0x1f40,'format':_0x2fdb('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2f86b8['on'](_0x2fdb('0x25'),function(_0x2801ab){fs['unlinkSync'](_0x26bb2c);_0x360bc6[_0x2fdb('0x15')](0x1f4)[_0x2fdb('0x5f')](_0x2801ab);});_0x2f86b8['on'](_0x2fdb('0x60'),function(_0xc58a57){_0x555345[_0x2fdb('0x61')]=isNaN(_0xc58a57[_0x2fdb('0x62')])?null:_0xc58a57['duration']*0x3e8;_0x555345['original_sampleCount']=isNaN(_0xc58a57[_0x2fdb('0x63')])?null:_0xc58a57[_0x2fdb('0x63')];_0x555345[_0x2fdb('0x64')]=isNaN(_0xc58a57[_0x2fdb('0x65')])?null:_0xc58a57[_0x2fdb('0x65')];_0x555345[_0x2fdb('0x66')]=isNaN(_0xc58a57[_0x2fdb('0x67')])?null:_0xc58a57['bitRate'];_0x555345[_0x2fdb('0x68')]=isNaN(_0xc58a57[_0x2fdb('0x69')])?null:_0xc58a57[_0x2fdb('0x69')];});_0x2f86b8['on'](_0x2fdb('0x6a'),function(_0x3e907e){_0x555345[_0x2fdb('0x6b')]=isNaN(_0x3e907e['duration'])?null:_0x3e907e[_0x2fdb('0x62')]*0x3e8;_0x555345[_0x2fdb('0x6c')]=isNaN(_0x3e907e[_0x2fdb('0x63')])?null:_0x3e907e[_0x2fdb('0x63')];_0x555345[_0x2fdb('0x6d')]=isNaN(_0x3e907e[_0x2fdb('0x65')])?null:_0x3e907e[_0x2fdb('0x65')];_0x555345[_0x2fdb('0x6e')]=isNaN(_0x3e907e['bitRate'])?null:_0x3e907e[_0x2fdb('0x67')];_0x555345[_0x2fdb('0x6f')]=isNaN(_0x3e907e[_0x2fdb('0x69')])?null:_0x3e907e[_0x2fdb('0x69')];});_0x2f86b8['on'](_0x2fdb('0x16'),function(){fs['chmodSync'](_0x440dc0,parseInt('0777',0x8));return db[_0x2fdb('0x2a')][_0x2fdb('0x52')](_0x555345)[_0x2fdb('0x21')](function(_0x4c9dfd){var _0x2f1f3a={'role':_0xbf4101[_0x2fdb('0x70')][_0x2fdb('0x71')],'userProfileId':_0xbf4101[_0x2fdb('0x70')][_0x2fdb('0x72')]};if(!_0x2f1f3a)throw new Error(_0x2fdb('0x73'));if(_0x2f1f3a['role']===_0x2fdb('0x74')){var _0x5c96a3=_0x4c9dfd[_0x2fdb('0x23')]({'plain':!![]});return db[_0x2fdb('0x75')]['find']({'where':{'name':'Sounds','userProfileId':_0x2f1f3a['userProfileId']},'raw':!![]})['then'](function(_0x10e385){if(_0x10e385&&_0x10e385['autoAssociation']===0x0){return db[_0x2fdb('0x76')]['create']({'name':_0x5c96a3['name'],'resourceId':_0x5c96a3['id'],'type':_0x10e385[_0x2fdb('0x27')],'sectionId':_0x10e385['id']},{})[_0x2fdb('0x21')](function(){return _0x4c9dfd;});}else{return _0x4c9dfd;}})[_0x2fdb('0x40')](function(_0x600b5a){logger['error'](_0x2fdb('0x77'),_0x600b5a);throw _0x600b5a;});}return _0x4c9dfd;})[_0x2fdb('0x21')](respondWithResult(_0x360bc6,null))['catch'](handleError(_0x360bc6,null));});_0x2f86b8['start']();}catch(_0x30ef65){_0x360bc6[_0x2fdb('0x15')](0x1f4)[_0x2fdb('0x5f')](_0x30ef65);}};exports[_0x2fdb('0x20')]=function(_0x16cdc0,_0x17ddea,_0x368a75){return db[_0x2fdb('0x2a')][_0x2fdb('0x45')]({'where':{'id':_0x16cdc0[_0x2fdb('0x46')]['id']}})[_0x2fdb('0x21')](handleEntityNotFound(_0x17ddea,null))['then'](saveUpdates(_['pick'](_0x16cdc0[_0x2fdb('0x70')],[_0x2fdb('0x27'),_0x2fdb('0x78')]),null))[_0x2fdb('0x21')](respondWithResult(_0x17ddea,null))['catch'](handleError(_0x17ddea,null));};exports[_0x2fdb('0x79')]=function(_0x4ab3b9,_0xf50f05,_0x5f4f9c){return db[_0x2fdb('0x2a')][_0x2fdb('0x45')]({'where':{'id':_0x4ab3b9[_0x2fdb('0x46')]['id']}})[_0x2fdb('0x21')](function(_0x29a16e){if(_0x29a16e){return _0x29a16e['destroy']();}})[_0x2fdb('0x21')](function(_0x414f24){var _0xdfcb99=path[_0x2fdb('0x58')](config[_0x2fdb('0x4f')],_0x2fdb('0x59'),util[_0x2fdb('0x50')](_0x2fdb('0x51'),_0x414f24[_0x2fdb('0x4a')],_0x414f24[_0x2fdb('0x7a')]));var _0x19258a=path[_0x2fdb('0x58')](config[_0x2fdb('0x4f')],_0x2fdb('0x49'),util['format']('%s.%s',_0x414f24[_0x2fdb('0x4a')],_0x414f24[_0x2fdb('0x47')]));fs[_0x2fdb('0x7b')](_0xdfcb99);fs[_0x2fdb('0x7b')](_0x19258a);return _0x414f24;})['then'](function(_0xd1fcfc){if(_0xd1fcfc){return _0xf50f05[_0x2fdb('0x15')](0xcc)[_0x2fdb('0x16')]();}})[_0x2fdb('0x21')](handleEntityNotFound(_0xf50f05,null))[_0x2fdb('0x40')](handleError(_0xf50f05,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 0028b0f..f71d411 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 _0xa082=['../../config/logger','api','bluebird','path','rimraf','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util'];(function(_0x2a6c09,_0x10a508){var _0x1e6fab=function(_0x38daca){while(--_0x38daca){_0x2a6c09['push'](_0x2a6c09['shift']());}};_0x1e6fab(++_0x10a508);}(_0xa082,0x18a));var _0x2a08=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa082[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x2a08('0x0'));var util=require(_0x2a08('0x1'));var logger=require(_0x2a08('0x2'))(_0x2a08('0x3'));var moment=require('moment');var BPromise=require(_0x2a08('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a08('0x5'));var rimraf=require(_0x2a08('0x6'));var config=require('../../config/environment');var attributes=require(_0x2a08('0x7'));module[_0x2a08('0x8')]=function(_0x27d9f0,_0x3b9560){return _0x27d9f0[_0x2a08('0x9')](_0x2a08('0xa'),attributes,{'tableName':_0x2a08('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82bb=['request-promise','../../config/environment','./sound.attributes','exports','Sound','tools_sounds','util','../../config/logger','api','bluebird'];(function(_0x1dbb69,_0x266868){var _0x3a48f9=function(_0xf30b79){while(--_0xf30b79){_0x1dbb69['push'](_0x1dbb69['shift']());}};_0x3a48f9(++_0x266868);}(_0x82bb,0x1e6));var _0xb82b=function(_0xf398b7,_0x49b85e){_0xf398b7=_0xf398b7-0x0;var _0x77d1ab=_0x82bb[_0xf398b7];return _0x77d1ab;};'use strict';var _=require('lodash');var util=require(_0xb82b('0x0'));var logger=require(_0xb82b('0x1'))(_0xb82b('0x2'));var moment=require('moment');var BPromise=require(_0xb82b('0x3'));var rp=require(_0xb82b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb82b('0x5'));var attributes=require(_0xb82b('0x6'));module[_0xb82b('0x7')]=function(_0x2d36de,_0x24c588){return _0x2d36de['define'](_0xb82b('0x8'),attributes,{'tableName':_0xb82b('0x9'),'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 400df7f..ec75bf7 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 _0x93c3=['../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','message','result','ShowSound','Sound','find','options','where','map','include','model','attributes','debug','stringify','catch','util','randomstring','ioredis','rpc'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x93c3,0x114));var _0x393c=function(_0x1e5f54,_0x3e165a){_0x1e5f54=_0x1e5f54-0x0;var _0xe3fb73=_0x93c3[_0x1e5f54];return _0xe3fb73;};'use strict';var _=require('lodash');var util=require(_0x393c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x393c('0x1'));var fs=require('fs');var Redis=require(_0x393c('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x393c('0x3'));var config=require(_0x393c('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x393c('0x5')][_0x393c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2ed830,_0x414e2f,_0x11c73d){return new BPromise(function(_0x28a2df,_0x49db85){return client[_0x393c('0x7')](_0x2ed830,_0x11c73d)[_0x393c('0x8')](function(_0x498748){logger[_0x393c('0x9')](_0x393c('0xa'),_0x414e2f,_0x393c('0xb'));logger['debug'](_0x393c('0xc'),_0x414e2f,'request\x20sent',JSON['stringify'](_0x498748));if(_0x498748[_0x393c('0xd')]){if(_0x498748['error']['code']===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x414e2f,_0x498748[_0x393c('0xd')][_0x393c('0xe')]);return _0x49db85(_0x498748[_0x393c('0xd')]['message']);}logger[_0x393c('0xd')]('Sound,\x20%s,\x20%s',_0x414e2f,_0x498748[_0x393c('0xd')][_0x393c('0xe')]);return _0x28a2df(_0x498748[_0x393c('0xd')][_0x393c('0xe')]);}else{logger[_0x393c('0x9')](_0x393c('0xa'),_0x414e2f,'request\x20sent');_0x28a2df(_0x498748[_0x393c('0xf')][_0x393c('0xe')]);}})['catch'](function(_0x4407ef){logger['error'](_0x393c('0xa'),_0x414e2f,_0x4407ef);_0x49db85(_0x4407ef);});});}exports[_0x393c('0x10')]=function(_0x1c4d4d){var _0xbbcf26=this;return new Promise(function(_0x435e5f,_0x5dbed6){return db[_0x393c('0x11')][_0x393c('0x12')]({'raw':_0x1c4d4d[_0x393c('0x13')]?_0x1c4d4d['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c4d4d[_0x393c('0x13')]?_0x1c4d4d[_0x393c('0x13')][_0x393c('0x14')]||null:null,'attributes':_0x1c4d4d['options']?_0x1c4d4d[_0x393c('0x13')]['attributes']||null:null,'include':_0x1c4d4d[_0x393c('0x13')]?_0x1c4d4d[_0x393c('0x13')]['include']?_[_0x393c('0x15')](_0x1c4d4d[_0x393c('0x13')][_0x393c('0x16')],function(_0x415497){return{'model':db[_0x415497[_0x393c('0x17')]],'as':_0x415497['as'],'attributes':_0x415497[_0x393c('0x18')],'include':_0x415497['include']?_[_0x393c('0x15')](_0x415497[_0x393c('0x16')],function(_0x3548ca){return{'model':db[_0x3548ca[_0x393c('0x17')]],'as':_0x3548ca['as'],'attributes':_0x3548ca[_0x393c('0x18')],'include':_0x3548ca[_0x393c('0x16')]?_['map'](_0x3548ca[_0x393c('0x16')],function(_0x594876){return{'model':db[_0x594876[_0x393c('0x17')]],'as':_0x594876['as'],'attributes':_0x594876[_0x393c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x393c('0x8')](function(_0x11a98c){logger['info']('ShowSound',_0x1c4d4d);logger[_0x393c('0x19')](_0x393c('0x10'),_0x1c4d4d,JSON[_0x393c('0x1a')](_0x11a98c));_0x435e5f(_0x11a98c);})[_0x393c('0x1b')](function(_0x57d977){logger[_0x393c('0xd')]('ShowSound',_0x57d977[_0x393c('0xe')],_0x1c4d4d);_0x5dbed6(_0xbbcf26[_0x393c('0xd')](0x1f4,_0x57d977[_0x393c('0xe')]));});});}; \ No newline at end of file +var _0x780a=['catch','lodash','moment','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','Sound,\x20%s,\x20%s','message','result','ShowSound','options','where','attributes','include','map','model','stringify'];(function(_0x562362,_0x5d54f4){var _0x3a18ce=function(_0x4b96ed){while(--_0x4b96ed){_0x562362['push'](_0x562362['shift']());}};_0x3a18ce(++_0x5d54f4);}(_0x780a,0x10f));var _0xa780=function(_0x2d3535,_0x3e4b18){_0x2d3535=_0x2d3535-0x0;var _0x37a2aa=_0x780a[_0x2d3535];return _0x37a2aa;};'use strict';var _=require(_0xa780('0x0'));var util=require('util');var moment=require(_0xa780('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa780('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa780('0x3'))(_0xa780('0x4'));var config=require('../../config/environment');var jayson=require(_0xa780('0x5'));var client=jayson[_0xa780('0x6')][_0xa780('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3fb29d,_0x3056cb,_0x3bce94){return new BPromise(function(_0x417714,_0x1842de){return client[_0xa780('0x8')](_0x3fb29d,_0x3bce94)[_0xa780('0x9')](function(_0x3683b7){logger[_0xa780('0xa')]('Sound,\x20%s,\x20%s',_0x3056cb,_0xa780('0xb'));logger[_0xa780('0xc')]('Sound,\x20%s,\x20%s,\x20%s',_0x3056cb,_0xa780('0xb'),JSON['stringify'](_0x3683b7));if(_0x3683b7[_0xa780('0xd')]){if(_0x3683b7['error'][_0xa780('0xe')]===0x1f4){logger['error'](_0xa780('0xf'),_0x3056cb,_0x3683b7[_0xa780('0xd')]['message']);return _0x1842de(_0x3683b7[_0xa780('0xd')][_0xa780('0x10')]);}logger[_0xa780('0xd')](_0xa780('0xf'),_0x3056cb,_0x3683b7[_0xa780('0xd')][_0xa780('0x10')]);return _0x417714(_0x3683b7[_0xa780('0xd')][_0xa780('0x10')]);}else{logger['info'](_0xa780('0xf'),_0x3056cb,_0xa780('0xb'));_0x417714(_0x3683b7[_0xa780('0x11')][_0xa780('0x10')]);}})['catch'](function(_0xa273){logger[_0xa780('0xd')](_0xa780('0xf'),_0x3056cb,_0xa273);_0x1842de(_0xa273);});});}exports[_0xa780('0x12')]=function(_0x2de6cf){var _0x1a263e=this;return new Promise(function(_0x173b96,_0x5cfeff){return db['Sound']['find']({'raw':_0x2de6cf[_0xa780('0x13')]?_0x2de6cf[_0xa780('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x2de6cf[_0xa780('0x13')]?_0x2de6cf['options'][_0xa780('0x14')]||null:null,'attributes':_0x2de6cf['options']?_0x2de6cf[_0xa780('0x13')][_0xa780('0x15')]||null:null,'include':_0x2de6cf['options']?_0x2de6cf[_0xa780('0x13')][_0xa780('0x16')]?_[_0xa780('0x17')](_0x2de6cf[_0xa780('0x13')][_0xa780('0x16')],function(_0x76fb6c){return{'model':db[_0x76fb6c[_0xa780('0x18')]],'as':_0x76fb6c['as'],'attributes':_0x76fb6c['attributes'],'include':_0x76fb6c['include']?_[_0xa780('0x17')](_0x76fb6c['include'],function(_0x4b5f58){return{'model':db[_0x4b5f58[_0xa780('0x18')]],'as':_0x4b5f58['as'],'attributes':_0x4b5f58[_0xa780('0x15')],'include':_0x4b5f58[_0xa780('0x16')]?_[_0xa780('0x17')](_0x4b5f58[_0xa780('0x16')],function(_0x5b7b06){return{'model':db[_0x5b7b06['model']],'as':_0x5b7b06['as'],'attributes':_0x5b7b06[_0xa780('0x15')]};}):[]};}):[]};}):[]:[]})[_0xa780('0x9')](function(_0x25f17e){logger[_0xa780('0xa')](_0xa780('0x12'),_0x2de6cf);logger[_0xa780('0xc')]('ShowSound',_0x2de6cf,JSON[_0xa780('0x19')](_0x25f17e));_0x173b96(_0x25f17e);})[_0xa780('0x1a')](function(_0x5cdcbd){logger[_0xa780('0xd')]('ShowSound',_0x5cdcbd['message'],_0x2de6cf);_0x5cfeff(_0x1a263e[_0xa780('0xd')](0x1f4,_0x5cdcbd['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index bd6f227..56dc05e 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(_0x48f2b7,_0x40f214){var _0x54506f=function(_0x193c0a){while(--_0x193c0a){_0x48f2b7['push'](_0x48f2b7['shift']());}};_0x54506f(++_0x40f214);}(_0x2032,0xd9));var _0x2203=function(_0x2dcdf2,_0x3e8c81){_0x2dcdf2=_0x2dcdf2-0x0;var _0x53da97=_0x2032[_0x2dcdf2];return _0x53da97;};'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 _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(_0x4697f2,_0x1de28e){var _0x147729=function(_0x1f4241){while(--_0x1f4241){_0x4697f2['push'](_0x4697f2['shift']());}};_0x147729(++_0x1de28e);}(_0x2032,0xd9));var _0x2203=function(_0x3ae066,_0x3ecb85){_0x3ae066=_0x3ae066-0x0;var _0x2a5a78=_0x2032[_0x3ae066];return _0x2a5a78;};'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 diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index b87e894..607ecc4 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 _0x9aab=['sequelize','STRING','TEXT','ENUM','out'];(function(_0x1a8d04,_0xa353b5){var _0x22b930=function(_0x212136){while(--_0x212136){_0x1a8d04['push'](_0x1a8d04['shift']());}};_0x22b930(++_0xa353b5);}(_0x9aab,0x177));var _0xb9aa=function(_0x1b9cba,_0x24af7d){_0x1b9cba=_0x1b9cba-0x0;var _0x3e68a0=_0x9aab[_0x1b9cba];return _0x3e68a0;};'use strict';var Sequelize=require(_0xb9aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb9aa('0x1')]},'body':{'type':Sequelize[_0xb9aa('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xb9aa('0x3')]('in','out'),'defaultValue':_0xb9aa('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xb9aa('0x1')]},'providerResponse':{'type':Sequelize[_0xb9aa('0x2')]}}; \ No newline at end of file +var _0x811d=['TEXT','ENUM','out','exports','STRING'];(function(_0x3b2bc5,_0x531464){var _0x53a070=function(_0x4f864b){while(--_0x4f864b){_0x3b2bc5['push'](_0x3b2bc5['shift']());}};_0x53a070(++_0x531464);}(_0x811d,0xee));var _0xd811=function(_0x31a9e9,_0x2d1543){_0x31a9e9=_0x31a9e9-0x0;var _0x339cf2=_0x811d[_0x31a9e9];return _0x339cf2;};'use strict';var Sequelize=require('sequelize');module[_0xd811('0x0')]={'uniqueid':{'type':Sequelize[_0xd811('0x1')]},'body':{'type':Sequelize[_0xd811('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xd811('0x3')]('in',_0xd811('0x4')),'defaultValue':_0xd811('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xd811('0x1')]},'providerResponse':{'type':Sequelize[_0xd811('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 83caa72..283a34c 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 _0xe3cc=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','length','hasOwnProperty','nolimit','sort','pick','filter','VIRTUAL','merge','where','SquareMessage','then','includeAll','include','rows','catch','show','fields','options','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5a3f92,_0x23e7df){var _0x467063=function(_0x387be4){while(--_0x387be4){_0x5a3f92['push'](_0x5a3f92['shift']());}};_0x467063(++_0x23e7df);}(_0xe3cc,0x122));var _0xce3c=function(_0x4ace43,_0x282aa5){_0x4ace43=_0x4ace43-0x0;var _0x1f56e0=_0xe3cc[_0x4ace43];return _0x1f56e0;};'use strict';var emlformat=require(_0xce3c('0x0'));var rimraf=require(_0xce3c('0x1'));var zipdir=require(_0xce3c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce3c('0x3'));var moment=require(_0xce3c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xce3c('0x5'));var util=require(_0xce3c('0x6'));var path=require(_0xce3c('0x7'));var sox=require(_0xce3c('0x8'));var csv=require(_0xce3c('0x9'));var ejs=require(_0xce3c('0xa'));var fs=require('fs');var fs_extra=require(_0xce3c('0xb'));var _=require(_0xce3c('0xc'));var squel=require('squel');var crypto=require(_0xce3c('0xd'));var jsforce=require(_0xce3c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xce3c('0x9'));var querystring=require(_0xce3c('0xf'));var Papa=require(_0xce3c('0x10'));var Redis=require('ioredis');var authService=require(_0xce3c('0x11'));var qs=require(_0xce3c('0x12'));var as=require(_0xce3c('0x13'));var hardwareService=require(_0xce3c('0x14'));var logger=require(_0xce3c('0x15'))(_0xce3c('0x16'));var utils=require(_0xce3c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xce3c('0x18'));var db=require(_0xce3c('0x19'))['db'];function respondWithStatusCode(_0xf2acbb,_0x54ffd0){_0x54ffd0=_0x54ffd0||0xcc;return function(_0x53f8b1){if(_0x53f8b1){return _0xf2acbb[_0xce3c('0x1a')](_0x54ffd0);}return _0xf2acbb[_0xce3c('0x1b')](_0x54ffd0)[_0xce3c('0x1c')]();};}function respondWithResult(_0x77cfc1,_0xa8f1e3){_0xa8f1e3=_0xa8f1e3||0xc8;return function(_0xe0b74e){if(_0xe0b74e){return _0x77cfc1[_0xce3c('0x1b')](_0xa8f1e3)[_0xce3c('0x1d')](_0xe0b74e);}};}function respondWithFilteredResult(_0x5f2cbc,_0x4872ca){return function(_0x922b9e){if(_0x922b9e){var _0x75c781=typeof _0x4872ca[_0xce3c('0x1e')]===_0xce3c('0x1f')&&typeof _0x4872ca[_0xce3c('0x20')]===_0xce3c('0x1f');var _0x1c8b5b=_0x922b9e[_0xce3c('0x21')];var _0x501347=_0x75c781?0x0:_0x4872ca[_0xce3c('0x1e')];var _0x1422a3=_0x75c781?_0x922b9e['count']:_0x4872ca['offset']+_0x4872ca[_0xce3c('0x20')];var _0x415c04;if(_0x1422a3>=_0x1c8b5b){_0x1422a3=_0x1c8b5b;_0x415c04=0xc8;}else{_0x415c04=0xce;}_0x5f2cbc[_0xce3c('0x1b')](_0x415c04);return _0x5f2cbc[_0xce3c('0x22')](_0xce3c('0x23'),_0x501347+'-'+_0x1422a3+'/'+_0x1c8b5b)[_0xce3c('0x1d')](_0x922b9e);}return null;};}function patchUpdates(_0x16493e){return function(_0x1ab31e){try{jsonpatch[_0xce3c('0x24')](_0x1ab31e,_0x16493e,!![]);}catch(_0x50bf35){return BPromise[_0xce3c('0x25')](_0x50bf35);}return _0x1ab31e[_0xce3c('0x26')]();};}function saveUpdates(_0x671df2,_0x5de340){return function(_0x371445){if(_0x371445){return _0x371445[_0xce3c('0x27')](_0x671df2)['then'](function(_0x4fa0e3){return _0x4fa0e3;});}return null;};}function removeEntity(_0x51856b,_0x3ccb78){return function(_0x2d6051){if(_0x2d6051){return _0x2d6051[_0xce3c('0x28')]()['then'](function(){_0x51856b[_0xce3c('0x1b')](0xcc)[_0xce3c('0x1c')]();});}};}function handleEntityNotFound(_0x323c88,_0x5ae16f){return function(_0x2fca5d){if(!_0x2fca5d){_0x323c88[_0xce3c('0x1a')](0x194);}return _0x2fca5d;};}function handleError(_0x584067,_0x40bf24){_0x40bf24=_0x40bf24||0x1f4;return function(_0x56294f){logger[_0xce3c('0x29')](_0x56294f[_0xce3c('0x2a')]);if(_0x56294f[_0xce3c('0x2b')]){delete _0x56294f[_0xce3c('0x2b')];}_0x584067[_0xce3c('0x1b')](_0x40bf24)[_0xce3c('0x2c')](_0x56294f);};}exports[_0xce3c('0x2d')]=function(_0x174bb1,_0xfdc4ea){var _0x17dfd8={},_0x593033={},_0x36d803={'count':0x0,'rows':[]};var _0x3f1ba6=_[_0xce3c('0x2e')](db['SquareMessage'][_0xce3c('0x2f')],function(_0x1c9e3a){return{'name':_0x1c9e3a[_0xce3c('0x30')],'type':_0x1c9e3a[_0xce3c('0x31')]['key']};});_0x593033[_0xce3c('0x32')]=_[_0xce3c('0x2e')](_0x3f1ba6,_0xce3c('0x2b'));_0x593033['query']=_[_0xce3c('0x33')](_0x174bb1['query']);_0x593033[_0xce3c('0x34')]=_['intersection'](_0x593033[_0xce3c('0x32')],_0x593033[_0xce3c('0x35')]);_0x17dfd8[_0xce3c('0x36')]=_[_0xce3c('0x37')](_0x593033[_0xce3c('0x32')],qs['fields'](_0x174bb1['query']['fields']));_0x17dfd8['attributes']=_0x17dfd8[_0xce3c('0x36')][_0xce3c('0x38')]?_0x17dfd8['attributes']:_0x593033[_0xce3c('0x32')];if(!_0x174bb1[_0xce3c('0x35')][_0xce3c('0x39')](_0xce3c('0x3a'))){_0x17dfd8[_0xce3c('0x20')]=qs['limit'](_0x174bb1[_0xce3c('0x35')]['limit']);_0x17dfd8[_0xce3c('0x1e')]=qs[_0xce3c('0x1e')](_0x174bb1[_0xce3c('0x35')]['offset']);}_0x17dfd8['order']=qs[_0xce3c('0x3b')](_0x174bb1[_0xce3c('0x35')]['sort']);_0x17dfd8['where']=qs['filters'](_[_0xce3c('0x3c')](_0x174bb1[_0xce3c('0x35')],_0x593033[_0xce3c('0x34')]),_0x3f1ba6);if(_0x174bb1[_0xce3c('0x35')][_0xce3c('0x3d')]){_0x17dfd8['where']=_['merge'](_0x17dfd8['where'],{'$or':_[_0xce3c('0x2e')](_0x3f1ba6,function(_0x29287e){if(_0x29287e[_0xce3c('0x31')]!==_0xce3c('0x3e')){var _0x113ae2={};_0x113ae2[_0x29287e[_0xce3c('0x2b')]]={'$like':'%'+_0x174bb1[_0xce3c('0x35')]['filter']+'%'};return _0x113ae2;}})});}_0x17dfd8=_[_0xce3c('0x3f')]({},_0x17dfd8,_0x174bb1['options']);var _0x4bbf83={'where':_0x17dfd8[_0xce3c('0x40')]};return db[_0xce3c('0x41')][_0xce3c('0x21')](_0x4bbf83)[_0xce3c('0x42')](function(_0x3d30c2){_0x36d803[_0xce3c('0x21')]=_0x3d30c2;if(_0x174bb1['query'][_0xce3c('0x43')]){_0x17dfd8[_0xce3c('0x44')]=[{'all':!![]}];}return db[_0xce3c('0x41')]['findAll'](_0x17dfd8);})[_0xce3c('0x42')](function(_0x50d5b1){_0x36d803[_0xce3c('0x45')]=_0x50d5b1;return _0x36d803;})[_0xce3c('0x42')](respondWithFilteredResult(_0xfdc4ea,_0x17dfd8))[_0xce3c('0x46')](handleError(_0xfdc4ea,null));};exports[_0xce3c('0x47')]=function(_0x47078f,_0x4b654a){var _0x3bd3b0={'raw':!![],'where':{'id':_0x47078f['params']['id']}},_0x3bc770={};_0x3bc770[_0xce3c('0x32')]=_['keys'](db[_0xce3c('0x41')][_0xce3c('0x2f')]);_0x3bc770['query']=_['keys'](_0x47078f[_0xce3c('0x35')]);_0x3bc770['filters']=_[_0xce3c('0x37')](_0x3bc770['model'],_0x3bc770['query']);_0x3bd3b0[_0xce3c('0x36')]=_['intersection'](_0x3bc770['model'],qs[_0xce3c('0x48')](_0x47078f[_0xce3c('0x35')]['fields']));_0x3bd3b0[_0xce3c('0x36')]=_0x3bd3b0['attributes'][_0xce3c('0x38')]?_0x3bd3b0['attributes']:_0x3bc770[_0xce3c('0x32')];if(_0x47078f['query'][_0xce3c('0x43')]){_0x3bd3b0[_0xce3c('0x44')]=[{'all':!![]}];}_0x3bd3b0=_[_0xce3c('0x3f')]({},_0x3bd3b0,_0x47078f[_0xce3c('0x49')]);return db['SquareMessage'][_0xce3c('0x4a')](_0x3bd3b0)['then'](handleEntityNotFound(_0x4b654a,null))['then'](respondWithResult(_0x4b654a,null))[_0xce3c('0x46')](handleError(_0x4b654a,null));};exports[_0xce3c('0x4b')]=function(_0x39ef8d,_0x3f1648){return db[_0xce3c('0x41')][_0xce3c('0x4b')](_0x39ef8d[_0xce3c('0x4c')],{})[_0xce3c('0x42')](respondWithResult(_0x3f1648,0xc9))[_0xce3c('0x46')](handleError(_0x3f1648,null));};exports[_0xce3c('0x27')]=function(_0x36251e,_0x133a54){if(_0x36251e[_0xce3c('0x4c')]['id']){delete _0x36251e[_0xce3c('0x4c')]['id'];}return db[_0xce3c('0x41')][_0xce3c('0x4a')]({'where':{'id':_0x36251e[_0xce3c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x133a54,null))['then'](saveUpdates(_0x36251e[_0xce3c('0x4c')],null))[_0xce3c('0x42')](respondWithResult(_0x133a54,null))['catch'](handleError(_0x133a54,null));};exports[_0xce3c('0x28')]=function(_0x2e9aa5,_0x54f171){return db[_0xce3c('0x41')][_0xce3c('0x4a')]({'where':{'id':_0x2e9aa5[_0xce3c('0x4d')]['id']}})[_0xce3c('0x42')](handleEntityNotFound(_0x54f171,null))[_0xce3c('0x42')](removeEntity(_0x54f171,null))[_0xce3c('0x46')](handleError(_0x54f171,null));}; \ No newline at end of file +var _0xe02a=['findAll','rows','catch','show','options','find','create','body','params','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','SquareMessage','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe02a,0xa3));var _0xae02=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe02a[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0xae02('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xae02('0x1'));var BPromise=require(_0xae02('0x2'));var Mustache=require(_0xae02('0x3'));var util=require(_0xae02('0x4'));var path=require(_0xae02('0x5'));var sox=require(_0xae02('0x6'));var csv=require(_0xae02('0x7'));var ejs=require(_0xae02('0x8'));var fs=require('fs');var fs_extra=require(_0xae02('0x9'));var _=require(_0xae02('0xa'));var squel=require(_0xae02('0xb'));var crypto=require(_0xae02('0xc'));var jsforce=require(_0xae02('0xd'));var deskjs=require(_0xae02('0xe'));var toCsv=require(_0xae02('0x7'));var querystring=require(_0xae02('0xf'));var Papa=require(_0xae02('0x10'));var Redis=require(_0xae02('0x11'));var authService=require(_0xae02('0x12'));var qs=require(_0xae02('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae02('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xae02('0x15'));var config=require(_0xae02('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xae02('0x17'))['db'];function respondWithStatusCode(_0x94990c,_0xbb3cea){_0xbb3cea=_0xbb3cea||0xcc;return function(_0x5b6618){if(_0x5b6618){return _0x94990c[_0xae02('0x18')](_0xbb3cea);}return _0x94990c['status'](_0xbb3cea)[_0xae02('0x19')]();};}function respondWithResult(_0x277588,_0xecd25b){_0xecd25b=_0xecd25b||0xc8;return function(_0x526928){if(_0x526928){return _0x277588[_0xae02('0x1a')](_0xecd25b)['json'](_0x526928);}};}function respondWithFilteredResult(_0x597d6e,_0xf1ef23){return function(_0x29d574){if(_0x29d574){var _0x110ccb=typeof _0xf1ef23[_0xae02('0x1b')]===_0xae02('0x1c')&&typeof _0xf1ef23[_0xae02('0x1d')]===_0xae02('0x1c');var _0x1bfa33=_0x29d574['count'];var _0x560114=_0x110ccb?0x0:_0xf1ef23[_0xae02('0x1b')];var _0x4369c9=_0x110ccb?_0x29d574[_0xae02('0x1e')]:_0xf1ef23['offset']+_0xf1ef23['limit'];var _0x57753b;if(_0x4369c9>=_0x1bfa33){_0x4369c9=_0x1bfa33;_0x57753b=0xc8;}else{_0x57753b=0xce;}_0x597d6e['status'](_0x57753b);return _0x597d6e[_0xae02('0x1f')](_0xae02('0x20'),_0x560114+'-'+_0x4369c9+'/'+_0x1bfa33)[_0xae02('0x21')](_0x29d574);}return null;};}function patchUpdates(_0xe22675){return function(_0x1f594a){try{jsonpatch[_0xae02('0x22')](_0x1f594a,_0xe22675,!![]);}catch(_0x177b83){return BPromise[_0xae02('0x23')](_0x177b83);}return _0x1f594a[_0xae02('0x24')]();};}function saveUpdates(_0x2d905e,_0x1fbff5){return function(_0x79917c){if(_0x79917c){return _0x79917c[_0xae02('0x25')](_0x2d905e)[_0xae02('0x26')](function(_0x5a738d){return _0x5a738d;});}return null;};}function removeEntity(_0x557c54,_0x10f4b9){return function(_0x13e2a){if(_0x13e2a){return _0x13e2a[_0xae02('0x27')]()[_0xae02('0x26')](function(){_0x557c54[_0xae02('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x261851,_0x319456){return function(_0x6bcee8){if(!_0x6bcee8){_0x261851[_0xae02('0x18')](0x194);}return _0x6bcee8;};}function handleError(_0x23a32b,_0x374576){_0x374576=_0x374576||0x1f4;return function(_0x2d6fe6){logger[_0xae02('0x28')](_0x2d6fe6[_0xae02('0x29')]);if(_0x2d6fe6[_0xae02('0x2a')]){delete _0x2d6fe6[_0xae02('0x2a')];}_0x23a32b[_0xae02('0x1a')](_0x374576)['send'](_0x2d6fe6);};}exports[_0xae02('0x2b')]=function(_0xe8b9a4,_0x111af2){var _0x50c35e={},_0x536694={},_0x2b3b08={'count':0x0,'rows':[]};var _0x10a8ad=_[_0xae02('0x2c')](db[_0xae02('0x2d')][_0xae02('0x2e')],function(_0x3dd29b){return{'name':_0x3dd29b['fieldName'],'type':_0x3dd29b[_0xae02('0x2f')][_0xae02('0x30')]};});_0x536694['model']=_[_0xae02('0x2c')](_0x10a8ad,_0xae02('0x2a'));_0x536694[_0xae02('0x31')]=_[_0xae02('0x32')](_0xe8b9a4[_0xae02('0x31')]);_0x536694['filters']=_[_0xae02('0x33')](_0x536694[_0xae02('0x34')],_0x536694[_0xae02('0x31')]);_0x50c35e[_0xae02('0x35')]=_[_0xae02('0x33')](_0x536694[_0xae02('0x34')],qs[_0xae02('0x36')](_0xe8b9a4[_0xae02('0x31')][_0xae02('0x36')]));_0x50c35e[_0xae02('0x35')]=_0x50c35e['attributes'][_0xae02('0x37')]?_0x50c35e['attributes']:_0x536694['model'];if(!_0xe8b9a4[_0xae02('0x31')][_0xae02('0x38')](_0xae02('0x39'))){_0x50c35e[_0xae02('0x1d')]=qs[_0xae02('0x1d')](_0xe8b9a4[_0xae02('0x31')]['limit']);_0x50c35e[_0xae02('0x1b')]=qs[_0xae02('0x1b')](_0xe8b9a4[_0xae02('0x31')][_0xae02('0x1b')]);}_0x50c35e[_0xae02('0x3a')]=qs[_0xae02('0x3b')](_0xe8b9a4['query'][_0xae02('0x3b')]);_0x50c35e[_0xae02('0x3c')]=qs[_0xae02('0x3d')](_[_0xae02('0x3e')](_0xe8b9a4[_0xae02('0x31')],_0x536694[_0xae02('0x3d')]),_0x10a8ad);if(_0xe8b9a4[_0xae02('0x31')][_0xae02('0x3f')]){_0x50c35e[_0xae02('0x3c')]=_['merge'](_0x50c35e[_0xae02('0x3c')],{'$or':_[_0xae02('0x2c')](_0x10a8ad,function(_0x2141d0){if(_0x2141d0[_0xae02('0x2f')]!==_0xae02('0x40')){var _0x440972={};_0x440972[_0x2141d0['name']]={'$like':'%'+_0xe8b9a4[_0xae02('0x31')][_0xae02('0x3f')]+'%'};return _0x440972;}})});}_0x50c35e=_[_0xae02('0x41')]({},_0x50c35e,_0xe8b9a4['options']);var _0x3685f1={'where':_0x50c35e[_0xae02('0x3c')]};return db['SquareMessage'][_0xae02('0x1e')](_0x3685f1)[_0xae02('0x26')](function(_0x273eba){_0x2b3b08['count']=_0x273eba;if(_0xe8b9a4[_0xae02('0x31')][_0xae02('0x42')]){_0x50c35e[_0xae02('0x43')]=[{'all':!![]}];}return db[_0xae02('0x2d')][_0xae02('0x44')](_0x50c35e);})['then'](function(_0x5db078){_0x2b3b08[_0xae02('0x45')]=_0x5db078;return _0x2b3b08;})[_0xae02('0x26')](respondWithFilteredResult(_0x111af2,_0x50c35e))[_0xae02('0x46')](handleError(_0x111af2,null));};exports[_0xae02('0x47')]=function(_0x40ed68,_0x207895){var _0x59448a={'raw':!![],'where':{'id':_0x40ed68['params']['id']}},_0x3ddeca={};_0x3ddeca[_0xae02('0x34')]=_[_0xae02('0x32')](db[_0xae02('0x2d')][_0xae02('0x2e')]);_0x3ddeca[_0xae02('0x31')]=_[_0xae02('0x32')](_0x40ed68[_0xae02('0x31')]);_0x3ddeca[_0xae02('0x3d')]=_[_0xae02('0x33')](_0x3ddeca[_0xae02('0x34')],_0x3ddeca['query']);_0x59448a['attributes']=_[_0xae02('0x33')](_0x3ddeca[_0xae02('0x34')],qs['fields'](_0x40ed68[_0xae02('0x31')][_0xae02('0x36')]));_0x59448a[_0xae02('0x35')]=_0x59448a[_0xae02('0x35')][_0xae02('0x37')]?_0x59448a[_0xae02('0x35')]:_0x3ddeca[_0xae02('0x34')];if(_0x40ed68[_0xae02('0x31')][_0xae02('0x42')]){_0x59448a[_0xae02('0x43')]=[{'all':!![]}];}_0x59448a=_[_0xae02('0x41')]({},_0x59448a,_0x40ed68[_0xae02('0x48')]);return db['SquareMessage'][_0xae02('0x49')](_0x59448a)[_0xae02('0x26')](handleEntityNotFound(_0x207895,null))['then'](respondWithResult(_0x207895,null))[_0xae02('0x46')](handleError(_0x207895,null));};exports[_0xae02('0x4a')]=function(_0x74ecc7,_0x3a6a88){return db[_0xae02('0x2d')][_0xae02('0x4a')](_0x74ecc7['body'],{})[_0xae02('0x26')](respondWithResult(_0x3a6a88,0xc9))[_0xae02('0x46')](handleError(_0x3a6a88,null));};exports[_0xae02('0x25')]=function(_0x13fbc2,_0x4aab2b){if(_0x13fbc2[_0xae02('0x4b')]['id']){delete _0x13fbc2['body']['id'];}return db[_0xae02('0x2d')][_0xae02('0x49')]({'where':{'id':_0x13fbc2[_0xae02('0x4c')]['id']}})[_0xae02('0x26')](handleEntityNotFound(_0x4aab2b,null))[_0xae02('0x26')](saveUpdates(_0x13fbc2['body'],null))[_0xae02('0x26')](respondWithResult(_0x4aab2b,null))[_0xae02('0x46')](handleError(_0x4aab2b,null));};exports[_0xae02('0x27')]=function(_0x219cf1,_0x32bd01){return db['SquareMessage'][_0xae02('0x49')]({'where':{'id':_0x219cf1[_0xae02('0x4c')]['id']}})['then'](handleEntityNotFound(_0x32bd01,null))[_0xae02('0x26')](removeEntity(_0x32bd01,null))[_0xae02('0x46')](handleError(_0x32bd01,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 9854125..bf00779 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 _0x2e28=['SquareMessage','square_messages','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x4da29a,_0x8f7125){var _0x58a2cc=function(_0x1c16c3){while(--_0x1c16c3){_0x4da29a['push'](_0x4da29a['shift']());}};_0x58a2cc(++_0x8f7125);}(_0x2e28,0xe9));var _0x82e2=function(_0x5a31b6,_0x58f421){_0x5a31b6=_0x5a31b6-0x0;var _0x1c3523=_0x2e28[_0x5a31b6];return _0x1c3523;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x82e2('0x0'))(_0x82e2('0x1'));var moment=require(_0x82e2('0x2'));var BPromise=require(_0x82e2('0x3'));var rp=require(_0x82e2('0x4'));var fs=require('fs');var path=require(_0x82e2('0x5'));var rimraf=require(_0x82e2('0x6'));var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0x82e2('0x7')]=function(_0x452166,_0x417c73){return _0x452166[_0x82e2('0x8')](_0x82e2('0x9'),attributes,{'tableName':_0x82e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bf1=['../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x162b73,_0x128905){var _0x22e1b6=function(_0x3f35ad){while(--_0x3f35ad){_0x162b73['push'](_0x162b73['shift']());}};_0x22e1b6(++_0x128905);}(_0x8bf1,0xef));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x18bf('0x0'));var util=require(_0x18bf('0x1'));var logger=require('../../config/logger')(_0x18bf('0x2'));var moment=require(_0x18bf('0x3'));var BPromise=require(_0x18bf('0x4'));var rp=require(_0x18bf('0x5'));var fs=require('fs');var path=require(_0x18bf('0x6'));var rimraf=require(_0x18bf('0x7'));var config=require(_0x18bf('0x8'));var attributes=require(_0x18bf('0x9'));module['exports']=function(_0x53d472,_0x34c7c3){return _0x53d472[_0x18bf('0xa')](_0x18bf('0xb'),attributes,{'tableName':_0x18bf('0xc'),'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 1c55b72..158267a 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 _0x8ff0=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSquareMessage','create','body','options','debug','lodash','util','moment'];(function(_0x8c7475,_0x3d805f){var _0x175b4c=function(_0x5180b9){while(--_0x5180b9){_0x8c7475['push'](_0x8c7475['shift']());}};_0x175b4c(++_0x3d805f);}(_0x8ff0,0x193));var _0x08ff=function(_0x4ac48d,_0x171a68){_0x4ac48d=_0x4ac48d-0x0;var _0x7537af=_0x8ff0[_0x4ac48d];return _0x7537af;};'use strict';var _=require(_0x08ff('0x0'));var util=require(_0x08ff('0x1'));var moment=require(_0x08ff('0x2'));var BPromise=require(_0x08ff('0x3'));var rs=require(_0x08ff('0x4'));var fs=require('fs');var Redis=require(_0x08ff('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x08ff('0x6'));var logger=require(_0x08ff('0x7'))(_0x08ff('0x8'));var config=require(_0x08ff('0x9'));var jayson=require(_0x08ff('0xa'));var client=jayson[_0x08ff('0xb')][_0x08ff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x25f86e,_0x6b4b98,_0x4b070e){return new BPromise(function(_0x30269e,_0x2649ec){return client[_0x08ff('0xd')](_0x25f86e,_0x4b070e)[_0x08ff('0xe')](function(_0x1270cd){logger[_0x08ff('0xf')](_0x08ff('0x10'),_0x6b4b98,'request\x20sent');logger['debug'](_0x08ff('0x11'),_0x6b4b98,_0x08ff('0x12'),JSON[_0x08ff('0x13')](_0x1270cd));if(_0x1270cd[_0x08ff('0x14')]){if(_0x1270cd[_0x08ff('0x14')][_0x08ff('0x15')]===0x1f4){logger[_0x08ff('0x14')](_0x08ff('0x10'),_0x6b4b98,_0x1270cd['error'][_0x08ff('0x16')]);return _0x2649ec(_0x1270cd[_0x08ff('0x14')][_0x08ff('0x16')]);}logger[_0x08ff('0x14')](_0x08ff('0x10'),_0x6b4b98,_0x1270cd['error'][_0x08ff('0x16')]);return _0x30269e(_0x1270cd['error'][_0x08ff('0x16')]);}else{logger[_0x08ff('0xf')](_0x08ff('0x10'),_0x6b4b98,_0x08ff('0x12'));_0x30269e(_0x1270cd[_0x08ff('0x17')]['message']);}})['catch'](function(_0x1f7320){logger[_0x08ff('0x14')]('SquareMessage,\x20%s,\x20%s',_0x6b4b98,_0x1f7320);_0x2649ec(_0x1f7320);});});}exports[_0x08ff('0x18')]=function(_0x5bd51e){var _0x2dcab0=this;return new Promise(function(_0x1f99f5,_0x34e4b5){return db['SquareMessage'][_0x08ff('0x19')](_0x5bd51e[_0x08ff('0x1a')],{'raw':_0x5bd51e[_0x08ff('0x1b')]?_0x5bd51e[_0x08ff('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x08ff('0xe')](function(_0x9da1b8){logger[_0x08ff('0xf')](_0x08ff('0x18'),_0x5bd51e);logger[_0x08ff('0x1c')](_0x08ff('0x18'),_0x5bd51e,JSON[_0x08ff('0x13')](_0x9da1b8));_0x1f99f5(_0x9da1b8);})['catch'](function(_0x2040c4){logger[_0x08ff('0x14')](_0x08ff('0x18'),_0x2040c4[_0x08ff('0x16')],_0x5bd51e);_0x34e4b5(_0x2dcab0['error'](0x1f4,_0x2040c4[_0x08ff('0x16')]));});});}; \ No newline at end of file +var _0xc985=['options','raw','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareMessage','SquareMessage','create','body'];(function(_0x33faed,_0x2b565f){var _0x435913=function(_0x112dc7){while(--_0x112dc7){_0x33faed['push'](_0x33faed['shift']());}};_0x435913(++_0x2b565f);}(_0xc985,0x13b));var _0x5c98=function(_0x438bfb,_0x2eef40){_0x438bfb=_0x438bfb-0x0;var _0x42fcd8=_0xc985[_0x438bfb];return _0x42fcd8;};'use strict';var _=require(_0x5c98('0x0'));var util=require('util');var moment=require(_0x5c98('0x1'));var BPromise=require(_0x5c98('0x2'));var rs=require(_0x5c98('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c98('0x4'))['db'];var utils=require(_0x5c98('0x5'));var logger=require(_0x5c98('0x6'))(_0x5c98('0x7'));var config=require(_0x5c98('0x8'));var jayson=require(_0x5c98('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3190d5,_0x464591,_0x232cbf){return new BPromise(function(_0x59ec25,_0x54575a){return client['request'](_0x3190d5,_0x232cbf)['then'](function(_0x3a9a71){logger[_0x5c98('0xa')](_0x5c98('0xb'),_0x464591,_0x5c98('0xc'));logger[_0x5c98('0xd')](_0x5c98('0xe'),_0x464591,_0x5c98('0xc'),JSON['stringify'](_0x3a9a71));if(_0x3a9a71[_0x5c98('0xf')]){if(_0x3a9a71[_0x5c98('0xf')][_0x5c98('0x10')]===0x1f4){logger[_0x5c98('0xf')](_0x5c98('0xb'),_0x464591,_0x3a9a71['error'][_0x5c98('0x11')]);return _0x54575a(_0x3a9a71[_0x5c98('0xf')][_0x5c98('0x11')]);}logger[_0x5c98('0xf')]('SquareMessage,\x20%s,\x20%s',_0x464591,_0x3a9a71[_0x5c98('0xf')][_0x5c98('0x11')]);return _0x59ec25(_0x3a9a71[_0x5c98('0xf')][_0x5c98('0x11')]);}else{logger['info'](_0x5c98('0xb'),_0x464591,'request\x20sent');_0x59ec25(_0x3a9a71['result'][_0x5c98('0x11')]);}})[_0x5c98('0x12')](function(_0x19fed4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x464591,_0x19fed4);_0x54575a(_0x19fed4);});});}exports[_0x5c98('0x13')]=function(_0x2c8963){var _0x538372=this;return new Promise(function(_0xec5e7c,_0xdc05d7){return db[_0x5c98('0x14')][_0x5c98('0x15')](_0x2c8963[_0x5c98('0x16')],{'raw':_0x2c8963[_0x5c98('0x17')]?_0x2c8963['options'][_0x5c98('0x18')]===undefined?!![]:![]:!![]})[_0x5c98('0x19')](function(_0x35ae5e){logger[_0x5c98('0xa')](_0x5c98('0x13'),_0x2c8963);logger[_0x5c98('0xd')](_0x5c98('0x13'),_0x2c8963,JSON['stringify'](_0x35ae5e));_0xec5e7c(_0x35ae5e);})[_0x5c98('0x12')](function(_0x586cfa){logger[_0x5c98('0xf')](_0x5c98('0x13'),_0x586cfa[_0x5c98('0x11')],_0x2c8963);_0xdc05d7(_0x538372[_0x5c98('0xf')](0x1f4,_0x586cfa[_0x5c98('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index d10cde5..f81fbdb 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 _0x66d5=['get','isAuthenticated','index','show','/:id/test','15s','test','post','create','/:id','update','delete','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x66d5,0xad));var _0x566d=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x66d5[_0x235482];return _0x5f5bea;};'use strict';var multer=require(_0x566d('0x0'));var util=require(_0x566d('0x1'));var path=require(_0x566d('0x2'));var timeout=require(_0x566d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x566d('0x4'));var config=require(_0x566d('0x5'));var controller=require(_0x566d('0x6'));router[_0x566d('0x7')]('/',auth[_0x566d('0x8')](),controller[_0x566d('0x9')]);router[_0x566d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x566d('0xa')]);router[_0x566d('0x7')](_0x566d('0xb'),auth[_0x566d('0x8')](),timeout(_0x566d('0xc')),controller[_0x566d('0xd')]);router[_0x566d('0xe')]('/',auth['isAuthenticated'](),controller[_0x566d('0xf')]);router['put'](_0x566d('0x10'),auth[_0x566d('0x8')](),controller[_0x566d('0x11')]);router[_0x566d('0x12')](_0x566d('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x566d('0x13')]=router; \ No newline at end of file +var _0xbd31=['../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x521eac,_0x213337){var _0x38e885=function(_0x3792de){while(--_0x3792de){_0x521eac['push'](_0x521eac['shift']());}};_0x38e885(++_0x213337);}(_0xbd31,0x77));var _0x1bd3=function(_0x57fc5c,_0x1981a0){_0x57fc5c=_0x57fc5c-0x0;var _0xc96d84=_0xbd31[_0x57fc5c];return _0xc96d84;};'use strict';var multer=require(_0x1bd3('0x0'));var util=require(_0x1bd3('0x1'));var path=require(_0x1bd3('0x2'));var timeout=require(_0x1bd3('0x3'));var express=require(_0x1bd3('0x4'));var router=express[_0x1bd3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1bd3('0x6'));var interaction=require(_0x1bd3('0x7'));var config=require(_0x1bd3('0x8'));var controller=require(_0x1bd3('0x9'));router[_0x1bd3('0xa')]('/',auth[_0x1bd3('0xb')](),controller[_0x1bd3('0xc')]);router['get'](_0x1bd3('0xd'),auth[_0x1bd3('0xb')](),controller[_0x1bd3('0xe')]);router[_0x1bd3('0xa')](_0x1bd3('0xf'),auth[_0x1bd3('0xb')](),timeout(_0x1bd3('0x10')),controller[_0x1bd3('0x11')]);router[_0x1bd3('0x12')]('/',auth['isAuthenticated'](),controller[_0x1bd3('0x13')]);router['put'](_0x1bd3('0xd'),auth[_0x1bd3('0xb')](),controller['update']);router['delete'](_0x1bd3('0xd'),auth[_0x1bd3('0xb')](),controller['destroy']);module[_0x1bd3('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index dfadd8e..9cf4e59 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 _0xe692=['STRING','sequelize','exports','name'];(function(_0x5218e9,_0x23292a){var _0x3959f3=function(_0xbb7c85){while(--_0xbb7c85){_0x5218e9['push'](_0x5218e9['shift']());}};_0x3959f3(++_0x23292a);}(_0xe692,0x11d));var _0x2e69=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xe692[_0x49d41c];return _0xb64c5f;};'use strict';var Sequelize=require(_0x2e69('0x0'));module[_0x2e69('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2e69('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2e69('0x3')]}}; \ No newline at end of file +var _0xbd8c=['sequelize','STRING','name'];(function(_0x5ecf42,_0x583f26){var _0x4beec8=function(_0x1f89a5){while(--_0x1f89a5){_0x5ecf42['push'](_0x5ecf42['shift']());}};_0x4beec8(++_0x583f26);}(_0xbd8c,0x198));var _0xcbd8=function(_0x7e1a8a,_0x3f1fb6){_0x7e1a8a=_0x7e1a8a-0x0;var _0xbc2374=_0xbd8c[_0x7e1a8a];return _0xbc2374;};'use strict';var Sequelize=require(_0xcbd8('0x0'));module['exports']={'name':{'type':Sequelize[_0xcbd8('0x1')],'unique':_0xcbd8('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xcbd8('0x1')]},'description':{'type':Sequelize[_0xcbd8('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index a983177..06fa5b8 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 _0x7508=['includeAll','findAll','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../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','Content-Range','apply','reject','save','update','then','get','ODBC','UserProfileResource','destroy','error','stack','name','send','index','SquareOdbc','rawAttributes','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','where','filter','type','VIRTUAL','merge','options'];(function(_0x1fee31,_0x3ede88){var _0x376024=function(_0x290554){while(--_0x290554){_0x1fee31['push'](_0x1fee31['shift']());}};_0x376024(++_0x3ede88);}(_0x7508,0x1c5));var _0x8750=function(_0x34ea52,_0x1bf87e){_0x34ea52=_0x34ea52-0x0;var _0x2c3e42=_0x7508[_0x34ea52];return _0x2c3e42;};'use strict';var emlformat=require(_0x8750('0x0'));var rimraf=require(_0x8750('0x1'));var zipdir=require(_0x8750('0x2'));var jsonpatch=require(_0x8750('0x3'));var rp=require(_0x8750('0x4'));var moment=require(_0x8750('0x5'));var BPromise=require(_0x8750('0x6'));var Mustache=require(_0x8750('0x7'));var util=require(_0x8750('0x8'));var path=require(_0x8750('0x9'));var sox=require(_0x8750('0xa'));var csv=require(_0x8750('0xb'));var ejs=require(_0x8750('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8750('0xd'));var jsforce=require(_0x8750('0xe'));var deskjs=require(_0x8750('0xf'));var toCsv=require(_0x8750('0xb'));var querystring=require(_0x8750('0x10'));var Papa=require(_0x8750('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8750('0x12'));var as=require(_0x8750('0x13'));var hardwareService=require(_0x8750('0x14'));var logger=require(_0x8750('0x15'))('api');var utils=require(_0x8750('0x16'));var config=require(_0x8750('0x17'));var licenseUtil=require(_0x8750('0x18'));var db=require(_0x8750('0x19'))['db'];function respondWithStatusCode(_0x3155c9,_0x3c115d){_0x3c115d=_0x3c115d||0xcc;return function(_0xb2ceed){if(_0xb2ceed){return _0x3155c9['sendStatus'](_0x3c115d);}return _0x3155c9[_0x8750('0x1a')](_0x3c115d)[_0x8750('0x1b')]();};}function respondWithResult(_0x2408e2,_0x5c3e4c){_0x5c3e4c=_0x5c3e4c||0xc8;return function(_0x39f1cd){if(_0x39f1cd){return _0x2408e2[_0x8750('0x1a')](_0x5c3e4c)[_0x8750('0x1c')](_0x39f1cd);}};}function respondWithFilteredResult(_0x371962,_0x4bb00f){return function(_0xc48beb){if(_0xc48beb){var _0x241d22=typeof _0x4bb00f[_0x8750('0x1d')]===_0x8750('0x1e')&&typeof _0x4bb00f[_0x8750('0x1f')]==='undefined';var _0x4e864b=_0xc48beb['count'];var _0x49f006=_0x241d22?0x0:_0x4bb00f[_0x8750('0x1d')];var _0x41c756=_0x241d22?_0xc48beb[_0x8750('0x20')]:_0x4bb00f[_0x8750('0x1d')]+_0x4bb00f['limit'];var _0x1369eb;if(_0x41c756>=_0x4e864b){_0x41c756=_0x4e864b;_0x1369eb=0xc8;}else{_0x1369eb=0xce;}_0x371962[_0x8750('0x1a')](_0x1369eb);return _0x371962[_0x8750('0x21')](_0x8750('0x22'),_0x49f006+'-'+_0x41c756+'/'+_0x4e864b)[_0x8750('0x1c')](_0xc48beb);}return null;};}function patchUpdates(_0x116783){return function(_0x489fb6){try{jsonpatch[_0x8750('0x23')](_0x489fb6,_0x116783,!![]);}catch(_0x4725a5){return BPromise[_0x8750('0x24')](_0x4725a5);}return _0x489fb6[_0x8750('0x25')]();};}function saveUpdates(_0xeee3be,_0x5f7071){return function(_0x2efdec){if(_0x2efdec){return _0x2efdec[_0x8750('0x26')](_0xeee3be)[_0x8750('0x27')](function(_0x38a60a){return _0x38a60a;});}return null;};}function removeEntity(_0x3f1e78,_0x170755){return function(_0x355a18){if(_0x355a18){return _0x355a18['destroy']()[_0x8750('0x27')](function(){var _0x2be98b=_0x355a18[_0x8750('0x28')]({'plain':!![]});var _0x2000e6=_0x8750('0x29');return db[_0x8750('0x2a')][_0x8750('0x2b')]({'where':{'type':_0x2000e6,'resourceId':_0x2be98b['id']}})[_0x8750('0x27')](function(){return _0x355a18;});})[_0x8750('0x27')](function(){_0x3f1e78['status'](0xcc)[_0x8750('0x1b')]();});}};}function handleEntityNotFound(_0x368593,_0x25b838){return function(_0x5d261e){if(!_0x5d261e){_0x368593['sendStatus'](0x194);}return _0x5d261e;};}function handleError(_0x26365f,_0x157bef){_0x157bef=_0x157bef||0x1f4;return function(_0x593bb9){logger[_0x8750('0x2c')](_0x593bb9[_0x8750('0x2d')]);if(_0x593bb9[_0x8750('0x2e')]){delete _0x593bb9['name'];}_0x26365f['status'](_0x157bef)[_0x8750('0x2f')](_0x593bb9);};}exports[_0x8750('0x30')]=function(_0x116646,_0x17a101){var _0x39a002={},_0x4b2238={},_0x58bd99={'count':0x0,'rows':[]};var _0x3f607c=_['map'](db[_0x8750('0x31')][_0x8750('0x32')],function(_0x59fc7a){return{'name':_0x59fc7a['fieldName'],'type':_0x59fc7a['type'][_0x8750('0x33')]};});_0x4b2238['model']=_[_0x8750('0x34')](_0x3f607c,_0x8750('0x2e'));_0x4b2238[_0x8750('0x35')]=_[_0x8750('0x36')](_0x116646[_0x8750('0x35')]);_0x4b2238[_0x8750('0x37')]=_[_0x8750('0x38')](_0x4b2238[_0x8750('0x39')],_0x4b2238[_0x8750('0x35')]);_0x39a002[_0x8750('0x3a')]=_[_0x8750('0x38')](_0x4b2238[_0x8750('0x39')],qs[_0x8750('0x3b')](_0x116646['query'][_0x8750('0x3b')]));_0x39a002[_0x8750('0x3a')]=_0x39a002['attributes'][_0x8750('0x3c')]?_0x39a002[_0x8750('0x3a')]:_0x4b2238[_0x8750('0x39')];if(!_0x116646[_0x8750('0x35')][_0x8750('0x3d')]('nolimit')){_0x39a002['limit']=qs['limit'](_0x116646[_0x8750('0x35')]['limit']);_0x39a002[_0x8750('0x1d')]=qs['offset'](_0x116646['query']['offset']);}_0x39a002[_0x8750('0x3e')]=qs['sort'](_0x116646[_0x8750('0x35')]['sort']);_0x39a002[_0x8750('0x3f')]=qs[_0x8750('0x37')](_['pick'](_0x116646[_0x8750('0x35')],_0x4b2238['filters']),_0x3f607c);if(_0x116646[_0x8750('0x35')][_0x8750('0x40')]){_0x39a002[_0x8750('0x3f')]=_['merge'](_0x39a002[_0x8750('0x3f')],{'$or':_[_0x8750('0x34')](_0x3f607c,function(_0x1543f5){if(_0x1543f5[_0x8750('0x41')]!==_0x8750('0x42')){var _0xbdfb1f={};_0xbdfb1f[_0x1543f5['name']]={'$like':'%'+_0x116646[_0x8750('0x35')][_0x8750('0x40')]+'%'};return _0xbdfb1f;}})});}_0x39a002=_[_0x8750('0x43')]({},_0x39a002,_0x116646[_0x8750('0x44')]);var _0x23747e={'where':_0x39a002[_0x8750('0x3f')]};return db['SquareOdbc']['count'](_0x23747e)[_0x8750('0x27')](function(_0x3eed97){_0x58bd99['count']=_0x3eed97;if(_0x116646[_0x8750('0x35')][_0x8750('0x45')]){_0x39a002['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x8750('0x46')](_0x39a002);})[_0x8750('0x27')](function(_0x52fe8e){_0x58bd99['rows']=_0x52fe8e;return _0x58bd99;})['then'](respondWithFilteredResult(_0x17a101,_0x39a002))[_0x8750('0x47')](handleError(_0x17a101,null));};exports['show']=function(_0x544237,_0x5d9418){var _0xba8703={'raw':!![],'where':{'id':_0x544237[_0x8750('0x48')]['id']}},_0x304c04={};_0x304c04[_0x8750('0x39')]=_['keys'](db[_0x8750('0x31')]['rawAttributes']);_0x304c04[_0x8750('0x35')]=_[_0x8750('0x36')](_0x544237[_0x8750('0x35')]);_0x304c04[_0x8750('0x37')]=_['intersection'](_0x304c04['model'],_0x304c04[_0x8750('0x35')]);_0xba8703[_0x8750('0x3a')]=_[_0x8750('0x38')](_0x304c04[_0x8750('0x39')],qs['fields'](_0x544237[_0x8750('0x35')][_0x8750('0x3b')]));_0xba8703[_0x8750('0x3a')]=_0xba8703[_0x8750('0x3a')]['length']?_0xba8703[_0x8750('0x3a')]:_0x304c04[_0x8750('0x39')];if(_0x544237[_0x8750('0x35')][_0x8750('0x45')]){_0xba8703[_0x8750('0x49')]=[{'all':!![]}];}_0xba8703=_[_0x8750('0x43')]({},_0xba8703,_0x544237['options']);return db[_0x8750('0x31')][_0x8750('0x4a')](_0xba8703)[_0x8750('0x27')](handleEntityNotFound(_0x5d9418,null))[_0x8750('0x27')](respondWithResult(_0x5d9418,null))[_0x8750('0x47')](handleError(_0x5d9418,null));};exports[_0x8750('0x4b')]=function(_0x17f526,_0x54d05a){return db['SquareOdbc'][_0x8750('0x4b')](_0x17f526[_0x8750('0x4c')],{})['then'](function(_0x41e510){var _0x11fc53=_0x17f526[_0x8750('0x4d')]['get']({'plain':!![]});if(!_0x11fc53)throw new Error(_0x8750('0x4e'));if(_0x11fc53[_0x8750('0x4f')]===_0x8750('0x4d')){var _0x693487=_0x41e510[_0x8750('0x28')]({'plain':!![]});var _0x1aae9a=_0x8750('0x29');return db[_0x8750('0x50')]['find']({'where':{'name':_0x1aae9a,'userProfileId':_0x11fc53[_0x8750('0x51')]},'raw':!![]})[_0x8750('0x27')](function(_0x4c8f83){if(_0x4c8f83&&_0x4c8f83[_0x8750('0x52')]===0x0){return db[_0x8750('0x2a')][_0x8750('0x4b')]({'name':_0x693487['name'],'resourceId':_0x693487['id'],'type':_0x4c8f83[_0x8750('0x2e')],'sectionId':_0x4c8f83['id']},{})['then'](function(){return _0x41e510;});}else{return _0x41e510;}})[_0x8750('0x47')](function(_0x1d64c1){logger[_0x8750('0x2c')](_0x8750('0x53'),_0x1d64c1);throw _0x1d64c1;});}return _0x41e510;})[_0x8750('0x27')](respondWithResult(_0x54d05a,0xc9))[_0x8750('0x47')](handleError(_0x54d05a,null));};exports['update']=function(_0x3732be,_0x35c4a8){if(_0x3732be[_0x8750('0x4c')]['id']){delete _0x3732be[_0x8750('0x4c')]['id'];}return db['SquareOdbc'][_0x8750('0x4a')]({'where':{'id':_0x3732be[_0x8750('0x48')]['id']}})[_0x8750('0x27')](handleEntityNotFound(_0x35c4a8,null))[_0x8750('0x27')](saveUpdates(_0x3732be[_0x8750('0x4c')],null))['then'](respondWithResult(_0x35c4a8,null))['catch'](handleError(_0x35c4a8,null));};exports[_0x8750('0x2b')]=function(_0xe60830,_0x378839){return db[_0x8750('0x31')][_0x8750('0x4a')]({'where':{'id':_0xe60830['params']['id']}})[_0x8750('0x27')](handleEntityNotFound(_0x378839,null))[_0x8750('0x27')](removeEntity(_0x378839,null))[_0x8750('0x47')](handleError(_0x378839,null));};exports[_0x8750('0x54')]=function(_0x3590f6,_0x20f106,_0x24efce){var _0x467a92;return db[_0x8750('0x31')][_0x8750('0x4a')]({'where':{'id':_0x3590f6[_0x8750('0x48')]['id']},'attributes':['id',_0x8750('0x55')]})['then'](handleEntityNotFound(_0x20f106,null))[_0x8750('0x27')](function(_0x396b34){if(_0x396b34){var _0x5e99fb=require(_0x8750('0x56'))();_0x5e99fb['openSync'](_0x396b34[_0x8750('0x55')]);_0x5e99fb['closeSync']();return _0x396b34;}})[_0x8750('0x27')](respondWithResult(_0x20f106,null))['catch'](handleError(_0x20f106,null));}; \ No newline at end of file +var _0xbf3a=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','ODBC','destroy','status','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','SquareOdbc','includeAll','findAll','rows','catch','show','params','keys','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','jsforce','querystring','ioredis'];(function(_0x29d443,_0x3bcbf){var _0x118b28=function(_0x1c23fd){while(--_0x1c23fd){_0x29d443['push'](_0x29d443['shift']());}};_0x118b28(++_0x3bcbf);}(_0xbf3a,0xee));var _0xabf3=function(_0x128443,_0x2fe025){_0x128443=_0x128443-0x0;var _0x1a4ce1=_0xbf3a[_0x128443];return _0x1a4ce1;};'use strict';var emlformat=require(_0xabf3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabf3('0x1'));var jsonpatch=require(_0xabf3('0x2'));var rp=require(_0xabf3('0x3'));var moment=require(_0xabf3('0x4'));var BPromise=require(_0xabf3('0x5'));var Mustache=require('mustache');var util=require(_0xabf3('0x6'));var path=require(_0xabf3('0x7'));var sox=require(_0xabf3('0x8'));var csv=require(_0xabf3('0x9'));var ejs=require(_0xabf3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xabf3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xabf3('0x9'));var querystring=require(_0xabf3('0xc'));var Papa=require('papaparse');var Redis=require(_0xabf3('0xd'));var authService=require(_0xabf3('0xe'));var qs=require(_0xabf3('0xf'));var as=require(_0xabf3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabf3('0x11'))(_0xabf3('0x12'));var utils=require(_0xabf3('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xabf3('0x14'))['db'];function respondWithStatusCode(_0x13b159,_0x58c4cb){_0x58c4cb=_0x58c4cb||0xcc;return function(_0x27caaa){if(_0x27caaa){return _0x13b159['sendStatus'](_0x58c4cb);}return _0x13b159['status'](_0x58c4cb)[_0xabf3('0x15')]();};}function respondWithResult(_0x1bb45e,_0x31ba25){_0x31ba25=_0x31ba25||0xc8;return function(_0x2edcdc){if(_0x2edcdc){return _0x1bb45e['status'](_0x31ba25)[_0xabf3('0x16')](_0x2edcdc);}};}function respondWithFilteredResult(_0x35694f,_0x315b6b){return function(_0x2dc0af){if(_0x2dc0af){var _0x46510c=typeof _0x315b6b[_0xabf3('0x17')]===_0xabf3('0x18')&&typeof _0x315b6b[_0xabf3('0x19')]===_0xabf3('0x18');var _0x6d946=_0x2dc0af['count'];var _0x4bffef=_0x46510c?0x0:_0x315b6b[_0xabf3('0x17')];var _0xcd07fe=_0x46510c?_0x2dc0af[_0xabf3('0x1a')]:_0x315b6b[_0xabf3('0x17')]+_0x315b6b[_0xabf3('0x19')];var _0x270222;if(_0xcd07fe>=_0x6d946){_0xcd07fe=_0x6d946;_0x270222=0xc8;}else{_0x270222=0xce;}_0x35694f['status'](_0x270222);return _0x35694f['set'](_0xabf3('0x1b'),_0x4bffef+'-'+_0xcd07fe+'/'+_0x6d946)['json'](_0x2dc0af);}return null;};}function patchUpdates(_0x18f808){return function(_0x3f52c5){try{jsonpatch[_0xabf3('0x1c')](_0x3f52c5,_0x18f808,!![]);}catch(_0x2db39a){return BPromise['reject'](_0x2db39a);}return _0x3f52c5[_0xabf3('0x1d')]();};}function saveUpdates(_0x179eb5,_0x3e3e4c){return function(_0x28edb2){if(_0x28edb2){return _0x28edb2[_0xabf3('0x1e')](_0x179eb5)[_0xabf3('0x1f')](function(_0x5d1e7f){return _0x5d1e7f;});}return null;};}function removeEntity(_0x4c9da1,_0x534250){return function(_0x3a7912){if(_0x3a7912){return _0x3a7912['destroy']()[_0xabf3('0x1f')](function(){var _0xc04c6=_0x3a7912[_0xabf3('0x20')]({'plain':!![]});var _0x16132e=_0xabf3('0x21');return db['UserProfileResource'][_0xabf3('0x22')]({'where':{'type':_0x16132e,'resourceId':_0xc04c6['id']}})[_0xabf3('0x1f')](function(){return _0x3a7912;});})[_0xabf3('0x1f')](function(){_0x4c9da1[_0xabf3('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x263a9c,_0x2eb09c){return function(_0xc54207){if(!_0xc54207){_0x263a9c[_0xabf3('0x24')](0x194);}return _0xc54207;};}function handleError(_0xe67bcf,_0x159f7c){_0x159f7c=_0x159f7c||0x1f4;return function(_0x33603d){logger['error'](_0x33603d[_0xabf3('0x25')]);if(_0x33603d[_0xabf3('0x26')]){delete _0x33603d[_0xabf3('0x26')];}_0xe67bcf[_0xabf3('0x23')](_0x159f7c)[_0xabf3('0x27')](_0x33603d);};}exports[_0xabf3('0x28')]=function(_0x2eaa84,_0x1ec51b){var _0x598992={},_0xd3a84={},_0x306083={'count':0x0,'rows':[]};var _0x2be6be=_[_0xabf3('0x29')](db['SquareOdbc'][_0xabf3('0x2a')],function(_0x5d4d73){return{'name':_0x5d4d73[_0xabf3('0x2b')],'type':_0x5d4d73[_0xabf3('0x2c')][_0xabf3('0x2d')]};});_0xd3a84['model']=_[_0xabf3('0x29')](_0x2be6be,_0xabf3('0x26'));_0xd3a84[_0xabf3('0x2e')]=_['keys'](_0x2eaa84[_0xabf3('0x2e')]);_0xd3a84['filters']=_['intersection'](_0xd3a84[_0xabf3('0x2f')],_0xd3a84['query']);_0x598992[_0xabf3('0x30')]=_['intersection'](_0xd3a84[_0xabf3('0x2f')],qs[_0xabf3('0x31')](_0x2eaa84[_0xabf3('0x2e')][_0xabf3('0x31')]));_0x598992['attributes']=_0x598992[_0xabf3('0x30')]['length']?_0x598992[_0xabf3('0x30')]:_0xd3a84[_0xabf3('0x2f')];if(!_0x2eaa84[_0xabf3('0x2e')][_0xabf3('0x32')](_0xabf3('0x33'))){_0x598992[_0xabf3('0x19')]=qs[_0xabf3('0x19')](_0x2eaa84[_0xabf3('0x2e')]['limit']);_0x598992['offset']=qs[_0xabf3('0x17')](_0x2eaa84['query'][_0xabf3('0x17')]);}_0x598992[_0xabf3('0x34')]=qs[_0xabf3('0x35')](_0x2eaa84[_0xabf3('0x2e')][_0xabf3('0x35')]);_0x598992[_0xabf3('0x36')]=qs['filters'](_[_0xabf3('0x37')](_0x2eaa84['query'],_0xd3a84[_0xabf3('0x38')]),_0x2be6be);if(_0x2eaa84['query'][_0xabf3('0x39')]){_0x598992[_0xabf3('0x36')]=_[_0xabf3('0x3a')](_0x598992[_0xabf3('0x36')],{'$or':_[_0xabf3('0x29')](_0x2be6be,function(_0x307de5){if(_0x307de5[_0xabf3('0x2c')]!=='VIRTUAL'){var _0x3257b6={};_0x3257b6[_0x307de5[_0xabf3('0x26')]]={'$like':'%'+_0x2eaa84['query'][_0xabf3('0x39')]+'%'};return _0x3257b6;}})});}_0x598992=_['merge']({},_0x598992,_0x2eaa84['options']);var _0xf68dba={'where':_0x598992['where']};return db[_0xabf3('0x3b')][_0xabf3('0x1a')](_0xf68dba)['then'](function(_0x4b364f){_0x306083['count']=_0x4b364f;if(_0x2eaa84[_0xabf3('0x2e')][_0xabf3('0x3c')]){_0x598992['include']=[{'all':!![]}];}return db[_0xabf3('0x3b')][_0xabf3('0x3d')](_0x598992);})[_0xabf3('0x1f')](function(_0x330f61){_0x306083[_0xabf3('0x3e')]=_0x330f61;return _0x306083;})['then'](respondWithFilteredResult(_0x1ec51b,_0x598992))[_0xabf3('0x3f')](handleError(_0x1ec51b,null));};exports[_0xabf3('0x40')]=function(_0x2592c5,_0x155ab6){var _0x589b6a={'raw':!![],'where':{'id':_0x2592c5[_0xabf3('0x41')]['id']}},_0x5520e7={};_0x5520e7[_0xabf3('0x2f')]=_[_0xabf3('0x42')](db['SquareOdbc'][_0xabf3('0x2a')]);_0x5520e7[_0xabf3('0x2e')]=_['keys'](_0x2592c5[_0xabf3('0x2e')]);_0x5520e7[_0xabf3('0x38')]=_['intersection'](_0x5520e7[_0xabf3('0x2f')],_0x5520e7[_0xabf3('0x2e')]);_0x589b6a[_0xabf3('0x30')]=_['intersection'](_0x5520e7[_0xabf3('0x2f')],qs['fields'](_0x2592c5[_0xabf3('0x2e')][_0xabf3('0x31')]));_0x589b6a[_0xabf3('0x30')]=_0x589b6a[_0xabf3('0x30')]['length']?_0x589b6a[_0xabf3('0x30')]:_0x5520e7[_0xabf3('0x2f')];if(_0x2592c5[_0xabf3('0x2e')][_0xabf3('0x3c')]){_0x589b6a['include']=[{'all':!![]}];}_0x589b6a=_[_0xabf3('0x3a')]({},_0x589b6a,_0x2592c5[_0xabf3('0x43')]);return db['SquareOdbc'][_0xabf3('0x44')](_0x589b6a)[_0xabf3('0x1f')](handleEntityNotFound(_0x155ab6,null))[_0xabf3('0x1f')](respondWithResult(_0x155ab6,null))['catch'](handleError(_0x155ab6,null));};exports['create']=function(_0x44e0d7,_0x3b422d){return db[_0xabf3('0x3b')][_0xabf3('0x45')](_0x44e0d7['body'],{})[_0xabf3('0x1f')](function(_0x25c6f5){var _0x579d74=_0x44e0d7[_0xabf3('0x46')]['get']({'plain':!![]});if(!_0x579d74)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x579d74[_0xabf3('0x47')]===_0xabf3('0x46')){var _0x255733=_0x25c6f5['get']({'plain':!![]});var _0x4b4e0d=_0xabf3('0x21');return db[_0xabf3('0x48')]['find']({'where':{'name':_0x4b4e0d,'userProfileId':_0x579d74[_0xabf3('0x49')]},'raw':!![]})['then'](function(_0x37e8e5){if(_0x37e8e5&&_0x37e8e5[_0xabf3('0x4a')]===0x0){return db[_0xabf3('0x4b')]['create']({'name':_0x255733['name'],'resourceId':_0x255733['id'],'type':_0x37e8e5[_0xabf3('0x26')],'sectionId':_0x37e8e5['id']},{})['then'](function(){return _0x25c6f5;});}else{return _0x25c6f5;}})[_0xabf3('0x3f')](function(_0x1bee35){logger[_0xabf3('0x4c')](_0xabf3('0x4d'),_0x1bee35);throw _0x1bee35;});}return _0x25c6f5;})[_0xabf3('0x1f')](respondWithResult(_0x3b422d,0xc9))[_0xabf3('0x3f')](handleError(_0x3b422d,null));};exports[_0xabf3('0x1e')]=function(_0x4d0895,_0xc1af81){if(_0x4d0895[_0xabf3('0x4e')]['id']){delete _0x4d0895[_0xabf3('0x4e')]['id'];}return db[_0xabf3('0x3b')][_0xabf3('0x44')]({'where':{'id':_0x4d0895[_0xabf3('0x41')]['id']}})[_0xabf3('0x1f')](handleEntityNotFound(_0xc1af81,null))['then'](saveUpdates(_0x4d0895[_0xabf3('0x4e')],null))['then'](respondWithResult(_0xc1af81,null))[_0xabf3('0x3f')](handleError(_0xc1af81,null));};exports[_0xabf3('0x22')]=function(_0x3617ed,_0x5b4638){return db[_0xabf3('0x3b')][_0xabf3('0x44')]({'where':{'id':_0x3617ed[_0xabf3('0x41')]['id']}})[_0xabf3('0x1f')](handleEntityNotFound(_0x5b4638,null))[_0xabf3('0x1f')](removeEntity(_0x5b4638,null))[_0xabf3('0x3f')](handleError(_0x5b4638,null));};exports[_0xabf3('0x4f')]=function(_0x1e86ed,_0x5dbec5,_0x3c6a9d){var _0x4de460;return db['SquareOdbc'][_0xabf3('0x44')]({'where':{'id':_0x1e86ed[_0xabf3('0x41')]['id']},'attributes':['id',_0xabf3('0x50')]})[_0xabf3('0x1f')](handleEntityNotFound(_0x5dbec5,null))['then'](function(_0x3d3396){if(_0x3d3396){var _0x489a4c=require(_0xabf3('0x51'))();_0x489a4c[_0xabf3('0x52')](_0x3d3396[_0xabf3('0x50')]);_0x489a4c[_0xabf3('0x53')]();return _0x3d3396;}})[_0xabf3('0x1f')](respondWithResult(_0x5dbec5,null))[_0xabf3('0x3f')](handleError(_0x5dbec5,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 699ca01..50c3a2c 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 _0x5ee9=['SquareOdbc','square_odbc','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x585700,_0x2761a7){var _0x2278f9=function(_0x61fa20){while(--_0x61fa20){_0x585700['push'](_0x585700['shift']());}};_0x2278f9(++_0x2761a7);}(_0x5ee9,0x120));var _0x95ee=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5ee9[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x95ee('0x0'));var util=require(_0x95ee('0x1'));var logger=require(_0x95ee('0x2'))('api');var moment=require(_0x95ee('0x3'));var BPromise=require('bluebird');var rp=require(_0x95ee('0x4'));var fs=require('fs');var path=require(_0x95ee('0x5'));var rimraf=require(_0x95ee('0x6'));var config=require(_0x95ee('0x7'));var attributes=require(_0x95ee('0x8'));module[_0x95ee('0x9')]=function(_0x375155,_0x2bde5c){return _0x375155[_0x95ee('0xa')](_0x95ee('0xb'),attributes,{'tableName':_0x95ee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb4d=['path','rimraf','../../config/environment','./squareOdbc.attributes','SquareOdbc','square_odbc','lodash','util','moment','bluebird','request-promise'];(function(_0x4095e2,_0x17f2cd){var _0x52af0e=function(_0x4d1b06){while(--_0x4d1b06){_0x4095e2['push'](_0x4095e2['shift']());}};_0x52af0e(++_0x17f2cd);}(_0xbb4d,0x74));var _0xdbb4=function(_0x18bf62,_0x2e2687){_0x18bf62=_0x18bf62-0x0;var _0x4ed65b=_0xbb4d[_0x18bf62];return _0x4ed65b;};'use strict';var _=require(_0xdbb4('0x0'));var util=require(_0xdbb4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdbb4('0x2'));var BPromise=require(_0xdbb4('0x3'));var rp=require(_0xdbb4('0x4'));var fs=require('fs');var path=require(_0xdbb4('0x5'));var rimraf=require(_0xdbb4('0x6'));var config=require(_0xdbb4('0x7'));var attributes=require(_0xdbb4('0x8'));module['exports']=function(_0x3f7b12,_0x3d1c5f){return _0x3f7b12['define'](_0xdbb4('0x9'),attributes,{'tableName':_0xdbb4('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 0875ed4..f592853 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 _0x453b=['SquareOdbc,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','SquareOdbc','find','options','raw','include','map','attributes','model','debug','ShowSquareOdbc','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x453b,0x185));var _0xb453=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x453b[_0xcd0918];return _0x250704;};'use strict';var _=require('lodash');var util=require(_0xb453('0x0'));var moment=require('moment');var BPromise=require(_0xb453('0x1'));var rs=require(_0xb453('0x2'));var fs=require('fs');var Redis=require(_0xb453('0x3'));var db=require(_0xb453('0x4'))['db'];var utils=require(_0xb453('0x5'));var logger=require(_0xb453('0x6'))('rpc');var config=require(_0xb453('0x7'));var jayson=require(_0xb453('0x8'));var client=jayson[_0xb453('0x9')][_0xb453('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x846d9c,_0x39c512,_0x7efd6e){return new BPromise(function(_0x1cdf77,_0x5a1feb){return client[_0xb453('0xb')](_0x846d9c,_0x7efd6e)[_0xb453('0xc')](function(_0x499060){logger[_0xb453('0xd')](_0xb453('0xe'),_0x39c512,_0xb453('0xf'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x39c512,_0xb453('0xf'),JSON[_0xb453('0x10')](_0x499060));if(_0x499060[_0xb453('0x11')]){if(_0x499060[_0xb453('0x11')][_0xb453('0x12')]===0x1f4){logger['error'](_0xb453('0xe'),_0x39c512,_0x499060[_0xb453('0x11')][_0xb453('0x13')]);return _0x5a1feb(_0x499060[_0xb453('0x11')][_0xb453('0x13')]);}logger[_0xb453('0x11')](_0xb453('0xe'),_0x39c512,_0x499060[_0xb453('0x11')][_0xb453('0x13')]);return _0x1cdf77(_0x499060[_0xb453('0x11')][_0xb453('0x13')]);}else{logger[_0xb453('0xd')](_0xb453('0xe'),_0x39c512,_0xb453('0xf'));_0x1cdf77(_0x499060['result'][_0xb453('0x13')]);}})[_0xb453('0x14')](function(_0x2a12d9){logger[_0xb453('0x11')](_0xb453('0xe'),_0x39c512,_0x2a12d9);_0x5a1feb(_0x2a12d9);});});}exports['ShowSquareOdbc']=function(_0x595e46){var _0x2d9c63=this;return new Promise(function(_0x4f4561,_0x14bd12){return db[_0xb453('0x15')][_0xb453('0x16')]({'raw':_0x595e46[_0xb453('0x17')]?_0x595e46[_0xb453('0x17')][_0xb453('0x18')]===undefined?!![]:![]:!![],'where':_0x595e46['options']?_0x595e46[_0xb453('0x17')]['where']||null:null,'attributes':_0x595e46[_0xb453('0x17')]?_0x595e46['options']['attributes']||null:null,'include':_0x595e46[_0xb453('0x17')]?_0x595e46['options'][_0xb453('0x19')]?_[_0xb453('0x1a')](_0x595e46[_0xb453('0x17')][_0xb453('0x19')],function(_0xffece){return{'model':db[_0xffece['model']],'as':_0xffece['as'],'attributes':_0xffece[_0xb453('0x1b')],'include':_0xffece[_0xb453('0x19')]?_[_0xb453('0x1a')](_0xffece[_0xb453('0x19')],function(_0x3d3cc3){return{'model':db[_0x3d3cc3[_0xb453('0x1c')]],'as':_0x3d3cc3['as'],'attributes':_0x3d3cc3['attributes'],'include':_0x3d3cc3['include']?_[_0xb453('0x1a')](_0x3d3cc3[_0xb453('0x19')],function(_0x18ae24){return{'model':db[_0x18ae24[_0xb453('0x1c')]],'as':_0x18ae24['as'],'attributes':_0x18ae24[_0xb453('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb453('0xc')](function(_0xc682b6){logger['info']('ShowSquareOdbc',_0x595e46);logger[_0xb453('0x1d')]('ShowSquareOdbc',_0x595e46,JSON[_0xb453('0x10')](_0xc682b6));_0x4f4561(_0xc682b6);})[_0xb453('0x14')](function(_0x20cca0){logger[_0xb453('0x11')](_0xb453('0x1e'),_0x20cca0['message'],_0x595e46);_0x14bd12(_0x2d9c63['error'](0x1f4,_0x20cca0[_0xb453('0x13')]));});});}; \ No newline at end of file +var _0x36e5=['../../config/logger','rpc','../../config/environment','client','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','message','result','ShowSquareOdbc','SquareOdbc','raw','options','attributes','include','map','model','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x342839,_0x401f80){var _0x550466=function(_0xfcd5be){while(--_0xfcd5be){_0x342839['push'](_0x342839['shift']());}};_0x550466(++_0x401f80);}(_0x36e5,0xea));var _0x536e=function(_0x4f3cd1,_0x4b666e){_0x4f3cd1=_0x4f3cd1-0x0;var _0x4f304d=_0x36e5[_0x4f3cd1];return _0x4f304d;};'use strict';var _=require(_0x536e('0x0'));var util=require(_0x536e('0x1'));var moment=require('moment');var BPromise=require(_0x536e('0x2'));var rs=require(_0x536e('0x3'));var fs=require('fs');var Redis=require(_0x536e('0x4'));var db=require(_0x536e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x536e('0x6'))(_0x536e('0x7'));var config=require(_0x536e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x536e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x213ab5,_0x5cd2f8,_0x1ea1af){return new BPromise(function(_0x36f354,_0x228b11){return client[_0x536e('0xa')](_0x213ab5,_0x1ea1af)[_0x536e('0xb')](function(_0x4c5c2c){logger[_0x536e('0xc')](_0x536e('0xd'),_0x5cd2f8,_0x536e('0xe'));logger[_0x536e('0xf')](_0x536e('0x10'),_0x5cd2f8,'request\x20sent',JSON['stringify'](_0x4c5c2c));if(_0x4c5c2c[_0x536e('0x11')]){if(_0x4c5c2c['error']['code']===0x1f4){logger['error'](_0x536e('0xd'),_0x5cd2f8,_0x4c5c2c[_0x536e('0x11')][_0x536e('0x12')]);return _0x228b11(_0x4c5c2c[_0x536e('0x11')][_0x536e('0x12')]);}logger['error'](_0x536e('0xd'),_0x5cd2f8,_0x4c5c2c[_0x536e('0x11')]['message']);return _0x36f354(_0x4c5c2c[_0x536e('0x11')][_0x536e('0x12')]);}else{logger[_0x536e('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x5cd2f8,_0x536e('0xe'));_0x36f354(_0x4c5c2c[_0x536e('0x13')][_0x536e('0x12')]);}})['catch'](function(_0x4490d4){logger[_0x536e('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x5cd2f8,_0x4490d4);_0x228b11(_0x4490d4);});});}exports[_0x536e('0x14')]=function(_0x48748a){var _0x912cef=this;return new Promise(function(_0x4807ed,_0x261379){return db[_0x536e('0x15')]['find']({'raw':_0x48748a['options']?_0x48748a['options'][_0x536e('0x16')]===undefined?!![]:![]:!![],'where':_0x48748a['options']?_0x48748a[_0x536e('0x17')]['where']||null:null,'attributes':_0x48748a[_0x536e('0x17')]?_0x48748a[_0x536e('0x17')][_0x536e('0x18')]||null:null,'include':_0x48748a[_0x536e('0x17')]?_0x48748a[_0x536e('0x17')][_0x536e('0x19')]?_[_0x536e('0x1a')](_0x48748a[_0x536e('0x17')][_0x536e('0x19')],function(_0x5918c5){return{'model':db[_0x5918c5[_0x536e('0x1b')]],'as':_0x5918c5['as'],'attributes':_0x5918c5['attributes'],'include':_0x5918c5[_0x536e('0x19')]?_[_0x536e('0x1a')](_0x5918c5[_0x536e('0x19')],function(_0x141bbf){return{'model':db[_0x141bbf[_0x536e('0x1b')]],'as':_0x141bbf['as'],'attributes':_0x141bbf[_0x536e('0x18')],'include':_0x141bbf[_0x536e('0x19')]?_[_0x536e('0x1a')](_0x141bbf[_0x536e('0x19')],function(_0x2c95bd){return{'model':db[_0x2c95bd[_0x536e('0x1b')]],'as':_0x2c95bd['as'],'attributes':_0x2c95bd['attributes']};}):[]};}):[]};}):[]:[]})[_0x536e('0xb')](function(_0x34e9f4){logger[_0x536e('0xc')](_0x536e('0x14'),_0x48748a);logger[_0x536e('0xf')](_0x536e('0x14'),_0x48748a,JSON[_0x536e('0x1c')](_0x34e9f4));_0x4807ed(_0x34e9f4);})[_0x536e('0x1d')](function(_0x5c2f33){logger[_0x536e('0x11')](_0x536e('0x14'),_0x5c2f33[_0x536e('0x12')],_0x48748a);_0x261379(_0x912cef[_0x536e('0x11')](0x1f4,_0x5c2f33[_0x536e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 8e9d35c..05ad69a 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 _0xef6a=['../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/users','getUsers','create','post','put','update','delete','destroy','multer','util','path','Router','../../components/auth/service'];(function(_0x2f6822,_0x11935a){var _0x58665f=function(_0x15c47e){while(--_0x15c47e){_0x2f6822['push'](_0x2f6822['shift']());}};_0x58665f(++_0x11935a);}(_0xef6a,0x1e9));var _0xaef6=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xef6a[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0xaef6('0x0'));var util=require(_0xaef6('0x1'));var path=require(_0xaef6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaef6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xaef6('0x4'));var interaction=require(_0xaef6('0x5'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router['get']('/',auth[_0xaef6('0x6')](),controller[_0xaef6('0x7')]);router[_0xaef6('0x8')](_0xaef6('0x9'),auth[_0xaef6('0x6')](),controller[_0xaef6('0xa')]);router[_0xaef6('0x8')](_0xaef6('0xb'),auth['isAuthenticated'](),controller[_0xaef6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaef6('0xd')]);router[_0xaef6('0xe')]('/:id/users',auth[_0xaef6('0x6')](),controller['addUsers']);router[_0xaef6('0xf')](_0xaef6('0x9'),auth[_0xaef6('0x6')](),controller[_0xaef6('0x10')]);router[_0xaef6('0x11')](_0xaef6('0x9'),auth[_0xaef6('0x6')](),controller[_0xaef6('0x12')]);router[_0xaef6('0x11')](_0xaef6('0xb'),auth[_0xaef6('0x6')](),controller['removeUsers']);module['exports']=router; \ No newline at end of file +var _0x1ae4=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show','/:id/users','post','put','update','destroy','delete','removeUsers','exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x1ae4,0x114));var _0x41ae=function(_0x49b8d3,_0x1b70ea){_0x49b8d3=_0x49b8d3-0x0;var _0x55ab8e=_0x1ae4[_0x49b8d3];return _0x55ab8e;};'use strict';var multer=require(_0x41ae('0x0'));var util=require(_0x41ae('0x1'));var path=require(_0x41ae('0x2'));var timeout=require('connect-timeout');var express=require(_0x41ae('0x3'));var router=express[_0x41ae('0x4')]();var fs_extra=require(_0x41ae('0x5'));var auth=require(_0x41ae('0x6'));var interaction=require(_0x41ae('0x7'));var config=require(_0x41ae('0x8'));var controller=require(_0x41ae('0x9'));router['get']('/',auth[_0x41ae('0xa')](),controller[_0x41ae('0xb')]);router[_0x41ae('0xc')](_0x41ae('0xd'),auth['isAuthenticated'](),controller[_0x41ae('0xe')]);router['get'](_0x41ae('0xf'),auth[_0x41ae('0xa')](),controller['getUsers']);router[_0x41ae('0x10')]('/',auth[_0x41ae('0xa')](),controller['create']);router[_0x41ae('0x10')]('/:id/users',auth[_0x41ae('0xa')](),controller['addUsers']);router[_0x41ae('0x11')](_0x41ae('0xd'),auth['isAuthenticated'](),controller[_0x41ae('0x12')]);router['delete'](_0x41ae('0xd'),auth[_0x41ae('0xa')](),controller[_0x41ae('0x13')]);router[_0x41ae('0x14')](_0x41ae('0xf'),auth['isAuthenticated'](),controller[_0x41ae('0x15')]);module[_0x41ae('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index d4cef59..2f4eb1d 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 _0xba38=['utf8','BLOB','production','DATE','exports','STRING','name','TEXT','long','getDataValue','preproduction','toString'];(function(_0x1a60c8,_0x5bf187){var _0x5046a8=function(_0x1995b2){while(--_0x1995b2){_0x1a60c8['push'](_0x1a60c8['shift']());}};_0x5046a8(++_0x5bf187);}(_0xba38,0x190));var _0x8ba3=function(_0x3fa2a1,_0x43b91a){_0x3fa2a1=_0x3fa2a1-0x0;var _0x888218=_0xba38[_0x3fa2a1];return _0x888218;};'use strict';var Sequelize=require('sequelize');module[_0x8ba3('0x0')]={'name':{'type':Sequelize[_0x8ba3('0x1')],'unique':_0x8ba3('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x8ba3('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0x8ba3('0x4')),'get':function(){if(this[_0x8ba3('0x5')](_0x8ba3('0x6'))){return this[_0x8ba3('0x5')](_0x8ba3('0x6'))[_0x8ba3('0x7')](_0x8ba3('0x8'));}}},'production':{'type':Sequelize[_0x8ba3('0x9')](_0x8ba3('0x4')),'get':function(){if(this[_0x8ba3('0x5')](_0x8ba3('0xa'))){return this[_0x8ba3('0x5')]('production')[_0x8ba3('0x7')](_0x8ba3('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x8ba3('0xb')]}}; \ No newline at end of file +var _0x832b=['BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','exports','STRING','TEXT'];(function(_0x2ca3d8,_0xf83cb8){var _0x2639d9=function(_0x5ee2bc){while(--_0x5ee2bc){_0x2ca3d8['push'](_0x2ca3d8['shift']());}};_0x2639d9(++_0xf83cb8);}(_0x832b,0x194));var _0xb832=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x832b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xb832('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xb832('0x1')]},'notes':{'type':Sequelize[_0xb832('0x2')]},'preproduction':{'type':Sequelize[_0xb832('0x3')](_0xb832('0x4')),'get':function(){if(this[_0xb832('0x5')](_0xb832('0x6'))){return this[_0xb832('0x5')]('preproduction')[_0xb832('0x7')](_0xb832('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0xb832('0x4')),'get':function(){if(this['getDataValue'](_0xb832('0x9'))){return this['getDataValue'](_0xb832('0x9'))[_0xb832('0x7')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xb832('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index f071973..03a0269 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 _0xe616=['query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','params','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','User','options','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','get','SquareProjects','error','name','send','index','map','SquareProject','rawAttributes','fieldName','key','model'];(function(_0x291d5c,_0x384244){var _0x9a75ff=function(_0x58ea4f){while(--_0x58ea4f){_0x291d5c['push'](_0x291d5c['shift']());}};_0x9a75ff(++_0x384244);}(_0xe616,0x1b6));var _0x6e61=function(_0x50be03,_0x10e55f){_0x50be03=_0x50be03-0x0;var _0x5364e7=_0xe616[_0x50be03];return _0x5364e7;};'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('bluebird');var Mustache=require(_0x6e61('0x5'));var util=require('util');var path=require(_0x6e61('0x6'));var sox=require(_0x6e61('0x7'));var csv=require(_0x6e61('0x8'));var ejs=require(_0x6e61('0x9'));var fs=require('fs');var fs_extra=require(_0x6e61('0xa'));var _=require('lodash');var squel=require(_0x6e61('0xb'));var crypto=require(_0x6e61('0xc'));var jsforce=require(_0x6e61('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6e61('0xe'));var Papa=require(_0x6e61('0xf'));var Redis=require(_0x6e61('0x10'));var authService=require(_0x6e61('0x11'));var qs=require(_0x6e61('0x12'));var as=require(_0x6e61('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e61('0x14'))(_0x6e61('0x15'));var utils=require(_0x6e61('0x16'));var config=require(_0x6e61('0x17'));var licenseUtil=require(_0x6e61('0x18'));var db=require(_0x6e61('0x19'))['db'];config[_0x6e61('0x1a')]=_[_0x6e61('0x1b')](config[_0x6e61('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x6e61('0x1c'))(new Redis(config[_0x6e61('0x1a')]));require(_0x6e61('0x1d'))[_0x6e61('0x1e')](socket);function respondWithStatusCode(_0x268bba,_0x544cc3){_0x544cc3=_0x544cc3||0xcc;return function(_0x1c7bb4){if(_0x1c7bb4){return _0x268bba[_0x6e61('0x1f')](_0x544cc3);}return _0x268bba[_0x6e61('0x20')](_0x544cc3)[_0x6e61('0x21')]();};}function respondWithResult(_0x2c2239,_0x51ca22){_0x51ca22=_0x51ca22||0xc8;return function(_0x2e5010){if(_0x2e5010){return _0x2c2239[_0x6e61('0x20')](_0x51ca22)[_0x6e61('0x22')](_0x2e5010);}};}function respondWithFilteredResult(_0x78158,_0x2dbafc){return function(_0xfd0f27){if(_0xfd0f27){var _0x379b6e=typeof _0x2dbafc[_0x6e61('0x23')]==='undefined'&&typeof _0x2dbafc[_0x6e61('0x24')]===_0x6e61('0x25');var _0x20473e=_0xfd0f27['count'];var _0x11fca8=_0x379b6e?0x0:_0x2dbafc[_0x6e61('0x23')];var _0x174f31=_0x379b6e?_0xfd0f27[_0x6e61('0x26')]:_0x2dbafc[_0x6e61('0x23')]+_0x2dbafc[_0x6e61('0x24')];var _0x4c0a99;if(_0x174f31>=_0x20473e){_0x174f31=_0x20473e;_0x4c0a99=0xc8;}else{_0x4c0a99=0xce;}_0x78158[_0x6e61('0x20')](_0x4c0a99);return _0x78158['set'](_0x6e61('0x27'),_0x11fca8+'-'+_0x174f31+'/'+_0x20473e)[_0x6e61('0x22')](_0xfd0f27);}return null;};}function patchUpdates(_0x1c6be4){return function(_0x3732bc){try{jsonpatch[_0x6e61('0x28')](_0x3732bc,_0x1c6be4,!![]);}catch(_0x5f5b5c){return BPromise[_0x6e61('0x29')](_0x5f5b5c);}return _0x3732bc['save']();};}function saveUpdates(_0x1a238c,_0x3017f7){return function(_0x5a94cd){if(_0x5a94cd){return _0x5a94cd[_0x6e61('0x2a')](_0x1a238c)[_0x6e61('0x2b')](function(_0xc9b3ab){return _0xc9b3ab;});}return null;};}function removeEntity(_0x45f57d,_0x262782){return function(_0x45c860){if(_0x45c860){return _0x45c860[_0x6e61('0x2c')]()[_0x6e61('0x2b')](function(){var _0x2f59a9=_0x45c860[_0x6e61('0x2d')]({'plain':!![]});var _0x3a2911=_0x6e61('0x2e');return db['UserProfileResource'][_0x6e61('0x2c')]({'where':{'type':_0x3a2911,'resourceId':_0x2f59a9['id']}})['then'](function(){return _0x45c860;});})[_0x6e61('0x2b')](function(){_0x45f57d[_0x6e61('0x20')](0xcc)[_0x6e61('0x21')]();});}};}function handleEntityNotFound(_0x2de987,_0x46436c){return function(_0x10e96d){if(!_0x10e96d){_0x2de987['sendStatus'](0x194);}return _0x10e96d;};}function handleError(_0x51fb4f,_0x44f422){_0x44f422=_0x44f422||0x1f4;return function(_0x26c5bd){logger[_0x6e61('0x2f')](_0x26c5bd['stack']);if(_0x26c5bd[_0x6e61('0x30')]){delete _0x26c5bd[_0x6e61('0x30')];}_0x51fb4f[_0x6e61('0x20')](_0x44f422)[_0x6e61('0x31')](_0x26c5bd);};}exports[_0x6e61('0x32')]=function(_0x646a22,_0x2f89d7){var _0x40d10b={},_0x32f40d={},_0x4603fd={'count':0x0,'rows':[]};var _0x2bfbbd=_[_0x6e61('0x33')](db[_0x6e61('0x34')][_0x6e61('0x35')],function(_0x126b08){return{'name':_0x126b08[_0x6e61('0x36')],'type':_0x126b08['type'][_0x6e61('0x37')]};});_0x32f40d[_0x6e61('0x38')]=_[_0x6e61('0x33')](_0x2bfbbd,'name');_0x32f40d[_0x6e61('0x39')]=_[_0x6e61('0x3a')](_0x646a22[_0x6e61('0x39')]);_0x32f40d[_0x6e61('0x3b')]=_[_0x6e61('0x3c')](_0x32f40d[_0x6e61('0x38')],_0x32f40d[_0x6e61('0x39')]);_0x40d10b[_0x6e61('0x3d')]=_[_0x6e61('0x3c')](_0x32f40d[_0x6e61('0x38')],qs['fields'](_0x646a22['query'][_0x6e61('0x3e')]));_0x40d10b[_0x6e61('0x3d')]=_0x40d10b[_0x6e61('0x3d')][_0x6e61('0x3f')]?_0x40d10b[_0x6e61('0x3d')]:_0x32f40d[_0x6e61('0x38')];if(!_0x646a22[_0x6e61('0x39')]['hasOwnProperty']('nolimit')){_0x40d10b[_0x6e61('0x24')]=qs['limit'](_0x646a22[_0x6e61('0x39')]['limit']);_0x40d10b[_0x6e61('0x23')]=qs[_0x6e61('0x23')](_0x646a22[_0x6e61('0x39')][_0x6e61('0x23')]);}_0x40d10b[_0x6e61('0x40')]=qs[_0x6e61('0x41')](_0x646a22[_0x6e61('0x39')]['sort']);_0x40d10b[_0x6e61('0x42')]=qs['filters'](_[_0x6e61('0x43')](_0x646a22[_0x6e61('0x39')],_0x32f40d[_0x6e61('0x3b')]),_0x2bfbbd);if(_0x646a22[_0x6e61('0x39')][_0x6e61('0x44')]){_0x40d10b[_0x6e61('0x42')]=_['merge'](_0x40d10b['where'],{'$or':_[_0x6e61('0x33')](_0x2bfbbd,function(_0x31985b){if(_0x31985b['type']!==_0x6e61('0x45')){var _0x19e2ff={};_0x19e2ff[_0x31985b[_0x6e61('0x30')]]={'$like':'%'+_0x646a22['query'][_0x6e61('0x44')]+'%'};return _0x19e2ff;}})});}_0x40d10b=_[_0x6e61('0x46')]({},_0x40d10b,_0x646a22['options']);var _0xf360e={'where':_0x40d10b[_0x6e61('0x42')]};return db[_0x6e61('0x34')][_0x6e61('0x26')](_0xf360e)[_0x6e61('0x2b')](function(_0x49b26d){_0x4603fd['count']=_0x49b26d;if(_0x646a22['query'][_0x6e61('0x47')]){_0x40d10b['include']=[{'all':!![]}];}return db[_0x6e61('0x34')][_0x6e61('0x48')](_0x40d10b);})[_0x6e61('0x2b')](function(_0x42fe67){_0x4603fd[_0x6e61('0x49')]=_0x42fe67;return _0x4603fd;})[_0x6e61('0x2b')](respondWithFilteredResult(_0x2f89d7,_0x40d10b))['catch'](handleError(_0x2f89d7,null));};exports['show']=function(_0x52dd81,_0x389902){var _0x41d2e8={'raw':![],'where':{'id':_0x52dd81[_0x6e61('0x4a')]['id']}},_0x14e836={};_0x14e836[_0x6e61('0x38')]=_[_0x6e61('0x3a')](db['SquareProject']['rawAttributes']);_0x14e836['query']=_[_0x6e61('0x3a')](_0x52dd81['query']);_0x14e836[_0x6e61('0x3b')]=_[_0x6e61('0x3c')](_0x14e836[_0x6e61('0x38')],_0x14e836[_0x6e61('0x39')]);_0x41d2e8[_0x6e61('0x3d')]=_[_0x6e61('0x3c')](_0x14e836[_0x6e61('0x38')],qs['fields'](_0x52dd81[_0x6e61('0x39')][_0x6e61('0x3e')]));_0x41d2e8[_0x6e61('0x3d')]=_0x41d2e8[_0x6e61('0x3d')][_0x6e61('0x3f')]?_0x41d2e8[_0x6e61('0x3d')]:_0x14e836[_0x6e61('0x38')];if(_0x52dd81['query'][_0x6e61('0x47')]){_0x41d2e8[_0x6e61('0x4b')]=[{'all':!![]}];}_0x41d2e8=_[_0x6e61('0x46')]({},_0x41d2e8,_0x52dd81['options']);return db[_0x6e61('0x34')][_0x6e61('0x4c')](_0x41d2e8)[_0x6e61('0x2b')](handleEntityNotFound(_0x389902,null))['then'](respondWithResult(_0x389902,null))[_0x6e61('0x4d')](handleError(_0x389902,null));};exports[_0x6e61('0x4e')]=function(_0x19803,_0x2cfa26){return db[_0x6e61('0x34')][_0x6e61('0x4e')](_0x19803[_0x6e61('0x4f')],{})[_0x6e61('0x2b')](function(_0x3c1424){var _0x4057d0=_0x19803['user'][_0x6e61('0x2d')]({'plain':!![]});if(!_0x4057d0)throw new Error(_0x6e61('0x50'));if(_0x4057d0['role']===_0x6e61('0x51')){var _0x30bee8=_0x3c1424[_0x6e61('0x2d')]({'plain':!![]});var _0x3cedbc=_0x6e61('0x2e');return db[_0x6e61('0x52')][_0x6e61('0x4c')]({'where':{'name':_0x3cedbc,'userProfileId':_0x4057d0[_0x6e61('0x53')]},'raw':!![]})[_0x6e61('0x2b')](function(_0x41bcc2){if(_0x41bcc2&&_0x41bcc2[_0x6e61('0x54')]===0x0){return db[_0x6e61('0x55')][_0x6e61('0x4e')]({'name':_0x30bee8[_0x6e61('0x30')],'resourceId':_0x30bee8['id'],'type':_0x41bcc2['name'],'sectionId':_0x41bcc2['id']},{})[_0x6e61('0x2b')](function(){return _0x3c1424;});}else{return _0x3c1424;}})[_0x6e61('0x4d')](function(_0x4a735e){logger['error'](_0x6e61('0x56'),_0x4a735e);throw _0x4a735e;});}return _0x3c1424;})[_0x6e61('0x2b')](respondWithResult(_0x2cfa26,0xc9))[_0x6e61('0x4d')](handleError(_0x2cfa26,null));};exports[_0x6e61('0x2a')]=function(_0x37e631,_0x33a8af){if(_0x37e631['body']['id']){delete _0x37e631[_0x6e61('0x4f')]['id'];}return db[_0x6e61('0x34')][_0x6e61('0x4c')]({'where':{'id':_0x37e631['params']['id']}})[_0x6e61('0x2b')](handleEntityNotFound(_0x33a8af,null))['then'](saveUpdates(_0x37e631['body'],null))[_0x6e61('0x2b')](respondWithResult(_0x33a8af,null))[_0x6e61('0x4d')](handleError(_0x33a8af,null));};exports['destroy']=function(_0x517b24,_0x3161c5){return db[_0x6e61('0x34')][_0x6e61('0x4c')]({'where':{'id':_0x517b24['params']['id']}})[_0x6e61('0x2b')](handleEntityNotFound(_0x3161c5,null))[_0x6e61('0x2b')](removeEntity(_0x3161c5,null))['catch'](handleError(_0x3161c5,null));};exports[_0x6e61('0x57')]=function(_0x1e6a4b,_0x37bc4e,_0x5be2c6){return db[_0x6e61('0x34')][_0x6e61('0x4c')]({'where':{'id':_0x1e6a4b['params']['id']}})['then'](handleEntityNotFound(_0x37bc4e,null))[_0x6e61('0x2b')](function(_0x2e746d){if(_0x2e746d){return _0x2e746d[_0x6e61('0x57')](_0x1e6a4b[_0x6e61('0x4f')][_0x6e61('0x58')],_['omit'](_0x1e6a4b[_0x6e61('0x4f')],['ids','id'])||{});}})[_0x6e61('0x2b')](respondWithResult(_0x37bc4e,null))['catch'](handleError(_0x37bc4e,null));};exports['removeUsers']=function(_0x150faf,_0x4d06ab,_0x2bea1d){return db['SquareProject']['find']({'where':{'id':_0x150faf[_0x6e61('0x4a')]['id']}})[_0x6e61('0x2b')](handleEntityNotFound(_0x4d06ab,null))['then'](function(_0x58d0d6){if(_0x58d0d6){return _0x58d0d6[_0x6e61('0x59')](_0x150faf['query'][_0x6e61('0x58')])['then'](function(){if(_[_0x6e61('0x5a')](_0x150faf[_0x6e61('0x39')][_0x6e61('0x58')])){for(var _0x4f9a1c=0x0;_0x4f9a1c<_0x150faf[_0x6e61('0x39')][_0x6e61('0x58')][_0x6e61('0x3f')];_0x4f9a1c+=0x1){socket['emit'](_0x6e61('0x5b'),{'UserId':Number(_0x150faf[_0x6e61('0x39')]['ids'][_0x4f9a1c]),'SquareProjectId':Number(_0x150faf[_0x6e61('0x4a')]['id'])});}}else{socket[_0x6e61('0x5c')](_0x6e61('0x5b'),{'UserId':Number(_0x150faf[_0x6e61('0x39')][_0x6e61('0x58')]),'SquareProjectId':Number(_0x150faf[_0x6e61('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x4d06ab,null))['catch'](handleError(_0x4d06ab,null));};exports[_0x6e61('0x5d')]=function(_0x45ac38,_0x382511,_0x41d800){var _0x1dcffc={};var _0x4edf1e={};var _0x1af98a;var _0x4c7d63;return db['SquareProject'][_0x6e61('0x5e')]({'where':{'id':_0x45ac38[_0x6e61('0x4a')]['id']}})[_0x6e61('0x2b')](handleEntityNotFound(_0x382511,null))['then'](function(_0x5e2f39){if(_0x5e2f39){_0x1af98a=_0x5e2f39;_0x4edf1e[_0x6e61('0x38')]=_['keys'](db[_0x6e61('0x5f')][_0x6e61('0x35')]);_0x4edf1e['query']=_[_0x6e61('0x3a')](_0x45ac38['query']);_0x4edf1e[_0x6e61('0x3b')]=_[_0x6e61('0x3c')](_0x4edf1e['model'],_0x4edf1e['query']);_0x1dcffc[_0x6e61('0x3d')]=_[_0x6e61('0x3c')](_0x4edf1e['model'],qs[_0x6e61('0x3e')](_0x45ac38[_0x6e61('0x39')][_0x6e61('0x3e')]));_0x1dcffc[_0x6e61('0x3d')]=_0x1dcffc[_0x6e61('0x3d')][_0x6e61('0x3f')]?_0x1dcffc[_0x6e61('0x3d')]:_0x4edf1e[_0x6e61('0x38')];_0x1dcffc[_0x6e61('0x40')]=qs[_0x6e61('0x41')](_0x45ac38[_0x6e61('0x39')][_0x6e61('0x41')]);_0x1dcffc[_0x6e61('0x42')]=qs['filters'](_['pick'](_0x45ac38[_0x6e61('0x39')],_0x4edf1e[_0x6e61('0x3b')]));if(_0x45ac38[_0x6e61('0x39')]['filter']){_0x1dcffc[_0x6e61('0x42')]=_[_0x6e61('0x46')](_0x1dcffc[_0x6e61('0x42')],{'$or':_[_0x6e61('0x33')](_0x1dcffc[_0x6e61('0x3d')],function(_0x907be8){var _0x36793e={};_0x36793e[_0x907be8]={'$like':'%'+_0x45ac38[_0x6e61('0x39')][_0x6e61('0x44')]+'%'};return _0x36793e;})});}_0x1dcffc=_[_0x6e61('0x46')]({},_0x1dcffc,_0x45ac38[_0x6e61('0x60')]);return _0x1af98a[_0x6e61('0x5d')](_0x1dcffc);}})['then'](function(_0x4eb787){if(_0x4eb787){_0x4c7d63=_0x4eb787[_0x6e61('0x3f')];if(!_0x45ac38[_0x6e61('0x39')][_0x6e61('0x61')](_0x6e61('0x62'))){_0x1dcffc[_0x6e61('0x24')]=qs[_0x6e61('0x24')](_0x45ac38[_0x6e61('0x39')][_0x6e61('0x24')]);_0x1dcffc['offset']=qs[_0x6e61('0x23')](_0x45ac38['query']['offset']);}return _0x1af98a[_0x6e61('0x5d')](_0x1dcffc);}})[_0x6e61('0x2b')](function(_0x326c72){if(_0x326c72){return _0x326c72?{'count':_0x4c7d63,'rows':_0x326c72}:null;}})[_0x6e61('0x2b')](respondWithResult(_0x382511,null))['catch'](handleError(_0x382511,null));}; \ No newline at end of file +var _0x1a0d=['role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/logger','api','../../config/environment','redis','defaults','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','SquareProjects','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x130209,_0x2cc129){var _0x155fb7=function(_0x891a60){while(--_0x891a60){_0x130209['push'](_0x130209['shift']());}};_0x155fb7(++_0x2cc129);}(_0x1a0d,0x127));var _0xd1a0=function(_0x1399f7,_0x38df0e){_0x1399f7=_0x1399f7-0x0;var _0x233d0b=_0x1a0d[_0x1399f7];return _0x233d0b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd1a0('0x0'));var zipdir=require(_0xd1a0('0x1'));var jsonpatch=require(_0xd1a0('0x2'));var rp=require(_0xd1a0('0x3'));var moment=require(_0xd1a0('0x4'));var BPromise=require(_0xd1a0('0x5'));var Mustache=require(_0xd1a0('0x6'));var util=require('util');var path=require(_0xd1a0('0x7'));var sox=require('sox');var csv=require(_0xd1a0('0x8'));var ejs=require(_0xd1a0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd1a0('0xa'));var squel=require(_0xd1a0('0xb'));var crypto=require(_0xd1a0('0xc'));var jsforce=require(_0xd1a0('0xd'));var deskjs=require(_0xd1a0('0xe'));var toCsv=require(_0xd1a0('0x8'));var querystring=require('querystring');var Papa=require(_0xd1a0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd1a0('0x10'))(_0xd1a0('0x11'));var utils=require('../../config/utils');var config=require(_0xd1a0('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd1a0('0x13')]=_[_0xd1a0('0x14')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd1a0('0x13')]));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x1159e8,_0x431469){_0x431469=_0x431469||0xcc;return function(_0x5c83e8){if(_0x5c83e8){return _0x1159e8[_0xd1a0('0x15')](_0x431469);}return _0x1159e8[_0xd1a0('0x16')](_0x431469)[_0xd1a0('0x17')]();};}function respondWithResult(_0xa17f91,_0x15e3a3){_0x15e3a3=_0x15e3a3||0xc8;return function(_0x529835){if(_0x529835){return _0xa17f91[_0xd1a0('0x16')](_0x15e3a3)[_0xd1a0('0x18')](_0x529835);}};}function respondWithFilteredResult(_0x3fb325,_0xa23a9a){return function(_0x5678c7){if(_0x5678c7){var _0x4b4818=typeof _0xa23a9a['offset']==='undefined'&&typeof _0xa23a9a[_0xd1a0('0x19')]===_0xd1a0('0x1a');var _0x2b743d=_0x5678c7[_0xd1a0('0x1b')];var _0x524e2e=_0x4b4818?0x0:_0xa23a9a['offset'];var _0x3c65cd=_0x4b4818?_0x5678c7[_0xd1a0('0x1b')]:_0xa23a9a[_0xd1a0('0x1c')]+_0xa23a9a[_0xd1a0('0x19')];var _0x40834a;if(_0x3c65cd>=_0x2b743d){_0x3c65cd=_0x2b743d;_0x40834a=0xc8;}else{_0x40834a=0xce;}_0x3fb325[_0xd1a0('0x16')](_0x40834a);return _0x3fb325[_0xd1a0('0x1d')](_0xd1a0('0x1e'),_0x524e2e+'-'+_0x3c65cd+'/'+_0x2b743d)[_0xd1a0('0x18')](_0x5678c7);}return null;};}function patchUpdates(_0xcfb271){return function(_0x134fb9){try{jsonpatch[_0xd1a0('0x1f')](_0x134fb9,_0xcfb271,!![]);}catch(_0x31bbd6){return BPromise[_0xd1a0('0x20')](_0x31bbd6);}return _0x134fb9[_0xd1a0('0x21')]();};}function saveUpdates(_0x1c3dbc,_0x2a91e7){return function(_0x5022b4){if(_0x5022b4){return _0x5022b4['update'](_0x1c3dbc)[_0xd1a0('0x22')](function(_0x34cc75){return _0x34cc75;});}return null;};}function removeEntity(_0x416f72,_0x16c4cd){return function(_0x3f3ad6){if(_0x3f3ad6){return _0x3f3ad6[_0xd1a0('0x23')]()['then'](function(){var _0x479095=_0x3f3ad6[_0xd1a0('0x24')]({'plain':!![]});var _0x5f427a=_0xd1a0('0x25');return db['UserProfileResource'][_0xd1a0('0x23')]({'where':{'type':_0x5f427a,'resourceId':_0x479095['id']}})[_0xd1a0('0x22')](function(){return _0x3f3ad6;});})['then'](function(){_0x416f72[_0xd1a0('0x16')](0xcc)[_0xd1a0('0x17')]();});}};}function handleEntityNotFound(_0x32634f,_0xaa5e48){return function(_0x214f67){if(!_0x214f67){_0x32634f[_0xd1a0('0x15')](0x194);}return _0x214f67;};}function handleError(_0x5f3a43,_0x26e796){_0x26e796=_0x26e796||0x1f4;return function(_0x4bed71){logger[_0xd1a0('0x26')](_0x4bed71[_0xd1a0('0x27')]);if(_0x4bed71[_0xd1a0('0x28')]){delete _0x4bed71[_0xd1a0('0x28')];}_0x5f3a43[_0xd1a0('0x16')](_0x26e796)[_0xd1a0('0x29')](_0x4bed71);};}exports[_0xd1a0('0x2a')]=function(_0x2855f6,_0x35c528){var _0x524454={},_0x5e6aed={},_0x2fdae4={'count':0x0,'rows':[]};var _0x1e5d02=_['map'](db[_0xd1a0('0x2b')][_0xd1a0('0x2c')],function(_0x106ced){return{'name':_0x106ced[_0xd1a0('0x2d')],'type':_0x106ced[_0xd1a0('0x2e')]['key']};});_0x5e6aed[_0xd1a0('0x2f')]=_[_0xd1a0('0x30')](_0x1e5d02,_0xd1a0('0x28'));_0x5e6aed['query']=_[_0xd1a0('0x31')](_0x2855f6[_0xd1a0('0x32')]);_0x5e6aed[_0xd1a0('0x33')]=_[_0xd1a0('0x34')](_0x5e6aed[_0xd1a0('0x2f')],_0x5e6aed[_0xd1a0('0x32')]);_0x524454[_0xd1a0('0x35')]=_['intersection'](_0x5e6aed[_0xd1a0('0x2f')],qs['fields'](_0x2855f6['query'][_0xd1a0('0x36')]));_0x524454[_0xd1a0('0x35')]=_0x524454[_0xd1a0('0x35')][_0xd1a0('0x37')]?_0x524454[_0xd1a0('0x35')]:_0x5e6aed['model'];if(!_0x2855f6[_0xd1a0('0x32')][_0xd1a0('0x38')](_0xd1a0('0x39'))){_0x524454[_0xd1a0('0x19')]=qs[_0xd1a0('0x19')](_0x2855f6[_0xd1a0('0x32')][_0xd1a0('0x19')]);_0x524454['offset']=qs[_0xd1a0('0x1c')](_0x2855f6[_0xd1a0('0x32')]['offset']);}_0x524454[_0xd1a0('0x3a')]=qs[_0xd1a0('0x3b')](_0x2855f6[_0xd1a0('0x32')]['sort']);_0x524454[_0xd1a0('0x3c')]=qs[_0xd1a0('0x33')](_[_0xd1a0('0x3d')](_0x2855f6[_0xd1a0('0x32')],_0x5e6aed[_0xd1a0('0x33')]),_0x1e5d02);if(_0x2855f6[_0xd1a0('0x32')][_0xd1a0('0x3e')]){_0x524454[_0xd1a0('0x3c')]=_[_0xd1a0('0x3f')](_0x524454['where'],{'$or':_[_0xd1a0('0x30')](_0x1e5d02,function(_0x5b3952){if(_0x5b3952['type']!==_0xd1a0('0x40')){var _0x3254ce={};_0x3254ce[_0x5b3952['name']]={'$like':'%'+_0x2855f6['query'][_0xd1a0('0x3e')]+'%'};return _0x3254ce;}})});}_0x524454=_[_0xd1a0('0x3f')]({},_0x524454,_0x2855f6[_0xd1a0('0x41')]);var _0x331d5d={'where':_0x524454['where']};return db[_0xd1a0('0x2b')]['count'](_0x331d5d)[_0xd1a0('0x22')](function(_0x418bd5){_0x2fdae4['count']=_0x418bd5;if(_0x2855f6[_0xd1a0('0x32')][_0xd1a0('0x42')]){_0x524454[_0xd1a0('0x43')]=[{'all':!![]}];}return db['SquareProject'][_0xd1a0('0x44')](_0x524454);})[_0xd1a0('0x22')](function(_0x7d1106){_0x2fdae4[_0xd1a0('0x45')]=_0x7d1106;return _0x2fdae4;})[_0xd1a0('0x22')](respondWithFilteredResult(_0x35c528,_0x524454))[_0xd1a0('0x46')](handleError(_0x35c528,null));};exports[_0xd1a0('0x47')]=function(_0x54059c,_0x36b1ce){var _0xd48f51={'raw':![],'where':{'id':_0x54059c[_0xd1a0('0x48')]['id']}},_0x2305ca={};_0x2305ca['model']=_['keys'](db[_0xd1a0('0x2b')][_0xd1a0('0x2c')]);_0x2305ca[_0xd1a0('0x32')]=_[_0xd1a0('0x31')](_0x54059c['query']);_0x2305ca[_0xd1a0('0x33')]=_[_0xd1a0('0x34')](_0x2305ca['model'],_0x2305ca[_0xd1a0('0x32')]);_0xd48f51[_0xd1a0('0x35')]=_[_0xd1a0('0x34')](_0x2305ca['model'],qs[_0xd1a0('0x36')](_0x54059c[_0xd1a0('0x32')][_0xd1a0('0x36')]));_0xd48f51[_0xd1a0('0x35')]=_0xd48f51[_0xd1a0('0x35')]['length']?_0xd48f51[_0xd1a0('0x35')]:_0x2305ca[_0xd1a0('0x2f')];if(_0x54059c[_0xd1a0('0x32')][_0xd1a0('0x42')]){_0xd48f51['include']=[{'all':!![]}];}_0xd48f51=_[_0xd1a0('0x3f')]({},_0xd48f51,_0x54059c['options']);return db[_0xd1a0('0x2b')][_0xd1a0('0x49')](_0xd48f51)['then'](handleEntityNotFound(_0x36b1ce,null))[_0xd1a0('0x22')](respondWithResult(_0x36b1ce,null))[_0xd1a0('0x46')](handleError(_0x36b1ce,null));};exports[_0xd1a0('0x4a')]=function(_0x24f05a,_0xa49a94){return db['SquareProject'][_0xd1a0('0x4a')](_0x24f05a[_0xd1a0('0x4b')],{})['then'](function(_0x591f08){var _0xe35280=_0x24f05a['user']['get']({'plain':!![]});if(!_0xe35280)throw new Error(_0xd1a0('0x4c'));if(_0xe35280[_0xd1a0('0x4d')]===_0xd1a0('0x4e')){var _0x22dba0=_0x591f08[_0xd1a0('0x24')]({'plain':!![]});var _0x17e013=_0xd1a0('0x25');return db['UserProfileSection'][_0xd1a0('0x49')]({'where':{'name':_0x17e013,'userProfileId':_0xe35280[_0xd1a0('0x4f')]},'raw':!![]})[_0xd1a0('0x22')](function(_0x3d9468){if(_0x3d9468&&_0x3d9468[_0xd1a0('0x50')]===0x0){return db[_0xd1a0('0x51')][_0xd1a0('0x4a')]({'name':_0x22dba0[_0xd1a0('0x28')],'resourceId':_0x22dba0['id'],'type':_0x3d9468[_0xd1a0('0x28')],'sectionId':_0x3d9468['id']},{})[_0xd1a0('0x22')](function(){return _0x591f08;});}else{return _0x591f08;}})['catch'](function(_0x49618f){logger['error'](_0xd1a0('0x52'),_0x49618f);throw _0x49618f;});}return _0x591f08;})[_0xd1a0('0x22')](respondWithResult(_0xa49a94,0xc9))[_0xd1a0('0x46')](handleError(_0xa49a94,null));};exports[_0xd1a0('0x53')]=function(_0x337473,_0x5331e4){if(_0x337473[_0xd1a0('0x4b')]['id']){delete _0x337473[_0xd1a0('0x4b')]['id'];}return db[_0xd1a0('0x2b')][_0xd1a0('0x49')]({'where':{'id':_0x337473[_0xd1a0('0x48')]['id']}})[_0xd1a0('0x22')](handleEntityNotFound(_0x5331e4,null))['then'](saveUpdates(_0x337473[_0xd1a0('0x4b')],null))['then'](respondWithResult(_0x5331e4,null))[_0xd1a0('0x46')](handleError(_0x5331e4,null));};exports[_0xd1a0('0x23')]=function(_0x45943e,_0x41adcb){return db[_0xd1a0('0x2b')][_0xd1a0('0x49')]({'where':{'id':_0x45943e[_0xd1a0('0x48')]['id']}})[_0xd1a0('0x22')](handleEntityNotFound(_0x41adcb,null))[_0xd1a0('0x22')](removeEntity(_0x41adcb,null))[_0xd1a0('0x46')](handleError(_0x41adcb,null));};exports[_0xd1a0('0x54')]=function(_0x4de13e,_0x407976,_0x3ac8e6){return db['SquareProject'][_0xd1a0('0x49')]({'where':{'id':_0x4de13e['params']['id']}})['then'](handleEntityNotFound(_0x407976,null))[_0xd1a0('0x22')](function(_0x3c9dbe){if(_0x3c9dbe){return _0x3c9dbe['addUsers'](_0x4de13e[_0xd1a0('0x4b')]['ids'],_[_0xd1a0('0x55')](_0x4de13e['body'],[_0xd1a0('0x56'),'id'])||{});}})[_0xd1a0('0x22')](respondWithResult(_0x407976,null))[_0xd1a0('0x46')](handleError(_0x407976,null));};exports[_0xd1a0('0x57')]=function(_0x1106f5,_0x28518d,_0x51afa4){return db[_0xd1a0('0x2b')]['find']({'where':{'id':_0x1106f5[_0xd1a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x28518d,null))[_0xd1a0('0x22')](function(_0x13ff76){if(_0x13ff76){return _0x13ff76[_0xd1a0('0x57')](_0x1106f5[_0xd1a0('0x32')][_0xd1a0('0x56')])[_0xd1a0('0x22')](function(){if(_[_0xd1a0('0x58')](_0x1106f5['query'][_0xd1a0('0x56')])){for(var _0x3bc825=0x0;_0x3bc825<_0x1106f5[_0xd1a0('0x32')][_0xd1a0('0x56')][_0xd1a0('0x37')];_0x3bc825+=0x1){socket[_0xd1a0('0x59')](_0xd1a0('0x5a'),{'UserId':Number(_0x1106f5['query'][_0xd1a0('0x56')][_0x3bc825]),'SquareProjectId':Number(_0x1106f5[_0xd1a0('0x48')]['id'])});}}else{socket[_0xd1a0('0x59')](_0xd1a0('0x5a'),{'UserId':Number(_0x1106f5[_0xd1a0('0x32')][_0xd1a0('0x56')]),'SquareProjectId':Number(_0x1106f5[_0xd1a0('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x28518d,null))['catch'](handleError(_0x28518d,null));};exports[_0xd1a0('0x5b')]=function(_0x3de7b9,_0x2ce48b,_0x15f724){var _0x2e7cae={};var _0x5e81cd={};var _0x357c5d;var _0x2355cb;return db[_0xd1a0('0x2b')]['findOne']({'where':{'id':_0x3de7b9[_0xd1a0('0x48')]['id']}})[_0xd1a0('0x22')](handleEntityNotFound(_0x2ce48b,null))[_0xd1a0('0x22')](function(_0x1203a6){if(_0x1203a6){_0x357c5d=_0x1203a6;_0x5e81cd[_0xd1a0('0x2f')]=_['keys'](db[_0xd1a0('0x5c')][_0xd1a0('0x2c')]);_0x5e81cd['query']=_[_0xd1a0('0x31')](_0x3de7b9[_0xd1a0('0x32')]);_0x5e81cd['filters']=_['intersection'](_0x5e81cd[_0xd1a0('0x2f')],_0x5e81cd[_0xd1a0('0x32')]);_0x2e7cae['attributes']=_[_0xd1a0('0x34')](_0x5e81cd[_0xd1a0('0x2f')],qs['fields'](_0x3de7b9[_0xd1a0('0x32')][_0xd1a0('0x36')]));_0x2e7cae[_0xd1a0('0x35')]=_0x2e7cae[_0xd1a0('0x35')][_0xd1a0('0x37')]?_0x2e7cae[_0xd1a0('0x35')]:_0x5e81cd[_0xd1a0('0x2f')];_0x2e7cae[_0xd1a0('0x3a')]=qs[_0xd1a0('0x3b')](_0x3de7b9[_0xd1a0('0x32')][_0xd1a0('0x3b')]);_0x2e7cae['where']=qs[_0xd1a0('0x33')](_['pick'](_0x3de7b9['query'],_0x5e81cd[_0xd1a0('0x33')]));if(_0x3de7b9[_0xd1a0('0x32')][_0xd1a0('0x3e')]){_0x2e7cae[_0xd1a0('0x3c')]=_[_0xd1a0('0x3f')](_0x2e7cae['where'],{'$or':_['map'](_0x2e7cae[_0xd1a0('0x35')],function(_0x15936b){var _0x28b84c={};_0x28b84c[_0x15936b]={'$like':'%'+_0x3de7b9['query'][_0xd1a0('0x3e')]+'%'};return _0x28b84c;})});}_0x2e7cae=_[_0xd1a0('0x3f')]({},_0x2e7cae,_0x3de7b9['options']);return _0x357c5d['getUsers'](_0x2e7cae);}})['then'](function(_0x37c2df){if(_0x37c2df){_0x2355cb=_0x37c2df[_0xd1a0('0x37')];if(!_0x3de7b9[_0xd1a0('0x32')][_0xd1a0('0x38')](_0xd1a0('0x39'))){_0x2e7cae[_0xd1a0('0x19')]=qs[_0xd1a0('0x19')](_0x3de7b9[_0xd1a0('0x32')][_0xd1a0('0x19')]);_0x2e7cae[_0xd1a0('0x1c')]=qs[_0xd1a0('0x1c')](_0x3de7b9['query'][_0xd1a0('0x1c')]);}return _0x357c5d[_0xd1a0('0x5b')](_0x2e7cae);}})[_0xd1a0('0x22')](function(_0x28a4da){if(_0x28a4da){return _0x28a4da?{'count':_0x2355cb,'rows':_0x28a4da}:null;}})['then'](respondWithResult(_0x2ce48b,null))['catch'](handleError(_0x2ce48b,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index e3a7269..3a6d92f 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 _0x2ace=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x32b8a9,_0x59d62b){var _0x40105c=function(_0x54c048){while(--_0x54c048){_0x32b8a9['push'](_0x32b8a9['shift']());}};_0x40105c(++_0x59d62b);}(_0x2ace,0x1ec));var _0xe2ac=function(_0x22f5ea,_0x3a6a30){_0x22f5ea=_0x22f5ea-0x0;var _0xe5955=_0x2ace[_0x22f5ea];return _0xe5955;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xe2ac('0x0'))['db'][_0xe2ac('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xe2ac('0x2')](0x0);var events={'afterCreate':_0xe2ac('0x3'),'afterUpdate':_0xe2ac('0x4'),'afterDestroy':_0xe2ac('0x5')};function emitEvent(_0x395503){return function(_0x29c68d,_0x2c8878,_0x55715c){SquareProjectEvents[_0xe2ac('0x6')](_0x395503+':'+_0x29c68d['id'],_0x29c68d);SquareProjectEvents['emit'](_0x395503,_0x29c68d);_0x55715c(null);};}for(var e in events){if(events[_0xe2ac('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xe2ac('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x9740=['exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x4aff03,_0x52b496){var _0x211c3d=function(_0x1ccc3d){while(--_0x1ccc3d){_0x4aff03['push'](_0x4aff03['shift']());}};_0x211c3d(++_0x52b496);}(_0x9740,0x79));var _0x0974=function(_0x362f5e,_0xff295c){_0x362f5e=_0x362f5e-0x0;var _0x56eca3=_0x9740[_0x362f5e];return _0x56eca3;};'use strict';var EventEmitter=require(_0x0974('0x0'));var SquareProject=require(_0x0974('0x1'))['db'][_0x0974('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x0974('0x3')](0x0);var events={'afterCreate':_0x0974('0x4'),'afterUpdate':_0x0974('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5ccd23){return function(_0x17d4d1,_0x5e1631,_0x8100a4){SquareProjectEvents[_0x0974('0x6')](_0x5ccd23+':'+_0x17d4d1['id'],_0x17d4d1);SquareProjectEvents[_0x0974('0x6')](_0x5ccd23,_0x17d4d1);_0x8100a4(null);};}for(var e in events){if(events[_0x0974('0x7')](e)){var event=events[e];SquareProject[_0x0974('0x8')](e,emitEvent(event));}}module[_0x0974('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 862c533..61abebc 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 _0x5c67=['rimraf','exports','define','SquareProject','square_projects','changed','preproduction','format','production','publishedAt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5c67,0xfa));var _0x75c6=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x5c67[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x75c6('0x0'));var util=require(_0x75c6('0x1'));var logger=require(_0x75c6('0x2'))(_0x75c6('0x3'));var moment=require(_0x75c6('0x4'));var BPromise=require(_0x75c6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x75c6('0x6'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0x75c6('0x7')]=function(_0x13279a,_0x4e77d8){return _0x13279a[_0x75c6('0x8')](_0x75c6('0x9'),attributes,{'tableName':_0x75c6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d604c,_0x51d012,_0x4da744){if(_0x3d604c[_0x75c6('0xb')](_0x75c6('0xc'))){_0x3d604c['savedAt']=moment()[_0x75c6('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3d604c['changed'](_0x75c6('0xe'))){_0x3d604c[_0x75c6('0xf')]=moment()[_0x75c6('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4da744(null,_0x3d604c);}}});}; \ No newline at end of file +var _0xa33f=['publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','production'];(function(_0x3eca5a,_0x20d490){var _0x15470e=function(_0x219cc6){while(--_0x219cc6){_0x3eca5a['push'](_0x3eca5a['shift']());}};_0x15470e(++_0x20d490);}(_0xa33f,0xdb));var _0xfa33=function(_0x2a6ca8,_0x1d9d8a){_0x2a6ca8=_0x2a6ca8-0x0;var _0x335ed5=_0xa33f[_0x2a6ca8];return _0x335ed5;};'use strict';var _=require(_0xfa33('0x0'));var util=require(_0xfa33('0x1'));var logger=require(_0xfa33('0x2'))('api');var moment=require(_0xfa33('0x3'));var BPromise=require(_0xfa33('0x4'));var rp=require(_0xfa33('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa33('0x6'));var config=require('../../config/environment');var attributes=require(_0xfa33('0x7'));module['exports']=function(_0x11e878,_0x46df79){return _0x11e878[_0xfa33('0x8')](_0xfa33('0x9'),attributes,{'tableName':_0xfa33('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7e689b,_0x3ce442,_0x5a6547){if(_0x7e689b[_0xfa33('0xb')](_0xfa33('0xc'))){_0x7e689b[_0xfa33('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x7e689b[_0xfa33('0xb')](_0xfa33('0xe'))){_0x7e689b[_0xfa33('0xf')]=moment()[_0xfa33('0x10')](_0xfa33('0x11'));}_0x5a6547(null,_0x7e689b);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 0b1bebb..ae2ce01 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 _0x1409=['message','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','then','stringify','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','info','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1409,0x177));var _0x9140=function(_0x1ebc14,_0x27b39b){_0x1ebc14=_0x1ebc14-0x0;var _0x487fc5=_0x1409[_0x1ebc14];return _0x487fc5;};'use strict';var _=require('lodash');var util=require(_0x9140('0x0'));var moment=require(_0x9140('0x1'));var BPromise=require('bluebird');var rs=require(_0x9140('0x2'));var fs=require('fs');var Redis=require(_0x9140('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9140('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9140('0x5'));var jayson=require(_0x9140('0x6'));var client=jayson[_0x9140('0x7')]['http']({'port':0x232a});config[_0x9140('0x8')]=_[_0x9140('0x9')](config[_0x9140('0x8')],{'host':_0x9140('0xa'),'port':0x18eb});var socket=require(_0x9140('0xb'))(new Redis(config[_0x9140('0x8')]));require(_0x9140('0xc'))[_0x9140('0xd')](socket);function respondWithRpcPromise(_0x4c0c40,_0x267e36,_0x286766){return new BPromise(function(_0x59dd4e,_0x16b422){return client['request'](_0x4c0c40,_0x286766)['then'](function(_0x10dbc1){logger[_0x9140('0xe')](_0x9140('0xf'),_0x267e36,'request\x20sent');logger[_0x9140('0x10')](_0x9140('0x11'),_0x267e36,_0x9140('0x12'),JSON['stringify'](_0x10dbc1));if(_0x10dbc1[_0x9140('0x13')]){if(_0x10dbc1[_0x9140('0x13')][_0x9140('0x14')]===0x1f4){logger[_0x9140('0x13')](_0x9140('0xf'),_0x267e36,_0x10dbc1['error'][_0x9140('0x15')]);return _0x16b422(_0x10dbc1[_0x9140('0x13')]['message']);}logger[_0x9140('0x13')](_0x9140('0xf'),_0x267e36,_0x10dbc1['error'][_0x9140('0x15')]);return _0x59dd4e(_0x10dbc1[_0x9140('0x13')]['message']);}else{logger[_0x9140('0xe')](_0x9140('0xf'),_0x267e36,'request\x20sent');_0x59dd4e(_0x10dbc1[_0x9140('0x16')]['message']);}})[_0x9140('0x17')](function(_0xf2cb42){logger[_0x9140('0x13')](_0x9140('0xf'),_0x267e36,_0xf2cb42);_0x16b422(_0xf2cb42);});});}exports[_0x9140('0x18')]=function(_0x2821b2){var _0x2f2aa5=this;return new Promise(function(_0x5bbba5,_0x5b25e9){return db[_0x9140('0x19')][_0x9140('0x1a')]({'raw':_0x2821b2[_0x9140('0x1b')]?_0x2821b2[_0x9140('0x1b')][_0x9140('0x1c')]===undefined?!![]:![]:!![],'where':_0x2821b2[_0x9140('0x1b')]?_0x2821b2['options'][_0x9140('0x1d')]||null:null,'attributes':_0x2821b2[_0x9140('0x1b')]?_0x2821b2['options'][_0x9140('0x1e')]||null:null,'include':_0x2821b2[_0x9140('0x1b')]?_0x2821b2[_0x9140('0x1b')][_0x9140('0x1f')]?_[_0x9140('0x20')](_0x2821b2[_0x9140('0x1b')][_0x9140('0x1f')],function(_0x12200b){return{'model':db[_0x12200b['model']],'as':_0x12200b['as'],'attributes':_0x12200b[_0x9140('0x1e')],'include':_0x12200b[_0x9140('0x1f')]?_[_0x9140('0x20')](_0x12200b['include'],function(_0x5e22e2){return{'model':db[_0x5e22e2[_0x9140('0x21')]],'as':_0x5e22e2['as'],'attributes':_0x5e22e2[_0x9140('0x1e')],'include':_0x5e22e2['include']?_['map'](_0x5e22e2['include'],function(_0x49f720){return{'model':db[_0x49f720['model']],'as':_0x49f720['as'],'attributes':_0x49f720[_0x9140('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9140('0x22')](function(_0x12ab63){logger[_0x9140('0xe')]('ShowSquareProject',_0x2821b2);logger[_0x9140('0x10')]('ShowSquareProject',_0x2821b2,JSON[_0x9140('0x23')](_0x12ab63));_0x5bbba5(_0x12ab63);})[_0x9140('0x17')](function(_0x2aceac){logger[_0x9140('0x13')]('ShowSquareProject',_0x2aceac[_0x9140('0x15')],_0x2821b2);_0x5b25e9(_0x2f2aa5['error'](0x1f4,_0x2aceac[_0x9140('0x15')]));});});}; \ No newline at end of file +var _0x4862=['ShowSquareProject','SquareProject','options','raw','where','attributes','include','map','model','info','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x3edf05,_0x57907c){var _0x435bee=function(_0x16c688){while(--_0x16c688){_0x3edf05['push'](_0x3edf05['shift']());}};_0x435bee(++_0x57907c);}(_0x4862,0x1a1));var _0x2486=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0x4862[_0x38c699];return _0x3b1ded;};'use strict';var _=require(_0x2486('0x0'));var util=require(_0x2486('0x1'));var moment=require(_0x2486('0x2'));var BPromise=require(_0x2486('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2486('0x4'));var db=require(_0x2486('0x5'))['db'];var utils=require(_0x2486('0x6'));var logger=require(_0x2486('0x7'))(_0x2486('0x8'));var config=require(_0x2486('0x9'));var jayson=require(_0x2486('0xa'));var client=jayson[_0x2486('0xb')][_0x2486('0xc')]({'port':0x232a});config[_0x2486('0xd')]=_[_0x2486('0xe')](config[_0x2486('0xd')],{'host':_0x2486('0xf'),'port':0x18eb});var socket=require(_0x2486('0x10'))(new Redis(config['redis']));require(_0x2486('0x11'))['register'](socket);function respondWithRpcPromise(_0x3693de,_0xb5d853,_0x568698){return new BPromise(function(_0x1e215f,_0x46f739){return client['request'](_0x3693de,_0x568698)['then'](function(_0x23ef68){logger['info'](_0x2486('0x12'),_0xb5d853,_0x2486('0x13'));logger[_0x2486('0x14')](_0x2486('0x15'),_0xb5d853,_0x2486('0x13'),JSON[_0x2486('0x16')](_0x23ef68));if(_0x23ef68['error']){if(_0x23ef68[_0x2486('0x17')]['code']===0x1f4){logger[_0x2486('0x17')](_0x2486('0x12'),_0xb5d853,_0x23ef68[_0x2486('0x17')]['message']);return _0x46f739(_0x23ef68[_0x2486('0x17')][_0x2486('0x18')]);}logger['error']('SquareProject,\x20%s,\x20%s',_0xb5d853,_0x23ef68[_0x2486('0x17')][_0x2486('0x18')]);return _0x1e215f(_0x23ef68[_0x2486('0x17')]['message']);}else{logger['info'](_0x2486('0x12'),_0xb5d853,'request\x20sent');_0x1e215f(_0x23ef68[_0x2486('0x19')][_0x2486('0x18')]);}})[_0x2486('0x1a')](function(_0x380419){logger['error']('SquareProject,\x20%s,\x20%s',_0xb5d853,_0x380419);_0x46f739(_0x380419);});});}exports[_0x2486('0x1b')]=function(_0x11b69c){var _0x40eb1c=this;return new Promise(function(_0x39f1d9,_0x4688fb){return db[_0x2486('0x1c')]['find']({'raw':_0x11b69c[_0x2486('0x1d')]?_0x11b69c[_0x2486('0x1d')][_0x2486('0x1e')]===undefined?!![]:![]:!![],'where':_0x11b69c[_0x2486('0x1d')]?_0x11b69c[_0x2486('0x1d')][_0x2486('0x1f')]||null:null,'attributes':_0x11b69c[_0x2486('0x1d')]?_0x11b69c[_0x2486('0x1d')][_0x2486('0x20')]||null:null,'include':_0x11b69c['options']?_0x11b69c['options'][_0x2486('0x21')]?_[_0x2486('0x22')](_0x11b69c[_0x2486('0x1d')][_0x2486('0x21')],function(_0x4713c5){return{'model':db[_0x4713c5['model']],'as':_0x4713c5['as'],'attributes':_0x4713c5['attributes'],'include':_0x4713c5[_0x2486('0x21')]?_['map'](_0x4713c5[_0x2486('0x21')],function(_0x3b9679){return{'model':db[_0x3b9679[_0x2486('0x23')]],'as':_0x3b9679['as'],'attributes':_0x3b9679['attributes'],'include':_0x3b9679[_0x2486('0x21')]?_['map'](_0x3b9679['include'],function(_0xc427f1){return{'model':db[_0xc427f1[_0x2486('0x23')]],'as':_0xc427f1['as'],'attributes':_0xc427f1[_0x2486('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a7cb8){logger[_0x2486('0x24')](_0x2486('0x1b'),_0x11b69c);logger[_0x2486('0x14')](_0x2486('0x1b'),_0x11b69c,JSON[_0x2486('0x16')](_0x3a7cb8));_0x39f1d9(_0x3a7cb8);})[_0x2486('0x1a')](function(_0x25f073){logger[_0x2486('0x17')]('ShowSquareProject',_0x25f073['message'],_0x11b69c);_0x4688fb(_0x40eb1c['error'](0x1f4,_0x25f073[_0x2486('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 638b662..4bbab57 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 _0x8f76=['register','length','squareProject:','./squareProject.events','save','remove','emit','removeListener'];(function(_0x2e6dee,_0x1a61b0){var _0x47706=function(_0x365546){while(--_0x365546){_0x2e6dee['push'](_0x2e6dee['shift']());}};_0x47706(++_0x1a61b0);}(_0x8f76,0x12b));var _0x68f7=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x8f76[_0x24237f];return _0x48298e;};'use strict';var SquareProjectEvents=require(_0x68f7('0x0'));var events=[_0x68f7('0x1'),_0x68f7('0x2'),'update'];function createListener(_0x571914,_0x3ca007){return function(_0x2f0c23){_0x3ca007[_0x68f7('0x3')](_0x571914,_0x2f0c23);};}function removeListener(_0x6fa541,_0x15d8de){return function(){SquareProjectEvents[_0x68f7('0x4')](_0x6fa541,_0x15d8de);};}exports[_0x68f7('0x5')]=function(_0x581380){for(var _0x2f469e=0x0,_0x10a3ff=events[_0x68f7('0x6')];_0x2f469e<_0x10a3ff;_0x2f469e++){var _0x27f8c3=events[_0x2f469e];var _0x287ef4=createListener(_0x68f7('0x7')+_0x27f8c3,_0x581380);SquareProjectEvents['on'](_0x27f8c3,_0x287ef4);}}; \ No newline at end of file +var _0x1ed5=['squareProject:','remove','update','removeListener','register','length'];(function(_0x6c907c,_0x16a736){var _0x5d8346=function(_0x2cf469){while(--_0x2cf469){_0x6c907c['push'](_0x6c907c['shift']());}};_0x5d8346(++_0x16a736);}(_0x1ed5,0x1d5));var _0x51ed=function(_0x122cc1,_0x5c956e){_0x122cc1=_0x122cc1-0x0;var _0x1e33af=_0x1ed5[_0x122cc1];return _0x1e33af;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0x51ed('0x0'),_0x51ed('0x1')];function createListener(_0x552587,_0x15cc20){return function(_0x37b342){_0x15cc20['emit'](_0x552587,_0x37b342);};}function removeListener(_0xe5671d,_0x5a993a){return function(){SquareProjectEvents[_0x51ed('0x2')](_0xe5671d,_0x5a993a);};}exports[_0x51ed('0x3')]=function(_0x51ed15){for(var _0xf98017=0x0,_0x4369d7=events[_0x51ed('0x4')];_0xf98017<_0x4369d7;_0xf98017++){var _0x25ee2b=events[_0xf98017];var _0x404924=createListener(_0x51ed('0x5')+_0x25ee2b,_0x51ed15);SquareProjectEvents['on'](_0x25ee2b,_0x404924);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 9f5675f..9138f57 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 _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x4b3374,_0x5513b9){var _0x513512=function(_0x56ce2a){while(--_0x56ce2a){_0x4b3374['push'](_0x4b3374['shift']());}};_0x513512(++_0x5513b9);}(_0xabce,0x103));var _0xeabc=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xabce[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file +var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x4549e1,_0x33f484){var _0x3cd8a1=function(_0x5624b4){while(--_0x5624b4){_0x4549e1['push'](_0x4549e1['shift']());}};_0x3cd8a1(++_0x33f484);}(_0x814b,0x1a2));var _0xb814=function(_0x43e885,_0x5700f1){_0x43e885=_0x43e885-0x0;var _0x18df65=_0x814b[_0x43e885];return _0x18df65;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 3846923..33b29d5 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(_0x5abdaa,_0x3f6517){var _0x3e7f09=function(_0x1124ff){while(--_0x1124ff){_0x5abdaa['push'](_0x5abdaa['shift']());}};_0x3e7f09(++_0x3f6517);}(_0xb458,0x103));var _0x8b45=function(_0x1663c8,_0x31aaeb){_0x1663c8=_0x1663c8-0x0;var _0x1a10d6=_0xb458[_0x1663c8];return _0x1a10d6;};'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 _0xf2ca=['getDataValue','substring','sequelize','exports','STRING','VIRTUAL'];(function(_0x135615,_0x943251){var _0x54a0e9=function(_0x503594){while(--_0x503594){_0x135615['push'](_0x135615['shift']());}};_0x54a0e9(++_0x943251);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x4bcfa6,_0x1c7e43){_0x4bcfa6=_0x4bcfa6-0x0;var _0x1c0165=_0xf2ca[_0x4bcfa6];return _0x1c0165;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'uniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xaf2c('0x2')]},'context':{'type':Sequelize[_0xaf2c('0x2')]},'extension':{'type':Sequelize[_0xaf2c('0x2')]},'priority':{'type':Sequelize[_0xaf2c('0x2')]},'accountcode':{'type':Sequelize[_0xaf2c('0x2')]},'dnid':{'type':Sequelize[_0xaf2c('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xaf2c('0x2')]},'filename':{'type':Sequelize[_0xaf2c('0x2')]},'savePath':{'type':Sequelize[_0xaf2c('0x2')]},'format':{'type':Sequelize[_0xaf2c('0x3')],'get':function(){var _0x58351f='';var _0x37fedd=this[_0xaf2c('0x4')]('savePath');if(_0x37fedd){_0x58351f=_0x37fedd[_0xaf2c('0x5')](_0x37fedd['lastIndexOf']('.'));}return _0x58351f;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index d8951c4..ae05184 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 _0xdab7=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll','include','findAll','rawAttributes','find','catch','create','body','params','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','unlink','SquareRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir'];(function(_0x54a212,_0x548a3b){var _0x466fb5=function(_0x5b3d3e){while(--_0x5b3d3e){_0x54a212['push'](_0x54a212['shift']());}};_0x466fb5(++_0x548a3b);}(_0xdab7,0x129));var _0x7dab=function(_0xa7a66c,_0x41046c){_0xa7a66c=_0xa7a66c-0x0;var _0x553382=_0xdab7[_0xa7a66c];return _0x553382;};'use strict';var emlformat=require(_0x7dab('0x0'));var rimraf=require(_0x7dab('0x1'));var zipdir=require(_0x7dab('0x2'));var jsonpatch=require(_0x7dab('0x3'));var rp=require(_0x7dab('0x4'));var moment=require(_0x7dab('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7dab('0x6'));var util=require(_0x7dab('0x7'));var path=require(_0x7dab('0x8'));var sox=require(_0x7dab('0x9'));var csv=require(_0x7dab('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7dab('0xb'));var _=require(_0x7dab('0xc'));var squel=require(_0x7dab('0xd'));var crypto=require('crypto');var jsforce=require(_0x7dab('0xe'));var deskjs=require(_0x7dab('0xf'));var toCsv=require(_0x7dab('0xa'));var querystring=require(_0x7dab('0x10'));var Papa=require(_0x7dab('0x11'));var Redis=require('ioredis');var authService=require(_0x7dab('0x12'));var qs=require(_0x7dab('0x13'));var as=require(_0x7dab('0x14'));var hardwareService=require(_0x7dab('0x15'));var logger=require(_0x7dab('0x16'))(_0x7dab('0x17'));var utils=require(_0x7dab('0x18'));var config=require(_0x7dab('0x19'));var licenseUtil=require(_0x7dab('0x1a'));var db=require(_0x7dab('0x1b'))['db'];function respondWithStatusCode(_0x420436,_0x59cffd){_0x59cffd=_0x59cffd||0xcc;return function(_0x17e8b7){if(_0x17e8b7){return _0x420436[_0x7dab('0x1c')](_0x59cffd);}return _0x420436['status'](_0x59cffd)[_0x7dab('0x1d')]();};}function respondWithResult(_0x2eefb7,_0x4090da){_0x4090da=_0x4090da||0xc8;return function(_0x409276){if(_0x409276){return _0x2eefb7[_0x7dab('0x1e')](_0x4090da)[_0x7dab('0x1f')](_0x409276);}};}function respondWithFilteredResult(_0x389e7f,_0x14210b){return function(_0x63f1a1){if(_0x63f1a1){var _0x5149c7=typeof _0x14210b[_0x7dab('0x20')]===_0x7dab('0x21')&&typeof _0x14210b[_0x7dab('0x22')]==='undefined';var _0x1ccd64=_0x63f1a1[_0x7dab('0x23')];var _0x19244f=_0x5149c7?0x0:_0x14210b['offset'];var _0x4c7cab=_0x5149c7?_0x63f1a1[_0x7dab('0x23')]:_0x14210b['offset']+_0x14210b[_0x7dab('0x22')];var _0x271dbd;if(_0x4c7cab>=_0x1ccd64){_0x4c7cab=_0x1ccd64;_0x271dbd=0xc8;}else{_0x271dbd=0xce;}_0x389e7f[_0x7dab('0x1e')](_0x271dbd);return _0x389e7f[_0x7dab('0x24')](_0x7dab('0x25'),_0x19244f+'-'+_0x4c7cab+'/'+_0x1ccd64)[_0x7dab('0x1f')](_0x63f1a1);}return null;};}function patchUpdates(_0x8ef182){return function(_0x5d60b0){try{jsonpatch[_0x7dab('0x26')](_0x5d60b0,_0x8ef182,!![]);}catch(_0x364306){return BPromise[_0x7dab('0x27')](_0x364306);}return _0x5d60b0[_0x7dab('0x28')]();};}function saveUpdates(_0x3d9fb2,_0x5cdc39){return function(_0x1a8a62){if(_0x1a8a62){return _0x1a8a62[_0x7dab('0x29')](_0x3d9fb2)[_0x7dab('0x2a')](function(_0x37e3dd){return _0x37e3dd;});}return null;};}function removeEntity(_0x2f6a13,_0x424379){return function(_0x27c0cd){if(_0x27c0cd){return _0x27c0cd[_0x7dab('0x2b')]()[_0x7dab('0x2a')](function(){_0x2f6a13[_0x7dab('0x1e')](0xcc)[_0x7dab('0x1d')]();});}};}function handleEntityNotFound(_0x2ca4aa,_0x701ca6){return function(_0x2f6720){if(!_0x2f6720){_0x2ca4aa[_0x7dab('0x1c')](0x194);}return _0x2f6720;};}function handleError(_0x2b3ba7,_0x3041d4){_0x3041d4=_0x3041d4||0x1f4;return function(_0x421cb6){logger['error'](_0x421cb6['stack']);if(_0x421cb6[_0x7dab('0x2c')]){delete _0x421cb6[_0x7dab('0x2c')];}_0x2b3ba7['status'](_0x3041d4)[_0x7dab('0x2d')](_0x421cb6);};}exports[_0x7dab('0x2e')]=function(_0x1b0ff0,_0x45464f){var _0x49b58c={},_0x5a13e6={},_0x34d9a6={'count':0x0,'rows':[]};var _0x17d4c0=_[_0x7dab('0x2f')](db['SquareRecording']['rawAttributes'],function(_0x3d394d){return{'name':_0x3d394d['fieldName'],'type':_0x3d394d[_0x7dab('0x30')][_0x7dab('0x31')]};});_0x5a13e6[_0x7dab('0x32')]=_[_0x7dab('0x2f')](_0x17d4c0,_0x7dab('0x2c'));_0x5a13e6['query']=_[_0x7dab('0x33')](_0x1b0ff0[_0x7dab('0x34')]);_0x5a13e6['filters']=_[_0x7dab('0x35')](_0x5a13e6[_0x7dab('0x32')],_0x5a13e6['query']);_0x49b58c[_0x7dab('0x36')]=_['intersection'](_0x5a13e6['model'],qs[_0x7dab('0x37')](_0x1b0ff0[_0x7dab('0x34')]['fields']));_0x49b58c['attributes']=_0x49b58c[_0x7dab('0x36')][_0x7dab('0x38')]?_0x49b58c[_0x7dab('0x36')]:_0x5a13e6['model'];if(!_0x1b0ff0[_0x7dab('0x34')][_0x7dab('0x39')]('nolimit')){_0x49b58c[_0x7dab('0x22')]=qs[_0x7dab('0x22')](_0x1b0ff0[_0x7dab('0x34')][_0x7dab('0x22')]);_0x49b58c['offset']=qs['offset'](_0x1b0ff0['query'][_0x7dab('0x20')]);}_0x49b58c[_0x7dab('0x3a')]=qs[_0x7dab('0x3b')](_0x1b0ff0[_0x7dab('0x34')]['sort']);_0x49b58c[_0x7dab('0x3c')]=qs[_0x7dab('0x3d')](_[_0x7dab('0x3e')](_0x1b0ff0[_0x7dab('0x34')],_0x5a13e6[_0x7dab('0x3d')]),_0x17d4c0);if(_0x1b0ff0[_0x7dab('0x34')][_0x7dab('0x3f')]){_0x49b58c[_0x7dab('0x3c')]=_[_0x7dab('0x40')](_0x49b58c[_0x7dab('0x3c')],{'$or':_[_0x7dab('0x2f')](_0x17d4c0,function(_0x41f7d0){if(_0x41f7d0[_0x7dab('0x30')]!==_0x7dab('0x41')){var _0x3f3c4e={};_0x3f3c4e[_0x41f7d0[_0x7dab('0x2c')]]={'$like':'%'+_0x1b0ff0[_0x7dab('0x34')][_0x7dab('0x3f')]+'%'};return _0x3f3c4e;}})});}_0x49b58c=_[_0x7dab('0x40')]({},_0x49b58c,_0x1b0ff0[_0x7dab('0x42')]);var _0x94439d={'where':_0x49b58c[_0x7dab('0x3c')]};return db[_0x7dab('0x43')]['count'](_0x94439d)[_0x7dab('0x2a')](function(_0x2e4141){_0x34d9a6[_0x7dab('0x23')]=_0x2e4141;if(_0x1b0ff0[_0x7dab('0x34')][_0x7dab('0x44')]){_0x49b58c[_0x7dab('0x45')]=[{'all':!![]}];}return db[_0x7dab('0x43')][_0x7dab('0x46')](_0x49b58c);})['then'](function(_0x148ee2){_0x34d9a6['rows']=_0x148ee2;return _0x34d9a6;})[_0x7dab('0x2a')](respondWithFilteredResult(_0x45464f,_0x49b58c))['catch'](handleError(_0x45464f,null));};exports['show']=function(_0x11c85b,_0x8f0f9b){var _0x224675={'raw':!![],'where':{'id':_0x11c85b['params']['id']}},_0x32923e={};_0x32923e['model']=_[_0x7dab('0x33')](db['SquareRecording'][_0x7dab('0x47')]);_0x32923e[_0x7dab('0x34')]=_['keys'](_0x11c85b[_0x7dab('0x34')]);_0x32923e[_0x7dab('0x3d')]=_[_0x7dab('0x35')](_0x32923e['model'],_0x32923e['query']);_0x224675[_0x7dab('0x36')]=_['intersection'](_0x32923e[_0x7dab('0x32')],qs[_0x7dab('0x37')](_0x11c85b[_0x7dab('0x34')][_0x7dab('0x37')]));_0x224675['attributes']=_0x224675[_0x7dab('0x36')][_0x7dab('0x38')]?_0x224675[_0x7dab('0x36')]:_0x32923e[_0x7dab('0x32')];if(_0x11c85b['query'][_0x7dab('0x44')]){_0x224675[_0x7dab('0x45')]=[{'all':!![]}];}_0x224675=_['merge']({},_0x224675,_0x11c85b[_0x7dab('0x42')]);return db[_0x7dab('0x43')][_0x7dab('0x48')](_0x224675)[_0x7dab('0x2a')](handleEntityNotFound(_0x8f0f9b,null))[_0x7dab('0x2a')](respondWithResult(_0x8f0f9b,null))[_0x7dab('0x49')](handleError(_0x8f0f9b,null));};exports['create']=function(_0x8cc289,_0x1fb669){return db[_0x7dab('0x43')][_0x7dab('0x4a')](_0x8cc289['body'],{})[_0x7dab('0x2a')](respondWithResult(_0x1fb669,0xc9))[_0x7dab('0x49')](handleError(_0x1fb669,null));};exports[_0x7dab('0x29')]=function(_0x4cc57f,_0x5ed152){if(_0x4cc57f[_0x7dab('0x4b')]['id']){delete _0x4cc57f[_0x7dab('0x4b')]['id'];}return db[_0x7dab('0x43')]['find']({'where':{'id':_0x4cc57f[_0x7dab('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5ed152,null))[_0x7dab('0x2a')](saveUpdates(_0x4cc57f['body'],null))['then'](respondWithResult(_0x5ed152,null))[_0x7dab('0x49')](handleError(_0x5ed152,null));};exports[_0x7dab('0x4d')]=function(_0x159ed4,_0x248d77,_0x2ca8d5){var _0x5f5972=require(_0x7dab('0x4e'));var _0x10cf49=![];var _0x2da7ca={};if(_0x159ed4[_0x7dab('0x34')][_0x7dab('0x30')]&&_0x159ed4[_0x7dab('0x34')]['type']===_0x7dab('0x4f')){_0x2da7ca['uniqueid']=_0x159ed4[_0x7dab('0x4c')]['id'];}else{_0x2da7ca['id']=_0x159ed4[_0x7dab('0x4c')]['id'];}return db[_0x7dab('0x43')]['find']({'where':_0x2da7ca,'attributes':['id',_0x7dab('0x50'),_0x7dab('0x51')],'raw':!![]})[_0x7dab('0x2a')](handleEntityNotFound(_0x248d77,null))[_0x7dab('0x2a')](function(_0x40f5c5){if(_0x40f5c5){var _0x373b21=_0x40f5c5[_0x7dab('0x50')];var _0x4b23aa=util[_0x7dab('0x52')](_0x7dab('0x53'),_0x373b21);if(fs[_0x7dab('0x54')](_0x4b23aa)){_0x10cf49=!![];return _0x5f5972[_0x7dab('0x55')](_0x4b23aa,_0x373b21,config[_0x7dab('0x56')][_0x7dab('0x57')])[_0x7dab('0x2a')](function(){return _0x40f5c5;});}return _0x40f5c5;}})[_0x7dab('0x2a')](function(_0x3b65f0){if(_0x3b65f0){var _0x58c656=_0x3b65f0['savePath'];if(!fs['existsSync'](_0x58c656)){throw new db['Sequelize'][(_0x7dab('0x58'))]('SquareRecording\x20not\x20found');}if(_0x3b65f0['filename']){return _0x248d77[_0x7dab('0x4d')](_0x58c656,_0x3b65f0[_0x7dab('0x51')]+path['extname'](_0x58c656),function(){if(_0x10cf49){fs[_0x7dab('0x59')](_0x58c656);}});}else{return _0x248d77[_0x7dab('0x4d')](_0x58c656,function(_0xf0550d){if(_0x10cf49){fs[_0x7dab('0x59')](_0x58c656);}});}}})[_0x7dab('0x49')](function(_0x580234){if(_0x580234['message']===_0x7dab('0x5a')){_0x248d77[_0x7dab('0x1e')](0x194)[_0x7dab('0x2d')](_0x7dab('0x5b'));}else{return handleError(_0x248d77,null);}});};exports['destroy']=function(_0x5bf8b8,_0x19a870){return db[_0x7dab('0x43')]['find']({'where':{'id':_0x5bf8b8[_0x7dab('0x4c')]['id']}})[_0x7dab('0x2a')](function(_0x1d10a8){if(_[_0x7dab('0x5c')](_0x1d10a8)){throw new ReferenceError(_0x7dab('0x5d'));}return _0x1d10a8;})['then'](function(_0x1643f2){var _0x9f7433=_0x1643f2[_0x7dab('0x50')];logger[_0x7dab('0x5e')](_0x7dab('0x5f'),_0x9f7433);if(!_[_0x7dab('0x5c')](_0x1643f2[_0x7dab('0x50')])&&fs[_0x7dab('0x54')](_0x9f7433)){logger['info'](_0x7dab('0x60')+_0x9f7433+_0x7dab('0x61'));fs[_0x7dab('0x62')](_0x9f7433);}_0x9f7433=_0x9f7433+_0x7dab('0x63');if(!_[_0x7dab('0x5c')](_0x1643f2[_0x7dab('0x50')])&&fs[_0x7dab('0x54')](_0x9f7433)){logger[_0x7dab('0x5e')](_0x7dab('0x60')+_0x9f7433+_0x7dab('0x61'));fs['unlinkSync'](_0x9f7433);}return _0x1643f2;})['then'](function(_0x2ac988){if(!_0x2ac988)throw new InternalError();return _0x2ac988[_0x7dab('0x2b')]();})[_0x7dab('0x2a')](function(){_0x19a870[_0x7dab('0x1e')](0xcc)['end']();})['catch'](handleError(_0x19a870,null));}; \ No newline at end of file +var _0x9cd5=['eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','keys','intersection','length','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync'];(function(_0x23c701,_0x21903f){var _0x3ee95a=function(_0x32ab2b){while(--_0x32ab2b){_0x23c701['push'](_0x23c701['shift']());}};_0x3ee95a(++_0x21903f);}(_0x9cd5,0xc2));var _0x59cd=function(_0x5c05eb,_0x24b11c){_0x5c05eb=_0x5c05eb-0x0;var _0x756e1=_0x9cd5[_0x5c05eb];return _0x756e1;};'use strict';var emlformat=require(_0x59cd('0x0'));var rimraf=require(_0x59cd('0x1'));var zipdir=require(_0x59cd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x59cd('0x3'));var BPromise=require(_0x59cd('0x4'));var Mustache=require('mustache');var util=require(_0x59cd('0x5'));var path=require(_0x59cd('0x6'));var sox=require(_0x59cd('0x7'));var csv=require(_0x59cd('0x8'));var ejs=require(_0x59cd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x59cd('0xa'));var squel=require(_0x59cd('0xb'));var crypto=require(_0x59cd('0xc'));var jsforce=require(_0x59cd('0xd'));var deskjs=require(_0x59cd('0xe'));var toCsv=require(_0x59cd('0x8'));var querystring=require(_0x59cd('0xf'));var Papa=require(_0x59cd('0x10'));var Redis=require(_0x59cd('0x11'));var authService=require(_0x59cd('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x59cd('0x13'));var hardwareService=require(_0x59cd('0x14'));var logger=require(_0x59cd('0x15'))(_0x59cd('0x16'));var utils=require(_0x59cd('0x17'));var config=require(_0x59cd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x59cd('0x19'))['db'];function respondWithStatusCode(_0x664810,_0x4e85e9){_0x4e85e9=_0x4e85e9||0xcc;return function(_0x219d63){if(_0x219d63){return _0x664810[_0x59cd('0x1a')](_0x4e85e9);}return _0x664810[_0x59cd('0x1b')](_0x4e85e9)[_0x59cd('0x1c')]();};}function respondWithResult(_0x59ec7a,_0x3547c3){_0x3547c3=_0x3547c3||0xc8;return function(_0x35d6dc){if(_0x35d6dc){return _0x59ec7a[_0x59cd('0x1b')](_0x3547c3)[_0x59cd('0x1d')](_0x35d6dc);}};}function respondWithFilteredResult(_0x1f3ab3,_0x2e8e16){return function(_0x75e545){if(_0x75e545){var _0x5b8591=typeof _0x2e8e16['offset']===_0x59cd('0x1e')&&typeof _0x2e8e16[_0x59cd('0x1f')]==='undefined';var _0x32f01e=_0x75e545['count'];var _0x3e176f=_0x5b8591?0x0:_0x2e8e16[_0x59cd('0x20')];var _0x4bd086=_0x5b8591?_0x75e545[_0x59cd('0x21')]:_0x2e8e16[_0x59cd('0x20')]+_0x2e8e16[_0x59cd('0x1f')];var _0x561990;if(_0x4bd086>=_0x32f01e){_0x4bd086=_0x32f01e;_0x561990=0xc8;}else{_0x561990=0xce;}_0x1f3ab3[_0x59cd('0x1b')](_0x561990);return _0x1f3ab3[_0x59cd('0x22')](_0x59cd('0x23'),_0x3e176f+'-'+_0x4bd086+'/'+_0x32f01e)[_0x59cd('0x1d')](_0x75e545);}return null;};}function patchUpdates(_0x24dc5f){return function(_0x24ea6e){try{jsonpatch[_0x59cd('0x24')](_0x24ea6e,_0x24dc5f,!![]);}catch(_0x51d010){return BPromise[_0x59cd('0x25')](_0x51d010);}return _0x24ea6e['save']();};}function saveUpdates(_0x10dc04,_0x57105a){return function(_0x830681){if(_0x830681){return _0x830681[_0x59cd('0x26')](_0x10dc04)[_0x59cd('0x27')](function(_0x45554a){return _0x45554a;});}return null;};}function removeEntity(_0x50226b,_0x483b1c){return function(_0xe2084d){if(_0xe2084d){return _0xe2084d['destroy']()[_0x59cd('0x27')](function(){_0x50226b['status'](0xcc)[_0x59cd('0x1c')]();});}};}function handleEntityNotFound(_0x3c9e82,_0x2d753d){return function(_0x51dd60){if(!_0x51dd60){_0x3c9e82[_0x59cd('0x1a')](0x194);}return _0x51dd60;};}function handleError(_0x22a3b1,_0x187a94){_0x187a94=_0x187a94||0x1f4;return function(_0x3329e6){logger['error'](_0x3329e6['stack']);if(_0x3329e6['name']){delete _0x3329e6[_0x59cd('0x28')];}_0x22a3b1['status'](_0x187a94)[_0x59cd('0x29')](_0x3329e6);};}exports[_0x59cd('0x2a')]=function(_0x3915e3,_0x8a2d80){var _0x5eb0ae={},_0x3e8451={},_0x4c4393={'count':0x0,'rows':[]};var _0x344037=_['map'](db[_0x59cd('0x2b')][_0x59cd('0x2c')],function(_0x55e5f3){return{'name':_0x55e5f3[_0x59cd('0x2d')],'type':_0x55e5f3[_0x59cd('0x2e')][_0x59cd('0x2f')]};});_0x3e8451[_0x59cd('0x30')]=_[_0x59cd('0x31')](_0x344037,_0x59cd('0x28'));_0x3e8451[_0x59cd('0x32')]=_['keys'](_0x3915e3['query']);_0x3e8451[_0x59cd('0x33')]=_['intersection'](_0x3e8451[_0x59cd('0x30')],_0x3e8451['query']);_0x5eb0ae[_0x59cd('0x34')]=_['intersection'](_0x3e8451['model'],qs[_0x59cd('0x35')](_0x3915e3[_0x59cd('0x32')]['fields']));_0x5eb0ae[_0x59cd('0x34')]=_0x5eb0ae[_0x59cd('0x34')]['length']?_0x5eb0ae[_0x59cd('0x34')]:_0x3e8451['model'];if(!_0x3915e3[_0x59cd('0x32')][_0x59cd('0x36')]('nolimit')){_0x5eb0ae[_0x59cd('0x1f')]=qs[_0x59cd('0x1f')](_0x3915e3['query'][_0x59cd('0x1f')]);_0x5eb0ae[_0x59cd('0x20')]=qs[_0x59cd('0x20')](_0x3915e3[_0x59cd('0x32')][_0x59cd('0x20')]);}_0x5eb0ae[_0x59cd('0x37')]=qs[_0x59cd('0x38')](_0x3915e3[_0x59cd('0x32')]['sort']);_0x5eb0ae[_0x59cd('0x39')]=qs['filters'](_[_0x59cd('0x3a')](_0x3915e3['query'],_0x3e8451[_0x59cd('0x33')]),_0x344037);if(_0x3915e3[_0x59cd('0x32')]['filter']){_0x5eb0ae[_0x59cd('0x39')]=_[_0x59cd('0x3b')](_0x5eb0ae[_0x59cd('0x39')],{'$or':_[_0x59cd('0x31')](_0x344037,function(_0x3eb659){if(_0x3eb659[_0x59cd('0x2e')]!==_0x59cd('0x3c')){var _0x217c52={};_0x217c52[_0x3eb659['name']]={'$like':'%'+_0x3915e3[_0x59cd('0x32')][_0x59cd('0x3d')]+'%'};return _0x217c52;}})});}_0x5eb0ae=_[_0x59cd('0x3b')]({},_0x5eb0ae,_0x3915e3['options']);var _0x4521da={'where':_0x5eb0ae[_0x59cd('0x39')]};return db[_0x59cd('0x2b')]['count'](_0x4521da)['then'](function(_0x4f1de9){_0x4c4393[_0x59cd('0x21')]=_0x4f1de9;if(_0x3915e3[_0x59cd('0x32')][_0x59cd('0x3e')]){_0x5eb0ae[_0x59cd('0x3f')]=[{'all':!![]}];}return db['SquareRecording'][_0x59cd('0x40')](_0x5eb0ae);})[_0x59cd('0x27')](function(_0x2e11ce){_0x4c4393['rows']=_0x2e11ce;return _0x4c4393;})[_0x59cd('0x27')](respondWithFilteredResult(_0x8a2d80,_0x5eb0ae))[_0x59cd('0x41')](handleError(_0x8a2d80,null));};exports[_0x59cd('0x42')]=function(_0xa04cd3,_0x2ba844){var _0x39101d={'raw':!![],'where':{'id':_0xa04cd3[_0x59cd('0x43')]['id']}},_0xcb9d86={};_0xcb9d86[_0x59cd('0x30')]=_[_0x59cd('0x44')](db[_0x59cd('0x2b')]['rawAttributes']);_0xcb9d86[_0x59cd('0x32')]=_[_0x59cd('0x44')](_0xa04cd3[_0x59cd('0x32')]);_0xcb9d86[_0x59cd('0x33')]=_[_0x59cd('0x45')](_0xcb9d86[_0x59cd('0x30')],_0xcb9d86['query']);_0x39101d['attributes']=_[_0x59cd('0x45')](_0xcb9d86['model'],qs[_0x59cd('0x35')](_0xa04cd3[_0x59cd('0x32')][_0x59cd('0x35')]));_0x39101d[_0x59cd('0x34')]=_0x39101d['attributes'][_0x59cd('0x46')]?_0x39101d['attributes']:_0xcb9d86[_0x59cd('0x30')];if(_0xa04cd3['query'][_0x59cd('0x3e')]){_0x39101d[_0x59cd('0x3f')]=[{'all':!![]}];}_0x39101d=_[_0x59cd('0x3b')]({},_0x39101d,_0xa04cd3['options']);return db[_0x59cd('0x2b')][_0x59cd('0x47')](_0x39101d)[_0x59cd('0x27')](handleEntityNotFound(_0x2ba844,null))[_0x59cd('0x27')](respondWithResult(_0x2ba844,null))[_0x59cd('0x41')](handleError(_0x2ba844,null));};exports[_0x59cd('0x48')]=function(_0x2c2eae,_0x2347b4){return db[_0x59cd('0x2b')][_0x59cd('0x48')](_0x2c2eae[_0x59cd('0x49')],{})[_0x59cd('0x27')](respondWithResult(_0x2347b4,0xc9))[_0x59cd('0x41')](handleError(_0x2347b4,null));};exports[_0x59cd('0x26')]=function(_0x3201c4,_0x11f259){if(_0x3201c4['body']['id']){delete _0x3201c4[_0x59cd('0x49')]['id'];}return db[_0x59cd('0x2b')][_0x59cd('0x47')]({'where':{'id':_0x3201c4[_0x59cd('0x43')]['id']}})[_0x59cd('0x27')](handleEntityNotFound(_0x11f259,null))[_0x59cd('0x27')](saveUpdates(_0x3201c4[_0x59cd('0x49')],null))[_0x59cd('0x27')](respondWithResult(_0x11f259,null))[_0x59cd('0x41')](handleError(_0x11f259,null));};exports[_0x59cd('0x4a')]=function(_0x11cf09,_0x52855a,_0x8af5d0){var _0x33a984=require(_0x59cd('0x4b'));var _0x40bf55=![];var _0x2e7ce={};if(_0x11cf09[_0x59cd('0x32')][_0x59cd('0x2e')]&&_0x11cf09['query']['type']===_0x59cd('0x4c')){_0x2e7ce[_0x59cd('0x4c')]=_0x11cf09[_0x59cd('0x43')]['id'];}else{_0x2e7ce['id']=_0x11cf09[_0x59cd('0x43')]['id'];}return db[_0x59cd('0x2b')][_0x59cd('0x47')]({'where':_0x2e7ce,'attributes':['id',_0x59cd('0x4d'),_0x59cd('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x52855a,null))[_0x59cd('0x27')](function(_0x124d93){if(_0x124d93){var _0x90a0ee=_0x124d93[_0x59cd('0x4d')];var _0xdaed3=util['format'](_0x59cd('0x4f'),_0x90a0ee);if(fs[_0x59cd('0x50')](_0xdaed3)){_0x40bf55=!![];return _0x33a984[_0x59cd('0x51')](_0xdaed3,_0x90a0ee,config[_0x59cd('0x52')][_0x59cd('0x53')])[_0x59cd('0x27')](function(){return _0x124d93;});}return _0x124d93;}})[_0x59cd('0x27')](function(_0x5083ec){if(_0x5083ec){var _0x556f23=_0x5083ec[_0x59cd('0x4d')];if(!fs['existsSync'](_0x556f23)){throw new db[(_0x59cd('0x54'))][(_0x59cd('0x55'))](_0x59cd('0x56'));}if(_0x5083ec[_0x59cd('0x4e')]){return _0x52855a[_0x59cd('0x4a')](_0x556f23,_0x5083ec[_0x59cd('0x4e')]+path[_0x59cd('0x57')](_0x556f23),function(){if(_0x40bf55){fs['unlink'](_0x556f23);}});}else{return _0x52855a[_0x59cd('0x4a')](_0x556f23,function(_0x5ede83){if(_0x40bf55){fs['unlink'](_0x556f23);}});}}})['catch'](function(_0xf79ab5){if(_0xf79ab5[_0x59cd('0x58')]===_0x59cd('0x56')){_0x52855a[_0x59cd('0x1b')](0x194)[_0x59cd('0x29')](_0x59cd('0x59'));}else{return handleError(_0x52855a,null);}});};exports['destroy']=function(_0x45afc7,_0x284f02){return db[_0x59cd('0x2b')][_0x59cd('0x47')]({'where':{'id':_0x45afc7[_0x59cd('0x43')]['id']}})[_0x59cd('0x27')](function(_0x19b015){if(_[_0x59cd('0x5a')](_0x19b015)){throw new ReferenceError('Entity\x20not\x20found');}return _0x19b015;})[_0x59cd('0x27')](function(_0x102645){var _0x42ddb5=_0x102645[_0x59cd('0x4d')];logger[_0x59cd('0x5b')](_0x59cd('0x5c'),_0x42ddb5);if(!_[_0x59cd('0x5a')](_0x102645['savePath'])&&fs[_0x59cd('0x50')](_0x42ddb5)){logger[_0x59cd('0x5b')](_0x59cd('0x5d')+_0x42ddb5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x42ddb5);}_0x42ddb5=_0x42ddb5+_0x59cd('0x5e');if(!_[_0x59cd('0x5a')](_0x102645[_0x59cd('0x4d')])&&fs[_0x59cd('0x50')](_0x42ddb5)){logger['info'](_0x59cd('0x5d')+_0x42ddb5+_0x59cd('0x5f'));fs[_0x59cd('0x60')](_0x42ddb5);}return _0x102645;})[_0x59cd('0x27')](function(_0x59294f){if(!_0x59294f)throw new InternalError();return _0x59294f['destroy']();})[_0x59cd('0x27')](function(){_0x284f02['status'](0xcc)['end']();})[_0x59cd('0x41')](handleError(_0x284f02,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index b4ca7d0..af0c09a 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 _0x7096=['exports','define','SquareRecording','square_recordings','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0x7096,0x10c));var _0x6709=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x7096[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef96=['rimraf','exports','SquareRecording','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x43caa2,_0x1ffb73){var _0x51b342=function(_0x288f85){while(--_0x288f85){_0x43caa2['push'](_0x43caa2['shift']());}};_0x51b342(++_0x1ffb73);}(_0xef96,0x162));var _0x6ef9=function(_0x26564c,_0x132aa5){_0x26564c=_0x26564c-0x0;var _0x9e527a=_0xef96[_0x26564c];return _0x9e527a;};'use strict';var _=require(_0x6ef9('0x0'));var util=require(_0x6ef9('0x1'));var logger=require(_0x6ef9('0x2'))(_0x6ef9('0x3'));var moment=require(_0x6ef9('0x4'));var BPromise=require(_0x6ef9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6ef9('0x6'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0x6ef9('0x7')]=function(_0x1983df,_0x34ba12){return _0x1983df['define'](_0x6ef9('0x8'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index c29c832..c3ab3eb 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 _0x683c=['CreateSquareRecording','SquareRecording','create','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3ecbdc,_0x3a71fe){var _0xad4dea=function(_0x3275a0){while(--_0x3275a0){_0x3ecbdc['push'](_0x3ecbdc['shift']());}};_0xad4dea(++_0x3a71fe);}(_0x683c,0x8c));var _0xc683=function(_0x2468c7,_0xaf4c81){_0x2468c7=_0x2468c7-0x0;var _0x11c7eb=_0x683c[_0x2468c7];return _0x11c7eb;};'use strict';var _=require(_0xc683('0x0'));var util=require('util');var moment=require(_0xc683('0x1'));var BPromise=require(_0xc683('0x2'));var rs=require(_0xc683('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc683('0x4'))['db'];var utils=require(_0xc683('0x5'));var logger=require(_0xc683('0x6'))(_0xc683('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc683('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7f6408,_0xa6ba2,_0x14ff70){return new BPromise(function(_0x289a0,_0x4f981c){return client[_0xc683('0x9')](_0x7f6408,_0x14ff70)[_0xc683('0xa')](function(_0x32bd8d){logger[_0xc683('0xb')](_0xc683('0xc'),_0xa6ba2,_0xc683('0xd'));logger[_0xc683('0xe')](_0xc683('0xf'),_0xa6ba2,_0xc683('0xd'),JSON[_0xc683('0x10')](_0x32bd8d));if(_0x32bd8d[_0xc683('0x11')]){if(_0x32bd8d[_0xc683('0x11')][_0xc683('0x12')]===0x1f4){logger[_0xc683('0x11')](_0xc683('0xc'),_0xa6ba2,_0x32bd8d['error']['message']);return _0x4f981c(_0x32bd8d['error'][_0xc683('0x13')]);}logger[_0xc683('0x11')](_0xc683('0xc'),_0xa6ba2,_0x32bd8d[_0xc683('0x11')][_0xc683('0x13')]);return _0x289a0(_0x32bd8d[_0xc683('0x11')][_0xc683('0x13')]);}else{logger['info'](_0xc683('0xc'),_0xa6ba2,'request\x20sent');_0x289a0(_0x32bd8d[_0xc683('0x14')][_0xc683('0x13')]);}})[_0xc683('0x15')](function(_0x388a36){logger[_0xc683('0x11')]('SquareRecording,\x20%s,\x20%s',_0xa6ba2,_0x388a36);_0x4f981c(_0x388a36);});});}exports[_0xc683('0x16')]=function(_0x24b9b3){var _0x23be92=this;return new Promise(function(_0x2b3f3d,_0xc3d4a1){return db[_0xc683('0x17')][_0xc683('0x18')](_0x24b9b3['body'],{'raw':_0x24b9b3[_0xc683('0x19')]?_0x24b9b3['options'][_0xc683('0x1a')]===undefined?!![]:![]:!![]})[_0xc683('0xa')](function(_0x135101){logger[_0xc683('0xb')]('CreateSquareRecording',_0x24b9b3);logger['debug'](_0xc683('0x16'),_0x24b9b3,JSON[_0xc683('0x10')](_0x135101));_0x2b3f3d(_0x135101);})['catch'](function(_0x3b83fd){logger[_0xc683('0x11')]('CreateSquareRecording',_0x3b83fd[_0xc683('0x13')],_0x24b9b3);_0xc3d4a1(_0x23be92[_0xc683('0x11')](0x1f4,_0x3b83fd[_0xc683('0x13')]));});});}; \ No newline at end of file +var _0x394c=['body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareRecording','SquareRecording','create'];(function(_0x3622ab,_0x17f980){var _0x51a526=function(_0x473763){while(--_0x473763){_0x3622ab['push'](_0x3622ab['shift']());}};_0x51a526(++_0x17f980);}(_0x394c,0x1c5));var _0xc394=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0x394c[_0x39cd3c];return _0x47a0ae;};'use strict';var _=require(_0xc394('0x0'));var util=require(_0xc394('0x1'));var moment=require(_0xc394('0x2'));var BPromise=require(_0xc394('0x3'));var rs=require(_0xc394('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc394('0x5'))['db'];var utils=require(_0xc394('0x6'));var logger=require(_0xc394('0x7'))(_0xc394('0x8'));var config=require(_0xc394('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc394('0xa')][_0xc394('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26fa18,_0x1d4998,_0x577279){return new BPromise(function(_0x550f1e,_0x12ce98){return client['request'](_0x26fa18,_0x577279)[_0xc394('0xc')](function(_0x50d7d3){logger['info'](_0xc394('0xd'),_0x1d4998,_0xc394('0xe'));logger[_0xc394('0xf')](_0xc394('0x10'),_0x1d4998,_0xc394('0xe'),JSON[_0xc394('0x11')](_0x50d7d3));if(_0x50d7d3[_0xc394('0x12')]){if(_0x50d7d3[_0xc394('0x12')][_0xc394('0x13')]===0x1f4){logger[_0xc394('0x12')]('SquareRecording,\x20%s,\x20%s',_0x1d4998,_0x50d7d3[_0xc394('0x12')]['message']);return _0x12ce98(_0x50d7d3[_0xc394('0x12')][_0xc394('0x14')]);}logger[_0xc394('0x12')](_0xc394('0xd'),_0x1d4998,_0x50d7d3[_0xc394('0x12')][_0xc394('0x14')]);return _0x550f1e(_0x50d7d3[_0xc394('0x12')][_0xc394('0x14')]);}else{logger[_0xc394('0x15')](_0xc394('0xd'),_0x1d4998,_0xc394('0xe'));_0x550f1e(_0x50d7d3[_0xc394('0x16')][_0xc394('0x14')]);}})[_0xc394('0x17')](function(_0x2a6cdd){logger[_0xc394('0x12')](_0xc394('0xd'),_0x1d4998,_0x2a6cdd);_0x12ce98(_0x2a6cdd);});});}exports[_0xc394('0x18')]=function(_0x3ac75a){var _0x48bc27=this;return new Promise(function(_0x39ff28,_0x4f7934){return db[_0xc394('0x19')][_0xc394('0x1a')](_0x3ac75a[_0xc394('0x1b')],{'raw':_0x3ac75a['options']?_0x3ac75a[_0xc394('0x1c')][_0xc394('0x1d')]===undefined?!![]:![]:!![]})[_0xc394('0xc')](function(_0x48fdb1){logger['info'](_0xc394('0x18'),_0x3ac75a);logger[_0xc394('0xf')](_0xc394('0x18'),_0x3ac75a,JSON['stringify'](_0x48fdb1));_0x39ff28(_0x48fdb1);})[_0xc394('0x17')](function(_0x5b51b0){logger[_0xc394('0x12')](_0xc394('0x18'),_0x5b51b0[_0xc394('0x14')],_0x3ac75a);_0x4f7934(_0x48bc27[_0xc394('0x12')](0x1f4,_0x5b51b0[_0xc394('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 2b2793c..1f31930 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0xfb23c5,_0x2c2e87){var _0x406576=function(_0x2c7f34){while(--_0x2c7f34){_0xfb23c5['push'](_0xfb23c5['shift']());}};_0x406576(++_0x2c2e87);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _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(_0x458f09,_0xf2ee90){var _0x1ca565=function(_0x8ec760){while(--_0x8ec760){_0x458f09['push'](_0x458f09['shift']());}};_0x1ca565(++_0xf2ee90);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index e5c56c9..5919600 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 _0xf971=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x2215cd,_0x58c76c){var _0x34a5ba=function(_0x4fff1f){while(--_0x4fff1f){_0x2215cd['push'](_0x2215cd['shift']());}};_0x34a5ba(++_0x58c76c);}(_0xf971,0x7c));var _0x1f97=function(_0x4515b1,_0x14735b){_0x4515b1=_0x4515b1-0x0;var _0x2edeee=_0xf971[_0x4515b1];return _0x2edeee;};'use strict';var Sequelize=require(_0x1f97('0x0'));module[_0x1f97('0x1')]={'network':{'type':Sequelize[_0x1f97('0x2')]},'network_script':{'type':Sequelize[_0x1f97('0x2')]},'request':{'type':Sequelize[_0x1f97('0x2')]},'channel':{'type':Sequelize[_0x1f97('0x2')]},'language':{'type':Sequelize[_0x1f97('0x2')]},'type':{'type':Sequelize[_0x1f97('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x1f97('0x2')]},'callerid':{'type':Sequelize[_0x1f97('0x2')]},'calleridname':{'type':Sequelize[_0x1f97('0x2')]},'callingpres':{'type':Sequelize[_0x1f97('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x1f97('0x2')]},'callingtns':{'type':Sequelize[_0x1f97('0x2')]},'dnid':{'type':Sequelize[_0x1f97('0x2')]},'rdnis':{'type':Sequelize[_0x1f97('0x2')]},'context':{'type':Sequelize[_0x1f97('0x2')]},'extension':{'type':Sequelize[_0x1f97('0x2')]},'priority':{'type':Sequelize[_0x1f97('0x2')]},'enhanced':{'type':Sequelize[_0x1f97('0x2')]},'accountcode':{'type':Sequelize[_0x1f97('0x2')]},'threadid':{'type':Sequelize[_0x1f97('0x2')]},'project_name':{'type':Sequelize[_0x1f97('0x2')]},'joinAt':{'type':Sequelize[_0x1f97('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x1f97('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xd9e3=['DATE','STRING'];(function(_0x489be9,_0x12f54a){var _0x482b2a=function(_0xc8dbf0){while(--_0xc8dbf0){_0x489be9['push'](_0x489be9['shift']());}};_0x482b2a(++_0x12f54a);}(_0xd9e3,0x7b));var _0x3d9e=function(_0x41f27d,_0x2bfb2b){_0x41f27d=_0x41f27d-0x0;var _0xe14051=_0xd9e3[_0x41f27d];return _0xe14051;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize[_0x3d9e('0x0')]},'network_script':{'type':Sequelize[_0x3d9e('0x0')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3d9e('0x0')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3d9e('0x0')]},'version':{'type':Sequelize[_0x3d9e('0x0')]},'callerid':{'type':Sequelize[_0x3d9e('0x0')]},'calleridname':{'type':Sequelize[_0x3d9e('0x0')]},'callingpres':{'type':Sequelize[_0x3d9e('0x0')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x3d9e('0x0')]},'callingtns':{'type':Sequelize[_0x3d9e('0x0')]},'dnid':{'type':Sequelize[_0x3d9e('0x0')]},'rdnis':{'type':Sequelize[_0x3d9e('0x0')]},'context':{'type':Sequelize[_0x3d9e('0x0')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3d9e('0x0')]},'enhanced':{'type':Sequelize[_0x3d9e('0x0')]},'accountcode':{'type':Sequelize[_0x3d9e('0x0')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3d9e('0x1')]},'leaveAt':{'type':Sequelize[_0x3d9e('0x1')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 15b72f4..dfc909e 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 _0x31ad=['sort','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','error','stack','name','map','SquareReport','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x42ac42,_0x6e6a4b){var _0x50dc84=function(_0x38b450){while(--_0x38b450){_0x42ac42['push'](_0x42ac42['shift']());}};_0x50dc84(++_0x6e6a4b);}(_0x31ad,0xa0));var _0xd31a=function(_0x4802c1,_0x5dcfdf){_0x4802c1=_0x4802c1-0x0;var _0x136243=_0x31ad[_0x4802c1];return _0x136243;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd31a('0x0'));var zipdir=require(_0xd31a('0x1'));var jsonpatch=require(_0xd31a('0x2'));var rp=require(_0xd31a('0x3'));var moment=require('moment');var BPromise=require(_0xd31a('0x4'));var Mustache=require(_0xd31a('0x5'));var util=require(_0xd31a('0x6'));var path=require(_0xd31a('0x7'));var sox=require(_0xd31a('0x8'));var csv=require(_0xd31a('0x9'));var ejs=require(_0xd31a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd31a('0xb'));var squel=require('squel');var crypto=require(_0xd31a('0xc'));var jsforce=require(_0xd31a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd31a('0x9'));var querystring=require(_0xd31a('0xe'));var Papa=require('papaparse');var Redis=require(_0xd31a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd31a('0x10'));var as=require(_0xd31a('0x11'));var hardwareService=require(_0xd31a('0x12'));var logger=require(_0xd31a('0x13'))(_0xd31a('0x14'));var utils=require('../../config/utils');var config=require(_0xd31a('0x15'));var licenseUtil=require(_0xd31a('0x16'));var db=require(_0xd31a('0x17'))['db'];function respondWithStatusCode(_0x14cf15,_0xdbc2ce){_0xdbc2ce=_0xdbc2ce||0xcc;return function(_0x4df883){if(_0x4df883){return _0x14cf15[_0xd31a('0x18')](_0xdbc2ce);}return _0x14cf15[_0xd31a('0x19')](_0xdbc2ce)[_0xd31a('0x1a')]();};}function respondWithResult(_0x2c67a6,_0x2c8b6f){_0x2c8b6f=_0x2c8b6f||0xc8;return function(_0x23afa8){if(_0x23afa8){return _0x2c67a6[_0xd31a('0x19')](_0x2c8b6f)[_0xd31a('0x1b')](_0x23afa8);}};}function respondWithFilteredResult(_0xf044df,_0x3aac29){return function(_0xe4ada5){if(_0xe4ada5){var _0x160799=typeof _0x3aac29['offset']===_0xd31a('0x1c')&&typeof _0x3aac29[_0xd31a('0x1d')]===_0xd31a('0x1c');var _0x2f1e30=_0xe4ada5[_0xd31a('0x1e')];var _0x28d950=_0x160799?0x0:_0x3aac29['offset'];var _0x8cbdcc=_0x160799?_0xe4ada5['count']:_0x3aac29[_0xd31a('0x1f')]+_0x3aac29['limit'];var _0x31f65f;if(_0x8cbdcc>=_0x2f1e30){_0x8cbdcc=_0x2f1e30;_0x31f65f=0xc8;}else{_0x31f65f=0xce;}_0xf044df[_0xd31a('0x19')](_0x31f65f);return _0xf044df[_0xd31a('0x20')]('Content-Range',_0x28d950+'-'+_0x8cbdcc+'/'+_0x2f1e30)[_0xd31a('0x1b')](_0xe4ada5);}return null;};}function patchUpdates(_0x31b45f){return function(_0x42d401){try{jsonpatch[_0xd31a('0x21')](_0x42d401,_0x31b45f,!![]);}catch(_0x5dae49){return BPromise[_0xd31a('0x22')](_0x5dae49);}return _0x42d401['save']();};}function saveUpdates(_0x57717d,_0x48f629){return function(_0x259e6f){if(_0x259e6f){return _0x259e6f[_0xd31a('0x23')](_0x57717d)[_0xd31a('0x24')](function(_0x376ae9){return _0x376ae9;});}return null;};}function removeEntity(_0x49ac14,_0x520209){return function(_0x4c48d6){if(_0x4c48d6){return _0x4c48d6[_0xd31a('0x25')]()[_0xd31a('0x24')](function(){_0x49ac14['status'](0xcc)[_0xd31a('0x1a')]();});}};}function handleEntityNotFound(_0x3f43b6,_0x504c0e){return function(_0x472eb3){if(!_0x472eb3){_0x3f43b6['sendStatus'](0x194);}return _0x472eb3;};}function handleError(_0x3cf610,_0x5b80ea){_0x5b80ea=_0x5b80ea||0x1f4;return function(_0x366ed5){logger[_0xd31a('0x26')](_0x366ed5[_0xd31a('0x27')]);if(_0x366ed5[_0xd31a('0x28')]){delete _0x366ed5[_0xd31a('0x28')];}_0x3cf610[_0xd31a('0x19')](_0x5b80ea)['send'](_0x366ed5);};}exports['index']=function(_0x5612a2,_0x2c288c){var _0x14a40b={},_0x1db1ad={},_0x37ec0a={'count':0x0,'rows':[]};var _0x548566=_[_0xd31a('0x29')](db[_0xd31a('0x2a')][_0xd31a('0x2b')],function(_0x1eb250){return{'name':_0x1eb250['fieldName'],'type':_0x1eb250[_0xd31a('0x2c')][_0xd31a('0x2d')]};});_0x1db1ad['model']=_[_0xd31a('0x29')](_0x548566,_0xd31a('0x28'));_0x1db1ad[_0xd31a('0x2e')]=_['keys'](_0x5612a2[_0xd31a('0x2e')]);_0x1db1ad[_0xd31a('0x2f')]=_[_0xd31a('0x30')](_0x1db1ad[_0xd31a('0x31')],_0x1db1ad['query']);_0x14a40b['attributes']=_[_0xd31a('0x30')](_0x1db1ad[_0xd31a('0x31')],qs['fields'](_0x5612a2[_0xd31a('0x2e')][_0xd31a('0x32')]));_0x14a40b['attributes']=_0x14a40b[_0xd31a('0x33')][_0xd31a('0x34')]?_0x14a40b['attributes']:_0x1db1ad[_0xd31a('0x31')];if(!_0x5612a2[_0xd31a('0x2e')][_0xd31a('0x35')](_0xd31a('0x36'))){_0x14a40b[_0xd31a('0x1d')]=qs[_0xd31a('0x1d')](_0x5612a2[_0xd31a('0x2e')][_0xd31a('0x1d')]);_0x14a40b[_0xd31a('0x1f')]=qs[_0xd31a('0x1f')](_0x5612a2[_0xd31a('0x2e')][_0xd31a('0x1f')]);}_0x14a40b[_0xd31a('0x37')]=qs[_0xd31a('0x38')](_0x5612a2[_0xd31a('0x2e')][_0xd31a('0x38')]);_0x14a40b['where']=qs['filters'](_[_0xd31a('0x39')](_0x5612a2[_0xd31a('0x2e')],_0x1db1ad['filters']),_0x548566);if(_0x5612a2[_0xd31a('0x2e')][_0xd31a('0x3a')]){_0x14a40b['where']=_[_0xd31a('0x3b')](_0x14a40b['where'],{'$or':_[_0xd31a('0x29')](_0x548566,function(_0x3a817e){if(_0x3a817e[_0xd31a('0x2c')]!=='VIRTUAL'){var _0x2716b9={};_0x2716b9[_0x3a817e[_0xd31a('0x28')]]={'$like':'%'+_0x5612a2['query']['filter']+'%'};return _0x2716b9;}})});}_0x14a40b=_[_0xd31a('0x3b')]({},_0x14a40b,_0x5612a2[_0xd31a('0x3c')]);var _0x42891a={'where':_0x14a40b['where']};return db[_0xd31a('0x2a')][_0xd31a('0x1e')](_0x42891a)[_0xd31a('0x24')](function(_0x5eaac0){_0x37ec0a[_0xd31a('0x1e')]=_0x5eaac0;if(_0x5612a2[_0xd31a('0x2e')][_0xd31a('0x3d')]){_0x14a40b[_0xd31a('0x3e')]=[{'all':!![]}];}return db['SquareReport'][_0xd31a('0x3f')](_0x14a40b);})['then'](function(_0x138795){_0x37ec0a[_0xd31a('0x40')]=_0x138795;return _0x37ec0a;})[_0xd31a('0x24')](respondWithFilteredResult(_0x2c288c,_0x14a40b))['catch'](handleError(_0x2c288c,null));};exports[_0xd31a('0x41')]=function(_0x3a3591,_0x32ac48){var _0x24cb63={'raw':!![],'where':{'id':_0x3a3591[_0xd31a('0x42')]['id']}},_0x5a0258={};_0x5a0258['model']=_[_0xd31a('0x43')](db[_0xd31a('0x2a')][_0xd31a('0x2b')]);_0x5a0258['query']=_[_0xd31a('0x43')](_0x3a3591['query']);_0x5a0258['filters']=_[_0xd31a('0x30')](_0x5a0258['model'],_0x5a0258[_0xd31a('0x2e')]);_0x24cb63['attributes']=_[_0xd31a('0x30')](_0x5a0258[_0xd31a('0x31')],qs[_0xd31a('0x32')](_0x3a3591[_0xd31a('0x2e')]['fields']));_0x24cb63[_0xd31a('0x33')]=_0x24cb63[_0xd31a('0x33')][_0xd31a('0x34')]?_0x24cb63[_0xd31a('0x33')]:_0x5a0258[_0xd31a('0x31')];if(_0x3a3591[_0xd31a('0x2e')]['includeAll']){_0x24cb63[_0xd31a('0x3e')]=[{'all':!![]}];}_0x24cb63=_['merge']({},_0x24cb63,_0x3a3591['options']);return db[_0xd31a('0x2a')]['find'](_0x24cb63)[_0xd31a('0x24')](handleEntityNotFound(_0x32ac48,null))['then'](respondWithResult(_0x32ac48,null))[_0xd31a('0x44')](handleError(_0x32ac48,null));};exports[_0xd31a('0x45')]=function(_0x24ed17,_0x40c37c){return db['SquareReport'][_0xd31a('0x45')](_0x24ed17[_0xd31a('0x46')],{})[_0xd31a('0x24')](respondWithResult(_0x40c37c,0xc9))[_0xd31a('0x44')](handleError(_0x40c37c,null));};exports[_0xd31a('0x23')]=function(_0x572617,_0x36a732){if(_0x572617[_0xd31a('0x46')]['id']){delete _0x572617[_0xd31a('0x46')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x572617['params']['id']}})['then'](handleEntityNotFound(_0x36a732,null))[_0xd31a('0x24')](saveUpdates(_0x572617['body'],null))[_0xd31a('0x24')](respondWithResult(_0x36a732,null))[_0xd31a('0x44')](handleError(_0x36a732,null));};exports[_0xd31a('0x25')]=function(_0xaa36f3,_0x306b36){return db[_0xd31a('0x2a')]['find']({'where':{'id':_0xaa36f3['params']['id']}})[_0xd31a('0x24')](handleEntityNotFound(_0x306b36,null))[_0xd31a('0x24')](removeEntity(_0x306b36,null))[_0xd31a('0x44')](handleError(_0x306b36,null));};exports[_0xd31a('0x47')]=function(_0x3a162b,_0x371529){return db['SquareReport'][_0xd31a('0x47')]()[_0xd31a('0x24')](respondWithResult(_0x371529,null))[_0xd31a('0x44')](handleError(_0x371529,null));}; \ No newline at end of file +var _0x155d=['name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','nolimit','order','sort','where','pick','filters','merge','filter','then','includeAll','include','findAll','catch','show','length','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','stack'];(function(_0x6e0e23,_0x29d04b){var _0x59947e=function(_0x49cbfc){while(--_0x49cbfc){_0x6e0e23['push'](_0x6e0e23['shift']());}};_0x59947e(++_0x29d04b);}(_0x155d,0xbb));var _0xd155=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x155d[_0x32f7d7];return _0x133d09;};'use strict';var emlformat=require(_0xd155('0x0'));var rimraf=require(_0xd155('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd155('0x2'));var rp=require(_0xd155('0x3'));var moment=require(_0xd155('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd155('0x5'));var util=require(_0xd155('0x6'));var path=require(_0xd155('0x7'));var sox=require(_0xd155('0x8'));var csv=require(_0xd155('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd155('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd155('0xb'));var jsforce=require(_0xd155('0xc'));var deskjs=require(_0xd155('0xd'));var toCsv=require(_0xd155('0x9'));var querystring=require(_0xd155('0xe'));var Papa=require(_0xd155('0xf'));var Redis=require(_0xd155('0x10'));var authService=require(_0xd155('0x11'));var qs=require(_0xd155('0x12'));var as=require(_0xd155('0x13'));var hardwareService=require(_0xd155('0x14'));var logger=require(_0xd155('0x15'))('api');var utils=require(_0xd155('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd155('0x17'));var db=require(_0xd155('0x18'))['db'];function respondWithStatusCode(_0x3bfa9a,_0x421441){_0x421441=_0x421441||0xcc;return function(_0x11473c){if(_0x11473c){return _0x3bfa9a[_0xd155('0x19')](_0x421441);}return _0x3bfa9a[_0xd155('0x1a')](_0x421441)[_0xd155('0x1b')]();};}function respondWithResult(_0x231797,_0x5e86b8){_0x5e86b8=_0x5e86b8||0xc8;return function(_0x1eae5c){if(_0x1eae5c){return _0x231797['status'](_0x5e86b8)[_0xd155('0x1c')](_0x1eae5c);}};}function respondWithFilteredResult(_0x272929,_0xbfd618){return function(_0x1bf639){if(_0x1bf639){var _0x261ec0=typeof _0xbfd618[_0xd155('0x1d')]===_0xd155('0x1e')&&typeof _0xbfd618[_0xd155('0x1f')]===_0xd155('0x1e');var _0x344743=_0x1bf639[_0xd155('0x20')];var _0x48a718=_0x261ec0?0x0:_0xbfd618[_0xd155('0x1d')];var _0x8de5fe=_0x261ec0?_0x1bf639[_0xd155('0x20')]:_0xbfd618[_0xd155('0x1d')]+_0xbfd618[_0xd155('0x1f')];var _0x5496d7;if(_0x8de5fe>=_0x344743){_0x8de5fe=_0x344743;_0x5496d7=0xc8;}else{_0x5496d7=0xce;}_0x272929[_0xd155('0x1a')](_0x5496d7);return _0x272929[_0xd155('0x21')](_0xd155('0x22'),_0x48a718+'-'+_0x8de5fe+'/'+_0x344743)[_0xd155('0x1c')](_0x1bf639);}return null;};}function patchUpdates(_0x52c816){return function(_0x24df8b){try{jsonpatch['apply'](_0x24df8b,_0x52c816,!![]);}catch(_0x139dd3){return BPromise[_0xd155('0x23')](_0x139dd3);}return _0x24df8b[_0xd155('0x24')]();};}function saveUpdates(_0x329057,_0x8eaf35){return function(_0x364289){if(_0x364289){return _0x364289[_0xd155('0x25')](_0x329057)['then'](function(_0x4ca14c){return _0x4ca14c;});}return null;};}function removeEntity(_0x83d737,_0x1cce81){return function(_0x37c519){if(_0x37c519){return _0x37c519[_0xd155('0x26')]()['then'](function(){_0x83d737[_0xd155('0x1a')](0xcc)[_0xd155('0x1b')]();});}};}function handleEntityNotFound(_0x52b4da,_0xd98fdd){return function(_0x4698be){if(!_0x4698be){_0x52b4da['sendStatus'](0x194);}return _0x4698be;};}function handleError(_0x142595,_0x237f65){_0x237f65=_0x237f65||0x1f4;return function(_0x4b4a11){logger[_0xd155('0x27')](_0x4b4a11[_0xd155('0x28')]);if(_0x4b4a11[_0xd155('0x29')]){delete _0x4b4a11[_0xd155('0x29')];}_0x142595[_0xd155('0x1a')](_0x237f65)[_0xd155('0x2a')](_0x4b4a11);};}exports[_0xd155('0x2b')]=function(_0xe36bc0,_0x51e581){var _0x3246c7={},_0x2da86d={},_0x2c07d2={'count':0x0,'rows':[]};var _0x5751cb=_[_0xd155('0x2c')](db[_0xd155('0x2d')][_0xd155('0x2e')],function(_0x45b061){return{'name':_0x45b061[_0xd155('0x2f')],'type':_0x45b061[_0xd155('0x30')][_0xd155('0x31')]};});_0x2da86d[_0xd155('0x32')]=_[_0xd155('0x2c')](_0x5751cb,'name');_0x2da86d['query']=_['keys'](_0xe36bc0[_0xd155('0x33')]);_0x2da86d['filters']=_['intersection'](_0x2da86d[_0xd155('0x32')],_0x2da86d[_0xd155('0x33')]);_0x3246c7[_0xd155('0x34')]=_[_0xd155('0x35')](_0x2da86d[_0xd155('0x32')],qs['fields'](_0xe36bc0[_0xd155('0x33')][_0xd155('0x36')]));_0x3246c7[_0xd155('0x34')]=_0x3246c7[_0xd155('0x34')]['length']?_0x3246c7['attributes']:_0x2da86d[_0xd155('0x32')];if(!_0xe36bc0[_0xd155('0x33')]['hasOwnProperty'](_0xd155('0x37'))){_0x3246c7[_0xd155('0x1f')]=qs[_0xd155('0x1f')](_0xe36bc0[_0xd155('0x33')][_0xd155('0x1f')]);_0x3246c7[_0xd155('0x1d')]=qs['offset'](_0xe36bc0['query'][_0xd155('0x1d')]);}_0x3246c7[_0xd155('0x38')]=qs[_0xd155('0x39')](_0xe36bc0['query'][_0xd155('0x39')]);_0x3246c7[_0xd155('0x3a')]=qs['filters'](_[_0xd155('0x3b')](_0xe36bc0['query'],_0x2da86d[_0xd155('0x3c')]),_0x5751cb);if(_0xe36bc0['query']['filter']){_0x3246c7[_0xd155('0x3a')]=_[_0xd155('0x3d')](_0x3246c7[_0xd155('0x3a')],{'$or':_['map'](_0x5751cb,function(_0x57ae32){if(_0x57ae32[_0xd155('0x30')]!=='VIRTUAL'){var _0x13c2f8={};_0x13c2f8[_0x57ae32[_0xd155('0x29')]]={'$like':'%'+_0xe36bc0[_0xd155('0x33')][_0xd155('0x3e')]+'%'};return _0x13c2f8;}})});}_0x3246c7=_[_0xd155('0x3d')]({},_0x3246c7,_0xe36bc0['options']);var _0x498738={'where':_0x3246c7['where']};return db['SquareReport'][_0xd155('0x20')](_0x498738)[_0xd155('0x3f')](function(_0x55095d){_0x2c07d2[_0xd155('0x20')]=_0x55095d;if(_0xe36bc0[_0xd155('0x33')][_0xd155('0x40')]){_0x3246c7[_0xd155('0x41')]=[{'all':!![]}];}return db['SquareReport'][_0xd155('0x42')](_0x3246c7);})['then'](function(_0x247d95){_0x2c07d2['rows']=_0x247d95;return _0x2c07d2;})[_0xd155('0x3f')](respondWithFilteredResult(_0x51e581,_0x3246c7))[_0xd155('0x43')](handleError(_0x51e581,null));};exports[_0xd155('0x44')]=function(_0x15643c,_0x162253){var _0x5784ad={'raw':!![],'where':{'id':_0x15643c['params']['id']}},_0x1c1df4={};_0x1c1df4['model']=_['keys'](db[_0xd155('0x2d')][_0xd155('0x2e')]);_0x1c1df4['query']=_['keys'](_0x15643c[_0xd155('0x33')]);_0x1c1df4['filters']=_[_0xd155('0x35')](_0x1c1df4['model'],_0x1c1df4['query']);_0x5784ad[_0xd155('0x34')]=_[_0xd155('0x35')](_0x1c1df4[_0xd155('0x32')],qs[_0xd155('0x36')](_0x15643c[_0xd155('0x33')][_0xd155('0x36')]));_0x5784ad[_0xd155('0x34')]=_0x5784ad['attributes'][_0xd155('0x45')]?_0x5784ad[_0xd155('0x34')]:_0x1c1df4[_0xd155('0x32')];if(_0x15643c['query']['includeAll']){_0x5784ad[_0xd155('0x41')]=[{'all':!![]}];}_0x5784ad=_[_0xd155('0x3d')]({},_0x5784ad,_0x15643c[_0xd155('0x46')]);return db[_0xd155('0x2d')][_0xd155('0x47')](_0x5784ad)[_0xd155('0x3f')](handleEntityNotFound(_0x162253,null))[_0xd155('0x3f')](respondWithResult(_0x162253,null))[_0xd155('0x43')](handleError(_0x162253,null));};exports['create']=function(_0x762352,_0x372385){return db['SquareReport'][_0xd155('0x48')](_0x762352[_0xd155('0x49')],{})[_0xd155('0x3f')](respondWithResult(_0x372385,0xc9))[_0xd155('0x43')](handleError(_0x372385,null));};exports[_0xd155('0x25')]=function(_0x2ed907,_0xd2d651){if(_0x2ed907[_0xd155('0x49')]['id']){delete _0x2ed907['body']['id'];}return db[_0xd155('0x2d')][_0xd155('0x47')]({'where':{'id':_0x2ed907[_0xd155('0x4a')]['id']}})[_0xd155('0x3f')](handleEntityNotFound(_0xd2d651,null))['then'](saveUpdates(_0x2ed907[_0xd155('0x49')],null))['then'](respondWithResult(_0xd2d651,null))['catch'](handleError(_0xd2d651,null));};exports[_0xd155('0x26')]=function(_0x27b786,_0x13ca90){return db[_0xd155('0x2d')][_0xd155('0x47')]({'where':{'id':_0x27b786[_0xd155('0x4a')]['id']}})[_0xd155('0x3f')](handleEntityNotFound(_0x13ca90,null))[_0xd155('0x3f')](removeEntity(_0x13ca90,null))[_0xd155('0x43')](handleError(_0x13ca90,null));};exports[_0xd155('0x4b')]=function(_0x2de516,_0x44746d){return db[_0xd155('0x2d')]['describe']()[_0xd155('0x3f')](respondWithResult(_0x44746d,null))[_0xd155('0x43')](handleError(_0x44746d,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index a901095..6d4d41f 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 _0x81ae=['lodash','util','api','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','report_square','uniqueid','project_name','leaveAt'];(function(_0x3fa9ce,_0x2bed6c){var _0x495007=function(_0x36401e){while(--_0x36401e){_0x3fa9ce['push'](_0x3fa9ce['shift']());}};_0x495007(++_0x2bed6c);}(_0x81ae,0x111));var _0xe81a=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x81ae[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xe81a('0x0'));var util=require(_0xe81a('0x1'));var logger=require('../../config/logger')(_0xe81a('0x2'));var moment=require('moment');var BPromise=require(_0xe81a('0x3'));var rp=require(_0xe81a('0x4'));var fs=require('fs');var path=require(_0xe81a('0x5'));var rimraf=require('rimraf');var config=require(_0xe81a('0x6'));var attributes=require(_0xe81a('0x7'));module[_0xe81a('0x8')]=function(_0x2d5b16,_0x515680){return _0x2d5b16['define']('SquareReport',attributes,{'tableName':_0xe81a('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xe81a('0xa'),_0xe81a('0xb')]},{'name':_0xe81a('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x709a=['project_name','leaveAt','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','define','report_square','uid_pname','uniqueid'];(function(_0x3c4276,_0x21d8b0){var _0x31e4ab=function(_0x332a82){while(--_0x332a82){_0x3c4276['push'](_0x3c4276['shift']());}};_0x31e4ab(++_0x21d8b0);}(_0x709a,0xb8));var _0xa709=function(_0x4febf1,_0x177ce7){_0x4febf1=_0x4febf1-0x0;var _0x1f9b8b=_0x709a[_0x4febf1];return _0x1f9b8b;};'use strict';var _=require(_0xa709('0x0'));var util=require('util');var logger=require(_0xa709('0x1'))('api');var moment=require(_0xa709('0x2'));var BPromise=require(_0xa709('0x3'));var rp=require(_0xa709('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa709('0x5'));var config=require(_0xa709('0x6'));var attributes=require(_0xa709('0x7'));module['exports']=function(_0x47c53e,_0x226f7b){return _0x47c53e[_0xa709('0x8')]('SquareReport',attributes,{'tableName':_0xa709('0x9'),'paranoid':![],'indexes':[{'name':_0xa709('0xa'),'fields':[_0xa709('0xb'),_0xa709('0xc')]},{'name':'leaveAt','fields':[_0xa709('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 7194422..8bdf734 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 _0x2ec1=['SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','body','options','raw','UpdateSquareReport','where','attributes','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info'];(function(_0x493c97,_0x317a51){var _0x22ec93=function(_0x675b09){while(--_0x675b09){_0x493c97['push'](_0x493c97['shift']());}};_0x22ec93(++_0x317a51);}(_0x2ec1,0x19a));var _0x12ec=function(_0x356beb,_0x308032){_0x356beb=_0x356beb-0x0;var _0x4e2281=_0x2ec1[_0x356beb];return _0x4e2281;};'use strict';var _=require(_0x12ec('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x12ec('0x1'));var db=require(_0x12ec('0x2'))['db'];var utils=require(_0x12ec('0x3'));var logger=require(_0x12ec('0x4'))('rpc');var config=require(_0x12ec('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x12ec('0x6')][_0x12ec('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x18dd9d,_0xed5e2,_0x3004cd){return new BPromise(function(_0x57e993,_0x31fea1){return client['request'](_0x18dd9d,_0x3004cd)[_0x12ec('0x8')](function(_0x6da373){logger[_0x12ec('0x9')](_0x12ec('0xa'),_0xed5e2,'request\x20sent');logger[_0x12ec('0xb')](_0x12ec('0xc'),_0xed5e2,_0x12ec('0xd'),JSON[_0x12ec('0xe')](_0x6da373));if(_0x6da373['error']){if(_0x6da373[_0x12ec('0xf')][_0x12ec('0x10')]===0x1f4){logger[_0x12ec('0xf')](_0x12ec('0xa'),_0xed5e2,_0x6da373['error']['message']);return _0x31fea1(_0x6da373[_0x12ec('0xf')][_0x12ec('0x11')]);}logger[_0x12ec('0xf')](_0x12ec('0xa'),_0xed5e2,_0x6da373[_0x12ec('0xf')][_0x12ec('0x11')]);return _0x57e993(_0x6da373['error'][_0x12ec('0x11')]);}else{logger[_0x12ec('0x9')](_0x12ec('0xa'),_0xed5e2,_0x12ec('0xd'));_0x57e993(_0x6da373[_0x12ec('0x12')][_0x12ec('0x11')]);}})[_0x12ec('0x13')](function(_0xae6105){logger[_0x12ec('0xf')]('SquareReport,\x20%s,\x20%s',_0xed5e2,_0xae6105);_0x31fea1(_0xae6105);});});}exports[_0x12ec('0x14')]=function(_0x1e9dac){var _0x17a69=this;return new Promise(function(_0x42565f,_0x3c96f4){return db[_0x12ec('0x15')]['create'](_0x1e9dac[_0x12ec('0x16')],{'raw':_0x1e9dac['options']?_0x1e9dac[_0x12ec('0x17')][_0x12ec('0x18')]===undefined?!![]:![]:!![]})[_0x12ec('0x8')](function(_0x4e9473){logger[_0x12ec('0x9')](_0x12ec('0x14'),_0x1e9dac);logger[_0x12ec('0xb')]('CreateSquareReport',_0x1e9dac,JSON[_0x12ec('0xe')](_0x4e9473));_0x42565f(_0x4e9473);})[_0x12ec('0x13')](function(_0x4539e3){logger['error']('CreateSquareReport',_0x4539e3['message'],_0x1e9dac);_0x3c96f4(_0x17a69['error'](0x1f4,_0x4539e3['message']));});});};exports[_0x12ec('0x19')]=function(_0x38c0f0){var _0x4a4052=this;return new Promise(function(_0x547ad6,_0x4ac4d8){return db[_0x12ec('0x15')]['update'](_0x38c0f0[_0x12ec('0x16')],{'raw':_0x38c0f0[_0x12ec('0x17')]?_0x38c0f0[_0x12ec('0x17')][_0x12ec('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38c0f0['options']?_0x38c0f0['options'][_0x12ec('0x1a')]||null:null,'attributes':_0x38c0f0[_0x12ec('0x17')]?_0x38c0f0[_0x12ec('0x17')][_0x12ec('0x1b')]||null:null,'limit':_0x38c0f0[_0x12ec('0x17')]?_0x38c0f0[_0x12ec('0x17')]['limit']||null:null})[_0x12ec('0x8')](function(_0x41f030){logger[_0x12ec('0x9')](_0x12ec('0x19'),_0x38c0f0);logger[_0x12ec('0xb')](_0x12ec('0x19'),_0x38c0f0,JSON[_0x12ec('0xe')](_0x41f030));_0x547ad6(_0x41f030);})[_0x12ec('0x13')](function(_0x524c96){logger['error']('UpdateSquareReport',_0x524c96['message'],_0x38c0f0);_0x4ac4d8(_0x4a4052[_0x12ec('0xf')](0x1f4,_0x524c96[_0x12ec('0x11')]));});});}; \ No newline at end of file +var _0xcf55=['../../config/environment','jayson/promise','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateSquareReport','SquareReport','create','options','raw','UpdateSquareReport','update','body','where','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3ba7c7,_0x3e3980){var _0x1f71fb=function(_0x3c97d5){while(--_0x3c97d5){_0x3ba7c7['push'](_0x3ba7c7['shift']());}};_0x1f71fb(++_0x3e3980);}(_0xcf55,0x100));var _0x5cf5=function(_0x3f07a1,_0x2db68a){_0x3f07a1=_0x3f07a1-0x0;var _0x5d421a=_0xcf55[_0x3f07a1];return _0x5d421a;};'use strict';var _=require('lodash');var util=require(_0x5cf5('0x0'));var moment=require(_0x5cf5('0x1'));var BPromise=require(_0x5cf5('0x2'));var rs=require(_0x5cf5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5cf5('0x4'))['db'];var utils=require(_0x5cf5('0x5'));var logger=require(_0x5cf5('0x6'))(_0x5cf5('0x7'));var config=require(_0x5cf5('0x8'));var jayson=require(_0x5cf5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7e4526,_0x119119,_0x4181e3){return new BPromise(function(_0x3e982a,_0x117eca){return client['request'](_0x7e4526,_0x4181e3)[_0x5cf5('0xa')](function(_0x560175){logger[_0x5cf5('0xb')](_0x5cf5('0xc'),_0x119119,'request\x20sent');logger[_0x5cf5('0xd')](_0x5cf5('0xe'),_0x119119,'request\x20sent',JSON[_0x5cf5('0xf')](_0x560175));if(_0x560175[_0x5cf5('0x10')]){if(_0x560175[_0x5cf5('0x10')][_0x5cf5('0x11')]===0x1f4){logger[_0x5cf5('0x10')](_0x5cf5('0xc'),_0x119119,_0x560175[_0x5cf5('0x10')]['message']);return _0x117eca(_0x560175[_0x5cf5('0x10')][_0x5cf5('0x12')]);}logger[_0x5cf5('0x10')](_0x5cf5('0xc'),_0x119119,_0x560175[_0x5cf5('0x10')]['message']);return _0x3e982a(_0x560175[_0x5cf5('0x10')]['message']);}else{logger[_0x5cf5('0xb')](_0x5cf5('0xc'),_0x119119,_0x5cf5('0x13'));_0x3e982a(_0x560175[_0x5cf5('0x14')][_0x5cf5('0x12')]);}})[_0x5cf5('0x15')](function(_0x52a402){logger[_0x5cf5('0x10')](_0x5cf5('0xc'),_0x119119,_0x52a402);_0x117eca(_0x52a402);});});}exports[_0x5cf5('0x16')]=function(_0x11b821){var _0x352cb2=this;return new Promise(function(_0x2b2164,_0x5e507d){return db[_0x5cf5('0x17')][_0x5cf5('0x18')](_0x11b821['body'],{'raw':_0x11b821[_0x5cf5('0x19')]?_0x11b821[_0x5cf5('0x19')][_0x5cf5('0x1a')]===undefined?!![]:![]:!![]})[_0x5cf5('0xa')](function(_0x1365e4){logger[_0x5cf5('0xb')]('CreateSquareReport',_0x11b821);logger['debug'](_0x5cf5('0x16'),_0x11b821,JSON['stringify'](_0x1365e4));_0x2b2164(_0x1365e4);})[_0x5cf5('0x15')](function(_0x24c0f7){logger['error'](_0x5cf5('0x16'),_0x24c0f7[_0x5cf5('0x12')],_0x11b821);_0x5e507d(_0x352cb2['error'](0x1f4,_0x24c0f7['message']));});});};exports[_0x5cf5('0x1b')]=function(_0x3f6d0b){var _0x3f8446=this;return new Promise(function(_0x333156,_0x11a867){return db[_0x5cf5('0x17')][_0x5cf5('0x1c')](_0x3f6d0b[_0x5cf5('0x1d')],{'raw':_0x3f6d0b[_0x5cf5('0x19')]?_0x3f6d0b[_0x5cf5('0x19')][_0x5cf5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f6d0b['options']?_0x3f6d0b[_0x5cf5('0x19')][_0x5cf5('0x1e')]||null:null,'attributes':_0x3f6d0b[_0x5cf5('0x19')]?_0x3f6d0b[_0x5cf5('0x19')][_0x5cf5('0x1f')]||null:null,'limit':_0x3f6d0b[_0x5cf5('0x19')]?_0x3f6d0b[_0x5cf5('0x19')][_0x5cf5('0x20')]||null:null})[_0x5cf5('0xa')](function(_0x422142){logger[_0x5cf5('0xb')]('UpdateSquareReport',_0x3f6d0b);logger[_0x5cf5('0xd')](_0x5cf5('0x1b'),_0x3f6d0b,JSON[_0x5cf5('0xf')](_0x422142));_0x333156(_0x422142);})[_0x5cf5('0x15')](function(_0x1be4e6){logger[_0x5cf5('0x10')](_0x5cf5('0x1b'),_0x1be4e6[_0x5cf5('0x12')],_0x3f6d0b);_0x11a867(_0x3f8446[_0x5cf5('0x10')](0x1f4,_0x1be4e6[_0x5cf5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index bada6b7..0a1b1f0 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 _0x4f41=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','util','path','Router','fs-extra'];(function(_0x419ab2,_0x2a7e6d){var _0x173304=function(_0x3c6049){while(--_0x3c6049){_0x419ab2['push'](_0x419ab2['shift']());}};_0x173304(++_0x2a7e6d);}(_0x4f41,0xd4));var _0x14f4=function(_0x3d0098,_0x22ee82){_0x3d0098=_0x3d0098-0x0;var _0x3ef587=_0x4f41[_0x3d0098];return _0x3ef587;};'use strict';var multer=require('multer');var util=require(_0x14f4('0x0'));var path=require(_0x14f4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x14f4('0x2')]();var fs_extra=require(_0x14f4('0x3'));var auth=require(_0x14f4('0x4'));var interaction=require(_0x14f4('0x5'));var config=require(_0x14f4('0x6'));var controller=require('./squareReportDetail.controller');router[_0x14f4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x14f4('0x7')](_0x14f4('0x8'),auth[_0x14f4('0x9')](),controller['describe']);router['get'](_0x14f4('0xa'),auth[_0x14f4('0x9')](),controller[_0x14f4('0xb')]);router[_0x14f4('0xc')]('/',auth[_0x14f4('0x9')](),controller['create']);router[_0x14f4('0xd')](_0x14f4('0xa'),auth[_0x14f4('0x9')](),controller[_0x14f4('0xe')]);router[_0x14f4('0xf')](_0x14f4('0xa'),auth['isAuthenticated'](),controller[_0x14f4('0x10')]);module[_0x14f4('0x11')]=router; \ No newline at end of file +var _0xf703=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x414453,_0x35c44f){var _0x562b4c=function(_0x1b6648){while(--_0x1b6648){_0x414453['push'](_0x414453['shift']());}};_0x562b4c(++_0x35c44f);}(_0xf703,0x6c));var _0x3f70=function(_0x17fc08,_0x3cac71){_0x17fc08=_0x17fc08-0x0;var _0x22f4a4=_0xf703[_0x17fc08];return _0x22f4a4;};'use strict';var multer=require(_0x3f70('0x0'));var util=require(_0x3f70('0x1'));var path=require(_0x3f70('0x2'));var timeout=require('connect-timeout');var express=require(_0x3f70('0x3'));var router=express[_0x3f70('0x4')]();var fs_extra=require(_0x3f70('0x5'));var auth=require(_0x3f70('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3f70('0x7'));var controller=require('./squareReportDetail.controller');router[_0x3f70('0x8')]('/',auth[_0x3f70('0x9')](),controller[_0x3f70('0xa')]);router[_0x3f70('0x8')](_0x3f70('0xb'),auth[_0x3f70('0x9')](),controller[_0x3f70('0xc')]);router[_0x3f70('0x8')](_0x3f70('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x3f70('0xe')]('/',auth[_0x3f70('0x9')](),controller[_0x3f70('0xf')]);router['put'](_0x3f70('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x3f70('0x10')](_0x3f70('0xd'),auth[_0x3f70('0x9')](),controller[_0x3f70('0x11')]);module[_0x3f70('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 8d356cb..09dfe30 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 _0xce8e=['sequelize','exports','STRING','TEXT'];(function(_0x451217,_0x2f896b){var _0x5060a3=function(_0x494679){while(--_0x494679){_0x451217['push'](_0x451217['shift']());}};_0x5060a3(++_0x2f896b);}(_0xce8e,0x1f4));var _0xece8=function(_0x59c8c8,_0x87d8de){_0x59c8c8=_0x59c8c8-0x0;var _0x20d93f=_0xce8e[_0x59c8c8];return _0x20d93f;};'use strict';var Sequelize=require(_0xece8('0x0'));module[_0xece8('0x1')]={'uniqueid':{'type':Sequelize[_0xece8('0x2')]},'node':{'type':Sequelize[_0xece8('0x2')]},'application':{'type':Sequelize[_0xece8('0x2')]},'data':{'type':Sequelize[_0xece8('0x3')]},'project_name':{'type':Sequelize[_0xece8('0x2')]},'callerid':{'type':Sequelize[_0xece8('0x2')]}}; \ No newline at end of file +var _0x8ca8=['sequelize','exports','STRING'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x8ca8,0x138));var _0x88ca=function(_0xa5f98d,_0x48525f){_0xa5f98d=_0xa5f98d-0x0;var _0x59b0af=_0x8ca8[_0xa5f98d];return _0x59b0af;};'use strict';var Sequelize=require(_0x88ca('0x0'));module[_0x88ca('0x1')]={'uniqueid':{'type':Sequelize[_0x88ca('0x2')]},'node':{'type':Sequelize[_0x88ca('0x2')]},'application':{'type':Sequelize[_0x88ca('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x88ca('0x2')]},'callerid':{'type':Sequelize[_0x88ca('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 1353d31..972670d 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 _0x92ab=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','SquareDetailsReport','findAll','rows','catch','show','options','create','update','body','find','params','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','query','keys'];(function(_0x39f375,_0x3aa8ec){var _0x463f93=function(_0x290215){while(--_0x290215){_0x39f375['push'](_0x39f375['shift']());}};_0x463f93(++_0x3aa8ec);}(_0x92ab,0x193));var _0xb92a=function(_0x14712c,_0x5920f5){_0x14712c=_0x14712c-0x0;var _0x58f6a0=_0x92ab[_0x14712c];return _0x58f6a0;};'use strict';var emlformat=require(_0xb92a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb92a('0x1'));var rp=require(_0xb92a('0x2'));var moment=require('moment');var BPromise=require(_0xb92a('0x3'));var Mustache=require(_0xb92a('0x4'));var util=require(_0xb92a('0x5'));var path=require(_0xb92a('0x6'));var sox=require(_0xb92a('0x7'));var csv=require('to-csv');var ejs=require(_0xb92a('0x8'));var fs=require('fs');var fs_extra=require(_0xb92a('0x9'));var _=require('lodash');var squel=require(_0xb92a('0xa'));var crypto=require(_0xb92a('0xb'));var jsforce=require(_0xb92a('0xc'));var deskjs=require(_0xb92a('0xd'));var toCsv=require(_0xb92a('0xe'));var querystring=require(_0xb92a('0xf'));var Papa=require(_0xb92a('0x10'));var Redis=require(_0xb92a('0x11'));var authService=require(_0xb92a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb92a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb92a('0x14'));var utils=require(_0xb92a('0x15'));var config=require(_0xb92a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb92a('0x17'))['db'];function respondWithStatusCode(_0xd1170,_0x372eb4){_0x372eb4=_0x372eb4||0xcc;return function(_0x3a292b){if(_0x3a292b){return _0xd1170[_0xb92a('0x18')](_0x372eb4);}return _0xd1170[_0xb92a('0x19')](_0x372eb4)['end']();};}function respondWithResult(_0x207880,_0x3271b4){_0x3271b4=_0x3271b4||0xc8;return function(_0x2b6fae){if(_0x2b6fae){return _0x207880[_0xb92a('0x19')](_0x3271b4)[_0xb92a('0x1a')](_0x2b6fae);}};}function respondWithFilteredResult(_0x3a4dd2,_0x48df29){return function(_0x5c7b4b){if(_0x5c7b4b){var _0x3e49c8=typeof _0x48df29[_0xb92a('0x1b')]===_0xb92a('0x1c')&&typeof _0x48df29[_0xb92a('0x1d')]===_0xb92a('0x1c');var _0x5c368b=_0x5c7b4b[_0xb92a('0x1e')];var _0x254704=_0x3e49c8?0x0:_0x48df29[_0xb92a('0x1b')];var _0xf5040d=_0x3e49c8?_0x5c7b4b['count']:_0x48df29[_0xb92a('0x1b')]+_0x48df29[_0xb92a('0x1d')];var _0x538f5f;if(_0xf5040d>=_0x5c368b){_0xf5040d=_0x5c368b;_0x538f5f=0xc8;}else{_0x538f5f=0xce;}_0x3a4dd2[_0xb92a('0x19')](_0x538f5f);return _0x3a4dd2['set']('Content-Range',_0x254704+'-'+_0xf5040d+'/'+_0x5c368b)['json'](_0x5c7b4b);}return null;};}function patchUpdates(_0x5be50f){return function(_0x2a6d9e){try{jsonpatch[_0xb92a('0x1f')](_0x2a6d9e,_0x5be50f,!![]);}catch(_0x453e2e){return BPromise['reject'](_0x453e2e);}return _0x2a6d9e[_0xb92a('0x20')]();};}function saveUpdates(_0x21440d,_0x190118){return function(_0x39fe42){if(_0x39fe42){return _0x39fe42['update'](_0x21440d)[_0xb92a('0x21')](function(_0x2ae348){return _0x2ae348;});}return null;};}function removeEntity(_0x597258,_0x38a1d7){return function(_0x210e0f){if(_0x210e0f){return _0x210e0f[_0xb92a('0x22')]()[_0xb92a('0x21')](function(){_0x597258[_0xb92a('0x19')](0xcc)[_0xb92a('0x23')]();});}};}function handleEntityNotFound(_0x5b7f77,_0x12249b){return function(_0x29805a){if(!_0x29805a){_0x5b7f77[_0xb92a('0x18')](0x194);}return _0x29805a;};}function handleError(_0x33ab7f,_0x1b4f1b){_0x1b4f1b=_0x1b4f1b||0x1f4;return function(_0xfc464c){logger[_0xb92a('0x24')](_0xfc464c[_0xb92a('0x25')]);if(_0xfc464c[_0xb92a('0x26')]){delete _0xfc464c[_0xb92a('0x26')];}_0x33ab7f[_0xb92a('0x19')](_0x1b4f1b)[_0xb92a('0x27')](_0xfc464c);};}exports[_0xb92a('0x28')]=function(_0x27473b,_0x568ca8){var _0x5eb49d={},_0x38ecc3={},_0x43d97a={'count':0x0,'rows':[]};var _0x4c1155=_[_0xb92a('0x29')](db['SquareDetailsReport'][_0xb92a('0x2a')],function(_0x5580a8){return{'name':_0x5580a8['fieldName'],'type':_0x5580a8[_0xb92a('0x2b')][_0xb92a('0x2c')]};});_0x38ecc3['model']=_['map'](_0x4c1155,_0xb92a('0x26'));_0x38ecc3[_0xb92a('0x2d')]=_[_0xb92a('0x2e')](_0x27473b[_0xb92a('0x2d')]);_0x38ecc3['filters']=_[_0xb92a('0x2f')](_0x38ecc3[_0xb92a('0x30')],_0x38ecc3[_0xb92a('0x2d')]);_0x5eb49d[_0xb92a('0x31')]=_[_0xb92a('0x2f')](_0x38ecc3[_0xb92a('0x30')],qs[_0xb92a('0x32')](_0x27473b['query']['fields']));_0x5eb49d[_0xb92a('0x31')]=_0x5eb49d['attributes'][_0xb92a('0x33')]?_0x5eb49d[_0xb92a('0x31')]:_0x38ecc3[_0xb92a('0x30')];if(!_0x27473b[_0xb92a('0x2d')][_0xb92a('0x34')](_0xb92a('0x35'))){_0x5eb49d[_0xb92a('0x1d')]=qs[_0xb92a('0x1d')](_0x27473b[_0xb92a('0x2d')][_0xb92a('0x1d')]);_0x5eb49d[_0xb92a('0x1b')]=qs['offset'](_0x27473b[_0xb92a('0x2d')][_0xb92a('0x1b')]);}_0x5eb49d[_0xb92a('0x36')]=qs[_0xb92a('0x37')](_0x27473b[_0xb92a('0x2d')]['sort']);_0x5eb49d[_0xb92a('0x38')]=qs[_0xb92a('0x39')](_['pick'](_0x27473b[_0xb92a('0x2d')],_0x38ecc3[_0xb92a('0x39')]),_0x4c1155);if(_0x27473b[_0xb92a('0x2d')][_0xb92a('0x3a')]){_0x5eb49d['where']=_[_0xb92a('0x3b')](_0x5eb49d['where'],{'$or':_[_0xb92a('0x29')](_0x4c1155,function(_0x49aa58){if(_0x49aa58[_0xb92a('0x2b')]!==_0xb92a('0x3c')){var _0x509749={};_0x509749[_0x49aa58['name']]={'$like':'%'+_0x27473b[_0xb92a('0x2d')][_0xb92a('0x3a')]+'%'};return _0x509749;}})});}_0x5eb49d=_['merge']({},_0x5eb49d,_0x27473b['options']);var _0xcff970={'where':_0x5eb49d[_0xb92a('0x38')]};return db['SquareDetailsReport'][_0xb92a('0x1e')](_0xcff970)['then'](function(_0xc7189b){_0x43d97a[_0xb92a('0x1e')]=_0xc7189b;if(_0x27473b[_0xb92a('0x2d')][_0xb92a('0x3d')]){_0x5eb49d[_0xb92a('0x3e')]=[{'all':!![]}];}return db[_0xb92a('0x3f')][_0xb92a('0x40')](_0x5eb49d);})[_0xb92a('0x21')](function(_0xd3e280){_0x43d97a[_0xb92a('0x41')]=_0xd3e280;return _0x43d97a;})[_0xb92a('0x21')](respondWithFilteredResult(_0x568ca8,_0x5eb49d))[_0xb92a('0x42')](handleError(_0x568ca8,null));};exports[_0xb92a('0x43')]=function(_0x5640a8,_0x26fe14){var _0x12759b={'raw':!![],'where':{'id':_0x5640a8['params']['id']}},_0x325e4a={};_0x325e4a['model']=_['keys'](db[_0xb92a('0x3f')][_0xb92a('0x2a')]);_0x325e4a[_0xb92a('0x2d')]=_[_0xb92a('0x2e')](_0x5640a8[_0xb92a('0x2d')]);_0x325e4a['filters']=_[_0xb92a('0x2f')](_0x325e4a['model'],_0x325e4a['query']);_0x12759b['attributes']=_[_0xb92a('0x2f')](_0x325e4a[_0xb92a('0x30')],qs['fields'](_0x5640a8[_0xb92a('0x2d')][_0xb92a('0x32')]));_0x12759b[_0xb92a('0x31')]=_0x12759b['attributes'][_0xb92a('0x33')]?_0x12759b[_0xb92a('0x31')]:_0x325e4a[_0xb92a('0x30')];if(_0x5640a8[_0xb92a('0x2d')][_0xb92a('0x3d')]){_0x12759b[_0xb92a('0x3e')]=[{'all':!![]}];}_0x12759b=_['merge']({},_0x12759b,_0x5640a8[_0xb92a('0x44')]);return db[_0xb92a('0x3f')]['find'](_0x12759b)['then'](handleEntityNotFound(_0x26fe14,null))[_0xb92a('0x21')](respondWithResult(_0x26fe14,null))['catch'](handleError(_0x26fe14,null));};exports[_0xb92a('0x45')]=function(_0x5a04b3,_0x3f6cda){return db[_0xb92a('0x3f')][_0xb92a('0x45')](_0x5a04b3['body'],{})[_0xb92a('0x21')](respondWithResult(_0x3f6cda,0xc9))[_0xb92a('0x42')](handleError(_0x3f6cda,null));};exports[_0xb92a('0x46')]=function(_0x2a1d67,_0x44f62b){if(_0x2a1d67['body']['id']){delete _0x2a1d67[_0xb92a('0x47')]['id'];}return db[_0xb92a('0x3f')][_0xb92a('0x48')]({'where':{'id':_0x2a1d67[_0xb92a('0x49')]['id']}})['then'](handleEntityNotFound(_0x44f62b,null))['then'](saveUpdates(_0x2a1d67[_0xb92a('0x47')],null))['then'](respondWithResult(_0x44f62b,null))['catch'](handleError(_0x44f62b,null));};exports[_0xb92a('0x22')]=function(_0x5598af,_0x8b6a4f){return db[_0xb92a('0x3f')][_0xb92a('0x48')]({'where':{'id':_0x5598af[_0xb92a('0x49')]['id']}})[_0xb92a('0x21')](handleEntityNotFound(_0x8b6a4f,null))['then'](removeEntity(_0x8b6a4f,null))[_0xb92a('0x42')](handleError(_0x8b6a4f,null));};exports[_0xb92a('0x4a')]=function(_0x5513cf,_0x352f4d){return db[_0xb92a('0x3f')][_0xb92a('0x4a')]()[_0xb92a('0x21')](respondWithResult(_0x352f4d,null))[_0xb92a('0x42')](handleError(_0x352f4d,null));}; \ No newline at end of file +var _0xce0a=['length','includeAll','options','find','create','body','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','save','destroy','end','error','stack','name','send','index','map','fieldName','key','model','query','intersection','fields','attributes','order','sort','filters','filter','where','merge','type','VIRTUAL','SquareDetailsReport','then','findAll','catch','show','params','keys','rawAttributes'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xce0a,0x1a4));var _0xace0=function(_0x347399,_0x42bbda){_0x347399=_0x347399-0x0;var _0x24e7be=_0xce0a[_0x347399];return _0x24e7be;};'use strict';var emlformat=require(_0xace0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xace0('0x1'));var jsonpatch=require(_0xace0('0x2'));var rp=require('request-promise');var moment=require(_0xace0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xace0('0x4'));var util=require(_0xace0('0x5'));var path=require(_0xace0('0x6'));var sox=require(_0xace0('0x7'));var csv=require(_0xace0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xace0('0x9'));var _=require(_0xace0('0xa'));var squel=require(_0xace0('0xb'));var crypto=require('crypto');var jsforce=require(_0xace0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xace0('0x8'));var querystring=require(_0xace0('0xd'));var Papa=require(_0xace0('0xe'));var Redis=require(_0xace0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xace0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xace0('0x11'))(_0xace0('0x12'));var utils=require('../../config/utils');var config=require(_0xace0('0x13'));var licenseUtil=require(_0xace0('0x14'));var db=require(_0xace0('0x15'))['db'];function respondWithStatusCode(_0x3b7b6e,_0x23ce30){_0x23ce30=_0x23ce30||0xcc;return function(_0xc39af4){if(_0xc39af4){return _0x3b7b6e[_0xace0('0x16')](_0x23ce30);}return _0x3b7b6e[_0xace0('0x17')](_0x23ce30)['end']();};}function respondWithResult(_0x26b84b,_0x1c7b9f){_0x1c7b9f=_0x1c7b9f||0xc8;return function(_0x1067e8){if(_0x1067e8){return _0x26b84b[_0xace0('0x17')](_0x1c7b9f)[_0xace0('0x18')](_0x1067e8);}};}function respondWithFilteredResult(_0x23b991,_0x1857d1){return function(_0x54fbea){if(_0x54fbea){var _0x30b728=typeof _0x1857d1[_0xace0('0x19')]==='undefined'&&typeof _0x1857d1[_0xace0('0x1a')]===_0xace0('0x1b');var _0xe1ec02=_0x54fbea[_0xace0('0x1c')];var _0x14be18=_0x30b728?0x0:_0x1857d1[_0xace0('0x19')];var _0x1c2b69=_0x30b728?_0x54fbea[_0xace0('0x1c')]:_0x1857d1[_0xace0('0x19')]+_0x1857d1[_0xace0('0x1a')];var _0x1db754;if(_0x1c2b69>=_0xe1ec02){_0x1c2b69=_0xe1ec02;_0x1db754=0xc8;}else{_0x1db754=0xce;}_0x23b991['status'](_0x1db754);return _0x23b991[_0xace0('0x1d')](_0xace0('0x1e'),_0x14be18+'-'+_0x1c2b69+'/'+_0xe1ec02)[_0xace0('0x18')](_0x54fbea);}return null;};}function patchUpdates(_0x2c3007){return function(_0x35ce49){try{jsonpatch['apply'](_0x35ce49,_0x2c3007,!![]);}catch(_0xf89f0){return BPromise['reject'](_0xf89f0);}return _0x35ce49[_0xace0('0x1f')]();};}function saveUpdates(_0x115993,_0x2721d6){return function(_0x193f24){if(_0x193f24){return _0x193f24['update'](_0x115993)['then'](function(_0x4476b4){return _0x4476b4;});}return null;};}function removeEntity(_0x3a2d3d,_0x470e81){return function(_0x31ce0a){if(_0x31ce0a){return _0x31ce0a[_0xace0('0x20')]()['then'](function(){_0x3a2d3d[_0xace0('0x17')](0xcc)[_0xace0('0x21')]();});}};}function handleEntityNotFound(_0x4dd09f,_0x5d5645){return function(_0x27e1b2){if(!_0x27e1b2){_0x4dd09f[_0xace0('0x16')](0x194);}return _0x27e1b2;};}function handleError(_0x2ee323,_0x22d22f){_0x22d22f=_0x22d22f||0x1f4;return function(_0xfc518b){logger[_0xace0('0x22')](_0xfc518b[_0xace0('0x23')]);if(_0xfc518b[_0xace0('0x24')]){delete _0xfc518b['name'];}_0x2ee323[_0xace0('0x17')](_0x22d22f)[_0xace0('0x25')](_0xfc518b);};}exports[_0xace0('0x26')]=function(_0x42727d,_0x2337f1){var _0x5042e1={},_0x29236a={},_0x3e49ae={'count':0x0,'rows':[]};var _0x49005a=_[_0xace0('0x27')](db['SquareDetailsReport']['rawAttributes'],function(_0x37b5d0){return{'name':_0x37b5d0[_0xace0('0x28')],'type':_0x37b5d0['type'][_0xace0('0x29')]};});_0x29236a[_0xace0('0x2a')]=_[_0xace0('0x27')](_0x49005a,_0xace0('0x24'));_0x29236a['query']=_['keys'](_0x42727d[_0xace0('0x2b')]);_0x29236a['filters']=_['intersection'](_0x29236a[_0xace0('0x2a')],_0x29236a['query']);_0x5042e1['attributes']=_[_0xace0('0x2c')](_0x29236a[_0xace0('0x2a')],qs[_0xace0('0x2d')](_0x42727d[_0xace0('0x2b')][_0xace0('0x2d')]));_0x5042e1[_0xace0('0x2e')]=_0x5042e1[_0xace0('0x2e')]['length']?_0x5042e1[_0xace0('0x2e')]:_0x29236a['model'];if(!_0x42727d[_0xace0('0x2b')]['hasOwnProperty']('nolimit')){_0x5042e1[_0xace0('0x1a')]=qs[_0xace0('0x1a')](_0x42727d[_0xace0('0x2b')][_0xace0('0x1a')]);_0x5042e1['offset']=qs[_0xace0('0x19')](_0x42727d[_0xace0('0x2b')][_0xace0('0x19')]);}_0x5042e1[_0xace0('0x2f')]=qs[_0xace0('0x30')](_0x42727d['query']['sort']);_0x5042e1['where']=qs[_0xace0('0x31')](_['pick'](_0x42727d['query'],_0x29236a[_0xace0('0x31')]),_0x49005a);if(_0x42727d['query'][_0xace0('0x32')]){_0x5042e1[_0xace0('0x33')]=_[_0xace0('0x34')](_0x5042e1[_0xace0('0x33')],{'$or':_[_0xace0('0x27')](_0x49005a,function(_0x445981){if(_0x445981[_0xace0('0x35')]!==_0xace0('0x36')){var _0x3863e0={};_0x3863e0[_0x445981[_0xace0('0x24')]]={'$like':'%'+_0x42727d[_0xace0('0x2b')][_0xace0('0x32')]+'%'};return _0x3863e0;}})});}_0x5042e1=_[_0xace0('0x34')]({},_0x5042e1,_0x42727d['options']);var _0x94706a={'where':_0x5042e1[_0xace0('0x33')]};return db[_0xace0('0x37')][_0xace0('0x1c')](_0x94706a)[_0xace0('0x38')](function(_0x28d6c3){_0x3e49ae[_0xace0('0x1c')]=_0x28d6c3;if(_0x42727d[_0xace0('0x2b')]['includeAll']){_0x5042e1['include']=[{'all':!![]}];}return db[_0xace0('0x37')][_0xace0('0x39')](_0x5042e1);})[_0xace0('0x38')](function(_0x4083ec){_0x3e49ae['rows']=_0x4083ec;return _0x3e49ae;})[_0xace0('0x38')](respondWithFilteredResult(_0x2337f1,_0x5042e1))[_0xace0('0x3a')](handleError(_0x2337f1,null));};exports[_0xace0('0x3b')]=function(_0x6287a1,_0x1872cf){var _0x490ef2={'raw':!![],'where':{'id':_0x6287a1[_0xace0('0x3c')]['id']}},_0x24be0b={};_0x24be0b['model']=_[_0xace0('0x3d')](db[_0xace0('0x37')][_0xace0('0x3e')]);_0x24be0b[_0xace0('0x2b')]=_['keys'](_0x6287a1[_0xace0('0x2b')]);_0x24be0b[_0xace0('0x31')]=_[_0xace0('0x2c')](_0x24be0b[_0xace0('0x2a')],_0x24be0b[_0xace0('0x2b')]);_0x490ef2[_0xace0('0x2e')]=_[_0xace0('0x2c')](_0x24be0b['model'],qs[_0xace0('0x2d')](_0x6287a1[_0xace0('0x2b')][_0xace0('0x2d')]));_0x490ef2['attributes']=_0x490ef2[_0xace0('0x2e')][_0xace0('0x3f')]?_0x490ef2[_0xace0('0x2e')]:_0x24be0b['model'];if(_0x6287a1['query'][_0xace0('0x40')]){_0x490ef2['include']=[{'all':!![]}];}_0x490ef2=_['merge']({},_0x490ef2,_0x6287a1[_0xace0('0x41')]);return db[_0xace0('0x37')][_0xace0('0x42')](_0x490ef2)['then'](handleEntityNotFound(_0x1872cf,null))['then'](respondWithResult(_0x1872cf,null))['catch'](handleError(_0x1872cf,null));};exports[_0xace0('0x43')]=function(_0x25351c,_0x454be0){return db[_0xace0('0x37')][_0xace0('0x43')](_0x25351c[_0xace0('0x44')],{})[_0xace0('0x38')](respondWithResult(_0x454be0,0xc9))['catch'](handleError(_0x454be0,null));};exports['update']=function(_0xf3957c,_0x3b13bc){if(_0xf3957c[_0xace0('0x44')]['id']){delete _0xf3957c[_0xace0('0x44')]['id'];}return db[_0xace0('0x37')][_0xace0('0x42')]({'where':{'id':_0xf3957c['params']['id']}})[_0xace0('0x38')](handleEntityNotFound(_0x3b13bc,null))[_0xace0('0x38')](saveUpdates(_0xf3957c[_0xace0('0x44')],null))[_0xace0('0x38')](respondWithResult(_0x3b13bc,null))[_0xace0('0x3a')](handleError(_0x3b13bc,null));};exports[_0xace0('0x20')]=function(_0x37d39a,_0x6d6174){return db['SquareDetailsReport'][_0xace0('0x42')]({'where':{'id':_0x37d39a[_0xace0('0x3c')]['id']}})[_0xace0('0x38')](handleEntityNotFound(_0x6d6174,null))['then'](removeEntity(_0x6d6174,null))[_0xace0('0x3a')](handleError(_0x6d6174,null));};exports['describe']=function(_0x49a8c3,_0xcaa476){return db[_0xace0('0x37')]['describe']()[_0xace0('0x38')](respondWithResult(_0xcaa476,null))[_0xace0('0x3a')](handleError(_0xcaa476,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index c74a677..68149f5 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 _0x51c4=['exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./squareReportDetail.attributes'];(function(_0x58f0e2,_0x5d1967){var _0x58953d=function(_0x48abca){while(--_0x48abca){_0x58f0e2['push'](_0x58f0e2['shift']());}};_0x58953d(++_0x5d1967);}(_0x51c4,0x13c));var _0x451c=function(_0xeef2f6,_0x4ea4bc){_0xeef2f6=_0xeef2f6-0x0;var _0x33413e=_0x51c4[_0xeef2f6];return _0x33413e;};'use strict';var _=require(_0x451c('0x0'));var util=require(_0x451c('0x1'));var logger=require(_0x451c('0x2'))(_0x451c('0x3'));var moment=require(_0x451c('0x4'));var BPromise=require('bluebird');var rp=require(_0x451c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x451c('0x6'));var config=require('../../config/environment');var attributes=require(_0x451c('0x7'));module[_0x451c('0x8')]=function(_0xcc191b,_0x2da6dd){return _0xcc191b[_0x451c('0x9')](_0x451c('0xa'),attributes,{'tableName':_0x451c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb94=['./squareReportDetail.attributes','exports','define','report_square_details','lodash','util','../../config/logger','moment','../../config/environment'];(function(_0x15c553,_0x470459){var _0x1bca10=function(_0x2644dc){while(--_0x2644dc){_0x15c553['push'](_0x15c553['shift']());}};_0x1bca10(++_0x470459);}(_0xfb94,0xb8));var _0x4fb9=function(_0x434bbd,_0x525ea8){_0x434bbd=_0x434bbd-0x0;var _0x325365=_0xfb94[_0x434bbd];return _0x325365;};'use strict';var _=require(_0x4fb9('0x0'));var util=require(_0x4fb9('0x1'));var logger=require(_0x4fb9('0x2'))('api');var moment=require(_0x4fb9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4fb9('0x4'));var attributes=require(_0x4fb9('0x5'));module[_0x4fb9('0x6')]=function(_0x3225d9,_0x3bc9f3){return _0x3225d9[_0x4fb9('0x7')]('SquareDetailsReport',attributes,{'tableName':_0x4fb9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 41259b8..a2c527e 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 _0x8f4c=['SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x94787e,_0xbab744){var _0xabcd2d=function(_0x58d498){while(--_0x58d498){_0x94787e['push'](_0x94787e['shift']());}};_0xabcd2d(++_0xbab744);}(_0x8f4c,0x113));var _0xc8f4=function(_0x409186,_0x4b8b73){_0x409186=_0x409186-0x0;var _0x3deb43=_0x8f4c[_0x409186];return _0x3deb43;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')](_0x108076[_0xc8f4('0x1a')],{'raw':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![]})[_0xc8f4('0xb')](function(_0x5f3264){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON[_0xc8f4('0x10')](_0x5f3264));_0x4763c1(_0x5f3264);})[_0xc8f4('0x16')](function(_0xaeee7d){logger[_0xc8f4('0x11')]('CreateSquareDetailsReport',_0xaeee7d[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0xaeee7d[_0xc8f4('0x13')]));});});}; \ No newline at end of file +var _0x4849=['then','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','options','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x247445,_0x5483d7){var _0x391c60=function(_0x2a065e){while(--_0x2a065e){_0x247445['push'](_0x247445['shift']());}};_0x391c60(++_0x5483d7);}(_0x4849,0xf8));var _0x9484=function(_0x54ea61,_0x235dbf){_0x54ea61=_0x54ea61-0x0;var _0x182ca4=_0x4849[_0x54ea61];return _0x182ca4;};'use strict';var _=require(_0x9484('0x0'));var util=require(_0x9484('0x1'));var moment=require(_0x9484('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9484('0x3'));var db=require(_0x9484('0x4'))['db'];var utils=require(_0x9484('0x5'));var logger=require(_0x9484('0x6'))(_0x9484('0x7'));var config=require(_0x9484('0x8'));var jayson=require(_0x9484('0x9'));var client=jayson[_0x9484('0xa')][_0x9484('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x536b43,_0x4a8a70,_0x11f2a1){return new BPromise(function(_0x583079,_0x3929b9){return client[_0x9484('0xc')](_0x536b43,_0x11f2a1)[_0x9484('0xd')](function(_0xe8b216){logger[_0x9484('0xe')](_0x9484('0xf'),_0x4a8a70,_0x9484('0x10'));logger[_0x9484('0x11')](_0x9484('0x12'),_0x4a8a70,_0x9484('0x10'),JSON[_0x9484('0x13')](_0xe8b216));if(_0xe8b216[_0x9484('0x14')]){if(_0xe8b216[_0x9484('0x14')][_0x9484('0x15')]===0x1f4){logger[_0x9484('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x4a8a70,_0xe8b216[_0x9484('0x14')]['message']);return _0x3929b9(_0xe8b216[_0x9484('0x14')][_0x9484('0x16')]);}logger[_0x9484('0x14')](_0x9484('0xf'),_0x4a8a70,_0xe8b216[_0x9484('0x14')][_0x9484('0x16')]);return _0x583079(_0xe8b216['error'][_0x9484('0x16')]);}else{logger[_0x9484('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x4a8a70,'request\x20sent');_0x583079(_0xe8b216[_0x9484('0x17')]['message']);}})[_0x9484('0x18')](function(_0x4e974f){logger[_0x9484('0x14')](_0x9484('0xf'),_0x4a8a70,_0x4e974f);_0x3929b9(_0x4e974f);});});}exports[_0x9484('0x19')]=function(_0xa279e2){var _0x26ec8b=this;return new Promise(function(_0x232694,_0x4b900f){return db[_0x9484('0x1a')][_0x9484('0x1b')](_0xa279e2['body'],{'raw':_0xa279e2[_0x9484('0x1c')]?_0xa279e2[_0x9484('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x9484('0xd')](function(_0x5325e6){logger[_0x9484('0xe')]('CreateSquareDetailsReport',_0xa279e2);logger[_0x9484('0x11')](_0x9484('0x19'),_0xa279e2,JSON[_0x9484('0x13')](_0x5325e6));_0x232694(_0x5325e6);})[_0x9484('0x18')](function(_0x5edcf5){logger['error'](_0x9484('0x19'),_0x5edcf5['message'],_0xa279e2);_0x4b900f(_0x26ec8b[_0x9484('0x14')](0x1f4,_0x5edcf5['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 798c8a3..a9619c3 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 _0x7e2e=['/process/:pid/kill','killProcess','express','get','isAuthenticated','index'];(function(_0x3fecfe,_0x627ab1){var _0x3a98e7=function(_0x5e7930){while(--_0x5e7930){_0x3fecfe['push'](_0x3fecfe['shift']());}};_0x3a98e7(++_0x627ab1);}(_0x7e2e,0x1f4));var _0xe7e2=function(_0x353494,_0x2b392e){_0x353494=_0x353494-0x0;var _0x460b53=_0x7e2e[_0x353494];return _0x460b53;};'use strict';var express=require(_0xe7e2('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0xe7e2('0x1')]('/',auth[_0xe7e2('0x2')](),controller[_0xe7e2('0x3')]);router[_0xe7e2('0x1')](_0xe7e2('0x4'),auth['isAuthenticated'](),controller[_0xe7e2('0x5')]);module['exports']=router; \ No newline at end of file +var _0x5900=['/process/:pid/kill','isAuthenticated','killProcess','exports','./system.controller','get'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x5900,0x1de));var _0x0590=function(_0x53ea77,_0x3edf7e){_0x53ea77=_0x53ea77-0x0;var _0xfc6ae3=_0x5900[_0x53ea77];return _0xfc6ae3;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x0590('0x0'));router[_0x0590('0x1')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0590('0x1')](_0x0590('0x2'),auth[_0x0590('0x3')](),controller[_0x0590('0x4')]);module[_0x0590('0x5')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 442cc3b..c3dd3fc 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 _0xe3e0=['lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','index','getAllData','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','exec','../../config/logger','api','util','bluebird'];(function(_0x188dbb,_0x6e70f6){var _0x4aa74e=function(_0x254111){while(--_0x254111){_0x188dbb['push'](_0x188dbb['shift']());}};_0x4aa74e(++_0x6e70f6);}(_0xe3e0,0x1aa));var _0x0e3e=function(_0x566bdf,_0x1f4861){_0x566bdf=_0x566bdf-0x0;var _0x331215=_0xe3e0[_0x566bdf];return _0x331215;};'use strict';var info=require(_0x0e3e('0x0'));var exec=require('child_process')[_0x0e3e('0x1')];var logger=require(_0x0e3e('0x2'))(_0x0e3e('0x3'));var util=require(_0x0e3e('0x4'));var BPromise=require(_0x0e3e('0x5'));var _=require(_0x0e3e('0x6'));function handleError(_0x5899cc,_0x2e7a26,_0x24a874){_0x2e7a26=_0x2e7a26||0x1f4;return function(_0x43d132){logger[_0x0e3e('0x7')](_0x0e3e('0x8'),_0x24a874,_0x2e7a26,util['inspect'](_0x43d132,{'showHidden':![],'depth':null}));delete _0x43d132['name'];_0x5899cc[_0x0e3e('0x9')](_0x2e7a26)['send'](_0x43d132);};}exports[_0x0e3e('0xa')]=function(_0x4ca2a6,_0xc3c126){return info[_0x0e3e('0xb')]()[_0x0e3e('0xc')](function(_0x2101a1){return _0xc3c126[_0x0e3e('0x9')](0xc8)[_0x0e3e('0xd')](_0x2101a1);})['catch'](function(_0x3bd044){return _0xc3c126[_0x0e3e('0x9')](0x1f4)['json'](_0x3bd044);});};exports[_0x0e3e('0xe')]=function(_0x157b14,_0x6bbaa2){var _0x3a18b0=[_0x0e3e('0xf')];return new BPromise(function(_0x44fc4f,_0x7d8e62){return exec(util[_0x0e3e('0x10')](_0x0e3e('0x11'),_0x157b14[_0x0e3e('0x12')]['pid']),function(_0x1d1aaa,_0x4f2cfe,_0x4e5e4e){if(_0x1d1aaa){return _0x7d8e62(_0x1d1aaa);}return _0x44fc4f(_0x4f2cfe);});})[_0x0e3e('0xc')](function(_0x1234be){var _0x2fa5d0=![];var _0x58055e=_0x1234be['split'](/\n/);for(var _0x56fbb4=0x0,_0x4cfa31=_0x3a18b0[_0x0e3e('0x13')];_0x56fbb4<_0x4cfa31,_0x2fa5d0===![];_0x56fbb4+=0x1){if(_0x1234be[_0x0e3e('0x14')](_0x3a18b0[_0x56fbb4])>=0x0){_0x2fa5d0=!![];}}if(!_0x2fa5d0){throw new Error(util['format'](_0x0e3e('0x15'),_0x157b14[_0x0e3e('0x12')][_0x0e3e('0x16')]));}process[_0x0e3e('0x17')](_0x157b14[_0x0e3e('0x12')][_0x0e3e('0x16')],_0x0e3e('0x18'));return _0x6bbaa2[_0x0e3e('0x9')](0xc8)[_0x0e3e('0xd')]({'message':util[_0x0e3e('0x10')](_0x0e3e('0x19'),_0x157b14[_0x0e3e('0x12')]['pid'])});})[_0x0e3e('0x1a')](handleError(_0x6bbaa2,null,_0x0e3e('0xe')));}; \ No newline at end of file +var _0xaf59=['components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','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','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','json','catch','killProcess'];(function(_0x488f2e,_0x550454){var _0x516ea6=function(_0xda466f){while(--_0xda466f){_0x488f2e['push'](_0x488f2e['shift']());}};_0x516ea6(++_0x550454);}(_0xaf59,0x186));var _0x9af5=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0xaf59[_0x1d70db];return _0x3060c6;};'use strict';var info=require('systeminformation');var exec=require(_0x9af5('0x0'))['exec'];var logger=require(_0x9af5('0x1'))(_0x9af5('0x2'));var util=require(_0x9af5('0x3'));var BPromise=require(_0x9af5('0x4'));var _=require(_0x9af5('0x5'));function handleError(_0x221125,_0x24dff0,_0x57dcf3){_0x24dff0=_0x24dff0||0x1f4;return function(_0x2e91d9){logger['error'](_0x9af5('0x6'),_0x57dcf3,_0x24dff0,util[_0x9af5('0x7')](_0x2e91d9,{'showHidden':![],'depth':null}));delete _0x2e91d9[_0x9af5('0x8')];_0x221125[_0x9af5('0x9')](_0x24dff0)[_0x9af5('0xa')](_0x2e91d9);};}exports[_0x9af5('0xb')]=function(_0x20cc8b,_0x1e57ff){return info[_0x9af5('0xc')]()['then'](function(_0x42ca8a){return _0x1e57ff[_0x9af5('0x9')](0xc8)[_0x9af5('0xd')](_0x42ca8a);})[_0x9af5('0xe')](function(_0xe38c2f){return _0x1e57ff[_0x9af5('0x9')](0x1f4)[_0x9af5('0xd')](_0xe38c2f);});};exports[_0x9af5('0xf')]=function(_0xf4f21e,_0x50560b){var _0x153b50=[_0x9af5('0x10')];return new BPromise(function(_0x2a7677,_0x535783){return exec(util[_0x9af5('0x11')](_0x9af5('0x12'),_0xf4f21e[_0x9af5('0x13')][_0x9af5('0x14')]),function(_0x21b798,_0x3977c0,_0x556d04){if(_0x21b798){return _0x535783(_0x21b798);}return _0x2a7677(_0x3977c0);});})[_0x9af5('0x15')](function(_0x19f0b7){var _0x20b205=![];var _0x4add7a=_0x19f0b7[_0x9af5('0x16')](/\n/);for(var _0x118dda=0x0,_0x4b68a8=_0x153b50[_0x9af5('0x17')];_0x118dda<_0x4b68a8,_0x20b205===![];_0x118dda+=0x1){if(_0x19f0b7[_0x9af5('0x18')](_0x153b50[_0x118dda])>=0x0){_0x20b205=!![];}}if(!_0x20b205){throw new Error(util['format'](_0x9af5('0x19'),_0xf4f21e[_0x9af5('0x13')]['pid']));}process[_0x9af5('0x1a')](_0xf4f21e[_0x9af5('0x13')]['pid'],_0x9af5('0x1b'));return _0x50560b[_0x9af5('0x9')](0xc8)[_0x9af5('0xd')]({'message':util['format'](_0x9af5('0x1c'),_0xf4f21e[_0x9af5('0x13')][_0x9af5('0x14')])});})[_0x9af5('0xe')](handleError(_0x50560b,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index c720b92..ae25a68 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 _0x1046=['put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','isAuthenticated','post','create'];(function(_0x4ed315,_0x1e35e1){var _0x11a63d=function(_0x13494f){while(--_0x13494f){_0x4ed315['push'](_0x4ed315['shift']());}};_0x11a63d(++_0x1e35e1);}(_0x1046,0x134));var _0x6104=function(_0xdc14d6,_0x4627d7){_0xdc14d6=_0xdc14d6-0x0;var _0x3caed4=_0x1046[_0xdc14d6];return _0x3caed4;};'use strict';var multer=require(_0x6104('0x0'));var util=require('util');var path=require(_0x6104('0x1'));var timeout=require(_0x6104('0x2'));var express=require(_0x6104('0x3'));var router=express[_0x6104('0x4')]();var fs_extra=require(_0x6104('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6104('0x6'));var config=require(_0x6104('0x7'));var controller=require(_0x6104('0x8'));router[_0x6104('0x9')]('/',auth['isAuthenticated'](),controller[_0x6104('0xa')]);router[_0x6104('0x9')](_0x6104('0xb'),auth[_0x6104('0xc')](),controller['show']);router[_0x6104('0xd')]('/',auth['isAuthenticated'](),controller[_0x6104('0xe')]);router[_0x6104('0xf')](_0x6104('0xb'),auth[_0x6104('0xc')](),controller[_0x6104('0x10')]);router[_0x6104('0x11')](_0x6104('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x6104('0x12')]=router; \ No newline at end of file +var _0x36fb=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports'];(function(_0x268cca,_0x57e7f3){var _0x1a428d=function(_0x3887c){while(--_0x3887c){_0x268cca['push'](_0x268cca['shift']());}};_0x1a428d(++_0x57e7f3);}(_0x36fb,0xc8));var _0xb36f=function(_0x38678,_0x469c1c){_0x38678=_0x38678-0x0;var _0x126b0a=_0x36fb[_0x38678];return _0x126b0a;};'use strict';var multer=require(_0xb36f('0x0'));var util=require(_0xb36f('0x1'));var path=require(_0xb36f('0x2'));var timeout=require('connect-timeout');var express=require(_0xb36f('0x3'));var router=express[_0xb36f('0x4')]();var fs_extra=require(_0xb36f('0x5'));var auth=require(_0xb36f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb36f('0x7'));var controller=require(_0xb36f('0x8'));router[_0xb36f('0x9')]('/',auth['isAuthenticated'](),controller[_0xb36f('0xa')]);router[_0xb36f('0x9')](_0xb36f('0xb'),auth[_0xb36f('0xc')](),controller[_0xb36f('0xd')]);router[_0xb36f('0xe')]('/',auth['isAuthenticated'](),controller[_0xb36f('0xf')]);router[_0xb36f('0x10')](_0xb36f('0xb'),auth[_0xb36f('0xc')](),controller[_0xb36f('0x11')]);router['delete'](_0xb36f('0xb'),auth[_0xb36f('0xc')](),controller[_0xb36f('0x12')]);module[_0xb36f('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 72ef4a6..5414dc2 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 _0x5eb8=['name','#0091EA','STRING'];(function(_0x4bbb10,_0x417407){var _0x513ac6=function(_0x234b31){while(--_0x234b31){_0x4bbb10['push'](_0x4bbb10['shift']());}};_0x513ac6(++_0x417407);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4b7b9b,_0xa4aff9){_0x4b7b9b=_0x4b7b9b-0x0;var _0x3be710=_0x5eb8[_0x4b7b9b];return _0x3be710;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x85eb('0x0')],'unique':_0x85eb('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':_0x85eb('0x2')},'description':{'type':Sequelize[_0x85eb('0x0')]}}; \ No newline at end of file +var _0x39c4=['exports','STRING','#0091EA'];(function(_0x1f454b,_0x363220){var _0x1ece1d=function(_0x1efa48){while(--_0x1efa48){_0x1f454b['push'](_0x1f454b['shift']());}};_0x1ece1d(++_0x363220);}(_0x39c4,0x174));var _0x439c=function(_0x130de7,_0x343411){_0x130de7=_0x130de7-0x0;var _0x3059c4=_0x39c4[_0x130de7];return _0x3059c4;};'use strict';var Sequelize=require('sequelize');module[_0x439c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x439c('0x1')],'defaultValue':_0x439c('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index ce714e1..e21e194 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 _0xa75b=['rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','reject','then','destroy','get','Tags','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Tag'];(function(_0x859359,_0x312a9e){var _0x843f52=function(_0x30bd39){while(--_0x30bd39){_0x859359['push'](_0x859359['shift']());}};_0x843f52(++_0x312a9e);}(_0xa75b,0x170));var _0xba75=function(_0x17f40c,_0x12dd76){_0x17f40c=_0x17f40c-0x0;var _0x48d526=_0xa75b[_0x17f40c];return _0x48d526;};'use strict';var emlformat=require(_0xba75('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xba75('0x1'));var rp=require(_0xba75('0x2'));var moment=require(_0xba75('0x3'));var BPromise=require(_0xba75('0x4'));var Mustache=require(_0xba75('0x5'));var util=require(_0xba75('0x6'));var path=require(_0xba75('0x7'));var sox=require(_0xba75('0x8'));var csv=require(_0xba75('0x9'));var ejs=require(_0xba75('0xa'));var fs=require('fs');var fs_extra=require(_0xba75('0xb'));var _=require(_0xba75('0xc'));var squel=require(_0xba75('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba75('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba75('0xf'));var Redis=require('ioredis');var authService=require(_0xba75('0x10'));var qs=require(_0xba75('0x11'));var as=require(_0xba75('0x12'));var hardwareService=require(_0xba75('0x13'));var logger=require(_0xba75('0x14'))(_0xba75('0x15'));var utils=require(_0xba75('0x16'));var config=require(_0xba75('0x17'));var licenseUtil=require(_0xba75('0x18'));var db=require(_0xba75('0x19'))['db'];function respondWithStatusCode(_0x8116d8,_0x1ed697){_0x1ed697=_0x1ed697||0xcc;return function(_0x50db90){if(_0x50db90){return _0x8116d8['sendStatus'](_0x1ed697);}return _0x8116d8[_0xba75('0x1a')](_0x1ed697)['end']();};}function respondWithResult(_0x2f141a,_0x2df615){_0x2df615=_0x2df615||0xc8;return function(_0xa27f76){if(_0xa27f76){return _0x2f141a[_0xba75('0x1a')](_0x2df615)['json'](_0xa27f76);}};}function respondWithFilteredResult(_0x31b3b3,_0x18bab2){return function(_0x256678){if(_0x256678){var _0x4028f9=typeof _0x18bab2[_0xba75('0x1b')]==='undefined'&&typeof _0x18bab2[_0xba75('0x1c')]===_0xba75('0x1d');var _0x14bd83=_0x256678['count'];var _0x2822af=_0x4028f9?0x0:_0x18bab2[_0xba75('0x1b')];var _0xc4bf17=_0x4028f9?_0x256678[_0xba75('0x1e')]:_0x18bab2[_0xba75('0x1b')]+_0x18bab2[_0xba75('0x1c')];var _0x5811cb;if(_0xc4bf17>=_0x14bd83){_0xc4bf17=_0x14bd83;_0x5811cb=0xc8;}else{_0x5811cb=0xce;}_0x31b3b3[_0xba75('0x1a')](_0x5811cb);return _0x31b3b3[_0xba75('0x1f')]('Content-Range',_0x2822af+'-'+_0xc4bf17+'/'+_0x14bd83)['json'](_0x256678);}return null;};}function patchUpdates(_0x35ffd2){return function(_0x31bc33){try{jsonpatch['apply'](_0x31bc33,_0x35ffd2,!![]);}catch(_0x48206c){return BPromise[_0xba75('0x20')](_0x48206c);}return _0x31bc33['save']();};}function saveUpdates(_0x1b8a36,_0x2ece41){return function(_0x19b2d7){if(_0x19b2d7){return _0x19b2d7['update'](_0x1b8a36)[_0xba75('0x21')](function(_0x221d5e){return _0x221d5e;});}return null;};}function removeEntity(_0x139fa4,_0x3e9bd9){return function(_0x14c54b){if(_0x14c54b){return _0x14c54b[_0xba75('0x22')]()['then'](function(){var _0x246c48=_0x14c54b[_0xba75('0x23')]({'plain':!![]});var _0xe579fb=_0xba75('0x24');return db[_0xba75('0x25')][_0xba75('0x22')]({'where':{'type':_0xe579fb,'resourceId':_0x246c48['id']}})[_0xba75('0x21')](function(){return _0x14c54b;});})[_0xba75('0x21')](function(){_0x139fa4[_0xba75('0x1a')](0xcc)[_0xba75('0x26')]();});}};}function handleEntityNotFound(_0x47ddff,_0x4c8d02){return function(_0x4e1987){if(!_0x4e1987){_0x47ddff[_0xba75('0x27')](0x194);}return _0x4e1987;};}function handleError(_0x4856be,_0x42cefb){_0x42cefb=_0x42cefb||0x1f4;return function(_0x58ea2d){logger[_0xba75('0x28')](_0x58ea2d[_0xba75('0x29')]);if(_0x58ea2d[_0xba75('0x2a')]){delete _0x58ea2d['name'];}_0x4856be[_0xba75('0x1a')](_0x42cefb)[_0xba75('0x2b')](_0x58ea2d);};}exports[_0xba75('0x2c')]=function(_0x2808f0,_0x5d9f78){var _0x4791a5={},_0x200715={},_0x481a04={'count':0x0,'rows':[]};var _0x5a85ee=_[_0xba75('0x2d')](db[_0xba75('0x2e')][_0xba75('0x2f')],function(_0x4b4d69){return{'name':_0x4b4d69[_0xba75('0x30')],'type':_0x4b4d69[_0xba75('0x31')]['key']};});_0x200715[_0xba75('0x32')]=_[_0xba75('0x2d')](_0x5a85ee,_0xba75('0x2a'));_0x200715[_0xba75('0x33')]=_['keys'](_0x2808f0[_0xba75('0x33')]);_0x200715[_0xba75('0x34')]=_['intersection'](_0x200715[_0xba75('0x32')],_0x200715[_0xba75('0x33')]);_0x4791a5[_0xba75('0x35')]=_['intersection'](_0x200715[_0xba75('0x32')],qs[_0xba75('0x36')](_0x2808f0[_0xba75('0x33')][_0xba75('0x36')]));_0x4791a5[_0xba75('0x35')]=_0x4791a5[_0xba75('0x35')][_0xba75('0x37')]?_0x4791a5['attributes']:_0x200715['model'];if(!_0x2808f0[_0xba75('0x33')][_0xba75('0x38')](_0xba75('0x39'))){_0x4791a5['limit']=qs[_0xba75('0x1c')](_0x2808f0[_0xba75('0x33')]['limit']);_0x4791a5['offset']=qs[_0xba75('0x1b')](_0x2808f0[_0xba75('0x33')][_0xba75('0x1b')]);}_0x4791a5[_0xba75('0x3a')]=qs[_0xba75('0x3b')](_0x2808f0['query']['sort']);_0x4791a5[_0xba75('0x3c')]=qs[_0xba75('0x34')](_[_0xba75('0x3d')](_0x2808f0[_0xba75('0x33')],_0x200715[_0xba75('0x34')]),_0x5a85ee);if(_0x2808f0[_0xba75('0x33')][_0xba75('0x3e')]){_0x4791a5['where']=_[_0xba75('0x3f')](_0x4791a5[_0xba75('0x3c')],{'$or':_['map'](_0x5a85ee,function(_0x1f28e8){if(_0x1f28e8[_0xba75('0x31')]!==_0xba75('0x40')){var _0x45d8cd={};_0x45d8cd[_0x1f28e8[_0xba75('0x2a')]]={'$like':'%'+_0x2808f0[_0xba75('0x33')][_0xba75('0x3e')]+'%'};return _0x45d8cd;}})});}_0x4791a5=_['merge']({},_0x4791a5,_0x2808f0[_0xba75('0x41')]);var _0x59d005={'where':_0x4791a5[_0xba75('0x3c')]};return db['Tag'][_0xba75('0x1e')](_0x59d005)[_0xba75('0x21')](function(_0x9c32ad){_0x481a04[_0xba75('0x1e')]=_0x9c32ad;if(_0x2808f0[_0xba75('0x33')][_0xba75('0x42')]){_0x4791a5[_0xba75('0x43')]=[{'all':!![]}];}return db[_0xba75('0x2e')][_0xba75('0x44')](_0x4791a5);})['then'](function(_0x30b5f0){_0x481a04[_0xba75('0x45')]=_0x30b5f0;return _0x481a04;})['then'](respondWithFilteredResult(_0x5d9f78,_0x4791a5))[_0xba75('0x46')](handleError(_0x5d9f78,null));};exports[_0xba75('0x47')]=function(_0x1130ac,_0x5bf935){var _0x5043a5={'raw':!![],'where':{'id':_0x1130ac['params']['id']}},_0x5c6491={};_0x5c6491[_0xba75('0x32')]=_['keys'](db[_0xba75('0x2e')][_0xba75('0x2f')]);_0x5c6491[_0xba75('0x33')]=_[_0xba75('0x48')](_0x1130ac[_0xba75('0x33')]);_0x5c6491['filters']=_['intersection'](_0x5c6491[_0xba75('0x32')],_0x5c6491['query']);_0x5043a5[_0xba75('0x35')]=_['intersection'](_0x5c6491[_0xba75('0x32')],qs[_0xba75('0x36')](_0x1130ac[_0xba75('0x33')][_0xba75('0x36')]));_0x5043a5['attributes']=_0x5043a5[_0xba75('0x35')][_0xba75('0x37')]?_0x5043a5[_0xba75('0x35')]:_0x5c6491[_0xba75('0x32')];if(_0x1130ac[_0xba75('0x33')][_0xba75('0x42')]){_0x5043a5[_0xba75('0x43')]=[{'all':!![]}];}_0x5043a5=_[_0xba75('0x3f')]({},_0x5043a5,_0x1130ac['options']);return db[_0xba75('0x2e')][_0xba75('0x49')](_0x5043a5)[_0xba75('0x21')](handleEntityNotFound(_0x5bf935,null))[_0xba75('0x21')](respondWithResult(_0x5bf935,null))[_0xba75('0x46')](handleError(_0x5bf935,null));};exports['create']=function(_0x2a1f84,_0x25ae33){return db[_0xba75('0x2e')][_0xba75('0x4a')](_0x2a1f84[_0xba75('0x4b')],{})[_0xba75('0x21')](function(_0x2c9085){var _0x5dc5f8=_0x2a1f84[_0xba75('0x4c')][_0xba75('0x23')]({'plain':!![]});if(!_0x5dc5f8)throw new Error(_0xba75('0x4d'));if(_0x5dc5f8['role']===_0xba75('0x4c')){var _0x29b4fc=_0x2c9085['get']({'plain':!![]});var _0x4d7e7e=_0xba75('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x4d7e7e,'userProfileId':_0x5dc5f8[_0xba75('0x4e')]},'raw':!![]})['then'](function(_0xbb87b9){if(_0xbb87b9&&_0xbb87b9[_0xba75('0x4f')]===0x0){return db[_0xba75('0x25')][_0xba75('0x4a')]({'name':_0x29b4fc[_0xba75('0x2a')],'resourceId':_0x29b4fc['id'],'type':_0xbb87b9['name'],'sectionId':_0xbb87b9['id']},{})[_0xba75('0x21')](function(){return _0x2c9085;});}else{return _0x2c9085;}})[_0xba75('0x46')](function(_0x57aaa6){logger[_0xba75('0x28')](_0xba75('0x50'),_0x57aaa6);throw _0x57aaa6;});}return _0x2c9085;})[_0xba75('0x21')](respondWithResult(_0x25ae33,0xc9))[_0xba75('0x46')](handleError(_0x25ae33,null));};exports[_0xba75('0x51')]=function(_0x52b2c9,_0x43f4b7){if(_0x52b2c9[_0xba75('0x4b')]['id']){delete _0x52b2c9['body']['id'];}return db[_0xba75('0x2e')][_0xba75('0x49')]({'where':{'id':_0x52b2c9[_0xba75('0x52')]['id']}})[_0xba75('0x21')](handleEntityNotFound(_0x43f4b7,null))[_0xba75('0x21')](saveUpdates(_0x52b2c9[_0xba75('0x4b')],null))['then'](respondWithResult(_0x43f4b7,null))[_0xba75('0x46')](handleError(_0x43f4b7,null));};exports[_0xba75('0x22')]=function(_0x361efb,_0x429e26){return db[_0xba75('0x2e')][_0xba75('0x49')]({'where':{'id':_0x361efb['params']['id']}})['then'](handleEntityNotFound(_0x429e26,null))['then'](removeEntity(_0x429e26,null))['catch'](handleError(_0x429e26,null));}; \ No newline at end of file +var _0x1cc7=['where','VIRTUAL','filter','merge','options','include','findAll','show','params','rawAttributes','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','get','Tags','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','Tag','fieldName','type','key','model','keys','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cc7,0x15a));var _0x71cc=function(_0xbf355c,_0xaa1191){_0xbf355c=_0xbf355c-0x0;var _0x195e35=_0x1cc7[_0xbf355c];return _0x195e35;};'use strict';var emlformat=require(_0x71cc('0x0'));var rimraf=require(_0x71cc('0x1'));var zipdir=require(_0x71cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x71cc('0x3'));var Mustache=require(_0x71cc('0x4'));var util=require(_0x71cc('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x71cc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71cc('0x7'));var squel=require(_0x71cc('0x8'));var crypto=require(_0x71cc('0x9'));var jsforce=require(_0x71cc('0xa'));var deskjs=require(_0x71cc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x71cc('0xc'));var Papa=require(_0x71cc('0xd'));var Redis=require(_0x71cc('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x71cc('0xf'))(_0x71cc('0x10'));var utils=require(_0x71cc('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x71cc('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aad83,_0x4f9c5c){_0x4f9c5c=_0x4f9c5c||0xcc;return function(_0x1a7c58){if(_0x1a7c58){return _0x1aad83['sendStatus'](_0x4f9c5c);}return _0x1aad83[_0x71cc('0x13')](_0x4f9c5c)[_0x71cc('0x14')]();};}function respondWithResult(_0x3cee23,_0xd16032){_0xd16032=_0xd16032||0xc8;return function(_0x33070e){if(_0x33070e){return _0x3cee23['status'](_0xd16032)[_0x71cc('0x15')](_0x33070e);}};}function respondWithFilteredResult(_0x292d0c,_0x3b26d1){return function(_0x14d5ab){if(_0x14d5ab){var _0x3875b8=typeof _0x3b26d1[_0x71cc('0x16')]===_0x71cc('0x17')&&typeof _0x3b26d1['limit']===_0x71cc('0x17');var _0x14788d=_0x14d5ab[_0x71cc('0x18')];var _0x1d1da8=_0x3875b8?0x0:_0x3b26d1[_0x71cc('0x16')];var _0x10da0a=_0x3875b8?_0x14d5ab['count']:_0x3b26d1[_0x71cc('0x16')]+_0x3b26d1[_0x71cc('0x19')];var _0x4fc0a9;if(_0x10da0a>=_0x14788d){_0x10da0a=_0x14788d;_0x4fc0a9=0xc8;}else{_0x4fc0a9=0xce;}_0x292d0c['status'](_0x4fc0a9);return _0x292d0c[_0x71cc('0x1a')](_0x71cc('0x1b'),_0x1d1da8+'-'+_0x10da0a+'/'+_0x14788d)[_0x71cc('0x15')](_0x14d5ab);}return null;};}function patchUpdates(_0x11299c){return function(_0x258d30){try{jsonpatch[_0x71cc('0x1c')](_0x258d30,_0x11299c,!![]);}catch(_0x363ecb){return BPromise[_0x71cc('0x1d')](_0x363ecb);}return _0x258d30['save']();};}function saveUpdates(_0x1442ef,_0x109239){return function(_0x587a0b){if(_0x587a0b){return _0x587a0b[_0x71cc('0x1e')](_0x1442ef)[_0x71cc('0x1f')](function(_0x38f58e){return _0x38f58e;});}return null;};}function removeEntity(_0x1a9b4f,_0x1bc67c){return function(_0x887399){if(_0x887399){return _0x887399['destroy']()[_0x71cc('0x1f')](function(){var _0x4147dc=_0x887399[_0x71cc('0x20')]({'plain':!![]});var _0x180cd2=_0x71cc('0x21');return db[_0x71cc('0x22')][_0x71cc('0x23')]({'where':{'type':_0x180cd2,'resourceId':_0x4147dc['id']}})[_0x71cc('0x1f')](function(){return _0x887399;});})[_0x71cc('0x1f')](function(){_0x1a9b4f['status'](0xcc)[_0x71cc('0x14')]();});}};}function handleEntityNotFound(_0x43c155,_0x28e095){return function(_0x26becf){if(!_0x26becf){_0x43c155[_0x71cc('0x24')](0x194);}return _0x26becf;};}function handleError(_0x1fa9c1,_0x16fc33){_0x16fc33=_0x16fc33||0x1f4;return function(_0x9a7ca3){logger[_0x71cc('0x25')](_0x9a7ca3[_0x71cc('0x26')]);if(_0x9a7ca3[_0x71cc('0x27')]){delete _0x9a7ca3[_0x71cc('0x27')];}_0x1fa9c1[_0x71cc('0x13')](_0x16fc33)[_0x71cc('0x28')](_0x9a7ca3);};}exports[_0x71cc('0x29')]=function(_0x5fa0e0,_0x4fa63e){var _0x3054ff={},_0x3b7451={},_0x34c6bc={'count':0x0,'rows':[]};var _0x184a51=_[_0x71cc('0x2a')](db[_0x71cc('0x2b')]['rawAttributes'],function(_0x3110e3){return{'name':_0x3110e3[_0x71cc('0x2c')],'type':_0x3110e3[_0x71cc('0x2d')][_0x71cc('0x2e')]};});_0x3b7451[_0x71cc('0x2f')]=_[_0x71cc('0x2a')](_0x184a51,_0x71cc('0x27'));_0x3b7451['query']=_[_0x71cc('0x30')](_0x5fa0e0['query']);_0x3b7451['filters']=_[_0x71cc('0x31')](_0x3b7451['model'],_0x3b7451['query']);_0x3054ff[_0x71cc('0x32')]=_['intersection'](_0x3b7451[_0x71cc('0x2f')],qs['fields'](_0x5fa0e0[_0x71cc('0x33')][_0x71cc('0x34')]));_0x3054ff['attributes']=_0x3054ff[_0x71cc('0x32')][_0x71cc('0x35')]?_0x3054ff[_0x71cc('0x32')]:_0x3b7451[_0x71cc('0x2f')];if(!_0x5fa0e0[_0x71cc('0x33')][_0x71cc('0x36')](_0x71cc('0x37'))){_0x3054ff[_0x71cc('0x19')]=qs[_0x71cc('0x19')](_0x5fa0e0[_0x71cc('0x33')]['limit']);_0x3054ff[_0x71cc('0x16')]=qs['offset'](_0x5fa0e0[_0x71cc('0x33')][_0x71cc('0x16')]);}_0x3054ff[_0x71cc('0x38')]=qs[_0x71cc('0x39')](_0x5fa0e0[_0x71cc('0x33')][_0x71cc('0x39')]);_0x3054ff['where']=qs[_0x71cc('0x3a')](_['pick'](_0x5fa0e0[_0x71cc('0x33')],_0x3b7451[_0x71cc('0x3a')]),_0x184a51);if(_0x5fa0e0[_0x71cc('0x33')]['filter']){_0x3054ff[_0x71cc('0x3b')]=_['merge'](_0x3054ff[_0x71cc('0x3b')],{'$or':_[_0x71cc('0x2a')](_0x184a51,function(_0x155c03){if(_0x155c03[_0x71cc('0x2d')]!==_0x71cc('0x3c')){var _0x1e7e67={};_0x1e7e67[_0x155c03[_0x71cc('0x27')]]={'$like':'%'+_0x5fa0e0[_0x71cc('0x33')][_0x71cc('0x3d')]+'%'};return _0x1e7e67;}})});}_0x3054ff=_[_0x71cc('0x3e')]({},_0x3054ff,_0x5fa0e0[_0x71cc('0x3f')]);var _0x12bf49={'where':_0x3054ff['where']};return db[_0x71cc('0x2b')][_0x71cc('0x18')](_0x12bf49)['then'](function(_0x54fc85){_0x34c6bc[_0x71cc('0x18')]=_0x54fc85;if(_0x5fa0e0[_0x71cc('0x33')]['includeAll']){_0x3054ff[_0x71cc('0x40')]=[{'all':!![]}];}return db[_0x71cc('0x2b')][_0x71cc('0x41')](_0x3054ff);})[_0x71cc('0x1f')](function(_0x21ef21){_0x34c6bc['rows']=_0x21ef21;return _0x34c6bc;})['then'](respondWithFilteredResult(_0x4fa63e,_0x3054ff))['catch'](handleError(_0x4fa63e,null));};exports[_0x71cc('0x42')]=function(_0x51c0e7,_0x3bd7d0){var _0x38ef60={'raw':!![],'where':{'id':_0x51c0e7[_0x71cc('0x43')]['id']}},_0x70cd0e={};_0x70cd0e[_0x71cc('0x2f')]=_[_0x71cc('0x30')](db[_0x71cc('0x2b')][_0x71cc('0x44')]);_0x70cd0e[_0x71cc('0x33')]=_[_0x71cc('0x30')](_0x51c0e7[_0x71cc('0x33')]);_0x70cd0e[_0x71cc('0x3a')]=_[_0x71cc('0x31')](_0x70cd0e['model'],_0x70cd0e[_0x71cc('0x33')]);_0x38ef60[_0x71cc('0x32')]=_[_0x71cc('0x31')](_0x70cd0e['model'],qs[_0x71cc('0x34')](_0x51c0e7[_0x71cc('0x33')][_0x71cc('0x34')]));_0x38ef60[_0x71cc('0x32')]=_0x38ef60[_0x71cc('0x32')][_0x71cc('0x35')]?_0x38ef60[_0x71cc('0x32')]:_0x70cd0e[_0x71cc('0x2f')];if(_0x51c0e7[_0x71cc('0x33')][_0x71cc('0x45')]){_0x38ef60[_0x71cc('0x40')]=[{'all':!![]}];}_0x38ef60=_[_0x71cc('0x3e')]({},_0x38ef60,_0x51c0e7['options']);return db[_0x71cc('0x2b')][_0x71cc('0x46')](_0x38ef60)[_0x71cc('0x1f')](handleEntityNotFound(_0x3bd7d0,null))[_0x71cc('0x1f')](respondWithResult(_0x3bd7d0,null))[_0x71cc('0x47')](handleError(_0x3bd7d0,null));};exports[_0x71cc('0x48')]=function(_0x430387,_0x51cd49){return db[_0x71cc('0x2b')][_0x71cc('0x48')](_0x430387['body'],{})[_0x71cc('0x1f')](function(_0x41ef8d){var _0x1bda7f=_0x430387[_0x71cc('0x49')][_0x71cc('0x20')]({'plain':!![]});if(!_0x1bda7f)throw new Error(_0x71cc('0x4a'));if(_0x1bda7f[_0x71cc('0x4b')]===_0x71cc('0x49')){var _0x3cf0bf=_0x41ef8d[_0x71cc('0x20')]({'plain':!![]});var _0x7178fc='Tags';return db[_0x71cc('0x4c')]['find']({'where':{'name':_0x7178fc,'userProfileId':_0x1bda7f[_0x71cc('0x4d')]},'raw':!![]})['then'](function(_0x2fbc04){if(_0x2fbc04&&_0x2fbc04[_0x71cc('0x4e')]===0x0){return db['UserProfileResource'][_0x71cc('0x48')]({'name':_0x3cf0bf[_0x71cc('0x27')],'resourceId':_0x3cf0bf['id'],'type':_0x2fbc04['name'],'sectionId':_0x2fbc04['id']},{})[_0x71cc('0x1f')](function(){return _0x41ef8d;});}else{return _0x41ef8d;}})[_0x71cc('0x47')](function(_0x459c57){logger[_0x71cc('0x25')](_0x71cc('0x4f'),_0x459c57);throw _0x459c57;});}return _0x41ef8d;})[_0x71cc('0x1f')](respondWithResult(_0x51cd49,0xc9))[_0x71cc('0x47')](handleError(_0x51cd49,null));};exports['update']=function(_0xb3df46,_0xdc11f2){if(_0xb3df46['body']['id']){delete _0xb3df46['body']['id'];}return db[_0x71cc('0x2b')][_0x71cc('0x46')]({'where':{'id':_0xb3df46['params']['id']}})[_0x71cc('0x1f')](handleEntityNotFound(_0xdc11f2,null))[_0x71cc('0x1f')](saveUpdates(_0xb3df46[_0x71cc('0x50')],null))[_0x71cc('0x1f')](respondWithResult(_0xdc11f2,null))[_0x71cc('0x47')](handleError(_0xdc11f2,null));};exports[_0x71cc('0x23')]=function(_0x4e607d,_0x49cd24){return db[_0x71cc('0x2b')]['find']({'where':{'id':_0x4e607d['params']['id']}})[_0x71cc('0x1f')](handleEntityNotFound(_0x49cd24,null))['then'](removeEntity(_0x49cd24,null))['catch'](handleError(_0x49cd24,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 4240855..837fadb 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 _0xda3d=['moment','bluebird','request-promise','rimraf','./tag.attributes','Tag','tools_tags','../../config/logger'];(function(_0x249a1c,_0xa648f8){var _0x47ffba=function(_0x577461){while(--_0x577461){_0x249a1c['push'](_0x249a1c['shift']());}};_0x47ffba(++_0xa648f8);}(_0xda3d,0x1d7));var _0xdda3=function(_0x322f55,_0x2addc8){_0x322f55=_0x322f55-0x0;var _0x2c2640=_0xda3d[_0x322f55];return _0x2c2640;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdda3('0x0'))('api');var moment=require(_0xdda3('0x1'));var BPromise=require(_0xdda3('0x2'));var rp=require(_0xdda3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdda3('0x4'));var config=require('../../config/environment');var attributes=require(_0xdda3('0x5'));module['exports']=function(_0x15ada4,_0x5ac6f5){return _0x15ada4['define'](_0xdda3('0x6'),attributes,{'tableName':_0xdda3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37fd=['path','rimraf','../../config/environment','exports','define','Tag','tools_tags','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x296144,_0x26bbbf){var _0x5329b1=function(_0x5d321b){while(--_0x5d321b){_0x296144['push'](_0x296144['shift']());}};_0x5329b1(++_0x26bbbf);}(_0x37fd,0x89));var _0xd37f=function(_0x542a4e,_0x23f7ef){_0x542a4e=_0x542a4e-0x0;var _0x11d75d=_0x37fd[_0x542a4e];return _0x11d75d;};'use strict';var _=require(_0xd37f('0x0'));var util=require(_0xd37f('0x1'));var logger=require(_0xd37f('0x2'))('api');var moment=require(_0xd37f('0x3'));var BPromise=require(_0xd37f('0x4'));var rp=require(_0xd37f('0x5'));var fs=require('fs');var path=require(_0xd37f('0x6'));var rimraf=require(_0xd37f('0x7'));var config=require(_0xd37f('0x8'));var attributes=require('./tag.attributes');module[_0xd37f('0x9')]=function(_0x28051d,_0x58f76f){return _0x28051d[_0xd37f('0xa')](_0xd37f('0xb'),attributes,{'tableName':_0xd37f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 5236427..b48f5d2 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 _0xfa2b=['jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x41767f,_0x2505c0){var _0x162611=function(_0x28ea64){while(--_0x28ea64){_0x41767f['push'](_0x41767f['shift']());}};_0x162611(++_0x2505c0);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x9abf91,_0x5ac968){_0x9abf91=_0x9abf91-0x0;var _0x18be07=_0xfa2b[_0x9abf91];return _0x18be07;};'use strict';var _=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var moment=require(_0xbfa2('0x2'));var BPromise=require(_0xbfa2('0x3'));var rs=require(_0xbfa2('0x4'));var fs=require('fs');var Redis=require(_0xbfa2('0x5'));var db=require(_0xbfa2('0x6'))['db'];var utils=require(_0xbfa2('0x7'));var logger=require(_0xbfa2('0x8'))(_0xbfa2('0x9'));var config=require(_0xbfa2('0xa'));var jayson=require(_0xbfa2('0xb'));var client=jayson[_0xbfa2('0xc')][_0xbfa2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x26ed93,_0x26e9bf,_0x4cd9ae){return new BPromise(function(_0x46a151,_0x4f17e6){return client[_0xbfa2('0xe')](_0x26ed93,_0x4cd9ae)[_0xbfa2('0xf')](function(_0x1b1c13){logger[_0xbfa2('0x10')](_0xbfa2('0x11'),_0x26e9bf,_0xbfa2('0x12'));logger[_0xbfa2('0x13')](_0xbfa2('0x14'),_0x26e9bf,_0xbfa2('0x12'),JSON['stringify'](_0x1b1c13));if(_0x1b1c13['error']){if(_0x1b1c13['error'][_0xbfa2('0x15')]===0x1f4){logger[_0xbfa2('0x16')](_0xbfa2('0x11'),_0x26e9bf,_0x1b1c13[_0xbfa2('0x16')][_0xbfa2('0x17')]);return _0x4f17e6(_0x1b1c13[_0xbfa2('0x16')]['message']);}logger[_0xbfa2('0x16')](_0xbfa2('0x11'),_0x26e9bf,_0x1b1c13[_0xbfa2('0x16')][_0xbfa2('0x17')]);return _0x46a151(_0x1b1c13[_0xbfa2('0x16')]['message']);}else{logger[_0xbfa2('0x10')]('Tag,\x20%s,\x20%s',_0x26e9bf,'request\x20sent');_0x46a151(_0x1b1c13[_0xbfa2('0x18')]['message']);}})['catch'](function(_0xab2c91){logger[_0xbfa2('0x16')]('Tag,\x20%s,\x20%s',_0x26e9bf,_0xab2c91);_0x4f17e6(_0xab2c91);});});} \ No newline at end of file +var _0x0ba7=['client','http','request','then','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x0ba7,0x16d));var _0x70ba=function(_0x31c88e,_0x3c8e69){_0x31c88e=_0x31c88e-0x0;var _0x28af53=_0x0ba7[_0x31c88e];return _0x28af53;};'use strict';var _=require(_0x70ba('0x0'));var util=require('util');var moment=require(_0x70ba('0x1'));var BPromise=require(_0x70ba('0x2'));var rs=require(_0x70ba('0x3'));var fs=require('fs');var Redis=require(_0x70ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x70ba('0x5'));var logger=require(_0x70ba('0x6'))(_0x70ba('0x7'));var config=require(_0x70ba('0x8'));var jayson=require(_0x70ba('0x9'));var client=jayson[_0x70ba('0xa')][_0x70ba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d5a16,_0x240696,_0x1185cb){return new BPromise(function(_0x1a968b,_0x41cd10){return client[_0x70ba('0xc')](_0x2d5a16,_0x1185cb)[_0x70ba('0xd')](function(_0x465b7c){logger['info'](_0x70ba('0xe'),_0x240696,'request\x20sent');logger[_0x70ba('0xf')](_0x70ba('0x10'),_0x240696,_0x70ba('0x11'),JSON[_0x70ba('0x12')](_0x465b7c));if(_0x465b7c['error']){if(_0x465b7c['error'][_0x70ba('0x13')]===0x1f4){logger['error'](_0x70ba('0xe'),_0x240696,_0x465b7c['error'][_0x70ba('0x14')]);return _0x41cd10(_0x465b7c[_0x70ba('0x15')]['message']);}logger[_0x70ba('0x15')]('Tag,\x20%s,\x20%s',_0x240696,_0x465b7c[_0x70ba('0x15')][_0x70ba('0x14')]);return _0x1a968b(_0x465b7c[_0x70ba('0x15')][_0x70ba('0x14')]);}else{logger[_0x70ba('0x16')](_0x70ba('0xe'),_0x240696,_0x70ba('0x11'));_0x1a968b(_0x465b7c[_0x70ba('0x17')][_0x70ba('0x14')]);}})[_0x70ba('0x18')](function(_0x30ac22){logger[_0x70ba('0x15')](_0x70ba('0xe'),_0x240696,_0x30ac22);_0x41cd10(_0x30ac22);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 879593a..a889964 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 639913f..0b180d6 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x269988,_0x6c5940){var _0x172812=function(_0x3ccac5){while(--_0x3ccac5){_0x269988['push'](_0x269988['shift']());}};_0x172812(++_0x6c5940);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xe706,0xa3));var _0x6e70=function(_0x110924,_0x1374bb){_0x110924=_0x110924-0x0;var _0x12905b=_0xe706[_0x110924];return _0x12905b;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index cc3579c..3431ce9 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 _0x45d6=['undefined','count','offset','limit','set','apply','reject','save','then','destroy','get','Teams','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','length','includeAll','include','find','create','Team','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getQueues','channel','ValidationError','Unknown\x20channel','toLowerCase','Queue','pick','capitalize','addQueues','findOne','isValidChannel','Sequelize','add','Queues','ids','addAgents','Chat','Sms','Fax','Openchannel','sequelize','transaction','Voice','penalty','QueueId','TeamVoiceQueue','User','Queue:save','online','interface','upsert','isNil','SIP/%s','voicePause','all','parse','VoicePrefixId','spread','Mail','Whatsapp','removeAgents','emit','Queue:remove','UserVoicePrefix','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json'];(function(_0x3ac72d,_0x591c5d){var _0x19273a=function(_0x46967b){while(--_0x46967b){_0x3ac72d['push'](_0x3ac72d['shift']());}};_0x19273a(++_0x591c5d);}(_0x45d6,0xef));var _0x645d=function(_0x55c9ee,_0x26882){_0x55c9ee=_0x55c9ee-0x0;var _0x2adba0=_0x45d6[_0x55c9ee];return _0x2adba0;};'use strict';var emlformat=require(_0x645d('0x0'));var rimraf=require(_0x645d('0x1'));var zipdir=require(_0x645d('0x2'));var jsonpatch=require(_0x645d('0x3'));var rp=require(_0x645d('0x4'));var moment=require(_0x645d('0x5'));var BPromise=require(_0x645d('0x6'));var Mustache=require(_0x645d('0x7'));var util=require(_0x645d('0x8'));var path=require(_0x645d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x645d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x645d('0xb'));var squel=require(_0x645d('0xc'));var crypto=require(_0x645d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x645d('0xe'));var toCsv=require(_0x645d('0xf'));var querystring=require('querystring');var Papa=require(_0x645d('0x10'));var Redis=require('ioredis');var authService=require(_0x645d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x645d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x645d('0x13'));var utils=require(_0x645d('0x14'));var config=require(_0x645d('0x15'));var licenseUtil=require(_0x645d('0x16'));var db=require('../../mysqldb')['db'];config[_0x645d('0x17')]=_[_0x645d('0x18')](config[_0x645d('0x17')],{'host':_0x645d('0x19'),'port':0x18eb});var socket=require(_0x645d('0x1a'))(new Redis(config['redis']));require('./team.socket')[_0x645d('0x1b')](socket);function respondWithStatusCode(_0x4284a5,_0x4c2242){_0x4c2242=_0x4c2242||0xcc;return function(_0x393ec2){if(_0x393ec2){return _0x4284a5[_0x645d('0x1c')](_0x4c2242);}return _0x4284a5[_0x645d('0x1d')](_0x4c2242)['end']();};}function respondWithResult(_0x413080,_0x4956a5){_0x4956a5=_0x4956a5||0xc8;return function(_0x5e4f69){if(_0x5e4f69){return _0x413080[_0x645d('0x1d')](_0x4956a5)[_0x645d('0x1e')](_0x5e4f69);}};}function respondWithFilteredResult(_0x4587df,_0xd1cacd){return function(_0x279a3c){if(_0x279a3c){var _0x148b88=typeof _0xd1cacd['offset']===_0x645d('0x1f')&&typeof _0xd1cacd['limit']===_0x645d('0x1f');var _0x8404cf=_0x279a3c[_0x645d('0x20')];var _0x3a9c18=_0x148b88?0x0:_0xd1cacd[_0x645d('0x21')];var _0x223dbe=_0x148b88?_0x279a3c['count']:_0xd1cacd[_0x645d('0x21')]+_0xd1cacd[_0x645d('0x22')];var _0x494784;if(_0x223dbe>=_0x8404cf){_0x223dbe=_0x8404cf;_0x494784=0xc8;}else{_0x494784=0xce;}_0x4587df[_0x645d('0x1d')](_0x494784);return _0x4587df[_0x645d('0x23')]('Content-Range',_0x3a9c18+'-'+_0x223dbe+'/'+_0x8404cf)['json'](_0x279a3c);}return null;};}function patchUpdates(_0x591cbf){return function(_0x31926a){try{jsonpatch[_0x645d('0x24')](_0x31926a,_0x591cbf,!![]);}catch(_0xe4519e){return BPromise[_0x645d('0x25')](_0xe4519e);}return _0x31926a[_0x645d('0x26')]();};}function saveUpdates(_0x14f0a2,_0xf11518){return function(_0x83842f){if(_0x83842f){return _0x83842f['update'](_0x14f0a2)[_0x645d('0x27')](function(_0x23fe9f){return _0x23fe9f;});}return null;};}function removeEntity(_0x4f782f,_0x332174){return function(_0x1fab1f){if(_0x1fab1f){return _0x1fab1f[_0x645d('0x28')]()[_0x645d('0x27')](function(){var _0x2d1141=_0x1fab1f[_0x645d('0x29')]({'plain':!![]});var _0x19d49b=_0x645d('0x2a');return db[_0x645d('0x2b')]['destroy']({'where':{'type':_0x19d49b,'resourceId':_0x2d1141['id']}})[_0x645d('0x27')](function(){return _0x1fab1f;});})['then'](function(){_0x4f782f[_0x645d('0x1d')](0xcc)[_0x645d('0x2c')]();});}};}function handleEntityNotFound(_0x56d414,_0xbbe12d){return function(_0x1c9037){if(!_0x1c9037){_0x56d414[_0x645d('0x1c')](0x194);}return _0x1c9037;};}function handleError(_0x327b24,_0x366cd0){_0x366cd0=_0x366cd0||0x1f4;return function(_0x52c4c5){logger[_0x645d('0x2d')](_0x52c4c5[_0x645d('0x2e')]);if(_0x52c4c5[_0x645d('0x2f')]){delete _0x52c4c5['name'];}_0x327b24[_0x645d('0x1d')](_0x366cd0)[_0x645d('0x30')](_0x52c4c5);};}exports[_0x645d('0x31')]=function(_0x5a914e,_0x1a3d73){var _0x24405d={},_0x508323={},_0xe082c4={'count':0x0,'rows':[]};var _0x47b6eb=_[_0x645d('0x32')](db['Team'][_0x645d('0x33')],function(_0x56fcf7){return{'name':_0x56fcf7[_0x645d('0x34')],'type':_0x56fcf7['type'][_0x645d('0x35')]};});_0x508323['model']=_[_0x645d('0x32')](_0x47b6eb,_0x645d('0x2f'));_0x508323[_0x645d('0x36')]=_['keys'](_0x5a914e[_0x645d('0x36')]);_0x508323['filters']=_[_0x645d('0x37')](_0x508323[_0x645d('0x38')],_0x508323[_0x645d('0x36')]);_0x24405d['attributes']=_[_0x645d('0x37')](_0x508323[_0x645d('0x38')],qs[_0x645d('0x39')](_0x5a914e[_0x645d('0x36')][_0x645d('0x39')]));_0x24405d[_0x645d('0x3a')]=_0x24405d[_0x645d('0x3a')]['length']?_0x24405d[_0x645d('0x3a')]:_0x508323[_0x645d('0x38')];if(!_0x5a914e[_0x645d('0x36')][_0x645d('0x3b')](_0x645d('0x3c'))){_0x24405d[_0x645d('0x22')]=qs['limit'](_0x5a914e[_0x645d('0x36')][_0x645d('0x22')]);_0x24405d['offset']=qs['offset'](_0x5a914e[_0x645d('0x36')][_0x645d('0x21')]);}_0x24405d[_0x645d('0x3d')]=qs[_0x645d('0x3e')](_0x5a914e['query']['sort']);_0x24405d[_0x645d('0x3f')]=qs[_0x645d('0x40')](_['pick'](_0x5a914e[_0x645d('0x36')],_0x508323[_0x645d('0x40')]),_0x47b6eb);if(_0x5a914e[_0x645d('0x36')][_0x645d('0x41')]){_0x24405d['where']=_[_0x645d('0x42')](_0x24405d[_0x645d('0x3f')],{'$or':_['map'](_0x47b6eb,function(_0x4dacbe){if(_0x4dacbe['type']!==_0x645d('0x43')){var _0xe57cfa={};_0xe57cfa[_0x4dacbe[_0x645d('0x2f')]]={'$like':'%'+_0x5a914e['query'][_0x645d('0x41')]+'%'};return _0xe57cfa;}})});}_0x24405d=_[_0x645d('0x42')]({},_0x24405d,_0x5a914e[_0x645d('0x44')]);var _0x1304d6={'where':_0x24405d[_0x645d('0x3f')]};return db['Team'][_0x645d('0x20')](_0x1304d6)[_0x645d('0x27')](function(_0x52109e){_0xe082c4[_0x645d('0x20')]=_0x52109e;if(_0x5a914e[_0x645d('0x36')]['includeAll']){_0x24405d['include']=[{'all':!![]}];}return db['Team'][_0x645d('0x45')](_0x24405d);})[_0x645d('0x27')](function(_0x4f5b07){_0xe082c4[_0x645d('0x46')]=_0x4f5b07;return _0xe082c4;})[_0x645d('0x27')](respondWithFilteredResult(_0x1a3d73,_0x24405d))[_0x645d('0x47')](handleError(_0x1a3d73,null));};exports[_0x645d('0x48')]=function(_0x2c8d10,_0x2e52d0){var _0x211b0d={'raw':![],'where':{'id':_0x2c8d10[_0x645d('0x49')]['id']}},_0x7743c1={};_0x7743c1['model']=_[_0x645d('0x4a')](db['Team']['rawAttributes']);_0x7743c1[_0x645d('0x36')]=_[_0x645d('0x4a')](_0x2c8d10[_0x645d('0x36')]);_0x7743c1[_0x645d('0x40')]=_[_0x645d('0x37')](_0x7743c1[_0x645d('0x38')],_0x7743c1[_0x645d('0x36')]);_0x211b0d['attributes']=_[_0x645d('0x37')](_0x7743c1[_0x645d('0x38')],qs[_0x645d('0x39')](_0x2c8d10[_0x645d('0x36')][_0x645d('0x39')]));_0x211b0d[_0x645d('0x3a')]=_0x211b0d[_0x645d('0x3a')][_0x645d('0x4b')]?_0x211b0d[_0x645d('0x3a')]:_0x7743c1['model'];if(_0x2c8d10[_0x645d('0x36')][_0x645d('0x4c')]){_0x211b0d[_0x645d('0x4d')]=[{'all':!![]}];}_0x211b0d=_['merge']({},_0x211b0d,_0x2c8d10[_0x645d('0x44')]);return db['Team'][_0x645d('0x4e')](_0x211b0d)['then'](handleEntityNotFound(_0x2e52d0,null))[_0x645d('0x27')](respondWithResult(_0x2e52d0,null))[_0x645d('0x47')](handleError(_0x2e52d0,null));};exports[_0x645d('0x4f')]=function(_0x5a8261,_0x2902fb){return db[_0x645d('0x50')]['create'](_0x5a8261[_0x645d('0x51')],{})[_0x645d('0x27')](function(_0x587dd3){var _0x3ef32e=_0x5a8261[_0x645d('0x52')][_0x645d('0x29')]({'plain':!![]});if(!_0x3ef32e)throw new Error(_0x645d('0x53'));if(_0x3ef32e[_0x645d('0x54')]==='user'){var _0x1b895a=_0x587dd3['get']({'plain':!![]});var _0x1415f0=_0x645d('0x2a');return db[_0x645d('0x55')][_0x645d('0x4e')]({'where':{'name':_0x1415f0,'userProfileId':_0x3ef32e[_0x645d('0x56')]},'raw':!![]})[_0x645d('0x27')](function(_0x5852f9){if(_0x5852f9&&_0x5852f9[_0x645d('0x57')]===0x0){return db[_0x645d('0x2b')][_0x645d('0x4f')]({'name':_0x1b895a[_0x645d('0x2f')],'resourceId':_0x1b895a['id'],'type':_0x5852f9[_0x645d('0x2f')],'sectionId':_0x5852f9['id']},{})[_0x645d('0x27')](function(){return _0x587dd3;});}else{return _0x587dd3;}})['catch'](function(_0x27fede){logger['error'](_0x645d('0x58'),_0x27fede);throw _0x27fede;});}return _0x587dd3;})['then'](respondWithResult(_0x2902fb,0xc9))[_0x645d('0x47')](handleError(_0x2902fb,null));};exports[_0x645d('0x59')]=function(_0x2a42bb,_0x255333){if(_0x2a42bb[_0x645d('0x51')]['id']){delete _0x2a42bb[_0x645d('0x51')]['id'];}return db[_0x645d('0x50')]['find']({'where':{'id':_0x2a42bb[_0x645d('0x49')]['id']}})[_0x645d('0x27')](handleEntityNotFound(_0x255333,null))[_0x645d('0x27')](saveUpdates(_0x2a42bb[_0x645d('0x51')],null))[_0x645d('0x27')](respondWithResult(_0x255333,null))['catch'](handleError(_0x255333,null));};exports[_0x645d('0x28')]=function(_0x239d86,_0x5a1473){return db[_0x645d('0x50')]['find']({'where':{'id':_0x239d86['params']['id']}})[_0x645d('0x27')](handleEntityNotFound(_0x5a1473,null))[_0x645d('0x27')](removeEntity(_0x5a1473,null))['catch'](handleError(_0x5a1473,null));};exports[_0x645d('0x5a')]=function(_0x5df7b2,_0x41fda4,_0x28d509){return db[_0x645d('0x50')]['findOne']({'where':{'id':_0x5df7b2[_0x645d('0x49')]['id']}})[_0x645d('0x27')](handleEntityNotFound(_0x41fda4,null))[_0x645d('0x27')](function(_0x3cdb00){if(!_0x5df7b2[_0x645d('0x36')][_0x645d('0x5b')]||!utils['isValidChannel'](_0x5df7b2[_0x645d('0x36')][_0x645d('0x5b')])){throw new db['Sequelize'][(_0x645d('0x5c'))](_0x645d('0x5d'));}var _0x3570c7={};var _0x1030db={};_0x1030db[_0x645d('0x38')]=_['keys'](db[_['capitalize'](_0x5df7b2[_0x645d('0x36')]['channel'][_0x645d('0x5e')]())+_0x645d('0x5f')][_0x645d('0x33')]);_0x1030db[_0x645d('0x36')]=_['keys'](_0x5df7b2[_0x645d('0x36')]);_0x1030db[_0x645d('0x40')]=_['intersection'](_0x1030db[_0x645d('0x38')],_0x1030db[_0x645d('0x36')]);_0x3570c7[_0x645d('0x3a')]=_[_0x645d('0x37')](_0x1030db[_0x645d('0x38')],qs['fields'](_0x5df7b2[_0x645d('0x36')]['fields']));_0x3570c7[_0x645d('0x3a')]=_0x3570c7[_0x645d('0x3a')][_0x645d('0x4b')]?_0x3570c7[_0x645d('0x3a')]:_0x1030db[_0x645d('0x38')];_0x3570c7[_0x645d('0x22')]=qs[_0x645d('0x22')](_0x5df7b2[_0x645d('0x36')][_0x645d('0x22')]);_0x3570c7[_0x645d('0x21')]=qs['offset'](_0x5df7b2[_0x645d('0x36')]['offset']);_0x3570c7['order']=qs['sort'](_0x5df7b2['query']['sort']);_0x3570c7[_0x645d('0x3f')]=qs[_0x645d('0x40')](_[_0x645d('0x60')](_0x5df7b2['query'],_0x1030db['filters']));_0x3570c7=_['merge']({},_0x3570c7,_0x5df7b2[_0x645d('0x44')]);return _0x3cdb00[_0x645d('0x29')+_[_0x645d('0x61')](_0x5df7b2[_0x645d('0x36')][_0x645d('0x5b')][_0x645d('0x5e')]())+'Queues'](_0x3570c7);})[_0x645d('0x27')](respondWithResult(_0x41fda4,null))[_0x645d('0x47')](handleError(_0x41fda4,null));};exports[_0x645d('0x62')]=function(_0x4fc063,_0x3abfdc,_0x4da432){return db[_0x645d('0x50')][_0x645d('0x63')]({'where':{'id':_0x4fc063[_0x645d('0x49')]['id']}})[_0x645d('0x27')](function(_0x659189){if(_0x659189){if(!_0x4fc063['body'][_0x645d('0x5b')]||!utils[_0x645d('0x64')](_0x4fc063[_0x645d('0x51')][_0x645d('0x5b')])){throw new db[(_0x645d('0x65'))][(_0x645d('0x5c'))]('Unknown\x20channel');}return _0x659189[_0x645d('0x66')+_[_0x645d('0x61')](_0x4fc063[_0x645d('0x51')]['channel'][_0x645d('0x5e')]())+_0x645d('0x67')](_0x4fc063[_0x645d('0x51')][_0x645d('0x68')]);}return null;})[_0x645d('0x27')](handleEntityNotFound(_0x3abfdc,null))[_0x645d('0x27')](respondWithStatusCode(_0x3abfdc,null))[_0x645d('0x47')](handleError(_0x3abfdc,null));};exports['removeQueues']=function(_0x2604d2,_0x190877,_0x2f1dec){return db[_0x645d('0x50')]['findOne']({'where':{'id':_0x2604d2['params']['id']}})[_0x645d('0x27')](function(_0x2ddb0e){if(_0x2ddb0e){if(!_0x2604d2[_0x645d('0x36')][_0x645d('0x5b')]||!utils[_0x645d('0x64')](_0x2604d2[_0x645d('0x36')][_0x645d('0x5b')])){throw new db[(_0x645d('0x65'))][(_0x645d('0x5c'))](_0x645d('0x5d'));}return _0x2ddb0e['remove'+_[_0x645d('0x61')](_0x2604d2[_0x645d('0x36')][_0x645d('0x5b')][_0x645d('0x5e')]())+'Queues'](_0x2604d2[_0x645d('0x36')][_0x645d('0x68')]);}return null;})[_0x645d('0x27')](handleEntityNotFound(_0x190877,null))[_0x645d('0x27')](respondWithStatusCode(_0x190877,null))[_0x645d('0x47')](handleError(_0x190877,null));};exports[_0x645d('0x69')]=function(_0x46cf10,_0x29cf7a){return db['Team'][_0x645d('0x4e')]({'where':{'id':_0x46cf10['params']['id']}})[_0x645d('0x27')](handleEntityNotFound(_0x29cf7a,null))[_0x645d('0x27')](function(_0x59907e){if(_0x59907e){var _0x176752=['Voice',_0x645d('0x6a'),'Mail',_0x645d('0x6b'),_0x645d('0x6c'),_0x645d('0x6d'),'Whatsapp'];return db[_0x645d('0x6e')][_0x645d('0x6f')](function(_0x134179){var _0x321d3a=_[_0x645d('0x32')](_0x176752,function(_0xdd0aeb){var _0x5b413b={'attributes':['id',_0x645d('0x2f')]};if(_0xdd0aeb===_0x645d('0x70')){_0x5b413b['through']={'attributes':[_0x645d('0x71')]};}return _0x59907e[_0x645d('0x29')+_0xdd0aeb+_0x645d('0x67')](_0x5b413b)[_0x645d('0x27')](function(_0x47102e){var _0x3d35dd=_[_0x645d('0x32')](_0x47102e,function(_0x31e498){var _0xc38a65=_[_0x645d('0x32')](_0x46cf10['body']['ids'],function(_0x11a905){var _0x57120c={'where':{'UserId':_0x11a905,[_0xdd0aeb+_0x645d('0x72')]:_0x31e498['id']},'transaction':_0x134179};if(_0xdd0aeb==='Voice'){_0x57120c[_0x645d('0x18')]={'penalty':_0x31e498[_0x645d('0x73')][_0x645d('0x71')]};}return db[_0x645d('0x74')+_0xdd0aeb+'Queue']['findOrCreate'](_0x57120c)[_0x645d('0x27')](function(){socket['emit'](_0x645d('0x52')+_0xdd0aeb+_0x645d('0x75'),{'UserId':_0x11a905,[_0xdd0aeb+_0x645d('0x72')]:_0x31e498['id']});if(_0xdd0aeb!==_0x645d('0x70'))return;return db['User']['findAll']({'where':{'id':_0x46cf10[_0x645d('0x51')][_0x645d('0x68')],'online':0x1},'attributes':['id',_0x645d('0x2f'),_0x645d('0x76'),'voicePause',_0x645d('0x77')],'raw':!![]})[_0x645d('0x27')](function(_0x23ebe2){var _0x20ef8e=_['map'](_0x23ebe2,function(_0x38ca0a){return db['UserVoiceQueueRt'][_0x645d('0x78')]({'membername':_0x38ca0a[_0x645d('0x2f')],'UserId':_0x38ca0a['id'],'queue_name':_0x31e498[_0x645d('0x2f')],'VoiceQueueId':_0x31e498['id'],'interface':_[_0x645d('0x79')](_0x38ca0a[_0x645d('0x77')])?util['format'](_0x645d('0x7a'),_0x38ca0a[_0x645d('0x2f')]):_0x38ca0a[_0x645d('0x77')],'paused':_0x38ca0a[_0x645d('0x7b')]||![],'penalty':_0x31e498['TeamVoiceQueue'][_0x645d('0x71')]},{'transaction':_0x134179});});return Promise[_0x645d('0x7c')](_0x20ef8e);});});});return Promise[_0x645d('0x7c')](_0xc38a65);});return Promise[_0x645d('0x7c')](_0x3d35dd);})[_0x645d('0x27')](function(){var _0x2e08a0=JSON[_0x645d('0x7d')]('['+_0x46cf10[_0x645d('0x51')]['ids']+']');db['TeamVoicePrefix'][_0x645d('0x63')]({'where':{'teamId':_0x46cf10[_0x645d('0x49')]['id']}})[_0x645d('0x27')](function(_0x42d34a){if(_0x42d34a){for(var _0x13e81e=0x0;_0x13e81e<_0x2e08a0[_0x645d('0x4b')];_0x13e81e++){var _0xb3dcbd=_0x2e08a0[_0x13e81e];db['UserVoicePrefix'][_0x645d('0x78')]({'UserId':_0xb3dcbd,'VoicePrefixId':_0x42d34a[_0x645d('0x7e')]});}}});});});return Promise[_0x645d('0x7c')](_0x321d3a)['then'](function(){return _0x59907e[_0x645d('0x69')](_0x46cf10[_0x645d('0x51')][_0x645d('0x68')],{'transaction':_0x134179})[_0x645d('0x7f')](function(_0x338cc0){return _0x338cc0;});});});}})['then'](respondWithResult(_0x29cf7a,null))['catch'](handleError(_0x29cf7a,null));};exports['removeAgents']=function(_0x4a4c50,_0x4b07c5){return db[_0x645d('0x50')][_0x645d('0x4e')]({'where':{'id':_0x4a4c50[_0x645d('0x49')]['id']}})[_0x645d('0x27')](handleEntityNotFound(_0x4b07c5,null))['then'](function(_0x3eaa83){if(_0x3eaa83){var _0x1430c8=['Voice','Chat',_0x645d('0x80'),'Sms',_0x645d('0x6c'),'Openchannel',_0x645d('0x81')];return db[_0x645d('0x6e')]['transaction'](function(_0x2835f9){var _0xa35c02=_[_0x645d('0x32')](_0x1430c8,function(_0x37322b){var _0x383c8f={'attributes':['id',_0x645d('0x2f')]};return _0x3eaa83[_0x645d('0x29')+_0x37322b+_0x645d('0x67')](_0x383c8f)[_0x645d('0x27')](function(_0x208fb0){var _0x58698b=_[_0x645d('0x32')](_0x208fb0,function(_0x32f51e){return _0x32f51e[_0x645d('0x82')](_0x4a4c50[_0x645d('0x36')][_0x645d('0x68')],{'transaction':_0x2835f9})['then'](function(){var _0x39d59=JSON[_0x645d('0x7d')]('['+_0x4a4c50[_0x645d('0x36')][_0x645d('0x68')]+']');var _0xac5af1=_['map'](_0x39d59,function(_0x283be5){socket[_0x645d('0x83')]('user'+_0x37322b+_0x645d('0x84'),{'UserId':Number(_0x283be5),[_0x37322b+_0x645d('0x72')]:_0x32f51e['id']});if(_0x37322b!==_0x645d('0x70'))return;return db['UserVoiceQueueRt'][_0x645d('0x28')]({'where':{'VoiceQueueId':_0x32f51e['id'],'UserId':_0x283be5},'transaction':_0x2835f9});});return Promise['all'](_0xac5af1);});});return Promise[_0x645d('0x7c')](_0x58698b);});});return Promise[_0x645d('0x7c')](_0xa35c02)['then'](function(){return _0x3eaa83[_0x645d('0x82')](_0x4a4c50['query']['ids'],{'transaction':_0x2835f9});})[_0x645d('0x27')](function(){var _0x3995b2=JSON['parse']('['+_0x4a4c50[_0x645d('0x36')][_0x645d('0x68')]+']');db['TeamVoicePrefix'][_0x645d('0x63')]({'where':{'teamId':_0x4a4c50[_0x645d('0x49')]['id']}})['then'](function(_0x39c613){if(_0x39c613){for(var _0x6b257b=0x0;_0x6b257b<_0x3995b2[_0x645d('0x4b')];_0x6b257b++){var _0x2e1242=_0x3995b2[_0x6b257b];db[_0x645d('0x85')][_0x645d('0x28')]({'where':{'UserId':_0x2e1242,'VoicePrefixId':_0x39c613['VoicePrefixId']}});}}});});});}})['then'](respondWithStatusCode(_0x4b07c5,null))[_0x645d('0x47')](handleError(_0x4b07c5,null));};exports['getAgents']=function(_0x1fc006,_0x26bb8f,_0x25f399){var _0xedc183={};var _0x5e73aa={};var _0x3130b1;var _0x3390a1;return db[_0x645d('0x50')][_0x645d('0x63')]({'where':{'id':_0x1fc006[_0x645d('0x49')]['id']}})[_0x645d('0x27')](handleEntityNotFound(_0x26bb8f,null))[_0x645d('0x27')](function(_0x413a9b){if(_0x413a9b){_0x3130b1=_0x413a9b;_0x5e73aa['model']=_[_0x645d('0x4a')](db[_0x645d('0x74')][_0x645d('0x33')]);_0x5e73aa['query']=_[_0x645d('0x4a')](_0x1fc006['query']);_0x5e73aa[_0x645d('0x40')]=_['intersection'](_0x5e73aa[_0x645d('0x38')],_0x5e73aa['query']);_0xedc183['attributes']=_[_0x645d('0x37')](_0x5e73aa[_0x645d('0x38')],qs[_0x645d('0x39')](_0x1fc006[_0x645d('0x36')]['fields']));_0xedc183[_0x645d('0x3a')]=_0xedc183[_0x645d('0x3a')][_0x645d('0x4b')]?_0xedc183[_0x645d('0x3a')]:_0x5e73aa[_0x645d('0x38')];_0xedc183[_0x645d('0x3d')]=qs['sort'](_0x1fc006[_0x645d('0x36')][_0x645d('0x3e')]);_0xedc183['where']=qs['filters'](_[_0x645d('0x60')](_0x1fc006[_0x645d('0x36')],_0x5e73aa[_0x645d('0x40')]));if(_0x1fc006[_0x645d('0x36')]['filter']){_0xedc183['where']=_[_0x645d('0x42')](_0xedc183[_0x645d('0x3f')],{'$or':_[_0x645d('0x32')](_0xedc183[_0x645d('0x3a')],function(_0x504cf5){var _0x4715f0={};_0x4715f0[_0x504cf5]={'$like':'%'+_0x1fc006['query'][_0x645d('0x41')]+'%'};return _0x4715f0;})});}_0xedc183=_['merge']({},_0xedc183,_0x1fc006[_0x645d('0x44')]);return _0x3130b1[_0x645d('0x86')](_0xedc183);}})[_0x645d('0x27')](function(_0x34430f){if(_0x34430f){_0x3390a1=_0x34430f[_0x645d('0x4b')];if(!_0x1fc006[_0x645d('0x36')][_0x645d('0x3b')]('nolimit')){_0xedc183[_0x645d('0x22')]=qs[_0x645d('0x22')](_0x1fc006[_0x645d('0x36')][_0x645d('0x22')]);_0xedc183[_0x645d('0x21')]=qs[_0x645d('0x21')](_0x1fc006[_0x645d('0x36')][_0x645d('0x21')]);}return _0x3130b1[_0x645d('0x86')](_0xedc183);}})[_0x645d('0x27')](function(_0x2d9d86){if(_0x2d9d86){return _0x2d9d86?{'count':_0x3390a1,'rows':_0x2d9d86}:null;}})[_0x645d('0x27')](respondWithResult(_0x26bb8f,null))[_0x645d('0x47')](handleError(_0x26bb8f,null));}; \ No newline at end of file +var _0x69c9=['Team','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','nolimit','sort','pick','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','create','user','role','Teams','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','getQueues','params','channel','isValidChannel','Sequelize','ValidationError','capitalize','toLowerCase','order','Queues','addQueues','findOne','Unknown\x20channel','add','removeQueues','remove','ids','addAgents','Voice','Mail','Fax','Openchannel','Whatsapp','transaction','through','penalty','QueueId','TeamVoiceQueue','Queue','emit','Queue:save','User','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','all','parse','UserVoicePrefix','VoicePrefixId','spread','removeAgents','Chat','Sms','sequelize','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','get','error','stack','name','send','index','map'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x69c9,0xe3));var _0x969c=function(_0x4875fd,_0x5060a3){_0x4875fd=_0x4875fd-0x0;var _0x20ebb3=_0x69c9[_0x4875fd];return _0x20ebb3;};'use strict';var emlformat=require(_0x969c('0x0'));var rimraf=require(_0x969c('0x1'));var zipdir=require(_0x969c('0x2'));var jsonpatch=require(_0x969c('0x3'));var rp=require(_0x969c('0x4'));var moment=require(_0x969c('0x5'));var BPromise=require(_0x969c('0x6'));var Mustache=require(_0x969c('0x7'));var util=require(_0x969c('0x8'));var path=require(_0x969c('0x9'));var sox=require('sox');var csv=require(_0x969c('0xa'));var ejs=require(_0x969c('0xb'));var fs=require('fs');var fs_extra=require(_0x969c('0xc'));var _=require(_0x969c('0xd'));var squel=require(_0x969c('0xe'));var crypto=require(_0x969c('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x969c('0x10'));var Papa=require(_0x969c('0x11'));var Redis=require(_0x969c('0x12'));var authService=require(_0x969c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x969c('0x14'));var hardwareService=require(_0x969c('0x15'));var logger=require(_0x969c('0x16'))(_0x969c('0x17'));var utils=require(_0x969c('0x18'));var config=require(_0x969c('0x19'));var licenseUtil=require(_0x969c('0x1a'));var db=require(_0x969c('0x1b'))['db'];config[_0x969c('0x1c')]=_[_0x969c('0x1d')](config[_0x969c('0x1c')],{'host':_0x969c('0x1e'),'port':0x18eb});var socket=require(_0x969c('0x1f'))(new Redis(config[_0x969c('0x1c')]));require('./team.socket')[_0x969c('0x20')](socket);function respondWithStatusCode(_0x5ecd0c,_0x5420b0){_0x5420b0=_0x5420b0||0xcc;return function(_0x63f327){if(_0x63f327){return _0x5ecd0c[_0x969c('0x21')](_0x5420b0);}return _0x5ecd0c[_0x969c('0x22')](_0x5420b0)[_0x969c('0x23')]();};}function respondWithResult(_0x1a1707,_0x158c90){_0x158c90=_0x158c90||0xc8;return function(_0x5de48f){if(_0x5de48f){return _0x1a1707[_0x969c('0x22')](_0x158c90)[_0x969c('0x24')](_0x5de48f);}};}function respondWithFilteredResult(_0x5a77a9,_0x173e33){return function(_0x4a4c53){if(_0x4a4c53){var _0x1f7dba=typeof _0x173e33[_0x969c('0x25')]===_0x969c('0x26')&&typeof _0x173e33[_0x969c('0x27')]===_0x969c('0x26');var _0x410124=_0x4a4c53[_0x969c('0x28')];var _0x40dd67=_0x1f7dba?0x0:_0x173e33[_0x969c('0x25')];var _0x3f2bab=_0x1f7dba?_0x4a4c53[_0x969c('0x28')]:_0x173e33[_0x969c('0x25')]+_0x173e33[_0x969c('0x27')];var _0x45456c;if(_0x3f2bab>=_0x410124){_0x3f2bab=_0x410124;_0x45456c=0xc8;}else{_0x45456c=0xce;}_0x5a77a9['status'](_0x45456c);return _0x5a77a9[_0x969c('0x29')](_0x969c('0x2a'),_0x40dd67+'-'+_0x3f2bab+'/'+_0x410124)[_0x969c('0x24')](_0x4a4c53);}return null;};}function patchUpdates(_0x5f28ee){return function(_0x46ddb7){try{jsonpatch[_0x969c('0x2b')](_0x46ddb7,_0x5f28ee,!![]);}catch(_0x41c45e){return BPromise['reject'](_0x41c45e);}return _0x46ddb7['save']();};}function saveUpdates(_0x2e6b84,_0x4e189d){return function(_0x4ba2f6){if(_0x4ba2f6){return _0x4ba2f6['update'](_0x2e6b84)[_0x969c('0x2c')](function(_0x52c30e){return _0x52c30e;});}return null;};}function removeEntity(_0x55f7e8,_0x58b3c0){return function(_0x11fb12){if(_0x11fb12){return _0x11fb12[_0x969c('0x2d')]()[_0x969c('0x2c')](function(){var _0x50f03e=_0x11fb12[_0x969c('0x2e')]({'plain':!![]});var _0x3a0de5='Teams';return db['UserProfileResource']['destroy']({'where':{'type':_0x3a0de5,'resourceId':_0x50f03e['id']}})['then'](function(){return _0x11fb12;});})['then'](function(){_0x55f7e8[_0x969c('0x22')](0xcc)[_0x969c('0x23')]();});}};}function handleEntityNotFound(_0x2a3e81,_0x52f9c9){return function(_0x29c434){if(!_0x29c434){_0x2a3e81[_0x969c('0x21')](0x194);}return _0x29c434;};}function handleError(_0x40b70c,_0x526585){_0x526585=_0x526585||0x1f4;return function(_0x1cdbf9){logger[_0x969c('0x2f')](_0x1cdbf9[_0x969c('0x30')]);if(_0x1cdbf9[_0x969c('0x31')]){delete _0x1cdbf9['name'];}_0x40b70c[_0x969c('0x22')](_0x526585)[_0x969c('0x32')](_0x1cdbf9);};}exports[_0x969c('0x33')]=function(_0x4e3a93,_0x37560d){var _0x35019b={},_0x3ef100={},_0x23eeed={'count':0x0,'rows':[]};var _0x553145=_[_0x969c('0x34')](db[_0x969c('0x35')][_0x969c('0x36')],function(_0x32cc42){return{'name':_0x32cc42[_0x969c('0x37')],'type':_0x32cc42[_0x969c('0x38')][_0x969c('0x39')]};});_0x3ef100['model']=_[_0x969c('0x34')](_0x553145,_0x969c('0x31'));_0x3ef100[_0x969c('0x3a')]=_['keys'](_0x4e3a93['query']);_0x3ef100['filters']=_[_0x969c('0x3b')](_0x3ef100[_0x969c('0x3c')],_0x3ef100['query']);_0x35019b['attributes']=_[_0x969c('0x3b')](_0x3ef100['model'],qs[_0x969c('0x3d')](_0x4e3a93[_0x969c('0x3a')][_0x969c('0x3d')]));_0x35019b['attributes']=_0x35019b[_0x969c('0x3e')][_0x969c('0x3f')]?_0x35019b['attributes']:_0x3ef100[_0x969c('0x3c')];if(!_0x4e3a93[_0x969c('0x3a')]['hasOwnProperty'](_0x969c('0x40'))){_0x35019b['limit']=qs[_0x969c('0x27')](_0x4e3a93['query'][_0x969c('0x27')]);_0x35019b[_0x969c('0x25')]=qs[_0x969c('0x25')](_0x4e3a93[_0x969c('0x3a')][_0x969c('0x25')]);}_0x35019b['order']=qs[_0x969c('0x41')](_0x4e3a93[_0x969c('0x3a')][_0x969c('0x41')]);_0x35019b['where']=qs['filters'](_[_0x969c('0x42')](_0x4e3a93['query'],_0x3ef100[_0x969c('0x43')]),_0x553145);if(_0x4e3a93[_0x969c('0x3a')]['filter']){_0x35019b[_0x969c('0x44')]=_[_0x969c('0x45')](_0x35019b['where'],{'$or':_[_0x969c('0x34')](_0x553145,function(_0x10490c){if(_0x10490c[_0x969c('0x38')]!==_0x969c('0x46')){var _0x347637={};_0x347637[_0x10490c[_0x969c('0x31')]]={'$like':'%'+_0x4e3a93['query'][_0x969c('0x47')]+'%'};return _0x347637;}})});}_0x35019b=_[_0x969c('0x45')]({},_0x35019b,_0x4e3a93[_0x969c('0x48')]);var _0x2546d2={'where':_0x35019b[_0x969c('0x44')]};return db['Team'][_0x969c('0x28')](_0x2546d2)[_0x969c('0x2c')](function(_0x247439){_0x23eeed[_0x969c('0x28')]=_0x247439;if(_0x4e3a93[_0x969c('0x3a')][_0x969c('0x49')]){_0x35019b[_0x969c('0x4a')]=[{'all':!![]}];}return db[_0x969c('0x35')][_0x969c('0x4b')](_0x35019b);})['then'](function(_0x43d881){_0x23eeed[_0x969c('0x4c')]=_0x43d881;return _0x23eeed;})[_0x969c('0x2c')](respondWithFilteredResult(_0x37560d,_0x35019b))[_0x969c('0x4d')](handleError(_0x37560d,null));};exports[_0x969c('0x4e')]=function(_0x46a18b,_0x5c9525){var _0x4185dd={'raw':![],'where':{'id':_0x46a18b['params']['id']}},_0x35fb14={};_0x35fb14[_0x969c('0x3c')]=_[_0x969c('0x4f')](db[_0x969c('0x35')][_0x969c('0x36')]);_0x35fb14['query']=_[_0x969c('0x4f')](_0x46a18b[_0x969c('0x3a')]);_0x35fb14[_0x969c('0x43')]=_[_0x969c('0x3b')](_0x35fb14[_0x969c('0x3c')],_0x35fb14[_0x969c('0x3a')]);_0x4185dd[_0x969c('0x3e')]=_[_0x969c('0x3b')](_0x35fb14[_0x969c('0x3c')],qs[_0x969c('0x3d')](_0x46a18b[_0x969c('0x3a')]['fields']));_0x4185dd[_0x969c('0x3e')]=_0x4185dd[_0x969c('0x3e')][_0x969c('0x3f')]?_0x4185dd['attributes']:_0x35fb14[_0x969c('0x3c')];if(_0x46a18b[_0x969c('0x3a')][_0x969c('0x49')]){_0x4185dd[_0x969c('0x4a')]=[{'all':!![]}];}_0x4185dd=_['merge']({},_0x4185dd,_0x46a18b[_0x969c('0x48')]);return db[_0x969c('0x35')]['find'](_0x4185dd)['then'](handleEntityNotFound(_0x5c9525,null))['then'](respondWithResult(_0x5c9525,null))[_0x969c('0x4d')](handleError(_0x5c9525,null));};exports[_0x969c('0x50')]=function(_0x5ec904,_0x5d592e){return db[_0x969c('0x35')][_0x969c('0x50')](_0x5ec904['body'],{})[_0x969c('0x2c')](function(_0x12282e){var _0x174466=_0x5ec904[_0x969c('0x51')][_0x969c('0x2e')]({'plain':!![]});if(!_0x174466)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x174466[_0x969c('0x52')]===_0x969c('0x51')){var _0x42d260=_0x12282e[_0x969c('0x2e')]({'plain':!![]});var _0x14ec1a=_0x969c('0x53');return db[_0x969c('0x54')][_0x969c('0x55')]({'where':{'name':_0x14ec1a,'userProfileId':_0x174466[_0x969c('0x56')]},'raw':!![]})[_0x969c('0x2c')](function(_0x114e31){if(_0x114e31&&_0x114e31[_0x969c('0x57')]===0x0){return db['UserProfileResource'][_0x969c('0x50')]({'name':_0x42d260[_0x969c('0x31')],'resourceId':_0x42d260['id'],'type':_0x114e31['name'],'sectionId':_0x114e31['id']},{})[_0x969c('0x2c')](function(){return _0x12282e;});}else{return _0x12282e;}})['catch'](function(_0x798a05){logger[_0x969c('0x2f')](_0x969c('0x58'),_0x798a05);throw _0x798a05;});}return _0x12282e;})['then'](respondWithResult(_0x5d592e,0xc9))[_0x969c('0x4d')](handleError(_0x5d592e,null));};exports[_0x969c('0x59')]=function(_0x3f1f19,_0x38c449){if(_0x3f1f19['body']['id']){delete _0x3f1f19[_0x969c('0x5a')]['id'];}return db[_0x969c('0x35')]['find']({'where':{'id':_0x3f1f19['params']['id']}})[_0x969c('0x2c')](handleEntityNotFound(_0x38c449,null))[_0x969c('0x2c')](saveUpdates(_0x3f1f19[_0x969c('0x5a')],null))['then'](respondWithResult(_0x38c449,null))[_0x969c('0x4d')](handleError(_0x38c449,null));};exports[_0x969c('0x2d')]=function(_0x216a93,_0x1ca74a){return db['Team'][_0x969c('0x55')]({'where':{'id':_0x216a93['params']['id']}})[_0x969c('0x2c')](handleEntityNotFound(_0x1ca74a,null))[_0x969c('0x2c')](removeEntity(_0x1ca74a,null))[_0x969c('0x4d')](handleError(_0x1ca74a,null));};exports[_0x969c('0x5b')]=function(_0x46b55f,_0x5a8adf,_0x62bf10){return db[_0x969c('0x35')]['findOne']({'where':{'id':_0x46b55f[_0x969c('0x5c')]['id']}})[_0x969c('0x2c')](handleEntityNotFound(_0x5a8adf,null))[_0x969c('0x2c')](function(_0x24860c){if(!_0x46b55f['query'][_0x969c('0x5d')]||!utils[_0x969c('0x5e')](_0x46b55f['query']['channel'])){throw new db[(_0x969c('0x5f'))][(_0x969c('0x60'))]('Unknown\x20channel');}var _0x463971={};var _0x2da4a5={};_0x2da4a5[_0x969c('0x3c')]=_[_0x969c('0x4f')](db[_[_0x969c('0x61')](_0x46b55f[_0x969c('0x3a')][_0x969c('0x5d')][_0x969c('0x62')]())+'Queue'][_0x969c('0x36')]);_0x2da4a5[_0x969c('0x3a')]=_[_0x969c('0x4f')](_0x46b55f['query']);_0x2da4a5[_0x969c('0x43')]=_[_0x969c('0x3b')](_0x2da4a5[_0x969c('0x3c')],_0x2da4a5['query']);_0x463971['attributes']=_[_0x969c('0x3b')](_0x2da4a5[_0x969c('0x3c')],qs[_0x969c('0x3d')](_0x46b55f[_0x969c('0x3a')]['fields']));_0x463971['attributes']=_0x463971[_0x969c('0x3e')][_0x969c('0x3f')]?_0x463971['attributes']:_0x2da4a5[_0x969c('0x3c')];_0x463971[_0x969c('0x27')]=qs[_0x969c('0x27')](_0x46b55f[_0x969c('0x3a')][_0x969c('0x27')]);_0x463971[_0x969c('0x25')]=qs[_0x969c('0x25')](_0x46b55f[_0x969c('0x3a')][_0x969c('0x25')]);_0x463971[_0x969c('0x63')]=qs['sort'](_0x46b55f[_0x969c('0x3a')]['sort']);_0x463971[_0x969c('0x44')]=qs[_0x969c('0x43')](_[_0x969c('0x42')](_0x46b55f[_0x969c('0x3a')],_0x2da4a5[_0x969c('0x43')]));_0x463971=_['merge']({},_0x463971,_0x46b55f[_0x969c('0x48')]);return _0x24860c[_0x969c('0x2e')+_['capitalize'](_0x46b55f['query'][_0x969c('0x5d')][_0x969c('0x62')]())+_0x969c('0x64')](_0x463971);})['then'](respondWithResult(_0x5a8adf,null))[_0x969c('0x4d')](handleError(_0x5a8adf,null));};exports[_0x969c('0x65')]=function(_0x59c331,_0x535521,_0x42ff24){return db[_0x969c('0x35')][_0x969c('0x66')]({'where':{'id':_0x59c331[_0x969c('0x5c')]['id']}})[_0x969c('0x2c')](function(_0x20071a){if(_0x20071a){if(!_0x59c331[_0x969c('0x5a')]['channel']||!utils['isValidChannel'](_0x59c331[_0x969c('0x5a')][_0x969c('0x5d')])){throw new db[(_0x969c('0x5f'))]['ValidationError'](_0x969c('0x67'));}return _0x20071a[_0x969c('0x68')+_[_0x969c('0x61')](_0x59c331['body'][_0x969c('0x5d')]['toLowerCase']())+_0x969c('0x64')](_0x59c331[_0x969c('0x5a')]['ids']);}return null;})[_0x969c('0x2c')](handleEntityNotFound(_0x535521,null))[_0x969c('0x2c')](respondWithStatusCode(_0x535521,null))['catch'](handleError(_0x535521,null));};exports[_0x969c('0x69')]=function(_0x2f9404,_0x2c9af3,_0x21a100){return db['Team'][_0x969c('0x66')]({'where':{'id':_0x2f9404['params']['id']}})['then'](function(_0x5d7ea0){if(_0x5d7ea0){if(!_0x2f9404[_0x969c('0x3a')][_0x969c('0x5d')]||!utils[_0x969c('0x5e')](_0x2f9404['query']['channel'])){throw new db[(_0x969c('0x5f'))][(_0x969c('0x60'))](_0x969c('0x67'));}return _0x5d7ea0[_0x969c('0x6a')+_['capitalize'](_0x2f9404[_0x969c('0x3a')]['channel'][_0x969c('0x62')]())+_0x969c('0x64')](_0x2f9404['query'][_0x969c('0x6b')]);}return null;})[_0x969c('0x2c')](handleEntityNotFound(_0x2c9af3,null))[_0x969c('0x2c')](respondWithStatusCode(_0x2c9af3,null))[_0x969c('0x4d')](handleError(_0x2c9af3,null));};exports[_0x969c('0x6c')]=function(_0x555fe5,_0x2c3f6c){return db[_0x969c('0x35')]['find']({'where':{'id':_0x555fe5[_0x969c('0x5c')]['id']}})[_0x969c('0x2c')](handleEntityNotFound(_0x2c3f6c,null))[_0x969c('0x2c')](function(_0x5bd9ba){if(_0x5bd9ba){var _0x2155c9=[_0x969c('0x6d'),'Chat',_0x969c('0x6e'),'Sms',_0x969c('0x6f'),_0x969c('0x70'),_0x969c('0x71')];return db['sequelize'][_0x969c('0x72')](function(_0x4b9201){var _0x2a487f=_['map'](_0x2155c9,function(_0x175f29){var _0xc1c594={'attributes':['id',_0x969c('0x31')]};if(_0x175f29===_0x969c('0x6d')){_0xc1c594[_0x969c('0x73')]={'attributes':[_0x969c('0x74')]};}return _0x5bd9ba['get'+_0x175f29+_0x969c('0x64')](_0xc1c594)[_0x969c('0x2c')](function(_0x541485){var _0x5eabbf=_[_0x969c('0x34')](_0x541485,function(_0x101157){var _0x173bda=_[_0x969c('0x34')](_0x555fe5[_0x969c('0x5a')][_0x969c('0x6b')],function(_0x5c3136){var _0x41f0ee={'where':{'UserId':_0x5c3136,[_0x175f29+_0x969c('0x75')]:_0x101157['id']},'transaction':_0x4b9201};if(_0x175f29===_0x969c('0x6d')){_0x41f0ee[_0x969c('0x1d')]={'penalty':_0x101157[_0x969c('0x76')][_0x969c('0x74')]};}return db['User'+_0x175f29+_0x969c('0x77')]['findOrCreate'](_0x41f0ee)[_0x969c('0x2c')](function(){socket[_0x969c('0x78')](_0x969c('0x51')+_0x175f29+_0x969c('0x79'),{'UserId':_0x5c3136,[_0x175f29+_0x969c('0x75')]:_0x101157['id']});if(_0x175f29!=='Voice')return;return db[_0x969c('0x7a')][_0x969c('0x4b')]({'where':{'id':_0x555fe5[_0x969c('0x5a')][_0x969c('0x6b')],'online':0x1},'attributes':['id',_0x969c('0x31'),_0x969c('0x7b'),_0x969c('0x7c'),'interface'],'raw':!![]})['then'](function(_0x50d736){var _0x9d8aa5=_[_0x969c('0x34')](_0x50d736,function(_0xaff68a){return db[_0x969c('0x7d')][_0x969c('0x7e')]({'membername':_0xaff68a[_0x969c('0x31')],'UserId':_0xaff68a['id'],'queue_name':_0x101157[_0x969c('0x31')],'VoiceQueueId':_0x101157['id'],'interface':_[_0x969c('0x7f')](_0xaff68a[_0x969c('0x80')])?util['format']('SIP/%s',_0xaff68a['name']):_0xaff68a['interface'],'paused':_0xaff68a[_0x969c('0x7c')]||![],'penalty':_0x101157[_0x969c('0x76')][_0x969c('0x74')]},{'transaction':_0x4b9201});});return Promise['all'](_0x9d8aa5);});});});return Promise['all'](_0x173bda);});return Promise[_0x969c('0x81')](_0x5eabbf);})[_0x969c('0x2c')](function(){var _0x595a38=JSON[_0x969c('0x82')]('['+_0x555fe5[_0x969c('0x5a')]['ids']+']');db['TeamVoicePrefix'][_0x969c('0x66')]({'where':{'teamId':_0x555fe5['params']['id']}})['then'](function(_0x387f4c){if(_0x387f4c){for(var _0x538bd2=0x0;_0x538bd2<_0x595a38[_0x969c('0x3f')];_0x538bd2++){var _0x34fe90=_0x595a38[_0x538bd2];db[_0x969c('0x83')][_0x969c('0x7e')]({'UserId':_0x34fe90,'VoicePrefixId':_0x387f4c[_0x969c('0x84')]});}}});});});return Promise['all'](_0x2a487f)[_0x969c('0x2c')](function(){return _0x5bd9ba[_0x969c('0x6c')](_0x555fe5[_0x969c('0x5a')][_0x969c('0x6b')],{'transaction':_0x4b9201})[_0x969c('0x85')](function(_0x3233a7){return _0x3233a7;});});});}})['then'](respondWithResult(_0x2c3f6c,null))[_0x969c('0x4d')](handleError(_0x2c3f6c,null));};exports[_0x969c('0x86')]=function(_0x44b867,_0x392698){return db['Team']['find']({'where':{'id':_0x44b867['params']['id']}})[_0x969c('0x2c')](handleEntityNotFound(_0x392698,null))[_0x969c('0x2c')](function(_0x302863){if(_0x302863){var _0x46b8c2=[_0x969c('0x6d'),_0x969c('0x87'),_0x969c('0x6e'),_0x969c('0x88'),'Fax',_0x969c('0x70'),_0x969c('0x71')];return db[_0x969c('0x89')][_0x969c('0x72')](function(_0x4ec5ad){var _0x4608a7=_[_0x969c('0x34')](_0x46b8c2,function(_0x59ee2c){var _0x18b4c7={'attributes':['id',_0x969c('0x31')]};return _0x302863[_0x969c('0x2e')+_0x59ee2c+_0x969c('0x64')](_0x18b4c7)[_0x969c('0x2c')](function(_0x29b10d){var _0x1860cb=_[_0x969c('0x34')](_0x29b10d,function(_0x548a52){return _0x548a52['removeAgents'](_0x44b867['query']['ids'],{'transaction':_0x4ec5ad})[_0x969c('0x2c')](function(){var _0x373e2a=JSON[_0x969c('0x82')]('['+_0x44b867[_0x969c('0x3a')][_0x969c('0x6b')]+']');var _0x54ac77=_[_0x969c('0x34')](_0x373e2a,function(_0x41c972){socket[_0x969c('0x78')](_0x969c('0x51')+_0x59ee2c+'Queue:remove',{'UserId':Number(_0x41c972),[_0x59ee2c+'QueueId']:_0x548a52['id']});if(_0x59ee2c!==_0x969c('0x6d'))return;return db[_0x969c('0x7d')][_0x969c('0x2d')]({'where':{'VoiceQueueId':_0x548a52['id'],'UserId':_0x41c972},'transaction':_0x4ec5ad});});return Promise[_0x969c('0x81')](_0x54ac77);});});return Promise[_0x969c('0x81')](_0x1860cb);});});return Promise[_0x969c('0x81')](_0x4608a7)[_0x969c('0x2c')](function(){return _0x302863[_0x969c('0x86')](_0x44b867['query'][_0x969c('0x6b')],{'transaction':_0x4ec5ad});})[_0x969c('0x2c')](function(){var _0x3584d8=JSON[_0x969c('0x82')]('['+_0x44b867[_0x969c('0x3a')][_0x969c('0x6b')]+']');db['TeamVoicePrefix'][_0x969c('0x66')]({'where':{'teamId':_0x44b867['params']['id']}})[_0x969c('0x2c')](function(_0x2b1437){if(_0x2b1437){for(var _0x2df797=0x0;_0x2df797<_0x3584d8['length'];_0x2df797++){var _0x33b51f=_0x3584d8[_0x2df797];db[_0x969c('0x83')]['destroy']({'where':{'UserId':_0x33b51f,'VoicePrefixId':_0x2b1437[_0x969c('0x84')]}});}}});});});}})[_0x969c('0x2c')](respondWithStatusCode(_0x392698,null))['catch'](handleError(_0x392698,null));};exports['getAgents']=function(_0x7ae66c,_0xcdb8f0,_0x3d8451){var _0x2a2938={};var _0x30e531={};var _0x4e2ef0;var _0x248837;return db['Team'][_0x969c('0x66')]({'where':{'id':_0x7ae66c['params']['id']}})[_0x969c('0x2c')](handleEntityNotFound(_0xcdb8f0,null))[_0x969c('0x2c')](function(_0x1f8f92){if(_0x1f8f92){_0x4e2ef0=_0x1f8f92;_0x30e531['model']=_[_0x969c('0x4f')](db[_0x969c('0x7a')][_0x969c('0x36')]);_0x30e531[_0x969c('0x3a')]=_['keys'](_0x7ae66c[_0x969c('0x3a')]);_0x30e531['filters']=_['intersection'](_0x30e531[_0x969c('0x3c')],_0x30e531[_0x969c('0x3a')]);_0x2a2938[_0x969c('0x3e')]=_[_0x969c('0x3b')](_0x30e531[_0x969c('0x3c')],qs[_0x969c('0x3d')](_0x7ae66c[_0x969c('0x3a')]['fields']));_0x2a2938['attributes']=_0x2a2938[_0x969c('0x3e')][_0x969c('0x3f')]?_0x2a2938[_0x969c('0x3e')]:_0x30e531[_0x969c('0x3c')];_0x2a2938[_0x969c('0x63')]=qs['sort'](_0x7ae66c[_0x969c('0x3a')]['sort']);_0x2a2938['where']=qs[_0x969c('0x43')](_[_0x969c('0x42')](_0x7ae66c[_0x969c('0x3a')],_0x30e531[_0x969c('0x43')]));if(_0x7ae66c[_0x969c('0x3a')][_0x969c('0x47')]){_0x2a2938[_0x969c('0x44')]=_[_0x969c('0x45')](_0x2a2938[_0x969c('0x44')],{'$or':_[_0x969c('0x34')](_0x2a2938[_0x969c('0x3e')],function(_0x3df730){var _0x4b74ab={};_0x4b74ab[_0x3df730]={'$like':'%'+_0x7ae66c[_0x969c('0x3a')][_0x969c('0x47')]+'%'};return _0x4b74ab;})});}_0x2a2938=_['merge']({},_0x2a2938,_0x7ae66c['options']);return _0x4e2ef0[_0x969c('0x8a')](_0x2a2938);}})[_0x969c('0x2c')](function(_0x3d4101){if(_0x3d4101){_0x248837=_0x3d4101[_0x969c('0x3f')];if(!_0x7ae66c['query'][_0x969c('0x8b')](_0x969c('0x40'))){_0x2a2938[_0x969c('0x27')]=qs['limit'](_0x7ae66c[_0x969c('0x3a')]['limit']);_0x2a2938[_0x969c('0x25')]=qs[_0x969c('0x25')](_0x7ae66c[_0x969c('0x3a')]['offset']);}return _0x4e2ef0['getAgents'](_0x2a2938);}})['then'](function(_0x26c72b){if(_0x26c72b){return _0x26c72b?{'count':_0x248837,'rows':_0x26c72b}:null;}})[_0x969c('0x2c')](respondWithResult(_0xcdb8f0,null))[_0x969c('0x4d')](handleError(_0xcdb8f0,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 66d7b58..1b8337f 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 _0x570a=['exports','Team','setMaxListeners','update','remove','emit','hook'];(function(_0x29d705,_0x7f11ef){var _0x54dc0e=function(_0x4b002e){while(--_0x4b002e){_0x29d705['push'](_0x29d705['shift']());}};_0x54dc0e(++_0x7f11ef);}(_0x570a,0x104));var _0xa570=function(_0x27c8be,_0x6d9118){_0x27c8be=_0x27c8be-0x0;var _0x49de1c=_0x570a[_0x27c8be];return _0x49de1c;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0xa570('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0xa570('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa570('0x2'),'afterDestroy':_0xa570('0x3')};function emitEvent(_0x41fa70){return function(_0x3cdd38,_0x23f3bc,_0x35ee0b){TeamEvents[_0xa570('0x4')](_0x41fa70+':'+_0x3cdd38['id'],_0x3cdd38);TeamEvents[_0xa570('0x4')](_0x41fa70,_0x3cdd38);_0x35ee0b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xa570('0x5')](e,emitEvent(event));}}module[_0xa570('0x6')]=TeamEvents; \ No newline at end of file +var _0xb1b7=['update','remove','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x134ec7,_0x2ed64f){var _0x504441=function(_0x4d9250){while(--_0x4d9250){_0x134ec7['push'](_0x134ec7['shift']());}};_0x504441(++_0x2ed64f);}(_0xb1b7,0x1cc));var _0x7b1b=function(_0x3e08ea,_0x39cd43){_0x3e08ea=_0x3e08ea-0x0;var _0x6fde9f=_0xb1b7[_0x3e08ea];return _0x6fde9f;};'use strict';var EventEmitter=require(_0x7b1b('0x0'));var Team=require(_0x7b1b('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x7b1b('0x2')](0x0);var events={'afterCreate':_0x7b1b('0x3'),'afterUpdate':_0x7b1b('0x4'),'afterDestroy':_0x7b1b('0x5')};function emitEvent(_0x419a42){return function(_0x36b0bc,_0x17cb2b,_0x385649){TeamEvents['emit'](_0x419a42+':'+_0x36b0bc['id'],_0x36b0bc);TeamEvents['emit'](_0x419a42,_0x36b0bc);_0x385649(null);};}for(var e in events){if(events[_0x7b1b('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x7b1b('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index bf55b0c..201a8e0 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 _0x1606=['exports','define','Team','teams','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x284da5,_0x58a5ee){var _0x36be98=function(_0x164326){while(--_0x164326){_0x284da5['push'](_0x284da5['shift']());}};_0x36be98(++_0x58a5ee);}(_0x1606,0x1d8));var _0x6160=function(_0x5c4b4b,_0x87a94){_0x5c4b4b=_0x5c4b4b-0x0;var _0x1d39a4=_0x1606[_0x5c4b4b];return _0x1d39a4;};'use strict';var _=require(_0x6160('0x0'));var util=require(_0x6160('0x1'));var logger=require(_0x6160('0x2'))(_0x6160('0x3'));var moment=require(_0x6160('0x4'));var BPromise=require(_0x6160('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6160('0x6'));var rimraf=require(_0x6160('0x7'));var config=require(_0x6160('0x8'));var attributes=require('./team.attributes');module[_0x6160('0x9')]=function(_0x355630,_0xe7ea90){return _0x355630[_0x6160('0xa')](_0x6160('0xb'),attributes,{'tableName':_0x6160('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ee1=['rimraf','../../config/environment','teams','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ee1,0x143));var _0x19ee=function(_0x326261,_0x2499b6){_0x326261=_0x326261-0x0;var _0x129b15=_0x9ee1[_0x326261];return _0x129b15;};'use strict';var _=require(_0x19ee('0x0'));var util=require(_0x19ee('0x1'));var logger=require(_0x19ee('0x2'))('api');var moment=require(_0x19ee('0x3'));var BPromise=require(_0x19ee('0x4'));var rp=require(_0x19ee('0x5'));var fs=require('fs');var path=require(_0x19ee('0x6'));var rimraf=require(_0x19ee('0x7'));var config=require(_0x19ee('0x8'));var attributes=require('./team.attributes');module['exports']=function(_0x2783da,_0x26862c){return _0x2783da['define']('Team',attributes,{'tableName':_0x19ee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 1434f18..c741616 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 _0xa96b=['bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x1ce20c,_0x42d6c5){var _0x5a38b5=function(_0xd6585b){while(--_0xd6585b){_0x1ce20c['push'](_0x1ce20c['shift']());}};_0x5a38b5(++_0x42d6c5);}(_0xa96b,0x19e));var _0xba96=function(_0x55f5d7,_0x178e01){_0x55f5d7=_0x55f5d7-0x0;var _0x3bbba9=_0xa96b[_0x55f5d7];return _0x3bbba9;};'use strict';var _=require(_0xba96('0x0'));var util=require(_0xba96('0x1'));var moment=require('moment');var BPromise=require(_0xba96('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba96('0x3'));var db=require(_0xba96('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xba96('0x5'))('rpc');var config=require(_0xba96('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xba96('0x7')][_0xba96('0x8')]({'port':0x232a});config[_0xba96('0x9')]=_['defaults'](config[_0xba96('0x9')],{'host':_0xba96('0xa'),'port':0x18eb});var socket=require(_0xba96('0xb'))(new Redis(config[_0xba96('0x9')]));require(_0xba96('0xc'))[_0xba96('0xd')](socket);function respondWithRpcPromise(_0x26a487,_0xc86a1c,_0x4c8d44){return new BPromise(function(_0x55d4dc,_0x4a9089){return client[_0xba96('0xe')](_0x26a487,_0x4c8d44)[_0xba96('0xf')](function(_0xac050f){logger['info'](_0xba96('0x10'),_0xc86a1c,_0xba96('0x11'));logger['debug'](_0xba96('0x12'),_0xc86a1c,_0xba96('0x11'),JSON[_0xba96('0x13')](_0xac050f));if(_0xac050f['error']){if(_0xac050f[_0xba96('0x14')][_0xba96('0x15')]===0x1f4){logger['error'](_0xba96('0x10'),_0xc86a1c,_0xac050f[_0xba96('0x14')]['message']);return _0x4a9089(_0xac050f[_0xba96('0x14')][_0xba96('0x16')]);}logger[_0xba96('0x14')](_0xba96('0x10'),_0xc86a1c,_0xac050f[_0xba96('0x14')]['message']);return _0x55d4dc(_0xac050f[_0xba96('0x14')][_0xba96('0x16')]);}else{logger[_0xba96('0x17')](_0xba96('0x10'),_0xc86a1c,'request\x20sent');_0x55d4dc(_0xac050f[_0xba96('0x18')]['message']);}})[_0xba96('0x19')](function(_0x39aef6){logger[_0xba96('0x14')](_0xba96('0x10'),_0xc86a1c,_0x39aef6);_0x4a9089(_0x39aef6);});});} \ No newline at end of file +var _0xd48b=['Team,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4ab342,_0x225d67){var _0x186df2=function(_0x57bfec){while(--_0x57bfec){_0x4ab342['push'](_0x4ab342['shift']());}};_0x186df2(++_0x225d67);}(_0xd48b,0x14e));var _0xbd48=function(_0x3008c9,_0x4785e5){_0x3008c9=_0x3008c9-0x0;var _0x4f602c=_0xd48b[_0x3008c9];return _0x4f602c;};'use strict';var _=require(_0xbd48('0x0'));var util=require(_0xbd48('0x1'));var moment=require(_0xbd48('0x2'));var BPromise=require(_0xbd48('0x3'));var rs=require(_0xbd48('0x4'));var fs=require('fs');var Redis=require(_0xbd48('0x5'));var db=require(_0xbd48('0x6'))['db'];var utils=require(_0xbd48('0x7'));var logger=require('../../config/logger')(_0xbd48('0x8'));var config=require(_0xbd48('0x9'));var jayson=require(_0xbd48('0xa'));var client=jayson[_0xbd48('0xb')][_0xbd48('0xc')]({'port':0x232a});config[_0xbd48('0xd')]=_[_0xbd48('0xe')](config[_0xbd48('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xbd48('0xf'))(new Redis(config['redis']));require(_0xbd48('0x10'))[_0xbd48('0x11')](socket);function respondWithRpcPromise(_0x97212,_0x862101,_0x1a826d){return new BPromise(function(_0x4d2751,_0x39af48){return client[_0xbd48('0x12')](_0x97212,_0x1a826d)[_0xbd48('0x13')](function(_0x5b883f){logger[_0xbd48('0x14')]('Team,\x20%s,\x20%s',_0x862101,_0xbd48('0x15'));logger[_0xbd48('0x16')](_0xbd48('0x17'),_0x862101,_0xbd48('0x15'),JSON[_0xbd48('0x18')](_0x5b883f));if(_0x5b883f[_0xbd48('0x19')]){if(_0x5b883f['error']['code']===0x1f4){logger[_0xbd48('0x19')](_0xbd48('0x1a'),_0x862101,_0x5b883f['error']['message']);return _0x39af48(_0x5b883f[_0xbd48('0x19')][_0xbd48('0x1b')]);}logger[_0xbd48('0x19')](_0xbd48('0x1a'),_0x862101,_0x5b883f[_0xbd48('0x19')][_0xbd48('0x1b')]);return _0x4d2751(_0x5b883f['error'][_0xbd48('0x1b')]);}else{logger[_0xbd48('0x14')](_0xbd48('0x1a'),_0x862101,_0xbd48('0x15'));_0x4d2751(_0x5b883f[_0xbd48('0x1c')][_0xbd48('0x1b')]);}})[_0xbd48('0x1d')](function(_0x4692cc){logger[_0xbd48('0x19')]('Team,\x20%s,\x20%s',_0x862101,_0x4692cc);_0x39af48(_0x4692cc);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 3c450fc..b449dc3 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 _0xe730=['length','team:','./team.events','save','remove','update','removeListener','register'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0xe730,0xf2));var _0x0e73=function(_0x469862,_0x338e7e){_0x469862=_0x469862-0x0;var _0x2932a0=_0xe730[_0x469862];return _0x2932a0;};'use strict';var TeamEvents=require(_0x0e73('0x0'));var events=[_0x0e73('0x1'),_0x0e73('0x2'),_0x0e73('0x3')];function createListener(_0x1fc2c3,_0xeab993){return function(_0x5c46c1){_0xeab993['emit'](_0x1fc2c3,_0x5c46c1);};}function removeListener(_0x7b553,_0x126201){return function(){TeamEvents[_0x0e73('0x4')](_0x7b553,_0x126201);};}exports[_0x0e73('0x5')]=function(_0xf2384b){for(var _0xa6d3e8=0x0,_0x379bb2=events[_0x0e73('0x6')];_0xa6d3e8<_0x379bb2;_0xa6d3e8++){var _0x109c42=events[_0xa6d3e8];var _0x18c043=createListener(_0x0e73('0x7')+_0x109c42,_0xf2384b);TeamEvents['on'](_0x109c42,_0x18c043);}}; \ No newline at end of file +var _0x1b70=['save','remove','update','emit','register','length','team:','./team.events'];(function(_0x331c20,_0x3cff19){var _0x205699=function(_0x3ac972){while(--_0x3ac972){_0x331c20['push'](_0x331c20['shift']());}};_0x205699(++_0x3cff19);}(_0x1b70,0xa7));var _0x01b7=function(_0x19f5fc,_0x4c658a){_0x19f5fc=_0x19f5fc-0x0;var _0x315fa3=_0x1b70[_0x19f5fc];return _0x315fa3;};'use strict';var TeamEvents=require(_0x01b7('0x0'));var events=[_0x01b7('0x1'),_0x01b7('0x2'),_0x01b7('0x3')];function createListener(_0x435721,_0x379dd2){return function(_0x168393){_0x379dd2[_0x01b7('0x4')](_0x435721,_0x168393);};}function removeListener(_0x3818da,_0x1b6f2d){return function(){TeamEvents['removeListener'](_0x3818da,_0x1b6f2d);};}exports[_0x01b7('0x5')]=function(_0x27cd5e){for(var _0x13564b=0x0,_0x5a2976=events[_0x01b7('0x6')];_0x13564b<_0x5a2976;_0x13564b++){var _0x5aea02=events[_0x13564b];var _0x152333=createListener(_0x01b7('0x7')+_0x5aea02,_0x27cd5e);TeamEvents['on'](_0x5aea02,_0x152333);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/index.js b/server/api/teamVoicePrefix/index.js index b6a5e1d..640d5f4 100644 --- a/server/api/teamVoicePrefix/index.js +++ b/server/api/teamVoicePrefix/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(_0x38b7e8,_0x38b739){var _0x300e6e=function(_0x1fcd5e){while(--_0x1fcd5e){_0x38b7e8['push'](_0x38b7e8['shift']());}};_0x300e6e(++_0x38b739);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0xcb91[_0x35fabd];return _0x61a8ee;};'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(_0x193e7a,_0x3799b0){var _0x4ec850=function(_0x19614c){while(--_0x19614c){_0x193e7a['push'](_0x193e7a['shift']());}};_0x4ec850(++_0x3799b0);}(_0x70e0,0x17b));var _0x070e=function(_0xc9b33a,_0xc85df7){_0xc9b33a=_0xc9b33a-0x0;var _0x3722bd=_0x70e0[_0xc9b33a];return _0x3722bd;};'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/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 516dffc..d8b0a32 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 _0x6b1c=['INTEGER','sequelize'];(function(_0x581126,_0x1dbe32){var _0x87f92f=function(_0x131cb9){while(--_0x131cb9){_0x581126['push'](_0x581126['shift']());}};_0x87f92f(++_0x1dbe32);}(_0x6b1c,0xf3));var _0xc6b1=function(_0x138f30,_0x28b343){_0x138f30=_0x138f30-0x0;var _0x363b58=_0x6b1c[_0x138f30];return _0x363b58;};'use strict';var Sequelize=require(_0xc6b1('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xc6b1('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xc6b1('0x1')]}}; \ No newline at end of file +var _0xe9ad=['INTEGER','sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe9ad,0x82));var _0xde9a=function(_0x1e0a4a,_0x55752e){_0x1e0a4a=_0x1e0a4a-0x0;var _0x352afd=_0xe9ad[_0x1e0a4a];return _0x352afd;};'use strict';var Sequelize=require(_0xde9a('0x0'));module[_0xde9a('0x1')]={'TeamId':{'type':Sequelize[_0xde9a('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xde9a('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index d04d527..e4a8ae8 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 _0x8f59=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','define','lodash'];(function(_0x1ef700,_0x1e3f8b){var _0x3ce59b=function(_0x5c432d){while(--_0x5c432d){_0x1ef700['push'](_0x1ef700['shift']());}};_0x3ce59b(++_0x1e3f8b);}(_0x8f59,0x11d));var _0x98f5=function(_0x19cd2a,_0x52bf9e){_0x19cd2a=_0x19cd2a-0x0;var _0x41f8b7=_0x8f59[_0x19cd2a];return _0x41f8b7;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var logger=require(_0x98f5('0x2'))(_0x98f5('0x3'));var moment=require(_0x98f5('0x4'));var BPromise=require(_0x98f5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98f5('0x6'));var rimraf=require(_0x98f5('0x7'));var config=require(_0x98f5('0x8'));var attributes=require(_0x98f5('0x9'));module['exports']=function(_0xdcce7a,_0x358618){return _0xdcce7a[_0x98f5('0xa')]('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x282b=['moment','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x45ed36,_0x43e4e1){var _0x194e0e=function(_0x20e339){while(--_0x20e339){_0x45ed36['push'](_0x45ed36['shift']());}};_0x194e0e(++_0x43e4e1);}(_0x282b,0xec));var _0xb282=function(_0x2decc8,_0x192f7b){_0x2decc8=_0x2decc8-0x0;var _0x43c85c=_0x282b[_0x2decc8];return _0x43c85c;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var logger=require(_0xb282('0x2'))(_0xb282('0x3'));var moment=require(_0xb282('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb282('0x5'));var rimraf=require('rimraf');var config=require(_0xb282('0x6'));var attributes=require(_0xb282('0x7'));module[_0xb282('0x8')]=function(_0x1dd19b,_0x3cad41){return _0x1dd19b[_0xb282('0x9')]('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js b/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js index 62ec30f..40c2894 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77f6=['then','info','TeamVoicePrefix,\x20%s,\x20%s','request\x20sent','TeamVoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x77f6,0x81));var _0x677f=function(_0x4a47e7,_0x111d41){_0x4a47e7=_0x4a47e7-0x0;var _0xe1d3f2=_0x77f6[_0x4a47e7];return _0xe1d3f2;};'use strict';var _=require(_0x677f('0x0'));var util=require(_0x677f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x677f('0x2'));var fs=require('fs');var Redis=require(_0x677f('0x3'));var db=require(_0x677f('0x4'))['db'];var utils=require(_0x677f('0x5'));var logger=require(_0x677f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x677f('0x7'));var client=jayson[_0x677f('0x8')][_0x677f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a553b,_0x127857,_0x1677d8){return new BPromise(function(_0x1c1d91,_0x5342af){return client[_0x677f('0xa')](_0x4a553b,_0x1677d8)[_0x677f('0xb')](function(_0xf6329d){logger[_0x677f('0xc')](_0x677f('0xd'),_0x127857,_0x677f('0xe'));logger['debug'](_0x677f('0xf'),_0x127857,_0x677f('0xe'),JSON[_0x677f('0x10')](_0xf6329d));if(_0xf6329d['error']){if(_0xf6329d[_0x677f('0x11')]['code']===0x1f4){logger[_0x677f('0x11')](_0x677f('0xd'),_0x127857,_0xf6329d[_0x677f('0x11')][_0x677f('0x12')]);return _0x5342af(_0xf6329d[_0x677f('0x11')]['message']);}logger[_0x677f('0x11')]('TeamVoicePrefix,\x20%s,\x20%s',_0x127857,_0xf6329d[_0x677f('0x11')][_0x677f('0x12')]);return _0x1c1d91(_0xf6329d[_0x677f('0x11')][_0x677f('0x12')]);}else{logger[_0x677f('0xc')](_0x677f('0xd'),_0x127857,'request\x20sent');_0x1c1d91(_0xf6329d[_0x677f('0x13')][_0x677f('0x12')]);}})['catch'](function(_0x2bdeea){logger[_0x677f('0x11')](_0x677f('0xd'),_0x127857,_0x2bdeea);_0x5342af(_0x2bdeea);});});} \ No newline at end of file +var _0xfdb8=['../../config/logger','../../config/environment','jayson/promise','client','http','request','info','TeamVoicePrefix,\x20%s,\x20%s','request\x20sent','debug','TeamVoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xfdb8,0xeb));var _0x8fdb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdb8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8fdb('0x0'));var util=require('util');var moment=require(_0x8fdb('0x1'));var BPromise=require(_0x8fdb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fdb('0x3'))['db'];var utils=require(_0x8fdb('0x4'));var logger=require(_0x8fdb('0x5'))('rpc');var config=require(_0x8fdb('0x6'));var jayson=require(_0x8fdb('0x7'));var client=jayson[_0x8fdb('0x8')][_0x8fdb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41d5c5,_0x1ab93e,_0x40726b){return new BPromise(function(_0x2ee8fc,_0x3b2564){return client[_0x8fdb('0xa')](_0x41d5c5,_0x40726b)['then'](function(_0x4ea81a){logger[_0x8fdb('0xb')](_0x8fdb('0xc'),_0x1ab93e,_0x8fdb('0xd'));logger[_0x8fdb('0xe')](_0x8fdb('0xf'),_0x1ab93e,_0x8fdb('0xd'),JSON[_0x8fdb('0x10')](_0x4ea81a));if(_0x4ea81a[_0x8fdb('0x11')]){if(_0x4ea81a[_0x8fdb('0x11')]['code']===0x1f4){logger[_0x8fdb('0x11')](_0x8fdb('0xc'),_0x1ab93e,_0x4ea81a[_0x8fdb('0x11')][_0x8fdb('0x12')]);return _0x3b2564(_0x4ea81a['error']['message']);}logger['error'](_0x8fdb('0xc'),_0x1ab93e,_0x4ea81a['error'][_0x8fdb('0x12')]);return _0x2ee8fc(_0x4ea81a[_0x8fdb('0x11')][_0x8fdb('0x12')]);}else{logger['info'](_0x8fdb('0xc'),_0x1ab93e,'request\x20sent');_0x2ee8fc(_0x4ea81a['result'][_0x8fdb('0x12')]);}})[_0x8fdb('0x13')](function(_0x46f122){logger['error'](_0x8fdb('0xc'),_0x1ab93e,_0x46f122);_0x3b2564(_0x46f122);});});} \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 13c9f1d..689da83 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3c3ec7,_0x309339){var _0x23e52c=function(_0x34cd19){while(--_0x34cd19){_0x3c3ec7['push'](_0x3c3ec7['shift']());}};_0x23e52c(++_0x309339);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x7709d5,_0x3a0bc4){var _0x36e23c=function(_0xaeb4e3){while(--_0xaeb4e3){_0x7709d5['push'](_0x7709d5['shift']());}};_0x36e23c(++_0x3a0bc4);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 8e55077..c3bd988 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 _0xb144=['sequelize'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0xb144,0x146));var _0x4b14=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb144[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x4b14('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3435=['INTEGER','sequelize','exports'];(function(_0x591c0c,_0x1c9db0){var _0x54fab9=function(_0x57aba5){while(--_0x57aba5){_0x591c0c['push'](_0x591c0c['shift']());}};_0x54fab9(++_0x1c9db0);}(_0x3435,0xfa));var _0x5343=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3435[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0x5343('0x0'));module[_0x5343('0x1')]={'penalty':{'type':Sequelize[_0x5343('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 2938a92..31e89ec 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 _0x3d6d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger'];(function(_0xc197eb,_0x35dc61){var _0x4be264=function(_0x5dd38a){while(--_0x5dd38a){_0xc197eb['push'](_0xc197eb['shift']());}};_0x4be264(++_0x35dc61);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x25a787,_0x6926e7){_0x25a787=_0x25a787-0x0;var _0x37712a=_0x3d6d[_0x25a787];return _0x37712a;};'use strict';var _=require(_0xd3d6('0x0'));var util=require(_0xd3d6('0x1'));var logger=require(_0xd3d6('0x2'))(_0xd3d6('0x3'));var moment=require(_0xd3d6('0x4'));var BPromise=require(_0xd3d6('0x5'));var rp=require(_0xd3d6('0x6'));var fs=require('fs');var path=require(_0xd3d6('0x7'));var rimraf=require(_0xd3d6('0x8'));var config=require(_0xd3d6('0x9'));var attributes=require(_0xd3d6('0xa'));module['exports']=function(_0x5400f8,_0x3f36){return _0x5400f8[_0xd3d6('0xb')](_0xd3d6('0xc'),attributes,{'tableName':_0xd3d6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','lodash','util'];(function(_0x31bdb2,_0x2a87ea){var _0x4b3e41=function(_0xb5670d){while(--_0xb5670d){_0x31bdb2['push'](_0x31bdb2['shift']());}};_0x4b3e41(++_0x2a87ea);}(_0x54ef,0x112));var _0xf54e=function(_0x342d95,_0x30257a){_0x342d95=_0x342d95-0x0;var _0x165faa=_0x54ef[_0x342d95];return _0x165faa;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 5df974f..4a13cf9 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 _0x502a=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x502a,0xd8));var _0xa502=function(_0x149aa5,_0x467cb8){_0x149aa5=_0x149aa5-0x0;var _0x4cfb0a=_0x502a[_0x149aa5];return _0x4cfb0a;};'use strict';var _=require(_0xa502('0x0'));var util=require(_0xa502('0x1'));var moment=require('moment');var BPromise=require(_0xa502('0x2'));var rs=require(_0xa502('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa502('0x4'));var logger=require('../../config/logger')(_0xa502('0x5'));var config=require(_0xa502('0x6'));var jayson=require(_0xa502('0x7'));var client=jayson[_0xa502('0x8')][_0xa502('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x489407,_0x329022,_0x29fb03){return new BPromise(function(_0x4d30f2,_0x4e4e5d){return client[_0xa502('0xa')](_0x489407,_0x29fb03)[_0xa502('0xb')](function(_0x5251fa){logger[_0xa502('0xc')](_0xa502('0xd'),_0x329022,_0xa502('0xe'));logger['debug'](_0xa502('0xf'),_0x329022,_0xa502('0xe'),JSON[_0xa502('0x10')](_0x5251fa));if(_0x5251fa['error']){if(_0x5251fa[_0xa502('0x11')][_0xa502('0x12')]===0x1f4){logger['error'](_0xa502('0xd'),_0x329022,_0x5251fa[_0xa502('0x11')]['message']);return _0x4e4e5d(_0x5251fa[_0xa502('0x11')][_0xa502('0x13')]);}logger[_0xa502('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x329022,_0x5251fa[_0xa502('0x11')][_0xa502('0x13')]);return _0x4d30f2(_0x5251fa[_0xa502('0x11')]['message']);}else{logger[_0xa502('0xc')](_0xa502('0xd'),_0x329022,_0xa502('0xe'));_0x4d30f2(_0x5251fa[_0xa502('0x14')][_0xa502('0x13')]);}})[_0xa502('0x15')](function(_0x3107a0){logger[_0xa502('0x11')](_0xa502('0xd'),_0x329022,_0x3107a0);_0x4e4e5d(_0x3107a0);});});} \ No newline at end of file +var _0xc6eb=['../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc6eb,0x118));var _0xbc6e=function(_0x3afd09,_0x52634e){_0x3afd09=_0x3afd09-0x0;var _0x451138=_0xc6eb[_0x3afd09];return _0x451138;};'use strict';var _=require(_0xbc6e('0x0'));var util=require('util');var moment=require(_0xbc6e('0x1'));var BPromise=require(_0xbc6e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc6e('0x3'));var db=require(_0xbc6e('0x4'))['db'];var utils=require(_0xbc6e('0x5'));var logger=require(_0xbc6e('0x6'))(_0xbc6e('0x7'));var config=require('../../config/environment');var jayson=require(_0xbc6e('0x8'));var client=jayson[_0xbc6e('0x9')][_0xbc6e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cc312,_0x5e4fc9,_0x536b8c){return new BPromise(function(_0x5ed473,_0x4d19e9){return client['request'](_0x1cc312,_0x536b8c)['then'](function(_0x4f9ee4){logger[_0xbc6e('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5e4fc9,_0xbc6e('0xc'));logger[_0xbc6e('0xd')](_0xbc6e('0xe'),_0x5e4fc9,_0xbc6e('0xc'),JSON[_0xbc6e('0xf')](_0x4f9ee4));if(_0x4f9ee4[_0xbc6e('0x10')]){if(_0x4f9ee4[_0xbc6e('0x10')][_0xbc6e('0x11')]===0x1f4){logger['error'](_0xbc6e('0x12'),_0x5e4fc9,_0x4f9ee4[_0xbc6e('0x10')]['message']);return _0x4d19e9(_0x4f9ee4[_0xbc6e('0x10')][_0xbc6e('0x13')]);}logger[_0xbc6e('0x10')](_0xbc6e('0x12'),_0x5e4fc9,_0x4f9ee4['error']['message']);return _0x5ed473(_0x4f9ee4[_0xbc6e('0x10')][_0xbc6e('0x13')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x5e4fc9,'request\x20sent');_0x5ed473(_0x4f9ee4[_0xbc6e('0x14')][_0xbc6e('0x13')]);}})[_0xbc6e('0x15')](function(_0x45c2fb){logger[_0xbc6e('0x10')](_0xbc6e('0x12'),_0x5e4fc9,_0x45c2fb);_0x4d19e9(_0x45c2fb);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 25adc03..76d8433 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 _0x7bd0=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports'];(function(_0xc2fcdb,_0x5e225a){var _0x4d7af3=function(_0x56d8eb){while(--_0x56d8eb){_0xc2fcdb['push'](_0xc2fcdb['shift']());}};_0x4d7af3(++_0x5e225a);}(_0x7bd0,0x111));var _0x07bd=function(_0x15a8fa,_0x4652b2){_0x15a8fa=_0x15a8fa-0x0;var _0x1355c2=_0x7bd0[_0x15a8fa];return _0x1355c2;};'use strict';var multer=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var path=require(_0x07bd('0x2'));var timeout=require(_0x07bd('0x3'));var express=require(_0x07bd('0x4'));var router=express[_0x07bd('0x5')]();var fs_extra=require(_0x07bd('0x6'));var auth=require(_0x07bd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x07bd('0x8'));var controller=require(_0x07bd('0x9'));router[_0x07bd('0xa')]('/',auth[_0x07bd('0xb')](),controller[_0x07bd('0xc')]);router[_0x07bd('0xa')](_0x07bd('0xd'),auth['isAuthenticated'](),controller[_0x07bd('0xe')]);router['post']('/',auth[_0x07bd('0xb')](),controller[_0x07bd('0xf')]);router[_0x07bd('0x10')]('/:id',auth[_0x07bd('0xb')](),controller[_0x07bd('0x11')]);router[_0x07bd('0x12')](_0x07bd('0xd'),auth['isAuthenticated'](),controller[_0x07bd('0x13')]);module[_0x07bd('0x14')]=router; \ No newline at end of file +var _0x50a5=['exports','multer','util','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0x50a5,0xd1));var _0x550a=function(_0x5206c6,_0x369677){_0x5206c6=_0x5206c6-0x0;var _0x2edbef=_0x50a5[_0x5206c6];return _0x2edbef;};'use strict';var multer=require(_0x550a('0x0'));var util=require(_0x550a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x550a('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x550a('0x3'));var config=require(_0x550a('0x4'));var controller=require(_0x550a('0x5'));router[_0x550a('0x6')]('/',auth[_0x550a('0x7')](),controller[_0x550a('0x8')]);router[_0x550a('0x6')](_0x550a('0x9'),auth[_0x550a('0x7')](),controller[_0x550a('0xa')]);router[_0x550a('0xb')]('/',auth[_0x550a('0x7')](),controller[_0x550a('0xc')]);router['put'](_0x550a('0x9'),auth[_0x550a('0x7')](),controller[_0x550a('0xd')]);router[_0x550a('0xe')](_0x550a('0x9'),auth[_0x550a('0x7')](),controller['destroy']);module[_0x550a('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 28e4c9e..c143de2 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 _0x04a3=['TEXT','sequelize','exports','STRING'];(function(_0x5de0c4,_0xacc4ce){var _0x55759a=function(_0x42e643){while(--_0x42e643){_0x5de0c4['push'](_0x5de0c4['shift']());}};_0x55759a(++_0xacc4ce);}(_0x04a3,0xb9));var _0x304a=function(_0x52b474,_0x3ca29d){_0x52b474=_0x52b474-0x0;var _0xb08603=_0x04a3[_0x52b474];return _0xb08603;};'use strict';var Sequelize=require(_0x304a('0x0'));module[_0x304a('0x1')]={'name':{'type':Sequelize[_0x304a('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x304a('0x3')]}}; \ No newline at end of file +var _0xfc4a=['exports','STRING','sequelize'];(function(_0x489ed3,_0x340d06){var _0x4ee841=function(_0x5bfdaa){while(--_0x5bfdaa){_0x489ed3['push'](_0x489ed3['shift']());}};_0x4ee841(++_0x340d06);}(_0xfc4a,0x86));var _0xafc4=function(_0x220a14,_0x3de07a){_0x220a14=_0x220a14-0x0;var _0x1a026c=_0xfc4a[_0x220a14];return _0x1a026c;};'use strict';var Sequelize=require(_0xafc4('0x0'));module[_0xafc4('0x1')]={'name':{'type':Sequelize[_0xafc4('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index a10d6b0..81cca50 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 _0x5c9b=['VIRTUAL','includeAll','include','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','update','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','apply','save','then','destroy','get','Templates','UserProfileResource','end','error','stack','name','send','Template','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge'];(function(_0x174140,_0x49b247){var _0x47e433=function(_0x314a69){while(--_0x314a69){_0x174140['push'](_0x174140['shift']());}};_0x47e433(++_0x49b247);}(_0x5c9b,0xa9));var _0xb5c9=function(_0xa01014,_0x2e8db9){_0xa01014=_0xa01014-0x0;var _0x14ce65=_0x5c9b[_0xa01014];return _0x14ce65;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5c9('0x0'));var zipdir=require(_0xb5c9('0x1'));var jsonpatch=require(_0xb5c9('0x2'));var rp=require(_0xb5c9('0x3'));var moment=require(_0xb5c9('0x4'));var BPromise=require(_0xb5c9('0x5'));var Mustache=require(_0xb5c9('0x6'));var util=require(_0xb5c9('0x7'));var path=require(_0xb5c9('0x8'));var sox=require(_0xb5c9('0x9'));var csv=require('to-csv');var ejs=require(_0xb5c9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb5c9('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb5c9('0xc'));var Papa=require('papaparse');var Redis=require(_0xb5c9('0xd'));var authService=require(_0xb5c9('0xe'));var qs=require(_0xb5c9('0xf'));var as=require(_0xb5c9('0x10'));var hardwareService=require(_0xb5c9('0x11'));var logger=require(_0xb5c9('0x12'))(_0xb5c9('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb5c9('0x14'));var db=require(_0xb5c9('0x15'))['db'];function respondWithStatusCode(_0x27803a,_0x453b7c){_0x453b7c=_0x453b7c||0xcc;return function(_0x21eb8e){if(_0x21eb8e){return _0x27803a[_0xb5c9('0x16')](_0x453b7c);}return _0x27803a[_0xb5c9('0x17')](_0x453b7c)['end']();};}function respondWithResult(_0x505ccd,_0x86f1dd){_0x86f1dd=_0x86f1dd||0xc8;return function(_0x250525){if(_0x250525){return _0x505ccd[_0xb5c9('0x17')](_0x86f1dd)[_0xb5c9('0x18')](_0x250525);}};}function respondWithFilteredResult(_0x1934ec,_0x196618){return function(_0x5371d1){if(_0x5371d1){var _0x4e4020=typeof _0x196618[_0xb5c9('0x19')]==='undefined'&&typeof _0x196618['limit']===_0xb5c9('0x1a');var _0x15bc9a=_0x5371d1[_0xb5c9('0x1b')];var _0x31c924=_0x4e4020?0x0:_0x196618[_0xb5c9('0x19')];var _0x7ba57c=_0x4e4020?_0x5371d1['count']:_0x196618['offset']+_0x196618['limit'];var _0x13ce6c;if(_0x7ba57c>=_0x15bc9a){_0x7ba57c=_0x15bc9a;_0x13ce6c=0xc8;}else{_0x13ce6c=0xce;}_0x1934ec['status'](_0x13ce6c);return _0x1934ec[_0xb5c9('0x1c')]('Content-Range',_0x31c924+'-'+_0x7ba57c+'/'+_0x15bc9a)[_0xb5c9('0x18')](_0x5371d1);}return null;};}function patchUpdates(_0x306021){return function(_0x1e7fc7){try{jsonpatch[_0xb5c9('0x1d')](_0x1e7fc7,_0x306021,!![]);}catch(_0x1d1980){return BPromise['reject'](_0x1d1980);}return _0x1e7fc7[_0xb5c9('0x1e')]();};}function saveUpdates(_0x351f2b,_0x386b55){return function(_0x4658d8){if(_0x4658d8){return _0x4658d8['update'](_0x351f2b)[_0xb5c9('0x1f')](function(_0x1d2819){return _0x1d2819;});}return null;};}function removeEntity(_0x31850c,_0x343e18){return function(_0x5042aa){if(_0x5042aa){return _0x5042aa[_0xb5c9('0x20')]()[_0xb5c9('0x1f')](function(){var _0x4b2dee=_0x5042aa[_0xb5c9('0x21')]({'plain':!![]});var _0x2ac4d4=_0xb5c9('0x22');return db[_0xb5c9('0x23')][_0xb5c9('0x20')]({'where':{'type':_0x2ac4d4,'resourceId':_0x4b2dee['id']}})['then'](function(){return _0x5042aa;});})['then'](function(){_0x31850c['status'](0xcc)[_0xb5c9('0x24')]();});}};}function handleEntityNotFound(_0x13a306,_0x3f9c8b){return function(_0x46e911){if(!_0x46e911){_0x13a306[_0xb5c9('0x16')](0x194);}return _0x46e911;};}function handleError(_0x240444,_0x1b465a){_0x1b465a=_0x1b465a||0x1f4;return function(_0x8a7a1f){logger[_0xb5c9('0x25')](_0x8a7a1f[_0xb5c9('0x26')]);if(_0x8a7a1f[_0xb5c9('0x27')]){delete _0x8a7a1f[_0xb5c9('0x27')];}_0x240444[_0xb5c9('0x17')](_0x1b465a)[_0xb5c9('0x28')](_0x8a7a1f);};}exports['index']=function(_0x4dfce3,_0x4e0113){var _0x6d0918={},_0x669093={},_0x53bdd2={'count':0x0,'rows':[]};var _0x1a21e0=_['map'](db[_0xb5c9('0x29')][_0xb5c9('0x2a')],function(_0x32baff){return{'name':_0x32baff[_0xb5c9('0x2b')],'type':_0x32baff[_0xb5c9('0x2c')]['key']};});_0x669093['model']=_[_0xb5c9('0x2d')](_0x1a21e0,_0xb5c9('0x27'));_0x669093[_0xb5c9('0x2e')]=_[_0xb5c9('0x2f')](_0x4dfce3['query']);_0x669093[_0xb5c9('0x30')]=_[_0xb5c9('0x31')](_0x669093[_0xb5c9('0x32')],_0x669093[_0xb5c9('0x2e')]);_0x6d0918[_0xb5c9('0x33')]=_[_0xb5c9('0x31')](_0x669093[_0xb5c9('0x32')],qs[_0xb5c9('0x34')](_0x4dfce3['query'][_0xb5c9('0x34')]));_0x6d0918[_0xb5c9('0x33')]=_0x6d0918[_0xb5c9('0x33')][_0xb5c9('0x35')]?_0x6d0918[_0xb5c9('0x33')]:_0x669093[_0xb5c9('0x32')];if(!_0x4dfce3['query'][_0xb5c9('0x36')](_0xb5c9('0x37'))){_0x6d0918[_0xb5c9('0x38')]=qs[_0xb5c9('0x38')](_0x4dfce3[_0xb5c9('0x2e')]['limit']);_0x6d0918[_0xb5c9('0x19')]=qs['offset'](_0x4dfce3[_0xb5c9('0x2e')][_0xb5c9('0x19')]);}_0x6d0918[_0xb5c9('0x39')]=qs['sort'](_0x4dfce3[_0xb5c9('0x2e')][_0xb5c9('0x3a')]);_0x6d0918[_0xb5c9('0x3b')]=qs['filters'](_['pick'](_0x4dfce3['query'],_0x669093[_0xb5c9('0x30')]),_0x1a21e0);if(_0x4dfce3[_0xb5c9('0x2e')][_0xb5c9('0x3c')]){_0x6d0918[_0xb5c9('0x3b')]=_[_0xb5c9('0x3d')](_0x6d0918[_0xb5c9('0x3b')],{'$or':_['map'](_0x1a21e0,function(_0x1c5b5d){if(_0x1c5b5d['type']!==_0xb5c9('0x3e')){var _0x39c657={};_0x39c657[_0x1c5b5d[_0xb5c9('0x27')]]={'$like':'%'+_0x4dfce3[_0xb5c9('0x2e')][_0xb5c9('0x3c')]+'%'};return _0x39c657;}})});}_0x6d0918=_['merge']({},_0x6d0918,_0x4dfce3['options']);var _0x3c6fe1={'where':_0x6d0918[_0xb5c9('0x3b')]};return db[_0xb5c9('0x29')][_0xb5c9('0x1b')](_0x3c6fe1)[_0xb5c9('0x1f')](function(_0x2935a8){_0x53bdd2[_0xb5c9('0x1b')]=_0x2935a8;if(_0x4dfce3[_0xb5c9('0x2e')][_0xb5c9('0x3f')]){_0x6d0918[_0xb5c9('0x40')]=[{'all':!![]}];}return db['Template']['findAll'](_0x6d0918);})[_0xb5c9('0x1f')](function(_0x3186e9){_0x53bdd2[_0xb5c9('0x41')]=_0x3186e9;return _0x53bdd2;})[_0xb5c9('0x1f')](respondWithFilteredResult(_0x4e0113,_0x6d0918))[_0xb5c9('0x42')](handleError(_0x4e0113,null));};exports[_0xb5c9('0x43')]=function(_0x472067,_0x398c8c){var _0x336350={'raw':!![],'where':{'id':_0x472067[_0xb5c9('0x44')]['id']}},_0x246bb1={};_0x246bb1[_0xb5c9('0x32')]=_[_0xb5c9('0x2f')](db[_0xb5c9('0x29')][_0xb5c9('0x2a')]);_0x246bb1[_0xb5c9('0x2e')]=_[_0xb5c9('0x2f')](_0x472067[_0xb5c9('0x2e')]);_0x246bb1['filters']=_[_0xb5c9('0x31')](_0x246bb1[_0xb5c9('0x32')],_0x246bb1['query']);_0x336350['attributes']=_[_0xb5c9('0x31')](_0x246bb1[_0xb5c9('0x32')],qs[_0xb5c9('0x34')](_0x472067['query']['fields']));_0x336350[_0xb5c9('0x33')]=_0x336350['attributes']['length']?_0x336350[_0xb5c9('0x33')]:_0x246bb1[_0xb5c9('0x32')];if(_0x472067['query'][_0xb5c9('0x3f')]){_0x336350[_0xb5c9('0x40')]=[{'all':!![]}];}_0x336350=_[_0xb5c9('0x3d')]({},_0x336350,_0x472067['options']);return db[_0xb5c9('0x29')]['find'](_0x336350)[_0xb5c9('0x1f')](handleEntityNotFound(_0x398c8c,null))['then'](respondWithResult(_0x398c8c,null))['catch'](handleError(_0x398c8c,null));};exports['create']=function(_0x1e531e,_0x5eed59){return db[_0xb5c9('0x29')][_0xb5c9('0x45')](_0x1e531e['body'],{})[_0xb5c9('0x1f')](function(_0xaee827){var _0x243079=_0x1e531e[_0xb5c9('0x46')][_0xb5c9('0x21')]({'plain':!![]});if(!_0x243079)throw new Error(_0xb5c9('0x47'));if(_0x243079[_0xb5c9('0x48')]===_0xb5c9('0x46')){var _0x4bb8c5=_0xaee827[_0xb5c9('0x21')]({'plain':!![]});var _0x4e4b5a=_0xb5c9('0x22');return db[_0xb5c9('0x49')][_0xb5c9('0x4a')]({'where':{'name':_0x4e4b5a,'userProfileId':_0x243079['userProfileId']},'raw':!![]})[_0xb5c9('0x1f')](function(_0x30c75d){if(_0x30c75d&&_0x30c75d['autoAssociation']===0x0){return db[_0xb5c9('0x23')][_0xb5c9('0x45')]({'name':_0x4bb8c5[_0xb5c9('0x27')],'resourceId':_0x4bb8c5['id'],'type':_0x30c75d[_0xb5c9('0x27')],'sectionId':_0x30c75d['id']},{})['then'](function(){return _0xaee827;});}else{return _0xaee827;}})[_0xb5c9('0x42')](function(_0x443da1){logger[_0xb5c9('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x443da1);throw _0x443da1;});}return _0xaee827;})[_0xb5c9('0x1f')](respondWithResult(_0x5eed59,0xc9))[_0xb5c9('0x42')](handleError(_0x5eed59,null));};exports[_0xb5c9('0x4b')]=function(_0x2079bc,_0x4da277){if(_0x2079bc[_0xb5c9('0x4c')]['id']){delete _0x2079bc[_0xb5c9('0x4c')]['id'];}return db[_0xb5c9('0x29')][_0xb5c9('0x4a')]({'where':{'id':_0x2079bc[_0xb5c9('0x44')]['id']}})[_0xb5c9('0x1f')](handleEntityNotFound(_0x4da277,null))['then'](saveUpdates(_0x2079bc[_0xb5c9('0x4c')],null))[_0xb5c9('0x1f')](respondWithResult(_0x4da277,null))[_0xb5c9('0x42')](handleError(_0x4da277,null));};exports[_0xb5c9('0x20')]=function(_0x419f0c,_0x1b966b){return db[_0xb5c9('0x29')][_0xb5c9('0x4a')]({'where':{'id':_0x419f0c[_0xb5c9('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b966b,null))['then'](removeEntity(_0x1b966b,null))['catch'](handleError(_0x1b966b,null));}; \ No newline at end of file +var _0x2880=['../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','get','Templates','UserProfileResource','error','stack','name','send','index','map','Template','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','catch','show','params','length','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1833ea,_0x47efc){var _0x49c38c=function(_0x3b5cce){while(--_0x3b5cce){_0x1833ea['push'](_0x1833ea['shift']());}};_0x49c38c(++_0x47efc);}(_0x2880,0x171));var _0x0288=function(_0x1bc798,_0x2ab7c9){_0x1bc798=_0x1bc798-0x0;var _0x3308ca=_0x2880[_0x1bc798];return _0x3308ca;};'use strict';var emlformat=require(_0x0288('0x0'));var rimraf=require(_0x0288('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0288('0x2'));var rp=require('request-promise');var moment=require(_0x0288('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0288('0x4'));var path=require(_0x0288('0x5'));var sox=require(_0x0288('0x6'));var csv=require(_0x0288('0x7'));var ejs=require(_0x0288('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0288('0x9'));var crypto=require(_0x0288('0xa'));var jsforce=require(_0x0288('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0288('0x7'));var querystring=require(_0x0288('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0288('0xd'));var qs=require(_0x0288('0xe'));var as=require(_0x0288('0xf'));var hardwareService=require(_0x0288('0x10'));var logger=require(_0x0288('0x11'))(_0x0288('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0288('0x13'));var db=require(_0x0288('0x14'))['db'];function respondWithStatusCode(_0x624ec7,_0x5ef39d){_0x5ef39d=_0x5ef39d||0xcc;return function(_0x2c8890){if(_0x2c8890){return _0x624ec7[_0x0288('0x15')](_0x5ef39d);}return _0x624ec7[_0x0288('0x16')](_0x5ef39d)[_0x0288('0x17')]();};}function respondWithResult(_0x589993,_0x128718){_0x128718=_0x128718||0xc8;return function(_0x29cfb8){if(_0x29cfb8){return _0x589993[_0x0288('0x16')](_0x128718)['json'](_0x29cfb8);}};}function respondWithFilteredResult(_0x163255,_0x5d8e2c){return function(_0x381418){if(_0x381418){var _0x44f370=typeof _0x5d8e2c[_0x0288('0x18')]===_0x0288('0x19')&&typeof _0x5d8e2c[_0x0288('0x1a')]==='undefined';var _0x59e4cf=_0x381418[_0x0288('0x1b')];var _0x4a3762=_0x44f370?0x0:_0x5d8e2c[_0x0288('0x18')];var _0x3897fe=_0x44f370?_0x381418[_0x0288('0x1b')]:_0x5d8e2c['offset']+_0x5d8e2c['limit'];var _0x2e6bc9;if(_0x3897fe>=_0x59e4cf){_0x3897fe=_0x59e4cf;_0x2e6bc9=0xc8;}else{_0x2e6bc9=0xce;}_0x163255[_0x0288('0x16')](_0x2e6bc9);return _0x163255[_0x0288('0x1c')]('Content-Range',_0x4a3762+'-'+_0x3897fe+'/'+_0x59e4cf)[_0x0288('0x1d')](_0x381418);}return null;};}function patchUpdates(_0x4ca7ad){return function(_0x318948){try{jsonpatch[_0x0288('0x1e')](_0x318948,_0x4ca7ad,!![]);}catch(_0x46ecef){return BPromise['reject'](_0x46ecef);}return _0x318948[_0x0288('0x1f')]();};}function saveUpdates(_0x3fe526,_0x2b6842){return function(_0x4e3b7e){if(_0x4e3b7e){return _0x4e3b7e[_0x0288('0x20')](_0x3fe526)[_0x0288('0x21')](function(_0x3fbfee){return _0x3fbfee;});}return null;};}function removeEntity(_0x1a36ab,_0x33e1a0){return function(_0x23096a){if(_0x23096a){return _0x23096a['destroy']()['then'](function(){var _0x1fef3c=_0x23096a[_0x0288('0x22')]({'plain':!![]});var _0x3b7406=_0x0288('0x23');return db[_0x0288('0x24')]['destroy']({'where':{'type':_0x3b7406,'resourceId':_0x1fef3c['id']}})[_0x0288('0x21')](function(){return _0x23096a;});})[_0x0288('0x21')](function(){_0x1a36ab[_0x0288('0x16')](0xcc)[_0x0288('0x17')]();});}};}function handleEntityNotFound(_0x3dd0e8,_0x4fa2d9){return function(_0xecb11e){if(!_0xecb11e){_0x3dd0e8[_0x0288('0x15')](0x194);}return _0xecb11e;};}function handleError(_0xf7e2ba,_0x5ab9a1){_0x5ab9a1=_0x5ab9a1||0x1f4;return function(_0x2ef26f){logger[_0x0288('0x25')](_0x2ef26f[_0x0288('0x26')]);if(_0x2ef26f[_0x0288('0x27')]){delete _0x2ef26f[_0x0288('0x27')];}_0xf7e2ba['status'](_0x5ab9a1)[_0x0288('0x28')](_0x2ef26f);};}exports[_0x0288('0x29')]=function(_0xad64f,_0x434a85){var _0x4d2929={},_0x5eed09={},_0x45a142={'count':0x0,'rows':[]};var _0x2bdedb=_[_0x0288('0x2a')](db[_0x0288('0x2b')]['rawAttributes'],function(_0x318ebb){return{'name':_0x318ebb['fieldName'],'type':_0x318ebb[_0x0288('0x2c')][_0x0288('0x2d')]};});_0x5eed09['model']=_[_0x0288('0x2a')](_0x2bdedb,'name');_0x5eed09[_0x0288('0x2e')]=_['keys'](_0xad64f[_0x0288('0x2e')]);_0x5eed09[_0x0288('0x2f')]=_[_0x0288('0x30')](_0x5eed09[_0x0288('0x31')],_0x5eed09[_0x0288('0x2e')]);_0x4d2929[_0x0288('0x32')]=_[_0x0288('0x30')](_0x5eed09[_0x0288('0x31')],qs[_0x0288('0x33')](_0xad64f[_0x0288('0x2e')][_0x0288('0x33')]));_0x4d2929[_0x0288('0x32')]=_0x4d2929['attributes']['length']?_0x4d2929[_0x0288('0x32')]:_0x5eed09[_0x0288('0x31')];if(!_0xad64f[_0x0288('0x2e')][_0x0288('0x34')]('nolimit')){_0x4d2929[_0x0288('0x1a')]=qs[_0x0288('0x1a')](_0xad64f[_0x0288('0x2e')]['limit']);_0x4d2929[_0x0288('0x18')]=qs[_0x0288('0x18')](_0xad64f[_0x0288('0x2e')][_0x0288('0x18')]);}_0x4d2929[_0x0288('0x35')]=qs[_0x0288('0x36')](_0xad64f['query'][_0x0288('0x36')]);_0x4d2929[_0x0288('0x37')]=qs[_0x0288('0x2f')](_[_0x0288('0x38')](_0xad64f['query'],_0x5eed09['filters']),_0x2bdedb);if(_0xad64f[_0x0288('0x2e')]['filter']){_0x4d2929[_0x0288('0x37')]=_[_0x0288('0x39')](_0x4d2929[_0x0288('0x37')],{'$or':_[_0x0288('0x2a')](_0x2bdedb,function(_0x13bf0b){if(_0x13bf0b[_0x0288('0x2c')]!==_0x0288('0x3a')){var _0x3d2ab9={};_0x3d2ab9[_0x13bf0b[_0x0288('0x27')]]={'$like':'%'+_0xad64f[_0x0288('0x2e')][_0x0288('0x3b')]+'%'};return _0x3d2ab9;}})});}_0x4d2929=_[_0x0288('0x39')]({},_0x4d2929,_0xad64f['options']);var _0x453796={'where':_0x4d2929[_0x0288('0x37')]};return db['Template']['count'](_0x453796)[_0x0288('0x21')](function(_0x2e7ad1){_0x45a142[_0x0288('0x1b')]=_0x2e7ad1;if(_0xad64f[_0x0288('0x2e')]['includeAll']){_0x4d2929[_0x0288('0x3c')]=[{'all':!![]}];}return db[_0x0288('0x2b')][_0x0288('0x3d')](_0x4d2929);})['then'](function(_0x50ef91){_0x45a142['rows']=_0x50ef91;return _0x45a142;})[_0x0288('0x21')](respondWithFilteredResult(_0x434a85,_0x4d2929))[_0x0288('0x3e')](handleError(_0x434a85,null));};exports[_0x0288('0x3f')]=function(_0x33ba43,_0x21aa61){var _0x4f2b37={'raw':!![],'where':{'id':_0x33ba43[_0x0288('0x40')]['id']}},_0x2db0ae={};_0x2db0ae[_0x0288('0x31')]=_['keys'](db['Template']['rawAttributes']);_0x2db0ae[_0x0288('0x2e')]=_['keys'](_0x33ba43[_0x0288('0x2e')]);_0x2db0ae[_0x0288('0x2f')]=_['intersection'](_0x2db0ae[_0x0288('0x31')],_0x2db0ae[_0x0288('0x2e')]);_0x4f2b37[_0x0288('0x32')]=_[_0x0288('0x30')](_0x2db0ae[_0x0288('0x31')],qs[_0x0288('0x33')](_0x33ba43[_0x0288('0x2e')][_0x0288('0x33')]));_0x4f2b37[_0x0288('0x32')]=_0x4f2b37[_0x0288('0x32')][_0x0288('0x41')]?_0x4f2b37[_0x0288('0x32')]:_0x2db0ae[_0x0288('0x31')];if(_0x33ba43[_0x0288('0x2e')][_0x0288('0x42')]){_0x4f2b37[_0x0288('0x3c')]=[{'all':!![]}];}_0x4f2b37=_[_0x0288('0x39')]({},_0x4f2b37,_0x33ba43[_0x0288('0x43')]);return db['Template']['find'](_0x4f2b37)['then'](handleEntityNotFound(_0x21aa61,null))[_0x0288('0x21')](respondWithResult(_0x21aa61,null))[_0x0288('0x3e')](handleError(_0x21aa61,null));};exports[_0x0288('0x44')]=function(_0x14144d,_0x41690a){return db[_0x0288('0x2b')][_0x0288('0x44')](_0x14144d[_0x0288('0x45')],{})['then'](function(_0x398f91){var _0x47a660=_0x14144d[_0x0288('0x46')][_0x0288('0x22')]({'plain':!![]});if(!_0x47a660)throw new Error(_0x0288('0x47'));if(_0x47a660['role']===_0x0288('0x46')){var _0x42a6ff=_0x398f91[_0x0288('0x22')]({'plain':!![]});var _0x35829d=_0x0288('0x23');return db[_0x0288('0x48')][_0x0288('0x49')]({'where':{'name':_0x35829d,'userProfileId':_0x47a660[_0x0288('0x4a')]},'raw':!![]})[_0x0288('0x21')](function(_0x2f2487){if(_0x2f2487&&_0x2f2487[_0x0288('0x4b')]===0x0){return db[_0x0288('0x24')][_0x0288('0x44')]({'name':_0x42a6ff[_0x0288('0x27')],'resourceId':_0x42a6ff['id'],'type':_0x2f2487['name'],'sectionId':_0x2f2487['id']},{})[_0x0288('0x21')](function(){return _0x398f91;});}else{return _0x398f91;}})[_0x0288('0x3e')](function(_0x57ffc5){logger[_0x0288('0x25')](_0x0288('0x4c'),_0x57ffc5);throw _0x57ffc5;});}return _0x398f91;})[_0x0288('0x21')](respondWithResult(_0x41690a,0xc9))[_0x0288('0x3e')](handleError(_0x41690a,null));};exports['update']=function(_0x3c5ccd,_0x232259){if(_0x3c5ccd['body']['id']){delete _0x3c5ccd[_0x0288('0x45')]['id'];}return db[_0x0288('0x2b')]['find']({'where':{'id':_0x3c5ccd[_0x0288('0x40')]['id']}})[_0x0288('0x21')](handleEntityNotFound(_0x232259,null))['then'](saveUpdates(_0x3c5ccd[_0x0288('0x45')],null))[_0x0288('0x21')](respondWithResult(_0x232259,null))['catch'](handleError(_0x232259,null));};exports['destroy']=function(_0x4d65c0,_0x4ea3a9){return db[_0x0288('0x2b')][_0x0288('0x49')]({'where':{'id':_0x4d65c0[_0x0288('0x40')]['id']}})[_0x0288('0x21')](handleEntityNotFound(_0x4ea3a9,null))['then'](removeEntity(_0x4ea3a9,null))[_0x0288('0x3e')](handleError(_0x4ea3a9,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 21b360d..f5c34f6 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 _0x6044=['moment','bluebird','path','rimraf','../../config/environment','./template.attributes','define','tools_templates','lodash','util','api'];(function(_0x163cc4,_0x17323f){var _0x4742a8=function(_0x5ac07d){while(--_0x5ac07d){_0x163cc4['push'](_0x163cc4['shift']());}};_0x4742a8(++_0x17323f);}(_0x6044,0x147));var _0x4604=function(_0x2f420f,_0x4b0d1d){_0x2f420f=_0x2f420f-0x0;var _0xa1d160=_0x6044[_0x2f420f];return _0xa1d160;};'use strict';var _=require(_0x4604('0x0'));var util=require(_0x4604('0x1'));var logger=require('../../config/logger')(_0x4604('0x2'));var moment=require(_0x4604('0x3'));var BPromise=require(_0x4604('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4604('0x5'));var rimraf=require(_0x4604('0x6'));var config=require(_0x4604('0x7'));var attributes=require(_0x4604('0x8'));module['exports']=function(_0xede36e,_0x2126f5){return _0xede36e[_0x4604('0x9')]('Template',attributes,{'tableName':_0x4604('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50e6=['define','Template','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x26a396,_0x167fc0){var _0x5cb800=function(_0x502f1b){while(--_0x502f1b){_0x26a396['push'](_0x26a396['shift']());}};_0x5cb800(++_0x167fc0);}(_0x50e6,0x13b));var _0x650e=function(_0x1f29e0,_0x4b53e5){_0x1f29e0=_0x1f29e0-0x0;var _0x22bb3f=_0x50e6[_0x1f29e0];return _0x22bb3f;};'use strict';var _=require(_0x650e('0x0'));var util=require(_0x650e('0x1'));var logger=require(_0x650e('0x2'))(_0x650e('0x3'));var moment=require(_0x650e('0x4'));var BPromise=require(_0x650e('0x5'));var rp=require(_0x650e('0x6'));var fs=require('fs');var path=require(_0x650e('0x7'));var rimraf=require(_0x650e('0x8'));var config=require('../../config/environment');var attributes=require('./template.attributes');module['exports']=function(_0x4f9fa9,_0x57bd9b){return _0x4f9fa9[_0x650e('0x9')](_0x650e('0xa'),attributes,{'tableName':_0x650e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 69768aa..ecb57b0 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 _0xf4b6=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','Template','findAll','options','raw','where','attributes','limit','include','map','model','then','GetTemplate','debug','lodash','moment','bluebird','../../mysqldb'];(function(_0x44e700,_0x487889){var _0x1d15c0=function(_0x22f443){while(--_0x22f443){_0x44e700['push'](_0x44e700['shift']());}};_0x1d15c0(++_0x487889);}(_0xf4b6,0x1a9));var _0x6f4b=function(_0x67bee4,_0x1d2f1e){_0x67bee4=_0x67bee4-0x0;var _0x3f80bf=_0xf4b6[_0x67bee4];return _0x3f80bf;};'use strict';var _=require(_0x6f4b('0x0'));var util=require('util');var moment=require(_0x6f4b('0x1'));var BPromise=require(_0x6f4b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f4b('0x3'))['db'];var utils=require(_0x6f4b('0x4'));var logger=require(_0x6f4b('0x5'))(_0x6f4b('0x6'));var config=require('../../config/environment');var jayson=require(_0x6f4b('0x7'));var client=jayson[_0x6f4b('0x8')][_0x6f4b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x161cc9,_0x2d5ee1,_0x59d2fe){return new BPromise(function(_0x25ad8f,_0x365230){return client[_0x6f4b('0xa')](_0x161cc9,_0x59d2fe)['then'](function(_0x4b7d48){logger['info'](_0x6f4b('0xb'),_0x2d5ee1,'request\x20sent');logger['debug'](_0x6f4b('0xc'),_0x2d5ee1,_0x6f4b('0xd'),JSON[_0x6f4b('0xe')](_0x4b7d48));if(_0x4b7d48['error']){if(_0x4b7d48[_0x6f4b('0xf')]['code']===0x1f4){logger[_0x6f4b('0xf')]('Template,\x20%s,\x20%s',_0x2d5ee1,_0x4b7d48['error'][_0x6f4b('0x10')]);return _0x365230(_0x4b7d48[_0x6f4b('0xf')][_0x6f4b('0x10')]);}logger['error'](_0x6f4b('0xb'),_0x2d5ee1,_0x4b7d48[_0x6f4b('0xf')][_0x6f4b('0x10')]);return _0x25ad8f(_0x4b7d48['error']['message']);}else{logger[_0x6f4b('0x11')](_0x6f4b('0xb'),_0x2d5ee1,'request\x20sent');_0x25ad8f(_0x4b7d48[_0x6f4b('0x12')][_0x6f4b('0x10')]);}})[_0x6f4b('0x13')](function(_0x192605){logger['error'](_0x6f4b('0xb'),_0x2d5ee1,_0x192605);_0x365230(_0x192605);});});}exports['GetTemplate']=function(_0xf82712){var _0x2c47fc=this;return new Promise(function(_0x2493d2,_0x3f1684){return db[_0x6f4b('0x14')][_0x6f4b('0x15')]({'raw':_0xf82712[_0x6f4b('0x16')]?_0xf82712[_0x6f4b('0x16')][_0x6f4b('0x17')]===undefined?!![]:![]:!![],'where':_0xf82712[_0x6f4b('0x16')]?_0xf82712[_0x6f4b('0x16')][_0x6f4b('0x18')]||null:null,'attributes':_0xf82712[_0x6f4b('0x16')]?_0xf82712['options'][_0x6f4b('0x19')]||null:null,'limit':_0xf82712[_0x6f4b('0x16')]?_0xf82712['options'][_0x6f4b('0x1a')]||null:null,'include':_0xf82712[_0x6f4b('0x16')]?_0xf82712[_0x6f4b('0x16')][_0x6f4b('0x1b')]?_[_0x6f4b('0x1c')](_0xf82712[_0x6f4b('0x16')][_0x6f4b('0x1b')],function(_0x2411a9){return{'model':db[_0x2411a9[_0x6f4b('0x1d')]],'as':_0x2411a9['as'],'attributes':_0x2411a9[_0x6f4b('0x19')],'include':_0x2411a9[_0x6f4b('0x1b')]?_[_0x6f4b('0x1c')](_0x2411a9[_0x6f4b('0x1b')],function(_0x2031ed){return{'model':db[_0x2031ed[_0x6f4b('0x1d')]],'as':_0x2031ed['as'],'attributes':_0x2031ed[_0x6f4b('0x19')],'include':_0x2031ed[_0x6f4b('0x1b')]?_[_0x6f4b('0x1c')](_0x2031ed['include'],function(_0x30df43){return{'model':db[_0x30df43[_0x6f4b('0x1d')]],'as':_0x30df43['as'],'attributes':_0x30df43[_0x6f4b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6f4b('0x1e')](function(_0x15a41a){logger[_0x6f4b('0x11')](_0x6f4b('0x1f'),_0xf82712);logger[_0x6f4b('0x20')](_0x6f4b('0x1f'),_0xf82712,JSON[_0x6f4b('0xe')](_0x15a41a));_0x2493d2(_0x15a41a);})[_0x6f4b('0x13')](function(_0x1d58b4){logger[_0x6f4b('0xf')]('GetTemplate',_0x1d58b4[_0x6f4b('0x10')],_0xf82712);_0x3f1684(_0x2c47fc[_0x6f4b('0xf')](0x1f4,_0x1d58b4[_0x6f4b('0x10')]));});});}; \ No newline at end of file +var _0x41fa=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','GetTemplate','options','raw','where','attributes','limit','include','model','map'];(function(_0x380717,_0x251b00){var _0x453069=function(_0x50be09){while(--_0x50be09){_0x380717['push'](_0x380717['shift']());}};_0x453069(++_0x251b00);}(_0x41fa,0x1f1));var _0xa41f=function(_0x40eec9,_0x817a67){_0x40eec9=_0x40eec9-0x0;var _0xfee890=_0x41fa[_0x40eec9];return _0xfee890;};'use strict';var _=require(_0xa41f('0x0'));var util=require(_0xa41f('0x1'));var moment=require(_0xa41f('0x2'));var BPromise=require(_0xa41f('0x3'));var rs=require(_0xa41f('0x4'));var fs=require('fs');var Redis=require(_0xa41f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa41f('0x6'));var logger=require(_0xa41f('0x7'))(_0xa41f('0x8'));var config=require(_0xa41f('0x9'));var jayson=require(_0xa41f('0xa'));var client=jayson[_0xa41f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41db12,_0x61a82,_0xe34a11){return new BPromise(function(_0x5c9834,_0x24cc7d){return client[_0xa41f('0xc')](_0x41db12,_0xe34a11)[_0xa41f('0xd')](function(_0x4603cf){logger[_0xa41f('0xe')](_0xa41f('0xf'),_0x61a82,_0xa41f('0x10'));logger[_0xa41f('0x11')]('Template,\x20%s,\x20%s,\x20%s',_0x61a82,_0xa41f('0x10'),JSON[_0xa41f('0x12')](_0x4603cf));if(_0x4603cf[_0xa41f('0x13')]){if(_0x4603cf[_0xa41f('0x13')]['code']===0x1f4){logger[_0xa41f('0x13')](_0xa41f('0xf'),_0x61a82,_0x4603cf[_0xa41f('0x13')][_0xa41f('0x14')]);return _0x24cc7d(_0x4603cf[_0xa41f('0x13')]['message']);}logger[_0xa41f('0x13')](_0xa41f('0xf'),_0x61a82,_0x4603cf['error']['message']);return _0x5c9834(_0x4603cf[_0xa41f('0x13')]['message']);}else{logger['info'](_0xa41f('0xf'),_0x61a82,_0xa41f('0x10'));_0x5c9834(_0x4603cf['result'][_0xa41f('0x14')]);}})['catch'](function(_0x1c5e0d){logger[_0xa41f('0x13')](_0xa41f('0xf'),_0x61a82,_0x1c5e0d);_0x24cc7d(_0x1c5e0d);});});}exports[_0xa41f('0x15')]=function(_0x568d98){var _0x225d2e=this;return new Promise(function(_0x1d363b,_0xe57cee){return db['Template']['findAll']({'raw':_0x568d98[_0xa41f('0x16')]?_0x568d98[_0xa41f('0x16')][_0xa41f('0x17')]===undefined?!![]:![]:!![],'where':_0x568d98['options']?_0x568d98[_0xa41f('0x16')][_0xa41f('0x18')]||null:null,'attributes':_0x568d98[_0xa41f('0x16')]?_0x568d98[_0xa41f('0x16')][_0xa41f('0x19')]||null:null,'limit':_0x568d98[_0xa41f('0x16')]?_0x568d98['options'][_0xa41f('0x1a')]||null:null,'include':_0x568d98['options']?_0x568d98[_0xa41f('0x16')]['include']?_['map'](_0x568d98[_0xa41f('0x16')][_0xa41f('0x1b')],function(_0xe0302c){return{'model':db[_0xe0302c[_0xa41f('0x1c')]],'as':_0xe0302c['as'],'attributes':_0xe0302c[_0xa41f('0x19')],'include':_0xe0302c[_0xa41f('0x1b')]?_[_0xa41f('0x1d')](_0xe0302c[_0xa41f('0x1b')],function(_0xa65f5c){return{'model':db[_0xa65f5c['model']],'as':_0xa65f5c['as'],'attributes':_0xa65f5c[_0xa41f('0x19')],'include':_0xa65f5c['include']?_[_0xa41f('0x1d')](_0xa65f5c[_0xa41f('0x1b')],function(_0x4637cf){return{'model':db[_0x4637cf[_0xa41f('0x1c')]],'as':_0x4637cf['as'],'attributes':_0x4637cf['attributes']};}):[]};}):[]};}):[]:[]})[_0xa41f('0xd')](function(_0x391014){logger[_0xa41f('0xe')](_0xa41f('0x15'),_0x568d98);logger[_0xa41f('0x11')](_0xa41f('0x15'),_0x568d98,JSON[_0xa41f('0x12')](_0x391014));_0x1d363b(_0x391014);})[_0xa41f('0x1e')](function(_0x266059){logger['error'](_0xa41f('0x15'),_0x266059['message'],_0x568d98);_0xe57cee(_0x225d2e[_0xa41f('0x13')](0x1f4,_0x266059[_0xa41f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index f463d21..5748839 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 _0x8bc9=['fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','addAction','put','update','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x1db088,_0x2c7046){var _0x1bd9d8=function(_0x52f6f1){while(--_0x52f6f1){_0x1db088['push'](_0x1db088['shift']());}};_0x1bd9d8(++_0x2c7046);}(_0x8bc9,0x1bb));var _0x98bc=function(_0x3720f5,_0x5c8957){_0x3720f5=_0x3720f5-0x0;var _0x2bd688=_0x8bc9[_0x3720f5];return _0x2bd688;};'use strict';var multer=require(_0x98bc('0x0'));var util=require(_0x98bc('0x1'));var path=require(_0x98bc('0x2'));var timeout=require(_0x98bc('0x3'));var express=require('express');var router=express[_0x98bc('0x4')]();var fs_extra=require(_0x98bc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x98bc('0x6'));var config=require(_0x98bc('0x7'));var controller=require(_0x98bc('0x8'));router[_0x98bc('0x9')]('/',auth['isAuthenticated'](),controller[_0x98bc('0xa')]);router[_0x98bc('0x9')](_0x98bc('0xb'),auth[_0x98bc('0xc')](),controller['show']);router['get']('/:id/all_conditions',auth[_0x98bc('0xc')](),controller[_0x98bc('0xd')]);router['get'](_0x98bc('0xe'),auth[_0x98bc('0xc')](),controller[_0x98bc('0xf')]);router[_0x98bc('0x9')](_0x98bc('0x10'),auth[_0x98bc('0xc')](),controller[_0x98bc('0x11')]);router[_0x98bc('0x12')]('/',auth[_0x98bc('0xc')](),controller[_0x98bc('0x13')]);router[_0x98bc('0x12')](_0x98bc('0x14'),auth[_0x98bc('0xc')](),controller[_0x98bc('0x15')]);router[_0x98bc('0x12')](_0x98bc('0xe'),auth[_0x98bc('0xc')](),controller[_0x98bc('0x16')]);router[_0x98bc('0x12')](_0x98bc('0x10'),auth['isAuthenticated'](),controller[_0x98bc('0x17')]);router[_0x98bc('0x18')]('/:id',auth[_0x98bc('0xc')](),controller[_0x98bc('0x19')]);router['delete'](_0x98bc('0xb'),auth['isAuthenticated'](),controller[_0x98bc('0x1a')]);module[_0x98bc('0x1b')]=router; \ No newline at end of file +var _0x35ec=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','put','delete','exports','multer','path','connect-timeout'];(function(_0x430d85,_0x49ec18){var _0x8944e=function(_0x3f59c2){while(--_0x3f59c2){_0x430d85['push'](_0x430d85['shift']());}};_0x8944e(++_0x49ec18);}(_0x35ec,0xde));var _0xc35e=function(_0x315d42,_0x190e52){_0x315d42=_0x315d42-0x0;var _0x493cc4=_0x35ec[_0x315d42];return _0x493cc4;};'use strict';var multer=require(_0xc35e('0x0'));var util=require('util');var path=require(_0xc35e('0x1'));var timeout=require(_0xc35e('0x2'));var express=require(_0xc35e('0x3'));var router=express['Router']();var fs_extra=require(_0xc35e('0x4'));var auth=require(_0xc35e('0x5'));var interaction=require(_0xc35e('0x6'));var config=require(_0xc35e('0x7'));var controller=require(_0xc35e('0x8'));router[_0xc35e('0x9')]('/',auth[_0xc35e('0xa')](),controller['index']);router['get'](_0xc35e('0xb'),auth[_0xc35e('0xa')](),controller[_0xc35e('0xc')]);router[_0xc35e('0x9')](_0xc35e('0xd'),auth[_0xc35e('0xa')](),controller['getAllConditions']);router[_0xc35e('0x9')]('/:id/any_conditions',auth[_0xc35e('0xa')](),controller['getAnyConditions']);router[_0xc35e('0x9')]('/:id/actions',auth[_0xc35e('0xa')](),controller[_0xc35e('0xe')]);router[_0xc35e('0xf')]('/',auth[_0xc35e('0xa')](),controller[_0xc35e('0x10')]);router[_0xc35e('0xf')](_0xc35e('0xd'),auth[_0xc35e('0xa')](),controller[_0xc35e('0x11')]);router['post'](_0xc35e('0x12'),auth[_0xc35e('0xa')](),controller[_0xc35e('0x13')]);router[_0xc35e('0xf')](_0xc35e('0x14'),auth[_0xc35e('0xa')](),controller[_0xc35e('0x15')]);router[_0xc35e('0x16')](_0xc35e('0xb'),auth[_0xc35e('0xa')](),controller['update']);router[_0xc35e('0x17')](_0xc35e('0xb'),auth[_0xc35e('0xa')](),controller['destroy']);module[_0xc35e('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 7277e46..0483d68 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 _0x8d19=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4eb889,_0x13b842){var _0x3f2955=function(_0x98bed8){while(--_0x98bed8){_0x4eb889['push'](_0x4eb889['shift']());}};_0x3f2955(++_0x13b842);}(_0x8d19,0x142));var _0x98d1=function(_0x2118ad,_0xe8e3fd){_0x2118ad=_0x2118ad-0x0;var _0x4b5715=_0x8d19[_0x2118ad];return _0x4b5715;};'use strict';var Sequelize=require(_0x98d1('0x0'));module[_0x98d1('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x98d1('0x2')]},'description':{'type':Sequelize[_0x98d1('0x2')]},'status':{'type':Sequelize[_0x98d1('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xbc07=['exports','STRING','BOOLEAN','sequelize'];(function(_0x514f77,_0x541151){var _0x3fe196=function(_0x3772aa){while(--_0x3772aa){_0x514f77['push'](_0x514f77['shift']());}};_0x3fe196(++_0x541151);}(_0xbc07,0xa3));var _0x7bc0=function(_0x59e0a6,_0x48b55c){_0x59e0a6=_0x59e0a6-0x0;var _0xd6efff=_0xbc07[_0x59e0a6];return _0xd6efff;};'use strict';var Sequelize=require(_0x7bc0('0x0'));module[_0x7bc0('0x1')]={'name':{'type':Sequelize[_0x7bc0('0x2')]},'channel':{'type':Sequelize[_0x7bc0('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x7bc0('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 3a3d773..5035358 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 _0x5470=['TriggerAnyId','getAllConditions','length','nolimit','getAnyConditions','findOne','addAction','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','sendStatus','error','name','send','map','Trigger','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','params'];(function(_0x1409c8,_0x2e7f4b){var _0x33f6de=function(_0x3aa586){while(--_0x3aa586){_0x1409c8['push'](_0x1409c8['shift']());}};_0x33f6de(++_0x2e7f4b);}(_0x5470,0x68));var _0x0547=function(_0x165e93,_0x472309){_0x165e93=_0x165e93-0x0;var _0x479df6=_0x5470[_0x165e93];return _0x479df6;};'use strict';var emlformat=require(_0x0547('0x0'));var rimraf=require(_0x0547('0x1'));var zipdir=require(_0x0547('0x2'));var jsonpatch=require(_0x0547('0x3'));var rp=require(_0x0547('0x4'));var moment=require(_0x0547('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0547('0x6'));var path=require(_0x0547('0x7'));var sox=require(_0x0547('0x8'));var csv=require('to-csv');var ejs=require(_0x0547('0x9'));var fs=require('fs');var fs_extra=require(_0x0547('0xa'));var _=require('lodash');var squel=require(_0x0547('0xb'));var crypto=require(_0x0547('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0547('0xd'));var querystring=require(_0x0547('0xe'));var Papa=require(_0x0547('0xf'));var Redis=require(_0x0547('0x10'));var authService=require(_0x0547('0x11'));var qs=require(_0x0547('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0547('0x13'));var logger=require(_0x0547('0x14'))(_0x0547('0x15'));var utils=require(_0x0547('0x16'));var config=require(_0x0547('0x17'));var licenseUtil=require(_0x0547('0x18'));var db=require(_0x0547('0x19'))['db'];function respondWithStatusCode(_0x284a46,_0x15495f){_0x15495f=_0x15495f||0xcc;return function(_0x45140b){if(_0x45140b){return _0x284a46['sendStatus'](_0x15495f);}return _0x284a46['status'](_0x15495f)[_0x0547('0x1a')]();};}function respondWithResult(_0x287b5e,_0x27e3fd){_0x27e3fd=_0x27e3fd||0xc8;return function(_0x641168){if(_0x641168){return _0x287b5e[_0x0547('0x1b')](_0x27e3fd)['json'](_0x641168);}};}function respondWithFilteredResult(_0x34d8d3,_0x34be84){return function(_0x2f6c24){if(_0x2f6c24){var _0x559f85=typeof _0x34be84[_0x0547('0x1c')]==='undefined'&&typeof _0x34be84[_0x0547('0x1d')]===_0x0547('0x1e');var _0xcdebdd=_0x2f6c24[_0x0547('0x1f')];var _0x21e38c=_0x559f85?0x0:_0x34be84[_0x0547('0x1c')];var _0x36b9de=_0x559f85?_0x2f6c24['count']:_0x34be84[_0x0547('0x1c')]+_0x34be84[_0x0547('0x1d')];var _0x3ba8f0;if(_0x36b9de>=_0xcdebdd){_0x36b9de=_0xcdebdd;_0x3ba8f0=0xc8;}else{_0x3ba8f0=0xce;}_0x34d8d3[_0x0547('0x1b')](_0x3ba8f0);return _0x34d8d3['set'](_0x0547('0x20'),_0x21e38c+'-'+_0x36b9de+'/'+_0xcdebdd)['json'](_0x2f6c24);}return null;};}function patchUpdates(_0x13b639){return function(_0xe5f02b){try{jsonpatch[_0x0547('0x21')](_0xe5f02b,_0x13b639,!![]);}catch(_0x2ce4fa){return BPromise[_0x0547('0x22')](_0x2ce4fa);}return _0xe5f02b[_0x0547('0x23')]();};}function saveUpdates(_0x544070,_0x55f5d8){return function(_0xa90659){if(_0xa90659){return _0xa90659[_0x0547('0x24')](_0x544070)[_0x0547('0x25')](function(_0x12f6b2){return _0x12f6b2;});}return null;};}function removeEntity(_0x12afca,_0x143913){return function(_0x39b941){if(_0x39b941){return _0x39b941[_0x0547('0x26')]()[_0x0547('0x25')](function(){var _0x4d2bad=_0x39b941[_0x0547('0x27')]({'plain':!![]});var _0x330172=_0x0547('0x28');return db[_0x0547('0x29')]['destroy']({'where':{'type':_0x330172,'resourceId':_0x4d2bad['id']}})[_0x0547('0x25')](function(){return _0x39b941;});})['then'](function(){_0x12afca[_0x0547('0x1b')](0xcc)[_0x0547('0x1a')]();});}};}function handleEntityNotFound(_0x515144,_0x5a8248){return function(_0x5e8783){if(!_0x5e8783){_0x515144[_0x0547('0x2a')](0x194);}return _0x5e8783;};}function handleError(_0x1dd877,_0x482e7f){_0x482e7f=_0x482e7f||0x1f4;return function(_0x117a42){logger[_0x0547('0x2b')](_0x117a42['stack']);if(_0x117a42['name']){delete _0x117a42[_0x0547('0x2c')];}_0x1dd877[_0x0547('0x1b')](_0x482e7f)[_0x0547('0x2d')](_0x117a42);};}exports['index']=function(_0x5430f2,_0xa539b9){var _0x41b3b8={},_0x29c93e={},_0x270bcd={'count':0x0,'rows':[]};var _0x1a999c=_[_0x0547('0x2e')](db[_0x0547('0x2f')]['rawAttributes'],function(_0x3d5663){return{'name':_0x3d5663['fieldName'],'type':_0x3d5663[_0x0547('0x30')]['key']};});_0x29c93e['model']=_['map'](_0x1a999c,_0x0547('0x2c'));_0x29c93e[_0x0547('0x31')]=_[_0x0547('0x32')](_0x5430f2['query']);_0x29c93e[_0x0547('0x33')]=_[_0x0547('0x34')](_0x29c93e[_0x0547('0x35')],_0x29c93e[_0x0547('0x31')]);_0x41b3b8[_0x0547('0x36')]=_['intersection'](_0x29c93e[_0x0547('0x35')],qs[_0x0547('0x37')](_0x5430f2['query'][_0x0547('0x37')]));_0x41b3b8[_0x0547('0x36')]=_0x41b3b8[_0x0547('0x36')]['length']?_0x41b3b8[_0x0547('0x36')]:_0x29c93e[_0x0547('0x35')];if(!_0x5430f2[_0x0547('0x31')][_0x0547('0x38')]('nolimit')){_0x41b3b8['limit']=qs[_0x0547('0x1d')](_0x5430f2['query']['limit']);_0x41b3b8['offset']=qs['offset'](_0x5430f2[_0x0547('0x31')][_0x0547('0x1c')]);}_0x41b3b8[_0x0547('0x39')]=qs['sort'](_0x5430f2['query'][_0x0547('0x3a')]);_0x41b3b8[_0x0547('0x3b')]=qs[_0x0547('0x33')](_[_0x0547('0x3c')](_0x5430f2[_0x0547('0x31')],_0x29c93e[_0x0547('0x33')]),_0x1a999c);if(_0x5430f2['query'][_0x0547('0x3d')]){_0x41b3b8[_0x0547('0x3b')]=_['merge'](_0x41b3b8[_0x0547('0x3b')],{'$or':_[_0x0547('0x2e')](_0x1a999c,function(_0x205f57){if(_0x205f57[_0x0547('0x30')]!==_0x0547('0x3e')){var _0x4231ac={};_0x4231ac[_0x205f57['name']]={'$like':'%'+_0x5430f2['query'][_0x0547('0x3d')]+'%'};return _0x4231ac;}})});}_0x41b3b8=_[_0x0547('0x3f')]({},_0x41b3b8,_0x5430f2[_0x0547('0x40')]);var _0x4e9503={'where':_0x41b3b8[_0x0547('0x3b')]};return db['Trigger'][_0x0547('0x1f')](_0x4e9503)['then'](function(_0x5ac701){_0x270bcd['count']=_0x5ac701;if(_0x5430f2[_0x0547('0x31')]['includeAll']){_0x41b3b8['include']=[{'all':!![]}];}return db[_0x0547('0x2f')][_0x0547('0x41')](_0x41b3b8);})['then'](function(_0x21e4b0){_0x270bcd[_0x0547('0x42')]=_0x21e4b0;return _0x270bcd;})[_0x0547('0x25')](respondWithFilteredResult(_0xa539b9,_0x41b3b8))[_0x0547('0x43')](handleError(_0xa539b9,null));};exports[_0x0547('0x44')]=function(_0x5ece0a,_0x41eaed){var _0x36f0fa={'raw':![],'where':{'id':_0x5ece0a['params']['id']}},_0x3af3ac={};_0x3af3ac[_0x0547('0x35')]=_['keys'](db[_0x0547('0x2f')][_0x0547('0x45')]);_0x3af3ac[_0x0547('0x31')]=_[_0x0547('0x32')](_0x5ece0a['query']);_0x3af3ac['filters']=_[_0x0547('0x34')](_0x3af3ac[_0x0547('0x35')],_0x3af3ac[_0x0547('0x31')]);_0x36f0fa[_0x0547('0x36')]=_[_0x0547('0x34')](_0x3af3ac[_0x0547('0x35')],qs[_0x0547('0x37')](_0x5ece0a[_0x0547('0x31')]['fields']));_0x36f0fa[_0x0547('0x36')]=_0x36f0fa[_0x0547('0x36')]['length']?_0x36f0fa[_0x0547('0x36')]:_0x3af3ac['model'];if(_0x5ece0a[_0x0547('0x31')]['includeAll']){_0x36f0fa[_0x0547('0x46')]=[{'all':!![]}];}_0x36f0fa=_[_0x0547('0x3f')]({},_0x36f0fa,_0x5ece0a[_0x0547('0x40')]);return db[_0x0547('0x2f')][_0x0547('0x47')](_0x36f0fa)['then'](handleEntityNotFound(_0x41eaed,null))[_0x0547('0x25')](respondWithResult(_0x41eaed,null))[_0x0547('0x43')](handleError(_0x41eaed,null));};exports[_0x0547('0x48')]=function(_0x557e90,_0x553c2d){return db[_0x0547('0x2f')][_0x0547('0x48')](_0x557e90[_0x0547('0x49')],{})[_0x0547('0x25')](function(_0x5bde69){var _0x427031=_0x557e90[_0x0547('0x4a')][_0x0547('0x27')]({'plain':!![]});if(!_0x427031)throw new Error(_0x0547('0x4b'));if(_0x427031[_0x0547('0x4c')]==='user'){var _0x44db53=_0x5bde69[_0x0547('0x27')]({'plain':!![]});var _0x510a7e=_0x0547('0x28');return db[_0x0547('0x4d')][_0x0547('0x47')]({'where':{'name':_0x510a7e,'userProfileId':_0x427031[_0x0547('0x4e')]},'raw':!![]})[_0x0547('0x25')](function(_0x49f69d){if(_0x49f69d&&_0x49f69d[_0x0547('0x4f')]===0x0){return db[_0x0547('0x29')][_0x0547('0x48')]({'name':_0x44db53[_0x0547('0x2c')],'resourceId':_0x44db53['id'],'type':_0x49f69d['name'],'sectionId':_0x49f69d['id']},{})[_0x0547('0x25')](function(){return _0x5bde69;});}else{return _0x5bde69;}})[_0x0547('0x43')](function(_0x2b33b0){logger[_0x0547('0x2b')](_0x0547('0x50'),_0x2b33b0);throw _0x2b33b0;});}return _0x5bde69;})[_0x0547('0x25')](respondWithResult(_0x553c2d,0xc9))['catch'](handleError(_0x553c2d,null));};exports[_0x0547('0x24')]=function(_0xe36536,_0x12e392){if(_0xe36536[_0x0547('0x49')]['id']){delete _0xe36536[_0x0547('0x49')]['id'];}return db[_0x0547('0x2f')]['find']({'where':{'id':_0xe36536['params']['id']}})['then'](handleEntityNotFound(_0x12e392,null))[_0x0547('0x25')](saveUpdates(_0xe36536[_0x0547('0x49')],null))[_0x0547('0x25')](respondWithResult(_0x12e392,null))[_0x0547('0x43')](handleError(_0x12e392,null));};exports[_0x0547('0x26')]=function(_0x3f24e7,_0x3697c5){return db[_0x0547('0x2f')]['find']({'where':{'id':_0x3f24e7['params']['id']}})[_0x0547('0x25')](handleEntityNotFound(_0x3697c5,null))[_0x0547('0x25')](removeEntity(_0x3697c5,null))[_0x0547('0x43')](handleError(_0x3697c5,null));};exports[_0x0547('0x51')]=function(_0x30eb1b,_0x3b212a,_0x4384f4){if(_0x30eb1b[_0x0547('0x49')]['id']){delete _0x30eb1b[_0x0547('0x49')]['id'];}return db[_0x0547('0x2f')][_0x0547('0x47')]({'where':{'id':_0x30eb1b['params']['id']}})[_0x0547('0x25')](handleEntityNotFound(_0x3b212a,null))[_0x0547('0x25')](function(_0x365ee3){if(_0x365ee3){_0x30eb1b[_0x0547('0x49')][_0x0547('0x52')]=_0x365ee3['id'];return db[_0x0547('0x53')][_0x0547('0x48')](_0x30eb1b['body']);}})[_0x0547('0x25')](respondWithResult(_0x3b212a,null))['catch'](handleError(_0x3b212a,null));};exports[_0x0547('0x54')]=function(_0xe4d33,_0x2cb8f2,_0xd9d69a){if(_0xe4d33[_0x0547('0x49')]['id']){delete _0xe4d33[_0x0547('0x49')]['id'];}return db[_0x0547('0x2f')][_0x0547('0x47')]({'where':{'id':_0xe4d33[_0x0547('0x55')]['id']}})[_0x0547('0x25')](handleEntityNotFound(_0x2cb8f2,null))['then'](function(_0x93cbe6){if(_0x93cbe6){_0xe4d33[_0x0547('0x49')][_0x0547('0x56')]=_0x93cbe6['id'];return db['Condition'][_0x0547('0x48')](_0xe4d33[_0x0547('0x49')]);}})[_0x0547('0x25')](respondWithResult(_0x2cb8f2,null))[_0x0547('0x43')](handleError(_0x2cb8f2,null));};exports[_0x0547('0x57')]=function(_0x30ee0f,_0x17cd3a,_0x1f5b67){var _0x487920={};var _0x1587ab={};var _0x92d0f0;var _0xf74840;return db['Trigger']['findOne']({'where':{'id':_0x30ee0f[_0x0547('0x55')]['id']}})[_0x0547('0x25')](handleEntityNotFound(_0x17cd3a,null))[_0x0547('0x25')](function(_0x13af50){if(_0x13af50){_0x92d0f0=_0x13af50;_0x1587ab[_0x0547('0x35')]=_[_0x0547('0x32')](db[_0x0547('0x53')][_0x0547('0x45')]);_0x1587ab[_0x0547('0x31')]=_[_0x0547('0x32')](_0x30ee0f[_0x0547('0x31')]);_0x1587ab[_0x0547('0x33')]=_['intersection'](_0x1587ab[_0x0547('0x35')],_0x1587ab[_0x0547('0x31')]);_0x487920['attributes']=_['intersection'](_0x1587ab[_0x0547('0x35')],qs[_0x0547('0x37')](_0x30ee0f[_0x0547('0x31')][_0x0547('0x37')]));_0x487920[_0x0547('0x36')]=_0x487920['attributes'][_0x0547('0x58')]?_0x487920['attributes']:_0x1587ab['model'];_0x487920[_0x0547('0x39')]=qs['sort'](_0x30ee0f[_0x0547('0x31')][_0x0547('0x3a')]);_0x487920[_0x0547('0x3b')]=qs[_0x0547('0x33')](_[_0x0547('0x3c')](_0x30ee0f[_0x0547('0x31')],_0x1587ab[_0x0547('0x33')]));if(_0x30ee0f['query'][_0x0547('0x3d')]){_0x487920[_0x0547('0x3b')]=_[_0x0547('0x3f')](_0x487920[_0x0547('0x3b')],{'$or':_[_0x0547('0x2e')](_0x487920[_0x0547('0x36')],function(_0x346ddc){var _0x39d048={};_0x39d048[_0x346ddc]={'$like':'%'+_0x30ee0f['query'][_0x0547('0x3d')]+'%'};return _0x39d048;})});}_0x487920=_[_0x0547('0x3f')]({},_0x487920,_0x30ee0f[_0x0547('0x40')]);return _0x92d0f0[_0x0547('0x57')](_0x487920);}})[_0x0547('0x25')](function(_0x41f293){if(_0x41f293){_0xf74840=_0x41f293[_0x0547('0x58')];if(!_0x30ee0f[_0x0547('0x31')][_0x0547('0x38')](_0x0547('0x59'))){_0x487920[_0x0547('0x1d')]=qs[_0x0547('0x1d')](_0x30ee0f[_0x0547('0x31')][_0x0547('0x1d')]);_0x487920[_0x0547('0x1c')]=qs[_0x0547('0x1c')](_0x30ee0f[_0x0547('0x31')][_0x0547('0x1c')]);}return _0x92d0f0['getAllConditions'](_0x487920);}})[_0x0547('0x25')](function(_0x4b1435){if(_0x4b1435){return _0x4b1435?{'count':_0xf74840,'rows':_0x4b1435}:null;}})[_0x0547('0x25')](respondWithResult(_0x17cd3a,null))[_0x0547('0x43')](handleError(_0x17cd3a,null));};exports[_0x0547('0x5a')]=function(_0x46dd5e,_0x1586d1,_0x156ba9){var _0xf1d98b={};var _0x55a9b4={};var _0x2cb911;var _0x4c66cd;return db[_0x0547('0x2f')][_0x0547('0x5b')]({'where':{'id':_0x46dd5e[_0x0547('0x55')]['id']}})['then'](handleEntityNotFound(_0x1586d1,null))['then'](function(_0x2b3cc4){if(_0x2b3cc4){_0x2cb911=_0x2b3cc4;_0x55a9b4['model']=_[_0x0547('0x32')](db[_0x0547('0x53')][_0x0547('0x45')]);_0x55a9b4[_0x0547('0x31')]=_[_0x0547('0x32')](_0x46dd5e[_0x0547('0x31')]);_0x55a9b4[_0x0547('0x33')]=_['intersection'](_0x55a9b4[_0x0547('0x35')],_0x55a9b4[_0x0547('0x31')]);_0xf1d98b['attributes']=_['intersection'](_0x55a9b4[_0x0547('0x35')],qs['fields'](_0x46dd5e[_0x0547('0x31')][_0x0547('0x37')]));_0xf1d98b[_0x0547('0x36')]=_0xf1d98b[_0x0547('0x36')][_0x0547('0x58')]?_0xf1d98b[_0x0547('0x36')]:_0x55a9b4[_0x0547('0x35')];_0xf1d98b['order']=qs['sort'](_0x46dd5e[_0x0547('0x31')][_0x0547('0x3a')]);_0xf1d98b['where']=qs[_0x0547('0x33')](_[_0x0547('0x3c')](_0x46dd5e[_0x0547('0x31')],_0x55a9b4[_0x0547('0x33')]));if(_0x46dd5e[_0x0547('0x31')]['filter']){_0xf1d98b[_0x0547('0x3b')]=_[_0x0547('0x3f')](_0xf1d98b[_0x0547('0x3b')],{'$or':_['map'](_0xf1d98b[_0x0547('0x36')],function(_0x5bcabc){var _0x14f481={};_0x14f481[_0x5bcabc]={'$like':'%'+_0x46dd5e['query']['filter']+'%'};return _0x14f481;})});}_0xf1d98b=_[_0x0547('0x3f')]({},_0xf1d98b,_0x46dd5e[_0x0547('0x40')]);return _0x2cb911[_0x0547('0x5a')](_0xf1d98b);}})[_0x0547('0x25')](function(_0x39217d){if(_0x39217d){_0x4c66cd=_0x39217d['length'];if(!_0x46dd5e[_0x0547('0x31')][_0x0547('0x38')](_0x0547('0x59'))){_0xf1d98b[_0x0547('0x1d')]=qs[_0x0547('0x1d')](_0x46dd5e[_0x0547('0x31')][_0x0547('0x1d')]);_0xf1d98b['offset']=qs[_0x0547('0x1c')](_0x46dd5e['query']['offset']);}return _0x2cb911[_0x0547('0x5a')](_0xf1d98b);}})['then'](function(_0x25ffb5){if(_0x25ffb5){return _0x25ffb5?{'count':_0x4c66cd,'rows':_0x25ffb5}:null;}})[_0x0547('0x25')](respondWithResult(_0x1586d1,null))[_0x0547('0x43')](handleError(_0x1586d1,null));};exports[_0x0547('0x5c')]=function(_0x501361,_0x218c8e,_0x508b72){if(_0x501361[_0x0547('0x49')]['id']){delete _0x501361[_0x0547('0x49')]['id'];}return db[_0x0547('0x2f')][_0x0547('0x47')]({'where':{'id':_0x501361['params']['id']}})[_0x0547('0x25')](handleEntityNotFound(_0x218c8e,null))[_0x0547('0x25')](function(_0x10ee3e){if(_0x10ee3e){_0x501361[_0x0547('0x49')]['TriggerId']=_0x10ee3e['id'];return db['Action'][_0x0547('0x48')](_0x501361[_0x0547('0x49')]);}})[_0x0547('0x25')](respondWithResult(_0x218c8e,null))[_0x0547('0x43')](handleError(_0x218c8e,null));};exports[_0x0547('0x5d')]=function(_0x537a0c,_0x39df70,_0x4f3507){var _0x1b8e13={};var _0x43f4ab={};var _0x2d9735;var _0x2119d4;return db['Trigger'][_0x0547('0x5b')]({'where':{'id':_0x537a0c[_0x0547('0x55')]['id']}})[_0x0547('0x25')](handleEntityNotFound(_0x39df70,null))[_0x0547('0x25')](function(_0x45bb95){if(_0x45bb95){_0x2d9735=_0x45bb95;_0x43f4ab[_0x0547('0x35')]=_[_0x0547('0x32')](db[_0x0547('0x5e')][_0x0547('0x45')]);_0x43f4ab['query']=_[_0x0547('0x32')](_0x537a0c[_0x0547('0x31')]);_0x43f4ab[_0x0547('0x33')]=_[_0x0547('0x34')](_0x43f4ab[_0x0547('0x35')],_0x43f4ab['query']);_0x1b8e13[_0x0547('0x36')]=_['intersection'](_0x43f4ab[_0x0547('0x35')],qs[_0x0547('0x37')](_0x537a0c[_0x0547('0x31')][_0x0547('0x37')]));_0x1b8e13[_0x0547('0x36')]=_0x1b8e13[_0x0547('0x36')][_0x0547('0x58')]?_0x1b8e13[_0x0547('0x36')]:_0x43f4ab[_0x0547('0x35')];_0x1b8e13['order']=qs[_0x0547('0x3a')](_0x537a0c[_0x0547('0x31')]['sort']);_0x1b8e13[_0x0547('0x3b')]=qs[_0x0547('0x33')](_[_0x0547('0x3c')](_0x537a0c[_0x0547('0x31')],_0x43f4ab[_0x0547('0x33')]));if(_0x537a0c[_0x0547('0x31')][_0x0547('0x3d')]){_0x1b8e13[_0x0547('0x3b')]=_[_0x0547('0x3f')](_0x1b8e13[_0x0547('0x3b')],{'$or':_['map'](_0x1b8e13['attributes'],function(_0x370497){var _0x48b39e={};_0x48b39e[_0x370497]={'$like':'%'+_0x537a0c[_0x0547('0x31')][_0x0547('0x3d')]+'%'};return _0x48b39e;})});}_0x1b8e13=_[_0x0547('0x3f')]({},_0x1b8e13,_0x537a0c[_0x0547('0x40')]);return _0x2d9735[_0x0547('0x5d')](_0x1b8e13);}})[_0x0547('0x25')](function(_0x3eecf7){if(_0x3eecf7){_0x2119d4=_0x3eecf7[_0x0547('0x58')];if(!_0x537a0c[_0x0547('0x31')][_0x0547('0x38')](_0x0547('0x59'))){_0x1b8e13[_0x0547('0x1d')]=qs[_0x0547('0x1d')](_0x537a0c[_0x0547('0x31')][_0x0547('0x1d')]);_0x1b8e13['offset']=qs['offset'](_0x537a0c[_0x0547('0x31')][_0x0547('0x1c')]);}return _0x2d9735['getActions'](_0x1b8e13);}})[_0x0547('0x25')](function(_0x245f7c){if(_0x245f7c){return _0x245f7c?{'count':_0x2119d4,'rows':_0x245f7c}:null;}})['then'](respondWithResult(_0x39df70,null))['catch'](handleError(_0x39df70,null));}; \ No newline at end of file +var _0x753a=['../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','then','get','end','error','stack','name','send','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','Trigger','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Triggers','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','getAllConditions','nolimit','getAnyConditions','addAction','TriggerId','getActions','Action','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4916e1,_0x3e8120){var _0x1a08a9=function(_0x597ca7){while(--_0x597ca7){_0x4916e1['push'](_0x4916e1['shift']());}};_0x1a08a9(++_0x3e8120);}(_0x753a,0x1b7));var _0xa753=function(_0x542724,_0x2a58f0){_0x542724=_0x542724-0x0;var _0x430e85=_0x753a[_0x542724];return _0x430e85;};'use strict';var emlformat=require(_0xa753('0x0'));var rimraf=require(_0xa753('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa753('0x2'));var rp=require(_0xa753('0x3'));var moment=require(_0xa753('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa753('0x5'));var util=require(_0xa753('0x6'));var path=require(_0xa753('0x7'));var sox=require(_0xa753('0x8'));var csv=require(_0xa753('0x9'));var ejs=require(_0xa753('0xa'));var fs=require('fs');var fs_extra=require(_0xa753('0xb'));var _=require('lodash');var squel=require(_0xa753('0xc'));var crypto=require(_0xa753('0xd'));var jsforce=require(_0xa753('0xe'));var deskjs=require(_0xa753('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa753('0x10'));var Redis=require(_0xa753('0x11'));var authService=require(_0xa753('0x12'));var qs=require(_0xa753('0x13'));var as=require(_0xa753('0x14'));var hardwareService=require(_0xa753('0x15'));var logger=require(_0xa753('0x16'))(_0xa753('0x17'));var utils=require(_0xa753('0x18'));var config=require(_0xa753('0x19'));var licenseUtil=require(_0xa753('0x1a'));var db=require(_0xa753('0x1b'))['db'];function respondWithStatusCode(_0x255f91,_0x971b86){_0x971b86=_0x971b86||0xcc;return function(_0x5ae7c9){if(_0x5ae7c9){return _0x255f91['sendStatus'](_0x971b86);}return _0x255f91[_0xa753('0x1c')](_0x971b86)['end']();};}function respondWithResult(_0x22af03,_0x472f93){_0x472f93=_0x472f93||0xc8;return function(_0x193aaa){if(_0x193aaa){return _0x22af03['status'](_0x472f93)['json'](_0x193aaa);}};}function respondWithFilteredResult(_0x5e439b,_0x5fa645){return function(_0x458a38){if(_0x458a38){var _0xb8889=typeof _0x5fa645['offset']===_0xa753('0x1d')&&typeof _0x5fa645[_0xa753('0x1e')]===_0xa753('0x1d');var _0xdf666e=_0x458a38['count'];var _0xcf393=_0xb8889?0x0:_0x5fa645['offset'];var _0x25802b=_0xb8889?_0x458a38[_0xa753('0x1f')]:_0x5fa645[_0xa753('0x20')]+_0x5fa645[_0xa753('0x1e')];var _0x544f52;if(_0x25802b>=_0xdf666e){_0x25802b=_0xdf666e;_0x544f52=0xc8;}else{_0x544f52=0xce;}_0x5e439b['status'](_0x544f52);return _0x5e439b[_0xa753('0x21')](_0xa753('0x22'),_0xcf393+'-'+_0x25802b+'/'+_0xdf666e)[_0xa753('0x23')](_0x458a38);}return null;};}function patchUpdates(_0xdd6a27){return function(_0x54ed93){try{jsonpatch[_0xa753('0x24')](_0x54ed93,_0xdd6a27,!![]);}catch(_0x5170a2){return BPromise['reject'](_0x5170a2);}return _0x54ed93[_0xa753('0x25')]();};}function saveUpdates(_0xb46245,_0x37b845){return function(_0x5ddea2){if(_0x5ddea2){return _0x5ddea2[_0xa753('0x26')](_0xb46245)['then'](function(_0x4a3fd7){return _0x4a3fd7;});}return null;};}function removeEntity(_0x211179,_0x50efa6){return function(_0x266872){if(_0x266872){return _0x266872[_0xa753('0x27')]()[_0xa753('0x28')](function(){var _0x72c8fc=_0x266872[_0xa753('0x29')]({'plain':!![]});var _0x7711f4='Triggers';return db['UserProfileResource']['destroy']({'where':{'type':_0x7711f4,'resourceId':_0x72c8fc['id']}})[_0xa753('0x28')](function(){return _0x266872;});})[_0xa753('0x28')](function(){_0x211179[_0xa753('0x1c')](0xcc)[_0xa753('0x2a')]();});}};}function handleEntityNotFound(_0x3ba435,_0x504b45){return function(_0x498cc8){if(!_0x498cc8){_0x3ba435['sendStatus'](0x194);}return _0x498cc8;};}function handleError(_0x460ee6,_0x2b2e80){_0x2b2e80=_0x2b2e80||0x1f4;return function(_0x30398e){logger[_0xa753('0x2b')](_0x30398e[_0xa753('0x2c')]);if(_0x30398e['name']){delete _0x30398e[_0xa753('0x2d')];}_0x460ee6[_0xa753('0x1c')](_0x2b2e80)[_0xa753('0x2e')](_0x30398e);};}exports['index']=function(_0x827231,_0x5ac9af){var _0x1ea881={},_0x2fa2e8={},_0x4168e1={'count':0x0,'rows':[]};var _0x27c785=_[_0xa753('0x2f')](db['Trigger'][_0xa753('0x30')],function(_0x4fbec1){return{'name':_0x4fbec1['fieldName'],'type':_0x4fbec1[_0xa753('0x31')]['key']};});_0x2fa2e8[_0xa753('0x32')]=_[_0xa753('0x2f')](_0x27c785,'name');_0x2fa2e8[_0xa753('0x33')]=_['keys'](_0x827231[_0xa753('0x33')]);_0x2fa2e8[_0xa753('0x34')]=_[_0xa753('0x35')](_0x2fa2e8['model'],_0x2fa2e8[_0xa753('0x33')]);_0x1ea881[_0xa753('0x36')]=_[_0xa753('0x35')](_0x2fa2e8['model'],qs['fields'](_0x827231['query'][_0xa753('0x37')]));_0x1ea881[_0xa753('0x36')]=_0x1ea881[_0xa753('0x36')][_0xa753('0x38')]?_0x1ea881[_0xa753('0x36')]:_0x2fa2e8['model'];if(!_0x827231[_0xa753('0x33')][_0xa753('0x39')]('nolimit')){_0x1ea881[_0xa753('0x1e')]=qs['limit'](_0x827231[_0xa753('0x33')][_0xa753('0x1e')]);_0x1ea881[_0xa753('0x20')]=qs[_0xa753('0x20')](_0x827231[_0xa753('0x33')][_0xa753('0x20')]);}_0x1ea881[_0xa753('0x3a')]=qs[_0xa753('0x3b')](_0x827231['query'][_0xa753('0x3b')]);_0x1ea881['where']=qs[_0xa753('0x34')](_[_0xa753('0x3c')](_0x827231[_0xa753('0x33')],_0x2fa2e8[_0xa753('0x34')]),_0x27c785);if(_0x827231[_0xa753('0x33')][_0xa753('0x3d')]){_0x1ea881[_0xa753('0x3e')]=_['merge'](_0x1ea881[_0xa753('0x3e')],{'$or':_[_0xa753('0x2f')](_0x27c785,function(_0x4ae4c1){if(_0x4ae4c1[_0xa753('0x31')]!==_0xa753('0x3f')){var _0x112d96={};_0x112d96[_0x4ae4c1['name']]={'$like':'%'+_0x827231[_0xa753('0x33')][_0xa753('0x3d')]+'%'};return _0x112d96;}})});}_0x1ea881=_[_0xa753('0x40')]({},_0x1ea881,_0x827231[_0xa753('0x41')]);var _0x5ab189={'where':_0x1ea881['where']};return db[_0xa753('0x42')][_0xa753('0x1f')](_0x5ab189)[_0xa753('0x28')](function(_0x3be941){_0x4168e1[_0xa753('0x1f')]=_0x3be941;if(_0x827231[_0xa753('0x33')][_0xa753('0x43')]){_0x1ea881[_0xa753('0x44')]=[{'all':!![]}];}return db['Trigger'][_0xa753('0x45')](_0x1ea881);})['then'](function(_0x1aafb7){_0x4168e1[_0xa753('0x46')]=_0x1aafb7;return _0x4168e1;})['then'](respondWithFilteredResult(_0x5ac9af,_0x1ea881))[_0xa753('0x47')](handleError(_0x5ac9af,null));};exports[_0xa753('0x48')]=function(_0x1dd2a3,_0x2731de){var _0x4ba64e={'raw':![],'where':{'id':_0x1dd2a3[_0xa753('0x49')]['id']}},_0x1cb2d2={};_0x1cb2d2[_0xa753('0x32')]=_['keys'](db[_0xa753('0x42')][_0xa753('0x30')]);_0x1cb2d2['query']=_[_0xa753('0x4a')](_0x1dd2a3['query']);_0x1cb2d2[_0xa753('0x34')]=_[_0xa753('0x35')](_0x1cb2d2[_0xa753('0x32')],_0x1cb2d2[_0xa753('0x33')]);_0x4ba64e[_0xa753('0x36')]=_[_0xa753('0x35')](_0x1cb2d2[_0xa753('0x32')],qs[_0xa753('0x37')](_0x1dd2a3[_0xa753('0x33')]['fields']));_0x4ba64e['attributes']=_0x4ba64e[_0xa753('0x36')]['length']?_0x4ba64e[_0xa753('0x36')]:_0x1cb2d2[_0xa753('0x32')];if(_0x1dd2a3['query']['includeAll']){_0x4ba64e[_0xa753('0x44')]=[{'all':!![]}];}_0x4ba64e=_[_0xa753('0x40')]({},_0x4ba64e,_0x1dd2a3[_0xa753('0x41')]);return db['Trigger'][_0xa753('0x4b')](_0x4ba64e)[_0xa753('0x28')](handleEntityNotFound(_0x2731de,null))[_0xa753('0x28')](respondWithResult(_0x2731de,null))[_0xa753('0x47')](handleError(_0x2731de,null));};exports[_0xa753('0x4c')]=function(_0x4f833c,_0x367c30){return db[_0xa753('0x42')][_0xa753('0x4c')](_0x4f833c[_0xa753('0x4d')],{})['then'](function(_0x560429){var _0x3d843c=_0x4f833c[_0xa753('0x4e')][_0xa753('0x29')]({'plain':!![]});if(!_0x3d843c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d843c['role']==='user'){var _0x380185=_0x560429[_0xa753('0x29')]({'plain':!![]});var _0x12e593=_0xa753('0x4f');return db['UserProfileSection'][_0xa753('0x4b')]({'where':{'name':_0x12e593,'userProfileId':_0x3d843c['userProfileId']},'raw':!![]})['then'](function(_0x6898a7){if(_0x6898a7&&_0x6898a7['autoAssociation']===0x0){return db['UserProfileResource'][_0xa753('0x4c')]({'name':_0x380185[_0xa753('0x2d')],'resourceId':_0x380185['id'],'type':_0x6898a7[_0xa753('0x2d')],'sectionId':_0x6898a7['id']},{})[_0xa753('0x28')](function(){return _0x560429;});}else{return _0x560429;}})[_0xa753('0x47')](function(_0x53ac85){logger[_0xa753('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53ac85);throw _0x53ac85;});}return _0x560429;})[_0xa753('0x28')](respondWithResult(_0x367c30,0xc9))[_0xa753('0x47')](handleError(_0x367c30,null));};exports[_0xa753('0x26')]=function(_0x39e736,_0x4626da){if(_0x39e736[_0xa753('0x4d')]['id']){delete _0x39e736[_0xa753('0x4d')]['id'];}return db[_0xa753('0x42')]['find']({'where':{'id':_0x39e736['params']['id']}})[_0xa753('0x28')](handleEntityNotFound(_0x4626da,null))[_0xa753('0x28')](saveUpdates(_0x39e736[_0xa753('0x4d')],null))[_0xa753('0x28')](respondWithResult(_0x4626da,null))[_0xa753('0x47')](handleError(_0x4626da,null));};exports['destroy']=function(_0x4b8bcb,_0x2fda54){return db[_0xa753('0x42')][_0xa753('0x4b')]({'where':{'id':_0x4b8bcb[_0xa753('0x49')]['id']}})[_0xa753('0x28')](handleEntityNotFound(_0x2fda54,null))[_0xa753('0x28')](removeEntity(_0x2fda54,null))[_0xa753('0x47')](handleError(_0x2fda54,null));};exports[_0xa753('0x50')]=function(_0xafb56b,_0x21405b,_0x1e313b){if(_0xafb56b[_0xa753('0x4d')]['id']){delete _0xafb56b[_0xa753('0x4d')]['id'];}return db[_0xa753('0x42')][_0xa753('0x4b')]({'where':{'id':_0xafb56b['params']['id']}})[_0xa753('0x28')](handleEntityNotFound(_0x21405b,null))[_0xa753('0x28')](function(_0x182ff){if(_0x182ff){_0xafb56b[_0xa753('0x4d')][_0xa753('0x51')]=_0x182ff['id'];return db[_0xa753('0x52')][_0xa753('0x4c')](_0xafb56b['body']);}})['then'](respondWithResult(_0x21405b,null))[_0xa753('0x47')](handleError(_0x21405b,null));};exports[_0xa753('0x53')]=function(_0xe4143,_0x3b3db6,_0xe3cc4d){if(_0xe4143['body']['id']){delete _0xe4143[_0xa753('0x4d')]['id'];}return db[_0xa753('0x42')][_0xa753('0x4b')]({'where':{'id':_0xe4143['params']['id']}})['then'](handleEntityNotFound(_0x3b3db6,null))[_0xa753('0x28')](function(_0x2824a8){if(_0x2824a8){_0xe4143[_0xa753('0x4d')][_0xa753('0x54')]=_0x2824a8['id'];return db['Condition']['create'](_0xe4143[_0xa753('0x4d')]);}})['then'](respondWithResult(_0x3b3db6,null))['catch'](handleError(_0x3b3db6,null));};exports['getAllConditions']=function(_0x405ab5,_0x546f2f,_0x3418aa){var _0x35486c={};var _0x3615c7={};var _0x3e02a3;var _0x52df8f;return db[_0xa753('0x42')][_0xa753('0x55')]({'where':{'id':_0x405ab5[_0xa753('0x49')]['id']}})[_0xa753('0x28')](handleEntityNotFound(_0x546f2f,null))['then'](function(_0x25d64e){if(_0x25d64e){_0x3e02a3=_0x25d64e;_0x3615c7[_0xa753('0x32')]=_[_0xa753('0x4a')](db[_0xa753('0x52')][_0xa753('0x30')]);_0x3615c7[_0xa753('0x33')]=_[_0xa753('0x4a')](_0x405ab5['query']);_0x3615c7[_0xa753('0x34')]=_[_0xa753('0x35')](_0x3615c7[_0xa753('0x32')],_0x3615c7[_0xa753('0x33')]);_0x35486c[_0xa753('0x36')]=_[_0xa753('0x35')](_0x3615c7[_0xa753('0x32')],qs[_0xa753('0x37')](_0x405ab5['query'][_0xa753('0x37')]));_0x35486c[_0xa753('0x36')]=_0x35486c[_0xa753('0x36')][_0xa753('0x38')]?_0x35486c[_0xa753('0x36')]:_0x3615c7[_0xa753('0x32')];_0x35486c['order']=qs[_0xa753('0x3b')](_0x405ab5[_0xa753('0x33')][_0xa753('0x3b')]);_0x35486c[_0xa753('0x3e')]=qs[_0xa753('0x34')](_['pick'](_0x405ab5[_0xa753('0x33')],_0x3615c7[_0xa753('0x34')]));if(_0x405ab5['query'][_0xa753('0x3d')]){_0x35486c[_0xa753('0x3e')]=_[_0xa753('0x40')](_0x35486c[_0xa753('0x3e')],{'$or':_['map'](_0x35486c[_0xa753('0x36')],function(_0x82a49b){var _0x49a8de={};_0x49a8de[_0x82a49b]={'$like':'%'+_0x405ab5[_0xa753('0x33')][_0xa753('0x3d')]+'%'};return _0x49a8de;})});}_0x35486c=_[_0xa753('0x40')]({},_0x35486c,_0x405ab5[_0xa753('0x41')]);return _0x3e02a3[_0xa753('0x56')](_0x35486c);}})[_0xa753('0x28')](function(_0x4cd740){if(_0x4cd740){_0x52df8f=_0x4cd740[_0xa753('0x38')];if(!_0x405ab5[_0xa753('0x33')][_0xa753('0x39')](_0xa753('0x57'))){_0x35486c[_0xa753('0x1e')]=qs[_0xa753('0x1e')](_0x405ab5[_0xa753('0x33')][_0xa753('0x1e')]);_0x35486c['offset']=qs['offset'](_0x405ab5[_0xa753('0x33')]['offset']);}return _0x3e02a3['getAllConditions'](_0x35486c);}})['then'](function(_0x4ffd3e){if(_0x4ffd3e){return _0x4ffd3e?{'count':_0x52df8f,'rows':_0x4ffd3e}:null;}})[_0xa753('0x28')](respondWithResult(_0x546f2f,null))[_0xa753('0x47')](handleError(_0x546f2f,null));};exports[_0xa753('0x58')]=function(_0x306845,_0x116963,_0x241b22){var _0x3a6ed3={};var _0x23874d={};var _0x449d2c;var _0x4025db;return db[_0xa753('0x42')][_0xa753('0x55')]({'where':{'id':_0x306845['params']['id']}})[_0xa753('0x28')](handleEntityNotFound(_0x116963,null))[_0xa753('0x28')](function(_0x30221f){if(_0x30221f){_0x449d2c=_0x30221f;_0x23874d[_0xa753('0x32')]=_['keys'](db[_0xa753('0x52')][_0xa753('0x30')]);_0x23874d[_0xa753('0x33')]=_[_0xa753('0x4a')](_0x306845[_0xa753('0x33')]);_0x23874d[_0xa753('0x34')]=_[_0xa753('0x35')](_0x23874d[_0xa753('0x32')],_0x23874d[_0xa753('0x33')]);_0x3a6ed3[_0xa753('0x36')]=_[_0xa753('0x35')](_0x23874d['model'],qs[_0xa753('0x37')](_0x306845['query'][_0xa753('0x37')]));_0x3a6ed3[_0xa753('0x36')]=_0x3a6ed3[_0xa753('0x36')][_0xa753('0x38')]?_0x3a6ed3[_0xa753('0x36')]:_0x23874d[_0xa753('0x32')];_0x3a6ed3[_0xa753('0x3a')]=qs[_0xa753('0x3b')](_0x306845[_0xa753('0x33')][_0xa753('0x3b')]);_0x3a6ed3[_0xa753('0x3e')]=qs['filters'](_[_0xa753('0x3c')](_0x306845[_0xa753('0x33')],_0x23874d['filters']));if(_0x306845[_0xa753('0x33')][_0xa753('0x3d')]){_0x3a6ed3['where']=_[_0xa753('0x40')](_0x3a6ed3[_0xa753('0x3e')],{'$or':_[_0xa753('0x2f')](_0x3a6ed3[_0xa753('0x36')],function(_0x1e9037){var _0x3119bd={};_0x3119bd[_0x1e9037]={'$like':'%'+_0x306845['query'][_0xa753('0x3d')]+'%'};return _0x3119bd;})});}_0x3a6ed3=_[_0xa753('0x40')]({},_0x3a6ed3,_0x306845[_0xa753('0x41')]);return _0x449d2c[_0xa753('0x58')](_0x3a6ed3);}})[_0xa753('0x28')](function(_0x30246d){if(_0x30246d){_0x4025db=_0x30246d[_0xa753('0x38')];if(!_0x306845[_0xa753('0x33')][_0xa753('0x39')](_0xa753('0x57'))){_0x3a6ed3[_0xa753('0x1e')]=qs[_0xa753('0x1e')](_0x306845['query'][_0xa753('0x1e')]);_0x3a6ed3[_0xa753('0x20')]=qs[_0xa753('0x20')](_0x306845[_0xa753('0x33')][_0xa753('0x20')]);}return _0x449d2c['getAnyConditions'](_0x3a6ed3);}})[_0xa753('0x28')](function(_0x4c2791){if(_0x4c2791){return _0x4c2791?{'count':_0x4025db,'rows':_0x4c2791}:null;}})[_0xa753('0x28')](respondWithResult(_0x116963,null))[_0xa753('0x47')](handleError(_0x116963,null));};exports[_0xa753('0x59')]=function(_0xe4f334,_0x5617b2,_0x1f05f9){if(_0xe4f334[_0xa753('0x4d')]['id']){delete _0xe4f334['body']['id'];}return db[_0xa753('0x42')][_0xa753('0x4b')]({'where':{'id':_0xe4f334[_0xa753('0x49')]['id']}})['then'](handleEntityNotFound(_0x5617b2,null))[_0xa753('0x28')](function(_0x35041e){if(_0x35041e){_0xe4f334['body'][_0xa753('0x5a')]=_0x35041e['id'];return db['Action'][_0xa753('0x4c')](_0xe4f334[_0xa753('0x4d')]);}})[_0xa753('0x28')](respondWithResult(_0x5617b2,null))['catch'](handleError(_0x5617b2,null));};exports[_0xa753('0x5b')]=function(_0x3487b1,_0x49b10b,_0x18d044){var _0x4c4caf={};var _0xf5d3fe={};var _0x4704ae;var _0x58743f;return db[_0xa753('0x42')][_0xa753('0x55')]({'where':{'id':_0x3487b1[_0xa753('0x49')]['id']}})[_0xa753('0x28')](handleEntityNotFound(_0x49b10b,null))[_0xa753('0x28')](function(_0x5756bd){if(_0x5756bd){_0x4704ae=_0x5756bd;_0xf5d3fe[_0xa753('0x32')]=_['keys'](db[_0xa753('0x5c')][_0xa753('0x30')]);_0xf5d3fe[_0xa753('0x33')]=_[_0xa753('0x4a')](_0x3487b1['query']);_0xf5d3fe[_0xa753('0x34')]=_[_0xa753('0x35')](_0xf5d3fe[_0xa753('0x32')],_0xf5d3fe['query']);_0x4c4caf[_0xa753('0x36')]=_[_0xa753('0x35')](_0xf5d3fe[_0xa753('0x32')],qs[_0xa753('0x37')](_0x3487b1[_0xa753('0x33')][_0xa753('0x37')]));_0x4c4caf['attributes']=_0x4c4caf[_0xa753('0x36')][_0xa753('0x38')]?_0x4c4caf[_0xa753('0x36')]:_0xf5d3fe[_0xa753('0x32')];_0x4c4caf[_0xa753('0x3a')]=qs['sort'](_0x3487b1['query'][_0xa753('0x3b')]);_0x4c4caf[_0xa753('0x3e')]=qs['filters'](_[_0xa753('0x3c')](_0x3487b1[_0xa753('0x33')],_0xf5d3fe[_0xa753('0x34')]));if(_0x3487b1['query'][_0xa753('0x3d')]){_0x4c4caf[_0xa753('0x3e')]=_['merge'](_0x4c4caf[_0xa753('0x3e')],{'$or':_[_0xa753('0x2f')](_0x4c4caf['attributes'],function(_0x4d2851){var _0x2ce97f={};_0x2ce97f[_0x4d2851]={'$like':'%'+_0x3487b1[_0xa753('0x33')][_0xa753('0x3d')]+'%'};return _0x2ce97f;})});}_0x4c4caf=_[_0xa753('0x40')]({},_0x4c4caf,_0x3487b1[_0xa753('0x41')]);return _0x4704ae['getActions'](_0x4c4caf);}})[_0xa753('0x28')](function(_0x2ed96c){if(_0x2ed96c){_0x58743f=_0x2ed96c['length'];if(!_0x3487b1[_0xa753('0x33')][_0xa753('0x39')](_0xa753('0x57'))){_0x4c4caf[_0xa753('0x1e')]=qs['limit'](_0x3487b1['query'][_0xa753('0x1e')]);_0x4c4caf['offset']=qs[_0xa753('0x20')](_0x3487b1[_0xa753('0x33')][_0xa753('0x20')]);}return _0x4704ae[_0xa753('0x5b')](_0x4c4caf);}})[_0xa753('0x28')](function(_0x21ebac){if(_0x21ebac){return _0x21ebac?{'count':_0x58743f,'rows':_0x21ebac}:null;}})[_0xa753('0x28')](respondWithResult(_0x49b10b,null))['catch'](handleError(_0x49b10b,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index c27e775..0ff908c 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 _0x79a8=['define','Trigger','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./trigger.attributes','exports'];(function(_0x39ff36,_0x5c1ce7){var _0x193380=function(_0x353520){while(--_0x353520){_0x39ff36['push'](_0x39ff36['shift']());}};_0x193380(++_0x5c1ce7);}(_0x79a8,0x1d0));var _0x879a=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x79a8[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x879a('0x0'));var util=require('util');var logger=require(_0x879a('0x1'))(_0x879a('0x2'));var moment=require(_0x879a('0x3'));var BPromise=require('bluebird');var rp=require(_0x879a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x879a('0x5'));var config=require(_0x879a('0x6'));var attributes=require(_0x879a('0x7'));module[_0x879a('0x8')]=function(_0x1808f1,_0x3cb89c){return _0x1808f1[_0x879a('0x9')](_0x879a('0xa'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49c4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','Trigger','tools_triggers','lodash'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x49c4,0x9b));var _0x449c=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x49c4[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x449c('0x0'));var util=require('util');var logger=require(_0x449c('0x1'))(_0x449c('0x2'));var moment=require(_0x449c('0x3'));var BPromise=require(_0x449c('0x4'));var rp=require(_0x449c('0x5'));var fs=require('fs');var path=require(_0x449c('0x6'));var rimraf=require(_0x449c('0x7'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0x449c('0x8')]=function(_0x442e56,_0x12586c){return _0x442e56[_0x449c('0x9')](_0x449c('0xa'),attributes,{'tableName':_0x449c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 176426d..4b6ac66 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 _0x8de0=['rpc','../../config/environment','jayson/promise','request','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','error','code','Trigger,\x20%s,\x20%s','message','info','result','catch','Trigger','findAll','options','raw','attributes','include','model','map','then','GetTrigger','debug','stringify','ShowTrigger','where','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3a8db5,_0x31cff7){var _0x2c03cd=function(_0x47dba0){while(--_0x47dba0){_0x3a8db5['push'](_0x3a8db5['shift']());}};_0x2c03cd(++_0x31cff7);}(_0x8de0,0x102));var _0x08de=function(_0xa091ec,_0x1cf122){_0xa091ec=_0xa091ec-0x0;var _0x834bd4=_0x8de0[_0xa091ec];return _0x834bd4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x08de('0x0'));var BPromise=require(_0x08de('0x1'));var rs=require(_0x08de('0x2'));var fs=require('fs');var Redis=require(_0x08de('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x08de('0x4'));var logger=require(_0x08de('0x5'))(_0x08de('0x6'));var config=require(_0x08de('0x7'));var jayson=require(_0x08de('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa1e64,_0x191488,_0x398539){return new BPromise(function(_0x3ae1c6,_0x421c4a){return client[_0x08de('0x9')](_0xa1e64,_0x398539)['then'](function(_0x5ca898){logger['info']('Trigger,\x20%s,\x20%s',_0x191488,_0x08de('0xa'));logger['debug'](_0x08de('0xb'),_0x191488,_0x08de('0xa'),JSON['stringify'](_0x5ca898));if(_0x5ca898[_0x08de('0xc')]){if(_0x5ca898[_0x08de('0xc')][_0x08de('0xd')]===0x1f4){logger['error'](_0x08de('0xe'),_0x191488,_0x5ca898[_0x08de('0xc')][_0x08de('0xf')]);return _0x421c4a(_0x5ca898['error']['message']);}logger[_0x08de('0xc')](_0x08de('0xe'),_0x191488,_0x5ca898[_0x08de('0xc')]['message']);return _0x3ae1c6(_0x5ca898[_0x08de('0xc')][_0x08de('0xf')]);}else{logger[_0x08de('0x10')](_0x08de('0xe'),_0x191488,_0x08de('0xa'));_0x3ae1c6(_0x5ca898[_0x08de('0x11')][_0x08de('0xf')]);}})[_0x08de('0x12')](function(_0x38abf4){logger[_0x08de('0xc')](_0x08de('0xe'),_0x191488,_0x38abf4);_0x421c4a(_0x38abf4);});});}exports['GetTrigger']=function(_0x16986c){var _0xc53440=this;return new Promise(function(_0x3cdc05,_0x39773c){return db[_0x08de('0x13')][_0x08de('0x14')]({'raw':_0x16986c[_0x08de('0x15')]?_0x16986c[_0x08de('0x15')][_0x08de('0x16')]===undefined?!![]:![]:!![],'where':_0x16986c[_0x08de('0x15')]?_0x16986c[_0x08de('0x15')]['where']||null:null,'attributes':_0x16986c['options']?_0x16986c[_0x08de('0x15')][_0x08de('0x17')]||null:null,'limit':_0x16986c[_0x08de('0x15')]?_0x16986c['options']['limit']||null:null,'include':_0x16986c[_0x08de('0x15')]?_0x16986c[_0x08de('0x15')][_0x08de('0x18')]?_['map'](_0x16986c[_0x08de('0x15')]['include'],function(_0x4f978c){return{'model':db[_0x4f978c[_0x08de('0x19')]],'as':_0x4f978c['as'],'attributes':_0x4f978c[_0x08de('0x17')],'include':_0x4f978c[_0x08de('0x18')]?_[_0x08de('0x1a')](_0x4f978c[_0x08de('0x18')],function(_0xbdbfc1){return{'model':db[_0xbdbfc1[_0x08de('0x19')]],'as':_0xbdbfc1['as'],'attributes':_0xbdbfc1[_0x08de('0x17')],'include':_0xbdbfc1[_0x08de('0x18')]?_[_0x08de('0x1a')](_0xbdbfc1[_0x08de('0x18')],function(_0x232f66){return{'model':db[_0x232f66[_0x08de('0x19')]],'as':_0x232f66['as'],'attributes':_0x232f66[_0x08de('0x17')]};}):[]};}):[]};}):[]:[]})[_0x08de('0x1b')](function(_0x430088){logger[_0x08de('0x10')](_0x08de('0x1c'),_0x16986c);logger[_0x08de('0x1d')](_0x08de('0x1c'),_0x16986c,JSON[_0x08de('0x1e')](_0x430088));_0x3cdc05(_0x430088);})['catch'](function(_0x5e827a){logger[_0x08de('0xc')](_0x08de('0x1c'),_0x5e827a[_0x08de('0xf')],_0x16986c);_0x39773c(_0xc53440[_0x08de('0xc')](0x1f4,_0x5e827a[_0x08de('0xf')]));});});};exports[_0x08de('0x1f')]=function(_0x330067){var _0x5ed7d4=this;return new Promise(function(_0x455772,_0x37d321){return db[_0x08de('0x13')]['find']({'raw':_0x330067['options']?_0x330067[_0x08de('0x15')][_0x08de('0x16')]===undefined?!![]:![]:!![],'where':_0x330067[_0x08de('0x15')]?_0x330067[_0x08de('0x15')][_0x08de('0x20')]||null:null,'attributes':_0x330067['options']?_0x330067[_0x08de('0x15')]['attributes']||null:null,'include':_0x330067[_0x08de('0x15')]?_0x330067[_0x08de('0x15')][_0x08de('0x18')]?_['map'](_0x330067['options'][_0x08de('0x18')],function(_0x16353d){return{'model':db[_0x16353d[_0x08de('0x19')]],'as':_0x16353d['as'],'attributes':_0x16353d[_0x08de('0x17')],'include':_0x16353d['include']?_[_0x08de('0x1a')](_0x16353d[_0x08de('0x18')],function(_0x20f11d){return{'model':db[_0x20f11d[_0x08de('0x19')]],'as':_0x20f11d['as'],'attributes':_0x20f11d[_0x08de('0x17')],'include':_0x20f11d[_0x08de('0x18')]?_[_0x08de('0x1a')](_0x20f11d[_0x08de('0x18')],function(_0x15523f){return{'model':db[_0x15523f['model']],'as':_0x15523f['as'],'attributes':_0x15523f[_0x08de('0x17')]};}):[]};}):[]};}):[]:[]})[_0x08de('0x1b')](function(_0x1297b4){logger[_0x08de('0x10')](_0x08de('0x1f'),_0x330067);logger[_0x08de('0x1d')](_0x08de('0x1f'),_0x330067,JSON[_0x08de('0x1e')](_0x1297b4));_0x455772(_0x1297b4);})[_0x08de('0x12')](function(_0x451b5e){logger[_0x08de('0xc')]('ShowTrigger',_0x451b5e['message'],_0x330067);_0x37d321(_0x5ed7d4[_0x08de('0xc')](0x1f4,_0x451b5e[_0x08de('0xf')]));});});}; \ No newline at end of file +var _0x9d97=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','GetTrigger','ShowTrigger','find','lodash','util','moment','bluebird','ioredis'];(function(_0x5f06c0,_0x2637c4){var _0x323312=function(_0x2236ec){while(--_0x2236ec){_0x5f06c0['push'](_0x5f06c0['shift']());}};_0x323312(++_0x2637c4);}(_0x9d97,0x192));var _0x79d9=function(_0x55119f,_0xcd2736){_0x55119f=_0x55119f-0x0;var _0x31211e=_0x9d97[_0x55119f];return _0x31211e;};'use strict';var _=require(_0x79d9('0x0'));var util=require(_0x79d9('0x1'));var moment=require(_0x79d9('0x2'));var BPromise=require(_0x79d9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x79d9('0x5'));var logger=require(_0x79d9('0x6'))(_0x79d9('0x7'));var config=require(_0x79d9('0x8'));var jayson=require(_0x79d9('0x9'));var client=jayson[_0x79d9('0xa')][_0x79d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2aaf68,_0x149af4,_0x5cfb97){return new BPromise(function(_0xb1809,_0x1a70ec){return client[_0x79d9('0xc')](_0x2aaf68,_0x5cfb97)[_0x79d9('0xd')](function(_0x60e211){logger[_0x79d9('0xe')]('Trigger,\x20%s,\x20%s',_0x149af4,'request\x20sent');logger[_0x79d9('0xf')](_0x79d9('0x10'),_0x149af4,_0x79d9('0x11'),JSON[_0x79d9('0x12')](_0x60e211));if(_0x60e211[_0x79d9('0x13')]){if(_0x60e211['error']['code']===0x1f4){logger[_0x79d9('0x13')](_0x79d9('0x14'),_0x149af4,_0x60e211[_0x79d9('0x13')][_0x79d9('0x15')]);return _0x1a70ec(_0x60e211[_0x79d9('0x13')][_0x79d9('0x15')]);}logger[_0x79d9('0x13')](_0x79d9('0x14'),_0x149af4,_0x60e211[_0x79d9('0x13')][_0x79d9('0x15')]);return _0xb1809(_0x60e211[_0x79d9('0x13')][_0x79d9('0x15')]);}else{logger[_0x79d9('0xe')](_0x79d9('0x14'),_0x149af4,_0x79d9('0x11'));_0xb1809(_0x60e211[_0x79d9('0x16')][_0x79d9('0x15')]);}})[_0x79d9('0x17')](function(_0x3f4515){logger[_0x79d9('0x13')](_0x79d9('0x14'),_0x149af4,_0x3f4515);_0x1a70ec(_0x3f4515);});});}exports['GetTrigger']=function(_0xaddf5d){var _0x4f50bd=this;return new Promise(function(_0x36e996,_0x515e95){return db[_0x79d9('0x18')][_0x79d9('0x19')]({'raw':_0xaddf5d[_0x79d9('0x1a')]?_0xaddf5d[_0x79d9('0x1a')][_0x79d9('0x1b')]===undefined?!![]:![]:!![],'where':_0xaddf5d[_0x79d9('0x1a')]?_0xaddf5d[_0x79d9('0x1a')][_0x79d9('0x1c')]||null:null,'attributes':_0xaddf5d['options']?_0xaddf5d[_0x79d9('0x1a')][_0x79d9('0x1d')]||null:null,'limit':_0xaddf5d[_0x79d9('0x1a')]?_0xaddf5d[_0x79d9('0x1a')][_0x79d9('0x1e')]||null:null,'include':_0xaddf5d[_0x79d9('0x1a')]?_0xaddf5d[_0x79d9('0x1a')][_0x79d9('0x1f')]?_[_0x79d9('0x20')](_0xaddf5d[_0x79d9('0x1a')]['include'],function(_0x4d4425){return{'model':db[_0x4d4425[_0x79d9('0x21')]],'as':_0x4d4425['as'],'attributes':_0x4d4425['attributes'],'include':_0x4d4425[_0x79d9('0x1f')]?_['map'](_0x4d4425[_0x79d9('0x1f')],function(_0x332092){return{'model':db[_0x332092[_0x79d9('0x21')]],'as':_0x332092['as'],'attributes':_0x332092[_0x79d9('0x1d')],'include':_0x332092[_0x79d9('0x1f')]?_[_0x79d9('0x20')](_0x332092['include'],function(_0x53db23){return{'model':db[_0x53db23[_0x79d9('0x21')]],'as':_0x53db23['as'],'attributes':_0x53db23[_0x79d9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x79d9('0xd')](function(_0xc7fab4){logger['info'](_0x79d9('0x22'),_0xaddf5d);logger[_0x79d9('0xf')](_0x79d9('0x22'),_0xaddf5d,JSON[_0x79d9('0x12')](_0xc7fab4));_0x36e996(_0xc7fab4);})['catch'](function(_0x38d9c5){logger[_0x79d9('0x13')](_0x79d9('0x22'),_0x38d9c5[_0x79d9('0x15')],_0xaddf5d);_0x515e95(_0x4f50bd['error'](0x1f4,_0x38d9c5[_0x79d9('0x15')]));});});};exports[_0x79d9('0x23')]=function(_0x4f793b){var _0x28bbc2=this;return new Promise(function(_0x8447d3,_0x2a8db7){return db[_0x79d9('0x18')][_0x79d9('0x24')]({'raw':_0x4f793b[_0x79d9('0x1a')]?_0x4f793b[_0x79d9('0x1a')][_0x79d9('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f793b[_0x79d9('0x1a')]?_0x4f793b[_0x79d9('0x1a')]['where']||null:null,'attributes':_0x4f793b['options']?_0x4f793b[_0x79d9('0x1a')][_0x79d9('0x1d')]||null:null,'include':_0x4f793b[_0x79d9('0x1a')]?_0x4f793b[_0x79d9('0x1a')][_0x79d9('0x1f')]?_[_0x79d9('0x20')](_0x4f793b[_0x79d9('0x1a')][_0x79d9('0x1f')],function(_0x57038d){return{'model':db[_0x57038d[_0x79d9('0x21')]],'as':_0x57038d['as'],'attributes':_0x57038d['attributes'],'include':_0x57038d[_0x79d9('0x1f')]?_[_0x79d9('0x20')](_0x57038d['include'],function(_0x49b3e4){return{'model':db[_0x49b3e4[_0x79d9('0x21')]],'as':_0x49b3e4['as'],'attributes':_0x49b3e4[_0x79d9('0x1d')],'include':_0x49b3e4[_0x79d9('0x1f')]?_['map'](_0x49b3e4['include'],function(_0x938d97){return{'model':db[_0x938d97[_0x79d9('0x21')]],'as':_0x938d97['as'],'attributes':_0x938d97['attributes']};}):[]};}):[]};}):[]:[]})[_0x79d9('0xd')](function(_0x32e964){logger['info'](_0x79d9('0x23'),_0x4f793b);logger[_0x79d9('0xf')](_0x79d9('0x23'),_0x4f793b,JSON[_0x79d9('0x12')](_0x32e964));_0x8447d3(_0x32e964);})[_0x79d9('0x17')](function(_0x5b7e2a){logger['error']('ShowTrigger',_0x5b7e2a['message'],_0x4f793b);_0x2a8db7(_0x28bbc2[_0x79d9('0x13')](0x1f4,_0x5b7e2a[_0x79d9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 94028f9..4a28665 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 _0xfd8e=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','show','post','/:id/clone','clone'];(function(_0x44e8ec,_0x3f3b56){var _0xfd4a09=function(_0x143b94){while(--_0x143b94){_0x44e8ec['push'](_0x44e8ec['shift']());}};_0xfd4a09(++_0x3f3b56);}(_0xfd8e,0x73));var _0xefd8=function(_0x1f9fae,_0x108bf2){_0x1f9fae=_0x1f9fae-0x0;var _0x491b82=_0xfd8e[_0x1f9fae];return _0x491b82;};'use strict';var multer=require(_0xefd8('0x0'));var util=require(_0xefd8('0x1'));var path=require(_0xefd8('0x2'));var timeout=require(_0xefd8('0x3'));var express=require(_0xefd8('0x4'));var router=express['Router']();var fs_extra=require(_0xefd8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xefd8('0x6'));var config=require(_0xefd8('0x7'));var controller=require(_0xefd8('0x8'));router[_0xefd8('0x9')]('/',auth['isAuthenticated'](),controller[_0xefd8('0xa')]);router['get'](_0xefd8('0xb'),auth[_0xefd8('0xc')](),controller[_0xefd8('0xd')]);router[_0xefd8('0xe')](_0xefd8('0xf'),auth[_0xefd8('0xc')](),controller[_0xefd8('0x10')]);router[_0xefd8('0xe')]('/',auth[_0xefd8('0xc')](),controller[_0xefd8('0x11')]);router['put']('/:id',auth[_0xefd8('0xc')](),controller[_0xefd8('0x12')]);router[_0xefd8('0x13')](_0xefd8('0xb'),auth[_0xefd8('0xc')](),controller[_0xefd8('0x14')]);module[_0xefd8('0x15')]=router; \ No newline at end of file +var _0xba5f=['./trunk.controller','isAuthenticated','index','get','/:id','show','post','clone','create','put','update','delete','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x467ad6,_0x10892e){var _0x4052cc=function(_0x364206){while(--_0x364206){_0x467ad6['push'](_0x467ad6['shift']());}};_0x4052cc(++_0x10892e);}(_0xba5f,0x1cf));var _0xfba5=function(_0x1c0435,_0x383a6c){_0x1c0435=_0x1c0435-0x0;var _0x49548e=_0xba5f[_0x1c0435];return _0x49548e;};'use strict';var multer=require(_0xfba5('0x0'));var util=require(_0xfba5('0x1'));var path=require('path');var timeout=require(_0xfba5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfba5('0x3'));var interaction=require(_0xfba5('0x4'));var config=require('../../config/environment');var controller=require(_0xfba5('0x5'));router['get']('/',auth[_0xfba5('0x6')](),controller[_0xfba5('0x7')]);router[_0xfba5('0x8')](_0xfba5('0x9'),auth[_0xfba5('0x6')](),controller[_0xfba5('0xa')]);router[_0xfba5('0xb')]('/:id/clone',auth[_0xfba5('0x6')](),controller[_0xfba5('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfba5('0xd')]);router[_0xfba5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xfba5('0xf')]);router[_0xfba5('0x10')](_0xfba5('0x9'),auth[_0xfba5('0x6')](),controller['destroy']);module[_0xfba5('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 4604ffc..1b42f10 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 _0x3d43=['yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','never','INTEGER','always','accept','refuse','originate','uac','uas','passive','actpass','BOOLEAN','exports','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto'];(function(_0x3754bf,_0x2d60fe){var _0x341082=function(_0x8e900c){while(--_0x8e900c){_0x3754bf['push'](_0x3754bf['shift']());}};_0x341082(++_0x2d60fe);}(_0x3d43,0xa6));var _0x33d4=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x3d43[_0x35e92e];return _0x1205a8;};'use strict';var Sequelize=require('sequelize');module[_0x33d4('0x0')]={'name':{'type':Sequelize[_0x33d4('0x1')],'allowNull':![],'unique':_0x33d4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x4'),'user',_0x33d4('0x5')),'allowNull':![],'defaultValue':_0x33d4('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x33d4('0x6')},'callingpres':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x7'),_0x33d4('0x8'),_0x33d4('0x9'),_0x33d4('0xa'),'PROHIB_NOT_SCREENED',_0x33d4('0xb'),_0x33d4('0xc'),_0x33d4('0xd'))},'deny':{'type':Sequelize[_0x33d4('0x1')]},'permit':{'type':Sequelize[_0x33d4('0x1')]},'secret':{'type':Sequelize[_0x33d4('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x33d4('0x1')]},'transport':{'type':Sequelize[_0x33d4('0x1')],'defaultValue':_0x33d4('0xe'),'set':function(_0x6d3e9f){this[_0x33d4('0xf')](_0x33d4('0x10'),_0x6d3e9f?_0x6d3e9f[_0x33d4('0x11')](','):null);},'get':function(){return this[_0x33d4('0x12')](_0x33d4('0x10'))?this[_0x33d4('0x12')](_0x33d4('0x10'))[_0x33d4('0x13')](','):null;},'comment':_0x33d4('0x14')},'dtmfmode':{'type':Sequelize['ENUM'](_0x33d4('0x15'),_0x33d4('0x16'),_0x33d4('0x17'),_0x33d4('0x18'),_0x33d4('0x19')),'defaultValue':_0x33d4('0x15')},'directmedia':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no',_0x33d4('0x1b'),_0x33d4('0x1c'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x33d4('0x1')]},'directmediadeny':{'type':Sequelize[_0x33d4('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x33d4('0x1d'),'set':function(_0x58e1ec){this[_0x33d4('0xf')](_0x33d4('0x1e'),_0x58e1ec?_0x58e1ec[_0x33d4('0x11')](','):null);},'get':function(){return this[_0x33d4('0x12')](_0x33d4('0x1e'))?this['getDataValue']('nat')['split'](','):null;},'comment':_0x33d4('0x1f')},'callgroup':{'type':Sequelize[_0x33d4('0x1')]},'namedcallgroup':{'type':Sequelize[_0x33d4('0x1')]},'pickupgroup':{'type':Sequelize[_0x33d4('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x33d4('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x33d4('0x20')},'allow':{'type':Sequelize[_0x33d4('0x1')],'allowNull':![],'defaultValue':_0x33d4('0x21'),'set':function(_0x4c256c){this['setDataValue']('allow',_0x4c256c?_0x4c256c['join'](';'):_0x33d4('0x21'));},'get':function(){return this[_0x33d4('0x12')](_0x33d4('0x22'))?this[_0x33d4('0x12')]('allow')[_0x33d4('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x33d4('0x23'),'set':function(_0x27fb2b){this['setDataValue'](_0x33d4('0x24'),_0x27fb2b?_0x27fb2b[_0x33d4('0x11')](','):null);},'get':function(){return this[_0x33d4('0x12')](_0x33d4('0x24'))?this['getDataValue'](_0x33d4('0x24'))[_0x33d4('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x33d4('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no',_0x33d4('0x25'))},'promiscredir':{'type':Sequelize['ENUM'](_0x33d4('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x33d4('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x33d4('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x33d4('0x1a'),'no'),'defaultValue':_0x33d4('0x1a')},'busylevel':{'type':Sequelize[_0x33d4('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x33d4('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0x33d4('0x1')]},'template':{'type':Sequelize[_0x33d4('0x1')]},'videosupport':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no',_0x33d4('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x33d4('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'mailbox':{'type':Sequelize[_0x33d4('0x1')]},'session_timers':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x28'),_0x33d4('0x29'),_0x33d4('0x2a'))},'session_expires':{'type':Sequelize[_0x33d4('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x33d4('0x2b'),_0x33d4('0x2c')),'defaultValue':_0x33d4('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x33d4('0x1')]},'regexten':{'type':Sequelize[_0x33d4('0x1')]},'fromdomain':{'type':Sequelize[_0x33d4('0x1')]},'fromuser':{'type':Sequelize[_0x33d4('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x33d4('0x3')]('yes','no'),'defaultValue':_0x33d4('0x1a')},'keepalive':{'type':Sequelize[_0x33d4('0x26')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x33d4('0x1')]},'rtptimeout':{'type':Sequelize[_0x33d4('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x33d4('0x26')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x33d4('0x1a'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x33d4('0x1')]},'callbackextension':{'type':Sequelize[_0x33d4('0x1')]},'timert1':{'type':Sequelize[_0x33d4('0x26')](0xb)},'timerb':{'type':Sequelize[_0x33d4('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x33d4('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x33d4('0x1')]},'contactdeny':{'type':Sequelize[_0x33d4('0x1')]},'contactacl':{'type':Sequelize[_0x33d4('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x33d4('0x1')]},'use_q850_reason':{'type':Sequelize[_0x33d4('0x1')]},'maxforwards':{'type':Sequelize[_0x33d4('0x26')](0xb)},'encryption':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x33d4('0x1a'),'no')},'icesupport':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0x33d4('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x33d4('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x33d4('0x1')]},'dtlscipher':{'type':Sequelize[_0x33d4('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x33d4('0x1')]},'dtlssetup':{'type':Sequelize[_0x33d4('0x3')]('active',_0x33d4('0x2d'),_0x33d4('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x33d4('0x1')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x33d4('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x33d4('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0x33d4('0x3')](_0x33d4('0x1a'),'no')},'vmexten':{'type':Sequelize[_0x33d4('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x33d4('0x1')]},'parkinglot':{'type':Sequelize[_0x33d4('0x1')]},'description':{'type':Sequelize[_0x33d4('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x33d4('0x1b'),_0x33d4('0x1c'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x33d4('0x1')]},'active':{'type':Sequelize[_0x33d4('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x33d4('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x53a7=['ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','rfc2833','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always','accept','refuse','originate','uas','pai','fingerprint','certificate','passive','actpass','dynamic','nonat','update','update,nonat','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED'];(function(_0x4f2dd6,_0x4d3d03){var _0x236e70=function(_0x2dd2be){while(--_0x2dd2be){_0x4f2dd6['push'](_0x4f2dd6['shift']());}};_0x236e70(++_0x4d3d03);}(_0x53a7,0xb8));var _0x753a=function(_0x41b964,_0x2e2ca5){_0x41b964=_0x41b964-0x0;var _0x397f9a=_0x53a7[_0x41b964];return _0x397f9a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x753a('0x0')],'allowNull':![],'unique':_0x753a('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x753a('0x2')](_0x753a('0x3'),_0x753a('0x4'),_0x753a('0x5')),'allowNull':![],'defaultValue':_0x753a('0x3')},'context':{'type':Sequelize[_0x753a('0x0')],'allowNull':![],'defaultValue':_0x753a('0x6')},'callingpres':{'type':Sequelize['ENUM'](_0x753a('0x7'),_0x753a('0x8'),'ALLOWED_FAILED_SCREEN',_0x753a('0x9'),_0x753a('0xa'),_0x753a('0xb'),'PROHIB_FAILED_SCREEN',_0x753a('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x753a('0x0')]},'md5secret':{'type':Sequelize[_0x753a('0x0')]},'remotesecret':{'type':Sequelize[_0x753a('0x0')]},'transport':{'type':Sequelize[_0x753a('0x0')],'defaultValue':_0x753a('0xd'),'set':function(_0x273eae){this[_0x753a('0xe')]('transport',_0x273eae?_0x273eae[_0x753a('0xf')](','):null);},'get':function(){return this[_0x753a('0x10')]('transport')?this[_0x753a('0x10')](_0x753a('0x11'))[_0x753a('0x12')](','):null;},'comment':_0x753a('0x13')},'dtmfmode':{'type':Sequelize[_0x753a('0x2')]('rfc2833',_0x753a('0x14'),_0x753a('0x15'),'inband',_0x753a('0x16')),'defaultValue':_0x753a('0x17')},'directmedia':{'type':Sequelize[_0x753a('0x2')](_0x753a('0x18'),'no','nonat','update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x753a('0x2')](_0x753a('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x1c50d5){this['setDataValue'](_0x753a('0x19'),_0x1c50d5?_0x1c50d5[_0x753a('0xf')](','):null);},'get':function(){return this[_0x753a('0x10')](_0x753a('0x19'))?this[_0x753a('0x10')](_0x753a('0x19'))['split'](','):null;},'comment':_0x753a('0x1a')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x753a('0x0')]},'namedpickupgroup':{'type':Sequelize[_0x753a('0x0')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x753a('0x0')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x753a('0x0')],'defaultValue':_0x753a('0x1b')},'allow':{'type':Sequelize[_0x753a('0x0')],'allowNull':![],'defaultValue':_0x753a('0x1c'),'set':function(_0xa8a71f){this[_0x753a('0xe')](_0x753a('0x1d'),_0xa8a71f?_0xa8a71f[_0x753a('0xf')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x753a('0x10')](_0x753a('0x1d'))?this['getDataValue'](_0x753a('0x1d'))['split'](';'):null;},'comment':_0x753a('0x1e')},'autoframing':{'type':Sequelize[_0x753a('0x2')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x2d86ba){this[_0x753a('0xe')](_0x753a('0x1f'),_0x2d86ba?_0x2d86ba['join'](','):null);},'get':function(){return this[_0x753a('0x10')](_0x753a('0x1f'))?this[_0x753a('0x10')](_0x753a('0x1f'))['split'](','):null;},'comment':_0x753a('0x20')},'trustrpid':{'type':Sequelize[_0x753a('0x2')](_0x753a('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x753a('0x2')](_0x753a('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x753a('0x2')](_0x753a('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0x753a('0x2')]('yes','no')},'useclientcode':{'type':Sequelize[_0x753a('0x2')](_0x753a('0x18'),'no')},'accountcode':{'type':Sequelize[_0x753a('0x21')](0xb)},'setvar':{'type':Sequelize[_0x753a('0x0')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x753a('0x0')]},'callcounter':{'type':Sequelize[_0x753a('0x2')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x753a('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0x753a('0x2')](_0x753a('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x753a('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x753a('0x2')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x753a('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x753a('0x0')]},'template':{'type':Sequelize[_0x753a('0x0')]},'videosupport':{'type':Sequelize['ENUM'](_0x753a('0x18'),'no',_0x753a('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x753a('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x753a('0x18'),'no')},'mailbox':{'type':Sequelize[_0x753a('0x0')]},'session_timers':{'type':Sequelize[_0x753a('0x2')](_0x753a('0x23'),_0x753a('0x24'),_0x753a('0x25'))},'session_expires':{'type':Sequelize[_0x753a('0x21')](0xb)},'session_minse':{'type':Sequelize[_0x753a('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0x753a('0x2')]('uac','uas'),'defaultValue':_0x753a('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0x753a('0x0')]},'regexten':{'type':Sequelize[_0x753a('0x0')]},'fromdomain':{'type':Sequelize[_0x753a('0x0')]},'fromuser':{'type':Sequelize[_0x753a('0x0')]},'port':{'type':Sequelize[_0x753a('0x21')](0x5)},'qualify':{'type':Sequelize[_0x753a('0x2')](_0x753a('0x18'),'no'),'defaultValue':_0x753a('0x18')},'keepalive':{'type':Sequelize[_0x753a('0x21')](0xb)},'defaultip':{'type':Sequelize[_0x753a('0x0')]},'defaultuser':{'type':Sequelize[_0x753a('0x0')]},'rtptimeout':{'type':Sequelize[_0x753a('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x753a('0x18'),'no',_0x753a('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x753a('0x0')]},'callbackextension':{'type':Sequelize[_0x753a('0x0')]},'timert1':{'type':Sequelize[_0x753a('0x21')](0xb)},'timerb':{'type':Sequelize[_0x753a('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0x753a('0x21')](0xb)},'contactpermit':{'type':Sequelize[_0x753a('0x0')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x753a('0x0')]},'unsolicited_mailbox':{'type':Sequelize[_0x753a('0x0')]},'use_q850_reason':{'type':Sequelize[_0x753a('0x0')]},'maxforwards':{'type':Sequelize[_0x753a('0x21')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x753a('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x753a('0x2')](_0x753a('0x18'),'no')},'force_avp':{'type':Sequelize[_0x753a('0x2')](_0x753a('0x18'),'no')},'icesupport':{'type':Sequelize[_0x753a('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x753a('0x2')](_0x753a('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x753a('0x2')](_0x753a('0x18'),'no',_0x753a('0x28'),_0x753a('0x29'))},'dtlsrekey':{'type':Sequelize[_0x753a('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0x753a('0x0')]},'dtlsprivatekey':{'type':Sequelize[_0x753a('0x0')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x753a('0x2')]('active',_0x753a('0x2a'),_0x753a('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x753a('0x0')]},'usereqphone':{'type':Sequelize[_0x753a('0x2')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x753a('0x0')]},'recordofffeature':{'type':Sequelize[_0x753a('0x0')]},'call_limit':{'type':Sequelize[_0x753a('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x753a('0x2')](_0x753a('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x753a('0x2')](_0x753a('0x18'),'no')},'vmexten':{'type':Sequelize[_0x753a('0x0')]},'mohinterpret':{'type':Sequelize[_0x753a('0x0')]},'mohsuggest':{'type':Sequelize[_0x753a('0x0')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x753a('0x0')]},'host':{'type':Sequelize[_0x753a('0x0')],'defaultValue':_0x753a('0x2c')},'canreinvite':{'type':Sequelize[_0x753a('0x2')](_0x753a('0x18'),'no',_0x753a('0x2d'),_0x753a('0x2e'),_0x753a('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x753a('0x0')]},'otherFields':{'type':Sequelize[_0x753a('0x0')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x753a('0x0')],'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 6dc9a4a..fdf417b 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 _0x00bb=['includeAll','findAll','rows','params','find','clone','rawAttributes','include','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','jayson/promise','client','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Trunk,\x20%s,\x20%s','result','catch','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Trunks','UserProfileResource','status','stack','name','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x254b72,_0xa2262){var _0x554582=function(_0x135917){while(--_0x135917){_0x254b72['push'](_0x254b72['shift']());}};_0x554582(++_0xa2262);}(_0x00bb,0x1d8));var _0xb00b=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x00bb[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];var jayson=require(_0xb00b('0x15'));var client=jayson[_0xb00b('0x16')][_0xb00b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xef5d52,_0x1f1c1d,_0x4ada81,_0x218de2){return new BPromise(function(_0xb0d42e,_0x482fe6){var _0x88d95e=_0x218de2||client;return _0x88d95e[_0xb00b('0x18')](_0xef5d52,_0x4ada81)['then'](function(_0x5da36b){logger[_0xb00b('0x19')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,'request\x20sent');logger[_0xb00b('0x1a')](_0xb00b('0x1b'),_0x1f1c1d,_0xb00b('0x1c'),JSON[_0xb00b('0x1d')](_0x5da36b));if(_0x5da36b['error']){if(_0x5da36b[_0xb00b('0x1e')]['code']===0x1f4){logger[_0xb00b('0x1e')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0x482fe6(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0xb0d42e(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}else{logger[_0xb00b('0x19')](_0xb00b('0x20'),_0x1f1c1d,'request\x20sent');_0xb0d42e(_0x5da36b[_0xb00b('0x21')]['message']);}})[_0xb00b('0x22')](function(_0x121ec7){logger['error'](_0xb00b('0x20'),_0x1f1c1d,_0x121ec7);_0x482fe6(_0x121ec7);});});}function respondWithStatusCode(_0x2896d1,_0x520444){_0x520444=_0x520444||0xcc;return function(_0x3ab3cc){if(_0x3ab3cc){return _0x2896d1[_0xb00b('0x23')](_0x520444);}return _0x2896d1['status'](_0x520444)[_0xb00b('0x24')]();};}function respondWithResult(_0x243fdb,_0x3c9500){_0x3c9500=_0x3c9500||0xc8;return function(_0x8caadf){if(_0x8caadf){return _0x243fdb['status'](_0x3c9500)['json'](_0x8caadf);}};}function respondWithFilteredResult(_0x3785e9,_0x490380){return function(_0x550587){if(_0x550587){var _0x4a635e=typeof _0x490380[_0xb00b('0x25')]===_0xb00b('0x26')&&typeof _0x490380[_0xb00b('0x27')]===_0xb00b('0x26');var _0x1f14fa=_0x550587[_0xb00b('0x28')];var _0x15d3b9=_0x4a635e?0x0:_0x490380['offset'];var _0x22c22d=_0x4a635e?_0x550587['count']:_0x490380[_0xb00b('0x25')]+_0x490380[_0xb00b('0x27')];var _0x5424ca;if(_0x22c22d>=_0x1f14fa){_0x22c22d=_0x1f14fa;_0x5424ca=0xc8;}else{_0x5424ca=0xce;}_0x3785e9['status'](_0x5424ca);return _0x3785e9[_0xb00b('0x29')](_0xb00b('0x2a'),_0x15d3b9+'-'+_0x22c22d+'/'+_0x1f14fa)[_0xb00b('0x2b')](_0x550587);}return null;};}function patchUpdates(_0x183233){return function(_0x303625){try{jsonpatch[_0xb00b('0x2c')](_0x303625,_0x183233,!![]);}catch(_0x2e160a){return BPromise[_0xb00b('0x2d')](_0x2e160a);}return _0x303625[_0xb00b('0x2e')]();};}function saveUpdates(_0x54e247,_0x2b5f41){return function(_0x44918d){if(_0x44918d){return _0x44918d['update'](_0x54e247)[_0xb00b('0x2f')](function(_0x2f3b37){return _0x2f3b37;});}return null;};}function removeEntity(_0x5a5e5a,_0x456241){return function(_0x4d2ee5){if(_0x4d2ee5){return _0x4d2ee5[_0xb00b('0x30')]()[_0xb00b('0x2f')](function(){var _0x322879=_0x4d2ee5[_0xb00b('0x31')]({'plain':!![]});var _0x338864=_0xb00b('0x32');return db[_0xb00b('0x33')]['destroy']({'where':{'type':_0x338864,'resourceId':_0x322879['id']}})['then'](function(){return _0x4d2ee5;});})['then'](function(){_0x5a5e5a[_0xb00b('0x34')](0xcc)[_0xb00b('0x24')]();});}};}function handleEntityNotFound(_0x45dcda,_0x2589cb){return function(_0x5cfa60){if(!_0x5cfa60){_0x45dcda[_0xb00b('0x23')](0x194);}return _0x5cfa60;};}function handleError(_0x266f8e,_0x341f46){_0x341f46=_0x341f46||0x1f4;return function(_0x1c7a9f){logger[_0xb00b('0x1e')](_0x1c7a9f[_0xb00b('0x35')]);if(_0x1c7a9f[_0xb00b('0x36')]){delete _0x1c7a9f[_0xb00b('0x36')];}_0x266f8e['status'](_0x341f46)['send'](_0x1c7a9f);};}exports[_0xb00b('0x37')]=function(_0x56022e,_0x1c8258){var _0x1c5400={},_0x29579b={},_0x45ca74={'count':0x0,'rows':[]};var _0x37c017=_[_0xb00b('0x38')](db[_0xb00b('0x39')]['rawAttributes'],function(_0x35f1ca){return{'name':_0x35f1ca[_0xb00b('0x3a')],'type':_0x35f1ca[_0xb00b('0x3b')][_0xb00b('0x3c')]};});_0x29579b[_0xb00b('0x3d')]=_[_0xb00b('0x38')](_0x37c017,'name');_0x29579b[_0xb00b('0x3e')]=_[_0xb00b('0x3f')](_0x56022e['query']);_0x29579b[_0xb00b('0x40')]=_[_0xb00b('0x41')](_0x29579b[_0xb00b('0x3d')],_0x29579b[_0xb00b('0x3e')]);_0x1c5400[_0xb00b('0x42')]=_['intersection'](_0x29579b[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x1c5400['attributes']=_0x1c5400['attributes'][_0xb00b('0x44')]?_0x1c5400[_0xb00b('0x42')]:_0x29579b[_0xb00b('0x3d')];if(!_0x56022e[_0xb00b('0x3e')][_0xb00b('0x45')](_0xb00b('0x46'))){_0x1c5400[_0xb00b('0x27')]=qs['limit'](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x27')]);_0x1c5400[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x25')]);}_0x1c5400[_0xb00b('0x47')]=qs[_0xb00b('0x48')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x48')]);_0x1c5400[_0xb00b('0x49')]=qs[_0xb00b('0x40')](_['pick'](_0x56022e[_0xb00b('0x3e')],_0x29579b[_0xb00b('0x40')]),_0x37c017);if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4a')]){_0x1c5400[_0xb00b('0x49')]=_[_0xb00b('0x4b')](_0x1c5400[_0xb00b('0x49')],{'$or':_[_0xb00b('0x38')](_0x37c017,function(_0x10ba60){if(_0x10ba60[_0xb00b('0x3b')]!==_0xb00b('0x4c')){var _0x3b3031={};_0x3b3031[_0x10ba60['name']]={'$like':'%'+_0x56022e['query']['filter']+'%'};return _0x3b3031;}})});}_0x1c5400=_[_0xb00b('0x4b')]({},_0x1c5400,_0x56022e[_0xb00b('0x4d')]);var _0x481154={'where':_0x1c5400[_0xb00b('0x49')]};return db[_0xb00b('0x39')][_0xb00b('0x28')](_0x481154)[_0xb00b('0x2f')](function(_0x4b62b3){_0x45ca74['count']=_0x4b62b3;if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x1c5400['include']=[{'all':!![]}];}return db['Trunk'][_0xb00b('0x4f')](_0x1c5400);})[_0xb00b('0x2f')](function(_0x4e0be4){_0x45ca74[_0xb00b('0x50')]=_0x4e0be4;return _0x45ca74;})['then'](respondWithFilteredResult(_0x1c8258,_0x1c5400))['catch'](handleError(_0x1c8258,null));};exports['show']=function(_0x465d90,_0x481515){var _0x1f7b86={'raw':![],'where':{'id':_0x465d90[_0xb00b('0x51')]['id']}},_0x3178aa={};_0x3178aa[_0xb00b('0x3d')]=_[_0xb00b('0x3f')](db[_0xb00b('0x39')]['rawAttributes']);_0x3178aa['query']=_[_0xb00b('0x3f')](_0x465d90[_0xb00b('0x3e')]);_0x3178aa['filters']=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],_0x3178aa['query']);_0x1f7b86[_0xb00b('0x42')]=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],qs['fields'](_0x465d90['query'][_0xb00b('0x43')]));_0x1f7b86[_0xb00b('0x42')]=_0x1f7b86[_0xb00b('0x42')][_0xb00b('0x44')]?_0x1f7b86['attributes']:_0x3178aa[_0xb00b('0x3d')];if(_0x465d90[_0xb00b('0x3e')]['includeAll']){_0x1f7b86['include']=[{'all':!![]}];}_0x1f7b86=_[_0xb00b('0x4b')]({},_0x1f7b86,_0x465d90['options']);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x1f7b86)[_0xb00b('0x2f')](handleEntityNotFound(_0x481515,null))[_0xb00b('0x2f')](respondWithResult(_0x481515,null))[_0xb00b('0x22')](handleError(_0x481515,null));};exports[_0xb00b('0x53')]=function(_0x5a3b85,_0x5d52a5){var _0x51c9e3={'where':{'id':_0x5a3b85[_0xb00b('0x51')]['id']}},_0x37d4d2={};_0x37d4d2[_0xb00b('0x3d')]=_['keys'](db[_0xb00b('0x39')][_0xb00b('0x54')]);_0x51c9e3[_0xb00b('0x42')]=_['intersection'](_0x37d4d2[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x51c9e3[_0xb00b('0x42')]=_0x51c9e3[_0xb00b('0x42')][_0xb00b('0x44')]?_0x51c9e3[_0xb00b('0x42')]:_0x37d4d2['model'];if(_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x51c9e3[_0xb00b('0x55')]=[{'all':!![]}];}_0x51c9e3=_['merge']({},_0x51c9e3,_0x5a3b85[_0xb00b('0x4d')]);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x51c9e3)[_0xb00b('0x2f')](handleEntityNotFound(_0x5d52a5,null))[_0xb00b('0x2f')](function(_0x4bfe0b){if(_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b[_0xb00b('0x31')]({'plain':!![]});_0xfd4ecc=qs[_0xb00b('0x56')](_0xfd4ecc,['id',_0xb00b('0x57'),'updatedAt']);_0x5a3b85[_0xb00b('0x58')]=_[_0xb00b('0x56')](_0x5a3b85[_0xb00b('0x58')],['id',_0xb00b('0x57'),_0xb00b('0x59')]);return db[_0xb00b('0x39')][_0xb00b('0x5a')](_['merge'](_0xfd4ecc,_0x5a3b85[_0xb00b('0x58')]),{'include':_0x5a3b85['query'][_0xb00b('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x3b3272){var _0x530d4a=_0x5a3b85[_0xb00b('0x5b')]['get']({'plain':!![]});if(!_0x530d4a)throw new Error(_0xb00b('0x5c'));if(_0x530d4a[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x4d1cec=_0x3b3272['get']({'plain':!![]});var _0x4f7a59=_0xb00b('0x32');return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0x4f7a59,'userProfileId':_0x530d4a['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37ae88){if(_0x37ae88&&_0x37ae88[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x4d1cec['name'],'resourceId':_0x4d1cec['id'],'type':_0x37ae88[_0xb00b('0x36')],'sectionId':_0x37ae88['id']},{})[_0xb00b('0x2f')](function(){return _0x3b3272;});}else{return _0x3b3272;}})['catch'](function(_0xe1316d){logger[_0xb00b('0x1e')](_0xb00b('0x60'),_0xe1316d);throw _0xe1316d;});}return _0x3b3272;});}})['then'](respondWithResult(_0x5d52a5,0xc9))['catch'](handleError(_0x5d52a5,null));};exports[_0xb00b('0x5a')]=function(_0x188da7,_0x23762e,_0x49f0a2){var _0x5aac5f;return db['Trunk']['create'](_0x188da7[_0xb00b('0x58')],{'raw':!![]})['then'](function(_0x2434a0){_0x5aac5f=_0x2434a0;return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x1e7f3a){var _0x2d21ec=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0x3d4482=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config[_0xb00b('0x65')],_0xb00b('0x66')),'utf8');var _0x27b3ae=ejs[_0xb00b('0x67')](_0x2d21ec,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x27b3ae);if(_0x5aac5f[_0xb00b('0x6a')]){var _0x432b68=ejs[_0xb00b('0x67')](_0x3d4482,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x432b68);}})[_0xb00b('0x2f')](function(){return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x5a'),{'module':_0xb00b('0x6c')});})[_0xb00b('0x2f')](function(){var _0xfb2b68=_0x188da7[_0xb00b('0x5b')][_0xb00b('0x31')]({'plain':!![]});if(!_0xfb2b68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfb2b68[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x7803a0=_0x5aac5f[_0xb00b('0x31')]({'plain':!![]});return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0xb00b('0x32'),'userProfileId':_0xfb2b68['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37a4c0){if(_0x37a4c0&&_0x37a4c0[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x7803a0[_0xb00b('0x36')],'resourceId':_0x7803a0['id'],'type':_0x37a4c0['name'],'sectionId':_0x37a4c0['id']},{})[_0xb00b('0x2f')](function(){return _0x5aac5f;});}else{return _0x5aac5f;}})['catch'](function(_0x135cbf){logger['error'](_0xb00b('0x60'),_0x135cbf);throw _0x135cbf;});}return _0x5aac5f;})[_0xb00b('0x2f')](respondWithResult(_0x23762e,0xc9))[_0xb00b('0x22')](handleError(_0x23762e,null));};exports['update']=function(_0x5287cc,_0x9ad1c6,_0x3c4850){var _0x33a483;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0x5287cc[_0xb00b('0x51')]['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x9ad1c6,null))[_0xb00b('0x2f')](saveUpdates(_0x5287cc[_0xb00b('0x58')],null))[_0xb00b('0x2f')](function(_0x257430){if(_0x257430){_0x33a483=_0x257430;return db[_0xb00b('0x39')][_0xb00b('0x4f')]({'raw':!![]});}})[_0xb00b('0x2f')](function(_0x4eb17d){if(_0x4eb17d){var _0x59503c=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],'server/files/templates/trunk.ejs'),_0xb00b('0x64'));var _0x391e98=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],_0xb00b('0x66')),_0xb00b('0x64'));var _0x45c9cd=ejs[_0xb00b('0x67')](_0x59503c,{'trunks':_0x4eb17d||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x45c9cd);var _0x4a9125=ejs[_0xb00b('0x67')](_0x391e98,{'trunks':_0x4eb17d||[]});fs['writeFileSync'](_0xb00b('0x6d'),_0x4a9125);return respondWithRpcPromise(_0xb00b('0x6b'),'update',{'module':_0xb00b('0x6c')});}return null;})[_0xb00b('0x2f')](function(_0xe80a21){if(_0xe80a21){return _0x33a483;}})[_0xb00b('0x2f')](respondWithResult(_0x9ad1c6,null))[_0xb00b('0x22')](handleError(_0x9ad1c6,null));};exports[_0xb00b('0x30')]=function(_0xc41c1f,_0x2423b2,_0x36ba5c){var _0x383d16;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0xc41c1f['params']['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x2423b2,null))[_0xb00b('0x2f')](removeEntity(_0x2423b2,null))[_0xb00b('0x2f')](function(){return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x17503d){var _0x32508b=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0xa4fe1e=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],'server/files/templates/registry.ejs'),_0xb00b('0x64'));var _0x202d5f=ejs[_0xb00b('0x67')](_0x32508b,{'trunks':_0x17503d});var _0x165442=ejs[_0xb00b('0x67')](_0xa4fe1e,{'trunks':_0x17503d});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x202d5f);fs[_0xb00b('0x68')](_0xb00b('0x6d'),_0x165442);return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x30'),{'module':'chan_sip.so'});})[_0xb00b('0x22')](handleError(_0x2423b2,null));}; \ No newline at end of file +var _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x866d49,_0xd5178a){var _0x10ac13=function(_0xa1f62a){while(--_0xa1f62a){_0x866d49['push'](_0x866d49['shift']());}};_0x10ac13(++_0xd5178a);}(_0xe14d,0x1ee));var _0xde14=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xe14d[_0xc6be3a];return _0x56a310;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index d34fb8e..9a6777f 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 _0x5a61=['bluebird','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','api'];(function(_0x26d016,_0x14d83d){var _0x14bdbb=function(_0x80f52e){while(--_0x80f52e){_0x26d016['push'](_0x26d016['shift']());}};_0x14bdbb(++_0x14d83d);}(_0x5a61,0x195));var _0x15a6=function(_0x1f0e4e,_0x3f1426){_0x1f0e4e=_0x1f0e4e-0x0;var _0x5c5564=_0x5a61[_0x1f0e4e];return _0x5c5564;};'use strict';var _=require(_0x15a6('0x0'));var util=require(_0x15a6('0x1'));var logger=require('../../config/logger')(_0x15a6('0x2'));var moment=require('moment');var BPromise=require(_0x15a6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x15a6('0x4'));var rimraf=require(_0x15a6('0x5'));var config=require(_0x15a6('0x6'));var attributes=require(_0x15a6('0x7'));module[_0x15a6('0x8')]=function(_0x4b4e95,_0x2070fc){return _0x4b4e95[_0x15a6('0x9')](_0x15a6('0xa'),attributes,{'tableName':_0x15a6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb14=['util','api','moment','bluebird','path','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash'];(function(_0x3f28da,_0x3a928a){var _0x39e451=function(_0x146112){while(--_0x146112){_0x3f28da['push'](_0x3f28da['shift']());}};_0x39e451(++_0x3a928a);}(_0xbb14,0x1a1));var _0x4bb1=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbb14[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x4bb1('0x0'));var util=require(_0x4bb1('0x1'));var logger=require('../../config/logger')(_0x4bb1('0x2'));var moment=require(_0x4bb1('0x3'));var BPromise=require(_0x4bb1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bb1('0x5'));var rimraf=require('rimraf');var config=require(_0x4bb1('0x6'));var attributes=require(_0x4bb1('0x7'));module[_0x4bb1('0x8')]=function(_0x59a3e5,_0x43e348){return _0x59a3e5['define'](_0x4bb1('0x9'),attributes,{'tableName':_0x4bb1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index bbb2b30..c0ac7eb 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 _0x3750=['limit','include','map','model','then','GetTrunk','stringify','ShowTrunk','attributes','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','findAll','options','raw','where'];(function(_0x3452a8,_0x4bfaa4){var _0x233814=function(_0x40b537){while(--_0x40b537){_0x3452a8['push'](_0x3452a8['shift']());}};_0x233814(++_0x4bfaa4);}(_0x3750,0x6c));var _0x0375=function(_0x195c21,_0x332612){_0x195c21=_0x195c21-0x0;var _0x3576a8=_0x3750[_0x195c21];return _0x3576a8;};'use strict';var _=require('lodash');var util=require(_0x0375('0x0'));var moment=require(_0x0375('0x1'));var BPromise=require(_0x0375('0x2'));var rs=require(_0x0375('0x3'));var fs=require('fs');var Redis=require(_0x0375('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0375('0x5'));var logger=require(_0x0375('0x6'))(_0x0375('0x7'));var config=require(_0x0375('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0375('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c3545,_0x1b863a,_0x311bb9){return new BPromise(function(_0x5a3145,_0x32b3ef){return client[_0x0375('0xa')](_0x2c3545,_0x311bb9)['then'](function(_0x222cbe){logger[_0x0375('0xb')](_0x0375('0xc'),_0x1b863a,'request\x20sent');logger[_0x0375('0xd')](_0x0375('0xe'),_0x1b863a,_0x0375('0xf'),JSON['stringify'](_0x222cbe));if(_0x222cbe[_0x0375('0x10')]){if(_0x222cbe[_0x0375('0x10')]['code']===0x1f4){logger[_0x0375('0x10')](_0x0375('0xc'),_0x1b863a,_0x222cbe[_0x0375('0x10')]['message']);return _0x32b3ef(_0x222cbe[_0x0375('0x10')][_0x0375('0x11')]);}logger[_0x0375('0x10')](_0x0375('0xc'),_0x1b863a,_0x222cbe[_0x0375('0x10')]['message']);return _0x5a3145(_0x222cbe[_0x0375('0x10')][_0x0375('0x11')]);}else{logger[_0x0375('0xb')](_0x0375('0xc'),_0x1b863a,'request\x20sent');_0x5a3145(_0x222cbe[_0x0375('0x12')][_0x0375('0x11')]);}})[_0x0375('0x13')](function(_0x56b107){logger[_0x0375('0x10')]('Trunk,\x20%s,\x20%s',_0x1b863a,_0x56b107);_0x32b3ef(_0x56b107);});});}exports['GetTrunk']=function(_0x51f4af){var _0x2b511f=this;return new Promise(function(_0x2f7129,_0x44f374){return db['Trunk'][_0x0375('0x14')]({'raw':_0x51f4af['options']?_0x51f4af[_0x0375('0x15')][_0x0375('0x16')]===undefined?!![]:![]:!![],'where':_0x51f4af[_0x0375('0x15')]?_0x51f4af[_0x0375('0x15')][_0x0375('0x17')]||null:null,'attributes':_0x51f4af[_0x0375('0x15')]?_0x51f4af[_0x0375('0x15')]['attributes']||null:null,'limit':_0x51f4af[_0x0375('0x15')]?_0x51f4af[_0x0375('0x15')][_0x0375('0x18')]||null:null,'include':_0x51f4af[_0x0375('0x15')]?_0x51f4af[_0x0375('0x15')][_0x0375('0x19')]?_[_0x0375('0x1a')](_0x51f4af[_0x0375('0x15')][_0x0375('0x19')],function(_0x59f8fa){return{'model':db[_0x59f8fa['model']],'as':_0x59f8fa['as'],'attributes':_0x59f8fa['attributes'],'include':_0x59f8fa[_0x0375('0x19')]?_[_0x0375('0x1a')](_0x59f8fa[_0x0375('0x19')],function(_0x2b354a){return{'model':db[_0x2b354a[_0x0375('0x1b')]],'as':_0x2b354a['as'],'attributes':_0x2b354a['attributes'],'include':_0x2b354a[_0x0375('0x19')]?_['map'](_0x2b354a[_0x0375('0x19')],function(_0x1fec17){return{'model':db[_0x1fec17[_0x0375('0x1b')]],'as':_0x1fec17['as'],'attributes':_0x1fec17['attributes']};}):[]};}):[]};}):[]:[]})[_0x0375('0x1c')](function(_0x4769fe){logger[_0x0375('0xb')](_0x0375('0x1d'),_0x51f4af);logger[_0x0375('0xd')](_0x0375('0x1d'),_0x51f4af,JSON[_0x0375('0x1e')](_0x4769fe));_0x2f7129(_0x4769fe);})['catch'](function(_0x3548b6){logger[_0x0375('0x10')](_0x0375('0x1d'),_0x3548b6['message'],_0x51f4af);_0x44f374(_0x2b511f['error'](0x1f4,_0x3548b6[_0x0375('0x11')]));});});};exports[_0x0375('0x1f')]=function(_0x17e96f){var _0x40e184=this;return new Promise(function(_0x349a3e,_0x2e5df7){return db['Trunk']['find']({'raw':_0x17e96f[_0x0375('0x15')]?_0x17e96f[_0x0375('0x15')][_0x0375('0x16')]===undefined?!![]:![]:!![],'where':_0x17e96f[_0x0375('0x15')]?_0x17e96f[_0x0375('0x15')][_0x0375('0x17')]||null:null,'attributes':_0x17e96f[_0x0375('0x15')]?_0x17e96f[_0x0375('0x15')][_0x0375('0x20')]||null:null,'include':_0x17e96f[_0x0375('0x15')]?_0x17e96f[_0x0375('0x15')][_0x0375('0x19')]?_[_0x0375('0x1a')](_0x17e96f[_0x0375('0x15')][_0x0375('0x19')],function(_0x570143){return{'model':db[_0x570143[_0x0375('0x1b')]],'as':_0x570143['as'],'attributes':_0x570143[_0x0375('0x20')],'include':_0x570143[_0x0375('0x19')]?_['map'](_0x570143['include'],function(_0x419494){return{'model':db[_0x419494[_0x0375('0x1b')]],'as':_0x419494['as'],'attributes':_0x419494['attributes'],'include':_0x419494['include']?_[_0x0375('0x1a')](_0x419494[_0x0375('0x19')],function(_0x3e4adc){return{'model':db[_0x3e4adc[_0x0375('0x1b')]],'as':_0x3e4adc['as'],'attributes':_0x3e4adc['attributes']};}):[]};}):[]};}):[]:[]})[_0x0375('0x1c')](function(_0x18197b){logger[_0x0375('0xb')]('ShowTrunk',_0x17e96f);logger[_0x0375('0xd')](_0x0375('0x1f'),_0x17e96f,JSON[_0x0375('0x1e')](_0x18197b));_0x349a3e(_0x18197b);})[_0x0375('0x13')](function(_0x412269){logger[_0x0375('0x10')](_0x0375('0x1f'),_0x412269['message'],_0x17e96f);_0x2e5df7(_0x40e184[_0x0375('0x10')](0x1f4,_0x412269['message']));});});}; \ No newline at end of file +var _0xd5f1=['../../config/environment','jayson/promise','client','http','request','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','options','raw','where','limit','include','map','model','attributes','then','GetTrunk','ShowTrunk','Trunk','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x47c2f9,_0x4d8900){var _0x35096f=function(_0x3e51a8){while(--_0x3e51a8){_0x47c2f9['push'](_0x47c2f9['shift']());}};_0x35096f(++_0x4d8900);}(_0xd5f1,0x1e5));var _0x1d5f=function(_0x5d245d,_0x39a2e6){_0x5d245d=_0x5d245d-0x0;var _0x3e113d=_0xd5f1[_0x5d245d];return _0x3e113d;};'use strict';var _=require(_0x1d5f('0x0'));var util=require('util');var moment=require(_0x1d5f('0x1'));var BPromise=require(_0x1d5f('0x2'));var rs=require(_0x1d5f('0x3'));var fs=require('fs');var Redis=require(_0x1d5f('0x4'));var db=require(_0x1d5f('0x5'))['db'];var utils=require(_0x1d5f('0x6'));var logger=require(_0x1d5f('0x7'))(_0x1d5f('0x8'));var config=require(_0x1d5f('0x9'));var jayson=require(_0x1d5f('0xa'));var client=jayson[_0x1d5f('0xb')][_0x1d5f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x351faf,_0x50a7e9,_0x12a8d5){return new BPromise(function(_0x24936a,_0xb457ab){return client[_0x1d5f('0xd')](_0x351faf,_0x12a8d5)['then'](function(_0x219e69){logger['info'](_0x1d5f('0xe'),_0x50a7e9,_0x1d5f('0xf'));logger[_0x1d5f('0x10')](_0x1d5f('0x11'),_0x50a7e9,'request\x20sent',JSON[_0x1d5f('0x12')](_0x219e69));if(_0x219e69['error']){if(_0x219e69[_0x1d5f('0x13')][_0x1d5f('0x14')]===0x1f4){logger[_0x1d5f('0x13')]('Trunk,\x20%s,\x20%s',_0x50a7e9,_0x219e69['error']['message']);return _0xb457ab(_0x219e69[_0x1d5f('0x13')][_0x1d5f('0x15')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x50a7e9,_0x219e69[_0x1d5f('0x13')]['message']);return _0x24936a(_0x219e69[_0x1d5f('0x13')][_0x1d5f('0x15')]);}else{logger[_0x1d5f('0x16')](_0x1d5f('0xe'),_0x50a7e9,_0x1d5f('0xf'));_0x24936a(_0x219e69[_0x1d5f('0x17')][_0x1d5f('0x15')]);}})[_0x1d5f('0x18')](function(_0x366463){logger[_0x1d5f('0x13')]('Trunk,\x20%s,\x20%s',_0x50a7e9,_0x366463);_0xb457ab(_0x366463);});});}exports['GetTrunk']=function(_0x60cfb6){var _0x2562e8=this;return new Promise(function(_0x394fc5,_0x424f38){return db['Trunk']['findAll']({'raw':_0x60cfb6[_0x1d5f('0x19')]?_0x60cfb6[_0x1d5f('0x19')][_0x1d5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x60cfb6[_0x1d5f('0x19')]?_0x60cfb6[_0x1d5f('0x19')][_0x1d5f('0x1b')]||null:null,'attributes':_0x60cfb6['options']?_0x60cfb6['options']['attributes']||null:null,'limit':_0x60cfb6['options']?_0x60cfb6['options'][_0x1d5f('0x1c')]||null:null,'include':_0x60cfb6[_0x1d5f('0x19')]?_0x60cfb6[_0x1d5f('0x19')][_0x1d5f('0x1d')]?_[_0x1d5f('0x1e')](_0x60cfb6[_0x1d5f('0x19')][_0x1d5f('0x1d')],function(_0x3c9376){return{'model':db[_0x3c9376[_0x1d5f('0x1f')]],'as':_0x3c9376['as'],'attributes':_0x3c9376[_0x1d5f('0x20')],'include':_0x3c9376[_0x1d5f('0x1d')]?_['map'](_0x3c9376[_0x1d5f('0x1d')],function(_0x438c9f){return{'model':db[_0x438c9f[_0x1d5f('0x1f')]],'as':_0x438c9f['as'],'attributes':_0x438c9f['attributes'],'include':_0x438c9f['include']?_[_0x1d5f('0x1e')](_0x438c9f['include'],function(_0x5ef127){return{'model':db[_0x5ef127[_0x1d5f('0x1f')]],'as':_0x5ef127['as'],'attributes':_0x5ef127[_0x1d5f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1d5f('0x21')](function(_0x4c3de3){logger[_0x1d5f('0x16')]('GetTrunk',_0x60cfb6);logger[_0x1d5f('0x10')](_0x1d5f('0x22'),_0x60cfb6,JSON[_0x1d5f('0x12')](_0x4c3de3));_0x394fc5(_0x4c3de3);})[_0x1d5f('0x18')](function(_0x17549e){logger[_0x1d5f('0x13')](_0x1d5f('0x22'),_0x17549e[_0x1d5f('0x15')],_0x60cfb6);_0x424f38(_0x2562e8['error'](0x1f4,_0x17549e[_0x1d5f('0x15')]));});});};exports[_0x1d5f('0x23')]=function(_0x27d0d8){var _0x4e96a9=this;return new Promise(function(_0x2f220d,_0x44fe59){return db[_0x1d5f('0x24')][_0x1d5f('0x25')]({'raw':_0x27d0d8[_0x1d5f('0x19')]?_0x27d0d8[_0x1d5f('0x19')][_0x1d5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x27d0d8['options']?_0x27d0d8[_0x1d5f('0x19')][_0x1d5f('0x1b')]||null:null,'attributes':_0x27d0d8['options']?_0x27d0d8[_0x1d5f('0x19')][_0x1d5f('0x20')]||null:null,'include':_0x27d0d8[_0x1d5f('0x19')]?_0x27d0d8[_0x1d5f('0x19')][_0x1d5f('0x1d')]?_[_0x1d5f('0x1e')](_0x27d0d8[_0x1d5f('0x19')][_0x1d5f('0x1d')],function(_0x163b6a){return{'model':db[_0x163b6a[_0x1d5f('0x1f')]],'as':_0x163b6a['as'],'attributes':_0x163b6a[_0x1d5f('0x20')],'include':_0x163b6a['include']?_[_0x1d5f('0x1e')](_0x163b6a[_0x1d5f('0x1d')],function(_0x523f61){return{'model':db[_0x523f61['model']],'as':_0x523f61['as'],'attributes':_0x523f61[_0x1d5f('0x20')],'include':_0x523f61[_0x1d5f('0x1d')]?_[_0x1d5f('0x1e')](_0x523f61['include'],function(_0xd47227){return{'model':db[_0xd47227['model']],'as':_0xd47227['as'],'attributes':_0xd47227[_0x1d5f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1d5f('0x21')](function(_0x59d783){logger[_0x1d5f('0x16')]('ShowTrunk',_0x27d0d8);logger[_0x1d5f('0x10')](_0x1d5f('0x23'),_0x27d0d8,JSON[_0x1d5f('0x12')](_0x59d783));_0x2f220d(_0x59d783);})[_0x1d5f('0x18')](function(_0x3ced10){logger[_0x1d5f('0x13')](_0x1d5f('0x23'),_0x3ced10['message'],_0x27d0d8);_0x44fe59(_0x4e96a9[_0x1d5f('0x13')](0x1f4,_0x3ced10[_0x1d5f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 88389f0..32a88ca 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 _0xaa3f=['getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','addQueues','diskStorage','server/files/images/','%s-%s','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','/:id/api_key','put','/:id','update','/:id/password','changePassword','delete','removeTeams','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','getVoiceQueuesRt','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists'];(function(_0x4ea434,_0x2aaef7){var _0x2b963b=function(_0x4f122d){while(--_0x4f122d){_0x4ea434['push'](_0x4ea434['shift']());}};_0x2b963b(++_0x2aaef7);}(_0xaa3f,0x198));var _0xfaa3=function(_0x3a0624,_0x399cde){_0x3a0624=_0x3a0624-0x0;var _0x43268f=_0xaa3f[_0x3a0624];return _0x43268f;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfaa3('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfaa3('0x2'));var interaction=require(_0xfaa3('0x3'));var config=require(_0xfaa3('0x4'));var controller=require(_0xfaa3('0x5'));router[_0xfaa3('0x6')]('/',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x8')]);router['get'](_0xfaa3('0x9'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0xa')]);router[_0xfaa3('0x6')](_0xfaa3('0xb'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0xc')]);router['get'](_0xfaa3('0xd'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0xe')]);router[_0xfaa3('0x6')]('/:id',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0xf')]);router['get'](_0xfaa3('0x10'),controller[_0xfaa3('0x11')]);router[_0xfaa3('0x6')](_0xfaa3('0x12'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x13')]);router[_0xfaa3('0x6')](_0xfaa3('0x14'),auth[_0xfaa3('0x7')](),controller['getContacts']);router[_0xfaa3('0x6')](_0xfaa3('0x15'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x16')]);router[_0xfaa3('0x6')]('/:id/queues_rt',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x17')]);router[_0xfaa3('0x6')]('/:id/groups',auth['isAuthenticated'](),controller[_0xfaa3('0x18')]);router[_0xfaa3('0x6')](_0xfaa3('0x19'),auth['isAuthenticated'](),controller['getRecordings']);router[_0xfaa3('0x6')](_0xfaa3('0x1a'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x1b')]);router[_0xfaa3('0x6')](_0xfaa3('0x1c'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x1d')]);router['get'](_0xfaa3('0x1e'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x1f')]);router[_0xfaa3('0x6')](_0xfaa3('0x20'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x21')]);router['get'](_0xfaa3('0x22'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0xfaa3('0x6')]('/:id/fax/interactions',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x23')]);router[_0xfaa3('0x6')](_0xfaa3('0x24'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0xfaa3('0x6')](_0xfaa3('0x25'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x26')]);router[_0xfaa3('0x6')](_0xfaa3('0x27'),auth['isAuthenticated'](),controller[_0xfaa3('0x28')]);router[_0xfaa3('0x6')](_0xfaa3('0x29'),auth['isAuthenticated'](),controller[_0xfaa3('0x2a')]);router['get'](_0xfaa3('0x2b'),auth['isAuthenticated'](),controller[_0xfaa3('0x2c')]);router[_0xfaa3('0x6')](_0xfaa3('0x2d'),auth[_0xfaa3('0x7')](),controller['getFaxAccounts']);router['get'](_0xfaa3('0x2e'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x2f')]);router[_0xfaa3('0x6')](_0xfaa3('0x30'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x31')]);router[_0xfaa3('0x6')](_0xfaa3('0x32'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x33')]);router['get'](_0xfaa3('0x34'),auth['isAuthenticated'](),controller[_0xfaa3('0x35')]);router[_0xfaa3('0x6')](_0xfaa3('0x36'),auth[_0xfaa3('0x7')](),controller['getWhatsappAccounts']);router[_0xfaa3('0x6')](_0xfaa3('0x37'),auth['isAuthenticated'](),controller[_0xfaa3('0x38')]);router['get'](_0xfaa3('0x39'),auth['isAuthenticated'](),controller[_0xfaa3('0x3a')]);router['get']('/:id/api_key',auth['isAuthenticated'](),controller[_0xfaa3('0x3b')]);router[_0xfaa3('0x3c')](_0xfaa3('0x14'),auth['isAuthenticated'](),controller[_0xfaa3('0x3d')]);router['post']('/',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x3e')]);router['post'](_0xfaa3('0x3f'),auth[_0xfaa3('0x7')](),controller['bulkCreate']);router[_0xfaa3('0x3c')](_0xfaa3('0x15'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x40')]);var upload=multer({'storage':multer[_0xfaa3('0x41')]({'destination':function(_0x2447df,_0x1b2c63,_0x1d54a){_0x1d54a(null,path['join'](config['root'],_0xfaa3('0x42')));},'filename':function(_0x18748b,_0x5cdbfd,_0x13b683){_0x13b683(null,util['format'](_0xfaa3('0x43'),Date['now'](),_0x5cdbfd['originalname']));}})});router[_0xfaa3('0x3c')](_0xfaa3('0x10'),upload[_0xfaa3('0x44')](_0xfaa3('0x45')),controller[_0xfaa3('0x46')]);router[_0xfaa3('0x3c')](_0xfaa3('0x47'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x48')]);router[_0xfaa3('0x3c')](_0xfaa3('0x49'),auth['isAuthenticated'](),controller[_0xfaa3('0x4a')]);router[_0xfaa3('0x3c')](_0xfaa3('0x4b'),auth[_0xfaa3('0x7')](),controller['pause']);router[_0xfaa3('0x3c')]('/:id/unpause',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x4c')]);router['post'](_0xfaa3('0x25'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x4d')]);router[_0xfaa3('0x3c')](_0xfaa3('0x4e'),auth[_0xfaa3('0x7')](),controller['addChatInteractions']);router[_0xfaa3('0x3c')](_0xfaa3('0x4f'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x50')]);router['post'](_0xfaa3('0x51'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x52')]);router[_0xfaa3('0x3c')](_0xfaa3('0x53'),auth[_0xfaa3('0x7')](),controller['addSmsInteractions']);router[_0xfaa3('0x3c')](_0xfaa3('0x54'),auth['isAuthenticated'](),controller[_0xfaa3('0x55')]);router[_0xfaa3('0x3c')]('/:id/whatsapp_interactions',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x56')]);router[_0xfaa3('0x3c')](_0xfaa3('0x2d'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x57')]);router[_0xfaa3('0x3c')](_0xfaa3('0x2e'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x58')]);router['post'](_0xfaa3('0x30'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x59')]);router[_0xfaa3('0x3c')](_0xfaa3('0x32'),auth[_0xfaa3('0x7')](),controller['addSmsAccounts']);router[_0xfaa3('0x3c')](_0xfaa3('0x34'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x5a')]);router['post'](_0xfaa3('0x36'),auth[_0xfaa3('0x7')](),controller['addWhatsappAccounts']);router[_0xfaa3('0x3c')](_0xfaa3('0x37'),auth[_0xfaa3('0x7')](),controller['addSquareProjects']);router[_0xfaa3('0x3c')](_0xfaa3('0x5b'),auth[_0xfaa3('0x7')](),controller['createApiKey']);router[_0xfaa3('0x5c')](_0xfaa3('0x5d'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x5e')]);router[_0xfaa3('0x5c')](_0xfaa3('0x5f'),auth['isAuthenticated'](),controller[_0xfaa3('0x60')]);router[_0xfaa3('0x61')](_0xfaa3('0x15'),auth[_0xfaa3('0x7')](),controller['removeQueues']);router['delete']('/:id/teams',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x62')]);router[_0xfaa3('0x61')]('/:id',auth[_0xfaa3('0x7')](),controller['destroy']);router['delete'](_0xfaa3('0x4e'),auth['isAuthenticated'](),controller[_0xfaa3('0x63')]);router[_0xfaa3('0x61')](_0xfaa3('0x4f'),auth[_0xfaa3('0x7')](),controller['removeMailInteractions']);router[_0xfaa3('0x61')](_0xfaa3('0x51'),auth['isAuthenticated'](),controller[_0xfaa3('0x64')]);router[_0xfaa3('0x61')](_0xfaa3('0x53'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x65')]);router[_0xfaa3('0x61')](_0xfaa3('0x54'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x66')]);router[_0xfaa3('0x61')](_0xfaa3('0x67'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x68')]);router[_0xfaa3('0x61')](_0xfaa3('0x2d'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x69')]);router[_0xfaa3('0x61')]('/:id/mail_accounts',auth[_0xfaa3('0x7')](),controller['removeMailAccounts']);router[_0xfaa3('0x61')](_0xfaa3('0x30'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x6a')]);router['delete'](_0xfaa3('0x32'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x6b')]);router[_0xfaa3('0x61')]('/:id/chat_websites',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x6c')]);router[_0xfaa3('0x61')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0xfaa3('0x61')](_0xfaa3('0x37'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x6d')]);router[_0xfaa3('0x61')](_0xfaa3('0x5b'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0x6e')]);module[_0xfaa3('0x6f')]=router; \ No newline at end of file +var _0x21e5=['getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','/:id/teams','getTeams','getLists','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','now','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','/:id/api_key','createApiKey','put','/:id/password','changePassword','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','delete','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/presence','/:id','/:id/avatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions'];(function(_0x3084de,_0x55d4fa){var _0x3596fa=function(_0x22bd50){while(--_0x22bd50){_0x3084de['push'](_0x3084de['shift']());}};_0x3596fa(++_0x55d4fa);}(_0x21e5,0x1a5));var _0x521e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x21e5[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x521e('0x0'));var util=require(_0x521e('0x1'));var path=require(_0x521e('0x2'));var timeout=require(_0x521e('0x3'));var express=require('express');var router=express[_0x521e('0x4')]();var fs_extra=require(_0x521e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x521e('0x6'));var config=require(_0x521e('0x7'));var controller=require(_0x521e('0x8'));router[_0x521e('0x9')]('/',auth[_0x521e('0xa')](),controller[_0x521e('0xb')]);router[_0x521e('0x9')](_0x521e('0xc'),auth[_0x521e('0xa')](),controller[_0x521e('0xd')]);router['get']('/whoami',auth[_0x521e('0xa')](),controller['whoami']);router[_0x521e('0x9')](_0x521e('0xe'),auth[_0x521e('0xa')](),controller['getPresence']);router['get'](_0x521e('0xf'),auth[_0x521e('0xa')](),controller['show']);router['get'](_0x521e('0x10'),controller['getAvatar']);router[_0x521e('0x9')]('/:id/open_tabs',auth[_0x521e('0xa')](),controller['getOpenTabs']);router[_0x521e('0x9')](_0x521e('0x11'),auth[_0x521e('0xa')](),controller[_0x521e('0x12')]);router[_0x521e('0x9')](_0x521e('0x13'),auth[_0x521e('0xa')](),controller[_0x521e('0x14')]);router[_0x521e('0x9')](_0x521e('0x15'),auth[_0x521e('0xa')](),controller['getVoiceQueuesRt']);router[_0x521e('0x9')](_0x521e('0x16'),auth[_0x521e('0xa')](),controller['getGroups']);router[_0x521e('0x9')]('/:id/recordings',auth['isAuthenticated'](),controller['getRecordings']);router['get'](_0x521e('0x17'),auth['isAuthenticated'](),controller[_0x521e('0x18')]);router[_0x521e('0x9')](_0x521e('0x19'),auth['isAuthenticated'](),controller[_0x521e('0x1a')]);router[_0x521e('0x9')]('/:id/openchannel/interactions',auth[_0x521e('0xa')](),controller[_0x521e('0x1b')]);router[_0x521e('0x9')](_0x521e('0x1c'),auth[_0x521e('0xa')](),controller['getMailInteractions']);router[_0x521e('0x9')](_0x521e('0x1d'),auth['isAuthenticated'](),controller[_0x521e('0x1e')]);router[_0x521e('0x9')](_0x521e('0x1f'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0x521e('0x9')](_0x521e('0x20'),auth[_0x521e('0xa')](),controller['getWhatsappInteractions']);router[_0x521e('0x9')](_0x521e('0x21'),auth[_0x521e('0xa')](),controller[_0x521e('0x22')]);router['get']('/:id/lists',auth[_0x521e('0xa')](),controller[_0x521e('0x23')]);router[_0x521e('0x9')]('/:id/agents',auth[_0x521e('0xa')](),controller['getAgents']);router[_0x521e('0x9')](_0x521e('0x24'),auth['isAuthenticated'](),controller[_0x521e('0x25')]);router['get'](_0x521e('0x26'),auth[_0x521e('0xa')](),controller['getFaxAccounts']);router[_0x521e('0x9')](_0x521e('0x27'),auth[_0x521e('0xa')](),controller['getMailAccounts']);router[_0x521e('0x9')](_0x521e('0x28'),auth['isAuthenticated'](),controller[_0x521e('0x29')]);router['get']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x521e('0x2a')]);router[_0x521e('0x9')](_0x521e('0x2b'),auth[_0x521e('0xa')](),controller['getChatWebsites']);router['get'](_0x521e('0x2c'),auth['isAuthenticated'](),controller[_0x521e('0x2d')]);router[_0x521e('0x9')]('/:id/square_projects',auth[_0x521e('0xa')](),controller[_0x521e('0x2e')]);router[_0x521e('0x9')](_0x521e('0x2f'),auth['isAuthenticated'](),controller[_0x521e('0x30')]);router[_0x521e('0x9')]('/:id/api_key',auth[_0x521e('0xa')](),controller[_0x521e('0x31')]);router[_0x521e('0x32')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x521e('0x33')]);router[_0x521e('0x32')]('/',auth['isAuthenticated'](),controller['create']);router[_0x521e('0x32')]('/create_many',auth[_0x521e('0xa')](),controller[_0x521e('0x34')]);router['post'](_0x521e('0x13'),auth[_0x521e('0xa')](),controller[_0x521e('0x35')]);var upload=multer({'storage':multer[_0x521e('0x36')]({'destination':function(_0x1351ba,_0x83cddb,_0x5f53b0){_0x5f53b0(null,path[_0x521e('0x37')](config[_0x521e('0x38')],_0x521e('0x39')));},'filename':function(_0x3a77fe,_0x33974a,_0x56c421){_0x56c421(null,util[_0x521e('0x3a')]('%s-%s',Date[_0x521e('0x3b')](),_0x33974a['originalname']));}})});router['post'](_0x521e('0x10'),upload[_0x521e('0x3c')](_0x521e('0x3d')),controller[_0x521e('0x3e')]);router[_0x521e('0x32')](_0x521e('0x3f'),auth[_0x521e('0xa')](),controller[_0x521e('0x40')]);router['post'](_0x521e('0x41'),auth[_0x521e('0xa')](),controller[_0x521e('0x42')]);router[_0x521e('0x32')](_0x521e('0x43'),auth['isAuthenticated'](),controller[_0x521e('0x44')]);router[_0x521e('0x32')](_0x521e('0x45'),auth[_0x521e('0xa')](),controller['unpause']);router[_0x521e('0x32')](_0x521e('0x21'),auth['isAuthenticated'](),controller[_0x521e('0x46')]);router[_0x521e('0x32')](_0x521e('0x47'),auth[_0x521e('0xa')](),controller[_0x521e('0x48')]);router[_0x521e('0x32')](_0x521e('0x49'),auth['isAuthenticated'](),controller[_0x521e('0x4a')]);router[_0x521e('0x32')](_0x521e('0x4b'),auth[_0x521e('0xa')](),controller[_0x521e('0x4c')]);router[_0x521e('0x32')](_0x521e('0x4d'),auth[_0x521e('0xa')](),controller[_0x521e('0x4e')]);router[_0x521e('0x32')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x521e('0x4f')]);router[_0x521e('0x32')](_0x521e('0x50'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0x521e('0x32')](_0x521e('0x26'),auth['isAuthenticated'](),controller[_0x521e('0x51')]);router[_0x521e('0x32')](_0x521e('0x27'),auth[_0x521e('0xa')](),controller[_0x521e('0x52')]);router[_0x521e('0x32')]('/:id/openchannel_accounts',auth[_0x521e('0xa')](),controller['addOpenchannelAccounts']);router['post']('/:id/sms_accounts',auth[_0x521e('0xa')](),controller['addSmsAccounts']);router['post'](_0x521e('0x2b'),auth[_0x521e('0xa')](),controller[_0x521e('0x53')]);router[_0x521e('0x32')]('/:id/whatsapp_accounts',auth[_0x521e('0xa')](),controller[_0x521e('0x54')]);router[_0x521e('0x32')](_0x521e('0x55'),auth[_0x521e('0xa')](),controller[_0x521e('0x56')]);router[_0x521e('0x32')](_0x521e('0x57'),auth[_0x521e('0xa')](),controller[_0x521e('0x58')]);router[_0x521e('0x59')]('/:id',auth[_0x521e('0xa')](),controller['update']);router[_0x521e('0x59')](_0x521e('0x5a'),auth[_0x521e('0xa')](),controller[_0x521e('0x5b')]);router['delete'](_0x521e('0x13'),auth[_0x521e('0xa')](),controller[_0x521e('0x5c')]);router['delete'](_0x521e('0x21'),auth[_0x521e('0xa')](),controller[_0x521e('0x5d')]);router['delete'](_0x521e('0xf'),auth[_0x521e('0xa')](),controller[_0x521e('0x5e')]);router['delete'](_0x521e('0x47'),auth[_0x521e('0xa')](),controller[_0x521e('0x5f')]);router['delete'](_0x521e('0x49'),auth['isAuthenticated'](),controller[_0x521e('0x60')]);router['delete'](_0x521e('0x4b'),auth[_0x521e('0xa')](),controller[_0x521e('0x61')]);router[_0x521e('0x62')](_0x521e('0x4d'),auth[_0x521e('0xa')](),controller[_0x521e('0x63')]);router[_0x521e('0x62')]('/:id/openchannel_interactions',auth[_0x521e('0xa')](),controller[_0x521e('0x64')]);router[_0x521e('0x62')](_0x521e('0x50'),auth[_0x521e('0xa')](),controller[_0x521e('0x65')]);router['delete'](_0x521e('0x26'),auth[_0x521e('0xa')](),controller[_0x521e('0x66')]);router[_0x521e('0x62')](_0x521e('0x27'),auth[_0x521e('0xa')](),controller[_0x521e('0x67')]);router[_0x521e('0x62')](_0x521e('0x28'),auth[_0x521e('0xa')](),controller[_0x521e('0x68')]);router[_0x521e('0x62')](_0x521e('0x69'),auth['isAuthenticated'](),controller[_0x521e('0x6a')]);router[_0x521e('0x62')]('/:id/chat_websites',auth[_0x521e('0xa')](),controller[_0x521e('0x6b')]);router[_0x521e('0x62')](_0x521e('0x2c'),auth[_0x521e('0xa')](),controller[_0x521e('0x6c')]);router[_0x521e('0x62')]('/:id/square_projects',auth[_0x521e('0xa')](),controller[_0x521e('0x6d')]);router[_0x521e('0x62')](_0x521e('0x57'),auth['isAuthenticated'](),controller[_0x521e('0x6e')]);module[_0x521e('0x6f')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 836167e..e9c3e75 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 _0x5162=['ENUM','admin','user','agent','local','INTEGER','internal','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','force_rport,comedia','nat','join','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','active','passive','actpass','update','update,nonat','TEXT','showWebBar','get','isArray','udp','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','force_avp','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blockedAt','UNSIGNED','sequelize','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email'];(function(_0x296273,_0xc923ae){var _0x29701b=function(_0x4b5f44){while(--_0x4b5f44){_0x296273['push'](_0x296273['shift']());}};_0x29701b(++_0xc923ae);}(_0x5162,0x103));var _0x2516=function(_0xd2f4f5,_0x341930){_0xd2f4f5=_0xd2f4f5-0x0;var _0x41fc10=_0x5162[_0xd2f4f5];return _0x41fc10;};'use strict';var Sequelize=require(_0x2516('0x0'));var moment=require('moment');var util=require('util');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x2516('0x1')],'allowNull':![],'unique':_0x2516('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3ce7de){this[_0x2516('0x3')](_0x2516('0x2'),_0x3ce7de);this[_0x2516('0x3')](_0x2516('0x4'),_0x3ce7de);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5beeb3){this[_0x2516('0x3')](_0x2516('0x5'),_0x5beeb3);this[_0x2516('0x3')](_0x2516('0x6'),util[_0x2516('0x7')](_0x2516('0x8'),_0x5beeb3,this[_0x2516('0x9')]('internal')));}},'alias':{'type':Sequelize[_0x2516('0x1')]},'email':{'type':Sequelize[_0x2516('0x1')],'allowNull':![],'unique':_0x2516('0xa'),'validate':{'isEmail':!![]},'set':function(_0x5dda21){if(_0x5dda21){this['setDataValue']('email',_0x5dda21['toLowerCase']());}}},'role':{'type':Sequelize[_0x2516('0xb')](_0x2516('0xc'),_0x2516('0xd'),_0x2516('0xe'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x2516('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x2516('0x1')],'defaultValue':_0x2516('0xf')},'internal':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':![],'unique':_0x2516('0x11'),'set':function(_0x558d20){this[_0x2516('0x3')](_0x2516('0x11'),_0x558d20);this[_0x2516('0x3')](_0x2516('0x12'),_0x558d20);this[_0x2516('0x3')](_0x2516('0x6'),util[_0x2516('0x7')](_0x2516('0x8'),this[_0x2516('0x9')]('fullname'),_0x558d20));}},'salt':{'type':Sequelize[_0x2516('0x1')]},'phone':{'type':Sequelize[_0x2516('0x1')]},'mobile':{'type':Sequelize[_0x2516('0x1')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x2516('0x1')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x2516('0x1')]},'online':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x2516('0x14')]},'voicePause':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x2516('0x1')],'defaultValue':_0x2516('0x15')},'lastPauseAt':{'type':Sequelize[_0x2516('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x2516('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x2516('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2516('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![],'defaultValue':_0x2516('0x16')},'ipaddr':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'port':{'type':Sequelize[_0x2516('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x17'),_0x2516('0xd'),'peer'),'allowNull':!![],'defaultValue':_0x2516('0x17')},'context':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x18'),_0x2516('0x19'),_0x2516('0x1a'),_0x2516('0x1b'),_0x2516('0x1c'),_0x2516('0x1d'),_0x2516('0x1e'),_0x2516('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'permit':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'secret':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'transport':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3e7a55){this['setDataValue'](_0x2516('0x20'),_0x3e7a55?_0x3e7a55['join'](','):null);},'get':function(){return this[_0x2516('0x9')]('transport')?this[_0x2516('0x9')](_0x2516('0x20'))[_0x2516('0x21')](','):null;},'comment':_0x2516('0x22')},'dtmfmode':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x23'),_0x2516('0x24'),_0x2516('0x25'),_0x2516('0x26'),'auto'),'allowNull':!![],'defaultValue':_0x2516('0x23')},'directmedia':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no',_0x2516('0x28'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'nat':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![],'defaultValue':_0x2516('0x29'),'set':function(_0x1979b5){this[_0x2516('0x3')](_0x2516('0x2a'),_0x1979b5?_0x1979b5[_0x2516('0x2b')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x2516('0x9')](_0x2516('0x2a'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x2516('0x1')]},'namedcallgroup':{'type':Sequelize[_0x2516('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x2516('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2516('0x1')]},'disallow':{'type':Sequelize[_0x2516('0x1')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x2516('0x1')],'allowNull':![],'defaultValue':_0x2516('0x2c'),'set':function(_0x155cf7){this[_0x2516('0x3')](_0x2516('0x2d'),_0x155cf7?_0x155cf7[_0x2516('0x2b')](';'):_0x2516('0x2c'));},'get':function(){return this[_0x2516('0x9')](_0x2516('0x2d'))?this[_0x2516('0x9')](_0x2516('0x2d'))[_0x2516('0x21')](';'):null;},'comment':_0x2516('0x2e')},'autoframing':{'type':Sequelize['ENUM'](_0x2516('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![],'set':function(_0x5debf2){this[_0x2516('0x3')](_0x2516('0x2f'),_0x5debf2?_0x5debf2[_0x2516('0x2b')](','):null);},'get':function(){return this[_0x2516('0x9')](_0x2516('0x2f'))?this['getDataValue'](_0x2516('0x2f'))[_0x2516('0x21')](','):null;},'comment':_0x2516('0x30')},'trustrpid':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2516('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no',_0x2516('0x31')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2516('0x32')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![],'defaultValue':_0x2516('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x2516('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x2516('0xb')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x2516('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x2516('0x27'),'no',_0x2516('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2516('0xb')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x34'),_0x2516('0x35'),_0x2516('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x37'),_0x2516('0x38')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2516('0xb')]('yes','no'),'allowNull':!![],'defaultValue':_0x2516('0x27')},'keepalive':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x2516('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2516('0xb')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x2516('0xb')]('yes','no','fingerprint',_0x2516('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x3a'),_0x2516('0x3b'),_0x2516('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2516('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2516('0xb')](_0x2516('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x2516('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat',_0x2516('0x3d'),_0x2516('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x2516('0x1')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x2516('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x2516('0x3f')]},'showWebBar':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x0,'set':function(_0x503517){this[_0x2516('0x3')](_0x2516('0x40'),_0x503517);var _0x11fa5b=this[_0x2516('0x41')]({'plain':!![]});switch(_0x503517){case 0x0:case 0x1:var _0x27b2ee=_0x11fa5b[_0x2516('0x20')]?_[_0x2516('0x42')](_0x11fa5b[_0x2516('0x20')])?_0x11fa5b[_0x2516('0x20')][_0x2516('0x2b')]():_0x11fa5b[_0x2516('0x20')]:_0x2516('0x43');if(_0x27b2ee===_0x2516('0x44')){_0x27b2ee='udp';}this[_0x2516('0x3')](_0x2516('0x20'),_0x27b2ee);this[_0x2516('0x3')](_0x2516('0x45'),'no');this[_0x2516('0x3')](_0x2516('0x46'),null);this[_0x2516('0x3')]('force_avp',null);this[_0x2516('0x3')](_0x2516('0x47'),null);this[_0x2516('0x3')](_0x2516('0x48'),null);this[_0x2516('0x3')](_0x2516('0x49'),null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x2516('0x4a'),null);this[_0x2516('0x3')](_0x2516('0x4b'),null);this[_0x2516('0x3')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x2516('0x20'),'wss');this[_0x2516('0x3')](_0x2516('0x45'),'yes');this[_0x2516('0x3')](_0x2516('0x46'),_0x2516('0x27'));this[_0x2516('0x3')](_0x2516('0x4c'),_0x2516('0x27'));this[_0x2516('0x3')](_0x2516('0x47'),_0x2516('0x27'));this['setDataValue']('dtlsenable',_0x2516('0x27'));this[_0x2516('0x3')](_0x2516('0x49'),'no');this['setDataValue'](_0x2516('0x4d'),'actpass');this[_0x2516('0x3')](_0x2516('0x4a'),_0x11fa5b[_0x2516('0x4a')]||_0x2516('0x4e'));this[_0x2516('0x3')](_0x2516('0x4b'),_0x11fa5b[_0x2516('0x4b')]||_0x2516('0x4f'));this[_0x2516('0x3')](_0x2516('0x50'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x317942){this['setDataValue']('permissions',_0x317942?_0x317942[_0x2516('0x2b')](','):[]);},'get':function(){return this[_0x2516('0x9')](_0x2516('0x51'))?_[_0x2516('0x52')](this[_0x2516('0x9')](_0x2516('0x51'))[_0x2516('0x21')](','),function(_0x2081a8){return parseInt(_0x2081a8,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x2516('0x1')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x2516('0x1')]},'phoneBarUnconditional':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x2516('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2516('0x1')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2516('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2516('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2516('0x53')],'get':function(){return this[_0x2516('0x9')]('phoneBarEnableScreenRecordingByAgent')?this[_0x2516('0x9')](_0x2516('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x2516('0x1')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2516('0x1')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x42d604){if(typeof _0x42d604===_0x2516('0x55')){var _0x5b7252=_0x42d604==='1'?!![]:_0x42d604==='0'?![]:_0x42d604==='true'?!![]:_0x42d604===_0x2516('0x56')?![]:![];this['setDataValue'](_0x2516('0x57'),_0x5b7252);}else{this[_0x2516('0x3')](_0x2516('0x57'),_0x42d604);}}},'blocked':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![],'set':function(_0x322df6){this['setDataValue']('blocked',_0x322df6);if(_0x322df6===!![]){this['setDataValue'](_0x2516('0x58'),moment());this[_0x2516('0x3')]('loginAttempts',0x0);}else{this[_0x2516('0x3')](_0x2516('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x2516('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x2516('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x2516('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x2516('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x2516('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x2516('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2516('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x44c2=['admin','user','agent','local','INTEGER','internal','\x22%s\x22\x20<%s>','BOOLEAN','DATE','dynamic','ENUM','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','STRING','name','setDataValue','callerid','format','getDataValue','email'];(function(_0x70c97a,_0xd4d263){var _0x5cb362=function(_0x163f30){while(--_0x163f30){_0x70c97a['push'](_0x70c97a['shift']());}};_0x5cb362(++_0xd4d263);}(_0x44c2,0x100));var _0x244c=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0x44c2[_0x361d3f];return _0x320229;};'use strict';var Sequelize=require(_0x244c('0x0'));var moment=require(_0x244c('0x1'));var util=require(_0x244c('0x2'));var _=require(_0x244c('0x3'));module['exports']={'name':{'type':Sequelize[_0x244c('0x4')],'allowNull':![],'unique':_0x244c('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2c5d4d){this[_0x244c('0x6')](_0x244c('0x5'),_0x2c5d4d);this[_0x244c('0x6')]('defaultuser',_0x2c5d4d);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x244c('0x4')],'allowNull':![],'set':function(_0x4c758e){this[_0x244c('0x6')]('fullname',_0x4c758e);this['setDataValue'](_0x244c('0x7'),util[_0x244c('0x8')]('\x22%s\x22\x20<%s>',_0x4c758e,this[_0x244c('0x9')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x244c('0x4')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x16c6f9){if(_0x16c6f9){this['setDataValue'](_0x244c('0xa'),_0x16c6f9['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x244c('0xb'),_0x244c('0xc'),_0x244c('0xd'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x244c('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x244c('0x4')],'defaultValue':_0x244c('0xe')},'internal':{'type':Sequelize[_0x244c('0xf')](0xb),'allowNull':![],'unique':_0x244c('0x10'),'set':function(_0x4465a9){this[_0x244c('0x6')]('internal',_0x4465a9);this[_0x244c('0x6')]('accountcode',_0x4465a9);this['setDataValue'](_0x244c('0x7'),util[_0x244c('0x8')](_0x244c('0x11'),this[_0x244c('0x9')]('fullname'),_0x4465a9));}},'salt':{'type':Sequelize[_0x244c('0x4')]},'phone':{'type':Sequelize[_0x244c('0x4')]},'mobile':{'type':Sequelize[_0x244c('0x4')]},'address':{'type':Sequelize[_0x244c('0x4')]},'zipcode':{'type':Sequelize[_0x244c('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x244c('0x4')]},'country':{'type':Sequelize[_0x244c('0x4')]},'online':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x244c('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x244c('0x13')]},'chatCapacity':{'type':Sequelize[_0x244c('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x244c('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x244c('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x244c('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x244c('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x244c('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![],'defaultValue':_0x244c('0x14')},'ipaddr':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x244c('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x16'),_0x244c('0xc'),_0x244c('0x17')),'allowNull':!![],'defaultValue':_0x244c('0x16')},'context':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM'](_0x244c('0x18'),_0x244c('0x19'),_0x244c('0x1a'),_0x244c('0x1b'),_0x244c('0x1c'),_0x244c('0x1d'),'PROHIB_FAILED_SCREEN',_0x244c('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![],'defaultValue':_0x244c('0x1f'),'set':function(_0x15aeaf){this[_0x244c('0x6')](_0x244c('0x20'),_0x15aeaf?_0x15aeaf[_0x244c('0x21')](','):null);},'get':function(){return this['getDataValue'](_0x244c('0x20'))?this[_0x244c('0x9')](_0x244c('0x20'))[_0x244c('0x22')](','):null;},'comment':_0x244c('0x23')},'dtmfmode':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x24'),_0x244c('0x25'),'shortinfo',_0x244c('0x26'),_0x244c('0x27')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no',_0x244c('0x29'),_0x244c('0x2a'),_0x244c('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x2fd6f4){this[_0x244c('0x6')](_0x244c('0x2c'),_0x2fd6f4?_0x2fd6f4[_0x244c('0x21')](','):null);},'get':function(){return this[_0x244c('0x9')]('nat')?this['getDataValue'](_0x244c('0x2c'))['split'](','):null;},'comment':_0x244c('0x2d')},'callgroup':{'type':Sequelize[_0x244c('0x4')]},'namedcallgroup':{'type':Sequelize[_0x244c('0x4')]},'pickupgroup':{'type':Sequelize[_0x244c('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x244c('0x4')]},'language':{'type':Sequelize[_0x244c('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x244c('0x2e')},'allow':{'type':Sequelize[_0x244c('0x4')],'allowNull':![],'defaultValue':_0x244c('0x2f'),'set':function(_0x16c2d9){this['setDataValue'](_0x244c('0x30'),_0x16c2d9?_0x16c2d9[_0x244c('0x21')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x244c('0x9')]('allow')?this[_0x244c('0x9')](_0x244c('0x30'))[_0x244c('0x22')](';'):null;},'comment':_0x244c('0x31')},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![],'set':function(_0x49e2a9){this[_0x244c('0x6')](_0x244c('0x32'),_0x49e2a9?_0x49e2a9[_0x244c('0x21')](','):null);},'get':function(){return this[_0x244c('0x9')](_0x244c('0x32'))?this[_0x244c('0x9')](_0x244c('0x32'))['split'](','):null;},'comment':_0x244c('0x33')},'trustrpid':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no',_0x244c('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x244c('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![],'defaultValue':_0x244c('0x35')},'amaflags':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x244c('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no',_0x244c('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x244c('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x244c('0x15')]('accept',_0x244c('0x37'),_0x244c('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x244c('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x244c('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x244c('0x39'),_0x244c('0x3a')),'allowNull':!![],'defaultValue':_0x244c('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x244c('0x28'),'no'),'allowNull':!![],'defaultValue':_0x244c('0x28')},'keepalive':{'type':Sequelize[_0x244c('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x244c('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x244c('0xf')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x244c('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x244c('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x244c('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x244c('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no','fingerprint',_0x244c('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x244c('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x244c('0x15')]('active',_0x244c('0x3c'),_0x244c('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x244c('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x244c('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x244c('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x244c('0x15')]('yes','no',_0x244c('0x29'),_0x244c('0x2a'),_0x244c('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x244c('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x244c('0x13')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x244c('0x3f')]},'showWebBar':{'type':Sequelize[_0x244c('0xf')],'defaultValue':0x0,'set':function(_0x24b0c9){this[_0x244c('0x6')](_0x244c('0x40'),_0x24b0c9);var _0x5a913c=this[_0x244c('0x41')]({'plain':!![]});switch(_0x24b0c9){case 0x0:case 0x1:var _0x460f84=_0x5a913c['transport']?_['isArray'](_0x5a913c[_0x244c('0x20')])?_0x5a913c[_0x244c('0x20')][_0x244c('0x21')]():_0x5a913c[_0x244c('0x20')]:_0x244c('0x1f');if(_0x460f84===_0x244c('0x42')){_0x460f84=_0x244c('0x1f');}this[_0x244c('0x6')](_0x244c('0x20'),_0x460f84);this[_0x244c('0x6')](_0x244c('0x43'),'no');this['setDataValue'](_0x244c('0x44'),null);this[_0x244c('0x6')]('force_avp',null);this['setDataValue'](_0x244c('0x45'),null);this[_0x244c('0x6')](_0x244c('0x46'),null);this['setDataValue'](_0x244c('0x47'),null);this['setDataValue'](_0x244c('0x48'),null);this[_0x244c('0x6')](_0x244c('0x49'),null);this[_0x244c('0x6')](_0x244c('0x4a'),null);this[_0x244c('0x6')](_0x244c('0x4b'),'no');break;case 0x2:this[_0x244c('0x6')]('transport',_0x244c('0x42'));this['setDataValue'](_0x244c('0x43'),_0x244c('0x28'));this[_0x244c('0x6')](_0x244c('0x44'),_0x244c('0x28'));this[_0x244c('0x6')]('force_avp',_0x244c('0x28'));this['setDataValue'](_0x244c('0x45'),_0x244c('0x28'));this['setDataValue']('dtlsenable','yes');this[_0x244c('0x6')](_0x244c('0x47'),'no');this[_0x244c('0x6')](_0x244c('0x48'),'actpass');this[_0x244c('0x6')](_0x244c('0x49'),_0x5a913c['dtlscertfile']||_0x244c('0x4c'));this['setDataValue'](_0x244c('0x4a'),_0x5a913c[_0x244c('0x4a')]||_0x244c('0x4d'));this[_0x244c('0x6')](_0x244c('0x4b'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1e395a){this[_0x244c('0x6')]('permissions',_0x1e395a?_0x1e395a['join'](','):[]);},'get':function(){return this[_0x244c('0x9')](_0x244c('0x4e'))?_[_0x244c('0x4f')](this['getDataValue']('permissions')[_0x244c('0x22')](','),function(_0x34725e){return parseInt(_0x34725e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x244c('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x244c('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x244c('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x244c('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x244c('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x244c('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x244c('0x15')](_0x244c('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x244c('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x244c('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x244c('0x50')],'get':function(){return this[_0x244c('0x9')]('phoneBarEnableScreenRecordingByAgent')?this['getDataValue'](_0x244c('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x244c('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x244c('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4d8d33){if(typeof _0x4d8d33===_0x244c('0x52')){var _0x3498fc=_0x4d8d33==='1'?!![]:_0x4d8d33==='0'?![]:_0x4d8d33===_0x244c('0x53')?!![]:_0x4d8d33==='false'?![]:![];this[_0x244c('0x6')](_0x244c('0x54'),_0x3498fc);}else{this[_0x244c('0x6')](_0x244c('0x54'),_0x4d8d33);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x56da4f){this[_0x244c('0x6')](_0x244c('0x55'),_0x56da4f);if(_0x56da4f===!![]){this[_0x244c('0x6')](_0x244c('0x56'),moment());this[_0x244c('0x6')](_0x244c('0x57'),0x0);}else{this[_0x244c('0x6')](_0x244c('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x244c('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x244c('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x244c('0xf')](0x5)[_0x244c('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x244c('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x244c('0x12')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 4dd39f4..5b225d5 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 _0x0787=['fieldName','type','key','salt','getOptions','where','includeAll','include','push','findAll','rows','query','length','dataValues','fax','openchannel','whatsapp','all','params','model','differenceBy','password','keys','filters','intersection','attributes','fields','merge','options','openTabs','true','sms','mail','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','isNil','min_internal','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','from','voicemail','mailbox','VoiceMail','fullname','email','agent','permissions','101','103','113','110','105','106','107','100','111','114','115','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','checkUserLimits','settingsEnabled','userProfileId','bulkCreate','some','each','UserProfileSection','isEmpty','autoAssociation','changePassword','oldPassword','newPassword','Sequelize','ValidationError','authenticate','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','spread','QueueId','emit','voice','VoiceQueue','format','SIP/%s','UserVoiceQueueRt','upsert','remove','Queues','isArray','Queue:remove','addAvatar','file','getAvatar','server/files/images/logos/default_profile.png','userpic','existsSync','join','server/files/images/','chat','ChatOpenTabs','CHAT','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','getContacts','findOne','CmContact','order','sort','pick','hasOwnProperty','List','Tag','Tags','color','tag','nolimit','Queue','getVoiceQueuesRt','getGroups','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','x-forwarded-for','connection','remoteAddress','socket','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','MemberReport','LOGININPAUSE','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','Pause','getTeams','Team','addTeams','getVoiceQueues','Voice','getChatQueues','Chat','setDataValue','Mail','getSmsQueues','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','getDataValue','Queue:save','TeamVoicePrefix','VoicePrefixId','removeTeams','getMailQueues','Sms','removeAgent','UserVoicePrefix','CmList','getLists','getAgents','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','CmHopper','phone','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','apiKeyIat','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','inbound','lower','desc','asc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','busy','slice','toUpperCase','QueryTypes','ui.','field','ui.createdAt','user_has_','_interactions','toString','OpenTabs','moment','bluebird','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../mysqldb','socket.io-emitter','register','redis','client','request','then','info','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','User,\x20%s,\x20%s','message','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','get','role','admin','Users','user','Agents','Telephones','telephone','filter','ignore','map','value','includes','find','name','UserProfileResource','destroy','end','sendStatus','stack','index','User','rawAttributes'];(function(_0x42b696,_0x180cee){var _0x1238e5=function(_0x5490fd){while(--_0x5490fd){_0x42b696['push'](_0x42b696['shift']());}};_0x1238e5(++_0x180cee);}(_0x0787,0x156));var _0x7078=function(_0x2bda14,_0x4fab1b){_0x2bda14=_0x2bda14-0x0;var _0xb5dd49=_0x0787[_0x2bda14];return _0xb5dd49;};'use strict';var moment=require(_0x7078('0x0'));var BPromise=require(_0x7078('0x1'));var util=require('util');var path=require(_0x7078('0x2'));var fs=require('fs');var _=require(_0x7078('0x3'));var squel=require(_0x7078('0x4'));var jayson=require(_0x7078('0x5'));var Redis=require(_0x7078('0x6'));var authService=require(_0x7078('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x7078('0x8'))('api');var utils=require(_0x7078('0x9'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7078('0xa'))['db'];var socket=require(_0x7078('0xb'))(new Redis(config['redis']));require('./user.socket')[_0x7078('0xc')](socket);config['redis']=_['defaults'](config[_0x7078('0xd')],{'host':'localhost','port':0x18eb});var client=jayson[_0x7078('0xe')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x481486,_0x2b9359,_0x42f6b1,_0x50bcd3){return new BPromise(function(_0x309921,_0x3a629d){var _0x1bc583=_0x50bcd3||client;return _0x1bc583[_0x7078('0xf')](_0x481486,_0x42f6b1)[_0x7078('0x10')](function(_0x57ad51){logger[_0x7078('0x11')]('User,\x20%s,\x20%s',_0x2b9359,'request\x20sent');logger[_0x7078('0x12')](_0x7078('0x13'),_0x2b9359,_0x7078('0x14'),JSON[_0x7078('0x15')](_0x57ad51));if(_0x57ad51[_0x7078('0x16')]){if(_0x57ad51['error'][_0x7078('0x17')]===0x1f4){logger[_0x7078('0x16')](_0x7078('0x18'),_0x2b9359,_0x57ad51[_0x7078('0x16')][_0x7078('0x19')]);return _0x3a629d(_0x57ad51['error'][_0x7078('0x19')]);}logger[_0x7078('0x16')](_0x7078('0x18'),_0x2b9359,_0x57ad51[_0x7078('0x16')][_0x7078('0x19')]);return _0x309921(_0x57ad51['error'][_0x7078('0x19')]);}else{logger[_0x7078('0x11')](_0x7078('0x18'),_0x2b9359,_0x7078('0x14'));_0x309921(_0x57ad51['result'][_0x7078('0x19')]);}})[_0x7078('0x1a')](function(_0x3272e4){logger[_0x7078('0x16')](_0x7078('0x18'),_0x2b9359,_0x3272e4);_0x3a629d(_0x3272e4);});});}function respondWithStatusCode(_0x5caf7c,_0x1598c7){_0x1598c7=_0x1598c7||0xcc;return function(_0x52674c){if(_0x52674c){return _0x5caf7c['sendStatus'](_0x1598c7);}return _0x5caf7c[_0x7078('0x1b')](_0x1598c7)['end']();};}function respondWithResult(_0x35911d,_0x3a7766){_0x3a7766=_0x3a7766||0xc8;return function(_0x450b10){if(_0x450b10){return _0x35911d['status'](_0x3a7766)[_0x7078('0x1c')](_0x450b10);}};}function respondWithFilteredResult(_0x64d54f,_0x1f187d){return function(_0x4d439c){if(_0x4d439c){var _0x68ffaf=typeof _0x1f187d[_0x7078('0x1d')]==='undefined'&&typeof _0x1f187d['limit']===_0x7078('0x1e');var _0x4a6cc5=_0x4d439c[_0x7078('0x1f')];var _0x3a9849=_0x68ffaf?0x0:_0x1f187d[_0x7078('0x1d')];var _0x24ec7a=_0x68ffaf?_0x4d439c[_0x7078('0x1f')]:_0x1f187d[_0x7078('0x1d')]+_0x1f187d[_0x7078('0x20')];var _0x44223b;if(_0x24ec7a>=_0x4a6cc5){_0x24ec7a=_0x4a6cc5;_0x44223b=0xc8;}else{_0x44223b=0xce;}_0x64d54f['status'](_0x44223b);return _0x64d54f[_0x7078('0x21')](_0x7078('0x22'),_0x3a9849+'-'+_0x24ec7a+'/'+_0x4a6cc5)[_0x7078('0x1c')](_0x4d439c);}return null;};}function saveUpdates(_0x41a8b3){return function(_0x90e680){if(_0x90e680){return _0x90e680[_0x7078('0x23')](_0x41a8b3)[_0x7078('0x10')](function(_0x1ef9d7){return _0x1ef9d7;});}return null;};}function removeEntity(_0x377c37){return function(_0xdfb4c7){if(_0xdfb4c7){return _0xdfb4c7['destroy']()[_0x7078('0x10')](function(){var _0x547aab=_0xdfb4c7[_0x7078('0x24')]({'plain':!![]});if(_0x547aab[_0x7078('0x25')]===_0x7078('0x26'))return;var _0xbdf31=[{'name':_0x7078('0x27'),'value':_0x7078('0x28'),'ignore':!![]},{'name':_0x7078('0x29'),'value':'agent','ignore':![]},{'name':_0x7078('0x2a'),'value':_0x7078('0x2b'),'ignore':![]}];var _0x3215ad=_(_0xbdf31)[_0x7078('0x2c')](_0x7078('0x2d'))[_0x7078('0x2e')](_0x7078('0x2f'))[_0x7078('0x2f')]();if(_[_0x7078('0x30')](_0x3215ad,_0x547aab['role'])){return;}var _0x221338=_[_0x7078('0x31')](_0xbdf31,[_0x7078('0x2f'),_0x547aab['role']])[_0x7078('0x32')];return db[_0x7078('0x33')][_0x7078('0x34')]({'where':{'type':_0x221338,'resourceId':_0x547aab['id']}})['then'](function(){return _0xdfb4c7;});})[_0x7078('0x10')](function(){_0x377c37['status'](0xcc)[_0x7078('0x35')]();});}};}function handleEntityNotFound(_0x413d81){return function(_0x185be4){if(!_0x185be4){_0x413d81[_0x7078('0x36')](0x194);}return _0x185be4;};}function handleError(_0x30623e,_0x5e544b){_0x5e544b=_0x5e544b||0x1f4;return function(_0x536851){logger[_0x7078('0x16')](_0x536851[_0x7078('0x37')]);if(_0x536851[_0x7078('0x32')]){delete _0x536851[_0x7078('0x32')];}_0x30623e['status'](_0x5e544b)['send'](_0x536851);};}exports[_0x7078('0x38')]=function(_0x5ad162,_0x32593e){var _0x375651={},_0x377521={'count':0x0,'rows':[]};var _0x359838=_(db[_0x7078('0x39')][_0x7078('0x3a')])['map'](function(_0xfd6de8){return{'name':_0xfd6de8[_0x7078('0x3b')],'type':_0xfd6de8[_0x7078('0x3c')][_0x7078('0x3d')]};})[_0x7078('0x2c')](function(_0x5075b7){return!_['includes'](['password',_0x7078('0x3e')],_0x5075b7['name']);})['value']();_0x375651=qs[_0x7078('0x3f')](_0x359838,_0x5ad162);var _0x39a6c9={'where':_0x375651[_0x7078('0x40')]};return db[_0x7078('0x39')][_0x7078('0x1f')](_0x39a6c9)['then'](function(_0x5f5ae7){_0x377521[_0x7078('0x1f')]=_0x5f5ae7;if(_0x5ad162['query'][_0x7078('0x41')]){_0x375651[_0x7078('0x42')]=[{'all':!![]}];}if(!_[_0x7078('0x30')](_0x375651['attributes'],'id')){_0x375651['attributes'][_0x7078('0x43')]('id');}return db['User'][_0x7078('0x44')](_0x375651);})[_0x7078('0x10')](function(_0x5bff1e){_0x377521[_0x7078('0x45')]=_0x5bff1e;if(_0x5ad162[_0x7078('0x46')]['openTabs']==='true'){var _0x32c3cc=[];for(var _0x1c0f21=0x0;_0x1c0f21<_0x377521[_0x7078('0x45')][_0x7078('0x47')];_0x1c0f21++){_0x32c3cc['push'](get_open_tabs('chat',_0x377521['rows'][_0x1c0f21][_0x7078('0x48')]));_0x32c3cc[_0x7078('0x43')](get_open_tabs('sms',_0x377521[_0x7078('0x45')][_0x1c0f21][_0x7078('0x48')]));_0x32c3cc[_0x7078('0x43')](get_open_tabs(_0x7078('0x49'),_0x377521[_0x7078('0x45')][_0x1c0f21][_0x7078('0x48')]));_0x32c3cc[_0x7078('0x43')](get_open_tabs('mail',_0x377521[_0x7078('0x45')][_0x1c0f21][_0x7078('0x48')]));_0x32c3cc[_0x7078('0x43')](get_open_tabs(_0x7078('0x4a'),_0x377521[_0x7078('0x45')][_0x1c0f21]['dataValues']));_0x32c3cc['push'](get_open_tabs(_0x7078('0x4b'),_0x377521['rows'][_0x1c0f21][_0x7078('0x48')]));}return BPromise[_0x7078('0x4c')](_0x32c3cc)[_0x7078('0x10')](function(_0x5eb7e1){return _0x377521;});}else{return _0x377521;}})[_0x7078('0x10')](respondWithFilteredResult(_0x32593e,_0x375651))[_0x7078('0x1a')](handleError(_0x32593e,null));};exports['show']=function(_0x569cc0,_0x5f667d){var _0xbbcc6b={'raw':![],'where':{'id':_0x569cc0[_0x7078('0x4d')]['id']}},_0x33f873={};_0x33f873[_0x7078('0x4e')]=_[_0x7078('0x4f')](_['keys'](db[_0x7078('0x39')][_0x7078('0x3a')]),[_0x7078('0x50'),_0x7078('0x3e')]);_0x33f873[_0x7078('0x46')]=_[_0x7078('0x51')](_0x569cc0[_0x7078('0x46')]);_0x33f873[_0x7078('0x52')]=_[_0x7078('0x53')](_0x33f873['model'],_0x33f873[_0x7078('0x46')]);_0xbbcc6b[_0x7078('0x54')]=_[_0x7078('0x53')](_0x33f873[_0x7078('0x4e')],qs['fields'](_0x569cc0['query'][_0x7078('0x55')]));_0xbbcc6b[_0x7078('0x54')]=_0xbbcc6b['attributes'][_0x7078('0x47')]?_0xbbcc6b[_0x7078('0x54')]:_0x33f873[_0x7078('0x4e')];if(_0x569cc0[_0x7078('0x46')]['includeAll']){_0xbbcc6b['include']=[{'all':!![]}];}_0xbbcc6b=_[_0x7078('0x56')]({},_0xbbcc6b,_0x569cc0[_0x7078('0x57')]);if(!_[_0x7078('0x30')](_0xbbcc6b['attributes'],'id')){_0xbbcc6b[_0x7078('0x54')][_0x7078('0x43')]('id');}return db[_0x7078('0x39')][_0x7078('0x31')](_0xbbcc6b)[_0x7078('0x10')](handleEntityNotFound(_0x5f667d,null))['then'](function(_0x56524f){var _0x4aec54=[];values=_0x56524f;if(_0x569cc0[_0x7078('0x46')][_0x7078('0x58')]===_0x7078('0x59')){_0x4aec54[_0x7078('0x43')](get_open_tabs('chat',_0x56524f[_0x7078('0x48')]));_0x4aec54[_0x7078('0x43')](get_open_tabs(_0x7078('0x5a'),_0x56524f['dataValues']));_0x4aec54[_0x7078('0x43')](get_open_tabs(_0x7078('0x4a'),_0x56524f[_0x7078('0x48')]));_0x4aec54[_0x7078('0x43')](get_open_tabs(_0x7078('0x4b'),_0x56524f['dataValues']));_0x4aec54[_0x7078('0x43')](get_open_tabs(_0x7078('0x49'),_0x56524f[_0x7078('0x48')]));_0x4aec54['push'](get_open_tabs(_0x7078('0x5b'),_0x56524f[_0x7078('0x48')]));return BPromise[_0x7078('0x4c')](_0x4aec54);}else{return values;}})[_0x7078('0x10')](function(_0x383753){return values;})[_0x7078('0x10')](respondWithResult(_0x5f667d,null))[_0x7078('0x1a')](handleError(_0x5f667d,null));};exports[_0x7078('0x23')]=function(_0x4f4b6e,_0x5c0dc0){if(_0x4f4b6e[_0x7078('0x5c')]['id']){delete _0x4f4b6e[_0x7078('0x5c')]['id'];}delete _0x4f4b6e[_0x7078('0x5c')][_0x7078('0x25')];return db[_0x7078('0x39')][_0x7078('0x31')]({'where':{'id':_0x4f4b6e['params']['id']}})[_0x7078('0x10')](handleEntityNotFound(_0x5c0dc0,null))[_0x7078('0x10')](saveUpdates(_0x4f4b6e['body'],null))[_0x7078('0x10')](respondWithResult(_0x5c0dc0,null))[_0x7078('0x1a')](handleError(_0x5c0dc0,null));};exports[_0x7078('0x5d')]=function(_0x39b7d2,_0x2dd93f){return db[_0x7078('0x39')][_0x7078('0x5d')]()[_0x7078('0x10')](respondWithResult(_0x2dd93f,null))[_0x7078('0x1a')](handleError(_0x2dd93f,null));};exports[_0x7078('0x5e')]=function(_0x11d0ec,_0x44edc7){return db[_0x7078('0x39')][_0x7078('0x31')]({'where':{'id':_0x11d0ec[_0x7078('0x4d')]['id']}})[_0x7078('0x10')](handleEntityNotFound(_0x44edc7,null))[_0x7078('0x10')](function(_0x1e818e){if(_0x1e818e){return _0x1e818e[_0x7078('0x5e')](_0x11d0ec[_0x7078('0x5c')][_0x7078('0x5f')],_[_0x7078('0x60')](_0x11d0ec[_0x7078('0x5c')],[_0x7078('0x5f'),'id'])||{});}})['then'](respondWithResult(_0x44edc7,null))[_0x7078('0x1a')](handleError(_0x44edc7,null));};function validateUser(_0x9ded8){return new BPromise(function(_0x4d213c,_0x382c04){if(_0x9ded8[_0x7078('0x61')])return _0x4d213c(_0x9ded8);return db[_0x7078('0x62')][_0x7078('0x63')](0x1)[_0x7078('0x10')](function(_0x5109bc){if(_0x5109bc[_0x7078('0x64')])authService['validatePasswordPattern'](_0x9ded8[_0x7078('0x50')]);db[_0x7078('0x39')]['max'](_0x7078('0x61'))[_0x7078('0x10')](function(_0x4c127b){if(_[_0x7078('0x65')](_0x4c127b)){_0x9ded8[_0x7078('0x61')]=_0x5109bc[_0x7078('0x66')]||0x1;return;}if(_[_0x7078('0x65')](_0x5109bc[_0x7078('0x66')])||_0x5109bc[_0x7078('0x66')]===_0x4c127b){_0x9ded8[_0x7078('0x61')]=_0x4c127b+0x1;return;}if(_0x5109bc[_0x7078('0x66')]>_0x4c127b){_0x9ded8[_0x7078('0x61')]=_0x5109bc['min_internal'];return;}return db['sequelize'][_0x7078('0x46')](_0x7078('0x67'),{'type':db[_0x7078('0x68')]['QueryTypes']['SELECT']})[_0x7078('0x10')](function(_0x522407){if(_0x522407&&_0x522407[_0x7078('0x47')]){for(var _0x43636e=0x0,_0x3191ed=_0x522407[_0x7078('0x47')];_0x43636e<_0x3191ed&&_['isNil'](_0x9ded8[_0x7078('0x61')]);_0x43636e++){if(_0x5109bc[_0x7078('0x66')]<=_0x522407[_0x43636e][_0x7078('0x69')]){_0x9ded8['internal']=_0x522407[_0x43636e][_0x7078('0x69')];}else if(_0x5109bc[_0x7078('0x66')]>_0x522407[_0x43636e][_0x7078('0x69')]&&_0x5109bc[_0x7078('0x66')]<=_0x522407[_0x43636e]['to']){_0x9ded8['internal']=_0x5109bc[_0x7078('0x66')];}}}if(_[_0x7078('0x65')](_0x9ded8[_0x7078('0x61')])){_0x9ded8[_0x7078('0x61')]=_0x4c127b+0x1;}return _0x4d213c(_0x9ded8);});});})[_0x7078('0x1a')](function(_0x17f5bf){_0x382c04(_0x17f5bf);});});}function updateUser(_0x259ff2){return new BPromise(function(_0x3b238f,_0x44328a){try{if(_0x259ff2[_0x7078('0x6a')]){_0x259ff2[_0x7078('0x6b')]=_0x259ff2[_0x7078('0x61')];_0x259ff2[_0x7078('0x6c')]={'mailbox':_0x259ff2[_0x7078('0x61')],'password':_0x259ff2['password'],'fullname':_0x259ff2[_0x7078('0x6d')],'email':_0x259ff2[_0x7078('0x6e')]};}if(_0x259ff2[_0x7078('0x25')]===_0x7078('0x6f')){if(!_0x259ff2[_0x7078('0x70')])_0x259ff2[_0x7078('0x70')]=[_0x7078('0x71'),'102',_0x7078('0x72'),_0x7078('0x73'),_0x7078('0x74'),'104',_0x7078('0x75'),_0x7078('0x76'),_0x7078('0x77'),'108','109',_0x7078('0x78'),_0x7078('0x79'),_0x7078('0x7a'),_0x7078('0x7b')];}_0x3b238f(_0x259ff2);}catch(_0x1e3c23){_0x44328a(_0x1e3c23);}});}exports[_0x7078('0x7c')]=function(_0x5e2f3d,_0xa69def){if(_0x5e2f3d[_0x7078('0x28')][_0x7078('0x25')]===_0x7078('0x6f'))throw new Error(_0x7078('0x7d'));if(_0x5e2f3d[_0x7078('0x5c')][_0x7078('0x25')]==='user'&&_0x5e2f3d['user'][_0x7078('0x25')]!==_0x7078('0x26')){throw new Error(_0x7078('0x7e'));}if(_0x5e2f3d[_0x7078('0x5c')][_0x7078('0x25')]===_0x7078('0x26')&&_0x5e2f3d[_0x7078('0x28')][_0x7078('0x25')]!==_0x7078('0x26')){throw new Error(_0x7078('0x7f'));}return licenseUtil[_0x7078('0x80')]([_0x5e2f3d[_0x7078('0x5c')]])['then'](function(){return validateUser(_0x5e2f3d['body']);})['then'](function(_0x1e141c){return updateUser(_0x1e141c)[_0x7078('0x10')](function(_0x12c861){if(_0x12c861['role']==='admin'){_0x12c861[_0x7078('0x81')]=_0x5e2f3d[_0x7078('0x28')][_0x7078('0x81')];delete _0x12c861[_0x7078('0x82')];}return _0x12c861;});})[_0x7078('0x10')](function(_0x5c3916){return db[_0x7078('0x39')][_0x7078('0x7c')](_0x5c3916,{'include':[{'model':db[_0x7078('0x6c')],'as':_0x7078('0x6c')}]});})[_0x7078('0x10')](function(_0x3fe9c8){if(_0x5e2f3d['body'][_0x7078('0x25')]===_0x7078('0x28'))return _0x3fe9c8;if(_0x5e2f3d['user'][_0x7078('0x25')]!==_0x7078('0x28'))return _0x3fe9c8;return db['UserProfileSection'][_0x7078('0x31')]({'where':{'name':_0x3fe9c8[_0x7078('0x25')]==='agent'?'Agents':_0x7078('0x2a'),'userProfileId':_0x5e2f3d[_0x7078('0x28')][_0x7078('0x82')]},'raw':!![]})[_0x7078('0x10')](function(_0x52b97e){if(!_0x52b97e||_0x52b97e['autoAssociation']!=0x0)return _0x3fe9c8;return db[_0x7078('0x33')]['create']({'name':_0x3fe9c8[_0x7078('0x32')],'resourceId':_0x3fe9c8['id'],'type':_0x52b97e['name'],'sectionId':_0x52b97e['id']},{})[_0x7078('0x10')](function(){return _0x3fe9c8;});})['catch'](function(_0x31548c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31548c);throw _0x31548c;});})['then'](respondWithResult(_0xa69def,0xc9))[_0x7078('0x1a')](handleError(_0xa69def,null));};exports[_0x7078('0x83')]=function(_0x430e74,_0x30b9c2){var _0x727756=_0x430e74[_0x7078('0x5c')];var _0x2ee95b=[];if(_0x430e74[_0x7078('0x28')]['role']==='agent')throw new Error(_0x7078('0x7d'));if(_[_0x7078('0x84')](_0x727756,[_0x7078('0x25'),_0x7078('0x28')])&&_0x430e74[_0x7078('0x28')][_0x7078('0x25')]!==_0x7078('0x26')){throw new Error(_0x7078('0x7e'));}if(_['some'](_0x727756,[_0x7078('0x25'),_0x7078('0x26')])&&_0x430e74[_0x7078('0x28')]['role']!==_0x7078('0x26')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x7078('0x80')](_0x727756)[_0x7078('0x10')](function(){return validateUser(_0x727756[0x0]);})['then'](function(){for(var _0x502fec=0x1;_0x502fec<_0x727756[_0x7078('0x47')];_0x502fec++){var _0x467cc0=_0x727756[_0x502fec-0x1]['internal'];if(!_0x727756[_0x502fec]['internal'])_0x727756[_0x502fec][_0x7078('0x61')]=_0x467cc0+0x1;_0x2ee95b[_0x7078('0x43')](validateUser(_0x727756[_0x502fec]));}return BPromise['all'](_0x2ee95b);})['then'](function(){_0x2ee95b=[];for(var _0x4d05c7=0x0;_0x4d05c7<_0x727756[_0x7078('0x47')];_0x4d05c7++){_0x2ee95b[_0x7078('0x43')](updateUser(_0x727756[_0x4d05c7]));}return BPromise[_0x7078('0x4c')](_0x2ee95b);})['then'](function(){return BPromise[_0x7078('0x85')](_0x727756,function(_0x2f3c99){return db[_0x7078('0x39')][_0x7078('0x7c')](_0x2f3c99,{'include':[{'model':db[_0x7078('0x6c')],'as':_0x7078('0x6c')}]})[_0x7078('0x10')](function(_0x15b299){_0x2f3c99['id']=_0x15b299['id'];return _0x2f3c99;});});})[_0x7078('0x10')](function(_0x162506){if(_0x430e74['body'][_0x7078('0x25')]===_0x7078('0x28'))return _0x162506;if(_0x430e74[_0x7078('0x28')]['role']!=='user')return _0x162506;var _0x351db3=_['some'](_0x162506,function(_0x2fd789){return _0x2fd789[_0x7078('0x25')]===_0x7078('0x6f')||_0x2fd789[_0x7078('0x25')]===_0x7078('0x2b');});if(!_0x351db3)return _0x162506;return db[_0x7078('0x86')]['findAll']({'where':{'name':{'$or':[_0x7078('0x29'),_0x7078('0x2a')]},'userProfileId':_0x430e74['user'][_0x7078('0x82')]},'raw':!![]})[_0x7078('0x10')](function(_0x45dd0c){if(_[_0x7078('0x87')](_0x45dd0c)||!_['some'](_0x45dd0c,[_0x7078('0x88'),0x0]))return _0x162506;_0x2ee95b=[];var _0x14e1f3=_(_0x45dd0c)[_0x7078('0x2e')](function(_0x347042){if(_0x347042['autoAssociation']===0x1)return;return _0x347042['name']==='Agents'?_0x7078('0x6f'):_0x7078('0x2b');})['compact']()['value']();for(var _0x59326b=0x0;_0x59326b<_0x162506[_0x7078('0x47')];_0x59326b++){if(!_[_0x7078('0x30')](_0x14e1f3,_0x162506[_0x59326b][_0x7078('0x25')]))return;var _0x378d03=_0x162506[_0x59326b]['role']===_0x7078('0x6f')?_0x7078('0x29'):_0x7078('0x2a');_0x2ee95b['push'](db[_0x7078('0x33')][_0x7078('0x7c')]({'name':_0x162506[_0x59326b][_0x7078('0x32')],'resourceId':_0x162506[_0x59326b]['id'],'type':_0x378d03,'sectionId':_[_0x7078('0x31')](_0x45dd0c,[_0x7078('0x32'),_0x378d03])['id']},{}));}return BPromise['all'](_0x2ee95b);});})[_0x7078('0x10')](respondWithResult(_0x30b9c2,0xc9))[_0x7078('0x1a')](handleError(_0x30b9c2,null));};exports[_0x7078('0x89')]=function(_0x1d6ca1,_0x2fd582){if(_0x1d6ca1['body']['id']){delete _0x1d6ca1[_0x7078('0x5c')]['id'];}return db['User']['find']({'where':{'id':_0x1d6ca1[_0x7078('0x4d')]['id']}})['then'](function(_0x3b191c){if(!_0x3b191c)return null;if(_0x3b191c['id']===_0x1d6ca1[_0x7078('0x28')]['id']){if(!_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8a')]||!_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8b')]){throw new db[(_0x7078('0x8c'))][(_0x7078('0x8d'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3b191c[_0x7078('0x8e')](_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8a')])){throw new db[(_0x7078('0x8c'))][(_0x7078('0x8d'))](_0x7078('0x8f'));}if(_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8a')]===_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8b')]){throw new db[(_0x7078('0x8c'))][(_0x7078('0x8d'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x1d6ca1['user'][_0x7078('0x25')]===_0x7078('0x26')){if(!_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8b')]){throw new db['Sequelize'][(_0x7078('0x8d'))](_0x7078('0x90'));}}else if(_0x1d6ca1[_0x7078('0x28')][_0x7078('0x25')]===_0x7078('0x28')){if(!_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8b')]){throw new db[(_0x7078('0x8c'))][(_0x7078('0x8d'))](_0x7078('0x90'));}if(_0x3b191c['role']!=='agent'){throw new db[(_0x7078('0x8c'))][(_0x7078('0x8d'))](_0x7078('0x7d'));}}else{throw new db[(_0x7078('0x8c'))][(_0x7078('0x8d'))](_0x7078('0x7d'));}return _0x3b191c;})[_0x7078('0x10')](handleEntityNotFound(_0x2fd582,null))[_0x7078('0x10')](function(_0x4f7701){return db['Setting']['findOne']({'attributes':['id',_0x7078('0x64'),'enforcePasswordHistory',_0x7078('0x91')]})[_0x7078('0x10')](function(_0x147c60){if(_0x147c60[_0x7078('0x64')])authService[_0x7078('0x92')](_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8b')]);if(!_0x147c60['enforcePasswordHistory']||!_0x4f7701[_0x7078('0x93')])return _0x4f7701;authService[_0x7078('0x94')](_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8b')],_0x4f7701['previousPasswords'],_0x147c60[_0x7078('0x91')]);return _0x4f7701;})[_0x7078('0x10')](saveUpdates({'password':_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8b')],'passwordResetAt':_0x1d6ca1[_0x7078('0x28')]['id']==_0x1d6ca1['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x1d6ca1[_0x7078('0x5c')][_0x7078('0x8b')],_0x4f7701[_0x7078('0x93')])},null));})['then'](respondWithResult(_0x2fd582,null))['catch'](handleError(_0x2fd582,null));};exports[_0x7078('0x95')]=function(_0x266bc5,_0x1aaf58){var _0x22dad3=_0x266bc5[_0x7078('0x5c')][_0x7078('0x96')];return db[_0x7078('0x39')]['find']({'where':{'id':_0x266bc5[_0x7078('0x4d')]['id']},'attributes':['id',_0x7078('0x32'),_0x7078('0x25'),_0x7078('0x97'),_0x7078('0x98'),_0x7078('0x99'),_0x7078('0x9a')]})[_0x7078('0x10')](handleEntityNotFound(_0x1aaf58,null))[_0x7078('0x10')](function(_0x414217){if(_0x414217){if(!utils[_0x7078('0x9b')](_0x22dad3)){throw new db['Sequelize'][(_0x7078('0x8d'))](_0x7078('0x9c'));}return _0x414217[_0x7078('0x9d')+_[_0x7078('0x9e')](_0x22dad3[_0x7078('0x9f')]())+'Queues'](_0x266bc5['body'][_0x7078('0x5f')],{'penalty':_0x266bc5[_0x7078('0x5c')][_0x7078('0xa0')]||0x0})[_0x7078('0xa1')](function(_0x14e9c5){for(var _0xdbe8c5=0x0;_0xdbe8c5<_0x266bc5[_0x7078('0x5c')][_0x7078('0x5f')][_0x7078('0x47')];_0xdbe8c5+=0x1){var _0x4962f1={'UserId':Number(_0x266bc5[_0x7078('0x4d')]['id'])};_0x4962f1[_[_0x7078('0x9e')](_0x22dad3[_0x7078('0x9f')]())+_0x7078('0xa2')]=Number(_0x266bc5['body'][_0x7078('0x5f')][_0xdbe8c5]);socket[_0x7078('0xa3')]('user'+_[_0x7078('0x9e')](_0x22dad3[_0x7078('0x9f')]())+'Queue:save',_0x4962f1);}return _0x14e9c5;})[_0x7078('0x10')](function(){if(_0x22dad3===_0x7078('0xa4')){return db[_0x7078('0xa5')]['findAll']({'where':{'id':_0x266bc5['body']['ids']||[]},'raw':!![],'attributes':['id',_0x7078('0x32')]});}})['then'](function(_0x5901bb){var _0x124580=_0x414217[_0x7078('0x24')]({'plain':!![]});var _0x365aa1=[];if(_0x22dad3===_0x7078('0xa4')&&_0x124580['role']===_0x7078('0x6f')&&_0x124580[_0x7078('0x97')]){for(var _0xe2710f=0x0;_0xe2710f<_0x5901bb[_0x7078('0x47')];_0xe2710f+=0x1){_0x365aa1[_0x7078('0x43')]({'membername':_0x124580['name'],'UserId':_0x124580['id'],'queue_name':_0x5901bb[_0xe2710f][_0x7078('0x32')],'VoiceQueueId':_0x5901bb[_0xe2710f]['id'],'interface':_[_0x7078('0x65')](_0x124580['interface'])?util[_0x7078('0xa6')](_0x7078('0xa7'),_0x124580['name']):_0x124580[_0x7078('0x9a')],'paused':_0x124580[_0x7078('0x99')]||![],'penalty':_0x266bc5['body'][_0x7078('0xa0')]||0x0});}return BPromise['each'](_0x365aa1,function(_0x46be01){return db[_0x7078('0xa8')][_0x7078('0xa9')](_0x46be01);});}return _0x414217;});}})['then'](respondWithStatusCode(_0x1aaf58,null))[_0x7078('0x1a')](handleError(_0x1aaf58,null));};exports['removeQueues']=function(_0x5976a7,_0x2dbbc2){var _0x38b67b;return db[_0x7078('0x39')][_0x7078('0x31')]({'where':{'id':_0x5976a7[_0x7078('0x4d')]['id']},'attributes':['id',_0x7078('0x32'),_0x7078('0x25')]})[_0x7078('0x10')](handleEntityNotFound(_0x2dbbc2,null))[_0x7078('0x10')](function(_0x388f56){if(_0x388f56){_0x38b67b=_0x388f56;if(!_0x5976a7[_0x7078('0x46')][_0x7078('0x96')]||!utils[_0x7078('0x9b')](_0x5976a7[_0x7078('0x46')]['channel'])){throw new db['Sequelize']['ValidationError'](_0x7078('0x9c'));}return _0x388f56[_0x7078('0xaa')+_['capitalize'](_0x5976a7[_0x7078('0x46')][_0x7078('0x96')][_0x7078('0x9f')]())+_0x7078('0xab')](_0x5976a7[_0x7078('0x46')][_0x7078('0x5f')]);}})[_0x7078('0x10')](function(_0x56eb87){if(_[_0x7078('0xac')](_0x5976a7[_0x7078('0x46')][_0x7078('0x5f')])){for(var _0x40ebcf=0x0;_0x40ebcf<_0x5976a7[_0x7078('0x46')][_0x7078('0x5f')]['length'];_0x40ebcf+=0x1){var _0x2da698={'UserId':Number(_0x5976a7[_0x7078('0x4d')]['id'])};_0x2da698[_['capitalize'](_0x5976a7['query'][_0x7078('0x96')][_0x7078('0x9f')]())+'QueueId']=Number(_0x5976a7[_0x7078('0x46')][_0x7078('0x5f')][_0x40ebcf]);socket[_0x7078('0xa3')](_0x7078('0x28')+_['capitalize'](_0x5976a7['query'][_0x7078('0x96')][_0x7078('0x9f')]())+_0x7078('0xad'),_0x2da698);}}else{var _0x2da698={'UserId':Number(_0x5976a7[_0x7078('0x4d')]['id'])};_0x2da698[_['capitalize'](_0x5976a7[_0x7078('0x46')]['channel'][_0x7078('0x9f')]())+_0x7078('0xa2')]=Number(_0x5976a7[_0x7078('0x46')]['ids']);socket[_0x7078('0xa3')]('user'+_[_0x7078('0x9e')](_0x5976a7['query'][_0x7078('0x96')]['toLowerCase']())+_0x7078('0xad'),_0x2da698);}return _0x56eb87;})['then'](function(){if(_0x5976a7[_0x7078('0x46')]['channel']===_0x7078('0xa4')){return db[_0x7078('0xa8')][_0x7078('0x34')]({'where':{'UserId':_0x5976a7[_0x7078('0x4d')]['id'],'VoiceQueueId':_0x5976a7[_0x7078('0x46')][_0x7078('0x5f')]},'individualHooks':!![]})[_0x7078('0x10')](function(){return _0x38b67b;});}return _0x38b67b;})[_0x7078('0x10')](respondWithStatusCode(_0x2dbbc2,null))['catch'](handleError(_0x2dbbc2,null));};exports[_0x7078('0xae')]=function(_0x282981,_0x30ba81){_0x282981['body']['userpic']=_0x282981[_0x7078('0xaf')]['filename'];return db[_0x7078('0x39')][_0x7078('0x31')]({'where':{'id':_0x282981['params']['id']}})['then'](handleEntityNotFound(_0x30ba81,null))['then'](saveUpdates(_0x282981[_0x7078('0x5c')],null))[_0x7078('0x10')](respondWithResult(_0x30ba81,null))[_0x7078('0x1a')](handleError(_0x30ba81,null));};exports[_0x7078('0xb0')]=function(_0x67757e,_0x583efc){var _0xb6a57b=path['join'](config['root'],_0x7078('0xb1'));return db[_0x7078('0x39')][_0x7078('0x31')]({'where':{'id':_0x67757e['params']['id']},'attributes':['id',_0x7078('0xb2')],'raw':!![]})[_0x7078('0x10')](handleEntityNotFound(_0x583efc,null))[_0x7078('0x10')](function(_0x3697cf){if(_0x3697cf){if(_[_0x7078('0x65')](_0x3697cf['userpic'])){return _0x583efc['download'](_0xb6a57b);}else{if(!fs[_0x7078('0xb3')](path[_0x7078('0xb4')](config['root'],_0x7078('0xb5'),_0x3697cf['userpic']))){return _0x583efc['download'](_0xb6a57b);}return _0x583efc['download'](path[_0x7078('0xb4')](config['root'],_0x7078('0xb5'),_0x3697cf['userpic']));}}})[_0x7078('0x1a')](handleError(_0x583efc,null));};exports['getOpenTabs']=function(_0x2cf233,_0x545c99){return db['User'][_0x7078('0x31')]({'where':{'id':_0x2cf233['params']['id']},'attributes':['id']})[_0x7078('0x10')](handleEntityNotFound(_0x545c99,null))['then'](function(_0xd80f59){var _0x211c16=[];values=_0xd80f59[_0x7078('0x48')];_0x211c16['push'](get_open_tabs(_0x7078('0xb6'),_0xd80f59[_0x7078('0x48')]));_0x211c16[_0x7078('0x43')](get_open_tabs(_0x7078('0x5a'),_0xd80f59['dataValues']));_0x211c16[_0x7078('0x43')](get_open_tabs(_0x7078('0x4a'),_0xd80f59[_0x7078('0x48')]));_0x211c16[_0x7078('0x43')](get_open_tabs(_0x7078('0x4b'),_0xd80f59['dataValues']));_0x211c16[_0x7078('0x43')](get_open_tabs(_0x7078('0x49'),_0xd80f59[_0x7078('0x48')]));_0x211c16['push'](get_open_tabs(_0x7078('0x5b'),_0xd80f59[_0x7078('0x48')]));return BPromise[_0x7078('0x4c')](_0x211c16);})[_0x7078('0x10')](function(_0x1b10b3){var _0x4109ea=[];if(_0x1b10b3){for(var _0x34e09e=0x0;_0x34e09e=_0x410157){_0x31799b=_0x410157;_0x22a5c2=0xc8;}else{_0x22a5c2=0xce;}_0x2f1b31['status'](_0x22a5c2);return _0x2f1b31[_0x0580('0x23')](_0x0580('0x24'),_0x41e4dc+'-'+_0x31799b+'/'+_0x410157)['json'](_0x4a5bee);}return null;};}function saveUpdates(_0x36333e){return function(_0x2720f3){if(_0x2720f3){return _0x2720f3[_0x0580('0x25')](_0x36333e)[_0x0580('0x11')](function(_0x55cb58){return _0x55cb58;});}return null;};}function removeEntity(_0x3c692c){return function(_0x281c6b){if(_0x281c6b){return _0x281c6b[_0x0580('0x26')]()[_0x0580('0x11')](function(){var _0x2522df=_0x281c6b[_0x0580('0x27')]({'plain':!![]});if(_0x2522df[_0x0580('0x28')]===_0x0580('0x29'))return;var _0x302f70=[{'name':_0x0580('0x2a'),'value':_0x0580('0x2b'),'ignore':!![]},{'name':_0x0580('0x2c'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0x0580('0x2d'),'ignore':![]}];var _0x1eaef0=_(_0x302f70)[_0x0580('0x2e')](_0x0580('0x2f'))[_0x0580('0x30')](_0x0580('0x31'))[_0x0580('0x31')]();if(_[_0x0580('0x32')](_0x1eaef0,_0x2522df[_0x0580('0x28')])){return;}var _0x4aaebf=_[_0x0580('0x33')](_0x302f70,[_0x0580('0x31'),_0x2522df[_0x0580('0x28')]])[_0x0580('0x34')];return db[_0x0580('0x35')][_0x0580('0x26')]({'where':{'type':_0x4aaebf,'resourceId':_0x2522df['id']}})['then'](function(){return _0x281c6b;});})[_0x0580('0x11')](function(){_0x3c692c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x169cdb){return function(_0x3024ae){if(!_0x3024ae){_0x169cdb[_0x0580('0x1b')](0x194);}return _0x3024ae;};}function handleError(_0x24a120,_0x3baa77){_0x3baa77=_0x3baa77||0x1f4;return function(_0x16dbf0){logger['error'](_0x16dbf0[_0x0580('0x36')]);if(_0x16dbf0[_0x0580('0x34')]){delete _0x16dbf0[_0x0580('0x34')];}_0x24a120[_0x0580('0x1c')](_0x3baa77)['send'](_0x16dbf0);};}exports[_0x0580('0x37')]=function(_0xd9f3d,_0x4e8856){var _0x10ae51={},_0x20081e={'count':0x0,'rows':[]};var _0x116d6c=_(db['User']['rawAttributes'])['map'](function(_0x2cc5ad){return{'name':_0x2cc5ad['fieldName'],'type':_0x2cc5ad[_0x0580('0x38')][_0x0580('0x39')]};})['filter'](function(_0x4c533f){return!_[_0x0580('0x32')]([_0x0580('0x3a'),'salt'],_0x4c533f[_0x0580('0x34')]);})[_0x0580('0x31')]();_0x10ae51=qs['getOptions'](_0x116d6c,_0xd9f3d);var _0x47510d={'where':_0x10ae51[_0x0580('0x3b')]};return db[_0x0580('0x3c')][_0x0580('0x22')](_0x47510d)[_0x0580('0x11')](function(_0x4ed61b){_0x20081e[_0x0580('0x22')]=_0x4ed61b;if(_0xd9f3d[_0x0580('0x3d')][_0x0580('0x3e')]){_0x10ae51['include']=[{'all':!![]}];}if(!_['includes'](_0x10ae51['attributes'],'id')){_0x10ae51[_0x0580('0x3f')]['push']('id');}return db[_0x0580('0x3c')][_0x0580('0x40')](_0x10ae51);})[_0x0580('0x11')](function(_0x1b702a){_0x20081e['rows']=_0x1b702a;if(_0xd9f3d[_0x0580('0x3d')][_0x0580('0x41')]===_0x0580('0x42')){var _0x146f29=[];for(var _0x215f3c=0x0;_0x215f3c<_0x20081e['rows'][_0x0580('0x43')];_0x215f3c++){_0x146f29[_0x0580('0x44')](get_open_tabs(_0x0580('0x45'),_0x20081e[_0x0580('0x46')][_0x215f3c][_0x0580('0x47')]));_0x146f29['push'](get_open_tabs(_0x0580('0x48'),_0x20081e[_0x0580('0x46')][_0x215f3c][_0x0580('0x47')]));_0x146f29[_0x0580('0x44')](get_open_tabs(_0x0580('0x49'),_0x20081e[_0x0580('0x46')][_0x215f3c]['dataValues']));_0x146f29[_0x0580('0x44')](get_open_tabs(_0x0580('0x4a'),_0x20081e[_0x0580('0x46')][_0x215f3c][_0x0580('0x47')]));_0x146f29[_0x0580('0x44')](get_open_tabs(_0x0580('0x4b'),_0x20081e[_0x0580('0x46')][_0x215f3c][_0x0580('0x47')]));_0x146f29['push'](get_open_tabs('whatsapp',_0x20081e[_0x0580('0x46')][_0x215f3c][_0x0580('0x47')]));}return BPromise['all'](_0x146f29)[_0x0580('0x11')](function(_0xa3ddfe){return _0x20081e;});}else{return _0x20081e;}})[_0x0580('0x11')](respondWithFilteredResult(_0x4e8856,_0x10ae51))['catch'](handleError(_0x4e8856,null));};exports[_0x0580('0x4c')]=function(_0x3e40f2,_0x5ecd36){var _0x562452={'raw':![],'where':{'id':_0x3e40f2['params']['id']}},_0x2ffd1e={};_0x2ffd1e[_0x0580('0x4d')]=_['differenceBy'](_[_0x0580('0x4e')](db[_0x0580('0x3c')][_0x0580('0x4f')]),[_0x0580('0x3a'),'salt']);_0x2ffd1e[_0x0580('0x3d')]=_[_0x0580('0x4e')](_0x3e40f2['query']);_0x2ffd1e[_0x0580('0x50')]=_['intersection'](_0x2ffd1e[_0x0580('0x4d')],_0x2ffd1e['query']);_0x562452[_0x0580('0x3f')]=_[_0x0580('0x51')](_0x2ffd1e[_0x0580('0x4d')],qs[_0x0580('0x52')](_0x3e40f2['query'][_0x0580('0x52')]));_0x562452['attributes']=_0x562452[_0x0580('0x3f')][_0x0580('0x43')]?_0x562452[_0x0580('0x3f')]:_0x2ffd1e[_0x0580('0x4d')];if(_0x3e40f2[_0x0580('0x3d')]['includeAll']){_0x562452[_0x0580('0x53')]=[{'all':!![]}];}_0x562452=_['merge']({},_0x562452,_0x3e40f2[_0x0580('0x54')]);if(!_['includes'](_0x562452[_0x0580('0x3f')],'id')){_0x562452[_0x0580('0x3f')]['push']('id');}return db['User'][_0x0580('0x33')](_0x562452)[_0x0580('0x11')](handleEntityNotFound(_0x5ecd36,null))[_0x0580('0x11')](function(_0x5eec59){var _0x2ff5e5=[];values=_0x5eec59;if(_0x3e40f2[_0x0580('0x3d')][_0x0580('0x41')]===_0x0580('0x42')){_0x2ff5e5[_0x0580('0x44')](get_open_tabs('chat',_0x5eec59[_0x0580('0x47')]));_0x2ff5e5[_0x0580('0x44')](get_open_tabs(_0x0580('0x48'),_0x5eec59['dataValues']));_0x2ff5e5[_0x0580('0x44')](get_open_tabs('openchannel',_0x5eec59['dataValues']));_0x2ff5e5[_0x0580('0x44')](get_open_tabs('whatsapp',_0x5eec59[_0x0580('0x47')]));_0x2ff5e5[_0x0580('0x44')](get_open_tabs('fax',_0x5eec59['dataValues']));_0x2ff5e5[_0x0580('0x44')](get_open_tabs(_0x0580('0x4a'),_0x5eec59[_0x0580('0x47')]));return BPromise[_0x0580('0x55')](_0x2ff5e5);}else{return values;}})[_0x0580('0x11')](function(_0x298405){return values;})[_0x0580('0x11')](respondWithResult(_0x5ecd36,null))[_0x0580('0x1a')](handleError(_0x5ecd36,null));};exports[_0x0580('0x25')]=function(_0x70fbdd,_0x5deae8){if(_0x70fbdd[_0x0580('0x56')]['id']){delete _0x70fbdd[_0x0580('0x56')]['id'];}delete _0x70fbdd['body'][_0x0580('0x28')];return db[_0x0580('0x3c')][_0x0580('0x33')]({'where':{'id':_0x70fbdd[_0x0580('0x57')]['id']}})[_0x0580('0x11')](handleEntityNotFound(_0x5deae8,null))[_0x0580('0x11')](saveUpdates(_0x70fbdd[_0x0580('0x56')],null))['then'](respondWithResult(_0x5deae8,null))[_0x0580('0x1a')](handleError(_0x5deae8,null));};exports[_0x0580('0x58')]=function(_0x5ef7b7,_0x1dcac4){return db[_0x0580('0x3c')]['describe']()[_0x0580('0x11')](respondWithResult(_0x1dcac4,null))[_0x0580('0x1a')](handleError(_0x1dcac4,null));};exports['addContacts']=function(_0xe40568,_0x436a16){return db[_0x0580('0x3c')][_0x0580('0x33')]({'where':{'id':_0xe40568[_0x0580('0x57')]['id']}})['then'](handleEntityNotFound(_0x436a16,null))[_0x0580('0x11')](function(_0x48d2f7){if(_0x48d2f7){return _0x48d2f7[_0x0580('0x59')](_0xe40568[_0x0580('0x56')]['ids'],_[_0x0580('0x5a')](_0xe40568[_0x0580('0x56')],['ids','id'])||{});}})[_0x0580('0x11')](respondWithResult(_0x436a16,null))[_0x0580('0x1a')](handleError(_0x436a16,null));};function validateUser(_0x2512c2){return new BPromise(function(_0x2aa333,_0x423a2e){if(_0x2512c2[_0x0580('0x5b')])return _0x2aa333(_0x2512c2);return db[_0x0580('0x5c')][_0x0580('0x5d')](0x1)[_0x0580('0x11')](function(_0xf6b11b){if(_0xf6b11b['securePassword'])authService[_0x0580('0x5e')](_0x2512c2[_0x0580('0x3a')]);db[_0x0580('0x3c')][_0x0580('0x5f')](_0x0580('0x5b'))[_0x0580('0x11')](function(_0x4973e4){if(_[_0x0580('0x60')](_0x4973e4)){_0x2512c2[_0x0580('0x5b')]=_0xf6b11b[_0x0580('0x61')]||0x1;return;}if(_['isNil'](_0xf6b11b[_0x0580('0x61')])||_0xf6b11b['min_internal']===_0x4973e4){_0x2512c2['internal']=_0x4973e4+0x1;return;}if(_0xf6b11b[_0x0580('0x61')]>_0x4973e4){_0x2512c2[_0x0580('0x5b')]=_0xf6b11b[_0x0580('0x61')];return;}return db[_0x0580('0x62')]['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x0580('0x62')][_0x0580('0x63')][_0x0580('0x64')]})['then'](function(_0x3b5aab){if(_0x3b5aab&&_0x3b5aab['length']){for(var _0x58b358=0x0,_0x521379=_0x3b5aab[_0x0580('0x43')];_0x58b358<_0x521379&&_[_0x0580('0x60')](_0x2512c2[_0x0580('0x5b')]);_0x58b358++){if(_0xf6b11b['min_internal']<=_0x3b5aab[_0x58b358][_0x0580('0x65')]){_0x2512c2['internal']=_0x3b5aab[_0x58b358][_0x0580('0x65')];}else if(_0xf6b11b[_0x0580('0x61')]>_0x3b5aab[_0x58b358][_0x0580('0x65')]&&_0xf6b11b['min_internal']<=_0x3b5aab[_0x58b358]['to']){_0x2512c2[_0x0580('0x5b')]=_0xf6b11b['min_internal'];}}}if(_[_0x0580('0x60')](_0x2512c2['internal'])){_0x2512c2['internal']=_0x4973e4+0x1;}return _0x2aa333(_0x2512c2);});});})[_0x0580('0x1a')](function(_0x52818c){_0x423a2e(_0x52818c);});});}function updateUser(_0x474bea){return new BPromise(function(_0x464ba6,_0xe60587){try{if(_0x474bea[_0x0580('0x66')]){_0x474bea[_0x0580('0x67')]=_0x474bea[_0x0580('0x5b')];_0x474bea[_0x0580('0x68')]={'mailbox':_0x474bea['internal'],'password':_0x474bea[_0x0580('0x3a')],'fullname':_0x474bea[_0x0580('0x69')],'email':_0x474bea['email']};}if(_0x474bea['role']===_0x0580('0x6a')){if(!_0x474bea[_0x0580('0x6b')])_0x474bea['permissions']=[_0x0580('0x6c'),'102',_0x0580('0x6d'),_0x0580('0x6e'),_0x0580('0x6f'),_0x0580('0x70'),'105',_0x0580('0x71'),_0x0580('0x72'),_0x0580('0x73'),'109',_0x0580('0x74'),_0x0580('0x75'),_0x0580('0x76'),_0x0580('0x77')];}_0x464ba6(_0x474bea);}catch(_0x4a7475){_0xe60587(_0x4a7475);}});}exports[_0x0580('0x78')]=function(_0xd539d,_0x9d6625){if(_0xd539d[_0x0580('0x2b')]['role']==='agent')throw new Error(_0x0580('0x79'));if(_0xd539d[_0x0580('0x56')][_0x0580('0x28')]==='user'&&_0xd539d[_0x0580('0x2b')]['role']!==_0x0580('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0xd539d['body'][_0x0580('0x28')]==='admin'&&_0xd539d['user'][_0x0580('0x28')]!==_0x0580('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0xd539d[_0x0580('0x56')]])[_0x0580('0x11')](function(){return validateUser(_0xd539d[_0x0580('0x56')]);})[_0x0580('0x11')](function(_0x26ad8a){return updateUser(_0x26ad8a)['then'](function(_0x458cc7){if(_0x458cc7['role']===_0x0580('0x29')){_0x458cc7[_0x0580('0x7a')]=_0xd539d[_0x0580('0x2b')][_0x0580('0x7a')];delete _0x458cc7[_0x0580('0x7b')];}return _0x458cc7;});})['then'](function(_0x46e288){return db[_0x0580('0x3c')][_0x0580('0x78')](_0x46e288,{'include':[{'model':db[_0x0580('0x68')],'as':'VoiceMail'}]});})['then'](function(_0x5cdfb1){if(_0xd539d[_0x0580('0x56')][_0x0580('0x28')]===_0x0580('0x2b'))return _0x5cdfb1;if(_0xd539d[_0x0580('0x2b')][_0x0580('0x28')]!==_0x0580('0x2b'))return _0x5cdfb1;return db[_0x0580('0x7c')][_0x0580('0x33')]({'where':{'name':_0x5cdfb1['role']==='agent'?'Agents':_0x0580('0x7d'),'userProfileId':_0xd539d['user'][_0x0580('0x7b')]},'raw':!![]})[_0x0580('0x11')](function(_0x3b6b34){if(!_0x3b6b34||_0x3b6b34[_0x0580('0x7e')]!=0x0)return _0x5cdfb1;return db['UserProfileResource']['create']({'name':_0x5cdfb1[_0x0580('0x34')],'resourceId':_0x5cdfb1['id'],'type':_0x3b6b34[_0x0580('0x34')],'sectionId':_0x3b6b34['id']},{})[_0x0580('0x11')](function(){return _0x5cdfb1;});})[_0x0580('0x1a')](function(_0x4f756e){logger[_0x0580('0x16')](_0x0580('0x7f'),_0x4f756e);throw _0x4f756e;});})[_0x0580('0x11')](respondWithResult(_0x9d6625,0xc9))['catch'](handleError(_0x9d6625,null));};exports[_0x0580('0x80')]=function(_0x4f1be7,_0x29353c){var _0x18f582=_0x4f1be7[_0x0580('0x56')];var _0x57e14a=[];if(_0x4f1be7['user']['role']==='agent')throw new Error(_0x0580('0x79'));if(_['some'](_0x18f582,[_0x0580('0x28'),'user'])&&_0x4f1be7[_0x0580('0x2b')][_0x0580('0x28')]!==_0x0580('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x0580('0x81')](_0x18f582,['role',_0x0580('0x29')])&&_0x4f1be7[_0x0580('0x2b')][_0x0580('0x28')]!==_0x0580('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x18f582)[_0x0580('0x11')](function(){return validateUser(_0x18f582[0x0]);})[_0x0580('0x11')](function(){for(var _0x2252bc=0x1;_0x2252bc<_0x18f582[_0x0580('0x43')];_0x2252bc++){var _0x1359a5=_0x18f582[_0x2252bc-0x1][_0x0580('0x5b')];if(!_0x18f582[_0x2252bc][_0x0580('0x5b')])_0x18f582[_0x2252bc]['internal']=_0x1359a5+0x1;_0x57e14a[_0x0580('0x44')](validateUser(_0x18f582[_0x2252bc]));}return BPromise['all'](_0x57e14a);})['then'](function(){_0x57e14a=[];for(var _0x37f631=0x0;_0x37f631<_0x18f582[_0x0580('0x43')];_0x37f631++){_0x57e14a[_0x0580('0x44')](updateUser(_0x18f582[_0x37f631]));}return BPromise[_0x0580('0x55')](_0x57e14a);})['then'](function(){return BPromise['each'](_0x18f582,function(_0x5d2d78){return db['User']['create'](_0x5d2d78,{'include':[{'model':db[_0x0580('0x68')],'as':_0x0580('0x68')}]})[_0x0580('0x11')](function(_0x81cde3){_0x5d2d78['id']=_0x81cde3['id'];return _0x5d2d78;});});})[_0x0580('0x11')](function(_0xd36f35){if(_0x4f1be7['body'][_0x0580('0x28')]===_0x0580('0x2b'))return _0xd36f35;if(_0x4f1be7[_0x0580('0x2b')]['role']!==_0x0580('0x2b'))return _0xd36f35;var _0x3f0f87=_[_0x0580('0x81')](_0xd36f35,function(_0x41c327){return _0x41c327[_0x0580('0x28')]==='agent'||_0x41c327['role']===_0x0580('0x2d');});if(!_0x3f0f87)return _0xd36f35;return db[_0x0580('0x7c')][_0x0580('0x40')]({'where':{'name':{'$or':[_0x0580('0x2c'),'Telephones']},'userProfileId':_0x4f1be7['user']['userProfileId']},'raw':!![]})[_0x0580('0x11')](function(_0x33a9a4){if(_[_0x0580('0x82')](_0x33a9a4)||!_['some'](_0x33a9a4,[_0x0580('0x7e'),0x0]))return _0xd36f35;_0x57e14a=[];var _0x3ba55b=_(_0x33a9a4)['map'](function(_0x4a422a){if(_0x4a422a[_0x0580('0x7e')]===0x1)return;return _0x4a422a[_0x0580('0x34')]===_0x0580('0x2c')?_0x0580('0x6a'):_0x0580('0x2d');})[_0x0580('0x83')]()[_0x0580('0x31')]();for(var _0x932b25=0x0;_0x932b25<_0xd36f35[_0x0580('0x43')];_0x932b25++){if(!_['includes'](_0x3ba55b,_0xd36f35[_0x932b25][_0x0580('0x28')]))return;var _0x53e40b=_0xd36f35[_0x932b25][_0x0580('0x28')]===_0x0580('0x6a')?_0x0580('0x2c'):'Telephones';_0x57e14a[_0x0580('0x44')](db['UserProfileResource'][_0x0580('0x78')]({'name':_0xd36f35[_0x932b25]['name'],'resourceId':_0xd36f35[_0x932b25]['id'],'type':_0x53e40b,'sectionId':_[_0x0580('0x33')](_0x33a9a4,[_0x0580('0x34'),_0x53e40b])['id']},{}));}return BPromise[_0x0580('0x55')](_0x57e14a);});})[_0x0580('0x11')](respondWithResult(_0x29353c,0xc9))['catch'](handleError(_0x29353c,null));};exports[_0x0580('0x84')]=function(_0x45abae,_0x2ce6b0){if(_0x45abae['body']['id']){delete _0x45abae['body']['id'];}return db[_0x0580('0x3c')][_0x0580('0x33')]({'where':{'id':_0x45abae[_0x0580('0x57')]['id']}})[_0x0580('0x11')](function(_0x9a0e94){if(!_0x9a0e94)return null;if(_0x9a0e94['id']===_0x45abae[_0x0580('0x2b')]['id']){if(!_0x45abae['body'][_0x0580('0x85')]||!_0x45abae[_0x0580('0x56')]['newPassword']){throw new db['Sequelize'][(_0x0580('0x86'))](_0x0580('0x87'));}if(!_0x9a0e94[_0x0580('0x88')](_0x45abae[_0x0580('0x56')][_0x0580('0x85')])){throw new db[(_0x0580('0x89'))]['ValidationError']('Wrong\x20credentials');}if(_0x45abae['body'][_0x0580('0x85')]===_0x45abae[_0x0580('0x56')][_0x0580('0x8a')]){throw new db[(_0x0580('0x89'))][(_0x0580('0x86'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x45abae[_0x0580('0x2b')][_0x0580('0x28')]===_0x0580('0x29')){if(!_0x45abae[_0x0580('0x56')][_0x0580('0x8a')]){throw new db[(_0x0580('0x89'))][(_0x0580('0x86'))](_0x0580('0x8b'));}}else if(_0x45abae[_0x0580('0x2b')]['role']==='user'){if(!_0x45abae[_0x0580('0x56')][_0x0580('0x8a')]){throw new db[(_0x0580('0x89'))]['ValidationError'](_0x0580('0x8b'));}if(_0x9a0e94['role']!==_0x0580('0x6a')){throw new db[(_0x0580('0x89'))][(_0x0580('0x86'))]('Unauthorized');}}else{throw new db['Sequelize'][(_0x0580('0x86'))](_0x0580('0x79'));}return _0x9a0e94;})[_0x0580('0x11')](handleEntityNotFound(_0x2ce6b0,null))[_0x0580('0x11')](function(_0x14474d){return db[_0x0580('0x5c')]['findOne']({'attributes':['id','securePassword',_0x0580('0x8c'),_0x0580('0x8d')]})[_0x0580('0x11')](function(_0x36bc46){if(_0x36bc46[_0x0580('0x8e')])authService[_0x0580('0x5e')](_0x45abae[_0x0580('0x56')][_0x0580('0x8a')]);if(!_0x36bc46[_0x0580('0x8c')]||!_0x14474d[_0x0580('0x8f')])return _0x14474d;authService[_0x0580('0x90')](_0x45abae[_0x0580('0x56')][_0x0580('0x8a')],_0x14474d[_0x0580('0x8f')],_0x36bc46[_0x0580('0x8d')]);return _0x14474d;})['then'](saveUpdates({'password':_0x45abae[_0x0580('0x56')][_0x0580('0x8a')],'passwordResetAt':_0x45abae['user']['id']==_0x45abae[_0x0580('0x57')]['id']?moment():null,'previousPasswords':authService[_0x0580('0x91')](_0x45abae[_0x0580('0x56')][_0x0580('0x8a')],_0x14474d[_0x0580('0x8f')])},null));})['then'](respondWithResult(_0x2ce6b0,null))[_0x0580('0x1a')](handleError(_0x2ce6b0,null));};exports[_0x0580('0x92')]=function(_0x18d8fe,_0x249acc){var _0x46109e=_0x18d8fe[_0x0580('0x56')][_0x0580('0x93')];return db[_0x0580('0x3c')][_0x0580('0x33')]({'where':{'id':_0x18d8fe[_0x0580('0x57')]['id']},'attributes':['id','name','role',_0x0580('0x94'),_0x0580('0x95'),'voicePause',_0x0580('0x96')]})['then'](handleEntityNotFound(_0x249acc,null))['then'](function(_0x28db1f){if(_0x28db1f){if(!utils['isValidChannel'](_0x46109e)){throw new db[(_0x0580('0x89'))][(_0x0580('0x86'))](_0x0580('0x97'));}return _0x28db1f[_0x0580('0x98')+_['capitalize'](_0x46109e[_0x0580('0x99')]())+_0x0580('0x9a')](_0x18d8fe[_0x0580('0x56')]['ids'],{'penalty':_0x18d8fe['body'][_0x0580('0x9b')]||0x0})[_0x0580('0x9c')](function(_0x493c08){for(var _0x9a3079=0x0;_0x9a3079<_0x18d8fe['body'][_0x0580('0x9d')][_0x0580('0x43')];_0x9a3079+=0x1){var _0x13af94={'UserId':Number(_0x18d8fe[_0x0580('0x57')]['id'])};_0x13af94[_[_0x0580('0x9e')](_0x46109e[_0x0580('0x99')]())+_0x0580('0x9f')]=Number(_0x18d8fe[_0x0580('0x56')][_0x0580('0x9d')][_0x9a3079]);socket[_0x0580('0xa0')]('user'+_[_0x0580('0x9e')](_0x46109e['toLowerCase']())+_0x0580('0xa1'),_0x13af94);}return _0x493c08;})[_0x0580('0x11')](function(){if(_0x46109e===_0x0580('0xa2')){return db['VoiceQueue'][_0x0580('0x40')]({'where':{'id':_0x18d8fe[_0x0580('0x56')][_0x0580('0x9d')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x88b2af){var _0x1d9034=_0x28db1f['get']({'plain':!![]});var _0x1bc10d=[];if(_0x46109e===_0x0580('0xa2')&&_0x1d9034[_0x0580('0x28')]===_0x0580('0x6a')&&_0x1d9034['online']){for(var _0x483674=0x0;_0x483674<_0x88b2af[_0x0580('0x43')];_0x483674+=0x1){_0x1bc10d[_0x0580('0x44')]({'membername':_0x1d9034[_0x0580('0x34')],'UserId':_0x1d9034['id'],'queue_name':_0x88b2af[_0x483674][_0x0580('0x34')],'VoiceQueueId':_0x88b2af[_0x483674]['id'],'interface':_[_0x0580('0x60')](_0x1d9034[_0x0580('0x96')])?util[_0x0580('0xa3')](_0x0580('0xa4'),_0x1d9034[_0x0580('0x34')]):_0x1d9034['interface'],'paused':_0x1d9034[_0x0580('0xa5')]||![],'penalty':_0x18d8fe[_0x0580('0x56')][_0x0580('0x9b')]||0x0});}return BPromise[_0x0580('0xa6')](_0x1bc10d,function(_0x13fe65){return db[_0x0580('0xa7')]['upsert'](_0x13fe65);});}return _0x28db1f;});}})[_0x0580('0x11')](respondWithStatusCode(_0x249acc,null))['catch'](handleError(_0x249acc,null));};exports['removeQueues']=function(_0x5f329b,_0x37a946){var _0x29ac4b;return db[_0x0580('0x3c')][_0x0580('0x33')]({'where':{'id':_0x5f329b[_0x0580('0x57')]['id']},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x37a946,null))[_0x0580('0x11')](function(_0x4aca03){if(_0x4aca03){_0x29ac4b=_0x4aca03;if(!_0x5f329b[_0x0580('0x3d')]['channel']||!utils[_0x0580('0xa8')](_0x5f329b[_0x0580('0x3d')][_0x0580('0x93')])){throw new db['Sequelize'][(_0x0580('0x86'))](_0x0580('0x97'));}return _0x4aca03['remove'+_['capitalize'](_0x5f329b[_0x0580('0x3d')][_0x0580('0x93')][_0x0580('0x99')]())+_0x0580('0x9a')](_0x5f329b[_0x0580('0x3d')][_0x0580('0x9d')]);}})[_0x0580('0x11')](function(_0x3c7f1d){if(_['isArray'](_0x5f329b[_0x0580('0x3d')][_0x0580('0x9d')])){for(var _0x2afbbf=0x0;_0x2afbbf<_0x5f329b[_0x0580('0x3d')][_0x0580('0x9d')][_0x0580('0x43')];_0x2afbbf+=0x1){var _0x1ad8e9={'UserId':Number(_0x5f329b[_0x0580('0x57')]['id'])};_0x1ad8e9[_[_0x0580('0x9e')](_0x5f329b[_0x0580('0x3d')]['channel'][_0x0580('0x99')]())+_0x0580('0x9f')]=Number(_0x5f329b[_0x0580('0x3d')]['ids'][_0x2afbbf]);socket['emit'](_0x0580('0x2b')+_[_0x0580('0x9e')](_0x5f329b[_0x0580('0x3d')][_0x0580('0x93')][_0x0580('0x99')]())+_0x0580('0xa9'),_0x1ad8e9);}}else{var _0x1ad8e9={'UserId':Number(_0x5f329b['params']['id'])};_0x1ad8e9[_[_0x0580('0x9e')](_0x5f329b[_0x0580('0x3d')][_0x0580('0x93')]['toLowerCase']())+_0x0580('0x9f')]=Number(_0x5f329b['query']['ids']);socket['emit'](_0x0580('0x2b')+_['capitalize'](_0x5f329b[_0x0580('0x3d')][_0x0580('0x93')][_0x0580('0x99')]())+_0x0580('0xa9'),_0x1ad8e9);}return _0x3c7f1d;})['then'](function(){if(_0x5f329b['query'][_0x0580('0x93')]==='voice'){return db[_0x0580('0xa7')]['destroy']({'where':{'UserId':_0x5f329b[_0x0580('0x57')]['id'],'VoiceQueueId':_0x5f329b[_0x0580('0x3d')][_0x0580('0x9d')]},'individualHooks':!![]})['then'](function(){return _0x29ac4b;});}return _0x29ac4b;})[_0x0580('0x11')](respondWithStatusCode(_0x37a946,null))[_0x0580('0x1a')](handleError(_0x37a946,null));};exports['addAvatar']=function(_0x1c84f1,_0x8482e3){_0x1c84f1['body'][_0x0580('0xaa')]=_0x1c84f1['file'][_0x0580('0xab')];return db['User'][_0x0580('0x33')]({'where':{'id':_0x1c84f1[_0x0580('0x57')]['id']}})[_0x0580('0x11')](handleEntityNotFound(_0x8482e3,null))[_0x0580('0x11')](saveUpdates(_0x1c84f1[_0x0580('0x56')],null))[_0x0580('0x11')](respondWithResult(_0x8482e3,null))[_0x0580('0x1a')](handleError(_0x8482e3,null));};exports['getAvatar']=function(_0x232b8d,_0x2f1712){var _0x25a00f=path[_0x0580('0xac')](config[_0x0580('0xad')],_0x0580('0xae'));return db['User'][_0x0580('0x33')]({'where':{'id':_0x232b8d[_0x0580('0x57')]['id']},'attributes':['id',_0x0580('0xaa')],'raw':!![]})['then'](handleEntityNotFound(_0x2f1712,null))[_0x0580('0x11')](function(_0x328957){if(_0x328957){if(_['isNil'](_0x328957[_0x0580('0xaa')])){return _0x2f1712[_0x0580('0xaf')](_0x25a00f);}else{if(!fs[_0x0580('0xb0')](path[_0x0580('0xac')](config[_0x0580('0xad')],'server/files/images/',_0x328957['userpic']))){return _0x2f1712[_0x0580('0xaf')](_0x25a00f);}return _0x2f1712[_0x0580('0xaf')](path[_0x0580('0xac')](config[_0x0580('0xad')],_0x0580('0xb1'),_0x328957[_0x0580('0xaa')]));}}})[_0x0580('0x1a')](handleError(_0x2f1712,null));};exports['getOpenTabs']=function(_0x574ce9,_0x5f1772){return db[_0x0580('0x3c')][_0x0580('0x33')]({'where':{'id':_0x574ce9[_0x0580('0x57')]['id']},'attributes':['id']})[_0x0580('0x11')](handleEntityNotFound(_0x5f1772,null))[_0x0580('0x11')](function(_0x2b68e5){var _0x1db5de=[];values=_0x2b68e5[_0x0580('0x47')];_0x1db5de[_0x0580('0x44')](get_open_tabs(_0x0580('0x45'),_0x2b68e5[_0x0580('0x47')]));_0x1db5de['push'](get_open_tabs(_0x0580('0x48'),_0x2b68e5['dataValues']));_0x1db5de[_0x0580('0x44')](get_open_tabs(_0x0580('0x4b'),_0x2b68e5[_0x0580('0x47')]));_0x1db5de['push'](get_open_tabs(_0x0580('0xb2'),_0x2b68e5[_0x0580('0x47')]));_0x1db5de[_0x0580('0x44')](get_open_tabs(_0x0580('0x49'),_0x2b68e5['dataValues']));_0x1db5de['push'](get_open_tabs(_0x0580('0x4a'),_0x2b68e5[_0x0580('0x47')]));return BPromise[_0x0580('0x55')](_0x1db5de);})[_0x0580('0x11')](function(_0x17782e){var _0x17216c=[];if(_0x17782e){for(var _0x1db448=0x0;_0x1db448=_0x440fa9[_0x3d27('0x56')]){throw new Error(_0x3d27('0x57'));}})[_0x3d27('0x12')](function(){if(_0x301633){return db[_0x3d27('0x2d')]['destroy']({'where':{'membername':_0x301633[_0x3d27('0x36')]},'individualHooks':!![]});}})[_0x3d27('0x12')](function(){if(_0x301633){return _0x301633[_0x3d27('0x58')]({'raw':!![]});}})[_0x3d27('0x12')](function(_0x1eb35e){if(_0x301633){if(_0x1eb35e){var _0x2327ee=[];_0x29a59f=_0x1eb35e;if(_0x29a59f[_0x3d27('0x4d')]){for(var _0x373acd=0x0;_0x373acd<_0x29a59f[_0x3d27('0x4d')];_0x373acd++){_0x2327ee['push'](db[_0x3d27('0x2d')][_0x3d27('0x59')]({'membername':_0x301633[_0x3d27('0x36')],'UserId':_0x301633['id'],'queue_name':_0x29a59f[_0x373acd][_0x3d27('0x36')],'VoiceQueueId':_0x29a59f[_0x373acd]['id'],'interface':_0x3478a9,'paused':_0x301633[_0x3d27('0x51')]||![],'penalty':_0x29a59f[_0x373acd]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x3d27('0x4a')](_0x2327ee);}}}})['then'](function(){if(_0x301633){return db[_0x3d27('0x2f')][_0x3d27('0x20')]({'where':{'membername':_0x301633[_0x3d27('0x36')],'exitAt':null}});}})[_0x3d27('0x12')](function(_0x3d03d0){if(_0x301633){if(_0x3d03d0&&_0x3d03d0[_0x3d27('0x4d')]){var _0x80204c=[];_0x3d03d0[_0x3d27('0x34')](function(_0x16ba37){_0x80204c[_0x3d27('0x35')](_0x16ba37[_0x3d27('0x2e')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x3d27('0x4a')](_0x80204c);}}})[_0x3d27('0x12')](function(_0x262a5b){if(_0x301633){var _0x2e7e82=[];var _0x3b8b7a=[];var _0x4d1b0d=utils['getChannels']();var _0x34c1ff={'membername':_0x301633['name'],'interface':_0x3478a9,'enterAt':moment()[_0x3d27('0x37')](_0x3d27('0x31')),'role':_0x301633[_0x3d27('0x2a')],'internal':_0x301633[_0x3d27('0x2b')]};_0x4d1b0d['forEach'](function(_0x56c2f2){_0x2e7e82[_0x3d27('0x35')](_[_0x3d27('0x5a')]({'channel':_0x56c2f2,'type':'LOGIN','data1':_0x3d27('0x5b'),'data2':_0x3478a9},_0x34c1ff));if(_0x301633[_0x3d27('0x51')]){_0x3b8b7a[_0x3d27('0x35')](_[_0x3d27('0x5a')]({'channel':_0x56c2f2,'type':_0x3d27('0x30'),'data1':_0x3d27('0x5c')},_0x34c1ff));}});return db[_0x3d27('0x2f')]['bulkCreate'](_0x2e7e82['concat'](_0x3b8b7a),{'individualHooks':!![]});}})[_0x3d27('0x12')](function(){if(_0x301633){return _0x301633[_0x3d27('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x3d27('0x37')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x301633[_0x3d27('0x51')]||![],'mailPause':_0x301633['loginInPause']||![],'chatPause':_0x301633[_0x3d27('0x51')]||![],'faxPause':_0x301633[_0x3d27('0x51')]||![],'smsPause':_0x301633[_0x3d27('0x51')]||![],'openchannelPause':_0x301633['loginInPause']||![],'pauseType':_0x301633[_0x3d27('0x51')]?_0x3d27('0x5c'):null,'lastPauseAt':moment()['format'](_0x3d27('0x31')),'interface':_0x3478a9});}})[_0x3d27('0x12')](function(_0x3d0285){_0x573eab(_0x3d0285);})[_0x3d27('0x1d')](function(_0x5cac29){_0x27b92c(_0x53a9ab[_0x3d27('0x18')](0x1f4,_0x5cac29[_0x3d27('0x1b')]));});});}; \ No newline at end of file +var _0xd3b2=['forEach','push','isNil','interface','format','SIP/%s','PAUSE','body','type','DEFAULT\x20PAUSE','internal','uniqueid','UnpauseUser','findOne','channel','isValidChannel','voice','UserVoiceQueueRt','system','chat','fax','sms','openchannel','whatsapp','set','%s%s','all','LogoutUser','destroy','mobile','phone','loginInPause','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','UserVoiceQueue.penalty','merge','bulkCreate','concat','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','request','then','info','request\x20sent','debug','stringify','error','User,\x20%s,\x20%s','message','result','catch','GetUser','User','findAll','options','raw','limit','include','map','model','ShowUser','find','where','attributes','PauseUser','role','update','MemberReport','name','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd3b2,0x17b));var _0x2d3b=function(_0x3d25cd,_0x3b3309){_0x3d25cd=_0x3d25cd-0x0;var _0x1328dd=_0xd3b2[_0x3d25cd];return _0x1328dd;};'use strict';var _=require(_0x2d3b('0x0'));var util=require(_0x2d3b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2d3b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d3b('0x3'))['db'];var utils=require(_0x2d3b('0x4'));var logger=require(_0x2d3b('0x5'))(_0x2d3b('0x6'));var config=require(_0x2d3b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2d3b('0x8')][_0x2d3b('0x9')]({'port':0x232a});config[_0x2d3b('0xa')]=_[_0x2d3b('0xb')](config[_0x2d3b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x2d3b('0xc'))(new Redis(config[_0x2d3b('0xa')]));require('./user.socket')['register'](socket);function respondWithRpcPromise(_0x3da248,_0x13152b,_0x481415){return new BPromise(function(_0x340c64,_0x10a4b9){return client[_0x2d3b('0xd')](_0x3da248,_0x481415)[_0x2d3b('0xe')](function(_0x5156a2){logger[_0x2d3b('0xf')]('User,\x20%s,\x20%s',_0x13152b,_0x2d3b('0x10'));logger[_0x2d3b('0x11')]('User,\x20%s,\x20%s,\x20%s',_0x13152b,_0x2d3b('0x10'),JSON[_0x2d3b('0x12')](_0x5156a2));if(_0x5156a2[_0x2d3b('0x13')]){if(_0x5156a2[_0x2d3b('0x13')]['code']===0x1f4){logger[_0x2d3b('0x13')](_0x2d3b('0x14'),_0x13152b,_0x5156a2[_0x2d3b('0x13')][_0x2d3b('0x15')]);return _0x10a4b9(_0x5156a2[_0x2d3b('0x13')][_0x2d3b('0x15')]);}logger[_0x2d3b('0x13')](_0x2d3b('0x14'),_0x13152b,_0x5156a2[_0x2d3b('0x13')][_0x2d3b('0x15')]);return _0x340c64(_0x5156a2[_0x2d3b('0x13')][_0x2d3b('0x15')]);}else{logger[_0x2d3b('0xf')]('User,\x20%s,\x20%s',_0x13152b,_0x2d3b('0x10'));_0x340c64(_0x5156a2[_0x2d3b('0x16')][_0x2d3b('0x15')]);}})[_0x2d3b('0x17')](function(_0x224f08){logger['error'](_0x2d3b('0x14'),_0x13152b,_0x224f08);_0x10a4b9(_0x224f08);});});}exports[_0x2d3b('0x18')]=function(_0x19e62c){var _0x1fbf3e=this;return new Promise(function(_0x4c4447,_0x519cd9){return db[_0x2d3b('0x19')][_0x2d3b('0x1a')]({'raw':_0x19e62c[_0x2d3b('0x1b')]?_0x19e62c['options'][_0x2d3b('0x1c')]===undefined?!![]:![]:!![],'where':_0x19e62c[_0x2d3b('0x1b')]?_0x19e62c[_0x2d3b('0x1b')]['where']||null:null,'attributes':_0x19e62c[_0x2d3b('0x1b')]?_0x19e62c[_0x2d3b('0x1b')]['attributes']||null:null,'limit':_0x19e62c['options']?_0x19e62c[_0x2d3b('0x1b')][_0x2d3b('0x1d')]||null:null,'include':_0x19e62c[_0x2d3b('0x1b')]?_0x19e62c['options'][_0x2d3b('0x1e')]?_[_0x2d3b('0x1f')](_0x19e62c['options'][_0x2d3b('0x1e')],function(_0x21e902){return{'model':db[_0x21e902[_0x2d3b('0x20')]],'as':_0x21e902['as'],'attributes':_0x21e902['attributes'],'include':_0x21e902[_0x2d3b('0x1e')]?_['map'](_0x21e902[_0x2d3b('0x1e')],function(_0xe2b76c){return{'model':db[_0xe2b76c[_0x2d3b('0x20')]],'as':_0xe2b76c['as'],'attributes':_0xe2b76c['attributes'],'include':_0xe2b76c[_0x2d3b('0x1e')]?_[_0x2d3b('0x1f')](_0xe2b76c[_0x2d3b('0x1e')],function(_0x5519a9){return{'model':db[_0x5519a9['model']],'as':_0x5519a9['as'],'attributes':_0x5519a9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c8baa){logger[_0x2d3b('0xf')]('GetUser',_0x19e62c);logger[_0x2d3b('0x11')](_0x2d3b('0x18'),_0x19e62c,JSON[_0x2d3b('0x12')](_0x5c8baa));_0x4c4447(_0x5c8baa);})[_0x2d3b('0x17')](function(_0x5bb995){logger[_0x2d3b('0x13')](_0x2d3b('0x18'),_0x5bb995[_0x2d3b('0x15')],_0x19e62c);_0x519cd9(_0x1fbf3e[_0x2d3b('0x13')](0x1f4,_0x5bb995[_0x2d3b('0x15')]));});});};exports[_0x2d3b('0x21')]=function(_0x54aa13){var _0x218e35=this;return new Promise(function(_0x335d35,_0x34bf21){return db['User'][_0x2d3b('0x22')]({'raw':_0x54aa13[_0x2d3b('0x1b')]?_0x54aa13['options'][_0x2d3b('0x1c')]===undefined?!![]:![]:!![],'where':_0x54aa13[_0x2d3b('0x1b')]?_0x54aa13[_0x2d3b('0x1b')][_0x2d3b('0x23')]||null:null,'attributes':_0x54aa13[_0x2d3b('0x1b')]?_0x54aa13[_0x2d3b('0x1b')][_0x2d3b('0x24')]||null:null,'include':_0x54aa13['options']?_0x54aa13[_0x2d3b('0x1b')]['include']?_[_0x2d3b('0x1f')](_0x54aa13[_0x2d3b('0x1b')]['include'],function(_0xbbc9c){return{'model':db[_0xbbc9c[_0x2d3b('0x20')]],'as':_0xbbc9c['as'],'attributes':_0xbbc9c[_0x2d3b('0x24')],'include':_0xbbc9c[_0x2d3b('0x1e')]?_[_0x2d3b('0x1f')](_0xbbc9c[_0x2d3b('0x1e')],function(_0x5ef4b2){return{'model':db[_0x5ef4b2['model']],'as':_0x5ef4b2['as'],'attributes':_0x5ef4b2['attributes'],'include':_0x5ef4b2[_0x2d3b('0x1e')]?_[_0x2d3b('0x1f')](_0x5ef4b2[_0x2d3b('0x1e')],function(_0x3e5e78){return{'model':db[_0x3e5e78['model']],'as':_0x3e5e78['as'],'attributes':_0x3e5e78[_0x2d3b('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449b23){logger[_0x2d3b('0xf')](_0x2d3b('0x21'),_0x54aa13);logger[_0x2d3b('0x11')](_0x2d3b('0x21'),_0x54aa13,JSON[_0x2d3b('0x12')](_0x449b23));_0x335d35(_0x449b23);})['catch'](function(_0x3d7ed2){logger['error'](_0x2d3b('0x21'),_0x3d7ed2[_0x2d3b('0x15')],_0x54aa13);_0x34bf21(_0x218e35[_0x2d3b('0x13')](0x1f4,_0x3d7ed2[_0x2d3b('0x15')]));});});};exports[_0x2d3b('0x25')]=function(_0x1465cb){var _0x29d4a1=this;return new Promise(function(_0x564922,_0x44710c){var _0x3a4e99;return db['User'][_0x2d3b('0x22')]({'where':_0x1465cb['options']['where']||{},'attributes':['id','name',_0x2d3b('0x26'),'internal','interface']})[_0x2d3b('0xe')](function(_0x277796){if(_0x277796){_0x3a4e99=_0x277796;return db['UserVoiceQueueRt'][_0x2d3b('0x27')]({'paused':0x1},{'where':{'UserId':_0x3a4e99['id']},'individualHooks':!![]});}})[_0x2d3b('0xe')](function(){if(_0x3a4e99){return db[_0x2d3b('0x28')][_0x2d3b('0x1a')]({'where':{'membername':_0x3a4e99[_0x2d3b('0x29')],'type':'PAUSE','exitAt':null}});}})[_0x2d3b('0xe')](function(_0x40cb8e){if(_0x3a4e99){if(_0x40cb8e&&_0x40cb8e[_0x2d3b('0x2a')]){var _0x29aefa=moment()['format'](_0x2d3b('0x2b'));for(var _0x44a5d2=0x0,_0x3ab38e=_0x40cb8e[_0x2d3b('0x2a')];_0x44a5d2<_0x3ab38e;_0x44a5d2++){_0x40cb8e[_0x44a5d2][_0x2d3b('0x2c')]({'exitAt':_0x29aefa});}}}})[_0x2d3b('0xe')](function(){if(_0x3a4e99){var _0x419937=[];var _0x4f1bdc=utils[_0x2d3b('0x2d')]();_0x4f1bdc[_0x2d3b('0x2e')](function(_0x4b260b){_0x419937[_0x2d3b('0x2f')]({'channel':_0x4b260b,'membername':_0x3a4e99[_0x2d3b('0x29')],'interface':_[_0x2d3b('0x30')](_0x3a4e99[_0x2d3b('0x31')])?util[_0x2d3b('0x32')](_0x2d3b('0x33'),_0x3a4e99[_0x2d3b('0x29')]):_0x3a4e99[_0x2d3b('0x31')],'type':_0x2d3b('0x34'),'enterAt':moment()[_0x2d3b('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x1465cb[_0x2d3b('0x35')][_0x2d3b('0x36')]||_0x2d3b('0x37'),'role':_0x3a4e99[_0x2d3b('0x26')],'internal':_0x3a4e99[_0x2d3b('0x38')],'uniqueid':_0x1465cb[_0x2d3b('0x35')][_0x2d3b('0x39')]||null});});return db['MemberReport']['bulkCreate'](_0x419937,{'individualHooks':!![]});}})[_0x2d3b('0xe')](function(){if(_0x3a4e99){return _0x3a4e99[_0x2d3b('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x1465cb[_0x2d3b('0x35')][_0x2d3b('0x36')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x2d3b('0x32')](_0x2d3b('0x2b'))});}})[_0x2d3b('0xe')](function(_0x1271fd){_0x564922(_0x1271fd);})[_0x2d3b('0x17')](function(_0x2654b7){_0x44710c(_0x29d4a1[_0x2d3b('0x13')](0x1f4,_0x2654b7[_0x2d3b('0x15')]));});});};exports[_0x2d3b('0x3a')]=function(_0x2deddd){var _0x9c921b=this;return new Promise(function(_0x2fd831,_0x35104c){var _0x277e91;return db[_0x2d3b('0x19')][_0x2d3b('0x3b')]({'where':_0x2deddd[_0x2d3b('0x1b')][_0x2d3b('0x23')]||{},'attributes':['id',_0x2d3b('0x29')]})[_0x2d3b('0xe')](function(_0x2f3987){if(_0x2f3987){_0x277e91=_0x2f3987;if(_0x2deddd['body'][_0x2d3b('0x3c')]&&!utils[_0x2d3b('0x3d')](_0x2deddd[_0x2d3b('0x35')][_0x2d3b('0x3c')])){throw new Error('Unknown\x20channel');}switch(_0x2deddd[_0x2d3b('0x35')]['channel']){case _0x2d3b('0x3e'):return db[_0x2d3b('0x3f')][_0x2d3b('0x27')]({'paused':0x0},{'where':{'UserId':_0x277e91['id']}})[_0x2d3b('0xe')](function(){return db[_0x2d3b('0x28')]['find']({'where':{'channel':_0x2deddd[_0x2d3b('0x35')][_0x2d3b('0x3c')],'membername':_0x277e91[_0x2d3b('0x29')],'type':_0x2d3b('0x34'),'exitAt':null}});})[_0x2d3b('0xe')](function(_0x5f5d54){if(_0x5f5d54){return _0x5f5d54['update']({'exitAt':moment()[_0x2d3b('0x32')](_0x2d3b('0x2b')),'data2':_0x2d3b('0x40')},{'individualHooks':!![]});}return null;})[_0x2d3b('0xe')](function(){return _0x277e91[_0x2d3b('0x27')]({'voicePause':![]});});case'mail':case _0x2d3b('0x41'):case _0x2d3b('0x42'):case _0x2d3b('0x43'):case _0x2d3b('0x44'):case _0x2d3b('0x45'):return db[_0x2d3b('0x28')][_0x2d3b('0x22')]({'where':{'channel':_0x2deddd[_0x2d3b('0x35')]['channel'],'membername':_0x277e91['name'],'type':_0x2d3b('0x34'),'exitAt':null}})[_0x2d3b('0xe')](function(_0x4d9f6a){return _0x4d9f6a[_0x2d3b('0x27')]({'exitAt':moment()[_0x2d3b('0x32')](_0x2d3b('0x2b')),'data2':_0x2d3b('0x40')},{'individualHooks':!![]});})[_0x2d3b('0xe')](function(){var _0x5aa3c0={};_[_0x2d3b('0x46')](_0x5aa3c0,util[_0x2d3b('0x32')](_0x2d3b('0x47'),_0x2deddd[_0x2d3b('0x35')][_0x2d3b('0x3c')],'Pause'),![]);return _0x277e91['update'](_0x5aa3c0);});default:return db[_0x2d3b('0x3f')][_0x2d3b('0x27')]({'paused':0x0},{'where':{'UserId':_0x277e91['id']}})[_0x2d3b('0xe')](function(){return db[_0x2d3b('0x28')]['findAll']({'where':{'membername':_0x277e91[_0x2d3b('0x29')],'type':_0x2d3b('0x34'),'exitAt':null}});})['then'](function(_0xd5c509){var _0x548a05=[];_0xd5c509['forEach'](function(_0x3c9867){_0x548a05[_0x2d3b('0x2f')](_0x3c9867[_0x2d3b('0x27')]({'exitAt':moment()[_0x2d3b('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'}));});return BPromise[_0x2d3b('0x48')](_0x548a05);})[_0x2d3b('0xe')](function(){return _0x277e91['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x2d3b('0xe')](function(_0x3b693e){_0x2fd831(_0x3b693e);})[_0x2d3b('0x17')](function(_0x4f911f){_0x35104c(_0x9c921b['error'](0x1f4,_0x4f911f['message']));});});};exports[_0x2d3b('0x49')]=function(_0x3a7375){var _0x1f1731=this;return new Promise(function(_0x26c190,_0x494832){var _0x3bb6ca;return db[_0x2d3b('0x19')][_0x2d3b('0x3b')]({'where':_0x3a7375[_0x2d3b('0x1b')][_0x2d3b('0x23')]||{},'attributes':['id',_0x2d3b('0x29')]})[_0x2d3b('0xe')](function(_0x2ce043){if(_0x2ce043){_0x3bb6ca=_0x2ce043;return db[_0x2d3b('0x3f')][_0x2d3b('0x4a')]({'where':{'membername':_0x3bb6ca[_0x2d3b('0x29')]},'individualHooks':!![]});}})[_0x2d3b('0xe')](function(){if(_0x3bb6ca){return db[_0x2d3b('0x28')]['findAll']({'where':{'membername':_0x3bb6ca[_0x2d3b('0x29')],'exitAt':null}});}})[_0x2d3b('0xe')](function(_0x1068e3){if(_0x3bb6ca){if(_0x1068e3&&_0x1068e3['length']){var _0x53566c=[];_0x1068e3[_0x2d3b('0x2e')](function(_0x31df52){_0x53566c[_0x2d3b('0x2f')](_0x31df52[_0x2d3b('0x27')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x2d3b('0x48')](_0x53566c);}}})['then'](function(){if(_0x3bb6ca){return _0x3bb6ca[_0x2d3b('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x2d3b('0xe')](function(_0x2e3bca){_0x26c190(_0x2e3bca);})[_0x2d3b('0x17')](function(_0x45ef77){_0x494832(_0x1f1731['error'](0x1f4,_0x45ef77['message']));});});};exports['LoginUser']=function(_0x178842){var _0xd571b3=this;return new Promise(function(_0x48dc1a,_0x25ab2c){var _0x41ee2f;var _0x380f05;var _0x54a62c;var _0x297782;return db['User']['findOne']({'where':_0x178842['options'][_0x2d3b('0x23')]||{},'attributes':['id','name','role',_0x2d3b('0x4b'),_0x2d3b('0x4c'),'internal',_0x2d3b('0x4d'),'interface']})[_0x2d3b('0xe')](function(_0x266f46){if(_0x266f46){_0x41ee2f=_0x266f46;_0x297782=_0x178842[_0x2d3b('0x35')][_0x2d3b('0x31')]?_0x178842[_0x2d3b('0x35')][_0x2d3b('0x31')]:util['format'](_0x2d3b('0x33'),_0x41ee2f['name']);return db[_0x2d3b('0x19')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x41ee2f['id']}}});}})['then'](function(_0x3697b2){if(_0x3697b2){_0x54a62c=_0x3697b2;return require(_0x2d3b('0x4e'))['getLicense']();}})[_0x2d3b('0xe')](function(_0x2b10d9){if(_0x2b10d9&&_0x2b10d9[_0x2d3b('0x4f')]&&_0x54a62c>=_0x2b10d9['agents']){throw new Error(_0x2d3b('0x50'));}})[_0x2d3b('0xe')](function(){if(_0x41ee2f){return db[_0x2d3b('0x3f')]['destroy']({'where':{'membername':_0x41ee2f[_0x2d3b('0x29')]},'individualHooks':!![]});}})[_0x2d3b('0xe')](function(){if(_0x41ee2f){return _0x41ee2f['getVoiceQueues']({'raw':!![]});}})[_0x2d3b('0xe')](function(_0x22648e){if(_0x41ee2f){if(_0x22648e){var _0x171b4e=[];_0x380f05=_0x22648e;if(_0x380f05['length']){for(var _0x469cb2=0x0;_0x469cb2<_0x380f05[_0x2d3b('0x2a')];_0x469cb2++){_0x171b4e[_0x2d3b('0x2f')](db['UserVoiceQueueRt']['upsert']({'membername':_0x41ee2f[_0x2d3b('0x29')],'UserId':_0x41ee2f['id'],'queue_name':_0x380f05[_0x469cb2][_0x2d3b('0x29')],'VoiceQueueId':_0x380f05[_0x469cb2]['id'],'interface':_0x297782,'paused':_0x41ee2f[_0x2d3b('0x4d')]||![],'penalty':_0x380f05[_0x469cb2][_0x2d3b('0x51')]||0x0}));}return BPromise['all'](_0x171b4e);}}}})[_0x2d3b('0xe')](function(){if(_0x41ee2f){return db['MemberReport'][_0x2d3b('0x1a')]({'where':{'membername':_0x41ee2f['name'],'exitAt':null}});}})['then'](function(_0x13104f){if(_0x41ee2f){if(_0x13104f&&_0x13104f[_0x2d3b('0x2a')]){var _0x154c39=[];_0x13104f['forEach'](function(_0x2cbc86){_0x154c39['push'](_0x2cbc86[_0x2d3b('0x27')]({'exitAt':moment()[_0x2d3b('0x32')](_0x2d3b('0x2b'))}));});return BPromise[_0x2d3b('0x48')](_0x154c39);}}})[_0x2d3b('0xe')](function(_0xd3d6ad){if(_0x41ee2f){var _0x311d5e=[];var _0x16ee63=[];var _0x3c05bd=utils['getChannels']();var _0x2bd5fc={'membername':_0x41ee2f[_0x2d3b('0x29')],'interface':_0x297782,'enterAt':moment()[_0x2d3b('0x32')](_0x2d3b('0x2b')),'role':_0x41ee2f[_0x2d3b('0x26')],'internal':_0x41ee2f[_0x2d3b('0x38')]};_0x3c05bd['forEach'](function(_0x25086c){_0x311d5e[_0x2d3b('0x2f')](_[_0x2d3b('0x52')]({'channel':_0x25086c,'type':'LOGIN','data1':'callysquare','data2':_0x297782},_0x2bd5fc));if(_0x41ee2f[_0x2d3b('0x4d')]){_0x16ee63[_0x2d3b('0x2f')](_['merge']({'channel':_0x25086c,'type':_0x2d3b('0x34'),'data1':'LOGININPAUSE'},_0x2bd5fc));}});return db[_0x2d3b('0x28')][_0x2d3b('0x53')](_0x311d5e[_0x2d3b('0x54')](_0x16ee63),{'individualHooks':!![]});}})['then'](function(){if(_0x41ee2f){return _0x41ee2f[_0x2d3b('0x27')]({'online':!![],'lastLoginAt':moment()[_0x2d3b('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x41ee2f['loginInPause']||![],'mailPause':_0x41ee2f[_0x2d3b('0x4d')]||![],'chatPause':_0x41ee2f[_0x2d3b('0x4d')]||![],'faxPause':_0x41ee2f[_0x2d3b('0x4d')]||![],'smsPause':_0x41ee2f[_0x2d3b('0x4d')]||![],'openchannelPause':_0x41ee2f[_0x2d3b('0x4d')]||![],'pauseType':_0x41ee2f[_0x2d3b('0x4d')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0x2d3b('0x2b')),'interface':_0x297782});}})[_0x2d3b('0xe')](function(_0x540d28){_0x48dc1a(_0x540d28);})[_0x2d3b('0x17')](function(_0x3d96b3){_0x25ab2c(_0xd571b3[_0x2d3b('0x13')](0x1f4,_0x3d96b3[_0x2d3b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 873c8be..9bcb857 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 _0x35f9=['./user.events','save','remove','update','removeListener','register','length','user:'];(function(_0x560796,_0x374571){var _0x2c6691=function(_0x173866){while(--_0x173866){_0x560796['push'](_0x560796['shift']());}};_0x2c6691(++_0x374571);}(_0x35f9,0x80));var _0x935f=function(_0x55a6c8,_0xe04694){_0x55a6c8=_0x55a6c8-0x0;var _0x27f974=_0x35f9[_0x55a6c8];return _0x27f974;};'use strict';var UserEvents=require(_0x935f('0x0'));var events=[_0x935f('0x1'),_0x935f('0x2'),_0x935f('0x3')];function createListener(_0x224314,_0x392544){return function(_0x5ca464){_0x392544['emit'](_0x224314,_0x5ca464);};}function removeListener(_0x16f617,_0x21ffa3){return function(){UserEvents[_0x935f('0x4')](_0x16f617,_0x21ffa3);};}exports[_0x935f('0x5')]=function(_0x163354){for(var _0x2ab44a=0x0,_0x218cda=events[_0x935f('0x6')];_0x2ab44a<_0x218cda;_0x2ab44a++){var _0x47eb6c=events[_0x2ab44a];var _0xe8570a=createListener(_0x935f('0x7')+_0x47eb6c,_0x163354);UserEvents['on'](_0x47eb6c,_0xe8570a);}}; \ No newline at end of file +var _0x3e93=['removeListener','register','./user.events','remove','emit'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x3e93,0x7f));var _0x33e9=function(_0x3ad1d5,_0xd334d8){_0x3ad1d5=_0x3ad1d5-0x0;var _0x1caec1=_0x3e93[_0x3ad1d5];return _0x1caec1;};'use strict';var UserEvents=require(_0x33e9('0x0'));var events=['save',_0x33e9('0x1'),'update'];function createListener(_0x5ef8e3,_0x7ba8c4){return function(_0x130f1d){_0x7ba8c4[_0x33e9('0x2')](_0x5ef8e3,_0x130f1d);};}function removeListener(_0x273b92,_0x5b9bec){return function(){UserEvents[_0x33e9('0x3')](_0x273b92,_0x5b9bec);};}exports[_0x33e9('0x4')]=function(_0x417486){for(var _0x2e6d2a=0x0,_0x532441=events['length'];_0x2e6d2a<_0x532441;_0x2e6d2a++){var _0x20abf4=events[_0x2e6d2a];var _0x554672=createListener('user:'+_0x20abf4,_0x417486);UserEvents['on'](_0x20abf4,_0x554672);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 23d694b..d96a861 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(_0x5cfbd1,_0x2a5877){var _0x206ad5=function(_0x22ecd3){while(--_0x22ecd3){_0x5cfbd1['push'](_0x5cfbd1['shift']());}};_0x206ad5(++_0x2a5877);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5c53f7,_0x5180a5){var _0x1f4f0c=function(_0x415c24){while(--_0x415c24){_0x5c53f7['push'](_0x5c53f7['shift']());}};_0x1f4f0c(++_0x5180a5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0xcb91[_0x2fee96];return _0x2e6ad1;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 6c15e10..dffe27b 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 _0x09b1=['INTEGER','sequelize'];(function(_0x2df0be,_0x4c8264){var _0x1c6e1c=function(_0xe23f83){while(--_0xe23f83){_0x2df0be['push'](_0x2df0be['shift']());}};_0x1c6e1c(++_0x4c8264);}(_0x09b1,0x167));var _0x109b=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x09b1[_0x39c734];return _0xb2a2f9;};'use strict';var Sequelize=require(_0x109b('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x109b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x973b=['exports','INTEGER','sequelize'];(function(_0x28a465,_0x558c2c){var _0x258386=function(_0x384486){while(--_0x384486){_0x28a465['push'](_0x28a465['shift']());}};_0x258386(++_0x558c2c);}(_0x973b,0x6e));var _0xb973=function(_0x5179b9,_0x56fabf){_0x5179b9=_0x5179b9-0x0;var _0x408f0a=_0x973b[_0x5179b9];return _0x408f0a;};'use strict';var Sequelize=require(_0xb973('0x0'));module[_0xb973('0x1')]={'penalty':{'type':Sequelize[_0xb973('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 be79698..006304f 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 _0x62d1=['define','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userChatQueue.attributes','exports'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x62d1,0x1ca));var _0x162d=function(_0x416df5,_0x5cd9e7){_0x416df5=_0x416df5-0x0;var _0x53235b=_0x62d1[_0x416df5];return _0x53235b;};'use strict';var _=require('lodash');var util=require(_0x162d('0x0'));var logger=require(_0x162d('0x1'))(_0x162d('0x2'));var moment=require(_0x162d('0x3'));var BPromise=require(_0x162d('0x4'));var rp=require(_0x162d('0x5'));var fs=require('fs');var path=require(_0x162d('0x6'));var rimraf=require(_0x162d('0x7'));var config=require('../../config/environment');var attributes=require(_0x162d('0x8'));module[_0x162d('0x9')]=function(_0x2998de,_0xe6a8c9){return _0x2998de[_0x162d('0xa')](_0x162d('0xb'),attributes,{'tableName':_0x162d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61d3=['request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x5bde45,_0x109c43){var _0x43b3ea=function(_0x32d457){while(--_0x32d457){_0x5bde45['push'](_0x5bde45['shift']());}};_0x43b3ea(++_0x109c43);}(_0x61d3,0x1e9));var _0x361d=function(_0x5a30fb,_0x206270){_0x5a30fb=_0x5a30fb-0x0;var _0x3b86aa=_0x61d3[_0x5a30fb];return _0x3b86aa;};'use strict';var _=require(_0x361d('0x0'));var util=require(_0x361d('0x1'));var logger=require(_0x361d('0x2'))(_0x361d('0x3'));var moment=require('moment');var BPromise=require(_0x361d('0x4'));var rp=require(_0x361d('0x5'));var fs=require('fs');var path=require(_0x361d('0x6'));var rimraf=require(_0x361d('0x7'));var config=require(_0x361d('0x8'));var attributes=require(_0x361d('0x9'));module[_0x361d('0xa')]=function(_0x50491a,_0x19de90){return _0x50491a[_0x361d('0xb')]('UserChatQueue',attributes,{'tableName':_0x361d('0xc'),'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 71506a1..8e4d810 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 _0x951f=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0xa6bad1,_0x17312a){var _0x2fbbe2=function(_0x4c42f6){while(--_0x4c42f6){_0xa6bad1['push'](_0xa6bad1['shift']());}};_0x2fbbe2(++_0x17312a);}(_0x951f,0x189));var _0xf951=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x951f[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xf951('0x0'));var util=require(_0xf951('0x1'));var moment=require(_0xf951('0x2'));var BPromise=require(_0xf951('0x3'));var rs=require(_0xf951('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf951('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf951('0x6'));var config=require(_0xf951('0x7'));var jayson=require(_0xf951('0x8'));var client=jayson[_0xf951('0x9')][_0xf951('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5795a6,_0x1f4631,_0x586b0f){return new BPromise(function(_0x416cd6,_0x1781c3){return client[_0xf951('0xb')](_0x5795a6,_0x586b0f)[_0xf951('0xc')](function(_0x595fb1){logger[_0xf951('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x1f4631,_0xf951('0xe'));logger[_0xf951('0xf')](_0xf951('0x10'),_0x1f4631,'request\x20sent',JSON[_0xf951('0x11')](_0x595fb1));if(_0x595fb1[_0xf951('0x12')]){if(_0x595fb1[_0xf951('0x12')][_0xf951('0x13')]===0x1f4){logger[_0xf951('0x12')](_0xf951('0x14'),_0x1f4631,_0x595fb1['error'][_0xf951('0x15')]);return _0x1781c3(_0x595fb1['error'][_0xf951('0x15')]);}logger[_0xf951('0x12')](_0xf951('0x14'),_0x1f4631,_0x595fb1['error'][_0xf951('0x15')]);return _0x416cd6(_0x595fb1[_0xf951('0x12')][_0xf951('0x15')]);}else{logger[_0xf951('0xd')](_0xf951('0x14'),_0x1f4631,'request\x20sent');_0x416cd6(_0x595fb1[_0xf951('0x16')][_0xf951('0x15')]);}})[_0xf951('0x17')](function(_0x1e2235){logger['error'](_0xf951('0x14'),_0x1f4631,_0x1e2235);_0x1781c3(_0x1e2235);});});} \ No newline at end of file +var _0xd77d=['../../config/logger','rpc','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x479746,_0x574758){var _0x36d2aa=function(_0x27e29d){while(--_0x27e29d){_0x479746['push'](_0x479746['shift']());}};_0x36d2aa(++_0x574758);}(_0xd77d,0x152));var _0xdd77=function(_0x569b01,_0x1f5007){_0x569b01=_0x569b01-0x0;var _0x301cfa=_0xd77d[_0x569b01];return _0x301cfa;};'use strict';var _=require(_0xdd77('0x0'));var util=require('util');var moment=require(_0xdd77('0x1'));var BPromise=require(_0xdd77('0x2'));var rs=require(_0xdd77('0x3'));var fs=require('fs');var Redis=require(_0xdd77('0x4'));var db=require(_0xdd77('0x5'))['db'];var utils=require(_0xdd77('0x6'));var logger=require(_0xdd77('0x7'))(_0xdd77('0x8'));var config=require('../../config/environment');var jayson=require(_0xdd77('0x9'));var client=jayson[_0xdd77('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33c3f9,_0x50a774,_0x1ecfb0){return new BPromise(function(_0x4bcfc1,_0x2fc642){return client[_0xdd77('0xb')](_0x33c3f9,_0x1ecfb0)[_0xdd77('0xc')](function(_0x59d5c1){logger[_0xdd77('0xd')](_0xdd77('0xe'),_0x50a774,_0xdd77('0xf'));logger[_0xdd77('0x10')](_0xdd77('0x11'),_0x50a774,_0xdd77('0xf'),JSON[_0xdd77('0x12')](_0x59d5c1));if(_0x59d5c1[_0xdd77('0x13')]){if(_0x59d5c1[_0xdd77('0x13')][_0xdd77('0x14')]===0x1f4){logger[_0xdd77('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x50a774,_0x59d5c1[_0xdd77('0x13')][_0xdd77('0x15')]);return _0x2fc642(_0x59d5c1[_0xdd77('0x13')][_0xdd77('0x15')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x50a774,_0x59d5c1[_0xdd77('0x13')]['message']);return _0x4bcfc1(_0x59d5c1[_0xdd77('0x13')][_0xdd77('0x15')]);}else{logger[_0xdd77('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x50a774,_0xdd77('0xf'));_0x4bcfc1(_0x59d5c1[_0xdd77('0x16')]['message']);}})['catch'](function(_0x3fad78){logger[_0xdd77('0x13')](_0xdd77('0xe'),_0x50a774,_0x3fad78);_0x2fc642(_0x3fad78);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 54fbcd1..82e8487 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1d8965,_0x2aec0d){var _0x38edbf=function(_0x55850c){while(--_0x55850c){_0x1d8965['push'](_0x1d8965['shift']());}};_0x38edbf(++_0x2aec0d);}(_0xedd9,0xfc));var _0x9edd=function(_0x47d1ae,_0x41e056){_0x47d1ae=_0x47d1ae-0x0;var _0x47328a=_0xedd9[_0x47d1ae];return _0x47328a;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3fce7e,_0x7d2966){var _0x382229=function(_0x4da391){while(--_0x4da391){_0x3fce7e['push'](_0x3fce7e['shift']());}};_0x382229(++_0x7d2966);}(_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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index dce1823..9cfc453 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 _0x54c9=['STRING','sequelize','exports','INTEGER'];(function(_0x4ad32f,_0x3bc396){var _0x2440ec=function(_0x460bad){while(--_0x460bad){_0x4ad32f['push'](_0x4ad32f['shift']());}};_0x2440ec(++_0x3bc396);}(_0x54c9,0x8d));var _0x954c=function(_0x17faf1,_0x40f1b3){_0x17faf1=_0x17faf1-0x0;var _0x2e40ef=_0x54c9[_0x17faf1];return _0x2e40ef;};'use strict';var Sequelize=require(_0x954c('0x0'));module[_0x954c('0x1')]={'penalty':{'type':Sequelize[_0x954c('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x954c('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x954c('0x3')]}}; \ No newline at end of file +var _0x5eec=['STRING','sequelize','INTEGER'];(function(_0x183b97,_0x2d297c){var _0x629cf7=function(_0x4ffd24){while(--_0x4ffd24){_0x183b97['push'](_0x183b97['shift']());}};_0x629cf7(++_0x2d297c);}(_0x5eec,0x13c));var _0xc5ee=function(_0x7795fa,_0x46ba20){_0x7795fa=_0x7795fa-0x0;var _0x297178=_0x5eec[_0x7795fa];return _0x297178;};'use strict';var Sequelize=require(_0xc5ee('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc5ee('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc5ee('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc5ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 1bc3921..782a5a3 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 _0x897f=['./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x1a92c4,_0x45328a){var _0x368692=function(_0x4d53ef){while(--_0x4d53ef){_0x1a92c4['push'](_0x1a92c4['shift']());}};_0x368692(++_0x45328a);}(_0x897f,0xf7));var _0xf897=function(_0x1e79b9,_0x223ef3){_0x1e79b9=_0x1e79b9-0x0;var _0x2c2d29=_0x897f[_0x1e79b9];return _0x2c2d29;};'use strict';var _=require('lodash');var util=require(_0xf897('0x0'));var logger=require(_0xf897('0x1'))('api');var moment=require(_0xf897('0x2'));var BPromise=require(_0xf897('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf897('0x4'));var rimraf=require('rimraf');var config=require(_0xf897('0x5'));var attributes=require(_0xf897('0x6'));module[_0xf897('0x7')]=function(_0x16d2ed,_0x1fb04e){return _0x16d2ed[_0xf897('0x8')](_0xf897('0x9'),attributes,{'tableName':_0xf897('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ccb=['rimraf','../../config/environment','./userFaxQueue.attributes','UserFaxQueue','lodash','api','moment','bluebird','request-promise','path'];(function(_0x1b74b9,_0x405552){var _0xb60da9=function(_0x1d6e3e){while(--_0x1d6e3e){_0x1b74b9['push'](_0x1b74b9['shift']());}};_0xb60da9(++_0x405552);}(_0x7ccb,0x68));var _0xb7cc=function(_0x521731,_0x26752c){_0x521731=_0x521731-0x0;var _0x11477a=_0x7ccb[_0x521731];return _0x11477a;};'use strict';var _=require(_0xb7cc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb7cc('0x1'));var moment=require(_0xb7cc('0x2'));var BPromise=require(_0xb7cc('0x3'));var rp=require(_0xb7cc('0x4'));var fs=require('fs');var path=require(_0xb7cc('0x5'));var rimraf=require(_0xb7cc('0x6'));var config=require(_0xb7cc('0x7'));var attributes=require(_0xb7cc('0x8'));module['exports']=function(_0x571b5b,_0x52249e){return _0x571b5b['define'](_0xb7cc('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 4dad1f0..2a88dc5 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 _0x7182=['result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4a29a9,_0x58cd04){var _0x386570=function(_0x1d2d09){while(--_0x1d2d09){_0x4a29a9['push'](_0x4a29a9['shift']());}};_0x386570(++_0x58cd04);}(_0x7182,0x12c));var _0x2718=function(_0x4714a0,_0x5ba5a7){_0x4714a0=_0x4714a0-0x0;var _0x48a983=_0x7182[_0x4714a0];return _0x48a983;};'use strict';var _=require('lodash');var util=require(_0x2718('0x0'));var moment=require(_0x2718('0x1'));var BPromise=require(_0x2718('0x2'));var rs=require(_0x2718('0x3'));var fs=require('fs');var Redis=require(_0x2718('0x4'));var db=require(_0x2718('0x5'))['db'];var utils=require(_0x2718('0x6'));var logger=require(_0x2718('0x7'))(_0x2718('0x8'));var config=require(_0x2718('0x9'));var jayson=require(_0x2718('0xa'));var client=jayson[_0x2718('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55d357,_0x43ce15,_0x282ae0){return new BPromise(function(_0x41716b,_0x46d47c){return client['request'](_0x55d357,_0x282ae0)[_0x2718('0xc')](function(_0x20f244){logger[_0x2718('0xd')](_0x2718('0xe'),_0x43ce15,_0x2718('0xf'));logger[_0x2718('0x10')](_0x2718('0x11'),_0x43ce15,_0x2718('0xf'),JSON[_0x2718('0x12')](_0x20f244));if(_0x20f244[_0x2718('0x13')]){if(_0x20f244[_0x2718('0x13')][_0x2718('0x14')]===0x1f4){logger[_0x2718('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x43ce15,_0x20f244['error'][_0x2718('0x15')]);return _0x46d47c(_0x20f244[_0x2718('0x13')][_0x2718('0x15')]);}logger['error'](_0x2718('0xe'),_0x43ce15,_0x20f244['error']['message']);return _0x41716b(_0x20f244[_0x2718('0x13')][_0x2718('0x15')]);}else{logger['info'](_0x2718('0xe'),_0x43ce15,_0x2718('0xf'));_0x41716b(_0x20f244[_0x2718('0x16')][_0x2718('0x15')]);}})['catch'](function(_0x41904b){logger[_0x2718('0x13')](_0x2718('0xe'),_0x43ce15,_0x41904b);_0x46d47c(_0x41904b);});});} \ No newline at end of file +var _0x4662=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x4662,0xcd));var _0x2466=function(_0xee95b8,_0x352b38){_0xee95b8=_0xee95b8-0x0;var _0x1a2c11=_0x4662[_0xee95b8];return _0x1a2c11;};'use strict';var _=require(_0x2466('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2466('0x1'));var rs=require(_0x2466('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2466('0x3'))['db'];var utils=require(_0x2466('0x4'));var logger=require(_0x2466('0x5'))(_0x2466('0x6'));var config=require(_0x2466('0x7'));var jayson=require(_0x2466('0x8'));var client=jayson[_0x2466('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56fe58,_0x28a706,_0x487c15){return new BPromise(function(_0x2ce19a,_0x41492e){return client[_0x2466('0xa')](_0x56fe58,_0x487c15)[_0x2466('0xb')](function(_0x81694){logger[_0x2466('0xc')](_0x2466('0xd'),_0x28a706,_0x2466('0xe'));logger[_0x2466('0xf')](_0x2466('0x10'),_0x28a706,_0x2466('0xe'),JSON['stringify'](_0x81694));if(_0x81694['error']){if(_0x81694[_0x2466('0x11')][_0x2466('0x12')]===0x1f4){logger['error'](_0x2466('0xd'),_0x28a706,_0x81694[_0x2466('0x11')]['message']);return _0x41492e(_0x81694[_0x2466('0x11')][_0x2466('0x13')]);}logger[_0x2466('0x11')](_0x2466('0xd'),_0x28a706,_0x81694[_0x2466('0x11')][_0x2466('0x13')]);return _0x2ce19a(_0x81694[_0x2466('0x11')]['message']);}else{logger[_0x2466('0xc')](_0x2466('0xd'),_0x28a706,_0x2466('0xe'));_0x2ce19a(_0x81694[_0x2466('0x14')]['message']);}})['catch'](function(_0x4521b3){logger[_0x2466('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x28a706,_0x4521b3);_0x41492e(_0x4521b3);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 51d3efa..86341e4 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x11b04b,_0x411c23){var _0x2bca59=function(_0x3eeed0){while(--_0x3eeed0){_0x11b04b['push'](_0x11b04b['shift']());}};_0x2bca59(++_0x411c23);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x23e9d4,_0x1063fd){var _0x4ab2b0=function(_0x3ff3e3){while(--_0x3ff3e3){_0x23e9d4['push'](_0x23e9d4['shift']());}};_0x4ab2b0(++_0x1063fd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 6eae10d..3fd7d2b 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 _0xb719=['exports','INTEGER','sequelize'];(function(_0x16971d,_0x180a2c){var _0x38150a=function(_0x1548b2){while(--_0x1548b2){_0x16971d['push'](_0x16971d['shift']());}};_0x38150a(++_0x180a2c);}(_0xb719,0x1f4));var _0x9b71=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0xb719[_0x291d3f];return _0x242080;};'use strict';var Sequelize=require(_0x9b71('0x0'));module[_0x9b71('0x1')]={'penalty':{'type':Sequelize[_0x9b71('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbfa4=['sequelize'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xbfa4,0x106));var _0x4bfa=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xbfa4[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require(_0x4bfa('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 1e7b743..3edd2e8 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 _0x74eb=['moment','request-promise','path','rimraf','../../config/environment','exports','define','UserMailQueue','user_has_mail_queues','util','../../config/logger'];(function(_0x2e6dbf,_0x57dd06){var _0x2680e5=function(_0x4018f4){while(--_0x4018f4){_0x2e6dbf['push'](_0x2e6dbf['shift']());}};_0x2680e5(++_0x57dd06);}(_0x74eb,0x174));var _0xb74e=function(_0x3979b4,_0x1d98a9){_0x3979b4=_0x3979b4-0x0;var _0x4fdf9f=_0x74eb[_0x3979b4];return _0x4fdf9f;};'use strict';var _=require('lodash');var util=require(_0xb74e('0x0'));var logger=require(_0xb74e('0x1'))('api');var moment=require(_0xb74e('0x2'));var BPromise=require('bluebird');var rp=require(_0xb74e('0x3'));var fs=require('fs');var path=require(_0xb74e('0x4'));var rimraf=require(_0xb74e('0x5'));var config=require(_0xb74e('0x6'));var attributes=require('./userMailQueue.attributes');module[_0xb74e('0x7')]=function(_0x12fd6f,_0x320cf6){return _0x12fd6f[_0xb74e('0x8')](_0xb74e('0x9'),attributes,{'tableName':_0xb74e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde68=['user_has_mail_queues','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue'];(function(_0x352904,_0x44b913){var _0x17d412=function(_0x335cf7){while(--_0x335cf7){_0x352904['push'](_0x352904['shift']());}};_0x17d412(++_0x44b913);}(_0xde68,0xfd));var _0x8de6=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xde68[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0x8de6('0x0'));var util=require(_0x8de6('0x1'));var logger=require(_0x8de6('0x2'))(_0x8de6('0x3'));var moment=require(_0x8de6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8de6('0x5'));var rimraf=require(_0x8de6('0x6'));var config=require(_0x8de6('0x7'));var attributes=require(_0x8de6('0x8'));module[_0x8de6('0x9')]=function(_0x4cce35,_0x3ea85c){return _0x4cce35['define'](_0x8de6('0xa'),attributes,{'tableName':_0x8de6('0xb'),'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 a1aa9f9..9ef650b 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1cb9,0x14e));var _0x91cb=function(_0x40e935,_0x5e1a0d){_0x40e935=_0x40e935-0x0;var _0x1e4ed2=_0x1cb9[_0x40e935];return _0x1e4ed2;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3406e7,_0x56be18){var _0x47c325=function(_0x483bbe){while(--_0x483bbe){_0x3406e7['push'](_0x3406e7['shift']());}};_0x47c325(++_0x56be18);}(_0x34e8,0x12c));var _0x834e=function(_0x54fcb2,_0x3d9973){_0x54fcb2=_0x54fcb2-0x0;var _0x29cc11=_0x34e8[_0x54fcb2];return _0x29cc11;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index f87fc02..00a5911 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 _0xa026=['../../components/auth/service','post','sendUserNotification','exports','multer','util','path','express','Router','fs-extra'];(function(_0x2b7b9d,_0x89a529){var _0x57e721=function(_0x3ee189){while(--_0x3ee189){_0x2b7b9d['push'](_0x2b7b9d['shift']());}};_0x57e721(++_0x89a529);}(_0xa026,0xb8));var _0x6a02=function(_0x25ffd4,_0x16b31d){_0x25ffd4=_0x25ffd4-0x0;var _0x414452=_0xa026[_0x25ffd4];return _0x414452;};'use strict';var multer=require(_0x6a02('0x0'));var util=require(_0x6a02('0x1'));var path=require(_0x6a02('0x2'));var timeout=require('connect-timeout');var express=require(_0x6a02('0x3'));var router=express[_0x6a02('0x4')]();var fs_extra=require(_0x6a02('0x5'));var auth=require(_0x6a02('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userNotification.controller');router[_0x6a02('0x7')]('/',auth['isAuthenticated'](),controller[_0x6a02('0x8')]);module[_0x6a02('0x9')]=router; \ No newline at end of file +var _0x90e6=['fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x363162,_0x3c8dd3){var _0x485ffd=function(_0x1a2f7a){while(--_0x1a2f7a){_0x363162['push'](_0x363162['shift']());}};_0x485ffd(++_0x3c8dd3);}(_0x90e6,0x159));var _0x690e=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x90e6[_0x470bfb];return _0x2f5d97;};'use strict';var multer=require(_0x690e('0x0'));var util=require(_0x690e('0x1'));var path=require(_0x690e('0x2'));var timeout=require(_0x690e('0x3'));var express=require(_0x690e('0x4'));var router=express[_0x690e('0x5')]();var fs_extra=require(_0x690e('0x6'));var auth=require(_0x690e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x690e('0x8'));var controller=require(_0x690e('0x9'));router[_0x690e('0xa')]('/',auth[_0x690e('0xb')](),controller['sendUserNotification']);module[_0x690e('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 56a2ab1..edaec54 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 _0x89b4=['BOOLEAN','exports','TEXT','STRING'];(function(_0x2793b1,_0x46ad54){var _0xfe5d1=function(_0x111ec3){while(--_0x111ec3){_0x2793b1['push'](_0x2793b1['shift']());}};_0xfe5d1(++_0x46ad54);}(_0x89b4,0x181));var _0x489b=function(_0x47d62e,_0x5a6418){_0x47d62e=_0x47d62e-0x0;var _0x2160a9=_0x89b4[_0x47d62e];return _0x2160a9;};'use strict';var Sequelize=require('sequelize');module[_0x489b('0x0')]={'body':{'type':Sequelize[_0x489b('0x1')]},'senderName':{'type':Sequelize[_0x489b('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x489b('0x2')]},'beep':{'type':Sequelize[_0x489b('0x3')]}}; \ No newline at end of file +var _0x6f56=['sequelize','exports','TEXT','BOOLEAN'];(function(_0x341a4b,_0x5109fb){var _0x5358d2=function(_0x4b8afa){while(--_0x4b8afa){_0x341a4b['push'](_0x341a4b['shift']());}};_0x5358d2(++_0x5109fb);}(_0x6f56,0x1ac));var _0x66f5=function(_0x52a14e,_0x57b9bb){_0x52a14e=_0x52a14e-0x0;var _0x232034=_0x6f56[_0x52a14e];return _0x232034;};'use strict';var Sequelize=require(_0x66f5('0x0'));module[_0x66f5('0x1')]={'body':{'type':Sequelize[_0x66f5('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x66f5('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x66f5('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 4dd3a81..406feda 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 _0x2120=['apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','transaction','create','forEach','emit','userNotification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','union','ids','queue','replace','Queue','push','all','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','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','defaults','localhost','./userNotification.socket','register','end','status','offset','limit','undefined','count','set','Content-Range','json'];(function(_0x56d896,_0x3b4c9c){var _0x293639=function(_0x126c14){while(--_0x126c14){_0x56d896['push'](_0x56d896['shift']());}};_0x293639(++_0x3b4c9c);}(_0x2120,0xa6));var _0x0212=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x2120[_0x4b174a];return _0x3cd7bf;};'use strict';var emlformat=require(_0x0212('0x0'));var rimraf=require(_0x0212('0x1'));var zipdir=require(_0x0212('0x2'));var jsonpatch=require(_0x0212('0x3'));var rp=require(_0x0212('0x4'));var moment=require(_0x0212('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0212('0x6'));var util=require(_0x0212('0x7'));var path=require(_0x0212('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0212('0x9'));var fs=require('fs');var fs_extra=require(_0x0212('0xa'));var _=require(_0x0212('0xb'));var squel=require('squel');var crypto=require(_0x0212('0xc'));var jsforce=require(_0x0212('0xd'));var deskjs=require(_0x0212('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0212('0xf'));var Redis=require(_0x0212('0x10'));var authService=require(_0x0212('0x11'));var qs=require(_0x0212('0x12'));var as=require(_0x0212('0x13'));var hardwareService=require(_0x0212('0x14'));var logger=require(_0x0212('0x15'))(_0x0212('0x16'));var utils=require('../../config/utils');var config=require(_0x0212('0x17'));var licenseUtil=require(_0x0212('0x18'));var db=require(_0x0212('0x19'))['db'];config[_0x0212('0x1a')]=_[_0x0212('0x1b')](config[_0x0212('0x1a')],{'host':_0x0212('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0212('0x1d'))[_0x0212('0x1e')](socket);function respondWithStatusCode(_0x242d9d,_0x7dc767){_0x7dc767=_0x7dc767||0xcc;return function(_0x51b5e6){if(_0x51b5e6){return _0x242d9d['sendStatus'](_0x7dc767);}return _0x242d9d['status'](_0x7dc767)[_0x0212('0x1f')]();};}function respondWithResult(_0x48003c,_0x1aac78){_0x1aac78=_0x1aac78||0xc8;return function(_0x280271){if(_0x280271){return _0x48003c[_0x0212('0x20')](_0x1aac78)['json'](_0x280271);}};}function respondWithFilteredResult(_0x19223c,_0x4a6c58){return function(_0x336028){if(_0x336028){var _0xa844b7=typeof _0x4a6c58[_0x0212('0x21')]==='undefined'&&typeof _0x4a6c58[_0x0212('0x22')]===_0x0212('0x23');var _0x45c8a6=_0x336028[_0x0212('0x24')];var _0x2c83ad=_0xa844b7?0x0:_0x4a6c58[_0x0212('0x21')];var _0x42ca8c=_0xa844b7?_0x336028['count']:_0x4a6c58[_0x0212('0x21')]+_0x4a6c58[_0x0212('0x22')];var _0x7cbeac;if(_0x42ca8c>=_0x45c8a6){_0x42ca8c=_0x45c8a6;_0x7cbeac=0xc8;}else{_0x7cbeac=0xce;}_0x19223c[_0x0212('0x20')](_0x7cbeac);return _0x19223c[_0x0212('0x25')](_0x0212('0x26'),_0x2c83ad+'-'+_0x42ca8c+'/'+_0x45c8a6)[_0x0212('0x27')](_0x336028);}return null;};}function patchUpdates(_0x1faaa0){return function(_0x316862){try{jsonpatch[_0x0212('0x28')](_0x316862,_0x1faaa0,!![]);}catch(_0x23af2a){return BPromise[_0x0212('0x29')](_0x23af2a);}return _0x316862[_0x0212('0x2a')]();};}function saveUpdates(_0x53c909,_0x12c378){return function(_0xa56ed0){if(_0xa56ed0){return _0xa56ed0[_0x0212('0x2b')](_0x53c909)[_0x0212('0x2c')](function(_0x5db4dd){return _0x5db4dd;});}return null;};}function removeEntity(_0x5a924b,_0x2323ce){return function(_0x38d601){if(_0x38d601){return _0x38d601[_0x0212('0x2d')]()[_0x0212('0x2c')](function(){_0x5a924b[_0x0212('0x20')](0xcc)[_0x0212('0x1f')]();});}};}function handleEntityNotFound(_0x25d72d,_0x49aa34){return function(_0x1c01ab){if(!_0x1c01ab){_0x25d72d['sendStatus'](0x194);}return _0x1c01ab;};}function handleError(_0x5cb89d,_0x38fd5f){_0x38fd5f=_0x38fd5f||0x1f4;return function(_0x4a2f54){logger[_0x0212('0x2e')](_0x4a2f54[_0x0212('0x2f')]);if(_0x4a2f54[_0x0212('0x30')]){delete _0x4a2f54[_0x0212('0x30')];}_0x5cb89d[_0x0212('0x20')](_0x38fd5f)[_0x0212('0x31')](_0x4a2f54);};}exports[_0x0212('0x32')]=function(_0x35b4de,_0x2cbe1d,_0x4652b3){if(!_0x35b4de[_0x0212('0x33')]['hasOwnProperty']('text')&&!_0x35b4de[_0x0212('0x33')]['hasOwnProperty'](_0x0212('0x34'))){throw new db[(_0x0212('0x35'))][(_0x0212('0x36'))](_0x0212('0x37'));}else{if(_0x35b4de['body'][_0x0212('0x38')](_0x0212('0x34'))&&!_0x35b4de[_0x0212('0x33')][_0x0212('0x38')](_0x0212('0x39'))){throw new db['Sequelize']['ValidationError'](_0x0212('0x3a'));}if(!_0x35b4de['body']['hasOwnProperty']('recipients')){throw new db[(_0x0212('0x35'))]['ValidationError'](_0x0212('0x3b'));}else{try{var _0x2d6d59=JSON['parse'](_0x35b4de[_0x0212('0x33')][_0x0212('0x3c')]);}catch(_0x1c7136){logger[_0x0212('0x2e')](_0x1c7136);throw new db[(_0x0212('0x35'))][(_0x0212('0x36'))](_0x0212('0x3d'));}var _0x5006d8=[_0x0212('0x3e'),_0x0212('0x3f'),_0x0212('0x40'),_0x0212('0x41'),'smsqueue',_0x0212('0x42'),_0x0212('0x43'),_0x0212('0x44'),'user'];if(_[_0x0212('0x45')](_0x2d6d59,function(_0x39abad){return!_[_0x0212('0x46')](_0x5006d8,_0x39abad[_0x0212('0x47')][_0x0212('0x48')]());})){throw new db[(_0x0212('0x35'))]['ValidationError'](_0x0212('0x49'));}}}var _0x168db6={};_0x168db6['senderName']=_0x35b4de[_0x0212('0x33')][_0x0212('0x38')](_0x0212('0x4a'))?_0x35b4de['body'][_0x0212('0x4a')]:_0x35b4de[_0x0212('0x4b')][_0x0212('0x4c')];_0x168db6[_0x0212('0x4d')]=_[_0x0212('0x4e')](_0x35b4de[_0x0212('0x33')][_0x0212('0x4d')])?null:_0x35b4de[_0x0212('0x33')][_0x0212('0x4d')];_0x168db6[_0x0212('0x4f')]=_0x35b4de[_0x0212('0x33')][_0x0212('0x4f')]||![];_0x168db6[_0x0212('0x50')]=_0x35b4de[_0x0212('0x4b')]['id'];return getContent(_0x35b4de[_0x0212('0x33')])['then'](function(_0x3f8641){_0x168db6['body']=_0x3f8641;return getRecipients(_0x2d6d59);})['then'](function(_0x2e0310){_0x168db6[_0x0212('0x51')]=_['sortBy'](_0x2e0310)[_0x0212('0x52')](',');return db[_0x0212('0x53')][_0x0212('0x54')](function(_0x1082fa){return db['UserNotification'][_0x0212('0x55')](_0x168db6,{'raw':!![],'transaction':_0x1082fa})[_0x0212('0x2c')](function(_0x33a0c9){var _0x51fb00={'sender':_0x168db6[_0x0212('0x4a')],'description':_0x168db6[_0x0212('0x4d')],'content':_0x168db6[_0x0212('0x33')],'beep':_0x168db6[_0x0212('0x4f')]};_0x2e0310[_0x0212('0x56')](function(_0x478994){_0x51fb00['recipient']=_0x478994;socket[_0x0212('0x57')](_0x0212('0x58'),_0x51fb00);});return _0x33a0c9;});});})[_0x0212('0x2c')](respondWithResult(_0x2cbe1d,0xc9))[_0x0212('0x59')](handleError(_0x2cbe1d,null));};function getContent(_0x23ebac){return new BPromise(function(_0x3f576a,_0x382d34){if(_0x23ebac['text']){_0x3f576a(_0x23ebac['text']);return;}return db['Template'][_0x0212('0x5a')]({'attributes':[_0x0212('0x5b')],'where':{'id':_0x23ebac[_0x0212('0x34')]},'raw':!![]})[_0x0212('0x2c')](function(_0x593a05){if(!_0x593a05)throw new db[(_0x0212('0x35'))][(_0x0212('0x36'))](_0x0212('0x5c'));var _0x8129bc=Mustache['render'](_0x593a05['html'],_0x23ebac[_0x0212('0x39')]);_0x3f576a(_0x8129bc);})['catch'](function(_0x1dfb1d){_0x382d34(_0x1dfb1d);});});}function getRecipients(_0x3f0d53){return new BPromise(function(_0x14afd6,_0x1dd78c){var _0x5d8df0=[];var _0x5e624f=[];_0x3f0d53[_0x0212('0x56')](function(_0x3049c7){var _0x40db72=_[_0x0212('0x5d')](_0x3049c7[_0x0212('0x47')][_0x0212('0x48')]());if(_0x40db72==='User'){_0x5d8df0=_[_0x0212('0x5e')](_0x5d8df0,_0x3049c7[_0x0212('0x5f')]);}else{if(_[_0x0212('0x46')](_0x40db72,_0x0212('0x60')))_0x40db72=_0x40db72[_0x0212('0x61')](_0x0212('0x60'),_0x0212('0x62'));_0x3049c7[_0x0212('0x5f')][_0x0212('0x56')](function(_0x310c2c){_0x5e624f[_0x0212('0x63')](getAgents(_0x40db72,_0x310c2c));});}});return BPromise[_0x0212('0x64')](_0x5e624f)['then'](function(_0x2f65ba){_0x5d8df0=_[_0x0212('0x5e')](_0x5d8df0,_['flatten'](_0x2f65ba));_0x14afd6(_0x5d8df0);})[_0x0212('0x59')](function(_0x1577e2){_0x1dd78c(_0x1577e2);});});}function getAgents(_0x56b457,_0x47402b){return new BPromise(function(_0x45e90e,_0x22e74f){return db[_0x56b457][_0x0212('0x5a')]({'where':{'id':_0x47402b}})['then'](function(_0x227428){return _0x227428[_0x0212('0x65')]({'attributes':['id'],'raw':!![]})[_0x0212('0x2c')](function(_0x1ab828){var _0x56711a=_[_0x0212('0x66')](_0x1ab828,'id');_0x45e90e(_0x56711a);});})[_0x0212('0x59')](function(_0x125e7c){_0x22e74f(_0x125e7c);});});} \ No newline at end of file +var _0x075d=['ids','queue','forEach','all','flatten','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','ValidationError','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','fullname','recipientsDescription','beep','SenderId','recipientsId','transaction','UserNotification','create','senderName','recipient','emit','userNotification:send','text','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','User','union'];(function(_0x2f1fb6,_0x2e3503){var _0x5422e0=function(_0x120591){while(--_0x120591){_0x2f1fb6['push'](_0x2f1fb6['shift']());}};_0x5422e0(++_0x2e3503);}(_0x075d,0xc8));var _0xd075=function(_0x3c301c,_0x347ec5){_0x3c301c=_0x3c301c-0x0;var _0x3caae4=_0x075d[_0x3c301c];return _0x3caae4;};'use strict';var emlformat=require(_0xd075('0x0'));var rimraf=require(_0xd075('0x1'));var zipdir=require(_0xd075('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd075('0x3'));var BPromise=require(_0xd075('0x4'));var Mustache=require('mustache');var util=require(_0xd075('0x5'));var path=require(_0xd075('0x6'));var sox=require(_0xd075('0x7'));var csv=require(_0xd075('0x8'));var ejs=require(_0xd075('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd075('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd075('0xb'));var deskjs=require(_0xd075('0xc'));var toCsv=require(_0xd075('0x8'));var querystring=require(_0xd075('0xd'));var Papa=require(_0xd075('0xe'));var Redis=require(_0xd075('0xf'));var authService=require(_0xd075('0x10'));var qs=require(_0xd075('0x11'));var as=require(_0xd075('0x12'));var hardwareService=require(_0xd075('0x13'));var logger=require('../../config/logger')(_0xd075('0x14'));var utils=require('../../config/utils');var config=require(_0xd075('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd075('0x16'))['db'];config[_0xd075('0x17')]=_[_0xd075('0x18')](config[_0xd075('0x17')],{'host':_0xd075('0x19'),'port':0x18eb});var socket=require(_0xd075('0x1a'))(new Redis(config[_0xd075('0x17')]));require(_0xd075('0x1b'))[_0xd075('0x1c')](socket);function respondWithStatusCode(_0x10875e,_0x48699e){_0x48699e=_0x48699e||0xcc;return function(_0x2c15c3){if(_0x2c15c3){return _0x10875e[_0xd075('0x1d')](_0x48699e);}return _0x10875e[_0xd075('0x1e')](_0x48699e)[_0xd075('0x1f')]();};}function respondWithResult(_0xfcedf2,_0x2adddb){_0x2adddb=_0x2adddb||0xc8;return function(_0x24fec1){if(_0x24fec1){return _0xfcedf2[_0xd075('0x1e')](_0x2adddb)[_0xd075('0x20')](_0x24fec1);}};}function respondWithFilteredResult(_0x388074,_0x5829e0){return function(_0xcd942a){if(_0xcd942a){var _0x377cd7=typeof _0x5829e0[_0xd075('0x21')]==='undefined'&&typeof _0x5829e0[_0xd075('0x22')]===_0xd075('0x23');var _0x126e23=_0xcd942a['count'];var _0x1751ed=_0x377cd7?0x0:_0x5829e0[_0xd075('0x21')];var _0x427b59=_0x377cd7?_0xcd942a[_0xd075('0x24')]:_0x5829e0[_0xd075('0x21')]+_0x5829e0[_0xd075('0x22')];var _0x5a88f0;if(_0x427b59>=_0x126e23){_0x427b59=_0x126e23;_0x5a88f0=0xc8;}else{_0x5a88f0=0xce;}_0x388074['status'](_0x5a88f0);return _0x388074[_0xd075('0x25')]('Content-Range',_0x1751ed+'-'+_0x427b59+'/'+_0x126e23)[_0xd075('0x20')](_0xcd942a);}return null;};}function patchUpdates(_0x5677f6){return function(_0x3657fd){try{jsonpatch[_0xd075('0x26')](_0x3657fd,_0x5677f6,!![]);}catch(_0x2914f6){return BPromise[_0xd075('0x27')](_0x2914f6);}return _0x3657fd['save']();};}function saveUpdates(_0x2d267b,_0x26ff3f){return function(_0x307b95){if(_0x307b95){return _0x307b95[_0xd075('0x28')](_0x2d267b)['then'](function(_0x1d956c){return _0x1d956c;});}return null;};}function removeEntity(_0x470eac,_0x5bb925){return function(_0x55245e){if(_0x55245e){return _0x55245e['destroy']()[_0xd075('0x29')](function(){_0x470eac[_0xd075('0x1e')](0xcc)[_0xd075('0x1f')]();});}};}function handleEntityNotFound(_0x59bf3e,_0x590b57){return function(_0x3ee8fb){if(!_0x3ee8fb){_0x59bf3e[_0xd075('0x1d')](0x194);}return _0x3ee8fb;};}function handleError(_0x561893,_0x5eb2d0){_0x5eb2d0=_0x5eb2d0||0x1f4;return function(_0x4a0d5c){logger[_0xd075('0x2a')](_0x4a0d5c[_0xd075('0x2b')]);if(_0x4a0d5c[_0xd075('0x2c')]){delete _0x4a0d5c[_0xd075('0x2c')];}_0x561893[_0xd075('0x1e')](_0x5eb2d0)[_0xd075('0x2d')](_0x4a0d5c);};}exports[_0xd075('0x2e')]=function(_0xba198,_0x5b3b9a,_0x5e9910){if(!_0xba198[_0xd075('0x2f')]['hasOwnProperty']('text')&&!_0xba198[_0xd075('0x2f')][_0xd075('0x30')](_0xd075('0x31'))){throw new db['Sequelize'][(_0xd075('0x32'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0xba198[_0xd075('0x2f')][_0xd075('0x30')](_0xd075('0x31'))&&!_0xba198['body'][_0xd075('0x30')](_0xd075('0x33'))){throw new db[(_0xd075('0x34'))]['ValidationError'](_0xd075('0x35'));}if(!_0xba198[_0xd075('0x2f')][_0xd075('0x30')](_0xd075('0x36'))){throw new db['Sequelize'][(_0xd075('0x32'))](_0xd075('0x37'));}else{try{var _0x452b15=JSON[_0xd075('0x38')](_0xba198['body'][_0xd075('0x36')]);}catch(_0x2e5839){logger[_0xd075('0x2a')](_0x2e5839);throw new db[(_0xd075('0x34'))][(_0xd075('0x32'))](_0xd075('0x39'));}var _0x2660cd=[_0xd075('0x3a'),_0xd075('0x3b'),_0xd075('0x3c'),'openchannelqueue',_0xd075('0x3d'),_0xd075('0x3e'),_0xd075('0x3f'),_0xd075('0x40'),_0xd075('0x41')];if(_['some'](_0x452b15,function(_0x2033b2){return!_[_0xd075('0x42')](_0x2660cd,_0x2033b2[_0xd075('0x43')][_0xd075('0x44')]());})){throw new db[(_0xd075('0x34'))][(_0xd075('0x32'))](_0xd075('0x45'));}}}var _0x176cdc={};_0x176cdc['senderName']=_0xba198[_0xd075('0x2f')][_0xd075('0x30')]('senderName')?_0xba198[_0xd075('0x2f')]['senderName']:_0xba198['user'][_0xd075('0x46')];_0x176cdc[_0xd075('0x47')]=_['isEmpty'](_0xba198[_0xd075('0x2f')][_0xd075('0x47')])?null:_0xba198[_0xd075('0x2f')][_0xd075('0x47')];_0x176cdc[_0xd075('0x48')]=_0xba198[_0xd075('0x2f')]['beep']||![];_0x176cdc[_0xd075('0x49')]=_0xba198[_0xd075('0x41')]['id'];return getContent(_0xba198[_0xd075('0x2f')])[_0xd075('0x29')](function(_0x59a488){_0x176cdc[_0xd075('0x2f')]=_0x59a488;return getRecipients(_0x452b15);})[_0xd075('0x29')](function(_0x2e2298){_0x176cdc[_0xd075('0x4a')]=_['sortBy'](_0x2e2298)['join'](',');return db['sequelize'][_0xd075('0x4b')](function(_0x4ccc97){return db[_0xd075('0x4c')][_0xd075('0x4d')](_0x176cdc,{'raw':!![],'transaction':_0x4ccc97})[_0xd075('0x29')](function(_0x201ed7){var _0x43cb4a={'sender':_0x176cdc[_0xd075('0x4e')],'description':_0x176cdc[_0xd075('0x47')],'content':_0x176cdc[_0xd075('0x2f')],'beep':_0x176cdc['beep']};_0x2e2298['forEach'](function(_0x58453e){_0x43cb4a[_0xd075('0x4f')]=_0x58453e;socket[_0xd075('0x50')](_0xd075('0x51'),_0x43cb4a);});return _0x201ed7;});});})['then'](respondWithResult(_0x5b3b9a,0xc9))['catch'](handleError(_0x5b3b9a,null));};function getContent(_0x3ecac9){return new BPromise(function(_0x4a336f,_0x42b6b2){if(_0x3ecac9[_0xd075('0x52')]){_0x4a336f(_0x3ecac9['text']);return;}return db['Template'][_0xd075('0x53')]({'attributes':[_0xd075('0x54')],'where':{'id':_0x3ecac9[_0xd075('0x31')]},'raw':!![]})['then'](function(_0x4f373b){if(!_0x4f373b)throw new db['Sequelize'][(_0xd075('0x32'))](_0xd075('0x55'));var _0x151659=Mustache[_0xd075('0x56')](_0x4f373b[_0xd075('0x54')],_0x3ecac9[_0xd075('0x33')]);_0x4a336f(_0x151659);})[_0xd075('0x57')](function(_0x48f6cd){_0x42b6b2(_0x48f6cd);});});}function getRecipients(_0x204f65){return new BPromise(function(_0x3ab63d,_0x5e577c){var _0xddcb1f=[];var _0x90a305=[];_0x204f65['forEach'](function(_0x2c3226){var _0x59c9aa=_[_0xd075('0x58')](_0x2c3226[_0xd075('0x43')][_0xd075('0x44')]());if(_0x59c9aa===_0xd075('0x59')){_0xddcb1f=_[_0xd075('0x5a')](_0xddcb1f,_0x2c3226[_0xd075('0x5b')]);}else{if(_[_0xd075('0x42')](_0x59c9aa,_0xd075('0x5c')))_0x59c9aa=_0x59c9aa['replace'](_0xd075('0x5c'),'Queue');_0x2c3226['ids'][_0xd075('0x5d')](function(_0x2a2505){_0x90a305['push'](getAgents(_0x59c9aa,_0x2a2505));});}});return BPromise[_0xd075('0x5e')](_0x90a305)[_0xd075('0x29')](function(_0x2ad527){_0xddcb1f=_[_0xd075('0x5a')](_0xddcb1f,_[_0xd075('0x5f')](_0x2ad527));_0x3ab63d(_0xddcb1f);})['catch'](function(_0x54d2b7){_0x5e577c(_0x54d2b7);});});}function getAgents(_0x30335d,_0x2015f6){return new BPromise(function(_0x7c02f0,_0x23eda4){return db[_0x30335d][_0xd075('0x53')]({'where':{'id':_0x2015f6}})[_0xd075('0x29')](function(_0x1f41cd){return _0x1f41cd[_0xd075('0x60')]({'attributes':['id'],'raw':!![]})['then'](function(_0x364b22){var _0x16beeb=_['map'](_0x364b22,'id');_0x7c02f0(_0x16beeb);});})['catch'](function(_0x57e0a6){_0x23eda4(_0x57e0a6);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index af064ce..1c88c5b 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 _0xfe7d=['UserNotification','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3cc8c3,_0x5318e1){var _0x9d2e39=function(_0x6fed1a){while(--_0x6fed1a){_0x3cc8c3['push'](_0x3cc8c3['shift']());}};_0x9d2e39(++_0x5318e1);}(_0xfe7d,0xa1));var _0xdfe7=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0xfe7d[_0x19159a];return _0xa677f4;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xdfe7('0x0'))['db'][_0xdfe7('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xdfe7('0x2')](0x0);var events={'afterCreate':_0xdfe7('0x3'),'afterUpdate':_0xdfe7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x47441c){return function(_0x2ffb6f,_0x2038a1,_0x3a7871){UserNotificationEvents[_0xdfe7('0x5')](_0x47441c+':'+_0x2ffb6f['id'],_0x2ffb6f);UserNotificationEvents[_0xdfe7('0x5')](_0x47441c,_0x2ffb6f);_0x3a7871(null);};}for(var e in events){if(events[_0xdfe7('0x6')](e)){var event=events[e];UserNotification[_0xdfe7('0x7')](e,emitEvent(event));}}module[_0xdfe7('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x7027=['hasOwnProperty','hook','exports','events','setMaxListeners','save','emit'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7027,0x192));var _0x7702=function(_0x59d8fb,_0x3e5f0f){_0x59d8fb=_0x59d8fb-0x0;var _0x484fb1=_0x7027[_0x59d8fb];return _0x484fb1;};'use strict';var EventEmitter=require(_0x7702('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x7702('0x1')](0x0);var events={'afterCreate':_0x7702('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5e2ec0){return function(_0x29dec8,_0x54082e,_0x3301c1){UserNotificationEvents[_0x7702('0x3')](_0x5e2ec0+':'+_0x29dec8['id'],_0x29dec8);UserNotificationEvents[_0x7702('0x3')](_0x5e2ec0,_0x29dec8);_0x3301c1(null);};}for(var e in events){if(events[_0x7702('0x4')](e)){var event=events[e];UserNotification[_0x7702('0x5')](e,emitEvent(event));}}module[_0x7702('0x6')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 90c28d8..67d53cc 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 _0x8004=['api','moment','bluebird','rimraf','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4','lodash','util','../../config/logger'];(function(_0x5109fb,_0x1d6241){var _0x18eb18=function(_0x5d2536){while(--_0x5d2536){_0x5109fb['push'](_0x5109fb['shift']());}};_0x18eb18(++_0x1d6241);}(_0x8004,0x75));var _0x4800=function(_0x4396d8,_0x24eb45){_0x4396d8=_0x4396d8-0x0;var _0x463743=_0x8004[_0x4396d8];return _0x463743;};'use strict';var _=require(_0x4800('0x0'));var util=require(_0x4800('0x1'));var logger=require(_0x4800('0x2'))(_0x4800('0x3'));var moment=require(_0x4800('0x4'));var BPromise=require(_0x4800('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4800('0x6'));var config=require('../../config/environment');var attributes=require(_0x4800('0x7'));module['exports']=function(_0xc97c3c,_0x12c005){return _0xc97c3c[_0x4800('0x8')](_0x4800('0x9'),attributes,{'tableName':_0x4800('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4800('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3a4e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0x3a4e,0x14d));var _0xe3a4=function(_0x4e9ca7,_0x35101c){_0x4e9ca7=_0x4e9ca7-0x0;var _0x347d12=_0x3a4e[_0x4e9ca7];return _0x347d12;};'use strict';var _=require(_0xe3a4('0x0'));var util=require(_0xe3a4('0x1'));var logger=require(_0xe3a4('0x2'))('api');var moment=require(_0xe3a4('0x3'));var BPromise=require(_0xe3a4('0x4'));var rp=require(_0xe3a4('0x5'));var fs=require('fs');var path=require(_0xe3a4('0x6'));var rimraf=require(_0xe3a4('0x7'));var config=require(_0xe3a4('0x8'));var attributes=require('./userNotification.attributes');module[_0xe3a4('0x9')]=function(_0x1ae726,_0x1d07ee){return _0x1ae726['define'](_0xe3a4('0xa'),attributes,{'tableName':_0xe3a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe3a4('0xc'),'collate':_0xe3a4('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 1e4f75a..b15f08c 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 _0xb5e4=['socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x20b87d,_0x16b877){var _0x5679ce=function(_0x493c70){while(--_0x493c70){_0x20b87d['push'](_0x20b87d['shift']());}};_0x5679ce(++_0x16b877);}(_0xb5e4,0xab));var _0x4b5e=function(_0x6f9dbb,_0x31fbb9){_0x6f9dbb=_0x6f9dbb-0x0;var _0x5708a3=_0xb5e4[_0x6f9dbb];return _0x5708a3;};'use strict';var _=require(_0x4b5e('0x0'));var util=require(_0x4b5e('0x1'));var moment=require(_0x4b5e('0x2'));var BPromise=require(_0x4b5e('0x3'));var rs=require(_0x4b5e('0x4'));var fs=require('fs');var Redis=require(_0x4b5e('0x5'));var db=require(_0x4b5e('0x6'))['db'];var utils=require(_0x4b5e('0x7'));var logger=require(_0x4b5e('0x8'))('rpc');var config=require(_0x4b5e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4b5e('0xa')][_0x4b5e('0xb')]({'port':0x232a});config[_0x4b5e('0xc')]=_[_0x4b5e('0xd')](config['redis'],{'host':_0x4b5e('0xe'),'port':0x18eb});var socket=require(_0x4b5e('0xf'))(new Redis(config[_0x4b5e('0xc')]));require(_0x4b5e('0x10'))[_0x4b5e('0x11')](socket);function respondWithRpcPromise(_0x3d9e7d,_0x140d95,_0x63aa27){return new BPromise(function(_0x51d2d9,_0x4e212d){return client[_0x4b5e('0x12')](_0x3d9e7d,_0x63aa27)[_0x4b5e('0x13')](function(_0x40109b){logger[_0x4b5e('0x14')](_0x4b5e('0x15'),_0x140d95,_0x4b5e('0x16'));logger[_0x4b5e('0x17')](_0x4b5e('0x18'),_0x140d95,'request\x20sent',JSON[_0x4b5e('0x19')](_0x40109b));if(_0x40109b['error']){if(_0x40109b[_0x4b5e('0x1a')][_0x4b5e('0x1b')]===0x1f4){logger[_0x4b5e('0x1a')]('UserNotification,\x20%s,\x20%s',_0x140d95,_0x40109b['error']['message']);return _0x4e212d(_0x40109b[_0x4b5e('0x1a')][_0x4b5e('0x1c')]);}logger[_0x4b5e('0x1a')]('UserNotification,\x20%s,\x20%s',_0x140d95,_0x40109b[_0x4b5e('0x1a')]['message']);return _0x51d2d9(_0x40109b[_0x4b5e('0x1a')][_0x4b5e('0x1c')]);}else{logger[_0x4b5e('0x14')](_0x4b5e('0x15'),_0x140d95,_0x4b5e('0x16'));_0x51d2d9(_0x40109b[_0x4b5e('0x1d')][_0x4b5e('0x1c')]);}})[_0x4b5e('0x1e')](function(_0x3843d1){logger[_0x4b5e('0x1a')](_0x4b5e('0x15'),_0x140d95,_0x3843d1);_0x4e212d(_0x3843d1);});});} \ No newline at end of file +var _0x6e37=['catch','randomstring','ioredis','../../mysqldb','../../config/utils','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','then','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4ed8ed,_0xf8153e){var _0x2a64f=function(_0x4bdb2d){while(--_0x4bdb2d){_0x4ed8ed['push'](_0x4ed8ed['shift']());}};_0x2a64f(++_0xf8153e);}(_0x6e37,0x99));var _0x76e3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e37[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x76e3('0x0'));var fs=require('fs');var Redis=require(_0x76e3('0x1'));var db=require(_0x76e3('0x2'))['db'];var utils=require(_0x76e3('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76e3('0x4')]['http']({'port':0x232a});config[_0x76e3('0x5')]=_[_0x76e3('0x6')](config[_0x76e3('0x5')],{'host':_0x76e3('0x7'),'port':0x18eb});var socket=require(_0x76e3('0x8'))(new Redis(config[_0x76e3('0x5')]));require(_0x76e3('0x9'))['register'](socket);function respondWithRpcPromise(_0x472701,_0x788f04,_0x246366){return new BPromise(function(_0x4ec037,_0x477550){return client['request'](_0x472701,_0x246366)[_0x76e3('0xa')](function(_0x3eb1b3){logger['info'](_0x76e3('0xb'),_0x788f04,'request\x20sent');logger[_0x76e3('0xc')](_0x76e3('0xd'),_0x788f04,'request\x20sent',JSON[_0x76e3('0xe')](_0x3eb1b3));if(_0x3eb1b3[_0x76e3('0xf')]){if(_0x3eb1b3[_0x76e3('0xf')][_0x76e3('0x10')]===0x1f4){logger[_0x76e3('0xf')]('UserNotification,\x20%s,\x20%s',_0x788f04,_0x3eb1b3['error'][_0x76e3('0x11')]);return _0x477550(_0x3eb1b3[_0x76e3('0xf')][_0x76e3('0x11')]);}logger[_0x76e3('0xf')](_0x76e3('0xb'),_0x788f04,_0x3eb1b3[_0x76e3('0xf')]['message']);return _0x4ec037(_0x3eb1b3[_0x76e3('0xf')][_0x76e3('0x11')]);}else{logger['info'](_0x76e3('0xb'),_0x788f04,'request\x20sent');_0x4ec037(_0x3eb1b3['result'][_0x76e3('0x11')]);}})[_0x76e3('0x12')](function(_0x3f5885){logger[_0x76e3('0xf')](_0x76e3('0xb'),_0x788f04,_0x3f5885);_0x477550(_0x3f5885);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 8d13fd9..acf680a 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 _0x8ad4=['remove','update','emit','register','length','userNotification:','./userNotification.events','save'];(function(_0x2f7ee1,_0x238541){var _0x298295=function(_0x124360){while(--_0x124360){_0x2f7ee1['push'](_0x2f7ee1['shift']());}};_0x298295(++_0x238541);}(_0x8ad4,0x126));var _0x48ad=function(_0x30800b,_0x536828){_0x30800b=_0x30800b-0x0;var _0x3fb300=_0x8ad4[_0x30800b];return _0x3fb300;};'use strict';var UserNotificationEvents=require(_0x48ad('0x0'));var events=[_0x48ad('0x1'),_0x48ad('0x2'),_0x48ad('0x3')];function createListener(_0x1319e7,_0x37fd92){return function(_0x216046){_0x37fd92[_0x48ad('0x4')](_0x1319e7,_0x216046);};}function removeListener(_0x4bc0c9,_0x3d1b28){return function(){UserNotificationEvents['removeListener'](_0x4bc0c9,_0x3d1b28);};}exports[_0x48ad('0x5')]=function(_0x24daf7){for(var _0x3811c7=0x0,_0x233b27=events[_0x48ad('0x6')];_0x3811c7<_0x233b27;_0x3811c7++){var _0xef7984=events[_0x3811c7];var _0x2a9621=createListener(_0x48ad('0x7')+_0xef7984,_0x24daf7);UserNotificationEvents['on'](_0xef7984,_0x2a9621);}}; \ No newline at end of file +var _0xf09c=['remove','update','emit','removeListener','save'];(function(_0x5ce105,_0x34f3ce){var _0x33d030=function(_0x3e64ef){while(--_0x3e64ef){_0x5ce105['push'](_0x5ce105['shift']());}};_0x33d030(++_0x34f3ce);}(_0xf09c,0x13f));var _0xcf09=function(_0x1d7f19,_0x3d8417){_0x1d7f19=_0x1d7f19-0x0;var _0x3285a4=_0xf09c[_0x1d7f19];return _0x3285a4;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xcf09('0x0'),_0xcf09('0x1'),_0xcf09('0x2')];function createListener(_0xeca608,_0x1a0b98){return function(_0x49c92a){_0x1a0b98[_0xcf09('0x3')](_0xeca608,_0x49c92a);};}function removeListener(_0x410e3c,_0x10446f){return function(){UserNotificationEvents[_0xcf09('0x4')](_0x410e3c,_0x10446f);};}exports['register']=function(_0x1f593e){for(var _0x58564b=0x0,_0x2808ff=events['length'];_0x58564b<_0x2808ff;_0x58564b++){var _0x25f840=events[_0x58564b];var _0x5396bc=createListener('userNotification:'+_0x25f840,_0x1f593e);UserNotificationEvents['on'](_0x25f840,_0x5396bc);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index b2acd67..8efe85e 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4145e7,_0x31a1e0){var _0x9b22e1=function(_0x11762c){while(--_0x11762c){_0x4145e7['push'](_0x4145e7['shift']());}};_0x9b22e1(++_0x31a1e0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xcb91[_0x49d41c];return _0xb64c5f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2344d6,_0x41831b){var _0x40bc47=function(_0x1eab7d){while(--_0x1eab7d){_0x2344d6['push'](_0x2344d6['shift']());}};_0x40bc47(++_0x41831b);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index c77bb6a..a4c43c2 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 _0xaef4=['exports','INTEGER','sequelize'];(function(_0x3b936e,_0x1b6196){var _0x2d5de7=function(_0x477132){while(--_0x477132){_0x3b936e['push'](_0x3b936e['shift']());}};_0x2d5de7(++_0x1b6196);}(_0xaef4,0x197));var _0x4aef=function(_0x371622,_0x99c042){_0x371622=_0x371622-0x0;var _0x2abde8=_0xaef4[_0x371622];return _0x2abde8;};'use strict';var Sequelize=require(_0x4aef('0x0'));module[_0x4aef('0x1')]={'penalty':{'type':Sequelize[_0x4aef('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6a30=['INTEGER','sequelize','exports'];(function(_0x4ebce8,_0x5b87d4){var _0x4706f8=function(_0x392a6d){while(--_0x392a6d){_0x4ebce8['push'](_0x4ebce8['shift']());}};_0x4706f8(++_0x5b87d4);}(_0x6a30,0x9d));var _0x06a3=function(_0x264beb,_0x4b52d9){_0x264beb=_0x264beb-0x0;var _0x4914ec=_0x6a30[_0x264beb];return _0x4914ec;};'use strict';var Sequelize=require(_0x06a3('0x0'));module[_0x06a3('0x1')]={'penalty':{'type':Sequelize[_0x06a3('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 64de44b..eb649d8 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 _0x2c4d=['user_has_openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','UserOpenchannelQueue'];(function(_0xde0e66,_0x1a5e43){var _0x17bd72=function(_0x57c5a8){while(--_0x57c5a8){_0xde0e66['push'](_0xde0e66['shift']());}};_0x17bd72(++_0x1a5e43);}(_0x2c4d,0x8d));var _0xd2c4=function(_0x152ea8,_0x3fb53f){_0x152ea8=_0x152ea8-0x0;var _0x4c0ebe=_0x2c4d[_0x152ea8];return _0x4c0ebe;};'use strict';var _=require(_0xd2c4('0x0'));var util=require('util');var logger=require(_0xd2c4('0x1'))(_0xd2c4('0x2'));var moment=require(_0xd2c4('0x3'));var BPromise=require(_0xd2c4('0x4'));var rp=require(_0xd2c4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd2c4('0x6'));var config=require(_0xd2c4('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x20921d,_0x4677bf){return _0x20921d['define'](_0xd2c4('0x8'),attributes,{'tableName':_0xd2c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6773=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','util'];(function(_0x57d187,_0x5198ed){var _0x33a815=function(_0x35fbca){while(--_0x35fbca){_0x57d187['push'](_0x57d187['shift']());}};_0x33a815(++_0x5198ed);}(_0x6773,0x1a3));var _0x3677=function(_0x4b7391,_0x586f07){_0x4b7391=_0x4b7391-0x0;var _0x581212=_0x6773[_0x4b7391];return _0x581212;};'use strict';var _=require('lodash');var util=require(_0x3677('0x0'));var logger=require(_0x3677('0x1'))(_0x3677('0x2'));var moment=require(_0x3677('0x3'));var BPromise=require(_0x3677('0x4'));var rp=require(_0x3677('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3677('0x6'));var config=require(_0x3677('0x7'));var attributes=require(_0x3677('0x8'));module['exports']=function(_0x3f84b6,_0x3671d5){return _0x3f84b6[_0x3677('0x9')](_0x3677('0xa'),attributes,{'tableName':_0x3677('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 37546e6..6b83a82 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 _0x551d=['http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x397633,_0x297aee){var _0x55d1e7=function(_0x919aa7){while(--_0x919aa7){_0x397633['push'](_0x397633['shift']());}};_0x55d1e7(++_0x297aee);}(_0x551d,0xfc));var _0xd551=function(_0x10ab62,_0x21d1da){_0x10ab62=_0x10ab62-0x0;var _0x3b325b=_0x551d[_0x10ab62];return _0x3b325b;};'use strict';var _=require(_0xd551('0x0'));var util=require(_0xd551('0x1'));var moment=require(_0xd551('0x2'));var BPromise=require('bluebird');var rs=require(_0xd551('0x3'));var fs=require('fs');var Redis=require(_0xd551('0x4'));var db=require(_0xd551('0x5'))['db'];var utils=require(_0xd551('0x6'));var logger=require(_0xd551('0x7'))(_0xd551('0x8'));var config=require(_0xd551('0x9'));var jayson=require(_0xd551('0xa'));var client=jayson[_0xd551('0xb')][_0xd551('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x234a83,_0x32345c,_0x3f8e81){return new BPromise(function(_0x18e661,_0x17da03){return client[_0xd551('0xd')](_0x234a83,_0x3f8e81)['then'](function(_0x82aa5f){logger[_0xd551('0xe')](_0xd551('0xf'),_0x32345c,_0xd551('0x10'));logger[_0xd551('0x11')](_0xd551('0x12'),_0x32345c,_0xd551('0x10'),JSON['stringify'](_0x82aa5f));if(_0x82aa5f['error']){if(_0x82aa5f[_0xd551('0x13')][_0xd551('0x14')]===0x1f4){logger['error'](_0xd551('0xf'),_0x32345c,_0x82aa5f[_0xd551('0x13')]['message']);return _0x17da03(_0x82aa5f['error']['message']);}logger[_0xd551('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x32345c,_0x82aa5f[_0xd551('0x13')]['message']);return _0x18e661(_0x82aa5f[_0xd551('0x13')][_0xd551('0x15')]);}else{logger[_0xd551('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x32345c,'request\x20sent');_0x18e661(_0x82aa5f[_0xd551('0x16')]['message']);}})[_0xd551('0x17')](function(_0x37de93){logger[_0xd551('0x13')](_0xd551('0xf'),_0x32345c,_0x37de93);_0x17da03(_0x37de93);});});} \ No newline at end of file +var _0x280a=['then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0x280a,0x1ac));var _0xa280=function(_0xffa302,_0xfd695c){_0xffa302=_0xffa302-0x0;var _0x38ea4b=_0x280a[_0xffa302];return _0x38ea4b;};'use strict';var _=require(_0xa280('0x0'));var util=require(_0xa280('0x1'));var moment=require('moment');var BPromise=require(_0xa280('0x2'));var rs=require(_0xa280('0x3'));var fs=require('fs');var Redis=require(_0xa280('0x4'));var db=require(_0xa280('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa280('0x6'))(_0xa280('0x7'));var config=require(_0xa280('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa280('0x9')][_0xa280('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6b58bb,_0x30e5e7,_0x4973f4){return new BPromise(function(_0x24b47b,_0x156ecb){return client[_0xa280('0xb')](_0x6b58bb,_0x4973f4)[_0xa280('0xc')](function(_0xed3055){logger[_0xa280('0xd')](_0xa280('0xe'),_0x30e5e7,_0xa280('0xf'));logger['debug'](_0xa280('0x10'),_0x30e5e7,_0xa280('0xf'),JSON[_0xa280('0x11')](_0xed3055));if(_0xed3055[_0xa280('0x12')]){if(_0xed3055['error'][_0xa280('0x13')]===0x1f4){logger[_0xa280('0x12')](_0xa280('0xe'),_0x30e5e7,_0xed3055[_0xa280('0x12')][_0xa280('0x14')]);return _0x156ecb(_0xed3055[_0xa280('0x12')][_0xa280('0x14')]);}logger['error'](_0xa280('0xe'),_0x30e5e7,_0xed3055[_0xa280('0x12')][_0xa280('0x14')]);return _0x24b47b(_0xed3055[_0xa280('0x12')][_0xa280('0x14')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x30e5e7,_0xa280('0xf'));_0x24b47b(_0xed3055['result'][_0xa280('0x14')]);}})[_0xa280('0x15')](function(_0x4a4226){logger[_0xa280('0x12')](_0xa280('0xe'),_0x30e5e7,_0x4a4226);_0x156ecb(_0x4a4226);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 46cdf1e..9b917ed 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 _0xf3a7=['get','/describe','describe','show','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','/:id/sections','addResources','put','/:id','update','delete','destroy','removeSections','removeResources','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index'];(function(_0x8fa4bc,_0x5cd2af){var _0x35b6a7=function(_0x357c25){while(--_0x357c25){_0x8fa4bc['push'](_0x8fa4bc['shift']());}};_0x35b6a7(++_0x5cd2af);}(_0xf3a7,0x99));var _0x7f3a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf3a7[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x7f3a('0x0'));var path=require(_0x7f3a('0x1'));var timeout=require(_0x7f3a('0x2'));var express=require(_0x7f3a('0x3'));var router=express[_0x7f3a('0x4')]();var fs_extra=require(_0x7f3a('0x5'));var auth=require(_0x7f3a('0x6'));var interaction=require(_0x7f3a('0x7'));var config=require(_0x7f3a('0x8'));var controller=require(_0x7f3a('0x9'));router['get']('/',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0xb')]);router[_0x7f3a('0xc')](_0x7f3a('0xd'),auth[_0x7f3a('0xa')](),controller[_0x7f3a('0xe')]);router[_0x7f3a('0xc')]('/:id',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0xf')]);router['get']('/:id/sections',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x10')]);router['get'](_0x7f3a('0x11'),auth['isAuthenticated'](),controller[_0x7f3a('0x12')]);router['post']('/',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x13')]);router[_0x7f3a('0x14')](_0x7f3a('0x15'),auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x16')]);router[_0x7f3a('0x14')](_0x7f3a('0x17'),auth[_0x7f3a('0xa')](),controller['addSections']);router[_0x7f3a('0x14')]('/:id/resources',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x18')]);router[_0x7f3a('0x19')](_0x7f3a('0x1a'),auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x1b')]);router[_0x7f3a('0x1c')]('/:id',auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x1d')]);router['delete'](_0x7f3a('0x17'),auth[_0x7f3a('0xa')](),controller[_0x7f3a('0x1e')]);router[_0x7f3a('0x1c')]('/:id/resources',auth['isAuthenticated'](),controller[_0x7f3a('0x1f')]);module[_0x7f3a('0x20')]=router; \ No newline at end of file +var _0x9e53=['../../components/interaction/service','../../config/environment','./userProfile.controller','get','/describe','isAuthenticated','describe','show','/:id/sections','getSections','create','post','addSections','/:id/resources','put','/:id','delete','destroy','removeSections','removeResources','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x44de47,_0x31bb85){var _0x4571d4=function(_0x1fa9ad){while(--_0x1fa9ad){_0x44de47['push'](_0x44de47['shift']());}};_0x4571d4(++_0x31bb85);}(_0x9e53,0x1b5));var _0x39e5=function(_0x33ad1f,_0xfc2fc8){_0x33ad1f=_0x33ad1f-0x0;var _0x26ef22=_0x9e53[_0x33ad1f];return _0x26ef22;};'use strict';var multer=require('multer');var util=require(_0x39e5('0x0'));var path=require(_0x39e5('0x1'));var timeout=require(_0x39e5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x39e5('0x3'));var auth=require(_0x39e5('0x4'));var interaction=require(_0x39e5('0x5'));var config=require(_0x39e5('0x6'));var controller=require(_0x39e5('0x7'));router[_0x39e5('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x39e5('0x8')](_0x39e5('0x9'),auth[_0x39e5('0xa')](),controller[_0x39e5('0xb')]);router[_0x39e5('0x8')]('/:id',auth[_0x39e5('0xa')](),controller[_0x39e5('0xc')]);router[_0x39e5('0x8')](_0x39e5('0xd'),auth['isAuthenticated'](),controller[_0x39e5('0xe')]);router[_0x39e5('0x8')]('/:id/resources',auth['isAuthenticated'](),controller['getResources']);router['post']('/',auth[_0x39e5('0xa')](),controller[_0x39e5('0xf')]);router[_0x39e5('0x10')]('/:id/clone',auth[_0x39e5('0xa')](),controller['clone']);router['post'](_0x39e5('0xd'),auth[_0x39e5('0xa')](),controller[_0x39e5('0x11')]);router[_0x39e5('0x10')](_0x39e5('0x12'),auth[_0x39e5('0xa')](),controller['addResources']);router[_0x39e5('0x13')](_0x39e5('0x14'),auth['isAuthenticated'](),controller['update']);router[_0x39e5('0x15')](_0x39e5('0x14'),auth[_0x39e5('0xa')](),controller[_0x39e5('0x16')]);router[_0x39e5('0x15')](_0x39e5('0xd'),auth[_0x39e5('0xa')](),controller[_0x39e5('0x17')]);router['delete']('/:id/resources',auth['isAuthenticated'](),controller[_0x39e5('0x18')]);module[_0x39e5('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index f38c322..868001b 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 _0x265f=['name','setDataValue','join','getDataValue','crudPermissions','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x21c120,_0x5769f4){var _0x1eb983=function(_0x4a0d66){while(--_0x4a0d66){_0x21c120['push'](_0x21c120['shift']());}};_0x1eb983(++_0x5769f4);}(_0x265f,0x75));var _0xf265=function(_0x69b0bf,_0x248a70){_0x69b0bf=_0x69b0bf-0x0;var _0x53a201=_0x265f[_0x69b0bf];return _0x53a201;};'use strict';var Sequelize=require(_0xf265('0x0'));module[_0xf265('0x1')]={'name':{'type':Sequelize[_0xf265('0x2')],'allowNull':![],'unique':_0xf265('0x3')},'crudPermissions':{'type':Sequelize[_0xf265('0x2')],'set':function(_0x2f683f){this[_0xf265('0x4')]('crudPermissions',_0x2f683f?_0x2f683f[_0xf265('0x5')](''):[]);},'get':function(){return this[_0xf265('0x6')](_0xf265('0x7'))?this[_0xf265('0x6')](_0xf265('0x7'))[_0xf265('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xf265('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xf265('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xf265('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xf265('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf265('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xf265('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xf265('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8e92=['sequelize','exports','STRING','name','setDataValue','crudPermissions','getDataValue','BOOLEAN'];(function(_0x550691,_0x19fe04){var _0x25f1e2=function(_0xe2eebd){while(--_0xe2eebd){_0x550691['push'](_0x550691['shift']());}};_0x25f1e2(++_0x19fe04);}(_0x8e92,0x140));var _0x28e9=function(_0x1ebcd5,_0x144163){_0x1ebcd5=_0x1ebcd5-0x0;var _0x190dcf=_0x8e92[_0x1ebcd5];return _0x190dcf;};'use strict';var Sequelize=require(_0x28e9('0x0'));module[_0x28e9('0x1')]={'name':{'type':Sequelize[_0x28e9('0x2')],'allowNull':![],'unique':_0x28e9('0x3')},'crudPermissions':{'type':Sequelize[_0x28e9('0x2')],'set':function(_0x4fe815){this[_0x28e9('0x4')](_0x28e9('0x5'),_0x4fe815?_0x4fe815['join'](''):[]);},'get':function(){return this[_0x28e9('0x6')](_0x28e9('0x5'))?this['getDataValue'](_0x28e9('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x28e9('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x28e9('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x28e9('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x28e9('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 14a6cfe..1c1c52c 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 _0x04d5=['bulkCreate','removeResources','section','Missing\x20section\x20parameter','getResources','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','sendStatus','stack','name','send','index','map','UserProfile','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','includeAll','include','findAll','rows','options','find','catch','body','get','omit','createdAt','updatedAt','crudPermissions','transaction','create','UserProfileSection','params','each','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','sequelize','sectionId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','resourceId','forEach','addResources'];(function(_0x367798,_0x2c333f){var _0x48d963=function(_0x42f86b){while(--_0x42f86b){_0x367798['push'](_0x367798['shift']());}};_0x48d963(++_0x2c333f);}(_0x04d5,0xe1));var _0x504d=function(_0x564f0f,_0x2c9552){_0x564f0f=_0x564f0f-0x0;var _0x53e007=_0x04d5[_0x564f0f];return _0x53e007;};'use strict';var emlformat=require(_0x504d('0x0'));var rimraf=require(_0x504d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x504d('0x2'));var rp=require(_0x504d('0x3'));var moment=require(_0x504d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x504d('0x5'));var util=require(_0x504d('0x6'));var path=require(_0x504d('0x7'));var sox=require(_0x504d('0x8'));var csv=require(_0x504d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x504d('0xa'));var _=require(_0x504d('0xb'));var squel=require(_0x504d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x504d('0xd'));var toCsv=require(_0x504d('0x9'));var querystring=require(_0x504d('0xe'));var Papa=require('papaparse');var Redis=require(_0x504d('0xf'));var authService=require(_0x504d('0x10'));var qs=require(_0x504d('0x11'));var as=require(_0x504d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x504d('0x13'))(_0x504d('0x14'));var utils=require(_0x504d('0x15'));var config=require(_0x504d('0x16'));var licenseUtil=require(_0x504d('0x17'));var db=require(_0x504d('0x18'))['db'];config[_0x504d('0x19')]=_['defaults'](config['redis'],{'host':_0x504d('0x1a'),'port':0x18eb});var socket=require(_0x504d('0x1b'))(new Redis(config[_0x504d('0x19')]));require(_0x504d('0x1c'))[_0x504d('0x1d')](socket);function respondWithStatusCode(_0x3954ac,_0x5de52b){_0x5de52b=_0x5de52b||0xcc;return function(_0x2df33e){if(_0x2df33e){return _0x3954ac['sendStatus'](_0x5de52b);}return _0x3954ac[_0x504d('0x1e')](_0x5de52b)[_0x504d('0x1f')]();};}function respondWithResult(_0x529f96,_0x4099b8){_0x4099b8=_0x4099b8||0xc8;return function(_0x6f7c30){if(_0x6f7c30){return _0x529f96[_0x504d('0x1e')](_0x4099b8)[_0x504d('0x20')](_0x6f7c30);}};}function respondWithFilteredResult(_0x2a7b5b,_0x538a48){return function(_0x150cc7){if(_0x150cc7){var _0x4e11a0=typeof _0x538a48[_0x504d('0x21')]===_0x504d('0x22')&&typeof _0x538a48[_0x504d('0x23')]==='undefined';var _0x11c073=_0x150cc7[_0x504d('0x24')];var _0x19effc=_0x4e11a0?0x0:_0x538a48[_0x504d('0x21')];var _0x41771e=_0x4e11a0?_0x150cc7['count']:_0x538a48['offset']+_0x538a48[_0x504d('0x23')];var _0x4d4852;if(_0x41771e>=_0x11c073){_0x41771e=_0x11c073;_0x4d4852=0xc8;}else{_0x4d4852=0xce;}_0x2a7b5b[_0x504d('0x1e')](_0x4d4852);return _0x2a7b5b[_0x504d('0x25')]('Content-Range',_0x19effc+'-'+_0x41771e+'/'+_0x11c073)[_0x504d('0x20')](_0x150cc7);}return null;};}function patchUpdates(_0x59f2d0){return function(_0x29388b){try{jsonpatch[_0x504d('0x26')](_0x29388b,_0x59f2d0,!![]);}catch(_0xbef6c1){return BPromise['reject'](_0xbef6c1);}return _0x29388b[_0x504d('0x27')]();};}function saveUpdates(_0x4d29ca,_0x53d67e){return function(_0x218d20){if(_0x218d20){return _0x218d20[_0x504d('0x28')](_0x4d29ca)['then'](function(_0x5bbef7){return _0x5bbef7;});}return null;};}function removeEntity(_0x12c710,_0x251284){return function(_0x54bed7){if(_0x54bed7){return _0x54bed7[_0x504d('0x29')]()[_0x504d('0x2a')](function(){_0x12c710[_0x504d('0x1e')](0xcc)[_0x504d('0x1f')]();});}};}function handleEntityNotFound(_0x358742,_0x5c7177){return function(_0x3d4300){if(!_0x3d4300){_0x358742[_0x504d('0x2b')](0x194);}return _0x3d4300;};}function handleError(_0x45382a,_0x34c010){_0x34c010=_0x34c010||0x1f4;return function(_0x4a43c7){logger['error'](_0x4a43c7[_0x504d('0x2c')]);if(_0x4a43c7['name']){delete _0x4a43c7[_0x504d('0x2d')];}_0x45382a['status'](_0x34c010)[_0x504d('0x2e')](_0x4a43c7);};}exports[_0x504d('0x2f')]=function(_0x385e45,_0x4fef5b){var _0x2e564c={},_0x4b0575={},_0x506a22={'count':0x0,'rows':[]};var _0x156472=_[_0x504d('0x30')](db[_0x504d('0x31')]['rawAttributes'],function(_0x2a98a9){return{'name':_0x2a98a9[_0x504d('0x32')],'type':_0x2a98a9['type']['key']};});_0x4b0575[_0x504d('0x33')]=_[_0x504d('0x30')](_0x156472,_0x504d('0x2d'));_0x4b0575['query']=_[_0x504d('0x34')](_0x385e45[_0x504d('0x35')]);_0x4b0575[_0x504d('0x36')]=_[_0x504d('0x37')](_0x4b0575[_0x504d('0x33')],_0x4b0575[_0x504d('0x35')]);_0x2e564c[_0x504d('0x38')]=_[_0x504d('0x37')](_0x4b0575[_0x504d('0x33')],qs['fields'](_0x385e45['query'][_0x504d('0x39')]));_0x2e564c['attributes']=_0x2e564c[_0x504d('0x38')][_0x504d('0x3a')]?_0x2e564c[_0x504d('0x38')]:_0x4b0575[_0x504d('0x33')];if(!_0x385e45[_0x504d('0x35')][_0x504d('0x3b')](_0x504d('0x3c'))){_0x2e564c[_0x504d('0x23')]=qs[_0x504d('0x23')](_0x385e45[_0x504d('0x35')][_0x504d('0x23')]);_0x2e564c['offset']=qs[_0x504d('0x21')](_0x385e45['query']['offset']);}_0x2e564c['order']=qs[_0x504d('0x3d')](_0x385e45[_0x504d('0x35')]['sort']);_0x2e564c[_0x504d('0x3e')]=qs['filters'](_[_0x504d('0x3f')](_0x385e45[_0x504d('0x35')],_0x4b0575['filters']),_0x156472);if(_0x385e45[_0x504d('0x35')][_0x504d('0x40')]){_0x2e564c[_0x504d('0x3e')]=_['merge'](_0x2e564c['where'],{'$or':_[_0x504d('0x30')](_0x156472,function(_0x3b853c){if(_0x3b853c[_0x504d('0x41')]!=='VIRTUAL'){var _0x1a6d51={};_0x1a6d51[_0x3b853c[_0x504d('0x2d')]]={'$like':'%'+_0x385e45[_0x504d('0x35')]['filter']+'%'};return _0x1a6d51;}})});}_0x2e564c=_[_0x504d('0x42')]({},_0x2e564c,_0x385e45['options']);var _0x46614f={'where':_0x2e564c[_0x504d('0x3e')]};return db[_0x504d('0x31')]['count'](_0x46614f)[_0x504d('0x2a')](function(_0x6d4cc2){_0x506a22[_0x504d('0x24')]=_0x6d4cc2;if(_0x385e45[_0x504d('0x35')][_0x504d('0x43')]){_0x2e564c[_0x504d('0x44')]=[{'all':!![]}];}return db[_0x504d('0x31')][_0x504d('0x45')](_0x2e564c);})[_0x504d('0x2a')](function(_0x5164ee){_0x506a22[_0x504d('0x46')]=_0x5164ee;return _0x506a22;})[_0x504d('0x2a')](respondWithFilteredResult(_0x4fef5b,_0x2e564c))['catch'](handleError(_0x4fef5b,null));};exports['show']=function(_0x1b6d35,_0x3d936e){var _0x56436f={'raw':![],'where':{'id':_0x1b6d35['params']['id']}},_0x58aca5={};_0x58aca5[_0x504d('0x33')]=_[_0x504d('0x34')](db['UserProfile']['rawAttributes']);_0x58aca5['query']=_[_0x504d('0x34')](_0x1b6d35['query']);_0x58aca5[_0x504d('0x36')]=_[_0x504d('0x37')](_0x58aca5[_0x504d('0x33')],_0x58aca5[_0x504d('0x35')]);_0x56436f['attributes']=_[_0x504d('0x37')](_0x58aca5['model'],qs[_0x504d('0x39')](_0x1b6d35[_0x504d('0x35')][_0x504d('0x39')]));_0x56436f['attributes']=_0x56436f[_0x504d('0x38')][_0x504d('0x3a')]?_0x56436f[_0x504d('0x38')]:_0x58aca5[_0x504d('0x33')];if(_0x1b6d35[_0x504d('0x35')][_0x504d('0x43')]){_0x56436f[_0x504d('0x44')]=[{'all':!![]}];}_0x56436f=_[_0x504d('0x42')]({},_0x56436f,_0x1b6d35[_0x504d('0x47')]);return db[_0x504d('0x31')][_0x504d('0x48')](_0x56436f)[_0x504d('0x2a')](handleEntityNotFound(_0x3d936e,null))[_0x504d('0x2a')](respondWithResult(_0x3d936e,null))[_0x504d('0x49')](handleError(_0x3d936e,null));};exports['create']=function(_0x43ae6f,_0x1b6f67){return db[_0x504d('0x31')]['create'](_0x43ae6f[_0x504d('0x4a')],{})[_0x504d('0x2a')](respondWithResult(_0x1b6f67,0xc9))['catch'](handleError(_0x1b6f67,null));};exports['clone']=function(_0x3c5e1a,_0x3fd82c){var _0x9aa6b7={'where':{'id':_0x3c5e1a['params']['id']}},_0x3c095b={};_0x3c095b[_0x504d('0x33')]=_['keys'](db['UserProfile']['rawAttributes']);_0x9aa6b7[_0x504d('0x38')]=_[_0x504d('0x37')](_0x3c095b[_0x504d('0x33')],qs[_0x504d('0x39')](_0x3c5e1a[_0x504d('0x35')][_0x504d('0x39')]));_0x9aa6b7[_0x504d('0x38')]=_0x9aa6b7['attributes'][_0x504d('0x3a')]?_0x9aa6b7['attributes']:_0x3c095b['model'];if(_0x3c5e1a[_0x504d('0x35')][_0x504d('0x43')]){_0x9aa6b7[_0x504d('0x44')]=[{'all':!![]}];}_0x9aa6b7=_[_0x504d('0x42')]({},_0x9aa6b7,_0x3c5e1a[_0x504d('0x47')]);return db[_0x504d('0x31')]['find'](_0x9aa6b7)[_0x504d('0x2a')](handleEntityNotFound(_0x3fd82c,null))[_0x504d('0x2a')](function(_0x3f6bcf){if(_0x3f6bcf){var _0x15e4c5=_0x3f6bcf[_0x504d('0x4b')]({'plain':!![]});_0x15e4c5=qs[_0x504d('0x4c')](_0x15e4c5,['id',_0x504d('0x4d'),_0x504d('0x4e'),_0x504d('0x4f')]);_0x3c5e1a['body']=_[_0x504d('0x4c')](_0x3c5e1a[_0x504d('0x4a')],['id','createdAt',_0x504d('0x4e')]);return db['sequelize'][_0x504d('0x50')](function(_0x147178){return db['UserProfile'][_0x504d('0x51')](_[_0x504d('0x42')](_0x15e4c5,_0x3c5e1a[_0x504d('0x4a')]),{'include':_0x3c5e1a[_0x504d('0x35')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x147178})[_0x504d('0x2a')](function(_0x322682){var _0x14e964=_0x322682['get']({'plain':!![]});return db[_0x504d('0x52')][_0x504d('0x45')]({'where':{'userProfileId':_0x3c5e1a[_0x504d('0x53')]['id']},'raw':!![]})[_0x504d('0x2a')](function(_0x29c5b8){if(_0x29c5b8){return BPromise[_0x504d('0x54')](_0x29c5b8,function(_0x88be22){return new BPromise(function(_0x40786e,_0x4becf9){if(_0x88be22[_0x504d('0x55')]===null||_0x88be22[_0x504d('0x55')]===0x1)_0x40786e(null);return db[_0x504d('0x56')]['findAll']({'where':{'sectionId':_0x88be22['id']},'raw':!![]})[_0x504d('0x2a')](function(_0x5307bb){var _0x911bf6=_[_0x504d('0x30')](_0x5307bb,function(_0x45a9fd){return qs[_0x504d('0x4c')](_0x45a9fd,['id',_0x504d('0x4d'),_0x504d('0x4e'),'sectionId']);});_0x40786e(_0x911bf6);})[_0x504d('0x49')](function(_0x5856df){_0x4becf9(_0x5856df);});})[_0x504d('0x2a')](function(_0x265e00){var _0x2e33b8=qs[_0x504d('0x4c')](_0x88be22,['id',_0x504d('0x4d'),_0x504d('0x4e')]);_0x2e33b8[_0x504d('0x57')]=_0x14e964['id'];if(_0x265e00)_0x2e33b8['Resources']=_0x265e00;return _0x2e33b8;})['then'](function(_0x159263){return db['UserProfileSection'][_0x504d('0x51')](_0x159263,{'include':[{'model':db[_0x504d('0x56')],'as':_0x504d('0x58')}],'raw':!![],'transaction':_0x147178});});})[_0x504d('0x2a')](function(){return _0x14e964;});}});});});}})[_0x504d('0x2a')](respondWithResult(_0x3fd82c,0xc9))['catch'](handleError(_0x3fd82c,null));};exports['update']=function(_0x4d9d4e,_0x1a3f1c){if(_0x4d9d4e['body']['id']){delete _0x4d9d4e[_0x504d('0x4a')]['id'];}return db[_0x504d('0x31')][_0x504d('0x48')]({'where':{'id':_0x4d9d4e[_0x504d('0x53')]['id']}})[_0x504d('0x2a')](handleEntityNotFound(_0x1a3f1c,null))[_0x504d('0x2a')](saveUpdates(_0x4d9d4e[_0x504d('0x4a')],null))['then'](respondWithResult(_0x1a3f1c,null))[_0x504d('0x49')](handleError(_0x1a3f1c,null));};exports[_0x504d('0x29')]=function(_0x3517d3,_0x13f1ac){return db[_0x504d('0x31')][_0x504d('0x48')]({'where':{'id':_0x3517d3[_0x504d('0x53')]['id']}})[_0x504d('0x2a')](handleEntityNotFound(_0x13f1ac,null))['then'](removeEntity(_0x13f1ac,null))[_0x504d('0x49')](handleError(_0x13f1ac,null));};exports[_0x504d('0x59')]=function(_0x432b4f,_0x210477){return db[_0x504d('0x31')][_0x504d('0x59')]()[_0x504d('0x2a')](respondWithResult(_0x210477,null))[_0x504d('0x49')](handleError(_0x210477,null));};exports[_0x504d('0x5a')]=function(_0x6ab9af,_0x15d84c){var _0x27b4cf=_0x6ab9af[_0x504d('0x4a')];return db[_0x504d('0x31')][_0x504d('0x48')]({'where':{'id':_0x6ab9af[_0x504d('0x53')]['id']}})['then'](handleEntityNotFound(_0x15d84c,null))['then'](function(_0x18abab){if(_0x18abab){return db[_0x504d('0x5b')][_0x504d('0x50')](function(_0x2d6d9f){return db[_0x504d('0x52')][_0x504d('0x29')]({'where':{'userProfileId':_0x6ab9af[_0x504d('0x53')]['id'],'sectionId':_[_0x504d('0x30')](_0x27b4cf,function(_0x5f37a2){return _0x5f37a2[_0x504d('0x5c')];})},'transaction':_0x2d6d9f})['then'](function(){var _0x4cccca=_[_0x504d('0x30')](_0x27b4cf,function(_0x45cde8){_0x45cde8[_0x504d('0x57')]=_0x6ab9af[_0x504d('0x53')]['id'];return _0x45cde8;});var _0x4875a6=[];return BPromise[_0x504d('0x54')](_0x4cccca,function(_0x1fe567){return db[_0x504d('0x52')][_0x504d('0x51')](_0x1fe567,{'include':[{'model':db[_0x504d('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x2d6d9f})[_0x504d('0x2a')](function(_0x1e7a72){_0x4875a6[_0x504d('0x5d')](_0x1e7a72['get']({'plain':!![]}));});})[_0x504d('0x2a')](function(){return _0x4875a6;});});});}})['then'](function(_0x14e508){return _0x14e508;})[_0x504d('0x2a')](respondWithResult(_0x15d84c,null))[_0x504d('0x49')](handleError(_0x15d84c,null));};exports[_0x504d('0x5e')]=function(_0x506570,_0x2d9068){var _0x31d28c;return db[_0x504d('0x31')][_0x504d('0x48')]({'where':{'id':_0x506570['params']['id']},'attributes':['id','name']})[_0x504d('0x2a')](handleEntityNotFound(_0x2d9068,null))[_0x504d('0x2a')](function(_0x58baa0){if(_0x58baa0){_0x31d28c=_0x58baa0;return db['UserProfileSection'][_0x504d('0x29')]({'where':{'userProfileId':_0x506570[_0x504d('0x53')]['id'],'sectionId':_0x506570[_0x504d('0x35')][_0x504d('0x5f')]}});}})['then'](function(){return _0x31d28c;})[_0x504d('0x2a')](respondWithStatusCode(_0x2d9068,null))['catch'](handleError(_0x2d9068,null));};exports[_0x504d('0x60')]=function(_0x29b50b,_0x169e89){var _0x5596d8=[];var _0x102cc9=[];return db['UserProfileSection'][_0x504d('0x45')]({'where':{'userProfileId':_0x29b50b[_0x504d('0x53')]['id']},'raw':!![]})[_0x504d('0x2a')](function(_0x38b849){_0x5596d8=_[_0x504d('0x40')](_0x38b849,function(_0x5f4b89){return _0x5f4b89[_0x504d('0x61')]===0x1||_[_0x504d('0x62')]([0x3eb,0x709],_0x5f4b89['sectionId']);});if(!_[_0x504d('0x63')](_0x5596d8)){return _['map'](_0x5596d8,function(_0x415929){return _0x415929[_0x504d('0x5c')];});}else{return;}})[_0x504d('0x2a')](function(_0x395f23){if(_0x395f23)_0x102cc9=_0x395f23;if(_['includes'](_0x102cc9,0x64)){var _0x53b41e=_[_0x504d('0x48')](_0x5596d8,{'sectionId':0x64});return hasDefaultDashboard(_0x53b41e)[_0x504d('0x2a')](function(_0x49b0f9){return _[_0x504d('0x30')](_0x5596d8,function(_0x88f611){if(_0x88f611[_0x504d('0x5c')]===0x64){_0x88f611[_0x504d('0x64')]=_0x49b0f9;}return _0x88f611;});});}else{return;}})[_0x504d('0x2a')](function(_0x3d73fb){if(_0x3d73fb)_0x5596d8=_0x3d73fb;if(_[_0x504d('0x62')](_0x102cc9,0x3eb)){var _0xaea174=_[_0x504d('0x48')](_0x5596d8,{'sectionId':0x3eb});return getCustomDashboards(_0xaea174)[_0x504d('0x2a')](function(_0x50340f){return _[_0x504d('0x30')](_0x5596d8,function(_0x438261){if(_0xaea174[_0x504d('0x61')]){if(_0x438261[_0x504d('0x5c')]===0x3eb){_0x438261[_0x504d('0x64')]=_0x50340f;}}else{if(_0x438261['sectionId']===0x64){_0x438261['subsections']=_0x50340f;}}return _0x438261;});});}else{return;}})[_0x504d('0x2a')](function(_0x11ac47){if(_0x11ac47)_0x5596d8=_0x11ac47;if(_['includes'](_0x102cc9,0x709)){var _0x13a4e1=_[_0x504d('0x48')](_0x5596d8,{'sectionId':0x709});return getPlugins(_0x13a4e1)[_0x504d('0x2a')](function(_0x14f750){if(_0x13a4e1[_0x504d('0x61')]){return _[_0x504d('0x30')](_0x5596d8,function(_0x591fa2){if(_0x591fa2['sectionId']===0x709){_0x591fa2[_0x504d('0x64')]=_0x14f750;}return _0x591fa2;});}else{var _0x51ad6b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x14f750};var _0xf32e10=_[_0x504d('0x30')](_0x5596d8);_0xf32e10[_0x504d('0x5d')](_0x51ad6b);return _0xf32e10;}});}else{return;}})[_0x504d('0x2a')](function(_0x237b9b){if(_0x237b9b)_0x5596d8=_0x237b9b;return _[_0x504d('0x40')](_0x5596d8,['enabled',0x1]);})[_0x504d('0x2a')](respondWithResult(_0x169e89,null))[_0x504d('0x49')](handleError(_0x169e89,null));};function hasDefaultDashboard(_0xd343c5){var _0x203246=[0x65];return new BPromise(function(_0x554a56,_0x4ba37b){try{if(_0xd343c5[_0x504d('0x55')]){_0x554a56(_0x203246);}else{return db[_0x504d('0x56')][_0x504d('0x65')]({'where':{'sectionId':_0xd343c5['id']},'raw':!![]})[_0x504d('0x2a')](function(_0x2e3a41){_0x2e3a41?_0x554a56(_0x203246):_0x554a56();});}}catch(_0x26ba9b){_0x4ba37b(_0x26ba9b);}});}function getCustomDashboards(_0x496ec9){var _0x3c4031=[];return new BPromise(function(_0xd1aa9c,_0x581869){try{if(_0x496ec9[_0x504d('0x55')]){return db['Dashboard'][_0x504d('0x45')]({'raw':!![]})['then'](function(_0x51c051){_0x51c051['forEach'](function(_0x34e1d6){_0x3c4031['push'](_0x34e1d6['id']+0x1869f);});_0xd1aa9c(_0x3c4031);});}else{return db[_0x504d('0x56')][_0x504d('0x45')]({'where':{'sectionId':_0x496ec9['id']},'raw':!![]})[_0x504d('0x2a')](function(_0x4d05cd){_0x4d05cd['forEach'](function(_0x1c39b8){_0x3c4031[_0x504d('0x5d')](_0x1c39b8[_0x504d('0x66')]+0x1869f);});_0xd1aa9c(_0x3c4031);});}}catch(_0x165ae7){_0x581869(_0x165ae7);}});}function getPlugins(_0x54c9b6){var _0x505eb6=[];return new BPromise(function(_0x13083f,_0x5181a8){try{if(_0x54c9b6['autoAssociation']){return db['Plugin'][_0x504d('0x45')]({'raw':!![]})[_0x504d('0x2a')](function(_0x2fc9f9){_0x2fc9f9[_0x504d('0x67')](function(_0xaf9ab7){_0x505eb6[_0x504d('0x5d')](_0xaf9ab7['id']+0x15b38);});_0x13083f(_0x505eb6);});}else{return db['UserProfileResource'][_0x504d('0x45')]({'where':{'sectionId':_0x54c9b6['id']},'raw':!![]})['then'](function(_0x548202){_0x548202[_0x504d('0x67')](function(_0x5dc693){_0x505eb6[_0x504d('0x5d')](_0x5dc693['resourceId']+0x15b38);});_0x13083f(_0x505eb6);});}}catch(_0x40af83){_0x5181a8(_0x40af83);}});}exports[_0x504d('0x68')]=function(_0x4d2904,_0x36fb62){return db[_0x504d('0x31')][_0x504d('0x48')]({'where':{'id':_0x4d2904['params']['id']}})[_0x504d('0x2a')](handleEntityNotFound(_0x36fb62,null))[_0x504d('0x2a')](function(_0x14257b){if(_0x14257b){return db[_0x504d('0x5b')][_0x504d('0x50')](function(_0x2429f9){return db[_0x504d('0x52')]['findAll']({'where':{'userProfileId':_0x4d2904[_0x504d('0x53')]['id']},'attributes':['id'],'raw':!![]})[_0x504d('0x2a')](function(_0x9771a0){if(_0x9771a0){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x4d2904[_0x504d('0x53')]['id'],'id':_[_0x504d('0x30')](_0x9771a0,function(_0x5e6b3a){return _0x5e6b3a['id'];})},'transaction':_0x2429f9});}})[_0x504d('0x2a')](function(_0x4d256a){var _0x512089=_[_0x504d('0x30')](_0x4d2904[_0x504d('0x4a')],function(_0x4352f5){_0x4352f5[_0x504d('0x57')]=_0x4d2904[_0x504d('0x53')]['id'];return _0x4352f5;});return db['UserProfileSection'][_0x504d('0x69')](_0x512089,{'raw':!![],'transaction':_0x2429f9});})[_0x504d('0x2a')](function(_0x8603fb){var _0x485f4f=_['filter'](_[_0x504d('0x30')](_0x8603fb,function(_0x5d1e80){return _0x5d1e80[_0x504d('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x485f4f){return db[_0x504d('0x52')][_0x504d('0x45')]({'where':{'userProfileId':_0x4d2904[_0x504d('0x53')]['id'],'sectionId':_[_0x504d('0x30')](_0x485f4f,function(_0x1b29b2){return _0x1b29b2['sectionId'];})},'attributes':['id',_0x504d('0x5c')],'raw':!![]})[_0x504d('0x2a')](function(_0x1b0d17){var _0x423114=_[_0x504d('0x30')](_0x4d2904[_0x504d('0x4a')],function(_0xeab47b){_0xeab47b[_0x504d('0x57')]=_0x4d2904['params']['id'];return _0xeab47b;});return db['UserProfileResource']['bulkCreate'](_0x423114,{'raw':!![],'transaction':_0x2429f9});});}})[_0x504d('0x49')](handleError(_0x36fb62,null));});}})[_0x504d('0x2a')](function(_0x588e60){var _0x4a30b6=_[_0x504d('0x30')](_0x588e60,function(_0xafa6c1){return _0xafa6c1[_0x504d('0x4b')]({'plain':!![]});});})[_0x504d('0x2a')](respondWithResult(_0x36fb62,null))[_0x504d('0x49')](handleError(_0x36fb62,null));};exports[_0x504d('0x6a')]=function(_0x40509d,_0x2f0d09,_0x4676fd){return db['UserProfile']['find']({'where':{'id':_0x40509d[_0x504d('0x53')]['id']}})[_0x504d('0x2a')](handleEntityNotFound(_0x2f0d09,null))['then'](function(_0x315914){if(_0x315914){return _0x315914[_0x504d('0x6a')](_0x40509d[_0x504d('0x35')][_0x504d('0x5f')]);}})[_0x504d('0x2a')](respondWithStatusCode(_0x2f0d09,null))['catch'](handleError(_0x2f0d09,null));};exports['getResources']=function(_0x588e8a,_0x4cbc94){var _0x17b081={};if(!_0x588e8a['query'][_0x504d('0x6b')])throw new Error(_0x504d('0x6c'));if(!_0x588e8a[_0x504d('0x35')][_0x504d('0x3b')](_0x504d('0x3c'))){_0x17b081['limit']=qs[_0x504d('0x23')](_0x588e8a[_0x504d('0x35')][_0x504d('0x23')]);_0x17b081[_0x504d('0x21')]=qs[_0x504d('0x21')](_0x588e8a[_0x504d('0x35')]['offset']);}return db[_0x504d('0x31')]['find']({'where':{'id':_0x588e8a[_0x504d('0x53')]['id']}})[_0x504d('0x2a')](function(_0x4a6c88){if(!_0x4a6c88)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x588e8a[_0x504d('0x53')]['id']);return db[_0x504d('0x31')][_0x504d('0x6d')](_0x588e8a);})[_0x504d('0x2a')](respondWithFilteredResult(_0x4cbc94,_0x17b081))['catch'](handleError(_0x4cbc94,null));}; \ No newline at end of file +var _0x1aab=['end','error','name','send','index','map','UserProfile','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','fields','find','create','body','clone','params','options','get','createdAt','crudPermissions','updatedAt','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','omit','sectionId','userProfileId','Resources','addSections','sequelize','removeSections','ids','getSections','enabled','includes','subsections','forEach','push','resourceId','bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','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','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy'];(function(_0x19a85a,_0x5b7f31){var _0x25361c=function(_0x4ddbad){while(--_0x4ddbad){_0x19a85a['push'](_0x19a85a['shift']());}};_0x25361c(++_0x5b7f31);}(_0x1aab,0x122));var _0xb1aa=function(_0x4a6581,_0x22a1a0){_0x4a6581=_0x4a6581-0x0;var _0x1920e7=_0x1aab[_0x4a6581];return _0x1920e7;};'use strict';var emlformat=require(_0xb1aa('0x0'));var rimraf=require(_0xb1aa('0x1'));var zipdir=require(_0xb1aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb1aa('0x3'));var moment=require('moment');var BPromise=require(_0xb1aa('0x4'));var Mustache=require(_0xb1aa('0x5'));var util=require(_0xb1aa('0x6'));var path=require(_0xb1aa('0x7'));var sox=require(_0xb1aa('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1aa('0x9'));var _=require(_0xb1aa('0xa'));var squel=require(_0xb1aa('0xb'));var crypto=require(_0xb1aa('0xc'));var jsforce=require(_0xb1aa('0xd'));var deskjs=require(_0xb1aa('0xe'));var toCsv=require(_0xb1aa('0xf'));var querystring=require('querystring');var Papa=require(_0xb1aa('0x10'));var Redis=require(_0xb1aa('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb1aa('0x12'));var as=require(_0xb1aa('0x13'));var hardwareService=require(_0xb1aa('0x14'));var logger=require(_0xb1aa('0x15'))(_0xb1aa('0x16'));var utils=require(_0xb1aa('0x17'));var config=require(_0xb1aa('0x18'));var licenseUtil=require(_0xb1aa('0x19'));var db=require(_0xb1aa('0x1a'))['db'];config[_0xb1aa('0x1b')]=_[_0xb1aa('0x1c')](config[_0xb1aa('0x1b')],{'host':_0xb1aa('0x1d'),'port':0x18eb});var socket=require(_0xb1aa('0x1e'))(new Redis(config[_0xb1aa('0x1b')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0xc75972,_0x53ab03){_0x53ab03=_0x53ab03||0xcc;return function(_0x17c9e8){if(_0x17c9e8){return _0xc75972['sendStatus'](_0x53ab03);}return _0xc75972[_0xb1aa('0x1f')](_0x53ab03)['end']();};}function respondWithResult(_0x24b12d,_0x489fb6){_0x489fb6=_0x489fb6||0xc8;return function(_0x235b7b){if(_0x235b7b){return _0x24b12d[_0xb1aa('0x1f')](_0x489fb6)['json'](_0x235b7b);}};}function respondWithFilteredResult(_0x2531f2,_0x3624aa){return function(_0x1d1450){if(_0x1d1450){var _0x471116=typeof _0x3624aa[_0xb1aa('0x20')]===_0xb1aa('0x21')&&typeof _0x3624aa[_0xb1aa('0x22')]===_0xb1aa('0x21');var _0x36dc82=_0x1d1450[_0xb1aa('0x23')];var _0x142c6d=_0x471116?0x0:_0x3624aa[_0xb1aa('0x20')];var _0x452e6b=_0x471116?_0x1d1450[_0xb1aa('0x23')]:_0x3624aa['offset']+_0x3624aa[_0xb1aa('0x22')];var _0x2e6725;if(_0x452e6b>=_0x36dc82){_0x452e6b=_0x36dc82;_0x2e6725=0xc8;}else{_0x2e6725=0xce;}_0x2531f2[_0xb1aa('0x1f')](_0x2e6725);return _0x2531f2[_0xb1aa('0x24')]('Content-Range',_0x142c6d+'-'+_0x452e6b+'/'+_0x36dc82)[_0xb1aa('0x25')](_0x1d1450);}return null;};}function patchUpdates(_0x143e99){return function(_0x58a71e){try{jsonpatch[_0xb1aa('0x26')](_0x58a71e,_0x143e99,!![]);}catch(_0x17298c){return BPromise[_0xb1aa('0x27')](_0x17298c);}return _0x58a71e['save']();};}function saveUpdates(_0x5bb543,_0x2375ab){return function(_0x781572){if(_0x781572){return _0x781572[_0xb1aa('0x28')](_0x5bb543)[_0xb1aa('0x29')](function(_0x3a9c9e){return _0x3a9c9e;});}return null;};}function removeEntity(_0x2f1db9,_0x26ec21){return function(_0x42fc91){if(_0x42fc91){return _0x42fc91[_0xb1aa('0x2a')]()[_0xb1aa('0x29')](function(){_0x2f1db9[_0xb1aa('0x1f')](0xcc)[_0xb1aa('0x2b')]();});}};}function handleEntityNotFound(_0x34b5e8,_0x4315e8){return function(_0x40c7ff){if(!_0x40c7ff){_0x34b5e8['sendStatus'](0x194);}return _0x40c7ff;};}function handleError(_0xd20062,_0x370669){_0x370669=_0x370669||0x1f4;return function(_0x3c1b92){logger[_0xb1aa('0x2c')](_0x3c1b92['stack']);if(_0x3c1b92[_0xb1aa('0x2d')]){delete _0x3c1b92[_0xb1aa('0x2d')];}_0xd20062['status'](_0x370669)[_0xb1aa('0x2e')](_0x3c1b92);};}exports[_0xb1aa('0x2f')]=function(_0x14d46f,_0x505542){var _0x25df88={},_0x120cc3={},_0x4a785e={'count':0x0,'rows':[]};var _0x4b8b7c=_[_0xb1aa('0x30')](db[_0xb1aa('0x31')][_0xb1aa('0x32')],function(_0x718b9a){return{'name':_0x718b9a[_0xb1aa('0x33')],'type':_0x718b9a[_0xb1aa('0x34')]['key']};});_0x120cc3[_0xb1aa('0x35')]=_['map'](_0x4b8b7c,'name');_0x120cc3['query']=_[_0xb1aa('0x36')](_0x14d46f[_0xb1aa('0x37')]);_0x120cc3[_0xb1aa('0x38')]=_[_0xb1aa('0x39')](_0x120cc3[_0xb1aa('0x35')],_0x120cc3['query']);_0x25df88[_0xb1aa('0x3a')]=_[_0xb1aa('0x39')](_0x120cc3[_0xb1aa('0x35')],qs['fields'](_0x14d46f['query']['fields']));_0x25df88[_0xb1aa('0x3a')]=_0x25df88[_0xb1aa('0x3a')][_0xb1aa('0x3b')]?_0x25df88[_0xb1aa('0x3a')]:_0x120cc3['model'];if(!_0x14d46f[_0xb1aa('0x37')][_0xb1aa('0x3c')](_0xb1aa('0x3d'))){_0x25df88[_0xb1aa('0x22')]=qs['limit'](_0x14d46f[_0xb1aa('0x37')][_0xb1aa('0x22')]);_0x25df88[_0xb1aa('0x20')]=qs['offset'](_0x14d46f[_0xb1aa('0x37')][_0xb1aa('0x20')]);}_0x25df88[_0xb1aa('0x3e')]=qs[_0xb1aa('0x3f')](_0x14d46f[_0xb1aa('0x37')][_0xb1aa('0x3f')]);_0x25df88[_0xb1aa('0x40')]=qs[_0xb1aa('0x38')](_[_0xb1aa('0x41')](_0x14d46f['query'],_0x120cc3[_0xb1aa('0x38')]),_0x4b8b7c);if(_0x14d46f['query'][_0xb1aa('0x42')]){_0x25df88[_0xb1aa('0x40')]=_[_0xb1aa('0x43')](_0x25df88[_0xb1aa('0x40')],{'$or':_['map'](_0x4b8b7c,function(_0x347b6a){if(_0x347b6a[_0xb1aa('0x34')]!==_0xb1aa('0x44')){var _0x582bfb={};_0x582bfb[_0x347b6a[_0xb1aa('0x2d')]]={'$like':'%'+_0x14d46f[_0xb1aa('0x37')]['filter']+'%'};return _0x582bfb;}})});}_0x25df88=_['merge']({},_0x25df88,_0x14d46f['options']);var _0xc32fba={'where':_0x25df88[_0xb1aa('0x40')]};return db[_0xb1aa('0x31')][_0xb1aa('0x23')](_0xc32fba)['then'](function(_0xcf3f4f){_0x4a785e[_0xb1aa('0x23')]=_0xcf3f4f;if(_0x14d46f[_0xb1aa('0x37')][_0xb1aa('0x45')]){_0x25df88[_0xb1aa('0x46')]=[{'all':!![]}];}return db['UserProfile'][_0xb1aa('0x47')](_0x25df88);})[_0xb1aa('0x29')](function(_0xe5be48){_0x4a785e[_0xb1aa('0x48')]=_0xe5be48;return _0x4a785e;})[_0xb1aa('0x29')](respondWithFilteredResult(_0x505542,_0x25df88))[_0xb1aa('0x49')](handleError(_0x505542,null));};exports[_0xb1aa('0x4a')]=function(_0x393f01,_0x54a674){var _0x3c56f3={'raw':![],'where':{'id':_0x393f01['params']['id']}},_0x3bc2d7={};_0x3bc2d7[_0xb1aa('0x35')]=_[_0xb1aa('0x36')](db[_0xb1aa('0x31')][_0xb1aa('0x32')]);_0x3bc2d7['query']=_['keys'](_0x393f01[_0xb1aa('0x37')]);_0x3bc2d7[_0xb1aa('0x38')]=_['intersection'](_0x3bc2d7[_0xb1aa('0x35')],_0x3bc2d7[_0xb1aa('0x37')]);_0x3c56f3[_0xb1aa('0x3a')]=_['intersection'](_0x3bc2d7[_0xb1aa('0x35')],qs[_0xb1aa('0x4b')](_0x393f01['query']['fields']));_0x3c56f3[_0xb1aa('0x3a')]=_0x3c56f3[_0xb1aa('0x3a')][_0xb1aa('0x3b')]?_0x3c56f3['attributes']:_0x3bc2d7[_0xb1aa('0x35')];if(_0x393f01[_0xb1aa('0x37')][_0xb1aa('0x45')]){_0x3c56f3[_0xb1aa('0x46')]=[{'all':!![]}];}_0x3c56f3=_[_0xb1aa('0x43')]({},_0x3c56f3,_0x393f01['options']);return db[_0xb1aa('0x31')][_0xb1aa('0x4c')](_0x3c56f3)[_0xb1aa('0x29')](handleEntityNotFound(_0x54a674,null))[_0xb1aa('0x29')](respondWithResult(_0x54a674,null))['catch'](handleError(_0x54a674,null));};exports['create']=function(_0x213ab2,_0xfd9d9e){return db['UserProfile'][_0xb1aa('0x4d')](_0x213ab2[_0xb1aa('0x4e')],{})[_0xb1aa('0x29')](respondWithResult(_0xfd9d9e,0xc9))['catch'](handleError(_0xfd9d9e,null));};exports[_0xb1aa('0x4f')]=function(_0xb6d736,_0x4c6b3c){var _0x1f9db1={'where':{'id':_0xb6d736[_0xb1aa('0x50')]['id']}},_0x30377e={};_0x30377e[_0xb1aa('0x35')]=_[_0xb1aa('0x36')](db[_0xb1aa('0x31')]['rawAttributes']);_0x1f9db1['attributes']=_[_0xb1aa('0x39')](_0x30377e[_0xb1aa('0x35')],qs[_0xb1aa('0x4b')](_0xb6d736['query']['fields']));_0x1f9db1['attributes']=_0x1f9db1['attributes']['length']?_0x1f9db1['attributes']:_0x30377e[_0xb1aa('0x35')];if(_0xb6d736[_0xb1aa('0x37')][_0xb1aa('0x45')]){_0x1f9db1[_0xb1aa('0x46')]=[{'all':!![]}];}_0x1f9db1=_[_0xb1aa('0x43')]({},_0x1f9db1,_0xb6d736[_0xb1aa('0x51')]);return db[_0xb1aa('0x31')][_0xb1aa('0x4c')](_0x1f9db1)[_0xb1aa('0x29')](handleEntityNotFound(_0x4c6b3c,null))[_0xb1aa('0x29')](function(_0x291986){if(_0x291986){var _0x4f6398=_0x291986[_0xb1aa('0x52')]({'plain':!![]});_0x4f6398=qs['omit'](_0x4f6398,['id',_0xb1aa('0x53'),'updatedAt',_0xb1aa('0x54')]);_0xb6d736[_0xb1aa('0x4e')]=_['omit'](_0xb6d736[_0xb1aa('0x4e')],['id','createdAt',_0xb1aa('0x55')]);return db['sequelize'][_0xb1aa('0x56')](function(_0x3a4c3a){return db[_0xb1aa('0x31')]['create'](_[_0xb1aa('0x43')](_0x4f6398,_0xb6d736['body']),{'include':_0xb6d736['query'][_0xb1aa('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x3a4c3a})[_0xb1aa('0x29')](function(_0x5b8f6d){var _0x38d824=_0x5b8f6d[_0xb1aa('0x52')]({'plain':!![]});return db[_0xb1aa('0x57')]['findAll']({'where':{'userProfileId':_0xb6d736[_0xb1aa('0x50')]['id']},'raw':!![]})[_0xb1aa('0x29')](function(_0x3cc7cd){if(_0x3cc7cd){return BPromise[_0xb1aa('0x58')](_0x3cc7cd,function(_0x56d6c3){return new BPromise(function(_0x4e7c05,_0x30a8bb){if(_0x56d6c3[_0xb1aa('0x59')]===null||_0x56d6c3[_0xb1aa('0x59')]===0x1)_0x4e7c05(null);return db[_0xb1aa('0x5a')]['findAll']({'where':{'sectionId':_0x56d6c3['id']},'raw':!![]})['then'](function(_0x3dd2a1){var _0x300354=_[_0xb1aa('0x30')](_0x3dd2a1,function(_0x3ec5e8){return qs[_0xb1aa('0x5b')](_0x3ec5e8,['id','createdAt','updatedAt',_0xb1aa('0x5c')]);});_0x4e7c05(_0x300354);})[_0xb1aa('0x49')](function(_0x2bec8d){_0x30a8bb(_0x2bec8d);});})['then'](function(_0x12144){var _0x1a17c4=qs['omit'](_0x56d6c3,['id','createdAt',_0xb1aa('0x55')]);_0x1a17c4[_0xb1aa('0x5d')]=_0x38d824['id'];if(_0x12144)_0x1a17c4[_0xb1aa('0x5e')]=_0x12144;return _0x1a17c4;})['then'](function(_0x2d7e8a){return db[_0xb1aa('0x57')][_0xb1aa('0x4d')](_0x2d7e8a,{'include':[{'model':db['UserProfileResource'],'as':_0xb1aa('0x5e')}],'raw':!![],'transaction':_0x3a4c3a});});})[_0xb1aa('0x29')](function(){return _0x38d824;});}});});});}})[_0xb1aa('0x29')](respondWithResult(_0x4c6b3c,0xc9))['catch'](handleError(_0x4c6b3c,null));};exports['update']=function(_0x36a1c5,_0x13249c){if(_0x36a1c5[_0xb1aa('0x4e')]['id']){delete _0x36a1c5['body']['id'];}return db[_0xb1aa('0x31')]['find']({'where':{'id':_0x36a1c5[_0xb1aa('0x50')]['id']}})[_0xb1aa('0x29')](handleEntityNotFound(_0x13249c,null))[_0xb1aa('0x29')](saveUpdates(_0x36a1c5[_0xb1aa('0x4e')],null))[_0xb1aa('0x29')](respondWithResult(_0x13249c,null))[_0xb1aa('0x49')](handleError(_0x13249c,null));};exports[_0xb1aa('0x2a')]=function(_0x7fbc8c,_0x3df823){return db[_0xb1aa('0x31')][_0xb1aa('0x4c')]({'where':{'id':_0x7fbc8c[_0xb1aa('0x50')]['id']}})[_0xb1aa('0x29')](handleEntityNotFound(_0x3df823,null))[_0xb1aa('0x29')](removeEntity(_0x3df823,null))[_0xb1aa('0x49')](handleError(_0x3df823,null));};exports['describe']=function(_0x178ee3,_0x140035){return db[_0xb1aa('0x31')]['describe']()[_0xb1aa('0x29')](respondWithResult(_0x140035,null))[_0xb1aa('0x49')](handleError(_0x140035,null));};exports[_0xb1aa('0x5f')]=function(_0x14281a,_0x1fe3d9){var _0x150846=_0x14281a['body'];return db[_0xb1aa('0x31')]['find']({'where':{'id':_0x14281a[_0xb1aa('0x50')]['id']}})[_0xb1aa('0x29')](handleEntityNotFound(_0x1fe3d9,null))[_0xb1aa('0x29')](function(_0x2c4130){if(_0x2c4130){return db[_0xb1aa('0x60')][_0xb1aa('0x56')](function(_0x59f5ef){return db['UserProfileSection'][_0xb1aa('0x2a')]({'where':{'userProfileId':_0x14281a[_0xb1aa('0x50')]['id'],'sectionId':_[_0xb1aa('0x30')](_0x150846,function(_0x13b682){return _0x13b682['sectionId'];})},'transaction':_0x59f5ef})['then'](function(){var _0x1d8fce=_[_0xb1aa('0x30')](_0x150846,function(_0x4d3b41){_0x4d3b41[_0xb1aa('0x5d')]=_0x14281a[_0xb1aa('0x50')]['id'];return _0x4d3b41;});var _0x1c2f67=[];return BPromise['each'](_0x1d8fce,function(_0x556c0b){return db['UserProfileSection'][_0xb1aa('0x4d')](_0x556c0b,{'include':[{'model':db[_0xb1aa('0x5a')],'as':_0xb1aa('0x5e')}],'raw':!![],'transaction':_0x59f5ef})['then'](function(_0x225ddd){_0x1c2f67['push'](_0x225ddd[_0xb1aa('0x52')]({'plain':!![]}));});})['then'](function(){return _0x1c2f67;});});});}})[_0xb1aa('0x29')](function(_0x3509be){return _0x3509be;})['then'](respondWithResult(_0x1fe3d9,null))[_0xb1aa('0x49')](handleError(_0x1fe3d9,null));};exports[_0xb1aa('0x61')]=function(_0x15407c,_0x488484){var _0x3bf8f5;return db[_0xb1aa('0x31')][_0xb1aa('0x4c')]({'where':{'id':_0x15407c['params']['id']},'attributes':['id',_0xb1aa('0x2d')]})[_0xb1aa('0x29')](handleEntityNotFound(_0x488484,null))['then'](function(_0x55168){if(_0x55168){_0x3bf8f5=_0x55168;return db[_0xb1aa('0x57')][_0xb1aa('0x2a')]({'where':{'userProfileId':_0x15407c[_0xb1aa('0x50')]['id'],'sectionId':_0x15407c[_0xb1aa('0x37')][_0xb1aa('0x62')]}});}})[_0xb1aa('0x29')](function(){return _0x3bf8f5;})[_0xb1aa('0x29')](respondWithStatusCode(_0x488484,null))['catch'](handleError(_0x488484,null));};exports[_0xb1aa('0x63')]=function(_0x1725b1,_0x109d48){var _0x1e3f5c=[];var _0x571173=[];return db[_0xb1aa('0x57')][_0xb1aa('0x47')]({'where':{'userProfileId':_0x1725b1[_0xb1aa('0x50')]['id']},'raw':!![]})[_0xb1aa('0x29')](function(_0x5f969b){_0x1e3f5c=_[_0xb1aa('0x42')](_0x5f969b,function(_0x5e02d6){return _0x5e02d6[_0xb1aa('0x64')]===0x1||_[_0xb1aa('0x65')]([0x3eb,0x709],_0x5e02d6[_0xb1aa('0x5c')]);});if(!_['isEmpty'](_0x1e3f5c)){return _[_0xb1aa('0x30')](_0x1e3f5c,function(_0x26e533){return _0x26e533[_0xb1aa('0x5c')];});}else{return;}})[_0xb1aa('0x29')](function(_0x2cc800){if(_0x2cc800)_0x571173=_0x2cc800;if(_['includes'](_0x571173,0x64)){var _0x55ae65=_[_0xb1aa('0x4c')](_0x1e3f5c,{'sectionId':0x64});return hasDefaultDashboard(_0x55ae65)[_0xb1aa('0x29')](function(_0x1e61d4){return _[_0xb1aa('0x30')](_0x1e3f5c,function(_0x34d43e){if(_0x34d43e[_0xb1aa('0x5c')]===0x64){_0x34d43e[_0xb1aa('0x66')]=_0x1e61d4;}return _0x34d43e;});});}else{return;}})[_0xb1aa('0x29')](function(_0x1655c5){if(_0x1655c5)_0x1e3f5c=_0x1655c5;if(_['includes'](_0x571173,0x3eb)){var _0x295fb8=_['find'](_0x1e3f5c,{'sectionId':0x3eb});return getCustomDashboards(_0x295fb8)[_0xb1aa('0x29')](function(_0xb49db3){return _[_0xb1aa('0x30')](_0x1e3f5c,function(_0x49f199){if(_0x295fb8[_0xb1aa('0x64')]){if(_0x49f199[_0xb1aa('0x5c')]===0x3eb){_0x49f199['subsections']=_0xb49db3;}}else{if(_0x49f199[_0xb1aa('0x5c')]===0x64){_0x49f199['subsections']=_0xb49db3;}}return _0x49f199;});});}else{return;}})[_0xb1aa('0x29')](function(_0x3dcabc){if(_0x3dcabc)_0x1e3f5c=_0x3dcabc;if(_[_0xb1aa('0x65')](_0x571173,0x709)){var _0x2f163a=_[_0xb1aa('0x4c')](_0x1e3f5c,{'sectionId':0x709});return getPlugins(_0x2f163a)[_0xb1aa('0x29')](function(_0x3b75d2){if(_0x2f163a[_0xb1aa('0x64')]){return _[_0xb1aa('0x30')](_0x1e3f5c,function(_0x309ec8){if(_0x309ec8[_0xb1aa('0x5c')]===0x709){_0x309ec8[_0xb1aa('0x66')]=_0x3b75d2;}return _0x309ec8;});}else{var _0x19c124={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3b75d2};var _0x52c422=_[_0xb1aa('0x30')](_0x1e3f5c);_0x52c422['push'](_0x19c124);return _0x52c422;}});}else{return;}})[_0xb1aa('0x29')](function(_0x50b345){if(_0x50b345)_0x1e3f5c=_0x50b345;return _[_0xb1aa('0x42')](_0x1e3f5c,[_0xb1aa('0x64'),0x1]);})[_0xb1aa('0x29')](respondWithResult(_0x109d48,null))[_0xb1aa('0x49')](handleError(_0x109d48,null));};function hasDefaultDashboard(_0x2349cf){var _0x33d660=[0x65];return new BPromise(function(_0x1e5ac3,_0x1c9bf6){try{if(_0x2349cf[_0xb1aa('0x59')]){_0x1e5ac3(_0x33d660);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x2349cf['id']},'raw':!![]})[_0xb1aa('0x29')](function(_0xd75f99){_0xd75f99?_0x1e5ac3(_0x33d660):_0x1e5ac3();});}}catch(_0x56f91c){_0x1c9bf6(_0x56f91c);}});}function getCustomDashboards(_0x2a5bdf){var _0x5a11b=[];return new BPromise(function(_0x16c0d8,_0x1147b1){try{if(_0x2a5bdf[_0xb1aa('0x59')]){return db['Dashboard'][_0xb1aa('0x47')]({'raw':!![]})['then'](function(_0x51e1c2){_0x51e1c2[_0xb1aa('0x67')](function(_0x1b8c81){_0x5a11b[_0xb1aa('0x68')](_0x1b8c81['id']+0x1869f);});_0x16c0d8(_0x5a11b);});}else{return db[_0xb1aa('0x5a')][_0xb1aa('0x47')]({'where':{'sectionId':_0x2a5bdf['id']},'raw':!![]})['then'](function(_0x164489){_0x164489[_0xb1aa('0x67')](function(_0x4a1c7b){_0x5a11b[_0xb1aa('0x68')](_0x4a1c7b['resourceId']+0x1869f);});_0x16c0d8(_0x5a11b);});}}catch(_0x5754a0){_0x1147b1(_0x5754a0);}});}function getPlugins(_0x124885){var _0x59a8ea=[];return new BPromise(function(_0x14476c,_0x4f2c8e){try{if(_0x124885[_0xb1aa('0x59')]){return db['Plugin'][_0xb1aa('0x47')]({'raw':!![]})[_0xb1aa('0x29')](function(_0x31af32){_0x31af32[_0xb1aa('0x67')](function(_0x538888){_0x59a8ea['push'](_0x538888['id']+0x15b38);});_0x14476c(_0x59a8ea);});}else{return db[_0xb1aa('0x5a')][_0xb1aa('0x47')]({'where':{'sectionId':_0x124885['id']},'raw':!![]})[_0xb1aa('0x29')](function(_0x36c4a9){_0x36c4a9[_0xb1aa('0x67')](function(_0x54b7af){_0x59a8ea[_0xb1aa('0x68')](_0x54b7af[_0xb1aa('0x69')]+0x15b38);});_0x14476c(_0x59a8ea);});}}catch(_0x3c5e5c){_0x4f2c8e(_0x3c5e5c);}});}exports['addResources']=function(_0x398a68,_0x1f2246){return db['UserProfile']['find']({'where':{'id':_0x398a68[_0xb1aa('0x50')]['id']}})[_0xb1aa('0x29')](handleEntityNotFound(_0x1f2246,null))[_0xb1aa('0x29')](function(_0x5eb07b){if(_0x5eb07b){return db[_0xb1aa('0x60')][_0xb1aa('0x56')](function(_0x5f42ae){return db['UserProfileSection'][_0xb1aa('0x47')]({'where':{'userProfileId':_0x398a68[_0xb1aa('0x50')]['id']},'attributes':['id'],'raw':!![]})[_0xb1aa('0x29')](function(_0x5cb8f6){if(_0x5cb8f6){return db[_0xb1aa('0x57')][_0xb1aa('0x2a')]({'where':{'userProfileId':_0x398a68[_0xb1aa('0x50')]['id'],'id':_[_0xb1aa('0x30')](_0x5cb8f6,function(_0x12a852){return _0x12a852['id'];})},'transaction':_0x5f42ae});}})[_0xb1aa('0x29')](function(_0x42988c){var _0x109912=_[_0xb1aa('0x30')](_0x398a68['body'],function(_0x5a20f2){_0x5a20f2[_0xb1aa('0x5d')]=_0x398a68['params']['id'];return _0x5a20f2;});return db[_0xb1aa('0x57')][_0xb1aa('0x6a')](_0x109912,{'raw':!![],'transaction':_0x5f42ae});})[_0xb1aa('0x29')](function(_0x34f589){var _0x40d91a=_[_0xb1aa('0x42')](_[_0xb1aa('0x30')](_0x34f589,function(_0x5ed4dd){return _0x5ed4dd[_0xb1aa('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x40d91a){return db[_0xb1aa('0x57')][_0xb1aa('0x47')]({'where':{'userProfileId':_0x398a68[_0xb1aa('0x50')]['id'],'sectionId':_[_0xb1aa('0x30')](_0x40d91a,function(_0x7ba125){return _0x7ba125[_0xb1aa('0x5c')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xb1aa('0x29')](function(_0x4a963c){var _0x49d67b=_[_0xb1aa('0x30')](_0x398a68[_0xb1aa('0x4e')],function(_0x1217e2){_0x1217e2[_0xb1aa('0x5d')]=_0x398a68['params']['id'];return _0x1217e2;});return db['UserProfileResource'][_0xb1aa('0x6a')](_0x49d67b,{'raw':!![],'transaction':_0x5f42ae});});}})[_0xb1aa('0x49')](handleError(_0x1f2246,null));});}})['then'](function(_0x2ac27b){var _0x515241=_['map'](_0x2ac27b,function(_0x1ebb6b){return _0x1ebb6b[_0xb1aa('0x52')]({'plain':!![]});});})[_0xb1aa('0x29')](respondWithResult(_0x1f2246,null))['catch'](handleError(_0x1f2246,null));};exports[_0xb1aa('0x6b')]=function(_0x4069cc,_0x3ecbad,_0x273daf){return db[_0xb1aa('0x31')][_0xb1aa('0x4c')]({'where':{'id':_0x4069cc[_0xb1aa('0x50')]['id']}})[_0xb1aa('0x29')](handleEntityNotFound(_0x3ecbad,null))[_0xb1aa('0x29')](function(_0x2d9bf3){if(_0x2d9bf3){return _0x2d9bf3[_0xb1aa('0x6b')](_0x4069cc[_0xb1aa('0x37')]['ids']);}})[_0xb1aa('0x29')](respondWithStatusCode(_0x3ecbad,null))['catch'](handleError(_0x3ecbad,null));};exports[_0xb1aa('0x6c')]=function(_0x179491,_0x14da7f){var _0x444b19={};if(!_0x179491[_0xb1aa('0x37')][_0xb1aa('0x6d')])throw new Error('Missing\x20section\x20parameter');if(!_0x179491['query'][_0xb1aa('0x3c')](_0xb1aa('0x3d'))){_0x444b19[_0xb1aa('0x22')]=qs[_0xb1aa('0x22')](_0x179491[_0xb1aa('0x37')][_0xb1aa('0x22')]);_0x444b19['offset']=qs['offset'](_0x179491[_0xb1aa('0x37')][_0xb1aa('0x20')]);}return db[_0xb1aa('0x31')][_0xb1aa('0x4c')]({'where':{'id':_0x179491[_0xb1aa('0x50')]['id']}})['then'](function(_0x2a092d){if(!_0x2a092d)throw new Error(_0xb1aa('0x6e')+_0x179491['params']['id']);return db[_0xb1aa('0x31')][_0xb1aa('0x6c')](_0x179491);})[_0xb1aa('0x29')](respondWithFilteredResult(_0x14da7f,_0x444b19))[_0xb1aa('0x49')](handleError(_0x14da7f,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index c1e75d8..cd09324 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 _0x2581=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x3ee1fe,_0x59f2a1){var _0x1ae57a=function(_0x1ef0c4){while(--_0x1ef0c4){_0x3ee1fe['push'](_0x3ee1fe['shift']());}};_0x1ae57a(++_0x59f2a1);}(_0x2581,0xcb));var _0x1258=function(_0x6765c2,_0x1c4f41){_0x6765c2=_0x6765c2-0x0;var _0x3d1105=_0x2581[_0x6765c2];return _0x3d1105;};'use strict';var EventEmitter=require(_0x1258('0x0'));var UserProfile=require(_0x1258('0x1'))['db'][_0x1258('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1258('0x3')](0x0);var events={'afterCreate':_0x1258('0x4'),'afterUpdate':'update','afterDestroy':_0x1258('0x5')};function emitEvent(_0x1235e5){return function(_0x339891,_0xb54644,_0x3ad6b0){UserProfileEvents[_0x1258('0x6')](_0x1235e5+':'+_0x339891['id'],_0x339891);UserProfileEvents[_0x1258('0x6')](_0x1235e5,_0x339891);_0x3ad6b0(null);};}for(var e in events){if(events[_0x1258('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x1258('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x2eba=['UserProfile','setMaxListeners','save','emit','../../mysqldb'];(function(_0x473ee7,_0x4dd754){var _0x30f0d4=function(_0x4d961d){while(--_0x4d961d){_0x473ee7['push'](_0x473ee7['shift']());}};_0x30f0d4(++_0x4dd754);}(_0x2eba,0xc7));var _0xa2eb=function(_0x1b907b,_0x3d8310){_0x1b907b=_0x1b907b-0x0;var _0x4cc61a=_0x2eba[_0x1b907b];return _0x4cc61a;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xa2eb('0x0'))['db'][_0xa2eb('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xa2eb('0x2')](0x0);var events={'afterCreate':_0xa2eb('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x45ff67){return function(_0x51ebed,_0x1544ff,_0x3174a0){UserProfileEvents[_0xa2eb('0x4')](_0x45ff67+':'+_0x51ebed['id'],_0x51ebed);UserProfileEvents[_0xa2eb('0x4')](_0x45ff67,_0x51ebed);_0x3174a0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index d824eab..15bc267 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 _0x5496=['parentSections','SquareProjects','name','projectName','projects','contacts','CmContact','Lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','telephones','Users','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','charAt','toUpperCase','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','union','ignore','autoAssociation','model','all','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','merge','key','VIRTUAL','foreignKey','forEach','options','reportType','DefaultReports','CustomReports','count','rows','includeAll','Tags','color','tag','ThroughTags','include','openTabs','true','dataValues','sms','fax','mail','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','field','value','then','associatedResources','map','catch','findAll','resolve','resourceId','type','squareprojects','childModel','odbc','SquareOdbc','SquareRecording'];(function(_0x2e38cd,_0x446de2){var _0x5120c9=function(_0x18768e){while(--_0x18768e){_0x2e38cd['push'](_0x2e38cd['shift']());}};_0x5120c9(++_0x446de2);}(_0x5496,0x175));var _0x6549=function(_0x10e83d,_0x845ca0){_0x10e83d=_0x10e83d-0x0;var _0x353a04=_0x5496[_0x10e83d];return _0x353a04;};'use strict';var _=require(_0x6549('0x0'));var attributes=require(_0x6549('0x1'));var qs=require(_0x6549('0x2'));var squel=require(_0x6549('0x3'));module[_0x6549('0x4')]=function(_0x4b616a){var _0x21585c=_0x4b616a['models'];function _0x2d2155(_0x8112c5,_0x3750cc){return new Promise(function(_0x4d0473,_0x5a4658){if(!_0x3750cc)return _0x4d0473(null);var _0x43cb17=_0x3750cc[_0x6549('0x5')]?{[_0x3750cc['filter'][_0x6549('0x6')]]:_0x3750cc[_0x6549('0x5')][_0x6549('0x7')]}:undefined;return _0x21585c[_0x8112c5]['findAll']({'where':_0x43cb17,'raw':!![]})[_0x6549('0x8')](function(_0x35d008){_0x3750cc[_0x6549('0x9')]=_[_0x6549('0xa')](_0x35d008,'id');_0x4d0473(_0x3750cc);})[_0x6549('0xb')](function(_0x3e08a6){_0x5a4658(_0x3e08a6);});});}function _0x50fa35(_0x551133,_0x1e27d4){return new Promise(function(_0xac828c,_0x3c5f9b){var _0x216620=_0x551133[_0x6549('0x5')]?{[_0x551133['filter']['field']]:_0x551133[_0x6549('0x5')][_0x6549('0x7')]}:undefined;return _0x21585c[_0x551133['model']][_0x6549('0xc')]({'where':_0x216620,'raw':!![]})[_0x6549('0x8')](function(_0x195d25){_0x1e27d4[_0x6549('0x9')]=_[_0x6549('0xa')](_0x195d25,function(_0x86ae9d){return _0x86ae9d['name'];});_0xac828c(_0x1e27d4);})['catch'](function(_0x384f75){_0x3c5f9b(_0x384f75);});});}function _0x25da29(_0x47a81a,_0x238a04,_0x67acc0){if(!_0x238a04)return Promise[_0x6549('0xd')](null);return new Promise(function(_0x387e60,_0xffc8b9){return _0x21585c['UserProfileResource']['findAll']({'where':{'sectionId':_0x238a04['id']},'raw':!![]})[_0x6549('0x8')](function(_0x48f037){if(_0x47a81a['field']&&_0x47a81a[_0x6549('0x6')]!=='id'){_0x238a04[_0x6549('0x9')]=_[_0x6549('0xa')](_0x48f037,function(_0xfca192){return _0xfca192[_0x47a81a[_0x6549('0x6')]];});}else{if(_0x67acc0==='AnalyticExtractedReport'){_0x238a04[_0x6549('0x9')]=_['map'](_0x48f037,function(_0x125096){return{'id':_0x125096[_0x6549('0xe')],'type':_0x125096[_0x6549('0xf')]};});}else{_0x238a04[_0x6549('0x9')]=_[_0x6549('0xa')](_0x48f037,function(_0x12d547){return _0x12d547[_0x6549('0xe')];});}}_0x387e60(_0x238a04);})[_0x6549('0xb')](function(_0x2be467){_0xffc8b9(_0x2be467);});});}function _0x6ae00c(_0x40d3f9,_0x1fbfa4){var _0x23c0ba={'parentSections':[]};switch(_0x40d3f9['toLowerCase']()){case _0x6549('0x10'):_0x23c0ba[_0x6549('0x11')]='SquareProject';break;case _0x6549('0x12'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x13');break;case'squarerecordings':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x14');_0x23c0ba[_0x6549('0x15')]=[{'name':_0x6549('0x16'),'field':_0x6549('0x17'),'foreignKey':_0x6549('0x18')}];break;case _0x6549('0x19'):_0x23c0ba[_0x6549('0x11')]='JscriptyProject';break;case _0x6549('0x1a'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x1b');_0x23c0ba['parentSections']=[{'name':_0x6549('0x1c'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x23c0ba['childModel']=_0x6549('0x1d');break;case _0x6549('0x1e'):_0x23c0ba['childModel']=_0x6549('0x1f');break;case _0x6549('0x20'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x21');break;case _0x6549('0x22'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x23');break;case'chatwebsites':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x24');break;case _0x6549('0x25'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x26');break;case _0x6549('0x27'):_0x23c0ba['childModel']=_0x6549('0x28');break;case'inboundroutes':case _0x6549('0x29'):case'outboundroutes':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x2a');break;case _0x6549('0x2b'):_0x23c0ba['childModel']=_0x6549('0x2c');break;case _0x6549('0x2d'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x2e');break;case'voicerecordings':_0x23c0ba['childModel']='VoiceRecording';_0x23c0ba[_0x6549('0x15')]=[{'name':_0x6549('0x2f'),'field':'name','foreignKey':_0x6549('0x30'),'model':_0x6549('0x31'),'filter':{'field':_0x6549('0x32'),'value':[_0x6549('0x33')]}},{'name':_0x6549('0x34'),'field':'name','foreignKey':'membername','model':_0x6549('0x31'),'filter':{'field':_0x6549('0x32'),'value':[_0x6549('0x35')]}},{'name':_0x6549('0x36'),'field':_0x6549('0x17'),'foreignKey':_0x6549('0x37'),'model':_0x6549('0x38'),'filter':{'field':_0x6549('0xf'),'value':[_0x6549('0x39')]}},{'name':_0x6549('0x3a'),'field':'name','foreignKey':_0x6549('0x37'),'model':_0x6549('0x38'),'filter':{'field':_0x6549('0xf'),'value':[_0x6549('0x3b')]}}];break;case _0x6549('0x3c'):_0x23c0ba['childModel']='VoiceMusicOnHold';break;case'chanspies':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x3d');break;case _0x6549('0x3e'):_0x23c0ba[_0x6549('0x11')]='VoicePrefix';break;case'ivrcampaigns':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x3f');break;case _0x6549('0x40'):_0x23c0ba['childModel']=_0x6549('0x41');break;case'mailaccounts':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x42');break;case _0x6549('0x43'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x44');break;case _0x6549('0x45'):_0x23c0ba[_0x6549('0x11')]='OpenchannelQueue';break;case _0x6549('0x46'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x47');break;case _0x6549('0x48'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x49');break;case _0x6549('0x4a'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x4b');break;case _0x6549('0x4c'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x4d');break;case _0x6549('0x4e'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x4f');break;case _0x6549('0x50'):_0x23c0ba['childModel']=_0x6549('0x51');break;case _0x6549('0x52'):case _0x6549('0x53'):_0x23c0ba[_0x6549('0x11')]='VoiceQueue';if(_0x1fbfa4){_0x23c0ba[_0x6549('0x15')]=[{'name':'VoiceQueues'},{'name':_0x6549('0x3a')}];}break;case _0x6549('0x54'):case'agents':case _0x6549('0x55'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x31');if(_0x1fbfa4){_0x23c0ba[_0x6549('0x15')]=[{'name':_0x6549('0x56'),'filter':{'field':'role','value':['admin',_0x6549('0x57')]},'ignore':!![]},{'name':_0x6549('0x2f')},{'name':_0x6549('0x34')}];}break;case _0x6549('0x58'):_0x23c0ba[_0x6549('0x11')]='ZendeskAccount';break;case _0x6549('0x59'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x5a');break;case _0x6549('0x5b'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x5c');break;case _0x6549('0x5d'):_0x23c0ba[_0x6549('0x11')]='SugarcrmAccount';break;case _0x6549('0x5e'):_0x23c0ba['childModel']=_0x6549('0x5f');break;case _0x6549('0x60'):_0x23c0ba[_0x6549('0x11')]='ZohoAccount';break;case _0x6549('0x61'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x31');break;case'cannedanswers':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x62');break;case _0x6549('0x63'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x64');break;case _0x6549('0x65'):_0x23c0ba['childModel']=_0x6549('0x66');break;case'intervals':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x67');break;case _0x6549('0x68'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x69');break;case _0x6549('0x6a'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x6b');break;case _0x6549('0x6c'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x6d');break;case _0x6549('0x6e'):_0x23c0ba['childModel']=_0x6549('0x6f');break;case _0x6549('0x70'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x71');break;case _0x6549('0x72'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x73');break;case _0x6549('0x74'):_0x23c0ba['childModel']=_0x6549('0x75');break;case _0x6549('0x76'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x77');break;case _0x6549('0x78'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x79');break;case _0x6549('0x7a'):_0x23c0ba['childModel']=_0x6549('0x7b');_0x23c0ba[_0x6549('0x15')]=[{'name':_0x6549('0x7c'),'field':'id','foreignKey':_0x6549('0x7d')}];break;case _0x6549('0x7e'):_0x23c0ba[_0x6549('0x11')]='AnalyticMetric';break;}return _0x23c0ba;}function _0x2ca517(_0xe0a696,_0x4bf996){var _0x38bce4=_0xe0a696[_0x6549('0x7f')](0x0)[_0x6549('0x80')]()+_0xe0a696['slice'](0x1);var _0x4640c8={'type':_0x21585c[_0x6549('0x81')]['QueryTypes'][_0x6549('0x82')],'raw':!![]};return new Promise(function(_0x509f69,_0x3dc12c){var _0x522cd3=squel[_0x6549('0x83')]()[_0x6549('0x6')](_0x6549('0x84')+_0x38bce4+_0x6549('0x85'),'id')[_0x6549('0x6')](_0x6549('0x86'))[_0x6549('0x87')](_0x6549('0x88')+_0xe0a696+_0x6549('0x89'),'ui')[_0x6549('0x8a')](_0x6549('0x8b'),_0x4bf996['id']);return _0x21585c[_0x6549('0x8c')][_0x6549('0x8d')](_0x522cd3[_0x6549('0x8e')](),_0x4640c8)['then'](function(_0x2bff46){_0x4bf996[_0x38bce4+_0x6549('0x8f')]=_0x2bff46;_0x509f69(_0x2bff46);})['catch'](function(_0xfb11e1){_0x3dc12c(_0xfb11e1);});});}return _0x4b616a[_0x6549('0x90')](_0x6549('0x91'),attributes,{'tableName':_0x6549('0x92'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4fbc75){var _0x6ff64d={'raw':![],'where':{}};var _0x28ff2e={};var _0x19c9bd={'count':0x0,'rows':[]};var _0x20e39b=_0x4fbc75['query'][_0x6549('0x93')];var _0x5372f4=_0x4fbc75[_0x6549('0x8d')][_0x6549('0x94')]||![];var _0x101221=_0x6ae00c(_0x20e39b,_0x5372f4);if(!_0x101221[_0x6549('0x11')])throw new Error(_0x6549('0x95')+_0x20e39b+'\x27');var _0x23f067=[{'name':_0x20e39b}];if(!_[_0x6549('0x96')](_0x101221[_0x6549('0x15')]))_0x23f067=_0x101221[_0x6549('0x15')];var _0x1cd528=[];for(var _0x49427f=0x0;_0x49427f<_0x23f067[_0x6549('0x97')];_0x49427f++){_0x1cd528[_0x6549('0x98')](_0x21585c[_0x6549('0x99')][_0x6549('0x9a')]({'where':{'userProfileId':_0x4fbc75[_0x6549('0x9b')]['id'],'name':_0x23f067[_0x49427f][_0x6549('0x17')]},'raw':!![]}));}return Promise['all'](_0x1cd528)['then'](function(_0x368298){var _0x11886e=_[_0x6549('0x5')](_0x368298,function(_0x4e8333){return _0x4e8333?_0x4e8333:undefined;});var _0x1be12c=_[_0x6549('0x5')](_0x23f067,['ignore',!![]]);var _0x312299=_[_0x6549('0x96')](_0x11886e)&&_[_0x6549('0x96')](_0x1be12c)?null:_[_0x6549('0x9c')](_0x1be12c,_0x11886e);if(!_0x312299)return null;var _0x2ea46d=[];for(var _0x3c1768=0x0;_0x3c1768<_0x312299[_0x6549('0x97')];_0x3c1768++){var _0x402c26=_['find'](_0x23f067,function(_0x43c667){return _0x312299[_0x3c1768]?_0x43c667['name']===_0x312299[_0x3c1768][_0x6549('0x17')]:null;});if(_0x402c26){if(_0x312299[_0x3c1768][_0x6549('0x9d')]){_0x2ea46d['push'](_0x2d2155(_0x101221[_0x6549('0x11')],_0x312299[_0x3c1768]));}else{if(!_0x312299[_0x3c1768][_0x6549('0x9e')]){_0x2ea46d[_0x6549('0x98')](_0x25da29(_0x402c26,_0x312299[_0x3c1768],_0x101221['childModel']));}else{if(_0x402c26[_0x6549('0x9f')]){_0x2ea46d[_0x6549('0x98')](_0x50fa35(_0x402c26,_0x312299[_0x3c1768]));}}}}}return Promise[_0x6549('0xa0')](_0x2ea46d);})[_0x6549('0x8')](function(_0x15b906){var _0x34c5f9=_0x15b906;var _0x500bd9=null;if(_0x34c5f9){_0x500bd9=_0x34c5f9[_0x6549('0x97')]===0x1?_0x34c5f9[0x0]:null;}if(!_0x500bd9&&!_0x34c5f9)return _0x19c9bd;var _0x1cad48=_0x21585c[_0x101221[_0x6549('0x11')]]['rawAttributes'];_0x28ff2e['model']=_['keys'](_0x1cad48);_0x28ff2e[_0x6549('0x8d')]=_[_0x6549('0xa1')](_0x4fbc75[_0x6549('0x8d')]);_0x28ff2e['filters']=_['intersection'](_0x28ff2e[_0x6549('0x9f')],_0x28ff2e['query']);_0x6ff64d[_0x6549('0xa2')]=_[_0x6549('0xa3')](_0x28ff2e[_0x6549('0x9f')],qs[_0x6549('0xa4')](_0x4fbc75[_0x6549('0x8d')][_0x6549('0xa4')]));_0x6ff64d[_0x6549('0xa2')]=_0x6ff64d['attributes'][_0x6549('0x97')]?_0x6ff64d[_0x6549('0xa2')]:_0x28ff2e[_0x6549('0x9f')];if(!_0x4fbc75['query'][_0x6549('0xa5')](_0x6549('0xa6'))){_0x6ff64d[_0x6549('0xa7')]=qs[_0x6549('0xa7')](_0x4fbc75[_0x6549('0x8d')][_0x6549('0xa7')]);_0x6ff64d[_0x6549('0xa8')]=qs['offset'](_0x4fbc75[_0x6549('0x8d')]['offset']);}_0x6ff64d[_0x6549('0xa9')]=qs[_0x6549('0xaa')](_0x4fbc75[_0x6549('0x8d')][_0x6549('0xaa')]);_0x6ff64d[_0x6549('0x8a')]=qs[_0x6549('0xab')](_[_0x6549('0xac')](_0x4fbc75[_0x6549('0x8d')],_0x28ff2e['filters']));if(_0x4fbc75[_0x6549('0x8d')][_0x6549('0x5')]){_0x6ff64d[_0x6549('0x8a')]=_[_0x6549('0xad')](_0x6ff64d[_0x6549('0x8a')],{'$or':_[_0x6549('0xa')](_0x1cad48,function(_0xc8645b){if(_0xc8645b[_0x6549('0xf')][_0x6549('0xae')]!==_0x6549('0xaf')){var _0x51f479={};_0x51f479[_0xc8645b[_0x6549('0x6')]]={'$like':'%'+_0x4fbc75[_0x6549('0x8d')][_0x6549('0x5')]+'%'};return _0x51f479;}})});}var _0x45dc56=[];var _0x416657=null;var _0xd80e41={};if(_0x500bd9){_0x416657=_[_0x6549('0x9a')](_0x23f067,[_0x6549('0x17'),_0x500bd9[_0x6549('0x17')]]);if(_0x416657[_0x6549('0x6')]){_0xd80e41={};if(_0x101221[_0x6549('0x11')]===_0x6549('0x7b')){_0xd80e41[_0x416657[_0x6549('0xb0')]]=_[_0x6549('0xa')](_0x500bd9[_0x6549('0x9')],'id');}else{_0xd80e41[_0x416657[_0x6549('0xb0')]]=_0x500bd9[_0x6549('0x9')];}_0x45dc56[_0x6549('0x98')](_0xd80e41);}else{_0x6ff64d['where']['id']=_0x500bd9[_0x6549('0x9')];}}else{for(var _0x401eb0=0x0;_0x401eb0<_0x34c5f9[_0x6549('0x97')];_0x401eb0++){_0x416657=_[_0x6549('0x9a')](_0x23f067,[_0x6549('0x17'),_0x34c5f9[_0x401eb0][_0x6549('0x17')]]);if(_0x416657[_0x6549('0x6')]){_0xd80e41={};_0xd80e41[_0x416657[_0x6549('0xb0')]]=_0x34c5f9[_0x401eb0][_0x6549('0x9')];_0x45dc56[_0x6549('0x98')](_0xd80e41);}else{if(!_0x6ff64d[_0x6549('0x8a')]['id'])_0x6ff64d[_0x6549('0x8a')]['id']=[];_0x34c5f9[_0x401eb0][_0x6549('0x9')][_0x6549('0xb1')](function(_0x38df70){_0x6ff64d[_0x6549('0x8a')]['id'][_0x6549('0x98')](_0x38df70);});}}}if(!_['isEmpty'](_0x45dc56)){_0x6ff64d[_0x6549('0x8a')]=_[_0x6549('0xad')](_0x6ff64d[_0x6549('0x8a')],{'$and':{'$or':_0x45dc56}});}_0x6ff64d=_[_0x6549('0xad')]({},_0x6ff64d,_0x4fbc75[_0x6549('0xb2')]);if(_0x500bd9&&!_0x500bd9[_0x6549('0x9e')]&&_0x101221[_0x6549('0x11')]==='AnalyticExtractedReport'){if(_0x4fbc75[_0x6549('0x8d')]['includeAll']){_0x6ff64d['include']=[{'all':!![]}];}return _0x21585c[_0x101221[_0x6549('0x11')]]['findAll'](_0x6ff64d)[_0x6549('0x8')](function(_0x1f3230){var _0x30083b=[];_0x1f3230[_0x6549('0xb1')](function(_0x419fdb){var _0x5ac35c;switch(_0x419fdb[_0x6549('0xb3')]){case'default':_0x5ac35c=_[_0x6549('0x9a')](_0x500bd9[_0x6549('0x9')],function(_0x4528fd){return _0x4528fd['id']===_0x419fdb['reportId']&&_0x4528fd[_0x6549('0xf')]===_0x6549('0xb4');});break;case'custom':_0x5ac35c=_['find'](_0x500bd9[_0x6549('0x9')],function(_0x154346){return _0x154346['id']===_0x419fdb[_0x6549('0x7d')]&&_0x154346[_0x6549('0xf')]===_0x6549('0xb5');});break;}if(_0x5ac35c)_0x30083b[_0x6549('0x98')](_0x419fdb);});_0x19c9bd[_0x6549('0xb6')]=_0x30083b[_0x6549('0x97')];_0x19c9bd[_0x6549('0xb7')]=_0x30083b;return _0x19c9bd;});}else{return _0x21585c[_0x101221[_0x6549('0x11')]][_0x6549('0xb6')]({'where':_0x6ff64d[_0x6549('0x8a')]})[_0x6549('0x8')](function(_0x4746bb){_0x19c9bd[_0x6549('0xb6')]=_0x4746bb;if(_0x4fbc75[_0x6549('0x8d')][_0x6549('0xb8')]){if(_0x101221[_0x6549('0x11')]===_0x6549('0x1b')){_0x6ff64d['include']=[{'model':_0x21585c['Tag'],'as':_0x6549('0xb9'),'attributes':['id',_0x6549('0x17'),_0x6549('0xba')],'required':_0x4fbc75[_0x6549('0x8d')][_0x6549('0xbb')]?!![]:![]},{'model':_0x21585c[_0x6549('0x6f')],'as':_0x6549('0xbc'),'attributes':['id',_0x6549('0x17'),_0x6549('0xba')],'through':_0x4fbc75[_0x6549('0x8d')]['tag']?{'attributes':[],'where':{'TagId':_0x4fbc75['query']['tag']||undefined}}:{},'required':_0x4fbc75[_0x6549('0x8d')][_0x6549('0xbb')]?!![]:![]}];}else{_0x6ff64d[_0x6549('0xbd')]=[{'all':!![]}];}}return _0x21585c[_0x101221[_0x6549('0x11')]][_0x6549('0xc')](_0x6ff64d);})['then'](function(_0x100c37){_0x19c9bd[_0x6549('0xb7')]=_0x100c37;if(_0x20e39b===_0x6549('0x2f')&&_0x4fbc75[_0x6549('0x8d')][_0x6549('0xbe')]===_0x6549('0xbf')){var _0xaf1a80=[];for(var _0x1dd688=0x0;_0x1dd688<_0x19c9bd[_0x6549('0xb7')][_0x6549('0x97')];_0x1dd688++){_0xaf1a80[_0x6549('0x98')](_0x2ca517('chat',_0x19c9bd[_0x6549('0xb7')][_0x1dd688][_0x6549('0xc0')]));_0xaf1a80[_0x6549('0x98')](_0x2ca517(_0x6549('0xc1'),_0x19c9bd['rows'][_0x1dd688][_0x6549('0xc0')]));_0xaf1a80[_0x6549('0x98')](_0x2ca517(_0x6549('0xc2'),_0x19c9bd[_0x6549('0xb7')][_0x1dd688][_0x6549('0xc0')]));_0xaf1a80[_0x6549('0x98')](_0x2ca517(_0x6549('0xc3'),_0x19c9bd[_0x6549('0xb7')][_0x1dd688][_0x6549('0xc0')]));_0xaf1a80['push'](_0x2ca517(_0x6549('0xc4'),_0x19c9bd[_0x6549('0xb7')][_0x1dd688][_0x6549('0xc0')]));_0xaf1a80[_0x6549('0x98')](_0x2ca517('whatsapp',_0x19c9bd['rows'][_0x1dd688]['dataValues']));}return Promise[_0x6549('0xa0')](_0xaf1a80)['then'](function(){return _0x19c9bd;});}return _0x19c9bd;});}});}}});}; \ No newline at end of file +var _0x4819=['merge','key','foreignKey','forEach','AnalyticExtractedReport','includeAll','reportType','default','DefaultReports','custom','CustomReports','count','rows','include','Tags','ThroughTags','tag','openTabs','chat','dataValues','fax','mail','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','map','model','then','associatedResources','name','catch','resolve','resourceId','type','toLowerCase','squareprojects','odbc','childModel','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','CmContact','Lists','ListId','CmList','companies','globalcustomfields','CmCustomField','chatqueues','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','telephone','queue','VoiceQueue','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','smsqueues','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','VoiceQueues','agents','telephones','Users','admin','user','Telephones','ZendeskAccount','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Interval','pauses','Sound','tags','Tag','Template','triggers','Trigger','trunks','variables','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','slice','QueryTypes','SELECT','select','InteractionId','ui.createdAt','from','user_has_','_interactions','sequelize','toString','OpenTabs','define','UserProfile','query','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','ignore','isEmpty','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x4819,0xcd));var _0x9481=function(_0x5390a3,_0x4d60f7){_0x5390a3=_0x5390a3-0x0;var _0x45d220=_0x4819[_0x5390a3];return _0x45d220;};'use strict';var _=require('lodash');var attributes=require(_0x9481('0x0'));var qs=require(_0x9481('0x1'));var squel=require(_0x9481('0x2'));module[_0x9481('0x3')]=function(_0x273a32){var _0xfb4034=_0x273a32[_0x9481('0x4')];function _0x14dc10(_0xc39edf,_0x16c617){return new Promise(function(_0x5ac51c,_0x4d9e3a){if(!_0x16c617)return _0x5ac51c(null);var _0x5def07=_0x16c617['filter']?{[_0x16c617[_0x9481('0x5')][_0x9481('0x6')]]:_0x16c617[_0x9481('0x5')][_0x9481('0x7')]}:undefined;return _0xfb4034[_0xc39edf][_0x9481('0x8')]({'where':_0x5def07,'raw':!![]})['then'](function(_0x1818cf){_0x16c617['associatedResources']=_[_0x9481('0x9')](_0x1818cf,'id');_0x5ac51c(_0x16c617);})['catch'](function(_0x411d24){_0x4d9e3a(_0x411d24);});});}function _0x2d5d0f(_0x2d4d44,_0x3ffe85){return new Promise(function(_0xe84f77,_0x29515a){var _0xa38c93=_0x2d4d44[_0x9481('0x5')]?{[_0x2d4d44[_0x9481('0x5')]['field']]:_0x2d4d44['filter'][_0x9481('0x7')]}:undefined;return _0xfb4034[_0x2d4d44[_0x9481('0xa')]][_0x9481('0x8')]({'where':_0xa38c93,'raw':!![]})[_0x9481('0xb')](function(_0x3d23c2){_0x3ffe85[_0x9481('0xc')]=_[_0x9481('0x9')](_0x3d23c2,function(_0x495b30){return _0x495b30[_0x9481('0xd')];});_0xe84f77(_0x3ffe85);})[_0x9481('0xe')](function(_0x5b1fe6){_0x29515a(_0x5b1fe6);});});}function _0x2266d5(_0x518150,_0x34108d,_0x7a2ac8){if(!_0x34108d)return Promise[_0x9481('0xf')](null);return new Promise(function(_0x2bb2a4,_0x546fce){return _0xfb4034['UserProfileResource'][_0x9481('0x8')]({'where':{'sectionId':_0x34108d['id']},'raw':!![]})['then'](function(_0x4d0da7){if(_0x518150[_0x9481('0x6')]&&_0x518150[_0x9481('0x6')]!=='id'){_0x34108d[_0x9481('0xc')]=_[_0x9481('0x9')](_0x4d0da7,function(_0x7000e7){return _0x7000e7[_0x518150[_0x9481('0x6')]];});}else{if(_0x7a2ac8==='AnalyticExtractedReport'){_0x34108d[_0x9481('0xc')]=_[_0x9481('0x9')](_0x4d0da7,function(_0x45f9df){return{'id':_0x45f9df[_0x9481('0x10')],'type':_0x45f9df[_0x9481('0x11')]};});}else{_0x34108d['associatedResources']=_[_0x9481('0x9')](_0x4d0da7,function(_0x294908){return _0x294908['resourceId'];});}}_0x2bb2a4(_0x34108d);})[_0x9481('0xe')](function(_0xd1cd1a){_0x546fce(_0xd1cd1a);});});}function _0x352b3a(_0x1809d2,_0x2dc02e){var _0x49ecfa={'parentSections':[]};switch(_0x1809d2[_0x9481('0x12')]()){case _0x9481('0x13'):_0x49ecfa['childModel']='SquareProject';break;case _0x9481('0x14'):_0x49ecfa[_0x9481('0x15')]='SquareOdbc';break;case _0x9481('0x16'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x17');_0x49ecfa[_0x9481('0x18')]=[{'name':'SquareProjects','field':_0x9481('0xd'),'foreignKey':_0x9481('0x19')}];break;case _0x9481('0x1a'):_0x49ecfa['childModel']=_0x9481('0x1b');break;case'contacts':_0x49ecfa[_0x9481('0x15')]=_0x9481('0x1c');_0x49ecfa[_0x9481('0x18')]=[{'name':_0x9481('0x1d'),'field':'id','foreignKey':_0x9481('0x1e')}];break;case'lists':_0x49ecfa[_0x9481('0x15')]=_0x9481('0x1f');break;case _0x9481('0x20'):_0x49ecfa['childModel']='CmCompany';break;case _0x9481('0x21'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x22');break;case _0x9481('0x23'):_0x49ecfa['childModel']='ChatQueue';break;case'chatwebsites':_0x49ecfa[_0x9481('0x15')]='ChatWebsite';break;case _0x9481('0x24'):_0x49ecfa['childModel']=_0x9481('0x25');break;case _0x9481('0x26'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x27');break;case _0x9481('0x28'):case'internalroutes':case _0x9481('0x29'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x2a');break;case'contexts':_0x49ecfa[_0x9481('0x15')]=_0x9481('0x2b');break;case _0x9481('0x2c'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x2d');break;case _0x9481('0x2e'):_0x49ecfa['childModel']=_0x9481('0x2f');_0x49ecfa['parentSections']=[{'name':_0x9481('0x30'),'field':_0x9481('0xd'),'foreignKey':_0x9481('0x31'),'model':_0x9481('0x32'),'filter':{'field':_0x9481('0x33'),'value':[_0x9481('0x34')]}},{'name':'Telephones','field':_0x9481('0xd'),'foreignKey':_0x9481('0x31'),'model':'User','filter':{'field':'role','value':[_0x9481('0x35')]}},{'name':'VoiceQueues','field':_0x9481('0xd'),'foreignKey':_0x9481('0x36'),'model':_0x9481('0x37'),'filter':{'field':_0x9481('0x11'),'value':['inbound']}},{'name':_0x9481('0x38'),'field':'name','foreignKey':_0x9481('0x36'),'model':'VoiceQueue','filter':{'field':_0x9481('0x11'),'value':['outbound']}}];break;case _0x9481('0x39'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x3a');break;case _0x9481('0x3b'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x3c');break;case _0x9481('0x3d'):_0x49ecfa['childModel']=_0x9481('0x3e');break;case _0x9481('0x3f'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x40');break;case _0x9481('0x41'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x42');break;case'mailaccounts':_0x49ecfa[_0x9481('0x15')]=_0x9481('0x43');break;case'mailsubstatuses':_0x49ecfa[_0x9481('0x15')]=_0x9481('0x44');break;case _0x9481('0x45'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x46');break;case'openchannelaccounts':_0x49ecfa[_0x9481('0x15')]='OpenchannelAccount';break;case _0x9481('0x47'):_0x49ecfa[_0x9481('0x15')]='SmsQueue';break;case'smsaccounts':_0x49ecfa[_0x9481('0x15')]=_0x9481('0x48');break;case _0x9481('0x49'):_0x49ecfa['childModel']=_0x9481('0x4a');break;case _0x9481('0x4b'):_0x49ecfa['childModel']='WhatsappAccount';break;case _0x9481('0x4c'):_0x49ecfa['childModel']=_0x9481('0x4d');break;case _0x9481('0x4e'):case _0x9481('0x4f'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x37');if(_0x2dc02e){_0x49ecfa['parentSections']=[{'name':_0x9481('0x50')},{'name':_0x9481('0x38')}];}break;case'users':case _0x9481('0x51'):case _0x9481('0x52'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x32');if(_0x2dc02e){_0x49ecfa[_0x9481('0x18')]=[{'name':_0x9481('0x53'),'filter':{'field':_0x9481('0x33'),'value':[_0x9481('0x54'),_0x9481('0x55')]},'ignore':!![]},{'name':'Agents'},{'name':_0x9481('0x56')}];}break;case'zendeskaccounts':_0x49ecfa['childModel']=_0x9481('0x57');break;case'salesforceaccounts':_0x49ecfa[_0x9481('0x15')]=_0x9481('0x58');break;case'freshdeskaccounts':_0x49ecfa[_0x9481('0x15')]=_0x9481('0x59');break;case _0x9481('0x5a'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x5b');break;case _0x9481('0x5c'):_0x49ecfa['childModel']='DeskAccount';break;case _0x9481('0x5d'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x5e');break;case _0x9481('0x5f'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x32');break;case _0x9481('0x60'):_0x49ecfa[_0x9481('0x15')]='CannedAnswer';break;case _0x9481('0x61'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x62');break;case _0x9481('0x63'):_0x49ecfa[_0x9481('0x15')]='Dashboard';break;case'intervals':_0x49ecfa[_0x9481('0x15')]=_0x9481('0x64');break;case _0x9481('0x65'):_0x49ecfa['childModel']='Pause';break;case'scheduler':_0x49ecfa['childModel']='Schedule';break;case'sounds':_0x49ecfa['childModel']=_0x9481('0x66');break;case _0x9481('0x67'):_0x49ecfa['childModel']=_0x9481('0x68');break;case'templates':_0x49ecfa[_0x9481('0x15')]=_0x9481('0x69');break;case _0x9481('0x6a'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x6b');break;case _0x9481('0x6c'):_0x49ecfa[_0x9481('0x15')]='Trunk';break;case _0x9481('0x6d'):_0x49ecfa[_0x9481('0x15')]='Variable';break;case _0x9481('0x6e'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x6f');break;case _0x9481('0x70'):_0x49ecfa[_0x9481('0x15')]='AnalyticExtractedReport';_0x49ecfa[_0x9481('0x18')]=[{'name':_0x9481('0x71'),'field':'id','foreignKey':_0x9481('0x72')}];break;case _0x9481('0x73'):_0x49ecfa[_0x9481('0x15')]=_0x9481('0x74');break;}return _0x49ecfa;}function _0x2927f5(_0x3ce09a,_0x2dfcb5){var _0x4e3379=_0x3ce09a['charAt'](0x0)['toUpperCase']()+_0x3ce09a[_0x9481('0x75')](0x1);var _0xc06b4d={'type':_0xfb4034['Sequelize'][_0x9481('0x76')][_0x9481('0x77')],'raw':!![]};return new Promise(function(_0x36fd7d,_0x189294){var _0x21ba74=squel[_0x9481('0x78')]()['field']('ui.'+_0x4e3379+_0x9481('0x79'),'id')[_0x9481('0x6')](_0x9481('0x7a'))[_0x9481('0x7b')](_0x9481('0x7c')+_0x3ce09a+_0x9481('0x7d'),'ui')['where']('ui.UserId\x20=\x20?',_0x2dfcb5['id']);return _0xfb4034[_0x9481('0x7e')]['query'](_0x21ba74[_0x9481('0x7f')](),_0xc06b4d)['then'](function(_0x9af916){_0x2dfcb5[_0x4e3379+_0x9481('0x80')]=_0x9af916;_0x36fd7d(_0x9af916);})[_0x9481('0xe')](function(_0x492464){_0x189294(_0x492464);});});}return _0x273a32[_0x9481('0x81')](_0x9481('0x82'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4ddc86){var _0x505c44={'raw':![],'where':{}};var _0x4b8d31={};var _0x68adeb={'count':0x0,'rows':[]};var _0x55276b=_0x4ddc86[_0x9481('0x83')][_0x9481('0x84')];var _0x35237b=_0x4ddc86['query'][_0x9481('0x85')]||![];var _0x5a8034=_0x352b3a(_0x55276b,_0x35237b);if(!_0x5a8034[_0x9481('0x15')])throw new Error(_0x9481('0x86')+_0x55276b+'\x27');var _0x3c267b=[{'name':_0x55276b}];if(!_['isEmpty'](_0x5a8034[_0x9481('0x18')]))_0x3c267b=_0x5a8034[_0x9481('0x18')];var _0x4ff016=[];for(var _0x321972=0x0;_0x321972<_0x3c267b[_0x9481('0x87')];_0x321972++){_0x4ff016[_0x9481('0x88')](_0xfb4034[_0x9481('0x89')][_0x9481('0x8a')]({'where':{'userProfileId':_0x4ddc86[_0x9481('0x8b')]['id'],'name':_0x3c267b[_0x321972][_0x9481('0xd')]},'raw':!![]}));}return Promise[_0x9481('0x8c')](_0x4ff016)[_0x9481('0xb')](function(_0x12abc6){var _0x237d9b=_[_0x9481('0x5')](_0x12abc6,function(_0x3daaff){return _0x3daaff?_0x3daaff:undefined;});var _0x3e32cb=_[_0x9481('0x5')](_0x3c267b,[_0x9481('0x8d'),!![]]);var _0x2b2ad1=_['isEmpty'](_0x237d9b)&&_[_0x9481('0x8e')](_0x3e32cb)?null:_['union'](_0x3e32cb,_0x237d9b);if(!_0x2b2ad1)return null;var _0x47bf37=[];for(var _0x1a7892=0x0;_0x1a7892<_0x2b2ad1['length'];_0x1a7892++){var _0x51133a=_['find'](_0x3c267b,function(_0x1b1967){return _0x2b2ad1[_0x1a7892]?_0x1b1967[_0x9481('0xd')]===_0x2b2ad1[_0x1a7892][_0x9481('0xd')]:null;});if(_0x51133a){if(_0x2b2ad1[_0x1a7892][_0x9481('0x8d')]){_0x47bf37['push'](_0x14dc10(_0x5a8034[_0x9481('0x15')],_0x2b2ad1[_0x1a7892]));}else{if(!_0x2b2ad1[_0x1a7892][_0x9481('0x8f')]){_0x47bf37[_0x9481('0x88')](_0x2266d5(_0x51133a,_0x2b2ad1[_0x1a7892],_0x5a8034[_0x9481('0x15')]));}else{if(_0x51133a['model']){_0x47bf37['push'](_0x2d5d0f(_0x51133a,_0x2b2ad1[_0x1a7892]));}}}}}return Promise[_0x9481('0x8c')](_0x47bf37);})[_0x9481('0xb')](function(_0x193992){var _0x380f2a=_0x193992;var _0xa49c1=null;if(_0x380f2a){_0xa49c1=_0x380f2a['length']===0x1?_0x380f2a[0x0]:null;}if(!_0xa49c1&&!_0x380f2a)return _0x68adeb;var _0xf84f12=_0xfb4034[_0x5a8034[_0x9481('0x15')]][_0x9481('0x90')];_0x4b8d31[_0x9481('0xa')]=_[_0x9481('0x91')](_0xf84f12);_0x4b8d31[_0x9481('0x83')]=_[_0x9481('0x91')](_0x4ddc86[_0x9481('0x83')]);_0x4b8d31[_0x9481('0x92')]=_[_0x9481('0x93')](_0x4b8d31[_0x9481('0xa')],_0x4b8d31[_0x9481('0x83')]);_0x505c44[_0x9481('0x94')]=_[_0x9481('0x93')](_0x4b8d31[_0x9481('0xa')],qs['fields'](_0x4ddc86[_0x9481('0x83')][_0x9481('0x95')]));_0x505c44[_0x9481('0x94')]=_0x505c44[_0x9481('0x94')][_0x9481('0x87')]?_0x505c44[_0x9481('0x94')]:_0x4b8d31[_0x9481('0xa')];if(!_0x4ddc86['query'][_0x9481('0x96')](_0x9481('0x97'))){_0x505c44['limit']=qs['limit'](_0x4ddc86[_0x9481('0x83')]['limit']);_0x505c44['offset']=qs[_0x9481('0x98')](_0x4ddc86['query'][_0x9481('0x98')]);}_0x505c44[_0x9481('0x99')]=qs[_0x9481('0x9a')](_0x4ddc86[_0x9481('0x83')]['sort']);_0x505c44[_0x9481('0x9b')]=qs['filters'](_[_0x9481('0x9c')](_0x4ddc86[_0x9481('0x83')],_0x4b8d31[_0x9481('0x92')]));if(_0x4ddc86['query']['filter']){_0x505c44['where']=_[_0x9481('0x9d')](_0x505c44['where'],{'$or':_['map'](_0xf84f12,function(_0xe43ae6){if(_0xe43ae6[_0x9481('0x11')][_0x9481('0x9e')]!=='VIRTUAL'){var _0x905ee6={};_0x905ee6[_0xe43ae6[_0x9481('0x6')]]={'$like':'%'+_0x4ddc86['query'][_0x9481('0x5')]+'%'};return _0x905ee6;}})});}var _0x3c8241=[];var _0x1ea93a=null;var _0x1e7ef4={};if(_0xa49c1){_0x1ea93a=_['find'](_0x3c267b,[_0x9481('0xd'),_0xa49c1['name']]);if(_0x1ea93a[_0x9481('0x6')]){_0x1e7ef4={};if(_0x5a8034[_0x9481('0x15')]==='AnalyticExtractedReport'){_0x1e7ef4[_0x1ea93a[_0x9481('0x9f')]]=_[_0x9481('0x9')](_0xa49c1[_0x9481('0xc')],'id');}else{_0x1e7ef4[_0x1ea93a['foreignKey']]=_0xa49c1['associatedResources'];}_0x3c8241[_0x9481('0x88')](_0x1e7ef4);}else{_0x505c44['where']['id']=_0xa49c1[_0x9481('0xc')];}}else{for(var _0x15d112=0x0;_0x15d112<_0x380f2a[_0x9481('0x87')];_0x15d112++){_0x1ea93a=_['find'](_0x3c267b,[_0x9481('0xd'),_0x380f2a[_0x15d112][_0x9481('0xd')]]);if(_0x1ea93a[_0x9481('0x6')]){_0x1e7ef4={};_0x1e7ef4[_0x1ea93a['foreignKey']]=_0x380f2a[_0x15d112][_0x9481('0xc')];_0x3c8241[_0x9481('0x88')](_0x1e7ef4);}else{if(!_0x505c44[_0x9481('0x9b')]['id'])_0x505c44[_0x9481('0x9b')]['id']=[];_0x380f2a[_0x15d112][_0x9481('0xc')][_0x9481('0xa0')](function(_0x25f284){_0x505c44[_0x9481('0x9b')]['id'][_0x9481('0x88')](_0x25f284);});}}}if(!_[_0x9481('0x8e')](_0x3c8241)){_0x505c44['where']=_[_0x9481('0x9d')](_0x505c44['where'],{'$and':{'$or':_0x3c8241}});}_0x505c44=_['merge']({},_0x505c44,_0x4ddc86['options']);if(_0xa49c1&&!_0xa49c1[_0x9481('0x8f')]&&_0x5a8034[_0x9481('0x15')]===_0x9481('0xa1')){if(_0x4ddc86[_0x9481('0x83')][_0x9481('0xa2')]){_0x505c44['include']=[{'all':!![]}];}return _0xfb4034[_0x5a8034[_0x9481('0x15')]][_0x9481('0x8')](_0x505c44)[_0x9481('0xb')](function(_0x455a85){var _0x27355e=[];_0x455a85[_0x9481('0xa0')](function(_0x1c50f1){var _0x1ab165;switch(_0x1c50f1[_0x9481('0xa3')]){case _0x9481('0xa4'):_0x1ab165=_['find'](_0xa49c1[_0x9481('0xc')],function(_0x1d49ba){return _0x1d49ba['id']===_0x1c50f1[_0x9481('0x72')]&&_0x1d49ba[_0x9481('0x11')]===_0x9481('0xa5');});break;case _0x9481('0xa6'):_0x1ab165=_[_0x9481('0x8a')](_0xa49c1[_0x9481('0xc')],function(_0x11f41e){return _0x11f41e['id']===_0x1c50f1[_0x9481('0x72')]&&_0x11f41e['type']===_0x9481('0xa7');});break;}if(_0x1ab165)_0x27355e[_0x9481('0x88')](_0x1c50f1);});_0x68adeb[_0x9481('0xa8')]=_0x27355e[_0x9481('0x87')];_0x68adeb[_0x9481('0xa9')]=_0x27355e;return _0x68adeb;});}else{return _0xfb4034[_0x5a8034[_0x9481('0x15')]][_0x9481('0xa8')]({'where':_0x505c44[_0x9481('0x9b')]})[_0x9481('0xb')](function(_0x538fe0){_0x68adeb[_0x9481('0xa8')]=_0x538fe0;if(_0x4ddc86['query']['includeAll']){if(_0x5a8034[_0x9481('0x15')]===_0x9481('0x1c')){_0x505c44[_0x9481('0xaa')]=[{'model':_0xfb4034[_0x9481('0x68')],'as':_0x9481('0xab'),'attributes':['id',_0x9481('0xd'),'color'],'required':_0x4ddc86[_0x9481('0x83')]['tag']?!![]:![]},{'model':_0xfb4034[_0x9481('0x68')],'as':_0x9481('0xac'),'attributes':['id',_0x9481('0xd'),'color'],'through':_0x4ddc86['query'][_0x9481('0xad')]?{'attributes':[],'where':{'TagId':_0x4ddc86[_0x9481('0x83')][_0x9481('0xad')]||undefined}}:{},'required':_0x4ddc86[_0x9481('0x83')][_0x9481('0xad')]?!![]:![]}];}else{_0x505c44[_0x9481('0xaa')]=[{'all':!![]}];}}return _0xfb4034[_0x5a8034[_0x9481('0x15')]][_0x9481('0x8')](_0x505c44);})[_0x9481('0xb')](function(_0x53013d){_0x68adeb[_0x9481('0xa9')]=_0x53013d;if(_0x55276b===_0x9481('0x30')&&_0x4ddc86['query'][_0x9481('0xae')]==='true'){var _0x616b77=[];for(var _0x1d84ea=0x0;_0x1d84ea<_0x68adeb['rows'][_0x9481('0x87')];_0x1d84ea++){_0x616b77[_0x9481('0x88')](_0x2927f5(_0x9481('0xaf'),_0x68adeb['rows'][_0x1d84ea][_0x9481('0xb0')]));_0x616b77[_0x9481('0x88')](_0x2927f5('sms',_0x68adeb[_0x9481('0xa9')][_0x1d84ea]['dataValues']));_0x616b77[_0x9481('0x88')](_0x2927f5(_0x9481('0xb1'),_0x68adeb[_0x9481('0xa9')][_0x1d84ea]['dataValues']));_0x616b77['push'](_0x2927f5(_0x9481('0xb2'),_0x68adeb[_0x9481('0xa9')][_0x1d84ea][_0x9481('0xb0')]));_0x616b77[_0x9481('0x88')](_0x2927f5(_0x9481('0xb3'),_0x68adeb[_0x9481('0xa9')][_0x1d84ea]['dataValues']));_0x616b77[_0x9481('0x88')](_0x2927f5(_0x9481('0xb4'),_0x68adeb[_0x9481('0xa9')][_0x1d84ea][_0x9481('0xb0')]));}return Promise[_0x9481('0x8c')](_0x616b77)[_0x9481('0xb')](function(){return _0x68adeb;});}return _0x68adeb;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 50bc747..904a223 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 _0x9e2e=['info','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then'];(function(_0x33bcdb,_0x11846b){var _0x18a9bf=function(_0x34417a){while(--_0x34417a){_0x33bcdb['push'](_0x33bcdb['shift']());}};_0x18a9bf(++_0x11846b);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x416208,_0x32e11e){_0x416208=_0x416208-0x0;var _0x1b43d6=_0x9e2e[_0x416208];return _0x1b43d6;};'use strict';var _=require(_0xe9e2('0x0'));var util=require(_0xe9e2('0x1'));var moment=require(_0xe9e2('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9e2('0x4'));var logger=require(_0xe9e2('0x5'))(_0xe9e2('0x6'));var config=require(_0xe9e2('0x7'));var jayson=require(_0xe9e2('0x8'));var client=jayson[_0xe9e2('0x9')][_0xe9e2('0xa')]({'port':0x232a});config['redis']=_[_0xe9e2('0xb')](config['redis'],{'host':_0xe9e2('0xc'),'port':0x18eb});var socket=require(_0xe9e2('0xd'))(new Redis(config['redis']));require(_0xe9e2('0xe'))[_0xe9e2('0xf')](socket);function respondWithRpcPromise(_0x5d065f,_0x20a3e9,_0xe1c4d3){return new BPromise(function(_0x56264f,_0x53e3c5){return client[_0xe9e2('0x10')](_0x5d065f,_0xe1c4d3)[_0xe9e2('0x11')](function(_0x2e02c8){logger[_0xe9e2('0x12')]('UserProfile,\x20%s,\x20%s',_0x20a3e9,'request\x20sent');logger[_0xe9e2('0x13')](_0xe9e2('0x14'),_0x20a3e9,_0xe9e2('0x15'),JSON[_0xe9e2('0x16')](_0x2e02c8));if(_0x2e02c8[_0xe9e2('0x17')]){if(_0x2e02c8[_0xe9e2('0x17')][_0xe9e2('0x18')]===0x1f4){logger[_0xe9e2('0x17')](_0xe9e2('0x19'),_0x20a3e9,_0x2e02c8[_0xe9e2('0x17')]['message']);return _0x53e3c5(_0x2e02c8['error'][_0xe9e2('0x1a')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x20a3e9,_0x2e02c8[_0xe9e2('0x17')][_0xe9e2('0x1a')]);return _0x56264f(_0x2e02c8[_0xe9e2('0x17')][_0xe9e2('0x1a')]);}else{logger[_0xe9e2('0x12')](_0xe9e2('0x19'),_0x20a3e9,'request\x20sent');_0x56264f(_0x2e02c8[_0xe9e2('0x1b')][_0xe9e2('0x1a')]);}})[_0xe9e2('0x1c')](function(_0x5b804f){logger[_0xe9e2('0x17')](_0xe9e2('0x19'),_0x20a3e9,_0x5b804f);_0x53e3c5(_0x5b804f);});});} \ No newline at end of file +var _0xc1d3=['jayson/promise','http','redis','defaults','localhost','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0xc1d3,0x147));var _0x3c1d=function(_0x1f8406,_0x54e1a7){_0x1f8406=_0x1f8406-0x0;var _0x1e9718=_0xc1d3[_0x1f8406];return _0x1e9718;};'use strict';var _=require(_0x3c1d('0x0'));var util=require(_0x3c1d('0x1'));var moment=require(_0x3c1d('0x2'));var BPromise=require(_0x3c1d('0x3'));var rs=require(_0x3c1d('0x4'));var fs=require('fs');var Redis=require(_0x3c1d('0x5'));var db=require(_0x3c1d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3c1d('0x7'));var config=require(_0x3c1d('0x8'));var jayson=require(_0x3c1d('0x9'));var client=jayson['client'][_0x3c1d('0xa')]({'port':0x232a});config[_0x3c1d('0xb')]=_[_0x3c1d('0xc')](config[_0x3c1d('0xb')],{'host':_0x3c1d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c1d('0xb')]));require(_0x3c1d('0xe'))[_0x3c1d('0xf')](socket);function respondWithRpcPromise(_0x417fbb,_0x255ea9,_0x11be8e){return new BPromise(function(_0x2974a3,_0x20458f){return client['request'](_0x417fbb,_0x11be8e)[_0x3c1d('0x10')](function(_0x1eaabc){logger[_0x3c1d('0x11')](_0x3c1d('0x12'),_0x255ea9,_0x3c1d('0x13'));logger['debug'](_0x3c1d('0x14'),_0x255ea9,_0x3c1d('0x13'),JSON['stringify'](_0x1eaabc));if(_0x1eaabc[_0x3c1d('0x15')]){if(_0x1eaabc['error']['code']===0x1f4){logger['error'](_0x3c1d('0x12'),_0x255ea9,_0x1eaabc[_0x3c1d('0x15')][_0x3c1d('0x16')]);return _0x20458f(_0x1eaabc[_0x3c1d('0x15')][_0x3c1d('0x16')]);}logger[_0x3c1d('0x15')]('UserProfile,\x20%s,\x20%s',_0x255ea9,_0x1eaabc['error'][_0x3c1d('0x16')]);return _0x2974a3(_0x1eaabc['error'][_0x3c1d('0x16')]);}else{logger[_0x3c1d('0x11')]('UserProfile,\x20%s,\x20%s',_0x255ea9,'request\x20sent');_0x2974a3(_0x1eaabc['result'][_0x3c1d('0x16')]);}})[_0x3c1d('0x17')](function(_0x14c64b){logger[_0x3c1d('0x15')](_0x3c1d('0x12'),_0x255ea9,_0x14c64b);_0x20458f(_0x14c64b);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 84e22b9..1d0e245 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 _0xa4a2=['remove','update','register','length','save'];(function(_0x1f48f5,_0xb9111a){var _0x2038e1=function(_0x3c6ccf){while(--_0x3c6ccf){_0x1f48f5['push'](_0x1f48f5['shift']());}};_0x2038e1(++_0xb9111a);}(_0xa4a2,0x9a));var _0x2a4a=function(_0x45dae8,_0x5c0982){_0x45dae8=_0x45dae8-0x0;var _0x51cd63=_0xa4a2[_0x45dae8];return _0x51cd63;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x2a4a('0x0'),_0x2a4a('0x1'),_0x2a4a('0x2')];function createListener(_0x4222f8,_0x2ccaf7){return function(_0x1dbb0e){_0x2ccaf7['emit'](_0x4222f8,_0x1dbb0e);};}function removeListener(_0x3a7694,_0x36c33e){return function(){UserProfileEvents['removeListener'](_0x3a7694,_0x36c33e);};}exports[_0x2a4a('0x3')]=function(_0x403593){for(var _0x46c0c6=0x0,_0x38f3a1=events[_0x2a4a('0x4')];_0x46c0c6<_0x38f3a1;_0x46c0c6++){var _0x5cb96d=events[_0x46c0c6];var _0x565247=createListener('userProfile:'+_0x5cb96d,_0x403593);UserProfileEvents['on'](_0x5cb96d,_0x565247);}}; \ No newline at end of file +var _0xa194=['removeListener','register','length','userProfile:','./userProfile.events','save','emit'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xa194,0x11c));var _0x4a19=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xa194[_0xbf8ebe];return _0x1e25e8;};'use strict';var UserProfileEvents=require(_0x4a19('0x0'));var events=[_0x4a19('0x1'),'remove','update'];function createListener(_0x5616fb,_0x5021c5){return function(_0x1ebee4){_0x5021c5[_0x4a19('0x2')](_0x5616fb,_0x1ebee4);};}function removeListener(_0x9276f5,_0x1ee28f){return function(){UserProfileEvents[_0x4a19('0x3')](_0x9276f5,_0x1ee28f);};}exports[_0x4a19('0x4')]=function(_0x13de00){for(var _0x5b502d=0x0,_0x3299b2=events[_0x4a19('0x5')];_0x5b502d<_0x3299b2;_0x5b502d++){var _0x5a1f4d=events[_0x5b502d];var _0x4486bb=createListener(_0x4a19('0x6')+_0x5a1f4d,_0x13de00);UserProfileEvents['on'](_0x5a1f4d,_0x4486bb);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 45a6fee..71f8582 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 _0xe638=['/describe','describe','/:id','show','post','create','put','update','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0xe638,0x144));var _0x8e63=function(_0x1502f5,_0x4cb98f){_0x1502f5=_0x1502f5-0x0;var _0x2ab33d=_0xe638[_0x1502f5];return _0x2ab33d;};'use strict';var multer=require('multer');var util=require(_0x8e63('0x0'));var path=require(_0x8e63('0x1'));var timeout=require(_0x8e63('0x2'));var express=require(_0x8e63('0x3'));var router=express['Router']();var fs_extra=require(_0x8e63('0x4'));var auth=require(_0x8e63('0x5'));var interaction=require(_0x8e63('0x6'));var config=require(_0x8e63('0x7'));var controller=require(_0x8e63('0x8'));router[_0x8e63('0x9')]('/',auth[_0x8e63('0xa')](),controller[_0x8e63('0xb')]);router['get'](_0x8e63('0xc'),auth[_0x8e63('0xa')](),controller[_0x8e63('0xd')]);router[_0x8e63('0x9')](_0x8e63('0xe'),auth['isAuthenticated'](),controller[_0x8e63('0xf')]);router[_0x8e63('0x10')]('/',auth[_0x8e63('0xa')](),controller[_0x8e63('0x11')]);router[_0x8e63('0x12')]('/:id',auth[_0x8e63('0xa')](),controller[_0x8e63('0x13')]);router['delete'](_0x8e63('0xe'),auth[_0x8e63('0xa')](),controller[_0x8e63('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa955=['post','put','update','delete','destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x24f870,_0x2c8a88){var _0x5d065b=function(_0x168247){while(--_0x168247){_0x24f870['push'](_0x24f870['shift']());}};_0x5d065b(++_0x2c8a88);}(_0xa955,0x7d));var _0x5a95=function(_0x54c71f,_0x5b07bd){_0x54c71f=_0x54c71f-0x0;var _0x5589bc=_0xa955[_0x54c71f];return _0x5589bc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5a95('0x0'));var express=require(_0x5a95('0x1'));var router=express[_0x5a95('0x2')]();var fs_extra=require(_0x5a95('0x3'));var auth=require(_0x5a95('0x4'));var interaction=require(_0x5a95('0x5'));var config=require(_0x5a95('0x6'));var controller=require(_0x5a95('0x7'));router['get']('/',auth[_0x5a95('0x8')](),controller[_0x5a95('0x9')]);router[_0x5a95('0xa')](_0x5a95('0xb'),auth[_0x5a95('0x8')](),controller[_0x5a95('0xc')]);router[_0x5a95('0xa')](_0x5a95('0xd'),auth[_0x5a95('0x8')](),controller[_0x5a95('0xe')]);router[_0x5a95('0xf')]('/',auth[_0x5a95('0x8')](),controller['create']);router[_0x5a95('0x10')](_0x5a95('0xd'),auth[_0x5a95('0x8')](),controller[_0x5a95('0x11')]);router[_0x5a95('0x12')](_0x5a95('0xd'),auth[_0x5a95('0x8')](),controller[_0x5a95('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 7a4034f..3805b37 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 _0x1dab=['INTEGER','sequelize','STRING'];(function(_0x3e5971,_0x51577f){var _0xf04603=function(_0x5415df){while(--_0x5415df){_0x3e5971['push'](_0x3e5971['shift']());}};_0xf04603(++_0x51577f);}(_0x1dab,0xd9));var _0xb1da=function(_0x3cba1d,_0x2825ae){_0x3cba1d=_0x3cba1d-0x0;var _0x5f192b=_0x1dab[_0x3cba1d];return _0x5f192b;};'use strict';var Sequelize=require(_0xb1da('0x0'));module['exports']={'name':{'type':Sequelize[_0xb1da('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb1da('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb1da('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x91a0=['STRING','sequelize','exports'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x91a0,0x1b1));var _0x091a=function(_0x465aa9,_0x1bf1c8){_0x465aa9=_0x465aa9-0x0;var _0x4104e4=_0x91a0[_0x465aa9];return _0x4104e4;};'use strict';var Sequelize=require(_0x091a('0x0'));module[_0x091a('0x1')]={'name':{'type':Sequelize[_0x091a('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x091a('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index b897403..1d933e2 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 _0x90b1=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','UserProfileResource','includeAll','rows','include','find','catch','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters'];(function(_0x1a902c,_0x5d40aa){var _0x1711e6=function(_0xeb98f7){while(--_0xeb98f7){_0x1a902c['push'](_0x1a902c['shift']());}};_0x1711e6(++_0x5d40aa);}(_0x90b1,0x1bb));var _0x190b=function(_0x2ca55e,_0x280c31){_0x2ca55e=_0x2ca55e-0x0;var _0x3c7753=_0x90b1[_0x2ca55e];return _0x3c7753;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['UserProfileResource'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['create']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['create'](_0x1f2262[_0x190b('0x43')],{})[_0x190b('0x22')](respondWithResult(_0xadc789,0xc9))[_0x190b('0x42')](handleError(_0xadc789,null));};exports['update']=function(_0x4cb561,_0x14958e){if(_0x4cb561[_0x190b('0x43')]['id']){delete _0x4cb561[_0x190b('0x43')]['id'];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'id':_0x4cb561[_0x190b('0x44')]['id']}})['then'](handleEntityNotFound(_0x14958e,null))[_0x190b('0x22')](saveUpdates(_0x4cb561[_0x190b('0x43')],null))[_0x190b('0x22')](respondWithResult(_0x14958e,null))['catch'](handleError(_0x14958e,null));};exports[_0x190b('0x23')]=function(_0x38c135,_0x215ab6){return db['UserProfileResource'][_0x190b('0x41')]({'where':{'id':_0x38c135[_0x190b('0x44')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x215ab6,null))[_0x190b('0x22')](removeEntity(_0x215ab6,null))[_0x190b('0x42')](handleError(_0x215ab6,null));};exports[_0x190b('0x45')]=function(_0x33cc78,_0x2ea1c8){return db[_0x190b('0x3d')][_0x190b('0x45')]()[_0x190b('0x22')](respondWithResult(_0x2ea1c8,null))['catch'](handleError(_0x2ea1c8,null));}; \ No newline at end of file +var _0x47c5=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model'];(function(_0xeeb808,_0x58fd94){var _0x588723=function(_0x3a2e34){while(--_0x3a2e34){_0xeeb808['push'](_0xeeb808['shift']());}};_0x588723(++_0x58fd94);}(_0x47c5,0x165));var _0x547c=function(_0x3b2be3,_0x3e602d){_0x3b2be3=_0x3b2be3-0x0;var _0x511b35=_0x47c5[_0x3b2be3];return _0x511b35;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['UserProfileResource'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['UserProfileResource']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['UserProfileResource'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['UserProfileResource'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));};exports['describe']=function(_0x152982,_0x5258cf){return db[_0x547c('0x2f')][_0x547c('0x51')]()[_0x547c('0x2a')](respondWithResult(_0x5258cf,null))['catch'](handleError(_0x5258cf,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index ef7b1d9..1b491b6 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 _0x7b79=['path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','compositeIndex','resourceId','sectionId','util','../../config/logger','api','moment','request-promise'];(function(_0x1afea4,_0x106601){var _0x3df48a=function(_0x597a7a){while(--_0x597a7a){_0x1afea4['push'](_0x1afea4['shift']());}};_0x3df48a(++_0x106601);}(_0x7b79,0xcd));var _0x97b7=function(_0x5b2a50,_0x4d327f){_0x5b2a50=_0x5b2a50-0x0;var _0x12bff8=_0x7b79[_0x5b2a50];return _0x12bff8;};'use strict';var _=require('lodash');var util=require(_0x97b7('0x0'));var logger=require(_0x97b7('0x1'))(_0x97b7('0x2'));var moment=require(_0x97b7('0x3'));var BPromise=require('bluebird');var rp=require(_0x97b7('0x4'));var fs=require('fs');var path=require(_0x97b7('0x5'));var rimraf=require(_0x97b7('0x6'));var config=require(_0x97b7('0x7'));var attributes=require(_0x97b7('0x8'));module[_0x97b7('0x9')]=function(_0x18cb5c,_0x191d7c){return _0x18cb5c['define'](_0x97b7('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x97b7('0xb'),'fields':[_0x97b7('0xc'),_0x97b7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b92=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId'];(function(_0x2534a6,_0x1ac6d6){var _0x517d99=function(_0x4258ca){while(--_0x4258ca){_0x2534a6['push'](_0x2534a6['shift']());}};_0x517d99(++_0x1ac6d6);}(_0x7b92,0x142));var _0x27b9=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0x7b92[_0x5235a6];return _0x1cf37e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x27b9('0x0'))(_0x27b9('0x1'));var moment=require(_0x27b9('0x2'));var BPromise=require(_0x27b9('0x3'));var rp=require(_0x27b9('0x4'));var fs=require('fs');var path=require(_0x27b9('0x5'));var rimraf=require(_0x27b9('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0x27b9('0x7')]=function(_0x3dfb11,_0x42d5ed){return _0x3dfb11[_0x27b9('0x8')](_0x27b9('0x9'),attributes,{'tableName':_0x27b9('0xa'),'paranoid':![],'indexes':[{'name':_0x27b9('0xb'),'fields':[_0x27b9('0xc'),_0x27b9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index ed6cb1e..6680a71 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 _0x9f8b=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x24222e,_0x30946){var _0x44fe67=function(_0x35d921){while(--_0x35d921){_0x24222e['push'](_0x24222e['shift']());}};_0x44fe67(++_0x30946);}(_0x9f8b,0x1f3));var _0xb9f8=function(_0x40b687,_0x3d93e3){_0x40b687=_0x40b687-0x0;var _0x1a32fa=_0x9f8b[_0x40b687];return _0x1a32fa;};'use strict';var _=require(_0xb9f8('0x0'));var util=require(_0xb9f8('0x1'));var moment=require('moment');var BPromise=require(_0xb9f8('0x2'));var rs=require(_0xb9f8('0x3'));var fs=require('fs');var Redis=require(_0xb9f8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9f8('0x5'));var logger=require(_0xb9f8('0x6'))('rpc');var config=require(_0xb9f8('0x7'));var jayson=require(_0xb9f8('0x8'));var client=jayson[_0xb9f8('0x9')][_0xb9f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x132327,_0x56f78f,_0x80d9ab){return new BPromise(function(_0x425135,_0x31af41){return client[_0xb9f8('0xb')](_0x132327,_0x80d9ab)[_0xb9f8('0xc')](function(_0x3699fc){logger[_0xb9f8('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x56f78f,_0xb9f8('0xe'));logger[_0xb9f8('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x56f78f,'request\x20sent',JSON[_0xb9f8('0x10')](_0x3699fc));if(_0x3699fc[_0xb9f8('0x11')]){if(_0x3699fc['error'][_0xb9f8('0x12')]===0x1f4){logger[_0xb9f8('0x11')](_0xb9f8('0x13'),_0x56f78f,_0x3699fc[_0xb9f8('0x11')][_0xb9f8('0x14')]);return _0x31af41(_0x3699fc[_0xb9f8('0x11')][_0xb9f8('0x14')]);}logger['error'](_0xb9f8('0x13'),_0x56f78f,_0x3699fc[_0xb9f8('0x11')][_0xb9f8('0x14')]);return _0x425135(_0x3699fc[_0xb9f8('0x11')][_0xb9f8('0x14')]);}else{logger[_0xb9f8('0xd')](_0xb9f8('0x13'),_0x56f78f,_0xb9f8('0xe'));_0x425135(_0x3699fc[_0xb9f8('0x15')][_0xb9f8('0x14')]);}})[_0xb9f8('0x16')](function(_0x27bc72){logger[_0xb9f8('0x11')](_0xb9f8('0x13'),_0x56f78f,_0x27bc72);_0x31af41(_0x27bc72);});});} \ No newline at end of file +var _0x723c=['message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3231da,_0x3ae101){var _0x256829=function(_0x57e2d7){while(--_0x57e2d7){_0x3231da['push'](_0x3231da['shift']());}};_0x256829(++_0x3ae101);}(_0x723c,0x121));var _0xc723=function(_0x9a5088,_0x2d997e){_0x9a5088=_0x9a5088-0x0;var _0x3a6f89=_0x723c[_0x9a5088];return _0x3a6f89;};'use strict';var _=require(_0xc723('0x0'));var util=require(_0xc723('0x1'));var moment=require(_0xc723('0x2'));var BPromise=require(_0xc723('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc723('0x4'))['db'];var utils=require(_0xc723('0x5'));var logger=require(_0xc723('0x6'))(_0xc723('0x7'));var config=require(_0xc723('0x8'));var jayson=require(_0xc723('0x9'));var client=jayson[_0xc723('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fb097,_0x975cc7,_0x46478c){return new BPromise(function(_0x7c2c83,_0x430747){return client['request'](_0x2fb097,_0x46478c)['then'](function(_0x5eb8a5){logger[_0xc723('0xb')](_0xc723('0xc'),_0x975cc7,_0xc723('0xd'));logger[_0xc723('0xe')](_0xc723('0xf'),_0x975cc7,_0xc723('0xd'),JSON[_0xc723('0x10')](_0x5eb8a5));if(_0x5eb8a5[_0xc723('0x11')]){if(_0x5eb8a5[_0xc723('0x11')][_0xc723('0x12')]===0x1f4){logger['error'](_0xc723('0xc'),_0x975cc7,_0x5eb8a5['error'][_0xc723('0x13')]);return _0x430747(_0x5eb8a5['error'][_0xc723('0x13')]);}logger[_0xc723('0x11')](_0xc723('0xc'),_0x975cc7,_0x5eb8a5[_0xc723('0x11')][_0xc723('0x13')]);return _0x7c2c83(_0x5eb8a5['error'][_0xc723('0x13')]);}else{logger[_0xc723('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x975cc7,'request\x20sent');_0x7c2c83(_0x5eb8a5[_0xc723('0x14')][_0xc723('0x13')]);}})[_0xc723('0x15')](function(_0x1967af){logger[_0xc723('0x11')](_0xc723('0xc'),_0x975cc7,_0x1967af);_0x430747(_0x1967af);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 8ee9d18..5de9911 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 _0xea29=['exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0xea29,0x1ba));var _0x9ea2=function(_0x513f27,_0x1cbc87){_0x513f27=_0x513f27-0x0;var _0xa316b7=_0xea29[_0x513f27];return _0xa316b7;};'use strict';var multer=require('multer');var util=require(_0x9ea2('0x0'));var path=require(_0x9ea2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9ea2('0x2'));var auth=require(_0x9ea2('0x3'));var interaction=require(_0x9ea2('0x4'));var config=require(_0x9ea2('0x5'));var controller=require(_0x9ea2('0x6'));router[_0x9ea2('0x7')]('/',auth[_0x9ea2('0x8')](),controller[_0x9ea2('0x9')]);router[_0x9ea2('0x7')](_0x9ea2('0xa'),auth[_0x9ea2('0x8')](),controller[_0x9ea2('0xb')]);router['get'](_0x9ea2('0xc'),auth[_0x9ea2('0x8')](),controller[_0x9ea2('0xd')]);router[_0x9ea2('0xe')]('/',auth[_0x9ea2('0x8')](),controller[_0x9ea2('0xf')]);router[_0x9ea2('0x10')](_0x9ea2('0xc'),auth['isAuthenticated'](),controller[_0x9ea2('0x11')]);router[_0x9ea2('0x12')]('/:id',auth[_0x9ea2('0x8')](),controller[_0x9ea2('0x13')]);module[_0x9ea2('0x14')]=router; \ No newline at end of file +var _0xfde3=['get','/:id','show','put','update','delete','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','describe'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xfde3,0xf4));var _0x3fde=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xfde3[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x3fde('0x0'));var util=require(_0x3fde('0x1'));var path=require(_0x3fde('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3fde('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3fde('0x4'));var interaction=require(_0x3fde('0x5'));var config=require(_0x3fde('0x6'));var controller=require(_0x3fde('0x7'));router['get']('/',auth[_0x3fde('0x8')](),controller[_0x3fde('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x3fde('0xa')]);router[_0x3fde('0xb')](_0x3fde('0xc'),auth['isAuthenticated'](),controller[_0x3fde('0xd')]);router['post']('/',auth[_0x3fde('0x8')](),controller['create']);router[_0x3fde('0xe')](_0x3fde('0xc'),auth[_0x3fde('0x8')](),controller[_0x3fde('0xf')]);router[_0x3fde('0x10')]('/:id',auth[_0x3fde('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index a2d8d8b..86784a8 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 _0x1775=['INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','exports','STRING'];(function(_0x238dd5,_0x5bb9cf){var _0x3ae0ab=function(_0x29be10){while(--_0x29be10){_0x238dd5['push'](_0x238dd5['shift']());}};_0x3ae0ab(++_0x5bb9cf);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0x5177('0x0')]={'name':{'type':Sequelize[_0x5177('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x5177('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5177('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5177('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5177('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5177('0x1')],'set':function(_0x2027bf){this[_0x5177('0x4')](_0x5177('0x5'),_0x2027bf?_0x2027bf[_0x5177('0x6')](''):[]);},'get':function(){return this[_0x5177('0x7')](_0x5177('0x5'))?this[_0x5177('0x7')](_0x5177('0x5'))[_0x5177('0x8')](''):[];}}}; \ No newline at end of file +var _0x5423=['getDataValue','crudPermissions','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','join'];(function(_0x53e838,_0x4ee338){var _0x30d1e0=function(_0x35b0cc){while(--_0x35b0cc){_0x53e838['push'](_0x53e838['shift']());}};_0x30d1e0(++_0x4ee338);}(_0x5423,0xe3));var _0x3542=function(_0x44ea5b,_0x2a2855){_0x44ea5b=_0x44ea5b-0x0;var _0x31ca36=_0x5423[_0x44ea5b];return _0x31ca36;};'use strict';var Sequelize=require(_0x3542('0x0'));module[_0x3542('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x3542('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3542('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3542('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x3542('0x2')],'set':function(_0xf0835){this[_0x3542('0x5')]('crudPermissions',_0xf0835?_0xf0835[_0x3542('0x6')](''):[]);},'get':function(){return this[_0x3542('0x7')](_0x3542('0x8'))?this[_0x3542('0x7')](_0x3542('0x8'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index d2af7cd..50fadd3 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 _0x6eec=['keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','UserProfileSection','rows','catch','show','params','length','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','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','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query'];(function(_0x4bbbc0,_0x532cde){var _0x4b0977=function(_0x100c74){while(--_0x100c74){_0x4bbbc0['push'](_0x4bbbc0['shift']());}};_0x4b0977(++_0x532cde);}(_0x6eec,0x152));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc6ee('0x0'));var rimraf=require(_0xc6ee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6ee('0x2'));var rp=require(_0xc6ee('0x3'));var moment=require(_0xc6ee('0x4'));var BPromise=require(_0xc6ee('0x5'));var Mustache=require(_0xc6ee('0x6'));var util=require('util');var path=require(_0xc6ee('0x7'));var sox=require(_0xc6ee('0x8'));var csv=require('to-csv');var ejs=require(_0xc6ee('0x9'));var fs=require('fs');var fs_extra=require(_0xc6ee('0xa'));var _=require('lodash');var squel=require(_0xc6ee('0xb'));var crypto=require(_0xc6ee('0xc'));var jsforce=require(_0xc6ee('0xd'));var deskjs=require(_0xc6ee('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc6ee('0xf'));var Papa=require(_0xc6ee('0x10'));var Redis=require(_0xc6ee('0x11'));var authService=require(_0xc6ee('0x12'));var qs=require(_0xc6ee('0x13'));var as=require(_0xc6ee('0x14'));var hardwareService=require(_0xc6ee('0x15'));var logger=require('../../config/logger')(_0xc6ee('0x16'));var utils=require(_0xc6ee('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc6ee('0x18'))['db'];function respondWithStatusCode(_0x495e75,_0xfb6e12){_0xfb6e12=_0xfb6e12||0xcc;return function(_0x3f2f58){if(_0x3f2f58){return _0x495e75['sendStatus'](_0xfb6e12);}return _0x495e75['status'](_0xfb6e12)['end']();};}function respondWithResult(_0x5859d6,_0x54c9fb){_0x54c9fb=_0x54c9fb||0xc8;return function(_0x32ff1f){if(_0x32ff1f){return _0x5859d6[_0xc6ee('0x19')](_0x54c9fb)['json'](_0x32ff1f);}};}function respondWithFilteredResult(_0x40298d,_0x104e61){return function(_0x34b0cd){if(_0x34b0cd){var _0x4d0fc0=typeof _0x104e61[_0xc6ee('0x1a')]===_0xc6ee('0x1b')&&typeof _0x104e61[_0xc6ee('0x1c')]===_0xc6ee('0x1b');var _0x315a9f=_0x34b0cd[_0xc6ee('0x1d')];var _0x571a6c=_0x4d0fc0?0x0:_0x104e61['offset'];var _0x47253b=_0x4d0fc0?_0x34b0cd[_0xc6ee('0x1d')]:_0x104e61[_0xc6ee('0x1a')]+_0x104e61[_0xc6ee('0x1c')];var _0x1e8f7d;if(_0x47253b>=_0x315a9f){_0x47253b=_0x315a9f;_0x1e8f7d=0xc8;}else{_0x1e8f7d=0xce;}_0x40298d['status'](_0x1e8f7d);return _0x40298d[_0xc6ee('0x1e')](_0xc6ee('0x1f'),_0x571a6c+'-'+_0x47253b+'/'+_0x315a9f)[_0xc6ee('0x20')](_0x34b0cd);}return null;};}function patchUpdates(_0x1ba66d){return function(_0x51cc8b){try{jsonpatch[_0xc6ee('0x21')](_0x51cc8b,_0x1ba66d,!![]);}catch(_0x13e40e){return BPromise[_0xc6ee('0x22')](_0x13e40e);}return _0x51cc8b[_0xc6ee('0x23')]();};}function saveUpdates(_0x17865d,_0x2854){return function(_0x56915c){if(_0x56915c){return _0x56915c[_0xc6ee('0x24')](_0x17865d)['then'](function(_0x4ef71a){return _0x4ef71a;});}return null;};}function removeEntity(_0x5b07de,_0x384bea){return function(_0x1b7a39){if(_0x1b7a39){return _0x1b7a39[_0xc6ee('0x25')]()[_0xc6ee('0x26')](function(){_0x5b07de[_0xc6ee('0x19')](0xcc)[_0xc6ee('0x27')]();});}};}function handleEntityNotFound(_0x5e8f22,_0x5bbed7){return function(_0x310140){if(!_0x310140){_0x5e8f22[_0xc6ee('0x28')](0x194);}return _0x310140;};}function handleError(_0x42a08c,_0x4f4832){_0x4f4832=_0x4f4832||0x1f4;return function(_0xf5743d){logger[_0xc6ee('0x29')](_0xf5743d[_0xc6ee('0x2a')]);if(_0xf5743d[_0xc6ee('0x2b')]){delete _0xf5743d['name'];}_0x42a08c[_0xc6ee('0x19')](_0x4f4832)[_0xc6ee('0x2c')](_0xf5743d);};}exports[_0xc6ee('0x2d')]=function(_0x5899d7,_0x37d321){var _0xd303d9={},_0x652106={},_0x463768={'count':0x0,'rows':[]};var _0x4088b2=_[_0xc6ee('0x2e')](db['UserProfileSection'][_0xc6ee('0x2f')],function(_0x5ac423){return{'name':_0x5ac423['fieldName'],'type':_0x5ac423[_0xc6ee('0x30')][_0xc6ee('0x31')]};});_0x652106[_0xc6ee('0x32')]=_[_0xc6ee('0x2e')](_0x4088b2,_0xc6ee('0x2b'));_0x652106[_0xc6ee('0x33')]=_[_0xc6ee('0x34')](_0x5899d7[_0xc6ee('0x33')]);_0x652106['filters']=_[_0xc6ee('0x35')](_0x652106[_0xc6ee('0x32')],_0x652106[_0xc6ee('0x33')]);_0xd303d9[_0xc6ee('0x36')]=_[_0xc6ee('0x35')](_0x652106[_0xc6ee('0x32')],qs[_0xc6ee('0x37')](_0x5899d7[_0xc6ee('0x33')][_0xc6ee('0x37')]));_0xd303d9[_0xc6ee('0x36')]=_0xd303d9['attributes']['length']?_0xd303d9['attributes']:_0x652106[_0xc6ee('0x32')];if(!_0x5899d7['query'][_0xc6ee('0x38')](_0xc6ee('0x39'))){_0xd303d9[_0xc6ee('0x1c')]=qs[_0xc6ee('0x1c')](_0x5899d7[_0xc6ee('0x33')][_0xc6ee('0x1c')]);_0xd303d9[_0xc6ee('0x1a')]=qs[_0xc6ee('0x1a')](_0x5899d7['query']['offset']);}_0xd303d9['order']=qs['sort'](_0x5899d7[_0xc6ee('0x33')][_0xc6ee('0x3a')]);_0xd303d9[_0xc6ee('0x3b')]=qs[_0xc6ee('0x3c')](_[_0xc6ee('0x3d')](_0x5899d7[_0xc6ee('0x33')],_0x652106[_0xc6ee('0x3c')]),_0x4088b2);if(_0x5899d7[_0xc6ee('0x33')]['filter']){_0xd303d9[_0xc6ee('0x3b')]=_[_0xc6ee('0x3e')](_0xd303d9['where'],{'$or':_[_0xc6ee('0x2e')](_0x4088b2,function(_0x1101ab){if(_0x1101ab['type']!==_0xc6ee('0x3f')){var _0x5ba781={};_0x5ba781[_0x1101ab[_0xc6ee('0x2b')]]={'$like':'%'+_0x5899d7[_0xc6ee('0x33')][_0xc6ee('0x40')]+'%'};return _0x5ba781;}})});}_0xd303d9=_[_0xc6ee('0x3e')]({},_0xd303d9,_0x5899d7[_0xc6ee('0x41')]);var _0x3c3d3b={'where':_0xd303d9[_0xc6ee('0x3b')]};return db['UserProfileSection'][_0xc6ee('0x1d')](_0x3c3d3b)[_0xc6ee('0x26')](function(_0x188d88){_0x463768[_0xc6ee('0x1d')]=_0x188d88;if(_0x5899d7[_0xc6ee('0x33')][_0xc6ee('0x42')]){_0xd303d9[_0xc6ee('0x43')]=[{'all':!![]}];}return db[_0xc6ee('0x44')]['findAll'](_0xd303d9);})[_0xc6ee('0x26')](function(_0x4ba0f4){_0x463768[_0xc6ee('0x45')]=_0x4ba0f4;return _0x463768;})[_0xc6ee('0x26')](respondWithFilteredResult(_0x37d321,_0xd303d9))[_0xc6ee('0x46')](handleError(_0x37d321,null));};exports[_0xc6ee('0x47')]=function(_0xdca5ed,_0x5a6035){var _0x393f4b={'raw':![],'where':{'id':_0xdca5ed[_0xc6ee('0x48')]['id']}},_0x3c9e78={};_0x3c9e78[_0xc6ee('0x32')]=_['keys'](db['UserProfileSection'][_0xc6ee('0x2f')]);_0x3c9e78[_0xc6ee('0x33')]=_[_0xc6ee('0x34')](_0xdca5ed[_0xc6ee('0x33')]);_0x3c9e78[_0xc6ee('0x3c')]=_[_0xc6ee('0x35')](_0x3c9e78[_0xc6ee('0x32')],_0x3c9e78[_0xc6ee('0x33')]);_0x393f4b[_0xc6ee('0x36')]=_[_0xc6ee('0x35')](_0x3c9e78['model'],qs[_0xc6ee('0x37')](_0xdca5ed[_0xc6ee('0x33')][_0xc6ee('0x37')]));_0x393f4b['attributes']=_0x393f4b[_0xc6ee('0x36')][_0xc6ee('0x49')]?_0x393f4b[_0xc6ee('0x36')]:_0x3c9e78['model'];if(_0xdca5ed[_0xc6ee('0x33')][_0xc6ee('0x42')]){_0x393f4b[_0xc6ee('0x43')]=[{'all':!![]}];}_0x393f4b=_[_0xc6ee('0x3e')]({},_0x393f4b,_0xdca5ed[_0xc6ee('0x41')]);return db[_0xc6ee('0x44')]['find'](_0x393f4b)['then'](handleEntityNotFound(_0x5a6035,null))[_0xc6ee('0x26')](respondWithResult(_0x5a6035,null))[_0xc6ee('0x46')](handleError(_0x5a6035,null));};exports['create']=function(_0x109209,_0x3ade76){return db['UserProfileSection'][_0xc6ee('0x4a')](_0x109209[_0xc6ee('0x4b')],{})['then'](respondWithResult(_0x3ade76,0xc9))[_0xc6ee('0x46')](handleError(_0x3ade76,null));};exports[_0xc6ee('0x24')]=function(_0x1de409,_0x4ffcc8){if(_0x1de409[_0xc6ee('0x4b')]['id']){delete _0x1de409['body']['id'];}return db[_0xc6ee('0x44')][_0xc6ee('0x4c')]({'where':{'id':_0x1de409['params']['id']}})[_0xc6ee('0x26')](handleEntityNotFound(_0x4ffcc8,null))[_0xc6ee('0x26')](saveUpdates(_0x1de409[_0xc6ee('0x4b')],null))[_0xc6ee('0x26')](respondWithResult(_0x4ffcc8,null))[_0xc6ee('0x46')](handleError(_0x4ffcc8,null));};exports[_0xc6ee('0x25')]=function(_0x2ae1a9,_0x4d3312){return db[_0xc6ee('0x44')][_0xc6ee('0x4c')]({'where':{'id':_0x2ae1a9[_0xc6ee('0x48')]['id']}})[_0xc6ee('0x26')](handleEntityNotFound(_0x4d3312,null))[_0xc6ee('0x26')](removeEntity(_0x4d3312,null))['catch'](handleError(_0x4d3312,null));};exports[_0xc6ee('0x4d')]=function(_0x35b754,_0x315bfa){return db[_0xc6ee('0x44')][_0xc6ee('0x4d')]()['then'](respondWithResult(_0x315bfa,null))[_0xc6ee('0x46')](handleError(_0x315bfa,null));}; \ No newline at end of file +var _0x96e0=['stack','name','send','map','UserProfileSection','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','error'];(function(_0x1a9142,_0x5539e6){var _0x3f14f6=function(_0x399e79){while(--_0x399e79){_0x1a9142['push'](_0x1a9142['shift']());}};_0x3f14f6(++_0x5539e6);}(_0x96e0,0x1df));var _0x096e=function(_0x11ba83,_0x46758c){_0x11ba83=_0x11ba83-0x0;var _0x1a379b=_0x96e0[_0x11ba83];return _0x1a379b;};'use strict';var emlformat=require(_0x096e('0x0'));var rimraf=require(_0x096e('0x1'));var zipdir=require(_0x096e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x096e('0x3'));var moment=require(_0x096e('0x4'));var BPromise=require(_0x096e('0x5'));var Mustache=require('mustache');var util=require(_0x096e('0x6'));var path=require(_0x096e('0x7'));var sox=require(_0x096e('0x8'));var csv=require(_0x096e('0x9'));var ejs=require(_0x096e('0xa'));var fs=require('fs');var fs_extra=require(_0x096e('0xb'));var _=require(_0x096e('0xc'));var squel=require(_0x096e('0xd'));var crypto=require(_0x096e('0xe'));var jsforce=require(_0x096e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x096e('0x9'));var querystring=require('querystring');var Papa=require(_0x096e('0x10'));var Redis=require(_0x096e('0x11'));var authService=require(_0x096e('0x12'));var qs=require(_0x096e('0x13'));var as=require(_0x096e('0x14'));var hardwareService=require(_0x096e('0x15'));var logger=require(_0x096e('0x16'))(_0x096e('0x17'));var utils=require(_0x096e('0x18'));var config=require(_0x096e('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x272e26,_0x1f3d0f){_0x1f3d0f=_0x1f3d0f||0xcc;return function(_0x5c1c65){if(_0x5c1c65){return _0x272e26[_0x096e('0x1a')](_0x1f3d0f);}return _0x272e26['status'](_0x1f3d0f)[_0x096e('0x1b')]();};}function respondWithResult(_0x512619,_0xe17369){_0xe17369=_0xe17369||0xc8;return function(_0x4d479d){if(_0x4d479d){return _0x512619[_0x096e('0x1c')](_0xe17369)[_0x096e('0x1d')](_0x4d479d);}};}function respondWithFilteredResult(_0x10506c,_0xc470f0){return function(_0x5b1ab9){if(_0x5b1ab9){var _0x5aca45=typeof _0xc470f0[_0x096e('0x1e')]===_0x096e('0x1f')&&typeof _0xc470f0[_0x096e('0x20')]==='undefined';var _0x4c28dd=_0x5b1ab9[_0x096e('0x21')];var _0xa42f77=_0x5aca45?0x0:_0xc470f0[_0x096e('0x1e')];var _0x34a682=_0x5aca45?_0x5b1ab9[_0x096e('0x21')]:_0xc470f0[_0x096e('0x1e')]+_0xc470f0[_0x096e('0x20')];var _0x3fde2c;if(_0x34a682>=_0x4c28dd){_0x34a682=_0x4c28dd;_0x3fde2c=0xc8;}else{_0x3fde2c=0xce;}_0x10506c[_0x096e('0x1c')](_0x3fde2c);return _0x10506c[_0x096e('0x22')](_0x096e('0x23'),_0xa42f77+'-'+_0x34a682+'/'+_0x4c28dd)[_0x096e('0x1d')](_0x5b1ab9);}return null;};}function patchUpdates(_0x396694){return function(_0x431616){try{jsonpatch[_0x096e('0x24')](_0x431616,_0x396694,!![]);}catch(_0x1474b7){return BPromise[_0x096e('0x25')](_0x1474b7);}return _0x431616['save']();};}function saveUpdates(_0x19a4f3,_0x3ca223){return function(_0xcb9ea4){if(_0xcb9ea4){return _0xcb9ea4['update'](_0x19a4f3)['then'](function(_0x4a0807){return _0x4a0807;});}return null;};}function removeEntity(_0x34b26e,_0x91055f){return function(_0x132a25){if(_0x132a25){return _0x132a25['destroy']()['then'](function(){_0x34b26e[_0x096e('0x1c')](0xcc)[_0x096e('0x1b')]();});}};}function handleEntityNotFound(_0x2af9f4,_0x44a8b9){return function(_0x3d4999){if(!_0x3d4999){_0x2af9f4[_0x096e('0x1a')](0x194);}return _0x3d4999;};}function handleError(_0x306c5a,_0x37096a){_0x37096a=_0x37096a||0x1f4;return function(_0x9772aa){logger[_0x096e('0x26')](_0x9772aa[_0x096e('0x27')]);if(_0x9772aa['name']){delete _0x9772aa[_0x096e('0x28')];}_0x306c5a[_0x096e('0x1c')](_0x37096a)[_0x096e('0x29')](_0x9772aa);};}exports['index']=function(_0x2055a0,_0x442ae0){var _0x13d93d={},_0x4b89a3={},_0x394eba={'count':0x0,'rows':[]};var _0x2a2876=_[_0x096e('0x2a')](db[_0x096e('0x2b')]['rawAttributes'],function(_0x291ca8){return{'name':_0x291ca8['fieldName'],'type':_0x291ca8[_0x096e('0x2c')][_0x096e('0x2d')]};});_0x4b89a3[_0x096e('0x2e')]=_[_0x096e('0x2a')](_0x2a2876,_0x096e('0x28'));_0x4b89a3[_0x096e('0x2f')]=_['keys'](_0x2055a0[_0x096e('0x2f')]);_0x4b89a3[_0x096e('0x30')]=_[_0x096e('0x31')](_0x4b89a3['model'],_0x4b89a3[_0x096e('0x2f')]);_0x13d93d['attributes']=_['intersection'](_0x4b89a3[_0x096e('0x2e')],qs[_0x096e('0x32')](_0x2055a0[_0x096e('0x2f')][_0x096e('0x32')]));_0x13d93d['attributes']=_0x13d93d[_0x096e('0x33')][_0x096e('0x34')]?_0x13d93d['attributes']:_0x4b89a3['model'];if(!_0x2055a0['query']['hasOwnProperty'](_0x096e('0x35'))){_0x13d93d['limit']=qs[_0x096e('0x20')](_0x2055a0['query'][_0x096e('0x20')]);_0x13d93d['offset']=qs[_0x096e('0x1e')](_0x2055a0[_0x096e('0x2f')]['offset']);}_0x13d93d[_0x096e('0x36')]=qs['sort'](_0x2055a0[_0x096e('0x2f')][_0x096e('0x37')]);_0x13d93d[_0x096e('0x38')]=qs['filters'](_['pick'](_0x2055a0[_0x096e('0x2f')],_0x4b89a3[_0x096e('0x30')]),_0x2a2876);if(_0x2055a0[_0x096e('0x2f')][_0x096e('0x39')]){_0x13d93d[_0x096e('0x38')]=_[_0x096e('0x3a')](_0x13d93d[_0x096e('0x38')],{'$or':_[_0x096e('0x2a')](_0x2a2876,function(_0x537f64){if(_0x537f64[_0x096e('0x2c')]!==_0x096e('0x3b')){var _0x4f90ff={};_0x4f90ff[_0x537f64[_0x096e('0x28')]]={'$like':'%'+_0x2055a0[_0x096e('0x2f')][_0x096e('0x39')]+'%'};return _0x4f90ff;}})});}_0x13d93d=_[_0x096e('0x3a')]({},_0x13d93d,_0x2055a0[_0x096e('0x3c')]);var _0x3bc5a8={'where':_0x13d93d['where']};return db[_0x096e('0x2b')][_0x096e('0x21')](_0x3bc5a8)[_0x096e('0x3d')](function(_0x2ef338){_0x394eba[_0x096e('0x21')]=_0x2ef338;if(_0x2055a0[_0x096e('0x2f')][_0x096e('0x3e')]){_0x13d93d[_0x096e('0x3f')]=[{'all':!![]}];}return db[_0x096e('0x2b')][_0x096e('0x40')](_0x13d93d);})[_0x096e('0x3d')](function(_0x3a1521){_0x394eba['rows']=_0x3a1521;return _0x394eba;})[_0x096e('0x3d')](respondWithFilteredResult(_0x442ae0,_0x13d93d))[_0x096e('0x41')](handleError(_0x442ae0,null));};exports[_0x096e('0x42')]=function(_0x8648db,_0x29667e){var _0xa70ef9={'raw':![],'where':{'id':_0x8648db[_0x096e('0x43')]['id']}},_0x8fa823={};_0x8fa823['model']=_[_0x096e('0x44')](db[_0x096e('0x2b')][_0x096e('0x45')]);_0x8fa823['query']=_[_0x096e('0x44')](_0x8648db[_0x096e('0x2f')]);_0x8fa823[_0x096e('0x30')]=_['intersection'](_0x8fa823['model'],_0x8fa823['query']);_0xa70ef9['attributes']=_['intersection'](_0x8fa823[_0x096e('0x2e')],qs[_0x096e('0x32')](_0x8648db[_0x096e('0x2f')][_0x096e('0x32')]));_0xa70ef9['attributes']=_0xa70ef9['attributes']['length']?_0xa70ef9[_0x096e('0x33')]:_0x8fa823[_0x096e('0x2e')];if(_0x8648db[_0x096e('0x2f')][_0x096e('0x3e')]){_0xa70ef9['include']=[{'all':!![]}];}_0xa70ef9=_[_0x096e('0x3a')]({},_0xa70ef9,_0x8648db[_0x096e('0x3c')]);return db['UserProfileSection'][_0x096e('0x46')](_0xa70ef9)[_0x096e('0x3d')](handleEntityNotFound(_0x29667e,null))[_0x096e('0x3d')](respondWithResult(_0x29667e,null))[_0x096e('0x41')](handleError(_0x29667e,null));};exports[_0x096e('0x47')]=function(_0x346fdf,_0x10e328){return db[_0x096e('0x2b')][_0x096e('0x47')](_0x346fdf[_0x096e('0x48')],{})[_0x096e('0x3d')](respondWithResult(_0x10e328,0xc9))[_0x096e('0x41')](handleError(_0x10e328,null));};exports['update']=function(_0x236039,_0x437a44){if(_0x236039[_0x096e('0x48')]['id']){delete _0x236039[_0x096e('0x48')]['id'];}return db[_0x096e('0x2b')][_0x096e('0x46')]({'where':{'id':_0x236039['params']['id']}})[_0x096e('0x3d')](handleEntityNotFound(_0x437a44,null))[_0x096e('0x3d')](saveUpdates(_0x236039[_0x096e('0x48')],null))['then'](respondWithResult(_0x437a44,null))[_0x096e('0x41')](handleError(_0x437a44,null));};exports['destroy']=function(_0x22812a,_0x100bca){return db[_0x096e('0x2b')]['find']({'where':{'id':_0x22812a['params']['id']}})['then'](handleEntityNotFound(_0x100bca,null))['then'](removeEntity(_0x100bca,null))['catch'](handleError(_0x100bca,null));};exports[_0x096e('0x49')]=function(_0x2c7896,_0x5bcec0){return db[_0x096e('0x2b')][_0x096e('0x49')]()[_0x096e('0x3d')](respondWithResult(_0x5bcec0,null))[_0x096e('0x41')](handleError(_0x5bcec0,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index ef1ee04..389d1c0 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 _0xc5c8=['lodash','util','../../config/logger','moment','path','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId'];(function(_0x9174d,_0x2c16d7){var _0x60fee8=function(_0x480920){while(--_0x480920){_0x9174d['push'](_0x9174d['shift']());}};_0x60fee8(++_0x2c16d7);}(_0xc5c8,0x118));var _0x8c5c=function(_0x285b94,_0x1b9c45){_0x285b94=_0x285b94-0x0;var _0x5f336a=_0xc5c8[_0x285b94];return _0x5f336a;};'use strict';var _=require(_0x8c5c('0x0'));var util=require(_0x8c5c('0x1'));var logger=require(_0x8c5c('0x2'))('api');var moment=require(_0x8c5c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c5c('0x4'));var rimraf=require(_0x8c5c('0x5'));var config=require('../../config/environment');var attributes=require(_0x8c5c('0x6'));module[_0x8c5c('0x7')]=function(_0x390b86,_0x2e297d){return _0x390b86[_0x8c5c('0x8')](_0x8c5c('0x9'),attributes,{'tableName':_0x8c5c('0xa'),'paranoid':![],'indexes':[{'name':_0x8c5c('0xb'),'fields':[_0x8c5c('0xc'),_0x8c5c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb6d7=['sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','compositeIndex'];(function(_0x1f77d8,_0x4174a9){var _0x2e93c0=function(_0x2ed806){while(--_0x2ed806){_0x1f77d8['push'](_0x1f77d8['shift']());}};_0x2e93c0(++_0x4174a9);}(_0xb6d7,0x101));var _0x7b6d=function(_0x40f99c,_0x234726){_0x40f99c=_0x40f99c-0x0;var _0x17f858=_0xb6d7[_0x40f99c];return _0x17f858;};'use strict';var _=require(_0x7b6d('0x0'));var util=require(_0x7b6d('0x1'));var logger=require(_0x7b6d('0x2'))(_0x7b6d('0x3'));var moment=require(_0x7b6d('0x4'));var BPromise=require(_0x7b6d('0x5'));var rp=require(_0x7b6d('0x6'));var fs=require('fs');var path=require(_0x7b6d('0x7'));var rimraf=require(_0x7b6d('0x8'));var config=require(_0x7b6d('0x9'));var attributes=require(_0x7b6d('0xa'));module[_0x7b6d('0xb')]=function(_0x43b42b,_0x362aeb){return _0x43b42b[_0x7b6d('0xc')](_0x7b6d('0xd'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x7b6d('0xe'),'fields':[_0x7b6d('0xf'),_0x7b6d('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 8277c48..171f2a6 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 _0x51cd=['ioredis','../../mysqldb','rpc','jayson/promise','client','http','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','randomstring'];(function(_0x584863,_0x2d9880){var _0x1dde2a=function(_0x55fbd1){while(--_0x55fbd1){_0x584863['push'](_0x584863['shift']());}};_0x1dde2a(++_0x2d9880);}(_0x51cd,0x141));var _0xd51c=function(_0x8284f4,_0x258d1f){_0x8284f4=_0x8284f4-0x0;var _0x93b710=_0x51cd[_0x8284f4];return _0x93b710;};'use strict';var _=require(_0xd51c('0x0'));var util=require(_0xd51c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd51c('0x2'));var fs=require('fs');var Redis=require(_0xd51c('0x3'));var db=require(_0xd51c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd51c('0x5'));var config=require('../../config/environment');var jayson=require(_0xd51c('0x6'));var client=jayson[_0xd51c('0x7')][_0xd51c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25d9e2,_0x2c9344,_0x41020c){return new BPromise(function(_0x43ce50,_0x47698d){return client['request'](_0x25d9e2,_0x41020c)['then'](function(_0x473104){logger[_0xd51c('0x9')](_0xd51c('0xa'),_0x2c9344,_0xd51c('0xb'));logger[_0xd51c('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2c9344,_0xd51c('0xb'),JSON[_0xd51c('0xd')](_0x473104));if(_0x473104[_0xd51c('0xe')]){if(_0x473104['error']['code']===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2c9344,_0x473104[_0xd51c('0xe')][_0xd51c('0xf')]);return _0x47698d(_0x473104[_0xd51c('0xe')][_0xd51c('0xf')]);}logger[_0xd51c('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2c9344,_0x473104[_0xd51c('0xe')]['message']);return _0x43ce50(_0x473104['error'][_0xd51c('0xf')]);}else{logger[_0xd51c('0x9')]('UserProfileSection,\x20%s,\x20%s',_0x2c9344,_0xd51c('0xb'));_0x43ce50(_0x473104[_0xd51c('0x10')]['message']);}})[_0xd51c('0x11')](function(_0xcb8b86){logger[_0xd51c('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2c9344,_0xcb8b86);_0x47698d(_0xcb8b86);});});} \ No newline at end of file +var _0xdf67=['../../config/environment','jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5b0aad,_0x2bb037){var _0x5b61db=function(_0x589295){while(--_0x589295){_0x5b0aad['push'](_0x5b0aad['shift']());}};_0x5b61db(++_0x2bb037);}(_0xdf67,0x117));var _0x7df6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf67[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7df6('0x0'));var util=require(_0x7df6('0x1'));var moment=require(_0x7df6('0x2'));var BPromise=require(_0x7df6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7df6('0x4'));var db=require(_0x7df6('0x5'))['db'];var utils=require(_0x7df6('0x6'));var logger=require(_0x7df6('0x7'))(_0x7df6('0x8'));var config=require(_0x7df6('0x9'));var jayson=require(_0x7df6('0xa'));var client=jayson[_0x7df6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x437fcd,_0x2e7f0b,_0x440354){return new BPromise(function(_0x4f1eab,_0x2f0712){return client[_0x7df6('0xc')](_0x437fcd,_0x440354)[_0x7df6('0xd')](function(_0xd32857){logger[_0x7df6('0xe')](_0x7df6('0xf'),_0x2e7f0b,'request\x20sent');logger[_0x7df6('0x10')](_0x7df6('0x11'),_0x2e7f0b,_0x7df6('0x12'),JSON[_0x7df6('0x13')](_0xd32857));if(_0xd32857[_0x7df6('0x14')]){if(_0xd32857[_0x7df6('0x14')]['code']===0x1f4){logger[_0x7df6('0x14')](_0x7df6('0xf'),_0x2e7f0b,_0xd32857[_0x7df6('0x14')][_0x7df6('0x15')]);return _0x2f0712(_0xd32857[_0x7df6('0x14')][_0x7df6('0x15')]);}logger['error'](_0x7df6('0xf'),_0x2e7f0b,_0xd32857[_0x7df6('0x14')][_0x7df6('0x15')]);return _0x4f1eab(_0xd32857[_0x7df6('0x14')][_0x7df6('0x15')]);}else{logger[_0x7df6('0xe')](_0x7df6('0xf'),_0x2e7f0b,'request\x20sent');_0x4f1eab(_0xd32857[_0x7df6('0x16')]['message']);}})[_0x7df6('0x17')](function(_0x4109bd){logger[_0x7df6('0x14')](_0x7df6('0xf'),_0x2e7f0b,_0x4109bd);_0x2f0712(_0x4109bd);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 63f2b81..c2d0699 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(_0x5ebd54,_0x928763){var _0x5f53f5=function(_0x380b5f){while(--_0x380b5f){_0x5ebd54['push'](_0x5ebd54['shift']());}};_0x5f53f5(++_0x928763);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4bb1b3,_0x446a44){var _0x6b3651=function(_0x1f0a7b){while(--_0x1f0a7b){_0x4bb1b3['push'](_0x4bb1b3['shift']());}};_0x6b3651(++_0x446a44);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index d257005..42f68c1 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 _0x00e9=['INTEGER','sequelize','exports'];(function(_0x504113,_0x5b7ea4){var _0x549056=function(_0x91c35c){while(--_0x91c35c){_0x504113['push'](_0x504113['shift']());}};_0x549056(++_0x5b7ea4);}(_0x00e9,0x10f));var _0x900e=function(_0x4cc207,_0x73afa6){_0x4cc207=_0x4cc207-0x0;var _0x5ac6e5=_0x00e9[_0x4cc207];return _0x5ac6e5;};'use strict';var Sequelize=require(_0x900e('0x0'));module[_0x900e('0x1')]={'penalty':{'type':Sequelize[_0x900e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb6f4=['sequelize'];(function(_0x137c60,_0x57589a){var _0x4ccffe=function(_0x2ac7e1){while(--_0x2ac7e1){_0x137c60['push'](_0x137c60['shift']());}};_0x4ccffe(++_0x57589a);}(_0xb6f4,0x11a));var _0x4b6f=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0xb6f4[_0x59b439];return _0x521ea3;};'use strict';var Sequelize=require(_0x4b6f('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 e4551fe..bfe9d74 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 _0xdeb3=['./userSmsQueue.attributes','define','user_has_sms_queues','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x134764,_0x112da5){var _0x2fe527=function(_0x7db51d){while(--_0x7db51d){_0x134764['push'](_0x134764['shift']());}};_0x2fe527(++_0x112da5);}(_0xdeb3,0xb7));var _0x3deb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdeb3[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x3deb('0x0'));var logger=require(_0x3deb('0x1'))(_0x3deb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3deb('0x3'));var fs=require('fs');var path=require(_0x3deb('0x4'));var rimraf=require(_0x3deb('0x5'));var config=require(_0x3deb('0x6'));var attributes=require(_0x3deb('0x7'));module['exports']=function(_0x193700,_0x47d2d4){return _0x193700[_0x3deb('0x8')]('UserSmsQueue',attributes,{'tableName':_0x3deb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd101=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd101,0xc1));var _0x1d10=function(_0x38dc5c,_0x3d0e2e){_0x38dc5c=_0x38dc5c-0x0;var _0x20d974=_0xd101[_0x38dc5c];return _0x20d974;};'use strict';var _=require(_0x1d10('0x0'));var util=require('util');var logger=require(_0x1d10('0x1'))(_0x1d10('0x2'));var moment=require(_0x1d10('0x3'));var BPromise=require(_0x1d10('0x4'));var rp=require(_0x1d10('0x5'));var fs=require('fs');var path=require(_0x1d10('0x6'));var rimraf=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var attributes=require('./userSmsQueue.attributes');module[_0x1d10('0x9')]=function(_0x203072,_0x2a4e2d){return _0x203072[_0x1d10('0xa')](_0x1d10('0xb'),attributes,{'tableName':_0x1d10('0xc'),'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 d91dd96..73c36ed 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 _0xfd49=['http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client'];(function(_0x208d9e,_0x2f31ae){var _0x23ae73=function(_0x18d0ee){while(--_0x18d0ee){_0x208d9e['push'](_0x208d9e['shift']());}};_0x23ae73(++_0x2f31ae);}(_0xfd49,0xea));var _0x9fd4=function(_0x5da107,_0x10357c){_0x5da107=_0x5da107-0x0;var _0x224f15=_0xfd49[_0x5da107];return _0x224f15;};'use strict';var _=require(_0x9fd4('0x0'));var util=require('util');var moment=require(_0x9fd4('0x1'));var BPromise=require('bluebird');var rs=require(_0x9fd4('0x2'));var fs=require('fs');var Redis=require(_0x9fd4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9fd4('0x4'))(_0x9fd4('0x5'));var config=require('../../config/environment');var jayson=require(_0x9fd4('0x6'));var client=jayson[_0x9fd4('0x7')][_0x9fd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c2127,_0x4c46b0,_0x3db339){return new BPromise(function(_0x17c1fe,_0x449810){return client[_0x9fd4('0x9')](_0x4c2127,_0x3db339)[_0x9fd4('0xa')](function(_0x1f3585){logger[_0x9fd4('0xb')](_0x9fd4('0xc'),_0x4c46b0,_0x9fd4('0xd'));logger[_0x9fd4('0xe')](_0x9fd4('0xf'),_0x4c46b0,_0x9fd4('0xd'),JSON[_0x9fd4('0x10')](_0x1f3585));if(_0x1f3585[_0x9fd4('0x11')]){if(_0x1f3585[_0x9fd4('0x11')][_0x9fd4('0x12')]===0x1f4){logger['error'](_0x9fd4('0xc'),_0x4c46b0,_0x1f3585[_0x9fd4('0x11')][_0x9fd4('0x13')]);return _0x449810(_0x1f3585[_0x9fd4('0x11')][_0x9fd4('0x13')]);}logger[_0x9fd4('0x11')](_0x9fd4('0xc'),_0x4c46b0,_0x1f3585[_0x9fd4('0x11')][_0x9fd4('0x13')]);return _0x17c1fe(_0x1f3585[_0x9fd4('0x11')][_0x9fd4('0x13')]);}else{logger[_0x9fd4('0xb')](_0x9fd4('0xc'),_0x4c46b0,'request\x20sent');_0x17c1fe(_0x1f3585[_0x9fd4('0x14')][_0x9fd4('0x13')]);}})[_0x9fd4('0x15')](function(_0x3b5f66){logger[_0x9fd4('0x11')](_0x9fd4('0xc'),_0x4c46b0,_0x3b5f66);_0x449810(_0x3b5f66);});});} \ No newline at end of file +var _0x73b2=['then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0x73b2,0x7a));var _0x273b=function(_0x19b16e,_0x3db7de){_0x19b16e=_0x19b16e-0x0;var _0x23f4a8=_0x73b2[_0x19b16e];return _0x23f4a8;};'use strict';var _=require(_0x273b('0x0'));var util=require(_0x273b('0x1'));var moment=require(_0x273b('0x2'));var BPromise=require(_0x273b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x273b('0x4'));var logger=require('../../config/logger')(_0x273b('0x5'));var config=require('../../config/environment');var jayson=require(_0x273b('0x6'));var client=jayson[_0x273b('0x7')][_0x273b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x250af2,_0x3e072c,_0x372517){return new BPromise(function(_0x2cd724,_0x293cee){return client[_0x273b('0x9')](_0x250af2,_0x372517)[_0x273b('0xa')](function(_0x3617ec){logger[_0x273b('0xb')](_0x273b('0xc'),_0x3e072c,_0x273b('0xd'));logger[_0x273b('0xe')](_0x273b('0xf'),_0x3e072c,_0x273b('0xd'),JSON[_0x273b('0x10')](_0x3617ec));if(_0x3617ec['error']){if(_0x3617ec[_0x273b('0x11')][_0x273b('0x12')]===0x1f4){logger[_0x273b('0x11')](_0x273b('0xc'),_0x3e072c,_0x3617ec[_0x273b('0x11')][_0x273b('0x13')]);return _0x293cee(_0x3617ec[_0x273b('0x11')]['message']);}logger[_0x273b('0x11')](_0x273b('0xc'),_0x3e072c,_0x3617ec[_0x273b('0x11')][_0x273b('0x13')]);return _0x2cd724(_0x3617ec[_0x273b('0x11')][_0x273b('0x13')]);}else{logger[_0x273b('0xb')](_0x273b('0xc'),_0x3e072c,'request\x20sent');_0x2cd724(_0x3617ec[_0x273b('0x14')][_0x273b('0x13')]);}})[_0x273b('0x15')](function(_0x3a5bb1){logger[_0x273b('0x11')](_0x273b('0xc'),_0x3e072c,_0x3a5bb1);_0x293cee(_0x3a5bb1);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/index.js b/server/api/userVoicePrefix/index.js index 0da6ef1..7ed6d6f 100644 --- a/server/api/userVoicePrefix/index.js +++ b/server/api/userVoicePrefix/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(_0x5568bf,_0x1d1e49){var _0x1f1049=function(_0x240897){while(--_0x240897){_0x5568bf['push'](_0x5568bf['shift']());}};_0x1f1049(++_0x1d1e49);}(_0xe706,0xa3));var _0x6e70=function(_0xdd27d1,_0xb6f0da){_0xdd27d1=_0xdd27d1-0x0;var _0x58220e=_0xe706[_0xdd27d1];return _0x58220e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x8666ec,_0x34fb14){var _0x496fe8=function(_0x52361d){while(--_0x52361d){_0x8666ec['push'](_0x8666ec['shift']());}};_0x496fe8(++_0x34fb14);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'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/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index cdd8915..f43d0e3 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 _0x0895=['sequelize','INTEGER'];(function(_0x4fd5a8,_0x30f8d9){var _0x5b14b4=function(_0x49116f){while(--_0x49116f){_0x4fd5a8['push'](_0x4fd5a8['shift']());}};_0x5b14b4(++_0x30f8d9);}(_0x0895,0x158));var _0x5089=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0895[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5089('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x5089('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x5089('0x1')]}}; \ No newline at end of file +var _0x9dab=['exports','sequelize'];(function(_0x545bed,_0x221e96){var _0x16c79c=function(_0x465346){while(--_0x465346){_0x545bed['push'](_0x545bed['shift']());}};_0x16c79c(++_0x221e96);}(_0x9dab,0x1df));var _0xb9da=function(_0x403c6f,_0x3ae257){_0x403c6f=_0x403c6f-0x0;var _0x6195a7=_0x9dab[_0x403c6f];return _0x6195a7;};'use strict';var Sequelize=require(_0xb9da('0x0'));module[_0xb9da('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 4f03cf8..6991cee 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(_0x4e08d6,_0x305aa0){var _0x4db1c3=function(_0x16c4bb){while(--_0x16c4bb){_0x4e08d6['push'](_0x4e08d6['shift']());}};_0x4db1c3(++_0x305aa0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0x36ccf6,_0x31e7b1){var _0x244025=function(_0x3caf1b){while(--_0x3caf1b){_0x36ccf6['push'](_0x36ccf6['shift']());}};_0x244025(++_0x31e7b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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/userVoicePrefix/userVoicePrefix.rpc.js b/server/api/userVoicePrefix/userVoicePrefix.rpc.js index f6d2510..9becb81 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.rpc.js +++ b/server/api/userVoicePrefix/userVoicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9292=['client','http','request','then','UserVoicePrefix,\x20%s,\x20%s','request\x20sent','debug','UserVoicePrefix,\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'];(function(_0x1ce4c0,_0x46a34a){var _0x869c61=function(_0x22cef1){while(--_0x22cef1){_0x1ce4c0['push'](_0x1ce4c0['shift']());}};_0x869c61(++_0x46a34a);}(_0x9292,0x6e));var _0x2929=function(_0x57c1b7,_0x46bb7a){_0x57c1b7=_0x57c1b7-0x0;var _0x3a4576=_0x9292[_0x57c1b7];return _0x3a4576;};'use strict';var _=require(_0x2929('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2929('0x1'));var rs=require(_0x2929('0x2'));var fs=require('fs');var Redis=require(_0x2929('0x3'));var db=require(_0x2929('0x4'))['db'];var utils=require(_0x2929('0x5'));var logger=require(_0x2929('0x6'))(_0x2929('0x7'));var config=require(_0x2929('0x8'));var jayson=require(_0x2929('0x9'));var client=jayson[_0x2929('0xa')][_0x2929('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b118c,_0x2e2469,_0x2dfcc4){return new BPromise(function(_0xaf1bd3,_0x37b531){return client[_0x2929('0xc')](_0x3b118c,_0x2dfcc4)[_0x2929('0xd')](function(_0xa0c0dc){logger['info'](_0x2929('0xe'),_0x2e2469,_0x2929('0xf'));logger[_0x2929('0x10')](_0x2929('0x11'),_0x2e2469,'request\x20sent',JSON[_0x2929('0x12')](_0xa0c0dc));if(_0xa0c0dc['error']){if(_0xa0c0dc[_0x2929('0x13')][_0x2929('0x14')]===0x1f4){logger['error'](_0x2929('0xe'),_0x2e2469,_0xa0c0dc['error'][_0x2929('0x15')]);return _0x37b531(_0xa0c0dc[_0x2929('0x13')][_0x2929('0x15')]);}logger['error'](_0x2929('0xe'),_0x2e2469,_0xa0c0dc[_0x2929('0x13')][_0x2929('0x15')]);return _0xaf1bd3(_0xa0c0dc[_0x2929('0x13')][_0x2929('0x15')]);}else{logger[_0x2929('0x16')](_0x2929('0xe'),_0x2e2469,_0x2929('0xf'));_0xaf1bd3(_0xa0c0dc['result'][_0x2929('0x15')]);}})[_0x2929('0x17')](function(_0x4d2fc2){logger['error'](_0x2929('0xe'),_0x2e2469,_0x4d2fc2);_0x37b531(_0x4d2fc2);});});} \ No newline at end of file +var _0x224b=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x34e29e,_0x3d6df5){var _0x4d0088=function(_0x317af6){while(--_0x317af6){_0x34e29e['push'](_0x34e29e['shift']());}};_0x4d0088(++_0x3d6df5);}(_0x224b,0x175));var _0xb224=function(_0x4e4ea1,_0x3d98fa){_0x4e4ea1=_0x4e4ea1-0x0;var _0x2f1ed6=_0x224b[_0x4e4ea1];return _0x2f1ed6;};'use strict';var _=require(_0xb224('0x0'));var util=require(_0xb224('0x1'));var moment=require(_0xb224('0x2'));var BPromise=require(_0xb224('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb224('0x4'));var db=require(_0xb224('0x5'))['db'];var utils=require(_0xb224('0x6'));var logger=require(_0xb224('0x7'))(_0xb224('0x8'));var config=require(_0xb224('0x9'));var jayson=require(_0xb224('0xa'));var client=jayson[_0xb224('0xb')][_0xb224('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x44d0fd,_0x30187f,_0x3c0f95){return new BPromise(function(_0x5a5a39,_0x50f424){return client[_0xb224('0xd')](_0x44d0fd,_0x3c0f95)[_0xb224('0xe')](function(_0x33d441){logger[_0xb224('0xf')](_0xb224('0x10'),_0x30187f,_0xb224('0x11'));logger[_0xb224('0x12')]('UserVoicePrefix,\x20%s,\x20%s,\x20%s',_0x30187f,_0xb224('0x11'),JSON[_0xb224('0x13')](_0x33d441));if(_0x33d441[_0xb224('0x14')]){if(_0x33d441[_0xb224('0x14')][_0xb224('0x15')]===0x1f4){logger[_0xb224('0x14')](_0xb224('0x10'),_0x30187f,_0x33d441[_0xb224('0x14')][_0xb224('0x16')]);return _0x50f424(_0x33d441['error'][_0xb224('0x16')]);}logger[_0xb224('0x14')](_0xb224('0x10'),_0x30187f,_0x33d441[_0xb224('0x14')]['message']);return _0x5a5a39(_0x33d441[_0xb224('0x14')][_0xb224('0x16')]);}else{logger[_0xb224('0xf')](_0xb224('0x10'),_0x30187f,_0xb224('0x11'));_0x5a5a39(_0x33d441[_0xb224('0x17')][_0xb224('0x16')]);}})[_0xb224('0x18')](function(_0x53d5a4){logger[_0xb224('0x14')]('UserVoicePrefix,\x20%s,\x20%s',_0x30187f,_0x53d5a4);_0x50f424(_0x53d5a4);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 71a3842..5e674df 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3f80ac,_0x306b3b){var _0x16665d=function(_0x26b6df){while(--_0x26b6df){_0x3f80ac['push'](_0x3f80ac['shift']());}};_0x16665d(++_0x306b3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 174dd76..754dedc 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 _0xeffe=['sequelize','INTEGER'];(function(_0x5699c9,_0x11e8e6){var _0x3b6676=function(_0x18387b){while(--_0x18387b){_0x5699c9['push'](_0x5699c9['shift']());}};_0x3b6676(++_0x11e8e6);}(_0xeffe,0x80));var _0xeeff=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xeffe[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0xeeff('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xeeff('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xea45=['sequelize','exports'];(function(_0x4641a7,_0x201cdf){var _0xd3ad87=function(_0x28157c){while(--_0x28157c){_0x4641a7['push'](_0x4641a7['shift']());}};_0xd3ad87(++_0x201cdf);}(_0xea45,0xa4));var _0x5ea4=function(_0x5a42c3,_0x138f32){_0x5a42c3=_0x5a42c3-0x0;var _0x458420=_0xea45[_0x5a42c3];return _0x458420;};'use strict';var Sequelize=require(_0x5ea4('0x0'));module[_0x5ea4('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 1ca5d3d..e7738fa 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 _0x17fb=['user_has_voice_queues','util','api','moment','bluebird','request-promise','path','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x1f413c,_0x22f3dd){var _0x19ef31=function(_0x2c55db){while(--_0x2c55db){_0x1f413c['push'](_0x1f413c['shift']());}};_0x19ef31(++_0x22f3dd);}(_0x17fb,0x18d));var _0xb17f=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0x17fb[_0x2085f3];return _0x384e3c;};'use strict';var _=require('lodash');var util=require(_0xb17f('0x0'));var logger=require('../../config/logger')(_0xb17f('0x1'));var moment=require(_0xb17f('0x2'));var BPromise=require(_0xb17f('0x3'));var rp=require(_0xb17f('0x4'));var fs=require('fs');var path=require(_0xb17f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb17f('0x6'));module[_0xb17f('0x7')]=function(_0x3594dd,_0x2725f1){return _0x3594dd[_0xb17f('0x8')](_0xb17f('0x9'),attributes,{'tableName':_0xb17f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab7b=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x162ba2,_0x28c60f){var _0x417fa4=function(_0x218674){while(--_0x218674){_0x162ba2['push'](_0x162ba2['shift']());}};_0x417fa4(++_0x28c60f);}(_0xab7b,0xb2));var _0xbab7=function(_0x3b2035,_0x375ce8){_0x3b2035=_0x3b2035-0x0;var _0x161ca3=_0xab7b[_0x3b2035];return _0x161ca3;};'use strict';var _=require(_0xbab7('0x0'));var util=require(_0xbab7('0x1'));var logger=require(_0xbab7('0x2'))(_0xbab7('0x3'));var moment=require(_0xbab7('0x4'));var BPromise=require(_0xbab7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbab7('0x6'));var rimraf=require(_0xbab7('0x7'));var config=require(_0xbab7('0x8'));var attributes=require('./userVoiceQueue.attributes');module[_0xbab7('0x9')]=function(_0x10e761,_0x376996){return _0x10e761[_0xbab7('0xa')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index c10801f..c836071 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 _0x7399=['error','code','message','UserVoiceQueue,\x20%s,\x20%s','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','stringify'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x7399,0x7c));var _0x9739=function(_0xf4d54c,_0x118dba){_0xf4d54c=_0xf4d54c-0x0;var _0x1e2ae6=_0x7399[_0xf4d54c];return _0x1e2ae6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9739('0x0'));var BPromise=require(_0x9739('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9739('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9739('0x3'));var logger=require(_0x9739('0x4'))(_0x9739('0x5'));var config=require('../../config/environment');var jayson=require(_0x9739('0x6'));var client=jayson[_0x9739('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21d752,_0x38a01b,_0x219ace){return new BPromise(function(_0x3fab9a,_0x5f0528){return client['request'](_0x21d752,_0x219ace)[_0x9739('0x8')](function(_0x401d4c){logger[_0x9739('0x9')]('UserVoiceQueue,\x20%s,\x20%s',_0x38a01b,_0x9739('0xa'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x38a01b,_0x9739('0xa'),JSON[_0x9739('0xb')](_0x401d4c));if(_0x401d4c[_0x9739('0xc')]){if(_0x401d4c[_0x9739('0xc')][_0x9739('0xd')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x38a01b,_0x401d4c[_0x9739('0xc')]['message']);return _0x5f0528(_0x401d4c[_0x9739('0xc')][_0x9739('0xe')]);}logger[_0x9739('0xc')](_0x9739('0xf'),_0x38a01b,_0x401d4c[_0x9739('0xc')][_0x9739('0xe')]);return _0x3fab9a(_0x401d4c[_0x9739('0xc')][_0x9739('0xe')]);}else{logger['info'](_0x9739('0xf'),_0x38a01b,_0x9739('0xa'));_0x3fab9a(_0x401d4c['result'][_0x9739('0xe')]);}})[_0x9739('0x10')](function(_0x175b98){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x38a01b,_0x175b98);_0x5f0528(_0x175b98);});});} \ No newline at end of file +var _0x4477=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x4477,0x91));var _0x7447=function(_0x4ecb19,_0x4796f5){_0x4ecb19=_0x4ecb19-0x0;var _0x166986=_0x4477[_0x4ecb19];return _0x166986;};'use strict';var _=require(_0x7447('0x0'));var util=require(_0x7447('0x1'));var moment=require(_0x7447('0x2'));var BPromise=require(_0x7447('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7447('0x4'))['db'];var utils=require(_0x7447('0x5'));var logger=require(_0x7447('0x6'))(_0x7447('0x7'));var config=require(_0x7447('0x8'));var jayson=require(_0x7447('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x231b5b,_0x186731,_0x4c33e0){return new BPromise(function(_0x30adff,_0x57c6c8){return client['request'](_0x231b5b,_0x4c33e0)['then'](function(_0x2ee1e5){logger[_0x7447('0xa')](_0x7447('0xb'),_0x186731,'request\x20sent');logger[_0x7447('0xc')](_0x7447('0xd'),_0x186731,_0x7447('0xe'),JSON[_0x7447('0xf')](_0x2ee1e5));if(_0x2ee1e5['error']){if(_0x2ee1e5['error'][_0x7447('0x10')]===0x1f4){logger[_0x7447('0x11')](_0x7447('0xb'),_0x186731,_0x2ee1e5['error'][_0x7447('0x12')]);return _0x57c6c8(_0x2ee1e5[_0x7447('0x11')][_0x7447('0x12')]);}logger[_0x7447('0x11')](_0x7447('0xb'),_0x186731,_0x2ee1e5['error'][_0x7447('0x12')]);return _0x30adff(_0x2ee1e5[_0x7447('0x11')]['message']);}else{logger['info'](_0x7447('0xb'),_0x186731,_0x7447('0xe'));_0x30adff(_0x2ee1e5[_0x7447('0x13')]['message']);}})[_0x7447('0x14')](function(_0x173221){logger[_0x7447('0x11')](_0x7447('0xb'),_0x186731,_0x173221);_0x57c6c8(_0x173221);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 78a7a18..c6dbdeb 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5d1acc,_0x47c387){var _0x222e43=function(_0x3931ec){while(--_0x3931ec){_0x5d1acc['push'](_0x5d1acc['shift']());}};_0x222e43(++_0x47c387);}(_0xe706,0xa3));var _0x6e70=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0xe706[_0x58965a];return _0x254efc;};'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(_0x476f49,_0x105660){var _0x48addd=function(_0x2f7341){while(--_0x2f7341){_0x476f49['push'](_0x476f49['shift']());}};_0x48addd(++_0x105660);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index e209abb..2f69a16 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 _0x5cf6=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x83c6c7,_0x5eea4e){var _0x21cf84=function(_0x42eca1){while(--_0x42eca1){_0x83c6c7['push'](_0x83c6c7['shift']());}};_0x21cf84(++_0x5eea4e);}(_0x5cf6,0x1d3));var _0x65cf=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5cf6[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x65cf('0x0'));module[_0x65cf('0x1')]={'uniqueid':{'type':Sequelize[_0x65cf('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x65cf('0x3')},'membername':{'type':Sequelize[_0x65cf('0x4')],'allowNull':![],'comment':_0x65cf('0x3')},'UserId':{'type':Sequelize[_0x65cf('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x65cf('0x4')],'allowNull':![],'unique':_0x65cf('0x5'),'comment':_0x65cf('0x3')},'VoiceQueueId':{'type':Sequelize[_0x65cf('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x65cf('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x65cf('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x65cf('0x2')](0xb),'defaultValue':0x0,'comment':_0x65cf('0x3')}}; \ No newline at end of file +var _0xb8d9=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x5262e2,_0xc8ccf7){var _0x75e705=function(_0xf97c68){while(--_0xf97c68){_0x5262e2['push'](_0x5262e2['shift']());}};_0x75e705(++_0xc8ccf7);}(_0xb8d9,0x175));var _0x9b8d=function(_0xd6c41c,_0x4056d2){_0xd6c41c=_0xd6c41c-0x0;var _0xa6957a=_0xb8d9[_0xd6c41c];return _0xa6957a;};'use strict';var Sequelize=require(_0x9b8d('0x0'));module[_0x9b8d('0x1')]={'uniqueid':{'type':Sequelize[_0x9b8d('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x9b8d('0x3')},'membername':{'type':Sequelize[_0x9b8d('0x4')],'allowNull':![],'comment':_0x9b8d('0x3')},'UserId':{'type':Sequelize[_0x9b8d('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x9b8d('0x4')],'allowNull':![],'unique':_0x9b8d('0x5'),'comment':_0x9b8d('0x3')},'VoiceQueueId':{'type':Sequelize[_0x9b8d('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x9b8d('0x3')},'penalty':{'type':Sequelize[_0x9b8d('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x9b8d('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 3a36d0b..5e5de52 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 _0x551c=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','UserVoiceQueueRt'];(function(_0xa3fcbc,_0x4651de){var _0x157aef=function(_0x26e6eb){while(--_0x26e6eb){_0xa3fcbc['push'](_0xa3fcbc['shift']());}};_0x157aef(++_0x4651de);}(_0x551c,0xfe));var _0xc551=function(_0xb179e9,_0x95e390){_0xb179e9=_0xb179e9-0x0;var _0x30bf50=_0x551c[_0xb179e9];return _0x30bf50;};'use strict';var EventEmitter=require(_0xc551('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xc551('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc551('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc551('0x3'),'afterDestroy':_0xc551('0x4')};function emitEvent(_0x4054e0){return function(_0x487c4a,_0x1045c3,_0x3397bd){UserVoiceQueueRtEvents['emit'](_0x4054e0+':'+_0x487c4a['id'],_0x487c4a);UserVoiceQueueRtEvents[_0xc551('0x5')](_0x4054e0,_0x487c4a);_0x3397bd(null);};}for(var e in events){if(events[_0xc551('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xc551('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x983f=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x5b6020,_0xbb8363){var _0x23bda1=function(_0x47abb9){while(--_0x47abb9){_0x5b6020['push'](_0x5b6020['shift']());}};_0x23bda1(++_0xbb8363);}(_0x983f,0x171));var _0xf983=function(_0x59f40c,_0x4477da){_0x59f40c=_0x59f40c-0x0;var _0x116231=_0x983f[_0x59f40c];return _0x116231;};'use strict';var EventEmitter=require(_0xf983('0x0'));var UserVoiceQueueRt=require(_0xf983('0x1'))['db'][_0xf983('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf983('0x3')](0x0);var events={'afterCreate':_0xf983('0x4'),'afterUpdate':_0xf983('0x5'),'afterDestroy':_0xf983('0x6')};function emitEvent(_0x1701a7){return function(_0x4ff690,_0x52bcd5,_0x405d8b){UserVoiceQueueRtEvents[_0xf983('0x7')](_0x1701a7+':'+_0x4ff690['id'],_0x4ff690);UserVoiceQueueRtEvents['emit'](_0x1701a7,_0x4ff690);_0x405d8b(null);};}for(var e in events){if(events[_0xf983('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0xf983('0x9')](e,emitEvent(event));}}module[_0xf983('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 2912840..9cd6c1e 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 _0x75a2=['exports','define','UserVoiceQueueRt','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x75a2,0x17c));var _0x275a=function(_0x1fc08d,_0x45d6be){_0x1fc08d=_0x1fc08d-0x0;var _0x121dc1=_0x75a2[_0x1fc08d];return _0x121dc1;};'use strict';var _=require(_0x275a('0x0'));var util=require(_0x275a('0x1'));var logger=require('../../config/logger')(_0x275a('0x2'));var moment=require(_0x275a('0x3'));var BPromise=require(_0x275a('0x4'));var rp=require(_0x275a('0x5'));var fs=require('fs');var path=require(_0x275a('0x6'));var rimraf=require(_0x275a('0x7'));var config=require(_0x275a('0x8'));var attributes=require(_0x275a('0x9'));module[_0x275a('0xa')]=function(_0x104dff,_0x21fc58){return _0x104dff[_0x275a('0xb')](_0x275a('0xc'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5252=['bluebird','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','user_has_voice_queues_rt','util','../../config/logger','moment'];(function(_0x27b009,_0x26be1f){var _0x19a628=function(_0x2bbf6e){while(--_0x2bbf6e){_0x27b009['push'](_0x27b009['shift']());}};_0x19a628(++_0x26be1f);}(_0x5252,0x1d3));var _0x2525=function(_0x1db9ce,_0x159252){_0x1db9ce=_0x1db9ce-0x0;var _0x492983=_0x5252[_0x1db9ce];return _0x492983;};'use strict';var _=require('lodash');var util=require(_0x2525('0x0'));var logger=require(_0x2525('0x1'))('api');var moment=require(_0x2525('0x2'));var BPromise=require(_0x2525('0x3'));var rp=require(_0x2525('0x4'));var fs=require('fs');var path=require(_0x2525('0x5'));var rimraf=require(_0x2525('0x6'));var config=require('../../config/environment');var attributes=require(_0x2525('0x7'));module[_0x2525('0x8')]=function(_0x36e807,_0x28facc){return _0x36e807['define']('UserVoiceQueueRt',attributes,{'tableName':_0x2525('0x9'),'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 73ab47e..f750625 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 _0x2f3e=['UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','./userVoiceQueueRt.socket','register','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1bb07c,_0x43cd16){var _0x30bb8a=function(_0x12ba2f){while(--_0x12ba2f){_0x1bb07c['push'](_0x1bb07c['shift']());}};_0x30bb8a(++_0x43cd16);}(_0x2f3e,0x149));var _0xe2f3=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0x2f3e[_0x5e28c2];return _0x1a8cc6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe2f3('0x0'));var BPromise=require(_0xe2f3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2f3('0x2'))['db'];var utils=require(_0xe2f3('0x3'));var logger=require('../../config/logger')(_0xe2f3('0x4'));var config=require(_0xe2f3('0x5'));var jayson=require(_0xe2f3('0x6'));var client=jayson['client'][_0xe2f3('0x7')]({'port':0x232a});config[_0xe2f3('0x8')]=_['defaults'](config[_0xe2f3('0x8')],{'host':_0xe2f3('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe2f3('0x8')]));require(_0xe2f3('0xa'))[_0xe2f3('0xb')](socket);function respondWithRpcPromise(_0x2cde01,_0x5453e3,_0x5e6c04){return new BPromise(function(_0x457523,_0x24c739){return client[_0xe2f3('0xc')](_0x2cde01,_0x5e6c04)[_0xe2f3('0xd')](function(_0x351adf){logger[_0xe2f3('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5453e3,_0xe2f3('0xf'));logger[_0xe2f3('0x10')](_0xe2f3('0x11'),_0x5453e3,_0xe2f3('0xf'),JSON[_0xe2f3('0x12')](_0x351adf));if(_0x351adf[_0xe2f3('0x13')]){if(_0x351adf[_0xe2f3('0x13')][_0xe2f3('0x14')]===0x1f4){logger[_0xe2f3('0x13')](_0xe2f3('0x15'),_0x5453e3,_0x351adf['error']['message']);return _0x24c739(_0x351adf['error'][_0xe2f3('0x16')]);}logger[_0xe2f3('0x13')](_0xe2f3('0x15'),_0x5453e3,_0x351adf[_0xe2f3('0x13')][_0xe2f3('0x16')]);return _0x457523(_0x351adf[_0xe2f3('0x13')][_0xe2f3('0x16')]);}else{logger[_0xe2f3('0xe')](_0xe2f3('0x15'),_0x5453e3,_0xe2f3('0xf'));_0x457523(_0x351adf[_0xe2f3('0x17')][_0xe2f3('0x16')]);}})[_0xe2f3('0x18')](function(_0x977015){logger['error'](_0xe2f3('0x15'),_0x5453e3,_0x977015);_0x24c739(_0x977015);});});}exports[_0xe2f3('0x19')]=function(_0x40bfa3){var _0x3fbe02=this;return new Promise(function(_0x56adc5,_0x21d85c){return db[_0xe2f3('0x1a')][_0xe2f3('0x1b')]({'raw':_0x40bfa3[_0xe2f3('0x1c')]?_0x40bfa3['options'][_0xe2f3('0x1d')]===undefined?!![]:![]:!![],'where':_0x40bfa3[_0xe2f3('0x1c')]?_0x40bfa3[_0xe2f3('0x1c')][_0xe2f3('0x1e')]||null:null,'attributes':[[db[_0xe2f3('0x1f')]['fn'](_0xe2f3('0x20'),db[_0xe2f3('0x1f')]['fn']('IF',db[_0xe2f3('0x1f')]['literal'](_0xe2f3('0x21')))),_0xe2f3('0x22')]]})[_0xe2f3('0xd')](function(_0x4bd25b){logger[_0xe2f3('0xe')](_0xe2f3('0x19'),_0x40bfa3);logger[_0xe2f3('0x10')](_0xe2f3('0x19'),_0x40bfa3,JSON[_0xe2f3('0x12')](_0x4bd25b));_0x56adc5(_0x4bd25b);})[_0xe2f3('0x18')](function(_0xeaeabc){logger['error']('GetVoiceQueueRtPauses',_0xeaeabc[_0xe2f3('0x16')],_0x40bfa3);_0x21d85c(_0x3fbe02['error'](0x1f4,_0xeaeabc[_0xe2f3('0x16')]));});});}; \ No newline at end of file +var _0x60cc=['options','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','then','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll'];(function(_0xb5e0b0,_0xd8bf38){var _0x291855=function(_0x5a452c){while(--_0x5a452c){_0xb5e0b0['push'](_0xb5e0b0['shift']());}};_0x291855(++_0xd8bf38);}(_0x60cc,0x1ac));var _0xc60c=function(_0x4fb867,_0x168873){_0x4fb867=_0x4fb867-0x0;var _0x848c1c=_0x60cc[_0x4fb867];return _0x848c1c;};'use strict';var _=require(_0xc60c('0x0'));var util=require(_0xc60c('0x1'));var moment=require(_0xc60c('0x2'));var BPromise=require(_0xc60c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc60c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc60c('0x5'));var logger=require(_0xc60c('0x6'))(_0xc60c('0x7'));var config=require(_0xc60c('0x8'));var jayson=require(_0xc60c('0x9'));var client=jayson[_0xc60c('0xa')][_0xc60c('0xb')]({'port':0x232a});config[_0xc60c('0xc')]=_['defaults'](config[_0xc60c('0xc')],{'host':_0xc60c('0xd'),'port':0x18eb});var socket=require(_0xc60c('0xe'))(new Redis(config[_0xc60c('0xc')]));require(_0xc60c('0xf'))['register'](socket);function respondWithRpcPromise(_0x373685,_0x3cb0e7,_0x2228fc){return new BPromise(function(_0x34b464,_0x46b4db){return client[_0xc60c('0x10')](_0x373685,_0x2228fc)['then'](function(_0x259241){logger[_0xc60c('0x11')](_0xc60c('0x12'),_0x3cb0e7,'request\x20sent');logger[_0xc60c('0x13')](_0xc60c('0x14'),_0x3cb0e7,'request\x20sent',JSON[_0xc60c('0x15')](_0x259241));if(_0x259241[_0xc60c('0x16')]){if(_0x259241[_0xc60c('0x16')]['code']===0x1f4){logger['error'](_0xc60c('0x12'),_0x3cb0e7,_0x259241['error'][_0xc60c('0x17')]);return _0x46b4db(_0x259241[_0xc60c('0x16')][_0xc60c('0x17')]);}logger['error'](_0xc60c('0x12'),_0x3cb0e7,_0x259241[_0xc60c('0x16')][_0xc60c('0x17')]);return _0x34b464(_0x259241[_0xc60c('0x16')]['message']);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3cb0e7,'request\x20sent');_0x34b464(_0x259241['result'][_0xc60c('0x17')]);}})['catch'](function(_0x59f7de){logger['error'](_0xc60c('0x12'),_0x3cb0e7,_0x59f7de);_0x46b4db(_0x59f7de);});});}exports[_0xc60c('0x18')]=function(_0x446ac4){var _0x29a715=this;return new Promise(function(_0x41f80a,_0x119272){return db[_0xc60c('0x19')][_0xc60c('0x1a')]({'raw':_0x446ac4[_0xc60c('0x1b')]?_0x446ac4[_0xc60c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x446ac4[_0xc60c('0x1b')]?_0x446ac4[_0xc60c('0x1b')][_0xc60c('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0xc60c('0x1d'),db[_0xc60c('0x1e')]['fn']('IF',db['sequelize'][_0xc60c('0x1f')](_0xc60c('0x20')))),'outboundQueuePauses']]})[_0xc60c('0x21')](function(_0x17b8eb){logger[_0xc60c('0x11')](_0xc60c('0x18'),_0x446ac4);logger['debug'](_0xc60c('0x18'),_0x446ac4,JSON[_0xc60c('0x15')](_0x17b8eb));_0x41f80a(_0x17b8eb);})[_0xc60c('0x22')](function(_0x114b03){logger[_0xc60c('0x16')](_0xc60c('0x18'),_0x114b03[_0xc60c('0x17')],_0x446ac4);_0x119272(_0x29a715[_0xc60c('0x16')](0x1f4,_0x114b03[_0xc60c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 9ea8dbc..608a901 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 _0x3641=['userVoiceQueueRt:','save','emit','register','length'];(function(_0x545211,_0x5787b1){var _0x41f333=function(_0x531000){while(--_0x531000){_0x545211['push'](_0x545211['shift']());}};_0x41f333(++_0x5787b1);}(_0x3641,0x173));var _0x1364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3641[_0x3dd15e];return _0x231fd0;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x1364('0x0'),'remove','update'];function createListener(_0x174332,_0x1a0e1a){return function(_0x5506bc){_0x1a0e1a[_0x1364('0x1')](_0x174332,_0x5506bc);};}function removeListener(_0x4a9034,_0x3d14e0){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4a9034,_0x3d14e0);};}exports[_0x1364('0x2')]=function(_0x4bcb69){for(var _0x169527=0x0,_0x278f40=events[_0x1364('0x3')];_0x169527<_0x278f40;_0x169527++){var _0x5ef8ba=events[_0x169527];var _0xb5d644=createListener(_0x1364('0x4')+_0x5ef8ba,_0x4bcb69);UserVoiceQueueRtEvents['on'](_0x5ef8ba,_0xb5d644);}}; \ No newline at end of file +var _0xb242=['register','length','save','remove','update','emit','removeListener'];(function(_0x4df278,_0x25d631){var _0x2f5979=function(_0x385797){while(--_0x385797){_0x4df278['push'](_0x4df278['shift']());}};_0x2f5979(++_0x25d631);}(_0xb242,0x1f3));var _0x2b24=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xb242[_0x565c49];return _0x20ca34;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x2b24('0x0'),_0x2b24('0x1'),_0x2b24('0x2')];function createListener(_0x23d2ef,_0x2ae747){return function(_0x24b99d){_0x2ae747[_0x2b24('0x3')](_0x23d2ef,_0x24b99d);};}function removeListener(_0x481806,_0x494b43){return function(){UserVoiceQueueRtEvents[_0x2b24('0x4')](_0x481806,_0x494b43);};}exports[_0x2b24('0x5')]=function(_0x5c1f57){for(var _0x341c66=0x0,_0x477e45=events[_0x2b24('0x6')];_0x341c66<_0x477e45;_0x341c66++){var _0x53345b=events[_0x341c66];var _0x475271=createListener('userVoiceQueueRt:'+_0x53345b,_0x5c1f57);UserVoiceQueueRtEvents['on'](_0x53345b,_0x475271);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 84a1628..1561d30 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x11bf29,_0x44409c){var _0x52a018=function(_0x3d11f1){while(--_0x3d11f1){_0x11bf29['push'](_0x11bf29['shift']());}};_0x52a018(++_0x44409c);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 811ca43..247adb5 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 _0x13f5=['exports','INTEGER'];(function(_0x7ca76f,_0x5ac99c){var _0x1fd4f3=function(_0x4a6bf6){while(--_0x4a6bf6){_0x7ca76f['push'](_0x7ca76f['shift']());}};_0x1fd4f3(++_0x5ac99c);}(_0x13f5,0x16c));var _0x513f=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x13f5[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require('sequelize');module[_0x513f('0x0')]={'penalty':{'type':Sequelize[_0x513f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6708=['exports','INTEGER','sequelize'];(function(_0x57d518,_0x5f5d23){var _0x218831=function(_0x1f6e4d){while(--_0x1f6e4d){_0x57d518['push'](_0x57d518['shift']());}};_0x218831(++_0x5f5d23);}(_0x6708,0xc5));var _0x8670=function(_0x5897f1,_0x5f5610){_0x5897f1=_0x5897f1-0x0;var _0x518408=_0x6708[_0x5897f1];return _0x518408;};'use strict';var Sequelize=require(_0x8670('0x0'));module[_0x8670('0x1')]={'penalty':{'type':Sequelize[_0x8670('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index ccde303..87aec5b 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 _0x3ca1=['user_has_whatsapp_queues','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','UserWhatsappQueue'];(function(_0x234249,_0x47ccd3){var _0x242b91=function(_0x7dd16b){while(--_0x7dd16b){_0x234249['push'](_0x234249['shift']());}};_0x242b91(++_0x47ccd3);}(_0x3ca1,0x97));var _0x13ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ca1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x13ca('0x0'))(_0x13ca('0x1'));var moment=require(_0x13ca('0x2'));var BPromise=require(_0x13ca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x13ca('0x4'));var config=require(_0x13ca('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0x13ca('0x6')]=function(_0x540a8b,_0x5f4c05){return _0x540a8b[_0x13ca('0x7')](_0x13ca('0x8'),attributes,{'tableName':_0x13ca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa408=['rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc88ea7,_0x166b0c){var _0x44b04e=function(_0x4d289f){while(--_0x4d289f){_0xc88ea7['push'](_0xc88ea7['shift']());}};_0x44b04e(++_0x166b0c);}(_0xa408,0xaf));var _0x8a40=function(_0x9b7a64,_0x38d4a8){_0x9b7a64=_0x9b7a64-0x0;var _0x33fd98=_0xa408[_0x9b7a64];return _0x33fd98;};'use strict';var _=require(_0x8a40('0x0'));var util=require(_0x8a40('0x1'));var logger=require(_0x8a40('0x2'))(_0x8a40('0x3'));var moment=require(_0x8a40('0x4'));var BPromise=require(_0x8a40('0x5'));var rp=require(_0x8a40('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a40('0x7'));var config=require(_0x8a40('0x8'));var attributes=require(_0x8a40('0x9'));module[_0x8a40('0xa')]=function(_0xb9f066,_0x496220){return _0xb9f066[_0x8a40('0xb')](_0x8a40('0xc'),attributes,{'tableName':_0x8a40('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 9614ebd..a5f9775 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 _0x881d=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','info'];(function(_0x4981e,_0x27182f){var _0x1c6533=function(_0x3196dd){while(--_0x3196dd){_0x4981e['push'](_0x4981e['shift']());}};_0x1c6533(++_0x27182f);}(_0x881d,0x13a));var _0xd881=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x881d[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0xd881('0x0'));var util=require(_0xd881('0x1'));var moment=require(_0xd881('0x2'));var BPromise=require('bluebird');var rs=require(_0xd881('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd881('0x4'))(_0xd881('0x5'));var config=require(_0xd881('0x6'));var jayson=require(_0xd881('0x7'));var client=jayson[_0xd881('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x545cc0,_0x1dbce6,_0x26ef32){return new BPromise(function(_0x4b673f,_0x419d13){return client['request'](_0x545cc0,_0x26ef32)['then'](function(_0x2c9339){logger[_0xd881('0x9')](_0xd881('0xa'),_0x1dbce6,_0xd881('0xb'));logger[_0xd881('0xc')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1dbce6,_0xd881('0xb'),JSON[_0xd881('0xd')](_0x2c9339));if(_0x2c9339[_0xd881('0xe')]){if(_0x2c9339[_0xd881('0xe')][_0xd881('0xf')]===0x1f4){logger[_0xd881('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1dbce6,_0x2c9339['error'][_0xd881('0x10')]);return _0x419d13(_0x2c9339['error'][_0xd881('0x10')]);}logger[_0xd881('0xe')](_0xd881('0xa'),_0x1dbce6,_0x2c9339[_0xd881('0xe')][_0xd881('0x10')]);return _0x4b673f(_0x2c9339['error'][_0xd881('0x10')]);}else{logger[_0xd881('0x9')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1dbce6,_0xd881('0xb'));_0x4b673f(_0x2c9339['result']['message']);}})[_0xd881('0x11')](function(_0x2e1c31){logger[_0xd881('0xe')](_0xd881('0xa'),_0x1dbce6,_0x2e1c31);_0x419d13(_0x2e1c31);});});} \ No newline at end of file +var _0x4cd5=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','util'];(function(_0x1bafb1,_0x3f4d43){var _0x1e9aa9=function(_0x34c867){while(--_0x34c867){_0x1bafb1['push'](_0x1bafb1['shift']());}};_0x1e9aa9(++_0x3f4d43);}(_0x4cd5,0x13a));var _0x54cd=function(_0x11ce54,_0x11837b){_0x11ce54=_0x11ce54-0x0;var _0x1b0229=_0x4cd5[_0x11ce54];return _0x1b0229;};'use strict';var _=require('lodash');var util=require(_0x54cd('0x0'));var moment=require(_0x54cd('0x1'));var BPromise=require(_0x54cd('0x2'));var rs=require(_0x54cd('0x3'));var fs=require('fs');var Redis=require(_0x54cd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x54cd('0x5'));var logger=require(_0x54cd('0x6'))(_0x54cd('0x7'));var config=require(_0x54cd('0x8'));var jayson=require(_0x54cd('0x9'));var client=jayson['client'][_0x54cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x498b00,_0x29b35c,_0x5f0dc9){return new BPromise(function(_0x5a4502,_0x17a29a){return client['request'](_0x498b00,_0x5f0dc9)['then'](function(_0x4e3bb5){logger[_0x54cd('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x29b35c,'request\x20sent');logger[_0x54cd('0xc')](_0x54cd('0xd'),_0x29b35c,_0x54cd('0xe'),JSON[_0x54cd('0xf')](_0x4e3bb5));if(_0x4e3bb5[_0x54cd('0x10')]){if(_0x4e3bb5[_0x54cd('0x10')][_0x54cd('0x11')]===0x1f4){logger[_0x54cd('0x10')](_0x54cd('0x12'),_0x29b35c,_0x4e3bb5[_0x54cd('0x10')]['message']);return _0x17a29a(_0x4e3bb5['error'][_0x54cd('0x13')]);}logger[_0x54cd('0x10')](_0x54cd('0x12'),_0x29b35c,_0x4e3bb5[_0x54cd('0x10')]['message']);return _0x5a4502(_0x4e3bb5['error'][_0x54cd('0x13')]);}else{logger[_0x54cd('0xb')](_0x54cd('0x12'),_0x29b35c,'request\x20sent');_0x5a4502(_0x4e3bb5[_0x54cd('0x14')]['message']);}})['catch'](function(_0x1401e1){logger[_0x54cd('0x10')](_0x54cd('0x12'),_0x29b35c,_0x1401e1);_0x17a29a(_0x1401e1);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 20a1170..4b4f145 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 _0xeb0d=['put','/:id','update','delete','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','create'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x4688f3,_0x36fa36){_0x4688f3=_0x4688f3-0x0;var _0x3cb0b9=_0xeb0d[_0x4688f3];return _0x3cb0b9;};'use strict';var multer=require(_0xdeb0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdeb0('0x1'));var router=express[_0xdeb0('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xdeb0('0x3'));var interaction=require(_0xdeb0('0x4'));var config=require(_0xdeb0('0x5'));var controller=require(_0xdeb0('0x6'));router[_0xdeb0('0x7')]('/',auth[_0xdeb0('0x8')](),controller[_0xdeb0('0x9')]);router[_0xdeb0('0x7')]('/:id',auth[_0xdeb0('0x8')](),controller[_0xdeb0('0xa')]);router['post']('/',auth[_0xdeb0('0x8')](),controller[_0xdeb0('0xb')]);router[_0xdeb0('0xc')](_0xdeb0('0xd'),auth[_0xdeb0('0x8')](),controller[_0xdeb0('0xe')]);router[_0xdeb0('0xf')](_0xdeb0('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xdeb0('0x10')]=router; \ No newline at end of file +var _0x0207=['update','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','index','get','/:id','isAuthenticated','show','post'];(function(_0x540841,_0x149d1f){var _0x58c65d=function(_0x3297d9){while(--_0x3297d9){_0x540841['push'](_0x540841['shift']());}};_0x58c65d(++_0x149d1f);}(_0x0207,0x162));var _0x7020=function(_0x134f00,_0x35829c){_0x134f00=_0x134f00-0x0;var _0x2e5f32=_0x0207[_0x134f00];return _0x2e5f32;};'use strict';var multer=require('multer');var util=require(_0x7020('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7020('0x1'));var router=express[_0x7020('0x2')]();var fs_extra=require(_0x7020('0x3'));var auth=require(_0x7020('0x4'));var interaction=require(_0x7020('0x5'));var config=require(_0x7020('0x6'));var controller=require(_0x7020('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7020('0x8')]);router[_0x7020('0x9')](_0x7020('0xa'),auth[_0x7020('0xb')](),controller[_0x7020('0xc')]);router[_0x7020('0xd')]('/',auth[_0x7020('0xb')](),controller['create']);router['put'](_0x7020('0xa'),auth[_0x7020('0xb')](),controller[_0x7020('0xe')]);router['delete'](_0x7020('0xa'),auth[_0x7020('0xb')](),controller['destroy']);module[_0x7020('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 2f537af..de2616b 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 _0x04f5=['exports','STRING','sequelize'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x04f5,0x1a9));var _0x504f=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0x04f5[_0x2e58c7];return _0x26eb00;};'use strict';var Sequelize=require(_0x504f('0x0'));module[_0x504f('0x1')]={'name':{'type':Sequelize[_0x504f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdf97=['STRING','name'];(function(_0x5ce268,_0x1835b6){var _0x28c96a=function(_0x18c1d6){while(--_0x18c1d6){_0x5ce268['push'](_0x5ce268['shift']());}};_0x28c96a(++_0x1835b6);}(_0xdf97,0x1c4));var _0x7df9=function(_0x96d000,_0x1830c3){_0x96d000=_0x96d000-0x0;var _0xc96352=_0xdf97[_0x96d000];return _0xc96352;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7df9('0x0')],'unique':_0x7df9('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 1e6580a..8e79fe9 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 _0x9ea9=['json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','index','map','Variable','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status'];(function(_0x4a1d3c,_0x44b199){var _0x390797=function(_0x5966a0){while(--_0x5966a0){_0x4a1d3c['push'](_0x4a1d3c['shift']());}};_0x390797(++_0x44b199);}(_0x9ea9,0xd0));var _0x99ea=function(_0x3f862b,_0x1bd186){_0x3f862b=_0x3f862b-0x0;var _0x11ca07=_0x9ea9[_0x3f862b];return _0x11ca07;};'use strict';var emlformat=require(_0x99ea('0x0'));var rimraf=require(_0x99ea('0x1'));var zipdir=require(_0x99ea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99ea('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x99ea('0x4'));var util=require(_0x99ea('0x5'));var path=require('path');var sox=require(_0x99ea('0x6'));var csv=require(_0x99ea('0x7'));var ejs=require(_0x99ea('0x8'));var fs=require('fs');var fs_extra=require(_0x99ea('0x9'));var _=require(_0x99ea('0xa'));var squel=require(_0x99ea('0xb'));var crypto=require(_0x99ea('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x99ea('0x7'));var querystring=require(_0x99ea('0xd'));var Papa=require(_0x99ea('0xe'));var Redis=require(_0x99ea('0xf'));var authService=require(_0x99ea('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x99ea('0x11'));var hardwareService=require(_0x99ea('0x12'));var logger=require(_0x99ea('0x13'))(_0x99ea('0x14'));var utils=require('../../config/utils');var config=require(_0x99ea('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x99ea('0x16'))['db'];function respondWithStatusCode(_0x4ba557,_0x54120a){_0x54120a=_0x54120a||0xcc;return function(_0x4445d1){if(_0x4445d1){return _0x4ba557[_0x99ea('0x17')](_0x54120a);}return _0x4ba557['status'](_0x54120a)[_0x99ea('0x18')]();};}function respondWithResult(_0x39642d,_0x43ba0a){_0x43ba0a=_0x43ba0a||0xc8;return function(_0x571b9a){if(_0x571b9a){return _0x39642d[_0x99ea('0x19')](_0x43ba0a)[_0x99ea('0x1a')](_0x571b9a);}};}function respondWithFilteredResult(_0x299689,_0x5eb7ee){return function(_0x73358d){if(_0x73358d){var _0x1cfce4=typeof _0x5eb7ee['offset']===_0x99ea('0x1b')&&typeof _0x5eb7ee[_0x99ea('0x1c')]===_0x99ea('0x1b');var _0x14072d=_0x73358d[_0x99ea('0x1d')];var _0x1022b7=_0x1cfce4?0x0:_0x5eb7ee[_0x99ea('0x1e')];var _0x1a7ab9=_0x1cfce4?_0x73358d[_0x99ea('0x1d')]:_0x5eb7ee['offset']+_0x5eb7ee[_0x99ea('0x1c')];var _0x1f5623;if(_0x1a7ab9>=_0x14072d){_0x1a7ab9=_0x14072d;_0x1f5623=0xc8;}else{_0x1f5623=0xce;}_0x299689[_0x99ea('0x19')](_0x1f5623);return _0x299689[_0x99ea('0x1f')](_0x99ea('0x20'),_0x1022b7+'-'+_0x1a7ab9+'/'+_0x14072d)[_0x99ea('0x1a')](_0x73358d);}return null;};}function patchUpdates(_0x35948f){return function(_0x4fd0b3){try{jsonpatch[_0x99ea('0x21')](_0x4fd0b3,_0x35948f,!![]);}catch(_0x37bf13){return BPromise['reject'](_0x37bf13);}return _0x4fd0b3[_0x99ea('0x22')]();};}function saveUpdates(_0xb32dc2,_0x12fe18){return function(_0x57e5fd){if(_0x57e5fd){return _0x57e5fd[_0x99ea('0x23')](_0xb32dc2)[_0x99ea('0x24')](function(_0x40956a){return _0x40956a;});}return null;};}function removeEntity(_0x2319ff,_0x52f1ab){return function(_0x2834cb){if(_0x2834cb){return _0x2834cb[_0x99ea('0x25')]()[_0x99ea('0x24')](function(){var _0x235e89=_0x2834cb[_0x99ea('0x26')]({'plain':!![]});var _0x144f53=_0x99ea('0x27');return db[_0x99ea('0x28')]['destroy']({'where':{'type':_0x144f53,'resourceId':_0x235e89['id']}})[_0x99ea('0x24')](function(){return _0x2834cb;});})[_0x99ea('0x24')](function(){_0x2319ff[_0x99ea('0x19')](0xcc)[_0x99ea('0x18')]();});}};}function handleEntityNotFound(_0x29118a,_0x1d7ef2){return function(_0x9c3174){if(!_0x9c3174){_0x29118a[_0x99ea('0x17')](0x194);}return _0x9c3174;};}function handleError(_0x39891e,_0x32618d){_0x32618d=_0x32618d||0x1f4;return function(_0x4a9c5a){logger[_0x99ea('0x29')](_0x4a9c5a[_0x99ea('0x2a')]);if(_0x4a9c5a[_0x99ea('0x2b')]){delete _0x4a9c5a[_0x99ea('0x2b')];}_0x39891e[_0x99ea('0x19')](_0x32618d)['send'](_0x4a9c5a);};}exports[_0x99ea('0x2c')]=function(_0x116dc3,_0x59eb3c){var _0x396a99={},_0x1e6836={},_0xe54f79={'count':0x0,'rows':[]};var _0xa711e9=_[_0x99ea('0x2d')](db[_0x99ea('0x2e')][_0x99ea('0x2f')],function(_0x449872){return{'name':_0x449872['fieldName'],'type':_0x449872[_0x99ea('0x30')][_0x99ea('0x31')]};});_0x1e6836[_0x99ea('0x32')]=_[_0x99ea('0x2d')](_0xa711e9,_0x99ea('0x2b'));_0x1e6836[_0x99ea('0x33')]=_[_0x99ea('0x34')](_0x116dc3[_0x99ea('0x33')]);_0x1e6836[_0x99ea('0x35')]=_[_0x99ea('0x36')](_0x1e6836[_0x99ea('0x32')],_0x1e6836[_0x99ea('0x33')]);_0x396a99[_0x99ea('0x37')]=_[_0x99ea('0x36')](_0x1e6836[_0x99ea('0x32')],qs[_0x99ea('0x38')](_0x116dc3[_0x99ea('0x33')][_0x99ea('0x38')]));_0x396a99['attributes']=_0x396a99[_0x99ea('0x37')][_0x99ea('0x39')]?_0x396a99[_0x99ea('0x37')]:_0x1e6836[_0x99ea('0x32')];if(!_0x116dc3['query'][_0x99ea('0x3a')](_0x99ea('0x3b'))){_0x396a99[_0x99ea('0x1c')]=qs[_0x99ea('0x1c')](_0x116dc3[_0x99ea('0x33')][_0x99ea('0x1c')]);_0x396a99['offset']=qs['offset'](_0x116dc3[_0x99ea('0x33')][_0x99ea('0x1e')]);}_0x396a99[_0x99ea('0x3c')]=qs['sort'](_0x116dc3['query'][_0x99ea('0x3d')]);_0x396a99[_0x99ea('0x3e')]=qs[_0x99ea('0x35')](_[_0x99ea('0x3f')](_0x116dc3[_0x99ea('0x33')],_0x1e6836[_0x99ea('0x35')]),_0xa711e9);if(_0x116dc3[_0x99ea('0x33')][_0x99ea('0x40')]){_0x396a99[_0x99ea('0x3e')]=_[_0x99ea('0x41')](_0x396a99[_0x99ea('0x3e')],{'$or':_[_0x99ea('0x2d')](_0xa711e9,function(_0x323c09){if(_0x323c09['type']!==_0x99ea('0x42')){var _0x3adb6b={};_0x3adb6b[_0x323c09[_0x99ea('0x2b')]]={'$like':'%'+_0x116dc3[_0x99ea('0x33')][_0x99ea('0x40')]+'%'};return _0x3adb6b;}})});}_0x396a99=_[_0x99ea('0x41')]({},_0x396a99,_0x116dc3[_0x99ea('0x43')]);var _0x173885={'where':_0x396a99['where']};return db[_0x99ea('0x2e')][_0x99ea('0x1d')](_0x173885)[_0x99ea('0x24')](function(_0x177580){_0xe54f79[_0x99ea('0x1d')]=_0x177580;if(_0x116dc3['query']['includeAll']){_0x396a99[_0x99ea('0x44')]=[{'all':!![]}];}return db[_0x99ea('0x2e')]['findAll'](_0x396a99);})[_0x99ea('0x24')](function(_0x456d84){_0xe54f79['rows']=_0x456d84;return _0xe54f79;})[_0x99ea('0x24')](respondWithFilteredResult(_0x59eb3c,_0x396a99))[_0x99ea('0x45')](handleError(_0x59eb3c,null));};exports['show']=function(_0x36793c,_0x28d54f){var _0x2710a8={'raw':!![],'where':{'id':_0x36793c[_0x99ea('0x46')]['id']}},_0x586d56={};_0x586d56[_0x99ea('0x32')]=_[_0x99ea('0x34')](db[_0x99ea('0x2e')][_0x99ea('0x2f')]);_0x586d56[_0x99ea('0x33')]=_[_0x99ea('0x34')](_0x36793c[_0x99ea('0x33')]);_0x586d56[_0x99ea('0x35')]=_[_0x99ea('0x36')](_0x586d56[_0x99ea('0x32')],_0x586d56[_0x99ea('0x33')]);_0x2710a8['attributes']=_['intersection'](_0x586d56[_0x99ea('0x32')],qs[_0x99ea('0x38')](_0x36793c[_0x99ea('0x33')][_0x99ea('0x38')]));_0x2710a8[_0x99ea('0x37')]=_0x2710a8[_0x99ea('0x37')]['length']?_0x2710a8[_0x99ea('0x37')]:_0x586d56[_0x99ea('0x32')];if(_0x36793c[_0x99ea('0x33')][_0x99ea('0x47')]){_0x2710a8[_0x99ea('0x44')]=[{'all':!![]}];}_0x2710a8=_[_0x99ea('0x41')]({},_0x2710a8,_0x36793c[_0x99ea('0x43')]);return db[_0x99ea('0x2e')][_0x99ea('0x48')](_0x2710a8)[_0x99ea('0x24')](handleEntityNotFound(_0x28d54f,null))['then'](respondWithResult(_0x28d54f,null))[_0x99ea('0x45')](handleError(_0x28d54f,null));};exports[_0x99ea('0x49')]=function(_0x1be19c,_0x3d020e){return db['Variable'][_0x99ea('0x49')](_0x1be19c['body'],{})[_0x99ea('0x24')](function(_0x3d1cd7){var _0x1b500d=_0x1be19c[_0x99ea('0x4a')]['get']({'plain':!![]});if(!_0x1b500d)throw new Error(_0x99ea('0x4b'));if(_0x1b500d[_0x99ea('0x4c')]===_0x99ea('0x4a')){var _0x238c0a=_0x3d1cd7['get']({'plain':!![]});var _0x1c58c1=_0x99ea('0x27');return db['UserProfileSection'][_0x99ea('0x48')]({'where':{'name':_0x1c58c1,'userProfileId':_0x1b500d['userProfileId']},'raw':!![]})['then'](function(_0x5b6f6f){if(_0x5b6f6f&&_0x5b6f6f['autoAssociation']===0x0){return db[_0x99ea('0x28')][_0x99ea('0x49')]({'name':_0x238c0a['name'],'resourceId':_0x238c0a['id'],'type':_0x5b6f6f[_0x99ea('0x2b')],'sectionId':_0x5b6f6f['id']},{})[_0x99ea('0x24')](function(){return _0x3d1cd7;});}else{return _0x3d1cd7;}})[_0x99ea('0x45')](function(_0x4681a5){logger[_0x99ea('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4681a5);throw _0x4681a5;});}return _0x3d1cd7;})[_0x99ea('0x24')](respondWithResult(_0x3d020e,0xc9))[_0x99ea('0x45')](handleError(_0x3d020e,null));};exports[_0x99ea('0x23')]=function(_0x258525,_0x414b22){if(_0x258525['body']['id']){delete _0x258525[_0x99ea('0x4d')]['id'];}return db[_0x99ea('0x2e')][_0x99ea('0x48')]({'where':{'id':_0x258525['params']['id']}})[_0x99ea('0x24')](handleEntityNotFound(_0x414b22,null))[_0x99ea('0x24')](saveUpdates(_0x258525[_0x99ea('0x4d')],null))[_0x99ea('0x24')](respondWithResult(_0x414b22,null))['catch'](handleError(_0x414b22,null));};exports[_0x99ea('0x25')]=function(_0xe781a9,_0x34e07e){return db[_0x99ea('0x2e')]['find']({'where':{'id':_0xe781a9[_0x99ea('0x46')]['id']}})[_0x99ea('0x24')](handleEntityNotFound(_0x34e07e,null))[_0x99ea('0x24')](removeEntity(_0x34e07e,null))[_0x99ea('0x45')](handleError(_0x34e07e,null));}; \ No newline at end of file +var _0x2dc4=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','type','key','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','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','zip-dir','fast-json-patch','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'];(function(_0x2c5b76,_0x3458d2){var _0x26b38d=function(_0x3b1b91){while(--_0x3b1b91){_0x2c5b76['push'](_0x2c5b76['shift']());}};_0x26b38d(++_0x3458d2);}(_0x2dc4,0x13d));var _0x42dc=function(_0xe5a40b,_0x5a054b){_0xe5a40b=_0xe5a40b-0x0;var _0x55493f=_0x2dc4[_0xe5a40b];return _0x55493f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x42dc('0x0'));var jsonpatch=require(_0x42dc('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x42dc('0x2'));var sox=require(_0x42dc('0x3'));var csv=require(_0x42dc('0x4'));var ejs=require(_0x42dc('0x5'));var fs=require('fs');var fs_extra=require(_0x42dc('0x6'));var _=require(_0x42dc('0x7'));var squel=require(_0x42dc('0x8'));var crypto=require(_0x42dc('0x9'));var jsforce=require(_0x42dc('0xa'));var deskjs=require(_0x42dc('0xb'));var toCsv=require(_0x42dc('0x4'));var querystring=require(_0x42dc('0xc'));var Papa=require(_0x42dc('0xd'));var Redis=require(_0x42dc('0xe'));var authService=require(_0x42dc('0xf'));var qs=require(_0x42dc('0x10'));var as=require(_0x42dc('0x11'));var hardwareService=require(_0x42dc('0x12'));var logger=require(_0x42dc('0x13'))(_0x42dc('0x14'));var utils=require(_0x42dc('0x15'));var config=require(_0x42dc('0x16'));var licenseUtil=require(_0x42dc('0x17'));var db=require(_0x42dc('0x18'))['db'];function respondWithStatusCode(_0x2ce1b1,_0x1ec2e8){_0x1ec2e8=_0x1ec2e8||0xcc;return function(_0x441af4){if(_0x441af4){return _0x2ce1b1['sendStatus'](_0x1ec2e8);}return _0x2ce1b1[_0x42dc('0x19')](_0x1ec2e8)[_0x42dc('0x1a')]();};}function respondWithResult(_0x38ad07,_0x22beec){_0x22beec=_0x22beec||0xc8;return function(_0x329edd){if(_0x329edd){return _0x38ad07[_0x42dc('0x19')](_0x22beec)[_0x42dc('0x1b')](_0x329edd);}};}function respondWithFilteredResult(_0x14ce48,_0x4ccf8d){return function(_0x157839){if(_0x157839){var _0x328a0d=typeof _0x4ccf8d[_0x42dc('0x1c')]===_0x42dc('0x1d')&&typeof _0x4ccf8d[_0x42dc('0x1e')]===_0x42dc('0x1d');var _0x578c39=_0x157839[_0x42dc('0x1f')];var _0x451a85=_0x328a0d?0x0:_0x4ccf8d['offset'];var _0x52a261=_0x328a0d?_0x157839[_0x42dc('0x1f')]:_0x4ccf8d['offset']+_0x4ccf8d[_0x42dc('0x1e')];var _0x2518d8;if(_0x52a261>=_0x578c39){_0x52a261=_0x578c39;_0x2518d8=0xc8;}else{_0x2518d8=0xce;}_0x14ce48[_0x42dc('0x19')](_0x2518d8);return _0x14ce48['set'](_0x42dc('0x20'),_0x451a85+'-'+_0x52a261+'/'+_0x578c39)[_0x42dc('0x1b')](_0x157839);}return null;};}function patchUpdates(_0x28d8b4){return function(_0x483b0e){try{jsonpatch[_0x42dc('0x21')](_0x483b0e,_0x28d8b4,!![]);}catch(_0x4c37d9){return BPromise['reject'](_0x4c37d9);}return _0x483b0e[_0x42dc('0x22')]();};}function saveUpdates(_0x3f65b7,_0x4cba03){return function(_0x1e5ed3){if(_0x1e5ed3){return _0x1e5ed3[_0x42dc('0x23')](_0x3f65b7)[_0x42dc('0x24')](function(_0x8c2cef){return _0x8c2cef;});}return null;};}function removeEntity(_0x41123d,_0xfc78e3){return function(_0x47344e){if(_0x47344e){return _0x47344e[_0x42dc('0x25')]()[_0x42dc('0x24')](function(){var _0x222db7=_0x47344e[_0x42dc('0x26')]({'plain':!![]});var _0x52329b=_0x42dc('0x27');return db[_0x42dc('0x28')][_0x42dc('0x25')]({'where':{'type':_0x52329b,'resourceId':_0x222db7['id']}})[_0x42dc('0x24')](function(){return _0x47344e;});})['then'](function(){_0x41123d[_0x42dc('0x19')](0xcc)[_0x42dc('0x1a')]();});}};}function handleEntityNotFound(_0x481efa,_0x13cff7){return function(_0x212a58){if(!_0x212a58){_0x481efa['sendStatus'](0x194);}return _0x212a58;};}function handleError(_0x247762,_0x481f41){_0x481f41=_0x481f41||0x1f4;return function(_0x372a73){logger[_0x42dc('0x29')](_0x372a73[_0x42dc('0x2a')]);if(_0x372a73['name']){delete _0x372a73[_0x42dc('0x2b')];}_0x247762[_0x42dc('0x19')](_0x481f41)[_0x42dc('0x2c')](_0x372a73);};}exports[_0x42dc('0x2d')]=function(_0x1c2a79,_0x35867c){var _0x41405b={},_0x3e2a46={},_0x1ed720={'count':0x0,'rows':[]};var _0x21bb82=_[_0x42dc('0x2e')](db[_0x42dc('0x2f')]['rawAttributes'],function(_0x2b5e73){return{'name':_0x2b5e73['fieldName'],'type':_0x2b5e73[_0x42dc('0x30')][_0x42dc('0x31')]};});_0x3e2a46[_0x42dc('0x32')]=_[_0x42dc('0x2e')](_0x21bb82,_0x42dc('0x2b'));_0x3e2a46['query']=_[_0x42dc('0x33')](_0x1c2a79[_0x42dc('0x34')]);_0x3e2a46['filters']=_[_0x42dc('0x35')](_0x3e2a46[_0x42dc('0x32')],_0x3e2a46[_0x42dc('0x34')]);_0x41405b[_0x42dc('0x36')]=_[_0x42dc('0x35')](_0x3e2a46['model'],qs['fields'](_0x1c2a79['query']['fields']));_0x41405b['attributes']=_0x41405b[_0x42dc('0x36')][_0x42dc('0x37')]?_0x41405b[_0x42dc('0x36')]:_0x3e2a46['model'];if(!_0x1c2a79['query'][_0x42dc('0x38')](_0x42dc('0x39'))){_0x41405b[_0x42dc('0x1e')]=qs[_0x42dc('0x1e')](_0x1c2a79[_0x42dc('0x34')][_0x42dc('0x1e')]);_0x41405b[_0x42dc('0x1c')]=qs[_0x42dc('0x1c')](_0x1c2a79['query']['offset']);}_0x41405b[_0x42dc('0x3a')]=qs['sort'](_0x1c2a79[_0x42dc('0x34')][_0x42dc('0x3b')]);_0x41405b[_0x42dc('0x3c')]=qs['filters'](_[_0x42dc('0x3d')](_0x1c2a79['query'],_0x3e2a46[_0x42dc('0x3e')]),_0x21bb82);if(_0x1c2a79[_0x42dc('0x34')]['filter']){_0x41405b['where']=_['merge'](_0x41405b[_0x42dc('0x3c')],{'$or':_[_0x42dc('0x2e')](_0x21bb82,function(_0x2d64fd){if(_0x2d64fd[_0x42dc('0x30')]!=='VIRTUAL'){var _0x58c8fe={};_0x58c8fe[_0x2d64fd[_0x42dc('0x2b')]]={'$like':'%'+_0x1c2a79['query'][_0x42dc('0x3f')]+'%'};return _0x58c8fe;}})});}_0x41405b=_['merge']({},_0x41405b,_0x1c2a79[_0x42dc('0x40')]);var _0x457729={'where':_0x41405b[_0x42dc('0x3c')]};return db[_0x42dc('0x2f')][_0x42dc('0x1f')](_0x457729)[_0x42dc('0x24')](function(_0x30bf94){_0x1ed720[_0x42dc('0x1f')]=_0x30bf94;if(_0x1c2a79[_0x42dc('0x34')][_0x42dc('0x41')]){_0x41405b[_0x42dc('0x42')]=[{'all':!![]}];}return db[_0x42dc('0x2f')][_0x42dc('0x43')](_0x41405b);})[_0x42dc('0x24')](function(_0x399901){_0x1ed720[_0x42dc('0x44')]=_0x399901;return _0x1ed720;})[_0x42dc('0x24')](respondWithFilteredResult(_0x35867c,_0x41405b))['catch'](handleError(_0x35867c,null));};exports[_0x42dc('0x45')]=function(_0x2f1488,_0xec1f70){var _0x3fd5fc={'raw':!![],'where':{'id':_0x2f1488[_0x42dc('0x46')]['id']}},_0x1a8f3a={};_0x1a8f3a[_0x42dc('0x32')]=_[_0x42dc('0x33')](db[_0x42dc('0x2f')][_0x42dc('0x47')]);_0x1a8f3a[_0x42dc('0x34')]=_[_0x42dc('0x33')](_0x2f1488[_0x42dc('0x34')]);_0x1a8f3a['filters']=_[_0x42dc('0x35')](_0x1a8f3a['model'],_0x1a8f3a[_0x42dc('0x34')]);_0x3fd5fc[_0x42dc('0x36')]=_[_0x42dc('0x35')](_0x1a8f3a[_0x42dc('0x32')],qs[_0x42dc('0x48')](_0x2f1488[_0x42dc('0x34')]['fields']));_0x3fd5fc[_0x42dc('0x36')]=_0x3fd5fc['attributes'][_0x42dc('0x37')]?_0x3fd5fc[_0x42dc('0x36')]:_0x1a8f3a[_0x42dc('0x32')];if(_0x2f1488[_0x42dc('0x34')][_0x42dc('0x41')]){_0x3fd5fc[_0x42dc('0x42')]=[{'all':!![]}];}_0x3fd5fc=_['merge']({},_0x3fd5fc,_0x2f1488['options']);return db[_0x42dc('0x2f')][_0x42dc('0x49')](_0x3fd5fc)[_0x42dc('0x24')](handleEntityNotFound(_0xec1f70,null))[_0x42dc('0x24')](respondWithResult(_0xec1f70,null))[_0x42dc('0x4a')](handleError(_0xec1f70,null));};exports[_0x42dc('0x4b')]=function(_0x47ef1e,_0x1ce526){return db[_0x42dc('0x2f')][_0x42dc('0x4b')](_0x47ef1e[_0x42dc('0x4c')],{})[_0x42dc('0x24')](function(_0x1a6f1f){var _0x27de3f=_0x47ef1e[_0x42dc('0x4d')][_0x42dc('0x26')]({'plain':!![]});if(!_0x27de3f)throw new Error(_0x42dc('0x4e'));if(_0x27de3f[_0x42dc('0x4f')]==='user'){var _0x261479=_0x1a6f1f[_0x42dc('0x26')]({'plain':!![]});var _0x402d2a=_0x42dc('0x27');return db[_0x42dc('0x50')][_0x42dc('0x49')]({'where':{'name':_0x402d2a,'userProfileId':_0x27de3f[_0x42dc('0x51')]},'raw':!![]})[_0x42dc('0x24')](function(_0x1948dc){if(_0x1948dc&&_0x1948dc[_0x42dc('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x261479[_0x42dc('0x2b')],'resourceId':_0x261479['id'],'type':_0x1948dc[_0x42dc('0x2b')],'sectionId':_0x1948dc['id']},{})[_0x42dc('0x24')](function(){return _0x1a6f1f;});}else{return _0x1a6f1f;}})[_0x42dc('0x4a')](function(_0x49ab43){logger[_0x42dc('0x29')](_0x42dc('0x53'),_0x49ab43);throw _0x49ab43;});}return _0x1a6f1f;})['then'](respondWithResult(_0x1ce526,0xc9))[_0x42dc('0x4a')](handleError(_0x1ce526,null));};exports[_0x42dc('0x23')]=function(_0x490c25,_0x56fa57){if(_0x490c25[_0x42dc('0x4c')]['id']){delete _0x490c25[_0x42dc('0x4c')]['id'];}return db['Variable'][_0x42dc('0x49')]({'where':{'id':_0x490c25[_0x42dc('0x46')]['id']}})[_0x42dc('0x24')](handleEntityNotFound(_0x56fa57,null))['then'](saveUpdates(_0x490c25[_0x42dc('0x4c')],null))['then'](respondWithResult(_0x56fa57,null))[_0x42dc('0x4a')](handleError(_0x56fa57,null));};exports[_0x42dc('0x25')]=function(_0x2e8ade,_0x4d3026){return db[_0x42dc('0x2f')][_0x42dc('0x49')]({'where':{'id':_0x2e8ade[_0x42dc('0x46')]['id']}})[_0x42dc('0x24')](handleEntityNotFound(_0x4d3026,null))[_0x42dc('0x24')](removeEntity(_0x4d3026,null))[_0x42dc('0x4a')](handleError(_0x4d3026,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 281354e..529b592 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 _0x8ec3=['lodash','util','api','bluebird','request-promise','path','rimraf','./variable.attributes','exports','define','Variable'];(function(_0x34ddf5,_0x36838b){var _0x29b34c=function(_0x228efe){while(--_0x228efe){_0x34ddf5['push'](_0x34ddf5['shift']());}};_0x29b34c(++_0x36838b);}(_0x8ec3,0x14a));var _0x38ec=function(_0x397fb4,_0x2a00f0){_0x397fb4=_0x397fb4-0x0;var _0xe202a1=_0x8ec3[_0x397fb4];return _0xe202a1;};'use strict';var _=require(_0x38ec('0x0'));var util=require(_0x38ec('0x1'));var logger=require('../../config/logger')(_0x38ec('0x2'));var moment=require('moment');var BPromise=require(_0x38ec('0x3'));var rp=require(_0x38ec('0x4'));var fs=require('fs');var path=require(_0x38ec('0x5'));var rimraf=require(_0x38ec('0x6'));var config=require('../../config/environment');var attributes=require(_0x38ec('0x7'));module[_0x38ec('0x8')]=function(_0x1ee289,_0x21a76c){return _0x1ee289[_0x38ec('0x9')](_0x38ec('0xa'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x826b=['exports','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./variable.attributes'];(function(_0x48478f,_0x537acd){var _0x10af50=function(_0x4cf0ac){while(--_0x4cf0ac){_0x48478f['push'](_0x48478f['shift']());}};_0x10af50(++_0x537acd);}(_0x826b,0xcf));var _0xb826=function(_0x3d5a6a,_0x54b4d0){_0x3d5a6a=_0x3d5a6a-0x0;var _0x3570d9=_0x826b[_0x3d5a6a];return _0x3570d9;};'use strict';var _=require(_0xb826('0x0'));var util=require(_0xb826('0x1'));var logger=require(_0xb826('0x2'))(_0xb826('0x3'));var moment=require(_0xb826('0x4'));var BPromise=require(_0xb826('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb826('0x6'));var config=require(_0xb826('0x7'));var attributes=require(_0xb826('0x8'));module[_0xb826('0x9')]=function(_0x3aa739,_0x1f5dab){return _0x3aa739['define'](_0xb826('0xa'),attributes,{'tableName':_0xb826('0xb'),'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 6972a65..950e855 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 _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x339fb4,_0x407ec9){var _0x2f57e6=function(_0xf2329b){while(--_0xf2329b){_0x339fb4['push'](_0x339fb4['shift']());}};_0x2f57e6(++_0x407ec9);}(_0xabce,0x103));var _0xeabc=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xabce[_0x433a86];return _0x23000c;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file +var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x54c9fa,_0x538544){var _0x2a01a2=function(_0xcc61cd){while(--_0xcc61cd){_0x54c9fa['push'](_0x54c9fa['shift']());}};_0x2a01a2(++_0x538544);}(_0x6aa7,0x178));var _0x76aa=function(_0x3cc7bb,_0x19e2fd){_0x3cc7bb=_0x3cc7bb-0x0;var _0x18d8a8=_0x6aa7[_0x3cc7bb];return _0x18d8a8;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 8cc24f0..eac3428 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 _0x0e07=['pull','/restart','restart','/migrations','migrations','exports','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull'];(function(_0xe50267,_0x1c32f1){var _0x4e1590=function(_0x224933){while(--_0x224933){_0xe50267['push'](_0xe50267['shift']());}};_0x4e1590(++_0x1c32f1);}(_0x0e07,0xc9));var _0x70e0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0e07[_0x3bf83f];return _0x22c4a9;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x70e0('0x0'));var controller=require(_0x70e0('0x1'));router[_0x70e0('0x2')]('/',controller['index']);router[_0x70e0('0x2')](_0x70e0('0x3'),auth[_0x70e0('0x4')](),auth[_0x70e0('0x5')](),controller[_0x70e0('0x6')]);router[_0x70e0('0x2')](_0x70e0('0x7'),auth[_0x70e0('0x4')](),auth[_0x70e0('0x5')](),controller['reset']);router[_0x70e0('0x2')](_0x70e0('0x8'),auth[_0x70e0('0x4')](),auth[_0x70e0('0x5')](),controller[_0x70e0('0x9')]);router[_0x70e0('0x2')](_0x70e0('0xa'),auth[_0x70e0('0x4')](),controller[_0x70e0('0xb')]);router[_0x70e0('0x2')](_0x70e0('0xc'),controller[_0x70e0('0xd')]);module[_0x70e0('0xe')]=router; \ No newline at end of file +var _0x5b38=['/pull','pull','migrations','exports','express','../../components/auth/service','get','index','isAuthenticated','fetch','canUpdate'];(function(_0x2ac35b,_0x2031d5){var _0x11653d=function(_0x558a04){while(--_0x558a04){_0x2ac35b['push'](_0x2ac35b['shift']());}};_0x11653d(++_0x2031d5);}(_0x5b38,0x12d));var _0x85b3=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5b38[_0x5b644e];return _0x49c6bf;};'use strict';var express=require(_0x85b3('0x0'));var router=express['Router']();var auth=require(_0x85b3('0x1'));var controller=require('./version.controller');router[_0x85b3('0x2')]('/',controller[_0x85b3('0x3')]);router[_0x85b3('0x2')]('/fetch',auth[_0x85b3('0x4')](),auth['canUpdate'](),controller[_0x85b3('0x5')]);router[_0x85b3('0x2')]('/reset',auth[_0x85b3('0x4')](),auth[_0x85b3('0x6')](),controller['reset']);router[_0x85b3('0x2')](_0x85b3('0x7'),auth[_0x85b3('0x4')](),auth[_0x85b3('0x6')](),controller[_0x85b3('0x8')]);router[_0x85b3('0x2')]('/restart',auth[_0x85b3('0x4')](),controller['restart']);router[_0x85b3('0x2')]('/migrations',controller[_0x85b3('0x9')]);module[_0x85b3('0xa')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 406056c..bc8746f 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 _0xdaf2=['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','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','compare-versions','exec','../../mysqldb','../../config/environment','../../config/logger','simple-git','root','exports','version','query','latest','fetch','status','json','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor'];(function(_0x50bbe8,_0x260b4a){var _0x38bd00=function(_0x56d0d6){while(--_0x56d0d6){_0x50bbe8['push'](_0x50bbe8['shift']());}};_0x38bd00(++_0x260b4a);}(_0xdaf2,0xb8));var _0x2daf=function(_0x47df54,_0x1aeb61){_0x47df54=_0x47df54-0x0;var _0x261b87=_0xdaf2[_0x47df54];return _0x261b87;};'use strict';var Umzug=require(_0x2daf('0x0'));var path=require(_0x2daf('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x2daf('0x2'))(module,'version');var compareVersions=require(_0x2daf('0x3'));var exec=require('child_process')[_0x2daf('0x4')];var db=require(_0x2daf('0x5'))['db'];var config=require(_0x2daf('0x6'));var pm2=require('../../config/pm2');var logger=require(_0x2daf('0x7'))('update');var git=require(_0x2daf('0x8'))(config[_0x2daf('0x9')]);exports['index']=function(_0x4775dc,_0x19ba24){var _0x43ead3={'current':module[_0x2daf('0xa')][_0x2daf('0xb')],'phonebar':0x2};if(_0x4775dc[_0x2daf('0xc')]&&_0x4775dc[_0x2daf('0xc')][_0x2daf('0xd')]){return git[_0x2daf('0xe')]()['tags'](function(_0x41e1e8,_0x2a4966){_0x43ead3[_0x2daf('0xd')]=(_0x41e1e8?module['exports'][_0x2daf('0xb')]:_0x2a4966[_0x2daf('0xd')])||'2.0.0';return _0x19ba24[_0x2daf('0xf')](0xc8)[_0x2daf('0x10')](_0x43ead3);});}else{return _0x19ba24[_0x2daf('0xf')](0xc8)[_0x2daf('0x10')](_0x43ead3);}};exports[_0x2daf('0xe')]=function(_0x33573a,_0x1dd0c5){return git[_0x2daf('0xe')](['origin','master'],function(_0x4b10da){if(_0x4b10da){logger[_0x2daf('0x11')](_0x4b10da);return _0x1dd0c5[_0x2daf('0xf')](0x1f4)[_0x2daf('0x10')](_0x4b10da);}logger[_0x2daf('0x12')](_0x2daf('0x13'));return _0x1dd0c5['status'](0xc8)[_0x2daf('0x10')]({'output':_0x2daf('0x14')});});};exports[_0x2daf('0x15')]=function(_0xaaf27e,_0x1c28cd){return git[_0x2daf('0x15')](['--hard','FETCH_HEAD'],function(_0x2e81cc){if(_0x2e81cc){logger[_0x2daf('0x11')](_0x2e81cc);return _0x1c28cd[_0x2daf('0xf')](0x1f4)[_0x2daf('0x10')](_0x2e81cc);}logger[_0x2daf('0x12')](_0x2daf('0x16'));return _0x1c28cd[_0x2daf('0xf')](0xc8)[_0x2daf('0x10')]({'output':_0x2daf('0x17')});});};exports['pull']=function(_0x548eff,_0x278191){exec('npm\x20install\x20--production',function(_0x576225,_0x2eb565,_0x1aef5a){logger[_0x2daf('0x12')](_0x2eb565);logger['info'](_0x1aef5a);if(_0x576225){logger[_0x2daf('0x11')](_0x576225);return _0x278191[_0x2daf('0xf')](0x1f4)[_0x2daf('0x10')](_0x576225);}return _0x278191[_0x2daf('0xf')](0xc8)['json']({'output':_0x2eb565});});};exports[_0x2daf('0x18')]=function(_0x860e4f,_0x696cd4){return pm2['restart']('motion2')[_0x2daf('0x19')](function(_0x5deef5){logger[_0x2daf('0x12')](_0x2daf('0x1a'),_0x5deef5);return _0x696cd4[_0x2daf('0xf')](0xc8)[_0x2daf('0x10')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x2daf('0x1b')](function(_0x427092){logger[_0x2daf('0x11')](_0x427092);return _0x696cd4[_0x2daf('0xf')](0x1f4)[_0x2daf('0x10')](_0x427092);});};exports[_0x2daf('0x1c')]=function(_0x39c53d,_0x63e9ad){var _0x550d49=fs[_0x2daf('0x1d')](path[_0x2daf('0x1e')](config[_0x2daf('0x9')],_0x2daf('0x1f'),'migrations'));var _0x127f31=[];for(var _0x3848a9=0x0;_0x3848a9<_0x550d49[_0x2daf('0x20')];_0x3848a9++){var _0x4d3159=_0x550d49[_0x3848a9][_0x2daf('0x21')](_0x2daf('0x22'),'');if(compareVersions(module[_0x2daf('0xa')][_0x2daf('0xb')],_0x4d3159)===-0x1){_0x127f31[_0x2daf('0x23')](_0x4d3159);}}if(_0x127f31[_0x2daf('0x20')]){var _0x5b47b3=_0x127f31[_0x2daf('0x24')](compareVersions);var _0x5d8778=new Umzug({'storage':_0x2daf('0x25'),'storageOptions':{'model':db[_0x2daf('0x26')],'modelName':_0x2daf('0x26'),'columnName':'version'},'migrations':{'params':[db[_0x2daf('0x25')][_0x2daf('0x27')](),db[_0x2daf('0x25')][_0x2daf('0x28')],function(){throw new Error(_0x2daf('0x29'));}],'path':path[_0x2daf('0x1e')](config[_0x2daf('0x9')],_0x2daf('0x1f'),_0x2daf('0x1c')),'pattern':/\.js$/}});_0x5d8778['up']({'migrations':_['map'](_0x5b47b3,function(_0x93daa6){return _0x93daa6+_0x2daf('0x22');})})['then'](function(){return _0x63e9ad[_0x2daf('0xf')](0xc8)[_0x2daf('0x10')]({'output':_0x2daf('0x2a')+module[_0x2daf('0xa')][_0x2daf('0xb')]+'\x20to\x20'+_['last'](_0x5b47b3),'migrations':_['join'](_0x5b47b3)});})['catch'](function(_0x1dd1d3){if(_0x1dd1d3 instanceof db['sequelize'][_0x2daf('0x2b')]){return _0x63e9ad[_0x2daf('0xf')](0xc8)[_0x2daf('0x10')]({'output':_0x2daf('0x2c')});}else{return _0x63e9ad['status'](0x1f4)[_0x2daf('0x10')](_0x1dd1d3);}});}else{return _0x63e9ad[_0x2daf('0xf')](0xc8)['json']({'output':_0x2daf('0x2c')});}}; \ No newline at end of file +var _0xa975=['index','exports','query','latest','tags','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','.js','version','push','length','Migration','getQueryInterface','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root'];(function(_0x3949a7,_0x25c840){var _0x5ba05f=function(_0x2717ff){while(--_0x2717ff){_0x3949a7['push'](_0x3949a7['shift']());}};_0x5ba05f(++_0x25c840);}(_0xa975,0x1ec));var _0x5a97=function(_0xe05aa5,_0x273667){_0xe05aa5=_0xe05aa5-0x0;var _0x327420=_0xa975[_0xe05aa5];return _0x327420;};'use strict';var Umzug=require(_0x5a97('0x0'));var path=require(_0x5a97('0x1'));var fs=require('fs');var _=require(_0x5a97('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x5a97('0x3'));var exec=require(_0x5a97('0x4'))[_0x5a97('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x5a97('0x6'));var pm2=require(_0x5a97('0x7'));var logger=require(_0x5a97('0x8'))(_0x5a97('0x9'));var git=require(_0x5a97('0xa'))(config[_0x5a97('0xb')]);exports[_0x5a97('0xc')]=function(_0x4791d6,_0xcf9bd){var _0x44429e={'current':module[_0x5a97('0xd')]['version'],'phonebar':0x2};if(_0x4791d6[_0x5a97('0xe')]&&_0x4791d6['query'][_0x5a97('0xf')]){return git['fetch']()[_0x5a97('0x10')](function(_0x3b628f,_0x156b3c){_0x44429e[_0x5a97('0xf')]=(_0x3b628f?module['exports']['version']:_0x156b3c[_0x5a97('0xf')])||_0x5a97('0x11');return _0xcf9bd[_0x5a97('0x12')](0xc8)[_0x5a97('0x13')](_0x44429e);});}else{return _0xcf9bd[_0x5a97('0x12')](0xc8)[_0x5a97('0x13')](_0x44429e);}};exports[_0x5a97('0x14')]=function(_0x4c5237,_0x178a9e){return git[_0x5a97('0x14')]([_0x5a97('0x15'),_0x5a97('0x16')],function(_0x5d69d4){if(_0x5d69d4){logger[_0x5a97('0x17')](_0x5d69d4);return _0x178a9e[_0x5a97('0x12')](0x1f4)[_0x5a97('0x13')](_0x5d69d4);}logger[_0x5a97('0x18')](_0x5a97('0x19'));return _0x178a9e[_0x5a97('0x12')](0xc8)[_0x5a97('0x13')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x59b859,_0x42fc00){return git[_0x5a97('0x1a')]([_0x5a97('0x1b'),_0x5a97('0x1c')],function(_0x186a45){if(_0x186a45){logger['error'](_0x186a45);return _0x42fc00[_0x5a97('0x12')](0x1f4)[_0x5a97('0x13')](_0x186a45);}logger[_0x5a97('0x18')](_0x5a97('0x1d'));return _0x42fc00['status'](0xc8)['json']({'output':_0x5a97('0x1e')});});};exports[_0x5a97('0x1f')]=function(_0x1ab38c,_0x5d7c4f){exec('npm\x20install\x20--production',function(_0x4e5785,_0x15c2c2,_0xbde1a8){logger[_0x5a97('0x18')](_0x15c2c2);logger[_0x5a97('0x18')](_0xbde1a8);if(_0x4e5785){logger[_0x5a97('0x17')](_0x4e5785);return _0x5d7c4f[_0x5a97('0x12')](0x1f4)[_0x5a97('0x13')](_0x4e5785);}return _0x5d7c4f['status'](0xc8)[_0x5a97('0x13')]({'output':_0x15c2c2});});};exports[_0x5a97('0x20')]=function(_0x19faaa,_0x15158b){return pm2[_0x5a97('0x20')](_0x5a97('0x21'))[_0x5a97('0x22')](function(_0x4e858e){logger[_0x5a97('0x18')](_0x5a97('0x23'),_0x4e858e);return _0x15158b[_0x5a97('0x12')](0xc8)[_0x5a97('0x13')]({'output':_0x5a97('0x24')});})[_0x5a97('0x25')](function(_0x4887a0){logger['error'](_0x4887a0);return _0x15158b[_0x5a97('0x12')](0x1f4)[_0x5a97('0x13')](_0x4887a0);});};exports[_0x5a97('0x26')]=function(_0x2cbd81,_0x4bcbce){var _0x3c2a05=fs[_0x5a97('0x27')](path[_0x5a97('0x28')](config[_0x5a97('0xb')],_0x5a97('0x29'),_0x5a97('0x26')));var _0x1bc2a5=[];for(var _0x39db6e=0x0;_0x39db6e<_0x3c2a05['length'];_0x39db6e++){var _0x324623=_0x3c2a05[_0x39db6e]['replace'](_0x5a97('0x2a'),'');if(compareVersions(module[_0x5a97('0xd')][_0x5a97('0x2b')],_0x324623)===-0x1){_0x1bc2a5[_0x5a97('0x2c')](_0x324623);}}if(_0x1bc2a5[_0x5a97('0x2d')]){var _0x1e56e4=_0x1bc2a5['sort'](compareVersions);var _0x222423=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x5a97('0x2e')],'modelName':_0x5a97('0x2e'),'columnName':_0x5a97('0x2b')},'migrations':{'params':[db['sequelize'][_0x5a97('0x2f')](),db[_0x5a97('0x30')][_0x5a97('0x31')],function(){throw new Error(_0x5a97('0x32'));}],'path':path[_0x5a97('0x28')](config[_0x5a97('0xb')],_0x5a97('0x29'),_0x5a97('0x26')),'pattern':/\.js$/}});_0x222423['up']({'migrations':_[_0x5a97('0x33')](_0x1e56e4,function(_0x3e3817){return _0x3e3817+_0x5a97('0x2a');})})[_0x5a97('0x22')](function(){return _0x4bcbce[_0x5a97('0x12')](0xc8)[_0x5a97('0x13')]({'output':_0x5a97('0x34')+module[_0x5a97('0xd')][_0x5a97('0x2b')]+_0x5a97('0x35')+_['last'](_0x1e56e4),'migrations':_[_0x5a97('0x28')](_0x1e56e4)});})[_0x5a97('0x25')](function(_0x4d1c04){if(_0x4d1c04 instanceof db[_0x5a97('0x30')][_0x5a97('0x36')]){return _0x4bcbce[_0x5a97('0x12')](0xc8)[_0x5a97('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x4bcbce[_0x5a97('0x12')](0x1f4)[_0x5a97('0x13')](_0x4d1c04);}});}else{return _0x4bcbce[_0x5a97('0x12')](0xc8)['json']({'output':_0x5a97('0x37')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index c6ad569..dac7c0a 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 _0x5080=['put','update','delete','destroy','multer','util','path','express','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','/:id','post','create'];(function(_0x470cdd,_0x4708cd){var _0x57fda7=function(_0x171462){while(--_0x171462){_0x470cdd['push'](_0x470cdd['shift']());}};_0x57fda7(++_0x4708cd);}(_0x5080,0x158));var _0x0508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5080[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0508('0x0'));var util=require(_0x0508('0x1'));var path=require(_0x0508('0x2'));var timeout=require('connect-timeout');var express=require(_0x0508('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0508('0x4'));var config=require('../../config/environment');var controller=require(_0x0508('0x5'));router[_0x0508('0x6')]('/',auth[_0x0508('0x7')](),controller[_0x0508('0x8')]);router[_0x0508('0x6')](_0x0508('0x9'),auth[_0x0508('0x7')](),controller['describe']);router[_0x0508('0x6')](_0x0508('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0508('0xb')]('/',auth[_0x0508('0x7')](),controller[_0x0508('0xc')]);router[_0x0508('0xd')]('/:id',auth[_0x0508('0x7')](),controller[_0x0508('0xe')]);router[_0x0508('0xf')](_0x0508('0xa'),auth[_0x0508('0x7')](),controller[_0x0508('0x10')]);module['exports']=router; \ No newline at end of file +var _0x460c=['update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0xb8fbc7,_0x3e256a){var _0x112f84=function(_0x417091){while(--_0x417091){_0xb8fbc7['push'](_0xb8fbc7['shift']());}};_0x112f84(++_0x3e256a);}(_0x460c,0xff));var _0xc460=function(_0x3aa467,_0x130eef){_0x3aa467=_0x3aa467-0x0;var _0x50e52a=_0x460c[_0x3aa467];return _0x50e52a;};'use strict';var multer=require(_0xc460('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc460('0x1'));var express=require(_0xc460('0x2'));var router=express[_0xc460('0x3')]();var fs_extra=require(_0xc460('0x4'));var auth=require(_0xc460('0x5'));var interaction=require(_0xc460('0x6'));var config=require(_0xc460('0x7'));var controller=require(_0xc460('0x8'));router[_0xc460('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc460('0xa'),auth[_0xc460('0xb')](),controller[_0xc460('0xc')]);router['get'](_0xc460('0xd'),auth[_0xc460('0xb')](),controller[_0xc460('0xe')]);router[_0xc460('0xf')]('/',auth[_0xc460('0xb')](),controller[_0xc460('0x10')]);router[_0xc460('0x11')](_0xc460('0xd'),auth[_0xc460('0xb')](),controller[_0xc460('0x12')]);router[_0xc460('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xc460('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 dea0ff4..01151ce 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 _0x0bb4=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x26012f,_0xbeda9f){var _0x38b10f=function(_0xd82943){while(--_0xd82943){_0x26012f['push'](_0x26012f['shift']());}};_0x38b10f(++_0xbeda9f);}(_0x0bb4,0x77));var _0x40bb=function(_0x45d5dc,_0x5048ef){_0x45d5dc=_0x45d5dc-0x0;var _0x1174a3=_0x0bb4[_0x45d5dc];return _0x1174a3;};'use strict';var Sequelize=require(_0x40bb('0x0'));module[_0x40bb('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x40bb('0x2')]},'calleridnum':{'type':Sequelize[_0x40bb('0x2')]},'calleridname':{'type':Sequelize[_0x40bb('0x2')]},'queue':{'type':Sequelize[_0x40bb('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x40bb('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x40bb('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x40bb('0x3')]},'agentdumpAt':{'type':Sequelize[_0x40bb('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x40bb('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x40bb('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x40bb('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x40bb('0x5')]},'reason':{'type':Sequelize[_0x40bb('0x2')]},'lastevent':{'type':Sequelize[_0x40bb('0x2')]},'channel':{'type':Sequelize[_0x40bb('0x2')]},'channelstate':{'type':Sequelize[_0x40bb('0x5')]},'channelstatedesc':{'type':Sequelize[_0x40bb('0x2')]},'connectedlinenum':{'type':Sequelize[_0x40bb('0x2')]},'connectedlinename':{'type':Sequelize[_0x40bb('0x2')]},'language':{'type':Sequelize[_0x40bb('0x2')]},'accountcode':{'type':Sequelize[_0x40bb('0x2')]},'context':{'type':Sequelize[_0x40bb('0x2')]},'exten':{'type':Sequelize[_0x40bb('0x2')]},'priority':{'type':Sequelize[_0x40bb('0x2')]},'destchannel':{'type':Sequelize[_0x40bb('0x2')]},'destchannelstate':{'type':Sequelize[_0x40bb('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x40bb('0x2')]},'destcalleridnum':{'type':Sequelize[_0x40bb('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x40bb('0x2')]},'destlanguage':{'type':Sequelize[_0x40bb('0x2')]},'destaccountcode':{'type':Sequelize[_0x40bb('0x2')]},'destcontext':{'type':Sequelize[_0x40bb('0x2')]},'destexten':{'type':Sequelize[_0x40bb('0x2')]},'destpriority':{'type':Sequelize[_0x40bb('0x2')]},'destuniqueid':{'type':Sequelize[_0x40bb('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x40bb('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x40bb('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x40bb('0x2')],'comment':_0x40bb('0x6')},'transferexten':{'type':Sequelize[_0x40bb('0x2')]},'transferuniqueid':{'type':Sequelize[_0x40bb('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x578c=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x26ee74,_0x5b8dec){var _0xc6f94b=function(_0x40d0ad){while(--_0x40d0ad){_0x26ee74['push'](_0x26ee74['shift']());}};_0xc6f94b(++_0x5b8dec);}(_0x578c,0x158));var _0xc578=function(_0x2efbe6,_0x3b7c5c){_0x2efbe6=_0x2efbe6-0x0;var _0x5cdef2=_0x578c[_0x2efbe6];return _0x5cdef2;};'use strict';var Sequelize=require(_0xc578('0x0'));module[_0xc578('0x1')]={'type':{'type':Sequelize[_0xc578('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc578('0x2')]},'calleridname':{'type':Sequelize[_0xc578('0x2')]},'queue':{'type':Sequelize[_0xc578('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc578('0x2')]},'agentcalledAt':{'type':Sequelize[_0xc578('0x3')]},'agentconnectAt':{'type':Sequelize[_0xc578('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xc578('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xc578('0x3')]},'agentdumpAt':{'type':Sequelize[_0xc578('0x3')]},'holdtime':{'type':Sequelize[_0xc578('0x4')]},'agentcomplete':{'type':Sequelize[_0xc578('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xc578('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc578('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc578('0x4')]},'agentacw':{'type':Sequelize[_0xc578('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc578('0x4')]},'reason':{'type':Sequelize[_0xc578('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xc578('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc578('0x2')]},'connectedlinename':{'type':Sequelize[_0xc578('0x2')]},'language':{'type':Sequelize[_0xc578('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc578('0x2')]},'exten':{'type':Sequelize[_0xc578('0x2')]},'priority':{'type':Sequelize[_0xc578('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc578('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xc578('0x2')]},'destcalleridnum':{'type':Sequelize[_0xc578('0x2')]},'destcalleridname':{'type':Sequelize[_0xc578('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc578('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xc578('0x2')]},'destaccountcode':{'type':Sequelize[_0xc578('0x2')]},'destcontext':{'type':Sequelize[_0xc578('0x2')]},'destexten':{'type':Sequelize[_0xc578('0x2')]},'destpriority':{'type':Sequelize[_0xc578('0x2')]},'destuniqueid':{'type':Sequelize[_0xc578('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xc578('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xc578('0x2')]},'transfer':{'type':Sequelize[_0xc578('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc578('0x2')],'comment':_0xc578('0x6')},'transferexten':{'type':Sequelize[_0xc578('0x2')]},'transferuniqueid':{'type':Sequelize[_0xc578('0x2')]},'agententerreason':{'type':Sequelize[_0xc578('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 ad1732a..6857b4b 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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 e2a51fe..a934b93 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 _0x83d3=['report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceAgentReport'];(function(_0x5a240f,_0x187844){var _0x1ba1f2=function(_0x4ba791){while(--_0x4ba791){_0x5a240f['push'](_0x5a240f['shift']());}};_0x1ba1f2(++_0x187844);}(_0x83d3,0x17c));var _0x383d=function(_0xd3b0ac,_0x2f5065){_0xd3b0ac=_0xd3b0ac-0x0;var _0x3d773e=_0x83d3[_0xd3b0ac];return _0x3d773e;};'use strict';var _=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var logger=require(_0x383d('0x2'))(_0x383d('0x3'));var moment=require(_0x383d('0x4'));var BPromise=require('bluebird');var rp=require(_0x383d('0x5'));var fs=require('fs');var path=require(_0x383d('0x6'));var rimraf=require(_0x383d('0x7'));var config=require(_0x383d('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0x383d('0x9')]=function(_0x4f3c10,_0x50eaff){return _0x4f3c10[_0x383d('0xa')](_0x383d('0xb'),attributes,{'tableName':_0x383d('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x383d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5785=['moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','util','../../config/logger','api'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x5785,0x119));var _0x5578=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x5785[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x5578('0x0'));var util=require(_0x5578('0x1'));var logger=require(_0x5578('0x2'))(_0x5578('0x3'));var moment=require(_0x5578('0x4'));var BPromise=require('bluebird');var rp=require(_0x5578('0x5'));var fs=require('fs');var path=require(_0x5578('0x6'));var rimraf=require(_0x5578('0x7'));var config=require(_0x5578('0x8'));var attributes=require(_0x5578('0x9'));module[_0x5578('0xa')]=function(_0x35a1f4,_0x1a9d73){return _0x35a1f4[_0x5578('0xb')](_0x5578('0xc'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x5578('0xd'),_0x5578('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 41bf075..9beaa56 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 _0x6645=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','debug','catch','update','raw','where','attributes','UpdateVoiceAgentReport'];(function(_0x564583,_0x369239){var _0x13ed6e=function(_0xf71f8a){while(--_0xf71f8a){_0x564583['push'](_0x564583['shift']());}};_0x13ed6e(++_0x369239);}(_0x6645,0x1c7));var _0x5664=function(_0x549689,_0x4d8ca6){_0x549689=_0x549689-0x0;var _0x57cdfe=_0x6645[_0x549689];return _0x57cdfe;};'use strict';var _=require(_0x5664('0x0'));var util=require(_0x5664('0x1'));var moment=require(_0x5664('0x2'));var BPromise=require(_0x5664('0x3'));var rs=require(_0x5664('0x4'));var fs=require('fs');var Redis=require(_0x5664('0x5'));var db=require(_0x5664('0x6'))['db'];var utils=require(_0x5664('0x7'));var logger=require('../../config/logger')(_0x5664('0x8'));var config=require(_0x5664('0x9'));var jayson=require(_0x5664('0xa'));var client=jayson[_0x5664('0xb')][_0x5664('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb7092d,_0x427bc7,_0x49f73b){return new BPromise(function(_0x1ff9f5,_0x38eec4){return client[_0x5664('0xd')](_0xb7092d,_0x49f73b)[_0x5664('0xe')](function(_0x406d9d){logger['info'](_0x5664('0xf'),_0x427bc7,_0x5664('0x10'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x427bc7,_0x5664('0x10'),JSON[_0x5664('0x11')](_0x406d9d));if(_0x406d9d[_0x5664('0x12')]){if(_0x406d9d[_0x5664('0x12')][_0x5664('0x13')]===0x1f4){logger[_0x5664('0x12')](_0x5664('0xf'),_0x427bc7,_0x406d9d[_0x5664('0x12')][_0x5664('0x14')]);return _0x38eec4(_0x406d9d['error'][_0x5664('0x14')]);}logger['error'](_0x5664('0xf'),_0x427bc7,_0x406d9d[_0x5664('0x12')]['message']);return _0x1ff9f5(_0x406d9d[_0x5664('0x12')]['message']);}else{logger[_0x5664('0x15')](_0x5664('0xf'),_0x427bc7,'request\x20sent');_0x1ff9f5(_0x406d9d[_0x5664('0x16')][_0x5664('0x14')]);}})['catch'](function(_0x2a9aa0){logger['error'](_0x5664('0xf'),_0x427bc7,_0x2a9aa0);_0x38eec4(_0x2a9aa0);});});}exports[_0x5664('0x17')]=function(_0x1f83ba){var _0x2b9ba4=this;return new Promise(function(_0x1b644a,_0x40edd6){return db[_0x5664('0x18')][_0x5664('0x19')](_0x1f83ba[_0x5664('0x1a')],{'raw':_0x1f83ba[_0x5664('0x1b')]?_0x1f83ba['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x53a4ee){logger[_0x5664('0x15')]('CreateVoiceAgentReport',_0x1f83ba);logger[_0x5664('0x1c')](_0x5664('0x17'),_0x1f83ba,JSON['stringify'](_0x53a4ee));_0x1b644a(_0x53a4ee);})[_0x5664('0x1d')](function(_0x3bccb7){logger['error'](_0x5664('0x17'),_0x3bccb7[_0x5664('0x14')],_0x1f83ba);_0x40edd6(_0x2b9ba4[_0x5664('0x12')](0x1f4,_0x3bccb7['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x5bb74e){var _0x4958fc=this;return new Promise(function(_0x3cb2f7,_0x5995fe){return db['VoiceAgentReport'][_0x5664('0x1e')](_0x5bb74e['body'],{'raw':_0x5bb74e[_0x5664('0x1b')]?_0x5bb74e[_0x5664('0x1b')][_0x5664('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bb74e[_0x5664('0x1b')]?_0x5bb74e['options'][_0x5664('0x20')]||null:null,'attributes':_0x5bb74e['options']?_0x5bb74e[_0x5664('0x1b')][_0x5664('0x21')]||null:null,'limit':_0x5bb74e['options']?_0x5bb74e['options']['limit']||null:null})[_0x5664('0xe')](function(_0x40dfd8){logger[_0x5664('0x15')](_0x5664('0x22'),_0x5bb74e);logger[_0x5664('0x1c')](_0x5664('0x22'),_0x5bb74e,JSON[_0x5664('0x11')](_0x40dfd8));_0x3cb2f7(_0x40dfd8);})[_0x5664('0x1d')](function(_0x5cc01c){logger[_0x5664('0x12')]('UpdateVoiceAgentReport',_0x5cc01c[_0x5664('0x14')],_0x5bb74e);_0x5995fe(_0x4958fc[_0x5664('0x12')](0x1f4,_0x5cc01c['message']));});});}; \ No newline at end of file +var _0x0ce2=['debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','result','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x322f60,_0xd6710b){var _0x3066ae=function(_0xa87e99){while(--_0xa87e99){_0x322f60['push'](_0x322f60['shift']());}};_0x3066ae(++_0xd6710b);}(_0x0ce2,0x17c));var _0x20ce=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0ce2[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x20ce('0x0'));var util=require(_0x20ce('0x1'));var moment=require(_0x20ce('0x2'));var BPromise=require('bluebird');var rs=require(_0x20ce('0x3'));var fs=require('fs');var Redis=require(_0x20ce('0x4'));var db=require(_0x20ce('0x5'))['db'];var utils=require(_0x20ce('0x6'));var logger=require(_0x20ce('0x7'))(_0x20ce('0x8'));var config=require(_0x20ce('0x9'));var jayson=require(_0x20ce('0xa'));var client=jayson[_0x20ce('0xb')][_0x20ce('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51e461,_0x1134e6,_0x4459d5){return new BPromise(function(_0x4aa3f4,_0x3bc066){return client[_0x20ce('0xd')](_0x51e461,_0x4459d5)[_0x20ce('0xe')](function(_0x26c8c4){logger[_0x20ce('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x1134e6,'request\x20sent');logger[_0x20ce('0x10')](_0x20ce('0x11'),_0x1134e6,'request\x20sent',JSON[_0x20ce('0x12')](_0x26c8c4));if(_0x26c8c4[_0x20ce('0x13')]){if(_0x26c8c4[_0x20ce('0x13')]['code']===0x1f4){logger[_0x20ce('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x1134e6,_0x26c8c4['error'][_0x20ce('0x14')]);return _0x3bc066(_0x26c8c4['error']['message']);}logger[_0x20ce('0x13')](_0x20ce('0x15'),_0x1134e6,_0x26c8c4['error'][_0x20ce('0x14')]);return _0x4aa3f4(_0x26c8c4[_0x20ce('0x13')][_0x20ce('0x14')]);}else{logger[_0x20ce('0xf')](_0x20ce('0x15'),_0x1134e6,_0x20ce('0x16'));_0x4aa3f4(_0x26c8c4[_0x20ce('0x17')][_0x20ce('0x14')]);}})[_0x20ce('0x18')](function(_0x18fee4){logger[_0x20ce('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x1134e6,_0x18fee4);_0x3bc066(_0x18fee4);});});}exports['CreateVoiceAgentReport']=function(_0x3c87b3){var _0x5cc2e0=this;return new Promise(function(_0x115f92,_0x52e30){return db[_0x20ce('0x19')][_0x20ce('0x1a')](_0x3c87b3[_0x20ce('0x1b')],{'raw':_0x3c87b3[_0x20ce('0x1c')]?_0x3c87b3[_0x20ce('0x1c')][_0x20ce('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x36ae0a){logger['info'](_0x20ce('0x1e'),_0x3c87b3);logger[_0x20ce('0x10')]('CreateVoiceAgentReport',_0x3c87b3,JSON[_0x20ce('0x12')](_0x36ae0a));_0x115f92(_0x36ae0a);})[_0x20ce('0x18')](function(_0x5d6038){logger[_0x20ce('0x13')]('CreateVoiceAgentReport',_0x5d6038[_0x20ce('0x14')],_0x3c87b3);_0x52e30(_0x5cc2e0['error'](0x1f4,_0x5d6038[_0x20ce('0x14')]));});});};exports[_0x20ce('0x1f')]=function(_0x29e739){var _0x1c2293=this;return new Promise(function(_0x363bf3,_0x5c4c23){return db[_0x20ce('0x19')][_0x20ce('0x20')](_0x29e739[_0x20ce('0x1b')],{'raw':_0x29e739['options']?_0x29e739[_0x20ce('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29e739[_0x20ce('0x1c')]?_0x29e739[_0x20ce('0x1c')][_0x20ce('0x21')]||null:null,'attributes':_0x29e739[_0x20ce('0x1c')]?_0x29e739[_0x20ce('0x1c')][_0x20ce('0x22')]||null:null,'limit':_0x29e739[_0x20ce('0x1c')]?_0x29e739[_0x20ce('0x1c')][_0x20ce('0x23')]||null:null})[_0x20ce('0xe')](function(_0x271b7f){logger[_0x20ce('0xf')](_0x20ce('0x1f'),_0x29e739);logger[_0x20ce('0x10')](_0x20ce('0x1f'),_0x29e739,JSON[_0x20ce('0x12')](_0x271b7f));_0x363bf3(_0x271b7f);})[_0x20ce('0x18')](function(_0x4a54cd){logger['error'](_0x20ce('0x1f'),_0x4a54cd[_0x20ce('0x14')],_0x29e739);_0x5c4c23(_0x1c2293[_0x20ce('0x13')](0x1f4,_0x4a54cd['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index b820f25..258549a 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 _0x5178=['/describe','isAuthenticated','describe','/:id','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index'];(function(_0x378d9a,_0x459fc5){var _0xb77ff8=function(_0xc4e3f2){while(--_0xc4e3f2){_0x378d9a['push'](_0x378d9a['shift']());}};_0xb77ff8(++_0x459fc5);}(_0x5178,0x171));var _0x8517=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5178[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x8517('0x0'));var path=require(_0x8517('0x1'));var timeout=require(_0x8517('0x2'));var express=require(_0x8517('0x3'));var router=express[_0x8517('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var controller=require('./voiceCallReport.controller');router[_0x8517('0x7')]('/',auth['isAuthenticated'](),controller[_0x8517('0x8')]);router[_0x8517('0x7')](_0x8517('0x9'),auth[_0x8517('0xa')](),controller[_0x8517('0xb')]);router['get'](_0x8517('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8517('0xd')]('/',auth[_0x8517('0xa')](),controller['create']);router[_0x8517('0xe')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0xf')]);router[_0x8517('0x10')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0x11')]);module['exports']=router; \ No newline at end of file +var _0x00bb=['express','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x20fa83,_0x534447){var _0x196e3d=function(_0x4ede1f){while(--_0x4ede1f){_0x20fa83['push'](_0x20fa83['shift']());}};_0x196e3d(++_0x534447);}(_0x00bb,0x1d8));var _0xb00b=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x00bb[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var fs_extra=require(_0xb00b('0x4'));var auth=require(_0xb00b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb00b('0x6'));var controller=require(_0xb00b('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb00b('0x8')](_0xb00b('0x9'),auth[_0xb00b('0xa')](),controller[_0xb00b('0xb')]);router[_0xb00b('0x8')](_0xb00b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb00b('0xd')]('/',auth[_0xb00b('0xa')](),controller[_0xb00b('0xe')]);router[_0xb00b('0xf')](_0xb00b('0xc'),auth['isAuthenticated'](),controller[_0xb00b('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb00b('0x11')]);module[_0xb00b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 55a43d7..a6a07f7 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 _0x4bde=['dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','inbound','internal','outbound','inbound-fax'];(function(_0x380b52,_0x5b1752){var _0x2e098c=function(_0x41d777){while(--_0x41d777){_0x380b52['push'](_0x380b52['shift']());}};_0x2e098c(++_0x5b1752);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x573dca,_0x585f0e){_0x573dca=_0x573dca-0x0;var _0x74ec51=_0x4bde[_0x573dca];return _0x74ec51;};'use strict';var Sequelize=require(_0xe4bd('0x0'));module[_0xe4bd('0x1')]={'uniqueid':{'type':Sequelize[_0xe4bd('0x2')]},'type':{'type':Sequelize['ENUM'](_0xe4bd('0x3'),_0xe4bd('0x4'),_0xe4bd('0x5'),_0xe4bd('0x6'),'outbound-fax',_0xe4bd('0x7'))},'tag':{'type':Sequelize[_0xe4bd('0x2')]},'accountcode':{'type':Sequelize[_0xe4bd('0x2')]},'source':{'type':Sequelize[_0xe4bd('0x2')]},'destination':{'type':Sequelize[_0xe4bd('0x2')]},'destinationcontext':{'type':Sequelize[_0xe4bd('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe4bd('0x2')]},'destinationchannel':{'type':Sequelize[_0xe4bd('0x2')]},'lastapplication':{'type':Sequelize[_0xe4bd('0x2')]},'lastdata':{'type':Sequelize[_0xe4bd('0x8')]},'starttime':{'type':Sequelize[_0xe4bd('0x9')]},'systemanswertime':{'type':Sequelize[_0xe4bd('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xe4bd('0xa')]},'mohtime':{'type':Sequelize[_0xe4bd('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe4bd('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xe4bd('0x2')]},'userDisposition':{'type':Sequelize[_0xe4bd('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xe4bd('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xe4bd('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xe4bd('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xe4bd('0x2')]}}; \ No newline at end of file +var _0x1053=['inbound-fax','TEXT','DATE','sequelize','exports','STRING','ENUM','inbound','internal','outbound'];(function(_0x47878f,_0x48d3bf){var _0x4b05b8=function(_0x3d6597){while(--_0x3d6597){_0x47878f['push'](_0x47878f['shift']());}};_0x4b05b8(++_0x48d3bf);}(_0x1053,0xd5));var _0x3105=function(_0x189b3b,_0x484de8){_0x189b3b=_0x189b3b-0x0;var _0x7c4721=_0x1053[_0x189b3b];return _0x7c4721;};'use strict';var Sequelize=require(_0x3105('0x0'));module[_0x3105('0x1')]={'uniqueid':{'type':Sequelize[_0x3105('0x2')]},'type':{'type':Sequelize[_0x3105('0x3')](_0x3105('0x4'),_0x3105('0x5'),_0x3105('0x6'),_0x3105('0x7'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0x3105('0x2')]},'accountcode':{'type':Sequelize[_0x3105('0x2')]},'source':{'type':Sequelize[_0x3105('0x2')]},'destination':{'type':Sequelize[_0x3105('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x3105('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x3105('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x3105('0x9')]},'answertime':{'type':Sequelize[_0x3105('0x9')]},'endtime':{'type':Sequelize[_0x3105('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3105('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x3105('0x2')]},'userDisposition':{'type':Sequelize[_0x3105('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x3105('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x3105('0x2')]},'note':{'type':Sequelize[_0x3105('0x2')]},'prefix':{'type':Sequelize[_0x3105('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index f361e3c..996d1ca 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(_0x763007,_0x393ca7){var _0x1657a7=function(_0x187aed){while(--_0x187aed){_0x763007['push'](_0x763007['shift']());}};_0x1657a7(++_0x393ca7);}(_0xdb28,0x106));var _0x8db2=function(_0x37a751,_0x488ac3){_0x37a751=_0x37a751-0x0;var _0x430932=_0xdb28[_0x37a751];return _0x430932;};'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 _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 0173204..0486914 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 _0xf754=['uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define'];(function(_0x11ac57,_0x4ea5a0){var _0x42e683=function(_0x56d553){while(--_0x56d553){_0x11ac57['push'](_0x11ac57['shift']());}};_0x42e683(++_0x4ea5a0);}(_0xf754,0x1b1));var _0x4f75=function(_0x4138ea,_0x29b4f5){_0x4138ea=_0x4138ea-0x0;var _0x4df353=_0xf754[_0x4138ea];return _0x4df353;};'use strict';var _=require(_0x4f75('0x0'));var util=require(_0x4f75('0x1'));var logger=require('../../config/logger')(_0x4f75('0x2'));var moment=require(_0x4f75('0x3'));var BPromise=require(_0x4f75('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f75('0x5'));var rimraf=require(_0x4f75('0x6'));var config=require(_0x4f75('0x7'));var attributes=require(_0x4f75('0x8'));module[_0x4f75('0x9')]=function(_0xad7d3,_0x336865){return _0xad7d3[_0x4f75('0xa')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x4f75('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ba0=['api','moment','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8ba0,0xd0));var _0x08ba=function(_0x15be80,_0x9e3b6d){_0x15be80=_0x15be80-0x0;var _0x1d5d9b=_0x8ba0[_0x15be80];return _0x1d5d9b;};'use strict';var _=require(_0x08ba('0x0'));var util=require('util');var logger=require(_0x08ba('0x1'))(_0x08ba('0x2'));var moment=require(_0x08ba('0x3'));var BPromise=require('bluebird');var rp=require(_0x08ba('0x4'));var fs=require('fs');var path=require(_0x08ba('0x5'));var rimraf=require(_0x08ba('0x6'));var config=require(_0x08ba('0x7'));var attributes=require(_0x08ba('0x8'));module[_0x08ba('0x9')]=function(_0x1fac97,_0x3888e6){return _0x1fac97[_0x08ba('0xa')](_0x08ba('0xb'),attributes,{'tableName':_0x08ba('0xc'),'paranoid':![],'indexes':[{'fields':[_0x08ba('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 09c5ee3..a4a76f7 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 _0x0e88=['raw','attributes','limit','map','include','model','then','body','UpdateVoiceCallReport','update','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','options'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0x0e88,0x1af));var _0x80e8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0e88[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x80e8('0x0'));var util=require(_0x80e8('0x1'));var moment=require('moment');var BPromise=require(_0x80e8('0x2'));var rs=require(_0x80e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80e8('0x4'))['db'];var utils=require(_0x80e8('0x5'));var logger=require(_0x80e8('0x6'))(_0x80e8('0x7'));var config=require(_0x80e8('0x8'));var jayson=require(_0x80e8('0x9'));var client=jayson[_0x80e8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4900df,_0x54498c,_0x4f3b88){return new BPromise(function(_0x44e0d2,_0x6f47ba){return client['request'](_0x4900df,_0x4f3b88)['then'](function(_0x12ca67){logger[_0x80e8('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x54498c,_0x80e8('0xc'));logger[_0x80e8('0xd')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x54498c,_0x80e8('0xc'),JSON[_0x80e8('0xe')](_0x12ca67));if(_0x12ca67[_0x80e8('0xf')]){if(_0x12ca67[_0x80e8('0xf')][_0x80e8('0x10')]===0x1f4){logger['error'](_0x80e8('0x11'),_0x54498c,_0x12ca67[_0x80e8('0xf')][_0x80e8('0x12')]);return _0x6f47ba(_0x12ca67[_0x80e8('0xf')][_0x80e8('0x12')]);}logger[_0x80e8('0xf')](_0x80e8('0x11'),_0x54498c,_0x12ca67[_0x80e8('0xf')][_0x80e8('0x12')]);return _0x44e0d2(_0x12ca67[_0x80e8('0xf')][_0x80e8('0x12')]);}else{logger[_0x80e8('0xb')](_0x80e8('0x11'),_0x54498c,_0x80e8('0xc'));_0x44e0d2(_0x12ca67[_0x80e8('0x13')]['message']);}})[_0x80e8('0x14')](function(_0x4af967){logger[_0x80e8('0xf')](_0x80e8('0x11'),_0x54498c,_0x4af967);_0x6f47ba(_0x4af967);});});}exports[_0x80e8('0x15')]=function(_0x46dd8e){var _0x295e0d=this;return new Promise(function(_0x28f884,_0x2e87dd){return db[_0x80e8('0x16')]['findAll']({'raw':_0x46dd8e[_0x80e8('0x17')]?_0x46dd8e[_0x80e8('0x17')][_0x80e8('0x18')]===undefined?!![]:![]:!![],'where':_0x46dd8e[_0x80e8('0x17')]?_0x46dd8e[_0x80e8('0x17')]['where']||null:null,'attributes':_0x46dd8e[_0x80e8('0x17')]?_0x46dd8e[_0x80e8('0x17')][_0x80e8('0x19')]||null:null,'limit':_0x46dd8e[_0x80e8('0x17')]?_0x46dd8e[_0x80e8('0x17')][_0x80e8('0x1a')]||null:null,'include':_0x46dd8e['options']?_0x46dd8e[_0x80e8('0x17')]['include']?_[_0x80e8('0x1b')](_0x46dd8e['options'][_0x80e8('0x1c')],function(_0x399e66){return{'model':db[_0x399e66['model']],'as':_0x399e66['as'],'attributes':_0x399e66[_0x80e8('0x19')],'include':_0x399e66['include']?_['map'](_0x399e66['include'],function(_0x1972aa){return{'model':db[_0x1972aa['model']],'as':_0x1972aa['as'],'attributes':_0x1972aa[_0x80e8('0x19')],'include':_0x1972aa['include']?_[_0x80e8('0x1b')](_0x1972aa[_0x80e8('0x1c')],function(_0x19d70b){return{'model':db[_0x19d70b[_0x80e8('0x1d')]],'as':_0x19d70b['as'],'attributes':_0x19d70b['attributes']};}):[]};}):[]};}):[]:[]})[_0x80e8('0x1e')](function(_0xd96118){logger['info']('GetVoiceCallReport',_0x46dd8e);logger[_0x80e8('0xd')](_0x80e8('0x15'),_0x46dd8e,JSON[_0x80e8('0xe')](_0xd96118));_0x28f884(_0xd96118);})[_0x80e8('0x14')](function(_0x232471){logger[_0x80e8('0xf')](_0x80e8('0x15'),_0x232471[_0x80e8('0x12')],_0x46dd8e);_0x2e87dd(_0x295e0d[_0x80e8('0xf')](0x1f4,_0x232471[_0x80e8('0x12')]));});});};exports['CreateVoiceCallReport']=function(_0x3d28ef){var _0x2abdbc=this;return new Promise(function(_0x389128,_0x19f8d9){return db['VoiceCallReport']['create'](_0x3d28ef[_0x80e8('0x1f')],{'raw':_0x3d28ef[_0x80e8('0x17')]?_0x3d28ef[_0x80e8('0x17')][_0x80e8('0x18')]===undefined?!![]:![]:!![]})[_0x80e8('0x1e')](function(_0xf50d4e){logger[_0x80e8('0xb')]('CreateVoiceCallReport',_0x3d28ef);logger[_0x80e8('0xd')]('CreateVoiceCallReport',_0x3d28ef,JSON[_0x80e8('0xe')](_0xf50d4e));_0x389128(_0xf50d4e);})[_0x80e8('0x14')](function(_0x31d65b){logger['error']('CreateVoiceCallReport',_0x31d65b[_0x80e8('0x12')],_0x3d28ef);_0x19f8d9(_0x2abdbc[_0x80e8('0xf')](0x1f4,_0x31d65b[_0x80e8('0x12')]));});});};exports[_0x80e8('0x20')]=function(_0x1d9838){var _0x54bf1f=this;return new Promise(function(_0x1ba1e8,_0x4bc232){return db[_0x80e8('0x16')][_0x80e8('0x21')](_0x1d9838[_0x80e8('0x1f')],{'raw':_0x1d9838[_0x80e8('0x17')]?_0x1d9838['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d9838[_0x80e8('0x17')]?_0x1d9838[_0x80e8('0x17')][_0x80e8('0x22')]||null:null,'attributes':_0x1d9838[_0x80e8('0x17')]?_0x1d9838[_0x80e8('0x17')]['attributes']||null:null,'limit':_0x1d9838[_0x80e8('0x17')]?_0x1d9838[_0x80e8('0x17')]['limit']||null:null})[_0x80e8('0x1e')](function(_0x1350d8){logger[_0x80e8('0xb')]('UpdateVoiceCallReport',_0x1d9838);logger[_0x80e8('0xd')](_0x80e8('0x20'),_0x1d9838,JSON['stringify'](_0x1350d8));_0x1ba1e8(_0x1350d8);})[_0x80e8('0x14')](function(_0x21add3){logger[_0x80e8('0xf')](_0x80e8('0x20'),_0x21add3[_0x80e8('0x12')],_0x1d9838);_0x4bc232(_0x54bf1f[_0x80e8('0xf')](0x1f4,_0x21add3[_0x80e8('0x12')]));});});}; \ No newline at end of file +var _0x5bc3=['message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','map','include','model','info','CreateVoiceCallReport','body','stringify','update','UpdateVoiceCallReport','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','error'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x5bc3,0x157));var _0x35bc=function(_0x51c99b,_0x420c1e){_0x51c99b=_0x51c99b-0x0;var _0xecf77e=_0x5bc3[_0x51c99b];return _0xecf77e;};'use strict';var _=require(_0x35bc('0x0'));var util=require('util');var moment=require(_0x35bc('0x1'));var BPromise=require(_0x35bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35bc('0x3'));var db=require(_0x35bc('0x4'))['db'];var utils=require(_0x35bc('0x5'));var logger=require(_0x35bc('0x6'))(_0x35bc('0x7'));var config=require(_0x35bc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x35bc('0x9')][_0x35bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57f0f9,_0x34c6a6,_0x538ba3){return new BPromise(function(_0x91954b,_0x52ae37){return client[_0x35bc('0xb')](_0x57f0f9,_0x538ba3)[_0x35bc('0xc')](function(_0x52c811){logger['info'](_0x35bc('0xd'),_0x34c6a6,'request\x20sent');logger[_0x35bc('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x34c6a6,_0x35bc('0xf'),JSON['stringify'](_0x52c811));if(_0x52c811['error']){if(_0x52c811['error']['code']===0x1f4){logger[_0x35bc('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x34c6a6,_0x52c811[_0x35bc('0x10')][_0x35bc('0x11')]);return _0x52ae37(_0x52c811[_0x35bc('0x10')][_0x35bc('0x11')]);}logger[_0x35bc('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x34c6a6,_0x52c811[_0x35bc('0x10')][_0x35bc('0x11')]);return _0x91954b(_0x52c811[_0x35bc('0x10')]['message']);}else{logger['info'](_0x35bc('0xd'),_0x34c6a6,_0x35bc('0xf'));_0x91954b(_0x52c811[_0x35bc('0x12')][_0x35bc('0x11')]);}})[_0x35bc('0x13')](function(_0x6a1869){logger[_0x35bc('0x10')](_0x35bc('0xd'),_0x34c6a6,_0x6a1869);_0x52ae37(_0x6a1869);});});}exports[_0x35bc('0x14')]=function(_0x4a0abf){var _0x3d2228=this;return new Promise(function(_0x58c3f1,_0x3bb974){return db[_0x35bc('0x15')]['findAll']({'raw':_0x4a0abf[_0x35bc('0x16')]?_0x4a0abf[_0x35bc('0x16')][_0x35bc('0x17')]===undefined?!![]:![]:!![],'where':_0x4a0abf[_0x35bc('0x16')]?_0x4a0abf[_0x35bc('0x16')][_0x35bc('0x18')]||null:null,'attributes':_0x4a0abf[_0x35bc('0x16')]?_0x4a0abf[_0x35bc('0x16')][_0x35bc('0x19')]||null:null,'limit':_0x4a0abf['options']?_0x4a0abf[_0x35bc('0x16')][_0x35bc('0x1a')]||null:null,'include':_0x4a0abf['options']?_0x4a0abf[_0x35bc('0x16')]['include']?_[_0x35bc('0x1b')](_0x4a0abf['options'][_0x35bc('0x1c')],function(_0x1e460e){return{'model':db[_0x1e460e[_0x35bc('0x1d')]],'as':_0x1e460e['as'],'attributes':_0x1e460e[_0x35bc('0x19')],'include':_0x1e460e['include']?_['map'](_0x1e460e[_0x35bc('0x1c')],function(_0x479ece){return{'model':db[_0x479ece[_0x35bc('0x1d')]],'as':_0x479ece['as'],'attributes':_0x479ece[_0x35bc('0x19')],'include':_0x479ece[_0x35bc('0x1c')]?_[_0x35bc('0x1b')](_0x479ece['include'],function(_0xc1e23a){return{'model':db[_0xc1e23a[_0x35bc('0x1d')]],'as':_0xc1e23a['as'],'attributes':_0xc1e23a[_0x35bc('0x19')]};}):[]};}):[]};}):[]:[]})[_0x35bc('0xc')](function(_0x5d0852){logger[_0x35bc('0x1e')](_0x35bc('0x14'),_0x4a0abf);logger[_0x35bc('0xe')](_0x35bc('0x14'),_0x4a0abf,JSON['stringify'](_0x5d0852));_0x58c3f1(_0x5d0852);})['catch'](function(_0x598219){logger[_0x35bc('0x10')](_0x35bc('0x14'),_0x598219['message'],_0x4a0abf);_0x3bb974(_0x3d2228[_0x35bc('0x10')](0x1f4,_0x598219[_0x35bc('0x11')]));});});};exports[_0x35bc('0x1f')]=function(_0x5acd32){var _0x399d1d=this;return new Promise(function(_0x48e199,_0x3a61fa){return db['VoiceCallReport']['create'](_0x5acd32[_0x35bc('0x20')],{'raw':_0x5acd32['options']?_0x5acd32['options'][_0x35bc('0x17')]===undefined?!![]:![]:!![]})[_0x35bc('0xc')](function(_0x56e3ba){logger[_0x35bc('0x1e')](_0x35bc('0x1f'),_0x5acd32);logger['debug'](_0x35bc('0x1f'),_0x5acd32,JSON[_0x35bc('0x21')](_0x56e3ba));_0x48e199(_0x56e3ba);})['catch'](function(_0x3bbe73){logger[_0x35bc('0x10')](_0x35bc('0x1f'),_0x3bbe73[_0x35bc('0x11')],_0x5acd32);_0x3a61fa(_0x399d1d[_0x35bc('0x10')](0x1f4,_0x3bbe73['message']));});});};exports['UpdateVoiceCallReport']=function(_0xeefb3){var _0x3fc0d0=this;return new Promise(function(_0x3dfc89,_0xb3a27a){return db[_0x35bc('0x15')][_0x35bc('0x22')](_0xeefb3[_0x35bc('0x20')],{'raw':_0xeefb3[_0x35bc('0x16')]?_0xeefb3['options'][_0x35bc('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xeefb3[_0x35bc('0x16')]?_0xeefb3['options'][_0x35bc('0x18')]||null:null,'attributes':_0xeefb3[_0x35bc('0x16')]?_0xeefb3['options'][_0x35bc('0x19')]||null:null,'limit':_0xeefb3[_0x35bc('0x16')]?_0xeefb3[_0x35bc('0x16')][_0x35bc('0x1a')]||null:null})['then'](function(_0x3d6d60){logger[_0x35bc('0x1e')](_0x35bc('0x23'),_0xeefb3);logger['debug'](_0x35bc('0x23'),_0xeefb3,JSON[_0x35bc('0x21')](_0x3d6d60));_0x3dfc89(_0x3d6d60);})['catch'](function(_0x2b1912){logger[_0x35bc('0x10')]('UpdateVoiceCallReport',_0x2b1912[_0x35bc('0x11')],_0xeefb3);_0xb3a27a(_0x3fc0d0[_0x35bc('0x10')](0x1f4,_0x2b1912[_0x35bc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 9a0323c..d47c76f 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 _0xf665=['fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x56150f,_0x249628){var _0x2062c7=function(_0x4942b0){while(--_0x4942b0){_0x56150f['push'](_0x56150f['shift']());}};_0x2062c7(++_0x249628);}(_0xf665,0x15f));var _0x5f66=function(_0x38cbdf,_0x4eb95f){_0x38cbdf=_0x38cbdf-0x0;var _0x20ebce=_0xf665[_0x38cbdf];return _0x20ebce;};'use strict';var multer=require(_0x5f66('0x0'));var util=require(_0x5f66('0x1'));var path=require(_0x5f66('0x2'));var timeout=require(_0x5f66('0x3'));var express=require(_0x5f66('0x4'));var router=express[_0x5f66('0x5')]();var fs_extra=require(_0x5f66('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5f66('0x7'));var config=require(_0x5f66('0x8'));var controller=require(_0x5f66('0x9'));router[_0x5f66('0xa')]('/',auth[_0x5f66('0xb')](),controller[_0x5f66('0xc')]);router['get'](_0x5f66('0xd'),auth[_0x5f66('0xb')](),controller[_0x5f66('0xe')]);router[_0x5f66('0xf')]('/',auth['isAuthenticated'](),controller[_0x5f66('0x10')]);router[_0x5f66('0x11')](_0x5f66('0xd'),auth[_0x5f66('0xb')](),controller[_0x5f66('0x12')]);router[_0x5f66('0x13')](_0x5f66('0xd'),auth['isAuthenticated'](),controller[_0x5f66('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3a71=['destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x412e4c,_0x17db8f){var _0x5d7d8b=function(_0x20741e){while(--_0x20741e){_0x412e4c['push'](_0x412e4c['shift']());}};_0x5d7d8b(++_0x17db8f);}(_0x3a71,0x157));var _0x13a7=function(_0x55ae42,_0x584424){_0x55ae42=_0x55ae42-0x0;var _0x2e4a7f=_0x3a71[_0x55ae42];return _0x2e4a7f;};'use strict';var multer=require(_0x13a7('0x0'));var util=require(_0x13a7('0x1'));var path=require(_0x13a7('0x2'));var timeout=require(_0x13a7('0x3'));var express=require(_0x13a7('0x4'));var router=express['Router']();var fs_extra=require(_0x13a7('0x5'));var auth=require(_0x13a7('0x6'));var interaction=require(_0x13a7('0x7'));var config=require('../../config/environment');var controller=require(_0x13a7('0x8'));router[_0x13a7('0x9')]('/',auth[_0x13a7('0xa')](),controller[_0x13a7('0xb')]);router[_0x13a7('0x9')](_0x13a7('0xc'),auth['isAuthenticated'](),controller[_0x13a7('0xd')]);router[_0x13a7('0xe')]('/',auth[_0x13a7('0xa')](),controller[_0x13a7('0xf')]);router[_0x13a7('0x10')](_0x13a7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x13a7('0x11')](_0x13a7('0xc'),auth['isAuthenticated'](),controller[_0x13a7('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 72615e5..945f0f7 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 _0x7e7d=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','setDataValue','options','join'];(function(_0x29352f,_0x458a13){var _0x217e89=function(_0x54ec85){while(--_0x54ec85){_0x29352f['push'](_0x29352f['shift']());}};_0x217e89(++_0x458a13);}(_0x7e7d,0x93));var _0xd7e7=function(_0x303023,_0x135a2b){_0x303023=_0x303023-0x0;var _0x11017e=_0x7e7d[_0x303023];return _0x11017e;};'use strict';var Sequelize=require(_0xd7e7('0x0'));module[_0xd7e7('0x1')]={'name':{'type':Sequelize[_0xd7e7('0x2')]},'prefix':{'type':Sequelize[_0xd7e7('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xd7e7('0x2')],'set':function(_0x17143e){this[_0xd7e7('0x3')](_0xd7e7('0x4'),_0x17143e?_0x17143e[_0xd7e7('0x5')](''):[]);},'get':function(){return this[_0xd7e7('0x6')]('options')?this[_0xd7e7('0x6')](_0xd7e7('0x4'))[_0xd7e7('0x7')](''):[];}},'auth':{'type':Sequelize[_0xd7e7('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xd7e7('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc1a8=['exports','STRING','name','setDataValue','getDataValue','options','split','BOOLEAN','sequelize'];(function(_0x3cdd8b,_0x7583f9){var _0x4dc717=function(_0x46cb11){while(--_0x46cb11){_0x3cdd8b['push'](_0x3cdd8b['shift']());}};_0x4dc717(++_0x7583f9);}(_0xc1a8,0x155));var _0x8c1a=function(_0x75267d,_0x5d286c){_0x75267d=_0x75267d-0x0;var _0x21ccec=_0xc1a8[_0x75267d];return _0x21ccec;};'use strict';var Sequelize=require(_0x8c1a('0x0'));module[_0x8c1a('0x1')]={'name':{'type':Sequelize[_0x8c1a('0x2')]},'prefix':{'type':Sequelize[_0x8c1a('0x2')],'unique':_0x8c1a('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x8c1a('0x2')],'set':function(_0x3a2705){this[_0x8c1a('0x4')]('options',_0x3a2705?_0x3a2705['join'](''):[]);},'get':function(){return this[_0x8c1a('0x5')](_0x8c1a('0x6'))?this['getDataValue'](_0x8c1a('0x6'))[_0x8c1a('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x8c1a('0x2')]},'record':{'type':Sequelize[_0x8c1a('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x8c1a('0x2')]},'description':{'type':Sequelize[_0x8c1a('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index a41cb7b..16d168f 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 _0xfdb5=['bluebird','path','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','count','offset','limit','set','apply','reject','save','then','get','ChanSpies','UserProfileResource','destroy','sendStatus','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','params','includeAll','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x216e72,_0x5cd161){var _0x2ff28d=function(_0x29a533){while(--_0x29a533){_0x216e72['push'](_0x216e72['shift']());}};_0x2ff28d(++_0x5cd161);}(_0xfdb5,0x12f));var _0x5fdb=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xfdb5[_0x3305de];return _0x3b5a84;};'use strict';var emlformat=require(_0x5fdb('0x0'));var rimraf=require(_0x5fdb('0x1'));var zipdir=require(_0x5fdb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5fdb('0x3'));var moment=require(_0x5fdb('0x4'));var BPromise=require(_0x5fdb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5fdb('0x6'));var sox=require('sox');var csv=require(_0x5fdb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5fdb('0x8'));var _=require(_0x5fdb('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5fdb('0xa'));var toCsv=require(_0x5fdb('0x7'));var querystring=require(_0x5fdb('0xb'));var Papa=require(_0x5fdb('0xc'));var Redis=require(_0x5fdb('0xd'));var authService=require(_0x5fdb('0xe'));var qs=require(_0x5fdb('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5fdb('0x10'));var logger=require('../../config/logger')(_0x5fdb('0x11'));var utils=require(_0x5fdb('0x12'));var config=require(_0x5fdb('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5fdb('0x14'))['db'];function respondWithStatusCode(_0x573f40,_0x27433e){_0x27433e=_0x27433e||0xcc;return function(_0x368750){if(_0x368750){return _0x573f40['sendStatus'](_0x27433e);}return _0x573f40[_0x5fdb('0x15')](_0x27433e)[_0x5fdb('0x16')]();};}function respondWithResult(_0x3a2e29,_0x59f815){_0x59f815=_0x59f815||0xc8;return function(_0x3d15a2){if(_0x3d15a2){return _0x3a2e29[_0x5fdb('0x15')](_0x59f815)[_0x5fdb('0x17')](_0x3d15a2);}};}function respondWithFilteredResult(_0xaf6b0e,_0x40c32d){return function(_0x2d620c){if(_0x2d620c){var _0x58ae27=typeof _0x40c32d['offset']===_0x5fdb('0x18')&&typeof _0x40c32d['limit']===_0x5fdb('0x18');var _0x148223=_0x2d620c[_0x5fdb('0x19')];var _0x47a10f=_0x58ae27?0x0:_0x40c32d[_0x5fdb('0x1a')];var _0xb8c99f=_0x58ae27?_0x2d620c[_0x5fdb('0x19')]:_0x40c32d[_0x5fdb('0x1a')]+_0x40c32d[_0x5fdb('0x1b')];var _0x30d7d1;if(_0xb8c99f>=_0x148223){_0xb8c99f=_0x148223;_0x30d7d1=0xc8;}else{_0x30d7d1=0xce;}_0xaf6b0e['status'](_0x30d7d1);return _0xaf6b0e[_0x5fdb('0x1c')]('Content-Range',_0x47a10f+'-'+_0xb8c99f+'/'+_0x148223)['json'](_0x2d620c);}return null;};}function patchUpdates(_0x8937c){return function(_0x2ab3a4){try{jsonpatch[_0x5fdb('0x1d')](_0x2ab3a4,_0x8937c,!![]);}catch(_0x571802){return BPromise[_0x5fdb('0x1e')](_0x571802);}return _0x2ab3a4[_0x5fdb('0x1f')]();};}function saveUpdates(_0x47e13a,_0x3e755a){return function(_0x170ad5){if(_0x170ad5){return _0x170ad5['update'](_0x47e13a)['then'](function(_0x4dc591){return _0x4dc591;});}return null;};}function removeEntity(_0x56997a,_0x15d2ec){return function(_0x573132){if(_0x573132){return _0x573132['destroy']()[_0x5fdb('0x20')](function(){var _0x458f8a=_0x573132[_0x5fdb('0x21')]({'plain':!![]});var _0x49e795=_0x5fdb('0x22');return db[_0x5fdb('0x23')][_0x5fdb('0x24')]({'where':{'type':_0x49e795,'resourceId':_0x458f8a['id']}})[_0x5fdb('0x20')](function(){return _0x573132;});})['then'](function(){_0x56997a[_0x5fdb('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdd573a,_0x207e42){return function(_0x488843){if(!_0x488843){_0xdd573a[_0x5fdb('0x25')](0x194);}return _0x488843;};}function handleError(_0x55ad0c,_0x19ee13){_0x19ee13=_0x19ee13||0x1f4;return function(_0x474217){logger['error'](_0x474217['stack']);if(_0x474217[_0x5fdb('0x26')]){delete _0x474217[_0x5fdb('0x26')];}_0x55ad0c[_0x5fdb('0x15')](_0x19ee13)[_0x5fdb('0x27')](_0x474217);};}exports[_0x5fdb('0x28')]=function(_0x5596cc,_0x5b20ec){var _0xc2af7e={},_0x1c0979={},_0x420b22={'count':0x0,'rows':[]};var _0xb09e8b=_[_0x5fdb('0x29')](db[_0x5fdb('0x2a')][_0x5fdb('0x2b')],function(_0x3f10fc){return{'name':_0x3f10fc[_0x5fdb('0x2c')],'type':_0x3f10fc[_0x5fdb('0x2d')][_0x5fdb('0x2e')]};});_0x1c0979[_0x5fdb('0x2f')]=_[_0x5fdb('0x29')](_0xb09e8b,_0x5fdb('0x26'));_0x1c0979[_0x5fdb('0x30')]=_['keys'](_0x5596cc[_0x5fdb('0x30')]);_0x1c0979[_0x5fdb('0x31')]=_[_0x5fdb('0x32')](_0x1c0979[_0x5fdb('0x2f')],_0x1c0979[_0x5fdb('0x30')]);_0xc2af7e[_0x5fdb('0x33')]=_[_0x5fdb('0x32')](_0x1c0979[_0x5fdb('0x2f')],qs[_0x5fdb('0x34')](_0x5596cc[_0x5fdb('0x30')]['fields']));_0xc2af7e[_0x5fdb('0x33')]=_0xc2af7e[_0x5fdb('0x33')][_0x5fdb('0x35')]?_0xc2af7e[_0x5fdb('0x33')]:_0x1c0979[_0x5fdb('0x2f')];if(!_0x5596cc[_0x5fdb('0x30')]['hasOwnProperty']('nolimit')){_0xc2af7e[_0x5fdb('0x1b')]=qs[_0x5fdb('0x1b')](_0x5596cc[_0x5fdb('0x30')][_0x5fdb('0x1b')]);_0xc2af7e[_0x5fdb('0x1a')]=qs[_0x5fdb('0x1a')](_0x5596cc[_0x5fdb('0x30')]['offset']);}_0xc2af7e[_0x5fdb('0x36')]=qs[_0x5fdb('0x37')](_0x5596cc[_0x5fdb('0x30')][_0x5fdb('0x37')]);_0xc2af7e[_0x5fdb('0x38')]=qs[_0x5fdb('0x31')](_[_0x5fdb('0x39')](_0x5596cc[_0x5fdb('0x30')],_0x1c0979[_0x5fdb('0x31')]),_0xb09e8b);if(_0x5596cc['query']['filter']){_0xc2af7e['where']=_[_0x5fdb('0x3a')](_0xc2af7e['where'],{'$or':_[_0x5fdb('0x29')](_0xb09e8b,function(_0x19a296){if(_0x19a296[_0x5fdb('0x2d')]!==_0x5fdb('0x3b')){var _0x4feae7={};_0x4feae7[_0x19a296[_0x5fdb('0x26')]]={'$like':'%'+_0x5596cc['query'][_0x5fdb('0x3c')]+'%'};return _0x4feae7;}})});}_0xc2af7e=_['merge']({},_0xc2af7e,_0x5596cc[_0x5fdb('0x3d')]);var _0x9bee6f={'where':_0xc2af7e[_0x5fdb('0x38')]};return db[_0x5fdb('0x2a')][_0x5fdb('0x19')](_0x9bee6f)['then'](function(_0x3614c4){_0x420b22[_0x5fdb('0x19')]=_0x3614c4;if(_0x5596cc[_0x5fdb('0x30')]['includeAll']){_0xc2af7e['include']=[{'all':!![]}];}return db[_0x5fdb('0x2a')][_0x5fdb('0x3e')](_0xc2af7e);})['then'](function(_0x1004b5){_0x420b22[_0x5fdb('0x3f')]=_0x1004b5;return _0x420b22;})['then'](respondWithFilteredResult(_0x5b20ec,_0xc2af7e))['catch'](handleError(_0x5b20ec,null));};exports['show']=function(_0x47c3c2,_0x1bd301){var _0x57c496={'raw':![],'where':{'id':_0x47c3c2[_0x5fdb('0x40')]['id']}},_0x10a3d4={};_0x10a3d4[_0x5fdb('0x2f')]=_['keys'](db[_0x5fdb('0x2a')][_0x5fdb('0x2b')]);_0x10a3d4[_0x5fdb('0x30')]=_['keys'](_0x47c3c2[_0x5fdb('0x30')]);_0x10a3d4[_0x5fdb('0x31')]=_[_0x5fdb('0x32')](_0x10a3d4[_0x5fdb('0x2f')],_0x10a3d4[_0x5fdb('0x30')]);_0x57c496[_0x5fdb('0x33')]=_['intersection'](_0x10a3d4[_0x5fdb('0x2f')],qs[_0x5fdb('0x34')](_0x47c3c2[_0x5fdb('0x30')][_0x5fdb('0x34')]));_0x57c496['attributes']=_0x57c496[_0x5fdb('0x33')][_0x5fdb('0x35')]?_0x57c496['attributes']:_0x10a3d4[_0x5fdb('0x2f')];if(_0x47c3c2['query'][_0x5fdb('0x41')]){_0x57c496[_0x5fdb('0x42')]=[{'all':!![]}];}_0x57c496=_[_0x5fdb('0x3a')]({},_0x57c496,_0x47c3c2[_0x5fdb('0x3d')]);return db[_0x5fdb('0x2a')]['find'](_0x57c496)[_0x5fdb('0x20')](handleEntityNotFound(_0x1bd301,null))[_0x5fdb('0x20')](respondWithResult(_0x1bd301,null))[_0x5fdb('0x43')](handleError(_0x1bd301,null));};exports[_0x5fdb('0x44')]=function(_0x1ddfb0,_0x49d1fb){return db[_0x5fdb('0x2a')][_0x5fdb('0x44')](_0x1ddfb0[_0x5fdb('0x45')],{})[_0x5fdb('0x20')](function(_0x457049){var _0x1a80a2=_0x1ddfb0[_0x5fdb('0x46')][_0x5fdb('0x21')]({'plain':!![]});if(!_0x1a80a2)throw new Error(_0x5fdb('0x47'));if(_0x1a80a2[_0x5fdb('0x48')]==='user'){var _0x2bc366=_0x457049[_0x5fdb('0x21')]({'plain':!![]});var _0xd37bf=_0x5fdb('0x22');return db['UserProfileSection'][_0x5fdb('0x49')]({'where':{'name':_0xd37bf,'userProfileId':_0x1a80a2[_0x5fdb('0x4a')]},'raw':!![]})[_0x5fdb('0x20')](function(_0x2d712f){if(_0x2d712f&&_0x2d712f[_0x5fdb('0x4b')]===0x0){return db[_0x5fdb('0x23')]['create']({'name':_0x2bc366['name'],'resourceId':_0x2bc366['id'],'type':_0x2d712f[_0x5fdb('0x26')],'sectionId':_0x2d712f['id']},{})[_0x5fdb('0x20')](function(){return _0x457049;});}else{return _0x457049;}})[_0x5fdb('0x43')](function(_0x3e816f){logger[_0x5fdb('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e816f);throw _0x3e816f;});}return _0x457049;})['then'](respondWithResult(_0x49d1fb,0xc9))[_0x5fdb('0x43')](handleError(_0x49d1fb,null));};exports['update']=function(_0x3a4621,_0x1be8f0){if(_0x3a4621[_0x5fdb('0x45')]['id']){delete _0x3a4621[_0x5fdb('0x45')]['id'];}return db[_0x5fdb('0x2a')]['find']({'where':{'id':_0x3a4621[_0x5fdb('0x40')]['id']}})[_0x5fdb('0x20')](handleEntityNotFound(_0x1be8f0,null))[_0x5fdb('0x20')](saveUpdates(_0x3a4621[_0x5fdb('0x45')],null))[_0x5fdb('0x20')](respondWithResult(_0x1be8f0,null))[_0x5fdb('0x43')](handleError(_0x1be8f0,null));};exports[_0x5fdb('0x24')]=function(_0x4a5d43,_0xd477c0){return db[_0x5fdb('0x2a')][_0x5fdb('0x49')]({'where':{'id':_0x4a5d43['params']['id']}})[_0x5fdb('0x20')](handleEntityNotFound(_0xd477c0,null))[_0x5fdb('0x20')](removeEntity(_0xd477c0,null))[_0x5fdb('0x43')](handleError(_0xd477c0,null));}; \ No newline at end of file +var _0xcb91=['json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','VoiceChanSpy','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','rows','catch','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x19efbc,_0x10b7d7){_0x19efbc=_0x19efbc-0x0;var _0x205c5e=_0xcb91[_0x19efbc];return _0x205c5e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){var _0x10a419=_0x55b232[_0x1cb9('0x24')]({'plain':!![]});var _0x69b4c8=_0x1cb9('0x25');return db[_0x1cb9('0x26')]['destroy']({'where':{'type':_0x69b4c8,'resourceId':_0x10a419['id']}})[_0x1cb9('0x22')](function(){return _0x55b232;});})[_0x1cb9('0x22')](function(){_0x27db16['status'](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x21effa,_0x41a9a0){return function(_0x1804fd){if(!_0x1804fd){_0x21effa[_0x1cb9('0x16')](0x194);}return _0x1804fd;};}function handleError(_0x21d6f5,_0x2e28fe){_0x2e28fe=_0x2e28fe||0x1f4;return function(_0xb644b3){logger[_0x1cb9('0x27')](_0xb644b3[_0x1cb9('0x28')]);if(_0xb644b3['name']){delete _0xb644b3[_0x1cb9('0x29')];}_0x21d6f5['status'](_0x2e28fe)[_0x1cb9('0x2a')](_0xb644b3);};}exports['index']=function(_0x278327,_0x41011c){var _0x3cd7f5={},_0x2038aa={},_0x561d89={'count':0x0,'rows':[]};var _0x1c701f=_['map'](db[_0x1cb9('0x2b')][_0x1cb9('0x2c')],function(_0x4220d7){return{'name':_0x4220d7['fieldName'],'type':_0x4220d7[_0x1cb9('0x2d')]['key']};});_0x2038aa[_0x1cb9('0x2e')]=_['map'](_0x1c701f,_0x1cb9('0x29'));_0x2038aa[_0x1cb9('0x2f')]=_[_0x1cb9('0x30')](_0x278327[_0x1cb9('0x2f')]);_0x2038aa['filters']=_[_0x1cb9('0x31')](_0x2038aa[_0x1cb9('0x2e')],_0x2038aa[_0x1cb9('0x2f')]);_0x3cd7f5[_0x1cb9('0x32')]=_[_0x1cb9('0x31')](_0x2038aa[_0x1cb9('0x2e')],qs[_0x1cb9('0x33')](_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x33')]));_0x3cd7f5[_0x1cb9('0x32')]=_0x3cd7f5[_0x1cb9('0x32')][_0x1cb9('0x34')]?_0x3cd7f5[_0x1cb9('0x32')]:_0x2038aa['model'];if(!_0x278327['query'][_0x1cb9('0x35')](_0x1cb9('0x36'))){_0x3cd7f5[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x1c')]);_0x3cd7f5[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0x278327['query'][_0x1cb9('0x1a')]);}_0x3cd7f5[_0x1cb9('0x37')]=qs[_0x1cb9('0x38')](_0x278327['query'][_0x1cb9('0x38')]);_0x3cd7f5['where']=qs[_0x1cb9('0x39')](_['pick'](_0x278327[_0x1cb9('0x2f')],_0x2038aa[_0x1cb9('0x39')]),_0x1c701f);if(_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3a')]){_0x3cd7f5[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](_0x3cd7f5[_0x1cb9('0x3b')],{'$or':_['map'](_0x1c701f,function(_0x4ca19e){if(_0x4ca19e[_0x1cb9('0x2d')]!==_0x1cb9('0x3d')){var _0x7a0d8b={};_0x7a0d8b[_0x4ca19e[_0x1cb9('0x29')]]={'$like':'%'+_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3a')]+'%'};return _0x7a0d8b;}})});}_0x3cd7f5=_[_0x1cb9('0x3c')]({},_0x3cd7f5,_0x278327['options']);var _0xbcaa32={'where':_0x3cd7f5['where']};return db['VoiceChanSpy']['count'](_0xbcaa32)[_0x1cb9('0x22')](function(_0x397ff9){_0x561d89[_0x1cb9('0x1d')]=_0x397ff9;if(_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3e')]){_0x3cd7f5['include']=[{'all':!![]}];}return db[_0x1cb9('0x2b')]['findAll'](_0x3cd7f5);})[_0x1cb9('0x22')](function(_0x71db9d){_0x561d89[_0x1cb9('0x3f')]=_0x71db9d;return _0x561d89;})['then'](respondWithFilteredResult(_0x41011c,_0x3cd7f5))[_0x1cb9('0x40')](handleError(_0x41011c,null));};exports['show']=function(_0xda1a44,_0xbc36fc){var _0x51a898={'raw':![],'where':{'id':_0xda1a44[_0x1cb9('0x41')]['id']}},_0x5839aa={};_0x5839aa[_0x1cb9('0x2e')]=_[_0x1cb9('0x30')](db[_0x1cb9('0x2b')][_0x1cb9('0x2c')]);_0x5839aa['query']=_[_0x1cb9('0x30')](_0xda1a44['query']);_0x5839aa['filters']=_['intersection'](_0x5839aa[_0x1cb9('0x2e')],_0x5839aa[_0x1cb9('0x2f')]);_0x51a898[_0x1cb9('0x32')]=_[_0x1cb9('0x31')](_0x5839aa[_0x1cb9('0x2e')],qs[_0x1cb9('0x33')](_0xda1a44[_0x1cb9('0x2f')][_0x1cb9('0x33')]));_0x51a898[_0x1cb9('0x32')]=_0x51a898[_0x1cb9('0x32')][_0x1cb9('0x34')]?_0x51a898['attributes']:_0x5839aa[_0x1cb9('0x2e')];if(_0xda1a44[_0x1cb9('0x2f')][_0x1cb9('0x3e')]){_0x51a898['include']=[{'all':!![]}];}_0x51a898=_[_0x1cb9('0x3c')]({},_0x51a898,_0xda1a44[_0x1cb9('0x42')]);return db[_0x1cb9('0x2b')][_0x1cb9('0x43')](_0x51a898)[_0x1cb9('0x22')](handleEntityNotFound(_0xbc36fc,null))['then'](respondWithResult(_0xbc36fc,null))[_0x1cb9('0x40')](handleError(_0xbc36fc,null));};exports['create']=function(_0x2eaa11,_0x4ac483){return db[_0x1cb9('0x2b')][_0x1cb9('0x44')](_0x2eaa11[_0x1cb9('0x45')],{})[_0x1cb9('0x22')](function(_0x56d0c5){var _0x298475=_0x2eaa11[_0x1cb9('0x46')][_0x1cb9('0x24')]({'plain':!![]});if(!_0x298475)throw new Error(_0x1cb9('0x47'));if(_0x298475[_0x1cb9('0x48')]===_0x1cb9('0x46')){var _0x17b92a=_0x56d0c5[_0x1cb9('0x24')]({'plain':!![]});var _0xbb500e=_0x1cb9('0x25');return db['UserProfileSection']['find']({'where':{'name':_0xbb500e,'userProfileId':_0x298475[_0x1cb9('0x49')]},'raw':!![]})[_0x1cb9('0x22')](function(_0x19e83a){if(_0x19e83a&&_0x19e83a[_0x1cb9('0x4a')]===0x0){return db[_0x1cb9('0x26')][_0x1cb9('0x44')]({'name':_0x17b92a[_0x1cb9('0x29')],'resourceId':_0x17b92a['id'],'type':_0x19e83a[_0x1cb9('0x29')],'sectionId':_0x19e83a['id']},{})[_0x1cb9('0x22')](function(){return _0x56d0c5;});}else{return _0x56d0c5;}})[_0x1cb9('0x40')](function(_0x4a4b87){logger[_0x1cb9('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a4b87);throw _0x4a4b87;});}return _0x56d0c5;})[_0x1cb9('0x22')](respondWithResult(_0x4ac483,0xc9))['catch'](handleError(_0x4ac483,null));};exports[_0x1cb9('0x21')]=function(_0x53c002,_0x5e5174){if(_0x53c002[_0x1cb9('0x45')]['id']){delete _0x53c002[_0x1cb9('0x45')]['id'];}return db[_0x1cb9('0x2b')]['find']({'where':{'id':_0x53c002[_0x1cb9('0x41')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x5e5174,null))['then'](saveUpdates(_0x53c002['body'],null))[_0x1cb9('0x22')](respondWithResult(_0x5e5174,null))[_0x1cb9('0x40')](handleError(_0x5e5174,null));};exports[_0x1cb9('0x23')]=function(_0x2b3f2a,_0x3de325){return db[_0x1cb9('0x2b')][_0x1cb9('0x43')]({'where':{'id':_0x2b3f2a['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x3de325,null))[_0x1cb9('0x22')](removeEntity(_0x3de325,null))[_0x1cb9('0x40')](handleError(_0x3de325,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index a3ddd20..8806d03 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 _0xcbf8=['name','options','join','StopMixMonitor','length','concat','internal','User','findAll','then','catch','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','system','merge','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password','ChanSpy','SIP/%s,%s'];(function(_0xef8714,_0x50b4ff){var _0x238712=function(_0x521a06){while(--_0x521a06){_0xef8714['push'](_0xef8714['shift']());}};_0x238712(++_0x50b4ff);}(_0xcbf8,0x1b4));var _0x8cbf=function(_0x25f63c,_0x35d98a){_0x25f63c=_0x25f63c-0x0;var _0xec739d=_0xcbf8[_0x25f63c];return _0xec739d;};'use strict';var _=require('lodash');var util=require(_0x8cbf('0x0'));var BPromise=require(_0x8cbf('0x1'));var attributes=require(_0x8cbf('0x2'));var getUserApplications=function(_0x56ed80,_0x49c6f6,_0x319a3c){var _0x1f2f85=0x1;var _0x2ade7c=[];var _0x4f0fa8={'context':_0x49c6f6[_0x8cbf('0x3')]||_0x8cbf('0x4'),'exten':util[_0x8cbf('0x5')]('%s%s',_0x56ed80['prefix'],_0x319a3c),'type':_0x8cbf('0x6'),'isApp':![],'ChanSpyId':_0x56ed80['id'],'UserId':_0x49c6f6['id']};_0x2ade7c['push'](_[_0x8cbf('0x7')]({'app':_0x8cbf('0x8'),'appdata':util[_0x8cbf('0x5')](_0x8cbf('0x9'),_0x8cbf('0xa')),'priority':_0x1f2f85++},_0x4f0fa8));if(_0x56ed80[_0x8cbf('0xb')]){_0x2ade7c[_0x8cbf('0xc')](_['merge']({'app':_0x8cbf('0xd'),'appdata':util[_0x8cbf('0x5')](_0x8cbf('0xe'),_0x56ed80[_0x8cbf('0xf')]),'priority':_0x1f2f85++},_0x4f0fa8));}if(_0x56ed80[_0x8cbf('0x10')]){_0x2ade7c[_0x8cbf('0xc')](_[_0x8cbf('0x7')]({'app':'Authenticate','appdata':_0x56ed80[_0x8cbf('0x11')],'priority':_0x1f2f85++},_0x4f0fa8));}_0x2ade7c[_0x8cbf('0xc')](_[_0x8cbf('0x7')]({'app':_0x8cbf('0x12'),'appdata':util[_0x8cbf('0x5')](_0x8cbf('0x13'),_0x49c6f6[_0x8cbf('0x14')],_0x56ed80[_0x8cbf('0x15')]?_0x56ed80[_0x8cbf('0x15')][_0x8cbf('0x16')](''):''),'priority':_0x1f2f85++},_0x4f0fa8));if(_0x56ed80[_0x8cbf('0xb')]){_0x2ade7c[_0x8cbf('0xc')](_[_0x8cbf('0x7')]({'app':_0x8cbf('0x17'),'priority':_0x1f2f85++},_0x4f0fa8));}return _0x2ade7c;};var getChanSpyApplications=function(_0x57278a,_0x5e05ac){var _0x5045a4=[];for(var _0x1fec0d=0x0,_0x3b1f5a=0x1;_0x1fec0d<_0x5e05ac[_0x8cbf('0x18')];_0x1fec0d++,_0x3b1f5a=0x1){_0x5045a4=_0x5045a4[_0x8cbf('0x19')](getUserApplications(_0x57278a,_0x5e05ac[_0x1fec0d],_0x5e05ac[_0x1fec0d]['internal']));if(_0x5e05ac[_0x1fec0d][_0x8cbf('0x1a')]!=_0x5e05ac[_0x1fec0d]['name']){_0x5045a4=_0x5045a4['concat'](getUserApplications(_0x57278a,_0x5e05ac[_0x1fec0d],_0x5e05ac[_0x1fec0d][_0x8cbf('0x14')]));}}return _0x5045a4;};var getChanSpyPromise=function(_0x21afbc,_0x40b141){return new BPromise(function(_0x391aeb,_0x4ed4ac){return _0x21afbc[_0x8cbf('0x1b')][_0x8cbf('0x1c')]({'attributes':['id',_0x8cbf('0x14'),_0x8cbf('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x8cbf('0x1d')](function(_0x144aa0){if(_0x144aa0){return _0x391aeb(getChanSpyApplications(_0x40b141,_0x144aa0));}return _0x391aeb([]);})[_0x8cbf('0x1e')](function(_0x344f7a){_0x4ed4ac(_0x344f7a);});});};module['exports']=function(_0x4cd89c,_0x533037){var _0x52b0ec=_0x4cd89c[_0x8cbf('0x1f')];return _0x4cd89c[_0x8cbf('0x20')](_0x8cbf('0x21'),attributes,{'tableName':_0x8cbf('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x50919b,_0x730bf,_0x4498c1){return getChanSpyPromise(_0x52b0ec,_0x50919b)['then'](function(_0x1c043e){if(_0x1c043e&&_0x1c043e[_0x8cbf('0x18')]){return _0x52b0ec[_0x8cbf('0x23')][_0x8cbf('0x24')](_0x1c043e);}})[_0x8cbf('0x1d')](function(){_0x4498c1();})[_0x8cbf('0x1e')](function(_0x22b17f){_0x4498c1(_0x22b17f);});},'afterUpdate':function(_0x7c0b9b,_0x49cec9,_0x5cf62e){return _0x52b0ec['VoiceExtension'][_0x8cbf('0x25')]({'where':{'ChanSpyId':_0x7c0b9b['id']}})[_0x8cbf('0x1d')](function(){return getChanSpyPromise(_0x52b0ec,_0x7c0b9b);})[_0x8cbf('0x1d')](function(_0x6a4d11){if(_0x6a4d11&&_0x6a4d11[_0x8cbf('0x18')]){return _0x52b0ec[_0x8cbf('0x23')][_0x8cbf('0x24')](_0x6a4d11);}})[_0x8cbf('0x1d')](function(){_0x5cf62e();})[_0x8cbf('0x1e')](function(_0x39dcb0){_0x5cf62e(_0x39dcb0);});},'afterDestroy':function(_0x5f2044,_0x4fdb43,_0x1adae2){return _0x52b0ec['VoiceExtension'][_0x8cbf('0x25')]({'where':{'ChanSpyId':_0x5f2044['id']}})[_0x8cbf('0x1d')](function(){_0x1adae2();})[_0x8cbf('0x1e')](function(_0x54845a){_0x1adae2(_0x54845a);});}}});}; \ No newline at end of file +var _0x451f=['models','define','VoiceChanSpy','voice_chanspy','length','catch','then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','format','system','push','Set','chanspy','merge','MixMonitor','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','record','StopMixMonitor','concat','internal','User','findAll','agent'];(function(_0x477837,_0x861827){var _0xa9a7c6=function(_0x2b7222){while(--_0x2b7222){_0x477837['push'](_0x477837['shift']());}};_0xa9a7c6(++_0x861827);}(_0x451f,0x9a));var _0xf451=function(_0x5340a9,_0x492c66){_0x5340a9=_0x5340a9-0x0;var _0x5cf940=_0x451f[_0x5340a9];return _0x5cf940;};'use strict';var _=require(_0xf451('0x0'));var util=require(_0xf451('0x1'));var BPromise=require(_0xf451('0x2'));var attributes=require(_0xf451('0x3'));var getUserApplications=function(_0x303aba,_0x413c3a,_0x5adc68){var _0x59d5cb=0x1;var _0x3ccba6=[];var _0x14d0d2={'context':_0x413c3a['context']||_0xf451('0x4'),'exten':util[_0xf451('0x5')]('%s%s',_0x303aba['prefix'],_0x5adc68),'type':_0xf451('0x6'),'isApp':![],'ChanSpyId':_0x303aba['id'],'UserId':_0x413c3a['id']};_0x3ccba6[_0xf451('0x7')](_['merge']({'app':_0xf451('0x8'),'appdata':util[_0xf451('0x5')]('CDR(type)=%s',_0xf451('0x9')),'priority':_0x59d5cb++},_0x14d0d2));if(_0x303aba['record']){_0x3ccba6['push'](_[_0xf451('0xa')]({'app':_0xf451('0xb'),'appdata':util[_0xf451('0x5')]('${UNIQUEID}.%s,a',_0x303aba[_0xf451('0xc')]),'priority':_0x59d5cb++},_0x14d0d2));}if(_0x303aba['auth']){_0x3ccba6[_0xf451('0x7')](_[_0xf451('0xa')]({'app':_0xf451('0xd'),'appdata':_0x303aba[_0xf451('0xe')],'priority':_0x59d5cb++},_0x14d0d2));}_0x3ccba6[_0xf451('0x7')](_[_0xf451('0xa')]({'app':_0xf451('0xf'),'appdata':util[_0xf451('0x5')](_0xf451('0x10'),_0x413c3a['name'],_0x303aba[_0xf451('0x11')]?_0x303aba[_0xf451('0x11')][_0xf451('0x12')](''):''),'priority':_0x59d5cb++},_0x14d0d2));if(_0x303aba[_0xf451('0x13')]){_0x3ccba6[_0xf451('0x7')](_['merge']({'app':_0xf451('0x14'),'priority':_0x59d5cb++},_0x14d0d2));}return _0x3ccba6;};var getChanSpyApplications=function(_0x1a4d15,_0x1bb77b){var _0x3c6202=[];for(var _0x1d0969=0x0,_0x54aa27=0x1;_0x1d0969<_0x1bb77b['length'];_0x1d0969++,_0x54aa27=0x1){_0x3c6202=_0x3c6202[_0xf451('0x15')](getUserApplications(_0x1a4d15,_0x1bb77b[_0x1d0969],_0x1bb77b[_0x1d0969][_0xf451('0x16')]));if(_0x1bb77b[_0x1d0969]['internal']!=_0x1bb77b[_0x1d0969]['name']){_0x3c6202=_0x3c6202['concat'](getUserApplications(_0x1a4d15,_0x1bb77b[_0x1d0969],_0x1bb77b[_0x1d0969]['name']));}}return _0x3c6202;};var getChanSpyPromise=function(_0x1d3849,_0x53c01b){return new BPromise(function(_0x3e5de4,_0x17c6ac){return _0x1d3849[_0xf451('0x17')][_0xf451('0x18')]({'attributes':['id','name',_0xf451('0x16')],'where':{'role':_0xf451('0x19'),'chanspy':!![]},'raw':!![]})['then'](function(_0x5aa5f5){if(_0x5aa5f5){return _0x3e5de4(getChanSpyApplications(_0x53c01b,_0x5aa5f5));}return _0x3e5de4([]);})['catch'](function(_0x10305c){_0x17c6ac(_0x10305c);});});};module['exports']=function(_0x59b497,_0x3b819b){var _0x3c8502=_0x59b497[_0xf451('0x1a')];return _0x59b497[_0xf451('0x1b')](_0xf451('0x1c'),attributes,{'tableName':_0xf451('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x353de1,_0x5ddd00,_0x5969d5){return getChanSpyPromise(_0x3c8502,_0x353de1)['then'](function(_0x1a9ff8){if(_0x1a9ff8&&_0x1a9ff8[_0xf451('0x1e')]){return _0x3c8502['VoiceExtension']['bulkCreate'](_0x1a9ff8);}})['then'](function(){_0x5969d5();})[_0xf451('0x1f')](function(_0xcc57c5){_0x5969d5(_0xcc57c5);});},'afterUpdate':function(_0x2d97c5,_0x29eefc,_0xa4a383){return _0x3c8502['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x2d97c5['id']}})[_0xf451('0x20')](function(){return getChanSpyPromise(_0x3c8502,_0x2d97c5);})['then'](function(_0x321543){if(_0x321543&&_0x321543[_0xf451('0x1e')]){return _0x3c8502[_0xf451('0x21')][_0xf451('0x22')](_0x321543);}})[_0xf451('0x20')](function(){_0xa4a383();})[_0xf451('0x1f')](function(_0xf223e4){_0xa4a383(_0xf223e4);});},'afterDestroy':function(_0x57a633,_0x31b8b2,_0x28f253){return _0x3c8502[_0xf451('0x21')][_0xf451('0x23')]({'where':{'ChanSpyId':_0x57a633['id']}})[_0xf451('0x20')](function(){_0x28f253();})[_0xf451('0x1f')](function(_0x1a9791){_0x28f253(_0x1a9791);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 067a09f..0c08673 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 _0x6b19=['error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b19,0xe8));var _0x96b1=function(_0x3f84d8,_0x3f789e){_0x3f84d8=_0x3f84d8-0x0;var _0x1faeec=_0x6b19[_0x3f84d8];return _0x1faeec;};'use strict';var _=require(_0x96b1('0x0'));var util=require(_0x96b1('0x1'));var moment=require('moment');var BPromise=require(_0x96b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96b1('0x3'))['db'];var utils=require(_0x96b1('0x4'));var logger=require(_0x96b1('0x5'))(_0x96b1('0x6'));var config=require(_0x96b1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x96b1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e3e1a,_0x572fde,_0x57a23a){return new BPromise(function(_0x307e65,_0x535cc9){return client[_0x96b1('0x9')](_0x3e3e1a,_0x57a23a)['then'](function(_0x36ea50){logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x572fde,_0x96b1('0xc'));logger[_0x96b1('0xd')](_0x96b1('0xe'),_0x572fde,_0x96b1('0xc'),JSON['stringify'](_0x36ea50));if(_0x36ea50['error']){if(_0x36ea50[_0x96b1('0xf')]['code']===0x1f4){logger['error'](_0x96b1('0xb'),_0x572fde,_0x36ea50[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x535cc9(_0x36ea50['error'][_0x96b1('0x10')]);}logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x572fde,_0x36ea50[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x307e65(_0x36ea50['error'][_0x96b1('0x10')]);}else{logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x572fde,_0x96b1('0xc'));_0x307e65(_0x36ea50[_0x96b1('0x11')][_0x96b1('0x10')]);}})[_0x96b1('0x12')](function(_0x2d5a32){logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x572fde,_0x2d5a32);_0x535cc9(_0x2d5a32);});});} \ No newline at end of file +var _0xa75b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x10e09d,_0x481ccd){var _0x388e1f=function(_0x1017aa){while(--_0x1017aa){_0x10e09d['push'](_0x10e09d['shift']());}};_0x388e1f(++_0x481ccd);}(_0xa75b,0x170));var _0xba75=function(_0x4ae96b,_0x489c31){_0x4ae96b=_0x4ae96b-0x0;var _0x1b4b2a=_0xa75b[_0x4ae96b];return _0x1b4b2a;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba75('0x1'));var rs=require(_0xba75('0x2'));var fs=require('fs');var Redis=require(_0xba75('0x3'));var db=require(_0xba75('0x4'))['db'];var utils=require(_0xba75('0x5'));var logger=require(_0xba75('0x6'))(_0xba75('0x7'));var config=require(_0xba75('0x8'));var jayson=require(_0xba75('0x9'));var client=jayson[_0xba75('0xa')][_0xba75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238a33,_0x3ccab5,_0x5c79e3){return new BPromise(function(_0x4b842d,_0x731cae){return client['request'](_0x238a33,_0x5c79e3)['then'](function(_0x218dbd){logger['info'](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));logger[_0xba75('0xe')](_0xba75('0xf'),_0x3ccab5,_0xba75('0xd'),JSON[_0xba75('0x10')](_0x218dbd));if(_0x218dbd[_0xba75('0x11')]){if(_0x218dbd[_0xba75('0x11')][_0xba75('0x12')]===0x1f4){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')]['message']);return _0x731cae(_0x218dbd['error'][_0xba75('0x13')]);}logger['error'](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')][_0xba75('0x13')]);return _0x4b842d(_0x218dbd[_0xba75('0x11')]['message']);}else{logger[_0xba75('0x14')](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));_0x4b842d(_0x218dbd[_0xba75('0x15')][_0xba75('0x13')]);}})['catch'](function(_0x350a9d){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x350a9d);_0x731cae(_0x350a9d);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 3828fe2..acee17b 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 _0xd366=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','create','put','update','delete','destroy','exports','multer','util'];(function(_0x4e0417,_0x574fd4){var _0x5d6909=function(_0x54e5d3){while(--_0x54e5d3){_0x4e0417['push'](_0x4e0417['shift']());}};_0x5d6909(++_0x574fd4);}(_0xd366,0x152));var _0x6d36=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xd366[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x6d36('0x0'));var util=require(_0x6d36('0x1'));var path=require(_0x6d36('0x2'));var timeout=require(_0x6d36('0x3'));var express=require(_0x6d36('0x4'));var router=express[_0x6d36('0x5')]();var fs_extra=require(_0x6d36('0x6'));var auth=require(_0x6d36('0x7'));var interaction=require(_0x6d36('0x8'));var config=require(_0x6d36('0x9'));var controller=require(_0x6d36('0xa'));router[_0x6d36('0xb')]('/',auth[_0x6d36('0xc')](),controller['index']);router[_0x6d36('0xb')](_0x6d36('0xd'),auth[_0x6d36('0xc')](),controller['show']);router['post']('/',auth[_0x6d36('0xc')](),controller[_0x6d36('0xe')]);router[_0x6d36('0xf')]('/:id',auth[_0x6d36('0xc')](),controller[_0x6d36('0x10')]);router[_0x6d36('0x11')](_0x6d36('0xd'),auth[_0x6d36('0xc')](),controller[_0x6d36('0x12')]);module[_0x6d36('0x13')]=router; \ No newline at end of file +var _0x5147=['destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','isAuthenticated','index','get','/:id','show','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5147,0x16a));var _0x7514=function(_0x44a444,_0x3b7cdd){_0x44a444=_0x44a444-0x0;var _0x256b75=_0x5147[_0x44a444];return _0x256b75;};'use strict';var multer=require('multer');var util=require(_0x7514('0x0'));var path=require(_0x7514('0x1'));var timeout=require(_0x7514('0x2'));var express=require(_0x7514('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7514('0x4'));var interaction=require(_0x7514('0x5'));var config=require('../../config/environment');var controller=require(_0x7514('0x6'));router['get']('/',auth[_0x7514('0x7')](),controller[_0x7514('0x8')]);router[_0x7514('0x9')](_0x7514('0xa'),auth[_0x7514('0x7')](),controller[_0x7514('0xb')]);router['post']('/',auth[_0x7514('0x7')](),controller['create']);router[_0x7514('0xc')](_0x7514('0xa'),auth[_0x7514('0x7')](),controller['update']);router['delete']('/:id',auth[_0x7514('0x7')](),controller[_0x7514('0xd')]);module[_0x7514('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 7786ef0..26d1caf 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 _0xc610=['name','STRING','BOOLEAN','sequelize','exports'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xc610,0x13e));var _0x0c61=function(_0x13b2cb,_0x5bbcbd){_0x13b2cb=_0x13b2cb-0x0;var _0x25679d=_0xc610[_0x13b2cb];return _0x25679d;};'use strict';var Sequelize=require(_0x0c61('0x0'));module[_0x0c61('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0c61('0x2')},'description':{'type':Sequelize[_0x0c61('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x0c61('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5113=['exports','STRING','name','BOOLEAN'];(function(_0x2ada80,_0x49dd55){var _0x3dfa1e=function(_0x55e7a7){while(--_0x55e7a7){_0x2ada80['push'](_0x2ada80['shift']());}};_0x3dfa1e(++_0x49dd55);}(_0x5113,0x90));var _0x3511=function(_0x17d389,_0x2f85bf){_0x17d389=_0x17d389-0x0;var _0x28a0c4=_0x5113[_0x17d389];return _0x28a0c4;};'use strict';var Sequelize=require('sequelize');module[_0x3511('0x0')]={'name':{'type':Sequelize[_0x3511('0x1')],'unique':_0x3511('0x2')},'description':{'type':Sequelize[_0x3511('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x3511('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 4e2ca2f..c0f1e0c 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 _0x1923=['VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','status','send','map','VoiceContext','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','name','includeAll','include','findAll','rows','show','params','find','create','body','readFileSync','root','server/files/templates/context.ejs','utf8','render','writeFileSync','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Contexts','userProfileId','autoAssociation','Reload','join','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info'];(function(_0x4399c6,_0x293f20){var _0x532c29=function(_0x312f8d){while(--_0x312f8d){_0x4399c6['push'](_0x4399c6['shift']());}};_0x532c29(++_0x293f20);}(_0x1923,0x187));var _0x3192=function(_0x32d1c2,_0x1d4f71){_0x32d1c2=_0x32d1c2-0x0;var _0x206e55=_0x1923[_0x32d1c2];return _0x206e55;};'use strict';var emlformat=require(_0x3192('0x0'));var rimraf=require(_0x3192('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3192('0x2'));var rp=require(_0x3192('0x3'));var moment=require(_0x3192('0x4'));var BPromise=require(_0x3192('0x5'));var Mustache=require('mustache');var util=require(_0x3192('0x6'));var path=require('path');var sox=require(_0x3192('0x7'));var csv=require(_0x3192('0x8'));var ejs=require(_0x3192('0x9'));var fs=require('fs');var fs_extra=require(_0x3192('0xa'));var _=require('lodash');var squel=require(_0x3192('0xb'));var crypto=require(_0x3192('0xc'));var jsforce=require(_0x3192('0xd'));var deskjs=require(_0x3192('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3192('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3192('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3192('0x11'));var hardwareService=require(_0x3192('0x12'));var logger=require(_0x3192('0x13'))(_0x3192('0x14'));var utils=require(_0x3192('0x15'));var config=require(_0x3192('0x16'));var licenseUtil=require(_0x3192('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3192('0x18'));var client=jayson[_0x3192('0x19')][_0x3192('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x17276f,_0x8b18f,_0x115480,_0x629655){return new BPromise(function(_0x52064d,_0x4e5a91){var _0x23ba09=_0x629655||client;return _0x23ba09[_0x3192('0x1b')](_0x17276f,_0x115480)['then'](function(_0x1e5bea){logger[_0x3192('0x1c')](_0x3192('0x1d'),_0x8b18f,'request\x20sent');logger[_0x3192('0x1e')](_0x3192('0x1f'),_0x8b18f,_0x3192('0x20'),JSON[_0x3192('0x21')](_0x1e5bea));if(_0x1e5bea[_0x3192('0x22')]){if(_0x1e5bea[_0x3192('0x22')][_0x3192('0x23')]===0x1f4){logger['error'](_0x3192('0x1d'),_0x8b18f,_0x1e5bea[_0x3192('0x22')][_0x3192('0x24')]);return _0x4e5a91(_0x1e5bea[_0x3192('0x22')][_0x3192('0x24')]);}logger[_0x3192('0x22')](_0x3192('0x1d'),_0x8b18f,_0x1e5bea['error'][_0x3192('0x24')]);return _0x52064d(_0x1e5bea['error'][_0x3192('0x24')]);}else{logger['info'](_0x3192('0x1d'),_0x8b18f,_0x3192('0x20'));_0x52064d(_0x1e5bea[_0x3192('0x25')]['message']);}})[_0x3192('0x26')](function(_0x4fff08){logger[_0x3192('0x22')](_0x3192('0x1d'),_0x8b18f,_0x4fff08);_0x4e5a91(_0x4fff08);});});}function respondWithStatusCode(_0x213848,_0x4d0c07){_0x4d0c07=_0x4d0c07||0xcc;return function(_0xbe418f){if(_0xbe418f){return _0x213848[_0x3192('0x27')](_0x4d0c07);}return _0x213848['status'](_0x4d0c07)[_0x3192('0x28')]();};}function respondWithResult(_0x1ccd2a,_0x25db54){_0x25db54=_0x25db54||0xc8;return function(_0x5e1b58){if(_0x5e1b58){return _0x1ccd2a['status'](_0x25db54)[_0x3192('0x29')](_0x5e1b58);}};}function respondWithFilteredResult(_0x35b305,_0xbb7724){return function(_0x4e09fb){if(_0x4e09fb){var _0x308d3f=typeof _0xbb7724['offset']==='undefined'&&typeof _0xbb7724[_0x3192('0x2a')]===_0x3192('0x2b');var _0x4890d7=_0x4e09fb[_0x3192('0x2c')];var _0x41d6e1=_0x308d3f?0x0:_0xbb7724['offset'];var _0x339edf=_0x308d3f?_0x4e09fb[_0x3192('0x2c')]:_0xbb7724[_0x3192('0x2d')]+_0xbb7724['limit'];var _0x5d1c17;if(_0x339edf>=_0x4890d7){_0x339edf=_0x4890d7;_0x5d1c17=0xc8;}else{_0x5d1c17=0xce;}_0x35b305['status'](_0x5d1c17);return _0x35b305[_0x3192('0x2e')](_0x3192('0x2f'),_0x41d6e1+'-'+_0x339edf+'/'+_0x4890d7)[_0x3192('0x29')](_0x4e09fb);}return null;};}function patchUpdates(_0x1c7b1f){return function(_0xdcb8f){try{jsonpatch[_0x3192('0x30')](_0xdcb8f,_0x1c7b1f,!![]);}catch(_0x51e5fd){return BPromise[_0x3192('0x31')](_0x51e5fd);}return _0xdcb8f[_0x3192('0x32')]();};}function saveUpdates(_0x294c30,_0x29e461){return function(_0x370c98){if(_0x370c98){return _0x370c98[_0x3192('0x33')](_0x294c30)[_0x3192('0x34')](function(_0x554632){return _0x554632;});}return null;};}function removeEntity(_0x5aac99,_0x443b8f){return function(_0xd8ab92){if(_0xd8ab92){return _0xd8ab92[_0x3192('0x35')]()[_0x3192('0x34')](function(){var _0xa8ea74=_0xd8ab92[_0x3192('0x36')]({'plain':!![]});var _0x17a108='Contexts';return db[_0x3192('0x37')]['destroy']({'where':{'type':_0x17a108,'resourceId':_0xa8ea74['id']}})['then'](function(){return _0xd8ab92;});})[_0x3192('0x34')](function(){_0x5aac99[_0x3192('0x38')](0xcc)[_0x3192('0x28')]();});}};}function handleEntityNotFound(_0x262541,_0x29f7cc){return function(_0x1dbeff){if(!_0x1dbeff){_0x262541['sendStatus'](0x194);}return _0x1dbeff;};}function handleError(_0x5d7952,_0x1195ad){_0x1195ad=_0x1195ad||0x1f4;return function(_0x5d04d8){logger['error'](_0x5d04d8['stack']);if(_0x5d04d8['name']){delete _0x5d04d8['name'];}_0x5d7952['status'](_0x1195ad)[_0x3192('0x39')](_0x5d04d8);};}exports['index']=function(_0x5ec058,_0x227073){var _0x276a86={},_0x133120={},_0x522422={'count':0x0,'rows':[]};var _0x394c43=_[_0x3192('0x3a')](db[_0x3192('0x3b')][_0x3192('0x3c')],function(_0x3f4e69){return{'name':_0x3f4e69['fieldName'],'type':_0x3f4e69[_0x3192('0x3d')][_0x3192('0x3e')]};});_0x133120[_0x3192('0x3f')]=_['map'](_0x394c43,'name');_0x133120['query']=_[_0x3192('0x40')](_0x5ec058[_0x3192('0x41')]);_0x133120[_0x3192('0x42')]=_[_0x3192('0x43')](_0x133120['model'],_0x133120[_0x3192('0x41')]);_0x276a86['attributes']=_[_0x3192('0x43')](_0x133120[_0x3192('0x3f')],qs[_0x3192('0x44')](_0x5ec058[_0x3192('0x41')][_0x3192('0x44')]));_0x276a86[_0x3192('0x45')]=_0x276a86[_0x3192('0x45')][_0x3192('0x46')]?_0x276a86['attributes']:_0x133120[_0x3192('0x3f')];if(!_0x5ec058['query'][_0x3192('0x47')]('nolimit')){_0x276a86[_0x3192('0x2a')]=qs[_0x3192('0x2a')](_0x5ec058['query'][_0x3192('0x2a')]);_0x276a86[_0x3192('0x2d')]=qs[_0x3192('0x2d')](_0x5ec058[_0x3192('0x41')]['offset']);}_0x276a86[_0x3192('0x48')]=qs[_0x3192('0x49')](_0x5ec058[_0x3192('0x41')][_0x3192('0x49')]);_0x276a86['where']=qs[_0x3192('0x42')](_[_0x3192('0x4a')](_0x5ec058[_0x3192('0x41')],_0x133120['filters']),_0x394c43);if(_0x5ec058['query'][_0x3192('0x4b')]){_0x276a86[_0x3192('0x4c')]=_[_0x3192('0x4d')](_0x276a86[_0x3192('0x4c')],{'$or':_['map'](_0x394c43,function(_0x1671ad){if(_0x1671ad[_0x3192('0x3d')]!=='VIRTUAL'){var _0x68d538={};_0x68d538[_0x1671ad[_0x3192('0x4e')]]={'$like':'%'+_0x5ec058[_0x3192('0x41')][_0x3192('0x4b')]+'%'};return _0x68d538;}})});}_0x276a86=_[_0x3192('0x4d')]({},_0x276a86,_0x5ec058['options']);var _0x1964ba={'where':_0x276a86[_0x3192('0x4c')]};return db[_0x3192('0x3b')][_0x3192('0x2c')](_0x1964ba)[_0x3192('0x34')](function(_0x1c5a27){_0x522422['count']=_0x1c5a27;if(_0x5ec058[_0x3192('0x41')][_0x3192('0x4f')]){_0x276a86[_0x3192('0x50')]=[{'all':!![]}];}return db['VoiceContext'][_0x3192('0x51')](_0x276a86);})[_0x3192('0x34')](function(_0x1d1e32){_0x522422[_0x3192('0x52')]=_0x1d1e32;return _0x522422;})[_0x3192('0x34')](respondWithFilteredResult(_0x227073,_0x276a86))[_0x3192('0x26')](handleError(_0x227073,null));};exports[_0x3192('0x53')]=function(_0x10fdbe,_0x66d6ad){var _0x4eabc0={'raw':![],'where':{'id':_0x10fdbe[_0x3192('0x54')]['id']}},_0x249d51={};_0x249d51[_0x3192('0x3f')]=_[_0x3192('0x40')](db[_0x3192('0x3b')][_0x3192('0x3c')]);_0x249d51[_0x3192('0x41')]=_['keys'](_0x10fdbe[_0x3192('0x41')]);_0x249d51[_0x3192('0x42')]=_[_0x3192('0x43')](_0x249d51[_0x3192('0x3f')],_0x249d51[_0x3192('0x41')]);_0x4eabc0[_0x3192('0x45')]=_[_0x3192('0x43')](_0x249d51[_0x3192('0x3f')],qs['fields'](_0x10fdbe['query'][_0x3192('0x44')]));_0x4eabc0[_0x3192('0x45')]=_0x4eabc0[_0x3192('0x45')][_0x3192('0x46')]?_0x4eabc0[_0x3192('0x45')]:_0x249d51[_0x3192('0x3f')];if(_0x10fdbe[_0x3192('0x41')]['includeAll']){_0x4eabc0[_0x3192('0x50')]=[{'all':!![]}];}_0x4eabc0=_[_0x3192('0x4d')]({},_0x4eabc0,_0x10fdbe['options']);return db[_0x3192('0x3b')][_0x3192('0x55')](_0x4eabc0)['then'](handleEntityNotFound(_0x66d6ad,null))[_0x3192('0x34')](respondWithResult(_0x66d6ad,null))['catch'](handleError(_0x66d6ad,null));};exports[_0x3192('0x56')]=function(_0xd2d64f,_0xcda527,_0x4d2d22){var _0x3ad50d;return db[_0x3192('0x3b')]['create'](_0xd2d64f[_0x3192('0x57')],{'raw':!![]})['then'](function(_0x5e793c){_0x3ad50d=_0x5e793c;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x1136a6){var _0x4c6b3d=fs[_0x3192('0x58')](path['join'](config[_0x3192('0x59')],_0x3192('0x5a')),_0x3192('0x5b'));var _0x58a593=ejs[_0x3192('0x5c')](_0x4c6b3d,{'contexts':_0x1136a6||[]});fs[_0x3192('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x58a593);})[_0x3192('0x34')](function(){return respondWithRpcPromise('Reload',_0x3192('0x56'),{'module':_0x3192('0x5e')});})[_0x3192('0x34')](function(){var _0x13922f=_0xd2d64f[_0x3192('0x5f')][_0x3192('0x36')]({'plain':!![]});if(!_0x13922f)throw new Error(_0x3192('0x60'));if(_0x13922f[_0x3192('0x61')]===_0x3192('0x5f')){var _0xced172=_0x3ad50d[_0x3192('0x36')]({'plain':!![]});return db[_0x3192('0x62')][_0x3192('0x55')]({'where':{'name':_0x3192('0x63'),'userProfileId':_0x13922f[_0x3192('0x64')]},'raw':!![]})[_0x3192('0x34')](function(_0xbded30){if(_0xbded30&&_0xbded30[_0x3192('0x65')]===0x0){return db[_0x3192('0x37')]['create']({'name':_0xced172[_0x3192('0x4e')],'resourceId':_0xced172['id'],'type':_0xbded30['name'],'sectionId':_0xbded30['id']},{})[_0x3192('0x34')](function(){return _0x3ad50d;});}else{return _0x3ad50d;}})[_0x3192('0x26')](function(_0xdcaa6b){logger[_0x3192('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdcaa6b);throw _0xdcaa6b;});}return _0x3ad50d;})[_0x3192('0x34')](respondWithResult(_0xcda527,0xc9))[_0x3192('0x26')](handleError(_0xcda527,null));};exports[_0x3192('0x33')]=function(_0x58b233,_0x275773,_0x1b52e6){var _0x5c1a49;return db[_0x3192('0x3b')]['find']({'where':{'id':_0x58b233[_0x3192('0x54')]['id']}})[_0x3192('0x34')](handleEntityNotFound(_0x275773,null))[_0x3192('0x34')](saveUpdates(_0x58b233[_0x3192('0x57')],null))[_0x3192('0x34')](function(_0x147ec2){if(_0x147ec2){_0x5c1a49=_0x147ec2;return db[_0x3192('0x3b')][_0x3192('0x51')]({'raw':!![]});}})[_0x3192('0x34')](function(_0x3f72d8){var _0x1438dc=fs['readFileSync'](path['join'](config[_0x3192('0x59')],_0x3192('0x5a')),_0x3192('0x5b'));var _0x34b642=ejs[_0x3192('0x5c')](_0x1438dc,{'contexts':_0x3f72d8||[]});fs[_0x3192('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x34b642);})[_0x3192('0x34')](function(){return respondWithRpcPromise(_0x3192('0x66'),_0x3192('0x33'),{'module':_0x3192('0x5e')});})['then'](function(){return _0x5c1a49;})[_0x3192('0x34')](respondWithResult(_0x275773,null))[_0x3192('0x26')](handleError(_0x275773,null));};exports[_0x3192('0x35')]=function(_0x16bdff,_0x43a121,_0x5419a1){var _0x55559b;return db[_0x3192('0x3b')][_0x3192('0x55')]({'where':{'id':_0x16bdff[_0x3192('0x54')]['id']}})[_0x3192('0x34')](handleEntityNotFound(_0x43a121,null))[_0x3192('0x34')](removeEntity(_0x43a121,null))[_0x3192('0x34')](function(){return db[_0x3192('0x3b')]['findAll']({'raw':!![]});})[_0x3192('0x34')](function(_0x3d378e){var _0xf67a8f=fs[_0x3192('0x58')](path[_0x3192('0x67')](config['root'],_0x3192('0x5a')),'utf8');var _0xf7795a=ejs[_0x3192('0x5c')](_0xf67a8f,{'contexts':_0x3d378e});fs[_0x3192('0x5d')](_0x3192('0x68'),_0xf7795a);return respondWithRpcPromise('Reload','destroy',{'module':_0x3192('0x5e')});})[_0x3192('0x26')](handleError(_0x43a121,null));}; \ No newline at end of file +var _0xab43=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','end','stack','name','map','VoiceContext','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','utf8','render','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info'];(function(_0xdb7fcb,_0x12a4a5){var _0x43fb67=function(_0x3a17b5){while(--_0x3a17b5){_0xdb7fcb['push'](_0xdb7fcb['shift']());}};_0x43fb67(++_0x12a4a5);}(_0xab43,0x10f));var _0x3ab4=function(_0x5504bc,_0x4ab540){_0x5504bc=_0x5504bc-0x0;var _0x4086d8=_0xab43[_0x5504bc];return _0x4086d8;};'use strict';var emlformat=require(_0x3ab4('0x0'));var rimraf=require(_0x3ab4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ab4('0x2'));var rp=require(_0x3ab4('0x3'));var moment=require(_0x3ab4('0x4'));var BPromise=require(_0x3ab4('0x5'));var Mustache=require('mustache');var util=require(_0x3ab4('0x6'));var path=require(_0x3ab4('0x7'));var sox=require(_0x3ab4('0x8'));var csv=require(_0x3ab4('0x9'));var ejs=require(_0x3ab4('0xa'));var fs=require('fs');var fs_extra=require(_0x3ab4('0xb'));var _=require(_0x3ab4('0xc'));var squel=require('squel');var crypto=require(_0x3ab4('0xd'));var jsforce=require(_0x3ab4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3ab4('0x9'));var querystring=require(_0x3ab4('0xf'));var Papa=require(_0x3ab4('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3ab4('0x11'));var as=require(_0x3ab4('0x12'));var hardwareService=require(_0x3ab4('0x13'));var logger=require(_0x3ab4('0x14'))('api');var utils=require(_0x3ab4('0x15'));var config=require(_0x3ab4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3ab4('0x17'))['db'];var jayson=require(_0x3ab4('0x18'));var client=jayson['client'][_0x3ab4('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3d6dd2,_0x2ee19d,_0x4ae432,_0x4d70ea){return new BPromise(function(_0x153c7b,_0x45b202){var _0x5a590c=_0x4d70ea||client;return _0x5a590c[_0x3ab4('0x1a')](_0x3d6dd2,_0x4ae432)[_0x3ab4('0x1b')](function(_0x1652c7){logger[_0x3ab4('0x1c')](_0x3ab4('0x1d'),_0x2ee19d,_0x3ab4('0x1e'));logger[_0x3ab4('0x1f')](_0x3ab4('0x20'),_0x2ee19d,_0x3ab4('0x1e'),JSON['stringify'](_0x1652c7));if(_0x1652c7[_0x3ab4('0x21')]){if(_0x1652c7[_0x3ab4('0x21')][_0x3ab4('0x22')]===0x1f4){logger[_0x3ab4('0x21')](_0x3ab4('0x1d'),_0x2ee19d,_0x1652c7[_0x3ab4('0x21')]['message']);return _0x45b202(_0x1652c7[_0x3ab4('0x21')][_0x3ab4('0x23')]);}logger[_0x3ab4('0x21')](_0x3ab4('0x1d'),_0x2ee19d,_0x1652c7[_0x3ab4('0x21')]['message']);return _0x153c7b(_0x1652c7[_0x3ab4('0x21')][_0x3ab4('0x23')]);}else{logger['info'](_0x3ab4('0x1d'),_0x2ee19d,_0x3ab4('0x1e'));_0x153c7b(_0x1652c7[_0x3ab4('0x24')][_0x3ab4('0x23')]);}})['catch'](function(_0x3f170c){logger['error'](_0x3ab4('0x1d'),_0x2ee19d,_0x3f170c);_0x45b202(_0x3f170c);});});}function respondWithStatusCode(_0x3eebcc,_0x466167){_0x466167=_0x466167||0xcc;return function(_0x5c580a){if(_0x5c580a){return _0x3eebcc['sendStatus'](_0x466167);}return _0x3eebcc[_0x3ab4('0x25')](_0x466167)['end']();};}function respondWithResult(_0x2df489,_0x3ec346){_0x3ec346=_0x3ec346||0xc8;return function(_0x312954){if(_0x312954){return _0x2df489['status'](_0x3ec346)[_0x3ab4('0x26')](_0x312954);}};}function respondWithFilteredResult(_0x473518,_0x41ff5e){return function(_0x4a0218){if(_0x4a0218){var _0x268ee3=typeof _0x41ff5e[_0x3ab4('0x27')]===_0x3ab4('0x28')&&typeof _0x41ff5e[_0x3ab4('0x29')]==='undefined';var _0x3153d3=_0x4a0218[_0x3ab4('0x2a')];var _0x22f27d=_0x268ee3?0x0:_0x41ff5e[_0x3ab4('0x27')];var _0x593326=_0x268ee3?_0x4a0218['count']:_0x41ff5e[_0x3ab4('0x27')]+_0x41ff5e[_0x3ab4('0x29')];var _0x5a5cf5;if(_0x593326>=_0x3153d3){_0x593326=_0x3153d3;_0x5a5cf5=0xc8;}else{_0x5a5cf5=0xce;}_0x473518['status'](_0x5a5cf5);return _0x473518[_0x3ab4('0x2b')](_0x3ab4('0x2c'),_0x22f27d+'-'+_0x593326+'/'+_0x3153d3)[_0x3ab4('0x26')](_0x4a0218);}return null;};}function patchUpdates(_0x638c2c){return function(_0x2ab207){try{jsonpatch[_0x3ab4('0x2d')](_0x2ab207,_0x638c2c,!![]);}catch(_0x4e555c){return BPromise[_0x3ab4('0x2e')](_0x4e555c);}return _0x2ab207[_0x3ab4('0x2f')]();};}function saveUpdates(_0x28a475,_0x4e4040){return function(_0xf44fee){if(_0xf44fee){return _0xf44fee[_0x3ab4('0x30')](_0x28a475)[_0x3ab4('0x1b')](function(_0x1b9849){return _0x1b9849;});}return null;};}function removeEntity(_0x590057,_0x5af35b){return function(_0x40b68d){if(_0x40b68d){return _0x40b68d[_0x3ab4('0x31')]()[_0x3ab4('0x1b')](function(){var _0x328afd=_0x40b68d[_0x3ab4('0x32')]({'plain':!![]});var _0x20ac03=_0x3ab4('0x33');return db[_0x3ab4('0x34')][_0x3ab4('0x31')]({'where':{'type':_0x20ac03,'resourceId':_0x328afd['id']}})[_0x3ab4('0x1b')](function(){return _0x40b68d;});})[_0x3ab4('0x1b')](function(){_0x590057[_0x3ab4('0x25')](0xcc)[_0x3ab4('0x35')]();});}};}function handleEntityNotFound(_0x149616,_0x563427){return function(_0xbbd9ef){if(!_0xbbd9ef){_0x149616['sendStatus'](0x194);}return _0xbbd9ef;};}function handleError(_0x4dc5e4,_0x2515d9){_0x2515d9=_0x2515d9||0x1f4;return function(_0x326c07){logger[_0x3ab4('0x21')](_0x326c07[_0x3ab4('0x36')]);if(_0x326c07[_0x3ab4('0x37')]){delete _0x326c07[_0x3ab4('0x37')];}_0x4dc5e4[_0x3ab4('0x25')](_0x2515d9)['send'](_0x326c07);};}exports['index']=function(_0x4a3388,_0x5cf48f){var _0x4e503a={},_0x46d91c={},_0x536fa3={'count':0x0,'rows':[]};var _0x4bcc26=_[_0x3ab4('0x38')](db[_0x3ab4('0x39')][_0x3ab4('0x3a')],function(_0x3827e3){return{'name':_0x3827e3[_0x3ab4('0x3b')],'type':_0x3827e3['type']['key']};});_0x46d91c[_0x3ab4('0x3c')]=_['map'](_0x4bcc26,_0x3ab4('0x37'));_0x46d91c[_0x3ab4('0x3d')]=_[_0x3ab4('0x3e')](_0x4a3388[_0x3ab4('0x3d')]);_0x46d91c[_0x3ab4('0x3f')]=_[_0x3ab4('0x40')](_0x46d91c[_0x3ab4('0x3c')],_0x46d91c[_0x3ab4('0x3d')]);_0x4e503a[_0x3ab4('0x41')]=_[_0x3ab4('0x40')](_0x46d91c[_0x3ab4('0x3c')],qs['fields'](_0x4a3388[_0x3ab4('0x3d')][_0x3ab4('0x42')]));_0x4e503a['attributes']=_0x4e503a[_0x3ab4('0x41')]['length']?_0x4e503a[_0x3ab4('0x41')]:_0x46d91c[_0x3ab4('0x3c')];if(!_0x4a3388['query']['hasOwnProperty']('nolimit')){_0x4e503a[_0x3ab4('0x29')]=qs[_0x3ab4('0x29')](_0x4a3388[_0x3ab4('0x3d')][_0x3ab4('0x29')]);_0x4e503a[_0x3ab4('0x27')]=qs['offset'](_0x4a3388['query'][_0x3ab4('0x27')]);}_0x4e503a[_0x3ab4('0x43')]=qs[_0x3ab4('0x44')](_0x4a3388[_0x3ab4('0x3d')][_0x3ab4('0x44')]);_0x4e503a['where']=qs[_0x3ab4('0x3f')](_['pick'](_0x4a3388[_0x3ab4('0x3d')],_0x46d91c[_0x3ab4('0x3f')]),_0x4bcc26);if(_0x4a3388[_0x3ab4('0x3d')][_0x3ab4('0x45')]){_0x4e503a[_0x3ab4('0x46')]=_[_0x3ab4('0x47')](_0x4e503a[_0x3ab4('0x46')],{'$or':_[_0x3ab4('0x38')](_0x4bcc26,function(_0x35a7f7){if(_0x35a7f7['type']!==_0x3ab4('0x48')){var _0x37ce7c={};_0x37ce7c[_0x35a7f7[_0x3ab4('0x37')]]={'$like':'%'+_0x4a3388[_0x3ab4('0x3d')][_0x3ab4('0x45')]+'%'};return _0x37ce7c;}})});}_0x4e503a=_[_0x3ab4('0x47')]({},_0x4e503a,_0x4a3388[_0x3ab4('0x49')]);var _0x1e94dc={'where':_0x4e503a[_0x3ab4('0x46')]};return db['VoiceContext'][_0x3ab4('0x2a')](_0x1e94dc)[_0x3ab4('0x1b')](function(_0x433c76){_0x536fa3[_0x3ab4('0x2a')]=_0x433c76;if(_0x4a3388['query'][_0x3ab4('0x4a')]){_0x4e503a[_0x3ab4('0x4b')]=[{'all':!![]}];}return db[_0x3ab4('0x39')][_0x3ab4('0x4c')](_0x4e503a);})[_0x3ab4('0x1b')](function(_0x1aeedf){_0x536fa3[_0x3ab4('0x4d')]=_0x1aeedf;return _0x536fa3;})[_0x3ab4('0x1b')](respondWithFilteredResult(_0x5cf48f,_0x4e503a))[_0x3ab4('0x4e')](handleError(_0x5cf48f,null));};exports[_0x3ab4('0x4f')]=function(_0x4ddca2,_0x57ff2c){var _0x95ce4b={'raw':![],'where':{'id':_0x4ddca2[_0x3ab4('0x50')]['id']}},_0xa6239b={};_0xa6239b[_0x3ab4('0x3c')]=_[_0x3ab4('0x3e')](db[_0x3ab4('0x39')][_0x3ab4('0x3a')]);_0xa6239b[_0x3ab4('0x3d')]=_['keys'](_0x4ddca2[_0x3ab4('0x3d')]);_0xa6239b[_0x3ab4('0x3f')]=_['intersection'](_0xa6239b['model'],_0xa6239b['query']);_0x95ce4b[_0x3ab4('0x41')]=_['intersection'](_0xa6239b['model'],qs['fields'](_0x4ddca2[_0x3ab4('0x3d')][_0x3ab4('0x42')]));_0x95ce4b[_0x3ab4('0x41')]=_0x95ce4b[_0x3ab4('0x41')]['length']?_0x95ce4b[_0x3ab4('0x41')]:_0xa6239b[_0x3ab4('0x3c')];if(_0x4ddca2['query'][_0x3ab4('0x4a')]){_0x95ce4b['include']=[{'all':!![]}];}_0x95ce4b=_[_0x3ab4('0x47')]({},_0x95ce4b,_0x4ddca2['options']);return db['VoiceContext'][_0x3ab4('0x51')](_0x95ce4b)[_0x3ab4('0x1b')](handleEntityNotFound(_0x57ff2c,null))['then'](respondWithResult(_0x57ff2c,null))[_0x3ab4('0x4e')](handleError(_0x57ff2c,null));};exports['create']=function(_0x145986,_0x1dd26a,_0x1cb4f7){var _0x2de9ff;return db[_0x3ab4('0x39')][_0x3ab4('0x52')](_0x145986[_0x3ab4('0x53')],{'raw':!![]})[_0x3ab4('0x1b')](function(_0x43dca4){_0x2de9ff=_0x43dca4;return db[_0x3ab4('0x39')][_0x3ab4('0x4c')]({'raw':!![]});})[_0x3ab4('0x1b')](function(_0x2c5b25){var _0x3fb1f9=fs[_0x3ab4('0x54')](path[_0x3ab4('0x55')](config[_0x3ab4('0x56')],_0x3ab4('0x57')),'utf8');var _0x4f8430=ejs['render'](_0x3fb1f9,{'contexts':_0x2c5b25||[]});fs[_0x3ab4('0x58')](_0x3ab4('0x59'),_0x4f8430);})[_0x3ab4('0x1b')](function(){return respondWithRpcPromise(_0x3ab4('0x5a'),_0x3ab4('0x52'),{'module':_0x3ab4('0x5b')});})[_0x3ab4('0x1b')](function(){var _0x5971e2=_0x145986[_0x3ab4('0x5c')][_0x3ab4('0x32')]({'plain':!![]});if(!_0x5971e2)throw new Error(_0x3ab4('0x5d'));if(_0x5971e2[_0x3ab4('0x5e')]===_0x3ab4('0x5c')){var _0x1a3331=_0x2de9ff['get']({'plain':!![]});return db[_0x3ab4('0x5f')][_0x3ab4('0x51')]({'where':{'name':_0x3ab4('0x33'),'userProfileId':_0x5971e2['userProfileId']},'raw':!![]})[_0x3ab4('0x1b')](function(_0x1d40c2){if(_0x1d40c2&&_0x1d40c2[_0x3ab4('0x60')]===0x0){return db[_0x3ab4('0x34')][_0x3ab4('0x52')]({'name':_0x1a3331[_0x3ab4('0x37')],'resourceId':_0x1a3331['id'],'type':_0x1d40c2['name'],'sectionId':_0x1d40c2['id']},{})[_0x3ab4('0x1b')](function(){return _0x2de9ff;});}else{return _0x2de9ff;}})['catch'](function(_0x58f468){logger[_0x3ab4('0x21')](_0x3ab4('0x61'),_0x58f468);throw _0x58f468;});}return _0x2de9ff;})[_0x3ab4('0x1b')](respondWithResult(_0x1dd26a,0xc9))['catch'](handleError(_0x1dd26a,null));};exports['update']=function(_0x36820b,_0x500c15,_0x1f334e){var _0x5ab08f;return db[_0x3ab4('0x39')][_0x3ab4('0x51')]({'where':{'id':_0x36820b[_0x3ab4('0x50')]['id']}})[_0x3ab4('0x1b')](handleEntityNotFound(_0x500c15,null))[_0x3ab4('0x1b')](saveUpdates(_0x36820b['body'],null))[_0x3ab4('0x1b')](function(_0x43a26e){if(_0x43a26e){_0x5ab08f=_0x43a26e;return db[_0x3ab4('0x39')][_0x3ab4('0x4c')]({'raw':!![]});}})['then'](function(_0x4fb32c){var _0x5ccdfe=fs[_0x3ab4('0x54')](path['join'](config[_0x3ab4('0x56')],'server/files/templates/context.ejs'),_0x3ab4('0x62'));var _0x2fe7e1=ejs[_0x3ab4('0x63')](_0x5ccdfe,{'contexts':_0x4fb32c||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x2fe7e1);})[_0x3ab4('0x1b')](function(){return respondWithRpcPromise('Reload',_0x3ab4('0x30'),{'module':_0x3ab4('0x5b')});})[_0x3ab4('0x1b')](function(){return _0x5ab08f;})['then'](respondWithResult(_0x500c15,null))[_0x3ab4('0x4e')](handleError(_0x500c15,null));};exports[_0x3ab4('0x31')]=function(_0x141df7,_0x208dac,_0x423c32){var _0x1fc327;return db[_0x3ab4('0x39')][_0x3ab4('0x51')]({'where':{'id':_0x141df7[_0x3ab4('0x50')]['id']}})[_0x3ab4('0x1b')](handleEntityNotFound(_0x208dac,null))[_0x3ab4('0x1b')](removeEntity(_0x208dac,null))[_0x3ab4('0x1b')](function(){return db[_0x3ab4('0x39')][_0x3ab4('0x4c')]({'raw':!![]});})[_0x3ab4('0x1b')](function(_0x255cd4){var _0x1f3d70=fs['readFileSync'](path[_0x3ab4('0x55')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x337989=ejs[_0x3ab4('0x63')](_0x1f3d70,{'contexts':_0x255cd4});fs[_0x3ab4('0x58')](_0x3ab4('0x59'),_0x337989);return respondWithRpcPromise('Reload','destroy',{'module':_0x3ab4('0x5b')});})[_0x3ab4('0x4e')](handleError(_0x208dac,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 7e77fd2..eb4e52c 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 _0xbc06=['api','bluebird','request-promise','path','rimraf','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc06,0x1a1));var _0x6bc0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc06[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6bc0('0x0'));var util=require(_0x6bc0('0x1'));var logger=require(_0x6bc0('0x2'))(_0x6bc0('0x3'));var moment=require('moment');var BPromise=require(_0x6bc0('0x4'));var rp=require(_0x6bc0('0x5'));var fs=require('fs');var path=require(_0x6bc0('0x6'));var rimraf=require(_0x6bc0('0x7'));var config=require('../../config/environment');var attributes=require(_0x6bc0('0x8'));module['exports']=function(_0x2485ac,_0x5a4e4c){return _0x2485ac[_0x6bc0('0x9')](_0x6bc0('0xa'),attributes,{'tableName':_0x6bc0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb7b=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext','util','../../config/logger','api','moment'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xdb7b,0x8c));var _0xbdb7=function(_0x31f57d,_0x2babdd){_0x31f57d=_0x31f57d-0x0;var _0x483b04=_0xdb7b[_0x31f57d];return _0x483b04;};'use strict';var _=require('lodash');var util=require(_0xbdb7('0x0'));var logger=require(_0xbdb7('0x1'))(_0xbdb7('0x2'));var moment=require(_0xbdb7('0x3'));var BPromise=require(_0xbdb7('0x4'));var rp=require(_0xbdb7('0x5'));var fs=require('fs');var path=require(_0xbdb7('0x6'));var rimraf=require(_0xbdb7('0x7'));var config=require(_0xbdb7('0x8'));var attributes=require(_0xbdb7('0x9'));module[_0xbdb7('0xa')]=function(_0x3626c2,_0x56dcfd){return _0x3626c2['define'](_0xbdb7('0xb'),attributes,{'tableName':'voice_contexts','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 8855821..23f842f 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 _0x4046=['request\x20sent','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x1594df,_0x528bdb){var _0x2f5d63=function(_0x3dc46d){while(--_0x3dc46d){_0x1594df['push'](_0x1594df['shift']());}};_0x2f5d63(++_0x528bdb);}(_0x4046,0x126));var _0x6404=function(_0x26abb0,_0x2c1f2e){_0x26abb0=_0x26abb0-0x0;var _0x46a7bd=_0x4046[_0x26abb0];return _0x46a7bd;};'use strict';var _=require('lodash');var util=require(_0x6404('0x0'));var moment=require(_0x6404('0x1'));var BPromise=require(_0x6404('0x2'));var rs=require(_0x6404('0x3'));var fs=require('fs');var Redis=require(_0x6404('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6404('0x5'));var jayson=require(_0x6404('0x6'));var client=jayson[_0x6404('0x7')][_0x6404('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2eba27,_0x5cd47b,_0x4cbc18){return new BPromise(function(_0x21b3d6,_0x509ad2){return client[_0x6404('0x9')](_0x2eba27,_0x4cbc18)[_0x6404('0xa')](function(_0x17d76e){logger[_0x6404('0xb')]('VoiceContext,\x20%s,\x20%s',_0x5cd47b,'request\x20sent');logger[_0x6404('0xc')](_0x6404('0xd'),_0x5cd47b,_0x6404('0xe'),JSON[_0x6404('0xf')](_0x17d76e));if(_0x17d76e[_0x6404('0x10')]){if(_0x17d76e[_0x6404('0x10')][_0x6404('0x11')]===0x1f4){logger[_0x6404('0x10')](_0x6404('0x12'),_0x5cd47b,_0x17d76e[_0x6404('0x10')][_0x6404('0x13')]);return _0x509ad2(_0x17d76e['error'][_0x6404('0x13')]);}logger[_0x6404('0x10')](_0x6404('0x12'),_0x5cd47b,_0x17d76e['error'][_0x6404('0x13')]);return _0x21b3d6(_0x17d76e['error'][_0x6404('0x13')]);}else{logger[_0x6404('0xb')]('VoiceContext,\x20%s,\x20%s',_0x5cd47b,_0x6404('0xe'));_0x21b3d6(_0x17d76e[_0x6404('0x14')]['message']);}})[_0x6404('0x15')](function(_0x42234c){logger[_0x6404('0x10')](_0x6404('0x12'),_0x5cd47b,_0x42234c);_0x509ad2(_0x42234c);});});} \ No newline at end of file +var _0x5397=['info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceContext,\x20%s,\x20%s','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5397,0x105));var _0x7539=function(_0x386b28,_0x28561b){_0x386b28=_0x386b28-0x0;var _0x3507a5=_0x5397[_0x386b28];return _0x3507a5;};'use strict';var _=require('lodash');var util=require(_0x7539('0x0'));var moment=require(_0x7539('0x1'));var BPromise=require(_0x7539('0x2'));var rs=require(_0x7539('0x3'));var fs=require('fs');var Redis=require(_0x7539('0x4'));var db=require(_0x7539('0x5'))['db'];var utils=require(_0x7539('0x6'));var logger=require(_0x7539('0x7'))(_0x7539('0x8'));var config=require('../../config/environment');var jayson=require(_0x7539('0x9'));var client=jayson[_0x7539('0xa')][_0x7539('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e3897,_0x2e3dad,_0x55b824){return new BPromise(function(_0x18ba43,_0x4e49e9){return client[_0x7539('0xc')](_0x2e3897,_0x55b824)[_0x7539('0xd')](function(_0xe34cd9){logger[_0x7539('0xe')]('VoiceContext,\x20%s,\x20%s',_0x2e3dad,'request\x20sent');logger[_0x7539('0xf')](_0x7539('0x10'),_0x2e3dad,_0x7539('0x11'),JSON[_0x7539('0x12')](_0xe34cd9));if(_0xe34cd9[_0x7539('0x13')]){if(_0xe34cd9['error'][_0x7539('0x14')]===0x1f4){logger[_0x7539('0x13')]('VoiceContext,\x20%s,\x20%s',_0x2e3dad,_0xe34cd9[_0x7539('0x13')][_0x7539('0x15')]);return _0x4e49e9(_0xe34cd9['error'][_0x7539('0x15')]);}logger[_0x7539('0x13')]('VoiceContext,\x20%s,\x20%s',_0x2e3dad,_0xe34cd9[_0x7539('0x13')][_0x7539('0x15')]);return _0x18ba43(_0xe34cd9[_0x7539('0x13')][_0x7539('0x15')]);}else{logger[_0x7539('0xe')]('VoiceContext,\x20%s,\x20%s',_0x2e3dad,_0x7539('0x11'));_0x18ba43(_0xe34cd9[_0x7539('0x16')][_0x7539('0x15')]);}})[_0x7539('0x17')](function(_0x515710){logger[_0x7539('0x13')](_0x7539('0x18'),_0x2e3dad,_0x515710);_0x4e49e9(_0x515710);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 05407b3..7c14c05 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 _0x447e=['./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra'];(function(_0x4b5965,_0x3909ca){var _0x3e7789=function(_0x33c2b0){while(--_0x33c2b0){_0x4b5965['push'](_0x4b5965['shift']());}};_0x3e7789(++_0x3909ca);}(_0x447e,0x10c));var _0xe447=function(_0x1ce314,_0x32e1c6){_0x1ce314=_0x1ce314-0x0;var _0x5d7ec3=_0x447e[_0x1ce314];return _0x5d7ec3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe447('0x0'));var timeout=require(_0xe447('0x1'));var express=require(_0xe447('0x2'));var router=express['Router']();var fs_extra=require(_0xe447('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe447('0x4'));router[_0xe447('0x5')]('/',auth[_0xe447('0x6')](),controller[_0xe447('0x7')]);router['get']('/describe',auth[_0xe447('0x6')](),controller[_0xe447('0x8')]);router[_0xe447('0x5')](_0xe447('0x9'),auth[_0xe447('0x6')](),controller[_0xe447('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe447('0xb')]);router[_0xe447('0xc')](_0xe447('0x9'),auth['isAuthenticated'](),controller[_0xe447('0xd')]);router[_0xe447('0xe')](_0xe447('0x9'),auth[_0xe447('0x6')](),controller[_0xe447('0xf')]);module[_0xe447('0x10')]=router; \ No newline at end of file +var _0xdd86=['./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','/:id','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x183c44,_0x3eb1f4){var _0x407480=function(_0x26d79b){while(--_0x26d79b){_0x183c44['push'](_0x183c44['shift']());}};_0x407480(++_0x3eb1f4);}(_0xdd86,0x15d));var _0x6dd8=function(_0x4fae19,_0x4f2d47){_0x4fae19=_0x4fae19-0x0;var _0x8d8e92=_0xdd86[_0x4fae19];return _0x8d8e92;};'use strict';var multer=require(_0x6dd8('0x0'));var util=require(_0x6dd8('0x1'));var path=require(_0x6dd8('0x2'));var timeout=require('connect-timeout');var express=require(_0x6dd8('0x3'));var router=express[_0x6dd8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6dd8('0x5'));var interaction=require(_0x6dd8('0x6'));var config=require(_0x6dd8('0x7'));var controller=require(_0x6dd8('0x8'));router[_0x6dd8('0x9')]('/',auth['isAuthenticated'](),controller[_0x6dd8('0xa')]);router[_0x6dd8('0x9')](_0x6dd8('0xb'),auth[_0x6dd8('0xc')](),controller[_0x6dd8('0xd')]);router[_0x6dd8('0x9')](_0x6dd8('0xe'),auth[_0x6dd8('0xc')](),controller['show']);router['post']('/',auth[_0x6dd8('0xc')](),controller[_0x6dd8('0xf')]);router[_0x6dd8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6dd8('0x11')]);router[_0x6dd8('0x12')](_0x6dd8('0xe'),auth[_0x6dd8('0xc')](),controller[_0x6dd8('0x13')]);module[_0x6dd8('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index c74040b..2eac045 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f62=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x3afbdf,_0x9e463b){var _0x5b6861=function(_0x31d287){while(--_0x31d287){_0x3afbdf['push'](_0x3afbdf['shift']());}};_0x5b6861(++_0x9e463b);}(_0x9f62,0x154));var _0x29f6=function(_0x3690cf,_0x3750e7){_0x3690cf=_0x3690cf-0x0;var _0x53ebd2=_0x9f62[_0x3690cf];return _0x53ebd2;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x29f6('0x1')]},'channelstate':{'type':Sequelize[_0x29f6('0x2')]},'channelstatedesc':{'type':Sequelize[_0x29f6('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'connectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'language':{'type':Sequelize[_0x29f6('0x1')]},'accountcode':{'type':Sequelize[_0x29f6('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x29f6('0x1')]},'priority':{'type':Sequelize[_0x29f6('0x2')]},'uniqueid':{'type':Sequelize[_0x29f6('0x1')]},'linkedid':{'type':Sequelize[_0x29f6('0x1')]},'destchannel':{'type':Sequelize[_0x29f6('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x29f6('0x1')]},'destexten':{'type':Sequelize[_0x29f6('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x29f6('0x1')]},'destlinkedid':{'type':Sequelize[_0x29f6('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x29f6('0x3')]},'lastevent':{'type':Sequelize[_0x29f6('0x1')],'comment':_0x29f6('0x4')},'routeId':{'type':Sequelize[_0x29f6('0x2')]},'duration':{'type':Sequelize[_0x29f6('0x2')]},'holdtime':{'type':Sequelize[_0x29f6('0x2')]},'billableseconds':{'type':Sequelize[_0x29f6('0x2')]}}; \ No newline at end of file +var _0x8ef6=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x25bca6,_0xe415ea){var _0x3f8d02=function(_0x3e581b){while(--_0x3e581b){_0x25bca6['push'](_0x25bca6['shift']());}};_0x3f8d02(++_0xe415ea);}(_0x8ef6,0xf2));var _0x68ef=function(_0x53770e,_0x30451b){_0x53770e=_0x53770e-0x0;var _0x3f006b=_0x8ef6[_0x53770e];return _0x3f006b;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'privilege':{'type':Sequelize[_0x68ef('0x2')]},'channel':{'type':Sequelize[_0x68ef('0x2')]},'channelstate':{'type':Sequelize[_0x68ef('0x3')]},'channelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'calleridnum':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'language':{'type':Sequelize[_0x68ef('0x2')]},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x68ef('0x3')]},'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'linkedid':{'type':Sequelize[_0x68ef('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x68ef('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridnum':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridname':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'destlanguage':{'type':Sequelize[_0x68ef('0x2')]},'destaccountcode':{'type':Sequelize[_0x68ef('0x2')]},'destcontext':{'type':Sequelize[_0x68ef('0x2')]},'destexten':{'type':Sequelize[_0x68ef('0x2')]},'destpriority':{'type':Sequelize[_0x68ef('0x3')]},'destuniqueid':{'type':Sequelize[_0x68ef('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x68ef('0x2')]},'dialstatus':{'type':Sequelize[_0x68ef('0x2')]},'starttime':{'type':Sequelize[_0x68ef('0x4')]},'answertime':{'type':Sequelize[_0x68ef('0x4')]},'endtime':{'type':Sequelize[_0x68ef('0x4')]},'lastevent':{'type':Sequelize[_0x68ef('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x68ef('0x3')]},'duration':{'type':Sequelize[_0x68ef('0x3')]},'holdtime':{'type':Sequelize[_0x68ef('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 4a0be09..1c22776 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 _0x06ba=['map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','findAll','catch','merge','find','create','body','params','destroy','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','error','stack','name','send'];(function(_0x1be2cb,_0x4fdefe){var _0x584aa4=function(_0x3f57cd){while(--_0x3f57cd){_0x1be2cb['push'](_0x1be2cb['shift']());}};_0x584aa4(++_0x4fdefe);}(_0x06ba,0x14c));var _0xa06b=function(_0x59b11f,_0x25f699){_0x59b11f=_0x59b11f-0x0;var _0x23be25=_0x06ba[_0x59b11f];return _0x23be25;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa06b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa06b('0x1'));var moment=require(_0xa06b('0x2'));var BPromise=require(_0xa06b('0x3'));var Mustache=require(_0xa06b('0x4'));var util=require(_0xa06b('0x5'));var path=require(_0xa06b('0x6'));var sox=require(_0xa06b('0x7'));var csv=require(_0xa06b('0x8'));var ejs=require(_0xa06b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa06b('0xa'));var squel=require(_0xa06b('0xb'));var crypto=require('crypto');var jsforce=require(_0xa06b('0xc'));var deskjs=require(_0xa06b('0xd'));var toCsv=require(_0xa06b('0x8'));var querystring=require('querystring');var Papa=require(_0xa06b('0xe'));var Redis=require(_0xa06b('0xf'));var authService=require(_0xa06b('0x10'));var qs=require(_0xa06b('0x11'));var as=require(_0xa06b('0x12'));var hardwareService=require(_0xa06b('0x13'));var logger=require('../../config/logger')(_0xa06b('0x14'));var utils=require(_0xa06b('0x15'));var config=require(_0xa06b('0x16'));var licenseUtil=require(_0xa06b('0x17'));var db=require(_0xa06b('0x18'))['db'];function respondWithStatusCode(_0x1b76d3,_0x1b419d){_0x1b419d=_0x1b419d||0xcc;return function(_0x417dac){if(_0x417dac){return _0x1b76d3[_0xa06b('0x19')](_0x1b419d);}return _0x1b76d3[_0xa06b('0x1a')](_0x1b419d)[_0xa06b('0x1b')]();};}function respondWithResult(_0x5066a8,_0x36da6e){_0x36da6e=_0x36da6e||0xc8;return function(_0x3fae0e){if(_0x3fae0e){return _0x5066a8[_0xa06b('0x1a')](_0x36da6e)['json'](_0x3fae0e);}};}function respondWithFilteredResult(_0x2278a8,_0x30d193){return function(_0x30510c){if(_0x30510c){var _0x22b9eb=typeof _0x30d193[_0xa06b('0x1c')]==='undefined'&&typeof _0x30d193[_0xa06b('0x1d')]===_0xa06b('0x1e');var _0xe7a1f4=_0x30510c[_0xa06b('0x1f')];var _0x39775b=_0x22b9eb?0x0:_0x30d193[_0xa06b('0x1c')];var _0x5b07fd=_0x22b9eb?_0x30510c[_0xa06b('0x1f')]:_0x30d193[_0xa06b('0x1c')]+_0x30d193['limit'];var _0x2be118;if(_0x5b07fd>=_0xe7a1f4){_0x5b07fd=_0xe7a1f4;_0x2be118=0xc8;}else{_0x2be118=0xce;}_0x2278a8[_0xa06b('0x1a')](_0x2be118);return _0x2278a8[_0xa06b('0x20')](_0xa06b('0x21'),_0x39775b+'-'+_0x5b07fd+'/'+_0xe7a1f4)[_0xa06b('0x22')](_0x30510c);}return null;};}function patchUpdates(_0x3f6dd8){return function(_0x54600f){try{jsonpatch['apply'](_0x54600f,_0x3f6dd8,!![]);}catch(_0x5e7e9c){return BPromise[_0xa06b('0x23')](_0x5e7e9c);}return _0x54600f[_0xa06b('0x24')]();};}function saveUpdates(_0x1f3422,_0x262e4b){return function(_0x4abb85){if(_0x4abb85){return _0x4abb85[_0xa06b('0x25')](_0x1f3422)[_0xa06b('0x26')](function(_0x14bf5b){return _0x14bf5b;});}return null;};}function removeEntity(_0x1be3c7,_0x3c7dac){return function(_0x42f546){if(_0x42f546){return _0x42f546['destroy']()[_0xa06b('0x26')](function(){_0x1be3c7[_0xa06b('0x1a')](0xcc)[_0xa06b('0x1b')]();});}};}function handleEntityNotFound(_0x5d37fc,_0x558d5d){return function(_0x5e8445){if(!_0x5e8445){_0x5d37fc[_0xa06b('0x19')](0x194);}return _0x5e8445;};}function handleError(_0x21dac0,_0x2ed5cb){_0x2ed5cb=_0x2ed5cb||0x1f4;return function(_0xbdf2d7){logger[_0xa06b('0x27')](_0xbdf2d7[_0xa06b('0x28')]);if(_0xbdf2d7[_0xa06b('0x29')]){delete _0xbdf2d7['name'];}_0x21dac0[_0xa06b('0x1a')](_0x2ed5cb)[_0xa06b('0x2a')](_0xbdf2d7);};}exports['index']=function(_0xa4aeeb,_0x38f2d1){var _0x3c00d4={},_0x3c56aa={},_0x31692e={'count':0x0,'rows':[]};var _0x271f3b=_[_0xa06b('0x2b')](db[_0xa06b('0x2c')][_0xa06b('0x2d')],function(_0x37bfda){return{'name':_0x37bfda[_0xa06b('0x2e')],'type':_0x37bfda[_0xa06b('0x2f')][_0xa06b('0x30')]};});_0x3c56aa[_0xa06b('0x31')]=_[_0xa06b('0x2b')](_0x271f3b,_0xa06b('0x29'));_0x3c56aa[_0xa06b('0x32')]=_[_0xa06b('0x33')](_0xa4aeeb[_0xa06b('0x32')]);_0x3c56aa[_0xa06b('0x34')]=_['intersection'](_0x3c56aa['model'],_0x3c56aa[_0xa06b('0x32')]);_0x3c00d4['attributes']=_[_0xa06b('0x35')](_0x3c56aa[_0xa06b('0x31')],qs[_0xa06b('0x36')](_0xa4aeeb[_0xa06b('0x32')][_0xa06b('0x36')]));_0x3c00d4[_0xa06b('0x37')]=_0x3c00d4['attributes'][_0xa06b('0x38')]?_0x3c00d4[_0xa06b('0x37')]:_0x3c56aa[_0xa06b('0x31')];if(!_0xa4aeeb[_0xa06b('0x32')][_0xa06b('0x39')](_0xa06b('0x3a'))){_0x3c00d4[_0xa06b('0x1d')]=qs[_0xa06b('0x1d')](_0xa4aeeb[_0xa06b('0x32')][_0xa06b('0x1d')]);_0x3c00d4[_0xa06b('0x1c')]=qs[_0xa06b('0x1c')](_0xa4aeeb[_0xa06b('0x32')][_0xa06b('0x1c')]);}_0x3c00d4[_0xa06b('0x3b')]=qs['sort'](_0xa4aeeb[_0xa06b('0x32')][_0xa06b('0x3c')]);_0x3c00d4[_0xa06b('0x3d')]=qs[_0xa06b('0x34')](_['pick'](_0xa4aeeb[_0xa06b('0x32')],_0x3c56aa[_0xa06b('0x34')]),_0x271f3b);if(_0xa4aeeb[_0xa06b('0x32')][_0xa06b('0x3e')]){_0x3c00d4['where']=_['merge'](_0x3c00d4[_0xa06b('0x3d')],{'$or':_[_0xa06b('0x2b')](_0x271f3b,function(_0x15b4f4){if(_0x15b4f4[_0xa06b('0x2f')]!=='VIRTUAL'){var _0x2e7eab={};_0x2e7eab[_0x15b4f4[_0xa06b('0x29')]]={'$like':'%'+_0xa4aeeb[_0xa06b('0x32')]['filter']+'%'};return _0x2e7eab;}})});}_0x3c00d4=_['merge']({},_0x3c00d4,_0xa4aeeb[_0xa06b('0x3f')]);var _0x3466b4={'where':_0x3c00d4[_0xa06b('0x3d')]};return db[_0xa06b('0x2c')]['count'](_0x3466b4)[_0xa06b('0x26')](function(_0x17e786){_0x31692e[_0xa06b('0x1f')]=_0x17e786;if(_0xa4aeeb[_0xa06b('0x32')][_0xa06b('0x40')]){_0x3c00d4[_0xa06b('0x41')]=[{'all':!![]}];}return db[_0xa06b('0x2c')][_0xa06b('0x42')](_0x3c00d4);})[_0xa06b('0x26')](function(_0x313204){_0x31692e['rows']=_0x313204;return _0x31692e;})['then'](respondWithFilteredResult(_0x38f2d1,_0x3c00d4))[_0xa06b('0x43')](handleError(_0x38f2d1,null));};exports['show']=function(_0xf8b697,_0x69e42b){var _0xd3db31={'raw':!![],'where':{'id':_0xf8b697['params']['id']}},_0x144ea2={};_0x144ea2[_0xa06b('0x31')]=_[_0xa06b('0x33')](db['VoiceDialReport'][_0xa06b('0x2d')]);_0x144ea2[_0xa06b('0x32')]=_[_0xa06b('0x33')](_0xf8b697['query']);_0x144ea2['filters']=_[_0xa06b('0x35')](_0x144ea2[_0xa06b('0x31')],_0x144ea2['query']);_0xd3db31[_0xa06b('0x37')]=_[_0xa06b('0x35')](_0x144ea2[_0xa06b('0x31')],qs['fields'](_0xf8b697[_0xa06b('0x32')][_0xa06b('0x36')]));_0xd3db31['attributes']=_0xd3db31[_0xa06b('0x37')][_0xa06b('0x38')]?_0xd3db31[_0xa06b('0x37')]:_0x144ea2[_0xa06b('0x31')];if(_0xf8b697[_0xa06b('0x32')][_0xa06b('0x40')]){_0xd3db31[_0xa06b('0x41')]=[{'all':!![]}];}_0xd3db31=_[_0xa06b('0x44')]({},_0xd3db31,_0xf8b697[_0xa06b('0x3f')]);return db[_0xa06b('0x2c')][_0xa06b('0x45')](_0xd3db31)[_0xa06b('0x26')](handleEntityNotFound(_0x69e42b,null))[_0xa06b('0x26')](respondWithResult(_0x69e42b,null))[_0xa06b('0x43')](handleError(_0x69e42b,null));};exports['create']=function(_0x138810,_0x1f57ee){return db['VoiceDialReport'][_0xa06b('0x46')](_0x138810[_0xa06b('0x47')],{})[_0xa06b('0x26')](respondWithResult(_0x1f57ee,0xc9))['catch'](handleError(_0x1f57ee,null));};exports[_0xa06b('0x25')]=function(_0x113aa1,_0x3216db){if(_0x113aa1[_0xa06b('0x47')]['id']){delete _0x113aa1[_0xa06b('0x47')]['id'];}return db[_0xa06b('0x2c')]['find']({'where':{'id':_0x113aa1[_0xa06b('0x48')]['id']}})[_0xa06b('0x26')](handleEntityNotFound(_0x3216db,null))[_0xa06b('0x26')](saveUpdates(_0x113aa1['body'],null))['then'](respondWithResult(_0x3216db,null))[_0xa06b('0x43')](handleError(_0x3216db,null));};exports[_0xa06b('0x49')]=function(_0xd04781,_0x535f64){return db[_0xa06b('0x2c')]['find']({'where':{'id':_0xd04781[_0xa06b('0x48')]['id']}})[_0xa06b('0x26')](handleEntityNotFound(_0x535f64,null))[_0xa06b('0x26')](removeEntity(_0x535f64,null))[_0xa06b('0x43')](handleError(_0x535f64,null));};exports[_0xa06b('0x4a')]=function(_0x373ea2,_0x11342d){return db[_0xa06b('0x2c')][_0xa06b('0x4a')]()[_0xa06b('0x26')](respondWithResult(_0x11342d,null))[_0xa06b('0x43')](handleError(_0x11342d,null));}; \ No newline at end of file +var _0x924a=['nolimit','order','sort','where','filters','pick','filter','VIRTUAL','VoiceDialReport','includeAll','include','findAll','rows','catch','params','length','merge','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty'];(function(_0x3b50c0,_0x3a87c1){var _0x1069c3=function(_0x4ef8a5){while(--_0x4ef8a5){_0x3b50c0['push'](_0x3b50c0['shift']());}};_0x1069c3(++_0x3a87c1);}(_0x924a,0x1b6));var _0xa924=function(_0x1c5ec8,_0x20388d){_0x1c5ec8=_0x1c5ec8-0x0;var _0x405718=_0x924a[_0x1c5ec8];return _0x405718;};'use strict';var emlformat=require(_0xa924('0x0'));var rimraf=require(_0xa924('0x1'));var zipdir=require(_0xa924('0x2'));var jsonpatch=require(_0xa924('0x3'));var rp=require(_0xa924('0x4'));var moment=require(_0xa924('0x5'));var BPromise=require(_0xa924('0x6'));var Mustache=require(_0xa924('0x7'));var util=require(_0xa924('0x8'));var path=require(_0xa924('0x9'));var sox=require(_0xa924('0xa'));var csv=require(_0xa924('0xb'));var ejs=require(_0xa924('0xc'));var fs=require('fs');var fs_extra=require(_0xa924('0xd'));var _=require('lodash');var squel=require(_0xa924('0xe'));var crypto=require(_0xa924('0xf'));var jsforce=require(_0xa924('0x10'));var deskjs=require(_0xa924('0x11'));var toCsv=require(_0xa924('0xb'));var querystring=require(_0xa924('0x12'));var Papa=require(_0xa924('0x13'));var Redis=require(_0xa924('0x14'));var authService=require(_0xa924('0x15'));var qs=require(_0xa924('0x16'));var as=require(_0xa924('0x17'));var hardwareService=require(_0xa924('0x18'));var logger=require(_0xa924('0x19'))(_0xa924('0x1a'));var utils=require(_0xa924('0x1b'));var config=require(_0xa924('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0xa924('0x1d'))['db'];function respondWithStatusCode(_0x311866,_0x46e3c6){_0x46e3c6=_0x46e3c6||0xcc;return function(_0x124363){if(_0x124363){return _0x311866[_0xa924('0x1e')](_0x46e3c6);}return _0x311866[_0xa924('0x1f')](_0x46e3c6)[_0xa924('0x20')]();};}function respondWithResult(_0x2016ec,_0xe839d9){_0xe839d9=_0xe839d9||0xc8;return function(_0x2bdd4f){if(_0x2bdd4f){return _0x2016ec[_0xa924('0x1f')](_0xe839d9)[_0xa924('0x21')](_0x2bdd4f);}};}function respondWithFilteredResult(_0xc68184,_0x25fdf4){return function(_0x3cddf6){if(_0x3cddf6){var _0x5438d3=typeof _0x25fdf4['offset']==='undefined'&&typeof _0x25fdf4[_0xa924('0x22')]===_0xa924('0x23');var _0x4a3f68=_0x3cddf6[_0xa924('0x24')];var _0x1eaeb6=_0x5438d3?0x0:_0x25fdf4[_0xa924('0x25')];var _0x1b39e3=_0x5438d3?_0x3cddf6[_0xa924('0x24')]:_0x25fdf4['offset']+_0x25fdf4[_0xa924('0x22')];var _0x21b7d5;if(_0x1b39e3>=_0x4a3f68){_0x1b39e3=_0x4a3f68;_0x21b7d5=0xc8;}else{_0x21b7d5=0xce;}_0xc68184[_0xa924('0x1f')](_0x21b7d5);return _0xc68184['set'](_0xa924('0x26'),_0x1eaeb6+'-'+_0x1b39e3+'/'+_0x4a3f68)['json'](_0x3cddf6);}return null;};}function patchUpdates(_0x4249a5){return function(_0x2ead87){try{jsonpatch[_0xa924('0x27')](_0x2ead87,_0x4249a5,!![]);}catch(_0x480938){return BPromise[_0xa924('0x28')](_0x480938);}return _0x2ead87[_0xa924('0x29')]();};}function saveUpdates(_0x177f97,_0x455de9){return function(_0x1970f6){if(_0x1970f6){return _0x1970f6[_0xa924('0x2a')](_0x177f97)['then'](function(_0x238a3a){return _0x238a3a;});}return null;};}function removeEntity(_0x452eeb,_0x4e16c4){return function(_0x5a1508){if(_0x5a1508){return _0x5a1508['destroy']()[_0xa924('0x2b')](function(){_0x452eeb['status'](0xcc)[_0xa924('0x20')]();});}};}function handleEntityNotFound(_0x296fb6,_0x3ac009){return function(_0x506d52){if(!_0x506d52){_0x296fb6[_0xa924('0x1e')](0x194);}return _0x506d52;};}function handleError(_0x13c434,_0x1edaec){_0x1edaec=_0x1edaec||0x1f4;return function(_0x25ca3d){logger[_0xa924('0x2c')](_0x25ca3d[_0xa924('0x2d')]);if(_0x25ca3d[_0xa924('0x2e')]){delete _0x25ca3d[_0xa924('0x2e')];}_0x13c434['status'](_0x1edaec)[_0xa924('0x2f')](_0x25ca3d);};}exports[_0xa924('0x30')]=function(_0x98d8d7,_0x1750e5){var _0x1a1f72={},_0xdb7aeb={},_0x1866a4={'count':0x0,'rows':[]};var _0x244d02=_[_0xa924('0x31')](db['VoiceDialReport'][_0xa924('0x32')],function(_0x19c86f){return{'name':_0x19c86f['fieldName'],'type':_0x19c86f[_0xa924('0x33')][_0xa924('0x34')]};});_0xdb7aeb[_0xa924('0x35')]=_[_0xa924('0x31')](_0x244d02,_0xa924('0x2e'));_0xdb7aeb['query']=_[_0xa924('0x36')](_0x98d8d7[_0xa924('0x37')]);_0xdb7aeb['filters']=_['intersection'](_0xdb7aeb[_0xa924('0x35')],_0xdb7aeb[_0xa924('0x37')]);_0x1a1f72[_0xa924('0x38')]=_[_0xa924('0x39')](_0xdb7aeb['model'],qs[_0xa924('0x3a')](_0x98d8d7['query'][_0xa924('0x3a')]));_0x1a1f72[_0xa924('0x38')]=_0x1a1f72[_0xa924('0x38')]['length']?_0x1a1f72['attributes']:_0xdb7aeb[_0xa924('0x35')];if(!_0x98d8d7['query'][_0xa924('0x3b')](_0xa924('0x3c'))){_0x1a1f72[_0xa924('0x22')]=qs['limit'](_0x98d8d7[_0xa924('0x37')][_0xa924('0x22')]);_0x1a1f72['offset']=qs[_0xa924('0x25')](_0x98d8d7[_0xa924('0x37')][_0xa924('0x25')]);}_0x1a1f72[_0xa924('0x3d')]=qs[_0xa924('0x3e')](_0x98d8d7[_0xa924('0x37')][_0xa924('0x3e')]);_0x1a1f72[_0xa924('0x3f')]=qs[_0xa924('0x40')](_[_0xa924('0x41')](_0x98d8d7[_0xa924('0x37')],_0xdb7aeb[_0xa924('0x40')]),_0x244d02);if(_0x98d8d7[_0xa924('0x37')][_0xa924('0x42')]){_0x1a1f72[_0xa924('0x3f')]=_['merge'](_0x1a1f72['where'],{'$or':_[_0xa924('0x31')](_0x244d02,function(_0x55c440){if(_0x55c440[_0xa924('0x33')]!==_0xa924('0x43')){var _0x1bd264={};_0x1bd264[_0x55c440[_0xa924('0x2e')]]={'$like':'%'+_0x98d8d7[_0xa924('0x37')][_0xa924('0x42')]+'%'};return _0x1bd264;}})});}_0x1a1f72=_['merge']({},_0x1a1f72,_0x98d8d7['options']);var _0x1720e5={'where':_0x1a1f72[_0xa924('0x3f')]};return db[_0xa924('0x44')][_0xa924('0x24')](_0x1720e5)['then'](function(_0x42f248){_0x1866a4[_0xa924('0x24')]=_0x42f248;if(_0x98d8d7['query'][_0xa924('0x45')]){_0x1a1f72[_0xa924('0x46')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xa924('0x47')](_0x1a1f72);})['then'](function(_0xcad7b0){_0x1866a4[_0xa924('0x48')]=_0xcad7b0;return _0x1866a4;})[_0xa924('0x2b')](respondWithFilteredResult(_0x1750e5,_0x1a1f72))[_0xa924('0x49')](handleError(_0x1750e5,null));};exports['show']=function(_0x2ab4e8,_0x1239c4){var _0x181403={'raw':!![],'where':{'id':_0x2ab4e8[_0xa924('0x4a')]['id']}},_0x37a2f2={};_0x37a2f2['model']=_[_0xa924('0x36')](db[_0xa924('0x44')]['rawAttributes']);_0x37a2f2[_0xa924('0x37')]=_['keys'](_0x2ab4e8['query']);_0x37a2f2['filters']=_[_0xa924('0x39')](_0x37a2f2[_0xa924('0x35')],_0x37a2f2[_0xa924('0x37')]);_0x181403[_0xa924('0x38')]=_[_0xa924('0x39')](_0x37a2f2[_0xa924('0x35')],qs[_0xa924('0x3a')](_0x2ab4e8[_0xa924('0x37')]['fields']));_0x181403['attributes']=_0x181403[_0xa924('0x38')][_0xa924('0x4b')]?_0x181403[_0xa924('0x38')]:_0x37a2f2[_0xa924('0x35')];if(_0x2ab4e8[_0xa924('0x37')][_0xa924('0x45')]){_0x181403[_0xa924('0x46')]=[{'all':!![]}];}_0x181403=_[_0xa924('0x4c')]({},_0x181403,_0x2ab4e8[_0xa924('0x4d')]);return db['VoiceDialReport'][_0xa924('0x4e')](_0x181403)['then'](handleEntityNotFound(_0x1239c4,null))[_0xa924('0x2b')](respondWithResult(_0x1239c4,null))[_0xa924('0x49')](handleError(_0x1239c4,null));};exports[_0xa924('0x4f')]=function(_0x112c67,_0x3ab582){return db[_0xa924('0x44')][_0xa924('0x4f')](_0x112c67[_0xa924('0x50')],{})['then'](respondWithResult(_0x3ab582,0xc9))['catch'](handleError(_0x3ab582,null));};exports[_0xa924('0x2a')]=function(_0x5a2693,_0x4dc4f9){if(_0x5a2693['body']['id']){delete _0x5a2693[_0xa924('0x50')]['id'];}return db[_0xa924('0x44')]['find']({'where':{'id':_0x5a2693[_0xa924('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4dc4f9,null))[_0xa924('0x2b')](saveUpdates(_0x5a2693['body'],null))['then'](respondWithResult(_0x4dc4f9,null))[_0xa924('0x49')](handleError(_0x4dc4f9,null));};exports[_0xa924('0x51')]=function(_0x40a7bb,_0x46cb0e){return db['VoiceDialReport'][_0xa924('0x4e')]({'where':{'id':_0x40a7bb[_0xa924('0x4a')]['id']}})['then'](handleEntityNotFound(_0x46cb0e,null))[_0xa924('0x2b')](removeEntity(_0x46cb0e,null))[_0xa924('0x49')](handleError(_0x46cb0e,null));};exports[_0xa924('0x52')]=function(_0x3dcb99,_0x2e465f){return db[_0xa924('0x44')][_0xa924('0x52')]()[_0xa924('0x2b')](respondWithResult(_0x2e465f,null))[_0xa924('0x49')](handleError(_0x2e465f,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index da6b31e..f817a12 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 _0x1259=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial','lodash','util','../../config/logger','api','moment'];(function(_0x38f02e,_0xe73a0d){var _0x206435=function(_0x26c7bd){while(--_0x26c7bd){_0x38f02e['push'](_0x38f02e['shift']());}};_0x206435(++_0xe73a0d);}(_0x1259,0x1f3));var _0x9125=function(_0x6b77d4,_0x2b5301){_0x6b77d4=_0x6b77d4-0x0;var _0x1b94ba=_0x1259[_0x6b77d4];return _0x1b94ba;};'use strict';var _=require(_0x9125('0x0'));var util=require(_0x9125('0x1'));var logger=require(_0x9125('0x2'))(_0x9125('0x3'));var moment=require(_0x9125('0x4'));var BPromise=require(_0x9125('0x5'));var rp=require(_0x9125('0x6'));var fs=require('fs');var path=require(_0x9125('0x7'));var rimraf=require(_0x9125('0x8'));var config=require(_0x9125('0x9'));var attributes=require('./voiceDialReport.attributes');module[_0x9125('0xa')]=function(_0x479f58,_0xe07335){return _0x479f58[_0x9125('0xb')](_0x9125('0xc'),attributes,{'tableName':_0x9125('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa74d=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_dial','uniqueid'];(function(_0x83bbd3,_0x43eb29){var _0x51b1df=function(_0x2053d2){while(--_0x2053d2){_0x83bbd3['push'](_0x83bbd3['shift']());}};_0x51b1df(++_0x43eb29);}(_0xa74d,0x193));var _0xda74=function(_0x829b28,_0x3db636){_0x829b28=_0x829b28-0x0;var _0x42dadf=_0xa74d[_0x829b28];return _0x42dadf;};'use strict';var _=require(_0xda74('0x0'));var util=require(_0xda74('0x1'));var logger=require('../../config/logger')(_0xda74('0x2'));var moment=require(_0xda74('0x3'));var BPromise=require(_0xda74('0x4'));var rp=require(_0xda74('0x5'));var fs=require('fs');var path=require(_0xda74('0x6'));var rimraf=require(_0xda74('0x7'));var config=require(_0xda74('0x8'));var attributes=require('./voiceDialReport.attributes');module[_0xda74('0x9')]=function(_0x55abfb,_0x3dba1c){return _0x55abfb[_0xda74('0xa')]('VoiceDialReport',attributes,{'tableName':_0xda74('0xb'),'paranoid':![],'indexes':[{'fields':[_0xda74('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index e3460ae..ffd27ec 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 _0x367a=['jayson/promise','client','http','request','then','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceDialReport,\x20%s,\x20%s','message','request\x20sent','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','catch','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4de01e,_0x44e130){var _0x5c4271=function(_0x5a0266){while(--_0x5a0266){_0x4de01e['push'](_0x4de01e['shift']());}};_0x5c4271(++_0x44e130);}(_0x367a,0x15e));var _0xa367=function(_0x23aa41,_0x2944df){_0x23aa41=_0x23aa41-0x0;var _0x293abb=_0x367a[_0x23aa41];return _0x293abb;};'use strict';var _=require(_0xa367('0x0'));var util=require(_0xa367('0x1'));var moment=require(_0xa367('0x2'));var BPromise=require('bluebird');var rs=require(_0xa367('0x3'));var fs=require('fs');var Redis=require(_0xa367('0x4'));var db=require(_0xa367('0x5'))['db'];var utils=require(_0xa367('0x6'));var logger=require(_0xa367('0x7'))(_0xa367('0x8'));var config=require(_0xa367('0x9'));var jayson=require(_0xa367('0xa'));var client=jayson[_0xa367('0xb')][_0xa367('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4826ec,_0x57f269,_0x292d11){return new BPromise(function(_0x248058,_0x413fe7){return client[_0xa367('0xd')](_0x4826ec,_0x292d11)[_0xa367('0xe')](function(_0x1483f7){logger[_0xa367('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x57f269,'request\x20sent');logger[_0xa367('0x10')](_0xa367('0x11'),_0x57f269,'request\x20sent',JSON[_0xa367('0x12')](_0x1483f7));if(_0x1483f7[_0xa367('0x13')]){if(_0x1483f7[_0xa367('0x13')]['code']===0x1f4){logger[_0xa367('0x13')](_0xa367('0x14'),_0x57f269,_0x1483f7[_0xa367('0x13')][_0xa367('0x15')]);return _0x413fe7(_0x1483f7[_0xa367('0x13')]['message']);}logger[_0xa367('0x13')](_0xa367('0x14'),_0x57f269,_0x1483f7['error'][_0xa367('0x15')]);return _0x248058(_0x1483f7[_0xa367('0x13')][_0xa367('0x15')]);}else{logger['info'](_0xa367('0x14'),_0x57f269,_0xa367('0x16'));_0x248058(_0x1483f7[_0xa367('0x17')]['message']);}})['catch'](function(_0xd397f8){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x57f269,_0xd397f8);_0x413fe7(_0xd397f8);});});}exports[_0xa367('0x18')]=function(_0x4ee92f){var _0x10df20=this;return new Promise(function(_0x1f664b,_0x65bef6){return db[_0xa367('0x19')][_0xa367('0x1a')](_0x4ee92f[_0xa367('0x1b')],{'raw':_0x4ee92f['options']?_0x4ee92f[_0xa367('0x1c')][_0xa367('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x513a20){logger['info'](_0xa367('0x18'),_0x4ee92f);logger[_0xa367('0x10')](_0xa367('0x18'),_0x4ee92f,JSON['stringify'](_0x513a20));_0x1f664b(_0x513a20);})[_0xa367('0x1e')](function(_0xa3cded){logger['error'](_0xa367('0x18'),_0xa3cded[_0xa367('0x15')],_0x4ee92f);_0x65bef6(_0x10df20[_0xa367('0x13')](0x1f4,_0xa3cded[_0xa367('0x15')]));});});};exports[_0xa367('0x1f')]=function(_0x203748){var _0x4411cd=this;return new Promise(function(_0x304a55,_0x1ebae8){return db['VoiceDialReport'][_0xa367('0x20')](_0x203748[_0xa367('0x1b')],{'raw':_0x203748['options']?_0x203748[_0xa367('0x1c')][_0xa367('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x203748[_0xa367('0x1c')]?_0x203748[_0xa367('0x1c')][_0xa367('0x21')]||null:null,'attributes':_0x203748['options']?_0x203748[_0xa367('0x1c')][_0xa367('0x22')]||null:null,'limit':_0x203748[_0xa367('0x1c')]?_0x203748[_0xa367('0x1c')][_0xa367('0x23')]||null:null})['then'](function(_0x10cf5b){logger[_0xa367('0xf')]('UpdateVoiceDialReport',_0x203748);logger['debug'](_0xa367('0x1f'),_0x203748,JSON[_0xa367('0x12')](_0x10cf5b));_0x304a55(_0x10cf5b);})['catch'](function(_0x253d45){logger['error'](_0xa367('0x1f'),_0x253d45[_0xa367('0x15')],_0x203748);_0x1ebae8(_0x4411cd[_0xa367('0x13')](0x1f4,_0x253d45[_0xa367('0x15')]));});});}; \ No newline at end of file +var _0xa258=['request','then','info','request\x20sent','debug','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','VoiceDialReport','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1f9740,_0x2dc7cb){var _0x1de045=function(_0x52cd85){while(--_0x52cd85){_0x1f9740['push'](_0x1f9740['shift']());}};_0x1de045(++_0x2dc7cb);}(_0xa258,0xfc));var _0x8a25=function(_0x3c4a44,_0x4b5a6b){_0x3c4a44=_0x3c4a44-0x0;var _0x17bb5a=_0xa258[_0x3c4a44];return _0x17bb5a;};'use strict';var _=require(_0x8a25('0x0'));var util=require('util');var moment=require(_0x8a25('0x1'));var BPromise=require(_0x8a25('0x2'));var rs=require(_0x8a25('0x3'));var fs=require('fs');var Redis=require(_0x8a25('0x4'));var db=require(_0x8a25('0x5'))['db'];var utils=require(_0x8a25('0x6'));var logger=require(_0x8a25('0x7'))(_0x8a25('0x8'));var config=require(_0x8a25('0x9'));var jayson=require(_0x8a25('0xa'));var client=jayson['client'][_0x8a25('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fc8af,_0x3484ef,_0x188a38){return new BPromise(function(_0x40b102,_0x5c12b4){return client[_0x8a25('0xc')](_0x2fc8af,_0x188a38)[_0x8a25('0xd')](function(_0x431fc5){logger[_0x8a25('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x3484ef,_0x8a25('0xf'));logger[_0x8a25('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x3484ef,_0x8a25('0xf'),JSON[_0x8a25('0x11')](_0x431fc5));if(_0x431fc5[_0x8a25('0x12')]){if(_0x431fc5[_0x8a25('0x12')][_0x8a25('0x13')]===0x1f4){logger['error'](_0x8a25('0x14'),_0x3484ef,_0x431fc5[_0x8a25('0x12')][_0x8a25('0x15')]);return _0x5c12b4(_0x431fc5[_0x8a25('0x12')][_0x8a25('0x15')]);}logger[_0x8a25('0x12')](_0x8a25('0x14'),_0x3484ef,_0x431fc5['error']['message']);return _0x40b102(_0x431fc5[_0x8a25('0x12')][_0x8a25('0x15')]);}else{logger[_0x8a25('0xe')](_0x8a25('0x14'),_0x3484ef,'request\x20sent');_0x40b102(_0x431fc5[_0x8a25('0x16')]['message']);}})[_0x8a25('0x17')](function(_0x353e9d){logger[_0x8a25('0x12')](_0x8a25('0x14'),_0x3484ef,_0x353e9d);_0x5c12b4(_0x353e9d);});});}exports[_0x8a25('0x18')]=function(_0x5b9bcd){var _0x18c686=this;return new Promise(function(_0x485e3b,_0x53e984){return db['VoiceDialReport'][_0x8a25('0x19')](_0x5b9bcd[_0x8a25('0x1a')],{'raw':_0x5b9bcd[_0x8a25('0x1b')]?_0x5b9bcd[_0x8a25('0x1b')][_0x8a25('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x53cb10){logger[_0x8a25('0xe')]('CreateVoiceDialReport',_0x5b9bcd);logger['debug']('CreateVoiceDialReport',_0x5b9bcd,JSON[_0x8a25('0x11')](_0x53cb10));_0x485e3b(_0x53cb10);})[_0x8a25('0x17')](function(_0x392957){logger[_0x8a25('0x12')](_0x8a25('0x18'),_0x392957['message'],_0x5b9bcd);_0x53e984(_0x18c686[_0x8a25('0x12')](0x1f4,_0x392957[_0x8a25('0x15')]));});});};exports[_0x8a25('0x1d')]=function(_0x9a074b){var _0x23411d=this;return new Promise(function(_0x2752c4,_0x241807){return db[_0x8a25('0x1e')]['update'](_0x9a074b[_0x8a25('0x1a')],{'raw':_0x9a074b[_0x8a25('0x1b')]?_0x9a074b['options'][_0x8a25('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9a074b[_0x8a25('0x1b')]?_0x9a074b[_0x8a25('0x1b')][_0x8a25('0x1f')]||null:null,'attributes':_0x9a074b['options']?_0x9a074b[_0x8a25('0x1b')][_0x8a25('0x20')]||null:null,'limit':_0x9a074b['options']?_0x9a074b[_0x8a25('0x1b')]['limit']||null:null})['then'](function(_0x2472e1){logger['info'](_0x8a25('0x1d'),_0x9a074b);logger[_0x8a25('0x10')](_0x8a25('0x1d'),_0x9a074b,JSON[_0x8a25('0x11')](_0x2472e1));_0x2752c4(_0x2472e1);})[_0x8a25('0x17')](function(_0x5267a6){logger[_0x8a25('0x12')](_0x8a25('0x1d'),_0x5267a6['message'],_0x9a074b);_0x241807(_0x23411d[_0x8a25('0x12')](0x1f4,_0x5267a6[_0x8a25('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 9803750..81ca7a5 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 _0xd746=['./voiceExtension.controller','get','/:id','show','post','isAuthenticated','create','addApplications','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xd746,0x99));var _0x6d74=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xd746[_0x29d915];return _0x160f86;};'use strict';var multer=require(_0x6d74('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6d74('0x1'));var express=require(_0x6d74('0x2'));var router=express['Router']();var fs_extra=require(_0x6d74('0x3'));var auth=require(_0x6d74('0x4'));var interaction=require(_0x6d74('0x5'));var config=require(_0x6d74('0x6'));var controller=require(_0x6d74('0x7'));router[_0x6d74('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6d74('0x9'),auth['isAuthenticated'](),controller[_0x6d74('0xa')]);router[_0x6d74('0xb')]('/',auth[_0x6d74('0xc')](),controller[_0x6d74('0xd')]);router[_0x6d74('0xb')]('/:id/applications',auth[_0x6d74('0xc')](),controller[_0x6d74('0xe')]);router[_0x6d74('0xf')]('/:id',auth[_0x6d74('0xc')](),controller[_0x6d74('0x10')]);router[_0x6d74('0x11')](_0x6d74('0x9'),auth['isAuthenticated'](),controller[_0x6d74('0x12')]);module[_0x6d74('0x13')]=router; \ No newline at end of file +var _0xda50=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','post','/:id/applications','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x2cdf8f,_0x5043d8){var _0x4cc64b=function(_0x2247a2){while(--_0x2247a2){_0x2cdf8f['push'](_0x2cdf8f['shift']());}};_0x4cc64b(++_0x5043d8);}(_0xda50,0x150));var _0x0da5=function(_0x2f7c46,_0x2aecb9){_0x2f7c46=_0x2f7c46-0x0;var _0x4479fe=_0xda50[_0x2f7c46];return _0x4479fe;};'use strict';var multer=require(_0x0da5('0x0'));var util=require(_0x0da5('0x1'));var path=require(_0x0da5('0x2'));var timeout=require(_0x0da5('0x3'));var express=require(_0x0da5('0x4'));var router=express[_0x0da5('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0da5('0x6'));var config=require(_0x0da5('0x7'));var controller=require('./voiceExtension.controller');router[_0x0da5('0x8')]('/',auth[_0x0da5('0x9')](),controller['index']);router[_0x0da5('0x8')](_0x0da5('0xa'),auth[_0x0da5('0x9')](),controller[_0x0da5('0xb')]);router['post']('/',auth[_0x0da5('0x9')](),controller[_0x0da5('0xc')]);router[_0x0da5('0xd')](_0x0da5('0xe'),auth['isAuthenticated'](),controller['addApplications']);router[_0x0da5('0xf')](_0x0da5('0xa'),auth[_0x0da5('0x9')](),controller[_0x0da5('0x10')]);router['delete'](_0x0da5('0xa'),auth['isAuthenticated'](),controller[_0x0da5('0x11')]);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 78f968e..d8bf9fb 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 _0xc7de=['exten','sequelize','compositeIndex','STRING','NoOp','ENUM','inbound','outbound','inbound-fax','outbound-fax','any','INTEGER','BOOLEAN','VIRTUAL','getDataValue'];(function(_0x16cdf2,_0x8ec198){var _0x702347=function(_0x5349fa){while(--_0x5349fa){_0x16cdf2['push'](_0x16cdf2['shift']());}};_0x702347(++_0x8ec198);}(_0xc7de,0x14b));var _0xec7d=function(_0x2a2799,_0x5e25a8){_0x2a2799=_0x2a2799-0x0;var _0x17f761=_0xc7de[_0x2a2799];return _0x17f761;};'use strict';var Sequelize=require(_0xec7d('0x0'));module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xec7d('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xec7d('0x2')],'allowNull':![],'unique':_0xec7d('0x1')},'priority':{'type':Sequelize[_0xec7d('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xec7d('0x1')},'tag':{'type':Sequelize[_0xec7d('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xec7d('0x2')],'allowNull':![],'defaultValue':_0xec7d('0x3')},'appdata':{'type':Sequelize[_0xec7d('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xec7d('0x4')](_0xec7d('0x5'),_0xec7d('0x6'),'internal',_0xec7d('0x7'),_0xec7d('0x8'),'system',_0xec7d('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xec7d('0x2')]},'interval':{'type':Sequelize[_0xec7d('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xec7d('0xa')]},'isApp':{'type':Sequelize[_0xec7d('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xec7d('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xec7d('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xec7d('0xa')]},'recordingFormat':{'type':Sequelize[_0xec7d('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xec7d('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xec7d('0xc')],'get':function(_0x40c075){return this[_0xec7d('0xd')](_0xec7d('0xe'));}},'alias':{'type':Sequelize[_0xec7d('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x56c5=['INTEGER','wav','BOOLEAN','getDataValue','sequelize','exports','compositeIndex','STRING','NoOp','ENUM','outbound','internal','inbound-fax','outbound-fax','any','*,*,*,*'];(function(_0x3eca1a,_0x36ec24){var _0x111811=function(_0x442823){while(--_0x442823){_0x3eca1a['push'](_0x3eca1a['shift']());}};_0x111811(++_0x36ec24);}(_0x56c5,0x104));var _0x556c=function(_0x5517b1,_0x35542b){_0x5517b1=_0x5517b1-0x0;var _0x306fa5=_0x56c5[_0x5517b1];return _0x306fa5;};'use strict';var Sequelize=require(_0x556c('0x0'));module[_0x556c('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x556c('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x556c('0x2')},'priority':{'type':Sequelize[_0x556c('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x556c('0x2')},'tag':{'type':Sequelize[_0x556c('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x556c('0x3')],'allowNull':![],'defaultValue':_0x556c('0x4')},'appdata':{'type':Sequelize[_0x556c('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x556c('0x5')]('inbound',_0x556c('0x6'),_0x556c('0x7'),_0x556c('0x8'),_0x556c('0x9'),'system',_0x556c('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x556c('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x556c('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x556c('0x3')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x556c('0xc')]},'recordingFormat':{'type':Sequelize[_0x556c('0x3')],'defaultValue':_0x556c('0xd')},'answer':{'type':Sequelize[_0x556c('0xe')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2a9c1d){return this[_0x556c('0xf')]('exten');}},'alias':{'type':Sequelize[_0x556c('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 4980a9c..b594445 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 _0xb08e=['socket.io-emitter','register','sendStatus','end','json','limit','undefined','count','offset','status','set','reject','update','then','destroy','get','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','error','stack','VoiceExtension','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','cutdigits','mandatoryDisposition','alias','addApplications','findOne','sequelize','transaction','VoiceExtensionId','isApp','rewriteDial','true','bulkCreate','rimraf','zip-dir','request-promise','moment','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0xb08e,0x187));var _0xeb08=function(_0x5794c4,_0x309b7a){_0x5794c4=_0x5794c4-0x0;var _0x537506=_0xb08e[_0x5794c4];return _0x537506;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb08('0x0'));var zipdir=require(_0xeb08('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb08('0x2'));var moment=require(_0xeb08('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xeb08('0x4'));var sox=require(_0xeb08('0x5'));var csv=require('to-csv');var ejs=require(_0xeb08('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeb08('0x7'));var crypto=require(_0xeb08('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xeb08('0x9'));var toCsv=require(_0xeb08('0xa'));var querystring=require(_0xeb08('0xb'));var Papa=require(_0xeb08('0xc'));var Redis=require(_0xeb08('0xd'));var authService=require(_0xeb08('0xe'));var qs=require(_0xeb08('0xf'));var as=require(_0xeb08('0x10'));var hardwareService=require(_0xeb08('0x11'));var logger=require(_0xeb08('0x12'))('api');var utils=require(_0xeb08('0x13'));var config=require(_0xeb08('0x14'));var licenseUtil=require(_0xeb08('0x15'));var db=require(_0xeb08('0x16'))['db'];config[_0xeb08('0x17')]=_[_0xeb08('0x18')](config[_0xeb08('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb08('0x19'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xeb08('0x1a')](socket);function respondWithStatusCode(_0x25d933,_0x6172c3){_0x6172c3=_0x6172c3||0xcc;return function(_0x2332b9){if(_0x2332b9){return _0x25d933[_0xeb08('0x1b')](_0x6172c3);}return _0x25d933['status'](_0x6172c3)[_0xeb08('0x1c')]();};}function respondWithResult(_0x313d43,_0x187fdc){_0x187fdc=_0x187fdc||0xc8;return function(_0xa0f387){if(_0xa0f387){return _0x313d43['status'](_0x187fdc)[_0xeb08('0x1d')](_0xa0f387);}};}function respondWithFilteredResult(_0x1e0a51,_0x41ddc3){return function(_0x67af63){if(_0x67af63){var _0x51ba69=typeof _0x41ddc3['offset']==='undefined'&&typeof _0x41ddc3[_0xeb08('0x1e')]===_0xeb08('0x1f');var _0x343959=_0x67af63[_0xeb08('0x20')];var _0x2e9529=_0x51ba69?0x0:_0x41ddc3[_0xeb08('0x21')];var _0x380c5a=_0x51ba69?_0x67af63[_0xeb08('0x20')]:_0x41ddc3[_0xeb08('0x21')]+_0x41ddc3[_0xeb08('0x1e')];var _0x2e5032;if(_0x380c5a>=_0x343959){_0x380c5a=_0x343959;_0x2e5032=0xc8;}else{_0x2e5032=0xce;}_0x1e0a51[_0xeb08('0x22')](_0x2e5032);return _0x1e0a51[_0xeb08('0x23')]('Content-Range',_0x2e9529+'-'+_0x380c5a+'/'+_0x343959)['json'](_0x67af63);}return null;};}function patchUpdates(_0x33c7aa){return function(_0x88da66){try{jsonpatch['apply'](_0x88da66,_0x33c7aa,!![]);}catch(_0x1d3dea){return BPromise[_0xeb08('0x24')](_0x1d3dea);}return _0x88da66['save']();};}function saveUpdates(_0x3c77df,_0x3fdfba){return function(_0x4308c7){if(_0x4308c7){return _0x4308c7[_0xeb08('0x25')](_0x3c77df)[_0xeb08('0x26')](function(_0x1f696d){return _0x1f696d;});}return null;};}function removeEntity(_0x5d7424,_0x326061){return function(_0x3c9f49){if(_0x3c9f49){return _0x3c9f49[_0xeb08('0x27')]()[_0xeb08('0x26')](function(){var _0x5c737e=_0x3c9f49[_0xeb08('0x28')]({'plain':!![]});var _0x37fb33=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0xeb08('0x29'),'value':_0xeb08('0x2a'),'ignore':![]},{'name':_0xeb08('0x2b'),'value':_0xeb08('0x2c'),'ignore':![]}];var _0x154810=_(_0x37fb33)[_0xeb08('0x2d')](_0xeb08('0x2e'))[_0xeb08('0x2f')]('value')[_0xeb08('0x30')]();if(_[_0xeb08('0x31')](_0x154810,_0x5c737e[_0xeb08('0x32')])){return;}var _0x406319=_[_0xeb08('0x33')](_0x37fb33,[_0xeb08('0x30'),_0x5c737e[_0xeb08('0x32')]])[_0xeb08('0x34')];return db['UserProfileResource'][_0xeb08('0x27')]({'where':{'type':_0x406319,'resourceId':_0x5c737e['id']}})[_0xeb08('0x26')](function(){return _0x3c9f49;});})['then'](function(){_0x5d7424['status'](0xcc)[_0xeb08('0x1c')]();});}};}function handleEntityNotFound(_0x37f0a6,_0x4b5432){return function(_0x4a154a){if(!_0x4a154a){_0x37f0a6['sendStatus'](0x194);}return _0x4a154a;};}function handleError(_0x571ab1,_0x497f03){_0x497f03=_0x497f03||0x1f4;return function(_0x2965f1){logger[_0xeb08('0x35')](_0x2965f1[_0xeb08('0x36')]);if(_0x2965f1['name']){delete _0x2965f1[_0xeb08('0x34')];}_0x571ab1[_0xeb08('0x22')](_0x497f03)['send'](_0x2965f1);};}exports['index']=function(_0x180e3d,_0x2bd8e3){var _0x1c4907={},_0x264f3f={},_0xa2a73c={'count':0x0,'rows':[]};var _0x442be3=_[_0xeb08('0x2f')](db[_0xeb08('0x37')][_0xeb08('0x38')],function(_0x275701){return{'name':_0x275701[_0xeb08('0x39')],'type':_0x275701[_0xeb08('0x32')][_0xeb08('0x3a')]};});_0x264f3f['model']=_[_0xeb08('0x2f')](_0x442be3,_0xeb08('0x34'));_0x264f3f[_0xeb08('0x3b')]=_[_0xeb08('0x3c')](_0x180e3d[_0xeb08('0x3b')]);_0x264f3f['filters']=_[_0xeb08('0x3d')](_0x264f3f[_0xeb08('0x3e')],_0x264f3f[_0xeb08('0x3b')]);_0x1c4907[_0xeb08('0x3f')]=_[_0xeb08('0x3d')](_0x264f3f[_0xeb08('0x3e')],qs[_0xeb08('0x40')](_0x180e3d[_0xeb08('0x3b')][_0xeb08('0x40')]));_0x1c4907[_0xeb08('0x3f')]=_0x1c4907[_0xeb08('0x3f')][_0xeb08('0x41')]?_0x1c4907['attributes']:_0x264f3f[_0xeb08('0x3e')];if(!_0x180e3d[_0xeb08('0x3b')]['hasOwnProperty'](_0xeb08('0x42'))){_0x1c4907[_0xeb08('0x1e')]=qs['limit'](_0x180e3d['query'][_0xeb08('0x1e')]);_0x1c4907[_0xeb08('0x21')]=qs[_0xeb08('0x21')](_0x180e3d[_0xeb08('0x3b')]['offset']);}_0x1c4907['order']=qs[_0xeb08('0x43')](_0x180e3d[_0xeb08('0x3b')][_0xeb08('0x43')]);_0x1c4907[_0xeb08('0x44')]=qs['filters'](_[_0xeb08('0x45')](_0x180e3d[_0xeb08('0x3b')],_0x264f3f[_0xeb08('0x46')]),_0x442be3);if(_0x180e3d[_0xeb08('0x3b')][_0xeb08('0x2d')]){_0x1c4907['where']=_[_0xeb08('0x47')](_0x1c4907[_0xeb08('0x44')],{'$or':_[_0xeb08('0x2f')](_0x442be3,function(_0x538b30){if(_0x538b30['type']!==_0xeb08('0x48')){var _0x1f9f1b={};_0x1f9f1b[_0x538b30[_0xeb08('0x34')]]={'$like':'%'+_0x180e3d['query'][_0xeb08('0x2d')]+'%'};return _0x1f9f1b;}})});}_0x1c4907=_[_0xeb08('0x47')]({},_0x1c4907,_0x180e3d[_0xeb08('0x49')]);var _0x5c7019={'where':_0x1c4907['where']};return db[_0xeb08('0x37')]['count'](_0x5c7019)['then'](function(_0x596b10){_0xa2a73c[_0xeb08('0x20')]=_0x596b10;if(_0x180e3d[_0xeb08('0x3b')][_0xeb08('0x4a')]){_0x1c4907[_0xeb08('0x4b')]=[{'all':!![]}];}return db[_0xeb08('0x37')][_0xeb08('0x4c')](_0x1c4907);})['then'](function(_0x1dfeff){_0xa2a73c[_0xeb08('0x4d')]=_0x1dfeff;return _0xa2a73c;})[_0xeb08('0x26')](respondWithFilteredResult(_0x2bd8e3,_0x1c4907))['catch'](handleError(_0x2bd8e3,null));};exports[_0xeb08('0x4e')]=function(_0x3daaad,_0x535494){var _0xe430e={'raw':![],'where':{'id':_0x3daaad[_0xeb08('0x4f')]['id']}},_0x50c43f={};_0x50c43f[_0xeb08('0x3e')]=_[_0xeb08('0x3c')](db['VoiceExtension']['rawAttributes']);_0x50c43f[_0xeb08('0x3b')]=_[_0xeb08('0x3c')](_0x3daaad[_0xeb08('0x3b')]);_0x50c43f[_0xeb08('0x46')]=_['intersection'](_0x50c43f['model'],_0x50c43f['query']);_0xe430e[_0xeb08('0x3f')]=_[_0xeb08('0x3d')](_0x50c43f[_0xeb08('0x3e')],qs[_0xeb08('0x40')](_0x3daaad[_0xeb08('0x3b')][_0xeb08('0x40')]));_0xe430e[_0xeb08('0x3f')]=_0xe430e[_0xeb08('0x3f')][_0xeb08('0x41')]?_0xe430e[_0xeb08('0x3f')]:_0x50c43f[_0xeb08('0x3e')];if(_0x3daaad[_0xeb08('0x3b')][_0xeb08('0x4a')]){_0xe430e[_0xeb08('0x4b')]=[{'all':!![]}];}_0xe430e=_['merge']({},_0xe430e,_0x3daaad[_0xeb08('0x49')]);return db['VoiceExtension'][_0xeb08('0x33')](_0xe430e)[_0xeb08('0x26')](handleEntityNotFound(_0x535494,null))[_0xeb08('0x26')](respondWithResult(_0x535494,null))[_0xeb08('0x50')](handleError(_0x535494,null));};exports['destroy']=function(_0xf4d76e,_0x6a92e){return db[_0xeb08('0x37')][_0xeb08('0x33')]({'where':{'id':_0xf4d76e[_0xeb08('0x4f')]['id']}})['then'](handleEntityNotFound(_0x6a92e,null))['then'](removeEntity(_0x6a92e,null))[_0xeb08('0x50')](handleError(_0x6a92e,null));};exports[_0xeb08('0x51')]=function(_0x4d87c1,_0x3a8297){if(_0x4d87c1[_0xeb08('0x52')][_0xeb08('0x32')]===_0xeb08('0x2a')&&!_['startsWith'](_0x4d87c1[_0xeb08('0x52')][_0xeb08('0x53')],'_')){_0x4d87c1[_0xeb08('0x52')][_0xeb08('0x53')]='_'[_0xeb08('0x54')](_0x4d87c1[_0xeb08('0x52')]['exten']);}return db[_0xeb08('0x37')][_0xeb08('0x51')](_0x4d87c1[_0xeb08('0x52')],{'raw':![]})[_0xeb08('0x26')](function(_0x1b256e){var _0x3ded81=_0x4d87c1[_0xeb08('0x55')]['get']({'plain':!![]});if(!_0x3ded81)throw new Error(_0xeb08('0x56'));if(_0x3ded81['role']===_0xeb08('0x55')){var _0x3f11b2=_0x1b256e['get']({'plain':!![]});var _0x4e6048=[{'name':'InboundRoutes','value':_0xeb08('0x57')},{'name':_0xeb08('0x29'),'value':_0xeb08('0x2a')},{'name':_0xeb08('0x2b'),'value':_0xeb08('0x2c')}];var _0x1ff87a=_[_0xeb08('0x33')](_0x4e6048,[_0xeb08('0x30'),_0x3f11b2[_0xeb08('0x32')]])[_0xeb08('0x34')];return db['UserProfileSection'][_0xeb08('0x33')]({'where':{'name':_0x1ff87a,'userProfileId':_0x3ded81[_0xeb08('0x58')]},'raw':!![]})[_0xeb08('0x26')](function(_0x8680a8){if(_0x8680a8&&_0x8680a8['autoAssociation']===0x0){return db[_0xeb08('0x59')][_0xeb08('0x51')]({'name':_0x3f11b2[_0xeb08('0x34')],'resourceId':_0x3f11b2['id'],'type':_0x8680a8[_0xeb08('0x34')],'sectionId':_0x8680a8['id']},{})[_0xeb08('0x26')](function(){return _0x1b256e;});}else{return _0x1b256e;}})[_0xeb08('0x50')](function(_0x293607){logger[_0xeb08('0x35')](_0xeb08('0x5a'),_0x293607);throw _0x293607;});}return _0x1b256e;})[_0xeb08('0x26')](respondWithResult(_0x3a8297,0xc9))[_0xeb08('0x50')](handleError(_0x3a8297,null));};exports[_0xeb08('0x25')]=function(_0x8a162f,_0x484fe6){if(_0x8a162f['body']['id']){delete _0x8a162f[_0xeb08('0x52')]['id'];}return db['VoiceExtension'][_0xeb08('0x33')]({'where':{'id':_0x8a162f[_0xeb08('0x4f')]['id']}})[_0xeb08('0x26')](handleEntityNotFound(_0x484fe6,null))[_0xeb08('0x26')](function(_0x5106bf){if(_0x5106bf){return db[_0xeb08('0x37')]['update'](_['pick'](_0x8a162f[_0xeb08('0x52')],[_0xeb08('0x53'),_0xeb08('0x5b'),'description','recordingFormat',_0xeb08('0x5c'),_0xeb08('0x5d'),_0xeb08('0x5e')]),{'where':{'context':_0x5106bf[_0xeb08('0x5b')],'exten':_0x5106bf[_0xeb08('0x53')]},'individualHooks':!![]})['then'](function(_0x2a3108){return _0x2a3108;});}return null;})[_0xeb08('0x26')](respondWithStatusCode(_0x484fe6,null))['catch'](handleError(_0x484fe6,null));};exports[_0xeb08('0x5f')]=function(_0x336687,_0x1aee48){return db[_0xeb08('0x37')][_0xeb08('0x60')]({'where':{'id':_0x336687['params']['id']}})[_0xeb08('0x26')](function(_0x1b74c0){if(_0x1b74c0){return db[_0xeb08('0x61')][_0xeb08('0x62')](function(_0x3022e8){return db[_0xeb08('0x37')][_0xeb08('0x27')]({'where':{'VoiceExtensionId':_0x336687[_0xeb08('0x4f')]['id']},'transaction':_0x3022e8})[_0xeb08('0x26')](function(){var _0x9c5036=_[_0xeb08('0x2f')](_0x336687[_0xeb08('0x52')],function(_0x575ac8){_0x575ac8[_0xeb08('0x63')]=_0x336687[_0xeb08('0x4f')]['id'];_0x575ac8[_0xeb08('0x64')]=!![];return _0x575ac8;});var _0x34bb69=_0x336687['query'][_0xeb08('0x65')]&&_0x336687[_0xeb08('0x3b')][_0xeb08('0x65')]['toLowerCase']()===_0xeb08('0x66')?!![]:![];return _0x1b74c0['createRouting'](_0x9c5036,_0x34bb69);})['then'](function(_0x366f08){return db[_0xeb08('0x37')][_0xeb08('0x67')](_0x366f08,{'transaction':_0x3022e8});});})[_0xeb08('0x26')](function(){return db[_0xeb08('0x37')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x336687[_0xeb08('0x4f')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xeb08('0x26')](respondWithResult(_0x1aee48,null))['catch'](handleError(_0x1aee48,null));}; \ No newline at end of file +var _0x7d97=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','isApp','rewriteDial','toLowerCase','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./voiceExtension.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','then','get','InboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','name','UserProfileResource','error','stack','index','VoiceExtension','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','includeAll','findAll','rows','show','params','keys','include','options','find','catch','create','body','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x3f0163,_0x2f4ed3){var _0x4ffdca=function(_0x3513e3){while(--_0x3513e3){_0x3f0163['push'](_0x3f0163['shift']());}};_0x4ffdca(++_0x2f4ed3);}(_0x7d97,0x1c4));var _0x77d9=function(_0x1976b1,_0x1b3e00){_0x1976b1=_0x1976b1-0x0;var _0xa3482=_0x7d97[_0x1976b1];return _0xa3482;};'use strict';var emlformat=require(_0x77d9('0x0'));var rimraf=require(_0x77d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x77d9('0x2'));var rp=require(_0x77d9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x77d9('0x4'));var util=require(_0x77d9('0x5'));var path=require(_0x77d9('0x6'));var sox=require('sox');var csv=require(_0x77d9('0x7'));var ejs=require(_0x77d9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77d9('0x9'));var squel=require(_0x77d9('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x77d9('0xb'));var toCsv=require(_0x77d9('0x7'));var querystring=require('querystring');var Papa=require(_0x77d9('0xc'));var Redis=require(_0x77d9('0xd'));var authService=require(_0x77d9('0xe'));var qs=require(_0x77d9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77d9('0x10'));var logger=require(_0x77d9('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x77d9('0x12'));var licenseUtil=require(_0x77d9('0x13'));var db=require(_0x77d9('0x14'))['db'];config[_0x77d9('0x15')]=_[_0x77d9('0x16')](config[_0x77d9('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x77d9('0x15')]));require(_0x77d9('0x17'))[_0x77d9('0x18')](socket);function respondWithStatusCode(_0x4f6c57,_0x316d9a){_0x316d9a=_0x316d9a||0xcc;return function(_0x2383fc){if(_0x2383fc){return _0x4f6c57[_0x77d9('0x19')](_0x316d9a);}return _0x4f6c57[_0x77d9('0x1a')](_0x316d9a)[_0x77d9('0x1b')]();};}function respondWithResult(_0x30a3a4,_0x2e3c30){_0x2e3c30=_0x2e3c30||0xc8;return function(_0x38dae0){if(_0x38dae0){return _0x30a3a4[_0x77d9('0x1a')](_0x2e3c30)[_0x77d9('0x1c')](_0x38dae0);}};}function respondWithFilteredResult(_0x11f2df,_0x1066ed){return function(_0x32aeff){if(_0x32aeff){var _0x5bd8fc=typeof _0x1066ed[_0x77d9('0x1d')]==='undefined'&&typeof _0x1066ed[_0x77d9('0x1e')]===_0x77d9('0x1f');var _0x447724=_0x32aeff[_0x77d9('0x20')];var _0x2faf70=_0x5bd8fc?0x0:_0x1066ed[_0x77d9('0x1d')];var _0x5ec5a5=_0x5bd8fc?_0x32aeff[_0x77d9('0x20')]:_0x1066ed[_0x77d9('0x1d')]+_0x1066ed[_0x77d9('0x1e')];var _0x38f363;if(_0x5ec5a5>=_0x447724){_0x5ec5a5=_0x447724;_0x38f363=0xc8;}else{_0x38f363=0xce;}_0x11f2df[_0x77d9('0x1a')](_0x38f363);return _0x11f2df[_0x77d9('0x21')](_0x77d9('0x22'),_0x2faf70+'-'+_0x5ec5a5+'/'+_0x447724)['json'](_0x32aeff);}return null;};}function patchUpdates(_0x3a117a){return function(_0x2fb8d1){try{jsonpatch['apply'](_0x2fb8d1,_0x3a117a,!![]);}catch(_0x423215){return BPromise[_0x77d9('0x23')](_0x423215);}return _0x2fb8d1['save']();};}function saveUpdates(_0x58b17f,_0x1b8490){return function(_0x5a2968){if(_0x5a2968){return _0x5a2968[_0x77d9('0x24')](_0x58b17f)['then'](function(_0x1c50a8){return _0x1c50a8;});}return null;};}function removeEntity(_0xd77f66,_0x1e79c7){return function(_0x205617){if(_0x205617){return _0x205617[_0x77d9('0x25')]()[_0x77d9('0x26')](function(){var _0x58a5dc=_0x205617[_0x77d9('0x27')]({'plain':!![]});var _0xee8915=[{'name':_0x77d9('0x28'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x77d9('0x29'),'ignore':![]},{'name':_0x77d9('0x2a'),'value':_0x77d9('0x2b'),'ignore':![]}];var _0x3131bc=_(_0xee8915)[_0x77d9('0x2c')](_0x77d9('0x2d'))[_0x77d9('0x2e')]('value')[_0x77d9('0x2f')]();if(_[_0x77d9('0x30')](_0x3131bc,_0x58a5dc[_0x77d9('0x31')])){return;}var _0xb6f7d6=_['find'](_0xee8915,[_0x77d9('0x2f'),_0x58a5dc[_0x77d9('0x31')]])[_0x77d9('0x32')];return db[_0x77d9('0x33')][_0x77d9('0x25')]({'where':{'type':_0xb6f7d6,'resourceId':_0x58a5dc['id']}})[_0x77d9('0x26')](function(){return _0x205617;});})['then'](function(){_0xd77f66[_0x77d9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e7a9b,_0x1ea0c6){return function(_0x1ccfed){if(!_0x1ccfed){_0x4e7a9b[_0x77d9('0x19')](0x194);}return _0x1ccfed;};}function handleError(_0x4677e1,_0x2ed2cc){_0x2ed2cc=_0x2ed2cc||0x1f4;return function(_0x1986b7){logger[_0x77d9('0x34')](_0x1986b7[_0x77d9('0x35')]);if(_0x1986b7[_0x77d9('0x32')]){delete _0x1986b7[_0x77d9('0x32')];}_0x4677e1[_0x77d9('0x1a')](_0x2ed2cc)['send'](_0x1986b7);};}exports[_0x77d9('0x36')]=function(_0x2cb80c,_0x8720e1){var _0x15b8e8={},_0xfff910={},_0x1a499f={'count':0x0,'rows':[]};var _0x59c206=_[_0x77d9('0x2e')](db[_0x77d9('0x37')]['rawAttributes'],function(_0x173c45){return{'name':_0x173c45[_0x77d9('0x38')],'type':_0x173c45[_0x77d9('0x31')][_0x77d9('0x39')]};});_0xfff910[_0x77d9('0x3a')]=_[_0x77d9('0x2e')](_0x59c206,_0x77d9('0x32'));_0xfff910[_0x77d9('0x3b')]=_['keys'](_0x2cb80c[_0x77d9('0x3b')]);_0xfff910['filters']=_[_0x77d9('0x3c')](_0xfff910[_0x77d9('0x3a')],_0xfff910[_0x77d9('0x3b')]);_0x15b8e8['attributes']=_[_0x77d9('0x3c')](_0xfff910['model'],qs[_0x77d9('0x3d')](_0x2cb80c['query'][_0x77d9('0x3d')]));_0x15b8e8['attributes']=_0x15b8e8[_0x77d9('0x3e')][_0x77d9('0x3f')]?_0x15b8e8[_0x77d9('0x3e')]:_0xfff910[_0x77d9('0x3a')];if(!_0x2cb80c[_0x77d9('0x3b')][_0x77d9('0x40')](_0x77d9('0x41'))){_0x15b8e8[_0x77d9('0x1e')]=qs[_0x77d9('0x1e')](_0x2cb80c['query'][_0x77d9('0x1e')]);_0x15b8e8[_0x77d9('0x1d')]=qs['offset'](_0x2cb80c[_0x77d9('0x3b')][_0x77d9('0x1d')]);}_0x15b8e8[_0x77d9('0x42')]=qs[_0x77d9('0x43')](_0x2cb80c[_0x77d9('0x3b')][_0x77d9('0x43')]);_0x15b8e8[_0x77d9('0x44')]=qs['filters'](_[_0x77d9('0x45')](_0x2cb80c['query'],_0xfff910[_0x77d9('0x46')]),_0x59c206);if(_0x2cb80c[_0x77d9('0x3b')][_0x77d9('0x2c')]){_0x15b8e8[_0x77d9('0x44')]=_[_0x77d9('0x47')](_0x15b8e8[_0x77d9('0x44')],{'$or':_[_0x77d9('0x2e')](_0x59c206,function(_0x42a8fd){if(_0x42a8fd[_0x77d9('0x31')]!==_0x77d9('0x48')){var _0x3fc649={};_0x3fc649[_0x42a8fd[_0x77d9('0x32')]]={'$like':'%'+_0x2cb80c[_0x77d9('0x3b')]['filter']+'%'};return _0x3fc649;}})});}_0x15b8e8=_[_0x77d9('0x47')]({},_0x15b8e8,_0x2cb80c['options']);var _0x2fb3a0={'where':_0x15b8e8[_0x77d9('0x44')]};return db['VoiceExtension'][_0x77d9('0x20')](_0x2fb3a0)[_0x77d9('0x26')](function(_0x134560){_0x1a499f[_0x77d9('0x20')]=_0x134560;if(_0x2cb80c[_0x77d9('0x3b')][_0x77d9('0x49')]){_0x15b8e8['include']=[{'all':!![]}];}return db[_0x77d9('0x37')][_0x77d9('0x4a')](_0x15b8e8);})[_0x77d9('0x26')](function(_0x41ad8b){_0x1a499f[_0x77d9('0x4b')]=_0x41ad8b;return _0x1a499f;})['then'](respondWithFilteredResult(_0x8720e1,_0x15b8e8))['catch'](handleError(_0x8720e1,null));};exports[_0x77d9('0x4c')]=function(_0x1d4cd3,_0x3bc39c){var _0x53681c={'raw':![],'where':{'id':_0x1d4cd3[_0x77d9('0x4d')]['id']}},_0x2feef2={};_0x2feef2[_0x77d9('0x3a')]=_[_0x77d9('0x4e')](db['VoiceExtension']['rawAttributes']);_0x2feef2[_0x77d9('0x3b')]=_[_0x77d9('0x4e')](_0x1d4cd3[_0x77d9('0x3b')]);_0x2feef2[_0x77d9('0x46')]=_[_0x77d9('0x3c')](_0x2feef2[_0x77d9('0x3a')],_0x2feef2[_0x77d9('0x3b')]);_0x53681c[_0x77d9('0x3e')]=_[_0x77d9('0x3c')](_0x2feef2['model'],qs[_0x77d9('0x3d')](_0x1d4cd3['query']['fields']));_0x53681c[_0x77d9('0x3e')]=_0x53681c[_0x77d9('0x3e')][_0x77d9('0x3f')]?_0x53681c[_0x77d9('0x3e')]:_0x2feef2[_0x77d9('0x3a')];if(_0x1d4cd3[_0x77d9('0x3b')][_0x77d9('0x49')]){_0x53681c[_0x77d9('0x4f')]=[{'all':!![]}];}_0x53681c=_['merge']({},_0x53681c,_0x1d4cd3[_0x77d9('0x50')]);return db[_0x77d9('0x37')][_0x77d9('0x51')](_0x53681c)[_0x77d9('0x26')](handleEntityNotFound(_0x3bc39c,null))['then'](respondWithResult(_0x3bc39c,null))['catch'](handleError(_0x3bc39c,null));};exports[_0x77d9('0x25')]=function(_0xd8aa2f,_0x4f6c02){return db['VoiceExtension']['find']({'where':{'id':_0xd8aa2f[_0x77d9('0x4d')]['id']}})[_0x77d9('0x26')](handleEntityNotFound(_0x4f6c02,null))[_0x77d9('0x26')](removeEntity(_0x4f6c02,null))[_0x77d9('0x52')](handleError(_0x4f6c02,null));};exports[_0x77d9('0x53')]=function(_0xe58912,_0xac66b2){if(_0xe58912[_0x77d9('0x54')][_0x77d9('0x31')]==='outbound'&&!_[_0x77d9('0x55')](_0xe58912[_0x77d9('0x54')][_0x77d9('0x56')],'_')){_0xe58912[_0x77d9('0x54')][_0x77d9('0x56')]='_'['concat'](_0xe58912[_0x77d9('0x54')]['exten']);}return db[_0x77d9('0x37')][_0x77d9('0x53')](_0xe58912[_0x77d9('0x54')],{'raw':![]})[_0x77d9('0x26')](function(_0xa514cc){var _0x3056e7=_0xe58912[_0x77d9('0x57')]['get']({'plain':!![]});if(!_0x3056e7)throw new Error(_0x77d9('0x58'));if(_0x3056e7[_0x77d9('0x59')]===_0x77d9('0x57')){var _0x2f4d54=_0xa514cc[_0x77d9('0x27')]({'plain':!![]});var _0x56a3a3=[{'name':_0x77d9('0x28'),'value':'inbound'},{'name':'OutboundRoutes','value':_0x77d9('0x29')},{'name':_0x77d9('0x2a'),'value':_0x77d9('0x2b')}];var _0x4d697c=_[_0x77d9('0x51')](_0x56a3a3,[_0x77d9('0x2f'),_0x2f4d54[_0x77d9('0x31')]])[_0x77d9('0x32')];return db[_0x77d9('0x5a')][_0x77d9('0x51')]({'where':{'name':_0x4d697c,'userProfileId':_0x3056e7[_0x77d9('0x5b')]},'raw':!![]})[_0x77d9('0x26')](function(_0x57b940){if(_0x57b940&&_0x57b940[_0x77d9('0x5c')]===0x0){return db['UserProfileResource'][_0x77d9('0x53')]({'name':_0x2f4d54[_0x77d9('0x32')],'resourceId':_0x2f4d54['id'],'type':_0x57b940[_0x77d9('0x32')],'sectionId':_0x57b940['id']},{})[_0x77d9('0x26')](function(){return _0xa514cc;});}else{return _0xa514cc;}})['catch'](function(_0x5ef95e){logger[_0x77d9('0x34')](_0x77d9('0x5d'),_0x5ef95e);throw _0x5ef95e;});}return _0xa514cc;})[_0x77d9('0x26')](respondWithResult(_0xac66b2,0xc9))[_0x77d9('0x52')](handleError(_0xac66b2,null));};exports[_0x77d9('0x24')]=function(_0x5e3e20,_0x1dc0f0){if(_0x5e3e20[_0x77d9('0x54')]['id']){delete _0x5e3e20['body']['id'];}return db[_0x77d9('0x37')][_0x77d9('0x51')]({'where':{'id':_0x5e3e20[_0x77d9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1dc0f0,null))[_0x77d9('0x26')](function(_0x3a77a8){if(_0x3a77a8){return db[_0x77d9('0x37')]['update'](_[_0x77d9('0x45')](_0x5e3e20[_0x77d9('0x54')],[_0x77d9('0x56'),'context',_0x77d9('0x5e'),_0x77d9('0x5f'),_0x77d9('0x60'),_0x77d9('0x61'),'alias']),{'where':{'context':_0x3a77a8['context'],'exten':_0x3a77a8[_0x77d9('0x56')]},'individualHooks':!![]})[_0x77d9('0x26')](function(_0x290fca){return _0x290fca;});}return null;})[_0x77d9('0x26')](respondWithStatusCode(_0x1dc0f0,null))['catch'](handleError(_0x1dc0f0,null));};exports[_0x77d9('0x62')]=function(_0x17d10d,_0x44e5e6){return db[_0x77d9('0x37')][_0x77d9('0x63')]({'where':{'id':_0x17d10d[_0x77d9('0x4d')]['id']}})[_0x77d9('0x26')](function(_0xd3c3d0){if(_0xd3c3d0){return db[_0x77d9('0x64')][_0x77d9('0x65')](function(_0x5307ee){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x17d10d[_0x77d9('0x4d')]['id']},'transaction':_0x5307ee})[_0x77d9('0x26')](function(){var _0x5de4a2=_[_0x77d9('0x2e')](_0x17d10d[_0x77d9('0x54')],function(_0x7dcf8b){_0x7dcf8b[_0x77d9('0x66')]=_0x17d10d[_0x77d9('0x4d')]['id'];_0x7dcf8b[_0x77d9('0x67')]=!![];return _0x7dcf8b;});var _0x588cd2=_0x17d10d[_0x77d9('0x3b')][_0x77d9('0x68')]&&_0x17d10d['query'][_0x77d9('0x68')][_0x77d9('0x69')]()==='true'?!![]:![];return _0xd3c3d0[_0x77d9('0x6a')](_0x5de4a2,_0x588cd2);})[_0x77d9('0x26')](function(_0x9d1be5){return db[_0x77d9('0x37')][_0x77d9('0x6b')](_0x9d1be5,{'transaction':_0x5307ee});});})[_0x77d9('0x26')](function(){return db[_0x77d9('0x37')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x17d10d[_0x77d9('0x4d')]['id']},'order':_0x77d9('0x6c')});});}})['then'](respondWithResult(_0x44e5e6,null))[_0x77d9('0x52')](handleError(_0x44e5e6,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index e500d75..cc27a5a 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 _0x19b7=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension'];(function(_0x3aef17,_0x1563c2){var _0x2ca07b=function(_0x45d548){while(--_0x45d548){_0x3aef17['push'](_0x3aef17['shift']());}};_0x2ca07b(++_0x1563c2);}(_0x19b7,0x179));var _0x719b=function(_0xa0996c,_0x3465fd){_0xa0996c=_0xa0996c-0x0;var _0x53db62=_0x19b7[_0xa0996c];return _0x53db62;};'use strict';var EventEmitter=require(_0x719b('0x0'));var VoiceExtension=require(_0x719b('0x1'))['db'][_0x719b('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x719b('0x3')](0x0);var events={'afterCreate':_0x719b('0x4'),'afterUpdate':_0x719b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x211797){return function(_0x22fc76,_0xe45db3,_0x50e4f9){VoiceExtensionEvents[_0x719b('0x6')](_0x211797+':'+_0x22fc76['id'],_0x22fc76);VoiceExtensionEvents[_0x719b('0x6')](_0x211797,_0x22fc76);_0x50e4f9(null);};}for(var e in events){if(events[_0x719b('0x7')](e)){var event=events[e];VoiceExtension[_0x719b('0x8')](e,emitEvent(event));}}module[_0x719b('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x5d63=['VoiceExtension','setMaxListeners','update','remove','emit','hook','../../mysqldb'];(function(_0x27d027,_0x589818){var _0x31b2dd=function(_0x15c175){while(--_0x15c175){_0x27d027['push'](_0x27d027['shift']());}};_0x31b2dd(++_0x589818);}(_0x5d63,0x92));var _0x35d6=function(_0xfa1755,_0x2c529e){_0xfa1755=_0xfa1755-0x0;var _0x3fcb00=_0x5d63[_0xfa1755];return _0x3fcb00;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x35d6('0x0'))['db'][_0x35d6('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x35d6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x35d6('0x3'),'afterDestroy':_0x35d6('0x4')};function emitEvent(_0x10da43){return function(_0xa0ac4c,_0x10ae76,_0x3d3249){VoiceExtensionEvents[_0x35d6('0x5')](_0x10da43+':'+_0xa0ac4c['id'],_0xa0ac4c);VoiceExtensionEvents[_0x35d6('0x5')](_0x10da43,_0xa0ac4c);_0x3d3249(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x35d6('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index caf5506..e455112 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 _0xb6d3=['CDR(tag)=','toLowerCase','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','outboundDial','appdata','priority','concat','catch','define','voice_extensions','last','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','outbound','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','param','phone','prefix','${EXTEN}','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','filter','tag'];(function(_0x2ca0ff,_0x4251fc){var _0x1b5cc0=function(_0x2a1300){while(--_0x2a1300){_0x2ca0ff['push'](_0x2ca0ff['shift']());}};_0x1b5cc0(++_0x4251fc);}(_0xb6d3,0x161));var _0x3b6d=function(_0xdcc3c2,_0xa52871){_0xdcc3c2=_0xdcc3c2-0x0;var _0x4862e9=_0xb6d3[_0xdcc3c2];return _0x4862e9;};'use strict';var util=require('util');var _=require(_0x3b6d('0x0'));var attributes=require(_0x3b6d('0x1'));module[_0x3b6d('0x2')]=function(_0x2a0181){var _0x3ca0ee=_0x2a0181[_0x3b6d('0x3')];function _0x2b6b82(_0x4d323f){var _0x4e2d5a=0x2;var _0x7a5ea4=[{'type':_0x4d323f[_0x3b6d('0x4')],'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x6')+_0x4d323f[_0x3b6d('0x4')],'context':_0x4d323f[_0x3b6d('0x7')],'exten':_0x4d323f[_0x3b6d('0x8')],'priority':_0x4e2d5a++,'VoiceExtensionId':_0x4d323f['id']},{'type':_0x4d323f[_0x3b6d('0x4')],'app':_0x4d323f['alias']?_0x3b6d('0x5'):_0x3b6d('0x9'),'appdata':_0x4d323f[_0x3b6d('0xa')]?_0x3b6d('0xb')+_0x4d323f['alias']:_0x3b6d('0xc'),'context':_0x4d323f[_0x3b6d('0x7')],'exten':_0x4d323f['exten'],'priority':_0x4e2d5a++,'VoiceExtensionId':_0x4d323f['id']}];if(_0x4d323f[_0x3b6d('0x4')]===_0x3b6d('0xd')){_0x7a5ea4[_0x3b6d('0xe')]({'type':_0x3b6d('0xd'),'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0xf')+_0x4d323f['id'],'context':_0x4d323f[_0x3b6d('0x7')],'exten':_0x4d323f['exten'],'priority':_0x4e2d5a++,'VoiceExtensionId':_0x4d323f['id']});}_0x7a5ea4[_0x3b6d('0xe')]({'type':_0x4d323f[_0x3b6d('0x4')],'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x10'),'context':_0x4d323f[_0x3b6d('0x7')],'exten':_0x4d323f[_0x3b6d('0x8')],'priority':_0x4e2d5a++,'VoiceExtensionId':_0x4d323f['id']},{'type':_0x4d323f[_0x3b6d('0x4')],'app':_0x3b6d('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4d323f[_0x3b6d('0x7')],'exten':_0x4d323f[_0x3b6d('0x8')],'priority':_0x4e2d5a++,'VoiceExtensionId':_0x4d323f['id']},{'type':_0x4d323f[_0x3b6d('0x4')],'app':_0x3b6d('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4d323f[_0x3b6d('0x7')],'exten':_0x4d323f[_0x3b6d('0x8')],'priority':_0x4e2d5a++,'VoiceExtensionId':_0x4d323f['id']});return _0x7a5ea4;}function _0x50024c(_0x34010a){var _0x23dfa2=0x2;var _0x1e27e8=[{'type':'outbound','app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x11'),'context':_0x34010a[_0x3b6d('0x7')],'exten':_0x34010a[_0x3b6d('0x8')],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':'outbound','app':_0x34010a['alias']?'Set':_0x3b6d('0x9'),'appdata':_0x34010a[_0x3b6d('0xa')]?'CDR(routeAlias)='+_0x34010a[_0x3b6d('0xa')]:_0x3b6d('0xc'),'context':_0x34010a['context'],'exten':_0x34010a[_0x3b6d('0x8')],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':'outbound','app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x12')+(_0x34010a[_0x3b6d('0x13')]?_0x3b6d('0x14')+_0x34010a[_0x3b6d('0x13')]+'}':'${EXTEN}'),'context':_0x34010a[_0x3b6d('0x7')],'exten':_0x34010a[_0x3b6d('0x8')],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':_0x3b6d('0x15'),'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0xf')+_0x34010a['id'],'context':_0x34010a[_0x3b6d('0x7')],'exten':_0x34010a['exten'],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':_0x3b6d('0x15'),'app':_0x3b6d('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x23dfa2+0x2)+_0x3b6d('0x17')+(_0x23dfa2+0x1)+')','context':_0x34010a[_0x3b6d('0x7')],'exten':_0x34010a[_0x3b6d('0x8')],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':_0x3b6d('0x15'),'app':_0x3b6d('0x5'),'appdata':_0x34010a[_0x3b6d('0x13')]?_0x3b6d('0x18')+_0x34010a[_0x3b6d('0x13')]+'}':_0x3b6d('0x19'),'context':_0x34010a['context'],'exten':_0x34010a[_0x3b6d('0x8')],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':_0x3b6d('0x15'),'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x10'),'context':_0x34010a[_0x3b6d('0x7')],'exten':_0x34010a['exten'],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':_0x3b6d('0x15'),'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x1a'),'context':_0x34010a[_0x3b6d('0x7')],'exten':_0x34010a['exten'],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':_0x3b6d('0x15'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x34010a['context'],'exten':_0x34010a['exten'],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':_0x3b6d('0x15'),'app':_0x3b6d('0x5'),'appdata':'outboundrouteid='+_0x34010a['id'],'context':_0x34010a[_0x3b6d('0x7')],'exten':_0x34010a[_0x3b6d('0x8')],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']}];if(_0x34010a[_0x3b6d('0x1b')](_0x3b6d('0x1c'))&&_0x34010a[_0x3b6d('0x1c')]!=='none'){_0x1e27e8[_0x3b6d('0xe')]({'type':_0x3b6d('0x15'),'app':_0x3b6d('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x34010a['context'],'exten':_0x34010a['exten'],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']},{'type':_0x3b6d('0x15'),'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x1d')+_0x34010a[_0x3b6d('0x1c')]||_0x3b6d('0x1e'),'context':_0x34010a[_0x3b6d('0x7')],'exten':_0x34010a[_0x3b6d('0x8')],'priority':_0x23dfa2++,'VoiceExtensionId':_0x34010a['id']});}return _0x1e27e8;}function _0x1680b2(_0x83293d){var _0x3674a9=[{'name':_0x3b6d('0x1f'),'param':0x0},{'name':_0x3b6d('0x20'),'param':0x1},{'name':_0x3b6d('0x21'),'param':0x2},{'name':_0x3b6d('0x22'),'param':0x3}];var _0x497007={};var _0x64830e=_0x83293d[_0x3b6d('0x23')](',');var _0x19dda5=[];for(var _0x2dffb2=0x0;_0x2dffb2<_0x3674a9[_0x3b6d('0x24')];_0x2dffb2++){switch(_0x3674a9[_0x2dffb2]['name']){case _0x3b6d('0x1f'):_0x497007[_0x3b6d('0x1f')]=_0x64830e[_0x3674a9[_0x2dffb2][_0x3b6d('0x25')]][_0x3b6d('0x23')]('/')[0x1];_0x497007[_0x3b6d('0x26')]=_0x64830e[_0x3674a9[_0x2dffb2][_0x3b6d('0x25')]][_0x3b6d('0x23')]('/')[0x2];_0x497007['prefix']=_0x497007['phone']?_0x497007[_0x3b6d('0x26')][_0x3b6d('0x23')]('$')[0x0]:undefined;_0x497007['phone']=route['cutdigits']?(_0x497007[_0x3b6d('0x27')]||'')+_0x3b6d('0x14')+route[_0x3b6d('0x13')]+'}':(_0x497007[_0x3b6d('0x27')]||'')+_0x3b6d('0x28');_0x19dda5[_0x3674a9[_0x2dffb2][_0x3b6d('0x25')]]=[_0x3b6d('0x29'),_0x497007['trunk'],_0x497007['phone']][_0x3b6d('0x2a')]('/');break;case'options':_0x497007[_0x3b6d('0x21')]=_0x64830e[_0x3674a9[_0x2dffb2][_0x3b6d('0x25')]];if(route['recordingFormat']!==_0x3b6d('0x2b')){if(_0x497007[_0x3b6d('0x21')][_0x3b6d('0x2c')]('U(xcally-mixmonitor-context)')<0x0){_0x497007[_0x3b6d('0x21')]+=_0x3b6d('0x2d');}}else{_0x497007['options']=_0x497007[_0x3b6d('0x21')][_0x3b6d('0x2e')](_0x3b6d('0x2d'),'');}_0x19dda5[_0x3674a9[_0x2dffb2][_0x3b6d('0x25')]]=_0x497007[_0x3b6d('0x21')];break;default:_0x19dda5[_0x3674a9[_0x2dffb2][_0x3b6d('0x25')]]=_0x64830e[_0x3674a9[_0x2dffb2][_0x3b6d('0x25')]];}}return _0x19dda5['join'](',');}function _0x635b14(_0x26eb47,_0x3ecba3,_0x22537b,_0x71745a){return new Promise(function(_0xdbacd4,_0x34e643){var _0x234cde=[];if(_[_0x3b6d('0x2f')](_0x3ecba3))return _0xdbacd4(_0x234cde);_0x3ca0ee[_0x3b6d('0x30')][_0x3b6d('0x31')]({'attributes':['id',_0x3b6d('0x32'),_0x3b6d('0x33')],'raw':!![]})[_0x3b6d('0x34')](function(_0x289f81){for(var _0x53327d=0x0,_0x20fb8e=0x0;_0x53327d<_0x3ecba3[_0x3b6d('0x24')];_0x53327d++,_0x20fb8e=0x0){var _0x48aafb=_0x3ecba3[_0x53327d];var _0x3f7894=[];var _0x337a9a=[];if(_0x48aafb[_0x3b6d('0x32')]!==_0x3b6d('0x35')){_0x48aafb[_0x3b6d('0x36')]=[_0x48aafb[_0x3b6d('0x32')]];}else{_0x48aafb['intervals']=_0x48aafb[_0x3b6d('0x33')]?_['map'](_[_0x3b6d('0x37')](_0x289f81,{'IntervalId':_0x48aafb[_0x3b6d('0x33')]}),_0x3b6d('0x32')):[];}_0x48aafb[_0x3b6d('0x7')]=_0x26eb47[_0x3b6d('0x7')];_0x48aafb['exten']=_0x26eb47[_0x3b6d('0x8')];if(_0x48aafb[_0x3b6d('0x4')])_0x48aafb[_0x3b6d('0x4')]=_0x48aafb[_0x3b6d('0x4')]['toLowerCase']();if(_0x26eb47[_0x3b6d('0x4')]===_0x3b6d('0x15')){if(_0x48aafb[_0x3b6d('0x1b')](_0x3b6d('0x38'))&&_0x48aafb[_0x3b6d('0x38')]&&_0x48aafb[_0x3b6d('0x38')]!=='--'){_0x3f7894[_0x3b6d('0xe')]({'type':_0x48aafb['type']['toLowerCase'](),'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x39')+_0x48aafb[_0x3b6d('0x38')],'context':_0x26eb47['context'],'exten':_0x26eb47[_0x3b6d('0x8')],'priority':_0x48aafb[_0x3b6d('0x36')][_0x3b6d('0x24')]+_0x22537b+_0x20fb8e++,'VoiceExtensionId':_0x26eb47['id']});}_0x3f7894['push']({'type':_0x48aafb['type'][_0x3b6d('0x3a')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x48aafb[_0x3b6d('0x3b')]?_0x3b6d('0x3c')+_0x48aafb[_0x3b6d('0x3b')]+')':_0x3b6d('0x3d')),'context':_0x26eb47[_0x3b6d('0x7')],'exten':_0x26eb47[_0x3b6d('0x8')],'priority':_0x48aafb[_0x3b6d('0x36')][_0x3b6d('0x24')]+_0x22537b+_0x20fb8e++,'VoiceExtensionId':_0x26eb47['id']});}else{if(_0x48aafb['hasOwnProperty'](_0x3b6d('0x3e'))){if([_0x3b6d('0x3f'),'playback'][_0x3b6d('0x40')](_0x48aafb[_0x3b6d('0x41')]['toLowerCase']())&&_0x48aafb[_0x3b6d('0x42')]!==_0x3b6d('0x43')){if(_0x48aafb[_0x3b6d('0x3e')]){_0x3f7894[_0x3b6d('0xe')]({'type':_0x48aafb[_0x3b6d('0x4')]['toLowerCase'](),'app':_0x3b6d('0x16'),'appdata':_0x3b6d('0x44'),'context':_0x26eb47['context'],'exten':_0x26eb47[_0x3b6d('0x8')],'priority':_0x48aafb[_0x3b6d('0x36')][_0x3b6d('0x24')]+_0x22537b+_0x20fb8e++,'VoiceExtensionId':_0x26eb47['id']});_0x3f7894[_0x3b6d('0xe')]({'type':_0x48aafb[_0x3b6d('0x4')][_0x3b6d('0x3a')](),'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x45'),'context':_0x26eb47[_0x3b6d('0x7')],'exten':_0x26eb47[_0x3b6d('0x8')],'priority':_0x48aafb['intervals'][_0x3b6d('0x24')]+_0x22537b+_0x20fb8e++,'VoiceExtensionId':_0x26eb47['id']});}else{_0x3f7894[_0x3b6d('0xe')]({'type':_0x48aafb['type']['toLowerCase'](),'app':_0x3b6d('0x16'),'appdata':_0x3b6d('0x46'),'context':_0x26eb47[_0x3b6d('0x7')],'exten':_0x26eb47[_0x3b6d('0x8')],'priority':_0x48aafb[_0x3b6d('0x36')]['length']+_0x22537b+_0x20fb8e++,'VoiceExtensionId':_0x26eb47['id']});_0x3f7894[_0x3b6d('0xe')]({'type':_0x48aafb[_0x3b6d('0x4')][_0x3b6d('0x3a')](),'app':_0x3b6d('0x5'),'appdata':_0x3b6d('0x47'),'context':_0x26eb47[_0x3b6d('0x7')],'exten':_0x26eb47['exten'],'priority':_0x48aafb[_0x3b6d('0x36')][_0x3b6d('0x24')]+_0x22537b+_0x20fb8e++,'VoiceExtensionId':_0x26eb47['id']});}}}}for(var _0x472a63=0x0;_0x472a63<_0x48aafb['intervals'][_0x3b6d('0x24')];_0x472a63++){var _0x41757b=_0x22537b+_0x48aafb[_0x3b6d('0x36')][_0x3b6d('0x24')];var _0x6e6595=_0x472a63===_0x48aafb['intervals'][_0x3b6d('0x24')]-0x1?_0x22537b+_0x3f7894[_0x3b6d('0x24')]+_0x337a9a[_0x3b6d('0x24')]+0x2:_0x22537b+_0x472a63+0x1;_0x3f7894['splice'](_0x472a63,0x0,{'type':_0x26eb47[_0x3b6d('0x4')],'app':'GotoIfTime','appdata':_0x48aafb[_0x3b6d('0x36')][_0x472a63]+'?'+_0x26eb47[_0x3b6d('0x7')]+_0x3b6d('0x48')+_0x41757b+':'+_0x26eb47['context']+_0x3b6d('0x48')+_0x6e6595,'exten':_0x26eb47['exten'],'context':_0x26eb47[_0x3b6d('0x7')],'priority':_0x22537b+_0x472a63,'VoiceExtensionId':_0x26eb47['id']});}if(_0x71745a&&_0x48aafb[_0x3b6d('0x42')]===_0x3b6d('0x49'))_0x48aafb[_0x3b6d('0x4a')]=_0x1680b2(_0x48aafb['appdata']);_0x48aafb['priority']=_0x3f7894[_0x3b6d('0x24')]?_['last'](_0x3f7894)[_0x3b6d('0x4b')]+0x1:_0x22537b;_0x234cde=_[_0x3b6d('0x4c')](_0x234cde,_0x3f7894,[_0x48aafb],_0x337a9a);_0x22537b=_['last'](_0x234cde)[_0x3b6d('0x4b')]+0x1;}return _0xdbacd4(_0x234cde);})[_0x3b6d('0x4d')](function(_0x372b34){_0x34e643(_0x372b34);});});}return _0x2a0181[_0x3b6d('0x4e')]('VoiceExtension',attributes,{'tableName':_0x3b6d('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x518f00,_0x287dc0){var _0x119b25=this;var _0xf95840=_0x119b25['type']===_0x3b6d('0x15')?_0x50024c(_0x119b25):_0x2b6b82(_0x119b25);return _0x635b14(_0x119b25,_0x518f00,_[_0x3b6d('0x50')](_0xf95840)[_0x3b6d('0x4b')]+0x1,_0x287dc0)[_0x3b6d('0x34')](function(_0x3f041e){var _0x41fef9=_[_0x3b6d('0x4c')](_0xf95840,_0x3f041e);_0x41fef9[_0x3b6d('0xe')]({'type':_0x119b25[_0x3b6d('0x4')],'app':_0x3b6d('0x51'),'exten':_0x119b25[_0x3b6d('0x8')],'context':_0x119b25[_0x3b6d('0x7')],'priority':_[_0x3b6d('0x50')](_0x41fef9)[_0x3b6d('0x4b')]+0x1,'VoiceExtensionId':_0x119b25['id']});return _0x41fef9;});}}});}; \ No newline at end of file +var _0x904e=['param','split','prefix','phone','SIP','join','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','then','*,*,*,*','intervals','IntervalId','filter','toLowerCase','tag','CDR(tag)=','ExecIf','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice',',${EXTEN},','outboundDial','appdata','concat','last','priority','define','VoiceExtension','voice_extensions','Hangup','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','push','inbound','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','trunk','timeout','options','url','length','name'];(function(_0x24d052,_0x584bfc){var _0x1f3f93=function(_0x620fb2){while(--_0x620fb2){_0x24d052['push'](_0x24d052['shift']());}};_0x1f3f93(++_0x584bfc);}(_0x904e,0x1a9));var _0xe904=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x904e[_0xae7c2f];return _0x5d7001;};'use strict';var util=require('util');var _=require('lodash');var attributes=require(_0xe904('0x0'));module[_0xe904('0x1')]=function(_0x454aef){var _0x170ff6=_0x454aef[_0xe904('0x2')];function _0x6fe9c5(_0x32b4e0){var _0x27a91b=0x2;var _0x10271e=[{'type':_0x32b4e0['type'],'app':_0xe904('0x3'),'appdata':_0xe904('0x4')+_0x32b4e0[_0xe904('0x5')],'context':_0x32b4e0[_0xe904('0x6')],'exten':_0x32b4e0[_0xe904('0x7')],'priority':_0x27a91b++,'VoiceExtensionId':_0x32b4e0['id']},{'type':_0x32b4e0[_0xe904('0x5')],'app':_0x32b4e0[_0xe904('0x8')]?_0xe904('0x3'):_0xe904('0x9'),'appdata':_0x32b4e0[_0xe904('0x8')]?_0xe904('0xa')+_0x32b4e0[_0xe904('0x8')]:_0xe904('0xb'),'context':_0x32b4e0[_0xe904('0x6')],'exten':_0x32b4e0[_0xe904('0x7')],'priority':_0x27a91b++,'VoiceExtensionId':_0x32b4e0['id']}];if(_0x32b4e0[_0xe904('0x5')]==='inbound'){_0x10271e[_0xe904('0xc')]({'type':_0xe904('0xd'),'app':_0xe904('0x3'),'appdata':'CDR(routeid)='+_0x32b4e0['id'],'context':_0x32b4e0['context'],'exten':_0x32b4e0[_0xe904('0x7')],'priority':_0x27a91b++,'VoiceExtensionId':_0x32b4e0['id']});}_0x10271e['push']({'type':_0x32b4e0['type'],'app':_0xe904('0x3'),'appdata':_0xe904('0xe'),'context':_0x32b4e0[_0xe904('0x6')],'exten':_0x32b4e0['exten'],'priority':_0x27a91b++,'VoiceExtensionId':_0x32b4e0['id']},{'type':_0x32b4e0[_0xe904('0x5')],'app':_0xe904('0x3'),'appdata':_0xe904('0xf'),'context':_0x32b4e0[_0xe904('0x6')],'exten':_0x32b4e0['exten'],'priority':_0x27a91b++,'VoiceExtensionId':_0x32b4e0['id']},{'type':_0x32b4e0['type'],'app':_0xe904('0x3'),'appdata':_0xe904('0x10'),'context':_0x32b4e0[_0xe904('0x6')],'exten':_0x32b4e0[_0xe904('0x7')],'priority':_0x27a91b++,'VoiceExtensionId':_0x32b4e0['id']});return _0x10271e;}function _0x1e51ee(_0x53ac3e){var _0x4b3e6d=0x2;var _0x465d76=[{'type':_0xe904('0x11'),'app':_0xe904('0x3'),'appdata':'CDR(type)=outbound','context':_0x53ac3e[_0xe904('0x6')],'exten':_0x53ac3e[_0xe904('0x7')],'priority':_0x4b3e6d++,'VoiceExtensionId':_0x53ac3e['id']},{'type':'outbound','app':_0x53ac3e[_0xe904('0x8')]?_0xe904('0x3'):_0xe904('0x9'),'appdata':_0x53ac3e[_0xe904('0x8')]?_0xe904('0xa')+_0x53ac3e[_0xe904('0x8')]:'No\x20alias\x20set','context':_0x53ac3e['context'],'exten':_0x53ac3e['exten'],'priority':_0x4b3e6d++,'VoiceExtensionId':_0x53ac3e['id']},{'type':_0xe904('0x11'),'app':_0xe904('0x3'),'appdata':_0xe904('0x12')+(_0x53ac3e[_0xe904('0x13')]?'${EXTEN:'+_0x53ac3e[_0xe904('0x13')]+'}':_0xe904('0x14')),'context':_0x53ac3e['context'],'exten':_0x53ac3e['exten'],'priority':_0x4b3e6d++,'VoiceExtensionId':_0x53ac3e['id']},{'type':_0xe904('0x11'),'app':_0xe904('0x3'),'appdata':_0xe904('0x15')+_0x53ac3e['id'],'context':_0x53ac3e[_0xe904('0x6')],'exten':_0x53ac3e['exten'],'priority':_0x4b3e6d++,'VoiceExtensionId':_0x53ac3e['id']},{'type':'outbound','app':'ExecIf','appdata':_0xe904('0x16')+(_0x4b3e6d+0x2)+_0xe904('0x17')+(_0x4b3e6d+0x1)+')','context':_0x53ac3e[_0xe904('0x6')],'exten':_0x53ac3e[_0xe904('0x7')],'priority':_0x4b3e6d++,'VoiceExtensionId':_0x53ac3e['id']},{'type':'outbound','app':'Set','appdata':_0x53ac3e[_0xe904('0x13')]?_0xe904('0x18')+_0x53ac3e[_0xe904('0x13')]+'}':_0xe904('0x19'),'context':_0x53ac3e['context'],'exten':_0x53ac3e[_0xe904('0x7')],'priority':_0x4b3e6d++,'VoiceExtensionId':_0x53ac3e['id']},{'type':_0xe904('0x11'),'app':'Set','appdata':_0xe904('0xe'),'context':_0x53ac3e[_0xe904('0x6')],'exten':_0x53ac3e[_0xe904('0x7')],'priority':_0x4b3e6d++,'VoiceExtensionId':_0x53ac3e['id']},{'type':'outbound','app':'Set','appdata':_0xe904('0xf'),'context':_0x53ac3e[_0xe904('0x6')],'exten':_0x53ac3e[_0xe904('0x7')],'priority':_0x4b3e6d++,'VoiceExtensionId':_0x53ac3e['id']},{'type':_0xe904('0x11'),'app':_0xe904('0x3'),'appdata':_0xe904('0x10'),'context':_0x53ac3e['context'],'exten':_0x53ac3e[_0xe904('0x7')],'priority':_0x4b3e6d++,'VoiceExtensionId':_0x53ac3e['id']},{'type':'outbound','app':_0xe904('0x3'),'appdata':_0xe904('0x1a')+_0x53ac3e['id'],'context':_0x53ac3e['context'],'exten':_0x53ac3e[_0xe904('0x7')],'priority':_0x4b3e6d++,'VoiceExtensionId':_0x53ac3e['id']}];if(_0x53ac3e[_0xe904('0x1b')](_0xe904('0x1c'))&&_0x53ac3e[_0xe904('0x1c')]!==_0xe904('0x1d')){_0x465d76['push']({'type':_0xe904('0x11'),'app':_0xe904('0x3'),'appdata':_0xe904('0x1e'),'context':_0x53ac3e[_0xe904('0x6')],'exten':_0x53ac3e[_0xe904('0x7')],'priority':_0x4b3e6d++,'VoiceExtensionId':_0x53ac3e['id']},{'type':_0xe904('0x11'),'app':_0xe904('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x53ac3e['recordingFormat']||'wav','context':_0x53ac3e[_0xe904('0x6')],'exten':_0x53ac3e['exten'],'priority':_0x4b3e6d++,'VoiceExtensionId':_0x53ac3e['id']});}return _0x465d76;}function _0x27a581(_0x50e508){var _0x494ce7=[{'name':_0xe904('0x1f'),'param':0x0},{'name':_0xe904('0x20'),'param':0x1},{'name':_0xe904('0x21'),'param':0x2},{'name':_0xe904('0x22'),'param':0x3}];var _0x59d514={};var _0x2bfa6d=_0x50e508['split'](',');var _0x708821=[];for(var _0x448499=0x0;_0x448499<_0x494ce7[_0xe904('0x23')];_0x448499++){switch(_0x494ce7[_0x448499][_0xe904('0x24')]){case'trunk':_0x59d514[_0xe904('0x1f')]=_0x2bfa6d[_0x494ce7[_0x448499][_0xe904('0x25')]][_0xe904('0x26')]('/')[0x1];_0x59d514['phone']=_0x2bfa6d[_0x494ce7[_0x448499]['param']]['split']('/')[0x2];_0x59d514[_0xe904('0x27')]=_0x59d514['phone']?_0x59d514[_0xe904('0x28')][_0xe904('0x26')]('$')[0x0]:undefined;_0x59d514[_0xe904('0x28')]=route['cutdigits']?(_0x59d514[_0xe904('0x27')]||'')+'${EXTEN:'+route[_0xe904('0x13')]+'}':(_0x59d514[_0xe904('0x27')]||'')+_0xe904('0x14');_0x708821[_0x494ce7[_0x448499][_0xe904('0x25')]]=[_0xe904('0x29'),_0x59d514[_0xe904('0x1f')],_0x59d514[_0xe904('0x28')]][_0xe904('0x2a')]('/');break;case _0xe904('0x21'):_0x59d514[_0xe904('0x21')]=_0x2bfa6d[_0x494ce7[_0x448499][_0xe904('0x25')]];if(route[_0xe904('0x1c')]!==_0xe904('0x1d')){if(_0x59d514['options']['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x59d514[_0xe904('0x21')]+=_0xe904('0x2b');}}else{_0x59d514[_0xe904('0x21')]=_0x59d514[_0xe904('0x21')]['replace'](_0xe904('0x2b'),'');}_0x708821[_0x494ce7[_0x448499][_0xe904('0x25')]]=_0x59d514[_0xe904('0x21')];break;default:_0x708821[_0x494ce7[_0x448499][_0xe904('0x25')]]=_0x2bfa6d[_0x494ce7[_0x448499][_0xe904('0x25')]];}}return _0x708821['join'](',');}function _0x4d02e5(_0x23f150,_0x117082,_0x365a6d,_0x378a4c){return new Promise(function(_0x4c8402,_0x38c209){var _0x8d8667=[];if(_[_0xe904('0x2c')](_0x117082))return _0x4c8402(_0x8d8667);_0x170ff6[_0xe904('0x2d')][_0xe904('0x2e')]({'attributes':['id',_0xe904('0x2f'),'IntervalId'],'raw':!![]})[_0xe904('0x30')](function(_0x18a769){for(var _0x349116=0x0,_0x2c8890=0x0;_0x349116<_0x117082[_0xe904('0x23')];_0x349116++,_0x2c8890=0x0){var _0x55c4fe=_0x117082[_0x349116];var _0x521b6e=[];var _0x355ab9=[];if(_0x55c4fe[_0xe904('0x2f')]!==_0xe904('0x31')){_0x55c4fe[_0xe904('0x32')]=[_0x55c4fe['interval']];}else{_0x55c4fe[_0xe904('0x32')]=_0x55c4fe[_0xe904('0x33')]?_['map'](_[_0xe904('0x34')](_0x18a769,{'IntervalId':_0x55c4fe['IntervalId']}),_0xe904('0x2f')):[];}_0x55c4fe[_0xe904('0x6')]=_0x23f150[_0xe904('0x6')];_0x55c4fe['exten']=_0x23f150['exten'];if(_0x55c4fe[_0xe904('0x5')])_0x55c4fe[_0xe904('0x5')]=_0x55c4fe[_0xe904('0x5')][_0xe904('0x35')]();if(_0x23f150[_0xe904('0x5')]===_0xe904('0x11')){if(_0x55c4fe[_0xe904('0x1b')](_0xe904('0x36'))&&_0x55c4fe[_0xe904('0x36')]&&_0x55c4fe[_0xe904('0x36')]!=='--'){_0x521b6e[_0xe904('0xc')]({'type':_0x55c4fe[_0xe904('0x5')][_0xe904('0x35')](),'app':_0xe904('0x3'),'appdata':_0xe904('0x37')+_0x55c4fe[_0xe904('0x36')],'context':_0x23f150[_0xe904('0x6')],'exten':_0x23f150[_0xe904('0x7')],'priority':_0x55c4fe[_0xe904('0x32')][_0xe904('0x23')]+_0x365a6d+_0x2c8890++,'VoiceExtensionId':_0x23f150['id']});}_0x521b6e[_0xe904('0xc')]({'type':_0x55c4fe['type'][_0xe904('0x35')](),'app':_0xe904('0x38'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x55c4fe[_0xe904('0x39')]?_0xe904('0x3a')+_0x55c4fe[_0xe904('0x39')]+')':'NoOp(No\x20number\x20available)'),'context':_0x23f150[_0xe904('0x6')],'exten':_0x23f150[_0xe904('0x7')],'priority':_0x55c4fe[_0xe904('0x32')][_0xe904('0x23')]+_0x365a6d+_0x2c8890++,'VoiceExtensionId':_0x23f150['id']});}else{if(_0x55c4fe[_0xe904('0x1b')](_0xe904('0x3b'))){if([_0xe904('0x3c'),_0xe904('0x3d')][_0xe904('0x3e')](_0x55c4fe['app']['toLowerCase']())&&_0x55c4fe[_0xe904('0x3f')]!=='custom'){if(_0x55c4fe[_0xe904('0x3b')]){_0x521b6e[_0xe904('0xc')]({'type':_0x55c4fe['type'][_0xe904('0x35')](),'app':_0xe904('0x38'),'appdata':_0xe904('0x40'),'context':_0x23f150[_0xe904('0x6')],'exten':_0x23f150['exten'],'priority':_0x55c4fe[_0xe904('0x32')][_0xe904('0x23')]+_0x365a6d+_0x2c8890++,'VoiceExtensionId':_0x23f150['id']});_0x521b6e[_0xe904('0xc')]({'type':_0x55c4fe['type'][_0xe904('0x35')](),'app':_0xe904('0x3'),'appdata':_0xe904('0x41'),'context':_0x23f150[_0xe904('0x6')],'exten':_0x23f150[_0xe904('0x7')],'priority':_0x55c4fe[_0xe904('0x32')][_0xe904('0x23')]+_0x365a6d+_0x2c8890++,'VoiceExtensionId':_0x23f150['id']});}else{_0x521b6e[_0xe904('0xc')]({'type':_0x55c4fe[_0xe904('0x5')][_0xe904('0x35')](),'app':_0xe904('0x38'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x23f150[_0xe904('0x6')],'exten':_0x23f150[_0xe904('0x7')],'priority':_0x55c4fe[_0xe904('0x32')]['length']+_0x365a6d+_0x2c8890++,'VoiceExtensionId':_0x23f150['id']});_0x521b6e[_0xe904('0xc')]({'type':_0x55c4fe['type']['toLowerCase'](),'app':_0xe904('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x23f150[_0xe904('0x6')],'exten':_0x23f150['exten'],'priority':_0x55c4fe['intervals'][_0xe904('0x23')]+_0x365a6d+_0x2c8890++,'VoiceExtensionId':_0x23f150['id']});}}}}for(var _0x40680f=0x0;_0x40680f<_0x55c4fe[_0xe904('0x32')][_0xe904('0x23')];_0x40680f++){var _0x26262c=_0x365a6d+_0x55c4fe['intervals'][_0xe904('0x23')];var _0x2e17d6=_0x40680f===_0x55c4fe['intervals']['length']-0x1?_0x365a6d+_0x521b6e[_0xe904('0x23')]+_0x355ab9[_0xe904('0x23')]+0x2:_0x365a6d+_0x40680f+0x1;_0x521b6e[_0xe904('0x42')](_0x40680f,0x0,{'type':_0x23f150[_0xe904('0x5')],'app':'GotoIfTime','appdata':_0x55c4fe[_0xe904('0x32')][_0x40680f]+'?'+_0x23f150[_0xe904('0x6')]+',${EXTEN},'+_0x26262c+':'+_0x23f150['context']+_0xe904('0x43')+_0x2e17d6,'exten':_0x23f150[_0xe904('0x7')],'context':_0x23f150[_0xe904('0x6')],'priority':_0x365a6d+_0x40680f,'VoiceExtensionId':_0x23f150['id']});}if(_0x378a4c&&_0x55c4fe[_0xe904('0x3f')]===_0xe904('0x44'))_0x55c4fe[_0xe904('0x45')]=_0x27a581(_0x55c4fe['appdata']);_0x55c4fe['priority']=_0x521b6e['length']?_['last'](_0x521b6e)['priority']+0x1:_0x365a6d;_0x8d8667=_[_0xe904('0x46')](_0x8d8667,_0x521b6e,[_0x55c4fe],_0x355ab9);_0x365a6d=_[_0xe904('0x47')](_0x8d8667)[_0xe904('0x48')]+0x1;}return _0x4c8402(_0x8d8667);})['catch'](function(_0x1885ef){_0x38c209(_0x1885ef);});});}return _0x454aef[_0xe904('0x49')](_0xe904('0x4a'),attributes,{'tableName':_0xe904('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3bebc5,_0xe0f983){var _0x567d05=this;var _0x22e481=_0x567d05[_0xe904('0x5')]===_0xe904('0x11')?_0x1e51ee(_0x567d05):_0x6fe9c5(_0x567d05);return _0x4d02e5(_0x567d05,_0x3bebc5,_[_0xe904('0x47')](_0x22e481)[_0xe904('0x48')]+0x1,_0xe0f983)[_0xe904('0x30')](function(_0x5f5d12){var _0x497b27=_[_0xe904('0x46')](_0x22e481,_0x5f5d12);_0x497b27['push']({'type':_0x567d05['type'],'app':_0xe904('0x4c'),'exten':_0x567d05[_0xe904('0x7')],'context':_0x567d05['context'],'priority':_['last'](_0x497b27)[_0xe904('0x48')]+0x1,'VoiceExtensionId':_0x567d05['id']});return _0x497b27;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 689f8a2..feaa090 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 _0x80c3=['error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','redis','defaults','socket.io-emitter','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x80c3,0x18f));var _0x380c=function(_0x4ca6a4,_0x5e9694){_0x4ca6a4=_0x4ca6a4-0x0;var _0x120555=_0x80c3[_0x4ca6a4];return _0x120555;};'use strict';var _=require(_0x380c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x380c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x380c('0x2'));var db=require(_0x380c('0x3'))['db'];var utils=require(_0x380c('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x380c('0x5'));var client=jayson['client']['http']({'port':0x232a});config[_0x380c('0x6')]=_[_0x380c('0x7')](config[_0x380c('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x380c('0x8'))(new Redis(config[_0x380c('0x6')]));require('./voiceExtension.socket')[_0x380c('0x9')](socket);function respondWithRpcPromise(_0x1d5493,_0x50be52,_0x58886c){return new BPromise(function(_0x3a1ebb,_0x35f424){return client['request'](_0x1d5493,_0x58886c)[_0x380c('0xa')](function(_0x41fbf2){logger[_0x380c('0xb')](_0x380c('0xc'),_0x50be52,_0x380c('0xd'));logger[_0x380c('0xe')](_0x380c('0xf'),_0x50be52,_0x380c('0xd'),JSON[_0x380c('0x10')](_0x41fbf2));if(_0x41fbf2[_0x380c('0x11')]){if(_0x41fbf2['error'][_0x380c('0x12')]===0x1f4){logger[_0x380c('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x50be52,_0x41fbf2[_0x380c('0x11')][_0x380c('0x13')]);return _0x35f424(_0x41fbf2[_0x380c('0x11')][_0x380c('0x13')]);}logger[_0x380c('0x11')](_0x380c('0xc'),_0x50be52,_0x41fbf2[_0x380c('0x11')][_0x380c('0x13')]);return _0x3a1ebb(_0x41fbf2[_0x380c('0x11')]['message']);}else{logger[_0x380c('0xb')]('VoiceExtension,\x20%s,\x20%s',_0x50be52,'request\x20sent');_0x3a1ebb(_0x41fbf2[_0x380c('0x14')]['message']);}})['catch'](function(_0x4901fe){logger['error'](_0x380c('0xc'),_0x50be52,_0x4901fe);_0x35f424(_0x4901fe);});});}exports[_0x380c('0x15')]=function(_0x1689b3){var _0x10c9ee=this;return new Promise(function(_0x92ea5f,_0x4086c2){return db[_0x380c('0x16')][_0x380c('0x17')]({'raw':_0x1689b3[_0x380c('0x18')]?_0x1689b3[_0x380c('0x18')][_0x380c('0x19')]===undefined?!![]:![]:!![],'where':_0x1689b3[_0x380c('0x18')]?_0x1689b3[_0x380c('0x18')][_0x380c('0x1a')]||null:null,'attributes':_0x1689b3[_0x380c('0x18')]?_0x1689b3[_0x380c('0x18')][_0x380c('0x1b')]||null:null,'limit':_0x1689b3[_0x380c('0x18')]?_0x1689b3[_0x380c('0x18')][_0x380c('0x1c')]||null:null,'include':_0x1689b3[_0x380c('0x18')]?_0x1689b3['options'][_0x380c('0x1d')]?_['map'](_0x1689b3[_0x380c('0x18')]['include'],function(_0x2f2e98){return{'model':db[_0x2f2e98['model']],'as':_0x2f2e98['as'],'attributes':_0x2f2e98['attributes'],'include':_0x2f2e98[_0x380c('0x1d')]?_[_0x380c('0x1e')](_0x2f2e98['include'],function(_0x24d551){return{'model':db[_0x24d551[_0x380c('0x1f')]],'as':_0x24d551['as'],'attributes':_0x24d551[_0x380c('0x1b')],'include':_0x24d551[_0x380c('0x1d')]?_[_0x380c('0x1e')](_0x24d551[_0x380c('0x1d')],function(_0x229840){return{'model':db[_0x229840[_0x380c('0x1f')]],'as':_0x229840['as'],'attributes':_0x229840['attributes']};}):[]};}):[]};}):[]:[]})[_0x380c('0xa')](function(_0x3a32f9){logger[_0x380c('0xb')](_0x380c('0x15'),_0x1689b3);logger[_0x380c('0xe')]('GetVoiceExtension',_0x1689b3,JSON['stringify'](_0x3a32f9));_0x92ea5f(_0x3a32f9);})['catch'](function(_0x339774){logger['error'](_0x380c('0x15'),_0x339774[_0x380c('0x13')],_0x1689b3);_0x4086c2(_0x10c9ee['error'](0x1f4,_0x339774[_0x380c('0x13')]));});});}; \ No newline at end of file +var _0x8375=['GetVoiceExtension','findAll','options','limit','map','include','model','attributes','then','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch'];(function(_0x2dda5a,_0x57ff09){var _0x21323b=function(_0x75eae3){while(--_0x75eae3){_0x2dda5a['push'](_0x2dda5a['shift']());}};_0x21323b(++_0x57ff09);}(_0x8375,0x132));var _0x5837=function(_0x21eb6e,_0x77afef){_0x21eb6e=_0x21eb6e-0x0;var _0x4c70b0=_0x8375[_0x21eb6e];return _0x4c70b0;};'use strict';var _=require('lodash');var util=require(_0x5837('0x0'));var moment=require(_0x5837('0x1'));var BPromise=require(_0x5837('0x2'));var rs=require(_0x5837('0x3'));var fs=require('fs');var Redis=require(_0x5837('0x4'));var db=require(_0x5837('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5837('0x6'))(_0x5837('0x7'));var config=require('../../config/environment');var jayson=require(_0x5837('0x8'));var client=jayson[_0x5837('0x9')][_0x5837('0xa')]({'port':0x232a});config[_0x5837('0xb')]=_['defaults'](config[_0x5837('0xb')],{'host':_0x5837('0xc'),'port':0x18eb});var socket=require(_0x5837('0xd'))(new Redis(config[_0x5837('0xb')]));require(_0x5837('0xe'))[_0x5837('0xf')](socket);function respondWithRpcPromise(_0x1bde71,_0x3f16c1,_0x2ce163){return new BPromise(function(_0x4f2b93,_0x4051b5){return client[_0x5837('0x10')](_0x1bde71,_0x2ce163)['then'](function(_0x102203){logger[_0x5837('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x3f16c1,_0x5837('0x12'));logger['debug'](_0x5837('0x13'),_0x3f16c1,_0x5837('0x12'),JSON[_0x5837('0x14')](_0x102203));if(_0x102203[_0x5837('0x15')]){if(_0x102203['error'][_0x5837('0x16')]===0x1f4){logger[_0x5837('0x15')](_0x5837('0x17'),_0x3f16c1,_0x102203['error'][_0x5837('0x18')]);return _0x4051b5(_0x102203[_0x5837('0x15')][_0x5837('0x18')]);}logger[_0x5837('0x15')](_0x5837('0x17'),_0x3f16c1,_0x102203[_0x5837('0x15')]['message']);return _0x4f2b93(_0x102203['error']['message']);}else{logger[_0x5837('0x11')](_0x5837('0x17'),_0x3f16c1,_0x5837('0x12'));_0x4f2b93(_0x102203[_0x5837('0x19')][_0x5837('0x18')]);}})[_0x5837('0x1a')](function(_0x2b87fb){logger['error'](_0x5837('0x17'),_0x3f16c1,_0x2b87fb);_0x4051b5(_0x2b87fb);});});}exports[_0x5837('0x1b')]=function(_0x295ae3){var _0x30c6f6=this;return new Promise(function(_0x387809,_0x50c42c){return db['VoiceExtension'][_0x5837('0x1c')]({'raw':_0x295ae3[_0x5837('0x1d')]?_0x295ae3[_0x5837('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x295ae3[_0x5837('0x1d')]?_0x295ae3[_0x5837('0x1d')]['where']||null:null,'attributes':_0x295ae3[_0x5837('0x1d')]?_0x295ae3[_0x5837('0x1d')]['attributes']||null:null,'limit':_0x295ae3[_0x5837('0x1d')]?_0x295ae3[_0x5837('0x1d')][_0x5837('0x1e')]||null:null,'include':_0x295ae3['options']?_0x295ae3[_0x5837('0x1d')]['include']?_[_0x5837('0x1f')](_0x295ae3[_0x5837('0x1d')][_0x5837('0x20')],function(_0x3f96b1){return{'model':db[_0x3f96b1[_0x5837('0x21')]],'as':_0x3f96b1['as'],'attributes':_0x3f96b1[_0x5837('0x22')],'include':_0x3f96b1[_0x5837('0x20')]?_[_0x5837('0x1f')](_0x3f96b1[_0x5837('0x20')],function(_0x192883){return{'model':db[_0x192883[_0x5837('0x21')]],'as':_0x192883['as'],'attributes':_0x192883[_0x5837('0x22')],'include':_0x192883[_0x5837('0x20')]?_[_0x5837('0x1f')](_0x192883[_0x5837('0x20')],function(_0x5c17dd){return{'model':db[_0x5c17dd[_0x5837('0x21')]],'as':_0x5c17dd['as'],'attributes':_0x5c17dd[_0x5837('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5837('0x23')](function(_0x430bd1){logger[_0x5837('0x11')](_0x5837('0x1b'),_0x295ae3);logger[_0x5837('0x24')]('GetVoiceExtension',_0x295ae3,JSON[_0x5837('0x14')](_0x430bd1));_0x387809(_0x430bd1);})[_0x5837('0x1a')](function(_0x3a3a34){logger[_0x5837('0x15')]('GetVoiceExtension',_0x3a3a34['message'],_0x295ae3);_0x50c42c(_0x30c6f6[_0x5837('0x15')](0x1f4,_0x3a3a34[_0x5837('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 4ddb33b..e82b8d6 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 _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x406fe8,_0x4981d2){var _0x489ea4=function(_0x4c8e30){while(--_0x4c8e30){_0x406fe8['push'](_0x406fe8['shift']());}};_0x489ea4(++_0x4981d2);}(_0xe14b,0x93));var _0xbe14=function(_0x545a07,_0x24d669){_0x545a07=_0x545a07-0x0;var _0x436dd2=_0xe14b[_0x545a07];return _0x436dd2;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x3581e1,_0xe4e08d){var _0x1a8935=function(_0x5a1865){while(--_0x5a1865){_0x3581e1['push'](_0x3581e1['shift']());}};_0x1a8935(++_0xe4e08d);}(_0x5fab,0x177));var _0xb5fa=function(_0x263f9d,_0x3d854e){_0x263f9d=_0x263f9d-0x0;var _0x4c4efa=_0x5fab[_0x263f9d];return _0x4c4efa;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 60f19ad..a7307ad 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 _0xbff5=['fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x149f32,_0x4273f7){var _0x11f475=function(_0x18eeef){while(--_0x18eeef){_0x149f32['push'](_0x149f32['shift']());}};_0x11f475(++_0x4273f7);}(_0xbff5,0x1bc));var _0x5bff=function(_0x13ef76,_0x59e898){_0x13ef76=_0x13ef76-0x0;var _0x4fbc52=_0xbff5[_0x13ef76];return _0x4fbc52;};'use strict';var multer=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var path=require(_0x5bff('0x2'));var timeout=require(_0x5bff('0x3'));var express=require(_0x5bff('0x4'));var router=express[_0x5bff('0x5')]();var fs_extra=require(_0x5bff('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5bff('0x7'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x5bff('0x8')]('/',auth[_0x5bff('0x9')](),controller[_0x5bff('0xa')]);router[_0x5bff('0x8')](_0x5bff('0xb'),auth[_0x5bff('0x9')](),controller[_0x5bff('0xc')]);router[_0x5bff('0x8')](_0x5bff('0xd'),auth['isAuthenticated'](),controller[_0x5bff('0xe')]);router['post']('/',auth[_0x5bff('0x9')](),controller[_0x5bff('0xf')]);router['put'](_0x5bff('0xb'),auth['isAuthenticated'](),controller[_0x5bff('0x10')]);router['delete'](_0x5bff('0xb'),auth[_0x5bff('0x9')](),controller['destroy']);module[_0x5bff('0x11')]=router; \ No newline at end of file +var _0x6a55=['isAuthenticated','index','/:id','show','getMessages','post','create','put','update','destroy','exports','multer','express','../../components/auth/service','../../config/environment','get'];(function(_0x4cc1c1,_0x3ad908){var _0x483778=function(_0x358fc5){while(--_0x358fc5){_0x4cc1c1['push'](_0x4cc1c1['shift']());}};_0x483778(++_0x3ad908);}(_0x6a55,0xdb));var _0x56a5=function(_0xb98d8d,_0x481423){_0xb98d8d=_0xb98d8d-0x0;var _0x489b15=_0x6a55[_0xb98d8d];return _0x489b15;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56a5('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x56a5('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x56a5('0x3'));var controller=require('./voiceMail.controller');router[_0x56a5('0x4')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x6')]);router[_0x56a5('0x4')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x8')]);router[_0x56a5('0x4')]('/:id/messages',auth[_0x56a5('0x5')](),controller[_0x56a5('0x9')]);router[_0x56a5('0xa')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0xb')]);router[_0x56a5('0xc')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xd')]);router['delete']('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0xe')]);module[_0x56a5('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index d77a685..7255261 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 _0x3c08=['sequelize','STRING','from-voicemail','contest_mailbox','trim','central','yes','ENUM','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','mailbox'];(function(_0x34147b,_0x5e296c){var _0x2242fb=function(_0x121e97){while(--_0x121e97){_0x34147b['push'](_0x34147b['shift']());}};_0x2242fb(++_0x5e296c);}(_0x3c08,0xf7));var _0x83c0=function(_0x4432e0,_0x5b332d){_0x4432e0=_0x4432e0-0x0;var _0x29e13f=_0x3c08[_0x4432e0];return _0x29e13f;};'use strict';var Sequelize=require(_0x83c0('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x83c0('0x1')]},'context':{'type':Sequelize[_0x83c0('0x1')],'defaultValue':_0x83c0('0x2'),'unique':_0x83c0('0x3')},'mailbox':{'type':Sequelize[_0x83c0('0x1')],'defaultValue':'','allowNull':![],'unique':_0x83c0('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x83c0('0x1')],'validate':{'isEmail':!![]},'set':function(_0x3ea626){this['setDataValue']('email',typeof _0x3ea626==='string'&&_0x3ea626[_0x83c0('0x4')]()?_0x3ea626[_0x83c0('0x4')]():null);}},'pager':{'type':Sequelize[_0x83c0('0x1')]},'tz':{'type':Sequelize[_0x83c0('0x1')],'defaultValue':_0x83c0('0x5')},'attach':{'type':Sequelize['ENUM'](_0x83c0('0x6'),'no'),'defaultValue':_0x83c0('0x6'),'allowNull':![]},'saycid':{'type':Sequelize[_0x83c0('0x7')](_0x83c0('0x6'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x83c0('0x1')]},'callback':{'type':Sequelize[_0x83c0('0x1')]},'review':{'type':Sequelize['ENUM'](_0x83c0('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x83c0('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x83c0('0x6'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x83c0('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x83c0('0x7')](_0x83c0('0x6'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x83c0('0x7')](_0x83c0('0x6'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x83c0('0x7')](_0x83c0('0x6'),'no'),'defaultValue':_0x83c0('0x6'),'allowNull':![]},'forcename':{'type':Sequelize[_0x83c0('0x7')](_0x83c0('0x6'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x83c0('0x7')](_0x83c0('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x83c0('0x7')]('yes','no'),'defaultValue':_0x83c0('0x6'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x83c0('0x1')]},'emailbody':{'type':Sequelize[_0x83c0('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x83c0('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x83c0('0xa')],'get':function(){return this[_0x83c0('0xb')]('fullname')+'\x20-\x20'+this['getDataValue'](_0x83c0('0xc'));}}}; \ No newline at end of file +var _0xc8c4=['STRING','from-voicemail','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','fullname','\x20-\x20','mailbox','sequelize','exports'];(function(_0x3da612,_0x332456){var _0x1a9d1d=function(_0x5ca0d0){while(--_0x5ca0d0){_0x3da612['push'](_0x3da612['shift']());}};_0x1a9d1d(++_0x332456);}(_0xc8c4,0x12e));var _0x4c8c=function(_0x4c180d,_0x58a7d8){_0x4c180d=_0x4c180d-0x0;var _0x2c3060=_0xc8c4[_0x4c180d];return _0x2c3060;};'use strict';var Sequelize=require(_0x4c8c('0x0'));module[_0x4c8c('0x1')]={'customer_id':{'type':Sequelize[_0x4c8c('0x2')]},'context':{'type':Sequelize[_0x4c8c('0x2')],'defaultValue':_0x4c8c('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x4c8c('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x4c8c('0x2')]},'fullname':{'type':Sequelize[_0x4c8c('0x2')]},'email':{'type':Sequelize[_0x4c8c('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3184d0){this[_0x4c8c('0x4')]('email',typeof _0x3184d0===_0x4c8c('0x5')&&_0x3184d0[_0x4c8c('0x6')]()?_0x3184d0[_0x4c8c('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x4c8c('0x7')},'attach':{'type':Sequelize[_0x4c8c('0x8')](_0x4c8c('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x4c8c('0x9'),'no'),'defaultValue':_0x4c8c('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x4c8c('0x2')]},'callback':{'type':Sequelize[_0x4c8c('0x2')]},'review':{'type':Sequelize[_0x4c8c('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x4c8c('0x8')](_0x4c8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x4c8c('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4c8c('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4c8c('0x8')](_0x4c8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4c8c('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4c8c('0x8')]('yes','no'),'defaultValue':_0x4c8c('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x4c8c('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4c8c('0x8')](_0x4c8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4c8c('0x8')]('yes','no'),'defaultValue':_0x4c8c('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x4c8c('0x2')]},'emailbody':{'type':Sequelize[_0x4c8c('0x2')]},'maxsecs':{'type':Sequelize[_0x4c8c('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4c8c('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4c8c('0xc')],'get':function(){return this['getDataValue'](_0x4c8c('0xd'))+_0x4c8c('0xe')+this['getDataValue'](_0x4c8c('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 1c00faf..fbff82a 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 _0xe605=['count','set','Content-Range','apply','save','update','then','destroy','Voicemails','UserProfileResource','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceMail','findAll','rows','show','params','intersection','find','catch','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x26d51f,_0x1de895){var _0x48305d=function(_0x13652a){while(--_0x13652a){_0x26d51f['push'](_0x26d51f['shift']());}};_0x48305d(++_0x1de895);}(_0xe605,0x92));var _0x5e60=function(_0x1676bf,_0x1e1a91){_0x1676bf=_0x1676bf-0x0;var _0x146ff4=_0xe605[_0x1676bf];return _0x146ff4;};'use strict';var emlformat=require(_0x5e60('0x0'));var rimraf=require(_0x5e60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e60('0x2'));var rp=require(_0x5e60('0x3'));var moment=require(_0x5e60('0x4'));var BPromise=require(_0x5e60('0x5'));var Mustache=require(_0x5e60('0x6'));var util=require(_0x5e60('0x7'));var path=require(_0x5e60('0x8'));var sox=require(_0x5e60('0x9'));var csv=require(_0x5e60('0xa'));var ejs=require(_0x5e60('0xb'));var fs=require('fs');var fs_extra=require(_0x5e60('0xc'));var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require(_0x5e60('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x371df7,_0x178782){_0x178782=_0x178782||0xcc;return function(_0x1f4e14){if(_0x1f4e14){return _0x371df7[_0x5e60('0x19')](_0x178782);}return _0x371df7[_0x5e60('0x1a')](_0x178782)[_0x5e60('0x1b')]();};}function respondWithResult(_0x4fd10e,_0x209adb){_0x209adb=_0x209adb||0xc8;return function(_0x45304f){if(_0x45304f){return _0x4fd10e[_0x5e60('0x1a')](_0x209adb)[_0x5e60('0x1c')](_0x45304f);}};}function respondWithFilteredResult(_0x5b028f,_0x20af5f){return function(_0x529ffe){if(_0x529ffe){var _0x1ffd77=typeof _0x20af5f[_0x5e60('0x1d')]==='undefined'&&typeof _0x20af5f[_0x5e60('0x1e')]===_0x5e60('0x1f');var _0xaa7d05=_0x529ffe[_0x5e60('0x20')];var _0x5c485d=_0x1ffd77?0x0:_0x20af5f[_0x5e60('0x1d')];var _0x22d718=_0x1ffd77?_0x529ffe['count']:_0x20af5f[_0x5e60('0x1d')]+_0x20af5f[_0x5e60('0x1e')];var _0x17c630;if(_0x22d718>=_0xaa7d05){_0x22d718=_0xaa7d05;_0x17c630=0xc8;}else{_0x17c630=0xce;}_0x5b028f[_0x5e60('0x1a')](_0x17c630);return _0x5b028f[_0x5e60('0x21')](_0x5e60('0x22'),_0x5c485d+'-'+_0x22d718+'/'+_0xaa7d05)[_0x5e60('0x1c')](_0x529ffe);}return null;};}function patchUpdates(_0x524c93){return function(_0x3282e4){try{jsonpatch[_0x5e60('0x23')](_0x3282e4,_0x524c93,!![]);}catch(_0x228f13){return BPromise['reject'](_0x228f13);}return _0x3282e4[_0x5e60('0x24')]();};}function saveUpdates(_0x5d77dd,_0x376069){return function(_0x1a44e5){if(_0x1a44e5){return _0x1a44e5[_0x5e60('0x25')](_0x5d77dd)[_0x5e60('0x26')](function(_0x34e98d){return _0x34e98d;});}return null;};}function removeEntity(_0x2a499e,_0x2636f1){return function(_0x5d2c03){if(_0x5d2c03){return _0x5d2c03[_0x5e60('0x27')]()[_0x5e60('0x26')](function(){var _0x19f37b=_0x5d2c03['get']({'plain':!![]});var _0x45cb62=_0x5e60('0x28');return db[_0x5e60('0x29')][_0x5e60('0x27')]({'where':{'type':_0x45cb62,'resourceId':_0x19f37b['id']}})['then'](function(){return _0x5d2c03;});})[_0x5e60('0x26')](function(){_0x2a499e['status'](0xcc)[_0x5e60('0x1b')]();});}};}function handleEntityNotFound(_0x221322,_0x4ba727){return function(_0x46691f){if(!_0x46691f){_0x221322[_0x5e60('0x19')](0x194);}return _0x46691f;};}function handleError(_0x5b1b46,_0x1ee931){_0x1ee931=_0x1ee931||0x1f4;return function(_0xac9c7a){logger['error'](_0xac9c7a['stack']);if(_0xac9c7a['name']){delete _0xac9c7a[_0x5e60('0x2a')];}_0x5b1b46[_0x5e60('0x1a')](_0x1ee931)[_0x5e60('0x2b')](_0xac9c7a);};}exports[_0x5e60('0x2c')]=function(_0x3ccfee,_0x558197){var _0x168ce6={},_0x405461={},_0x4d4b55={'count':0x0,'rows':[]};var _0x11fc87=_['map'](db['VoiceMail'][_0x5e60('0x2d')],function(_0x3c4340){return{'name':_0x3c4340[_0x5e60('0x2e')],'type':_0x3c4340[_0x5e60('0x2f')][_0x5e60('0x30')]};});_0x405461[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x11fc87,_0x5e60('0x2a'));_0x405461[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x3ccfee['query']);_0x405461[_0x5e60('0x35')]=_['intersection'](_0x405461['model'],_0x405461[_0x5e60('0x33')]);_0x168ce6[_0x5e60('0x36')]=_['intersection'](_0x405461[_0x5e60('0x31')],qs['fields'](_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x37')]));_0x168ce6[_0x5e60('0x36')]=_0x168ce6[_0x5e60('0x36')][_0x5e60('0x38')]?_0x168ce6[_0x5e60('0x36')]:_0x405461[_0x5e60('0x31')];if(!_0x3ccfee[_0x5e60('0x33')]['hasOwnProperty'](_0x5e60('0x39'))){_0x168ce6[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x1e')]);_0x168ce6[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x3ccfee['query'][_0x5e60('0x1d')]);}_0x168ce6[_0x5e60('0x3a')]=qs['sort'](_0x3ccfee['query'][_0x5e60('0x3b')]);_0x168ce6[_0x5e60('0x3c')]=qs[_0x5e60('0x35')](_[_0x5e60('0x3d')](_0x3ccfee[_0x5e60('0x33')],_0x405461['filters']),_0x11fc87);if(_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x3e')]){_0x168ce6[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x168ce6[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x32')](_0x11fc87,function(_0x2b635a){if(_0x2b635a['type']!==_0x5e60('0x40')){var _0x1f95b2={};_0x1f95b2[_0x2b635a['name']]={'$like':'%'+_0x3ccfee['query']['filter']+'%'};return _0x1f95b2;}})});}_0x168ce6=_[_0x5e60('0x3f')]({},_0x168ce6,_0x3ccfee[_0x5e60('0x41')]);var _0x2c6d5b={'where':_0x168ce6[_0x5e60('0x3c')]};return db['VoiceMail'][_0x5e60('0x20')](_0x2c6d5b)[_0x5e60('0x26')](function(_0x4b6192){_0x4d4b55['count']=_0x4b6192;if(_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x42')]){_0x168ce6[_0x5e60('0x43')]=[{'all':!![]}];}return db[_0x5e60('0x44')][_0x5e60('0x45')](_0x168ce6);})[_0x5e60('0x26')](function(_0x2522d2){_0x4d4b55[_0x5e60('0x46')]=_0x2522d2;return _0x4d4b55;})[_0x5e60('0x26')](respondWithFilteredResult(_0x558197,_0x168ce6))['catch'](handleError(_0x558197,null));};exports[_0x5e60('0x47')]=function(_0x2bb154,_0x59a2eb){var _0x1b1567={'raw':!![],'where':{'id':_0x2bb154[_0x5e60('0x48')]['id']}},_0x4aac07={};_0x4aac07[_0x5e60('0x31')]=_[_0x5e60('0x34')](db['VoiceMail'][_0x5e60('0x2d')]);_0x4aac07[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x2bb154[_0x5e60('0x33')]);_0x4aac07['filters']=_['intersection'](_0x4aac07['model'],_0x4aac07[_0x5e60('0x33')]);_0x1b1567[_0x5e60('0x36')]=_[_0x5e60('0x49')](_0x4aac07[_0x5e60('0x31')],qs[_0x5e60('0x37')](_0x2bb154[_0x5e60('0x33')]['fields']));_0x1b1567[_0x5e60('0x36')]=_0x1b1567[_0x5e60('0x36')][_0x5e60('0x38')]?_0x1b1567[_0x5e60('0x36')]:_0x4aac07[_0x5e60('0x31')];if(_0x2bb154[_0x5e60('0x33')][_0x5e60('0x42')]){_0x1b1567['include']=[{'all':!![]}];}_0x1b1567=_[_0x5e60('0x3f')]({},_0x1b1567,_0x2bb154[_0x5e60('0x41')]);return db[_0x5e60('0x44')][_0x5e60('0x4a')](_0x1b1567)[_0x5e60('0x26')](handleEntityNotFound(_0x59a2eb,null))[_0x5e60('0x26')](respondWithResult(_0x59a2eb,null))[_0x5e60('0x4b')](handleError(_0x59a2eb,null));};exports[_0x5e60('0x4c')]=function(_0x1518bd,_0x350d6d){return db[_0x5e60('0x44')][_0x5e60('0x4c')](_0x1518bd[_0x5e60('0x4d')],{})[_0x5e60('0x26')](function(_0x1aa381){var _0x176ef3=_0x1518bd[_0x5e60('0x4e')][_0x5e60('0x4f')]({'plain':!![]});if(!_0x176ef3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x176ef3['role']===_0x5e60('0x4e')){var _0x4d3588=_0x1aa381[_0x5e60('0x4f')]({'plain':!![]});var _0x1d247e=_0x5e60('0x28');return db[_0x5e60('0x50')][_0x5e60('0x4a')]({'where':{'name':_0x1d247e,'userProfileId':_0x176ef3[_0x5e60('0x51')]},'raw':!![]})['then'](function(_0x48bea6){if(_0x48bea6&&_0x48bea6[_0x5e60('0x52')]===0x0){return db[_0x5e60('0x29')][_0x5e60('0x4c')]({'name':_0x4d3588['name'],'resourceId':_0x4d3588['id'],'type':_0x48bea6['name'],'sectionId':_0x48bea6['id']},{})[_0x5e60('0x26')](function(){return _0x1aa381;});}else{return _0x1aa381;}})[_0x5e60('0x4b')](function(_0x179cc6){logger['error'](_0x5e60('0x53'),_0x179cc6);throw _0x179cc6;});}return _0x1aa381;})[_0x5e60('0x26')](respondWithResult(_0x350d6d,0xc9))[_0x5e60('0x4b')](handleError(_0x350d6d,null));};exports[_0x5e60('0x25')]=function(_0x17d002,_0x148204){if(_0x17d002['body']['id']){delete _0x17d002[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x44')]['find']({'where':{'id':_0x17d002[_0x5e60('0x48')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x148204,null))[_0x5e60('0x26')](saveUpdates(_0x17d002['body'],null))[_0x5e60('0x26')](respondWithResult(_0x148204,null))[_0x5e60('0x4b')](handleError(_0x148204,null));};exports['destroy']=function(_0x26e129,_0x367208){return db[_0x5e60('0x44')][_0x5e60('0x4a')]({'where':{'id':_0x26e129['params']['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x367208,null))[_0x5e60('0x26')](removeEntity(_0x367208,null))['catch'](handleError(_0x367208,null));};exports[_0x5e60('0x54')]=function(_0x4cb322,_0x8d00b9,_0x5220fc){return db[_0x5e60('0x44')][_0x5e60('0x55')]({'where':{'id':_0x4cb322['params']['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x8d00b9,null))['then'](function(_0x1a2094){var _0x566fc7;var _0x157787={},_0x5b4daa={};_0x5b4daa[_0x5e60('0x31')]=_[_0x5e60('0x34')](db[_0x5e60('0x56')][_0x5e60('0x2d')]);_0x5b4daa[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x4cb322[_0x5e60('0x33')]);_0x5b4daa['filters']=_[_0x5e60('0x49')](_0x5b4daa[_0x5e60('0x31')],_0x5b4daa[_0x5e60('0x33')]);_0x157787[_0x5e60('0x36')]=_[_0x5e60('0x49')](_0x5b4daa[_0x5e60('0x31')],qs['fields'](_0x4cb322['query']['fields']));_0x157787[_0x5e60('0x36')]=_0x157787[_0x5e60('0x36')]['length']?_0x157787[_0x5e60('0x36')]:_0x5b4daa[_0x5e60('0x31')];if(!_0x4cb322['query'][_0x5e60('0x57')](_0x5e60('0x39'))){_0x157787[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x1e')]);_0x157787[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x1d')]);}_0x157787[_0x5e60('0x3a')]=qs[_0x5e60('0x3b')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3b')]);_0x157787[_0x5e60('0x3c')]=qs[_0x5e60('0x35')](_[_0x5e60('0x3d')](_0x4cb322['query'],_0x5b4daa[_0x5e60('0x35')]));if(_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3e')]){_0x157787['where']=_[_0x5e60('0x3f')](_0x157787[_0x5e60('0x3c')],{'$or':_['map'](_0x157787[_0x5e60('0x36')],function(_0x6f4d2f){var _0x5bbaaf={};_0x5bbaaf[_0x6f4d2f]={'$like':'%'+_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3e')]+'%'};return _0x5bbaaf;})});}_0x157787[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x157787[_0x5e60('0x3c')],{'mailboxuser':_0x1a2094[_0x5e60('0x58')]});_0x157787=_[_0x5e60('0x3f')]({},_0x157787,_0x4cb322[_0x5e60('0x41')]);return db[_0x5e60('0x56')]['findAndCountAll'](_0x157787)[_0x5e60('0x26')](respondWithFilteredResult(_0x8d00b9,_0x157787));})[_0x5e60('0x4b')](handleError(_0x8d00b9,null));}; \ No newline at end of file +var _0xbdb7=['map','query','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','fields','include','find','create','body','role','user','get','Voicemails','UserProfileSection','userProfileId','autoAssociation','destroy','getMessages','findOne','nolimit','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','UserProfileResource','then','sendStatus','error','stack','name','send','index','VoiceMail','rawAttributes','fieldName'];(function(_0xdaf8eb,_0x3befbb){var _0x27a9d3=function(_0x581286){while(--_0x581286){_0xdaf8eb['push'](_0xdaf8eb['shift']());}};_0x27a9d3(++_0x3befbb);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x204eb7,_0x4974c3){_0x204eb7=_0x204eb7-0x0;var _0x37e444=_0xbdb7[_0x204eb7];return _0x37e444;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){var _0x3c423f=_0x3a456f['get']({'plain':!![]});var _0x47abaf='Voicemails';return db[_0x7bdb('0x23')]['destroy']({'where':{'type':_0x47abaf,'resourceId':_0x3c423f['id']}})[_0x7bdb('0x24')](function(){return _0x3a456f;});})[_0x7bdb('0x24')](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)[_0x7bdb('0x17')]();});}};}function handleEntityNotFound(_0x2a494e,_0x523869){return function(_0x10e818){if(!_0x10e818){_0x2a494e[_0x7bdb('0x25')](0x194);}return _0x10e818;};}function handleError(_0x399b62,_0xe1141d){_0xe1141d=_0xe1141d||0x1f4;return function(_0x371e8a){logger[_0x7bdb('0x26')](_0x371e8a[_0x7bdb('0x27')]);if(_0x371e8a[_0x7bdb('0x28')]){delete _0x371e8a[_0x7bdb('0x28')];}_0x399b62[_0x7bdb('0x1d')](_0xe1141d)[_0x7bdb('0x29')](_0x371e8a);};}exports[_0x7bdb('0x2a')]=function(_0x5b386d,_0x388a45){var _0x23fc3a={},_0x8f7672={},_0x9f5c1={'count':0x0,'rows':[]};var _0x29eac5=_['map'](db[_0x7bdb('0x2b')][_0x7bdb('0x2c')],function(_0x9ac56){return{'name':_0x9ac56[_0x7bdb('0x2d')],'type':_0x9ac56['type']['key']};});_0x8f7672['model']=_[_0x7bdb('0x2e')](_0x29eac5,'name');_0x8f7672[_0x7bdb('0x2f')]=_['keys'](_0x5b386d[_0x7bdb('0x2f')]);_0x8f7672[_0x7bdb('0x30')]=_[_0x7bdb('0x31')](_0x8f7672['model'],_0x8f7672[_0x7bdb('0x2f')]);_0x23fc3a['attributes']=_['intersection'](_0x8f7672[_0x7bdb('0x32')],qs['fields'](_0x5b386d[_0x7bdb('0x2f')]['fields']));_0x23fc3a['attributes']=_0x23fc3a[_0x7bdb('0x33')][_0x7bdb('0x34')]?_0x23fc3a[_0x7bdb('0x33')]:_0x8f7672[_0x7bdb('0x32')];if(!_0x5b386d[_0x7bdb('0x2f')][_0x7bdb('0x35')]('nolimit')){_0x23fc3a[_0x7bdb('0x1b')]=qs[_0x7bdb('0x1b')](_0x5b386d[_0x7bdb('0x2f')][_0x7bdb('0x1b')]);_0x23fc3a[_0x7bdb('0x19')]=qs[_0x7bdb('0x19')](_0x5b386d[_0x7bdb('0x2f')][_0x7bdb('0x19')]);}_0x23fc3a[_0x7bdb('0x36')]=qs['sort'](_0x5b386d['query'][_0x7bdb('0x37')]);_0x23fc3a[_0x7bdb('0x38')]=qs[_0x7bdb('0x30')](_[_0x7bdb('0x39')](_0x5b386d[_0x7bdb('0x2f')],_0x8f7672['filters']),_0x29eac5);if(_0x5b386d['query'][_0x7bdb('0x3a')]){_0x23fc3a['where']=_[_0x7bdb('0x3b')](_0x23fc3a['where'],{'$or':_[_0x7bdb('0x2e')](_0x29eac5,function(_0x5d1826){if(_0x5d1826['type']!==_0x7bdb('0x3c')){var _0x2d578e={};_0x2d578e[_0x5d1826[_0x7bdb('0x28')]]={'$like':'%'+_0x5b386d[_0x7bdb('0x2f')][_0x7bdb('0x3a')]+'%'};return _0x2d578e;}})});}_0x23fc3a=_[_0x7bdb('0x3b')]({},_0x23fc3a,_0x5b386d[_0x7bdb('0x3d')]);var _0x501aff={'where':_0x23fc3a['where']};return db[_0x7bdb('0x2b')][_0x7bdb('0x1c')](_0x501aff)[_0x7bdb('0x24')](function(_0x3509e4){_0x9f5c1[_0x7bdb('0x1c')]=_0x3509e4;if(_0x5b386d[_0x7bdb('0x2f')][_0x7bdb('0x3e')]){_0x23fc3a['include']=[{'all':!![]}];}return db['VoiceMail'][_0x7bdb('0x3f')](_0x23fc3a);})[_0x7bdb('0x24')](function(_0x4636f8){_0x9f5c1[_0x7bdb('0x40')]=_0x4636f8;return _0x9f5c1;})['then'](respondWithFilteredResult(_0x388a45,_0x23fc3a))[_0x7bdb('0x41')](handleError(_0x388a45,null));};exports['show']=function(_0x37029b,_0x27de25){var _0x218361={'raw':!![],'where':{'id':_0x37029b[_0x7bdb('0x42')]['id']}},_0x264f3a={};_0x264f3a[_0x7bdb('0x32')]=_[_0x7bdb('0x43')](db[_0x7bdb('0x2b')][_0x7bdb('0x2c')]);_0x264f3a['query']=_[_0x7bdb('0x43')](_0x37029b[_0x7bdb('0x2f')]);_0x264f3a['filters']=_[_0x7bdb('0x31')](_0x264f3a['model'],_0x264f3a[_0x7bdb('0x2f')]);_0x218361[_0x7bdb('0x33')]=_[_0x7bdb('0x31')](_0x264f3a[_0x7bdb('0x32')],qs[_0x7bdb('0x44')](_0x37029b['query'][_0x7bdb('0x44')]));_0x218361[_0x7bdb('0x33')]=_0x218361[_0x7bdb('0x33')][_0x7bdb('0x34')]?_0x218361[_0x7bdb('0x33')]:_0x264f3a['model'];if(_0x37029b[_0x7bdb('0x2f')][_0x7bdb('0x3e')]){_0x218361[_0x7bdb('0x45')]=[{'all':!![]}];}_0x218361=_[_0x7bdb('0x3b')]({},_0x218361,_0x37029b[_0x7bdb('0x3d')]);return db[_0x7bdb('0x2b')][_0x7bdb('0x46')](_0x218361)[_0x7bdb('0x24')](handleEntityNotFound(_0x27de25,null))[_0x7bdb('0x24')](respondWithResult(_0x27de25,null))[_0x7bdb('0x41')](handleError(_0x27de25,null));};exports['create']=function(_0x189cf8,_0x58c4bc){return db['VoiceMail'][_0x7bdb('0x47')](_0x189cf8[_0x7bdb('0x48')],{})['then'](function(_0x37780a){var _0x186809=_0x189cf8['user']['get']({'plain':!![]});if(!_0x186809)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x186809[_0x7bdb('0x49')]===_0x7bdb('0x4a')){var _0x2fab74=_0x37780a[_0x7bdb('0x4b')]({'plain':!![]});var _0x33687b=_0x7bdb('0x4c');return db[_0x7bdb('0x4d')][_0x7bdb('0x46')]({'where':{'name':_0x33687b,'userProfileId':_0x186809[_0x7bdb('0x4e')]},'raw':!![]})[_0x7bdb('0x24')](function(_0x5a8d4a){if(_0x5a8d4a&&_0x5a8d4a[_0x7bdb('0x4f')]===0x0){return db['UserProfileResource'][_0x7bdb('0x47')]({'name':_0x2fab74[_0x7bdb('0x28')],'resourceId':_0x2fab74['id'],'type':_0x5a8d4a[_0x7bdb('0x28')],'sectionId':_0x5a8d4a['id']},{})[_0x7bdb('0x24')](function(){return _0x37780a;});}else{return _0x37780a;}})['catch'](function(_0x258f29){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x258f29);throw _0x258f29;});}return _0x37780a;})[_0x7bdb('0x24')](respondWithResult(_0x58c4bc,0xc9))[_0x7bdb('0x41')](handleError(_0x58c4bc,null));};exports['update']=function(_0x4e17f3,_0x49bb3f){if(_0x4e17f3[_0x7bdb('0x48')]['id']){delete _0x4e17f3['body']['id'];}return db['VoiceMail'][_0x7bdb('0x46')]({'where':{'id':_0x4e17f3[_0x7bdb('0x42')]['id']}})[_0x7bdb('0x24')](handleEntityNotFound(_0x49bb3f,null))[_0x7bdb('0x24')](saveUpdates(_0x4e17f3['body'],null))[_0x7bdb('0x24')](respondWithResult(_0x49bb3f,null))['catch'](handleError(_0x49bb3f,null));};exports[_0x7bdb('0x50')]=function(_0x7f2d89,_0x82f990){return db[_0x7bdb('0x2b')][_0x7bdb('0x46')]({'where':{'id':_0x7f2d89[_0x7bdb('0x42')]['id']}})['then'](handleEntityNotFound(_0x82f990,null))[_0x7bdb('0x24')](removeEntity(_0x82f990,null))[_0x7bdb('0x41')](handleError(_0x82f990,null));};exports[_0x7bdb('0x51')]=function(_0x58658e,_0x2b5493,_0x1d9927){return db['VoiceMail'][_0x7bdb('0x52')]({'where':{'id':_0x58658e['params']['id']}})[_0x7bdb('0x24')](handleEntityNotFound(_0x2b5493,null))[_0x7bdb('0x24')](function(_0x4f3f8c){var _0x478bbd;var _0x21a54f={},_0x2a6c5b={};_0x2a6c5b['model']=_[_0x7bdb('0x43')](db['VoiceMailMessage'][_0x7bdb('0x2c')]);_0x2a6c5b['query']=_['keys'](_0x58658e[_0x7bdb('0x2f')]);_0x2a6c5b[_0x7bdb('0x30')]=_[_0x7bdb('0x31')](_0x2a6c5b[_0x7bdb('0x32')],_0x2a6c5b[_0x7bdb('0x2f')]);_0x21a54f[_0x7bdb('0x33')]=_[_0x7bdb('0x31')](_0x2a6c5b[_0x7bdb('0x32')],qs[_0x7bdb('0x44')](_0x58658e[_0x7bdb('0x2f')][_0x7bdb('0x44')]));_0x21a54f[_0x7bdb('0x33')]=_0x21a54f['attributes'][_0x7bdb('0x34')]?_0x21a54f[_0x7bdb('0x33')]:_0x2a6c5b['model'];if(!_0x58658e[_0x7bdb('0x2f')][_0x7bdb('0x35')](_0x7bdb('0x53'))){_0x21a54f[_0x7bdb('0x1b')]=qs[_0x7bdb('0x1b')](_0x58658e['query'][_0x7bdb('0x1b')]);_0x21a54f[_0x7bdb('0x19')]=qs[_0x7bdb('0x19')](_0x58658e['query'][_0x7bdb('0x19')]);}_0x21a54f[_0x7bdb('0x36')]=qs[_0x7bdb('0x37')](_0x58658e[_0x7bdb('0x2f')][_0x7bdb('0x37')]);_0x21a54f[_0x7bdb('0x38')]=qs[_0x7bdb('0x30')](_[_0x7bdb('0x39')](_0x58658e[_0x7bdb('0x2f')],_0x2a6c5b['filters']));if(_0x58658e[_0x7bdb('0x2f')][_0x7bdb('0x3a')]){_0x21a54f[_0x7bdb('0x38')]=_[_0x7bdb('0x3b')](_0x21a54f[_0x7bdb('0x38')],{'$or':_[_0x7bdb('0x2e')](_0x21a54f[_0x7bdb('0x33')],function(_0x86c6ed){var _0x4565c2={};_0x4565c2[_0x86c6ed]={'$like':'%'+_0x58658e[_0x7bdb('0x2f')][_0x7bdb('0x3a')]+'%'};return _0x4565c2;})});}_0x21a54f[_0x7bdb('0x38')]=_[_0x7bdb('0x3b')](_0x21a54f['where'],{'mailboxuser':_0x4f3f8c[_0x7bdb('0x54')]});_0x21a54f=_['merge']({},_0x21a54f,_0x58658e[_0x7bdb('0x3d')]);return db[_0x7bdb('0x55')][_0x7bdb('0x56')](_0x21a54f)['then'](respondWithFilteredResult(_0x2b5493,_0x21a54f));})[_0x7bdb('0x41')](handleError(_0x2b5493,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index dd39fbb..d072223 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 _0x69ee=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x69ee,0x11c));var _0xe69e=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x69ee[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xe69e('0x0'));var util=require('util');var logger=require(_0xe69e('0x1'))(_0xe69e('0x2'));var moment=require(_0xe69e('0x3'));var BPromise=require(_0xe69e('0x4'));var rp=require(_0xe69e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe69e('0x6'));var config=require(_0xe69e('0x7'));var attributes=require(_0xe69e('0x8'));module[_0xe69e('0x9')]=function(_0x3932de,_0x63e4ff){return _0x3932de[_0xe69e('0xa')](_0xe69e('0xb'),attributes,{'tableName':_0xe69e('0xc'),'paranoid':![],'indexes':[{'name':_0xe69e('0xd'),'fields':[_0xe69e('0xe'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x79b5=['rimraf','../../config/environment','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','util','api','request-promise','path'];(function(_0xd0e5ea,_0x2efa04){var _0x2b8f57=function(_0x2d193e){while(--_0x2d193e){_0xd0e5ea['push'](_0xd0e5ea['shift']());}};_0x2b8f57(++_0x2efa04);}(_0x79b5,0xcc));var _0x579b=function(_0xa1ae5c,_0x44beef){_0xa1ae5c=_0xa1ae5c-0x0;var _0x4573c1=_0x79b5[_0xa1ae5c];return _0x4573c1;};'use strict';var _=require('lodash');var util=require(_0x579b('0x0'));var logger=require('../../config/logger')(_0x579b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x579b('0x2'));var fs=require('fs');var path=require(_0x579b('0x3'));var rimraf=require(_0x579b('0x4'));var config=require(_0x579b('0x5'));var attributes=require(_0x579b('0x6'));module['exports']=function(_0x3d3fac,_0x34294f){return _0x3d3fac[_0x579b('0x7')](_0x579b('0x8'),attributes,{'tableName':_0x579b('0x9'),'paranoid':![],'indexes':[{'name':_0x579b('0xa'),'fields':[_0x579b('0xb'),_0x579b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 9f0c02d..92dc157 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 _0xd37a=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','info','catch','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd37a,0xe4));var _0xad37=function(_0x537dc8,_0x500f51){_0x537dc8=_0x537dc8-0x0;var _0xb6fed7=_0xd37a[_0x537dc8];return _0xb6fed7;};'use strict';var _=require(_0xad37('0x0'));var util=require(_0xad37('0x1'));var moment=require(_0xad37('0x2'));var BPromise=require(_0xad37('0x3'));var rs=require(_0xad37('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad37('0x5'))['db'];var utils=require(_0xad37('0x6'));var logger=require(_0xad37('0x7'))(_0xad37('0x8'));var config=require('../../config/environment');var jayson=require(_0xad37('0x9'));var client=jayson[_0xad37('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24c861,_0x27b6df,_0x47e61a){return new BPromise(function(_0x185925,_0x12fbf6){return client[_0xad37('0xb')](_0x24c861,_0x47e61a)[_0xad37('0xc')](function(_0x4f7b3b){logger['info']('VoiceMail,\x20%s,\x20%s',_0x27b6df,_0xad37('0xd'));logger[_0xad37('0xe')](_0xad37('0xf'),_0x27b6df,_0xad37('0xd'),JSON[_0xad37('0x10')](_0x4f7b3b));if(_0x4f7b3b['error']){if(_0x4f7b3b[_0xad37('0x11')][_0xad37('0x12')]===0x1f4){logger[_0xad37('0x11')](_0xad37('0x13'),_0x27b6df,_0x4f7b3b['error'][_0xad37('0x14')]);return _0x12fbf6(_0x4f7b3b[_0xad37('0x11')][_0xad37('0x14')]);}logger[_0xad37('0x11')](_0xad37('0x13'),_0x27b6df,_0x4f7b3b['error']['message']);return _0x185925(_0x4f7b3b[_0xad37('0x11')][_0xad37('0x14')]);}else{logger[_0xad37('0x15')](_0xad37('0x13'),_0x27b6df,_0xad37('0xd'));_0x185925(_0x4f7b3b['result'][_0xad37('0x14')]);}})[_0xad37('0x16')](function(_0x1a7c39){logger[_0xad37('0x11')](_0xad37('0x13'),_0x27b6df,_0x1a7c39);_0x12fbf6(_0x1a7c39);});});} \ No newline at end of file +var _0xfb92=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x477e63,_0x55f3ba){var _0x381ab9=function(_0x8d3fd9){while(--_0x8d3fd9){_0x477e63['push'](_0x477e63['shift']());}};_0x381ab9(++_0x55f3ba);}(_0xfb92,0x150));var _0x2fb9=function(_0x5e5103,_0xcc08fd){_0x5e5103=_0x5e5103-0x0;var _0x3f4dea=_0xfb92[_0x5e5103];return _0x3f4dea;};'use strict';var _=require('lodash');var util=require(_0x2fb9('0x0'));var moment=require(_0x2fb9('0x1'));var BPromise=require(_0x2fb9('0x2'));var rs=require(_0x2fb9('0x3'));var fs=require('fs');var Redis=require(_0x2fb9('0x4'));var db=require(_0x2fb9('0x5'))['db'];var utils=require(_0x2fb9('0x6'));var logger=require('../../config/logger')(_0x2fb9('0x7'));var config=require(_0x2fb9('0x8'));var jayson=require(_0x2fb9('0x9'));var client=jayson['client'][_0x2fb9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58eeb2,_0x4fb155,_0x5807aa){return new BPromise(function(_0x535071,_0x3f5f08){return client[_0x2fb9('0xb')](_0x58eeb2,_0x5807aa)[_0x2fb9('0xc')](function(_0xaa04b){logger[_0x2fb9('0xd')](_0x2fb9('0xe'),_0x4fb155,_0x2fb9('0xf'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x4fb155,'request\x20sent',JSON[_0x2fb9('0x10')](_0xaa04b));if(_0xaa04b['error']){if(_0xaa04b[_0x2fb9('0x11')]['code']===0x1f4){logger[_0x2fb9('0x11')](_0x2fb9('0xe'),_0x4fb155,_0xaa04b[_0x2fb9('0x11')][_0x2fb9('0x12')]);return _0x3f5f08(_0xaa04b[_0x2fb9('0x11')][_0x2fb9('0x12')]);}logger[_0x2fb9('0x11')](_0x2fb9('0xe'),_0x4fb155,_0xaa04b[_0x2fb9('0x11')][_0x2fb9('0x12')]);return _0x535071(_0xaa04b[_0x2fb9('0x11')][_0x2fb9('0x12')]);}else{logger[_0x2fb9('0xd')]('VoiceMail,\x20%s,\x20%s',_0x4fb155,_0x2fb9('0xf'));_0x535071(_0xaa04b['result']['message']);}})['catch'](function(_0x365e6a){logger[_0x2fb9('0x11')]('VoiceMail,\x20%s,\x20%s',_0x4fb155,_0x365e6a);_0x3f5f08(_0x365e6a);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 66fbb58..c8f99b3 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 _0x4fa3=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','download','post','create','update','delete','/:id','multer','util','path'];(function(_0x50fa33,_0x57d4dc){var _0x867bfa=function(_0x1ec4dd){while(--_0x1ec4dd){_0x50fa33['push'](_0x50fa33['shift']());}};_0x867bfa(++_0x57d4dc);}(_0x4fa3,0xa8));var _0x34fa=function(_0x2e4cbf,_0x8763d3){_0x2e4cbf=_0x2e4cbf-0x0;var _0x52840f=_0x4fa3[_0x2e4cbf];return _0x52840f;};'use strict';var multer=require(_0x34fa('0x0'));var util=require(_0x34fa('0x1'));var path=require(_0x34fa('0x2'));var timeout=require(_0x34fa('0x3'));var express=require(_0x34fa('0x4'));var router=express[_0x34fa('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x34fa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x34fa('0x7'));var controller=require('./voiceMailMessage.controller');router[_0x34fa('0x8')]('/',auth[_0x34fa('0x9')](),controller[_0x34fa('0xa')]);router[_0x34fa('0x8')]('/:id',auth[_0x34fa('0x9')](),controller[_0x34fa('0xb')]);router[_0x34fa('0x8')](_0x34fa('0xc'),auth['isAuthenticated'](),controller[_0x34fa('0xd')]);router[_0x34fa('0xe')]('/',auth['isAuthenticated'](),controller[_0x34fa('0xf')]);router['put']('/:id',auth[_0x34fa('0x9')](),controller[_0x34fa('0x10')]);router[_0x34fa('0x11')](_0x34fa('0x12'),auth[_0x34fa('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1c6a=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','/:id','show','isAuthenticated','download','post','create','update'];(function(_0xdd1754,_0x337707){var _0x280be3=function(_0x2b5369){while(--_0x2b5369){_0xdd1754['push'](_0xdd1754['shift']());}};_0x280be3(++_0x337707);}(_0x1c6a,0x128));var _0xa1c6=function(_0xeab168,_0x30d561){_0xeab168=_0xeab168-0x0;var _0xbbf818=_0x1c6a[_0xeab168];return _0xbbf818;};'use strict';var multer=require(_0xa1c6('0x0'));var util=require(_0xa1c6('0x1'));var path=require(_0xa1c6('0x2'));var timeout=require(_0xa1c6('0x3'));var express=require(_0xa1c6('0x4'));var router=express[_0xa1c6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa1c6('0x6'));var interaction=require(_0xa1c6('0x7'));var config=require(_0xa1c6('0x8'));var controller=require(_0xa1c6('0x9'));router[_0xa1c6('0xa')]('/',auth['isAuthenticated'](),controller[_0xa1c6('0xb')]);router[_0xa1c6('0xa')](_0xa1c6('0xc'),auth['isAuthenticated'](),controller[_0xa1c6('0xd')]);router[_0xa1c6('0xa')]('/:id/download',auth[_0xa1c6('0xe')](),controller[_0xa1c6('0xf')]);router[_0xa1c6('0x10')]('/',auth[_0xa1c6('0xe')](),controller[_0xa1c6('0x11')]);router['put'](_0xa1c6('0xc'),auth[_0xa1c6('0xe')](),controller[_0xa1c6('0x12')]);router[_0xa1c6('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xa1c6('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 99f263c..96eb5a9 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 _0x98be=['VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','sequelize','exports'];(function(_0x1dbc6a,_0x50786a){var _0x9c84fe=function(_0x5e314c){while(--_0x5e314c){_0x1dbc6a['push'](_0x1dbc6a['shift']());}};_0x9c84fe(++_0x50786a);}(_0x98be,0x120));var _0xe98b=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x98be[_0x456fb1];return _0x4083d6;};'use strict';var Sequelize=require(_0xe98b('0x0'));module[_0xe98b('0x1')]={'name':{'type':Sequelize[_0xe98b('0x2')],'get':function(_0x257be4){return this[_0xe98b('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xe98b('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xe98b('0x6')](_0xe98b('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xe98b('0x5')],'defaultValue':''},'stamp':{'type':_0xe98b('0x8'),'defaultValue':Sequelize[_0xe98b('0x9')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x11b1=['long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0x5d5bcb,_0x25e2ea){var _0x4ea5eb=function(_0x36782b){while(--_0x36782b){_0x5d5bcb['push'](_0x5d5bcb['shift']());}};_0x4ea5eb(++_0x25e2ea);}(_0x11b1,0x187));var _0x111b=function(_0x19d433,_0xd59e31){_0x19d433=_0x19d433-0x0;var _0x368fe4=_0x11b1[_0x19d433];return _0x368fe4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x111b('0x0')],'get':function(_0x3d58e0){return this[_0x111b('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x111b('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x111b('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x111b('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x111b('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x111b('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x111b('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x111b('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x111b('0x4')](_0x111b('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x111b('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x111b('0x3')],'defaultValue':''},'stamp':{'type':_0x111b('0x6'),'defaultValue':Sequelize[_0x111b('0x7')](_0x111b('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index ea1f5e2..52a148e 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 _0x12c6=['create','body','download','recording','msg_id','Sequelize','ValidationError','attachment','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','model','differenceBy','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','rows','catch','show','params','includeAll','include','find'];(function(_0x4a4922,_0x82cb8f){var _0x55a8c6=function(_0x59712e){while(--_0x59712e){_0x4a4922['push'](_0x4a4922['shift']());}};_0x55a8c6(++_0x82cb8f);}(_0x12c6,0xae));var _0x612c=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x12c6[_0x49b207];return _0x2dc8fa;};'use strict';var emlformat=require(_0x612c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x612c('0x1'));var jsonpatch=require(_0x612c('0x2'));var rp=require(_0x612c('0x3'));var moment=require(_0x612c('0x4'));var BPromise=require(_0x612c('0x5'));var Mustache=require(_0x612c('0x6'));var util=require('util');var path=require(_0x612c('0x7'));var sox=require(_0x612c('0x8'));var csv=require(_0x612c('0x9'));var ejs=require(_0x612c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x612c('0xb'));var squel=require('squel');var crypto=require(_0x612c('0xc'));var jsforce=require(_0x612c('0xd'));var deskjs=require(_0x612c('0xe'));var toCsv=require(_0x612c('0x9'));var querystring=require('querystring');var Papa=require(_0x612c('0xf'));var Redis=require(_0x612c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x612c('0x11'));var as=require(_0x612c('0x12'));var hardwareService=require(_0x612c('0x13'));var logger=require(_0x612c('0x14'))(_0x612c('0x15'));var utils=require('../../config/utils');var config=require(_0x612c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x612c('0x17'))['db'];function respondWithStatusCode(_0xf92df8,_0xc15a74){_0xc15a74=_0xc15a74||0xcc;return function(_0xcfec51){if(_0xcfec51){return _0xf92df8[_0x612c('0x18')](_0xc15a74);}return _0xf92df8['status'](_0xc15a74)[_0x612c('0x19')]();};}function respondWithResult(_0x54abcd,_0x5a48a1){_0x5a48a1=_0x5a48a1||0xc8;return function(_0x4541f1){if(_0x4541f1){return _0x54abcd[_0x612c('0x1a')](_0x5a48a1)['json'](_0x4541f1);}};}function respondWithFilteredResult(_0x115b27,_0x525fba){return function(_0x3550cd){if(_0x3550cd){var _0x509e9f=typeof _0x525fba[_0x612c('0x1b')]===_0x612c('0x1c')&&typeof _0x525fba[_0x612c('0x1d')]===_0x612c('0x1c');var _0x5dc922=_0x3550cd[_0x612c('0x1e')];var _0x52e0f7=_0x509e9f?0x0:_0x525fba[_0x612c('0x1b')];var _0x5070e8=_0x509e9f?_0x3550cd[_0x612c('0x1e')]:_0x525fba[_0x612c('0x1b')]+_0x525fba[_0x612c('0x1d')];var _0x3d9a40;if(_0x5070e8>=_0x5dc922){_0x5070e8=_0x5dc922;_0x3d9a40=0xc8;}else{_0x3d9a40=0xce;}_0x115b27[_0x612c('0x1a')](_0x3d9a40);return _0x115b27[_0x612c('0x1f')](_0x612c('0x20'),_0x52e0f7+'-'+_0x5070e8+'/'+_0x5dc922)[_0x612c('0x21')](_0x3550cd);}return null;};}function patchUpdates(_0x165b19){return function(_0x2a6048){try{jsonpatch['apply'](_0x2a6048,_0x165b19,!![]);}catch(_0xcbcb48){return BPromise[_0x612c('0x22')](_0xcbcb48);}return _0x2a6048[_0x612c('0x23')]();};}function saveUpdates(_0x30e733,_0x32e18c){return function(_0x32d95f){if(_0x32d95f){return _0x32d95f[_0x612c('0x24')](_0x30e733)[_0x612c('0x25')](function(_0x2f313f){return _0x2f313f;});}return null;};}function removeEntity(_0x3027dc,_0x19def7){return function(_0x5804bf){if(_0x5804bf){return _0x5804bf['destroy']()['then'](function(){_0x3027dc['status'](0xcc)[_0x612c('0x19')]();});}};}function handleEntityNotFound(_0x88c5af,_0x2b8d60){return function(_0x4f0e2f){if(!_0x4f0e2f){_0x88c5af[_0x612c('0x18')](0x194);}return _0x4f0e2f;};}function handleError(_0x13de73,_0x5791c3){_0x5791c3=_0x5791c3||0x1f4;return function(_0x5f59f9){logger['error'](_0x5f59f9[_0x612c('0x26')]);if(_0x5f59f9[_0x612c('0x27')]){delete _0x5f59f9[_0x612c('0x27')];}_0x13de73[_0x612c('0x1a')](_0x5791c3)[_0x612c('0x28')](_0x5f59f9);};}exports[_0x612c('0x29')]=function(_0x36dfb0,_0x46c8db){var _0x5b08bc={},_0x316b8f={},_0x14dc23={'count':0x0,'rows':[]};var _0x4a6907=_[_0x612c('0x2a')](db[_0x612c('0x2b')][_0x612c('0x2c')],function(_0x213898){return{'name':_0x213898[_0x612c('0x2d')],'type':_0x213898['type']['key']};});_0x316b8f[_0x612c('0x2e')]=_[_0x612c('0x2f')](_[_0x612c('0x2a')](_0x4a6907,_0x612c('0x27')),[_0x612c('0x27')]);_0x316b8f['query']=_[_0x612c('0x30')](_0x36dfb0[_0x612c('0x31')]);_0x316b8f[_0x612c('0x32')]=_['intersection'](_0x316b8f[_0x612c('0x2e')],_0x316b8f['query']);_0x5b08bc['attributes']=_[_0x612c('0x33')](_0x316b8f[_0x612c('0x2e')],qs[_0x612c('0x34')](_0x36dfb0[_0x612c('0x31')][_0x612c('0x34')]));_0x5b08bc[_0x612c('0x35')]=_0x5b08bc[_0x612c('0x35')][_0x612c('0x36')]?_0x5b08bc['attributes']:_0x316b8f[_0x612c('0x2e')];if(!_0x36dfb0[_0x612c('0x31')][_0x612c('0x37')](_0x612c('0x38'))){_0x5b08bc[_0x612c('0x1d')]=qs[_0x612c('0x1d')](_0x36dfb0[_0x612c('0x31')][_0x612c('0x1d')]);_0x5b08bc[_0x612c('0x1b')]=qs[_0x612c('0x1b')](_0x36dfb0[_0x612c('0x31')][_0x612c('0x1b')]);}_0x5b08bc[_0x612c('0x39')]=qs[_0x612c('0x3a')](_0x36dfb0['query'][_0x612c('0x3a')]);_0x5b08bc[_0x612c('0x3b')]=qs[_0x612c('0x32')](_[_0x612c('0x3c')](_0x36dfb0[_0x612c('0x31')],_0x316b8f[_0x612c('0x32')]),_0x4a6907);if(_0x36dfb0['query']['filter']){_0x5b08bc['where']=_[_0x612c('0x3d')](_0x5b08bc[_0x612c('0x3b')],{'$or':_[_0x612c('0x2a')](_0x4a6907,function(_0x4a2bbc){if(_0x4a2bbc[_0x612c('0x3e')]!==_0x612c('0x3f')){var _0x2dd41a={};_0x2dd41a[_0x4a2bbc['name']]={'$like':'%'+_0x36dfb0['query']['filter']+'%'};return _0x2dd41a;}})});}_0x5b08bc=_[_0x612c('0x3d')]({},_0x5b08bc,_0x36dfb0[_0x612c('0x40')]);var _0x11f198={'where':_0x5b08bc['where']};return db[_0x612c('0x2b')][_0x612c('0x1e')](_0x11f198)['then'](function(_0x2bf09f){_0x14dc23[_0x612c('0x1e')]=_0x2bf09f;if(_0x36dfb0[_0x612c('0x31')]['includeAll']){_0x5b08bc['include']=[{'all':!![]}];}return db[_0x612c('0x2b')]['findAll'](_0x5b08bc);})[_0x612c('0x25')](function(_0x25ff5c){_0x14dc23[_0x612c('0x41')]=_0x25ff5c;return _0x14dc23;})[_0x612c('0x25')](respondWithFilteredResult(_0x46c8db,_0x5b08bc))[_0x612c('0x42')](handleError(_0x46c8db,null));};exports[_0x612c('0x43')]=function(_0x1102e0,_0x5bcd39){var _0x77dffa={'raw':!![],'where':{'id':_0x1102e0[_0x612c('0x44')]['id']}},_0x5c0142={};_0x5c0142['model']=_[_0x612c('0x30')](db['VoiceMailMessage'][_0x612c('0x2c')]);_0x5c0142['query']=_[_0x612c('0x30')](_0x1102e0[_0x612c('0x31')]);_0x5c0142[_0x612c('0x32')]=_[_0x612c('0x33')](_0x5c0142[_0x612c('0x2e')],_0x5c0142['query']);_0x77dffa['attributes']=_['intersection'](_0x5c0142[_0x612c('0x2e')],qs['fields'](_0x1102e0[_0x612c('0x31')][_0x612c('0x34')]));_0x77dffa[_0x612c('0x35')]=_0x77dffa['attributes'][_0x612c('0x36')]?_0x77dffa[_0x612c('0x35')]:_0x5c0142[_0x612c('0x2e')];if(_0x1102e0[_0x612c('0x31')][_0x612c('0x45')]){_0x77dffa[_0x612c('0x46')]=[{'all':!![]}];}_0x77dffa=_['merge']({},_0x77dffa,_0x1102e0[_0x612c('0x40')]);return db['VoiceMailMessage'][_0x612c('0x47')](_0x77dffa)[_0x612c('0x25')](handleEntityNotFound(_0x5bcd39,null))['then'](respondWithResult(_0x5bcd39,null))['catch'](handleError(_0x5bcd39,null));};exports['create']=function(_0x1b522a,_0x12ce80){return db[_0x612c('0x2b')][_0x612c('0x48')](_0x1b522a[_0x612c('0x49')],{})[_0x612c('0x25')](respondWithResult(_0x12ce80,0xc9))['catch'](handleError(_0x12ce80,null));};exports[_0x612c('0x24')]=function(_0xf64c84,_0x4084e5){if(_0xf64c84['body']['id']){delete _0xf64c84[_0x612c('0x49')]['id'];}return db['VoiceMailMessage'][_0x612c('0x47')]({'where':{'id':_0xf64c84[_0x612c('0x44')]['id']}})[_0x612c('0x25')](handleEntityNotFound(_0x4084e5,null))['then'](saveUpdates(_0xf64c84[_0x612c('0x49')],null))['then'](respondWithResult(_0x4084e5,null))[_0x612c('0x42')](handleError(_0x4084e5,null));};exports['destroy']=function(_0x211e34,_0x41bcbe){return db[_0x612c('0x2b')][_0x612c('0x47')]({'where':{'id':_0x211e34[_0x612c('0x44')]['id']}})[_0x612c('0x25')](handleEntityNotFound(_0x41bcbe,null))[_0x612c('0x25')](removeEntity(_0x41bcbe,null))[_0x612c('0x42')](handleError(_0x41bcbe,null));};exports[_0x612c('0x4a')]=function(_0xd6e597,_0x12bdbc,_0x579037){return db[_0x612c('0x2b')]['find']({'where':{'id':_0xd6e597[_0x612c('0x44')]['id']},'attributes':['id',_0x612c('0x4b'),_0x612c('0x4c')]})['then'](handleEntityNotFound(_0x12bdbc,null))[_0x612c('0x25')](function(_0x2d7a3b){if(_0x2d7a3b){if(!_0x2d7a3b[_0x612c('0x4b')]){throw new db[(_0x612c('0x4d'))][(_0x612c('0x4e'))]('VoiceMailMessage\x20not\x20found');}var _0x500f23={'Content-Type':'audio/wav','Content-Disposition':_0x612c('0x4f')};if(_0x2d7a3b[_0x612c('0x4c')]){_0x500f23['Content-Disposition']=_0x612c('0x50')+_0x2d7a3b['msg_id']+_0x612c('0x51');}_0x12bdbc['set'](_0x500f23);return _0x12bdbc[_0x612c('0x28')](new Buffer(_0x2d7a3b[_0x612c('0x4b')]));}})[_0x612c('0x42')](handleError(_0x12bdbc,null));}; \ No newline at end of file +var _0x362a=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMailMessage','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','moment','bluebird','util','path'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x362a,0x1b6));var _0xa362=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0x362a[_0x580b15];return _0x1adb1b;};'use strict';var emlformat=require(_0xa362('0x0'));var rimraf=require(_0xa362('0x1'));var zipdir=require(_0xa362('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa362('0x3'));var BPromise=require(_0xa362('0x4'));var Mustache=require('mustache');var util=require(_0xa362('0x5'));var path=require(_0xa362('0x6'));var sox=require(_0xa362('0x7'));var csv=require('to-csv');var ejs=require(_0xa362('0x8'));var fs=require('fs');var fs_extra=require(_0xa362('0x9'));var _=require(_0xa362('0xa'));var squel=require(_0xa362('0xb'));var crypto=require(_0xa362('0xc'));var jsforce=require(_0xa362('0xd'));var deskjs=require(_0xa362('0xe'));var toCsv=require(_0xa362('0xf'));var querystring=require('querystring');var Papa=require(_0xa362('0x10'));var Redis=require(_0xa362('0x11'));var authService=require(_0xa362('0x12'));var qs=require(_0xa362('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa362('0x14'));var logger=require(_0xa362('0x15'))(_0xa362('0x16'));var utils=require(_0xa362('0x17'));var config=require(_0xa362('0x18'));var licenseUtil=require(_0xa362('0x19'));var db=require(_0xa362('0x1a'))['db'];function respondWithStatusCode(_0xd728a5,_0x2a2313){_0x2a2313=_0x2a2313||0xcc;return function(_0x253a2f){if(_0x253a2f){return _0xd728a5[_0xa362('0x1b')](_0x2a2313);}return _0xd728a5[_0xa362('0x1c')](_0x2a2313)['end']();};}function respondWithResult(_0x3853ca,_0x2ee267){_0x2ee267=_0x2ee267||0xc8;return function(_0x48fcbb){if(_0x48fcbb){return _0x3853ca[_0xa362('0x1c')](_0x2ee267)[_0xa362('0x1d')](_0x48fcbb);}};}function respondWithFilteredResult(_0x2792e5,_0x2467f5){return function(_0x3255e5){if(_0x3255e5){var _0x283acb=typeof _0x2467f5[_0xa362('0x1e')]===_0xa362('0x1f')&&typeof _0x2467f5['limit']==='undefined';var _0x232825=_0x3255e5[_0xa362('0x20')];var _0x3d76f6=_0x283acb?0x0:_0x2467f5['offset'];var _0x351c7c=_0x283acb?_0x3255e5[_0xa362('0x20')]:_0x2467f5['offset']+_0x2467f5['limit'];var _0x3b7df6;if(_0x351c7c>=_0x232825){_0x351c7c=_0x232825;_0x3b7df6=0xc8;}else{_0x3b7df6=0xce;}_0x2792e5['status'](_0x3b7df6);return _0x2792e5[_0xa362('0x21')](_0xa362('0x22'),_0x3d76f6+'-'+_0x351c7c+'/'+_0x232825)[_0xa362('0x1d')](_0x3255e5);}return null;};}function patchUpdates(_0x1d3019){return function(_0x50b674){try{jsonpatch['apply'](_0x50b674,_0x1d3019,!![]);}catch(_0x36e2ac){return BPromise['reject'](_0x36e2ac);}return _0x50b674[_0xa362('0x23')]();};}function saveUpdates(_0x18a22e,_0xb0aa3c){return function(_0x2a3e6c){if(_0x2a3e6c){return _0x2a3e6c[_0xa362('0x24')](_0x18a22e)[_0xa362('0x25')](function(_0x576811){return _0x576811;});}return null;};}function removeEntity(_0x29dc0c,_0x53626a){return function(_0x594b8e){if(_0x594b8e){return _0x594b8e[_0xa362('0x26')]()[_0xa362('0x25')](function(){_0x29dc0c[_0xa362('0x1c')](0xcc)[_0xa362('0x27')]();});}};}function handleEntityNotFound(_0x4057ea,_0x5abcae){return function(_0x4afae8){if(!_0x4afae8){_0x4057ea[_0xa362('0x1b')](0x194);}return _0x4afae8;};}function handleError(_0x1d970b,_0x2b5128){_0x2b5128=_0x2b5128||0x1f4;return function(_0x31130f){logger[_0xa362('0x28')](_0x31130f['stack']);if(_0x31130f[_0xa362('0x29')]){delete _0x31130f[_0xa362('0x29')];}_0x1d970b[_0xa362('0x1c')](_0x2b5128)[_0xa362('0x2a')](_0x31130f);};}exports[_0xa362('0x2b')]=function(_0xd70c1,_0x11531a){var _0x507ce1={},_0x42653b={},_0x350584={'count':0x0,'rows':[]};var _0x49ac8b=_[_0xa362('0x2c')](db['VoiceMailMessage'][_0xa362('0x2d')],function(_0x1700d9){return{'name':_0x1700d9[_0xa362('0x2e')],'type':_0x1700d9[_0xa362('0x2f')][_0xa362('0x30')]};});_0x42653b[_0xa362('0x31')]=_[_0xa362('0x32')](_[_0xa362('0x2c')](_0x49ac8b,'name'),[_0xa362('0x29')]);_0x42653b[_0xa362('0x33')]=_[_0xa362('0x34')](_0xd70c1[_0xa362('0x33')]);_0x42653b[_0xa362('0x35')]=_[_0xa362('0x36')](_0x42653b[_0xa362('0x31')],_0x42653b[_0xa362('0x33')]);_0x507ce1[_0xa362('0x37')]=_[_0xa362('0x36')](_0x42653b[_0xa362('0x31')],qs[_0xa362('0x38')](_0xd70c1[_0xa362('0x33')][_0xa362('0x38')]));_0x507ce1[_0xa362('0x37')]=_0x507ce1['attributes'][_0xa362('0x39')]?_0x507ce1[_0xa362('0x37')]:_0x42653b[_0xa362('0x31')];if(!_0xd70c1[_0xa362('0x33')][_0xa362('0x3a')]('nolimit')){_0x507ce1[_0xa362('0x3b')]=qs[_0xa362('0x3b')](_0xd70c1[_0xa362('0x33')][_0xa362('0x3b')]);_0x507ce1[_0xa362('0x1e')]=qs[_0xa362('0x1e')](_0xd70c1[_0xa362('0x33')][_0xa362('0x1e')]);}_0x507ce1[_0xa362('0x3c')]=qs[_0xa362('0x3d')](_0xd70c1[_0xa362('0x33')][_0xa362('0x3d')]);_0x507ce1[_0xa362('0x3e')]=qs[_0xa362('0x35')](_[_0xa362('0x3f')](_0xd70c1[_0xa362('0x33')],_0x42653b[_0xa362('0x35')]),_0x49ac8b);if(_0xd70c1['query'][_0xa362('0x40')]){_0x507ce1['where']=_[_0xa362('0x41')](_0x507ce1[_0xa362('0x3e')],{'$or':_[_0xa362('0x2c')](_0x49ac8b,function(_0x4153e9){if(_0x4153e9[_0xa362('0x2f')]!==_0xa362('0x42')){var _0x125053={};_0x125053[_0x4153e9[_0xa362('0x29')]]={'$like':'%'+_0xd70c1['query'][_0xa362('0x40')]+'%'};return _0x125053;}})});}_0x507ce1=_[_0xa362('0x41')]({},_0x507ce1,_0xd70c1[_0xa362('0x43')]);var _0x4ab809={'where':_0x507ce1['where']};return db[_0xa362('0x44')][_0xa362('0x20')](_0x4ab809)[_0xa362('0x25')](function(_0x5a3897){_0x350584['count']=_0x5a3897;if(_0xd70c1['query'][_0xa362('0x45')]){_0x507ce1[_0xa362('0x46')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xa362('0x47')](_0x507ce1);})[_0xa362('0x25')](function(_0x2b5d85){_0x350584[_0xa362('0x48')]=_0x2b5d85;return _0x350584;})[_0xa362('0x25')](respondWithFilteredResult(_0x11531a,_0x507ce1))[_0xa362('0x49')](handleError(_0x11531a,null));};exports[_0xa362('0x4a')]=function(_0x521c13,_0x7713df){var _0x49f590={'raw':!![],'where':{'id':_0x521c13[_0xa362('0x4b')]['id']}},_0x3e058c={};_0x3e058c[_0xa362('0x31')]=_[_0xa362('0x34')](db[_0xa362('0x44')]['rawAttributes']);_0x3e058c[_0xa362('0x33')]=_[_0xa362('0x34')](_0x521c13[_0xa362('0x33')]);_0x3e058c[_0xa362('0x35')]=_[_0xa362('0x36')](_0x3e058c[_0xa362('0x31')],_0x3e058c[_0xa362('0x33')]);_0x49f590[_0xa362('0x37')]=_['intersection'](_0x3e058c[_0xa362('0x31')],qs[_0xa362('0x38')](_0x521c13[_0xa362('0x33')][_0xa362('0x38')]));_0x49f590['attributes']=_0x49f590[_0xa362('0x37')][_0xa362('0x39')]?_0x49f590[_0xa362('0x37')]:_0x3e058c[_0xa362('0x31')];if(_0x521c13[_0xa362('0x33')][_0xa362('0x45')]){_0x49f590['include']=[{'all':!![]}];}_0x49f590=_[_0xa362('0x41')]({},_0x49f590,_0x521c13['options']);return db['VoiceMailMessage'][_0xa362('0x4c')](_0x49f590)[_0xa362('0x25')](handleEntityNotFound(_0x7713df,null))['then'](respondWithResult(_0x7713df,null))[_0xa362('0x49')](handleError(_0x7713df,null));};exports[_0xa362('0x4d')]=function(_0x40b283,_0x1bc64c){return db['VoiceMailMessage'][_0xa362('0x4d')](_0x40b283[_0xa362('0x4e')],{})[_0xa362('0x25')](respondWithResult(_0x1bc64c,0xc9))[_0xa362('0x49')](handleError(_0x1bc64c,null));};exports[_0xa362('0x24')]=function(_0x5b0114,_0x396443){if(_0x5b0114[_0xa362('0x4e')]['id']){delete _0x5b0114[_0xa362('0x4e')]['id'];}return db[_0xa362('0x44')][_0xa362('0x4c')]({'where':{'id':_0x5b0114[_0xa362('0x4b')]['id']}})[_0xa362('0x25')](handleEntityNotFound(_0x396443,null))[_0xa362('0x25')](saveUpdates(_0x5b0114[_0xa362('0x4e')],null))[_0xa362('0x25')](respondWithResult(_0x396443,null))[_0xa362('0x49')](handleError(_0x396443,null));};exports['destroy']=function(_0x9ddbe4,_0x5a6d04){return db[_0xa362('0x44')][_0xa362('0x4c')]({'where':{'id':_0x9ddbe4[_0xa362('0x4b')]['id']}})[_0xa362('0x25')](handleEntityNotFound(_0x5a6d04,null))[_0xa362('0x25')](removeEntity(_0x5a6d04,null))[_0xa362('0x49')](handleError(_0x5a6d04,null));};exports[_0xa362('0x4f')]=function(_0x2da9ad,_0x359b6b,_0x49fe0f){return db['VoiceMailMessage'][_0xa362('0x4c')]({'where':{'id':_0x2da9ad[_0xa362('0x4b')]['id']},'attributes':['id','recording',_0xa362('0x50')]})['then'](handleEntityNotFound(_0x359b6b,null))[_0xa362('0x25')](function(_0x1d04d6){if(_0x1d04d6){if(!_0x1d04d6[_0xa362('0x51')]){throw new db[(_0xa362('0x52'))][(_0xa362('0x53'))](_0xa362('0x54'));}var _0x978010={'Content-Type':_0xa362('0x55'),'Content-Disposition':'attachment'};if(_0x1d04d6[_0xa362('0x50')]){_0x978010[_0xa362('0x56')]=_0xa362('0x57')+_0x1d04d6[_0xa362('0x50')]+_0xa362('0x58');}_0x359b6b[_0xa362('0x21')](_0x978010);return _0x359b6b[_0xa362('0x2a')](new Buffer(_0x1d04d6[_0xa362('0x51')]));}})['catch'](handleError(_0x359b6b,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 3467cf4..800d859 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 _0xda92=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x3724b1,_0x505127){var _0x3c4507=function(_0x589996){while(--_0x589996){_0x3724b1['push'](_0x3724b1['shift']());}};_0x3c4507(++_0x505127);}(_0xda92,0xa4));var _0x2da9=function(_0x2ee4fb,_0x3de151){_0x2ee4fb=_0x2ee4fb-0x0;var _0x343e4b=_0xda92[_0x2ee4fb];return _0x343e4b;};'use strict';var _=require(_0x2da9('0x0'));var util=require(_0x2da9('0x1'));var logger=require(_0x2da9('0x2'))(_0x2da9('0x3'));var moment=require(_0x2da9('0x4'));var BPromise=require(_0x2da9('0x5'));var rp=require(_0x2da9('0x6'));var fs=require('fs');var path=require(_0x2da9('0x7'));var rimraf=require(_0x2da9('0x8'));var config=require(_0x2da9('0x9'));var attributes=require(_0x2da9('0xa'));module['exports']=function(_0x2456a1,_0x5816f6){return _0x2456a1[_0x2da9('0xb')](_0x2da9('0xc'),attributes,{'tableName':_0x2da9('0xd'),'paranoid':![],'indexes':[{'name':_0x2da9('0xe'),'fields':[_0x2da9('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xe05e=['api','moment','path','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash','util','../../config/logger'];(function(_0x433117,_0x1d2e0e){var _0x20aca0=function(_0x19536b){while(--_0x19536b){_0x433117['push'](_0x433117['shift']());}};_0x20aca0(++_0x1d2e0e);}(_0xe05e,0x168));var _0xee05=function(_0x479509,_0x1daf8a){_0x479509=_0x479509-0x0;var _0x382da8=_0xe05e[_0x479509];return _0x382da8;};'use strict';var _=require(_0xee05('0x0'));var util=require(_0xee05('0x1'));var logger=require(_0xee05('0x2'))(_0xee05('0x3'));var moment=require(_0xee05('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xee05('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xee05('0x6'));module[_0xee05('0x7')]=function(_0x3a39d7,_0x356806){return _0x3a39d7[_0xee05('0x8')]('VoiceMailMessage',attributes,{'tableName':_0xee05('0x9'),'paranoid':![],'indexes':[{'name':_0xee05('0xa'),'fields':[_0xee05('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 3bfd111..074c9cb 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 _0x405d=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x27521e,_0x5a23c8){var _0x7d880b=function(_0x3ab111){while(--_0x3ab111){_0x27521e['push'](_0x27521e['shift']());}};_0x7d880b(++_0x5a23c8);}(_0x405d,0x151));var _0xd405=function(_0x3445a7,_0x285439){_0x3445a7=_0x3445a7-0x0;var _0x2aec67=_0x405d[_0x3445a7];return _0x2aec67;};'use strict';var _=require(_0xd405('0x0'));var util=require('util');var moment=require(_0xd405('0x1'));var BPromise=require(_0xd405('0x2'));var rs=require(_0xd405('0x3'));var fs=require('fs');var Redis=require(_0xd405('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd405('0x5'));var logger=require(_0xd405('0x6'))(_0xd405('0x7'));var config=require(_0xd405('0x8'));var jayson=require(_0xd405('0x9'));var client=jayson[_0xd405('0xa')][_0xd405('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x500397,_0x7d760a,_0x22119c){return new BPromise(function(_0x5c6c46,_0x1ad480){return client[_0xd405('0xc')](_0x500397,_0x22119c)['then'](function(_0x3b547b){logger[_0xd405('0xd')](_0xd405('0xe'),_0x7d760a,_0xd405('0xf'));logger[_0xd405('0x10')](_0xd405('0x11'),_0x7d760a,'request\x20sent',JSON[_0xd405('0x12')](_0x3b547b));if(_0x3b547b[_0xd405('0x13')]){if(_0x3b547b[_0xd405('0x13')][_0xd405('0x14')]===0x1f4){logger[_0xd405('0x13')](_0xd405('0xe'),_0x7d760a,_0x3b547b[_0xd405('0x13')][_0xd405('0x15')]);return _0x1ad480(_0x3b547b[_0xd405('0x13')]['message']);}logger[_0xd405('0x13')](_0xd405('0xe'),_0x7d760a,_0x3b547b[_0xd405('0x13')][_0xd405('0x15')]);return _0x5c6c46(_0x3b547b[_0xd405('0x13')][_0xd405('0x15')]);}else{logger[_0xd405('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x7d760a,_0xd405('0xf'));_0x5c6c46(_0x3b547b[_0xd405('0x16')][_0xd405('0x15')]);}})[_0xd405('0x17')](function(_0x2a973c){logger[_0xd405('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x7d760a,_0x2a973c);_0x1ad480(_0x2a973c);});});} \ No newline at end of file +var _0xaaf9=['then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request'];(function(_0x40283c,_0x4b4fab){var _0x340a61=function(_0x380fc0){while(--_0x380fc0){_0x40283c['push'](_0x40283c['shift']());}};_0x340a61(++_0x4b4fab);}(_0xaaf9,0x16a));var _0x9aaf=function(_0x3ff5aa,_0x448252){_0x3ff5aa=_0x3ff5aa-0x0;var _0x78ee80=_0xaaf9[_0x3ff5aa];return _0x78ee80;};'use strict';var _=require(_0x9aaf('0x0'));var util=require(_0x9aaf('0x1'));var moment=require(_0x9aaf('0x2'));var BPromise=require(_0x9aaf('0x3'));var rs=require(_0x9aaf('0x4'));var fs=require('fs');var Redis=require(_0x9aaf('0x5'));var db=require(_0x9aaf('0x6'))['db'];var utils=require(_0x9aaf('0x7'));var logger=require(_0x9aaf('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9aaf('0x9'));var client=jayson['client'][_0x9aaf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf300a4,_0x735000,_0x5a8abe){return new BPromise(function(_0x3d6eed,_0x19717a){return client[_0x9aaf('0xb')](_0xf300a4,_0x5a8abe)[_0x9aaf('0xc')](function(_0x3b4676){logger[_0x9aaf('0xd')](_0x9aaf('0xe'),_0x735000,_0x9aaf('0xf'));logger[_0x9aaf('0x10')](_0x9aaf('0x11'),_0x735000,_0x9aaf('0xf'),JSON[_0x9aaf('0x12')](_0x3b4676));if(_0x3b4676[_0x9aaf('0x13')]){if(_0x3b4676[_0x9aaf('0x13')]['code']===0x1f4){logger['error'](_0x9aaf('0xe'),_0x735000,_0x3b4676[_0x9aaf('0x13')][_0x9aaf('0x14')]);return _0x19717a(_0x3b4676[_0x9aaf('0x13')]['message']);}logger[_0x9aaf('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x735000,_0x3b4676['error']['message']);return _0x3d6eed(_0x3b4676['error']['message']);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x735000,_0x9aaf('0xf'));_0x3d6eed(_0x3b4676['result'][_0x9aaf('0x14')]);}})[_0x9aaf('0x15')](function(_0xc53fb9){logger[_0x9aaf('0x13')](_0x9aaf('0xe'),_0x735000,_0xc53fb9);_0x19717a(_0xc53fb9);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index e5b9ba0..7c30187 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 _0xca3e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','/:id','get','/:id/sounds','getSounds','post','create','addSound','delete','/:id/sounds/:id2','removeSound','exports','path','connect-timeout','express'];(function(_0x416330,_0x3a8fc1){var _0x478ab7=function(_0x3b9763){while(--_0x3b9763){_0x416330['push'](_0x416330['shift']());}};_0x478ab7(++_0x3a8fc1);}(_0xca3e,0x18d));var _0xeca3=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xca3e[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeca3('0x0'));var timeout=require(_0xeca3('0x1'));var express=require(_0xeca3('0x2'));var router=express['Router']();var fs_extra=require(_0xeca3('0x3'));var auth=require(_0xeca3('0x4'));var interaction=require(_0xeca3('0x5'));var config=require(_0xeca3('0x6'));var controller=require(_0xeca3('0x7'));router['get']('/',auth[_0xeca3('0x8')](),controller['index']);router['get'](_0xeca3('0x9'),auth[_0xeca3('0x8')](),controller['show']);router[_0xeca3('0xa')](_0xeca3('0xb'),auth[_0xeca3('0x8')](),controller[_0xeca3('0xc')]);router[_0xeca3('0xd')]('/',auth[_0xeca3('0x8')](),controller[_0xeca3('0xe')]);router['post'](_0xeca3('0xb'),auth[_0xeca3('0x8')](),controller[_0xeca3('0xf')]);router['put'](_0xeca3('0x9'),auth[_0xeca3('0x8')](),controller['update']);router[_0xeca3('0x10')](_0xeca3('0x9'),auth[_0xeca3('0x8')](),controller['destroy']);router[_0xeca3('0x10')](_0xeca3('0x11'),auth[_0xeca3('0x8')](),controller[_0xeca3('0x12')]);module[_0xeca3('0x13')]=router; \ No newline at end of file +var _0x735b=['addSound','put','update','delete','destroy','removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','/:id','isAuthenticated','show','/:id/sounds','create'];(function(_0x3cac61,_0x62fed0){var _0x570b82=function(_0x2d5bef){while(--_0x2d5bef){_0x3cac61['push'](_0x3cac61['shift']());}};_0x570b82(++_0x62fed0);}(_0x735b,0x104));var _0xb735=function(_0x436bb6,_0x1fdaf6){_0x436bb6=_0x436bb6-0x0;var _0x20a27e=_0x735b[_0x436bb6];return _0x20a27e;};'use strict';var multer=require(_0xb735('0x0'));var util=require(_0xb735('0x1'));var path=require(_0xb735('0x2'));var timeout=require(_0xb735('0x3'));var express=require(_0xb735('0x4'));var router=express[_0xb735('0x5')]();var fs_extra=require(_0xb735('0x6'));var auth=require(_0xb735('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb735('0x8'));var controller=require(_0xb735('0x9'));router[_0xb735('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb735('0xa')](_0xb735('0xb'),auth[_0xb735('0xc')](),controller[_0xb735('0xd')]);router[_0xb735('0xa')](_0xb735('0xe'),auth['isAuthenticated'](),controller['getSounds']);router['post']('/',auth[_0xb735('0xc')](),controller[_0xb735('0xf')]);router['post'](_0xb735('0xe'),auth[_0xb735('0xc')](),controller[_0xb735('0x10')]);router[_0xb735('0x11')](_0xb735('0xb'),auth['isAuthenticated'](),controller[_0xb735('0x12')]);router[_0xb735('0x13')](_0xb735('0xb'),auth[_0xb735('0xc')](),controller[_0xb735('0x14')]);router['delete']('/:id/sounds/:id2',auth[_0xb735('0xc')](),controller[_0xb735('0x15')]);module[_0xb735('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index f598a49..0cdefbd 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 _0x3a58=['mp3nb','quietmp3nb','quietmp3','mp3','STRING','exports','ENUM','custom','files'];(function(_0xa5b97,_0x5b090b){var _0x114ead=function(_0x4b7a28){while(--_0x4b7a28){_0xa5b97['push'](_0xa5b97['shift']());}};_0x114ead(++_0x5b090b);}(_0x3a58,0x68));var _0x83a5=function(_0x56e1e3,_0x5959dc){_0x56e1e3=_0x56e1e3-0x0;var _0x47b0f4=_0x3a58[_0x56e1e3];return _0x47b0f4;};'use strict';var Sequelize=require('sequelize');module[_0x83a5('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x83a5('0x1')](_0x83a5('0x2'),_0x83a5('0x3'),_0x83a5('0x4'),_0x83a5('0x5'),_0x83a5('0x6'),_0x83a5('0x7')),'allowNull':!![],'defaultValue':_0x83a5('0x3')},'directory':{'type':Sequelize[_0x83a5('0x8')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x83a5('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x83a5('0x8')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x83a5('0x8')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x350f=['files','quietmp3nb','alpha','TIMESTAMP','sequelize','exports','STRING','name','ENUM','custom'];(function(_0x1b596c,_0x428304){var _0x34c572=function(_0xaa4503){while(--_0xaa4503){_0x1b596c['push'](_0x1b596c['shift']());}};_0x34c572(++_0x428304);}(_0x350f,0x108));var _0xf350=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x350f[_0x3826ad];return _0x17b900;};'use strict';var Sequelize=require(_0xf350('0x0'));module[_0xf350('0x1')]={'name':{'type':Sequelize[_0xf350('0x2')],'allowNull':![],'unique':_0xf350('0x3')},'mode':{'type':Sequelize[_0xf350('0x4')](_0xf350('0x5'),_0xf350('0x6'),'mp3nb',_0xf350('0x7'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0xf350('0x6')},'directory':{'type':Sequelize[_0xf350('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xf350('0x2')],'allowNull':!![],'defaultValue':_0xf350('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xf350('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 b6d8b17..fcf775f 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 _0xd0c9=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','fields','body','find','create','sequelize','transaction','mode','files','server/files/moh','mkdirSync','0777','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','destroy','readdirSync','directory','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','root','server/files/sounds/converted','format','basename','extname','%s.%s','message','removeSound','id2','createdAt','getSounds','rimraf','zip-dir'];(function(_0x391811,_0x187aa0){var _0x4fb675=function(_0x177804){while(--_0x177804){_0x391811['push'](_0x391811['shift']());}};_0x4fb675(++_0x187aa0);}(_0xd0c9,0x73));var _0x9d0c=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xd0c9[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d0c('0x0'));var zipdir=require(_0x9d0c('0x1'));var jsonpatch=require(_0x9d0c('0x2'));var rp=require(_0x9d0c('0x3'));var moment=require(_0x9d0c('0x4'));var BPromise=require(_0x9d0c('0x5'));var Mustache=require(_0x9d0c('0x6'));var util=require(_0x9d0c('0x7'));var path=require(_0x9d0c('0x8'));var sox=require(_0x9d0c('0x9'));var csv=require(_0x9d0c('0xa'));var ejs=require(_0x9d0c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d0c('0xc'));var squel=require(_0x9d0c('0xd'));var crypto=require(_0x9d0c('0xe'));var jsforce=require(_0x9d0c('0xf'));var deskjs=require(_0x9d0c('0x10'));var toCsv=require(_0x9d0c('0xa'));var querystring=require(_0x9d0c('0x11'));var Papa=require(_0x9d0c('0x12'));var Redis=require('ioredis');var authService=require(_0x9d0c('0x13'));var qs=require(_0x9d0c('0x14'));var as=require(_0x9d0c('0x15'));var hardwareService=require(_0x9d0c('0x16'));var logger=require('../../config/logger')(_0x9d0c('0x17'));var utils=require(_0x9d0c('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9d0c('0x19'))['db'];function respondWithStatusCode(_0x20388c,_0x13d790){_0x13d790=_0x13d790||0xcc;return function(_0x410890){if(_0x410890){return _0x20388c[_0x9d0c('0x1a')](_0x13d790);}return _0x20388c[_0x9d0c('0x1b')](_0x13d790)[_0x9d0c('0x1c')]();};}function respondWithResult(_0x512a02,_0x34780b){_0x34780b=_0x34780b||0xc8;return function(_0x460c77){if(_0x460c77){return _0x512a02['status'](_0x34780b)[_0x9d0c('0x1d')](_0x460c77);}};}function respondWithFilteredResult(_0x5e8de0,_0x37b12){return function(_0x21ba77){if(_0x21ba77){var _0x511960=typeof _0x37b12['offset']===_0x9d0c('0x1e')&&typeof _0x37b12['limit']===_0x9d0c('0x1e');var _0x55ed30=_0x21ba77[_0x9d0c('0x1f')];var _0x5a5ac6=_0x511960?0x0:_0x37b12[_0x9d0c('0x20')];var _0x2e93c1=_0x511960?_0x21ba77[_0x9d0c('0x1f')]:_0x37b12['offset']+_0x37b12['limit'];var _0x16cb45;if(_0x2e93c1>=_0x55ed30){_0x2e93c1=_0x55ed30;_0x16cb45=0xc8;}else{_0x16cb45=0xce;}_0x5e8de0[_0x9d0c('0x1b')](_0x16cb45);return _0x5e8de0['set'](_0x9d0c('0x21'),_0x5a5ac6+'-'+_0x2e93c1+'/'+_0x55ed30)[_0x9d0c('0x1d')](_0x21ba77);}return null;};}function patchUpdates(_0x36d603){return function(_0x4999b9){try{jsonpatch[_0x9d0c('0x22')](_0x4999b9,_0x36d603,!![]);}catch(_0x4aef82){return BPromise[_0x9d0c('0x23')](_0x4aef82);}return _0x4999b9[_0x9d0c('0x24')]();};}function saveUpdates(_0x219efc,_0x22322f){return function(_0x2a91ff){if(_0x2a91ff){return _0x2a91ff[_0x9d0c('0x25')](_0x219efc)[_0x9d0c('0x26')](function(_0x3207ad){return _0x3207ad;});}return null;};}function removeEntity(_0x443c2c,_0x155c28){return function(_0x252650){if(_0x252650){return _0x252650['destroy']()[_0x9d0c('0x26')](function(){var _0x2b2b2b=_0x252650[_0x9d0c('0x27')]({'plain':!![]});var _0x164ef1=_0x9d0c('0x28');return db[_0x9d0c('0x29')]['destroy']({'where':{'type':_0x164ef1,'resourceId':_0x2b2b2b['id']}})[_0x9d0c('0x26')](function(){return _0x252650;});})[_0x9d0c('0x26')](function(){_0x443c2c[_0x9d0c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb94e9b,_0x167ad8){return function(_0x72c23f){if(!_0x72c23f){_0xb94e9b['sendStatus'](0x194);}return _0x72c23f;};}function handleError(_0x5c9485,_0x50b8b1){_0x50b8b1=_0x50b8b1||0x1f4;return function(_0x35183d){logger[_0x9d0c('0x2a')](_0x35183d[_0x9d0c('0x2b')]);if(_0x35183d['name']){delete _0x35183d[_0x9d0c('0x2c')];}_0x5c9485[_0x9d0c('0x1b')](_0x50b8b1)[_0x9d0c('0x2d')](_0x35183d);};}exports[_0x9d0c('0x2e')]=function(_0x53d0d5,_0x1daaaa){var _0x5f196a={},_0xfd69d3={},_0x186b6a={'count':0x0,'rows':[]};var _0x162572=_[_0x9d0c('0x2f')](db[_0x9d0c('0x30')][_0x9d0c('0x31')],function(_0x2cb5eb){return{'name':_0x2cb5eb[_0x9d0c('0x32')],'type':_0x2cb5eb[_0x9d0c('0x33')][_0x9d0c('0x34')]};});_0xfd69d3[_0x9d0c('0x35')]=_[_0x9d0c('0x2f')](_0x162572,'name');_0xfd69d3[_0x9d0c('0x36')]=_[_0x9d0c('0x37')](_0x53d0d5[_0x9d0c('0x36')]);_0xfd69d3[_0x9d0c('0x38')]=_[_0x9d0c('0x39')](_0xfd69d3[_0x9d0c('0x35')],_0xfd69d3[_0x9d0c('0x36')]);_0x5f196a[_0x9d0c('0x3a')]=_['intersection'](_0xfd69d3[_0x9d0c('0x35')],qs['fields'](_0x53d0d5['query']['fields']));_0x5f196a['attributes']=_0x5f196a[_0x9d0c('0x3a')][_0x9d0c('0x3b')]?_0x5f196a['attributes']:_0xfd69d3[_0x9d0c('0x35')];if(!_0x53d0d5[_0x9d0c('0x36')][_0x9d0c('0x3c')](_0x9d0c('0x3d'))){_0x5f196a[_0x9d0c('0x3e')]=qs[_0x9d0c('0x3e')](_0x53d0d5['query'][_0x9d0c('0x3e')]);_0x5f196a['offset']=qs[_0x9d0c('0x20')](_0x53d0d5[_0x9d0c('0x36')]['offset']);}_0x5f196a[_0x9d0c('0x3f')]=qs[_0x9d0c('0x40')](_0x53d0d5['query'][_0x9d0c('0x40')]);delete _0x53d0d5[_0x9d0c('0x36')][_0x9d0c('0x40')];_0x5f196a[_0x9d0c('0x41')]=qs[_0x9d0c('0x38')](_[_0x9d0c('0x42')](_0x53d0d5['query'],_0xfd69d3[_0x9d0c('0x38')]),_0x162572);if(_0x53d0d5[_0x9d0c('0x36')][_0x9d0c('0x43')]){_0x5f196a[_0x9d0c('0x41')]=_[_0x9d0c('0x44')](_0x5f196a[_0x9d0c('0x41')],{'$or':_[_0x9d0c('0x2f')](_0x162572,function(_0x2d9d07){if(_0x2d9d07[_0x9d0c('0x33')]!=='VIRTUAL'){var _0x33fe56={};_0x33fe56[_0x2d9d07[_0x9d0c('0x2c')]]={'$like':'%'+_0x53d0d5[_0x9d0c('0x36')][_0x9d0c('0x43')]+'%'};return _0x33fe56;}})});}_0x5f196a=_[_0x9d0c('0x44')]({},_0x5f196a,_0x53d0d5[_0x9d0c('0x45')]);var _0x154a44={'where':_0x5f196a[_0x9d0c('0x41')]};return db['VoiceMusicOnHold'][_0x9d0c('0x1f')](_0x154a44)[_0x9d0c('0x26')](function(_0x53fb3a){_0x186b6a[_0x9d0c('0x1f')]=_0x53fb3a;if(_0x53d0d5['query'][_0x9d0c('0x46')]){_0x5f196a[_0x9d0c('0x47')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x5f196a);})[_0x9d0c('0x26')](function(_0x50ac0b){_0x186b6a[_0x9d0c('0x48')]=_0x50ac0b;return _0x186b6a;})['then'](respondWithFilteredResult(_0x1daaaa,_0x5f196a))['catch'](handleError(_0x1daaaa,null));};exports[_0x9d0c('0x49')]=function(_0x1422a0,_0x4e34e0){var _0x246164={'raw':![],'where':{'id':_0x1422a0[_0x9d0c('0x4a')]['id']}},_0x25cf8={};_0x25cf8['model']=_['keys'](db[_0x9d0c('0x30')][_0x9d0c('0x31')]);_0x25cf8['query']=_[_0x9d0c('0x37')](_0x1422a0[_0x9d0c('0x36')]);_0x25cf8[_0x9d0c('0x38')]=_['intersection'](_0x25cf8['model'],_0x25cf8['query']);_0x246164[_0x9d0c('0x3a')]=_[_0x9d0c('0x39')](_0x25cf8[_0x9d0c('0x35')],qs[_0x9d0c('0x4b')](_0x1422a0[_0x9d0c('0x36')][_0x9d0c('0x4b')]));_0x246164[_0x9d0c('0x3a')]=_0x246164[_0x9d0c('0x3a')][_0x9d0c('0x3b')]?_0x246164[_0x9d0c('0x3a')]:_0x25cf8[_0x9d0c('0x35')];if(_0x1422a0[_0x9d0c('0x36')][_0x9d0c('0x46')]){_0x246164[_0x9d0c('0x47')]=[{'all':!![]}];}_0x246164=_[_0x9d0c('0x44')]({},_0x246164,_0x1422a0[_0x9d0c('0x45')]);return db[_0x9d0c('0x30')]['find'](_0x246164)[_0x9d0c('0x26')](handleEntityNotFound(_0x4e34e0,null))[_0x9d0c('0x26')](respondWithResult(_0x4e34e0,null))['catch'](handleError(_0x4e34e0,null));};exports[_0x9d0c('0x25')]=function(_0x3a72da,_0x363b18){if(_0x3a72da[_0x9d0c('0x4c')]['id']){delete _0x3a72da[_0x9d0c('0x4c')]['id'];}return db[_0x9d0c('0x30')][_0x9d0c('0x4d')]({'where':{'id':_0x3a72da[_0x9d0c('0x4a')]['id']}})[_0x9d0c('0x26')](handleEntityNotFound(_0x363b18,null))[_0x9d0c('0x26')](saveUpdates(_0x3a72da[_0x9d0c('0x4c')],null))[_0x9d0c('0x26')](respondWithResult(_0x363b18,null))['catch'](handleError(_0x363b18,null));};exports[_0x9d0c('0x4e')]=function(_0x22ce27,_0x387577,_0x255a24){return db[_0x9d0c('0x4f')][_0x9d0c('0x50')](function(_0x43b949){if(_0x22ce27['body'][_0x9d0c('0x51')]===_0x9d0c('0x52')){_0x22ce27[_0x9d0c('0x4c')]['directory']=path['join'](config['root'],_0x9d0c('0x53'),_0x22ce27[_0x9d0c('0x4c')][_0x9d0c('0x2c')]);}return db['VoiceMusicOnHold'][_0x9d0c('0x4e')](_0x22ce27[_0x9d0c('0x4c')],{'transaction':_0x43b949})[_0x9d0c('0x26')](function(_0x1e1084){if(_0x22ce27[_0x9d0c('0x4c')][_0x9d0c('0x51')]===_0x9d0c('0x52')){fs[_0x9d0c('0x54')](_0x1e1084['directory'],parseInt(_0x9d0c('0x55'),0x8));}var _0x4c2da8=_0x22ce27[_0x9d0c('0x56')]['get']({'plain':!![]});if(!_0x4c2da8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c2da8[_0x9d0c('0x57')]==='user'){var _0x202c06=_0x1e1084['get']({'plain':!![]});return db['UserProfileSection'][_0x9d0c('0x4d')]({'where':{'name':'MusicOnHolds','userProfileId':_0x4c2da8[_0x9d0c('0x58')]},'raw':!![]})[_0x9d0c('0x26')](function(_0x4a6239){if(_0x4a6239&&_0x4a6239[_0x9d0c('0x59')]===0x0){return db[_0x9d0c('0x29')][_0x9d0c('0x4e')]({'name':_0x202c06['name'],'resourceId':_0x202c06['id'],'type':_0x4a6239[_0x9d0c('0x2c')],'sectionId':_0x4a6239['id']},{})[_0x9d0c('0x26')](function(){return _0x1e1084;});}else{return _0x1e1084;}})['catch'](function(_0x334393){logger['error'](_0x9d0c('0x5a'),_0x334393);});}return _0x1e1084;});})[_0x9d0c('0x26')](respondWithResult(_0x387577,0xc9))[_0x9d0c('0x5b')](handleError(_0x387577,null));};exports[_0x9d0c('0x5c')]=function(_0x1aeba3,_0x35a753,_0x3f0194){var _0xc33050;return db[_0x9d0c('0x30')][_0x9d0c('0x4d')]({'where':{'id':_0x1aeba3[_0x9d0c('0x4a')]['id']}})[_0x9d0c('0x26')](function(_0x891aad){if(_0x891aad){return db[_0x9d0c('0x4f')][_0x9d0c('0x50')](function(_0x6f3d80){return _0x891aad[_0x9d0c('0x5c')]({'transaction':_0x6f3d80,'raw':!![]})[_0x9d0c('0x26')](function(_0x33a81f){if(_0x33a81f['directory']){fs[_0x9d0c('0x5d')](_0x33a81f[_0x9d0c('0x5e')])[_0x9d0c('0x5f')](function(_0x3089e9){fs[_0x9d0c('0x60')](path[_0x9d0c('0x61')](_0x33a81f[_0x9d0c('0x5e')],_0x3089e9));});fs[_0x9d0c('0x62')](_0x33a81f[_0x9d0c('0x5e')]);}return _0x33a81f;});})[_0x9d0c('0x5b')](function(_0x48ecbc){throw new db[(_0x9d0c('0x63'))][(_0x9d0c('0x64'))](_0x48ecbc['message']);});}})['then'](handleEntityNotFound(_0x35a753,null))[_0x9d0c('0x26')](removeEntity(_0x35a753,null))[_0x9d0c('0x5b')](handleError(_0x35a753,null));};exports[_0x9d0c('0x65')]=function(_0xa55b59,_0x5a43cd,_0x370e65){return db[_0x9d0c('0x4f')][_0x9d0c('0x50')](function(_0x354fca){var _0x13ad66;return db[_0x9d0c('0x30')]['find']({'where':{'id':_0xa55b59[_0x9d0c('0x4a')]['id']}})['then'](function(_0x45a6f2){if(_0x45a6f2){_0x13ad66=_0x45a6f2;return _0x45a6f2[_0x9d0c('0x65')](_0xa55b59[_0x9d0c('0x4c')]['id'],{'transaction':_0x354fca});}})[_0x9d0c('0x26')](function(_0x52dd10){if(_0x52dd10){return db[_0x9d0c('0x66')][_0x9d0c('0x67')]({'where':{'id':_0xa55b59[_0x9d0c('0x4c')]['id']},'attributes':['id',_0x9d0c('0x2c'),_0x9d0c('0x68'),_0x9d0c('0x69'),'createdAt'],'raw':!![]});}})[_0x9d0c('0x26')](function(_0xb26ed5){if(_0xb26ed5){var _0x2219eb=path[_0x9d0c('0x61')](config[_0x9d0c('0x6a')],_0x9d0c('0x6b'),util[_0x9d0c('0x6c')]('%s.%s',path[_0x9d0c('0x6d')](_0xb26ed5[_0x9d0c('0x68')],path[_0x9d0c('0x6e')](_0xb26ed5[_0x9d0c('0x68')])),_0xb26ed5[_0x9d0c('0x69')]));var _0x598bab=path['join'](config[_0x9d0c('0x6a')],_0x9d0c('0x53'),_0x13ad66[_0x9d0c('0x2c')],util[_0x9d0c('0x6c')](_0x9d0c('0x6f'),_0xb26ed5[_0x9d0c('0x2c')],_0xb26ed5['converted_format']));fs['symlinkSync'](_0x2219eb,_0x598bab);return _0xb26ed5;}})[_0x9d0c('0x5b')](function(_0x2251b5){throw new db[(_0x9d0c('0x63'))][(_0x9d0c('0x64'))](_0x2251b5[_0x9d0c('0x70')]);});})[_0x9d0c('0x26')](handleEntityNotFound(_0x5a43cd,null))[_0x9d0c('0x26')](respondWithResult(_0x5a43cd,0xc9))[_0x9d0c('0x5b')](handleError(_0x5a43cd,null));};exports[_0x9d0c('0x71')]=function(_0x3bf6b7,_0x25a82c,_0x5c9ec9){return db['sequelize']['transaction'](function(_0x547861){var _0x24314b;return db['VoiceMusicOnHold'][_0x9d0c('0x67')]({'where':{'id':_0x3bf6b7['params']['id']}})['then'](handleEntityNotFound(_0x25a82c,null))['then'](function(_0x5a7427){if(_0x5a7427){_0x24314b=_0x5a7427;return _0x5a7427[_0x9d0c('0x71')](_0x3bf6b7[_0x9d0c('0x4a')]['id2']);}})[_0x9d0c('0x26')](function(_0x4bf636){if(_0x4bf636){return db['Sound'][_0x9d0c('0x67')]({'where':{'id':_0x3bf6b7[_0x9d0c('0x4a')][_0x9d0c('0x72')]},'attributes':['id','name',_0x9d0c('0x68'),_0x9d0c('0x69'),_0x9d0c('0x73')],'raw':!![]});}})['then'](function(_0x30f5fd){if(_0x30f5fd){fs[_0x9d0c('0x60')](path[_0x9d0c('0x61')](_0x24314b[_0x9d0c('0x5e')],util[_0x9d0c('0x6c')](_0x9d0c('0x6f'),_0x30f5fd[_0x9d0c('0x2c')],_0x30f5fd['converted_format'])));return _0x30f5fd;}})['catch'](function(_0x390793){throw new db['Sequelize'][(_0x9d0c('0x64'))](_0x390793['message']);});})[_0x9d0c('0x26')](handleEntityNotFound(_0x25a82c,null))[_0x9d0c('0x26')](respondWithStatusCode(_0x25a82c,0xcc))[_0x9d0c('0x5b')](handleError(_0x25a82c,null));};exports['getSounds']=function(_0x33b5f8,_0x1c978a,_0x58cbb0){var _0x9d1377={};var _0x368e59={};var _0x381dc5;var _0x5a7ddd;return db[_0x9d0c('0x30')]['findOne']({'where':{'id':_0x33b5f8['params']['id']}})[_0x9d0c('0x26')](handleEntityNotFound(_0x1c978a,null))[_0x9d0c('0x26')](function(_0x36f025){if(_0x36f025){_0x381dc5=_0x36f025;_0x368e59[_0x9d0c('0x35')]=_[_0x9d0c('0x37')](db[_0x9d0c('0x66')][_0x9d0c('0x31')]);_0x368e59[_0x9d0c('0x36')]=_[_0x9d0c('0x37')](_0x33b5f8[_0x9d0c('0x36')]);_0x368e59[_0x9d0c('0x38')]=_[_0x9d0c('0x39')](_0x368e59['model'],_0x368e59[_0x9d0c('0x36')]);_0x9d1377[_0x9d0c('0x3a')]=_[_0x9d0c('0x39')](_0x368e59['model'],qs['fields'](_0x33b5f8['query']['fields']));_0x9d1377[_0x9d0c('0x3a')]=_0x9d1377['attributes']['length']?_0x9d1377[_0x9d0c('0x3a')]:_0x368e59[_0x9d0c('0x35')];_0x9d1377[_0x9d0c('0x3f')]=qs[_0x9d0c('0x40')](_0x33b5f8[_0x9d0c('0x36')]['sort']);_0x9d1377[_0x9d0c('0x41')]=qs['filters'](_[_0x9d0c('0x42')](_0x33b5f8[_0x9d0c('0x36')],_0x368e59[_0x9d0c('0x38')]));if(_0x33b5f8[_0x9d0c('0x36')][_0x9d0c('0x43')]){_0x9d1377['where']=_[_0x9d0c('0x44')](_0x9d1377[_0x9d0c('0x41')],{'$or':_[_0x9d0c('0x2f')](_0x9d1377[_0x9d0c('0x3a')],function(_0xc639d4){var _0x20e0ef={};_0x20e0ef[_0xc639d4]={'$like':'%'+_0x33b5f8['query']['filter']+'%'};return _0x20e0ef;})});}_0x9d1377=_[_0x9d0c('0x44')]({},_0x9d1377,_0x33b5f8[_0x9d0c('0x45')]);return _0x381dc5[_0x9d0c('0x74')](_0x9d1377);}})['then'](function(_0x4959ca){if(_0x4959ca){_0x5a7ddd=_0x4959ca[_0x9d0c('0x3b')];if(!_0x33b5f8[_0x9d0c('0x36')]['hasOwnProperty'](_0x9d0c('0x3d'))){_0x9d1377[_0x9d0c('0x3e')]=qs[_0x9d0c('0x3e')](_0x33b5f8[_0x9d0c('0x36')][_0x9d0c('0x3e')]);_0x9d1377[_0x9d0c('0x20')]=qs[_0x9d0c('0x20')](_0x33b5f8[_0x9d0c('0x36')][_0x9d0c('0x20')]);}return _0x381dc5[_0x9d0c('0x74')](_0x9d1377);}})['then'](function(_0x490291){if(_0x490291){return _0x490291?{'count':_0x5a7ddd,'rows':_0x490291}:null;}})[_0x9d0c('0x26')](respondWithResult(_0x1c978a,null))[_0x9d0c('0x5b')](handleError(_0x1c978a,null));}; \ No newline at end of file +var _0x339f=['keys','merge','catch','body','find','create','sequelize','mode','files','directory','join','server/files/moh','mkdirSync','user','role','get','MusicOnHolds','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','transaction','findOne','converted_format','root','%s.%s','basename','save_name','extname','format','symlinkSync','removeSound','Sound','id2','createdAt','getSounds','eml-format','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','error','stack','send','map','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','where','type','VIRTUAL','name','filter','options','VoiceMusicOnHold','includeAll','findAll','params'];(function(_0x4ec909,_0x2b2037){var _0x750956=function(_0x41ffee){while(--_0x41ffee){_0x4ec909['push'](_0x4ec909['shift']());}};_0x750956(++_0x2b2037);}(_0x339f,0x100));var _0xf339=function(_0x47fbf1,_0x3308ee){_0x47fbf1=_0x47fbf1-0x0;var _0x4d11b2=_0x339f[_0x47fbf1];return _0x4d11b2;};'use strict';var emlformat=require(_0xf339('0x0'));var rimraf=require(_0xf339('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf339('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf339('0x3'));var util=require(_0xf339('0x4'));var path=require(_0xf339('0x5'));var sox=require(_0xf339('0x6'));var csv=require(_0xf339('0x7'));var ejs=require(_0xf339('0x8'));var fs=require('fs');var fs_extra=require(_0xf339('0x9'));var _=require(_0xf339('0xa'));var squel=require('squel');var crypto=require(_0xf339('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf339('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf339('0xd'));var Papa=require(_0xf339('0xe'));var Redis=require(_0xf339('0xf'));var authService=require(_0xf339('0x10'));var qs=require(_0xf339('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf339('0x12'));var logger=require(_0xf339('0x13'))(_0xf339('0x14'));var utils=require(_0xf339('0x15'));var config=require(_0xf339('0x16'));var licenseUtil=require(_0xf339('0x17'));var db=require(_0xf339('0x18'))['db'];function respondWithStatusCode(_0x58aded,_0x1744a1){_0x1744a1=_0x1744a1||0xcc;return function(_0x532db8){if(_0x532db8){return _0x58aded[_0xf339('0x19')](_0x1744a1);}return _0x58aded[_0xf339('0x1a')](_0x1744a1)[_0xf339('0x1b')]();};}function respondWithResult(_0x3ed65a,_0x3d7730){_0x3d7730=_0x3d7730||0xc8;return function(_0x248e81){if(_0x248e81){return _0x3ed65a['status'](_0x3d7730)[_0xf339('0x1c')](_0x248e81);}};}function respondWithFilteredResult(_0xd77850,_0x2a73ef){return function(_0x4e421d){if(_0x4e421d){var _0x2c5f95=typeof _0x2a73ef[_0xf339('0x1d')]===_0xf339('0x1e')&&typeof _0x2a73ef[_0xf339('0x1f')]===_0xf339('0x1e');var _0x44af93=_0x4e421d[_0xf339('0x20')];var _0x44f560=_0x2c5f95?0x0:_0x2a73ef[_0xf339('0x1d')];var _0x462a0d=_0x2c5f95?_0x4e421d['count']:_0x2a73ef[_0xf339('0x1d')]+_0x2a73ef[_0xf339('0x1f')];var _0x4eb8fa;if(_0x462a0d>=_0x44af93){_0x462a0d=_0x44af93;_0x4eb8fa=0xc8;}else{_0x4eb8fa=0xce;}_0xd77850[_0xf339('0x1a')](_0x4eb8fa);return _0xd77850[_0xf339('0x21')](_0xf339('0x22'),_0x44f560+'-'+_0x462a0d+'/'+_0x44af93)[_0xf339('0x1c')](_0x4e421d);}return null;};}function patchUpdates(_0x385028){return function(_0x1be7d9){try{jsonpatch[_0xf339('0x23')](_0x1be7d9,_0x385028,!![]);}catch(_0x55fde7){return BPromise[_0xf339('0x24')](_0x55fde7);}return _0x1be7d9['save']();};}function saveUpdates(_0x506e95,_0x365cea){return function(_0x3718be){if(_0x3718be){return _0x3718be[_0xf339('0x25')](_0x506e95)[_0xf339('0x26')](function(_0x1f8a7c){return _0x1f8a7c;});}return null;};}function removeEntity(_0x63ef43,_0x4bf27b){return function(_0x103191){if(_0x103191){return _0x103191[_0xf339('0x27')]()['then'](function(){var _0x2ac6c8=_0x103191['get']({'plain':!![]});var _0xadc780='MusicOnHolds';return db[_0xf339('0x28')][_0xf339('0x27')]({'where':{'type':_0xadc780,'resourceId':_0x2ac6c8['id']}})[_0xf339('0x26')](function(){return _0x103191;});})['then'](function(){_0x63ef43[_0xf339('0x1a')](0xcc)[_0xf339('0x1b')]();});}};}function handleEntityNotFound(_0x38f8b6,_0x2158ef){return function(_0x49c9de){if(!_0x49c9de){_0x38f8b6[_0xf339('0x19')](0x194);}return _0x49c9de;};}function handleError(_0x15082b,_0x3dbd4d){_0x3dbd4d=_0x3dbd4d||0x1f4;return function(_0x32a6a5){logger[_0xf339('0x29')](_0x32a6a5[_0xf339('0x2a')]);if(_0x32a6a5['name']){delete _0x32a6a5['name'];}_0x15082b[_0xf339('0x1a')](_0x3dbd4d)[_0xf339('0x2b')](_0x32a6a5);};}exports['index']=function(_0x4711a7,_0xc720de){var _0x1eff35={},_0x29141c={},_0x10b6df={'count':0x0,'rows':[]};var _0x13b8d0=_[_0xf339('0x2c')](db['VoiceMusicOnHold'][_0xf339('0x2d')],function(_0x4c3044){return{'name':_0x4c3044[_0xf339('0x2e')],'type':_0x4c3044['type'][_0xf339('0x2f')]};});_0x29141c[_0xf339('0x30')]=_[_0xf339('0x2c')](_0x13b8d0,'name');_0x29141c[_0xf339('0x31')]=_['keys'](_0x4711a7[_0xf339('0x31')]);_0x29141c['filters']=_[_0xf339('0x32')](_0x29141c[_0xf339('0x30')],_0x29141c[_0xf339('0x31')]);_0x1eff35[_0xf339('0x33')]=_[_0xf339('0x32')](_0x29141c[_0xf339('0x30')],qs[_0xf339('0x34')](_0x4711a7[_0xf339('0x31')][_0xf339('0x34')]));_0x1eff35[_0xf339('0x33')]=_0x1eff35[_0xf339('0x33')][_0xf339('0x35')]?_0x1eff35[_0xf339('0x33')]:_0x29141c[_0xf339('0x30')];if(!_0x4711a7[_0xf339('0x31')][_0xf339('0x36')]('nolimit')){_0x1eff35[_0xf339('0x1f')]=qs[_0xf339('0x1f')](_0x4711a7[_0xf339('0x31')][_0xf339('0x1f')]);_0x1eff35[_0xf339('0x1d')]=qs['offset'](_0x4711a7['query'][_0xf339('0x1d')]);}_0x1eff35['order']=qs[_0xf339('0x37')](_0x4711a7[_0xf339('0x31')][_0xf339('0x37')]);delete _0x4711a7[_0xf339('0x31')][_0xf339('0x37')];_0x1eff35['where']=qs[_0xf339('0x38')](_[_0xf339('0x39')](_0x4711a7[_0xf339('0x31')],_0x29141c[_0xf339('0x38')]),_0x13b8d0);if(_0x4711a7['query']['filter']){_0x1eff35['where']=_['merge'](_0x1eff35[_0xf339('0x3a')],{'$or':_[_0xf339('0x2c')](_0x13b8d0,function(_0x2bd809){if(_0x2bd809[_0xf339('0x3b')]!==_0xf339('0x3c')){var _0x51e63f={};_0x51e63f[_0x2bd809[_0xf339('0x3d')]]={'$like':'%'+_0x4711a7[_0xf339('0x31')][_0xf339('0x3e')]+'%'};return _0x51e63f;}})});}_0x1eff35=_['merge']({},_0x1eff35,_0x4711a7[_0xf339('0x3f')]);var _0x1678c3={'where':_0x1eff35[_0xf339('0x3a')]};return db[_0xf339('0x40')][_0xf339('0x20')](_0x1678c3)[_0xf339('0x26')](function(_0x5b42ac){_0x10b6df['count']=_0x5b42ac;if(_0x4711a7[_0xf339('0x31')][_0xf339('0x41')]){_0x1eff35['include']=[{'all':!![]}];}return db[_0xf339('0x40')][_0xf339('0x42')](_0x1eff35);})[_0xf339('0x26')](function(_0x1a0dd7){_0x10b6df['rows']=_0x1a0dd7;return _0x10b6df;})[_0xf339('0x26')](respondWithFilteredResult(_0xc720de,_0x1eff35))['catch'](handleError(_0xc720de,null));};exports['show']=function(_0x16182a,_0xe38ffb){var _0x1686b7={'raw':![],'where':{'id':_0x16182a[_0xf339('0x43')]['id']}},_0x366a4b={};_0x366a4b[_0xf339('0x30')]=_[_0xf339('0x44')](db['VoiceMusicOnHold'][_0xf339('0x2d')]);_0x366a4b[_0xf339('0x31')]=_[_0xf339('0x44')](_0x16182a[_0xf339('0x31')]);_0x366a4b['filters']=_['intersection'](_0x366a4b[_0xf339('0x30')],_0x366a4b[_0xf339('0x31')]);_0x1686b7[_0xf339('0x33')]=_[_0xf339('0x32')](_0x366a4b[_0xf339('0x30')],qs['fields'](_0x16182a['query'][_0xf339('0x34')]));_0x1686b7['attributes']=_0x1686b7[_0xf339('0x33')][_0xf339('0x35')]?_0x1686b7[_0xf339('0x33')]:_0x366a4b[_0xf339('0x30')];if(_0x16182a[_0xf339('0x31')]['includeAll']){_0x1686b7['include']=[{'all':!![]}];}_0x1686b7=_[_0xf339('0x45')]({},_0x1686b7,_0x16182a[_0xf339('0x3f')]);return db['VoiceMusicOnHold']['find'](_0x1686b7)[_0xf339('0x26')](handleEntityNotFound(_0xe38ffb,null))[_0xf339('0x26')](respondWithResult(_0xe38ffb,null))[_0xf339('0x46')](handleError(_0xe38ffb,null));};exports[_0xf339('0x25')]=function(_0x14d09c,_0x509963){if(_0x14d09c['body']['id']){delete _0x14d09c[_0xf339('0x47')]['id'];}return db[_0xf339('0x40')][_0xf339('0x48')]({'where':{'id':_0x14d09c[_0xf339('0x43')]['id']}})[_0xf339('0x26')](handleEntityNotFound(_0x509963,null))[_0xf339('0x26')](saveUpdates(_0x14d09c[_0xf339('0x47')],null))[_0xf339('0x26')](respondWithResult(_0x509963,null))[_0xf339('0x46')](handleError(_0x509963,null));};exports[_0xf339('0x49')]=function(_0xb0678a,_0x4d9a10,_0x427d79){return db[_0xf339('0x4a')]['transaction'](function(_0x190986){if(_0xb0678a[_0xf339('0x47')][_0xf339('0x4b')]===_0xf339('0x4c')){_0xb0678a[_0xf339('0x47')][_0xf339('0x4d')]=path[_0xf339('0x4e')](config['root'],_0xf339('0x4f'),_0xb0678a[_0xf339('0x47')][_0xf339('0x3d')]);}return db['VoiceMusicOnHold']['create'](_0xb0678a[_0xf339('0x47')],{'transaction':_0x190986})[_0xf339('0x26')](function(_0x1887d0){if(_0xb0678a[_0xf339('0x47')][_0xf339('0x4b')]===_0xf339('0x4c')){fs[_0xf339('0x50')](_0x1887d0[_0xf339('0x4d')],parseInt('0777',0x8));}var _0x24bb30=_0xb0678a[_0xf339('0x51')]['get']({'plain':!![]});if(!_0x24bb30)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24bb30[_0xf339('0x52')]===_0xf339('0x51')){var _0xada16a=_0x1887d0[_0xf339('0x53')]({'plain':!![]});return db['UserProfileSection'][_0xf339('0x48')]({'where':{'name':_0xf339('0x54'),'userProfileId':_0x24bb30['userProfileId']},'raw':!![]})[_0xf339('0x26')](function(_0x19f2da){if(_0x19f2da&&_0x19f2da['autoAssociation']===0x0){return db[_0xf339('0x28')][_0xf339('0x49')]({'name':_0xada16a[_0xf339('0x3d')],'resourceId':_0xada16a['id'],'type':_0x19f2da[_0xf339('0x3d')],'sectionId':_0x19f2da['id']},{})[_0xf339('0x26')](function(){return _0x1887d0;});}else{return _0x1887d0;}})[_0xf339('0x46')](function(_0x39ef71){logger[_0xf339('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39ef71);});}return _0x1887d0;});})[_0xf339('0x26')](respondWithResult(_0x4d9a10,0xc9))[_0xf339('0x46')](handleError(_0x4d9a10,null));};exports['destroy']=function(_0x998023,_0x413dcf,_0xd72ff7){var _0x2b6ea4;return db[_0xf339('0x40')][_0xf339('0x48')]({'where':{'id':_0x998023[_0xf339('0x43')]['id']}})[_0xf339('0x26')](function(_0x306318){if(_0x306318){return db[_0xf339('0x4a')]['transaction'](function(_0x2151e6){return _0x306318['destroy']({'transaction':_0x2151e6,'raw':!![]})['then'](function(_0x18ef4a){if(_0x18ef4a['directory']){fs[_0xf339('0x55')](_0x18ef4a['directory'])[_0xf339('0x56')](function(_0x32d7d0){fs[_0xf339('0x57')](path[_0xf339('0x4e')](_0x18ef4a[_0xf339('0x4d')],_0x32d7d0));});fs[_0xf339('0x58')](_0x18ef4a[_0xf339('0x4d')]);}return _0x18ef4a;});})['catch'](function(_0x35a14d){throw new db[(_0xf339('0x59'))][(_0xf339('0x5a'))](_0x35a14d[_0xf339('0x5b')]);});}})[_0xf339('0x26')](handleEntityNotFound(_0x413dcf,null))[_0xf339('0x26')](removeEntity(_0x413dcf,null))[_0xf339('0x46')](handleError(_0x413dcf,null));};exports[_0xf339('0x5c')]=function(_0x5ba105,_0x3d2b54,_0x36f649){return db['sequelize'][_0xf339('0x5d')](function(_0x359ffd){var _0x2c925c;return db[_0xf339('0x40')][_0xf339('0x48')]({'where':{'id':_0x5ba105[_0xf339('0x43')]['id']}})['then'](function(_0x9dc6f6){if(_0x9dc6f6){_0x2c925c=_0x9dc6f6;return _0x9dc6f6[_0xf339('0x5c')](_0x5ba105['body']['id'],{'transaction':_0x359ffd});}})['then'](function(_0x4952bf){if(_0x4952bf){return db['Sound'][_0xf339('0x5e')]({'where':{'id':_0x5ba105['body']['id']},'attributes':['id','name','save_name',_0xf339('0x5f'),'createdAt'],'raw':!![]});}})[_0xf339('0x26')](function(_0x4b434a){if(_0x4b434a){var _0x5b0bcd=path[_0xf339('0x4e')](config[_0xf339('0x60')],'server/files/sounds/converted',util['format'](_0xf339('0x61'),path[_0xf339('0x62')](_0x4b434a[_0xf339('0x63')],path[_0xf339('0x64')](_0x4b434a[_0xf339('0x63')])),_0x4b434a[_0xf339('0x5f')]));var _0x4e93cd=path[_0xf339('0x4e')](config[_0xf339('0x60')],'server/files/moh',_0x2c925c[_0xf339('0x3d')],util[_0xf339('0x65')]('%s.%s',_0x4b434a[_0xf339('0x3d')],_0x4b434a[_0xf339('0x5f')]));fs[_0xf339('0x66')](_0x5b0bcd,_0x4e93cd);return _0x4b434a;}})[_0xf339('0x46')](function(_0x31653a){throw new db[(_0xf339('0x59'))][(_0xf339('0x5a'))](_0x31653a['message']);});})[_0xf339('0x26')](handleEntityNotFound(_0x3d2b54,null))[_0xf339('0x26')](respondWithResult(_0x3d2b54,0xc9))[_0xf339('0x46')](handleError(_0x3d2b54,null));};exports[_0xf339('0x67')]=function(_0x5827f3,_0x3fd269,_0xf0b63a){return db[_0xf339('0x4a')][_0xf339('0x5d')](function(_0x8e04e3){var _0x54a45b;return db[_0xf339('0x40')][_0xf339('0x5e')]({'where':{'id':_0x5827f3[_0xf339('0x43')]['id']}})[_0xf339('0x26')](handleEntityNotFound(_0x3fd269,null))['then'](function(_0x2b66d0){if(_0x2b66d0){_0x54a45b=_0x2b66d0;return _0x2b66d0[_0xf339('0x67')](_0x5827f3[_0xf339('0x43')]['id2']);}})['then'](function(_0x70baa6){if(_0x70baa6){return db[_0xf339('0x68')][_0xf339('0x5e')]({'where':{'id':_0x5827f3[_0xf339('0x43')][_0xf339('0x69')]},'attributes':['id','name',_0xf339('0x63'),_0xf339('0x5f'),_0xf339('0x6a')],'raw':!![]});}})[_0xf339('0x26')](function(_0x33f5e3){if(_0x33f5e3){fs[_0xf339('0x57')](path['join'](_0x54a45b[_0xf339('0x4d')],util[_0xf339('0x65')](_0xf339('0x61'),_0x33f5e3['name'],_0x33f5e3[_0xf339('0x5f')])));return _0x33f5e3;}})[_0xf339('0x46')](function(_0x38ea7b){throw new db['Sequelize']['ValidationError'](_0x38ea7b['message']);});})['then'](handleEntityNotFound(_0x3fd269,null))[_0xf339('0x26')](respondWithStatusCode(_0x3fd269,0xcc))[_0xf339('0x46')](handleError(_0x3fd269,null));};exports[_0xf339('0x6b')]=function(_0x1ddf31,_0x425a3c,_0xcb687){var _0x3c6577={};var _0x358070={};var _0x59bb45;var _0x5a809f;return db[_0xf339('0x40')][_0xf339('0x5e')]({'where':{'id':_0x1ddf31[_0xf339('0x43')]['id']}})[_0xf339('0x26')](handleEntityNotFound(_0x425a3c,null))[_0xf339('0x26')](function(_0xfd93c3){if(_0xfd93c3){_0x59bb45=_0xfd93c3;_0x358070[_0xf339('0x30')]=_[_0xf339('0x44')](db[_0xf339('0x68')][_0xf339('0x2d')]);_0x358070[_0xf339('0x31')]=_[_0xf339('0x44')](_0x1ddf31['query']);_0x358070[_0xf339('0x38')]=_[_0xf339('0x32')](_0x358070[_0xf339('0x30')],_0x358070[_0xf339('0x31')]);_0x3c6577[_0xf339('0x33')]=_[_0xf339('0x32')](_0x358070[_0xf339('0x30')],qs[_0xf339('0x34')](_0x1ddf31[_0xf339('0x31')][_0xf339('0x34')]));_0x3c6577[_0xf339('0x33')]=_0x3c6577[_0xf339('0x33')]['length']?_0x3c6577[_0xf339('0x33')]:_0x358070[_0xf339('0x30')];_0x3c6577['order']=qs['sort'](_0x1ddf31[_0xf339('0x31')][_0xf339('0x37')]);_0x3c6577['where']=qs[_0xf339('0x38')](_[_0xf339('0x39')](_0x1ddf31[_0xf339('0x31')],_0x358070[_0xf339('0x38')]));if(_0x1ddf31[_0xf339('0x31')][_0xf339('0x3e')]){_0x3c6577[_0xf339('0x3a')]=_[_0xf339('0x45')](_0x3c6577[_0xf339('0x3a')],{'$or':_[_0xf339('0x2c')](_0x3c6577[_0xf339('0x33')],function(_0xcc9793){var _0x241136={};_0x241136[_0xcc9793]={'$like':'%'+_0x1ddf31['query'][_0xf339('0x3e')]+'%'};return _0x241136;})});}_0x3c6577=_[_0xf339('0x45')]({},_0x3c6577,_0x1ddf31[_0xf339('0x3f')]);return _0x59bb45[_0xf339('0x6b')](_0x3c6577);}})['then'](function(_0x7b0715){if(_0x7b0715){_0x5a809f=_0x7b0715['length'];if(!_0x1ddf31[_0xf339('0x31')]['hasOwnProperty']('nolimit')){_0x3c6577[_0xf339('0x1f')]=qs['limit'](_0x1ddf31[_0xf339('0x31')][_0xf339('0x1f')]);_0x3c6577[_0xf339('0x1d')]=qs[_0xf339('0x1d')](_0x1ddf31[_0xf339('0x31')][_0xf339('0x1d')]);}return _0x59bb45[_0xf339('0x6b')](_0x3c6577);}})[_0xf339('0x26')](function(_0x223227){if(_0x223227){return _0x223227?{'count':_0x5a809f,'rows':_0x223227}:null;}})[_0xf339('0x26')](respondWithResult(_0x425a3c,null))['catch'](handleError(_0x425a3c,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index ad310b8..b538ae0 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 _0x6ab1=['rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x13178a,_0x23c431){var _0x4411d9=function(_0x3dfe02){while(--_0x3dfe02){_0x13178a['push'](_0x13178a['shift']());}};_0x4411d9(++_0x23c431);}(_0x6ab1,0x124));var _0x16ab=function(_0x4cb272,_0x52c0e9){_0x4cb272=_0x4cb272-0x0;var _0x57b4aa=_0x6ab1[_0x4cb272];return _0x57b4aa;};'use strict';var _=require(_0x16ab('0x0'));var util=require(_0x16ab('0x1'));var logger=require(_0x16ab('0x2'))(_0x16ab('0x3'));var moment=require(_0x16ab('0x4'));var BPromise=require('bluebird');var rp=require(_0x16ab('0x5'));var fs=require('fs');var path=require(_0x16ab('0x6'));var rimraf=require(_0x16ab('0x7'));var config=require(_0x16ab('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x16ab('0x9')]=function(_0x55ade2,_0x23222b){return _0x55ade2[_0x16ab('0xa')](_0x16ab('0xb'),attributes,{'tableName':_0x16ab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb69f=['moment','bluebird','request-promise','path','../../config/environment','exports','define','VoiceMusicOnHold','../../config/logger','api'];(function(_0x4d7da1,_0x1300f1){var _0x42c4ab=function(_0x2fb9e2){while(--_0x2fb9e2){_0x4d7da1['push'](_0x4d7da1['shift']());}};_0x42c4ab(++_0x1300f1);}(_0xb69f,0x166));var _0xfb69=function(_0x12bde6,_0x1c6345){_0x12bde6=_0x12bde6-0x0;var _0x234f12=_0xb69f[_0x12bde6];return _0x234f12;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfb69('0x0'))(_0xfb69('0x1'));var moment=require(_0xfb69('0x2'));var BPromise=require(_0xfb69('0x3'));var rp=require(_0xfb69('0x4'));var fs=require('fs');var path=require(_0xfb69('0x5'));var rimraf=require('rimraf');var config=require(_0xfb69('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xfb69('0x7')]=function(_0x13e722,_0x1cd042){return _0x13e722[_0xfb69('0x8')](_0xfb69('0x9'),attributes,{'tableName':'voice_musiconhold','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 4170151..67b783f 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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0xfb1192,_0x1efde6){var _0x33c542=function(_0x1b0325){while(--_0x1b0325){_0xfb1192['push'](_0xfb1192['shift']());}};_0x33c542(++_0x1efde6);}(_0xedd9,0xfc));var _0x9edd=function(_0x24a23e,_0x576d31){_0x24a23e=_0x24a23e-0x0;var _0x51073c=_0xedd9[_0x24a23e];return _0x51073c;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3b08cc,_0x12839b){var _0x5d5bb6=function(_0x1628de){while(--_0x1628de){_0x3b08cc['push'](_0x3b08cc['shift']());}};_0x5d5bb6(++_0x12839b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 399cfed..5eadffd 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 _0x871e=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','show','/:id/users','getAgents','/:id/teams','getTeams','post','addAgents','addTeams','put','/:id','destroy','delete','removeAgents','removeTeams'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0x871e,0x1b0));var _0xe871=function(_0x4f76db,_0x48a942){_0x4f76db=_0x4f76db-0x0;var _0x5c8b10=_0x871e[_0x4f76db];return _0x5c8b10;};'use strict';var multer=require(_0xe871('0x0'));var util=require('util');var path=require(_0xe871('0x1'));var timeout=require(_0xe871('0x2'));var express=require(_0xe871('0x3'));var router=express[_0xe871('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe871('0x5'));var interaction=require(_0xe871('0x6'));var config=require(_0xe871('0x7'));var controller=require(_0xe871('0x8'));router[_0xe871('0x9')]('/',auth[_0xe871('0xa')](),controller[_0xe871('0xb')]);router[_0xe871('0x9')](_0xe871('0xc'),auth[_0xe871('0xa')](),controller['describe']);router[_0xe871('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe871('0xd')]);router[_0xe871('0x9')](_0xe871('0xe'),auth['isAuthenticated'](),controller[_0xe871('0xf')]);router[_0xe871('0x9')](_0xe871('0x10'),auth[_0xe871('0xa')](),controller[_0xe871('0x11')]);router[_0xe871('0x12')]('/',auth[_0xe871('0xa')](),controller['create']);router[_0xe871('0x12')](_0xe871('0xe'),auth[_0xe871('0xa')](),controller[_0xe871('0x13')]);router[_0xe871('0x12')](_0xe871('0x10'),auth[_0xe871('0xa')](),controller[_0xe871('0x14')]);router[_0xe871('0x15')]('/:id',auth[_0xe871('0xa')](),controller['update']);router['delete'](_0xe871('0x16'),auth[_0xe871('0xa')](),controller[_0xe871('0x17')]);router[_0xe871('0x18')](_0xe871('0xe'),auth[_0xe871('0xa')](),controller[_0xe871('0x19')]);router[_0xe871('0x18')](_0xe871('0x10'),auth['isAuthenticated'](),controller[_0xe871('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x8a26=['util','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','destroy','delete','removeTeams','exports','multer'];(function(_0x2cfc63,_0x2f2d2f){var _0x1cef43=function(_0x4c079a){while(--_0x4c079a){_0x2cfc63['push'](_0x2cfc63['shift']());}};_0x1cef43(++_0x2f2d2f);}(_0x8a26,0x1a8));var _0x68a2=function(_0x40f4eb,_0x126451){_0x40f4eb=_0x40f4eb-0x0;var _0x2737ad=_0x8a26[_0x40f4eb];return _0x2737ad;};'use strict';var multer=require(_0x68a2('0x0'));var util=require(_0x68a2('0x1'));var path=require('path');var timeout=require(_0x68a2('0x2'));var express=require('express');var router=express[_0x68a2('0x3')]();var fs_extra=require(_0x68a2('0x4'));var auth=require(_0x68a2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x68a2('0x6')]('/',auth[_0x68a2('0x7')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x68a2('0x8')]);router[_0x68a2('0x6')](_0x68a2('0x9'),auth[_0x68a2('0x7')](),controller[_0x68a2('0xa')]);router[_0x68a2('0x6')](_0x68a2('0xb'),auth['isAuthenticated'](),controller[_0x68a2('0xc')]);router[_0x68a2('0x6')](_0x68a2('0xd'),auth['isAuthenticated'](),controller[_0x68a2('0xe')]);router[_0x68a2('0xf')]('/',auth[_0x68a2('0x7')](),controller[_0x68a2('0x10')]);router[_0x68a2('0xf')](_0x68a2('0xb'),auth[_0x68a2('0x7')](),controller[_0x68a2('0x11')]);router[_0x68a2('0xf')](_0x68a2('0xd'),auth[_0x68a2('0x7')](),controller[_0x68a2('0x12')]);router[_0x68a2('0x13')](_0x68a2('0x9'),auth[_0x68a2('0x7')](),controller[_0x68a2('0x14')]);router['delete'](_0x68a2('0x9'),auth[_0x68a2('0x7')](),controller[_0x68a2('0x15')]);router['delete'](_0x68a2('0xb'),auth[_0x68a2('0x7')](),controller['removeAgents']);router[_0x68a2('0x16')](_0x68a2('0xd'),auth[_0x68a2('0x7')](),controller[_0x68a2('0x17')]);module[_0x68a2('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 11b8699..960ae24 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 _0x70fd=['sequelize','STRING','name','VIRTUAL','system-','getDataValue'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x70fd,0x17a));var _0xd70f=function(_0x56b034,_0xb96f9b){_0x56b034=_0x56b034-0x0;var _0x25f338=_0x70fd[_0x56b034];return _0x25f338;};'use strict';var Sequelize=require(_0xd70f('0x0'));module['exports']={'name':{'type':Sequelize[_0xd70f('0x1')],'allowNull':![],'unique':_0xd70f('0x2')},'prefix':{'type':Sequelize[_0xd70f('0x3')],'get':function(_0x13be88){return _0xd70f('0x4')+this[_0xd70f('0x5')](_0xd70f('0x2'))+'-';}},'description':{'type':Sequelize[_0xd70f('0x1')]},'callerIdAll':{'type':Sequelize[_0xd70f('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc790=['getDataValue','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x20ff67,_0xc5bb51){var _0x408169=function(_0x3f34b0){while(--_0x3f34b0){_0x20ff67['push'](_0x20ff67['shift']());}};_0x408169(++_0xc5bb51);}(_0xc790,0xe8));var _0x0c79=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xc790[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x0c79('0x0'));module[_0x0c79('0x1')]={'name':{'type':Sequelize[_0x0c79('0x2')],'allowNull':![],'unique':_0x0c79('0x3')},'prefix':{'type':Sequelize[_0x0c79('0x4')],'get':function(_0x272ef3){return _0x0c79('0x5')+this[_0x0c79('0x6')](_0x0c79('0x3'))+'-';}},'description':{'type':Sequelize[_0x0c79('0x2')]},'callerIdAll':{'type':Sequelize[_0x0c79('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5b962a6..23c5817 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 _0x3423=['VoiceExtension','role','user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','charAt','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','order','getAgents','nolimit','getTeams','Team','addTeams','online','Agents','each','TeamVoicePrefix','upsert','findOrCreate','forEach','removeTeams','User','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','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','../../components/auth/service','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','UserProfileResource','then','end','error','stack','name','index','VoicePrefix','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','includeAll','find','params','describe','create','sequelize','body','get'];(function(_0x5bc954,_0x18dac4){var _0xf24448=function(_0x27b1e5){while(--_0x27b1e5){_0x5bc954['push'](_0x5bc954['shift']());}};_0xf24448(++_0x18dac4);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3342('0x0'));var jsonpatch=require(_0x3342('0x1'));var rp=require(_0x3342('0x2'));var moment=require(_0x3342('0x3'));var BPromise=require(_0x3342('0x4'));var Mustache=require(_0x3342('0x5'));var util=require(_0x3342('0x6'));var path=require(_0x3342('0x7'));var sox=require(_0x3342('0x8'));var csv=require(_0x3342('0x9'));var ejs=require(_0x3342('0xa'));var fs=require('fs');var fs_extra=require(_0x3342('0xb'));var _=require(_0x3342('0xc'));var squel=require(_0x3342('0xd'));var crypto=require(_0x3342('0xe'));var jsforce=require(_0x3342('0xf'));var deskjs=require(_0x3342('0x10'));var toCsv=require(_0x3342('0x9'));var querystring=require(_0x3342('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3342('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3342('0x13'));var utils=require(_0x3342('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3342('0x15'));var db=require('../../mysqldb')['db'];config[_0x3342('0x16')]=_[_0x3342('0x17')](config['redis'],{'host':_0x3342('0x18'),'port':0x18eb});var socket=require(_0x3342('0x19'))(new Redis(config[_0x3342('0x16')]));require(_0x3342('0x1a'))[_0x3342('0x1b')](socket);function respondWithStatusCode(_0x104077,_0x34a306){_0x34a306=_0x34a306||0xcc;return function(_0x59be1d){if(_0x59be1d){return _0x104077[_0x3342('0x1c')](_0x34a306);}return _0x104077[_0x3342('0x1d')](_0x34a306)['end']();};}function respondWithResult(_0x40d609,_0x2c9df0){_0x2c9df0=_0x2c9df0||0xc8;return function(_0x51ef91){if(_0x51ef91){return _0x40d609['status'](_0x2c9df0)[_0x3342('0x1e')](_0x51ef91);}};}function respondWithFilteredResult(_0x143cf1,_0x6949fc){return function(_0x2075cb){if(_0x2075cb){var _0x12947a=typeof _0x6949fc[_0x3342('0x1f')]===_0x3342('0x20')&&typeof _0x6949fc[_0x3342('0x21')]===_0x3342('0x20');var _0x4f4c2a=_0x2075cb[_0x3342('0x22')];var _0xda235a=_0x12947a?0x0:_0x6949fc[_0x3342('0x1f')];var _0x5e05f5=_0x12947a?_0x2075cb[_0x3342('0x22')]:_0x6949fc[_0x3342('0x1f')]+_0x6949fc['limit'];var _0xe774b7;if(_0x5e05f5>=_0x4f4c2a){_0x5e05f5=_0x4f4c2a;_0xe774b7=0xc8;}else{_0xe774b7=0xce;}_0x143cf1[_0x3342('0x1d')](_0xe774b7);return _0x143cf1['set'](_0x3342('0x23'),_0xda235a+'-'+_0x5e05f5+'/'+_0x4f4c2a)['json'](_0x2075cb);}return null;};}function patchUpdates(_0x3f271c){return function(_0x38994e){try{jsonpatch[_0x3342('0x24')](_0x38994e,_0x3f271c,!![]);}catch(_0x2dbad1){return BPromise[_0x3342('0x25')](_0x2dbad1);}return _0x38994e[_0x3342('0x26')]();};}function saveUpdates(_0x26eb87,_0x2d8622){return function(_0x5d4f14){if(_0x5d4f14){return _0x5d4f14[_0x3342('0x27')](_0x26eb87)['then'](function(_0x51cf45){return _0x51cf45;});}return null;};}function removeEntity(_0x986ab0,_0x52ba65){return function(_0x5d2f0b){if(_0x5d2f0b){return _0x5d2f0b[_0x3342('0x28')]()['then'](function(){var _0x37df78=_0x5d2f0b['get']({'plain':!![]});var _0x524286='VoicePrefixes';return db[_0x3342('0x29')][_0x3342('0x28')]({'where':{'type':_0x524286,'resourceId':_0x37df78['id']}})[_0x3342('0x2a')](function(){return _0x5d2f0b;});})['then'](function(){_0x986ab0[_0x3342('0x1d')](0xcc)[_0x3342('0x2b')]();});}};}function handleEntityNotFound(_0x1cc542,_0x272a52){return function(_0x4fbfb7){if(!_0x4fbfb7){_0x1cc542[_0x3342('0x1c')](0x194);}return _0x4fbfb7;};}function handleError(_0x3d6810,_0x387ba2){_0x387ba2=_0x387ba2||0x1f4;return function(_0x301114){logger[_0x3342('0x2c')](_0x301114[_0x3342('0x2d')]);if(_0x301114[_0x3342('0x2e')]){delete _0x301114['name'];}_0x3d6810[_0x3342('0x1d')](_0x387ba2)['send'](_0x301114);};}exports[_0x3342('0x2f')]=function(_0x407f8c,_0x508f87){var _0x250396={},_0x1cc42d={},_0x347d52={'count':0x0,'rows':[]};var _0x4e7410=_['map'](db[_0x3342('0x30')][_0x3342('0x31')],function(_0x311cfe){return{'name':_0x311cfe[_0x3342('0x32')],'type':_0x311cfe[_0x3342('0x33')][_0x3342('0x34')]};});_0x1cc42d[_0x3342('0x35')]=_[_0x3342('0x36')](_0x4e7410,_0x3342('0x2e'));_0x1cc42d[_0x3342('0x37')]=_[_0x3342('0x38')](_0x407f8c[_0x3342('0x37')]);_0x1cc42d['filters']=_['intersection'](_0x1cc42d[_0x3342('0x35')],_0x1cc42d['query']);_0x250396[_0x3342('0x39')]=_[_0x3342('0x3a')](_0x1cc42d[_0x3342('0x35')],qs[_0x3342('0x3b')](_0x407f8c[_0x3342('0x37')][_0x3342('0x3b')]));_0x250396[_0x3342('0x39')]=_0x250396['attributes'][_0x3342('0x3c')]?_0x250396[_0x3342('0x39')]:_0x1cc42d[_0x3342('0x35')];if(!_0x407f8c[_0x3342('0x37')][_0x3342('0x3d')]('nolimit')){_0x250396[_0x3342('0x21')]=qs['limit'](_0x407f8c[_0x3342('0x37')][_0x3342('0x21')]);_0x250396[_0x3342('0x1f')]=qs[_0x3342('0x1f')](_0x407f8c['query'][_0x3342('0x1f')]);}_0x250396['order']=qs[_0x3342('0x3e')](_0x407f8c[_0x3342('0x37')][_0x3342('0x3e')]);_0x250396[_0x3342('0x3f')]=qs[_0x3342('0x40')](_[_0x3342('0x41')](_0x407f8c[_0x3342('0x37')],_0x1cc42d['filters']),_0x4e7410);if(_0x407f8c[_0x3342('0x37')][_0x3342('0x42')]){_0x250396['where']=_[_0x3342('0x43')](_0x250396[_0x3342('0x3f')],{'$or':_['map'](_0x4e7410,function(_0x45b956){if(_0x45b956[_0x3342('0x33')]!=='VIRTUAL'){var _0x4985db={};_0x4985db[_0x45b956['name']]={'$like':'%'+_0x407f8c[_0x3342('0x37')][_0x3342('0x42')]+'%'};return _0x4985db;}})});}_0x250396=_['merge']({},_0x250396,_0x407f8c[_0x3342('0x44')]);var _0x2a1f7e={'where':_0x250396[_0x3342('0x3f')]};return db[_0x3342('0x30')][_0x3342('0x22')](_0x2a1f7e)[_0x3342('0x2a')](function(_0x34de7b){_0x347d52[_0x3342('0x22')]=_0x34de7b;if(_0x407f8c['query']['includeAll']){_0x250396[_0x3342('0x45')]=[{'all':!![]}];}return db[_0x3342('0x30')][_0x3342('0x46')](_0x250396);})[_0x3342('0x2a')](function(_0x717946){_0x347d52[_0x3342('0x47')]=_0x717946;return _0x347d52;})['then'](respondWithFilteredResult(_0x508f87,_0x250396))[_0x3342('0x48')](handleError(_0x508f87,null));};exports[_0x3342('0x49')]=function(_0x283ce9,_0x309423){var _0x64e352={'raw':![],'where':{'id':_0x283ce9['params']['id']}},_0x365d6f={};_0x365d6f[_0x3342('0x35')]=_['keys'](db[_0x3342('0x30')][_0x3342('0x31')]);_0x365d6f[_0x3342('0x37')]=_[_0x3342('0x38')](_0x283ce9['query']);_0x365d6f[_0x3342('0x40')]=_[_0x3342('0x3a')](_0x365d6f['model'],_0x365d6f[_0x3342('0x37')]);_0x64e352[_0x3342('0x39')]=_[_0x3342('0x3a')](_0x365d6f[_0x3342('0x35')],qs['fields'](_0x283ce9[_0x3342('0x37')][_0x3342('0x3b')]));_0x64e352['attributes']=_0x64e352[_0x3342('0x39')]['length']?_0x64e352['attributes']:_0x365d6f[_0x3342('0x35')];if(_0x283ce9[_0x3342('0x37')][_0x3342('0x4a')]){_0x64e352[_0x3342('0x45')]=[{'all':!![]}];}_0x64e352=_[_0x3342('0x43')]({},_0x64e352,_0x283ce9[_0x3342('0x44')]);return db[_0x3342('0x30')]['find'](_0x64e352)['then'](handleEntityNotFound(_0x309423,null))[_0x3342('0x2a')](respondWithResult(_0x309423,null))['catch'](handleError(_0x309423,null));};exports[_0x3342('0x28')]=function(_0x5e1202,_0x4c9214){return db['VoicePrefix'][_0x3342('0x4b')]({'where':{'id':_0x5e1202[_0x3342('0x4c')]['id']}})[_0x3342('0x2a')](handleEntityNotFound(_0x4c9214,null))[_0x3342('0x2a')](removeEntity(_0x4c9214,null))['catch'](handleError(_0x4c9214,null));};exports[_0x3342('0x4d')]=function(_0x3a6597,_0x4ce271){return db[_0x3342('0x30')][_0x3342('0x4d')]()[_0x3342('0x2a')](respondWithResult(_0x4ce271,null))['catch'](handleError(_0x4ce271,null));};exports[_0x3342('0x4e')]=function(_0x1497d9,_0x45eb2c){var _0x3be76c;return db[_0x3342('0x4f')]['transaction'](function(_0x2699d2){return db[_0x3342('0x30')][_0x3342('0x4e')](_0x1497d9[_0x3342('0x50')],{'transaction':_0x2699d2})[_0x3342('0x2a')](function(_0x386a5d){_0x3be76c=_0x386a5d[_0x3342('0x51')]({'plain':!![]});return db[_0x3342('0x52')][_0x3342('0x4b')]({'where':{'id':_0x3be76c['VoiceExtensionId']},'raw':!![]})[_0x3342('0x2a')](function(_0x4eebaa){return createVoicePrefixExtensions(_0x3be76c,_0x4eebaa,_0x2699d2);});});})[_0x3342('0x2a')](function(){var _0x524fb6=_0x1497d9['user']['get']({'plain':!![]});if(!_0x524fb6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x524fb6[_0x3342('0x53')]===_0x3342('0x54')){var _0x3cd098=_0x3be76c;return db[_0x3342('0x55')][_0x3342('0x4b')]({'where':{'name':_0x3342('0x56'),'userProfileId':_0x524fb6[_0x3342('0x57')]},'raw':!![]})[_0x3342('0x2a')](function(_0x2938e0){if(_0x2938e0&&_0x2938e0[_0x3342('0x58')]===0x0){return db[_0x3342('0x29')]['create']({'name':_0x3cd098['name'],'resourceId':_0x3cd098['id'],'type':_0x2938e0[_0x3342('0x2e')],'sectionId':_0x2938e0['id']},{})['then'](function(){return _0x3be76c;});}else{return _0x3be76c;}})[_0x3342('0x48')](function(_0x59964b){logger['error'](_0x3342('0x59'),_0x59964b);throw _0x59964b;});}return _0x3be76c;})[_0x3342('0x2a')](respondWithResult(_0x45eb2c,null))[_0x3342('0x48')](handleError(_0x45eb2c,null));};function Extension(_0x5d5e0f,_0x58d37a,_0x54b41d,_0x3cc92a){this['context']=_0x3342('0x5a');this[_0x3342('0x5b')]=_0x5d5e0f;this[_0x3342('0x5c')]=_0x54b41d;this['type']=_0x3342('0x5d');this[_0x3342('0x5e')]=_0x3342('0x5f');this[_0x3342('0x60')]=_0x58d37a;this[_0x3342('0x61')]=_0x3cc92a;}function createVoicePrefixExtensions(_0x19e27b,_0xa4452,_0x57942a){return new BPromise(function(_0x4bc9a9,_0x30e299){var _0x4ec1c4=new Extension(formatPrefixName(_0x19e27b[_0x3342('0x62')]),0x1,_0x3342('0x63'),_0x3342('0x64'));_0x4ec1c4[_0x3342('0x65')]=_0x19e27b['id'];return db[_0x3342('0x52')]['create'](_0x4ec1c4,{'transaction':_0x57942a})[_0x3342('0x2a')](function(_0x3f2fcb){var _0x4c1c6a=_0x3f2fcb[_0x3342('0x51')]({'plain':!![]});var _0x14cc64=_[_0x3342('0x36')](addVoicePrefixExtensions(_0x19e27b,_0xa4452),function(_0x2858a6){_0x2858a6[_0x3342('0x66')]=_0x4c1c6a['id'];_0x2858a6[_0x3342('0x65')]=_0x19e27b['id'];return _0x2858a6;});return db[_0x3342('0x52')][_0x3342('0x67')](_0x14cc64,{'transaction':_0x57942a})[_0x3342('0x2a')](function(_0x36eec8){if(!_0x36eec8){return _0x30e299(_0x3342('0x68'));}else{return _0x4bc9a9(_0x36eec8);}})[_0x3342('0x48')](function(_0x3b01a3){return _0x30e299(_0x3b01a3);});});;});};function addVoicePrefixExtensions(_0x58cbdd,_0x5c9399){var _0x146ffc=[];var _0x4672b5=formatPrefixName(_0x58cbdd[_0x3342('0x62')]);_0x146ffc[_0x3342('0x69')](new Extension(_0x4672b5,0x2,'Set','CDR(prefix)='+_0x58cbdd[_0x3342('0x2e')]));if(_0x58cbdd[_0x3342('0x6a')]){_0x146ffc[_0x3342('0x69')](new Extension(_0x4672b5,0x3,_0x3342('0x6b'),_0x3342('0x6c')+_0x58cbdd[_0x3342('0x6a')]));}else{_0x146ffc[_0x3342('0x69')](new Extension(_0x4672b5,0x3,_0x3342('0x63'),_0x3342('0x6d')));}_0x146ffc[_0x3342('0x69')](new Extension(_0x4672b5,0x4,'goto',_0x5c9399[_0x3342('0x6e')]+','+'${EXTEN:'+(0x8+_0x58cbdd[_0x3342('0x2e')][_0x3342('0x3c')])+'}'+','+0x1));return _0x146ffc;}function formatPrefixName(_0x536fbc){var _0x18cadb='_';for(var _0x3506d4=0x0;_0x3506d4<_0x536fbc['length'];_0x3506d4++){if(_0x536fbc[_0x3342('0x6f')](_0x3506d4)=='-'){_0x18cadb+=_0x536fbc[_0x3342('0x6f')](_0x3506d4);}else{_0x18cadb+='['+_0x536fbc[_0x3342('0x6f')](_0x3506d4)+']';}}_0x18cadb+='.';return _0x18cadb;}exports[_0x3342('0x27')]=function(_0x6b9502,_0x42bc3b,_0x28d937){var _0x57b8ac=_0x6b9502[_0x3342('0x50')];_0x57b8ac['prefix']='system-'+_0x57b8ac[_0x3342('0x2e')]+'-';return db[_0x3342('0x4f')][_0x3342('0x70')](function(_0x28e73f){return db[_0x3342('0x30')][_0x3342('0x27')](_0x57b8ac,{'where':{'id':_0x57b8ac['id']},'transaction':_0x28e73f})[_0x3342('0x2a')](function(){return db[_0x3342('0x52')]['destroy']({'where':{'VoicePrefixId':_0x57b8ac['id']},'transaction':_0x28e73f})[_0x3342('0x2a')](function(){return db[_0x3342('0x52')][_0x3342('0x4b')]({'where':{'id':_0x57b8ac[_0x3342('0x66')]},'raw':!![]})[_0x3342('0x2a')](function(_0x2f02ce){return createVoicePrefixExtensions(_0x57b8ac,_0x2f02ce,_0x28e73f);});});});})[_0x3342('0x2a')](function(){return db['VoicePrefix'][_0x3342('0x71')](_0x57b8ac['id']);})[_0x3342('0x2a')](respondWithResult(_0x42bc3b,null))[_0x3342('0x48')](handleError(_0x42bc3b,null));};exports[_0x3342('0x72')]=function(_0x38a83f,_0x30e493,_0x5a9027){return db['VoicePrefix']['find']({'where':{'id':_0x38a83f[_0x3342('0x4c')]['id']}})[_0x3342('0x2a')](handleEntityNotFound(_0x30e493,null))[_0x3342('0x2a')](function(_0x43cabb){if(_0x43cabb){return _0x43cabb[_0x3342('0x72')](_0x38a83f[_0x3342('0x50')][_0x3342('0x73')],_[_0x3342('0x74')](_0x38a83f['body'],[_0x3342('0x73'),'id'])||{})[_0x3342('0x75')](function(_0x2967d6){for(var _0x42782f=0x0;_0x42782f<_0x38a83f['body'][_0x3342('0x73')][_0x3342('0x3c')];_0x42782f+=0x1){socket[_0x3342('0x76')](_0x3342('0x77'),{'UserId':Number(_0x38a83f[_0x3342('0x50')][_0x3342('0x73')][_0x42782f]),'VoicePrefixId':Number(_0x38a83f[_0x3342('0x4c')]['id'])});}return _0x2967d6;});}})[_0x3342('0x2a')](respondWithResult(_0x30e493,null))[_0x3342('0x48')](handleError(_0x30e493,null));};exports['removeAgents']=function(_0xdc419a,_0x1862b8,_0x58c1b1){return db[_0x3342('0x30')]['find']({'where':{'id':_0xdc419a[_0x3342('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1862b8,null))[_0x3342('0x2a')](function(_0x5b2f46){if(_0x5b2f46){return _0x5b2f46[_0x3342('0x78')](_0xdc419a[_0x3342('0x37')]['ids'])[_0x3342('0x2a')](function(){if(_[_0x3342('0x79')](_0xdc419a['query'][_0x3342('0x73')])){for(var _0x24c9ef=0x0;_0x24c9ef<_0xdc419a[_0x3342('0x37')][_0x3342('0x73')][_0x3342('0x3c')];_0x24c9ef+=0x1){socket[_0x3342('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0xdc419a[_0x3342('0x37')][_0x3342('0x73')][_0x24c9ef]),'VoicePrefixId':Number(_0xdc419a[_0x3342('0x4c')]['id'])});}}else{socket[_0x3342('0x76')](_0x3342('0x7a'),{'UserId':Number(_0xdc419a[_0x3342('0x37')][_0x3342('0x73')]),'VoicePrefixId':Number(_0xdc419a[_0x3342('0x4c')]['id'])});}});}})[_0x3342('0x2a')](respondWithStatusCode(_0x1862b8,null))[_0x3342('0x48')](handleError(_0x1862b8,null));};exports['getAgents']=function(_0x677fc4,_0x7c5834,_0x2e050f){var _0x592122={};var _0x5ef689={};var _0x344a1d;var _0x52e891;return db['VoicePrefix'][_0x3342('0x7b')]({'where':{'id':_0x677fc4[_0x3342('0x4c')]['id']}})['then'](handleEntityNotFound(_0x7c5834,null))[_0x3342('0x2a')](function(_0x4d7132){if(_0x4d7132){_0x344a1d=_0x4d7132;_0x5ef689[_0x3342('0x35')]=_['keys'](db['User'][_0x3342('0x31')]);_0x5ef689[_0x3342('0x37')]=_[_0x3342('0x38')](_0x677fc4['query']);_0x5ef689['filters']=_[_0x3342('0x3a')](_0x5ef689['model'],_0x5ef689[_0x3342('0x37')]);_0x592122[_0x3342('0x39')]=_[_0x3342('0x3a')](_0x5ef689[_0x3342('0x35')],qs['fields'](_0x677fc4['query'][_0x3342('0x3b')]));_0x592122[_0x3342('0x39')]=_0x592122['attributes'][_0x3342('0x3c')]?_0x592122['attributes']:_0x5ef689[_0x3342('0x35')];_0x592122[_0x3342('0x7c')]=qs[_0x3342('0x3e')](_0x677fc4[_0x3342('0x37')][_0x3342('0x3e')]);_0x592122['where']=qs['filters'](_['pick'](_0x677fc4[_0x3342('0x37')],_0x5ef689[_0x3342('0x40')]));if(_0x677fc4[_0x3342('0x37')]['filter']){_0x592122[_0x3342('0x3f')]=_[_0x3342('0x43')](_0x592122[_0x3342('0x3f')],{'$or':_[_0x3342('0x36')](_0x592122[_0x3342('0x39')],function(_0x2355c0){var _0x5cfbf6={};_0x5cfbf6[_0x2355c0]={'$like':'%'+_0x677fc4[_0x3342('0x37')]['filter']+'%'};return _0x5cfbf6;})});}_0x592122=_['merge']({},_0x592122,_0x677fc4['options']);return _0x344a1d[_0x3342('0x7d')](_0x592122);}})[_0x3342('0x2a')](function(_0x50c080){if(_0x50c080){_0x52e891=_0x50c080[_0x3342('0x3c')];if(!_0x677fc4[_0x3342('0x37')]['hasOwnProperty'](_0x3342('0x7e'))){_0x592122[_0x3342('0x21')]=qs[_0x3342('0x21')](_0x677fc4[_0x3342('0x37')][_0x3342('0x21')]);_0x592122[_0x3342('0x1f')]=qs[_0x3342('0x1f')](_0x677fc4[_0x3342('0x37')]['offset']);}return _0x344a1d[_0x3342('0x7d')](_0x592122);}})[_0x3342('0x2a')](function(_0x13738c){if(_0x13738c){return _0x13738c?{'count':_0x52e891,'rows':_0x13738c}:null;}})[_0x3342('0x2a')](respondWithResult(_0x7c5834,null))[_0x3342('0x48')](handleError(_0x7c5834,null));};exports[_0x3342('0x7f')]=function(_0x2d2902,_0x49de28,_0x57a3f8){var _0x1fdaa3={};var _0x2fd436={};var _0x28b7ba;var _0x36ac0d;return db[_0x3342('0x30')][_0x3342('0x7b')]({'where':{'id':_0x2d2902[_0x3342('0x4c')]['id']}})['then'](handleEntityNotFound(_0x49de28,null))[_0x3342('0x2a')](function(_0x15652e){if(_0x15652e){_0x28b7ba=_0x15652e;_0x2fd436[_0x3342('0x35')]=_[_0x3342('0x38')](db[_0x3342('0x80')]['rawAttributes']);_0x2fd436[_0x3342('0x37')]=_[_0x3342('0x38')](_0x2d2902[_0x3342('0x37')]);_0x2fd436[_0x3342('0x40')]=_['intersection'](_0x2fd436[_0x3342('0x35')],_0x2fd436[_0x3342('0x37')]);_0x1fdaa3[_0x3342('0x39')]=_[_0x3342('0x3a')](_0x2fd436[_0x3342('0x35')],qs[_0x3342('0x3b')](_0x2d2902[_0x3342('0x37')]['fields']));_0x1fdaa3['attributes']=_0x1fdaa3[_0x3342('0x39')]['length']?_0x1fdaa3[_0x3342('0x39')]:_0x2fd436[_0x3342('0x35')];_0x1fdaa3[_0x3342('0x7c')]=qs[_0x3342('0x3e')](_0x2d2902[_0x3342('0x37')]['sort']);_0x1fdaa3[_0x3342('0x3f')]=qs[_0x3342('0x40')](_[_0x3342('0x41')](_0x2d2902['query'],_0x2fd436['filters']));if(_0x2d2902[_0x3342('0x37')][_0x3342('0x42')]){_0x1fdaa3[_0x3342('0x3f')]=_[_0x3342('0x43')](_0x1fdaa3[_0x3342('0x3f')],{'$or':_[_0x3342('0x36')](_0x1fdaa3[_0x3342('0x39')],function(_0x2c8c08){var _0x316b4c={};_0x316b4c[_0x2c8c08]={'$like':'%'+_0x2d2902[_0x3342('0x37')][_0x3342('0x42')]+'%'};return _0x316b4c;})});}_0x1fdaa3=_[_0x3342('0x43')]({},_0x1fdaa3,_0x2d2902['options']);return _0x28b7ba['getTeams'](_0x1fdaa3);}})['then'](function(_0x2539a0){if(_0x2539a0){_0x36ac0d=_0x2539a0[_0x3342('0x3c')];if(!_0x2d2902[_0x3342('0x37')][_0x3342('0x3d')](_0x3342('0x7e'))){_0x1fdaa3['limit']=qs[_0x3342('0x21')](_0x2d2902[_0x3342('0x37')][_0x3342('0x21')]);_0x1fdaa3['offset']=qs[_0x3342('0x1f')](_0x2d2902[_0x3342('0x37')]['offset']);}return _0x28b7ba['getTeams'](_0x1fdaa3);}})[_0x3342('0x2a')](function(_0x1cbc11){if(_0x1cbc11){return _0x1cbc11?{'count':_0x36ac0d,'rows':_0x1cbc11}:null;}})[_0x3342('0x2a')](respondWithResult(_0x49de28,null))[_0x3342('0x48')](handleError(_0x49de28,null));};exports[_0x3342('0x81')]=function(_0x51b0f9,_0x48cb53,_0x37fdc5){var _0x26063d=_0x51b0f9[_0x3342('0x50')][_0x3342('0x73')];var _0x43323e;return db[_0x3342('0x80')][_0x3342('0x46')]({'where':{'id':_0x26063d},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x3342('0x82'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x3c1c34){if(_0x3c1c34){_0x43323e=_0x3c1c34;var _0x319a6e=_['flatMap'](_0x3c1c34,function(_0x36739b){var _0x4dcbb1=_0x36739b['get']({'plain':!![]});return _0x4dcbb1[_0x3342('0x83')];});return db['VoicePrefix'][_0x3342('0x4b')]({'where':{'id':_0x51b0f9[_0x3342('0x4c')]['id']}})[_0x3342('0x2a')](function(_0x2b029d){return db[_0x3342('0x4f')][_0x3342('0x70')](function(_0x5aa6ce){return _0x2b029d[_0x3342('0x81')](_0x26063d,{'transaction':_0x5aa6ce})[_0x3342('0x2a')](function(){return BPromise[_0x3342('0x84')](_0x43323e,function(_0x5d9c1e){return db[_0x3342('0x85')][_0x3342('0x86')]({'TeamId':_0x5d9c1e['id'],'VoicePrefixId':_0x51b0f9[_0x3342('0x4c')]['id']},{'transaction':_0x5aa6ce});});})[_0x3342('0x2a')](function(){return BPromise[_0x3342('0x84')](_0x319a6e,function(_0x41de0c){return db['UserVoicePrefix'][_0x3342('0x87')]({'where':{'UserId':_0x41de0c['id'],'VoicePrefixId':_0x51b0f9[_0x3342('0x4c')]['id']},'transaction':_0x5aa6ce});});})[_0x3342('0x2a')](function(){_0x319a6e[_0x3342('0x88')](function(_0x441c2a){socket['emit'](_0x3342('0x77'),{'UserId':_0x441c2a['id'],'VoicePrefixId':_0x2b029d['id']});});});});});}})[_0x3342('0x2a')](respondWithStatusCode(_0x48cb53,null))[_0x3342('0x48')](handleError(_0x48cb53,null));};exports[_0x3342('0x89')]=function(_0x498de2,_0x100d41,_0x56251e){return db[_0x3342('0x80')][_0x3342('0x46')]({'where':{'id':_0x498de2[_0x3342('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3342('0x8a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3342('0x2a')](handleEntityNotFound(_0x100d41,null))['then'](function(_0x340350){var _0xe6d040=_[_0x3342('0x36')](_0x340350,'id');var _0x58253f=[];var _0x25b867=[];var _0x3a6d87=squel[_0x3342('0x8b')]();_0x3a6d87[_0x3342('0x8c')](_0x3342('0x8d'))[_0x3342('0x8e')](_0x3342('0x8f'),'tq')['join'](_0x3342('0x90'),'ut',_0x3342('0x91'))[_0x3342('0x3f')]('VoicePrefixId\x20=\x20?',_0x498de2[_0x3342('0x4c')]['id']);for(var _0x3c0eb8=0x0;_0x3c0eb8<_0x340350[_0x3342('0x3c')];_0x3c0eb8+=0x1){let _0x2b5df1=_0x340350[_0x3c0eb8];for(var _0xe57bc1=0x0;_0xe57bc1<_0x2b5df1[_0x3342('0x83')][_0x3342('0x3c')];_0xe57bc1+=0x1){let _0x2ae81c=_0x2b5df1['Agents'][_0xe57bc1];var _0x448a3c=_0x3a6d87[_0x3342('0x92')]();_0x448a3c['where'](_0x3342('0x93'),_0x2ae81c['id']);_0x25b867[_0x3342('0x69')](db[_0x3342('0x4f')][_0x3342('0x37')](_0x448a3c[_0x3342('0x94')](),{'type':db[_0x3342('0x4f')][_0x3342('0x95')][_0x3342('0x96')]})[_0x3342('0x2a')](function(_0x31095f){if(_0x31095f[_0x3342('0x3c')]===0x1){return _0x2ae81c['id'];}else{var _0x4a301d=_['every'](_[_0x3342('0x36')](_0x31095f,_0x3342('0x97')),function(_0x107e1b){return _[_0x3342('0x98')](_0xe6d040,_0x107e1b);});if(_0x4a301d){return _0x2ae81c['id'];}}}));}}return BPromise[_0x3342('0x99')](_0x25b867)[_0x3342('0x2a')](function(_0x34f15a){_0x58253f=_(_0x58253f)[_0x3342('0x9a')](_0x34f15a)[_0x3342('0x9b')]()[_0x3342('0x9c')]();return db[_0x3342('0x30')][_0x3342('0x4b')]({'where':{'id':_0x498de2[_0x3342('0x4c')]['id']}})[_0x3342('0x2a')](function(_0x45d548){return db[_0x3342('0x4f')]['transaction'](function(_0x4e1359){return _0x45d548[_0x3342('0x89')](_0x498de2[_0x3342('0x37')]['ids'],{'transaction':_0x4e1359})[_0x3342('0x2a')](function(){if(!_[_0x3342('0x9d')](_0x58253f)){return _0x45d548['removeAgents'](_0x58253f,{'transaction':_0x4e1359});}})[_0x3342('0x2a')](function(){_0x58253f['forEach'](function(_0x24049f){socket[_0x3342('0x76')](_0x3342('0x7a'),{'UserId':_0x24049f,'VoicePrefixId':_0x45d548['id']});});});});});});})[_0x3342('0x2a')](respondWithStatusCode(_0x100d41,null))[_0x3342('0x48')](handleError(_0x100d41,null));}; \ No newline at end of file +var _0x63a5=['merge','VIRTUAL','options','includeAll','include','VoicePrefix','findAll','rows','catch','show','params','rawAttributes','keys','find','describe','create','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','context','from-sip','exten','app','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','goto','charAt','system-','transaction','findById','addAgents','ids','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','pick','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','field','tq.TeamId','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','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','redis','defaults','localhost','socket.io-emitter','register','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter'];(function(_0x2f2367,_0x3a992e){var _0x3e7eb8=function(_0x2df534){while(--_0x2df534){_0x2f2367['push'](_0x2f2367['shift']());}};_0x3e7eb8(++_0x3a992e);}(_0x63a5,0x18e));var _0x563a=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x63a5[_0x3070dc];return _0x431489;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];config[_0x563a('0x19')]=_[_0x563a('0x1a')](config[_0x563a('0x19')],{'host':_0x563a('0x1b'),'port':0x18eb});var socket=require(_0x563a('0x1c'))(new Redis(config[_0x563a('0x19')]));require('./voicePrefix.socket')[_0x563a('0x1d')](socket);function respondWithStatusCode(_0x3045ac,_0x8c3727){_0x8c3727=_0x8c3727||0xcc;return function(_0x26987f){if(_0x26987f){return _0x3045ac['sendStatus'](_0x8c3727);}return _0x3045ac['status'](_0x8c3727)[_0x563a('0x1e')]();};}function respondWithResult(_0x2ad667,_0x5b291f){_0x5b291f=_0x5b291f||0xc8;return function(_0x2ade24){if(_0x2ade24){return _0x2ad667[_0x563a('0x1f')](_0x5b291f)[_0x563a('0x20')](_0x2ade24);}};}function respondWithFilteredResult(_0x9c2f77,_0x4f947d){return function(_0x598693){if(_0x598693){var _0xe3d2bd=typeof _0x4f947d[_0x563a('0x21')]===_0x563a('0x22')&&typeof _0x4f947d['limit']==='undefined';var _0x52b99a=_0x598693['count'];var _0x40916a=_0xe3d2bd?0x0:_0x4f947d[_0x563a('0x21')];var _0x26061f=_0xe3d2bd?_0x598693[_0x563a('0x23')]:_0x4f947d['offset']+_0x4f947d['limit'];var _0x3930f0;if(_0x26061f>=_0x52b99a){_0x26061f=_0x52b99a;_0x3930f0=0xc8;}else{_0x3930f0=0xce;}_0x9c2f77[_0x563a('0x1f')](_0x3930f0);return _0x9c2f77[_0x563a('0x24')](_0x563a('0x25'),_0x40916a+'-'+_0x26061f+'/'+_0x52b99a)[_0x563a('0x20')](_0x598693);}return null;};}function patchUpdates(_0x2dc7e2){return function(_0x44b460){try{jsonpatch[_0x563a('0x26')](_0x44b460,_0x2dc7e2,!![]);}catch(_0x506491){return BPromise[_0x563a('0x27')](_0x506491);}return _0x44b460['save']();};}function saveUpdates(_0x44e2c1,_0xd3e0ae){return function(_0x3a36a4){if(_0x3a36a4){return _0x3a36a4[_0x563a('0x28')](_0x44e2c1)[_0x563a('0x29')](function(_0x1682ee){return _0x1682ee;});}return null;};}function removeEntity(_0x3642b3,_0x173990){return function(_0x4de4c3){if(_0x4de4c3){return _0x4de4c3[_0x563a('0x2a')]()[_0x563a('0x29')](function(){var _0x2311f2=_0x4de4c3[_0x563a('0x2b')]({'plain':!![]});var _0xce8165=_0x563a('0x2c');return db[_0x563a('0x2d')][_0x563a('0x2a')]({'where':{'type':_0xce8165,'resourceId':_0x2311f2['id']}})[_0x563a('0x29')](function(){return _0x4de4c3;});})[_0x563a('0x29')](function(){_0x3642b3[_0x563a('0x1f')](0xcc)[_0x563a('0x1e')]();});}};}function handleEntityNotFound(_0x1bdfb0,_0x7696c2){return function(_0x579cb5){if(!_0x579cb5){_0x1bdfb0[_0x563a('0x2e')](0x194);}return _0x579cb5;};}function handleError(_0x3c16d0,_0x2257e1){_0x2257e1=_0x2257e1||0x1f4;return function(_0x4aaa3d){logger[_0x563a('0x2f')](_0x4aaa3d[_0x563a('0x30')]);if(_0x4aaa3d[_0x563a('0x31')]){delete _0x4aaa3d[_0x563a('0x31')];}_0x3c16d0[_0x563a('0x1f')](_0x2257e1)[_0x563a('0x32')](_0x4aaa3d);};}exports[_0x563a('0x33')]=function(_0x4a2d28,_0x2418ae){var _0x24ec9d={},_0x4259f6={},_0x2ea6c2={'count':0x0,'rows':[]};var _0x1a77b8=_['map'](db['VoicePrefix']['rawAttributes'],function(_0x4e5c46){return{'name':_0x4e5c46[_0x563a('0x34')],'type':_0x4e5c46[_0x563a('0x35')][_0x563a('0x36')]};});_0x4259f6[_0x563a('0x37')]=_[_0x563a('0x38')](_0x1a77b8,_0x563a('0x31'));_0x4259f6['query']=_['keys'](_0x4a2d28[_0x563a('0x39')]);_0x4259f6[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x4259f6[_0x563a('0x37')],_0x4259f6[_0x563a('0x39')]);_0x24ec9d[_0x563a('0x3c')]=_[_0x563a('0x3b')](_0x4259f6[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x4a2d28[_0x563a('0x39')][_0x563a('0x3d')]));_0x24ec9d[_0x563a('0x3c')]=_0x24ec9d[_0x563a('0x3c')][_0x563a('0x3e')]?_0x24ec9d[_0x563a('0x3c')]:_0x4259f6[_0x563a('0x37')];if(!_0x4a2d28['query'][_0x563a('0x3f')](_0x563a('0x40'))){_0x24ec9d[_0x563a('0x41')]=qs['limit'](_0x4a2d28[_0x563a('0x39')]['limit']);_0x24ec9d[_0x563a('0x21')]=qs[_0x563a('0x21')](_0x4a2d28['query']['offset']);}_0x24ec9d[_0x563a('0x42')]=qs['sort'](_0x4a2d28[_0x563a('0x39')][_0x563a('0x43')]);_0x24ec9d[_0x563a('0x44')]=qs[_0x563a('0x3a')](_['pick'](_0x4a2d28['query'],_0x4259f6[_0x563a('0x3a')]),_0x1a77b8);if(_0x4a2d28['query'][_0x563a('0x45')]){_0x24ec9d[_0x563a('0x44')]=_[_0x563a('0x46')](_0x24ec9d[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x1a77b8,function(_0x38fab5){if(_0x38fab5[_0x563a('0x35')]!==_0x563a('0x47')){var _0x4c71df={};_0x4c71df[_0x38fab5[_0x563a('0x31')]]={'$like':'%'+_0x4a2d28['query'][_0x563a('0x45')]+'%'};return _0x4c71df;}})});}_0x24ec9d=_[_0x563a('0x46')]({},_0x24ec9d,_0x4a2d28[_0x563a('0x48')]);var _0x2d3800={'where':_0x24ec9d['where']};return db['VoicePrefix']['count'](_0x2d3800)[_0x563a('0x29')](function(_0x1255da){_0x2ea6c2[_0x563a('0x23')]=_0x1255da;if(_0x4a2d28[_0x563a('0x39')][_0x563a('0x49')]){_0x24ec9d[_0x563a('0x4a')]=[{'all':!![]}];}return db[_0x563a('0x4b')][_0x563a('0x4c')](_0x24ec9d);})[_0x563a('0x29')](function(_0x433353){_0x2ea6c2[_0x563a('0x4d')]=_0x433353;return _0x2ea6c2;})[_0x563a('0x29')](respondWithFilteredResult(_0x2418ae,_0x24ec9d))[_0x563a('0x4e')](handleError(_0x2418ae,null));};exports[_0x563a('0x4f')]=function(_0x144e15,_0x456d27){var _0x4643c4={'raw':![],'where':{'id':_0x144e15[_0x563a('0x50')]['id']}},_0x21bafb={};_0x21bafb['model']=_['keys'](db[_0x563a('0x4b')][_0x563a('0x51')]);_0x21bafb[_0x563a('0x39')]=_[_0x563a('0x52')](_0x144e15[_0x563a('0x39')]);_0x21bafb[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x21bafb[_0x563a('0x37')],_0x21bafb['query']);_0x4643c4['attributes']=_[_0x563a('0x3b')](_0x21bafb[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x144e15[_0x563a('0x39')][_0x563a('0x3d')]));_0x4643c4[_0x563a('0x3c')]=_0x4643c4[_0x563a('0x3c')][_0x563a('0x3e')]?_0x4643c4['attributes']:_0x21bafb[_0x563a('0x37')];if(_0x144e15[_0x563a('0x39')]['includeAll']){_0x4643c4[_0x563a('0x4a')]=[{'all':!![]}];}_0x4643c4=_['merge']({},_0x4643c4,_0x144e15[_0x563a('0x48')]);return db[_0x563a('0x4b')][_0x563a('0x53')](_0x4643c4)['then'](handleEntityNotFound(_0x456d27,null))[_0x563a('0x29')](respondWithResult(_0x456d27,null))[_0x563a('0x4e')](handleError(_0x456d27,null));};exports[_0x563a('0x2a')]=function(_0x39c104,_0x6fe8a9){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x39c104[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x6fe8a9,null))[_0x563a('0x29')](removeEntity(_0x6fe8a9,null))[_0x563a('0x4e')](handleError(_0x6fe8a9,null));};exports[_0x563a('0x54')]=function(_0x406d4a,_0x497469){return db['VoicePrefix'][_0x563a('0x54')]()[_0x563a('0x29')](respondWithResult(_0x497469,null))[_0x563a('0x4e')](handleError(_0x497469,null));};exports['create']=function(_0x5ae08f,_0x13530f){var _0x1fc4d2;return db['sequelize']['transaction'](function(_0x51e142){return db[_0x563a('0x4b')][_0x563a('0x55')](_0x5ae08f[_0x563a('0x56')],{'transaction':_0x51e142})[_0x563a('0x29')](function(_0x8d3997){_0x1fc4d2=_0x8d3997[_0x563a('0x2b')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x1fc4d2[_0x563a('0x57')]},'raw':!![]})['then'](function(_0x4453b2){return createVoicePrefixExtensions(_0x1fc4d2,_0x4453b2,_0x51e142);});});})[_0x563a('0x29')](function(){var _0x3e993e=_0x5ae08f[_0x563a('0x58')][_0x563a('0x2b')]({'plain':!![]});if(!_0x3e993e)throw new Error(_0x563a('0x59'));if(_0x3e993e[_0x563a('0x5a')]==='user'){var _0x22cc91=_0x1fc4d2;return db[_0x563a('0x5b')]['find']({'where':{'name':_0x563a('0x2c'),'userProfileId':_0x3e993e[_0x563a('0x5c')]},'raw':!![]})[_0x563a('0x29')](function(_0x2afa8c){if(_0x2afa8c&&_0x2afa8c[_0x563a('0x5d')]===0x0){return db[_0x563a('0x2d')][_0x563a('0x55')]({'name':_0x22cc91[_0x563a('0x31')],'resourceId':_0x22cc91['id'],'type':_0x2afa8c[_0x563a('0x31')],'sectionId':_0x2afa8c['id']},{})[_0x563a('0x29')](function(){return _0x1fc4d2;});}else{return _0x1fc4d2;}})['catch'](function(_0x1926f1){logger[_0x563a('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1926f1);throw _0x1926f1;});}return _0x1fc4d2;})['then'](respondWithResult(_0x13530f,null))[_0x563a('0x4e')](handleError(_0x13530f,null));};function Extension(_0x709bfd,_0x579d61,_0x19edc3,_0x59e371){this[_0x563a('0x5e')]=_0x563a('0x5f');this[_0x563a('0x60')]=_0x709bfd;this[_0x563a('0x61')]=_0x19edc3;this[_0x563a('0x35')]='system';this['description']='Voice\x20Prefix\x20Extension';this['priority']=_0x579d61;this[_0x563a('0x62')]=_0x59e371;}function createVoicePrefixExtensions(_0x5141d5,_0x111444,_0x496b6a){return new BPromise(function(_0x2a82cf,_0x3f2750){var _0xbe3343=new Extension(formatPrefixName(_0x5141d5[_0x563a('0x63')]),0x1,_0x563a('0x64'),'Voice\x20Prefix');_0xbe3343[_0x563a('0x65')]=_0x5141d5['id'];return db['VoiceExtension']['create'](_0xbe3343,{'transaction':_0x496b6a})[_0x563a('0x29')](function(_0x3b7993){var _0x409f3c=_0x3b7993[_0x563a('0x2b')]({'plain':!![]});var _0x1c8ad7=_['map'](addVoicePrefixExtensions(_0x5141d5,_0x111444),function(_0x10eb03){_0x10eb03[_0x563a('0x57')]=_0x409f3c['id'];_0x10eb03[_0x563a('0x65')]=_0x5141d5['id'];return _0x10eb03;});return db[_0x563a('0x66')][_0x563a('0x67')](_0x1c8ad7,{'transaction':_0x496b6a})['then'](function(_0xac578c){if(!_0xac578c){return _0x3f2750('Extensions\x20creation\x20failed');}else{return _0x2a82cf(_0xac578c);}})[_0x563a('0x4e')](function(_0x201c9d){return _0x3f2750(_0x201c9d);});});;});};function addVoicePrefixExtensions(_0x47d6cd,_0x34dd59){var _0x30bf2b=[];var _0x18a26b=formatPrefixName(_0x47d6cd[_0x563a('0x63')]);_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x2,_0x563a('0x69'),_0x563a('0x6a')+_0x47d6cd[_0x563a('0x31')]));if(_0x47d6cd['callerIdAll']){_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x3,_0x563a('0x69'),_0x563a('0x6b')+_0x47d6cd[_0x563a('0x6c')]));}else{_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x3,_0x563a('0x64'),_0x563a('0x6d')));}_0x30bf2b['push'](new Extension(_0x18a26b,0x4,_0x563a('0x6e'),_0x34dd59['context']+','+'${EXTEN:'+(0x8+_0x47d6cd['name'][_0x563a('0x3e')])+'}'+','+0x1));return _0x30bf2b;}function formatPrefixName(_0x4e4e60){var _0x529587='_';for(var _0x30d775=0x0;_0x30d775<_0x4e4e60[_0x563a('0x3e')];_0x30d775++){if(_0x4e4e60[_0x563a('0x6f')](_0x30d775)=='-'){_0x529587+=_0x4e4e60[_0x563a('0x6f')](_0x30d775);}else{_0x529587+='['+_0x4e4e60[_0x563a('0x6f')](_0x30d775)+']';}}_0x529587+='.';return _0x529587;}exports['update']=function(_0x4814b3,_0x4c9ad7,_0x39b8f8){var _0x8b2e10=_0x4814b3[_0x563a('0x56')];_0x8b2e10[_0x563a('0x63')]=_0x563a('0x70')+_0x8b2e10[_0x563a('0x31')]+'-';return db['sequelize'][_0x563a('0x71')](function(_0x43b2f1){return db['VoicePrefix'][_0x563a('0x28')](_0x8b2e10,{'where':{'id':_0x8b2e10['id']},'transaction':_0x43b2f1})[_0x563a('0x29')](function(){return db[_0x563a('0x66')]['destroy']({'where':{'VoicePrefixId':_0x8b2e10['id']},'transaction':_0x43b2f1})[_0x563a('0x29')](function(){return db[_0x563a('0x66')][_0x563a('0x53')]({'where':{'id':_0x8b2e10[_0x563a('0x57')]},'raw':!![]})['then'](function(_0x229690){return createVoicePrefixExtensions(_0x8b2e10,_0x229690,_0x43b2f1);});});});})[_0x563a('0x29')](function(){return db[_0x563a('0x4b')][_0x563a('0x72')](_0x8b2e10['id']);})[_0x563a('0x29')](respondWithResult(_0x4c9ad7,null))['catch'](handleError(_0x4c9ad7,null));};exports['addAgents']=function(_0x4346fe,_0x598a91,_0x46beba){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x4346fe[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x598a91,null))[_0x563a('0x29')](function(_0x3f66be){if(_0x3f66be){return _0x3f66be[_0x563a('0x73')](_0x4346fe[_0x563a('0x56')][_0x563a('0x74')],_['omit'](_0x4346fe[_0x563a('0x56')],['ids','id'])||{})[_0x563a('0x75')](function(_0x441933){for(var _0x54c512=0x0;_0x54c512<_0x4346fe[_0x563a('0x56')]['ids'][_0x563a('0x3e')];_0x54c512+=0x1){socket[_0x563a('0x76')]('userVoicePrefix:save',{'UserId':Number(_0x4346fe[_0x563a('0x56')][_0x563a('0x74')][_0x54c512]),'VoicePrefixId':Number(_0x4346fe[_0x563a('0x50')]['id'])});}return _0x441933;});}})[_0x563a('0x29')](respondWithResult(_0x598a91,null))['catch'](handleError(_0x598a91,null));};exports[_0x563a('0x77')]=function(_0x31faef,_0x17000b,_0x3cdfc1){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x31faef[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x17000b,null))[_0x563a('0x29')](function(_0x238ae4){if(_0x238ae4){return _0x238ae4['removeAgents'](_0x31faef[_0x563a('0x39')][_0x563a('0x74')])[_0x563a('0x29')](function(){if(_['isArray'](_0x31faef[_0x563a('0x39')][_0x563a('0x74')])){for(var _0x3dc800=0x0;_0x3dc800<_0x31faef[_0x563a('0x39')][_0x563a('0x74')][_0x563a('0x3e')];_0x3dc800+=0x1){socket[_0x563a('0x76')](_0x563a('0x78'),{'UserId':Number(_0x31faef[_0x563a('0x39')][_0x563a('0x74')][_0x3dc800]),'VoicePrefixId':Number(_0x31faef[_0x563a('0x50')]['id'])});}}else{socket[_0x563a('0x76')](_0x563a('0x78'),{'UserId':Number(_0x31faef['query'][_0x563a('0x74')]),'VoicePrefixId':Number(_0x31faef[_0x563a('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x17000b,null))[_0x563a('0x4e')](handleError(_0x17000b,null));};exports[_0x563a('0x79')]=function(_0x1ecca5,_0x162ab6,_0xf3ed04){var _0x44cbb4={};var _0x3a00b8={};var _0x9b753b;var _0x41898f;return db['VoicePrefix'][_0x563a('0x7a')]({'where':{'id':_0x1ecca5[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x162ab6,null))[_0x563a('0x29')](function(_0x4c5547){if(_0x4c5547){_0x9b753b=_0x4c5547;_0x3a00b8['model']=_['keys'](db[_0x563a('0x7b')][_0x563a('0x51')]);_0x3a00b8[_0x563a('0x39')]=_[_0x563a('0x52')](_0x1ecca5[_0x563a('0x39')]);_0x3a00b8[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x3a00b8[_0x563a('0x37')],_0x3a00b8[_0x563a('0x39')]);_0x44cbb4[_0x563a('0x3c')]=_['intersection'](_0x3a00b8[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x3d')]));_0x44cbb4[_0x563a('0x3c')]=_0x44cbb4[_0x563a('0x3c')][_0x563a('0x3e')]?_0x44cbb4[_0x563a('0x3c')]:_0x3a00b8[_0x563a('0x37')];_0x44cbb4[_0x563a('0x42')]=qs[_0x563a('0x43')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x43')]);_0x44cbb4['where']=qs[_0x563a('0x3a')](_[_0x563a('0x7c')](_0x1ecca5[_0x563a('0x39')],_0x3a00b8[_0x563a('0x3a')]));if(_0x1ecca5[_0x563a('0x39')][_0x563a('0x45')]){_0x44cbb4[_0x563a('0x44')]=_['merge'](_0x44cbb4[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x44cbb4[_0x563a('0x3c')],function(_0x562120){var _0x1e3b8c={};_0x1e3b8c[_0x562120]={'$like':'%'+_0x1ecca5[_0x563a('0x39')][_0x563a('0x45')]+'%'};return _0x1e3b8c;})});}_0x44cbb4=_[_0x563a('0x46')]({},_0x44cbb4,_0x1ecca5[_0x563a('0x48')]);return _0x9b753b[_0x563a('0x79')](_0x44cbb4);}})['then'](function(_0x2d46f5){if(_0x2d46f5){_0x41898f=_0x2d46f5[_0x563a('0x3e')];if(!_0x1ecca5[_0x563a('0x39')][_0x563a('0x3f')](_0x563a('0x40'))){_0x44cbb4['limit']=qs[_0x563a('0x41')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x41')]);_0x44cbb4[_0x563a('0x21')]=qs['offset'](_0x1ecca5[_0x563a('0x39')][_0x563a('0x21')]);}return _0x9b753b['getAgents'](_0x44cbb4);}})['then'](function(_0x458a21){if(_0x458a21){return _0x458a21?{'count':_0x41898f,'rows':_0x458a21}:null;}})[_0x563a('0x29')](respondWithResult(_0x162ab6,null))[_0x563a('0x4e')](handleError(_0x162ab6,null));};exports[_0x563a('0x7d')]=function(_0x241361,_0x31a58e,_0x1e324a){var _0x38857b={};var _0x43b6a2={};var _0x2385eb;var _0x36fe22;return db['VoicePrefix'][_0x563a('0x7a')]({'where':{'id':_0x241361[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x31a58e,null))['then'](function(_0x1dc77d){if(_0x1dc77d){_0x2385eb=_0x1dc77d;_0x43b6a2[_0x563a('0x37')]=_['keys'](db[_0x563a('0x7e')][_0x563a('0x51')]);_0x43b6a2[_0x563a('0x39')]=_[_0x563a('0x52')](_0x241361[_0x563a('0x39')]);_0x43b6a2[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x43b6a2[_0x563a('0x37')],_0x43b6a2['query']);_0x38857b[_0x563a('0x3c')]=_[_0x563a('0x3b')](_0x43b6a2[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x241361[_0x563a('0x39')]['fields']));_0x38857b[_0x563a('0x3c')]=_0x38857b['attributes']['length']?_0x38857b[_0x563a('0x3c')]:_0x43b6a2[_0x563a('0x37')];_0x38857b[_0x563a('0x42')]=qs[_0x563a('0x43')](_0x241361['query'][_0x563a('0x43')]);_0x38857b[_0x563a('0x44')]=qs['filters'](_[_0x563a('0x7c')](_0x241361['query'],_0x43b6a2[_0x563a('0x3a')]));if(_0x241361[_0x563a('0x39')][_0x563a('0x45')]){_0x38857b[_0x563a('0x44')]=_[_0x563a('0x46')](_0x38857b[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x38857b[_0x563a('0x3c')],function(_0x372e43){var _0x484953={};_0x484953[_0x372e43]={'$like':'%'+_0x241361[_0x563a('0x39')]['filter']+'%'};return _0x484953;})});}_0x38857b=_['merge']({},_0x38857b,_0x241361[_0x563a('0x48')]);return _0x2385eb[_0x563a('0x7d')](_0x38857b);}})['then'](function(_0x44859c){if(_0x44859c){_0x36fe22=_0x44859c[_0x563a('0x3e')];if(!_0x241361[_0x563a('0x39')][_0x563a('0x3f')](_0x563a('0x40'))){_0x38857b[_0x563a('0x41')]=qs[_0x563a('0x41')](_0x241361[_0x563a('0x39')]['limit']);_0x38857b[_0x563a('0x21')]=qs[_0x563a('0x21')](_0x241361['query'][_0x563a('0x21')]);}return _0x2385eb[_0x563a('0x7d')](_0x38857b);}})['then'](function(_0x38601a){if(_0x38601a){return _0x38601a?{'count':_0x36fe22,'rows':_0x38601a}:null;}})[_0x563a('0x29')](respondWithResult(_0x31a58e,null))[_0x563a('0x4e')](handleError(_0x31a58e,null));};exports['addTeams']=function(_0x10c81e,_0x4928de,_0x95bb77){var _0x33d74b=_0x10c81e[_0x563a('0x56')]['ids'];var _0x2d9810;return db['Team'][_0x563a('0x4c')]({'where':{'id':_0x33d74b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x563a('0x7f'),'attributes':['id',_0x563a('0x31'),_0x563a('0x80'),_0x563a('0x81'),_0x563a('0x82')],'raw':!![]}]})[_0x563a('0x29')](function(_0x2d2cb9){if(_0x2d2cb9){_0x2d9810=_0x2d2cb9;var _0x2c4b52=_[_0x563a('0x83')](_0x2d2cb9,function(_0x5c8df5){var _0x579601=_0x5c8df5[_0x563a('0x2b')]({'plain':!![]});return _0x579601[_0x563a('0x7f')];});return db['VoicePrefix'][_0x563a('0x53')]({'where':{'id':_0x10c81e[_0x563a('0x50')]['id']}})[_0x563a('0x29')](function(_0x1ebdd0){return db[_0x563a('0x84')][_0x563a('0x71')](function(_0x2a3bdd){return _0x1ebdd0['addTeams'](_0x33d74b,{'transaction':_0x2a3bdd})[_0x563a('0x29')](function(){return BPromise[_0x563a('0x85')](_0x2d9810,function(_0x28bbe5){return db[_0x563a('0x86')]['upsert']({'TeamId':_0x28bbe5['id'],'VoicePrefixId':_0x10c81e[_0x563a('0x50')]['id']},{'transaction':_0x2a3bdd});});})[_0x563a('0x29')](function(){return BPromise[_0x563a('0x85')](_0x2c4b52,function(_0x150fd6){return db[_0x563a('0x87')][_0x563a('0x88')]({'where':{'UserId':_0x150fd6['id'],'VoicePrefixId':_0x10c81e[_0x563a('0x50')]['id']},'transaction':_0x2a3bdd});});})[_0x563a('0x29')](function(){_0x2c4b52[_0x563a('0x89')](function(_0x3f78b7){socket[_0x563a('0x76')](_0x563a('0x8a'),{'UserId':_0x3f78b7['id'],'VoicePrefixId':_0x1ebdd0['id']});});});});});}})[_0x563a('0x29')](respondWithStatusCode(_0x4928de,null))[_0x563a('0x4e')](handleError(_0x4928de,null));};exports[_0x563a('0x8b')]=function(_0x115188,_0x713637,_0x12bb1b){return db[_0x563a('0x7e')][_0x563a('0x4c')]({'where':{'id':_0x115188[_0x563a('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x563a('0x7b')],'as':_0x563a('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x563a('0x29')](handleEntityNotFound(_0x713637,null))[_0x563a('0x29')](function(_0xb9cbc9){var _0x42831f=_[_0x563a('0x38')](_0xb9cbc9,'id');var _0x5385e0=[];var _0x1d0ed4=[];var _0x14bc9e=squel[_0x563a('0x8c')]();_0x14bc9e[_0x563a('0x8d')](_0x563a('0x8e'))['from'](_0x563a('0x8f'),'tq')['join'](_0x563a('0x90'),'ut',_0x563a('0x91'))[_0x563a('0x44')]('VoicePrefixId\x20=\x20?',_0x115188[_0x563a('0x50')]['id']);for(var _0x25e5d1=0x0;_0x25e5d1<_0xb9cbc9[_0x563a('0x3e')];_0x25e5d1+=0x1){let _0x5ba698=_0xb9cbc9[_0x25e5d1];for(var _0x2dadc1=0x0;_0x2dadc1<_0x5ba698[_0x563a('0x7f')]['length'];_0x2dadc1+=0x1){let _0x55f64e=_0x5ba698[_0x563a('0x7f')][_0x2dadc1];var _0x41d0df=_0x14bc9e['clone']();_0x41d0df['where'](_0x563a('0x92'),_0x55f64e['id']);_0x1d0ed4['push'](db[_0x563a('0x84')][_0x563a('0x39')](_0x41d0df[_0x563a('0x93')](),{'type':db[_0x563a('0x84')][_0x563a('0x94')][_0x563a('0x95')]})[_0x563a('0x29')](function(_0xc24817){if(_0xc24817[_0x563a('0x3e')]===0x1){return _0x55f64e['id'];}else{var _0xd04cd=_[_0x563a('0x96')](_['map'](_0xc24817,'TeamId'),function(_0x571a84){return _[_0x563a('0x97')](_0x42831f,_0x571a84);});if(_0xd04cd){return _0x55f64e['id'];}}}));}}return BPromise[_0x563a('0x98')](_0x1d0ed4)[_0x563a('0x29')](function(_0x5244e5){_0x5385e0=_(_0x5385e0)['union'](_0x5244e5)[_0x563a('0x99')]()[_0x563a('0x9a')]();return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x115188[_0x563a('0x50')]['id']}})[_0x563a('0x29')](function(_0x23e33f){return db['sequelize'][_0x563a('0x71')](function(_0x25049d){return _0x23e33f[_0x563a('0x8b')](_0x115188[_0x563a('0x39')][_0x563a('0x74')],{'transaction':_0x25049d})[_0x563a('0x29')](function(){if(!_[_0x563a('0x9b')](_0x5385e0)){return _0x23e33f[_0x563a('0x77')](_0x5385e0,{'transaction':_0x25049d});}})[_0x563a('0x29')](function(){_0x5385e0[_0x563a('0x89')](function(_0x482d21){socket[_0x563a('0x76')]('userVoicePrefix:remove',{'UserId':_0x482d21,'VoicePrefixId':_0x23e33f['id']});});});});});});})[_0x563a('0x29')](respondWithStatusCode(_0x713637,null))[_0x563a('0x4e')](handleError(_0x713637,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index c4f94fb..6664857 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 _0x0473=['save','remove','emit','hasOwnProperty','exports','VoicePrefix'];(function(_0xcd37c0,_0x95c330){var _0x42b0df=function(_0x3632f6){while(--_0x3632f6){_0xcd37c0['push'](_0xcd37c0['shift']());}};_0x42b0df(++_0x95c330);}(_0x0473,0x179));var _0x3047=function(_0x4b90b7,_0x2b0ab0){_0x4b90b7=_0x4b90b7-0x0;var _0x36ac5f=_0x0473[_0x4b90b7];return _0x36ac5f;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x3047('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3047('0x1'),'afterUpdate':'update','afterDestroy':_0x3047('0x2')};function emitEvent(_0x299028){return function(_0x2c173f,_0x35efeb,_0xaa47a0){VoicePrefixEvents[_0x3047('0x3')](_0x299028+':'+_0x2c173f['id'],_0x2c173f);VoicePrefixEvents[_0x3047('0x3')](_0x299028,_0x2c173f);_0xaa47a0(null);};}for(var e in events){if(events[_0x3047('0x4')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x3047('0x5')]=VoicePrefixEvents; \ No newline at end of file +var _0x14fe=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','VoicePrefix'];(function(_0x1eca8e,_0x118eeb){var _0x432e4b=function(_0x5550a8){while(--_0x5550a8){_0x1eca8e['push'](_0x1eca8e['shift']());}};_0x432e4b(++_0x118eeb);}(_0x14fe,0xee));var _0xe14f=function(_0x1ee182,_0x4e3b4c){_0x1ee182=_0x1ee182-0x0;var _0x29a0b7=_0x14fe[_0x1ee182];return _0x29a0b7;};'use strict';var EventEmitter=require(_0xe14f('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xe14f('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe14f('0x2')](0x0);var events={'afterCreate':_0xe14f('0x3'),'afterUpdate':_0xe14f('0x4'),'afterDestroy':_0xe14f('0x5')};function emitEvent(_0x4d3195){return function(_0x928fd7,_0xbcac74,_0x225fbe){VoicePrefixEvents[_0xe14f('0x6')](_0x4d3195+':'+_0x928fd7['id'],_0x928fd7);VoicePrefixEvents['emit'](_0x4d3195,_0x928fd7);_0x225fbe(null);};}for(var e in events){if(events[_0xe14f('0x7')](e)){var event=events[e];VoicePrefix[_0xe14f('0x8')](e,emitEvent(event));}}module[_0xe14f('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 7bf1a91..feea838 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 _0xf14c=['bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','lodash','api'];(function(_0x106301,_0x245789){var _0x1125f1=function(_0x1c8ab2){while(--_0x1c8ab2){_0x106301['push'](_0x106301['shift']());}};_0x1125f1(++_0x245789);}(_0xf14c,0x13e));var _0xcf14=function(_0xf7c778,_0x195f70){_0xf7c778=_0xf7c778-0x0;var _0x45eabc=_0xf14c[_0xf7c778];return _0x45eabc;};'use strict';var _=require(_0xcf14('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcf14('0x1'));var moment=require('moment');var BPromise=require(_0xcf14('0x2'));var rp=require(_0xcf14('0x3'));var fs=require('fs');var path=require(_0xcf14('0x4'));var rimraf=require('rimraf');var config=require(_0xcf14('0x5'));var attributes=require(_0xcf14('0x6'));module['exports']=function(_0x5cc24b,_0x5b97a5){return _0x5cc24b[_0xcf14('0x7')](_0xcf14('0x8'),attributes,{'tableName':_0xcf14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ca0=['voice_prefixes','lodash','util','../../config/logger','api','moment','path','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix'];(function(_0x57b13b,_0x2dfec5){var _0x5afcb0=function(_0x18673e){while(--_0x18673e){_0x57b13b['push'](_0x57b13b['shift']());}};_0x5afcb0(++_0x2dfec5);}(_0x2ca0,0x11f));var _0x02ca=function(_0xa4f529,_0x36add4){_0xa4f529=_0xa4f529-0x0;var _0x3ce0df=_0x2ca0[_0xa4f529];return _0x3ce0df;};'use strict';var _=require(_0x02ca('0x0'));var util=require(_0x02ca('0x1'));var logger=require(_0x02ca('0x2'))(_0x02ca('0x3'));var moment=require(_0x02ca('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x02ca('0x5'));var rimraf=require('rimraf');var config=require(_0x02ca('0x6'));var attributes=require(_0x02ca('0x7'));module[_0x02ca('0x8')]=function(_0x4b1211,_0x47d882){return _0x4b1211['define'](_0x02ca('0x9'),attributes,{'tableName':_0x02ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 00e542e..91156c3 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 _0x32f4=['request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x432db9,_0x20b76f){var _0x287d06=function(_0x3ef9db){while(--_0x3ef9db){_0x432db9['push'](_0x432db9['shift']());}};_0x287d06(++_0x20b76f);}(_0x32f4,0x154));var _0x432f=function(_0x31cd84,_0x3ec25a){_0x31cd84=_0x31cd84-0x0;var _0x55f053=_0x32f4[_0x31cd84];return _0x55f053;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});config['redis']=_[_0x432f('0xb')](config[_0x432f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x432f('0xd'))(new Redis(config['redis']));require(_0x432f('0xe'))[_0x432f('0xf')](socket);function respondWithRpcPromise(_0x3a0d4b,_0x13369a,_0x53f3ef){return new BPromise(function(_0x5d0155,_0x23fd9d){return client['request'](_0x3a0d4b,_0x53f3ef)[_0x432f('0x10')](function(_0x4b6c02){logger[_0x432f('0x11')](_0x432f('0x12'),_0x13369a,'request\x20sent');logger[_0x432f('0x13')](_0x432f('0x14'),_0x13369a,'request\x20sent',JSON[_0x432f('0x15')](_0x4b6c02));if(_0x4b6c02[_0x432f('0x16')]){if(_0x4b6c02['error']['code']===0x1f4){logger[_0x432f('0x16')](_0x432f('0x12'),_0x13369a,_0x4b6c02[_0x432f('0x16')][_0x432f('0x17')]);return _0x23fd9d(_0x4b6c02[_0x432f('0x16')]['message']);}logger[_0x432f('0x16')](_0x432f('0x12'),_0x13369a,_0x4b6c02[_0x432f('0x16')][_0x432f('0x17')]);return _0x5d0155(_0x4b6c02['error'][_0x432f('0x17')]);}else{logger[_0x432f('0x11')](_0x432f('0x12'),_0x13369a,_0x432f('0x18'));_0x5d0155(_0x4b6c02[_0x432f('0x19')][_0x432f('0x17')]);}})['catch'](function(_0x2d2c86){logger['error'](_0x432f('0x12'),_0x13369a,_0x2d2c86);_0x23fd9d(_0x2d2c86);});});} \ No newline at end of file +var _0xb491=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','VoicePrefix,\x20%s,\x20%s'];(function(_0x292423,_0x1759b7){var _0x2801cb=function(_0x23c821){while(--_0x23c821){_0x292423['push'](_0x292423['shift']());}};_0x2801cb(++_0x1759b7);}(_0xb491,0x18c));var _0x1b49=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0xb491[_0x427352];return _0x23e0e6;};'use strict';var _=require(_0x1b49('0x0'));var util=require(_0x1b49('0x1'));var moment=require(_0x1b49('0x2'));var BPromise=require(_0x1b49('0x3'));var rs=require(_0x1b49('0x4'));var fs=require('fs');var Redis=require(_0x1b49('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b49('0x6'));var logger=require(_0x1b49('0x7'))('rpc');var config=require(_0x1b49('0x8'));var jayson=require(_0x1b49('0x9'));var client=jayson[_0x1b49('0xa')]['http']({'port':0x232a});config[_0x1b49('0xb')]=_['defaults'](config[_0x1b49('0xb')],{'host':_0x1b49('0xc'),'port':0x18eb});var socket=require(_0x1b49('0xd'))(new Redis(config[_0x1b49('0xb')]));require(_0x1b49('0xe'))[_0x1b49('0xf')](socket);function respondWithRpcPromise(_0x36e294,_0x3dc13d,_0x2768e1){return new BPromise(function(_0x1174c3,_0x2ca75f){return client[_0x1b49('0x10')](_0x36e294,_0x2768e1)[_0x1b49('0x11')](function(_0x13ba5c){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x3dc13d,_0x1b49('0x12'));logger[_0x1b49('0x13')](_0x1b49('0x14'),_0x3dc13d,_0x1b49('0x12'),JSON[_0x1b49('0x15')](_0x13ba5c));if(_0x13ba5c['error']){if(_0x13ba5c[_0x1b49('0x16')]['code']===0x1f4){logger[_0x1b49('0x16')](_0x1b49('0x17'),_0x3dc13d,_0x13ba5c[_0x1b49('0x16')][_0x1b49('0x18')]);return _0x2ca75f(_0x13ba5c['error'][_0x1b49('0x18')]);}logger[_0x1b49('0x16')](_0x1b49('0x17'),_0x3dc13d,_0x13ba5c[_0x1b49('0x16')][_0x1b49('0x18')]);return _0x1174c3(_0x13ba5c[_0x1b49('0x16')][_0x1b49('0x18')]);}else{logger[_0x1b49('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x3dc13d,_0x1b49('0x12'));_0x1174c3(_0x13ba5c[_0x1b49('0x1a')]['message']);}})[_0x1b49('0x1b')](function(_0x20c51f){logger[_0x1b49('0x16')](_0x1b49('0x17'),_0x3dc13d,_0x20c51f);_0x2ca75f(_0x20c51f);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index e42f84b..36c7b60 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 _0x195e=['save','remove','update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x518ad2,_0x13f91b){var _0x8ee5ea=function(_0x5a516a){while(--_0x5a516a){_0x518ad2['push'](_0x518ad2['shift']());}};_0x8ee5ea(++_0x13f91b);}(_0x195e,0xfb));var _0xe195=function(_0x5bb053,_0x5158f8){_0x5bb053=_0x5bb053-0x0;var _0x44eed4=_0x195e[_0x5bb053];return _0x44eed4;};'use strict';var VoicePrefixEvents=require(_0xe195('0x0'));var events=[_0xe195('0x1'),_0xe195('0x2'),_0xe195('0x3')];function createListener(_0x40fe4d,_0x3975a9){return function(_0x31ca3b){_0x3975a9[_0xe195('0x4')](_0x40fe4d,_0x31ca3b);};}function removeListener(_0x2243e9,_0x30011c){return function(){VoicePrefixEvents[_0xe195('0x5')](_0x2243e9,_0x30011c);};}exports[_0xe195('0x6')]=function(_0x11cc55){for(var _0x595c13=0x0,_0x2a1acc=events[_0xe195('0x7')];_0x595c13<_0x2a1acc;_0x595c13++){var _0x2ead59=events[_0x595c13];var _0x28c1a9=createListener(_0xe195('0x8')+_0x2ead59,_0x11cc55);VoicePrefixEvents['on'](_0x2ead59,_0x28c1a9);}}; \ No newline at end of file +var _0x81d5=['register','length','voicePrefix:','./voicePrefix.events','save','update','emit','removeListener'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x81d5,0x1ab));var _0x581d=function(_0x943c09,_0x3c1a1c){_0x943c09=_0x943c09-0x0;var _0x54a590=_0x81d5[_0x943c09];return _0x54a590;};'use strict';var VoicePrefixEvents=require(_0x581d('0x0'));var events=[_0x581d('0x1'),'remove',_0x581d('0x2')];function createListener(_0x20d1a8,_0x2fe463){return function(_0x9fb336){_0x2fe463[_0x581d('0x3')](_0x20d1a8,_0x9fb336);};}function removeListener(_0x553617,_0x4801bc){return function(){VoicePrefixEvents[_0x581d('0x4')](_0x553617,_0x4801bc);};}exports[_0x581d('0x5')]=function(_0x1895d2){for(var _0x4bb545=0x0,_0x16067b=events[_0x581d('0x6')];_0x4bb545<_0x16067b;_0x4bb545++){var _0x43124c=events[_0x4bb545];var _0x497368=createListener(_0x581d('0x7')+_0x43124c,_0x1895d2);VoicePrefixEvents['on'](_0x43124c,_0x497368);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 90b55e5..0ef624e 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 _0x8f9d=['getHopperBlacks','getTeams','/:id/users','getAgents','/:id/lists','/:id/blacklists','post','create','/:id/clone','clone','/:id/teams','addAgents','addLists','addBlackLists','put','delete','removeTeams','removeLists','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black'];(function(_0x27734e,_0x5027c2){var _0x210f1d=function(_0x304f5d){while(--_0x304f5d){_0x27734e['push'](_0x27734e['shift']());}};_0x210f1d(++_0x5027c2);}(_0x8f9d,0x194));var _0xd8f9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f9d[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xd8f9('0x0'));var util=require('util');var path=require(_0xd8f9('0x1'));var timeout=require(_0xd8f9('0x2'));var express=require('express');var router=express[_0xd8f9('0x3')]();var fs_extra=require(_0xd8f9('0x4'));var auth=require(_0xd8f9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd8f9('0x6'));var controller=require(_0xd8f9('0x7'));router[_0xd8f9('0x8')]('/',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xa')]);router['get'](_0xd8f9('0xb'),auth[_0xd8f9('0x9')](),controller['show']);router[_0xd8f9('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller['getHoppers']);router[_0xd8f9('0x8')]('/:id/hopper_histories',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xc')]);router['get'](_0xd8f9('0xd'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xe')]);router['get'](_0xd8f9('0xf'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x10')]);router[_0xd8f9('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd8f9('0x11')]);router['get'](_0xd8f9('0x12'),auth['isAuthenticated'](),controller[_0xd8f9('0x13')]);router['get']('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xd8f9('0x14'),auth[_0xd8f9('0x9')](),controller['getLists']);router['get'](_0xd8f9('0x15'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xd8f9('0x16')]('/',auth['isAuthenticated'](),controller[_0xd8f9('0x17')]);router[_0xd8f9('0x16')](_0xd8f9('0x18'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x19')]);router[_0xd8f9('0x16')](_0xd8f9('0x1a'),auth['isAuthenticated'](),controller['addTeams']);router[_0xd8f9('0x16')](_0xd8f9('0x12'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x1b')]);router['post'](_0xd8f9('0x14'),auth['isAuthenticated'](),controller[_0xd8f9('0x1c')]);router['post'](_0xd8f9('0x15'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x1d')]);router[_0xd8f9('0x1e')](_0xd8f9('0xb'),auth[_0xd8f9('0x9')](),controller['update']);router[_0xd8f9('0x1f')](_0xd8f9('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xd8f9('0x1f')](_0xd8f9('0x1a'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x20')]);router[_0xd8f9('0x1f')](_0xd8f9('0x12'),auth['isAuthenticated'](),controller['removeAgents']);router['delete'](_0xd8f9('0x14'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x21')]);router['delete'](_0xd8f9('0x15'),auth[_0xd8f9('0x9')](),controller['removeBlackLists']);module[_0xd8f9('0x22')]=router; \ No newline at end of file +var _0x5a1f=['clone','/:id/users','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','removeBlackLists','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueue.controller','isAuthenticated','get','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','/:id/members','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone'];(function(_0x1937fb,_0x43fb5d){var _0xa7bb65=function(_0x3c7154){while(--_0x3c7154){_0x1937fb['push'](_0x1937fb['shift']());}};_0xa7bb65(++_0x43fb5d);}(_0x5a1f,0x1ba));var _0xf5a1=function(_0x743cac,_0x56c9c0){_0x743cac=_0x743cac-0x0;var _0x2b9689=_0x5a1f[_0x743cac];return _0x2b9689;};'use strict';var multer=require('multer');var util=require(_0xf5a1('0x0'));var path=require(_0xf5a1('0x1'));var timeout=require(_0xf5a1('0x2'));var express=require(_0xf5a1('0x3'));var router=express[_0xf5a1('0x4')]();var fs_extra=require(_0xf5a1('0x5'));var auth=require(_0xf5a1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf5a1('0x7'));var controller=require(_0xf5a1('0x8'));router['get']('/',auth[_0xf5a1('0x9')](),controller['index']);router[_0xf5a1('0xa')](_0xf5a1('0xb'),auth[_0xf5a1('0x9')](),controller[_0xf5a1('0xc')]);router['get'](_0xf5a1('0xd'),auth['isAuthenticated'](),controller['getHoppers']);router[_0xf5a1('0xa')](_0xf5a1('0xe'),auth[_0xf5a1('0x9')](),controller[_0xf5a1('0xf')]);router['get'](_0xf5a1('0x10'),auth[_0xf5a1('0x9')](),controller[_0xf5a1('0x11')]);router[_0xf5a1('0xa')](_0xf5a1('0x12'),auth['isAuthenticated'](),controller[_0xf5a1('0x13')]);router[_0xf5a1('0xa')](_0xf5a1('0x14'),auth[_0xf5a1('0x9')](),controller[_0xf5a1('0x15')]);router[_0xf5a1('0xa')]('/:id/users',auth[_0xf5a1('0x9')](),controller[_0xf5a1('0x16')]);router[_0xf5a1('0xa')](_0xf5a1('0x17'),auth[_0xf5a1('0x9')](),controller['getMembers']);router[_0xf5a1('0xa')](_0xf5a1('0x18'),auth[_0xf5a1('0x9')](),controller[_0xf5a1('0x19')]);router[_0xf5a1('0xa')](_0xf5a1('0x1a'),auth[_0xf5a1('0x9')](),controller[_0xf5a1('0x1b')]);router[_0xf5a1('0x1c')]('/',auth[_0xf5a1('0x9')](),controller[_0xf5a1('0x1d')]);router['post'](_0xf5a1('0x1e'),auth['isAuthenticated'](),controller[_0xf5a1('0x1f')]);router[_0xf5a1('0x1c')](_0xf5a1('0x14'),auth['isAuthenticated'](),controller['addTeams']);router[_0xf5a1('0x1c')](_0xf5a1('0x20'),auth[_0xf5a1('0x9')](),controller['addAgents']);router[_0xf5a1('0x1c')](_0xf5a1('0x18'),auth[_0xf5a1('0x9')](),controller[_0xf5a1('0x21')]);router[_0xf5a1('0x1c')](_0xf5a1('0x1a'),auth[_0xf5a1('0x9')](),controller[_0xf5a1('0x22')]);router[_0xf5a1('0x23')](_0xf5a1('0xb'),auth[_0xf5a1('0x9')](),controller[_0xf5a1('0x24')]);router[_0xf5a1('0x25')](_0xf5a1('0xb'),auth['isAuthenticated'](),controller[_0xf5a1('0x26')]);router[_0xf5a1('0x25')](_0xf5a1('0x14'),auth[_0xf5a1('0x9')](),controller[_0xf5a1('0x27')]);router[_0xf5a1('0x25')](_0xf5a1('0x20'),auth[_0xf5a1('0x9')](),controller[_0xf5a1('0x28')]);router[_0xf5a1('0x25')](_0xf5a1('0x18'),auth['isAuthenticated'](),controller['removeLists']);router[_0xf5a1('0x25')]('/:id/blacklists',auth[_0xf5a1('0x9')](),controller[_0xf5a1('0x29')]);module[_0xf5a1('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 d9ce2da..0ec76f5 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 _0x42b0=['dropRate','FLOAT','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','inbound','STRING','default','ENUM','ringall','random','rrmemory','rrordered','strategy','getDataValue','type','dialMethod','booked','progressive','power','INTEGER','yes','all','TEXT','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor'];(function(_0x1900b1,_0x40abe8){var _0x2e422d=function(_0x206dd1){while(--_0x206dd1){_0x1900b1['push'](_0x1900b1['shift']());}};_0x2e422d(++_0x40abe8);}(_0x42b0,0xbc));var _0x042b=function(_0x482611,_0x33356d){_0x482611=_0x482611-0x0;var _0x4aeb3a=_0x42b0[_0x482611];return _0x4aeb3a;};'use strict';var Sequelize=require(_0x042b('0x0'));module[_0x042b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x042b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x042b('0x3'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x042b('0x4')],'defaultValue':_0x042b('0x5')},'announce':{'type':Sequelize[_0x042b('0x4')],'defaultValue':''},'strategy':{'type':Sequelize[_0x042b('0x6')]('rr',_0x042b('0x7'),'leastrecent','fewestcalls',_0x042b('0x8'),_0x042b('0x9'),'linear','wrandom',_0x042b('0xa')),'allowNull':![],'defaultValue':'ringall','set':function(_0x8fd46a){this['setDataValue'](_0x042b('0xb'),_0x8fd46a?_0x8fd46a:_0x042b('0x9'));},'get':function(){var _0x1d2796=this[_0x042b('0xc')](_0x042b('0xd'));var _0x414f4a=this[_0x042b('0xc')](_0x042b('0xe'));var _0x21bf5c=this[_0x042b('0xc')](_0x042b('0xb'));if(_0x1d2796===_0x042b('0x3')){return _0x21bf5c;}if(_0x414f4a===_0x042b('0xf')&&_0x21bf5c==='rrmemory'||_0x414f4a===_0x042b('0xf')&&_0x21bf5c==='roundrobin'){return _0x21bf5c;}if(_0x414f4a===_0x042b('0x10')||_0x414f4a==='predictive'||_0x414f4a===_0x042b('0x11')){return _0x21bf5c;}return null;}},'servicelevel':{'type':Sequelize[_0x042b('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x042b('0x12')](0xb)},'timeout':{'type':Sequelize[_0x042b('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x042b('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x042b('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x042b('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x042b('0x6')](_0x042b('0x13'),'no'),'defaultValue':_0x042b('0x13')},'autopause':{'type':Sequelize['ENUM'](_0x042b('0x13'),'no',_0x042b('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x042b('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x042b('0x6')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x042b('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x042b('0x6')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x042b('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x042b('0x6')](_0x042b('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x042b('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x042b('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x042b('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x042b('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x042b('0x6')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x042b('0x6')](_0x042b('0x13'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x042b('0x6')](_0x042b('0x13'),'no')},'announce_position_limit':{'type':Sequelize[_0x042b('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x042b('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x042b('0x4')]},'queue_youarenext':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x042b('0x4')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x042b('0x15')],'set':function(_0x4ed494){this[_0x042b('0x16')](_0x042b('0x17'),_0x4ed494?_0x4ed494[_0x042b('0x18')](','):[]);},'get':function(){return this[_0x042b('0xc')](_0x042b('0x17'))?this[_0x042b('0xc')](_0x042b('0x17'))[_0x042b('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x042b('0x4')],'defaultValue':_0x042b('0x13'),'set':function(_0x2344f4){this[_0x042b('0x16')](_0x042b('0x1a'),_0x2344f4?_0x2344f4[_0x042b('0x18')](','):undefined);},'get':function(){return this[_0x042b('0xc')](_0x042b('0x1a'))?this['getDataValue'](_0x042b('0x1a'))[_0x042b('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x042b('0x4')],'defaultValue':'no','set':function(_0xa7b29a){this[_0x042b('0x16')](_0x042b('0x1b'),_0xa7b29a?_0xa7b29a['join'](','):undefined);},'get':function(){return this[_0x042b('0xc')](_0x042b('0x1b'))?this['getDataValue'](_0x042b('0x1b'))[_0x042b('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x042b('0x6')](_0x042b('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x042b('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x042b('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x042b('0x6')](_0x042b('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x042b('0x4')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x042b('0x1c')],'defaultValue':0x0,'set':function(_0x1502a7){this[_0x042b('0x16')]('acw',_0x1502a7);if(_0x1502a7){if(this[_0x042b('0xc')]('wrapuptime')<0x2){this[_0x042b('0x16')](_0x042b('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x042b('0x1c')],'defaultValue':0x0,'comment':_0x042b('0x1e')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x042b('0x10'),_0x042b('0x11'),'predictive',_0x042b('0xf')),'defaultValue':_0x042b('0x10'),'comment':_0x042b('0x1f')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x042b('0x20')},'dialLimitQueue':{'type':Sequelize[_0x042b('0x12')](0x4)[_0x042b('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x042b('0x22')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x042b('0x23')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x042b('0x24'),'dropRate'),'defaultValue':_0x042b('0x25'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x042b('0x26')](0x2)[_0x042b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x042b('0x12')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x042b('0x27')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x042b('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x042b('0x28'),'comment':_0x042b('0x29')},'dialQueueTimeout':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x042b('0x2a')},'dialQueueProject':{'type':Sequelize[_0x042b('0x4')],'comment':_0x042b('0x2b')},'dialCongestionMaxRetry':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x042b('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x042b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x042b('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x042b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x3,'comment':_0x042b('0x2e')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x042b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x042b('0x2f')},'dialGlobalMaxRetry':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x042b('0x30')},'dialTimezone':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x042b('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x042b('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x042b('0x31'),_0x042b('0x32'),'onlyIfOpen'),'defaultValue':_0x042b('0x31')},'dialAMDActive':{'type':Sequelize[_0x042b('0x1c')],'defaultValue':0x0,'comment':_0x042b('0x33')},'dialAMDInitialSilence':{'type':Sequelize[_0x042b('0x12')](0x9)[_0x042b('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x042b('0x34')},'dialAMDGreeting':{'type':Sequelize[_0x042b('0x12')](0x9)[_0x042b('0x21')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x042b('0x12')](0x9)[_0x042b('0x21')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x042b('0x35')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x042b('0x12')](0x9)[_0x042b('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x042b('0x36')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x042b('0x12')](0x9)[_0x042b('0x21')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x042b('0x37')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x042b('0x12')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x042b('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x042b('0x12')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x042b('0x38')},'dialRecallMeTimeout':{'type':Sequelize[_0x042b('0x12')](0x5)[_0x042b('0x21')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x042b('0x39')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x042b('0x3a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x042b('0x3b'),_0x042b('0x3c')),'defaultValue':_0x042b('0x3b')},'dialQueueProject2':{'type':Sequelize[_0x042b('0x4')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x042b('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x042b('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x042b('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x042b('0x3d')},'dialCutDigit':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x042b('0x3e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x042b('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x042b('0x3f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x042b('0x12')](0x5)[_0x042b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x042b('0x40')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x042b('0x41')},'dialDropRetryFrequency':{'type':Sequelize[_0x042b('0x12')](0x5)[_0x042b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x042b('0x42')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x042b('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x042b('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x042b('0x44')},'dialMachineMaxRetry':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x042b('0x45')},'dialMachineRetryFrequency':{'type':Sequelize[_0x042b('0x12')](0x5)[_0x042b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x042b('0x12')](0x5)[_0x042b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x042b('0x46')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x042b('0x12')],'allowNull':!![],'comment':_0x042b('0x47')},'mandatoryDisposition':{'type':Sequelize[_0x042b('0x1c')],'defaultValue':![],'comment':_0x042b('0x48'),'set':function(_0xa2d9a6){if(!_0xa2d9a6)this[_0x042b('0x16')](_0x042b('0x49'),null);this['setDataValue'](_0x042b('0x4a'),_0xa2d9a6);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x042b('0x12')](0x3)[_0x042b('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x2eb2=['#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','exports','STRING','name','ENUM','inbound','outbound','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','type','getDataValue','dialMethod','strategy','booked','progressive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','predictive','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','FLOAT','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,)','Busy\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)','never','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length'];(function(_0x305ad1,_0x580e62){var _0x556e37=function(_0x2c2588){while(--_0x2c2588){_0x305ad1['push'](_0x305ad1['shift']());}};_0x556e37(++_0x580e62);}(_0x2eb2,0x19f));var _0x22eb=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x2eb2[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![],'unique':_0x22eb('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x22eb('0x3')](_0x22eb('0x4'),_0x22eb('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x22eb('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x22eb('0x3')]('rr',_0x22eb('0x6'),_0x22eb('0x7'),_0x22eb('0x8'),_0x22eb('0x9'),_0x22eb('0xa'),_0x22eb('0xb'),_0x22eb('0xc'),_0x22eb('0xd')),'allowNull':![],'defaultValue':_0x22eb('0x6'),'set':function(_0xb9c8a4){this[_0x22eb('0xe')]('strategy',_0xb9c8a4?_0xb9c8a4:_0x22eb('0xa'));},'get':function(){var _0x54342e=this['getDataValue'](_0x22eb('0xf'));var _0x5d6f8a=this[_0x22eb('0x10')](_0x22eb('0x11'));var _0x57c798=this['getDataValue'](_0x22eb('0x12'));if(_0x54342e===_0x22eb('0x4')){return _0x57c798;}if(_0x5d6f8a===_0x22eb('0x13')&&_0x57c798===_0x22eb('0xa')||_0x5d6f8a===_0x22eb('0x13')&&_0x57c798==='roundrobin'){return _0x57c798;}if(_0x5d6f8a===_0x22eb('0x14')||_0x5d6f8a==='predictive'||_0x5d6f8a===_0x22eb('0x15')){return _0x57c798;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x22eb('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x22eb('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x22eb('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x22eb('0x17'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0x22eb('0x17'),'no',_0x22eb('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x22eb('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x22eb('0x3')](_0x22eb('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x22eb('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x22eb('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x22eb('0x3')](_0x22eb('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x22eb('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x22eb('0x3')](_0x22eb('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x22eb('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x22eb('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x22eb('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x22eb('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x22eb('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x22eb('0x3')](_0x22eb('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x22eb('0x3')]('yes','no'),'defaultValue':_0x22eb('0x17')},'announce_holdtime':{'type':Sequelize[_0x22eb('0x3')](_0x22eb('0x17'),'no',_0x22eb('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x22eb('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x22eb('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x22eb('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x22eb('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x22eb('0x1')]},'queue_youarenext':{'type':Sequelize[_0x22eb('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x22eb('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x22eb('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x22eb('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x22eb('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x22eb('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x22eb('0x1')]},'queue_quantity2':{'type':Sequelize[_0x22eb('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x22eb('0x1')]},'queue_less_than':{'type':Sequelize[_0x22eb('0x1')]},'periodic_announce':{'type':Sequelize[_0x22eb('0x1a')],'set':function(_0x14724e){this[_0x22eb('0xe')](_0x22eb('0x1b'),_0x14724e?_0x14724e[_0x22eb('0x1c')](','):[]);},'get':function(){return this[_0x22eb('0x10')](_0x22eb('0x1b'))?this[_0x22eb('0x10')]('periodic_announce')[_0x22eb('0x1d')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x22eb('0x17'),'set':function(_0x1e035a){this[_0x22eb('0xe')](_0x22eb('0x1e'),_0x1e035a?_0x1e035a[_0x22eb('0x1c')](','):undefined);},'get':function(){return this[_0x22eb('0x10')](_0x22eb('0x1e'))?this[_0x22eb('0x10')](_0x22eb('0x1e'))[_0x22eb('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x49259f){this[_0x22eb('0xe')]('leavewhenempty',_0x49259f?_0x49259f['join'](','):undefined);},'get':function(){return this[_0x22eb('0x10')](_0x22eb('0x1f'))?this[_0x22eb('0x10')](_0x22eb('0x1f'))[_0x22eb('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x22eb('0x3')](_0x22eb('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x22eb('0x3')](_0x22eb('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x22eb('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x22eb('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x22eb('0x20')],'defaultValue':0x0,'set':function(_0x2b5cb5){this['setDataValue'](_0x22eb('0x21'),_0x2b5cb5);if(_0x2b5cb5){if(this[_0x22eb('0x10')](_0x22eb('0x22'))<0x2){this[_0x22eb('0xe')](_0x22eb('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x22eb('0x20')],'defaultValue':0x0,'comment':_0x22eb('0x23')},'dialMethod':{'type':Sequelize['ENUM'](_0x22eb('0x24'),_0x22eb('0x14'),_0x22eb('0x15'),_0x22eb('0x25'),_0x22eb('0x13')),'defaultValue':'progressive','comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x22eb('0x16')](0x4)[_0x22eb('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x22eb('0x16')](0x4)[_0x22eb('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x22eb('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x22eb('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x22eb('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x22eb('0x3')](_0x22eb('0x29'),_0x22eb('0x2a')),'defaultValue':_0x22eb('0x2a'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x22eb('0x2b')](0x2)[_0x22eb('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x22eb('0x16')](0x3)[_0x22eb('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x22eb('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0x22eb('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x22eb('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x22eb('0x16')](0x3)[_0x22eb('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x22eb('0x2d')},'dialQueueOptions':{'type':Sequelize[_0x22eb('0x1')],'defaultValue':_0x22eb('0x2e'),'comment':_0x22eb('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x22eb('0x16')](0x3)[_0x22eb('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x22eb('0x30')},'dialQueueProject':{'type':Sequelize[_0x22eb('0x1')],'comment':_0x22eb('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0x22eb('0x16')](0x3)[_0x22eb('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x22eb('0x16')](0x5)[_0x22eb('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x22eb('0x16')](0x3)[_0x22eb('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x22eb('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x22eb('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x22eb('0x16')](0x5)[_0x22eb('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x22eb('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x22eb('0x16')](0x3)[_0x22eb('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x22eb('0x34')},'dialTimezone':{'type':Sequelize[_0x22eb('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x22eb('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x22eb('0x3')]('always',_0x22eb('0x35'),'onlyIfOpen'),'defaultValue':_0x22eb('0x36')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x22eb('0x37')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x22eb('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x22eb('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x22eb('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x22eb('0x16')](0x9)[_0x22eb('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x22eb('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x22eb('0x16')](0x9)[_0x22eb('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x22eb('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x22eb('0x16')](0x9)[_0x22eb('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x22eb('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x22eb('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x22eb('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x22eb('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x22eb('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x22eb('0x16')](0x9)[_0x22eb('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x22eb('0x16')](0x5)[_0x22eb('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x22eb('0x3e')},'dialRecallInQueue':{'type':Sequelize[_0x22eb('0x20')],'defaultValue':0x0,'comment':_0x22eb('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0x22eb('0x3')]('DESC',_0x22eb('0x40')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x22eb('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x22eb('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x22eb('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x22eb('0x16')](0x3)[_0x22eb('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x22eb('0x41')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x22eb('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x22eb('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x22eb('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x22eb('0x16')](0x5)[_0x22eb('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x22eb('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x22eb('0x16')](0x3)[_0x22eb('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x22eb('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x22eb('0x16')](0x5)[_0x22eb('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x22eb('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x22eb('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x22eb('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x22eb('0x16')](0x5)[_0x22eb('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x22eb('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x22eb('0x16')](0x3)[_0x22eb('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x22eb('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x22eb('0x16')](0x5)[_0x22eb('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x22eb('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x22eb('0x16')](0x3)[_0x22eb('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x22eb('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x22eb('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x22eb('0x16')],'allowNull':!![],'comment':_0x22eb('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x22eb('0x20')],'defaultValue':![],'comment':_0x22eb('0x4d'),'set':function(_0x196ad2){if(!_0x196ad2)this['setDataValue'](_0x22eb('0x4e'),null);this[_0x22eb('0xe')]('mandatoryDisposition',_0x196ad2);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x22eb('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x22eb('0x16')](0x3)[_0x22eb('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 14f8423..f27d886 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 _0x402a=['fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filters','where','merge','VIRTUAL','options','VoiceQueue','findAll','rows','catch','params','keys','includeAll','include','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','findOne','CmHopper','order','getHopperHistories','CmHopperHistory','CmHopperFinal','VoiceQueueId','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','Agents','online','voicePause','interface','flatMap','penalty','sequelize','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueue','findOrCreate','isNil','format','SIP/%s','forEach','emit','removeTeams','select','tq.TeamId','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','union','ids','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','phone','ContactId','ListId','field','scheduledAt','CmListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','fromQuery','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','phone\x20IS\x20NOT\x20NULL','removeBlackLists','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./voiceQueue.socket','register','end','json','offset','undefined','count','set','Content-Range','reject','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','name','destroy','status','sendStatus','error','stack','send','index','rawAttributes'];(function(_0x42c049,_0x4b6268){var _0x48a805=function(_0x29ed88){while(--_0x29ed88){_0x42c049['push'](_0x42c049['shift']());}};_0x48a805(++_0x4b6268);}(_0x402a,0x12f));var _0xa402=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x402a[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa402('0x0'));var rp=require(_0xa402('0x1'));var moment=require(_0xa402('0x2'));var BPromise=require(_0xa402('0x3'));var Mustache=require(_0xa402('0x4'));var util=require(_0xa402('0x5'));var path=require(_0xa402('0x6'));var sox=require('sox');var csv=require(_0xa402('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa402('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa402('0x9'));var toCsv=require(_0xa402('0x7'));var querystring=require('querystring');var Papa=require(_0xa402('0xa'));var Redis=require(_0xa402('0xb'));var authService=require(_0xa402('0xc'));var qs=require(_0xa402('0xd'));var as=require(_0xa402('0xe'));var hardwareService=require(_0xa402('0xf'));var logger=require('../../config/logger')(_0xa402('0x10'));var utils=require(_0xa402('0x11'));var config=require(_0xa402('0x12'));var licenseUtil=require(_0xa402('0x13'));var db=require(_0xa402('0x14'))['db'];config[_0xa402('0x15')]=_['defaults'](config[_0xa402('0x15')],{'host':_0xa402('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa402('0x15')]));require(_0xa402('0x17'))[_0xa402('0x18')](socket);function respondWithStatusCode(_0x127a88,_0x373050){_0x373050=_0x373050||0xcc;return function(_0x3980b7){if(_0x3980b7){return _0x127a88['sendStatus'](_0x373050);}return _0x127a88['status'](_0x373050)[_0xa402('0x19')]();};}function respondWithResult(_0x2e270d,_0x5a6255){_0x5a6255=_0x5a6255||0xc8;return function(_0x23e7ef){if(_0x23e7ef){return _0x2e270d['status'](_0x5a6255)[_0xa402('0x1a')](_0x23e7ef);}};}function respondWithFilteredResult(_0x4c9f5c,_0x177601){return function(_0x559589){if(_0x559589){var _0xc84a68=typeof _0x177601[_0xa402('0x1b')]===_0xa402('0x1c')&&typeof _0x177601['limit']===_0xa402('0x1c');var _0x36bf1c=_0x559589[_0xa402('0x1d')];var _0x44bba8=_0xc84a68?0x0:_0x177601[_0xa402('0x1b')];var _0x3e8be8=_0xc84a68?_0x559589[_0xa402('0x1d')]:_0x177601[_0xa402('0x1b')]+_0x177601['limit'];var _0x294565;if(_0x3e8be8>=_0x36bf1c){_0x3e8be8=_0x36bf1c;_0x294565=0xc8;}else{_0x294565=0xce;}_0x4c9f5c['status'](_0x294565);return _0x4c9f5c[_0xa402('0x1e')](_0xa402('0x1f'),_0x44bba8+'-'+_0x3e8be8+'/'+_0x36bf1c)[_0xa402('0x1a')](_0x559589);}return null;};}function patchUpdates(_0x1fb00c){return function(_0x4189e9){try{jsonpatch['apply'](_0x4189e9,_0x1fb00c,!![]);}catch(_0x19c65a){return BPromise[_0xa402('0x20')](_0x19c65a);}return _0x4189e9['save']();};}function saveUpdates(_0x3a57b9,_0x5b9981){return function(_0x47cd8c){if(_0x47cd8c){return _0x47cd8c[_0xa402('0x21')](_0x3a57b9)['then'](function(_0x3eea26){return _0x3eea26;});}return null;};}function removeEntity(_0x275235,_0x319ab0){return function(_0x19d6b4){if(_0x19d6b4){return _0x19d6b4['destroy']()[_0xa402('0x22')](function(){var _0xae460=_0x19d6b4[_0xa402('0x23')]({'plain':!![]});var _0x29a77f=[{'name':_0xa402('0x24'),'value':_0xa402('0x25'),'ignore':![]},{'name':_0xa402('0x26'),'value':_0xa402('0x27'),'ignore':![]}];var _0x1a4235=_(_0x29a77f)[_0xa402('0x28')](_0xa402('0x29'))[_0xa402('0x2a')](_0xa402('0x2b'))[_0xa402('0x2b')]();if(_['includes'](_0x1a4235,_0xae460[_0xa402('0x2c')])){return;}var _0x3c3ddf=_[_0xa402('0x2d')](_0x29a77f,['value',_0xae460[_0xa402('0x2c')]])[_0xa402('0x2e')];return db['UserProfileResource'][_0xa402('0x2f')]({'where':{'type':_0x3c3ddf,'resourceId':_0xae460['id']}})[_0xa402('0x22')](function(){return _0x19d6b4;});})[_0xa402('0x22')](function(){_0x275235[_0xa402('0x30')](0xcc)[_0xa402('0x19')]();});}};}function handleEntityNotFound(_0x47a0e4,_0x42ab96){return function(_0x33509a){if(!_0x33509a){_0x47a0e4[_0xa402('0x31')](0x194);}return _0x33509a;};}function handleError(_0xda665f,_0x4255d5){_0x4255d5=_0x4255d5||0x1f4;return function(_0x2daba6){logger[_0xa402('0x32')](_0x2daba6[_0xa402('0x33')]);if(_0x2daba6[_0xa402('0x2e')]){delete _0x2daba6[_0xa402('0x2e')];}_0xda665f[_0xa402('0x30')](_0x4255d5)[_0xa402('0x34')](_0x2daba6);};}exports[_0xa402('0x35')]=function(_0x1344dd,_0x17e32f){var _0x1b2d69={},_0x1b1c0f={},_0x3ed54e={'count':0x0,'rows':[]};var _0x17720f=_[_0xa402('0x2a')](db['VoiceQueue'][_0xa402('0x36')],function(_0x534b57){return{'name':_0x534b57[_0xa402('0x37')],'type':_0x534b57['type'][_0xa402('0x38')]};});_0x1b1c0f[_0xa402('0x39')]=_['map'](_0x17720f,_0xa402('0x2e'));_0x1b1c0f[_0xa402('0x3a')]=_['keys'](_0x1344dd['query']);_0x1b1c0f['filters']=_[_0xa402('0x3b')](_0x1b1c0f[_0xa402('0x39')],_0x1b1c0f[_0xa402('0x3a')]);_0x1b2d69[_0xa402('0x3c')]=_[_0xa402('0x3b')](_0x1b1c0f[_0xa402('0x39')],qs[_0xa402('0x3d')](_0x1344dd['query']['fields']));_0x1b2d69['attributes']=_0x1b2d69['attributes'][_0xa402('0x3e')]?_0x1b2d69[_0xa402('0x3c')]:_0x1b1c0f[_0xa402('0x39')];if(!_0x1344dd['query'][_0xa402('0x3f')](_0xa402('0x40'))){_0x1b2d69['limit']=qs[_0xa402('0x41')](_0x1344dd[_0xa402('0x3a')][_0xa402('0x41')]);_0x1b2d69['offset']=qs[_0xa402('0x1b')](_0x1344dd[_0xa402('0x3a')][_0xa402('0x1b')]);}_0x1b2d69['order']=qs[_0xa402('0x42')](_0x1344dd[_0xa402('0x3a')]['sort']);_0x1b2d69['where']=qs['filters'](_[_0xa402('0x43')](_0x1344dd[_0xa402('0x3a')],_0x1b1c0f[_0xa402('0x44')]),_0x17720f);if(_0x1344dd[_0xa402('0x3a')][_0xa402('0x28')]){_0x1b2d69[_0xa402('0x45')]=_[_0xa402('0x46')](_0x1b2d69[_0xa402('0x45')],{'$or':_[_0xa402('0x2a')](_0x17720f,function(_0x1d74bf){if(_0x1d74bf['type']!==_0xa402('0x47')){var _0x401add={};_0x401add[_0x1d74bf[_0xa402('0x2e')]]={'$like':'%'+_0x1344dd[_0xa402('0x3a')]['filter']+'%'};return _0x401add;}})});}_0x1b2d69=_[_0xa402('0x46')]({},_0x1b2d69,_0x1344dd[_0xa402('0x48')]);var _0x281617={'where':_0x1b2d69[_0xa402('0x45')]};return db[_0xa402('0x49')][_0xa402('0x1d')](_0x281617)[_0xa402('0x22')](function(_0x15d881){_0x3ed54e[_0xa402('0x1d')]=_0x15d881;if(_0x1344dd[_0xa402('0x3a')]['includeAll']){_0x1b2d69['include']=[{'all':!![]}];}return db[_0xa402('0x49')][_0xa402('0x4a')](_0x1b2d69);})['then'](function(_0x53ccf3){_0x3ed54e[_0xa402('0x4b')]=_0x53ccf3;return _0x3ed54e;})[_0xa402('0x22')](respondWithFilteredResult(_0x17e32f,_0x1b2d69))[_0xa402('0x4c')](handleError(_0x17e32f,null));};exports['show']=function(_0x198e1f,_0x1a7bdb){var _0x29e2ed={'raw':![],'where':{'id':_0x198e1f[_0xa402('0x4d')]['id']}},_0x232576={};_0x232576['model']=_[_0xa402('0x4e')](db[_0xa402('0x49')][_0xa402('0x36')]);_0x232576[_0xa402('0x3a')]=_[_0xa402('0x4e')](_0x198e1f[_0xa402('0x3a')]);_0x232576[_0xa402('0x44')]=_[_0xa402('0x3b')](_0x232576[_0xa402('0x39')],_0x232576[_0xa402('0x3a')]);_0x29e2ed['attributes']=_[_0xa402('0x3b')](_0x232576[_0xa402('0x39')],qs[_0xa402('0x3d')](_0x198e1f['query'][_0xa402('0x3d')]));_0x29e2ed[_0xa402('0x3c')]=_0x29e2ed[_0xa402('0x3c')][_0xa402('0x3e')]?_0x29e2ed['attributes']:_0x232576[_0xa402('0x39')];if(_0x198e1f[_0xa402('0x3a')][_0xa402('0x4f')]){_0x29e2ed[_0xa402('0x50')]=[{'all':!![]}];}_0x29e2ed=_[_0xa402('0x46')]({},_0x29e2ed,_0x198e1f[_0xa402('0x48')]);return db[_0xa402('0x49')]['find'](_0x29e2ed)['then'](handleEntityNotFound(_0x1a7bdb,null))[_0xa402('0x22')](respondWithResult(_0x1a7bdb,null))[_0xa402('0x4c')](handleError(_0x1a7bdb,null));};exports[_0xa402('0x51')]=function(_0x44c102,_0x19c08c){return db[_0xa402('0x49')][_0xa402('0x51')](_0x44c102[_0xa402('0x52')],{})['then'](function(_0x31d8a4){var _0x3d55f6=_0x44c102[_0xa402('0x53')][_0xa402('0x23')]({'plain':!![]});if(!_0x3d55f6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d55f6['role']==='user'){var _0x4e0163=_0x31d8a4['get']({'plain':!![]});var _0x1709c3=[{'name':_0xa402('0x24'),'value':_0xa402('0x25')},{'name':_0xa402('0x26'),'value':_0xa402('0x27')}];var _0x11ff31=_[_0xa402('0x2d')](_0x1709c3,[_0xa402('0x2b'),_0x4e0163['type']])[_0xa402('0x2e')];return db[_0xa402('0x54')][_0xa402('0x2d')]({'where':{'name':_0x11ff31,'userProfileId':_0x3d55f6[_0xa402('0x55')]},'raw':!![]})[_0xa402('0x22')](function(_0x58202c){if(_0x58202c&&_0x58202c[_0xa402('0x56')]===0x0){return db[_0xa402('0x57')][_0xa402('0x51')]({'name':_0x4e0163['name'],'resourceId':_0x4e0163['id'],'type':_0x58202c[_0xa402('0x2e')],'sectionId':_0x58202c['id']},{})['then'](function(){return _0x31d8a4;});}else{return _0x31d8a4;}})[_0xa402('0x4c')](function(_0x42ff4c){logger[_0xa402('0x32')](_0xa402('0x58'),_0x42ff4c);throw _0x42ff4c;});}return _0x31d8a4;})['then'](respondWithResult(_0x19c08c,0xc9))[_0xa402('0x4c')](handleError(_0x19c08c,null));};exports[_0xa402('0x59')]=function(_0x2e4607,_0x22c101){var _0x90bfad={'where':{'id':_0x2e4607[_0xa402('0x4d')]['id']}},_0x454efa={};_0x454efa['model']=_[_0xa402('0x4e')](db['VoiceQueue'][_0xa402('0x36')]);_0x90bfad[_0xa402('0x3c')]=_['intersection'](_0x454efa[_0xa402('0x39')],qs[_0xa402('0x3d')](_0x2e4607[_0xa402('0x3a')][_0xa402('0x3d')]));_0x90bfad['attributes']=_0x90bfad[_0xa402('0x3c')][_0xa402('0x3e')]?_0x90bfad[_0xa402('0x3c')]:_0x454efa['model'];if(_0x2e4607['query']['includeAll']){_0x90bfad[_0xa402('0x50')]=[{'all':!![]}];}_0x90bfad=_[_0xa402('0x46')]({},_0x90bfad,_0x2e4607[_0xa402('0x48')]);return db[_0xa402('0x49')][_0xa402('0x2d')](_0x90bfad)[_0xa402('0x22')](handleEntityNotFound(_0x22c101,null))[_0xa402('0x22')](function(_0x38c46f){if(_0x38c46f){var _0x400cc5=_0x38c46f[_0xa402('0x23')]({'plain':!![]});_0x400cc5=qs[_0xa402('0x5a')](_0x400cc5,['id',_0xa402('0x5b'),_0xa402('0x5c')]);_0x2e4607[_0xa402('0x52')]=_[_0xa402('0x5a')](_0x2e4607[_0xa402('0x52')],['id',_0xa402('0x5b'),'updatedAt']);return db[_0xa402('0x49')][_0xa402('0x51')](_[_0xa402('0x46')](_0x400cc5,_0x2e4607['body']),{'include':_0x2e4607[_0xa402('0x3a')][_0xa402('0x4f')]?[{'all':!![]}]:undefined})[_0xa402('0x22')](function(_0x579d07){var _0x4a5ab9=_0x2e4607[_0xa402('0x53')][_0xa402('0x23')]({'plain':!![]});if(!_0x4a5ab9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a5ab9[_0xa402('0x5d')]==='user'){var _0x4fbe46=_0x579d07[_0xa402('0x23')]({'plain':!![]});var _0x158d07=[{'name':_0xa402('0x24'),'value':_0xa402('0x25')},{'name':'QueueCampaigns','value':_0xa402('0x27')}];var _0x5c007f=_[_0xa402('0x2d')](_0x158d07,[_0xa402('0x2b'),_0x4fbe46[_0xa402('0x2c')]])[_0xa402('0x2e')];return db['UserProfileSection'][_0xa402('0x2d')]({'where':{'name':_0x5c007f,'userProfileId':_0x4a5ab9[_0xa402('0x55')]},'raw':!![]})[_0xa402('0x22')](function(_0x55af06){if(_0x55af06&&_0x55af06[_0xa402('0x56')]===0x0){return db[_0xa402('0x57')]['create']({'name':_0x4fbe46[_0xa402('0x2e')],'resourceId':_0x4fbe46['id'],'type':_0x55af06[_0xa402('0x2e')],'sectionId':_0x55af06['id']},{})['then'](function(){return _0x579d07;});}else{return _0x579d07;}})[_0xa402('0x4c')](function(_0x3e77e0){logger['error'](_0xa402('0x58'),_0x3e77e0);throw _0x3e77e0;});}return _0x579d07;});}})[_0xa402('0x22')](respondWithResult(_0x22c101,0xc9))[_0xa402('0x4c')](handleError(_0x22c101,null));};exports[_0xa402('0x21')]=function(_0x1e067f,_0x237ab1){if(_0x1e067f[_0xa402('0x52')]['id']){delete _0x1e067f[_0xa402('0x52')]['id'];}return db[_0xa402('0x49')]['find']({'where':{'id':_0x1e067f[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x237ab1,null))[_0xa402('0x22')](saveUpdates(_0x1e067f[_0xa402('0x52')],null))['then'](respondWithResult(_0x237ab1,null))[_0xa402('0x4c')](handleError(_0x237ab1,null));};exports[_0xa402('0x2f')]=function(_0x26da6,_0x4ccf92){return db['VoiceQueue'][_0xa402('0x2d')]({'where':{'id':_0x26da6[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x4ccf92,null))[_0xa402('0x22')](removeEntity(_0x4ccf92,null))['catch'](handleError(_0x4ccf92,null));};exports['getHoppers']=function(_0x5da8ad,_0x418411,_0x5a28e5){var _0xe66198={'raw':![],'where':{}};var _0x18f907={};var _0xdf3d8f={'count':0x0,'rows':[]};return db[_0xa402('0x49')][_0xa402('0x5e')]({'where':{'id':_0x5da8ad[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x418411,null))[_0xa402('0x22')](function(_0x288e4d){if(_0x288e4d){_0x18f907[_0xa402('0x39')]=_['keys'](db[_0xa402('0x5f')][_0xa402('0x36')]);_0x18f907['query']=_[_0xa402('0x4e')](_0x5da8ad[_0xa402('0x3a')]);_0x18f907[_0xa402('0x44')]=_[_0xa402('0x3b')](_0x18f907[_0xa402('0x39')],_0x18f907[_0xa402('0x3a')]);_0xe66198[_0xa402('0x3c')]=_[_0xa402('0x3b')](_0x18f907[_0xa402('0x39')],qs['fields'](_0x5da8ad[_0xa402('0x3a')]['fields']));_0xe66198[_0xa402('0x3c')]=_0xe66198[_0xa402('0x3c')]['length']?_0xe66198[_0xa402('0x3c')]:_0x18f907[_0xa402('0x39')];if(!_0x5da8ad['query'][_0xa402('0x3f')](_0xa402('0x40'))){_0xe66198[_0xa402('0x41')]=qs[_0xa402('0x41')](_0x5da8ad['query'][_0xa402('0x41')]);_0xe66198['offset']=qs[_0xa402('0x1b')](_0x5da8ad['query'][_0xa402('0x1b')]);}_0xe66198[_0xa402('0x60')]=qs[_0xa402('0x42')](_0x5da8ad['query'][_0xa402('0x42')]);_0xe66198[_0xa402('0x45')]=qs[_0xa402('0x44')](_[_0xa402('0x43')](_0x5da8ad[_0xa402('0x3a')],_0x18f907[_0xa402('0x44')]));_0xe66198[_0xa402('0x45')]['VoiceQueueId']=_0x288e4d['id'];if(_0x5da8ad['query'][_0xa402('0x28')]){_0xe66198[_0xa402('0x45')]=_[_0xa402('0x46')](_0xe66198['where'],{'$or':_['map'](_0xe66198['attributes'],function(_0x2352e4){var _0x135270={};_0x135270[_0x2352e4]={'$like':'%'+_0x5da8ad[_0xa402('0x3a')]['filter']+'%'};return _0x135270;})});}_0xe66198=_[_0xa402('0x46')]({},_0xe66198,_0x5da8ad[_0xa402('0x48')]);return db[_0xa402('0x5f')][_0xa402('0x1d')]({'where':_0xe66198[_0xa402('0x45')]})[_0xa402('0x22')](function(_0x39cf95){_0xdf3d8f['count']=_0x39cf95;if(_0x5da8ad[_0xa402('0x3a')]['includeAll']){_0xe66198['include']=[{'all':!![]}];}return db[_0xa402('0x5f')][_0xa402('0x4a')](_0xe66198);})['then'](function(_0x406471){_0xdf3d8f[_0xa402('0x4b')]=_0x406471;return _0xdf3d8f;});}})['then'](respondWithFilteredResult(_0x418411,_0xe66198))[_0xa402('0x4c')](handleError(_0x418411,null));};exports[_0xa402('0x61')]=function(_0x37f9ac,_0x15d0b5,_0x40e560){var _0x3e4cba={'raw':!![],'where':{}};var _0x305818={};var _0x259c20={'count':0x0,'rows':[]};return db[_0xa402('0x49')]['findOne']({'where':{'id':_0x37f9ac[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x15d0b5,null))[_0xa402('0x22')](function(_0x372950){if(_0x372950){_0x305818[_0xa402('0x39')]=_[_0xa402('0x4e')](db[_0xa402('0x62')]['rawAttributes']);_0x305818[_0xa402('0x3a')]=_['keys'](_0x37f9ac[_0xa402('0x3a')]);_0x305818[_0xa402('0x44')]=_[_0xa402('0x3b')](_0x305818[_0xa402('0x39')],_0x305818[_0xa402('0x3a')]);_0x3e4cba[_0xa402('0x3c')]=_[_0xa402('0x3b')](_0x305818['model'],qs[_0xa402('0x3d')](_0x37f9ac[_0xa402('0x3a')][_0xa402('0x3d')]));_0x3e4cba['attributes']=_0x3e4cba[_0xa402('0x3c')][_0xa402('0x3e')]?_0x3e4cba[_0xa402('0x3c')]:_0x305818['model'];if(!_0x37f9ac[_0xa402('0x3a')][_0xa402('0x3f')]('nolimit')){_0x3e4cba[_0xa402('0x41')]=qs['limit'](_0x37f9ac['query']['limit']);_0x3e4cba[_0xa402('0x1b')]=qs['offset'](_0x37f9ac[_0xa402('0x3a')][_0xa402('0x1b')]);}_0x3e4cba[_0xa402('0x60')]=qs['sort'](_0x37f9ac[_0xa402('0x3a')][_0xa402('0x42')]);_0x3e4cba[_0xa402('0x45')]=qs[_0xa402('0x44')](_[_0xa402('0x43')](_0x37f9ac[_0xa402('0x3a')],_0x305818[_0xa402('0x44')]));_0x3e4cba[_0xa402('0x45')]['VoiceQueueId']=_0x372950['id'];if(_0x37f9ac['query'][_0xa402('0x28')]){_0x3e4cba[_0xa402('0x45')]=_[_0xa402('0x46')](_0x3e4cba[_0xa402('0x45')],{'$or':_[_0xa402('0x2a')](_0x3e4cba[_0xa402('0x3c')],function(_0x471a81){var _0x101800={};_0x101800[_0x471a81]={'$like':'%'+_0x37f9ac[_0xa402('0x3a')]['filter']+'%'};return _0x101800;})});}_0x3e4cba=_[_0xa402('0x46')]({},_0x3e4cba,_0x37f9ac[_0xa402('0x48')]);return db[_0xa402('0x62')][_0xa402('0x1d')]({'where':_0x3e4cba[_0xa402('0x45')]})[_0xa402('0x22')](function(_0x174b03){_0x259c20[_0xa402('0x1d')]=_0x174b03;if(_0x37f9ac[_0xa402('0x3a')][_0xa402('0x4f')]){_0x3e4cba['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xa402('0x4a')](_0x3e4cba);})[_0xa402('0x22')](function(_0x2f3fa9){_0x259c20[_0xa402('0x4b')]=_0x2f3fa9;return _0x259c20;});}})[_0xa402('0x22')](respondWithFilteredResult(_0x15d0b5,_0x3e4cba))[_0xa402('0x4c')](handleError(_0x15d0b5,null));};exports['getHopperFinals']=function(_0x4ea643,_0x557532,_0x559d44){var _0xc362cc={'raw':!![],'where':{}};var _0x1bab0c={};var _0x4badd3={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa402('0x5e')]({'where':{'id':_0x4ea643[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x557532,null))[_0xa402('0x22')](function(_0x55d58e){if(_0x55d58e){_0x1bab0c[_0xa402('0x39')]=_['keys'](db[_0xa402('0x63')][_0xa402('0x36')]);_0x1bab0c[_0xa402('0x3a')]=_[_0xa402('0x4e')](_0x4ea643[_0xa402('0x3a')]);_0x1bab0c[_0xa402('0x44')]=_[_0xa402('0x3b')](_0x1bab0c[_0xa402('0x39')],_0x1bab0c[_0xa402('0x3a')]);_0xc362cc[_0xa402('0x3c')]=_[_0xa402('0x3b')](_0x1bab0c[_0xa402('0x39')],qs['fields'](_0x4ea643['query'][_0xa402('0x3d')]));_0xc362cc[_0xa402('0x3c')]=_0xc362cc['attributes'][_0xa402('0x3e')]?_0xc362cc['attributes']:_0x1bab0c[_0xa402('0x39')];if(!_0x4ea643[_0xa402('0x3a')][_0xa402('0x3f')](_0xa402('0x40'))){_0xc362cc[_0xa402('0x41')]=qs[_0xa402('0x41')](_0x4ea643[_0xa402('0x3a')]['limit']);_0xc362cc[_0xa402('0x1b')]=qs['offset'](_0x4ea643['query']['offset']);}_0xc362cc[_0xa402('0x60')]=qs['sort'](_0x4ea643[_0xa402('0x3a')][_0xa402('0x42')]);_0xc362cc[_0xa402('0x45')]=qs[_0xa402('0x44')](_[_0xa402('0x43')](_0x4ea643[_0xa402('0x3a')],_0x1bab0c[_0xa402('0x44')]));_0xc362cc['where'][_0xa402('0x64')]=_0x55d58e['id'];if(_0x4ea643[_0xa402('0x3a')][_0xa402('0x28')]){_0xc362cc['where']=_[_0xa402('0x46')](_0xc362cc[_0xa402('0x45')],{'$or':_['map'](_0xc362cc['attributes'],function(_0x3d47ce){var _0x176c93={};_0x176c93[_0x3d47ce]={'$like':'%'+_0x4ea643[_0xa402('0x3a')][_0xa402('0x28')]+'%'};return _0x176c93;})});}_0xc362cc=_[_0xa402('0x46')]({},_0xc362cc,_0x4ea643['options']);return db['CmHopperFinal']['count']({'where':_0xc362cc[_0xa402('0x45')]})['then'](function(_0x6e8779){_0x4badd3['count']=_0x6e8779;if(_0x4ea643[_0xa402('0x3a')]['includeAll']){_0xc362cc['include']=[{'all':!![]}];}return db[_0xa402('0x63')][_0xa402('0x4a')](_0xc362cc);})['then'](function(_0x22f002){_0x4badd3[_0xa402('0x4b')]=_0x22f002;return _0x4badd3;});}})[_0xa402('0x22')](respondWithFilteredResult(_0x557532,_0xc362cc))['catch'](handleError(_0x557532,null));};exports[_0xa402('0x65')]=function(_0x3c738d,_0x5e7057,_0x4140d6){var _0x44ea44={'raw':!![],'where':{}};var _0x3bbf9d={};var _0xa6f0c9={'count':0x0,'rows':[]};return db[_0xa402('0x49')][_0xa402('0x5e')]({'where':{'id':_0x3c738d[_0xa402('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5e7057,null))['then'](function(_0x53fa7e){if(_0x53fa7e){_0x3bbf9d[_0xa402('0x39')]=_[_0xa402('0x4e')](db['CmHopperBlack'][_0xa402('0x36')]);_0x3bbf9d['query']=_[_0xa402('0x4e')](_0x3c738d[_0xa402('0x3a')]);_0x3bbf9d[_0xa402('0x44')]=_[_0xa402('0x3b')](_0x3bbf9d[_0xa402('0x39')],_0x3bbf9d[_0xa402('0x3a')]);_0x44ea44['attributes']=_['intersection'](_0x3bbf9d[_0xa402('0x39')],qs[_0xa402('0x3d')](_0x3c738d[_0xa402('0x3a')]['fields']));_0x44ea44[_0xa402('0x3c')]=_0x44ea44['attributes'][_0xa402('0x3e')]?_0x44ea44['attributes']:_0x3bbf9d[_0xa402('0x39')];if(!_0x3c738d['query'][_0xa402('0x3f')](_0xa402('0x40'))){_0x44ea44[_0xa402('0x41')]=qs[_0xa402('0x41')](_0x3c738d[_0xa402('0x3a')][_0xa402('0x41')]);_0x44ea44[_0xa402('0x1b')]=qs[_0xa402('0x1b')](_0x3c738d[_0xa402('0x3a')][_0xa402('0x1b')]);}_0x44ea44[_0xa402('0x60')]=qs[_0xa402('0x42')](_0x3c738d['query'][_0xa402('0x42')]);_0x44ea44[_0xa402('0x45')]=qs[_0xa402('0x44')](_[_0xa402('0x43')](_0x3c738d[_0xa402('0x3a')],_0x3bbf9d[_0xa402('0x44')]));_0x44ea44[_0xa402('0x45')][_0xa402('0x64')]=_0x53fa7e['id'];if(_0x3c738d[_0xa402('0x3a')]['filter']){_0x44ea44[_0xa402('0x45')]=_[_0xa402('0x46')](_0x44ea44[_0xa402('0x45')],{'$or':_[_0xa402('0x2a')](_0x44ea44[_0xa402('0x3c')],function(_0x5f404f){var _0x242c69={};_0x242c69[_0x5f404f]={'$like':'%'+_0x3c738d[_0xa402('0x3a')][_0xa402('0x28')]+'%'};return _0x242c69;})});}_0x44ea44=_[_0xa402('0x46')]({},_0x44ea44,_0x3c738d['options']);return db[_0xa402('0x66')][_0xa402('0x1d')]({'where':_0x44ea44[_0xa402('0x45')]})['then'](function(_0x478174){_0xa6f0c9[_0xa402('0x1d')]=_0x478174;if(_0x3c738d[_0xa402('0x3a')][_0xa402('0x4f')]){_0x44ea44[_0xa402('0x50')]=[{'all':!![]}];}return db[_0xa402('0x66')][_0xa402('0x4a')](_0x44ea44);})['then'](function(_0x4f1d25){_0xa6f0c9[_0xa402('0x4b')]=_0x4f1d25;return _0xa6f0c9;});}})['then'](respondWithFilteredResult(_0x5e7057,_0x44ea44))[_0xa402('0x4c')](handleError(_0x5e7057,null));};exports[_0xa402('0x67')]=function(_0x12ffab,_0x4288f9,_0x55ea45){var _0xdc6b0f={};var _0x4d8c11={};var _0x4dc886;var _0x15e0e1;return db[_0xa402('0x49')][_0xa402('0x5e')]({'where':{'id':_0x12ffab[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x4288f9,null))['then'](function(_0x1319fe){if(_0x1319fe){_0x4dc886=_0x1319fe;_0x4d8c11[_0xa402('0x39')]=_[_0xa402('0x4e')](db[_0xa402('0x68')][_0xa402('0x36')]);_0x4d8c11[_0xa402('0x3a')]=_[_0xa402('0x4e')](_0x12ffab['query']);_0x4d8c11[_0xa402('0x44')]=_[_0xa402('0x3b')](_0x4d8c11['model'],_0x4d8c11[_0xa402('0x3a')]);_0xdc6b0f[_0xa402('0x3c')]=_[_0xa402('0x3b')](_0x4d8c11[_0xa402('0x39')],qs[_0xa402('0x3d')](_0x12ffab[_0xa402('0x3a')]['fields']));_0xdc6b0f[_0xa402('0x3c')]=_0xdc6b0f[_0xa402('0x3c')]['length']?_0xdc6b0f[_0xa402('0x3c')]:_0x4d8c11[_0xa402('0x39')];_0xdc6b0f[_0xa402('0x60')]=qs[_0xa402('0x42')](_0x12ffab['query']['sort']);_0xdc6b0f[_0xa402('0x45')]=qs['filters'](_['pick'](_0x12ffab[_0xa402('0x3a')],_0x4d8c11[_0xa402('0x44')]));if(_0x12ffab['query']['filter']){_0xdc6b0f[_0xa402('0x45')]=_[_0xa402('0x46')](_0xdc6b0f['where'],{'$or':_[_0xa402('0x2a')](_0xdc6b0f[_0xa402('0x3c')],function(_0x848e53){var _0x174ce0={};_0x174ce0[_0x848e53]={'$like':'%'+_0x12ffab[_0xa402('0x3a')]['filter']+'%'};return _0x174ce0;})});}_0xdc6b0f=_[_0xa402('0x46')]({},_0xdc6b0f,_0x12ffab[_0xa402('0x48')]);return _0x4dc886[_0xa402('0x67')](_0xdc6b0f);}})[_0xa402('0x22')](function(_0x2aaf16){if(_0x2aaf16){_0x15e0e1=_0x2aaf16[_0xa402('0x3e')];if(!_0x12ffab[_0xa402('0x3a')][_0xa402('0x3f')](_0xa402('0x40'))){_0xdc6b0f[_0xa402('0x41')]=qs['limit'](_0x12ffab[_0xa402('0x3a')][_0xa402('0x41')]);_0xdc6b0f[_0xa402('0x1b')]=qs[_0xa402('0x1b')](_0x12ffab[_0xa402('0x3a')][_0xa402('0x1b')]);}return _0x4dc886[_0xa402('0x67')](_0xdc6b0f);}})[_0xa402('0x22')](function(_0x369f3f){if(_0x369f3f){return _0x369f3f?{'count':_0x15e0e1,'rows':_0x369f3f}:null;}})[_0xa402('0x22')](respondWithResult(_0x4288f9,null))[_0xa402('0x4c')](handleError(_0x4288f9,null));};exports[_0xa402('0x69')]=function(_0x44d027,_0x552557,_0x547774){var _0x312035=_0x44d027['body']['teams'];var _0x130c2a=_['map'](_0x312035,'id');return db[_0xa402('0x68')][_0xa402('0x4a')]({'where':{'id':_0x130c2a},'attributes':['id'],'include':[{'model':db[_0xa402('0x6a')],'as':_0xa402('0x6b'),'attributes':['id','name',_0xa402('0x6c'),_0xa402('0x6d'),_0xa402('0x6e')],'raw':!![]}]})[_0xa402('0x22')](function(_0x8c9491){if(_0x8c9491){var _0x495afe=_[_0xa402('0x6f')](_0x8c9491,function(_0x132e2a){var _0x24dfff=_0x132e2a[_0xa402('0x23')]({'plain':!![]});_0x24dfff['Agents']['forEach'](function(_0x4a15d3){_0x4a15d3[_0xa402('0x70')]=_[_0xa402('0x2d')](_0x312035,{'id':_0x24dfff['id']})[_0xa402('0x70')];});return _0x24dfff[_0xa402('0x6b')];});return db[_0xa402('0x49')][_0xa402('0x2d')]({'where':{'id':_0x44d027[_0xa402('0x4d')]['id']}})['then'](function(_0x136e49){return db[_0xa402('0x71')][_0xa402('0x72')](function(_0x261fbb){return _0x136e49['addTeams'](_0x130c2a,{'transaction':_0x261fbb})[_0xa402('0x22')](function(){return BPromise['each'](_0x312035,function(_0x4c5f4e){return db[_0xa402('0x73')][_0xa402('0x74')]({'TeamId':_0x4c5f4e['id'],'VoiceQueueId':_0x44d027[_0xa402('0x4d')]['id'],'penalty':_0x4c5f4e['penalty']},{'transaction':_0x261fbb});});})[_0xa402('0x22')](function(){return BPromise[_0xa402('0x75')](_0x495afe,function(_0xfc1f6){return db[_0xa402('0x76')][_0xa402('0x77')]({'where':{'UserId':_0xfc1f6['id'],'VoiceQueueId':_0x44d027[_0xa402('0x4d')]['id']},'defaults':{'penalty':_0xfc1f6[_0xa402('0x70')]},'transaction':_0x261fbb});});})[_0xa402('0x22')](function(){return BPromise[_0xa402('0x75')](_[_0xa402('0x28')](_0x495afe,{'online':!![]}),function(_0x4fbb03){return db['UserVoiceQueueRt'][_0xa402('0x74')]({'membername':_0x4fbb03['name'],'UserId':_0x4fbb03['id'],'queue_name':_0x136e49[_0xa402('0x2e')],'VoiceQueueId':_0x136e49['id'],'interface':_[_0xa402('0x78')](_0x4fbb03[_0xa402('0x6e')])?util[_0xa402('0x79')](_0xa402('0x7a'),_0x4fbb03['name']):_0x4fbb03['interface'],'paused':_0x4fbb03[_0xa402('0x6d')]||![],'penalty':_0x4fbb03[_0xa402('0x70')]},{'transaction':_0x261fbb});});})[_0xa402('0x22')](function(){_0x495afe[_0xa402('0x7b')](function(_0xc0168e){socket[_0xa402('0x7c')]('userVoiceQueue:save',{'UserId':_0xc0168e['id'],'VoiceQueueId':_0x136e49['id']});});});});});}})[_0xa402('0x22')](respondWithStatusCode(_0x552557,null))['catch'](handleError(_0x552557,null));};exports[_0xa402('0x7d')]=function(_0x852bf5,_0x53d28e,_0x14b4c6){return db['Team'][_0xa402('0x4a')]({'where':{'id':_0x852bf5[_0xa402('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa402('0x6a')],'as':_0xa402('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xa402('0x22')](handleEntityNotFound(_0x53d28e,null))[_0xa402('0x22')](function(_0x7b91c0){var _0x22d209=_[_0xa402('0x2a')](_0x7b91c0,'id');var _0xe347cf=[];var _0x438ff2=[];var _0x14eea4=squel[_0xa402('0x7e')]();_0x14eea4['field'](_0xa402('0x7f'))[_0xa402('0x80')](_0xa402('0x81'),'tq')[_0xa402('0x82')]('user_has_teams','ut',_0xa402('0x83'))['where'](_0xa402('0x84'),_0x852bf5[_0xa402('0x4d')]['id']);for(var _0x1f41af=0x0;_0x1f41af<_0x7b91c0[_0xa402('0x3e')];_0x1f41af+=0x1){let _0x117e79=_0x7b91c0[_0x1f41af];for(var _0x538be3=0x0;_0x538be3<_0x117e79[_0xa402('0x6b')][_0xa402('0x3e')];_0x538be3+=0x1){let _0x5b81c0=_0x117e79[_0xa402('0x6b')][_0x538be3];var _0x396a87=_0x14eea4[_0xa402('0x59')]();_0x396a87['where'](_0xa402('0x85'),_0x5b81c0['id']);_0x438ff2[_0xa402('0x86')](db[_0xa402('0x71')]['query'](_0x396a87[_0xa402('0x87')](),{'type':db[_0xa402('0x71')][_0xa402('0x88')]['SELECT']})[_0xa402('0x22')](function(_0x29ff30){if(_0x29ff30['length']===0x1){return _0x5b81c0['id'];}else{var _0xa2b2de=_['every'](_['map'](_0x29ff30,_0xa402('0x89')),function(_0x481d19){return _[_0xa402('0x8a')](_0x22d209,_0x481d19);});if(_0xa2b2de){return _0x5b81c0['id'];}}}));}}return BPromise[_0xa402('0x8b')](_0x438ff2)[_0xa402('0x22')](function(_0x52dbd6){_0xe347cf=_(_0xe347cf)[_0xa402('0x8c')](_0x52dbd6)['compact']()['value']();return db[_0xa402('0x49')][_0xa402('0x2d')]({'where':{'id':_0x852bf5[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](function(_0x264e62){return db[_0xa402('0x71')][_0xa402('0x72')](function(_0x3f239d){return _0x264e62[_0xa402('0x7d')](_0x852bf5[_0xa402('0x3a')][_0xa402('0x8d')],{'transaction':_0x3f239d})[_0xa402('0x22')](function(){if(!_[_0xa402('0x8e')](_0xe347cf)){return _0x264e62[_0xa402('0x8f')](_0xe347cf,{'transaction':_0x3f239d})[_0xa402('0x22')](function(){return db[_0xa402('0x90')][_0xa402('0x2f')]({'where':{'VoiceQueueId':_0x852bf5[_0xa402('0x4d')]['id'],'UserId':_0xe347cf},'transaction':_0x3f239d});});}})[_0xa402('0x22')](function(){_0xe347cf['forEach'](function(_0x5e02eb){socket['emit'](_0xa402('0x91'),{'UserId':_0x5e02eb,'VoiceQueueId':_0x264e62['id']});});});});});});})[_0xa402('0x22')](respondWithStatusCode(_0x53d28e,null))[_0xa402('0x4c')](handleError(_0x53d28e,null));};exports['addAgents']=function(_0x35e5c1,_0x70a073,_0x26fc8c){var _0x1d99b7,_0xf43f21;return db[_0xa402('0x49')]['find']({'where':{'id':_0x35e5c1['params']['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x70a073,null))[_0xa402('0x22')](function(_0x2429be){if(_0x2429be){_0xf43f21=_0x2429be;return _0x2429be[_0xa402('0x92')](_0x35e5c1[_0xa402('0x52')][_0xa402('0x8d')],_['omit'](_0x35e5c1[_0xa402('0x52')],['ids','id'])||{})[_0xa402('0x93')](function(_0x5bc19e){for(var _0x477f2b=0x0;_0x477f2b<_0x35e5c1[_0xa402('0x52')][_0xa402('0x8d')][_0xa402('0x3e')];_0x477f2b+=0x1){socket[_0xa402('0x7c')]('userVoiceQueue:save',{'UserId':Number(_0x35e5c1['body']['ids'][_0x477f2b]),'VoiceQueueId':Number(_0x35e5c1[_0xa402('0x4d')]['id'])});}return _0x5bc19e;});}})[_0xa402('0x22')](function(_0x30103c){_0x1d99b7=_0x30103c||[];if(_0xf43f21){return db[_0xa402('0x6a')]['findAll']({'where':{'id':_0x35e5c1[_0xa402('0x52')][_0xa402('0x8d')]},'attributes':['id',_0xa402('0x2e'),'online','voicePause',_0xa402('0x6e')],'raw':!![]});}})[_0xa402('0x22')](function(_0xe24f82){if(!_[_0xa402('0x8e')](_0xe24f82)){var _0x454de2=[];for(var _0x4bf417=0x0;_0x4bf417<_0xe24f82['length'];_0x4bf417++){if(_0xe24f82[_0x4bf417][_0xa402('0x6c')]){_0x454de2['push'](db[_0xa402('0x90')][_0xa402('0x74')]({'membername':_0xe24f82[_0x4bf417][_0xa402('0x2e')],'UserId':_0xe24f82[_0x4bf417]['id'],'queue_name':_0xf43f21['name'],'VoiceQueueId':_0xf43f21['id'],'interface':_[_0xa402('0x78')](_0xe24f82[_0x4bf417][_0xa402('0x6e')])?util[_0xa402('0x79')](_0xa402('0x7a'),_0xe24f82[_0x4bf417]['name']):_0xe24f82[_0x4bf417][_0xa402('0x6e')],'paused':_0xe24f82[_0x4bf417][_0xa402('0x6d')]||![],'penalty':_0x35e5c1[_0xa402('0x52')][_0xa402('0x70')]||0x0}));}}return BPromise[_0xa402('0x8b')](_0x454de2);}})[_0xa402('0x22')](function(){return _0x1d99b7;})[_0xa402('0x22')](respondWithResult(_0x70a073,null))[_0xa402('0x4c')](handleError(_0x70a073,null));};exports[_0xa402('0x8f')]=function(_0x5a996b,_0x596977,_0x5b3f33){return db[_0xa402('0x49')][_0xa402('0x2d')]({'where':{'id':_0x5a996b['params']['id']}})['then'](handleEntityNotFound(_0x596977,null))[_0xa402('0x22')](function(_0x5c526c){if(_0x5c526c){return _0x5c526c[_0xa402('0x8f')](_0x5a996b[_0xa402('0x3a')][_0xa402('0x8d')])['then'](function(){if(_['isArray'](_0x5a996b[_0xa402('0x3a')][_0xa402('0x8d')])){for(var _0x27d943=0x0;_0x27d943<_0x5a996b[_0xa402('0x3a')][_0xa402('0x8d')]['length'];_0x27d943+=0x1){socket[_0xa402('0x7c')](_0xa402('0x91'),{'UserId':Number(_0x5a996b[_0xa402('0x3a')]['ids'][_0x27d943]),'VoiceQueueId':Number(_0x5a996b[_0xa402('0x4d')]['id'])});}}else{socket[_0xa402('0x7c')](_0xa402('0x91'),{'UserId':Number(_0x5a996b[_0xa402('0x3a')][_0xa402('0x8d')]),'VoiceQueueId':Number(_0x5a996b['params']['id'])});}});}})[_0xa402('0x22')](function(_0x40e5d8){return db[_0xa402('0x90')][_0xa402('0x2f')]({'where':{'VoiceQueueId':_0x5a996b[_0xa402('0x4d')]['id'],'UserId':_0x5a996b[_0xa402('0x3a')]['ids']}})['then'](function(){return _0x40e5d8;});})[_0xa402('0x22')](respondWithStatusCode(_0x596977,null))[_0xa402('0x4c')](handleError(_0x596977,null));};exports[_0xa402('0x94')]=function(_0x187732,_0x258f2a,_0x5d1b34){var _0x5df773={};var _0x239032={};var _0x488059;var _0x3f9a0c;return db[_0xa402('0x49')][_0xa402('0x5e')]({'where':{'id':_0x187732['params']['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x258f2a,null))[_0xa402('0x22')](function(_0x359a52){if(_0x359a52){_0x488059=_0x359a52;_0x239032[_0xa402('0x39')]=_[_0xa402('0x4e')](db[_0xa402('0x6a')][_0xa402('0x36')]);_0x239032[_0xa402('0x3a')]=_[_0xa402('0x4e')](_0x187732['query']);_0x239032[_0xa402('0x44')]=_[_0xa402('0x3b')](_0x239032['model'],_0x239032[_0xa402('0x3a')]);_0x5df773[_0xa402('0x3c')]=_[_0xa402('0x3b')](_0x239032[_0xa402('0x39')],qs['fields'](_0x187732[_0xa402('0x3a')]['fields']));_0x5df773[_0xa402('0x3c')]=_0x5df773['attributes'][_0xa402('0x3e')]?_0x5df773['attributes']:_0x239032['model'];_0x5df773['order']=qs['sort'](_0x187732[_0xa402('0x3a')][_0xa402('0x42')]);_0x5df773[_0xa402('0x45')]=qs[_0xa402('0x44')](_[_0xa402('0x43')](_0x187732[_0xa402('0x3a')],_0x239032[_0xa402('0x44')]));if(_0x187732['query'][_0xa402('0x28')]){_0x5df773[_0xa402('0x45')]=_[_0xa402('0x46')](_0x5df773['where'],{'$or':_[_0xa402('0x2a')](_0x5df773[_0xa402('0x3c')],function(_0xb04a61){var _0x2c0466={};_0x2c0466[_0xb04a61]={'$like':'%'+_0x187732[_0xa402('0x3a')][_0xa402('0x28')]+'%'};return _0x2c0466;})});}_0x5df773=_['merge']({},_0x5df773,_0x187732[_0xa402('0x48')]);return _0x488059[_0xa402('0x94')](_0x5df773);}})[_0xa402('0x22')](function(_0x5a6808){if(_0x5a6808){_0x3f9a0c=_0x5a6808['length'];if(!_0x187732['query'][_0xa402('0x3f')](_0xa402('0x40'))){_0x5df773[_0xa402('0x41')]=qs[_0xa402('0x41')](_0x187732[_0xa402('0x3a')][_0xa402('0x41')]);_0x5df773[_0xa402('0x1b')]=qs[_0xa402('0x1b')](_0x187732[_0xa402('0x3a')][_0xa402('0x1b')]);}return _0x488059[_0xa402('0x94')](_0x5df773);}})['then'](function(_0x5f09fc){if(_0x5f09fc){return _0x5f09fc?{'count':_0x3f9a0c,'rows':_0x5f09fc}:null;}})[_0xa402('0x22')](respondWithResult(_0x258f2a,null))[_0xa402('0x4c')](handleError(_0x258f2a,null));};exports['getMembers']=function(_0xf73026,_0x5f0c08,_0x19cfc1){var _0x30df3f={};var _0x35513f={};var _0x1fc1c5;var _0x1fedab;return db[_0xa402('0x49')][_0xa402('0x5e')]({'where':{'id':_0xf73026[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x5f0c08,null))[_0xa402('0x22')](function(_0x216874){if(_0x216874){_0x1fc1c5=_0x216874;_0x35513f['model']=_[_0xa402('0x4e')](db[_0xa402('0x90')][_0xa402('0x36')]);_0x35513f[_0xa402('0x3a')]=_[_0xa402('0x4e')](_0xf73026[_0xa402('0x3a')]);_0x35513f['filters']=_['intersection'](_0x35513f[_0xa402('0x39')],_0x35513f[_0xa402('0x3a')]);_0x30df3f[_0xa402('0x3c')]=_[_0xa402('0x3b')](_0x35513f[_0xa402('0x39')],qs[_0xa402('0x3d')](_0xf73026['query'][_0xa402('0x3d')]));_0x30df3f['attributes']=_0x30df3f[_0xa402('0x3c')][_0xa402('0x3e')]?_0x30df3f[_0xa402('0x3c')]:_0x35513f[_0xa402('0x39')];_0x30df3f['order']=qs[_0xa402('0x42')](_0xf73026[_0xa402('0x3a')]['sort']);_0x30df3f[_0xa402('0x45')]=qs[_0xa402('0x44')](_[_0xa402('0x43')](_0xf73026[_0xa402('0x3a')],_0x35513f[_0xa402('0x44')]));if(_0xf73026[_0xa402('0x3a')][_0xa402('0x28')]){_0x30df3f[_0xa402('0x45')]=_[_0xa402('0x46')](_0x30df3f['where'],{'$or':_[_0xa402('0x2a')](_0x30df3f[_0xa402('0x3c')],function(_0x1b1c70){var _0x23b32b={};_0x23b32b[_0x1b1c70]={'$like':'%'+_0xf73026[_0xa402('0x3a')][_0xa402('0x28')]+'%'};return _0x23b32b;})});}_0x30df3f=_[_0xa402('0x46')]({},_0x30df3f,_0xf73026[_0xa402('0x48')]);return _0x1fc1c5['getMembers'](_0x30df3f);}})[_0xa402('0x22')](function(_0x44d341){if(_0x44d341){_0x1fedab=_0x44d341[_0xa402('0x3e')];if(!_0xf73026[_0xa402('0x3a')][_0xa402('0x3f')](_0xa402('0x40'))){_0x30df3f[_0xa402('0x41')]=qs[_0xa402('0x41')](_0xf73026[_0xa402('0x3a')][_0xa402('0x41')]);_0x30df3f[_0xa402('0x1b')]=qs['offset'](_0xf73026['query']['offset']);}return _0x1fc1c5[_0xa402('0x95')](_0x30df3f);}})['then'](function(_0x1374f7){return _0x1374f7?{'count':_0x1fedab,'rows':_0x1374f7}:null;})['then'](respondWithResult(_0x5f0c08,null))[_0xa402('0x4c')](handleError(_0x5f0c08,null));};exports[_0xa402('0x96')]=function(_0x1378d5,_0x1b461a,_0x1c1b35){var _0x3a3ca3={};var _0x18804c={};var _0x136636;var _0x213085;return db[_0xa402('0x49')]['findOne']({'where':{'id':_0x1378d5[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x1b461a,null))['then'](function(_0x5ca8b4){if(_0x5ca8b4){_0x136636=_0x5ca8b4;_0x18804c[_0xa402('0x39')]=_[_0xa402('0x4e')](db[_0xa402('0x97')][_0xa402('0x36')]);_0x18804c[_0xa402('0x3a')]=_[_0xa402('0x4e')](_0x1378d5['query']);_0x18804c[_0xa402('0x44')]=_[_0xa402('0x3b')](_0x18804c['model'],_0x18804c['query']);_0x3a3ca3[_0xa402('0x3c')]=_['intersection'](_0x18804c[_0xa402('0x39')],qs[_0xa402('0x3d')](_0x1378d5[_0xa402('0x3a')]['fields']));_0x3a3ca3[_0xa402('0x3c')]=_0x3a3ca3[_0xa402('0x3c')][_0xa402('0x3e')]?_0x3a3ca3[_0xa402('0x3c')]:_0x18804c['model'];_0x3a3ca3[_0xa402('0x60')]=qs['sort'](_0x1378d5['query'][_0xa402('0x42')]);_0x3a3ca3[_0xa402('0x45')]=qs[_0xa402('0x44')](_[_0xa402('0x43')](_0x1378d5[_0xa402('0x3a')],_0x18804c['filters']));if(_0x1378d5[_0xa402('0x3a')][_0xa402('0x28')]){_0x3a3ca3[_0xa402('0x45')]=_[_0xa402('0x46')](_0x3a3ca3['where'],{'$or':_[_0xa402('0x2a')](_0x3a3ca3[_0xa402('0x3c')],function(_0x141e3a){var _0x13aecb={};_0x13aecb[_0x141e3a]={'$like':'%'+_0x1378d5['query'][_0xa402('0x28')]+'%'};return _0x13aecb;})});}_0x3a3ca3=_['merge']({},_0x3a3ca3,_0x1378d5[_0xa402('0x48')]);return _0x136636[_0xa402('0x96')](_0x3a3ca3);}})['then'](function(_0x3278e1){if(_0x3278e1){_0x213085=_0x3278e1['length'];if(!_0x1378d5[_0xa402('0x3a')][_0xa402('0x3f')](_0xa402('0x40'))){_0x3a3ca3['limit']=qs[_0xa402('0x41')](_0x1378d5[_0xa402('0x3a')]['limit']);_0x3a3ca3[_0xa402('0x1b')]=qs['offset'](_0x1378d5[_0xa402('0x3a')][_0xa402('0x1b')]);}return _0x136636[_0xa402('0x96')](_0x3a3ca3);}})[_0xa402('0x22')](function(_0x39ff6a){if(_0x39ff6a){return _0x39ff6a?{'count':_0x213085,'rows':_0x39ff6a}:null;}})['then'](respondWithResult(_0x1b461a,null))[_0xa402('0x4c')](handleError(_0x1b461a,null));};exports['addLists']=function(_0x550403,_0x2102f6,_0x1cabdf){var _0x1cbb16,_0x5a2079;return db[_0xa402('0x49')][_0xa402('0x2d')]({'where':{'id':_0x550403['params']['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x2102f6,null))['then'](function(_0x3fca89){if(_0x3fca89){_0x5a2079=_0x3fca89;return _0x3fca89[_0xa402('0x98')](_0x550403[_0xa402('0x52')]['ids'],_[_0xa402('0x5a')](_0x550403[_0xa402('0x52')],[_0xa402('0x8d'),'id'])||{});}return null;})[_0xa402('0x93')](function(_0x2bee8f){var _0xde9aac;_0x1cbb16=_0x2bee8f||[];var _0x5021d0=[];if(_0x2bee8f){for(var _0x1bef04=0x0;_0x1bef04<_0x2bee8f[_0xa402('0x3e')];_0x1bef04+=0x1){var _0x3f26dd=_0x2bee8f[_0x1bef04][_0xa402('0x23')]({'plain':!![]});_0x5a2079['dialCheckDuplicateType']=_0x550403[_0xa402('0x52')][_0xa402('0x99')]?_0x550403[_0xa402('0x52')][_0xa402('0x99')]:_0x5a2079[_0xa402('0x99')];switch(_0x5a2079[_0xa402('0x99')]){case _0xa402('0x9a'):_0xde9aac=squel[_0xa402('0x9b')]()[_0xa402('0x9c')]('cm_hopper')['fromQuery']([_0xa402('0x9d'),'scheduledAt',_0xa402('0x9e'),_0xa402('0x9f'),_0xa402('0x64'),_0xa402('0x5b'),_0xa402('0x5c')],squel[_0xa402('0x7e')]()[_0xa402('0xa0')](_0xa402('0x9d'),_0xa402('0x9d'))[_0xa402('0xa0')]('NOW()',_0xa402('0xa1'))[_0xa402('0xa0')]('id',_0xa402('0x9e'))[_0xa402('0xa0')](_0x3f26dd[_0xa402('0xa2')]['toString'](),_0xa402('0x9f'))[_0xa402('0xa0')](_0x550403[_0xa402('0x4d')]['id'][_0xa402('0x87')](),_0xa402('0x64'))[_0xa402('0xa0')](_0xa402('0xa3'),_0xa402('0x5b'))[_0xa402('0xa0')](_0xa402('0xa3'),_0xa402('0x5c'))[_0xa402('0x80')](_0xa402('0xa4'))[_0xa402('0x45')](_0xa402('0xa5'))[_0xa402('0x45')](_0xa402('0xa6'),_0x3f26dd[_0xa402('0xa2')]['toString']())[_0xa402('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0xa402('0x45')](_0xa402('0xa7'),squel[_0xa402('0x7e')]()['field'](_0xa402('0xa8'))[_0xa402('0x80')](_0xa402('0xa9'))[_0xa402('0x45')](_0xa402('0x84'),_0x550403[_0xa402('0x4d')]['id'][_0xa402('0x87')]()))[_0xa402('0x45')](_0xa402('0xa7'),squel[_0xa402('0x7e')]()[_0xa402('0xa0')]('COALESCE(phone,\x27\x27)')[_0xa402('0x80')]('cm_hopper')[_0xa402('0x45')](_0xa402('0x84'),_0x550403[_0xa402('0x4d')]['id'][_0xa402('0x87')]())))[_0xa402('0x87')]();break;case _0xa402('0xaa'):_0xde9aac=squel[_0xa402('0x9b')]()[_0xa402('0x9c')]('cm_hopper')[_0xa402('0xab')]([_0xa402('0x9d'),_0xa402('0xa1'),_0xa402('0x9e'),_0xa402('0x9f'),'VoiceQueueId','createdAt',_0xa402('0x5c')],squel[_0xa402('0x7e')]()[_0xa402('0xa0')](_0xa402('0x9d'),_0xa402('0x9d'))[_0xa402('0xa0')](_0xa402('0xa3'),_0xa402('0xa1'))[_0xa402('0xa0')]('id',_0xa402('0x9e'))[_0xa402('0xa0')](_0x3f26dd[_0xa402('0xa2')][_0xa402('0x87')](),_0xa402('0x9f'))[_0xa402('0xa0')](_0x550403[_0xa402('0x4d')]['id']['toString'](),_0xa402('0x64'))[_0xa402('0xa0')](_0xa402('0xa3'),_0xa402('0x5b'))[_0xa402('0xa0')](_0xa402('0xa3'),'updatedAt')[_0xa402('0x80')](_0xa402('0xa4'))[_0xa402('0x45')](_0xa402('0xa5'))[_0xa402('0x45')](_0xa402('0xa6'),_0x3f26dd[_0xa402('0xa2')][_0xa402('0x87')]())[_0xa402('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0xa402('0x45')](_0xa402('0xa7'),squel['select']()[_0xa402('0xa0')](_0xa402('0xac'))[_0xa402('0x80')]('cm_hopper')['where'](_0xa402('0x84'),_0x550403[_0xa402('0x4d')]['id'][_0xa402('0x87')]())))[_0xa402('0x87')]();break;default:_0xde9aac=squel[_0xa402('0x9b')]()[_0xa402('0x9c')]('cm_hopper')[_0xa402('0xab')](['phone',_0xa402('0xa1'),_0xa402('0x9e'),_0xa402('0x9f'),_0xa402('0x64'),_0xa402('0x5b'),_0xa402('0x5c')],squel['select']()['field'](_0xa402('0x9d'),_0xa402('0x9d'))[_0xa402('0xa0')](_0xa402('0xa3'),'scheduledAt')[_0xa402('0xa0')]('id',_0xa402('0x9e'))[_0xa402('0xa0')](_0x3f26dd['CmListId']['toString'](),_0xa402('0x9f'))[_0xa402('0xa0')](_0x550403[_0xa402('0x4d')]['id']['toString'](),_0xa402('0x64'))['field'](_0xa402('0xa3'),_0xa402('0x5b'))[_0xa402('0xa0')](_0xa402('0xa3'),_0xa402('0x5c'))[_0xa402('0x80')](_0xa402('0xa4'))[_0xa402('0x45')](_0xa402('0xa5'))[_0xa402('0x45')](_0xa402('0xa6'),_0x3f26dd[_0xa402('0xa2')][_0xa402('0x87')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x5021d0[_0xa402('0x86')](db[_0xa402('0x71')][_0xa402('0x3a')](_0xde9aac));}return BPromise[_0xa402('0x8b')](_0x5021d0);}})[_0xa402('0x22')](function(){return _0x1cbb16;})['then'](respondWithResult(_0x2102f6,null))[_0xa402('0x4c')](handleError(_0x2102f6,null));};exports[_0xa402('0xad')]=function(_0x43802e,_0x3e66db,_0x5a29b7){return db['VoiceQueue'][_0xa402('0x2d')]({'where':{'id':_0x43802e[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x3e66db,null))[_0xa402('0x22')](function(_0x347f88){if(_0x347f88){return _0x347f88['removeLists'](_0x43802e[_0xa402('0x3a')][_0xa402('0x8d')]);}})['then'](function(_0x113305){if(_0x113305){return db[_0xa402('0x5f')][_0xa402('0x2f')]({'where':{'ListId':_0x43802e[_0xa402('0x3a')][_0xa402('0x8d')],'VoiceQueueId':_0x43802e[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](function(){return _0x113305;});}})[_0xa402('0x22')](respondWithStatusCode(_0x3e66db,null))[_0xa402('0x4c')](handleError(_0x3e66db,null));};exports[_0xa402('0xae')]=function(_0xf3d7d8,_0x11737b,_0x4858d7){var _0x34df43={};var _0x2ae75a={};var _0x208108;var _0xec22be;return db[_0xa402('0x49')][_0xa402('0x5e')]({'where':{'id':_0xf3d7d8['params']['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x11737b,null))[_0xa402('0x22')](function(_0x5576f4){if(_0x5576f4){_0x208108=_0x5576f4;_0x2ae75a[_0xa402('0x39')]=_['keys'](db['CmList']['rawAttributes']);_0x2ae75a['query']=_[_0xa402('0x4e')](_0xf3d7d8[_0xa402('0x3a')]);_0x2ae75a['filters']=_[_0xa402('0x3b')](_0x2ae75a[_0xa402('0x39')],_0x2ae75a['query']);_0x34df43[_0xa402('0x3c')]=_['intersection'](_0x2ae75a[_0xa402('0x39')],qs[_0xa402('0x3d')](_0xf3d7d8[_0xa402('0x3a')][_0xa402('0x3d')]));_0x34df43['attributes']=_0x34df43[_0xa402('0x3c')]['length']?_0x34df43[_0xa402('0x3c')]:_0x2ae75a[_0xa402('0x39')];_0x34df43[_0xa402('0x60')]=qs[_0xa402('0x42')](_0xf3d7d8[_0xa402('0x3a')][_0xa402('0x42')]);_0x34df43[_0xa402('0x45')]=qs[_0xa402('0x44')](_[_0xa402('0x43')](_0xf3d7d8['query'],_0x2ae75a[_0xa402('0x44')]));if(_0xf3d7d8['query'][_0xa402('0x28')]){_0x34df43[_0xa402('0x45')]=_[_0xa402('0x46')](_0x34df43[_0xa402('0x45')],{'$or':_[_0xa402('0x2a')](_0x34df43[_0xa402('0x3c')],function(_0xaeaf2c){var _0x24966d={};_0x24966d[_0xaeaf2c]={'$like':'%'+_0xf3d7d8['query'][_0xa402('0x28')]+'%'};return _0x24966d;})});}_0x34df43=_[_0xa402('0x46')]({},_0x34df43,_0xf3d7d8[_0xa402('0x48')]);return _0x208108[_0xa402('0xae')](_0x34df43);}})[_0xa402('0x22')](function(_0x938add){if(_0x938add){_0xec22be=_0x938add[_0xa402('0x3e')];if(!_0xf3d7d8[_0xa402('0x3a')][_0xa402('0x3f')](_0xa402('0x40'))){_0x34df43[_0xa402('0x41')]=qs[_0xa402('0x41')](_0xf3d7d8[_0xa402('0x3a')][_0xa402('0x41')]);_0x34df43[_0xa402('0x1b')]=qs['offset'](_0xf3d7d8[_0xa402('0x3a')][_0xa402('0x1b')]);}return _0x208108[_0xa402('0xae')](_0x34df43);}})[_0xa402('0x22')](function(_0xe6e62a){if(_0xe6e62a){return _0xe6e62a?{'count':_0xec22be,'rows':_0xe6e62a}:null;}})['then'](respondWithResult(_0x11737b,null))['catch'](handleError(_0x11737b,null));};exports[_0xa402('0xaf')]=function(_0x3a2052,_0x46b08c,_0x4d85ac){var _0x30775c,_0x4aef16;return db['VoiceQueue'][_0xa402('0x2d')]({'where':{'id':_0x3a2052[_0xa402('0x4d')]['id']}})['then'](handleEntityNotFound(_0x46b08c,null))['then'](function(_0x279eb9){if(_0x279eb9){_0x4aef16=_0x279eb9;return _0x279eb9[_0xa402('0xaf')](_0x3a2052['body']['ids'],_['omit'](_0x3a2052[_0xa402('0x52')],['ids','id'])||{});}return null;})[_0xa402('0x93')](function(_0x2454e3){var _0x30537a;_0x30775c=_0x2454e3||[];var _0x32adac=[];if(_0x2454e3){for(var _0x3b727c=0x0;_0x3b727c<_0x2454e3['length'];_0x3b727c+=0x1){var _0x310a96=_0x2454e3[_0x3b727c][_0xa402('0x23')]({'plain':!![]});_0x30537a=squel[_0xa402('0x9b')]()['into'](_0xa402('0xb0'))[_0xa402('0xab')]([_0xa402('0x9d'),_0xa402('0x9e'),_0xa402('0x9f'),_0xa402('0x64'),_0xa402('0x5b'),_0xa402('0x5c')],squel['select']()[_0xa402('0xa0')](_0xa402('0x9d'),_0xa402('0x9d'))[_0xa402('0xa0')]('id',_0xa402('0x9e'))[_0xa402('0xa0')](_0x310a96['CmListId']['toString'](),_0xa402('0x9f'))[_0xa402('0xa0')](_0x3a2052[_0xa402('0x4d')]['id'][_0xa402('0x87')](),_0xa402('0x64'))[_0xa402('0xa0')](_0xa402('0xa3'),_0xa402('0x5b'))[_0xa402('0xa0')]('NOW()',_0xa402('0x5c'))['from']('cm_contacts')[_0xa402('0x45')](_0xa402('0xa5'))['where'](_0xa402('0xa6'),_0x310a96[_0xa402('0xa2')]['toString']())['where'](_0xa402('0xb1')))[_0xa402('0x87')]();_0x32adac[_0xa402('0x86')](db[_0xa402('0x71')][_0xa402('0x3a')](_0x30537a));}return BPromise['all'](_0x32adac);}})[_0xa402('0x22')](function(){return _0x30775c;})[_0xa402('0x22')](respondWithResult(_0x46b08c,null))[_0xa402('0x4c')](handleError(_0x46b08c,null));};exports['removeBlackLists']=function(_0x404944,_0x1cc8d4,_0x716f22){return db['VoiceQueue']['find']({'where':{'id':_0x404944[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](handleEntityNotFound(_0x1cc8d4,null))['then'](function(_0x583c0b){if(_0x583c0b){return _0x583c0b[_0xa402('0xb2')](_0x404944[_0xa402('0x3a')][_0xa402('0x8d')]);}})[_0xa402('0x22')](function(_0x1b9804){if(_0x1b9804){return db[_0xa402('0x66')][_0xa402('0x2f')]({'where':{'ListId':_0x404944['query'][_0xa402('0x8d')],'VoiceQueueId':_0x404944[_0xa402('0x4d')]['id']}})[_0xa402('0x22')](function(){return _0x1b9804;});}})[_0xa402('0x22')](respondWithStatusCode(_0x1cc8d4,null))['catch'](handleError(_0x1cc8d4,null));}; \ No newline at end of file +var _0x20fa=['isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','isArray','getAgents','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','cm_hopper','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','fromQuery','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','get','VoiceQueues','inbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','VoiceQueue','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','merge','map','options','includeAll','include','rows','catch','show','params','create','body','user','QueueCampaigns','outbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','role','destroy','getHoppers','findOne','CmHopper','pick','VoiceQueueId','findAll','CmHopperHistory','getHopperFinals','CmHopperFinal','hasOwnProperty','getHopperBlacks','CmHopperBlack','Team','addTeams','User','Agents','online','voicePause','interface','flatMap','transaction','each','penalty','UserVoiceQueue','UserVoiceQueueRt','upsert','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','compact'];(function(_0x489c95,_0x53159c){var _0x10e7a7=function(_0xcb4342){while(--_0xcb4342){_0x489c95['push'](_0x489c95['shift']());}};_0x10e7a7(++_0x53159c);}(_0x20fa,0x18f));var _0xa20f=function(_0x549278,_0x450754){_0x549278=_0x549278-0x0;var _0x1ea9a1=_0x20fa[_0x549278];return _0x1ea9a1;};'use strict';var emlformat=require(_0xa20f('0x0'));var rimraf=require(_0xa20f('0x1'));var zipdir=require(_0xa20f('0x2'));var jsonpatch=require(_0xa20f('0x3'));var rp=require(_0xa20f('0x4'));var moment=require(_0xa20f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa20f('0x6'));var path=require(_0xa20f('0x7'));var sox=require(_0xa20f('0x8'));var csv=require(_0xa20f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa20f('0xa'));var squel=require(_0xa20f('0xb'));var crypto=require('crypto');var jsforce=require(_0xa20f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa20f('0x9'));var querystring=require('querystring');var Papa=require(_0xa20f('0xd'));var Redis=require(_0xa20f('0xe'));var authService=require(_0xa20f('0xf'));var qs=require(_0xa20f('0x10'));var as=require(_0xa20f('0x11'));var hardwareService=require(_0xa20f('0x12'));var logger=require(_0xa20f('0x13'))('api');var utils=require(_0xa20f('0x14'));var config=require(_0xa20f('0x15'));var licenseUtil=require(_0xa20f('0x16'));var db=require(_0xa20f('0x17'))['db'];config['redis']=_['defaults'](config[_0xa20f('0x18')],{'host':_0xa20f('0x19'),'port':0x18eb});var socket=require(_0xa20f('0x1a'))(new Redis(config[_0xa20f('0x18')]));require(_0xa20f('0x1b'))[_0xa20f('0x1c')](socket);function respondWithStatusCode(_0x147596,_0x3e0802){_0x3e0802=_0x3e0802||0xcc;return function(_0x4296af){if(_0x4296af){return _0x147596['sendStatus'](_0x3e0802);}return _0x147596[_0xa20f('0x1d')](_0x3e0802)[_0xa20f('0x1e')]();};}function respondWithResult(_0x3c857d,_0x15d358){_0x15d358=_0x15d358||0xc8;return function(_0x5340ad){if(_0x5340ad){return _0x3c857d[_0xa20f('0x1d')](_0x15d358)['json'](_0x5340ad);}};}function respondWithFilteredResult(_0xc24553,_0xd7cfbd){return function(_0x5445e5){if(_0x5445e5){var _0x342ec9=typeof _0xd7cfbd[_0xa20f('0x1f')]===_0xa20f('0x20')&&typeof _0xd7cfbd[_0xa20f('0x21')]==='undefined';var _0x4d8189=_0x5445e5['count'];var _0x1171d7=_0x342ec9?0x0:_0xd7cfbd['offset'];var _0x4d4035=_0x342ec9?_0x5445e5[_0xa20f('0x22')]:_0xd7cfbd[_0xa20f('0x1f')]+_0xd7cfbd['limit'];var _0x3b0c75;if(_0x4d4035>=_0x4d8189){_0x4d4035=_0x4d8189;_0x3b0c75=0xc8;}else{_0x3b0c75=0xce;}_0xc24553['status'](_0x3b0c75);return _0xc24553['set'](_0xa20f('0x23'),_0x1171d7+'-'+_0x4d4035+'/'+_0x4d8189)[_0xa20f('0x24')](_0x5445e5);}return null;};}function patchUpdates(_0x15a74e){return function(_0x456a4f){try{jsonpatch[_0xa20f('0x25')](_0x456a4f,_0x15a74e,!![]);}catch(_0x2eee5d){return BPromise[_0xa20f('0x26')](_0x2eee5d);}return _0x456a4f[_0xa20f('0x27')]();};}function saveUpdates(_0x10a15f,_0x4053a9){return function(_0x14c3ad){if(_0x14c3ad){return _0x14c3ad[_0xa20f('0x28')](_0x10a15f)[_0xa20f('0x29')](function(_0x28419f){return _0x28419f;});}return null;};}function removeEntity(_0x141802,_0x3a93b7){return function(_0x2cbdef){if(_0x2cbdef){return _0x2cbdef['destroy']()[_0xa20f('0x29')](function(){var _0x49dc47=_0x2cbdef[_0xa20f('0x2a')]({'plain':!![]});var _0x10913b=[{'name':_0xa20f('0x2b'),'value':_0xa20f('0x2c'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x5f0a97=_(_0x10913b)[_0xa20f('0x2d')](_0xa20f('0x2e'))['map'](_0xa20f('0x2f'))['value']();if(_[_0xa20f('0x30')](_0x5f0a97,_0x49dc47[_0xa20f('0x31')])){return;}var _0x5ab29b=_[_0xa20f('0x32')](_0x10913b,[_0xa20f('0x2f'),_0x49dc47['type']])[_0xa20f('0x33')];return db[_0xa20f('0x34')]['destroy']({'where':{'type':_0x5ab29b,'resourceId':_0x49dc47['id']}})['then'](function(){return _0x2cbdef;});})[_0xa20f('0x29')](function(){_0x141802[_0xa20f('0x1d')](0xcc)[_0xa20f('0x1e')]();});}};}function handleEntityNotFound(_0x268d92,_0x4e9f1a){return function(_0x3cfc8f){if(!_0x3cfc8f){_0x268d92['sendStatus'](0x194);}return _0x3cfc8f;};}function handleError(_0x4df9a6,_0x5ab1a0){_0x5ab1a0=_0x5ab1a0||0x1f4;return function(_0x5c00c1){logger[_0xa20f('0x35')](_0x5c00c1['stack']);if(_0x5c00c1[_0xa20f('0x33')]){delete _0x5c00c1[_0xa20f('0x33')];}_0x4df9a6['status'](_0x5ab1a0)['send'](_0x5c00c1);};}exports['index']=function(_0x3f93f1,_0xc94803){var _0x246dc8={},_0x167889={},_0x269c49={'count':0x0,'rows':[]};var _0xd3abdf=_['map'](db[_0xa20f('0x36')][_0xa20f('0x37')],function(_0x178946){return{'name':_0x178946[_0xa20f('0x38')],'type':_0x178946[_0xa20f('0x31')]['key']};});_0x167889['model']=_['map'](_0xd3abdf,'name');_0x167889[_0xa20f('0x39')]=_[_0xa20f('0x3a')](_0x3f93f1[_0xa20f('0x39')]);_0x167889[_0xa20f('0x3b')]=_[_0xa20f('0x3c')](_0x167889['model'],_0x167889[_0xa20f('0x39')]);_0x246dc8[_0xa20f('0x3d')]=_[_0xa20f('0x3c')](_0x167889[_0xa20f('0x3e')],qs[_0xa20f('0x3f')](_0x3f93f1[_0xa20f('0x39')][_0xa20f('0x3f')]));_0x246dc8[_0xa20f('0x3d')]=_0x246dc8[_0xa20f('0x3d')][_0xa20f('0x40')]?_0x246dc8['attributes']:_0x167889[_0xa20f('0x3e')];if(!_0x3f93f1[_0xa20f('0x39')]['hasOwnProperty'](_0xa20f('0x41'))){_0x246dc8[_0xa20f('0x21')]=qs['limit'](_0x3f93f1[_0xa20f('0x39')][_0xa20f('0x21')]);_0x246dc8[_0xa20f('0x1f')]=qs[_0xa20f('0x1f')](_0x3f93f1[_0xa20f('0x39')]['offset']);}_0x246dc8[_0xa20f('0x42')]=qs['sort'](_0x3f93f1[_0xa20f('0x39')][_0xa20f('0x43')]);_0x246dc8['where']=qs[_0xa20f('0x3b')](_['pick'](_0x3f93f1['query'],_0x167889[_0xa20f('0x3b')]),_0xd3abdf);if(_0x3f93f1[_0xa20f('0x39')][_0xa20f('0x2d')]){_0x246dc8[_0xa20f('0x44')]=_[_0xa20f('0x45')](_0x246dc8[_0xa20f('0x44')],{'$or':_[_0xa20f('0x46')](_0xd3abdf,function(_0x45a5ce){if(_0x45a5ce[_0xa20f('0x31')]!=='VIRTUAL'){var _0x29f731={};_0x29f731[_0x45a5ce[_0xa20f('0x33')]]={'$like':'%'+_0x3f93f1[_0xa20f('0x39')][_0xa20f('0x2d')]+'%'};return _0x29f731;}})});}_0x246dc8=_[_0xa20f('0x45')]({},_0x246dc8,_0x3f93f1[_0xa20f('0x47')]);var _0x332d5a={'where':_0x246dc8['where']};return db[_0xa20f('0x36')][_0xa20f('0x22')](_0x332d5a)[_0xa20f('0x29')](function(_0x52b110){_0x269c49[_0xa20f('0x22')]=_0x52b110;if(_0x3f93f1['query'][_0xa20f('0x48')]){_0x246dc8[_0xa20f('0x49')]=[{'all':!![]}];}return db[_0xa20f('0x36')]['findAll'](_0x246dc8);})[_0xa20f('0x29')](function(_0x1993e4){_0x269c49[_0xa20f('0x4a')]=_0x1993e4;return _0x269c49;})[_0xa20f('0x29')](respondWithFilteredResult(_0xc94803,_0x246dc8))[_0xa20f('0x4b')](handleError(_0xc94803,null));};exports[_0xa20f('0x4c')]=function(_0x3c7024,_0x330694){var _0x50d827={'raw':![],'where':{'id':_0x3c7024[_0xa20f('0x4d')]['id']}},_0x5721ef={};_0x5721ef[_0xa20f('0x3e')]=_[_0xa20f('0x3a')](db[_0xa20f('0x36')]['rawAttributes']);_0x5721ef[_0xa20f('0x39')]=_[_0xa20f('0x3a')](_0x3c7024['query']);_0x5721ef[_0xa20f('0x3b')]=_[_0xa20f('0x3c')](_0x5721ef[_0xa20f('0x3e')],_0x5721ef[_0xa20f('0x39')]);_0x50d827[_0xa20f('0x3d')]=_['intersection'](_0x5721ef['model'],qs[_0xa20f('0x3f')](_0x3c7024[_0xa20f('0x39')]['fields']));_0x50d827['attributes']=_0x50d827[_0xa20f('0x3d')][_0xa20f('0x40')]?_0x50d827[_0xa20f('0x3d')]:_0x5721ef[_0xa20f('0x3e')];if(_0x3c7024['query'][_0xa20f('0x48')]){_0x50d827[_0xa20f('0x49')]=[{'all':!![]}];}_0x50d827=_[_0xa20f('0x45')]({},_0x50d827,_0x3c7024[_0xa20f('0x47')]);return db['VoiceQueue'][_0xa20f('0x32')](_0x50d827)['then'](handleEntityNotFound(_0x330694,null))[_0xa20f('0x29')](respondWithResult(_0x330694,null))['catch'](handleError(_0x330694,null));};exports[_0xa20f('0x4e')]=function(_0x5e4f31,_0xb6c6a1){return db[_0xa20f('0x36')][_0xa20f('0x4e')](_0x5e4f31[_0xa20f('0x4f')],{})[_0xa20f('0x29')](function(_0x112646){var _0x2182a0=_0x5e4f31[_0xa20f('0x50')][_0xa20f('0x2a')]({'plain':!![]});if(!_0x2182a0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2182a0['role']===_0xa20f('0x50')){var _0x105597=_0x112646[_0xa20f('0x2a')]({'plain':!![]});var _0x1680f7=[{'name':_0xa20f('0x2b'),'value':'inbound'},{'name':_0xa20f('0x51'),'value':_0xa20f('0x52')}];var _0x2809be=_['find'](_0x1680f7,[_0xa20f('0x2f'),_0x105597[_0xa20f('0x31')]])[_0xa20f('0x33')];return db[_0xa20f('0x53')][_0xa20f('0x32')]({'where':{'name':_0x2809be,'userProfileId':_0x2182a0[_0xa20f('0x54')]},'raw':!![]})['then'](function(_0x3e22af){if(_0x3e22af&&_0x3e22af[_0xa20f('0x55')]===0x0){return db['UserProfileResource'][_0xa20f('0x4e')]({'name':_0x105597[_0xa20f('0x33')],'resourceId':_0x105597['id'],'type':_0x3e22af[_0xa20f('0x33')],'sectionId':_0x3e22af['id']},{})['then'](function(){return _0x112646;});}else{return _0x112646;}})[_0xa20f('0x4b')](function(_0x282343){logger[_0xa20f('0x35')](_0xa20f('0x56'),_0x282343);throw _0x282343;});}return _0x112646;})[_0xa20f('0x29')](respondWithResult(_0xb6c6a1,0xc9))[_0xa20f('0x4b')](handleError(_0xb6c6a1,null));};exports[_0xa20f('0x57')]=function(_0x71f28,_0x41c3ed){var _0x2b2af4={'where':{'id':_0x71f28[_0xa20f('0x4d')]['id']}},_0x3e5d4b={};_0x3e5d4b['model']=_[_0xa20f('0x3a')](db[_0xa20f('0x36')][_0xa20f('0x37')]);_0x2b2af4[_0xa20f('0x3d')]=_['intersection'](_0x3e5d4b[_0xa20f('0x3e')],qs['fields'](_0x71f28[_0xa20f('0x39')]['fields']));_0x2b2af4['attributes']=_0x2b2af4[_0xa20f('0x3d')][_0xa20f('0x40')]?_0x2b2af4[_0xa20f('0x3d')]:_0x3e5d4b[_0xa20f('0x3e')];if(_0x71f28[_0xa20f('0x39')][_0xa20f('0x48')]){_0x2b2af4[_0xa20f('0x49')]=[{'all':!![]}];}_0x2b2af4=_[_0xa20f('0x45')]({},_0x2b2af4,_0x71f28[_0xa20f('0x47')]);return db['VoiceQueue'][_0xa20f('0x32')](_0x2b2af4)[_0xa20f('0x29')](handleEntityNotFound(_0x41c3ed,null))['then'](function(_0x3fff45){if(_0x3fff45){var _0x2e2bfb=_0x3fff45['get']({'plain':!![]});_0x2e2bfb=qs[_0xa20f('0x58')](_0x2e2bfb,['id','createdAt','updatedAt']);_0x71f28['body']=_['omit'](_0x71f28[_0xa20f('0x4f')],['id','createdAt','updatedAt']);return db[_0xa20f('0x36')]['create'](_[_0xa20f('0x45')](_0x2e2bfb,_0x71f28[_0xa20f('0x4f')]),{'include':_0x71f28['query'][_0xa20f('0x48')]?[{'all':!![]}]:undefined})[_0xa20f('0x29')](function(_0x2713e9){var _0x33491f=_0x71f28[_0xa20f('0x50')]['get']({'plain':!![]});if(!_0x33491f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33491f[_0xa20f('0x59')]===_0xa20f('0x50')){var _0x177685=_0x2713e9['get']({'plain':!![]});var _0x11f63b=[{'name':_0xa20f('0x2b'),'value':_0xa20f('0x2c')},{'name':_0xa20f('0x51'),'value':'outbound'}];var _0x2ca67d=_[_0xa20f('0x32')](_0x11f63b,[_0xa20f('0x2f'),_0x177685[_0xa20f('0x31')]])['name'];return db[_0xa20f('0x53')][_0xa20f('0x32')]({'where':{'name':_0x2ca67d,'userProfileId':_0x33491f['userProfileId']},'raw':!![]})[_0xa20f('0x29')](function(_0x2655f3){if(_0x2655f3&&_0x2655f3[_0xa20f('0x55')]===0x0){return db[_0xa20f('0x34')][_0xa20f('0x4e')]({'name':_0x177685[_0xa20f('0x33')],'resourceId':_0x177685['id'],'type':_0x2655f3[_0xa20f('0x33')],'sectionId':_0x2655f3['id']},{})[_0xa20f('0x29')](function(){return _0x2713e9;});}else{return _0x2713e9;}})[_0xa20f('0x4b')](function(_0x56d0a2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56d0a2);throw _0x56d0a2;});}return _0x2713e9;});}})[_0xa20f('0x29')](respondWithResult(_0x41c3ed,0xc9))[_0xa20f('0x4b')](handleError(_0x41c3ed,null));};exports['update']=function(_0x56dabb,_0x1a8728){if(_0x56dabb[_0xa20f('0x4f')]['id']){delete _0x56dabb[_0xa20f('0x4f')]['id'];}return db[_0xa20f('0x36')][_0xa20f('0x32')]({'where':{'id':_0x56dabb['params']['id']}})['then'](handleEntityNotFound(_0x1a8728,null))['then'](saveUpdates(_0x56dabb[_0xa20f('0x4f')],null))[_0xa20f('0x29')](respondWithResult(_0x1a8728,null))[_0xa20f('0x4b')](handleError(_0x1a8728,null));};exports[_0xa20f('0x5a')]=function(_0x2d7874,_0x50be23){return db[_0xa20f('0x36')][_0xa20f('0x32')]({'where':{'id':_0x2d7874[_0xa20f('0x4d')]['id']}})[_0xa20f('0x29')](handleEntityNotFound(_0x50be23,null))[_0xa20f('0x29')](removeEntity(_0x50be23,null))[_0xa20f('0x4b')](handleError(_0x50be23,null));};exports[_0xa20f('0x5b')]=function(_0x2ab680,_0x3f4258,_0x32d9d0){var _0x211539={'raw':![],'where':{}};var _0x4e8f22={};var _0x466daa={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa20f('0x5c')]({'where':{'id':_0x2ab680[_0xa20f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3f4258,null))['then'](function(_0x9684f9){if(_0x9684f9){_0x4e8f22['model']=_[_0xa20f('0x3a')](db[_0xa20f('0x5d')]['rawAttributes']);_0x4e8f22['query']=_[_0xa20f('0x3a')](_0x2ab680[_0xa20f('0x39')]);_0x4e8f22[_0xa20f('0x3b')]=_[_0xa20f('0x3c')](_0x4e8f22[_0xa20f('0x3e')],_0x4e8f22[_0xa20f('0x39')]);_0x211539[_0xa20f('0x3d')]=_['intersection'](_0x4e8f22[_0xa20f('0x3e')],qs[_0xa20f('0x3f')](_0x2ab680['query'][_0xa20f('0x3f')]));_0x211539['attributes']=_0x211539['attributes'][_0xa20f('0x40')]?_0x211539[_0xa20f('0x3d')]:_0x4e8f22[_0xa20f('0x3e')];if(!_0x2ab680[_0xa20f('0x39')]['hasOwnProperty']('nolimit')){_0x211539[_0xa20f('0x21')]=qs[_0xa20f('0x21')](_0x2ab680['query']['limit']);_0x211539[_0xa20f('0x1f')]=qs['offset'](_0x2ab680[_0xa20f('0x39')][_0xa20f('0x1f')]);}_0x211539[_0xa20f('0x42')]=qs[_0xa20f('0x43')](_0x2ab680['query'][_0xa20f('0x43')]);_0x211539[_0xa20f('0x44')]=qs[_0xa20f('0x3b')](_[_0xa20f('0x5e')](_0x2ab680['query'],_0x4e8f22[_0xa20f('0x3b')]));_0x211539[_0xa20f('0x44')][_0xa20f('0x5f')]=_0x9684f9['id'];if(_0x2ab680['query'][_0xa20f('0x2d')]){_0x211539[_0xa20f('0x44')]=_[_0xa20f('0x45')](_0x211539[_0xa20f('0x44')],{'$or':_[_0xa20f('0x46')](_0x211539[_0xa20f('0x3d')],function(_0x42a3b4){var _0x1972fa={};_0x1972fa[_0x42a3b4]={'$like':'%'+_0x2ab680[_0xa20f('0x39')][_0xa20f('0x2d')]+'%'};return _0x1972fa;})});}_0x211539=_[_0xa20f('0x45')]({},_0x211539,_0x2ab680[_0xa20f('0x47')]);return db['CmHopper']['count']({'where':_0x211539[_0xa20f('0x44')]})[_0xa20f('0x29')](function(_0x3a7b84){_0x466daa[_0xa20f('0x22')]=_0x3a7b84;if(_0x2ab680['query'][_0xa20f('0x48')]){_0x211539[_0xa20f('0x49')]=[{'all':!![]}];}return db[_0xa20f('0x5d')][_0xa20f('0x60')](_0x211539);})[_0xa20f('0x29')](function(_0x41dee4){_0x466daa[_0xa20f('0x4a')]=_0x41dee4;return _0x466daa;});}})['then'](respondWithFilteredResult(_0x3f4258,_0x211539))[_0xa20f('0x4b')](handleError(_0x3f4258,null));};exports['getHopperHistories']=function(_0x200f00,_0x3456ad,_0x4b2f29){var _0x4bd3f3={'raw':!![],'where':{}};var _0x2f3659={};var _0x2e3a62={'count':0x0,'rows':[]};return db[_0xa20f('0x36')][_0xa20f('0x5c')]({'where':{'id':_0x200f00[_0xa20f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3456ad,null))['then'](function(_0x44ce21){if(_0x44ce21){_0x2f3659[_0xa20f('0x3e')]=_[_0xa20f('0x3a')](db[_0xa20f('0x61')][_0xa20f('0x37')]);_0x2f3659[_0xa20f('0x39')]=_['keys'](_0x200f00[_0xa20f('0x39')]);_0x2f3659[_0xa20f('0x3b')]=_[_0xa20f('0x3c')](_0x2f3659[_0xa20f('0x3e')],_0x2f3659[_0xa20f('0x39')]);_0x4bd3f3[_0xa20f('0x3d')]=_['intersection'](_0x2f3659['model'],qs['fields'](_0x200f00[_0xa20f('0x39')][_0xa20f('0x3f')]));_0x4bd3f3[_0xa20f('0x3d')]=_0x4bd3f3[_0xa20f('0x3d')][_0xa20f('0x40')]?_0x4bd3f3['attributes']:_0x2f3659['model'];if(!_0x200f00[_0xa20f('0x39')]['hasOwnProperty'](_0xa20f('0x41'))){_0x4bd3f3[_0xa20f('0x21')]=qs[_0xa20f('0x21')](_0x200f00[_0xa20f('0x39')][_0xa20f('0x21')]);_0x4bd3f3[_0xa20f('0x1f')]=qs[_0xa20f('0x1f')](_0x200f00[_0xa20f('0x39')][_0xa20f('0x1f')]);}_0x4bd3f3[_0xa20f('0x42')]=qs[_0xa20f('0x43')](_0x200f00[_0xa20f('0x39')][_0xa20f('0x43')]);_0x4bd3f3[_0xa20f('0x44')]=qs[_0xa20f('0x3b')](_[_0xa20f('0x5e')](_0x200f00['query'],_0x2f3659[_0xa20f('0x3b')]));_0x4bd3f3[_0xa20f('0x44')][_0xa20f('0x5f')]=_0x44ce21['id'];if(_0x200f00[_0xa20f('0x39')][_0xa20f('0x2d')]){_0x4bd3f3[_0xa20f('0x44')]=_[_0xa20f('0x45')](_0x4bd3f3[_0xa20f('0x44')],{'$or':_[_0xa20f('0x46')](_0x4bd3f3[_0xa20f('0x3d')],function(_0x1354c9){var _0x38b100={};_0x38b100[_0x1354c9]={'$like':'%'+_0x200f00[_0xa20f('0x39')][_0xa20f('0x2d')]+'%'};return _0x38b100;})});}_0x4bd3f3=_[_0xa20f('0x45')]({},_0x4bd3f3,_0x200f00[_0xa20f('0x47')]);return db[_0xa20f('0x61')]['count']({'where':_0x4bd3f3[_0xa20f('0x44')]})['then'](function(_0x431621){_0x2e3a62['count']=_0x431621;if(_0x200f00[_0xa20f('0x39')]['includeAll']){_0x4bd3f3[_0xa20f('0x49')]=[{'all':!![]}];}return db[_0xa20f('0x61')][_0xa20f('0x60')](_0x4bd3f3);})[_0xa20f('0x29')](function(_0x49520f){_0x2e3a62[_0xa20f('0x4a')]=_0x49520f;return _0x2e3a62;});}})[_0xa20f('0x29')](respondWithFilteredResult(_0x3456ad,_0x4bd3f3))[_0xa20f('0x4b')](handleError(_0x3456ad,null));};exports[_0xa20f('0x62')]=function(_0x1eb391,_0x20a177,_0x359ea0){var _0x1a2e6b={'raw':!![],'where':{}};var _0x42ccb5={};var _0x5cc7eb={'count':0x0,'rows':[]};return db[_0xa20f('0x36')]['findOne']({'where':{'id':_0x1eb391[_0xa20f('0x4d')]['id']}})[_0xa20f('0x29')](handleEntityNotFound(_0x20a177,null))[_0xa20f('0x29')](function(_0xf01929){if(_0xf01929){_0x42ccb5[_0xa20f('0x3e')]=_['keys'](db[_0xa20f('0x63')][_0xa20f('0x37')]);_0x42ccb5[_0xa20f('0x39')]=_[_0xa20f('0x3a')](_0x1eb391[_0xa20f('0x39')]);_0x42ccb5[_0xa20f('0x3b')]=_[_0xa20f('0x3c')](_0x42ccb5['model'],_0x42ccb5[_0xa20f('0x39')]);_0x1a2e6b['attributes']=_[_0xa20f('0x3c')](_0x42ccb5[_0xa20f('0x3e')],qs['fields'](_0x1eb391[_0xa20f('0x39')][_0xa20f('0x3f')]));_0x1a2e6b[_0xa20f('0x3d')]=_0x1a2e6b[_0xa20f('0x3d')][_0xa20f('0x40')]?_0x1a2e6b['attributes']:_0x42ccb5[_0xa20f('0x3e')];if(!_0x1eb391['query'][_0xa20f('0x64')]('nolimit')){_0x1a2e6b[_0xa20f('0x21')]=qs[_0xa20f('0x21')](_0x1eb391[_0xa20f('0x39')][_0xa20f('0x21')]);_0x1a2e6b[_0xa20f('0x1f')]=qs[_0xa20f('0x1f')](_0x1eb391[_0xa20f('0x39')][_0xa20f('0x1f')]);}_0x1a2e6b[_0xa20f('0x42')]=qs[_0xa20f('0x43')](_0x1eb391[_0xa20f('0x39')][_0xa20f('0x43')]);_0x1a2e6b[_0xa20f('0x44')]=qs[_0xa20f('0x3b')](_['pick'](_0x1eb391[_0xa20f('0x39')],_0x42ccb5[_0xa20f('0x3b')]));_0x1a2e6b[_0xa20f('0x44')][_0xa20f('0x5f')]=_0xf01929['id'];if(_0x1eb391['query'][_0xa20f('0x2d')]){_0x1a2e6b[_0xa20f('0x44')]=_[_0xa20f('0x45')](_0x1a2e6b[_0xa20f('0x44')],{'$or':_[_0xa20f('0x46')](_0x1a2e6b[_0xa20f('0x3d')],function(_0x11dc1d){var _0x4bbaa8={};_0x4bbaa8[_0x11dc1d]={'$like':'%'+_0x1eb391[_0xa20f('0x39')][_0xa20f('0x2d')]+'%'};return _0x4bbaa8;})});}_0x1a2e6b=_[_0xa20f('0x45')]({},_0x1a2e6b,_0x1eb391[_0xa20f('0x47')]);return db[_0xa20f('0x63')][_0xa20f('0x22')]({'where':_0x1a2e6b[_0xa20f('0x44')]})[_0xa20f('0x29')](function(_0x45bc8e){_0x5cc7eb['count']=_0x45bc8e;if(_0x1eb391[_0xa20f('0x39')][_0xa20f('0x48')]){_0x1a2e6b[_0xa20f('0x49')]=[{'all':!![]}];}return db[_0xa20f('0x63')][_0xa20f('0x60')](_0x1a2e6b);})['then'](function(_0xa23267){_0x5cc7eb[_0xa20f('0x4a')]=_0xa23267;return _0x5cc7eb;});}})[_0xa20f('0x29')](respondWithFilteredResult(_0x20a177,_0x1a2e6b))[_0xa20f('0x4b')](handleError(_0x20a177,null));};exports[_0xa20f('0x65')]=function(_0x30f22d,_0x19bc4d,_0x3d4ded){var _0x365aea={'raw':!![],'where':{}};var _0x59d02b={};var _0x50ea05={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa20f('0x5c')]({'where':{'id':_0x30f22d['params']['id']}})[_0xa20f('0x29')](handleEntityNotFound(_0x19bc4d,null))[_0xa20f('0x29')](function(_0x4a1b03){if(_0x4a1b03){_0x59d02b['model']=_[_0xa20f('0x3a')](db['CmHopperBlack'][_0xa20f('0x37')]);_0x59d02b[_0xa20f('0x39')]=_[_0xa20f('0x3a')](_0x30f22d['query']);_0x59d02b['filters']=_[_0xa20f('0x3c')](_0x59d02b[_0xa20f('0x3e')],_0x59d02b[_0xa20f('0x39')]);_0x365aea[_0xa20f('0x3d')]=_['intersection'](_0x59d02b[_0xa20f('0x3e')],qs[_0xa20f('0x3f')](_0x30f22d[_0xa20f('0x39')][_0xa20f('0x3f')]));_0x365aea[_0xa20f('0x3d')]=_0x365aea[_0xa20f('0x3d')]['length']?_0x365aea['attributes']:_0x59d02b['model'];if(!_0x30f22d[_0xa20f('0x39')][_0xa20f('0x64')](_0xa20f('0x41'))){_0x365aea[_0xa20f('0x21')]=qs[_0xa20f('0x21')](_0x30f22d[_0xa20f('0x39')][_0xa20f('0x21')]);_0x365aea[_0xa20f('0x1f')]=qs[_0xa20f('0x1f')](_0x30f22d[_0xa20f('0x39')][_0xa20f('0x1f')]);}_0x365aea['order']=qs[_0xa20f('0x43')](_0x30f22d[_0xa20f('0x39')]['sort']);_0x365aea['where']=qs[_0xa20f('0x3b')](_[_0xa20f('0x5e')](_0x30f22d['query'],_0x59d02b['filters']));_0x365aea[_0xa20f('0x44')]['VoiceQueueId']=_0x4a1b03['id'];if(_0x30f22d[_0xa20f('0x39')][_0xa20f('0x2d')]){_0x365aea[_0xa20f('0x44')]=_['merge'](_0x365aea[_0xa20f('0x44')],{'$or':_[_0xa20f('0x46')](_0x365aea[_0xa20f('0x3d')],function(_0x18d489){var _0x4a9a4e={};_0x4a9a4e[_0x18d489]={'$like':'%'+_0x30f22d['query'][_0xa20f('0x2d')]+'%'};return _0x4a9a4e;})});}_0x365aea=_[_0xa20f('0x45')]({},_0x365aea,_0x30f22d[_0xa20f('0x47')]);return db[_0xa20f('0x66')]['count']({'where':_0x365aea['where']})[_0xa20f('0x29')](function(_0x2f7153){_0x50ea05['count']=_0x2f7153;if(_0x30f22d[_0xa20f('0x39')][_0xa20f('0x48')]){_0x365aea['include']=[{'all':!![]}];}return db[_0xa20f('0x66')][_0xa20f('0x60')](_0x365aea);})[_0xa20f('0x29')](function(_0x37298e){_0x50ea05['rows']=_0x37298e;return _0x50ea05;});}})['then'](respondWithFilteredResult(_0x19bc4d,_0x365aea))[_0xa20f('0x4b')](handleError(_0x19bc4d,null));};exports['getTeams']=function(_0x40d939,_0x3715d0,_0x177b2d){var _0x8b9cea={};var _0x3b4dd1={};var _0x194a77;var _0x185ead;return db[_0xa20f('0x36')][_0xa20f('0x5c')]({'where':{'id':_0x40d939[_0xa20f('0x4d')]['id']}})[_0xa20f('0x29')](handleEntityNotFound(_0x3715d0,null))[_0xa20f('0x29')](function(_0x5848fa){if(_0x5848fa){_0x194a77=_0x5848fa;_0x3b4dd1[_0xa20f('0x3e')]=_[_0xa20f('0x3a')](db[_0xa20f('0x67')][_0xa20f('0x37')]);_0x3b4dd1[_0xa20f('0x39')]=_[_0xa20f('0x3a')](_0x40d939[_0xa20f('0x39')]);_0x3b4dd1[_0xa20f('0x3b')]=_[_0xa20f('0x3c')](_0x3b4dd1[_0xa20f('0x3e')],_0x3b4dd1['query']);_0x8b9cea[_0xa20f('0x3d')]=_[_0xa20f('0x3c')](_0x3b4dd1[_0xa20f('0x3e')],qs[_0xa20f('0x3f')](_0x40d939['query'][_0xa20f('0x3f')]));_0x8b9cea['attributes']=_0x8b9cea[_0xa20f('0x3d')][_0xa20f('0x40')]?_0x8b9cea['attributes']:_0x3b4dd1[_0xa20f('0x3e')];_0x8b9cea[_0xa20f('0x42')]=qs['sort'](_0x40d939[_0xa20f('0x39')][_0xa20f('0x43')]);_0x8b9cea[_0xa20f('0x44')]=qs[_0xa20f('0x3b')](_['pick'](_0x40d939[_0xa20f('0x39')],_0x3b4dd1['filters']));if(_0x40d939['query']['filter']){_0x8b9cea[_0xa20f('0x44')]=_[_0xa20f('0x45')](_0x8b9cea[_0xa20f('0x44')],{'$or':_[_0xa20f('0x46')](_0x8b9cea[_0xa20f('0x3d')],function(_0x5c8783){var _0x33fe92={};_0x33fe92[_0x5c8783]={'$like':'%'+_0x40d939[_0xa20f('0x39')]['filter']+'%'};return _0x33fe92;})});}_0x8b9cea=_[_0xa20f('0x45')]({},_0x8b9cea,_0x40d939[_0xa20f('0x47')]);return _0x194a77['getTeams'](_0x8b9cea);}})[_0xa20f('0x29')](function(_0x5dc12e){if(_0x5dc12e){_0x185ead=_0x5dc12e['length'];if(!_0x40d939[_0xa20f('0x39')][_0xa20f('0x64')](_0xa20f('0x41'))){_0x8b9cea['limit']=qs['limit'](_0x40d939['query'][_0xa20f('0x21')]);_0x8b9cea['offset']=qs['offset'](_0x40d939[_0xa20f('0x39')]['offset']);}return _0x194a77['getTeams'](_0x8b9cea);}})['then'](function(_0x3b53c3){if(_0x3b53c3){return _0x3b53c3?{'count':_0x185ead,'rows':_0x3b53c3}:null;}})[_0xa20f('0x29')](respondWithResult(_0x3715d0,null))['catch'](handleError(_0x3715d0,null));};exports[_0xa20f('0x68')]=function(_0x402c1f,_0x5e2cfc,_0x3ce9e2){var _0x11e4f8=_0x402c1f[_0xa20f('0x4f')]['teams'];var _0x3773e9=_[_0xa20f('0x46')](_0x11e4f8,'id');return db[_0xa20f('0x67')][_0xa20f('0x60')]({'where':{'id':_0x3773e9},'attributes':['id'],'include':[{'model':db[_0xa20f('0x69')],'as':_0xa20f('0x6a'),'attributes':['id',_0xa20f('0x33'),_0xa20f('0x6b'),_0xa20f('0x6c'),_0xa20f('0x6d')],'raw':!![]}]})[_0xa20f('0x29')](function(_0x286019){if(_0x286019){var _0x25392d=_[_0xa20f('0x6e')](_0x286019,function(_0x5652f6){var _0x66aab8=_0x5652f6[_0xa20f('0x2a')]({'plain':!![]});_0x66aab8['Agents']['forEach'](function(_0x1d86a8){_0x1d86a8['penalty']=_[_0xa20f('0x32')](_0x11e4f8,{'id':_0x66aab8['id']})['penalty'];});return _0x66aab8['Agents'];});return db[_0xa20f('0x36')][_0xa20f('0x32')]({'where':{'id':_0x402c1f['params']['id']}})[_0xa20f('0x29')](function(_0x166295){return db['sequelize'][_0xa20f('0x6f')](function(_0x12e515){return _0x166295[_0xa20f('0x68')](_0x3773e9,{'transaction':_0x12e515})[_0xa20f('0x29')](function(){return BPromise[_0xa20f('0x70')](_0x11e4f8,function(_0x2c5805){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x2c5805['id'],'VoiceQueueId':_0x402c1f[_0xa20f('0x4d')]['id'],'penalty':_0x2c5805[_0xa20f('0x71')]},{'transaction':_0x12e515});});})['then'](function(){return BPromise[_0xa20f('0x70')](_0x25392d,function(_0x5cb871){return db[_0xa20f('0x72')]['findOrCreate']({'where':{'UserId':_0x5cb871['id'],'VoiceQueueId':_0x402c1f['params']['id']},'defaults':{'penalty':_0x5cb871['penalty']},'transaction':_0x12e515});});})[_0xa20f('0x29')](function(){return BPromise['each'](_['filter'](_0x25392d,{'online':!![]}),function(_0x531075){return db[_0xa20f('0x73')][_0xa20f('0x74')]({'membername':_0x531075[_0xa20f('0x33')],'UserId':_0x531075['id'],'queue_name':_0x166295['name'],'VoiceQueueId':_0x166295['id'],'interface':_['isNil'](_0x531075[_0xa20f('0x6d')])?util[_0xa20f('0x75')](_0xa20f('0x76'),_0x531075[_0xa20f('0x33')]):_0x531075[_0xa20f('0x6d')],'paused':_0x531075['voicePause']||![],'penalty':_0x531075[_0xa20f('0x71')]},{'transaction':_0x12e515});});})[_0xa20f('0x29')](function(){_0x25392d[_0xa20f('0x77')](function(_0xf0688d){socket[_0xa20f('0x78')](_0xa20f('0x79'),{'UserId':_0xf0688d['id'],'VoiceQueueId':_0x166295['id']});});});});});}})[_0xa20f('0x29')](respondWithStatusCode(_0x5e2cfc,null))['catch'](handleError(_0x5e2cfc,null));};exports[_0xa20f('0x7a')]=function(_0x6f2ffc,_0x122d91,_0x3bbf1d){return db['Team']['findAll']({'where':{'id':_0x6f2ffc[_0xa20f('0x39')][_0xa20f('0x7b')]},'attributes':['id'],'include':[{'model':db[_0xa20f('0x69')],'as':_0xa20f('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xa20f('0x29')](handleEntityNotFound(_0x122d91,null))[_0xa20f('0x29')](function(_0x37db4d){var _0x22d1f2=_[_0xa20f('0x46')](_0x37db4d,'id');var _0x27b106=[];var _0x3e9f1d=[];var _0x130b04=squel['select']();_0x130b04[_0xa20f('0x7c')](_0xa20f('0x7d'))[_0xa20f('0x7e')](_0xa20f('0x7f'),'tq')[_0xa20f('0x80')](_0xa20f('0x81'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xa20f('0x82'),_0x6f2ffc[_0xa20f('0x4d')]['id']);for(var _0x7c60e4=0x0;_0x7c60e4<_0x37db4d[_0xa20f('0x40')];_0x7c60e4+=0x1){let _0x412817=_0x37db4d[_0x7c60e4];for(var _0x35e56e=0x0;_0x35e56e<_0x412817['Agents']['length'];_0x35e56e+=0x1){let _0x1edd24=_0x412817[_0xa20f('0x6a')][_0x35e56e];var _0x568d80=_0x130b04[_0xa20f('0x57')]();_0x568d80[_0xa20f('0x44')](_0xa20f('0x83'),_0x1edd24['id']);_0x3e9f1d[_0xa20f('0x84')](db[_0xa20f('0x85')][_0xa20f('0x39')](_0x568d80[_0xa20f('0x86')](),{'type':db[_0xa20f('0x85')][_0xa20f('0x87')][_0xa20f('0x88')]})[_0xa20f('0x29')](function(_0x18099d){if(_0x18099d[_0xa20f('0x40')]===0x1){return _0x1edd24['id'];}else{var _0x1ab838=_[_0xa20f('0x89')](_[_0xa20f('0x46')](_0x18099d,_0xa20f('0x8a')),function(_0x2626c4){return _[_0xa20f('0x30')](_0x22d1f2,_0x2626c4);});if(_0x1ab838){return _0x1edd24['id'];}}}));}}return BPromise[_0xa20f('0x8b')](_0x3e9f1d)[_0xa20f('0x29')](function(_0x2cb4c4){_0x27b106=_(_0x27b106)['union'](_0x2cb4c4)[_0xa20f('0x8c')]()[_0xa20f('0x2f')]();return db['VoiceQueue'][_0xa20f('0x32')]({'where':{'id':_0x6f2ffc[_0xa20f('0x4d')]['id']}})['then'](function(_0x3f7c98){return db[_0xa20f('0x85')][_0xa20f('0x6f')](function(_0x5a3ad7){return _0x3f7c98[_0xa20f('0x7a')](_0x6f2ffc['query'][_0xa20f('0x7b')],{'transaction':_0x5a3ad7})['then'](function(){if(!_[_0xa20f('0x8d')](_0x27b106)){return _0x3f7c98[_0xa20f('0x8e')](_0x27b106,{'transaction':_0x5a3ad7})[_0xa20f('0x29')](function(){return db[_0xa20f('0x73')][_0xa20f('0x5a')]({'where':{'VoiceQueueId':_0x6f2ffc[_0xa20f('0x4d')]['id'],'UserId':_0x27b106},'transaction':_0x5a3ad7});});}})[_0xa20f('0x29')](function(){_0x27b106['forEach'](function(_0x8652d1){socket[_0xa20f('0x78')](_0xa20f('0x8f'),{'UserId':_0x8652d1,'VoiceQueueId':_0x3f7c98['id']});});});});});});})[_0xa20f('0x29')](respondWithStatusCode(_0x122d91,null))[_0xa20f('0x4b')](handleError(_0x122d91,null));};exports[_0xa20f('0x90')]=function(_0x352f11,_0x596462,_0x3f07e1){var _0x4c644a,_0x353910;return db['VoiceQueue']['find']({'where':{'id':_0x352f11[_0xa20f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x596462,null))[_0xa20f('0x29')](function(_0x35445e){if(_0x35445e){_0x353910=_0x35445e;return _0x35445e[_0xa20f('0x90')](_0x352f11[_0xa20f('0x4f')][_0xa20f('0x7b')],_['omit'](_0x352f11[_0xa20f('0x4f')],[_0xa20f('0x7b'),'id'])||{})[_0xa20f('0x91')](function(_0x1b0782){for(var _0x2cefb6=0x0;_0x2cefb6<_0x352f11[_0xa20f('0x4f')]['ids']['length'];_0x2cefb6+=0x1){socket['emit'](_0xa20f('0x79'),{'UserId':Number(_0x352f11[_0xa20f('0x4f')][_0xa20f('0x7b')][_0x2cefb6]),'VoiceQueueId':Number(_0x352f11[_0xa20f('0x4d')]['id'])});}return _0x1b0782;});}})[_0xa20f('0x29')](function(_0x26c41b){_0x4c644a=_0x26c41b||[];if(_0x353910){return db['User'][_0xa20f('0x60')]({'where':{'id':_0x352f11[_0xa20f('0x4f')][_0xa20f('0x7b')]},'attributes':['id',_0xa20f('0x33'),_0xa20f('0x6b'),'voicePause',_0xa20f('0x6d')],'raw':!![]});}})[_0xa20f('0x29')](function(_0x3aa384){if(!_['isEmpty'](_0x3aa384)){var _0x5f0a59=[];for(var _0x193420=0x0;_0x193420<_0x3aa384[_0xa20f('0x40')];_0x193420++){if(_0x3aa384[_0x193420]['online']){_0x5f0a59[_0xa20f('0x84')](db[_0xa20f('0x73')][_0xa20f('0x74')]({'membername':_0x3aa384[_0x193420]['name'],'UserId':_0x3aa384[_0x193420]['id'],'queue_name':_0x353910[_0xa20f('0x33')],'VoiceQueueId':_0x353910['id'],'interface':_[_0xa20f('0x92')](_0x3aa384[_0x193420][_0xa20f('0x6d')])?util[_0xa20f('0x75')]('SIP/%s',_0x3aa384[_0x193420][_0xa20f('0x33')]):_0x3aa384[_0x193420][_0xa20f('0x6d')],'paused':_0x3aa384[_0x193420]['voicePause']||![],'penalty':_0x352f11[_0xa20f('0x4f')][_0xa20f('0x71')]||0x0}));}}return BPromise['all'](_0x5f0a59);}})['then'](function(){return _0x4c644a;})[_0xa20f('0x29')](respondWithResult(_0x596462,null))['catch'](handleError(_0x596462,null));};exports[_0xa20f('0x8e')]=function(_0x55a898,_0xe53f59,_0x2f0bb8){return db[_0xa20f('0x36')][_0xa20f('0x32')]({'where':{'id':_0x55a898['params']['id']}})['then'](handleEntityNotFound(_0xe53f59,null))[_0xa20f('0x29')](function(_0x1ed451){if(_0x1ed451){return _0x1ed451[_0xa20f('0x8e')](_0x55a898[_0xa20f('0x39')][_0xa20f('0x7b')])[_0xa20f('0x29')](function(){if(_[_0xa20f('0x93')](_0x55a898[_0xa20f('0x39')][_0xa20f('0x7b')])){for(var _0x1097bf=0x0;_0x1097bf<_0x55a898['query'][_0xa20f('0x7b')][_0xa20f('0x40')];_0x1097bf+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x55a898['query'][_0xa20f('0x7b')][_0x1097bf]),'VoiceQueueId':Number(_0x55a898[_0xa20f('0x4d')]['id'])});}}else{socket[_0xa20f('0x78')](_0xa20f('0x8f'),{'UserId':Number(_0x55a898[_0xa20f('0x39')][_0xa20f('0x7b')]),'VoiceQueueId':Number(_0x55a898[_0xa20f('0x4d')]['id'])});}});}})[_0xa20f('0x29')](function(_0x5ab9a9){return db[_0xa20f('0x73')]['destroy']({'where':{'VoiceQueueId':_0x55a898[_0xa20f('0x4d')]['id'],'UserId':_0x55a898[_0xa20f('0x39')]['ids']}})[_0xa20f('0x29')](function(){return _0x5ab9a9;});})['then'](respondWithStatusCode(_0xe53f59,null))[_0xa20f('0x4b')](handleError(_0xe53f59,null));};exports[_0xa20f('0x94')]=function(_0x8bf12c,_0x2a8707,_0x4847b3){var _0x53a7ed={};var _0x5a5fb8={};var _0x120806;var _0x2ca0fb;return db[_0xa20f('0x36')][_0xa20f('0x5c')]({'where':{'id':_0x8bf12c[_0xa20f('0x4d')]['id']}})[_0xa20f('0x29')](handleEntityNotFound(_0x2a8707,null))['then'](function(_0x43494a){if(_0x43494a){_0x120806=_0x43494a;_0x5a5fb8[_0xa20f('0x3e')]=_[_0xa20f('0x3a')](db['User'][_0xa20f('0x37')]);_0x5a5fb8[_0xa20f('0x39')]=_[_0xa20f('0x3a')](_0x8bf12c[_0xa20f('0x39')]);_0x5a5fb8['filters']=_['intersection'](_0x5a5fb8[_0xa20f('0x3e')],_0x5a5fb8['query']);_0x53a7ed['attributes']=_['intersection'](_0x5a5fb8[_0xa20f('0x3e')],qs[_0xa20f('0x3f')](_0x8bf12c[_0xa20f('0x39')][_0xa20f('0x3f')]));_0x53a7ed[_0xa20f('0x3d')]=_0x53a7ed[_0xa20f('0x3d')][_0xa20f('0x40')]?_0x53a7ed[_0xa20f('0x3d')]:_0x5a5fb8['model'];_0x53a7ed[_0xa20f('0x42')]=qs[_0xa20f('0x43')](_0x8bf12c['query'][_0xa20f('0x43')]);_0x53a7ed[_0xa20f('0x44')]=qs[_0xa20f('0x3b')](_['pick'](_0x8bf12c[_0xa20f('0x39')],_0x5a5fb8[_0xa20f('0x3b')]));if(_0x8bf12c['query'][_0xa20f('0x2d')]){_0x53a7ed[_0xa20f('0x44')]=_[_0xa20f('0x45')](_0x53a7ed[_0xa20f('0x44')],{'$or':_[_0xa20f('0x46')](_0x53a7ed[_0xa20f('0x3d')],function(_0x50ca04){var _0x3eefd9={};_0x3eefd9[_0x50ca04]={'$like':'%'+_0x8bf12c[_0xa20f('0x39')]['filter']+'%'};return _0x3eefd9;})});}_0x53a7ed=_[_0xa20f('0x45')]({},_0x53a7ed,_0x8bf12c[_0xa20f('0x47')]);return _0x120806[_0xa20f('0x94')](_0x53a7ed);}})['then'](function(_0x3feaca){if(_0x3feaca){_0x2ca0fb=_0x3feaca[_0xa20f('0x40')];if(!_0x8bf12c['query'][_0xa20f('0x64')]('nolimit')){_0x53a7ed['limit']=qs[_0xa20f('0x21')](_0x8bf12c[_0xa20f('0x39')][_0xa20f('0x21')]);_0x53a7ed['offset']=qs['offset'](_0x8bf12c[_0xa20f('0x39')][_0xa20f('0x1f')]);}return _0x120806[_0xa20f('0x94')](_0x53a7ed);}})['then'](function(_0x37af14){if(_0x37af14){return _0x37af14?{'count':_0x2ca0fb,'rows':_0x37af14}:null;}})['then'](respondWithResult(_0x2a8707,null))[_0xa20f('0x4b')](handleError(_0x2a8707,null));};exports['getMembers']=function(_0x24fc5d,_0x25c249,_0x378546){var _0x487d2d={};var _0x2d1341={};var _0x2b965f;var _0x1ef17b;return db[_0xa20f('0x36')]['findOne']({'where':{'id':_0x24fc5d[_0xa20f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x25c249,null))['then'](function(_0x2fa69e){if(_0x2fa69e){_0x2b965f=_0x2fa69e;_0x2d1341[_0xa20f('0x3e')]=_['keys'](db['UserVoiceQueueRt'][_0xa20f('0x37')]);_0x2d1341[_0xa20f('0x39')]=_['keys'](_0x24fc5d[_0xa20f('0x39')]);_0x2d1341[_0xa20f('0x3b')]=_[_0xa20f('0x3c')](_0x2d1341[_0xa20f('0x3e')],_0x2d1341[_0xa20f('0x39')]);_0x487d2d['attributes']=_[_0xa20f('0x3c')](_0x2d1341['model'],qs[_0xa20f('0x3f')](_0x24fc5d[_0xa20f('0x39')]['fields']));_0x487d2d['attributes']=_0x487d2d[_0xa20f('0x3d')][_0xa20f('0x40')]?_0x487d2d[_0xa20f('0x3d')]:_0x2d1341[_0xa20f('0x3e')];_0x487d2d[_0xa20f('0x42')]=qs[_0xa20f('0x43')](_0x24fc5d[_0xa20f('0x39')][_0xa20f('0x43')]);_0x487d2d['where']=qs['filters'](_[_0xa20f('0x5e')](_0x24fc5d[_0xa20f('0x39')],_0x2d1341[_0xa20f('0x3b')]));if(_0x24fc5d[_0xa20f('0x39')][_0xa20f('0x2d')]){_0x487d2d[_0xa20f('0x44')]=_[_0xa20f('0x45')](_0x487d2d[_0xa20f('0x44')],{'$or':_[_0xa20f('0x46')](_0x487d2d[_0xa20f('0x3d')],function(_0x2f6a73){var _0x33438d={};_0x33438d[_0x2f6a73]={'$like':'%'+_0x24fc5d[_0xa20f('0x39')][_0xa20f('0x2d')]+'%'};return _0x33438d;})});}_0x487d2d=_[_0xa20f('0x45')]({},_0x487d2d,_0x24fc5d[_0xa20f('0x47')]);return _0x2b965f['getMembers'](_0x487d2d);}})[_0xa20f('0x29')](function(_0x28c117){if(_0x28c117){_0x1ef17b=_0x28c117['length'];if(!_0x24fc5d[_0xa20f('0x39')]['hasOwnProperty'](_0xa20f('0x41'))){_0x487d2d[_0xa20f('0x21')]=qs[_0xa20f('0x21')](_0x24fc5d[_0xa20f('0x39')][_0xa20f('0x21')]);_0x487d2d[_0xa20f('0x1f')]=qs[_0xa20f('0x1f')](_0x24fc5d[_0xa20f('0x39')][_0xa20f('0x1f')]);}return _0x2b965f['getMembers'](_0x487d2d);}})['then'](function(_0x4f78f7){return _0x4f78f7?{'count':_0x1ef17b,'rows':_0x4f78f7}:null;})[_0xa20f('0x29')](respondWithResult(_0x25c249,null))['catch'](handleError(_0x25c249,null));};exports[_0xa20f('0x95')]=function(_0x40afed,_0x5e903a,_0xe41218){var _0x59c603={};var _0x159e29={};var _0x1da6d1;var _0x2814aa;return db[_0xa20f('0x36')]['findOne']({'where':{'id':_0x40afed['params']['id']}})[_0xa20f('0x29')](handleEntityNotFound(_0x5e903a,null))[_0xa20f('0x29')](function(_0x566ad6){if(_0x566ad6){_0x1da6d1=_0x566ad6;_0x159e29[_0xa20f('0x3e')]=_[_0xa20f('0x3a')](db[_0xa20f('0x96')][_0xa20f('0x37')]);_0x159e29['query']=_[_0xa20f('0x3a')](_0x40afed['query']);_0x159e29[_0xa20f('0x3b')]=_[_0xa20f('0x3c')](_0x159e29[_0xa20f('0x3e')],_0x159e29[_0xa20f('0x39')]);_0x59c603['attributes']=_[_0xa20f('0x3c')](_0x159e29['model'],qs['fields'](_0x40afed['query'][_0xa20f('0x3f')]));_0x59c603[_0xa20f('0x3d')]=_0x59c603[_0xa20f('0x3d')]['length']?_0x59c603['attributes']:_0x159e29[_0xa20f('0x3e')];_0x59c603['order']=qs[_0xa20f('0x43')](_0x40afed['query'][_0xa20f('0x43')]);_0x59c603[_0xa20f('0x44')]=qs['filters'](_[_0xa20f('0x5e')](_0x40afed[_0xa20f('0x39')],_0x159e29[_0xa20f('0x3b')]));if(_0x40afed[_0xa20f('0x39')][_0xa20f('0x2d')]){_0x59c603[_0xa20f('0x44')]=_[_0xa20f('0x45')](_0x59c603['where'],{'$or':_[_0xa20f('0x46')](_0x59c603[_0xa20f('0x3d')],function(_0x11fe6b){var _0x10bebb={};_0x10bebb[_0x11fe6b]={'$like':'%'+_0x40afed['query'][_0xa20f('0x2d')]+'%'};return _0x10bebb;})});}_0x59c603=_[_0xa20f('0x45')]({},_0x59c603,_0x40afed['options']);return _0x1da6d1[_0xa20f('0x95')](_0x59c603);}})['then'](function(_0x4dc7fb){if(_0x4dc7fb){_0x2814aa=_0x4dc7fb['length'];if(!_0x40afed['query']['hasOwnProperty']('nolimit')){_0x59c603['limit']=qs[_0xa20f('0x21')](_0x40afed[_0xa20f('0x39')][_0xa20f('0x21')]);_0x59c603[_0xa20f('0x1f')]=qs[_0xa20f('0x1f')](_0x40afed[_0xa20f('0x39')][_0xa20f('0x1f')]);}return _0x1da6d1['getLists'](_0x59c603);}})[_0xa20f('0x29')](function(_0x465e99){if(_0x465e99){return _0x465e99?{'count':_0x2814aa,'rows':_0x465e99}:null;}})[_0xa20f('0x29')](respondWithResult(_0x5e903a,null))[_0xa20f('0x4b')](handleError(_0x5e903a,null));};exports[_0xa20f('0x97')]=function(_0x1c53d3,_0x2bddf9,_0x4f85c1){var _0x48d347,_0x1909d8;return db[_0xa20f('0x36')][_0xa20f('0x32')]({'where':{'id':_0x1c53d3[_0xa20f('0x4d')]['id']}})[_0xa20f('0x29')](handleEntityNotFound(_0x2bddf9,null))['then'](function(_0x497047){if(_0x497047){_0x1909d8=_0x497047;return _0x497047['addLists'](_0x1c53d3[_0xa20f('0x4f')][_0xa20f('0x7b')],_[_0xa20f('0x58')](_0x1c53d3[_0xa20f('0x4f')],[_0xa20f('0x7b'),'id'])||{});}return null;})['spread'](function(_0x2784ae){var _0x2ae5b9;_0x48d347=_0x2784ae||[];var _0x58d69a=[];if(_0x2784ae){for(var _0x476a15=0x0;_0x476a15<_0x2784ae[_0xa20f('0x40')];_0x476a15+=0x1){var _0x2f3a9b=_0x2784ae[_0x476a15][_0xa20f('0x2a')]({'plain':!![]});_0x1909d8[_0xa20f('0x98')]=_0x1c53d3['body'][_0xa20f('0x98')]?_0x1c53d3['body'][_0xa20f('0x98')]:_0x1909d8[_0xa20f('0x98')];switch(_0x1909d8[_0xa20f('0x98')]){case _0xa20f('0x99'):_0x2ae5b9=squel[_0xa20f('0x9a')]()['into'](_0xa20f('0x9b'))['fromQuery']([_0xa20f('0x9c'),_0xa20f('0x9d'),_0xa20f('0x9e'),_0xa20f('0x9f'),'VoiceQueueId',_0xa20f('0xa0'),_0xa20f('0xa1')],squel[_0xa20f('0xa2')]()[_0xa20f('0x7c')]('phone',_0xa20f('0x9c'))[_0xa20f('0x7c')](_0xa20f('0xa3'),_0xa20f('0x9d'))[_0xa20f('0x7c')]('id',_0xa20f('0x9e'))['field'](_0x2f3a9b[_0xa20f('0xa4')]['toString'](),_0xa20f('0x9f'))[_0xa20f('0x7c')](_0x1c53d3['params']['id']['toString'](),'VoiceQueueId')[_0xa20f('0x7c')](_0xa20f('0xa3'),_0xa20f('0xa0'))[_0xa20f('0x7c')]('NOW()','updatedAt')[_0xa20f('0x7e')](_0xa20f('0xa5'))[_0xa20f('0x44')](_0xa20f('0xa6'))[_0xa20f('0x44')](_0xa20f('0xa7'),_0x2f3a9b[_0xa20f('0xa4')][_0xa20f('0x86')]())['where'](_0xa20f('0xa8'))[_0xa20f('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa20f('0xa2')]()[_0xa20f('0x7c')](_0xa20f('0xa9'))['from']('cm_hopper_final')[_0xa20f('0x44')](_0xa20f('0x82'),_0x1c53d3[_0xa20f('0x4d')]['id']['toString']()))[_0xa20f('0x44')](_0xa20f('0xaa'),squel[_0xa20f('0xa2')]()['field'](_0xa20f('0xab'))[_0xa20f('0x7e')](_0xa20f('0x9b'))['where'](_0xa20f('0x82'),_0x1c53d3[_0xa20f('0x4d')]['id'][_0xa20f('0x86')]())))[_0xa20f('0x86')]();break;case _0xa20f('0xac'):_0x2ae5b9=squel[_0xa20f('0x9a')]()[_0xa20f('0xad')](_0xa20f('0x9b'))[_0xa20f('0xae')]([_0xa20f('0x9c'),'scheduledAt',_0xa20f('0x9e'),'ListId','VoiceQueueId',_0xa20f('0xa0'),_0xa20f('0xa1')],squel['select']()[_0xa20f('0x7c')](_0xa20f('0x9c'),_0xa20f('0x9c'))[_0xa20f('0x7c')](_0xa20f('0xa3'),_0xa20f('0x9d'))[_0xa20f('0x7c')]('id',_0xa20f('0x9e'))['field'](_0x2f3a9b[_0xa20f('0xa4')]['toString'](),_0xa20f('0x9f'))[_0xa20f('0x7c')](_0x1c53d3['params']['id'][_0xa20f('0x86')](),_0xa20f('0x5f'))[_0xa20f('0x7c')](_0xa20f('0xa3'),_0xa20f('0xa0'))[_0xa20f('0x7c')](_0xa20f('0xa3'),'updatedAt')['from'](_0xa20f('0xa5'))[_0xa20f('0x44')](_0xa20f('0xa6'))[_0xa20f('0x44')](_0xa20f('0xa7'),_0x2f3a9b[_0xa20f('0xa4')][_0xa20f('0x86')]())['where'](_0xa20f('0xa8'))['where'](_0xa20f('0xaa'),squel[_0xa20f('0xa2')]()[_0xa20f('0x7c')](_0xa20f('0xab'))[_0xa20f('0x7e')](_0xa20f('0x9b'))[_0xa20f('0x44')](_0xa20f('0x82'),_0x1c53d3[_0xa20f('0x4d')]['id']['toString']())))[_0xa20f('0x86')]();break;default:_0x2ae5b9=squel[_0xa20f('0x9a')]()[_0xa20f('0xad')](_0xa20f('0x9b'))[_0xa20f('0xae')]([_0xa20f('0x9c'),_0xa20f('0x9d'),_0xa20f('0x9e'),_0xa20f('0x9f'),_0xa20f('0x5f'),_0xa20f('0xa0'),'updatedAt'],squel[_0xa20f('0xa2')]()[_0xa20f('0x7c')](_0xa20f('0x9c'),_0xa20f('0x9c'))[_0xa20f('0x7c')]('NOW()',_0xa20f('0x9d'))[_0xa20f('0x7c')]('id',_0xa20f('0x9e'))[_0xa20f('0x7c')](_0x2f3a9b[_0xa20f('0xa4')][_0xa20f('0x86')](),_0xa20f('0x9f'))['field'](_0x1c53d3[_0xa20f('0x4d')]['id']['toString'](),'VoiceQueueId')[_0xa20f('0x7c')]('NOW()','createdAt')[_0xa20f('0x7c')]('NOW()','updatedAt')[_0xa20f('0x7e')](_0xa20f('0xa5'))[_0xa20f('0x44')](_0xa20f('0xa6'))[_0xa20f('0x44')](_0xa20f('0xa7'),_0x2f3a9b[_0xa20f('0xa4')][_0xa20f('0x86')]())['where'](_0xa20f('0xa8')))[_0xa20f('0x86')]();}_0x58d69a[_0xa20f('0x84')](db[_0xa20f('0x85')][_0xa20f('0x39')](_0x2ae5b9));}return BPromise[_0xa20f('0x8b')](_0x58d69a);}})['then'](function(){return _0x48d347;})['then'](respondWithResult(_0x2bddf9,null))[_0xa20f('0x4b')](handleError(_0x2bddf9,null));};exports[_0xa20f('0xaf')]=function(_0x254bc7,_0x1248bf,_0x4f9efb){return db[_0xa20f('0x36')]['find']({'where':{'id':_0x254bc7['params']['id']}})[_0xa20f('0x29')](handleEntityNotFound(_0x1248bf,null))[_0xa20f('0x29')](function(_0x1404c9){if(_0x1404c9){return _0x1404c9[_0xa20f('0xaf')](_0x254bc7[_0xa20f('0x39')]['ids']);}})[_0xa20f('0x29')](function(_0x557d95){if(_0x557d95){return db[_0xa20f('0x5d')][_0xa20f('0x5a')]({'where':{'ListId':_0x254bc7[_0xa20f('0x39')]['ids'],'VoiceQueueId':_0x254bc7['params']['id']}})['then'](function(){return _0x557d95;});}})[_0xa20f('0x29')](respondWithStatusCode(_0x1248bf,null))[_0xa20f('0x4b')](handleError(_0x1248bf,null));};exports[_0xa20f('0xb0')]=function(_0x3e50c4,_0x162f6e,_0x2f51ed){var _0x2a8e8c={};var _0x2b0825={};var _0x45ea07;var _0x15c517;return db['VoiceQueue'][_0xa20f('0x5c')]({'where':{'id':_0x3e50c4[_0xa20f('0x4d')]['id']}})[_0xa20f('0x29')](handleEntityNotFound(_0x162f6e,null))[_0xa20f('0x29')](function(_0x4ae622){if(_0x4ae622){_0x45ea07=_0x4ae622;_0x2b0825[_0xa20f('0x3e')]=_['keys'](db['CmList'][_0xa20f('0x37')]);_0x2b0825[_0xa20f('0x39')]=_[_0xa20f('0x3a')](_0x3e50c4[_0xa20f('0x39')]);_0x2b0825[_0xa20f('0x3b')]=_[_0xa20f('0x3c')](_0x2b0825[_0xa20f('0x3e')],_0x2b0825[_0xa20f('0x39')]);_0x2a8e8c[_0xa20f('0x3d')]=_[_0xa20f('0x3c')](_0x2b0825['model'],qs[_0xa20f('0x3f')](_0x3e50c4[_0xa20f('0x39')][_0xa20f('0x3f')]));_0x2a8e8c[_0xa20f('0x3d')]=_0x2a8e8c[_0xa20f('0x3d')][_0xa20f('0x40')]?_0x2a8e8c[_0xa20f('0x3d')]:_0x2b0825[_0xa20f('0x3e')];_0x2a8e8c['order']=qs[_0xa20f('0x43')](_0x3e50c4[_0xa20f('0x39')][_0xa20f('0x43')]);_0x2a8e8c[_0xa20f('0x44')]=qs[_0xa20f('0x3b')](_['pick'](_0x3e50c4[_0xa20f('0x39')],_0x2b0825['filters']));if(_0x3e50c4[_0xa20f('0x39')][_0xa20f('0x2d')]){_0x2a8e8c['where']=_['merge'](_0x2a8e8c['where'],{'$or':_['map'](_0x2a8e8c[_0xa20f('0x3d')],function(_0x2b289f){var _0x5e7dac={};_0x5e7dac[_0x2b289f]={'$like':'%'+_0x3e50c4[_0xa20f('0x39')]['filter']+'%'};return _0x5e7dac;})});}_0x2a8e8c=_[_0xa20f('0x45')]({},_0x2a8e8c,_0x3e50c4[_0xa20f('0x47')]);return _0x45ea07['getBlackLists'](_0x2a8e8c);}})[_0xa20f('0x29')](function(_0x286736){if(_0x286736){_0x15c517=_0x286736[_0xa20f('0x40')];if(!_0x3e50c4[_0xa20f('0x39')][_0xa20f('0x64')]('nolimit')){_0x2a8e8c['limit']=qs[_0xa20f('0x21')](_0x3e50c4[_0xa20f('0x39')][_0xa20f('0x21')]);_0x2a8e8c[_0xa20f('0x1f')]=qs['offset'](_0x3e50c4['query']['offset']);}return _0x45ea07[_0xa20f('0xb0')](_0x2a8e8c);}})[_0xa20f('0x29')](function(_0x184fe0){if(_0x184fe0){return _0x184fe0?{'count':_0x15c517,'rows':_0x184fe0}:null;}})[_0xa20f('0x29')](respondWithResult(_0x162f6e,null))[_0xa20f('0x4b')](handleError(_0x162f6e,null));};exports[_0xa20f('0xb1')]=function(_0x2b5537,_0x7bc6b4,_0x16d420){var _0xb1b902,_0x2430e4;return db['VoiceQueue']['find']({'where':{'id':_0x2b5537[_0xa20f('0x4d')]['id']}})[_0xa20f('0x29')](handleEntityNotFound(_0x7bc6b4,null))[_0xa20f('0x29')](function(_0x2497c8){if(_0x2497c8){_0x2430e4=_0x2497c8;return _0x2497c8['addBlackLists'](_0x2b5537[_0xa20f('0x4f')][_0xa20f('0x7b')],_['omit'](_0x2b5537[_0xa20f('0x4f')],[_0xa20f('0x7b'),'id'])||{});}return null;})[_0xa20f('0x91')](function(_0x157003){var _0x3e4c70;_0xb1b902=_0x157003||[];var _0x4542e6=[];if(_0x157003){for(var _0x3428ce=0x0;_0x3428ce<_0x157003[_0xa20f('0x40')];_0x3428ce+=0x1){var _0x5c385b=_0x157003[_0x3428ce][_0xa20f('0x2a')]({'plain':!![]});_0x3e4c70=squel[_0xa20f('0x9a')]()[_0xa20f('0xad')](_0xa20f('0xb2'))[_0xa20f('0xae')]([_0xa20f('0x9c'),_0xa20f('0x9e'),_0xa20f('0x9f'),_0xa20f('0x5f'),_0xa20f('0xa0'),'updatedAt'],squel[_0xa20f('0xa2')]()[_0xa20f('0x7c')](_0xa20f('0x9c'),_0xa20f('0x9c'))[_0xa20f('0x7c')]('id',_0xa20f('0x9e'))[_0xa20f('0x7c')](_0x5c385b[_0xa20f('0xa4')]['toString'](),_0xa20f('0x9f'))[_0xa20f('0x7c')](_0x2b5537[_0xa20f('0x4d')]['id'][_0xa20f('0x86')](),_0xa20f('0x5f'))[_0xa20f('0x7c')](_0xa20f('0xa3'),_0xa20f('0xa0'))[_0xa20f('0x7c')](_0xa20f('0xa3'),_0xa20f('0xa1'))[_0xa20f('0x7e')](_0xa20f('0xa5'))['where'](_0xa20f('0xa6'))['where']('ListId\x20=\x20?',_0x5c385b['CmListId'][_0xa20f('0x86')]())['where'](_0xa20f('0xa8')))[_0xa20f('0x86')]();_0x4542e6['push'](db[_0xa20f('0x85')][_0xa20f('0x39')](_0x3e4c70));}return BPromise[_0xa20f('0x8b')](_0x4542e6);}})[_0xa20f('0x29')](function(){return _0xb1b902;})[_0xa20f('0x29')](respondWithResult(_0x7bc6b4,null))[_0xa20f('0x4b')](handleError(_0x7bc6b4,null));};exports[_0xa20f('0xb3')]=function(_0x211d92,_0x91b90e,_0x40a83f){return db[_0xa20f('0x36')][_0xa20f('0x32')]({'where':{'id':_0x211d92[_0xa20f('0x4d')]['id']}})[_0xa20f('0x29')](handleEntityNotFound(_0x91b90e,null))[_0xa20f('0x29')](function(_0x56b7b0){if(_0x56b7b0){return _0x56b7b0[_0xa20f('0xb3')](_0x211d92[_0xa20f('0x39')][_0xa20f('0x7b')]);}})['then'](function(_0x21ae89){if(_0x21ae89){return db[_0xa20f('0x66')][_0xa20f('0x5a')]({'where':{'ListId':_0x211d92[_0xa20f('0x39')][_0xa20f('0x7b')],'VoiceQueueId':_0x211d92[_0xa20f('0x4d')]['id']}})[_0xa20f('0x29')](function(){return _0x21ae89;});}})[_0xa20f('0x29')](respondWithStatusCode(_0x91b90e,null))['catch'](handleError(_0x91b90e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index fa6c767..5cfd46d 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 _0xdfea=['save','remove','emit','hook','exports','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x1623a5,_0x5ca096){var _0x55b630=function(_0x112413){while(--_0x112413){_0x1623a5['push'](_0x1623a5['shift']());}};_0x55b630(++_0x5ca096);}(_0xdfea,0x125));var _0xadfe=function(_0x32ae87,_0x151b9e){_0x32ae87=_0x32ae87-0x0;var _0x1bc656=_0xdfea[_0x32ae87];return _0x1bc656;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xadfe('0x0'))['db'][_0xadfe('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xadfe('0x2')](0x0);var events={'afterCreate':_0xadfe('0x3'),'afterUpdate':'update','afterDestroy':_0xadfe('0x4')};function emitEvent(_0x36b025){return function(_0x1edc12,_0x280586,_0x560acd){VoiceQueueEvents[_0xadfe('0x5')](_0x36b025+':'+_0x1edc12['id'],_0x1edc12);VoiceQueueEvents[_0xadfe('0x5')](_0x36b025,_0x1edc12);_0x560acd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xadfe('0x6')](e,emitEvent(event));}}module[_0xadfe('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0xdf3a=['emit','hasOwnProperty','hook','exports','events','VoiceQueue','setMaxListeners','update','remove'];(function(_0x263a1a,_0x508bc9){var _0x802057=function(_0x5ebec9){while(--_0x5ebec9){_0x263a1a['push'](_0x263a1a['shift']());}};_0x802057(++_0x508bc9);}(_0xdf3a,0xf7));var _0xadf3=function(_0x215a31,_0x1925fb){_0x215a31=_0x215a31-0x0;var _0x11c72a=_0xdf3a[_0x215a31];return _0x11c72a;};'use strict';var EventEmitter=require(_0xadf3('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xadf3('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xadf3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xadf3('0x3'),'afterDestroy':_0xadf3('0x4')};function emitEvent(_0x44dbd9){return function(_0x2d1205,_0x4c377f,_0x5d54ad){VoiceQueueEvents[_0xadf3('0x5')](_0x44dbd9+':'+_0x2d1205['id'],_0x2d1205);VoiceQueueEvents[_0xadf3('0x5')](_0x44dbd9,_0x2d1205);_0x5d54ad(null);};}for(var e in events){if(events[_0xadf3('0x6')](e)){var event=events[e];VoiceQueue[_0xadf3('0x7')](e,emitEvent(event));}}module[_0xadf3('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 4a6f52d..6cd38a1 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 _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x3c5924,_0x4d295f){var _0x576958=function(_0x4a3e2d){while(--_0x4a3e2d){_0x3c5924['push'](_0x3c5924['shift']());}};_0x576958(++_0x4d295f);}(_0x008c,0x188));var _0xc008=function(_0x3d7022,_0x59dfd5){_0x3d7022=_0x3d7022-0x0;var _0x40870b=_0x008c[_0x3d7022];return _0x40870b;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x2023e1,_0xeca985){var _0x1fe133=function(_0x526d5f){while(--_0x526d5f){_0x2023e1['push'](_0x2023e1['shift']());}};_0x1fe133(++_0xeca985);}(_0x3e74,0x175));var _0x43e7=function(_0x2a6839,_0x5ef906){_0x2a6839=_0x2a6839-0x0;var _0x4aa455=_0x3e74[_0x2a6839];return _0x4aa455;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index bb7c253..56bf3fb 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 _0x1c64=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','raw','options','where','attributes','limit','include','map','model','GetVoiceQueue','catch','ShowVoiceQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x500a89,_0x1d65c6){var _0x2432fd=function(_0x1d496e){while(--_0x1d496e){_0x500a89['push'](_0x500a89['shift']());}};_0x2432fd(++_0x1d65c6);}(_0x1c64,0x1e9));var _0x41c6=function(_0x50fd4b,_0x145fb2){_0x50fd4b=_0x50fd4b-0x0;var _0x11658a=_0x1c64[_0x50fd4b];return _0x11658a;};'use strict';var _=require(_0x41c6('0x0'));var util=require('util');var moment=require(_0x41c6('0x1'));var BPromise=require(_0x41c6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41c6('0x3'));var db=require(_0x41c6('0x4'))['db'];var utils=require(_0x41c6('0x5'));var logger=require(_0x41c6('0x6'))(_0x41c6('0x7'));var config=require(_0x41c6('0x8'));var jayson=require(_0x41c6('0x9'));var client=jayson[_0x41c6('0xa')]['http']({'port':0x232a});config['redis']=_[_0x41c6('0xb')](config[_0x41c6('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x41c6('0xd'))(new Redis(config['redis']));require(_0x41c6('0xe'))[_0x41c6('0xf')](socket);function respondWithRpcPromise(_0x19a0c7,_0x552c30,_0x5d59ab){return new BPromise(function(_0x4323df,_0x44fc08){return client[_0x41c6('0x10')](_0x19a0c7,_0x5d59ab)[_0x41c6('0x11')](function(_0x536735){logger[_0x41c6('0x12')](_0x41c6('0x13'),_0x552c30,_0x41c6('0x14'));logger[_0x41c6('0x15')](_0x41c6('0x16'),_0x552c30,_0x41c6('0x14'),JSON[_0x41c6('0x17')](_0x536735));if(_0x536735[_0x41c6('0x18')]){if(_0x536735['error']['code']===0x1f4){logger[_0x41c6('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x552c30,_0x536735[_0x41c6('0x18')][_0x41c6('0x19')]);return _0x44fc08(_0x536735[_0x41c6('0x18')][_0x41c6('0x19')]);}logger[_0x41c6('0x18')](_0x41c6('0x13'),_0x552c30,_0x536735['error'][_0x41c6('0x19')]);return _0x4323df(_0x536735[_0x41c6('0x18')]['message']);}else{logger[_0x41c6('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x552c30,_0x41c6('0x14'));_0x4323df(_0x536735['result'][_0x41c6('0x19')]);}})['catch'](function(_0x3b4efa){logger[_0x41c6('0x18')](_0x41c6('0x13'),_0x552c30,_0x3b4efa);_0x44fc08(_0x3b4efa);});});}exports['GetVoiceQueue']=function(_0x252046){var _0x1d60b4=this;return new Promise(function(_0x5387a1,_0x5b84ce){return db['VoiceQueue']['findAll']({'raw':_0x252046['options']?_0x252046['options'][_0x41c6('0x1a')]===undefined?!![]:![]:!![],'where':_0x252046[_0x41c6('0x1b')]?_0x252046[_0x41c6('0x1b')][_0x41c6('0x1c')]||null:null,'attributes':_0x252046[_0x41c6('0x1b')]?_0x252046['options'][_0x41c6('0x1d')]||null:null,'limit':_0x252046[_0x41c6('0x1b')]?_0x252046['options'][_0x41c6('0x1e')]||null:null,'include':_0x252046[_0x41c6('0x1b')]?_0x252046[_0x41c6('0x1b')][_0x41c6('0x1f')]?_[_0x41c6('0x20')](_0x252046['options'][_0x41c6('0x1f')],function(_0x227116){return{'model':db[_0x227116['model']],'as':_0x227116['as'],'attributes':_0x227116['attributes'],'include':_0x227116[_0x41c6('0x1f')]?_['map'](_0x227116[_0x41c6('0x1f')],function(_0x33fef4){return{'model':db[_0x33fef4[_0x41c6('0x21')]],'as':_0x33fef4['as'],'attributes':_0x33fef4['attributes'],'include':_0x33fef4[_0x41c6('0x1f')]?_[_0x41c6('0x20')](_0x33fef4['include'],function(_0x5e5be0){return{'model':db[_0x5e5be0['model']],'as':_0x5e5be0['as'],'attributes':_0x5e5be0['attributes']};}):[]};}):[]};}):[]:[]})[_0x41c6('0x11')](function(_0x10873e){logger[_0x41c6('0x12')](_0x41c6('0x22'),_0x252046);logger[_0x41c6('0x15')](_0x41c6('0x22'),_0x252046,JSON[_0x41c6('0x17')](_0x10873e));_0x5387a1(_0x10873e);})[_0x41c6('0x23')](function(_0x54169f){logger[_0x41c6('0x18')](_0x41c6('0x22'),_0x54169f['message'],_0x252046);_0x5b84ce(_0x1d60b4[_0x41c6('0x18')](0x1f4,_0x54169f[_0x41c6('0x19')]));});});};exports[_0x41c6('0x24')]=function(_0x3eb638){var _0x33eba5=this;return new Promise(function(_0x49a487,_0x4187a4){return db['VoiceQueue'][_0x41c6('0x25')]({'raw':_0x3eb638['options']?_0x3eb638['options']['raw']===undefined?!![]:![]:!![],'where':_0x3eb638['options']?_0x3eb638[_0x41c6('0x1b')][_0x41c6('0x1c')]||null:null,'attributes':_0x3eb638[_0x41c6('0x1b')]?_0x3eb638[_0x41c6('0x1b')][_0x41c6('0x1d')]||null:null,'include':_0x3eb638[_0x41c6('0x1b')]?_0x3eb638[_0x41c6('0x1b')]['include']?_['map'](_0x3eb638['options'][_0x41c6('0x1f')],function(_0x432f7d){return{'model':db[_0x432f7d[_0x41c6('0x21')]],'as':_0x432f7d['as'],'attributes':_0x432f7d[_0x41c6('0x1d')],'include':_0x432f7d[_0x41c6('0x1f')]?_[_0x41c6('0x20')](_0x432f7d[_0x41c6('0x1f')],function(_0x2ec636){return{'model':db[_0x2ec636['model']],'as':_0x2ec636['as'],'attributes':_0x2ec636[_0x41c6('0x1d')],'include':_0x2ec636[_0x41c6('0x1f')]?_['map'](_0x2ec636[_0x41c6('0x1f')],function(_0x13de45){return{'model':db[_0x13de45[_0x41c6('0x21')]],'as':_0x13de45['as'],'attributes':_0x13de45['attributes']};}):[]};}):[]};}):[]:[]})[_0x41c6('0x11')](function(_0x6b71b8){logger['info']('ShowVoiceQueue',_0x3eb638);logger['debug'](_0x41c6('0x24'),_0x3eb638,JSON['stringify'](_0x6b71b8));_0x49a487(_0x6b71b8);})['catch'](function(_0x22f557){logger[_0x41c6('0x18')]('ShowVoiceQueue',_0x22f557['message'],_0x3eb638);_0x4187a4(_0x33eba5[_0x41c6('0x18')](0x1f4,_0x22f557['message']));});});}; \ No newline at end of file +var _0x1468=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetVoiceQueue','findAll','options','where','attributes','include','map','model','ShowVoiceQueue','find','raw','lodash','moment'];(function(_0x16ae06,_0x3546e3){var _0x9f911=function(_0x5b9213){while(--_0x5b9213){_0x16ae06['push'](_0x16ae06['shift']());}};_0x9f911(++_0x3546e3);}(_0x1468,0x136));var _0x8146=function(_0x3b2244,_0x54873f){_0x3b2244=_0x3b2244-0x0;var _0x2dcc14=_0x1468[_0x3b2244];return _0x2dcc14;};'use strict';var _=require(_0x8146('0x0'));var util=require('util');var moment=require(_0x8146('0x1'));var BPromise=require('bluebird');var rs=require(_0x8146('0x2'));var fs=require('fs');var Redis=require(_0x8146('0x3'));var db=require(_0x8146('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8146('0x5'))(_0x8146('0x6'));var config=require(_0x8146('0x7'));var jayson=require(_0x8146('0x8'));var client=jayson[_0x8146('0x9')][_0x8146('0xa')]({'port':0x232a});config[_0x8146('0xb')]=_[_0x8146('0xc')](config[_0x8146('0xb')],{'host':_0x8146('0xd'),'port':0x18eb});var socket=require(_0x8146('0xe'))(new Redis(config[_0x8146('0xb')]));require(_0x8146('0xf'))[_0x8146('0x10')](socket);function respondWithRpcPromise(_0xe4b87e,_0x236aba,_0x582269){return new BPromise(function(_0x5258e4,_0x1ef990){return client[_0x8146('0x11')](_0xe4b87e,_0x582269)[_0x8146('0x12')](function(_0x26c530){logger[_0x8146('0x13')](_0x8146('0x14'),_0x236aba,'request\x20sent');logger[_0x8146('0x15')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x236aba,_0x8146('0x16'),JSON[_0x8146('0x17')](_0x26c530));if(_0x26c530[_0x8146('0x18')]){if(_0x26c530[_0x8146('0x18')][_0x8146('0x19')]===0x1f4){logger[_0x8146('0x18')](_0x8146('0x14'),_0x236aba,_0x26c530[_0x8146('0x18')]['message']);return _0x1ef990(_0x26c530[_0x8146('0x18')][_0x8146('0x1a')]);}logger[_0x8146('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x236aba,_0x26c530['error'][_0x8146('0x1a')]);return _0x5258e4(_0x26c530[_0x8146('0x18')][_0x8146('0x1a')]);}else{logger[_0x8146('0x13')](_0x8146('0x14'),_0x236aba,_0x8146('0x16'));_0x5258e4(_0x26c530['result']['message']);}})[_0x8146('0x1b')](function(_0x113900){logger[_0x8146('0x18')](_0x8146('0x14'),_0x236aba,_0x113900);_0x1ef990(_0x113900);});});}exports[_0x8146('0x1c')]=function(_0x21f889){var _0x32753e=this;return new Promise(function(_0x57afe9,_0x107e52){return db['VoiceQueue'][_0x8146('0x1d')]({'raw':_0x21f889[_0x8146('0x1e')]?_0x21f889[_0x8146('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x21f889['options']?_0x21f889[_0x8146('0x1e')][_0x8146('0x1f')]||null:null,'attributes':_0x21f889[_0x8146('0x1e')]?_0x21f889['options'][_0x8146('0x20')]||null:null,'limit':_0x21f889[_0x8146('0x1e')]?_0x21f889[_0x8146('0x1e')]['limit']||null:null,'include':_0x21f889[_0x8146('0x1e')]?_0x21f889['options'][_0x8146('0x21')]?_[_0x8146('0x22')](_0x21f889['options'][_0x8146('0x21')],function(_0x23801b){return{'model':db[_0x23801b[_0x8146('0x23')]],'as':_0x23801b['as'],'attributes':_0x23801b[_0x8146('0x20')],'include':_0x23801b[_0x8146('0x21')]?_[_0x8146('0x22')](_0x23801b[_0x8146('0x21')],function(_0x490ff7){return{'model':db[_0x490ff7[_0x8146('0x23')]],'as':_0x490ff7['as'],'attributes':_0x490ff7[_0x8146('0x20')],'include':_0x490ff7[_0x8146('0x21')]?_['map'](_0x490ff7['include'],function(_0x202f2e){return{'model':db[_0x202f2e[_0x8146('0x23')]],'as':_0x202f2e['as'],'attributes':_0x202f2e[_0x8146('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8146('0x12')](function(_0x45c0bc){logger[_0x8146('0x13')](_0x8146('0x1c'),_0x21f889);logger['debug']('GetVoiceQueue',_0x21f889,JSON[_0x8146('0x17')](_0x45c0bc));_0x57afe9(_0x45c0bc);})[_0x8146('0x1b')](function(_0x409679){logger[_0x8146('0x18')]('GetVoiceQueue',_0x409679[_0x8146('0x1a')],_0x21f889);_0x107e52(_0x32753e[_0x8146('0x18')](0x1f4,_0x409679[_0x8146('0x1a')]));});});};exports[_0x8146('0x24')]=function(_0x4e3eca){var _0x58a05b=this;return new Promise(function(_0x2ee6c1,_0x473c55){return db['VoiceQueue'][_0x8146('0x25')]({'raw':_0x4e3eca['options']?_0x4e3eca[_0x8146('0x1e')][_0x8146('0x26')]===undefined?!![]:![]:!![],'where':_0x4e3eca['options']?_0x4e3eca[_0x8146('0x1e')][_0x8146('0x1f')]||null:null,'attributes':_0x4e3eca[_0x8146('0x1e')]?_0x4e3eca['options'][_0x8146('0x20')]||null:null,'include':_0x4e3eca[_0x8146('0x1e')]?_0x4e3eca[_0x8146('0x1e')]['include']?_[_0x8146('0x22')](_0x4e3eca[_0x8146('0x1e')][_0x8146('0x21')],function(_0x4449eb){return{'model':db[_0x4449eb[_0x8146('0x23')]],'as':_0x4449eb['as'],'attributes':_0x4449eb[_0x8146('0x20')],'include':_0x4449eb['include']?_[_0x8146('0x22')](_0x4449eb['include'],function(_0x5696c){return{'model':db[_0x5696c[_0x8146('0x23')]],'as':_0x5696c['as'],'attributes':_0x5696c[_0x8146('0x20')],'include':_0x5696c[_0x8146('0x21')]?_[_0x8146('0x22')](_0x5696c['include'],function(_0x2cd557){return{'model':db[_0x2cd557['model']],'as':_0x2cd557['as'],'attributes':_0x2cd557[_0x8146('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5625ef){logger[_0x8146('0x13')](_0x8146('0x24'),_0x4e3eca);logger[_0x8146('0x15')](_0x8146('0x24'),_0x4e3eca,JSON[_0x8146('0x17')](_0x5625ef));_0x2ee6c1(_0x5625ef);})['catch'](function(_0x39c997){logger['error'](_0x8146('0x24'),_0x39c997[_0x8146('0x1a')],_0x4e3eca);_0x473c55(_0x58a05b[_0x8146('0x18')](0x1f4,_0x39c997['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index bced351..67b0239 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 _0xb1e6=['remove','emit','removeListener'];(function(_0x19babd,_0x1d4ef7){var _0x314eaf=function(_0x24ea35){while(--_0x24ea35){_0x19babd['push'](_0x19babd['shift']());}};_0x314eaf(++_0x1d4ef7);}(_0xb1e6,0xea));var _0x6b1e=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0xb1e6[_0x40aaa4];return _0x4e21e5;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0x6b1e('0x0'),'update'];function createListener(_0x2bddab,_0x160e35){return function(_0x21cc5d){_0x160e35[_0x6b1e('0x1')](_0x2bddab,_0x21cc5d);};}function removeListener(_0x48ec6d,_0x2b16ee){return function(){VoiceQueueEvents[_0x6b1e('0x2')](_0x48ec6d,_0x2b16ee);};}exports['register']=function(_0x417274){for(var _0x54fcfc=0x0,_0x2f8041=events['length'];_0x54fcfc<_0x2f8041;_0x54fcfc++){var _0x56447c=events[_0x54fcfc];var _0x3d1fac=createListener('voiceQueue:'+_0x56447c,_0x417274);VoiceQueueEvents['on'](_0x56447c,_0x3d1fac);}}; \ No newline at end of file +var _0xef80=['save','remove','update','emit','removeListener','register','length','voiceQueue:'];(function(_0x265693,_0x1ae712){var _0x4fe38e=function(_0x17dd88){while(--_0x17dd88){_0x265693['push'](_0x265693['shift']());}};_0x4fe38e(++_0x1ae712);}(_0xef80,0x148));var _0x0ef8=function(_0xeb80c9,_0x3fe888){_0xeb80c9=_0xeb80c9-0x0;var _0x259c37=_0xef80[_0xeb80c9];return _0x259c37;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x0ef8('0x0'),_0x0ef8('0x1'),_0x0ef8('0x2')];function createListener(_0x19dc62,_0x45cc4c){return function(_0x2ba301){_0x45cc4c[_0x0ef8('0x3')](_0x19dc62,_0x2ba301);};}function removeListener(_0x8bd624,_0x38d522){return function(){VoiceQueueEvents[_0x0ef8('0x4')](_0x8bd624,_0x38d522);};}exports[_0x0ef8('0x5')]=function(_0x405237){for(var _0x158fd2=0x0,_0x51229d=events[_0x0ef8('0x6')];_0x158fd2<_0x51229d;_0x158fd2++){var _0x529867=events[_0x158fd2];var _0x458ed7=createListener(_0x0ef8('0x7')+_0x529867,_0x405237);VoiceQueueEvents['on'](_0x529867,_0x458ed7);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index f170050..537a052 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 _0x8125=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','describe','/index','getVoiceQueuesReport','show','post','create'];(function(_0x281cf1,_0x4ec5d5){var _0x29fa78=function(_0x50a151){while(--_0x50a151){_0x281cf1['push'](_0x281cf1['shift']());}};_0x29fa78(++_0x4ec5d5);}(_0x8125,0x17c));var _0x5812=function(_0x220f99,_0x2baaf7){_0x220f99=_0x220f99-0x0;var _0x377fa6=_0x8125[_0x220f99];return _0x377fa6;};'use strict';var multer=require(_0x5812('0x0'));var util=require(_0x5812('0x1'));var path=require(_0x5812('0x2'));var timeout=require(_0x5812('0x3'));var express=require(_0x5812('0x4'));var router=express[_0x5812('0x5')]();var fs_extra=require(_0x5812('0x6'));var auth=require(_0x5812('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5812('0x8'));var controller=require(_0x5812('0x9'));router['get']('/',auth[_0x5812('0xa')](),controller[_0x5812('0xb')]);router[_0x5812('0xc')](_0x5812('0xd'),auth[_0x5812('0xa')](),controller[_0x5812('0xe')]);router['get'](_0x5812('0xf'),auth[_0x5812('0xa')](),controller[_0x5812('0x10')]);router[_0x5812('0xc')]('/:id',auth[_0x5812('0xa')](),controller[_0x5812('0x11')]);router[_0x5812('0x12')]('/',auth[_0x5812('0xa')](),controller[_0x5812('0x13')]);router['put'](_0x5812('0x14'),auth['isAuthenticated'](),controller[_0x5812('0x15')]);router[_0x5812('0x16')]('/:id',auth[_0x5812('0xa')](),controller[_0x5812('0x17')]);module[_0x5812('0x18')]=router; \ No newline at end of file +var _0xd3d4=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','/describe','/index','getVoiceQueuesReport','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x2be961,_0x324806){var _0x2fad48=function(_0x41c30b){while(--_0x41c30b){_0x2be961['push'](_0x2be961['shift']());}};_0x2fad48(++_0x324806);}(_0xd3d4,0xaa));var _0x4d3d=function(_0x27567e,_0x2f60b0){_0x27567e=_0x27567e-0x0;var _0xb71bfe=_0xd3d4[_0x27567e];return _0xb71bfe;};'use strict';var multer=require(_0x4d3d('0x0'));var util=require(_0x4d3d('0x1'));var path=require(_0x4d3d('0x2'));var timeout=require(_0x4d3d('0x3'));var express=require(_0x4d3d('0x4'));var router=express[_0x4d3d('0x5')]();var fs_extra=require(_0x4d3d('0x6'));var auth=require(_0x4d3d('0x7'));var interaction=require(_0x4d3d('0x8'));var config=require('../../config/environment');var controller=require(_0x4d3d('0x9'));router[_0x4d3d('0xa')]('/',auth[_0x4d3d('0xb')](),controller['index']);router[_0x4d3d('0xa')](_0x4d3d('0xc'),auth[_0x4d3d('0xb')](),controller['describe']);router[_0x4d3d('0xa')](_0x4d3d('0xd'),auth[_0x4d3d('0xb')](),controller[_0x4d3d('0xe')]);router['get'](_0x4d3d('0xf'),auth['isAuthenticated'](),controller[_0x4d3d('0x10')]);router[_0x4d3d('0x11')]('/',auth['isAuthenticated'](),controller[_0x4d3d('0x12')]);router['put'](_0x4d3d('0xf'),auth['isAuthenticated'](),controller[_0x4d3d('0x13')]);router[_0x4d3d('0x14')](_0x4d3d('0xf'),auth[_0x4d3d('0xb')](),controller[_0x4d3d('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 91f1cc0..0047acb 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 _0x2acd=['moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','setDataValue','queuecallerleaveAt','holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2acd,0xaf));var _0xd2ac=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x2acd[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0xd2ac('0x0'));var moment=require(_0xd2ac('0x1'));module[_0xd2ac('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd2ac('0x3')]},'calleridname':{'type':Sequelize[_0xd2ac('0x3')]},'queue':{'type':Sequelize[_0xd2ac('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xd2ac('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xd2ac('0x4')],'set':function(_0x1b2e5b){var _0x13294d=moment(_0x1b2e5b);var _0x578e4b=moment(this[_0xd2ac('0x5')](_0xd2ac('0x6')))[_0xd2ac('0x7')](_0xd2ac('0x8'));var _0x3cff58=_0x13294d['diff'](_0x578e4b,'seconds');this[_0xd2ac('0x9')](_0xd2ac('0xa'),_0x1b2e5b);this[_0xd2ac('0x9')](_0xd2ac('0xb'),_0x3cff58||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xd2ac('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xd2ac('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xd2ac('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xd2ac('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xd2ac('0x3')],'comment':_0xd2ac('0xd')},'originalposition':{'type':Sequelize[_0xd2ac('0xe')]},'channel':{'type':Sequelize[_0xd2ac('0x3')]},'connectedlinenum':{'type':Sequelize[_0xd2ac('0x3')]},'connectedlinename':{'type':Sequelize[_0xd2ac('0x3')]},'accountcode':{'type':Sequelize[_0xd2ac('0x3')]},'context':{'type':Sequelize[_0xd2ac('0x3')]},'exten':{'type':Sequelize[_0xd2ac('0x3')]},'priority':{'type':Sequelize[_0xd2ac('0x3')]},'holdtime':{'type':Sequelize[_0xd2ac('0xe')]},'mohtime':{'type':Sequelize[_0xd2ac('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd2ac('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xd2ac('0x3')]},'transfer':{'type':Sequelize[_0xd2ac('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xd2ac('0xf')},'transferexten':{'type':Sequelize[_0xd2ac('0x3')]},'transferuniqueid':{'type':Sequelize[_0xd2ac('0x3')]},'disposition':{'type':Sequelize[_0xd2ac('0x3')]},'secondDisposition':{'type':Sequelize[_0xd2ac('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd2ac('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8ce5=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN'];(function(_0x383316,_0x5173bc){var _0x582cf8=function(_0x11c11b){while(--_0x11c11b){_0x383316['push'](_0x383316['shift']());}};_0x582cf8(++_0x5173bc);}(_0x8ce5,0x172));var _0x58ce=function(_0x332688,_0x1ffc4c){_0x332688=_0x332688-0x0;var _0x5d8714=_0x8ce5[_0x332688];return _0x5d8714;};'use strict';var Sequelize=require(_0x58ce('0x0'));var moment=require(_0x58ce('0x1'));module[_0x58ce('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x58ce('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x58ce('0x3')]},'queue':{'type':Sequelize[_0x58ce('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x58ce('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x58ce('0x4')],'set':function(_0x464d05){var _0x399b21=moment(_0x464d05);var _0x5a96ea=moment(this[_0x58ce('0x5')](_0x58ce('0x6')))[_0x58ce('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x160827=_0x399b21['diff'](_0x5a96ea,_0x58ce('0x8'));this[_0x58ce('0x9')](_0x58ce('0xa'),_0x464d05);this[_0x58ce('0x9')](_0x58ce('0xb'),_0x160827||null);}},'position':{'type':Sequelize[_0x58ce('0xc')]},'count':{'type':Sequelize[_0x58ce('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x58ce('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x58ce('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x58ce('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x58ce('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x58ce('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x58ce('0x3')],'comment':_0x58ce('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x58ce('0x3')]},'connectedlinename':{'type':Sequelize[_0x58ce('0x3')]},'accountcode':{'type':Sequelize[_0x58ce('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x58ce('0x3')]},'priority':{'type':Sequelize[_0x58ce('0x3')]},'holdtime':{'type':Sequelize[_0x58ce('0xc')]},'mohtime':{'type':Sequelize[_0x58ce('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x58ce('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x58ce('0x3')]},'transfer':{'type':Sequelize[_0x58ce('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x58ce('0x3')],'comment':_0x58ce('0xf')},'transferexten':{'type':Sequelize[_0x58ce('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x58ce('0x3')]},'secondDisposition':{'type':Sequelize[_0x58ce('0x3')]},'thirdDisposition':{'type':Sequelize[_0x58ce('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x58ce('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index ee08a46..f618c8b 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 _0x2e44=['hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceQueueReport','findAll','rows','catch','show','params','keys','find','body','describe','order','getVoiceQueuesReport','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','stack','name','index','map','rawAttributes','type','key','query','intersection','model','fields','attributes','length'];(function(_0x45f111,_0x3a1a4a){var _0x483508=function(_0x3131ab){while(--_0x3131ab){_0x45f111['push'](_0x45f111['shift']());}};_0x483508(++_0x3a1a4a);}(_0x2e44,0x1a8));var _0x42e4=function(_0x442214,_0x3a869f){_0x442214=_0x442214-0x0;var _0x2bddf9=_0x2e44[_0x442214];return _0x2bddf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x42e4('0x0'));var zipdir=require(_0x42e4('0x1'));var jsonpatch=require(_0x42e4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x42e4('0x3'));var util=require(_0x42e4('0x4'));var path=require(_0x42e4('0x5'));var sox=require(_0x42e4('0x6'));var csv=require(_0x42e4('0x7'));var ejs=require(_0x42e4('0x8'));var fs=require('fs');var fs_extra=require(_0x42e4('0x9'));var _=require(_0x42e4('0xa'));var squel=require(_0x42e4('0xb'));var crypto=require(_0x42e4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x42e4('0xd'));var toCsv=require(_0x42e4('0x7'));var querystring=require(_0x42e4('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x42e4('0xf'));var qs=require(_0x42e4('0x10'));var as=require(_0x42e4('0x11'));var hardwareService=require(_0x42e4('0x12'));var logger=require(_0x42e4('0x13'))(_0x42e4('0x14'));var utils=require(_0x42e4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x42e4('0x16'));var db=require(_0x42e4('0x17'))['db'];config[_0x42e4('0x18')]=_[_0x42e4('0x19')](config[_0x42e4('0x18')],{'host':_0x42e4('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42e4('0x18')]));require(_0x42e4('0x1b'))[_0x42e4('0x1c')](socket);function respondWithStatusCode(_0x6ea8fd,_0x1968bf){_0x1968bf=_0x1968bf||0xcc;return function(_0x156fcb){if(_0x156fcb){return _0x6ea8fd[_0x42e4('0x1d')](_0x1968bf);}return _0x6ea8fd[_0x42e4('0x1e')](_0x1968bf)['end']();};}function respondWithResult(_0x4dbb3e,_0x1cd491){_0x1cd491=_0x1cd491||0xc8;return function(_0x3bba4c){if(_0x3bba4c){return _0x4dbb3e[_0x42e4('0x1e')](_0x1cd491)[_0x42e4('0x1f')](_0x3bba4c);}};}function respondWithFilteredResult(_0x57a621,_0x4ec341){return function(_0x5d7d3d){if(_0x5d7d3d){var _0x5d5f7d=typeof _0x4ec341[_0x42e4('0x20')]===_0x42e4('0x21')&&typeof _0x4ec341[_0x42e4('0x22')]===_0x42e4('0x21');var _0x1b19f1=_0x5d7d3d[_0x42e4('0x23')];var _0x2df9fc=_0x5d5f7d?0x0:_0x4ec341['offset'];var _0x1849ba=_0x5d5f7d?_0x5d7d3d[_0x42e4('0x23')]:_0x4ec341[_0x42e4('0x20')]+_0x4ec341[_0x42e4('0x22')];var _0x1ac263;if(_0x1849ba>=_0x1b19f1){_0x1849ba=_0x1b19f1;_0x1ac263=0xc8;}else{_0x1ac263=0xce;}_0x57a621['status'](_0x1ac263);return _0x57a621[_0x42e4('0x24')]('Content-Range',_0x2df9fc+'-'+_0x1849ba+'/'+_0x1b19f1)[_0x42e4('0x1f')](_0x5d7d3d);}return null;};}function patchUpdates(_0x1e226a){return function(_0x441890){try{jsonpatch['apply'](_0x441890,_0x1e226a,!![]);}catch(_0x19420d){return BPromise[_0x42e4('0x25')](_0x19420d);}return _0x441890[_0x42e4('0x26')]();};}function saveUpdates(_0x358a5b,_0x176ec1){return function(_0x53ec43){if(_0x53ec43){return _0x53ec43[_0x42e4('0x27')](_0x358a5b)[_0x42e4('0x28')](function(_0x449643){return _0x449643;});}return null;};}function removeEntity(_0x3cfeec,_0xb5354b){return function(_0x4ac1ab){if(_0x4ac1ab){return _0x4ac1ab[_0x42e4('0x29')]()[_0x42e4('0x28')](function(){_0x3cfeec['status'](0xcc)[_0x42e4('0x2a')]();});}};}function handleEntityNotFound(_0x1556ca,_0x382516){return function(_0x157d5a){if(!_0x157d5a){_0x1556ca[_0x42e4('0x1d')](0x194);}return _0x157d5a;};}function handleError(_0x30677f,_0x540434){_0x540434=_0x540434||0x1f4;return function(_0x35bc9b){logger['error'](_0x35bc9b[_0x42e4('0x2b')]);if(_0x35bc9b[_0x42e4('0x2c')]){delete _0x35bc9b['name'];}_0x30677f[_0x42e4('0x1e')](_0x540434)['send'](_0x35bc9b);};}exports[_0x42e4('0x2d')]=function(_0x5cd940,_0x2d1a75){var _0x1dc463={},_0x4240e4={},_0x114264={'count':0x0,'rows':[]};var _0x745e6a=_[_0x42e4('0x2e')](db['VoiceQueueReport'][_0x42e4('0x2f')],function(_0x3d79ae){return{'name':_0x3d79ae['fieldName'],'type':_0x3d79ae[_0x42e4('0x30')][_0x42e4('0x31')]};});_0x4240e4['model']=_[_0x42e4('0x2e')](_0x745e6a,'name');_0x4240e4[_0x42e4('0x32')]=_['keys'](_0x5cd940[_0x42e4('0x32')]);_0x4240e4['filters']=_[_0x42e4('0x33')](_0x4240e4[_0x42e4('0x34')],_0x4240e4[_0x42e4('0x32')]);_0x1dc463['attributes']=_[_0x42e4('0x33')](_0x4240e4[_0x42e4('0x34')],qs[_0x42e4('0x35')](_0x5cd940[_0x42e4('0x32')][_0x42e4('0x35')]));_0x1dc463['attributes']=_0x1dc463[_0x42e4('0x36')][_0x42e4('0x37')]?_0x1dc463[_0x42e4('0x36')]:_0x4240e4[_0x42e4('0x34')];if(!_0x5cd940[_0x42e4('0x32')][_0x42e4('0x38')](_0x42e4('0x39'))){_0x1dc463[_0x42e4('0x22')]=qs[_0x42e4('0x22')](_0x5cd940[_0x42e4('0x32')][_0x42e4('0x22')]);_0x1dc463[_0x42e4('0x20')]=qs['offset'](_0x5cd940[_0x42e4('0x32')][_0x42e4('0x20')]);}_0x1dc463['order']=qs['sort'](_0x5cd940[_0x42e4('0x32')][_0x42e4('0x3a')]);_0x1dc463[_0x42e4('0x3b')]=qs[_0x42e4('0x3c')](_[_0x42e4('0x3d')](_0x5cd940[_0x42e4('0x32')],_0x4240e4['filters']),_0x745e6a);if(_0x5cd940[_0x42e4('0x32')][_0x42e4('0x3e')]){_0x1dc463['where']=_[_0x42e4('0x3f')](_0x1dc463['where'],{'$or':_['map'](_0x745e6a,function(_0x341481){if(_0x341481['type']!==_0x42e4('0x40')){var _0x3a7af8={};_0x3a7af8[_0x341481[_0x42e4('0x2c')]]={'$like':'%'+_0x5cd940['query'][_0x42e4('0x3e')]+'%'};return _0x3a7af8;}})});}_0x1dc463=_[_0x42e4('0x3f')]({},_0x1dc463,_0x5cd940[_0x42e4('0x41')]);var _0x71c630={'where':_0x1dc463[_0x42e4('0x3b')]};return db['VoiceQueueReport']['count'](_0x71c630)[_0x42e4('0x28')](function(_0x22dd4b){_0x114264[_0x42e4('0x23')]=_0x22dd4b;if(_0x5cd940[_0x42e4('0x32')][_0x42e4('0x42')]){_0x1dc463[_0x42e4('0x43')]=[{'all':!![]}];}return db[_0x42e4('0x44')][_0x42e4('0x45')](_0x1dc463);})[_0x42e4('0x28')](function(_0x4c78c3){_0x114264[_0x42e4('0x46')]=_0x4c78c3;return _0x114264;})['then'](respondWithFilteredResult(_0x2d1a75,_0x1dc463))[_0x42e4('0x47')](handleError(_0x2d1a75,null));};exports[_0x42e4('0x48')]=function(_0x38f453,_0x5f255b){var _0x386e42={'raw':![],'where':{'id':_0x38f453[_0x42e4('0x49')]['id']}},_0x17d9af={};_0x17d9af['model']=_[_0x42e4('0x4a')](db[_0x42e4('0x44')][_0x42e4('0x2f')]);_0x17d9af[_0x42e4('0x32')]=_['keys'](_0x38f453['query']);_0x17d9af[_0x42e4('0x3c')]=_[_0x42e4('0x33')](_0x17d9af[_0x42e4('0x34')],_0x17d9af['query']);_0x386e42[_0x42e4('0x36')]=_[_0x42e4('0x33')](_0x17d9af[_0x42e4('0x34')],qs[_0x42e4('0x35')](_0x38f453[_0x42e4('0x32')][_0x42e4('0x35')]));_0x386e42['attributes']=_0x386e42[_0x42e4('0x36')]['length']?_0x386e42[_0x42e4('0x36')]:_0x17d9af[_0x42e4('0x34')];if(_0x38f453[_0x42e4('0x32')][_0x42e4('0x42')]){_0x386e42[_0x42e4('0x43')]=[{'all':!![]}];}_0x386e42=_[_0x42e4('0x3f')]({},_0x386e42,_0x38f453[_0x42e4('0x41')]);return db['VoiceQueueReport'][_0x42e4('0x4b')](_0x386e42)[_0x42e4('0x28')](handleEntityNotFound(_0x5f255b,null))[_0x42e4('0x28')](respondWithResult(_0x5f255b,null))[_0x42e4('0x47')](handleError(_0x5f255b,null));};exports['create']=function(_0x307a6d,_0xd83657){return db[_0x42e4('0x44')]['create'](_0x307a6d[_0x42e4('0x4c')],{})[_0x42e4('0x28')](respondWithResult(_0xd83657,0xc9))['catch'](handleError(_0xd83657,null));};exports[_0x42e4('0x27')]=function(_0x13c91f,_0x5d1879){if(_0x13c91f[_0x42e4('0x4c')]['id']){delete _0x13c91f['body']['id'];}return db[_0x42e4('0x44')]['find']({'where':{'id':_0x13c91f[_0x42e4('0x49')]['id']}})[_0x42e4('0x28')](handleEntityNotFound(_0x5d1879,null))[_0x42e4('0x28')](saveUpdates(_0x13c91f[_0x42e4('0x4c')],null))[_0x42e4('0x28')](respondWithResult(_0x5d1879,null))[_0x42e4('0x47')](handleError(_0x5d1879,null));};exports[_0x42e4('0x29')]=function(_0x5ce8bd,_0x26a516){return db['VoiceQueueReport']['find']({'where':{'id':_0x5ce8bd['params']['id']}})['then'](handleEntityNotFound(_0x26a516,null))['then'](removeEntity(_0x26a516,null))[_0x42e4('0x47')](handleError(_0x26a516,null));};exports[_0x42e4('0x4d')]=function(_0x2f0aa1,_0x277979){return db[_0x42e4('0x44')][_0x42e4('0x4d')]()[_0x42e4('0x28')](respondWithResult(_0x277979,null))[_0x42e4('0x47')](handleError(_0x277979,null));};exports['getVoiceQueuesReport']=function(_0x32c505,_0x1cf278){var _0x723916={},_0x14715e={},_0x4753f9={'count':0x0,'rows':[]};_0x14715e[_0x42e4('0x34')]=_[_0x42e4('0x4a')](db[_0x42e4('0x44')][_0x42e4('0x2f')]);_0x14715e[_0x42e4('0x32')]=_[_0x42e4('0x4a')](_0x32c505[_0x42e4('0x32')]);_0x14715e[_0x42e4('0x3c')]=_['intersection'](_0x14715e[_0x42e4('0x34')],_0x14715e[_0x42e4('0x32')]);_0x723916['attributes']=_[_0x42e4('0x33')](_0x14715e[_0x42e4('0x34')],qs[_0x42e4('0x35')](_0x32c505[_0x42e4('0x32')]['fields']));_0x723916[_0x42e4('0x36')]=_0x723916['attributes'][_0x42e4('0x37')]?_0x723916[_0x42e4('0x36')]:_0x14715e['model'];if(!_0x32c505[_0x42e4('0x32')][_0x42e4('0x38')](_0x42e4('0x39'))){_0x723916[_0x42e4('0x22')]=qs[_0x42e4('0x22')](_0x32c505[_0x42e4('0x32')][_0x42e4('0x22')]);_0x723916[_0x42e4('0x20')]=qs[_0x42e4('0x20')](_0x32c505[_0x42e4('0x32')][_0x42e4('0x20')]);}_0x723916[_0x42e4('0x4e')]=qs[_0x42e4('0x3a')](_0x32c505['query'][_0x42e4('0x3a')]);_0x723916[_0x42e4('0x3b')]=qs[_0x42e4('0x3c')](_[_0x42e4('0x3d')](_0x32c505[_0x42e4('0x32')],_0x14715e[_0x42e4('0x3c')]));if(_0x32c505[_0x42e4('0x32')][_0x42e4('0x3e')]){_0x723916[_0x42e4('0x3b')]=_['merge'](_0x723916[_0x42e4('0x3b')],{'$or':_[_0x42e4('0x2e')](_0x723916[_0x42e4('0x36')],function(_0x1b3498){var _0x578423={};_0x578423[_0x1b3498]={'$like':'%'+_0x32c505[_0x42e4('0x32')][_0x42e4('0x3e')]+'%'};return _0x578423;})});}_0x723916=_[_0x42e4('0x3f')]({},_0x723916,_0x32c505[_0x42e4('0x41')]);var _0x22537a={'where':_0x723916[_0x42e4('0x3b')]};return db[_0x42e4('0x44')]['count'](_0x22537a)[_0x42e4('0x28')](function(_0x24b28b){_0x4753f9[_0x42e4('0x23')]=_0x24b28b;if(_0x32c505[_0x42e4('0x32')][_0x42e4('0x42')]){_0x723916[_0x42e4('0x43')]=[{'all':!![]}];}return db[_0x42e4('0x44')][_0x42e4('0x45')](_0x723916);})[_0x42e4('0x28')](function(_0x13a3e3){_0x4753f9[_0x42e4('0x46')]=_0x13a3e3;return _0x4753f9;})[_0x42e4('0x28')](respondWithFilteredResult(_0x1cf278,_0x723916,'getVoiceQueuesReport'))['catch'](handleError(_0x1cf278,null,_0x42e4('0x4f')));}; \ No newline at end of file +var _0xa12a=['key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','getVoiceQueuesReport','intersection','nolimit','order','rows','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./voiceQueueReport.socket','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','update','destroy','then','error','stack','name','index','map','VoiceQueueReport','rawAttributes','fieldName','type'];(function(_0x2d9eaa,_0x272c56){var _0x5bf0f8=function(_0x28d427){while(--_0x28d427){_0x2d9eaa['push'](_0x2d9eaa['shift']());}};_0x5bf0f8(++_0x272c56);}(_0xa12a,0x18b));var _0xaa12=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa12a[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaa12('0x0'));var rp=require(_0xaa12('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaa12('0x2'));var util=require(_0xaa12('0x3'));var path=require('path');var sox=require(_0xaa12('0x4'));var csv=require(_0xaa12('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa12('0x6'));var _=require(_0xaa12('0x7'));var squel=require(_0xaa12('0x8'));var crypto=require('crypto');var jsforce=require(_0xaa12('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xaa12('0x5'));var querystring=require(_0xaa12('0xa'));var Papa=require('papaparse');var Redis=require(_0xaa12('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xaa12('0xc'));var as=require(_0xaa12('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa12('0xe'))(_0xaa12('0xf'));var utils=require('../../config/utils');var config=require(_0xaa12('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa12('0x11'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xaa12('0x12'))(new Redis(config[_0xaa12('0x13')]));require(_0xaa12('0x14'))['register'](socket);function respondWithStatusCode(_0x406943,_0x2647b8){_0x2647b8=_0x2647b8||0xcc;return function(_0x9a1254){if(_0x9a1254){return _0x406943['sendStatus'](_0x2647b8);}return _0x406943['status'](_0x2647b8)[_0xaa12('0x15')]();};}function respondWithResult(_0x20dc3b,_0x51cb64){_0x51cb64=_0x51cb64||0xc8;return function(_0x88689){if(_0x88689){return _0x20dc3b[_0xaa12('0x16')](_0x51cb64)['json'](_0x88689);}};}function respondWithFilteredResult(_0x2e2647,_0x573f2c){return function(_0x568425){if(_0x568425){var _0xfddc0d=typeof _0x573f2c[_0xaa12('0x17')]===_0xaa12('0x18')&&typeof _0x573f2c[_0xaa12('0x19')]===_0xaa12('0x18');var _0x28fb44=_0x568425[_0xaa12('0x1a')];var _0x48583d=_0xfddc0d?0x0:_0x573f2c[_0xaa12('0x17')];var _0x59c90b=_0xfddc0d?_0x568425[_0xaa12('0x1a')]:_0x573f2c[_0xaa12('0x17')]+_0x573f2c[_0xaa12('0x19')];var _0x49eb3e;if(_0x59c90b>=_0x28fb44){_0x59c90b=_0x28fb44;_0x49eb3e=0xc8;}else{_0x49eb3e=0xce;}_0x2e2647[_0xaa12('0x16')](_0x49eb3e);return _0x2e2647[_0xaa12('0x1b')](_0xaa12('0x1c'),_0x48583d+'-'+_0x59c90b+'/'+_0x28fb44)[_0xaa12('0x1d')](_0x568425);}return null;};}function patchUpdates(_0x5dd800){return function(_0x60eb21){try{jsonpatch[_0xaa12('0x1e')](_0x60eb21,_0x5dd800,!![]);}catch(_0x28bbcc){return BPromise['reject'](_0x28bbcc);}return _0x60eb21['save']();};}function saveUpdates(_0x49802c,_0x4b1603){return function(_0xe7b899){if(_0xe7b899){return _0xe7b899[_0xaa12('0x1f')](_0x49802c)['then'](function(_0x1aecba){return _0x1aecba;});}return null;};}function removeEntity(_0x3848de,_0x2c246c){return function(_0x9d8678){if(_0x9d8678){return _0x9d8678[_0xaa12('0x20')]()[_0xaa12('0x21')](function(){_0x3848de['status'](0xcc)[_0xaa12('0x15')]();});}};}function handleEntityNotFound(_0x537b57,_0x3a98f1){return function(_0x856450){if(!_0x856450){_0x537b57['sendStatus'](0x194);}return _0x856450;};}function handleError(_0x596e54,_0x203ca4){_0x203ca4=_0x203ca4||0x1f4;return function(_0x2181a9){logger[_0xaa12('0x22')](_0x2181a9[_0xaa12('0x23')]);if(_0x2181a9[_0xaa12('0x24')]){delete _0x2181a9[_0xaa12('0x24')];}_0x596e54[_0xaa12('0x16')](_0x203ca4)['send'](_0x2181a9);};}exports[_0xaa12('0x25')]=function(_0x52bfe1,_0x11ad0d){var _0x4ed050={},_0x3878ed={},_0x568080={'count':0x0,'rows':[]};var _0x189bf0=_[_0xaa12('0x26')](db[_0xaa12('0x27')][_0xaa12('0x28')],function(_0xa1d216){return{'name':_0xa1d216[_0xaa12('0x29')],'type':_0xa1d216[_0xaa12('0x2a')][_0xaa12('0x2b')]};});_0x3878ed['model']=_[_0xaa12('0x26')](_0x189bf0,_0xaa12('0x24'));_0x3878ed[_0xaa12('0x2c')]=_[_0xaa12('0x2d')](_0x52bfe1['query']);_0x3878ed[_0xaa12('0x2e')]=_['intersection'](_0x3878ed['model'],_0x3878ed[_0xaa12('0x2c')]);_0x4ed050['attributes']=_['intersection'](_0x3878ed[_0xaa12('0x2f')],qs[_0xaa12('0x30')](_0x52bfe1[_0xaa12('0x2c')][_0xaa12('0x30')]));_0x4ed050[_0xaa12('0x31')]=_0x4ed050['attributes'][_0xaa12('0x32')]?_0x4ed050[_0xaa12('0x31')]:_0x3878ed[_0xaa12('0x2f')];if(!_0x52bfe1[_0xaa12('0x2c')][_0xaa12('0x33')]('nolimit')){_0x4ed050[_0xaa12('0x19')]=qs[_0xaa12('0x19')](_0x52bfe1[_0xaa12('0x2c')][_0xaa12('0x19')]);_0x4ed050[_0xaa12('0x17')]=qs['offset'](_0x52bfe1[_0xaa12('0x2c')][_0xaa12('0x17')]);}_0x4ed050['order']=qs['sort'](_0x52bfe1[_0xaa12('0x2c')][_0xaa12('0x34')]);_0x4ed050[_0xaa12('0x35')]=qs[_0xaa12('0x2e')](_['pick'](_0x52bfe1['query'],_0x3878ed[_0xaa12('0x2e')]),_0x189bf0);if(_0x52bfe1[_0xaa12('0x2c')][_0xaa12('0x36')]){_0x4ed050[_0xaa12('0x35')]=_[_0xaa12('0x37')](_0x4ed050[_0xaa12('0x35')],{'$or':_[_0xaa12('0x26')](_0x189bf0,function(_0x272905){if(_0x272905[_0xaa12('0x2a')]!==_0xaa12('0x38')){var _0x1e923a={};_0x1e923a[_0x272905[_0xaa12('0x24')]]={'$like':'%'+_0x52bfe1['query']['filter']+'%'};return _0x1e923a;}})});}_0x4ed050=_['merge']({},_0x4ed050,_0x52bfe1[_0xaa12('0x39')]);var _0x3f2bbb={'where':_0x4ed050['where']};return db[_0xaa12('0x27')][_0xaa12('0x1a')](_0x3f2bbb)[_0xaa12('0x21')](function(_0x18b78a){_0x568080[_0xaa12('0x1a')]=_0x18b78a;if(_0x52bfe1[_0xaa12('0x2c')][_0xaa12('0x3a')]){_0x4ed050[_0xaa12('0x3b')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xaa12('0x3c')](_0x4ed050);})['then'](function(_0x512e6a){_0x568080['rows']=_0x512e6a;return _0x568080;})[_0xaa12('0x21')](respondWithFilteredResult(_0x11ad0d,_0x4ed050))[_0xaa12('0x3d')](handleError(_0x11ad0d,null));};exports[_0xaa12('0x3e')]=function(_0x534ee6,_0x159f0b){var _0x37befe={'raw':![],'where':{'id':_0x534ee6[_0xaa12('0x3f')]['id']}},_0x46d425={};_0x46d425['model']=_[_0xaa12('0x2d')](db[_0xaa12('0x27')][_0xaa12('0x28')]);_0x46d425[_0xaa12('0x2c')]=_[_0xaa12('0x2d')](_0x534ee6[_0xaa12('0x2c')]);_0x46d425[_0xaa12('0x2e')]=_['intersection'](_0x46d425['model'],_0x46d425[_0xaa12('0x2c')]);_0x37befe['attributes']=_['intersection'](_0x46d425[_0xaa12('0x2f')],qs[_0xaa12('0x30')](_0x534ee6[_0xaa12('0x2c')][_0xaa12('0x30')]));_0x37befe[_0xaa12('0x31')]=_0x37befe[_0xaa12('0x31')][_0xaa12('0x32')]?_0x37befe[_0xaa12('0x31')]:_0x46d425['model'];if(_0x534ee6['query']['includeAll']){_0x37befe['include']=[{'all':!![]}];}_0x37befe=_['merge']({},_0x37befe,_0x534ee6[_0xaa12('0x39')]);return db['VoiceQueueReport'][_0xaa12('0x40')](_0x37befe)[_0xaa12('0x21')](handleEntityNotFound(_0x159f0b,null))[_0xaa12('0x21')](respondWithResult(_0x159f0b,null))[_0xaa12('0x3d')](handleError(_0x159f0b,null));};exports[_0xaa12('0x41')]=function(_0x49a446,_0x1938c2){return db[_0xaa12('0x27')][_0xaa12('0x41')](_0x49a446[_0xaa12('0x42')],{})[_0xaa12('0x21')](respondWithResult(_0x1938c2,0xc9))[_0xaa12('0x3d')](handleError(_0x1938c2,null));};exports[_0xaa12('0x1f')]=function(_0x25f625,_0x2e909d){if(_0x25f625[_0xaa12('0x42')]['id']){delete _0x25f625[_0xaa12('0x42')]['id'];}return db[_0xaa12('0x27')]['find']({'where':{'id':_0x25f625[_0xaa12('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2e909d,null))['then'](saveUpdates(_0x25f625[_0xaa12('0x42')],null))[_0xaa12('0x21')](respondWithResult(_0x2e909d,null))[_0xaa12('0x3d')](handleError(_0x2e909d,null));};exports[_0xaa12('0x20')]=function(_0x39fecf,_0x5f2817){return db[_0xaa12('0x27')][_0xaa12('0x40')]({'where':{'id':_0x39fecf['params']['id']}})[_0xaa12('0x21')](handleEntityNotFound(_0x5f2817,null))[_0xaa12('0x21')](removeEntity(_0x5f2817,null))[_0xaa12('0x3d')](handleError(_0x5f2817,null));};exports[_0xaa12('0x43')]=function(_0x5daae0,_0x5cb79a){return db['VoiceQueueReport'][_0xaa12('0x43')]()[_0xaa12('0x21')](respondWithResult(_0x5cb79a,null))['catch'](handleError(_0x5cb79a,null));};exports[_0xaa12('0x44')]=function(_0x1ffcb0,_0x5eba04){var _0x93fcea={},_0x1356f7={},_0x4aacd0={'count':0x0,'rows':[]};_0x1356f7[_0xaa12('0x2f')]=_[_0xaa12('0x2d')](db[_0xaa12('0x27')][_0xaa12('0x28')]);_0x1356f7[_0xaa12('0x2c')]=_[_0xaa12('0x2d')](_0x1ffcb0[_0xaa12('0x2c')]);_0x1356f7[_0xaa12('0x2e')]=_[_0xaa12('0x45')](_0x1356f7[_0xaa12('0x2f')],_0x1356f7[_0xaa12('0x2c')]);_0x93fcea['attributes']=_[_0xaa12('0x45')](_0x1356f7[_0xaa12('0x2f')],qs['fields'](_0x1ffcb0[_0xaa12('0x2c')][_0xaa12('0x30')]));_0x93fcea[_0xaa12('0x31')]=_0x93fcea[_0xaa12('0x31')][_0xaa12('0x32')]?_0x93fcea[_0xaa12('0x31')]:_0x1356f7[_0xaa12('0x2f')];if(!_0x1ffcb0[_0xaa12('0x2c')][_0xaa12('0x33')](_0xaa12('0x46'))){_0x93fcea['limit']=qs['limit'](_0x1ffcb0[_0xaa12('0x2c')][_0xaa12('0x19')]);_0x93fcea[_0xaa12('0x17')]=qs[_0xaa12('0x17')](_0x1ffcb0[_0xaa12('0x2c')][_0xaa12('0x17')]);}_0x93fcea[_0xaa12('0x47')]=qs[_0xaa12('0x34')](_0x1ffcb0[_0xaa12('0x2c')]['sort']);_0x93fcea[_0xaa12('0x35')]=qs['filters'](_['pick'](_0x1ffcb0['query'],_0x1356f7['filters']));if(_0x1ffcb0[_0xaa12('0x2c')][_0xaa12('0x36')]){_0x93fcea['where']=_['merge'](_0x93fcea[_0xaa12('0x35')],{'$or':_[_0xaa12('0x26')](_0x93fcea[_0xaa12('0x31')],function(_0x13d4f7){var _0x35ab96={};_0x35ab96[_0x13d4f7]={'$like':'%'+_0x1ffcb0[_0xaa12('0x2c')][_0xaa12('0x36')]+'%'};return _0x35ab96;})});}_0x93fcea=_[_0xaa12('0x37')]({},_0x93fcea,_0x1ffcb0[_0xaa12('0x39')]);var _0x13e60e={'where':_0x93fcea['where']};return db[_0xaa12('0x27')][_0xaa12('0x1a')](_0x13e60e)[_0xaa12('0x21')](function(_0x2f1495){_0x4aacd0[_0xaa12('0x1a')]=_0x2f1495;if(_0x1ffcb0[_0xaa12('0x2c')][_0xaa12('0x3a')]){_0x93fcea[_0xaa12('0x3b')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x93fcea);})['then'](function(_0x1d415f){_0x4aacd0[_0xaa12('0x48')]=_0x1d415f;return _0x4aacd0;})[_0xaa12('0x21')](respondWithFilteredResult(_0x5eba04,_0x93fcea,_0xaa12('0x44')))[_0xaa12('0x3d')](handleError(_0x5eba04,null,_0xaa12('0x44')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index f1dc9ab..bdbaaab 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 _0xf1ea=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','update','remove','emit'];(function(_0x15c536,_0x45dbca){var _0x514730=function(_0x357e90){while(--_0x357e90){_0x15c536['push'](_0x15c536['shift']());}};_0x514730(++_0x45dbca);}(_0xf1ea,0x16b));var _0xaf1e=function(_0x1aca38,_0x47f6bc){_0x1aca38=_0x1aca38-0x0;var _0x2d0648=_0xf1ea[_0x1aca38];return _0x2d0648;};'use strict';var EventEmitter=require(_0xaf1e('0x0'));var VoiceQueueReport=require(_0xaf1e('0x1'))['db'][_0xaf1e('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xaf1e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaf1e('0x4'),'afterDestroy':_0xaf1e('0x5')};function emitEvent(_0xd2a04d){return function(_0x286877,_0x1f405b,_0x7443b){VoiceQueueReportEvents[_0xaf1e('0x6')](_0xd2a04d+':'+_0x286877['id'],_0x286877);VoiceQueueReportEvents['emit'](_0xd2a04d,_0x286877);_0x7443b(null);};}for(var e in events){if(events[_0xaf1e('0x7')](e)){var event=events[e];VoiceQueueReport[_0xaf1e('0x8')](e,emitEvent(event));}}module[_0xaf1e('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x2d85=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x218681,_0x16971b){var _0x56c5de=function(_0x34b75a){while(--_0x34b75a){_0x218681['push'](_0x218681['shift']());}};_0x56c5de(++_0x16971b);}(_0x2d85,0x1e9));var _0x52d8=function(_0x38e91d,_0x16ad15){_0x38e91d=_0x38e91d-0x0;var _0x2c9dc3=_0x2d85[_0x38e91d];return _0x2c9dc3;};'use strict';var EventEmitter=require(_0x52d8('0x0'));var VoiceQueueReport=require(_0x52d8('0x1'))['db'][_0x52d8('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x52d8('0x3')](0x0);var events={'afterCreate':_0x52d8('0x4'),'afterUpdate':_0x52d8('0x5'),'afterDestroy':_0x52d8('0x6')};function emitEvent(_0x135d96){return function(_0x2ad3d4,_0x1b8213,_0x5ab6eb){VoiceQueueReportEvents[_0x52d8('0x7')](_0x135d96+':'+_0x2ad3d4['id'],_0x2ad3d4);VoiceQueueReportEvents[_0x52d8('0x7')](_0x135d96,_0x2ad3d4);_0x5ab6eb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x52d8('0x8')](e,emitEvent(event));}}module[_0x52d8('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 48f36bb..a993f6c 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 _0x4061=['api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid','calleridnum','util'];(function(_0x5507b3,_0x1d90dd){var _0x1167c8=function(_0xa5a0ab){while(--_0xa5a0ab){_0x5507b3['push'](_0x5507b3['shift']());}};_0x1167c8(++_0x1d90dd);}(_0x4061,0x11d));var _0x1406=function(_0x480a28,_0x4d827a){_0x480a28=_0x480a28-0x0;var _0x4434cc=_0x4061[_0x480a28];return _0x4434cc;};'use strict';var _=require('lodash');var util=require(_0x1406('0x0'));var logger=require('../../config/logger')(_0x1406('0x1'));var moment=require(_0x1406('0x2'));var BPromise=require(_0x1406('0x3'));var rp=require(_0x1406('0x4'));var fs=require('fs');var path=require(_0x1406('0x5'));var rimraf=require('rimraf');var config=require(_0x1406('0x6'));var attributes=require(_0x1406('0x7'));module[_0x1406('0x8')]=function(_0x51662d,_0x28e380){return _0x51662d[_0x1406('0x9')](_0x1406('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x1406('0xb')]},{'fields':[_0x1406('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfcc5=['./voiceQueueReport.attributes','define','VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0xbfbbeb,_0x106baa){var _0xec9fa1=function(_0x124d67){while(--_0x124d67){_0xbfbbeb['push'](_0xbfbbeb['shift']());}};_0xec9fa1(++_0x106baa);}(_0xfcc5,0x1bf));var _0x5fcc=function(_0xe641a8,_0x20549f){_0xe641a8=_0xe641a8-0x0;var _0x7d69f2=_0xfcc5[_0xe641a8];return _0x7d69f2;};'use strict';var _=require(_0x5fcc('0x0'));var util=require(_0x5fcc('0x1'));var logger=require(_0x5fcc('0x2'))(_0x5fcc('0x3'));var moment=require(_0x5fcc('0x4'));var BPromise=require('bluebird');var rp=require(_0x5fcc('0x5'));var fs=require('fs');var path=require(_0x5fcc('0x6'));var rimraf=require(_0x5fcc('0x7'));var config=require('../../config/environment');var attributes=require(_0x5fcc('0x8'));module['exports']=function(_0x275418,_0x31e182){return _0x275418[_0x5fcc('0x9')](_0x5fcc('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x5fcc('0xb')]},{'fields':[_0x5fcc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 5a2c4a7..57ed36c 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 _0xef48=['map','stringify','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','include','model','attributes'];(function(_0x18ce2f,_0x93cbb1){var _0xdfdde3=function(_0x26a400){while(--_0x26a400){_0x18ce2f['push'](_0x18ce2f['shift']());}};_0xdfdde3(++_0x93cbb1);}(_0xef48,0xf0));var _0x8ef4=function(_0x14c931,_0x52511b){_0x14c931=_0x14c931-0x0;var _0x45e73a=_0xef48[_0x14c931];return _0x45e73a;};'use strict';var _=require(_0x8ef4('0x0'));var util=require(_0x8ef4('0x1'));var moment=require(_0x8ef4('0x2'));var BPromise=require('bluebird');var rs=require(_0x8ef4('0x3'));var fs=require('fs');var Redis=require(_0x8ef4('0x4'));var db=require(_0x8ef4('0x5'))['db'];var utils=require(_0x8ef4('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8ef4('0x7'));var client=jayson[_0x8ef4('0x8')][_0x8ef4('0x9')]({'port':0x232a});config[_0x8ef4('0xa')]=_[_0x8ef4('0xb')](config[_0x8ef4('0xa')],{'host':_0x8ef4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x8ef4('0xd')](socket);function respondWithRpcPromise(_0x3d50cc,_0x40ff1e,_0x46bba2){return new BPromise(function(_0x30cd23,_0x554ad1){return client[_0x8ef4('0xe')](_0x3d50cc,_0x46bba2)[_0x8ef4('0xf')](function(_0x583e11){logger[_0x8ef4('0x10')](_0x8ef4('0x11'),_0x40ff1e,'request\x20sent');logger[_0x8ef4('0x12')](_0x8ef4('0x13'),_0x40ff1e,_0x8ef4('0x14'),JSON['stringify'](_0x583e11));if(_0x583e11['error']){if(_0x583e11['error'][_0x8ef4('0x15')]===0x1f4){logger[_0x8ef4('0x16')](_0x8ef4('0x11'),_0x40ff1e,_0x583e11['error'][_0x8ef4('0x17')]);return _0x554ad1(_0x583e11[_0x8ef4('0x16')][_0x8ef4('0x17')]);}logger[_0x8ef4('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x40ff1e,_0x583e11['error']['message']);return _0x30cd23(_0x583e11['error'][_0x8ef4('0x17')]);}else{logger[_0x8ef4('0x10')](_0x8ef4('0x11'),_0x40ff1e,_0x8ef4('0x14'));_0x30cd23(_0x583e11[_0x8ef4('0x18')][_0x8ef4('0x17')]);}})[_0x8ef4('0x19')](function(_0x6c6767){logger[_0x8ef4('0x16')](_0x8ef4('0x11'),_0x40ff1e,_0x6c6767);_0x554ad1(_0x6c6767);});});}exports[_0x8ef4('0x1a')]=function(_0x258288){var _0x291f21=this;return new Promise(function(_0x4d1012,_0x47ec68){return db[_0x8ef4('0x1b')]['findAll']({'raw':_0x258288[_0x8ef4('0x1c')]?_0x258288['options'][_0x8ef4('0x1d')]===undefined?!![]:![]:!![],'where':_0x258288[_0x8ef4('0x1c')]?_0x258288[_0x8ef4('0x1c')]['where']||null:null,'attributes':_0x258288[_0x8ef4('0x1c')]?_0x258288[_0x8ef4('0x1c')]['attributes']||null:null,'limit':_0x258288[_0x8ef4('0x1c')]?_0x258288[_0x8ef4('0x1c')]['limit']||null:null,'include':_0x258288[_0x8ef4('0x1c')]?_0x258288['options'][_0x8ef4('0x1e')]?_['map'](_0x258288[_0x8ef4('0x1c')][_0x8ef4('0x1e')],function(_0x4831f5){return{'model':db[_0x4831f5[_0x8ef4('0x1f')]],'as':_0x4831f5['as'],'attributes':_0x4831f5[_0x8ef4('0x20')],'include':_0x4831f5['include']?_[_0x8ef4('0x21')](_0x4831f5[_0x8ef4('0x1e')],function(_0xfa46f3){return{'model':db[_0xfa46f3['model']],'as':_0xfa46f3['as'],'attributes':_0xfa46f3[_0x8ef4('0x20')],'include':_0xfa46f3['include']?_[_0x8ef4('0x21')](_0xfa46f3[_0x8ef4('0x1e')],function(_0x33db9b){return{'model':db[_0x33db9b['model']],'as':_0x33db9b['as'],'attributes':_0x33db9b[_0x8ef4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8ef4('0xf')](function(_0x5cbd8b){logger['info']('GetVoiceQueueReport',_0x258288);logger[_0x8ef4('0x12')](_0x8ef4('0x1a'),_0x258288,JSON[_0x8ef4('0x22')](_0x5cbd8b));_0x4d1012(_0x5cbd8b);})[_0x8ef4('0x19')](function(_0x1cd2ba){logger[_0x8ef4('0x16')](_0x8ef4('0x1a'),_0x1cd2ba[_0x8ef4('0x17')],_0x258288);_0x47ec68(_0x291f21[_0x8ef4('0x16')](0x1f4,_0x1cd2ba[_0x8ef4('0x17')]));});});};exports[_0x8ef4('0x23')]=function(_0x1bb4c0){var _0x1b9c7f=this;return new Promise(function(_0x197792,_0x47d9fa){return db[_0x8ef4('0x1b')]['create'](_0x1bb4c0['body'],{'raw':_0x1bb4c0['options']?_0x1bb4c0['options'][_0x8ef4('0x1d')]===undefined?!![]:![]:!![]})[_0x8ef4('0xf')](function(_0x14ea57){logger[_0x8ef4('0x10')]('CreateVoiceQueueReport',_0x1bb4c0);logger[_0x8ef4('0x12')]('CreateVoiceQueueReport',_0x1bb4c0,JSON['stringify'](_0x14ea57));_0x197792(_0x14ea57);})[_0x8ef4('0x19')](function(_0x39a570){logger['error'](_0x8ef4('0x23'),_0x39a570['message'],_0x1bb4c0);_0x47d9fa(_0x1b9c7f[_0x8ef4('0x16')](0x1f4,_0x39a570[_0x8ef4('0x17')]));});});};exports[_0x8ef4('0x24')]=function(_0x21e999){var _0x1b8c8f=this;return new Promise(function(_0x29af21,_0x4e29bc){return db['VoiceQueueReport'][_0x8ef4('0x25')](_0x21e999['body'],{'raw':_0x21e999[_0x8ef4('0x1c')]?_0x21e999['options'][_0x8ef4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21e999[_0x8ef4('0x1c')]?_0x21e999[_0x8ef4('0x1c')][_0x8ef4('0x26')]||null:null,'attributes':_0x21e999[_0x8ef4('0x1c')]?_0x21e999[_0x8ef4('0x1c')]['attributes']||null:null,'limit':_0x21e999['options']?_0x21e999[_0x8ef4('0x1c')]['limit']||null:null})[_0x8ef4('0xf')](function(_0xbbb202){logger[_0x8ef4('0x10')](_0x8ef4('0x24'),_0x21e999);logger[_0x8ef4('0x12')](_0x8ef4('0x24'),_0x21e999,JSON[_0x8ef4('0x22')](_0xbbb202));_0x29af21(_0xbbb202);})[_0x8ef4('0x19')](function(_0x4bafdd){logger[_0x8ef4('0x16')](_0x8ef4('0x24'),_0x4bafdd[_0x8ef4('0x17')],_0x21e999);_0x4e29bc(_0x1b8c8f[_0x8ef4('0x16')](0x1f4,_0x4bafdd[_0x8ef4('0x17')]));});});}; \ No newline at end of file +var _0xde56=['raw','attributes','limit','include','model','map','GetVoiceQueueReport','debug','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VoiceQueueReport','options'];(function(_0x10fb38,_0x5693ca){var _0x1301f2=function(_0x150b2b){while(--_0x150b2b){_0x10fb38['push'](_0x10fb38['shift']());}};_0x1301f2(++_0x5693ca);}(_0xde56,0xae));var _0x6de5=function(_0x4f0e62,_0x28e44f){_0x4f0e62=_0x4f0e62-0x0;var _0x117ab8=_0xde56[_0x4f0e62];return _0x117ab8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6de5('0x0'));var BPromise=require(_0x6de5('0x1'));var rs=require(_0x6de5('0x2'));var fs=require('fs');var Redis=require(_0x6de5('0x3'));var db=require(_0x6de5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6de5('0x5'))(_0x6de5('0x6'));var config=require(_0x6de5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6de5('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6de5('0x9')],{'host':_0x6de5('0xa'),'port':0x18eb});var socket=require(_0x6de5('0xb'))(new Redis(config[_0x6de5('0x9')]));require('./voiceQueueReport.socket')[_0x6de5('0xc')](socket);function respondWithRpcPromise(_0x503662,_0x16bdc9,_0x5ca751){return new BPromise(function(_0x2150f6,_0x4d934a){return client[_0x6de5('0xd')](_0x503662,_0x5ca751)[_0x6de5('0xe')](function(_0x4f6fbd){logger[_0x6de5('0xf')](_0x6de5('0x10'),_0x16bdc9,'request\x20sent');logger['debug'](_0x6de5('0x11'),_0x16bdc9,_0x6de5('0x12'),JSON[_0x6de5('0x13')](_0x4f6fbd));if(_0x4f6fbd[_0x6de5('0x14')]){if(_0x4f6fbd[_0x6de5('0x14')][_0x6de5('0x15')]===0x1f4){logger[_0x6de5('0x14')](_0x6de5('0x10'),_0x16bdc9,_0x4f6fbd['error'][_0x6de5('0x16')]);return _0x4d934a(_0x4f6fbd[_0x6de5('0x14')][_0x6de5('0x16')]);}logger[_0x6de5('0x14')](_0x6de5('0x10'),_0x16bdc9,_0x4f6fbd[_0x6de5('0x14')]['message']);return _0x2150f6(_0x4f6fbd[_0x6de5('0x14')][_0x6de5('0x16')]);}else{logger[_0x6de5('0xf')](_0x6de5('0x10'),_0x16bdc9,_0x6de5('0x12'));_0x2150f6(_0x4f6fbd['result'][_0x6de5('0x16')]);}})[_0x6de5('0x17')](function(_0x1b94e0){logger['error'](_0x6de5('0x10'),_0x16bdc9,_0x1b94e0);_0x4d934a(_0x1b94e0);});});}exports['GetVoiceQueueReport']=function(_0x2b8591){var _0xcb0fcc=this;return new Promise(function(_0x5cb3c1,_0x24647e){return db[_0x6de5('0x18')]['findAll']({'raw':_0x2b8591[_0x6de5('0x19')]?_0x2b8591[_0x6de5('0x19')][_0x6de5('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b8591[_0x6de5('0x19')]?_0x2b8591[_0x6de5('0x19')]['where']||null:null,'attributes':_0x2b8591[_0x6de5('0x19')]?_0x2b8591[_0x6de5('0x19')][_0x6de5('0x1b')]||null:null,'limit':_0x2b8591[_0x6de5('0x19')]?_0x2b8591[_0x6de5('0x19')][_0x6de5('0x1c')]||null:null,'include':_0x2b8591[_0x6de5('0x19')]?_0x2b8591['options']['include']?_['map'](_0x2b8591[_0x6de5('0x19')][_0x6de5('0x1d')],function(_0x180d06){return{'model':db[_0x180d06[_0x6de5('0x1e')]],'as':_0x180d06['as'],'attributes':_0x180d06[_0x6de5('0x1b')],'include':_0x180d06[_0x6de5('0x1d')]?_[_0x6de5('0x1f')](_0x180d06[_0x6de5('0x1d')],function(_0x42d8b2){return{'model':db[_0x42d8b2[_0x6de5('0x1e')]],'as':_0x42d8b2['as'],'attributes':_0x42d8b2['attributes'],'include':_0x42d8b2[_0x6de5('0x1d')]?_[_0x6de5('0x1f')](_0x42d8b2['include'],function(_0xdabc9){return{'model':db[_0xdabc9[_0x6de5('0x1e')]],'as':_0xdabc9['as'],'attributes':_0xdabc9['attributes']};}):[]};}):[]};}):[]:[]})[_0x6de5('0xe')](function(_0x489573){logger[_0x6de5('0xf')](_0x6de5('0x20'),_0x2b8591);logger[_0x6de5('0x21')](_0x6de5('0x20'),_0x2b8591,JSON['stringify'](_0x489573));_0x5cb3c1(_0x489573);})[_0x6de5('0x17')](function(_0x4cfb62){logger[_0x6de5('0x14')]('GetVoiceQueueReport',_0x4cfb62[_0x6de5('0x16')],_0x2b8591);_0x24647e(_0xcb0fcc['error'](0x1f4,_0x4cfb62[_0x6de5('0x16')]));});});};exports[_0x6de5('0x22')]=function(_0x367258){var _0xfdf85b=this;return new Promise(function(_0x269f7d,_0x11422c){return db[_0x6de5('0x18')][_0x6de5('0x23')](_0x367258[_0x6de5('0x24')],{'raw':_0x367258[_0x6de5('0x19')]?_0x367258[_0x6de5('0x19')][_0x6de5('0x1a')]===undefined?!![]:![]:!![]})[_0x6de5('0xe')](function(_0xc2fdfa){logger[_0x6de5('0xf')]('CreateVoiceQueueReport',_0x367258);logger[_0x6de5('0x21')](_0x6de5('0x22'),_0x367258,JSON[_0x6de5('0x13')](_0xc2fdfa));_0x269f7d(_0xc2fdfa);})[_0x6de5('0x17')](function(_0x5ca5dd){logger[_0x6de5('0x14')](_0x6de5('0x22'),_0x5ca5dd[_0x6de5('0x16')],_0x367258);_0x11422c(_0xfdf85b[_0x6de5('0x14')](0x1f4,_0x5ca5dd[_0x6de5('0x16')]));});});};exports[_0x6de5('0x25')]=function(_0x2559cc){var _0xd8eaed=this;return new Promise(function(_0x5c3cae,_0x3840f0){return db[_0x6de5('0x18')][_0x6de5('0x26')](_0x2559cc[_0x6de5('0x24')],{'raw':_0x2559cc[_0x6de5('0x19')]?_0x2559cc[_0x6de5('0x19')][_0x6de5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2559cc[_0x6de5('0x19')]?_0x2559cc[_0x6de5('0x19')][_0x6de5('0x27')]||null:null,'attributes':_0x2559cc[_0x6de5('0x19')]?_0x2559cc[_0x6de5('0x19')][_0x6de5('0x1b')]||null:null,'limit':_0x2559cc[_0x6de5('0x19')]?_0x2559cc[_0x6de5('0x19')]['limit']||null:null})[_0x6de5('0xe')](function(_0x3d1cc0){logger[_0x6de5('0xf')](_0x6de5('0x25'),_0x2559cc);logger[_0x6de5('0x21')](_0x6de5('0x25'),_0x2559cc,JSON[_0x6de5('0x13')](_0x3d1cc0));_0x5c3cae(_0x3d1cc0);})[_0x6de5('0x17')](function(_0x11c058){logger[_0x6de5('0x14')](_0x6de5('0x25'),_0x11c058[_0x6de5('0x16')],_0x2559cc);_0x3840f0(_0xd8eaed['error'](0x1f4,_0x11c058[_0x6de5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 8352c62..2a0bd4d 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 _0x6797=['emit','removeListener','register','length','./voiceQueueReport.events','save','remove','update'];(function(_0x1e24f8,_0x52070f){var _0x5c4446=function(_0x40bf51){while(--_0x40bf51){_0x1e24f8['push'](_0x1e24f8['shift']());}};_0x5c4446(++_0x52070f);}(_0x6797,0x94));var _0x7679=function(_0x268409,_0x4e20cf){_0x268409=_0x268409-0x0;var _0x4ac01b=_0x6797[_0x268409];return _0x4ac01b;};'use strict';var VoiceQueueReportEvents=require(_0x7679('0x0'));var events=[_0x7679('0x1'),_0x7679('0x2'),_0x7679('0x3')];function createListener(_0x1f0334,_0x376d30){return function(_0x2a9c70){_0x376d30[_0x7679('0x4')](_0x1f0334,_0x2a9c70);};}function removeListener(_0x216d92,_0x494458){return function(){VoiceQueueReportEvents[_0x7679('0x5')](_0x216d92,_0x494458);};}exports[_0x7679('0x6')]=function(_0x57b2f9){for(var _0x415e7a=0x0,_0x5326a8=events[_0x7679('0x7')];_0x415e7a<_0x5326a8;_0x415e7a++){var _0xa34325=events[_0x415e7a];var _0x423561=createListener('voiceQueueReport:'+_0xa34325,_0x57b2f9);VoiceQueueReportEvents['on'](_0xa34325,_0x423561);}}; \ No newline at end of file +var _0xa1a5=['register','voiceQueueReport:','./voiceQueueReport.events','remove','update','removeListener'];(function(_0x387bc3,_0x282b81){var _0x5ea6b7=function(_0x273f06){while(--_0x273f06){_0x387bc3['push'](_0x387bc3['shift']());}};_0x5ea6b7(++_0x282b81);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0x5094e9,_0xdc3b68){_0x5094e9=_0x5094e9-0x0;var _0x4cd3ed=_0xa1a5[_0x5094e9];return _0x4cd3ed;};'use strict';var VoiceQueueReportEvents=require(_0x5a1a('0x0'));var events=['save',_0x5a1a('0x1'),_0x5a1a('0x2')];function createListener(_0x1d0a04,_0x13223e){return function(_0x1eac2b){_0x13223e['emit'](_0x1d0a04,_0x1eac2b);};}function removeListener(_0x3d3652,_0x12138d){return function(){VoiceQueueReportEvents[_0x5a1a('0x3')](_0x3d3652,_0x12138d);};}exports[_0x5a1a('0x4')]=function(_0x1b718f){for(var _0x27f71f=0x0,_0x1062b9=events['length'];_0x27f71f<_0x1062b9;_0x27f71f++){var _0x1ec37f=events[_0x27f71f];var _0x313212=createListener(_0x5a1a('0x5')+_0x1ec37f,_0x1b718f);VoiceQueueReportEvents['on'](_0x1ec37f,_0x313212);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 098ad6a..ee43d32 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 _0x4156=['create','put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post'];(function(_0x3c96f5,_0xd07b7d){var _0x2ec0ad=function(_0x521391){while(--_0x521391){_0x3c96f5['push'](_0x3c96f5['shift']());}};_0x2ec0ad(++_0xd07b7d);}(_0x4156,0x1eb));var _0x6415=function(_0x590955,_0x26a268){_0x590955=_0x590955-0x0;var _0x22fbed=_0x4156[_0x590955];return _0x22fbed;};'use strict';var multer=require(_0x6415('0x0'));var util=require('util');var path=require(_0x6415('0x1'));var timeout=require('connect-timeout');var express=require(_0x6415('0x2'));var router=express[_0x6415('0x3')]();var fs_extra=require(_0x6415('0x4'));var auth=require(_0x6415('0x5'));var interaction=require(_0x6415('0x6'));var config=require(_0x6415('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x6415('0x8')]('/',auth[_0x6415('0x9')](),controller[_0x6415('0xa')]);router[_0x6415('0x8')](_0x6415('0xb'),auth[_0x6415('0x9')](),controller['show']);router[_0x6415('0xc')]('/',auth['isAuthenticated'](),controller[_0x6415('0xd')]);router[_0x6415('0xe')](_0x6415('0xb'),auth['isAuthenticated'](),controller[_0x6415('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6415('0x10')]);module[_0x6415('0x11')]=router; \ No newline at end of file +var _0x255f=['isAuthenticated','show','post','create','put','delete','/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x18eeb1,_0x2b8714){var _0x4c1aca=function(_0x303118){while(--_0x303118){_0x18eeb1['push'](_0x18eeb1['shift']());}};_0x4c1aca(++_0x2b8714);}(_0x255f,0x185));var _0xf255=function(_0x11151c,_0x2b976b){_0x11151c=_0x11151c-0x0;var _0x1e00ef=_0x255f[_0x11151c];return _0x1e00ef;};'use strict';var multer=require(_0xf255('0x0'));var util=require('util');var path=require(_0xf255('0x1'));var timeout=require(_0xf255('0x2'));var express=require(_0xf255('0x3'));var router=express['Router']();var fs_extra=require(_0xf255('0x4'));var auth=require(_0xf255('0x5'));var interaction=require(_0xf255('0x6'));var config=require(_0xf255('0x7'));var controller=require(_0xf255('0x8'));router[_0xf255('0x9')]('/',auth[_0xf255('0xa')](),controller['index']);router[_0xf255('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf255('0xb')]);router[_0xf255('0xc')]('/',auth['isAuthenticated'](),controller[_0xf255('0xd')]);router[_0xf255('0xe')]('/:id',auth[_0xf255('0xa')](),controller['update']);router[_0xf255('0xf')](_0xf255('0x10'),auth[_0xf255('0xa')](),controller[_0xf255('0x11')]);module[_0xf255('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 9f12bab..f64de80 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 _0x9256=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0x9256,0x128));var _0x6925=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9256[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6925('0x0'));var moment=require(_0x6925('0x1'));module[_0x6925('0x2')]={'time':{'type':Sequelize[_0x6925('0x3')]},'callid':{'type':Sequelize[_0x6925('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6925('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6925('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6925('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x6925('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x6925('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6925('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6925('0x4')],'allowNull':![],'defaultValue':moment()[_0x6925('0x5')](_0x6925('0x6'))}}; \ No newline at end of file +var _0x82c0=['DATE','format','sequelize','exports','STRING'];(function(_0x205ad6,_0x363914){var _0x5edda5=function(_0x387977){while(--_0x387977){_0x205ad6['push'](_0x205ad6['shift']());}};_0x5edda5(++_0x363914);}(_0x82c0,0xa2));var _0x082c=function(_0x421931,_0x1f2e32){_0x421931=_0x421931-0x0;var _0x2e9e31=_0x82c0[_0x421931];return _0x2e9e31;};'use strict';var Sequelize=require(_0x082c('0x0'));var moment=require('moment');module[_0x082c('0x1')]={'time':{'type':Sequelize[_0x082c('0x2')]},'callid':{'type':Sequelize[_0x082c('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x082c('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x082c('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x082c('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x082c('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x082c('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x082c('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x082c('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x082c('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x082c('0x3')],'allowNull':![],'defaultValue':moment()[_0x082c('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 8f55b66..62d9d87 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 _0xb44d=['fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','filter','options','includeAll','findAll','catch','show','params','include','find','create','body','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes'];(function(_0x35d822,_0xf2b0c0){var _0x18b48c=function(_0xd85391){while(--_0xd85391){_0x35d822['push'](_0x35d822['shift']());}};_0x18b48c(++_0xf2b0c0);}(_0xb44d,0x144));var _0xdb44=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb44d[_0x502c7d];return _0x30b7ed;};'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(_0xdb44('0x0'));var moment=require(_0xdb44('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdb44('0x2'));var path=require(_0xdb44('0x3'));var sox=require(_0xdb44('0x4'));var csv=require('to-csv');var ejs=require(_0xdb44('0x5'));var fs=require('fs');var fs_extra=require(_0xdb44('0x6'));var _=require(_0xdb44('0x7'));var squel=require(_0xdb44('0x8'));var crypto=require(_0xdb44('0x9'));var jsforce=require(_0xdb44('0xa'));var deskjs=require(_0xdb44('0xb'));var toCsv=require(_0xdb44('0xc'));var querystring=require(_0xdb44('0xd'));var Papa=require('papaparse');var Redis=require(_0xdb44('0xe'));var authService=require(_0xdb44('0xf'));var qs=require(_0xdb44('0x10'));var as=require(_0xdb44('0x11'));var hardwareService=require(_0xdb44('0x12'));var logger=require(_0xdb44('0x13'))(_0xdb44('0x14'));var utils=require('../../config/utils');var config=require(_0xdb44('0x15'));var licenseUtil=require(_0xdb44('0x16'));var db=require(_0xdb44('0x17'))['db'];function respondWithStatusCode(_0x3925f0,_0x34a872){_0x34a872=_0x34a872||0xcc;return function(_0x3a35a7){if(_0x3a35a7){return _0x3925f0[_0xdb44('0x18')](_0x34a872);}return _0x3925f0[_0xdb44('0x19')](_0x34a872)['end']();};}function respondWithResult(_0x3f46b5,_0x5a6dd2){_0x5a6dd2=_0x5a6dd2||0xc8;return function(_0x229ca7){if(_0x229ca7){return _0x3f46b5[_0xdb44('0x19')](_0x5a6dd2)[_0xdb44('0x1a')](_0x229ca7);}};}function respondWithFilteredResult(_0x198ec3,_0x204f2a){return function(_0x5bdb24){if(_0x5bdb24){var _0x431232=typeof _0x204f2a[_0xdb44('0x1b')]===_0xdb44('0x1c')&&typeof _0x204f2a['limit']===_0xdb44('0x1c');var _0x4bb54f=_0x5bdb24[_0xdb44('0x1d')];var _0x4c19e2=_0x431232?0x0:_0x204f2a[_0xdb44('0x1b')];var _0x28ff5e=_0x431232?_0x5bdb24[_0xdb44('0x1d')]:_0x204f2a[_0xdb44('0x1b')]+_0x204f2a[_0xdb44('0x1e')];var _0x248758;if(_0x28ff5e>=_0x4bb54f){_0x28ff5e=_0x4bb54f;_0x248758=0xc8;}else{_0x248758=0xce;}_0x198ec3[_0xdb44('0x19')](_0x248758);return _0x198ec3[_0xdb44('0x1f')](_0xdb44('0x20'),_0x4c19e2+'-'+_0x28ff5e+'/'+_0x4bb54f)[_0xdb44('0x1a')](_0x5bdb24);}return null;};}function patchUpdates(_0x1bbca7){return function(_0x2bb745){try{jsonpatch[_0xdb44('0x21')](_0x2bb745,_0x1bbca7,!![]);}catch(_0x341a7a){return BPromise['reject'](_0x341a7a);}return _0x2bb745[_0xdb44('0x22')]();};}function saveUpdates(_0x417507,_0x3e81e9){return function(_0xd13dc){if(_0xd13dc){return _0xd13dc[_0xdb44('0x23')](_0x417507)['then'](function(_0x3ebf26){return _0x3ebf26;});}return null;};}function removeEntity(_0x97fc4c,_0x5760b5){return function(_0x109b93){if(_0x109b93){return _0x109b93[_0xdb44('0x24')]()[_0xdb44('0x25')](function(){_0x97fc4c[_0xdb44('0x19')](0xcc)[_0xdb44('0x26')]();});}};}function handleEntityNotFound(_0x2c3960,_0x3ddbef){return function(_0x392e04){if(!_0x392e04){_0x2c3960[_0xdb44('0x18')](0x194);}return _0x392e04;};}function handleError(_0x57465f,_0xb0eabb){_0xb0eabb=_0xb0eabb||0x1f4;return function(_0x19da1b){logger[_0xdb44('0x27')](_0x19da1b['stack']);if(_0x19da1b[_0xdb44('0x28')]){delete _0x19da1b[_0xdb44('0x28')];}_0x57465f[_0xdb44('0x19')](_0xb0eabb)[_0xdb44('0x29')](_0x19da1b);};}exports[_0xdb44('0x2a')]=function(_0x2f2db4,_0x3856f5){var _0x1e09a1={},_0x2a16d5={},_0x19845e={'count':0x0,'rows':[]};var _0xcd4e9d=_[_0xdb44('0x2b')](db[_0xdb44('0x2c')][_0xdb44('0x2d')],function(_0x34baa4){return{'name':_0x34baa4[_0xdb44('0x2e')],'type':_0x34baa4[_0xdb44('0x2f')][_0xdb44('0x30')]};});_0x2a16d5[_0xdb44('0x31')]=_[_0xdb44('0x2b')](_0xcd4e9d,_0xdb44('0x28'));_0x2a16d5[_0xdb44('0x32')]=_[_0xdb44('0x33')](_0x2f2db4[_0xdb44('0x32')]);_0x2a16d5['filters']=_[_0xdb44('0x34')](_0x2a16d5[_0xdb44('0x31')],_0x2a16d5[_0xdb44('0x32')]);_0x1e09a1[_0xdb44('0x35')]=_['intersection'](_0x2a16d5[_0xdb44('0x31')],qs[_0xdb44('0x36')](_0x2f2db4[_0xdb44('0x32')]['fields']));_0x1e09a1[_0xdb44('0x35')]=_0x1e09a1['attributes'][_0xdb44('0x37')]?_0x1e09a1[_0xdb44('0x35')]:_0x2a16d5[_0xdb44('0x31')];if(!_0x2f2db4[_0xdb44('0x32')][_0xdb44('0x38')]('nolimit')){_0x1e09a1[_0xdb44('0x1e')]=qs[_0xdb44('0x1e')](_0x2f2db4[_0xdb44('0x32')][_0xdb44('0x1e')]);_0x1e09a1[_0xdb44('0x1b')]=qs[_0xdb44('0x1b')](_0x2f2db4[_0xdb44('0x32')]['offset']);}_0x1e09a1[_0xdb44('0x39')]=qs[_0xdb44('0x3a')](_0x2f2db4['query'][_0xdb44('0x3a')]);_0x1e09a1['where']=qs[_0xdb44('0x3b')](_[_0xdb44('0x3c')](_0x2f2db4[_0xdb44('0x32')],_0x2a16d5[_0xdb44('0x3b')]),_0xcd4e9d);if(_0x2f2db4[_0xdb44('0x32')]['filter']){_0x1e09a1[_0xdb44('0x3d')]=_[_0xdb44('0x3e')](_0x1e09a1[_0xdb44('0x3d')],{'$or':_[_0xdb44('0x2b')](_0xcd4e9d,function(_0x2d3600){if(_0x2d3600[_0xdb44('0x2f')]!=='VIRTUAL'){var _0x232419={};_0x232419[_0x2d3600['name']]={'$like':'%'+_0x2f2db4['query'][_0xdb44('0x3f')]+'%'};return _0x232419;}})});}_0x1e09a1=_[_0xdb44('0x3e')]({},_0x1e09a1,_0x2f2db4[_0xdb44('0x40')]);var _0xaa7448={'where':_0x1e09a1[_0xdb44('0x3d')]};return db['VoiceQueuesLog'][_0xdb44('0x1d')](_0xaa7448)[_0xdb44('0x25')](function(_0x2c9842){_0x19845e['count']=_0x2c9842;if(_0x2f2db4[_0xdb44('0x32')][_0xdb44('0x41')]){_0x1e09a1['include']=[{'all':!![]}];}return db[_0xdb44('0x2c')][_0xdb44('0x42')](_0x1e09a1);})[_0xdb44('0x25')](function(_0x406091){_0x19845e['rows']=_0x406091;return _0x19845e;})[_0xdb44('0x25')](respondWithFilteredResult(_0x3856f5,_0x1e09a1))[_0xdb44('0x43')](handleError(_0x3856f5,null));};exports[_0xdb44('0x44')]=function(_0x56b12f,_0x434ab8){var _0x411dcd={'raw':!![],'where':{'id':_0x56b12f[_0xdb44('0x45')]['id']}},_0x504801={};_0x504801[_0xdb44('0x31')]=_[_0xdb44('0x33')](db[_0xdb44('0x2c')][_0xdb44('0x2d')]);_0x504801[_0xdb44('0x32')]=_[_0xdb44('0x33')](_0x56b12f['query']);_0x504801['filters']=_[_0xdb44('0x34')](_0x504801[_0xdb44('0x31')],_0x504801[_0xdb44('0x32')]);_0x411dcd['attributes']=_[_0xdb44('0x34')](_0x504801['model'],qs[_0xdb44('0x36')](_0x56b12f['query']['fields']));_0x411dcd[_0xdb44('0x35')]=_0x411dcd[_0xdb44('0x35')][_0xdb44('0x37')]?_0x411dcd[_0xdb44('0x35')]:_0x504801[_0xdb44('0x31')];if(_0x56b12f[_0xdb44('0x32')]['includeAll']){_0x411dcd[_0xdb44('0x46')]=[{'all':!![]}];}_0x411dcd=_[_0xdb44('0x3e')]({},_0x411dcd,_0x56b12f[_0xdb44('0x40')]);return db['VoiceQueuesLog'][_0xdb44('0x47')](_0x411dcd)[_0xdb44('0x25')](handleEntityNotFound(_0x434ab8,null))[_0xdb44('0x25')](respondWithResult(_0x434ab8,null))[_0xdb44('0x43')](handleError(_0x434ab8,null));};exports[_0xdb44('0x48')]=function(_0x1b0ab9,_0x166219){return db[_0xdb44('0x2c')][_0xdb44('0x48')](_0x1b0ab9[_0xdb44('0x49')],{})[_0xdb44('0x25')](respondWithResult(_0x166219,0xc9))[_0xdb44('0x43')](handleError(_0x166219,null));};exports[_0xdb44('0x23')]=function(_0x16fb40,_0x323e56){if(_0x16fb40['body']['id']){delete _0x16fb40[_0xdb44('0x49')]['id'];}return db[_0xdb44('0x2c')][_0xdb44('0x47')]({'where':{'id':_0x16fb40['params']['id']}})['then'](handleEntityNotFound(_0x323e56,null))[_0xdb44('0x25')](saveUpdates(_0x16fb40[_0xdb44('0x49')],null))['then'](respondWithResult(_0x323e56,null))[_0xdb44('0x43')](handleError(_0x323e56,null));};exports['destroy']=function(_0x5e2403,_0x137305){return db[_0xdb44('0x2c')]['find']({'where':{'id':_0x5e2403[_0xdb44('0x45')]['id']}})[_0xdb44('0x25')](handleEntityNotFound(_0x137305,null))[_0xdb44('0x25')](removeEntity(_0x137305,null))[_0xdb44('0x43')](handleError(_0x137305,null));}; \ No newline at end of file +var _0x742f=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','name','index','map','VoiceQueuesLog','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x24a7f7,_0x11b707){var _0x4bce52=function(_0x86728){while(--_0x86728){_0x24a7f7['push'](_0x24a7f7['shift']());}};_0x4bce52(++_0x11b707);}(_0x742f,0xc7));var _0xf742=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x742f[_0x4a3898];return _0x25ceb0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf742('0x0'));var zipdir=require(_0xf742('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf742('0x2'));var moment=require(_0xf742('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf742('0x4'));var util=require(_0xf742('0x5'));var path=require(_0xf742('0x6'));var sox=require(_0xf742('0x7'));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(_0xf742('0x8'));var crypto=require(_0xf742('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf742('0xa'));var querystring=require(_0xf742('0xb'));var Papa=require(_0xf742('0xc'));var Redis=require(_0xf742('0xd'));var authService=require(_0xf742('0xe'));var qs=require(_0xf742('0xf'));var as=require(_0xf742('0x10'));var hardwareService=require(_0xf742('0x11'));var logger=require('../../config/logger')(_0xf742('0x12'));var utils=require(_0xf742('0x13'));var config=require(_0xf742('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf742('0x15'))['db'];function respondWithStatusCode(_0x29af0f,_0x45ce87){_0x45ce87=_0x45ce87||0xcc;return function(_0x440d0d){if(_0x440d0d){return _0x29af0f[_0xf742('0x16')](_0x45ce87);}return _0x29af0f['status'](_0x45ce87)[_0xf742('0x17')]();};}function respondWithResult(_0x2b754b,_0xb8c872){_0xb8c872=_0xb8c872||0xc8;return function(_0x30d5c9){if(_0x30d5c9){return _0x2b754b[_0xf742('0x18')](_0xb8c872)['json'](_0x30d5c9);}};}function respondWithFilteredResult(_0x1b4fbf,_0x42549a){return function(_0x35f1ee){if(_0x35f1ee){var _0x30985c=typeof _0x42549a['offset']===_0xf742('0x19')&&typeof _0x42549a['limit']==='undefined';var _0x3201e1=_0x35f1ee['count'];var _0x2cabfe=_0x30985c?0x0:_0x42549a['offset'];var _0x2be19d=_0x30985c?_0x35f1ee[_0xf742('0x1a')]:_0x42549a[_0xf742('0x1b')]+_0x42549a[_0xf742('0x1c')];var _0x144234;if(_0x2be19d>=_0x3201e1){_0x2be19d=_0x3201e1;_0x144234=0xc8;}else{_0x144234=0xce;}_0x1b4fbf[_0xf742('0x18')](_0x144234);return _0x1b4fbf[_0xf742('0x1d')](_0xf742('0x1e'),_0x2cabfe+'-'+_0x2be19d+'/'+_0x3201e1)[_0xf742('0x1f')](_0x35f1ee);}return null;};}function patchUpdates(_0x42d029){return function(_0x4429d7){try{jsonpatch[_0xf742('0x20')](_0x4429d7,_0x42d029,!![]);}catch(_0x29e2d9){return BPromise[_0xf742('0x21')](_0x29e2d9);}return _0x4429d7['save']();};}function saveUpdates(_0x598daa,_0x3f53d3){return function(_0x3f6b3a){if(_0x3f6b3a){return _0x3f6b3a[_0xf742('0x22')](_0x598daa)[_0xf742('0x23')](function(_0x12f649){return _0x12f649;});}return null;};}function removeEntity(_0x3b7c5a,_0x38764e){return function(_0x21a75d){if(_0x21a75d){return _0x21a75d[_0xf742('0x24')]()[_0xf742('0x23')](function(){_0x3b7c5a[_0xf742('0x18')](0xcc)[_0xf742('0x17')]();});}};}function handleEntityNotFound(_0x11f35a,_0x5b4c50){return function(_0x1361cf){if(!_0x1361cf){_0x11f35a[_0xf742('0x16')](0x194);}return _0x1361cf;};}function handleError(_0x208d68,_0x46da67){_0x46da67=_0x46da67||0x1f4;return function(_0x3cbb1a){logger[_0xf742('0x25')](_0x3cbb1a['stack']);if(_0x3cbb1a[_0xf742('0x26')]){delete _0x3cbb1a[_0xf742('0x26')];}_0x208d68[_0xf742('0x18')](_0x46da67)['send'](_0x3cbb1a);};}exports[_0xf742('0x27')]=function(_0x366be5,_0x1e84db){var _0x490a84={},_0x3f64a4={},_0x24de03={'count':0x0,'rows':[]};var _0x446b03=_[_0xf742('0x28')](db[_0xf742('0x29')][_0xf742('0x2a')],function(_0x387ce8){return{'name':_0x387ce8['fieldName'],'type':_0x387ce8[_0xf742('0x2b')][_0xf742('0x2c')]};});_0x3f64a4[_0xf742('0x2d')]=_[_0xf742('0x28')](_0x446b03,_0xf742('0x26'));_0x3f64a4[_0xf742('0x2e')]=_[_0xf742('0x2f')](_0x366be5[_0xf742('0x2e')]);_0x3f64a4['filters']=_[_0xf742('0x30')](_0x3f64a4[_0xf742('0x2d')],_0x3f64a4[_0xf742('0x2e')]);_0x490a84[_0xf742('0x31')]=_[_0xf742('0x30')](_0x3f64a4['model'],qs[_0xf742('0x32')](_0x366be5['query'][_0xf742('0x32')]));_0x490a84[_0xf742('0x31')]=_0x490a84['attributes'][_0xf742('0x33')]?_0x490a84[_0xf742('0x31')]:_0x3f64a4[_0xf742('0x2d')];if(!_0x366be5['query'][_0xf742('0x34')](_0xf742('0x35'))){_0x490a84[_0xf742('0x1c')]=qs[_0xf742('0x1c')](_0x366be5[_0xf742('0x2e')][_0xf742('0x1c')]);_0x490a84[_0xf742('0x1b')]=qs['offset'](_0x366be5['query'][_0xf742('0x1b')]);}_0x490a84[_0xf742('0x36')]=qs[_0xf742('0x37')](_0x366be5[_0xf742('0x2e')][_0xf742('0x37')]);_0x490a84[_0xf742('0x38')]=qs[_0xf742('0x39')](_['pick'](_0x366be5['query'],_0x3f64a4[_0xf742('0x39')]),_0x446b03);if(_0x366be5[_0xf742('0x2e')][_0xf742('0x3a')]){_0x490a84['where']=_[_0xf742('0x3b')](_0x490a84['where'],{'$or':_[_0xf742('0x28')](_0x446b03,function(_0x3e7eac){if(_0x3e7eac['type']!==_0xf742('0x3c')){var _0x19a03b={};_0x19a03b[_0x3e7eac['name']]={'$like':'%'+_0x366be5[_0xf742('0x2e')][_0xf742('0x3a')]+'%'};return _0x19a03b;}})});}_0x490a84=_['merge']({},_0x490a84,_0x366be5[_0xf742('0x3d')]);var _0x3ad5a4={'where':_0x490a84['where']};return db[_0xf742('0x29')][_0xf742('0x1a')](_0x3ad5a4)['then'](function(_0x59b908){_0x24de03[_0xf742('0x1a')]=_0x59b908;if(_0x366be5['query'][_0xf742('0x3e')]){_0x490a84['include']=[{'all':!![]}];}return db[_0xf742('0x29')][_0xf742('0x3f')](_0x490a84);})[_0xf742('0x23')](function(_0x106801){_0x24de03[_0xf742('0x40')]=_0x106801;return _0x24de03;})[_0xf742('0x23')](respondWithFilteredResult(_0x1e84db,_0x490a84))[_0xf742('0x41')](handleError(_0x1e84db,null));};exports[_0xf742('0x42')]=function(_0x1dc8c5,_0x4b03e0){var _0x3e1355={'raw':!![],'where':{'id':_0x1dc8c5[_0xf742('0x43')]['id']}},_0x4158a1={};_0x4158a1[_0xf742('0x2d')]=_[_0xf742('0x2f')](db[_0xf742('0x29')]['rawAttributes']);_0x4158a1[_0xf742('0x2e')]=_['keys'](_0x1dc8c5[_0xf742('0x2e')]);_0x4158a1[_0xf742('0x39')]=_['intersection'](_0x4158a1[_0xf742('0x2d')],_0x4158a1['query']);_0x3e1355[_0xf742('0x31')]=_['intersection'](_0x4158a1[_0xf742('0x2d')],qs[_0xf742('0x32')](_0x1dc8c5[_0xf742('0x2e')]['fields']));_0x3e1355['attributes']=_0x3e1355[_0xf742('0x31')]['length']?_0x3e1355[_0xf742('0x31')]:_0x4158a1['model'];if(_0x1dc8c5[_0xf742('0x2e')]['includeAll']){_0x3e1355[_0xf742('0x44')]=[{'all':!![]}];}_0x3e1355=_[_0xf742('0x3b')]({},_0x3e1355,_0x1dc8c5[_0xf742('0x3d')]);return db[_0xf742('0x29')]['find'](_0x3e1355)[_0xf742('0x23')](handleEntityNotFound(_0x4b03e0,null))[_0xf742('0x23')](respondWithResult(_0x4b03e0,null))[_0xf742('0x41')](handleError(_0x4b03e0,null));};exports[_0xf742('0x45')]=function(_0x442a39,_0xf0ad4d){return db[_0xf742('0x29')]['create'](_0x442a39['body'],{})['then'](respondWithResult(_0xf0ad4d,0xc9))[_0xf742('0x41')](handleError(_0xf0ad4d,null));};exports[_0xf742('0x22')]=function(_0xf4ba09,_0x4a7af7){if(_0xf4ba09[_0xf742('0x46')]['id']){delete _0xf4ba09[_0xf742('0x46')]['id'];}return db[_0xf742('0x29')][_0xf742('0x47')]({'where':{'id':_0xf4ba09['params']['id']}})[_0xf742('0x23')](handleEntityNotFound(_0x4a7af7,null))['then'](saveUpdates(_0xf4ba09[_0xf742('0x46')],null))[_0xf742('0x23')](respondWithResult(_0x4a7af7,null))[_0xf742('0x41')](handleError(_0x4a7af7,null));};exports['destroy']=function(_0x361881,_0x1762bd){return db[_0xf742('0x29')][_0xf742('0x47')]({'where':{'id':_0x361881[_0xf742('0x43')]['id']}})['then'](handleEntityNotFound(_0x1762bd,null))[_0xf742('0x23')](removeEntity(_0x1762bd,null))[_0xf742('0x41')](handleError(_0x1762bd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 85f6028..6e8beeb 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 _0x938c=['util','api','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event','dtm','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x938c,0x11f));var _0xc938=function(_0x4ba512,_0x4a5f1c){_0x4ba512=_0x4ba512-0x0;var _0x164839=_0x938c[_0x4ba512];return _0x164839;};'use strict';var _=require(_0xc938('0x0'));var util=require(_0xc938('0x1'));var logger=require('../../config/logger')(_0xc938('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc938('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc938('0x4'));var config=require(_0xc938('0x5'));var attributes=require(_0xc938('0x6'));module[_0xc938('0x7')]=function(_0x235110,_0x8cfbb6){return _0x235110['define'](_0xc938('0x8'),attributes,{'tableName':_0xc938('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xc938('0xa'),_0xc938('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xba0b=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm','api'];(function(_0x48d2f9,_0x2e4981){var _0x2d9527=function(_0xc37d7b){while(--_0xc37d7b){_0x48d2f9['push'](_0x48d2f9['shift']());}};_0x2d9527(++_0x2e4981);}(_0xba0b,0x110));var _0xbba0=function(_0x29ec4a,_0x221a2d){_0x29ec4a=_0x29ec4a-0x0;var _0x5f52af=_0xba0b[_0x29ec4a];return _0x5f52af;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbba0('0x0'));var moment=require(_0xbba0('0x1'));var BPromise=require(_0xbba0('0x2'));var rp=require(_0xbba0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbba0('0x4'));var config=require(_0xbba0('0x5'));var attributes=require(_0xbba0('0x6'));module[_0xbba0('0x7')]=function(_0x203830,_0x5bf3d2){return _0x203830[_0xbba0('0x8')](_0xbba0('0x9'),attributes,{'tableName':_0xbba0('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xbba0('0xb'),_0xbba0('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 9896228..4734a6d 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 _0x72d1=['error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x3784d2,_0x504607){var _0x2a1938=function(_0x5548f5){while(--_0x5548f5){_0x3784d2['push'](_0x3784d2['shift']());}};_0x2a1938(++_0x504607);}(_0x72d1,0x18b));var _0x172d=function(_0x20fdc1,_0xde1296){_0x20fdc1=_0x20fdc1-0x0;var _0x25397c=_0x72d1[_0x20fdc1];return _0x25397c;};'use strict';var _=require(_0x172d('0x0'));var util=require(_0x172d('0x1'));var moment=require('moment');var BPromise=require(_0x172d('0x2'));var rs=require(_0x172d('0x3'));var fs=require('fs');var Redis=require(_0x172d('0x4'));var db=require(_0x172d('0x5'))['db'];var utils=require(_0x172d('0x6'));var logger=require(_0x172d('0x7'))('rpc');var config=require(_0x172d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x172d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d95e1,_0x2c3d19,_0x4071b3){return new BPromise(function(_0x52a4f3,_0x1fed7a){return client[_0x172d('0xa')](_0x3d95e1,_0x4071b3)[_0x172d('0xb')](function(_0x1de73f){logger[_0x172d('0xc')](_0x172d('0xd'),_0x2c3d19,_0x172d('0xe'));logger[_0x172d('0xf')](_0x172d('0x10'),_0x2c3d19,'request\x20sent',JSON[_0x172d('0x11')](_0x1de73f));if(_0x1de73f['error']){if(_0x1de73f['error'][_0x172d('0x12')]===0x1f4){logger['error'](_0x172d('0xd'),_0x2c3d19,_0x1de73f[_0x172d('0x13')][_0x172d('0x14')]);return _0x1fed7a(_0x1de73f[_0x172d('0x13')][_0x172d('0x14')]);}logger[_0x172d('0x13')](_0x172d('0xd'),_0x2c3d19,_0x1de73f[_0x172d('0x13')]['message']);return _0x52a4f3(_0x1de73f[_0x172d('0x13')]['message']);}else{logger[_0x172d('0xc')](_0x172d('0xd'),_0x2c3d19,'request\x20sent');_0x52a4f3(_0x1de73f[_0x172d('0x15')]['message']);}})[_0x172d('0x16')](function(_0x81f26a){logger[_0x172d('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2c3d19,_0x81f26a);_0x1fed7a(_0x81f26a);});});} \ No newline at end of file +var _0x831c=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x831c,0x112));var _0xc831=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x831c[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0xc831('0x0'));var util=require(_0xc831('0x1'));var moment=require(_0xc831('0x2'));var BPromise=require(_0xc831('0x3'));var rs=require(_0xc831('0x4'));var fs=require('fs');var Redis=require(_0xc831('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc831('0x6'));var logger=require(_0xc831('0x7'))(_0xc831('0x8'));var config=require(_0xc831('0x9'));var jayson=require(_0xc831('0xa'));var client=jayson[_0xc831('0xb')][_0xc831('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x532e2d,_0x3de941,_0x40d95a){return new BPromise(function(_0xb88df3,_0x5740fa){return client[_0xc831('0xd')](_0x532e2d,_0x40d95a)[_0xc831('0xe')](function(_0x4f0eb4){logger['info'](_0xc831('0xf'),_0x3de941,_0xc831('0x10'));logger[_0xc831('0x11')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x3de941,'request\x20sent',JSON[_0xc831('0x12')](_0x4f0eb4));if(_0x4f0eb4[_0xc831('0x13')]){if(_0x4f0eb4[_0xc831('0x13')]['code']===0x1f4){logger[_0xc831('0x13')](_0xc831('0xf'),_0x3de941,_0x4f0eb4[_0xc831('0x13')][_0xc831('0x14')]);return _0x5740fa(_0x4f0eb4[_0xc831('0x13')][_0xc831('0x14')]);}logger[_0xc831('0x13')](_0xc831('0xf'),_0x3de941,_0x4f0eb4[_0xc831('0x13')][_0xc831('0x14')]);return _0xb88df3(_0x4f0eb4['error']['message']);}else{logger[_0xc831('0x15')](_0xc831('0xf'),_0x3de941,_0xc831('0x10'));_0xb88df3(_0x4f0eb4[_0xc831('0x16')]['message']);}})['catch'](function(_0x580883){logger[_0xc831('0x13')](_0xc831('0xf'),_0x3de941,_0x580883);_0x5740fa(_0x580883);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 8fe504c..89c39b8 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 _0xc41c=['/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0xc41c,0xdb));var _0xcc41=function(_0x14a83c,_0x394b54){_0x14a83c=_0x14a83c-0x0;var _0x345d56=_0xc41c[_0x14a83c];return _0x345d56;};'use strict';var multer=require('multer');var util=require(_0xcc41('0x0'));var path=require(_0xcc41('0x1'));var timeout=require(_0xcc41('0x2'));var express=require(_0xcc41('0x3'));var router=express[_0xcc41('0x4')]();var fs_extra=require(_0xcc41('0x5'));var auth=require(_0xcc41('0x6'));var interaction=require(_0xcc41('0x7'));var config=require('../../config/environment');var controller=require(_0xcc41('0x8'));router[_0xcc41('0x9')]('/',auth[_0xcc41('0xa')](),controller[_0xcc41('0xb')]);router[_0xcc41('0x9')](_0xcc41('0xc'),auth['isAuthenticated'](),controller[_0xcc41('0xd')]);router['get'](_0xcc41('0xe'),auth[_0xcc41('0xa')](),controller['show']);router[_0xcc41('0x9')](_0xcc41('0xf'),auth['isAuthenticated'](),controller[_0xcc41('0x10')]);router[_0xcc41('0x9')](_0xcc41('0x11'),controller[_0xcc41('0x12')]);router[_0xcc41('0x9')](_0xcc41('0x13'),auth[_0xcc41('0xa')](),controller[_0xcc41('0x14')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xcc41('0x15')](_0xcc41('0x13'),auth[_0xcc41('0xa')](),controller[_0xcc41('0x16')]);router['put'](_0xcc41('0xe'),auth[_0xcc41('0xa')](),controller[_0xcc41('0x17')]);router[_0xcc41('0x18')]('/:id',auth[_0xcc41('0xa')](),controller[_0xcc41('0x19')]);module['exports']=router; \ No newline at end of file +var _0x07f4=['describe','show','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','/describe'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x07f4,0x153));var _0x407f=function(_0x1aaf0f,_0x3f5d31){_0x1aaf0f=_0x1aaf0f-0x0;var _0x14e16a=_0x07f4[_0x1aaf0f];return _0x14e16a;};'use strict';var multer=require(_0x407f('0x0'));var util=require(_0x407f('0x1'));var path=require(_0x407f('0x2'));var timeout=require('connect-timeout');var express=require(_0x407f('0x3'));var router=express[_0x407f('0x4')]();var fs_extra=require(_0x407f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x407f('0x6'));var config=require('../../config/environment');var controller=require(_0x407f('0x7'));router[_0x407f('0x8')]('/',auth[_0x407f('0x9')](),controller['index']);router[_0x407f('0x8')](_0x407f('0xa'),auth['isAuthenticated'](),controller[_0x407f('0xb')]);router['get']('/:id',auth[_0x407f('0x9')](),controller[_0x407f('0xc')]);router[_0x407f('0x8')](_0x407f('0xd'),auth['isAuthenticated'](),controller[_0x407f('0xe')]);router[_0x407f('0x8')]('/:id/downloads',controller[_0x407f('0xf')]);router[_0x407f('0x8')](_0x407f('0x10'),auth[_0x407f('0x9')](),controller[_0x407f('0x11')]);router[_0x407f('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x407f('0x10'),auth[_0x407f('0x9')](),controller[_0x407f('0x13')]);router[_0x407f('0x14')](_0x407f('0x15'),auth[_0x407f('0x9')](),controller[_0x407f('0x16')]);router[_0x407f('0x17')]('/:id',auth[_0x407f('0x9')](),controller[_0x407f('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index ab63e58..5c726b0 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(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 12cdc33..09cdb65 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 _0x93f4=['[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','findOne','Setting','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','differenceBy','format','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','download','../../components/encryptor','type','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','sequelize','MD5','$and','push','recording','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request'];(function(_0x40c986,_0x2700c8){var _0x3b4231=function(_0x20f373){while(--_0x20f373){_0x40c986['push'](_0x40c986['shift']());}};_0x3b4231(++_0x2700c8);}(_0x93f4,0xbf));var _0x493f=function(_0x119de2,_0x4ca9ad){_0x119de2=_0x119de2-0x0;var _0x32db9b=_0x93f4[_0x119de2];return _0x32db9b;};'use strict';var emlformat=require(_0x493f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x493f('0x1'));var jsonpatch=require(_0x493f('0x2'));var rp=require('request-promise');var moment=require(_0x493f('0x3'));var BPromise=require(_0x493f('0x4'));var Mustache=require(_0x493f('0x5'));var util=require(_0x493f('0x6'));var path=require(_0x493f('0x7'));var sox=require(_0x493f('0x8'));var csv=require('to-csv');var ejs=require(_0x493f('0x9'));var fs=require('fs');var fs_extra=require(_0x493f('0xa'));var _=require(_0x493f('0xb'));var squel=require(_0x493f('0xc'));var crypto=require(_0x493f('0xd'));var jsforce=require(_0x493f('0xe'));var deskjs=require(_0x493f('0xf'));var toCsv=require(_0x493f('0x10'));var querystring=require(_0x493f('0x11'));var Papa=require(_0x493f('0x12'));var AWS=require(_0x493f('0x13'));var uuidv4=require(_0x493f('0x14'));var Redis=require(_0x493f('0x15'));var authService=require(_0x493f('0x16'));var qs=require(_0x493f('0x17'));var as=require(_0x493f('0x18'));var hardwareService=require(_0x493f('0x19'));var logger=require(_0x493f('0x1a'))(_0x493f('0x1b'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x493f('0x1c'));var db=require(_0x493f('0x1d'))['db'];function respondWithStatusCode(_0x28e696,_0x953956){_0x953956=_0x953956||0xcc;return function(_0x3197fd){if(_0x3197fd){return _0x28e696[_0x493f('0x1e')](_0x953956);}return _0x28e696[_0x493f('0x1f')](_0x953956)[_0x493f('0x20')]();};}function respondWithResult(_0x4edc39,_0x12473a){_0x12473a=_0x12473a||0xc8;return function(_0x52204a){if(_0x52204a){return _0x4edc39[_0x493f('0x1f')](_0x12473a)['json'](_0x52204a);}};}function respondWithFilteredResult(_0xac0765,_0xd9423c){return function(_0x5d47f1){if(_0x5d47f1){var _0x38c79c=typeof _0xd9423c[_0x493f('0x21')]===_0x493f('0x22')&&typeof _0xd9423c[_0x493f('0x23')]===_0x493f('0x22');var _0x51c7f3=_0x5d47f1[_0x493f('0x24')];var _0x34841f=_0x38c79c?0x0:_0xd9423c[_0x493f('0x21')];var _0x3336e0=_0x38c79c?_0x5d47f1[_0x493f('0x24')]:_0xd9423c[_0x493f('0x21')]+_0xd9423c[_0x493f('0x23')];var _0x565082;if(_0x3336e0>=_0x51c7f3){_0x3336e0=_0x51c7f3;_0x565082=0xc8;}else{_0x565082=0xce;}_0xac0765[_0x493f('0x1f')](_0x565082);return _0xac0765[_0x493f('0x25')](_0x493f('0x26'),_0x34841f+'-'+_0x3336e0+'/'+_0x51c7f3)[_0x493f('0x27')](_0x5d47f1);}return null;};}function patchUpdates(_0x51d94e){return function(_0x5e2a73){try{jsonpatch[_0x493f('0x28')](_0x5e2a73,_0x51d94e,!![]);}catch(_0x25ee9d){return BPromise[_0x493f('0x29')](_0x25ee9d);}return _0x5e2a73[_0x493f('0x2a')]();};}function saveUpdates(_0x5b80a6,_0x56e2f6){return function(_0x20016f){if(_0x20016f){return _0x20016f[_0x493f('0x2b')](_0x5b80a6)[_0x493f('0x2c')](function(_0x13d2ee){return _0x13d2ee;});}return null;};}function removeEntity(_0x459f70,_0x2ebd2e){return function(_0x567ed1){if(_0x567ed1){return _0x567ed1[_0x493f('0x2d')]()[_0x493f('0x2c')](function(){_0x459f70[_0x493f('0x1f')](0xcc)[_0x493f('0x20')]();});}};}function handleEntityNotFound(_0x5abaa3,_0x5b32cc){return function(_0x1cbad3){if(!_0x1cbad3){_0x5abaa3[_0x493f('0x1e')](0x194);}return _0x1cbad3;};}function handleError(_0x4909c1,_0x4662d1){_0x4662d1=_0x4662d1||0x1f4;return function(_0x277594){logger[_0x493f('0x2e')](_0x277594[_0x493f('0x2f')]);if(_0x277594['name']){delete _0x277594[_0x493f('0x30')];}_0x4909c1[_0x493f('0x1f')](_0x4662d1)[_0x493f('0x31')](_0x277594);};}exports[_0x493f('0x32')]=function(_0xa403f5,_0x8882a7){var _0x477290={},_0x2b58f0={},_0x3d488b={'count':0x0,'rows':[]};var _0x40f77f=_[_0x493f('0x33')](db[_0x493f('0x34')][_0x493f('0x35')],function(_0x243009){return{'name':_0x243009[_0x493f('0x36')],'type':_0x243009['type'][_0x493f('0x37')]};});_0x2b58f0['model']=_[_0x493f('0x38')](_[_0x493f('0x33')](_0x40f77f,_0x493f('0x30')),[_0x493f('0x39')]);_0x2b58f0['query']=_['keys'](_0xa403f5['query']);_0x2b58f0[_0x493f('0x3a')]=_[_0x493f('0x3b')](_0x2b58f0[_0x493f('0x3c')],_0x2b58f0[_0x493f('0x3d')]);_0x477290['attributes']=_[_0x493f('0x3b')](_0x2b58f0[_0x493f('0x3c')],qs['fields'](_0xa403f5[_0x493f('0x3d')][_0x493f('0x3e')]));_0x477290[_0x493f('0x3f')]=_0x477290[_0x493f('0x3f')][_0x493f('0x40')]?_0x477290[_0x493f('0x3f')]:_0x2b58f0[_0x493f('0x3c')];if(!_0xa403f5['query'][_0x493f('0x41')](_0x493f('0x42'))){_0x477290['limit']=qs[_0x493f('0x23')](_0xa403f5['query'][_0x493f('0x23')]);_0x477290[_0x493f('0x21')]=qs[_0x493f('0x21')](_0xa403f5[_0x493f('0x3d')][_0x493f('0x21')]);}_0x477290[_0x493f('0x43')]=qs[_0x493f('0x44')](_0xa403f5[_0x493f('0x3d')][_0x493f('0x44')]);_0x477290['where']=qs[_0x493f('0x3a')](_[_0x493f('0x45')](_0xa403f5[_0x493f('0x3d')],_0x2b58f0[_0x493f('0x3a')]),_0x40f77f);if(_0xa403f5[_0x493f('0x3d')]['filter']){_0x477290[_0x493f('0x46')]=_[_0x493f('0x47')](_0x477290[_0x493f('0x46')],{'$or':_['map'](_0x40f77f,function(_0x2e0657){if(_0x2e0657['type']!==_0x493f('0x48')){var _0x120929={};_0x120929[_0x2e0657['name']]={'$like':'%'+_0xa403f5[_0x493f('0x3d')][_0x493f('0x49')]+'%'};return _0x120929;}})});}_0x477290=_[_0x493f('0x47')]({},_0x477290,_0xa403f5[_0x493f('0x4a')]);var _0x157887={'where':_0x477290[_0x493f('0x46')]};return db['VoiceRecording'][_0x493f('0x24')](_0x157887)[_0x493f('0x2c')](function(_0x4f022c){_0x3d488b[_0x493f('0x24')]=_0x4f022c;if(_0xa403f5[_0x493f('0x3d')][_0x493f('0x4b')]){_0x477290[_0x493f('0x4c')]=[{'all':!![]}];}return db[_0x493f('0x34')][_0x493f('0x4d')](_0x477290);})[_0x493f('0x2c')](function(_0x190a2f){_0x3d488b[_0x493f('0x4e')]=_0x190a2f;return _0x3d488b;})['then'](respondWithFilteredResult(_0x8882a7,_0x477290))['catch'](handleError(_0x8882a7,null));};exports[_0x493f('0x4f')]=function(_0x3dea37,_0x5b30d0){var _0x3e298d={'raw':![],'where':{'id':_0x3dea37[_0x493f('0x50')]['id']}},_0x584ada={};_0x584ada['model']=_[_0x493f('0x51')](db[_0x493f('0x34')][_0x493f('0x35')]);_0x584ada[_0x493f('0x3d')]=_[_0x493f('0x51')](_0x3dea37[_0x493f('0x3d')]);_0x584ada[_0x493f('0x3a')]=_[_0x493f('0x3b')](_0x584ada[_0x493f('0x3c')],_0x584ada[_0x493f('0x3d')]);_0x3e298d[_0x493f('0x3f')]=_[_0x493f('0x3b')](_0x584ada[_0x493f('0x3c')],qs['fields'](_0x3dea37[_0x493f('0x3d')][_0x493f('0x3e')]));_0x3e298d[_0x493f('0x3f')]=_0x3e298d[_0x493f('0x3f')][_0x493f('0x40')]?_0x3e298d['attributes']:_0x584ada[_0x493f('0x3c')];if(_0x3dea37[_0x493f('0x3d')][_0x493f('0x4b')]){_0x3e298d[_0x493f('0x4c')]=[{'all':!![]}];}_0x3e298d=_[_0x493f('0x47')]({},_0x3e298d,_0x3dea37[_0x493f('0x4a')]);return db[_0x493f('0x34')][_0x493f('0x52')](_0x3e298d)['then'](handleEntityNotFound(_0x5b30d0,null))[_0x493f('0x2c')](respondWithResult(_0x5b30d0,null))[_0x493f('0x53')](handleError(_0x5b30d0,null));};exports[_0x493f('0x54')]=function(_0x58605c,_0x12d1bb){return db[_0x493f('0x34')][_0x493f('0x54')](_0x58605c['body'],{})[_0x493f('0x2c')](respondWithResult(_0x12d1bb,0xc9))[_0x493f('0x53')](handleError(_0x12d1bb,null));};exports['update']=function(_0x32b188,_0x4283f9){if(_0x32b188[_0x493f('0x55')]['id']){delete _0x32b188[_0x493f('0x55')]['id'];}return db[_0x493f('0x34')][_0x493f('0x52')]({'where':{'id':_0x32b188[_0x493f('0x50')]['id']}})['then'](handleEntityNotFound(_0x4283f9,null))[_0x493f('0x2c')](saveUpdates(_0x32b188[_0x493f('0x55')],null))[_0x493f('0x2c')](respondWithResult(_0x4283f9,null))[_0x493f('0x53')](handleError(_0x4283f9,null));};exports[_0x493f('0x56')]=function(_0x4abd73,_0x4c16fc){return db[_0x493f('0x34')][_0x493f('0x56')]()[_0x493f('0x2c')](respondWithResult(_0x4c16fc,null))['catch'](handleError(_0x4c16fc,null));};exports[_0x493f('0x57')]=function(_0x2278fb,_0x4f3925,_0x5f4c78){var _0x2ce8c9=require(_0x493f('0x58'));var _0xa6854f=![];var _0x53b7a4={};if(_0x2278fb[_0x493f('0x3d')][_0x493f('0x59')]&&_0x2278fb[_0x493f('0x3d')]['type']===_0x493f('0x5a')){_0x53b7a4['uniqueid']=_0x2278fb[_0x493f('0x50')]['id'];}else{_0x53b7a4['id']=_0x2278fb[_0x493f('0x50')]['id'];}return db[_0x493f('0x34')][_0x493f('0x52')]({'where':_0x53b7a4,'attributes':['id',_0x493f('0x5b')],'raw':!![]})['then'](handleEntityNotFound(_0x4f3925,null))['then'](function(_0x5f3da3){if(_0x5f3da3){var _0x2b626c=_0x5f3da3[_0x493f('0x5b')];var _0x3dc486=util['format'](_0x493f('0x5c'),_0x2b626c);if(fs[_0x493f('0x5d')](_0x3dc486)){_0xa6854f=!![];return _0x2ce8c9[_0x493f('0x5e')](_0x3dc486,_0x2b626c,config[_0x493f('0x5f')]['recording'])['then'](function(){return _0x5f3da3;});}return _0x5f3da3;}})[_0x493f('0x2c')](function(_0xfcd4e2){if(_0xfcd4e2){var _0x2ab17b=_0xfcd4e2[_0x493f('0x5b')];if(!fs['existsSync'](_0x2ab17b)){throw new db[(_0x493f('0x60'))][(_0x493f('0x61'))](_0x493f('0x62'));}if(_0xfcd4e2[_0x493f('0x63')]){return _0x4f3925[_0x493f('0x57')](_0x2ab17b,_0xfcd4e2[_0x493f('0x63')]+path[_0x493f('0x64')](_0x2ab17b),function(){if(_0xa6854f){fs[_0x493f('0x65')](_0x2ab17b);}});}else{return _0x4f3925['download'](_0x2ab17b,function(_0x494919){if(_0xa6854f){fs[_0x493f('0x65')](_0x2ab17b);}});}}})[_0x493f('0x53')](function(_0xe90b55){if(_0xe90b55[_0x493f('0x66')]===_0x493f('0x62')){_0x4f3925[_0x493f('0x1f')](0x194)[_0x493f('0x31')]('Not\x20found');}else{return handleError(_0x4f3925,null);}});};exports['downloads']=function(_0x1ca489,_0x3c67a5,_0x1f867c){var _0x232508=require(_0x493f('0x58'));var _0x15702c=![];var _0x3bde97={'$and':[db['sequelize']['where'](db[_0x493f('0x67')]['fn'](_0x493f('0x68'),db[_0x493f('0x67')]['col']('uniqueid')),_0x1ca489[_0x493f('0x3d')]['token'])]};if(_0x1ca489[_0x493f('0x3d')][_0x493f('0x59')]&&_0x1ca489['query'][_0x493f('0x59')]===_0x493f('0x5a')){_0x3bde97[_0x493f('0x69')][_0x493f('0x6a')]({'uniqueid':_0x1ca489[_0x493f('0x50')]['id']});}else{_0x3bde97[_0x493f('0x69')][_0x493f('0x6a')]({'id':_0x1ca489['params']['id']});}return db['VoiceRecording']['find']({'where':_0x3bde97,'attributes':['id',_0x493f('0x5b')],'raw':!![]})[_0x493f('0x2c')](handleEntityNotFound(_0x3c67a5,null))['then'](function(_0x1f95df){if(_0x1f95df){var _0x4e0a8f=util['format']('%s.cypher',_0x1f95df['value']);if(fs[_0x493f('0x5d')](_0x4e0a8f)){_0x15702c=!![];return _0x232508[_0x493f('0x5e')](_0x4e0a8f,_0x1f95df[_0x493f('0x5b')],config['secrets'][_0x493f('0x6b')])[_0x493f('0x2c')](function(){return _0x1f95df;});}return _0x1f95df;}})['then'](function(_0x4e8a3d){if(_0x4e8a3d){if(!fs['existsSync'](_0x4e8a3d[_0x493f('0x5b')])){throw new db[(_0x493f('0x60'))][(_0x493f('0x61'))](_0x493f('0x62'));}if(_0x4e8a3d[_0x493f('0x63')]){return _0x3c67a5[_0x493f('0x57')](_0x4e8a3d['value'],_0x4e8a3d[_0x493f('0x63')]+path['extname'](_0x4e8a3d[_0x493f('0x5b')]),function(){if(_0x15702c){fs[_0x493f('0x65')](_0x4e8a3d[_0x493f('0x5b')]);}});}else{return _0x3c67a5[_0x493f('0x57')](_0x4e8a3d[_0x493f('0x5b')],function(_0x544e44){if(_0x15702c){fs[_0x493f('0x65')](_0x4e8a3d[_0x493f('0x5b')]);}});}}})[_0x493f('0x53')](handleError(_0x3c67a5,null));};exports[_0x493f('0x2d')]=function(_0x18776f,_0x481a4c){return db[_0x493f('0x34')][_0x493f('0x52')]({'where':{'id':_0x18776f[_0x493f('0x50')]['id']}})[_0x493f('0x2c')](function(_0x3c934){if(_[_0x493f('0x6c')](_0x3c934)){throw new ReferenceError(_0x493f('0x6d'));}return _0x3c934;})[_0x493f('0x2c')](function(_0x429a12){var _0x1d1c04=_0x429a12[_0x493f('0x5b')];logger[_0x493f('0x6e')](_0x493f('0x6f'),_0x1d1c04);if(!_[_0x493f('0x6c')](_0x429a12['value'])&&fs[_0x493f('0x5d')](_0x1d1c04)){logger['info'](_0x493f('0x70')+_0x1d1c04+_0x493f('0x71'));fs[_0x493f('0x72')](_0x1d1c04);}_0x1d1c04=_0x1d1c04+_0x493f('0x73');if(!_['isNil'](_0x429a12['value'])&&fs[_0x493f('0x5d')](_0x1d1c04)){logger['info'](_0x493f('0x70')+_0x1d1c04+_0x493f('0x71'));fs['unlinkSync'](_0x1d1c04);}return _0x429a12;})['then'](function(_0x200789){if(!_0x200789)throw new InternalError();return _0x200789[_0x493f('0x2d')]();})['then'](function(){_0x481a4c[_0x493f('0x1f')](0xcc)[_0x493f('0x20')]();})[_0x493f('0x53')](handleError(_0x481a4c,null));};function getBucketslist(_0x2ca3d7,_0x4519f8,_0x534356){return new Promise(function(_0x4b8119,_0x178bff){var _0x3d41cd=new AWS['S3']({'accessKeyId':_0x4519f8,'secretAccessKey':_0x2ca3d7,'region':_0x534356});_0x3d41cd[_0x493f('0x74')]({},function(_0x3eefc4,_0x45d547){if(_0x3eefc4){return _0x178bff(_0x3eefc4);}else{return _0x4b8119(_0x45d547);}});});}function createBucket(_0x180d13,_0xd51f92,_0x549875,_0x420e5c){return new Promise(function(_0x3b3317,_0x1df79f){var _0x3ab1dd=new AWS['S3']({'accessKeyId':_0xd51f92,'secretAccessKey':_0x180d13,'region':_0x549875});_0x3ab1dd[_0x493f('0x75')]({'Bucket':_0x420e5c},function(_0x294c81,_0x386caa){if(_0x294c81){return _0x1df79f(_0x294c81);}else{return _0x3b3317(_0x386caa);}});});}function uploadFile(_0x48880c,_0xb917a6,_0xd52c76,_0x3230da,_0x267385,_0x584ead){return new Promise(function(_0x507393,_0x18f05a){var _0x28a39a=new AWS['S3']({'accessKeyId':_0xb917a6,'secretAccessKey':_0x48880c,'region':_0xd52c76});_0x28a39a[_0x493f('0x76')]({'Bucket':_0x3230da,'Key':_0x267385,'Body':_0x584ead},function(_0x412827,_0x4e8ce2){if(_0x412827){return _0x18f05a(_0x412827);}else{return _0x507393(_0x4e8ce2);}});});}function startTranscribe(_0x4ccfe5,_0x3ddf60,_0x5511e0,_0x434f54,_0x2c4a95,_0x3a7862){return new Promise(function(_0x14c54e,_0x3c57a4){var _0x152c75=new AWS['TranscribeService']({'accessKeyId':_0x3ddf60,'secretAccessKey':_0x4ccfe5,'region':_0x5511e0});_0x152c75['startTranscriptionJob']({'TranscriptionJobName':_0x434f54,'LanguageCode':_0x2c4a95,'Media':{'MediaFileUri':_0x3a7862}},function(_0x196a20,_0x215b20){if(_0x196a20){return _0x3c57a4(_0x196a20);}else{return _0x14c54e(_0x215b20);}});});}function transcribe(_0x2ab930,_0x120db9,_0x54945d,_0x28d679,_0x450f0f,_0x4f2991,_0x2da625){return new Promise(function(_0x5257a0,_0x3d7031){var _0x4c4764={};logger[_0x493f('0x6e')](util['format'](_0x493f('0x77'),_0x2ab930,_0x450f0f));return uploadFile(_0x120db9,_0x54945d,_0x28d679,_0x450f0f,path[_0x493f('0x78')](_0x4f2991),fs[_0x493f('0x79')](_0x4f2991))[_0x493f('0x2c')](function(_0x106652){logger[_0x493f('0x6e')](util[_0x493f('0x39')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x2ab930,_0x450f0f,_0x106652[_0x493f('0x7a')]));_0x4c4764[_0x493f('0x7b')]=_0x106652[_0x493f('0x7c')];_0x4c4764[_0x493f('0x7d')]=_0x106652[_0x493f('0x7a')];logger['info'](util[_0x493f('0x39')](_0x493f('0x7e'),_0x2ab930));return startTranscribe(_0x120db9,_0x54945d,_0x28d679,uuidv4(),_0x2da625,_0x106652[_0x493f('0x7a')]);})[_0x493f('0x2c')](function(_0x295e6f){logger[_0x493f('0x6e')](util['format'](_0x493f('0x7f'),_0x2ab930,_0x295e6f[_0x493f('0x80')][_0x493f('0x81')]));_0x4c4764[_0x493f('0x82')]=_0x295e6f['TranscriptionJob'][_0x493f('0x81')];_0x4c4764[_0x493f('0x83')]=_0x295e6f['TranscriptionJob']['TranscriptionJobStatus'];return _0x5257a0(_0x4c4764);})[_0x493f('0x53')](function(_0x4c141a){return _0x3d7031(_0x4c141a);});});}exports[_0x493f('0x84')]=function(_0x3cde02,_0x433db9,_0x1bb79f){var _0x388102;var _0x41748f;var _0x2a1a28;var _0x48b9d4=require(_0x493f('0x58'));return db[_0x493f('0x34')][_0x493f('0x85')]({'where':{'id':_0x3cde02['params']['id']}})[_0x493f('0x2c')](function(_0x338bdb){if(_0x338bdb){var _0x91d48c=util[_0x493f('0x39')](_0x493f('0x5c'),_0x338bdb[_0x493f('0x5b')]);if(fs[_0x493f('0x5d')](_0x91d48c)){cypher=!![];return _0x48b9d4['decryptFile'](_0x91d48c,_0x338bdb[_0x493f('0x5b')],config[_0x493f('0x5f')][_0x493f('0x6b')])[_0x493f('0x2c')](function(){return _0x338bdb;});}return _0x338bdb;}})['then'](function(_0x362e7f){if(!_0x362e7f){throw new db['Sequelize'][(_0x493f('0x61'))]('Voice\x20Recording\x20not\x20found');}_0x41748f=_0x362e7f;return db[_0x493f('0x86')][_0x493f('0x85')]({'where':{'id':0x1}});})[_0x493f('0x2c')](handleEntityNotFound(_0x433db9,null))[_0x493f('0x2c')](function(_0x597c82){if(_0x597c82){_0x388102=_0x597c82;if(!_0x388102['transcribe']||!_0x388102['transcribeAccountId']||!_0x388102[_0x493f('0x87')]||!_0x388102['language']||!_0x388102[_0x493f('0x7b')]){throw new db[(_0x493f('0x60'))]['ValidationError'](_0x493f('0x88'));}if(_0x3cde02[_0x493f('0x55')][_0x493f('0x89')]&&(!_0x388102['sentiment']||!_0x388102['sentimentAccountId']||!_0x388102['sentimentRegion']||!_0x388102[_0x493f('0x8a')]||!_0x388102[_0x493f('0x7b')])){throw new db['Sequelize'][(_0x493f('0x61'))](_0x493f('0x8b'));}return db[_0x493f('0x8c')][_0x493f('0x85')]({'where':{'id':_0x388102[_0x493f('0x8d')]}});}})[_0x493f('0x2c')](function(_0xd2315c){if(!_0xd2315c){throw new db[(_0x493f('0x60'))][(_0x493f('0x61'))](_0x493f('0x8e'));}if(!_0xd2315c[_0x493f('0x8f')]||!_0xd2315c[_0x493f('0x90')]){throw new db[(_0x493f('0x60'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x2a1a28=_0xd2315c;return getBucketslist(_0x2a1a28['data1'],_0x2a1a28['data2'],_0x388102[_0x493f('0x87')]);})[_0x493f('0x2c')](function(_0x872fe9){if(_0x872fe9&&_0x872fe9[_0x493f('0x91')]){var _0x5e33a3=_['find'](_0x872fe9[_0x493f('0x91')],function(_0x116c29){return _0x116c29[_0x493f('0x92')]===_0x388102[_0x493f('0x7b')];});if(!_0x5e33a3){logger['info'](util[_0x493f('0x39')](_0x493f('0x93'),_0x3cde02[_0x493f('0x50')]['id'],_0x388102['bucket']));return createBucket(_0x2a1a28['data1'],_0x2a1a28[_0x493f('0x90')],_0x388102[_0x493f('0x87')],_0x388102[_0x493f('0x7b')]);}logger[_0x493f('0x6e')](util[_0x493f('0x39')](_0x493f('0x94'),_0x3cde02[_0x493f('0x50')]['id'],_0x388102['bucket']));return;}})['then'](function(_0x441be1){if(_0x41748f[_0x493f('0x83')]==='NEW'){return transcribe(_0x3cde02[_0x493f('0x50')]['id'],_0x2a1a28[_0x493f('0x8f')],_0x2a1a28[_0x493f('0x90')],_0x388102[_0x493f('0x87')],_0x388102[_0x493f('0x7b')],_0x41748f[_0x493f('0x5b')],_0x388102[_0x493f('0x8a')]);}else{logger[_0x493f('0x6e')](util[_0x493f('0x39')](_0x493f('0x95'),_0x3cde02[_0x493f('0x50')]['id']));return{'transcribeStatus':_0x493f('0x96')};}})['then'](function(_0x5ceb35){if(_0x5ceb35){_0x5ceb35[_0x493f('0x97')]=_0x3cde02[_0x493f('0x55')][_0x493f('0x89')];return _0x41748f[_0x493f('0x98')](_0x5ceb35);}})[_0x493f('0x2c')](respondWithResult(_0x433db9,null))[_0x493f('0x53')](handleError(_0x433db9,null));};function writeFile(_0x2bf9b0,_0x17b3d6){return new Promise(function(_0x1c54d6,_0x5b9f8b){fs[_0x493f('0x99')](_0x17b3d6,_0x2bf9b0,function(_0x5e14cb,_0x17b0bc){if(_0x5e14cb){return _0x5b9f8b(_0x5e14cb);}else{return _0x1c54d6(_0x17b0bc);}});});}exports[_0x493f('0x9a')]=function(_0x370b03,_0x53b1d9,_0x16ae5d){return db[_0x493f('0x34')][_0x493f('0x85')]({'where':{'id':_0x370b03[_0x493f('0x50')]['id']}})[_0x493f('0x2c')](handleEntityNotFound(_0x53b1d9))[_0x493f('0x2c')](function(_0x41a79b){if(_0x41a79b&&_0x41a79b[_0x493f('0x9b')]){var _0x8b7a3=_0x41a79b[_0x493f('0x9b')];var _0x243848=config[_0x493f('0x9c')]+_0x493f('0x9d')+_0x41a79b['id']+_0x493f('0x9e');if(fs[_0x493f('0x5d')](_0x243848)){return _0x243848;}return writeFile(_0x8b7a3,_0x243848)[_0x493f('0x2c')](function(){return _0x243848;});}else{throw new db[(_0x493f('0x60'))][(_0x493f('0x61'))]('Transcript\x20not\x20available');}})['then'](function(_0x11f540){return _0x53b1d9[_0x493f('0x57')](_0x11f540);})[_0x493f('0x53')](handleError(_0x53b1d9));}; \ No newline at end of file +var _0x43e4=['keys','intersection','model','attributes','fields','length','nolimit','order','sort','filters','pick','where','filter','merge','options','include','rows','params','includeAll','find','catch','create','body','describe','download','uniqueid','value','format','%s.cypher','existsSync','decryptFile','Sequelize','filename','unlink','VoiceRecording\x20not\x20found','Not\x20found','downloads','../../components/encryptor','sequelize','col','token','$and','push','secrets','ValidationError','extname','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','recording','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','language','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','limit','undefined','count','offset','set','Content-Range','json','save','update','then','destroy','sendStatus','error','stack','send','index','VoiceRecording','type','key','differenceBy','map','name','query'];(function(_0x18546c,_0x4daf94){var _0x46ef43=function(_0x559377){while(--_0x559377){_0x18546c['push'](_0x18546c['shift']());}};_0x46ef43(++_0x4daf94);}(_0x43e4,0xf1));var _0x443e=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x43e4[_0x3ab9ee];return _0x82ee88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x443e('0x0'));var zipdir=require(_0x443e('0x1'));var jsonpatch=require(_0x443e('0x2'));var rp=require(_0x443e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x443e('0x4'));var util=require(_0x443e('0x5'));var path=require(_0x443e('0x6'));var sox=require('sox');var csv=require(_0x443e('0x7'));var ejs=require(_0x443e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x443e('0x9'));var squel=require(_0x443e('0xa'));var crypto=require(_0x443e('0xb'));var jsforce=require(_0x443e('0xc'));var deskjs=require(_0x443e('0xd'));var toCsv=require(_0x443e('0x7'));var querystring=require(_0x443e('0xe'));var Papa=require(_0x443e('0xf'));var AWS=require('aws-sdk');var uuidv4=require(_0x443e('0x10'));var Redis=require(_0x443e('0x11'));var authService=require(_0x443e('0x12'));var qs=require(_0x443e('0x13'));var as=require(_0x443e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x443e('0x15'))('api');var utils=require(_0x443e('0x16'));var config=require(_0x443e('0x17'));var licenseUtil=require(_0x443e('0x18'));var db=require(_0x443e('0x19'))['db'];function respondWithStatusCode(_0x25cfd5,_0x2a1a9d){_0x2a1a9d=_0x2a1a9d||0xcc;return function(_0x56f6b6){if(_0x56f6b6){return _0x25cfd5['sendStatus'](_0x2a1a9d);}return _0x25cfd5['status'](_0x2a1a9d)[_0x443e('0x1a')]();};}function respondWithResult(_0x449214,_0x528566){_0x528566=_0x528566||0xc8;return function(_0x2c4ade){if(_0x2c4ade){return _0x449214[_0x443e('0x1b')](_0x528566)['json'](_0x2c4ade);}};}function respondWithFilteredResult(_0x5b5e9a,_0x47d9f2){return function(_0x3f4c7c){if(_0x3f4c7c){var _0x45b48b=typeof _0x47d9f2['offset']==='undefined'&&typeof _0x47d9f2[_0x443e('0x1c')]===_0x443e('0x1d');var _0x193b27=_0x3f4c7c[_0x443e('0x1e')];var _0x4fafcc=_0x45b48b?0x0:_0x47d9f2[_0x443e('0x1f')];var _0x4dfed2=_0x45b48b?_0x3f4c7c[_0x443e('0x1e')]:_0x47d9f2['offset']+_0x47d9f2['limit'];var _0x585389;if(_0x4dfed2>=_0x193b27){_0x4dfed2=_0x193b27;_0x585389=0xc8;}else{_0x585389=0xce;}_0x5b5e9a[_0x443e('0x1b')](_0x585389);return _0x5b5e9a[_0x443e('0x20')](_0x443e('0x21'),_0x4fafcc+'-'+_0x4dfed2+'/'+_0x193b27)[_0x443e('0x22')](_0x3f4c7c);}return null;};}function patchUpdates(_0x4473c0){return function(_0xdb547e){try{jsonpatch['apply'](_0xdb547e,_0x4473c0,!![]);}catch(_0x5bbf77){return BPromise['reject'](_0x5bbf77);}return _0xdb547e[_0x443e('0x23')]();};}function saveUpdates(_0x3e92bb,_0x2e1329){return function(_0x452775){if(_0x452775){return _0x452775[_0x443e('0x24')](_0x3e92bb)[_0x443e('0x25')](function(_0x2d525a){return _0x2d525a;});}return null;};}function removeEntity(_0x2bc0e3,_0x56e1be){return function(_0x374605){if(_0x374605){return _0x374605[_0x443e('0x26')]()[_0x443e('0x25')](function(){_0x2bc0e3[_0x443e('0x1b')](0xcc)[_0x443e('0x1a')]();});}};}function handleEntityNotFound(_0x398910,_0x2e18d8){return function(_0x10fe82){if(!_0x10fe82){_0x398910[_0x443e('0x27')](0x194);}return _0x10fe82;};}function handleError(_0x229df3,_0x364472){_0x364472=_0x364472||0x1f4;return function(_0x4e287c){logger[_0x443e('0x28')](_0x4e287c[_0x443e('0x29')]);if(_0x4e287c['name']){delete _0x4e287c['name'];}_0x229df3['status'](_0x364472)[_0x443e('0x2a')](_0x4e287c);};}exports[_0x443e('0x2b')]=function(_0x317f99,_0x3ad1eb){var _0x2209fa={},_0x27cf14={},_0x3d9d69={'count':0x0,'rows':[]};var _0x37b68f=_['map'](db[_0x443e('0x2c')]['rawAttributes'],function(_0x15a59e){return{'name':_0x15a59e['fieldName'],'type':_0x15a59e[_0x443e('0x2d')][_0x443e('0x2e')]};});_0x27cf14['model']=_[_0x443e('0x2f')](_[_0x443e('0x30')](_0x37b68f,_0x443e('0x31')),['format']);_0x27cf14[_0x443e('0x32')]=_[_0x443e('0x33')](_0x317f99[_0x443e('0x32')]);_0x27cf14['filters']=_[_0x443e('0x34')](_0x27cf14[_0x443e('0x35')],_0x27cf14[_0x443e('0x32')]);_0x2209fa[_0x443e('0x36')]=_['intersection'](_0x27cf14[_0x443e('0x35')],qs[_0x443e('0x37')](_0x317f99['query'][_0x443e('0x37')]));_0x2209fa[_0x443e('0x36')]=_0x2209fa['attributes'][_0x443e('0x38')]?_0x2209fa[_0x443e('0x36')]:_0x27cf14[_0x443e('0x35')];if(!_0x317f99[_0x443e('0x32')]['hasOwnProperty'](_0x443e('0x39'))){_0x2209fa['limit']=qs[_0x443e('0x1c')](_0x317f99['query'][_0x443e('0x1c')]);_0x2209fa[_0x443e('0x1f')]=qs[_0x443e('0x1f')](_0x317f99[_0x443e('0x32')]['offset']);}_0x2209fa[_0x443e('0x3a')]=qs[_0x443e('0x3b')](_0x317f99[_0x443e('0x32')][_0x443e('0x3b')]);_0x2209fa['where']=qs[_0x443e('0x3c')](_[_0x443e('0x3d')](_0x317f99[_0x443e('0x32')],_0x27cf14[_0x443e('0x3c')]),_0x37b68f);if(_0x317f99[_0x443e('0x32')]['filter']){_0x2209fa[_0x443e('0x3e')]=_['merge'](_0x2209fa['where'],{'$or':_[_0x443e('0x30')](_0x37b68f,function(_0x4310f6){if(_0x4310f6[_0x443e('0x2d')]!=='VIRTUAL'){var _0x535b68={};_0x535b68[_0x4310f6[_0x443e('0x31')]]={'$like':'%'+_0x317f99[_0x443e('0x32')][_0x443e('0x3f')]+'%'};return _0x535b68;}})});}_0x2209fa=_[_0x443e('0x40')]({},_0x2209fa,_0x317f99[_0x443e('0x41')]);var _0x3610ea={'where':_0x2209fa[_0x443e('0x3e')]};return db[_0x443e('0x2c')][_0x443e('0x1e')](_0x3610ea)[_0x443e('0x25')](function(_0x37ecd5){_0x3d9d69[_0x443e('0x1e')]=_0x37ecd5;if(_0x317f99[_0x443e('0x32')]['includeAll']){_0x2209fa[_0x443e('0x42')]=[{'all':!![]}];}return db[_0x443e('0x2c')]['findAll'](_0x2209fa);})[_0x443e('0x25')](function(_0x204040){_0x3d9d69[_0x443e('0x43')]=_0x204040;return _0x3d9d69;})[_0x443e('0x25')](respondWithFilteredResult(_0x3ad1eb,_0x2209fa))['catch'](handleError(_0x3ad1eb,null));};exports['show']=function(_0x3bad1f,_0x1dc978){var _0x422830={'raw':![],'where':{'id':_0x3bad1f[_0x443e('0x44')]['id']}},_0x1c36d9={};_0x1c36d9[_0x443e('0x35')]=_[_0x443e('0x33')](db['VoiceRecording']['rawAttributes']);_0x1c36d9[_0x443e('0x32')]=_[_0x443e('0x33')](_0x3bad1f['query']);_0x1c36d9[_0x443e('0x3c')]=_['intersection'](_0x1c36d9[_0x443e('0x35')],_0x1c36d9['query']);_0x422830[_0x443e('0x36')]=_[_0x443e('0x34')](_0x1c36d9['model'],qs[_0x443e('0x37')](_0x3bad1f[_0x443e('0x32')]['fields']));_0x422830['attributes']=_0x422830['attributes'][_0x443e('0x38')]?_0x422830[_0x443e('0x36')]:_0x1c36d9[_0x443e('0x35')];if(_0x3bad1f['query'][_0x443e('0x45')]){_0x422830['include']=[{'all':!![]}];}_0x422830=_[_0x443e('0x40')]({},_0x422830,_0x3bad1f['options']);return db[_0x443e('0x2c')][_0x443e('0x46')](_0x422830)['then'](handleEntityNotFound(_0x1dc978,null))[_0x443e('0x25')](respondWithResult(_0x1dc978,null))[_0x443e('0x47')](handleError(_0x1dc978,null));};exports[_0x443e('0x48')]=function(_0x6691cc,_0x2a0b27){return db[_0x443e('0x2c')][_0x443e('0x48')](_0x6691cc[_0x443e('0x49')],{})[_0x443e('0x25')](respondWithResult(_0x2a0b27,0xc9))['catch'](handleError(_0x2a0b27,null));};exports[_0x443e('0x24')]=function(_0x29bc5c,_0x40f4af){if(_0x29bc5c[_0x443e('0x49')]['id']){delete _0x29bc5c[_0x443e('0x49')]['id'];}return db[_0x443e('0x2c')][_0x443e('0x46')]({'where':{'id':_0x29bc5c[_0x443e('0x44')]['id']}})[_0x443e('0x25')](handleEntityNotFound(_0x40f4af,null))[_0x443e('0x25')](saveUpdates(_0x29bc5c[_0x443e('0x49')],null))[_0x443e('0x25')](respondWithResult(_0x40f4af,null))[_0x443e('0x47')](handleError(_0x40f4af,null));};exports[_0x443e('0x4a')]=function(_0x15224b,_0x3a51ed){return db[_0x443e('0x2c')][_0x443e('0x4a')]()[_0x443e('0x25')](respondWithResult(_0x3a51ed,null))[_0x443e('0x47')](handleError(_0x3a51ed,null));};exports[_0x443e('0x4b')]=function(_0x3ddfa6,_0xe919c6,_0x5c7b07){var _0xe77224=require('../../components/encryptor');var _0x5e18cd=![];var _0x1575c0={};if(_0x3ddfa6[_0x443e('0x32')][_0x443e('0x2d')]&&_0x3ddfa6[_0x443e('0x32')][_0x443e('0x2d')]===_0x443e('0x4c')){_0x1575c0[_0x443e('0x4c')]=_0x3ddfa6[_0x443e('0x44')]['id'];}else{_0x1575c0['id']=_0x3ddfa6[_0x443e('0x44')]['id'];}return db[_0x443e('0x2c')]['find']({'where':_0x1575c0,'attributes':['id',_0x443e('0x4d')],'raw':!![]})[_0x443e('0x25')](handleEntityNotFound(_0xe919c6,null))[_0x443e('0x25')](function(_0x4b8930){if(_0x4b8930){var _0x31b2a3=_0x4b8930[_0x443e('0x4d')];var _0x463e05=util[_0x443e('0x4e')](_0x443e('0x4f'),_0x31b2a3);if(fs[_0x443e('0x50')](_0x463e05)){_0x5e18cd=!![];return _0xe77224[_0x443e('0x51')](_0x463e05,_0x31b2a3,config['secrets']['recording'])['then'](function(){return _0x4b8930;});}return _0x4b8930;}})[_0x443e('0x25')](function(_0x544c3d){if(_0x544c3d){var _0x556b6a=_0x544c3d[_0x443e('0x4d')];if(!fs[_0x443e('0x50')](_0x556b6a)){throw new db[(_0x443e('0x52'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x544c3d['filename']){return _0xe919c6['download'](_0x556b6a,_0x544c3d[_0x443e('0x53')]+path['extname'](_0x556b6a),function(){if(_0x5e18cd){fs[_0x443e('0x54')](_0x556b6a);}});}else{return _0xe919c6['download'](_0x556b6a,function(_0x42b4a2){if(_0x5e18cd){fs[_0x443e('0x54')](_0x556b6a);}});}}})[_0x443e('0x47')](function(_0xb5a4d3){if(_0xb5a4d3['message']===_0x443e('0x55')){_0xe919c6[_0x443e('0x1b')](0x194)[_0x443e('0x2a')](_0x443e('0x56'));}else{return handleError(_0xe919c6,null);}});};exports[_0x443e('0x57')]=function(_0x260ea6,_0x6d4227,_0x24ec32){var _0x340448=require(_0x443e('0x58'));var _0x5a8375=![];var _0x2bdb15={'$and':[db[_0x443e('0x59')]['where'](db[_0x443e('0x59')]['fn']('MD5',db[_0x443e('0x59')][_0x443e('0x5a')](_0x443e('0x4c'))),_0x260ea6['query'][_0x443e('0x5b')])]};if(_0x260ea6[_0x443e('0x32')][_0x443e('0x2d')]&&_0x260ea6[_0x443e('0x32')]['type']===_0x443e('0x4c')){_0x2bdb15[_0x443e('0x5c')][_0x443e('0x5d')]({'uniqueid':_0x260ea6[_0x443e('0x44')]['id']});}else{_0x2bdb15['$and'][_0x443e('0x5d')]({'id':_0x260ea6[_0x443e('0x44')]['id']});}return db[_0x443e('0x2c')][_0x443e('0x46')]({'where':_0x2bdb15,'attributes':['id',_0x443e('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x6d4227,null))[_0x443e('0x25')](function(_0x29ab96){if(_0x29ab96){var _0x4a5478=util[_0x443e('0x4e')]('%s.cypher',_0x29ab96['value']);if(fs[_0x443e('0x50')](_0x4a5478)){_0x5a8375=!![];return _0x340448[_0x443e('0x51')](_0x4a5478,_0x29ab96['value'],config[_0x443e('0x5e')]['recording'])['then'](function(){return _0x29ab96;});}return _0x29ab96;}})[_0x443e('0x25')](function(_0x370b7c){if(_0x370b7c){if(!fs[_0x443e('0x50')](_0x370b7c[_0x443e('0x4d')])){throw new db[(_0x443e('0x52'))][(_0x443e('0x5f'))](_0x443e('0x55'));}if(_0x370b7c['filename']){return _0x6d4227[_0x443e('0x4b')](_0x370b7c[_0x443e('0x4d')],_0x370b7c['filename']+path[_0x443e('0x60')](_0x370b7c[_0x443e('0x4d')]),function(){if(_0x5a8375){fs[_0x443e('0x54')](_0x370b7c['value']);}});}else{return _0x6d4227[_0x443e('0x4b')](_0x370b7c[_0x443e('0x4d')],function(_0x9e5e3){if(_0x5a8375){fs[_0x443e('0x54')](_0x370b7c[_0x443e('0x4d')]);}});}}})[_0x443e('0x47')](handleError(_0x6d4227,null));};exports['destroy']=function(_0xa29609,_0x2db96c){return db[_0x443e('0x2c')]['find']({'where':{'id':_0xa29609[_0x443e('0x44')]['id']}})[_0x443e('0x25')](function(_0x55735f){if(_[_0x443e('0x61')](_0x55735f)){throw new ReferenceError('Entity\x20not\x20found');}return _0x55735f;})['then'](function(_0x1d4f28){var _0x4ac1a4=_0x1d4f28['value'];logger[_0x443e('0x62')](_0x443e('0x63'),_0x4ac1a4);if(!_['isNil'](_0x1d4f28['value'])&&fs[_0x443e('0x50')](_0x4ac1a4)){logger[_0x443e('0x62')](_0x443e('0x64')+_0x4ac1a4+_0x443e('0x65'));fs[_0x443e('0x66')](_0x4ac1a4);}_0x4ac1a4=_0x4ac1a4+'.cypher';if(!_[_0x443e('0x61')](_0x1d4f28['value'])&&fs[_0x443e('0x50')](_0x4ac1a4)){logger['info'](_0x443e('0x64')+_0x4ac1a4+_0x443e('0x65'));fs[_0x443e('0x66')](_0x4ac1a4);}return _0x1d4f28;})[_0x443e('0x25')](function(_0x2718b9){if(!_0x2718b9)throw new InternalError();return _0x2718b9['destroy']();})[_0x443e('0x25')](function(){_0x2db96c[_0x443e('0x1b')](0xcc)['end']();})[_0x443e('0x47')](handleError(_0x2db96c,null));};function getBucketslist(_0x288ca9,_0x34cb8e,_0x30798a){return new Promise(function(_0x14833f,_0x2cb4be){var _0xdd192d=new AWS['S3']({'accessKeyId':_0x34cb8e,'secretAccessKey':_0x288ca9,'region':_0x30798a});_0xdd192d[_0x443e('0x67')]({},function(_0x2fa742,_0x566a2a){if(_0x2fa742){return _0x2cb4be(_0x2fa742);}else{return _0x14833f(_0x566a2a);}});});}function createBucket(_0x15a5e3,_0x1d79df,_0x4e8c8f,_0x554c72){return new Promise(function(_0x571132,_0x3f9b55){var _0x12c3c9=new AWS['S3']({'accessKeyId':_0x1d79df,'secretAccessKey':_0x15a5e3,'region':_0x4e8c8f});_0x12c3c9[_0x443e('0x68')]({'Bucket':_0x554c72},function(_0x491ecd,_0x361363){if(_0x491ecd){return _0x3f9b55(_0x491ecd);}else{return _0x571132(_0x361363);}});});}function uploadFile(_0x4724ae,_0x294b01,_0x5b8982,_0x437b13,_0x7770b5,_0x206911){return new Promise(function(_0x4ad757,_0x1fecc7){var _0x252881=new AWS['S3']({'accessKeyId':_0x294b01,'secretAccessKey':_0x4724ae,'region':_0x5b8982});_0x252881[_0x443e('0x69')]({'Bucket':_0x437b13,'Key':_0x7770b5,'Body':_0x206911},function(_0x3e6696,_0xb40a16){if(_0x3e6696){return _0x1fecc7(_0x3e6696);}else{return _0x4ad757(_0xb40a16);}});});}function startTranscribe(_0x33ca5d,_0x5519cb,_0x506d3a,_0x474a7e,_0x3330a2,_0x56738c){return new Promise(function(_0x31a504,_0x3547d4){var _0x369902=new AWS[(_0x443e('0x6a'))]({'accessKeyId':_0x5519cb,'secretAccessKey':_0x33ca5d,'region':_0x506d3a});_0x369902['startTranscriptionJob']({'TranscriptionJobName':_0x474a7e,'LanguageCode':_0x3330a2,'Media':{'MediaFileUri':_0x56738c}},function(_0x3b58fb,_0x16d396){if(_0x3b58fb){return _0x3547d4(_0x3b58fb);}else{return _0x31a504(_0x16d396);}});});}function transcribe(_0x5f1592,_0x369e46,_0x3b8afd,_0xcda458,_0x4e3e89,_0x2908d3,_0x2d10fc){return new Promise(function(_0x5a1379,_0x5d002e){var _0x3ecd97={};logger[_0x443e('0x62')](util[_0x443e('0x4e')](_0x443e('0x6b'),_0x5f1592,_0x4e3e89));return uploadFile(_0x369e46,_0x3b8afd,_0xcda458,_0x4e3e89,path['basename'](_0x2908d3),fs[_0x443e('0x6c')](_0x2908d3))[_0x443e('0x25')](function(_0x57f2bb){logger[_0x443e('0x62')](util[_0x443e('0x4e')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x5f1592,_0x4e3e89,_0x57f2bb[_0x443e('0x6d')]));_0x3ecd97[_0x443e('0x6e')]=_0x57f2bb[_0x443e('0x6f')];_0x3ecd97['location']=_0x57f2bb[_0x443e('0x6d')];logger[_0x443e('0x62')](util[_0x443e('0x4e')](_0x443e('0x70'),_0x5f1592));return startTranscribe(_0x369e46,_0x3b8afd,_0xcda458,uuidv4(),_0x2d10fc,_0x57f2bb['Location']);})['then'](function(_0x41860f){logger[_0x443e('0x62')](util[_0x443e('0x4e')](_0x443e('0x71'),_0x5f1592,_0x41860f['TranscriptionJob']['TranscriptionJobName']));_0x3ecd97[_0x443e('0x72')]=_0x41860f[_0x443e('0x73')][_0x443e('0x74')];_0x3ecd97[_0x443e('0x75')]=_0x41860f[_0x443e('0x73')][_0x443e('0x76')];return _0x5a1379(_0x3ecd97);})['catch'](function(_0x1c3ecf){return _0x5d002e(_0x1c3ecf);});});}exports[_0x443e('0x77')]=function(_0x361183,_0x9269f,_0x1510f1){var _0x22d06d;var _0x477512;var _0x29ad5d;var _0x2e0f9f=require('../../components/encryptor');return db['VoiceRecording'][_0x443e('0x78')]({'where':{'id':_0x361183[_0x443e('0x44')]['id']}})[_0x443e('0x25')](function(_0x51baf8){if(_0x51baf8){var _0x31a6b4=util[_0x443e('0x4e')]('%s.cypher',_0x51baf8['value']);if(fs['existsSync'](_0x31a6b4)){cypher=!![];return _0x2e0f9f[_0x443e('0x51')](_0x31a6b4,_0x51baf8[_0x443e('0x4d')],config[_0x443e('0x5e')][_0x443e('0x79')])[_0x443e('0x25')](function(){return _0x51baf8;});}return _0x51baf8;}})[_0x443e('0x25')](function(_0x1829bf){if(!_0x1829bf){throw new db[(_0x443e('0x52'))]['ValidationError'](_0x443e('0x7a'));}_0x477512=_0x1829bf;return db[_0x443e('0x7b')][_0x443e('0x78')]({'where':{'id':0x1}});})[_0x443e('0x25')](handleEntityNotFound(_0x9269f,null))[_0x443e('0x25')](function(_0x23f860){if(_0x23f860){_0x22d06d=_0x23f860;if(!_0x22d06d[_0x443e('0x7c')]||!_0x22d06d['transcribeAccountId']||!_0x22d06d[_0x443e('0x7d')]||!_0x22d06d[_0x443e('0x7e')]||!_0x22d06d[_0x443e('0x6e')]){throw new db[(_0x443e('0x52'))][(_0x443e('0x5f'))]('Transcribe\x20not\x20configured');}if(_0x361183[_0x443e('0x49')]['runSentiment']&&(!_0x22d06d[_0x443e('0x7f')]||!_0x22d06d[_0x443e('0x80')]||!_0x22d06d['sentimentRegion']||!_0x22d06d[_0x443e('0x7e')]||!_0x22d06d[_0x443e('0x6e')])){throw new db[(_0x443e('0x52'))][(_0x443e('0x5f'))](_0x443e('0x81'));}return db['CloudProvider'][_0x443e('0x78')]({'where':{'id':_0x22d06d['transcribeAccountId']}});}})[_0x443e('0x25')](function(_0x1ec954){if(!_0x1ec954){throw new db[(_0x443e('0x52'))]['ValidationError'](_0x443e('0x82'));}if(!_0x1ec954['data1']||!_0x1ec954[_0x443e('0x83')]){throw new db['Sequelize'][(_0x443e('0x5f'))](_0x443e('0x84'));}_0x29ad5d=_0x1ec954;return getBucketslist(_0x29ad5d[_0x443e('0x85')],_0x29ad5d[_0x443e('0x83')],_0x22d06d[_0x443e('0x7d')]);})[_0x443e('0x25')](function(_0x21de65){if(_0x21de65&&_0x21de65[_0x443e('0x86')]){var _0x597a36=_[_0x443e('0x46')](_0x21de65[_0x443e('0x86')],function(_0x467da7){return _0x467da7['Name']===_0x22d06d[_0x443e('0x6e')];});if(!_0x597a36){logger['info'](util[_0x443e('0x4e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x361183['params']['id'],_0x22d06d[_0x443e('0x6e')]));return createBucket(_0x29ad5d[_0x443e('0x85')],_0x29ad5d[_0x443e('0x83')],_0x22d06d[_0x443e('0x7d')],_0x22d06d[_0x443e('0x6e')]);}logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x361183[_0x443e('0x44')]['id'],_0x22d06d[_0x443e('0x6e')]));return;}})[_0x443e('0x25')](function(_0x4fb92c){if(_0x477512[_0x443e('0x75')]===_0x443e('0x87')){return transcribe(_0x361183['params']['id'],_0x29ad5d['data1'],_0x29ad5d[_0x443e('0x83')],_0x22d06d['transcribeRegion'],_0x22d06d[_0x443e('0x6e')],_0x477512['value'],_0x22d06d[_0x443e('0x7e')]);}else{logger[_0x443e('0x62')](util[_0x443e('0x4e')](_0x443e('0x88'),_0x361183[_0x443e('0x44')]['id']));return{'transcribeStatus':_0x443e('0x89')};}})['then'](function(_0x5a3b50){if(_0x5a3b50){_0x5a3b50[_0x443e('0x8a')]=_0x361183[_0x443e('0x49')][_0x443e('0x8b')];return _0x477512[_0x443e('0x8c')](_0x5a3b50);}})[_0x443e('0x25')](respondWithResult(_0x9269f,null))[_0x443e('0x47')](handleError(_0x9269f,null));};function writeFile(_0x41a6c6,_0x7ab73){return new Promise(function(_0x431c4e,_0x51f8ec){fs[_0x443e('0x8d')](_0x7ab73,_0x41a6c6,function(_0x1ba40d,_0x146115){if(_0x1ba40d){return _0x51f8ec(_0x1ba40d);}else{return _0x431c4e(_0x146115);}});});}exports[_0x443e('0x8e')]=function(_0xeb5604,_0xffb597,_0x4d2d42){return db[_0x443e('0x2c')]['findOne']({'where':{'id':_0xeb5604[_0x443e('0x44')]['id']}})[_0x443e('0x25')](handleEntityNotFound(_0xffb597))[_0x443e('0x25')](function(_0x27cc73){if(_0x27cc73&&_0x27cc73['fileText']){var _0x4ca94c=_0x27cc73[_0x443e('0x8f')];var _0x63ac3c=config['root']+_0x443e('0x90')+_0x27cc73['id']+_0x443e('0x91');if(fs[_0x443e('0x50')](_0x63ac3c)){return _0x63ac3c;}return writeFile(_0x4ca94c,_0x63ac3c)[_0x443e('0x25')](function(){return _0x63ac3c;});}else{throw new db[(_0x443e('0x52'))][(_0x443e('0x5f'))]('Transcript\x20not\x20available');}})[_0x443e('0x25')](function(_0x164dab){return _0xffb597[_0x443e('0x4b')](_0x164dab);})[_0x443e('0x47')](handleError(_0xffb597));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 699fa22..32b5f66 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 _0x1981=['define','voice_recordings','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceRecording.attributes','exports'];(function(_0x41e45f,_0x3ee147){var _0x52ee1f=function(_0x383b40){while(--_0x383b40){_0x41e45f['push'](_0x41e45f['shift']());}};_0x52ee1f(++_0x3ee147);}(_0x1981,0xf3));var _0x1198=function(_0x13ab6a,_0x2074dd){_0x13ab6a=_0x13ab6a-0x0;var _0xebf4cf=_0x1981[_0x13ab6a];return _0xebf4cf;};'use strict';var _=require(_0x1198('0x0'));var util=require('util');var logger=require(_0x1198('0x1'))(_0x1198('0x2'));var moment=require('moment');var BPromise=require(_0x1198('0x3'));var rp=require(_0x1198('0x4'));var fs=require('fs');var path=require(_0x1198('0x5'));var rimraf=require(_0x1198('0x6'));var config=require('../../config/environment');var attributes=require(_0x1198('0x7'));module[_0x1198('0x8')]=function(_0x1be165,_0x439413){return _0x1be165[_0x1198('0x9')]('VoiceRecording',attributes,{'tableName':_0x1198('0xa'),'paranoid':![],'indexes':[{'name':_0x1198('0xb'),'fields':[_0x1198('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x51ed=['define','voice_recordings','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceRecording.attributes','exports'];(function(_0x13cd5a,_0x482548){var _0x18e97a=function(_0x290b95){while(--_0x290b95){_0x13cd5a['push'](_0x13cd5a['shift']());}};_0x18e97a(++_0x482548);}(_0x51ed,0x1a3));var _0xd51e=function(_0x2cb742,_0x16184d){_0x2cb742=_0x2cb742-0x0;var _0x4e9847=_0x51ed[_0x2cb742];return _0x4e9847;};'use strict';var _=require(_0xd51e('0x0'));var util=require('util');var logger=require(_0xd51e('0x1'))(_0xd51e('0x2'));var moment=require(_0xd51e('0x3'));var BPromise=require(_0xd51e('0x4'));var rp=require(_0xd51e('0x5'));var fs=require('fs');var path=require(_0xd51e('0x6'));var rimraf=require('rimraf');var config=require(_0xd51e('0x7'));var attributes=require(_0xd51e('0x8'));module[_0xd51e('0x9')]=function(_0x2a02a0,_0xde8e9c){return _0x2a02a0[_0xd51e('0xa')]('VoiceRecording',attributes,{'tableName':_0xd51e('0xb'),'paranoid':![],'indexes':[{'name':_0xd51e('0xc'),'fields':[_0xd51e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 245ae85..c1f72b9 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 _0x4e2e=['error','message','result','VoiceRecording','update','body','options','raw','attributes','limit','UpdateVoiceRecording','debug','catch','../../components/encryptor','findOne','create','callRecordingEncryption','format','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x136e50,_0x28db6a){var _0x497591=function(_0x5cb145){while(--_0x5cb145){_0x136e50['push'](_0x136e50['shift']());}};_0x497591(++_0x28db6a);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x3207ab,_0x2d34c1){_0x3207ab=_0x3207ab-0x0;var _0x120e52=_0x4e2e[_0x3207ab];return _0x120e52;};'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);});});}exports['UpdateVoiceRecording']=function(_0x196f16){var _0x54c80b=this;return new Promise(function(_0x1d5e9d,_0x3f313b){return db[_0xe4e2('0x15')][_0xe4e2('0x16')](_0x196f16[_0xe4e2('0x17')],{'raw':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')]['where']||null:null,'attributes':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x1a')]||null:null,'limit':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x1b')]||null:null})[_0xe4e2('0xc')](function(_0x51c67e){logger[_0xe4e2('0xd')](_0xe4e2('0x1c'),_0x196f16);logger[_0xe4e2('0x1d')]('UpdateVoiceRecording',_0x196f16,JSON[_0xe4e2('0x11')](_0x51c67e));_0x1d5e9d(_0x51c67e);})[_0xe4e2('0x1e')](function(_0x598fa3){logger[_0xe4e2('0x12')](_0xe4e2('0x1c'),_0x598fa3[_0xe4e2('0x13')],_0x196f16);_0x3f313b(_0x54c80b[_0xe4e2('0x12')](0x1f4,_0x598fa3[_0xe4e2('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x166610){var _0x357903=this;return new Promise(function(_0x1f6d1f,_0x5120fd){var _0x3a31b8=require(_0xe4e2('0x1f'));var _0x31f651;return db['Setting'][_0xe4e2('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xe4e2('0xc')](function(_0x1e21c0){_0x31f651=_0x1e21c0;return db['VoiceRecording'][_0xe4e2('0x21')](_0x166610[_0xe4e2('0x17')]);})[_0xe4e2('0xc')](function(_0x41500b){if(_0x31f651[_0xe4e2('0x22')]&&fs['existsSync'](_0x41500b['value'])){var _0x2cb235=util[_0xe4e2('0x23')](_0xe4e2('0x24'),_0x41500b[_0xe4e2('0x25')]);return _0x3a31b8[_0xe4e2('0x26')](_0x41500b[_0xe4e2('0x25')],_0x2cb235,config[_0xe4e2('0x27')][_0xe4e2('0x28')])[_0xe4e2('0xc')](function(){fs[_0xe4e2('0x29')](_0x41500b[_0xe4e2('0x25')]);logger[_0xe4e2('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x41500b;});}return _0x41500b;})[_0xe4e2('0xc')](function(_0x8ffc6){logger[_0xe4e2('0xd')](_0xe4e2('0x2a'),_0x166610);logger[_0xe4e2('0x1d')](_0xe4e2('0x2a'),_0x166610,JSON['stringify'](_0x8ffc6));_0x1f6d1f(_0x8ffc6);})[_0xe4e2('0x1e')](function(_0x286714){logger[_0xe4e2('0x12')](_0xe4e2('0x2a'),_0x286714[_0xe4e2('0x13')],_0x166610);_0x5120fd(_0x357903[_0xe4e2('0x12')](0x1f4,_0x286714[_0xe4e2('0x13')]));});});}; \ No newline at end of file +var _0xa30a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','UpdateVoiceRecording','update','body','options','where','limit','debug','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x142890,_0x4e431a){var _0x33d7e6=function(_0x5d0162){while(--_0x5d0162){_0x142890['push'](_0x142890['shift']());}};_0x33d7e6(++_0x4e431a);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8af448,_0x14fe09,_0x42dc22){return new BPromise(function(_0x5d076a,_0xedbc45){return client[_0xaa30('0xb')](_0x8af448,_0x42dc22)[_0xaa30('0xc')](function(_0x59d028){logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,'request\x20sent');logger['debug'](_0xaa30('0xf'),_0x14fe09,'request\x20sent',JSON[_0xaa30('0x10')](_0x59d028));if(_0x59d028[_0xaa30('0x11')]){if(_0x59d028[_0xaa30('0x11')][_0xaa30('0x12')]===0x1f4){logger['error'](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0xedbc45(_0x59d028['error'][_0xaa30('0x13')]);}logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0x5d076a(_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);}else{logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,_0xaa30('0x14'));_0x5d076a(_0x59d028['result'][_0xaa30('0x13')]);}})['catch'](function(_0x5eb356){logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x5eb356);_0xedbc45(_0x5eb356);});});}exports[_0xaa30('0x15')]=function(_0x540e36){var _0x54fa49=this;return new Promise(function(_0x53f9fd,_0x23ad3b){return db['VoiceRecording'][_0xaa30('0x16')](_0x540e36[_0xaa30('0x17')],{'raw':_0x540e36['options']?_0x540e36['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')][_0xaa30('0x19')]||null:null,'attributes':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')]['attributes']||null:null,'limit':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')][_0xaa30('0x1a')]||null:null})[_0xaa30('0xc')](function(_0x1ff442){logger['info'](_0xaa30('0x15'),_0x540e36);logger[_0xaa30('0x1b')](_0xaa30('0x15'),_0x540e36,JSON[_0xaa30('0x10')](_0x1ff442));_0x53f9fd(_0x1ff442);})['catch'](function(_0x14d7fa){logger[_0xaa30('0x11')](_0xaa30('0x15'),_0x14d7fa[_0xaa30('0x13')],_0x540e36);_0x23ad3b(_0x54fa49[_0xaa30('0x11')](0x1f4,_0x14d7fa[_0xaa30('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x467850){var _0x465701=this;return new Promise(function(_0x5d4da8,_0xb043e4){var _0x5b3efb=require(_0xaa30('0x1c'));var _0x33a0c9;return db[_0xaa30('0x1d')][_0xaa30('0x1e')]({'attributes':['id',_0xaa30('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xaa30('0xc')](function(_0x6ff09a){_0x33a0c9=_0x6ff09a;return db[_0xaa30('0x20')][_0xaa30('0x21')](_0x467850[_0xaa30('0x17')]);})[_0xaa30('0xc')](function(_0x43003f){if(_0x33a0c9[_0xaa30('0x1f')]&&fs[_0xaa30('0x22')](_0x43003f[_0xaa30('0x23')])){var _0x1a3f64=util[_0xaa30('0x24')](_0xaa30('0x25'),_0x43003f['value']);return _0x5b3efb[_0xaa30('0x26')](_0x43003f[_0xaa30('0x23')],_0x1a3f64,config[_0xaa30('0x27')][_0xaa30('0x28')])[_0xaa30('0xc')](function(){fs[_0xaa30('0x29')](_0x43003f['value']);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x43003f;});}return _0x43003f;})[_0xaa30('0xc')](function(_0x407090){logger[_0xaa30('0xd')](_0xaa30('0x2a'),_0x467850);logger[_0xaa30('0x1b')]('CreateVoiceRecording',_0x467850,JSON['stringify'](_0x407090));_0x5d4da8(_0x407090);})[_0xaa30('0x2b')](function(_0x2d26fb){logger['error'](_0xaa30('0x2a'),_0x2d26fb['message'],_0x467850);_0xb043e4(_0x465701[_0xaa30('0x11')](0x1f4,_0x2d26fb['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index a7d6bb3..7ecec8d 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 _0x805f=['create','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','get','/describe','describe','post'];(function(_0x3803a4,_0x3460b6){var _0x1064d9=function(_0xd6e64e){while(--_0xd6e64e){_0x3803a4['push'](_0x3803a4['shift']());}};_0x1064d9(++_0x3460b6);}(_0x805f,0x95));var _0xf805=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x805f[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xf805('0x0'));var util=require(_0xf805('0x1'));var path=require(_0xf805('0x2'));var timeout=require(_0xf805('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf805('0x4'));var auth=require(_0xf805('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf805('0x6'));var controller=require(_0xf805('0x7'));router['get']('/',auth[_0xf805('0x8')](),controller['index']);router[_0xf805('0x9')](_0xf805('0xa'),auth[_0xf805('0x8')](),controller[_0xf805('0xb')]);router[_0xf805('0x9')]('/:id',auth[_0xf805('0x8')](),controller['show']);router[_0xf805('0xc')]('/',auth[_0xf805('0x8')](),controller[_0xf805('0xd')]);router[_0xf805('0xe')]('/:id',auth[_0xf805('0x8')](),controller[_0xf805('0xf')]);router[_0xf805('0x10')]('/:id',auth[_0xf805('0x8')](),controller[_0xf805('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc502=['../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','post','create','put','exports','multer','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x50b3ce,_0x1e047f){var _0x28e84e=function(_0x18dd4c){while(--_0x18dd4c){_0x50b3ce['push'](_0x50b3ce['shift']());}};_0x28e84e(++_0x1e047f);}(_0xc502,0x136));var _0x2c50=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xc502[_0x39e84d];return _0x1991bc;};'use strict';var multer=require(_0x2c50('0x0'));var util=require('util');var path=require(_0x2c50('0x1'));var timeout=require(_0x2c50('0x2'));var express=require('express');var router=express[_0x2c50('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2c50('0x4'));var config=require(_0x2c50('0x5'));var controller=require(_0x2c50('0x6'));router[_0x2c50('0x7')]('/',auth[_0x2c50('0x8')](),controller[_0x2c50('0x9')]);router[_0x2c50('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2c50('0x7')](_0x2c50('0xa'),auth[_0x2c50('0x8')](),controller['show']);router[_0x2c50('0xb')]('/',auth[_0x2c50('0x8')](),controller[_0x2c50('0xc')]);router[_0x2c50('0xd')](_0x2c50('0xa'),auth[_0x2c50('0x8')](),controller['update']);router['delete'](_0x2c50('0xa'),auth[_0x2c50('0x8')](),controller['destroy']);module[_0x2c50('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index af301ee..993b511 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 _0xdcce=['Yes','sequelize','moment','blind','attended','STRING','ENUM'];(function(_0xc70ff5,_0x1f8a90){var _0x3f84b4=function(_0x5d55d5){while(--_0x5d55d5){_0xc70ff5['push'](_0xc70ff5['shift']());}};_0x3f84b4(++_0x1f8a90);}(_0xdcce,0x1eb));var _0xedcc=function(_0x43a660,_0x2a08c8){_0x43a660=_0x43a660-0x0;var _0x40f835=_0xdcce[_0x43a660];return _0x40f835;};'use strict';var Sequelize=require(_0xedcc('0x0'));var moment=require(_0xedcc('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xedcc('0x2'),_0xedcc('0x3'))},'result':{'type':Sequelize[_0xedcc('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xedcc('0x4')]},'transferercalleridname':{'type':Sequelize[_0xedcc('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xedcc('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xedcc('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xedcc('0x4')]},'transfererexten':{'type':Sequelize[_0xedcc('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xedcc('0x4')]},'transfereechannel':{'type':Sequelize[_0xedcc('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xedcc('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xedcc('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xedcc('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xedcc('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xedcc('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xedcc('0x5')](_0xedcc('0x6'),'No')},'context':{'type':Sequelize[_0xedcc('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0ce2=['Yes','sequelize','moment','attended','STRING','ENUM'];(function(_0x42e016,_0x1b97b5){var _0x3509c7=function(_0x17d7d5){while(--_0x17d7d5){_0x42e016['push'](_0x42e016['shift']());}};_0x3509c7(++_0x1b97b5);}(_0x0ce2,0xeb));var _0x20ce=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0ce2[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x20ce('0x0'));var moment=require(_0x20ce('0x1'));module['exports']={'type':{'type':Sequelize['ENUM']('blind',_0x20ce('0x2'))},'result':{'type':Sequelize[_0x20ce('0x3')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x20ce('0x3')]},'transferercalleridname':{'type':Sequelize[_0x20ce('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x20ce('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x20ce('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x20ce('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x20ce('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x20ce('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x20ce('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x20ce('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x20ce('0x3')]},'transfereecontext':{'type':Sequelize[_0x20ce('0x3')]},'transfereeexten':{'type':Sequelize[_0x20ce('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x20ce('0x3')]},'isexternal':{'type':Sequelize[_0x20ce('0x4')](_0x20ce('0x5'),'No')},'context':{'type':Sequelize[_0x20ce('0x3')]},'extension':{'type':Sequelize[_0x20ce('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 977b177..3cd3ddd 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 _0x5e95=['filter','merge','type','VIRTUAL','name','options','includeAll','findAll','rows','catch','params','include','create','body','find','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','save','update','destroy','then','end','sendStatus','error','stack','send','index','VoiceTransferReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick'];(function(_0x4fa717,_0xf10785){var _0x431048=function(_0x1c5cea){while(--_0x1c5cea){_0x4fa717['push'](_0x4fa717['shift']());}};_0x431048(++_0xf10785);}(_0x5e95,0x1d2));var _0x55e9=function(_0x5ead0e,_0x394902){_0x5ead0e=_0x5ead0e-0x0;var _0x425c06=_0x5e95[_0x5ead0e];return _0x425c06;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x55e9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x55e9('0x1'));var moment=require(_0x55e9('0x2'));var BPromise=require(_0x55e9('0x3'));var Mustache=require(_0x55e9('0x4'));var util=require(_0x55e9('0x5'));var path=require(_0x55e9('0x6'));var sox=require(_0x55e9('0x7'));var csv=require('to-csv');var ejs=require(_0x55e9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x55e9('0x9'));var squel=require('squel');var crypto=require(_0x55e9('0xa'));var jsforce=require(_0x55e9('0xb'));var deskjs=require(_0x55e9('0xc'));var toCsv=require(_0x55e9('0xd'));var querystring=require(_0x55e9('0xe'));var Papa=require('papaparse');var Redis=require(_0x55e9('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x55e9('0x10'));var hardwareService=require(_0x55e9('0x11'));var logger=require('../../config/logger')(_0x55e9('0x12'));var utils=require(_0x55e9('0x13'));var config=require(_0x55e9('0x14'));var licenseUtil=require(_0x55e9('0x15'));var db=require(_0x55e9('0x16'))['db'];function respondWithStatusCode(_0x2aa651,_0x594020){_0x594020=_0x594020||0xcc;return function(_0x52f299){if(_0x52f299){return _0x2aa651['sendStatus'](_0x594020);}return _0x2aa651['status'](_0x594020)['end']();};}function respondWithResult(_0x111b87,_0x3ab8d0){_0x3ab8d0=_0x3ab8d0||0xc8;return function(_0x19d104){if(_0x19d104){return _0x111b87[_0x55e9('0x17')](_0x3ab8d0)[_0x55e9('0x18')](_0x19d104);}};}function respondWithFilteredResult(_0x18d265,_0x1ac496){return function(_0xf72e24){if(_0xf72e24){var _0x5cedf8=typeof _0x1ac496[_0x55e9('0x19')]==='undefined'&&typeof _0x1ac496['limit']===_0x55e9('0x1a');var _0x479a00=_0xf72e24[_0x55e9('0x1b')];var _0x5604a5=_0x5cedf8?0x0:_0x1ac496[_0x55e9('0x19')];var _0x12aa16=_0x5cedf8?_0xf72e24[_0x55e9('0x1b')]:_0x1ac496['offset']+_0x1ac496['limit'];var _0x21ff9c;if(_0x12aa16>=_0x479a00){_0x12aa16=_0x479a00;_0x21ff9c=0xc8;}else{_0x21ff9c=0xce;}_0x18d265[_0x55e9('0x17')](_0x21ff9c);return _0x18d265[_0x55e9('0x1c')](_0x55e9('0x1d'),_0x5604a5+'-'+_0x12aa16+'/'+_0x479a00)['json'](_0xf72e24);}return null;};}function patchUpdates(_0x2ec009){return function(_0x4fb37d){try{jsonpatch['apply'](_0x4fb37d,_0x2ec009,!![]);}catch(_0x38bb91){return BPromise['reject'](_0x38bb91);}return _0x4fb37d[_0x55e9('0x1e')]();};}function saveUpdates(_0x36bc49,_0x4154c9){return function(_0x90c18e){if(_0x90c18e){return _0x90c18e[_0x55e9('0x1f')](_0x36bc49)['then'](function(_0x4a273a){return _0x4a273a;});}return null;};}function removeEntity(_0x3c2560,_0x4a4b5e){return function(_0x1ffd7a){if(_0x1ffd7a){return _0x1ffd7a[_0x55e9('0x20')]()[_0x55e9('0x21')](function(){_0x3c2560[_0x55e9('0x17')](0xcc)[_0x55e9('0x22')]();});}};}function handleEntityNotFound(_0xccaecb,_0x196182){return function(_0x332896){if(!_0x332896){_0xccaecb[_0x55e9('0x23')](0x194);}return _0x332896;};}function handleError(_0x1f5ea7,_0x3ad7d7){_0x3ad7d7=_0x3ad7d7||0x1f4;return function(_0x384c2b){logger[_0x55e9('0x24')](_0x384c2b[_0x55e9('0x25')]);if(_0x384c2b['name']){delete _0x384c2b['name'];}_0x1f5ea7[_0x55e9('0x17')](_0x3ad7d7)[_0x55e9('0x26')](_0x384c2b);};}exports[_0x55e9('0x27')]=function(_0x6cee4f,_0x28fee0){var _0x24bf57={},_0x27676f={},_0x3b4efc={'count':0x0,'rows':[]};var _0x4b8ca8=_['map'](db[_0x55e9('0x28')][_0x55e9('0x29')],function(_0x5478c7){return{'name':_0x5478c7[_0x55e9('0x2a')],'type':_0x5478c7['type'][_0x55e9('0x2b')]};});_0x27676f[_0x55e9('0x2c')]=_[_0x55e9('0x2d')](_0x4b8ca8,'name');_0x27676f[_0x55e9('0x2e')]=_[_0x55e9('0x2f')](_0x6cee4f[_0x55e9('0x2e')]);_0x27676f[_0x55e9('0x30')]=_[_0x55e9('0x31')](_0x27676f['model'],_0x27676f['query']);_0x24bf57['attributes']=_[_0x55e9('0x31')](_0x27676f[_0x55e9('0x2c')],qs[_0x55e9('0x32')](_0x6cee4f[_0x55e9('0x2e')]['fields']));_0x24bf57[_0x55e9('0x33')]=_0x24bf57[_0x55e9('0x33')][_0x55e9('0x34')]?_0x24bf57[_0x55e9('0x33')]:_0x27676f['model'];if(!_0x6cee4f['query'][_0x55e9('0x35')]('nolimit')){_0x24bf57[_0x55e9('0x36')]=qs[_0x55e9('0x36')](_0x6cee4f['query'][_0x55e9('0x36')]);_0x24bf57['offset']=qs[_0x55e9('0x19')](_0x6cee4f[_0x55e9('0x2e')]['offset']);}_0x24bf57[_0x55e9('0x37')]=qs[_0x55e9('0x38')](_0x6cee4f[_0x55e9('0x2e')][_0x55e9('0x38')]);_0x24bf57[_0x55e9('0x39')]=qs['filters'](_[_0x55e9('0x3a')](_0x6cee4f[_0x55e9('0x2e')],_0x27676f[_0x55e9('0x30')]),_0x4b8ca8);if(_0x6cee4f['query'][_0x55e9('0x3b')]){_0x24bf57[_0x55e9('0x39')]=_[_0x55e9('0x3c')](_0x24bf57[_0x55e9('0x39')],{'$or':_['map'](_0x4b8ca8,function(_0x5766d0){if(_0x5766d0[_0x55e9('0x3d')]!==_0x55e9('0x3e')){var _0x1ab571={};_0x1ab571[_0x5766d0[_0x55e9('0x3f')]]={'$like':'%'+_0x6cee4f[_0x55e9('0x2e')][_0x55e9('0x3b')]+'%'};return _0x1ab571;}})});}_0x24bf57=_['merge']({},_0x24bf57,_0x6cee4f[_0x55e9('0x40')]);var _0x19e926={'where':_0x24bf57[_0x55e9('0x39')]};return db[_0x55e9('0x28')][_0x55e9('0x1b')](_0x19e926)[_0x55e9('0x21')](function(_0x1a11ad){_0x3b4efc[_0x55e9('0x1b')]=_0x1a11ad;if(_0x6cee4f[_0x55e9('0x2e')][_0x55e9('0x41')]){_0x24bf57['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0x55e9('0x42')](_0x24bf57);})[_0x55e9('0x21')](function(_0x3969ec){_0x3b4efc[_0x55e9('0x43')]=_0x3969ec;return _0x3b4efc;})[_0x55e9('0x21')](respondWithFilteredResult(_0x28fee0,_0x24bf57))[_0x55e9('0x44')](handleError(_0x28fee0,null));};exports['show']=function(_0x48619a,_0x2e7e72){var _0x56959f={'raw':!![],'where':{'id':_0x48619a[_0x55e9('0x45')]['id']}},_0xecadb7={};_0xecadb7[_0x55e9('0x2c')]=_[_0x55e9('0x2f')](db[_0x55e9('0x28')][_0x55e9('0x29')]);_0xecadb7[_0x55e9('0x2e')]=_[_0x55e9('0x2f')](_0x48619a[_0x55e9('0x2e')]);_0xecadb7[_0x55e9('0x30')]=_[_0x55e9('0x31')](_0xecadb7[_0x55e9('0x2c')],_0xecadb7[_0x55e9('0x2e')]);_0x56959f['attributes']=_[_0x55e9('0x31')](_0xecadb7[_0x55e9('0x2c')],qs[_0x55e9('0x32')](_0x48619a[_0x55e9('0x2e')]['fields']));_0x56959f[_0x55e9('0x33')]=_0x56959f[_0x55e9('0x33')]['length']?_0x56959f[_0x55e9('0x33')]:_0xecadb7[_0x55e9('0x2c')];if(_0x48619a['query']['includeAll']){_0x56959f[_0x55e9('0x46')]=[{'all':!![]}];}_0x56959f=_[_0x55e9('0x3c')]({},_0x56959f,_0x48619a[_0x55e9('0x40')]);return db[_0x55e9('0x28')]['find'](_0x56959f)['then'](handleEntityNotFound(_0x2e7e72,null))['then'](respondWithResult(_0x2e7e72,null))['catch'](handleError(_0x2e7e72,null));};exports[_0x55e9('0x47')]=function(_0x6a7c09,_0x2d40d0){return db[_0x55e9('0x28')]['create'](_0x6a7c09[_0x55e9('0x48')],{})[_0x55e9('0x21')](respondWithResult(_0x2d40d0,0xc9))[_0x55e9('0x44')](handleError(_0x2d40d0,null));};exports[_0x55e9('0x1f')]=function(_0x4fba66,_0x18bd8f){if(_0x4fba66[_0x55e9('0x48')]['id']){delete _0x4fba66[_0x55e9('0x48')]['id'];}return db[_0x55e9('0x28')]['find']({'where':{'id':_0x4fba66[_0x55e9('0x45')]['id']}})[_0x55e9('0x21')](handleEntityNotFound(_0x18bd8f,null))[_0x55e9('0x21')](saveUpdates(_0x4fba66['body'],null))['then'](respondWithResult(_0x18bd8f,null))[_0x55e9('0x44')](handleError(_0x18bd8f,null));};exports['destroy']=function(_0x364a35,_0x3660ee){return db[_0x55e9('0x28')][_0x55e9('0x49')]({'where':{'id':_0x364a35['params']['id']}})[_0x55e9('0x21')](handleEntityNotFound(_0x3660ee,null))[_0x55e9('0x21')](removeEntity(_0x3660ee,null))[_0x55e9('0x44')](handleError(_0x3660ee,null));};exports[_0x55e9('0x4a')]=function(_0x560153,_0x2b336c){return db[_0x55e9('0x28')][_0x55e9('0x4a')]()['then'](respondWithResult(_0x2b336c,null))[_0x55e9('0x44')](handleError(_0x2b336c,null));}; \ No newline at end of file +var _0x0863=['where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','create','body','describe','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','VoiceTransferReport','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x1b5b29,_0xfd5dd8){var _0x2b125e=function(_0x336ec2){while(--_0x336ec2){_0x1b5b29['push'](_0x1b5b29['shift']());}};_0x2b125e(++_0xfd5dd8);}(_0x0863,0x1ae));var _0x3086=function(_0x34c9a5,_0x5ac707){_0x34c9a5=_0x34c9a5-0x0;var _0x391592=_0x0863[_0x34c9a5];return _0x391592;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3086('0x0'));var rp=require(_0x3086('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3086('0x2'));var util=require(_0x3086('0x3'));var path=require(_0x3086('0x4'));var sox=require(_0x3086('0x5'));var csv=require(_0x3086('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3086('0x7'));var _=require(_0x3086('0x8'));var squel=require('squel');var crypto=require(_0x3086('0x9'));var jsforce=require(_0x3086('0xa'));var deskjs=require(_0x3086('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3086('0xc'));var Redis=require('ioredis');var authService=require(_0x3086('0xd'));var qs=require(_0x3086('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3086('0xf'))(_0x3086('0x10'));var utils=require('../../config/utils');var config=require(_0x3086('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x146fa2,_0x49e6b8){_0x49e6b8=_0x49e6b8||0xcc;return function(_0x45401c){if(_0x45401c){return _0x146fa2[_0x3086('0x12')](_0x49e6b8);}return _0x146fa2[_0x3086('0x13')](_0x49e6b8)[_0x3086('0x14')]();};}function respondWithResult(_0x1686d7,_0x3b5a7e){_0x3b5a7e=_0x3b5a7e||0xc8;return function(_0x5d99e5){if(_0x5d99e5){return _0x1686d7[_0x3086('0x13')](_0x3b5a7e)[_0x3086('0x15')](_0x5d99e5);}};}function respondWithFilteredResult(_0x41758b,_0x16809e){return function(_0x15b448){if(_0x15b448){var _0x30adee=typeof _0x16809e[_0x3086('0x16')]===_0x3086('0x17')&&typeof _0x16809e[_0x3086('0x18')]===_0x3086('0x17');var _0x3d870e=_0x15b448[_0x3086('0x19')];var _0x59c747=_0x30adee?0x0:_0x16809e[_0x3086('0x16')];var _0x4d58a7=_0x30adee?_0x15b448['count']:_0x16809e[_0x3086('0x16')]+_0x16809e[_0x3086('0x18')];var _0x5d8a4c;if(_0x4d58a7>=_0x3d870e){_0x4d58a7=_0x3d870e;_0x5d8a4c=0xc8;}else{_0x5d8a4c=0xce;}_0x41758b[_0x3086('0x13')](_0x5d8a4c);return _0x41758b[_0x3086('0x1a')](_0x3086('0x1b'),_0x59c747+'-'+_0x4d58a7+'/'+_0x3d870e)[_0x3086('0x15')](_0x15b448);}return null;};}function patchUpdates(_0x599879){return function(_0xe96b6e){try{jsonpatch[_0x3086('0x1c')](_0xe96b6e,_0x599879,!![]);}catch(_0x22d8fd){return BPromise[_0x3086('0x1d')](_0x22d8fd);}return _0xe96b6e[_0x3086('0x1e')]();};}function saveUpdates(_0x5e7255,_0x54fcc5){return function(_0x4eed42){if(_0x4eed42){return _0x4eed42[_0x3086('0x1f')](_0x5e7255)[_0x3086('0x20')](function(_0x3eaef9){return _0x3eaef9;});}return null;};}function removeEntity(_0x2510b9,_0xafb8f1){return function(_0x209785){if(_0x209785){return _0x209785[_0x3086('0x21')]()['then'](function(){_0x2510b9[_0x3086('0x13')](0xcc)[_0x3086('0x14')]();});}};}function handleEntityNotFound(_0x26b43a,_0x2f9e0f){return function(_0x56823b){if(!_0x56823b){_0x26b43a[_0x3086('0x12')](0x194);}return _0x56823b;};}function handleError(_0x46cc19,_0x55bd72){_0x55bd72=_0x55bd72||0x1f4;return function(_0x55a223){logger['error'](_0x55a223[_0x3086('0x22')]);if(_0x55a223[_0x3086('0x23')]){delete _0x55a223[_0x3086('0x23')];}_0x46cc19[_0x3086('0x13')](_0x55bd72)['send'](_0x55a223);};}exports[_0x3086('0x24')]=function(_0x562b96,_0x42211d){var _0x50fb82={},_0x16cc7d={},_0xf30228={'count':0x0,'rows':[]};var _0x2cd17b=_[_0x3086('0x25')](db[_0x3086('0x26')][_0x3086('0x27')],function(_0x7746c2){return{'name':_0x7746c2['fieldName'],'type':_0x7746c2[_0x3086('0x28')][_0x3086('0x29')]};});_0x16cc7d['model']=_[_0x3086('0x25')](_0x2cd17b,'name');_0x16cc7d[_0x3086('0x2a')]=_[_0x3086('0x2b')](_0x562b96[_0x3086('0x2a')]);_0x16cc7d[_0x3086('0x2c')]=_[_0x3086('0x2d')](_0x16cc7d['model'],_0x16cc7d[_0x3086('0x2a')]);_0x50fb82[_0x3086('0x2e')]=_[_0x3086('0x2d')](_0x16cc7d[_0x3086('0x2f')],qs['fields'](_0x562b96[_0x3086('0x2a')][_0x3086('0x30')]));_0x50fb82[_0x3086('0x2e')]=_0x50fb82[_0x3086('0x2e')][_0x3086('0x31')]?_0x50fb82[_0x3086('0x2e')]:_0x16cc7d['model'];if(!_0x562b96[_0x3086('0x2a')][_0x3086('0x32')](_0x3086('0x33'))){_0x50fb82[_0x3086('0x18')]=qs['limit'](_0x562b96[_0x3086('0x2a')]['limit']);_0x50fb82[_0x3086('0x16')]=qs[_0x3086('0x16')](_0x562b96[_0x3086('0x2a')][_0x3086('0x16')]);}_0x50fb82['order']=qs[_0x3086('0x34')](_0x562b96[_0x3086('0x2a')]['sort']);_0x50fb82[_0x3086('0x35')]=qs['filters'](_[_0x3086('0x36')](_0x562b96['query'],_0x16cc7d['filters']),_0x2cd17b);if(_0x562b96[_0x3086('0x2a')][_0x3086('0x37')]){_0x50fb82[_0x3086('0x35')]=_[_0x3086('0x38')](_0x50fb82['where'],{'$or':_[_0x3086('0x25')](_0x2cd17b,function(_0x25b26c){if(_0x25b26c[_0x3086('0x28')]!==_0x3086('0x39')){var _0x5105d5={};_0x5105d5[_0x25b26c[_0x3086('0x23')]]={'$like':'%'+_0x562b96[_0x3086('0x2a')][_0x3086('0x37')]+'%'};return _0x5105d5;}})});}_0x50fb82=_[_0x3086('0x38')]({},_0x50fb82,_0x562b96['options']);var _0x537df9={'where':_0x50fb82[_0x3086('0x35')]};return db[_0x3086('0x26')][_0x3086('0x19')](_0x537df9)[_0x3086('0x20')](function(_0x54b38c){_0xf30228['count']=_0x54b38c;if(_0x562b96['query'][_0x3086('0x3a')]){_0x50fb82['include']=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x50fb82);})[_0x3086('0x20')](function(_0x1e4b28){_0xf30228[_0x3086('0x3b')]=_0x1e4b28;return _0xf30228;})[_0x3086('0x20')](respondWithFilteredResult(_0x42211d,_0x50fb82))[_0x3086('0x3c')](handleError(_0x42211d,null));};exports[_0x3086('0x3d')]=function(_0x162f1e,_0x212f7a){var _0x224ea2={'raw':!![],'where':{'id':_0x162f1e[_0x3086('0x3e')]['id']}},_0x1e1434={};_0x1e1434[_0x3086('0x2f')]=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x1e1434[_0x3086('0x2a')]=_[_0x3086('0x2b')](_0x162f1e[_0x3086('0x2a')]);_0x1e1434[_0x3086('0x2c')]=_[_0x3086('0x2d')](_0x1e1434[_0x3086('0x2f')],_0x1e1434[_0x3086('0x2a')]);_0x224ea2['attributes']=_[_0x3086('0x2d')](_0x1e1434['model'],qs[_0x3086('0x30')](_0x162f1e[_0x3086('0x2a')][_0x3086('0x30')]));_0x224ea2[_0x3086('0x2e')]=_0x224ea2[_0x3086('0x2e')]['length']?_0x224ea2[_0x3086('0x2e')]:_0x1e1434[_0x3086('0x2f')];if(_0x162f1e[_0x3086('0x2a')][_0x3086('0x3a')]){_0x224ea2[_0x3086('0x3f')]=[{'all':!![]}];}_0x224ea2=_['merge']({},_0x224ea2,_0x162f1e[_0x3086('0x40')]);return db['VoiceTransferReport'][_0x3086('0x41')](_0x224ea2)['then'](handleEntityNotFound(_0x212f7a,null))['then'](respondWithResult(_0x212f7a,null))[_0x3086('0x3c')](handleError(_0x212f7a,null));};exports[_0x3086('0x42')]=function(_0x1686da,_0x1e6712){return db['VoiceTransferReport'][_0x3086('0x42')](_0x1686da['body'],{})[_0x3086('0x20')](respondWithResult(_0x1e6712,0xc9))[_0x3086('0x3c')](handleError(_0x1e6712,null));};exports['update']=function(_0xa33e3f,_0x52f4a0){if(_0xa33e3f[_0x3086('0x43')]['id']){delete _0xa33e3f[_0x3086('0x43')]['id'];}return db[_0x3086('0x26')][_0x3086('0x41')]({'where':{'id':_0xa33e3f[_0x3086('0x3e')]['id']}})[_0x3086('0x20')](handleEntityNotFound(_0x52f4a0,null))[_0x3086('0x20')](saveUpdates(_0xa33e3f[_0x3086('0x43')],null))[_0x3086('0x20')](respondWithResult(_0x52f4a0,null))['catch'](handleError(_0x52f4a0,null));};exports['destroy']=function(_0x8f9513,_0x282c66){return db[_0x3086('0x26')][_0x3086('0x41')]({'where':{'id':_0x8f9513[_0x3086('0x3e')]['id']}})[_0x3086('0x20')](handleEntityNotFound(_0x282c66,null))['then'](removeEntity(_0x282c66,null))[_0x3086('0x3c')](handleError(_0x282c66,null));};exports[_0x3086('0x44')]=function(_0x5ce383,_0x4a4ad0){return db[_0x3086('0x26')][_0x3086('0x44')]()[_0x3086('0x20')](respondWithResult(_0x4a4ad0,null))[_0x3086('0x3c')](handleError(_0x4a4ad0,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d2954ff..3b12990 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 _0x0ad1=['VoiceTransferReport','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x138d06,_0x33edf2){var _0x1a01eb=function(_0x387acb){while(--_0x387acb){_0x138d06['push'](_0x138d06['shift']());}};_0x1a01eb(++_0x33edf2);}(_0x0ad1,0x137));var _0x10ad=function(_0x298679,_0xcea593){_0x298679=_0x298679-0x0;var _0x1f8b52=_0x0ad1[_0x298679];return _0x1f8b52;};'use strict';var _=require(_0x10ad('0x0'));var util=require('util');var logger=require(_0x10ad('0x1'))('api');var moment=require(_0x10ad('0x2'));var BPromise=require(_0x10ad('0x3'));var rp=require(_0x10ad('0x4'));var fs=require('fs');var path=require(_0x10ad('0x5'));var rimraf=require(_0x10ad('0x6'));var config=require(_0x10ad('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x10ad('0x8')]=function(_0x14b9ad,_0x457793){return _0x14b9ad['define'](_0x10ad('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1170=['../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','api','bluebird','request-promise','rimraf'];(function(_0x754ed,_0x3d85cf){var _0x1eaa26=function(_0x24b2ac){while(--_0x24b2ac){_0x754ed['push'](_0x754ed['shift']());}};_0x1eaa26(++_0x3d85cf);}(_0x1170,0x166));var _0x0117=function(_0x4f391e,_0x3dd4c9){_0x4f391e=_0x4f391e-0x0;var _0x3d16f9=_0x1170[_0x4f391e];return _0x3d16f9;};'use strict';var _=require(_0x0117('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0117('0x1'));var moment=require('moment');var BPromise=require(_0x0117('0x2'));var rp=require(_0x0117('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0117('0x4'));var config=require(_0x0117('0x5'));var attributes=require(_0x0117('0x6'));module[_0x0117('0x7')]=function(_0x4f8614,_0x5e9023){return _0x4f8614[_0x0117('0x8')](_0x0117('0x9'),attributes,{'tableName':_0x0117('0xa'),'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 1a51a0f..052c9ab 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 _0x004c=['error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','create','raw','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x597c15,_0x59294e){var _0x2d6b32=function(_0x334788){while(--_0x334788){_0x597c15['push'](_0x597c15['shift']());}};_0x2d6b32(++_0x59294e);}(_0x004c,0x1de));var _0xc004=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x004c[_0x342baa];return _0x1208f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc004('0x0'));var BPromise=require(_0xc004('0x1'));var rs=require(_0xc004('0x2'));var fs=require('fs');var Redis=require(_0xc004('0x3'));var db=require(_0xc004('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc004('0x5'))(_0xc004('0x6'));var config=require('../../config/environment');var jayson=require(_0xc004('0x7'));var client=jayson[_0xc004('0x8')][_0xc004('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cabfe,_0x3511a2,_0x3f1f44){return new BPromise(function(_0x2abbfd,_0x1dfeb7){return client[_0xc004('0xa')](_0x1cabfe,_0x3f1f44)[_0xc004('0xb')](function(_0x41b838){logger[_0xc004('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x3511a2,_0xc004('0xd'));logger[_0xc004('0xe')](_0xc004('0xf'),_0x3511a2,_0xc004('0xd'),JSON['stringify'](_0x41b838));if(_0x41b838['error']){if(_0x41b838[_0xc004('0x10')][_0xc004('0x11')]===0x1f4){logger['error'](_0xc004('0x12'),_0x3511a2,_0x41b838[_0xc004('0x10')][_0xc004('0x13')]);return _0x1dfeb7(_0x41b838[_0xc004('0x10')]['message']);}logger[_0xc004('0x10')](_0xc004('0x12'),_0x3511a2,_0x41b838[_0xc004('0x10')][_0xc004('0x13')]);return _0x2abbfd(_0x41b838[_0xc004('0x10')][_0xc004('0x13')]);}else{logger[_0xc004('0xc')](_0xc004('0x12'),_0x3511a2,'request\x20sent');_0x2abbfd(_0x41b838[_0xc004('0x14')][_0xc004('0x13')]);}})[_0xc004('0x15')](function(_0xfa0527){logger[_0xc004('0x10')](_0xc004('0x12'),_0x3511a2,_0xfa0527);_0x1dfeb7(_0xfa0527);});});}exports[_0xc004('0x16')]=function(_0x391b51){var _0x4ff234=this;return new Promise(function(_0x3fc1d2,_0x497216){return db['VoiceTransferReport'][_0xc004('0x17')](_0x391b51['body'],{'raw':_0x391b51['options']?_0x391b51['options'][_0xc004('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x30dc1c){logger['info'](_0xc004('0x16'),_0x391b51);logger[_0xc004('0xe')](_0xc004('0x16'),_0x391b51,JSON[_0xc004('0x19')](_0x30dc1c));_0x3fc1d2(_0x30dc1c);})[_0xc004('0x15')](function(_0x5689c8){logger[_0xc004('0x10')](_0xc004('0x16'),_0x5689c8[_0xc004('0x13')],_0x391b51);_0x497216(_0x4ff234['error'](0x1f4,_0x5689c8[_0xc004('0x13')]));});});}; \ No newline at end of file +var _0x1cc6=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','then','lodash'];(function(_0x45235c,_0x28fa90){var _0x109afb=function(_0x60befa){while(--_0x60befa){_0x45235c['push'](_0x45235c['shift']());}};_0x109afb(++_0x28fa90);}(_0x1cc6,0x1af));var _0x61cc=function(_0x58fbb0,_0xe497b5){_0x58fbb0=_0x58fbb0-0x0;var _0x1783d2=_0x1cc6[_0x58fbb0];return _0x1783d2;};'use strict';var _=require(_0x61cc('0x0'));var util=require(_0x61cc('0x1'));var moment=require(_0x61cc('0x2'));var BPromise=require(_0x61cc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61cc('0x4'));var db=require(_0x61cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x61cc('0x6'))(_0x61cc('0x7'));var config=require(_0x61cc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x61cc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x287c13,_0x4b3149,_0x467282){return new BPromise(function(_0x15f7c9,_0x33e47e){return client[_0x61cc('0xa')](_0x287c13,_0x467282)['then'](function(_0x1cca16){logger[_0x61cc('0xb')](_0x61cc('0xc'),_0x4b3149,'request\x20sent');logger[_0x61cc('0xd')](_0x61cc('0xe'),_0x4b3149,_0x61cc('0xf'),JSON['stringify'](_0x1cca16));if(_0x1cca16[_0x61cc('0x10')]){if(_0x1cca16['error']['code']===0x1f4){logger[_0x61cc('0x10')](_0x61cc('0xc'),_0x4b3149,_0x1cca16[_0x61cc('0x10')]['message']);return _0x33e47e(_0x1cca16['error'][_0x61cc('0x11')]);}logger[_0x61cc('0x10')](_0x61cc('0xc'),_0x4b3149,_0x1cca16[_0x61cc('0x10')][_0x61cc('0x11')]);return _0x15f7c9(_0x1cca16[_0x61cc('0x10')][_0x61cc('0x11')]);}else{logger[_0x61cc('0xb')](_0x61cc('0xc'),_0x4b3149,_0x61cc('0xf'));_0x15f7c9(_0x1cca16['result'][_0x61cc('0x11')]);}})[_0x61cc('0x12')](function(_0x2a99d7){logger[_0x61cc('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x4b3149,_0x2a99d7);_0x33e47e(_0x2a99d7);});});}exports[_0x61cc('0x13')]=function(_0x3c29a9){var _0x3caca4=this;return new Promise(function(_0x108c6c,_0x5402c8){return db[_0x61cc('0x14')]['create'](_0x3c29a9[_0x61cc('0x15')],{'raw':_0x3c29a9[_0x61cc('0x16')]?_0x3c29a9[_0x61cc('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x61cc('0x17')](function(_0x1bc1bc){logger[_0x61cc('0xb')]('CreateVoiceTransferReport',_0x3c29a9);logger[_0x61cc('0xd')](_0x61cc('0x13'),_0x3c29a9,JSON['stringify'](_0x1bc1bc));_0x108c6c(_0x1bc1bc);})[_0x61cc('0x12')](function(_0x4f87c0){logger[_0x61cc('0x10')](_0x61cc('0x13'),_0x4f87c0[_0x61cc('0x11')],_0x3c29a9);_0x5402c8(_0x3caca4[_0x61cc('0x10')](0x1f4,_0x4f87c0['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index fc2bfbf..6a9c6eb 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 _0xb2fe=['exports','express','Router','post','isAuthenticated','originate','canUpdate','hangup','/answer','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer'];(function(_0xb119da,_0x42d325){var _0x3ecb48=function(_0x361539){while(--_0x361539){_0xb119da['push'](_0xb119da['shift']());}};_0x3ecb48(++_0x42d325);}(_0xb2fe,0x1c3));var _0xeb2f=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0xb2fe[_0x2f1114];return _0x2fe856;};'use strict';var express=require(_0xeb2f('0x0'));var router=express[_0xeb2f('0x1')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0xeb2f('0x2')]('/originate',auth[_0xeb2f('0x3')](),auth['canUpdate'](),controller[_0xeb2f('0x4')]);router[_0xeb2f('0x2')]('/hangup',auth[_0xeb2f('0x3')](),auth[_0xeb2f('0x5')](),controller[_0xeb2f('0x6')]);router[_0xeb2f('0x2')](_0xeb2f('0x7'),auth[_0xeb2f('0x3')](),auth['canUpdate'](),controller[_0xeb2f('0x8')]);router[_0xeb2f('0x2')](_0xeb2f('0x9'),auth['isAuthenticated'](),auth[_0xeb2f('0x5')](),controller[_0xeb2f('0xa')]);router['post'](_0xeb2f('0xb'),auth[_0xeb2f('0x3')](),auth[_0xeb2f('0x5')](),controller[_0xeb2f('0xc')]);router[_0xeb2f('0x2')](_0xeb2f('0xd'),auth[_0xeb2f('0x3')](),auth[_0xeb2f('0x5')](),controller[_0xeb2f('0xe')]);router[_0xeb2f('0x2')](_0xeb2f('0xf'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xeb2f('0x10')]);module[_0xeb2f('0x11')]=router; \ No newline at end of file +var _0x1676=['transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','canUpdate','originate','post','isAuthenticated','/answer','answer','/hold','/unhold','/calls','calls','/transfer'];(function(_0x3c218a,_0x4639c0){var _0x74913f=function(_0x5303fb){while(--_0x5303fb){_0x3c218a['push'](_0x3c218a['shift']());}};_0x74913f(++_0x4639c0);}(_0x1676,0x158));var _0x6167=function(_0x3fb81d,_0x33c9f5){_0x3fb81d=_0x3fb81d-0x0;var _0x59b675=_0x1676[_0x3fb81d];return _0x59b675;};'use strict';var express=require(_0x6167('0x0'));var router=express[_0x6167('0x1')]();var auth=require(_0x6167('0x2'));var controller=require(_0x6167('0x3'));router['post'](_0x6167('0x4'),auth['isAuthenticated'](),auth[_0x6167('0x5')](),controller[_0x6167('0x6')]);router[_0x6167('0x7')]('/hangup',auth[_0x6167('0x8')](),auth[_0x6167('0x5')](),controller['hangup']);router[_0x6167('0x7')](_0x6167('0x9'),auth[_0x6167('0x8')](),auth[_0x6167('0x5')](),controller[_0x6167('0xa')]);router[_0x6167('0x7')](_0x6167('0xb'),auth['isAuthenticated'](),auth[_0x6167('0x5')](),controller['hold']);router[_0x6167('0x7')](_0x6167('0xc'),auth[_0x6167('0x8')](),auth[_0x6167('0x5')](),controller['unhold']);router[_0x6167('0x7')](_0x6167('0xd'),auth['isAuthenticated'](),auth[_0x6167('0x5')](),controller[_0x6167('0xe')]);router[_0x6167('0x7')](_0x6167('0xf'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x6167('0x10')]);module[_0x6167('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 bc473c3..8675e4d 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 _0x5b02=['conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','jayson/promise','http','../../config/logger','webbarapi','ioredis','redis','localhost','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','all','filter','rows','UserId','sessionId','length','originate','originate\x20fired:','body','validate','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup\x20executed!','answer','answer\x20fired:','userId','webbar:answer','answer\x20executed!','hold','hold\x20fired:','unhold\x20fired:','calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','webbar:conference'];(function(_0x23292a,_0x1e08ea){var _0x4564f2=function(_0x1ae201){while(--_0x1ae201){_0x23292a['push'](_0x23292a['shift']());}};_0x4564f2(++_0x1e08ea);}(_0x5b02,0xe9));var _0x25b0=function(_0xee2556,_0x5267a8){_0xee2556=_0xee2556-0x0;var _0x305250=_0x5b02[_0xee2556];return _0x305250;};'use strict';var path=require(_0x25b0('0x0'));var fs=require('fs');var _=require(_0x25b0('0x1'));var db=require(_0x25b0('0x2'))['db'];var config=require(_0x25b0('0x3'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x25b0('0x4'));var amiClient=jayson['client'][_0x25b0('0x5')]({'port':0x232a});var logger=require(_0x25b0('0x6'))(_0x25b0('0x7'));var Redis=require(_0x25b0('0x8'));config[_0x25b0('0x9')]=_['defaults'](config[_0x25b0('0x9')],{'host':_0x25b0('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x25b0('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x25b0('0xb')]},'callNumber':{'type':_0x25b0('0xc'),'required':[!![],_0x25b0('0xd')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x25b0('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0x25b0('0xe'),'required':[!![],_0x25b0('0xb')]},'sessionId':{'type':_0x25b0('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x25b0('0xe'),'required':[!![],_0x25b0('0xb')]},'sessionId':{'type':_0x25b0('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x25b0('0xe'),'required':[!![],_0x25b0('0xb')]},'sessionId':{'type':_0x25b0('0xc'),'required':[!![],_0x25b0('0xf')]},'transferNumber':{'type':_0x25b0('0xc'),'required':[!![],_0x25b0('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x25b0('0xe'),'required':[!![],_0x25b0('0xb')]},'sessionId':{'type':_0x25b0('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x25b0('0xe'),'required':[!![],_0x25b0('0xb')]},'sessionId':{'type':_0x25b0('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x25b0('0xe'),'required':[!![],_0x25b0('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0xfe1ea6,_0x4b2357,_0xa8280a){logger[_0x25b0('0x11')](_0xfe1ea6,_0x4b2357,JSON[_0x25b0('0x12')](_0xa8280a));io['to'](_0xfe1ea6)[_0x25b0('0x13')](_0x4b2357,_0xa8280a);}function handleError(_0x5e3a3a){return function(_0x1d850f){console[_0x25b0('0x14')](_0x25b0('0x15'),_0x1d850f,_0x1d850f instanceof RangeError);logger[_0x25b0('0x16')](_0x1d850f[_0x25b0('0x17')]);if(_0x1d850f instanceof RangeError){if(_0x1d850f[_0x25b0('0x18')]){delete _0x1d850f['name'];}_0x5e3a3a[_0x25b0('0x19')](0x194)[_0x25b0('0x1a')](_0x1d850f);}else{if(_0x1d850f[_0x25b0('0x18')]){delete _0x1d850f[_0x25b0('0x18')];}_0x5e3a3a[_0x25b0('0x19')](0x1f4)[_0x25b0('0x1a')](_0x1d850f);}};}function checkError(){return function(_0x232be7){if(!_0x232be7){throw new RangeError(_0x25b0('0x1b'));}return _0x232be7;};}function respondWithRpcPromise(_0x7bdaf9,_0x35939f){return new BPromise(function(_0x2b2eda,_0x3ce1da){var _0x5cb746=amiClient;return _0x5cb746[_0x25b0('0x1c')](_0x7bdaf9,_0x35939f)[_0x25b0('0x1d')](function(_0x517ec5){if(_0x517ec5[_0x25b0('0x16')]){if(_0x517ec5[_0x25b0('0x16')][_0x25b0('0x1e')]===0x1f4){return _0x3ce1da(_0x517ec5['error']['message']);}return _0x2b2eda(_0x517ec5['error'][_0x25b0('0x1f')]);}else{_0x2b2eda(_0x517ec5[_0x25b0('0x20')]);}})[_0x25b0('0x21')](function(_0x24f847){_0x3ce1da(_0x24f847);});});}function getAgent(_0xdbb459){return db[_0x25b0('0x22')][_0x25b0('0x23')]({'where':{'id':_0xdbb459,'role':_0x25b0('0x24')}})[_0x25b0('0x1d')](checkError());}function getAgentCheckSession(_0x596d14,_0x2ea408){return new BPromise(function(_0xbfba84,_0x5ed7d2){var _0x567775=respondWithRpcPromise('VoiceChannels');var _0x1a6212=getAgent(_0x596d14);Promise[_0x25b0('0x25')]([_0x567775,_0x1a6212])[_0x25b0('0x1d')](function(_0x105129){var _0x214377=_0x105129[0x0];var _0x3285ae=_0x105129[0x1];var _0x12676b=_[_0x25b0('0x26')](_0x214377[_0x25b0('0x27')],function(_0x285a2b){return _0x285a2b[_0x25b0('0x28')]==_0x3285ae['id']&&_0x285a2b[_0x25b0('0x29')]==_0x2ea408;});if(_0x12676b[_0x25b0('0x2a')]==0x1){_0xbfba84(_0x3285ae);}else{_0x5ed7d2(new RangeError('sessionId\x20'+_0x2ea408+'\x20not\x20found!'));}});});}exports[_0x25b0('0x2b')]=function(_0x52eec1,_0x4dfeea){logger[_0x25b0('0x11')](_0x25b0('0x2c'),_0x52eec1[_0x25b0('0x2d')]);var _0x2338fa=originateValidation[_0x25b0('0x2e')](_0x52eec1['body']);if(_0x2338fa[_0x25b0('0x2a')]>0x0){return _0x4dfeea[_0x25b0('0x19')](0x190)['json'](_0x2338fa);}var _0x13ce9=_0x52eec1[_0x25b0('0x2d')]['userId'];var _0x215fb8=_0x52eec1['body'][_0x25b0('0x2f')];var _0x21f60e=_0x52eec1[_0x25b0('0x2d')][_0x25b0('0x30')];var _0x374bde=_0x52eec1[_0x25b0('0x2d')][_0x25b0('0x31')];return getAgent(_0x13ce9)[_0x25b0('0x1d')](function(_0x2f123c){logger['info'](_0x25b0('0x32'),_0x2f123c[_0x25b0('0x18')]);emit(util[_0x25b0('0x33')](_0x25b0('0x34'),_0x2f123c[_0x25b0('0x18')]),_0x25b0('0x35'),{'callNumber':_0x215fb8,'callerId':_0x21f60e,'callbackUrl':_0x374bde});return _0x4dfeea[_0x25b0('0x19')](0xc8)[_0x25b0('0x36')]({'error':![],'message':_0x25b0('0x37')});})[_0x25b0('0x21')](handleError(_0x4dfeea));};exports['hangup']=function(_0x282af9,_0x104b35){logger[_0x25b0('0x11')]('hangup\x20fired:',_0x282af9[_0x25b0('0x2d')]);var _0x42a0ed=hangupValidation[_0x25b0('0x2e')](_0x282af9[_0x25b0('0x2d')]);if(_0x42a0ed[_0x25b0('0x2a')]>0x0){return _0x104b35[_0x25b0('0x19')](0x190)[_0x25b0('0x36')](_0x42a0ed);}var _0x391493=_0x282af9['body']['userId'];var _0x447a18=_0x282af9[_0x25b0('0x2d')][_0x25b0('0x29')];return getAgent(_0x391493)['then'](function(_0x9c6ab4){logger['info'](_0x25b0('0x32'),_0x9c6ab4[_0x25b0('0x18')]);emit(util[_0x25b0('0x33')](_0x25b0('0x34'),_0x9c6ab4[_0x25b0('0x18')]),'webbar:hangup',{'sessionId':_0x447a18});return _0x104b35[_0x25b0('0x19')](0xc8)[_0x25b0('0x36')]({'error':![],'message':_0x25b0('0x38')});})[_0x25b0('0x21')](handleError(_0x104b35));};exports[_0x25b0('0x39')]=function(_0x5a9e86,_0x327659){logger[_0x25b0('0x11')](_0x25b0('0x3a'),_0x5a9e86[_0x25b0('0x2d')]);var _0x35fc00=answerValidation[_0x25b0('0x2e')](_0x5a9e86[_0x25b0('0x2d')]);if(_0x35fc00[_0x25b0('0x2a')]>0x0){return _0x327659[_0x25b0('0x19')](0x190)[_0x25b0('0x36')](_0x35fc00);}var _0x124d4b=_0x5a9e86['body'][_0x25b0('0x3b')];var _0x5cb047=_0x5a9e86[_0x25b0('0x2d')][_0x25b0('0x29')];return getAgent(_0x124d4b)[_0x25b0('0x1d')](function(_0x365805){logger['info'](_0x25b0('0x32'),_0x365805[_0x25b0('0x18')]);emit(util[_0x25b0('0x33')]('user:%s',_0x365805[_0x25b0('0x18')]),_0x25b0('0x3c'),{'sessionId':_0x5cb047});return _0x327659[_0x25b0('0x19')](0xc8)[_0x25b0('0x36')]({'error':![],'message':_0x25b0('0x3d')});})[_0x25b0('0x21')](handleError(_0x327659));};exports[_0x25b0('0x3e')]=function(_0x55ff4c,_0x3ad3b3){logger[_0x25b0('0x11')](_0x25b0('0x3f'),_0x55ff4c['body']);var _0xbaeb06=holdValidation[_0x25b0('0x2e')](_0x55ff4c[_0x25b0('0x2d')]);if(_0xbaeb06[_0x25b0('0x2a')]>0x0){return _0x3ad3b3[_0x25b0('0x19')](0x190)['json'](_0xbaeb06);}var _0x1e8a8d=_0x55ff4c[_0x25b0('0x2d')][_0x25b0('0x3b')];var _0x524e9a=_0x55ff4c[_0x25b0('0x2d')][_0x25b0('0x29')];return getAgent(_0x1e8a8d)[_0x25b0('0x1d')](function(_0x1d6d55){logger[_0x25b0('0x11')](_0x25b0('0x32'),_0x1d6d55['name']);emit(util['format']('user:%s',_0x1d6d55[_0x25b0('0x18')]),'webbar:hold',{'sessionId':_0x524e9a});return _0x3ad3b3['status'](0xc8)[_0x25b0('0x36')]({'error':![],'message':'hold\x20executed!'});})[_0x25b0('0x21')](handleError(_0x3ad3b3));};exports['unhold']=function(_0x4fc22d,_0x394e52){logger[_0x25b0('0x11')](_0x25b0('0x40'),_0x4fc22d[_0x25b0('0x2d')]);var _0x42d139=unholdValidation[_0x25b0('0x2e')](_0x4fc22d[_0x25b0('0x2d')]);if(_0x42d139[_0x25b0('0x2a')]>0x0){return _0x394e52[_0x25b0('0x19')](0x190)[_0x25b0('0x36')](_0x42d139);}var _0x48fb71=_0x4fc22d['body']['userId'];var _0xf1e6bf=_0x4fc22d[_0x25b0('0x2d')][_0x25b0('0x29')];return getAgent(_0x48fb71)[_0x25b0('0x1d')](function(_0x14db4c){logger[_0x25b0('0x11')](_0x25b0('0x32'),_0x14db4c['name']);emit(util[_0x25b0('0x33')]('user:%s',_0x14db4c[_0x25b0('0x18')]),'webbar:unhold',{'sessionId':_0xf1e6bf});return _0x394e52['status'](0xc8)[_0x25b0('0x36')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x394e52));};exports[_0x25b0('0x41')]=function(_0xe5dc47,_0x38e958){logger[_0x25b0('0x11')](_0x25b0('0x42'),_0x38e958[_0x25b0('0x2d')]);var _0x8bbdb3=callsValidation[_0x25b0('0x2e')](_0xe5dc47[_0x25b0('0x2d')]);if(_0x8bbdb3[_0x25b0('0x2a')]>0x0){return _0x38e958['status'](0x190)['json'](_0x8bbdb3);}var _0x163a05=_0xe5dc47[_0x25b0('0x2d')]['userId'];var _0xef5172=respondWithRpcPromise(_0x25b0('0x43'));var _0x176a1d=getAgent(_0x163a05);return Promise[_0x25b0('0x25')]([_0xef5172,_0x176a1d])[_0x25b0('0x1d')](function(_0x4cce6a){var _0x163a01=_0x4cce6a[0x0];var _0x2d1577=_0x4cce6a[0x1];var _0x135371=_['filter'](_0x163a01[_0x25b0('0x27')],function(_0x3f0516){return _0x3f0516[_0x25b0('0x28')]==_0x2d1577['id'];});return _0x38e958[_0x25b0('0x19')](0xc8)[_0x25b0('0x36')]({'count':_0x135371[_0x25b0('0x2a')],'rows':_0x135371});})[_0x25b0('0x21')](handleError(_0x38e958));};exports[_0x25b0('0x44')]=function(_0x28682b,_0x39a5e3){logger[_0x25b0('0x11')](_0x25b0('0x45'),_0x28682b[_0x25b0('0x2d')]);var _0x2c5995=conferenceValidation['validate'](_0x28682b[_0x25b0('0x2d')]);if(_0x2c5995[_0x25b0('0x2a')]>0x0){return _0x39a5e3['status'](0x190)[_0x25b0('0x36')](_0x2c5995);}var _0x4c089c=_0x28682b[_0x25b0('0x2d')][_0x25b0('0x3b')];return getAgent(_0x4c089c)['then'](function(_0x4513e8){logger[_0x25b0('0x11')](_0x25b0('0x32'),_0x4513e8['name']);emit(util[_0x25b0('0x33')]('user:%s',_0x4513e8[_0x25b0('0x18')]),_0x25b0('0x46'));return _0x39a5e3['status'](0xc8)[_0x25b0('0x36')]({'error':![],'message':_0x25b0('0x47')});})['catch'](handleError(_0x39a5e3));};exports[_0x25b0('0x48')]=function(_0x5b1aef,_0x5e7724){logger['info'](_0x25b0('0x49'),_0x5b1aef[_0x25b0('0x2d')]);var _0x2f1d4a=transferValidation['validate'](_0x5b1aef[_0x25b0('0x2d')]);if(_0x2f1d4a[_0x25b0('0x2a')]>0x0){return _0x5e7724[_0x25b0('0x19')](0x190)[_0x25b0('0x36')](_0x2f1d4a);}var _0x1e4c6e=_0x5b1aef[_0x25b0('0x2d')][_0x25b0('0x3b')];var _0x452f19=_0x5b1aef[_0x25b0('0x2d')][_0x25b0('0x29')];var _0x1fb191=_0x5b1aef[_0x25b0('0x2d')][_0x25b0('0x4a')];return getAgent(_0x1e4c6e)[_0x25b0('0x1d')](function(_0x1b0150){logger[_0x25b0('0x11')](_0x25b0('0x32'),_0x1b0150['name']);emit(util[_0x25b0('0x33')]('user:%s',_0x1b0150[_0x25b0('0x18')]),_0x25b0('0x4b'),{'sessionId':_0x452f19,'transferNumber':_0x1fb191});return _0x5e7724[_0x25b0('0x19')](0xc8)[_0x25b0('0x36')]({'error':![],'message':'transfer\x20executed!'});})[_0x25b0('0x21')](handleError(_0x5e7724));}; \ No newline at end of file +var _0x1b32=['emit','log','handleError:','error','name','status','send','NotFound','request','then','code','message','result','User','findOne','agent','all','filter','rows','UserId','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','validate','length','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup\x20fired:','hangup\x20executed!','catch','answer','answer\x20fired:','webbar:answer','hold','sessionId','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','string','callNumber\x20is\x20required','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info'];(function(_0x9add99,_0x3eda3b){var _0x482653=function(_0x3eeaa4){while(--_0x3eeaa4){_0x9add99['push'](_0x9add99['shift']());}};_0x482653(++_0x3eda3b);}(_0x1b32,0x85));var _0x21b3=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x1b32[_0x1a7846];return _0x48049;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x21b3('0x0'));var db=require(_0x21b3('0x1'))['db'];var config=require(_0x21b3('0x2'));var util=require(_0x21b3('0x3'));var BPromise=require(_0x21b3('0x4'));var jayson=require(_0x21b3('0x5'));var amiClient=jayson[_0x21b3('0x6')][_0x21b3('0x7')]({'port':0x232a});var logger=require(_0x21b3('0x8'))(_0x21b3('0x9'));var Redis=require(_0x21b3('0xa'));config[_0x21b3('0xb')]=_[_0x21b3('0xc')](config[_0x21b3('0xb')],{'host':_0x21b3('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x21b3('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0x12')]},'transferNumber':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x15662a,_0xe6b2b7,_0x29f286){logger[_0x21b3('0x14')](_0x15662a,_0xe6b2b7,JSON['stringify'](_0x29f286));io['to'](_0x15662a)[_0x21b3('0x15')](_0xe6b2b7,_0x29f286);}function handleError(_0x47ae6c){return function(_0x408c17){console[_0x21b3('0x16')](_0x21b3('0x17'),_0x408c17,_0x408c17 instanceof RangeError);logger[_0x21b3('0x18')](_0x408c17['stack']);if(_0x408c17 instanceof RangeError){if(_0x408c17[_0x21b3('0x19')]){delete _0x408c17[_0x21b3('0x19')];}_0x47ae6c[_0x21b3('0x1a')](0x194)['send'](_0x408c17);}else{if(_0x408c17[_0x21b3('0x19')]){delete _0x408c17[_0x21b3('0x19')];}_0x47ae6c[_0x21b3('0x1a')](0x1f4)[_0x21b3('0x1b')](_0x408c17);}};}function checkError(){return function(_0x360e57){if(!_0x360e57){throw new RangeError(_0x21b3('0x1c'));}return _0x360e57;};}function respondWithRpcPromise(_0x1e5181,_0x4cc8e0){return new BPromise(function(_0xbb78f3,_0x54695b){var _0x139672=amiClient;return _0x139672[_0x21b3('0x1d')](_0x1e5181,_0x4cc8e0)[_0x21b3('0x1e')](function(_0x4fcb87){if(_0x4fcb87[_0x21b3('0x18')]){if(_0x4fcb87['error'][_0x21b3('0x1f')]===0x1f4){return _0x54695b(_0x4fcb87[_0x21b3('0x18')][_0x21b3('0x20')]);}return _0xbb78f3(_0x4fcb87[_0x21b3('0x18')][_0x21b3('0x20')]);}else{_0xbb78f3(_0x4fcb87[_0x21b3('0x21')]);}})['catch'](function(_0x5b752c){_0x54695b(_0x5b752c);});});}function getAgent(_0x49aab8){return db[_0x21b3('0x22')][_0x21b3('0x23')]({'where':{'id':_0x49aab8,'role':_0x21b3('0x24')}})[_0x21b3('0x1e')](checkError());}function getAgentCheckSession(_0x18eba4,_0x58a356){return new BPromise(function(_0x170e78,_0x564313){var _0x16d012=respondWithRpcPromise('VoiceChannels');var _0x469e42=getAgent(_0x18eba4);Promise[_0x21b3('0x25')]([_0x16d012,_0x469e42])[_0x21b3('0x1e')](function(_0x4f6432){var _0x291e52=_0x4f6432[0x0];var _0x300977=_0x4f6432[0x1];var _0x336b1e=_[_0x21b3('0x26')](_0x291e52[_0x21b3('0x27')],function(_0x210c49){return _0x210c49[_0x21b3('0x28')]==_0x300977['id']&&_0x210c49['sessionId']==_0x58a356;});if(_0x336b1e['length']==0x1){_0x170e78(_0x300977);}else{_0x564313(new RangeError(_0x21b3('0x29')+_0x58a356+_0x21b3('0x2a')));}});});}exports['originate']=function(_0x45c753,_0xa04ac7){logger[_0x21b3('0x14')](_0x21b3('0x2b'),_0x45c753[_0x21b3('0x2c')]);var _0x6c56f5=originateValidation[_0x21b3('0x2d')](_0x45c753[_0x21b3('0x2c')]);if(_0x6c56f5[_0x21b3('0x2e')]>0x0){return _0xa04ac7['status'](0x190)['json'](_0x6c56f5);}var _0x18946f=_0x45c753['body'][_0x21b3('0x2f')];var _0x2d8c12=_0x45c753['body'][_0x21b3('0x30')];var _0x403cec=_0x45c753[_0x21b3('0x2c')][_0x21b3('0x31')];var _0x4c4239=_0x45c753[_0x21b3('0x2c')][_0x21b3('0x32')];return getAgent(_0x18946f)[_0x21b3('0x1e')](function(_0x118b9b){logger['info'](_0x21b3('0x33'),_0x118b9b['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x118b9b[_0x21b3('0x19')]),_0x21b3('0x36'),{'callNumber':_0x2d8c12,'callerId':_0x403cec,'callbackUrl':_0x4c4239});return _0xa04ac7[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x38')});})['catch'](handleError(_0xa04ac7));};exports['hangup']=function(_0x28641f,_0x86027e){logger[_0x21b3('0x14')](_0x21b3('0x39'),_0x28641f['body']);var _0x1c190e=hangupValidation[_0x21b3('0x2d')](_0x28641f[_0x21b3('0x2c')]);if(_0x1c190e[_0x21b3('0x2e')]>0x0){return _0x86027e[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x1c190e);}var _0xbb93cd=_0x28641f[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x3145b2=_0x28641f[_0x21b3('0x2c')]['sessionId'];return getAgent(_0xbb93cd)[_0x21b3('0x1e')](function(_0x321050){logger['info'](_0x21b3('0x33'),_0x321050['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x321050['name']),'webbar:hangup',{'sessionId':_0x3145b2});return _0x86027e['status'](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x3a')});})[_0x21b3('0x3b')](handleError(_0x86027e));};exports[_0x21b3('0x3c')]=function(_0x548652,_0x5d310c){logger[_0x21b3('0x14')](_0x21b3('0x3d'),_0x548652[_0x21b3('0x2c')]);var _0x28adbc=answerValidation[_0x21b3('0x2d')](_0x548652[_0x21b3('0x2c')]);if(_0x28adbc[_0x21b3('0x2e')]>0x0){return _0x5d310c['status'](0x190)[_0x21b3('0x37')](_0x28adbc);}var _0x44cf7d=_0x548652[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x119b43=_0x548652[_0x21b3('0x2c')]['sessionId'];return getAgent(_0x44cf7d)['then'](function(_0x1e7e1b){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0x1e7e1b['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x1e7e1b[_0x21b3('0x19')]),_0x21b3('0x3e'),{'sessionId':_0x119b43});return _0x5d310c[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':'answer\x20executed!'});})[_0x21b3('0x3b')](handleError(_0x5d310c));};exports[_0x21b3('0x3f')]=function(_0x3bc4ef,_0x4e3d2b){logger['info']('hold\x20fired:',_0x3bc4ef[_0x21b3('0x2c')]);var _0x17b878=holdValidation[_0x21b3('0x2d')](_0x3bc4ef[_0x21b3('0x2c')]);if(_0x17b878[_0x21b3('0x2e')]>0x0){return _0x4e3d2b[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x17b878);}var _0x30d48b=_0x3bc4ef[_0x21b3('0x2c')]['userId'];var _0x542ef4=_0x3bc4ef['body'][_0x21b3('0x40')];return getAgent(_0x30d48b)[_0x21b3('0x1e')](function(_0x4046cd){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0x4046cd[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x4046cd[_0x21b3('0x19')]),_0x21b3('0x41'),{'sessionId':_0x542ef4});return _0x4e3d2b['status'](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x42')});})[_0x21b3('0x3b')](handleError(_0x4e3d2b));};exports[_0x21b3('0x43')]=function(_0x34509e,_0x2c7019){logger[_0x21b3('0x14')](_0x21b3('0x44'),_0x34509e[_0x21b3('0x2c')]);var _0x58c568=unholdValidation[_0x21b3('0x2d')](_0x34509e[_0x21b3('0x2c')]);if(_0x58c568[_0x21b3('0x2e')]>0x0){return _0x2c7019[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x58c568);}var _0x5d7ee7=_0x34509e['body'][_0x21b3('0x2f')];var _0x4bd19f=_0x34509e[_0x21b3('0x2c')][_0x21b3('0x40')];return getAgent(_0x5d7ee7)[_0x21b3('0x1e')](function(_0x412536){logger['info']('entityFound:',_0x412536[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x412536[_0x21b3('0x19')]),'webbar:unhold',{'sessionId':_0x4bd19f});return _0x2c7019[_0x21b3('0x1a')](0xc8)['json']({'error':![],'message':_0x21b3('0x45')});})[_0x21b3('0x3b')](handleError(_0x2c7019));};exports['calls']=function(_0x5f55ff,_0x3fd841){logger[_0x21b3('0x14')](_0x21b3('0x46'),_0x3fd841[_0x21b3('0x2c')]);var _0xc612b5=callsValidation[_0x21b3('0x2d')](_0x5f55ff[_0x21b3('0x2c')]);if(_0xc612b5['length']>0x0){return _0x3fd841[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0xc612b5);}var _0x166a31=_0x5f55ff[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x49a40e=respondWithRpcPromise('VoiceChannels');var _0x31c8f8=getAgent(_0x166a31);return Promise[_0x21b3('0x25')]([_0x49a40e,_0x31c8f8])[_0x21b3('0x1e')](function(_0x279b7d){var _0x18582e=_0x279b7d[0x0];var _0x4f728=_0x279b7d[0x1];var _0x5b1611=_[_0x21b3('0x26')](_0x18582e[_0x21b3('0x27')],function(_0x552141){return _0x552141[_0x21b3('0x28')]==_0x4f728['id'];});return _0x3fd841['status'](0xc8)[_0x21b3('0x37')]({'count':_0x5b1611[_0x21b3('0x2e')],'rows':_0x5b1611});})[_0x21b3('0x3b')](handleError(_0x3fd841));};exports[_0x21b3('0x47')]=function(_0x542c4e,_0x193317){logger['info'](_0x21b3('0x48'),_0x542c4e[_0x21b3('0x2c')]);var _0x3d285f=conferenceValidation[_0x21b3('0x2d')](_0x542c4e[_0x21b3('0x2c')]);if(_0x3d285f['length']>0x0){return _0x193317[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x3d285f);}var _0x1821bf=_0x542c4e[_0x21b3('0x2c')][_0x21b3('0x2f')];return getAgent(_0x1821bf)[_0x21b3('0x1e')](function(_0xf6eb3){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0xf6eb3[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0xf6eb3[_0x21b3('0x19')]),_0x21b3('0x49'));return _0x193317[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x4a')});})[_0x21b3('0x3b')](handleError(_0x193317));};exports['transfer']=function(_0x412e3b,_0xc0c8f){logger[_0x21b3('0x14')]('transfer\x20fired:',_0x412e3b[_0x21b3('0x2c')]);var _0x3572e1=transferValidation[_0x21b3('0x2d')](_0x412e3b['body']);if(_0x3572e1[_0x21b3('0x2e')]>0x0){return _0xc0c8f[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x3572e1);}var _0x1655e4=_0x412e3b[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x2d33a7=_0x412e3b['body']['sessionId'];var _0x31c511=_0x412e3b['body'][_0x21b3('0x4b')];return getAgent(_0x1655e4)[_0x21b3('0x1e')](function(_0x164d9f){logger['info'](_0x21b3('0x33'),_0x164d9f[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x164d9f[_0x21b3('0x19')]),_0x21b3('0x4c'),{'sessionId':_0x2d33a7,'transferNumber':_0x31c511});return _0xc0c8f[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0xc0c8f));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 2b17a74..2f0c961 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 _0x524e=['index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','addDisposition','addAnswer','addApplications','/:id/notify','notify','/:id/send','put','update','delete','destroy','removeAnswers','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get'];(function(_0x4ea413,_0x51ff3a){var _0x51cf25=function(_0x3c6456){while(--_0x3c6456){_0x4ea413['push'](_0x4ea413['shift']());}};_0x51cf25(++_0x51ff3a);}(_0x524e,0x15e));var _0xe524=function(_0x5a9e79,_0x5799de){_0x5a9e79=_0x5a9e79-0x0;var _0x5cca9c=_0x524e[_0x5a9e79];return _0x5cca9c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x9')](_0xe524('0x10'),auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x9')](_0xe524('0x12'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x9')](_0xe524('0x14'),auth[_0xe524('0xe')](),controller['getAgents']);router['get'](_0xe524('0x15'),auth[_0xe524('0xe')](),controller[_0xe524('0x16')]);router[_0xe524('0x17')]('/',auth[_0xe524('0xe')](),controller['create']);router[_0xe524('0x17')]('/:id/dispositions',auth[_0xe524('0xe')](),controller[_0xe524('0x18')]);router['post'](_0xe524('0x12'),auth['isAuthenticated'](),controller[_0xe524('0x19')]);router['post'](_0xe524('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['post'](_0xe524('0x15'),auth['isAuthenticated'](),controller[_0xe524('0x1a')]);router[_0xe524('0x17')](_0xe524('0x1b'),controller[_0xe524('0x1c')]);router['post'](_0xe524('0x1d'),auth[_0xe524('0xe')](),controller['send']);router[_0xe524('0x1e')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x1f')]);router[_0xe524('0x20')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x21')]);router[_0xe524('0x20')]('/:id/dispositions',auth[_0xe524('0xe')](),controller['removeDispositions']);router['delete'](_0xe524('0x12'),auth[_0xe524('0xe')](),controller[_0xe524('0x22')]);router[_0xe524('0x20')]('/:id/users',auth[_0xe524('0xe')](),controller['removeAgents']);module[_0xe524('0x23')]=router; \ No newline at end of file +var _0xe3da=['/:id/send','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/notify','notify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0xb')](_0xae3d('0x11'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x12')]);router[_0xae3d('0xb')]('/:id/canned_answers',auth[_0xae3d('0xc')](),controller['getAnswers']);router[_0xae3d('0xb')](_0xae3d('0x13'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x14')]);router['get'](_0xae3d('0x15'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x16')]);router[_0xae3d('0x17')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0x18')]);router[_0xae3d('0x17')]('/:id/dispositions',auth[_0xae3d('0xc')](),controller[_0xae3d('0x19')]);router[_0xae3d('0x17')](_0xae3d('0x1a'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x1b')]);router['post'](_0xae3d('0x13'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x1c')]);router['post'](_0xae3d('0x15'),auth[_0xae3d('0xc')](),controller['addApplications']);router['post'](_0xae3d('0x1d'),controller[_0xae3d('0x1e')]);router[_0xae3d('0x17')](_0xae3d('0x1f'),auth[_0xae3d('0xc')](),controller['send']);router[_0xae3d('0x20')]('/:id',auth[_0xae3d('0xc')](),controller[_0xae3d('0x21')]);router[_0xae3d('0x22')](_0xae3d('0x23'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x24')]);router[_0xae3d('0x22')](_0xae3d('0x11'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x25')]);router[_0xae3d('0x22')](_0xae3d('0x1a'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x26')]);router[_0xae3d('0x22')](_0xae3d('0x13'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x27')]);module[_0xae3d('0x28')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 1cbf1e7..922ea09 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 _0x952e=['BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','twilio','TEXT','INTEGER'];(function(_0x4a494d,_0x2e3e04){var _0x5222ae=function(_0x1a317b){while(--_0x1a317b){_0x4a494d['push'](_0x4a494d['shift']());}};_0x5222ae(++_0x2e3e04);}(_0x952e,0x1bf));var _0xe952=function(_0x491501,_0x38538d){_0x491501=_0x491501-0x0;var _0x2cbdcc=_0x952e[_0x491501];return _0x2cbdcc;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xe952('0x0'));module[_0xe952('0x1')]={'name':{'type':Sequelize[_0xe952('0x2')],'unique':_0xe952('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xe952('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xe952('0x2')],'defaultValue':function(){return rs[_0xe952('0x4')]();}},'phone':{'type':Sequelize[_0xe952('0x2')]},'type':{'type':Sequelize['ENUM'](_0xe952('0x5'))},'accountSid':{'type':Sequelize[_0xe952('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xe952('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe952('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe952('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe952('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe952('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe952('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe952('0x8')],'defaultValue':![],'comment':_0xe952('0x9'),'set':function(_0x423297){if(!_0x423297){this[_0xe952('0xa')](_0xe952('0xb'),null);}this[_0xe952('0xa')](_0xe952('0xc'),_0x423297);}},'description':{'type':Sequelize[_0xe952('0x2')]}}; \ No newline at end of file +var _0x84a6=['sequelize','STRING','generate','twilio','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x50c06e,_0x14cfde){var _0x49ec59=function(_0x1ee336){while(--_0x1ee336){_0x50c06e['push'](_0x50c06e['shift']());}};_0x49ec59(++_0x14cfde);}(_0x84a6,0x150));var _0x684a=function(_0xa305f7,_0x15ebf5){_0xa305f7=_0xa305f7-0x0;var _0x1a63c4=_0x84a6[_0xa305f7];return _0x1a63c4;};'use strict';var Sequelize=require(_0x684a('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x684a('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x684a('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x684a('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x684a('0x2')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x684a('0x3'))},'accountSid':{'type':Sequelize[_0x684a('0x1')]},'authToken':{'type':Sequelize[_0x684a('0x1')]},'notificationTemplate':{'type':Sequelize[_0x684a('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x684a('0x5')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x684a('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x684a('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x684a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x684a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x684a('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x684a('0x8'),'set':function(_0x1fd682){if(!_0x1fd682){this[_0x684a('0x9')](_0x684a('0xa'),null);}this[_0x684a('0x9')](_0x684a('0xb'),_0x1fd682);}},'description':{'type':Sequelize[_0x684a('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 8eb837f..98b99dc 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 _0x33cc=['receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','to\x20is\x20mandatory','List','out','Messages','dataValues','push','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','end','status','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','destroy','get','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','create','body','user','role','WhatsappAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','WhatsappAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','WhatsappApplication','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','Body','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','defaults','CmContact','WhatsappInteraction','interaction','created','autoclose','close','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','Start','startRouting'];(function(_0x5df893,_0x578e66){var _0xb5e6ce=function(_0x2b4aca){while(--_0x2b4aca){_0x5df893['push'](_0x5df893['shift']());}};_0xb5e6ce(++_0x578e66);}(_0x33cc,0x178));var _0xc33c=function(_0x26896f,_0x4edf8c){_0x26896f=_0x26896f-0x0;var _0xa4850a=_0x33cc[_0x26896f];return _0xa4850a;};'use strict';var emlformat=require(_0xc33c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc33c('0x1'));var jsonpatch=require(_0xc33c('0x2'));var rp=require('request-promise');var moment=require(_0xc33c('0x3'));var BPromise=require(_0xc33c('0x4'));var Mustache=require(_0xc33c('0x5'));var util=require('util');var path=require(_0xc33c('0x6'));var sox=require(_0xc33c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc33c('0x8'));var _=require(_0xc33c('0x9'));var squel=require(_0xc33c('0xa'));var crypto=require(_0xc33c('0xb'));var jsforce=require(_0xc33c('0xc'));var deskjs=require(_0xc33c('0xd'));var toCsv=require(_0xc33c('0xe'));var querystring=require(_0xc33c('0xf'));var Papa=require(_0xc33c('0x10'));var Redis=require('ioredis');var authService=require(_0xc33c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc33c('0x12'));var hardwareService=require(_0xc33c('0x13'));var logger=require('../../config/logger')(_0xc33c('0x14'));var utils=require(_0xc33c('0x15'));var config=require(_0xc33c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc33c('0x17'))['db'];config[_0xc33c('0x18')]=_['defaults'](config['redis'],{'host':_0xc33c('0x19'),'port':0x18eb});var socket=require(_0xc33c('0x1a'))(new Redis(config[_0xc33c('0x18')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0xc33c('0x1b'));var client=jayson['client'][_0xc33c('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x32de81,_0x51f805,_0x2b5167,_0x1c9b91){return new BPromise(function(_0x36ce16,_0x5c5f25){var _0x52a1c1=_0x1c9b91||client;return _0x52a1c1[_0xc33c('0x1d')](_0x32de81,_0x2b5167)[_0xc33c('0x1e')](function(_0x40232d){logger['info'](_0xc33c('0x1f'),_0x51f805,_0xc33c('0x20'));logger[_0xc33c('0x21')](_0xc33c('0x22'),_0x51f805,_0xc33c('0x20'),JSON['stringify'](_0x40232d));if(_0x40232d[_0xc33c('0x23')]){if(_0x40232d[_0xc33c('0x23')][_0xc33c('0x24')]===0x1f4){logger[_0xc33c('0x23')](_0xc33c('0x1f'),_0x51f805,_0x40232d['error'][_0xc33c('0x25')]);return _0x5c5f25(_0x40232d[_0xc33c('0x23')][_0xc33c('0x25')]);}logger[_0xc33c('0x23')](_0xc33c('0x1f'),_0x51f805,_0x40232d[_0xc33c('0x23')][_0xc33c('0x25')]);return _0x36ce16(_0x40232d['error'][_0xc33c('0x25')]);}else{logger[_0xc33c('0x26')](_0xc33c('0x1f'),_0x51f805,_0xc33c('0x20'));_0x36ce16(_0x40232d[_0xc33c('0x27')][_0xc33c('0x25')]);}})[_0xc33c('0x28')](function(_0x1092a3){logger['error'](_0xc33c('0x1f'),_0x51f805,_0x1092a3);_0x5c5f25(_0x1092a3);});});}function respondWithStatusCode(_0x2fce2c,_0x21ac89){_0x21ac89=_0x21ac89||0xcc;return function(_0xdbe92a){if(_0xdbe92a){return _0x2fce2c[_0xc33c('0x29')](_0x21ac89);}return _0x2fce2c['status'](_0x21ac89)[_0xc33c('0x2a')]();};}function respondWithResult(_0x4c0220,_0x3468f4){_0x3468f4=_0x3468f4||0xc8;return function(_0x1a9825){if(_0x1a9825){return _0x4c0220[_0xc33c('0x2b')](_0x3468f4)['json'](_0x1a9825);}};}function respondWithFilteredResult(_0x47dbe5,_0x112f4a){return function(_0x32a9ee){if(_0x32a9ee){var _0x3a8423=typeof _0x112f4a['offset']===_0xc33c('0x2c')&&typeof _0x112f4a[_0xc33c('0x2d')]==='undefined';var _0x76e10a=_0x32a9ee['count'];var _0x39d18c=_0x3a8423?0x0:_0x112f4a[_0xc33c('0x2e')];var _0x151595=_0x3a8423?_0x32a9ee[_0xc33c('0x2f')]:_0x112f4a[_0xc33c('0x2e')]+_0x112f4a[_0xc33c('0x2d')];var _0x5eaf6d;if(_0x151595>=_0x76e10a){_0x151595=_0x76e10a;_0x5eaf6d=0xc8;}else{_0x5eaf6d=0xce;}_0x47dbe5[_0xc33c('0x2b')](_0x5eaf6d);return _0x47dbe5['set'](_0xc33c('0x30'),_0x39d18c+'-'+_0x151595+'/'+_0x76e10a)[_0xc33c('0x31')](_0x32a9ee);}return null;};}function patchUpdates(_0x2894fe){return function(_0x2f6b98){try{jsonpatch[_0xc33c('0x32')](_0x2f6b98,_0x2894fe,!![]);}catch(_0x185c27){return BPromise[_0xc33c('0x33')](_0x185c27);}return _0x2f6b98[_0xc33c('0x34')]();};}function saveUpdates(_0x59494d,_0x5506e0){return function(_0xe82252){if(_0xe82252){return _0xe82252[_0xc33c('0x35')](_0x59494d)[_0xc33c('0x1e')](function(_0x219b2b){return _0x219b2b;});}return null;};}function removeEntity(_0x9f83,_0x312aa1){return function(_0x2bd0d5){if(_0x2bd0d5){return _0x2bd0d5[_0xc33c('0x36')]()[_0xc33c('0x1e')](function(){var _0x417f7a=_0x2bd0d5[_0xc33c('0x37')]({'plain':!![]});var _0x7701d0='WhatsappAccounts';return db[_0xc33c('0x38')][_0xc33c('0x36')]({'where':{'type':_0x7701d0,'resourceId':_0x417f7a['id']}})['then'](function(){return _0x2bd0d5;});})['then'](function(){_0x9f83['status'](0xcc)[_0xc33c('0x2a')]();});}};}function handleEntityNotFound(_0x4f1abe,_0x2e16fd){return function(_0x5b1a0e){if(!_0x5b1a0e){_0x4f1abe[_0xc33c('0x29')](0x194);}return _0x5b1a0e;};}function handleError(_0x5eb768,_0x3a869c){_0x3a869c=_0x3a869c||0x1f4;return function(_0x357553){logger[_0xc33c('0x23')](_0x357553['stack']);if(_0x357553[_0xc33c('0x39')]){delete _0x357553['name'];}_0x5eb768[_0xc33c('0x2b')](_0x3a869c)[_0xc33c('0x3a')](_0x357553);};}exports['index']=function(_0x8cb5de,_0x4b8e3c){var _0x12edb2={'include':[{'model':db[_0xc33c('0x3b')],'as':_0xc33c('0x3c')}]},_0x54f319={},_0xf8cdd8={'count':0x0,'rows':[]};var _0x4b0b91=_[_0xc33c('0x3d')](db[_0xc33c('0x3e')][_0xc33c('0x3f')],function(_0x1dfef7){return{'name':_0x1dfef7[_0xc33c('0x40')],'type':_0x1dfef7[_0xc33c('0x41')][_0xc33c('0x42')]};});_0x54f319[_0xc33c('0x43')]=_[_0xc33c('0x3d')](_0x4b0b91,_0xc33c('0x39'));_0x54f319[_0xc33c('0x44')]=_[_0xc33c('0x45')](_0x8cb5de[_0xc33c('0x44')]);_0x54f319['filters']=_[_0xc33c('0x46')](_0x54f319['model'],_0x54f319[_0xc33c('0x44')]);_0x12edb2['attributes']=_[_0xc33c('0x46')](_0x54f319[_0xc33c('0x43')],qs[_0xc33c('0x47')](_0x8cb5de[_0xc33c('0x44')]['fields']));_0x12edb2['attributes']=_0x12edb2[_0xc33c('0x48')][_0xc33c('0x49')]?_0x12edb2[_0xc33c('0x48')]:_0x54f319[_0xc33c('0x43')];if(!_0x8cb5de['query']['hasOwnProperty'](_0xc33c('0x4a'))){_0x12edb2[_0xc33c('0x2d')]=qs[_0xc33c('0x2d')](_0x8cb5de[_0xc33c('0x44')][_0xc33c('0x2d')]);_0x12edb2['offset']=qs['offset'](_0x8cb5de[_0xc33c('0x44')][_0xc33c('0x2e')]);}_0x12edb2[_0xc33c('0x4b')]=qs[_0xc33c('0x4c')](_0x8cb5de[_0xc33c('0x44')][_0xc33c('0x4c')]);_0x12edb2[_0xc33c('0x4d')]=qs['filters'](_[_0xc33c('0x4e')](_0x8cb5de[_0xc33c('0x44')],_0x54f319[_0xc33c('0x4f')]),_0x4b0b91);if(_0x8cb5de[_0xc33c('0x44')][_0xc33c('0x50')]){_0x12edb2[_0xc33c('0x4d')]=_[_0xc33c('0x51')](_0x12edb2[_0xc33c('0x4d')],{'$or':_[_0xc33c('0x3d')](_0x4b0b91,function(_0x30acb4){if(_0x30acb4['type']!==_0xc33c('0x52')){var _0x3e69a7={};_0x3e69a7[_0x30acb4[_0xc33c('0x39')]]={'$like':'%'+_0x8cb5de['query']['filter']+'%'};return _0x3e69a7;}})});}_0x12edb2=_['merge']({},_0x12edb2,_0x8cb5de[_0xc33c('0x53')]);var _0x402840={'where':_0x12edb2['where']};return db[_0xc33c('0x3e')][_0xc33c('0x2f')](_0x402840)[_0xc33c('0x1e')](function(_0x424437){_0xf8cdd8[_0xc33c('0x2f')]=_0x424437;if(_0x8cb5de['query']['includeAll']){_0x12edb2[_0xc33c('0x54')]=[{'all':!![]}];}return db[_0xc33c('0x3e')][_0xc33c('0x55')](_0x12edb2);})['then'](function(_0xe2cfab){_0xf8cdd8[_0xc33c('0x56')]=_0xe2cfab;return _0xf8cdd8;})[_0xc33c('0x1e')](respondWithFilteredResult(_0x4b8e3c,_0x12edb2))[_0xc33c('0x28')](handleError(_0x4b8e3c,null));};exports['show']=function(_0x1505e6,_0x2453b3){var _0x287fb6={'raw':![],'where':{'id':_0x1505e6[_0xc33c('0x57')]['id']},'include':[{'model':db[_0xc33c('0x3b')],'as':_0xc33c('0x3c')}]},_0x440127={};_0x440127[_0xc33c('0x43')]=_[_0xc33c('0x45')](db[_0xc33c('0x3e')][_0xc33c('0x3f')]);_0x440127[_0xc33c('0x44')]=_[_0xc33c('0x45')](_0x1505e6[_0xc33c('0x44')]);_0x440127[_0xc33c('0x4f')]=_[_0xc33c('0x46')](_0x440127[_0xc33c('0x43')],_0x440127['query']);_0x287fb6[_0xc33c('0x48')]=_[_0xc33c('0x46')](_0x440127[_0xc33c('0x43')],qs[_0xc33c('0x47')](_0x1505e6[_0xc33c('0x44')][_0xc33c('0x47')]));_0x287fb6[_0xc33c('0x48')]=_0x287fb6[_0xc33c('0x48')][_0xc33c('0x49')]?_0x287fb6[_0xc33c('0x48')]:_0x440127[_0xc33c('0x43')];if(_0x1505e6['query'][_0xc33c('0x58')]){_0x287fb6['include']=[{'all':!![]}];}_0x287fb6=_[_0xc33c('0x51')]({},_0x287fb6,_0x1505e6[_0xc33c('0x53')]);return db[_0xc33c('0x3e')][_0xc33c('0x59')](_0x287fb6)[_0xc33c('0x1e')](handleEntityNotFound(_0x2453b3,null))[_0xc33c('0x1e')](respondWithResult(_0x2453b3,null))[_0xc33c('0x28')](handleError(_0x2453b3,null));};exports[_0xc33c('0x5a')]=function(_0x535f9d,_0x3ff9b2){return db[_0xc33c('0x3e')][_0xc33c('0x5a')](_0x535f9d[_0xc33c('0x5b')],{})[_0xc33c('0x1e')](function(_0x930234){var _0x232b0d=_0x535f9d[_0xc33c('0x5c')][_0xc33c('0x37')]({'plain':!![]});if(!_0x232b0d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x232b0d[_0xc33c('0x5d')]===_0xc33c('0x5c')){var _0x29edea=_0x930234[_0xc33c('0x37')]({'plain':!![]});var _0xbbbf99=_0xc33c('0x5e');return db[_0xc33c('0x5f')]['find']({'where':{'name':_0xbbbf99,'userProfileId':_0x232b0d['userProfileId']},'raw':!![]})[_0xc33c('0x1e')](function(_0x2da9e3){if(_0x2da9e3&&_0x2da9e3[_0xc33c('0x60')]===0x0){return db[_0xc33c('0x38')][_0xc33c('0x5a')]({'name':_0x29edea['name'],'resourceId':_0x29edea['id'],'type':_0x2da9e3[_0xc33c('0x39')],'sectionId':_0x2da9e3['id']},{})[_0xc33c('0x1e')](function(){return _0x930234;});}else{return _0x930234;}})['catch'](function(_0x3a9bba){logger['error'](_0xc33c('0x61'),_0x3a9bba);throw _0x3a9bba;});}return _0x930234;})[_0xc33c('0x1e')](respondWithResult(_0x3ff9b2,0xc9))['catch'](handleError(_0x3ff9b2,null));};exports[_0xc33c('0x35')]=function(_0x4a1d7f,_0x4895d6){if(_0x4a1d7f[_0xc33c('0x5b')]['id']){delete _0x4a1d7f['body']['id'];}return db[_0xc33c('0x3e')]['find']({'where':{'id':_0x4a1d7f[_0xc33c('0x57')]['id']},'include':[{'model':db[_0xc33c('0x3b')],'as':_0xc33c('0x3c')}]})[_0xc33c('0x1e')](handleEntityNotFound(_0x4895d6,null))[_0xc33c('0x1e')](saveUpdates(_0x4a1d7f[_0xc33c('0x5b')],null))[_0xc33c('0x1e')](respondWithResult(_0x4895d6,null))['catch'](handleError(_0x4895d6,null));};exports[_0xc33c('0x36')]=function(_0x38e657,_0x2195e3){return db[_0xc33c('0x3e')][_0xc33c('0x59')]({'where':{'id':_0x38e657['params']['id']}})[_0xc33c('0x1e')](handleEntityNotFound(_0x2195e3,null))[_0xc33c('0x1e')](removeEntity(_0x2195e3,null))[_0xc33c('0x28')](handleError(_0x2195e3,null));};exports[_0xc33c('0x62')]=function(_0x7ffe7e,_0x90386d){return db['WhatsappAccount'][_0xc33c('0x62')]()[_0xc33c('0x1e')](respondWithResult(_0x90386d,null))[_0xc33c('0x28')](handleError(_0x90386d,null));};exports[_0xc33c('0x63')]=function(_0x5ab236,_0x24b1fa,_0x1a812a){if(_0x5ab236[_0xc33c('0x5b')]['id']){delete _0x5ab236[_0xc33c('0x5b')]['id'];}return db[_0xc33c('0x3e')][_0xc33c('0x59')]({'where':{'id':_0x5ab236[_0xc33c('0x57')]['id']}})['then'](handleEntityNotFound(_0x24b1fa,null))[_0xc33c('0x1e')](function(_0x4800a8){if(_0x4800a8){_0x5ab236[_0xc33c('0x5b')]['WhatsappAccountId']=_0x4800a8['id'];return db[_0xc33c('0x64')][_0xc33c('0x5a')](_0x5ab236[_0xc33c('0x5b')]);}})[_0xc33c('0x1e')](respondWithResult(_0x24b1fa,null))[_0xc33c('0x28')](handleError(_0x24b1fa,null));};exports[_0xc33c('0x65')]=function(_0x3e3c0e,_0x486966,_0x467d71){var _0x638bd={'raw':![],'where':{}};var _0x1b4a88={};var _0x5c4b50={'count':0x0,'rows':[]};return db[_0xc33c('0x3e')][_0xc33c('0x66')]({'where':{'id':_0x3e3c0e[_0xc33c('0x57')]['id']}})[_0xc33c('0x1e')](handleEntityNotFound(_0x486966,null))[_0xc33c('0x1e')](function(_0x21342f){if(_0x21342f){_0x1b4a88[_0xc33c('0x43')]=_['keys'](db[_0xc33c('0x64')][_0xc33c('0x3f')]);_0x1b4a88['query']=_[_0xc33c('0x45')](_0x3e3c0e[_0xc33c('0x44')]);_0x1b4a88[_0xc33c('0x4f')]=_[_0xc33c('0x46')](_0x1b4a88['model'],_0x1b4a88['query']);_0x638bd[_0xc33c('0x48')]=_[_0xc33c('0x46')](_0x1b4a88['model'],qs[_0xc33c('0x47')](_0x3e3c0e[_0xc33c('0x44')][_0xc33c('0x47')]));_0x638bd['attributes']=_0x638bd[_0xc33c('0x48')][_0xc33c('0x49')]?_0x638bd['attributes']:_0x1b4a88[_0xc33c('0x43')];if(!_0x3e3c0e['query'][_0xc33c('0x67')](_0xc33c('0x4a'))){_0x638bd[_0xc33c('0x2d')]=qs['limit'](_0x3e3c0e['query'][_0xc33c('0x2d')]);_0x638bd[_0xc33c('0x2e')]=qs[_0xc33c('0x2e')](_0x3e3c0e[_0xc33c('0x44')][_0xc33c('0x2e')]);}_0x638bd[_0xc33c('0x4b')]=qs[_0xc33c('0x4c')](_0x3e3c0e[_0xc33c('0x44')][_0xc33c('0x4c')]);_0x638bd[_0xc33c('0x4d')]=qs['filters'](_['pick'](_0x3e3c0e[_0xc33c('0x44')],_0x1b4a88[_0xc33c('0x4f')]));_0x638bd['where'][_0xc33c('0x68')]=_0x21342f['id'];if(_0x3e3c0e[_0xc33c('0x44')][_0xc33c('0x50')]){_0x638bd['where']=_[_0xc33c('0x51')](_0x638bd[_0xc33c('0x4d')],{'$or':_[_0xc33c('0x3d')](_0x638bd['attributes'],function(_0x554d80){var _0x4fecca={};_0x4fecca[_0x554d80]={'$like':'%'+_0x3e3c0e[_0xc33c('0x44')][_0xc33c('0x50')]+'%'};return _0x4fecca;})});}_0x638bd=_[_0xc33c('0x51')]({},_0x638bd,_0x3e3c0e[_0xc33c('0x53')]);return db['Disposition'][_0xc33c('0x2f')]({'where':_0x638bd[_0xc33c('0x4d')]})[_0xc33c('0x1e')](function(_0x3dfc09){_0x5c4b50[_0xc33c('0x2f')]=_0x3dfc09;if(_0x3e3c0e['query'][_0xc33c('0x58')]){_0x638bd[_0xc33c('0x54')]=[{'all':!![]}];}return db[_0xc33c('0x64')][_0xc33c('0x55')](_0x638bd);})[_0xc33c('0x1e')](function(_0x15fbbb){_0x5c4b50[_0xc33c('0x56')]=_0x15fbbb;return _0x5c4b50;});}})['then'](respondWithFilteredResult(_0x486966,_0x638bd))[_0xc33c('0x28')](handleError(_0x486966,null));};exports[_0xc33c('0x69')]=function(_0x27ef44,_0x5952cf,_0x10091e){return db[_0xc33c('0x3e')][_0xc33c('0x59')]({'where':{'id':_0x27ef44[_0xc33c('0x57')]['id']}})[_0xc33c('0x1e')](handleEntityNotFound(_0x5952cf,null))['then'](function(_0x226f92){if(_0x226f92){return _0x226f92['removeDispositions'](_0x27ef44[_0xc33c('0x44')][_0xc33c('0x6a')]);}})['then'](respondWithStatusCode(_0x5952cf,null))['catch'](handleError(_0x5952cf,null));};exports[_0xc33c('0x6b')]=function(_0x23bfb9,_0x258352,_0x134abf){if(_0x23bfb9['body']['id']){delete _0x23bfb9['body']['id'];}return db[_0xc33c('0x3e')][_0xc33c('0x59')]({'where':{'id':_0x23bfb9['params']['id']}})[_0xc33c('0x1e')](handleEntityNotFound(_0x258352,null))[_0xc33c('0x1e')](function(_0x12136b){if(_0x12136b){_0x23bfb9[_0xc33c('0x5b')][_0xc33c('0x68')]=_0x12136b['id'];return db['CannedAnswer'][_0xc33c('0x5a')](_0x23bfb9['body']);}})['then'](respondWithResult(_0x258352,null))[_0xc33c('0x28')](handleError(_0x258352,null));};exports[_0xc33c('0x6c')]=function(_0x31a995,_0x1e7ef2,_0x393121){var _0x35e163={'raw':![],'where':{}};var _0xdfe40c={};var _0x5956c2={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xc33c('0x66')]({'where':{'id':_0x31a995[_0xc33c('0x57')]['id']}})[_0xc33c('0x1e')](handleEntityNotFound(_0x1e7ef2,null))[_0xc33c('0x1e')](function(_0x2003f8){if(_0x2003f8){_0xdfe40c[_0xc33c('0x43')]=_[_0xc33c('0x45')](db[_0xc33c('0x6d')][_0xc33c('0x3f')]);_0xdfe40c[_0xc33c('0x44')]=_['keys'](_0x31a995[_0xc33c('0x44')]);_0xdfe40c['filters']=_['intersection'](_0xdfe40c[_0xc33c('0x43')],_0xdfe40c[_0xc33c('0x44')]);_0x35e163[_0xc33c('0x48')]=_[_0xc33c('0x46')](_0xdfe40c[_0xc33c('0x43')],qs[_0xc33c('0x47')](_0x31a995[_0xc33c('0x44')][_0xc33c('0x47')]));_0x35e163['attributes']=_0x35e163[_0xc33c('0x48')][_0xc33c('0x49')]?_0x35e163[_0xc33c('0x48')]:_0xdfe40c[_0xc33c('0x43')];if(!_0x31a995[_0xc33c('0x44')][_0xc33c('0x67')](_0xc33c('0x4a'))){_0x35e163[_0xc33c('0x2d')]=qs[_0xc33c('0x2d')](_0x31a995[_0xc33c('0x44')][_0xc33c('0x2d')]);_0x35e163[_0xc33c('0x2e')]=qs['offset'](_0x31a995[_0xc33c('0x44')][_0xc33c('0x2e')]);}_0x35e163['order']=qs['sort'](_0x31a995[_0xc33c('0x44')][_0xc33c('0x4c')]);_0x35e163['where']=qs['filters'](_[_0xc33c('0x4e')](_0x31a995[_0xc33c('0x44')],_0xdfe40c[_0xc33c('0x4f')]));_0x35e163[_0xc33c('0x4d')][_0xc33c('0x68')]=_0x2003f8['id'];if(_0x31a995[_0xc33c('0x44')]['filter']){_0x35e163['where']=_[_0xc33c('0x51')](_0x35e163[_0xc33c('0x4d')],{'$or':_['map'](_0x35e163['attributes'],function(_0x568cd3){var _0x4305d0={};_0x4305d0[_0x568cd3]={'$like':'%'+_0x31a995[_0xc33c('0x44')][_0xc33c('0x50')]+'%'};return _0x4305d0;})});}_0x35e163=_[_0xc33c('0x51')]({},_0x35e163,_0x31a995[_0xc33c('0x53')]);return db[_0xc33c('0x6d')][_0xc33c('0x2f')]({'where':_0x35e163[_0xc33c('0x4d')]})[_0xc33c('0x1e')](function(_0x1e7250){_0x5956c2['count']=_0x1e7250;if(_0x31a995[_0xc33c('0x44')][_0xc33c('0x58')]){_0x35e163['include']=[{'all':!![]}];}return db[_0xc33c('0x6d')][_0xc33c('0x55')](_0x35e163);})['then'](function(_0x2cebaa){_0x5956c2[_0xc33c('0x56')]=_0x2cebaa;return _0x5956c2;});}})[_0xc33c('0x1e')](respondWithFilteredResult(_0x1e7ef2,_0x35e163))['catch'](handleError(_0x1e7ef2,null));};exports[_0xc33c('0x6e')]=function(_0x46a79f,_0x266ee0,_0xacafc6){return db[_0xc33c('0x3e')][_0xc33c('0x59')]({'where':{'id':_0x46a79f[_0xc33c('0x57')]['id']}})['then'](handleEntityNotFound(_0x266ee0,null))['then'](function(_0x58823e){if(_0x58823e){return _0x58823e['removeAnswers'](_0x46a79f[_0xc33c('0x44')][_0xc33c('0x6a')]);}})[_0xc33c('0x1e')](respondWithStatusCode(_0x266ee0,null))[_0xc33c('0x28')](handleError(_0x266ee0,null));};exports[_0xc33c('0x6f')]=function(_0x10cd55,_0x34fb50,_0x8a52a1){return db[_0xc33c('0x3e')][_0xc33c('0x59')]({'where':{'id':_0x10cd55[_0xc33c('0x57')]['id']}})['then'](handleEntityNotFound(_0x34fb50,null))[_0xc33c('0x1e')](function(_0x2534f9){if(_0x2534f9){return _0x2534f9[_0xc33c('0x6f')](_0x10cd55[_0xc33c('0x5b')][_0xc33c('0x6a')],_[_0xc33c('0x70')](_0x10cd55[_0xc33c('0x5b')],[_0xc33c('0x6a'),'id'])||{})[_0xc33c('0x71')](function(_0x1438cf){for(var _0x108019=0x0;_0x108019<_0x10cd55[_0xc33c('0x5b')][_0xc33c('0x6a')]['length'];_0x108019+=0x1){socket[_0xc33c('0x72')](_0xc33c('0x73'),{'UserId':Number(_0x10cd55[_0xc33c('0x5b')]['ids'][_0x108019]),'WhatsappAccountId':Number(_0x10cd55[_0xc33c('0x57')]['id'])});}return _0x1438cf;});}})[_0xc33c('0x1e')](respondWithResult(_0x34fb50,null))[_0xc33c('0x28')](handleError(_0x34fb50,null));};exports[_0xc33c('0x74')]=function(_0x46476d,_0x485f13,_0x1e23fa){return db[_0xc33c('0x3e')][_0xc33c('0x59')]({'where':{'id':_0x46476d[_0xc33c('0x57')]['id']}})[_0xc33c('0x1e')](handleEntityNotFound(_0x485f13,null))[_0xc33c('0x1e')](function(_0x4c65bf){if(_0x4c65bf){return _0x4c65bf[_0xc33c('0x74')](_0x46476d[_0xc33c('0x44')][_0xc33c('0x6a')])[_0xc33c('0x1e')](function(){if(_[_0xc33c('0x75')](_0x46476d['query'][_0xc33c('0x6a')])){for(var _0x38c939=0x0;_0x38c939<_0x46476d['query'][_0xc33c('0x6a')][_0xc33c('0x49')];_0x38c939+=0x1){socket[_0xc33c('0x72')](_0xc33c('0x76'),{'UserId':Number(_0x46476d[_0xc33c('0x44')][_0xc33c('0x6a')][_0x38c939]),'WhatsappAccountId':Number(_0x46476d[_0xc33c('0x57')]['id'])});}}else{socket[_0xc33c('0x72')](_0xc33c('0x76'),{'UserId':Number(_0x46476d[_0xc33c('0x44')][_0xc33c('0x6a')]),'WhatsappAccountId':Number(_0x46476d[_0xc33c('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x485f13,null))[_0xc33c('0x28')](handleError(_0x485f13,null));};exports['getAgents']=function(_0x484d7e,_0x8fc44a,_0x17d610){var _0x5a5261={};var _0x37602d={};var _0x2525ad;var _0x51e5fe;return db[_0xc33c('0x3e')]['findOne']({'where':{'id':_0x484d7e['params']['id']}})['then'](handleEntityNotFound(_0x8fc44a,null))[_0xc33c('0x1e')](function(_0x34045b){if(_0x34045b){_0x2525ad=_0x34045b;_0x37602d[_0xc33c('0x43')]=_[_0xc33c('0x45')](db[_0xc33c('0x77')][_0xc33c('0x3f')]);_0x37602d[_0xc33c('0x44')]=_[_0xc33c('0x45')](_0x484d7e[_0xc33c('0x44')]);_0x37602d[_0xc33c('0x4f')]=_[_0xc33c('0x46')](_0x37602d[_0xc33c('0x43')],_0x37602d[_0xc33c('0x44')]);_0x5a5261['attributes']=_[_0xc33c('0x46')](_0x37602d[_0xc33c('0x43')],qs[_0xc33c('0x47')](_0x484d7e[_0xc33c('0x44')][_0xc33c('0x47')]));_0x5a5261['attributes']=_0x5a5261['attributes'][_0xc33c('0x49')]?_0x5a5261[_0xc33c('0x48')]:_0x37602d[_0xc33c('0x43')];_0x5a5261[_0xc33c('0x4b')]=qs['sort'](_0x484d7e[_0xc33c('0x44')][_0xc33c('0x4c')]);_0x5a5261[_0xc33c('0x4d')]=qs[_0xc33c('0x4f')](_[_0xc33c('0x4e')](_0x484d7e[_0xc33c('0x44')],_0x37602d[_0xc33c('0x4f')]));if(_0x484d7e[_0xc33c('0x44')][_0xc33c('0x50')]){_0x5a5261[_0xc33c('0x4d')]=_[_0xc33c('0x51')](_0x5a5261[_0xc33c('0x4d')],{'$or':_['map'](_0x5a5261['attributes'],function(_0x46a077){var _0x3649ec={};_0x3649ec[_0x46a077]={'$like':'%'+_0x484d7e[_0xc33c('0x44')][_0xc33c('0x50')]+'%'};return _0x3649ec;})});}_0x5a5261=_[_0xc33c('0x51')]({},_0x5a5261,_0x484d7e[_0xc33c('0x53')]);return _0x2525ad[_0xc33c('0x78')](_0x5a5261);}})[_0xc33c('0x1e')](function(_0x715623){if(_0x715623){_0x51e5fe=_0x715623[_0xc33c('0x49')];if(!_0x484d7e[_0xc33c('0x44')]['hasOwnProperty'](_0xc33c('0x4a'))){_0x5a5261[_0xc33c('0x2d')]=qs[_0xc33c('0x2d')](_0x484d7e[_0xc33c('0x44')]['limit']);_0x5a5261[_0xc33c('0x2e')]=qs[_0xc33c('0x2e')](_0x484d7e[_0xc33c('0x44')][_0xc33c('0x2e')]);}return _0x2525ad[_0xc33c('0x78')](_0x5a5261);}})[_0xc33c('0x1e')](function(_0x3ae64a){if(_0x3ae64a){return _0x3ae64a?{'count':_0x51e5fe,'rows':_0x3ae64a}:null;}})[_0xc33c('0x1e')](respondWithResult(_0x8fc44a,null))[_0xc33c('0x28')](handleError(_0x8fc44a,null));};exports['addApplications']=function(_0x323d49,_0x1b1d49,_0x2a5de4){return db[_0xc33c('0x3e')][_0xc33c('0x66')]({'where':{'id':_0x323d49[_0xc33c('0x57')]['id']}})['then'](handleEntityNotFound(_0x1b1d49,null))[_0xc33c('0x1e')](function(_0x246aa7){if(_0x246aa7){return db['sequelize']['transaction'](function(_0x290dbf){return db[_0xc33c('0x79')]['destroy']({'where':{'WhatsappAccountId':_0x323d49[_0xc33c('0x57')]['id']},'transaction':_0x290dbf})[_0xc33c('0x1e')](function(_0x5468aa){var _0x540bc3=_['map'](_0x323d49[_0xc33c('0x5b')],function(_0x1eddaf){_0x1eddaf[_0xc33c('0x68')]=_0x323d49[_0xc33c('0x57')]['id'];return _0x1eddaf;});return db['WhatsappApplication']['bulkCreate'](_0x540bc3,{'transaction':_0x290dbf});});})['then'](function(){return db['WhatsappApplication'][_0xc33c('0x7a')]({'where':{'WhatsappAccountId':_0x323d49[_0xc33c('0x57')]['id']},'order':_0xc33c('0x7b')});});}})[_0xc33c('0x1e')](respondWithResult(_0x1b1d49,null))[_0xc33c('0x28')](handleError(_0x1b1d49,null));};exports['getApplications']=function(_0x11542d,_0x34efbb,_0x19b135){var _0xc7c5bb={};var _0x30f9b0={};var _0x4cf765;var _0x2d4cfc;return db[_0xc33c('0x3e')][_0xc33c('0x66')]({'where':{'id':_0x11542d['params']['id']}})[_0xc33c('0x1e')](handleEntityNotFound(_0x34efbb,null))['then'](function(_0x25a754){if(_0x25a754){_0x4cf765=_0x25a754;_0x30f9b0[_0xc33c('0x43')]=_[_0xc33c('0x45')](db[_0xc33c('0x79')]['rawAttributes']);_0x30f9b0[_0xc33c('0x44')]=_['keys'](_0x11542d[_0xc33c('0x44')]);_0x30f9b0[_0xc33c('0x4f')]=_['intersection'](_0x30f9b0['model'],_0x30f9b0[_0xc33c('0x44')]);_0xc7c5bb[_0xc33c('0x48')]=_[_0xc33c('0x46')](_0x30f9b0['model'],qs['fields'](_0x11542d[_0xc33c('0x44')]['fields']));_0xc7c5bb[_0xc33c('0x48')]=_0xc7c5bb[_0xc33c('0x48')]['length']?_0xc7c5bb[_0xc33c('0x48')]:_0x30f9b0['model'];_0xc7c5bb['order']=qs[_0xc33c('0x4c')](_0x11542d['query'][_0xc33c('0x4c')]);_0xc7c5bb[_0xc33c('0x4d')]=qs[_0xc33c('0x4f')](_[_0xc33c('0x4e')](_0x11542d[_0xc33c('0x44')],_0x30f9b0['filters']));if(_0x11542d[_0xc33c('0x44')][_0xc33c('0x50')]){_0xc7c5bb[_0xc33c('0x4d')]=_[_0xc33c('0x51')](_0xc7c5bb[_0xc33c('0x4d')],{'$or':_[_0xc33c('0x3d')](_0xc7c5bb['attributes'],function(_0x316a30){var _0x3e7500={};_0x3e7500[_0x316a30]={'$like':'%'+_0x11542d[_0xc33c('0x44')]['filter']+'%'};return _0x3e7500;})});}_0xc7c5bb=_[_0xc33c('0x51')]({},_0xc7c5bb,_0x11542d['options']);return _0x4cf765[_0xc33c('0x7c')](_0xc7c5bb);}})[_0xc33c('0x1e')](function(_0x1d08b3){if(_0x1d08b3){_0x2d4cfc=_0x1d08b3[_0xc33c('0x49')];if(!_0x11542d[_0xc33c('0x44')][_0xc33c('0x67')](_0xc33c('0x4a'))){_0xc7c5bb[_0xc33c('0x2d')]=qs[_0xc33c('0x2d')](_0x11542d[_0xc33c('0x44')][_0xc33c('0x2d')]);_0xc7c5bb[_0xc33c('0x2e')]=qs['offset'](_0x11542d[_0xc33c('0x44')][_0xc33c('0x2e')]);}return _0x4cf765[_0xc33c('0x7c')](_0xc7c5bb);}})[_0xc33c('0x1e')](function(_0x1b42b8){if(_0x1b42b8){return _0x1b42b8?{'count':_0x2d4cfc,'rows':_0x1b42b8}:null;}})[_0xc33c('0x1e')](respondWithResult(_0x34efbb,null))[_0xc33c('0x28')](handleError(_0x34efbb,null));};exports[_0xc33c('0x7d')]=function(_0xe8e6ef,_0x14c4fa,_0x290c5a){var _0x1329c0={'channel':_0xc33c('0x7e')};var _0x269356=[];var _0x2cded6=[];var _0x45f690={};return db[_0xc33c('0x3e')]['find']({'where':{'id':_0xe8e6ef[_0xc33c('0x57')]['id']},'include':[{'model':db[_0xc33c('0x79')],'as':_0xc33c('0x7f')}]})[_0xc33c('0x1e')](handleEntityNotFound(_0x14c4fa,null))['then'](function(_0x346e01){_0x1329c0[_0xc33c('0x80')]=_0x346e01;_0x1329c0[_0xc33c('0x81')]=_['orderBy'](_0x346e01[_0xc33c('0x7f')],[_0xc33c('0x7b')],[_0xc33c('0x82')]);if(_0x1329c0[_0xc33c('0x80')][_0xc33c('0x7f')]){delete _0x1329c0['account'][_0xc33c('0x7f')];}return db['CmContact'][_0xc33c('0x62')]();})[_0xc33c('0x1e')](function(_0x35dfb2){if(!_0x35dfb2){throw new db[(_0xc33c('0x83'))][(_0xc33c('0x84'))](_0xc33c('0x85'));}_0x269356=_[_0xc33c('0x86')](_[_0xc33c('0x45')](_0x35dfb2),[_0xc33c('0x87'),_0xc33c('0x88')]);_0x2cded6=_[_0xc33c('0x86')](_[_0xc33c('0x45')](_0x35dfb2),['createdAt',_0xc33c('0x88'),_0xc33c('0x89'),_0xc33c('0x8a')]);_0x1329c0[_0xc33c('0x5b')]={'mapKey':_0xc33c('0x8b')};if(_0x1329c0[_0xc33c('0x80')][_0xc33c('0x41')]&&_0x1329c0[_0xc33c('0x80')][_0xc33c('0x41')]===_0xc33c('0x8c')){_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x8d')]=_0xe8e6ef[_0xc33c('0x5b')][_0xc33c('0x8e')]['replace'](_0xc33c('0x8f'),'');_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x5b')]=_0xe8e6ef[_0xc33c('0x5b')][_0xc33c('0x90')];_0x1329c0['body'][_0xc33c('0x91')]=_0xe8e6ef[_0xc33c('0x5b')]['MessageSid'];}if(_0x1329c0['body']['id']){delete _0x1329c0[_0xc33c('0x5b')]['id'];}if(_[_0xc33c('0x92')](_0x1329c0['body'][_0xc33c('0x8d')])){throw new db[(_0xc33c('0x83'))][(_0xc33c('0x84'))](_0xc33c('0x93'));}if(_[_0xc33c('0x92')](_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x5b')])||_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x5b')]===''){throw new db[(_0xc33c('0x83'))][(_0xc33c('0x84'))](_0xc33c('0x94'));}if(_[_0xc33c('0x92')](_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x95')])){throw new db['Sequelize'][(_0xc33c('0x84'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2cded6);}if(!_[_0xc33c('0x96')](_0x2cded6,_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x95')])){throw new db[(_0xc33c('0x83'))][(_0xc33c('0x84'))](_0xc33c('0x97')+_0x2cded6);}_0x45f690[_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x95')]]=_0x1329c0[_0xc33c('0x5b')]['from'];return db[_0xc33c('0x98')][_0xc33c('0x59')]({'where':{'id':_0x1329c0[_0xc33c('0x80')][_0xc33c('0x8a')]},'include':[{'model':db['CmContact'],'as':_0xc33c('0x99'),'where':_0x45f690,'limit':0x1,'order':[[_0xc33c('0x88'),'DESC']]}]});})[_0xc33c('0x1e')](handleEntityNotFound(_0x14c4fa,null))[_0xc33c('0x1e')](function(_0x5bd5a2){if(_0x5bd5a2){_0x1329c0[_0xc33c('0x9a')]=_[_0xc33c('0x70')](_0x5bd5a2,[_0xc33c('0x99')]);if(_0x5bd5a2[_0xc33c('0x99')]['length']){return _0x5bd5a2[_0xc33c('0x99')][0x0];}var _0x3384a1=_[_0xc33c('0x9b')](_0x1329c0[_0xc33c('0x5b')],{'firstName':_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x8d')],'ListId':_0x5bd5a2['id']});_0x3384a1[_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x95')]]=_0x1329c0[_0xc33c('0x5b')]['from'];return db[_0xc33c('0x9c')]['create'](_0x3384a1,{'fields':_0x269356,'raw':!![]});}})['then'](handleEntityNotFound(_0x14c4fa,null))['then'](function(_0x21bc56){if(_0x21bc56){_0x1329c0['contact']=_0x21bc56;var _0xdbafc9={'ContactId':_0x21bc56['id'],'phone':_0x1329c0['body'][_0xc33c('0x8d')],'WhatsappAccountId':_0xe8e6ef[_0xc33c('0x57')]['id']};var _0x58ece2={'ContactId':_0x21bc56['id'],'WhatsappAccountId':_0xe8e6ef[_0xc33c('0x57')]['id'],'closed':![]};return db[_0xc33c('0x9d')]['find']({'where':_0x58ece2})[_0xc33c('0x1e')](function(_0x5ab336){if(_0x5ab336){return[_0x5ab336,![]];}return db['WhatsappInteraction'][_0xc33c('0x5a')](_0xdbafc9)[_0xc33c('0x1e')](function(_0x1ac774){return[_0x1ac774,!![]];});});}})['spread'](function(_0x376cec,_0x32fafa){_0x1329c0[_0xc33c('0x9e')]=_0x376cec[_0xc33c('0x37')]({'plain':!![]});_0x1329c0[_0xc33c('0x9e')][_0xc33c('0x9f')]=![];if(_0x32fafa){if(_0x1329c0[_0xc33c('0x80')][_0xc33c('0xa0')]){_0x1329c0[_0xc33c('0x81')]['push']({'id':0x0,'priority':_0x1329c0[_0xc33c('0x81')][_0xc33c('0x49')]+0x1,'app':_0xc33c('0xa1'),'appdata':'unmanaged','interval':_0xc33c('0xa2')});}_0x1329c0[_0xc33c('0x9e')]['created']=!![];}return db[_0xc33c('0xa3')]['create']({'phone':_0x1329c0[_0xc33c('0x5b')]['from'],'messageId':_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x91')],'body':_0x1329c0[_0xc33c('0x5b')][_0xc33c('0x5b')],'WhatsappAccountId':_0xe8e6ef[_0xc33c('0x57')]['id'],'WhatsappInteractionId':_0x376cec['id'],'direction':'in','ContactId':_0x376cec[_0xc33c('0xa4')],'AttachmentId':_0x1329c0[_0xc33c('0x5b')][_0xc33c('0xa5')]});})[_0xc33c('0x1e')](function(_0x3392da){_0x1329c0[_0xc33c('0x25')]=_0x3392da;if(_0x1329c0[_0xc33c('0x9e')][_0xc33c('0xa6')]){return db[_0xc33c('0x77')][_0xc33c('0x59')]({'attributes':['id',_0xc33c('0x39')],'where':{'id':_0x1329c0[_0xc33c('0x9e')][_0xc33c('0xa6')]}})['then'](function(_0x1dde14){if(_0x1dde14){_0x1329c0['applications'][_0xc33c('0xa7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1dde14['name']+','+(_0x1329c0[_0xc33c('0x80')]['waitForTheAssignedAgent']||0xa),'interval':_0xc33c('0xa2')});}return respondWithRpcPromise(_0xc33c('0xa8'),'startRouting',_0x1329c0);});}return respondWithRpcPromise('Start',_0xc33c('0xa9'),_0x1329c0);})[_0xc33c('0x1e')](function(_0x4b0b0b){if(_0x4b0b0b){var _0x6993a5=0xc8;var _0x3da34e=_0xc33c('0xaa');logger['info'](_0xc33c('0x22'),_0x3da34e,_0x6993a5,_0xc33c('0xab'));logger['debug'](_0xc33c('0xac'),_0x3da34e,_0x6993a5,_0xc33c('0xab'),JSON['stringify'](_0x4b0b0b));if(_0x1329c0[_0xc33c('0x80')][_0xc33c('0x41')]===_0xc33c('0x8c')){return _0x14c4fa[_0xc33c('0x2b')](_0x6993a5)[_0xc33c('0xad')](_0xc33c('0xae'),_0xc33c('0xaf'))[_0xc33c('0x3a')]('\x0a');}else{return _0x14c4fa['status'](_0x6993a5)[_0xc33c('0x31')](_0x4b0b0b);}}})['catch'](handleError(_0x14c4fa,null));};exports[_0xc33c('0x3a')]=function(_0x1b93f6,_0x2b1997,_0x411f3a){var _0x521c07,_0x46be99,_0x531d6d;if(_['isNil'](_0x1b93f6[_0xc33c('0x5b')]['body'])||_0x1b93f6[_0xc33c('0x5b')][_0xc33c('0x5b')]===''){throw new db['Sequelize']['ValidationError'](_0xc33c('0x94'));}if(_[_0xc33c('0x92')](_0x1b93f6[_0xc33c('0x5b')]['to'])){throw new db[(_0xc33c('0x83'))][(_0xc33c('0x84'))](_0xc33c('0xb0'));}_0x521c07=_0x1b93f6['body']['to'];return db[_0xc33c('0x3e')][_0xc33c('0x59')]({'where':{'id':_0x1b93f6[_0xc33c('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0xc33c('0xb1'),'include':[{'model':db[_0xc33c('0x9c')],'as':'Contacts','where':{'mobile':_0x521c07},'limit':0x1,'order':[[_0xc33c('0x88'),'DESC']]}]}]})[_0xc33c('0x1e')](handleEntityNotFound(_0x2b1997,null))[_0xc33c('0x1e')](function(_0x3d2064){if(_0x3d2064&&_0x3d2064[_0xc33c('0xb1')]){_0x46be99=_0x3d2064[_0xc33c('0x37')]({'plain':!![]});if(_0x46be99[_0xc33c('0xb1')]&&_0x46be99[_0xc33c('0xb1')]['Contacts'][_0xc33c('0x49')]){return _0x46be99[_0xc33c('0xb1')]['Contacts'][0x0];}return db[_0xc33c('0x9c')][_0xc33c('0x5a')](_['defaults'](_0x1b93f6['body'],{'firstName':_0x521c07,'mobile':_0x521c07,'phone':_0x521c07,'ListId':_0x46be99[_0xc33c('0x8a')]}));}})['then'](handleEntityNotFound(_0x2b1997,null))[_0xc33c('0x1e')](function(_0x416a59){if(_0x416a59){_0x531d6d=_0x416a59;return db[_0xc33c('0x9d')][_0xc33c('0x59')]({'where':{'ContactId':_0x531d6d['id'],'closed':![],'WhatsappAccountId':_0x46be99['id']}})[_0xc33c('0x1e')](function(_0x2712f1){if(_0x2712f1){return[_0x2712f1,![]];}return db[_0xc33c('0x9d')]['create']({'UserId':_0x1b93f6[_0xc33c('0x5c')]['id'],'ContactId':_0x531d6d['id'],'WhatsappAccountId':_0x46be99['id'],'phone':_0x521c07,'firstMsgDirection':_0xc33c('0xb2'),'Messages':[_[_0xc33c('0x51')](_0x1b93f6[_0xc33c('0x5b')],{'read':![],'body':_0x1b93f6['body'][_0xc33c('0x5b')],'phone':_0x521c07,'WhatsappAccountId':_0x46be99['id'],'UserId':_0x1b93f6['user']['id'],'ContactId':_0x531d6d['id']})]},{'include':[{'model':db[_0xc33c('0xa3')],'as':_0xc33c('0xb3')}]})[_0xc33c('0x1e')](function(_0x57e21b){return[_0x57e21b,!![]];});});}})['spread'](function(_0xb9b12d,_0x171953){if(_0x171953){return _0xb9b12d;}return db['WhatsappMessage']['create'](_[_0xc33c('0x51')](_0x1b93f6[_0xc33c('0x5b')],{'read':![],'body':_0x1b93f6['body'][_0xc33c('0x5b')],'phone':_0x521c07,'WhatsappAccountId':_0x46be99['id'],'WhatsappInteractionId':_0xb9b12d['id'],'UserId':_0x1b93f6[_0xc33c('0x5c')]['id'],'ContactId':_0x531d6d['id']}))[_0xc33c('0x1e')](function(_0x5906f9){_0xb9b12d[_0xc33c('0xb4')][_0xc33c('0xb3')]=[];_0xb9b12d['dataValues'][_0xc33c('0xb3')][_0xc33c('0xb5')](_0x5906f9[_0xc33c('0xb4')]);return _0xb9b12d;});})[_0xc33c('0x1e')](respondWithResult(_0x2b1997,null))[_0xc33c('0x28')](handleError(_0x2b1997,null));}; \ No newline at end of file +var _0xf39b=['spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','findOne','User','addApplications','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','Applications','account','applications','orderBy','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','From','replace','whatsapp:','Body','messageId','MessageSid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','defaults','contact','WhatsappInteraction','interaction','created','push','close','*,*,*,*','WhatsappMessage','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','to\x20is\x20mandatory','CmList','List','user','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../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','request','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','get','WhatsappAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','show','params','create','body','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','hasOwnProperty','nolimit','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','rows','removeAnswers','addAgents','omit'];(function(_0x3c3128,_0x117d7d){var _0x26b55e=function(_0x350250){while(--_0x350250){_0x3c3128['push'](_0x3c3128['shift']());}};_0x26b55e(++_0x117d7d);}(_0xf39b,0x1c3));var _0xbf39=function(_0x4b0126,_0x346b9d){_0x4b0126=_0x4b0126-0x0;var _0x5f4833=_0xf39b[_0x4b0126];return _0x5f4833;};'use strict';var emlformat=require(_0xbf39('0x0'));var rimraf=require(_0xbf39('0x1'));var zipdir=require(_0xbf39('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf39('0x3'));var moment=require(_0xbf39('0x4'));var BPromise=require(_0xbf39('0x5'));var Mustache=require(_0xbf39('0x6'));var util=require('util');var path=require('path');var sox=require(_0xbf39('0x7'));var csv=require(_0xbf39('0x8'));var ejs=require(_0xbf39('0x9'));var fs=require('fs');var fs_extra=require(_0xbf39('0xa'));var _=require(_0xbf39('0xb'));var squel=require('squel');var crypto=require(_0xbf39('0xc'));var jsforce=require(_0xbf39('0xd'));var deskjs=require(_0xbf39('0xe'));var toCsv=require(_0xbf39('0x8'));var querystring=require(_0xbf39('0xf'));var Papa=require(_0xbf39('0x10'));var Redis=require(_0xbf39('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbf39('0x12'));var as=require(_0xbf39('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf39('0x14'));var utils=require(_0xbf39('0x15'));var config=require(_0xbf39('0x16'));var licenseUtil=require(_0xbf39('0x17'));var db=require(_0xbf39('0x18'))['db'];config['redis']=_['defaults'](config[_0xbf39('0x19')],{'host':_0xbf39('0x1a'),'port':0x18eb});var socket=require(_0xbf39('0x1b'))(new Redis(config['redis']));require(_0xbf39('0x1c'))[_0xbf39('0x1d')](socket);var jayson=require(_0xbf39('0x1e'));var client=jayson[_0xbf39('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2566e9,_0x3a1fbe,_0x168e9b,_0x481735){return new BPromise(function(_0x212ea0,_0x4ce02c){var _0x4fe521=_0x481735||client;return _0x4fe521[_0xbf39('0x20')](_0x2566e9,_0x168e9b)[_0xbf39('0x21')](function(_0x2eb981){logger[_0xbf39('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x3a1fbe,'request\x20sent');logger[_0xbf39('0x23')](_0xbf39('0x24'),_0x3a1fbe,_0xbf39('0x25'),JSON[_0xbf39('0x26')](_0x2eb981));if(_0x2eb981['error']){if(_0x2eb981[_0xbf39('0x27')][_0xbf39('0x28')]===0x1f4){logger['error'](_0xbf39('0x29'),_0x3a1fbe,_0x2eb981[_0xbf39('0x27')][_0xbf39('0x2a')]);return _0x4ce02c(_0x2eb981[_0xbf39('0x27')]['message']);}logger[_0xbf39('0x27')](_0xbf39('0x29'),_0x3a1fbe,_0x2eb981['error']['message']);return _0x212ea0(_0x2eb981['error'][_0xbf39('0x2a')]);}else{logger[_0xbf39('0x22')](_0xbf39('0x29'),_0x3a1fbe,_0xbf39('0x25'));_0x212ea0(_0x2eb981[_0xbf39('0x2b')][_0xbf39('0x2a')]);}})[_0xbf39('0x2c')](function(_0x30448d){logger['error'](_0xbf39('0x29'),_0x3a1fbe,_0x30448d);_0x4ce02c(_0x30448d);});});}function respondWithStatusCode(_0x58275f,_0x15ab6d){_0x15ab6d=_0x15ab6d||0xcc;return function(_0x3b6c23){if(_0x3b6c23){return _0x58275f[_0xbf39('0x2d')](_0x15ab6d);}return _0x58275f[_0xbf39('0x2e')](_0x15ab6d)[_0xbf39('0x2f')]();};}function respondWithResult(_0x291000,_0x3ff3cc){_0x3ff3cc=_0x3ff3cc||0xc8;return function(_0x1615ff){if(_0x1615ff){return _0x291000[_0xbf39('0x2e')](_0x3ff3cc)[_0xbf39('0x30')](_0x1615ff);}};}function respondWithFilteredResult(_0x3a1294,_0x3b7fd1){return function(_0x2a21ca){if(_0x2a21ca){var _0x54b744=typeof _0x3b7fd1['offset']===_0xbf39('0x31')&&typeof _0x3b7fd1[_0xbf39('0x32')]===_0xbf39('0x31');var _0x339c67=_0x2a21ca[_0xbf39('0x33')];var _0x1d5d0b=_0x54b744?0x0:_0x3b7fd1[_0xbf39('0x34')];var _0x192637=_0x54b744?_0x2a21ca[_0xbf39('0x33')]:_0x3b7fd1[_0xbf39('0x34')]+_0x3b7fd1['limit'];var _0x12a60f;if(_0x192637>=_0x339c67){_0x192637=_0x339c67;_0x12a60f=0xc8;}else{_0x12a60f=0xce;}_0x3a1294[_0xbf39('0x2e')](_0x12a60f);return _0x3a1294[_0xbf39('0x35')](_0xbf39('0x36'),_0x1d5d0b+'-'+_0x192637+'/'+_0x339c67)[_0xbf39('0x30')](_0x2a21ca);}return null;};}function patchUpdates(_0x2664e1){return function(_0x13d493){try{jsonpatch['apply'](_0x13d493,_0x2664e1,!![]);}catch(_0x40dc53){return BPromise[_0xbf39('0x37')](_0x40dc53);}return _0x13d493[_0xbf39('0x38')]();};}function saveUpdates(_0x516066,_0x4446ea){return function(_0x230af3){if(_0x230af3){return _0x230af3[_0xbf39('0x39')](_0x516066)[_0xbf39('0x21')](function(_0xa002ed){return _0xa002ed;});}return null;};}function removeEntity(_0x228529,_0x2f3d2a){return function(_0xd23995){if(_0xd23995){return _0xd23995['destroy']()['then'](function(){var _0x396e86=_0xd23995[_0xbf39('0x3a')]({'plain':!![]});var _0x244013=_0xbf39('0x3b');return db[_0xbf39('0x3c')][_0xbf39('0x3d')]({'where':{'type':_0x244013,'resourceId':_0x396e86['id']}})[_0xbf39('0x21')](function(){return _0xd23995;});})['then'](function(){_0x228529[_0xbf39('0x2e')](0xcc)[_0xbf39('0x2f')]();});}};}function handleEntityNotFound(_0x4b4e53,_0x54161c){return function(_0x5e0e81){if(!_0x5e0e81){_0x4b4e53[_0xbf39('0x2d')](0x194);}return _0x5e0e81;};}function handleError(_0x28770c,_0x5b14d7){_0x5b14d7=_0x5b14d7||0x1f4;return function(_0x453856){logger['error'](_0x453856[_0xbf39('0x3e')]);if(_0x453856['name']){delete _0x453856[_0xbf39('0x3f')];}_0x28770c[_0xbf39('0x2e')](_0x5b14d7)[_0xbf39('0x40')](_0x453856);};}exports[_0xbf39('0x41')]=function(_0x3eff38,_0x18a09c){var _0xdb6d9f={'include':[{'model':db[_0xbf39('0x42')],'as':_0xbf39('0x43')}]},_0x27ea29={},_0x4b975b={'count':0x0,'rows':[]};var _0x2aae6a=_[_0xbf39('0x44')](db[_0xbf39('0x45')][_0xbf39('0x46')],function(_0x362212){return{'name':_0x362212['fieldName'],'type':_0x362212[_0xbf39('0x47')]['key']};});_0x27ea29[_0xbf39('0x48')]=_['map'](_0x2aae6a,_0xbf39('0x3f'));_0x27ea29[_0xbf39('0x49')]=_[_0xbf39('0x4a')](_0x3eff38[_0xbf39('0x49')]);_0x27ea29[_0xbf39('0x4b')]=_[_0xbf39('0x4c')](_0x27ea29[_0xbf39('0x48')],_0x27ea29[_0xbf39('0x49')]);_0xdb6d9f[_0xbf39('0x4d')]=_[_0xbf39('0x4c')](_0x27ea29['model'],qs['fields'](_0x3eff38[_0xbf39('0x49')][_0xbf39('0x4e')]));_0xdb6d9f['attributes']=_0xdb6d9f['attributes'][_0xbf39('0x4f')]?_0xdb6d9f[_0xbf39('0x4d')]:_0x27ea29[_0xbf39('0x48')];if(!_0x3eff38[_0xbf39('0x49')]['hasOwnProperty']('nolimit')){_0xdb6d9f[_0xbf39('0x32')]=qs[_0xbf39('0x32')](_0x3eff38[_0xbf39('0x49')][_0xbf39('0x32')]);_0xdb6d9f['offset']=qs[_0xbf39('0x34')](_0x3eff38[_0xbf39('0x49')]['offset']);}_0xdb6d9f[_0xbf39('0x50')]=qs[_0xbf39('0x51')](_0x3eff38['query'][_0xbf39('0x51')]);_0xdb6d9f[_0xbf39('0x52')]=qs[_0xbf39('0x4b')](_['pick'](_0x3eff38['query'],_0x27ea29[_0xbf39('0x4b')]),_0x2aae6a);if(_0x3eff38[_0xbf39('0x49')][_0xbf39('0x53')]){_0xdb6d9f['where']=_[_0xbf39('0x54')](_0xdb6d9f[_0xbf39('0x52')],{'$or':_[_0xbf39('0x44')](_0x2aae6a,function(_0x122f54){if(_0x122f54[_0xbf39('0x47')]!==_0xbf39('0x55')){var _0x6b3815={};_0x6b3815[_0x122f54['name']]={'$like':'%'+_0x3eff38[_0xbf39('0x49')]['filter']+'%'};return _0x6b3815;}})});}_0xdb6d9f=_[_0xbf39('0x54')]({},_0xdb6d9f,_0x3eff38[_0xbf39('0x56')]);var _0x3d1266={'where':_0xdb6d9f[_0xbf39('0x52')]};return db['WhatsappAccount'][_0xbf39('0x33')](_0x3d1266)[_0xbf39('0x21')](function(_0x529d01){_0x4b975b[_0xbf39('0x33')]=_0x529d01;if(_0x3eff38['query'][_0xbf39('0x57')]){_0xdb6d9f[_0xbf39('0x58')]=[{'all':!![]}];}return db[_0xbf39('0x45')]['findAll'](_0xdb6d9f);})[_0xbf39('0x21')](function(_0x1ece80){_0x4b975b['rows']=_0x1ece80;return _0x4b975b;})[_0xbf39('0x21')](respondWithFilteredResult(_0x18a09c,_0xdb6d9f))[_0xbf39('0x2c')](handleError(_0x18a09c,null));};exports[_0xbf39('0x59')]=function(_0x390412,_0x241820){var _0x26d666={'raw':![],'where':{'id':_0x390412[_0xbf39('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0xbf39('0x43')}]},_0x2ccf3d={};_0x2ccf3d[_0xbf39('0x48')]=_[_0xbf39('0x4a')](db['WhatsappAccount']['rawAttributes']);_0x2ccf3d[_0xbf39('0x49')]=_[_0xbf39('0x4a')](_0x390412[_0xbf39('0x49')]);_0x2ccf3d[_0xbf39('0x4b')]=_['intersection'](_0x2ccf3d[_0xbf39('0x48')],_0x2ccf3d['query']);_0x26d666[_0xbf39('0x4d')]=_[_0xbf39('0x4c')](_0x2ccf3d['model'],qs['fields'](_0x390412[_0xbf39('0x49')][_0xbf39('0x4e')]));_0x26d666[_0xbf39('0x4d')]=_0x26d666[_0xbf39('0x4d')]['length']?_0x26d666[_0xbf39('0x4d')]:_0x2ccf3d[_0xbf39('0x48')];if(_0x390412['query'][_0xbf39('0x57')]){_0x26d666['include']=[{'all':!![]}];}_0x26d666=_[_0xbf39('0x54')]({},_0x26d666,_0x390412[_0xbf39('0x56')]);return db[_0xbf39('0x45')]['find'](_0x26d666)[_0xbf39('0x21')](handleEntityNotFound(_0x241820,null))['then'](respondWithResult(_0x241820,null))[_0xbf39('0x2c')](handleError(_0x241820,null));};exports[_0xbf39('0x5b')]=function(_0x203000,_0x388cd0){return db[_0xbf39('0x45')][_0xbf39('0x5b')](_0x203000[_0xbf39('0x5c')],{})[_0xbf39('0x21')](function(_0x577c7c){var _0x43006c=_0x203000['user'][_0xbf39('0x3a')]({'plain':!![]});if(!_0x43006c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43006c[_0xbf39('0x5d')]==='user'){var _0x168f03=_0x577c7c[_0xbf39('0x3a')]({'plain':!![]});var _0x22675b=_0xbf39('0x3b');return db['UserProfileSection'][_0xbf39('0x5e')]({'where':{'name':_0x22675b,'userProfileId':_0x43006c[_0xbf39('0x5f')]},'raw':!![]})[_0xbf39('0x21')](function(_0x325013){if(_0x325013&&_0x325013[_0xbf39('0x60')]===0x0){return db[_0xbf39('0x3c')]['create']({'name':_0x168f03[_0xbf39('0x3f')],'resourceId':_0x168f03['id'],'type':_0x325013['name'],'sectionId':_0x325013['id']},{})[_0xbf39('0x21')](function(){return _0x577c7c;});}else{return _0x577c7c;}})[_0xbf39('0x2c')](function(_0x396f09){logger[_0xbf39('0x27')](_0xbf39('0x61'),_0x396f09);throw _0x396f09;});}return _0x577c7c;})[_0xbf39('0x21')](respondWithResult(_0x388cd0,0xc9))[_0xbf39('0x2c')](handleError(_0x388cd0,null));};exports[_0xbf39('0x39')]=function(_0x17b99e,_0x135dcd){if(_0x17b99e[_0xbf39('0x5c')]['id']){delete _0x17b99e[_0xbf39('0x5c')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x17b99e[_0xbf39('0x5a')]['id']},'include':[{'model':db[_0xbf39('0x42')],'as':_0xbf39('0x43')}]})[_0xbf39('0x21')](handleEntityNotFound(_0x135dcd,null))['then'](saveUpdates(_0x17b99e[_0xbf39('0x5c')],null))[_0xbf39('0x21')](respondWithResult(_0x135dcd,null))['catch'](handleError(_0x135dcd,null));};exports['destroy']=function(_0x587de4,_0x319e67){return db[_0xbf39('0x45')][_0xbf39('0x5e')]({'where':{'id':_0x587de4[_0xbf39('0x5a')]['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x319e67,null))[_0xbf39('0x21')](removeEntity(_0x319e67,null))['catch'](handleError(_0x319e67,null));};exports[_0xbf39('0x62')]=function(_0x560ec2,_0x2c243c){return db[_0xbf39('0x45')][_0xbf39('0x62')]()[_0xbf39('0x21')](respondWithResult(_0x2c243c,null))[_0xbf39('0x2c')](handleError(_0x2c243c,null));};exports[_0xbf39('0x63')]=function(_0x21630b,_0x1b35c1,_0x46e5c3){if(_0x21630b['body']['id']){delete _0x21630b[_0xbf39('0x5c')]['id'];}return db[_0xbf39('0x45')][_0xbf39('0x5e')]({'where':{'id':_0x21630b[_0xbf39('0x5a')]['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x1b35c1,null))['then'](function(_0x3ce651){if(_0x3ce651){_0x21630b[_0xbf39('0x5c')][_0xbf39('0x64')]=_0x3ce651['id'];return db[_0xbf39('0x65')][_0xbf39('0x5b')](_0x21630b[_0xbf39('0x5c')]);}})['then'](respondWithResult(_0x1b35c1,null))[_0xbf39('0x2c')](handleError(_0x1b35c1,null));};exports[_0xbf39('0x66')]=function(_0x523c05,_0x575b99,_0x47e6a4){var _0x3de6a9={'raw':![],'where':{}};var _0x1f3845={};var _0x542b00={'count':0x0,'rows':[]};return db[_0xbf39('0x45')]['findOne']({'where':{'id':_0x523c05['params']['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x575b99,null))[_0xbf39('0x21')](function(_0x4dbf30){if(_0x4dbf30){_0x1f3845[_0xbf39('0x48')]=_[_0xbf39('0x4a')](db[_0xbf39('0x65')][_0xbf39('0x46')]);_0x1f3845[_0xbf39('0x49')]=_[_0xbf39('0x4a')](_0x523c05[_0xbf39('0x49')]);_0x1f3845[_0xbf39('0x4b')]=_[_0xbf39('0x4c')](_0x1f3845[_0xbf39('0x48')],_0x1f3845['query']);_0x3de6a9[_0xbf39('0x4d')]=_[_0xbf39('0x4c')](_0x1f3845[_0xbf39('0x48')],qs['fields'](_0x523c05[_0xbf39('0x49')][_0xbf39('0x4e')]));_0x3de6a9['attributes']=_0x3de6a9[_0xbf39('0x4d')][_0xbf39('0x4f')]?_0x3de6a9[_0xbf39('0x4d')]:_0x1f3845['model'];if(!_0x523c05['query'][_0xbf39('0x67')](_0xbf39('0x68'))){_0x3de6a9[_0xbf39('0x32')]=qs['limit'](_0x523c05[_0xbf39('0x49')]['limit']);_0x3de6a9[_0xbf39('0x34')]=qs[_0xbf39('0x34')](_0x523c05[_0xbf39('0x49')][_0xbf39('0x34')]);}_0x3de6a9[_0xbf39('0x50')]=qs[_0xbf39('0x51')](_0x523c05['query']['sort']);_0x3de6a9[_0xbf39('0x52')]=qs[_0xbf39('0x4b')](_['pick'](_0x523c05['query'],_0x1f3845['filters']));_0x3de6a9[_0xbf39('0x52')]['WhatsappAccountId']=_0x4dbf30['id'];if(_0x523c05[_0xbf39('0x49')][_0xbf39('0x53')]){_0x3de6a9[_0xbf39('0x52')]=_['merge'](_0x3de6a9[_0xbf39('0x52')],{'$or':_[_0xbf39('0x44')](_0x3de6a9[_0xbf39('0x4d')],function(_0x50aa5b){var _0xd7d8d7={};_0xd7d8d7[_0x50aa5b]={'$like':'%'+_0x523c05[_0xbf39('0x49')][_0xbf39('0x53')]+'%'};return _0xd7d8d7;})});}_0x3de6a9=_['merge']({},_0x3de6a9,_0x523c05[_0xbf39('0x56')]);return db['Disposition']['count']({'where':_0x3de6a9[_0xbf39('0x52')]})[_0xbf39('0x21')](function(_0x3fd313){_0x542b00[_0xbf39('0x33')]=_0x3fd313;if(_0x523c05[_0xbf39('0x49')]['includeAll']){_0x3de6a9[_0xbf39('0x58')]=[{'all':!![]}];}return db[_0xbf39('0x65')][_0xbf39('0x69')](_0x3de6a9);})[_0xbf39('0x21')](function(_0x36dc55){_0x542b00['rows']=_0x36dc55;return _0x542b00;});}})[_0xbf39('0x21')](respondWithFilteredResult(_0x575b99,_0x3de6a9))[_0xbf39('0x2c')](handleError(_0x575b99,null));};exports[_0xbf39('0x6a')]=function(_0x1e468e,_0x3785ca,_0x568286){return db[_0xbf39('0x45')]['find']({'where':{'id':_0x1e468e['params']['id']}})['then'](handleEntityNotFound(_0x3785ca,null))[_0xbf39('0x21')](function(_0x213ef7){if(_0x213ef7){return _0x213ef7[_0xbf39('0x6a')](_0x1e468e[_0xbf39('0x49')][_0xbf39('0x6b')]);}})[_0xbf39('0x21')](respondWithStatusCode(_0x3785ca,null))['catch'](handleError(_0x3785ca,null));};exports[_0xbf39('0x6c')]=function(_0x4d7ba4,_0x28123c,_0x353c14){if(_0x4d7ba4[_0xbf39('0x5c')]['id']){delete _0x4d7ba4[_0xbf39('0x5c')]['id'];}return db['WhatsappAccount'][_0xbf39('0x5e')]({'where':{'id':_0x4d7ba4[_0xbf39('0x5a')]['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x28123c,null))[_0xbf39('0x21')](function(_0x119102){if(_0x119102){_0x4d7ba4['body'][_0xbf39('0x64')]=_0x119102['id'];return db[_0xbf39('0x6d')]['create'](_0x4d7ba4[_0xbf39('0x5c')]);}})[_0xbf39('0x21')](respondWithResult(_0x28123c,null))[_0xbf39('0x2c')](handleError(_0x28123c,null));};exports[_0xbf39('0x6e')]=function(_0x4c1a0b,_0x544ca9,_0x605ecc){var _0x3d25e4={'raw':![],'where':{}};var _0x27e66b={};var _0x4bda4c={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x4c1a0b['params']['id']}})['then'](handleEntityNotFound(_0x544ca9,null))[_0xbf39('0x21')](function(_0x36da59){if(_0x36da59){_0x27e66b[_0xbf39('0x48')]=_['keys'](db['CannedAnswer'][_0xbf39('0x46')]);_0x27e66b[_0xbf39('0x49')]=_[_0xbf39('0x4a')](_0x4c1a0b['query']);_0x27e66b[_0xbf39('0x4b')]=_[_0xbf39('0x4c')](_0x27e66b[_0xbf39('0x48')],_0x27e66b['query']);_0x3d25e4[_0xbf39('0x4d')]=_[_0xbf39('0x4c')](_0x27e66b[_0xbf39('0x48')],qs['fields'](_0x4c1a0b[_0xbf39('0x49')][_0xbf39('0x4e')]));_0x3d25e4[_0xbf39('0x4d')]=_0x3d25e4['attributes'][_0xbf39('0x4f')]?_0x3d25e4[_0xbf39('0x4d')]:_0x27e66b[_0xbf39('0x48')];if(!_0x4c1a0b[_0xbf39('0x49')][_0xbf39('0x67')](_0xbf39('0x68'))){_0x3d25e4[_0xbf39('0x32')]=qs[_0xbf39('0x32')](_0x4c1a0b['query'][_0xbf39('0x32')]);_0x3d25e4[_0xbf39('0x34')]=qs['offset'](_0x4c1a0b[_0xbf39('0x49')]['offset']);}_0x3d25e4[_0xbf39('0x50')]=qs[_0xbf39('0x51')](_0x4c1a0b[_0xbf39('0x49')][_0xbf39('0x51')]);_0x3d25e4[_0xbf39('0x52')]=qs[_0xbf39('0x4b')](_[_0xbf39('0x6f')](_0x4c1a0b['query'],_0x27e66b[_0xbf39('0x4b')]));_0x3d25e4[_0xbf39('0x52')][_0xbf39('0x64')]=_0x36da59['id'];if(_0x4c1a0b[_0xbf39('0x49')][_0xbf39('0x53')]){_0x3d25e4['where']=_[_0xbf39('0x54')](_0x3d25e4['where'],{'$or':_[_0xbf39('0x44')](_0x3d25e4[_0xbf39('0x4d')],function(_0x1d351c){var _0x4ea110={};_0x4ea110[_0x1d351c]={'$like':'%'+_0x4c1a0b[_0xbf39('0x49')]['filter']+'%'};return _0x4ea110;})});}_0x3d25e4=_[_0xbf39('0x54')]({},_0x3d25e4,_0x4c1a0b[_0xbf39('0x56')]);return db['CannedAnswer'][_0xbf39('0x33')]({'where':_0x3d25e4[_0xbf39('0x52')]})[_0xbf39('0x21')](function(_0x14be4d){_0x4bda4c[_0xbf39('0x33')]=_0x14be4d;if(_0x4c1a0b[_0xbf39('0x49')][_0xbf39('0x57')]){_0x3d25e4[_0xbf39('0x58')]=[{'all':!![]}];}return db[_0xbf39('0x6d')][_0xbf39('0x69')](_0x3d25e4);})['then'](function(_0x1912d7){_0x4bda4c[_0xbf39('0x70')]=_0x1912d7;return _0x4bda4c;});}})[_0xbf39('0x21')](respondWithFilteredResult(_0x544ca9,_0x3d25e4))['catch'](handleError(_0x544ca9,null));};exports[_0xbf39('0x71')]=function(_0x36a8a7,_0x4e60b1,_0x422af0){return db[_0xbf39('0x45')]['find']({'where':{'id':_0x36a8a7[_0xbf39('0x5a')]['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x4e60b1,null))['then'](function(_0x59e5ab){if(_0x59e5ab){return _0x59e5ab[_0xbf39('0x71')](_0x36a8a7[_0xbf39('0x49')][_0xbf39('0x6b')]);}})[_0xbf39('0x21')](respondWithStatusCode(_0x4e60b1,null))[_0xbf39('0x2c')](handleError(_0x4e60b1,null));};exports[_0xbf39('0x72')]=function(_0x589170,_0x4f9438,_0x114af0){return db[_0xbf39('0x45')][_0xbf39('0x5e')]({'where':{'id':_0x589170['params']['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x4f9438,null))[_0xbf39('0x21')](function(_0x2b2c82){if(_0x2b2c82){return _0x2b2c82[_0xbf39('0x72')](_0x589170[_0xbf39('0x5c')][_0xbf39('0x6b')],_[_0xbf39('0x73')](_0x589170[_0xbf39('0x5c')],[_0xbf39('0x6b'),'id'])||{})[_0xbf39('0x74')](function(_0x5975b8){for(var _0x1c6206=0x0;_0x1c6206<_0x589170[_0xbf39('0x5c')]['ids']['length'];_0x1c6206+=0x1){socket[_0xbf39('0x75')](_0xbf39('0x76'),{'UserId':Number(_0x589170[_0xbf39('0x5c')][_0xbf39('0x6b')][_0x1c6206]),'WhatsappAccountId':Number(_0x589170[_0xbf39('0x5a')]['id'])});}return _0x5975b8;});}})[_0xbf39('0x21')](respondWithResult(_0x4f9438,null))['catch'](handleError(_0x4f9438,null));};exports[_0xbf39('0x77')]=function(_0x37e17f,_0x2e94ae,_0x383cb6){return db[_0xbf39('0x45')]['find']({'where':{'id':_0x37e17f[_0xbf39('0x5a')]['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x2e94ae,null))[_0xbf39('0x21')](function(_0x26de83){if(_0x26de83){return _0x26de83[_0xbf39('0x77')](_0x37e17f[_0xbf39('0x49')][_0xbf39('0x6b')])[_0xbf39('0x21')](function(){if(_[_0xbf39('0x78')](_0x37e17f[_0xbf39('0x49')][_0xbf39('0x6b')])){for(var _0x3cab0e=0x0;_0x3cab0e<_0x37e17f[_0xbf39('0x49')][_0xbf39('0x6b')]['length'];_0x3cab0e+=0x1){socket[_0xbf39('0x75')](_0xbf39('0x79'),{'UserId':Number(_0x37e17f[_0xbf39('0x49')][_0xbf39('0x6b')][_0x3cab0e]),'WhatsappAccountId':Number(_0x37e17f[_0xbf39('0x5a')]['id'])});}}else{socket[_0xbf39('0x75')](_0xbf39('0x79'),{'UserId':Number(_0x37e17f[_0xbf39('0x49')][_0xbf39('0x6b')]),'WhatsappAccountId':Number(_0x37e17f['params']['id'])});}});}})[_0xbf39('0x21')](respondWithStatusCode(_0x2e94ae,null))[_0xbf39('0x2c')](handleError(_0x2e94ae,null));};exports[_0xbf39('0x7a')]=function(_0x4659c7,_0x459635,_0x418e3e){var _0x3ae4ff={};var _0x4386a2={};var _0x28d194;var _0x59528f;return db['WhatsappAccount'][_0xbf39('0x7b')]({'where':{'id':_0x4659c7['params']['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x459635,null))[_0xbf39('0x21')](function(_0x5728e6){if(_0x5728e6){_0x28d194=_0x5728e6;_0x4386a2[_0xbf39('0x48')]=_[_0xbf39('0x4a')](db[_0xbf39('0x7c')][_0xbf39('0x46')]);_0x4386a2[_0xbf39('0x49')]=_[_0xbf39('0x4a')](_0x4659c7[_0xbf39('0x49')]);_0x4386a2[_0xbf39('0x4b')]=_[_0xbf39('0x4c')](_0x4386a2[_0xbf39('0x48')],_0x4386a2[_0xbf39('0x49')]);_0x3ae4ff[_0xbf39('0x4d')]=_[_0xbf39('0x4c')](_0x4386a2[_0xbf39('0x48')],qs[_0xbf39('0x4e')](_0x4659c7[_0xbf39('0x49')]['fields']));_0x3ae4ff[_0xbf39('0x4d')]=_0x3ae4ff[_0xbf39('0x4d')]['length']?_0x3ae4ff['attributes']:_0x4386a2['model'];_0x3ae4ff['order']=qs['sort'](_0x4659c7[_0xbf39('0x49')][_0xbf39('0x51')]);_0x3ae4ff[_0xbf39('0x52')]=qs[_0xbf39('0x4b')](_[_0xbf39('0x6f')](_0x4659c7[_0xbf39('0x49')],_0x4386a2['filters']));if(_0x4659c7[_0xbf39('0x49')][_0xbf39('0x53')]){_0x3ae4ff[_0xbf39('0x52')]=_['merge'](_0x3ae4ff[_0xbf39('0x52')],{'$or':_[_0xbf39('0x44')](_0x3ae4ff[_0xbf39('0x4d')],function(_0x4bb78c){var _0x4def19={};_0x4def19[_0x4bb78c]={'$like':'%'+_0x4659c7[_0xbf39('0x49')]['filter']+'%'};return _0x4def19;})});}_0x3ae4ff=_[_0xbf39('0x54')]({},_0x3ae4ff,_0x4659c7['options']);return _0x28d194[_0xbf39('0x7a')](_0x3ae4ff);}})[_0xbf39('0x21')](function(_0x49a26c){if(_0x49a26c){_0x59528f=_0x49a26c[_0xbf39('0x4f')];if(!_0x4659c7[_0xbf39('0x49')][_0xbf39('0x67')](_0xbf39('0x68'))){_0x3ae4ff[_0xbf39('0x32')]=qs[_0xbf39('0x32')](_0x4659c7[_0xbf39('0x49')][_0xbf39('0x32')]);_0x3ae4ff['offset']=qs['offset'](_0x4659c7[_0xbf39('0x49')][_0xbf39('0x34')]);}return _0x28d194[_0xbf39('0x7a')](_0x3ae4ff);}})[_0xbf39('0x21')](function(_0x2523b6){if(_0x2523b6){return _0x2523b6?{'count':_0x59528f,'rows':_0x2523b6}:null;}})[_0xbf39('0x21')](respondWithResult(_0x459635,null))[_0xbf39('0x2c')](handleError(_0x459635,null));};exports[_0xbf39('0x7d')]=function(_0x50b598,_0x3ae7ab,_0x18e686){return db[_0xbf39('0x45')][_0xbf39('0x7b')]({'where':{'id':_0x50b598[_0xbf39('0x5a')]['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x3ae7ab,null))[_0xbf39('0x21')](function(_0x4bcac0){if(_0x4bcac0){return db['sequelize'][_0xbf39('0x7e')](function(_0x5041f5){return db[_0xbf39('0x7f')]['destroy']({'where':{'WhatsappAccountId':_0x50b598[_0xbf39('0x5a')]['id']},'transaction':_0x5041f5})[_0xbf39('0x21')](function(_0x320a53){var _0x27c895=_[_0xbf39('0x44')](_0x50b598['body'],function(_0x56cc3c){_0x56cc3c[_0xbf39('0x64')]=_0x50b598[_0xbf39('0x5a')]['id'];return _0x56cc3c;});return db[_0xbf39('0x7f')][_0xbf39('0x80')](_0x27c895,{'transaction':_0x5041f5});});})['then'](function(){return db['WhatsappApplication'][_0xbf39('0x81')]({'where':{'WhatsappAccountId':_0x50b598[_0xbf39('0x5a')]['id']},'order':'priority'});});}})[_0xbf39('0x21')](respondWithResult(_0x3ae7ab,null))['catch'](handleError(_0x3ae7ab,null));};exports[_0xbf39('0x82')]=function(_0x466938,_0x688f,_0x5c8f0c){var _0x4337b8={};var _0x59d5fa={};var _0x25ed01;var _0x341251;return db[_0xbf39('0x45')][_0xbf39('0x7b')]({'where':{'id':_0x466938[_0xbf39('0x5a')]['id']}})[_0xbf39('0x21')](handleEntityNotFound(_0x688f,null))[_0xbf39('0x21')](function(_0x3ccf7c){if(_0x3ccf7c){_0x25ed01=_0x3ccf7c;_0x59d5fa[_0xbf39('0x48')]=_[_0xbf39('0x4a')](db[_0xbf39('0x7f')][_0xbf39('0x46')]);_0x59d5fa[_0xbf39('0x49')]=_[_0xbf39('0x4a')](_0x466938[_0xbf39('0x49')]);_0x59d5fa[_0xbf39('0x4b')]=_[_0xbf39('0x4c')](_0x59d5fa[_0xbf39('0x48')],_0x59d5fa[_0xbf39('0x49')]);_0x4337b8[_0xbf39('0x4d')]=_[_0xbf39('0x4c')](_0x59d5fa['model'],qs[_0xbf39('0x4e')](_0x466938[_0xbf39('0x49')][_0xbf39('0x4e')]));_0x4337b8[_0xbf39('0x4d')]=_0x4337b8[_0xbf39('0x4d')][_0xbf39('0x4f')]?_0x4337b8[_0xbf39('0x4d')]:_0x59d5fa[_0xbf39('0x48')];_0x4337b8[_0xbf39('0x50')]=qs[_0xbf39('0x51')](_0x466938[_0xbf39('0x49')][_0xbf39('0x51')]);_0x4337b8['where']=qs[_0xbf39('0x4b')](_[_0xbf39('0x6f')](_0x466938[_0xbf39('0x49')],_0x59d5fa[_0xbf39('0x4b')]));if(_0x466938[_0xbf39('0x49')][_0xbf39('0x53')]){_0x4337b8[_0xbf39('0x52')]=_['merge'](_0x4337b8[_0xbf39('0x52')],{'$or':_[_0xbf39('0x44')](_0x4337b8['attributes'],function(_0xc822e9){var _0x11216c={};_0x11216c[_0xc822e9]={'$like':'%'+_0x466938[_0xbf39('0x49')][_0xbf39('0x53')]+'%'};return _0x11216c;})});}_0x4337b8=_[_0xbf39('0x54')]({},_0x4337b8,_0x466938[_0xbf39('0x56')]);return _0x25ed01[_0xbf39('0x82')](_0x4337b8);}})[_0xbf39('0x21')](function(_0x3b68c0){if(_0x3b68c0){_0x341251=_0x3b68c0[_0xbf39('0x4f')];if(!_0x466938[_0xbf39('0x49')]['hasOwnProperty'](_0xbf39('0x68'))){_0x4337b8[_0xbf39('0x32')]=qs['limit'](_0x466938[_0xbf39('0x49')][_0xbf39('0x32')]);_0x4337b8[_0xbf39('0x34')]=qs[_0xbf39('0x34')](_0x466938['query'][_0xbf39('0x34')]);}return _0x25ed01[_0xbf39('0x82')](_0x4337b8);}})[_0xbf39('0x21')](function(_0x3ea287){if(_0x3ea287){return _0x3ea287?{'count':_0x341251,'rows':_0x3ea287}:null;}})[_0xbf39('0x21')](respondWithResult(_0x688f,null))[_0xbf39('0x2c')](handleError(_0x688f,null));};exports[_0xbf39('0x83')]=function(_0x18bf5,_0x295e5c,_0x1f7dc7){var _0x1f2b85={'channel':_0xbf39('0x84')};var _0x2a948b=[];var _0xe03630=[];var _0x2f9c33={};return db['WhatsappAccount']['find']({'where':{'id':_0x18bf5[_0xbf39('0x5a')]['id']},'include':[{'model':db[_0xbf39('0x7f')],'as':_0xbf39('0x85')}]})['then'](handleEntityNotFound(_0x295e5c,null))[_0xbf39('0x21')](function(_0x3f3294){_0x1f2b85[_0xbf39('0x86')]=_0x3f3294;_0x1f2b85[_0xbf39('0x87')]=_[_0xbf39('0x88')](_0x3f3294[_0xbf39('0x85')],[_0xbf39('0x89')],['asc']);if(_0x1f2b85[_0xbf39('0x86')][_0xbf39('0x85')]){delete _0x1f2b85['account'][_0xbf39('0x85')];}return db[_0xbf39('0x8a')]['describe']();})['then'](function(_0x9d25b4){if(!_0x9d25b4){throw new db[(_0xbf39('0x8b'))][(_0xbf39('0x8c'))](_0xbf39('0x8d'));}_0x2a948b=_[_0xbf39('0x8e')](_[_0xbf39('0x4a')](_0x9d25b4),[_0xbf39('0x8f'),_0xbf39('0x90')]);_0xe03630=_[_0xbf39('0x8e')](_[_0xbf39('0x4a')](_0x9d25b4),[_0xbf39('0x8f'),'updatedAt',_0xbf39('0x91'),_0xbf39('0x92')]);_0x1f2b85[_0xbf39('0x5c')]={'mapKey':'mobile'};if(_0x1f2b85[_0xbf39('0x86')]['type']&&_0x1f2b85[_0xbf39('0x86')][_0xbf39('0x47')]==='twilio'){_0x1f2b85[_0xbf39('0x5c')][_0xbf39('0x93')]=_0x18bf5[_0xbf39('0x5c')][_0xbf39('0x94')][_0xbf39('0x95')](_0xbf39('0x96'),'');_0x1f2b85[_0xbf39('0x5c')][_0xbf39('0x5c')]=_0x18bf5[_0xbf39('0x5c')][_0xbf39('0x97')];_0x1f2b85[_0xbf39('0x5c')][_0xbf39('0x98')]=_0x18bf5['body'][_0xbf39('0x99')];}if(_0x1f2b85[_0xbf39('0x5c')]['id']){delete _0x1f2b85[_0xbf39('0x5c')]['id'];}if(_['isNil'](_0x1f2b85['body']['from'])){throw new db['Sequelize']['ValidationError'](_0xbf39('0x9a'));}if(_[_0xbf39('0x9b')](_0x1f2b85['body'][_0xbf39('0x5c')])||_0x1f2b85[_0xbf39('0x5c')][_0xbf39('0x5c')]===''){throw new db[(_0xbf39('0x8b'))]['ValidationError'](_0xbf39('0x9c'));}if(_[_0xbf39('0x9b')](_0x1f2b85['body'][_0xbf39('0x9d')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe03630);}if(!_[_0xbf39('0x9e')](_0xe03630,_0x1f2b85[_0xbf39('0x5c')][_0xbf39('0x9d')])){throw new db[(_0xbf39('0x8b'))][(_0xbf39('0x8c'))](_0xbf39('0x9f')+_0xe03630);}_0x2f9c33[_0x1f2b85[_0xbf39('0x5c')][_0xbf39('0x9d')]]=_0x1f2b85[_0xbf39('0x5c')][_0xbf39('0x93')];return db['CmList']['find']({'where':{'id':_0x1f2b85[_0xbf39('0x86')][_0xbf39('0x92')]},'include':[{'model':db[_0xbf39('0x8a')],'as':_0xbf39('0xa0'),'where':_0x2f9c33,'limit':0x1,'order':[[_0xbf39('0x90'),_0xbf39('0xa1')]]}]});})['then'](handleEntityNotFound(_0x295e5c,null))[_0xbf39('0x21')](function(_0x4bf7fc){if(_0x4bf7fc){_0x1f2b85[_0xbf39('0xa2')]=_[_0xbf39('0x73')](_0x4bf7fc,[_0xbf39('0xa0')]);if(_0x4bf7fc[_0xbf39('0xa0')][_0xbf39('0x4f')]){return _0x4bf7fc[_0xbf39('0xa0')][0x0];}var _0x4db877=_[_0xbf39('0xa3')](_0x1f2b85[_0xbf39('0x5c')],{'firstName':_0x1f2b85[_0xbf39('0x5c')][_0xbf39('0x93')],'ListId':_0x4bf7fc['id']});_0x4db877[_0x1f2b85[_0xbf39('0x5c')][_0xbf39('0x9d')]]=_0x1f2b85['body']['from'];return db[_0xbf39('0x8a')]['create'](_0x4db877,{'fields':_0x2a948b,'raw':!![]});}})[_0xbf39('0x21')](handleEntityNotFound(_0x295e5c,null))['then'](function(_0x112e5b){if(_0x112e5b){_0x1f2b85[_0xbf39('0xa4')]=_0x112e5b;var _0x26d7d6={'ContactId':_0x112e5b['id'],'phone':_0x1f2b85[_0xbf39('0x5c')][_0xbf39('0x93')],'WhatsappAccountId':_0x18bf5[_0xbf39('0x5a')]['id']};var _0x30ebff={'ContactId':_0x112e5b['id'],'WhatsappAccountId':_0x18bf5[_0xbf39('0x5a')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xbf39('0x5e')]({'where':_0x30ebff})[_0xbf39('0x21')](function(_0x3c0af9){if(_0x3c0af9){return[_0x3c0af9,![]];}return db[_0xbf39('0xa5')][_0xbf39('0x5b')](_0x26d7d6)['then'](function(_0xc910ac){return[_0xc910ac,!![]];});});}})[_0xbf39('0x74')](function(_0x48ebf0,_0xdfa0bb){_0x1f2b85[_0xbf39('0xa6')]=_0x48ebf0[_0xbf39('0x3a')]({'plain':!![]});_0x1f2b85[_0xbf39('0xa6')][_0xbf39('0xa7')]=![];if(_0xdfa0bb){if(_0x1f2b85[_0xbf39('0x86')]['autoclose']){_0x1f2b85['applications'][_0xbf39('0xa8')]({'id':0x0,'priority':_0x1f2b85[_0xbf39('0x87')][_0xbf39('0x4f')]+0x1,'app':_0xbf39('0xa9'),'appdata':'unmanaged','interval':_0xbf39('0xaa')});}_0x1f2b85['interaction']['created']=!![];}return db[_0xbf39('0xab')][_0xbf39('0x5b')]({'phone':_0x1f2b85[_0xbf39('0x5c')][_0xbf39('0x93')],'messageId':_0x1f2b85['body'][_0xbf39('0x98')],'body':_0x1f2b85[_0xbf39('0x5c')]['body'],'WhatsappAccountId':_0x18bf5[_0xbf39('0x5a')]['id'],'WhatsappInteractionId':_0x48ebf0['id'],'direction':'in','ContactId':_0x48ebf0[_0xbf39('0xac')],'AttachmentId':_0x1f2b85[_0xbf39('0x5c')]['AttachmentId']});})[_0xbf39('0x21')](function(_0x3d0245){_0x1f2b85[_0xbf39('0x2a')]=_0x3d0245;if(_0x1f2b85[_0xbf39('0xa6')][_0xbf39('0xad')]){return db[_0xbf39('0x7c')][_0xbf39('0x5e')]({'attributes':['id',_0xbf39('0x3f')],'where':{'id':_0x1f2b85[_0xbf39('0xa6')][_0xbf39('0xad')]}})[_0xbf39('0x21')](function(_0x34fbf5){if(_0x34fbf5){_0x1f2b85[_0xbf39('0x87')][_0xbf39('0xae')]({'id':0x0,'priority':0x0,'app':_0xbf39('0xaf'),'appdata':_0x34fbf5[_0xbf39('0x3f')]+','+(_0x1f2b85['account'][_0xbf39('0xb0')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xbf39('0xb1'),_0xbf39('0xb2'),_0x1f2b85);});}return respondWithRpcPromise('Start',_0xbf39('0xb2'),_0x1f2b85);})['then'](function(_0x35ae03){if(_0x35ae03){var _0x42cf63=0xc8;var _0x117015='receiveMessage';logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x117015,_0x42cf63,'entity\x20found');logger[_0xbf39('0x23')](_0xbf39('0xb3'),_0x117015,_0x42cf63,_0xbf39('0xb4'),JSON['stringify'](_0x35ae03));if(_0x1f2b85[_0xbf39('0x86')][_0xbf39('0x47')]===_0xbf39('0xb5')){return _0x295e5c['status'](_0x42cf63)[_0xbf39('0x35')]('Content-Type','text/xml')[_0xbf39('0x40')]('\x0a');}else{return _0x295e5c[_0xbf39('0x2e')](_0x42cf63)[_0xbf39('0x30')](_0x35ae03);}}})[_0xbf39('0x2c')](handleError(_0x295e5c,null));};exports[_0xbf39('0x40')]=function(_0xb860d7,_0x9468c0,_0x568de2){var _0x3aba9a,_0xa2a155,_0x374778;if(_['isNil'](_0xb860d7[_0xbf39('0x5c')][_0xbf39('0x5c')])||_0xb860d7['body'][_0xbf39('0x5c')]===''){throw new db['Sequelize']['ValidationError'](_0xbf39('0x9c'));}if(_['isNil'](_0xb860d7[_0xbf39('0x5c')]['to'])){throw new db[(_0xbf39('0x8b'))]['ValidationError'](_0xbf39('0xb6'));}_0x3aba9a=_0xb860d7[_0xbf39('0x5c')]['to'];return db[_0xbf39('0x45')][_0xbf39('0x5e')]({'where':{'id':_0xb860d7[_0xbf39('0x5a')]['id']},'include':[{'model':db[_0xbf39('0xb7')],'as':_0xbf39('0xb8'),'include':[{'model':db[_0xbf39('0x8a')],'as':'Contacts','where':{'mobile':_0x3aba9a},'limit':0x1,'order':[[_0xbf39('0x90'),_0xbf39('0xa1')]]}]}]})[_0xbf39('0x21')](handleEntityNotFound(_0x9468c0,null))[_0xbf39('0x21')](function(_0x176da2){if(_0x176da2&&_0x176da2[_0xbf39('0xb8')]){_0xa2a155=_0x176da2[_0xbf39('0x3a')]({'plain':!![]});if(_0xa2a155[_0xbf39('0xb8')]&&_0xa2a155[_0xbf39('0xb8')][_0xbf39('0xa0')]['length']){return _0xa2a155[_0xbf39('0xb8')][_0xbf39('0xa0')][0x0];}return db[_0xbf39('0x8a')][_0xbf39('0x5b')](_[_0xbf39('0xa3')](_0xb860d7['body'],{'firstName':_0x3aba9a,'mobile':_0x3aba9a,'phone':_0x3aba9a,'ListId':_0xa2a155[_0xbf39('0x92')]}));}})[_0xbf39('0x21')](handleEntityNotFound(_0x9468c0,null))[_0xbf39('0x21')](function(_0x1c5a0c){if(_0x1c5a0c){_0x374778=_0x1c5a0c;return db['WhatsappInteraction'][_0xbf39('0x5e')]({'where':{'ContactId':_0x374778['id'],'closed':![],'WhatsappAccountId':_0xa2a155['id']}})[_0xbf39('0x21')](function(_0x218480){if(_0x218480){return[_0x218480,![]];}return db['WhatsappInteraction']['create']({'UserId':_0xb860d7[_0xbf39('0xb9')]['id'],'ContactId':_0x374778['id'],'WhatsappAccountId':_0xa2a155['id'],'phone':_0x3aba9a,'firstMsgDirection':_0xbf39('0xba'),'Messages':[_['merge'](_0xb860d7[_0xbf39('0x5c')],{'read':![],'body':_0xb860d7[_0xbf39('0x5c')][_0xbf39('0x5c')],'phone':_0x3aba9a,'WhatsappAccountId':_0xa2a155['id'],'UserId':_0xb860d7[_0xbf39('0xb9')]['id'],'ContactId':_0x374778['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xbf39('0xbb')}]})['then'](function(_0x1afe9a){return[_0x1afe9a,!![]];});});}})[_0xbf39('0x74')](function(_0x1523fe,_0x565133){if(_0x565133){return _0x1523fe;}return db[_0xbf39('0xab')]['create'](_[_0xbf39('0x54')](_0xb860d7[_0xbf39('0x5c')],{'read':![],'body':_0xb860d7[_0xbf39('0x5c')]['body'],'phone':_0x3aba9a,'WhatsappAccountId':_0xa2a155['id'],'WhatsappInteractionId':_0x1523fe['id'],'UserId':_0xb860d7['user']['id'],'ContactId':_0x374778['id']}))['then'](function(_0xbf1ff3){_0x1523fe['dataValues'][_0xbf39('0xbb')]=[];_0x1523fe[_0xbf39('0xbc')][_0xbf39('0xbb')][_0xbf39('0xa8')](_0xbf1ff3[_0xbf39('0xbc')]);return _0x1523fe;});})[_0xbf39('0x21')](respondWithResult(_0x9468c0,null))[_0xbf39('0x2c')](handleError(_0x9468c0,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 1f47eb4..c2e6e98 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 _0x8815=['events','WhatsappAccount','setMaxListeners','update','remove','hook'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x8815,0x150));var _0x5881=function(_0x2defb5,_0x1cda14){_0x2defb5=_0x2defb5-0x0;var _0x229c53=_0x8815[_0x2defb5];return _0x229c53;};'use strict';var EventEmitter=require(_0x5881('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x5881('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5881('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5881('0x3'),'afterDestroy':_0x5881('0x4')};function emitEvent(_0xd3502a){return function(_0xee60a8,_0x25d8d1,_0x17737e){WhatsappAccountEvents['emit'](_0xd3502a+':'+_0xee60a8['id'],_0xee60a8);WhatsappAccountEvents['emit'](_0xd3502a,_0xee60a8);_0x17737e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x5881('0x5')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x3a9e=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','update'];(function(_0x437eca,_0x55ba5e){var _0x3548dc=function(_0xc42c4f){while(--_0xc42c4f){_0x437eca['push'](_0x437eca['shift']());}};_0x3548dc(++_0x55ba5e);}(_0x3a9e,0x148));var _0xe3a9=function(_0x4b7d87,_0x238711){_0x4b7d87=_0x4b7d87-0x0;var _0x3b9f82=_0x3a9e[_0x4b7d87];return _0x3b9f82;};'use strict';var EventEmitter=require(_0xe3a9('0x0'));var WhatsappAccount=require(_0xe3a9('0x1'))['db'][_0xe3a9('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe3a9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe3a9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x531be8){return function(_0x1ca1d7,_0x2a5122,_0x2f6ba2){WhatsappAccountEvents['emit'](_0x531be8+':'+_0x1ca1d7['id'],_0x1ca1d7);WhatsappAccountEvents[_0xe3a9('0x5')](_0x531be8,_0x1ca1d7);_0x2f6ba2(null);};}for(var e in events){if(events[_0xe3a9('0x6')](e)){var event=events[e];WhatsappAccount[_0xe3a9('0x7')](e,emitEvent(event));}}module[_0xe3a9('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 08d8b82..fb270ad 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 _0x4d85=['./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0x4d85,0xd0));var _0x54d8=function(_0x579dfd,_0x49ec2d){_0x579dfd=_0x579dfd-0x0;var _0x3231dc=_0x4d85[_0x579dfd];return _0x3231dc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x54d8('0x0'))(_0x54d8('0x1'));var moment=require(_0x54d8('0x2'));var BPromise=require(_0x54d8('0x3'));var rp=require(_0x54d8('0x4'));var fs=require('fs');var path=require(_0x54d8('0x5'));var rimraf=require(_0x54d8('0x6'));var config=require(_0x54d8('0x7'));var attributes=require(_0x54d8('0x8'));module[_0x54d8('0x9')]=function(_0xe5dd14,_0x5d7e80){return _0xe5dd14['define'](_0x54d8('0xa'),attributes,{'tableName':_0x54d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8c5=['rimraf','./whatsappAccount.attributes','WhatsappAccount','whatsapp_accounts','util','api','moment','request-promise','path'];(function(_0x2cdb5d,_0x53bd50){var _0x148126=function(_0x3feb98){while(--_0x3feb98){_0x2cdb5d['push'](_0x2cdb5d['shift']());}};_0x148126(++_0x53bd50);}(_0xe8c5,0x16c));var _0x5e8c=function(_0x2c9dab,_0x129ae5){_0x2c9dab=_0x2c9dab-0x0;var _0x442213=_0xe8c5[_0x2c9dab];return _0x442213;};'use strict';var _=require('lodash');var util=require(_0x5e8c('0x0'));var logger=require('../../config/logger')(_0x5e8c('0x1'));var moment=require(_0x5e8c('0x2'));var BPromise=require('bluebird');var rp=require(_0x5e8c('0x3'));var fs=require('fs');var path=require(_0x5e8c('0x4'));var rimraf=require(_0x5e8c('0x5'));var config=require('../../config/environment');var attributes=require(_0x5e8c('0x6'));module['exports']=function(_0x4443e9,_0x8a377){return _0x4443e9['define'](_0x5e8c('0x7'),attributes,{'tableName':_0x5e8c('0x8'),'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 3ead721..bb80316 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 _0x564a=['model','attributes','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','debug','request\x20sent','error','code','message','info','WhatsappAccount,\x20%s,\x20%s','catch','ShowWhatsappAccount','find','options','raw','where','include','map'];(function(_0x1c0058,_0x25d0cf){var _0x480919=function(_0x25c458){while(--_0x25c458){_0x1c0058['push'](_0x1c0058['shift']());}};_0x480919(++_0x25d0cf);}(_0x564a,0x1de));var _0xa564=function(_0x45cc6e,_0x55e0d0){_0x45cc6e=_0x45cc6e-0x0;var _0x492cf1=_0x564a[_0x45cc6e];return _0x492cf1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa564('0x0'));var rs=require(_0xa564('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa564('0x2'))['db'];var utils=require(_0xa564('0x3'));var logger=require(_0xa564('0x4'))(_0xa564('0x5'));var config=require(_0xa564('0x6'));var jayson=require(_0xa564('0x7'));var client=jayson[_0xa564('0x8')][_0xa564('0x9')]({'port':0x232a});config['redis']=_[_0xa564('0xa')](config[_0xa564('0xb')],{'host':_0xa564('0xc'),'port':0x18eb});var socket=require(_0xa564('0xd'))(new Redis(config[_0xa564('0xb')]));require(_0xa564('0xe'))['register'](socket);function respondWithRpcPromise(_0x27c50e,_0x5b8552,_0x32be4d){return new BPromise(function(_0x3d82a0,_0x47b662){return client[_0xa564('0xf')](_0x27c50e,_0x32be4d)[_0xa564('0x10')](function(_0x21efec){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x5b8552,'request\x20sent');logger[_0xa564('0x11')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5b8552,_0xa564('0x12'),JSON['stringify'](_0x21efec));if(_0x21efec[_0xa564('0x13')]){if(_0x21efec['error'][_0xa564('0x14')]===0x1f4){logger[_0xa564('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x5b8552,_0x21efec[_0xa564('0x13')][_0xa564('0x15')]);return _0x47b662(_0x21efec['error']['message']);}logger[_0xa564('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x5b8552,_0x21efec[_0xa564('0x13')][_0xa564('0x15')]);return _0x3d82a0(_0x21efec[_0xa564('0x13')][_0xa564('0x15')]);}else{logger[_0xa564('0x16')](_0xa564('0x17'),_0x5b8552,_0xa564('0x12'));_0x3d82a0(_0x21efec['result']['message']);}})[_0xa564('0x18')](function(_0x54f500){logger[_0xa564('0x13')](_0xa564('0x17'),_0x5b8552,_0x54f500);_0x47b662(_0x54f500);});});}exports[_0xa564('0x19')]=function(_0x39372b){var _0x4cffd0=this;return new Promise(function(_0x10770e,_0x3ac934){return db['WhatsappAccount'][_0xa564('0x1a')]({'raw':_0x39372b[_0xa564('0x1b')]?_0x39372b['options'][_0xa564('0x1c')]===undefined?!![]:![]:!![],'where':_0x39372b['options']?_0x39372b[_0xa564('0x1b')][_0xa564('0x1d')]||null:null,'attributes':_0x39372b[_0xa564('0x1b')]?_0x39372b['options']['attributes']||null:null,'include':_0x39372b['options']?_0x39372b[_0xa564('0x1b')][_0xa564('0x1e')]?_[_0xa564('0x1f')](_0x39372b[_0xa564('0x1b')][_0xa564('0x1e')],function(_0x317c71){return{'model':db[_0x317c71[_0xa564('0x20')]],'as':_0x317c71['as'],'attributes':_0x317c71[_0xa564('0x21')],'include':_0x317c71['include']?_['map'](_0x317c71['include'],function(_0x429c8c){return{'model':db[_0x429c8c['model']],'as':_0x429c8c['as'],'attributes':_0x429c8c[_0xa564('0x21')],'include':_0x429c8c[_0xa564('0x1e')]?_['map'](_0x429c8c[_0xa564('0x1e')],function(_0x18ee0b){return{'model':db[_0x18ee0b[_0xa564('0x20')]],'as':_0x18ee0b['as'],'attributes':_0x18ee0b[_0xa564('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa564('0x10')](function(_0xd7f74b){logger[_0xa564('0x16')]('ShowWhatsappAccount',_0x39372b);logger[_0xa564('0x11')](_0xa564('0x19'),_0x39372b,JSON['stringify'](_0xd7f74b));_0x10770e(_0xd7f74b);})[_0xa564('0x18')](function(_0x218ac0){logger[_0xa564('0x13')]('ShowWhatsappAccount',_0x218ac0[_0xa564('0x15')],_0x39372b);_0x3ac934(_0x4cffd0[_0xa564('0x13')](0x1f4,_0x218ac0[_0xa564('0x15')]));});});}; \ No newline at end of file +var _0xed27=['WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','WhatsappAccount','options','where','include','map','attributes','model','ShowWhatsappAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info'];(function(_0x50cbad,_0x54b962){var _0x1695e8=function(_0x59ee38){while(--_0x59ee38){_0x50cbad['push'](_0x50cbad['shift']());}};_0x1695e8(++_0x54b962);}(_0xed27,0x183));var _0x7ed2=function(_0x3e90b2,_0x5237f2){_0x3e90b2=_0x3e90b2-0x0;var _0x1fcdc3=_0xed27[_0x3e90b2];return _0x1fcdc3;};'use strict';var _=require(_0x7ed2('0x0'));var util=require(_0x7ed2('0x1'));var moment=require(_0x7ed2('0x2'));var BPromise=require('bluebird');var rs=require(_0x7ed2('0x3'));var fs=require('fs');var Redis=require(_0x7ed2('0x4'));var db=require(_0x7ed2('0x5'))['db'];var utils=require(_0x7ed2('0x6'));var logger=require(_0x7ed2('0x7'))('rpc');var config=require(_0x7ed2('0x8'));var jayson=require(_0x7ed2('0x9'));var client=jayson[_0x7ed2('0xa')][_0x7ed2('0xb')]({'port':0x232a});config[_0x7ed2('0xc')]=_[_0x7ed2('0xd')](config[_0x7ed2('0xc')],{'host':_0x7ed2('0xe'),'port':0x18eb});var socket=require(_0x7ed2('0xf'))(new Redis(config[_0x7ed2('0xc')]));require('./whatsappAccount.socket')[_0x7ed2('0x10')](socket);function respondWithRpcPromise(_0x52d160,_0x445ff7,_0x53c76d){return new BPromise(function(_0x506e69,_0x2eac31){return client[_0x7ed2('0x11')](_0x52d160,_0x53c76d)[_0x7ed2('0x12')](function(_0x384d31){logger[_0x7ed2('0x13')](_0x7ed2('0x14'),_0x445ff7,_0x7ed2('0x15'));logger[_0x7ed2('0x16')](_0x7ed2('0x17'),_0x445ff7,'request\x20sent',JSON['stringify'](_0x384d31));if(_0x384d31['error']){if(_0x384d31[_0x7ed2('0x18')][_0x7ed2('0x19')]===0x1f4){logger[_0x7ed2('0x18')](_0x7ed2('0x14'),_0x445ff7,_0x384d31[_0x7ed2('0x18')][_0x7ed2('0x1a')]);return _0x2eac31(_0x384d31[_0x7ed2('0x18')]['message']);}logger[_0x7ed2('0x18')](_0x7ed2('0x14'),_0x445ff7,_0x384d31[_0x7ed2('0x18')][_0x7ed2('0x1a')]);return _0x506e69(_0x384d31[_0x7ed2('0x18')]['message']);}else{logger[_0x7ed2('0x13')](_0x7ed2('0x14'),_0x445ff7,_0x7ed2('0x15'));_0x506e69(_0x384d31[_0x7ed2('0x1b')][_0x7ed2('0x1a')]);}})[_0x7ed2('0x1c')](function(_0x2cb9f4){logger[_0x7ed2('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x445ff7,_0x2cb9f4);_0x2eac31(_0x2cb9f4);});});}exports['ShowWhatsappAccount']=function(_0x510e54){var _0x3b2e20=this;return new Promise(function(_0xcef16b,_0x50d02b){return db[_0x7ed2('0x1d')]['find']({'raw':_0x510e54[_0x7ed2('0x1e')]?_0x510e54[_0x7ed2('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x510e54[_0x7ed2('0x1e')]?_0x510e54[_0x7ed2('0x1e')][_0x7ed2('0x1f')]||null:null,'attributes':_0x510e54[_0x7ed2('0x1e')]?_0x510e54[_0x7ed2('0x1e')]['attributes']||null:null,'include':_0x510e54['options']?_0x510e54[_0x7ed2('0x1e')][_0x7ed2('0x20')]?_[_0x7ed2('0x21')](_0x510e54[_0x7ed2('0x1e')][_0x7ed2('0x20')],function(_0x14db8b){return{'model':db[_0x14db8b['model']],'as':_0x14db8b['as'],'attributes':_0x14db8b[_0x7ed2('0x22')],'include':_0x14db8b['include']?_[_0x7ed2('0x21')](_0x14db8b[_0x7ed2('0x20')],function(_0x437d09){return{'model':db[_0x437d09['model']],'as':_0x437d09['as'],'attributes':_0x437d09[_0x7ed2('0x22')],'include':_0x437d09['include']?_[_0x7ed2('0x21')](_0x437d09[_0x7ed2('0x20')],function(_0x3cf5f6){return{'model':db[_0x3cf5f6[_0x7ed2('0x23')]],'as':_0x3cf5f6['as'],'attributes':_0x3cf5f6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5737e5){logger[_0x7ed2('0x13')](_0x7ed2('0x24'),_0x510e54);logger[_0x7ed2('0x16')](_0x7ed2('0x24'),_0x510e54,JSON['stringify'](_0x5737e5));_0xcef16b(_0x5737e5);})[_0x7ed2('0x1c')](function(_0x1a28d1){logger[_0x7ed2('0x18')](_0x7ed2('0x24'),_0x1a28d1['message'],_0x510e54);_0x50d02b(_0x3b2e20[_0x7ed2('0x18')](0x1f4,_0x1a28d1[_0x7ed2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index b6ca13f..29ee098 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 _0xdcbc=['removeListener','register','whatsappAccount:','save','remove','emit'];(function(_0x35939c,_0x26d676){var _0x5db96f=function(_0x88f4){while(--_0x88f4){_0x35939c['push'](_0x35939c['shift']());}};_0x5db96f(++_0x26d676);}(_0xdcbc,0xab));var _0xcdcb=function(_0x15407e,_0x30ee0d){_0x15407e=_0x15407e-0x0;var _0x113423=_0xdcbc[_0x15407e];return _0x113423;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xcdcb('0x0'),_0xcdcb('0x1'),'update'];function createListener(_0x13b94f,_0x55793a){return function(_0x5bb4cc){_0x55793a[_0xcdcb('0x2')](_0x13b94f,_0x5bb4cc);};}function removeListener(_0x4d5286,_0x5bcc58){return function(){WhatsappAccountEvents[_0xcdcb('0x3')](_0x4d5286,_0x5bcc58);};}exports[_0xcdcb('0x4')]=function(_0x86dea9){for(var _0x48a0bf=0x0,_0xbc1770=events['length'];_0x48a0bf<_0xbc1770;_0x48a0bf++){var _0x2949d2=events[_0x48a0bf];var _0x20b235=createListener(_0xcdcb('0x5')+_0x2949d2,_0x86dea9);WhatsappAccountEvents['on'](_0x2949d2,_0x20b235);}}; \ No newline at end of file +var _0xe94c=['length','whatsappAccount:','save','remove','update','emit','removeListener','register'];(function(_0x2709bd,_0x274e31){var _0x4b5d5c=function(_0x5f3a3b){while(--_0x5f3a3b){_0x2709bd['push'](_0x2709bd['shift']());}};_0x4b5d5c(++_0x274e31);}(_0xe94c,0x72));var _0xce94=function(_0x3ee47d,_0x36208c){_0x3ee47d=_0x3ee47d-0x0;var _0x32da51=_0xe94c[_0x3ee47d];return _0x32da51;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xce94('0x0'),_0xce94('0x1'),_0xce94('0x2')];function createListener(_0x2a3f8a,_0x2fe1fe){return function(_0x422238){_0x2fe1fe[_0xce94('0x3')](_0x2a3f8a,_0x422238);};}function removeListener(_0x9ab364,_0x4ce66a){return function(){WhatsappAccountEvents[_0xce94('0x4')](_0x9ab364,_0x4ce66a);};}exports[_0xce94('0x5')]=function(_0x387620){for(var _0x380768=0x0,_0x2b0974=events[_0xce94('0x6')];_0x380768<_0x2b0974;_0x380768++){var _0x4adad8=events[_0x380768];var _0x2c9834=createListener(_0xce94('0x7')+_0x4adad8,_0x387620);WhatsappAccountEvents['on'](_0x4adad8,_0x2c9834);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index f9beb7e..b57e6c0 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 _0xb6d5=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5c9dab,_0x152aa1){var _0x2f8aca=function(_0x4a91f7){while(--_0x4a91f7){_0x5c9dab['push'](_0x5c9dab['shift']());}};_0x2f8aca(++_0x152aa1);}(_0xb6d5,0xd1));var _0x5b6d=function(_0x155af3,_0x4b7f9a){_0x155af3=_0x155af3-0x0;var _0x15a675=_0xb6d5[_0x155af3];return _0x15a675;};'use strict';var multer=require(_0x5b6d('0x0'));var util=require(_0x5b6d('0x1'));var path=require(_0x5b6d('0x2'));var timeout=require('connect-timeout');var express=require(_0x5b6d('0x3'));var router=express[_0x5b6d('0x4')]();var fs_extra=require(_0x5b6d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5b6d('0x6'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x5b6d('0x7')]('/',auth[_0x5b6d('0x8')](),controller[_0x5b6d('0x9')]);router['get'](_0x5b6d('0xa'),auth[_0x5b6d('0x8')](),controller[_0x5b6d('0xb')]);router[_0x5b6d('0xc')]('/',auth['isAuthenticated'](),controller[_0x5b6d('0xd')]);router[_0x5b6d('0xe')](_0x5b6d('0xa'),auth[_0x5b6d('0x8')](),controller[_0x5b6d('0xf')]);router[_0x5b6d('0x10')](_0x5b6d('0xa'),auth[_0x5b6d('0x8')](),controller[_0x5b6d('0x11')]);module[_0x5b6d('0x12')]=router; \ No newline at end of file +var _0x556a=['index','/:id','show','post','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x556a,0x15f));var _0xa556=function(_0x501525,_0x405f2f){_0x501525=_0x501525-0x0;var _0xa5ac26=_0x556a[_0x501525];return _0xa5ac26;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa556('0x0'));var timeout=require(_0xa556('0x1'));var express=require(_0xa556('0x2'));var router=express[_0xa556('0x3')]();var fs_extra=require(_0xa556('0x4'));var auth=require(_0xa556('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa556('0x6'));router[_0xa556('0x7')]('/',auth[_0xa556('0x8')](),controller[_0xa556('0x9')]);router[_0xa556('0x7')](_0xa556('0xa'),auth[_0xa556('0x8')](),controller[_0xa556('0xb')]);router[_0xa556('0xc')]('/',auth[_0xa556('0x8')](),controller['create']);router[_0xa556('0xd')](_0xa556('0xa'),auth[_0xa556('0x8')](),controller[_0xa556('0xe')]);router[_0xa556('0xf')](_0xa556('0xa'),auth['isAuthenticated'](),controller[_0xa556('0x10')]);module[_0xa556('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index f3859f7..40b77b9 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 _0x7ccf=['sequelize','STRING','noop','*,*,*,*'];(function(_0x5bee05,_0x22f7e7){var _0x3308f7=function(_0x43e2e4){while(--_0x43e2e4){_0x5bee05['push'](_0x5bee05['shift']());}};_0x3308f7(++_0x22f7e7);}(_0x7ccf,0xbc));var _0xf7cc=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0x7ccf[_0x310d10];return _0x1fb8af;};'use strict';var Sequelize=require(_0xf7cc('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf7cc('0x1')],'allowNull':![],'defaultValue':_0xf7cc('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf7cc('0x1')]},'interval':{'type':Sequelize[_0xf7cc('0x1')],'defaultValue':_0xf7cc('0x3')}}; \ No newline at end of file +var _0x6647=['TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x49120d,_0x5ccda5){var _0x266964=function(_0x1c6b13){while(--_0x1c6b13){_0x49120d['push'](_0x49120d['shift']());}};_0x266964(++_0x5ccda5);}(_0x6647,0x74));var _0x7664=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6647[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x7664('0x0'));module[_0x7664('0x1')]={'priority':{'type':Sequelize[_0x7664('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7664('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7664('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7664('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 5fb0cf0..b029042 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 _0x1228=['end','json','undefined','count','limit','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappApplication','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','offset','sort','pick','filter','where','merge','type','options','includeAll','rows','catch','params','length','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x1228,0x12f));var _0x8122=function(_0x7ec937,_0xbe3b08){_0x7ec937=_0x7ec937-0x0;var _0x150040=_0x1228[_0x7ec937];return _0x150040;};'use strict';var emlformat=require(_0x8122('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8122('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8122('0x2'));var moment=require(_0x8122('0x3'));var BPromise=require(_0x8122('0x4'));var Mustache=require('mustache');var util=require(_0x8122('0x5'));var path=require(_0x8122('0x6'));var sox=require('sox');var csv=require(_0x8122('0x7'));var ejs=require(_0x8122('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8122('0x9'));var squel=require(_0x8122('0xa'));var crypto=require('crypto');var jsforce=require(_0x8122('0xb'));var deskjs=require(_0x8122('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8122('0xd'));var Papa=require(_0x8122('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8122('0xf'));var logger=require('../../config/logger')(_0x8122('0x10'));var utils=require(_0x8122('0x11'));var config=require(_0x8122('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8122('0x13'))['db'];function respondWithStatusCode(_0x565f6e,_0x162ed4){_0x162ed4=_0x162ed4||0xcc;return function(_0x1ca828){if(_0x1ca828){return _0x565f6e[_0x8122('0x14')](_0x162ed4);}return _0x565f6e[_0x8122('0x15')](_0x162ed4)[_0x8122('0x16')]();};}function respondWithResult(_0x266feb,_0x1fa431){_0x1fa431=_0x1fa431||0xc8;return function(_0x1be8e2){if(_0x1be8e2){return _0x266feb[_0x8122('0x15')](_0x1fa431)[_0x8122('0x17')](_0x1be8e2);}};}function respondWithFilteredResult(_0xfa15a2,_0x6baf37){return function(_0x559256){if(_0x559256){var _0x3ed5d1=typeof _0x6baf37['offset']===_0x8122('0x18')&&typeof _0x6baf37['limit']===_0x8122('0x18');var _0x2acf8f=_0x559256[_0x8122('0x19')];var _0x4bfb9e=_0x3ed5d1?0x0:_0x6baf37['offset'];var _0x4f7277=_0x3ed5d1?_0x559256['count']:_0x6baf37['offset']+_0x6baf37[_0x8122('0x1a')];var _0x2511e9;if(_0x4f7277>=_0x2acf8f){_0x4f7277=_0x2acf8f;_0x2511e9=0xc8;}else{_0x2511e9=0xce;}_0xfa15a2[_0x8122('0x15')](_0x2511e9);return _0xfa15a2['set']('Content-Range',_0x4bfb9e+'-'+_0x4f7277+'/'+_0x2acf8f)[_0x8122('0x17')](_0x559256);}return null;};}function patchUpdates(_0x174321){return function(_0x68761a){try{jsonpatch['apply'](_0x68761a,_0x174321,!![]);}catch(_0x15e635){return BPromise[_0x8122('0x1b')](_0x15e635);}return _0x68761a[_0x8122('0x1c')]();};}function saveUpdates(_0x988c0c,_0x3c6226){return function(_0x130e1b){if(_0x130e1b){return _0x130e1b[_0x8122('0x1d')](_0x988c0c)[_0x8122('0x1e')](function(_0x4fc6af){return _0x4fc6af;});}return null;};}function removeEntity(_0x34c185,_0x5cfa77){return function(_0x732946){if(_0x732946){return _0x732946[_0x8122('0x1f')]()[_0x8122('0x1e')](function(){_0x34c185[_0x8122('0x15')](0xcc)[_0x8122('0x16')]();});}};}function handleEntityNotFound(_0x240a6d,_0x40e945){return function(_0x2708a5){if(!_0x2708a5){_0x240a6d[_0x8122('0x14')](0x194);}return _0x2708a5;};}function handleError(_0x4e67ab,_0x1258d7){_0x1258d7=_0x1258d7||0x1f4;return function(_0xa79602){logger[_0x8122('0x20')](_0xa79602[_0x8122('0x21')]);if(_0xa79602[_0x8122('0x22')]){delete _0xa79602[_0x8122('0x22')];}_0x4e67ab[_0x8122('0x15')](_0x1258d7)[_0x8122('0x23')](_0xa79602);};}exports[_0x8122('0x24')]=function(_0x4610b1,_0x4c70f4){var _0x49531a={},_0x2a0b63={},_0x264ccf={'count':0x0,'rows':[]};var _0x5263ca=_['map'](db[_0x8122('0x25')][_0x8122('0x26')],function(_0x367ada){return{'name':_0x367ada['fieldName'],'type':_0x367ada['type'][_0x8122('0x27')]};});_0x2a0b63[_0x8122('0x28')]=_[_0x8122('0x29')](_0x5263ca,_0x8122('0x22'));_0x2a0b63[_0x8122('0x2a')]=_[_0x8122('0x2b')](_0x4610b1[_0x8122('0x2a')]);_0x2a0b63[_0x8122('0x2c')]=_[_0x8122('0x2d')](_0x2a0b63[_0x8122('0x28')],_0x2a0b63['query']);_0x49531a[_0x8122('0x2e')]=_[_0x8122('0x2d')](_0x2a0b63[_0x8122('0x28')],qs[_0x8122('0x2f')](_0x4610b1[_0x8122('0x2a')][_0x8122('0x2f')]));_0x49531a[_0x8122('0x2e')]=_0x49531a[_0x8122('0x2e')]['length']?_0x49531a['attributes']:_0x2a0b63[_0x8122('0x28')];if(!_0x4610b1['query']['hasOwnProperty'](_0x8122('0x30'))){_0x49531a['limit']=qs['limit'](_0x4610b1[_0x8122('0x2a')][_0x8122('0x1a')]);_0x49531a['offset']=qs[_0x8122('0x31')](_0x4610b1['query'][_0x8122('0x31')]);}_0x49531a['order']=qs[_0x8122('0x32')](_0x4610b1[_0x8122('0x2a')]['sort']);_0x49531a['where']=qs['filters'](_[_0x8122('0x33')](_0x4610b1[_0x8122('0x2a')],_0x2a0b63['filters']),_0x5263ca);if(_0x4610b1[_0x8122('0x2a')][_0x8122('0x34')]){_0x49531a[_0x8122('0x35')]=_[_0x8122('0x36')](_0x49531a['where'],{'$or':_[_0x8122('0x29')](_0x5263ca,function(_0x1a1510){if(_0x1a1510[_0x8122('0x37')]!=='VIRTUAL'){var _0x3805ec={};_0x3805ec[_0x1a1510['name']]={'$like':'%'+_0x4610b1[_0x8122('0x2a')]['filter']+'%'};return _0x3805ec;}})});}_0x49531a=_[_0x8122('0x36')]({},_0x49531a,_0x4610b1[_0x8122('0x38')]);var _0x1e6c01={'where':_0x49531a[_0x8122('0x35')]};return db['WhatsappApplication'][_0x8122('0x19')](_0x1e6c01)[_0x8122('0x1e')](function(_0x565829){_0x264ccf[_0x8122('0x19')]=_0x565829;if(_0x4610b1[_0x8122('0x2a')][_0x8122('0x39')]){_0x49531a['include']=[{'all':!![]}];}return db[_0x8122('0x25')]['findAll'](_0x49531a);})[_0x8122('0x1e')](function(_0x3258e8){_0x264ccf[_0x8122('0x3a')]=_0x3258e8;return _0x264ccf;})[_0x8122('0x1e')](respondWithFilteredResult(_0x4c70f4,_0x49531a))[_0x8122('0x3b')](handleError(_0x4c70f4,null));};exports['show']=function(_0xbad19,_0x16ab8c){var _0x5bceb1={'raw':!![],'where':{'id':_0xbad19[_0x8122('0x3c')]['id']}},_0x3dbd77={};_0x3dbd77[_0x8122('0x28')]=_[_0x8122('0x2b')](db[_0x8122('0x25')][_0x8122('0x26')]);_0x3dbd77[_0x8122('0x2a')]=_['keys'](_0xbad19[_0x8122('0x2a')]);_0x3dbd77[_0x8122('0x2c')]=_[_0x8122('0x2d')](_0x3dbd77['model'],_0x3dbd77[_0x8122('0x2a')]);_0x5bceb1[_0x8122('0x2e')]=_[_0x8122('0x2d')](_0x3dbd77['model'],qs['fields'](_0xbad19[_0x8122('0x2a')]['fields']));_0x5bceb1['attributes']=_0x5bceb1[_0x8122('0x2e')][_0x8122('0x3d')]?_0x5bceb1[_0x8122('0x2e')]:_0x3dbd77['model'];if(_0xbad19[_0x8122('0x2a')][_0x8122('0x39')]){_0x5bceb1['include']=[{'all':!![]}];}_0x5bceb1=_[_0x8122('0x36')]({},_0x5bceb1,_0xbad19[_0x8122('0x38')]);return db[_0x8122('0x25')][_0x8122('0x3e')](_0x5bceb1)['then'](handleEntityNotFound(_0x16ab8c,null))[_0x8122('0x1e')](respondWithResult(_0x16ab8c,null))['catch'](handleError(_0x16ab8c,null));};exports[_0x8122('0x3f')]=function(_0x21860f,_0x5e6093){return db[_0x8122('0x25')][_0x8122('0x3f')](_0x21860f['body'],{})[_0x8122('0x1e')](respondWithResult(_0x5e6093,0xc9))[_0x8122('0x3b')](handleError(_0x5e6093,null));};exports[_0x8122('0x1d')]=function(_0x8c7e4f,_0x1d9ccf){if(_0x8c7e4f[_0x8122('0x40')]['id']){delete _0x8c7e4f[_0x8122('0x40')]['id'];}return db['WhatsappApplication'][_0x8122('0x3e')]({'where':{'id':_0x8c7e4f[_0x8122('0x3c')]['id']}})[_0x8122('0x1e')](handleEntityNotFound(_0x1d9ccf,null))[_0x8122('0x1e')](saveUpdates(_0x8c7e4f['body'],null))[_0x8122('0x1e')](respondWithResult(_0x1d9ccf,null))[_0x8122('0x3b')](handleError(_0x1d9ccf,null));};exports[_0x8122('0x1f')]=function(_0x4bac94,_0x3618cb){return db[_0x8122('0x25')][_0x8122('0x3e')]({'where':{'id':_0x4bac94[_0x8122('0x3c')]['id']}})[_0x8122('0x1e')](handleEntityNotFound(_0x3618cb,null))['then'](removeEntity(_0x3618cb,null))[_0x8122('0x3b')](handleError(_0x3618cb,null));}; \ No newline at end of file +var _0xf5b6=['rows','catch','show','intersection','length','find','create','body','update','params','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include'];(function(_0x231673,_0x527a2b){var _0x35951f=function(_0x4208ee){while(--_0x4208ee){_0x231673['push'](_0x231673['shift']());}};_0x35951f(++_0x527a2b);}(_0xf5b6,0x1b4));var _0x6f5b=function(_0x201988,_0x460356){_0x201988=_0x201988-0x0;var _0x41acf3=_0xf5b6[_0x201988];return _0x41acf3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f5b('0x0'));var jsonpatch=require(_0x6f5b('0x1'));var rp=require(_0x6f5b('0x2'));var moment=require(_0x6f5b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6f5b('0x4'));var util=require(_0x6f5b('0x5'));var path=require(_0x6f5b('0x6'));var sox=require(_0x6f5b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f5b('0x8'));var _=require(_0x6f5b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6f5b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6f5b('0xb'));var querystring=require(_0x6f5b('0xc'));var Papa=require(_0x6f5b('0xd'));var Redis=require('ioredis');var authService=require(_0x6f5b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6f5b('0xf'));var hardwareService=require(_0x6f5b('0x10'));var logger=require(_0x6f5b('0x11'))(_0x6f5b('0x12'));var utils=require(_0x6f5b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6f5b('0x14'));var db=require(_0x6f5b('0x15'))['db'];function respondWithStatusCode(_0x3ee308,_0x515f59){_0x515f59=_0x515f59||0xcc;return function(_0x5a28b8){if(_0x5a28b8){return _0x3ee308[_0x6f5b('0x16')](_0x515f59);}return _0x3ee308[_0x6f5b('0x17')](_0x515f59)[_0x6f5b('0x18')]();};}function respondWithResult(_0x557dd3,_0x1d45dc){_0x1d45dc=_0x1d45dc||0xc8;return function(_0x487962){if(_0x487962){return _0x557dd3[_0x6f5b('0x17')](_0x1d45dc)['json'](_0x487962);}};}function respondWithFilteredResult(_0x3b0fc6,_0xc4c3cc){return function(_0x4ac6c5){if(_0x4ac6c5){var _0xc7288f=typeof _0xc4c3cc[_0x6f5b('0x19')]===_0x6f5b('0x1a')&&typeof _0xc4c3cc[_0x6f5b('0x1b')]===_0x6f5b('0x1a');var _0x3667d8=_0x4ac6c5[_0x6f5b('0x1c')];var _0x1d3452=_0xc7288f?0x0:_0xc4c3cc[_0x6f5b('0x19')];var _0x377c79=_0xc7288f?_0x4ac6c5[_0x6f5b('0x1c')]:_0xc4c3cc[_0x6f5b('0x19')]+_0xc4c3cc[_0x6f5b('0x1b')];var _0x449063;if(_0x377c79>=_0x3667d8){_0x377c79=_0x3667d8;_0x449063=0xc8;}else{_0x449063=0xce;}_0x3b0fc6['status'](_0x449063);return _0x3b0fc6[_0x6f5b('0x1d')](_0x6f5b('0x1e'),_0x1d3452+'-'+_0x377c79+'/'+_0x3667d8)[_0x6f5b('0x1f')](_0x4ac6c5);}return null;};}function patchUpdates(_0x448a8a){return function(_0x4dab9e){try{jsonpatch[_0x6f5b('0x20')](_0x4dab9e,_0x448a8a,!![]);}catch(_0x139541){return BPromise['reject'](_0x139541);}return _0x4dab9e[_0x6f5b('0x21')]();};}function saveUpdates(_0x2fc9c4,_0x3ebff5){return function(_0x97d67f){if(_0x97d67f){return _0x97d67f['update'](_0x2fc9c4)[_0x6f5b('0x22')](function(_0x35f0b7){return _0x35f0b7;});}return null;};}function removeEntity(_0x3b3b2e,_0x1144a2){return function(_0x172d1c){if(_0x172d1c){return _0x172d1c[_0x6f5b('0x23')]()['then'](function(){_0x3b3b2e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5932d1,_0x55a867){return function(_0x4fc1d6){if(!_0x4fc1d6){_0x5932d1[_0x6f5b('0x16')](0x194);}return _0x4fc1d6;};}function handleError(_0x56adc4,_0x37e291){_0x37e291=_0x37e291||0x1f4;return function(_0x379348){logger[_0x6f5b('0x24')](_0x379348['stack']);if(_0x379348[_0x6f5b('0x25')]){delete _0x379348[_0x6f5b('0x25')];}_0x56adc4['status'](_0x37e291)[_0x6f5b('0x26')](_0x379348);};}exports[_0x6f5b('0x27')]=function(_0x4fa5de,_0xf55ca4){var _0x366f29={},_0x56807b={},_0x5835c1={'count':0x0,'rows':[]};var _0x9bffa4=_[_0x6f5b('0x28')](db[_0x6f5b('0x29')][_0x6f5b('0x2a')],function(_0xf10c82){return{'name':_0xf10c82[_0x6f5b('0x2b')],'type':_0xf10c82[_0x6f5b('0x2c')]['key']};});_0x56807b[_0x6f5b('0x2d')]=_[_0x6f5b('0x28')](_0x9bffa4,_0x6f5b('0x25'));_0x56807b[_0x6f5b('0x2e')]=_[_0x6f5b('0x2f')](_0x4fa5de[_0x6f5b('0x2e')]);_0x56807b['filters']=_['intersection'](_0x56807b[_0x6f5b('0x2d')],_0x56807b[_0x6f5b('0x2e')]);_0x366f29[_0x6f5b('0x30')]=_['intersection'](_0x56807b[_0x6f5b('0x2d')],qs[_0x6f5b('0x31')](_0x4fa5de[_0x6f5b('0x2e')][_0x6f5b('0x31')]));_0x366f29[_0x6f5b('0x30')]=_0x366f29[_0x6f5b('0x30')]['length']?_0x366f29[_0x6f5b('0x30')]:_0x56807b[_0x6f5b('0x2d')];if(!_0x4fa5de[_0x6f5b('0x2e')][_0x6f5b('0x32')](_0x6f5b('0x33'))){_0x366f29['limit']=qs[_0x6f5b('0x1b')](_0x4fa5de['query'][_0x6f5b('0x1b')]);_0x366f29['offset']=qs['offset'](_0x4fa5de[_0x6f5b('0x2e')]['offset']);}_0x366f29[_0x6f5b('0x34')]=qs[_0x6f5b('0x35')](_0x4fa5de['query'][_0x6f5b('0x35')]);_0x366f29[_0x6f5b('0x36')]=qs[_0x6f5b('0x37')](_['pick'](_0x4fa5de['query'],_0x56807b[_0x6f5b('0x37')]),_0x9bffa4);if(_0x4fa5de['query'][_0x6f5b('0x38')]){_0x366f29['where']=_[_0x6f5b('0x39')](_0x366f29[_0x6f5b('0x36')],{'$or':_[_0x6f5b('0x28')](_0x9bffa4,function(_0x571ba5){if(_0x571ba5[_0x6f5b('0x2c')]!=='VIRTUAL'){var _0x4378af={};_0x4378af[_0x571ba5[_0x6f5b('0x25')]]={'$like':'%'+_0x4fa5de[_0x6f5b('0x2e')][_0x6f5b('0x38')]+'%'};return _0x4378af;}})});}_0x366f29=_[_0x6f5b('0x39')]({},_0x366f29,_0x4fa5de[_0x6f5b('0x3a')]);var _0x227225={'where':_0x366f29[_0x6f5b('0x36')]};return db[_0x6f5b('0x29')][_0x6f5b('0x1c')](_0x227225)[_0x6f5b('0x22')](function(_0x322c5d){_0x5835c1[_0x6f5b('0x1c')]=_0x322c5d;if(_0x4fa5de[_0x6f5b('0x2e')][_0x6f5b('0x3b')]){_0x366f29[_0x6f5b('0x3c')]=[{'all':!![]}];}return db[_0x6f5b('0x29')]['findAll'](_0x366f29);})['then'](function(_0x25fdcb){_0x5835c1[_0x6f5b('0x3d')]=_0x25fdcb;return _0x5835c1;})[_0x6f5b('0x22')](respondWithFilteredResult(_0xf55ca4,_0x366f29))[_0x6f5b('0x3e')](handleError(_0xf55ca4,null));};exports[_0x6f5b('0x3f')]=function(_0x4f709f,_0x26bb22){var _0x54a5b6={'raw':!![],'where':{'id':_0x4f709f['params']['id']}},_0x3ca69b={};_0x3ca69b[_0x6f5b('0x2d')]=_[_0x6f5b('0x2f')](db[_0x6f5b('0x29')][_0x6f5b('0x2a')]);_0x3ca69b[_0x6f5b('0x2e')]=_['keys'](_0x4f709f[_0x6f5b('0x2e')]);_0x3ca69b['filters']=_[_0x6f5b('0x40')](_0x3ca69b['model'],_0x3ca69b[_0x6f5b('0x2e')]);_0x54a5b6['attributes']=_[_0x6f5b('0x40')](_0x3ca69b[_0x6f5b('0x2d')],qs[_0x6f5b('0x31')](_0x4f709f['query'][_0x6f5b('0x31')]));_0x54a5b6[_0x6f5b('0x30')]=_0x54a5b6[_0x6f5b('0x30')][_0x6f5b('0x41')]?_0x54a5b6['attributes']:_0x3ca69b['model'];if(_0x4f709f[_0x6f5b('0x2e')][_0x6f5b('0x3b')]){_0x54a5b6[_0x6f5b('0x3c')]=[{'all':!![]}];}_0x54a5b6=_[_0x6f5b('0x39')]({},_0x54a5b6,_0x4f709f['options']);return db['WhatsappApplication'][_0x6f5b('0x42')](_0x54a5b6)[_0x6f5b('0x22')](handleEntityNotFound(_0x26bb22,null))['then'](respondWithResult(_0x26bb22,null))[_0x6f5b('0x3e')](handleError(_0x26bb22,null));};exports[_0x6f5b('0x43')]=function(_0xc783b5,_0x123213){return db['WhatsappApplication'][_0x6f5b('0x43')](_0xc783b5[_0x6f5b('0x44')],{})[_0x6f5b('0x22')](respondWithResult(_0x123213,0xc9))[_0x6f5b('0x3e')](handleError(_0x123213,null));};exports[_0x6f5b('0x45')]=function(_0x53aff2,_0x4d946b){if(_0x53aff2[_0x6f5b('0x44')]['id']){delete _0x53aff2[_0x6f5b('0x44')]['id'];}return db['WhatsappApplication'][_0x6f5b('0x42')]({'where':{'id':_0x53aff2[_0x6f5b('0x46')]['id']}})[_0x6f5b('0x22')](handleEntityNotFound(_0x4d946b,null))[_0x6f5b('0x22')](saveUpdates(_0x53aff2[_0x6f5b('0x44')],null))[_0x6f5b('0x22')](respondWithResult(_0x4d946b,null))[_0x6f5b('0x3e')](handleError(_0x4d946b,null));};exports[_0x6f5b('0x23')]=function(_0x3636cb,_0x27ca66){return db['WhatsappApplication'][_0x6f5b('0x42')]({'where':{'id':_0x3636cb[_0x6f5b('0x46')]['id']}})[_0x6f5b('0x22')](handleEntityNotFound(_0x27ca66,null))[_0x6f5b('0x22')](removeEntity(_0x27ca66,null))[_0x6f5b('0x3e')](handleError(_0x27ca66,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index eb03e87..c5b8587 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 _0x3148=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4_unicode_ci','lodash'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3148,0x1d3));var _0x8314=function(_0x2565d5,_0xe6c944){_0x2565d5=_0x2565d5-0x0;var _0x1b546c=_0x3148[_0x2565d5];return _0x1b546c;};'use strict';var _=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var logger=require('../../config/logger')(_0x8314('0x2'));var moment=require(_0x8314('0x3'));var BPromise=require(_0x8314('0x4'));var rp=require(_0x8314('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8314('0x6'));var config=require(_0x8314('0x7'));var attributes=require(_0x8314('0x8'));module[_0x8314('0x9')]=function(_0x18a30b,_0x9cb271){return _0x18a30b[_0x8314('0xa')]('WhatsappApplication',attributes,{'tableName':_0x8314('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8314('0xc')});}; \ No newline at end of file +var _0xf873=['bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xf873,0xb2));var _0x3f87=function(_0xed0e83,_0x377368){_0xed0e83=_0xed0e83-0x0;var _0x6e442a=_0xf873[_0xed0e83];return _0x6e442a;};'use strict';var _=require('lodash');var util=require(_0x3f87('0x0'));var logger=require(_0x3f87('0x1'))(_0x3f87('0x2'));var moment=require(_0x3f87('0x3'));var BPromise=require(_0x3f87('0x4'));var rp=require(_0x3f87('0x5'));var fs=require('fs');var path=require(_0x3f87('0x6'));var rimraf=require(_0x3f87('0x7'));var config=require(_0x3f87('0x8'));var attributes=require('./whatsappApplication.attributes');module[_0x3f87('0x9')]=function(_0x43c8e4,_0x27c03e){return _0x43c8e4['define'](_0x3f87('0xa'),attributes,{'tableName':_0x3f87('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3f87('0xc'),'collate':_0x3f87('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index c91105c..63ff00c 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 _0xda55=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x5bf9c0,_0x206f4c){var _0x285285=function(_0xbdbfbf){while(--_0xbdbfbf){_0x5bf9c0['push'](_0x5bf9c0['shift']());}};_0x285285(++_0x206f4c);}(_0xda55,0x6d));var _0x5da5=function(_0x4f1789,_0x37fda7){_0x4f1789=_0x4f1789-0x0;var _0x5bb8fe=_0xda55[_0x4f1789];return _0x5bb8fe;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd877,_0x267469,_0x71b187){return new BPromise(function(_0x46290d,_0x3debdf){return client[_0x5da5('0x9')](_0x2fd877,_0x71b187)[_0x5da5('0xa')](function(_0x302795){logger['info'](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x267469,_0x5da5('0xc'),JSON[_0x5da5('0xf')](_0x302795));if(_0x302795[_0x5da5('0x10')]){if(_0x302795['error'][_0x5da5('0x11')]===0x1f4){logger[_0x5da5('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x267469,_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);return _0x3debdf(_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);}logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x302795['error']['message']);return _0x46290d(_0x302795['error'][_0x5da5('0x12')]);}else{logger[_0x5da5('0x13')](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));_0x46290d(_0x302795[_0x5da5('0x14')][_0x5da5('0x12')]);}})[_0x5da5('0x15')](function(_0x4a952a){logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x4a952a);_0x3debdf(_0x4a952a);});});} \ No newline at end of file +var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappApplication,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x306eff,_0xbba498){var _0x4eccc6=function(_0x5dc838){while(--_0x5dc838){_0x306eff['push'](_0x306eff['shift']());}};_0x4eccc6(++_0xbba498);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0x4b84[_0x2de0a7];return _0x429437;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('WhatsappApplication,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 3ea0193..f4a0050 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 _0xe0ae=['update','delete','destroy','/:id/tags','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','index','get','/describe','isAuthenticated','show','/:id/messages','getMessages','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','/:id','whatsappinteraction:update'];(function(_0x4390a4,_0x31b8aa){var _0x4f3b4f=function(_0xbc8664){while(--_0xbc8664){_0x4390a4['push'](_0x4390a4['shift']());}};_0x4f3b4f(++_0x31b8aa);}(_0xe0ae,0xa1));var _0xee0a=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0xe0ae[_0x5d5bcb];return _0x4ea5eb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee0a('0x0'));var timeout=require(_0xee0a('0x1'));var express=require('express');var router=express[_0xee0a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xee0a('0x3'));var interaction=require(_0xee0a('0x4'));var config=require('../../config/environment');var controller=require(_0xee0a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xee0a('0x6')]);router[_0xee0a('0x7')](_0xee0a('0x8'),auth[_0xee0a('0x9')](),controller['describe']);router[_0xee0a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xee0a('0xa')]);router[_0xee0a('0x7')](_0xee0a('0xb'),auth['isAuthenticated'](),controller[_0xee0a('0xc')]);router[_0xee0a('0x7')]('/:id/download',auth[_0xee0a('0x9')](),controller['download']);router[_0xee0a('0xd')]('/',auth[_0xee0a('0x9')](),controller['create']);router[_0xee0a('0xd')]('/:id/messages',auth[_0xee0a('0x9')](),controller[_0xee0a('0xe')]);router['post']('/:id/tags',auth[_0xee0a('0x9')](),interaction[_0xee0a('0xf')](_0xee0a('0x10'),_0xee0a('0x11')),controller[_0xee0a('0x12')]);router['put'](_0xee0a('0x13'),auth[_0xee0a('0x9')](),interaction['tracked'](_0xee0a('0x10'),_0xee0a('0x14')),controller[_0xee0a('0x15')]);router[_0xee0a('0x16')]('/:id',auth[_0xee0a('0x9')](),interaction[_0xee0a('0xf')](_0xee0a('0x10'),'whatsappinteraction:destroy'),controller[_0xee0a('0x17')]);router[_0xee0a('0x16')](_0xee0a('0x18'),auth[_0xee0a('0x9')](),controller['removeTags']);module[_0xee0a('0x19')]=router; \ No newline at end of file +var _0x46ed=['describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','whatsapp','whatsappinteraction:addtags','put','update','delete','whatsappinteraction:destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x3c120e,_0x5094e9){var _0x21d514=function(_0x5961f7){while(--_0x5961f7){_0x3c120e['push'](_0x3c120e['shift']());}};_0x21d514(++_0x5094e9);}(_0x46ed,0x168));var _0xd46e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x46ed[_0x4ae6ef];return _0x3cbb4e;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd46e('0x5'));var interaction=require(_0xd46e('0x6'));var config=require('../../config/environment');var controller=require(_0xd46e('0x7'));router[_0xd46e('0x8')]('/',auth[_0xd46e('0x9')](),controller[_0xd46e('0xa')]);router[_0xd46e('0x8')](_0xd46e('0xb'),auth[_0xd46e('0x9')](),controller[_0xd46e('0xc')]);router[_0xd46e('0x8')](_0xd46e('0xd'),auth[_0xd46e('0x9')](),controller['show']);router[_0xd46e('0x8')](_0xd46e('0xe'),auth['isAuthenticated'](),controller[_0xd46e('0xf')]);router[_0xd46e('0x8')](_0xd46e('0x10'),auth[_0xd46e('0x9')](),controller[_0xd46e('0x11')]);router[_0xd46e('0x12')]('/',auth['isAuthenticated'](),controller[_0xd46e('0x13')]);router['post']('/:id/messages',auth[_0xd46e('0x9')](),controller[_0xd46e('0x14')]);router['post']('/:id/tags',auth[_0xd46e('0x9')](),interaction[_0xd46e('0x15')](_0xd46e('0x16'),_0xd46e('0x17')),controller['addTags']);router[_0xd46e('0x18')](_0xd46e('0xd'),auth[_0xd46e('0x9')](),interaction[_0xd46e('0x15')](_0xd46e('0x16'),'whatsappinteraction:update'),controller[_0xd46e('0x19')]);router[_0xd46e('0x1a')](_0xd46e('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0xd46e('0x16'),_0xd46e('0x1b')),controller['destroy']);router['delete'](_0xd46e('0x1c'),auth[_0xd46e('0x9')](),controller[_0xd46e('0x1d')]);module[_0xd46e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 3b5b83c..0d264a8 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 _0x0845=['BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x24b470,_0xd7c92d){var _0x4acedd=function(_0xb1ff13){while(--_0xb1ff13){_0x24b470['push'](_0x24b470['shift']());}};_0x4acedd(++_0xd7c92d);}(_0x0845,0x125));var _0x5084=function(_0x11e645,_0x5d8923){_0x11e645=_0x11e645-0x0;var _0x4e544a=_0x0845[_0x11e645];return _0x4e544a;};'use strict';var Sequelize=require(_0x5084('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x5084('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5084('0x2')]},'disposition':{'type':Sequelize[_0x5084('0x3')]},'secondDisposition':{'type':Sequelize[_0x5084('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5084('0x3')]},'note':{'type':Sequelize[_0x5084('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x5084('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x5084('0x4')]('in',_0x5084('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5084('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x9b69=['DATE','out','BOOLEAN','sequelize','moment','exports','STRING','ENUM'];(function(_0x467581,_0x18b68a){var _0x3c937b=function(_0x2d7fa5){while(--_0x2d7fa5){_0x467581['push'](_0x467581['shift']());}};_0x3c937b(++_0x18b68a);}(_0x9b69,0xa3));var _0x99b6=function(_0x2d37a8,_0x18c29d){_0x2d37a8=_0x2d37a8-0x0;var _0x9f247c=_0x9b69[_0x2d37a8];return _0x9f247c;};'use strict';var Sequelize=require(_0x99b6('0x0'));var moment=require(_0x99b6('0x1'));module[_0x99b6('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x99b6('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x99b6('0x3')]},'note':{'type':Sequelize[_0x99b6('0x3')]},'phone':{'type':Sequelize[_0x99b6('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x99b6('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x99b6('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x99b6('0x4')]('in',_0x99b6('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x99b6('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index a6e6d09..70687c6 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 _0xb377=['undefined','count','set','Content-Range','reject','destroy','then','end','error','name','send','Users','map','TagIds','Tags','split','push','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','field','color','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','keys','some','compact','isEmpty','WhatsappAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','keyBy','unreadMessages','Account.key','Account.mandatoryDisposition','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','contactName','i.*','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','all','show','includeAll','include','merge','options','create','catch','update','params','describe','addMessage','WhatsappMessage','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','ids','omit','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','server','tmp','join','root','files','attachments','format','fullname','CmContact','firstName','direction','secret','WhatsappAccount','Owner','mkdirSync','N.A.','closed','disposition','Messages','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','offset'];(function(_0x21f992,_0x4f3714){var _0x3b4e84=function(_0x27e621){while(--_0x27e621){_0x21f992['push'](_0x21f992['shift']());}};_0x3b4e84(++_0x4f3714);}(_0xb377,0x1b6));var _0x7b37=function(_0x49fc92,_0xf8005a){_0x49fc92=_0x49fc92-0x0;var _0x34ddd6=_0xb377[_0x49fc92];return _0x34ddd6;};'use strict';var emlformat=require(_0x7b37('0x0'));var rimraf=require(_0x7b37('0x1'));var zipdir=require(_0x7b37('0x2'));var jsonpatch=require(_0x7b37('0x3'));var rp=require(_0x7b37('0x4'));var moment=require(_0x7b37('0x5'));var BPromise=require(_0x7b37('0x6'));var Mustache=require(_0x7b37('0x7'));var util=require(_0x7b37('0x8'));var path=require(_0x7b37('0x9'));var sox=require(_0x7b37('0xa'));var csv=require(_0x7b37('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b37('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7b37('0xd'));var deskjs=require(_0x7b37('0xe'));var toCsv=require(_0x7b37('0xb'));var querystring=require(_0x7b37('0xf'));var Papa=require(_0x7b37('0x10'));var Redis=require(_0x7b37('0x11'));var authService=require(_0x7b37('0x12'));var qs=require(_0x7b37('0x13'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x7b37('0x14'));var hardwareService=require(_0x7b37('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x7b37('0x16'));var config=require(_0x7b37('0x17'));var licenseUtil=require(_0x7b37('0x18'));var db=require(_0x7b37('0x19'))['db'];config[_0x7b37('0x1a')]=_[_0x7b37('0x1b')](config[_0x7b37('0x1a')],{'host':_0x7b37('0x1c'),'port':0x18eb});var socket=require(_0x7b37('0x1d'))(new Redis(config[_0x7b37('0x1a')]));require(_0x7b37('0x1e'))[_0x7b37('0x1f')](socket);function respondWithStatusCode(_0x35a61f,_0x330ee2){_0x330ee2=_0x330ee2||0xcc;return function(_0xbfdc78){if(_0xbfdc78){return _0x35a61f[_0x7b37('0x20')](_0x330ee2);}return _0x35a61f[_0x7b37('0x21')](_0x330ee2)['end']();};}function respondWithResult(_0x537c83,_0x176a4f){_0x176a4f=_0x176a4f||0xc8;return function(_0x5b06f9){if(_0x5b06f9){return _0x537c83['status'](_0x176a4f)[_0x7b37('0x22')](_0x5b06f9);}};}function respondWithFilteredResult(_0x5a64fb,_0x1447aa){return function(_0x487f5c){if(_0x487f5c){var _0x29a9dd=typeof _0x1447aa[_0x7b37('0x23')]===_0x7b37('0x24')&&typeof _0x1447aa['limit']==='undefined';var _0x6905bb=_0x487f5c[_0x7b37('0x25')];var _0x3f3bbb=_0x29a9dd?0x0:_0x1447aa[_0x7b37('0x23')];var _0x30bf66=_0x29a9dd?_0x487f5c['count']:_0x1447aa['offset']+_0x1447aa['limit'];var _0x436d15;if(_0x30bf66>=_0x6905bb){_0x30bf66=_0x6905bb;_0x436d15=0xc8;}else{_0x436d15=0xce;}_0x5a64fb[_0x7b37('0x21')](_0x436d15);return _0x5a64fb[_0x7b37('0x26')](_0x7b37('0x27'),_0x3f3bbb+'-'+_0x30bf66+'/'+_0x6905bb)[_0x7b37('0x22')](_0x487f5c);}return null;};}function patchUpdates(_0x3059d8){return function(_0x11af8e){try{jsonpatch['apply'](_0x11af8e,_0x3059d8,!![]);}catch(_0x4066ea){return BPromise[_0x7b37('0x28')](_0x4066ea);}return _0x11af8e['save']();};}function saveUpdates(_0x239cfc,_0x4f03a2){return function(_0x1d9645){if(_0x1d9645){return _0x1d9645['update'](_0x239cfc)['then'](function(_0x2e3678){return _0x2e3678;});}return null;};}function removeEntity(_0x337759,_0x42d1d7){return function(_0x94ecb2){if(_0x94ecb2){return _0x94ecb2[_0x7b37('0x29')]()[_0x7b37('0x2a')](function(){_0x337759['status'](0xcc)[_0x7b37('0x2b')]();});}};}function handleEntityNotFound(_0xdc5403,_0x8df2fc){return function(_0x3d0cc1){if(!_0x3d0cc1){_0xdc5403[_0x7b37('0x20')](0x194);}return _0x3d0cc1;};}function handleError(_0x1e0433,_0x46810f){_0x46810f=_0x46810f||0x1f4;return function(_0x2bfdd1){logger[_0x7b37('0x2c')](_0x2bfdd1['stack']);if(_0x2bfdd1[_0x7b37('0x2d')]){delete _0x2bfdd1[_0x7b37('0x2d')];}_0x1e0433[_0x7b37('0x21')](_0x46810f)[_0x7b37('0x2e')](_0x2bfdd1);};}function getInteractionUsers(_0x50ac54,_0x2949c6){return new BPromise(function(_0x3282b9,_0x9c4451){try{if(_0x2949c6[_0x50ac54['id']]){_0x50ac54[_0x7b37('0x2f')]=_[_0x7b37('0x30')](_0x2949c6[_0x50ac54['id']],function(_0x3a60c5){return{'id':_0x3a60c5['id'],'fullname':_0x3a60c5['fullname']};});}}catch(_0x29ec63){_0x9c4451(_0x29ec63);}_0x3282b9(_0x50ac54);});}function getInteractionTags(_0x4a1def,_0x2cec69){return new BPromise(function(_0x5df623,_0x1844a9){try{if(_0x4a1def[_0x7b37('0x31')]){_0x4a1def[_0x7b37('0x32')]=[];_0x4a1def['TagIds'][_0x7b37('0x33')](',')['forEach'](function(_0x58cb03){_0x4a1def[_0x7b37('0x32')][_0x7b37('0x34')](_0x2cec69[_0x58cb03]);});}delete _0x4a1def['TagIds'];}catch(_0x1fde0c){_0x1844a9(_0x1fde0c);}_0x5df623(_0x4a1def);});}function updateWhatsappInteraction(_0x2abbdd,_0x4b29b7,_0x479052){return new BPromise(function(_0x234cbc,_0x4ad051){return getInteractionUsers(_0x2abbdd,_0x479052)['then'](function(_0x5a36eb){return getInteractionTags(_0x5a36eb,_0x4b29b7);})[_0x7b37('0x2a')](function(_0x562f69){_0x234cbc(_0x562f69);})['catch'](function(_0x153e83){_0x4ad051(_0x153e83);});});}exports[_0x7b37('0x35')]=function(_0x2bc27,_0x226e42){var _0x18ec5e={},_0x470d68={},_0x139910={'count':0x0,'rows':[]};var _0x4e0b6d=_[_0x7b37('0x30')](db[_0x7b37('0x36')][_0x7b37('0x37')],function(_0x2dd21e){return{'name':_0x2dd21e[_0x7b37('0x38')],'type':_0x2dd21e[_0x7b37('0x39')][_0x7b37('0x3a')]};});_0x470d68[_0x7b37('0x3b')]=_['map'](_0x4e0b6d,_0x7b37('0x2d'));_0x470d68[_0x7b37('0x3c')]=_['keys'](_0x2bc27[_0x7b37('0x3c')]);_0x470d68[_0x7b37('0x3d')]=_[_0x7b37('0x3e')](_0x470d68[_0x7b37('0x3b')],_0x470d68[_0x7b37('0x3c')]);_0x18ec5e[_0x7b37('0x3f')]=_[_0x7b37('0x3e')](_0x470d68[_0x7b37('0x3b')],qs[_0x7b37('0x40')](_0x2bc27[_0x7b37('0x3c')]['fields']));_0x18ec5e[_0x7b37('0x3f')]=_0x18ec5e[_0x7b37('0x3f')][_0x7b37('0x41')]?_0x18ec5e[_0x7b37('0x3f')]:_0x470d68[_0x7b37('0x3b')];if(!_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x42')](_0x7b37('0x43'))){_0x18ec5e['limit']=qs['limit'](_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x44')]);_0x18ec5e[_0x7b37('0x23')]=qs[_0x7b37('0x23')](_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x23')]);}_0x18ec5e[_0x7b37('0x45')]=qs[_0x7b37('0x46')](_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x46')]);_0x18ec5e[_0x7b37('0x47')]=qs['filters'](_['pick'](_0x2bc27[_0x7b37('0x3c')],_0x470d68['filters']),_0x4e0b6d);var _0x4297d6=[];var _0x2e708e=squel['select']()['field']('id')[_0x7b37('0x48')](_0x7b37('0x2d'))['field'](_0x7b37('0x49'))['from'](_0x7b37('0x4a'));var _0x14360b=squel[_0x7b37('0x4b')]()[_0x7b37('0x48')](_0x7b37('0x4c'))[_0x7b37('0x48')](_0x7b37('0x4d'))[_0x7b37('0x48')](_0x7b37('0x4e'))[_0x7b37('0x4f')](_0x7b37('0x50'),'ui')[_0x7b37('0x51')](_0x7b37('0x52'),'u',_0x7b37('0x53'));var _0x552779=squel['select']()[_0x7b37('0x4f')](_0x7b37('0x54'),'i')[_0x7b37('0x51')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x7b37('0x51')](_0x7b37('0x52'),'o',_0x7b37('0x55'))[_0x7b37('0x51')](_0x7b37('0x56'),'a',_0x7b37('0x57'))[_0x7b37('0x51')](_0x7b37('0x58'),'me',_0x7b37('0x59'))['left_join']('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0x7b37('0x51')]('tools_tags','t',_0x7b37('0x5a'));var _0x1b57b4=squel[_0x7b37('0x5b')]();var _0x3f365a=[];var _0x4defaa=squel[_0x7b37('0x5b')]();var _0x21c400;if(_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x5c')]){_0x21c400=as['parseSearch'](_0x2bc27['query'][_0x7b37('0x5c')]);var _0x290775=_0x21c400['sqlOperator'];for(var _0x2046ce=0x0;_0x2046ce<_0x21c400[_0x7b37('0x5d')]['length'];_0x2046ce++){var _0x203c91=_0x21c400[_0x7b37('0x5d')][_0x2046ce];var _0x3f9fb1='i';var _0x4f79c3=_['find'](_0x4e0b6d,[_0x7b37('0x2d'),_0x203c91[_0x7b37('0x48')]]);if(!_0x4f79c3){switch(_0x203c91[_0x7b37('0x48')]){case'unreadMessages':if(_0x203c91[_0x7b37('0x5e')]==0x1){_0x552779[_0x7b37('0x5f')]('`'+_0x203c91[_0x7b37('0x48')]+_0x7b37('0x60'));}else{_0x552779[_0x7b37('0x5f')]('`'+_0x203c91['field']+'`\x20>\x200');}break;case _0x7b37('0x61'):if(_0x203c91[_0x7b37('0x62')]===_0x7b37('0x63')){if(_0x203c91['value'][_0x7b37('0x33')]('\x20')['length']>0x1){_0x1b57b4[_0x290775](_0x7b37('0x64'),qs[_0x7b37('0x65')](_0x203c91[_0x7b37('0x5e')]),null);}else{var _0x31af15='%'+_0x203c91[_0x7b37('0x5e')]+'%';_0x1b57b4[_0x290775]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x31af15,_0x31af15,_0x31af15);}}else{_0x4f79c3=_[_0x7b37('0x66')](_0x4e0b6d,[_0x7b37('0x2d'),_0x7b37('0x67')]);_0x203c91[_0x7b37('0x48')]='ContactId';_0x5e386c=as['buildExpression'](_0x3f9fb1,_0x4f79c3[_0x7b37('0x39')],_0x203c91);_0x1b57b4[_0x290775](_0x5e386c[_0x7b37('0x68')],_0x5e386c[_0x7b37('0x5e')][_0x7b37('0x69')],_0x5e386c['value']['end']);}break;case _0x7b37('0x6a'):var _0x45429b=_0x203c91['value'][_0x7b37('0x33')](',')[_0x7b37('0x30')](function(_0x3b13d2){return Number(_0x3b13d2);});_0x45429b[_0x7b37('0x6b')](function(_0x3a4335){_0x4defaa['or'](_0x7b37('0x6c'),'%,'+_0x3a4335+',%');});_0x3f365a=_['union'](_0x3f365a,_0x45429b);break;case _0x7b37('0x6d'):if(_0x203c91[_0x7b37('0x62')]===_0x7b37('0x63')){_0x1b57b4[_0x290775](_0x7b37('0x6e'),'%'+_0x203c91[_0x7b37('0x5e')]+'%',null);}else{_0x4f79c3=_[_0x7b37('0x66')](_0x4e0b6d,[_0x7b37('0x2d'),_0x7b37('0x6f')]);_0x203c91[_0x7b37('0x48')]=_0x7b37('0x6f');_0x5e386c=as[_0x7b37('0x70')](_0x3f9fb1,_0x4f79c3[_0x7b37('0x39')],_0x203c91);_0x1b57b4[_0x290775](_0x5e386c[_0x7b37('0x68')],_0x5e386c[_0x7b37('0x5e')]['start'],_0x5e386c[_0x7b37('0x5e')]['end']);}break;case _0x7b37('0x71'):_0x5e386c=as[_0x7b37('0x70')]('me',null,_0x203c91);_0x1b57b4[_0x290775](_0x5e386c[_0x7b37('0x68')],_0x5e386c[_0x7b37('0x5e')][_0x7b37('0x69')],_0x5e386c[_0x7b37('0x5e')][_0x7b37('0x2b')]);break;}}else{var _0x5e386c=as[_0x7b37('0x70')](_0x3f9fb1,_0x4f79c3[_0x7b37('0x39')],_0x203c91);_0x1b57b4[_0x290775](_0x5e386c[_0x7b37('0x68')],_0x5e386c[_0x7b37('0x5e')][_0x7b37('0x69')],_0x5e386c[_0x7b37('0x5e')][_0x7b37('0x2b')]);}}}else{var _0x484aad=_(_0x2bc27[_0x7b37('0x3c')])[_0x7b37('0x72')]()[_0x7b37('0x30')](function(_0x10150a){return _[_0x7b37('0x73')](_0x4e0b6d,[_0x7b37('0x2d'),_0x10150a])?_0x10150a:undefined;})[_0x7b37('0x74')]()['value']();if(!_[_0x7b37('0x75')](_0x484aad)){_0x484aad[_0x7b37('0x6b')](function(_0x42e239){if(_0x42e239===_0x7b37('0x76')){_0x552779[_0x7b37('0x47')]('i.WhatsappAccountId\x20IN\x20?',[][_0x7b37('0x77')](_0x2bc27[_0x7b37('0x3c')][_0x42e239]));}else if(_0x42e239===_0x7b37('0x78')){var _0x497f90=JSON[_0x7b37('0x79')](_0x2bc27[_0x7b37('0x3c')][_0x42e239])[_0x7b37('0x7a')];var _0x2fd9fa=JSON['parse'](_0x2bc27[_0x7b37('0x3c')][_0x42e239])[_0x7b37('0x7b')];_0x552779[_0x7b37('0x47')](_0x7b37('0x7c'),_0x497f90,_0x2fd9fa);}else{if(_0x2bc27['query'][_0x42e239]===_0x7b37('0x7d')){_0x552779[_0x7b37('0x47')]('i.'+_0x42e239+_0x7b37('0x7e'));}else{_0x552779[_0x7b37('0x47')]('i.'+_0x42e239+'\x20=\x20?',_0x2bc27[_0x7b37('0x3c')][_0x42e239]);}}});}if(_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x7f')]){if(_0x2bc27[_0x7b37('0x3c')]['read']==0x1){_0x552779[_0x7b37('0x5f')](_0x7b37('0x80'));}else{_0x552779['having']('`unreadMessages`\x20>\x200');}}if(_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x81')]){_0x3f365a=_[_0x7b37('0x82')](_0x2bc27['query'][_0x7b37('0x81')])?_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x81')]:new Array(_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x81')]);_0x3f365a[_0x7b37('0x6b')](function(_0x2555fd){_0x4defaa['or'](_0x7b37('0x6c'),'%,'+_0x2555fd+',%');});}if(_0x2bc27['query'][_0x7b37('0x83')]){var _0x120387=_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x83')][_0x7b37('0x84')]('\x5c','\x5c\x5c')[_0x7b37('0x84')](/'/g,'\x27\x27');if(qs[_0x7b37('0x85')](_0x120387)){_0x1b57b4['or'](_0x7b37('0x86'),_0x120387+'%')['or'](_0x7b37('0x87'),_0x120387+'%');}else{_0x1b57b4['or'](_0x7b37('0x88'),qs[_0x7b37('0x65')](_0x120387))['or'](_0x7b37('0x89'),_0x120387+'%');}}}_0x552779[_0x7b37('0x47')](_0x1b57b4);_0x552779[_0x7b37('0x8a')](_0x7b37('0x8b'));var _0x24523b={'type':db[_0x7b37('0x8c')]['QueryTypes']['SELECT'],'raw':!![]};var _0x40f41b=_0x552779[_0x7b37('0x8d')]();_0x40f41b[_0x7b37('0x48')](_0x7b37('0x8b'));_0x40f41b[_0x7b37('0x48')](_0x7b37('0x8e'),'unreadMessages');if(_0x18ec5e[_0x7b37('0x45')]){_0x18ec5e[_0x7b37('0x45')][_0x7b37('0x6b')](function(_0x3a587a){var _0x1148fe=_0x3a587a[0x0]==='contactName'?_0x3a587a[0x0]:'i.'+_0x3a587a[0x0];_0x552779[_0x7b37('0x45')](_0x1148fe,_0x3a587a[0x1]==='DESC'?![]:!![]);});}if(!_[_0x7b37('0x75')](_0x3f365a)){_0x552779[_0x7b37('0x5f')](_0x4defaa);_0x40f41b['where'](_0x7b37('0x8f'),_0x3f365a);}BPromise['resolve']()[_0x7b37('0x2a')](function(){if(!_0x21c400){if(_0x2bc27['query'][_0x7b37('0x76')])return;_0x40f41b[_0x7b37('0x47')](_0x7b37('0x90'));_0x552779[_0x7b37('0x47')](_0x7b37('0x90'));return;}if(_0x2bc27[_0x7b37('0x91')][_0x7b37('0x92')]!==_0x7b37('0x93'))return;return _0x2bc27['user'][_0x7b37('0x94')]({'attributes':['id'],'raw':!![]})[_0x7b37('0x2a')](function(_0x1f8f7e){if(_[_0x7b37('0x75')](_0x1f8f7e)){_0x40f41b[_0x7b37('0x47')]('i.WhatsappAccountId\x20IS\x20NULL');_0x552779[_0x7b37('0x47')](_0x7b37('0x95'));}else{_0x40f41b['where'](_0x7b37('0x96'),_[_0x7b37('0x30')](_0x1f8f7e,'id'));_0x552779[_0x7b37('0x47')](_0x7b37('0x96'),_['map'](_0x1f8f7e,'id'));}});})['then'](function(){if(_0x2bc27[_0x7b37('0x91')][_0x7b37('0x92')]===_0x7b37('0x93')&&!_0x21c400&&!_0x2bc27['query'][_0x7b37('0x76')])return[];return db[_0x7b37('0x97')][_0x7b37('0x3c')](_0x40f41b['toString'](),_0x24523b);})['then'](function(_0x25e17f){_0x139910[_0x7b37('0x25')]=_0x25e17f['length'];if(_0x139910[_0x7b37('0x25')]===0x0)return[];return db[_0x7b37('0x97')]['query'](_0x2e708e['toString'](),_0x24523b)[_0x7b37('0x2a')](function(_0x416407){_0x4297d6=_[_0x7b37('0x98')](_0x416407,'id');_0x24523b=_['merge'](_0x24523b,{'model':db[_0x7b37('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2bc27[_0x7b37('0x3c')][_0x7b37('0x40')]){_0x18ec5e[_0x7b37('0x3f')][_0x7b37('0x6b')](function(_0x5931b2){_0x552779['field']('i.'+_0x5931b2);});}else{_0x552779[_0x7b37('0x48')](_0x7b37('0x8e'),_0x7b37('0x99'));_0x552779[_0x7b37('0x48')]('a.key',_0x7b37('0x9a'));_0x552779[_0x7b37('0x48')]('a.mandatoryDisposition',_0x7b37('0x9b'));_0x552779[_0x7b37('0x48')](_0x7b37('0x9c'),_0x7b37('0x9d'));_0x552779[_0x7b37('0x48')](_0x7b37('0x9e'));_0x552779['field']('c.firstName','Contact.firstName');_0x552779[_0x7b37('0x48')](_0x7b37('0x9f'),'Contact.lastName');_0x552779[_0x7b37('0x48')](_0x7b37('0xa0'),'Contact.email');_0x552779['field'](_0x7b37('0xa1'),_0x7b37('0xa2'));_0x552779['field'](_0x7b37('0xa3'),_0x7b37('0xa4'));_0x552779[_0x7b37('0x48')]('c.fax',_0x7b37('0xa5'));_0x552779[_0x7b37('0x48')](_0x7b37('0xa6'),_0x7b37('0xa7'));_0x552779[_0x7b37('0x48')]('o.internal','Owner.internal');_0x552779['field'](_0x7b37('0xa8'),_0x7b37('0x31'));}if(_0x18ec5e[_0x7b37('0x44')])_0x552779[_0x7b37('0x44')](_0x18ec5e[_0x7b37('0x44')]);if(_0x18ec5e['offset'])_0x552779['offset'](_0x18ec5e[_0x7b37('0x23')]);return db[_0x7b37('0x97')][_0x7b37('0x3c')](_0x552779[_0x7b37('0xa9')](),_0x24523b);})['then'](function(_0x55508d){if(_0x55508d[_0x7b37('0x41')]>0x0)_0x14360b[_0x7b37('0x47')](_0x7b37('0xaa'),_[_0x7b37('0x30')](_0x55508d,'id'));return db[_0x7b37('0x97')]['query'](_0x14360b[_0x7b37('0xa9')](),_0x24523b)[_0x7b37('0x2a')](function(_0x531fb1){var _0x50cc3f=_['groupBy'](_0x531fb1,_0x7b37('0xab'));var _0x2ab3f9=[];_0x55508d[_0x7b37('0x6b')](function(_0x5c85d9){_0x2ab3f9['push'](updateWhatsappInteraction(_0x5c85d9,_0x4297d6,_0x50cc3f));});return BPromise[_0x7b37('0xac')](_0x2ab3f9);});});})[_0x7b37('0x2a')](function(_0x21ba13){_0x139910['rows']=_0x21ba13;return _0x139910;})[_0x7b37('0x2a')](respondWithFilteredResult(_0x226e42,_0x18ec5e))['catch'](handleError(_0x226e42,null));};exports[_0x7b37('0xad')]=function(_0x30e341,_0x325804){var _0xeb6e9b={'raw':![],'where':{'id':_0x30e341['params']['id']}},_0x239221={};_0x239221[_0x7b37('0x3b')]=_['keys'](db[_0x7b37('0x36')][_0x7b37('0x37')]);_0x239221[_0x7b37('0x3c')]=_['keys'](_0x30e341[_0x7b37('0x3c')]);_0x239221[_0x7b37('0x3d')]=_['intersection'](_0x239221[_0x7b37('0x3b')],_0x239221[_0x7b37('0x3c')]);_0xeb6e9b[_0x7b37('0x3f')]=_['intersection'](_0x239221[_0x7b37('0x3b')],qs[_0x7b37('0x40')](_0x30e341[_0x7b37('0x3c')][_0x7b37('0x40')]));_0xeb6e9b[_0x7b37('0x3f')]=_0xeb6e9b[_0x7b37('0x3f')]['length']?_0xeb6e9b[_0x7b37('0x3f')]:_0x239221['model'];if(_0x30e341[_0x7b37('0x3c')][_0x7b37('0xae')]){_0xeb6e9b[_0x7b37('0xaf')]=[{'all':!![]}];}_0xeb6e9b=_[_0x7b37('0xb0')]({},_0xeb6e9b,_0x30e341[_0x7b37('0xb1')]);return db['WhatsappInteraction']['find'](_0xeb6e9b)['then'](handleEntityNotFound(_0x325804,null))[_0x7b37('0x2a')](respondWithResult(_0x325804,null))['catch'](handleError(_0x325804,null));};exports['create']=function(_0x1de1da,_0x25c3d6){return db[_0x7b37('0x36')][_0x7b37('0xb2')](_0x1de1da['body'],{})[_0x7b37('0x2a')](respondWithResult(_0x25c3d6,0xc9))[_0x7b37('0xb3')](handleError(_0x25c3d6,null));};exports[_0x7b37('0xb4')]=function(_0x23fa8c,_0x4245d8){if(_0x23fa8c[_0x7b37('0x71')]['id']){delete _0x23fa8c[_0x7b37('0x71')]['id'];}return db[_0x7b37('0x36')][_0x7b37('0x66')]({'where':{'id':_0x23fa8c[_0x7b37('0xb5')]['id']}})[_0x7b37('0x2a')](handleEntityNotFound(_0x4245d8,null))[_0x7b37('0x2a')](saveUpdates(_0x23fa8c[_0x7b37('0x71')],null))[_0x7b37('0x2a')](respondWithResult(_0x4245d8,null))['catch'](handleError(_0x4245d8,null));};exports[_0x7b37('0x29')]=function(_0x60d3d,_0xcfcaff){return db[_0x7b37('0x36')]['find']({'where':{'id':_0x60d3d[_0x7b37('0xb5')]['id']}})['then'](handleEntityNotFound(_0xcfcaff,null))[_0x7b37('0x2a')](removeEntity(_0xcfcaff,null))[_0x7b37('0xb3')](handleError(_0xcfcaff,null));};exports[_0x7b37('0xb6')]=function(_0x3d7907,_0x3525b0){return db[_0x7b37('0x36')][_0x7b37('0xb6')]()[_0x7b37('0x2a')](respondWithResult(_0x3525b0,null))[_0x7b37('0xb3')](handleError(_0x3525b0,null));};exports[_0x7b37('0xb7')]=function(_0x35df31,_0x13094c,_0x376dfb){return db[_0x7b37('0xb8')][_0x7b37('0x66')]({'where':{'id':_0x35df31[_0x7b37('0xb5')]['id']}})[_0x7b37('0x2a')](handleEntityNotFound(_0x13094c,null))['then'](function(_0x3632e1){if(_0x3632e1){return _0x3632e1[_0x7b37('0xb7')](_0x35df31[_0x7b37('0x71')]['ids'],_['omit'](_0x35df31['body'],['ids','id'])||{});}})[_0x7b37('0x2a')](respondWithResult(_0x13094c,null))[_0x7b37('0xb3')](handleError(_0x13094c,null));};exports[_0x7b37('0xb9')]=function(_0x2dae4,_0x425072,_0x21a9aa){var _0x15d183={'raw':![],'where':{}};var _0x10e014={};var _0x44f054={'count':0x0,'rows':[]};return db[_0x7b37('0x36')]['findOne']({'where':{'id':_0x2dae4[_0x7b37('0xb5')]['id']}})['then'](handleEntityNotFound(_0x425072,null))[_0x7b37('0x2a')](function(_0x45727c){if(_0x45727c){_0x10e014[_0x7b37('0x3b')]=_[_0x7b37('0x72')](db[_0x7b37('0xb8')][_0x7b37('0x37')]);_0x10e014['query']=_['keys'](_0x2dae4[_0x7b37('0x3c')]);_0x10e014[_0x7b37('0x3d')]=_[_0x7b37('0x3e')](_0x10e014['model'],_0x10e014[_0x7b37('0x3c')]);_0x15d183[_0x7b37('0x3f')]=_[_0x7b37('0x3e')](_0x10e014[_0x7b37('0x3b')],qs['fields'](_0x2dae4[_0x7b37('0x3c')][_0x7b37('0x40')]));_0x15d183[_0x7b37('0x3f')]=_0x15d183['attributes'][_0x7b37('0x41')]?_0x15d183[_0x7b37('0x3f')]:_0x10e014[_0x7b37('0x3b')];if(!_0x2dae4[_0x7b37('0x3c')][_0x7b37('0x42')](_0x7b37('0x43'))){_0x15d183[_0x7b37('0x44')]=qs[_0x7b37('0x44')](_0x2dae4[_0x7b37('0x3c')]['limit']);_0x15d183[_0x7b37('0x23')]=qs[_0x7b37('0x23')](_0x2dae4['query'][_0x7b37('0x23')]);}_0x15d183[_0x7b37('0x45')]=qs[_0x7b37('0x46')](_0x2dae4['query'][_0x7b37('0x46')]);_0x15d183[_0x7b37('0x47')]=qs[_0x7b37('0x3d')](_['pick'](_0x2dae4[_0x7b37('0x3c')],_0x10e014[_0x7b37('0x3d')]));_0x15d183[_0x7b37('0x47')][_0x7b37('0xab')]=_0x45727c['id'];if(_0x2dae4['query'][_0x7b37('0x83')]){_0x15d183['where']=_[_0x7b37('0xb0')](_0x15d183['where'],{'$or':_['map'](_0x15d183[_0x7b37('0x3f')],function(_0x218cd5){var _0x49b9dc={};_0x49b9dc[_0x218cd5]={'$like':'%'+_0x2dae4['query'][_0x7b37('0x83')]+'%'};return _0x49b9dc;})});}if(_0x2dae4[_0x7b37('0x3c')]['$gte']){var _0x4ca3a2=_0x2dae4[_0x7b37('0x3c')][_0x7b37('0x7a')][_0x7b37('0x33')](',');var _0x2eda57={};_0x2eda57[_0x4ca3a2[0x0]]={'$gte':moment(_0x4ca3a2[0x1])['format'](_0x7b37('0xba'))};_0x15d183['where']=_[_0x7b37('0xb0')](_0x15d183[_0x7b37('0x47')],_0x2eda57);}_0x15d183=_[_0x7b37('0xb0')]({},_0x15d183,_0x2dae4[_0x7b37('0xb1')]);return db[_0x7b37('0xb8')]['count']({'where':_0x15d183[_0x7b37('0x47')]})['then'](function(_0x392678){_0x44f054['count']=_0x392678;if(_0x2dae4[_0x7b37('0x3c')][_0x7b37('0xae')]){_0x15d183[_0x7b37('0xaf')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x7b37('0xbb')](_0x15d183);})[_0x7b37('0x2a')](function(_0xc9ee95){_0x44f054[_0x7b37('0xbc')]=_0xc9ee95;return _0x44f054;});}})[_0x7b37('0x2a')](respondWithFilteredResult(_0x425072,_0x15d183))[_0x7b37('0xb3')](handleError(_0x425072,null));};exports[_0x7b37('0xbd')]=function(_0x44ac1a,_0x1ebc64,_0x3fbf69){return db[_0x7b37('0x36')][_0x7b37('0x66')]({'where':{'id':_0x44ac1a[_0x7b37('0xb5')]['id']}})['then'](handleEntityNotFound(_0x1ebc64,null))['then'](function(_0x2c04a0){if(_0x2c04a0){return _0x2c04a0[_0x7b37('0xbe')](_0x44ac1a[_0x7b37('0x71')][_0x7b37('0xbf')],_[_0x7b37('0xc0')](_0x44ac1a[_0x7b37('0x71')],[_0x7b37('0xbf'),'id'])||{})[_0x7b37('0xc1')](function(){return db[_0x7b37('0x6a')][_0x7b37('0xbb')]({'attributes':['id',_0x7b37('0x2d'),'color'],'where':{'id':_0x44ac1a[_0x7b37('0x71')][_0x7b37('0xbf')]}});})[_0x7b37('0x2a')](function(_0x3a562e){socket[_0x7b37('0xc2')](_0x7b37('0xc3'),{'id':Number(_0x44ac1a[_0x7b37('0xb5')]['id']),'tags':_0x3a562e||[]});return{'id':Number(_0x44ac1a[_0x7b37('0xb5')]['id']),'tags':_0x3a562e||[]};});}})[_0x7b37('0x2a')](respondWithResult(_0x1ebc64,null))[_0x7b37('0xb3')](handleError(_0x1ebc64,null));};exports[_0x7b37('0xc4')]=function(_0x4e5305,_0x24127b,_0x5d470e){return db['WhatsappInteraction'][_0x7b37('0x66')]({'where':{'id':_0x4e5305['params']['id']}})[_0x7b37('0x2a')](handleEntityNotFound(_0x24127b,null))[_0x7b37('0x2a')](function(_0x33c156){if(_0x33c156){return _0x33c156['removeTags'](_0x4e5305[_0x7b37('0x3c')][_0x7b37('0xbf')]);}})['then'](respondWithStatusCode(_0x24127b,null))[_0x7b37('0xb3')](handleError(_0x24127b,null));};exports[_0x7b37('0xc5')]=function(_0x4e7d33,_0x3a2ee6){var _0x126db3=moment()[_0x7b37('0xc6')]()[_0x7b37('0xa9')]();var _0xe7d931=path['join'](config['root'],_0x7b37('0xc7'),'files',_0x7b37('0xc8'));var _0x10b497=path[_0x7b37('0xc9')](config[_0x7b37('0xca')],_0x7b37('0xc7'),_0x7b37('0xcb'),_0x7b37('0xcc'));var _0x3a29df=path[_0x7b37('0xc9')](_0xe7d931,_0x126db3);var _0x2246dc=util[_0x7b37('0xcd')]('transcript-%d-%s.zip',_0x4e7d33[_0x7b37('0xb5')]['id'],_0x126db3);var _0x187255=path[_0x7b37('0xc9')](_0xe7d931,_0x2246dc);var _0x3cb0db=[];_0x3cb0db[_0x7b37('0x34')]({'model':db[_0x7b37('0x6d')],'as':_0x7b37('0x6d'),'attributes':['id',_0x7b37('0xce')],'raw':!![]});_0x3cb0db[_0x7b37('0x34')]({'model':db[_0x7b37('0xcf')],'as':'Contact','attributes':['id',_0x7b37('0xd0'),'lastName'],'raw':!![]});if(_0x4e7d33[_0x7b37('0x3c')][_0x7b37('0xcc')]){_0x3cb0db['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x4c8965=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x7b37('0x71'),_0x7b37('0x78'),_0x7b37('0xd1'),_0x7b37('0xd2'),_0x7b37('0x7f')],'include':_0x3cb0db}];_0x4c8965[_0x7b37('0x34')]({'model':db[_0x7b37('0xd3')],'as':'Account','attributes':['id',_0x7b37('0x2d')]});_0x4c8965[_0x7b37('0x34')]({'model':db[_0x7b37('0x6d')],'as':_0x7b37('0xd4'),'attributes':['id',_0x7b37('0xce')]});return db[_0x7b37('0x36')][_0x7b37('0x66')]({'where':{'id':_0x4e7d33[_0x7b37('0xb5')]['id']},'include':_0x4c8965})[_0x7b37('0x2a')](handleEntityNotFound(_0x3a2ee6,null))[_0x7b37('0x2a')](function(_0x128366){if(_0x128366){var _0x9f9b3a=_0x128366['get']({'plain':!![]});fs[_0x7b37('0xd5')](_0x3a29df);var _0x32d677={'channel':'Whatsapp','account':_0x9f9b3a['Account'][_0x7b37('0x2d')],'agent':_0x9f9b3a[_0x7b37('0xd4')]?_0x9f9b3a[_0x7b37('0xd4')][_0x7b37('0xce')]:_0x7b37('0xd6'),'createdAt':moment(_0x9f9b3a['createdAt'])[_0x7b37('0xcd')](_0x7b37('0xba'))['toString'](),'closedAt':_0x9f9b3a[_0x7b37('0xd7')]?moment(_0x9f9b3a['closedAt'])[_0x7b37('0xcd')](_0x7b37('0xba'))[_0x7b37('0xa9')]():'','disposition':_0x9f9b3a[_0x7b37('0xd8')],'messages':_(_0x9f9b3a[_0x7b37('0xd9')])[_0x7b37('0x83')]({'secret':![]})[_0x7b37('0x30')](function(_0x52ad72){if(_0x52ad72[_0x7b37('0xda')]){var _0x1d82e5=path[_0x7b37('0xc9')](_0x10b497,_0x52ad72['Attachment'][_0x7b37('0xdb')]);if(fs[_0x7b37('0xdc')](_0x1d82e5)){fs[_0x7b37('0xdd')](_0x1d82e5)[_0x7b37('0xde')](fs[_0x7b37('0xdf')](path[_0x7b37('0xc9')](_0x3a29df,_0x52ad72[_0x7b37('0xda')]['basename'])));}}return{'date':moment(_0x52ad72[_0x7b37('0x78')])[_0x7b37('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x52ad72['direction']===_0x7b37('0xe0')?_0x52ad72[_0x7b37('0x6d')]?_0x52ad72['User'][_0x7b37('0xce')]:_0x7b37('0xe1'):_0x52ad72[_0x7b37('0x61')][_0x7b37('0xd0')]+(_0x52ad72[_0x7b37('0x61')]['lastName']?'\x20'+_0x52ad72[_0x7b37('0x61')][_0x7b37('0xe2')]:''),'body':_0x52ad72[_0x7b37('0xda')]?_0x52ad72[_0x7b37('0xda')]['basename']:_0x52ad72[_0x7b37('0x71')],'direction':_0x52ad72[_0x7b37('0xd1')]===_0x7b37('0xe0')?'A':'C','secret':_0x52ad72[_0x7b37('0xd2')],'read':_0x52ad72[_0x7b37('0x7f')],'attachment':_0x52ad72[_0x7b37('0xda')]};})[_0x7b37('0x5e')]()};return ejs[_0x7b37('0xe3')](path[_0x7b37('0xc9')](config[_0x7b37('0xca')],_0x7b37('0xc7'),_0x7b37('0xe4'),_0x7b37('0xe5')),{'interaction':_0x32d677})[_0x7b37('0x2a')](function(_0x51bee5){var _0x5ce492=path[_0x7b37('0xc9')](_0x3a29df,_0x7b37('0xe6')+_0x9f9b3a['id']+'-'+_0x126db3+_0x7b37('0xe7'));var _0x35c0cb={'path':_0x5ce492,'channel':_0x7b37('0xe8'),'interactionId':_0x9f9b3a['id']};return pdf[_0x7b37('0xe9')](_0x51bee5,_0x35c0cb);})['then'](function(){return new BPromise(function(_0x425cc3,_0x179d99){zipdir(_0x3a29df,{'saveTo':_0x187255},function(_0x42ed99,_0x16eda7){if(_0x42ed99)return _0x179d99(_0x42ed99);return _0x425cc3(_0x16eda7);});})[_0x7b37('0x2a')](function(){return new BPromise(function(_0x27d766,_0x2d6be9){rimraf(_0x3a29df,function(_0x4c1659){if(_0x4c1659)_0x2d6be9(_0x4c1659);return _0x27d766();});});})[_0x7b37('0x2a')](function(){return _0x3a2ee6[_0x7b37('0xc5')](_0x187255,_0x2246dc,function(_0x591177){if(_0x591177){console[_0x7b37('0xea')](_0x7b37('0xeb'),_0x591177);}else{fs[_0x7b37('0xec')](_0x187255);}});});});}else{return _0x3a2ee6[_0x7b37('0x20')](0xc8);}})['catch'](handleError(_0x3a2ee6,null));}; \ No newline at end of file +var _0x383a=['register','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','map','fullname','TagIds','split','forEach','Tags','index','WhatsappInteraction','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','some','compact','isEmpty','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','i.id','QueryTypes','SELECT','contactName','DESC','t.id\x20IN\x20?','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.mandatoryDisposition','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','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','push','all','show','params','include','merge','catch','create','find','addMessage','WhatsappMessage','ids','omit','getMessages','rawAttributes','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','rows','addTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','direction','secret','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','N.A.','closed','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','server','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','mustache','util','path','ejs','fs-extra','lodash','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket'];(function(_0x582d0b,_0x28f609){var _0x2e93e1=function(_0xb6a81c){while(--_0xb6a81c){_0x582d0b['push'](_0x582d0b['shift']());}};_0x2e93e1(++_0x28f609);}(_0x383a,0x1ad));var _0xa383=function(_0x423312,_0x25f527){_0x423312=_0x423312-0x0;var _0x33f959=_0x383a[_0x423312];return _0x33f959;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa383('0x0'));var zipdir=require(_0xa383('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa383('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa383('0x3'));var util=require(_0xa383('0x4'));var path=require(_0xa383('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa383('0x6'));var fs=require('fs');var fs_extra=require(_0xa383('0x7'));var _=require(_0xa383('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa383('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa383('0xa'));var authService=require(_0xa383('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0xa383('0xc'));var pdf=require(_0xa383('0xd'));var hardwareService=require(_0xa383('0xe'));var logger=require('../../config/logger')(_0xa383('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa383('0x10'));var db=require(_0xa383('0x11'))['db'];config[_0xa383('0x12')]=_[_0xa383('0x13')](config['redis'],{'host':_0xa383('0x14'),'port':0x18eb});var socket=require(_0xa383('0x15'))(new Redis(config[_0xa383('0x12')]));require(_0xa383('0x16'))[_0xa383('0x17')](socket);function respondWithStatusCode(_0x1fcb20,_0x1c655c){_0x1c655c=_0x1c655c||0xcc;return function(_0x83a77a){if(_0x83a77a){return _0x1fcb20['sendStatus'](_0x1c655c);}return _0x1fcb20['status'](_0x1c655c)[_0xa383('0x18')]();};}function respondWithResult(_0x2d8794,_0xe2e956){_0xe2e956=_0xe2e956||0xc8;return function(_0x2f2fd8){if(_0x2f2fd8){return _0x2d8794['status'](_0xe2e956)[_0xa383('0x19')](_0x2f2fd8);}};}function respondWithFilteredResult(_0x5d491c,_0x287b82){return function(_0x81eab0){if(_0x81eab0){var _0x2ccaf7=typeof _0x287b82[_0xa383('0x1a')]===_0xa383('0x1b')&&typeof _0x287b82[_0xa383('0x1c')]===_0xa383('0x1b');var _0x2649b0=_0x81eab0[_0xa383('0x1d')];var _0x113ff0=_0x2ccaf7?0x0:_0x287b82['offset'];var _0x5d87f9=_0x2ccaf7?_0x81eab0['count']:_0x287b82[_0xa383('0x1a')]+_0x287b82[_0xa383('0x1c')];var _0x5e0ba5;if(_0x5d87f9>=_0x2649b0){_0x5d87f9=_0x2649b0;_0x5e0ba5=0xc8;}else{_0x5e0ba5=0xce;}_0x5d491c[_0xa383('0x1e')](_0x5e0ba5);return _0x5d491c['set'](_0xa383('0x1f'),_0x113ff0+'-'+_0x5d87f9+'/'+_0x2649b0)[_0xa383('0x19')](_0x81eab0);}return null;};}function patchUpdates(_0x4db308){return function(_0x433d85){try{jsonpatch[_0xa383('0x20')](_0x433d85,_0x4db308,!![]);}catch(_0x4cc53b){return BPromise[_0xa383('0x21')](_0x4cc53b);}return _0x433d85[_0xa383('0x22')]();};}function saveUpdates(_0x37bacb,_0xd2c369){return function(_0x398cd5){if(_0x398cd5){return _0x398cd5[_0xa383('0x23')](_0x37bacb)['then'](function(_0x23d22b){return _0x23d22b;});}return null;};}function removeEntity(_0x28add7,_0x90148c){return function(_0x2ffa5d){if(_0x2ffa5d){return _0x2ffa5d[_0xa383('0x24')]()[_0xa383('0x25')](function(){_0x28add7[_0xa383('0x1e')](0xcc)[_0xa383('0x18')]();});}};}function handleEntityNotFound(_0x553d45,_0x3b671a){return function(_0x25ce4f){if(!_0x25ce4f){_0x553d45[_0xa383('0x26')](0x194);}return _0x25ce4f;};}function handleError(_0x1db1ac,_0x2640f4){_0x2640f4=_0x2640f4||0x1f4;return function(_0x26c28a){logger[_0xa383('0x27')](_0x26c28a[_0xa383('0x28')]);if(_0x26c28a[_0xa383('0x29')]){delete _0x26c28a[_0xa383('0x29')];}_0x1db1ac[_0xa383('0x1e')](_0x2640f4)['send'](_0x26c28a);};}function getInteractionUsers(_0x4d0ecb,_0xd11504){return new BPromise(function(_0x2e4ba5,_0x390bbe){try{if(_0xd11504[_0x4d0ecb['id']]){_0x4d0ecb['Users']=_[_0xa383('0x2a')](_0xd11504[_0x4d0ecb['id']],function(_0x2468c1){return{'id':_0x2468c1['id'],'fullname':_0x2468c1[_0xa383('0x2b')]};});}}catch(_0x1394c5){_0x390bbe(_0x1394c5);}_0x2e4ba5(_0x4d0ecb);});}function getInteractionTags(_0x56866d,_0x32f851){return new BPromise(function(_0x36de27,_0x302d5b){try{if(_0x56866d[_0xa383('0x2c')]){_0x56866d['Tags']=[];_0x56866d[_0xa383('0x2c')][_0xa383('0x2d')](',')[_0xa383('0x2e')](function(_0xfbff18){_0x56866d[_0xa383('0x2f')]['push'](_0x32f851[_0xfbff18]);});}delete _0x56866d[_0xa383('0x2c')];}catch(_0x39060a){_0x302d5b(_0x39060a);}_0x36de27(_0x56866d);});}function updateWhatsappInteraction(_0x1110fe,_0x402472,_0x59381a){return new BPromise(function(_0x24d74c,_0x46a43e){return getInteractionUsers(_0x1110fe,_0x59381a)['then'](function(_0x129e13){return getInteractionTags(_0x129e13,_0x402472);})[_0xa383('0x25')](function(_0x2eb5c2){_0x24d74c(_0x2eb5c2);})['catch'](function(_0x115a00){_0x46a43e(_0x115a00);});});}exports[_0xa383('0x30')]=function(_0x10afeb,_0x91b4c4){var _0x503cc8={},_0x269cc1={},_0x50869c={'count':0x0,'rows':[]};var _0x238ac4=_[_0xa383('0x2a')](db[_0xa383('0x31')]['rawAttributes'],function(_0x307cb4){return{'name':_0x307cb4[_0xa383('0x32')],'type':_0x307cb4[_0xa383('0x33')][_0xa383('0x34')]};});_0x269cc1[_0xa383('0x35')]=_[_0xa383('0x2a')](_0x238ac4,'name');_0x269cc1[_0xa383('0x36')]=_[_0xa383('0x37')](_0x10afeb[_0xa383('0x36')]);_0x269cc1['filters']=_[_0xa383('0x38')](_0x269cc1[_0xa383('0x35')],_0x269cc1['query']);_0x503cc8[_0xa383('0x39')]=_['intersection'](_0x269cc1['model'],qs[_0xa383('0x3a')](_0x10afeb[_0xa383('0x36')]['fields']));_0x503cc8[_0xa383('0x39')]=_0x503cc8[_0xa383('0x39')][_0xa383('0x3b')]?_0x503cc8[_0xa383('0x39')]:_0x269cc1['model'];if(!_0x10afeb[_0xa383('0x36')][_0xa383('0x3c')](_0xa383('0x3d'))){_0x503cc8[_0xa383('0x1c')]=qs[_0xa383('0x1c')](_0x10afeb['query'][_0xa383('0x1c')]);_0x503cc8[_0xa383('0x1a')]=qs[_0xa383('0x1a')](_0x10afeb['query'][_0xa383('0x1a')]);}_0x503cc8[_0xa383('0x3e')]=qs[_0xa383('0x3f')](_0x10afeb[_0xa383('0x36')][_0xa383('0x3f')]);_0x503cc8[_0xa383('0x40')]=qs[_0xa383('0x41')](_['pick'](_0x10afeb[_0xa383('0x36')],_0x269cc1['filters']),_0x238ac4);var _0x331f14=[];var _0x48a387=squel[_0xa383('0x42')]()['field']('id')[_0xa383('0x43')](_0xa383('0x29'))[_0xa383('0x43')](_0xa383('0x44'))[_0xa383('0x45')]('tools_tags');var _0x3411a3=squel[_0xa383('0x42')]()[_0xa383('0x43')](_0xa383('0x46'))['field'](_0xa383('0x47'))[_0xa383('0x43')](_0xa383('0x48'))['from']('user_has_whatsapp_interactions','ui')[_0xa383('0x49')](_0xa383('0x4a'),'u',_0xa383('0x4b'));var _0x33e177=squel[_0xa383('0x42')]()[_0xa383('0x45')](_0xa383('0x4c'),'i')[_0xa383('0x49')](_0xa383('0x4d'),'c',_0xa383('0x4e'))[_0xa383('0x49')](_0xa383('0x4a'),'o','o.id\x20=\x20i.UserId')[_0xa383('0x49')](_0xa383('0x4f'),'a',_0xa383('0x50'))['left_join']('whatsapp_messages','me','me.WhatsappInteractionId\x20=\x20i.id')[_0xa383('0x49')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xa383('0x49')](_0xa383('0x51'),'t',_0xa383('0x52'));var _0x9cbb43=squel[_0xa383('0x53')]();var _0x339bf6=[];var _0x2c393b=squel[_0xa383('0x53')]();var _0x25e61c;if(_0x10afeb['query'][_0xa383('0x54')]){_0x25e61c=as[_0xa383('0x55')](_0x10afeb['query']['search']);var _0x5248c4=_0x25e61c[_0xa383('0x56')];for(var _0xa9719b=0x0;_0xa9719b<_0x25e61c[_0xa383('0x57')][_0xa383('0x3b')];_0xa9719b++){var _0x4e47fc=_0x25e61c[_0xa383('0x57')][_0xa9719b];var _0x1858a9='i';var _0x8cd84=_['find'](_0x238ac4,['name',_0x4e47fc[_0xa383('0x43')]]);if(!_0x8cd84){switch(_0x4e47fc[_0xa383('0x43')]){case _0xa383('0x58'):if(_0x4e47fc[_0xa383('0x59')]==0x1){_0x33e177['having']('`'+_0x4e47fc[_0xa383('0x43')]+'`\x20=\x200');}else{_0x33e177[_0xa383('0x5a')]('`'+_0x4e47fc[_0xa383('0x43')]+_0xa383('0x5b'));}break;case _0xa383('0x5c'):if(_0x4e47fc['operator']==='$substring'){if(_0x4e47fc[_0xa383('0x59')][_0xa383('0x2d')]('\x20')[_0xa383('0x3b')]>0x1){_0x9cbb43[_0x5248c4]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa383('0x5d')](_0x4e47fc[_0xa383('0x59')]),null);}else{var _0x51d440='%'+_0x4e47fc[_0xa383('0x59')]+'%';_0x9cbb43[_0x5248c4](_0xa383('0x5e'),_0x51d440,_0x51d440,_0x51d440);}}else{_0x8cd84=_['find'](_0x238ac4,[_0xa383('0x29'),_0xa383('0x5f')]);_0x4e47fc[_0xa383('0x43')]=_0xa383('0x5f');_0x348b17=as[_0xa383('0x60')](_0x1858a9,_0x8cd84['type'],_0x4e47fc);_0x9cbb43[_0x5248c4](_0x348b17[_0xa383('0x61')],_0x348b17[_0xa383('0x59')]['start'],_0x348b17['value'][_0xa383('0x18')]);}break;case _0xa383('0x62'):var _0x53c587=_0x4e47fc[_0xa383('0x59')][_0xa383('0x2d')](',')[_0xa383('0x2a')](function(_0x2ba23a){return Number(_0x2ba23a);});_0x53c587[_0xa383('0x2e')](function(_0x4a565d){_0x2c393b['or'](_0xa383('0x63'),'%,'+_0x4a565d+',%');});_0x339bf6=_['union'](_0x339bf6,_0x53c587);break;case _0xa383('0x64'):if(_0x4e47fc[_0xa383('0x65')]===_0xa383('0x66')){_0x9cbb43[_0x5248c4](_0xa383('0x67'),'%'+_0x4e47fc[_0xa383('0x59')]+'%',null);}else{_0x8cd84=_['find'](_0x238ac4,[_0xa383('0x29'),'UserId']);_0x4e47fc['field']=_0xa383('0x68');_0x348b17=as[_0xa383('0x60')](_0x1858a9,_0x8cd84['type'],_0x4e47fc);_0x9cbb43[_0x5248c4](_0x348b17[_0xa383('0x61')],_0x348b17['value'][_0xa383('0x69')],_0x348b17[_0xa383('0x59')]['end']);}break;case _0xa383('0x6a'):_0x348b17=as[_0xa383('0x60')]('me',null,_0x4e47fc);_0x9cbb43[_0x5248c4](_0x348b17[_0xa383('0x61')],_0x348b17[_0xa383('0x59')][_0xa383('0x69')],_0x348b17[_0xa383('0x59')]['end']);break;}}else{var _0x348b17=as[_0xa383('0x60')](_0x1858a9,_0x8cd84[_0xa383('0x33')],_0x4e47fc);_0x9cbb43[_0x5248c4](_0x348b17['text'],_0x348b17[_0xa383('0x59')][_0xa383('0x69')],_0x348b17[_0xa383('0x59')][_0xa383('0x18')]);}}}else{var _0x20de90=_(_0x10afeb[_0xa383('0x36')])[_0xa383('0x37')]()[_0xa383('0x2a')](function(_0x1378bf){return _[_0xa383('0x6b')](_0x238ac4,['name',_0x1378bf])?_0x1378bf:undefined;})[_0xa383('0x6c')]()[_0xa383('0x59')]();if(!_[_0xa383('0x6d')](_0x20de90)){_0x20de90[_0xa383('0x2e')](function(_0x2644ed){if(_0x2644ed==='WhatsappAccountId'){_0x33e177['where']('i.WhatsappAccountId\x20IN\x20?',[][_0xa383('0x6e')](_0x10afeb[_0xa383('0x36')][_0x2644ed]));}else if(_0x2644ed===_0xa383('0x6f')){var _0x1303b6=JSON[_0xa383('0x70')](_0x10afeb[_0xa383('0x36')][_0x2644ed])[_0xa383('0x71')];var _0x5b7cde=JSON[_0xa383('0x70')](_0x10afeb[_0xa383('0x36')][_0x2644ed])[_0xa383('0x72')];_0x33e177['where'](_0xa383('0x73'),_0x1303b6,_0x5b7cde);}else{if(_0x10afeb[_0xa383('0x36')][_0x2644ed]===_0xa383('0x74')){_0x33e177[_0xa383('0x40')]('i.'+_0x2644ed+_0xa383('0x75'));}else{_0x33e177[_0xa383('0x40')]('i.'+_0x2644ed+_0xa383('0x76'),_0x10afeb[_0xa383('0x36')][_0x2644ed]);}}});}if(_0x10afeb['query'][_0xa383('0x77')]){if(_0x10afeb['query'][_0xa383('0x77')]==0x1){_0x33e177['having'](_0xa383('0x78'));}else{_0x33e177[_0xa383('0x5a')](_0xa383('0x79'));}}if(_0x10afeb['query'][_0xa383('0x7a')]){_0x339bf6=_[_0xa383('0x7b')](_0x10afeb[_0xa383('0x36')][_0xa383('0x7a')])?_0x10afeb['query'][_0xa383('0x7a')]:new Array(_0x10afeb['query'][_0xa383('0x7a')]);_0x339bf6[_0xa383('0x2e')](function(_0x460f4d){_0x2c393b['or'](_0xa383('0x63'),'%,'+_0x460f4d+',%');});}if(_0x10afeb[_0xa383('0x36')][_0xa383('0x7c')]){var _0x381270=_0x10afeb[_0xa383('0x36')][_0xa383('0x7c')]['replace']('\x5c','\x5c\x5c')[_0xa383('0x7d')](/'/g,'\x27\x27');if(qs[_0xa383('0x7e')](_0x381270)){_0x9cbb43['or'](_0xa383('0x7f'),_0x381270+'%')['or'](_0xa383('0x80'),_0x381270+'%');}else{_0x9cbb43['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa383('0x5d')](_0x381270))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x381270+'%');}}}_0x33e177[_0xa383('0x40')](_0x9cbb43);_0x33e177['group'](_0xa383('0x81'));var _0x331108={'type':db['Sequelize'][_0xa383('0x82')][_0xa383('0x83')],'raw':!![]};var _0x14dcfd=_0x33e177['clone']();_0x14dcfd['field']('i.id');_0x14dcfd[_0xa383('0x43')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa383('0x58'));if(_0x503cc8[_0xa383('0x3e')]){_0x503cc8['order'][_0xa383('0x2e')](function(_0x4e5021){var _0x37c773=_0x4e5021[0x0]===_0xa383('0x84')?_0x4e5021[0x0]:'i.'+_0x4e5021[0x0];_0x33e177[_0xa383('0x3e')](_0x37c773,_0x4e5021[0x1]===_0xa383('0x85')?![]:!![]);});}if(!_[_0xa383('0x6d')](_0x339bf6)){_0x33e177[_0xa383('0x5a')](_0x2c393b);_0x14dcfd[_0xa383('0x40')](_0xa383('0x86'),_0x339bf6);}BPromise['resolve']()[_0xa383('0x25')](function(){if(!_0x25e61c){if(_0x10afeb['query'][_0xa383('0x87')])return;_0x14dcfd[_0xa383('0x40')](_0xa383('0x88'));_0x33e177[_0xa383('0x40')](_0xa383('0x88'));return;}if(_0x10afeb[_0xa383('0x89')]['role']!==_0xa383('0x8a'))return;return _0x10afeb['user'][_0xa383('0x8b')]({'attributes':['id'],'raw':!![]})[_0xa383('0x25')](function(_0x32fe47){if(_[_0xa383('0x6d')](_0x32fe47)){_0x14dcfd[_0xa383('0x40')](_0xa383('0x8c'));_0x33e177[_0xa383('0x40')](_0xa383('0x8c'));}else{_0x14dcfd[_0xa383('0x40')](_0xa383('0x8d'),_[_0xa383('0x2a')](_0x32fe47,'id'));_0x33e177[_0xa383('0x40')]('i.WhatsappAccountId\x20IN\x20?',_[_0xa383('0x2a')](_0x32fe47,'id'));}});})[_0xa383('0x25')](function(){if(_0x10afeb[_0xa383('0x89')]['role']===_0xa383('0x8a')&&!_0x25e61c&&!_0x10afeb['query'][_0xa383('0x87')])return[];return db[_0xa383('0x8e')][_0xa383('0x36')](_0x14dcfd[_0xa383('0x8f')](),_0x331108);})[_0xa383('0x25')](function(_0x9d99e){_0x50869c[_0xa383('0x1d')]=_0x9d99e['length'];if(_0x50869c[_0xa383('0x1d')]===0x0)return[];return db[_0xa383('0x8e')]['query'](_0x48a387[_0xa383('0x8f')](),_0x331108)[_0xa383('0x25')](function(_0x54b4ab){_0x331f14=_['keyBy'](_0x54b4ab,'id');_0x331108=_['merge'](_0x331108,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x10afeb[_0xa383('0x36')][_0xa383('0x3a')]){_0x503cc8[_0xa383('0x39')]['forEach'](function(_0x4a77b4){_0x33e177[_0xa383('0x43')]('i.'+_0x4a77b4);});}else{_0x33e177[_0xa383('0x43')](_0xa383('0x90'),_0xa383('0x58'));_0x33e177[_0xa383('0x43')]('a.key','Account.key');_0x33e177['field']('a.mandatoryDisposition',_0xa383('0x91'));_0x33e177[_0xa383('0x43')](_0xa383('0x92'),_0xa383('0x84'));_0x33e177[_0xa383('0x43')]('i.*');_0x33e177['field'](_0xa383('0x93'),_0xa383('0x94'));_0x33e177[_0xa383('0x43')](_0xa383('0x95'),'Contact.lastName');_0x33e177[_0xa383('0x43')](_0xa383('0x96'),'Contact.email');_0x33e177[_0xa383('0x43')](_0xa383('0x97'),_0xa383('0x98'));_0x33e177[_0xa383('0x43')](_0xa383('0x99'),_0xa383('0x9a'));_0x33e177[_0xa383('0x43')](_0xa383('0x9b'),_0xa383('0x9c'));_0x33e177[_0xa383('0x43')](_0xa383('0x9d'),_0xa383('0x9e'));_0x33e177[_0xa383('0x43')]('o.internal',_0xa383('0x9f'));_0x33e177[_0xa383('0x43')](_0xa383('0xa0'),_0xa383('0x2c'));}if(_0x503cc8['limit'])_0x33e177['limit'](_0x503cc8[_0xa383('0x1c')]);if(_0x503cc8[_0xa383('0x1a')])_0x33e177['offset'](_0x503cc8['offset']);return db[_0xa383('0x8e')][_0xa383('0x36')](_0x33e177[_0xa383('0x8f')](),_0x331108);})[_0xa383('0x25')](function(_0x5cda08){if(_0x5cda08['length']>0x0)_0x3411a3[_0xa383('0x40')]('ui.WhatsappInteractionId\x20IN\x20?',_['map'](_0x5cda08,'id'));return db[_0xa383('0x8e')][_0xa383('0x36')](_0x3411a3['toString'](),_0x331108)[_0xa383('0x25')](function(_0x5eb8b9){var _0x1ada9e=_[_0xa383('0xa1')](_0x5eb8b9,_0xa383('0xa2'));var _0x847bd0=[];_0x5cda08[_0xa383('0x2e')](function(_0x4d2270){_0x847bd0[_0xa383('0xa3')](updateWhatsappInteraction(_0x4d2270,_0x331f14,_0x1ada9e));});return BPromise[_0xa383('0xa4')](_0x847bd0);});});})['then'](function(_0x533ac9){_0x50869c['rows']=_0x533ac9;return _0x50869c;})['then'](respondWithFilteredResult(_0x91b4c4,_0x503cc8))['catch'](handleError(_0x91b4c4,null));};exports[_0xa383('0xa5')]=function(_0x582b55,_0x4489d5){var _0x31b2ec={'raw':![],'where':{'id':_0x582b55[_0xa383('0xa6')]['id']}},_0x31f1da={};_0x31f1da['model']=_['keys'](db[_0xa383('0x31')]['rawAttributes']);_0x31f1da[_0xa383('0x36')]=_[_0xa383('0x37')](_0x582b55[_0xa383('0x36')]);_0x31f1da['filters']=_[_0xa383('0x38')](_0x31f1da['model'],_0x31f1da[_0xa383('0x36')]);_0x31b2ec[_0xa383('0x39')]=_[_0xa383('0x38')](_0x31f1da[_0xa383('0x35')],qs[_0xa383('0x3a')](_0x582b55[_0xa383('0x36')][_0xa383('0x3a')]));_0x31b2ec[_0xa383('0x39')]=_0x31b2ec[_0xa383('0x39')][_0xa383('0x3b')]?_0x31b2ec[_0xa383('0x39')]:_0x31f1da[_0xa383('0x35')];if(_0x582b55[_0xa383('0x36')]['includeAll']){_0x31b2ec[_0xa383('0xa7')]=[{'all':!![]}];}_0x31b2ec=_[_0xa383('0xa8')]({},_0x31b2ec,_0x582b55['options']);return db[_0xa383('0x31')]['find'](_0x31b2ec)['then'](handleEntityNotFound(_0x4489d5,null))[_0xa383('0x25')](respondWithResult(_0x4489d5,null))[_0xa383('0xa9')](handleError(_0x4489d5,null));};exports[_0xa383('0xaa')]=function(_0x1fe063,_0x26754b){return db[_0xa383('0x31')][_0xa383('0xaa')](_0x1fe063[_0xa383('0x6a')],{})['then'](respondWithResult(_0x26754b,0xc9))['catch'](handleError(_0x26754b,null));};exports['update']=function(_0x226617,_0x59ce33){if(_0x226617[_0xa383('0x6a')]['id']){delete _0x226617[_0xa383('0x6a')]['id'];}return db[_0xa383('0x31')][_0xa383('0xab')]({'where':{'id':_0x226617[_0xa383('0xa6')]['id']}})[_0xa383('0x25')](handleEntityNotFound(_0x59ce33,null))[_0xa383('0x25')](saveUpdates(_0x226617[_0xa383('0x6a')],null))[_0xa383('0x25')](respondWithResult(_0x59ce33,null))[_0xa383('0xa9')](handleError(_0x59ce33,null));};exports[_0xa383('0x24')]=function(_0x360b84,_0x27b33c){return db[_0xa383('0x31')][_0xa383('0xab')]({'where':{'id':_0x360b84[_0xa383('0xa6')]['id']}})[_0xa383('0x25')](handleEntityNotFound(_0x27b33c,null))[_0xa383('0x25')](removeEntity(_0x27b33c,null))['catch'](handleError(_0x27b33c,null));};exports['describe']=function(_0x198089,_0x7480e4){return db[_0xa383('0x31')]['describe']()['then'](respondWithResult(_0x7480e4,null))[_0xa383('0xa9')](handleError(_0x7480e4,null));};exports[_0xa383('0xac')]=function(_0x2ccc27,_0x131ab3,_0x5e301b){return db[_0xa383('0xad')][_0xa383('0xab')]({'where':{'id':_0x2ccc27[_0xa383('0xa6')]['id']}})['then'](handleEntityNotFound(_0x131ab3,null))[_0xa383('0x25')](function(_0x59c605){if(_0x59c605){return _0x59c605[_0xa383('0xac')](_0x2ccc27['body'][_0xa383('0xae')],_[_0xa383('0xaf')](_0x2ccc27[_0xa383('0x6a')],[_0xa383('0xae'),'id'])||{});}})['then'](respondWithResult(_0x131ab3,null))[_0xa383('0xa9')](handleError(_0x131ab3,null));};exports[_0xa383('0xb0')]=function(_0x595caa,_0x340bdb,_0x381414){var _0x518229={'raw':![],'where':{}};var _0x100d3b={};var _0xadd757={'count':0x0,'rows':[]};return db[_0xa383('0x31')]['findOne']({'where':{'id':_0x595caa['params']['id']}})['then'](handleEntityNotFound(_0x340bdb,null))['then'](function(_0x4582b8){if(_0x4582b8){_0x100d3b['model']=_['keys'](db[_0xa383('0xad')][_0xa383('0xb1')]);_0x100d3b[_0xa383('0x36')]=_[_0xa383('0x37')](_0x595caa['query']);_0x100d3b[_0xa383('0x41')]=_[_0xa383('0x38')](_0x100d3b[_0xa383('0x35')],_0x100d3b[_0xa383('0x36')]);_0x518229[_0xa383('0x39')]=_[_0xa383('0x38')](_0x100d3b[_0xa383('0x35')],qs[_0xa383('0x3a')](_0x595caa[_0xa383('0x36')]['fields']));_0x518229[_0xa383('0x39')]=_0x518229['attributes']['length']?_0x518229['attributes']:_0x100d3b['model'];if(!_0x595caa[_0xa383('0x36')][_0xa383('0x3c')](_0xa383('0x3d'))){_0x518229[_0xa383('0x1c')]=qs['limit'](_0x595caa['query'][_0xa383('0x1c')]);_0x518229[_0xa383('0x1a')]=qs[_0xa383('0x1a')](_0x595caa[_0xa383('0x36')][_0xa383('0x1a')]);}_0x518229[_0xa383('0x3e')]=qs[_0xa383('0x3f')](_0x595caa[_0xa383('0x36')][_0xa383('0x3f')]);_0x518229[_0xa383('0x40')]=qs[_0xa383('0x41')](_['pick'](_0x595caa[_0xa383('0x36')],_0x100d3b['filters']));_0x518229[_0xa383('0x40')]['WhatsappInteractionId']=_0x4582b8['id'];if(_0x595caa[_0xa383('0x36')][_0xa383('0x7c')]){_0x518229['where']=_[_0xa383('0xa8')](_0x518229['where'],{'$or':_[_0xa383('0x2a')](_0x518229[_0xa383('0x39')],function(_0x34d251){var _0x57baaa={};_0x57baaa[_0x34d251]={'$like':'%'+_0x595caa[_0xa383('0x36')]['filter']+'%'};return _0x57baaa;})});}if(_0x595caa['query'][_0xa383('0x71')]){var _0xa0db57=_0x595caa[_0xa383('0x36')]['$gte'][_0xa383('0x2d')](',');var _0x2103c7={};_0x2103c7[_0xa0db57[0x0]]={'$gte':moment(_0xa0db57[0x1])[_0xa383('0xb2')](_0xa383('0xb3'))};_0x518229[_0xa383('0x40')]=_[_0xa383('0xa8')](_0x518229[_0xa383('0x40')],_0x2103c7);}_0x518229=_['merge']({},_0x518229,_0x595caa[_0xa383('0xb4')]);return db[_0xa383('0xad')][_0xa383('0x1d')]({'where':_0x518229[_0xa383('0x40')]})[_0xa383('0x25')](function(_0x57ac29){_0xadd757[_0xa383('0x1d')]=_0x57ac29;if(_0x595caa['query'][_0xa383('0xb5')]){_0x518229[_0xa383('0xa7')]=[{'all':!![]}];}return db[_0xa383('0xad')][_0xa383('0xb6')](_0x518229);})[_0xa383('0x25')](function(_0x2f27e3){_0xadd757[_0xa383('0xb7')]=_0x2f27e3;return _0xadd757;});}})[_0xa383('0x25')](respondWithFilteredResult(_0x340bdb,_0x518229))[_0xa383('0xa9')](handleError(_0x340bdb,null));};exports[_0xa383('0xb8')]=function(_0x2316e8,_0x33fc6e,_0xee3240){return db[_0xa383('0x31')]['find']({'where':{'id':_0x2316e8[_0xa383('0xa6')]['id']}})[_0xa383('0x25')](handleEntityNotFound(_0x33fc6e,null))['then'](function(_0x10d656){if(_0x10d656){return _0x10d656['setTags'](_0x2316e8[_0xa383('0x6a')][_0xa383('0xae')],_['omit'](_0x2316e8[_0xa383('0x6a')],['ids','id'])||{})[_0xa383('0xb9')](function(){return db[_0xa383('0x62')][_0xa383('0xb6')]({'attributes':['id',_0xa383('0x29'),'color'],'where':{'id':_0x2316e8['body'][_0xa383('0xae')]}});})['then'](function(_0x1ebd88){socket[_0xa383('0xba')](_0xa383('0xbb'),{'id':Number(_0x2316e8['params']['id']),'tags':_0x1ebd88||[]});return{'id':Number(_0x2316e8[_0xa383('0xa6')]['id']),'tags':_0x1ebd88||[]};});}})[_0xa383('0x25')](respondWithResult(_0x33fc6e,null))[_0xa383('0xa9')](handleError(_0x33fc6e,null));};exports[_0xa383('0xbc')]=function(_0x1e17bd,_0x4e143d,_0x548946){return db[_0xa383('0x31')][_0xa383('0xab')]({'where':{'id':_0x1e17bd[_0xa383('0xa6')]['id']}})['then'](handleEntityNotFound(_0x4e143d,null))[_0xa383('0x25')](function(_0x1af3c6){if(_0x1af3c6){return _0x1af3c6['removeTags'](_0x1e17bd[_0xa383('0x36')][_0xa383('0xae')]);}})['then'](respondWithStatusCode(_0x4e143d,null))[_0xa383('0xa9')](handleError(_0x4e143d,null));};exports[_0xa383('0xbd')]=function(_0x1f9134,_0x469fa7){var _0x194db4=moment()[_0xa383('0xbe')]()[_0xa383('0x8f')]();var _0x3b32a8=path[_0xa383('0xbf')](config[_0xa383('0xc0')],'server',_0xa383('0xc1'),_0xa383('0xc2'));var _0x24b59b=path[_0xa383('0xbf')](config[_0xa383('0xc0')],'server','files',_0xa383('0xc3'));var _0xf17630=path['join'](_0x3b32a8,_0x194db4);var _0x27dc5b=util['format'](_0xa383('0xc4'),_0x1f9134[_0xa383('0xa6')]['id'],_0x194db4);var _0x50c551=path[_0xa383('0xbf')](_0x3b32a8,_0x27dc5b);var _0x38a26c=[];_0x38a26c[_0xa383('0xa3')]({'model':db[_0xa383('0x64')],'as':_0xa383('0x64'),'attributes':['id','fullname'],'raw':!![]});_0x38a26c['push']({'model':db[_0xa383('0xc5')],'as':'Contact','attributes':['id',_0xa383('0xc6'),_0xa383('0xc7')],'raw':!![]});if(_0x1f9134['query'][_0xa383('0xc3')]){_0x38a26c[_0xa383('0xa3')]({'model':db[_0xa383('0xc8')],'as':_0xa383('0xc8'),'raw':!![]});}var _0x4fae25=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0xa383('0x6a'),_0xa383('0x6f'),_0xa383('0xc9'),_0xa383('0xca'),_0xa383('0x77')],'include':_0x38a26c}];_0x4fae25[_0xa383('0xa3')]({'model':db[_0xa383('0xcb')],'as':_0xa383('0xcc'),'attributes':['id',_0xa383('0x29')]});_0x4fae25[_0xa383('0xa3')]({'model':db[_0xa383('0x64')],'as':'Owner','attributes':['id',_0xa383('0x2b')]});return db[_0xa383('0x31')][_0xa383('0xab')]({'where':{'id':_0x1f9134[_0xa383('0xa6')]['id']},'include':_0x4fae25})['then'](handleEntityNotFound(_0x469fa7,null))[_0xa383('0x25')](function(_0x2af097){if(_0x2af097){var _0x7fdae0=_0x2af097[_0xa383('0xcd')]({'plain':!![]});fs[_0xa383('0xce')](_0xf17630);var _0x2cb356={'channel':_0xa383('0xcf'),'account':_0x7fdae0[_0xa383('0xcc')][_0xa383('0x29')],'agent':_0x7fdae0[_0xa383('0xd0')]?_0x7fdae0[_0xa383('0xd0')][_0xa383('0x2b')]:_0xa383('0xd1'),'createdAt':moment(_0x7fdae0[_0xa383('0x6f')])[_0xa383('0xb2')](_0xa383('0xb3'))['toString'](),'closedAt':_0x7fdae0[_0xa383('0xd2')]?moment(_0x7fdae0['closedAt'])['format'](_0xa383('0xb3'))[_0xa383('0x8f')]():'','disposition':_0x7fdae0[_0xa383('0xd3')],'messages':_(_0x7fdae0[_0xa383('0xd4')])[_0xa383('0x7c')]({'secret':![]})['map'](function(_0x1eb1e7){if(_0x1eb1e7[_0xa383('0xc8')]){var _0x13497d=path[_0xa383('0xbf')](_0x24b59b,_0x1eb1e7['Attachment'][_0xa383('0xd5')]);if(fs[_0xa383('0xd6')](_0x13497d)){fs[_0xa383('0xd7')](_0x13497d)[_0xa383('0xd8')](fs[_0xa383('0xd9')](path[_0xa383('0xbf')](_0xf17630,_0x1eb1e7[_0xa383('0xc8')][_0xa383('0xd5')])));}}return{'date':moment(_0x1eb1e7[_0xa383('0x6f')])['format'](_0xa383('0xb3'))['toString'](),'sender':_0x1eb1e7[_0xa383('0xc9')]===_0xa383('0xda')?_0x1eb1e7[_0xa383('0x64')]?_0x1eb1e7[_0xa383('0x64')][_0xa383('0x2b')]:_0xa383('0xdb'):_0x1eb1e7[_0xa383('0x5c')]['firstName']+(_0x1eb1e7[_0xa383('0x5c')][_0xa383('0xc7')]?'\x20'+_0x1eb1e7[_0xa383('0x5c')][_0xa383('0xc7')]:''),'body':_0x1eb1e7['Attachment']?_0x1eb1e7[_0xa383('0xc8')][_0xa383('0xd5')]:_0x1eb1e7[_0xa383('0x6a')],'direction':_0x1eb1e7[_0xa383('0xc9')]==='out'?'A':'C','secret':_0x1eb1e7[_0xa383('0xca')],'read':_0x1eb1e7[_0xa383('0x77')],'attachment':_0x1eb1e7['Attachment']};})[_0xa383('0x59')]()};return ejs['renderFile'](path[_0xa383('0xbf')](config[_0xa383('0xc0')],_0xa383('0xdc'),'views',_0xa383('0xdd')),{'interaction':_0x2cb356})[_0xa383('0x25')](function(_0xd69118){var _0x4d6768=path[_0xa383('0xbf')](_0xf17630,'transcript-'+_0x7fdae0['id']+'-'+_0x194db4+_0xa383('0xde'));var _0xef5e47={'path':_0x4d6768,'channel':_0xa383('0xcf'),'interactionId':_0x7fdae0['id']};return pdf[_0xa383('0xdf')](_0xd69118,_0xef5e47);})[_0xa383('0x25')](function(){return new BPromise(function(_0x219f4b,_0x2c1ec4){zipdir(_0xf17630,{'saveTo':_0x50c551},function(_0x2e5107,_0x416b61){if(_0x2e5107)return _0x2c1ec4(_0x2e5107);return _0x219f4b(_0x416b61);});})[_0xa383('0x25')](function(){return new BPromise(function(_0x10aba5,_0x5565ab){rimraf(_0xf17630,function(_0x5f0c07){if(_0x5f0c07)_0x5565ab(_0x5f0c07);return _0x10aba5();});});})[_0xa383('0x25')](function(){return _0x469fa7[_0xa383('0xbd')](_0x50c551,_0x27dc5b,function(_0x4be491){if(_0x4be491){console[_0xa383('0xe0')]('err',_0x4be491);}else{fs[_0xa383('0xe1')](_0x50c551);}});});});}else{return _0x469fa7[_0xa383('0x26')](0xc8);}})['catch'](handleError(_0x469fa7,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 501541d..e2560c2 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 _0x570f=['WhatsappInteraction','setMaxListeners','save','update','remove','getUsers','Users','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5ed068,_0x470a7c){var _0x141d2d=function(_0x32ce1a){while(--_0x32ce1a){_0x5ed068['push'](_0x5ed068['shift']());}};_0x141d2d(++_0x470a7c);}(_0x570f,0x152));var _0xf570=function(_0x2b89dc,_0x8bfa42){_0x2b89dc=_0x2b89dc-0x0;var _0x412762=_0x570f[_0x2b89dc];return _0x412762;};'use strict';var EventEmitter=require(_0xf570('0x0'));var WhatsappInteraction=require(_0xf570('0x1'))['db'][_0xf570('0x2')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf570('0x3')](0x0);var events={'afterCreate':_0xf570('0x4'),'afterUpdate':_0xf570('0x5'),'afterDestroy':_0xf570('0x6')};function emitEvent(_0x140bb4){return function(_0x1cb206,_0x5b8c89,_0x5ce063){_0x1cb206[_0xf570('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x37d1c8){_0x1cb206['setDataValue'](_0xf570('0x8'),_0x37d1c8['map'](function(_0x350a32){return{'id':_0x350a32['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x1cb206['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf570('0x9')](function(_0x375e35){_0x1cb206[_0xf570('0xa')](_0xf570('0xb'),_0x375e35[_0xf570('0xc')]);WhatsappInteractionEvents['emit'](_0x140bb4+':'+_0x1cb206['id'],_0x1cb206);WhatsappInteractionEvents[_0xf570('0xd')](_0x140bb4,_0x1cb206);_0x5ce063(null);})[_0xf570('0xe')](_0x5ce063(null));};}for(var e in events){if(events[_0xf570('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xf570('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xa9e5=['remove','getUsers','then','setDataValue','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0xf5345a,_0x29b58f){var _0x327e30=function(_0x28f2b7){while(--_0x28f2b7){_0xf5345a['push'](_0xf5345a['shift']());}};_0x327e30(++_0x29b58f);}(_0xa9e5,0x8a));var _0x5a9e=function(_0x26a6d4,_0x4ee93f){_0x26a6d4=_0x26a6d4-0x0;var _0x53a301=_0xa9e5[_0x26a6d4];return _0x53a301;};'use strict';var EventEmitter=require(_0x5a9e('0x0'));var WhatsappInteraction=require(_0x5a9e('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x5a9e('0x1'))['db'][_0x5a9e('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5a9e('0x3')](0x0);var events={'afterCreate':_0x5a9e('0x4'),'afterUpdate':_0x5a9e('0x5'),'afterDestroy':_0x5a9e('0x6')};function emitEvent(_0x3ce605){return function(_0x2f42f8,_0x120d60,_0x34a9ed){_0x2f42f8[_0x5a9e('0x7')]({'attributes':['id'],'raw':!![]})[_0x5a9e('0x8')](function(_0x69b06a){_0x2f42f8[_0x5a9e('0x9')]('Users',_0x69b06a[_0x5a9e('0xa')](function(_0x18ee71){return{'id':_0x18ee71['id']};}));return WhatsappMessage[_0x5a9e('0xb')]({'where':{'WhatsappInteractionId':_0x2f42f8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5a9e('0x8')](function(_0x4ffdb3){_0x2f42f8[_0x5a9e('0x9')]('unreadMessages',_0x4ffdb3[_0x5a9e('0xc')]);WhatsappInteractionEvents[_0x5a9e('0xd')](_0x3ce605+':'+_0x2f42f8['id'],_0x2f42f8);WhatsappInteractionEvents[_0x5a9e('0xd')](_0x3ce605,_0x2f42f8);_0x34a9ed(null);})[_0x5a9e('0xe')](_0x34a9ed(null));};}for(var e in events){if(events[_0x5a9e('0xf')](e)){var event=events[e];WhatsappInteraction[_0x5a9e('0x10')](e,emitEvent(event));}}module[_0x5a9e('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index e94d9eb..583d1b6 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 _0xa3bf=['path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','request-promise'];(function(_0x32cdfe,_0x200ff4){var _0x178aa0=function(_0x3e7ca7){while(--_0x3e7ca7){_0x32cdfe['push'](_0x32cdfe['shift']());}};_0x178aa0(++_0x200ff4);}(_0xa3bf,0x1eb));var _0xfa3b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa3bf[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xfa3b('0x0'));var util=require(_0xfa3b('0x1'));var logger=require('../../config/logger')(_0xfa3b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfa3b('0x3'));var fs=require('fs');var path=require(_0xfa3b('0x4'));var rimraf=require(_0xfa3b('0x5'));var config=require(_0xfa3b('0x6'));var attributes=require(_0xfa3b('0x7'));module[_0xfa3b('0x8')]=function(_0x5a3214,_0x4ca21a){return _0x5a3214[_0xfa3b('0x9')](_0xfa3b('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b9a4e,_0x4a4b3d,_0x23dd99){if(_0x5b9a4e[_0xfa3b('0xb')]('closed')){_0x5b9a4e[_0xfa3b('0xc')]=moment()[_0xfa3b('0xd')](_0xfa3b('0xe'));}_0x23dd99(null,_0x5b9a4e);}}});}; \ No newline at end of file +var _0x76c3=['WhatsappInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x2126f6,_0x436357){var _0x554b03=function(_0x1128e4){while(--_0x1128e4){_0x2126f6['push'](_0x2126f6['shift']());}};_0x554b03(++_0x436357);}(_0x76c3,0x127));var _0x376c=function(_0x4aae30,_0x229929){_0x4aae30=_0x4aae30-0x0;var _0x353f24=_0x76c3[_0x4aae30];return _0x353f24;};'use strict';var _=require('lodash');var util=require(_0x376c('0x0'));var logger=require(_0x376c('0x1'))(_0x376c('0x2'));var moment=require(_0x376c('0x3'));var BPromise=require(_0x376c('0x4'));var rp=require(_0x376c('0x5'));var fs=require('fs');var path=require(_0x376c('0x6'));var rimraf=require(_0x376c('0x7'));var config=require(_0x376c('0x8'));var attributes=require(_0x376c('0x9'));module[_0x376c('0xa')]=function(_0x5d53d2,_0x134f17){return _0x5d53d2['define'](_0x376c('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3983b5,_0x32ca77,_0x40a827){if(_0x3983b5[_0x376c('0xc')](_0x376c('0xd'))){_0x3983b5[_0x376c('0xe')]=moment()[_0x376c('0xf')](_0x376c('0x10'));}_0x40a827(null,_0x3983b5);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 167660f..5eadd7c 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 _0x6739=['defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateWhatsappInteraction','body','options','where','attributes','limit','debug','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x5ec7db,_0x36c0be){var _0x209f26=function(_0x4d7c3e){while(--_0x4d7c3e){_0x5ec7db['push'](_0x5ec7db['shift']());}};_0x209f26(++_0x36c0be);}(_0x6739,0x185));var _0x9673=function(_0x54780a,_0x20447c){_0x54780a=_0x54780a-0x0;var _0x56fa61=_0x6739[_0x54780a];return _0x56fa61;};'use strict';var _=require(_0x9673('0x0'));var util=require(_0x9673('0x1'));var moment=require('moment');var BPromise=require(_0x9673('0x2'));var rs=require(_0x9673('0x3'));var fs=require('fs');var Redis=require(_0x9673('0x4'));var db=require(_0x9673('0x5'))['db'];var utils=require(_0x9673('0x6'));var logger=require(_0x9673('0x7'))(_0x9673('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9673('0x9')][_0x9673('0xa')]({'port':0x232a});config['redis']=_[_0x9673('0xb')](config[_0x9673('0xc')],{'host':_0x9673('0xd'),'port':0x18eb});var socket=require(_0x9673('0xe'))(new Redis(config['redis']));require(_0x9673('0xf'))[_0x9673('0x10')](socket);function respondWithRpcPromise(_0x174e3c,_0x3e36a1,_0x5ce004){return new BPromise(function(_0x179a59,_0x5915c6){return client['request'](_0x174e3c,_0x5ce004)[_0x9673('0x11')](function(_0x4f8056){logger[_0x9673('0x12')](_0x9673('0x13'),_0x3e36a1,_0x9673('0x14'));logger['debug'](_0x9673('0x15'),_0x3e36a1,_0x9673('0x14'),JSON[_0x9673('0x16')](_0x4f8056));if(_0x4f8056['error']){if(_0x4f8056['error']['code']===0x1f4){logger[_0x9673('0x17')](_0x9673('0x13'),_0x3e36a1,_0x4f8056[_0x9673('0x17')][_0x9673('0x18')]);return _0x5915c6(_0x4f8056[_0x9673('0x17')][_0x9673('0x18')]);}logger[_0x9673('0x17')](_0x9673('0x13'),_0x3e36a1,_0x4f8056['error'][_0x9673('0x18')]);return _0x179a59(_0x4f8056[_0x9673('0x17')][_0x9673('0x18')]);}else{logger[_0x9673('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x3e36a1,'request\x20sent');_0x179a59(_0x4f8056['result']['message']);}})[_0x9673('0x19')](function(_0x3d2e29){logger[_0x9673('0x17')](_0x9673('0x13'),_0x3e36a1,_0x3d2e29);_0x5915c6(_0x3d2e29);});});}exports[_0x9673('0x1a')]=function(_0xcd1d5e){var _0x10e40b=this;return new Promise(function(_0x51418b,_0x12eea5){return db['WhatsappInteraction']['update'](_0xcd1d5e[_0x9673('0x1b')],{'raw':_0xcd1d5e['options']?_0xcd1d5e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcd1d5e[_0x9673('0x1c')]?_0xcd1d5e[_0x9673('0x1c')][_0x9673('0x1d')]||null:null,'attributes':_0xcd1d5e[_0x9673('0x1c')]?_0xcd1d5e[_0x9673('0x1c')][_0x9673('0x1e')]||null:null,'limit':_0xcd1d5e[_0x9673('0x1c')]?_0xcd1d5e[_0x9673('0x1c')][_0x9673('0x1f')]||null:null})[_0x9673('0x11')](function(_0x5e39ad){logger[_0x9673('0x12')](_0x9673('0x1a'),_0xcd1d5e);logger[_0x9673('0x20')](_0x9673('0x1a'),_0xcd1d5e,JSON[_0x9673('0x16')](_0x5e39ad));_0x51418b(_0x5e39ad);})[_0x9673('0x19')](function(_0xd8dfff){logger[_0x9673('0x17')](_0x9673('0x1a'),_0xd8dfff[_0x9673('0x18')],_0xcd1d5e);_0x12eea5(_0x10e40b[_0x9673('0x17')](0x1f4,_0xd8dfff['message']));});});};exports[_0x9673('0x21')]=function(_0x1cab29){return new Promise(function(_0x3bf900,_0x3b2ad6){return db[_0x9673('0x22')][_0x9673('0x23')]({'where':_0x1cab29[_0x9673('0x1c')]?_0x1cab29[_0x9673('0x1c')][_0x9673('0x1d')]||null:null})[_0x9673('0x11')](function(_0x65094d){if(_0x65094d){return _0x65094d[_0x9673('0x24')](_0x1cab29[_0x9673('0x1b')][_0x9673('0x25')],_['omit'](_0x1cab29['body'],[_0x9673('0x25'),'id'])||{});}})[_0x9673('0x26')](function(_0xc75f97){logger[_0x9673('0x12')](_0x9673('0x27'),_0x1cab29);logger['debug']('AddTags',_0x1cab29,JSON['stringify'](_0xc75f97));_0x3bf900(_0xc75f97);})[_0x9673('0x19')](function(_0x52c044){logger[_0x9673('0x17')](_0x9673('0x27'),_0x52c044[_0x9673('0x18')],_0x1cab29);_0x3b2ad6(_this[_0x9673('0x17')](0x1f4,_0x52c044[_0x9673('0x18')]));});});}; \ No newline at end of file +var _0xb077=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','WhatsappInteraction','options','raw','where','attributes','UpdateWhatsappInteraction','stringify','find','addTags','body','ids','omit','spread','AddTags','util','moment','bluebird'];(function(_0x3e8ba5,_0x59a883){var _0x270688=function(_0x1df316){while(--_0x1df316){_0x3e8ba5['push'](_0x3e8ba5['shift']());}};_0x270688(++_0x59a883);}(_0xb077,0xf9));var _0x7b07=function(_0x32b32e,_0x150b3d){_0x32b32e=_0x32b32e-0x0;var _0x2ed58c=_0xb077[_0x32b32e];return _0x2ed58c;};'use strict';var _=require('lodash');var util=require(_0x7b07('0x0'));var moment=require(_0x7b07('0x1'));var BPromise=require(_0x7b07('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b07('0x3'));var db=require(_0x7b07('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b07('0x5'))(_0x7b07('0x6'));var config=require(_0x7b07('0x7'));var jayson=require(_0x7b07('0x8'));var client=jayson[_0x7b07('0x9')][_0x7b07('0xa')]({'port':0x232a});config[_0x7b07('0xb')]=_[_0x7b07('0xc')](config[_0x7b07('0xb')],{'host':_0x7b07('0xd'),'port':0x18eb});var socket=require(_0x7b07('0xe'))(new Redis(config[_0x7b07('0xb')]));require(_0x7b07('0xf'))[_0x7b07('0x10')](socket);function respondWithRpcPromise(_0x1f7f1c,_0x5553ef,_0x19c5d4){return new BPromise(function(_0x3abf6f,_0x1740ce){return client[_0x7b07('0x11')](_0x1f7f1c,_0x19c5d4)[_0x7b07('0x12')](function(_0x496b92){logger[_0x7b07('0x13')](_0x7b07('0x14'),_0x5553ef,_0x7b07('0x15'));logger[_0x7b07('0x16')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x5553ef,_0x7b07('0x15'),JSON['stringify'](_0x496b92));if(_0x496b92[_0x7b07('0x17')]){if(_0x496b92[_0x7b07('0x17')][_0x7b07('0x18')]===0x1f4){logger[_0x7b07('0x17')](_0x7b07('0x14'),_0x5553ef,_0x496b92['error']['message']);return _0x1740ce(_0x496b92[_0x7b07('0x17')][_0x7b07('0x19')]);}logger['error'](_0x7b07('0x14'),_0x5553ef,_0x496b92['error'][_0x7b07('0x19')]);return _0x3abf6f(_0x496b92[_0x7b07('0x17')][_0x7b07('0x19')]);}else{logger['info'](_0x7b07('0x14'),_0x5553ef,_0x7b07('0x15'));_0x3abf6f(_0x496b92[_0x7b07('0x1a')][_0x7b07('0x19')]);}})[_0x7b07('0x1b')](function(_0x5e3beb){logger['error'](_0x7b07('0x14'),_0x5553ef,_0x5e3beb);_0x1740ce(_0x5e3beb);});});}exports['UpdateWhatsappInteraction']=function(_0x50dd69){var _0x13d871=this;return new Promise(function(_0x20cb5b,_0x2d9202){return db[_0x7b07('0x1c')]['update'](_0x50dd69['body'],{'raw':_0x50dd69[_0x7b07('0x1d')]?_0x50dd69[_0x7b07('0x1d')][_0x7b07('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50dd69[_0x7b07('0x1d')]?_0x50dd69[_0x7b07('0x1d')][_0x7b07('0x1f')]||null:null,'attributes':_0x50dd69[_0x7b07('0x1d')]?_0x50dd69['options'][_0x7b07('0x20')]||null:null,'limit':_0x50dd69[_0x7b07('0x1d')]?_0x50dd69[_0x7b07('0x1d')]['limit']||null:null})[_0x7b07('0x12')](function(_0x149b1f){logger[_0x7b07('0x13')](_0x7b07('0x21'),_0x50dd69);logger[_0x7b07('0x16')](_0x7b07('0x21'),_0x50dd69,JSON[_0x7b07('0x22')](_0x149b1f));_0x20cb5b(_0x149b1f);})[_0x7b07('0x1b')](function(_0x1bcc56){logger[_0x7b07('0x17')](_0x7b07('0x21'),_0x1bcc56['message'],_0x50dd69);_0x2d9202(_0x13d871[_0x7b07('0x17')](0x1f4,_0x1bcc56[_0x7b07('0x19')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x4870bf){return new Promise(function(_0x7d15bb,_0x2d1be1){return db['WhatsappInteraction'][_0x7b07('0x23')]({'where':_0x4870bf[_0x7b07('0x1d')]?_0x4870bf[_0x7b07('0x1d')][_0x7b07('0x1f')]||null:null})[_0x7b07('0x12')](function(_0x11826e){if(_0x11826e){return _0x11826e[_0x7b07('0x24')](_0x4870bf[_0x7b07('0x25')][_0x7b07('0x26')],_[_0x7b07('0x27')](_0x4870bf['body'],[_0x7b07('0x26'),'id'])||{});}})[_0x7b07('0x28')](function(_0x54f954){logger[_0x7b07('0x13')]('AddTags',_0x4870bf);logger['debug'](_0x7b07('0x29'),_0x4870bf,JSON[_0x7b07('0x22')](_0x54f954));_0x7d15bb(_0x54f954);})[_0x7b07('0x1b')](function(_0x2a0547){logger['error']('AddTags',_0x2a0547[_0x7b07('0x19')],_0x4870bf);_0x2d1be1(_this[_0x7b07('0x17')](0x1f4,_0x2a0547[_0x7b07('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 187c87e..2e647c8 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 _0x6ac5=['register','./whatsappInteraction.events','update','emit'];(function(_0x326f05,_0x19eaf1){var _0x353cff=function(_0x4c2a10){while(--_0x4c2a10){_0x326f05['push'](_0x326f05['shift']());}};_0x353cff(++_0x19eaf1);}(_0x6ac5,0x119));var _0x56ac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6ac5[_0x14add3];return _0x4a174f;};'use strict';var WhatsappInteractionEvents=require(_0x56ac('0x0'));var events=['save','remove',_0x56ac('0x1')];function createListener(_0x5ac3ba,_0x5eeb27){return function(_0x2d7bfd){_0x5eeb27[_0x56ac('0x2')](_0x5ac3ba,_0x2d7bfd);};}function removeListener(_0x12e5be,_0x1ffbc7){return function(){WhatsappInteractionEvents['removeListener'](_0x12e5be,_0x1ffbc7);};}exports[_0x56ac('0x3')]=function(_0xb211f3){for(var _0x27ae8d=0x0,_0x3b0b6a=events['length'];_0x27ae8d<_0x3b0b6a;_0x27ae8d++){var _0x4ba671=events[_0x27ae8d];var _0x2f9c99=createListener('whatsappInteraction:'+_0x4ba671,_0xb211f3);WhatsappInteractionEvents['on'](_0x4ba671,_0x2f9c99);}}; \ No newline at end of file +var _0x77a6=['emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0x3ac38d,_0x778a95){var _0x2beed0=function(_0x2a29c1){while(--_0x2a29c1){_0x3ac38d['push'](_0x3ac38d['shift']());}};_0x2beed0(++_0x778a95);}(_0x77a6,0x101));var _0x677a=function(_0x402999,_0xbc5e31){_0x402999=_0x402999-0x0;var _0x59bf08=_0x77a6[_0x402999];return _0x59bf08;};'use strict';var WhatsappInteractionEvents=require(_0x677a('0x0'));var events=[_0x677a('0x1'),_0x677a('0x2'),_0x677a('0x3')];function createListener(_0x2a4004,_0x4cff44){return function(_0x5b0625){_0x4cff44[_0x677a('0x4')](_0x2a4004,_0x5b0625);};}function removeListener(_0x49c92c,_0x3558e5){return function(){WhatsappInteractionEvents[_0x677a('0x5')](_0x49c92c,_0x3558e5);};}exports[_0x677a('0x6')]=function(_0x1aed36){for(var _0x23ff9f=0x0,_0x4c01b3=events[_0x677a('0x7')];_0x23ff9f<_0x4c01b3;_0x23ff9f++){var _0x31b6c0=events[_0x23ff9f];var _0x2692ce=createListener(_0x677a('0x8')+_0x31b6c0,_0x1aed36);WhatsappInteractionEvents['on'](_0x31b6c0,_0x2692ce);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 54b242b..577815d 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 _0x47dd=['index','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x114cde,_0x148efd){var _0x4b7547=function(_0x643263){while(--_0x643263){_0x114cde['push'](_0x114cde['shift']());}};_0x4b7547(++_0x148efd);}(_0x47dd,0x106));var _0xd47d=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x47dd[_0xc0a3d3];return _0x3386e8;};'use strict';var multer=require('multer');var util=require(_0xd47d('0x0'));var path=require(_0xd47d('0x1'));var timeout=require('connect-timeout');var express=require(_0xd47d('0x2'));var router=express['Router']();var fs_extra=require(_0xd47d('0x3'));var auth=require(_0xd47d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd47d('0x5'));var controller=require('./whatsappMessage.controller');router[_0xd47d('0x6')]('/',auth[_0xd47d('0x7')](),controller[_0xd47d('0x8')]);router[_0xd47d('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xd47d('0x9')]);router[_0xd47d('0x6')](_0xd47d('0xa'),auth[_0xd47d('0x7')](),controller[_0xd47d('0xb')]);router[_0xd47d('0xc')]('/',auth[_0xd47d('0x7')](),interaction[_0xd47d('0xd')](_0xd47d('0xe'),_0xd47d('0xf')),controller[_0xd47d('0x10')]);router[_0xd47d('0xc')](_0xd47d('0x11'),controller[_0xd47d('0x12')]);router['put'](_0xd47d('0xa'),auth[_0xd47d('0x7')](),controller[_0xd47d('0x13')]);router[_0xd47d('0x14')](_0xd47d('0x15'),auth[_0xd47d('0x7')](),controller[_0xd47d('0x16')]);router[_0xd47d('0x14')](_0xd47d('0x17'),auth[_0xd47d('0x7')](),controller[_0xd47d('0x18')]);router[_0xd47d('0x19')](_0xd47d('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xd47d('0x1a')]=router; \ No newline at end of file +var _0xe78e=['whatsapp','whatsappmessage:create','create','post','/:id/status','status','update','/:id/accept','reject','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','describe','/:id','show','isAuthenticated','tracked'];(function(_0x59c7e5,_0x41c52f){var _0x1a353d=function(_0x35345c){while(--_0x35345c){_0x59c7e5['push'](_0x59c7e5['shift']());}};_0x1a353d(++_0x41c52f);}(_0xe78e,0x123));var _0xee78=function(_0x11695e,_0x4a57c4){_0x11695e=_0x11695e-0x0;var _0x3b7110=_0xe78e[_0x11695e];return _0x3b7110;};'use strict';var multer=require('multer');var util=require(_0xee78('0x0'));var path=require(_0xee78('0x1'));var timeout=require(_0xee78('0x2'));var express=require(_0xee78('0x3'));var router=express[_0xee78('0x4')]();var fs_extra=require(_0xee78('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xee78('0x6'));var config=require(_0xee78('0x7'));var controller=require(_0xee78('0x8'));router[_0xee78('0x9')]('/',auth['isAuthenticated'](),controller[_0xee78('0xa')]);router['get'](_0xee78('0xb'),auth['isAuthenticated'](),controller[_0xee78('0xc')]);router[_0xee78('0x9')](_0xee78('0xd'),auth['isAuthenticated'](),controller[_0xee78('0xe')]);router['post']('/',auth[_0xee78('0xf')](),interaction[_0xee78('0x10')](_0xee78('0x11'),_0xee78('0x12')),controller[_0xee78('0x13')]);router[_0xee78('0x14')](_0xee78('0x15'),controller[_0xee78('0x16')]);router['put']('/:id',auth[_0xee78('0xf')](),controller[_0xee78('0x17')]);router['put'](_0xee78('0x18'),auth[_0xee78('0xf')](),controller['accept']);router['put']('/:id/reject',auth[_0xee78('0xf')](),controller[_0xee78('0x19')]);router[_0xee78('0x1a')](_0xee78('0xd'),auth['isAuthenticated'](),controller[_0xee78('0x1b')]);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 0bf96db..2b87b8b 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 _0x0453=['ENUM','out','STRING','DATE','BOOLEAN','exports','TEXT','medium'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x0453,0x155));var _0x3045=function(_0x95651d,_0x5a22db){_0x95651d=_0x95651d-0x0;var _0x266777=_0x0453[_0x95651d];return _0x266777;};'use strict';var Sequelize=require('sequelize');module[_0x3045('0x0')]={'body':{'type':Sequelize[_0x3045('0x1')](_0x3045('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3045('0x3')]('in',_0x3045('0x4')),'defaultValue':_0x3045('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3045('0x5')](0xbe)},'phone':{'type':Sequelize[_0x3045('0x5')]},'readAt':{'type':Sequelize[_0x3045('0x6')]},'secret':{'type':Sequelize[_0x3045('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3045('0x1')]}}; \ No newline at end of file +var _0x220a=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0x220a,0x13b));var _0xa220=function(_0x2f9124,_0x2fbb25){_0x2f9124=_0x2f9124-0x0;var _0x16268a=_0x220a[_0x2f9124];return _0x16268a;};'use strict';var Sequelize=require(_0xa220('0x0'));module[_0xa220('0x1')]={'body':{'type':Sequelize[_0xa220('0x2')](_0xa220('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa220('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa220('0x5')),'defaultValue':_0xa220('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa220('0x6')](0xbe)},'phone':{'type':Sequelize[_0xa220('0x6')]},'readAt':{'type':Sequelize[_0xa220('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa220('0x6')]},'providerResponse':{'type':Sequelize[_0xa220('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 245b0d1..11ee7ed 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 _0x0c94=['../../config/license/util','../../mysqldb','redis','defaults','localhost','jayson/promise','client','http','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','end','stack','name','map','WhatsappMessage','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteractionId','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','Sequelize','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','type','inspect','twilio','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x59550b,_0x186704){var _0x2f68f5=function(_0x4d0225){while(--_0x4d0225){_0x59550b['push'](_0x59550b['shift']());}};_0x2f68f5(++_0x186704);}(_0x0c94,0x71));var _0x40c9=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x0c94[_0x4c12ec];return _0x3ae42c;};'use strict';var emlformat=require(_0x40c9('0x0'));var rimraf=require(_0x40c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x40c9('0x2'));var moment=require(_0x40c9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x40c9('0x4'));var util=require('util');var path=require(_0x40c9('0x5'));var sox=require('sox');var csv=require(_0x40c9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x40c9('0x7'));var _=require(_0x40c9('0x8'));var squel=require('squel');var crypto=require(_0x40c9('0x9'));var jsforce=require(_0x40c9('0xa'));var deskjs=require(_0x40c9('0xb'));var toCsv=require(_0x40c9('0x6'));var querystring=require(_0x40c9('0xc'));var Papa=require(_0x40c9('0xd'));var Redis=require(_0x40c9('0xe'));var authService=require(_0x40c9('0xf'));var qs=require(_0x40c9('0x10'));var as=require(_0x40c9('0x11'));var hardwareService=require(_0x40c9('0x12'));var logger=require(_0x40c9('0x13'))(_0x40c9('0x14'));var utils=require(_0x40c9('0x15'));var config=require(_0x40c9('0x16'));var licenseUtil=require(_0x40c9('0x17'));var db=require(_0x40c9('0x18'))['db'];config[_0x40c9('0x19')]=_[_0x40c9('0x1a')](config[_0x40c9('0x19')],{'host':_0x40c9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x40c9('0x19')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x40c9('0x1c'));var client=jayson[_0x40c9('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x40c9('0x1d')][_0x40c9('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2a11b2,_0x3def4f,_0x5b0848,_0x3e15d6){return new BPromise(function(_0x12756b,_0x2788a8){var _0x2d3c82=_0x3e15d6||client;return _0x2d3c82['request'](_0x2a11b2,_0x5b0848)['then'](function(_0x4d6f9e){logger[_0x40c9('0x1f')](_0x40c9('0x20'),_0x3def4f,_0x40c9('0x21'));logger[_0x40c9('0x22')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3def4f,_0x40c9('0x21'),JSON[_0x40c9('0x23')](_0x4d6f9e));if(_0x4d6f9e['error']){if(_0x4d6f9e[_0x40c9('0x24')][_0x40c9('0x25')]===0x1f4){logger[_0x40c9('0x24')](_0x40c9('0x20'),_0x3def4f,_0x4d6f9e[_0x40c9('0x24')][_0x40c9('0x26')]);return _0x2788a8(_0x4d6f9e[_0x40c9('0x24')][_0x40c9('0x26')]);}logger[_0x40c9('0x24')](_0x40c9('0x20'),_0x3def4f,_0x4d6f9e[_0x40c9('0x24')][_0x40c9('0x26')]);return _0x12756b(_0x4d6f9e['error'][_0x40c9('0x26')]);}else{logger['info'](_0x40c9('0x20'),_0x3def4f,_0x40c9('0x21'));_0x12756b(_0x4d6f9e[_0x40c9('0x27')][_0x40c9('0x26')]);}})['catch'](function(_0x42eadf){logger[_0x40c9('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x3def4f,_0x42eadf);_0x2788a8(_0x42eadf);});});}function respondWithStatusCode(_0xc7372e,_0x1cf291){_0x1cf291=_0x1cf291||0xcc;return function(_0x42879d){if(_0x42879d){return _0xc7372e[_0x40c9('0x28')](_0x1cf291);}return _0xc7372e[_0x40c9('0x29')](_0x1cf291)['end']();};}function respondWithResult(_0x4f68ce,_0x34e8d2){_0x34e8d2=_0x34e8d2||0xc8;return function(_0x2011aa){if(_0x2011aa){return _0x4f68ce[_0x40c9('0x29')](_0x34e8d2)[_0x40c9('0x2a')](_0x2011aa);}};}function respondWithFilteredResult(_0x1338e6,_0xa5532f){return function(_0x355657){if(_0x355657){var _0x263516=typeof _0xa5532f['offset']===_0x40c9('0x2b')&&typeof _0xa5532f[_0x40c9('0x2c')]===_0x40c9('0x2b');var _0x42c304=_0x355657[_0x40c9('0x2d')];var _0x2a7a2c=_0x263516?0x0:_0xa5532f[_0x40c9('0x2e')];var _0x46de56=_0x263516?_0x355657[_0x40c9('0x2d')]:_0xa5532f[_0x40c9('0x2e')]+_0xa5532f[_0x40c9('0x2c')];var _0x516382;if(_0x46de56>=_0x42c304){_0x46de56=_0x42c304;_0x516382=0xc8;}else{_0x516382=0xce;}_0x1338e6[_0x40c9('0x29')](_0x516382);return _0x1338e6[_0x40c9('0x2f')]('Content-Range',_0x2a7a2c+'-'+_0x46de56+'/'+_0x42c304)[_0x40c9('0x2a')](_0x355657);}return null;};}function patchUpdates(_0x2c4c03){return function(_0x4e7d85){try{jsonpatch[_0x40c9('0x30')](_0x4e7d85,_0x2c4c03,!![]);}catch(_0x3f2d6b){return BPromise[_0x40c9('0x31')](_0x3f2d6b);}return _0x4e7d85[_0x40c9('0x32')]();};}function saveUpdates(_0x4afdaa,_0x18fd96){return function(_0x2e38b5){if(_0x2e38b5){return _0x2e38b5[_0x40c9('0x33')](_0x4afdaa)[_0x40c9('0x34')](function(_0x342777){return _0x342777;});}return null;};}function removeEntity(_0x424d78,_0x20497e){return function(_0xc740d6){if(_0xc740d6){return _0xc740d6[_0x40c9('0x35')]()[_0x40c9('0x34')](function(){_0x424d78[_0x40c9('0x29')](0xcc)[_0x40c9('0x36')]();});}};}function handleEntityNotFound(_0x342db9,_0x3cfa08){return function(_0xe25a5){if(!_0xe25a5){_0x342db9[_0x40c9('0x28')](0x194);}return _0xe25a5;};}function handleError(_0x1d1311,_0x1c76a2){_0x1c76a2=_0x1c76a2||0x1f4;return function(_0x41dbc8){logger[_0x40c9('0x24')](_0x41dbc8[_0x40c9('0x37')]);if(_0x41dbc8[_0x40c9('0x38')]){delete _0x41dbc8[_0x40c9('0x38')];}_0x1d1311[_0x40c9('0x29')](_0x1c76a2)['send'](_0x41dbc8);};}exports['index']=function(_0x22041a,_0x296fc3){var _0x32a433={},_0x58e062={},_0x4bfb4c={'count':0x0,'rows':[]};var _0x16d8b5=_[_0x40c9('0x39')](db[_0x40c9('0x3a')][_0x40c9('0x3b')],function(_0xedeebe){return{'name':_0xedeebe['fieldName'],'type':_0xedeebe['type'][_0x40c9('0x3c')]};});_0x58e062[_0x40c9('0x3d')]=_[_0x40c9('0x39')](_0x16d8b5,_0x40c9('0x38'));_0x58e062['query']=_[_0x40c9('0x3e')](_0x22041a[_0x40c9('0x3f')]);_0x58e062[_0x40c9('0x40')]=_[_0x40c9('0x41')](_0x58e062[_0x40c9('0x3d')],_0x58e062[_0x40c9('0x3f')]);_0x32a433['attributes']=_[_0x40c9('0x41')](_0x58e062[_0x40c9('0x3d')],qs[_0x40c9('0x42')](_0x22041a[_0x40c9('0x3f')][_0x40c9('0x42')]));_0x32a433['attributes']=_0x32a433[_0x40c9('0x43')][_0x40c9('0x44')]?_0x32a433[_0x40c9('0x43')]:_0x58e062[_0x40c9('0x3d')];if(!_0x22041a[_0x40c9('0x3f')][_0x40c9('0x45')](_0x40c9('0x46'))){_0x32a433[_0x40c9('0x2c')]=qs['limit'](_0x22041a[_0x40c9('0x3f')][_0x40c9('0x2c')]);_0x32a433[_0x40c9('0x2e')]=qs[_0x40c9('0x2e')](_0x22041a[_0x40c9('0x3f')][_0x40c9('0x2e')]);}_0x32a433['order']=qs[_0x40c9('0x47')](_0x22041a[_0x40c9('0x3f')]['sort']);_0x32a433[_0x40c9('0x48')]=qs[_0x40c9('0x40')](_[_0x40c9('0x49')](_0x22041a[_0x40c9('0x3f')],_0x58e062[_0x40c9('0x40')]),_0x16d8b5);if(_0x22041a[_0x40c9('0x3f')][_0x40c9('0x4a')]){_0x32a433[_0x40c9('0x48')]=_['merge'](_0x32a433['where'],{'$or':_[_0x40c9('0x39')](_0x16d8b5,function(_0x2d12d5){if(_0x2d12d5['type']!==_0x40c9('0x4b')){var _0x18c346={};_0x18c346[_0x2d12d5['name']]={'$like':'%'+_0x22041a[_0x40c9('0x3f')][_0x40c9('0x4a')]+'%'};return _0x18c346;}})});}_0x32a433=_['merge']({},_0x32a433,_0x22041a[_0x40c9('0x4c')]);var _0x87fd45={'where':_0x32a433[_0x40c9('0x48')]};return db[_0x40c9('0x3a')][_0x40c9('0x2d')](_0x87fd45)['then'](function(_0x1c9721){_0x4bfb4c[_0x40c9('0x2d')]=_0x1c9721;if(_0x22041a[_0x40c9('0x3f')][_0x40c9('0x4d')]){_0x32a433[_0x40c9('0x4e')]=[{'all':!![]}];}return db[_0x40c9('0x3a')][_0x40c9('0x4f')](_0x32a433);})[_0x40c9('0x34')](function(_0x4c3da1){_0x4bfb4c[_0x40c9('0x50')]=_0x4c3da1;return _0x4bfb4c;})[_0x40c9('0x34')](respondWithFilteredResult(_0x296fc3,_0x32a433))[_0x40c9('0x51')](handleError(_0x296fc3,null));};exports[_0x40c9('0x52')]=function(_0x1ea01e,_0x3bc174){var _0x2f86f6={'raw':!![],'where':{'id':_0x1ea01e[_0x40c9('0x53')]['id']}},_0x52d7a7={};_0x52d7a7[_0x40c9('0x3d')]=_[_0x40c9('0x3e')](db[_0x40c9('0x3a')][_0x40c9('0x3b')]);_0x52d7a7[_0x40c9('0x3f')]=_[_0x40c9('0x3e')](_0x1ea01e[_0x40c9('0x3f')]);_0x52d7a7[_0x40c9('0x40')]=_[_0x40c9('0x41')](_0x52d7a7[_0x40c9('0x3d')],_0x52d7a7[_0x40c9('0x3f')]);_0x2f86f6[_0x40c9('0x43')]=_[_0x40c9('0x41')](_0x52d7a7[_0x40c9('0x3d')],qs['fields'](_0x1ea01e[_0x40c9('0x3f')][_0x40c9('0x42')]));_0x2f86f6[_0x40c9('0x43')]=_0x2f86f6[_0x40c9('0x43')][_0x40c9('0x44')]?_0x2f86f6['attributes']:_0x52d7a7[_0x40c9('0x3d')];if(_0x1ea01e['query'][_0x40c9('0x4d')]){_0x2f86f6[_0x40c9('0x4e')]=[{'all':!![]}];}_0x2f86f6=_['merge']({},_0x2f86f6,_0x1ea01e[_0x40c9('0x4c')]);return db['WhatsappMessage']['find'](_0x2f86f6)[_0x40c9('0x34')](handleEntityNotFound(_0x3bc174,null))['then'](respondWithResult(_0x3bc174,null))[_0x40c9('0x51')](handleError(_0x3bc174,null));};exports[_0x40c9('0x54')]=function(_0x5e71ef,_0x5e9328){return db[_0x40c9('0x3a')][_0x40c9('0x54')](_0x5e71ef['body'],{})['then'](respondWithResult(_0x5e9328,0xc9))[_0x40c9('0x51')](handleError(_0x5e9328,null));};exports['update']=function(_0x14f0ff,_0x1a10ed){if(_0x14f0ff[_0x40c9('0x55')]['id']){delete _0x14f0ff[_0x40c9('0x55')]['id'];}return db[_0x40c9('0x3a')][_0x40c9('0x56')]({'where':{'id':_0x14f0ff[_0x40c9('0x53')]['id']}})[_0x40c9('0x34')](handleEntityNotFound(_0x1a10ed,null))['then'](saveUpdates(_0x14f0ff['body'],null))['then'](respondWithResult(_0x1a10ed,null))[_0x40c9('0x51')](handleError(_0x1a10ed,null));};exports[_0x40c9('0x35')]=function(_0x33f490,_0x198834){return db[_0x40c9('0x3a')][_0x40c9('0x56')]({'where':{'id':_0x33f490['params']['id']}})[_0x40c9('0x34')](handleEntityNotFound(_0x198834,null))[_0x40c9('0x34')](removeEntity(_0x198834,null))[_0x40c9('0x51')](handleError(_0x198834,null));};exports[_0x40c9('0x57')]=function(_0x2a5cb1,_0x1552e1){return db['WhatsappMessage'][_0x40c9('0x57')]()[_0x40c9('0x34')](respondWithResult(_0x1552e1,null))['catch'](handleError(_0x1552e1,null));};var interaction_log=require(_0x40c9('0x13'))(_0x40c9('0x58'));exports[_0x40c9('0x59')]=function(_0x24ae9b,_0x4b7aa2,_0x803d78){var _0x2032f7={'agent':{},'channel':_0x40c9('0x5a')};if(_0x24ae9b[_0x40c9('0x55')]['id']){delete _0x24ae9b[_0x40c9('0x55')]['id'];}_0x24ae9b[_0x40c9('0x55')]['read']=!![];_0x24ae9b[_0x40c9('0x55')][_0x40c9('0x5b')]=moment()[_0x40c9('0x5c')](_0x40c9('0x5d'));_0x24ae9b['body'][_0x40c9('0x5e')]=_0x24ae9b['body'][_0x40c9('0x5e')]||_0x24ae9b[_0x40c9('0x5f')]['id'];_0x2032f7['agent']['id']=_0x24ae9b[_0x40c9('0x55')][_0x40c9('0x5e')];return db[_0x40c9('0x3a')][_0x40c9('0x56')]({'where':{'id':_0x24ae9b[_0x40c9('0x53')]['id'],'UserId':null}})[_0x40c9('0x34')](handleEntityNotFound(_0x4b7aa2,null))['then'](saveUpdates(_0x24ae9b['body'],null))[_0x40c9('0x34')](function(_0x46e5c0){if(_0x46e5c0){_0x2032f7['message']=_0x46e5c0[_0x40c9('0x60')]({'plain':!![]});return db['WhatsappInteraction'][_0x40c9('0x56')]({'where':{'id':_0x46e5c0[_0x40c9('0x61')]}});}return null;})[_0x40c9('0x34')](handleEntityNotFound(_0x4b7aa2,null))['then'](function(_0x317de3){if(_0x317de3){return _0x317de3['update']({'UserId':_0x24ae9b[_0x40c9('0x55')]['UserId'],'read1stAt':_[_0x40c9('0x62')](_0x317de3[_0x40c9('0x63')])?moment()[_0x40c9('0x5c')](_0x40c9('0x5d')):undefined});}return null;})[_0x40c9('0x34')](function(_0x1beef8){if(_0x1beef8){_0x2032f7[_0x40c9('0x64')]=_0x1beef8[_0x40c9('0x60')]({'plain':!![]});interaction_log[_0x40c9('0x1f')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x24ae9b['user']['id'],_0x24ae9b[_0x40c9('0x5f')][_0x40c9('0x38')],_0x24ae9b[_0x40c9('0x5f')][_0x40c9('0x65')],_0x2032f7[_0x40c9('0x64')]['id'],_0x24ae9b[_0x40c9('0x55')]?JSON[_0x40c9('0x23')](_0x24ae9b[_0x40c9('0x55')]):'null');return respondWithRpcPromise(_0x40c9('0x66'),_0x40c9('0x67'),_0x2032f7);}return null;})['then'](function(_0x4070c5){var _0x498fc8=_0x40c9('0x68')+_0x4070c5['message'][_0x40c9('0x69')];return db[_0x40c9('0x6a')][_0x40c9('0x3f')](_0x498fc8,{'type':db['Sequelize'][_0x40c9('0x6b')]['SELECT'],'raw':!![]})[_0x40c9('0x34')](function(_0x2d0d3b){return _0x2d0d3b;});})[_0x40c9('0x34')](function(_0x4b4f1f){if(_0x4b4f1f){_0x2032f7[_0x40c9('0x26')][_0x40c9('0x6c')]=_0x4b4f1f[0x0];if(!_0x24ae9b[_0x40c9('0x55')]['UserId'])return;return db[_0x40c9('0x6d')][_0x40c9('0x56')]({'where':{'id':_0x24ae9b[_0x40c9('0x55')][_0x40c9('0x5e')],'role':_0x40c9('0x6e')},'attributes':['id',_0x40c9('0x38'),_0x40c9('0x6f'),_0x40c9('0x70'),_0x40c9('0x71')],'raw':!![]});}return null;})[_0x40c9('0x34')](function(_0x495b12){if(!_0x495b12)return null;_0x2032f7['message'][_0x40c9('0x6e')]=_0x495b12;return _0x2032f7;})[_0x40c9('0x34')](function(_0x14e3e0){if(_0x14e3e0){if(_0x24ae9b[_0x40c9('0x55')][_0x40c9('0x72')]){_0x2032f7[_0x40c9('0x26')][_0x40c9('0x73')]=util[_0x40c9('0x5c')](_0x40c9('0x74'),_0x24ae9b['user'][_0x40c9('0x38')]);_0x2032f7[_0x40c9('0x26')][_0x40c9('0x75')]=_0x2032f7[_0x40c9('0x75')];_0x2032f7[_0x40c9('0x26')][_0x40c9('0x76')]=_0x2032f7[_0x40c9('0x75')];_0x2032f7[_0x40c9('0x26')][_0x40c9('0x77')]=_0x40c9('0x59');return respondWithRpcPromise(_0x40c9('0x78'),_0x40c9('0x78'),{'event':_0x40c9('0x79'),'message':_0x2032f7['message']},client9002)[_0x40c9('0x34')](function(){return _0x2032f7;});}return _0x2032f7;}return null;})[_0x40c9('0x34')](respondWithResult(_0x4b7aa2,null))[_0x40c9('0x51')](handleError(_0x4b7aa2,null));};var interaction_log=require('../../config/logger')(_0x40c9('0x58'));exports[_0x40c9('0x31')]=function(_0x2ce3cc,_0x5f500d,_0x1f3360){var _0x26fd80={'agent':{},'channel':'whatsapp'};if(_0x2ce3cc['body']['id']){delete _0x2ce3cc[_0x40c9('0x55')]['id'];}_0x2ce3cc['body'][_0x40c9('0x5e')]=_0x2ce3cc[_0x40c9('0x55')]['UserId']||_0x2ce3cc[_0x40c9('0x5f')]['id'];_0x26fd80[_0x40c9('0x6e')]['id']=_0x2ce3cc['body'][_0x40c9('0x5e')];return db[_0x40c9('0x3a')][_0x40c9('0x56')]({'where':{'id':_0x2ce3cc[_0x40c9('0x53')]['id'],'UserId':null}})[_0x40c9('0x34')](handleEntityNotFound(_0x5f500d,null))[_0x40c9('0x34')](function(_0x160ea4){if(_0x160ea4){_0x26fd80[_0x40c9('0x26')]=_0x160ea4[_0x40c9('0x60')]({'plain':!![]});return db[_0x40c9('0x7a')]['find']({'where':{'id':_0x160ea4[_0x40c9('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x5f500d,null))[_0x40c9('0x34')](function(_0x416b30){if(_0x416b30){_0x26fd80[_0x40c9('0x64')]=_0x416b30['get']({'plain':!![]});interaction_log[_0x40c9('0x1f')](_0x40c9('0x7b'),_0x2ce3cc['user']['id'],_0x2ce3cc[_0x40c9('0x5f')][_0x40c9('0x38')],_0x2ce3cc['user'][_0x40c9('0x65')],_0x26fd80['interaction']['id'],_0x2ce3cc[_0x40c9('0x55')]?JSON[_0x40c9('0x23')](_0x2ce3cc['body']):_0x40c9('0x7c'));return respondWithRpcPromise(_0x40c9('0x7d'),'rejectMessage',_0x26fd80);}return null;})['then'](function(_0x57732a){var _0x7ea51c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x57732a['message']['ContactId'];return db[_0x40c9('0x6a')][_0x40c9('0x3f')](_0x7ea51c,{'type':db[_0x40c9('0x7e')]['QueryTypes']['SELECT'],'raw':!![]})[_0x40c9('0x34')](function(_0x4c9713){return _0x4c9713;});})[_0x40c9('0x34')](function(_0x233803){if(_0x233803){_0x26fd80[_0x40c9('0x26')][_0x40c9('0x6c')]=_0x233803[0x0];if(!_0x2ce3cc['body']['UserId'])return;return db[_0x40c9('0x6d')][_0x40c9('0x56')]({'where':{'id':_0x2ce3cc[_0x40c9('0x55')][_0x40c9('0x5e')],'role':_0x40c9('0x6e')},'attributes':['id',_0x40c9('0x38'),_0x40c9('0x6f'),_0x40c9('0x70'),_0x40c9('0x71')],'raw':!![]});}return null;})['then'](function(_0x57a66b){if(!_0x57a66b)return null;_0x26fd80[_0x40c9('0x26')]['agent']=_0x57a66b;return _0x26fd80;})['then'](function(_0xac4e26){if(_0xac4e26){_0xac4e26['message'][_0x40c9('0x73')]=util['format'](_0x40c9('0x74'),_0x2ce3cc[_0x40c9('0x5f')][_0x40c9('0x38')]);_0xac4e26['message'][_0x40c9('0x75')]=_0x26fd80[_0x40c9('0x75')];_0xac4e26[_0x40c9('0x26')][_0x40c9('0x76')]=_0x26fd80[_0x40c9('0x75')];_0xac4e26[_0x40c9('0x26')][_0x40c9('0x77')]=_0x40c9('0x31');respondWithRpcPromise(_0x40c9('0x78'),_0x40c9('0x78'),{'event':_0x40c9('0x7f'),'message':_0xac4e26[_0x40c9('0x26')]},client9002);return _0x26fd80;}return null;})[_0x40c9('0x34')](respondWithResult(_0x5f500d,null))[_0x40c9('0x51')](handleError(_0x5f500d,null));};exports[_0x40c9('0x29')]=function(_0x167a3c,_0xa4a70a,_0x3d21ac){if(_0x167a3c[_0x40c9('0x55')]['id']){delete _0x167a3c[_0x40c9('0x55')]['id'];}var _0x29b1aa;return db[_0x40c9('0x3a')]['find']({'where':{'id':_0x167a3c['params']['id']}})[_0x40c9('0x34')](handleEntityNotFound(_0xa4a70a,null))[_0x40c9('0x34')](function(_0x45f6fd){if(_0x45f6fd){_0x29b1aa=_0x45f6fd;return db['WhatsappAccount'][_0x40c9('0x56')]({'where':{'id':_0x45f6fd[_0x40c9('0x80')]}});}})[_0x40c9('0x34')](handleEntityNotFound(_0xa4a70a,null))[_0x40c9('0x34')](function(_0x363808){if(_0x363808){logger[_0x40c9('0x22')](_0x40c9('0x81'),_0x40c9('0x29'),'received\x20delivery\x20report\x20from',_0x363808[_0x40c9('0x82')],util[_0x40c9('0x83')](_0x167a3c[_0x40c9('0x55')],{'showHidden':![],'depth':null}));switch(_0x363808[_0x40c9('0x82')]){case _0x40c9('0x84'):if(_0x167a3c[_0x40c9('0x55')]['MessageSid']&&_0x167a3c[_0x40c9('0x55')]['MessageSid']===_0x29b1aa['messageId']&&_0x167a3c[_0x40c9('0x55')]['MessageStatus']&&_0x167a3c[_0x40c9('0x55')][_0x40c9('0x85')]===_0x40c9('0x86')){return _0x29b1aa['update']({'read':!![]});}else{logger[_0x40c9('0x24')](_0x40c9('0x87'),_0x40c9('0x29'),_0x40c9('0x84'),util[_0x40c9('0x83')](_0x167a3c[_0x40c9('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x29b1aa;}})[_0x40c9('0x34')](respondWithResult(_0xa4a70a,null))['catch'](handleError(_0xa4a70a,null));}; \ No newline at end of file +var _0xa74c=['WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','whatsapp-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','RejectMessage','rejectMessage','sequelize','email','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','http','client','then','info','debug'];(function(_0x1d5d3f,_0x3a9d08){var _0x6f9221=function(_0x1e9b5d){while(--_0x1e9b5d){_0x1d5d3f['push'](_0x1d5d3f['shift']());}};_0x6f9221(++_0x3a9d08);}(_0xa74c,0x190));var _0xca74=function(_0x750be8,_0x266ded){_0x750be8=_0x750be8-0x0;var _0x18bed3=_0xa74c[_0x750be8];return _0x18bed3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca74('0x0'));var zipdir=require(_0xca74('0x1'));var jsonpatch=require(_0xca74('0x2'));var rp=require('request-promise');var moment=require(_0xca74('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xca74('0x4'));var path=require(_0xca74('0x5'));var sox=require(_0xca74('0x6'));var csv=require(_0xca74('0x7'));var ejs=require(_0xca74('0x8'));var fs=require('fs');var fs_extra=require(_0xca74('0x9'));var _=require(_0xca74('0xa'));var squel=require(_0xca74('0xb'));var crypto=require(_0xca74('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xca74('0xd'));var toCsv=require(_0xca74('0x7'));var querystring=require(_0xca74('0xe'));var Papa=require(_0xca74('0xf'));var Redis=require(_0xca74('0x10'));var authService=require(_0xca74('0x11'));var qs=require(_0xca74('0x12'));var as=require(_0xca74('0x13'));var hardwareService=require(_0xca74('0x14'));var logger=require(_0xca74('0x15'))(_0xca74('0x16'));var utils=require(_0xca74('0x17'));var config=require(_0xca74('0x18'));var licenseUtil=require(_0xca74('0x19'));var db=require(_0xca74('0x1a'))['db'];config[_0xca74('0x1b')]=_[_0xca74('0x1c')](config[_0xca74('0x1b')],{'host':_0xca74('0x1d'),'port':0x18eb});var socket=require(_0xca74('0x1e'))(new Redis(config[_0xca74('0x1b')]));require(_0xca74('0x1f'))['register'](socket);var jayson=require(_0xca74('0x20'));var client=jayson['client'][_0xca74('0x21')]({'port':0x232c});var client9002=jayson[_0xca74('0x22')][_0xca74('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x8dec,_0x1a5f90,_0xb2287,_0x2b9385){return new BPromise(function(_0x26de5a,_0x4a3983){var _0x6c5daa=_0x2b9385||client;return _0x6c5daa['request'](_0x8dec,_0xb2287)[_0xca74('0x23')](function(_0x4aca87){logger[_0xca74('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x1a5f90,'request\x20sent');logger[_0xca74('0x25')](_0xca74('0x26'),_0x1a5f90,_0xca74('0x27'),JSON[_0xca74('0x28')](_0x4aca87));if(_0x4aca87['error']){if(_0x4aca87[_0xca74('0x29')][_0xca74('0x2a')]===0x1f4){logger[_0xca74('0x29')](_0xca74('0x2b'),_0x1a5f90,_0x4aca87[_0xca74('0x29')][_0xca74('0x2c')]);return _0x4a3983(_0x4aca87['error'][_0xca74('0x2c')]);}logger[_0xca74('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x1a5f90,_0x4aca87['error'][_0xca74('0x2c')]);return _0x26de5a(_0x4aca87[_0xca74('0x29')][_0xca74('0x2c')]);}else{logger[_0xca74('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x1a5f90,_0xca74('0x27'));_0x26de5a(_0x4aca87[_0xca74('0x2d')][_0xca74('0x2c')]);}})['catch'](function(_0x46b413){logger[_0xca74('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x1a5f90,_0x46b413);_0x4a3983(_0x46b413);});});}function respondWithStatusCode(_0x20b91a,_0x4b2597){_0x4b2597=_0x4b2597||0xcc;return function(_0x4626a2){if(_0x4626a2){return _0x20b91a[_0xca74('0x2e')](_0x4b2597);}return _0x20b91a['status'](_0x4b2597)[_0xca74('0x2f')]();};}function respondWithResult(_0x3a62b9,_0x14fe1e){_0x14fe1e=_0x14fe1e||0xc8;return function(_0x53832d){if(_0x53832d){return _0x3a62b9[_0xca74('0x30')](_0x14fe1e)[_0xca74('0x31')](_0x53832d);}};}function respondWithFilteredResult(_0x48b7d1,_0x11077d){return function(_0x560638){if(_0x560638){var _0x61abc2=typeof _0x11077d[_0xca74('0x32')]===_0xca74('0x33')&&typeof _0x11077d[_0xca74('0x34')]==='undefined';var _0x2c67eb=_0x560638[_0xca74('0x35')];var _0x59b323=_0x61abc2?0x0:_0x11077d[_0xca74('0x32')];var _0x284528=_0x61abc2?_0x560638[_0xca74('0x35')]:_0x11077d[_0xca74('0x32')]+_0x11077d[_0xca74('0x34')];var _0x29d22e;if(_0x284528>=_0x2c67eb){_0x284528=_0x2c67eb;_0x29d22e=0xc8;}else{_0x29d22e=0xce;}_0x48b7d1[_0xca74('0x30')](_0x29d22e);return _0x48b7d1[_0xca74('0x36')](_0xca74('0x37'),_0x59b323+'-'+_0x284528+'/'+_0x2c67eb)[_0xca74('0x31')](_0x560638);}return null;};}function patchUpdates(_0x33b9dc){return function(_0x4f8e69){try{jsonpatch[_0xca74('0x38')](_0x4f8e69,_0x33b9dc,!![]);}catch(_0x4174e7){return BPromise[_0xca74('0x39')](_0x4174e7);}return _0x4f8e69[_0xca74('0x3a')]();};}function saveUpdates(_0x5718ba,_0x4c1466){return function(_0xf72f22){if(_0xf72f22){return _0xf72f22[_0xca74('0x3b')](_0x5718ba)[_0xca74('0x23')](function(_0x4f53ab){return _0x4f53ab;});}return null;};}function removeEntity(_0x132061,_0x2896a7){return function(_0x5334da){if(_0x5334da){return _0x5334da['destroy']()[_0xca74('0x23')](function(){_0x132061[_0xca74('0x30')](0xcc)[_0xca74('0x2f')]();});}};}function handleEntityNotFound(_0x205196,_0x1f8114){return function(_0x410625){if(!_0x410625){_0x205196[_0xca74('0x2e')](0x194);}return _0x410625;};}function handleError(_0x3a5bce,_0x36fe62){_0x36fe62=_0x36fe62||0x1f4;return function(_0x41adeb){logger[_0xca74('0x29')](_0x41adeb[_0xca74('0x3c')]);if(_0x41adeb[_0xca74('0x3d')]){delete _0x41adeb['name'];}_0x3a5bce[_0xca74('0x30')](_0x36fe62)[_0xca74('0x3e')](_0x41adeb);};}exports[_0xca74('0x3f')]=function(_0x550d9c,_0x3c1b28){var _0x33b364={},_0x142b00={},_0x2cb698={'count':0x0,'rows':[]};var _0x5ee050=_[_0xca74('0x40')](db[_0xca74('0x41')][_0xca74('0x42')],function(_0x235122){return{'name':_0x235122[_0xca74('0x43')],'type':_0x235122[_0xca74('0x44')][_0xca74('0x45')]};});_0x142b00['model']=_['map'](_0x5ee050,_0xca74('0x3d'));_0x142b00[_0xca74('0x46')]=_[_0xca74('0x47')](_0x550d9c[_0xca74('0x46')]);_0x142b00[_0xca74('0x48')]=_[_0xca74('0x49')](_0x142b00[_0xca74('0x4a')],_0x142b00[_0xca74('0x46')]);_0x33b364['attributes']=_[_0xca74('0x49')](_0x142b00['model'],qs['fields'](_0x550d9c['query'][_0xca74('0x4b')]));_0x33b364[_0xca74('0x4c')]=_0x33b364['attributes'][_0xca74('0x4d')]?_0x33b364[_0xca74('0x4c')]:_0x142b00[_0xca74('0x4a')];if(!_0x550d9c[_0xca74('0x46')][_0xca74('0x4e')]('nolimit')){_0x33b364[_0xca74('0x34')]=qs[_0xca74('0x34')](_0x550d9c[_0xca74('0x46')][_0xca74('0x34')]);_0x33b364['offset']=qs[_0xca74('0x32')](_0x550d9c['query'][_0xca74('0x32')]);}_0x33b364[_0xca74('0x4f')]=qs['sort'](_0x550d9c['query'][_0xca74('0x50')]);_0x33b364[_0xca74('0x51')]=qs['filters'](_[_0xca74('0x52')](_0x550d9c[_0xca74('0x46')],_0x142b00[_0xca74('0x48')]),_0x5ee050);if(_0x550d9c[_0xca74('0x46')][_0xca74('0x53')]){_0x33b364[_0xca74('0x51')]=_['merge'](_0x33b364[_0xca74('0x51')],{'$or':_[_0xca74('0x40')](_0x5ee050,function(_0x275141){if(_0x275141[_0xca74('0x44')]!==_0xca74('0x54')){var _0x229034={};_0x229034[_0x275141[_0xca74('0x3d')]]={'$like':'%'+_0x550d9c[_0xca74('0x46')]['filter']+'%'};return _0x229034;}})});}_0x33b364=_[_0xca74('0x55')]({},_0x33b364,_0x550d9c[_0xca74('0x56')]);var _0x503a80={'where':_0x33b364['where']};return db[_0xca74('0x41')][_0xca74('0x35')](_0x503a80)[_0xca74('0x23')](function(_0x2b72eb){_0x2cb698['count']=_0x2b72eb;if(_0x550d9c[_0xca74('0x46')][_0xca74('0x57')]){_0x33b364[_0xca74('0x58')]=[{'all':!![]}];}return db[_0xca74('0x41')][_0xca74('0x59')](_0x33b364);})[_0xca74('0x23')](function(_0x5780e2){_0x2cb698[_0xca74('0x5a')]=_0x5780e2;return _0x2cb698;})[_0xca74('0x23')](respondWithFilteredResult(_0x3c1b28,_0x33b364))['catch'](handleError(_0x3c1b28,null));};exports[_0xca74('0x5b')]=function(_0x2fcd5d,_0x2ff46e){var _0x1254d2={'raw':!![],'where':{'id':_0x2fcd5d[_0xca74('0x5c')]['id']}},_0x137c41={};_0x137c41[_0xca74('0x4a')]=_[_0xca74('0x47')](db[_0xca74('0x41')][_0xca74('0x42')]);_0x137c41[_0xca74('0x46')]=_['keys'](_0x2fcd5d[_0xca74('0x46')]);_0x137c41[_0xca74('0x48')]=_[_0xca74('0x49')](_0x137c41[_0xca74('0x4a')],_0x137c41[_0xca74('0x46')]);_0x1254d2[_0xca74('0x4c')]=_[_0xca74('0x49')](_0x137c41[_0xca74('0x4a')],qs[_0xca74('0x4b')](_0x2fcd5d['query'][_0xca74('0x4b')]));_0x1254d2[_0xca74('0x4c')]=_0x1254d2['attributes']['length']?_0x1254d2[_0xca74('0x4c')]:_0x137c41['model'];if(_0x2fcd5d[_0xca74('0x46')][_0xca74('0x57')]){_0x1254d2[_0xca74('0x58')]=[{'all':!![]}];}_0x1254d2=_[_0xca74('0x55')]({},_0x1254d2,_0x2fcd5d[_0xca74('0x56')]);return db['WhatsappMessage'][_0xca74('0x5d')](_0x1254d2)['then'](handleEntityNotFound(_0x2ff46e,null))[_0xca74('0x23')](respondWithResult(_0x2ff46e,null))[_0xca74('0x5e')](handleError(_0x2ff46e,null));};exports[_0xca74('0x5f')]=function(_0x2a3887,_0x3ab533){return db['WhatsappMessage'][_0xca74('0x5f')](_0x2a3887[_0xca74('0x60')],{})[_0xca74('0x23')](respondWithResult(_0x3ab533,0xc9))[_0xca74('0x5e')](handleError(_0x3ab533,null));};exports['update']=function(_0x5ec99d,_0x1f9ad7){if(_0x5ec99d[_0xca74('0x60')]['id']){delete _0x5ec99d[_0xca74('0x60')]['id'];}return db[_0xca74('0x41')]['find']({'where':{'id':_0x5ec99d['params']['id']}})[_0xca74('0x23')](handleEntityNotFound(_0x1f9ad7,null))['then'](saveUpdates(_0x5ec99d[_0xca74('0x60')],null))['then'](respondWithResult(_0x1f9ad7,null))['catch'](handleError(_0x1f9ad7,null));};exports[_0xca74('0x61')]=function(_0x5d2ffc,_0x1790ad){return db[_0xca74('0x41')][_0xca74('0x5d')]({'where':{'id':_0x5d2ffc[_0xca74('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1790ad,null))[_0xca74('0x23')](removeEntity(_0x1790ad,null))[_0xca74('0x5e')](handleError(_0x1790ad,null));};exports[_0xca74('0x62')]=function(_0x545655,_0x113146){return db[_0xca74('0x41')][_0xca74('0x62')]()['then'](respondWithResult(_0x113146,null))[_0xca74('0x5e')](handleError(_0x113146,null));};var interaction_log=require(_0xca74('0x15'))(_0xca74('0x63'));exports[_0xca74('0x64')]=function(_0x38e478,_0x48e17d,_0x471fcc){var _0x3d1150={'agent':{},'channel':'whatsapp'};if(_0x38e478[_0xca74('0x60')]['id']){delete _0x38e478[_0xca74('0x60')]['id'];}_0x38e478[_0xca74('0x60')][_0xca74('0x65')]=!![];_0x38e478[_0xca74('0x60')]['readAt']=moment()[_0xca74('0x66')](_0xca74('0x67'));_0x38e478[_0xca74('0x60')][_0xca74('0x68')]=_0x38e478[_0xca74('0x60')]['UserId']||_0x38e478[_0xca74('0x69')]['id'];_0x3d1150[_0xca74('0x6a')]['id']=_0x38e478[_0xca74('0x60')][_0xca74('0x68')];return db[_0xca74('0x41')]['find']({'where':{'id':_0x38e478[_0xca74('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x48e17d,null))[_0xca74('0x23')](saveUpdates(_0x38e478[_0xca74('0x60')],null))[_0xca74('0x23')](function(_0x4c7d57){if(_0x4c7d57){_0x3d1150[_0xca74('0x2c')]=_0x4c7d57[_0xca74('0x6b')]({'plain':!![]});return db[_0xca74('0x6c')][_0xca74('0x5d')]({'where':{'id':_0x4c7d57[_0xca74('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x48e17d,null))['then'](function(_0x519ba6){if(_0x519ba6){return _0x519ba6[_0xca74('0x3b')]({'UserId':_0x38e478[_0xca74('0x60')][_0xca74('0x68')],'read1stAt':_[_0xca74('0x6e')](_0x519ba6['read1stAt'])?moment()[_0xca74('0x66')](_0xca74('0x67')):undefined});}return null;})['then'](function(_0x22e855){if(_0x22e855){_0x3d1150['interaction']=_0x22e855[_0xca74('0x6b')]({'plain':!![]});interaction_log[_0xca74('0x24')](_0xca74('0x6f'),_0x38e478[_0xca74('0x69')]['id'],_0x38e478[_0xca74('0x69')][_0xca74('0x3d')],_0x38e478[_0xca74('0x69')]['role'],_0x3d1150['interaction']['id'],_0x38e478[_0xca74('0x60')]?JSON[_0xca74('0x28')](_0x38e478[_0xca74('0x60')]):_0xca74('0x70'));return respondWithRpcPromise('AcceptMessage',_0xca74('0x71'),_0x3d1150);}return null;})['then'](function(_0xd8695f){var _0x5904cc=_0xca74('0x72')+_0xd8695f[_0xca74('0x2c')][_0xca74('0x73')];return db['sequelize'][_0xca74('0x46')](_0x5904cc,{'type':db[_0xca74('0x74')][_0xca74('0x75')][_0xca74('0x76')],'raw':!![]})[_0xca74('0x23')](function(_0x220861){return _0x220861;});})['then'](function(_0x26d6e8){if(_0x26d6e8){_0x3d1150[_0xca74('0x2c')][_0xca74('0x77')]=_0x26d6e8[0x0];if(!_0x38e478[_0xca74('0x60')][_0xca74('0x68')])return;return db['User']['find']({'where':{'id':_0x38e478[_0xca74('0x60')]['UserId'],'role':_0xca74('0x6a')},'attributes':['id',_0xca74('0x3d'),_0xca74('0x78'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x4c3f7d){if(!_0x4c3f7d)return null;_0x3d1150['message'][_0xca74('0x6a')]=_0x4c3f7d;return _0x3d1150;})[_0xca74('0x23')](function(_0x31c092){if(_0x31c092){if(_0x38e478['body'][_0xca74('0x79')]){_0x3d1150[_0xca74('0x2c')][_0xca74('0x7a')]=util[_0xca74('0x66')](_0xca74('0x7b'),_0x38e478[_0xca74('0x69')]['name']);_0x3d1150[_0xca74('0x2c')][_0xca74('0x7c')]=_0x3d1150[_0xca74('0x7c')];_0x3d1150[_0xca74('0x2c')][_0xca74('0x7d')]=_0x3d1150[_0xca74('0x7c')];_0x3d1150[_0xca74('0x2c')][_0xca74('0x7e')]='accept';return respondWithRpcPromise(_0xca74('0x7f'),_0xca74('0x7f'),{'event':_0xca74('0x80'),'message':_0x3d1150['message']},client9002)[_0xca74('0x23')](function(){return _0x3d1150;});}return _0x3d1150;}return null;})[_0xca74('0x23')](respondWithResult(_0x48e17d,null))[_0xca74('0x5e')](handleError(_0x48e17d,null));};var interaction_log=require(_0xca74('0x15'))('whatsapp-interactions');exports[_0xca74('0x39')]=function(_0x49567a,_0x132a34,_0x473e98){var _0x5411f7={'agent':{},'channel':'whatsapp'};if(_0x49567a['body']['id']){delete _0x49567a[_0xca74('0x60')]['id'];}_0x49567a[_0xca74('0x60')]['UserId']=_0x49567a[_0xca74('0x60')][_0xca74('0x68')]||_0x49567a[_0xca74('0x69')]['id'];_0x5411f7[_0xca74('0x6a')]['id']=_0x49567a[_0xca74('0x60')][_0xca74('0x68')];return db[_0xca74('0x41')][_0xca74('0x5d')]({'where':{'id':_0x49567a[_0xca74('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x132a34,null))[_0xca74('0x23')](function(_0x486eba){if(_0x486eba){_0x5411f7[_0xca74('0x2c')]=_0x486eba[_0xca74('0x6b')]({'plain':!![]});return db['WhatsappInteraction'][_0xca74('0x5d')]({'where':{'id':_0x486eba[_0xca74('0x6d')]}});}return null;})[_0xca74('0x23')](handleEntityNotFound(_0x132a34,null))[_0xca74('0x23')](function(_0x2dcfcd){if(_0x2dcfcd){_0x5411f7['interaction']=_0x2dcfcd[_0xca74('0x6b')]({'plain':!![]});interaction_log[_0xca74('0x24')](_0xca74('0x81'),_0x49567a['user']['id'],_0x49567a[_0xca74('0x69')][_0xca74('0x3d')],_0x49567a[_0xca74('0x69')][_0xca74('0x82')],_0x5411f7[_0xca74('0x83')]['id'],_0x49567a[_0xca74('0x60')]?JSON[_0xca74('0x28')](_0x49567a[_0xca74('0x60')]):_0xca74('0x70'));return respondWithRpcPromise(_0xca74('0x84'),_0xca74('0x85'),_0x5411f7);}return null;})['then'](function(_0x3e11aa){var _0x5284a9=_0xca74('0x72')+_0x3e11aa[_0xca74('0x2c')][_0xca74('0x73')];return db[_0xca74('0x86')][_0xca74('0x46')](_0x5284a9,{'type':db[_0xca74('0x74')][_0xca74('0x75')]['SELECT'],'raw':!![]})[_0xca74('0x23')](function(_0x462422){return _0x462422;});})[_0xca74('0x23')](function(_0x5b998e){if(_0x5b998e){_0x5411f7[_0xca74('0x2c')][_0xca74('0x77')]=_0x5b998e[0x0];if(!_0x49567a[_0xca74('0x60')][_0xca74('0x68')])return;return db['User'][_0xca74('0x5d')]({'where':{'id':_0x49567a[_0xca74('0x60')][_0xca74('0x68')],'role':_0xca74('0x6a')},'attributes':['id',_0xca74('0x3d'),'fullname',_0xca74('0x87'),'internal'],'raw':!![]});}return null;})['then'](function(_0x51e00a){if(!_0x51e00a)return null;_0x5411f7[_0xca74('0x2c')][_0xca74('0x6a')]=_0x51e00a;return _0x5411f7;})[_0xca74('0x23')](function(_0x31911b){if(_0x31911b){_0x31911b[_0xca74('0x2c')][_0xca74('0x7a')]=util[_0xca74('0x66')]('SIP/%s',_0x49567a['user'][_0xca74('0x3d')]);_0x31911b[_0xca74('0x2c')][_0xca74('0x7c')]=_0x5411f7[_0xca74('0x7c')];_0x31911b[_0xca74('0x2c')]['motionChannel']=_0x5411f7['channel'];_0x31911b[_0xca74('0x2c')][_0xca74('0x7e')]=_0xca74('0x39');respondWithRpcPromise(_0xca74('0x7f'),'EventManager',{'event':_0xca74('0x88'),'message':_0x31911b['message']},client9002);return _0x5411f7;}return null;})[_0xca74('0x23')](respondWithResult(_0x132a34,null))[_0xca74('0x5e')](handleError(_0x132a34,null));};exports[_0xca74('0x30')]=function(_0x2cf1a0,_0x9b60a2,_0x176bfd){if(_0x2cf1a0[_0xca74('0x60')]['id']){delete _0x2cf1a0[_0xca74('0x60')]['id'];}var _0x4a8d5e;return db['WhatsappMessage'][_0xca74('0x5d')]({'where':{'id':_0x2cf1a0[_0xca74('0x5c')]['id']}})[_0xca74('0x23')](handleEntityNotFound(_0x9b60a2,null))[_0xca74('0x23')](function(_0x37f370){if(_0x37f370){_0x4a8d5e=_0x37f370;return db[_0xca74('0x89')][_0xca74('0x5d')]({'where':{'id':_0x37f370[_0xca74('0x8a')]}});}})['then'](handleEntityNotFound(_0x9b60a2,null))[_0xca74('0x23')](function(_0xb5bb65){if(_0xb5bb65){logger[_0xca74('0x25')](_0xca74('0x8b'),_0xca74('0x30'),_0xca74('0x8c'),_0xb5bb65[_0xca74('0x44')],util[_0xca74('0x8d')](_0x2cf1a0['body'],{'showHidden':![],'depth':null}));switch(_0xb5bb65['type']){case _0xca74('0x8e'):if(_0x2cf1a0[_0xca74('0x60')][_0xca74('0x8f')]&&_0x2cf1a0[_0xca74('0x60')]['MessageSid']===_0x4a8d5e[_0xca74('0x90')]&&_0x2cf1a0[_0xca74('0x60')]['MessageStatus']&&_0x2cf1a0[_0xca74('0x60')][_0xca74('0x91')]===_0xca74('0x65')){return _0x4a8d5e[_0xca74('0x3b')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xca74('0x30'),_0xca74('0x8e'),util['inspect'](_0x2cf1a0[_0xca74('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x4a8d5e;}})[_0xca74('0x23')](respondWithResult(_0x9b60a2,null))[_0xca74('0x5e')](handleError(_0x9b60a2,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 488ec79..3524fb8 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 _0x4b0f=['exports','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x418c3a,_0xafc508){_0x418c3a=_0x418c3a-0x0;var _0x5ebf73=_0x4b0f[_0x418c3a];return _0x5ebf73;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xf4b0('0x0'))['db'][_0xf4b0('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf4b0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf4b0('0x3'),'afterDestroy':_0xf4b0('0x4')};function emitEvent(_0x141c87){return function(_0x28be5f,_0x2a08dc,_0x354cb3){WhatsappMessageEvents[_0xf4b0('0x5')](_0x141c87+':'+_0x28be5f['id'],_0x28be5f);WhatsappMessageEvents[_0xf4b0('0x5')](_0x141c87,_0x28be5f);_0x354cb3(null);};}for(var e in events){if(events[_0xf4b0('0x6')](e)){var event=events[e];WhatsappMessage[_0xf4b0('0x7')](e,emitEvent(event));}}module[_0xf4b0('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0x3c81=['hook','exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x4bb691,_0x37679a){var _0x588b53=function(_0x2c802d){while(--_0x2c802d){_0x4bb691['push'](_0x4bb691['shift']());}};_0x588b53(++_0x37679a);}(_0x3c81,0x102));var _0x13c8=function(_0x5ee313,_0x1c6ff0){_0x5ee313=_0x5ee313-0x0;var _0x24cdd9=_0x3c81[_0x5ee313];return _0x24cdd9;};'use strict';var EventEmitter=require(_0x13c8('0x0'));var WhatsappMessage=require(_0x13c8('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x13c8('0x2')](0x0);var events={'afterCreate':_0x13c8('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c3ba4){return function(_0x548599,_0x101d4f,_0x3ec886){WhatsappMessageEvents[_0x13c8('0x4')](_0x5c3ba4+':'+_0x548599['id'],_0x548599);WhatsappMessageEvents[_0x13c8('0x4')](_0x5c3ba4,_0x548599);_0x3ec886(null);};}for(var e in events){if(events[_0x13c8('0x5')](e)){var event=events[e];WhatsappMessage[_0x13c8('0x6')](e,emitEvent(event));}}module[_0x13c8('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 0f7547e..ca47d7e 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 _0x2f78=['catch','error','out','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','secret','UserId','findOne','WhatsappInteractionId','then','update','createdAt'];(function(_0x41010e,_0x25e9c5){var _0x59e342=function(_0x37d547){while(--_0x37d547){_0x41010e['push'](_0x41010e['shift']());}};_0x59e342(++_0x25e9c5);}(_0x2f78,0x19f));var _0x82f7=function(_0x4d3d58,_0xa122fe){_0x4d3d58=_0x4d3d58-0x0;var _0xcc3d3c=_0x2f78[_0x4d3d58];return _0xcc3d3c;};'use strict';var _=require(_0x82f7('0x0'));var util=require('util');var logger=require(_0x82f7('0x1'))('api');var moment=require(_0x82f7('0x2'));var BPromise=require(_0x82f7('0x3'));var rp=require(_0x82f7('0x4'));var fs=require('fs');var path=require(_0x82f7('0x5'));var rimraf=require(_0x82f7('0x6'));var config=require(_0x82f7('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0x82f7('0x8')]=function(_0x2887ba,_0xcae3f2){return _0x2887ba[_0x82f7('0x9')](_0x82f7('0xa'),attributes,{'tableName':_0x82f7('0xb'),'paranoid':![],'indexes':[{'name':_0x82f7('0xc'),'fields':[_0x82f7('0xc')]},{'name':_0x82f7('0xd'),'fields':[_0x82f7('0xe')],'type':_0x82f7('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x476420,_0x2e8d29,_0x318020){var _0x44745c=_0x2887ba[_0x82f7('0x10')];var _0xeb84eb=_0x476420['get']({'plain':!![]});if(_0xeb84eb[_0x82f7('0x11')]['toLowerCase']()==='in'||_0xeb84eb[_0x82f7('0x11')][_0x82f7('0x12')]()==='out'&&!_0xeb84eb[_0x82f7('0x13')]&&!_['isNil'](_0xeb84eb[_0x82f7('0x14')])){_0x44745c['WhatsappInteraction'][_0x82f7('0x15')]({'where':{'id':_0xeb84eb[_0x82f7('0x16')]}})[_0x82f7('0x17')](function(_0x5a37de){if(_0x5a37de){_0x5a37de[_0x82f7('0x18')]({'lastMsgAt':_0xeb84eb[_0x82f7('0x19')],'lastMsgDirection':_0xeb84eb[_0x82f7('0x11')][_0x82f7('0x12')]()});}})[_0x82f7('0x1a')](function(_0x11539b){console[_0x82f7('0x1b')](_0x11539b);});}if(_0xeb84eb[_0x82f7('0x11')]===_0x82f7('0x1c')&&!_0xeb84eb[_0x82f7('0x13')]){var _0x2cc643;_0x44745c[_0x82f7('0x1d')][_0x82f7('0x1e')]({'where':{'id':_0xeb84eb['WhatsappAccountId']},'raw':!![]})['then'](function(_0x30af30){_0x2cc643=_0x30af30;if(_0x2cc643&&_0x2cc643[_0x82f7('0x1f')]){switch(_0x2cc643['type']){case _0x82f7('0x20'):var _0x1fa904=require(_0x82f7('0x20'));if(_0x2cc643[_0x82f7('0x21')]&&_0x2cc643[_0x82f7('0x22')]&&_0x2cc643[_0x82f7('0x23')]){var _0x2c51ad=new _0x1fa904(_0x2cc643[_0x82f7('0x21')],_0x2cc643[_0x82f7('0x22')]);_0x2c51ad[_0x82f7('0x24')][_0x82f7('0x25')]({'body':_0xeb84eb[_0x82f7('0xe')],'to':_0x82f7('0x26')+_0xeb84eb['phone'],'from':_0x82f7('0x26')+_0x2cc643[_0x82f7('0x23')],'statusCallback':_0x2cc643[_0x82f7('0x27')]+_0x82f7('0x28')+_0xeb84eb['id']+_0x82f7('0x29')+_0x2cc643[_0x82f7('0x2a')]})[_0x82f7('0x17')](function(_0x100ef1){if(_0x100ef1[_0x82f7('0x2b')]){return _0x476420[_0x82f7('0x18')]({'messageId':_0x100ef1['sid']});}})[_0x82f7('0x1a')](function(_0x4b24ed){logger[_0x82f7('0x1b')](_0x82f7('0x2c'),'afterCreate',_0x82f7('0x20'),util[_0x82f7('0x2d')](_0x4b24ed,{'showHidden':![],'depth':null}));});}else{logger[_0x82f7('0x1b')](_0x82f7('0x2c'),_0x82f7('0x2e'),_0x82f7('0x20'),_0x82f7('0x2f'));}break;}}})['finally'](function(){_0x318020();});}else{_0x318020();}}},'charset':_0x82f7('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xedb4=['models','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0xedb4,0x156));var _0x4edb=function(_0x119629,_0x246787){_0x119629=_0x119629-0x0;var _0x49a771=_0xedb4[_0x119629];return _0x49a771;};'use strict';var _=require('lodash');var util=require(_0x4edb('0x0'));var logger=require(_0x4edb('0x1'))(_0x4edb('0x2'));var moment=require(_0x4edb('0x3'));var BPromise=require(_0x4edb('0x4'));var rp=require(_0x4edb('0x5'));var fs=require('fs');var path=require(_0x4edb('0x6'));var rimraf=require(_0x4edb('0x7'));var config=require(_0x4edb('0x8'));var attributes=require(_0x4edb('0x9'));module['exports']=function(_0x469d30,_0xe7762c){return _0x469d30['define'](_0x4edb('0xa'),attributes,{'tableName':_0x4edb('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x4edb('0xc')]},{'name':_0x4edb('0xd'),'fields':['body'],'type':_0x4edb('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7b717f,_0x86d377,_0x9938d6){var _0xf4fb7c=_0x469d30[_0x4edb('0xf')];var _0x484121=_0x7b717f[_0x4edb('0x10')]({'plain':!![]});if(_0x484121[_0x4edb('0x11')][_0x4edb('0x12')]()==='in'||_0x484121['direction'][_0x4edb('0x12')]()===_0x4edb('0x13')&&!_0x484121[_0x4edb('0x14')]&&!_['isNil'](_0x484121[_0x4edb('0x15')])){_0xf4fb7c[_0x4edb('0x16')]['findOne']({'where':{'id':_0x484121[_0x4edb('0x17')]}})[_0x4edb('0x18')](function(_0x4fd24f){if(_0x4fd24f){_0x4fd24f[_0x4edb('0x19')]({'lastMsgAt':_0x484121[_0x4edb('0x1a')],'lastMsgDirection':_0x484121[_0x4edb('0x11')][_0x4edb('0x12')]()});}})[_0x4edb('0x1b')](function(_0x5441f1){console[_0x4edb('0x1c')](_0x5441f1);});}if(_0x484121['direction']===_0x4edb('0x13')&&!_0x484121['secret']){var _0x467f21;_0xf4fb7c[_0x4edb('0x1d')][_0x4edb('0x1e')]({'where':{'id':_0x484121[_0x4edb('0x1f')]},'raw':!![]})['then'](function(_0x2fea15){_0x467f21=_0x2fea15;if(_0x467f21&&_0x467f21[_0x4edb('0x20')]){switch(_0x467f21['type']){case _0x4edb('0x21'):var _0x5ab6c9=require('twilio');if(_0x467f21[_0x4edb('0x22')]&&_0x467f21[_0x4edb('0x23')]&&_0x467f21[_0x4edb('0x24')]){var _0x14a4ec=new _0x5ab6c9(_0x467f21[_0x4edb('0x22')],_0x467f21[_0x4edb('0x23')]);_0x14a4ec[_0x4edb('0x25')][_0x4edb('0x26')]({'body':_0x484121[_0x4edb('0x27')],'to':_0x4edb('0x28')+_0x484121[_0x4edb('0x24')],'from':_0x4edb('0x28')+_0x467f21['phone'],'statusCallback':_0x467f21[_0x4edb('0x29')]+_0x4edb('0x2a')+_0x484121['id']+_0x4edb('0x2b')+_0x467f21[_0x4edb('0x2c')]})['then'](function(_0x3bb0){if(_0x3bb0[_0x4edb('0x2d')]){return _0x7b717f['update']({'messageId':_0x3bb0[_0x4edb('0x2d')]});}})[_0x4edb('0x1b')](function(_0x340786){logger[_0x4edb('0x1c')](_0x4edb('0x2e'),_0x4edb('0x2f'),'twilio',util[_0x4edb('0x30')](_0x340786,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4edb('0x2e'),_0x4edb('0x2f'),_0x4edb('0x21'),_0x4edb('0x31'));}break;}}})['finally'](function(){_0x9938d6();});}else{_0x9938d6();}}},'charset':'utf8mb4','collate':_0x4edb('0x32')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index f2b93aa..f054ea0 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 _0xca13=['info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then'];(function(_0x267692,_0x229aaa){var _0x209905=function(_0x252e4c){while(--_0x252e4c){_0x267692['push'](_0x267692['shift']());}};_0x209905(++_0x229aaa);}(_0xca13,0x1af));var _0x3ca1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xca13[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ca1('0x0'));var BPromise=require(_0x3ca1('0x1'));var rs=require(_0x3ca1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ca1('0x3'))['db'];var utils=require(_0x3ca1('0x4'));var logger=require('../../config/logger')(_0x3ca1('0x5'));var config=require(_0x3ca1('0x6'));var jayson=require(_0x3ca1('0x7'));var client=jayson['client'][_0x3ca1('0x8')]({'port':0x232a});config[_0x3ca1('0x9')]=_[_0x3ca1('0xa')](config[_0x3ca1('0x9')],{'host':_0x3ca1('0xb'),'port':0x18eb});var socket=require(_0x3ca1('0xc'))(new Redis(config[_0x3ca1('0x9')]));require(_0x3ca1('0xd'))[_0x3ca1('0xe')](socket);function respondWithRpcPromise(_0x40f9ae,_0x2bdd2a,_0x3e868d){return new BPromise(function(_0x19d6b3,_0x45a199){return client[_0x3ca1('0xf')](_0x40f9ae,_0x3e868d)[_0x3ca1('0x10')](function(_0x5bfc3a){logger[_0x3ca1('0x11')](_0x3ca1('0x12'),_0x2bdd2a,'request\x20sent');logger[_0x3ca1('0x13')](_0x3ca1('0x14'),_0x2bdd2a,_0x3ca1('0x15'),JSON[_0x3ca1('0x16')](_0x5bfc3a));if(_0x5bfc3a[_0x3ca1('0x17')]){if(_0x5bfc3a[_0x3ca1('0x17')][_0x3ca1('0x18')]===0x1f4){logger[_0x3ca1('0x17')](_0x3ca1('0x12'),_0x2bdd2a,_0x5bfc3a[_0x3ca1('0x17')][_0x3ca1('0x19')]);return _0x45a199(_0x5bfc3a[_0x3ca1('0x17')][_0x3ca1('0x19')]);}logger[_0x3ca1('0x17')](_0x3ca1('0x12'),_0x2bdd2a,_0x5bfc3a[_0x3ca1('0x17')][_0x3ca1('0x19')]);return _0x19d6b3(_0x5bfc3a[_0x3ca1('0x17')][_0x3ca1('0x19')]);}else{logger['info'](_0x3ca1('0x12'),_0x2bdd2a,_0x3ca1('0x15'));_0x19d6b3(_0x5bfc3a['result'][_0x3ca1('0x19')]);}})[_0x3ca1('0x1a')](function(_0x487559){logger[_0x3ca1('0x17')](_0x3ca1('0x12'),_0x2bdd2a,_0x487559);_0x45a199(_0x487559);});});}exports[_0x3ca1('0x1b')]=function(_0x3bac23){var _0x498eb6=this;return new Promise(function(_0x23e433,_0x2e5e80){return db[_0x3ca1('0x1c')][_0x3ca1('0x1d')](_0x3bac23['body'],{'raw':_0x3bac23[_0x3ca1('0x1e')]?_0x3bac23[_0x3ca1('0x1e')][_0x3ca1('0x1f')]===undefined?!![]:![]:!![]})[_0x3ca1('0x10')](function(_0x2ef076){logger[_0x3ca1('0x11')](_0x3ca1('0x1b'),_0x3bac23);logger['debug']('CreateWhatsappMessage',_0x3bac23,JSON[_0x3ca1('0x16')](_0x2ef076));_0x23e433(_0x2ef076);})[_0x3ca1('0x1a')](function(_0x71e1b1){logger[_0x3ca1('0x17')](_0x3ca1('0x1b'),_0x71e1b1[_0x3ca1('0x19')],_0x3bac23);_0x2e5e80(_0x498eb6[_0x3ca1('0x17')](0x1f4,_0x71e1b1[_0x3ca1('0x19')]));});});}; \ No newline at end of file +var _0x272b=['stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','CreateWhatsappMessage','WhatsappMessage','options','raw','then','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','info','request\x20sent'];(function(_0x561cb5,_0x3e497b){var _0x17b657=function(_0x3390cb){while(--_0x3390cb){_0x561cb5['push'](_0x561cb5['shift']());}};_0x17b657(++_0x3e497b);}(_0x272b,0x178));var _0xb272=function(_0x395155,_0x192ffd){_0x395155=_0x395155-0x0;var _0x179767=_0x272b[_0x395155];return _0x179767;};'use strict';var _=require(_0xb272('0x0'));var util=require('util');var moment=require(_0xb272('0x1'));var BPromise=require('bluebird');var rs=require(_0xb272('0x2'));var fs=require('fs');var Redis=require(_0xb272('0x3'));var db=require(_0xb272('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb272('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb272('0x6'));var client=jayson[_0xb272('0x7')][_0xb272('0x8')]({'port':0x232a});config[_0xb272('0x9')]=_[_0xb272('0xa')](config[_0xb272('0x9')],{'host':_0xb272('0xb'),'port':0x18eb});var socket=require(_0xb272('0xc'))(new Redis(config[_0xb272('0x9')]));require('./whatsappMessage.socket')[_0xb272('0xd')](socket);function respondWithRpcPromise(_0x3bba1e,_0x54fe5c,_0x4b1d5d){return new BPromise(function(_0x257a63,_0x547e24){return client['request'](_0x3bba1e,_0x4b1d5d)['then'](function(_0x5045df){logger[_0xb272('0xe')]('WhatsappMessage,\x20%s,\x20%s',_0x54fe5c,_0xb272('0xf'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x54fe5c,_0xb272('0xf'),JSON[_0xb272('0x10')](_0x5045df));if(_0x5045df[_0xb272('0x11')]){if(_0x5045df[_0xb272('0x11')][_0xb272('0x12')]===0x1f4){logger[_0xb272('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x54fe5c,_0x5045df[_0xb272('0x11')]['message']);return _0x547e24(_0x5045df[_0xb272('0x11')][_0xb272('0x13')]);}logger['error'](_0xb272('0x14'),_0x54fe5c,_0x5045df[_0xb272('0x11')][_0xb272('0x13')]);return _0x257a63(_0x5045df[_0xb272('0x11')][_0xb272('0x13')]);}else{logger['info'](_0xb272('0x14'),_0x54fe5c,_0xb272('0xf'));_0x257a63(_0x5045df[_0xb272('0x15')][_0xb272('0x13')]);}})[_0xb272('0x16')](function(_0x26d002){logger[_0xb272('0x11')](_0xb272('0x14'),_0x54fe5c,_0x26d002);_0x547e24(_0x26d002);});});}exports[_0xb272('0x17')]=function(_0xc08855){var _0x529c37=this;return new Promise(function(_0x566c1b,_0x213ab7){return db[_0xb272('0x18')]['create'](_0xc08855['body'],{'raw':_0xc08855[_0xb272('0x19')]?_0xc08855['options'][_0xb272('0x1a')]===undefined?!![]:![]:!![]})[_0xb272('0x1b')](function(_0x5aa091){logger['info'](_0xb272('0x17'),_0xc08855);logger['debug'](_0xb272('0x17'),_0xc08855,JSON['stringify'](_0x5aa091));_0x566c1b(_0x5aa091);})[_0xb272('0x16')](function(_0x1b45c4){logger[_0xb272('0x11')]('CreateWhatsappMessage',_0x1b45c4['message'],_0xc08855);_0x213ab7(_0x529c37['error'](0x1f4,_0x1b45c4[_0xb272('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index e295351..2de5501 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 _0x0726=['remove','emit','removeListener','register','whatsappMessage:','./whatsappMessage.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0726,0x16d));var _0x6072=function(_0x4b75b1,_0x426fc4){_0x4b75b1=_0x4b75b1-0x0;var _0x2c73f6=_0x0726[_0x4b75b1];return _0x2c73f6;};'use strict';var WhatsappMessageEvents=require(_0x6072('0x0'));var events=['save',_0x6072('0x1'),'update'];function createListener(_0x48c6d7,_0x45636e){return function(_0x41e3ad){_0x45636e[_0x6072('0x2')](_0x48c6d7,_0x41e3ad);};}function removeListener(_0x2253ed,_0x55598f){return function(){WhatsappMessageEvents[_0x6072('0x3')](_0x2253ed,_0x55598f);};}exports[_0x6072('0x4')]=function(_0x3745c1){for(var _0x5bd8a1=0x0,_0x4e900f=events['length'];_0x5bd8a1<_0x4e900f;_0x5bd8a1++){var _0xcea004=events[_0x5bd8a1];var _0x5d4bf2=createListener(_0x6072('0x5')+_0xcea004,_0x3745c1);WhatsappMessageEvents['on'](_0xcea004,_0x5d4bf2);}}; \ No newline at end of file +var _0x2d70=['save','remove','update','emit','removeListener','length','whatsappMessage:','./whatsappMessage.events'];(function(_0x8af623,_0x25edaa){var _0x63f5f7=function(_0x7199ca){while(--_0x7199ca){_0x8af623['push'](_0x8af623['shift']());}};_0x63f5f7(++_0x25edaa);}(_0x2d70,0xbf));var _0x02d7=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0x2d70[_0x2605dc];return _0x4568c9;};'use strict';var WhatsappMessageEvents=require(_0x02d7('0x0'));var events=[_0x02d7('0x1'),_0x02d7('0x2'),_0x02d7('0x3')];function createListener(_0x3d1906,_0x49933b){return function(_0xbda0f0){_0x49933b[_0x02d7('0x4')](_0x3d1906,_0xbda0f0);};}function removeListener(_0x33d22b,_0x8261a0){return function(){WhatsappMessageEvents[_0x02d7('0x5')](_0x33d22b,_0x8261a0);};}exports['register']=function(_0x285ae2){for(var _0x5f87d7=0x0,_0x531257=events[_0x02d7('0x6')];_0x5f87d7<_0x531257;_0x5f87d7++){var _0x5e17a7=events[_0x5f87d7];var _0x1322fe=createListener(_0x02d7('0x7')+_0x5e17a7,_0x285ae2);WhatsappMessageEvents['on'](_0x5e17a7,_0x1322fe);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index d83b998..5c0cb21 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 _0x987e=['addAgents','put','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','describe','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams'];(function(_0x4239f7,_0x488b3d){var _0x2ffcca=function(_0x7383c6){while(--_0x7383c6){_0x4239f7['push'](_0x4239f7['shift']());}};_0x2ffcca(++_0x488b3d);}(_0x987e,0xfb));var _0xe987=function(_0x556708,_0x51aaab){_0x556708=_0x556708-0x0;var _0x5773ab=_0x987e[_0x556708];return _0x5773ab;};'use strict';var multer=require(_0xe987('0x0'));var util=require(_0xe987('0x1'));var path=require('path');var timeout=require(_0xe987('0x2'));var express=require(_0xe987('0x3'));var router=express[_0xe987('0x4')]();var fs_extra=require(_0xe987('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe987('0x6'));var controller=require(_0xe987('0x7'));router[_0xe987('0x8')]('/',auth[_0xe987('0x9')](),controller['index']);router[_0xe987('0x8')]('/describe',auth[_0xe987('0x9')](),controller[_0xe987('0xa')]);router[_0xe987('0x8')]('/:id',auth[_0xe987('0x9')](),controller['show']);router[_0xe987('0x8')](_0xe987('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xe987('0x8')](_0xe987('0xc'),auth[_0xe987('0x9')](),controller[_0xe987('0xd')]);router[_0xe987('0x8')](_0xe987('0xe'),auth[_0xe987('0x9')](),controller[_0xe987('0xf')]);router[_0xe987('0x10')]('/',auth[_0xe987('0x9')](),controller[_0xe987('0x11')]);router['post'](_0xe987('0xc'),auth['isAuthenticated'](),controller[_0xe987('0x12')]);router[_0xe987('0x10')]('/:id/users',auth[_0xe987('0x9')](),controller[_0xe987('0x13')]);router[_0xe987('0x14')]('/:id',auth[_0xe987('0x9')](),controller['update']);router[_0xe987('0x15')](_0xe987('0x16'),auth[_0xe987('0x9')](),controller[_0xe987('0x17')]);router['delete']('/:id/teams',auth[_0xe987('0x9')](),controller[_0xe987('0x18')]);router[_0xe987('0x15')]('/:id/users',auth[_0xe987('0x9')](),controller[_0xe987('0x19')]);module[_0xe987('0x1a')]=router; \ No newline at end of file +var _0x91f4=['express','fs-extra','../../components/auth/service','./whatsappQueue.controller','get','index','describe','/:id','show','isAuthenticated','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x3a8955,_0x11feed){var _0x19967d=function(_0x386547){while(--_0x386547){_0x3a8955['push'](_0x3a8955['shift']());}};_0x19967d(++_0x11feed);}(_0x91f4,0x158));var _0x491f=function(_0x4b43ae,_0x350e89){_0x4b43ae=_0x4b43ae-0x0;var _0x5b1c5b=_0x91f4[_0x4b43ae];return _0x5b1c5b;};'use strict';var multer=require(_0x491f('0x0'));var util=require(_0x491f('0x1'));var path=require(_0x491f('0x2'));var timeout=require(_0x491f('0x3'));var express=require(_0x491f('0x4'));var router=express['Router']();var fs_extra=require(_0x491f('0x5'));var auth=require(_0x491f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x491f('0x7'));router[_0x491f('0x8')]('/',auth['isAuthenticated'](),controller[_0x491f('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x491f('0xa')]);router['get'](_0x491f('0xb'),auth['isAuthenticated'](),controller[_0x491f('0xc')]);router[_0x491f('0x8')]('/:id/members',auth[_0x491f('0xd')](),controller[_0x491f('0xe')]);router['get'](_0x491f('0xf'),auth['isAuthenticated'](),controller[_0x491f('0x10')]);router['get'](_0x491f('0x11'),auth[_0x491f('0xd')](),controller[_0x491f('0x12')]);router[_0x491f('0x13')]('/',auth[_0x491f('0xd')](),controller['create']);router[_0x491f('0x13')]('/:id/teams',auth[_0x491f('0xd')](),controller[_0x491f('0x14')]);router[_0x491f('0x13')](_0x491f('0x11'),auth[_0x491f('0xd')](),controller[_0x491f('0x15')]);router[_0x491f('0x16')](_0x491f('0xb'),auth[_0x491f('0xd')](),controller[_0x491f('0x17')]);router[_0x491f('0x18')]('/:id',auth[_0x491f('0xd')](),controller[_0x491f('0x19')]);router[_0x491f('0x18')](_0x491f('0xf'),auth[_0x491f('0xd')](),controller[_0x491f('0x1a')]);router[_0x491f('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x491f('0x1b')]);module[_0x491f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 39f4ddb..4a790af 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 _0x0fc2=['STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0x0fc2,0x6e));var _0x20fc=function(_0xd6a21b,_0xbfe245){_0xd6a21b=_0xd6a21b-0x0;var _0x275d2c=_0x0fc2[_0xd6a21b];return _0x275d2c;};'use strict';var Sequelize=require(_0x20fc('0x0'));module[_0x20fc('0x1')]={'name':{'type':Sequelize[_0x20fc('0x2')],'unique':_0x20fc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x20fc('0x4')](_0x20fc('0x5'),_0x20fc('0x6'),_0x20fc('0x7'))},'description':{'type':Sequelize[_0x20fc('0x2')]}}; \ No newline at end of file +var _0x2121=['beepall','roundrobin','sequelize','exports','INTEGER','ENUM','rrmemory'];(function(_0x11ce46,_0x7a1715){var _0x272001=function(_0x38c599){while(--_0x38c599){_0x11ce46['push'](_0x11ce46['shift']());}};_0x272001(++_0x7a1715);}(_0x2121,0x1b4));var _0x1212=function(_0xcea314,_0x5b76df){_0xcea314=_0xcea314-0x0;var _0x813524=_0x2121[_0xcea314];return _0x813524;};'use strict';var Sequelize=require(_0x1212('0x0'));module[_0x1212('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x1212('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1212('0x3')](_0x1212('0x4'),_0x1212('0x5'),_0x1212('0x6'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index eda0ac4..d632cf9 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 _0x612e=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','format','%s/%s','createdAt','getTeams','addTeams','Team','Agents','flatMap','sequelize','transaction','each','forEach','emit','removeTeams','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','userWhatsappQueue:save','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','WhatsappQueues','then','error','stack','name','index','WhatsappQueue','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user'];(function(_0x5c7ffe,_0x5ddc7a){var _0x3280d6=function(_0x1910eb){while(--_0x1910eb){_0x5c7ffe['push'](_0x5c7ffe['shift']());}};_0x3280d6(++_0x5ddc7a);}(_0x612e,0x14a));var _0xe612=function(_0x56fe36,_0x2e2f28){_0x56fe36=_0x56fe36-0x0;var _0xa4badd=_0x612e[_0x56fe36];return _0xa4badd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe612('0x0'));var jsonpatch=require(_0xe612('0x1'));var rp=require(_0xe612('0x2'));var moment=require(_0xe612('0x3'));var BPromise=require(_0xe612('0x4'));var Mustache=require(_0xe612('0x5'));var util=require(_0xe612('0x6'));var path=require(_0xe612('0x7'));var sox=require('sox');var csv=require(_0xe612('0x8'));var ejs=require(_0xe612('0x9'));var fs=require('fs');var fs_extra=require(_0xe612('0xa'));var _=require(_0xe612('0xb'));var squel=require(_0xe612('0xc'));var crypto=require(_0xe612('0xd'));var jsforce=require(_0xe612('0xe'));var deskjs=require(_0xe612('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe612('0x10'));var Papa=require(_0xe612('0x11'));var Redis=require('ioredis');var authService=require(_0xe612('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe612('0x13'));var hardwareService=require(_0xe612('0x14'));var logger=require(_0xe612('0x15'))(_0xe612('0x16'));var utils=require(_0xe612('0x17'));var config=require(_0xe612('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe612('0x19')]=_[_0xe612('0x1a')](config[_0xe612('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe612('0x19')]));require(_0xe612('0x1b'))[_0xe612('0x1c')](socket);function respondWithStatusCode(_0x4aa49f,_0x43b942){_0x43b942=_0x43b942||0xcc;return function(_0x282ba3){if(_0x282ba3){return _0x4aa49f[_0xe612('0x1d')](_0x43b942);}return _0x4aa49f[_0xe612('0x1e')](_0x43b942)[_0xe612('0x1f')]();};}function respondWithResult(_0x1641f7,_0x11d473){_0x11d473=_0x11d473||0xc8;return function(_0x5f3972){if(_0x5f3972){return _0x1641f7[_0xe612('0x1e')](_0x11d473)[_0xe612('0x20')](_0x5f3972);}};}function respondWithFilteredResult(_0x16c2cb,_0x7a3915){return function(_0xa22f68){if(_0xa22f68){var _0x4340fc=typeof _0x7a3915[_0xe612('0x21')]===_0xe612('0x22')&&typeof _0x7a3915[_0xe612('0x23')]===_0xe612('0x22');var _0x26da5b=_0xa22f68[_0xe612('0x24')];var _0xa6ced3=_0x4340fc?0x0:_0x7a3915['offset'];var _0x2574c7=_0x4340fc?_0xa22f68[_0xe612('0x24')]:_0x7a3915[_0xe612('0x21')]+_0x7a3915[_0xe612('0x23')];var _0x3f4922;if(_0x2574c7>=_0x26da5b){_0x2574c7=_0x26da5b;_0x3f4922=0xc8;}else{_0x3f4922=0xce;}_0x16c2cb[_0xe612('0x1e')](_0x3f4922);return _0x16c2cb[_0xe612('0x25')](_0xe612('0x26'),_0xa6ced3+'-'+_0x2574c7+'/'+_0x26da5b)[_0xe612('0x20')](_0xa22f68);}return null;};}function patchUpdates(_0x5e5195){return function(_0x13600c){try{jsonpatch[_0xe612('0x27')](_0x13600c,_0x5e5195,!![]);}catch(_0x3b12b4){return BPromise['reject'](_0x3b12b4);}return _0x13600c[_0xe612('0x28')]();};}function saveUpdates(_0x5e49f1,_0x195f0b){return function(_0x93c596){if(_0x93c596){return _0x93c596[_0xe612('0x29')](_0x5e49f1)['then'](function(_0x4f9860){return _0x4f9860;});}return null;};}function removeEntity(_0x1cd8d7,_0x4c5694){return function(_0x1bb7b3){if(_0x1bb7b3){return _0x1bb7b3['destroy']()['then'](function(){var _0x3acfcb=_0x1bb7b3[_0xe612('0x2a')]({'plain':!![]});var _0xf50051=_0xe612('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0xf50051,'resourceId':_0x3acfcb['id']}})[_0xe612('0x2c')](function(){return _0x1bb7b3;});})[_0xe612('0x2c')](function(){_0x1cd8d7[_0xe612('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49c11e,_0x3bbccd){return function(_0x5fb819){if(!_0x5fb819){_0x49c11e[_0xe612('0x1d')](0x194);}return _0x5fb819;};}function handleError(_0x4b07c3,_0x400bf0){_0x400bf0=_0x400bf0||0x1f4;return function(_0x2e2106){logger[_0xe612('0x2d')](_0x2e2106[_0xe612('0x2e')]);if(_0x2e2106[_0xe612('0x2f')]){delete _0x2e2106[_0xe612('0x2f')];}_0x4b07c3[_0xe612('0x1e')](_0x400bf0)['send'](_0x2e2106);};}exports[_0xe612('0x30')]=function(_0x278709,_0x126611){var _0x9cad79={},_0x29c429={},_0x3117cd={'count':0x0,'rows':[]};var _0x3ca3fa=_['map'](db[_0xe612('0x31')][_0xe612('0x32')],function(_0xefadb){return{'name':_0xefadb['fieldName'],'type':_0xefadb[_0xe612('0x33')]['key']};});_0x29c429['model']=_['map'](_0x3ca3fa,_0xe612('0x2f'));_0x29c429[_0xe612('0x34')]=_[_0xe612('0x35')](_0x278709[_0xe612('0x34')]);_0x29c429[_0xe612('0x36')]=_[_0xe612('0x37')](_0x29c429['model'],_0x29c429[_0xe612('0x34')]);_0x9cad79['attributes']=_[_0xe612('0x37')](_0x29c429[_0xe612('0x38')],qs[_0xe612('0x39')](_0x278709[_0xe612('0x34')][_0xe612('0x39')]));_0x9cad79[_0xe612('0x3a')]=_0x9cad79[_0xe612('0x3a')]['length']?_0x9cad79[_0xe612('0x3a')]:_0x29c429[_0xe612('0x38')];if(!_0x278709[_0xe612('0x34')][_0xe612('0x3b')](_0xe612('0x3c'))){_0x9cad79[_0xe612('0x23')]=qs[_0xe612('0x23')](_0x278709[_0xe612('0x34')][_0xe612('0x23')]);_0x9cad79['offset']=qs[_0xe612('0x21')](_0x278709[_0xe612('0x34')][_0xe612('0x21')]);}_0x9cad79[_0xe612('0x3d')]=qs[_0xe612('0x3e')](_0x278709[_0xe612('0x34')][_0xe612('0x3e')]);_0x9cad79[_0xe612('0x3f')]=qs[_0xe612('0x36')](_[_0xe612('0x40')](_0x278709[_0xe612('0x34')],_0x29c429[_0xe612('0x36')]),_0x3ca3fa);if(_0x278709[_0xe612('0x34')][_0xe612('0x41')]){_0x9cad79[_0xe612('0x3f')]=_[_0xe612('0x42')](_0x9cad79[_0xe612('0x3f')],{'$or':_[_0xe612('0x43')](_0x3ca3fa,function(_0x406a51){if(_0x406a51[_0xe612('0x33')]!=='VIRTUAL'){var _0x462bf4={};_0x462bf4[_0x406a51['name']]={'$like':'%'+_0x278709[_0xe612('0x34')][_0xe612('0x41')]+'%'};return _0x462bf4;}})});}_0x9cad79=_[_0xe612('0x42')]({},_0x9cad79,_0x278709[_0xe612('0x44')]);var _0x38dd9f={'where':_0x9cad79[_0xe612('0x3f')]};return db[_0xe612('0x31')]['count'](_0x38dd9f)['then'](function(_0x5ea890){_0x3117cd[_0xe612('0x24')]=_0x5ea890;if(_0x278709['query'][_0xe612('0x45')]){_0x9cad79[_0xe612('0x46')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xe612('0x47')](_0x9cad79);})[_0xe612('0x2c')](function(_0x218333){_0x3117cd[_0xe612('0x48')]=_0x218333;return _0x3117cd;})['then'](respondWithFilteredResult(_0x126611,_0x9cad79))[_0xe612('0x49')](handleError(_0x126611,null));};exports[_0xe612('0x4a')]=function(_0x3c6d39,_0x3205f4){var _0xa1b9b2={'raw':!![],'where':{'id':_0x3c6d39[_0xe612('0x4b')]['id']}},_0x419d4e={};_0x419d4e['model']=_[_0xe612('0x35')](db[_0xe612('0x31')][_0xe612('0x32')]);_0x419d4e[_0xe612('0x34')]=_[_0xe612('0x35')](_0x3c6d39[_0xe612('0x34')]);_0x419d4e[_0xe612('0x36')]=_[_0xe612('0x37')](_0x419d4e[_0xe612('0x38')],_0x419d4e['query']);_0xa1b9b2[_0xe612('0x3a')]=_[_0xe612('0x37')](_0x419d4e['model'],qs['fields'](_0x3c6d39[_0xe612('0x34')][_0xe612('0x39')]));_0xa1b9b2[_0xe612('0x3a')]=_0xa1b9b2[_0xe612('0x3a')][_0xe612('0x4c')]?_0xa1b9b2[_0xe612('0x3a')]:_0x419d4e[_0xe612('0x38')];if(_0x3c6d39[_0xe612('0x34')][_0xe612('0x45')]){_0xa1b9b2['include']=[{'all':!![]}];}_0xa1b9b2=_[_0xe612('0x42')]({},_0xa1b9b2,_0x3c6d39[_0xe612('0x44')]);return db['WhatsappQueue'][_0xe612('0x4d')](_0xa1b9b2)[_0xe612('0x2c')](handleEntityNotFound(_0x3205f4,null))['then'](respondWithResult(_0x3205f4,null))[_0xe612('0x49')](handleError(_0x3205f4,null));};exports[_0xe612('0x4e')]=function(_0x595a12,_0x258c3d){return db[_0xe612('0x31')][_0xe612('0x4e')](_0x595a12[_0xe612('0x4f')],{})[_0xe612('0x2c')](function(_0x3f9552){var _0x50b663=_0x595a12[_0xe612('0x50')][_0xe612('0x2a')]({'plain':!![]});if(!_0x50b663)throw new Error(_0xe612('0x51'));if(_0x50b663[_0xe612('0x52')]==='user'){var _0x44c25b=_0x3f9552['get']({'plain':!![]});var _0x172186=_0xe612('0x2b');return db[_0xe612('0x53')][_0xe612('0x4d')]({'where':{'name':_0x172186,'userProfileId':_0x50b663[_0xe612('0x54')]},'raw':!![]})[_0xe612('0x2c')](function(_0x2a8ae5){if(_0x2a8ae5&&_0x2a8ae5[_0xe612('0x55')]===0x0){return db[_0xe612('0x56')][_0xe612('0x4e')]({'name':_0x44c25b[_0xe612('0x2f')],'resourceId':_0x44c25b['id'],'type':_0x2a8ae5['name'],'sectionId':_0x2a8ae5['id']},{})[_0xe612('0x2c')](function(){return _0x3f9552;});}else{return _0x3f9552;}})[_0xe612('0x49')](function(_0x33af18){logger[_0xe612('0x2d')](_0xe612('0x57'),_0x33af18);throw _0x33af18;});}return _0x3f9552;})[_0xe612('0x2c')](respondWithResult(_0x258c3d,0xc9))[_0xe612('0x49')](handleError(_0x258c3d,null));};exports[_0xe612('0x29')]=function(_0x10bf3d,_0x476b01){if(_0x10bf3d['body']['id']){delete _0x10bf3d[_0xe612('0x4f')]['id'];}return db[_0xe612('0x31')][_0xe612('0x4d')]({'where':{'id':_0x10bf3d['params']['id']}})[_0xe612('0x2c')](handleEntityNotFound(_0x476b01,null))['then'](saveUpdates(_0x10bf3d[_0xe612('0x4f')],null))['then'](respondWithResult(_0x476b01,null))[_0xe612('0x49')](handleError(_0x476b01,null));};exports[_0xe612('0x58')]=function(_0xc0ee2f,_0x1c0215){return db[_0xe612('0x31')]['find']({'where':{'id':_0xc0ee2f['params']['id']}})['then'](handleEntityNotFound(_0x1c0215,null))[_0xe612('0x2c')](removeEntity(_0x1c0215,null))[_0xe612('0x49')](handleError(_0x1c0215,null));};exports[_0xe612('0x59')]=function(_0x5c9481,_0x3e4935){return db[_0xe612('0x31')][_0xe612('0x59')]()['then'](respondWithResult(_0x3e4935,null))[_0xe612('0x49')](handleError(_0x3e4935,null));};exports[_0xe612('0x5a')]=function(_0x16c9ea,_0xf69112,_0x4c6da6){var _0x48439b={'raw':!![],'where':{}},_0x268218={},_0x5b04c2;return db['WhatsappQueue'][_0xe612('0x5b')]({'where':{'id':_0x16c9ea[_0xe612('0x4b')]['id']}})['then'](handleEntityNotFound(_0xf69112,null))[_0xe612('0x2c')](function(_0x48e57d){if(_0x48e57d){_0x5b04c2=_0x48e57d['get']({'plain':!![]});_0x268218[_0xe612('0x38')]=_[_0xe612('0x35')](db[_0xe612('0x5c')][_0xe612('0x32')]);_0x268218[_0xe612('0x34')]=_[_0xe612('0x35')](_0x16c9ea['query']);_0x268218[_0xe612('0x36')]=_[_0xe612('0x37')](_0x268218[_0xe612('0x38')],_0x268218[_0xe612('0x34')]);_0x48439b[_0xe612('0x3a')]=_[_0xe612('0x37')](_0x268218[_0xe612('0x38')],qs[_0xe612('0x39')](_0x16c9ea[_0xe612('0x34')][_0xe612('0x39')]));_0x48439b[_0xe612('0x3a')]=_0x48439b['attributes']['length']?_0x48439b[_0xe612('0x3a')]:_0x268218[_0xe612('0x38')];if(!_0x16c9ea[_0xe612('0x34')][_0xe612('0x3b')](_0xe612('0x3c'))){_0x48439b[_0xe612('0x23')]=qs['limit'](_0x16c9ea[_0xe612('0x34')]['limit']);_0x48439b[_0xe612('0x21')]=qs[_0xe612('0x21')](_0x16c9ea[_0xe612('0x34')][_0xe612('0x21')]);}_0x48439b[_0xe612('0x3d')]=qs[_0xe612('0x3e')](_0x16c9ea[_0xe612('0x34')][_0xe612('0x3e')]);_0x48439b[_0xe612('0x3f')]=qs['filters'](_[_0xe612('0x40')](_0x16c9ea['query'],_0x268218[_0xe612('0x36')]));_0x48439b[_0xe612('0x3f')]['WhatsappQueueId']=_0x48e57d['id'];if(_0x16c9ea[_0xe612('0x34')]['filter']){_0x48439b[_0xe612('0x3f')]=_[_0xe612('0x42')](_0x48439b[_0xe612('0x3f')],{'$or':_[_0xe612('0x43')](_0x48439b['attributes'],function(_0x55a99a){var _0x35af6a={};_0x35af6a[_0x55a99a]={'$like':'%'+_0x16c9ea[_0xe612('0x34')][_0xe612('0x41')]+'%'};return _0x35af6a;})});}_0x48439b=_[_0xe612('0x42')]({},_0x48439b,_0x16c9ea[_0xe612('0x44')]);return db[_0xe612('0x5c')][_0xe612('0x47')](_0x48439b);}})[_0xe612('0x2c')](function(_0x1f06ea){if(_0x1f06ea){return db[_0xe612('0x5d')][_0xe612('0x5e')]({'where':{'id':_[_0xe612('0x43')](_0x1f06ea,_0xe612('0x5f')),'role':_0xe612('0x60')},'attributes':['id','name',_0xe612('0x61'),'updatedAt','createdAt']});}})['then'](function(_0x4f4654){if(_0x4f4654){return{'count':_0x4f4654['count'],'rows':_[_0xe612('0x43')](_0x4f4654[_0xe612('0x48')],function(_0x49d08a){return{'membername':_0x49d08a[_0xe612('0x2f')],'UserId':_0x49d08a['id'],'queue_name':_0x5b04c2[_0xe612('0x2f')],'WhatsappQueueId':_0x5b04c2['id'],'interface':util[_0xe612('0x62')](_0xe612('0x63'),'SIP',_0x49d08a[_0xe612('0x2f')]),'penalty':0x0,'paused':_0x49d08a[_0xe612('0x61')],'createdAt':_0x49d08a[_0xe612('0x64')],'updatedAt':_0x49d08a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe612('0x2c')](respondWithFilteredResult(_0xf69112,_0x48439b))[_0xe612('0x49')](handleError(_0xf69112,null));};exports['getTeams']=function(_0x54ec62,_0x4e9db3,_0x21f847){var _0x343054={};var _0x38424e={};var _0x158c77;var _0x31a22d;return db[_0xe612('0x31')][_0xe612('0x5b')]({'where':{'id':_0x54ec62[_0xe612('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4e9db3,null))[_0xe612('0x2c')](function(_0x378eb7){if(_0x378eb7){_0x158c77=_0x378eb7;_0x38424e[_0xe612('0x38')]=_[_0xe612('0x35')](db['Team']['rawAttributes']);_0x38424e[_0xe612('0x34')]=_[_0xe612('0x35')](_0x54ec62[_0xe612('0x34')]);_0x38424e[_0xe612('0x36')]=_[_0xe612('0x37')](_0x38424e[_0xe612('0x38')],_0x38424e[_0xe612('0x34')]);_0x343054[_0xe612('0x3a')]=_['intersection'](_0x38424e[_0xe612('0x38')],qs[_0xe612('0x39')](_0x54ec62['query'][_0xe612('0x39')]));_0x343054[_0xe612('0x3a')]=_0x343054['attributes'][_0xe612('0x4c')]?_0x343054[_0xe612('0x3a')]:_0x38424e[_0xe612('0x38')];_0x343054[_0xe612('0x3d')]=qs['sort'](_0x54ec62[_0xe612('0x34')][_0xe612('0x3e')]);_0x343054[_0xe612('0x3f')]=qs[_0xe612('0x36')](_[_0xe612('0x40')](_0x54ec62[_0xe612('0x34')],_0x38424e['filters']));if(_0x54ec62[_0xe612('0x34')][_0xe612('0x41')]){_0x343054[_0xe612('0x3f')]=_[_0xe612('0x42')](_0x343054[_0xe612('0x3f')],{'$or':_[_0xe612('0x43')](_0x343054['attributes'],function(_0x34d1f2){var _0x372bc1={};_0x372bc1[_0x34d1f2]={'$like':'%'+_0x54ec62[_0xe612('0x34')][_0xe612('0x41')]+'%'};return _0x372bc1;})});}_0x343054=_[_0xe612('0x42')]({},_0x343054,_0x54ec62['options']);return _0x158c77[_0xe612('0x65')](_0x343054);}})['then'](function(_0x4b59b9){if(_0x4b59b9){_0x31a22d=_0x4b59b9[_0xe612('0x4c')];if(!_0x54ec62['query']['hasOwnProperty'](_0xe612('0x3c'))){_0x343054[_0xe612('0x23')]=qs[_0xe612('0x23')](_0x54ec62[_0xe612('0x34')][_0xe612('0x23')]);_0x343054[_0xe612('0x21')]=qs[_0xe612('0x21')](_0x54ec62[_0xe612('0x34')][_0xe612('0x21')]);}return _0x158c77['getTeams'](_0x343054);}})[_0xe612('0x2c')](function(_0x415e8c){if(_0x415e8c){return _0x415e8c?{'count':_0x31a22d,'rows':_0x415e8c}:null;}})['then'](respondWithResult(_0x4e9db3,null))['catch'](handleError(_0x4e9db3,null));};exports[_0xe612('0x66')]=function(_0x80942a,_0x10e9a4,_0xbfb488){var _0x1e6032=_0x80942a[_0xe612('0x4f')]['ids'];return db[_0xe612('0x67')][_0xe612('0x47')]({'where':{'id':_0x1e6032},'attributes':['id'],'include':[{'model':db[_0xe612('0x5d')],'as':_0xe612('0x68'),'attributes':['id','name','online','voicePause','interface'],'raw':!![]}]})[_0xe612('0x2c')](function(_0x32fd14){if(_0x32fd14){var _0x13246f=_[_0xe612('0x69')](_0x32fd14,function(_0x5bd67){var _0x2a08c9=_0x5bd67['get']({'plain':!![]});return _0x2a08c9[_0xe612('0x68')];});return db[_0xe612('0x31')][_0xe612('0x4d')]({'where':{'id':_0x80942a[_0xe612('0x4b')]['id']}})[_0xe612('0x2c')](function(_0x13f4ce){return db[_0xe612('0x6a')][_0xe612('0x6b')](function(_0x419cb9){return _0x13f4ce[_0xe612('0x66')](_0x1e6032,{'transaction':_0x419cb9})[_0xe612('0x2c')](function(){return BPromise[_0xe612('0x6c')](_0x13246f,function(_0x480c6e){return db[_0xe612('0x5c')]['findOrCreate']({'where':{'UserId':_0x480c6e['id'],'WhatsappQueueId':_0x80942a[_0xe612('0x4b')]['id']},'transaction':_0x419cb9});});})['then'](function(){_0x13246f[_0xe612('0x6d')](function(_0x350c6a){socket[_0xe612('0x6e')]('userWhatsappQueue:save',{'UserId':_0x350c6a['id'],'WhatsappQueueId':_0x13f4ce['id']});});});});});}})[_0xe612('0x2c')](respondWithStatusCode(_0x10e9a4,null))[_0xe612('0x49')](handleError(_0x10e9a4,null));};exports[_0xe612('0x6f')]=function(_0x53d8fb,_0x1c6251,_0x586332){return db['Team'][_0xe612('0x47')]({'where':{'id':_0x53d8fb['query'][_0xe612('0x70')]},'attributes':['id'],'include':[{'model':db[_0xe612('0x5d')],'as':_0xe612('0x68'),'attributes':['id'],'raw':!![]}]})[_0xe612('0x2c')](handleEntityNotFound(_0x1c6251,null))['then'](function(_0x15820c){var _0x4473a7=_['map'](_0x15820c,'id');var _0x245a82=[];var _0x369f7f=[];var _0x3f074c=squel[_0xe612('0x71')]();_0x3f074c[_0xe612('0x72')](_0xe612('0x73'))[_0xe612('0x74')](_0xe612('0x75'),'tq')[_0xe612('0x76')]('user_has_teams','ut',_0xe612('0x77'))[_0xe612('0x3f')]('WhatsappQueueId\x20=\x20?',_0x53d8fb[_0xe612('0x4b')]['id']);for(var _0x147040=0x0;_0x147040<_0x15820c[_0xe612('0x4c')];_0x147040+=0x1){let _0x5bb1d7=_0x15820c[_0x147040];for(var _0x20a836=0x0;_0x20a836<_0x5bb1d7[_0xe612('0x68')]['length'];_0x20a836+=0x1){let _0x14be5a=_0x5bb1d7['Agents'][_0x20a836];var _0x4a1a5e=_0x3f074c[_0xe612('0x78')]();_0x4a1a5e[_0xe612('0x3f')](_0xe612('0x79'),_0x14be5a['id']);_0x369f7f[_0xe612('0x7a')](db[_0xe612('0x6a')][_0xe612('0x34')](_0x4a1a5e[_0xe612('0x7b')](),{'type':db['sequelize'][_0xe612('0x7c')]['SELECT']})[_0xe612('0x2c')](function(_0x154a27){if(_0x154a27[_0xe612('0x4c')]===0x1){return _0x14be5a['id'];}else{var _0x3932c0=_[_0xe612('0x7d')](_['map'](_0x154a27,_0xe612('0x7e')),function(_0x33d0f8){return _['includes'](_0x4473a7,_0x33d0f8);});if(_0x3932c0){return _0x14be5a['id'];}}}));}}return BPromise[_0xe612('0x7f')](_0x369f7f)[_0xe612('0x2c')](function(_0x11bb31){_0x245a82=_(_0x245a82)['union'](_0x11bb31)['compact']()[_0xe612('0x80')]();return db[_0xe612('0x31')]['find']({'where':{'id':_0x53d8fb[_0xe612('0x4b')]['id']}})[_0xe612('0x2c')](function(_0x512e92){return db[_0xe612('0x6a')][_0xe612('0x6b')](function(_0x228015){return _0x512e92[_0xe612('0x6f')](_0x53d8fb[_0xe612('0x34')][_0xe612('0x70')],{'transaction':_0x228015})[_0xe612('0x2c')](function(){if(!_[_0xe612('0x81')](_0x245a82)){return _0x512e92[_0xe612('0x82')](_0x245a82,{'transaction':_0x228015});}})[_0xe612('0x2c')](function(){_0x245a82[_0xe612('0x6d')](function(_0x38fb56){socket[_0xe612('0x6e')](_0xe612('0x83'),{'UserId':_0x38fb56,'WhatsappQueueId':_0x512e92['id']});});});});});});})[_0xe612('0x2c')](respondWithStatusCode(_0x1c6251,null))[_0xe612('0x49')](handleError(_0x1c6251,null));};exports[_0xe612('0x84')]=function(_0x4dc2ce,_0xba3825,_0x35df64){return db[_0xe612('0x31')][_0xe612('0x4d')]({'where':{'id':_0x4dc2ce[_0xe612('0x4b')]['id']}})[_0xe612('0x2c')](handleEntityNotFound(_0xba3825,null))['then'](function(_0x503447){if(_0x503447){return _0x503447[_0xe612('0x84')](_0x4dc2ce['body']['ids'],_['omit'](_0x4dc2ce['body'],[_0xe612('0x70'),'id'])||{})[_0xe612('0x85')](function(_0x20d867){for(var _0x3a59a8=0x0;_0x3a59a8<_0x4dc2ce[_0xe612('0x4f')][_0xe612('0x70')][_0xe612('0x4c')];_0x3a59a8+=0x1){socket[_0xe612('0x6e')](_0xe612('0x86'),{'UserId':Number(_0x4dc2ce['body']['ids'][_0x3a59a8]),'WhatsappQueueId':Number(_0x4dc2ce[_0xe612('0x4b')]['id'])});}return _0x20d867;});}})['then'](respondWithResult(_0xba3825,null))['catch'](handleError(_0xba3825,null));};exports[_0xe612('0x82')]=function(_0x4e9017,_0x8898bb,_0x463b7a){return db[_0xe612('0x31')][_0xe612('0x4d')]({'where':{'id':_0x4e9017[_0xe612('0x4b')]['id']}})['then'](handleEntityNotFound(_0x8898bb,null))[_0xe612('0x2c')](function(_0x508a3f){if(_0x508a3f){return _0x508a3f['removeAgents'](_0x4e9017[_0xe612('0x34')][_0xe612('0x70')])[_0xe612('0x2c')](function(){if(_[_0xe612('0x87')](_0x4e9017[_0xe612('0x34')]['ids'])){for(var _0x11a0e8=0x0;_0x11a0e8<_0x4e9017[_0xe612('0x34')][_0xe612('0x70')][_0xe612('0x4c')];_0x11a0e8+=0x1){socket[_0xe612('0x6e')]('userWhatsappQueue:remove',{'UserId':Number(_0x4e9017['query']['ids'][_0x11a0e8]),'WhatsappQueueId':Number(_0x4e9017['params']['id'])});}}else{socket[_0xe612('0x6e')](_0xe612('0x83'),{'UserId':Number(_0x4e9017[_0xe612('0x34')][_0xe612('0x70')]),'WhatsappQueueId':Number(_0x4e9017[_0xe612('0x4b')]['id'])});}});}})[_0xe612('0x2c')](respondWithStatusCode(_0x8898bb,null))['catch'](handleError(_0x8898bb,null));};exports[_0xe612('0x88')]=function(_0x22f16f,_0x4be221,_0x2776e3){var _0x159f8d={};var _0x47ed63={};var _0x3005ac;var _0x17acb4;return db[_0xe612('0x31')][_0xe612('0x5b')]({'where':{'id':_0x22f16f['params']['id']}})[_0xe612('0x2c')](handleEntityNotFound(_0x4be221,null))[_0xe612('0x2c')](function(_0x2c9722){if(_0x2c9722){_0x3005ac=_0x2c9722;_0x47ed63[_0xe612('0x38')]=_['keys'](db[_0xe612('0x5d')]['rawAttributes']);_0x47ed63[_0xe612('0x34')]=_[_0xe612('0x35')](_0x22f16f[_0xe612('0x34')]);_0x47ed63['filters']=_[_0xe612('0x37')](_0x47ed63['model'],_0x47ed63[_0xe612('0x34')]);_0x159f8d[_0xe612('0x3a')]=_['intersection'](_0x47ed63[_0xe612('0x38')],qs[_0xe612('0x39')](_0x22f16f['query']['fields']));_0x159f8d['attributes']=_0x159f8d['attributes']['length']?_0x159f8d[_0xe612('0x3a')]:_0x47ed63[_0xe612('0x38')];_0x159f8d['order']=qs[_0xe612('0x3e')](_0x22f16f[_0xe612('0x34')]['sort']);_0x159f8d[_0xe612('0x3f')]=qs[_0xe612('0x36')](_[_0xe612('0x40')](_0x22f16f['query'],_0x47ed63[_0xe612('0x36')]));if(_0x22f16f['query'][_0xe612('0x41')]){_0x159f8d[_0xe612('0x3f')]=_[_0xe612('0x42')](_0x159f8d[_0xe612('0x3f')],{'$or':_[_0xe612('0x43')](_0x159f8d[_0xe612('0x3a')],function(_0x3e5a7f){var _0x34d1fe={};_0x34d1fe[_0x3e5a7f]={'$like':'%'+_0x22f16f[_0xe612('0x34')][_0xe612('0x41')]+'%'};return _0x34d1fe;})});}_0x159f8d=_[_0xe612('0x42')]({},_0x159f8d,_0x22f16f[_0xe612('0x44')]);return _0x3005ac[_0xe612('0x88')](_0x159f8d);}})[_0xe612('0x2c')](function(_0x8fcaff){if(_0x8fcaff){_0x17acb4=_0x8fcaff[_0xe612('0x4c')];if(!_0x22f16f[_0xe612('0x34')][_0xe612('0x3b')]('nolimit')){_0x159f8d[_0xe612('0x23')]=qs[_0xe612('0x23')](_0x22f16f[_0xe612('0x34')][_0xe612('0x23')]);_0x159f8d[_0xe612('0x21')]=qs[_0xe612('0x21')](_0x22f16f[_0xe612('0x34')][_0xe612('0x21')]);}return _0x3005ac[_0xe612('0x88')](_0x159f8d);}})['then'](function(_0x203498){if(_0x203498){return _0x203498?{'count':_0x17acb4,'rows':_0x203498}:null;}})['then'](respondWithResult(_0x4be221,null))[_0xe612('0x49')](handleError(_0x4be221,null));}; \ No newline at end of file +var _0x3f73=['forEach','emit','userWhatsappQueue:save','removeTeams','select','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','value','removeAgents','userWhatsappQueue:remove','addAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','get','WhatsappQueues','end','stack','name','map','WhatsappQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','catch','show','params','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate'];(function(_0x2949cf,_0x2bb6e9){var _0x49518a=function(_0x6ce967){while(--_0x6ce967){_0x2949cf['push'](_0x2949cf['shift']());}};_0x49518a(++_0x2bb6e9);}(_0x3f73,0x127));var _0x33f7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3f73[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x33f7('0x0'));var rimraf=require(_0x33f7('0x1'));var zipdir=require(_0x33f7('0x2'));var jsonpatch=require(_0x33f7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x33f7('0x4'));var Mustache=require(_0x33f7('0x5'));var util=require(_0x33f7('0x6'));var path=require('path');var sox=require(_0x33f7('0x7'));var csv=require(_0x33f7('0x8'));var ejs=require(_0x33f7('0x9'));var fs=require('fs');var fs_extra=require(_0x33f7('0xa'));var _=require(_0x33f7('0xb'));var squel=require(_0x33f7('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x33f7('0xd'));var toCsv=require(_0x33f7('0x8'));var querystring=require(_0x33f7('0xe'));var Papa=require('papaparse');var Redis=require(_0x33f7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x33f7('0x10'));var as=require(_0x33f7('0x11'));var hardwareService=require(_0x33f7('0x12'));var logger=require(_0x33f7('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x33f7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x33f7('0x15'))['db'];config['redis']=_[_0x33f7('0x16')](config[_0x33f7('0x17')],{'host':_0x33f7('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x33f7('0x17')]));require(_0x33f7('0x19'))[_0x33f7('0x1a')](socket);function respondWithStatusCode(_0x3be5ca,_0x247be8){_0x247be8=_0x247be8||0xcc;return function(_0x4377f3){if(_0x4377f3){return _0x3be5ca[_0x33f7('0x1b')](_0x247be8);}return _0x3be5ca[_0x33f7('0x1c')](_0x247be8)['end']();};}function respondWithResult(_0x129dbc,_0x43756f){_0x43756f=_0x43756f||0xc8;return function(_0x29f9a0){if(_0x29f9a0){return _0x129dbc['status'](_0x43756f)[_0x33f7('0x1d')](_0x29f9a0);}};}function respondWithFilteredResult(_0xeac29d,_0x43792a){return function(_0x141ad7){if(_0x141ad7){var _0x49ed2c=typeof _0x43792a[_0x33f7('0x1e')]===_0x33f7('0x1f')&&typeof _0x43792a['limit']==='undefined';var _0x1f9d38=_0x141ad7[_0x33f7('0x20')];var _0x28015e=_0x49ed2c?0x0:_0x43792a[_0x33f7('0x1e')];var _0x3eacba=_0x49ed2c?_0x141ad7[_0x33f7('0x20')]:_0x43792a['offset']+_0x43792a[_0x33f7('0x21')];var _0x25d5bd;if(_0x3eacba>=_0x1f9d38){_0x3eacba=_0x1f9d38;_0x25d5bd=0xc8;}else{_0x25d5bd=0xce;}_0xeac29d[_0x33f7('0x1c')](_0x25d5bd);return _0xeac29d[_0x33f7('0x22')](_0x33f7('0x23'),_0x28015e+'-'+_0x3eacba+'/'+_0x1f9d38)[_0x33f7('0x1d')](_0x141ad7);}return null;};}function patchUpdates(_0x565f4f){return function(_0x1e54ad){try{jsonpatch['apply'](_0x1e54ad,_0x565f4f,!![]);}catch(_0x5c2dea){return BPromise['reject'](_0x5c2dea);}return _0x1e54ad['save']();};}function saveUpdates(_0x23241c,_0x22903d){return function(_0xf1a5bc){if(_0xf1a5bc){return _0xf1a5bc[_0x33f7('0x24')](_0x23241c)[_0x33f7('0x25')](function(_0x4e0060){return _0x4e0060;});}return null;};}function removeEntity(_0x43597d,_0x32851b){return function(_0x590b7b){if(_0x590b7b){return _0x590b7b[_0x33f7('0x26')]()[_0x33f7('0x25')](function(){var _0x914e5d=_0x590b7b[_0x33f7('0x27')]({'plain':!![]});var _0xb12270=_0x33f7('0x28');return db['UserProfileResource'][_0x33f7('0x26')]({'where':{'type':_0xb12270,'resourceId':_0x914e5d['id']}})[_0x33f7('0x25')](function(){return _0x590b7b;});})[_0x33f7('0x25')](function(){_0x43597d[_0x33f7('0x1c')](0xcc)[_0x33f7('0x29')]();});}};}function handleEntityNotFound(_0xaef132,_0x34e0a0){return function(_0x4add96){if(!_0x4add96){_0xaef132[_0x33f7('0x1b')](0x194);}return _0x4add96;};}function handleError(_0x5dad76,_0x5c46e9){_0x5c46e9=_0x5c46e9||0x1f4;return function(_0x2ab977){logger['error'](_0x2ab977[_0x33f7('0x2a')]);if(_0x2ab977['name']){delete _0x2ab977[_0x33f7('0x2b')];}_0x5dad76[_0x33f7('0x1c')](_0x5c46e9)['send'](_0x2ab977);};}exports['index']=function(_0x155e9e,_0x1feacd){var _0x5d1594={},_0x1c3157={},_0xa7e511={'count':0x0,'rows':[]};var _0x4babb2=_[_0x33f7('0x2c')](db[_0x33f7('0x2d')][_0x33f7('0x2e')],function(_0x294948){return{'name':_0x294948[_0x33f7('0x2f')],'type':_0x294948['type'][_0x33f7('0x30')]};});_0x1c3157[_0x33f7('0x31')]=_['map'](_0x4babb2,'name');_0x1c3157[_0x33f7('0x32')]=_[_0x33f7('0x33')](_0x155e9e[_0x33f7('0x32')]);_0x1c3157[_0x33f7('0x34')]=_[_0x33f7('0x35')](_0x1c3157['model'],_0x1c3157[_0x33f7('0x32')]);_0x5d1594[_0x33f7('0x36')]=_[_0x33f7('0x35')](_0x1c3157['model'],qs[_0x33f7('0x37')](_0x155e9e[_0x33f7('0x32')]['fields']));_0x5d1594['attributes']=_0x5d1594[_0x33f7('0x36')][_0x33f7('0x38')]?_0x5d1594['attributes']:_0x1c3157[_0x33f7('0x31')];if(!_0x155e9e[_0x33f7('0x32')][_0x33f7('0x39')](_0x33f7('0x3a'))){_0x5d1594[_0x33f7('0x21')]=qs[_0x33f7('0x21')](_0x155e9e[_0x33f7('0x32')][_0x33f7('0x21')]);_0x5d1594[_0x33f7('0x1e')]=qs['offset'](_0x155e9e[_0x33f7('0x32')][_0x33f7('0x1e')]);}_0x5d1594[_0x33f7('0x3b')]=qs['sort'](_0x155e9e[_0x33f7('0x32')][_0x33f7('0x3c')]);_0x5d1594[_0x33f7('0x3d')]=qs[_0x33f7('0x34')](_[_0x33f7('0x3e')](_0x155e9e[_0x33f7('0x32')],_0x1c3157[_0x33f7('0x34')]),_0x4babb2);if(_0x155e9e[_0x33f7('0x32')][_0x33f7('0x3f')]){_0x5d1594[_0x33f7('0x3d')]=_[_0x33f7('0x40')](_0x5d1594['where'],{'$or':_[_0x33f7('0x2c')](_0x4babb2,function(_0x4823cb){if(_0x4823cb[_0x33f7('0x41')]!=='VIRTUAL'){var _0x9e8343={};_0x9e8343[_0x4823cb['name']]={'$like':'%'+_0x155e9e[_0x33f7('0x32')][_0x33f7('0x3f')]+'%'};return _0x9e8343;}})});}_0x5d1594=_[_0x33f7('0x40')]({},_0x5d1594,_0x155e9e['options']);var _0x23afbe={'where':_0x5d1594[_0x33f7('0x3d')]};return db[_0x33f7('0x2d')][_0x33f7('0x20')](_0x23afbe)['then'](function(_0x3fefab){_0xa7e511[_0x33f7('0x20')]=_0x3fefab;if(_0x155e9e[_0x33f7('0x32')][_0x33f7('0x42')]){_0x5d1594[_0x33f7('0x43')]=[{'all':!![]}];}return db[_0x33f7('0x2d')][_0x33f7('0x44')](_0x5d1594);})[_0x33f7('0x25')](function(_0x30af4d){_0xa7e511['rows']=_0x30af4d;return _0xa7e511;})[_0x33f7('0x25')](respondWithFilteredResult(_0x1feacd,_0x5d1594))[_0x33f7('0x45')](handleError(_0x1feacd,null));};exports[_0x33f7('0x46')]=function(_0x294363,_0x1b23bb){var _0x44d95f={'raw':!![],'where':{'id':_0x294363[_0x33f7('0x47')]['id']}},_0x1f9a4f={};_0x1f9a4f['model']=_[_0x33f7('0x33')](db[_0x33f7('0x2d')]['rawAttributes']);_0x1f9a4f[_0x33f7('0x32')]=_['keys'](_0x294363['query']);_0x1f9a4f['filters']=_[_0x33f7('0x35')](_0x1f9a4f[_0x33f7('0x31')],_0x1f9a4f['query']);_0x44d95f[_0x33f7('0x36')]=_[_0x33f7('0x35')](_0x1f9a4f[_0x33f7('0x31')],qs[_0x33f7('0x37')](_0x294363[_0x33f7('0x32')][_0x33f7('0x37')]));_0x44d95f['attributes']=_0x44d95f[_0x33f7('0x36')]['length']?_0x44d95f[_0x33f7('0x36')]:_0x1f9a4f[_0x33f7('0x31')];if(_0x294363['query'][_0x33f7('0x42')]){_0x44d95f[_0x33f7('0x43')]=[{'all':!![]}];}_0x44d95f=_[_0x33f7('0x40')]({},_0x44d95f,_0x294363[_0x33f7('0x48')]);return db[_0x33f7('0x2d')][_0x33f7('0x49')](_0x44d95f)[_0x33f7('0x25')](handleEntityNotFound(_0x1b23bb,null))['then'](respondWithResult(_0x1b23bb,null))[_0x33f7('0x45')](handleError(_0x1b23bb,null));};exports[_0x33f7('0x4a')]=function(_0x411be7,_0x484b03){return db['WhatsappQueue'][_0x33f7('0x4a')](_0x411be7['body'],{})['then'](function(_0x5d11d0){var _0x181e6a=_0x411be7['user'][_0x33f7('0x27')]({'plain':!![]});if(!_0x181e6a)throw new Error(_0x33f7('0x4b'));if(_0x181e6a[_0x33f7('0x4c')]===_0x33f7('0x4d')){var _0x3677ee=_0x5d11d0[_0x33f7('0x27')]({'plain':!![]});var _0x25ff50=_0x33f7('0x28');return db[_0x33f7('0x4e')][_0x33f7('0x49')]({'where':{'name':_0x25ff50,'userProfileId':_0x181e6a['userProfileId']},'raw':!![]})[_0x33f7('0x25')](function(_0x145883){if(_0x145883&&_0x145883[_0x33f7('0x4f')]===0x0){return db[_0x33f7('0x50')]['create']({'name':_0x3677ee[_0x33f7('0x2b')],'resourceId':_0x3677ee['id'],'type':_0x145883[_0x33f7('0x2b')],'sectionId':_0x145883['id']},{})[_0x33f7('0x25')](function(){return _0x5d11d0;});}else{return _0x5d11d0;}})[_0x33f7('0x45')](function(_0x4c001e){logger[_0x33f7('0x51')](_0x33f7('0x52'),_0x4c001e);throw _0x4c001e;});}return _0x5d11d0;})[_0x33f7('0x25')](respondWithResult(_0x484b03,0xc9))[_0x33f7('0x45')](handleError(_0x484b03,null));};exports[_0x33f7('0x24')]=function(_0x5be159,_0x5692af){if(_0x5be159[_0x33f7('0x53')]['id']){delete _0x5be159[_0x33f7('0x53')]['id'];}return db['WhatsappQueue'][_0x33f7('0x49')]({'where':{'id':_0x5be159[_0x33f7('0x47')]['id']}})[_0x33f7('0x25')](handleEntityNotFound(_0x5692af,null))[_0x33f7('0x25')](saveUpdates(_0x5be159[_0x33f7('0x53')],null))[_0x33f7('0x25')](respondWithResult(_0x5692af,null))['catch'](handleError(_0x5692af,null));};exports[_0x33f7('0x26')]=function(_0x368cb0,_0x37b023){return db[_0x33f7('0x2d')][_0x33f7('0x49')]({'where':{'id':_0x368cb0[_0x33f7('0x47')]['id']}})[_0x33f7('0x25')](handleEntityNotFound(_0x37b023,null))[_0x33f7('0x25')](removeEntity(_0x37b023,null))[_0x33f7('0x45')](handleError(_0x37b023,null));};exports[_0x33f7('0x54')]=function(_0x31014f,_0x2ae87b){return db['WhatsappQueue'][_0x33f7('0x54')]()[_0x33f7('0x25')](respondWithResult(_0x2ae87b,null))[_0x33f7('0x45')](handleError(_0x2ae87b,null));};exports[_0x33f7('0x55')]=function(_0x5f1967,_0x5755a6,_0x38ea76){var _0x2f4cb4={'raw':!![],'where':{}},_0x39daba={},_0x1de8b1;return db['WhatsappQueue'][_0x33f7('0x56')]({'where':{'id':_0x5f1967[_0x33f7('0x47')]['id']}})[_0x33f7('0x25')](handleEntityNotFound(_0x5755a6,null))[_0x33f7('0x25')](function(_0x26826f){if(_0x26826f){_0x1de8b1=_0x26826f[_0x33f7('0x27')]({'plain':!![]});_0x39daba[_0x33f7('0x31')]=_[_0x33f7('0x33')](db[_0x33f7('0x57')]['rawAttributes']);_0x39daba[_0x33f7('0x32')]=_[_0x33f7('0x33')](_0x5f1967['query']);_0x39daba[_0x33f7('0x34')]=_['intersection'](_0x39daba[_0x33f7('0x31')],_0x39daba[_0x33f7('0x32')]);_0x2f4cb4[_0x33f7('0x36')]=_[_0x33f7('0x35')](_0x39daba[_0x33f7('0x31')],qs[_0x33f7('0x37')](_0x5f1967[_0x33f7('0x32')][_0x33f7('0x37')]));_0x2f4cb4[_0x33f7('0x36')]=_0x2f4cb4[_0x33f7('0x36')][_0x33f7('0x38')]?_0x2f4cb4[_0x33f7('0x36')]:_0x39daba[_0x33f7('0x31')];if(!_0x5f1967['query'][_0x33f7('0x39')](_0x33f7('0x3a'))){_0x2f4cb4['limit']=qs[_0x33f7('0x21')](_0x5f1967[_0x33f7('0x32')][_0x33f7('0x21')]);_0x2f4cb4[_0x33f7('0x1e')]=qs['offset'](_0x5f1967[_0x33f7('0x32')][_0x33f7('0x1e')]);}_0x2f4cb4[_0x33f7('0x3b')]=qs[_0x33f7('0x3c')](_0x5f1967[_0x33f7('0x32')]['sort']);_0x2f4cb4[_0x33f7('0x3d')]=qs[_0x33f7('0x34')](_[_0x33f7('0x3e')](_0x5f1967[_0x33f7('0x32')],_0x39daba[_0x33f7('0x34')]));_0x2f4cb4['where'][_0x33f7('0x58')]=_0x26826f['id'];if(_0x5f1967[_0x33f7('0x32')]['filter']){_0x2f4cb4[_0x33f7('0x3d')]=_[_0x33f7('0x40')](_0x2f4cb4[_0x33f7('0x3d')],{'$or':_[_0x33f7('0x2c')](_0x2f4cb4[_0x33f7('0x36')],function(_0x26741b){var _0x58f4fb={};_0x58f4fb[_0x26741b]={'$like':'%'+_0x5f1967[_0x33f7('0x32')][_0x33f7('0x3f')]+'%'};return _0x58f4fb;})});}_0x2f4cb4=_['merge']({},_0x2f4cb4,_0x5f1967['options']);return db[_0x33f7('0x57')][_0x33f7('0x44')](_0x2f4cb4);}})[_0x33f7('0x25')](function(_0x561751){if(_0x561751){return db['User'][_0x33f7('0x59')]({'where':{'id':_[_0x33f7('0x2c')](_0x561751,_0x33f7('0x5a')),'role':_0x33f7('0x5b')},'attributes':['id',_0x33f7('0x2b'),'whatsappPause','updatedAt',_0x33f7('0x5c')]});}})[_0x33f7('0x25')](function(_0x457fe4){if(_0x457fe4){return{'count':_0x457fe4['count'],'rows':_[_0x33f7('0x2c')](_0x457fe4['rows'],function(_0x1f52b4){return{'membername':_0x1f52b4['name'],'UserId':_0x1f52b4['id'],'queue_name':_0x1de8b1[_0x33f7('0x2b')],'WhatsappQueueId':_0x1de8b1['id'],'interface':util[_0x33f7('0x5d')](_0x33f7('0x5e'),_0x33f7('0x5f'),_0x1f52b4[_0x33f7('0x2b')]),'penalty':0x0,'paused':_0x1f52b4['whatsappPause'],'createdAt':_0x1f52b4[_0x33f7('0x5c')],'updatedAt':_0x1f52b4['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x33f7('0x25')](respondWithFilteredResult(_0x5755a6,_0x2f4cb4))[_0x33f7('0x45')](handleError(_0x5755a6,null));};exports['getTeams']=function(_0x203866,_0x438d54,_0x13ebf8){var _0x13c3bb={};var _0x25ed56={};var _0x3d5cf5;var _0x51772f;return db[_0x33f7('0x2d')]['findOne']({'where':{'id':_0x203866[_0x33f7('0x47')]['id']}})[_0x33f7('0x25')](handleEntityNotFound(_0x438d54,null))['then'](function(_0x66f566){if(_0x66f566){_0x3d5cf5=_0x66f566;_0x25ed56[_0x33f7('0x31')]=_[_0x33f7('0x33')](db[_0x33f7('0x60')][_0x33f7('0x2e')]);_0x25ed56[_0x33f7('0x32')]=_[_0x33f7('0x33')](_0x203866['query']);_0x25ed56[_0x33f7('0x34')]=_[_0x33f7('0x35')](_0x25ed56[_0x33f7('0x31')],_0x25ed56[_0x33f7('0x32')]);_0x13c3bb[_0x33f7('0x36')]=_[_0x33f7('0x35')](_0x25ed56[_0x33f7('0x31')],qs[_0x33f7('0x37')](_0x203866[_0x33f7('0x32')][_0x33f7('0x37')]));_0x13c3bb['attributes']=_0x13c3bb['attributes']['length']?_0x13c3bb['attributes']:_0x25ed56['model'];_0x13c3bb[_0x33f7('0x3b')]=qs['sort'](_0x203866[_0x33f7('0x32')][_0x33f7('0x3c')]);_0x13c3bb[_0x33f7('0x3d')]=qs[_0x33f7('0x34')](_[_0x33f7('0x3e')](_0x203866[_0x33f7('0x32')],_0x25ed56['filters']));if(_0x203866[_0x33f7('0x32')]['filter']){_0x13c3bb['where']=_[_0x33f7('0x40')](_0x13c3bb[_0x33f7('0x3d')],{'$or':_[_0x33f7('0x2c')](_0x13c3bb['attributes'],function(_0x2dcd97){var _0x3158c2={};_0x3158c2[_0x2dcd97]={'$like':'%'+_0x203866[_0x33f7('0x32')][_0x33f7('0x3f')]+'%'};return _0x3158c2;})});}_0x13c3bb=_[_0x33f7('0x40')]({},_0x13c3bb,_0x203866[_0x33f7('0x48')]);return _0x3d5cf5['getTeams'](_0x13c3bb);}})[_0x33f7('0x25')](function(_0x474af8){if(_0x474af8){_0x51772f=_0x474af8[_0x33f7('0x38')];if(!_0x203866[_0x33f7('0x32')][_0x33f7('0x39')](_0x33f7('0x3a'))){_0x13c3bb[_0x33f7('0x21')]=qs[_0x33f7('0x21')](_0x203866['query'][_0x33f7('0x21')]);_0x13c3bb[_0x33f7('0x1e')]=qs[_0x33f7('0x1e')](_0x203866[_0x33f7('0x32')][_0x33f7('0x1e')]);}return _0x3d5cf5[_0x33f7('0x61')](_0x13c3bb);}})[_0x33f7('0x25')](function(_0x43b81c){if(_0x43b81c){return _0x43b81c?{'count':_0x51772f,'rows':_0x43b81c}:null;}})[_0x33f7('0x25')](respondWithResult(_0x438d54,null))[_0x33f7('0x45')](handleError(_0x438d54,null));};exports[_0x33f7('0x62')]=function(_0x26f8c6,_0x5227e0,_0x2db5d0){var _0x533c32=_0x26f8c6[_0x33f7('0x53')][_0x33f7('0x63')];return db[_0x33f7('0x60')][_0x33f7('0x44')]({'where':{'id':_0x533c32},'attributes':['id'],'include':[{'model':db[_0x33f7('0x64')],'as':_0x33f7('0x65'),'attributes':['id',_0x33f7('0x2b'),_0x33f7('0x66'),_0x33f7('0x67'),_0x33f7('0x68')],'raw':!![]}]})['then'](function(_0x266e64){if(_0x266e64){var _0x1eb850=_[_0x33f7('0x69')](_0x266e64,function(_0xb5d75){var _0x5ba10f=_0xb5d75['get']({'plain':!![]});return _0x5ba10f[_0x33f7('0x65')];});return db['WhatsappQueue'][_0x33f7('0x49')]({'where':{'id':_0x26f8c6[_0x33f7('0x47')]['id']}})[_0x33f7('0x25')](function(_0x46b495){return db[_0x33f7('0x6a')][_0x33f7('0x6b')](function(_0x49b784){return _0x46b495['addTeams'](_0x533c32,{'transaction':_0x49b784})[_0x33f7('0x25')](function(){return BPromise[_0x33f7('0x6c')](_0x1eb850,function(_0x437e3c){return db['UserWhatsappQueue'][_0x33f7('0x6d')]({'where':{'UserId':_0x437e3c['id'],'WhatsappQueueId':_0x26f8c6[_0x33f7('0x47')]['id']},'transaction':_0x49b784});});})[_0x33f7('0x25')](function(){_0x1eb850[_0x33f7('0x6e')](function(_0x512594){socket[_0x33f7('0x6f')](_0x33f7('0x70'),{'UserId':_0x512594['id'],'WhatsappQueueId':_0x46b495['id']});});});});});}})['then'](respondWithStatusCode(_0x5227e0,null))[_0x33f7('0x45')](handleError(_0x5227e0,null));};exports[_0x33f7('0x71')]=function(_0xd6852c,_0x77fb97,_0x316dc2){return db[_0x33f7('0x60')][_0x33f7('0x44')]({'where':{'id':_0xd6852c['query'][_0x33f7('0x63')]},'attributes':['id'],'include':[{'model':db[_0x33f7('0x64')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x33f7('0x25')](handleEntityNotFound(_0x77fb97,null))[_0x33f7('0x25')](function(_0xcc876c){var _0x29753d=_['map'](_0xcc876c,'id');var _0x57c4f9=[];var _0x35dec2=[];var _0x527a2c=squel[_0x33f7('0x72')]();_0x527a2c['field']('tq.TeamId')[_0x33f7('0x73')](_0x33f7('0x74'),'tq')[_0x33f7('0x75')](_0x33f7('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x33f7('0x3d')](_0x33f7('0x77'),_0xd6852c['params']['id']);for(var _0x3c7bf8=0x0;_0x3c7bf8<_0xcc876c[_0x33f7('0x38')];_0x3c7bf8+=0x1){let _0x55f415=_0xcc876c[_0x3c7bf8];for(var _0x3879be=0x0;_0x3879be<_0x55f415[_0x33f7('0x65')][_0x33f7('0x38')];_0x3879be+=0x1){let _0x2e061a=_0x55f415[_0x33f7('0x65')][_0x3879be];var _0x1b3db6=_0x527a2c[_0x33f7('0x78')]();_0x1b3db6[_0x33f7('0x3d')](_0x33f7('0x79'),_0x2e061a['id']);_0x35dec2[_0x33f7('0x7a')](db['sequelize'][_0x33f7('0x32')](_0x1b3db6[_0x33f7('0x7b')](),{'type':db[_0x33f7('0x6a')][_0x33f7('0x7c')][_0x33f7('0x7d')]})['then'](function(_0x233d4c){if(_0x233d4c[_0x33f7('0x38')]===0x1){return _0x2e061a['id'];}else{var _0xea14b0=_[_0x33f7('0x7e')](_[_0x33f7('0x2c')](_0x233d4c,_0x33f7('0x7f')),function(_0x5bbd1a){return _['includes'](_0x29753d,_0x5bbd1a);});if(_0xea14b0){return _0x2e061a['id'];}}}));}}return BPromise[_0x33f7('0x80')](_0x35dec2)[_0x33f7('0x25')](function(_0x442564){_0x57c4f9=_(_0x57c4f9)['union'](_0x442564)['compact']()[_0x33f7('0x81')]();return db['WhatsappQueue'][_0x33f7('0x49')]({'where':{'id':_0xd6852c['params']['id']}})[_0x33f7('0x25')](function(_0x4b136d){return db['sequelize']['transaction'](function(_0x5d7862){return _0x4b136d[_0x33f7('0x71')](_0xd6852c[_0x33f7('0x32')]['ids'],{'transaction':_0x5d7862})[_0x33f7('0x25')](function(){if(!_['isEmpty'](_0x57c4f9)){return _0x4b136d[_0x33f7('0x82')](_0x57c4f9,{'transaction':_0x5d7862});}})[_0x33f7('0x25')](function(){_0x57c4f9['forEach'](function(_0x1c4f19){socket[_0x33f7('0x6f')](_0x33f7('0x83'),{'UserId':_0x1c4f19,'WhatsappQueueId':_0x4b136d['id']});});});});});});})['then'](respondWithStatusCode(_0x77fb97,null))[_0x33f7('0x45')](handleError(_0x77fb97,null));};exports['addAgents']=function(_0x2cc06e,_0x48c2db,_0x3c0bee){return db[_0x33f7('0x2d')]['find']({'where':{'id':_0x2cc06e['params']['id']}})[_0x33f7('0x25')](handleEntityNotFound(_0x48c2db,null))[_0x33f7('0x25')](function(_0x3a47ca){if(_0x3a47ca){return _0x3a47ca[_0x33f7('0x84')](_0x2cc06e['body'][_0x33f7('0x63')],_['omit'](_0x2cc06e['body'],['ids','id'])||{})['spread'](function(_0x2e1e98){for(var _0x42ffce=0x0;_0x42ffce<_0x2cc06e[_0x33f7('0x53')][_0x33f7('0x63')][_0x33f7('0x38')];_0x42ffce+=0x1){socket[_0x33f7('0x6f')](_0x33f7('0x70'),{'UserId':Number(_0x2cc06e[_0x33f7('0x53')][_0x33f7('0x63')][_0x42ffce]),'WhatsappQueueId':Number(_0x2cc06e[_0x33f7('0x47')]['id'])});}return _0x2e1e98;});}})[_0x33f7('0x25')](respondWithResult(_0x48c2db,null))[_0x33f7('0x45')](handleError(_0x48c2db,null));};exports['removeAgents']=function(_0x354b66,_0x53e6a7,_0xac6a33){return db[_0x33f7('0x2d')][_0x33f7('0x49')]({'where':{'id':_0x354b66['params']['id']}})[_0x33f7('0x25')](handleEntityNotFound(_0x53e6a7,null))[_0x33f7('0x25')](function(_0xfd17b0){if(_0xfd17b0){return _0xfd17b0[_0x33f7('0x82')](_0x354b66[_0x33f7('0x32')][_0x33f7('0x63')])['then'](function(){if(_[_0x33f7('0x85')](_0x354b66[_0x33f7('0x32')][_0x33f7('0x63')])){for(var _0x4023fc=0x0;_0x4023fc<_0x354b66[_0x33f7('0x32')]['ids'][_0x33f7('0x38')];_0x4023fc+=0x1){socket[_0x33f7('0x6f')](_0x33f7('0x83'),{'UserId':Number(_0x354b66[_0x33f7('0x32')]['ids'][_0x4023fc]),'WhatsappQueueId':Number(_0x354b66['params']['id'])});}}else{socket['emit'](_0x33f7('0x83'),{'UserId':Number(_0x354b66['query'][_0x33f7('0x63')]),'WhatsappQueueId':Number(_0x354b66['params']['id'])});}});}})[_0x33f7('0x25')](respondWithStatusCode(_0x53e6a7,null))['catch'](handleError(_0x53e6a7,null));};exports[_0x33f7('0x86')]=function(_0xb29a56,_0x47249c,_0x28758f){var _0x2ebee8={};var _0xcc7ed9={};var _0x44afe2;var _0x5f180d;return db[_0x33f7('0x2d')][_0x33f7('0x56')]({'where':{'id':_0xb29a56['params']['id']}})['then'](handleEntityNotFound(_0x47249c,null))['then'](function(_0x21b81b){if(_0x21b81b){_0x44afe2=_0x21b81b;_0xcc7ed9['model']=_[_0x33f7('0x33')](db['User'][_0x33f7('0x2e')]);_0xcc7ed9[_0x33f7('0x32')]=_[_0x33f7('0x33')](_0xb29a56[_0x33f7('0x32')]);_0xcc7ed9[_0x33f7('0x34')]=_['intersection'](_0xcc7ed9[_0x33f7('0x31')],_0xcc7ed9[_0x33f7('0x32')]);_0x2ebee8[_0x33f7('0x36')]=_[_0x33f7('0x35')](_0xcc7ed9[_0x33f7('0x31')],qs['fields'](_0xb29a56['query'][_0x33f7('0x37')]));_0x2ebee8[_0x33f7('0x36')]=_0x2ebee8[_0x33f7('0x36')]['length']?_0x2ebee8[_0x33f7('0x36')]:_0xcc7ed9['model'];_0x2ebee8[_0x33f7('0x3b')]=qs[_0x33f7('0x3c')](_0xb29a56[_0x33f7('0x32')]['sort']);_0x2ebee8['where']=qs[_0x33f7('0x34')](_[_0x33f7('0x3e')](_0xb29a56[_0x33f7('0x32')],_0xcc7ed9['filters']));if(_0xb29a56[_0x33f7('0x32')][_0x33f7('0x3f')]){_0x2ebee8[_0x33f7('0x3d')]=_[_0x33f7('0x40')](_0x2ebee8[_0x33f7('0x3d')],{'$or':_['map'](_0x2ebee8[_0x33f7('0x36')],function(_0x35149b){var _0x2b51={};_0x2b51[_0x35149b]={'$like':'%'+_0xb29a56[_0x33f7('0x32')][_0x33f7('0x3f')]+'%'};return _0x2b51;})});}_0x2ebee8=_[_0x33f7('0x40')]({},_0x2ebee8,_0xb29a56[_0x33f7('0x48')]);return _0x44afe2[_0x33f7('0x86')](_0x2ebee8);}})[_0x33f7('0x25')](function(_0x4086ee){if(_0x4086ee){_0x5f180d=_0x4086ee[_0x33f7('0x38')];if(!_0xb29a56[_0x33f7('0x32')]['hasOwnProperty'](_0x33f7('0x3a'))){_0x2ebee8[_0x33f7('0x21')]=qs[_0x33f7('0x21')](_0xb29a56[_0x33f7('0x32')][_0x33f7('0x21')]);_0x2ebee8[_0x33f7('0x1e')]=qs[_0x33f7('0x1e')](_0xb29a56[_0x33f7('0x32')][_0x33f7('0x1e')]);}return _0x44afe2[_0x33f7('0x86')](_0x2ebee8);}})['then'](function(_0x3cc1ce){if(_0x3cc1ce){return _0x3cc1ce?{'count':_0x5f180d,'rows':_0x3cc1ce}:null;}})[_0x33f7('0x25')](respondWithResult(_0x47249c,null))[_0x33f7('0x45')](handleError(_0x47249c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index cb0b439..bb2ce6d 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 _0x33bd=['emit','hook','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove'];(function(_0x2be2c7,_0x32900e){var _0x4cc9a7=function(_0x2a3c37){while(--_0x2a3c37){_0x2be2c7['push'](_0x2be2c7['shift']());}};_0x4cc9a7(++_0x32900e);}(_0x33bd,0x19a));var _0xd33b=function(_0x20369f,_0x5db98c){_0x20369f=_0x20369f-0x0;var _0x74c15d=_0x33bd[_0x20369f];return _0x74c15d;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xd33b('0x0'))['db'][_0xd33b('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd33b('0x2')](0x0);var events={'afterCreate':_0xd33b('0x3'),'afterUpdate':_0xd33b('0x4'),'afterDestroy':_0xd33b('0x5')};function emitEvent(_0x406a6d){return function(_0x39f82,_0x51e093,_0x11c609){WhatsappQueueEvents[_0xd33b('0x6')](_0x406a6d+':'+_0x39f82['id'],_0x39f82);WhatsappQueueEvents['emit'](_0x406a6d,_0x39f82);_0x11c609(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xd33b('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x306b=['hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','emit'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x306b,0x16b));var _0xb306=function(_0x36e3bc,_0x41ca82){_0x36e3bc=_0x36e3bc-0x0;var _0x1f8fcb=_0x306b[_0x36e3bc];return _0x1f8fcb;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xb306('0x0'))['db'][_0xb306('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb306('0x2')](0x0);var events={'afterCreate':_0xb306('0x3'),'afterUpdate':_0xb306('0x4'),'afterDestroy':'remove'};function emitEvent(_0x59b730){return function(_0x615031,_0x4fb2bf,_0x4b68d3){WhatsappQueueEvents[_0xb306('0x5')](_0x59b730+':'+_0x615031['id'],_0x615031);WhatsappQueueEvents[_0xb306('0x5')](_0x59b730,_0x615031);_0x4b68d3(null);};}for(var e in events){if(events[_0xb306('0x6')](e)){var event=events[e];WhatsappQueue[_0xb306('0x7')](e,emitEvent(event));}}module[_0xb306('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 11deb2b..41c2008 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 _0x5688=['api','request-promise','path','rimraf','exports','WhatsappQueue','util','../../config/logger'];(function(_0x4f6bbb,_0x3e628a){var _0x1a9332=function(_0x306e5d){while(--_0x306e5d){_0x4f6bbb['push'](_0x4f6bbb['shift']());}};_0x1a9332(++_0x3e628a);}(_0x5688,0x186));var _0x8568=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x5688[_0x29db36];return _0x234e87;};'use strict';var _=require('lodash');var util=require(_0x8568('0x0'));var logger=require(_0x8568('0x1'))(_0x8568('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8568('0x3'));var fs=require('fs');var path=require(_0x8568('0x4'));var rimraf=require(_0x8568('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x8568('0x6')]=function(_0x2f62af,_0x2d50fb){return _0x2f62af['define'](_0x8568('0x7'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb911=['./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x11beb3,_0x53eac6){var _0x1ce932=function(_0x8565f9){while(--_0x8565f9){_0x11beb3['push'](_0x11beb3['shift']());}};_0x1ce932(++_0x53eac6);}(_0xb911,0x94));var _0x1b91=function(_0x4c5013,_0x4198a1){_0x4c5013=_0x4c5013-0x0;var _0x2d1a74=_0xb911[_0x4c5013];return _0x2d1a74;};'use strict';var _=require(_0x1b91('0x0'));var util=require(_0x1b91('0x1'));var logger=require(_0x1b91('0x2'))(_0x1b91('0x3'));var moment=require('moment');var BPromise=require(_0x1b91('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b91('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1b91('0x6'));module[_0x1b91('0x7')]=function(_0x848944,_0x1915cf){return _0x848944[_0x1b91('0x8')](_0x1b91('0x9'),attributes,{'tableName':_0x1b91('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 800cd7d..85c9e1e 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 _0xdbfa=['jayson/promise','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','limit','include','model','map','catch','ShowWhatsappQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1f60c2,_0x46bd6b){var _0xc3ef84=function(_0x2484d4){while(--_0x2484d4){_0x1f60c2['push'](_0x1f60c2['shift']());}};_0xc3ef84(++_0x46bd6b);}(_0xdbfa,0x156));var _0xadbf=function(_0x44bb5e,_0x48ab50){_0x44bb5e=_0x44bb5e-0x0;var _0x490872=_0xdbfa[_0x44bb5e];return _0x490872;};'use strict';var _=require(_0xadbf('0x0'));var util=require(_0xadbf('0x1'));var moment=require(_0xadbf('0x2'));var BPromise=require(_0xadbf('0x3'));var rs=require(_0xadbf('0x4'));var fs=require('fs');var Redis=require(_0xadbf('0x5'));var db=require(_0xadbf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xadbf('0x7'))(_0xadbf('0x8'));var config=require(_0xadbf('0x9'));var jayson=require(_0xadbf('0xa'));var client=jayson[_0xadbf('0xb')][_0xadbf('0xc')]({'port':0x232a});config[_0xadbf('0xd')]=_[_0xadbf('0xe')](config[_0xadbf('0xd')],{'host':_0xadbf('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xadbf('0xd')]));require(_0xadbf('0x10'))[_0xadbf('0x11')](socket);function respondWithRpcPromise(_0x1f5ac6,_0x242021,_0x771208){return new BPromise(function(_0x2b62bf,_0x5b9c09){return client[_0xadbf('0x12')](_0x1f5ac6,_0x771208)[_0xadbf('0x13')](function(_0x5617bd){logger[_0xadbf('0x14')](_0xadbf('0x15'),_0x242021,_0xadbf('0x16'));logger[_0xadbf('0x17')](_0xadbf('0x18'),_0x242021,_0xadbf('0x16'),JSON[_0xadbf('0x19')](_0x5617bd));if(_0x5617bd[_0xadbf('0x1a')]){if(_0x5617bd[_0xadbf('0x1a')][_0xadbf('0x1b')]===0x1f4){logger['error'](_0xadbf('0x15'),_0x242021,_0x5617bd[_0xadbf('0x1a')][_0xadbf('0x1c')]);return _0x5b9c09(_0x5617bd['error']['message']);}logger['error'](_0xadbf('0x15'),_0x242021,_0x5617bd[_0xadbf('0x1a')][_0xadbf('0x1c')]);return _0x2b62bf(_0x5617bd['error'][_0xadbf('0x1c')]);}else{logger[_0xadbf('0x14')](_0xadbf('0x15'),_0x242021,_0xadbf('0x16'));_0x2b62bf(_0x5617bd[_0xadbf('0x1d')][_0xadbf('0x1c')]);}})['catch'](function(_0x1336d4){logger[_0xadbf('0x1a')](_0xadbf('0x15'),_0x242021,_0x1336d4);_0x5b9c09(_0x1336d4);});});}exports[_0xadbf('0x1e')]=function(_0x1b0857){var _0x3dc26f=this;return new Promise(function(_0x3dbbfa,_0x12e086){return db[_0xadbf('0x1f')][_0xadbf('0x20')]({'raw':_0x1b0857[_0xadbf('0x21')]?_0x1b0857[_0xadbf('0x21')][_0xadbf('0x22')]===undefined?!![]:![]:!![],'where':_0x1b0857['options']?_0x1b0857[_0xadbf('0x21')]['where']||null:null,'attributes':_0x1b0857['options']?_0x1b0857['options'][_0xadbf('0x23')]||null:null,'limit':_0x1b0857[_0xadbf('0x21')]?_0x1b0857[_0xadbf('0x21')][_0xadbf('0x24')]||null:null,'include':_0x1b0857[_0xadbf('0x21')]?_0x1b0857[_0xadbf('0x21')][_0xadbf('0x25')]?_['map'](_0x1b0857[_0xadbf('0x21')][_0xadbf('0x25')],function(_0x52959e){return{'model':db[_0x52959e[_0xadbf('0x26')]],'as':_0x52959e['as'],'attributes':_0x52959e['attributes'],'include':_0x52959e[_0xadbf('0x25')]?_[_0xadbf('0x27')](_0x52959e[_0xadbf('0x25')],function(_0x20298d){return{'model':db[_0x20298d[_0xadbf('0x26')]],'as':_0x20298d['as'],'attributes':_0x20298d[_0xadbf('0x23')],'include':_0x20298d[_0xadbf('0x25')]?_['map'](_0x20298d[_0xadbf('0x25')],function(_0x52a182){return{'model':db[_0x52a182['model']],'as':_0x52a182['as'],'attributes':_0x52a182[_0xadbf('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ccf35){logger[_0xadbf('0x14')](_0xadbf('0x1e'),_0x1b0857);logger[_0xadbf('0x17')](_0xadbf('0x1e'),_0x1b0857,JSON[_0xadbf('0x19')](_0x2ccf35));_0x3dbbfa(_0x2ccf35);})[_0xadbf('0x28')](function(_0x2b95d2){logger['error'](_0xadbf('0x1e'),_0x2b95d2[_0xadbf('0x1c')],_0x1b0857);_0x12e086(_0x3dc26f[_0xadbf('0x1a')](0x1f4,_0x2b95d2[_0xadbf('0x1c')]));});});};exports[_0xadbf('0x29')]=function(_0x11d007){var _0x265571=this;return new Promise(function(_0x41bf94,_0x33b5f4){return db[_0xadbf('0x1f')][_0xadbf('0x2a')]({'raw':_0x11d007[_0xadbf('0x21')]?_0x11d007[_0xadbf('0x21')][_0xadbf('0x22')]===undefined?!![]:![]:!![],'where':_0x11d007['options']?_0x11d007['options'][_0xadbf('0x2b')]||null:null,'attributes':_0x11d007['options']?_0x11d007[_0xadbf('0x21')][_0xadbf('0x23')]||null:null,'include':_0x11d007[_0xadbf('0x21')]?_0x11d007['options']['include']?_[_0xadbf('0x27')](_0x11d007[_0xadbf('0x21')][_0xadbf('0x25')],function(_0x44a9d6){return{'model':db[_0x44a9d6[_0xadbf('0x26')]],'as':_0x44a9d6['as'],'attributes':_0x44a9d6[_0xadbf('0x23')],'include':_0x44a9d6[_0xadbf('0x25')]?_['map'](_0x44a9d6[_0xadbf('0x25')],function(_0x11cb7b){return{'model':db[_0x11cb7b[_0xadbf('0x26')]],'as':_0x11cb7b['as'],'attributes':_0x11cb7b[_0xadbf('0x23')],'include':_0x11cb7b['include']?_[_0xadbf('0x27')](_0x11cb7b[_0xadbf('0x25')],function(_0x560786){return{'model':db[_0x560786[_0xadbf('0x26')]],'as':_0x560786['as'],'attributes':_0x560786[_0xadbf('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b4357){logger[_0xadbf('0x14')]('ShowWhatsappQueue',_0x11d007);logger[_0xadbf('0x17')](_0xadbf('0x29'),_0x11d007,JSON['stringify'](_0x4b4357));_0x41bf94(_0x4b4357);})[_0xadbf('0x28')](function(_0x2c18d6){logger['error'](_0xadbf('0x29'),_0x2c18d6[_0xadbf('0x1c')],_0x11d007);_0x33b5f4(_0x265571[_0xadbf('0x1a')](0x1f4,_0x2c18d6[_0xadbf('0x1c')]));});});}; \ No newline at end of file +var _0x268e=['options','raw','where','attributes','include','map','model','then','debug','stringify','WhatsappQueue','find','ShowWhatsappQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','WhatsappQueue,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetWhatsappQueue','findAll'];(function(_0x4782c9,_0x426746){var _0x43476d=function(_0x570dc8){while(--_0x570dc8){_0x4782c9['push'](_0x4782c9['shift']());}};_0x43476d(++_0x426746);}(_0x268e,0xa9));var _0xe268=function(_0x1cec42,_0x528fb5){_0x1cec42=_0x1cec42-0x0;var _0x569739=_0x268e[_0x1cec42];return _0x569739;};'use strict';var _=require('lodash');var util=require(_0xe268('0x0'));var moment=require(_0xe268('0x1'));var BPromise=require(_0xe268('0x2'));var rs=require(_0xe268('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe268('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe268('0x5'))(_0xe268('0x6'));var config=require(_0xe268('0x7'));var jayson=require(_0xe268('0x8'));var client=jayson[_0xe268('0x9')][_0xe268('0xa')]({'port':0x232a});config[_0xe268('0xb')]=_[_0xe268('0xc')](config[_0xe268('0xb')],{'host':_0xe268('0xd'),'port':0x18eb});var socket=require(_0xe268('0xe'))(new Redis(config[_0xe268('0xb')]));require(_0xe268('0xf'))['register'](socket);function respondWithRpcPromise(_0x93ca15,_0x3ca3c6,_0x5b0f6a){return new BPromise(function(_0x1b2632,_0x1cc517){return client['request'](_0x93ca15,_0x5b0f6a)['then'](function(_0x4dface){logger['info'](_0xe268('0x10'),_0x3ca3c6,_0xe268('0x11'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3ca3c6,_0xe268('0x11'),JSON['stringify'](_0x4dface));if(_0x4dface[_0xe268('0x12')]){if(_0x4dface[_0xe268('0x12')][_0xe268('0x13')]===0x1f4){logger[_0xe268('0x12')](_0xe268('0x10'),_0x3ca3c6,_0x4dface[_0xe268('0x12')][_0xe268('0x14')]);return _0x1cc517(_0x4dface[_0xe268('0x12')][_0xe268('0x14')]);}logger[_0xe268('0x12')](_0xe268('0x10'),_0x3ca3c6,_0x4dface[_0xe268('0x12')]['message']);return _0x1b2632(_0x4dface[_0xe268('0x12')][_0xe268('0x14')]);}else{logger[_0xe268('0x15')](_0xe268('0x10'),_0x3ca3c6,_0xe268('0x11'));_0x1b2632(_0x4dface[_0xe268('0x16')][_0xe268('0x14')]);}})[_0xe268('0x17')](function(_0x218141){logger[_0xe268('0x12')](_0xe268('0x10'),_0x3ca3c6,_0x218141);_0x1cc517(_0x218141);});});}exports[_0xe268('0x18')]=function(_0x513fb2){var _0x275a9c=this;return new Promise(function(_0x138615,_0x21cfe3){return db['WhatsappQueue'][_0xe268('0x19')]({'raw':_0x513fb2['options']?_0x513fb2[_0xe268('0x1a')][_0xe268('0x1b')]===undefined?!![]:![]:!![],'where':_0x513fb2[_0xe268('0x1a')]?_0x513fb2['options'][_0xe268('0x1c')]||null:null,'attributes':_0x513fb2[_0xe268('0x1a')]?_0x513fb2['options'][_0xe268('0x1d')]||null:null,'limit':_0x513fb2['options']?_0x513fb2[_0xe268('0x1a')]['limit']||null:null,'include':_0x513fb2['options']?_0x513fb2[_0xe268('0x1a')][_0xe268('0x1e')]?_[_0xe268('0x1f')](_0x513fb2[_0xe268('0x1a')]['include'],function(_0x370e49){return{'model':db[_0x370e49[_0xe268('0x20')]],'as':_0x370e49['as'],'attributes':_0x370e49[_0xe268('0x1d')],'include':_0x370e49[_0xe268('0x1e')]?_[_0xe268('0x1f')](_0x370e49[_0xe268('0x1e')],function(_0x3ae6ff){return{'model':db[_0x3ae6ff[_0xe268('0x20')]],'as':_0x3ae6ff['as'],'attributes':_0x3ae6ff[_0xe268('0x1d')],'include':_0x3ae6ff[_0xe268('0x1e')]?_[_0xe268('0x1f')](_0x3ae6ff[_0xe268('0x1e')],function(_0x5a08a0){return{'model':db[_0x5a08a0['model']],'as':_0x5a08a0['as'],'attributes':_0x5a08a0[_0xe268('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe268('0x21')](function(_0x5243ce){logger[_0xe268('0x15')](_0xe268('0x18'),_0x513fb2);logger[_0xe268('0x22')](_0xe268('0x18'),_0x513fb2,JSON[_0xe268('0x23')](_0x5243ce));_0x138615(_0x5243ce);})['catch'](function(_0x4247a8){logger[_0xe268('0x12')](_0xe268('0x18'),_0x4247a8[_0xe268('0x14')],_0x513fb2);_0x21cfe3(_0x275a9c[_0xe268('0x12')](0x1f4,_0x4247a8['message']));});});};exports['ShowWhatsappQueue']=function(_0x149e0){var _0x1d4820=this;return new Promise(function(_0x4f0633,_0x18ee06){return db[_0xe268('0x24')][_0xe268('0x25')]({'raw':_0x149e0[_0xe268('0x1a')]?_0x149e0['options'][_0xe268('0x1b')]===undefined?!![]:![]:!![],'where':_0x149e0[_0xe268('0x1a')]?_0x149e0[_0xe268('0x1a')][_0xe268('0x1c')]||null:null,'attributes':_0x149e0[_0xe268('0x1a')]?_0x149e0['options'][_0xe268('0x1d')]||null:null,'include':_0x149e0[_0xe268('0x1a')]?_0x149e0[_0xe268('0x1a')][_0xe268('0x1e')]?_[_0xe268('0x1f')](_0x149e0[_0xe268('0x1a')][_0xe268('0x1e')],function(_0x8045db){return{'model':db[_0x8045db[_0xe268('0x20')]],'as':_0x8045db['as'],'attributes':_0x8045db[_0xe268('0x1d')],'include':_0x8045db['include']?_[_0xe268('0x1f')](_0x8045db[_0xe268('0x1e')],function(_0xe225c){return{'model':db[_0xe225c[_0xe268('0x20')]],'as':_0xe225c['as'],'attributes':_0xe225c[_0xe268('0x1d')],'include':_0xe225c[_0xe268('0x1e')]?_[_0xe268('0x1f')](_0xe225c[_0xe268('0x1e')],function(_0x3cd87d){return{'model':db[_0x3cd87d[_0xe268('0x20')]],'as':_0x3cd87d['as'],'attributes':_0x3cd87d[_0xe268('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe268('0x21')](function(_0x2fecc8){logger['info'](_0xe268('0x26'),_0x149e0);logger['debug']('ShowWhatsappQueue',_0x149e0,JSON[_0xe268('0x23')](_0x2fecc8));_0x4f0633(_0x2fecc8);})['catch'](function(_0x38477a){logger[_0xe268('0x12')](_0xe268('0x26'),_0x38477a[_0xe268('0x14')],_0x149e0);_0x18ee06(_0x1d4820[_0xe268('0x12')](0x1f4,_0x38477a[_0xe268('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 1e97ddb..e9077ee 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 _0x40cf=['whatsappQueue:','./whatsappQueue.events','save','remove','update','removeListener','length'];(function(_0x5eb5e2,_0x44c89e){var _0x44e6a5=function(_0x6f8322){while(--_0x6f8322){_0x5eb5e2['push'](_0x5eb5e2['shift']());}};_0x44e6a5(++_0x44c89e);}(_0x40cf,0xa9));var _0xf40c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x40cf[_0x14add3];return _0x4a174f;};'use strict';var WhatsappQueueEvents=require(_0xf40c('0x0'));var events=[_0xf40c('0x1'),_0xf40c('0x2'),_0xf40c('0x3')];function createListener(_0xffdea6,_0x3b3dc5){return function(_0x24db5c){_0x3b3dc5['emit'](_0xffdea6,_0x24db5c);};}function removeListener(_0x55ec1d,_0x2f7ed5){return function(){WhatsappQueueEvents[_0xf40c('0x4')](_0x55ec1d,_0x2f7ed5);};}exports['register']=function(_0x2b21dd){for(var _0x56da7b=0x0,_0x1d59ef=events[_0xf40c('0x5')];_0x56da7b<_0x1d59ef;_0x56da7b++){var _0x39a0f1=events[_0x56da7b];var _0x3ef571=createListener(_0xf40c('0x6')+_0x39a0f1,_0x2b21dd);WhatsappQueueEvents['on'](_0x39a0f1,_0x3ef571);}}; \ No newline at end of file +var _0x2121=['length','whatsappQueue:','./whatsappQueue.events','save','remove','update','removeListener'];(function(_0xedf7f8,_0x5d53a6){var _0x104ff4=function(_0x3a733a){while(--_0x3a733a){_0xedf7f8['push'](_0xedf7f8['shift']());}};_0x104ff4(++_0x5d53a6);}(_0x2121,0xa3));var _0x1212=function(_0x2e9d3e,_0xf4e8d4){_0x2e9d3e=_0x2e9d3e-0x0;var _0x5571d4=_0x2121[_0x2e9d3e];return _0x5571d4;};'use strict';var WhatsappQueueEvents=require(_0x1212('0x0'));var events=[_0x1212('0x1'),_0x1212('0x2'),_0x1212('0x3')];function createListener(_0x4c420d,_0x54c4e9){return function(_0x4c9e5a){_0x54c4e9['emit'](_0x4c420d,_0x4c9e5a);};}function removeListener(_0x57c86e,_0x48a999){return function(){WhatsappQueueEvents[_0x1212('0x4')](_0x57c86e,_0x48a999);};}exports['register']=function(_0x23e39c){for(var _0x1cd607=0x0,_0x3f0863=events[_0x1212('0x5')];_0x1cd607<_0x3f0863;_0x1cd607++){var _0x2e42dd=events[_0x1cd607];var _0xf04123=createListener(_0x1212('0x6')+_0x2e42dd,_0x23e39c);WhatsappQueueEvents['on'](_0x2e42dd,_0xf04123);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 04efb06..7eec9c1 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 _0x825d=['/:id','update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','create','put'];(function(_0x5f5225,_0x224c7d){var _0x30efee=function(_0xfe1afa){while(--_0xfe1afa){_0x5f5225['push'](_0x5f5225['shift']());}};_0x30efee(++_0x224c7d);}(_0x825d,0x7b));var _0xd825=function(_0x3609f8,_0x2cf633){_0x3609f8=_0x3609f8-0x0;var _0x4fcdd3=_0x825d[_0x3609f8];return _0x4fcdd3;};'use strict';var multer=require('multer');var util=require(_0xd825('0x0'));var path=require(_0xd825('0x1'));var timeout=require(_0xd825('0x2'));var express=require(_0xd825('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd825('0x4'));var interaction=require(_0xd825('0x5'));var config=require(_0xd825('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0xd825('0x7')]('/',auth['isAuthenticated'](),controller[_0xd825('0x8')]);router[_0xd825('0x7')](_0xd825('0x9'),auth[_0xd825('0xa')](),controller['describe']);router[_0xd825('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xd825('0xa')](),controller[_0xd825('0xb')]);router[_0xd825('0xc')](_0xd825('0xd'),auth[_0xd825('0xa')](),controller[_0xd825('0xe')]);router[_0xd825('0xf')](_0xd825('0xd'),auth[_0xd825('0xa')](),controller[_0xd825('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd254=['isAuthenticated','show','post','create','put','delete','/:id','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd254,0x1dc));var _0x4d25=function(_0x3a1fdb,_0x57fc8c){_0x3a1fdb=_0x3a1fdb-0x0;var _0xb900db=_0xd254[_0x3a1fdb];return _0xb900db;};'use strict';var multer=require(_0x4d25('0x0'));var util=require('util');var path=require(_0x4d25('0x1'));var timeout=require(_0x4d25('0x2'));var express=require(_0x4d25('0x3'));var router=express[_0x4d25('0x4')]();var fs_extra=require(_0x4d25('0x5'));var auth=require(_0x4d25('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4d25('0x7'));var controller=require(_0x4d25('0x8'));router[_0x4d25('0x9')]('/',auth[_0x4d25('0xa')](),controller['index']);router['get']('/describe',auth[_0x4d25('0xa')](),controller['describe']);router[_0x4d25('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4d25('0xb')]);router[_0x4d25('0xc')]('/',auth[_0x4d25('0xa')](),controller[_0x4d25('0xd')]);router[_0x4d25('0xe')]('/:id',auth[_0x4d25('0xa')](),controller['update']);router[_0x4d25('0xf')](_0x4d25('0x10'),auth[_0x4d25('0xa')](),controller[_0x4d25('0x11')]);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 2bc4a55..1ae7689 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(_0x13fa16,_0x3f5320){var _0x361d97=function(_0x434c2a){while(--_0x434c2a){_0x13fa16['push'](_0x13fa16['shift']());}};_0x361d97(++_0x3f5320);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x55eb48,_0x4c4fc6){var _0x44ac24=function(_0x49d4d6){while(--_0x49d4d6){_0x55eb48['push'](_0x55eb48['shift']());}};_0x44ac24(++_0x4c4fc6);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index be39699..94f2daa 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 _0xbfcc=['destroy','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','offset','count','set','Content-Range','json','reject','then'];(function(_0x3bee7a,_0x95a83d){var _0x3a9081=function(_0x296808){while(--_0x296808){_0x3bee7a['push'](_0x3bee7a['shift']());}};_0x3a9081(++_0x95a83d);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xbfcc[_0x1992f1];return _0x413dfe;};'use strict';var emlformat=require(_0xcbfc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcbfc('0x1'));var rp=require(_0xcbfc('0x2'));var moment=require(_0xcbfc('0x3'));var BPromise=require(_0xcbfc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcbfc('0x5'));var ejs=require(_0xcbfc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbfc('0x7'));var squel=require('squel');var crypto=require(_0xcbfc('0x8'));var jsforce=require(_0xcbfc('0x9'));var deskjs=require(_0xcbfc('0xa'));var toCsv=require(_0xcbfc('0x5'));var querystring=require('querystring');var Papa=require(_0xcbfc('0xb'));var Redis=require(_0xcbfc('0xc'));var authService=require(_0xcbfc('0xd'));var qs=require(_0xcbfc('0xe'));var as=require(_0xcbfc('0xf'));var hardwareService=require(_0xcbfc('0x10'));var logger=require('../../config/logger')(_0xcbfc('0x11'));var utils=require(_0xcbfc('0x12'));var config=require(_0xcbfc('0x13'));var licenseUtil=require(_0xcbfc('0x14'));var db=require(_0xcbfc('0x15'))['db'];function respondWithStatusCode(_0x4e8b34,_0x3bfd05){_0x3bfd05=_0x3bfd05||0xcc;return function(_0x86f67c){if(_0x86f67c){return _0x4e8b34[_0xcbfc('0x16')](_0x3bfd05);}return _0x4e8b34['status'](_0x3bfd05)[_0xcbfc('0x17')]();};}function respondWithResult(_0x3ec338,_0x2f2bdd){_0x2f2bdd=_0x2f2bdd||0xc8;return function(_0x45a5cc){if(_0x45a5cc){return _0x3ec338[_0xcbfc('0x18')](_0x2f2bdd)['json'](_0x45a5cc);}};}function respondWithFilteredResult(_0x3c69ed,_0x1963de){return function(_0x1ec8c4){if(_0x1ec8c4){var _0x4317e4=typeof _0x1963de['offset']==='undefined'&&typeof _0x1963de[_0xcbfc('0x19')]===_0xcbfc('0x1a');var _0xa65368=_0x1ec8c4['count'];var _0x5b078f=_0x4317e4?0x0:_0x1963de[_0xcbfc('0x1b')];var _0x99b59d=_0x4317e4?_0x1ec8c4[_0xcbfc('0x1c')]:_0x1963de['offset']+_0x1963de[_0xcbfc('0x19')];var _0x552777;if(_0x99b59d>=_0xa65368){_0x99b59d=_0xa65368;_0x552777=0xc8;}else{_0x552777=0xce;}_0x3c69ed[_0xcbfc('0x18')](_0x552777);return _0x3c69ed[_0xcbfc('0x1d')](_0xcbfc('0x1e'),_0x5b078f+'-'+_0x99b59d+'/'+_0xa65368)[_0xcbfc('0x1f')](_0x1ec8c4);}return null;};}function patchUpdates(_0x25c167){return function(_0x2653b1){try{jsonpatch['apply'](_0x2653b1,_0x25c167,!![]);}catch(_0x9c79da){return BPromise[_0xcbfc('0x20')](_0x9c79da);}return _0x2653b1['save']();};}function saveUpdates(_0x1da958,_0x5a449b){return function(_0x4cc8b3){if(_0x4cc8b3){return _0x4cc8b3['update'](_0x1da958)[_0xcbfc('0x21')](function(_0x4a0fcb){return _0x4a0fcb;});}return null;};}function removeEntity(_0x4a1915,_0x1b3e42){return function(_0x34cffa){if(_0x34cffa){return _0x34cffa[_0xcbfc('0x22')]()[_0xcbfc('0x21')](function(){_0x4a1915['status'](0xcc)[_0xcbfc('0x17')]();});}};}function handleEntityNotFound(_0x51284a,_0x280b78){return function(_0x75bca0){if(!_0x75bca0){_0x51284a['sendStatus'](0x194);}return _0x75bca0;};}function handleError(_0x28bdcf,_0x3b73a3){_0x3b73a3=_0x3b73a3||0x1f4;return function(_0x4ab48e){logger[_0xcbfc('0x23')](_0x4ab48e[_0xcbfc('0x24')]);if(_0x4ab48e[_0xcbfc('0x25')]){delete _0x4ab48e[_0xcbfc('0x25')];}_0x28bdcf['status'](_0x3b73a3)[_0xcbfc('0x26')](_0x4ab48e);};}exports[_0xcbfc('0x27')]=function(_0x4f632a,_0x1f6a14){var _0x26463f={},_0x7cbdfa={},_0x388d41={'count':0x0,'rows':[]};var _0x2b4286=_[_0xcbfc('0x28')](db[_0xcbfc('0x29')]['rawAttributes'],function(_0x41b68b){return{'name':_0x41b68b[_0xcbfc('0x2a')],'type':_0x41b68b[_0xcbfc('0x2b')][_0xcbfc('0x2c')]};});_0x7cbdfa['model']=_[_0xcbfc('0x28')](_0x2b4286,_0xcbfc('0x25'));_0x7cbdfa[_0xcbfc('0x2d')]=_[_0xcbfc('0x2e')](_0x4f632a[_0xcbfc('0x2d')]);_0x7cbdfa[_0xcbfc('0x2f')]=_[_0xcbfc('0x30')](_0x7cbdfa['model'],_0x7cbdfa[_0xcbfc('0x2d')]);_0x26463f[_0xcbfc('0x31')]=_['intersection'](_0x7cbdfa[_0xcbfc('0x32')],qs[_0xcbfc('0x33')](_0x4f632a[_0xcbfc('0x2d')]['fields']));_0x26463f['attributes']=_0x26463f['attributes'][_0xcbfc('0x34')]?_0x26463f[_0xcbfc('0x31')]:_0x7cbdfa[_0xcbfc('0x32')];if(!_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x35')](_0xcbfc('0x36'))){_0x26463f[_0xcbfc('0x19')]=qs[_0xcbfc('0x19')](_0x4f632a['query'][_0xcbfc('0x19')]);_0x26463f[_0xcbfc('0x1b')]=qs['offset'](_0x4f632a[_0xcbfc('0x2d')]['offset']);}_0x26463f[_0xcbfc('0x37')]=qs[_0xcbfc('0x38')](_0x4f632a[_0xcbfc('0x2d')]['sort']);_0x26463f[_0xcbfc('0x39')]=qs['filters'](_['pick'](_0x4f632a[_0xcbfc('0x2d')],_0x7cbdfa[_0xcbfc('0x2f')]),_0x2b4286);if(_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3a')]){_0x26463f[_0xcbfc('0x39')]=_[_0xcbfc('0x3b')](_0x26463f[_0xcbfc('0x39')],{'$or':_[_0xcbfc('0x28')](_0x2b4286,function(_0x5cf4fa){if(_0x5cf4fa[_0xcbfc('0x2b')]!=='VIRTUAL'){var _0x15a5c4={};_0x15a5c4[_0x5cf4fa[_0xcbfc('0x25')]]={'$like':'%'+_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3a')]+'%'};return _0x15a5c4;}})});}_0x26463f=_['merge']({},_0x26463f,_0x4f632a['options']);var _0x236b66={'where':_0x26463f[_0xcbfc('0x39')]};return db[_0xcbfc('0x29')][_0xcbfc('0x1c')](_0x236b66)[_0xcbfc('0x21')](function(_0x4aa189){_0x388d41[_0xcbfc('0x1c')]=_0x4aa189;if(_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3c')]){_0x26463f['include']=[{'all':!![]}];}return db[_0xcbfc('0x29')][_0xcbfc('0x3d')](_0x26463f);})[_0xcbfc('0x21')](function(_0x4ca55c){_0x388d41[_0xcbfc('0x3e')]=_0x4ca55c;return _0x388d41;})[_0xcbfc('0x21')](respondWithFilteredResult(_0x1f6a14,_0x26463f))[_0xcbfc('0x3f')](handleError(_0x1f6a14,null));};exports[_0xcbfc('0x40')]=function(_0x102f4f,_0x28447a){var _0x1e14bb={'raw':!![],'where':{'id':_0x102f4f[_0xcbfc('0x41')]['id']}},_0x561544={};_0x561544[_0xcbfc('0x32')]=_['keys'](db[_0xcbfc('0x29')][_0xcbfc('0x42')]);_0x561544[_0xcbfc('0x2d')]=_[_0xcbfc('0x2e')](_0x102f4f[_0xcbfc('0x2d')]);_0x561544[_0xcbfc('0x2f')]=_[_0xcbfc('0x30')](_0x561544[_0xcbfc('0x32')],_0x561544['query']);_0x1e14bb[_0xcbfc('0x31')]=_[_0xcbfc('0x30')](_0x561544[_0xcbfc('0x32')],qs[_0xcbfc('0x33')](_0x102f4f[_0xcbfc('0x2d')][_0xcbfc('0x33')]));_0x1e14bb[_0xcbfc('0x31')]=_0x1e14bb['attributes'][_0xcbfc('0x34')]?_0x1e14bb[_0xcbfc('0x31')]:_0x561544['model'];if(_0x102f4f[_0xcbfc('0x2d')][_0xcbfc('0x3c')]){_0x1e14bb[_0xcbfc('0x43')]=[{'all':!![]}];}_0x1e14bb=_['merge']({},_0x1e14bb,_0x102f4f[_0xcbfc('0x44')]);return db[_0xcbfc('0x29')][_0xcbfc('0x45')](_0x1e14bb)[_0xcbfc('0x21')](handleEntityNotFound(_0x28447a,null))[_0xcbfc('0x21')](respondWithResult(_0x28447a,null))[_0xcbfc('0x3f')](handleError(_0x28447a,null));};exports[_0xcbfc('0x46')]=function(_0x55fc0b,_0x5a87b6){return db[_0xcbfc('0x29')][_0xcbfc('0x46')](_0x55fc0b[_0xcbfc('0x47')],{})[_0xcbfc('0x21')](respondWithResult(_0x5a87b6,0xc9))['catch'](handleError(_0x5a87b6,null));};exports['update']=function(_0x2e89bf,_0xe5c5ef){if(_0x2e89bf[_0xcbfc('0x47')]['id']){delete _0x2e89bf['body']['id'];}return db[_0xcbfc('0x29')][_0xcbfc('0x45')]({'where':{'id':_0x2e89bf[_0xcbfc('0x41')]['id']}})['then'](handleEntityNotFound(_0xe5c5ef,null))[_0xcbfc('0x21')](saveUpdates(_0x2e89bf[_0xcbfc('0x47')],null))[_0xcbfc('0x21')](respondWithResult(_0xe5c5ef,null))[_0xcbfc('0x3f')](handleError(_0xe5c5ef,null));};exports[_0xcbfc('0x22')]=function(_0xd9976d,_0x222b58){return db[_0xcbfc('0x29')][_0xcbfc('0x45')]({'where':{'id':_0xd9976d[_0xcbfc('0x41')]['id']}})['then'](handleEntityNotFound(_0x222b58,null))[_0xcbfc('0x21')](removeEntity(_0x222b58,null))[_0xcbfc('0x3f')](handleError(_0x222b58,null));};exports[_0xcbfc('0x48')]=function(_0x5c2ad9,_0x28ae7f){return db[_0xcbfc('0x29')]['describe']()[_0xcbfc('0x21')](respondWithResult(_0x28ae7f,null))[_0xcbfc('0x3f')](handleError(_0x28ae7f,null));}; \ No newline at end of file +var _0x57f8=['filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','sort'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x57f8,0x198));var _0x857f=function(_0x34e830,_0x3c3620){_0x34e830=_0x34e830-0x0;var _0x462e4b=_0x57f8[_0x34e830];return _0x462e4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x857f('0x0'));var zipdir=require(_0x857f('0x1'));var jsonpatch=require(_0x857f('0x2'));var rp=require(_0x857f('0x3'));var moment=require(_0x857f('0x4'));var BPromise=require(_0x857f('0x5'));var Mustache=require(_0x857f('0x6'));var util=require(_0x857f('0x7'));var path=require(_0x857f('0x8'));var sox=require(_0x857f('0x9'));var csv=require(_0x857f('0xa'));var ejs=require(_0x857f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x857f('0xc'));var squel=require(_0x857f('0xd'));var crypto=require(_0x857f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x857f('0xf'));var toCsv=require(_0x857f('0xa'));var querystring=require(_0x857f('0x10'));var Papa=require('papaparse');var Redis=require(_0x857f('0x11'));var authService=require(_0x857f('0x12'));var qs=require(_0x857f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x857f('0x14'));var logger=require(_0x857f('0x15'))(_0x857f('0x16'));var utils=require(_0x857f('0x17'));var config=require(_0x857f('0x18'));var licenseUtil=require(_0x857f('0x19'));var db=require(_0x857f('0x1a'))['db'];function respondWithStatusCode(_0x533631,_0x2e1eda){_0x2e1eda=_0x2e1eda||0xcc;return function(_0x2d5e26){if(_0x2d5e26){return _0x533631[_0x857f('0x1b')](_0x2e1eda);}return _0x533631[_0x857f('0x1c')](_0x2e1eda)[_0x857f('0x1d')]();};}function respondWithResult(_0x4a25ec,_0x4bc590){_0x4bc590=_0x4bc590||0xc8;return function(_0x3b09d9){if(_0x3b09d9){return _0x4a25ec['status'](_0x4bc590)[_0x857f('0x1e')](_0x3b09d9);}};}function respondWithFilteredResult(_0x4ac81f,_0x1d47bf){return function(_0x134a4f){if(_0x134a4f){var _0x5c3a69=typeof _0x1d47bf[_0x857f('0x1f')]===_0x857f('0x20')&&typeof _0x1d47bf[_0x857f('0x21')]===_0x857f('0x20');var _0x279e74=_0x134a4f[_0x857f('0x22')];var _0x1a9ef8=_0x5c3a69?0x0:_0x1d47bf[_0x857f('0x1f')];var _0x1014ca=_0x5c3a69?_0x134a4f[_0x857f('0x22')]:_0x1d47bf[_0x857f('0x1f')]+_0x1d47bf['limit'];var _0x1729d8;if(_0x1014ca>=_0x279e74){_0x1014ca=_0x279e74;_0x1729d8=0xc8;}else{_0x1729d8=0xce;}_0x4ac81f[_0x857f('0x1c')](_0x1729d8);return _0x4ac81f['set'](_0x857f('0x23'),_0x1a9ef8+'-'+_0x1014ca+'/'+_0x279e74)[_0x857f('0x1e')](_0x134a4f);}return null;};}function patchUpdates(_0x377587){return function(_0x484035){try{jsonpatch['apply'](_0x484035,_0x377587,!![]);}catch(_0x12ee77){return BPromise[_0x857f('0x24')](_0x12ee77);}return _0x484035[_0x857f('0x25')]();};}function saveUpdates(_0x4fa031,_0x118237){return function(_0x17a98e){if(_0x17a98e){return _0x17a98e[_0x857f('0x26')](_0x4fa031)['then'](function(_0x1961ea){return _0x1961ea;});}return null;};}function removeEntity(_0x14a8ce,_0x50bfb7){return function(_0x3bc543){if(_0x3bc543){return _0x3bc543[_0x857f('0x27')]()[_0x857f('0x28')](function(){_0x14a8ce[_0x857f('0x1c')](0xcc)[_0x857f('0x1d')]();});}};}function handleEntityNotFound(_0x3b23a7,_0x233a68){return function(_0x2a89ba){if(!_0x2a89ba){_0x3b23a7[_0x857f('0x1b')](0x194);}return _0x2a89ba;};}function handleError(_0xcd1ee9,_0x72f0aa){_0x72f0aa=_0x72f0aa||0x1f4;return function(_0x4782ab){logger[_0x857f('0x29')](_0x4782ab[_0x857f('0x2a')]);if(_0x4782ab['name']){delete _0x4782ab[_0x857f('0x2b')];}_0xcd1ee9[_0x857f('0x1c')](_0x72f0aa)[_0x857f('0x2c')](_0x4782ab);};}exports[_0x857f('0x2d')]=function(_0x58c2de,_0x40c306){var _0x57ceaa={},_0x1b405a={},_0x234048={'count':0x0,'rows':[]};var _0x45a37f=_[_0x857f('0x2e')](db[_0x857f('0x2f')][_0x857f('0x30')],function(_0x1c4fff){return{'name':_0x1c4fff[_0x857f('0x31')],'type':_0x1c4fff[_0x857f('0x32')][_0x857f('0x33')]};});_0x1b405a[_0x857f('0x34')]=_[_0x857f('0x2e')](_0x45a37f,_0x857f('0x2b'));_0x1b405a['query']=_[_0x857f('0x35')](_0x58c2de[_0x857f('0x36')]);_0x1b405a['filters']=_[_0x857f('0x37')](_0x1b405a[_0x857f('0x34')],_0x1b405a['query']);_0x57ceaa[_0x857f('0x38')]=_[_0x857f('0x37')](_0x1b405a['model'],qs[_0x857f('0x39')](_0x58c2de[_0x857f('0x36')][_0x857f('0x39')]));_0x57ceaa[_0x857f('0x38')]=_0x57ceaa['attributes']['length']?_0x57ceaa[_0x857f('0x38')]:_0x1b405a[_0x857f('0x34')];if(!_0x58c2de['query'][_0x857f('0x3a')]('nolimit')){_0x57ceaa[_0x857f('0x21')]=qs[_0x857f('0x21')](_0x58c2de[_0x857f('0x36')][_0x857f('0x21')]);_0x57ceaa[_0x857f('0x1f')]=qs['offset'](_0x58c2de['query'][_0x857f('0x1f')]);}_0x57ceaa['order']=qs[_0x857f('0x3b')](_0x58c2de[_0x857f('0x36')][_0x857f('0x3b')]);_0x57ceaa['where']=qs[_0x857f('0x3c')](_[_0x857f('0x3d')](_0x58c2de[_0x857f('0x36')],_0x1b405a[_0x857f('0x3c')]),_0x45a37f);if(_0x58c2de[_0x857f('0x36')][_0x857f('0x3e')]){_0x57ceaa[_0x857f('0x3f')]=_['merge'](_0x57ceaa[_0x857f('0x3f')],{'$or':_[_0x857f('0x2e')](_0x45a37f,function(_0x1f285c){if(_0x1f285c[_0x857f('0x32')]!==_0x857f('0x40')){var _0x2356fb={};_0x2356fb[_0x1f285c[_0x857f('0x2b')]]={'$like':'%'+_0x58c2de['query'][_0x857f('0x3e')]+'%'};return _0x2356fb;}})});}_0x57ceaa=_[_0x857f('0x41')]({},_0x57ceaa,_0x58c2de[_0x857f('0x42')]);var _0xc2ac41={'where':_0x57ceaa[_0x857f('0x3f')]};return db[_0x857f('0x2f')]['count'](_0xc2ac41)[_0x857f('0x28')](function(_0x354678){_0x234048[_0x857f('0x22')]=_0x354678;if(_0x58c2de[_0x857f('0x36')][_0x857f('0x43')]){_0x57ceaa[_0x857f('0x44')]=[{'all':!![]}];}return db[_0x857f('0x2f')][_0x857f('0x45')](_0x57ceaa);})['then'](function(_0x40fb37){_0x234048[_0x857f('0x46')]=_0x40fb37;return _0x234048;})[_0x857f('0x28')](respondWithFilteredResult(_0x40c306,_0x57ceaa))[_0x857f('0x47')](handleError(_0x40c306,null));};exports[_0x857f('0x48')]=function(_0x1bbf9f,_0x374b9f){var _0x42d922={'raw':!![],'where':{'id':_0x1bbf9f[_0x857f('0x49')]['id']}},_0xb4d7c2={};_0xb4d7c2[_0x857f('0x34')]=_[_0x857f('0x35')](db[_0x857f('0x2f')][_0x857f('0x30')]);_0xb4d7c2['query']=_[_0x857f('0x35')](_0x1bbf9f['query']);_0xb4d7c2[_0x857f('0x3c')]=_[_0x857f('0x37')](_0xb4d7c2[_0x857f('0x34')],_0xb4d7c2[_0x857f('0x36')]);_0x42d922[_0x857f('0x38')]=_[_0x857f('0x37')](_0xb4d7c2[_0x857f('0x34')],qs[_0x857f('0x39')](_0x1bbf9f[_0x857f('0x36')][_0x857f('0x39')]));_0x42d922[_0x857f('0x38')]=_0x42d922['attributes']['length']?_0x42d922[_0x857f('0x38')]:_0xb4d7c2['model'];if(_0x1bbf9f[_0x857f('0x36')]['includeAll']){_0x42d922[_0x857f('0x44')]=[{'all':!![]}];}_0x42d922=_[_0x857f('0x41')]({},_0x42d922,_0x1bbf9f[_0x857f('0x42')]);return db[_0x857f('0x2f')][_0x857f('0x4a')](_0x42d922)[_0x857f('0x28')](handleEntityNotFound(_0x374b9f,null))[_0x857f('0x28')](respondWithResult(_0x374b9f,null))[_0x857f('0x47')](handleError(_0x374b9f,null));};exports['create']=function(_0x42cf05,_0x3b431d){return db[_0x857f('0x2f')][_0x857f('0x4b')](_0x42cf05['body'],{})[_0x857f('0x28')](respondWithResult(_0x3b431d,0xc9))[_0x857f('0x47')](handleError(_0x3b431d,null));};exports[_0x857f('0x26')]=function(_0x736ef6,_0x67563){if(_0x736ef6['body']['id']){delete _0x736ef6[_0x857f('0x4c')]['id'];}return db[_0x857f('0x2f')]['find']({'where':{'id':_0x736ef6[_0x857f('0x49')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x67563,null))['then'](saveUpdates(_0x736ef6[_0x857f('0x4c')],null))['then'](respondWithResult(_0x67563,null))[_0x857f('0x47')](handleError(_0x67563,null));};exports[_0x857f('0x27')]=function(_0x446fe9,_0x2008d5){return db[_0x857f('0x2f')][_0x857f('0x4a')]({'where':{'id':_0x446fe9[_0x857f('0x49')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x2008d5,null))[_0x857f('0x28')](removeEntity(_0x2008d5,null))[_0x857f('0x47')](handleError(_0x2008d5,null));};exports['describe']=function(_0x5464f4,_0x13ef75){return db[_0x857f('0x2f')][_0x857f('0x4d')]()[_0x857f('0x28')](respondWithResult(_0x13ef75,null))[_0x857f('0x47')](handleError(_0x13ef75,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index a365900..9e7eb49 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 _0x02fd=['request-promise','path','rimraf','../../config/environment','define','WhatsappQueueReport','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x02fd,0xdf));var _0xd02f=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x02fd[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0xd02f('0x0'));var util=require('util');var logger=require(_0xd02f('0x1'))(_0xd02f('0x2'));var moment=require(_0xd02f('0x3'));var BPromise=require(_0xd02f('0x4'));var rp=require(_0xd02f('0x5'));var fs=require('fs');var path=require(_0xd02f('0x6'));var rimraf=require(_0xd02f('0x7'));var config=require(_0xd02f('0x8'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x1c1d9c,_0x2440e7){return _0x1c1d9c[_0xd02f('0x9')](_0xd02f('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xd02f('0xb'),'fields':[_0xd02f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf02=['define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x261be6,_0x5e3734){var _0x5030a3=function(_0x5668aa){while(--_0x5668aa){_0x261be6['push'](_0x261be6['shift']());}};_0x5030a3(++_0x5e3734);}(_0xdf02,0x118));var _0x2df0=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xdf02[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0x2df0('0x0'));var logger=require(_0x2df0('0x1'))(_0x2df0('0x2'));var moment=require('moment');var BPromise=require(_0x2df0('0x3'));var rp=require(_0x2df0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2df0('0x5'));var config=require(_0x2df0('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x2df0('0x7')]=function(_0x156020,_0x446806){return _0x156020[_0x2df0('0x8')](_0x2df0('0x9'),attributes,{'tableName':_0x2df0('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2df0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 1e19b7b..1312459 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 _0xdff5=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','WhatsappQueueReport','create','body','options','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','raw','attributes','limit','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x4950e5,_0x3558ea){var _0x5be113=function(_0x4e3716){while(--_0x4e3716){_0x4950e5['push'](_0x4950e5['shift']());}};_0x5be113(++_0x3558ea);}(_0xdff5,0x1bb));var _0x5dff=function(_0x3d7b67,_0x1fb5bd){_0x3d7b67=_0x3d7b67-0x0;var _0x514c12=_0xdff5[_0x3d7b67];return _0x514c12;};'use strict';var _=require(_0x5dff('0x0'));var util=require(_0x5dff('0x1'));var moment=require(_0x5dff('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dff('0x3'));var db=require(_0x5dff('0x4'))['db'];var utils=require(_0x5dff('0x5'));var logger=require(_0x5dff('0x6'))(_0x5dff('0x7'));var config=require(_0x5dff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5dff('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x240493,_0x53dd52,_0x2c3d30){return new BPromise(function(_0x1c968e,_0x20456f){return client[_0x5dff('0xa')](_0x240493,_0x2c3d30)[_0x5dff('0xb')](function(_0x417283){logger['info'](_0x5dff('0xc'),_0x53dd52,_0x5dff('0xd'));logger[_0x5dff('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x53dd52,'request\x20sent',JSON[_0x5dff('0xf')](_0x417283));if(_0x417283['error']){if(_0x417283[_0x5dff('0x10')][_0x5dff('0x11')]===0x1f4){logger[_0x5dff('0x10')](_0x5dff('0xc'),_0x53dd52,_0x417283[_0x5dff('0x10')][_0x5dff('0x12')]);return _0x20456f(_0x417283[_0x5dff('0x10')]['message']);}logger[_0x5dff('0x10')](_0x5dff('0xc'),_0x53dd52,_0x417283[_0x5dff('0x10')][_0x5dff('0x12')]);return _0x1c968e(_0x417283[_0x5dff('0x10')]['message']);}else{logger[_0x5dff('0x13')](_0x5dff('0xc'),_0x53dd52,'request\x20sent');_0x1c968e(_0x417283[_0x5dff('0x14')][_0x5dff('0x12')]);}})[_0x5dff('0x15')](function(_0x29fc09){logger[_0x5dff('0x10')](_0x5dff('0xc'),_0x53dd52,_0x29fc09);_0x20456f(_0x29fc09);});});}exports['CreateWhatsappQueueReport']=function(_0x8bec5a){var _0x41d498=this;return new Promise(function(_0x4bf38f,_0x5edbf5){return db[_0x5dff('0x16')][_0x5dff('0x17')](_0x8bec5a[_0x5dff('0x18')],{'raw':_0x8bec5a[_0x5dff('0x19')]?_0x8bec5a[_0x5dff('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x5dff('0xb')](function(_0x2d5707){logger[_0x5dff('0x13')](_0x5dff('0x1a'),_0x8bec5a);logger['debug']('CreateWhatsappQueueReport',_0x8bec5a,JSON[_0x5dff('0xf')](_0x2d5707));_0x4bf38f(_0x2d5707);})['catch'](function(_0x38efd0){logger[_0x5dff('0x10')](_0x5dff('0x1a'),_0x38efd0[_0x5dff('0x12')],_0x8bec5a);_0x5edbf5(_0x41d498[_0x5dff('0x10')](0x1f4,_0x38efd0[_0x5dff('0x12')]));});});};exports[_0x5dff('0x1b')]=function(_0x4abc1e){var _0x1af9a1=this;return new Promise(function(_0x20ea92,_0x289efe){return db[_0x5dff('0x16')][_0x5dff('0x1c')](_0x4abc1e[_0x5dff('0x18')],{'raw':_0x4abc1e['options']?_0x4abc1e['options'][_0x5dff('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4abc1e[_0x5dff('0x19')]?_0x4abc1e[_0x5dff('0x19')]['where']||null:null,'attributes':_0x4abc1e[_0x5dff('0x19')]?_0x4abc1e[_0x5dff('0x19')][_0x5dff('0x1e')]||null:null,'limit':_0x4abc1e[_0x5dff('0x19')]?_0x4abc1e[_0x5dff('0x19')][_0x5dff('0x1f')]||null:null})[_0x5dff('0xb')](function(_0x271830){logger['info'](_0x5dff('0x1b'),_0x4abc1e);logger[_0x5dff('0xe')](_0x5dff('0x1b'),_0x4abc1e,JSON['stringify'](_0x271830));_0x20ea92(_0x271830);})[_0x5dff('0x15')](function(_0x46e3e8){logger[_0x5dff('0x10')](_0x5dff('0x1b'),_0x46e3e8['message'],_0x4abc1e);_0x289efe(_0x1af9a1[_0x5dff('0x10')](0x1f4,_0x46e3e8[_0x5dff('0x12')]));});});}; \ No newline at end of file +var _0x1fda=['lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','stringify','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','then','info','UpdateWhatsappQueueReport','where','attributes','limit'];(function(_0x12bcb7,_0x5d1904){var _0x5d6436=function(_0x242263){while(--_0x242263){_0x12bcb7['push'](_0x12bcb7['shift']());}};_0x5d6436(++_0x5d1904);}(_0x1fda,0x74));var _0xa1fd=function(_0x3e5458,_0x2eeddb){_0x3e5458=_0x3e5458-0x0;var _0x316ee5=_0x1fda[_0x3e5458];return _0x316ee5;};'use strict';var _=require(_0xa1fd('0x0'));var util=require(_0xa1fd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa1fd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1fd('0x3'))['db'];var utils=require(_0xa1fd('0x4'));var logger=require('../../config/logger')(_0xa1fd('0x5'));var config=require(_0xa1fd('0x6'));var jayson=require(_0xa1fd('0x7'));var client=jayson[_0xa1fd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x242a20,_0x4b54da,_0x216c5a){return new BPromise(function(_0x8e84e,_0x329f50){return client[_0xa1fd('0x9')](_0x242a20,_0x216c5a)['then'](function(_0x5acf3d){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x4b54da,_0xa1fd('0xa'));logger[_0xa1fd('0xb')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x4b54da,_0xa1fd('0xa'),JSON[_0xa1fd('0xc')](_0x5acf3d));if(_0x5acf3d[_0xa1fd('0xd')]){if(_0x5acf3d['error']['code']===0x1f4){logger['error'](_0xa1fd('0xe'),_0x4b54da,_0x5acf3d[_0xa1fd('0xd')]['message']);return _0x329f50(_0x5acf3d[_0xa1fd('0xd')]['message']);}logger['error'](_0xa1fd('0xe'),_0x4b54da,_0x5acf3d[_0xa1fd('0xd')][_0xa1fd('0xf')]);return _0x8e84e(_0x5acf3d[_0xa1fd('0xd')][_0xa1fd('0xf')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x4b54da,'request\x20sent');_0x8e84e(_0x5acf3d[_0xa1fd('0x10')][_0xa1fd('0xf')]);}})[_0xa1fd('0x11')](function(_0x158bce){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x4b54da,_0x158bce);_0x329f50(_0x158bce);});});}exports[_0xa1fd('0x12')]=function(_0x8cf01f){var _0x5060b4=this;return new Promise(function(_0x2f4a16,_0x50b1e2){return db[_0xa1fd('0x13')]['create'](_0x8cf01f[_0xa1fd('0x14')],{'raw':_0x8cf01f[_0xa1fd('0x15')]?_0x8cf01f[_0xa1fd('0x15')][_0xa1fd('0x16')]===undefined?!![]:![]:!![]})[_0xa1fd('0x17')](function(_0xf59eb4){logger[_0xa1fd('0x18')](_0xa1fd('0x12'),_0x8cf01f);logger['debug'](_0xa1fd('0x12'),_0x8cf01f,JSON[_0xa1fd('0xc')](_0xf59eb4));_0x2f4a16(_0xf59eb4);})[_0xa1fd('0x11')](function(_0x55591d){logger[_0xa1fd('0xd')](_0xa1fd('0x12'),_0x55591d['message'],_0x8cf01f);_0x50b1e2(_0x5060b4[_0xa1fd('0xd')](0x1f4,_0x55591d['message']));});});};exports[_0xa1fd('0x19')]=function(_0x46e58d){var _0x167195=this;return new Promise(function(_0x20fb0d,_0x4ec966){return db[_0xa1fd('0x13')]['update'](_0x46e58d[_0xa1fd('0x14')],{'raw':_0x46e58d[_0xa1fd('0x15')]?_0x46e58d['options'][_0xa1fd('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46e58d[_0xa1fd('0x15')]?_0x46e58d[_0xa1fd('0x15')][_0xa1fd('0x1a')]||null:null,'attributes':_0x46e58d[_0xa1fd('0x15')]?_0x46e58d[_0xa1fd('0x15')][_0xa1fd('0x1b')]||null:null,'limit':_0x46e58d[_0xa1fd('0x15')]?_0x46e58d[_0xa1fd('0x15')][_0xa1fd('0x1c')]||null:null})[_0xa1fd('0x17')](function(_0x2f0979){logger['info'](_0xa1fd('0x19'),_0x46e58d);logger['debug']('UpdateWhatsappQueueReport',_0x46e58d,JSON['stringify'](_0x2f0979));_0x20fb0d(_0x2f0979);})[_0xa1fd('0x11')](function(_0x157e2c){logger[_0xa1fd('0xd')](_0xa1fd('0x19'),_0x157e2c[_0xa1fd('0xf')],_0x46e58d);_0x4ec966(_0x167195[_0xa1fd('0xd')](0x1f4,_0x157e2c[_0xa1fd('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 9eca7c0..982b889 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 _0x4dd3=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','describe','show','post','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x29b083,_0x5157a4){var _0x38d17a=function(_0x49b261){while(--_0x49b261){_0x29b083['push'](_0x29b083['shift']());}};_0x38d17a(++_0x5157a4);}(_0x4dd3,0x14c));var _0x34dd=function(_0x4e0a03,_0x5eb6b0){_0x4e0a03=_0x4e0a03-0x0;var _0x2478fc=_0x4dd3[_0x4e0a03];return _0x2478fc;};'use strict';var multer=require('multer');var util=require(_0x34dd('0x0'));var path=require(_0x34dd('0x1'));var timeout=require(_0x34dd('0x2'));var express=require(_0x34dd('0x3'));var router=express[_0x34dd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34dd('0x5'));var interaction=require(_0x34dd('0x6'));var config=require(_0x34dd('0x7'));var controller=require(_0x34dd('0x8'));router['get']('/',auth[_0x34dd('0x9')](),controller[_0x34dd('0xa')]);router[_0x34dd('0xb')]('/describe',auth[_0x34dd('0x9')](),controller[_0x34dd('0xc')]);router[_0x34dd('0xb')]('/:id',auth[_0x34dd('0x9')](),controller[_0x34dd('0xd')]);router[_0x34dd('0xe')]('/',auth[_0x34dd('0x9')](),controller[_0x34dd('0xf')]);router[_0x34dd('0x10')](_0x34dd('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x34dd('0x12')](_0x34dd('0x11'),auth[_0x34dd('0x9')](),controller[_0x34dd('0x13')]);module[_0x34dd('0x14')]=router; \ No newline at end of file +var _0x7e6a=['update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x1ba8ae,_0x3a714b){var _0x4282ed=function(_0x3dd8a8){while(--_0x3dd8a8){_0x1ba8ae['push'](_0x1ba8ae['shift']());}};_0x4282ed(++_0x3a714b);}(_0x7e6a,0x1cf));var _0xa7e6=function(_0x2072f6,_0x40b531){_0x2072f6=_0x2072f6-0x0;var _0x5b2c52=_0x7e6a[_0x2072f6];return _0x5b2c52;};'use strict';var multer=require(_0xa7e6('0x0'));var util=require(_0xa7e6('0x1'));var path=require(_0xa7e6('0x2'));var timeout=require(_0xa7e6('0x3'));var express=require('express');var router=express[_0xa7e6('0x4')]();var fs_extra=require(_0xa7e6('0x5'));var auth=require(_0xa7e6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa7e6('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xa7e6('0x8')]('/',auth['isAuthenticated'](),controller[_0xa7e6('0x9')]);router['get']('/describe',auth[_0xa7e6('0xa')](),controller[_0xa7e6('0xb')]);router['get'](_0xa7e6('0xc'),auth['isAuthenticated'](),controller[_0xa7e6('0xd')]);router[_0xa7e6('0xe')]('/',auth['isAuthenticated'](),controller[_0xa7e6('0xf')]);router[_0xa7e6('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa7e6('0x11')]);router[_0xa7e6('0x12')](_0xa7e6('0xc'),auth[_0xa7e6('0xa')](),controller['destroy']);module[_0xa7e6('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 4c42d5f..b1dbd07 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 _0x3306=['ENUM','agent','queue','DATE','sequelize','exports','STRING'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x3306,0x107));var _0x6330=function(_0xf33adc,_0x53af83){_0xf33adc=_0xf33adc-0x0;var _0x527f43=_0x3306[_0xf33adc];return _0x527f43;};'use strict';var Sequelize=require(_0x6330('0x0'));module[_0x6330('0x1')]={'uniqueid':{'type':Sequelize[_0x6330('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6330('0x3')]('account',_0x6330('0x4'),_0x6330('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x6330('0x6')]}}; \ No newline at end of file +var _0x80cd=['account','agent','queue','DATE','exports','STRING','ENUM'];(function(_0x5634d2,_0x40ec38){var _0x4150b5=function(_0x44ceef){while(--_0x44ceef){_0x5634d2['push'](_0x5634d2['shift']());}};_0x4150b5(++_0x40ec38);}(_0x80cd,0x146));var _0xd80c=function(_0x2e7f96,_0x2ffe43){_0x2e7f96=_0x2e7f96-0x0;var _0x315277=_0x80cd[_0x2e7f96];return _0x315277;};'use strict';var Sequelize=require('sequelize');module[_0xd80c('0x0')]={'uniqueid':{'type':Sequelize[_0xd80c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd80c('0x2')](_0xd80c('0x3'),_0xd80c('0x4'),_0xd80c('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xd80c('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 8a8e91c..fc17c77 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 _0x7d14=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','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','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','WhatsappTransferReport','rawAttributes'];(function(_0x598257,_0x516239){var _0x1922d5=function(_0x3ece5a){while(--_0x3ece5a){_0x598257['push'](_0x598257['shift']());}};_0x1922d5(++_0x516239);}(_0x7d14,0x6d));var _0x47d1=function(_0x219757,_0x512398){_0x219757=_0x219757-0x0;var _0x370904=_0x7d14[_0x219757];return _0x370904;};'use strict';var emlformat=require(_0x47d1('0x0'));var rimraf=require(_0x47d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47d1('0x2'));var rp=require(_0x47d1('0x3'));var moment=require(_0x47d1('0x4'));var BPromise=require(_0x47d1('0x5'));var Mustache=require('mustache');var util=require(_0x47d1('0x6'));var path=require(_0x47d1('0x7'));var sox=require(_0x47d1('0x8'));var csv=require(_0x47d1('0x9'));var ejs=require(_0x47d1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x47d1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x47d1('0xc'));var toCsv=require(_0x47d1('0x9'));var querystring=require(_0x47d1('0xd'));var Papa=require(_0x47d1('0xe'));var Redis=require(_0x47d1('0xf'));var authService=require(_0x47d1('0x10'));var qs=require(_0x47d1('0x11'));var as=require(_0x47d1('0x12'));var hardwareService=require(_0x47d1('0x13'));var logger=require(_0x47d1('0x14'))(_0x47d1('0x15'));var utils=require(_0x47d1('0x16'));var config=require(_0x47d1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x47d1('0x18'))['db'];function respondWithStatusCode(_0x1247c7,_0x50155b){_0x50155b=_0x50155b||0xcc;return function(_0x2b14dd){if(_0x2b14dd){return _0x1247c7[_0x47d1('0x19')](_0x50155b);}return _0x1247c7[_0x47d1('0x1a')](_0x50155b)[_0x47d1('0x1b')]();};}function respondWithResult(_0x1ee76a,_0xada37f){_0xada37f=_0xada37f||0xc8;return function(_0x1e3895){if(_0x1e3895){return _0x1ee76a[_0x47d1('0x1a')](_0xada37f)[_0x47d1('0x1c')](_0x1e3895);}};}function respondWithFilteredResult(_0xf39a50,_0x18754d){return function(_0x29bbb9){if(_0x29bbb9){var _0x22a2c7=typeof _0x18754d['offset']==='undefined'&&typeof _0x18754d[_0x47d1('0x1d')]===_0x47d1('0x1e');var _0x54ccc5=_0x29bbb9[_0x47d1('0x1f')];var _0x540a61=_0x22a2c7?0x0:_0x18754d['offset'];var _0x372e4f=_0x22a2c7?_0x29bbb9[_0x47d1('0x1f')]:_0x18754d[_0x47d1('0x20')]+_0x18754d[_0x47d1('0x1d')];var _0x54ca37;if(_0x372e4f>=_0x54ccc5){_0x372e4f=_0x54ccc5;_0x54ca37=0xc8;}else{_0x54ca37=0xce;}_0xf39a50[_0x47d1('0x1a')](_0x54ca37);return _0xf39a50['set'](_0x47d1('0x21'),_0x540a61+'-'+_0x372e4f+'/'+_0x54ccc5)[_0x47d1('0x1c')](_0x29bbb9);}return null;};}function patchUpdates(_0x21ed20){return function(_0x5b0261){try{jsonpatch[_0x47d1('0x22')](_0x5b0261,_0x21ed20,!![]);}catch(_0x4260a0){return BPromise[_0x47d1('0x23')](_0x4260a0);}return _0x5b0261[_0x47d1('0x24')]();};}function saveUpdates(_0x57478d,_0x4522aa){return function(_0x474911){if(_0x474911){return _0x474911[_0x47d1('0x25')](_0x57478d)[_0x47d1('0x26')](function(_0x5de4d1){return _0x5de4d1;});}return null;};}function removeEntity(_0x29bca2,_0x4400e5){return function(_0x4e6ed3){if(_0x4e6ed3){return _0x4e6ed3[_0x47d1('0x27')]()[_0x47d1('0x26')](function(){_0x29bca2[_0x47d1('0x1a')](0xcc)[_0x47d1('0x1b')]();});}};}function handleEntityNotFound(_0x244038,_0x4aece8){return function(_0x4710bd){if(!_0x4710bd){_0x244038['sendStatus'](0x194);}return _0x4710bd;};}function handleError(_0x5f070d,_0x1d0b56){_0x1d0b56=_0x1d0b56||0x1f4;return function(_0x3e07f7){logger[_0x47d1('0x28')](_0x3e07f7[_0x47d1('0x29')]);if(_0x3e07f7[_0x47d1('0x2a')]){delete _0x3e07f7[_0x47d1('0x2a')];}_0x5f070d[_0x47d1('0x1a')](_0x1d0b56)[_0x47d1('0x2b')](_0x3e07f7);};}exports['index']=function(_0x2187d3,_0x509c75){var _0x3ce24e={},_0x3d3573={},_0x172307={'count':0x0,'rows':[]};var _0x2f9851=_[_0x47d1('0x2c')](db[_0x47d1('0x2d')][_0x47d1('0x2e')],function(_0xe135a4){return{'name':_0xe135a4['fieldName'],'type':_0xe135a4['type'][_0x47d1('0x2f')]};});_0x3d3573[_0x47d1('0x30')]=_[_0x47d1('0x2c')](_0x2f9851,'name');_0x3d3573[_0x47d1('0x31')]=_[_0x47d1('0x32')](_0x2187d3[_0x47d1('0x31')]);_0x3d3573[_0x47d1('0x33')]=_[_0x47d1('0x34')](_0x3d3573['model'],_0x3d3573[_0x47d1('0x31')]);_0x3ce24e[_0x47d1('0x35')]=_[_0x47d1('0x34')](_0x3d3573[_0x47d1('0x30')],qs[_0x47d1('0x36')](_0x2187d3[_0x47d1('0x31')][_0x47d1('0x36')]));_0x3ce24e[_0x47d1('0x35')]=_0x3ce24e[_0x47d1('0x35')][_0x47d1('0x37')]?_0x3ce24e['attributes']:_0x3d3573['model'];if(!_0x2187d3['query'][_0x47d1('0x38')](_0x47d1('0x39'))){_0x3ce24e[_0x47d1('0x1d')]=qs[_0x47d1('0x1d')](_0x2187d3['query'][_0x47d1('0x1d')]);_0x3ce24e[_0x47d1('0x20')]=qs['offset'](_0x2187d3[_0x47d1('0x31')]['offset']);}_0x3ce24e[_0x47d1('0x3a')]=qs[_0x47d1('0x3b')](_0x2187d3['query'][_0x47d1('0x3b')]);_0x3ce24e[_0x47d1('0x3c')]=qs[_0x47d1('0x33')](_[_0x47d1('0x3d')](_0x2187d3[_0x47d1('0x31')],_0x3d3573['filters']),_0x2f9851);if(_0x2187d3[_0x47d1('0x31')]['filter']){_0x3ce24e[_0x47d1('0x3c')]=_[_0x47d1('0x3e')](_0x3ce24e[_0x47d1('0x3c')],{'$or':_[_0x47d1('0x2c')](_0x2f9851,function(_0x33064b){if(_0x33064b[_0x47d1('0x3f')]!==_0x47d1('0x40')){var _0x31cc97={};_0x31cc97[_0x33064b[_0x47d1('0x2a')]]={'$like':'%'+_0x2187d3[_0x47d1('0x31')][_0x47d1('0x41')]+'%'};return _0x31cc97;}})});}_0x3ce24e=_[_0x47d1('0x3e')]({},_0x3ce24e,_0x2187d3[_0x47d1('0x42')]);var _0x302786={'where':_0x3ce24e[_0x47d1('0x3c')]};return db[_0x47d1('0x2d')][_0x47d1('0x1f')](_0x302786)[_0x47d1('0x26')](function(_0x13309d){_0x172307[_0x47d1('0x1f')]=_0x13309d;if(_0x2187d3[_0x47d1('0x31')][_0x47d1('0x43')]){_0x3ce24e[_0x47d1('0x44')]=[{'all':!![]}];}return db[_0x47d1('0x2d')][_0x47d1('0x45')](_0x3ce24e);})[_0x47d1('0x26')](function(_0x1bca4a){_0x172307[_0x47d1('0x46')]=_0x1bca4a;return _0x172307;})['then'](respondWithFilteredResult(_0x509c75,_0x3ce24e))['catch'](handleError(_0x509c75,null));};exports[_0x47d1('0x47')]=function(_0x469511,_0x396da4){var _0x4b9367={'raw':!![],'where':{'id':_0x469511[_0x47d1('0x48')]['id']}},_0x3906fb={};_0x3906fb[_0x47d1('0x30')]=_[_0x47d1('0x32')](db['WhatsappTransferReport'][_0x47d1('0x2e')]);_0x3906fb['query']=_['keys'](_0x469511[_0x47d1('0x31')]);_0x3906fb[_0x47d1('0x33')]=_[_0x47d1('0x34')](_0x3906fb[_0x47d1('0x30')],_0x3906fb['query']);_0x4b9367[_0x47d1('0x35')]=_[_0x47d1('0x34')](_0x3906fb[_0x47d1('0x30')],qs['fields'](_0x469511[_0x47d1('0x31')][_0x47d1('0x36')]));_0x4b9367[_0x47d1('0x35')]=_0x4b9367['attributes']['length']?_0x4b9367[_0x47d1('0x35')]:_0x3906fb[_0x47d1('0x30')];if(_0x469511[_0x47d1('0x31')][_0x47d1('0x43')]){_0x4b9367['include']=[{'all':!![]}];}_0x4b9367=_[_0x47d1('0x3e')]({},_0x4b9367,_0x469511['options']);return db['WhatsappTransferReport'][_0x47d1('0x49')](_0x4b9367)['then'](handleEntityNotFound(_0x396da4,null))['then'](respondWithResult(_0x396da4,null))['catch'](handleError(_0x396da4,null));};exports[_0x47d1('0x4a')]=function(_0xf8a077,_0xb52b5b){return db[_0x47d1('0x2d')][_0x47d1('0x4a')](_0xf8a077[_0x47d1('0x4b')],{})['then'](respondWithResult(_0xb52b5b,0xc9))[_0x47d1('0x4c')](handleError(_0xb52b5b,null));};exports[_0x47d1('0x25')]=function(_0x2f1536,_0x5db50d){if(_0x2f1536[_0x47d1('0x4b')]['id']){delete _0x2f1536[_0x47d1('0x4b')]['id'];}return db['WhatsappTransferReport'][_0x47d1('0x49')]({'where':{'id':_0x2f1536[_0x47d1('0x48')]['id']}})['then'](handleEntityNotFound(_0x5db50d,null))[_0x47d1('0x26')](saveUpdates(_0x2f1536['body'],null))[_0x47d1('0x26')](respondWithResult(_0x5db50d,null))[_0x47d1('0x4c')](handleError(_0x5db50d,null));};exports[_0x47d1('0x27')]=function(_0x5d73ef,_0x51e4bf){return db[_0x47d1('0x2d')][_0x47d1('0x49')]({'where':{'id':_0x5d73ef[_0x47d1('0x48')]['id']}})[_0x47d1('0x26')](handleEntityNotFound(_0x51e4bf,null))[_0x47d1('0x26')](removeEntity(_0x51e4bf,null))[_0x47d1('0x4c')](handleError(_0x51e4bf,null));};exports[_0x47d1('0x4d')]=function(_0x295a6e,_0x28b9eb){return db[_0x47d1('0x2d')]['describe']()[_0x47d1('0x26')](respondWithResult(_0x28b9eb,null))[_0x47d1('0x4c')](handleError(_0x28b9eb,null));}; \ No newline at end of file +var _0x70a8=['pick','merge','VIRTUAL','filter','options','then','includeAll','include','catch','show','params','rawAttributes','intersection','find','create','body','describe','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','sendStatus','error','stack','send','index','map','WhatsappTransferReport','type','key','model','name','query','keys','filters','attributes','fields','length','order','sort','where'];(function(_0x16452d,_0x1cc000){var _0x1b17bf=function(_0x4188c2){while(--_0x4188c2){_0x16452d['push'](_0x16452d['shift']());}};_0x1b17bf(++_0x1cc000);}(_0x70a8,0x1f4));var _0x870a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x70a8[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x870a('0x0'));var jsonpatch=require(_0x870a('0x1'));var rp=require('request-promise');var moment=require(_0x870a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x870a('0x3'));var util=require('util');var path=require(_0x870a('0x4'));var sox=require(_0x870a('0x5'));var csv=require(_0x870a('0x6'));var ejs=require(_0x870a('0x7'));var fs=require('fs');var fs_extra=require(_0x870a('0x8'));var _=require(_0x870a('0x9'));var squel=require('squel');var crypto=require(_0x870a('0xa'));var jsforce=require(_0x870a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x870a('0x6'));var querystring=require('querystring');var Papa=require(_0x870a('0xc'));var Redis=require('ioredis');var authService=require(_0x870a('0xd'));var qs=require(_0x870a('0xe'));var as=require(_0x870a('0xf'));var hardwareService=require(_0x870a('0x10'));var logger=require('../../config/logger')(_0x870a('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x870a('0x12'))['db'];function respondWithStatusCode(_0x5d0ee4,_0xd7ed56){_0xd7ed56=_0xd7ed56||0xcc;return function(_0x454839){if(_0x454839){return _0x5d0ee4['sendStatus'](_0xd7ed56);}return _0x5d0ee4[_0x870a('0x13')](_0xd7ed56)[_0x870a('0x14')]();};}function respondWithResult(_0x220952,_0x1ffd98){_0x1ffd98=_0x1ffd98||0xc8;return function(_0x15062b){if(_0x15062b){return _0x220952[_0x870a('0x13')](_0x1ffd98)['json'](_0x15062b);}};}function respondWithFilteredResult(_0x1b4c0c,_0x8be8c1){return function(_0x5ad708){if(_0x5ad708){var _0x4877d5=typeof _0x8be8c1['offset']===_0x870a('0x15')&&typeof _0x8be8c1[_0x870a('0x16')]===_0x870a('0x15');var _0x10e6b6=_0x5ad708[_0x870a('0x17')];var _0x4992f3=_0x4877d5?0x0:_0x8be8c1[_0x870a('0x18')];var _0x147505=_0x4877d5?_0x5ad708[_0x870a('0x17')]:_0x8be8c1['offset']+_0x8be8c1[_0x870a('0x16')];var _0x59ccc1;if(_0x147505>=_0x10e6b6){_0x147505=_0x10e6b6;_0x59ccc1=0xc8;}else{_0x59ccc1=0xce;}_0x1b4c0c['status'](_0x59ccc1);return _0x1b4c0c[_0x870a('0x19')](_0x870a('0x1a'),_0x4992f3+'-'+_0x147505+'/'+_0x10e6b6)[_0x870a('0x1b')](_0x5ad708);}return null;};}function patchUpdates(_0x14612a){return function(_0x3e9f3){try{jsonpatch[_0x870a('0x1c')](_0x3e9f3,_0x14612a,!![]);}catch(_0xf93977){return BPromise['reject'](_0xf93977);}return _0x3e9f3[_0x870a('0x1d')]();};}function saveUpdates(_0x134095,_0x242b86){return function(_0x25e4dc){if(_0x25e4dc){return _0x25e4dc[_0x870a('0x1e')](_0x134095)['then'](function(_0x322a13){return _0x322a13;});}return null;};}function removeEntity(_0x3fc2d0,_0x472d8d){return function(_0x16353e){if(_0x16353e){return _0x16353e[_0x870a('0x1f')]()['then'](function(){_0x3fc2d0[_0x870a('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29d66a,_0x1eb361){return function(_0x47b5f9){if(!_0x47b5f9){_0x29d66a[_0x870a('0x20')](0x194);}return _0x47b5f9;};}function handleError(_0x5e6c4a,_0x5b9f75){_0x5b9f75=_0x5b9f75||0x1f4;return function(_0x421e2c){logger[_0x870a('0x21')](_0x421e2c[_0x870a('0x22')]);if(_0x421e2c['name']){delete _0x421e2c['name'];}_0x5e6c4a[_0x870a('0x13')](_0x5b9f75)[_0x870a('0x23')](_0x421e2c);};}exports[_0x870a('0x24')]=function(_0x1bf025,_0x107c7b){var _0x1e515f={},_0x3332d8={},_0x300de3={'count':0x0,'rows':[]};var _0x2adfb5=_[_0x870a('0x25')](db[_0x870a('0x26')]['rawAttributes'],function(_0x9fbb7){return{'name':_0x9fbb7['fieldName'],'type':_0x9fbb7[_0x870a('0x27')][_0x870a('0x28')]};});_0x3332d8[_0x870a('0x29')]=_[_0x870a('0x25')](_0x2adfb5,_0x870a('0x2a'));_0x3332d8[_0x870a('0x2b')]=_[_0x870a('0x2c')](_0x1bf025['query']);_0x3332d8[_0x870a('0x2d')]=_['intersection'](_0x3332d8['model'],_0x3332d8[_0x870a('0x2b')]);_0x1e515f[_0x870a('0x2e')]=_['intersection'](_0x3332d8[_0x870a('0x29')],qs[_0x870a('0x2f')](_0x1bf025[_0x870a('0x2b')][_0x870a('0x2f')]));_0x1e515f['attributes']=_0x1e515f['attributes'][_0x870a('0x30')]?_0x1e515f['attributes']:_0x3332d8['model'];if(!_0x1bf025[_0x870a('0x2b')]['hasOwnProperty']('nolimit')){_0x1e515f['limit']=qs[_0x870a('0x16')](_0x1bf025[_0x870a('0x2b')][_0x870a('0x16')]);_0x1e515f[_0x870a('0x18')]=qs[_0x870a('0x18')](_0x1bf025[_0x870a('0x2b')][_0x870a('0x18')]);}_0x1e515f[_0x870a('0x31')]=qs[_0x870a('0x32')](_0x1bf025[_0x870a('0x2b')][_0x870a('0x32')]);_0x1e515f[_0x870a('0x33')]=qs['filters'](_[_0x870a('0x34')](_0x1bf025[_0x870a('0x2b')],_0x3332d8['filters']),_0x2adfb5);if(_0x1bf025[_0x870a('0x2b')]['filter']){_0x1e515f[_0x870a('0x33')]=_[_0x870a('0x35')](_0x1e515f[_0x870a('0x33')],{'$or':_[_0x870a('0x25')](_0x2adfb5,function(_0x5ddeb7){if(_0x5ddeb7[_0x870a('0x27')]!==_0x870a('0x36')){var _0x1280b5={};_0x1280b5[_0x5ddeb7[_0x870a('0x2a')]]={'$like':'%'+_0x1bf025[_0x870a('0x2b')][_0x870a('0x37')]+'%'};return _0x1280b5;}})});}_0x1e515f=_[_0x870a('0x35')]({},_0x1e515f,_0x1bf025[_0x870a('0x38')]);var _0x9267e={'where':_0x1e515f[_0x870a('0x33')]};return db[_0x870a('0x26')][_0x870a('0x17')](_0x9267e)[_0x870a('0x39')](function(_0x1e32f2){_0x300de3[_0x870a('0x17')]=_0x1e32f2;if(_0x1bf025[_0x870a('0x2b')][_0x870a('0x3a')]){_0x1e515f[_0x870a('0x3b')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x1e515f);})['then'](function(_0x5c5e64){_0x300de3['rows']=_0x5c5e64;return _0x300de3;})[_0x870a('0x39')](respondWithFilteredResult(_0x107c7b,_0x1e515f))[_0x870a('0x3c')](handleError(_0x107c7b,null));};exports[_0x870a('0x3d')]=function(_0x563fa3,_0x214e6f){var _0x2d4623={'raw':!![],'where':{'id':_0x563fa3[_0x870a('0x3e')]['id']}},_0x4f6c48={};_0x4f6c48['model']=_['keys'](db[_0x870a('0x26')][_0x870a('0x3f')]);_0x4f6c48[_0x870a('0x2b')]=_[_0x870a('0x2c')](_0x563fa3[_0x870a('0x2b')]);_0x4f6c48['filters']=_[_0x870a('0x40')](_0x4f6c48['model'],_0x4f6c48['query']);_0x2d4623['attributes']=_[_0x870a('0x40')](_0x4f6c48[_0x870a('0x29')],qs[_0x870a('0x2f')](_0x563fa3['query'][_0x870a('0x2f')]));_0x2d4623[_0x870a('0x2e')]=_0x2d4623[_0x870a('0x2e')]['length']?_0x2d4623['attributes']:_0x4f6c48['model'];if(_0x563fa3['query'][_0x870a('0x3a')]){_0x2d4623[_0x870a('0x3b')]=[{'all':!![]}];}_0x2d4623=_[_0x870a('0x35')]({},_0x2d4623,_0x563fa3[_0x870a('0x38')]);return db[_0x870a('0x26')][_0x870a('0x41')](_0x2d4623)[_0x870a('0x39')](handleEntityNotFound(_0x214e6f,null))[_0x870a('0x39')](respondWithResult(_0x214e6f,null))['catch'](handleError(_0x214e6f,null));};exports[_0x870a('0x42')]=function(_0x56eedb,_0x2a1e8a){return db[_0x870a('0x26')][_0x870a('0x42')](_0x56eedb['body'],{})[_0x870a('0x39')](respondWithResult(_0x2a1e8a,0xc9))[_0x870a('0x3c')](handleError(_0x2a1e8a,null));};exports[_0x870a('0x1e')]=function(_0x36fb4c,_0x3fc68c){if(_0x36fb4c['body']['id']){delete _0x36fb4c[_0x870a('0x43')]['id'];}return db['WhatsappTransferReport'][_0x870a('0x41')]({'where':{'id':_0x36fb4c[_0x870a('0x3e')]['id']}})[_0x870a('0x39')](handleEntityNotFound(_0x3fc68c,null))[_0x870a('0x39')](saveUpdates(_0x36fb4c['body'],null))['then'](respondWithResult(_0x3fc68c,null))[_0x870a('0x3c')](handleError(_0x3fc68c,null));};exports[_0x870a('0x1f')]=function(_0x331b10,_0xeb21f2){return db[_0x870a('0x26')]['find']({'where':{'id':_0x331b10['params']['id']}})[_0x870a('0x39')](handleEntityNotFound(_0xeb21f2,null))['then'](removeEntity(_0xeb21f2,null))['catch'](handleError(_0xeb21f2,null));};exports[_0x870a('0x44')]=function(_0x625fb6,_0x21b37d){return db[_0x870a('0x26')][_0x870a('0x44')]()[_0x870a('0x39')](respondWithResult(_0x21b37d,null))['catch'](handleError(_0x21b37d,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 55b947f..be50d82 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 _0xb3b7=['report_whatsapp_transfer','lodash','api','moment','bluebird','path','../../config/environment','./whatsappTransferReport.attributes','exports','define'];(function(_0x1abf62,_0x116a74){var _0x2de161=function(_0x4f203f){while(--_0x4f203f){_0x1abf62['push'](_0x1abf62['shift']());}};_0x2de161(++_0x116a74);}(_0xb3b7,0x12d));var _0x7b3b=function(_0x551d38,_0x35f382){_0x551d38=_0x551d38-0x0;var _0x5a551c=_0xb3b7[_0x551d38];return _0x5a551c;};'use strict';var _=require(_0x7b3b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7b3b('0x1'));var moment=require(_0x7b3b('0x2'));var BPromise=require(_0x7b3b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b3b('0x4'));var rimraf=require('rimraf');var config=require(_0x7b3b('0x5'));var attributes=require(_0x7b3b('0x6'));module[_0x7b3b('0x7')]=function(_0xa0e0a8,_0x2d6465){return _0xa0e0a8[_0x7b3b('0x8')]('WhatsappTransferReport',attributes,{'tableName':_0x7b3b('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x782c=['bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','api','moment'];(function(_0x4eb042,_0x531d1c){var _0x4dc44f=function(_0x57a4d7){while(--_0x57a4d7){_0x4eb042['push'](_0x4eb042['shift']());}};_0x4dc44f(++_0x531d1c);}(_0x782c,0xa8));var _0xc782=function(_0x2ac746,_0x36605e){_0x2ac746=_0x2ac746-0x0;var _0x3eb60a=_0x782c[_0x2ac746];return _0x3eb60a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc782('0x0'));var moment=require(_0xc782('0x1'));var BPromise=require(_0xc782('0x2'));var rp=require(_0xc782('0x3'));var fs=require('fs');var path=require(_0xc782('0x4'));var rimraf=require('rimraf');var config=require(_0xc782('0x5'));var attributes=require(_0xc782('0x6'));module[_0xc782('0x7')]=function(_0x21dd95,_0x3c904c){return _0x21dd95[_0xc782('0x8')](_0xc782('0x9'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index aee9943..7feec19 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 _0x3878=['rpc','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x5a26db,_0x2c5ccd){var _0x4619dd=function(_0x21e28f){while(--_0x21e28f){_0x5a26db['push'](_0x5a26db['shift']());}};_0x4619dd(++_0x2c5ccd);}(_0x3878,0x1c7));var _0x8387=function(_0x2b6c93,_0x163a8b){_0x2b6c93=_0x2b6c93-0x0;var _0x5cfd8e=_0x3878[_0x2b6c93];return _0x5cfd8e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8387('0x0'));var BPromise=require(_0x8387('0x1'));var rs=require(_0x8387('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8387('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8387('0x4'))(_0x8387('0x5'));var config=require('../../config/environment');var jayson=require(_0x8387('0x6'));var client=jayson[_0x8387('0x7')][_0x8387('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ef0b6,_0x1e9fa6,_0x459f7c){return new BPromise(function(_0x4d9ace,_0x778970){return client[_0x8387('0x9')](_0x5ef0b6,_0x459f7c)[_0x8387('0xa')](function(_0x15b12a){logger[_0x8387('0xb')](_0x8387('0xc'),_0x1e9fa6,_0x8387('0xd'));logger[_0x8387('0xe')](_0x8387('0xf'),_0x1e9fa6,_0x8387('0xd'),JSON['stringify'](_0x15b12a));if(_0x15b12a['error']){if(_0x15b12a[_0x8387('0x10')]['code']===0x1f4){logger[_0x8387('0x10')](_0x8387('0xc'),_0x1e9fa6,_0x15b12a[_0x8387('0x10')]['message']);return _0x778970(_0x15b12a[_0x8387('0x10')][_0x8387('0x11')]);}logger[_0x8387('0x10')](_0x8387('0xc'),_0x1e9fa6,_0x15b12a[_0x8387('0x10')][_0x8387('0x11')]);return _0x4d9ace(_0x15b12a[_0x8387('0x10')][_0x8387('0x11')]);}else{logger[_0x8387('0xb')](_0x8387('0xc'),_0x1e9fa6,_0x8387('0xd'));_0x4d9ace(_0x15b12a[_0x8387('0x12')][_0x8387('0x11')]);}})[_0x8387('0x13')](function(_0x51e7de){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x1e9fa6,_0x51e7de);_0x778970(_0x51e7de);});});} \ No newline at end of file +var _0x6ab9=['jayson/promise','client','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x46a23b,_0x8ce44a){var _0x3e9836=function(_0x334ea6){while(--_0x334ea6){_0x46a23b['push'](_0x46a23b['shift']());}};_0x3e9836(++_0x8ce44a);}(_0x6ab9,0x19a));var _0x96ab=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x6ab9[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x96ab('0x0'));var util=require(_0x96ab('0x1'));var moment=require('moment');var BPromise=require(_0x96ab('0x2'));var rs=require(_0x96ab('0x3'));var fs=require('fs');var Redis=require(_0x96ab('0x4'));var db=require(_0x96ab('0x5'))['db'];var utils=require(_0x96ab('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x96ab('0x7'));var jayson=require(_0x96ab('0x8'));var client=jayson[_0x96ab('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d2a35,_0xf8e2b1,_0x516cf7){return new BPromise(function(_0x313efb,_0x1e3f17){return client[_0x96ab('0xa')](_0x3d2a35,_0x516cf7)[_0x96ab('0xb')](function(_0x39b50e){logger[_0x96ab('0xc')](_0x96ab('0xd'),_0xf8e2b1,_0x96ab('0xe'));logger[_0x96ab('0xf')](_0x96ab('0x10'),_0xf8e2b1,_0x96ab('0xe'),JSON[_0x96ab('0x11')](_0x39b50e));if(_0x39b50e[_0x96ab('0x12')]){if(_0x39b50e['error'][_0x96ab('0x13')]===0x1f4){logger['error'](_0x96ab('0xd'),_0xf8e2b1,_0x39b50e[_0x96ab('0x12')][_0x96ab('0x14')]);return _0x1e3f17(_0x39b50e[_0x96ab('0x12')][_0x96ab('0x14')]);}logger[_0x96ab('0x12')](_0x96ab('0xd'),_0xf8e2b1,_0x39b50e[_0x96ab('0x12')][_0x96ab('0x14')]);return _0x313efb(_0x39b50e[_0x96ab('0x12')][_0x96ab('0x14')]);}else{logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0xf8e2b1,_0x96ab('0xe'));_0x313efb(_0x39b50e[_0x96ab('0x15')][_0x96ab('0x14')]);}})['catch'](function(_0x43e35e){logger[_0x96ab('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0xf8e2b1,_0x43e35e);_0x1e3f17(_0x43e35e);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index d92b3d1..01609df 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x06ec=['status','join','None','seedDB','./config/license','default','catch','error','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','Online\x20apps:','online','name','Offline\x20apps:','map','filter'];(function(_0x5124f6,_0x3c142d){var _0x171e16=function(_0x4f61f9){while(--_0x4f61f9){_0x5124f6['push'](_0x5124f6['shift']());}};_0x171e16(++_0x3c142d);}(_0x06ec,0x81));var _0xc06e=function(_0x314db8,_0x994e22){_0x314db8=_0x314db8-0x0;var _0x59d4f4=_0x06ec[_0x314db8];return _0x59d4f4;};'use strict';var _=require(_0xc06e('0x0'));var mysqldb=require(_0xc06e('0x1'));var rpc=require(_0xc06e('0x2'));var config=require(_0xc06e('0x3'));var logger=require(_0xc06e('0x4'))(_0xc06e('0x5'));var pm2=require(_0xc06e('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xc06e('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xc06e('0x8'));function main(){return mysqldb['db'][_0xc06e('0x9')][_0xc06e('0xa')]()[_0xc06e('0xb')](function(){return rpc[_0xc06e('0xc')]();})['then'](function(_0x25327e){logger[_0xc06e('0xd')](_0x25327e);return chat[_0xc06e('0xe')]();})['then'](function(){return whatsapp['start']();})['then'](function(){return schedule[_0xc06e('0xe')]();})[_0xc06e('0xb')](function(){return transcribe[_0xc06e('0xe')]();})[_0xc06e('0xb')](function(_0x279656){logger[_0xc06e('0xd')](_0x279656);return pm2[_0xc06e('0xe')](pm2Config);})[_0xc06e('0xb')](function(_0x1457e9){logger['info'](_0xc06e('0xf'),_['map'](_['filter'](_0x1457e9,{'status':_0xc06e('0x10')}),_0xc06e('0x11'))['join']());logger['info'](_0xc06e('0x12'),_[_0xc06e('0x13')](_[_0xc06e('0x14')](_0x1457e9,function(_0x2b5c83){return _0x2b5c83[_0xc06e('0x15')]!==_0xc06e('0x10');}),_0xc06e('0x11'))[_0xc06e('0x16')]()||_0xc06e('0x17'));config[_0xc06e('0x18')]&&require('./config/seedDB')['default']();require(_0xc06e('0x19'))[_0xc06e('0x1a')]();})[_0xc06e('0x1b')](function(_0x52f0cf){logger[_0xc06e('0x1c')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x52f0cf);process[_0xc06e('0x1d')](0x1);});}main(); \ No newline at end of file +var _0x26b5=['start','info','map','filter','online','name','join','Offline\x20apps:','status','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','listen'];(function(_0x503287,_0x252ead){var _0x3709ef=function(_0x39e5f5){while(--_0x39e5f5){_0x503287['push'](_0x503287['shift']());}};_0x3709ef(++_0x252ead);}(_0x26b5,0x1f2));var _0x526b=function(_0x45a49b,_0x4a6b4b){_0x45a49b=_0x45a49b-0x0;var _0x5cfeec=_0x26b5[_0x45a49b];return _0x5cfeec;};'use strict';var _=require(_0x526b('0x0'));var mysqldb=require(_0x526b('0x1'));var rpc=require(_0x526b('0x2'));var config=require(_0x526b('0x3'));var logger=require(_0x526b('0x4'))(_0x526b('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0x526b('0x6'));var schedule=require(_0x526b('0x7'));var chat=require(_0x526b('0x8'));var whatsapp=require(_0x526b('0x9'));var transcribe=require(_0x526b('0xa'));function main(){return mysqldb['db']['sequelize'][_0x526b('0xb')]()[_0x526b('0xc')](function(){return rpc[_0x526b('0xd')]();})[_0x526b('0xc')](function(_0x2d4405){logger['info'](_0x2d4405);return chat[_0x526b('0xe')]();})[_0x526b('0xc')](function(){return whatsapp['start']();})['then'](function(){return schedule[_0x526b('0xe')]();})[_0x526b('0xc')](function(){return transcribe[_0x526b('0xe')]();})[_0x526b('0xc')](function(_0x5a8379){logger[_0x526b('0xf')](_0x5a8379);return pm2[_0x526b('0xe')](pm2Config);})[_0x526b('0xc')](function(_0x3cc7b0){logger[_0x526b('0xf')]('Online\x20apps:',_[_0x526b('0x10')](_[_0x526b('0x11')](_0x3cc7b0,{'status':_0x526b('0x12')}),_0x526b('0x13'))[_0x526b('0x14')]());logger[_0x526b('0xf')](_0x526b('0x15'),_['map'](_[_0x526b('0x11')](_0x3cc7b0,function(_0x1d7936){return _0x1d7936[_0x526b('0x16')]!==_0x526b('0x12');}),'name')[_0x526b('0x14')]()||_0x526b('0x17'));config[_0x526b('0x18')]&&require(_0x526b('0x19'))[_0x526b('0x1a')]();require(_0x526b('0x1b'))['default']();})[_0x526b('0x1c')](function(_0x411dab){logger[_0x526b('0x1d')](_0x526b('0x1e'),_0x411dab);process[_0x526b('0x1f')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index fca2fed..3b681fd 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 _0xd215=['phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','disposition','status','unmanaged','json','Unmanaged.','catch','headers','authorization','startsWith','User','then','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','find','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','disabled','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','user','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','join','promisify','sign','payload','options','toString','floor','now','HS512','../../mysqldb','../../config/environment','../../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','md5secret','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd215,0x14f));var _0x5d21=function(_0xfd37a1,_0x599d38){_0xfd37a1=_0xfd37a1-0x0;var _0x3c727a=_0xd215[_0xfd37a1];return _0x3c727a;};'use strict';var db=require(_0x5d21('0x0'))['db'];var config=require(_0x5d21('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x5d21('0x2'));var encryptor=require(_0x5d21('0x3'));var _=require(_0x5d21('0x4'));var jwt=require(_0x5d21('0x5'));var expressJwt=require(_0x5d21('0x6'));var compose=require(_0x5d21('0x7'));var basicAuth=require(_0x5d21('0x8'));var crypto=require(_0x5d21('0x9'));var BPromise=require(_0x5d21('0xa'));var util=require(_0x5d21('0xb'));var moment=require(_0x5d21('0xc'));var validateJwt=expressJwt({'secret':config[_0x5d21('0xd')][_0x5d21('0xe')]});var userAttributes=['id',_0x5d21('0xf'),_0x5d21('0x10'),_0x5d21('0x11'),_0x5d21('0x12'),_0x5d21('0x13'),_0x5d21('0x14'),_0x5d21('0x15'),_0x5d21('0x16'),_0x5d21('0x17'),_0x5d21('0x18'),_0x5d21('0x19'),_0x5d21('0x1a'),'smsPause',_0x5d21('0x1b'),_0x5d21('0x1c'),'showWebBar','lastLoginAt','lastPauseAt',_0x5d21('0x1d'),_0x5d21('0x1e'),_0x5d21('0x1f'),_0x5d21('0x20'),_0x5d21('0x21'),'phoneBarAutoAnswerDelay',_0x5d21('0x22'),_0x5d21('0x23'),_0x5d21('0x24'),_0x5d21('0x25'),_0x5d21('0x26'),'phoneBarPrefixRequired','phoneBarRemoteControl',_0x5d21('0x27'),_0x5d21('0x28'),_0x5d21('0x29'),'userProfileId',_0x5d21('0x2a'),_0x5d21('0x2b'),_0x5d21('0x2c'),'downloadVoiceRecordings',_0x5d21('0x2d'),'downloadAttachments'];exports[_0x5d21('0x2e')]=function(){return this[_0x5d21('0x2f')](!![])[_0x5d21('0x30')](function(_0x356e0d,_0x23e541,_0x49f8d8){if(_0x356e0d['user']){_0x49f8d8();}else{return db[_0x5d21('0x31')][_0x5d21('0x32')]({'where':{'id':_0x356e0d[_0x5d21('0x33')]['id']},'attributes':['id',_0x5d21('0x34'),_0x5d21('0x35')],'raw':!![]})['then'](function(_0x457467){if(_0x457467&&_0x457467[_0x5d21('0x34')]){return _0x23e541[_0x5d21('0x36')](_0x457467[_0x5d21('0x35')]===_0x5d21('0x37')?0x195:0x193)[_0x5d21('0x38')]({'message':_0x457467[_0x5d21('0x35')]===_0x5d21('0x37')?_0x5d21('0x39'):'Forbidden.'});}else{_0x49f8d8();}})[_0x5d21('0x3a')](function(_0x6ab990){_0x49f8d8(_0x6ab990);});}});};exports[_0x5d21('0x2f')]=function isAuthenticated(_0x39d0b1){return compose()[_0x5d21('0x30')](function(_0x1b405c,_0x226353,_0x4ebd70){var _0x56ba84;if(_0x1b405c[_0x5d21('0x3b')][_0x5d21('0x3c')]){if(_[_0x5d21('0x3d')](_0x1b405c[_0x5d21('0x3b')]['authorization'],'Basic')){var _0x2e4f1=basicAuth(_0x1b405c);db[_0x5d21('0x3e')]['find']({'where':{'name':_0x2e4f1[_0x5d21('0x11')]}})[_0x5d21('0x3f')](function(_0x32c80e){if(!_0x32c80e||!_0x32c80e[_0x5d21('0x40')](_0x2e4f1[_0x5d21('0x41')])){return _0x226353[_0x5d21('0x36')](0x191)[_0x5d21('0x38')]({'message':_0x5d21('0x42')});}_0x1b405c['user']={'id':_0x32c80e['id']};_0x4ebd70();})[_0x5d21('0x3a')](function(_0x5b0c5f){_0x4ebd70(_0x5b0c5f);});}else if(_[_0x5d21('0x3d')](_0x1b405c['headers'][_0x5d21('0x3c')],_0x5d21('0x43'))){validateJwt(_0x1b405c,_0x226353,_0x4ebd70);}else{if(_0x39d0b1){_0x4ebd70();}else{return _0x226353[_0x5d21('0x36')](0x193)['json']({'message':_0x5d21('0x44')});}}}else if(_0x1b405c[_0x5d21('0x45')][_0x5d21('0x46')]){try{var _0x3fde64={'audience':hardwareConf[_0x5d21('0x47')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x1b405c[_0x5d21('0x45')][_0x5d21('0x46')],_0x3fde64)[_0x5d21('0x3f')](function(_0x14fd1e){return db[_0x5d21('0x3e')][_0x5d21('0x48')]({'where':{'id':_0x14fd1e['sub']}})[_0x5d21('0x3f')](function(_0x3390f6){_0x56ba84=_0x3390f6;return db[_0x5d21('0x49')][_0x5d21('0x32')]({'where':{'id':0x1},'attributes':[_0x5d21('0x4a'),_0x5d21('0x4b')],'raw':!![]});})[_0x5d21('0x3f')](function(_0x3fed5b){if(!_0x56ba84||!_['isEqual'](_0x56ba84[_0x5d21('0x4c')],_0x14fd1e[_0x5d21('0x4d')])){return _0x226353[_0x5d21('0x36')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x56ba84[_0x5d21('0x4e')]){return _0x226353[_0x5d21('0x36')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}if(_0x56ba84['blocked']){if(_0x3fed5b[_0x5d21('0x4b')]>0x0){if(moment(_0x56ba84[_0x5d21('0x4f')])[_0x5d21('0x50')](_0x3fed5b['blockDuration'],_0x5d21('0x51'))>moment()){return _0x226353[_0x5d21('0x36')](0x191)['json']({'message':_0x5d21('0x52')});}}else{return _0x226353['status'](0x191)[_0x5d21('0x38')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x1b405c['user']={'id':_0x56ba84['id']};_0x4ebd70();});})[_0x5d21('0x3a')](function(){return _0x226353['status'](0x191)[_0x5d21('0x38')]({'message':_0x5d21('0x52')});});}catch(_0x2cbf19){_0x4ebd70(_0x2cbf19);}}else if(_0x39d0b1){_0x4ebd70();}else{return _0x226353[_0x5d21('0x36')](0x193)[_0x5d21('0x38')]({'message':'Unknown\x20authorization\x20format'});}})[_0x5d21('0x30')](function(_0x2638db,_0x465338,_0x501e0f){if(_0x2638db[_0x5d21('0x53')]){db[_0x5d21('0x3e')][_0x5d21('0x48')]({'where':{'id':_0x2638db['user']['id']},'attributes':userAttributes})[_0x5d21('0x3f')](function(_0x64e381){if(!_0x64e381){return _0x465338[_0x5d21('0x36')](0x194)[_0x5d21('0x38')]({'message':_0x5d21('0x54')});}_0x2638db[_0x5d21('0x53')]=_0x64e381;_0x501e0f();})['catch'](function(_0x30b62c){_0x501e0f(_0x30b62c);});}else if(_0x39d0b1){_0x501e0f();}else{return _0x465338[_0x5d21('0x36')](0x194)[_0x5d21('0x38')]({'message':_0x5d21('0x55')});}});};exports[_0x5d21('0x56')]=function canUpdate(){return compose()[_0x5d21('0x30')](function(_0x4fea1b,_0x2bdfce,_0xaa4ecf){return licenseUtil[_0x5d21('0x57')]()['then'](function(_0x2b1a43){if(_0x2b1a43[_0x5d21('0x58')]){_0xaa4ecf();}else{return _0x2bdfce[_0x5d21('0x36')](0x193)['json']({'message':_0x5d21('0x59')});}})[_0x5d21('0x3a')](function(_0x5220d3){_0xaa4ecf(_0x5220d3);});});};exports[_0x5d21('0x5a')]=function(_0x17035e,_0x40e806,_0x32cdc4){_0x17035e[_0x5d21('0x5a')]=!![];return _0x32cdc4();};exports[_0x5d21('0x5b')]=function signToken(_0x2a519a){return signJwt(_0x2a519a);};exports['setTokenCookie']=function(_0x4b3e71,_0x2efb8c){if(!_0x4b3e71[_0x5d21('0x53')]){return _0x2efb8c[_0x5d21('0x36')](0x194)[_0x5d21('0x38')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x51c2ac={'payload':{'id':_0x4b3e71['user']['id'],'role':_0x4b3e71[_0x5d21('0x53')][_0x5d21('0xf')]},'options':{'expiresIn':0x15180}};return signJwt(_0x51c2ac)[_0x5d21('0x3f')](function(_0x584742){_0x2efb8c[_0x5d21('0x5c')](_0x5d21('0x5d'),_0x584742);_0x2efb8c[_0x5d21('0x5e')]('/dashboards/general');})[_0x5d21('0x3a')](function(_0x31bb57){return _0x2efb8c[_0x5d21('0x36')](0x1f4)[_0x5d21('0x5f')](_0x31bb57);});};exports[_0x5d21('0x60')]=function(_0x18ebe0){if(_[_0x5d21('0x61')](_0x18ebe0[_0x5d21('0x4c')])||_[_0x5d21('0x61')](_0x18ebe0[_0x5d21('0x62')])){return null;}else{return createJwt(_0x18ebe0);}};exports[_0x5d21('0x63')]=function(_0x1cec3a){_0x1cec3a[_0x5d21('0x4c')]=generateNonce();_0x1cec3a[_0x5d21('0x62')]=generateIssuedAt();return createJwt(_0x1cec3a);};exports[_0x5d21('0x64')]=function(_0x2bdd52,_0x2c7946){var _0x144fcc=_0x2bdd52[_0x5d21('0x45')]['apikey'];if(_0x144fcc){var _0x3ccb1f={'nonce':_0x2c7946[_0x5d21('0x4c')],'iat':_0x2c7946[_0x5d21('0x62')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x5d21('0x47')]()};return verifyJwt(_0x144fcc,_0x3ccb1f)[_0x5d21('0x3f')](function(){return generateApiKey(_0x2c7946);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x5d21('0x65')]=function(_0x3857f1){var _0x441d29=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x441d29[_0x5d21('0x66')](_0x3857f1))throw new db[(_0x5d21('0x67'))][(_0x5d21('0x68'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x5d21('0x69')]=function(_0x558119,_0x41c1c7,_0x25690f){var _0x1d7723=encryptor['decryptString'](_0x41c1c7)[_0x5d21('0x6a')](',');for(var _0x270bea=0x0;_0x270bea<_0x25690f;_0x270bea++){if(!_0x1d7723[_0x270bea])break;if(_0x558119['toLowerCase']()===_0x1d7723[_0x270bea][_0x5d21('0x6b')]()){var _0x8e138d=util[_0x5d21('0x6c')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x25690f);if(_0x25690f===0x1){_0x8e138d=_0x5d21('0x6d');}throw new db[(_0x5d21('0x67'))][(_0x5d21('0x68'))](_0x8e138d);}}return;};exports[_0x5d21('0x6e')]=function(_0x3f55e5,_0xbb1458){var _0x4da225=_0xbb1458?encryptor['decryptString'](_0xbb1458)[_0x5d21('0x6a')](','):[];if(_0x4da225[_0x5d21('0x6f')]===0x5){_0x4da225[_0x5d21('0x70')](-0x1,0x1);}_0x4da225[_0x5d21('0x71')](_0x3f55e5);return encryptor['encryptString'](_0x4da225[_0x5d21('0x72')](','));};function signJwt(_0x42dafc){var _0x12e347=BPromise[_0x5d21('0x73')](jwt[_0x5d21('0x74')],{'context':jwt});var _0x2ab0c4=_0x42dafc['secret']||config['secrets'][_0x5d21('0xe')];return new BPromise(function(_0x17e426,_0x26f984){_0x12e347(_0x42dafc[_0x5d21('0x75')],_0x2ab0c4,_0x42dafc[_0x5d21('0x76')])[_0x5d21('0x3f')](function(_0x262dc3){_0x17e426(_0x262dc3);})[_0x5d21('0x3a')](function(_0x2a720b){_0x26f984(_0x2a720b);});});}function verifyJwt(_0x15a52d,_0x5eec85,_0x417e59){var _0x16651b=BPromise[_0x5d21('0x73')](jwt['verify'],{'context':jwt});var _0x3f354c=_0x417e59||config[_0x5d21('0xd')][_0x5d21('0xe')];return new BPromise(function(_0x4b81d7,_0x330d47){_0x16651b(_0x15a52d,_0x3f354c,_0x5eec85)[_0x5d21('0x3f')](function(_0x2f3a47){_0x4b81d7(_0x2f3a47);})[_0x5d21('0x3a')](function(_0x56f5c8){_0x330d47(_0x56f5c8);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x5d21('0x77')]('hex');}function generateIssuedAt(){return Math[_0x5d21('0x78')](Date[_0x5d21('0x79')]()/0x3e8)[_0x5d21('0x77')]();}function createJwt(_0x1a32f9){var _0x412959={'payload':{'iat':_0x1a32f9[_0x5d21('0x62')],'nonce':_0x1a32f9[_0x5d21('0x4c')]},'options':{'algorithm':_0x5d21('0x7a'),'subject':_0x1a32f9['id']['toString'](),'issuer':hardwareConf[_0x5d21('0x47')](),'audience':hardwareConf[_0x5d21('0x47')]()}};return signJwt(_0x412959)[_0x5d21('0x3f')](function(_0xcd9cd9){return{'iat':_0x1a32f9[_0x5d21('0x62')],'nonce':_0x1a32f9[_0x5d21('0x4c')],'token':_0xcd9cd9};});} \ No newline at end of file +var _0x7295=['passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','closed','then','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','startsWith','authorization','Basic','find','name','pass','Wrong\x20credentials.','getUuid','query','apikey','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','add','minutes','Unknown\x20authorization\x20format','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','apiKeyNonce','isNil','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','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','split','length','unshift','join','promisify','sign','secret','session','payload','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','util','moment','secrets','role','fullname','internal','email','voicePause','mailPause','faxPause','pauseType','lastLoginAt','crudPermissions','allowmessenger'];(function(_0x21ea6e,_0x5da422){var _0x2c60dc=function(_0x1ebd6c){while(--_0x1ebd6c){_0x21ea6e['push'](_0x21ea6e['shift']());}};_0x2c60dc(++_0x5da422);}(_0x7295,0x1d5));var _0x5729=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7295[_0x6131cd];return _0x47e916;};'use strict';var db=require(_0x5729('0x0'))['db'];var config=require(_0x5729('0x1'));var hardwareConf=require(_0x5729('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x5729('0x3'));var _=require(_0x5729('0x4'));var jwt=require(_0x5729('0x5'));var expressJwt=require(_0x5729('0x6'));var compose=require(_0x5729('0x7'));var basicAuth=require(_0x5729('0x8'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x5729('0x9'));var moment=require(_0x5729('0xa'));var validateJwt=expressJwt({'secret':config[_0x5729('0xb')]['session']});var userAttributes=['id',_0x5729('0xc'),_0x5729('0xd'),'name',_0x5729('0xe'),_0x5729('0xf'),'userpic','permissions','md5secret',_0x5729('0x10'),'chatPause',_0x5729('0x11'),_0x5729('0x12'),'smsPause','openchannelPause',_0x5729('0x13'),'showWebBar',_0x5729('0x14'),'lastPauseAt',_0x5729('0x15'),_0x5729('0x16'),_0x5729('0x17'),_0x5729('0x18'),_0x5729('0x19'),_0x5729('0x1a'),_0x5729('0x1b'),_0x5729('0x1c'),_0x5729('0x1d'),_0x5729('0x1e'),_0x5729('0x1f'),_0x5729('0x20'),_0x5729('0x21'),_0x5729('0x22'),'hotdesk',_0x5729('0x23'),_0x5729('0x24'),_0x5729('0x25'),_0x5729('0x26'),'wssPort',_0x5729('0x27'),_0x5729('0x28'),'downloadAttachments'];exports[_0x5729('0x29')]=function(){return this['isAuthenticated'](!![])[_0x5729('0x2a')](function(_0x4f9d26,_0x17ef1a,_0xa7a989){if(_0x4f9d26[_0x5729('0x2b')]){_0xa7a989();}else{return db[_0x5729('0x2c')][_0x5729('0x2d')]({'where':{'id':_0x4f9d26['params']['id']},'attributes':['id',_0x5729('0x2e'),'disposition'],'raw':!![]})[_0x5729('0x2f')](function(_0x55f3da){if(_0x55f3da&&_0x55f3da['closed']){return _0x17ef1a[_0x5729('0x30')](_0x55f3da[_0x5729('0x31')]===_0x5729('0x32')?0x195:0x193)[_0x5729('0x33')]({'message':_0x55f3da[_0x5729('0x31')]==='unmanaged'?_0x5729('0x34'):_0x5729('0x35')});}else{_0xa7a989();}})[_0x5729('0x36')](function(_0x5af125){_0xa7a989(_0x5af125);});}});};exports[_0x5729('0x37')]=function isAuthenticated(_0x1ac051){return compose()['use'](function(_0x1f188c,_0x272bab,_0xf1c052){var _0x9d606b;if(_0x1f188c[_0x5729('0x38')]['authorization']){if(_[_0x5729('0x39')](_0x1f188c[_0x5729('0x38')][_0x5729('0x3a')],_0x5729('0x3b'))){var _0x2ae20f=basicAuth(_0x1f188c);db['User'][_0x5729('0x3c')]({'where':{'name':_0x2ae20f[_0x5729('0x3d')]}})['then'](function(_0x2c9186){if(!_0x2c9186||!_0x2c9186['authenticate'](_0x2ae20f[_0x5729('0x3e')])){return _0x272bab[_0x5729('0x30')](0x191)[_0x5729('0x33')]({'message':_0x5729('0x3f')});}_0x1f188c[_0x5729('0x2b')]={'id':_0x2c9186['id']};_0xf1c052();})[_0x5729('0x36')](function(_0x5f09d2){_0xf1c052(_0x5f09d2);});}else if(_[_0x5729('0x39')](_0x1f188c[_0x5729('0x38')][_0x5729('0x3a')],'Bearer')){validateJwt(_0x1f188c,_0x272bab,_0xf1c052);}else{if(_0x1ac051){_0xf1c052();}else{return _0x272bab[_0x5729('0x30')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x1f188c['query']['apikey']){try{var _0x241aa4={'audience':hardwareConf[_0x5729('0x40')](),'issuer':hardwareConf[_0x5729('0x40')]()};verifyJwt(_0x1f188c[_0x5729('0x41')][_0x5729('0x42')],_0x241aa4)[_0x5729('0x2f')](function(_0x603513){return db[_0x5729('0x43')][_0x5729('0x3c')]({'where':{'id':_0x603513[_0x5729('0x44')]}})['then'](function(_0x42bc3d){_0x9d606b=_0x42bc3d;return db[_0x5729('0x45')]['findOne']({'where':{'id':0x1},'attributes':[_0x5729('0x46'),_0x5729('0x47')],'raw':!![]});})['then'](function(_0x148ba6){if(!_0x9d606b||!_[_0x5729('0x48')](_0x9d606b['apiKeyNonce'],_0x603513[_0x5729('0x49')])){return _0x272bab[_0x5729('0x30')](0x191)[_0x5729('0x33')]({'message':_0x5729('0x4a')});}if(_0x9d606b['disabled']){return _0x272bab[_0x5729('0x30')](0x191)['json']({'message':_0x5729('0x4b')});}if(_0x9d606b[_0x5729('0x4c')]){if(_0x148ba6['blockDuration']>0x0){if(moment(_0x9d606b['blockedAt'])[_0x5729('0x4d')](_0x148ba6[_0x5729('0x47')],_0x5729('0x4e'))>moment()){return _0x272bab[_0x5729('0x30')](0x191)[_0x5729('0x33')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x272bab[_0x5729('0x30')](0x191)[_0x5729('0x33')]({'message':_0x5729('0x4b')});}}_0x1f188c['user']={'id':_0x9d606b['id']};_0xf1c052();});})['catch'](function(){return _0x272bab[_0x5729('0x30')](0x191)[_0x5729('0x33')]({'message':_0x5729('0x4b')});});}catch(_0x1b1334){_0xf1c052(_0x1b1334);}}else if(_0x1ac051){_0xf1c052();}else{return _0x272bab[_0x5729('0x30')](0x193)['json']({'message':_0x5729('0x4f')});}})[_0x5729('0x2a')](function(_0x12c87d,_0x26ec4a,_0x118949){if(_0x12c87d[_0x5729('0x2b')]){db[_0x5729('0x43')][_0x5729('0x3c')]({'where':{'id':_0x12c87d['user']['id']},'attributes':userAttributes})[_0x5729('0x2f')](function(_0x3f54d3){if(!_0x3f54d3){return _0x26ec4a[_0x5729('0x30')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x12c87d[_0x5729('0x2b')]=_0x3f54d3;_0x118949();})[_0x5729('0x36')](function(_0x5dc1e7){_0x118949(_0x5dc1e7);});}else if(_0x1ac051){_0x118949();}else{return _0x26ec4a[_0x5729('0x30')](0x194)[_0x5729('0x33')]({'message':_0x5729('0x50')});}});};exports[_0x5729('0x51')]=function canUpdate(){return compose()[_0x5729('0x2a')](function(_0x2e1f7e,_0x395ae1,_0x282cb9){return licenseUtil[_0x5729('0x52')]()['then'](function(_0x1d984b){if(_0x1d984b[_0x5729('0x53')]){_0x282cb9();}else{return _0x395ae1[_0x5729('0x30')](0x193)[_0x5729('0x33')]({'message':_0x5729('0x54')});}})[_0x5729('0x36')](function(_0x23936a){_0x282cb9(_0x23936a);});});};exports['isMiddleware']=function(_0x4b5d33,_0x8b581c,_0x34e7f3){_0x4b5d33[_0x5729('0x55')]=!![];return _0x34e7f3();};exports[_0x5729('0x56')]=function signToken(_0x3971ba){return signJwt(_0x3971ba);};exports[_0x5729('0x57')]=function(_0x1d4d67,_0x2d9878){if(!_0x1d4d67[_0x5729('0x2b')]){return _0x2d9878[_0x5729('0x30')](0x194)[_0x5729('0x33')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x3a8a7e={'payload':{'id':_0x1d4d67['user']['id'],'role':_0x1d4d67[_0x5729('0x2b')][_0x5729('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3a8a7e)[_0x5729('0x2f')](function(_0xe4c2bc){_0x2d9878[_0x5729('0x58')](_0x5729('0x59'),_0xe4c2bc);_0x2d9878[_0x5729('0x5a')](_0x5729('0x5b'));})[_0x5729('0x36')](function(_0x5d2997){return _0x2d9878[_0x5729('0x30')](0x1f4)['send'](_0x5d2997);});};exports[_0x5729('0x5c')]=function(_0x1c495e){if(_['isNil'](_0x1c495e[_0x5729('0x5d')])||_[_0x5729('0x5e')](_0x1c495e[_0x5729('0x5f')])){return null;}else{return createJwt(_0x1c495e);}};exports[_0x5729('0x60')]=function(_0x502c1a){_0x502c1a[_0x5729('0x5d')]=generateNonce();_0x502c1a[_0x5729('0x5f')]=generateIssuedAt();return createJwt(_0x502c1a);};exports[_0x5729('0x61')]=function(_0x292a92,_0x505e81){var _0xf92a99=_0x292a92[_0x5729('0x41')][_0x5729('0x42')];if(_0xf92a99){var _0x49e890={'nonce':_0x505e81[_0x5729('0x5d')],'iat':_0x505e81[_0x5729('0x5f')],'audience':hardwareConf[_0x5729('0x40')](),'issuer':hardwareConf[_0x5729('0x40')]()};return verifyJwt(_0xf92a99,_0x49e890)[_0x5729('0x2f')](function(){return generateApiKey(_0x505e81);});}else{throw{'message':_0x5729('0x62')};}};exports[_0x5729('0x63')]=function(_0x55f67c){var _0x218e9d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x218e9d[_0x5729('0x64')](_0x55f67c))throw new db[(_0x5729('0x65'))]['ValidationError'](_0x5729('0x66'));return;};exports['validatePasswordHistory']=function(_0x3c3c53,_0x5a6d38,_0x4ed0eb){var _0x439d28=encryptor[_0x5729('0x67')](_0x5a6d38)['split'](',');for(var _0x1f212b=0x0;_0x1f212b<_0x4ed0eb;_0x1f212b++){if(!_0x439d28[_0x1f212b])break;if(_0x3c3c53[_0x5729('0x68')]()===_0x439d28[_0x1f212b]['toLowerCase']()){var _0x130c0a=util['format'](_0x5729('0x69'),_0x4ed0eb);if(_0x4ed0eb===0x1){_0x130c0a='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x5729('0x65'))][(_0x5729('0x6a'))](_0x130c0a);}}return;};exports['updatePasswordsHistory']=function(_0xb8cd18,_0x3145f5){var _0x4ec215=_0x3145f5?encryptor['decryptString'](_0x3145f5)[_0x5729('0x6b')](','):[];if(_0x4ec215[_0x5729('0x6c')]===0x5){_0x4ec215['splice'](-0x1,0x1);}_0x4ec215[_0x5729('0x6d')](_0xb8cd18);return encryptor['encryptString'](_0x4ec215[_0x5729('0x6e')](','));};function signJwt(_0x2e3775){var _0x110c73=BPromise[_0x5729('0x6f')](jwt[_0x5729('0x70')],{'context':jwt});var _0xbe9c9=_0x2e3775[_0x5729('0x71')]||config[_0x5729('0xb')][_0x5729('0x72')];return new BPromise(function(_0x288cc9,_0x4837ec){_0x110c73(_0x2e3775[_0x5729('0x73')],_0xbe9c9,_0x2e3775['options'])['then'](function(_0xfcbede){_0x288cc9(_0xfcbede);})[_0x5729('0x36')](function(_0x47a103){_0x4837ec(_0x47a103);});});}function verifyJwt(_0x5b3ab9,_0x2fcae,_0x5c0c74){var _0x48dae1=BPromise[_0x5729('0x6f')](jwt[_0x5729('0x74')],{'context':jwt});var _0x38f580=_0x5c0c74||config['secrets'][_0x5729('0x72')];return new BPromise(function(_0xad83f5,_0x2d255d){_0x48dae1(_0x5b3ab9,_0x38f580,_0x2fcae)[_0x5729('0x2f')](function(_0x1d77d1){_0xad83f5(_0x1d77d1);})[_0x5729('0x36')](function(_0x49031e){_0x2d255d(_0x49031e);});});}function generateNonce(){return crypto[_0x5729('0x75')](0x10)[_0x5729('0x76')](_0x5729('0x77'));}function generateIssuedAt(){return Math[_0x5729('0x78')](Date[_0x5729('0x79')]()/0x3e8)[_0x5729('0x76')]();}function createJwt(_0x34f68d){var _0x308596={'payload':{'iat':_0x34f68d[_0x5729('0x5f')],'nonce':_0x34f68d['apiKeyNonce']},'options':{'algorithm':_0x5729('0x7a'),'subject':_0x34f68d['id'][_0x5729('0x76')](),'issuer':hardwareConf[_0x5729('0x40')](),'audience':hardwareConf[_0x5729('0x40')]()}};return signJwt(_0x308596)[_0x5729('0x2f')](function(_0x14f51a){return{'iat':_0x34f68d['apiKeyIat'],'nonce':_0x34f68d[_0x5729('0x5d')],'token':_0x14f51a};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 9086bde..7d96dab 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 _0x32cc=['write','close','unlink','encryptString','secret','createCipher','utf8','base64','createDecipher','crypto','bluebird','../../config/environment','app','secrets','aes-256-ctr','aes192','algorithm','encrypt','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','data','update','end','final','binary'];(function(_0x31ddea,_0x40de6d){var _0x12539b=function(_0x1d353b){while(--_0x1d353b){_0x31ddea['push'](_0x31ddea['shift']());}};_0x12539b(++_0x40de6d);}(_0x32cc,0x171));var _0xc32c=function(_0x4096be,_0x1a7ca1){_0x4096be=_0x4096be-0x0;var _0x1455bd=_0x32cc[_0x4096be];return _0x1455bd;};'use strict';var crypto=require(_0xc32c('0x0'));var fs=require('fs');var BPromise=require(_0xc32c('0x1'));var _=require('lodash');var config=require(_0xc32c('0x2'));var logger=require('../../config/logger')(_0xc32c('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc32c('0x4')]['session'],'algorithm':_0xc32c('0x5')};const fileOptions={'algorithm':_0xc32c('0x6')};if(config['encrypt']&&config['encrypt'][_0xc32c('0x7')]){var isSupported=isAlgorithmSupported(config[_0xc32c('0x8')][_0xc32c('0x7')]);if(isSupported){fileOptions['algorithm']=config[_0xc32c('0x8')][_0xc32c('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0xc32c('0x8')][_0xc32c('0x7')],_0xc32c('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x14126c){return AES_SUPPORTED_RX['test'](_0x14126c);}function getSupportedCiphers(){return crypto[_0xc32c('0xa')]()[_0xc32c('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x3fbcf2){return getSupportedCiphers()[_0xc32c('0xc')](_0x3fbcf2)>-0x1;}function combineOptions(_0x592c4b){var _0x548d93={};for(var _0x1a4514 in fileOptions){if(fileOptions[_0xc32c('0xd')](_0x1a4514)){_0x548d93[_0x1a4514]=fileOptions[_0x1a4514];}}if(_0x592c4b){for(var _0x851f6a in _0x592c4b){if(_0x592c4b[_0xc32c('0xd')](_0x851f6a)){_0x548d93[_0x851f6a]=_0x592c4b[_0x851f6a];}}}return _0x548d93;}exports['encryptFile']=function(_0x24ac51,_0x461c60,_0x1a7119,_0x2919a4){return new BPromise(function(_0xa711be,_0x334501){_0x2919a4=combineOptions(_0x2919a4);var _0x5a4e05=new Buffer(_0x1a7119);var _0x1700e0=fs[_0xc32c('0xe')](_0x24ac51);var _0xf2bd68=fs[_0xc32c('0xf')](_0x461c60);var _0x128dd6=crypto['createCipher'](_0x2919a4['algorithm'],_0x5a4e05);_0x1700e0['on'](_0xc32c('0x10'),function(_0x2230e5){var _0x37a14f=new Buffer(_0x128dd6[_0xc32c('0x11')](_0x2230e5),'binary');_0xf2bd68['write'](_0x37a14f);});_0x1700e0['on'](_0xc32c('0x12'),function(){try{var _0xf83c6a=new Buffer(_0x128dd6[_0xc32c('0x13')](_0xc32c('0x14')),_0xc32c('0x14'));_0xf2bd68[_0xc32c('0x15')](_0xf83c6a);_0xf2bd68[_0xc32c('0x12')]();_0xf2bd68['on'](_0xc32c('0x16'),function(){return _0xa711be(_0x461c60);});}catch(_0x48a988){fs[_0xc32c('0x17')](_0x461c60);return _0x334501(_0x48a988);}});});};exports['decryptFile']=function(_0x254d56,_0x446945,_0x280f20,_0x152bad){return new BPromise(function(_0x429ff4,_0x5c17c0){_0x152bad=combineOptions(_0x152bad);var _0x4ebefb=new Buffer(_0x280f20);var _0x2f6efb=fs[_0xc32c('0xe')](_0x254d56);var _0x418b3f=fs[_0xc32c('0xf')](_0x446945);var _0x22bc2c=crypto['createDecipher'](_0x152bad[_0xc32c('0x7')],_0x4ebefb);_0x2f6efb['on'](_0xc32c('0x10'),function(_0x268b51){var _0x1e239c=new Buffer(_0x22bc2c['update'](_0x268b51),_0xc32c('0x14'));_0x418b3f[_0xc32c('0x15')](_0x1e239c);});_0x2f6efb['on']('end',function(){try{var _0x5a8fa4=new Buffer(_0x22bc2c[_0xc32c('0x13')]('binary'),_0xc32c('0x14'));_0x418b3f[_0xc32c('0x15')](_0x5a8fa4);_0x418b3f[_0xc32c('0x12')]();_0x418b3f['on'](_0xc32c('0x16'),function(){return _0x429ff4(_0x446945);});}catch(_0x2cf1f7){fs[_0xc32c('0x17')](_0x446945);return _0x5c17c0(_0x2cf1f7);}});});};exports[_0xc32c('0x18')]=function(_0x35c022,_0x5de3a4,_0x5ad0e2){var _0x5bae79=_0x5ad0e2||stringOptions[_0xc32c('0x7')];var _0x5e3ad1=_0x5de3a4||stringOptions[_0xc32c('0x19')];var _0xb32e0c=crypto[_0xc32c('0x1a')](_0x5bae79,_0x5e3ad1);var _0x2ce0df=_0xb32e0c[_0xc32c('0x11')](_0x35c022,_0xc32c('0x1b'),_0xc32c('0x1c'));_0x2ce0df+=_0xb32e0c[_0xc32c('0x13')](_0xc32c('0x1c'));return _0x2ce0df;};exports['decryptString']=function(_0x2353f5,_0x3586c5,_0x44a12f){var _0x375919=_0x44a12f||stringOptions['algorithm'];var _0x2c6836=_0x3586c5||stringOptions[_0xc32c('0x19')];var _0x502b9b=crypto[_0xc32c('0x1d')](_0x375919,_0x2c6836);var _0x3d06fa=_0x502b9b['update'](_0x2353f5,_0xc32c('0x1c'),'utf8');_0x3d06fa+=_0x502b9b[_0xc32c('0x13')](_0xc32c('0x1b'));return _0x3d06fa;}; \ No newline at end of file +var _0xd67d=['write','end','decryptFile','update','final','close','unlink','encryptString','createCipher','utf8','base64','decryptString','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','data','binary'];(function(_0x4c736a,_0x3fff9a){var _0x2a1a90=function(_0x8103ee){while(--_0x8103ee){_0x4c736a['push'](_0x4c736a['shift']());}};_0x2a1a90(++_0x3fff9a);}(_0xd67d,0xec));var _0xdd67=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xd67d[_0xdea41a];return _0x15d0d8;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xdd67('0x0'));var _=require(_0xdd67('0x1'));var config=require(_0xdd67('0x2'));var logger=require(_0xdd67('0x3'))(_0xdd67('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xdd67('0x5')][_0xdd67('0x6')],'algorithm':_0xdd67('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0xdd67('0x8')]&&config[_0xdd67('0x8')][_0xdd67('0x9')]){var isSupported=isAlgorithmSupported(config[_0xdd67('0x8')][_0xdd67('0x9')]);if(isSupported){fileOptions['algorithm']=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xdd67('0xa')](',\x20');logger[_0xdd67('0xb')](config[_0xdd67('0x8')][_0xdd67('0x9')],_0xdd67('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x28d054){return AES_SUPPORTED_RX['test'](_0x28d054);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xdd67('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x1f5022){return getSupportedCiphers()[_0xdd67('0xe')](_0x1f5022)>-0x1;}function combineOptions(_0x19e7e6){var _0x523dd0={};for(var _0x2a0992 in fileOptions){if(fileOptions[_0xdd67('0xf')](_0x2a0992)){_0x523dd0[_0x2a0992]=fileOptions[_0x2a0992];}}if(_0x19e7e6){for(var _0x8bec8f in _0x19e7e6){if(_0x19e7e6[_0xdd67('0xf')](_0x8bec8f)){_0x523dd0[_0x8bec8f]=_0x19e7e6[_0x8bec8f];}}}return _0x523dd0;}exports[_0xdd67('0x10')]=function(_0x5041bb,_0xf9ae55,_0x3d41ca,_0x28575f){return new BPromise(function(_0x2410d4,_0x5d3e0d){_0x28575f=combineOptions(_0x28575f);var _0x5086a7=new Buffer(_0x3d41ca);var _0x274578=fs[_0xdd67('0x11')](_0x5041bb);var _0x47aa04=fs['createWriteStream'](_0xf9ae55);var _0x237d33=crypto['createCipher'](_0x28575f[_0xdd67('0x9')],_0x5086a7);_0x274578['on'](_0xdd67('0x12'),function(_0x41a4a8){var _0x3e98f4=new Buffer(_0x237d33['update'](_0x41a4a8),_0xdd67('0x13'));_0x47aa04[_0xdd67('0x14')](_0x3e98f4);});_0x274578['on'](_0xdd67('0x15'),function(){try{var _0x59433b=new Buffer(_0x237d33['final'](_0xdd67('0x13')),_0xdd67('0x13'));_0x47aa04[_0xdd67('0x14')](_0x59433b);_0x47aa04[_0xdd67('0x15')]();_0x47aa04['on']('close',function(){return _0x2410d4(_0xf9ae55);});}catch(_0x2c4df5){fs['unlink'](_0xf9ae55);return _0x5d3e0d(_0x2c4df5);}});});};exports[_0xdd67('0x16')]=function(_0x2b73f7,_0x3c773b,_0x5c4234,_0x4e1459){return new BPromise(function(_0x2783e,_0x4b762b){_0x4e1459=combineOptions(_0x4e1459);var _0x307608=new Buffer(_0x5c4234);var _0x3e2757=fs[_0xdd67('0x11')](_0x2b73f7);var _0x54d38b=fs['createWriteStream'](_0x3c773b);var _0x647aec=crypto['createDecipher'](_0x4e1459['algorithm'],_0x307608);_0x3e2757['on'](_0xdd67('0x12'),function(_0x2d03de){var _0x53b8ef=new Buffer(_0x647aec[_0xdd67('0x17')](_0x2d03de),_0xdd67('0x13'));_0x54d38b[_0xdd67('0x14')](_0x53b8ef);});_0x3e2757['on'](_0xdd67('0x15'),function(){try{var _0x3de2b9=new Buffer(_0x647aec[_0xdd67('0x18')]('binary'),_0xdd67('0x13'));_0x54d38b[_0xdd67('0x14')](_0x3de2b9);_0x54d38b['end']();_0x54d38b['on'](_0xdd67('0x19'),function(){return _0x2783e(_0x3c773b);});}catch(_0x3b4084){fs[_0xdd67('0x1a')](_0x3c773b);return _0x4b762b(_0x3b4084);}});});};exports[_0xdd67('0x1b')]=function(_0x5f07f7,_0x5cb75f,_0x8c2bd7){var _0xb816a9=_0x8c2bd7||stringOptions[_0xdd67('0x9')];var _0x4aa8e4=_0x5cb75f||stringOptions['secret'];var _0x53e696=crypto[_0xdd67('0x1c')](_0xb816a9,_0x4aa8e4);var _0xe68aea=_0x53e696[_0xdd67('0x17')](_0x5f07f7,_0xdd67('0x1d'),_0xdd67('0x1e'));_0xe68aea+=_0x53e696[_0xdd67('0x18')]('base64');return _0xe68aea;};exports[_0xdd67('0x1f')]=function(_0x1178e0,_0x7a285a,_0x5df70a){var _0x2fa93f=_0x5df70a||stringOptions[_0xdd67('0x9')];var _0x21805e=_0x7a285a||stringOptions['secret'];var _0xe4dcea=crypto['createDecipher'](_0x2fa93f,_0x21805e);var _0x4565d1=_0xe4dcea['update'](_0x1178e0,_0xdd67('0x1e'),'utf8');_0x4565d1+=_0xe4dcea['final'](_0xdd67('0x1d'));return _0x4565d1;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 3d05647..f1fc4d1 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 _0x36d6=['catch','inspect','Failed','finally','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','query','sequelize','QueryTypes','SELECT','num','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x39feab,_0x1efcb6){var _0x44f6ec=function(_0x36b476){while(--_0x36b476){_0x39feab['push'](_0x39feab['shift']());}};_0x44f6ec(++_0x1efcb6);}(_0x36d6,0xf4));var _0x636d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36d6[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x636d('0x0'));var path=require(_0x636d('0x1'));var _=require(_0x636d('0x2'));var csv=require(_0x636d('0x3'));var fs=require('fs');var BPromise=require(_0x636d('0x4'));var zipdir=require(_0x636d('0x5'));var rimraf=require(_0x636d('0x6'));var db=require(_0x636d('0x7'))['db'];var dbH=require(_0x636d('0x7'))[_0x636d('0x8')];var logger=require(_0x636d('0x9'))(_0x636d('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x636d('0xb')][0x2]);var QUERY=process[_0x636d('0xb')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5bd3fc,_0x12eb30){var _0x36132c={'status':_0x5bd3fc};var _0x36eae6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x12eb30){_0x36132c[_0x636d('0xc')]=_0x12eb30;}return db['AnalyticExtractedReport'][_0x636d('0xd')](_0x36132c,_0x36eae6);}function main(){var _0x3d7fb0=0x1388;var _0x5b92a8;logger[_0x636d('0xe')](util[_0x636d('0xf')](_0x636d('0x10'),EXTRACTED_REPORT_ID,_0x636d('0x11')));return db[_0x636d('0x12')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x636d('0x13'),_0x636d('0x14')]})[_0x636d('0x15')](function(_0x3f41c6){if(_0x3f41c6){_0x5b92a8=_0x3f41c6;_0x3d7fb0=_0x5b92a8[_0x636d('0x14')]||0x1388;}})[_0x636d('0x15')](function(){return dbH['sequelize'][_0x636d('0x16')](util[_0x636d('0xf')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x636d('0x17')][_0x636d('0x18')][_0x636d('0x19')]});})['then'](function(_0x4893af){if(!_0x4893af[0x0][_0x636d('0x1a')]){return analyticExtractedReport('Empty');}var _0x57c837=[];var _0x5157aa=0x0;if(_0x5b92a8[_0x636d('0x13')]){if(_0x4893af&&_0x4893af[_0x636d('0x1b')]){var _0x5366b7=_[_0x636d('0x1c')](_0x4893af[0x0][_0x636d('0x1a')]/_0x3d7fb0);var _0x890a32=Number['isInteger'](_0x4893af[0x0]['num']/_0x3d7fb0)?_0x4893af[0x0][_0x636d('0x1a')]%_0x3d7fb0:0x0;_0x5366b7[_0x636d('0x1d')](function(_0x2d502f){if(_0x2d502f>0x0){_0x5157aa+=_0x3d7fb0;}_0x57c837[_0x636d('0x1e')](dbH[_0x636d('0x17')][_0x636d('0x16')](util[_0x636d('0xf')](_0x636d('0x1f'),QUERY,_0x3d7fb0,_0x5157aa),{'type':dbH[_0x636d('0x17')][_0x636d('0x18')][_0x636d('0x19')]}));});if(_0x890a32>0x0){_0x5157aa+=_0x3d7fb0;_0x57c837['push'](dbH['sequelize'][_0x636d('0x16')](util[_0x636d('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x890a32,_0x5157aa),{'type':dbH[_0x636d('0x17')][_0x636d('0x18')][_0x636d('0x19')]}));}}}else{_0x57c837['push'](dbH[_0x636d('0x17')][_0x636d('0x16')](QUERY,{'type':dbH['sequelize'][_0x636d('0x18')]['SELECT']}));}var _0x2bf6c9=path[_0x636d('0x20')](PATH);var _0x1e955f=path['basename'](PATH,_0x636d('0x21'));var _0x455e57=_0x5b92a8[_0x636d('0x13')]&&_0x57c837[_0x636d('0x1b')]>0x1;var _0x1b8640=[];if(!fs[_0x636d('0x22')](path['join'](_0x2bf6c9,_0x1e955f))&&_0x455e57){fs[_0x636d('0x23')](path[_0x636d('0x24')](_0x2bf6c9,_0x1e955f));}return BPromise[_0x636d('0x25')](_0x57c837,function(_0x509249){_0x1b8640['push'](_0x509249);})['then'](function(){for(var _0x31b43d=0x0;_0x31b43d<_0x1b8640[_0x636d('0x1b')];_0x31b43d+=0x1){var _0x40ad64;var _0x1865dc=_0x1b8640[_0x31b43d];if(_0x455e57){_0x40ad64=path['join'](_0x2bf6c9,_0x1e955f,util[_0x636d('0xf')](_0x636d('0x26'),_0x1e955f,_0x31b43d,_0x636d('0x27')));}else{_0x40ad64=path[_0x636d('0x24')](_0x2bf6c9,util['format'](_0x636d('0x28'),_0x1e955f,_0x636d('0x27')));}fs[_0x636d('0x29')](_0x40ad64,csv(_0x1865dc));}})['then'](function(){if(_0x455e57){return new Promise(function(_0x44dc74){zipdir(path[_0x636d('0x24')](_0x2bf6c9,_0x1e955f),{'saveTo':path[_0x636d('0x24')](_0x2bf6c9,util['format'](_0x636d('0x28'),_0x1e955f,_0x636d('0x2a')))},function(_0x4bc2a3,_0x42f187){rimraf(path[_0x636d('0x24')](_0x2bf6c9,_0x1e955f),function(){});_0x44dc74('zip\x20finished');});});}})[_0x636d('0x15')](function(){logger['info'](util[_0x636d('0xf')](_0x636d('0x2b'),EXTRACTED_REPORT_ID,_0x636d('0x11')));return analyticExtractedReport('Completed',_0x455e57?util[_0x636d('0xf')](_0x636d('0x28'),_0x1e955f,_0x455e57?_0x636d('0x2a'):_0x636d('0x27')):null);});})[_0x636d('0x2c')](function(_0x3b4e48){logger['info'](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x636d('0x11')),util[_0x636d('0x2d')](_0x3b4e48,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x636d('0x2e'));})[_0x636d('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x9640=['sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','length','existsSync','join','mkdirSync','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then'];(function(_0x490014,_0x519ad6){var _0x289bee=function(_0x44fcc8){while(--_0x44fcc8){_0x490014['push'](_0x490014['shift']());}};_0x289bee(++_0x519ad6);}(_0x9640,0x1e1));var _0x0964=function(_0x590f9f,_0x3b1a10){_0x590f9f=_0x590f9f-0x0;var _0x1e483b=_0x9640[_0x590f9f];return _0x1e483b;};'use strict';var util=require(_0x0964('0x0'));var path=require(_0x0964('0x1'));var _=require('lodash');var csv=require(_0x0964('0x2'));var fs=require('fs');var BPromise=require(_0x0964('0x3'));var zipdir=require(_0x0964('0x4'));var rimraf=require(_0x0964('0x5'));var db=require(_0x0964('0x6'))['db'];var dbH=require(_0x0964('0x6'))[_0x0964('0x7')];var logger=require(_0x0964('0x8'))(_0x0964('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x0964('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1deaee,_0x15e3b9){var _0x54626f={'status':_0x1deaee};var _0x9f1db0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x15e3b9){_0x54626f['savename']=_0x15e3b9;}return db['AnalyticExtractedReport']['update'](_0x54626f,_0x9f1db0);}function main(){var _0x3d5a26=0x1388;var _0x3bb196;logger[_0x0964('0xb')](util[_0x0964('0xc')](_0x0964('0xd'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x0964('0xe')][_0x0964('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0964('0x10'),_0x0964('0x11')]})['then'](function(_0x41d627){if(_0x41d627){_0x3bb196=_0x41d627;_0x3d5a26=_0x3bb196['splitSizeCsv']||0x1388;}})[_0x0964('0x12')](function(){return dbH[_0x0964('0x13')][_0x0964('0x14')](util[_0x0964('0xc')](_0x0964('0x15'),QUERY),{'type':dbH['sequelize'][_0x0964('0x16')][_0x0964('0x17')]});})[_0x0964('0x12')](function(_0x2fb925){if(!_0x2fb925[0x0]['num']){return analyticExtractedReport(_0x0964('0x18'));}var _0xafdfbc=[];var _0x562d32=0x0;if(_0x3bb196[_0x0964('0x10')]){if(_0x2fb925&&_0x2fb925['length']){var _0xa15991=_[_0x0964('0x19')](_0x2fb925[0x0][_0x0964('0x1a')]/_0x3d5a26);var _0x2db449=Number[_0x0964('0x1b')](_0x2fb925[0x0][_0x0964('0x1a')]/_0x3d5a26)?_0x2fb925[0x0][_0x0964('0x1a')]%_0x3d5a26:0x0;_0xa15991[_0x0964('0x1c')](function(_0x4fb940){if(_0x4fb940>0x0){_0x562d32+=_0x3d5a26;}_0xafdfbc['push'](dbH[_0x0964('0x13')][_0x0964('0x14')](util[_0x0964('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3d5a26,_0x562d32),{'type':dbH[_0x0964('0x13')][_0x0964('0x16')]['SELECT']}));});if(_0x2db449>0x0){_0x562d32+=_0x3d5a26;_0xafdfbc[_0x0964('0x1d')](dbH[_0x0964('0x13')]['query'](util[_0x0964('0xc')](_0x0964('0x1e'),QUERY,_0x2db449,_0x562d32),{'type':dbH[_0x0964('0x13')]['QueryTypes'][_0x0964('0x17')]}));}}}else{_0xafdfbc[_0x0964('0x1d')](dbH[_0x0964('0x13')][_0x0964('0x14')](QUERY,{'type':dbH[_0x0964('0x13')]['QueryTypes'][_0x0964('0x17')]}));}var _0x487c8b=path['dirname'](PATH);var _0x1eca74=path[_0x0964('0x1f')](PATH,'.csv');var _0x40d40e=_0x3bb196['split']&&_0xafdfbc[_0x0964('0x20')]>0x1;var _0x19227d=[];if(!fs[_0x0964('0x21')](path[_0x0964('0x22')](_0x487c8b,_0x1eca74))&&_0x40d40e){fs[_0x0964('0x23')](path[_0x0964('0x22')](_0x487c8b,_0x1eca74));}return BPromise['each'](_0xafdfbc,function(_0x3a248f){_0x19227d[_0x0964('0x1d')](_0x3a248f);})[_0x0964('0x12')](function(){for(var _0x461b97=0x0;_0x461b97<_0x19227d[_0x0964('0x20')];_0x461b97+=0x1){var _0x3649c0;var _0x3097dd=_0x19227d[_0x461b97];if(_0x40d40e){_0x3649c0=path[_0x0964('0x22')](_0x487c8b,_0x1eca74,util[_0x0964('0xc')](_0x0964('0x24'),_0x1eca74,_0x461b97,_0x0964('0x25')));}else{_0x3649c0=path[_0x0964('0x22')](_0x487c8b,util[_0x0964('0xc')]('%s.%s',_0x1eca74,_0x0964('0x25')));}fs[_0x0964('0x26')](_0x3649c0,csv(_0x3097dd));}})[_0x0964('0x12')](function(){if(_0x40d40e){return new Promise(function(_0x42820c){zipdir(path['join'](_0x487c8b,_0x1eca74),{'saveTo':path[_0x0964('0x22')](_0x487c8b,util[_0x0964('0xc')](_0x0964('0x27'),_0x1eca74,_0x0964('0x28')))},function(_0x3fc4f0,_0x272356){rimraf(path[_0x0964('0x22')](_0x487c8b,_0x1eca74),function(){});_0x42820c(_0x0964('0x29'));});});}})['then'](function(){logger[_0x0964('0xb')](util[_0x0964('0xc')](_0x0964('0x2a'),EXTRACTED_REPORT_ID,_0x0964('0x2b')));return analyticExtractedReport(_0x0964('0x2c'),_0x40d40e?util[_0x0964('0xc')](_0x0964('0x27'),_0x1eca74,_0x40d40e?'zip':_0x0964('0x25')):null);});})['catch'](function(_0x19adb3){logger[_0x0964('0xb')](util['format'](_0x0964('0x2d'),EXTRACTED_REPORT_ID,_0x0964('0x2b')),util[_0x0964('0x2e')](_0x19adb3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0964('0x2f'));})[_0x0964('0x30')](function(){process[_0x0964('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 71902cf..58b24cc 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 _0x75f6=['center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','path','lodash','util','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','value','fill','body','push','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','pageBreak','before','landscape','toString','\x20/\x20','footer','black','right','num','Empty','Setting','find','split','splitSizePdf','then','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','query','dirname','length','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD'];(function(_0x328347,_0x4f3389){var _0x508f7a=function(_0x205e34){while(--_0x205e34){_0x328347['push'](_0x328347['shift']());}};_0x508f7a(++_0x4f3389);}(_0x75f6,0x171));var _0x675f=function(_0x523e42,_0x4449bf){_0x523e42=_0x523e42-0x0;var _0x476393=_0x75f6[_0x523e42];return _0x476393;};'use strict';var _=require(_0x675f('0x0'));var fs=require('fs');var util=require(_0x675f('0x1'));var path=require('path');var moment=require(_0x675f('0x2'));var htmlToPdfmake=require(_0x675f('0x3'));var PdfPrinter=require(_0x675f('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x675f('0x5'));var JSDOM=require(_0x675f('0x6'))[_0x675f('0x7')];var window=new JSDOM('')[_0x675f('0x8')];var BPromise=require(_0x675f('0x9'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x675f('0xa'))(_0x675f('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x675f('0xc')][0x4];var NAME=process[_0x675f('0xc')][0x5];var FORMAT=_0x675f('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1f81c2,_0x4538c6){var _0x4125a1={'status':_0x1f81c2};var _0x67a5a5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4538c6){_0x4125a1[_0x675f('0xe')]=_0x4538c6;}return db['AnalyticExtractedReport'][_0x675f('0xf')](_0x4125a1,_0x67a5a5);}function getHeaders(_0x22ca8d){return _[_0x675f('0x10')](_0x22ca8d,function(_0x3337b6){return{'text':_0x3337b6,'style':_0x675f('0x11')};});}function getRows(_0x24003a,_0x3a7020){return _[_0x675f('0x10')](_0x3a7020,function(_0x2fd9be){return _(_0x2fd9be)[_0x675f('0x12')](_0x24003a)[_0x675f('0x10')](function(_0x302463){return _0x302463?_['toString'](_0x302463):'';})[_0x675f('0x13')]();});}function createTable(_0x15b53b,_0x1f3781){var _0x533e99={'widths':_[_0x675f('0x14')](Array(_0x15b53b['length']),0x91),'heights':function(_0x4838d1){return _0x4838d1===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x55844c=getHeaders(_0x15b53b);_0x533e99[_0x675f('0x15')][_0x675f('0x16')](_0x55844c);var _0x45b00c=getRows(_0x15b53b,_0x1f3781);_0x533e99[_0x675f('0x15')]=_0x533e99[_0x675f('0x15')]['concat'](_0x45b00c);return _0x533e99;}function createTables(_0x283f25){var _0x25d0bd=[];var _0x2448c8=_[_0x675f('0x17')](Object[_0x675f('0x18')](_0x283f25[0x0]),0x5);_0x2448c8[_0x675f('0x19')](function(_0x5b4919){_0x25d0bd[_0x675f('0x16')](createTable(_0x5b4919,_0x283f25));});return _0x25d0bd;}function getPDFDocDefinition(_0x42863d){var _0x4524ca=util[_0x675f('0x1a')](_0x675f('0x1b'),NAME,EXTRACTED_REPORT[_0x675f('0x1c')],moment(EXTRACTED_REPORT['startDate'])[_0x675f('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x675f('0x1d')])[_0x675f('0x1a')](FORMAT));var _0x2e14db=[];for(var _0x2c672a=0x0;_0x2c672a<_0x42863d['length'];_0x2c672a++){var _0x431387=[];if(_0x2c672a===0x0){_0x431387[_0x675f('0x16')]({'text':_0x4524ca,'style':'header'});}var _0x514782={'table':_0x42863d[_0x2c672a]};if(_0x2c672a>0x0){_0x514782[_0x675f('0x1e')]=_0x675f('0x1f');_0x514782['margin']=[0x0,0x46,0x0,0x0];}_0x431387[_0x675f('0x16')](_0x514782);_0x2e14db[_0x675f('0x16')](_0x431387);}return{'pageSize':'A4','pageOrientation':_0x675f('0x20'),'content':_0x2e14db,'footer':function(_0x80fb12,_0x148e64){return{'text':_0x80fb12[_0x675f('0x21')]()+_0x675f('0x22')+_0x148e64,'style':_0x675f('0x23')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x675f('0x24')},'footer':{'alignment':_0x675f('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x442899){var _0x479ee7=0x1388;var _0x204dde;if(!_0x442899[0x0][_0x675f('0x26')]){return analyticExtractedReport(_0x675f('0x27'));}return db[_0x675f('0x28')][_0x675f('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x675f('0x2a'),_0x675f('0x2b')]})[_0x675f('0x2c')](function(_0x31ccb6){if(_0x31ccb6){_0x204dde=_0x31ccb6;_0x479ee7=_0x204dde[_0x675f('0x2b')]||0x3e8;}})['then'](function(){var _0x391f10=[];var _0x3d7efb=0x0;if(_0x204dde[_0x675f('0x2a')]){if(_0x442899&&_0x442899['length']){var _0x83cb3d=_['range'](_0x442899[0x0][_0x675f('0x26')]/_0x479ee7);var _0x22ca1a=Number[_0x675f('0x2d')](_0x442899[0x0][_0x675f('0x26')]/_0x479ee7)?_0x442899[0x0][_0x675f('0x26')]%_0x479ee7:0x0;_0x83cb3d[_0x675f('0x19')](function(_0x4719bd){if(_0x4719bd>0x0){_0x3d7efb+=_0x479ee7;}_0x391f10['push'](dbH['sequelize']['query'](util[_0x675f('0x1a')](_0x675f('0x2e'),QUERY,_0x479ee7,_0x3d7efb),{'type':dbH['sequelize'][_0x675f('0x2f')][_0x675f('0x30')]}));});if(_0x22ca1a>0x0){_0x3d7efb+=_0x479ee7;_0x391f10[_0x675f('0x16')](dbH[_0x675f('0x31')][_0x675f('0x32')](util['format'](_0x675f('0x2e'),QUERY,_0x22ca1a,_0x3d7efb),{'type':dbH[_0x675f('0x31')][_0x675f('0x2f')]['SELECT']}));}}}else{_0x391f10['push'](dbH['sequelize'][_0x675f('0x32')](QUERY,{'type':dbH[_0x675f('0x31')][_0x675f('0x2f')][_0x675f('0x30')]}));}var _0x39a935=path[_0x675f('0x33')](PATH);var _0x4662dd=path['basename'](PATH,'.pdf');var _0x496afa=_0x204dde[_0x675f('0x2a')]&&_0x391f10[_0x675f('0x34')]>0x1;var _0x7df918=[];if(!fs[_0x675f('0x35')](path[_0x675f('0x36')](_0x39a935,_0x4662dd))&&_0x496afa){fs[_0x675f('0x37')](path['join'](_0x39a935,_0x4662dd));}return BPromise[_0x675f('0x38')](_0x391f10,function(_0x35430f){_0x7df918[_0x675f('0x16')](_0x35430f);})['then'](function(){var _0x32d14=[];for(var _0x7079f4=0x0;_0x7079f4<_0x7df918[_0x675f('0x34')];_0x7079f4+=0x1){var _0x265261=_0x7df918[_0x7079f4];var _0x4c7a85=createTables(_[_0x675f('0x39')](_0x265261));var _0x1a2a3b;var _0x5d02d2=getPDFDocDefinition(_0x4c7a85);var _0x11aa59=getPDFPrinter();var _0x1e84d4=_0x11aa59[_0x675f('0x3a')](_0x5d02d2);if(_0x496afa){_0x1a2a3b=path['join'](_0x39a935,_0x4662dd,util[_0x675f('0x1a')](_0x675f('0x3b'),_0x4662dd,_0x7079f4,_0x675f('0x3c')));}else{_0x1a2a3b=path[_0x675f('0x36')](_0x39a935,util[_0x675f('0x1a')](_0x675f('0x3d'),_0x4662dd,_0x675f('0x3c')));}_0x32d14[_0x675f('0x16')](writePDFDocument(_0x1e84d4,_0x1a2a3b));}return Promise['all'](_0x32d14);})[_0x675f('0x2c')](function(){if(_0x496afa){return new Promise(function(_0x30dd64){zipdir(path['join'](_0x39a935,_0x4662dd),{'saveTo':path['join'](_0x39a935,util[_0x675f('0x1a')](_0x675f('0x3d'),_0x4662dd,_0x675f('0x3e')))},function(){rimraf(path[_0x675f('0x36')](_0x39a935,_0x4662dd),function(){});_0x30dd64(_0x675f('0x3f'));});});}})[_0x675f('0x2c')](function(){if(!_0x496afa)return;rimraf(path[_0x675f('0x36')](_0x39a935,_0x4662dd),function(){});})[_0x675f('0x2c')](function(){logger[_0x675f('0x40')](util[_0x675f('0x1a')](_0x675f('0x41'),EXTRACTED_REPORT_ID,_0x675f('0x42')));return analyticExtractedReport('Completed',_0x496afa?util[_0x675f('0x1a')](_0x675f('0x3d'),_0x4662dd,_0x496afa?_0x675f('0x3e'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x675f('0x40')](util['format'](_0x675f('0x43'),EXTRACTED_REPORT_ID,_0x675f('0x42')));return db[_0x675f('0x44')][_0x675f('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x675f('0x2c')](function(_0x3bbba6){EXTRACTED_REPORT=_0x3bbba6;return dbH[_0x675f('0x31')][_0x675f('0x32')](util[_0x675f('0x1a')](_0x675f('0x46'),QUERY),{'type':dbH[_0x675f('0x31')][_0x675f('0x2f')][_0x675f('0x30')]});})[_0x675f('0x2c')](extractReport)[_0x675f('0x47')](function(_0x186bfe){logger[_0x675f('0x40')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x675f('0x42')),util['inspect'](_0x186bfe,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x675f('0x48'));})[_0x675f('0x49')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2e5ff8=new PdfPrinter({'Arial':{'normal':__dirname+_0x675f('0x4a'),'bold':__dirname+_0x675f('0x4b'),'italics':__dirname+_0x675f('0x4c'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x2e5ff8;}function getPDFDocDefinitionFromHTML(_0x3f94ba,_0x4e01a4){var _0x498e5a=util[_0x675f('0x1a')](_0x675f('0x4d'),_0x4e01a4[_0x675f('0x4e')],_0x4e01a4[_0x675f('0x4f')]);var _0x242b8e=moment()[_0x675f('0x1a')](_0x675f('0x50'))['toString']();var _0x31a27e=htmlToPdfmake(_0x3f94ba,{'window':window,'tableAutoSize':!![]});return{'content':[_0x31a27e],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x675f('0x51'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x675f('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x675f('0x51')}},'header':function(){return[{'text':_0x675f('0x52'),'style':_0x675f('0x53')}];},'footer':function(_0x3c4139,_0x49db30){return[{'text':util[_0x675f('0x1a')](_0x675f('0x54'),_0x498e5a,_0x3c4139,_0x49db30,_0x242b8e),'style':_0x675f('0x23')}];}};}function writePDFDocument(_0x1fdbbf,_0x3cf7e6){return new Promise(function(_0xf349bf,_0xbf2d43){var _0x11f10c=_0x1fdbbf[_0x675f('0x55')](fs[_0x675f('0x56')](_0x3cf7e6));_0x11f10c['on'](_0x675f('0x57'),function(){_0xf349bf(_0x675f('0x57'));});_0x11f10c['on'](_0x675f('0x58'),function(_0x36a02d){_0xbf2d43(_0x36a02d);});_0x1fdbbf['end']();});}exports['createPdfFromHTML']=function(_0x51767a,_0x18759d){var _0x1ac552=getPDFPrinter();var _0x3b3112=getPDFDocDefinitionFromHTML(_0x51767a,_0x18759d);var _0x2807a4=_0x1ac552[_0x675f('0x3a')](_0x3b3112);return writePDFDocument(_0x2807a4,_0x18759d[_0x675f('0x59')])['catch'](function(_0x1b46c1){throw _0x1b46c1;});}; \ No newline at end of file +var _0x7323=['find','split','splitSizePdf','then','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.pdf','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','all','zip','zip\x20finished','info','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','catch','inspect','Failed','exit','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end','createPdfFromHTML','lodash','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','pick','toString','value','fill','length','push','body','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','format','header','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty'];(function(_0x14250b,_0x511de5){var _0x3ca347=function(_0x1b43b2){while(--_0x1b43b2){_0x14250b['push'](_0x14250b['shift']());}};_0x3ca347(++_0x511de5);}(_0x7323,0x18e));var _0x3732=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0x7323[_0x1ac120];return _0x19b703;};'use strict';var _=require(_0x3732('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0x3732('0x1'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x3732('0x2'));var zipdir=require(_0x3732('0x3'));var rimraf=require(_0x3732('0x4'));var JSDOM=require(_0x3732('0x5'))[_0x3732('0x6')];var window=new JSDOM('')[_0x3732('0x7')];var BPromise=require(_0x3732('0x8'));var db=require('../../mysqldb')['db'];var dbH=require(_0x3732('0x9'))[_0x3732('0xa')];var logger=require(_0x3732('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x3732('0xc')][0x2]);var QUERY=process[_0x3732('0xc')][0x3];var PATH=process[_0x3732('0xc')][0x4];var NAME=process[_0x3732('0xc')][0x5];var FORMAT=_0x3732('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3daefd,_0x1b0f1f){var _0x339649={'status':_0x3daefd};var _0x51a9f9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b0f1f){_0x339649[_0x3732('0xe')]=_0x1b0f1f;}return db['AnalyticExtractedReport'][_0x3732('0xf')](_0x339649,_0x51a9f9);}function getHeaders(_0x3fa1b9){return _['map'](_0x3fa1b9,function(_0x5482d3){return{'text':_0x5482d3,'style':'tableHeader'};});}function getRows(_0x41cbb9,_0x4bd0e2){return _[_0x3732('0x10')](_0x4bd0e2,function(_0x27c55d){return _(_0x27c55d)[_0x3732('0x11')](_0x41cbb9)[_0x3732('0x10')](function(_0x4025af){return _0x4025af?_[_0x3732('0x12')](_0x4025af):'';})[_0x3732('0x13')]();});}function createTable(_0x35ebc7,_0x41bc23){var _0x2fbfe3={'widths':_[_0x3732('0x14')](Array(_0x35ebc7[_0x3732('0x15')]),0x91),'heights':function(_0x5ac833){return _0x5ac833===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x58552f=getHeaders(_0x35ebc7);_0x2fbfe3['body'][_0x3732('0x16')](_0x58552f);var _0x541660=getRows(_0x35ebc7,_0x41bc23);_0x2fbfe3[_0x3732('0x17')]=_0x2fbfe3[_0x3732('0x17')][_0x3732('0x18')](_0x541660);return _0x2fbfe3;}function createTables(_0x29c867){var _0xb661df=[];var _0x5d73b1=_[_0x3732('0x19')](Object[_0x3732('0x1a')](_0x29c867[0x0]),0x5);_0x5d73b1[_0x3732('0x1b')](function(_0x188035){_0xb661df[_0x3732('0x16')](createTable(_0x188035,_0x29c867));});return _0xb661df;}function getPDFDocDefinition(_0x348576){var _0x1b1438=util['format'](_0x3732('0x1c'),NAME,EXTRACTED_REPORT[_0x3732('0x1d')],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x3732('0x1e')](FORMAT));var _0x5b3bd7=[];for(var _0x375c5b=0x0;_0x375c5b<_0x348576[_0x3732('0x15')];_0x375c5b++){var _0x421373=[];if(_0x375c5b===0x0){_0x421373['push']({'text':_0x1b1438,'style':_0x3732('0x1f')});}var _0x32cbc6={'table':_0x348576[_0x375c5b]};if(_0x375c5b>0x0){_0x32cbc6['pageBreak']=_0x3732('0x20');_0x32cbc6[_0x3732('0x21')]=[0x0,0x46,0x0,0x0];}_0x421373[_0x3732('0x16')](_0x32cbc6);_0x5b3bd7[_0x3732('0x16')](_0x421373);}return{'pageSize':'A4','pageOrientation':_0x3732('0x22'),'content':_0x5b3bd7,'footer':function(_0x2521b7,_0x2c3d56){return{'text':_0x2521b7[_0x3732('0x12')]()+_0x3732('0x23')+_0x2c3d56,'style':_0x3732('0x24')};},'defaultStyle':{'font':_0x3732('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x3732('0x26')},'footer':{'alignment':_0x3732('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x53f685){var _0x25e495=0x1388;var _0x23b174;if(!_0x53f685[0x0][_0x3732('0x28')]){return analyticExtractedReport(_0x3732('0x29'));}return db['Setting'][_0x3732('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3732('0x2b'),_0x3732('0x2c')]})[_0x3732('0x2d')](function(_0x692813){if(_0x692813){_0x23b174=_0x692813;_0x25e495=_0x23b174[_0x3732('0x2c')]||0x3e8;}})['then'](function(){var _0x4365b7=[];var _0x13aeeb=0x0;if(_0x23b174['split']){if(_0x53f685&&_0x53f685[_0x3732('0x15')]){var _0x2b4f5a=_['range'](_0x53f685[0x0][_0x3732('0x28')]/_0x25e495);var _0x28d04a=Number[_0x3732('0x2e')](_0x53f685[0x0][_0x3732('0x28')]/_0x25e495)?_0x53f685[0x0][_0x3732('0x28')]%_0x25e495:0x0;_0x2b4f5a[_0x3732('0x1b')](function(_0x201d1f){if(_0x201d1f>0x0){_0x13aeeb+=_0x25e495;}_0x4365b7['push'](dbH[_0x3732('0x2f')][_0x3732('0x30')](util[_0x3732('0x1e')](_0x3732('0x31'),QUERY,_0x25e495,_0x13aeeb),{'type':dbH['sequelize']['QueryTypes'][_0x3732('0x32')]}));});if(_0x28d04a>0x0){_0x13aeeb+=_0x25e495;_0x4365b7[_0x3732('0x16')](dbH[_0x3732('0x2f')]['query'](util['format'](_0x3732('0x31'),QUERY,_0x28d04a,_0x13aeeb),{'type':dbH['sequelize']['QueryTypes'][_0x3732('0x32')]}));}}}else{_0x4365b7[_0x3732('0x16')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x3732('0x2f')][_0x3732('0x33')][_0x3732('0x32')]}));}var _0x486305=path[_0x3732('0x34')](PATH);var _0x37e4e7=path[_0x3732('0x35')](PATH,_0x3732('0x36'));var _0x1c3e73=_0x23b174[_0x3732('0x2b')]&&_0x4365b7[_0x3732('0x15')]>0x1;var _0x12d528=[];if(!fs['existsSync'](path[_0x3732('0x37')](_0x486305,_0x37e4e7))&&_0x1c3e73){fs[_0x3732('0x38')](path[_0x3732('0x37')](_0x486305,_0x37e4e7));}return BPromise[_0x3732('0x39')](_0x4365b7,function(_0x1c6584){_0x12d528[_0x3732('0x16')](_0x1c6584);})[_0x3732('0x2d')](function(){var _0x1bd545=[];for(var _0x162b30=0x0;_0x162b30<_0x12d528['length'];_0x162b30+=0x1){var _0x331cdc=_0x12d528[_0x162b30];var _0x4c8c5c=createTables(_[_0x3732('0x3a')](_0x331cdc));var _0x489bca;var _0x1ac457=getPDFDocDefinition(_0x4c8c5c);var _0x307c06=getPDFPrinter();var _0x507b46=_0x307c06[_0x3732('0x3b')](_0x1ac457);if(_0x1c3e73){_0x489bca=path[_0x3732('0x37')](_0x486305,_0x37e4e7,util[_0x3732('0x1e')]('%s%d.%s',_0x37e4e7,_0x162b30,_0x3732('0x3c')));}else{_0x489bca=path[_0x3732('0x37')](_0x486305,util[_0x3732('0x1e')](_0x3732('0x3d'),_0x37e4e7,_0x3732('0x3c')));}_0x1bd545[_0x3732('0x16')](writePDFDocument(_0x507b46,_0x489bca));}return Promise[_0x3732('0x3e')](_0x1bd545);})[_0x3732('0x2d')](function(){if(_0x1c3e73){return new Promise(function(_0x53ec5c){zipdir(path[_0x3732('0x37')](_0x486305,_0x37e4e7),{'saveTo':path[_0x3732('0x37')](_0x486305,util[_0x3732('0x1e')](_0x3732('0x3d'),_0x37e4e7,_0x3732('0x3f')))},function(){rimraf(path[_0x3732('0x37')](_0x486305,_0x37e4e7),function(){});_0x53ec5c(_0x3732('0x40'));});});}})[_0x3732('0x2d')](function(){if(!_0x1c3e73)return;rimraf(path['join'](_0x486305,_0x37e4e7),function(){});})[_0x3732('0x2d')](function(){logger[_0x3732('0x41')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x3732('0x42')));return analyticExtractedReport(_0x3732('0x43'),_0x1c3e73?util['format'](_0x3732('0x3d'),_0x37e4e7,_0x1c3e73?'zip':_0x3732('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x3732('0x41')](util['format'](_0x3732('0x44'),EXTRACTED_REPORT_ID,_0x3732('0x42')));return db[_0x3732('0x45')][_0x3732('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x120ff0){EXTRACTED_REPORT=_0x120ff0;return dbH[_0x3732('0x2f')][_0x3732('0x30')](util[_0x3732('0x1e')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3732('0x2f')][_0x3732('0x33')]['SELECT']});})[_0x3732('0x2d')](extractReport)[_0x3732('0x47')](function(_0x41f02e){logger[_0x3732('0x41')](util[_0x3732('0x1e')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3732('0x42')),util[_0x3732('0x48')](_0x41f02e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3732('0x49'));})['finally'](function(){process[_0x3732('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x887606=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x3732('0x4b'),'bolditalics':__dirname+_0x3732('0x4c')}});return _0x887606;}function getPDFDocDefinitionFromHTML(_0x5efeeb,_0x8dd4cd){var _0x94fbb2=util[_0x3732('0x1e')](_0x3732('0x4d'),_0x8dd4cd[_0x3732('0x4e')],_0x8dd4cd[_0x3732('0x4f')]);var _0x244863=moment()[_0x3732('0x1e')](_0x3732('0x50'))[_0x3732('0x12')]();var _0x34c930=htmlToPdfmake(_0x5efeeb,{'window':window,'tableAutoSize':!![]});return{'content':[_0x34c930],'defaultStyle':{'font':_0x3732('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','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':_0x3732('0x51')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x3f6a0d,_0x4a1442){return[{'text':util[_0x3732('0x1e')](_0x3732('0x52'),_0x94fbb2,_0x3f6a0d,_0x4a1442,_0x244863),'style':_0x3732('0x24')}];}};}function writePDFDocument(_0x1866ec,_0x3d2a3b){return new Promise(function(_0x216773,_0x3c932f){var _0x570101=_0x1866ec['pipe'](fs[_0x3732('0x53')](_0x3d2a3b));_0x570101['on'](_0x3732('0x54'),function(){_0x216773(_0x3732('0x54'));});_0x570101['on'](_0x3732('0x55'),function(_0x15ddc0){_0x3c932f(_0x15ddc0);});_0x1866ec[_0x3732('0x56')]();});}exports[_0x3732('0x57')]=function(_0x215e4f,_0x563ec5){var _0xf43e5a=getPDFPrinter();var _0x5da469=getPDFDocDefinitionFromHTML(_0x215e4f,_0x563ec5);var _0x5ebbe6=_0xf43e5a[_0x3732('0x3b')](_0x5da469);return writePDFDocument(_0x5ebbe6,_0x563ec5['path'])[_0x3732('0x47')](function(_0x57f1ef){throw _0x57f1ef;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 0a4c370..f60397e 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 _0x0d40=['num','Empty','length','range','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT'];(function(_0x458123,_0x6e1c89){var _0x2557d9=function(_0x358965){while(--_0x358965){_0x458123['push'](_0x458123['shift']());}};_0x2557d9(++_0x6e1c89);}(_0x0d40,0xac));var _0x00d4=function(_0x1ebc6c,_0x58a00b){_0x1ebc6c=_0x1ebc6c-0x0;var _0x3a826d=_0x0d40[_0x1ebc6c];return _0x3a826d;};'use strict';var util=require(_0x00d4('0x0'));var path=require(_0x00d4('0x1'));var _=require(_0x00d4('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x00d4('0x3'));var zipdir=require(_0x00d4('0x4'));var rimraf=require(_0x00d4('0x5'));var db=require(_0x00d4('0x6'))['db'];var dbH=require(_0x00d4('0x6'))[_0x00d4('0x7')];var logger=require(_0x00d4('0x8'))(_0x00d4('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x00d4('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xf7ecf8,_0xddeaa6){var _0xf08a92={'status':_0xf7ecf8};var _0x552a16={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xddeaa6){_0xf08a92[_0x00d4('0xb')]=_0xddeaa6;}return db['AnalyticExtractedReport'][_0x00d4('0xc')](_0xf08a92,_0x552a16);}function main(){var _0x27dd92=0x1388;var _0x5e8cb0;logger['info'](util[_0x00d4('0xd')](_0x00d4('0xe'),EXTRACTED_REPORT_ID,_0x00d4('0xf')));return db['Setting'][_0x00d4('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x00d4('0x11'),_0x00d4('0x12')]})[_0x00d4('0x13')](function(_0x31ee35){if(_0x31ee35){_0x5e8cb0=_0x31ee35;_0x27dd92=_0x5e8cb0['splitSizeXlsx']||0x1388;}})[_0x00d4('0x13')](function(){return dbH['sequelize']['query'](util['format'](_0x00d4('0x14'),QUERY),{'type':dbH[_0x00d4('0x15')][_0x00d4('0x16')][_0x00d4('0x17')]});})[_0x00d4('0x13')](function(_0x196d7d){if(!_0x196d7d[0x0][_0x00d4('0x18')]){return analyticExtractedReport(_0x00d4('0x19'));}var _0x1b9a83=[];var _0x4dbc80=0x0;if(_0x5e8cb0['split']){if(_0x196d7d&&_0x196d7d[_0x00d4('0x1a')]){var _0x54ef98=_[_0x00d4('0x1b')](_0x196d7d[0x0][_0x00d4('0x18')]/_0x27dd92);var _0x4eeb88=Number['isInteger'](_0x196d7d[0x0][_0x00d4('0x18')]/_0x27dd92)?_0x196d7d[0x0][_0x00d4('0x18')]%_0x27dd92:0x0;_0x54ef98['forEach'](function(_0x1c2783){if(_0x1c2783>0x0){_0x4dbc80+=_0x27dd92;}_0x1b9a83[_0x00d4('0x1c')](dbH[_0x00d4('0x15')][_0x00d4('0x1d')](util[_0x00d4('0xd')](_0x00d4('0x1e'),QUERY,_0x27dd92,_0x4dbc80),{'type':dbH[_0x00d4('0x15')][_0x00d4('0x16')]['SELECT']}));});if(_0x4eeb88>0x0){_0x4dbc80+=_0x27dd92;_0x1b9a83[_0x00d4('0x1c')](dbH['sequelize'][_0x00d4('0x1d')](util[_0x00d4('0xd')](_0x00d4('0x1e'),QUERY,_0x4eeb88,_0x4dbc80),{'type':dbH[_0x00d4('0x15')]['QueryTypes']['SELECT']}));}}}else{_0x1b9a83[_0x00d4('0x1c')](dbH[_0x00d4('0x15')][_0x00d4('0x1d')](QUERY,{'type':dbH[_0x00d4('0x15')]['QueryTypes']['SELECT']}));}var _0x5863dd=path[_0x00d4('0x1f')](PATH);var _0x3bd844=path[_0x00d4('0x20')](PATH,_0x00d4('0x21'));var _0x154aef=_0x5e8cb0[_0x00d4('0x11')]&&_0x1b9a83[_0x00d4('0x1a')]>0x1;var _0x26a168=[];if(!fs[_0x00d4('0x22')](path[_0x00d4('0x23')](_0x5863dd,_0x3bd844))&&_0x154aef){fs['mkdirSync'](path[_0x00d4('0x23')](_0x5863dd,_0x3bd844));}return BPromise['each'](_0x1b9a83,function(_0x2942ef){_0x26a168[_0x00d4('0x1c')](_0x2942ef);})[_0x00d4('0x13')](function(){for(var _0x29597f=0x0;_0x29597f<_0x26a168[_0x00d4('0x1a')];_0x29597f+=0x1){var _0x4195a5;var _0x42c2fd=_0x26a168[_0x29597f];if(_0x154aef){_0x4195a5=path[_0x00d4('0x23')](_0x5863dd,_0x3bd844,util[_0x00d4('0xd')](_0x00d4('0x24'),_0x3bd844,_0x29597f,'xlsx'));}else{_0x4195a5=path[_0x00d4('0x23')](_0x5863dd,util[_0x00d4('0xd')]('%s.%s',_0x3bd844,_0x00d4('0x25')));}fs[_0x00d4('0x26')](_0x4195a5,json2xls(_0x42c2fd),_0x00d4('0x27'));}})[_0x00d4('0x13')](function(){if(_0x154aef){return new Promise(function(_0x186e60){zipdir(path[_0x00d4('0x23')](_0x5863dd,_0x3bd844),{'saveTo':path[_0x00d4('0x23')](_0x5863dd,util['format'](_0x00d4('0x28'),_0x3bd844,_0x00d4('0x29')))},function(_0x4d53e4,_0x18866d){rimraf(path[_0x00d4('0x23')](_0x5863dd,_0x3bd844),function(){});_0x186e60(_0x00d4('0x2a'));});});}})[_0x00d4('0x13')](function(){logger[_0x00d4('0x2b')](util[_0x00d4('0xd')](_0x00d4('0x2c'),EXTRACTED_REPORT_ID,_0x00d4('0xf')));return analyticExtractedReport(_0x00d4('0x2d'),_0x154aef?util[_0x00d4('0xd')]('%s.%s',_0x3bd844,_0x154aef?_0x00d4('0x29'):_0x00d4('0x25')):null);});})[_0x00d4('0x2e')](function(_0x1c61fd){logger['info'](util[_0x00d4('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x00d4('0x2f')](_0x1c61fd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x00d4('0x30'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x17c1=['each','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','zip\x20finished','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','json2xls','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','update','info','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','Empty','split','length','range','num','isInteger','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','existsSync','join'];(function(_0x5574e5,_0x2287ce){var _0x47d890=function(_0x4a85c6){while(--_0x4a85c6){_0x5574e5['push'](_0x5574e5['shift']());}};_0x47d890(++_0x2287ce);}(_0x17c1,0x184));var _0x117c=function(_0x5b5cfd,_0x5aac93){_0x5b5cfd=_0x5b5cfd-0x0;var _0x259aa5=_0x17c1[_0x5b5cfd];return _0x259aa5;};'use strict';var util=require(_0x117c('0x0'));var path=require(_0x117c('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x117c('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x117c('0x3'));var rimraf=require(_0x117c('0x4'));var db=require(_0x117c('0x5'))['db'];var dbH=require(_0x117c('0x5'))[_0x117c('0x6')];var logger=require('../../config/logger')(_0x117c('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x117c('0x8')][0x2]);var QUERY=process[_0x117c('0x8')][0x3];var PATH=process[_0x117c('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x224486,_0x2d47c5){var _0x5d7531={'status':_0x224486};var _0x2d6524={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2d47c5){_0x5d7531[_0x117c('0x9')]=_0x2d47c5;}return db['AnalyticExtractedReport'][_0x117c('0xa')](_0x5d7531,_0x2d6524);}function main(){var _0x583bde=0x1388;var _0x3025cd;logger[_0x117c('0xb')](util[_0x117c('0xc')](_0x117c('0xd'),EXTRACTED_REPORT_ID,_0x117c('0xe')));return db[_0x117c('0xf')][_0x117c('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x117c('0x11')]})[_0x117c('0x12')](function(_0x126043){if(_0x126043){_0x3025cd=_0x126043;_0x583bde=_0x3025cd['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0x117c('0x13')]['query'](util[_0x117c('0xc')](_0x117c('0x14'),QUERY),{'type':dbH[_0x117c('0x13')][_0x117c('0x15')][_0x117c('0x16')]});})[_0x117c('0x12')](function(_0x3fd264){if(!_0x3fd264[0x0]['num']){return analyticExtractedReport(_0x117c('0x17'));}var _0x29e1b1=[];var _0x21e476=0x0;if(_0x3025cd[_0x117c('0x18')]){if(_0x3fd264&&_0x3fd264[_0x117c('0x19')]){var _0x43d62f=_[_0x117c('0x1a')](_0x3fd264[0x0][_0x117c('0x1b')]/_0x583bde);var _0x1d7aba=Number[_0x117c('0x1c')](_0x3fd264[0x0][_0x117c('0x1b')]/_0x583bde)?_0x3fd264[0x0][_0x117c('0x1b')]%_0x583bde:0x0;_0x43d62f['forEach'](function(_0x1854e5){if(_0x1854e5>0x0){_0x21e476+=_0x583bde;}_0x29e1b1[_0x117c('0x1d')](dbH[_0x117c('0x13')][_0x117c('0x1e')](util[_0x117c('0xc')](_0x117c('0x1f'),QUERY,_0x583bde,_0x21e476),{'type':dbH[_0x117c('0x13')][_0x117c('0x15')]['SELECT']}));});if(_0x1d7aba>0x0){_0x21e476+=_0x583bde;_0x29e1b1[_0x117c('0x1d')](dbH['sequelize'][_0x117c('0x1e')](util[_0x117c('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1d7aba,_0x21e476),{'type':dbH[_0x117c('0x13')][_0x117c('0x15')]['SELECT']}));}}}else{_0x29e1b1[_0x117c('0x1d')](dbH['sequelize'][_0x117c('0x1e')](QUERY,{'type':dbH[_0x117c('0x13')][_0x117c('0x15')][_0x117c('0x16')]}));}var _0x1d5207=path[_0x117c('0x20')](PATH);var _0x1bc580=path['basename'](PATH,'.xlsx');var _0x43e61e=_0x3025cd['split']&&_0x29e1b1[_0x117c('0x19')]>0x1;var _0x35b72d=[];if(!fs[_0x117c('0x21')](path[_0x117c('0x22')](_0x1d5207,_0x1bc580))&&_0x43e61e){fs['mkdirSync'](path['join'](_0x1d5207,_0x1bc580));}return BPromise[_0x117c('0x23')](_0x29e1b1,function(_0x5bea15){_0x35b72d['push'](_0x5bea15);})[_0x117c('0x12')](function(){for(var _0x7295eb=0x0;_0x7295eb<_0x35b72d[_0x117c('0x19')];_0x7295eb+=0x1){var _0x5d4c83;var _0x4fd8ef=_0x35b72d[_0x7295eb];if(_0x43e61e){_0x5d4c83=path[_0x117c('0x22')](_0x1d5207,_0x1bc580,util[_0x117c('0xc')](_0x117c('0x24'),_0x1bc580,_0x7295eb,_0x117c('0x25')));}else{_0x5d4c83=path[_0x117c('0x22')](_0x1d5207,util[_0x117c('0xc')](_0x117c('0x26'),_0x1bc580,'xlsx'));}fs[_0x117c('0x27')](_0x5d4c83,json2xls(_0x4fd8ef),'binary');}})[_0x117c('0x12')](function(){if(_0x43e61e){return new Promise(function(_0x72925){zipdir(path[_0x117c('0x22')](_0x1d5207,_0x1bc580),{'saveTo':path[_0x117c('0x22')](_0x1d5207,util[_0x117c('0xc')](_0x117c('0x26'),_0x1bc580,_0x117c('0x28')))},function(_0x57d2f5,_0x5a7fb5){rimraf(path[_0x117c('0x22')](_0x1d5207,_0x1bc580),function(){});_0x72925(_0x117c('0x29'));});});}})[_0x117c('0x12')](function(){logger[_0x117c('0xb')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x117c('0x2a'),_0x43e61e?util['format'](_0x117c('0x26'),_0x1bc580,_0x43e61e?_0x117c('0x28'):'xlsx'):null);});})['catch'](function(_0x131fc0){logger[_0x117c('0xb')](util[_0x117c('0xc')](_0x117c('0x2b'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x117c('0x2c')](_0x131fc0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x117c('0x2d')](function(){process[_0x117c('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 d1f4279..efc94e9 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 _0xd866=['createdAt','interval','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','transaction','destroy','sortBy','catch','error','rewrite','util','models','Interval','intervals','VoiceExtension','findAll','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab'];(function(_0x3d2438,_0x2e7922){var _0xd18de5=function(_0xe8a130){while(--_0xe8a130){_0x3d2438['push'](_0x3d2438['shift']());}};_0xd18de5(++_0x2e7922);}(_0xd866,0x188));var _0x6d86=function(_0x4acf6f,_0x5072e5){_0x4acf6f=_0x4acf6f-0x0;var _0x3c6d3a=_0xd866[_0x4acf6f];return _0x3c6d3a;};'use strict';var _=require('lodash');var util=require(_0x6d86('0x0'));function rewrite(_0x16449b,_0x11e859){var _0x384a71=this;return _0x16449b[_0x6d86('0x1')][_0x6d86('0x2')]['findAll']({'raw':!![]})['then'](function(_0x415be2){_0x384a71[_0x6d86('0x3')]=_0x415be2;return _0x16449b[_0x6d86('0x1')][_0x6d86('0x4')][_0x6d86('0x5')]({'where':{'IntervalId':_0x11e859[_0x6d86('0x6')]},'raw':!![]});})['then'](function(_0x44292b){return _0x16449b['models']['VoiceExtension'][_0x6d86('0x5')]({'where':{'exten':{'$in':_[_0x6d86('0x7')](_[_0x6d86('0x8')](_0x44292b,_0x6d86('0x9')))}},'order':[{'raw':_0x6d86('0xa')}],'raw':!![]});})[_0x6d86('0xb')](function(_0x12e1cc){var _0xddcc57=_[_0x6d86('0xc')](_0x12e1cc,{'priority':'1'});var _0x4f88f3=_[_0x6d86('0xc')](_0x12e1cc,{'isApp':0x1});var _0x720731=_[_0x6d86('0xd')](_0x4f88f3,_0x6d86('0x9'));var _0x2d9b0b=[_0x6d86('0xe'),_0x6d86('0xf')];var _0x4e084a=[];var _0x1e08b1=[];for(var _0x36a1d3 in _0x720731){if(_0x720731[_0x6d86('0x10')](_0x36a1d3)){_0x384a71[_0x6d86('0x11')]=0x2;_0x384a71[_0x6d86('0x12')]=[];_0x384a71[_0x6d86('0x13')]=_[_0x6d86('0x14')](_0xddcc57,{'exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')]});_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':_0x6d86('0x17'),'appdata':util[_0x6d86('0x18')](_0x6d86('0x19'),_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')]),'context':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1a')],'exten':_0x720731[_0x36a1d3][0x0]['exten'],'priority':_0x384a71['priority']++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});if(_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')]===_0x6d86('0x1c')){_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0]['type'],'app':'Set','appdata':_0x6d86('0x1d')+_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')],'context':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1a')],'exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')],'priority':_0x384a71[_0x6d86('0x11')]++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});}else if(_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')]===_0x6d86('0x1e')){if(_0x384a71['extension']){_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':_0x6d86('0x17'),'appdata':'CDR(destination)='+(_0x384a71[_0x6d86('0x13')][_0x6d86('0x1f')]?_0x6d86('0x20')+_0x384a71[_0x6d86('0x13')]['cutdigits']+'}':'${EXTEN}'),'context':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1a')],'exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')],'priority':_0x384a71['priority']++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});}_0x384a71[_0x6d86('0x12')]['push']({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':_0x6d86('0x17'),'appdata':_0x6d86('0x1d')+_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')],'context':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1a')],'exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')],'priority':_0x384a71['priority']++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});var _0x25b600=_0x384a71['priority']++;_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':_0x6d86('0x21'),'appdata':_0x6d86('0x22')+(_0x25b600+0x2)+'):Goto('+(_0x25b600+0x1)+')','context':_0x720731[_0x36a1d3][0x0]['context'],'exten':_0x720731[_0x36a1d3][0x0]['exten'],'priority':_0x25b600,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});if(_0x384a71[_0x6d86('0x13')]){_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':'Set','appdata':_0x384a71[_0x6d86('0x13')][_0x6d86('0x1f')]?_0x6d86('0x23')+_0x384a71['extension'][_0x6d86('0x1f')]+'}':_0x6d86('0x24'),'context':_0x720731[_0x36a1d3][0x0]['context'],'exten':_0x720731[_0x36a1d3][0x0]['exten'],'priority':_0x384a71['priority']++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});}_0x384a71['extensions'][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0]['type'],'app':'Set','appdata':_0x6d86('0x25')+_0x720731[_0x36a1d3][0x0]['VoiceExtensionId'],'context':_0x720731[_0x36a1d3][0x0]['context'],'exten':_0x720731[_0x36a1d3][0x0]['exten'],'priority':_0x384a71[_0x6d86('0x11')]++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});if(_0x384a71['extension']&&_0x384a71[_0x6d86('0x13')][_0x6d86('0x10')](_0x6d86('0x26'))&&_0x384a71['extension'][_0x6d86('0x26')]!==_0x6d86('0x27')){_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':'Set','appdata':_0x6d86('0x28'),'context':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1a')],'exten':_0x720731[_0x36a1d3][0x0]['exten'],'priority':_0x384a71[_0x6d86('0x11')]++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0]['type'],'app':_0x6d86('0x17'),'appdata':_0x6d86('0x29')+_0x384a71[_0x6d86('0x13')][_0x6d86('0x26')]||_0x6d86('0x2a'),'context':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1a')],'exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')],'priority':_0x384a71[_0x6d86('0x11')]++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});}}_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':'Set','appdata':_0x6d86('0x2b'),'context':_0x720731[_0x36a1d3][0x0]['context'],'exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')],'priority':_0x384a71[_0x6d86('0x11')]++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':'Set','appdata':_0x6d86('0x2c'),'context':_0x720731[_0x36a1d3][0x0]['context'],'exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')],'priority':_0x384a71[_0x6d86('0x11')]++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});_0x384a71[_0x6d86('0x12')]['push']({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':'Set','appdata':_0x6d86('0x2d'),'context':_0x720731[_0x36a1d3][0x0]['context'],'exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')],'priority':_0x384a71['priority']++,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});for(var _0x50eccf=0x0,_0x4f0fe8=0x0;_0x50eccf<_0x720731[_0x36a1d3]['length'];_0x50eccf+=0x1,_0x4f0fe8=0x0){var _0x43f00=_0x720731[_0x36a1d3][_0x50eccf];if(_0x43f00[_0x6d86('0x16')]){_0x43f00[_0x6d86('0x16')]=_0x43f00[_0x6d86('0x16')]['toLowerCase']();}var _0x5e0d2d=[];var _0x14aaff=[];delete _0x43f00['id'];delete _0x43f00[_0x6d86('0x2e')];delete _0x43f00['updatedAt'];var _0x2d3647=_0x43f00[_0x6d86('0x2f')]!=='*,*,*,*'?[_0x43f00[_0x6d86('0x2f')]]:_0x43f00[_0x6d86('0x6')]?_[_0x6d86('0x8')](_[_0x6d86('0xc')](_0x384a71[_0x6d86('0x3')],{'IntervalId':_0x43f00[_0x6d86('0x6')]}),_0x6d86('0x2f')):[];if(_0x43f00[_0x6d86('0x10')](_0x6d86('0x30'))){if(_0x43f00[_0x6d86('0x30')]&&_0x43f00[_0x6d86('0x30')]!=='--'){_0x5e0d2d['push']({'type':_0x43f00[_0x6d86('0x16')],'app':_0x6d86('0x17'),'appdata':_0x6d86('0x31')+_0x43f00['tag'],'context':_0x43f00[_0x6d86('0x1a')],'exten':_0x43f00[_0x6d86('0x9')],'priority':_0x2d3647[_0x6d86('0x32')]+_0x384a71['priority']+_0x4f0fe8++,'VoiceExtensionId':_0x43f00[_0x6d86('0x1b')]});}}if(_0x43f00[_0x6d86('0x16')]===_0x6d86('0x1e')&&_0x43f00[_0x6d86('0x10')]('callerID')){if(_0x43f00[_0x6d86('0x33')]){_0x5e0d2d[_0x6d86('0x15')]({'type':_0x43f00['type'],'app':_0x6d86('0x21'),'appdata':_0x6d86('0x34')+_0x43f00[_0x6d86('0x33')]+')','context':_0x43f00[_0x6d86('0x1a')],'exten':_0x43f00['exten'],'priority':_0x2d3647['length']+_0x384a71['priority']+_0x4f0fe8++,'VoiceExtensionId':_0x43f00['VoiceExtensionId']});}else{_0x5e0d2d[_0x6d86('0x15')]({'type':_0x43f00['type'],'app':_0x6d86('0x21'),'appdata':_0x6d86('0x35'),'context':_0x43f00[_0x6d86('0x1a')],'exten':_0x43f00[_0x6d86('0x9')],'priority':_0x2d3647['length']+_0x384a71[_0x6d86('0x11')]+_0x4f0fe8++,'VoiceExtensionId':_0x43f00[_0x6d86('0x1b')]});}}if(_0x43f00['hasOwnProperty'](_0x6d86('0x36'))){if(_0x2d9b0b[_0x6d86('0x37')](_0x43f00[_0x6d86('0x38')][_0x6d86('0x39')]())>=0x0&&_0x43f00[_0x6d86('0x3a')]!==_0x6d86('0x3b')){if(_0x43f00['answer']){_0x5e0d2d[_0x6d86('0x15')]({'type':_0x43f00['type'],'app':_0x6d86('0x21'),'appdata':_0x6d86('0x3c'),'context':_0x43f00[_0x6d86('0x1a')],'exten':_0x43f00['exten'],'priority':_0x2d3647['length']+_0x384a71[_0x6d86('0x11')]+_0x4f0fe8++,'VoiceExtensionId':_0x43f00[_0x6d86('0x1b')]});_0x5e0d2d[_0x6d86('0x15')]({'type':_0x43f00['type'],'app':_0x6d86('0x17'),'appdata':_0x6d86('0x3d'),'context':_0x43f00[_0x6d86('0x1a')],'exten':_0x43f00[_0x6d86('0x9')],'priority':_0x2d3647['length']+_0x384a71[_0x6d86('0x11')]+_0x4f0fe8++,'VoiceExtensionId':_0x43f00[_0x6d86('0x1b')]});}else{_0x5e0d2d[_0x6d86('0x15')]({'type':_0x43f00[_0x6d86('0x16')],'app':'ExecIf','appdata':_0x6d86('0x3e'),'context':_0x43f00[_0x6d86('0x1a')],'exten':_0x43f00['exten'],'priority':_0x2d3647['length']+_0x384a71[_0x6d86('0x11')]+_0x4f0fe8++,'VoiceExtensionId':_0x43f00[_0x6d86('0x1b')]});_0x5e0d2d[_0x6d86('0x15')]({'type':_0x43f00['type'],'app':_0x6d86('0x17'),'appdata':_0x6d86('0x3f'),'context':_0x43f00[_0x6d86('0x1a')],'exten':_0x43f00['exten'],'priority':_0x2d3647[_0x6d86('0x32')]+_0x384a71[_0x6d86('0x11')]+_0x4f0fe8++,'VoiceExtensionId':_0x43f00[_0x6d86('0x1b')]});}}}for(var _0x4dfc1d=0x0;_0x4dfc1d<_0x2d3647[_0x6d86('0x32')];_0x4dfc1d+=0x1){var _0x2ea319=_0x384a71[_0x6d86('0x11')]+_0x2d3647[_0x6d86('0x32')];var _0xb2778f=_0x4dfc1d===_0x2d3647[_0x6d86('0x32')]-0x1?_0x384a71[_0x6d86('0x11')]+_0x5e0d2d[_0x6d86('0x32')]+_0x14aaff[_0x6d86('0x32')]+0x2:_0x384a71[_0x6d86('0x11')]+_0x4dfc1d+0x1;_0x5e0d2d['splice'](_0x4dfc1d,0x0,{'type':_0x43f00['type'],'app':'GotoIfTime','appdata':_0x2d3647[_0x4dfc1d]+'?'+_0x43f00[_0x6d86('0x1a')]+_0x6d86('0x40')+_0x2ea319+':'+_0x43f00[_0x6d86('0x1a')]+_0x6d86('0x40')+_0xb2778f,'exten':_0x43f00['exten'],'context':_0x43f00['context'],'priority':_0x384a71['priority']+_0x4dfc1d,'VoiceExtensionId':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]});}_0x43f00['priority']=_0x5e0d2d[_0x6d86('0x32')]?_['last'](_0x5e0d2d)[_0x6d86('0x11')]+0x1:_0x384a71[_0x6d86('0x11')];_0x384a71[_0x6d86('0x11')]=(_0x14aaff[_0x6d86('0x32')]?_[_0x6d86('0x41')](_0x14aaff)[_0x6d86('0x11')]:_0x43f00['priority'])+0x1;_0x384a71[_0x6d86('0x12')]=_[_0x6d86('0x42')](_0x384a71[_0x6d86('0x12')],_0x5e0d2d,[_0x43f00],_0x14aaff);}_0x384a71[_0x6d86('0x12')][_0x6d86('0x15')]({'type':_0x720731[_0x36a1d3][0x0][_0x6d86('0x16')],'app':'Hangup','exten':_0x720731[_0x36a1d3][0x0][_0x6d86('0x9')],'context':_0x720731[_0x36a1d3][0x0][_0x6d86('0x1a')],'priority':_0x384a71[_0x6d86('0x11')],'VoiceExtensionId':_0x720731[_0x36a1d3][0x0]['VoiceExtensionId']});_0x4e084a[_0x6d86('0x15')](_0x720731[_0x36a1d3][0x0][_0x6d86('0x1b')]);_0x1e08b1=_[_0x6d86('0x42')](_0x1e08b1,_0x384a71[_0x6d86('0x12')]);}}return _0x16449b[_0x6d86('0x43')](function(_0x3328ce){return _0x16449b[_0x6d86('0x1')][_0x6d86('0x4')][_0x6d86('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x4e084a}},'transaction':_0x3328ce})[_0x6d86('0xb')](function(_0x14532f){return _0x16449b[_0x6d86('0x1')][_0x6d86('0x4')]['bulkCreate'](_[_0x6d86('0x45')](_0x1e08b1,_0x6d86('0x11')),{'transaction':_0x3328ce});});});})[_0x6d86('0x46')](function(_0x28b46f){console[_0x6d86('0x47')](_0x28b46f);});}exports[_0x6d86('0x48')]=rewrite; \ No newline at end of file +var _0x9738=['filter','groupBy','queue','hasOwnProperty','priority','extensions','extension','push','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','Set','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','interval','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','then'];(function(_0x4e9f29,_0x1bbcbf){var _0x8e1ab3=function(_0x4a4e6b){while(--_0x4a4e6b){_0x4e9f29['push'](_0x4e9f29['shift']());}};_0x8e1ab3(++_0x1bbcbf);}(_0x9738,0x1ec));var _0x8973=function(_0x646785,_0x178b0d){_0x646785=_0x646785-0x0;var _0x4cfa50=_0x9738[_0x646785];return _0x4cfa50;};'use strict';var _=require(_0x8973('0x0'));var util=require(_0x8973('0x1'));function rewrite(_0x2c2efc,_0x1a5f7e){var _0x5a56c8=this;return _0x2c2efc[_0x8973('0x2')][_0x8973('0x3')][_0x8973('0x4')]({'raw':!![]})['then'](function(_0x331a3e){_0x5a56c8['intervals']=_0x331a3e;return _0x2c2efc[_0x8973('0x2')][_0x8973('0x5')][_0x8973('0x4')]({'where':{'IntervalId':_0x1a5f7e[_0x8973('0x6')]},'raw':!![]});})['then'](function(_0x1575da){return _0x2c2efc[_0x8973('0x2')][_0x8973('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x8973('0x7')](_[_0x8973('0x8')](_0x1575da,_0x8973('0x9')))}},'order':[{'raw':_0x8973('0xa')}],'raw':!![]});})[_0x8973('0xb')](function(_0x246f5b){var _0x5575fa=_[_0x8973('0xc')](_0x246f5b,{'priority':'1'});var _0x864bcc=_[_0x8973('0xc')](_0x246f5b,{'isApp':0x1});var _0x569562=_[_0x8973('0xd')](_0x864bcc,_0x8973('0x9'));var _0x46ea41=[_0x8973('0xe'),'playback'];var _0x30c7cb=[];var _0x2c6fad=[];for(var _0x2c1c1b in _0x569562){if(_0x569562[_0x8973('0xf')](_0x2c1c1b)){_0x5a56c8[_0x8973('0x10')]=0x2;_0x5a56c8[_0x8973('0x11')]=[];_0x5a56c8[_0x8973('0x12')]=_['find'](_0x5575fa,{'exten':_0x569562[_0x2c1c1b][0x0][_0x8973('0x9')]});_0x5a56c8[_0x8973('0x11')][_0x8973('0x13')]({'type':_0x569562[_0x2c1c1b][0x0]['type'],'app':'Set','appdata':util[_0x8973('0x14')](_0x8973('0x15'),_0x569562[_0x2c1c1b][0x0][_0x8973('0x16')]),'context':_0x569562[_0x2c1c1b][0x0][_0x8973('0x17')],'exten':_0x569562[_0x2c1c1b][0x0]['exten'],'priority':_0x5a56c8[_0x8973('0x10')]++,'VoiceExtensionId':_0x569562[_0x2c1c1b][0x0][_0x8973('0x18')]});if(_0x569562[_0x2c1c1b][0x0][_0x8973('0x16')]===_0x8973('0x19')){_0x5a56c8[_0x8973('0x11')][_0x8973('0x13')]({'type':_0x569562[_0x2c1c1b][0x0][_0x8973('0x16')],'app':'Set','appdata':'CDR(routeid)='+_0x569562[_0x2c1c1b][0x0][_0x8973('0x18')],'context':_0x569562[_0x2c1c1b][0x0][_0x8973('0x17')],'exten':_0x569562[_0x2c1c1b][0x0][_0x8973('0x9')],'priority':_0x5a56c8[_0x8973('0x10')]++,'VoiceExtensionId':_0x569562[_0x2c1c1b][0x0]['VoiceExtensionId']});}else if(_0x569562[_0x2c1c1b][0x0][_0x8973('0x16')]==='outbound'){if(_0x5a56c8[_0x8973('0x12')]){_0x5a56c8[_0x8973('0x11')][_0x8973('0x13')]({'type':_0x569562[_0x2c1c1b][0x0][_0x8973('0x16')],'app':_0x8973('0x1a'),'appdata':_0x8973('0x1b')+(_0x5a56c8['extension']['cutdigits']?_0x8973('0x1c')+_0x5a56c8['extension'][_0x8973('0x1d')]+'}':_0x8973('0x1e')),'context':_0x569562[_0x2c1c1b][0x0]['context'],'exten':_0x569562[_0x2c1c1b][0x0][_0x8973('0x9')],'priority':_0x5a56c8['priority']++,'VoiceExtensionId':_0x569562[_0x2c1c1b][0x0]['VoiceExtensionId']});}_0x5a56c8[_0x8973('0x11')][_0x8973('0x13')]({'type':_0x569562[_0x2c1c1b][0x0][_0x8973('0x16')],'app':_0x8973('0x1a'),'appdata':_0x8973('0x1f')+_0x569562[_0x2c1c1b][0x0][_0x8973('0x18')],'context':_0x569562[_0x2c1c1b][0x0][_0x8973('0x17')],'exten':_0x569562[_0x2c1c1b][0x0][_0x8973('0x9')],'priority':_0x5a56c8['priority']++,'VoiceExtensionId':_0x569562[_0x2c1c1b][0x0][_0x8973('0x18')]});var _0x1cc5a2=_0x5a56c8[_0x8973('0x10')]++;_0x5a56c8[_0x8973('0x11')]['push']({'type':_0x569562[_0x2c1c1b][0x0][_0x8973('0x16')],'app':_0x8973('0x20'),'appdata':_0x8973('0x21')+(_0x1cc5a2+0x2)+_0x8973('0x22')+(_0x1cc5a2+0x1)+')','context':_0x569562[_0x2c1c1b][0x0][_0x8973('0x17')],'exten':_0x569562[_0x2c1c1b][0x0][_0x8973('0x9')],'priority':_0x1cc5a2,'VoiceExtensionId':_0x569562[_0x2c1c1b][0x0][_0x8973('0x18')]});if(_0x5a56c8[_0x8973('0x12')]){_0x5a56c8[_0x8973('0x11')][_0x8973('0x13')]({'type':_0x569562[_0x2c1c1b][0x0][_0x8973('0x16')],'app':'Set','appdata':_0x5a56c8[_0x8973('0x12')][_0x8973('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x5a56c8[_0x8973('0x12')][_0x8973('0x1d')]+'}':_0x8973('0x23'),'context':_0x569562[_0x2c1c1b][0x0][_0x8973('0x17')],'exten':_0x569562[_0x2c1c1b][0x0][_0x8973('0x9')],'priority':_0x5a56c8[_0x8973('0x10')]++,'VoiceExtensionId':_0x569562[_0x2c1c1b][0x0][_0x8973('0x18')]});}_0x5a56c8[_0x8973('0x11')]['push']({'type':_0x569562[_0x2c1c1b][0x0][_0x8973('0x16')],'app':_0x8973('0x1a'),'appdata':_0x8973('0x24')+_0x569562[_0x2c1c1b][0x0][_0x8973('0x18')],'context':_0x569562[_0x2c1c1b][0x0][_0x8973('0x17')],'exten':_0x569562[_0x2c1c1b][0x0][_0x8973('0x9')],'priority':_0x5a56c8[_0x8973('0x10')]++,'VoiceExtensionId':_0x569562[_0x2c1c1b][0x0][_0x8973('0x18')]});if(_0x5a56c8[_0x8973('0x12')]&&_0x5a56c8[_0x8973('0x12')]['hasOwnProperty'](_0x8973('0x25'))&&_0x5a56c8[_0x8973('0x12')][_0x8973('0x25')]!=='none'){_0x5a56c8[_0x8973('0x11')][_0x8973('0x13')]({'type':_0x569562[_0x2c1c1b][0x0]['type'],'app':_0x8973('0x1a'),'appdata':_0x8973('0x26'),'context':_0x569562[_0x2c1c1b][0x0][_0x8973('0x17')],'exten':_0x569562[_0x2c1c1b][0x0][_0x8973('0x9')],'priority':_0x5a56c8[_0x8973('0x10')]++,'VoiceExtensionId':_0x569562[_0x2c1c1b][0x0][_0x8973('0x18')]});_0x5a56c8[_0x8973('0x11')][_0x8973('0x13')]({'type':_0x569562[_0x2c1c1b][0x0][_0x8973('0x16')],'app':'Set','appdata':_0x8973('0x27')+_0x5a56c8['extension'][_0x8973('0x25')]||_0x8973('0x28'),'context':_0x569562[_0x2c1c1b][0x0][_0x8973('0x17')],'exten':_0x569562[_0x2c1c1b][0x0]['exten'],'priority':_0x5a56c8['priority']++,'VoiceExtensionId':_0x569562[_0x2c1c1b][0x0]['VoiceExtensionId']});}}_0x5a56c8[_0x8973('0x11')]['push']({'type':_0x569562[_0x2c1c1b][0x0][_0x8973('0x16')],'app':'Set','appdata':_0x8973('0x29'),'context':_0x569562[_0x2c1c1b][0x0][_0x8973('0x17')],'exten':_0x569562[_0x2c1c1b][0x0][_0x8973('0x9')],'priority':_0x5a56c8[_0x8973('0x10')]++,'VoiceExtensionId':_0x569562[_0x2c1c1b][0x0][_0x8973('0x18')]});_0x5a56c8[_0x8973('0x11')]['push']({'type':_0x569562[_0x2c1c1b][0x0][_0x8973('0x16')],'app':_0x8973('0x1a'),'appdata':_0x8973('0x2a'),'context':_0x569562[_0x2c1c1b][0x0][_0x8973('0x17')],'exten':_0x569562[_0x2c1c1b][0x0][_0x8973('0x9')],'priority':_0x5a56c8[_0x8973('0x10')]++,'VoiceExtensionId':_0x569562[_0x2c1c1b][0x0][_0x8973('0x18')]});_0x5a56c8['extensions']['push']({'type':_0x569562[_0x2c1c1b][0x0][_0x8973('0x16')],'app':_0x8973('0x1a'),'appdata':_0x8973('0x2b'),'context':_0x569562[_0x2c1c1b][0x0][_0x8973('0x17')],'exten':_0x569562[_0x2c1c1b][0x0][_0x8973('0x9')],'priority':_0x5a56c8[_0x8973('0x10')]++,'VoiceExtensionId':_0x569562[_0x2c1c1b][0x0][_0x8973('0x18')]});for(var _0x2c8384=0x0,_0x3b76fd=0x0;_0x2c8384<_0x569562[_0x2c1c1b][_0x8973('0x2c')];_0x2c8384+=0x1,_0x3b76fd=0x0){var _0x59e29f=_0x569562[_0x2c1c1b][_0x2c8384];if(_0x59e29f[_0x8973('0x16')]){_0x59e29f[_0x8973('0x16')]=_0x59e29f['type'][_0x8973('0x2d')]();}var _0x24e165=[];var _0x3403e6=[];delete _0x59e29f['id'];delete _0x59e29f['createdAt'];delete _0x59e29f['updatedAt'];var _0x1f5829=_0x59e29f[_0x8973('0x2e')]!=='*,*,*,*'?[_0x59e29f[_0x8973('0x2e')]]:_0x59e29f[_0x8973('0x6')]?_[_0x8973('0x8')](_['filter'](_0x5a56c8[_0x8973('0x2f')],{'IntervalId':_0x59e29f['IntervalId']}),_0x8973('0x2e')):[];if(_0x59e29f[_0x8973('0xf')](_0x8973('0x30'))){if(_0x59e29f['tag']&&_0x59e29f[_0x8973('0x30')]!=='--'){_0x24e165[_0x8973('0x13')]({'type':_0x59e29f[_0x8973('0x16')],'app':_0x8973('0x1a'),'appdata':_0x8973('0x31')+_0x59e29f[_0x8973('0x30')],'context':_0x59e29f[_0x8973('0x17')],'exten':_0x59e29f[_0x8973('0x9')],'priority':_0x1f5829['length']+_0x5a56c8['priority']+_0x3b76fd++,'VoiceExtensionId':_0x59e29f[_0x8973('0x18')]});}}if(_0x59e29f[_0x8973('0x16')]==='outbound'&&_0x59e29f[_0x8973('0xf')](_0x8973('0x32'))){if(_0x59e29f[_0x8973('0x32')]){_0x24e165[_0x8973('0x13')]({'type':_0x59e29f[_0x8973('0x16')],'app':'ExecIf','appdata':_0x8973('0x33')+_0x59e29f['callerID']+')','context':_0x59e29f['context'],'exten':_0x59e29f[_0x8973('0x9')],'priority':_0x1f5829['length']+_0x5a56c8['priority']+_0x3b76fd++,'VoiceExtensionId':_0x59e29f[_0x8973('0x18')]});}else{_0x24e165[_0x8973('0x13')]({'type':_0x59e29f[_0x8973('0x16')],'app':_0x8973('0x20'),'appdata':_0x8973('0x34'),'context':_0x59e29f[_0x8973('0x17')],'exten':_0x59e29f[_0x8973('0x9')],'priority':_0x1f5829[_0x8973('0x2c')]+_0x5a56c8[_0x8973('0x10')]+_0x3b76fd++,'VoiceExtensionId':_0x59e29f['VoiceExtensionId']});}}if(_0x59e29f[_0x8973('0xf')](_0x8973('0x35'))){if(_0x46ea41[_0x8973('0x36')](_0x59e29f[_0x8973('0x37')][_0x8973('0x2d')]())>=0x0&&_0x59e29f[_0x8973('0x38')]!==_0x8973('0x39')){if(_0x59e29f[_0x8973('0x35')]){_0x24e165[_0x8973('0x13')]({'type':_0x59e29f[_0x8973('0x16')],'app':_0x8973('0x20'),'appdata':_0x8973('0x3a'),'context':_0x59e29f[_0x8973('0x17')],'exten':_0x59e29f['exten'],'priority':_0x1f5829[_0x8973('0x2c')]+_0x5a56c8['priority']+_0x3b76fd++,'VoiceExtensionId':_0x59e29f[_0x8973('0x18')]});_0x24e165[_0x8973('0x13')]({'type':_0x59e29f[_0x8973('0x16')],'app':_0x8973('0x1a'),'appdata':_0x8973('0x3b'),'context':_0x59e29f['context'],'exten':_0x59e29f['exten'],'priority':_0x1f5829['length']+_0x5a56c8[_0x8973('0x10')]+_0x3b76fd++,'VoiceExtensionId':_0x59e29f[_0x8973('0x18')]});}else{_0x24e165[_0x8973('0x13')]({'type':_0x59e29f[_0x8973('0x16')],'app':_0x8973('0x20'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x59e29f['context'],'exten':_0x59e29f['exten'],'priority':_0x1f5829[_0x8973('0x2c')]+_0x5a56c8['priority']+_0x3b76fd++,'VoiceExtensionId':_0x59e29f[_0x8973('0x18')]});_0x24e165['push']({'type':_0x59e29f[_0x8973('0x16')],'app':_0x8973('0x1a'),'appdata':_0x8973('0x3c'),'context':_0x59e29f[_0x8973('0x17')],'exten':_0x59e29f[_0x8973('0x9')],'priority':_0x1f5829['length']+_0x5a56c8['priority']+_0x3b76fd++,'VoiceExtensionId':_0x59e29f['VoiceExtensionId']});}}}for(var _0x2068e8=0x0;_0x2068e8<_0x1f5829[_0x8973('0x2c')];_0x2068e8+=0x1){var _0x5b0b19=_0x5a56c8[_0x8973('0x10')]+_0x1f5829[_0x8973('0x2c')];var _0x50d0b7=_0x2068e8===_0x1f5829[_0x8973('0x2c')]-0x1?_0x5a56c8[_0x8973('0x10')]+_0x24e165['length']+_0x3403e6[_0x8973('0x2c')]+0x2:_0x5a56c8[_0x8973('0x10')]+_0x2068e8+0x1;_0x24e165['splice'](_0x2068e8,0x0,{'type':_0x59e29f['type'],'app':_0x8973('0x3d'),'appdata':_0x1f5829[_0x2068e8]+'?'+_0x59e29f[_0x8973('0x17')]+',${EXTEN},'+_0x5b0b19+':'+_0x59e29f[_0x8973('0x17')]+_0x8973('0x3e')+_0x50d0b7,'exten':_0x59e29f[_0x8973('0x9')],'context':_0x59e29f[_0x8973('0x17')],'priority':_0x5a56c8[_0x8973('0x10')]+_0x2068e8,'VoiceExtensionId':_0x569562[_0x2c1c1b][0x0][_0x8973('0x18')]});}_0x59e29f[_0x8973('0x10')]=_0x24e165['length']?_['last'](_0x24e165)[_0x8973('0x10')]+0x1:_0x5a56c8[_0x8973('0x10')];_0x5a56c8[_0x8973('0x10')]=(_0x3403e6[_0x8973('0x2c')]?_['last'](_0x3403e6)[_0x8973('0x10')]:_0x59e29f[_0x8973('0x10')])+0x1;_0x5a56c8[_0x8973('0x11')]=_[_0x8973('0x3f')](_0x5a56c8[_0x8973('0x11')],_0x24e165,[_0x59e29f],_0x3403e6);}_0x5a56c8[_0x8973('0x11')][_0x8973('0x13')]({'type':_0x569562[_0x2c1c1b][0x0]['type'],'app':_0x8973('0x40'),'exten':_0x569562[_0x2c1c1b][0x0][_0x8973('0x9')],'context':_0x569562[_0x2c1c1b][0x0]['context'],'priority':_0x5a56c8['priority'],'VoiceExtensionId':_0x569562[_0x2c1c1b][0x0]['VoiceExtensionId']});_0x30c7cb[_0x8973('0x13')](_0x569562[_0x2c1c1b][0x0]['VoiceExtensionId']);_0x2c6fad=_[_0x8973('0x3f')](_0x2c6fad,_0x5a56c8['extensions']);}}return _0x2c2efc[_0x8973('0x41')](function(_0x559701){return _0x2c2efc[_0x8973('0x2')]['VoiceExtension'][_0x8973('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x30c7cb}},'transaction':_0x559701})[_0x8973('0xb')](function(_0x3ea201){return _0x2c2efc[_0x8973('0x2')][_0x8973('0x5')][_0x8973('0x43')](_[_0x8973('0x44')](_0x2c6fad,_0x8973('0x10')),{'transaction':_0x559701});});});})[_0x8973('0x45')](function(_0x2cc283){console[_0x8973('0x46')](_0x2cc283);});}exports[_0x8973('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 00279af..29a3b4f 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 _0x12a3=['into','cm_hopper','fromQuery','phone','ContactId','updatedAt','select','field','NOW()','toString','createdAt','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','scheduledAt','from','str','calleridnum','id\x20IN\x20?','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','get','always','push','query','VoiceQueueId','sequelize','catch','all','VoiceQueue','Campaign','Lists','CampaignId','CmList','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','parse','pause','info','bluebird','util','squel','papaparse','ioredis','../../../config/environment','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','then','stringify','cmContact','checkHopper','inspect','insert'];(function(_0x3760f1,_0x498373){var _0x14d886=function(_0x104123){while(--_0x104123){_0x3760f1['push'](_0x3760f1['shift']());}};_0x14d886(++_0x498373);}(_0x12a3,0x1d5));var _0x312a=function(_0x5454ad,_0x47ed68){_0x5454ad=_0x5454ad-0x0;var _0x398aff=_0x12a3[_0x5454ad];return _0x398aff;};'use strict';var BPromise=require(_0x312a('0x0'));var util=require(_0x312a('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x312a('0x2'));var Papa=require(_0x312a('0x3'));var Redis=require(_0x312a('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x312a('0x5'));var logger=require('../../../config/logger')(_0x312a('0x6'));config[_0x312a('0x7')]=_[_0x312a('0x8')](config[_0x312a('0x7')],{'host':_0x312a('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x312a('0x7')]));require(_0x312a('0xa'))['register'](socket);try{if(!process[_0x312a('0xb')][0x2]||process[_0x312a('0xb')][0x2]===_0x312a('0xc')||process[_0x312a('0xb')][0x2]===_0x312a('0xd')){throw new Error(_0x312a('0xe'));}var FILEPATH=process[_0x312a('0xb')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]==='undefined'||process['argv'][0x3]===_0x312a('0xd')||!process[_0x312a('0xb')][0x4]||process[_0x312a('0xb')][0x4]===_0x312a('0xc')||process[_0x312a('0xb')][0x4]===_0x312a('0xd')){throw new Error(_0x312a('0xf'));}var FIELDS=_[_0x312a('0x10')](process[_0x312a('0xb')][0x3][_0x312a('0x11')](','),process[_0x312a('0xb')][0x4]['split'](','));if(!process[_0x312a('0xb')][0x5]||process['argv'][0x5]===_0x312a('0xc')||process[_0x312a('0xb')][0x5]===_0x312a('0xd')){throw new Error(_0x312a('0x12'));}var LISTID=process[_0x312a('0xb')][0x5];var COMPANYID=process[_0x312a('0xb')][0x6]&&process[_0x312a('0xb')][0x6]!=='undefined'&&process[_0x312a('0xb')][0x6]!==_0x312a('0xd')?process[_0x312a('0xb')][0x6]:null;var DUPLICATES=process[_0x312a('0xb')][0x7]&&process['argv'][0x7]!=='undefined'&&process['argv'][0x7]!==_0x312a('0xd')?process[_0x312a('0xb')][0x7]:null;if(!process[_0x312a('0xb')][0x8]||process[_0x312a('0xb')][0x8]===_0x312a('0xc')||process['argv'][0x8]===_0x312a('0xd')){throw new Error(_0x312a('0x13'));}var SOCKET_TIMESTAMP=process[_0x312a('0xb')][0x8];}catch(_0x55a730){logger[_0x312a('0x14')](_0x55a730);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(_0x5c0b94,_0x1c3ff3,_0x128673,_0x5827c4){var _0x10fa84={'message':_0x1c3ff3};_0x10fa84[_0x5c0b94]=!![];if(_0x128673){_0x10fa84[_0x312a('0x15')]=_0x128673;}if(_0x5827c4){_0x10fa84[_0x312a('0x16')]=_0x5827c4;}return _0x10fa84;}function isEmail(_0x4e18e2){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))*$/[_0x312a('0x17')](_0x4e18e2);}function checkRow(_0x15ccda,_0x331d33,_0x1b6b38){return new BPromise(function(_0x2bdf09,_0x21882d){if(_[_0x312a('0x18')](_0x15ccda)){return _0x21882d(handleCheckRowError(_0x312a('0x14'),_0x312a('0x19'),null,_0x1b6b38));}if(_0x15ccda[_0x312a('0x1a')]&&_0x15ccda[_0x312a('0x1a')][_0x312a('0x1b')]){var _0x503124=_[_0x312a('0x1c')](_0x15ccda[_0x312a('0x1a')],_0x312a('0x1d'))[_0x312a('0x1e')](';');return _0x21882d(handleCheckRowError(_0x312a('0x14'),_0x503124,null,_0x1b6b38));}var _0x286a7e={};for(var _0x2a106a in FIELDS){if(FIELDS['hasOwnProperty'](_0x2a106a)&&FIELDS[_0x2a106a]){_0x286a7e[_0x2a106a]=_0x15ccda['data'][0x0][FIELDS[_0x2a106a]]||_0x15ccda['data'][0x0]['\ufeff'+FIELDS[_0x2a106a]];}}if(!_0x286a7e[_0x312a('0x1f')]){return _0x21882d(handleCheckRowError('error',_0x312a('0x20'),null,_0x1b6b38));}if(!_0x286a7e['phone']){return _0x21882d(handleCheckRowError('error',_0x312a('0x21'),null,_0x1b6b38));}if(_0x286a7e[_0x312a('0x22')]){var _0x37de07=moment(_0x286a7e[_0x312a('0x22')],_0x312a('0x23'));if(!_0x37de07['isValid']()){return _0x21882d(handleCheckRowError(_0x312a('0x14'),_0x312a('0x24'),null,_0x1b6b38));}}if(_0x286a7e[_0x312a('0x25')]){if(!isEmail(_0x286a7e[_0x312a('0x25')])){return _0x21882d(handleCheckRowError(_0x312a('0x14'),'email\x20format\x20is\x20not\x20valid!',null,_0x1b6b38));}}_0x286a7e[_0x312a('0x26')]=LISTID;_0x286a7e[_0x312a('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x312a('0x1b')]&&_0x331d33){var _0x4ca72f={};for(var _0x54cfc7=0x0,_0x2bdcc7=DUPLICATES[_0x312a('0x1b')];_0x54cfc7<_0x2bdcc7;_0x54cfc7+=0x1){_0x4ca72f[DUPLICATES[_0x54cfc7]]=_0x286a7e[DUPLICATES[_0x54cfc7]];}var _0x4d0190=_[_0x312a('0x28')](_0x331d33,_0x4ca72f);if(_0x4d0190){return _0x21882d(handleCheckRowError(_0x312a('0x29'),_0x312a('0x2a'),_0x4d0190,_0x1b6b38));}}return db[_0x312a('0x2b')]['create'](_0x286a7e,{'raw':!![],'hooks':![],'fields':_[_0x312a('0x2c')](_0x286a7e)})[_0x312a('0x2d')](function(_0x15e681){if(DUPLICATES&&DUPLICATES[_0x312a('0x1b')]&&_0x331d33){_0x331d33['push'](_['pick'](_0x286a7e,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x15e681['id'];return _0x2bdf09();})['catch'](function(_0x468d70){return _0x21882d(handleCheckRowError(_0x312a('0x14'),'Error\x20while\x20creating\x20contact:\x20'+(_0x468d70[_0x312a('0x1d')]||JSON[_0x312a('0x2e')](_0x468d70)),null,_0x1b6b38));});});}function checkHopper(){function _0x43eb52(){return function(_0x2fdc40){logger[_0x312a('0x14')](_0x312a('0x2f'),_0x312a('0x30'),util[_0x312a('0x31')](_0x2fdc40,{'showHidden':![],'depth':null}));};}var _0x5ed282=function(_0x1086f2,_0x581824){var _0x5a8585=squel[_0x312a('0x32')]()[_0x312a('0x33')](_0x312a('0x34'))[_0x312a('0x35')]([_0x312a('0x36'),'scheduledAt',_0x312a('0x37'),_0x312a('0x26'),_0x581824,'createdAt',_0x312a('0x38')],squel[_0x312a('0x39')]()[_0x312a('0x3a')](_0x312a('0x36'),_0x312a('0x36'))[_0x312a('0x3a')](_0x312a('0x3b'),'scheduledAt')[_0x312a('0x3a')]('id',_0x312a('0x37'))[_0x312a('0x3a')](LISTID['toString'](),'ListId')[_0x312a('0x3a')](_0x1086f2['id'][_0x312a('0x3c')](),_0x581824)[_0x312a('0x3a')](_0x312a('0x3b'),_0x312a('0x3d'))[_0x312a('0x3a')](_0x312a('0x3b'),_0x312a('0x38'))['from'](_0x312a('0x3e'))[_0x312a('0x3f')](_0x312a('0x40'))['where'](_0x312a('0x41'),LISTID[_0x312a('0x3c')]())['where'](_0x312a('0x42'))[_0x312a('0x3f')](_0x312a('0x43'),squel[_0x312a('0x39')]()['field'](_0x312a('0x36'))['from'](_0x312a('0x34'))[_0x312a('0x3f')](_0x581824+_0x312a('0x44'),_0x1086f2['id'][_0x312a('0x3c')]())))[_0x312a('0x3c')]();return _0x5a8585;};var _0x45a85a=function(_0x201b87,_0x59248a){var _0x128b76=squel[_0x312a('0x32')]()[_0x312a('0x33')](_0x312a('0x34'))['fromQuery']([_0x312a('0x36'),_0x312a('0x45'),_0x312a('0x37'),'ListId',_0x59248a,_0x312a('0x3d'),_0x312a('0x38')],squel[_0x312a('0x39')]()[_0x312a('0x3a')](_0x312a('0x36'),_0x312a('0x36'))['field'](_0x312a('0x3b'),_0x312a('0x45'))[_0x312a('0x3a')]('id','ContactId')[_0x312a('0x3a')](LISTID['toString'](),_0x312a('0x26'))[_0x312a('0x3a')](_0x201b87['id']['toString'](),_0x59248a)['field'](_0x312a('0x3b'),_0x312a('0x3d'))[_0x312a('0x3a')](_0x312a('0x3b'),'updatedAt')[_0x312a('0x46')](_0x312a('0x3e'))['where'](_0x312a('0x40'))[_0x312a('0x3f')](_0x312a('0x41'),LISTID['toString']())[_0x312a('0x3f')]('id\x20IN\x20?',squel[_0x312a('0x47')](hopperContacts))[_0x312a('0x3f')](_0x312a('0x42'))[_0x312a('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x312a('0x48'))['from']('cm_hopper_final')[_0x312a('0x3f')](_0x59248a+'\x20=\x20?',_0x201b87['id'][_0x312a('0x3c')]()))[_0x312a('0x3f')](_0x312a('0x43'),squel[_0x312a('0x39')]()[_0x312a('0x3a')](_0x312a('0x36'))[_0x312a('0x46')](_0x312a('0x34'))['where'](_0x59248a+_0x312a('0x44'),_0x201b87['id'][_0x312a('0x3c')]())))['toString']();return _0x128b76;};function _0x23dd81(_0x595fa0,_0x78f317){var _0x52471d=squel[_0x312a('0x32')]()[_0x312a('0x33')](_0x312a('0x34'))['fromQuery'](['phone',_0x312a('0x45'),'ContactId','ListId',_0x78f317,_0x312a('0x3d'),'updatedAt'],squel[_0x312a('0x39')]()['field'](_0x312a('0x36'),_0x312a('0x36'))[_0x312a('0x3a')]('NOW()',_0x312a('0x45'))[_0x312a('0x3a')]('id',_0x312a('0x37'))[_0x312a('0x3a')](LISTID[_0x312a('0x3c')](),_0x312a('0x26'))[_0x312a('0x3a')](_0x595fa0['id'][_0x312a('0x3c')](),_0x78f317)['field']('NOW()',_0x312a('0x3d'))[_0x312a('0x3a')]('NOW()',_0x312a('0x38'))[_0x312a('0x46')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x312a('0x3f')]('ListId\x20=\x20?',LISTID[_0x312a('0x3c')]())[_0x312a('0x3f')](_0x312a('0x49'),squel[_0x312a('0x47')](hopperContacts))[_0x312a('0x3f')](_0x312a('0x42')))[_0x312a('0x3c')]();return _0x52471d;}function _0x461f51(_0x20f328,_0x1967e7){var _0x2c9b96=squel[_0x312a('0x32')]()['into'](_0x312a('0x4a'))[_0x312a('0x35')]([_0x312a('0x36'),'ContactId',_0x312a('0x26'),_0x1967e7,_0x312a('0x3d'),'updatedAt'],squel[_0x312a('0x39')]()[_0x312a('0x3a')](_0x312a('0x36'),_0x312a('0x36'))[_0x312a('0x3a')]('id','ContactId')[_0x312a('0x3a')](LISTID['toString'](),_0x312a('0x26'))[_0x312a('0x3a')](_0x20f328['id']['toString'](),_0x1967e7)[_0x312a('0x3a')](_0x312a('0x3b'),_0x312a('0x3d'))['field'](_0x312a('0x3b'),_0x312a('0x38'))['from'](_0x312a('0x3e'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x312a('0x41'),LISTID[_0x312a('0x3c')]())['where'](_0x312a('0x49'),squel[_0x312a('0x47')](hopperContacts))[_0x312a('0x3f')](_0x312a('0x42')))[_0x312a('0x3c')]();return _0x2c9b96;}return db['VoiceQueue'][_0x312a('0x4b')]({'where':{'type':_0x312a('0x4c')},'attributes':['id',_0x312a('0x4d')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x312a('0x2d')](function(_0x2260ae){var _0x3388a6=[];if(_0x2260ae){var _0x2d0e8e;for(var _0x9b3762=0x0,_0x831d90;_0x9b3762<_0x2260ae[_0x312a('0x1b')];_0x9b3762+=0x1){_0x831d90=_0x2260ae[_0x9b3762][_0x312a('0x4e')]({'plain':!![]});switch(_0x831d90[_0x312a('0x4d')]){case _0x312a('0x4f'):_0x3388a6[_0x312a('0x50')](db['sequelize'][_0x312a('0x51')](_0x45a85a(_0x831d90,_0x312a('0x52')))[_0x312a('0x2d')](function(){})['catch'](_0x43eb52()));break;case'onlyIfOpen':_0x3388a6[_0x312a('0x50')](db[_0x312a('0x53')][_0x312a('0x51')](_0x5ed282(_0x831d90,_0x312a('0x52')))[_0x312a('0x2d')](function(){})[_0x312a('0x54')](_0x43eb52()));break;default:_0x3388a6[_0x312a('0x50')](db['sequelize'][_0x312a('0x51')](_0x23dd81(_0x831d90,_0x312a('0x52')))[_0x312a('0x2d')](function(){})[_0x312a('0x54')](_0x43eb52()));}}}return _0x3388a6;})[_0x312a('0x55')]()[_0x312a('0x2d')](function(){return db[_0x312a('0x56')][_0x312a('0x4b')]({'where':{'type':_0x312a('0x4c')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x563261){var _0x15458e=[];if(_0x563261){var _0x3ecf41;for(var _0x13e693=0x0,_0x28cd6e;_0x13e693<_0x563261[_0x312a('0x1b')];_0x13e693+=0x1){_0x28cd6e=_0x563261[_0x13e693][_0x312a('0x4e')]({'plain':!![]});_0x15458e[_0x312a('0x50')](db['sequelize'][_0x312a('0x51')](_0x461f51(_0x28cd6e,'VoiceQueueId'))[_0x312a('0x2d')](function(){})['catch'](_0x43eb52()));}}return _0x15458e;})[_0x312a('0x55')]();})[_0x312a('0x2d')](function(){return db[_0x312a('0x57')][_0x312a('0x4b')]({'attributes':['id',_0x312a('0x4d')],'include':[{'model':db['CmList'],'as':_0x312a('0x58'),'where':{'id':LISTID}}]})[_0x312a('0x2d')](function(_0x3c7d45){var _0x452c4c=[];if(_0x3c7d45){for(var _0x187764=0x0,_0x3aecda;_0x187764<_0x3c7d45[_0x312a('0x1b')];_0x187764+=0x1){_0x3aecda=_0x3c7d45[_0x187764][_0x312a('0x4e')]({'plain':!![]});switch(_0x3aecda[_0x312a('0x4d')]){case _0x312a('0x4f'):_0x452c4c[_0x312a('0x50')](db[_0x312a('0x53')]['query'](_0x45a85a(_0x3aecda,_0x312a('0x59')))[_0x312a('0x2d')](function(){})[_0x312a('0x54')](_0x43eb52()));break;case'onlyIfOpen':_0x452c4c[_0x312a('0x50')](db[_0x312a('0x53')][_0x312a('0x51')](_0x5ed282(_0x3aecda,_0x312a('0x59')))[_0x312a('0x2d')](function(){})[_0x312a('0x54')](_0x43eb52()));break;default:_0x452c4c[_0x312a('0x50')](db['sequelize'][_0x312a('0x51')](_0x23dd81(_0x3aecda,_0x312a('0x59')))[_0x312a('0x2d')](function(){})[_0x312a('0x54')](_0x43eb52()));}}}return _0x452c4c;})['all']();})[_0x312a('0x2d')](function(){return db[_0x312a('0x57')][_0x312a('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x312a('0x5a')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x312a('0x2d')](function(_0x49d8e7){var _0x52fd2d=[];if(_0x49d8e7){for(var _0x337d43=0x0,_0x4277f8;_0x337d43<_0x49d8e7[_0x312a('0x1b')];_0x337d43+=0x1){_0x4277f8=_0x49d8e7[_0x337d43][_0x312a('0x4e')]({'plain':!![]});_0x52fd2d[_0x312a('0x50')](db[_0x312a('0x53')][_0x312a('0x51')](_0x461f51(_0x4277f8,_0x312a('0x59')))['then'](function(){})[_0x312a('0x54')](_0x43eb52()));}}return _0x52fd2d;})['all']();})[_0x312a('0x54')](function(_0x1b2e97){logger[_0x312a('0x14')](_0x312a('0x5b'),_0x312a('0x5c'),_0x1b2e97[_0x312a('0x1d')]);});}var processPromises=function(_0x3ad24d){return BPromise[_0x312a('0x55')](promises)[_0x312a('0x2d')](function(_0xebdac9){})[_0x312a('0x54')](function(_0x4495bc){logger[_0x312a('0x14')](_0x312a('0x5d'),JSON[_0x312a('0x2e')](_0x4495bc));})['finally'](function(){socket[_0x312a('0x5e')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3ad24d){return _0x3ad24d['resume']();}});};var endCsv=function(){return BPromise[_0x312a('0x5f')]()[_0x312a('0x2d')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x312a('0x5e')](_0x312a('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x312a('0x61')](FILEPATH);}catch(_0x37a67b){logger[_0x312a('0x14')](_0x312a('0x62'),JSON[_0x312a('0x2e')](_0x37a67b));}finally{process[_0x312a('0x63')](0x0);}});};process['on'](_0x312a('0x64'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x312a('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x312a('0x11')](',');return db[_0x312a('0x2b')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x427094){var _0x355cd1=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x312a('0x65')](_0x355cd1,{'header':!![],'skipEmptyLines':!![],'step':function(_0x16bcc4,_0x171a64){total+=0x1;var _0xc1c4ce=total;promises[_0x312a('0x50')](checkRow(_0x16bcc4,_0x427094,_0xc1c4ce)['then'](function(){success+=0x1;})[_0x312a('0x54')](function(_0x4de776){if(_0x4de776[_0x312a('0x14')]){errors+=0x1;delete _0x4de776[_0x312a('0x14')];}else if(_0x4de776[_0x312a('0x29')]){duplicates+=0x1;delete _0x4de776[_0x312a('0x29')];}rows[_0x312a('0x50')](_0x4de776);}));if(total%0xc8===0x0){_0x171a64[_0x312a('0x66')]();return processPromises(_0x171a64);}},'complete':function(){return processPromises()[_0x312a('0x2d')](function(){logger[_0x312a('0x67')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x2e70b8,_0x597ddf){logger[_0x312a('0x67')]('CSV\x20parse\x20error',JSON['stringify'](_0x2e70b8));endCsv();}});})['catch'](function(_0x1a7c9b){logger[_0x312a('0x14')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x312a('0x2e')](_0x1a7c9b));});}main(); \ No newline at end of file +var _0xbaea=['phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','select','field','scheduledAt','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','NOW()','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','CmList','BlackLists','get','all','CampaignId','onlyIfOpen','Campaign','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','../../../mysqldb','../../../config/logger','redis','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','phone'];(function(_0x3817b4,_0x119589){var _0x27db42=function(_0x332d39){while(--_0x332d39){_0x3817b4['push'](_0x3817b4['shift']());}};_0x27db42(++_0x119589);}(_0xbaea,0x1f1));var _0xabae=function(_0x556a10,_0x13f7c1){_0x556a10=_0x556a10-0x0;var _0x4968f0=_0xbaea[_0x556a10];return _0x4968f0;};'use strict';var BPromise=require(_0xabae('0x0'));var util=require('util');var _=require(_0xabae('0x1'));var fs=require('fs');var squel=require(_0xabae('0x2'));var Papa=require(_0xabae('0x3'));var Redis=require('ioredis');var db=require(_0xabae('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0xabae('0x5'))('api');config[_0xabae('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xabae('0x6')]));require(_0xabae('0x7'))[_0xabae('0x8')](socket);try{if(!process[_0xabae('0x9')][0x2]||process[_0xabae('0x9')][0x2]===_0xabae('0xa')||process['argv'][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xabae('0x9')][0x2];if(!process['argv'][0x3]||process[_0xabae('0x9')][0x3]===_0xabae('0xa')||process[_0xabae('0x9')][0x3]===_0xabae('0xb')||!process[_0xabae('0x9')][0x4]||process[_0xabae('0x9')][0x4]===_0xabae('0xa')||process['argv'][0x4]==='null'){throw new Error(_0xabae('0xc'));}var FIELDS=_[_0xabae('0xd')](process[_0xabae('0x9')][0x3][_0xabae('0xe')](','),process[_0xabae('0x9')][0x4][_0xabae('0xe')](','));if(!process[_0xabae('0x9')][0x5]||process['argv'][0x5]===_0xabae('0xa')||process[_0xabae('0x9')][0x5]===_0xabae('0xb')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xabae('0x9')][0x5];var COMPANYID=process[_0xabae('0x9')][0x6]&&process['argv'][0x6]!==_0xabae('0xa')&&process[_0xabae('0x9')][0x6]!==_0xabae('0xb')?process[_0xabae('0x9')][0x6]:null;var DUPLICATES=process[_0xabae('0x9')][0x7]&&process['argv'][0x7]!==_0xabae('0xa')&&process['argv'][0x7]!=='null'?process[_0xabae('0x9')][0x7]:null;if(!process[_0xabae('0x9')][0x8]||process[_0xabae('0x9')][0x8]==='undefined'||process['argv'][0x8]===_0xabae('0xb')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x12c5e9){logger[_0xabae('0xf')](_0x12c5e9);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(_0x254a53,_0xb8617f,_0x3302f8,_0xb0075a){var _0x3ededb={'message':_0xb8617f};_0x3ededb[_0x254a53]=!![];if(_0x3302f8){_0x3ededb[_0xabae('0x10')]=_0x3302f8;}if(_0xb0075a){_0x3ededb[_0xabae('0x11')]=_0xb0075a;}return _0x3ededb;}function isEmail(_0x12d19e){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))*$/[_0xabae('0x12')](_0x12d19e);}function checkRow(_0x15e193,_0x42c65d,_0x27c2ed){return new BPromise(function(_0x180057,_0x3fb91a){if(_[_0xabae('0x13')](_0x15e193)){return _0x3fb91a(handleCheckRowError(_0xabae('0xf'),_0xabae('0x14'),null,_0x27c2ed));}if(_0x15e193[_0xabae('0x15')]&&_0x15e193[_0xabae('0x15')][_0xabae('0x16')]){var _0x4d965d=_['map'](_0x15e193[_0xabae('0x15')],_0xabae('0x17'))[_0xabae('0x18')](';');return _0x3fb91a(handleCheckRowError(_0xabae('0xf'),_0x4d965d,null,_0x27c2ed));}var _0x3b4025={};for(var _0x47bcb3 in FIELDS){if(FIELDS[_0xabae('0x19')](_0x47bcb3)&&FIELDS[_0x47bcb3]){_0x3b4025[_0x47bcb3]=_0x15e193['data'][0x0][FIELDS[_0x47bcb3]]||_0x15e193[_0xabae('0x1a')][0x0]['\ufeff'+FIELDS[_0x47bcb3]];}}if(!_0x3b4025['firstName']){return _0x3fb91a(handleCheckRowError(_0xabae('0xf'),'firstName\x20not\x20specified!',null,_0x27c2ed));}if(!_0x3b4025[_0xabae('0x1b')]){return _0x3fb91a(handleCheckRowError(_0xabae('0xf'),_0xabae('0x1c'),null,_0x27c2ed));}if(_0x3b4025[_0xabae('0x1d')]){var _0xad7a99=moment(_0x3b4025[_0xabae('0x1d')],'YYYY-MM-DD');if(!_0xad7a99[_0xabae('0x1e')]()){return _0x3fb91a(handleCheckRowError(_0xabae('0xf'),_0xabae('0x1f'),null,_0x27c2ed));}}if(_0x3b4025[_0xabae('0x20')]){if(!isEmail(_0x3b4025[_0xabae('0x20')])){return _0x3fb91a(handleCheckRowError('error',_0xabae('0x21'),null,_0x27c2ed));}}_0x3b4025[_0xabae('0x22')]=LISTID;_0x3b4025[_0xabae('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xabae('0x16')]&&_0x42c65d){var _0x14d68a={};for(var _0x42e5ef=0x0,_0x5beb93=DUPLICATES['length'];_0x42e5ef<_0x5beb93;_0x42e5ef+=0x1){_0x14d68a[DUPLICATES[_0x42e5ef]]=_0x3b4025[DUPLICATES[_0x42e5ef]];}var _0x3259fa=_[_0xabae('0x24')](_0x42c65d,_0x14d68a);if(_0x3259fa){return _0x3fb91a(handleCheckRowError(_0xabae('0x25'),_0xabae('0x26'),_0x3259fa,_0x27c2ed));}}return db[_0xabae('0x27')][_0xabae('0x28')](_0x3b4025,{'raw':!![],'hooks':![],'fields':_[_0xabae('0x29')](_0x3b4025)})[_0xabae('0x2a')](function(_0x57d0e7){if(DUPLICATES&&DUPLICATES['length']&&_0x42c65d){_0x42c65d[_0xabae('0x2b')](_['pick'](_0x3b4025,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x57d0e7['id'];return _0x180057();})[_0xabae('0x2c')](function(_0x30ccb2){return _0x3fb91a(handleCheckRowError(_0xabae('0xf'),_0xabae('0x2d')+(_0x30ccb2[_0xabae('0x17')]||JSON['stringify'](_0x30ccb2)),null,_0x27c2ed));});});}function checkHopper(){function _0x4c604a(){return function(_0x642583){logger[_0xabae('0xf')](_0xabae('0x2e'),_0xabae('0x2f'),util[_0xabae('0x30')](_0x642583,{'showHidden':![],'depth':null}));};}var _0x457cc0=function(_0x5e0fef,_0x18a7dc){var _0x3945e4=squel[_0xabae('0x31')]()[_0xabae('0x32')](_0xabae('0x33'))[_0xabae('0x34')]([_0xabae('0x1b'),'scheduledAt',_0xabae('0x35'),_0xabae('0x22'),_0x18a7dc,_0xabae('0x36'),_0xabae('0x37')],squel[_0xabae('0x38')]()[_0xabae('0x39')](_0xabae('0x1b'),'phone')[_0xabae('0x39')]('NOW()',_0xabae('0x3a'))[_0xabae('0x39')]('id','ContactId')[_0xabae('0x39')](LISTID[_0xabae('0x3b')](),_0xabae('0x22'))[_0xabae('0x39')](_0x5e0fef['id'][_0xabae('0x3b')](),_0x18a7dc)[_0xabae('0x39')]('NOW()',_0xabae('0x36'))[_0xabae('0x39')]('NOW()','updatedAt')[_0xabae('0x3c')](_0xabae('0x3d'))[_0xabae('0x3e')](_0xabae('0x3f'))['where'](_0xabae('0x40'),LISTID[_0xabae('0x3b')]())[_0xabae('0x3e')](_0xabae('0x41'))[_0xabae('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xabae('0x38')]()['field'](_0xabae('0x1b'))[_0xabae('0x3c')](_0xabae('0x33'))[_0xabae('0x3e')](_0x18a7dc+'\x20=\x20?',_0x5e0fef['id'][_0xabae('0x3b')]())))[_0xabae('0x3b')]();return _0x3945e4;};var _0x3b341f=function(_0x270ac1,_0x319b8d){var _0x495c92=squel[_0xabae('0x31')]()[_0xabae('0x32')](_0xabae('0x33'))[_0xabae('0x34')]([_0xabae('0x1b'),_0xabae('0x3a'),_0xabae('0x35'),_0xabae('0x22'),_0x319b8d,_0xabae('0x36'),_0xabae('0x37')],squel['select']()[_0xabae('0x39')](_0xabae('0x1b'),_0xabae('0x1b'))['field'](_0xabae('0x42'),_0xabae('0x3a'))[_0xabae('0x39')]('id',_0xabae('0x35'))[_0xabae('0x39')](LISTID[_0xabae('0x3b')](),'ListId')[_0xabae('0x39')](_0x270ac1['id']['toString'](),_0x319b8d)[_0xabae('0x39')](_0xabae('0x42'),_0xabae('0x36'))['field'](_0xabae('0x42'),_0xabae('0x37'))[_0xabae('0x3c')](_0xabae('0x3d'))[_0xabae('0x3e')](_0xabae('0x3f'))[_0xabae('0x3e')](_0xabae('0x40'),LISTID['toString']())[_0xabae('0x3e')](_0xabae('0x43'),squel[_0xabae('0x44')](hopperContacts))[_0xabae('0x3e')](_0xabae('0x41'))[_0xabae('0x3e')](_0xabae('0x45'),squel['select']()[_0xabae('0x39')](_0xabae('0x46'))[_0xabae('0x3c')]('cm_hopper_final')[_0xabae('0x3e')](_0x319b8d+_0xabae('0x47'),_0x270ac1['id'][_0xabae('0x3b')]()))[_0xabae('0x3e')](_0xabae('0x45'),squel[_0xabae('0x38')]()[_0xabae('0x39')](_0xabae('0x1b'))[_0xabae('0x3c')]('cm_hopper')[_0xabae('0x3e')](_0x319b8d+_0xabae('0x47'),_0x270ac1['id'][_0xabae('0x3b')]())))[_0xabae('0x3b')]();return _0x495c92;};function _0x2b735e(_0x3d6f67,_0xe84adc){var _0xfee8a6=squel[_0xabae('0x31')]()[_0xabae('0x32')](_0xabae('0x33'))['fromQuery'](['phone','scheduledAt','ContactId',_0xabae('0x22'),_0xe84adc,'createdAt',_0xabae('0x37')],squel[_0xabae('0x38')]()[_0xabae('0x39')]('phone',_0xabae('0x1b'))[_0xabae('0x39')]('NOW()',_0xabae('0x3a'))[_0xabae('0x39')]('id',_0xabae('0x35'))[_0xabae('0x39')](LISTID[_0xabae('0x3b')](),_0xabae('0x22'))[_0xabae('0x39')](_0x3d6f67['id'][_0xabae('0x3b')](),_0xe84adc)[_0xabae('0x39')](_0xabae('0x42'),_0xabae('0x36'))['field'](_0xabae('0x42'),_0xabae('0x37'))[_0xabae('0x3c')](_0xabae('0x3d'))[_0xabae('0x3e')](_0xabae('0x3f'))[_0xabae('0x3e')]('ListId\x20=\x20?',LISTID[_0xabae('0x3b')]())[_0xabae('0x3e')](_0xabae('0x43'),squel[_0xabae('0x44')](hopperContacts))[_0xabae('0x3e')](_0xabae('0x41')))[_0xabae('0x3b')]();return _0xfee8a6;}function _0x22a05b(_0x20e07c,_0x5a7fdd){var _0x278b9e=squel[_0xabae('0x31')]()[_0xabae('0x32')](_0xabae('0x48'))['fromQuery']([_0xabae('0x1b'),_0xabae('0x35'),'ListId',_0x5a7fdd,_0xabae('0x36'),'updatedAt'],squel[_0xabae('0x38')]()['field'](_0xabae('0x1b'),_0xabae('0x1b'))[_0xabae('0x39')]('id','ContactId')[_0xabae('0x39')](LISTID[_0xabae('0x3b')](),_0xabae('0x22'))[_0xabae('0x39')](_0x20e07c['id']['toString'](),_0x5a7fdd)[_0xabae('0x39')](_0xabae('0x42'),_0xabae('0x36'))[_0xabae('0x39')](_0xabae('0x42'),_0xabae('0x37'))['from']('cm_contacts')[_0xabae('0x3e')](_0xabae('0x3f'))[_0xabae('0x3e')](_0xabae('0x40'),LISTID['toString']())[_0xabae('0x3e')](_0xabae('0x43'),squel['str'](hopperContacts))[_0xabae('0x3e')](_0xabae('0x41')))['toString']();return _0x278b9e;}return db[_0xabae('0x49')][_0xabae('0x4a')]({'where':{'type':_0xabae('0x4b')},'attributes':['id',_0xabae('0x4c')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xabae('0x2a')](function(_0x1ed218){var _0x209e38=[];if(_0x1ed218){var _0x45da1d;for(var _0x39c98d=0x0,_0x5145df;_0x39c98d<_0x1ed218[_0xabae('0x16')];_0x39c98d+=0x1){_0x5145df=_0x1ed218[_0x39c98d]['get']({'plain':!![]});switch(_0x5145df[_0xabae('0x4c')]){case _0xabae('0x4d'):_0x209e38['push'](db[_0xabae('0x4e')][_0xabae('0x4f')](_0x3b341f(_0x5145df,_0xabae('0x50')))[_0xabae('0x2a')](function(){})[_0xabae('0x2c')](_0x4c604a()));break;case'onlyIfOpen':_0x209e38[_0xabae('0x2b')](db['sequelize'][_0xabae('0x4f')](_0x457cc0(_0x5145df,'VoiceQueueId'))['then'](function(){})[_0xabae('0x2c')](_0x4c604a()));break;default:_0x209e38['push'](db[_0xabae('0x4e')][_0xabae('0x4f')](_0x2b735e(_0x5145df,'VoiceQueueId'))[_0xabae('0x2a')](function(){})[_0xabae('0x2c')](_0x4c604a()));}}}return _0x209e38;})['all']()[_0xabae('0x2a')](function(){return db[_0xabae('0x49')][_0xabae('0x4a')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xabae('0x51')],'as':_0xabae('0x52'),'where':{'id':LISTID}}]})[_0xabae('0x2a')](function(_0x20ec75){var _0x58d0af=[];if(_0x20ec75){var _0x2cfd2d;for(var _0x3b1b66=0x0,_0x22e53c;_0x3b1b66<_0x20ec75[_0xabae('0x16')];_0x3b1b66+=0x1){_0x22e53c=_0x20ec75[_0x3b1b66][_0xabae('0x53')]({'plain':!![]});_0x58d0af[_0xabae('0x2b')](db['sequelize']['query'](_0x22a05b(_0x22e53c,_0xabae('0x50')))['then'](function(){})['catch'](_0x4c604a()));}}return _0x58d0af;})[_0xabae('0x54')]();})['then'](function(){return db['Campaign'][_0xabae('0x4a')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xabae('0x51')],'as':'Lists','where':{'id':LISTID}}]})[_0xabae('0x2a')](function(_0x278db9){var _0x5cb188=[];if(_0x278db9){for(var _0x21a19c=0x0,_0x3a691a;_0x21a19c<_0x278db9[_0xabae('0x16')];_0x21a19c+=0x1){_0x3a691a=_0x278db9[_0x21a19c][_0xabae('0x53')]({'plain':!![]});switch(_0x3a691a['dialCheckDuplicateType']){case'always':_0x5cb188[_0xabae('0x2b')](db[_0xabae('0x4e')]['query'](_0x3b341f(_0x3a691a,_0xabae('0x55')))['then'](function(){})[_0xabae('0x2c')](_0x4c604a()));break;case _0xabae('0x56'):_0x5cb188[_0xabae('0x2b')](db[_0xabae('0x4e')][_0xabae('0x4f')](_0x457cc0(_0x3a691a,_0xabae('0x55')))['then'](function(){})['catch'](_0x4c604a()));break;default:_0x5cb188[_0xabae('0x2b')](db[_0xabae('0x4e')][_0xabae('0x4f')](_0x2b735e(_0x3a691a,'CampaignId'))[_0xabae('0x2a')](function(){})['catch'](_0x4c604a()));}}}return _0x5cb188;})['all']();})[_0xabae('0x2a')](function(){return db[_0xabae('0x57')][_0xabae('0x4a')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0xabae('0x2a')](function(_0x40ae82){var _0x1112c6=[];if(_0x40ae82){for(var _0x119942=0x0,_0x4d0bb5;_0x119942<_0x40ae82[_0xabae('0x16')];_0x119942+=0x1){_0x4d0bb5=_0x40ae82[_0x119942][_0xabae('0x53')]({'plain':!![]});_0x1112c6[_0xabae('0x2b')](db[_0xabae('0x4e')][_0xabae('0x4f')](_0x22a05b(_0x4d0bb5,_0xabae('0x55')))[_0xabae('0x2a')](function(){})[_0xabae('0x2c')](_0x4c604a()));}}return _0x1112c6;})[_0xabae('0x54')]();})[_0xabae('0x2c')](function(_0x294f8b){logger[_0xabae('0xf')](_0xabae('0x58'),'generalCheckHopper',_0x294f8b[_0xabae('0x17')]);});}var processPromises=function(_0x166071){return BPromise['all'](promises)[_0xabae('0x2a')](function(_0xf48b11){})['catch'](function(_0x5a4d7e){logger['error'](_0xabae('0x59'),JSON[_0xabae('0x5a')](_0x5a4d7e));})[_0xabae('0x5b')](function(){socket[_0xabae('0x5c')](_0xabae('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x166071){return _0x166071[_0xabae('0x5e')]();}});};var endCsv=function(){return BPromise[_0xabae('0x5f')]()[_0xabae('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0xabae('0x2a')](function(){socket[_0xabae('0x5c')](_0xabae('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x21114d){logger[_0xabae('0xf')](_0xabae('0x60'),JSON[_0xabae('0x5a')](_0x21114d));}finally{process[_0xabae('0x61')](0x0);}});};process['on'](_0xabae('0x62'),function(){logger[_0xabae('0x63')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0xabae('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xabae('0x27')][_0xabae('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xabae('0x2a')](function(_0x1b8a97){var _0x47933d=fs[_0xabae('0x64')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xabae('0x65')](_0x47933d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e0c6f,_0x4078c6){total+=0x1;var _0xb88da2=total;promises[_0xabae('0x2b')](checkRow(_0x1e0c6f,_0x1b8a97,_0xb88da2)[_0xabae('0x2a')](function(){success+=0x1;})[_0xabae('0x2c')](function(_0x1e6650){if(_0x1e6650[_0xabae('0xf')]){errors+=0x1;delete _0x1e6650[_0xabae('0xf')];}else if(_0x1e6650[_0xabae('0x25')]){duplicates+=0x1;delete _0x1e6650['duplicate'];}rows[_0xabae('0x2b')](_0x1e6650);}));if(total%0xc8===0x0){_0x4078c6[_0xabae('0x66')]();return processPromises(_0x4078c6);}},'complete':function(){return processPromises()[_0xabae('0x2a')](function(){logger[_0xabae('0x63')](_0xabae('0x67'));endCsv();});},'error':function(_0x3535eb,_0x4c92fc){logger[_0xabae('0x63')]('CSV\x20parse\x20error',JSON[_0xabae('0x5a')](_0x3535eb));endCsv();}});})['catch'](function(_0x16b262){logger[_0xabae('0xf')](_0xabae('0x68'),JSON['stringify'](_0x16b262));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 2d1bcc5..539ab21 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 _0x6b5b=['LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','root','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','defaults','redis','localhost','socket.io-emitter','format','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','concat','keys','insert','fields',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','field','min_id','info','Received\x20SIGINT','message','push','query','main','stringify','send','start','binding','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','rows','errors','trim','replace','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','error','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;'];(function(_0xcc5aeb,_0xc48bcb){var _0x4c2d2b=function(_0x21935e){while(--_0x21935e){_0xcc5aeb['push'](_0xcc5aeb['shift']());}};_0x4c2d2b(++_0xc48bcb);}(_0x6b5b,0x130));var _0xb6b5=function(_0x21f959,_0x42fdbc){_0x21f959=_0x21f959-0x0;var _0x210421=_0x6b5b[_0x21f959];return _0x210421;};'use strict';var fs=require('fs');var path=require(_0xb6b5('0x0'));var _=require(_0xb6b5('0x1'));var Papa=require(_0xb6b5('0x2'));var util=require(_0xb6b5('0x3'));var BPromise=require(_0xb6b5('0x4'));var moment=require(_0xb6b5('0x5'));var squel=require(_0xb6b5('0x6'));var Redis=require(_0xb6b5('0x7'));var db=require(_0xb6b5('0x8'))['db'];var config=require(_0xb6b5('0x9'));var logger=require('../../../config/logger')('import');config['redis']=_[_0xb6b5('0xa')](config[_0xb6b5('0xb')],{'host':_0xb6b5('0xc'),'port':0x18eb});var socket=require(_0xb6b5('0xd'))(new Redis(config[_0xb6b5('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xb6b5('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x34d511){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))*$/[_0xb6b5('0xf')](_0x34d511);}function selectNotIn(_0x4dbb08,_0x2187e4,_0x5f5634,_0x4706b6,_0x5c387b){return squel[_0xb6b5('0x10')]()['field'](_0xb6b5('0x11'))[_0xb6b5('0x12')](_0x4706b6)[_0xb6b5('0x13')](_0x2187e4,null,_0x2187e4+_0xb6b5('0x14')+_0x4706b6+'.'+_0x5f5634)[_0xb6b5('0x15')](_0x4706b6+'.'+_0x5f5634+_0xb6b5('0x16')+_0x4dbb08+'.'+_0x5f5634)['where'](_0x2187e4+_0xb6b5('0x17')+_0x5c387b[_0xb6b5('0x13')]()+')');}function insertCmHopper(_0x2bec73,_0x466772,_0xcd6edf,_0x4ea23b,_0x334d56){var _0x54b131=[_0xb6b5('0x18'),_0xb6b5('0x19'),_0xb6b5('0x1a'),_0xb6b5('0x1b'),_0x466772+'.'+_0x4ea23b,_0xb6b5('0x1c'),'cm_contacts.updatedAt',_0xb6b5('0x1d'),_0xb6b5('0x1e'),'\x22'+_0x334d56+'\x22'];return squel['insert']()[_0xb6b5('0x1f')](_0xb6b5('0x20'))[_0xb6b5('0x21')]([_0xb6b5('0x11'),'scheduledat',_0xb6b5('0x22'),_0xb6b5('0x23'),_0x4ea23b,_0xb6b5('0x24'),_0xb6b5('0x25'),'priority',_0xb6b5('0x26'),_0xb6b5('0x27')],squel[_0xb6b5('0x10')]()['fields'](_0x54b131)[_0xb6b5('0x12')](_0x466772)[_0xb6b5('0x13')](_0xb6b5('0x28'),null,_0xb6b5('0x29')+_0x466772+_0xb6b5('0x2a'))[_0xb6b5('0x13')](_0xcd6edf,null,_0xcd6edf+'.id\x20=\x20'+_0x466772+'.'+_0x4ea23b)[_0xb6b5('0x15')](_0x466772+_0xb6b5('0x2b'),_0x2bec73)[_0xb6b5('0x15')](_0xb6b5('0x2c'),NOW)[_0xb6b5('0x15')](_0xb6b5('0x2d'),selectNotIn(_0x466772,_0xcd6edf,_0x4ea23b,_0xb6b5('0x20'),['\x22always\x22',_0xb6b5('0x2e')]))[_0xb6b5('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x466772,_0xcd6edf,_0x4ea23b,_0xb6b5('0x20'),['\x22always\x22'])))[_0xb6b5('0x2f')]();}function insertCmHopperBlack(_0x4aa81b,_0x36ee96,_0x5cb511,_0x3198cd){var _0x59bf65=[_0xb6b5('0x18'),_0xb6b5('0x1a'),_0xb6b5('0x1b'),_0x36ee96+'.'+_0x3198cd,_0xb6b5('0x1c'),'cm_contacts.updatedAt'];return squel['insert']()[_0xb6b5('0x1f')](_0xb6b5('0x30'))[_0xb6b5('0x21')]([_0xb6b5('0x11'),_0xb6b5('0x22'),_0xb6b5('0x23'),_0x3198cd,_0xb6b5('0x24'),_0xb6b5('0x25')],squel[_0xb6b5('0x10')]()['fields'](_0x59bf65)['from'](_0x36ee96)[_0xb6b5('0x13')](_0xb6b5('0x28'),null,_0xb6b5('0x29')+_0x36ee96+'.CmListId')[_0xb6b5('0x13')](_0x5cb511,null,_0x5cb511+_0xb6b5('0x14')+_0x36ee96+'.'+_0x3198cd)[_0xb6b5('0x15')](_0x36ee96+_0xb6b5('0x2b'),_0x4aa81b)[_0xb6b5('0x15')](_0xb6b5('0x2c'),NOW)[_0xb6b5('0x15')](_0xb6b5('0x2d'),squel[_0xb6b5('0x10')]()['field'](_0xb6b5('0x11'))[_0xb6b5('0x12')]('cm_hopper_black')['where'](_0xb6b5('0x31'),_0x4aa81b)[_0xb6b5('0x15')](_0x3198cd+_0xb6b5('0x32'),_0x36ee96+'.'+_0x3198cd)))[_0xb6b5('0x2f')]();}function insertCmContact(_0x4a598f,_0x3fca79,_0x38d0b0,_0x19f7af){var _0x10ba8f=_[_0xb6b5('0x33')](_[_0xb6b5('0x34')](_0x19f7af),[_0xb6b5('0x23'),'CompanyId',_0xb6b5('0x24'),_0xb6b5('0x25')]);return squel[_0xb6b5('0x35')]()[_0xb6b5('0x1f')](_0xb6b5('0x28'))['fromQuery'](_0x10ba8f,squel[_0xb6b5('0x10')]()[_0xb6b5('0x36')](_0x10ba8f)[_0xb6b5('0x12')](_0x3fca79)[_0xb6b5('0x15')]('('+_0x38d0b0[_0xb6b5('0x13')](',')+_0xb6b5('0x37'),squel[_0xb6b5('0x10')]()['fields'](_0x38d0b0)[_0xb6b5('0x12')](_0xb6b5('0x28'))['where'](_0xb6b5('0x31'),_0x4a598f)['where'](_0xb6b5('0x38')))[_0xb6b5('0x15')]('id\x20IN\x20?',squel['select']()[_0xb6b5('0x39')]('MIN(id)',_0xb6b5('0x3a'))['from'](_0x3fca79)['group'](_0x38d0b0[_0xb6b5('0x13')](','))))[_0xb6b5('0x2f')]();}function handleStop(){logger[_0xb6b5('0x3b')](_0xb6b5('0x3c'));stopped=!![];}function handleUncaughtException(_0x3abcc8){logger['error'](_0x3abcc8[_0xb6b5('0x3d')]);process['exit'](0x1);}function handleError(_0x3abdf4,_0x224b5b){stats['errors'][_0xb6b5('0x3e')]({'name':_0x224b5b['code'],'message':_0x224b5b['message'],'row':_0x3abdf4});}function handleQuery(_0x8635cc){logger[_0xb6b5('0x3b')](_0x8635cc);return db['sequelize'][_0xb6b5('0x3f')](_0x8635cc)['spread'](function(_0x21554a){results[_0xb6b5('0x3e')](_0x21554a);})['catch'](function(_0x2d9395){logger['error'](_0x2d9395['message']);});}function main(_0x2545de,_0x3f4eff,_0x5f4263,_0x361c0b){logger['info'](_0xb6b5('0x40'),_0x2545de,JSON[_0xb6b5('0x41')](_0x3f4eff));process[_0xb6b5('0x42')](_0xb6b5('0x43'));var _0x1536e0=_0x3f4eff[_0xb6b5('0x44')];var _0x52824d=_0x3f4eff['socket_timestamp'];var _0x330af7=path[_0xb6b5('0x13')](config['root'],_0xb6b5('0x45'),_0x52824d+_0xb6b5('0x46'));var _0x21bb2f=_['keys'](_0x1536e0)[_0xb6b5('0x13')]();logger['info'](_0xb6b5('0x47'),_0x21bb2f);fs[_0xb6b5('0x48')](_0x330af7,_0x21bb2f+'\x0a');Papa[_0xb6b5('0x49')](fs[_0xb6b5('0x4a')](_0x2545de),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2da069,_0x3a8ef8){try{for(var _0x48b6fa=0x0,_0x14fe98=[];_0x48b6fa<_0x2da069[_0xb6b5('0x4b')][_0xb6b5('0x4c')];_0x48b6fa++){stats[_0xb6b5('0x4d')]+=0x1;if(_0x2da069[_0xb6b5('0x4e')][_0x48b6fa]){handleError(_0x2da069[_0xb6b5('0x4b')][_0x48b6fa],_0x2da069[_0xb6b5('0x4e')][_0x48b6fa]);}else{var _0x2b33bd=[];for(var _0x33c0ed in _0x1536e0){if(_0x1536e0['hasOwnProperty'](_0x33c0ed)){if(_0x2da069[_0xb6b5('0x4b')][_0x48b6fa][_0x1536e0[_0x33c0ed]]){var _0x3adcaa=_[_0xb6b5('0x4f')](_0x2da069[_0xb6b5('0x4b')][_0x48b6fa][_0x1536e0[_0x33c0ed]][_0xb6b5('0x50')](/"/g,'\x27'));switch(_0x33c0ed){case _0xb6b5('0x51'):var _0x444efa=moment(_0x3adcaa,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x444efa['isValid']()){_0x14fe98[_0xb6b5('0x3e')]('\x22'+_0x3adcaa+'\x22');}else{_0x2b33bd['push'](_0xb6b5('0x52'));}break;case _0xb6b5('0x53'):var _0x45beb6=parseInt(_0x3adcaa);_0x3adcaa=_['isNaN'](_0x45beb6)||_0x45beb6<0x0||_0x45beb6>0x4?_0x361c0b?0x3:0x2:_0x45beb6;_0x14fe98['push']('\x22'+_0x3adcaa+'\x22');break;case'UserId':var _0x30bbf4=parseInt(_0x3adcaa);if(_[_0xb6b5('0x54')](_0x30bbf4)&&_[_0xb6b5('0x55')](_0x5f4263,_0x30bbf4)){_0x14fe98[_0xb6b5('0x3e')]('\x22'+_0x30bbf4+'\x22');}else{_0x2b33bd[_0xb6b5('0x3e')](_0xb6b5('0x56'));}break;case _0xb6b5('0x57'):if(isEmail(_0x3adcaa)){_0x14fe98[_0xb6b5('0x3e')]('\x22'+_0x3adcaa+'\x22');}else{_0x2b33bd[_0xb6b5('0x3e')](_0xb6b5('0x58'));}break;case'dateOfBirth':var _0x56cfc0=moment(_0x3adcaa,_0xb6b5('0x59'),!![]);if(_0x56cfc0[_0xb6b5('0x5a')]()){_0x14fe98[_0xb6b5('0x3e')]('\x22'+_0x3adcaa+'\x22');}else{_0x2b33bd[_0xb6b5('0x3e')](_0xb6b5('0x5b'));}break;default:_0x14fe98['push']('\x22'+_0x3adcaa+'\x22');}}else{switch(_0x33c0ed){case _0xb6b5('0x5c'):case _0xb6b5('0x11'):_0x2b33bd[_0xb6b5('0x3e')](_0x33c0ed+_0xb6b5('0x5d'));break;default:_0x14fe98[_0xb6b5('0x3e')]('\x22\x22');}}}}if(_0x2b33bd[_0xb6b5('0x4c')]){handleError(_0x2da069[_0xb6b5('0x4b')][_0x48b6fa],{'code':_0xb6b5('0x5e'),'message':_0x2b33bd['join']()});}else{fs[_0xb6b5('0x5f')](_0x330af7,_0x14fe98['join']()+'\x0a');}_0x14fe98=[];}if(!(stats[_0xb6b5('0x4d')]%0xc8)){socket[_0xb6b5('0x60')](_0xb6b5('0x61')+_0x52824d,stats);stats[_0xb6b5('0x4e')]=[];}}if(stopped){logger[_0xb6b5('0x3b')](_0xb6b5('0x62'));_0x3a8ef8[_0xb6b5('0x63')]();}}catch(_0x4dfeca){handleError(_0x2da069[_0xb6b5('0x4b')][_0x48b6fa],{'code':_0xb6b5('0x64'),'message':_0x4dfeca[_0xb6b5('0x3d')]});logger[_0xb6b5('0x65')](_0xb6b5('0x66'),_0x4dfeca[_0xb6b5('0x3d')]);}},'complete':function(){try{var _0x100b72=[];var _0x3f2bef=_0xb6b5('0x28');if(_0x3f4eff['duplicates']&&_0x3f4eff[_0xb6b5('0x67')][_0xb6b5('0x4c')]){_0x3f2bef=_0xb6b5('0x68')+_0x52824d;_0x100b72[_0xb6b5('0x3e')](_0xb6b5('0x69')+_0x3f2bef+_0xb6b5('0x6a'));}var _0x2d62cf=util[_0xb6b5('0xe')](_0xb6b5('0x6b'),_0x330af7,_0x3f2bef,_0x21bb2f,_0x3f4eff['ListId'],_0x3f4eff[_0xb6b5('0x6c')]||null,NOW,NOW);if(_['isNil'](_0x1536e0['scheduledat'])){_0x2d62cf+=_0xb6b5('0x6d');}_0x100b72[_0xb6b5('0x3e')](_0x2d62cf);if(_0x3f4eff[_0xb6b5('0x67')]&&_0x3f4eff['duplicates'][_0xb6b5('0x4c')]){_0x100b72[_0xb6b5('0x3e')](insertCmContact(_0x3f4eff[_0xb6b5('0x23')],_0x3f2bef,_0x3f4eff['duplicates'],_0x1536e0));_0x100b72[_0xb6b5('0x3e')](_0xb6b5('0x6e')+_0x3f2bef+';');}_0x100b72[_0xb6b5('0x3e')](insertCmHopper(_0x3f4eff[_0xb6b5('0x23')],_0xb6b5('0x6f'),_0xb6b5('0x70'),'VoiceQueueId',_0x361c0b));_0x100b72[_0xb6b5('0x3e')](insertCmHopperBlack(_0x3f4eff[_0xb6b5('0x23')],_0xb6b5('0x71'),_0xb6b5('0x70'),_0xb6b5('0x72')));_0x100b72['push'](insertCmHopper(_0x3f4eff['ListId'],_0xb6b5('0x73'),_0xb6b5('0x74'),_0xb6b5('0x75'),_0x361c0b));_0x100b72[_0xb6b5('0x3e')](insertCmHopperBlack(_0x3f4eff[_0xb6b5('0x23')],_0xb6b5('0x76'),_0xb6b5('0x74'),_0xb6b5('0x75')));BPromise[_0xb6b5('0x77')](_0x100b72,handleQuery)[_0xb6b5('0x78')](function(_0x3320ce){stats[_0xb6b5('0x79')]=!![];stats['affectedRows']=_0x3f4eff[_0xb6b5('0x67')]&&_0x3f4eff['duplicates'][_0xb6b5('0x4c')]?results[0x2][_0xb6b5('0x7a')]:results[0x0][_0xb6b5('0x7a')];socket[_0xb6b5('0x60')](_0xb6b5('0x61')+_0x52824d,stats);fs[_0xb6b5('0x7b')](_0x2545de);fs[_0xb6b5('0x7b')](_0x330af7);process[_0xb6b5('0x7c')](0x0);})['catch'](function(_0x5a12cd){logger[_0xb6b5('0x65')](_0x5a12cd['message']);process[_0xb6b5('0x7c')](0x1);});}catch(_0x33e336){logger[_0xb6b5('0x65')](_0xb6b5('0x7d'),_0x33e336[_0xb6b5('0x3d')]);process[_0xb6b5('0x7c')](0x1);}},'error':function(_0x9e21e5,_0x55302b,_0x437d4c,_0xb80152){throw new Error(_0xb80152);}});}function validate(){if(process['argv']&&process[_0xb6b5('0x7e')][_0xb6b5('0x4c')]<0x4){throw new Error(_0xb6b5('0x7f'));}var _0x1ecce6=path[_0xb6b5('0x13')](config[_0xb6b5('0x80')],'server/files/tmp',process[_0xb6b5('0x7e')][0x2]);if(!fs['existsSync'](_0x1ecce6)){throw new Error(_0xb6b5('0x81'));}var _0x49ebe2={};try{_0x49ebe2=JSON['parse'](process['argv'][0x3]);if(!_0x49ebe2['binding']){throw new Error(_0xb6b5('0x82'));}if(!_0x49ebe2[_0xb6b5('0x44')][_0xb6b5('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x49ebe2[_0xb6b5('0x44')][_0xb6b5('0x5c')]){throw new Error(_0xb6b5('0x83'));}var _0x17bf7d=0x0;if(_0x49ebe2['binding'][_0xb6b5('0x26')]){_0x17bf7d=0x1;}if(!_0x49ebe2[_0xb6b5('0x23')]){throw new Error(_0xb6b5('0x84'));}}catch(_0x3c0e3d){throw new Error(_0xb6b5('0x85'));}var _0x3906db=[];try{_0x3906db=_[_0xb6b5('0x86')](JSON[_0xb6b5('0x49')](process[_0xb6b5('0x7e')][0x4]),'id');}catch(_0x1f3bfb){logger['info']('No\x20agent\x20available');}main(_0x1ecce6,_0x49ebe2,_0x3906db,_0x17bf7d);}validate();process['on'](_0xb6b5('0x87'),handleStop);process['on'](_0xb6b5('0x88'),handleUncaughtException); \ No newline at end of file +var _0x804b=['createdAt','priority','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_contacts.updatedAt','insert','into','cm_hopper_black','fromQuery','ListId','updatedAt','.CmListId\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','concat','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','error','message','exit','errors','push','code','info','sequelize','query','spread','main','stringify','send','start','binding','socket_timestamp','.csv','keys','header','writeFileSync','createReadStream','rows','hasOwnProperty','data','trim','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','length','appendFileSync','emit','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','then','affectedRows','contact:import:','unlink','catch','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','parse','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','import','redis','socket.io-emitter','format','test','field','from','join','where','\x20=\x20','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper','phone','scheduledat','ContactId'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x804b,0x6a));var _0xb804=function(_0x1d33e1,_0xac0648){_0x1d33e1=_0x1d33e1-0x0;var _0x2f67eb=_0x804b[_0x1d33e1];return _0x2f67eb;};'use strict';var fs=require('fs');var path=require(_0xb804('0x0'));var _=require(_0xb804('0x1'));var Papa=require(_0xb804('0x2'));var util=require(_0xb804('0x3'));var BPromise=require(_0xb804('0x4'));var moment=require(_0xb804('0x5'));var squel=require(_0xb804('0x6'));var Redis=require(_0xb804('0x7'));var db=require(_0xb804('0x8'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xb804('0x9'));config['redis']=_['defaults'](config[_0xb804('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb804('0xb'))(new Redis(config[_0xb804('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xb804('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x352c40){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))*$/[_0xb804('0xd')](_0x352c40);}function selectNotIn(_0x426709,_0x2e9484,_0x3bf78e,_0xf3a7fc,_0x598557){return squel['select']()[_0xb804('0xe')]('phone')[_0xb804('0xf')](_0xf3a7fc)[_0xb804('0x10')](_0x2e9484,null,_0x2e9484+'.id\x20=\x20'+_0xf3a7fc+'.'+_0x3bf78e)[_0xb804('0x11')](_0xf3a7fc+'.'+_0x3bf78e+_0xb804('0x12')+_0x426709+'.'+_0x3bf78e)[_0xb804('0x11')](_0x2e9484+'.dialCheckDuplicateType\x20IN\x20('+_0x598557[_0xb804('0x10')]()+')');}function insertCmHopper(_0x18d349,_0x448fb3,_0x26cc74,_0x5768cd,_0x26d7b1){var _0x5b0923=[_0xb804('0x13'),_0xb804('0x14'),'cm_contacts.id',_0xb804('0x15'),_0x448fb3+'.'+_0x5768cd,_0xb804('0x16'),'cm_contacts.updatedAt','cm_contacts.priority',_0xb804('0x17'),'\x22'+_0x26d7b1+'\x22'];return squel['insert']()['into'](_0xb804('0x18'))['fromQuery']([_0xb804('0x19'),_0xb804('0x1a'),_0xb804('0x1b'),'ListId',_0x5768cd,_0xb804('0x1c'),'updatedAt',_0xb804('0x1d'),_0xb804('0x1e'),_0xb804('0x1f')],squel[_0xb804('0x20')]()[_0xb804('0x21')](_0x5b0923)['from'](_0x448fb3)[_0xb804('0x10')](_0xb804('0x22'),null,_0xb804('0x23')+_0x448fb3+'.CmListId')[_0xb804('0x10')](_0x26cc74,null,_0x26cc74+_0xb804('0x24')+_0x448fb3+'.'+_0x5768cd)[_0xb804('0x11')](_0x448fb3+'.CmListId\x20=\x20?',_0x18d349)[_0xb804('0x11')](_0xb804('0x25'),NOW)[_0xb804('0x11')](_0xb804('0x26'),selectNotIn(_0x448fb3,_0x26cc74,_0x5768cd,_0xb804('0x18'),['\x22always\x22',_0xb804('0x27')]))[_0xb804('0x11')](_0xb804('0x26'),selectNotIn(_0x448fb3,_0x26cc74,_0x5768cd,'cm_hopper',['\x22always\x22'])))[_0xb804('0x28')]();}function insertCmHopperBlack(_0x339d1b,_0x4f2715,_0x424c99,_0x1194fe){var _0x2dca97=[_0xb804('0x13'),_0xb804('0x29'),'cm_contacts.ListId',_0x4f2715+'.'+_0x1194fe,_0xb804('0x16'),_0xb804('0x2a')];return squel[_0xb804('0x2b')]()[_0xb804('0x2c')](_0xb804('0x2d'))[_0xb804('0x2e')](['phone',_0xb804('0x1b'),_0xb804('0x2f'),_0x1194fe,_0xb804('0x1c'),_0xb804('0x30')],squel[_0xb804('0x20')]()['fields'](_0x2dca97)[_0xb804('0xf')](_0x4f2715)[_0xb804('0x10')](_0xb804('0x22'),null,_0xb804('0x23')+_0x4f2715+'.CmListId')[_0xb804('0x10')](_0x424c99,null,_0x424c99+'.id\x20=\x20'+_0x4f2715+'.'+_0x1194fe)[_0xb804('0x11')](_0x4f2715+_0xb804('0x31'),_0x339d1b)[_0xb804('0x11')](_0xb804('0x25'),NOW)[_0xb804('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xb804('0x20')]()[_0xb804('0xe')](_0xb804('0x19'))[_0xb804('0xf')](_0xb804('0x2d'))['where'](_0xb804('0x32'),_0x339d1b)[_0xb804('0x11')](_0x1194fe+_0xb804('0x33'),_0x4f2715+'.'+_0x1194fe)))[_0xb804('0x28')]();}function insertCmContact(_0x315f4e,_0x2e687e,_0x21679a,_0x56e63b){var _0x5937f8=_[_0xb804('0x34')](_['keys'](_0x56e63b),[_0xb804('0x2f'),_0xb804('0x35'),_0xb804('0x1c'),_0xb804('0x30')]);return squel[_0xb804('0x2b')]()[_0xb804('0x2c')](_0xb804('0x22'))[_0xb804('0x2e')](_0x5937f8,squel[_0xb804('0x20')]()[_0xb804('0x21')](_0x5937f8)[_0xb804('0xf')](_0x2e687e)[_0xb804('0x11')]('('+_0x21679a[_0xb804('0x10')](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0xb804('0x21')](_0x21679a)[_0xb804('0xf')](_0xb804('0x22'))[_0xb804('0x11')](_0xb804('0x32'),_0x315f4e)[_0xb804('0x11')](_0xb804('0x36')))['where'](_0xb804('0x37'),squel[_0xb804('0x20')]()['field'](_0xb804('0x38'),_0xb804('0x39'))['from'](_0x2e687e)[_0xb804('0x3a')](_0x21679a['join'](','))))[_0xb804('0x28')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x19aa5b){logger[_0xb804('0x3b')](_0x19aa5b[_0xb804('0x3c')]);process[_0xb804('0x3d')](0x1);}function handleError(_0x532774,_0x306991){stats[_0xb804('0x3e')][_0xb804('0x3f')]({'name':_0x306991[_0xb804('0x40')],'message':_0x306991[_0xb804('0x3c')],'row':_0x532774});}function handleQuery(_0x29710f){logger[_0xb804('0x41')](_0x29710f);return db[_0xb804('0x42')][_0xb804('0x43')](_0x29710f)[_0xb804('0x44')](function(_0x10a164){results[_0xb804('0x3f')](_0x10a164);})['catch'](function(_0x58e268){logger['error'](_0x58e268[_0xb804('0x3c')]);});}function main(_0x3b9718,_0x4cb446,_0x13883e,_0x9ae2b6){logger[_0xb804('0x41')](_0xb804('0x45'),_0x3b9718,JSON[_0xb804('0x46')](_0x4cb446));process[_0xb804('0x47')](_0xb804('0x48'));var _0x1f9fc6=_0x4cb446[_0xb804('0x49')];var _0x586529=_0x4cb446[_0xb804('0x4a')];var _0x552cd2=path[_0xb804('0x10')](config['root'],'server/files/tmp',_0x586529+_0xb804('0x4b'));var _0x3b48f2=_[_0xb804('0x4c')](_0x1f9fc6)[_0xb804('0x10')]();logger['info'](_0xb804('0x4d'),_0x3b48f2);fs[_0xb804('0x4e')](_0x552cd2,_0x3b48f2+'\x0a');Papa['parse'](fs[_0xb804('0x4f')](_0x3b9718),{'header':!![],'skipEmptyLines':!![],'step':function(_0x217ec4,_0x52f93c){try{for(var _0x53da1f=0x0,_0x483ce0=[];_0x53da1f<_0x217ec4['data']['length'];_0x53da1f++){stats[_0xb804('0x50')]+=0x1;if(_0x217ec4[_0xb804('0x3e')][_0x53da1f]){handleError(_0x217ec4['data'][_0x53da1f],_0x217ec4[_0xb804('0x3e')][_0x53da1f]);}else{var _0x5afd93=[];for(var _0x548090 in _0x1f9fc6){if(_0x1f9fc6[_0xb804('0x51')](_0x548090)){if(_0x217ec4[_0xb804('0x52')][_0x53da1f][_0x1f9fc6[_0x548090]]){var _0x58138c=_[_0xb804('0x53')](_0x217ec4[_0xb804('0x52')][_0x53da1f][_0x1f9fc6[_0x548090]]['replace'](/"/g,'\x27'));switch(_0x548090){case _0xb804('0x1a'):var _0x57789c=moment(_0x58138c,_0xb804('0x54'),!![]);if(_0x57789c[_0xb804('0x55')]()){_0x483ce0[_0xb804('0x3f')]('\x22'+_0x58138c+'\x22');}else{_0x5afd93['push'](_0xb804('0x56'));}break;case _0xb804('0x1d'):var _0x162ce0=parseInt(_0x58138c);_0x58138c=_[_0xb804('0x57')](_0x162ce0)||_0x162ce0<0x0||_0x162ce0>0x4?_0x9ae2b6?0x3:0x2:_0x162ce0;_0x483ce0[_0xb804('0x3f')]('\x22'+_0x58138c+'\x22');break;case _0xb804('0x1e'):var _0x22fd2d=parseInt(_0x58138c);if(_[_0xb804('0x58')](_0x22fd2d)&&_[_0xb804('0x59')](_0x13883e,_0x22fd2d)){_0x483ce0[_0xb804('0x3f')]('\x22'+_0x22fd2d+'\x22');}else{_0x5afd93[_0xb804('0x3f')](_0xb804('0x5a'));}break;case'email':if(isEmail(_0x58138c)){_0x483ce0[_0xb804('0x3f')]('\x22'+_0x58138c+'\x22');}else{_0x5afd93[_0xb804('0x3f')](_0xb804('0x5b'));}break;case _0xb804('0x5c'):var _0x19d60d=moment(_0x58138c,_0xb804('0x5d'),!![]);if(_0x19d60d[_0xb804('0x55')]()){_0x483ce0[_0xb804('0x3f')]('\x22'+_0x58138c+'\x22');}else{_0x5afd93[_0xb804('0x3f')](_0xb804('0x5e'));}break;default:_0x483ce0[_0xb804('0x3f')]('\x22'+_0x58138c+'\x22');}}else{switch(_0x548090){case _0xb804('0x5f'):case'phone':_0x5afd93[_0xb804('0x3f')](_0x548090+_0xb804('0x60'));break;default:_0x483ce0[_0xb804('0x3f')]('\x22\x22');}}}}if(_0x5afd93[_0xb804('0x61')]){handleError(_0x217ec4[_0xb804('0x52')][_0x53da1f],{'code':'SystemRow','message':_0x5afd93[_0xb804('0x10')]()});}else{fs[_0xb804('0x62')](_0x552cd2,_0x483ce0[_0xb804('0x10')]()+'\x0a');}_0x483ce0=[];}if(!(stats[_0xb804('0x50')]%0xc8)){socket[_0xb804('0x63')]('contact:import:'+_0x586529,stats);stats[_0xb804('0x3e')]=[];}}if(stopped){logger[_0xb804('0x41')](_0xb804('0x64'));_0x52f93c[_0xb804('0x65')]();}}catch(_0x2ca578){handleError(_0x217ec4[_0xb804('0x52')][_0x53da1f],{'code':_0xb804('0x66'),'message':_0x2ca578[_0xb804('0x3c')]});logger[_0xb804('0x3b')]('step',_0x2ca578[_0xb804('0x3c')]);}},'complete':function(){try{var _0x241ac5=[];var _0x4b4983='cm_contacts';if(_0x4cb446[_0xb804('0x67')]&&_0x4cb446[_0xb804('0x67')]['length']){_0x4b4983=_0xb804('0x68')+_0x586529;_0x241ac5['push'](_0xb804('0x69')+_0x4b4983+_0xb804('0x6a'));}var _0x5376a3=util[_0xb804('0xc')](_0xb804('0x6b'),_0x552cd2,_0x4b4983,_0x3b48f2,_0x4cb446['ListId'],_0x4cb446[_0xb804('0x35')]||null,NOW,NOW);if(_['isNil'](_0x1f9fc6[_0xb804('0x1a')])){_0x5376a3+=_0xb804('0x6c');}_0x241ac5['push'](_0x5376a3);if(_0x4cb446['duplicates']&&_0x4cb446[_0xb804('0x67')][_0xb804('0x61')]){_0x241ac5[_0xb804('0x3f')](insertCmContact(_0x4cb446['ListId'],_0x4b4983,_0x4cb446[_0xb804('0x67')],_0x1f9fc6));_0x241ac5[_0xb804('0x3f')](_0xb804('0x6d')+_0x4b4983+';');}_0x241ac5[_0xb804('0x3f')](insertCmHopper(_0x4cb446[_0xb804('0x2f')],_0xb804('0x6e'),_0xb804('0x6f'),'VoiceQueueId',_0x9ae2b6));_0x241ac5[_0xb804('0x3f')](insertCmHopperBlack(_0x4cb446[_0xb804('0x2f')],_0xb804('0x70'),_0xb804('0x6f'),'VoiceQueueId'));_0x241ac5[_0xb804('0x3f')](insertCmHopper(_0x4cb446[_0xb804('0x2f')],_0xb804('0x71'),_0xb804('0x72'),'CampaignId',_0x9ae2b6));_0x241ac5['push'](insertCmHopperBlack(_0x4cb446[_0xb804('0x2f')],'campaigns_has_cm_blacklists',_0xb804('0x72'),_0xb804('0x73')));BPromise['each'](_0x241ac5,handleQuery)[_0xb804('0x74')](function(_0x2b6efa){stats['finish']=!![];stats[_0xb804('0x75')]=_0x4cb446[_0xb804('0x67')]&&_0x4cb446[_0xb804('0x67')]['length']?results[0x2][_0xb804('0x75')]:results[0x0]['affectedRows'];socket[_0xb804('0x63')](_0xb804('0x76')+_0x586529,stats);fs[_0xb804('0x77')](_0x3b9718);fs[_0xb804('0x77')](_0x552cd2);process[_0xb804('0x3d')](0x0);})[_0xb804('0x78')](function(_0x2a127a){logger[_0xb804('0x3b')](_0x2a127a[_0xb804('0x3c')]);process['exit'](0x1);});}catch(_0x3c8afa){logger[_0xb804('0x3b')](_0xb804('0x79'),_0x3c8afa['message']);process[_0xb804('0x3d')](0x1);}},'error':function(_0xf238f7,_0x49ec98,_0xbea19f,_0x5923d5){throw new Error(_0x5923d5);}});}function validate(){if(process[_0xb804('0x7a')]&&process['argv'][_0xb804('0x61')]<0x4){throw new Error(_0xb804('0x7b'));}var _0x55e028=path[_0xb804('0x10')](config['root'],_0xb804('0x7c'),process['argv'][0x2]);if(!fs[_0xb804('0x7d')](_0x55e028)){throw new Error(_0xb804('0x7e'));}var _0x412deb={};try{_0x412deb=JSON['parse'](process[_0xb804('0x7a')][0x3]);if(!_0x412deb[_0xb804('0x49')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x412deb[_0xb804('0x49')][_0xb804('0x19')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x412deb['binding'][_0xb804('0x5f')]){throw new Error(_0xb804('0x7f'));}var _0x1719d0=0x0;if(_0x412deb['binding']['UserId']){_0x1719d0=0x1;}if(!_0x412deb['ListId']){throw new Error(_0xb804('0x80'));}}catch(_0x3b8bb9){throw new Error(_0xb804('0x81'));}var _0x114d88=[];try{_0x114d88=_[_0xb804('0x82')](JSON[_0xb804('0x83')](process[_0xb804('0x7a')][0x4]),'id');}catch(_0x16dc84){logger['info'](_0xb804('0x84'));}main(_0x55e028,_0x412deb,_0x114d88,_0x1719d0);}validate();process['on'](_0xb804('0x85'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index e4dd94e..38a9a2e 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0290=['UniqueId','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','agentcalledAt','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime','outbound','***\x20Call\x20Info\x20***','Member\x20Name','membername','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','billableseconds','getSubjects','string','toLowerCase','inbound','push','queue','variable','destcalleridnum','voice','calleridnum','keyValue','Caller\x20Name','calleridname','Call\x20To','Queue'];(function(_0x143a73,_0x540ecb){var _0x5d7710=function(_0x2a3dfc){while(--_0x2a3dfc){_0x143a73['push'](_0x143a73['shift']());}};_0x5d7710(++_0x540ecb);}(_0x0290,0x69));var _0x0029=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x0290[_0x1e7b16];return _0x37fadc;};'use strict';exports[_0x0029('0x0')]=function(_0x8dbaa6,_0x53da3c){var _0x337d24=[{'type':_0x0029('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x8dbaa6[_0x0029('0x2')]()){case'voice':switch(_0x53da3c['toLowerCase']()){case _0x0029('0x3'):_0x337d24[_0x0029('0x4')]({'type':'variable','content':'','variableName':_0x0029('0x5')});_0x337d24[_0x0029('0x4')]({'type':_0x0029('0x6'),'content':'','variableName':'calleridnum'});break;case'outbound':_0x337d24[_0x0029('0x4')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x337d24[_0x0029('0x4')]({'type':_0x0029('0x6'),'content':'','variableName':_0x0029('0x7')});break;}}return _0x337d24;};exports['getDescriptions']=function(_0x3026a4,_0x320e95){var _0x28180a=[];switch(_0x3026a4[_0x0029('0x2')]()){case _0x0029('0x8'):switch(_0x320e95['toLowerCase']()){case _0x0029('0x3'):_0x28180a=[{'type':'string','content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Caller\x20Number','keyType':_0x0029('0x6'),'variableName':_0x0029('0x9')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0xb'),'keyType':_0x0029('0x6'),'variableName':_0x0029('0xc')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0xd'),'keyType':_0x0029('0x6'),'variableName':'destexten'},{'type':'keyValue','content':'','key':_0x0029('0xe'),'keyType':_0x0029('0x6'),'variableName':_0x0029('0x5')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0xf'),'keyType':_0x0029('0x6'),'variableName':_0x0029('0x10')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x11'),'keyType':_0x0029('0x6'),'variableName':'agentcalledAt'},{'type':_0x0029('0x1'),'content':_0x0029('0x12'),'key':null,'keyType':null,'variableName':null},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x13'),'keyType':'variable','variableName':_0x0029('0x14')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x15'),'keyType':'variable','variableName':_0x0029('0x7')},{'type':'string','content':_0x0029('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x0029('0xa'),'content':'','key':'Agent\x20Ring','keyType':'variable','variableName':_0x0029('0x17')},{'type':_0x0029('0xa'),'content':'','key':'Agent\x20Connect','keyType':_0x0029('0x6'),'variableName':_0x0029('0x18')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x19'),'keyType':_0x0029('0x6'),'variableName':_0x0029('0x1a')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x1b'),'keyType':'variable','variableName':_0x0029('0x1c')},{'type':_0x0029('0xa'),'content':'','key':'Talk\x20Time','keyType':_0x0029('0x6'),'variableName':_0x0029('0x1d')}];break;case _0x0029('0x1e'):_0x28180a=[{'type':_0x0029('0x1'),'content':_0x0029('0x1f'),'variableName':null},{'type':_0x0029('0xa'),'content':'','key':'Called\x20Number','keyType':_0x0029('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x20'),'keyType':_0x0029('0x6'),'keyContent':'','variableName':_0x0029('0x21')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0xf'),'keyType':_0x0029('0x6'),'keyContent':'','variableName':'uniqueid'},{'type':_0x0029('0xa'),'content':'','key':'Date','keyType':_0x0029('0x6'),'keyContent':'','variableName':_0x0029('0x22')},{'type':_0x0029('0x1'),'content':_0x0029('0x16')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x23'),'keyType':_0x0029('0x6'),'keyContent':'','variableName':'answertime'},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x24'),'keyType':_0x0029('0x6'),'keyContent':'','variableName':_0x0029('0x25')},{'type':_0x0029('0xa'),'content':'','key':_0x0029('0x26'),'keyType':_0x0029('0x6'),'keyContent':'','variableName':'duration'},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':_0x0029('0x6'),'keyContent':'','variableName':_0x0029('0x27')}];break;}}return _0x28180a;}; \ No newline at end of file +var _0xfdd1=['Caller\x20Name','calleridname','Call\x20To','destexten','UniqueId','uniqueid','Date','agentcalledAt','string','destcalleridname','Agent\x20Number','agentconnectAt','Agent\x20Complete','Talk\x20Time','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','***\x20Time\x20Info\x20***','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','voice','inbound','push','queue','variable','calleridnum','outbound','Outbound\x20Call','destcalleridnum','toLowerCase','keyValue'];(function(_0x1cff83,_0x2ad682){var _0x46f7e6=function(_0x18c80b){while(--_0x18c80b){_0x1cff83['push'](_0x1cff83['shift']());}};_0x46f7e6(++_0x2ad682);}(_0xfdd1,0x93));var _0x1fdd=function(_0x1a9f6f,_0x73e636){_0x1a9f6f=_0x1a9f6f-0x0;var _0x38ae40=_0xfdd1[_0x1a9f6f];return _0x38ae40;};'use strict';exports[_0x1fdd('0x0')]=function(_0x2612bb,_0x55e149){var _0x50a498=[{'type':'string','content':_0x1fdd('0x1'),'variableName':null}];switch(_0x2612bb['toLowerCase']()){case _0x1fdd('0x2'):switch(_0x55e149['toLowerCase']()){case _0x1fdd('0x3'):_0x50a498[_0x1fdd('0x4')]({'type':'variable','content':'','variableName':_0x1fdd('0x5')});_0x50a498['push']({'type':_0x1fdd('0x6'),'content':'','variableName':_0x1fdd('0x7')});break;case _0x1fdd('0x8'):_0x50a498['push']({'type':'string','content':_0x1fdd('0x9'),'variableName':null});_0x50a498[_0x1fdd('0x4')]({'type':_0x1fdd('0x6'),'content':'','variableName':_0x1fdd('0xa')});break;}}return _0x50a498;};exports['getDescriptions']=function(_0x5c477e,_0x37407a){var _0x2e50c1=[];switch(_0x5c477e[_0x1fdd('0xb')]()){case _0x1fdd('0x2'):switch(_0x37407a[_0x1fdd('0xb')]()){case'inbound':_0x2e50c1=[{'type':'string','content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x1fdd('0xc'),'content':'','key':'Caller\x20Number','keyType':_0x1fdd('0x6'),'variableName':_0x1fdd('0x7')},{'type':'keyValue','content':'','key':_0x1fdd('0xd'),'keyType':_0x1fdd('0x6'),'variableName':_0x1fdd('0xe')},{'type':_0x1fdd('0xc'),'content':'','key':_0x1fdd('0xf'),'keyType':_0x1fdd('0x6'),'variableName':_0x1fdd('0x10')},{'type':_0x1fdd('0xc'),'content':'','key':'Queue','keyType':'variable','variableName':_0x1fdd('0x5')},{'type':_0x1fdd('0xc'),'content':'','key':_0x1fdd('0x11'),'keyType':_0x1fdd('0x6'),'variableName':_0x1fdd('0x12')},{'type':_0x1fdd('0xc'),'content':'','key':_0x1fdd('0x13'),'keyType':_0x1fdd('0x6'),'variableName':_0x1fdd('0x14')},{'type':_0x1fdd('0x15'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':_0x1fdd('0x6'),'variableName':_0x1fdd('0x16')},{'type':'keyValue','content':'','key':_0x1fdd('0x17'),'keyType':'variable','variableName':_0x1fdd('0xa')},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':'variable','variableName':_0x1fdd('0x14')},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':_0x1fdd('0x6'),'variableName':_0x1fdd('0x18')},{'type':_0x1fdd('0xc'),'content':'','key':_0x1fdd('0x19'),'keyType':'variable','variableName':'agentcompleteAt'},{'type':_0x1fdd('0xc'),'content':'','key':'Hold\x20Time','keyType':_0x1fdd('0x6'),'variableName':'holdtime'},{'type':'keyValue','content':'','key':_0x1fdd('0x1a'),'keyType':'variable','variableName':'talktime'}];break;case _0x1fdd('0x8'):_0x2e50c1=[{'type':'string','content':_0x1fdd('0x1b'),'variableName':null},{'type':_0x1fdd('0xc'),'content':'','key':_0x1fdd('0x1c'),'keyType':_0x1fdd('0x6'),'keyContent':'','variableName':_0x1fdd('0xa')},{'type':'keyValue','content':'','key':_0x1fdd('0x1d'),'keyType':_0x1fdd('0x6'),'keyContent':'','variableName':_0x1fdd('0x1e')},{'type':_0x1fdd('0xc'),'content':'','key':_0x1fdd('0x11'),'keyType':_0x1fdd('0x6'),'keyContent':'','variableName':_0x1fdd('0x12')},{'type':_0x1fdd('0xc'),'content':'','key':_0x1fdd('0x13'),'keyType':_0x1fdd('0x6'),'keyContent':'','variableName':'starttime'},{'type':_0x1fdd('0x15'),'content':_0x1fdd('0x1f')},{'type':'keyValue','content':'','key':_0x1fdd('0x20'),'keyType':_0x1fdd('0x6'),'keyContent':'','variableName':_0x1fdd('0x21')},{'type':_0x1fdd('0xc'),'content':'','key':_0x1fdd('0x22'),'keyType':_0x1fdd('0x6'),'keyContent':'','variableName':_0x1fdd('0x23')},{'type':_0x1fdd('0xc'),'content':'','key':_0x1fdd('0x24'),'keyType':_0x1fdd('0x6'),'keyContent':'','variableName':_0x1fdd('0x25')},{'type':'keyValue','content':'','key':_0x1fdd('0x26'),'keyType':'variable','keyContent':'','variableName':_0x1fdd('0x27')}];break;}}return _0x2e50c1;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index f071011..b35d19b 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x134c=['sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','then','update','catch','error','tracked','user','clone','body','omit','html','phone','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions'];(function(_0x29ee0c,_0x283703){var _0x1904f8=function(_0x4ef781){while(--_0x4ef781){_0x29ee0c['push'](_0x29ee0c['shift']());}};_0x1904f8(++_0x283703);}(_0x134c,0x1ca));var _0xc134=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x134c[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0xc134('0x0'));var db=require(_0xc134('0x1'))['db'];var loggers={'openchannel':require(_0xc134('0x2'))(_0xc134('0x3')),'mail':require(_0xc134('0x2'))(_0xc134('0x4')),'fax':require(_0xc134('0x2'))(_0xc134('0x5')),'sms':require(_0xc134('0x2'))(_0xc134('0x6')),'chat':require(_0xc134('0x2'))(_0xc134('0x7')),'whatsapp':require(_0xc134('0x2'))(_0xc134('0x8'))};function getInteractionId(_0x4133db,_0x5827d7,_0x1a0c6a){if(_0x4133db&&_0x4133db[_[_0xc134('0x9')](_0x1a0c6a)+_0xc134('0xa')]){return _0x4133db[_[_0xc134('0x9')](_0x1a0c6a)+'InteractionId'];}else if(_0x4133db&&_0x4133db['id']){return _0x4133db['id'];}else if(_0x5827d7&&_0x5827d7['id']){return _0x5827d7['id'];}else{return'unknown';}}function log(_0x4e3135,_0x407f0c,_0x1f3b59,_0x385cf2,_0x3a0ef6,_0x562287){loggers[_0x3a0ef6[_0xc134('0xb')]()][_0x4e3135](_0xc134('0xc'),_0x562287[_0xc134('0xd')](),_0x407f0c?_0x407f0c['id']:null,_0x407f0c?_0x407f0c[_0xc134('0xe')]:null,_0x407f0c?_0x407f0c['role']:null,getInteractionId(_0x1f3b59,_0x385cf2,_0x3a0ef6),_0x1f3b59?JSON[_0xc134('0xf')](_0x1f3b59):_0xc134('0x10'));}function updateUser(_0x587e78,_0x44c701,_0x19a010,_0x4de881,_0x32745d){db[_[_0xc134('0x9')](_0x4de881)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x44c701,_0x19a010,_0x4de881)}})[_0xc134('0x11')](function(_0x5a705a){if(_0x5a705a){return _0x5a705a[_0xc134('0x12')]({'UserId':_0x587e78?_0x587e78['id']:null});}})[_0xc134('0x11')](function(_0x36adbd){if(_0x36adbd){log('info',_0x587e78,_0x44c701,_0x19a010,_0x4de881,_0x32745d);}})[_0xc134('0x13')](function(){log(_0xc134('0x14'),_0x587e78,_0x44c701,_0x19a010,_0x4de881,_0x32745d);});}exports[_0xc134('0x15')]=function(_0x262361,_0x1e5cb4){return function(_0x5ce8b9,_0x2d10c0,_0x5085ec){var _0x9efe12=_0x5ce8b9[_0xc134('0x16')];var _0xa7d678={};var _0x4fac22=_0x5ce8b9['query'];if(_0xa7d678){_0xa7d678=_[_0xc134('0x17')](_0x5ce8b9[_0xc134('0x18')]);_0xa7d678=_[_0xc134('0x19')](_0xa7d678,[_0xc134('0x18'),_0xc134('0x1a'),_0xc134('0x1b'),'fax',_0xc134('0x1c')]);}updateUser(_0x9efe12,_0xa7d678,_0x4fac22,_0x262361,_0x1e5cb4);_0x5085ec(null);};}; \ No newline at end of file +var _0xd360=['catch','error','tracked','query','clone','body','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','null','Interaction','findOne','then','update','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd360,0x94));var _0x0d36=function(_0x41e923,_0x4a5b9b){_0x41e923=_0x41e923-0x0;var _0x3e04cb=_0xd360[_0x41e923];return _0x3e04cb;};'use strict';var _=require(_0x0d36('0x0'));var db=require(_0x0d36('0x1'))['db'];var loggers={'openchannel':require(_0x0d36('0x2'))(_0x0d36('0x3')),'mail':require(_0x0d36('0x2'))(_0x0d36('0x4')),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0x0d36('0x2'))('sms-interactions'),'chat':require(_0x0d36('0x2'))(_0x0d36('0x5')),'whatsapp':require(_0x0d36('0x2'))(_0x0d36('0x6'))};function getInteractionId(_0x37397a,_0x38df6b,_0x4c028a){if(_0x37397a&&_0x37397a[_[_0x0d36('0x7')](_0x4c028a)+_0x0d36('0x8')]){return _0x37397a[_['upperFirst'](_0x4c028a)+_0x0d36('0x8')];}else if(_0x37397a&&_0x37397a['id']){return _0x37397a['id'];}else if(_0x38df6b&&_0x38df6b['id']){return _0x38df6b['id'];}else{return _0x0d36('0x9');}}function log(_0x552c21,_0x41a3a5,_0x5f6b1e,_0x59051c,_0x363fe6,_0xb8a491){loggers[_0x363fe6[_0x0d36('0xa')]()][_0x552c21](_0x0d36('0xb'),_0xb8a491['toUpperCase'](),_0x41a3a5?_0x41a3a5['id']:null,_0x41a3a5?_0x41a3a5[_0x0d36('0xc')]:null,_0x41a3a5?_0x41a3a5[_0x0d36('0xd')]:null,getInteractionId(_0x5f6b1e,_0x59051c,_0x363fe6),_0x5f6b1e?JSON['stringify'](_0x5f6b1e):_0x0d36('0xe'));}function updateUser(_0x80a538,_0x60fa9f,_0x457a16,_0x1a6cd0,_0x187723){db[_['upperFirst'](_0x1a6cd0)+_0x0d36('0xf')][_0x0d36('0x10')]({'where':{'id':getInteractionId(_0x60fa9f,_0x457a16,_0x1a6cd0)}})[_0x0d36('0x11')](function(_0x26ce6a){if(_0x26ce6a){return _0x26ce6a[_0x0d36('0x12')]({'UserId':_0x80a538?_0x80a538['id']:null});}})[_0x0d36('0x11')](function(_0x365bb3){if(_0x365bb3){log(_0x0d36('0x13'),_0x80a538,_0x60fa9f,_0x457a16,_0x1a6cd0,_0x187723);}})[_0x0d36('0x14')](function(){log(_0x0d36('0x15'),_0x80a538,_0x60fa9f,_0x457a16,_0x1a6cd0,_0x187723);});}exports[_0x0d36('0x16')]=function(_0x3bf9ee,_0x492c36){return function(_0x59404c,_0x42c2b6,_0x350689){var _0x486d0e=_0x59404c['user'];var _0x4db76a={};var _0x4b9004=_0x59404c[_0x0d36('0x17')];if(_0x4db76a){_0x4db76a=_[_0x0d36('0x18')](_0x59404c[_0x0d36('0x19')]);_0x4db76a=_['omit'](_0x4db76a,[_0x0d36('0x19'),'html','phone',_0x0d36('0x1a'),_0x0d36('0x1b')]);}updateUser(_0x486d0e,_0x4db76a,_0x4b9004,_0x3bf9ee,_0x492c36);_0x350689(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 13d35ae..93dd642 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 _0x4439=['split','format','update','base64','final','parse','use','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','data1','license'];(function(_0x182ab1,_0x1e1378){var _0x1c51c4=function(_0x402684){while(--_0x402684){_0x182ab1['push'](_0x182ab1['shift']());}};_0x1c51c4(++_0x1e1378);}(_0x4439,0x1c9));var _0x9443=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0x4439[_0x4c1ec2];return _0x3f6f1c;};'use strict';var crypto=require(_0x9443('0x0'));var util=require(_0x9443('0x1'));var compose=require(_0x9443('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x481b6d,_0x22ff4d){if(_0x481b6d&&_0x22ff4d){if(_0x22ff4d[_0x9443('0x3')]&&_0x22ff4d['license']){var _0x249349=_0x22ff4d[_0x9443('0x3')];var _0x5d1a28=_0x22ff4d[_0x9443('0x4')];var _0x553cba=_0x249349[_0x9443('0x5')]('-')[0x4];var _0x569b31=_0x249349[_0x9443('0x5')]('-')[0x0];var _0x33f342=crypto['createDecipher']('aes-256-ctr',util[_0x9443('0x6')]('%s:%s:%s',_0x553cba,_0x249349,_0x569b31));var _0x518bef=_0x33f342[_0x9443('0x7')](_0x5d1a28,_0x9443('0x8'),'utf8');_0x518bef+=_0x33f342[_0x9443('0x9')]('utf8');var _0x4929e6=JSON[_0x9443('0xa')](_0x518bef);return _0x4929e6['hasOwnProperty'](_0x481b6d)?_0x4929e6[_0x481b6d]:null;}}return null;}function isLimit(_0x4fcb49,_0x3f91b6,_0xd2b9ba,_0x5bb1b8){var _0x32b880=_0x3f91b6;return compose()[_0x9443('0xb')](function(_0x34696c,_0x1457c7,_0x3c355a){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0x9443('0xc')](function(_0x5b4a77){var _0x41bcde=getValueFromLicense(_0x4fcb49,_0x5b4a77);return _0x41bcde?_0x41bcde:_0x32b880;})[_0x9443('0xc')](function(_0x2cf3c4){_0x32b880=_0x2cf3c4;return _0xd2b9ba[_0x9443('0xd')](_0x5bb1b8);})['then'](function(_0x4836f2){if(_0x4836f2>=_0x32b880){return _0x1457c7['status'](0x193)[_0x9443('0xe')]({'message':util[_0x9443('0x6')](_0x9443('0xf'),_0x4fcb49)});}_0x3c355a();})[_0x9443('0x10')](function(_0x4f1913){_0x3c355a(_0x4f1913);});});}function isUserLimit(){return isLimit(_0x9443('0x11'),0x1,db[_0x9443('0x12')],{'where':{'$or':[{'role':_0x9443('0x13')},{'role':_0x9443('0x14')}]}});}exports[_0x9443('0x15')]=isUserLimit; \ No newline at end of file +var _0x9c9b=['data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','hasOwnProperty','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment'];(function(_0x518838,_0x585fbf){var _0x46fe3d=function(_0x1f3014){while(--_0x1f3014){_0x518838['push'](_0x518838['shift']());}};_0x46fe3d(++_0x585fbf);}(_0x9c9b,0x194));var _0xb9c9=function(_0x51be89,_0x488eec){_0x51be89=_0x51be89-0x0;var _0x47033a=_0x9c9b[_0x51be89];return _0x47033a;};'use strict';var crypto=require('crypto');var util=require(_0xb9c9('0x0'));var compose=require(_0xb9c9('0x1'));var db=require(_0xb9c9('0x2'))['db'];var config=require(_0xb9c9('0x3'));function getValueFromLicense(_0x74a16d,_0x581c9a){if(_0x74a16d&&_0x581c9a){if(_0x581c9a[_0xb9c9('0x4')]&&_0x581c9a[_0xb9c9('0x5')]){var _0x4f800e=_0x581c9a['data1'];var _0x599e45=_0x581c9a[_0xb9c9('0x5')];var _0x26bf07=_0x4f800e[_0xb9c9('0x6')]('-')[0x4];var _0x3ccb91=_0x4f800e[_0xb9c9('0x6')]('-')[0x0];var _0x9dc3da=crypto[_0xb9c9('0x7')](_0xb9c9('0x8'),util[_0xb9c9('0x9')](_0xb9c9('0xa'),_0x26bf07,_0x4f800e,_0x3ccb91));var _0x286ad3=_0x9dc3da[_0xb9c9('0xb')](_0x599e45,_0xb9c9('0xc'),'utf8');_0x286ad3+=_0x9dc3da['final'](_0xb9c9('0xd'));var _0x1cf4b5=JSON[_0xb9c9('0xe')](_0x286ad3);return _0x1cf4b5[_0xb9c9('0xf')](_0x74a16d)?_0x1cf4b5[_0x74a16d]:null;}}return null;}function isLimit(_0x1a1c86,_0x5a2153,_0x4ff664,_0x5ce530){var _0x254f03=_0x5a2153;return compose()['use'](function(_0x524773,_0xc46ca3,_0x4d1566){return db['License'][_0xb9c9('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xb9c9('0x11')](function(_0x40e6a4){var _0x54721e=getValueFromLicense(_0x1a1c86,_0x40e6a4);return _0x54721e?_0x54721e:_0x254f03;})[_0xb9c9('0x11')](function(_0x1af04b){_0x254f03=_0x1af04b;return _0x4ff664[_0xb9c9('0x12')](_0x5ce530);})[_0xb9c9('0x11')](function(_0x13abaf){if(_0x13abaf>=_0x254f03){return _0xc46ca3['status'](0x193)[_0xb9c9('0x13')]({'message':util[_0xb9c9('0x9')](_0xb9c9('0x14'),_0x1a1c86)});}_0x4d1566();})['catch'](function(_0x5b9586){_0x4d1566(_0x5b9586);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':_0xb9c9('0x15')},{'role':_0xb9c9('0x16')}]}});}exports[_0xb9c9('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 63cc793..964aff0 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 _0xf2f0=['pop','utcOffset','format','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','replace','[$or]','length','split','slice','forEach','shift','indexOf','conditions','buildExpression','DATE','$eq','$between','value','includes','$gt','$lte','add','days','castTo','text','CAST(','field','\x20AS\x20','operator','$notIn','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','$lt','<\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xf2f0,0x1d0));var _0x0f2f=function(_0x4d20c0,_0x33210c){_0x4d20c0=_0x4d20c0-0x0;var _0x1afcc3=_0xf2f0[_0x4d20c0];return _0x1afcc3;};'use strict';var _=require(_0x0f2f('0x0'));var moment=require(_0x0f2f('0x1'));exports[_0x0f2f('0x2')]=function(_0x1b568d){var _0x9ba9eb={'conditions':[]};_0x9ba9eb[_0x0f2f('0x3')]=_[_0x0f2f('0x4')](_0x1b568d,'[$or]')?'or':'and';var _0x210316=_0x1b568d[_0x0f2f('0x5')]('[$and]','')[_0x0f2f('0x5')](_0x0f2f('0x6'),'')['split']('||');for(var _0x3f2bbb=0x0;_0x3f2bbb<_0x210316[_0x0f2f('0x7')];_0x3f2bbb++){var _0x4c4b87=_0x210316[_0x3f2bbb][_0x0f2f('0x8')](':=');var _0x1f8035=_0x4c4b87[0x0];var _0x58f2ee=_0x4c4b87[_0x0f2f('0x9')](0x1);_0x58f2ee[_0x0f2f('0xa')](function(_0x1e0406){var _0x1b3903=_0x1e0406[_0x0f2f('0x8')]('[')[_0x0f2f('0xb')]();var _0x207c00=_0x1e0406['match'](/\[(.*?)\]/g);_0x207c00['forEach'](function(_0x620b67){var _0x34d765=_0x620b67[_0x0f2f('0x8')]('[')['filter'](function(_0x33f51d){return _0x33f51d[_0x0f2f('0xc')](']')>-0x1;})['map'](function(_0xf69ffd){return _0xf69ffd[_0x0f2f('0x8')](']')[0x0];})[0x0];_0x9ba9eb[_0x0f2f('0xd')]['push']({'field':_0x1f8035,'operator':_0x1b3903,'value':_0x34d765});});});}return _0x9ba9eb;};exports[_0x0f2f('0xe')]=function(_0x52c2ff,_0x7addf5,_0x1b09f4){var _0x1095a0={};if(_0x7addf5===_0x0f2f('0xf')){if(_0x1b09f4['operator']===_0x0f2f('0x10')){_0x1b09f4['operator']=_0x0f2f('0x11');_0x1b09f4['value']+=','+_0x1b09f4[_0x0f2f('0x12')];}else if(_[_0x0f2f('0x13')]([_0x0f2f('0x14'),_0x0f2f('0x15')],_0x1b09f4['operator'])){_0x1b09f4['value']=moment(_0x1b09f4[_0x0f2f('0x12')])[_0x0f2f('0x16')](0x1,_0x0f2f('0x17'))['format']('YYYY-MM-DD');}}if(_0x1b09f4[_0x0f2f('0x18')]){_0x7addf5=_0x1b09f4[_0x0f2f('0x18')];_0x1095a0[_0x0f2f('0x19')]=_0x0f2f('0x1a')+_0x52c2ff+'.'+_0x1b09f4[_0x0f2f('0x1b')]+_0x0f2f('0x1c')+_0x1b09f4[_0x0f2f('0x18')]+')\x20'+parseOperator(_0x1b09f4[_0x0f2f('0x1d')]);}else{_0x1095a0['text']=_0x52c2ff+'.'+_0x1b09f4['field']+'\x20'+parseOperator(_0x1b09f4[_0x0f2f('0x1d')]);}if(_[_0x0f2f('0x13')](['$ne',_0x0f2f('0x1e')],_0x1b09f4[_0x0f2f('0x1d')]))_0x1095a0[_0x0f2f('0x19')]='('+_0x1095a0[_0x0f2f('0x19')]+'\x20OR\x20'+_0x52c2ff+'.'+_0x1b09f4[_0x0f2f('0x1b')]+_0x0f2f('0x1f');_0x1095a0[_0x0f2f('0x12')]=parseValue(_0x7addf5,_0x1b09f4[_0x0f2f('0x1d')],_0x1b09f4[_0x0f2f('0x12')]);return _0x1095a0;};function parseOperator(_0x17cb25){var _0x36174b;switch(_0x17cb25){case _0x0f2f('0x20'):_0x36174b='IN\x20?';break;case'$notIn':_0x36174b=_0x0f2f('0x21');break;case _0x0f2f('0x10'):_0x36174b=_0x0f2f('0x22');break;case _0x0f2f('0x23'):_0x36174b=_0x0f2f('0x24');break;case _0x0f2f('0x25'):case _0x0f2f('0x26'):case'$endsWith':_0x36174b='LIKE\x20?';break;case _0x0f2f('0x27'):_0x36174b=_0x0f2f('0x28');break;case _0x0f2f('0x14'):_0x36174b='>\x20?';break;case _0x0f2f('0x15'):_0x36174b='<=\x20?';break;case _0x0f2f('0x29'):_0x36174b=_0x0f2f('0x2a');break;case _0x0f2f('0x11'):_0x36174b=_0x0f2f('0x2b');break;}return _0x36174b;}function parseValue(_0x11bd5d,_0x1a48d6,_0xb6040d){var _0x5db11e={'start':undefined,'end':undefined};switch(_0x1a48d6){case'$in':case'$notIn':_0x5db11e[_0x0f2f('0x2c')]=_0xb6040d[_0x0f2f('0x8')](',');break;case _0x0f2f('0x25'):_0x5db11e[_0x0f2f('0x2c')]='%'+_0xb6040d+'%';break;case _0x0f2f('0x26'):_0x5db11e[_0x0f2f('0x2c')]=_0xb6040d+'%';break;case _0x0f2f('0x2d'):_0x5db11e[_0x0f2f('0x2c')]='%'+_0xb6040d;break;case _0x0f2f('0x11'):var _0x27cd69=_0xb6040d['split'](',');var _0xb6040d=_0x27cd69['shift']();var _0xc8b984=_0x27cd69[_0x0f2f('0x2e')]();if(_0x11bd5d==='DATE'){_0xb6040d=moment(_0xb6040d)[_0x0f2f('0x2f')](0x0,!![])[_0x0f2f('0x30')]();_0xc8b984=moment(_0xc8b984)[_0x0f2f('0x2f')](0x0,!![])[_0x0f2f('0x16')](0x17,_0x0f2f('0x31'))[_0x0f2f('0x16')](0x3b,'minutes')['add'](0x3b,_0x0f2f('0x32'))['format']();}_0x5db11e={'start':_0xb6040d,'end':_0xc8b984};break;default:_0x5db11e['start']=_0xb6040d;break;}return _0x5db11e;} \ No newline at end of file +var _0xfd3a=['forEach','match','indexOf','map','conditions','buildExpression','operator','$eq','$between','value','$gt','$lte','add','days','format','castTo','CAST(','field','includes','text','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','$notIn','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','$gte','$in','start','shift','pop','DATE','utcOffset','hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','length','split','slice'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0xfd3a,0xc6));var _0xafd3=function(_0x4569fd,_0x44446e){_0x4569fd=_0x4569fd-0x0;var _0x1986cb=_0xfd3a[_0x4569fd];return _0x1986cb;};'use strict';var _=require(_0xafd3('0x0'));var moment=require(_0xafd3('0x1'));exports[_0xafd3('0x2')]=function(_0x4c9f1d){var _0x2ee75d={'conditions':[]};_0x2ee75d[_0xafd3('0x3')]=_[_0xafd3('0x4')](_0x4c9f1d,_0xafd3('0x5'))?'or':'and';var _0x3b53ec=_0x4c9f1d[_0xafd3('0x6')]('[$and]','')[_0xafd3('0x6')](_0xafd3('0x5'),'')['split']('||');for(var _0xe01138=0x0;_0xe01138<_0x3b53ec[_0xafd3('0x7')];_0xe01138++){var _0x3fcda5=_0x3b53ec[_0xe01138][_0xafd3('0x8')](':=');var _0x5dd81a=_0x3fcda5[0x0];var _0x1edb0e=_0x3fcda5[_0xafd3('0x9')](0x1);_0x1edb0e[_0xafd3('0xa')](function(_0x246cd4){var _0xfd2942=_0x246cd4[_0xafd3('0x8')]('[')['shift']();var _0x43cd87=_0x246cd4[_0xafd3('0xb')](/\[(.*?)\]/g);_0x43cd87[_0xafd3('0xa')](function(_0x1ba208){var _0x58d1c8=_0x1ba208[_0xafd3('0x8')]('[')['filter'](function(_0x2d779d){return _0x2d779d[_0xafd3('0xc')](']')>-0x1;})[_0xafd3('0xd')](function(_0x7a1d14){return _0x7a1d14[_0xafd3('0x8')](']')[0x0];})[0x0];_0x2ee75d[_0xafd3('0xe')]['push']({'field':_0x5dd81a,'operator':_0xfd2942,'value':_0x58d1c8});});});}return _0x2ee75d;};exports[_0xafd3('0xf')]=function(_0x412356,_0x481f48,_0x1a529b){var _0xaa01d7={};if(_0x481f48==='DATE'){if(_0x1a529b[_0xafd3('0x10')]===_0xafd3('0x11')){_0x1a529b[_0xafd3('0x10')]=_0xafd3('0x12');_0x1a529b[_0xafd3('0x13')]+=','+_0x1a529b[_0xafd3('0x13')];}else if(_['includes']([_0xafd3('0x14'),_0xafd3('0x15')],_0x1a529b[_0xafd3('0x10')])){_0x1a529b['value']=moment(_0x1a529b[_0xafd3('0x13')])[_0xafd3('0x16')](0x1,_0xafd3('0x17'))[_0xafd3('0x18')]('YYYY-MM-DD');}}if(_0x1a529b['castTo']){_0x481f48=_0x1a529b[_0xafd3('0x19')];_0xaa01d7['text']=_0xafd3('0x1a')+_0x412356+'.'+_0x1a529b['field']+'\x20AS\x20'+_0x1a529b[_0xafd3('0x19')]+')\x20'+parseOperator(_0x1a529b[_0xafd3('0x10')]);}else{_0xaa01d7['text']=_0x412356+'.'+_0x1a529b[_0xafd3('0x1b')]+'\x20'+parseOperator(_0x1a529b[_0xafd3('0x10')]);}if(_[_0xafd3('0x1c')](['$ne','$notIn'],_0x1a529b[_0xafd3('0x10')]))_0xaa01d7[_0xafd3('0x1d')]='('+_0xaa01d7[_0xafd3('0x1d')]+_0xafd3('0x1e')+_0x412356+'.'+_0x1a529b[_0xafd3('0x1b')]+_0xafd3('0x1f');_0xaa01d7[_0xafd3('0x13')]=parseValue(_0x481f48,_0x1a529b['operator'],_0x1a529b[_0xafd3('0x13')]);return _0xaa01d7;};function parseOperator(_0x5423ba){var _0x7536a2;switch(_0x5423ba){case'$in':_0x7536a2=_0xafd3('0x20');break;case _0xafd3('0x21'):_0x7536a2='NOT\x20IN\x20?';break;case _0xafd3('0x11'):_0x7536a2=_0xafd3('0x22');break;case _0xafd3('0x23'):_0x7536a2=_0xafd3('0x24');break;case _0xafd3('0x25'):case _0xafd3('0x26'):case _0xafd3('0x27'):_0x7536a2='LIKE\x20?';break;case _0xafd3('0x28'):_0x7536a2=_0xafd3('0x29');break;case _0xafd3('0x14'):_0x7536a2=_0xafd3('0x2a');break;case _0xafd3('0x15'):_0x7536a2='<=\x20?';break;case _0xafd3('0x2b'):_0x7536a2='>=\x20?';break;case _0xafd3('0x12'):_0x7536a2='BETWEEN\x20?\x20AND\x20?';break;}return _0x7536a2;}function parseValue(_0x34d70a,_0x369fde,_0x109031){var _0x44cc79={'start':undefined,'end':undefined};switch(_0x369fde){case _0xafd3('0x2c'):case'$notIn':_0x44cc79[_0xafd3('0x2d')]=_0x109031[_0xafd3('0x8')](',');break;case _0xafd3('0x25'):_0x44cc79['start']='%'+_0x109031+'%';break;case _0xafd3('0x26'):_0x44cc79[_0xafd3('0x2d')]=_0x109031+'%';break;case _0xafd3('0x27'):_0x44cc79[_0xafd3('0x2d')]='%'+_0x109031;break;case _0xafd3('0x12'):var _0x4a13f5=_0x109031['split'](',');var _0x109031=_0x4a13f5[_0xafd3('0x2e')]();var _0x518286=_0x4a13f5[_0xafd3('0x2f')]();if(_0x34d70a===_0xafd3('0x30')){_0x109031=moment(_0x109031)[_0xafd3('0x31')](0x0,!![])[_0xafd3('0x18')]();_0x518286=moment(_0x518286)[_0xafd3('0x31')](0x0,!![])[_0xafd3('0x16')](0x17,_0xafd3('0x32'))['add'](0x3b,_0xafd3('0x33'))['add'](0x3b,'seconds')[_0xafd3('0x18')]();}_0x44cc79={'start':_0x109031,'end':_0x518286};break;default:_0x44cc79[_0xafd3('0x2d')]=_0x109031;break;}return _0x44cc79;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 6d03f05..8e29df8 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 _0x48ad=['lower','merge','options','lodash','sequelize','parse','keys','fields','split','isEmpty','forOwn','find','type','isPlainObject','$gte','YYYY-MM-DD','utc','format','subtract','name','isArray','sort','map','indexOf','priority','unsigned','substr','DESC','cast','col','ASC','omit','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','push','join','getOptions','query','$id','model','intersection','attributes','limit','offset','order','where','filters','pick'];(function(_0x3712dd,_0x46da6d){var _0x5b2e4e=function(_0xe0b6b1){while(--_0xe0b6b1){_0x3712dd['push'](_0x3712dd['shift']());}};_0x5b2e4e(++_0x46da6d);}(_0x48ad,0xa5));var _0xd48a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x48ad[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd48a('0x0'));var sequelize=require(_0xd48a('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2d64e0){var _0x24e0b0=['ne'];try{var _0x54c470=JSON[_0xd48a('0x2')](_0x2d64e0);var _0x17f413=Object[_0xd48a('0x3')](_0x54c470)[0x0];return _0x24e0b0['includes'](_0x17f413);}catch(_0x55e4e2){return![];}}function getOperatorValue(_0x107986){var _0x566e32=JSON['parse'](_0x107986);var _0x369a1f=Object[_0xd48a('0x3')](_0x566e32)[0x0];var _0x190648=_0x566e32[_0x369a1f];return{['$'+_0x369a1f]:_0x190648};}exports[_0xd48a('0x4')]=function(_0x9a9301){var _0x1a15dc=null;if(_0x9a9301){_0x1a15dc=_0x9a9301[_0xd48a('0x5')](',');}return _0x1a15dc;};exports['filters']=function(_0x196777,_0x584a25){var _0x3382ba={};if(!_[_0xd48a('0x6')](_0x196777)){_[_0xd48a('0x7')](_0x196777,function(_0x3c0a62,_0x259391){try{if(_0x584a25){var _0x14c014=_[_0xd48a('0x8')](_0x584a25,{'name':_0x259391})||{};if(hasSequelizeOperator(_0x3c0a62)){_0x3382ba[_0x259391]=getOperatorValue(_0x3c0a62);}else if(_0x14c014[_0xd48a('0x9')]==='DATE'&&_[_0xd48a('0xa')](_0x3c0a62)){var _0x38a860=JSON[_0xd48a('0x2')](_0x3c0a62);var _0x327acf={'$gte':moment(moment(_0x38a860[_0xd48a('0xb')])['format'](_0xd48a('0xc')))[_0xd48a('0xd')]()[_0xd48a('0xe')](),'$lte':moment(moment(_0x38a860['$lte'])[_0xd48a('0xe')]('YYYY-MM-DD'))[_0xd48a('0xd')]()[_0xd48a('0xf')](0x1,'s')[_0xd48a('0xe')]()};_0x3382ba[_0x259391]=_0x327acf;}else if(_0x14c014[_0xd48a('0x10')]==='uniqueid'){_0x3382ba[_0x259391]=_0x3c0a62;}else{_0x3382ba[_0x259391]=_[_0xd48a('0x11')](_0x3c0a62)?_0x3c0a62:JSON['parse'](_0x3c0a62);}}else{_0x3382ba[_0x259391]=_[_0xd48a('0x11')](_0x3c0a62)?_0x3c0a62:JSON[_0xd48a('0x2')](_0x3c0a62);}}catch(_0x3ae5c8){_0x3382ba[_0x259391]=_0x3c0a62[_0xd48a('0x5')](',');}});}return _0x3382ba;};exports['limit']=function(_0x16e9cd){_0x16e9cd=parseInt(_0x16e9cd,0xa);if(!_0x16e9cd||_0x16e9cd<0x0){_0x16e9cd=LIMIT_VALUE;}return _0x16e9cd;};exports['offset']=function(_0x11d3c1){_0x11d3c1=parseInt(_0x11d3c1,0xa);if(!_0x11d3c1||_0x11d3c1<0x0){_0x11d3c1=0x0;}return _0x11d3c1;};exports[_0xd48a('0x12')]=function(_0x276ff3){var _0x2c2c0c,_0x5256e3=null;if(_0x276ff3){_0x2c2c0c=_0x276ff3[_0xd48a('0x5')](',');_0x5256e3=_[_0xd48a('0x13')](_0x2c2c0c,function(_0x3f2033){if(_0x3f2033[_0xd48a('0x14')]('-')===0x0){return[_0x3f2033===_0xd48a('0x15')?sequelize['cast'](sequelize['col'](_0xd48a('0x15')),_0xd48a('0x16')):_0x3f2033[_0xd48a('0x17')](0x1),_0xd48a('0x18')];}else{return[_0x3f2033===_0xd48a('0x15')?sequelize[_0xd48a('0x19')](sequelize[_0xd48a('0x1a')](_0xd48a('0x15')),_0xd48a('0x16')):_0x3f2033,_0xd48a('0x1b')];}});}return _0x5256e3;};exports[_0xd48a('0x1c')]=function(_0x509393,_0x527034){if(_[_0xd48a('0x6')](_0x509393)){return _0x509393;}if(_[_0xd48a('0x11')](_0x509393)){for(var _0x19a75a=0x0;_0x19a75a<_0x509393[_0xd48a('0x1d')];_0x19a75a+=0x1){_0x509393[_0x19a75a]=this[_0xd48a('0x1c')](_0x509393[_0x19a75a],_0x527034);}return _0x509393;}if(!_[_0xd48a('0x1e')](_0x509393)){return _0x509393;}if(_[_0xd48a('0x1f')](_0x527034)){_0x527034=[_0x527034];}if(!_[_0xd48a('0x11')](_0x527034)){return _0x509393;}for(var _0x4dfacc=0x0;_0x4dfacc<_0x527034[_0xd48a('0x1d')];_0x4dfacc+=0x1){_[_0xd48a('0x20')](_0x509393,_0x527034[_0x4dfacc]);}for(var _0x4070ee in _0x509393){if(_0x509393['hasOwnProperty'](_0x4070ee)){_0x509393[_0x4070ee]=this['omit'](_0x509393[_0x4070ee],_0x527034);}}return _0x509393;};exports[_0xd48a('0x21')]=function(_0x5ce2bd){return _0x5ce2bd[_0xd48a('0x22')](RegExp(_0xd48a('0x23')))?!![]:![];};exports[_0xd48a('0x24')]=function(_0xad93f1){return _0xad93f1[_0xd48a('0x22')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x27e73f){var _0x38979d=[];_0x27e73f[_0xd48a('0x5')](/[ ,]+/)['forEach'](function(_0x429d7a){_0x429d7a=_0x429d7a['replace'](/([^:]")"+/g,'$1');_0x429d7a='+'+_0x429d7a+'*';if(_0x429d7a['includes']('@'))_0x429d7a='\x22'+_0x429d7a+'\x22';_0x38979d[_0xd48a('0x25')](_0x429d7a);});return _0x38979d[_0xd48a('0x26')]('\x20');};exports[_0xd48a('0x27')]=function(_0x3438af,_0x533323,_0x10c124){var _0x55059a={},_0x437ab3={};if(_0x533323[_0xd48a('0x28')][_0xd48a('0x29')]){_0x533323[_0xd48a('0x28')]['id']=_0x533323[_0xd48a('0x28')][_0xd48a('0x29')];delete _0x533323[_0xd48a('0x28')][_0xd48a('0x29')];}_0x55059a[_0xd48a('0x2a')]=_['map'](_0x3438af,_0xd48a('0x10'));_0x55059a[_0xd48a('0x28')]=_[_0xd48a('0x3')](_0x533323[_0xd48a('0x28')]);_0x55059a['filters']=_[_0xd48a('0x2b')](_0x55059a[_0xd48a('0x2a')],_0x55059a['query']);_0x437ab3[_0xd48a('0x2c')]=_[_0xd48a('0x2b')](_0x55059a[_0xd48a('0x2a')],this[_0xd48a('0x4')](_0x533323['query'][_0xd48a('0x4')]));_0x437ab3[_0xd48a('0x2c')]=_0x437ab3[_0xd48a('0x2c')]['length']?_0x437ab3[_0xd48a('0x2c')]:_0x55059a[_0xd48a('0x2a')];if(!_0x533323['query']['hasOwnProperty']('nolimit')){_0x437ab3['limit']=this['limit'](_0x533323[_0xd48a('0x28')][_0xd48a('0x2d')]);_0x437ab3[_0xd48a('0x2e')]=this[_0xd48a('0x2e')](_0x533323[_0xd48a('0x28')][_0xd48a('0x2e')]);}_0x437ab3[_0xd48a('0x2f')]=this[_0xd48a('0x12')](_0x533323[_0xd48a('0x28')][_0xd48a('0x12')]);_0x437ab3[_0xd48a('0x30')]=this[_0xd48a('0x31')](_[_0xd48a('0x32')](_0x533323[_0xd48a('0x28')],_0x55059a[_0xd48a('0x31')]),_0x3438af);if(_0x533323['query']['filter']){_0x437ab3['where']=_['merge'](_0x437ab3[_0xd48a('0x30')],{'$or':_[_0xd48a('0x13')](_0x3438af,function(_0x414dea){if(_0x414dea[_0xd48a('0x9')]!=='VIRTUAL'){if(_0x10c124){return sequelize[_0xd48a('0x30')](sequelize['fn'](_0xd48a('0x33'),sequelize['col'](_0x414dea[_0xd48a('0x10')])),{'$like':sequelize['fn'](_0xd48a('0x33'),'%'+_0x533323[_0xd48a('0x28')]['filter']+'%')});}else{var _0x3ca62b={};_0x3ca62b[_0x414dea['name']]={'$like':'%'+_0x533323[_0xd48a('0x28')]['filter']+'%'};return _0x3ca62b;}}})});}_0x437ab3=_[_0xd48a('0x34')]({},_0x437ab3,_0x533323[_0xd48a('0x35')]);return _0x437ab3;}; \ No newline at end of file +var _0x9f0b=['indexOf','priority','cast','unsigned','substr','ASC','isArray','length','omit','isObject','isString','unset','isNumeric','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','push','$id','query','model','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','lower','col','filter','options','sequelize','moment','parse','keys','includes','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','name','uniqueid','limit','offset','map'];(function(_0x416cdc,_0x213b87){var _0x1931ce=function(_0x1dc762){while(--_0x1dc762){_0x416cdc['push'](_0x416cdc['shift']());}};_0x1931ce(++_0x213b87);}(_0x9f0b,0x13f));var _0xb9f0=function(_0x4c98b9,_0x1ad11b){_0x4c98b9=_0x4c98b9-0x0;var _0x3a257a=_0x9f0b[_0x4c98b9];return _0x3a257a;};'use strict';var _=require('lodash');var sequelize=require(_0xb9f0('0x0'));var moment=require(_0xb9f0('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1b5639){var _0x22b0e9=['ne'];try{var _0x5ba5c6=JSON[_0xb9f0('0x2')](_0x1b5639);var _0x1795df=Object[_0xb9f0('0x3')](_0x5ba5c6)[0x0];return _0x22b0e9[_0xb9f0('0x4')](_0x1795df);}catch(_0xd150cc){return![];}}function getOperatorValue(_0x376320){var _0xde4aff=JSON[_0xb9f0('0x2')](_0x376320);var _0x1a809a=Object[_0xb9f0('0x3')](_0xde4aff)[0x0];var _0xded038=_0xde4aff[_0x1a809a];return{['$'+_0x1a809a]:_0xded038};}exports['fields']=function(_0x55dd3e){var _0x53c8a7=null;if(_0x55dd3e){_0x53c8a7=_0x55dd3e[_0xb9f0('0x5')](',');}return _0x53c8a7;};exports[_0xb9f0('0x6')]=function(_0xa33554,_0x296ff4){var _0x3b0b30={};if(!_[_0xb9f0('0x7')](_0xa33554)){_[_0xb9f0('0x8')](_0xa33554,function(_0x47f4f3,_0x413446){try{if(_0x296ff4){var _0x3432b1=_[_0xb9f0('0x9')](_0x296ff4,{'name':_0x413446})||{};if(hasSequelizeOperator(_0x47f4f3)){_0x3b0b30[_0x413446]=getOperatorValue(_0x47f4f3);}else if(_0x3432b1[_0xb9f0('0xa')]===_0xb9f0('0xb')&&_[_0xb9f0('0xc')](_0x47f4f3)){var _0x3aa283=JSON[_0xb9f0('0x2')](_0x47f4f3);var _0x4e50e5={'$gte':moment(moment(_0x3aa283[_0xb9f0('0xd')])[_0xb9f0('0xe')](_0xb9f0('0xf')))['utc']()[_0xb9f0('0xe')](),'$lte':moment(moment(_0x3aa283['$lte'])[_0xb9f0('0xe')](_0xb9f0('0xf')))[_0xb9f0('0x10')]()[_0xb9f0('0x11')](0x1,'s')[_0xb9f0('0xe')]()};_0x3b0b30[_0x413446]=_0x4e50e5;}else if(_0x3432b1[_0xb9f0('0x12')]===_0xb9f0('0x13')){_0x3b0b30[_0x413446]=_0x47f4f3;}else{_0x3b0b30[_0x413446]=_['isArray'](_0x47f4f3)?_0x47f4f3:JSON[_0xb9f0('0x2')](_0x47f4f3);}}else{_0x3b0b30[_0x413446]=_['isArray'](_0x47f4f3)?_0x47f4f3:JSON[_0xb9f0('0x2')](_0x47f4f3);}}catch(_0x38d053){_0x3b0b30[_0x413446]=_0x47f4f3['split'](',');}});}return _0x3b0b30;};exports[_0xb9f0('0x14')]=function(_0x2a0e16){_0x2a0e16=parseInt(_0x2a0e16,0xa);if(!_0x2a0e16||_0x2a0e16<0x0){_0x2a0e16=LIMIT_VALUE;}return _0x2a0e16;};exports[_0xb9f0('0x15')]=function(_0xc43aff){_0xc43aff=parseInt(_0xc43aff,0xa);if(!_0xc43aff||_0xc43aff<0x0){_0xc43aff=0x0;}return _0xc43aff;};exports['sort']=function(_0x30f5c9){var _0x545b22,_0x17d681=null;if(_0x30f5c9){_0x545b22=_0x30f5c9['split'](',');_0x17d681=_[_0xb9f0('0x16')](_0x545b22,function(_0x3e6108){if(_0x3e6108[_0xb9f0('0x17')]('-')===0x0){return[_0x3e6108===_0xb9f0('0x18')?sequelize[_0xb9f0('0x19')](sequelize['col'](_0xb9f0('0x18')),_0xb9f0('0x1a')):_0x3e6108[_0xb9f0('0x1b')](0x1),'DESC'];}else{return[_0x3e6108===_0xb9f0('0x18')?sequelize['cast'](sequelize['col'](_0xb9f0('0x18')),'unsigned'):_0x3e6108,_0xb9f0('0x1c')];}});}return _0x17d681;};exports['omit']=function(_0x10c144,_0x539bf3){if(_[_0xb9f0('0x7')](_0x10c144)){return _0x10c144;}if(_[_0xb9f0('0x1d')](_0x10c144)){for(var _0x349851=0x0;_0x349851<_0x10c144[_0xb9f0('0x1e')];_0x349851+=0x1){_0x10c144[_0x349851]=this[_0xb9f0('0x1f')](_0x10c144[_0x349851],_0x539bf3);}return _0x10c144;}if(!_[_0xb9f0('0x20')](_0x10c144)){return _0x10c144;}if(_[_0xb9f0('0x21')](_0x539bf3)){_0x539bf3=[_0x539bf3];}if(!_[_0xb9f0('0x1d')](_0x539bf3)){return _0x10c144;}for(var _0x6db4c9=0x0;_0x6db4c9<_0x539bf3[_0xb9f0('0x1e')];_0x6db4c9+=0x1){_[_0xb9f0('0x22')](_0x10c144,_0x539bf3[_0x6db4c9]);}for(var _0x389a35 in _0x10c144){if(_0x10c144['hasOwnProperty'](_0x389a35)){_0x10c144[_0x389a35]=this[_0xb9f0('0x1f')](_0x10c144[_0x389a35],_0x539bf3);}}return _0x10c144;};exports[_0xb9f0('0x23')]=function(_0x43e816){return _0x43e816['match'](RegExp(_0xb9f0('0x24')))?!![]:![];};exports[_0xb9f0('0x25')]=function(_0x14504d){return _0x14504d['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xb9f0('0x26')]=function(_0x95c55a){var _0x379223=[];_0x95c55a[_0xb9f0('0x5')](/[ ,]+/)[_0xb9f0('0x27')](function(_0x4f85eb){_0x4f85eb=_0x4f85eb['replace'](/([^:]")"+/g,'$1');_0x4f85eb='+'+_0x4f85eb+'*';if(_0x4f85eb[_0xb9f0('0x4')]('@'))_0x4f85eb='\x22'+_0x4f85eb+'\x22';_0x379223[_0xb9f0('0x28')](_0x4f85eb);});return _0x379223['join']('\x20');};exports['getOptions']=function(_0x1ea1e0,_0x33cce2,_0x30af55){var _0x34fa28={},_0x13f37b={};if(_0x33cce2['query'][_0xb9f0('0x29')]){_0x33cce2[_0xb9f0('0x2a')]['id']=_0x33cce2[_0xb9f0('0x2a')][_0xb9f0('0x29')];delete _0x33cce2[_0xb9f0('0x2a')]['$id'];}_0x34fa28[_0xb9f0('0x2b')]=_[_0xb9f0('0x16')](_0x1ea1e0,_0xb9f0('0x12'));_0x34fa28[_0xb9f0('0x2a')]=_[_0xb9f0('0x3')](_0x33cce2[_0xb9f0('0x2a')]);_0x34fa28[_0xb9f0('0x6')]=_[_0xb9f0('0x2c')](_0x34fa28[_0xb9f0('0x2b')],_0x34fa28['query']);_0x13f37b[_0xb9f0('0x2d')]=_['intersection'](_0x34fa28[_0xb9f0('0x2b')],this[_0xb9f0('0x2e')](_0x33cce2[_0xb9f0('0x2a')][_0xb9f0('0x2e')]));_0x13f37b[_0xb9f0('0x2d')]=_0x13f37b[_0xb9f0('0x2d')][_0xb9f0('0x1e')]?_0x13f37b['attributes']:_0x34fa28[_0xb9f0('0x2b')];if(!_0x33cce2['query'][_0xb9f0('0x2f')]('nolimit')){_0x13f37b['limit']=this[_0xb9f0('0x14')](_0x33cce2['query'][_0xb9f0('0x14')]);_0x13f37b[_0xb9f0('0x15')]=this[_0xb9f0('0x15')](_0x33cce2[_0xb9f0('0x2a')]['offset']);}_0x13f37b[_0xb9f0('0x30')]=this[_0xb9f0('0x31')](_0x33cce2[_0xb9f0('0x2a')][_0xb9f0('0x31')]);_0x13f37b[_0xb9f0('0x32')]=this[_0xb9f0('0x6')](_['pick'](_0x33cce2[_0xb9f0('0x2a')],_0x34fa28[_0xb9f0('0x6')]),_0x1ea1e0);if(_0x33cce2['query']['filter']){_0x13f37b[_0xb9f0('0x32')]=_[_0xb9f0('0x33')](_0x13f37b['where'],{'$or':_['map'](_0x1ea1e0,function(_0x2eb3f8){if(_0x2eb3f8[_0xb9f0('0xa')]!==_0xb9f0('0x34')){if(_0x30af55){return sequelize[_0xb9f0('0x32')](sequelize['fn'](_0xb9f0('0x35'),sequelize[_0xb9f0('0x36')](_0x2eb3f8[_0xb9f0('0x12')])),{'$like':sequelize['fn'](_0xb9f0('0x35'),'%'+_0x33cce2[_0xb9f0('0x2a')][_0xb9f0('0x37')]+'%')});}else{var _0x4d3596={};_0x4d3596[_0x2eb3f8['name']]={'$like':'%'+_0x33cce2[_0xb9f0('0x2a')]['filter']+'%'};return _0x4d3596;}}})});}_0x13f37b=_['merge']({},_0x13f37b,_0x33cce2[_0xb9f0('0x38')]);return _0x13f37b;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index f79bea7..9cf9c62 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc35b=['client','use','json\x20replacer','toISOString','split','views','/server/views','renderFile','view\x20engine','html','urlencoded','50mb','json','initialize','express','body-parser','method-override','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','env','production','set','appPath','join','root','public','development','test'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc35b,0x103));var _0xbc35=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xc35b[_0x409353];return _0x4f4b59;};'use strict';var express=require(_0xbc35('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0xbc35('0x1'));var methodOverride=require(_0xbc35('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xbc35('0x3'));var path=require(_0xbc35('0x4'));var passport=require(_0xbc35('0x5'));var cors=require(_0xbc35('0x6'));var moment=require(_0xbc35('0x7'));var config=require(_0xbc35('0x8'));var db=require(_0xbc35('0x9'))['db'];exports[_0xbc35('0xa')]=function(_0x4cc110){var _0x4b9ee9=_0x4cc110[_0xbc35('0xb')](_0xbc35('0xc'));if(_0x4b9ee9===_0xbc35('0xd')){_0x4cc110[_0xbc35('0xe')](_0xbc35('0xf'),path[_0xbc35('0x10')](config[_0xbc35('0x11')],_0xbc35('0x12')));}if(_0x4b9ee9===_0xbc35('0x13')||_0x4b9ee9===_0xbc35('0x14')){_0x4cc110['set'](_0xbc35('0xf'),path[_0xbc35('0x10')](config[_0xbc35('0x11')],_0xbc35('0x15')));_0x4cc110[_0xbc35('0x16')](errorHandler());}_0x4cc110['set'](_0xbc35('0x17'),function(_0x322a89,_0x5c3d11){if(this[_0x322a89]instanceof Date){_0x5c3d11=this[_0x322a89][_0xbc35('0x18')]()[_0xbc35('0x19')]('.')[0x0]+'Z';}return _0x5c3d11;});_0x4cc110[_0xbc35('0x16')](express['static'](_0x4cc110[_0xbc35('0xb')](_0xbc35('0xf'))));_0x4cc110['set'](_0xbc35('0x1a'),config['root']+_0xbc35('0x1b'));_0x4cc110['engine']('html',require('ejs')[_0xbc35('0x1c')]);_0x4cc110['set'](_0xbc35('0x1d'),_0xbc35('0x1e'));_0x4cc110[_0xbc35('0x16')](bodyParser[_0xbc35('0x1f')]({'limit':_0xbc35('0x20'),'extended':!![]}));_0x4cc110[_0xbc35('0x16')](bodyParser[_0xbc35('0x21')]({'limit':_0xbc35('0x20')}));_0x4cc110[_0xbc35('0x16')](cors());_0x4cc110['use'](methodOverride());_0x4cc110[_0xbc35('0x16')](cookieParser());_0x4cc110[_0xbc35('0x16')](passport[_0xbc35('0x22')]());}; \ No newline at end of file +var _0x8f01=['ejs','view\x20engine','urlencoded','50mb','json','express','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','moment','../mysqldb','default','get','production','set','appPath','join','root','public','development','test','use','json\x20replacer','toISOString','split','static','/server/views','engine','html'];(function(_0x56e230,_0x2d434b){var _0xb12710=function(_0x447720){while(--_0x447720){_0x56e230['push'](_0x56e230['shift']());}};_0xb12710(++_0x2d434b);}(_0x8f01,0x14f));var _0x18f0=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0x8f01[_0x3c487b];return _0x1d65f6;};'use strict';var express=require(_0x18f0('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x18f0('0x1'));var methodOverride=require(_0x18f0('0x2'));var cookieParser=require(_0x18f0('0x3'));var errorHandler=require(_0x18f0('0x4'));var path=require(_0x18f0('0x5'));var passport=require(_0x18f0('0x6'));var cors=require(_0x18f0('0x7'));var moment=require(_0x18f0('0x8'));var config=require('./environment');var db=require(_0x18f0('0x9'))['db'];exports[_0x18f0('0xa')]=function(_0x477321){var _0x4d1016=_0x477321[_0x18f0('0xb')]('env');if(_0x4d1016===_0x18f0('0xc')){_0x477321[_0x18f0('0xd')](_0x18f0('0xe'),path[_0x18f0('0xf')](config[_0x18f0('0x10')],_0x18f0('0x11')));}if(_0x4d1016===_0x18f0('0x12')||_0x4d1016===_0x18f0('0x13')){_0x477321[_0x18f0('0xd')](_0x18f0('0xe'),path['join'](config[_0x18f0('0x10')],'client'));_0x477321[_0x18f0('0x14')](errorHandler());}_0x477321[_0x18f0('0xd')](_0x18f0('0x15'),function(_0x192a79,_0x39c837){if(this[_0x192a79]instanceof Date){_0x39c837=this[_0x192a79][_0x18f0('0x16')]()[_0x18f0('0x17')]('.')[0x0]+'Z';}return _0x39c837;});_0x477321['use'](express[_0x18f0('0x18')](_0x477321['get']('appPath')));_0x477321[_0x18f0('0xd')]('views',config[_0x18f0('0x10')]+_0x18f0('0x19'));_0x477321[_0x18f0('0x1a')](_0x18f0('0x1b'),require(_0x18f0('0x1c'))['renderFile']);_0x477321[_0x18f0('0xd')](_0x18f0('0x1d'),'html');_0x477321[_0x18f0('0x14')](bodyParser[_0x18f0('0x1e')]({'limit':_0x18f0('0x1f'),'extended':!![]}));_0x477321['use'](bodyParser[_0x18f0('0x20')]({'limit':'50mb'}));_0x477321[_0x18f0('0x14')](cors());_0x477321[_0x18f0('0x14')](methodOverride());_0x477321['use'](cookieParser());_0x477321[_0x18f0('0x14')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 9e5b905..2d48970 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 _0xea43=['macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0xea43,0x150));var _0x3ea4=function(_0x2a1191,_0x233115){_0x2a1191=_0x2a1191-0x0;var _0x2a420e=_0xea43[_0x2a1191];return _0x2a420e;};'use strict';var _=require(_0x3ea4('0x0'));var os=require('os');var crypto=require(_0x3ea4('0x1'));var machine=require(_0x3ea4('0x2'));var exec=require('child_process')[_0x3ea4('0x3')];var config=require(_0x3ea4('0x4'));function getInterfaces(){var _0x3c07f9=[];var _0x3ad820=os[_0x3ea4('0x5')]();var _0xc48a27=_[_0x3ea4('0x6')](_[_0x3ea4('0x7')](_0x3ad820));for(var _0x1f3836=0x0;_0x1f3836<_0xc48a27[_0x3ea4('0x8')];_0x1f3836++){var _0x593665=_0x3ad820[_0xc48a27[_0x1f3836]][_0x3ea4('0x9')](function(_0x5073dd){return _0x5073dd[_0x3ea4('0xa')]===_0x3ea4('0xb')&&_0x5073dd[_0x3ea4('0xc')]===![];});_0x3c07f9=_0x3c07f9[_0x3ea4('0xd')](_0x593665);}return _0x3c07f9;}function getFirstInterface(){var _0x7d44b2=_[_0x3ea4('0xe')](getInterfaces());return{'macAddress':_0x7d44b2&&_0x7d44b2['mac']?_0x7d44b2['mac']:_0x3ea4('0xf'),'ipAddress':_0x7d44b2&&_0x7d44b2[_0x3ea4('0x10')]?_0x7d44b2[_0x3ea4('0x10')]:_0x3ea4('0x11')};}exports[_0x3ea4('0x12')]=getFirstInterface;function getCPUhash(){var _0x236533=_[_0x3ea4('0x6')](os[_0x3ea4('0x13')]()['map'](function(_0x83de2c){return _0x83de2c[_0x3ea4('0x14')];}))[_0x3ea4('0x15')](':');return crypto[_0x3ea4('0x16')](_0x3ea4('0x17'))[_0x3ea4('0x18')](_0x236533)[_0x3ea4('0x19')](_0x3ea4('0x1a'));}exports[_0x3ea4('0x1b')]=function(){var _0x28b094=os[_0x3ea4('0x1c')]();var _0x889d47=/[0-9a-f-]{36}/;if(config[_0x3ea4('0x1d')]&&_0x889d47[_0x3ea4('0x1e')](config[_0x3ea4('0x1d')])){return config['licenseToken'];}else if(_0x28b094==='win32'){return exec(_0x3ea4('0x1f'),{'encoding':_0x3ea4('0x20')})[_0x3ea4('0x21')]('\x0d\x0a','');}else{var _0x4826b3=getFirstInterface();var _0x2b89f8=getCPUhash();var _0x65f63d=_0x2b89f8+'|'+os['hostname']()+'|'+_0x4826b3[_0x3ea4('0x22')]+'|'+_0x4826b3[_0x3ea4('0x23')];var _0x352b75=crypto[_0x3ea4('0x16')]('md5')[_0x3ea4('0x18')](_0x65f63d)[_0x3ea4('0x19')](_0x3ea4('0x1a'));return _0x352b75[_0x3ea4('0x24')](0x0,0x8)+'-'+_0x352b75[_0x3ea4('0x24')](0x8,0xc)+'-'+_0x352b75[_0x3ea4('0x24')](0xc,0x10)+'-'+_0x352b75[_0x3ea4('0x24')](0x10,0x14)+'-'+_0x352b75[_0x3ea4('0x24')](0x14);}}; \ No newline at end of file +var _0xc0c0=['cpus','map','model','createHash','md5','update','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','digest','substring','lodash','crypto','execSync','../environment','networkInterfaces','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','orderBy'];(function(_0x4042a7,_0x46909f){var _0xd2abd1=function(_0x571f39){while(--_0x571f39){_0x4042a7['push'](_0x4042a7['shift']());}};_0xd2abd1(++_0x46909f);}(_0xc0c0,0x193));var _0x0c0c=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xc0c0[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x0c0c('0x0'));var os=require('os');var crypto=require(_0x0c0c('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0x0c0c('0x2')];var config=require(_0x0c0c('0x3'));function getInterfaces(){var _0x57e7e2=[];var _0x210d4e=os[_0x0c0c('0x4')]();var _0x6bb49d=_['orderBy'](_[_0x0c0c('0x5')](_0x210d4e));for(var _0x1ae6a4=0x0;_0x1ae6a4<_0x6bb49d[_0x0c0c('0x6')];_0x1ae6a4++){var _0x8b9b5d=_0x210d4e[_0x6bb49d[_0x1ae6a4]][_0x0c0c('0x7')](function(_0xd98f8f){return _0xd98f8f[_0x0c0c('0x8')]===_0x0c0c('0x9')&&_0xd98f8f[_0x0c0c('0xa')]===![];});_0x57e7e2=_0x57e7e2[_0x0c0c('0xb')](_0x8b9b5d);}return _0x57e7e2;}function getFirstInterface(){var _0x433a64=_[_0x0c0c('0xc')](getInterfaces());return{'macAddress':_0x433a64&&_0x433a64[_0x0c0c('0xd')]?_0x433a64[_0x0c0c('0xd')]:_0x0c0c('0xe'),'ipAddress':_0x433a64&&_0x433a64['address']?_0x433a64[_0x0c0c('0xf')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x437531=_[_0x0c0c('0x10')](os[_0x0c0c('0x11')]()[_0x0c0c('0x12')](function(_0x5dea72){return _0x5dea72[_0x0c0c('0x13')];}))['join'](':');return crypto[_0x0c0c('0x14')](_0x0c0c('0x15'))[_0x0c0c('0x16')](_0x437531)['digest']('hex');}exports[_0x0c0c('0x17')]=function(){var _0x2cad49=os[_0x0c0c('0x18')]();var _0x471d7a=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x471d7a['test'](config[_0x0c0c('0x19')])){return config[_0x0c0c('0x19')];}else if(_0x2cad49===_0x0c0c('0x1a')){return exec(_0x0c0c('0x1b'),{'encoding':_0x0c0c('0x1c')})[_0x0c0c('0x1d')]('\x0d\x0a','');}else{var _0x458f35=getFirstInterface();var _0x4b2f10=getCPUhash();var _0x204eba=_0x4b2f10+'|'+os[_0x0c0c('0x1e')]()+'|'+_0x458f35[_0x0c0c('0x1f')]+'|'+_0x458f35[_0x0c0c('0x20')];var _0xb9e871=crypto[_0x0c0c('0x14')](_0x0c0c('0x15'))[_0x0c0c('0x16')](_0x204eba)[_0x0c0c('0x21')]('hex');return _0xb9e871[_0x0c0c('0x22')](0x0,0x8)+'-'+_0xb9e871[_0x0c0c('0x22')](0x8,0xc)+'-'+_0xb9e871[_0x0c0c('0x22')](0xc,0x10)+'-'+_0xb9e871[_0x0c0c('0x22')](0x10,0x14)+'-'+_0xb9e871[_0x0c0c('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7cad7fe..9b197fb 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 _0x6bcb=['util','moment','request-promise','bluebird','pkginfo','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','GET','then','catch','get','data1','active','data2','info','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','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default'];(function(_0x3754d6,_0x2822e0){var _0xbb2448=function(_0x215d29){while(--_0x215d29){_0x3754d6['push'](_0x3754d6['shift']());}};_0xbb2448(++_0x2822e0);}(_0x6bcb,0x7b));var _0xb6bc=function(_0x14477e,_0x44d4da){_0x14477e=_0x14477e-0x0;var _0x5d4a05=_0x6bcb[_0x14477e];return _0x5d4a05;};'use strict';var util=require(_0xb6bc('0x0'));var moment=require(_0xb6bc('0x1'));var rp=require(_0xb6bc('0x2'));var BPromise=require(_0xb6bc('0x3'));var pkginfo=require(_0xb6bc('0x4'))(module,'version');var db=require(_0xb6bc('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xb6bc('0x6'));var logger=require(_0xb6bc('0x7'))(_0xb6bc('0x8'));var HOST=_0xb6bc('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x13d0fe){return new BPromise(function(_0xbf663a,_0x37cb10){var _0xa5ece8=util[_0xb6bc('0xa')](_0xb6bc('0xb'),HOST,_0x13d0fe,module[_0xb6bc('0xc')][_0xb6bc('0xd')]);if(oldToken){_0xa5ece8=util[_0xb6bc('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x13d0fe,module[_0xb6bc('0xc')][_0xb6bc('0xd')],oldToken);}var _0x3abdd6={'uri':_0xa5ece8,'method':_0xb6bc('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x3abdd6)[_0xb6bc('0xf')](function(_0x5a8e45){_0xbf663a(_0x5a8e45);})[_0xb6bc('0x10')](function(_0x1d509d){_0x37cb10(_0x1d509d);});});}function manageLicense(_0x5661a6,_0x133b64){var _0x112247=_0x133b64[_0xb6bc('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x112247[_0xb6bc('0x12')]!==_0x5661a6&&!_0x112247['data2']){oldToken=_0x112247['data1'];}httpRequest(_0x5661a6)[_0xb6bc('0xf')](function(_0x57a8f3){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x57a8f3[_0xb6bc('0x13')]){isOldTokenSent=![];if(!_0x112247[_0xb6bc('0x8')]&&_0x112247[_0xb6bc('0x8')]!=_0x57a8f3['license']||_0x112247[_0xb6bc('0x8')]&&_0x112247[_0xb6bc('0x14')]){logger[_0xb6bc('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x112247[_0xb6bc('0x8')]&&!_0x112247[_0xb6bc('0x14')]&&_0x112247[_0xb6bc('0x8')]!=_0x57a8f3[_0xb6bc('0x8')]){logger[_0xb6bc('0x15')](_0xb6bc('0x16'));}if(_0x112247['license']&&!_0x112247[_0xb6bc('0x14')]&&_0x112247[_0xb6bc('0x8')]==_0x57a8f3[_0xb6bc('0x8')]){return _0x133b64;}return _0x133b64[_0xb6bc('0x17')]({'data1':_0x5661a6,'data2':null,'license':_0x57a8f3[_0xb6bc('0x8')]});}else{if(_0x57a8f3[_0xb6bc('0x8')]||_0x112247[_0xb6bc('0x8')]){if(!_0x112247[_0xb6bc('0x14')]){if(_0x112247[_0xb6bc('0x12')]==_0x5661a6){GRAY_PERIOD_REASON=_0xb6bc('0x18');logger[_0xb6bc('0x15')](_0xb6bc('0x19'));}else{GRAY_PERIOD_REASON=_0xb6bc('0x1a');logger['info'](_0xb6bc('0x1b'),_0x112247[_0xb6bc('0x12')],_0x5661a6);}logger[_0xb6bc('0x15')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xb6bc('0x1c')](),moment()[_0xb6bc('0xa')](_0xb6bc('0x1d')));return _0x133b64[_0xb6bc('0x17')]({'data2':encryptor[_0xb6bc('0x1e')](moment()[_0xb6bc('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor['decryptString'](_0x112247[_0xb6bc('0x14')]),_0xb6bc('0x1f'))>DAYS){logger[_0xb6bc('0x15')](_0xb6bc('0x20'),moment()['format'](_0xb6bc('0x1d')));isOldTokenSent=![];return _0x133b64['update']({'data1':_0x5661a6,'data2':null,'license':null});}}}else{if(_0x112247['data1']!=_0x5661a6){logger['info'](_0xb6bc('0x1b'),_0x112247['data1'],_0x5661a6);return _0x133b64[_0xb6bc('0x17')]({'data1':_0x5661a6,'data2':null,'license':null});}}}return _0x133b64;})['then'](function(_0x5a07fb){_0x133b64=_0x5a07fb;})[_0xb6bc('0x10')](function(_0xb6ed39){logger[_0xb6bc('0x21')](_0xb6ed39[_0xb6bc('0x22')]);})[_0xb6bc('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0xb6bc('0x24')](),_0x133b64);},TIME);});}function defaultLicense(){var _0xb71abb=hardware[_0xb6bc('0x24')]();if(_0xb71abb){return db[_0xb6bc('0x25')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0xb71abb}})[_0xb6bc('0x26')](function(_0x2e3da2,_0x513374){logger[_0xb6bc('0x15')](_0xb6bc('0x27'),_0xb71abb);manageLicense(_0xb71abb,_0x2e3da2);})[_0xb6bc('0x10')](function(_0xa13708){logger['error'](_0xa13708[_0xb6bc('0x22')]);});}}exports[_0xb6bc('0x28')]=defaultLicense; \ No newline at end of file +var _0x9326=['exports','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','update','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x9326,0x1b5));var _0x6932=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0x9326[_0x4f2c3a];return _0x17d91c;};'use strict';var util=require(_0x6932('0x0'));var moment=require(_0x6932('0x1'));var rp=require(_0x6932('0x2'));var BPromise=require(_0x6932('0x3'));var pkginfo=require(_0x6932('0x4'))(module,_0x6932('0x5'));var db=require(_0x6932('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x6932('0x7'));var logger=require(_0x6932('0x8'))(_0x6932('0x9'));var HOST=_0x6932('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5b7ee8){return new BPromise(function(_0x1f05d5,_0x48bd2d){var _0x285d0d=util[_0x6932('0xb')](_0x6932('0xc'),HOST,_0x5b7ee8,module['exports']['version']);if(oldToken){_0x285d0d=util[_0x6932('0xb')](_0x6932('0xd'),HOST,_0x5b7ee8,module[_0x6932('0xe')][_0x6932('0x5')],oldToken);}var _0x5061bf={'uri':_0x285d0d,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x5061bf)[_0x6932('0xf')](function(_0x245823){_0x1f05d5(_0x245823);})[_0x6932('0x10')](function(_0xed0ec5){_0x48bd2d(_0xed0ec5);});});}function manageLicense(_0x5b5d14,_0x46f0f2){var _0x473686=_0x46f0f2[_0x6932('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x473686[_0x6932('0x12')]!==_0x5b5d14&&!_0x473686[_0x6932('0x13')]){oldToken=_0x473686[_0x6932('0x12')];}httpRequest(_0x5b5d14)['then'](function(_0x18ea42){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x18ea42[_0x6932('0x14')]){isOldTokenSent=![];if(!_0x473686['license']&&_0x473686['license']!=_0x18ea42[_0x6932('0x9')]||_0x473686[_0x6932('0x9')]&&_0x473686[_0x6932('0x13')]){logger[_0x6932('0x15')](_0x6932('0x16'));}if(_0x473686[_0x6932('0x9')]&&!_0x473686['data2']&&_0x473686['license']!=_0x18ea42[_0x6932('0x9')]){logger['info'](_0x6932('0x17'));}if(_0x473686['license']&&!_0x473686['data2']&&_0x473686[_0x6932('0x9')]==_0x18ea42[_0x6932('0x9')]){return _0x46f0f2;}return _0x46f0f2['update']({'data1':_0x5b5d14,'data2':null,'license':_0x18ea42[_0x6932('0x9')]});}else{if(_0x18ea42[_0x6932('0x9')]||_0x473686[_0x6932('0x9')]){if(!_0x473686['data2']){if(_0x473686[_0x6932('0x12')]==_0x5b5d14){GRAY_PERIOD_REASON=_0x6932('0x18');logger['info'](_0x6932('0x19'));}else{GRAY_PERIOD_REASON=_0x6932('0x1a');logger[_0x6932('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x473686[_0x6932('0x12')],_0x5b5d14);}logger[_0x6932('0x15')](_0x6932('0x1b'),GRAY_PERIOD_REASON[_0x6932('0x1c')](),moment()[_0x6932('0xb')](_0x6932('0x1d')));return _0x46f0f2['update']({'data2':encryptor[_0x6932('0x1e')](moment()[_0x6932('0xb')](_0x6932('0x1d')))});}else{if(moment()[_0x6932('0x1f')](encryptor[_0x6932('0x20')](_0x473686[_0x6932('0x13')]),'days')>DAYS){logger[_0x6932('0x15')](_0x6932('0x21'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x46f0f2['update']({'data1':_0x5b5d14,'data2':null,'license':null});}}}else{if(_0x473686[_0x6932('0x12')]!=_0x5b5d14){logger[_0x6932('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x473686[_0x6932('0x12')],_0x5b5d14);return _0x46f0f2[_0x6932('0x22')]({'data1':_0x5b5d14,'data2':null,'license':null});}}}return _0x46f0f2;})['then'](function(_0x5c8636){_0x46f0f2=_0x5c8636;})['catch'](function(_0x2641a9){logger['error'](_0x2641a9['message']);})[_0x6932('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0x6932('0x24')](),_0x46f0f2);},TIME);});}function defaultLicense(){var _0x3e8340=hardware[_0x6932('0x24')]();if(_0x3e8340){return db[_0x6932('0x25')][_0x6932('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x3e8340}})[_0x6932('0x27')](function(_0x280437,_0xe0a928){logger['info'](_0x6932('0x28'),_0x3e8340);manageLicense(_0x3e8340,_0x280437);})['catch'](function(_0x47b3a5){logger['error'](_0x47b3a5['message']);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 8a19221..71a77e3 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 _0xd3a3=['License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../mysqldb','Demo\x20license','getUuid','defaults','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','parse','demo','uuid','machineUuid','decryptString','deadline','add','grayReason','message','User','findAll','role','COUNT','sequelize','col','admin','then','users','telephones','forEach','user','count','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users'];(function(_0x396278,_0x49f698){var _0x30286b=function(_0x4c299c){while(--_0x4c299c){_0x396278['push'](_0x396278['shift']());}};_0x30286b(++_0x49f698);}(_0xd3a3,0xb6));var _0x3d3a=function(_0x5e12e5,_0x351f55){_0x5e12e5=_0x5e12e5-0x0;var _0x5b2efa=_0xd3a3[_0x5e12e5];return _0x5b2efa;};'use strict';var util=require(_0x3d3a('0x0'));var _=require(_0x3d3a('0x1'));var moment=require(_0x3d3a('0x2'));var BPromise=require('bluebird');var hardware=require(_0x3d3a('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0x3d3a('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x3d3a('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x3d3a('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4835af){return new BPromise(function(_0x3eb449,_0x47d55a){return db['License']['find'](_[_0x3d3a('0x7')](_0x4835af,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x12fe88){return checkLicense(_0x12fe88,null);})['then'](function(_0x83d70e){_0x3eb449(_0x83d70e);return;})[_0x3d3a('0x8')](function(_0x3aad50){_0x47d55a(_0x3aad50);});});}function checkLicense(_0x1bfc89,_0x2c510e){if(!_0x1bfc89){demoLicense['uuid']=_0x1bfc89[_0x3d3a('0x9')];return demoLicense;}try{var _0x277133=_0x2c510e||_0x1bfc89[_0x3d3a('0xa')];if(_[_0x3d3a('0xb')](_0x277133)){throw new Error(_0x3d3a('0xc'));}var _0x8e8d41=_0x1bfc89[_0x3d3a('0x9')];var _0x2f92cc=_0x1bfc89[_0x3d3a('0xd')];var _0x2e7274=_0x8e8d41[_0x3d3a('0xe')]('-')[0x4];var _0x45e194=_0x8e8d41['split']('-')[0x0];var _0x1a82a0=encryptor['decryptString'](_0x277133,util[_0x3d3a('0xf')](_0x3d3a('0x10'),_0x2e7274,_0x8e8d41,_0x45e194));var _0x249ed6=JSON[_0x3d3a('0x11')](_0x1a82a0);_0x249ed6[_0x3d3a('0x12')]=![];_0x249ed6[_0x3d3a('0x13')]=_0x8e8d41;_0x249ed6[_0x3d3a('0x14')]=hardware[_0x3d3a('0x6')]();if(_0x2f92cc){var _0x37b1de=encryptor[_0x3d3a('0x15')](_0x2f92cc);_0x249ed6['gray']=_0x37b1de;_0x249ed6[_0x3d3a('0x16')]=moment(_0x37b1de)[_0x3d3a('0x17')](0x7,'days')[_0x3d3a('0xf')]();_0x249ed6[_0x3d3a('0x18')]=_0x249ed6[_0x3d3a('0x13')]!=_0x249ed6[_0x3d3a('0x14')]?'changed':'disabled';}return _0x249ed6;}catch(_0x2527fc){breakingLicense[_0x3d3a('0x13')]=_0x1bfc89[_0x3d3a('0x9')];breakingLicense[_0x3d3a('0x19')]=_0x2527fc[_0x3d3a('0x19')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2c8008,_0xabe79e){getLicense()['then'](function(_0x5ecb3a){return db[_0x3d3a('0x1a')][_0x3d3a('0x1b')]({'attributes':[_0x3d3a('0x1c'),[db['sequelize']['fn'](_0x3d3a('0x1d'),db[_0x3d3a('0x1e')][_0x3d3a('0x1f')](_0x3d3a('0x1c'))),'count']],'group':_0x3d3a('0x1c'),'where':{'role':{'$or':[_0x3d3a('0x20'),'user','telephone']}},'raw':!![]})[_0x3d3a('0x21')](function(_0xe00b7c){var _0xec5059={'user':_0x5ecb3a[_0x3d3a('0x22')]||0x0,'telephone':_0x5ecb3a[_0x3d3a('0x23')]||0x0};_0xe00b7c[_0x3d3a('0x24')](function(_0x52505b){var _0x1cb610=_0x52505b[_0x3d3a('0x1c')]===_0x3d3a('0x20')?_0x3d3a('0x25'):_0x52505b[_0x3d3a('0x1c')];_0xec5059[_0x1cb610]-=_0x52505b[_0x3d3a('0x26')];if(_0xec5059[_0x1cb610]<0x0)_0xec5059[_0x1cb610]=0x0;});_0x2c8008(_0xec5059);return;});})[_0x3d3a('0x8')](function(_0x1b0913){_0xabe79e(_0x1b0913);});});}function checkUserLimits(_0x52fec8){return new BPromise(function(_0x7a7be5,_0x2c5d11){getLimits()[_0x3d3a('0x21')](function(_0x2f2815){var _0x8f2e26=_[_0x3d3a('0x27')](_[_0x3d3a('0x28')](_0x52fec8,_0x3d3a('0x1c')),[_0x3d3a('0x20'),'user','telephone']);var _0x6369d4=(_0x8f2e26[_0x3d3a('0x20')]||0x0)+(_0x8f2e26[_0x3d3a('0x25')]||0x0);var _0x31e888=_0x8f2e26[_0x3d3a('0x29')]||0x0;if(_0x6369d4>_0x2f2815[_0x3d3a('0x25')])return _0x2c5d11(_0x3d3a('0x2a'));if(_0x31e888>_0x2f2815[_0x3d3a('0x29')])return _0x2c5d11(_0x3d3a('0x2b'));return _0x7a7be5();})[_0x3d3a('0x8')](function(_0xd3a8a9){_0x2c5d11(_0xd3a8a9);});});}module[_0x3d3a('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x4a3b=['catch','data1','license','isEmpty','data2','split','decryptString','format','%s:%s:%s','parse','machineUuid','gray','deadline','days','uuid','changed','disabled','message','then','findAll','sequelize','COUNT','col','role','count','user','telephone','users','telephones','forEach','admin','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','defaults'];(function(_0x4f783d,_0x8d7d21){var _0x3d1efe=function(_0x48f69c){while(--_0x48f69c){_0x4f783d['push'](_0x4f783d['shift']());}};_0x3d1efe(++_0x8d7d21);}(_0x4a3b,0x1c0));var _0xb4a3=function(_0x408f9b,_0x578ffe){_0x408f9b=_0x408f9b-0x0;var _0x5d49b7=_0x4a3b[_0x408f9b];return _0x5d49b7;};'use strict';var util=require(_0xb4a3('0x0'));var _=require('lodash');var moment=require(_0xb4a3('0x1'));var BPromise=require(_0xb4a3('0x2'));var hardware=require(_0xb4a3('0x3'));var encryptor=require(_0xb4a3('0x4'));var db=require(_0xb4a3('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb4a3('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb4a3('0x7'),'machineUuid':hardware[_0xb4a3('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb4a3('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb4a3('0x9'),'machineUuid':hardware[_0xb4a3('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x23ee46){return new BPromise(function(_0x3e2039,_0x5480ca){return db['License'][_0xb4a3('0xa')](_[_0xb4a3('0xb')](_0x23ee46,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x1e96fc){return checkLicense(_0x1e96fc,null);})['then'](function(_0x41be74){_0x3e2039(_0x41be74);return;})[_0xb4a3('0xc')](function(_0x57ac34){_0x5480ca(_0x57ac34);});});}function checkLicense(_0x37177a,_0x3860c7){if(!_0x37177a){demoLicense['uuid']=_0x37177a[_0xb4a3('0xd')];return demoLicense;}try{var _0x2e2d0d=_0x3860c7||_0x37177a[_0xb4a3('0xe')];if(_[_0xb4a3('0xf')](_0x2e2d0d)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x3e2d20=_0x37177a[_0xb4a3('0xd')];var _0x1a3b2c=_0x37177a[_0xb4a3('0x10')];var _0x5dfa79=_0x3e2d20[_0xb4a3('0x11')]('-')[0x4];var _0x23ff78=_0x3e2d20[_0xb4a3('0x11')]('-')[0x0];var _0x544cd5=encryptor[_0xb4a3('0x12')](_0x2e2d0d,util[_0xb4a3('0x13')](_0xb4a3('0x14'),_0x5dfa79,_0x3e2d20,_0x23ff78));var _0x5e6ee7=JSON[_0xb4a3('0x15')](_0x544cd5);_0x5e6ee7['demo']=![];_0x5e6ee7['uuid']=_0x3e2d20;_0x5e6ee7[_0xb4a3('0x16')]=hardware[_0xb4a3('0x8')]();if(_0x1a3b2c){var _0x18c623=encryptor[_0xb4a3('0x12')](_0x1a3b2c);_0x5e6ee7[_0xb4a3('0x17')]=_0x18c623;_0x5e6ee7[_0xb4a3('0x18')]=moment(_0x18c623)['add'](0x7,_0xb4a3('0x19'))[_0xb4a3('0x13')]();_0x5e6ee7['grayReason']=_0x5e6ee7[_0xb4a3('0x1a')]!=_0x5e6ee7['machineUuid']?_0xb4a3('0x1b'):_0xb4a3('0x1c');}return _0x5e6ee7;}catch(_0x4ceb28){breakingLicense['uuid']=_0x37177a[_0xb4a3('0xd')];breakingLicense[_0xb4a3('0x1d')]=_0x4ceb28['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5b0ee2,_0x2d34b6){getLicense()[_0xb4a3('0x1e')](function(_0x1bcd3d){return db['User'][_0xb4a3('0x1f')]({'attributes':['role',[db[_0xb4a3('0x20')]['fn'](_0xb4a3('0x21'),db[_0xb4a3('0x20')][_0xb4a3('0x22')](_0xb4a3('0x23'))),_0xb4a3('0x24')]],'group':_0xb4a3('0x23'),'where':{'role':{'$or':['admin',_0xb4a3('0x25'),_0xb4a3('0x26')]}},'raw':!![]})[_0xb4a3('0x1e')](function(_0x3b46bb){var _0x582cf3={'user':_0x1bcd3d[_0xb4a3('0x27')]||0x0,'telephone':_0x1bcd3d[_0xb4a3('0x28')]||0x0};_0x3b46bb[_0xb4a3('0x29')](function(_0x2088a3){var _0x44ea32=_0x2088a3[_0xb4a3('0x23')]===_0xb4a3('0x2a')?_0xb4a3('0x25'):_0x2088a3[_0xb4a3('0x23')];_0x582cf3[_0x44ea32]-=_0x2088a3[_0xb4a3('0x24')];if(_0x582cf3[_0x44ea32]<0x0)_0x582cf3[_0x44ea32]=0x0;});_0x5b0ee2(_0x582cf3);return;});})[_0xb4a3('0xc')](function(_0x12286b){_0x2d34b6(_0x12286b);});});}function checkUserLimits(_0x336785){return new BPromise(function(_0x371123,_0x30470d){getLimits()['then'](function(_0x33f489){var _0xb07731=_[_0xb4a3('0x2b')](_[_0xb4a3('0x2c')](_0x336785,'role'),[_0xb4a3('0x2a'),'user',_0xb4a3('0x26')]);var _0x5832c0=(_0xb07731[_0xb4a3('0x2a')]||0x0)+(_0xb07731[_0xb4a3('0x25')]||0x0);var _0x26afe1=_0xb07731['telephone']||0x0;if(_0x5832c0>_0x33f489[_0xb4a3('0x25')])return _0x30470d('License\x20limit\x20reached\x20for\x20users');if(_0x26afe1>_0x33f489[_0xb4a3('0x26')])return _0x30470d(_0xb4a3('0x2d'));return _0x371123();})[_0xb4a3('0xc')](function(_0x48e081){_0x30470d(_0x48e081);});});}module['exports']={'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 c970e0e..a770df6 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 _0xa30a=['http://localhost:9000','myappanuglar-secret','secret','exports'];(function(_0xc0a626,_0x3f3d91){var _0x2717b6=function(_0x3fb8a7){while(--_0x3fb8a7){_0xc0a626['push'](_0xc0a626['shift']());}};_0x2717b6(++_0x3f3d91);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';module[_0xaa30('0x0')]={'DOMAIN':_0xaa30('0x1'),'SESSION_SECRET':_0xaa30('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xaa30('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xd4f4=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0xb9eb63,_0x20f231){var _0x112c03=function(_0x3e16f5){while(--_0x3e16f5){_0xb9eb63['push'](_0xb9eb63['shift']());}};_0x112c03(++_0x20f231);}(_0xd4f4,0x8b));var _0x4d4f=function(_0xd779b,_0x397327){_0xd779b=_0xd779b-0x0;var _0x354ea2=_0xd4f4[_0xd779b];return _0x354ea2;};'use strict';module[_0x4d4f('0x0')]={'DOMAIN':_0x4d4f('0x1'),'SESSION_SECRET':_0x4d4f('0x2'),'GOOGLE_ID':_0x4d4f('0x3'),'GOOGLE_SECRET':_0x4d4f('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 125daa5..4bef72a 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07a5=['replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','Logger','%s-%s','error','transports','File','info','Console','env','debugLevel','moment','winston','util','path','INFO','join','log','xcally','format','%s-%s.log','message'];(function(_0x5c1421,_0x5e5516){var _0x248528=function(_0x1bb102){while(--_0x1bb102){_0x5c1421['push'](_0x5c1421['shift']());}};_0x248528(++_0x5e5516);}(_0x07a5,0x12d));var _0x507a=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x07a5[_0x277107];return _0x1da046;};'use strict';var moment=require(_0x507a('0x0'));var winston=require(_0x507a('0x1'));var util=require(_0x507a('0x2'));var path=require(_0x507a('0x3'));var debugLevel=_0x507a('0x4');function filename(_0x4ada96,_0xb1d2d4){return path[_0x507a('0x5')]('/var',_0x507a('0x6'),_0x507a('0x7'),util[_0x507a('0x8')](_0x507a('0x9'),_0x4ada96,_0xb1d2d4));}function formatter(_0x178ade,_0x4d6d64){_0x4d6d64[_0x507a('0xa')]=_0x4d6d64[_0x507a('0xa')][_0x507a('0xb')](/@@{/g,_0x507a('0xc'))['replace'](/}@@/g,_0x507a('0xd'))[_0x507a('0xb')](/@{/g,'{{')[_0x507a('0xb')](/}@/g,'}}');return util[_0x507a('0x8')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x507a('0x8')](_0x507a('0xe')),_0x4d6d64['level'][_0x507a('0xf')](),_0x178ade,_0x4d6d64[_0x507a('0xa')]);}module[_0x507a('0x10')]=function(_0x1f7de7){return new winston[(_0x507a('0x11'))]({'transports':[new winston['transports']['File']({'name':util[_0x507a('0x8')](_0x507a('0x12'),_0x1f7de7,_0x507a('0x13')),'filename':filename(_0x1f7de7,_0x507a('0x13')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2914ee){return formatter(_0x1f7de7,_0x2914ee);}}),new winston[(_0x507a('0x14'))][(_0x507a('0x15'))]({'name':util[_0x507a('0x8')]('%s-%s',_0x1f7de7,_0x507a('0x16')),'filename':filename(_0x1f7de7,_0x507a('0x16')),'level':_0x507a('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x35db06){return formatter(_0x1f7de7,_0x35db06);}}),new winston['transports'][(_0x507a('0x17'))]({'level':process[_0x507a('0x18')][_0x507a('0x19')]||debugLevel,'json':![],'formatter':function(_0x4ecbc0){return formatter(_0x1f7de7,_0x4ecbc0);}})]});}; \ No newline at end of file +var _0x645a=['message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','exports','Logger','transports','File','%s-%s','error','info','env','debugLevel','winston','util','path','INFO','/var','log','format'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x645a,0x1f3));var _0xa645=function(_0x14540b,_0x85d32d){_0x14540b=_0x14540b-0x0;var _0x394822=_0x645a[_0x14540b];return _0x394822;};'use strict';var moment=require('moment');var winston=require(_0xa645('0x0'));var util=require(_0xa645('0x1'));var path=require(_0xa645('0x2'));var debugLevel=_0xa645('0x3');function filename(_0x26f711,_0x39887d){return path['join'](_0xa645('0x4'),_0xa645('0x5'),'xcally',util[_0xa645('0x6')]('%s-%s.log',_0x26f711,_0x39887d));}function formatter(_0x597e3e,_0x50b55a){_0x50b55a[_0xa645('0x7')]=_0x50b55a['message'][_0xa645('0x8')](/@@{/g,_0xa645('0x9'))[_0xa645('0x8')](/}@@/g,_0xa645('0xa'))[_0xa645('0x8')](/@{/g,'{{')[_0xa645('0x8')](/}@/g,'}}');return util[_0xa645('0x6')](_0xa645('0xb'),moment()[_0xa645('0x6')](_0xa645('0xc')),_0x50b55a[_0xa645('0xd')]['toUpperCase'](),_0x597e3e,_0x50b55a[_0xa645('0x7')]);}module[_0xa645('0xe')]=function(_0x17382d){return new winston[(_0xa645('0xf'))]({'transports':[new winston[(_0xa645('0x10'))][(_0xa645('0x11'))]({'name':util[_0xa645('0x6')](_0xa645('0x12'),_0x17382d,_0xa645('0x13')),'filename':filename(_0x17382d,_0xa645('0x13')),'level':_0xa645('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xa875b4){return formatter(_0x17382d,_0xa875b4);}}),new winston[(_0xa645('0x10'))][(_0xa645('0x11'))]({'name':util['format'](_0xa645('0x12'),_0x17382d,_0xa645('0x14')),'filename':filename(_0x17382d,_0xa645('0x14')),'level':_0xa645('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x90f172){return formatter(_0x17382d,_0x90f172);}}),new winston['transports']['Console']({'level':process[_0xa645('0x15')][_0xa645('0x16')]||debugLevel,'json':![],'formatter':function(_0xeaefd8){return formatter(_0x17382d,_0xeaefd8);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index f82c3a2..2909a65 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 _0x4440=['express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path'];(function(_0x343dbb,_0x5158ba){var _0x3c0a45=function(_0x1ea39c){while(--_0x1ea39c){_0x343dbb['push'](_0x343dbb['shift']());}};_0x3c0a45(++_0x5158ba);}(_0x4440,0x81));var _0x0444=function(_0x5f4129,_0x26eb9a){_0x5f4129=_0x5f4129-0x0;var _0x27fd6c=_0x4440[_0x5f4129];return _0x27fd6c;};'use strict';var path=require(_0x0444('0x0'));var os=require('os');var config={'apps':[{'name':_0x0444('0x1'),'script':path[_0x0444('0x2')](__dirname,_0x0444('0x3'))},{'name':_0x0444('0x4'),'script':path['join'](__dirname,_0x0444('0x5'))},{'name':_0x0444('0x6'),'script':path[_0x0444('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0x0444('0x7'),'script':path[_0x0444('0x2')](__dirname,_0x0444('0x8'))},{'name':'routing','script':path[_0x0444('0x2')](__dirname,_0x0444('0x9'))},{'name':_0x0444('0xa'),'script':path['join'](__dirname,_0x0444('0xb'))}]};module[_0x0444('0xc')]=config; \ No newline at end of file +var _0x9bbb=['../../services/email/index.js','routing','../../services/routing/index.js','xdr','express','join','agi','../../services/agi/index.js'];(function(_0xda62ce,_0x5c4ed9){var _0x3a348e=function(_0x10c43e){while(--_0x10c43e){_0xda62ce['push'](_0xda62ce['shift']());}};_0x3a348e(++_0x5c4ed9);}(_0x9bbb,0x1f4));var _0xb9bb=function(_0x5cb7f4,_0x20b02c){_0x5cb7f4=_0x5cb7f4-0x0;var _0x1bd1a2=_0x9bbb[_0x5cb7f4];return _0x1bd1a2;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0xb9bb('0x0'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':'ami','script':path[_0xb9bb('0x1')](__dirname,'../../services/ami/index.js')},{'name':_0xb9bb('0x2'),'script':path[_0xb9bb('0x1')](__dirname,_0xb9bb('0x3'))},{'name':'email','script':path[_0xb9bb('0x1')](__dirname,_0xb9bb('0x4'))},{'name':_0xb9bb('0x5'),'script':path[_0xb9bb('0x1')](__dirname,_0xb9bb('0x6'))},{'name':_0xb9bb('0x7'),'script':path[_0xb9bb('0x1')](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index dd38cb5..80e9e3c 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 _0xd7f6=['bluebird','./config','start','disconnect','stop','then','restart','list','delete','dump','saved','pm2'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xd7f6,0x137));var _0x6d7f=function(_0x44b622,_0x5520c5){_0x44b622=_0x44b622-0x0;var _0x424962=_0xd7f6[_0x44b622];return _0x424962;};'use strict';var pm2=require(_0x6d7f('0x0'));var BPromise=require(_0x6d7f('0x1'));var config=require(_0x6d7f('0x2'));function connect(){return new BPromise(function(_0x5d339a,_0x51abe1){return pm2['connect'](function(_0x1ddc9d){if(_0x1ddc9d){return _0x51abe1(_0x1ddc9d);}return _0x5d339a('connected');});});};exports[_0x6d7f('0x3')]=function(_0x40135d){return connect()['then'](function(){return new BPromise(function(_0x30dc75,_0x26ad4a){return pm2[_0x6d7f('0x3')](_0x40135d,function(_0x4ad2f2,_0x3dbf8d){if(_0x4ad2f2){return _0x26ad4a(_0x4ad2f2);}pm2[_0x6d7f('0x4')]();return _0x30dc75(_0x3dbf8d);});});});};exports[_0x6d7f('0x5')]=function(_0x4ac8af){return connect()[_0x6d7f('0x6')](function(){return new BPromise(function(_0x478bb,_0xc51443){return pm2['stop'](_0x4ac8af,function(_0x139f1d,_0x2a9b85){if(_0x139f1d){return _0xc51443(_0x139f1d);}pm2[_0x6d7f('0x4')]();return _0x478bb(_0x2a9b85);});});});};exports['restart']=function(_0x447234){return connect()[_0x6d7f('0x6')](function(){return new BPromise(function(_0x539834,_0x3a1ea3){return pm2[_0x6d7f('0x7')](_0x447234,function(_0x5bd45a,_0x4b1421){if(_0x5bd45a){return _0x3a1ea3(_0x5bd45a);}pm2[_0x6d7f('0x4')]();return _0x539834(_0x4b1421);});});});};exports[_0x6d7f('0x8')]=function(){return connect()[_0x6d7f('0x6')](function(){return new BPromise(function(_0x5c47ce,_0x5be0f){return pm2[_0x6d7f('0x8')](function(_0x5c869d,_0x541ae0){if(_0x5c869d){return _0x5be0f(_0x5c869d);}pm2['disconnect']();return _0x5c47ce(_0x541ae0);});});});};exports['describe']=function(_0x2390e4){return connect()[_0x6d7f('0x6')](function(){return new BPromise(function(_0x4f0015,_0x28c642){return pm2['describe'](_0x2390e4,function(_0x387aad,_0x3d6e42){if(_0x387aad){return _0x28c642(_0x387aad);}pm2[_0x6d7f('0x4')]();return _0x4f0015(_0x3d6e42);});});});};exports[_0x6d7f('0x9')]=function(_0x15edcb){return connect()[_0x6d7f('0x6')](function(){return new BPromise(function(_0x41c9c4,_0x52b45f){return pm2[_0x6d7f('0x9')](_0x15edcb,function(_0x512919,_0x371a81){if(_0x512919){return _0x52b45f(_0x512919);}pm2[_0x6d7f('0x4')]();return _0x41c9c4(_0x371a81);});});});};exports[_0x6d7f('0xa')]=function(){return connect()[_0x6d7f('0x6')](function(){return new BPromise(function(_0x55563b,_0xd2e74e){return pm2[_0x6d7f('0xa')](function(_0x189f61){if(_0x189f61){return _0xd2e74e(_0x189f61);}return _0x55563b(_0x6d7f('0xb'));});});});}; \ No newline at end of file +var _0xd37b=['saved','pm2','./config','connected','start','stop','then','disconnect','restart','list','delete','dump'];(function(_0xfe7524,_0x4a6bf3){var _0x462139=function(_0x106b5c){while(--_0x106b5c){_0xfe7524['push'](_0xfe7524['shift']());}};_0x462139(++_0x4a6bf3);}(_0xd37b,0x139));var _0xbd37=function(_0x3e3982,_0xea6e7d){_0x3e3982=_0x3e3982-0x0;var _0x20c702=_0xd37b[_0x3e3982];return _0x20c702;};'use strict';var pm2=require(_0xbd37('0x0'));var BPromise=require('bluebird');var config=require(_0xbd37('0x1'));function connect(){return new BPromise(function(_0x5eaedd,_0x956fa5){return pm2['connect'](function(_0x333b31){if(_0x333b31){return _0x956fa5(_0x333b31);}return _0x5eaedd(_0xbd37('0x2'));});});};exports[_0xbd37('0x3')]=function(_0x4b6d89){return connect()['then'](function(){return new BPromise(function(_0x57dacc,_0x5eab89){return pm2[_0xbd37('0x3')](_0x4b6d89,function(_0x10f79d,_0x22ec01){if(_0x10f79d){return _0x5eab89(_0x10f79d);}pm2['disconnect']();return _0x57dacc(_0x22ec01);});});});};exports[_0xbd37('0x4')]=function(_0x2b88a0){return connect()[_0xbd37('0x5')](function(){return new BPromise(function(_0x19ce57,_0x8af581){return pm2[_0xbd37('0x4')](_0x2b88a0,function(_0x2e394a,_0x41b1f5){if(_0x2e394a){return _0x8af581(_0x2e394a);}pm2[_0xbd37('0x6')]();return _0x19ce57(_0x41b1f5);});});});};exports[_0xbd37('0x7')]=function(_0x50393f){return connect()[_0xbd37('0x5')](function(){return new BPromise(function(_0x3b27a5,_0x20f53b){return pm2[_0xbd37('0x7')](_0x50393f,function(_0x1df678,_0x1f5633){if(_0x1df678){return _0x20f53b(_0x1df678);}pm2[_0xbd37('0x6')]();return _0x3b27a5(_0x1f5633);});});});};exports[_0xbd37('0x8')]=function(){return connect()[_0xbd37('0x5')](function(){return new BPromise(function(_0x4df975,_0x445177){return pm2[_0xbd37('0x8')](function(_0x1a90b6,_0x4a37e3){if(_0x1a90b6){return _0x445177(_0x1a90b6);}pm2[_0xbd37('0x6')]();return _0x4df975(_0x4a37e3);});});});};exports['describe']=function(_0x4e7cf2){return connect()[_0xbd37('0x5')](function(){return new BPromise(function(_0x469610,_0x55de53){return pm2['describe'](_0x4e7cf2,function(_0x53dbf3,_0x17c16f){if(_0x53dbf3){return _0x55de53(_0x53dbf3);}pm2[_0xbd37('0x6')]();return _0x469610(_0x17c16f);});});});};exports[_0xbd37('0x9')]=function(_0x48faaa){return connect()[_0xbd37('0x5')](function(){return new BPromise(function(_0x5721fa,_0x505965){return pm2[_0xbd37('0x9')](_0x48faaa,function(_0x47e5a5,_0x571fca){if(_0x47e5a5){return _0x505965(_0x47e5a5);}pm2[_0xbd37('0x6')]();return _0x5721fa(_0x571fca);});});});};exports[_0xbd37('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x4e6a96,_0x42db96){return pm2['dump'](function(_0x4495ed){if(_0x4495ed){return _0x42db96(_0x4495ed);}return _0x4e6a96(_0xbd37('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 1f1a566..e0b98e3 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 _0xf282=['[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','find','chatTimeout','then','ChatInteraction','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','emit','catch','error'];(function(_0x2aa76d,_0x2e687d){var _0x2941a0=function(_0x549cc5){while(--_0x549cc5){_0x2aa76d['push'](_0x2aa76d['shift']());}};_0x2941a0(++_0x2e687d);}(_0xf282,0x14d));var _0x2f28=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xf282[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var moment=require(_0x2f28('0x0'));var Redis=require(_0x2f28('0x1'));var util=require(_0x2f28('0x2'));var config=require(_0x2f28('0x3'));var db=require(_0x2f28('0x4'))['db'];var logger=require(_0x2f28('0x5'))(_0x2f28('0x6'));config[_0x2f28('0x7')]=_[_0x2f28('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2f28('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x1b5ec3=0x0;var _0x3a07ef=[];return db['Setting'][_0x2f28('0xa')]({'raw':!![],'attributes':['id',_0x2f28('0xb')],'where':{'id':0x1}})[_0x2f28('0xc')](function(_0x39b8b7){_0x1b5ec3=_0x39b8b7[_0x2f28('0xb')];if(_0x1b5ec3){return db[_0x2f28('0xd')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2f28('0xe')](_0x39b8b7['chatTimeout'],_0x2f28('0xf'))}}});}else{return[];}})['then'](function(_0x500dc4){if(_0x500dc4&&_0x500dc4[_0x2f28('0x10')]){_0x3a07ef=_['map'](_0x500dc4||[],'id');logger[_0x2f28('0x11')](_0x2f28('0x12'),_0x3a07ef[_0x2f28('0x13')]());return db[_0x2f28('0xd')][_0x2f28('0x14')]({'closeReason':_0x2f28('0x15'),'disposition':_0x2f28('0x16'),'closed':!![],'closedAt':moment()[_0x2f28('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3a07ef}});}})[_0x2f28('0xc')](function(){if(_0x3a07ef&&_0x3a07ef[_0x2f28('0x10')]){logger[_0x2f28('0x11')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x3a07ef[_0x2f28('0x13')]());for(var _0x4a83cf=0x0;_0x4a83cf<_0x3a07ef['length'];_0x4a83cf++){io[_0x2f28('0x18')]('chatInteraction:update',{'id':_0x3a07ef[_0x4a83cf],'closed':!![]});}}})[_0x2f28('0x19')](function(_0x25b209){logger[_0x2f28('0x1a')](_0x2f28('0x1b'),_0x25b209?util[_0x2f28('0x1c')](_0x25b209,{'showHidden':![],'depth':null}):'');});}exports[_0x2f28('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1e8b=['[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','findAll','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','length'];(function(_0x338f84,_0x24100f){var _0x2e238d=function(_0x18eaa4){while(--_0x18eaa4){_0x338f84['push'](_0x338f84['shift']());}};_0x2e238d(++_0x24100f);}(_0x1e8b,0x180));var _0xb1e8=function(_0x72c11f,_0xc2f446){_0x72c11f=_0x72c11f-0x0;var _0x55ac38=_0x1e8b[_0x72c11f];return _0x55ac38;};'use strict';var _=require('lodash');var moment=require(_0xb1e8('0x0'));var Redis=require('ioredis');var util=require('util');var config=require(_0xb1e8('0x1'));var db=require(_0xb1e8('0x2'))['db'];var logger=require(_0xb1e8('0x3'))(_0xb1e8('0x4'));config[_0xb1e8('0x5')]=_[_0xb1e8('0x6')](config[_0xb1e8('0x5')],{'host':_0xb1e8('0x7'),'port':0x18eb});var io=require(_0xb1e8('0x8'))(new Redis(config[_0xb1e8('0x5')]));function closeInteractions(){var _0x2cdfec=0x0;var _0x86415e=[];return db[_0xb1e8('0x9')]['find']({'raw':!![],'attributes':['id',_0xb1e8('0xa')],'where':{'id':0x1}})[_0xb1e8('0xb')](function(_0x53a3ab){_0x2cdfec=_0x53a3ab[_0xb1e8('0xa')];if(_0x2cdfec){return db[_0xb1e8('0xc')][_0xb1e8('0xd')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x53a3ab[_0xb1e8('0xa')],'minutes')}}});}else{return[];}})[_0xb1e8('0xb')](function(_0x196d55){if(_0x196d55&&_0x196d55['length']){_0x86415e=_['map'](_0x196d55||[],'id');logger[_0xb1e8('0xe')](_0xb1e8('0xf'),_0x86415e[_0xb1e8('0x10')]());return db[_0xb1e8('0xc')][_0xb1e8('0x11')]({'closeReason':_0xb1e8('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xb1e8('0x13')](_0xb1e8('0x14'))},{'where':{'id':_0x86415e}});}})[_0xb1e8('0xb')](function(){if(_0x86415e&&_0x86415e[_0xb1e8('0x15')]){logger[_0xb1e8('0xe')](_0xb1e8('0x16'),_0x86415e[_0xb1e8('0x10')]());for(var _0x3605a0=0x0;_0x3605a0<_0x86415e['length'];_0x3605a0++){io[_0xb1e8('0x17')](_0xb1e8('0x18'),{'id':_0x86415e[_0x3605a0],'closed':!![]});}}})['catch'](function(_0x322b73){logger[_0xb1e8('0x19')](_0xb1e8('0x1a'),_0x322b73?util[_0xb1e8('0x1b')](_0x322b73,{'showHidden':![],'depth':null}):'');});}exports[_0xb1e8('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index d30502f..77a132b 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 _0xf64a=['savename','format','%s.%s','basename','extname','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','start','stop\x20cron','endAt','update','run','util','lodash','moment','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','port','secure','authentication','auth','user','pass','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports'];(function(_0x507f20,_0x471478){var _0x12ee49=function(_0x3475e5){while(--_0x3475e5){_0x507f20['push'](_0x507f20['shift']());}};_0x12ee49(++_0x471478);}(_0xf64a,0xf2));var _0xaf64=function(_0xf2f332,_0x299fbf){_0xf2f332=_0xf2f332-0x0;var _0x56cce3=_0xf64a[_0xf2f332];return _0x56cce3;};'use strict';var fs=require('fs');var util=require(_0xaf64('0x0'));var path=require('path');var _=require(_0xaf64('0x1'));var moment=require(_0xaf64('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xaf64('0x3'));var BPromise=require(_0xaf64('0x4'));var logger=require('../logger')(_0xaf64('0x5'));var db=require(_0xaf64('0x6'))['db'];var analyticCustomReportController=require(_0xaf64('0x7'));var analyticDefaultReportController=require(_0xaf64('0x8'));var client=jayson[_0xaf64('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x118963,_0x1dbc04){return function(){logger['info'](_0xaf64('0xa'),_0x118963['email']);var _0x41917b=!![];var _0x488421={'tls':{'rejectUnauthorized':![]}};if(_0x118963[_0xaf64('0xb')][_0xaf64('0xc')][_0xaf64('0xd')]){_0x488421[_0xaf64('0xd')]=_0x118963['MailAccount']['Smtp']['service'];}else{_0x488421['host']=_0x118963[_0xaf64('0xb')][_0xaf64('0xc')]['host'];_0x488421['port']=_0x118963[_0xaf64('0xb')][_0xaf64('0xc')][_0xaf64('0xe')];_0x488421[_0xaf64('0xf')]=_0x118963[_0xaf64('0xb')][_0xaf64('0xc')][_0xaf64('0xf')];}if(_0x118963['MailAccount'][_0xaf64('0xc')][_0xaf64('0x10')]){_0x488421[_0xaf64('0x11')]={'user':_0x118963['MailAccount'][_0xaf64('0xc')][_0xaf64('0x12')],'pass':_0x118963['MailAccount'][_0xaf64('0xc')][_0xaf64('0x13')]};}var _0x348806={'account':_0x488421,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x118963['MailAccount'][_0xaf64('0x14')],_0x118963[_0xaf64('0xb')][_0xaf64('0x15')]||_0x118963[_0xaf64('0xb')][_0xaf64('0xc')]['user']),'to':_0x118963['email'],'cc':_0x118963['cc'],'bcc':_0x118963[_0xaf64('0x16')],'subject':util['format'](_0xaf64('0x17'),_0x1dbc04[_0xaf64('0x14')],_0x118963[_0xaf64('0x18')],_0x118963[_0xaf64('0x19')])}};var _0x2d6707=path[_0xaf64('0x1a')](__dirname,_0xaf64('0x1b'));var _0x136b0e=_0x1dbc04[_0xaf64('0x1c')];var _0x362537=util[_0xaf64('0x1d')](_0xaf64('0x1e'),path[_0xaf64('0x1f')](_0x1dbc04[_0xaf64('0x1c')],path[_0xaf64('0x20')](_0x1dbc04['savename'])),'zip');var _0x425fe5=path['join'](_0x2d6707,_0x136b0e);var _0x29f2cc=path[_0xaf64('0x1a')](_0x2d6707,_0x362537);if(fs[_0xaf64('0x21')](_0x425fe5)){_0x1dbc04[_0xaf64('0x22')]=_0xaf64('0x23');_0x348806[_0xaf64('0x24')][_0xaf64('0x25')]=[{'filename':_0x136b0e,'path':_0x425fe5}];_0x348806[_0xaf64('0x24')][_0xaf64('0x26')]=util['format'](_0xaf64('0x27'),JSON[_0xaf64('0x28')](_0x1dbc04,null,0x2));}else if(fs['existsSync'](_0x29f2cc)){_0x1dbc04[_0xaf64('0x22')]=_0xaf64('0x23');_0x348806[_0xaf64('0x24')][_0xaf64('0x25')]=[{'filename':_0x362537,'path':_0x29f2cc}];}else{_0x348806['message']['text']=_0xaf64('0x29');if(!_0x118963[_0xaf64('0x2a')]){_0x41917b=![];logger[_0xaf64('0x2b')](_0xaf64('0x2c'));}}if(_0x41917b){return client[_0xaf64('0x2d')](_0xaf64('0x2e'),_0x348806)[_0xaf64('0x2f')](function(_0x2e8cdb){if(_0x2e8cdb['error']){return logger[_0xaf64('0x30')]('error\x20mail',JSON[_0xaf64('0x28')](_0x2e8cdb));}return logger[_0xaf64('0x2b')](_0xaf64('0x31'));})[_0xaf64('0x32')](function(_0x403c14){return logger[_0xaf64('0x30')](_0xaf64('0x33'),JSON[_0xaf64('0x28')](_0x403c14));});}};}function handleError(){return function(_0x26f7ce){return logger[_0xaf64('0x30')](JSON[_0xaf64('0x28')](_0x26f7ce));};}function handleResult(_0x20c144){return function(_0x1e9c1b){logger[_0xaf64('0x2b')](_0xaf64('0x34'),JSON[_0xaf64('0x28')](_0x1e9c1b));if(_0x20c144['MailAccount']&&_0x20c144[_0xaf64('0xb')][_0xaf64('0xc')]&&!_[_0xaf64('0x35')](_0x20c144[_0xaf64('0x15')])){setTimeout(handleSendEmail(_0x20c144,_0x1e9c1b),0x3c*0x3e8);}};}function handleJob(_0x3d8a21){return function(){try{if(_['isNil'](_0x3d8a21['subtractNumber'])){return logger[_0xaf64('0x2b')](_0xaf64('0x36'));}if(_[_0xaf64('0x35')](_0x3d8a21[_0xaf64('0x19')])){return logger[_0xaf64('0x2b')](_0xaf64('0x37'));}var _0x4f0fa2={'startDate':moment()[_0xaf64('0x38')](_0x3d8a21[_0xaf64('0x18')],_0x3d8a21[_0xaf64('0x19')])[_0xaf64('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xaf64('0x1d')](_0xaf64('0x39')),'type':_0xaf64('0x3a'),'output':_0x3d8a21[_0xaf64('0x3b')],'name':_0x3d8a21['name']};if(!_[_0xaf64('0x35')](_0x3d8a21[_0xaf64('0x3c')])){logger[_0xaf64('0x2b')](_0xaf64('0x3d'),_0x3d8a21[_0xaf64('0x3c')]);return analyticDefaultReportController[_0xaf64('0x3e')]({'id':_0x3d8a21[_0xaf64('0x3c')]},_0x4f0fa2)[_0xaf64('0x2f')](handleResult(_0x3d8a21))[_0xaf64('0x32')](handleError());}if(!_[_0xaf64('0x35')](_0x3d8a21[_0xaf64('0x3f')])){logger[_0xaf64('0x2b')](_0xaf64('0x40'),_0x3d8a21['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x3d8a21[_0xaf64('0x3f')]},_0x4f0fa2)[_0xaf64('0x2f')](handleResult(_0x3d8a21))['catch'](handleError());}}catch(_0xd84b56){logger[_0xaf64('0x30')](JSON[_0xaf64('0x28')](_0xd84b56));}return logger['info'](_0xaf64('0x41'));};}function getJobs(_0x280b8f){var _0x50172f={};if(_0x280b8f){_0x50172f['id']=_0x280b8f;}return db[_0xaf64('0x42')][_0xaf64('0x43')]({'where':_0x50172f,'include':[{'model':db[_0xaf64('0xb')],'attributes':['id',_0xaf64('0x14'),_0xaf64('0x15')],'include':[{'model':db[_0xaf64('0x44')],'as':_0xaf64('0xc')}]}]})[_0xaf64('0x2f')](function(_0x3b46da){var _0x144405=_['keys'](manager['jobs']);var _0x5e4fab=_['map'](_0x3b46da,function(_0x393563){return _0x393563['id'][_0xaf64('0x45')]();});var _0x3a7a44=_[_0xaf64('0x46')](_0x3b46da,function(_0x9d3987){return _0x9d3987['id'][_0xaf64('0x45')]();});var _0x153f49=_0x280b8f?_0x5e4fab:_[_0xaf64('0x47')](_0x5e4fab,_0x144405);var _0x849967=_[_0xaf64('0x48')](_0x5e4fab,_0x144405);var _0x1e2214=_[_0xaf64('0x47')](_0x144405,_0x5e4fab);var _0x13345a;var _0x19215a;for(_0x13345a=0x0;_0x13345a<_0x1e2214[_0xaf64('0x49')]&&!_0x280b8f;_0x13345a+=0x1){_0x19215a=_0x1e2214[_0x13345a][_0xaf64('0x45')]();if(manager[_0xaf64('0x4a')](_0x19215a)){manager[_0xaf64('0x4b')](_0x19215a);manager[_0xaf64('0x4c')](_0x19215a);logger[_0xaf64('0x2b')]('delete\x20cron',_0x19215a);}}logger[_0xaf64('0x2b')]('toRun',JSON[_0xaf64('0x28')](_0x153f49));for(_0x13345a=0x0;_0x13345a<_0x153f49[_0xaf64('0x49')];_0x13345a+=0x1){_0x19215a=_0x153f49[_0x13345a]['toString']();logger[_0xaf64('0x2b')](_0xaf64('0x4d'),_0x19215a);if(_0x280b8f){logger[_0xaf64('0x2b')](_0xaf64('0x4e'),_0x280b8f);logger[_0xaf64('0x2b')](JSON[_0xaf64('0x28')](_0x3a7a44[_0x19215a]));BPromise[_0xaf64('0x4f')]()[_0xaf64('0x2f')](handleJob(_0x3a7a44[_0x19215a]));logger['info'](_0xaf64('0x50'),_0x3a7a44[_0x19215a][_0xaf64('0x14')],_0x3a7a44[_0x19215a][_0xaf64('0x51')]);}else if(_0x3a7a44[_0x19215a][_0xaf64('0x51')]&&_0x3a7a44[_0x19215a][_0xaf64('0x52')]&&moment()[_0xaf64('0x53')](_0x3a7a44[_0x19215a][_0xaf64('0x54')],_0x3a7a44[_0x19215a]['endAt'])){manager['add'](_0x19215a,_0x3a7a44[_0x19215a][_0xaf64('0x51')],handleJob(_0x3a7a44[_0x19215a]));manager[_0xaf64('0x55')](_0x19215a);logger[_0xaf64('0x2b')]('add\x20cron',_0x3a7a44[_0x19215a][_0xaf64('0x14')],_0x3a7a44[_0x19215a][_0xaf64('0x51')]);}else if(manager['exists'](_0x19215a)){manager[_0xaf64('0x4b')](_0x19215a);manager[_0xaf64('0x4c')](_0x19215a);logger[_0xaf64('0x2b')](_0xaf64('0x56'),_0x3a7a44[_0x19215a][_0xaf64('0x14')],_0x3a7a44[_0x19215a]['cron']);}}for(_0x13345a=0x0,_0x19215a;_0x13345a<_0x849967[_0xaf64('0x49')]&&!_0x280b8f;_0x13345a+=0x1){_0x19215a=_0x849967[_0x13345a][_0xaf64('0x45')]();if(manager[_0xaf64('0x4a')](_0x19215a)){if(_0x3a7a44[_0x19215a][_0xaf64('0x51')]&&_0x3a7a44[_0x19215a][_0xaf64('0x52')]&&moment()[_0xaf64('0x53')](_0x3a7a44[_0x19215a][_0xaf64('0x54')],_0x3a7a44[_0x19215a][_0xaf64('0x57')])){manager[_0xaf64('0x58')](_0x19215a,_0x3a7a44[_0x19215a][_0xaf64('0x51')],handleJob(_0x3a7a44[_0x19215a]));logger[_0xaf64('0x2b')]('update\x20cron',_0x3a7a44[_0x19215a][_0xaf64('0x14')],_0x3a7a44[_0x19215a][_0xaf64('0x51')]);}else{manager[_0xaf64('0x4b')](_0x19215a);manager[_0xaf64('0x4c')](_0x19215a);logger[_0xaf64('0x2b')]('stop\x20cron',_0x3a7a44[_0x19215a][_0xaf64('0x14')],_0x3a7a44[_0x19215a][_0xaf64('0x51')]);}}}})[_0xaf64('0x32')](function(_0x4f2793){logger[_0xaf64('0x30')](JSON[_0xaf64('0x28')](_0x4f2793));});}exports[_0xaf64('0x59')]=function(_0x51bfbf){return getJobs(_0x51bfbf);};exports[_0xaf64('0x55')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xd161=['length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','update\x20cron','util','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','MailAccount','Smtp','service','host','port','secure','auth','pass','format','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','join','savename','%s.%s','basename','extname','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','then','error','error\x20mail','email\x20sent','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','MailServerOut','keys','jobs','toString','keyBy','difference'];(function(_0x5d2a76,_0x4e8410){var _0x2426fd=function(_0x3eaa10){while(--_0x3eaa10){_0x5d2a76['push'](_0x5d2a76['shift']());}};_0x2426fd(++_0x4e8410);}(_0xd161,0x1b3));var _0x1d16=function(_0x449108,_0x271de3){_0x449108=_0x449108-0x0;var _0x31e342=_0xd161[_0x449108];return _0x31e342;};'use strict';var fs=require('fs');var util=require(_0x1d16('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0x1d16('0x1'));var CronJobManager=require(_0x1d16('0x2'));var jayson=require(_0x1d16('0x3'));var BPromise=require(_0x1d16('0x4'));var logger=require(_0x1d16('0x5'))(_0x1d16('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x1d16('0x7'));var client=jayson[_0x1d16('0x8')][_0x1d16('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x161de5,_0x18c700){return function(){logger[_0x1d16('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x161de5[_0x1d16('0xb')]);var _0x375269=!![];var _0x2864c2={'tls':{'rejectUnauthorized':![]}};if(_0x161de5[_0x1d16('0xc')][_0x1d16('0xd')][_0x1d16('0xe')]){_0x2864c2[_0x1d16('0xe')]=_0x161de5[_0x1d16('0xc')]['Smtp'][_0x1d16('0xe')];}else{_0x2864c2[_0x1d16('0xf')]=_0x161de5[_0x1d16('0xc')][_0x1d16('0xd')][_0x1d16('0xf')];_0x2864c2[_0x1d16('0x10')]=_0x161de5['MailAccount'][_0x1d16('0xd')][_0x1d16('0x10')];_0x2864c2[_0x1d16('0x11')]=_0x161de5[_0x1d16('0xc')][_0x1d16('0xd')][_0x1d16('0x11')];}if(_0x161de5[_0x1d16('0xc')][_0x1d16('0xd')]['authentication']){_0x2864c2[_0x1d16('0x12')]={'user':_0x161de5[_0x1d16('0xc')]['Smtp']['user'],'pass':_0x161de5['MailAccount'][_0x1d16('0xd')][_0x1d16('0x13')]};}var _0xf705f5={'account':_0x2864c2,'message':{'from':util[_0x1d16('0x14')](_0x1d16('0x15'),_0x161de5['MailAccount'][_0x1d16('0x16')],_0x161de5['MailAccount'][_0x1d16('0xb')]||_0x161de5[_0x1d16('0xc')][_0x1d16('0xd')][_0x1d16('0x17')]),'to':_0x161de5['email'],'cc':_0x161de5['cc'],'bcc':_0x161de5[_0x1d16('0x18')],'subject':util[_0x1d16('0x14')](_0x1d16('0x19'),_0x18c700[_0x1d16('0x16')],_0x161de5['subtractNumber'],_0x161de5['subtractUnit'])}};var _0x53cb0d=path[_0x1d16('0x1a')](__dirname,'../../files/reports');var _0x4a39c8=_0x18c700[_0x1d16('0x1b')];var _0x45740b=util[_0x1d16('0x14')](_0x1d16('0x1c'),path[_0x1d16('0x1d')](_0x18c700[_0x1d16('0x1b')],path[_0x1d16('0x1e')](_0x18c700['savename'])),'zip');var _0x200832=path['join'](_0x53cb0d,_0x4a39c8);var _0x38b800=path[_0x1d16('0x1a')](_0x53cb0d,_0x45740b);if(fs[_0x1d16('0x1f')](_0x200832)){_0x18c700[_0x1d16('0x20')]=_0x1d16('0x21');_0xf705f5[_0x1d16('0x22')][_0x1d16('0x23')]=[{'filename':_0x4a39c8,'path':_0x200832}];_0xf705f5[_0x1d16('0x22')][_0x1d16('0x24')]=util[_0x1d16('0x14')](_0x1d16('0x25'),JSON[_0x1d16('0x26')](_0x18c700,null,0x2));}else if(fs[_0x1d16('0x1f')](_0x38b800)){_0x18c700[_0x1d16('0x20')]=_0x1d16('0x21');_0xf705f5['message'][_0x1d16('0x23')]=[{'filename':_0x45740b,'path':_0x38b800}];}else{_0xf705f5[_0x1d16('0x22')][_0x1d16('0x24')]=_0x1d16('0x27');if(!_0x161de5['sendIfEmpty']){_0x375269=![];logger[_0x1d16('0xa')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x375269){return client['request']('SendMail',_0xf705f5)[_0x1d16('0x28')](function(_0x865fee){if(_0x865fee[_0x1d16('0x29')]){return logger['error'](_0x1d16('0x2a'),JSON[_0x1d16('0x26')](_0x865fee));}return logger['info'](_0x1d16('0x2b'));})['catch'](function(_0x27c63a){return logger[_0x1d16('0x29')](_0x1d16('0x2a'),JSON[_0x1d16('0x26')](_0x27c63a));});}};}function handleError(){return function(_0x219391){return logger[_0x1d16('0x29')](JSON['stringify'](_0x219391));};}function handleResult(_0x450a8f){return function(_0x4f0c6e){logger[_0x1d16('0xa')](_0x1d16('0x2c'),JSON[_0x1d16('0x26')](_0x4f0c6e));if(_0x450a8f[_0x1d16('0xc')]&&_0x450a8f[_0x1d16('0xc')][_0x1d16('0xd')]&&!_[_0x1d16('0x2d')](_0x450a8f['email'])){setTimeout(handleSendEmail(_0x450a8f,_0x4f0c6e),0x3c*0x3e8);}};}function handleJob(_0x25f719){return function(){try{if(_[_0x1d16('0x2d')](_0x25f719[_0x1d16('0x2e')])){return logger[_0x1d16('0xa')](_0x1d16('0x2f'));}if(_['isNil'](_0x25f719['subtractUnit'])){return logger[_0x1d16('0xa')]('subtractUnit\x20null\x20or\x20undefined');}var _0x3e4d4d={'startDate':moment()['subtract'](_0x25f719[_0x1d16('0x2e')],_0x25f719['subtractUnit'])['format'](_0x1d16('0x30')),'endDate':moment()[_0x1d16('0x14')](_0x1d16('0x30')),'type':_0x1d16('0x31'),'output':_0x25f719[_0x1d16('0x32')],'name':_0x25f719[_0x1d16('0x16')]};if(!_[_0x1d16('0x2d')](_0x25f719['DefaultReportId'])){logger[_0x1d16('0xa')](_0x1d16('0x33'),_0x25f719['DefaultReportId']);return analyticDefaultReportController[_0x1d16('0x34')]({'id':_0x25f719['DefaultReportId']},_0x3e4d4d)[_0x1d16('0x28')](handleResult(_0x25f719))[_0x1d16('0x35')](handleError());}if(!_['isNil'](_0x25f719[_0x1d16('0x36')])){logger[_0x1d16('0xa')](_0x1d16('0x37'),_0x25f719[_0x1d16('0x36')]);return analyticCustomReportController[_0x1d16('0x34')]({'id':_0x25f719[_0x1d16('0x36')]},_0x3e4d4d)['then'](handleResult(_0x25f719))[_0x1d16('0x35')](handleError());}}catch(_0x14a557){logger[_0x1d16('0x29')](JSON[_0x1d16('0x26')](_0x14a557));}return logger[_0x1d16('0xa')]('no\x20report\x20id');};}function getJobs(_0x102dd9){var _0x4c4219={};if(_0x102dd9){_0x4c4219['id']=_0x102dd9;}return db[_0x1d16('0x38')]['findAll']({'where':_0x4c4219,'include':[{'model':db['MailAccount'],'attributes':['id',_0x1d16('0x16'),_0x1d16('0xb')],'include':[{'model':db[_0x1d16('0x39')],'as':_0x1d16('0xd')}]}]})[_0x1d16('0x28')](function(_0x20072e){var _0x2a9424=_[_0x1d16('0x3a')](manager[_0x1d16('0x3b')]);var _0x14ed2b=_['map'](_0x20072e,function(_0xe52878){return _0xe52878['id'][_0x1d16('0x3c')]();});var _0x1339b2=_[_0x1d16('0x3d')](_0x20072e,function(_0x4aea34){return _0x4aea34['id']['toString']();});var _0x203053=_0x102dd9?_0x14ed2b:_['difference'](_0x14ed2b,_0x2a9424);var _0x517986=_['intersection'](_0x14ed2b,_0x2a9424);var _0x273c36=_[_0x1d16('0x3e')](_0x2a9424,_0x14ed2b);var _0x1eda5b;var _0x1b5974;for(_0x1eda5b=0x0;_0x1eda5b<_0x273c36[_0x1d16('0x3f')]&&!_0x102dd9;_0x1eda5b+=0x1){_0x1b5974=_0x273c36[_0x1eda5b]['toString']();if(manager[_0x1d16('0x40')](_0x1b5974)){manager[_0x1d16('0x41')](_0x1b5974);manager[_0x1d16('0x42')](_0x1b5974);logger['info'](_0x1d16('0x43'),_0x1b5974);}}logger[_0x1d16('0xa')](_0x1d16('0x44'),JSON['stringify'](_0x203053));for(_0x1eda5b=0x0;_0x1eda5b<_0x203053[_0x1d16('0x3f')];_0x1eda5b+=0x1){_0x1b5974=_0x203053[_0x1eda5b][_0x1d16('0x3c')]();logger[_0x1d16('0xa')](_0x1d16('0x45'),_0x1b5974);if(_0x102dd9){logger[_0x1d16('0xa')](_0x1d16('0x46'),_0x102dd9);logger[_0x1d16('0xa')](JSON[_0x1d16('0x26')](_0x1339b2[_0x1b5974]));BPromise['resolve']()['then'](handleJob(_0x1339b2[_0x1b5974]));logger['info'](_0x1d16('0x47'),_0x1339b2[_0x1b5974]['name'],_0x1339b2[_0x1b5974][_0x1d16('0x48')]);}else if(_0x1339b2[_0x1b5974]['cron']&&_0x1339b2[_0x1b5974][_0x1d16('0x49')]&&moment()[_0x1d16('0x4a')](_0x1339b2[_0x1b5974][_0x1d16('0x4b')],_0x1339b2[_0x1b5974][_0x1d16('0x4c')])){manager[_0x1d16('0x4d')](_0x1b5974,_0x1339b2[_0x1b5974]['cron'],handleJob(_0x1339b2[_0x1b5974]));manager[_0x1d16('0x4e')](_0x1b5974);logger[_0x1d16('0xa')](_0x1d16('0x4f'),_0x1339b2[_0x1b5974][_0x1d16('0x16')],_0x1339b2[_0x1b5974]['cron']);}else if(manager['exists'](_0x1b5974)){manager[_0x1d16('0x41')](_0x1b5974);manager['deleteJob'](_0x1b5974);logger[_0x1d16('0xa')](_0x1d16('0x50'),_0x1339b2[_0x1b5974][_0x1d16('0x16')],_0x1339b2[_0x1b5974][_0x1d16('0x48')]);}}for(_0x1eda5b=0x0,_0x1b5974;_0x1eda5b<_0x517986[_0x1d16('0x3f')]&&!_0x102dd9;_0x1eda5b+=0x1){_0x1b5974=_0x517986[_0x1eda5b][_0x1d16('0x3c')]();if(manager[_0x1d16('0x40')](_0x1b5974)){if(_0x1339b2[_0x1b5974][_0x1d16('0x48')]&&_0x1339b2[_0x1b5974][_0x1d16('0x49')]&&moment()[_0x1d16('0x4a')](_0x1339b2[_0x1b5974][_0x1d16('0x4b')],_0x1339b2[_0x1b5974]['endAt'])){manager[_0x1d16('0x51')](_0x1b5974,_0x1339b2[_0x1b5974][_0x1d16('0x48')],handleJob(_0x1339b2[_0x1b5974]));logger[_0x1d16('0xa')](_0x1d16('0x52'),_0x1339b2[_0x1b5974][_0x1d16('0x16')],_0x1339b2[_0x1b5974][_0x1d16('0x48')]);}else{manager[_0x1d16('0x41')](_0x1b5974);manager[_0x1d16('0x42')](_0x1b5974);logger[_0x1d16('0xa')](_0x1d16('0x50'),_0x1339b2[_0x1b5974]['name'],_0x1339b2[_0x1b5974][_0x1d16('0x48')]);}}}})[_0x1d16('0x35')](function(_0x48bf55){logger[_0x1d16('0x29')](JSON[_0x1d16('0x26')](_0x48bf55));});}exports['run']=function(_0x145af9){return getJobs(_0x145af9);};exports[_0x1d16('0x4e')]=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 821d1f9..a15a61b 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 _0x91b6=['Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Negative','SentimentScore','Mixed','Neutral','FAILED','FailureReason','resolve','tempSentiment','findOne','Sentiment','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','push','catch','start','lodash','aws-sdk','util','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated'];(function(_0x43a6dc,_0x42ce1a){var _0x48541e=function(_0x22c2e3){while(--_0x22c2e3){_0x43a6dc['push'](_0x43a6dc['shift']());}};_0x48541e(++_0x42ce1a);}(_0x91b6,0x18b));var _0x691b=function(_0x2cc89c,_0x4c12a7){_0x2cc89c=_0x2cc89c-0x0;var _0x6c677=_0x91b6[_0x2cc89c];return _0x6c677;};var _=require(_0x691b('0x0'));var AWS=require(_0x691b('0x1'));var rp=require('request-promise');var util=require(_0x691b('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x691b('0x3'))(_0x691b('0x4'));function getTranscriptionJob(_0x22cf2d,_0x28f581,_0xeca3c,_0x3e19d0){return new Promise(function(_0x585420,_0x5586b9){var _0x448027=new AWS[(_0x691b('0x5'))]({'accessKeyId':_0x28f581,'secretAccessKey':_0x22cf2d,'region':_0xeca3c});_0x448027['getTranscriptionJob']({'TranscriptionJobName':_0x3e19d0},function(_0x223632,_0xceca6a){if(_0x223632){return _0x5586b9(_0x223632);}else{return _0x585420(_0xceca6a);}});});}function sentiment(_0x2fdbf8,_0x17aa85,_0xbd8767,_0x30204f,_0xc49113){return new Promise(function(_0x1073cb,_0x5ad4a9){var _0x3a4377=new AWS[(_0x691b('0x6'))]({'accessKeyId':_0x17aa85,'secretAccessKey':_0x2fdbf8,'region':_0xbd8767});_0x3a4377[_0x691b('0x7')]({'Text':_0x30204f,'LanguageCode':_0xc49113[_0x691b('0x8')](0x0,0x2)},function(_0x128bbf,_0x31eeb6){if(_0x128bbf){return _0x5ad4a9(_0x128bbf);}else{return _0x1073cb(_0x31eeb6);}});});}function checkTranscribeJob(_0x494e02,_0x3abde0,_0x152ebb){var _0xb9cc85;return new BPromise(function(_0x72a1eb,_0x592151){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0xb'),_0x494e02['id'],_0x494e02[_0x691b('0xc')]));return getTranscriptionJob(_0x152ebb[_0x691b('0xd')],_0x152ebb[_0x691b('0xe')],_0x3abde0[_0x691b('0xf')],_0x494e02['transcribeName'])[_0x691b('0x10')](function(_0x5952df){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x11'),_0x494e02['id'],_0x494e02[_0x691b('0xc')],_0x5952df[_0x691b('0x12')]['TranscriptionJobStatus']));if(!_0x494e02[_0x691b('0x13')]){switch(_0x5952df[_0x691b('0x12')][_0x691b('0x14')]){case _0x691b('0x15'):var _0x15ed6b={'transcribeStatus':_0x5952df['TranscriptionJob'][_0x691b('0x14')],'fileUri':_0x5952df[_0x691b('0x12')][_0x691b('0x16')][_0x691b('0x17')]};logger[_0x691b('0x9')](util[_0x691b('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x494e02['id']));return rp({'uri':_0x5952df[_0x691b('0x12')][_0x691b('0x16')]['TranscriptFileUri'],'json':!![]})[_0x691b('0x10')](function(_0x3d5a84){logger[_0x691b('0x9')](util['format'](_0x691b('0x18'),_0x494e02['id']));if(_0x3d5a84&&_0x3d5a84[_0x691b('0x19')]&&_0x3d5a84[_0x691b('0x19')]['transcripts']&&_0x3d5a84[_0x691b('0x19')][_0x691b('0x1a')]['length']){_0x15ed6b[_0x691b('0x13')]='';for(var _0x43ad07=0x0;_0x43ad07<_0x3d5a84[_0x691b('0x19')][_0x691b('0x1a')][_0x691b('0x1b')];_0x43ad07++){_0x15ed6b[_0x691b('0x13')]+=_0x3d5a84[_0x691b('0x19')]['transcripts'][_0x43ad07][_0x691b('0x1c')]+'';}}return _0x494e02[_0x691b('0x1d')](_0x15ed6b);})['then'](function(){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x1e'),_0x494e02['id']));if(!_0x494e02['tempSentiment']){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3abde0[_0x691b('0x21')]||!_0x3abde0[_0x691b('0x22')]||!_0x3abde0[_0x691b('0x23')]||!_0x3abde0['language']||!_0x3abde0[_0x691b('0x24')]){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))](_0x691b('0x25'));}if(!_0x15ed6b[_0x691b('0x13')]){throw new Error(_0x691b('0x26'));}if(_0x3abde0[_0x691b('0x22')]===_0x152ebb['id']){return _0x152ebb;}else{return db[_0x691b('0x27')]['findOne']({'where':{'id':_settings[_0x691b('0x22')]}});}})[_0x691b('0x10')](function(_0x1aa5aa){if(!_0x1aa5aa){throw new db['Sequelize'][(_0x691b('0x20'))](_0x691b('0x28'));}if(!_0x1aa5aa['data1']||!_0x1aa5aa[_0x691b('0xe')]){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))](_0x691b('0x29'));}_0xb9cc85=_0x1aa5aa;logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x2a'),_0x494e02['id']));return sentiment(_0xb9cc85[_0x691b('0xd')],_0xb9cc85['data2'],_0x3abde0[_0x691b('0x23')],_0x15ed6b[_0x691b('0x13')],_0x3abde0[_0x691b('0x2b')]);})['then'](function(_0x110827){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x2c'),_0x494e02['id']));return _0x494e02[_0x691b('0x1d')]({'sentiment':_0x110827['Sentiment'],'sPositive':_0x110827['SentimentScore'][_0x691b('0x2d')],'sNegative':_0x110827['SentimentScore'][_0x691b('0x2e')],'sMixed':_0x110827[_0x691b('0x2f')][_0x691b('0x30')],'sNeutral':_0x110827[_0x691b('0x2f')][_0x691b('0x31')]});})[_0x691b('0x10')](function(){logger[_0x691b('0x9')](util[_0x691b('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x494e02['id']));_0x72a1eb();});case'FAILED':return _0x494e02[_0x691b('0x1d')]({'transcribeStatus':_0x691b('0x32'),'failureReason':_0x5952df[_0x691b('0x12')][_0x691b('0x33')]})[_0x691b('0x10')](function(){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x1e'),_0x494e02['id']));_0x72a1eb();});default:logger[_0x691b('0x9')](util[_0x691b('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x494e02['id']));break;}}else{return BPromise[_0x691b('0x34')]()[_0x691b('0x10')](function(){if(!_0x494e02[_0x691b('0x35')]){throw new db[(_0x691b('0x1f'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3abde0[_0x691b('0x21')]||!_0x3abde0[_0x691b('0x22')]||!_0x3abde0[_0x691b('0x23')]||!_0x3abde0['language']||!_0x3abde0['bucket']){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))](_0x691b('0x25'));}if(!_0x494e02[_0x691b('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x3abde0['sentimentAccountId']===_0x152ebb['id']){return _0x152ebb;}else{return db[_0x691b('0x27')][_0x691b('0x36')]({'where':{'id':_settings[_0x691b('0x22')]}});}})[_0x691b('0x10')](function(_0x280805){if(!_0x280805){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x280805['data1']||!_0x280805['data2']){throw new db['Sequelize'][(_0x691b('0x20'))](_0x691b('0x29'));}_0xb9cc85=_0x280805;logger['info'](util['format'](_0x691b('0x2a'),_0x494e02['id']));return sentiment(_0xb9cc85[_0x691b('0xd')],_0xb9cc85[_0x691b('0xe')],_0x3abde0[_0x691b('0x23')],_0x494e02[_0x691b('0x13')],_0x3abde0[_0x691b('0x2b')]);})[_0x691b('0x10')](function(_0x5440f1){logger[_0x691b('0x9')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x494e02['id']));return _0x494e02['update']({'sentiment':_0x5440f1[_0x691b('0x37')],'sPositive':_0x5440f1[_0x691b('0x2f')][_0x691b('0x2d')],'sNegative':_0x5440f1[_0x691b('0x2f')][_0x691b('0x2e')],'sMixed':_0x5440f1[_0x691b('0x2f')][_0x691b('0x30')],'sNeutral':_0x5440f1['SentimentScore'][_0x691b('0x31')],'transcribeStatus':_0x691b('0x15')});})[_0x691b('0x10')](function(){logger[_0x691b('0x9')](util[_0x691b('0xa')](_0x691b('0x1e'),_0x494e02['id']));_0x72a1eb();});}})['catch'](function(_0x1c1886){if(_0x1c1886){if(!_0x1c1886[_0x691b('0x38')]||_0x1c1886[_0x691b('0x38')]!==_0x691b('0x39')){logger[_0x691b('0x3a')](util[_0x691b('0xa')](_0x691b('0x3b'),_0x494e02['id']),util[_0x691b('0x3c')](_0x1c1886,{'showHidden':![],'depth':null}));}}_0x72a1eb();});});}function checkTranscribe(){var _0x5566ec;var _0x47f491;var _0x5dac4d;return db[_0x691b('0x3d')][_0x691b('0x3e')]({'where':{'transcribeStatus':_0x691b('0x3f')}})[_0x691b('0x10')](function(_0x3d69f5){if(!_0x3d69f5||!_0x3d69f5[_0x691b('0x1b')]){throw new db['Sequelize']['ValidationError'](_0x691b('0x40'));}_0x5566ec=_0x3d69f5;return db[_0x691b('0x41')][_0x691b('0x36')]({'where':{'id':0x1}});})[_0x691b('0x10')](function(_0x476b7f){if(!_0x476b7f){throw new db[(_0x691b('0x1f'))]['ValidationError'](_0x691b('0x42'));}_0x47f491=_0x476b7f;if(!_0x47f491[_0x691b('0x4')]||!_0x47f491[_0x691b('0x43')]||!_0x47f491[_0x691b('0xf')]||!_0x47f491['language']||!_0x47f491[_0x691b('0x24')]){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))]('Transcribe\x20not\x20configured');}return db[_0x691b('0x27')][_0x691b('0x36')]({'where':{'id':_0x47f491[_0x691b('0x43')]}});})[_0x691b('0x10')](function(_0x8c51c7){if(!_0x8c51c7){throw new db['Sequelize'][(_0x691b('0x20'))](_0x691b('0x28'));}if(!_0x8c51c7[_0x691b('0xd')]||!_0x8c51c7[_0x691b('0xe')]){throw new db[(_0x691b('0x1f'))][(_0x691b('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x5dac4d=_0x8c51c7;var _0x40964a=[];_0x5566ec['forEach'](function(_0x4be219){_0x40964a[_0x691b('0x44')](checkTranscribeJob(_0x4be219,_0x47f491,_0x5dac4d));});return BPromise['all'](_0x40964a);})[_0x691b('0x45')](function(_0x4b79b0){if(_0x4b79b0){if(!_0x4b79b0['name']||_0x4b79b0[_0x691b('0x38')]!==_0x691b('0x39')){logger['error'](util[_0x691b('0x3c')](_0x4b79b0,{'showHidden':![],'depth':null}));}}});}exports[_0x691b('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xb676=['transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Neutral','COMPLETED','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','lodash','request-promise','util','bluebird','../../mysqldb','TranscribeService','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length'];(function(_0x23c550,_0x7e41c4){var _0x5635b1=function(_0x68f9ce){while(--_0x68f9ce){_0x23c550['push'](_0x23c550['shift']());}};_0x5635b1(++_0x7e41c4);}(_0xb676,0xbc));var _0x6b67=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xb676[_0x562f3b];return _0x1edd55;};var _=require(_0x6b67('0x0'));var AWS=require('aws-sdk');var rp=require(_0x6b67('0x1'));var util=require(_0x6b67('0x2'));var BPromise=require(_0x6b67('0x3'));var db=require(_0x6b67('0x4'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x1ed5cd,_0xa6e590,_0x4dee9f,_0xfe7fb8){return new Promise(function(_0x58628e,_0x16597c){var _0x45cab7=new AWS[(_0x6b67('0x5'))]({'accessKeyId':_0xa6e590,'secretAccessKey':_0x1ed5cd,'region':_0x4dee9f});_0x45cab7['getTranscriptionJob']({'TranscriptionJobName':_0xfe7fb8},function(_0x5659fc,_0x1f3234){if(_0x5659fc){return _0x16597c(_0x5659fc);}else{return _0x58628e(_0x1f3234);}});});}function sentiment(_0x43bfd4,_0x561a78,_0xd783d8,_0xe69a03,_0x58f003){return new Promise(function(_0x180e08,_0x3bcf98){var _0x37abb0=new AWS[(_0x6b67('0x6'))]({'accessKeyId':_0x561a78,'secretAccessKey':_0x43bfd4,'region':_0xd783d8});_0x37abb0['detectSentiment']({'Text':_0xe69a03,'LanguageCode':_0x58f003[_0x6b67('0x7')](0x0,0x2)},function(_0x48ea70,_0x1778d1){if(_0x48ea70){return _0x3bcf98(_0x48ea70);}else{return _0x180e08(_0x1778d1);}});});}function checkTranscribeJob(_0x25c0f8,_0x1ebceb,_0x2ab6c5){var _0x3e1bc6;return new BPromise(function(_0x30d92b,_0x4242c8){logger[_0x6b67('0x8')](util[_0x6b67('0x9')](_0x6b67('0xa'),_0x25c0f8['id'],_0x25c0f8[_0x6b67('0xb')]));return getTranscriptionJob(_0x2ab6c5['data1'],_0x2ab6c5[_0x6b67('0xc')],_0x1ebceb[_0x6b67('0xd')],_0x25c0f8['transcribeName'])[_0x6b67('0xe')](function(_0x1b6c60){logger[_0x6b67('0x8')](util[_0x6b67('0x9')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x25c0f8['id'],_0x25c0f8[_0x6b67('0xb')],_0x1b6c60[_0x6b67('0xf')][_0x6b67('0x10')]));if(!_0x25c0f8[_0x6b67('0x11')]){switch(_0x1b6c60[_0x6b67('0xf')][_0x6b67('0x10')]){case'COMPLETED':var _0x1e01b9={'transcribeStatus':_0x1b6c60['TranscriptionJob'][_0x6b67('0x10')],'fileUri':_0x1b6c60[_0x6b67('0xf')][_0x6b67('0x12')][_0x6b67('0x13')]};logger['info'](util[_0x6b67('0x9')](_0x6b67('0x14'),_0x25c0f8['id']));return rp({'uri':_0x1b6c60[_0x6b67('0xf')]['Transcript'][_0x6b67('0x13')],'json':!![]})[_0x6b67('0xe')](function(_0x1fedd5){logger['info'](util[_0x6b67('0x9')](_0x6b67('0x15'),_0x25c0f8['id']));if(_0x1fedd5&&_0x1fedd5[_0x6b67('0x16')]&&_0x1fedd5[_0x6b67('0x16')][_0x6b67('0x17')]&&_0x1fedd5[_0x6b67('0x16')][_0x6b67('0x17')][_0x6b67('0x18')]){_0x1e01b9[_0x6b67('0x11')]='';for(var _0x39bfb2=0x0;_0x39bfb2<_0x1fedd5[_0x6b67('0x16')]['transcripts'][_0x6b67('0x18')];_0x39bfb2++){_0x1e01b9[_0x6b67('0x11')]+=_0x1fedd5[_0x6b67('0x16')]['transcripts'][_0x39bfb2][_0x6b67('0x19')]+'';}}return _0x25c0f8[_0x6b67('0x1a')](_0x1e01b9);})['then'](function(){logger[_0x6b67('0x8')](util[_0x6b67('0x9')](_0x6b67('0x1b'),_0x25c0f8['id']));if(!_0x25c0f8[_0x6b67('0x1c')]){throw new db[(_0x6b67('0x1d'))][(_0x6b67('0x1e'))](_0x6b67('0x1f'));}if(!_0x1ebceb['sentiment']||!_0x1ebceb[_0x6b67('0x20')]||!_0x1ebceb[_0x6b67('0x21')]||!_0x1ebceb[_0x6b67('0x22')]||!_0x1ebceb[_0x6b67('0x23')]){throw new db[(_0x6b67('0x1d'))][(_0x6b67('0x1e'))](_0x6b67('0x24'));}if(!_0x1e01b9[_0x6b67('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x1ebceb[_0x6b67('0x20')]===_0x2ab6c5['id']){return _0x2ab6c5;}else{return db[_0x6b67('0x25')][_0x6b67('0x26')]({'where':{'id':_settings[_0x6b67('0x20')]}});}})[_0x6b67('0xe')](function(_0x1a7e6b){if(!_0x1a7e6b){throw new db['Sequelize']['ValidationError'](_0x6b67('0x27'));}if(!_0x1a7e6b[_0x6b67('0x28')]||!_0x1a7e6b[_0x6b67('0xc')]){throw new db[(_0x6b67('0x1d'))]['ValidationError'](_0x6b67('0x29'));}_0x3e1bc6=_0x1a7e6b;logger['info'](util[_0x6b67('0x9')](_0x6b67('0x2a'),_0x25c0f8['id']));return sentiment(_0x3e1bc6[_0x6b67('0x28')],_0x3e1bc6['data2'],_0x1ebceb[_0x6b67('0x21')],_0x1e01b9[_0x6b67('0x11')],_0x1ebceb[_0x6b67('0x22')]);})['then'](function(_0x44e09a){logger[_0x6b67('0x8')](util[_0x6b67('0x9')](_0x6b67('0x2b'),_0x25c0f8['id']));return _0x25c0f8[_0x6b67('0x1a')]({'sentiment':_0x44e09a[_0x6b67('0x2c')],'sPositive':_0x44e09a[_0x6b67('0x2d')][_0x6b67('0x2e')],'sNegative':_0x44e09a[_0x6b67('0x2d')][_0x6b67('0x2f')],'sMixed':_0x44e09a[_0x6b67('0x2d')][_0x6b67('0x30')],'sNeutral':_0x44e09a[_0x6b67('0x2d')]['Neutral']});})[_0x6b67('0xe')](function(){logger[_0x6b67('0x8')](util[_0x6b67('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x25c0f8['id']));_0x30d92b();});case _0x6b67('0x31'):return _0x25c0f8[_0x6b67('0x1a')]({'transcribeStatus':_0x6b67('0x31'),'failureReason':_0x1b6c60[_0x6b67('0xf')]['FailureReason']})['then'](function(){logger[_0x6b67('0x8')](util[_0x6b67('0x9')](_0x6b67('0x1b'),_0x25c0f8['id']));_0x30d92b();});default:logger[_0x6b67('0x8')](util[_0x6b67('0x9')](_0x6b67('0x32'),_0x25c0f8['id']));break;}}else{return BPromise[_0x6b67('0x33')]()[_0x6b67('0xe')](function(){if(!_0x25c0f8[_0x6b67('0x1c')]){throw new db[(_0x6b67('0x1d'))][(_0x6b67('0x1e'))](_0x6b67('0x1f'));}if(!_0x1ebceb[_0x6b67('0x34')]||!_0x1ebceb[_0x6b67('0x20')]||!_0x1ebceb[_0x6b67('0x21')]||!_0x1ebceb[_0x6b67('0x22')]||!_0x1ebceb['bucket']){throw new db['Sequelize'][(_0x6b67('0x1e'))](_0x6b67('0x24'));}if(!_0x25c0f8[_0x6b67('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x1ebceb[_0x6b67('0x20')]===_0x2ab6c5['id']){return _0x2ab6c5;}else{return db['CloudProvider'][_0x6b67('0x26')]({'where':{'id':_settings[_0x6b67('0x20')]}});}})[_0x6b67('0xe')](function(_0x1f8224){if(!_0x1f8224){throw new db[(_0x6b67('0x1d'))][(_0x6b67('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1f8224['data1']||!_0x1f8224['data2']){throw new db['Sequelize'][(_0x6b67('0x1e'))](_0x6b67('0x29'));}_0x3e1bc6=_0x1f8224;logger['info'](util[_0x6b67('0x9')](_0x6b67('0x2a'),_0x25c0f8['id']));return sentiment(_0x3e1bc6[_0x6b67('0x28')],_0x3e1bc6['data2'],_0x1ebceb[_0x6b67('0x21')],_0x25c0f8[_0x6b67('0x11')],_0x1ebceb['language']);})['then'](function(_0x47e592){logger[_0x6b67('0x8')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x25c0f8['id']));return _0x25c0f8[_0x6b67('0x1a')]({'sentiment':_0x47e592[_0x6b67('0x2c')],'sPositive':_0x47e592['SentimentScore'][_0x6b67('0x2e')],'sNegative':_0x47e592[_0x6b67('0x2d')][_0x6b67('0x2f')],'sMixed':_0x47e592[_0x6b67('0x2d')][_0x6b67('0x30')],'sNeutral':_0x47e592[_0x6b67('0x2d')][_0x6b67('0x35')],'transcribeStatus':_0x6b67('0x36')});})['then'](function(){logger[_0x6b67('0x8')](util[_0x6b67('0x9')](_0x6b67('0x1b'),_0x25c0f8['id']));_0x30d92b();});}})[_0x6b67('0x37')](function(_0x32a5e3){if(_0x32a5e3){if(!_0x32a5e3['name']||_0x32a5e3[_0x6b67('0x38')]!==_0x6b67('0x39')){logger['error'](util[_0x6b67('0x9')](_0x6b67('0x3a'),_0x25c0f8['id']),util[_0x6b67('0x3b')](_0x32a5e3,{'showHidden':![],'depth':null}));}}_0x30d92b();});});}function checkTranscribe(){var _0x36a7c3;var _0x46efc4;var _0x7257d0;return db[_0x6b67('0x3c')][_0x6b67('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x6b67('0xe')](function(_0x359807){if(!_0x359807||!_0x359807[_0x6b67('0x18')]){throw new db[(_0x6b67('0x1d'))]['ValidationError'](_0x6b67('0x3e'));}_0x36a7c3=_0x359807;return db[_0x6b67('0x3f')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x3110b3){if(!_0x3110b3){throw new db[(_0x6b67('0x1d'))][(_0x6b67('0x1e'))](_0x6b67('0x40'));}_0x46efc4=_0x3110b3;if(!_0x46efc4[_0x6b67('0x41')]||!_0x46efc4['transcribeAccountId']||!_0x46efc4[_0x6b67('0xd')]||!_0x46efc4[_0x6b67('0x22')]||!_0x46efc4[_0x6b67('0x23')]){throw new db[(_0x6b67('0x1d'))][(_0x6b67('0x1e'))](_0x6b67('0x42'));}return db[_0x6b67('0x25')][_0x6b67('0x26')]({'where':{'id':_0x46efc4[_0x6b67('0x43')]}});})['then'](function(_0x3a6078){if(!_0x3a6078){throw new db[(_0x6b67('0x1d'))][(_0x6b67('0x1e'))](_0x6b67('0x27'));}if(!_0x3a6078[_0x6b67('0x28')]||!_0x3a6078[_0x6b67('0xc')]){throw new db['Sequelize'][(_0x6b67('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x7257d0=_0x3a6078;var _0x30a67=[];_0x36a7c3[_0x6b67('0x44')](function(_0x4437f2){_0x30a67[_0x6b67('0x45')](checkTranscribeJob(_0x4437f2,_0x46efc4,_0x7257d0));});return BPromise[_0x6b67('0x46')](_0x30a67);})['catch'](function(_0x4ee98a){if(_0x4ee98a){if(!_0x4ee98a[_0x6b67('0x38')]||_0x4ee98a[_0x6b67('0x38')]!=='SequelizeValidationError'){logger['error'](util[_0x6b67('0x3b')](_0x4ee98a,{'showHidden':![],'depth':null}));}}});}exports['start']=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 e30023a..c27478e 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 _0xa4f4=['util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','moment','ioredis'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xa4f4,0xf6));var _0x4a4f=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xa4f4[_0x2aea9e];return _0x430b92;};'use strict';var _=require('lodash');var moment=require(_0x4a4f('0x0'));var Redis=require(_0x4a4f('0x1'));var util=require(_0x4a4f('0x2'));var config=require(_0x4a4f('0x3'));var db=require(_0x4a4f('0x4'))['db'];var logger=require(_0x4a4f('0x5'))(_0x4a4f('0x6'));config[_0x4a4f('0x7')]=_[_0x4a4f('0x8')](config[_0x4a4f('0x7')],{'host':_0x4a4f('0x9'),'port':0x18eb});var io=require(_0x4a4f('0xa'))(new Redis(config[_0x4a4f('0x7')]));function closeInteractions(){var _0x34c739=[];return db[_0x4a4f('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x4a4f('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4a4f('0xd')](0x18,'hours')}}})[_0x4a4f('0xe')](function(_0x370180){if(_0x370180&&_0x370180[_0x4a4f('0xf')]){_0x34c739=_[_0x4a4f('0x10')](_0x370180||[],'id');logger['info'](_0x4a4f('0x11'),_0x34c739[_0x4a4f('0x12')]());return db[_0x4a4f('0xb')]['update']({'closeReason':_0x4a4f('0x13'),'disposition':_0x4a4f('0x14'),'closed':!![],'closedAt':moment()[_0x4a4f('0x15')](_0x4a4f('0x16'))},{'where':{'id':_0x34c739}});}})['then'](function(){if(_0x34c739&&_0x34c739[_0x4a4f('0xf')]){logger[_0x4a4f('0x17')](_0x4a4f('0x18'),_0x34c739[_0x4a4f('0x12')]());for(var _0x1c1b5c=0x0;_0x1c1b5c<_0x34c739[_0x4a4f('0xf')];_0x1c1b5c++){io[_0x4a4f('0x19')](_0x4a4f('0x1a'),{'id':_0x34c739[_0x1c1b5c],'closed':!![]});}}})[_0x4a4f('0x1b')](function(_0x34e643){logger[_0x4a4f('0x1c')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x34e643?util[_0x4a4f('0x1d')](_0x34e643,{'showHidden':![],'depth':null}):'');});}exports[_0x4a4f('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf17a=['[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','findAll','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','timeout','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0xf17a,0x136));var _0xaf17=function(_0x41c05e,_0x597110){_0x41c05e=_0x41c05e-0x0;var _0x14e5f3=_0xf17a[_0x41c05e];return _0x14e5f3;};'use strict';var _=require(_0xaf17('0x0'));var moment=require(_0xaf17('0x1'));var Redis=require(_0xaf17('0x2'));var util=require(_0xaf17('0x3'));var config=require(_0xaf17('0x4'));var db=require(_0xaf17('0x5'))['db'];var logger=require('../logger')('schedule');config['redis']=_[_0xaf17('0x6')](config[_0xaf17('0x7')],{'host':_0xaf17('0x8'),'port':0x18eb});var io=require(_0xaf17('0x9'))(new Redis(config[_0xaf17('0x7')]));function closeInteractions(){var _0xbbe5ee=[];return db['WhatsappInteraction'][_0xaf17('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xaf17('0xb')](0x18,_0xaf17('0xc'))}}})[_0xaf17('0xd')](function(_0x57669d){if(_0x57669d&&_0x57669d[_0xaf17('0xe')]){_0xbbe5ee=_[_0xaf17('0xf')](_0x57669d||[],'id');logger[_0xaf17('0x10')](_0xaf17('0x11'),_0xbbe5ee[_0xaf17('0x12')]());return db[_0xaf17('0x13')][_0xaf17('0x14')]({'closeReason':'system','disposition':_0xaf17('0x15'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xbbe5ee}});}})[_0xaf17('0xd')](function(){if(_0xbbe5ee&&_0xbbe5ee[_0xaf17('0xe')]){logger[_0xaf17('0x10')](_0xaf17('0x16'),_0xbbe5ee[_0xaf17('0x12')]());for(var _0x566dcd=0x0;_0x566dcd<_0xbbe5ee[_0xaf17('0xe')];_0x566dcd++){io[_0xaf17('0x17')](_0xaf17('0x18'),{'id':_0xbbe5ee[_0x566dcd],'closed':!![]});}}})[_0xaf17('0x19')](function(_0x24fd85){logger['error'](_0xaf17('0x1a'),_0x24fd85?util[_0xaf17('0x1b')](_0x24fd85,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 67ed8f9..91c48cc 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7634=['push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','log','contacts1','CmHopper','bulkCreate','finished\x20populating','hopper1','contacts2','catch','util','../mysqldb'];(function(_0x4332fb,_0x57977a){var _0x1e8335=function(_0x1d14f9){while(--_0x1d14f9){_0x4332fb['push'](_0x4332fb['shift']());}};_0x1e8335(++_0x57977a);}(_0x7634,0x70));var _0x4763=function(_0x11f6de,_0xdeae3b){_0x11f6de=_0x11f6de-0x0;var _0x3b912b=_0x7634[_0x11f6de];return _0x3b912b;};'use strict';var util=require(_0x4763('0x0'));var db=require(_0x4763('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4763('0x2')]({'id':i,'firstName':_0x4763('0x3')+i,'lastName':_0x4763('0x4')+i,'phone':0xf879fb460+i,'email':_0x4763('0x5')+i+_0x4763('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4763('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4763('0x7')](),'updatedAt':Date[_0x4763('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4763('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x4763('0x4')+i,'phone':0xf879fb460+i,'email':_0x4763('0x5')+i+_0x4763('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x4763('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4763('0x7')](),'updatedAt':Date[_0x4763('0x7')]()});}db[_0x4763('0x8')][_0x4763('0x9')]({'where':{}})[_0x4763('0xa')](function(){return db[_0x4763('0x8')]['bulkCreate'](contacts);})[_0x4763('0xa')](function(){console[_0x4763('0xb')]('finished\x20populating',_0x4763('0xc'));return db['CmHopper'][_0x4763('0x9')]({'where':{}});})[_0x4763('0xa')](function(){return db[_0x4763('0xd')][_0x4763('0xe')](hopper);})[_0x4763('0xa')](function(){console[_0x4763('0xb')](_0x4763('0xf'),_0x4763('0x10'));return db[_0x4763('0x8')][_0x4763('0xe')](contacts2);})[_0x4763('0xa')](function(){console[_0x4763('0xb')]('finished\x20populating',_0x4763('0x11'));return db['CmHopper']['bulkCreate'](hopper2);})['then'](function(){console['log'](_0x4763('0xf'),'hopper2');})[_0x4763('0x12')](function(_0x32f1f4){console[_0x4763('0xb')](_0x32f1f4);}); \ No newline at end of file +var _0xbff2=['contacts2','hopper2','catch','util','Innocenzo','Biondo','innocenzo.biondo','push','now','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate'];(function(_0x411eb5,_0x2cd241){var _0x338798=function(_0x25013f){while(--_0x25013f){_0x411eb5['push'](_0x411eb5['shift']());}};_0x338798(++_0x2cd241);}(_0xbff2,0x69));var _0x2bff=function(_0x53366a,_0x4435bd){_0x53366a=_0x53366a-0x0;var _0x16a06f=_0xbff2[_0x53366a];return _0x16a06f;};'use strict';var util=require(_0x2bff('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x2bff('0x1')+i,'lastName':_0x2bff('0x2')+i,'phone':0xf879fb460+i,'email':_0x2bff('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2bff('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x2bff('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2bff('0x5')](),'updatedAt':Date[_0x2bff('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2bff('0x4')]({'id':i,'firstName':_0x2bff('0x1')+i,'lastName':_0x2bff('0x2')+i,'phone':0xf879fb460+i,'email':_0x2bff('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2bff('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x2bff('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2bff('0x5')](),'updatedAt':Date[_0x2bff('0x5')]()});}db[_0x2bff('0x6')][_0x2bff('0x7')]({'where':{}})[_0x2bff('0x8')](function(){return db[_0x2bff('0x6')]['bulkCreate'](contacts);})['then'](function(){console[_0x2bff('0x9')](_0x2bff('0xa'),_0x2bff('0xb'));return db[_0x2bff('0xc')][_0x2bff('0x7')]({'where':{}});})[_0x2bff('0x8')](function(){return db[_0x2bff('0xc')][_0x2bff('0xd')](hopper);})[_0x2bff('0x8')](function(){console['log'](_0x2bff('0xa'),'hopper1');return db[_0x2bff('0x6')][_0x2bff('0xd')](contacts2);})[_0x2bff('0x8')](function(){console[_0x2bff('0x9')](_0x2bff('0xa'),_0x2bff('0xe'));return db[_0x2bff('0xc')]['bulkCreate'](hopper2);})['then'](function(){console[_0x2bff('0x9')](_0x2bff('0xa'),_0x2bff('0xf'));})[_0x2bff('0x10')](function(_0x16e319){console['log'](_0x16e319);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 7f14242..380c97e 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab66=['%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','catch','util','../mysqldb','push','format','%s%s','agent'];(function(_0x4a007c,_0x810025){var _0x19f12b=function(_0x5f12f3){while(--_0x5f12f3){_0x4a007c['push'](_0x4a007c['shift']());}};_0x19f12b(++_0x810025);}(_0xab66,0x125));var _0x6ab6=function(_0x870992,_0x3634b7){_0x870992=_0x870992-0x0;var _0x2c1dfb=_0xab66[_0x870992];return _0x2c1dfb;};'use strict';var util=require(_0x6ab6('0x0'));var db=require(_0x6ab6('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x6ab6('0x2')]({'name':util[_0x6ab6('0x3')](_0x6ab6('0x4'),'agent',i),'fullname':util['format'](_0x6ab6('0x4'),_0x6ab6('0x5'),i),'email':util[_0x6ab6('0x3')](_0x6ab6('0x6'),'agent',i),'role':'agent','password':_0x6ab6('0x7'),'internal':0xfa0+i,'type':_0x6ab6('0x8'),'transport':[_0x6ab6('0x9'),'ws',_0x6ab6('0xa')],'disallow':[_0x6ab6('0xb')],'allow':[_0x6ab6('0xc')],'defaultuser':util[_0x6ab6('0x3')](_0x6ab6('0x4'),_0x6ab6('0x5'),i),'encryption':_0x6ab6('0xd'),'avpf':_0x6ab6('0xd'),'force_avp':_0x6ab6('0xd'),'icesupport':_0x6ab6('0xd'),'dtlsenable':_0x6ab6('0xd'),'dtlsverify':'no','dtlscertfile':_0x6ab6('0xe'),'dtlsprivatekey':_0x6ab6('0xf'),'dtlssetup':_0x6ab6('0x10'),'callerid':util[_0x6ab6('0x3')](_0x6ab6('0x11'),util[_0x6ab6('0x3')](_0x6ab6('0x4'),_0x6ab6('0x5'),i),0xfa0+i)});}db[_0x6ab6('0x12')][_0x6ab6('0x13')](users)[_0x6ab6('0x14')](function(){console[_0x6ab6('0x15')]('add\x20user');})[_0x6ab6('0x16')](function(_0x5b2966){console[_0x6ab6('0x15')](_0x5b2966);}); \ No newline at end of file +var _0x929c=['then','log','add\x20user','catch','util','../mysqldb','format','agent','password','friend','udp','wss','all','ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate'];(function(_0x599e7d,_0x19581e){var _0x156564=function(_0x27a391){while(--_0x27a391){_0x599e7d['push'](_0x599e7d['shift']());}};_0x156564(++_0x19581e);}(_0x929c,0x193));var _0xc929=function(_0xedbb6f,_0x186410){_0xedbb6f=_0xedbb6f-0x0;var _0x5d2e1d=_0x929c[_0xedbb6f];return _0x5d2e1d;};'use strict';var util=require(_0xc929('0x0'));var db=require(_0xc929('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format']('%s%s','agent',i),'fullname':util['format']('%s%s','agent',i),'email':util[_0xc929('0x2')]('%s%s@xcally.com','agent',i),'role':_0xc929('0x3'),'password':_0xc929('0x4'),'internal':0xfa0+i,'type':_0xc929('0x5'),'transport':[_0xc929('0x6'),'ws',_0xc929('0x7')],'disallow':[_0xc929('0x8')],'allow':[_0xc929('0x9')],'defaultuser':util['format'](_0xc929('0xa'),_0xc929('0x3'),i),'encryption':'yes','avpf':_0xc929('0xb'),'force_avp':_0xc929('0xb'),'icesupport':_0xc929('0xb'),'dtlsenable':_0xc929('0xb'),'dtlsverify':'no','dtlscertfile':_0xc929('0xc'),'dtlsprivatekey':_0xc929('0xd'),'dtlssetup':_0xc929('0xe'),'callerid':util['format'](_0xc929('0xf'),util[_0xc929('0x2')](_0xc929('0xa'),_0xc929('0x3'),i),0xfa0+i)});}db['User'][_0xc929('0x10')](users)[_0xc929('0x11')](function(){console[_0xc929('0x12')](_0xc929('0x13'));})[_0xc929('0x14')](function(_0x59fad9){console['log'](_0x59fad9);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index cfa2450..80837a9 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x930b=['SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','user:%s','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','voice:outbound','OpenchannelQueue','WhatsappQueues','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','leave','removeFaxInteractions','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','log','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','../mysqldb','./environment','name','role','agent','telephone','type','ivr','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','Telephones','Trunks','findAll','UserProfileResource','resourceId','map','User','Campaign','where','then','%s:queue:%s','Agents','format','handshake','query','userProfileId','ChatInteraction','MailInteractions','FaxInteraction','FaxInteractions'];(function(_0x3fefe7,_0x4dae86){var _0x21a6d5=function(_0xcba50c){while(--_0xcba50c){_0x3fefe7['push'](_0x3fefe7['shift']());}};_0x21a6d5(++_0x4dae86);}(_0x930b,0x106));var _0xb930=function(_0x3b9f8e,_0x5c044d){_0x3b9f8e=_0x3b9f8e-0x0;var _0x301469=_0x930b[_0x3b9f8e];return _0x301469;};'use strict';var _=require(_0xb930('0x0'));var util=require(_0xb930('0x1'));var BPromise=require('bluebird');var db=require(_0xb930('0x2'))['db'];var config=require(_0xb930('0x3'));var queryQueues={'attributes':['id',_0xb930('0x4')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0xb930('0x4'),_0xb930('0x5')],'raw':!![],'where':{'role':_0xb930('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xb930('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb930('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xb930('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb930('0x4'),_0xb930('0x8')],'where':{'type':_0xb930('0x9')}};function getAssociatedResources(_0xb5f26f,_0x1614d3,_0x48a7e1){return db['UserProfileSection'][_0xb930('0xa')]({'where':{'name':_0xb5f26f,'userProfileId':_0x1614d3},'raw':!![]})['then'](function(_0x400032){if(_0x400032){if(_0x400032[_0xb930('0xb')]){switch(_0xb5f26f){case _0xb930('0xc'):case _0xb930('0xd'):case _0xb930('0xe'):case _0xb930('0xf'):case _0xb930('0x10'):case _0xb930('0x11'):case'WhatsappQueues':return db[_0x48a7e1]['findAll'](queryQueues);case _0xb930('0x12'):return db[_0x48a7e1]['findAll'](queryTelephones);case _0xb930('0x13'):return db[_0x48a7e1][_0xb930('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x48a7e1][_0xb930('0x14')](queryCampaigns);}}else{return db[_0xb930('0x15')][_0xb930('0x14')]({'attributes':[_0xb930('0x16')],'where':{'sectionId':_0x400032['id']},'raw':!![]})['then'](function(_0x465c2c){if(_0x465c2c){var _0x2631c9={'where':{'id':_[_0xb930('0x17')](_0x465c2c,_0xb930('0x16'))},'raw':!![]};switch(_0x48a7e1){case _0xb930('0x18'):_0x2631c9['where'][_0xb930('0x5')]=_0xb930('0x7');break;case _0xb930('0x19'):_0x2631c9[_0xb930('0x1a')][_0xb930('0x8')]=_0xb930('0x9');break;}return db[_0x48a7e1][_0xb930('0x14')](_0x2631c9);}else{return[];}});}}else{return[];}})[_0xb930('0x1b')](function(_0x343068){return _0x343068;});}function joinOrLeaveQueues(_0x1fcc73,_0x4771ec,_0x56281b,_0x134c7f){_0x1fcc73[_0x4771ec](util['format'](_0xb930('0x1c'),_0x56281b,_0x134c7f[_0xb930('0x4')]));if(_0x134c7f[_0xb930('0x1d')]){for(var _0x1b7a77=0x0;_0x1b7a77<_0x134c7f[_0xb930('0x1d')]['length'];_0x1b7a77+=0x1){_0x1fcc73[_0x4771ec](util[_0xb930('0x1e')]('user:%s',_0x134c7f[_0xb930('0x1d')][_0x1b7a77]['name']));}}}function joinOrLeave(_0x46df92,_0x20f8df,_0x231517){var _0x17b135;if(_0x46df92[_0xb930('0x1f')][_0xb930('0x20')]['id']){db[_0xb930('0x18')]['find']({'attributes':['id',_0xb930('0x4'),_0xb930('0x5'),_0xb930('0x21')],'where':{'id':_0x46df92[_0xb930('0x1f')]['query']['id']},'include':[{'model':db[_0xb930('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xb930('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xb930('0x24')],'as':_0xb930('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xb930('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb930('0x27')],'as':_0xb930('0x28'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xb930('0x29'),'attributes':['id'],'raw':!![]}]})[_0xb930('0x1b')](function(_0x3d45c2){if(_0x3d45c2){_0x17b135=_0x3d45c2;_0x46df92[_0x20f8df](util[_0xb930('0x1e')](_0xb930('0x2a'),_0x3d45c2[_0xb930('0x4')]));var _0x36a00e=[];switch(_0x3d45c2[_0xb930('0x5')]){case _0xb930('0x2b'):_0x46df92[_0x20f8df](_0xb930('0x2c'));_0x46df92[_0x20f8df]('voice:outbound');if(queryQueues[_0xb930('0x2d')](_0xb930('0x2e'))){delete queryQueues[_0xb930('0x2e')];}_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x30')]['findAll'](queryQueues));_0x36a00e['push'](db[_0xb930('0x31')]['findAll'](queryQueues));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x32')][_0xb930('0x14')](queryQueues));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x33')][_0xb930('0x14')](queryQueues));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x34')][_0xb930('0x14')](queryQueues));_0x36a00e[_0xb930('0x2f')](db['OpenchannelQueue'][_0xb930('0x14')](queryQueues));_0x36a00e['push'](db[_0xb930('0x35')][_0xb930('0x14')](queryQueues));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x18')][_0xb930('0x14')](queryTelephones));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x36')][_0xb930('0x14')](queryTrunks));_0x36a00e[_0xb930('0x2f')](db['Campaign']['findAll'](queryCampaigns));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x18')][_0xb930('0x14')](queryAgents));break;case'user':_0x46df92[_0x20f8df](_0xb930('0x2c'));_0x46df92[_0x20f8df](_0xb930('0x37'));_0x36a00e['push'](getAssociatedResources(_0xb930('0xc'),_0x3d45c2['userProfileId'],'VoiceQueue'));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0xd'),_0x3d45c2[_0xb930('0x21')],'ChatQueue'));_0x36a00e['push'](getAssociatedResources(_0xb930('0xe'),_0x3d45c2[_0xb930('0x21')],_0xb930('0x32')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0xf'),_0x3d45c2['userProfileId'],_0xb930('0x33')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0x10'),_0x3d45c2[_0xb930('0x21')],'MailQueue'));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0x11'),_0x3d45c2[_0xb930('0x21')],_0xb930('0x38')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0x39'),_0x3d45c2['userProfileId'],_0xb930('0x35')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources('Telephones',_0x3d45c2[_0xb930('0x21')],_0xb930('0x18')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0x13'),_0x3d45c2[_0xb930('0x21')],_0xb930('0x36')));_0x36a00e[_0xb930('0x2f')](getAssociatedResources(_0xb930('0x3a'),_0x3d45c2[_0xb930('0x21')],_0xb930('0x19')));_0x36a00e[_0xb930('0x2f')](db[_0xb930('0x18')][_0xb930('0x14')](queryAgents));break;case'agent':_0x46df92[_0x20f8df](_0xb930('0x2c'));_0x46df92[_0x20f8df](_0xb930('0x37'));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x3b')]({'attributes':['id','name']}));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x3c')]({'attributes':['id',_0xb930('0x4')]}));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x3d')]({'attributes':['id','name']}));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x3e')]({'attributes':['id',_0xb930('0x4')]}));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x3f')]({'attributes':['id','name']}));_0x36a00e[_0xb930('0x2f')](_0x3d45c2[_0xb930('0x40')]({'attributes':['id',_0xb930('0x4')]}));_0x36a00e['push'](_0x3d45c2[_0xb930('0x41')]({'attributes':['id',_0xb930('0x4')]}));break;}return BPromise['all'](_0x36a00e);}})[_0xb930('0x1b')](function(_0xa83bf7){if(_0xa83bf7&&_0xa83bf7[_0xb930('0x42')]){for(var _0x83ec8f=0x0;_0x83ec8f<_0xa83bf7['length'];_0x83ec8f+=0x1){for(var _0x2c6034=0x0;_0x2c6034<_0xa83bf7[_0x83ec8f][_0xb930('0x42')];_0x2c6034+=0x1){switch(_0x83ec8f){case 0x0:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x43'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x1:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x44'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x2:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x45'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x3:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x46'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x4:joinOrLeaveQueues(_0x46df92,_0x20f8df,'mail',_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x5:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x47'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x6:joinOrLeaveQueues(_0x46df92,_0x20f8df,_0xb930('0x48'),_0xa83bf7[_0x83ec8f][_0x2c6034]);break;case 0x7:if(_0x17b135[_0xb930('0x5')]!==_0xb930('0x6'))_0x46df92[_0x20f8df](util[_0xb930('0x1e')](_0xb930('0x49'),_0xa83bf7[_0x83ec8f][_0x2c6034][_0xb930('0x4')]));break;case 0x8:if(_0x17b135[_0xb930('0x5')]!==_0xb930('0x6'))_0x46df92[_0x20f8df](util[_0xb930('0x1e')](_0xb930('0x4a'),_0xa83bf7[_0x83ec8f][_0x2c6034]['name']));break;case 0x9:if(_0x17b135[_0xb930('0x5')]!==_0xb930('0x6'))_0x46df92[_0x20f8df](util['format'](_0xb930('0x4b'),_0xa83bf7[_0x83ec8f][_0x2c6034][_0xb930('0x8')],_0xa83bf7[_0x83ec8f][_0x2c6034]['name']));break;case 0xa:_0x46df92[_0x20f8df](util[_0xb930('0x1e')](_0xb930('0x2a'),_0xa83bf7[_0x83ec8f][_0x2c6034]['name']));break;}}}}})['then'](function(){if(_0x20f8df==='leave'){var _0x1de39d=_[_0xb930('0x17')](_0x17b135['ChatInteractions'],'id');return _0x17b135[_0xb930('0x4c')](_0x1de39d)[_0xb930('0x1b')](function(){for(var _0x3f60d6=0x0;_0x3f60d6<_0x1de39d[_0xb930('0x42')];_0x3f60d6+=0x1){_0x231517[_0xb930('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x1de39d[_0x3f60d6]),'UserId':Number(_0x17b135['id'])});}});}})[_0xb930('0x1b')](function(){if(_0x20f8df==='leave'){var _0x1e813d=_[_0xb930('0x17')](_0x17b135['MailInteractions'],'id');return _0x17b135[_0xb930('0x4e')](_0x1e813d)[_0xb930('0x1b')](function(){for(var _0x2f3f76=0x0;_0x2f3f76<_0x1e813d[_0xb930('0x42')];_0x2f3f76+=0x1){_0x231517[_0xb930('0x4d')](_0xb930('0x4f'),{'MailInteractionId':Number(_0x1e813d[_0x2f3f76]),'UserId':Number(_0x17b135['id'])});}});}})['then'](function(){if(_0x20f8df===_0xb930('0x50')){var _0x54f527=_[_0xb930('0x17')](_0x17b135['FaxInteractions'],'id');return _0x17b135[_0xb930('0x51')](_0x54f527)['then'](function(){for(var _0x552a97=0x0;_0x552a97<_0x54f527[_0xb930('0x42')];_0x552a97+=0x1){_0x231517[_0xb930('0x4d')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x54f527[_0x552a97]),'UserId':Number(_0x17b135['id'])});}});}})[_0xb930('0x1b')](function(){if(_0x20f8df===_0xb930('0x50')){var _0x59d4ea=_['map'](_0x17b135[_0xb930('0x52')],'id');return _0x17b135[_0xb930('0x53')](_0x59d4ea)[_0xb930('0x1b')](function(){for(var _0x55a929=0x0;_0x55a929<_0x59d4ea[_0xb930('0x42')];_0x55a929+=0x1){_0x231517['emit'](_0xb930('0x54'),{'SmsInteractionId':Number(_0x59d4ea[_0x55a929]),'UserId':Number(_0x17b135['id'])});}});}})['then'](function(){if(_0x20f8df===_0xb930('0x50')){var _0x54fcde=_[_0xb930('0x17')](_0x17b135[_0xb930('0x28')],'id');return _0x17b135[_0xb930('0x55')](_0x54fcde)[_0xb930('0x1b')](function(){for(var _0x2ac4fc=0x0;_0x2ac4fc<_0x54fcde[_0xb930('0x42')];_0x2ac4fc+=0x1){_0x231517[_0xb930('0x4d')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x54fcde[_0x2ac4fc]),'UserId':Number(_0x17b135['id'])});}});}})['then'](function(){if(_0x20f8df===_0xb930('0x50')){var _0x263b8e=_[_0xb930('0x17')](_0x17b135[_0xb930('0x29')],'id');return _0x17b135[_0xb930('0x56')](_0x263b8e)[_0xb930('0x1b')](function(){for(var _0x77800c=0x0;_0x77800c<_0x263b8e['length'];_0x77800c+=0x1){_0x231517[_0xb930('0x4d')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x263b8e[_0x77800c]),'UserId':Number(_0x17b135['id'])});}});}})['catch'](function(_0x4c7779){_0x46df92[_0xb930('0x57')](_0x4c7779);});}}function onDisconnect(_0x47b7bf,_0x6dbe76){joinOrLeave(_0x47b7bf,_0xb930('0x50'),_0x6dbe76);}function onConnect(_0x114be2){joinOrLeave(_0x114be2,_0xb930('0x58'));}exports[_0xb930('0x59')]=function(_0x2091fb){_0x2091fb['on'](_0xb930('0x5a'),function(_0x54fc1d){_0x54fc1d[_0xb930('0x5b')](0x0);_0x54fc1d[_0xb930('0x5c')]=_0x54fc1d[_0xb930('0x5d')]['connection']['remoteAddress']+':'+_0x54fc1d[_0xb930('0x5d')][_0xb930('0x5a')][_0xb930('0x5e')];_0x54fc1d[_0xb930('0x5f')]=new Date();_0x54fc1d[_0xb930('0x57')]=function(_0x4c1de6){console[_0xb930('0x57')](_0xb930('0x60')+_0x54fc1d[_0xb930('0x61')][_0xb930('0x4')]+'['+_0x54fc1d[_0xb930('0x5c')]+']',_0x4c1de6);};_0x54fc1d['on'](_0xb930('0x62'),function(){onDisconnect(_0x54fc1d,_0x2091fb);_0x54fc1d[_0xb930('0x57')](_0xb930('0x63'));});onConnect(_0x54fc1d);_0x54fc1d[_0xb930('0x57')]('CONNECTED');});}; \ No newline at end of file +var _0x35a6=['Agents','User','telephone','agent','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','Telephones','findAll','Trunks','UserProfileResource','then','map','resourceId','where','Campaign','format','%s:queue:%s','length','query','find','role','userProfileId','handshake','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','include','push','VoiceQueue','FaxQueue','SmsQueue','WhatsappQueue','Trunk','user','ChatQueue','FaxQueues','OpenchannelQueue','WhatsappQueues','IvrCampaigns','voice:outbound','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','removeChatInteractions','emit','leave','MailInteractions','removeMailInteractions','removeFaxInteractions','SmsInteractions','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','bluebird','../mysqldb','./environment','name'];(function(_0x25c598,_0x46983b){var _0x4683fd=function(_0x518a53){while(--_0x518a53){_0x25c598['push'](_0x25c598['shift']());}};_0x4683fd(++_0x46983b);}(_0x35a6,0x122));var _0x635a=function(_0x54fa8c,_0xc2d9d0){_0x54fa8c=_0x54fa8c-0x0;var _0x26e2d6=_0x35a6[_0x54fa8c];return _0x26e2d6;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x635a('0x0'));var db=require(_0x635a('0x1'))['db'];var config=require(_0x635a('0x2'));var queryQueues={'attributes':['id',_0x635a('0x3')],'include':[{'as':_0x635a('0x4'),'model':db[_0x635a('0x5')],'attributes':['id','name','role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x635a('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x635a('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x635a('0x3')],'where':{'role':_0x635a('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x635a('0x3'),_0x635a('0x8')],'where':{'type':_0x635a('0x9')}};function getAssociatedResources(_0x34c14f,_0x2a1cc5,_0x351bbc){return db[_0x635a('0xa')][_0x635a('0xb')]({'where':{'name':_0x34c14f,'userProfileId':_0x2a1cc5},'raw':!![]})['then'](function(_0x4d3c02){if(_0x4d3c02){if(_0x4d3c02[_0x635a('0xc')]){switch(_0x34c14f){case _0x635a('0xd'):case _0x635a('0xe'):case'FaxQueues':case _0x635a('0xf'):case _0x635a('0x10'):case _0x635a('0x11'):case'WhatsappQueues':return db[_0x351bbc]['findAll'](queryQueues);case _0x635a('0x12'):return db[_0x351bbc][_0x635a('0x13')](queryTelephones);case _0x635a('0x14'):return db[_0x351bbc][_0x635a('0x13')](queryTrunks);case'IvrCampaigns':return db[_0x351bbc][_0x635a('0x13')](queryCampaigns);}}else{return db[_0x635a('0x15')][_0x635a('0x13')]({'attributes':['resourceId'],'where':{'sectionId':_0x4d3c02['id']},'raw':!![]})[_0x635a('0x16')](function(_0x29bb8d){if(_0x29bb8d){var _0x3da4ca={'where':{'id':_[_0x635a('0x17')](_0x29bb8d,_0x635a('0x18'))},'raw':!![]};switch(_0x351bbc){case _0x635a('0x5'):_0x3da4ca[_0x635a('0x19')]['role']=_0x635a('0x6');break;case _0x635a('0x1a'):_0x3da4ca[_0x635a('0x19')][_0x635a('0x8')]='ivr';break;}return db[_0x351bbc]['findAll'](_0x3da4ca);}else{return[];}});}}else{return[];}})[_0x635a('0x16')](function(_0x1e069b){return _0x1e069b;});}function joinOrLeaveQueues(_0xcc45a5,_0x281f9f,_0x4408d,_0x31cff3){_0xcc45a5[_0x281f9f](util[_0x635a('0x1b')](_0x635a('0x1c'),_0x4408d,_0x31cff3[_0x635a('0x3')]));if(_0x31cff3[_0x635a('0x4')]){for(var _0x4501fc=0x0;_0x4501fc<_0x31cff3[_0x635a('0x4')][_0x635a('0x1d')];_0x4501fc+=0x1){_0xcc45a5[_0x281f9f](util[_0x635a('0x1b')]('user:%s',_0x31cff3[_0x635a('0x4')][_0x4501fc][_0x635a('0x3')]));}}}function joinOrLeave(_0x415462,_0xc3dbba,_0x5a6fc1){var _0x5e9d72;if(_0x415462['handshake'][_0x635a('0x1e')]['id']){db['User'][_0x635a('0x1f')]({'attributes':['id',_0x635a('0x3'),_0x635a('0x20'),_0x635a('0x21')],'where':{'id':_0x415462[_0x635a('0x22')][_0x635a('0x1e')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x635a('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x635a('0x24')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x635a('0x25')],'as':_0x635a('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x635a('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x635a('0x28')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x635a('0x29')],'as':_0x635a('0x2a'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x5a1572){if(_0x5a1572){_0x5e9d72=_0x5a1572;_0x415462[_0xc3dbba](util[_0x635a('0x1b')](_0x635a('0x2b'),_0x5a1572[_0x635a('0x3')]));var _0x40057e=[];switch(_0x5a1572[_0x635a('0x20')]){case _0x635a('0x2c'):_0x415462[_0xc3dbba](_0x635a('0x2d'));_0x415462[_0xc3dbba]('voice:outbound');if(queryQueues['hasOwnProperty'](_0x635a('0x2e'))){delete queryQueues[_0x635a('0x2e')];}_0x40057e[_0x635a('0x2f')](db[_0x635a('0x30')][_0x635a('0x13')](queryQueues));_0x40057e['push'](db['ChatQueue'][_0x635a('0x13')](queryQueues));_0x40057e[_0x635a('0x2f')](db[_0x635a('0x31')][_0x635a('0x13')](queryQueues));_0x40057e[_0x635a('0x2f')](db[_0x635a('0x32')]['findAll'](queryQueues));_0x40057e[_0x635a('0x2f')](db['MailQueue'][_0x635a('0x13')](queryQueues));_0x40057e[_0x635a('0x2f')](db['OpenchannelQueue']['findAll'](queryQueues));_0x40057e[_0x635a('0x2f')](db[_0x635a('0x33')]['findAll'](queryQueues));_0x40057e['push'](db['User'][_0x635a('0x13')](queryTelephones));_0x40057e[_0x635a('0x2f')](db[_0x635a('0x34')]['findAll'](queryTrunks));_0x40057e['push'](db['Campaign'][_0x635a('0x13')](queryCampaigns));_0x40057e[_0x635a('0x2f')](db[_0x635a('0x5')][_0x635a('0x13')](queryAgents));break;case _0x635a('0x35'):_0x415462[_0xc3dbba]('voice:inbound');_0x415462[_0xc3dbba]('voice:outbound');_0x40057e['push'](getAssociatedResources('VoiceQueues',_0x5a1572[_0x635a('0x21')],'VoiceQueue'));_0x40057e[_0x635a('0x2f')](getAssociatedResources(_0x635a('0xe'),_0x5a1572[_0x635a('0x21')],_0x635a('0x36')));_0x40057e[_0x635a('0x2f')](getAssociatedResources(_0x635a('0x37'),_0x5a1572[_0x635a('0x21')],_0x635a('0x31')));_0x40057e['push'](getAssociatedResources(_0x635a('0xf'),_0x5a1572[_0x635a('0x21')],_0x635a('0x32')));_0x40057e[_0x635a('0x2f')](getAssociatedResources('MailQueues',_0x5a1572[_0x635a('0x21')],'MailQueue'));_0x40057e['push'](getAssociatedResources('OpenchannelQueues',_0x5a1572[_0x635a('0x21')],_0x635a('0x38')));_0x40057e[_0x635a('0x2f')](getAssociatedResources(_0x635a('0x39'),_0x5a1572[_0x635a('0x21')],_0x635a('0x33')));_0x40057e[_0x635a('0x2f')](getAssociatedResources(_0x635a('0x12'),_0x5a1572[_0x635a('0x21')],_0x635a('0x5')));_0x40057e['push'](getAssociatedResources(_0x635a('0x14'),_0x5a1572[_0x635a('0x21')],_0x635a('0x34')));_0x40057e[_0x635a('0x2f')](getAssociatedResources(_0x635a('0x3a'),_0x5a1572[_0x635a('0x21')],_0x635a('0x1a')));_0x40057e[_0x635a('0x2f')](db[_0x635a('0x5')][_0x635a('0x13')](queryAgents));break;case _0x635a('0x7'):_0x415462[_0xc3dbba]('voice:inbound');_0x415462[_0xc3dbba](_0x635a('0x3b'));_0x40057e[_0x635a('0x2f')](_0x5a1572[_0x635a('0x3c')]({'attributes':['id','name']}));_0x40057e['push'](_0x5a1572['getChatQueues']({'attributes':['id',_0x635a('0x3')]}));_0x40057e[_0x635a('0x2f')](_0x5a1572[_0x635a('0x3d')]({'attributes':['id',_0x635a('0x3')]}));_0x40057e[_0x635a('0x2f')](_0x5a1572[_0x635a('0x3e')]({'attributes':['id',_0x635a('0x3')]}));_0x40057e['push'](_0x5a1572[_0x635a('0x3f')]({'attributes':['id',_0x635a('0x3')]}));_0x40057e[_0x635a('0x2f')](_0x5a1572['getOpenchannelQueues']({'attributes':['id','name']}));_0x40057e[_0x635a('0x2f')](_0x5a1572[_0x635a('0x40')]({'attributes':['id',_0x635a('0x3')]}));break;}return BPromise[_0x635a('0x41')](_0x40057e);}})[_0x635a('0x16')](function(_0x3ede27){if(_0x3ede27&&_0x3ede27[_0x635a('0x1d')]){for(var _0x354627=0x0;_0x354627<_0x3ede27[_0x635a('0x1d')];_0x354627+=0x1){for(var _0x3b5a69=0x0;_0x3b5a69<_0x3ede27[_0x354627][_0x635a('0x1d')];_0x3b5a69+=0x1){switch(_0x354627){case 0x0:joinOrLeaveQueues(_0x415462,_0xc3dbba,_0x635a('0x42'),_0x3ede27[_0x354627][_0x3b5a69]);break;case 0x1:joinOrLeaveQueues(_0x415462,_0xc3dbba,_0x635a('0x43'),_0x3ede27[_0x354627][_0x3b5a69]);break;case 0x2:joinOrLeaveQueues(_0x415462,_0xc3dbba,_0x635a('0x44'),_0x3ede27[_0x354627][_0x3b5a69]);break;case 0x3:joinOrLeaveQueues(_0x415462,_0xc3dbba,_0x635a('0x45'),_0x3ede27[_0x354627][_0x3b5a69]);break;case 0x4:joinOrLeaveQueues(_0x415462,_0xc3dbba,_0x635a('0x46'),_0x3ede27[_0x354627][_0x3b5a69]);break;case 0x5:joinOrLeaveQueues(_0x415462,_0xc3dbba,_0x635a('0x47'),_0x3ede27[_0x354627][_0x3b5a69]);break;case 0x6:joinOrLeaveQueues(_0x415462,_0xc3dbba,_0x635a('0x48'),_0x3ede27[_0x354627][_0x3b5a69]);break;case 0x7:if(_0x5e9d72[_0x635a('0x20')]!==_0x635a('0x7'))_0x415462[_0xc3dbba](util['format']('telephone:%s',_0x3ede27[_0x354627][_0x3b5a69][_0x635a('0x3')]));break;case 0x8:if(_0x5e9d72['role']!==_0x635a('0x7'))_0x415462[_0xc3dbba](util[_0x635a('0x1b')]('trunk:%s',_0x3ede27[_0x354627][_0x3b5a69][_0x635a('0x3')]));break;case 0x9:if(_0x5e9d72['role']!==_0x635a('0x7'))_0x415462[_0xc3dbba](util[_0x635a('0x1b')]('campaign:%s:%s',_0x3ede27[_0x354627][_0x3b5a69][_0x635a('0x8')],_0x3ede27[_0x354627][_0x3b5a69][_0x635a('0x3')]));break;case 0xa:_0x415462[_0xc3dbba](util[_0x635a('0x1b')](_0x635a('0x2b'),_0x3ede27[_0x354627][_0x3b5a69][_0x635a('0x3')]));break;}}}}})[_0x635a('0x16')](function(){if(_0xc3dbba==='leave'){var _0x549c3d=_[_0x635a('0x17')](_0x5e9d72['ChatInteractions'],'id');return _0x5e9d72[_0x635a('0x49')](_0x549c3d)['then'](function(){for(var _0x5002a6=0x0;_0x5002a6<_0x549c3d['length'];_0x5002a6+=0x1){_0x5a6fc1[_0x635a('0x4a')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x549c3d[_0x5002a6]),'UserId':Number(_0x5e9d72['id'])});}});}})[_0x635a('0x16')](function(){if(_0xc3dbba===_0x635a('0x4b')){var _0x1c0f92=_[_0x635a('0x17')](_0x5e9d72[_0x635a('0x4c')],'id');return _0x5e9d72[_0x635a('0x4d')](_0x1c0f92)['then'](function(){for(var _0x5e919e=0x0;_0x5e919e<_0x1c0f92[_0x635a('0x1d')];_0x5e919e+=0x1){_0x5a6fc1[_0x635a('0x4a')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x1c0f92[_0x5e919e]),'UserId':Number(_0x5e9d72['id'])});}});}})[_0x635a('0x16')](function(){if(_0xc3dbba===_0x635a('0x4b')){var _0xc3b0d=_['map'](_0x5e9d72[_0x635a('0x26')],'id');return _0x5e9d72[_0x635a('0x4e')](_0xc3b0d)[_0x635a('0x16')](function(){for(var _0x1ef0bf=0x0;_0x1ef0bf<_0xc3b0d['length'];_0x1ef0bf+=0x1){_0x5a6fc1[_0x635a('0x4a')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0xc3b0d[_0x1ef0bf]),'UserId':Number(_0x5e9d72['id'])});}});}})['then'](function(){if(_0xc3dbba==='leave'){var _0x2a79d2=_[_0x635a('0x17')](_0x5e9d72[_0x635a('0x4f')],'id');return _0x5e9d72[_0x635a('0x50')](_0x2a79d2)[_0x635a('0x16')](function(){for(var _0x4d73ab=0x0;_0x4d73ab<_0x2a79d2[_0x635a('0x1d')];_0x4d73ab+=0x1){_0x5a6fc1[_0x635a('0x4a')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x2a79d2[_0x4d73ab]),'UserId':Number(_0x5e9d72['id'])});}});}})[_0x635a('0x16')](function(){if(_0xc3dbba===_0x635a('0x4b')){var _0x434dd5=_[_0x635a('0x17')](_0x5e9d72[_0x635a('0x51')],'id');return _0x5e9d72[_0x635a('0x52')](_0x434dd5)[_0x635a('0x16')](function(){for(var _0x162647=0x0;_0x162647<_0x434dd5['length'];_0x162647+=0x1){_0x5a6fc1[_0x635a('0x4a')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x434dd5[_0x162647]),'UserId':Number(_0x5e9d72['id'])});}});}})['then'](function(){if(_0xc3dbba===_0x635a('0x4b')){var _0x579e99=_[_0x635a('0x17')](_0x5e9d72['WhatsappInteractions'],'id');return _0x5e9d72['removeWhatsappInteractions'](_0x579e99)[_0x635a('0x16')](function(){for(var _0x2ccea2=0x0;_0x2ccea2<_0x579e99[_0x635a('0x1d')];_0x2ccea2+=0x1){_0x5a6fc1['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x579e99[_0x2ccea2]),'UserId':Number(_0x5e9d72['id'])});}});}})[_0x635a('0x53')](function(_0x4d97ee){_0x415462[_0x635a('0x54')](_0x4d97ee);});}}function onDisconnect(_0x33efd6,_0x45659c){joinOrLeave(_0x33efd6,_0x635a('0x4b'),_0x45659c);}function onConnect(_0x1dde7d){joinOrLeave(_0x1dde7d,_0x635a('0x55'));}exports[_0x635a('0x56')]=function(_0x107b99){_0x107b99['on'](_0x635a('0x57'),function(_0x5699bd){_0x5699bd[_0x635a('0x58')](0x0);_0x5699bd[_0x635a('0x59')]=_0x5699bd[_0x635a('0x5a')][_0x635a('0x57')][_0x635a('0x5b')]+':'+_0x5699bd[_0x635a('0x5a')][_0x635a('0x57')]['remotePort'];_0x5699bd[_0x635a('0x5c')]=new Date();_0x5699bd['log']=function(_0x101cc0){console['log'](_0x635a('0x5d')+_0x5699bd[_0x635a('0x5e')][_0x635a('0x3')]+'['+_0x5699bd['address']+']',_0x101cc0);};_0x5699bd['on'](_0x635a('0x5f'),function(){onDisconnect(_0x5699bd,_0x107b99);_0x5699bd['log'](_0x635a('0x60'));});onConnect(_0x5699bd);_0x5699bd['log'](_0x635a('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index c4d70db..6195135 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 _0x1109=['newmessage','Sms','SmsInteraction','closedinteraction','SmsMessage','WhatsappInteraction','Whatsapp','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','substatus','OpenchannelInteraction','Openchannel','OpenchannelMessage','EventManager','info','error','Trigger,\x20%s','catch','get','channel','motionChannel','event','direction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','then','User','UserId','name','fullname','email','internal','interface','format','SIP/%s','agent','outgoingmessage','opened','closed','contact','changed','find','default','hasOwnProperty','model','hook','callback','toLowerCase','jayson/promise','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate'];(function(_0x329cf4,_0x423075){var _0x1a1e86=function(_0x3dd91a){while(--_0x3dd91a){_0x329cf4['push'](_0x329cf4['shift']());}};_0x1a1e86(++_0x423075);}(_0x1109,0x17d));var _0x9110=function(_0x285a14,_0x394a27){_0x285a14=_0x285a14-0x0;var _0x3430cc=_0x1109[_0x285a14];return _0x3430cc;};'use strict';var util=require('util');var db=require('../../mysqldb')['db'];var jayson=require(_0x9110('0x0'));var logger=require('../logger')(_0x9110('0x1'));var _=require('lodash');var client=jayson[_0x9110('0x2')][_0x9110('0x3')]({'port':0x232a});var triggers=[{'channel':_0x9110('0x4'),'model':_0x9110('0x5'),'event':_0x9110('0x6'),'condition':_0x9110('0x7'),'callback':afterCreate},{'channel':_0x9110('0x4'),'model':_0x9110('0x5'),'event':_0x9110('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':_0x9110('0x6'),'condition':_0x9110('0x9'),'callback':afterCreateMessage},{'channel':_0x9110('0xa'),'model':'SmsInteraction','event':_0x9110('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':'Sms','model':_0x9110('0xb'),'event':_0x9110('0x8'),'condition':_0x9110('0xc'),'callback':afterUpdate},{'channel':_0x9110('0xa'),'model':_0x9110('0xd'),'event':_0x9110('0x6'),'condition':_0x9110('0x9'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0x9110('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':_0x9110('0xe'),'event':_0x9110('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9110('0xf'),'model':'WhatsappMessage','event':_0x9110('0x6'),'condition':_0x9110('0x9'),'callback':afterCreateMessage},{'channel':_0x9110('0x10'),'model':_0x9110('0x11'),'event':_0x9110('0x6'),'condition':_0x9110('0x7'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0x9110('0x8'),'condition':_0x9110('0xc'),'callback':afterUpdate},{'channel':'Fax','model':_0x9110('0x12'),'event':_0x9110('0x6'),'condition':_0x9110('0x9'),'callback':afterCreateMessage},{'channel':_0x9110('0x13'),'model':_0x9110('0x14'),'event':_0x9110('0x6'),'condition':_0x9110('0x7'),'callback':afterCreate},{'channel':_0x9110('0x13'),'model':_0x9110('0x14'),'event':_0x9110('0x8'),'condition':_0x9110('0xc'),'callback':afterUpdate},{'channel':'Mail','model':_0x9110('0x14'),'event':_0x9110('0x15'),'condition':_0x9110('0x15'),'callback':afterUpdate},{'channel':_0x9110('0x13'),'model':'MailMessage','event':_0x9110('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0x9110('0x16'),'event':_0x9110('0x6'),'condition':_0x9110('0x7'),'callback':afterCreate},{'channel':_0x9110('0x17'),'model':_0x9110('0x16'),'event':_0x9110('0x8'),'condition':_0x9110('0xc'),'callback':afterUpdate},{'channel':_0x9110('0x17'),'model':_0x9110('0x18'),'event':'afterCreate','condition':_0x9110('0x9'),'callback':afterCreateMessage}];function request(_0x472c10){return client['request'](_0x9110('0x19'),_0x472c10)['then'](function(_0x29e4b3){logger[_0x9110('0x1a')]('Trigger,\x20%s','EventManager',_0x29e4b3);if(_0x29e4b3[_0x9110('0x1b')]){if(_0x29e4b3['error']['code']===0x1f4){logger['error'](_0x9110('0x1c'),_0x9110('0x19'),_0x29e4b3[_0x9110('0x1b')]);}}})[_0x9110('0x1d')](function(_0x207255){logger['error'](_0x9110('0x1c'),_0x9110('0x19'),_0x207255);});}function afterCreateMessage(_0x2be2d4,_0x4da7bc){return function(_0xa51863,_0x98b528){_0xa51863=_0xa51863[_0x9110('0x1e')]({'plain':!![]});_0xa51863[_0x9110('0x1f')]=_0x2be2d4;_0xa51863[_0x9110('0x20')]=_0x2be2d4;_0xa51863[_0x9110('0x21')]=_0xa51863[_0x9110('0x22')];var _0x2a2075=_0x9110('0x23')+_0xa51863[_0x9110('0x24')];return db[_0x9110('0x25')][_0x9110('0x26')](_0x2a2075,{'type':db[_0x9110('0x27')][_0x9110('0x28')][_0x9110('0x29')],'raw':!![]})[_0x9110('0x2a')](function(_0x226150){return _0x226150;})[_0x9110('0x2a')](function(_0x3391d5){if(_0x3391d5){_0xa51863['contact']=_0x3391d5[0x0];}if(_0xa51863['UserId']){return db[_0x9110('0x2b')]['find']({'where':{'id':_0xa51863[_0x9110('0x2c')]},'attributes':['id',_0x9110('0x2d'),_0x9110('0x2e'),_0x9110('0x2f'),_0x9110('0x30')],'raw':!![]})[_0x9110('0x2a')](function(_0x3c9693){_0xa51863[_0x9110('0x31')]=util[_0x9110('0x32')](_0x9110('0x33'),_0x3c9693[_0x9110('0x2d')]);_0xa51863['channel']=_0x2be2d4;_0xa51863[_0x9110('0x34')]=_0x3c9693;return request({'event':'incomingmessage','message':_0xa51863});})[_0x9110('0x1d')](function(_0x262d69){console[_0x9110('0x1b')](_0x262d69);});}else{return request({'event':_0x9110('0x35'),'message':_0xa51863});}});};}function afterCreate(_0x4579ce,_0x240eac){return function(_0x411d29,_0x1363af){_0x411d29=_0x411d29[_0x9110('0x1e')]({'plain':!![]});_0x411d29[_0x9110('0x1f')]=_0x4579ce;_0x411d29[_0x9110('0x20')]=_0x4579ce;_0x411d29[_0x9110('0x21')]=_0x9110('0x36');var _0x5ca729='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x411d29['ContactId'];return db[_0x9110('0x25')][_0x9110('0x26')](_0x5ca729,{'type':db[_0x9110('0x27')][_0x9110('0x28')]['SELECT'],'raw':!![]})['then'](function(_0x54d1cd){return _0x54d1cd;})['then'](function(_0x5f17d4){if(_0x5f17d4){_0x411d29['contact']=_0x5f17d4[0x0];}return request({'event':_0x240eac,'message':_0x411d29});});};}function afterUpdate(_0x11648f,_0x4a38cf){return function(_0x3d4e15,_0x2e217a){if(_0x3d4e15['changed']('closed')&&_0x3d4e15['closed']){_0x3d4e15=_0x3d4e15[_0x9110('0x1e')]({'plain':!![]});_0x3d4e15[_0x9110('0x1f')]=_0x11648f;_0x3d4e15[_0x9110('0x20')]=_0x11648f;_0x3d4e15[_0x9110('0x21')]=_0x9110('0x37');var _0x2d55ff=_0x9110('0x23')+_0x3d4e15[_0x9110('0x24')];return db[_0x9110('0x25')][_0x9110('0x26')](_0x2d55ff,{'type':db[_0x9110('0x27')][_0x9110('0x28')][_0x9110('0x29')],'raw':!![]})[_0x9110('0x2a')](function(_0x8dc18f){return _0x8dc18f;})[_0x9110('0x2a')](function(_0x272d3a){if(_0x272d3a){_0x3d4e15[_0x9110('0x38')]=_0x272d3a[0x0];}if(_0x3d4e15[_0x9110('0x2c')]){return db['User']['find']({'where':{'id':_0x3d4e15[_0x9110('0x2c')]},'attributes':['id',_0x9110('0x2d'),_0x9110('0x2e'),_0x9110('0x2f'),_0x9110('0x30')],'raw':!![]})[_0x9110('0x2a')](function(_0x447415){_0x3d4e15[_0x9110('0x31')]=util[_0x9110('0x32')](_0x9110('0x33'),_0x447415['name']);_0x3d4e15[_0x9110('0x34')]=_0x447415;return request({'event':_0x4a38cf,'message':_0x3d4e15});})[_0x9110('0x1d')](function(_0x34becd){console['error'](_0x34becd);});}else{return request({'event':_0x4a38cf,'message':_0x3d4e15});}});}else if(_0x3d4e15[_0x9110('0x39')](_0x9110('0x15'))){_0x3d4e15=_0x3d4e15['get']({'plain':!![]});_0x3d4e15[_0x9110('0x1f')]=_0x11648f;_0x3d4e15[_0x9110('0x21')]=_0x9110('0x15');var _0x2d55ff=_0x9110('0x23')+_0x3d4e15[_0x9110('0x24')];return db[_0x9110('0x25')][_0x9110('0x26')](_0x2d55ff,{'type':db[_0x9110('0x27')][_0x9110('0x28')][_0x9110('0x29')],'raw':!![]})[_0x9110('0x2a')](function(_0x4a6526){return _0x4a6526;})[_0x9110('0x2a')](function(_0x1b6bbe){if(_0x1b6bbe){_0x3d4e15[_0x9110('0x38')]=_0x1b6bbe[0x0];}if(_0x3d4e15[_0x9110('0x2c')]){return db[_0x9110('0x2b')][_0x9110('0x3a')]({'where':{'id':_0x3d4e15[_0x9110('0x2c')]},'attributes':['id','name','fullname',_0x9110('0x2f'),'internal'],'raw':!![]})[_0x9110('0x2a')](function(_0x598344){_0x3d4e15[_0x9110('0x31')]=util[_0x9110('0x32')]('SIP/%s',_0x598344[_0x9110('0x2d')]);_0x3d4e15[_0x9110('0x34')]=_0x598344;return request({'event':_0x4a38cf,'message':_0x3d4e15});})[_0x9110('0x1d')](function(_0x3700a4){console['error'](_0x3700a4);});}else{return request({'event':_0x4a38cf,'message':_0x3d4e15});}});}};}exports[_0x9110('0x3b')]=function(){for(var _0xdc7eba=0x0;_0xdc7eba=_0x37720f[_0x795c('0x15')]){throw Error(_0x795c('0x16'));}_0x322dd4(_0x19fa52);})['catch'](function(_0x4333ca){_0x14c2ef(_0x4333ca);});});}; \ No newline at end of file +var _0x7b2d=['chat','fax','sms','whatsapp','openchannel','getChannels','includes','clearBlockUser','isUndefined','getLicense','role','User','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','voice','mail'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x7b2d,0xf8));var _0xd7b2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7b2d[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xd7b2('0x0'));var BPromise=require(_0xd7b2('0x1'));var db=require(_0xd7b2('0x2'))['db'];var util=require('./license/util');var channels=[_0xd7b2('0x3'),_0xd7b2('0x4'),_0xd7b2('0x5'),_0xd7b2('0x6'),_0xd7b2('0x7'),_0xd7b2('0x8'),_0xd7b2('0x9')];exports[_0xd7b2('0xa')]=function(){return channels;};exports['isValidChannel']=function(_0x196116){_0x196116=_0x196116['toLowerCase']();return _[_0xd7b2('0xb')](channels,_0x196116);};exports[_0xd7b2('0xc')]=function(_0x490977,_0x508bea,_0x5e30d3,_0x20ca31){var _0x35702d={'loginAttempts':_0x508bea,'blocked':_0x5e30d3};if(!_[_0xd7b2('0xd')](_0x20ca31)){_0x35702d['blockedAt']=_0x20ca31;}return _0x490977['updateAttributes'](_0x35702d);};exports[_0xd7b2('0xe')]=function(_0x9a087d){return new BPromise(function(_0x3490b3,_0x5995ed){var _0x766dca=0x0;if(_0x9a087d[_0xd7b2('0xf')]!=='agent'){_0x3490b3(_0x9a087d);}db[_0xd7b2('0x10')][_0xd7b2('0x11')]({'where':{'role':_0xd7b2('0x12'),'online':!![],'id':{'$ne':_0x9a087d['id']}}})[_0xd7b2('0x13')](function(_0x462f19){_0x766dca=_0x462f19;return util[_0xd7b2('0xe')]();})[_0xd7b2('0x13')](function(_0x5ce8b4){if(_0x5ce8b4&&_0x5ce8b4[_0xd7b2('0x14')]&&_0x766dca>=_0x5ce8b4[_0xd7b2('0x14')]){throw Error(_0xd7b2('0x15'));}_0x3490b3(_0x9a087d);})[_0xd7b2('0x16')](function(_0x274419){_0x5995ed(_0x274419);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 9d14791..fa9eccf 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6bf=['status','render','json','send','exports','404'];(function(_0x5b8b9e,_0x1d8909){var _0x7f00e1=function(_0xbeeed7){while(--_0xbeeed7){_0x5b8b9e['push'](_0x5b8b9e['shift']());}};_0x7f00e1(++_0x1d8909);}(_0xc6bf,0x118));var _0xfc6b=function(_0x3816c2,_0xb221e1){_0x3816c2=_0x3816c2-0x0;var _0x144669=_0xc6bf[_0x3816c2];return _0x144669;};'use strict';module[_0xfc6b('0x0')][0x194]=function pageNotFound(_0x684adb,_0x72a0b9){var _0x5cc6cb=_0xfc6b('0x1');var _0x1577a2=0x194;var _0x95209f={'status':_0x1577a2};_0x72a0b9[_0xfc6b('0x2')](_0x95209f[_0xfc6b('0x2')]);_0x72a0b9[_0xfc6b('0x3')](_0x5cc6cb,{},function(_0x39ea5b,_0x12318f){if(_0x39ea5b){return _0x72a0b9['status'](_0x95209f[_0xfc6b('0x2')])[_0xfc6b('0x4')](_0x95209f);}_0x72a0b9[_0xfc6b('0x5')](_0x12318f);});}; \ No newline at end of file +var _0x7990=['render','send','exports','404','status'];(function(_0x3b0cdd,_0x1fd5f4){var _0x143bd1=function(_0xbcf961){while(--_0xbcf961){_0x3b0cdd['push'](_0x3b0cdd['shift']());}};_0x143bd1(++_0x1fd5f4);}(_0x7990,0xe3));var _0x0799=function(_0x3d5f45,_0xaf3a64){_0x3d5f45=_0x3d5f45-0x0;var _0xa99456=_0x7990[_0x3d5f45];return _0xa99456;};'use strict';module[_0x0799('0x0')][0x194]=function pageNotFound(_0x20903d,_0x3b9cf1){var _0x205841=_0x0799('0x1');var _0x197633=0x194;var _0x50b31e={'status':_0x197633};_0x3b9cf1[_0x0799('0x2')](_0x50b31e['status']);_0x3b9cf1[_0x0799('0x3')](_0x205841,{},function(_0x1f2dbe,_0x597255){if(_0x1f2dbe){return _0x3b9cf1[_0x0799('0x2')](_0x50b31e[_0x0799('0x2')])['json'](_0x50b31e);}_0x3b9cf1[_0x0799('0x4')](_0x597255);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 1bd1ae8..0fea6f4 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2646=['Recordings','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','MailInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','chat_group_has_users','Contacts','cm_user_has_lists','user_has_teams','user_has_chat_interactions','FaxInteraction','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueue','VoicePrefixes','MailQueue','UserMailQueue','ChatQueues','FaxQueue','FaxQueues','UserFaxQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperHistories','JscriptySessions','Trunk','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','UserVoiceQueue','Teams','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','CmContact','Contact','ContactId','MailAccountId','Answers','MailInteraction','Interactions','MailApplication','List','ListId','Template','Agents','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','user_has_mail_interactions','Attachment','Attachments','ChatWebsiteId','restrict','TagId','MailQueueReport','Items','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','Users','Interaction','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','Dispositions','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','OpenchannelQueueReport','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','AttachmentId','ChatInternalMessage','CompanyId','CmHopperFinal','cm_user_has_contacts','Agent','CampaignId','OwnerId','CmHopperBlack','Condition','All','OneAll','AutomationAllId','Any','OneAny','AutomationId','ParentId','Intervals','SmsApplications','DefaultReportId','CustomReportId','Mohs','cm_contact_has_tags','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','SalesforceAccount','Subject','Description','VariableId','SugarcrmField','Field','DeskConfiguration','int_desk_configuration_has_tags','ZohoConfiguration','ZohoField','int_zendesk_configuration_has_tags','FreshdeskField','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerField','FreshsalesField','JscriptyQuestionReport','SessionId','JscriptyProject','ProjectId','VoiceQueues','MailQueues','team_has_whatsapp_queues','HopperBlacks','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','ChatOfflineMessageId','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','FromAgent','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','UserProfileResource','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','defaultsDeep','motion2','xC@LL1234','127.0.0.1','name','utf8','sequelizeHistory','xcall','utf8mb4','utf8_general_ci','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','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','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','cascade','UserId','hasMany'];(function(_0x3484e3,_0x246f13){var _0x5b1a72=function(_0x2f4734){while(--_0x2f4734){_0x3484e3['push'](_0x3484e3['shift']());}};_0x5b1a72(++_0x246f13);}(_0x2646,0xee));var _0x6264=function(_0x53f740,_0x1c689c){_0x53f740=_0x53f740-0x0;var _0x50636a=_0x2646[_0x53f740];return _0x50636a;};'use strict';var config=require(_0x6264('0x0'));var Sequelize=require(_0x6264('0x1'));var _=require(_0x6264('0x2'));var jstz=require(_0x6264('0x3'));var timezone=jstz['determine']();config[_0x6264('0x1')]=_[_0x6264('0x4')](config[_0x6264('0x1')],{'database':_0x6264('0x5'),'username':'xcall','password':_0x6264('0x6'),'options':{'host':_0x6264('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x6264('0x8')](),'define':{'charset':_0x6264('0x9'),'collate':'utf8_general_ci'}}});config[_0x6264('0xa')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':'motion2','username':_0x6264('0xb'),'password':_0x6264('0x6'),'options':{'host':_0x6264('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x6264('0xc')},'logging':![],'timezone':timezone[_0x6264('0x8')](),'define':{'charset':_0x6264('0x9'),'collate':_0x6264('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6264('0x1')][_0x6264('0xe')],config[_0x6264('0x1')][_0x6264('0xf')],config['sequelize'][_0x6264('0x10')],config['sequelize'][_0x6264('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x6264('0xe')],config['sequelizeHistory'][_0x6264('0xf')],config[_0x6264('0xa')][_0x6264('0x10')],config[_0x6264('0xa')][_0x6264('0x11')])};db[_0x6264('0x12')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x14'));db[_0x6264('0x15')]=db[_0x6264('0x1')]['import'](_0x6264('0x16'));db[_0x6264('0x17')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x18'));db[_0x6264('0x19')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x1a'));db[_0x6264('0x1b')]=db['sequelize']['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x1c'));db[_0x6264('0x1d')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x1e'));db[_0x6264('0x1f')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x20'));db['VoiceMail']=db[_0x6264('0x1')][_0x6264('0x13')]('../api/voiceMail/voiceMail.model');db[_0x6264('0x21')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x22'));db[_0x6264('0x23')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x24'));db[_0x6264('0x25')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x26'));db[_0x6264('0x27')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x28'));db[_0x6264('0x29')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x2a'));db[_0x6264('0x2b')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x2c'));db['Trunk']=db[_0x6264('0x1')]['import']('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x2d'));db['UserVoiceQueueRt']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x2e'));db['UserVoiceQueue']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x2f'));db[_0x6264('0x30')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x31'));db['UserMailQueue']=db[_0x6264('0x1')]['import'](_0x6264('0x32'));db['UserFaxQueue']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x33'));db[_0x6264('0x34')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x35'));db[_0x6264('0x36')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x37'));db[_0x6264('0x38')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/mailServerIn/mailServerIn.model');db[_0x6264('0x39')]=db['sequelize']['import'](_0x6264('0x3a'));db[_0x6264('0x3b')]=db['sequelize']['import'](_0x6264('0x3c'));db['MailQueue']=db[_0x6264('0x1')]['import'](_0x6264('0x3d'));db[_0x6264('0x3e')]=db[_0x6264('0x1')]['import']('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x6264('0x1')]['import'](_0x6264('0x3f'));db[_0x6264('0x40')]=db['sequelize'][_0x6264('0x13')]('../api/mailMessage/mailMessage.model');db['MailApplication']=db[_0x6264('0x1')][_0x6264('0x13')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db['sequelize'][_0x6264('0x13')](_0x6264('0x41'));db[_0x6264('0x42')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x43'));db[_0x6264('0x44')]=db[_0x6264('0x1')]['import']('../api/dashboardItem/dashboardItem.model');db[_0x6264('0x45')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/faxAccount/faxAccount.model');db[_0x6264('0x46')]=db['sequelize']['import'](_0x6264('0x47'));db['FaxInteraction']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x48'));db[_0x6264('0x49')]=db['sequelize']['import'](_0x6264('0x4a'));db['FaxQueue']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x4b'));db[_0x6264('0x4c')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x4d'));db[_0x6264('0x4e')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x4f'));db[_0x6264('0x50')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x51'));db[_0x6264('0x52')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x53'));db['SmsMessage']=db['sequelize']['import'](_0x6264('0x54'));db[_0x6264('0x55')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/smsQueue/smsQueue.model');db[_0x6264('0x56')]=db['sequelize'][_0x6264('0x13')]('../api/openchannelAccount/openchannelAccount.model');db[_0x6264('0x57')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x58'));db[_0x6264('0x59')]=db['sequelize'][_0x6264('0x13')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x6264('0x5a')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x5b'));db[_0x6264('0x5c')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x5d'));db[_0x6264('0x5e')]=db['sequelize'][_0x6264('0x13')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db['sequelize'][_0x6264('0x13')](_0x6264('0x5f'));db[_0x6264('0x60')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x61'));db[_0x6264('0x62')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x63'));db[_0x6264('0x64')]=db[_0x6264('0x1')]['import']('../api/chatMessage/chatMessage.model');db[_0x6264('0x65')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x6264('0x66')]=db['sequelize']['import'](_0x6264('0x67'));db['ChatGroup']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x68'));db[_0x6264('0x69')]=db[_0x6264('0x1')]['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0x6264('0x6a')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x6b'));db['CmContact']=db[_0x6264('0x1')]['import']('../api/cmContact/cmContact.model');db[_0x6264('0x6c')]=db['sequelize'][_0x6264('0x13')](_0x6264('0x6d'));db['CmHopperBlack']=db['sequelize'][_0x6264('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db[_0x6264('0x1')][_0x6264('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x6264('0x6e')]=db[_0x6264('0x1')]['import'](_0x6264('0x6f'));db['ReportAgentPreview']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x70'));db[_0x6264('0x71')]=db[_0x6264('0x1')]['import'](_0x6264('0x72'));db[_0x6264('0x73')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x74'));db[_0x6264('0x75')]=db['sequelize'][_0x6264('0x13')]('../api/automation/automation.model');db[_0x6264('0x76')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x77'));db[_0x6264('0x78')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x79'));db['Condition']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x7a'));db[_0x6264('0x7b')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x7c'));db[_0x6264('0x7d')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x7e'));db[_0x6264('0x7f')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x6264('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x6264('0x81')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x82'));db['Sound']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x83'));db[_0x6264('0x84')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/tag/tag.model');db['Template']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x85'));db[_0x6264('0x86')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x87'));db[_0x6264('0x88')]=db[_0x6264('0x1')]['import']('../api/variable/variable.model');db[_0x6264('0x89')]=db[_0x6264('0x1')]['import']('../api/integration/integration.model');db[_0x6264('0x8a')]=db[_0x6264('0x1')]['import'](_0x6264('0x8b'));db[_0x6264('0x8c')]=db[_0x6264('0x1')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0x6264('0x8d')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x8e'));db[_0x6264('0x8f')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x90'));db['AnalyticMetric']=db[_0x6264('0x1')]['import'](_0x6264('0x91'));db[_0x6264('0x92')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x93'));db['AnalyticTreeReport']=db[_0x6264('0x1')][_0x6264('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db[_0x6264('0x1')]['import'](_0x6264('0x94'));db[_0x6264('0x95')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x96'));db[_0x6264('0x97')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x98'));db[_0x6264('0x99')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x9a'));db[_0x6264('0x9b')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x9c'));db['SugarcrmField']=db[_0x6264('0x1')][_0x6264('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x6264('0x9d')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x9e'));db['DeskConfiguration']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x9f'));db[_0x6264('0xa0')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xa1'));db[_0x6264('0xa2')]=db[_0x6264('0x1')]['import'](_0x6264('0xa3'));db['ZohoConfiguration']=db['sequelize']['import'](_0x6264('0xa4'));db['ZohoField']=db['sequelize'][_0x6264('0x13')](_0x6264('0xa5'));db[_0x6264('0xa6')]=db['sequelize'][_0x6264('0x13')](_0x6264('0xa7'));db[_0x6264('0xa8')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xa9'));db[_0x6264('0xaa')]=db['sequelize'][_0x6264('0x13')](_0x6264('0xab'));db['FreshdeskAccount']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xac'));db[_0x6264('0xad')]=db[_0x6264('0x1')]['import'](_0x6264('0xae'));db['FreshdeskField']=db[_0x6264('0x1')][_0x6264('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x6264('0x1')]['import'](_0x6264('0xaf'));db[_0x6264('0xb0')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xb1'));db['VtigerField']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xb2'));db[_0x6264('0xb3')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xb4'));db[_0x6264('0xb5')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xb6'));db[_0x6264('0xb7')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xb8'));db[_0x6264('0xb9')]=db['sequelize'][_0x6264('0x13')](_0x6264('0xba'));db[_0x6264('0xbb')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xbc'));db[_0x6264('0xbd')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xbe'));db[_0x6264('0xbf')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x6264('0xc0')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xc1'));db['FreshsalesField']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xc2'));db[_0x6264('0x89')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xc3'));db['Network']=db['sequelize'][_0x6264('0x13')](_0x6264('0xc4'));db[_0x6264('0xc5')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xc6'));db['ChatInternalMessage']=db[_0x6264('0x1')][_0x6264('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x6264('0xc7')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xc8'));db['JscriptyQuestionReport']=db['sequelize'][_0x6264('0x13')](_0x6264('0xc9'));db[_0x6264('0xca')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xcb'));db[_0x6264('0xcc')]=db['sequelize'][_0x6264('0x13')](_0x6264('0xcd'));db['SquareReport']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xce'));db[_0x6264('0xcf')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xd0'));db['JscriptyProject']=db['sequelize']['import'](_0x6264('0xd1'));db[_0x6264('0xd2')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xd3'));db[_0x6264('0xd4')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xd5'));db['SquareProject']=db['sequelize'][_0x6264('0x13')](_0x6264('0xd6'));db[_0x6264('0xd7')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/squareRecording/squareRecording.model');db[_0x6264('0xd8')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/squareMessage/squareMessage.model');db[_0x6264('0xd9')]=db['sequelize'][_0x6264('0x13')](_0x6264('0xda'));db[_0x6264('0xdb')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xdc'));db[_0x6264('0xdd')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xde'));db[_0x6264('0xdf')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xe0'));db['Attachment']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xe1'));db[_0x6264('0xe2')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xe3'));db['MailTransferReport']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xe4'));db[_0x6264('0xe5')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xe6'));db[_0x6264('0xe7')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xe8'));db[_0x6264('0xe9')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db['sequelize']['import'](_0x6264('0xea'));db[_0x6264('0xeb')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xec'));db[_0x6264('0xed')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xee'));db[_0x6264('0xef')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xf0'));db[_0x6264('0xf1')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xf2'));db['UserProfileResource']=db[_0x6264('0x1')]['import'](_0x6264('0xf3'));db['UserNotification']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xf4'));db[_0x6264('0xf5')]=db[_0x6264('0x1')]['import'](_0x6264('0xf6'));db[_0x6264('0xf7')]=db['sequelize'][_0x6264('0x13')](_0x6264('0xf8'));db[_0x6264('0xf9')]=db[_0x6264('0x1')][_0x6264('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x6264('0xfa')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xfb'));db[_0x6264('0xfc')]=db[_0x6264('0x1')]['import'](_0x6264('0xfd'));db['WhatsappTransferReport']=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0xfe'));db[_0x6264('0xff')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x100'));db[_0x6264('0x101')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x102'));db[_0x6264('0x103')]=db['sequelize']['import'](_0x6264('0x104'));db[_0x6264('0x105')]=db[_0x6264('0x1')]['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x6264('0x106')]=db[_0x6264('0x1')][_0x6264('0x13')](_0x6264('0x107'));db['User'][_0x6264('0x108')](db[_0x6264('0x109')],{'as':'VoiceMail','onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')][_0x6264('0x10c')](db[_0x6264('0x1d')],{'as':_0x6264('0x10d'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')][_0x6264('0x10c')](db[_0x6264('0x10e')],{'as':_0x6264('0x10f'),'foreignKey':'UserId'});db[_0x6264('0x12')]['hasMany'](db['VoiceExtension'],{'as':_0x6264('0x110'),'onDelete':_0x6264('0x10a'),'hooks':!![]});db['User'][_0x6264('0x10c')](db['CmHopperFinal'],{'as':_0x6264('0x111'),'foreignKey':'UserId'});db['User'][_0x6264('0x10c')](db[_0x6264('0x6e')],{'as':_0x6264('0x112'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')][_0x6264('0x10c')](db[_0x6264('0x113')],{'as':_0x6264('0x113'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')]['hasMany'](db[_0x6264('0x59')],{'as':_0x6264('0x114'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')][_0x6264('0x10c')](db['ChatInteraction'],{'as':_0x6264('0x115'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')][_0x6264('0x10c')](db[_0x6264('0x52')],{'as':_0x6264('0x116'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')]['hasMany'](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')]['hasMany'](db['MailInteraction'],{'as':_0x6264('0x117'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')][_0x6264('0x10c')](db[_0x6264('0xf9')],{'as':'WhatsappInteractions','foreignKey':_0x6264('0x10b')});db[_0x6264('0x12')][_0x6264('0x10c')](db['UserNotification'],{'as':_0x6264('0x118'),'foreignKey':_0x6264('0x119')});db['User'][_0x6264('0x11a')](db['UserProfile'],{'as':_0x6264('0xef'),'foreignKey':_0x6264('0x11b')});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0x11d')],{'as':'Groups','through':_0x6264('0x11e')});db[_0x6264('0x12')][_0x6264('0x11c')](db['CmContact'],{'as':_0x6264('0x11f'),'through':'cm_user_has_contacts'});db['User'][_0x6264('0x11c')](db[_0x6264('0xeb')],{'as':'Lists','through':_0x6264('0x120')});db[_0x6264('0x12')]['belongsToMany'](db[_0x6264('0xd9')],{'through':_0x6264('0x121')});db['User']['belongsToMany'](db['MailInteraction'],{'as':_0x6264('0x117'),'through':'user_has_mail_interactions'});db[_0x6264('0x12')]['belongsToMany'](db['ChatInteraction'],{'as':_0x6264('0x115'),'through':_0x6264('0x122')});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0x123')],{'as':_0x6264('0x124'),'through':_0x6264('0x125')});db[_0x6264('0x12')]['belongsToMany'](db['SmsInteraction'],{'as':_0x6264('0x116'),'through':_0x6264('0x126')});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0x59')],{'as':'OpenchannelInteractions','through':_0x6264('0x127')});db[_0x6264('0x12')][_0x6264('0x11c')](db['WhatsappInteraction'],{'as':_0x6264('0x128'),'through':_0x6264('0x129')});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0x12a')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0x6264('0x12')]['belongsToMany'](db[_0x6264('0xed')],{'as':_0x6264('0x12b'),'through':'UserVoicePrefix','required':![]});db[_0x6264('0x12')]['belongsToMany'](db[_0x6264('0x12c')],{'as':'MailQueues','through':_0x6264('0x12d'),'required':![]});db[_0x6264('0x12')][_0x6264('0x11c')](db['ChatQueue'],{'as':_0x6264('0x12e'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x6264('0x11c')](db[_0x6264('0x12f')],{'as':_0x6264('0x130'),'through':_0x6264('0x131'),'required':![]});db[_0x6264('0x12')]['belongsToMany'](db[_0x6264('0x55')],{'as':'SmsQueues','through':_0x6264('0x34'),'required':![]});db['User']['belongsToMany'](db[_0x6264('0x5c')],{'as':_0x6264('0x132'),'through':_0x6264('0x133'),'required':![]});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0xff')],{'as':_0x6264('0x134'),'through':_0x6264('0x36'),'required':![]});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0xeb')],{'through':_0x6264('0x120')});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0xed')],{'as':_0x6264('0x12b'),'through':'user_has_voice_prefixes','required':![]});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0x5e')],{'as':_0x6264('0x135'),'through':_0x6264('0x136')});db[_0x6264('0x12')][_0x6264('0x11c')](db['FaxAccount'],{'as':_0x6264('0x137'),'through':_0x6264('0x138')});db[_0x6264('0x12')][_0x6264('0x11c')](db[_0x6264('0x3b')],{'as':'MailAccounts','through':_0x6264('0x139')});db[_0x6264('0x12')]['belongsToMany'](db[_0x6264('0x56')],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db['User']['belongsToMany'](db[_0x6264('0x4e')],{'as':_0x6264('0x13a'),'through':_0x6264('0x13b')});db[_0x6264('0x12')][_0x6264('0x11c')](db['WhatsappAccount'],{'as':_0x6264('0x13c'),'through':_0x6264('0x13d')});db['User'][_0x6264('0x11c')](db[_0x6264('0x13e')],{'as':'SquareProjects','through':_0x6264('0x13f')});db[_0x6264('0x15')]['hasMany'](db[_0x6264('0x19')],{'as':_0x6264('0x140'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x141')});db[_0x6264('0x17')][_0x6264('0x10c')](db[_0x6264('0x19')],{'onDelete':_0x6264('0x10a')});db[_0x6264('0x19')][_0x6264('0x10c')](db[_0x6264('0x19')],{'as':_0x6264('0x142'),'onDelete':_0x6264('0x10a')});db[_0x6264('0x1b')][_0x6264('0x11c')](db[_0x6264('0x143')],{'as':_0x6264('0x144'),'through':_0x6264('0x145')});db[_0x6264('0x12a')][_0x6264('0x10c')](db[_0x6264('0x10e')],{'as':_0x6264('0x146'),'foreignKey':'VoiceQueueId'});db[_0x6264('0x12a')][_0x6264('0x10c')](db[_0x6264('0x6c')],{'as':_0x6264('0x147'),'foreignKey':_0x6264('0x148')});db[_0x6264('0x12a')]['hasMany'](db['CmHopperFinal'],{'as':_0x6264('0x111'),'foreignKey':_0x6264('0x148')});db[_0x6264('0x12a')][_0x6264('0x10c')](db[_0x6264('0x6e')],{'as':_0x6264('0x149'),'foreignKey':_0x6264('0x148')});db[_0x6264('0x12a')]['hasMany'](db[_0x6264('0x113')],{'as':_0x6264('0x113'),'foreignKey':_0x6264('0x148')});db[_0x6264('0x12a')]['hasMany'](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x6264('0x148')});db['VoiceQueue'][_0x6264('0x10c')](db['JscriptySessionReport'],{'as':_0x6264('0x14a'),'foreignKey':_0x6264('0x148')});db[_0x6264('0x12a')][_0x6264('0x11a')](db['Trunk'],{'as':_0x6264('0x14b'),'foreignKey':_0x6264('0x14c')});db['VoiceQueue'][_0x6264('0x11a')](db[_0x6264('0x14b')],{'as':_0x6264('0x14d'),'foreignKey':'TrunkBackupId'});db[_0x6264('0x12a')][_0x6264('0x11a')](db[_0x6264('0x7b')],{'as':_0x6264('0x7b'),'foreignKey':_0x6264('0x14e')});db['VoiceQueue'][_0x6264('0x11a')](db['Pause'],{'as':_0x6264('0x14f'),'foreignKey':_0x6264('0x150')});db['VoiceQueue'][_0x6264('0x11c')](db[_0x6264('0xeb')],{'as':_0x6264('0x151'),'through':_0x6264('0x152')});db[_0x6264('0x12a')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':'Agents','through':_0x6264('0x153')});db[_0x6264('0x12a')][_0x6264('0x11c')](db[_0x6264('0xd9')],{'as':_0x6264('0x154'),'through':_0x6264('0x103')});db['VoiceQueue']['belongsToMany'](db[_0x6264('0xeb')],{'as':'BlackLists','through':_0x6264('0x155')});db[_0x6264('0x1d')][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x12'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x1f')][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x12'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x109')][_0x6264('0x10c')](db['VoiceMailMessage'],{'as':_0x6264('0x156'),'onDelete':'cascade','foreignKey':_0x6264('0x157'),'sourceKey':'mailbox'});db[_0x6264('0x21')][_0x6264('0x11a')](db['VoiceMail'],{'foreignKey':_0x6264('0x157'),'targetKey':_0x6264('0x158')});db['VoiceCallReport'][_0x6264('0x10c')](db[_0x6264('0x29')],{'as':_0x6264('0x159'),'foreignKey':_0x6264('0x15a'),'constraints':![]});db[_0x6264('0x23')]['hasMany'](db[_0x6264('0x27')],{'as':_0x6264('0x15b'),'foreignKey':_0x6264('0x15a'),'constraints':![]});db[_0x6264('0x23')][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x12'),'foreignKey':_0x6264('0x10b')});db['VoiceCallReport'][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x38')][_0x6264('0x11a')](db['MailAccount'],{'as':_0x6264('0x3b'),'foreignKey':_0x6264('0x15f')});db[_0x6264('0x39')]['belongsTo'](db[_0x6264('0x3b')],{'as':_0x6264('0x3b'),'foreignKey':_0x6264('0x15f')});db['MailAccount'][_0x6264('0x108')](db[_0x6264('0x38')],{'as':'Imap','onDelete':_0x6264('0x10a')});db['MailAccount']['hasOne'](db[_0x6264('0x39')],{'as':'Smtp','onDelete':'cascade'});db['MailAccount']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x6264('0x15f'),'onDelete':'cascade'});db[_0x6264('0x3b')][_0x6264('0x10c')](db[_0x6264('0x76')],{'as':_0x6264('0x160'),'foreignKey':_0x6264('0x15f')});db[_0x6264('0x3b')][_0x6264('0x10c')](db[_0x6264('0x40')],{'as':_0x6264('0x156'),'foreignKey':_0x6264('0x15f')});db[_0x6264('0x3b')]['hasMany'](db[_0x6264('0x161')],{'as':_0x6264('0x162')});db[_0x6264('0x3b')][_0x6264('0x10c')](db[_0x6264('0x163')],{'as':_0x6264('0x142')});db[_0x6264('0x3b')]['belongsTo'](db[_0x6264('0xeb')],{'as':_0x6264('0x164'),'foreignKey':_0x6264('0x165')});db[_0x6264('0x3b')][_0x6264('0x11a')](db[_0x6264('0x166')],{'as':_0x6264('0x166'),'foreignKey':'TemplateId'});db[_0x6264('0x3b')]['belongsTo'](db[_0x6264('0x7d')],{'as':_0x6264('0x14f'),'foreignKey':_0x6264('0x150')});db[_0x6264('0x3b')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':_0x6264('0x139')});db['MailQueue'][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':'Agents','through':_0x6264('0x12d')});db[_0x6264('0x12c')][_0x6264('0x11c')](db['Team'],{'through':_0x6264('0x168'),'as':_0x6264('0x154')});db[_0x6264('0x161')][_0x6264('0x10c')](db[_0x6264('0x40')],{'as':_0x6264('0x156'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x169')});db[_0x6264('0x161')][_0x6264('0x11a')](db[_0x6264('0x3b')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x15f')});db[_0x6264('0x161')]['belongsTo'](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x161')][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x16b'),'foreignKey':'UserId'});db['MailInteraction'][_0x6264('0x11c')](db['Tag'],{'through':_0x6264('0x16c'),'as':_0x6264('0x16d')});db[_0x6264('0x161')][_0x6264('0x11c')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x6264('0x16e')});db[_0x6264('0x161')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':'Users','through':_0x6264('0x16f'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x6264('0x10c')](db[_0x6264('0x170')],{'as':_0x6264('0x171'),'onDelete':_0x6264('0x10a')});db['MailMessage'][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x12')});db[_0x6264('0x40')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x15d')});db[_0x6264('0x40')][_0x6264('0x11a')](db[_0x6264('0x161')],{'as':'Interaction','foreignKey':_0x6264('0x169')});db['MailMessage'][_0x6264('0x11a')](db['MailAccount'],{'as':'Account','foreignKey':_0x6264('0x15f')});db['MailMessage'][_0x6264('0x11a')](db[_0x6264('0x5e')],{'as':_0x6264('0x5e'),'foreignKey':_0x6264('0x172')});db['MailMessage'][_0x6264('0x11a')](db['ChatOfflineMessage'],{'as':_0x6264('0x65'),'foreignKey':'ChatOfflineMessageId'});db[_0x6264('0x163')][_0x6264('0x11a')](db[_0x6264('0x12')],{'onDelete':_0x6264('0x173')});db[_0x6264('0x163')]['belongsTo'](db[_0x6264('0x12c')],{'onDelete':_0x6264('0x173')});db[_0x6264('0x163')][_0x6264('0x11a')](db[_0x6264('0x3b')],{'onDelete':_0x6264('0x173')});db[_0x6264('0x163')][_0x6264('0x11a')](db['Interval'],{'onDelete':_0x6264('0x173'),'foreignKey':_0x6264('0x14e')});db[_0x6264('0x163')]['belongsTo'](db[_0x6264('0x84')],{'onDelete':'restrict','foreignKey':_0x6264('0x174')});db[_0x6264('0x175')][_0x6264('0x11a')](db['MailAccount'],{});db[_0x6264('0x175')][_0x6264('0x11a')](db['CmList'],{'as':'List','foreignKey':_0x6264('0x165')});db[_0x6264('0x175')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x175')][_0x6264('0x11a')](db['MailInteraction'],{});db[_0x6264('0x175')][_0x6264('0x11a')](db[_0x6264('0x40')],{});db['MailQueueReport'][_0x6264('0x11a')](db[_0x6264('0x12')],{});db[_0x6264('0x175')][_0x6264('0x11a')](db[_0x6264('0x12c')],{});db[_0x6264('0x42')][_0x6264('0x10c')](db['DashboardItem'],{'as':_0x6264('0x176'),'onDelete':_0x6264('0x10a')});db[_0x6264('0x45')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x6264('0x177'),'onDelete':_0x6264('0x10a')});db['FaxAccount'][_0x6264('0x10c')](db['CannedAnswer'],{'as':_0x6264('0x160'),'foreignKey':_0x6264('0x177')});db['FaxAccount'][_0x6264('0x10c')](db['FaxInteraction'],{'as':_0x6264('0x162')});db['FaxAccount'][_0x6264('0x10c')](db[_0x6264('0x46')],{'as':_0x6264('0x142')});db[_0x6264('0x45')][_0x6264('0x10c')](db[_0x6264('0x19')],{'as':_0x6264('0x178'),'onDelete':_0x6264('0x10a')});db[_0x6264('0x45')][_0x6264('0x10c')](db[_0x6264('0x49')],{'as':_0x6264('0x156')});db[_0x6264('0x45')][_0x6264('0x11a')](db['Trunk'],{'as':'Trunk'});db[_0x6264('0x45')][_0x6264('0x11a')](db[_0x6264('0xeb')],{'as':_0x6264('0x164'),'foreignKey':_0x6264('0x165')});db['FaxAccount']['belongsTo'](db[_0x6264('0x7d')],{'as':_0x6264('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6264('0x45')]['belongsToMany'](db['User'],{'as':_0x6264('0x167'),'through':'user_has_fax_accounts'});db[_0x6264('0x46')]['belongsTo'](db[_0x6264('0x12')],{'onDelete':_0x6264('0x173')});db[_0x6264('0x46')]['belongsTo'](db[_0x6264('0x12f')],{'onDelete':_0x6264('0x173')});db[_0x6264('0x46')][_0x6264('0x11a')](db[_0x6264('0x45')],{'onDelete':_0x6264('0x173')});db[_0x6264('0x46')][_0x6264('0x11a')](db[_0x6264('0x84')],{'onDelete':_0x6264('0x173'),'foreignKey':_0x6264('0x174')});db[_0x6264('0x123')]['hasMany'](db[_0x6264('0x49')],{'as':_0x6264('0x156'),'onDelete':'cascade','foreignKey':_0x6264('0x179')});db['FaxInteraction'][_0x6264('0x11a')](db[_0x6264('0x45')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x177')});db['FaxInteraction'][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x123')][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x16b'),'foreignKey':'UserId'});db['FaxInteraction'][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':_0x6264('0x17a'),'as':'Tags'});db[_0x6264('0x123')][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':'fax_interaction_has_tags','as':_0x6264('0x16e')});db[_0x6264('0x123')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x17b'),'through':'user_has_fax_interactions','foreignKey':_0x6264('0x179')});db['FaxMessage'][_0x6264('0x11a')](db['User'],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x12')});db['FaxMessage'][_0x6264('0x11a')](db[_0x6264('0x123')],{'as':_0x6264('0x17c'),'foreignKey':_0x6264('0x179')});db['FaxMessage'][_0x6264('0x11a')](db[_0x6264('0x15c')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x15d')});db['FaxMessage'][_0x6264('0x11a')](db[_0x6264('0x170')],{'as':_0x6264('0x170'),'foreignKey':'AttachmentId'});db[_0x6264('0x49')][_0x6264('0x11a')](db[_0x6264('0x45')],{'as':'Account','foreignKey':_0x6264('0x177')});db[_0x6264('0x12f')]['belongsToMany'](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':_0x6264('0x131')});db[_0x6264('0x12f')][_0x6264('0x11c')](db[_0x6264('0xd9')],{'through':'team_has_fax_queues','as':_0x6264('0x154')});db[_0x6264('0x4c')][_0x6264('0x11a')](db[_0x6264('0x45')],{});db[_0x6264('0x4c')][_0x6264('0x11a')](db['CmList'],{'as':_0x6264('0x164'),'foreignKey':_0x6264('0x165')});db[_0x6264('0x4c')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':'ContactId'});db['FaxQueueReport']['belongsTo'](db['FaxInteraction'],{});db['FaxQueueReport'][_0x6264('0x11a')](db[_0x6264('0x49')],{});db['FaxQueueReport']['belongsTo'](db[_0x6264('0x12')],{});db[_0x6264('0x4c')][_0x6264('0x11a')](db[_0x6264('0x12f')],{});db['SmsAccount'][_0x6264('0x10c')](db[_0x6264('0x78')],{'as':'Dispositions','foreignKey':_0x6264('0x17d'),'onDelete':'cascade'});db['SmsAccount'][_0x6264('0x10c')](db['CannedAnswer'],{'as':_0x6264('0x160'),'foreignKey':_0x6264('0x17d')});db[_0x6264('0x4e')][_0x6264('0x10c')](db[_0x6264('0x17e')],{'as':'Messages','foreignKey':_0x6264('0x17d')});db[_0x6264('0x4e')]['hasMany'](db[_0x6264('0x52')],{'as':_0x6264('0x162')});db[_0x6264('0x4e')][_0x6264('0x10c')](db[_0x6264('0x50')],{'as':_0x6264('0x142')});db[_0x6264('0x4e')][_0x6264('0x11a')](db[_0x6264('0xeb')],{'as':_0x6264('0x164'),'foreignKey':_0x6264('0x165')});db[_0x6264('0x4e')][_0x6264('0x11a')](db[_0x6264('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x6264('0x150')});db[_0x6264('0x4e')]['belongsToMany'](db['User'],{'as':_0x6264('0x167'),'through':'user_has_sms_accounts'});db['SmsApplication'][_0x6264('0x11a')](db['User'],{'onDelete':_0x6264('0x173')});db[_0x6264('0x50')][_0x6264('0x11a')](db[_0x6264('0x55')],{'onDelete':'restrict'});db[_0x6264('0x50')]['belongsTo'](db[_0x6264('0x4e')],{'onDelete':_0x6264('0x173')});db[_0x6264('0x50')][_0x6264('0x11a')](db[_0x6264('0x7b')],{'onDelete':_0x6264('0x173'),'foreignKey':'IntervalId'});db['SmsApplication'][_0x6264('0x11a')](db['Tag'],{'onDelete':_0x6264('0x173'),'foreignKey':'TagId'});db[_0x6264('0x52')][_0x6264('0x10c')](db['SmsMessage'],{'as':_0x6264('0x156'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x17f')});db[_0x6264('0x52')][_0x6264('0x11a')](db[_0x6264('0x4e')],{'as':'Account','foreignKey':_0x6264('0x17d')});db[_0x6264('0x52')][_0x6264('0x11a')](db['CmContact'],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x52')][_0x6264('0x11a')](db['User'],{'as':_0x6264('0x16b'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x52')][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':_0x6264('0x180'),'as':'Tags'});db[_0x6264('0x52')][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':'sms_interaction_has_tags','as':_0x6264('0x16e')});db[_0x6264('0x52')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x17b'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db[_0x6264('0x17e')]['belongsTo'](db['User'],{'as':_0x6264('0x12')});db['SmsMessage'][_0x6264('0x11a')](db['CmContact'],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x15d')});db[_0x6264('0x17e')][_0x6264('0x11a')](db[_0x6264('0x52')],{'onDelete':'cascade','as':_0x6264('0x17c'),'foreignKey':'SmsInteractionId'});db[_0x6264('0x17e')][_0x6264('0x11a')](db[_0x6264('0x4e')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x17d')});db[_0x6264('0x55')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':_0x6264('0x34'),'foreignKey':'SmsQueueId'});db[_0x6264('0x55')][_0x6264('0x11c')](db[_0x6264('0xd9')],{'through':_0x6264('0x181'),'as':_0x6264('0x154')});db[_0x6264('0x56')][_0x6264('0x10c')](db[_0x6264('0x78')],{'as':_0x6264('0x182'),'foreignKey':_0x6264('0x183'),'onDelete':'cascade'});db[_0x6264('0x56')][_0x6264('0x10c')](db[_0x6264('0x76')],{'as':_0x6264('0x160'),'foreignKey':_0x6264('0x183')});db[_0x6264('0x56')][_0x6264('0x10c')](db['OpenchannelInteraction'],{'as':_0x6264('0x162'),'foreignKey':_0x6264('0x183')});db['OpenchannelAccount']['hasMany'](db['OpenchannelMessage'],{'as':_0x6264('0x156'),'foreignKey':'OpenchannelAccountId'});db[_0x6264('0x56')]['hasMany'](db['OpenchannelApplication'],{'as':_0x6264('0x142'),'foreignKey':_0x6264('0x183')});db[_0x6264('0x56')][_0x6264('0x11a')](db[_0x6264('0xeb')],{'as':'List','foreignKey':_0x6264('0x165')});db[_0x6264('0x56')][_0x6264('0x11a')](db[_0x6264('0x7d')],{'as':_0x6264('0x14f'),'foreignKey':_0x6264('0x150')});db[_0x6264('0x56')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':'Agents','through':_0x6264('0x184')});db[_0x6264('0x57')]['belongsTo'](db[_0x6264('0x12')],{'onDelete':_0x6264('0x173')});db[_0x6264('0x57')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0x6264('0x173'),'foreignKey':'OpenchannelQueueId'});db[_0x6264('0x57')][_0x6264('0x11a')](db[_0x6264('0x56')],{'onDelete':_0x6264('0x173'),'foreignKey':_0x6264('0x183')});db[_0x6264('0x57')][_0x6264('0x11a')](db[_0x6264('0x7b')],{'onDelete':_0x6264('0x173'),'foreignKey':'IntervalId'});db['OpenchannelApplication']['belongsTo'](db[_0x6264('0x84')],{'onDelete':_0x6264('0x173'),'foreignKey':_0x6264('0x174')});db[_0x6264('0x59')][_0x6264('0x10c')](db[_0x6264('0x5a')],{'as':_0x6264('0x156'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x185')});db[_0x6264('0x59')]['belongsTo'](db[_0x6264('0x56')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x183')});db[_0x6264('0x59')]['belongsTo'](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':'ContactId'});db[_0x6264('0x59')]['belongsTo'](db['User'],{'as':_0x6264('0x16b'),'foreignKey':'UserId'});db[_0x6264('0x59')][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':_0x6264('0x186'),'as':_0x6264('0x16d')});db['OpenchannelInteraction']['belongsToMany'](db['Tag'],{'through':_0x6264('0x186'),'as':'ThroughTags'});db[_0x6264('0x59')]['belongsToMany'](db[_0x6264('0x12')],{'as':'Users','through':_0x6264('0x127'),'foreignKey':_0x6264('0x185')});db[_0x6264('0x5a')]['belongsTo'](db[_0x6264('0x12')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x12')});db['OpenchannelMessage'][_0x6264('0x11a')](db[_0x6264('0x15c')],{'onDelete':'cascade','as':_0x6264('0x15d')});db[_0x6264('0x5a')][_0x6264('0x11a')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x6264('0x17c'),'foreignKey':_0x6264('0x185')});db['OpenchannelMessage'][_0x6264('0x11a')](db[_0x6264('0x170')],{'as':_0x6264('0x170'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x6264('0x11a')](db[_0x6264('0x56')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x183')});db['OpenchannelQueue']['belongsToMany'](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':'UserOpenchannelQueue','foreignKey':_0x6264('0x187')});db[_0x6264('0x5c')][_0x6264('0x11c')](db[_0x6264('0xd9')],{'through':_0x6264('0x188'),'as':'Teams'});db['ChatWebsite']['hasMany'](db['Disposition'],{'as':_0x6264('0x182'),'foreignKey':_0x6264('0x172'),'onDelete':'cascade'});db[_0x6264('0x5e')]['hasMany'](db[_0x6264('0x76')],{'as':'Answers','foreignKey':_0x6264('0x172')});db['ChatWebsite'][_0x6264('0x10c')](db[_0x6264('0x69')],{'as':_0x6264('0x189')});db['ChatWebsite'][_0x6264('0x10c')](db[_0x6264('0x62')],{'as':_0x6264('0x162')});db['ChatWebsite']['hasMany'](db[_0x6264('0x60')],{'as':_0x6264('0x142')});db[_0x6264('0x5e')]['hasMany'](db['ChatMessage'],{'as':_0x6264('0x156')});db[_0x6264('0x5e')]['belongsTo'](db[_0x6264('0xeb')],{'as':_0x6264('0x164'),'foreignKey':_0x6264('0x165')});db[_0x6264('0x5e')][_0x6264('0x11a')](db['Interval'],{'as':_0x6264('0x7b'),'foreignKey':_0x6264('0x14e')});db[_0x6264('0x5e')][_0x6264('0x11a')](db['MailAccount'],{'as':_0x6264('0x3b'),'foreignKey':_0x6264('0x15f')});db[_0x6264('0x5e')][_0x6264('0x11a')](db[_0x6264('0x7d')],{'as':_0x6264('0x14f'),'foreignKey':_0x6264('0x150')});db[_0x6264('0x5e')]['belongsToMany'](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':_0x6264('0x136')});db['OpenchannelQueueReport'][_0x6264('0x11a')](db[_0x6264('0x56')],{});db[_0x6264('0x18a')]['belongsTo'](db[_0x6264('0xeb')],{'as':'List','foreignKey':'ListId'});db['OpenchannelQueueReport'][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x18a')][_0x6264('0x11a')](db[_0x6264('0x59')],{});db[_0x6264('0x18a')][_0x6264('0x11a')](db[_0x6264('0x5a')],{});db[_0x6264('0x18a')][_0x6264('0x11a')](db[_0x6264('0x12')],{});db[_0x6264('0x18a')][_0x6264('0x11a')](db[_0x6264('0x5c')],{});db[_0x6264('0x60')][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':'Agent','foreignKey':_0x6264('0x10b'),'onDelete':_0x6264('0x173')});db[_0x6264('0x60')][_0x6264('0x11a')](db[_0x6264('0x66')],{'as':_0x6264('0x18b'),'foreignKey':_0x6264('0x18c'),'onDelete':_0x6264('0x173')});db[_0x6264('0x60')][_0x6264('0x11a')](db['ChatWebsite'],{'as':_0x6264('0x18d'),'foreignKey':_0x6264('0x172'),'onDelete':_0x6264('0x173')});db[_0x6264('0x60')][_0x6264('0x11a')](db[_0x6264('0x84')],{'onDelete':_0x6264('0x173'),'foreignKey':'TagId'});db[_0x6264('0x62')][_0x6264('0x10c')](db[_0x6264('0x64')],{'as':_0x6264('0x156'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x18e')});db[_0x6264('0x62')][_0x6264('0x11a')](db[_0x6264('0x5e')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x172')});db[_0x6264('0x62')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x62')][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x16b'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x62')][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':'chat_interaction_has_tags','as':_0x6264('0x16d')});db['ChatInteraction'][_0x6264('0x11c')](db['Tag'],{'through':_0x6264('0x18f'),'as':_0x6264('0x16e')});db[_0x6264('0x62')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x17b'),'through':_0x6264('0x122'),'foreignKey':_0x6264('0x18e')});db[_0x6264('0x64')]['belongsTo'](db[_0x6264('0x12')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x12')});db[_0x6264('0x64')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db['ChatMessage'][_0x6264('0x11a')](db[_0x6264('0x62')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x17c'),'foreignKey':'ChatInteractionId'});db[_0x6264('0x64')][_0x6264('0x11a')](db[_0x6264('0x170')],{'as':'Attachment','foreignKey':_0x6264('0x190')});db[_0x6264('0x64')]['belongsTo'](db[_0x6264('0x5e')],{'as':_0x6264('0x16a'),'foreignKey':'ChatWebsiteId'});db[_0x6264('0x65')][_0x6264('0x10c')](db[_0x6264('0x170')],{'as':_0x6264('0x171'),'foreignKey':'ChatOfflineMessageId','onDelete':'cascade','hooks':!![]});db[_0x6264('0x65')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x15d'),'foreignKey':'ContactId'});db[_0x6264('0x65')]['belongsTo'](db[_0x6264('0x5e')],{'as':'Account','foreignKey':_0x6264('0x172')});db[_0x6264('0x66')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':_0x6264('0x30'),'hooks':!![]});db[_0x6264('0x66')][_0x6264('0x11c')](db[_0x6264('0xd9')],{'through':'team_has_chat_queues','as':'Teams'});db[_0x6264('0x11d')][_0x6264('0x10c')](db[_0x6264('0x191')],{'as':_0x6264('0x156'),'foreignKey':'ChatGroupId','onDelete':_0x6264('0x10a')});db[_0x6264('0x11d')]['belongsToMany'](db[_0x6264('0x12')],{'as':_0x6264('0x146'),'through':_0x6264('0x11e')});db[_0x6264('0x69')][_0x6264('0x11a')](db[_0x6264('0x5e')],{'as':'Website','foreignKey':_0x6264('0x172')});db['CmCompany'][_0x6264('0x10c')](db[_0x6264('0x15c')],{'as':_0x6264('0x11f'),'foreignKey':_0x6264('0x192')});db[_0x6264('0x15c')][_0x6264('0x10c')](db[_0x6264('0x6c')],{'as':'Hoppers','foreignKey':_0x6264('0x15e')});db[_0x6264('0x15c')][_0x6264('0x10c')](db[_0x6264('0x193')],{'as':_0x6264('0x111'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x15c')][_0x6264('0x10c')](db[_0x6264('0x6e')],{'as':_0x6264('0x149'),'foreignKey':'ContactId'});db[_0x6264('0x15c')]['hasMany'](db[_0x6264('0x113')],{'as':_0x6264('0x113'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0x15c')][_0x6264('0x10c')](db[_0x6264('0xca')],{'as':_0x6264('0x14a'),'foreignKey':'ContactId'});db[_0x6264('0x15c')][_0x6264('0x10c')](db[_0x6264('0x59')],{'as':_0x6264('0x114'),'foreignKey':_0x6264('0x15e'),'onDelete':_0x6264('0x173')});db[_0x6264('0x15c')][_0x6264('0x10c')](db[_0x6264('0x62')],{'as':_0x6264('0x115'),'foreignKey':_0x6264('0x15e'),'onDelete':'restrict'});db['CmContact'][_0x6264('0x10c')](db[_0x6264('0x52')],{'as':_0x6264('0x116'),'foreignKey':_0x6264('0x15e'),'onDelete':'restrict'});db[_0x6264('0x15c')]['hasMany'](db[_0x6264('0x123')],{'as':_0x6264('0x124'),'foreignKey':_0x6264('0x15e'),'onDelete':_0x6264('0x173')});db[_0x6264('0x15c')][_0x6264('0x10c')](db['MailInteraction'],{'as':_0x6264('0x117'),'foreignKey':_0x6264('0x15e'),'onDelete':'restrict'});db[_0x6264('0x15c')]['belongsTo'](db[_0x6264('0x6a')],{'as':'Company','foreignKey':_0x6264('0x192')});db[_0x6264('0x15c')][_0x6264('0x11a')](db['CmList'],{'as':_0x6264('0x164'),'foreignKey':_0x6264('0x165'),'onDelete':'cascade'});db[_0x6264('0x15c')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x17b'),'through':_0x6264('0x194')});db[_0x6264('0x15c')][_0x6264('0x11c')](db[_0x6264('0x84')],{'as':_0x6264('0x16d'),'through':'cm_contact_has_tags'});db[_0x6264('0x15c')][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':'cm_contact_has_tags','as':_0x6264('0x16e')});db[_0x6264('0x6c')][_0x6264('0x11a')](db['CmContact'],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e'),'onDelete':'cascade'});db[_0x6264('0x6c')][_0x6264('0x11a')](db[_0x6264('0xeb')],{'as':_0x6264('0x164'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x6264('0x6c')][_0x6264('0x11a')](db['User'],{'as':_0x6264('0x195'),'foreignKey':_0x6264('0x10b')});db[_0x6264('0x6c')][_0x6264('0x11a')](db[_0x6264('0x12a')],{'as':_0x6264('0x18b'),'foreignKey':'VoiceQueueId','onDelete':_0x6264('0x10a')});db[_0x6264('0x6c')][_0x6264('0x11a')](db['Campaign'],{'as':_0x6264('0xdd'),'foreignKey':_0x6264('0x196'),'onDelete':_0x6264('0x10a')});db['CmHopper'][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x16b'),'foreignKey':_0x6264('0x197')});db[_0x6264('0x198')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':'Contact','foreignKey':_0x6264('0x15e'),'onDelete':_0x6264('0x10a')});db[_0x6264('0x198')][_0x6264('0x11a')](db[_0x6264('0xeb')],{'as':_0x6264('0x164'),'foreignKey':'ListId','onDelete':_0x6264('0x10a')});db[_0x6264('0x198')]['belongsTo'](db['VoiceQueue'],{'as':_0x6264('0x18b'),'foreignKey':_0x6264('0x148'),'onDelete':_0x6264('0x10a')});db[_0x6264('0x198')]['belongsTo'](db['Campaign'],{'as':_0x6264('0xdd'),'foreignKey':_0x6264('0x196'),'onDelete':_0x6264('0x10a')});db[_0x6264('0x75')][_0x6264('0x10c')](db[_0x6264('0x199')],{'as':{'plural':_0x6264('0x19a'),'singular':_0x6264('0x19b')},'foreignKey':_0x6264('0x19c'),'onDelete':'cascade','hooks':!![]});db[_0x6264('0x75')][_0x6264('0x10c')](db['Condition'],{'as':{'plural':_0x6264('0x19d'),'singular':_0x6264('0x19e')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x6264('0x75')][_0x6264('0x10c')](db['Action'],{'as':'Actions','foreignKey':_0x6264('0x19f'),'onDelete':'cascade','hooks':!![]});db['Disposition'][_0x6264('0x10c')](db[_0x6264('0x78')],{'as':'Dispositions','foreignKey':_0x6264('0x1a0'),'onDelete':_0x6264('0x10a')});db['Interval'][_0x6264('0x10c')](db[_0x6264('0x7b')],{'as':_0x6264('0x1a1'),'foreignKey':_0x6264('0x14e'),'onDelete':_0x6264('0x10a'),'hooks':!![],'required':![]});db[_0x6264('0x7b')][_0x6264('0x10c')](db['VoiceExtension'],{'as':_0x6264('0x110'),'foreignKey':_0x6264('0x14e'),'onDelete':_0x6264('0x173')});db[_0x6264('0x7b')][_0x6264('0x10c')](db[_0x6264('0x163')],{'as':'MailApplications','foreignKey':_0x6264('0x14e')});db[_0x6264('0x7b')][_0x6264('0x10c')](db[_0x6264('0x60')],{'as':'ChatApplications','foreignKey':_0x6264('0x14e')});db[_0x6264('0x7b')][_0x6264('0x10c')](db[_0x6264('0x46')],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0x6264('0x7b')][_0x6264('0x10c')](db['SmsApplication'],{'as':_0x6264('0x1a2'),'foreignKey':'IntervalId'});db[_0x6264('0x81')][_0x6264('0x11a')](db[_0x6264('0x3b')],{});db['Schedule'][_0x6264('0x11a')](db[_0x6264('0x8d')],{'foreignKey':_0x6264('0x1a3')});db[_0x6264('0x81')][_0x6264('0x11a')](db[_0x6264('0x8c')],{'foreignKey':_0x6264('0x1a4')});db['Sound'][_0x6264('0x11c')](db['VoiceMusicOnHold'],{'as':_0x6264('0x1a5'),'through':_0x6264('0x145'),'onDelete':_0x6264('0x173')});db[_0x6264('0x84')][_0x6264('0x11c')](db[_0x6264('0x15c')],{'through':_0x6264('0x1a6')});db['Tag'][_0x6264('0x11c')](db[_0x6264('0x62')],{'through':_0x6264('0x18f')});db[_0x6264('0x84')]['belongsToMany'](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x6264('0x84')][_0x6264('0x11c')](db[_0x6264('0x52')],{'through':'sms_interaction_has_tags'});db[_0x6264('0x84')]['belongsToMany'](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x6264('0x84')][_0x6264('0x11c')](db[_0x6264('0x59')],{'through':_0x6264('0x186')});db[_0x6264('0x84')]['belongsToMany'](db[_0x6264('0xf9')],{'through':_0x6264('0x1a7')});db[_0x6264('0x86')][_0x6264('0x10c')](db[_0x6264('0x199')],{'as':{'plural':'AllConditions','singular':_0x6264('0x1a8')},'foreignKey':_0x6264('0x1a9'),'onDelete':'cascade','hooks':!![]});db[_0x6264('0x86')][_0x6264('0x10c')](db['Condition'],{'as':{'plural':_0x6264('0x1aa'),'singular':_0x6264('0x1ab')},'foreignKey':_0x6264('0x1ac'),'onDelete':_0x6264('0x10a'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x6264('0x73')],{'as':_0x6264('0x1ad'),'foreignKey':_0x6264('0x1ae'),'onDelete':_0x6264('0x10a'),'hooks':!![]});db[_0x6264('0x8c')][_0x6264('0x10c')](db[_0x6264('0x92')],{'as':_0x6264('0x1af'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1a4'),'hooks':!![]});db[_0x6264('0x8d')][_0x6264('0x10c')](db[_0x6264('0x92')],{'as':'Fields','onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x6264('0x1b0')][_0x6264('0x10c')](db['AnalyticFieldReport'],{'as':_0x6264('0x1af'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b1')});db[_0x6264('0x92')][_0x6264('0x11a')](db[_0x6264('0x1b0')],{'foreignKey':_0x6264('0x1b1')});db['SalesforceAccount'][_0x6264('0x10c')](db[_0x6264('0x95')],{'as':_0x6264('0x1b2'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b3')});db[_0x6264('0x95')][_0x6264('0x10c')](db['SalesforceField'],{'as':_0x6264('0x1b4'),'onDelete':'cascade','foreignKey':_0x6264('0x1b5')});db['SalesforceConfiguration'][_0x6264('0x10c')](db[_0x6264('0x97')],{'as':_0x6264('0x1b6'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0x95')][_0x6264('0x10c')](db['SalesforceField'],{'as':_0x6264('0x1af'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0x95')][_0x6264('0x11a')](db[_0x6264('0x1b9')],{'as':'Account','foreignKey':_0x6264('0x1b3')});db[_0x6264('0x97')][_0x6264('0x10c')](db[_0x6264('0x97')],{'as':_0x6264('0x1ba'),'foreignKey':'SubjectId'});db[_0x6264('0x97')]['hasMany'](db[_0x6264('0x97')],{'as':_0x6264('0x1bb'),'foreignKey':'DescriptionId'});db['SalesforceField']['hasMany'](db[_0x6264('0x97')],{'as':'Field','foreignKey':'FieldId'});db[_0x6264('0x97')]['belongsTo'](db[_0x6264('0x88')],{'as':_0x6264('0x88'),'foreignKey':_0x6264('0x1bc')});db[_0x6264('0x99')][_0x6264('0x10c')](db[_0x6264('0x9b')],{'as':_0x6264('0x1b2'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b3')});db[_0x6264('0x9b')][_0x6264('0x10c')](db['SugarcrmField'],{'as':_0x6264('0x1b4'),'onDelete':'cascade','foreignKey':_0x6264('0x1b5')});db['SugarcrmConfiguration']['hasMany'](db[_0x6264('0x1bd')],{'as':_0x6264('0x1b6'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0x9b')][_0x6264('0x10c')](db[_0x6264('0x1bd')],{'as':_0x6264('0x1af'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0x9b')]['belongsTo'](db[_0x6264('0x99')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x1b3')});db[_0x6264('0x1bd')][_0x6264('0x10c')](db['SugarcrmField'],{'as':_0x6264('0x1ba'),'foreignKey':'SubjectId'});db[_0x6264('0x1bd')]['hasMany'](db[_0x6264('0x1bd')],{'as':_0x6264('0x1bb'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0x1bd')][_0x6264('0x10c')](db['SugarcrmField'],{'as':_0x6264('0x1be'),'foreignKey':_0x6264('0x1b8')});db['SugarcrmField']['belongsTo'](db[_0x6264('0x88')],{'as':'Variable','foreignKey':'VariableId'});db[_0x6264('0x9d')][_0x6264('0x10c')](db['DeskConfiguration'],{'as':_0x6264('0x1b2'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b3')});db[_0x6264('0x1bf')][_0x6264('0x10c')](db[_0x6264('0xa0')],{'as':_0x6264('0x1b4'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b5')});db[_0x6264('0x1bf')][_0x6264('0x10c')](db[_0x6264('0xa0')],{'as':_0x6264('0x1b6'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['DeskConfiguration'][_0x6264('0x10c')](db[_0x6264('0xa0')],{'as':_0x6264('0x1af'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0x1bf')][_0x6264('0x11a')](db[_0x6264('0x9d')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x1b3')});db['DeskConfiguration']['belongsToMany'](db[_0x6264('0x84')],{'through':_0x6264('0x1c0')});db[_0x6264('0xa0')]['hasMany'](db[_0x6264('0xa0')],{'as':_0x6264('0x1ba'),'foreignKey':_0x6264('0x1b5')});db['DeskField']['hasMany'](db[_0x6264('0xa0')],{'as':'Description','foreignKey':_0x6264('0x1b7')});db['DeskField']['hasMany'](db[_0x6264('0xa0')],{'as':_0x6264('0x1be'),'foreignKey':'FieldId'});db['DeskField'][_0x6264('0x11a')](db[_0x6264('0x88')],{'as':'Variable','foreignKey':_0x6264('0x1bc')});db[_0x6264('0xa2')][_0x6264('0x10c')](db[_0x6264('0x1c1')],{'as':'Configurations','onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b3')});db[_0x6264('0x1c1')][_0x6264('0x10c')](db[_0x6264('0x1c2')],{'as':'Subjects','onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b5')});db[_0x6264('0x1c1')][_0x6264('0x10c')](db[_0x6264('0x1c2')],{'as':_0x6264('0x1b6'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0x1c1')][_0x6264('0x10c')](db[_0x6264('0x1c2')],{'as':'Fields','onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b8')});db['ZohoConfiguration']['belongsTo'](db[_0x6264('0xa2')],{'as':'Account','foreignKey':'AccountId'});db[_0x6264('0x1c2')][_0x6264('0x10c')](db[_0x6264('0x1c2')],{'as':_0x6264('0x1ba'),'foreignKey':_0x6264('0x1b5')});db[_0x6264('0x1c2')][_0x6264('0x10c')](db[_0x6264('0x1c2')],{'as':'Description','foreignKey':_0x6264('0x1b7')});db[_0x6264('0x1c2')]['hasMany'](db[_0x6264('0x1c2')],{'as':_0x6264('0x1be'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0x1c2')][_0x6264('0x11a')](db[_0x6264('0x88')],{'as':_0x6264('0x88'),'foreignKey':'VariableId'});db[_0x6264('0xa6')][_0x6264('0x10c')](db[_0x6264('0xa8')],{'as':_0x6264('0x1b2'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b3')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x6264('0x1b4'),'foreignKey':'SubjectId'});db[_0x6264('0xa8')][_0x6264('0x10c')](db['ZendeskField'],{'as':_0x6264('0x1b6'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0xa8')][_0x6264('0x10c')](db['ZendeskField'],{'as':_0x6264('0x1af'),'foreignKey':'FieldId'});db[_0x6264('0xa8')][_0x6264('0x11a')](db[_0x6264('0xa6')],{'as':_0x6264('0x16a'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':_0x6264('0x1c3')});db[_0x6264('0xaa')]['hasMany'](db[_0x6264('0xaa')],{'as':_0x6264('0x1ba'),'foreignKey':'SubjectId'});db[_0x6264('0xaa')][_0x6264('0x10c')](db[_0x6264('0xaa')],{'as':'Description','foreignKey':_0x6264('0x1b7')});db[_0x6264('0xaa')][_0x6264('0x10c')](db[_0x6264('0xaa')],{'as':_0x6264('0x1be'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0xaa')][_0x6264('0x11a')](db[_0x6264('0x88')],{'as':'Variable','foreignKey':_0x6264('0x1bc')});db['FreshdeskAccount']['hasMany'](db['FreshdeskConfiguration'],{'as':_0x6264('0x1b2'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b3')});db[_0x6264('0xad')]['hasMany'](db['FreshdeskField'],{'as':_0x6264('0x1b4'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b5')});db[_0x6264('0xad')][_0x6264('0x10c')](db[_0x6264('0x1c4')],{'as':_0x6264('0x1b6'),'onDelete':_0x6264('0x10a'),'foreignKey':'DescriptionId'});db[_0x6264('0xad')][_0x6264('0x10c')](db[_0x6264('0x1c4')],{'as':_0x6264('0x1af'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0xad')]['belongsTo'](db[_0x6264('0x1c5')],{'as':_0x6264('0x16a'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x6264('0x11c')](db[_0x6264('0x84')],{'through':_0x6264('0x1c6')});db['FreshdeskField'][_0x6264('0x10c')](db[_0x6264('0x1c4')],{'as':_0x6264('0x1ba'),'foreignKey':_0x6264('0x1b5')});db[_0x6264('0x1c4')][_0x6264('0x10c')](db['FreshdeskField'],{'as':_0x6264('0x1bb'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0x1c4')]['hasMany'](db[_0x6264('0x1c4')],{'as':_0x6264('0x1be'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0x1c4')][_0x6264('0x11a')](db[_0x6264('0x88')],{'as':_0x6264('0x88'),'foreignKey':_0x6264('0x1bc')});db[_0x6264('0x1c7')][_0x6264('0x10c')](db[_0x6264('0xb0')],{'as':_0x6264('0x1b2'),'onDelete':'cascade','foreignKey':_0x6264('0x1b3')});db[_0x6264('0xb0')][_0x6264('0x10c')](db[_0x6264('0x1c8')],{'as':'Subjects','foreignKey':_0x6264('0x1b5')});db[_0x6264('0xb0')][_0x6264('0x10c')](db['VtigerField'],{'as':_0x6264('0x1b6'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0xb0')][_0x6264('0x10c')](db[_0x6264('0x1c8')],{'as':_0x6264('0x1af'),'foreignKey':_0x6264('0x1b8')});db['VtigerConfiguration'][_0x6264('0x11a')](db[_0x6264('0x1c7')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x1b3')});db[_0x6264('0x1c8')]['hasMany'](db[_0x6264('0x1c8')],{'as':_0x6264('0x1ba'),'foreignKey':_0x6264('0x1b5')});db['VtigerField']['hasMany'](db[_0x6264('0x1c8')],{'as':_0x6264('0x1bb'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0x1c8')][_0x6264('0x10c')](db[_0x6264('0x1c8')],{'as':_0x6264('0x1be'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0x1c8')][_0x6264('0x11a')](db[_0x6264('0x88')],{'as':_0x6264('0x88'),'foreignKey':_0x6264('0x1bc')});db[_0x6264('0xb3')][_0x6264('0x10c')](db[_0x6264('0xb5')],{'as':'Configurations','onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b3')});db['ServicenowConfiguration'][_0x6264('0x10c')](db[_0x6264('0xb7')],{'as':_0x6264('0x1b4'),'foreignKey':_0x6264('0x1b5')});db['ServicenowConfiguration'][_0x6264('0x10c')](db[_0x6264('0xb7')],{'as':_0x6264('0x1b6'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0xb5')][_0x6264('0x10c')](db[_0x6264('0xb7')],{'as':'Fields','foreignKey':_0x6264('0x1b8')});db[_0x6264('0xb5')]['belongsTo'](db['ServicenowAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x6264('0xb7')]['hasMany'](db[_0x6264('0xb7')],{'as':_0x6264('0x1ba'),'foreignKey':_0x6264('0x1b5')});db[_0x6264('0xb7')][_0x6264('0x10c')](db[_0x6264('0xb7')],{'as':_0x6264('0x1bb'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0xb7')]['hasMany'](db[_0x6264('0xb7')],{'as':_0x6264('0x1be'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0xb7')][_0x6264('0x11a')](db[_0x6264('0x88')],{'as':_0x6264('0x88'),'foreignKey':'VariableId'});db[_0x6264('0xb9')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x6264('0x1b2'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b3')});db['Dynamics365Configuration']['hasMany'](db[_0x6264('0xbd')],{'as':_0x6264('0x1b4'),'onDelete':'cascade','foreignKey':_0x6264('0x1b5')});db[_0x6264('0xbb')]['hasMany'](db['Dynamics365Field'],{'as':_0x6264('0x1b6'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b7')});db[_0x6264('0xbb')][_0x6264('0x10c')](db[_0x6264('0xbd')],{'as':'Fields','onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0xbb')][_0x6264('0x11a')](db[_0x6264('0xb9')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x1b3')});db[_0x6264('0xbd')]['hasMany'](db['Dynamics365Field'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x6264('0xbd')][_0x6264('0x10c')](db[_0x6264('0xbd')],{'as':_0x6264('0x1bb'),'foreignKey':'DescriptionId'});db['Dynamics365Field'][_0x6264('0x10c')](db[_0x6264('0xbd')],{'as':_0x6264('0x1be'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0xbd')]['belongsTo'](db[_0x6264('0x88')],{'as':_0x6264('0x88'),'foreignKey':_0x6264('0x1bc')});db[_0x6264('0xbf')][_0x6264('0x10c')](db[_0x6264('0xc0')],{'as':_0x6264('0x1b2'),'onDelete':'cascade','foreignKey':_0x6264('0x1b3')});db[_0x6264('0xc0')][_0x6264('0x10c')](db[_0x6264('0x1c9')],{'as':_0x6264('0x1b4'),'foreignKey':_0x6264('0x1b5')});db[_0x6264('0xc0')][_0x6264('0x10c')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x6264('0x10c')](db[_0x6264('0x1c9')],{'as':_0x6264('0x1af'),'foreignKey':'FieldId'});db[_0x6264('0xc0')][_0x6264('0x11a')](db[_0x6264('0xbf')],{'as':'Account','foreignKey':_0x6264('0x1b3')});db[_0x6264('0x1c9')][_0x6264('0x10c')](db[_0x6264('0x1c9')],{'as':_0x6264('0x1ba'),'foreignKey':_0x6264('0x1b5')});db[_0x6264('0x1c9')][_0x6264('0x10c')](db[_0x6264('0x1c9')],{'as':_0x6264('0x1bb'),'foreignKey':'DescriptionId'});db[_0x6264('0x1c9')]['hasMany'](db[_0x6264('0x1c9')],{'as':_0x6264('0x1be'),'foreignKey':_0x6264('0x1b8')});db[_0x6264('0x1c9')]['belongsTo'](db['Variable'],{'as':_0x6264('0x88'),'foreignKey':_0x6264('0x1bc')});db[_0x6264('0xc5')][_0x6264('0x11a')](db[_0x6264('0x5e')],{});db[_0x6264('0xc5')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x6264('0x165')});db[_0x6264('0xc5')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0xc5')]['belongsTo'](db['ChatInteraction'],{});db['ChatQueueReport'][_0x6264('0x11a')](db[_0x6264('0x64')],{});db[_0x6264('0xc5')][_0x6264('0x11a')](db[_0x6264('0x12')],{});db[_0x6264('0xc5')]['belongsTo'](db[_0x6264('0x66')],{});db[_0x6264('0x191')][_0x6264('0x11a')](db[_0x6264('0x12')],{'onDelete':_0x6264('0x10a'),'foreignKey':'FromId'});db[_0x6264('0x191')]['belongsTo'](db[_0x6264('0x12')],{'onDelete':'cascade','foreignKey':'ToId'});db['JscriptySessionReport'][_0x6264('0x10c')](db[_0x6264('0x1ca')],{'foreignKey':_0x6264('0x1cb'),'onDelete':_0x6264('0x10a')});db[_0x6264('0xca')]['hasMany'](db[_0x6264('0xc7')],{'foreignKey':_0x6264('0x1cb'),'onDelete':_0x6264('0x10a')});db['SmsQueueReport'][_0x6264('0x11a')](db[_0x6264('0x4e')],{});db['SmsQueueReport'][_0x6264('0x11a')](db['CmList'],{'as':'List','foreignKey':_0x6264('0x165')});db[_0x6264('0xcc')]['belongsTo'](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db[_0x6264('0xcc')]['belongsTo'](db['SmsInteraction'],{});db[_0x6264('0xcc')][_0x6264('0x11a')](db['SmsMessage'],{});db[_0x6264('0xcc')][_0x6264('0x11a')](db['User'],{});db[_0x6264('0xcc')][_0x6264('0x11a')](db[_0x6264('0x55')],{});db[_0x6264('0x1cc')][_0x6264('0x10c')](db['JscriptySessionReport'],{'foreignKey':_0x6264('0x1cd')});db['JscriptyProject'][_0x6264('0x10c')](db[_0x6264('0x1ca')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x6264('0x10c')](db['JscriptyAnswerReport'],{'foreignKey':_0x6264('0x1cd')});db['SquareProject']['belongsToMany'](db['User'],{'as':'Users','through':'user_has_square_projects'});db['Team']['belongsToMany'](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':_0x6264('0x121')});db[_0x6264('0xd9')][_0x6264('0x11c')](db[_0x6264('0x12a')],{'through':_0x6264('0x103'),'as':_0x6264('0x1ce')});db['Team'][_0x6264('0x11c')](db['MailQueue'],{'through':_0x6264('0x168'),'as':_0x6264('0x1cf')});db[_0x6264('0xd9')][_0x6264('0x11c')](db[_0x6264('0x66')],{'through':'team_has_chat_queues','as':_0x6264('0x12e')});db[_0x6264('0xd9')][_0x6264('0x11c')](db['FaxQueue'],{'through':'team_has_fax_queues','as':_0x6264('0x130')});db['Team'][_0x6264('0x11c')](db[_0x6264('0x55')],{'through':_0x6264('0x181'),'as':'SmsQueues'});db[_0x6264('0xd9')][_0x6264('0x11c')](db[_0x6264('0x5c')],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x6264('0xd9')][_0x6264('0x11c')](db['WhatsappQueue'],{'through':_0x6264('0x1d0'),'as':_0x6264('0x134')});db[_0x6264('0xd9')][_0x6264('0x11c')](db[_0x6264('0xed')],{'through':_0x6264('0x105'),'as':'VoicePrefixes'});db[_0x6264('0xdd')][_0x6264('0x10c')](db[_0x6264('0x6c')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0x6264('0xdd')][_0x6264('0x10c')](db[_0x6264('0x193')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0x6264('0xdd')]['hasMany'](db[_0x6264('0x6e')],{'as':'HopperHistories','foreignKey':_0x6264('0x196')});db[_0x6264('0xdd')][_0x6264('0x10c')](db[_0x6264('0x198')],{'as':_0x6264('0x1d1'),'foreignKey':_0x6264('0x196')});db['Campaign'][_0x6264('0x11a')](db[_0x6264('0x14b')],{'as':_0x6264('0x14b'),'foreignKey':'TrunkId'});db[_0x6264('0xdd')][_0x6264('0x11a')](db['Trunk'],{'as':_0x6264('0x14d'),'foreignKey':_0x6264('0x1d2')});db[_0x6264('0xdd')][_0x6264('0x11a')](db[_0x6264('0x7b')],{'as':_0x6264('0x7b'),'foreignKey':_0x6264('0x14e')});db[_0x6264('0xdd')][_0x6264('0x11a')](db['SquareProject'],{'as':'SquareProject','foreignKey':_0x6264('0x1d3')});db[_0x6264('0xdd')][_0x6264('0x11c')](db['CmList'],{'as':'Lists','through':_0x6264('0x1d4')});db[_0x6264('0xdd')]['belongsToMany'](db[_0x6264('0xeb')],{'as':_0x6264('0x1d5'),'through':_0x6264('0x1d6')});db[_0x6264('0x170')]['belongsTo'](db[_0x6264('0x65')],{'as':_0x6264('0x65'),'foreignKey':_0x6264('0x1d7')});db[_0x6264('0x1d8')][_0x6264('0x11a')](db[_0x6264('0x40')],{});db[_0x6264('0x1d8')][_0x6264('0x11a')](db['MailInteraction'],{});db[_0x6264('0x1d8')]['belongsTo'](db[_0x6264('0x3b')],{'foreignKey':_0x6264('0x1d9'),'as':_0x6264('0x1da')});db[_0x6264('0x1d8')]['belongsTo'](db[_0x6264('0x12')],{'foreignKey':_0x6264('0x1db'),'as':'FromAgent'});db[_0x6264('0x1d8')][_0x6264('0x11a')](db['User'],{'foreignKey':_0x6264('0x1dc'),'as':_0x6264('0x1dd')});db[_0x6264('0x1d8')][_0x6264('0x11a')](db['MailQueue'],{'foreignKey':_0x6264('0x1de'),'as':'ToQueue'});db[_0x6264('0x1d8')][_0x6264('0x11a')](db[_0x6264('0x3b')],{'foreignKey':'ToMailAccountId','as':_0x6264('0x1df')});db[_0x6264('0xe5')]['belongsTo'](db['ChatMessage'],{});db[_0x6264('0xe5')]['belongsTo'](db[_0x6264('0x62')],{});db[_0x6264('0xe5')][_0x6264('0x11a')](db[_0x6264('0x5e')],{'foreignKey':_0x6264('0x1e0'),'as':_0x6264('0x1da')});db[_0x6264('0xe5')][_0x6264('0x11a')](db[_0x6264('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x6264('0xe5')]['belongsTo'](db[_0x6264('0x12')],{'foreignKey':'ToUserId','as':_0x6264('0x1dd')});db[_0x6264('0xe5')][_0x6264('0x11a')](db[_0x6264('0x66')],{'foreignKey':_0x6264('0x1e1'),'as':_0x6264('0x1e2')});db[_0x6264('0xe5')][_0x6264('0x11a')](db[_0x6264('0x5e')],{'foreignKey':_0x6264('0x1e3'),'as':'ToAccount'});db[_0x6264('0xe7')]['belongsTo'](db[_0x6264('0x49')],{});db[_0x6264('0xe7')][_0x6264('0x11a')](db[_0x6264('0x123')],{});db['FaxTransferReport'][_0x6264('0x11a')](db[_0x6264('0x45')],{'foreignKey':_0x6264('0x1e4'),'as':_0x6264('0x1da')});db[_0x6264('0xe7')][_0x6264('0x11a')](db[_0x6264('0x12')],{'foreignKey':_0x6264('0x1db'),'as':_0x6264('0x1e5')});db[_0x6264('0xe7')][_0x6264('0x11a')](db[_0x6264('0x12')],{'foreignKey':_0x6264('0x1dc'),'as':_0x6264('0x1dd')});db[_0x6264('0xe7')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x6264('0x1e6'),'as':_0x6264('0x1e2')});db[_0x6264('0xe7')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x6264('0x1e7'),'as':_0x6264('0x1df')});db['OpenchannelTransferReport'][_0x6264('0x11a')](db[_0x6264('0x5a')],{});db[_0x6264('0xe9')][_0x6264('0x11a')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0x6264('0x11a')](db[_0x6264('0x56')],{'foreignKey':_0x6264('0x1e8'),'as':_0x6264('0x1da')});db[_0x6264('0xe9')]['belongsTo'](db[_0x6264('0x12')],{'foreignKey':_0x6264('0x1db'),'as':_0x6264('0x1e5')});db[_0x6264('0xe9')][_0x6264('0x11a')](db[_0x6264('0x12')],{'foreignKey':_0x6264('0x1dc'),'as':_0x6264('0x1dd')});db[_0x6264('0xe9')][_0x6264('0x11a')](db['OpenchannelQueue'],{'foreignKey':_0x6264('0x1e9'),'as':_0x6264('0x1e2')});db[_0x6264('0xe9')][_0x6264('0x11a')](db[_0x6264('0x56')],{'foreignKey':_0x6264('0x1ea'),'as':_0x6264('0x1df')});db[_0x6264('0x1eb')][_0x6264('0x11a')](db['SmsMessage'],{});db[_0x6264('0x1eb')][_0x6264('0x11a')](db['SmsInteraction'],{});db[_0x6264('0x1eb')]['belongsTo'](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0x6264('0x1da')});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x6264('0x1db'),'as':_0x6264('0x1e5')});db[_0x6264('0x1eb')]['belongsTo'](db[_0x6264('0x12')],{'foreignKey':_0x6264('0x1dc'),'as':_0x6264('0x1dd')});db[_0x6264('0x1eb')]['belongsTo'](db[_0x6264('0x55')],{'foreignKey':_0x6264('0x1ec'),'as':'ToQueue'});db[_0x6264('0x1eb')][_0x6264('0x11a')](db['SmsAccount'],{'foreignKey':_0x6264('0x1ed'),'as':'ToAccount'});db[_0x6264('0xeb')][_0x6264('0x10c')](db[_0x6264('0x78')],{'as':_0x6264('0x182'),'foreignKey':_0x6264('0x165'),'onDelete':'cascade'});db[_0x6264('0xeb')][_0x6264('0x10c')](db[_0x6264('0x71')],{'as':_0x6264('0x1ee'),'foreignKey':'ListId'});db['CmList'][_0x6264('0x10c')](db[_0x6264('0x15c')],{'as':_0x6264('0x11f'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x165')});db[_0x6264('0xeb')][_0x6264('0x10c')](db[_0x6264('0x193')],{'as':_0x6264('0x111'),'foreignKey':_0x6264('0x165')});db['CmList'][_0x6264('0x10c')](db[_0x6264('0x6e')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x6264('0x10c')](db[_0x6264('0x113')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x6264('0xeb')][_0x6264('0x11c')](db[_0x6264('0x12a')],{'as':_0x6264('0x1ef'),'through':_0x6264('0x152')});db[_0x6264('0xeb')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':_0x6264('0x120')});db[_0x6264('0xed')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade'});db[_0x6264('0xed')]['belongsToMany'](db[_0x6264('0x12')],{'as':'Agents','through':_0x6264('0x106')});db[_0x6264('0xed')][_0x6264('0x11c')](db[_0x6264('0xd9')],{'through':'TeamVoicePrefix','as':_0x6264('0x154')});db[_0x6264('0xef')]['hasMany'](db[_0x6264('0x12')],{'as':'Users','foreignKey':_0x6264('0x11b')});db[_0x6264('0xef')]['hasMany'](db['UserProfileSection'],{'as':_0x6264('0x1f0'),'foreignKey':_0x6264('0x11b'),'onDelete':'cascade'});db['UserProfileSection'][_0x6264('0x10c')](db[_0x6264('0x1f1')],{'as':'Resources','foreignKey':_0x6264('0x1f2'),'onDelete':_0x6264('0x10a')});db['WhatsappAccount'][_0x6264('0x10c')](db[_0x6264('0x78')],{'as':_0x6264('0x182'),'foreignKey':_0x6264('0x1f3'),'onDelete':'cascade'});db[_0x6264('0xf5')]['hasMany'](db[_0x6264('0x76')],{'as':_0x6264('0x160'),'foreignKey':_0x6264('0x1f3')});db[_0x6264('0xf5')][_0x6264('0x10c')](db[_0x6264('0xfa')],{'as':_0x6264('0x156'),'foreignKey':'WhatsappAccountId'});db[_0x6264('0xf5')][_0x6264('0x10c')](db['WhatsappInteraction'],{'as':_0x6264('0x162')});db['WhatsappAccount'][_0x6264('0x10c')](db[_0x6264('0xf7')],{'as':_0x6264('0x142')});db[_0x6264('0xf5')][_0x6264('0x11a')](db['CmList'],{'as':'List','foreignKey':_0x6264('0x165')});db[_0x6264('0xf5')][_0x6264('0x11a')](db[_0x6264('0x7d')],{'as':_0x6264('0x14f'),'foreignKey':_0x6264('0x150')});db[_0x6264('0xf5')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x167'),'through':_0x6264('0x13d')});db['WhatsappApplication'][_0x6264('0x11a')](db[_0x6264('0x12')],{'onDelete':_0x6264('0x173')});db[_0x6264('0xf7')]['belongsTo'](db['WhatsappQueue'],{'onDelete':_0x6264('0x173')});db[_0x6264('0xf7')][_0x6264('0x11a')](db[_0x6264('0xf5')],{'onDelete':_0x6264('0x173')});db[_0x6264('0xf7')]['belongsTo'](db['Interval'],{'onDelete':_0x6264('0x173'),'foreignKey':'IntervalId'});db[_0x6264('0xf7')][_0x6264('0x11a')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x6264('0x174')});db[_0x6264('0xf9')]['hasMany'](db['WhatsappMessage'],{'as':_0x6264('0x156'),'onDelete':_0x6264('0x10a'),'foreignKey':_0x6264('0x1f4')});db[_0x6264('0xf9')][_0x6264('0x11a')](db[_0x6264('0xf5')],{'as':_0x6264('0x16a'),'foreignKey':'WhatsappAccountId'});db[_0x6264('0xf9')][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db['WhatsappInteraction'][_0x6264('0x11a')](db[_0x6264('0x12')],{'as':_0x6264('0x16b'),'foreignKey':_0x6264('0x10b')});db['WhatsappInteraction'][_0x6264('0x11c')](db['Tag'],{'through':_0x6264('0x1a7'),'as':_0x6264('0x16d')});db[_0x6264('0xf9')]['belongsToMany'](db[_0x6264('0x84')],{'through':_0x6264('0x1a7'),'as':_0x6264('0x16e')});db[_0x6264('0xf9')][_0x6264('0x11c')](db[_0x6264('0x12')],{'as':_0x6264('0x17b'),'through':_0x6264('0x129'),'foreignKey':_0x6264('0x1f4')});db[_0x6264('0xfa')][_0x6264('0x11a')](db['User'],{'as':_0x6264('0x12')});db[_0x6264('0xfa')]['belongsTo'](db[_0x6264('0x15c')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x15d')});db[_0x6264('0xfa')][_0x6264('0x11a')](db[_0x6264('0xf9')],{'onDelete':_0x6264('0x10a'),'as':_0x6264('0x17c'),'foreignKey':_0x6264('0x1f4')});db[_0x6264('0xfa')][_0x6264('0x11a')](db[_0x6264('0xf5')],{'as':_0x6264('0x16a'),'foreignKey':_0x6264('0x1f3')});db['WhatsappQueueReport'][_0x6264('0x11a')](db['WhatsappAccount'],{});db[_0x6264('0xfc')][_0x6264('0x11a')](db[_0x6264('0xeb')],{'as':'List','foreignKey':_0x6264('0x165')});db['WhatsappQueueReport'][_0x6264('0x11a')](db[_0x6264('0x15c')],{'as':_0x6264('0x15d'),'foreignKey':_0x6264('0x15e')});db['WhatsappQueueReport']['belongsTo'](db[_0x6264('0xf9')],{});db[_0x6264('0xfc')][_0x6264('0x11a')](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0x6264('0x11a')](db[_0x6264('0xfa')],{});db[_0x6264('0xfc')]['belongsTo'](db[_0x6264('0x12')],{});db[_0x6264('0x1f5')][_0x6264('0x11a')](db[_0x6264('0xfa')],{});db['WhatsappTransferReport'][_0x6264('0x11a')](db['WhatsappInteraction'],{});db[_0x6264('0x1f5')][_0x6264('0x11a')](db['WhatsappAccount'],{'foreignKey':_0x6264('0x1f6'),'as':'FromAccount'});db['WhatsappTransferReport']['belongsTo'](db[_0x6264('0xf5')],{'foreignKey':_0x6264('0x1f7'),'as':_0x6264('0x1df')});db[_0x6264('0x1f5')][_0x6264('0x11a')](db[_0x6264('0xff')],{'foreignKey':_0x6264('0x1f8'),'as':_0x6264('0x1e2')});db[_0x6264('0x1f5')][_0x6264('0x11a')](db[_0x6264('0x12')],{'foreignKey':_0x6264('0x1db'),'as':_0x6264('0x1e5')});db['WhatsappTransferReport'][_0x6264('0x11a')](db[_0x6264('0x12')],{'foreignKey':_0x6264('0x1dc'),'as':_0x6264('0x1dd')});db['WhatsappQueue'][_0x6264('0x11c')](db['User'],{'as':_0x6264('0x167'),'through':_0x6264('0x36'),'foreignKey':_0x6264('0x1f9')});db[_0x6264('0xff')]['belongsToMany'](db[_0x6264('0xd9')],{'through':_0x6264('0x1d0'),'as':'Teams'});module[_0x6264('0x1fa')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x0717=['../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','../api/automation/automation.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intDeskAccount/intDeskAccount.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoField','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','cascade','hasMany','UserId','Extensions','HopperFinals','CmHopperHistory','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','ChatInteractions','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','MailQueue','MailQueues','UserMailQueue','FaxQueues','SmsQueue','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','Applications','Sounds','moh_has_sounds','VoiceQueue','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','Trunk','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Team','Teams','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','hasOne','Smtp','Dispositions','Answers','MailMessage','Messages','Interactions','List','Template','TemplateId','Pause','team_has_mail_queues','Account','Contact','Owner','mail_interaction_has_tags','Tags','Tag','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','MailApplication','restrict','TagId','FaxAccountId','CannedAnswer','Exntensions','ListId','mandatoryDispositionPauseId','FaxInteractionId','fax_interaction_has_tags','Users','user_has_fax_interactions','AttachmentId','UserFaxQueue','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ThroughTags','ProactiveActions','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Members','Contacts','CompanyId','Hoppers','Company','cm_contact_has_tags','Agent','CampaignId','Queue','Automation','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','AnalyticFieldReport','DefaultReportId','MetricId','Configurations','AccountId','SalesforceField','Descriptions','DescriptionId','FieldId','SubjectId','Field','VariableId','SugarcrmAccount','Subjects','Description','DeskAccount','DeskConfiguration','Subject','ZohoConfiguration','ZendeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerField','FreshsalesConfiguration','FreshsalesField','ChatQueueReport','ChatInternalMessage','ToId','SessionId','JscriptyProject','ProjectId','JscriptyAnswerReport','VoiceQueues','ChatQueues','team_has_whatsapp_queues','TrunkId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','CustomFields','HopperHistory','Queues','UserProfileSections','Resources','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','WhatsappQueue','ToQueueId','WhatsappQueueId','exports','sequelize','lodash','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','xcall','name','database','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal'];(function(_0x3f0fa1,_0x5927bc){var _0x366b54=function(_0x1b5152){while(--_0x1b5152){_0x3f0fa1['push'](_0x3f0fa1['shift']());}};_0x366b54(++_0x5927bc);}(_0x0717,0x17f));var _0x7071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0717[_0x3dd15e];return _0x231fd0;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x7071('0x0'));var _=require(_0x7071('0x1'));var jstz=require('jstz');var timezone=jstz[_0x7071('0x2')]();config[_0x7071('0x0')]=_[_0x7071('0x3')](config[_0x7071('0x0')],{'database':_0x7071('0x4'),'username':'xcall','password':_0x7071('0x5'),'options':{'host':_0x7071('0x6'),'port':0xcea,'dialect':_0x7071('0x7'),'dialectOptions':{'charset':_0x7071('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x7071('0x9'),'collate':_0x7071('0xa')}}});config[_0x7071('0xb')]=_[_0x7071('0x3')](config['sequelizeHistory'],{'database':_0x7071('0x4'),'username':_0x7071('0xc'),'password':_0x7071('0x5'),'options':{'host':_0x7071('0x6'),'port':0xcea,'dialect':_0x7071('0x7'),'dialectOptions':{'charset':_0x7071('0x8')},'logging':![],'timezone':timezone[_0x7071('0xd')](),'define':{'charset':_0x7071('0x9'),'collate':_0x7071('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x7071('0xe')],config[_0x7071('0x0')]['username'],config[_0x7071('0x0')][_0x7071('0xf')],config[_0x7071('0x0')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7071('0xb')]['database'],config[_0x7071('0xb')]['username'],config['sequelizeHistory']['password'],config[_0x7071('0xb')]['options'])};db[_0x7071('0x10')]=db['sequelize'][_0x7071('0x11')](_0x7071('0x12'));db[_0x7071('0x13')]=db[_0x7071('0x0')]['import'](_0x7071('0x14'));db[_0x7071('0x15')]=db['sequelize']['import'](_0x7071('0x16'));db[_0x7071('0x17')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x18'));db[_0x7071('0x19')]=db[_0x7071('0x0')]['import'](_0x7071('0x1a'));db['VoiceQueue']=db['sequelize']['import'](_0x7071('0x1b'));db[_0x7071('0x1c')]=db['sequelize'][_0x7071('0x11')](_0x7071('0x1d'));db[_0x7071('0x1e')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x1f'));db[_0x7071('0x20')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x21'));db[_0x7071('0x22')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x23'));db[_0x7071('0x24')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x25'));db[_0x7071('0x26')]=db['sequelize'][_0x7071('0x11')](_0x7071('0x27'));db[_0x7071('0x28')]=db['sequelize'][_0x7071('0x11')](_0x7071('0x29'));db['VoiceQueueReport']=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x2a'));db['MemberReport']=db[_0x7071('0x0')]['import']('../api/memberReport/memberReport.model');db['Trunk']=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x2b'));db[_0x7071('0x2c')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x2d'));db[_0x7071('0x2e')]=db[_0x7071('0x0')]['import'](_0x7071('0x2f'));db[_0x7071('0x30')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x31'));db[_0x7071('0x32')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x33'));db['UserMailQueue']=db['sequelize'][_0x7071('0x11')](_0x7071('0x34'));db['UserFaxQueue']=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x35'));db['UserSmsQueue']=db[_0x7071('0x0')][_0x7071('0x11')]('../api/userSmsQueue/userSmsQueue.model');db[_0x7071('0x36')]=db[_0x7071('0x0')]['import'](_0x7071('0x37'));db[_0x7071('0x38')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x39'));db[_0x7071('0x3a')]=db['sequelize'][_0x7071('0x11')](_0x7071('0x3b'));db[_0x7071('0x3c')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x3d'));db[_0x7071('0x3e')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x3f'));db['MailQueue']=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x40'));db[_0x7071('0x41')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x42'));db[_0x7071('0x43')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x44'));db['MailMessage']=db['sequelize'][_0x7071('0x11')](_0x7071('0x45'));db['MailApplication']=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x46'));db[_0x7071('0x47')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x48'));db[_0x7071('0x49')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x4a'));db[_0x7071('0x4b')]=db['sequelize'][_0x7071('0x11')]('../api/dashboardItem/dashboardItem.model');db[_0x7071('0x4c')]=db['sequelize']['import']('../api/faxAccount/faxAccount.model');db[_0x7071('0x4d')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x4e'));db[_0x7071('0x4f')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x50'));db[_0x7071('0x51')]=db[_0x7071('0x0')]['import'](_0x7071('0x52'));db[_0x7071('0x53')]=db[_0x7071('0x0')][_0x7071('0x11')]('../api/faxQueue/faxQueue.model');db[_0x7071('0x54')]=db[_0x7071('0x0')]['import'](_0x7071('0x55'));db['SmsAccount']=db['sequelize'][_0x7071('0x11')]('../api/smsAccount/smsAccount.model');db[_0x7071('0x56')]=db[_0x7071('0x0')]['import'](_0x7071('0x57'));db[_0x7071('0x58')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x59'));db[_0x7071('0x5a')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x5b'));db['SmsQueue']=db[_0x7071('0x0')]['import']('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0x7071('0x0')][_0x7071('0x11')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db[_0x7071('0x0')][_0x7071('0x11')]('../api/openchannelApplication/openchannelApplication.model');db[_0x7071('0x5c')]=db['sequelize'][_0x7071('0x11')](_0x7071('0x5d'));db['OpenchannelMessage']=db['sequelize'][_0x7071('0x11')]('../api/openchannelMessage/openchannelMessage.model');db[_0x7071('0x5e')]=db['sequelize'][_0x7071('0x11')](_0x7071('0x5f'));db[_0x7071('0x60')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x61'));db[_0x7071('0x62')]=db[_0x7071('0x0')]['import'](_0x7071('0x63'));db[_0x7071('0x64')]=db[_0x7071('0x0')]['import'](_0x7071('0x65'));db[_0x7071('0x66')]=db[_0x7071('0x0')]['import'](_0x7071('0x67'));db[_0x7071('0x68')]=db[_0x7071('0x0')][_0x7071('0x11')]('../api/chatMessage/chatMessage.model');db[_0x7071('0x69')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x6a'));db[_0x7071('0x6b')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x6c'));db[_0x7071('0x6d')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x6e'));db[_0x7071('0x6f')]=db[_0x7071('0x0')][_0x7071('0x11')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x7071('0x70')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x71'));db[_0x7071('0x72')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x73'));db[_0x7071('0x74')]=db['sequelize'][_0x7071('0x11')]('../api/cmHopper/cmHopper.model');db[_0x7071('0x75')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x76'));db[_0x7071('0x77')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x78'));db['CmHopperHistory']=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x79'));db[_0x7071('0x7a')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x7b'));db[_0x7071('0x7c')]=db[_0x7071('0x0')]['import'](_0x7071('0x7d'));db['Action']=db[_0x7071('0x0')]['import'](_0x7071('0x7e'));db['Automation']=db[_0x7071('0x0')]['import'](_0x7071('0x7f'));db['CannedAnswer']=db[_0x7071('0x0')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x7071('0x80')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x81'));db[_0x7071('0x82')]=db[_0x7071('0x0')]['import']('../api/condition/condition.model');db[_0x7071('0x83')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x84'));db['Pause']=db[_0x7071('0x0')]['import'](_0x7071('0x85'));db['Cdr']=db[_0x7071('0x0')]['import'](_0x7071('0x86'));db['VoiceQueuesLog']=db[_0x7071('0x0')]['import'](_0x7071('0x87'));db[_0x7071('0x88')]=db[_0x7071('0x0')][_0x7071('0x11')]('../api/schedule/schedule.model');db[_0x7071('0x89')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x8a'));db['Tag']=db['sequelize'][_0x7071('0x11')]('../api/tag/tag.model');db['Template']=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x8b'));db['Trigger']=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x8c'));db[_0x7071('0x8d')]=db['sequelize'][_0x7071('0x11')](_0x7071('0x8e'));db[_0x7071('0x8f')]=db[_0x7071('0x0')][_0x7071('0x11')]('../api/integration/integration.model');db[_0x7071('0x90')]=db[_0x7071('0x0')]['import'](_0x7071('0x91'));db['AnalyticCustomReport']=db['sequelize'][_0x7071('0x11')]('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x92'));db[_0x7071('0x93')]=db[_0x7071('0x0')]['import'](_0x7071('0x94'));db[_0x7071('0x95')]=db[_0x7071('0x0')]['import'](_0x7071('0x96'));db['AnalyticFieldReport']=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x97'));db[_0x7071('0x98')]=db[_0x7071('0x0')][_0x7071('0x11')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x7071('0x99')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x9a'));db[_0x7071('0x9b')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x9c'));db['SalesforceField']=db[_0x7071('0x0')]['import'](_0x7071('0x9d'));db['SugarcrmAccount']=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0x9e'));db[_0x7071('0x9f')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xa0'));db[_0x7071('0xa1')]=db['sequelize']['import']('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db[_0x7071('0x0')]['import'](_0x7071('0xa2'));db['DeskConfiguration']=db[_0x7071('0x0')][_0x7071('0x11')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x7071('0xa3')]=db['sequelize'][_0x7071('0x11')](_0x7071('0xa4'));db[_0x7071('0xa5')]=db[_0x7071('0x0')]['import']('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0x7071('0x0')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x7071('0xa6')]=db[_0x7071('0x0')][_0x7071('0x11')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db['sequelize'][_0x7071('0x11')](_0x7071('0xa7'));db['ZendeskConfiguration']=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xa8'));db[_0x7071('0xa9')]=db[_0x7071('0x0')]['import'](_0x7071('0xaa'));db[_0x7071('0xab')]=db['sequelize']['import'](_0x7071('0xac'));db[_0x7071('0xad')]=db[_0x7071('0x0')][_0x7071('0x11')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x7071('0xae')]=db[_0x7071('0x0')]['import'](_0x7071('0xaf'));db[_0x7071('0xb0')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xb1'));db[_0x7071('0xb2')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xb3'));db['VtigerField']=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xb4'));db[_0x7071('0xb5')]=db[_0x7071('0x0')]['import'](_0x7071('0xb6'));db[_0x7071('0xb7')]=db['sequelize']['import'](_0x7071('0xb8'));db[_0x7071('0xb9')]=db[_0x7071('0x0')][_0x7071('0x11')]('../api/intServicenowField/intServicenowField.model');db[_0x7071('0xba')]=db[_0x7071('0x0')][_0x7071('0x11')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x7071('0xbb')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xbc'));db[_0x7071('0xbd')]=db[_0x7071('0x0')][_0x7071('0x11')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x7071('0xbe')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xbf'));db['FreshsalesConfiguration']=db['sequelize'][_0x7071('0x11')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xc0'));db[_0x7071('0x8f')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xc1'));db[_0x7071('0xc2')]=db[_0x7071('0x0')]['import'](_0x7071('0xc3'));db['ChatQueueReport']=db[_0x7071('0x0')]['import'](_0x7071('0xc4'));db['ChatInternalMessage']=db[_0x7071('0x0')][_0x7071('0x11')]('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0x7071('0x0')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x7071('0xc5')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xc6'));db['JscriptySessionReport']=db['sequelize'][_0x7071('0x11')](_0x7071('0xc7'));db[_0x7071('0xc8')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xc9'));db[_0x7071('0xca')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xcb'));db[_0x7071('0xcc')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xcd'));db['JscriptyProject']=db[_0x7071('0x0')][_0x7071('0x11')]('../api/jscriptyProject/jscriptyProject.model');db[_0x7071('0xce')]=db['sequelize'][_0x7071('0x11')](_0x7071('0xcf'));db['SquareOdbc']=db[_0x7071('0x0')]['import'](_0x7071('0xd0'));db[_0x7071('0xd1')]=db[_0x7071('0x0')]['import'](_0x7071('0xd2'));db['SquareRecording']=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xd3'));db[_0x7071('0xd4')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xd5'));db['Team']=db['sequelize'][_0x7071('0x11')](_0x7071('0xd6'));db[_0x7071('0xd7')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xd8'));db[_0x7071('0xd9')]=db['sequelize'][_0x7071('0x11')](_0x7071('0xda'));db[_0x7071('0xdb')]=db[_0x7071('0x0')]['import'](_0x7071('0xdc'));db[_0x7071('0xdd')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xde'));db[_0x7071('0xdf')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xe0'));db[_0x7071('0xe1')]=db[_0x7071('0x0')][_0x7071('0x11')]('../api/mailTransferReport/mailTransferReport.model');db[_0x7071('0xe2')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xe3'));db[_0x7071('0xe4')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xe5'));db[_0x7071('0xe6')]=db['sequelize'][_0x7071('0x11')](_0x7071('0xe7'));db[_0x7071('0xe8')]=db['sequelize'][_0x7071('0x11')]('../api/smsTransferReport/smsTransferReport.model');db[_0x7071('0xe9')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xea'));db[_0x7071('0xeb')]=db['sequelize'][_0x7071('0x11')]('../api/voicePrefix/voicePrefix.model');db[_0x7071('0xec')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xed'));db[_0x7071('0xee')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xef'));db['UserProfileResource']=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xf0'));db[_0x7071('0xf1')]=db[_0x7071('0x0')][_0x7071('0x11')]('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xf2'));db[_0x7071('0xf3')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xf4'));db[_0x7071('0xf5')]=db[_0x7071('0x0')][_0x7071('0x11')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x7071('0xf6')]=db['sequelize']['import'](_0x7071('0xf7'));db[_0x7071('0xf8')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xf9'));db[_0x7071('0xfa')]=db[_0x7071('0x0')][_0x7071('0x11')](_0x7071('0xfb'));db['WhatsappQueue']=db[_0x7071('0x0')]['import'](_0x7071('0xfc'));db[_0x7071('0xfd')]=db[_0x7071('0x0')][_0x7071('0x11')]('../api/cloudProvider/cloudProvider.model');db[_0x7071('0xfe')]=db[_0x7071('0x0')][_0x7071('0x11')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x7071('0xff')]=db[_0x7071('0x0')]['import'](_0x7071('0x100'));db[_0x7071('0x101')]=db['sequelize']['import']('../api/userVoicePrefix/userVoicePrefix.model');db['User']['hasOne'](db[_0x7071('0x20')],{'as':'VoiceMail','onDelete':_0x7071('0x102'),'foreignKey':'UserId'});db[_0x7071('0x10')][_0x7071('0x103')](db[_0x7071('0x1c')],{'as':'Recordings','foreignKey':_0x7071('0x104')});db[_0x7071('0x10')]['hasMany'](db[_0x7071('0x2e')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db['User']['hasMany'](db['VoiceExtension'],{'as':_0x7071('0x105'),'onDelete':'cascade','hooks':!![]});db['User'][_0x7071('0x103')](db[_0x7071('0x77')],{'as':_0x7071('0x106'),'foreignKey':_0x7071('0x104')});db['User'][_0x7071('0x103')](db[_0x7071('0x107')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0x7071('0x10')][_0x7071('0x103')](db[_0x7071('0x7a')],{'as':_0x7071('0x7a'),'foreignKey':'UserId'});db[_0x7071('0x10')][_0x7071('0x103')](db['OpenchannelInteraction'],{'as':_0x7071('0x108'),'foreignKey':'UserId'});db[_0x7071('0x10')]['hasMany'](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x7071('0x104')});db[_0x7071('0x10')][_0x7071('0x103')](db['SmsInteraction'],{'as':_0x7071('0x109'),'foreignKey':_0x7071('0x104')});db[_0x7071('0x10')][_0x7071('0x103')](db[_0x7071('0x4f')],{'as':_0x7071('0x10a'),'foreignKey':'UserId'});db[_0x7071('0x10')][_0x7071('0x103')](db['MailInteraction'],{'as':_0x7071('0x10b'),'foreignKey':_0x7071('0x104')});db[_0x7071('0x10')][_0x7071('0x103')](db[_0x7071('0xf5')],{'as':_0x7071('0x10c'),'foreignKey':_0x7071('0x104')});db['User'][_0x7071('0x103')](db['UserNotification'],{'as':_0x7071('0x10d'),'foreignKey':_0x7071('0x10e')});db[_0x7071('0x10')][_0x7071('0x10f')](db['UserProfile'],{'as':_0x7071('0xec'),'foreignKey':_0x7071('0x110')});db[_0x7071('0x10')][_0x7071('0x111')](db[_0x7071('0x6d')],{'as':_0x7071('0x112'),'through':_0x7071('0x113')});db[_0x7071('0x10')][_0x7071('0x111')](db[_0x7071('0x72')],{'as':'Contacts','through':_0x7071('0x114')});db['User'][_0x7071('0x111')](db[_0x7071('0xe9')],{'as':_0x7071('0x115'),'through':_0x7071('0x116')});db[_0x7071('0x10')]['belongsToMany'](db['Team'],{'through':_0x7071('0x117')});db[_0x7071('0x10')][_0x7071('0x111')](db['MailInteraction'],{'as':_0x7071('0x10b'),'through':'user_has_mail_interactions'});db[_0x7071('0x10')][_0x7071('0x111')](db[_0x7071('0x66')],{'as':_0x7071('0x118'),'through':_0x7071('0x119')});db[_0x7071('0x10')][_0x7071('0x111')](db['FaxInteraction'],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db['User'][_0x7071('0x111')](db[_0x7071('0x58')],{'as':_0x7071('0x109'),'through':_0x7071('0x11a')});db[_0x7071('0x10')][_0x7071('0x111')](db[_0x7071('0x5c')],{'as':_0x7071('0x108'),'through':_0x7071('0x11b')});db[_0x7071('0x10')][_0x7071('0x111')](db[_0x7071('0xf5')],{'as':_0x7071('0x10c'),'through':_0x7071('0x11c')});db['User'][_0x7071('0x111')](db['VoiceQueue'],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db['User'][_0x7071('0x111')](db[_0x7071('0xeb')],{'as':'VoicePrefixes','through':_0x7071('0x101'),'required':![]});db[_0x7071('0x10')][_0x7071('0x111')](db[_0x7071('0x11d')],{'as':_0x7071('0x11e'),'through':_0x7071('0x11f'),'required':![]});db[_0x7071('0x10')]['belongsToMany'](db[_0x7071('0x6b')],{'as':'ChatQueues','through':_0x7071('0x32'),'required':![],'hooks':!![]});db[_0x7071('0x10')][_0x7071('0x111')](db['FaxQueue'],{'as':_0x7071('0x120'),'through':'UserFaxQueue','required':![]});db[_0x7071('0x10')][_0x7071('0x111')](db[_0x7071('0x121')],{'as':_0x7071('0x122'),'through':_0x7071('0x123'),'required':![]});db[_0x7071('0x10')][_0x7071('0x111')](db['OpenchannelQueue'],{'as':_0x7071('0x124'),'through':_0x7071('0x36'),'required':![]});db[_0x7071('0x10')][_0x7071('0x111')](db['WhatsappQueue'],{'as':_0x7071('0x125'),'through':_0x7071('0x38'),'required':![]});db[_0x7071('0x10')][_0x7071('0x111')](db[_0x7071('0xe9')],{'through':_0x7071('0x116')});db[_0x7071('0x10')][_0x7071('0x111')](db[_0x7071('0xeb')],{'as':_0x7071('0x126'),'through':_0x7071('0x127'),'required':![]});db['User'][_0x7071('0x111')](db[_0x7071('0x60')],{'as':_0x7071('0x128'),'through':_0x7071('0x129')});db[_0x7071('0x10')]['belongsToMany'](db[_0x7071('0x4c')],{'as':'FaxAccounts','through':_0x7071('0x12a')});db[_0x7071('0x10')]['belongsToMany'](db['MailAccount'],{'as':_0x7071('0x12b'),'through':_0x7071('0x12c')});db[_0x7071('0x10')]['belongsToMany'](db[_0x7071('0x12d')],{'as':_0x7071('0x12e'),'through':_0x7071('0x12f')});db[_0x7071('0x10')]['belongsToMany'](db[_0x7071('0x130')],{'as':_0x7071('0x131'),'through':'user_has_sms_accounts'});db[_0x7071('0x10')]['belongsToMany'](db[_0x7071('0x132')],{'as':_0x7071('0x133'),'through':_0x7071('0x134')});db[_0x7071('0x10')]['belongsToMany'](db[_0x7071('0xd1')],{'as':'SquareProjects','through':_0x7071('0x135')});db[_0x7071('0x13')]['hasMany'](db[_0x7071('0x17')],{'as':_0x7071('0x136'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db['VoiceContext']['hasMany'](db[_0x7071('0x17')],{'onDelete':'cascade'});db[_0x7071('0x17')][_0x7071('0x103')](db[_0x7071('0x17')],{'as':_0x7071('0x137'),'onDelete':_0x7071('0x102')});db['VoiceMusicOnHold']['belongsToMany'](db[_0x7071('0x89')],{'as':_0x7071('0x138'),'through':_0x7071('0x139')});db[_0x7071('0x13a')][_0x7071('0x103')](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0x7071('0x13b')});db[_0x7071('0x13a')]['hasMany'](db[_0x7071('0x74')],{'as':'Hoppers','foreignKey':_0x7071('0x13b')});db[_0x7071('0x13a')][_0x7071('0x103')](db['CmHopperFinal'],{'as':_0x7071('0x106'),'foreignKey':_0x7071('0x13b')});db[_0x7071('0x13a')][_0x7071('0x103')](db['CmHopperHistory'],{'as':_0x7071('0x13c'),'foreignKey':'VoiceQueueId'});db[_0x7071('0x13a')]['hasMany'](db[_0x7071('0x7a')],{'as':'ReportAgentPreview','foreignKey':_0x7071('0x13b')});db[_0x7071('0x13a')]['hasMany'](db[_0x7071('0x75')],{'as':_0x7071('0x13d'),'foreignKey':_0x7071('0x13b')});db[_0x7071('0x13a')][_0x7071('0x103')](db[_0x7071('0x13e')],{'as':_0x7071('0x13f'),'foreignKey':_0x7071('0x13b')});db[_0x7071('0x13a')]['belongsTo'](db['Trunk'],{'as':_0x7071('0x140'),'foreignKey':'TrunkId'});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':_0x7071('0x141'),'foreignKey':_0x7071('0x142')});db[_0x7071('0x13a')][_0x7071('0x10f')](db[_0x7071('0x83')],{'as':_0x7071('0x83'),'foreignKey':_0x7071('0x143')});db[_0x7071('0x13a')][_0x7071('0x10f')](db['Pause'],{'as':_0x7071('0x144'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0x7071('0x111')](db[_0x7071('0xe9')],{'as':_0x7071('0x115'),'through':_0x7071('0x145')});db[_0x7071('0x13a')][_0x7071('0x111')](db[_0x7071('0x10')],{'as':_0x7071('0x146'),'through':_0x7071('0x30')});db[_0x7071('0x13a')][_0x7071('0x111')](db[_0x7071('0x147')],{'as':_0x7071('0x148'),'through':_0x7071('0xfe')});db['VoiceQueue'][_0x7071('0x111')](db[_0x7071('0xe9')],{'as':_0x7071('0x149'),'through':_0x7071('0x14a')});db['VoiceRecording']['belongsTo'](db[_0x7071('0x10')],{'as':_0x7071('0x10'),'foreignKey':_0x7071('0x104')});db[_0x7071('0x1e')]['belongsTo'](db['User'],{'as':'User','foreignKey':'UserId'});db[_0x7071('0x20')][_0x7071('0x103')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x14b'),'sourceKey':_0x7071('0x14c')});db[_0x7071('0x22')][_0x7071('0x10f')](db[_0x7071('0x20')],{'foreignKey':'mailboxuser','targetKey':_0x7071('0x14c')});db['VoiceCallReport']['hasMany'](db[_0x7071('0x14d')],{'as':_0x7071('0x14e'),'foreignKey':_0x7071('0x14f'),'constraints':![]});db[_0x7071('0x24')]['hasMany'](db['VoiceAgentReport'],{'as':_0x7071('0x150'),'foreignKey':_0x7071('0x14f'),'constraints':![]});db[_0x7071('0x24')][_0x7071('0x10f')](db[_0x7071('0x10')],{'as':'User','foreignKey':_0x7071('0x104')});db[_0x7071('0x24')][_0x7071('0x10f')](db[_0x7071('0x72')],{'as':'Contact','foreignKey':_0x7071('0x151')});db['MailServerIn']['belongsTo'](db[_0x7071('0x3e')],{'as':_0x7071('0x3e'),'foreignKey':_0x7071('0x152')});db[_0x7071('0x3c')][_0x7071('0x10f')](db[_0x7071('0x3e')],{'as':_0x7071('0x3e'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x7071('0x153')](db[_0x7071('0x3a')],{'as':'Imap','onDelete':_0x7071('0x102')});db[_0x7071('0x3e')][_0x7071('0x153')](db[_0x7071('0x3c')],{'as':_0x7071('0x154'),'onDelete':_0x7071('0x102')});db[_0x7071('0x3e')][_0x7071('0x103')](db[_0x7071('0x80')],{'as':_0x7071('0x155'),'foreignKey':'MailAccountId','onDelete':_0x7071('0x102')});db[_0x7071('0x3e')]['hasMany'](db['CannedAnswer'],{'as':_0x7071('0x156'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x7071('0x103')](db[_0x7071('0x157')],{'as':_0x7071('0x158'),'foreignKey':_0x7071('0x152')});db[_0x7071('0x3e')][_0x7071('0x103')](db['MailInteraction'],{'as':_0x7071('0x159')});db['MailAccount'][_0x7071('0x103')](db['MailApplication'],{'as':'Applications'});db[_0x7071('0x3e')][_0x7071('0x10f')](db['CmList'],{'as':_0x7071('0x15a'),'foreignKey':'ListId'});db[_0x7071('0x3e')][_0x7071('0x10f')](db['Template'],{'as':_0x7071('0x15b'),'foreignKey':_0x7071('0x15c')});db['MailAccount'][_0x7071('0x10f')](db[_0x7071('0x15d')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['MailAccount']['belongsToMany'](db[_0x7071('0x10')],{'as':'Agents','through':_0x7071('0x12c')});db[_0x7071('0x11d')][_0x7071('0x111')](db['User'],{'as':'Agents','through':_0x7071('0x11f')});db[_0x7071('0x11d')][_0x7071('0x111')](db[_0x7071('0x147')],{'through':_0x7071('0x15e'),'as':_0x7071('0x148')});db[_0x7071('0x43')][_0x7071('0x103')](db[_0x7071('0x157')],{'as':_0x7071('0x158'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db['MailInteraction']['belongsTo'](db[_0x7071('0x3e')],{'as':_0x7071('0x15f'),'foreignKey':_0x7071('0x152')});db[_0x7071('0x43')]['belongsTo'](db[_0x7071('0x72')],{'as':_0x7071('0x160'),'foreignKey':_0x7071('0x151')});db[_0x7071('0x43')][_0x7071('0x10f')](db[_0x7071('0x10')],{'as':_0x7071('0x161'),'foreignKey':_0x7071('0x104')});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':_0x7071('0x162'),'as':_0x7071('0x163')});db[_0x7071('0x43')]['belongsToMany'](db[_0x7071('0x164')],{'through':_0x7071('0x162'),'as':'ThroughTags'});db[_0x7071('0x43')][_0x7071('0x111')](db[_0x7071('0x10')],{'as':'Users','through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x7071('0x157')]['hasMany'](db['Attachment'],{'as':_0x7071('0x165'),'onDelete':_0x7071('0x102')});db[_0x7071('0x157')][_0x7071('0x10f')](db[_0x7071('0x10')],{'as':_0x7071('0x10')});db[_0x7071('0x157')][_0x7071('0x10f')](db[_0x7071('0x72')],{'onDelete':_0x7071('0x102'),'as':_0x7071('0x160')});db['MailMessage'][_0x7071('0x10f')](db['MailInteraction'],{'as':_0x7071('0x166'),'foreignKey':'MailInteractionId'});db[_0x7071('0x157')]['belongsTo'](db[_0x7071('0x3e')],{'as':_0x7071('0x15f'),'foreignKey':_0x7071('0x152')});db[_0x7071('0x157')][_0x7071('0x10f')](db[_0x7071('0x60')],{'as':_0x7071('0x60'),'foreignKey':_0x7071('0x167')});db[_0x7071('0x157')][_0x7071('0x10f')](db[_0x7071('0x69')],{'as':_0x7071('0x69'),'foreignKey':_0x7071('0x168')});db[_0x7071('0x169')][_0x7071('0x10f')](db[_0x7071('0x10')],{'onDelete':_0x7071('0x16a')});db[_0x7071('0x169')][_0x7071('0x10f')](db[_0x7071('0x11d')],{'onDelete':'restrict'});db[_0x7071('0x169')][_0x7071('0x10f')](db[_0x7071('0x3e')],{'onDelete':'restrict'});db[_0x7071('0x169')][_0x7071('0x10f')](db[_0x7071('0x83')],{'onDelete':_0x7071('0x16a'),'foreignKey':'IntervalId'});db[_0x7071('0x169')]['belongsTo'](db[_0x7071('0x164')],{'onDelete':'restrict','foreignKey':_0x7071('0x16b')});db[_0x7071('0x47')][_0x7071('0x10f')](db['MailAccount'],{});db[_0x7071('0x47')][_0x7071('0x10f')](db[_0x7071('0xe9')],{'as':_0x7071('0x15a'),'foreignKey':'ListId'});db[_0x7071('0x47')][_0x7071('0x10f')](db[_0x7071('0x72')],{'as':_0x7071('0x160'),'foreignKey':_0x7071('0x151')});db[_0x7071('0x47')][_0x7071('0x10f')](db[_0x7071('0x43')],{});db[_0x7071('0x47')][_0x7071('0x10f')](db[_0x7071('0x157')],{});db[_0x7071('0x47')][_0x7071('0x10f')](db[_0x7071('0x10')],{});db[_0x7071('0x47')][_0x7071('0x10f')](db[_0x7071('0x11d')],{});db[_0x7071('0x49')][_0x7071('0x103')](db[_0x7071('0x4b')],{'as':'Items','onDelete':_0x7071('0x102')});db[_0x7071('0x4c')][_0x7071('0x103')](db[_0x7071('0x80')],{'as':_0x7071('0x155'),'foreignKey':_0x7071('0x16c'),'onDelete':'cascade'});db[_0x7071('0x4c')]['hasMany'](db[_0x7071('0x16d')],{'as':_0x7071('0x156'),'foreignKey':_0x7071('0x16c')});db[_0x7071('0x4c')][_0x7071('0x103')](db[_0x7071('0x4f')],{'as':_0x7071('0x159')});db['FaxAccount'][_0x7071('0x103')](db[_0x7071('0x4d')],{'as':_0x7071('0x137')});db['FaxAccount']['hasMany'](db['VoiceExtension'],{'as':_0x7071('0x16e'),'onDelete':_0x7071('0x102')});db[_0x7071('0x4c')][_0x7071('0x103')](db[_0x7071('0x51')],{'as':_0x7071('0x158')});db[_0x7071('0x4c')][_0x7071('0x10f')](db[_0x7071('0x140')],{'as':_0x7071('0x140')});db['FaxAccount'][_0x7071('0x10f')](db[_0x7071('0xe9')],{'as':_0x7071('0x15a'),'foreignKey':_0x7071('0x16f')});db[_0x7071('0x4c')]['belongsTo'](db[_0x7071('0x15d')],{'as':_0x7071('0x144'),'foreignKey':_0x7071('0x170')});db['FaxAccount'][_0x7071('0x111')](db[_0x7071('0x10')],{'as':_0x7071('0x146'),'through':_0x7071('0x12a')});db['FaxApplication']['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0x7071('0x4d')][_0x7071('0x10f')](db['FaxQueue'],{'onDelete':'restrict'});db['FaxApplication'][_0x7071('0x10f')](db[_0x7071('0x4c')],{'onDelete':_0x7071('0x16a')});db[_0x7071('0x4d')]['belongsTo'](db[_0x7071('0x164')],{'onDelete':_0x7071('0x16a'),'foreignKey':'TagId'});db[_0x7071('0x4f')][_0x7071('0x103')](db['FaxMessage'],{'as':_0x7071('0x158'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x171')});db['FaxInteraction'][_0x7071('0x10f')](db[_0x7071('0x4c')],{'as':_0x7071('0x15f'),'foreignKey':_0x7071('0x16c')});db[_0x7071('0x4f')][_0x7071('0x10f')](db[_0x7071('0x72')],{'as':_0x7071('0x160'),'foreignKey':_0x7071('0x151')});db[_0x7071('0x4f')][_0x7071('0x10f')](db[_0x7071('0x10')],{'as':_0x7071('0x161'),'foreignKey':_0x7071('0x104')});db[_0x7071('0x4f')][_0x7071('0x111')](db[_0x7071('0x164')],{'through':_0x7071('0x172'),'as':_0x7071('0x163')});db['FaxInteraction'][_0x7071('0x111')](db[_0x7071('0x164')],{'through':_0x7071('0x172'),'as':'ThroughTags'});db[_0x7071('0x4f')][_0x7071('0x111')](db[_0x7071('0x10')],{'as':_0x7071('0x173'),'through':_0x7071('0x174'),'foreignKey':_0x7071('0x171')});db[_0x7071('0x51')][_0x7071('0x10f')](db['User'],{'onDelete':_0x7071('0x102'),'as':_0x7071('0x10')});db['FaxMessage'][_0x7071('0x10f')](db['FaxInteraction'],{'as':_0x7071('0x166'),'foreignKey':_0x7071('0x171')});db[_0x7071('0x51')]['belongsTo'](db[_0x7071('0x72')],{'onDelete':_0x7071('0x102'),'as':_0x7071('0x160')});db['FaxMessage'][_0x7071('0x10f')](db[_0x7071('0xdd')],{'as':'Attachment','foreignKey':_0x7071('0x175')});db[_0x7071('0x51')][_0x7071('0x10f')](db[_0x7071('0x4c')],{'as':_0x7071('0x15f'),'foreignKey':_0x7071('0x16c')});db[_0x7071('0x53')]['belongsToMany'](db[_0x7071('0x10')],{'as':_0x7071('0x146'),'through':_0x7071('0x176')});db[_0x7071('0x53')][_0x7071('0x111')](db[_0x7071('0x147')],{'through':_0x7071('0x177'),'as':_0x7071('0x148')});db[_0x7071('0x54')]['belongsTo'](db[_0x7071('0x4c')],{});db[_0x7071('0x54')][_0x7071('0x10f')](db[_0x7071('0xe9')],{'as':_0x7071('0x15a'),'foreignKey':'ListId'});db[_0x7071('0x54')]['belongsTo'](db[_0x7071('0x72')],{'as':'Contact','foreignKey':_0x7071('0x151')});db[_0x7071('0x54')][_0x7071('0x10f')](db[_0x7071('0x4f')],{});db['FaxQueueReport']['belongsTo'](db[_0x7071('0x51')],{});db[_0x7071('0x54')][_0x7071('0x10f')](db[_0x7071('0x10')],{});db['FaxQueueReport'][_0x7071('0x10f')](db[_0x7071('0x53')],{});db[_0x7071('0x130')][_0x7071('0x103')](db['Disposition'],{'as':_0x7071('0x155'),'foreignKey':_0x7071('0x178'),'onDelete':_0x7071('0x102')});db[_0x7071('0x130')][_0x7071('0x103')](db[_0x7071('0x16d')],{'as':_0x7071('0x156'),'foreignKey':_0x7071('0x178')});db['SmsAccount'][_0x7071('0x103')](db['SmsMessage'],{'as':_0x7071('0x158'),'foreignKey':_0x7071('0x178')});db[_0x7071('0x130')]['hasMany'](db['SmsInteraction'],{'as':_0x7071('0x159')});db['SmsAccount']['hasMany'](db[_0x7071('0x56')],{'as':_0x7071('0x137')});db[_0x7071('0x130')][_0x7071('0x10f')](db[_0x7071('0xe9')],{'as':_0x7071('0x15a'),'foreignKey':'ListId'});db[_0x7071('0x130')][_0x7071('0x10f')](db['Pause'],{'as':_0x7071('0x144'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7071('0x130')][_0x7071('0x111')](db[_0x7071('0x10')],{'as':'Agents','through':_0x7071('0x179')});db[_0x7071('0x56')]['belongsTo'](db[_0x7071('0x10')],{'onDelete':_0x7071('0x16a')});db[_0x7071('0x56')][_0x7071('0x10f')](db[_0x7071('0x121')],{'onDelete':'restrict'});db[_0x7071('0x56')][_0x7071('0x10f')](db[_0x7071('0x130')],{'onDelete':_0x7071('0x16a')});db[_0x7071('0x56')][_0x7071('0x10f')](db[_0x7071('0x83')],{'onDelete':_0x7071('0x16a'),'foreignKey':_0x7071('0x143')});db['SmsApplication'][_0x7071('0x10f')](db[_0x7071('0x164')],{'onDelete':_0x7071('0x16a'),'foreignKey':'TagId'});db['SmsInteraction'][_0x7071('0x103')](db['SmsMessage'],{'as':_0x7071('0x158'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x7071('0x58')][_0x7071('0x10f')](db[_0x7071('0x130')],{'as':_0x7071('0x15f'),'foreignKey':_0x7071('0x178')});db[_0x7071('0x58')][_0x7071('0x10f')](db[_0x7071('0x72')],{'as':'Contact','foreignKey':'ContactId'});db[_0x7071('0x58')][_0x7071('0x10f')](db[_0x7071('0x10')],{'as':_0x7071('0x161'),'foreignKey':'UserId'});db[_0x7071('0x58')][_0x7071('0x111')](db[_0x7071('0x164')],{'through':_0x7071('0x17a'),'as':'Tags'});db[_0x7071('0x58')]['belongsToMany'](db[_0x7071('0x164')],{'through':_0x7071('0x17a'),'as':'ThroughTags'});db[_0x7071('0x58')][_0x7071('0x111')](db['User'],{'as':'Users','through':_0x7071('0x11a'),'foreignKey':_0x7071('0x17b')});db[_0x7071('0x5a')][_0x7071('0x10f')](db[_0x7071('0x10')],{'as':'User'});db[_0x7071('0x5a')][_0x7071('0x10f')](db[_0x7071('0x72')],{'onDelete':_0x7071('0x102'),'as':'Contact'});db[_0x7071('0x5a')][_0x7071('0x10f')](db[_0x7071('0x58')],{'onDelete':'cascade','as':_0x7071('0x166'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x7071('0x10f')](db[_0x7071('0x130')],{'as':_0x7071('0x15f'),'foreignKey':'SmsAccountId'});db[_0x7071('0x121')]['belongsToMany'](db[_0x7071('0x10')],{'as':_0x7071('0x146'),'through':'UserSmsQueue','foreignKey':_0x7071('0x17c')});db[_0x7071('0x121')][_0x7071('0x111')](db[_0x7071('0x147')],{'through':_0x7071('0x17d'),'as':_0x7071('0x148')});db['OpenchannelAccount']['hasMany'](db[_0x7071('0x80')],{'as':_0x7071('0x155'),'foreignKey':_0x7071('0x17e'),'onDelete':'cascade'});db['OpenchannelAccount'][_0x7071('0x103')](db[_0x7071('0x16d')],{'as':'Answers','foreignKey':_0x7071('0x17e')});db[_0x7071('0x12d')]['hasMany'](db[_0x7071('0x5c')],{'as':_0x7071('0x159'),'foreignKey':_0x7071('0x17e')});db[_0x7071('0x12d')]['hasMany'](db[_0x7071('0x17f')],{'as':_0x7071('0x158'),'foreignKey':'OpenchannelAccountId'});db[_0x7071('0x12d')][_0x7071('0x103')](db[_0x7071('0x180')],{'as':_0x7071('0x137'),'foreignKey':_0x7071('0x17e')});db[_0x7071('0x12d')][_0x7071('0x10f')](db[_0x7071('0xe9')],{'as':_0x7071('0x15a'),'foreignKey':_0x7071('0x16f')});db[_0x7071('0x12d')][_0x7071('0x10f')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x7071('0x170')});db['OpenchannelAccount'][_0x7071('0x111')](db[_0x7071('0x10')],{'as':_0x7071('0x146'),'through':_0x7071('0x12f')});db[_0x7071('0x180')][_0x7071('0x10f')](db[_0x7071('0x10')],{'onDelete':_0x7071('0x16a')});db[_0x7071('0x180')][_0x7071('0x10f')](db[_0x7071('0x5e')],{'onDelete':'restrict','foreignKey':_0x7071('0x181')});db['OpenchannelApplication'][_0x7071('0x10f')](db[_0x7071('0x12d')],{'onDelete':_0x7071('0x16a'),'foreignKey':_0x7071('0x17e')});db['OpenchannelApplication'][_0x7071('0x10f')](db['Interval'],{'onDelete':_0x7071('0x16a'),'foreignKey':_0x7071('0x143')});db['OpenchannelApplication'][_0x7071('0x10f')](db['Tag'],{'onDelete':_0x7071('0x16a'),'foreignKey':_0x7071('0x16b')});db['OpenchannelInteraction'][_0x7071('0x103')](db[_0x7071('0x17f')],{'as':_0x7071('0x158'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x182')});db[_0x7071('0x5c')][_0x7071('0x10f')](db['OpenchannelAccount'],{'as':_0x7071('0x15f'),'foreignKey':_0x7071('0x17e')});db[_0x7071('0x5c')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x7071('0x5c')]['belongsTo'](db[_0x7071('0x10')],{'as':_0x7071('0x161'),'foreignKey':_0x7071('0x104')});db[_0x7071('0x5c')][_0x7071('0x111')](db[_0x7071('0x164')],{'through':_0x7071('0x183'),'as':_0x7071('0x163')});db[_0x7071('0x5c')][_0x7071('0x111')](db[_0x7071('0x164')],{'through':_0x7071('0x183'),'as':_0x7071('0x184')});db[_0x7071('0x5c')]['belongsToMany'](db['User'],{'as':_0x7071('0x173'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x7071('0x17f')][_0x7071('0x10f')](db[_0x7071('0x10')],{'onDelete':_0x7071('0x102'),'as':_0x7071('0x10')});db[_0x7071('0x17f')][_0x7071('0x10f')](db[_0x7071('0x72')],{'onDelete':_0x7071('0x102'),'as':'Contact'});db[_0x7071('0x17f')][_0x7071('0x10f')](db['OpenchannelInteraction'],{'onDelete':_0x7071('0x102'),'as':_0x7071('0x166'),'foreignKey':_0x7071('0x182')});db['OpenchannelMessage'][_0x7071('0x10f')](db['Attachment'],{'as':_0x7071('0xdd'),'foreignKey':'AttachmentId'});db[_0x7071('0x17f')][_0x7071('0x10f')](db[_0x7071('0x12d')],{'as':_0x7071('0x15f'),'foreignKey':_0x7071('0x17e')});db[_0x7071('0x5e')][_0x7071('0x111')](db[_0x7071('0x10')],{'as':_0x7071('0x146'),'through':_0x7071('0x36'),'foreignKey':_0x7071('0x181')});db[_0x7071('0x5e')][_0x7071('0x111')](db[_0x7071('0x147')],{'through':'team_has_openchannel_queues','as':_0x7071('0x148')});db[_0x7071('0x60')]['hasMany'](db['Disposition'],{'as':_0x7071('0x155'),'foreignKey':'ChatWebsiteId','onDelete':_0x7071('0x102')});db[_0x7071('0x60')][_0x7071('0x103')](db[_0x7071('0x16d')],{'as':_0x7071('0x156'),'foreignKey':'ChatWebsiteId'});db[_0x7071('0x60')][_0x7071('0x103')](db[_0x7071('0x6f')],{'as':_0x7071('0x185')});db['ChatWebsite'][_0x7071('0x103')](db['ChatInteraction'],{'as':_0x7071('0x159')});db[_0x7071('0x60')][_0x7071('0x103')](db[_0x7071('0x64')],{'as':'Applications'});db[_0x7071('0x60')]['hasMany'](db[_0x7071('0x68')],{'as':_0x7071('0x158')});db[_0x7071('0x60')][_0x7071('0x10f')](db[_0x7071('0xe9')],{'as':_0x7071('0x15a'),'foreignKey':_0x7071('0x16f')});db[_0x7071('0x60')]['belongsTo'](db[_0x7071('0x83')],{'as':'Interval','foreignKey':_0x7071('0x143')});db[_0x7071('0x60')][_0x7071('0x10f')](db['MailAccount'],{'as':_0x7071('0x3e'),'foreignKey':_0x7071('0x152')});db[_0x7071('0x60')]['belongsTo'](db['Pause'],{'as':_0x7071('0x144'),'foreignKey':_0x7071('0x170')});db['ChatWebsite'][_0x7071('0x111')](db[_0x7071('0x10')],{'as':_0x7071('0x146'),'through':_0x7071('0x129')});db[_0x7071('0x62')]['belongsTo'](db['OpenchannelAccount'],{});db[_0x7071('0x62')][_0x7071('0x10f')](db['CmList'],{'as':'List','foreignKey':_0x7071('0x16f')});db['OpenchannelQueueReport']['belongsTo'](db[_0x7071('0x72')],{'as':_0x7071('0x160'),'foreignKey':_0x7071('0x151')});db[_0x7071('0x62')][_0x7071('0x10f')](db['OpenchannelInteraction'],{});db[_0x7071('0x62')]['belongsTo'](db[_0x7071('0x17f')],{});db[_0x7071('0x62')][_0x7071('0x10f')](db['User'],{});db['OpenchannelQueueReport'][_0x7071('0x10f')](db[_0x7071('0x5e')],{});db[_0x7071('0x64')][_0x7071('0x10f')](db[_0x7071('0x10')],{'as':'Agent','foreignKey':_0x7071('0x104'),'onDelete':_0x7071('0x16a')});db[_0x7071('0x64')][_0x7071('0x10f')](db[_0x7071('0x6b')],{'as':'Queue','foreignKey':_0x7071('0x186'),'onDelete':_0x7071('0x16a')});db[_0x7071('0x64')][_0x7071('0x10f')](db[_0x7071('0x60')],{'as':_0x7071('0x187'),'foreignKey':_0x7071('0x167'),'onDelete':_0x7071('0x16a')});db[_0x7071('0x64')][_0x7071('0x10f')](db[_0x7071('0x164')],{'onDelete':_0x7071('0x16a'),'foreignKey':_0x7071('0x16b')});db[_0x7071('0x66')][_0x7071('0x103')](db['ChatMessage'],{'as':_0x7071('0x158'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x188')});db['ChatInteraction']['belongsTo'](db[_0x7071('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x7071('0x66')][_0x7071('0x10f')](db[_0x7071('0x72')],{'as':'Contact','foreignKey':_0x7071('0x151')});db[_0x7071('0x66')][_0x7071('0x10f')](db[_0x7071('0x10')],{'as':_0x7071('0x161'),'foreignKey':_0x7071('0x104')});db[_0x7071('0x66')][_0x7071('0x111')](db[_0x7071('0x164')],{'through':_0x7071('0x189'),'as':_0x7071('0x163')});db['ChatInteraction'][_0x7071('0x111')](db[_0x7071('0x164')],{'through':_0x7071('0x189'),'as':_0x7071('0x184')});db[_0x7071('0x66')][_0x7071('0x111')](db['User'],{'as':_0x7071('0x173'),'through':'user_has_chat_interactions','foreignKey':_0x7071('0x188')});db[_0x7071('0x68')][_0x7071('0x10f')](db['User'],{'onDelete':'cascade','as':_0x7071('0x10')});db['ChatMessage'][_0x7071('0x10f')](db['CmContact'],{'onDelete':_0x7071('0x102'),'as':_0x7071('0x160'),'foreignKey':_0x7071('0x151')});db[_0x7071('0x68')][_0x7071('0x10f')](db['ChatInteraction'],{'onDelete':_0x7071('0x102'),'as':_0x7071('0x166'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x7071('0x10f')](db['Attachment'],{'as':_0x7071('0xdd'),'foreignKey':_0x7071('0x175')});db['ChatMessage']['belongsTo'](db[_0x7071('0x60')],{'as':_0x7071('0x15f'),'foreignKey':_0x7071('0x167')});db['ChatOfflineMessage'][_0x7071('0x103')](db[_0x7071('0xdd')],{'as':_0x7071('0x165'),'foreignKey':_0x7071('0x168'),'onDelete':'cascade','hooks':!![]});db['ChatOfflineMessage'][_0x7071('0x10f')](db[_0x7071('0x72')],{'onDelete':'cascade','as':_0x7071('0x160'),'foreignKey':_0x7071('0x151')});db[_0x7071('0x69')][_0x7071('0x10f')](db[_0x7071('0x60')],{'as':_0x7071('0x15f'),'foreignKey':'ChatWebsiteId'});db[_0x7071('0x6b')][_0x7071('0x111')](db['User'],{'as':_0x7071('0x146'),'through':_0x7071('0x32'),'hooks':!![]});db[_0x7071('0x6b')][_0x7071('0x111')](db[_0x7071('0x147')],{'through':_0x7071('0x18a'),'as':_0x7071('0x148')});db[_0x7071('0x6d')][_0x7071('0x103')](db['ChatInternalMessage'],{'as':_0x7071('0x158'),'foreignKey':_0x7071('0x18b'),'onDelete':_0x7071('0x102')});db[_0x7071('0x6d')]['belongsToMany'](db[_0x7071('0x10')],{'as':_0x7071('0x18c'),'through':_0x7071('0x113')});db[_0x7071('0x6f')][_0x7071('0x10f')](db['ChatWebsite'],{'as':_0x7071('0x187'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x7071('0x103')](db[_0x7071('0x72')],{'as':_0x7071('0x18d'),'foreignKey':_0x7071('0x18e')});db[_0x7071('0x72')]['hasMany'](db[_0x7071('0x74')],{'as':_0x7071('0x18f'),'foreignKey':'ContactId'});db[_0x7071('0x72')]['hasMany'](db['CmHopperFinal'],{'as':_0x7071('0x106'),'foreignKey':_0x7071('0x151')});db[_0x7071('0x72')][_0x7071('0x103')](db[_0x7071('0x107')],{'as':_0x7071('0x13c'),'foreignKey':_0x7071('0x151')});db[_0x7071('0x72')][_0x7071('0x103')](db['ReportAgentPreview'],{'as':_0x7071('0x7a'),'foreignKey':'ContactId'});db[_0x7071('0x72')][_0x7071('0x103')](db[_0x7071('0x13e')],{'as':'JscriptySessions','foreignKey':_0x7071('0x151')});db[_0x7071('0x72')][_0x7071('0x103')](db[_0x7071('0x5c')],{'as':'OpenchannelInteractions','foreignKey':_0x7071('0x151'),'onDelete':_0x7071('0x16a')});db[_0x7071('0x72')][_0x7071('0x103')](db[_0x7071('0x66')],{'as':_0x7071('0x118'),'foreignKey':_0x7071('0x151'),'onDelete':_0x7071('0x16a')});db[_0x7071('0x72')][_0x7071('0x103')](db[_0x7071('0x58')],{'as':_0x7071('0x109'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x7071('0x103')](db[_0x7071('0x4f')],{'as':_0x7071('0x10a'),'foreignKey':_0x7071('0x151'),'onDelete':_0x7071('0x16a')});db[_0x7071('0x72')]['hasMany'](db['MailInteraction'],{'as':_0x7071('0x10b'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x7071('0x72')][_0x7071('0x10f')](db[_0x7071('0x70')],{'as':_0x7071('0x190'),'foreignKey':_0x7071('0x18e')});db[_0x7071('0x72')][_0x7071('0x10f')](db[_0x7071('0xe9')],{'as':_0x7071('0x15a'),'foreignKey':'ListId','onDelete':_0x7071('0x102')});db[_0x7071('0x72')][_0x7071('0x111')](db[_0x7071('0x10')],{'as':_0x7071('0x173'),'through':'cm_user_has_contacts'});db['CmContact'][_0x7071('0x111')](db[_0x7071('0x164')],{'as':_0x7071('0x163'),'through':_0x7071('0x191')});db['CmContact'][_0x7071('0x111')](db[_0x7071('0x164')],{'through':_0x7071('0x191'),'as':_0x7071('0x184')});db[_0x7071('0x74')][_0x7071('0x10f')](db['CmContact'],{'as':'Contact','foreignKey':_0x7071('0x151'),'onDelete':_0x7071('0x102')});db['CmHopper'][_0x7071('0x10f')](db['CmList'],{'as':_0x7071('0x15a'),'foreignKey':_0x7071('0x16f'),'onDelete':_0x7071('0x102')});db[_0x7071('0x74')][_0x7071('0x10f')](db[_0x7071('0x10')],{'as':_0x7071('0x192'),'foreignKey':_0x7071('0x104')});db[_0x7071('0x74')][_0x7071('0x10f')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x7071('0x13b'),'onDelete':_0x7071('0x102')});db[_0x7071('0x74')][_0x7071('0x10f')](db[_0x7071('0xd9')],{'as':'Campaign','foreignKey':_0x7071('0x193'),'onDelete':_0x7071('0x102')});db[_0x7071('0x74')][_0x7071('0x10f')](db[_0x7071('0x10')],{'as':_0x7071('0x161'),'foreignKey':'OwnerId'});db[_0x7071('0x75')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x7071('0x151'),'onDelete':_0x7071('0x102')});db['CmHopperBlack'][_0x7071('0x10f')](db['CmList'],{'as':_0x7071('0x15a'),'foreignKey':_0x7071('0x16f'),'onDelete':_0x7071('0x102')});db[_0x7071('0x75')][_0x7071('0x10f')](db['VoiceQueue'],{'as':_0x7071('0x194'),'foreignKey':'VoiceQueueId','onDelete':_0x7071('0x102')});db[_0x7071('0x75')]['belongsTo'](db['Campaign'],{'as':'Campaign','foreignKey':_0x7071('0x193'),'onDelete':_0x7071('0x102')});db[_0x7071('0x195')][_0x7071('0x103')](db['Condition'],{'as':{'plural':_0x7071('0x196'),'singular':_0x7071('0x197')},'foreignKey':_0x7071('0x198'),'onDelete':_0x7071('0x102'),'hooks':!![]});db[_0x7071('0x195')][_0x7071('0x103')](db['Condition'],{'as':{'plural':'Any','singular':_0x7071('0x199')},'foreignKey':_0x7071('0x19a'),'onDelete':_0x7071('0x102'),'hooks':!![]});db[_0x7071('0x195')][_0x7071('0x103')](db['Action'],{'as':_0x7071('0x19b'),'foreignKey':_0x7071('0x19c'),'onDelete':_0x7071('0x102'),'hooks':!![]});db[_0x7071('0x80')][_0x7071('0x103')](db[_0x7071('0x80')],{'as':_0x7071('0x155'),'foreignKey':_0x7071('0x19d'),'onDelete':_0x7071('0x102')});db[_0x7071('0x83')][_0x7071('0x103')](db['Interval'],{'as':_0x7071('0x19e'),'foreignKey':'IntervalId','onDelete':_0x7071('0x102'),'hooks':!![],'required':![]});db[_0x7071('0x83')][_0x7071('0x103')](db[_0x7071('0x17')],{'as':'Extensions','foreignKey':_0x7071('0x143'),'onDelete':_0x7071('0x16a')});db[_0x7071('0x83')][_0x7071('0x103')](db['MailApplication'],{'as':_0x7071('0x19f'),'foreignKey':_0x7071('0x143')});db[_0x7071('0x83')][_0x7071('0x103')](db[_0x7071('0x64')],{'as':_0x7071('0x1a0'),'foreignKey':_0x7071('0x143')});db[_0x7071('0x83')]['hasMany'](db[_0x7071('0x4d')],{'as':_0x7071('0x1a1'),'foreignKey':_0x7071('0x143')});db['Interval'][_0x7071('0x103')](db[_0x7071('0x56')],{'as':_0x7071('0x1a2'),'foreignKey':_0x7071('0x143')});db['Schedule'][_0x7071('0x10f')](db[_0x7071('0x3e')],{});db['Schedule'][_0x7071('0x10f')](db[_0x7071('0x1a3')],{'foreignKey':'DefaultReportId'});db[_0x7071('0x88')]['belongsTo'](db[_0x7071('0x1a4')],{'foreignKey':_0x7071('0x1a5')});db[_0x7071('0x89')][_0x7071('0x111')](db[_0x7071('0x19')],{'as':_0x7071('0x1a6'),'through':_0x7071('0x139'),'onDelete':_0x7071('0x16a')});db[_0x7071('0x164')][_0x7071('0x111')](db[_0x7071('0x72')],{'through':_0x7071('0x191')});db[_0x7071('0x164')][_0x7071('0x111')](db['ChatInteraction'],{'through':_0x7071('0x189')});db[_0x7071('0x164')][_0x7071('0x111')](db['MailInteraction'],{'through':_0x7071('0x162')});db['Tag']['belongsToMany'](db[_0x7071('0x58')],{'through':_0x7071('0x17a')});db[_0x7071('0x164')]['belongsToMany'](db[_0x7071('0x4f')],{'through':_0x7071('0x172')});db[_0x7071('0x164')]['belongsToMany'](db[_0x7071('0x5c')],{'through':_0x7071('0x183')});db[_0x7071('0x164')][_0x7071('0x111')](db[_0x7071('0xf5')],{'through':_0x7071('0x1a7')});db[_0x7071('0x1a8')][_0x7071('0x103')](db[_0x7071('0x82')],{'as':{'plural':_0x7071('0x1a9'),'singular':_0x7071('0x1aa')},'foreignKey':_0x7071('0x1ab'),'onDelete':_0x7071('0x102'),'hooks':!![]});db[_0x7071('0x1a8')][_0x7071('0x103')](db[_0x7071('0x82')],{'as':{'plural':_0x7071('0x1ac'),'singular':_0x7071('0x1ad')},'foreignKey':_0x7071('0x1ae'),'onDelete':'cascade','hooks':!![]});db[_0x7071('0x1a8')]['hasMany'](db['Action'],{'as':_0x7071('0x19b'),'foreignKey':_0x7071('0x1af'),'onDelete':'cascade','hooks':!![]});db[_0x7071('0x1a4')][_0x7071('0x103')](db['AnalyticFieldReport'],{'as':_0x7071('0x1b0'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1a5'),'hooks':!![]});db[_0x7071('0x1a3')][_0x7071('0x103')](db[_0x7071('0x1b1')],{'as':'Fields','onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1b2')});db[_0x7071('0x95')][_0x7071('0x103')](db[_0x7071('0x1b1')],{'as':'Fields','onDelete':'cascade','foreignKey':'MetricId'});db[_0x7071('0x1b1')][_0x7071('0x10f')](db[_0x7071('0x95')],{'foreignKey':_0x7071('0x1b3')});db['SalesforceAccount']['hasMany'](db['SalesforceConfiguration'],{'as':_0x7071('0x1b4'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1b5')});db[_0x7071('0x9b')]['hasMany'](db[_0x7071('0x1b6')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x7071('0x9b')]['hasMany'](db[_0x7071('0x1b6')],{'as':_0x7071('0x1b7'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1b8')});db[_0x7071('0x9b')]['hasMany'](db[_0x7071('0x1b6')],{'as':_0x7071('0x1b0'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1b9')});db[_0x7071('0x9b')]['belongsTo'](db[_0x7071('0x99')],{'as':_0x7071('0x15f'),'foreignKey':_0x7071('0x1b5')});db[_0x7071('0x1b6')][_0x7071('0x103')](db['SalesforceField'],{'as':'Subject','foreignKey':_0x7071('0x1ba')});db[_0x7071('0x1b6')][_0x7071('0x103')](db[_0x7071('0x1b6')],{'as':'Description','foreignKey':_0x7071('0x1b8')});db[_0x7071('0x1b6')][_0x7071('0x103')](db['SalesforceField'],{'as':_0x7071('0x1bb'),'foreignKey':_0x7071('0x1b9')});db['SalesforceField'][_0x7071('0x10f')](db[_0x7071('0x8d')],{'as':_0x7071('0x8d'),'foreignKey':_0x7071('0x1bc')});db[_0x7071('0x1bd')][_0x7071('0x103')](db[_0x7071('0x9f')],{'as':_0x7071('0x1b4'),'onDelete':'cascade','foreignKey':_0x7071('0x1b5')});db[_0x7071('0x9f')][_0x7071('0x103')](db[_0x7071('0xa1')],{'as':_0x7071('0x1be'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1ba')});db[_0x7071('0x9f')]['hasMany'](db['SugarcrmField'],{'as':_0x7071('0x1b7'),'onDelete':'cascade','foreignKey':_0x7071('0x1b8')});db[_0x7071('0x9f')][_0x7071('0x103')](db['SugarcrmField'],{'as':_0x7071('0x1b0'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1b9')});db[_0x7071('0x9f')][_0x7071('0x10f')](db[_0x7071('0x1bd')],{'as':_0x7071('0x15f'),'foreignKey':_0x7071('0x1b5')});db[_0x7071('0xa1')][_0x7071('0x103')](db[_0x7071('0xa1')],{'as':'Subject','foreignKey':_0x7071('0x1ba')});db[_0x7071('0xa1')][_0x7071('0x103')](db['SugarcrmField'],{'as':_0x7071('0x1bf'),'foreignKey':_0x7071('0x1b8')});db[_0x7071('0xa1')]['hasMany'](db[_0x7071('0xa1')],{'as':_0x7071('0x1bb'),'foreignKey':'FieldId'});db[_0x7071('0xa1')]['belongsTo'](db[_0x7071('0x8d')],{'as':_0x7071('0x8d'),'foreignKey':'VariableId'});db[_0x7071('0x1c0')][_0x7071('0x103')](db[_0x7071('0x1c1')],{'as':_0x7071('0x1b4'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1b5')});db[_0x7071('0x1c1')][_0x7071('0x103')](db[_0x7071('0xa3')],{'as':_0x7071('0x1be'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1ba')});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':_0x7071('0x1b7'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1b8')});db['DeskConfiguration'][_0x7071('0x103')](db[_0x7071('0xa3')],{'as':_0x7071('0x1b0'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1b9')});db['DeskConfiguration'][_0x7071('0x10f')](db[_0x7071('0x1c0')],{'as':_0x7071('0x15f'),'foreignKey':_0x7071('0x1b5')});db[_0x7071('0x1c1')]['belongsToMany'](db[_0x7071('0x164')],{'through':'int_desk_configuration_has_tags'});db[_0x7071('0xa3')][_0x7071('0x103')](db['DeskField'],{'as':_0x7071('0x1c2'),'foreignKey':_0x7071('0x1ba')});db[_0x7071('0xa3')]['hasMany'](db[_0x7071('0xa3')],{'as':_0x7071('0x1bf'),'foreignKey':_0x7071('0x1b8')});db[_0x7071('0xa3')]['hasMany'](db[_0x7071('0xa3')],{'as':_0x7071('0x1bb'),'foreignKey':_0x7071('0x1b9')});db[_0x7071('0xa3')]['belongsTo'](db[_0x7071('0x8d')],{'as':'Variable','foreignKey':'VariableId'});db['ZohoAccount'][_0x7071('0x103')](db['ZohoConfiguration'],{'as':_0x7071('0x1b4'),'onDelete':'cascade','foreignKey':_0x7071('0x1b5')});db[_0x7071('0x1c3')]['hasMany'](db[_0x7071('0xa6')],{'as':_0x7071('0x1be'),'onDelete':'cascade','foreignKey':_0x7071('0x1ba')});db[_0x7071('0x1c3')]['hasMany'](db['ZohoField'],{'as':_0x7071('0x1b7'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1b8')});db[_0x7071('0x1c3')][_0x7071('0x103')](db[_0x7071('0xa6')],{'as':_0x7071('0x1b0'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1b9')});db[_0x7071('0x1c3')][_0x7071('0x10f')](db[_0x7071('0xa5')],{'as':'Account','foreignKey':_0x7071('0x1b5')});db[_0x7071('0xa6')]['hasMany'](db[_0x7071('0xa6')],{'as':_0x7071('0x1c2'),'foreignKey':_0x7071('0x1ba')});db[_0x7071('0xa6')]['hasMany'](db[_0x7071('0xa6')],{'as':_0x7071('0x1bf'),'foreignKey':_0x7071('0x1b8')});db[_0x7071('0xa6')][_0x7071('0x103')](db[_0x7071('0xa6')],{'as':_0x7071('0x1bb'),'foreignKey':'FieldId'});db['ZohoField'][_0x7071('0x10f')](db[_0x7071('0x8d')],{'as':_0x7071('0x8d'),'foreignKey':_0x7071('0x1bc')});db[_0x7071('0x1c4')][_0x7071('0x103')](db[_0x7071('0x1c5')],{'as':_0x7071('0x1b4'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1b5')});db[_0x7071('0x1c5')][_0x7071('0x103')](db['ZendeskField'],{'as':_0x7071('0x1be'),'foreignKey':_0x7071('0x1ba')});db[_0x7071('0x1c5')][_0x7071('0x103')](db['ZendeskField'],{'as':_0x7071('0x1b7'),'foreignKey':_0x7071('0x1b8')});db[_0x7071('0x1c5')][_0x7071('0x103')](db[_0x7071('0xa9')],{'as':_0x7071('0x1b0'),'foreignKey':_0x7071('0x1b9')});db[_0x7071('0x1c5')]['belongsTo'](db[_0x7071('0x1c4')],{'as':'Account','foreignKey':_0x7071('0x1b5')});db[_0x7071('0x1c5')]['belongsToMany'](db['Tag'],{'through':_0x7071('0x1c6')});db['ZendeskField'][_0x7071('0x103')](db[_0x7071('0xa9')],{'as':_0x7071('0x1c2'),'foreignKey':'SubjectId'});db[_0x7071('0xa9')][_0x7071('0x103')](db[_0x7071('0xa9')],{'as':_0x7071('0x1bf'),'foreignKey':'DescriptionId'});db[_0x7071('0xa9')]['hasMany'](db[_0x7071('0xa9')],{'as':_0x7071('0x1bb'),'foreignKey':_0x7071('0x1b9')});db['ZendeskField']['belongsTo'](db['Variable'],{'as':_0x7071('0x8d'),'foreignKey':_0x7071('0x1bc')});db[_0x7071('0xab')][_0x7071('0x103')](db['FreshdeskConfiguration'],{'as':_0x7071('0x1b4'),'onDelete':_0x7071('0x102'),'foreignKey':'AccountId'});db[_0x7071('0xad')][_0x7071('0x103')](db[_0x7071('0xae')],{'as':_0x7071('0x1be'),'onDelete':'cascade','foreignKey':_0x7071('0x1ba')});db[_0x7071('0xad')][_0x7071('0x103')](db[_0x7071('0xae')],{'as':'Descriptions','onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1b8')});db[_0x7071('0xad')][_0x7071('0x103')](db[_0x7071('0xae')],{'as':_0x7071('0x1b0'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1b9')});db['FreshdeskConfiguration'][_0x7071('0x10f')](db[_0x7071('0xab')],{'as':'Account','foreignKey':_0x7071('0x1b5')});db['FreshdeskConfiguration']['belongsToMany'](db[_0x7071('0x164')],{'through':_0x7071('0x1c7')});db[_0x7071('0xae')]['hasMany'](db[_0x7071('0xae')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x7071('0xae')][_0x7071('0x103')](db['FreshdeskField'],{'as':_0x7071('0x1bf'),'foreignKey':_0x7071('0x1b8')});db[_0x7071('0xae')][_0x7071('0x103')](db[_0x7071('0xae')],{'as':'Field','foreignKey':'FieldId'});db['FreshdeskField']['belongsTo'](db[_0x7071('0x8d')],{'as':_0x7071('0x8d'),'foreignKey':_0x7071('0x1bc')});db['VtigerAccount'][_0x7071('0x103')](db[_0x7071('0xb2')],{'as':_0x7071('0x1b4'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1b5')});db[_0x7071('0xb2')][_0x7071('0x103')](db['VtigerField'],{'as':_0x7071('0x1be'),'foreignKey':_0x7071('0x1ba')});db[_0x7071('0xb2')][_0x7071('0x103')](db[_0x7071('0x1c8')],{'as':'Descriptions','foreignKey':_0x7071('0x1b8')});db[_0x7071('0xb2')][_0x7071('0x103')](db[_0x7071('0x1c8')],{'as':_0x7071('0x1b0'),'foreignKey':'FieldId'});db[_0x7071('0xb2')]['belongsTo'](db[_0x7071('0xb0')],{'as':'Account','foreignKey':'AccountId'});db[_0x7071('0x1c8')]['hasMany'](db['VtigerField'],{'as':_0x7071('0x1c2'),'foreignKey':_0x7071('0x1ba')});db[_0x7071('0x1c8')]['hasMany'](db[_0x7071('0x1c8')],{'as':'Description','foreignKey':_0x7071('0x1b8')});db['VtigerField']['hasMany'](db[_0x7071('0x1c8')],{'as':_0x7071('0x1bb'),'foreignKey':_0x7071('0x1b9')});db[_0x7071('0x1c8')]['belongsTo'](db[_0x7071('0x8d')],{'as':_0x7071('0x8d'),'foreignKey':'VariableId'});db[_0x7071('0xb5')][_0x7071('0x103')](db[_0x7071('0xb7')],{'as':_0x7071('0x1b4'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1b5')});db[_0x7071('0xb7')][_0x7071('0x103')](db[_0x7071('0xb9')],{'as':'Subjects','foreignKey':_0x7071('0x1ba')});db[_0x7071('0xb7')]['hasMany'](db['ServicenowField'],{'as':_0x7071('0x1b7'),'foreignKey':_0x7071('0x1b8')});db[_0x7071('0xb7')][_0x7071('0x103')](db['ServicenowField'],{'as':_0x7071('0x1b0'),'foreignKey':_0x7071('0x1b9')});db[_0x7071('0xb7')]['belongsTo'](db[_0x7071('0xb5')],{'as':_0x7071('0x15f'),'foreignKey':_0x7071('0x1b5')});db[_0x7071('0xb9')][_0x7071('0x103')](db['ServicenowField'],{'as':'Subject','foreignKey':'SubjectId'});db['ServicenowField'][_0x7071('0x103')](db[_0x7071('0xb9')],{'as':_0x7071('0x1bf'),'foreignKey':_0x7071('0x1b8')});db[_0x7071('0xb9')][_0x7071('0x103')](db[_0x7071('0xb9')],{'as':'Field','foreignKey':_0x7071('0x1b9')});db[_0x7071('0xb9')][_0x7071('0x10f')](db[_0x7071('0x8d')],{'as':_0x7071('0x8d'),'foreignKey':_0x7071('0x1bc')});db[_0x7071('0xba')][_0x7071('0x103')](db[_0x7071('0xbb')],{'as':_0x7071('0x1b4'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1b5')});db[_0x7071('0xbb')][_0x7071('0x103')](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1ba')});db[_0x7071('0xbb')][_0x7071('0x103')](db[_0x7071('0xbd')],{'as':'Descriptions','onDelete':_0x7071('0x102'),'foreignKey':'DescriptionId'});db[_0x7071('0xbb')]['hasMany'](db[_0x7071('0xbd')],{'as':_0x7071('0x1b0'),'onDelete':_0x7071('0x102'),'foreignKey':'FieldId'});db[_0x7071('0xbb')][_0x7071('0x10f')](db[_0x7071('0xba')],{'as':_0x7071('0x15f'),'foreignKey':_0x7071('0x1b5')});db[_0x7071('0xbd')][_0x7071('0x103')](db[_0x7071('0xbd')],{'as':_0x7071('0x1c2'),'foreignKey':_0x7071('0x1ba')});db[_0x7071('0xbd')][_0x7071('0x103')](db[_0x7071('0xbd')],{'as':'Description','foreignKey':_0x7071('0x1b8')});db[_0x7071('0xbd')][_0x7071('0x103')](db[_0x7071('0xbd')],{'as':_0x7071('0x1bb'),'foreignKey':_0x7071('0x1b9')});db[_0x7071('0xbd')][_0x7071('0x10f')](db[_0x7071('0x8d')],{'as':_0x7071('0x8d'),'foreignKey':'VariableId'});db['FreshsalesAccount']['hasMany'](db[_0x7071('0x1c9')],{'as':_0x7071('0x1b4'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1b5')});db['FreshsalesConfiguration'][_0x7071('0x103')](db['FreshsalesField'],{'as':_0x7071('0x1be'),'foreignKey':'SubjectId'});db[_0x7071('0x1c9')][_0x7071('0x103')](db[_0x7071('0x1ca')],{'as':'Descriptions','foreignKey':_0x7071('0x1b8')});db[_0x7071('0x1c9')]['hasMany'](db['FreshsalesField'],{'as':_0x7071('0x1b0'),'foreignKey':'FieldId'});db[_0x7071('0x1c9')]['belongsTo'](db[_0x7071('0xbe')],{'as':_0x7071('0x15f'),'foreignKey':_0x7071('0x1b5')});db['FreshsalesField'][_0x7071('0x103')](db['FreshsalesField'],{'as':_0x7071('0x1c2'),'foreignKey':'SubjectId'});db[_0x7071('0x1ca')][_0x7071('0x103')](db[_0x7071('0x1ca')],{'as':_0x7071('0x1bf'),'foreignKey':_0x7071('0x1b8')});db['FreshsalesField'][_0x7071('0x103')](db['FreshsalesField'],{'as':'Field','foreignKey':_0x7071('0x1b9')});db[_0x7071('0x1ca')]['belongsTo'](db['Variable'],{'as':_0x7071('0x8d'),'foreignKey':_0x7071('0x1bc')});db[_0x7071('0x1cb')][_0x7071('0x10f')](db[_0x7071('0x60')],{});db[_0x7071('0x1cb')][_0x7071('0x10f')](db['CmList'],{'as':_0x7071('0x15a'),'foreignKey':_0x7071('0x16f')});db[_0x7071('0x1cb')][_0x7071('0x10f')](db[_0x7071('0x72')],{'as':_0x7071('0x160'),'foreignKey':'ContactId'});db['ChatQueueReport'][_0x7071('0x10f')](db[_0x7071('0x66')],{});db[_0x7071('0x1cb')][_0x7071('0x10f')](db[_0x7071('0x68')],{});db[_0x7071('0x1cb')][_0x7071('0x10f')](db['User'],{});db[_0x7071('0x1cb')][_0x7071('0x10f')](db[_0x7071('0x6b')],{});db[_0x7071('0x1cc')][_0x7071('0x10f')](db['User'],{'onDelete':_0x7071('0x102'),'foreignKey':'FromId'});db[_0x7071('0x1cc')]['belongsTo'](db[_0x7071('0x10')],{'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1cd')});db['JscriptySessionReport'][_0x7071('0x103')](db[_0x7071('0xc5')],{'foreignKey':_0x7071('0x1ce'),'onDelete':_0x7071('0x102')});db[_0x7071('0x13e')][_0x7071('0x103')](db['JscriptyAnswerReport'],{'foreignKey':_0x7071('0x1ce'),'onDelete':'cascade'});db[_0x7071('0xc8')]['belongsTo'](db[_0x7071('0x130')],{});db[_0x7071('0xc8')][_0x7071('0x10f')](db[_0x7071('0xe9')],{'as':_0x7071('0x15a'),'foreignKey':_0x7071('0x16f')});db[_0x7071('0xc8')][_0x7071('0x10f')](db[_0x7071('0x72')],{'as':_0x7071('0x160'),'foreignKey':'ContactId'});db[_0x7071('0xc8')][_0x7071('0x10f')](db[_0x7071('0x58')],{});db['SmsQueueReport'][_0x7071('0x10f')](db[_0x7071('0x5a')],{});db[_0x7071('0xc8')][_0x7071('0x10f')](db[_0x7071('0x10')],{});db[_0x7071('0xc8')][_0x7071('0x10f')](db[_0x7071('0x121')],{});db[_0x7071('0x1cf')][_0x7071('0x103')](db['JscriptySessionReport'],{'foreignKey':_0x7071('0x1d0')});db[_0x7071('0x1cf')][_0x7071('0x103')](db[_0x7071('0xc5')],{'foreignKey':_0x7071('0x1d0')});db[_0x7071('0x1cf')][_0x7071('0x103')](db[_0x7071('0x1d1')],{'foreignKey':_0x7071('0x1d0')});db[_0x7071('0xd1')]['belongsToMany'](db[_0x7071('0x10')],{'as':_0x7071('0x173'),'through':'user_has_square_projects'});db[_0x7071('0x147')]['belongsToMany'](db[_0x7071('0x10')],{'as':_0x7071('0x146'),'through':_0x7071('0x117')});db[_0x7071('0x147')]['belongsToMany'](db[_0x7071('0x13a')],{'through':_0x7071('0xfe'),'as':_0x7071('0x1d2')});db[_0x7071('0x147')]['belongsToMany'](db['MailQueue'],{'through':_0x7071('0x15e'),'as':_0x7071('0x11e')});db[_0x7071('0x147')][_0x7071('0x111')](db['ChatQueue'],{'through':_0x7071('0x18a'),'as':_0x7071('0x1d3')});db['Team'][_0x7071('0x111')](db[_0x7071('0x53')],{'through':'team_has_fax_queues','as':_0x7071('0x120')});db[_0x7071('0x147')]['belongsToMany'](db[_0x7071('0x121')],{'through':_0x7071('0x17d'),'as':_0x7071('0x122')});db[_0x7071('0x147')]['belongsToMany'](db[_0x7071('0x5e')],{'through':'team_has_openchannel_queues','as':_0x7071('0x124')});db[_0x7071('0x147')]['belongsToMany'](db['WhatsappQueue'],{'through':_0x7071('0x1d4'),'as':'WhatsappQueues'});db['Team'][_0x7071('0x111')](db[_0x7071('0xeb')],{'through':'TeamVoicePrefix','as':_0x7071('0x126')});db[_0x7071('0xd9')][_0x7071('0x103')](db[_0x7071('0x74')],{'as':_0x7071('0x18f'),'foreignKey':'CampaignId'});db[_0x7071('0xd9')][_0x7071('0x103')](db[_0x7071('0x77')],{'as':_0x7071('0x106'),'foreignKey':_0x7071('0x193')});db['Campaign'][_0x7071('0x103')](db['CmHopperHistory'],{'as':_0x7071('0x13c'),'foreignKey':_0x7071('0x193')});db[_0x7071('0xd9')][_0x7071('0x103')](db[_0x7071('0x75')],{'as':_0x7071('0x13d'),'foreignKey':_0x7071('0x193')});db[_0x7071('0xd9')][_0x7071('0x10f')](db[_0x7071('0x140')],{'as':'Trunk','foreignKey':_0x7071('0x1d5')});db[_0x7071('0xd9')]['belongsTo'](db[_0x7071('0x140')],{'as':_0x7071('0x141'),'foreignKey':_0x7071('0x142')});db['Campaign'][_0x7071('0x10f')](db[_0x7071('0x83')],{'as':_0x7071('0x83'),'foreignKey':_0x7071('0x143')});db[_0x7071('0xd9')]['belongsTo'](db[_0x7071('0xd1')],{'as':_0x7071('0xd1'),'foreignKey':_0x7071('0x1d6')});db[_0x7071('0xd9')][_0x7071('0x111')](db['CmList'],{'as':'Lists','through':_0x7071('0x1d7')});db[_0x7071('0xd9')][_0x7071('0x111')](db[_0x7071('0xe9')],{'as':_0x7071('0x149'),'through':_0x7071('0x1d8')});db['Attachment']['belongsTo'](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x7071('0xe1')][_0x7071('0x10f')](db[_0x7071('0x157')],{});db[_0x7071('0xe1')]['belongsTo'](db['MailInteraction'],{});db[_0x7071('0xe1')][_0x7071('0x10f')](db[_0x7071('0x3e')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db['MailTransferReport'][_0x7071('0x10f')](db['User'],{'foreignKey':_0x7071('0x1d9'),'as':_0x7071('0x1da')});db[_0x7071('0xe1')][_0x7071('0x10f')](db[_0x7071('0x10')],{'foreignKey':_0x7071('0x1db'),'as':_0x7071('0x1dc')});db[_0x7071('0xe1')][_0x7071('0x10f')](db[_0x7071('0x11d')],{'foreignKey':_0x7071('0x1dd'),'as':_0x7071('0x1de')});db[_0x7071('0xe1')][_0x7071('0x10f')](db[_0x7071('0x3e')],{'foreignKey':_0x7071('0x1df'),'as':_0x7071('0x1e0')});db[_0x7071('0xe2')][_0x7071('0x10f')](db[_0x7071('0x68')],{});db[_0x7071('0xe2')]['belongsTo'](db[_0x7071('0x66')],{});db[_0x7071('0xe2')][_0x7071('0x10f')](db[_0x7071('0x60')],{'foreignKey':_0x7071('0x1e1'),'as':_0x7071('0x1e2')});db[_0x7071('0xe2')][_0x7071('0x10f')](db[_0x7071('0x10')],{'foreignKey':_0x7071('0x1d9'),'as':_0x7071('0x1da')});db[_0x7071('0xe2')][_0x7071('0x10f')](db['User'],{'foreignKey':_0x7071('0x1db'),'as':_0x7071('0x1dc')});db[_0x7071('0xe2')][_0x7071('0x10f')](db[_0x7071('0x6b')],{'foreignKey':_0x7071('0x1e3'),'as':_0x7071('0x1de')});db['ChatTransferReport'][_0x7071('0x10f')](db['ChatWebsite'],{'foreignKey':_0x7071('0x1e4'),'as':'ToAccount'});db[_0x7071('0xe4')][_0x7071('0x10f')](db[_0x7071('0x51')],{});db[_0x7071('0xe4')]['belongsTo'](db[_0x7071('0x4f')],{});db[_0x7071('0xe4')][_0x7071('0x10f')](db[_0x7071('0x4c')],{'foreignKey':_0x7071('0x1e5'),'as':_0x7071('0x1e2')});db['FaxTransferReport'][_0x7071('0x10f')](db[_0x7071('0x10')],{'foreignKey':_0x7071('0x1d9'),'as':_0x7071('0x1da')});db[_0x7071('0xe4')][_0x7071('0x10f')](db[_0x7071('0x10')],{'foreignKey':_0x7071('0x1db'),'as':'ToAgent'});db[_0x7071('0xe4')][_0x7071('0x10f')](db['FaxQueue'],{'foreignKey':_0x7071('0x1e6'),'as':_0x7071('0x1de')});db[_0x7071('0xe4')][_0x7071('0x10f')](db[_0x7071('0x4c')],{'foreignKey':_0x7071('0x1e7'),'as':_0x7071('0x1e0')});db['OpenchannelTransferReport']['belongsTo'](db[_0x7071('0x17f')],{});db[_0x7071('0xe6')][_0x7071('0x10f')](db[_0x7071('0x5c')],{});db[_0x7071('0xe6')][_0x7071('0x10f')](db[_0x7071('0x12d')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db[_0x7071('0xe6')][_0x7071('0x10f')](db[_0x7071('0x10')],{'foreignKey':_0x7071('0x1d9'),'as':_0x7071('0x1da')});db[_0x7071('0xe6')][_0x7071('0x10f')](db[_0x7071('0x10')],{'foreignKey':_0x7071('0x1db'),'as':_0x7071('0x1dc')});db[_0x7071('0xe6')][_0x7071('0x10f')](db['OpenchannelQueue'],{'foreignKey':_0x7071('0x1e8'),'as':_0x7071('0x1de')});db['OpenchannelTransferReport'][_0x7071('0x10f')](db[_0x7071('0x12d')],{'foreignKey':_0x7071('0x1e9'),'as':_0x7071('0x1e0')});db[_0x7071('0xe8')]['belongsTo'](db[_0x7071('0x5a')],{});db[_0x7071('0xe8')][_0x7071('0x10f')](db['SmsInteraction'],{});db[_0x7071('0xe8')][_0x7071('0x10f')](db[_0x7071('0x130')],{'foreignKey':_0x7071('0x1ea'),'as':_0x7071('0x1e2')});db[_0x7071('0xe8')]['belongsTo'](db[_0x7071('0x10')],{'foreignKey':_0x7071('0x1d9'),'as':_0x7071('0x1da')});db[_0x7071('0xe8')][_0x7071('0x10f')](db['User'],{'foreignKey':'ToUserId','as':_0x7071('0x1dc')});db[_0x7071('0xe8')][_0x7071('0x10f')](db[_0x7071('0x121')],{'foreignKey':'ToSmsQueueId','as':_0x7071('0x1de')});db[_0x7071('0xe8')][_0x7071('0x10f')](db[_0x7071('0x130')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList'][_0x7071('0x103')](db[_0x7071('0x80')],{'as':_0x7071('0x155'),'foreignKey':_0x7071('0x16f'),'onDelete':'cascade'});db[_0x7071('0xe9')][_0x7071('0x103')](db[_0x7071('0x7c')],{'as':_0x7071('0x1eb'),'foreignKey':_0x7071('0x16f')});db[_0x7071('0xe9')]['hasMany'](db['CmContact'],{'as':_0x7071('0x18d'),'onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x16f')});db['CmList'][_0x7071('0x103')](db[_0x7071('0x77')],{'as':_0x7071('0x106'),'foreignKey':_0x7071('0x16f')});db[_0x7071('0xe9')][_0x7071('0x103')](db[_0x7071('0x107')],{'as':_0x7071('0x1ec'),'foreignKey':'ListId'});db[_0x7071('0xe9')]['hasMany'](db['ReportAgentPreview'],{'as':_0x7071('0x7a'),'foreignKey':'ListId'});db['CmList'][_0x7071('0x111')](db[_0x7071('0x13a')],{'as':_0x7071('0x1ed'),'through':'voice_queues_has_cm_lists'});db[_0x7071('0xe9')][_0x7071('0x111')](db[_0x7071('0x10')],{'as':_0x7071('0x146'),'through':_0x7071('0x116')});db[_0x7071('0xeb')][_0x7071('0x103')](db['VoiceExtension'],{'as':_0x7071('0x105'),'onDelete':_0x7071('0x102')});db[_0x7071('0xeb')][_0x7071('0x111')](db[_0x7071('0x10')],{'as':_0x7071('0x146'),'through':_0x7071('0x101')});db[_0x7071('0xeb')][_0x7071('0x111')](db['Team'],{'through':_0x7071('0xff'),'as':'Teams'});db[_0x7071('0xec')][_0x7071('0x103')](db[_0x7071('0x10')],{'as':_0x7071('0x173'),'foreignKey':_0x7071('0x110')});db[_0x7071('0xec')][_0x7071('0x103')](db[_0x7071('0xee')],{'as':_0x7071('0x1ee'),'foreignKey':_0x7071('0x110'),'onDelete':_0x7071('0x102')});db[_0x7071('0xee')]['hasMany'](db['UserProfileResource'],{'as':_0x7071('0x1ef'),'foreignKey':'sectionId','onDelete':_0x7071('0x102')});db[_0x7071('0x132')][_0x7071('0x103')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x7071('0x1f0'),'onDelete':_0x7071('0x102')});db['WhatsappAccount'][_0x7071('0x103')](db['CannedAnswer'],{'as':_0x7071('0x156'),'foreignKey':_0x7071('0x1f0')});db[_0x7071('0x132')]['hasMany'](db[_0x7071('0xf6')],{'as':_0x7071('0x158'),'foreignKey':_0x7071('0x1f0')});db[_0x7071('0x132')][_0x7071('0x103')](db[_0x7071('0xf5')],{'as':_0x7071('0x159')});db[_0x7071('0x132')]['hasMany'](db[_0x7071('0xf3')],{'as':'Applications'});db[_0x7071('0x132')][_0x7071('0x10f')](db[_0x7071('0xe9')],{'as':_0x7071('0x15a'),'foreignKey':'ListId'});db['WhatsappAccount'][_0x7071('0x10f')](db[_0x7071('0x15d')],{'as':_0x7071('0x144'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7071('0x132')][_0x7071('0x111')](db[_0x7071('0x10')],{'as':_0x7071('0x146'),'through':'user_has_whatsapp_accounts'});db[_0x7071('0xf3')][_0x7071('0x10f')](db[_0x7071('0x10')],{'onDelete':_0x7071('0x16a')});db[_0x7071('0xf3')][_0x7071('0x10f')](db['WhatsappQueue'],{'onDelete':_0x7071('0x16a')});db[_0x7071('0xf3')][_0x7071('0x10f')](db[_0x7071('0x132')],{'onDelete':_0x7071('0x16a')});db[_0x7071('0xf3')]['belongsTo'](db[_0x7071('0x83')],{'onDelete':'restrict','foreignKey':_0x7071('0x143')});db[_0x7071('0xf3')][_0x7071('0x10f')](db[_0x7071('0x164')],{'onDelete':_0x7071('0x16a'),'foreignKey':_0x7071('0x16b')});db['WhatsappInteraction'][_0x7071('0x103')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x7071('0x102'),'foreignKey':_0x7071('0x1f1')});db[_0x7071('0xf5')][_0x7071('0x10f')](db[_0x7071('0x132')],{'as':_0x7071('0x15f'),'foreignKey':'WhatsappAccountId'});db[_0x7071('0xf5')][_0x7071('0x10f')](db[_0x7071('0x72')],{'as':_0x7071('0x160'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0x7071('0x10f')](db['User'],{'as':_0x7071('0x161'),'foreignKey':_0x7071('0x104')});db['WhatsappInteraction'][_0x7071('0x111')](db['Tag'],{'through':_0x7071('0x1a7'),'as':_0x7071('0x163')});db[_0x7071('0xf5')]['belongsToMany'](db[_0x7071('0x164')],{'through':_0x7071('0x1a7'),'as':'ThroughTags'});db['WhatsappInteraction'][_0x7071('0x111')](db[_0x7071('0x10')],{'as':_0x7071('0x173'),'through':'user_has_whatsapp_interactions','foreignKey':_0x7071('0x1f1')});db[_0x7071('0xf6')][_0x7071('0x10f')](db['User'],{'as':_0x7071('0x10')});db[_0x7071('0xf6')][_0x7071('0x10f')](db[_0x7071('0x72')],{'onDelete':_0x7071('0x102'),'as':'Contact'});db[_0x7071('0xf6')][_0x7071('0x10f')](db[_0x7071('0xf5')],{'onDelete':_0x7071('0x102'),'as':'Interaction','foreignKey':_0x7071('0x1f1')});db['WhatsappMessage'][_0x7071('0x10f')](db[_0x7071('0x132')],{'as':_0x7071('0x15f'),'foreignKey':_0x7071('0x1f0')});db[_0x7071('0xf8')][_0x7071('0x10f')](db[_0x7071('0x132')],{});db['WhatsappQueueReport'][_0x7071('0x10f')](db[_0x7071('0xe9')],{'as':_0x7071('0x15a'),'foreignKey':_0x7071('0x16f')});db[_0x7071('0xf8')]['belongsTo'](db[_0x7071('0x72')],{'as':_0x7071('0x160'),'foreignKey':'ContactId'});db[_0x7071('0xf8')][_0x7071('0x10f')](db['WhatsappInteraction'],{});db[_0x7071('0xf8')]['belongsTo'](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0x7071('0x10f')](db[_0x7071('0xf6')],{});db[_0x7071('0xf8')][_0x7071('0x10f')](db[_0x7071('0x10')],{});db[_0x7071('0xfa')][_0x7071('0x10f')](db['WhatsappMessage'],{});db[_0x7071('0xfa')][_0x7071('0x10f')](db[_0x7071('0xf5')],{});db[_0x7071('0xfa')]['belongsTo'](db[_0x7071('0x132')],{'foreignKey':_0x7071('0x1f2'),'as':'FromAccount'});db[_0x7071('0xfa')][_0x7071('0x10f')](db[_0x7071('0x132')],{'foreignKey':'ToWhatsappAccountId','as':_0x7071('0x1e0')});db[_0x7071('0xfa')]['belongsTo'](db[_0x7071('0x1f3')],{'foreignKey':_0x7071('0x1f4'),'as':_0x7071('0x1de')});db['WhatsappTransferReport'][_0x7071('0x10f')](db[_0x7071('0x10')],{'foreignKey':_0x7071('0x1d9'),'as':_0x7071('0x1da')});db['WhatsappTransferReport'][_0x7071('0x10f')](db[_0x7071('0x10')],{'foreignKey':_0x7071('0x1db'),'as':_0x7071('0x1dc')});db['WhatsappQueue'][_0x7071('0x111')](db[_0x7071('0x10')],{'as':_0x7071('0x146'),'through':_0x7071('0x38'),'foreignKey':_0x7071('0x1f5')});db['WhatsappQueue'][_0x7071('0x111')](db[_0x7071('0x147')],{'through':'team_has_whatsapp_queues','as':'Teams'});module[_0x7071('0x1f6')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 3b2256f..9c906af 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa246=['device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','statusCode','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/faxAccount','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatProactiveAction','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/template','/api/triggers','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/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/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesField','/api/networks','./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/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/cloudProvider','/api/realtime','./api/realtime','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','/api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','3.0.0','/plugins','route','get','sendFile','appPath','/index.html','username','password','newPassword','apiKey','firstName','lastName','phone','mobile','fax','clientId','securityToken','code','accessKey','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','exten','clientEmail','privateKey','secretaccesskey','pass','accountSid','localstationid','secret','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','path','express-winston','util','./errors','./config/logger','api','auth','default','use','logger','isEmpty','\x20body=%s','method','headers','x-forwarded-for','remoteAddress','url','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body'];(function(_0x1ba114,_0x594a5b){var _0x245c01=function(_0x4681dd){while(--_0x4681dd){_0x1ba114['push'](_0x1ba114['shift']());}};_0x245c01(++_0x594a5b);}(_0xa246,0x11f));var _0x6a24=function(_0x479753,_0x255c91){_0x479753=_0x479753-0x0;var _0x38f3e2=_0xa246[_0x479753];return _0x38f3e2;};'use strict';var _=require('lodash');var path=require(_0x6a24('0x0'));var express=require('express');var ewinston=require(_0x6a24('0x1'));var util=require(_0x6a24('0x2'));var errors=require(_0x6a24('0x3'));var config=require('./config/environment');var logger=require(_0x6a24('0x4'))(_0x6a24('0x5'));var authLogger=require('./config/logger')(_0x6a24('0x6'));exports[_0x6a24('0x7')]=function(_0xbd5399){_0xbd5399[_0x6a24('0x8')](ewinston[_0x6a24('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x45a85d,_0x97b2a){var _0x3463a3='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x6a24('0xa')](_0x45a85d['body'])){_0x3463a3+=_0x6a24('0xb');var _0x5d32be=_0x45a85d['body'];maskSensitiveData(_0x5d32be);}return util['format'](_0x3463a3,_0x45a85d[_0x6a24('0xc')],_0x45a85d[_0x6a24('0xd')][_0x6a24('0xe')]?_0x45a85d['headers']['x-forwarded-for']:_0x45a85d['connection'][_0x6a24('0xf')]||_0x45a85d['ip'],_0x45a85d[_0x6a24('0x10')],_0x97b2a['statusCode'],_0x97b2a[_0x6a24('0x11')],_0x45a85d[_0x6a24('0x12')]?_0x45a85d[_0x6a24('0x12')]['id']:null,_0x45a85d[_0x6a24('0x12')]?_0x45a85d['user'][_0x6a24('0x13')]:null,_0x45a85d['user']?_0x45a85d[_0x6a24('0x12')][_0x6a24('0x14')]:null,_0x5d32be?util['inspect'](_0x5d32be,![],null):'');}}));_0xbd5399[_0x6a24('0x8')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x153333,_0x3cb223){var _0x2a8eee=_0x6a24('0x15');if(_0x153333[_0x6a24('0x16')]&&_0x153333[_0x6a24('0x16')][_0x6a24('0x17')]&&_0x153333[_0x6a24('0x16')][_0x6a24('0x18')]){_0x2a8eee=_0x6a24('0x19');}return util['format'](_0x2a8eee,_0x153333[_0x6a24('0xc')],_0x153333[_0x6a24('0xd')]['x-forwarded-for']?_0x153333[_0x6a24('0xd')][_0x6a24('0xe')]:_0x153333[_0x6a24('0x1a')][_0x6a24('0xf')]||_0x153333['ip'],_0x153333[_0x6a24('0x10')],_0x3cb223[_0x6a24('0x1b')],_0x3cb223[_0x6a24('0x11')],_0x153333[_0x6a24('0x12')]?_0x153333['user']['id']:null,_0x153333[_0x6a24('0x12')]?_0x153333[_0x6a24('0x12')][_0x6a24('0x13')]:null,_0x153333[_0x6a24('0x12')]?_0x153333[_0x6a24('0x12')][_0x6a24('0x14')]:null,_0x153333[_0x6a24('0x16')]&&_0x153333[_0x6a24('0x16')][_0x6a24('0x17')]?_0x153333[_0x6a24('0x16')][_0x6a24('0x17')]:_0x6a24('0x1c'),_0x153333[_0x6a24('0x16')]&&_0x153333[_0x6a24('0x16')]['agent_id']?_0x153333[_0x6a24('0x16')][_0x6a24('0x18')]:'',_0x153333['body']&&_0x153333[_0x6a24('0x16')]['agent_name']?_0x153333['body'][_0x6a24('0x1d')]:'');},'ignoreRoute':function(_0x46003b){var _0x41a0cf=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x41a0cf[_0x6a24('0x1e')](_0x46003b[_0x6a24('0x10')]);}}));_0xbd5399['use'](_0x6a24('0x1f'),require(_0x6a24('0x20')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x21'),require(_0x6a24('0x22')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x23'),require(_0x6a24('0x24')));_0xbd5399['use'](_0x6a24('0x25'),require(_0x6a24('0x26')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x27'),require('./api/voiceMusicOnHold'));_0xbd5399[_0x6a24('0x8')]('/api/voice/queues',require(_0x6a24('0x28')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x29'),require(_0x6a24('0x2a')));_0xbd5399[_0x6a24('0x8')]('/api/screen/recordings',require(_0x6a24('0x2b')));_0xbd5399['use'](_0x6a24('0x2c'),require(_0x6a24('0x2d')));_0xbd5399['use']('/api/voice/mails/messages',require(_0x6a24('0x2e')));_0xbd5399['use']('/api/voice/calls/reports',require('./api/voiceCallReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x2f'),require(_0x6a24('0x30')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x31'),require('./api/voiceAgentReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x32'),require(_0x6a24('0x33')));_0xbd5399[_0x6a24('0x8')]('/api/members/reports',require(_0x6a24('0x34')));_0xbd5399['use'](_0x6a24('0x35'),require(_0x6a24('0x36')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x37'),require(_0x6a24('0x38')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x39'),require('./api/mailServerOut'));_0xbd5399['use'](_0x6a24('0x3a'),require(_0x6a24('0x3b')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x3c'),require(_0x6a24('0x3d')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x3e'),require(_0x6a24('0x3f')));_0xbd5399['use'](_0x6a24('0x40'),require(_0x6a24('0x41')));_0xbd5399['use']('/api/mail/messages',require(_0x6a24('0x42')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x43'),require(_0x6a24('0x44')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x45'),require('./api/mailQueueReport'));_0xbd5399[_0x6a24('0x8')]('/api/dashboards',require('./api/dashboard'));_0xbd5399[_0x6a24('0x8')]('/api/dashboards/items',require('./api/dashboardItem'));_0xbd5399['use']('/api/fax/accounts',require(_0x6a24('0x46')));_0xbd5399[_0x6a24('0x8')]('/api/fax/applications',require('./api/faxApplication'));_0xbd5399[_0x6a24('0x8')]('/api/fax/interactions',require(_0x6a24('0x47')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x48'),require(_0x6a24('0x49')));_0xbd5399['use'](_0x6a24('0x4a'),require(_0x6a24('0x4b')));_0xbd5399['use'](_0x6a24('0x4c'),require('./api/faxQueueReport'));_0xbd5399['use'](_0x6a24('0x4d'),require(_0x6a24('0x4e')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x4f'),require(_0x6a24('0x50')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x51'),require(_0x6a24('0x52')));_0xbd5399['use']('/api/sms/messages',require(_0x6a24('0x53')));_0xbd5399[_0x6a24('0x8')]('/api/sms/queues',require('./api/smsQueue'));_0xbd5399['use']('/api/openchannel/accounts',require(_0x6a24('0x54')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x55'),require('./api/openchannelApplication'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x56'),require(_0x6a24('0x57')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x58'),require(_0x6a24('0x59')));_0xbd5399['use'](_0x6a24('0x5a'),require(_0x6a24('0x5b')));_0xbd5399[_0x6a24('0x8')]('/api/chat/websites',require('./api/chatWebsite'));_0xbd5399[_0x6a24('0x8')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x5c'),require(_0x6a24('0x5d')));_0xbd5399['use'](_0x6a24('0x5e'),require(_0x6a24('0x5f')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x60'),require(_0x6a24('0x61')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x62'),require(_0x6a24('0x63')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x64'),require(_0x6a24('0x65')));_0xbd5399['use'](_0x6a24('0x66'),require('./api/chatGroup'));_0xbd5399[_0x6a24('0x8')]('/api/chat/proactive_actions',require(_0x6a24('0x67')));_0xbd5399[_0x6a24('0x8')]('/api/cm/companies',require('./api/cmCompany'));_0xbd5399[_0x6a24('0x8')]('/api/cm/contacts',require(_0x6a24('0x68')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x69'),require('./api/cmHopper'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x6a'),require('./api/cmHopperBlack'));_0xbd5399['use'](_0x6a24('0x6b'),require('./api/cmHopperFinal'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x6c'),require(_0x6a24('0x6d')));_0xbd5399['use'](_0x6a24('0x6e'),require(_0x6a24('0x6f')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x70'),require(_0x6a24('0x71')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x72'),require('./api/automation'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x73'),require(_0x6a24('0x74')));_0xbd5399['use']('/api/dispositions',require(_0x6a24('0x75')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x76'),require(_0x6a24('0x77')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x78'),require('./api/interval'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x79'),require(_0x6a24('0x7a')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x7b'),require('./api/cdr'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x7c'),require(_0x6a24('0x7d')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x7e'),require(_0x6a24('0x7f')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x80'),require(_0x6a24('0x81')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x82'),require('./api/tag'));_0xbd5399[_0x6a24('0x8')]('/api/templates',require(_0x6a24('0x83')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x84'),require('./api/trigger'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x85'),require(_0x6a24('0x86')));_0xbd5399[_0x6a24('0x8')]('/api/integrations',require(_0x6a24('0x87')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x88'),require(_0x6a24('0x89')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x8a'),require('./api/analyticCustomReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x8b'),require(_0x6a24('0x8c')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x8d'),require('./api/analyticExtractedReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x8e'),require('./api/analyticMetric'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x8f'),require('./api/analyticFieldReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x90'),require(_0x6a24('0x91')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x92'),require(_0x6a24('0x93')));_0xbd5399['use'](_0x6a24('0x94'),require(_0x6a24('0x95')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x96'),require(_0x6a24('0x97')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x98'),require(_0x6a24('0x99')));_0xbd5399['use'](_0x6a24('0x9a'),require('./api/intSugarcrmConfiguration'));_0xbd5399['use']('/api/integrations/sugarcrm/fields',require(_0x6a24('0x9b')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x9c'),require(_0x6a24('0x9d')));_0xbd5399['use'](_0x6a24('0x9e'),require(_0x6a24('0x9f')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xa0'),require('./api/intDeskField'));_0xbd5399[_0x6a24('0x8')]('/api/integrations/zoho/accounts',require(_0x6a24('0xa1')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xa2'),require('./api/intZohoConfiguration'));_0xbd5399['use'](_0x6a24('0xa3'),require(_0x6a24('0xa4')));_0xbd5399['use'](_0x6a24('0xa5'),require(_0x6a24('0xa6')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xa7'),require(_0x6a24('0xa8')));_0xbd5399['use']('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xa9'),require(_0x6a24('0xaa')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xab'),require('./api/intFreshdeskConfiguration'));_0xbd5399[_0x6a24('0x8')]('/api/integrations/freshdesk/fields',require(_0x6a24('0xac')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xad'),require('./api/intVtigerAccount'));_0xbd5399[_0x6a24('0x8')]('/api/integrations/vtiger/configurations',require(_0x6a24('0xae')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xaf'),require('./api/intVtigerField'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xb0'),require('./api/intServicenowAccount'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xb1'),require('./api/intServicenowConfiguration'));_0xbd5399['use']('/api/integrations/servicenow/fields',require(_0x6a24('0xb2')));_0xbd5399[_0x6a24('0x8')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xb3'),require(_0x6a24('0xb4')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xb5'),require('./api/intDynamics365Field'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xb6'),require('./api/intFreshsalesAccount'));_0xbd5399['use']('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0xbd5399[_0x6a24('0x8')]('/api/integrations/freshsales/fields',require(_0x6a24('0xb7')));_0xbd5399['use'](_0x6a24('0xb8'),require(_0x6a24('0xb9')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xba'),require(_0x6a24('0xbb')));_0xbd5399['use'](_0x6a24('0xbc'),require(_0x6a24('0xbd')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xbe'),require(_0x6a24('0xbf')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xc0'),require(_0x6a24('0xc1')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xc2'),require(_0x6a24('0xc3')));_0xbd5399[_0x6a24('0x8')]('/api/sms/reports/queue',require(_0x6a24('0xc4')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xc5'),require(_0x6a24('0xc6')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xc7'),require(_0x6a24('0xc8')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xc9'),require(_0x6a24('0xca')));_0xbd5399['use'](_0x6a24('0xcb'),require('./api/setting'));_0xbd5399['use'](_0x6a24('0xcc'),require(_0x6a24('0xcd')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xce'),require(_0x6a24('0xcf')));_0xbd5399['use'](_0x6a24('0xd0'),require('./api/squareRecording'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xd1'),require(_0x6a24('0xd2')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xd3'),require('./api/team'));_0xbd5399['use']('/api/license',require(_0x6a24('0xd4')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xd5'),require(_0x6a24('0xd6')));_0xbd5399[_0x6a24('0x8')]('/api/migrations',require(_0x6a24('0xd7')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xd8'),require('./api/attachment'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xd9'),require(_0x6a24('0xda')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xdb'),require(_0x6a24('0xdc')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xdd'),require(_0x6a24('0xde')));_0xbd5399['use']('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xdf'),require(_0x6a24('0xe0')));_0xbd5399[_0x6a24('0x8')]('/api/sms/reports/transfer',require(_0x6a24('0xe1')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xe2'),require(_0x6a24('0xe3')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xe4'),require(_0x6a24('0xe5')));_0xbd5399[_0x6a24('0x8')]('/api/userProfiles',require(_0x6a24('0xe6')));_0xbd5399['use'](_0x6a24('0xe7'),require(_0x6a24('0xe8')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xe9'),require(_0x6a24('0xea')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xeb'),require('./api/userNotification'));_0xbd5399[_0x6a24('0x8')]('/api/whatsapp/accounts',require(_0x6a24('0xec')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xed'),require(_0x6a24('0xee')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xef'),require(_0x6a24('0xf0')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xf1'),require('./api/whatsappMessage'));_0xbd5399['use'](_0x6a24('0xf2'),require('./api/whatsappQueueReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xf3'),require('./api/whatsappTransferReport'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xf4'),require('./api/whatsappQueue'));_0xbd5399[_0x6a24('0x8')]('/api/cloudProviders',require(_0x6a24('0xf5')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xf6'),require(_0x6a24('0xf7')));_0xbd5399[_0x6a24('0x8')]('/api/auth/local',require(_0x6a24('0xf8')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xf9'),require(_0x6a24('0xfa')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xfb'),require('./api/jira'));_0xbd5399['use'](_0x6a24('0xfc'),require('./api/rpc'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0xfd'),require('./api/version'));_0xbd5399['use'](_0x6a24('0xfe'),require(_0x6a24('0xff')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x100'),require('./api/pm2'));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x101'),require(_0x6a24('0x102')));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x103'),express[_0x6a24('0x104')](path[_0x6a24('0x105')](config[_0x6a24('0x106')],_0x6a24('0x103'))));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x107'),express['static'](path[_0x6a24('0x105')](config['root'],_0x6a24('0x107'))));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x108'),express[_0x6a24('0x104')](path[_0x6a24('0x105')](config[_0x6a24('0x106')],_0x6a24('0x108'))));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x109'),express[_0x6a24('0x104')](path[_0x6a24('0x105')](config[_0x6a24('0x106')],'snippet',_0x6a24('0x10a'))));_0xbd5399[_0x6a24('0x8')](_0x6a24('0x10b'),express[_0x6a24('0x104')](path[_0x6a24('0x105')](config[_0x6a24('0x106')],'/server/files/plugins')));_0xbd5399[_0x6a24('0x10c')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x6a24('0x10d')](errors[0x194]);_0xbd5399['route']('/*')[_0x6a24('0x10d')](function(_0x59512e,_0xc390a){_0xc390a[_0x6a24('0x10e')](path['resolve'](_0xbd5399[_0x6a24('0x10d')](_0x6a24('0x10f'))+_0x6a24('0x110')));});};var sensitiveFields=[_0x6a24('0x111'),_0x6a24('0x112'),_0x6a24('0x113'),_0x6a24('0x114'),_0x6a24('0x115'),_0x6a24('0x116'),'street',_0x6a24('0x117'),_0x6a24('0x118'),_0x6a24('0x119'),'email',_0x6a24('0x11a'),'clientSecret',_0x6a24('0x11b'),_0x6a24('0x11c'),_0x6a24('0x11d'),'tenantId',_0x6a24('0x11e'),_0x6a24('0x11f'),_0x6a24('0x120'),_0x6a24('0x121'),'authToken',_0x6a24('0x122'),_0x6a24('0x123'),_0x6a24('0x124'),_0x6a24('0x125'),'calleridnum',_0x6a24('0x126'),'vidaooApiKey',_0x6a24('0x127'),_0x6a24('0x128'),'accesskeyid',_0x6a24('0x129'),'key',_0x6a24('0x12'),_0x6a24('0x12a'),_0x6a24('0x12b'),_0x6a24('0x12c'),'dsn',_0x6a24('0x12d'),'registry',_0x6a24('0x12e')];function maskSensitiveData(_0x1bc1f5){var _0x3794fd=/(?!^)[\s\S](?!$)/g;if(!_[_0x6a24('0x12f')](_0x1bc1f5))return;for(var _0x15e4f9 in _0x1bc1f5){if(_[_0x6a24('0x130')](_0x1bc1f5[_0x15e4f9])){for(var _0x127e9f=0x0;_0x127e9f<_0x1bc1f5[_0x15e4f9][_0x6a24('0x131')];_0x127e9f++){maskSensitiveData(_0x1bc1f5[_0x15e4f9][_0x127e9f]);}}else if(_[_0x6a24('0x12f')](_0x1bc1f5[_0x15e4f9])){maskSensitiveData(_0x1bc1f5[_0x15e4f9]);}else if(_[_0x6a24('0x132')](_0x1bc1f5[_0x15e4f9])){_0x1bc1f5[_0x15e4f9]=_0x1bc1f5[_0x15e4f9][_0x6a24('0x133')](/{{{/g,_0x6a24('0x134'))[_0x6a24('0x133')](/}}}/g,_0x6a24('0x135'))[_0x6a24('0x133')](/{{/g,'@{')[_0x6a24('0x133')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x15e4f9)){_0x1bc1f5[_0x15e4f9]=_0x1bc1f5[_0x15e4f9][_0x6a24('0x133')](_0x3794fd,'*');}}}} \ No newline at end of file +var _0x95da=['/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/jscriptyProject','/api/settings','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','/api/campaigns','/api/migrations','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/chatTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/jira','/api/rpc','./api/rpc','./api/version','./api/system','./api/pm2','/api/webbar','/apidoc','static','join','/www','root','/demo','/snippet','3.0.0','/plugins','route','get','sendFile','resolve','/index.html','username','password','newPassword','apiKey','firstName','lastName','street','mobile','fax','clientSecret','securityToken','code','accessKey','tenantId','token','authToken','consumerKey','membername','calleridname','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','secret','oldPassword','isArray','length','isPlainObject','replace','@@{','}@@','includes','lodash','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','auth','default','use','logger','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','user','name','role','inspect','agent_id','responseTime','device','agent_name','test','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/schedule','./api/sound','/api/tags','./api/tag','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration'];(function(_0x3f1c7d,_0x5c9556){var _0x3ca093=function(_0x5f3a89){while(--_0x5f3a89){_0x3f1c7d['push'](_0x3f1c7d['shift']());}};_0x3ca093(++_0x5c9556);}(_0x95da,0x95));var _0xa95d=function(_0x5a3e66,_0x3ee9bd){_0x5a3e66=_0x5a3e66-0x0;var _0x46764b=_0x95da[_0x5a3e66];return _0x46764b;};'use strict';var _=require(_0xa95d('0x0'));var path=require(_0xa95d('0x1'));var express=require(_0xa95d('0x2'));var ewinston=require(_0xa95d('0x3'));var util=require(_0xa95d('0x4'));var errors=require(_0xa95d('0x5'));var config=require(_0xa95d('0x6'));var logger=require(_0xa95d('0x7'))(_0xa95d('0x8'));var authLogger=require('./config/logger')(_0xa95d('0x9'));exports[_0xa95d('0xa')]=function(_0x2ffc38){_0x2ffc38[_0xa95d('0xb')](ewinston[_0xa95d('0xc')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x252143,_0x429494){var _0x36ae22='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x252143[_0xa95d('0xd')])){_0x36ae22+=_0xa95d('0xe');var _0x1cf84d=_0x252143[_0xa95d('0xd')];maskSensitiveData(_0x1cf84d);}return util[_0xa95d('0xf')](_0x36ae22,_0x252143[_0xa95d('0x10')],_0x252143[_0xa95d('0x11')][_0xa95d('0x12')]?_0x252143[_0xa95d('0x11')]['x-forwarded-for']:_0x252143[_0xa95d('0x13')][_0xa95d('0x14')]||_0x252143['ip'],_0x252143[_0xa95d('0x15')],_0x429494[_0xa95d('0x16')],_0x429494['responseTime'],_0x252143[_0xa95d('0x17')]?_0x252143['user']['id']:null,_0x252143[_0xa95d('0x17')]?_0x252143[_0xa95d('0x17')][_0xa95d('0x18')]:null,_0x252143['user']?_0x252143[_0xa95d('0x17')][_0xa95d('0x19')]:null,_0x1cf84d?util[_0xa95d('0x1a')](_0x1cf84d,![],null):'');}}));_0x2ffc38[_0xa95d('0xb')](ewinston[_0xa95d('0xc')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2a9ee9,_0x498b85){var _0x2c96ca='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x2a9ee9['body']&&_0x2a9ee9['body']['device']&&_0x2a9ee9[_0xa95d('0xd')][_0xa95d('0x1b')]){_0x2c96ca='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xa95d('0xf')](_0x2c96ca,_0x2a9ee9[_0xa95d('0x10')],_0x2a9ee9['headers'][_0xa95d('0x12')]?_0x2a9ee9[_0xa95d('0x11')][_0xa95d('0x12')]:_0x2a9ee9['connection'][_0xa95d('0x14')]||_0x2a9ee9['ip'],_0x2a9ee9['url'],_0x498b85[_0xa95d('0x16')],_0x498b85[_0xa95d('0x1c')],_0x2a9ee9[_0xa95d('0x17')]?_0x2a9ee9[_0xa95d('0x17')]['id']:null,_0x2a9ee9['user']?_0x2a9ee9[_0xa95d('0x17')][_0xa95d('0x18')]:null,_0x2a9ee9[_0xa95d('0x17')]?_0x2a9ee9['user'][_0xa95d('0x19')]:null,_0x2a9ee9[_0xa95d('0xd')]&&_0x2a9ee9[_0xa95d('0xd')][_0xa95d('0x1d')]?_0x2a9ee9[_0xa95d('0xd')][_0xa95d('0x1d')]:'other',_0x2a9ee9[_0xa95d('0xd')]&&_0x2a9ee9[_0xa95d('0xd')][_0xa95d('0x1b')]?_0x2a9ee9[_0xa95d('0xd')][_0xa95d('0x1b')]:'',_0x2a9ee9['body']&&_0x2a9ee9[_0xa95d('0xd')][_0xa95d('0x1e')]?_0x2a9ee9['body'][_0xa95d('0x1e')]:'');},'ignoreRoute':function(_0x305171){var _0x3c8887=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3c8887[_0xa95d('0x1f')](_0x305171[_0xa95d('0x15')]);}}));_0x2ffc38['use'](_0xa95d('0x20'),require(_0xa95d('0x21')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x22'),require('./api/voiceChanSpy'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x23'),require('./api/voiceContext'));_0x2ffc38['use'](_0xa95d('0x24'),require(_0xa95d('0x25')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x26'),require(_0xa95d('0x27')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x28'),require(_0xa95d('0x29')));_0x2ffc38['use'](_0xa95d('0x2a'),require(_0xa95d('0x2b')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x2c'),require(_0xa95d('0x2d')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x2e'),require(_0xa95d('0x2f')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x30'),require(_0xa95d('0x31')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x32'),require(_0xa95d('0x33')));_0x2ffc38[_0xa95d('0xb')]('/api/voice/dials/reports',require(_0xa95d('0x34')));_0x2ffc38['use'](_0xa95d('0x35'),require(_0xa95d('0x36')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x37'),require('./api/voiceQueueReport'));_0x2ffc38['use'](_0xa95d('0x38'),require('./api/memberReport'));_0x2ffc38['use'](_0xa95d('0x39'),require(_0xa95d('0x3a')));_0x2ffc38['use'](_0xa95d('0x3b'),require('./api/voiceTransferReport'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x3c'),require(_0xa95d('0x3d')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x3e'),require('./api/mailAccount'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x3f'),require(_0xa95d('0x40')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x41'),require(_0xa95d('0x42')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x43'),require(_0xa95d('0x44')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x45'),require(_0xa95d('0x46')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x47'),require(_0xa95d('0x48')));_0x2ffc38['use']('/api/mail/reports/queue',require(_0xa95d('0x49')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x4a'),require(_0xa95d('0x4b')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x4c'),require(_0xa95d('0x4d')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x4e'),require(_0xa95d('0x4f')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x50'),require(_0xa95d('0x51')));_0x2ffc38[_0xa95d('0xb')]('/api/fax/interactions',require(_0xa95d('0x52')));_0x2ffc38['use'](_0xa95d('0x53'),require('./api/faxMessage'));_0x2ffc38['use'](_0xa95d('0x54'),require(_0xa95d('0x55')));_0x2ffc38['use']('/api/fax/reports/queue',require(_0xa95d('0x56')));_0x2ffc38[_0xa95d('0xb')]('/api/sms/accounts',require(_0xa95d('0x57')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x58'),require(_0xa95d('0x59')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x5a'),require(_0xa95d('0x5b')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x5c'),require(_0xa95d('0x5d')));_0x2ffc38[_0xa95d('0xb')]('/api/sms/queues',require(_0xa95d('0x5e')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x5f'),require('./api/openchannelAccount'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x60'),require(_0xa95d('0x61')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x62'),require(_0xa95d('0x63')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x64'),require(_0xa95d('0x65')));_0x2ffc38['use'](_0xa95d('0x66'),require(_0xa95d('0x67')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x68'),require('./api/chatWebsite'));_0x2ffc38['use']('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x69'),require(_0xa95d('0x6a')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x6b'),require(_0xa95d('0x6c')));_0x2ffc38[_0xa95d('0xb')]('/api/chat/messages',require(_0xa95d('0x6d')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x6e'),require(_0xa95d('0x6f')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x70'),require(_0xa95d('0x71')));_0x2ffc38[_0xa95d('0xb')]('/api/chat/groups',require(_0xa95d('0x72')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x73'),require(_0xa95d('0x74')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x75'),require(_0xa95d('0x76')));_0x2ffc38[_0xa95d('0xb')]('/api/cm/contacts',require(_0xa95d('0x77')));_0x2ffc38['use'](_0xa95d('0x78'),require(_0xa95d('0x79')));_0x2ffc38[_0xa95d('0xb')]('/api/cm/hopper_black',require(_0xa95d('0x7a')));_0x2ffc38['use'](_0xa95d('0x7b'),require(_0xa95d('0x7c')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x7d'),require(_0xa95d('0x7e')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x7f'),require('./api/cmCustomField'));_0x2ffc38['use'](_0xa95d('0x80'),require(_0xa95d('0x81')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x82'),require(_0xa95d('0x83')));_0x2ffc38[_0xa95d('0xb')]('/api/canned_answers',require('./api/cannedAnswer'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x84'),require(_0xa95d('0x85')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x86'),require('./api/condition'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x87'),require('./api/interval'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x88'),require(_0xa95d('0x89')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x8a'),require('./api/cdr'));_0x2ffc38['use'](_0xa95d('0x8b'),require('./api/voiceQueuesLog'));_0x2ffc38[_0xa95d('0xb')]('/api/schedules',require(_0xa95d('0x8c')));_0x2ffc38['use']('/api/sounds',require(_0xa95d('0x8d')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x8e'),require(_0xa95d('0x8f')));_0x2ffc38[_0xa95d('0xb')]('/api/templates',require(_0xa95d('0x90')));_0x2ffc38['use'](_0xa95d('0x91'),require(_0xa95d('0x92')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x93'),require(_0xa95d('0x94')));_0x2ffc38['use'](_0xa95d('0x95'),require(_0xa95d('0x96')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x97'),require(_0xa95d('0x98')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x99'),require('./api/analyticCustomReport'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x9a'),require(_0xa95d('0x9b')));_0x2ffc38['use']('/api/analytics/extracted_reports',require(_0xa95d('0x9c')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x9d'),require(_0xa95d('0x9e')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x9f'),require(_0xa95d('0xa0')));_0x2ffc38['use']('/api/analytics/tree_reports',require(_0xa95d('0xa1')));_0x2ffc38['use'](_0xa95d('0xa2'),require(_0xa95d('0xa3')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xa4'),require('./api/intSalesforceConfiguration'));_0x2ffc38['use']('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xa5'),require(_0xa95d('0xa6')));_0x2ffc38[_0xa95d('0xb')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x2ffc38['use']('/api/integrations/sugarcrm/fields',require(_0xa95d('0xa7')));_0x2ffc38[_0xa95d('0xb')]('/api/integrations/desk/accounts',require(_0xa95d('0xa8')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xa9'),require(_0xa95d('0xaa')));_0x2ffc38['use'](_0xa95d('0xab'),require(_0xa95d('0xac')));_0x2ffc38['use'](_0xa95d('0xad'),require(_0xa95d('0xae')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xaf'),require('./api/intZohoConfiguration'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xb0'),require('./api/intZohoField'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xb1'),require(_0xa95d('0xb2')));_0x2ffc38['use']('/api/integrations/zendesk/configurations',require(_0xa95d('0xb3')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xb4'),require('./api/intZendeskField'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xb5'),require(_0xa95d('0xb6')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xb7'),require(_0xa95d('0xb8')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xb9'),require(_0xa95d('0xba')));_0x2ffc38['use'](_0xa95d('0xbb'),require(_0xa95d('0xbc')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xbd'),require(_0xa95d('0xbe')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xbf'),require(_0xa95d('0xc0')));_0x2ffc38[_0xa95d('0xb')]('/api/integrations/servicenow/accounts',require(_0xa95d('0xc1')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xc2'),require('./api/intServicenowConfiguration'));_0x2ffc38[_0xa95d('0xb')]('/api/integrations/servicenow/fields',require(_0xa95d('0xc3')));_0x2ffc38['use'](_0xa95d('0xc4'),require(_0xa95d('0xc5')));_0x2ffc38['use'](_0xa95d('0xc6'),require('./api/intDynamics365Configuration'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xc7'),require(_0xa95d('0xc8')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xc9'),require('./api/intFreshsalesAccount'));_0x2ffc38['use'](_0xa95d('0xca'),require(_0xa95d('0xcb')));_0x2ffc38['use']('/api/integrations/freshsales/fields',require(_0xa95d('0xcc')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xcd'),require(_0xa95d('0xce')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xcf'),require('./api/chatQueueReport'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xd0'),require('./api/chatInternalMessage'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xd1'),require(_0xa95d('0xd2')));_0x2ffc38[_0xa95d('0xb')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xd3'),require(_0xa95d('0xd4')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xd5'),require(_0xa95d('0xd6')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xd7'),require('./api/squareReport'));_0x2ffc38['use'](_0xa95d('0xd8'),require('./api/squareReportDetail'));_0x2ffc38[_0xa95d('0xb')]('/api/jscripty/projects',require(_0xa95d('0xd9')));_0x2ffc38['use'](_0xa95d('0xda'),require('./api/setting'));_0x2ffc38[_0xa95d('0xb')]('/api/square/odbc',require('./api/squareOdbc'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xdb'),require(_0xa95d('0xdc')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xdd'),require(_0xa95d('0xde')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xdf'),require(_0xa95d('0xe0')));_0x2ffc38[_0xa95d('0xb')]('/api/teams',require(_0xa95d('0xe1')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xe2'),require('./api/license'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xe3'),require('./api/campaign'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xe4'),require('./api/migration'));_0x2ffc38[_0xa95d('0xb')]('/api/attachments',require(_0xa95d('0xe5')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xe6'),require(_0xa95d('0xe7')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xe8'),require('./api/mailTransferReport'));_0x2ffc38['use']('/api/chat/reports/transfer',require(_0xa95d('0xe9')));_0x2ffc38[_0xa95d('0xb')]('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xea'),require(_0xa95d('0xeb')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xec'),require(_0xa95d('0xed')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xee'),require(_0xa95d('0xef')));_0x2ffc38[_0xa95d('0xb')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x2ffc38['use'](_0xa95d('0xf0'),require(_0xa95d('0xf1')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xf2'),require(_0xa95d('0xf3')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xf4'),require('./api/userProfileResource'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xf5'),require('./api/userNotification'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xf6'),require(_0xa95d('0xf7')));_0x2ffc38[_0xa95d('0xb')]('/api/whatsapp/applications',require(_0xa95d('0xf8')));_0x2ffc38['use']('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xf9'),require(_0xa95d('0xfa')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xfb'),require(_0xa95d('0xfc')));_0x2ffc38[_0xa95d('0xb')]('/api/whatsapp/reports/transfer',require(_0xa95d('0xfd')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0xfe'),require('./api/whatsappQueue'));_0x2ffc38['use'](_0xa95d('0xff'),require('./api/cloudProvider'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x100'),require(_0xa95d('0x101')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x102'),require(_0xa95d('0x103')));_0x2ffc38['use'](_0xa95d('0x104'),require('./api/authGoogle'));_0x2ffc38[_0xa95d('0xb')]('/api/jira',require(_0xa95d('0x105')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x106'),require(_0xa95d('0x107')));_0x2ffc38[_0xa95d('0xb')]('/api/version',require(_0xa95d('0x108')));_0x2ffc38[_0xa95d('0xb')]('/api/system',require(_0xa95d('0x109')));_0x2ffc38['use']('/api/pm2',require(_0xa95d('0x10a')));_0x2ffc38['use'](_0xa95d('0x10b'),require('./api/webbar'));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x10c'),express[_0xa95d('0x10d')](path[_0xa95d('0x10e')](config['root'],'/apidoc')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x10f'),express[_0xa95d('0x10d')](path['join'](config[_0xa95d('0x110')],'/www')));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x111'),express[_0xa95d('0x10d')](path['join'](config[_0xa95d('0x110')],_0xa95d('0x111'))));_0x2ffc38['use'](_0xa95d('0x112'),express[_0xa95d('0x10d')](path[_0xa95d('0x10e')](config[_0xa95d('0x110')],'snippet',_0xa95d('0x113'))));_0x2ffc38[_0xa95d('0xb')](_0xa95d('0x114'),express['static'](path[_0xa95d('0x10e')](config[_0xa95d('0x110')],'/server/files/plugins')));_0x2ffc38[_0xa95d('0x115')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xa95d('0x116')](errors[0x194]);_0x2ffc38[_0xa95d('0x115')]('/*')[_0xa95d('0x116')](function(_0x1faaf8,_0x471558){_0x471558[_0xa95d('0x117')](path[_0xa95d('0x118')](_0x2ffc38['get']('appPath')+_0xa95d('0x119')));});};var sensitiveFields=[_0xa95d('0x11a'),_0xa95d('0x11b'),_0xa95d('0x11c'),_0xa95d('0x11d'),_0xa95d('0x11e'),_0xa95d('0x11f'),_0xa95d('0x120'),'phone',_0xa95d('0x121'),_0xa95d('0x122'),'email','clientId',_0xa95d('0x123'),_0xa95d('0x124'),_0xa95d('0x125'),_0xa95d('0x126'),_0xa95d('0x127'),_0xa95d('0x128'),'channelSecret','accessToken','accessTokenSecret',_0xa95d('0x129'),_0xa95d('0x12a'),'consumerSecret',_0xa95d('0x12b'),_0xa95d('0x12c'),_0xa95d('0x12d'),_0xa95d('0x12e'),'vidaooApiKey',_0xa95d('0x12f'),_0xa95d('0x130'),_0xa95d('0x131'),_0xa95d('0x132'),_0xa95d('0x133'),'user',_0xa95d('0x134'),_0xa95d('0x135'),_0xa95d('0x136'),'dsn',_0xa95d('0x137'),'registry',_0xa95d('0x138')];function maskSensitiveData(_0x1b3448){var _0x2beb9a=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x1b3448))return;for(var _0x313988 in _0x1b3448){if(_[_0xa95d('0x139')](_0x1b3448[_0x313988])){for(var _0x3668de=0x0;_0x3668de<_0x1b3448[_0x313988][_0xa95d('0x13a')];_0x3668de++){maskSensitiveData(_0x1b3448[_0x313988][_0x3668de]);}}else if(_[_0xa95d('0x13b')](_0x1b3448[_0x313988])){maskSensitiveData(_0x1b3448[_0x313988]);}else if(_['isString'](_0x1b3448[_0x313988])){_0x1b3448[_0x313988]=_0x1b3448[_0x313988][_0xa95d('0x13c')](/{{{/g,_0xa95d('0x13d'))['replace'](/}}}/g,_0xa95d('0x13e'))['replace'](/{{/g,'@{')[_0xa95d('0x13c')](/}}/g,'}@');if(_[_0xa95d('0x13f')](sensitiveFields,_0x313988)){_0x1b3448[_0x313988]=_0x1b3448[_0x313988]['replace'](_0x2beb9a,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 16e1636..9ad2c3f 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfef6=['../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','port','rpc','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','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/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc'];(function(_0x1fed08,_0x9fb6b4){var _0x5a3466=function(_0x3971b0){while(--_0x3971b0){_0x1fed08['push'](_0x1fed08['shift']());}};_0x5a3466(++_0x9fb6b4);}(_0xfef6,0x95));var _0x6fef=function(_0x4b5a9e,_0x467811){_0x4b5a9e=_0x4b5a9e-0x0;var _0x1c2d77=_0xfef6[_0x4b5a9e];return _0x1c2d77;};'use strict';var jayson=require(_0x6fef('0x0'));var BPromise=require(_0x6fef('0x1'));var _=require(_0x6fef('0x2'));var config=require(_0x6fef('0x3'));exports['listen']=function(){return new BPromise(function(_0xd96f6c,_0x4eba83){var _0x2f8c51={};_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x5')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x6')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x7')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x8')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x9')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0xa')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0xb')));_0x2f8c51=_['merge'](_0x2f8c51,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0xc')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/trunk/trunk.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0xd')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0xe')));_0x2f8c51=_['merge'](_0x2f8c51,require('../api/mailAccount/mailAccount.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0xf')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x10')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x11')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x12')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x13')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x14')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/faxApplication/faxApplication.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x15')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x16')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/faxQueue/faxQueue.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x2f8c51=_['merge'](_0x2f8c51,require('../api/smsAccount/smsAccount.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/smsInteraction/smsInteraction.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x17')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/smsQueue/smsQueue.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x18')));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x19')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/chatMessage/chatMessage.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x1a')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x1b')));_0x2f8c51=_['merge'](_0x2f8c51,require('../api/cmHopper/cmHopper.rpc'));_0x2f8c51=_['merge'](_0x2f8c51,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x1c')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x1d')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x1e')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x1f')));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x20')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x21')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x22')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x23')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/variable/variable.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x24')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x25')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x26')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x27')));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x28')));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x29')));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x2a')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x2b')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x2c')));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x2d')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x2e')));_0x2f8c51=_['merge'](_0x2f8c51,require('../api/setting/setting.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x2f')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/squareProject/squareProject.rpc'));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x30')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x31')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x32')));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x33')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/plugin/plugin.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x34')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x35')));_0x2f8c51=_[_0x6fef('0x4')](_0x2f8c51,require(_0x6fef('0x36')));_0x2f8c51=_['merge'](_0x2f8c51,require(_0x6fef('0x37')));var _0x4589c6=jayson['server'](_0x2f8c51)[_0x6fef('0x38')]();var _0x1108df=config['rpc']['port']||config[_0x6fef('0x39')]+0x1;var _0x551349=config[_0x6fef('0x3a')]['ip']||'localhost';_0x4589c6['on'](_0x6fef('0x3b'),function(_0x528b0a){return _0x4eba83(_0x528b0a);});_0x4589c6[_0x6fef('0x3c')](_0x1108df,_0x551349,function(){console[_0x6fef('0x3d')](_0x6fef('0x3e'),_0x551349,_0x1108df);require(_0x6fef('0x3f'))['default']();return _0xd96f6c(_0x6fef('0x40')+_0x551349+':'+_0x1108df);});});}; \ No newline at end of file +var _0x3741=['../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','listen','merge','../api/user/user.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3741,0x6b));var _0x1374=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0x3741[_0x2300c7];return _0x23f720;};'use strict';var jayson=require(_0x1374('0x0'));var BPromise=require(_0x1374('0x1'));var _=require(_0x1374('0x2'));var config=require('../config/environment');exports[_0x1374('0x3')]=function(){return new BPromise(function(_0x1aceec,_0x52a494){var _0x558de3={};_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x5')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require('../api/voiceExtension/voiceExtension.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require('../api/voiceQueue/voiceQueue.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x6')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x7')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x8')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x9')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0xa')));_0x558de3=_['merge'](_0x558de3,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0xb')));_0x558de3=_['merge'](_0x558de3,require(_0x1374('0xc')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0xd')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0xe')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0xf')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x10')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x11')));_0x558de3=_['merge'](_0x558de3,require(_0x1374('0x12')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require('../api/faxAccount/faxAccount.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x13')));_0x558de3=_['merge'](_0x558de3,require(_0x1374('0x14')));_0x558de3=_['merge'](_0x558de3,require('../api/faxMessage/faxMessage.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x15')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x16')));_0x558de3=_['merge'](_0x558de3,require('../api/smsAccount/smsAccount.rpc'));_0x558de3=_['merge'](_0x558de3,require(_0x1374('0x17')));_0x558de3=_['merge'](_0x558de3,require(_0x1374('0x18')));_0x558de3=_['merge'](_0x558de3,require(_0x1374('0x19')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x1a')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x1b')));_0x558de3=_['merge'](_0x558de3,require(_0x1374('0x1c')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x1d')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x1e')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require('../api/chatInteraction/chatInteraction.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x1f')));_0x558de3=_['merge'](_0x558de3,require(_0x1374('0x20')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require('../api/cmContact/cmContact.rpc'));_0x558de3=_['merge'](_0x558de3,require(_0x1374('0x21')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x22')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x23')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x24')));_0x558de3=_['merge'](_0x558de3,require(_0x1374('0x25')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require('../api/sound/sound.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x26')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require('../api/trigger/trigger.rpc'));_0x558de3=_['merge'](_0x558de3,require('../api/variable/variable.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x27')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x28')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x29')));_0x558de3=_['merge'](_0x558de3,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x2a')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x2b')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x2c')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x2d')));_0x558de3=_['merge'](_0x558de3,require(_0x1374('0x2e')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x2f')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x30')));_0x558de3=_['merge'](_0x558de3,require(_0x1374('0x31')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require('../api/setting/setting.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require('../api/squareOdbc/squareOdbc.rpc'));_0x558de3=_['merge'](_0x558de3,require(_0x1374('0x32')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x33')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x34')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x35')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x36')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require('../api/plugin/plugin.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x37')));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x38')));_0x558de3=_['merge'](_0x558de3,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x558de3=_[_0x1374('0x4')](_0x558de3,require(_0x1374('0x39')));_0x558de3=_['merge'](_0x558de3,require(_0x1374('0x3a')));var _0x4637d8=jayson[_0x1374('0x3b')](_0x558de3)[_0x1374('0x3c')]();var _0x48fc75=config[_0x1374('0x3d')][_0x1374('0x3e')]||config[_0x1374('0x3e')]+0x1;var _0x51476e=config[_0x1374('0x3d')]['ip']||'localhost';_0x4637d8['on'](_0x1374('0x3f'),function(_0x10e516){return _0x52a494(_0x10e516);});_0x4637d8[_0x1374('0x3')](_0x48fc75,_0x51476e,function(){console['log'](_0x1374('0x40'),_0x51476e,_0x48fc75);require(_0x1374('0x41'))[_0x1374('0x42')]();return _0x1aceec(_0x1374('0x43')+_0x51476e+':'+_0x48fc75);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index a326f9f..ac4e26b 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 _0x33aa=['E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','prototype','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','sendRequest','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','setVariable','isBoolean','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','indexOf','substr','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout'];(function(_0x222165,_0x2c296e){var _0x1ee52d=function(_0x43f5c9){while(--_0x43f5c9){_0x222165['push'](_0x222165['shift']());}};_0x1ee52d(++_0x2c296e);}(_0x33aa,0xc9));var _0xa33a=function(_0x3d5f8a,_0x34a40b){_0x3d5f8a=_0x3d5f8a-0x0;var _0x15bf5b=_0x33aa[_0x3d5f8a];return _0x15bf5b;};'use strict';var util=require(_0xa33a('0x0'));var _=require(_0xa33a('0x1'));var EventEmitter=require(_0xa33a('0x2'))[_0xa33a('0x3')];var AGIReply=require(_0xa33a('0x4'));var AGIError=require(_0xa33a('0x5'));function AGIChannel(_0x2ffdd6){var _0x31060d=this,_0x530bf8=new AGIReply(),_0x5b8073=![],_0x1655fa={};EventEmitter[_0xa33a('0x6')](_0x31060d);_0x2ffdd6[_0xa33a('0x7')](_0xa33a('0x8'));_0x2ffdd6[_0xa33a('0x9')](0x8*0x3c*0x3c*0x3e8);_0x530bf8[_0xa33a('0x7')]('utf8');_0x530bf8['on']('headers',function(_0x4c5511){for(var _0x41eac5 in _0x4c5511){_0x31060d[_0x41eac5]=_0x4c5511[_0x41eac5];}_0x31060d[_0xa33a('0xa')]('ready');});_0x530bf8['on'](_0xa33a('0xb'),function(_0x4b2bd2){if(_0x4b2bd2[_0xa33a('0xc')]()==_0xa33a('0xd')){_0x31060d[_0xa33a('0xa')](_0xa33a('0xd'));return;}if(_0x4b2bd2[_0xa33a('0xe')](0x0,0xb)==_0xa33a('0xf')){_0x5b8073=!![];}if(_0x5b8073){_0x1655fa['rx']+=_0x4b2bd2+'\x0a';if(_0x4b2bd2[_0xa33a('0x10')](_0xa33a('0x11'))!=-0x1){_0x5b8073=![];}}else{_0x1655fa['rx']=_0x4b2bd2;}if(_0x5b8073){return;}if(typeof _0x1655fa['cb']==_0xa33a('0x12')){var _0x2db0b1=_0x1655fa['rx']['substring'](0x0,0x3),_0x1df689=null,_0x282f1b=null;_0x2db0b1=parseInt(_0x2db0b1);if(isNaN(_0x2db0b1)){_0x1655fa['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xa33a('0x13')});return;}if(_0x2db0b1!=0xc8){_0x1655fa['cb'](null,{'code':_0x2db0b1,'result':-0x1,'extra':'KO'});return;}_0x1df689=_0x1655fa['rx'][_0xa33a('0xe')](0x4)['replace']('result=','');if(_0x1df689[_0xa33a('0x14')]('\x20')!=-0x1){_0x1df689=_0x1df689[_0xa33a('0x15')](0x0,_0x1df689['indexOf']('\x20'));}if(_['startsWith'](_0x1df689,'-1')){_0x1df689=parseInt(_0x1df689);}_0x282f1b=_0x1655fa['rx']['split']('\x20');if(_0x282f1b[_0xa33a('0x16')]==0x3){_0x282f1b=_0x282f1b[0x2]['substring'](0x1,_0x282f1b[0x2][_0xa33a('0x16')]-0x1);}else if(_0x282f1b[_0xa33a('0x16')]>0x3){var _0x4087c8=/\((.+)\)/;var _0x31ec07=_0x1655fa['rx'][_0xa33a('0x17')](_0x4087c8);if(_0x31ec07){_0x282f1b=_0x31ec07[0x1];}else{_0x282f1b=null;}}else{_0x282f1b=null;}_0x1655fa['cb'](null,{'code':_0x2db0b1,'result':_0x1df689,'extra':_0x282f1b});}});_0x2ffdd6['on'](_0xa33a('0x18'),function(_0x951571){_0x31060d[_0xa33a('0xa')]('error',new AGIError(_0xa33a('0x19'),_0x951571[_0xa33a('0x1a')]));});_0x2ffdd6['on']('close',function(){_0x31060d[_0xa33a('0xa')](_0xa33a('0x1b'),new AGIError(_0xa33a('0x1c')));});_0x2ffdd6['on'](_0xa33a('0x1d'),function(){_0x31060d[_0xa33a('0xa')](_0xa33a('0x1d'),new AGIError(_0xa33a('0x1e')));_0x2ffdd6['destroy']();});_0x2ffdd6[_0xa33a('0x1f')](_0x530bf8);this[_0xa33a('0x20')]=function(_0x2fcb5a,_0x421771){var _0x2fcb5a=_0x2fcb5a||'',_0x421771=typeof _0x421771=='function'?_0x421771:new Function();_0x1655fa={'tx':_0x2fcb5a,'rx':'','cb':_0x421771};_0x2ffdd6[_0xa33a('0x21')](_0x2fcb5a+'\x0a');},this[_0xa33a('0x1b')]=function(){_0x2ffdd6[_0xa33a('0x22')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xa33a('0x23')]['sendRequest']=function(_0x1cd651){return this[_0xa33a('0x20')]['sync'](this,_0x1cd651);};AGIChannel[_0xa33a('0x23')]['answer']=function(){return this['sendRequest'](_0xa33a('0x24'));};AGIChannel[_0xa33a('0x23')][_0xa33a('0x25')]=function(_0xee59a6,_0x5090e4,_0x87c655){_0xee59a6=_0xee59a6===undefined?'beep':_0xee59a6;_0x5090e4=_0x5090e4===undefined?'5':_0x5090e4;_0x87c655=_0x87c655===undefined?'1':_0x87c655;return this['sendRequest'](util[_0xa33a('0x26')](_0xa33a('0x27'),_0xee59a6,_0x5090e4*0x3e8,_0x87c655));};AGIChannel[_0xa33a('0x23')]['noop']=function(_0x1f0af6){_0x1f0af6=_0x1f0af6||_0xa33a('0x28');return this[_0xa33a('0x29')](util[_0xa33a('0x26')](_0xa33a('0x2a'),_0x1f0af6));};AGIChannel['prototype'][_0xa33a('0x2b')]=function(_0x245ecc,_0x5745fb){if(_[_0xa33a('0x2c')](_0x5745fb)){return this[_0xa33a('0x29')](util[_0xa33a('0x26')](_0xa33a('0x2d'),_0x245ecc,_0x5745fb[_0xa33a('0x2e')](',')));}return this[_0xa33a('0x29')](util['format']('EXEC\x20%s\x20%s',_0x245ecc,_0x5745fb));};AGIChannel[_0xa33a('0x23')][_0xa33a('0x2f')]=function(_0x173001){return this['sendRequest'](util[_0xa33a('0x26')](_0xa33a('0x30'),_0x173001));};AGIChannel['prototype'][_0xa33a('0x31')]=function(_0x42c715){return this[_0xa33a('0x29')](util[_0xa33a('0x26')](_0xa33a('0x32'),_0x42c715));};AGIChannel['prototype']['setPriority']=function(_0x319b49){return this[_0xa33a('0x29')](util[_0xa33a('0x26')](_0xa33a('0x33'),_0x319b49));};AGIChannel[_0xa33a('0x23')][_0xa33a('0xd')]=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0xa33a('0x23')][_0xa33a('0x34')]=function(_0x24739e,_0x388750){var _0x103563=_[_0xa33a('0x35')](_0x388750)||_['isNumber'](_0x388750)?_0x388750[_0xa33a('0x36')]():_0x388750;return this['sendRequest'](util[_0xa33a('0x26')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x24739e,_0x103563?_0x103563[_0xa33a('0x36')]()[_0xa33a('0x37')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xa33a('0x38')]=function(_0x21222b,_0x1cd846){return this[_0xa33a('0x29')](util[_0xa33a('0x26')](_0xa33a('0x39'),_0x21222b,_0x1cd846));};AGIChannel[_0xa33a('0x23')][_0xa33a('0x3a')]=function(_0x469a79,_0xead1c2){return this[_0xa33a('0x29')](util['format'](_0xa33a('0x3b'),_0x469a79,_0xead1c2));};AGIChannel[_0xa33a('0x23')]['sayPhonetic']=function(_0x51b18e,_0x196485){return this[_0xa33a('0x29')](util['format'](_0xa33a('0x3c'),_0x51b18e,_0x196485));};AGIChannel[_0xa33a('0x23')][_0xa33a('0x3d')]=function(_0x182a83,_0x48d2a9,_0x1771e4){_0x48d2a9=_0x48d2a9||this[_0xa33a('0x3e')];_0x1771e4=_0x1771e4||0x1;this['setContext'](_0x182a83);this[_0xa33a('0x31')](_0x48d2a9);this['setPriority'](_0x1771e4);return this[_0xa33a('0x3f')](util[_0xa33a('0x26')](_0xa33a('0x40'),_0x182a83,_0x48d2a9,_0x1771e4));};AGIChannel[_0xa33a('0x23')][_0xa33a('0x41')]=function(_0x5a540e){return this['sendRequest'](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x5a540e));};AGIChannel[_0xa33a('0x23')][_0xa33a('0x42')]=function(_0x536c5e,_0x3cc299,_0x338583,_0x3fd52e,_0x43b097,_0x4d3540){_0x3cc299=_0x3cc299||_0xa33a('0x43');_0x338583=_0x338583||'';_0x3fd52e=_0x3fd52e===undefined?-0x1:_0x3fd52e==='-1'?-0x1:_0x3fd52e*0x3e8;_0x43b097=_0x43b097===undefined?'':'s='+_0x43b097;_0x4d3540=_0x4d3540?_0xa33a('0x44'):'';return this[_0xa33a('0x29')](util[_0xa33a('0x26')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x536c5e,_0x3cc299,_0x338583,_0x3fd52e,_0x4d3540,_0x43b097));};AGIChannel[_0xa33a('0x23')][_0xa33a('0x45')]=function(_0x58c02b,_0x46d2b6){_0x46d2b6=_0x46d2b6||'';return this['sendRequest'](util[_0xa33a('0x26')](_0xa33a('0x46'),_0x58c02b,_0x46d2b6));};AGIChannel['prototype'][_0xa33a('0x47')]=function(_0x5c8fe2){return this['exec'](_0xa33a('0x48'),_0x5c8fe2);};AGIChannel[_0xa33a('0x23')][_0xa33a('0x49')]=function(_0x2fd3c5){return this['exec']('WAIT',_0x2fd3c5);};AGIChannel[_0xa33a('0x23')][_0xa33a('0x18')]=function(_0x1eda10,_0x18e131){this[_0xa33a('0x3f')](util[_0xa33a('0x26')](_0xa33a('0x4a'),_0x1eda10['id'],_0x1eda10[_0xa33a('0x4b')],_0x18e131));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xa33a('0x4c')]=AGIChannel; \ No newline at end of file +var _0x8c1e=['sayDigits','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','label','exports','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','emit','ready','line','toLowerCase','hangup','substring','search','function','no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','command','sync','prototype','answer','sendRequest','ANSWER','getData','beep','format','noop','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s'];(function(_0x52c6ec,_0x2c76ea){var _0x571479=function(_0x4824b3){while(--_0x4824b3){_0x52c6ec['push'](_0x52c6ec['shift']());}};_0x571479(++_0x2c76ea);}(_0x8c1e,0x14c));var _0xe8c1=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x8c1e[_0x2d2c16];return _0x53f2fb;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require('events')[_0xe8c1('0x0')];var AGIReply=require(_0xe8c1('0x1'));var AGIError=require(_0xe8c1('0x2'));function AGIChannel(_0x657c53){var _0x4f128f=this,_0x216695=new AGIReply(),_0x3cc39a=![],_0x1262c0={};EventEmitter[_0xe8c1('0x3')](_0x4f128f);_0x657c53['setEncoding'](_0xe8c1('0x4'));_0x657c53[_0xe8c1('0x5')](0x8*0x3c*0x3c*0x3e8);_0x216695[_0xe8c1('0x6')](_0xe8c1('0x4'));_0x216695['on'](_0xe8c1('0x7'),function(_0x203bf9){for(var _0x2bc002 in _0x203bf9){_0x4f128f[_0x2bc002]=_0x203bf9[_0x2bc002];}_0x4f128f[_0xe8c1('0x8')](_0xe8c1('0x9'));});_0x216695['on'](_0xe8c1('0xa'),function(_0x55cc72){if(_0x55cc72[_0xe8c1('0xb')]()==_0xe8c1('0xc')){_0x4f128f[_0xe8c1('0x8')](_0xe8c1('0xc'));return;}if(_0x55cc72[_0xe8c1('0xd')](0x0,0xb)=='520-Invalid'){_0x3cc39a=!![];}if(_0x3cc39a){_0x1262c0['rx']+=_0x55cc72+'\x0a';if(_0x55cc72[_0xe8c1('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x3cc39a=![];}}else{_0x1262c0['rx']=_0x55cc72;}if(_0x3cc39a){return;}if(typeof _0x1262c0['cb']==_0xe8c1('0xf')){var _0x2020f5=_0x1262c0['rx'][_0xe8c1('0xd')](0x0,0x3),_0x1c9578=null,_0x534e98=null;_0x2020f5=parseInt(_0x2020f5);if(isNaN(_0x2020f5)){_0x1262c0['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe8c1('0x10')});return;}if(_0x2020f5!=0xc8){_0x1262c0['cb'](null,{'code':_0x2020f5,'result':-0x1,'extra':'KO'});return;}_0x1c9578=_0x1262c0['rx'][_0xe8c1('0xd')](0x4)[_0xe8c1('0x11')](_0xe8c1('0x12'),'');if(_0x1c9578[_0xe8c1('0x13')]('\x20')!=-0x1){_0x1c9578=_0x1c9578[_0xe8c1('0x14')](0x0,_0x1c9578['indexOf']('\x20'));}if(_[_0xe8c1('0x15')](_0x1c9578,'-1')){_0x1c9578=parseInt(_0x1c9578);}_0x534e98=_0x1262c0['rx']['split']('\x20');if(_0x534e98[_0xe8c1('0x16')]==0x3){_0x534e98=_0x534e98[0x2][_0xe8c1('0xd')](0x1,_0x534e98[0x2]['length']-0x1);}else if(_0x534e98[_0xe8c1('0x16')]>0x3){var _0x64bd05=/\((.+)\)/;var _0x3ff704=_0x1262c0['rx'][_0xe8c1('0x17')](_0x64bd05);if(_0x3ff704){_0x534e98=_0x3ff704[0x1];}else{_0x534e98=null;}}else{_0x534e98=null;}_0x1262c0['cb'](null,{'code':_0x2020f5,'result':_0x1c9578,'extra':_0x534e98});}});_0x657c53['on'](_0xe8c1('0x18'),function(_0x19a306){_0x4f128f[_0xe8c1('0x8')]('error',new AGIError(_0xe8c1('0x19'),_0x19a306[_0xe8c1('0x1a')]));});_0x657c53['on']('close',function(){_0x4f128f[_0xe8c1('0x8')](_0xe8c1('0x1b'),new AGIError(_0xe8c1('0x1c')));});_0x657c53['on'](_0xe8c1('0x1d'),function(){_0x4f128f['emit'](_0xe8c1('0x1d'),new AGIError(_0xe8c1('0x1e')));_0x657c53[_0xe8c1('0x1f')]();});_0x657c53[_0xe8c1('0x20')](_0x216695);this['command']=function(_0x5b5d09,_0x2e9f37){var _0x5b5d09=_0x5b5d09||'',_0x2e9f37=typeof _0x2e9f37=='function'?_0x2e9f37:new Function();_0x1262c0={'tx':_0x5b5d09,'rx':'','cb':_0x2e9f37};_0x657c53[_0xe8c1('0x21')](_0x5b5d09+'\x0a');},this[_0xe8c1('0x1b')]=function(){_0x657c53[_0xe8c1('0x1f')]();};}util[_0xe8c1('0x22')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x18731a){return this[_0xe8c1('0x23')][_0xe8c1('0x24')](this,_0x18731a);};AGIChannel[_0xe8c1('0x25')][_0xe8c1('0x26')]=function(){return this[_0xe8c1('0x27')](_0xe8c1('0x28'));};AGIChannel['prototype'][_0xe8c1('0x29')]=function(_0x2cdd69,_0xb0ed0,_0xff5806){_0x2cdd69=_0x2cdd69===undefined?_0xe8c1('0x2a'):_0x2cdd69;_0xb0ed0=_0xb0ed0===undefined?'5':_0xb0ed0;_0xff5806=_0xff5806===undefined?'1':_0xff5806;return this[_0xe8c1('0x27')](util[_0xe8c1('0x2b')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x2cdd69,_0xb0ed0*0x3e8,_0xff5806));};AGIChannel[_0xe8c1('0x25')][_0xe8c1('0x2c')]=function(_0x2c7be8){_0x2c7be8=_0x2c7be8||'NO\x20MESSAGE';return this['sendRequest'](util[_0xe8c1('0x2b')](_0xe8c1('0x2d'),_0x2c7be8));};AGIChannel[_0xe8c1('0x25')][_0xe8c1('0x2e')]=function(_0x154c8a,_0x5396f3){if(_[_0xe8c1('0x2f')](_0x5396f3)){return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x154c8a,_0x5396f3[_0xe8c1('0x30')](',')));}return this[_0xe8c1('0x27')](util[_0xe8c1('0x2b')](_0xe8c1('0x31'),_0x154c8a,_0x5396f3));};AGIChannel[_0xe8c1('0x25')][_0xe8c1('0x32')]=function(_0x3ba702){return this[_0xe8c1('0x27')](util['format'](_0xe8c1('0x33'),_0x3ba702));};AGIChannel[_0xe8c1('0x25')]['setExtension']=function(_0x3fb7ac){return this[_0xe8c1('0x27')](util['format'](_0xe8c1('0x34'),_0x3fb7ac));};AGIChannel['prototype'][_0xe8c1('0x35')]=function(_0x26ade2){return this[_0xe8c1('0x27')](util[_0xe8c1('0x2b')](_0xe8c1('0x36'),_0x26ade2));};AGIChannel['prototype'][_0xe8c1('0xc')]=function(){return this[_0xe8c1('0x27')](_0xe8c1('0x37'));};AGIChannel[_0xe8c1('0x25')][_0xe8c1('0x38')]=function(_0x2beea5,_0xb1e993){var _0x27982d=_[_0xe8c1('0x39')](_0xb1e993)||_[_0xe8c1('0x3a')](_0xb1e993)?_0xb1e993[_0xe8c1('0x3b')]():_0xb1e993;return this['sendRequest'](util['format'](_0xe8c1('0x3c'),_0x2beea5,_0x27982d?_0x27982d[_0xe8c1('0x3b')]()[_0xe8c1('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe8c1('0x25')][_0xe8c1('0x3d')]=function(_0x5bd7c0,_0xd93e12){return this[_0xe8c1('0x27')](util[_0xe8c1('0x2b')](_0xe8c1('0x3e'),_0x5bd7c0,_0xd93e12));};AGIChannel[_0xe8c1('0x25')][_0xe8c1('0x3f')]=function(_0x204f27,_0x517363){return this['sendRequest'](util['format'](_0xe8c1('0x40'),_0x204f27,_0x517363));};AGIChannel[_0xe8c1('0x25')]['sayPhonetic']=function(_0x18e02a,_0x1f40ce){return this[_0xe8c1('0x27')](util[_0xe8c1('0x2b')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x18e02a,_0x1f40ce));};AGIChannel[_0xe8c1('0x25')][_0xe8c1('0x41')]=function(_0x36ca71,_0x31c6b1,_0x2dc14d){_0x31c6b1=_0x31c6b1||this[_0xe8c1('0x42')];_0x2dc14d=_0x2dc14d||0x1;this['setContext'](_0x36ca71);this[_0xe8c1('0x43')](_0x31c6b1);this[_0xe8c1('0x35')](_0x2dc14d);return this[_0xe8c1('0x2c')](util['format'](_0xe8c1('0x44'),_0x36ca71,_0x31c6b1,_0x2dc14d));};AGIChannel[_0xe8c1('0x25')][_0xe8c1('0x45')]=function(_0x4b8b16){return this[_0xe8c1('0x27')](util[_0xe8c1('0x2b')](_0xe8c1('0x46'),_0x4b8b16));};AGIChannel[_0xe8c1('0x25')]['recordFile']=function(_0x32e933,_0x260398,_0x33aa50,_0x5239d9,_0x2b0aa9,_0x4dacaa){_0x260398=_0x260398||'wav';_0x33aa50=_0x33aa50||'';_0x5239d9=_0x5239d9===undefined?-0x1:_0x5239d9==='-1'?-0x1:_0x5239d9*0x3e8;_0x2b0aa9=_0x2b0aa9===undefined?'':'s='+_0x2b0aa9;_0x4dacaa=_0x4dacaa?_0xe8c1('0x47'):'';return this['sendRequest'](util[_0xe8c1('0x2b')](_0xe8c1('0x48'),_0x32e933,_0x260398,_0x33aa50,_0x5239d9,_0x4dacaa,_0x2b0aa9));};AGIChannel[_0xe8c1('0x25')]['streamFile']=function(_0x3e5dfa,_0x5222ab){_0x5222ab=_0x5222ab||'';return this[_0xe8c1('0x27')](util[_0xe8c1('0x2b')](_0xe8c1('0x49'),_0x3e5dfa,_0x5222ab));};AGIChannel[_0xe8c1('0x25')][_0xe8c1('0x4a')]=function(_0x415873){return this[_0xe8c1('0x2e')](_0xe8c1('0x4b'),_0x415873);};AGIChannel[_0xe8c1('0x25')][_0xe8c1('0x4c')]=function(_0x44e0da){return this['exec']('WAIT',_0x44e0da);};AGIChannel[_0xe8c1('0x25')][_0xe8c1('0x18')]=function(_0x3948e1,_0x17766e){this['noop'](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x3948e1['id'],_0x3948e1[_0xe8c1('0x4d')],_0x17766e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xe8c1('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 832e2d0..6b5831b 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 _0xfd5c=['Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','message','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xfd5c,0x175));var _0xcfd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd5c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xcfd5('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xcfd5('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xcfd5('0x2'),'E_AGI_SOCKET_ERROR':_0xcfd5('0x3'),'E_AGI_SOCKET_CLOSE':_0xcfd5('0x4'),'E_AGI_SOCKET_TIMEOUT':_0xcfd5('0x5'),'E_AGI_COMMAND_EMPTY':_0xcfd5('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xcfd5('0x7'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x60cdfe){var _0x60cdfe=_0x60cdfe||null,_0x1a68a8=_0x1a68a8||[],_0x2dcfdc=0x1,_0x129037='';if(!error[_0x60cdfe]){_0x60cdfe=_0xcfd5('0x8');}_0x1a68a8[_0xcfd5('0x9')](error[_0x60cdfe]);while(arguments[_0x2dcfdc]){_0x1a68a8[_0xcfd5('0x9')](arguments[_0x2dcfdc]);_0x2dcfdc++;}_0x129037=util['format']['apply'](util,_0x1a68a8);this[_0xcfd5('0xa')]=_0x129037;this[_0xcfd5('0xb')]=_0x60cdfe;}module[_0xcfd5('0xc')]=AGIError; \ No newline at end of file +var _0x7b41=['Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0x7b41,0x15d));var _0x17b4=function(_0x2dc271,_0x1eb8a8){_0x2dc271=_0x2dc271-0x0;var _0x3c03e0=_0x7b41[_0x2dc271];return _0x3c03e0;};'use strict';var util=require(_0x17b4('0x0'));var error={'E_AGI_UNDEFINED':_0x17b4('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x17b4('0x2'),'E_AGI_SERVER_CLOSE':_0x17b4('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x17b4('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x17b4('0x5'),'E_AGI_SOCKET_ERROR':_0x17b4('0x6'),'E_AGI_SOCKET_CLOSE':_0x17b4('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x17b4('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x17b4('0x9'),'E_AGI_IVR_ENTRY':_0x17b4('0xa')};function AGIError(_0x5f2220){var _0x5f2220=_0x5f2220||null,_0x4b1bb6=_0x4b1bb6||[],_0x3c32ec=0x1,_0xc2d737='';if(!error[_0x5f2220]){_0x5f2220=_0x17b4('0xb');}_0x4b1bb6[_0x17b4('0xc')](error[_0x5f2220]);while(arguments[_0x3c32ec]){_0x4b1bb6[_0x17b4('0xc')](arguments[_0x3c32ec]);_0x3c32ec++;}_0xc2d737=util[_0x17b4('0xd')][_0x17b4('0xe')](util,_0x4b1bb6);this[_0x17b4('0xf')]=_0xc2d737;this['name']=_0x5f2220;}module[_0x17b4('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 731941b..f1d28e7 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 _0xcb5c=['vertices','addEdge','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','length','split','agicommand','vswitch','default','target','menu','invalid','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','exports','lodash','agi','getdigits','getsecretdigits','edges','numberOfEdges','prototype'];(function(_0x4724ba,_0x372142){var _0x3c2f63=function(_0x44f80b){while(--_0x44f80b){_0x4724ba['push'](_0x4724ba['shift']());}};_0x3c2f63(++_0x372142);}(_0xcb5c,0x172));var _0xccb5=function(_0x378f17,_0x17b7ab){_0x378f17=_0x378f17-0x0;var _0x545988=_0xcb5c[_0x378f17];return _0x545988;};'use strict';var _=require(_0xccb5('0x0'));var logger=require('../../../config/logger')(_0xccb5('0x1'));var verticesWithRetry=['menu',_0xccb5('0x2'),_0xccb5('0x3')];var Graph=function(){this['vertices']={};this[_0xccb5('0x4')]={};this[_0xccb5('0x5')]=0x0;};Graph[_0xccb5('0x6')]['addVertex']=function(_0x26c13f){this[_0xccb5('0x7')][_0x26c13f['id']]=_0x26c13f;this[_0xccb5('0x4')][_0x26c13f['id']]=[];};Graph[_0xccb5('0x6')][_0xccb5('0x8')]=function(_0x44e12c,_0x3b17b9,_0x1dc8a8){this[_0xccb5('0x4')][_0x44e12c]['push']({'target':_0x3b17b9,'condition':_0x1dc8a8});this['numberOfEdges']+=0x1;};Graph[_0xccb5('0x6')][_0xccb5('0x9')]=function(){return _[_0xccb5('0x9')](this['vertices']);};Graph['prototype'][_0xccb5('0xa')]=function(){return this[_0xccb5('0x5')];};Graph[_0xccb5('0x6')][_0xccb5('0xb')]=function(_0x1e833e){return this[_0xccb5('0x7')][_0x1e833e];};Graph[_0xccb5('0x6')][_0xccb5('0xc')]=function(_0x20e67b,_0x3ba476){if(!this['vertices'][_0x20e67b]){return logger[_0xccb5('0xd')](_0xccb5('0xe'));}var _0x5139be=_0x3ba476(this[_0xccb5('0x7')][_0x20e67b]);if(!_0x5139be){return logger[_0xccb5('0xd')](_0xccb5('0xf'));}if(this['edges'][_0x20e67b]['length']===0x0){return logger[_0xccb5('0xd')](_0xccb5('0x10'));}for(var _0x183c76=0x0,_0x2066a6=[],_0x55a6cb=![];_0x183c76\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','[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','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','xml2json','lodash','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./vertices','agi','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','evtHangup','toJson','agicommand','maxRetry','retry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','addEdge','source','target','then','catch','substring','inspect','debug','variables','close','timeout','hangup'];(function(_0x1f5cb0,_0x3212e6){var _0x110d95=function(_0x1d0f74){while(--_0x1d0f74){_0x1f5cb0['push'](_0x1f5cb0['shift']());}};_0x110d95(++_0x3212e6);}(_0x0a90,0x1e7));var _0x00a9=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x0a90[_0x20ef64];return _0x3707d8;};'use strict';var parser=require(_0x00a9('0x0'));var _=require(_0x00a9('0x1'));var syncho=require('syncho');var util=require(_0x00a9('0x2'));var moment=require(_0x00a9('0x3'));var config=require(_0x00a9('0x4'));var logger=require(_0x00a9('0x5'))('agi');var utilLicense=require(_0x00a9('0x6'));var rpc=require(_0x00a9('0x7'));var mailRpc=require(_0x00a9('0x8'));var Graph=require('./graph');var Vertices=require(_0x00a9('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x00a9('0xa')]=_['defaults'](config['agi'],{'ip':_0x00a9('0xb'),'port':0x11dd});function connectionHandler(_0x1ecb0d){process[_0x00a9('0xc')](function(){syncho(function(){try{setChannelVariables(_0x1ecb0d);agiHandler(_0x1ecb0d);}catch(_0x1cc483){logger[_0x00a9('0xd')](_0x1cc483[_0x00a9('0xe')]);}});});}function listeningHandler(){console[_0x00a9('0xf')](_0x00a9('0x10'),config[_0x00a9('0xa')]['port']);logger[_0x00a9('0x11')](util[_0x00a9('0x12')](_0x00a9('0x13'),config[_0x00a9('0xa')]['ip'],config[_0x00a9('0xa')][_0x00a9('0x14')]));}function errorHandler(_0x51395b){if(_0x51395b&&_0x51395b[_0x00a9('0x15')]&&_0x51395b['message']){logger['error'](util[_0x00a9('0x12')]('[%s]\x20%s',_0x51395b[_0x00a9('0x15')],_0x51395b['message']));}else{logger[_0x00a9('0xd')](util[_0x00a9('0x12')](_0x00a9('0x16'),_0x51395b[_0x00a9('0xe')]));}}function closeHandler(){logger['info'](util['format'](_0x00a9('0x17'),this['arg_1'],this[_0x00a9('0x18')],this[_0x00a9('0x19')],this['dnid'],this[_0x00a9('0x1a')]));try{createSquareReport(this);}catch(_0x5ddcc8){logger[_0x00a9('0xd')](_0x5ddcc8[_0x00a9('0xe')]);}}function timeoutHandler(){logger[_0x00a9('0x11')](util[_0x00a9('0x12')](_0x00a9('0x1b'),this[_0x00a9('0x1c')],this[_0x00a9('0x18')],this[_0x00a9('0x19')],this[_0x00a9('0x1d')],this[_0x00a9('0x1a')]));}function hangupHandler(){logger[_0x00a9('0x11')](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x00a9('0x1c')],this['calleridname'],this['callerid'],this[_0x00a9('0x1d')],this['uniqueid']));this[_0x00a9('0x1e')]=!![];}function getRoot(_0x123270){return parser[_0x00a9('0x1f')](_0x123270,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x311dd2,_0x192781,_0x4abb29){_0x192781[_0x00a9('0x20')]=_0x4abb29;if(_0x192781['hasOwnProperty']('retry')){_0x192781[_0x00a9('0x21')]=parseInt(_0x192781[_0x00a9('0x22')],0xa);}_0x311dd2[_0x00a9('0x23')](_[_0x00a9('0x24')](_0x192781,_0x00a9('0x25')));}function initGraph(_0x55fa59,_0xebf50f){var _0x462865=new Graph();for(var _0x4d4bf3 in _0x55fa59){if(_0x55fa59[_0x00a9('0x26')](_0x4d4bf3)){if(_[_0x00a9('0x27')](_0x55fa59[_0x4d4bf3])){for(var _0x48da17=0x0;_0x48da17<_0x55fa59[_0x4d4bf3][_0x00a9('0x28')];_0x48da17+=0x1){addVertex(_0x462865,_0x55fa59[_0x4d4bf3][_0x48da17],_0x4d4bf3);}}else{addVertex(_0x462865,_0x55fa59[_0x4d4bf3],_0x4d4bf3);}}}for(var _0x48dd86=0x0;_0x48dd86<_0xebf50f[_0x00a9('0x28')];_0x48dd86+=0x1){if(_0xebf50f[_0x48dd86]['source']&&_0xebf50f[_0x48dd86]['target']){_0x462865[_0x00a9('0x29')](_0xebf50f[_0x48dd86][_0x00a9('0x2a')],_0xebf50f[_0x48dd86][_0x00a9('0x2b')],_0xebf50f[_0x48dd86]['value']);}}return _0x462865;}function getSquareProject(_0x30a318,_0x313e94){rpc['getSquareProject'](_0x30a318)[_0x00a9('0x2c')](function(_0x57e7fb){_0x313e94(null,_0x57e7fb);})[_0x00a9('0x2d')](function(_0x1122d3){_0x313e94(null,_0x1122d3);});}function createSquareReport(_0xdaa373,_0x757d3){rpc['createSquareReport'](_0xdaa373)['then'](function(_0x38f79d){if(_0x757d3){_0x757d3(null,_0x38f79d);}})[_0x00a9('0x2d')](function(_0x3e3f0f){if(_0x757d3){_0x757d3(null,_0x3e3f0f);}});}function setChannelVariables(_0x4c5710){for(var _0x3647b7 in _0x4c5710){if(_0x4c5710[_0x00a9('0x26')](_0x3647b7)){if(_0x3647b7['indexOf']('agi_')===0x0){_0x4c5710[_0x3647b7[_0x00a9('0x2e')](0x4)]=_0x4c5710[_0x3647b7];delete _0x4c5710[_0x3647b7];}}}}function getLogFromObject(_0x2e4e7e){return util[_0x00a9('0x2f')](_0x2e4e7e,{'showHidden':![],'depth':null});}function agiHandler(_0x2ddd12){var _0x2e3520,_0x11553c,_0x312dab,_0x30b9f2,_0xa5c732;logger[_0x00a9('0x30')](_0x00a9('0x31'),JSON['stringify'](_0x2ddd12,null,0x2));logger[_0x00a9('0x11')](util[_0x00a9('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2ddd12['arg_1'],_0x2ddd12[_0x00a9('0x18')],_0x2ddd12[_0x00a9('0x19')],_0x2ddd12[_0x00a9('0x1d')],_0x2ddd12[_0x00a9('0x1a')]));_0x2ddd12['on'](_0x00a9('0xd'),errorHandler);_0x2ddd12['on'](_0x00a9('0x32'),closeHandler);_0x2ddd12['on'](_0x00a9('0x33'),timeoutHandler);_0x2ddd12[_0x00a9('0x1e')]=![];_0x2ddd12['on'](_0x00a9('0x34'),hangupHandler);var _0x8b152c=getSquareProject[_0x00a9('0x35')](null,_0x2ddd12[_0x00a9('0x1c')]);if(_0x8b152c){if(_0x8b152c[_0x00a9('0x36')]){_0x2e3520=getRoot(_0x8b152c['production']);if(_0x2e3520&&_0x2e3520[_0x00a9('0x37')]){logger['debug'](_0x00a9('0x38'),JSON['stringify'](_0x2e3520,null,0x2));_0x2ddd12[_0x00a9('0x39')]=moment()[_0x00a9('0x12')](_0x00a9('0x3a'));_0x11553c=initGraph(_[_0x00a9('0x24')](_0x2e3520,'mxCell'),_0x2e3520[_0x00a9('0x25')]);_0x312dab=new Vertices(_0x2ddd12,rpc,mailRpc);logger[_0x00a9('0x11')](util['format'](_0x00a9('0x3b'),_0x2ddd12[_0x00a9('0x1c')],_0x2ddd12['calleridname'],_0x2ddd12[_0x00a9('0x19')],_0x2ddd12[_0x00a9('0x1d')],_0x2ddd12[_0x00a9('0x1a')]));_0x11553c[_0x00a9('0x3c')](_0x2e3520[_0x00a9('0x37')]['id'],function(_0xed183){try{_0xed183=_0x312dab[_0x00a9('0x3d')](_0xed183);logger['debug'](_0x00a9('0x3e'),JSON[_0x00a9('0x3f')](_0xed183,null,0x2));if(_0xed183[_0x00a9('0x20')]===_0x00a9('0x40')){logger[_0x00a9('0x11')](_0x00a9('0x41'));_0x2ddd12[_0x00a9('0x42')]=_0xed183[_0x00a9('0x42')]||_0x2ddd12[_0x00a9('0x42')];_0x2ddd12[_0x00a9('0x43')]=_0xed183[_0x00a9('0x43')];_0x2ddd12[_0x00a9('0x44')]=_0xed183[_0x00a9('0x44')]?_0xed183[_0x00a9('0x44')]-0x1:0x1;return null;}else if(_0xed183&&_0x312dab[_0xed183['agicommand']]){_0xa5c732=_0x312dab[_0xed183['agicommand']](_0xed183);logger['info'](_0x00a9('0x45'),JSON[_0x00a9('0x3f')](_0xa5c732,null,0x2));if(_0xa5c732&&_0xa5c732[_0x00a9('0x46')]===AGI_CODE_SUCCESS&&_0xa5c732['result']!==AGI_RESULT_ERROR&&!_0x2ddd12['evtHangup']){logger[_0x00a9('0x30')](_0x00a9('0x45'),getLogFromObject(_0xa5c732));return _[_0x00a9('0x47')](_0xa5c732['result'])?null:_0xa5c732[_0x00a9('0x48')]['toString']();}else{logger[_0x00a9('0xd')](_0x00a9('0x45'),getLogFromObject(_0xa5c732));return null;}}else{logger['error'](_0x00a9('0x49'));return null;}}catch(_0x42ccc9){logger[_0x00a9('0xd')](_0x42ccc9[_0x00a9('0xe')]);return null;}});if(_0x2e3520[_0x00a9('0x4a')]){logger[_0x00a9('0x11')](util[_0x00a9('0x12')](_0x00a9('0x4b'),_0x2ddd12[_0x00a9('0x1c')],_0x2ddd12[_0x00a9('0x18')],_0x2ddd12[_0x00a9('0x19')],_0x2ddd12['dnid'],_0x2ddd12[_0x00a9('0x1a')]));_0x11553c[_0x00a9('0x3c')](_0x2e3520[_0x00a9('0x4a')]['id'],function(_0x3dfe7e){try{_0x3dfe7e=_0x312dab[_0x00a9('0x3d')](_0x3dfe7e);logger[_0x00a9('0x30')](_0x00a9('0x3e'),JSON[_0x00a9('0x3f')](_0x3dfe7e,null,0x2));if(_0x3dfe7e&&_0x312dab[_0x3dfe7e[_0x00a9('0x20')]]){_0xa5c732=_0x312dab[_0x3dfe7e[_0x00a9('0x20')]](_0x3dfe7e);if(_0xa5c732){logger[_0x00a9('0x30')](_0x00a9('0x45'),getLogFromObject(_0xa5c732));return _[_0x00a9('0x47')](_0xa5c732[_0x00a9('0x48')])?null:_0xa5c732[_0x00a9('0x48')][_0x00a9('0x4c')]();}else{logger[_0x00a9('0xd')](_0x00a9('0x45'),getLogFromObject(_0xa5c732));return null;}}else{logger[_0x00a9('0xd')](_0x00a9('0x49'));return null;}}catch(_0x247675){logger[_0x00a9('0xd')](_0x247675[_0x00a9('0xe')]);return null;}});}logger[_0x00a9('0x11')](util[_0x00a9('0x12')](_0x00a9('0x4d'),_0x2ddd12[_0x00a9('0x1c')],_0x2ddd12[_0x00a9('0x18')],_0x2ddd12[_0x00a9('0x19')],_0x2ddd12[_0x00a9('0x1d')],_0x2ddd12[_0x00a9('0x1a')]));logger[_0x00a9('0x11')](util[_0x00a9('0x12')](_0x00a9('0x4e'),_0x2ddd12[_0x00a9('0x42')],_0x2ddd12['extension'],parseInt(_0x2ddd12[_0x00a9('0x44')],0xa)+0x1));_0x2ddd12['continueAt'](_0x2ddd12[_0x00a9('0x42')],_0x2ddd12[_0x00a9('0x43')],parseInt(_0x2ddd12[_0x00a9('0x44')],0xa)+0x1);_0x2ddd12[_0x00a9('0x32')]();}}else{logger[_0x00a9('0xd')](util['format'](_0x00a9('0x4f'),_0x2ddd12['arg_1']));_0x2ddd12[_0x00a9('0x50')](_0x2ddd12['context'],_0x2ddd12[_0x00a9('0x43')],parseInt(_0x2ddd12[_0x00a9('0x44')],0xa)+0x1);_0x2ddd12['close']();}}else{logger[_0x00a9('0xd')](util[_0x00a9('0x12')](_0x00a9('0x51'),_0x2ddd12[_0x00a9('0x1c')]));_0x2ddd12['continueAt'](_0x2ddd12[_0x00a9('0x42')],_0x2ddd12['extension'],parseInt(_0x2ddd12[_0x00a9('0x44')],0xa)+0x1);_0x2ddd12['close']();}}function main(){var _0x19b8bf;return utilLicense[_0x00a9('0x52')]()[_0x00a9('0x2c')](function(_0x3a44ef){if(_0x3a44ef){if(_0x3a44ef[_0x00a9('0x53')]){if(_0x3a44ef[_0x00a9('0x54')]&&_0x3a44ef[_0x00a9('0x54')]>0x0){logger[_0x00a9('0x11')](util[_0x00a9('0x12')](_0x00a9('0x55'),_0x3a44ef['callysquare']));_0x19b8bf=_0x3a44ef[_0x00a9('0x54')];}else{logger[_0x00a9('0x11')](_0x00a9('0x56'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x19b8bf=-0x1;}}})[_0x00a9('0x2d')](function(_0x3b8f6d){logger[_0x00a9('0xd')](_0x00a9('0x57'),_0x3b8f6d[_0x00a9('0xe')]);})['finally'](function(){var _0x5e202f=require(_0x00a9('0x58'))(config[_0x00a9('0xa')][_0x00a9('0x14')],config[_0x00a9('0xa')]['ip'],_0x19b8bf);_0x5e202f['on'](_0x00a9('0xd'),errorHandler);_0x5e202f['on'](_0x00a9('0x59'),listeningHandler);_0x5e202f['on']('connection',connectionHandler);_0x5e202f['on'](_0x00a9('0x32'),closeHandler);});}main(); \ No newline at end of file +var _0xd518=['callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch','[LICENSE]','./server','xml2json','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','error','stack','log','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','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','indexOf','agi_','substring','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','debug','root','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','start','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand','response','code','result','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','voice'];(function(_0x302caf,_0x2404c7){var _0x105383=function(_0x2c3184){while(--_0x2c3184){_0x302caf['push'](_0x302caf['shift']());}};_0x105383(++_0x2404c7);}(_0xd518,0x10c));var _0x8d51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd518[_0x3dd15e];return _0x231fd0;};'use strict';var parser=require(_0x8d51('0x0'));var _=require(_0x8d51('0x1'));var syncho=require(_0x8d51('0x2'));var util=require(_0x8d51('0x3'));var moment=require('moment');var config=require(_0x8d51('0x4'));var logger=require(_0x8d51('0x5'))(_0x8d51('0x6'));var utilLicense=require(_0x8d51('0x7'));var rpc=require(_0x8d51('0x8'));var mailRpc=require(_0x8d51('0x9'));var Graph=require(_0x8d51('0xa'));var Vertices=require(_0x8d51('0xb'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x8d51('0x6')]=_['defaults'](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0xabd256){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0xabd256);agiHandler(_0xabd256);}catch(_0x17505f){logger[_0x8d51('0xc')](_0x17505f[_0x8d51('0xd')]);}});});}function listeningHandler(){console[_0x8d51('0xe')](_0x8d51('0xf'),config[_0x8d51('0x6')][_0x8d51('0x10')]);logger[_0x8d51('0x11')](util['format'](_0x8d51('0x12'),config[_0x8d51('0x6')]['ip'],config[_0x8d51('0x6')][_0x8d51('0x10')]));}function errorHandler(_0x4968b3){if(_0x4968b3&&_0x4968b3[_0x8d51('0x13')]&&_0x4968b3[_0x8d51('0x14')]){logger[_0x8d51('0xc')](util[_0x8d51('0x15')](_0x8d51('0x16'),_0x4968b3[_0x8d51('0x13')],_0x4968b3[_0x8d51('0x14')]));}else{logger[_0x8d51('0xc')](util['format'](_0x8d51('0x17'),_0x4968b3[_0x8d51('0xd')]));}}function closeHandler(){logger['info'](util['format'](_0x8d51('0x18'),this[_0x8d51('0x19')],this[_0x8d51('0x1a')],this['callerid'],this[_0x8d51('0x1b')],this[_0x8d51('0x1c')]));try{createSquareReport(this);}catch(_0x28c227){logger[_0x8d51('0xc')](_0x28c227['stack']);}}function timeoutHandler(){logger[_0x8d51('0x11')](util[_0x8d51('0x15')](_0x8d51('0x1d'),this['arg_1'],this[_0x8d51('0x1a')],this[_0x8d51('0x1e')],this['dnid'],this[_0x8d51('0x1c')]));}function hangupHandler(){logger[_0x8d51('0x11')](util[_0x8d51('0x15')](_0x8d51('0x1f'),this[_0x8d51('0x19')],this['calleridname'],this[_0x8d51('0x1e')],this[_0x8d51('0x1b')],this[_0x8d51('0x1c')]));this[_0x8d51('0x20')]=!![];}function getRoot(_0x15c162){return parser[_0x8d51('0x21')](_0x15c162,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x43ad11,_0x489d69,_0x481dd6){_0x489d69['agicommand']=_0x481dd6;if(_0x489d69[_0x8d51('0x22')](_0x8d51('0x23'))){_0x489d69['maxRetry']=parseInt(_0x489d69[_0x8d51('0x23')],0xa);}_0x43ad11[_0x8d51('0x24')](_[_0x8d51('0x25')](_0x489d69,_0x8d51('0x26')));}function initGraph(_0x31a0c6,_0x3bc3a3){var _0x5e5ef8=new Graph();for(var _0xf75518 in _0x31a0c6){if(_0x31a0c6[_0x8d51('0x22')](_0xf75518)){if(_[_0x8d51('0x27')](_0x31a0c6[_0xf75518])){for(var _0x91b45b=0x0;_0x91b45b<_0x31a0c6[_0xf75518][_0x8d51('0x28')];_0x91b45b+=0x1){addVertex(_0x5e5ef8,_0x31a0c6[_0xf75518][_0x91b45b],_0xf75518);}}else{addVertex(_0x5e5ef8,_0x31a0c6[_0xf75518],_0xf75518);}}}for(var _0x1c9c40=0x0;_0x1c9c40<_0x3bc3a3[_0x8d51('0x28')];_0x1c9c40+=0x1){if(_0x3bc3a3[_0x1c9c40][_0x8d51('0x29')]&&_0x3bc3a3[_0x1c9c40][_0x8d51('0x2a')]){_0x5e5ef8[_0x8d51('0x2b')](_0x3bc3a3[_0x1c9c40]['source'],_0x3bc3a3[_0x1c9c40][_0x8d51('0x2a')],_0x3bc3a3[_0x1c9c40][_0x8d51('0x2c')]);}}return _0x5e5ef8;}function getSquareProject(_0x2f9556,_0x3560f){rpc[_0x8d51('0x2d')](_0x2f9556)[_0x8d51('0x2e')](function(_0x235807){_0x3560f(null,_0x235807);})['catch'](function(_0xc9b495){_0x3560f(null,_0xc9b495);});}function createSquareReport(_0x5ead8a,_0x533467){rpc['createSquareReport'](_0x5ead8a)[_0x8d51('0x2e')](function(_0x3f1aee){if(_0x533467){_0x533467(null,_0x3f1aee);}})['catch'](function(_0x188173){if(_0x533467){_0x533467(null,_0x188173);}});}function setChannelVariables(_0x9ca9bf){for(var _0x1caaec in _0x9ca9bf){if(_0x9ca9bf['hasOwnProperty'](_0x1caaec)){if(_0x1caaec[_0x8d51('0x2f')](_0x8d51('0x30'))===0x0){_0x9ca9bf[_0x1caaec[_0x8d51('0x31')](0x4)]=_0x9ca9bf[_0x1caaec];delete _0x9ca9bf[_0x1caaec];}}}}function getLogFromObject(_0x553254){return util['inspect'](_0x553254,{'showHidden':![],'depth':null});}function agiHandler(_0x137c47){var _0x45a86d,_0x4c540a,_0x1bfaa5,_0x5282fa,_0x16bd97;logger['debug']('variables',JSON[_0x8d51('0x32')](_0x137c47,null,0x2));logger[_0x8d51('0x11')](util[_0x8d51('0x15')](_0x8d51('0x33'),_0x137c47[_0x8d51('0x19')],_0x137c47[_0x8d51('0x1a')],_0x137c47[_0x8d51('0x1e')],_0x137c47[_0x8d51('0x1b')],_0x137c47[_0x8d51('0x1c')]));_0x137c47['on'](_0x8d51('0xc'),errorHandler);_0x137c47['on'](_0x8d51('0x34'),closeHandler);_0x137c47['on'](_0x8d51('0x35'),timeoutHandler);_0x137c47['evtHangup']=![];_0x137c47['on'](_0x8d51('0x36'),hangupHandler);var _0x476e35=getSquareProject[_0x8d51('0x37')](null,_0x137c47['arg_1']);if(_0x476e35){if(_0x476e35['production']){_0x45a86d=getRoot(_0x476e35['production']);if(_0x45a86d&&_0x45a86d['start']){logger[_0x8d51('0x38')](_0x8d51('0x39'),JSON[_0x8d51('0x32')](_0x45a86d,null,0x2));_0x137c47['joinAt']=moment()[_0x8d51('0x15')](_0x8d51('0x3a'));_0x4c540a=initGraph(_[_0x8d51('0x25')](_0x45a86d,'mxCell'),_0x45a86d[_0x8d51('0x26')]);_0x1bfaa5=new Vertices(_0x137c47,rpc,mailRpc);logger[_0x8d51('0x11')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x137c47[_0x8d51('0x19')],_0x137c47[_0x8d51('0x1a')],_0x137c47['callerid'],_0x137c47[_0x8d51('0x1b')],_0x137c47[_0x8d51('0x1c')]));_0x4c540a[_0x8d51('0x3b')](_0x45a86d[_0x8d51('0x3c')]['id'],function(_0x5275e6){try{_0x5275e6=_0x1bfaa5[_0x8d51('0x3d')](_0x5275e6);logger['debug']('vertex',JSON['stringify'](_0x5275e6,null,0x2));if(_0x5275e6['agicommand']==='gotoc'){logger[_0x8d51('0x11')](_0x8d51('0x3e'));_0x137c47[_0x8d51('0x3f')]=_0x5275e6['context']||_0x137c47[_0x8d51('0x3f')];_0x137c47[_0x8d51('0x40')]=_0x5275e6[_0x8d51('0x40')];_0x137c47[_0x8d51('0x41')]=_0x5275e6[_0x8d51('0x41')]?_0x5275e6['priority']-0x1:0x1;return null;}else if(_0x5275e6&&_0x1bfaa5[_0x5275e6[_0x8d51('0x42')]]){_0x16bd97=_0x1bfaa5[_0x5275e6['agicommand']](_0x5275e6);logger['info'](_0x8d51('0x43'),JSON[_0x8d51('0x32')](_0x16bd97,null,0x2));if(_0x16bd97&&_0x16bd97[_0x8d51('0x44')]===AGI_CODE_SUCCESS&&_0x16bd97[_0x8d51('0x45')]!==AGI_RESULT_ERROR&&!_0x137c47[_0x8d51('0x20')]){logger[_0x8d51('0x38')](_0x8d51('0x43'),getLogFromObject(_0x16bd97));return _[_0x8d51('0x46')](_0x16bd97[_0x8d51('0x45')])?null:_0x16bd97[_0x8d51('0x45')][_0x8d51('0x47')]();}else{logger[_0x8d51('0xc')](_0x8d51('0x43'),getLogFromObject(_0x16bd97));return null;}}else{logger[_0x8d51('0xc')](_0x8d51('0x48'));return null;}}catch(_0x1fe790){logger[_0x8d51('0xc')](_0x1fe790['stack']);return null;}});if(_0x45a86d['finally']){logger[_0x8d51('0x11')](util[_0x8d51('0x15')](_0x8d51('0x49'),_0x137c47[_0x8d51('0x19')],_0x137c47['calleridname'],_0x137c47[_0x8d51('0x1e')],_0x137c47[_0x8d51('0x1b')],_0x137c47[_0x8d51('0x1c')]));_0x4c540a[_0x8d51('0x3b')](_0x45a86d[_0x8d51('0x4a')]['id'],function(_0x16b2f5){try{_0x16b2f5=_0x1bfaa5[_0x8d51('0x3d')](_0x16b2f5);logger[_0x8d51('0x38')](_0x8d51('0x4b'),JSON[_0x8d51('0x32')](_0x16b2f5,null,0x2));if(_0x16b2f5&&_0x1bfaa5[_0x16b2f5[_0x8d51('0x42')]]){_0x16bd97=_0x1bfaa5[_0x16b2f5[_0x8d51('0x42')]](_0x16b2f5);if(_0x16bd97){logger['debug'](_0x8d51('0x43'),getLogFromObject(_0x16bd97));return _[_0x8d51('0x46')](_0x16bd97[_0x8d51('0x45')])?null:_0x16bd97['result'][_0x8d51('0x47')]();}else{logger[_0x8d51('0xc')]('response',getLogFromObject(_0x16bd97));return null;}}else{logger[_0x8d51('0xc')](_0x8d51('0x48'));return null;}}catch(_0x455733){logger[_0x8d51('0xc')](_0x455733[_0x8d51('0xd')]);return null;}});}logger[_0x8d51('0x11')](util[_0x8d51('0x15')](_0x8d51('0x4c'),_0x137c47[_0x8d51('0x19')],_0x137c47[_0x8d51('0x1a')],_0x137c47[_0x8d51('0x1e')],_0x137c47[_0x8d51('0x1b')],_0x137c47['uniqueid']));logger[_0x8d51('0x11')](util[_0x8d51('0x15')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x137c47[_0x8d51('0x3f')],_0x137c47[_0x8d51('0x40')],parseInt(_0x137c47[_0x8d51('0x41')],0xa)+0x1));_0x137c47[_0x8d51('0x4d')](_0x137c47[_0x8d51('0x3f')],_0x137c47['extension'],parseInt(_0x137c47[_0x8d51('0x41')],0xa)+0x1);_0x137c47[_0x8d51('0x34')]();}}else{logger[_0x8d51('0xc')](util[_0x8d51('0x15')](_0x8d51('0x4e'),_0x137c47[_0x8d51('0x19')]));_0x137c47[_0x8d51('0x4d')](_0x137c47['context'],_0x137c47[_0x8d51('0x40')],parseInt(_0x137c47[_0x8d51('0x41')],0xa)+0x1);_0x137c47['close']();}}else{logger[_0x8d51('0xc')](util[_0x8d51('0x15')]('Project\x20%s\x20not\x20found',_0x137c47[_0x8d51('0x19')]));_0x137c47[_0x8d51('0x4d')](_0x137c47[_0x8d51('0x3f')],_0x137c47[_0x8d51('0x40')],parseInt(_0x137c47['priority'],0xa)+0x1);_0x137c47[_0x8d51('0x34')]();}}function main(){var _0x153306;return utilLicense['getLicense']()[_0x8d51('0x2e')](function(_0x1dd79c){if(_0x1dd79c){if(_0x1dd79c[_0x8d51('0x4f')]){if(_0x1dd79c[_0x8d51('0x50')]&&_0x1dd79c[_0x8d51('0x50')]>0x0){logger[_0x8d51('0x11')](util[_0x8d51('0x15')](_0x8d51('0x51'),_0x1dd79c[_0x8d51('0x50')]));_0x153306=_0x1dd79c[_0x8d51('0x50')];}else{logger[_0x8d51('0x11')](_0x8d51('0x52'));}}else{logger['info'](_0x8d51('0x53'));_0x153306=-0x1;}}})[_0x8d51('0x54')](function(_0x5b53b4){logger['error'](_0x8d51('0x55'),_0x5b53b4[_0x8d51('0xd')]);})[_0x8d51('0x4a')](function(){var _0x4b5c22=require(_0x8d51('0x56'))(config[_0x8d51('0x6')][_0x8d51('0x10')],config[_0x8d51('0x6')]['ip'],_0x153306);_0x4b5c22['on'](_0x8d51('0xc'),errorHandler);_0x4b5c22['on']('listening',listeningHandler);_0x4b5c22['on']('connection',connectionHandler);_0x4b5c22['on'](_0x8d51('0x34'),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 5464c3e..47dace7 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 _0x7ec9=['SendMail','bluebird','jayson/promise','client','http','request','error','message','result','sendMailMessage'];(function(_0x2adb29,_0x2d4933){var _0x3f7e01=function(_0x5503f5){while(--_0x5503f5){_0x2adb29['push'](_0x2adb29['shift']());}};_0x3f7e01(++_0x2d4933);}(_0x7ec9,0xa1));var _0x97ec=function(_0x495b3d,_0x4d3da4){_0x495b3d=_0x495b3d-0x0;var _0x4cb329=_0x7ec9[_0x495b3d];return _0x4cb329;};'use strict';var BPromise=require(_0x97ec('0x0'));var jayson=require(_0x97ec('0x1'));var client=jayson[_0x97ec('0x2')][_0x97ec('0x3')]({'port':0x232b});function request(_0x3f95a5,_0x97547){return new BPromise(function(_0xb36106,_0x16880f){return client[_0x97ec('0x4')](_0x3f95a5,_0x97547)['then'](function(_0x4792c5){if(_0x4792c5['error']){return _0x16880f(_0x4792c5[_0x97ec('0x5')][_0x97ec('0x6')]);}else{return _0xb36106(_0x4792c5[_0x97ec('0x7')]);}})['catch'](function(_0x397631){return _0x16880f(_0x397631);});});}exports[_0x97ec('0x8')]=function(_0x2b6aca,_0xa8f17f){return request(_0x97ec('0x9'),{'account':_0x2b6aca,'message':_0xa8f17f});}; \ No newline at end of file +var _0x4ec4=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','then','error'];(function(_0x5ad1cb,_0x2786fb){var _0x2c7a53=function(_0x51a222){while(--_0x51a222){_0x5ad1cb['push'](_0x5ad1cb['shift']());}};_0x2c7a53(++_0x2786fb);}(_0x4ec4,0xc2));var _0x44ec=function(_0x507126,_0x3dd5c3){_0x507126=_0x507126-0x0;var _0x5ca642=_0x4ec4[_0x507126];return _0x5ca642;};'use strict';var BPromise=require(_0x44ec('0x0'));var jayson=require(_0x44ec('0x1'));var client=jayson[_0x44ec('0x2')][_0x44ec('0x3')]({'port':0x232b});function request(_0x1128f6,_0x2a1273){return new BPromise(function(_0x4371e5,_0x18b165){return client['request'](_0x1128f6,_0x2a1273)[_0x44ec('0x4')](function(_0x2e17b8){if(_0x2e17b8[_0x44ec('0x5')]){return _0x18b165(_0x2e17b8[_0x44ec('0x5')]['message']);}else{return _0x4371e5(_0x2e17b8[_0x44ec('0x6')]);}})[_0x44ec('0x7')](function(_0x236f74){return _0x18b165(_0x236f74);});});}exports[_0x44ec('0x8')]=function(_0x59f213,_0x41a235){return request(_0x44ec('0x9'),{'account':_0x59f213,'message':_0x41a235});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 3e78025..b999f72 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 _0x36b7=['emit','util','stream','Transform','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','substring','length','split','indexOf','slice','trim','headers'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x36b7,0x1bb));var _0x736b=function(_0xdd1f1b,_0x4a823f){_0xdd1f1b=_0xdd1f1b-0x0;var _0x3252b1=_0x36b7[_0xdd1f1b];return _0x3252b1;};'use strict';var util=require(_0x736b('0x0'));var Transform=require(_0x736b('0x1'))[_0x736b('0x2')];function AGIReply(_0x423088){Transform['call'](this,_0x423088);this[_0x736b('0x3')]='';this[_0x736b('0x4')]=![];}util[_0x736b('0x5')](AGIReply,Transform);AGIReply[_0x736b('0x6')][_0x736b('0x7')]=function(_0x5ae441,_0x2f82ab,_0x2851c2){var _0x1eca9e='\x0a',_0x269afa=['\x0a\x0a',_0x736b('0x8')],_0x47afad=-0x1,_0x3879d3=-0x1,_0x365481='',_0x124257=0x0,_0x1cf182='',_0x4488ad='';this[_0x736b('0x3')]+=_0x5ae441['toString']();_0x1cf182=this[_0x736b('0x3')];if(!this[_0x736b('0x4')]){_0x124257=0x0;while(_0x269afa[_0x124257]){while((_0x3879d3=_0x1cf182['indexOf'](_0x269afa[_0x124257]))!=-0x1){_0x365481=_0x269afa[_0x124257];_0x4488ad=_0x1cf182[_0x736b('0x9')](0x0,_0x3879d3);_0x1cf182=_0x1cf182['substring'](_0x3879d3+_0x365481[_0x736b('0xa')]);var _0x34db6d=_0x4488ad[_0x736b('0xb')](_0x1eca9e),_0x5f1a1d=0x0,_0x5670a9={},_0x646209='',_0x5249cf='',_0x43d45a=-0x1;while(_0x34db6d[_0x5f1a1d]){_0x43d45a=_0x34db6d[_0x5f1a1d][_0x736b('0xc')](':');if(_0x43d45a!=-0x1){_0x646209=_0x34db6d[_0x5f1a1d][_0x736b('0xd')](0x0,_0x43d45a)[_0x736b('0xe')]();_0x5249cf=_0x34db6d[_0x5f1a1d][_0x736b('0xd')](_0x43d45a+0x1)[_0x736b('0xe')]();if(_0x646209['length']>0x0){_0x5670a9[_0x646209]=_0x5249cf;}}else{}_0x5f1a1d++;}this['emit'](_0x736b('0xf'),_0x5670a9);this[_0x736b('0x4')]=!![];}_0x124257++;}this[_0x736b('0x3')]=_0x1cf182;}else{while((_0x47afad=_0x1cf182[_0x736b('0xc')](_0x1eca9e))!=-0x1){_0x4488ad=_0x1cf182['substring'](0x0,_0x47afad);this[_0x736b('0x10')]('line',_0x4488ad);_0x1cf182=_0x1cf182[_0x736b('0x9')](_0x47afad+_0x1eca9e[_0x736b('0xa')]);}this[_0x736b('0x3')]=_0x1cf182;}_0x2851c2();};module['exports']=AGIReply; \ No newline at end of file +var _0xf7a3=['substring','length','split','slice','trim','emit','line','Transform','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','indexOf'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xf7a3,0xac));var _0x3f7a=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0xf7a3[_0x155c64];return _0x1f154a;};'use strict';var util=require('util');var Transform=require('stream')[_0x3f7a('0x0')];function AGIReply(_0x312192){Transform['call'](this,_0x312192);this[_0x3f7a('0x1')]='';this[_0x3f7a('0x2')]=![];}util[_0x3f7a('0x3')](AGIReply,Transform);AGIReply[_0x3f7a('0x4')][_0x3f7a('0x5')]=function(_0x4d227f,_0xb63480,_0x72a19d){var _0x58d8e7='\x0a',_0x1bb3e1=['\x0a\x0a',_0x3f7a('0x6')],_0x469d2f=-0x1,_0x6148f0=-0x1,_0x4e3edb='',_0x466642=0x0,_0x14e148='',_0x2018f8='';this[_0x3f7a('0x1')]+=_0x4d227f['toString']();_0x14e148=this[_0x3f7a('0x1')];if(!this[_0x3f7a('0x2')]){_0x466642=0x0;while(_0x1bb3e1[_0x466642]){while((_0x6148f0=_0x14e148[_0x3f7a('0x7')](_0x1bb3e1[_0x466642]))!=-0x1){_0x4e3edb=_0x1bb3e1[_0x466642];_0x2018f8=_0x14e148[_0x3f7a('0x8')](0x0,_0x6148f0);_0x14e148=_0x14e148[_0x3f7a('0x8')](_0x6148f0+_0x4e3edb[_0x3f7a('0x9')]);var _0x51697c=_0x2018f8[_0x3f7a('0xa')](_0x58d8e7),_0x58921f=0x0,_0x1a1468={},_0x41d181='',_0x1c7b43='',_0x4adbff=-0x1;while(_0x51697c[_0x58921f]){_0x4adbff=_0x51697c[_0x58921f]['indexOf'](':');if(_0x4adbff!=-0x1){_0x41d181=_0x51697c[_0x58921f][_0x3f7a('0xb')](0x0,_0x4adbff)[_0x3f7a('0xc')]();_0x1c7b43=_0x51697c[_0x58921f][_0x3f7a('0xb')](_0x4adbff+0x1)[_0x3f7a('0xc')]();if(_0x41d181[_0x3f7a('0x9')]>0x0){_0x1a1468[_0x41d181]=_0x1c7b43;}}else{}_0x58921f++;}this[_0x3f7a('0xd')]('headers',_0x1a1468);this['_inBody']=!![];}_0x466642++;}this['_localBuffer']=_0x14e148;}else{while((_0x469d2f=_0x14e148[_0x3f7a('0x7')](_0x58d8e7))!=-0x1){_0x2018f8=_0x14e148[_0x3f7a('0x8')](0x0,_0x469d2f);this[_0x3f7a('0xd')](_0x3f7a('0xe'),_0x2018f8);_0x14e148=_0x14e148[_0x3f7a('0x8')](_0x469d2f+_0x58d8e7['length']);}this[_0x3f7a('0x1')]=_0x14e148;}_0x72a19d();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 6fd9f70..b8ee7fe 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 _0x6dd9=['http','request','then','error','message','result','catch','ShowSquareProject','production','MailServerOut','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Intervals','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','jayson/promise'];(function(_0x5bb7ba,_0x330a53){var _0x1f3daa=function(_0x19479e){while(--_0x19479e){_0x5bb7ba['push'](_0x5bb7ba['shift']());}};_0x1f3daa(++_0x330a53);}(_0x6dd9,0x1c6));var _0x96dd=function(_0x147893,_0x4afae8){_0x147893=_0x147893-0x0;var _0x456c32=_0x6dd9[_0x147893];return _0x456c32;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x96dd('0x0'));var util=require('util');var jayson=require(_0x96dd('0x1'));var client=jayson['client'][_0x96dd('0x2')]({'port':0x2329});function request(_0x1901c1,_0x296afb){return new BPromise(function(_0xc989b5,_0x54c160){return client[_0x96dd('0x3')](_0x1901c1,_0x296afb)[_0x96dd('0x4')](function(_0x4b0f87){if(_0x4b0f87[_0x96dd('0x5')]){return _0x54c160(_0x4b0f87[_0x96dd('0x5')][_0x96dd('0x6')]);}else{return _0xc989b5(_0x4b0f87[_0x96dd('0x7')]);}})[_0x96dd('0x8')](function(_0x44081a){return _0x54c160(_0x44081a);});});}exports['getSquareProject']=function(_0x5a4c7d){return request(_0x96dd('0x9'),{'options':{'raw':![],'where':{'name':_0x5a4c7d},'attributes':[_0x96dd('0xa')]}});};exports['getMailAccountById']=function(_0x578b16){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x578b16},'include':[{'model':_0x96dd('0xb'),'as':'Smtp'}],'attributes':['id',_0x96dd('0xc'),'email']}});};exports[_0x96dd('0xd')]=function(_0x3a5b4a){return request(_0x96dd('0x9'),{'options':{'where':{'id':_0x3a5b4a},'attributes':[_0x96dd('0xc')]}});};exports[_0x96dd('0xe')]=function(_0x5d3237){return request(_0x96dd('0xf'),{'options':{'where':{'id':_0x5d3237},'attributes':[_0x96dd('0xc')]}});};exports[_0x96dd('0x10')]=function(_0x85ee26){return request(_0x96dd('0x11'),{'options':{'where':{'id':_0x85ee26},'attributes':['name']}});};exports[_0x96dd('0x12')]=function(_0x446716){return request(_0x96dd('0x13'),{'options':{'where':{'id':_0x446716},'attributes':[_0x96dd('0x14')]}});};exports[_0x96dd('0x15')]=function(_0x3d4634){return request(_0x96dd('0x16'),{'options':{'where':{'id':_0x3d4634},'attributes':['name']}});};exports[_0x96dd('0x17')]=function(_0x1eb1d7){return request(_0x96dd('0x18'),{'options':{'where':{'id':_0x1eb1d7},'attributes':['name']}});};exports[_0x96dd('0x19')]=function(_0x1058b1){return request(_0x96dd('0x1a'),{'options':{'where':{'id':_0x1058b1},'attributes':[_0x96dd('0x1b')]}});};exports[_0x96dd('0x1c')]=function(_0x4d492a){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x4d492a},'include':[{'model':'Interval','as':_0x96dd('0x1d')}]}});};exports['getSmsAccountById']=function(_0x5e1337){return request(_0x96dd('0x1e'),{'options':{'where':{'id':_0x5e1337},'attributes':['id',_0x96dd('0xc')]}});};exports[_0x96dd('0x1f')]=function(_0x27cbeb){return request('CreateSmsMessage',{'body':_0x27cbeb});};exports[_0x96dd('0x20')]=function(_0x88d61c){return request(_0x96dd('0x21'),{'body':_0x88d61c});};exports[_0x96dd('0x22')]=function(_0x2ece34){return request('CreateSquareReport',{'body':_[_0x96dd('0x23')](_0x2ece34,{'project_name':_0x2ece34[_0x96dd('0x24')],'prev_project_name':_0x2ece34['arg_2']||'','is_subproject':_0x2ece34[_0x96dd('0x25')]?!![]:![],'leaveAt':moment()[_0x96dd('0x26')](_0x96dd('0x27'))})});};exports[_0x96dd('0x28')]=function(_0x4a45f3){return request(_0x96dd('0x29'),{'body':_0x4a45f3});};exports[_0x96dd('0x2a')]=function(_0x2e6848){return request(_0x96dd('0x2b'),{'body':_0x2e6848});};exports[_0x96dd('0x2c')]=function(_0xdf2da3){return request(_0x96dd('0x2d'),{'options':{'raw':![],'where':{'phone':_0xdf2da3[_0x96dd('0x2e')],'ListId':_0xdf2da3['ListId']}}})[_0x96dd('0x4')](function(_0x55ac45){if(_0x55ac45){return _0x55ac45;}return request(_0x96dd('0x2f'),{'body':_0xdf2da3});});};exports['getPauseById']=function(_0x35d6db){return request(_0x96dd('0x30'),{'options':{'where':{'id':_0x35d6db},'attributes':[_0x96dd('0xc')]}});};exports[_0x96dd('0x31')]=function(_0x5039ae,_0x47678f){return request(_0x96dd('0x32'),{'body':{'interface':_0x47678f},'options':{'where':_0x5039ae}});};exports[_0x96dd('0x33')]=function(_0x5446dd,_0x226d14,_0x32d364){return request(_0x96dd('0x34'),{'body':{'type':_0x226d14,'uniqueid':_0x32d364},'options':{'where':_0x5446dd}});};exports[_0x96dd('0x35')]=function(_0x55b0c2){return request(_0x96dd('0x36'),{'body':{},'options':{'where':_0x55b0c2}});};exports[_0x96dd('0x37')]=function(_0x53d96f){return request(_0x96dd('0x38'),{'body':{},'options':{'where':_0x53d96f}});}; \ No newline at end of file +var _0x7a4f=['jayson/promise','client','http','request','error','catch','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','dsn','getUserById','getTrunkById','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','CreateSquareMessage','phone','ListId','then','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','moment','lodash','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7a4f,0x110));var _0xf7a4=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0x7a4f[_0x3e531a];return _0x3c2574;};'use strict';var BPromise=require('bluebird');var moment=require(_0xf7a4('0x0'));var _=require(_0xf7a4('0x1'));var util=require(_0xf7a4('0x2'));var jayson=require(_0xf7a4('0x3'));var client=jayson[_0xf7a4('0x4')][_0xf7a4('0x5')]({'port':0x2329});function request(_0x7ffc13,_0x55f595){return new BPromise(function(_0x23219f,_0x10a55c){return client[_0xf7a4('0x6')](_0x7ffc13,_0x55f595)['then'](function(_0x3bba04){if(_0x3bba04[_0xf7a4('0x7')]){return _0x10a55c(_0x3bba04[_0xf7a4('0x7')]['message']);}else{return _0x23219f(_0x3bba04['result']);}})[_0xf7a4('0x8')](function(_0x2652ab){return _0x10a55c(_0x2652ab);});});}exports[_0xf7a4('0x9')]=function(_0x2a359e){return request(_0xf7a4('0xa'),{'options':{'raw':![],'where':{'name':_0x2a359e},'attributes':['production']}});};exports[_0xf7a4('0xb')]=function(_0x6c35){return request(_0xf7a4('0xc'),{'options':{'raw':![],'where':{'id':_0x6c35},'include':[{'model':_0xf7a4('0xd'),'as':_0xf7a4('0xe')}],'attributes':['id',_0xf7a4('0xf'),_0xf7a4('0x10')]}});};exports['getSquareProjectById']=function(_0x3a7c6a){return request('ShowSquareProject',{'options':{'where':{'id':_0x3a7c6a},'attributes':[_0xf7a4('0xf')]}});};exports[_0xf7a4('0x11')]=function(_0x2c17e8){return request(_0xf7a4('0x12'),{'options':{'where':{'id':_0x2c17e8},'attributes':['name']}});};exports[_0xf7a4('0x13')]=function(_0x53a45a){return request(_0xf7a4('0x14'),{'options':{'where':{'id':_0x53a45a},'attributes':[_0xf7a4('0xf')]}});};exports['getSquareOdbcById']=function(_0x203025){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x203025},'attributes':[_0xf7a4('0x15')]}});};exports[_0xf7a4('0x16')]=function(_0xff2d1d){return request('ShowUser',{'options':{'where':{'id':_0xff2d1d},'attributes':[_0xf7a4('0xf')]}});};exports[_0xf7a4('0x17')]=function(_0x27685b){return request('ShowTrunk',{'options':{'where':{'id':_0x27685b},'attributes':[_0xf7a4('0xf')]}});};exports[_0xf7a4('0x18')]=function(_0x2d1e58){return request(_0xf7a4('0x19'),{'options':{'where':{'id':_0x2d1e58},'attributes':['save_name']}});};exports[_0xf7a4('0x1a')]=function(_0x2c4495){return request(_0xf7a4('0x1b'),{'options':{'raw':![],'where':{'id':_0x2c4495},'include':[{'model':_0xf7a4('0x1c'),'as':_0xf7a4('0x1d')}]}});};exports['getSmsAccountById']=function(_0x5b9b16){return request(_0xf7a4('0x1e'),{'options':{'where':{'id':_0x5b9b16},'attributes':['id','name']}});};exports[_0xf7a4('0x1f')]=function(_0x45b6a2){return request(_0xf7a4('0x20'),{'body':_0x45b6a2});};exports['createSquareDetailsReport']=function(_0x44d869){return request(_0xf7a4('0x21'),{'body':_0x44d869});};exports[_0xf7a4('0x22')]=function(_0x593129){return request(_0xf7a4('0x23'),{'body':_[_0xf7a4('0x24')](_0x593129,{'project_name':_0x593129[_0xf7a4('0x25')],'prev_project_name':_0x593129[_0xf7a4('0x26')]||'','is_subproject':_0x593129[_0xf7a4('0x26')]?!![]:![],'leaveAt':moment()[_0xf7a4('0x27')](_0xf7a4('0x28'))})});};exports['createSquareRecording']=function(_0x4fb2b2){return request(_0xf7a4('0x29'),{'body':_0x4fb2b2});};exports['createSquareMessage']=function(_0x2c3522){return request(_0xf7a4('0x2a'),{'body':_0x2c3522});};exports['createCmContact']=function(_0x4a51a0){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4a51a0[_0xf7a4('0x2b')],'ListId':_0x4a51a0[_0xf7a4('0x2c')]}}})[_0xf7a4('0x2d')](function(_0x3ae346){if(_0x3ae346){return _0x3ae346;}return request('CreateCmContact',{'body':_0x4a51a0});});};exports[_0xf7a4('0x2e')]=function(_0x1ecfc5){return request(_0xf7a4('0x2f'),{'options':{'where':{'id':_0x1ecfc5},'attributes':[_0xf7a4('0xf')]}});};exports[_0xf7a4('0x30')]=function(_0x11d3c9,_0x352a2c){return request(_0xf7a4('0x31'),{'body':{'interface':_0x352a2c},'options':{'where':_0x11d3c9}});};exports[_0xf7a4('0x32')]=function(_0x42f07f,_0x1a7a44,_0x1cde5){return request(_0xf7a4('0x33'),{'body':{'type':_0x1a7a44,'uniqueid':_0x1cde5},'options':{'where':_0x42f07f}});};exports[_0xf7a4('0x34')]=function(_0x468fee){return request(_0xf7a4('0x35'),{'body':{},'options':{'where':_0x468fee}});};exports['agentLogout']=function(_0x5d0f7b){return request(_0xf7a4('0x36'),{'body':{},'options':{'where':_0x5d0f7b}});}; \ 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 5c3c498..e5e6b18 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 _0xe978=['exports','./polly','./lex'];(function(_0x200ced,_0x503efa){var _0x28e175=function(_0x450010){while(--_0x450010){_0x200ced['push'](_0x200ced['shift']());}};_0x28e175(++_0x503efa);}(_0xe978,0x70));var _0x8e97=function(_0x7f6b75,_0x2d4175){_0x7f6b75=_0x7f6b75-0x0;var _0x10b834=_0xe978[_0x7f6b75];return _0x10b834;};var polly=require(_0x8e97('0x0'));var lex=require(_0x8e97('0x1'));module[_0x8e97('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xb931=['exports'];(function(_0x36af92,_0xbcd703){var _0x466599=function(_0x15cd0d){while(--_0x15cd0d){_0x36af92['push'](_0x36af92['shift']());}};_0x466599(++_0xbcd703);}(_0xb931,0x155));var _0x1b93=function(_0x193001,_0xfb3170){_0x193001=_0x193001-0x0;var _0x5ef4ca=_0xb931[_0x193001];return _0x5ef4ca;};var polly=require('./polly');var lex=require('./lex');module[_0x1b93('0x0')]={'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 5a415e8..7b4c955 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4483=['exports','./lib/api'];(function(_0x2651a9,_0x31dc2d){var _0xff12d3=function(_0x2f579d){while(--_0x2f579d){_0x2651a9['push'](_0x2651a9['shift']());}};_0xff12d3(++_0x31dc2d);}(_0x4483,0x1a3));var _0x3448=function(_0x2d5be0,_0x35c601){_0x2d5be0=_0x2d5be0-0x0;var _0x5e9a30=_0x4483[_0x2d5be0];return _0x5e9a30;};'use strict';var lex=require(_0x3448('0x0'));module[_0x3448('0x1')]=function(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178){return lex(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178);}; \ No newline at end of file +var _0x6f7a=['./lib/api','exports'];(function(_0xeef1f9,_0x572535){var _0x47fd1c=function(_0x754cb8){while(--_0x754cb8){_0xeef1f9['push'](_0xeef1f9['shift']());}};_0x47fd1c(++_0x572535);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x2daac8,_0x32b7f2){_0x2daac8=_0x2daac8-0x0;var _0x1aebaa=_0x6f7a[_0x2daac8];return _0x1aebaa;};'use strict';var lex=require(_0xa6f7('0x0'));module[_0xa6f7('0x1')]=function(_0x205e14,_0x982062,_0x4dd99d,_0x93614a,_0x407de3,_0x12ecb8){return lex(_0x205e14,_0x982062,_0x4dd99d,_0x93614a,_0x407de3,_0x12ecb8);}; \ 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 96d576e..58851a6 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(_0x1bb831,_0x5d76be){var _0x4a94af=function(_0x553e61){while(--_0x553e61){_0x1bb831['push'](_0x1bb831['shift']());}};_0x4a94af(++_0x5d76be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0xb5a561,_0x2d4110){var _0x30737e=function(_0x18dc3f){while(--_0x18dc3f){_0xb5a561['push'](_0xb5a561['shift']());}};_0x30737e(++_0x2d4110);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 bea5e3a..e088c34 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. * // * * // ************************************************************************* -'use strict';var polly=require('./lib/api');module['exports']=function(_0x39e9b9,_0x240af5,_0x2a58c0,_0x359f3b,_0xb0fbfc,_0x151d12,_0x17f959){return polly(_0x39e9b9,_0x240af5,_0x2a58c0,_0x359f3b,_0xb0fbfc,_0x151d12,_0x17f959);}; \ No newline at end of file +var _0xb246=['./lib/api','exports'];(function(_0x4b332a,_0x5ec2db){var _0x115a04=function(_0x422160){while(--_0x422160){_0x4b332a['push'](_0x4b332a['shift']());}};_0x115a04(++_0x5ec2db);}(_0xb246,0x6e));var _0x6b24=function(_0xc70ff5,_0x1f8a90){_0xc70ff5=_0xc70ff5-0x0;var _0x3f84b4=_0xb246[_0xc70ff5];return _0x3f84b4;};'use strict';var polly=require(_0x6b24('0x0'));module[_0x6b24('0x1')]=function(_0x3b3046,_0x163144,_0x13d5d1,_0x434ba1,_0x4f5a8d,_0x427a50,_0x126e8c){return polly(_0x3b3046,_0x163144,_0x13d5d1,_0x434ba1,_0x4f5a8d,_0x427a50,_0x126e8c);}; \ 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 6c1cc29..a1546c1 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 _0xbcfd=['exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xbcfd,0xa0));var _0xdbcf=function(_0xfe57a8,_0x5bc623){_0xfe57a8=_0xfe57a8-0x0;var _0x243c8c=_0xbcfd[_0xfe57a8];return _0x243c8c;};'use strict';var fs=require('fs');var path=require(_0xdbcf('0x0'));var BPromise=require(_0xdbcf('0x1'));var rs=require(_0xdbcf('0x2'));var AWS=require(_0xdbcf('0x3'));function pollyResult(_0xb76611,_0x571a88,_0x5e117e){return new BPromise(function(_0xa12756,_0x4787e7){_0xb76611[_0xdbcf('0x4')](_0x571a88,function(_0x558abd,_0x4c7ff8){if(_0x558abd){_0x4787e7(_0x558abd);}else if(_0x4c7ff8){if(_0x4c7ff8[_0xdbcf('0x5')]instanceof Buffer){fs[_0xdbcf('0x6')](_0x5e117e,_0x4c7ff8['AudioStream'],function(_0x2fbfe4){if(_0x2fbfe4){_0x4787e7(_0x2fbfe4);}else{_0xa12756();}});}else{_0x4787e7(new Error(_0xdbcf('0x7')));}}else{_0x4787e7(new Error(_0xdbcf('0x8')));}});});}module[_0xdbcf('0x9')]=function(_0x5309ec,_0x30ab5f,_0x1acd53,_0x4d6eaa,_0x5a621b,_0x3fd529,_0x111f49){var _0x54bf93=new AWS[(_0xdbcf('0xa'))]({'accessKeyId':_0x5309ec,'secretAccessKey':_0x30ab5f,'region':_0x1acd53});var _0x5a0f97={'Text':_0x5a621b,'TextType':_0x3fd529||_0xdbcf('0xb'),'OutputFormat':_0xdbcf('0xc'),'VoiceId':_0x4d6eaa};return pollyResult(_0x54bf93,_0x5a0f97,_0x111f49);}; \ No newline at end of file +var _0x7a21=['path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3'];(function(_0x570869,_0x173eef){var _0x128d31=function(_0x396665){while(--_0x396665){_0x570869['push'](_0x570869['shift']());}};_0x128d31(++_0x173eef);}(_0x7a21,0x18c));var _0x17a2=function(_0x3ea4fc,_0x17ba77){_0x3ea4fc=_0x3ea4fc-0x0;var _0x50d181=_0x7a21[_0x3ea4fc];return _0x50d181;};'use strict';var fs=require('fs');var path=require(_0x17a2('0x0'));var BPromise=require(_0x17a2('0x1'));var rs=require(_0x17a2('0x2'));var AWS=require(_0x17a2('0x3'));function pollyResult(_0x5cb59d,_0x27ebab,_0x51906b){return new BPromise(function(_0x238643,_0x420fd3){_0x5cb59d[_0x17a2('0x4')](_0x27ebab,function(_0x4e1501,_0x1f8b8b){if(_0x4e1501){_0x420fd3(_0x4e1501);}else if(_0x1f8b8b){if(_0x1f8b8b['AudioStream']instanceof Buffer){fs['writeFile'](_0x51906b,_0x1f8b8b[_0x17a2('0x5')],function(_0x45a7f9){if(_0x45a7f9){_0x420fd3(_0x45a7f9);}else{_0x238643();}});}else{_0x420fd3(new Error(_0x17a2('0x6')));}}else{_0x420fd3(new Error(_0x17a2('0x7')));}});});}module[_0x17a2('0x8')]=function(_0x3c212e,_0x443c22,_0x196cf8,_0x1c46e4,_0x2ea836,_0x4dc416,_0x366474){var _0x51559f=new AWS[(_0x17a2('0x9'))]({'accessKeyId':_0x3c212e,'secretAccessKey':_0x443c22,'region':_0x196cf8});var _0x113b3f={'Text':_0x2ea836,'TextType':_0x4dc416||_0x17a2('0xa'),'OutputFormat':_0x17a2('0xb'),'VoiceId':_0x1c46e4};return pollyResult(_0x51559f,_0x113b3f,_0x366474);}; \ 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 7c61fd7..6e4bcc1 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 _0x6d0e=['./lib/api'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6d0e,0xc6));var _0xe6d0=function(_0x3b09be,_0x163cf5){_0x3b09be=_0x3b09be-0x0;var _0x3596f3=_0x6d0e[_0x3b09be];return _0x3596f3;};'use strict';var asr=require(_0xe6d0('0x0'));module['exports']=function(_0x47c041,_0x31f7d8,_0x3a640b,_0x5d1a64){return asr(_0x47c041,_0x31f7d8,_0x3a640b);}; \ No newline at end of file +var _0x2dce=['./lib/api','exports'];(function(_0x37dae5,_0x4c168a){var _0x473be3=function(_0x382133){while(--_0x382133){_0x37dae5['push'](_0x37dae5['shift']());}};_0x473be3(++_0x4c168a);}(_0x2dce,0x1e8));var _0xe2dc=function(_0x4fb135,_0x5a30f2){_0x4fb135=_0x4fb135-0x0;var _0x2ea2b3=_0x2dce[_0x4fb135];return _0x2ea2b3;};'use strict';var asr=require(_0xe2dc('0x0'));module[_0xe2dc('0x1')]=function(_0x4f5f3b,_0x95a9e0,_0x26c1ec,_0x588642){return asr(_0x4f5f3b,_0x95a9e0,_0x26c1ec);}; \ 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 b1f6976..06b0161 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 _0x6c50=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','LINEAR16','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x31bfee,_0x5e7b65){var _0x4fe58e=function(_0x52f282){while(--_0x52f282){_0x31bfee['push'](_0x31bfee['shift']());}};_0x4fe58e(++_0x5e7b65);}(_0x6c50,0xa4));var _0x06c5=function(_0x19ab82,_0xd81a9b){_0x19ab82=_0x19ab82-0x0;var _0x3c5d89=_0x6c50[_0x19ab82];return _0x3c5d89;};'use strict';var url=require(_0x06c5('0x0'));var BPromise=require(_0x06c5('0x1'));var fs=require('fs');var host=_0x06c5('0x2');module[_0x06c5('0x3')]=function(_0x495adf,_0xd66539,_0x494494){return new BPromise(function(_0x4271d1,_0x2853be){var _0x434003;if(typeof _0x495adf!==_0x06c5('0x4')||_0x495adf[_0x06c5('0x5')]===0x0){return _0x2853be(_0x06c5('0x6'));}if(typeof _0xd66539!==_0x06c5('0x4')||_0xd66539[_0x06c5('0x5')]===0x0){return _0x2853be(_0x06c5('0x7'));}if(typeof _0x494494!==_0x06c5('0x8')&&(typeof _0x494494!==_0x06c5('0x4')||_0x494494['length']===0x0)){return _0x2853be(_0x06c5('0x9'));}try{_0x434003=fs[_0x06c5('0xa')](_0x495adf)[_0x06c5('0xb')](_0x06c5('0xc'));}catch(_0x4e863c){return _0x2853be(_0x4e863c);}return _0x4271d1({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0xd66539,'body':{'config':{'encoding':_0x06c5('0xd'),'sampleRateHertz':'8000','languageCode':_0x494494},'audio':{'content':_0x434003}},'json':!![]});});}; \ No newline at end of file +var _0xecd5=['/v1/speech:recognize?key=','LINEAR16','bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','length','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST'];(function(_0x2e8e8d,_0x4d8a72){var _0x138f82=function(_0x3ce7c2){while(--_0x3ce7c2){_0x2e8e8d['push'](_0x2e8e8d['shift']());}};_0x138f82(++_0x4d8a72);}(_0xecd5,0x110));var _0x5ecd=function(_0x13132b,_0x50142e){_0x13132b=_0x13132b-0x0;var _0x4b7c08=_0xecd5[_0x13132b];return _0x4b7c08;};'use strict';var url=require('url');var BPromise=require(_0x5ecd('0x0'));var fs=require('fs');var host=_0x5ecd('0x1');module[_0x5ecd('0x2')]=function(_0x4e96ee,_0x982997,_0x23f625){return new BPromise(function(_0x469fd0,_0x458bb3){var _0x516d8e;if(typeof _0x4e96ee!==_0x5ecd('0x3')||_0x4e96ee['length']===0x0){return _0x458bb3(_0x5ecd('0x4'));}if(typeof _0x982997!==_0x5ecd('0x3')||_0x982997['length']===0x0){return _0x458bb3(_0x5ecd('0x5'));}if(typeof _0x23f625!==_0x5ecd('0x6')&&(typeof _0x23f625!==_0x5ecd('0x3')||_0x23f625[_0x5ecd('0x7')]===0x0)){return _0x458bb3(_0x5ecd('0x8'));}try{_0x516d8e=fs[_0x5ecd('0x9')](_0x4e96ee)[_0x5ecd('0xa')](_0x5ecd('0xb'));}catch(_0x340c6b){return _0x458bb3(_0x340c6b);}return _0x469fd0({'method':_0x5ecd('0xc'),'uri':host+_0x5ecd('0xd')+_0x982997,'body':{'config':{'encoding':_0x5ecd('0xe'),'sampleRateHertz':'8000','languageCode':_0x23f625},'audio':{'content':_0x516d8e}},'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 d1e9d5e..218331e 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 _0x07b2=['exports','./asr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07b2,0x18d));var _0x207b=function(_0x32f0bf,_0x528534){_0x32f0bf=_0x32f0bf-0x0;var _0xcb4c4f=_0x07b2[_0x32f0bf];return _0xcb4c4f;};var asr=require(_0x207b('0x0'));module[_0x207b('0x1')]={'asr':asr}; \ No newline at end of file +var _0x000b=['./asr','exports'];(function(_0x4ecd53,_0xc9af83){var _0x3c2427=function(_0x577f99){while(--_0x577f99){_0x4ecd53['push'](_0x4ecd53['shift']());}};_0x3c2427(++_0xc9af83);}(_0x000b,0x8a));var _0xb000=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x000b[_0x4aba15];return _0x1c8122;};var asr=require(_0xb000('0x0'));module[_0xb000('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index a10ed3c..2b58aed 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 _0x95a8=['sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','protocol','WHAT_EVER','data','end','wav','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','ssml','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','resolve','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','polly','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x95a8,0x1a6));var _0x895a=function(_0x83f8c4,_0x450c4b){_0x83f8c4=_0x83f8c4-0x0;var _0x1cf945=_0x95a8[_0x83f8c4];return _0x1cf945;};'use strict';var apiai=require(_0x895a('0x0'));var BPromise=require(_0x895a('0x1'));var dialogflow=require(_0x895a('0x2'));var fs=require('fs');var http=require(_0x895a('0x3'));var https=require(_0x895a('0x4'));var md5=require(_0x895a('0x5'));var path=require(_0x895a('0x6'));var querystring=require(_0x895a('0x7'));var rp=require(_0x895a('0x8'));var rs=require(_0x895a('0x9'));var sox=require(_0x895a('0xa'));var tts=require('google-tts-api');var urlParse=require(_0x895a('0xb'))[_0x895a('0xc')];var util=require(_0x895a('0xd'));var aws=require(_0x895a('0xe'));var google=require(_0x895a('0xf'));var sestek=require(_0x895a('0x10'));var tilde=require(_0x895a('0x11'));var logger=require(_0x895a('0x12'))(_0x895a('0x13'));var ISPEECH_API=_0x895a('0x14');function downloadFile(_0x27ff82,_0x236805){return new BPromise(function(_0x521bda,_0xdcf792){var _0x15f27b=urlParse(_0x27ff82);var _0x25f37c=_0x15f27b['protocol']===_0x895a('0x15')?https:http;var _0x22f7bf={'host':_0x15f27b[_0x895a('0x16')],'path':_0x15f27b[_0x895a('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x25f37c[_0x895a('0x17')](_0x22f7bf,function(_0x3ada3a){if(_0x3ada3a[_0x895a('0x18')]!==0xc8){logger[_0x895a('0x19')](_0x895a('0x1a')+_0x27ff82+'\x20failed,\x20status\x20code\x20=\x20'+_0x3ada3a[_0x895a('0x18')]+'\x20('+_0x3ada3a['statusMessage']+')');_0xdcf792(new Error(_0x895a('0x1a')+_0x27ff82+_0x895a('0x1b')+_0x3ada3a[_0x895a('0x18')]+'\x20('+_0x3ada3a['statusMessage']+')'));return;}var _0x178398=fs[_0x895a('0x1c')](_0x236805);_0x178398['on'](_0x895a('0x1d'),function(){logger[_0x895a('0x1e')](_0x895a('0x1f'));_0x178398[_0x895a('0x20')](_0x521bda);});_0x178398['on'](_0x895a('0x19'),function(_0x41398d){fs[_0x895a('0x21')](_0x236805);logger[_0x895a('0x19')](_0x895a('0x22'),_0x41398d);_0xdcf792(_0x41398d);});_0x3ada3a[_0x895a('0x23')](_0x178398);})['on'](_0x895a('0x19'),function(_0x400fcf){logger['error'](_0x400fcf);_0xdcf792(_0x400fcf);})['end']();});}function uploadFile(_0x2089ed){return new BPromise(function(_0x5126de,_0x11d929){var _0x3a9e98=urlParse(_0x2089ed);var _0x29206b=_0x3a9e98[_0x895a('0x24')]===_0x895a('0x15')?https:http;var _0xfbfde7={'host':_0x3a9e98[_0x895a('0x16')],'path':_0x3a9e98[_0x895a('0x6')],'headers':{'user-agent':_0x895a('0x25')}};_0x29206b[_0x895a('0x17')](_0xfbfde7,function(_0x5c43f5){if(_0x5c43f5[_0x895a('0x18')]!==0xc8){_0x11d929(new Error(_0x895a('0x1a')+_0x2089ed+'\x20failed,\x20status\x20code\x20=\x20'+_0x5c43f5[_0x895a('0x18')]+'\x20('+_0x5c43f5['statusMessage']+')'));return;}var _0xadaee5='';_0x5c43f5['on'](_0x895a('0x26'),function(_0x6760bd){_0xadaee5+=_0x6760bd;});_0x5c43f5['on']('end',function(){_0x5126de(_0xadaee5);});})['on'](_0x895a('0x19'),function(_0x1748bb){_0x11d929(_0x1748bb);})[_0x895a('0x27')]();});}function convertFile(_0xec8298,_0x210d3f){return new BPromise(function(_0x55b52f,_0xc94ab7){var _0x1cefc6=sox['transcode'](_0xec8298,_0x210d3f,{'sampleRate':0x1f40,'format':_0x895a('0x28'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1cefc6['on']('error',function(_0x57a019){logger['error']('error\x20convert',_0x57a019);_0xc94ab7(_0x57a019);});_0x1cefc6['on'](_0x895a('0x27'),function(){logger[_0x895a('0x1e')]('finish\x20to\x20convert');_0x55b52f();});_0x1cefc6[_0x895a('0x29')]();});}function base64Decode(_0x3760a6,_0x1c480e){var _0x6d98d2=path['resolve'](__dirname,_0x895a('0x2a'),rs[_0x895a('0x2b')](0x4)+_0x895a('0x2c'));fs[_0x895a('0x2d')](_0x6d98d2,_0x3760a6,_0x895a('0x2e'));return convertFile(_0x6d98d2,_0x1c480e)[_0x895a('0x2f')](function(){try{fs['unlink'](_0x6d98d2);fs[_0x895a('0x30')](_0x1c480e,_0x895a('0x31'));}catch(_0x52ff31){logger[_0x895a('0x19')](_0x52ff31);}return _0x1c480e[_0x895a('0x32')]('.')[0x0];});}function base64Encode(_0x328426){var _0xc701f5=fs[_0x895a('0x33')](_0x328426);return new Buffer(_0xc701f5)[_0x895a('0x34')]('base64');}exports['googleCloudTTS']=function(_0x4296ec,_0x12c392,_0x27bd8a,_0x23b8b0,_0x362431,_0x28ae67){var _0x3fedd4,_0x33fc14;var _0x131e21=_0x895a('0x35');var _0x30b5eb='?key='+_0x4296ec;var _0x3d1574={};if(_0x12c392===_0x895a('0x36')){_0x3d1574['input']={'ssml':_0x27bd8a};}else{_0x3d1574['input']={'text':_0x27bd8a};};_0x3d1574[_0x895a('0x37')]={'languageCode':_0x23b8b0,'ssmlGender':_0x362431};_0x3d1574[_0x895a('0x38')]={'audioEncoding':_0x895a('0x39'),'sampleRateHertz':0x1f40};var _0x2db5ff={'url':_0x131e21+_0x895a('0x3a')+_0x30b5eb,'method':_0x895a('0x3b'),'json':!![],'body':_0x3d1574};return rp(_0x2db5ff)[_0x895a('0x2f')](function(_0x331f09){return new BPromise(function(_0x2a5464,_0x1a06b0){_0x3fedd4=path['resolve'](__dirname,'tmp',rs[_0x895a('0x2b')](0x4)+_0x895a('0x3c'));var _0x520826=Buffer[_0x895a('0x3d')](_0x331f09[_0x895a('0x3e')],_0x895a('0x2e'));return fs[_0x895a('0x3f')](_0x3fedd4,_0x520826,function(_0x3b9346){_0x1a06b0(_0x3b9346);},function(_0xaedec5){fs[_0x895a('0x30')](_0x3fedd4,_0x895a('0x31'));_0x2a5464(_0xaedec5);});});})['then'](function(_0x16054f){_0x33fc14=path[_0x895a('0x40')](__dirname,_0x895a('0x2a'),rs['generate'](0x4)+_0x895a('0x2c'));return convertFile(_0x3fedd4,_0x33fc14);})['then'](function(){try{fs[_0x895a('0x21')](_0x3fedd4);fs['chmodSync'](_0x33fc14,_0x895a('0x31'));}catch(_0x47a3e3){logger[_0x895a('0x19')](_0x47a3e3);}logger[_0x895a('0x1e')]('googleCloudTTS\x20path',_0x33fc14[_0x895a('0x32')]('.')[0x0]);return _0x33fc14['split']('.')[0x0];});};exports[_0x895a('0x41')]=function(_0x3d9ecc,_0x518046){var _0x523945=_0x895a('0x42');var _0xf1e083,_0x2fe5ca;var _0x2fcfce;var _0x36269b={'encoding':_0x895a('0x43'),'method':_0x895a('0x3b'),'timeout':0x2710,'url':_0x523945,'headers':{'Content-Type':_0x895a('0x44')},'body':_0x895a('0x45')+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0x895a('0x46')]([_0x3d9ecc,_0x518046||'en',![],_0x895a('0x47')]),null,_0x895a('0x48')]]]))};return rp(_0x36269b)['then'](function(_0x174dae){try{_0x2fcfce=eval(_0x174dae[_0x895a('0x49')](0x5))[0x0][0x2];}catch(_0x5b4835){throw new Error(_0x895a('0x4a')+_0x174dae[_0x895a('0x26')]);}if(!_0x2fcfce){if(_0x3d9ecc[_0x895a('0x4b')]>0xc8){throw new Error(_0x895a('0x4c'));}else{throw new Error('lang\x20\x22'+_0x518046+_0x895a('0x4d'));}}try{_0x2fcfce=eval(_0x2fcfce)[0x0];}catch(_0x55a6fc){throw new Error(_0x895a('0x4a')+res[_0x895a('0x26')]);}const _0x168f0d=_0x2fcfce;_0xf1e083=path[_0x895a('0x40')](__dirname,_0x895a('0x2a'),rs[_0x895a('0x2b')](0x4)+_0x895a('0x3c'));fs['writeFileSync'](_0xf1e083,_0x2fcfce,{'encoding':_0x895a('0x2e')});_0x2fe5ca=path[_0x895a('0x40')](__dirname,_0x895a('0x2a'),rs['generate'](0x4)+_0x895a('0x2c'));return convertFile(_0xf1e083,_0x2fe5ca);})[_0x895a('0x2f')](function(){try{fs[_0x895a('0x21')](_0xf1e083);fs['chmodSync'](_0x2fe5ca,'777');}catch(_0x28c526){logger[_0x895a('0x19')](_0x28c526);}logger['info']('goggleTTS\x20path',_0x2fe5ca['split']('.')[0x0]);return _0x2fe5ca[_0x895a('0x32')]('.')[0x0];});};exports[_0x895a('0x4e')]=function(_0x36b1c1,_0x1b234e,_0x328ddf){return google[_0x895a('0x4f')](_0x36b1c1,_0x1b234e,_0x328ddf)[_0x895a('0x2f')](function(_0x37baef){logger[_0x895a('0x1e')](_0x37baef[_0x895a('0x50')]);return rp(_0x37baef);})['then'](function(_0x23c75e){var _0x12923c='';var _0xe0794b=0x0;try{fs[_0x895a('0x21')](_0x36b1c1);}catch(_0x35a979){logger['error'](_0x35a979);}if(_0x23c75e&&_0x23c75e['results']){_0x12923c=_0x23c75e[_0x895a('0x51')][_0x895a('0x52')](function(_0x5e2f92){return _0x5e2f92&&_0x5e2f92[_0x895a('0x53')][0x0]&&_0x5e2f92[_0x895a('0x53')][0x0][_0x895a('0x54')]?_0x5e2f92['alternatives'][0x0][_0x895a('0x54')]:'';})[_0x895a('0x55')]('\x0a');_0xe0794b=_0x23c75e[_0x895a('0x51')][_0x895a('0x52')](function(_0x3e6646){return _0x3e6646&&_0x3e6646[_0x895a('0x53')][0x0]&&_0x3e6646[_0x895a('0x53')][0x0][_0x895a('0x56')]?_0x3e6646[_0x895a('0x53')][0x0]['confidence']:0x0;})[_0x895a('0x55')]('\x0a');}logger[_0x895a('0x1e')](_0x895a('0x57'),_0x12923c);logger[_0x895a('0x1e')](_0x895a('0x58'),_0xe0794b);return{'transcript':_0x12923c,'confidence':_0xe0794b};})['catch'](function(_0x3e019b){logger[_0x895a('0x19')](_0x895a('0x59'),_0x3e019b['statusCode'],_0x3e019b[_0x895a('0x5a')],_0x3e019b['message']);});};exports[_0x895a('0x5b')]=function(_0x304c7d,_0x597f62,_0xd18a35,_0x1bd6b4){var _0x2c1680=apiai(_0x597f62,{'language':_0x1bd6b4||'en'});return _0x2c1680[_0x895a('0x5c')](_0xd18a35,{'sessionId':md5(_0x304c7d)})[_0x895a('0x2f')](function(_0x2ed630){logger[_0x895a('0x1e')](JSON['stringify'](_0x2ed630));return{'source':_0x2ed630[_0x895a('0x5d')][_0x895a('0x5e')],'resolvedQuery':_0x2ed630['result'][_0x895a('0x5f')],'action':_0x2ed630[_0x895a('0x5d')][_0x895a('0x60')],'actionIncomplete':_0x2ed630[_0x895a('0x5d')][_0x895a('0x61')],'speech':_0x2ed630[_0x895a('0x5d')][_0x895a('0x62')][_0x895a('0x63')],'score':_0x2ed630['result'][_0x895a('0x64')],'statusCode':_0x2ed630['status'][_0x895a('0x65')],'endConversation':_0x2ed630[_0x895a('0x5d')][_0x895a('0x66')][_0x895a('0x67')]||![],'isFallbackIntent':_0x2ed630[_0x895a('0x5d')][_0x895a('0x66')]['isFallbackIntent']};});};exports[_0x895a('0x68')]=function(_0x1aa731,_0x129163,_0x4bca86,_0x32a464,_0x488acc,_0x3fa13e){var _0x2446d1=_0x32a464[_0x895a('0x69')](/\\n/g,'\x0a');var _0x2a4bed={'credentials':{'private_key':_0x2446d1,'client_email':_0x4bca86}};var _0x5190f0=new dialogflow[(_0x895a('0x6a'))](_0x2a4bed);var _0x5ec8cb=_0x5190f0[_0x895a('0x6b')](_0x129163,md5(_0x1aa731));var _0x7fc17b={'session':_0x5ec8cb,'queryInput':{'text':{'text':_0x488acc,'languageCode':_0x3fa13e}}};return _0x5190f0[_0x895a('0x6c')](_0x7fc17b)[_0x895a('0x2f')](function(_0x592684){if(_0x592684&&_0x592684[_0x895a('0x4b')]){logger[_0x895a('0x1e')]('Dialogflow\x20V2\x20response:',JSON[_0x895a('0x46')](_0x592684));var _0x262926=_0x592684[0x0];if(_0x262926){var _0x38194a={'action':_0x262926[_0x895a('0x6d')][_0x895a('0x60')],'allRequiredParamsPresent':_0x262926[_0x895a('0x6d')]['allRequiredParamsPresent'],'endConversation':_0x262926['queryResult'][_0x895a('0x6e')]&&_0x262926[_0x895a('0x6d')]['diagnosticInfo'][_0x895a('0x6f')]?_0x262926[_0x895a('0x6d')]['diagnosticInfo'][_0x895a('0x6f')][_0x895a('0x70')][_0x895a('0x71')]:![],'fulfillmentText':_0x262926['queryResult'][_0x895a('0x72')],'intentName':_0x262926[_0x895a('0x6d')]['intent'][_0x895a('0x5a')],'intentDisplayName':_0x262926[_0x895a('0x6d')][_0x895a('0x73')]['displayName'],'isFallbackIntent':_0x262926['queryResult'][_0x895a('0x73')][_0x895a('0x74')],'languageCode':_0x262926[_0x895a('0x6d')][_0x895a('0x75')],'queryText':_0x262926[_0x895a('0x6d')][_0x895a('0x76')],'responseId':_0x262926['responseId'],'score':_0x262926[_0x895a('0x6d')][_0x895a('0x77')],'speech':_0x262926[_0x895a('0x6d')][_0x895a('0x72')],'providerResponse':JSON[_0x895a('0x46')](_0x592684)};return _0x38194a;}}});};exports[_0x895a('0x78')]=function(_0x9f3995,_0x2f4a83,_0x40fd9c,_0xeff263){return tilde[_0x895a('0x4f')](_0x9f3995,_0x2f4a83,_0x40fd9c,_0xeff263)[_0x895a('0x2f')](function(_0x58367e){try{fs[_0x895a('0x21')](_0x9f3995);}catch(_0x4ced0d){logger[_0x895a('0x19')](_0x4ced0d);}logger[_0x895a('0x1e')]('Tilde\x20ASR\x20transcription',_0x58367e[_0x895a('0x54')]);logger['info']('Tilde\x20ASR\x20confidence',_0x58367e[_0x895a('0x56')]);return _0x58367e;});};exports['awsPolly']=function(_0xf1b204,_0x5d850d,_0x1f155d,_0x26fabd,_0x25ef65,_0x48ec1d){var _0x324d24=path[_0x895a('0x40')](__dirname,_0x895a('0x2a'),rs[_0x895a('0x2b')](0x4)+_0x895a('0x3c'));var _0x5cab03;return aws[_0x895a('0x79')](_0xf1b204,_0x5d850d,_0x1f155d,_0x26fabd,_0x25ef65,_0x48ec1d,_0x324d24)[_0x895a('0x2f')](function(){_0x5cab03=path[_0x895a('0x40')](__dirname,'tmp',rs[_0x895a('0x2b')](0x4)+'.wav');return convertFile(_0x324d24,_0x5cab03);})['then'](function(){try{fs['unlink'](_0x324d24);fs['chmodSync'](_0x5cab03,_0x895a('0x31'));}catch(_0x2a93d0){logger['error'](_0x2a93d0);}return _0x5cab03[_0x895a('0x32')]('.')[0x0];});};exports['awsLex']=function(_0x2881b0,_0x51d656,_0xe8d045,_0x1a7a73,_0x499400,_0x2c774f){return aws[_0x895a('0x7a')](_0x2881b0,_0x51d656,_0xe8d045,_0x1a7a73,_0x499400,_0x2c774f)[_0x895a('0x2f')](function(_0x4ff8b3){logger['info'](JSON[_0x895a('0x46')](_0x4ff8b3));return _0x4ff8b3;});};exports[_0x895a('0x7b')]=function(_0x2be10e,_0x9bd868,_0xb8b99c,_0x1fee9a){var _0x5814bc=util['format'](_0x895a('0x7c'),ISPEECH_API,_0x2be10e,encodeURIComponent(_0x9bd868),_0xb8b99c,_0x1fee9a);var _0x1c252a=path[_0x895a('0x40')](__dirname,_0x895a('0x2a'),rs[_0x895a('0x2b')](0x4)+'.mp3');var _0x298531;return downloadFile(_0x5814bc,_0x1c252a)[_0x895a('0x2f')](function(){_0x298531=path[_0x895a('0x40')](__dirname,_0x895a('0x2a'),rs['generate'](0x4)+_0x895a('0x2c'));return convertFile(_0x1c252a,_0x298531);})[_0x895a('0x2f')](function(){try{fs[_0x895a('0x21')](_0x1c252a);fs['chmodSync'](_0x298531,'777');}catch(_0x4e1a52){logger[_0x895a('0x19')](_0x4e1a52);}return _0x298531[_0x895a('0x32')]('.')[0x0];});};exports[_0x895a('0x7d')]=function(_0x3d5601,_0x18825b,_0x436062,_0x14ae75){var _0x4ec9e9=util[_0x895a('0x7e')](_0x895a('0x7f'),ISPEECH_API,_0x18825b,_0x436062,base64Encode(_0x3d5601),_0x14ae75?util[_0x895a('0x7e')](_0x895a('0x80'),encodeURIComponent(_0x14ae75)):_0x895a('0x81'));return uploadFile(_0x4ec9e9)['then'](function(_0x2c32ed){return querystring[_0x895a('0xc')](_0x2c32ed);});};exports[_0x895a('0x82')]=function(_0x509438,_0x5251c3){return sestek['nda'](_0x509438,_0x5251c3)[_0x895a('0x2f')](function(_0x32e8d2){logger['info'](JSON[_0x895a('0x46')](_0x32e8d2));var _0x2ec3b2={'speech':_0x32e8d2[_0x895a('0x83')],'action':_0x32e8d2[_0x895a('0x84')]?_0x32e8d2[_0x895a('0x84')][_0x895a('0x85')]:undefined,'actiondata':_0x32e8d2[_0x895a('0x84')]?_0x32e8d2['channelData'][_0x895a('0x86')]:undefined};if(_0x32e8d2[_0x895a('0x84')]&&_0x32e8d2[_0x895a('0x84')][_0x895a('0x87')]){return base64Decode(_0x32e8d2[_0x895a('0x84')]['AudioFromTts'][_0x895a('0x88')],path[_0x895a('0x40')](__dirname,_0x895a('0x2a'),rs['generate'](0x4)+_0x895a('0x2c')))[_0x895a('0x2f')](function(_0x2c849b){_0x2ec3b2[_0x895a('0x89')]=_0x2c849b;return _0x2ec3b2;});}return _0x2ec3b2;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xbed7=['sox','google-tts-api','parse','util','./aws','./google','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','request\x20to\x20','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','data','transcode','error\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','text:synthesize','POST','resolve','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','null','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','code','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','queryText','responseId','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','format','freeform=3','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','dirName','apiai-promise','dialogflow','http','https','md5','path','request-promise','randomstring'];(function(_0x1f24fc,_0x182407){var _0x2fbdbd=function(_0x3cc11f){while(--_0x3cc11f){_0x1f24fc['push'](_0x1f24fc['shift']());}};_0x2fbdbd(++_0x182407);}(_0xbed7,0x184));var _0x7bed=function(_0x1b1ec5,_0x1b0410){_0x1b1ec5=_0x1b1ec5-0x0;var _0x14ff1a=_0xbed7[_0x1b1ec5];return _0x14ff1a;};'use strict';var apiai=require(_0x7bed('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x7bed('0x1'));var fs=require('fs');var http=require(_0x7bed('0x2'));var https=require(_0x7bed('0x3'));var md5=require(_0x7bed('0x4'));var path=require(_0x7bed('0x5'));var querystring=require('querystring');var rp=require(_0x7bed('0x6'));var rs=require(_0x7bed('0x7'));var sox=require(_0x7bed('0x8'));var tts=require(_0x7bed('0x9'));var urlParse=require('url')[_0x7bed('0xa')];var util=require(_0x7bed('0xb'));var aws=require(_0x7bed('0xc'));var google=require(_0x7bed('0xd'));var sestek=require('./sestek');var tilde=require(_0x7bed('0xe'));var logger=require(_0x7bed('0xf'))('agi');var ISPEECH_API=_0x7bed('0x10');function downloadFile(_0x499551,_0x1682da){return new BPromise(function(_0x62d866,_0xa6dc3d){var _0x28bdfc=urlParse(_0x499551);var _0x3fda4a=_0x28bdfc[_0x7bed('0x11')]===_0x7bed('0x12')?https:http;var _0x2c1c0c={'host':_0x28bdfc[_0x7bed('0x13')],'path':_0x28bdfc[_0x7bed('0x5')],'headers':{'user-agent':_0x7bed('0x14')}};_0x3fda4a[_0x7bed('0x15')](_0x2c1c0c,function(_0x195f04){if(_0x195f04['statusCode']!==0xc8){logger[_0x7bed('0x16')]('request\x20to\x20'+_0x499551+_0x7bed('0x17')+_0x195f04[_0x7bed('0x18')]+'\x20('+_0x195f04['statusMessage']+')');_0xa6dc3d(new Error(_0x7bed('0x19')+_0x499551+'\x20failed,\x20status\x20code\x20=\x20'+_0x195f04[_0x7bed('0x18')]+'\x20('+_0x195f04['statusMessage']+')'));return;}var _0x254ed8=fs['createWriteStream'](_0x1682da);_0x254ed8['on'](_0x7bed('0x1a'),function(){logger[_0x7bed('0x1b')](_0x7bed('0x1c'));_0x254ed8[_0x7bed('0x1d')](_0x62d866);});_0x254ed8['on'](_0x7bed('0x16'),function(_0x1925a5){fs[_0x7bed('0x1e')](_0x1682da);logger['error'](_0x7bed('0x1f'),_0x1925a5);_0xa6dc3d(_0x1925a5);});_0x195f04[_0x7bed('0x20')](_0x254ed8);})['on']('error',function(_0x4cdc91){logger[_0x7bed('0x16')](_0x4cdc91);_0xa6dc3d(_0x4cdc91);})[_0x7bed('0x21')]();});}function uploadFile(_0x48a1b6){return new BPromise(function(_0x4ab603,_0x315a67){var _0x5f34f7=urlParse(_0x48a1b6);var _0x26941d=_0x5f34f7[_0x7bed('0x11')]===_0x7bed('0x12')?https:http;var _0x37d083={'host':_0x5f34f7['host'],'path':_0x5f34f7[_0x7bed('0x5')],'headers':{'user-agent':_0x7bed('0x14')}};_0x26941d['get'](_0x37d083,function(_0x212d79){if(_0x212d79[_0x7bed('0x18')]!==0xc8){_0x315a67(new Error(_0x7bed('0x19')+_0x48a1b6+'\x20failed,\x20status\x20code\x20=\x20'+_0x212d79[_0x7bed('0x18')]+'\x20('+_0x212d79['statusMessage']+')'));return;}var _0x157704='';_0x212d79['on'](_0x7bed('0x22'),function(_0xc02424){_0x157704+=_0xc02424;});_0x212d79['on'](_0x7bed('0x21'),function(){_0x4ab603(_0x157704);});})['on'](_0x7bed('0x16'),function(_0x5e9564){_0x315a67(_0x5e9564);})['end']();});}function convertFile(_0x1c28bb,_0x169feb){return new BPromise(function(_0xb603f9,_0x1c42b6){var _0x1ced59=sox[_0x7bed('0x23')](_0x1c28bb,_0x169feb,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1ced59['on'](_0x7bed('0x16'),function(_0x583848){logger['error'](_0x7bed('0x24'),_0x583848);_0x1c42b6(_0x583848);});_0x1ced59['on'](_0x7bed('0x21'),function(){logger[_0x7bed('0x1b')]('finish\x20to\x20convert');_0xb603f9();});_0x1ced59[_0x7bed('0x25')]();});}function base64Decode(_0x5dcd1e,_0x50aa99){var _0x18edab=path['resolve'](__dirname,_0x7bed('0x26'),rs[_0x7bed('0x27')](0x4)+_0x7bed('0x28'));fs[_0x7bed('0x29')](_0x18edab,_0x5dcd1e,_0x7bed('0x2a'));return convertFile(_0x18edab,_0x50aa99)[_0x7bed('0x2b')](function(){try{fs[_0x7bed('0x1e')](_0x18edab);fs[_0x7bed('0x2c')](_0x50aa99,_0x7bed('0x2d'));}catch(_0x12f55f){logger[_0x7bed('0x16')](_0x12f55f);}return _0x50aa99[_0x7bed('0x2e')]('.')[0x0];});}function base64Encode(_0x21b463){var _0x57b445=fs[_0x7bed('0x2f')](_0x21b463);return new Buffer(_0x57b445)[_0x7bed('0x30')](_0x7bed('0x2a'));}exports[_0x7bed('0x31')]=function(_0x250fad,_0xe9a0b7,_0x34f1d3,_0x165dfa,_0x4913f6,_0xf6d9b1){var _0x4097c1,_0x2f89b3;var _0x30eabc=_0x7bed('0x32');var _0x5c04da=_0x7bed('0x33')+_0x250fad;var _0x28dbbf={};if(_0xe9a0b7==='ssml'){_0x28dbbf[_0x7bed('0x34')]={'ssml':_0x34f1d3};}else{_0x28dbbf['input']={'text':_0x34f1d3};};_0x28dbbf[_0x7bed('0x35')]={'languageCode':_0x165dfa,'ssmlGender':_0x4913f6};_0x28dbbf[_0x7bed('0x36')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x12fc33={'url':_0x30eabc+_0x7bed('0x37')+_0x5c04da,'method':_0x7bed('0x38'),'json':!![],'body':_0x28dbbf};return rp(_0x12fc33)[_0x7bed('0x2b')](function(_0x4be06f){return new BPromise(function(_0x5c862e,_0x311149){_0x4097c1=path[_0x7bed('0x39')](__dirname,_0x7bed('0x26'),rs[_0x7bed('0x27')](0x4)+_0x7bed('0x3a'));var _0x120708=Buffer[_0x7bed('0x3b')](_0x4be06f[_0x7bed('0x3c')],'base64');return fs[_0x7bed('0x3d')](_0x4097c1,_0x120708,function(_0x32dbe3){_0x311149(_0x32dbe3);},function(_0x5a3624){fs['chmodSync'](_0x4097c1,_0x7bed('0x2d'));_0x5c862e(_0x5a3624);});});})[_0x7bed('0x2b')](function(_0x1037d5){_0x2f89b3=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x4097c1,_0x2f89b3);})[_0x7bed('0x2b')](function(){try{fs[_0x7bed('0x1e')](_0x4097c1);fs[_0x7bed('0x2c')](_0x2f89b3,_0x7bed('0x2d'));}catch(_0x116871){logger[_0x7bed('0x16')](_0x116871);}logger[_0x7bed('0x1b')](_0x7bed('0x3e'),_0x2f89b3[_0x7bed('0x2e')]('.')[0x0]);return _0x2f89b3[_0x7bed('0x2e')]('.')[0x0];});};exports[_0x7bed('0x3f')]=function(_0x217444,_0x5520e8){var _0x368f92=_0x7bed('0x40');var _0x3f9833,_0x517a1d;var _0x7ccd16;var _0x131659={'encoding':_0x7bed('0x41'),'method':_0x7bed('0x38'),'timeout':0x2710,'url':_0x368f92,'headers':{'Content-Type':_0x7bed('0x42')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0x7bed('0x43')]([_0x217444,_0x5520e8||'en',![],_0x7bed('0x44')]),null,'generic']]]))};return rp(_0x131659)['then'](function(_0x3780b0){try{_0x7ccd16=eval(_0x3780b0[_0x7bed('0x45')](0x5))[0x0][0x2];}catch(_0x2dbce4){throw new Error('parse\x20response\x20failed:\x0a'+_0x3780b0[_0x7bed('0x22')]);}if(!_0x7ccd16){if(_0x217444[_0x7bed('0x46')]>0xc8){throw new Error(_0x7bed('0x47'));}else{throw new Error(_0x7bed('0x48')+_0x5520e8+_0x7bed('0x49'));}}try{_0x7ccd16=eval(_0x7ccd16)[0x0];}catch(_0x1d9992){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x7bed('0x22')]);}const _0x13ac13=_0x7ccd16;_0x3f9833=path[_0x7bed('0x39')](__dirname,_0x7bed('0x26'),rs[_0x7bed('0x27')](0x4)+_0x7bed('0x3a'));fs[_0x7bed('0x29')](_0x3f9833,_0x7ccd16,{'encoding':_0x7bed('0x2a')});_0x517a1d=path[_0x7bed('0x39')](__dirname,_0x7bed('0x26'),rs[_0x7bed('0x27')](0x4)+_0x7bed('0x28'));return convertFile(_0x3f9833,_0x517a1d);})['then'](function(){try{fs[_0x7bed('0x1e')](_0x3f9833);fs[_0x7bed('0x2c')](_0x517a1d,_0x7bed('0x2d'));}catch(_0xc97742){logger[_0x7bed('0x16')](_0xc97742);}logger[_0x7bed('0x1b')](_0x7bed('0x4a'),_0x517a1d['split']('.')[0x0]);return _0x517a1d[_0x7bed('0x2e')]('.')[0x0];});};exports[_0x7bed('0x4b')]=function(_0x513108,_0x49e8f5,_0x3f8cef){return google[_0x7bed('0x4c')](_0x513108,_0x49e8f5,_0x3f8cef)[_0x7bed('0x2b')](function(_0x1575c0){logger[_0x7bed('0x1b')](_0x1575c0['uri']);return rp(_0x1575c0);})[_0x7bed('0x2b')](function(_0x3930d8){var _0x39caa5='';var _0x3ae987=0x0;try{fs[_0x7bed('0x1e')](_0x513108);}catch(_0xb00f7b){logger[_0x7bed('0x16')](_0xb00f7b);}if(_0x3930d8&&_0x3930d8[_0x7bed('0x4d')]){_0x39caa5=_0x3930d8[_0x7bed('0x4d')][_0x7bed('0x4e')](function(_0x230e97){return _0x230e97&&_0x230e97[_0x7bed('0x4f')][0x0]&&_0x230e97[_0x7bed('0x4f')][0x0][_0x7bed('0x50')]?_0x230e97['alternatives'][0x0][_0x7bed('0x50')]:'';})[_0x7bed('0x51')]('\x0a');_0x3ae987=_0x3930d8[_0x7bed('0x4d')]['map'](function(_0x3c2477){return _0x3c2477&&_0x3c2477[_0x7bed('0x4f')][0x0]&&_0x3c2477[_0x7bed('0x4f')][0x0]['confidence']?_0x3c2477[_0x7bed('0x4f')][0x0][_0x7bed('0x52')]:0x0;})[_0x7bed('0x51')]('\x0a');}logger[_0x7bed('0x1b')]('googleASR\x20transcription',_0x39caa5);logger[_0x7bed('0x1b')](_0x7bed('0x53'),_0x3ae987);return{'transcript':_0x39caa5,'confidence':_0x3ae987};})['catch'](function(_0x197ce2){logger['error']('[%s]\x20%s:%s',_0x197ce2[_0x7bed('0x18')],_0x197ce2[_0x7bed('0x54')],_0x197ce2[_0x7bed('0x55')]);});};exports[_0x7bed('0x56')]=function(_0x548530,_0x54a835,_0x3d15d9,_0x40824d){var _0x1d7339=apiai(_0x54a835,{'language':_0x40824d||'en'});return _0x1d7339[_0x7bed('0x57')](_0x3d15d9,{'sessionId':md5(_0x548530)})[_0x7bed('0x2b')](function(_0x591b02){logger[_0x7bed('0x1b')](JSON[_0x7bed('0x43')](_0x591b02));return{'source':_0x591b02[_0x7bed('0x58')][_0x7bed('0x59')],'resolvedQuery':_0x591b02[_0x7bed('0x58')][_0x7bed('0x5a')],'action':_0x591b02[_0x7bed('0x58')][_0x7bed('0x5b')],'actionIncomplete':_0x591b02[_0x7bed('0x58')][_0x7bed('0x5c')],'speech':_0x591b02['result'][_0x7bed('0x5d')][_0x7bed('0x5e')],'score':_0x591b02[_0x7bed('0x58')]['score'],'statusCode':_0x591b02[_0x7bed('0x5f')][_0x7bed('0x60')],'endConversation':_0x591b02[_0x7bed('0x58')]['metadata'][_0x7bed('0x61')]||![],'isFallbackIntent':_0x591b02[_0x7bed('0x58')]['metadata'][_0x7bed('0x62')]};});};exports['googleDialogflowV2']=function(_0x5585bd,_0x5183bc,_0xcb7b2a,_0x593633,_0x2c9387,_0x32ca50){var _0x14fe91=_0x593633[_0x7bed('0x63')](/\\n/g,'\x0a');var _0x12d1d7={'credentials':{'private_key':_0x14fe91,'client_email':_0xcb7b2a}};var _0x3bbe6e=new dialogflow[(_0x7bed('0x64'))](_0x12d1d7);var _0x173603=_0x3bbe6e[_0x7bed('0x65')](_0x5183bc,md5(_0x5585bd));var _0x4397dd={'session':_0x173603,'queryInput':{'text':{'text':_0x2c9387,'languageCode':_0x32ca50}}};return _0x3bbe6e[_0x7bed('0x66')](_0x4397dd)[_0x7bed('0x2b')](function(_0x57f540){if(_0x57f540&&_0x57f540[_0x7bed('0x46')]){logger[_0x7bed('0x1b')](_0x7bed('0x67'),JSON[_0x7bed('0x43')](_0x57f540));var _0x4b6b9b=_0x57f540[0x0];if(_0x4b6b9b){var _0x3072cc={'action':_0x4b6b9b['queryResult']['action'],'allRequiredParamsPresent':_0x4b6b9b[_0x7bed('0x68')][_0x7bed('0x69')],'endConversation':_0x4b6b9b[_0x7bed('0x68')][_0x7bed('0x6a')]&&_0x4b6b9b[_0x7bed('0x68')][_0x7bed('0x6a')]['fields']?_0x4b6b9b[_0x7bed('0x68')][_0x7bed('0x6a')][_0x7bed('0x6b')][_0x7bed('0x6c')][_0x7bed('0x6d')]:![],'fulfillmentText':_0x4b6b9b[_0x7bed('0x68')]['fulfillmentText'],'intentName':_0x4b6b9b[_0x7bed('0x68')][_0x7bed('0x6e')][_0x7bed('0x54')],'intentDisplayName':_0x4b6b9b[_0x7bed('0x68')][_0x7bed('0x6e')][_0x7bed('0x6f')],'isFallbackIntent':_0x4b6b9b[_0x7bed('0x68')][_0x7bed('0x6e')][_0x7bed('0x70')],'languageCode':_0x4b6b9b['queryResult']['languageCode'],'queryText':_0x4b6b9b['queryResult'][_0x7bed('0x71')],'responseId':_0x4b6b9b[_0x7bed('0x72')],'score':_0x4b6b9b['queryResult']['intentDetectionConfidence'],'speech':_0x4b6b9b['queryResult']['fulfillmentText'],'providerResponse':JSON[_0x7bed('0x43')](_0x57f540)};return _0x3072cc;}}});};exports[_0x7bed('0x73')]=function(_0x1cccc8,_0x59dc70,_0x40af7a,_0x1cf485){return tilde[_0x7bed('0x4c')](_0x1cccc8,_0x59dc70,_0x40af7a,_0x1cf485)[_0x7bed('0x2b')](function(_0x51a984){try{fs[_0x7bed('0x1e')](_0x1cccc8);}catch(_0x283e72){logger['error'](_0x283e72);}logger[_0x7bed('0x1b')]('Tilde\x20ASR\x20transcription',_0x51a984[_0x7bed('0x50')]);logger[_0x7bed('0x1b')](_0x7bed('0x74'),_0x51a984[_0x7bed('0x52')]);return _0x51a984;});};exports[_0x7bed('0x75')]=function(_0x40fdd1,_0x5ddaa5,_0xf1b975,_0xa1c5d,_0x34262e,_0x404ef0){var _0x54ff3e=path[_0x7bed('0x39')](__dirname,_0x7bed('0x26'),rs[_0x7bed('0x27')](0x4)+'.mp3');var _0x249474;return aws['polly'](_0x40fdd1,_0x5ddaa5,_0xf1b975,_0xa1c5d,_0x34262e,_0x404ef0,_0x54ff3e)[_0x7bed('0x2b')](function(){_0x249474=path[_0x7bed('0x39')](__dirname,_0x7bed('0x26'),rs['generate'](0x4)+_0x7bed('0x28'));return convertFile(_0x54ff3e,_0x249474);})['then'](function(){try{fs['unlink'](_0x54ff3e);fs['chmodSync'](_0x249474,_0x7bed('0x2d'));}catch(_0x16704f){logger[_0x7bed('0x16')](_0x16704f);}return _0x249474[_0x7bed('0x2e')]('.')[0x0];});};exports[_0x7bed('0x76')]=function(_0x289181,_0x4e6056,_0x4afdb7,_0x5da6c7,_0x4af12c,_0x3ff49a){return aws[_0x7bed('0x77')](_0x289181,_0x4e6056,_0x4afdb7,_0x5da6c7,_0x4af12c,_0x3ff49a)[_0x7bed('0x2b')](function(_0x52ad85){logger[_0x7bed('0x1b')](JSON[_0x7bed('0x43')](_0x52ad85));return _0x52ad85;});};exports['ispeechTTS']=function(_0x1d0b06,_0x7754fc,_0x31e00c,_0x5c5d3c){var _0x21ac57=util['format'](_0x7bed('0x78'),ISPEECH_API,_0x1d0b06,encodeURIComponent(_0x7754fc),_0x31e00c,_0x5c5d3c);var _0x3aba3e=path['resolve'](__dirname,_0x7bed('0x26'),rs[_0x7bed('0x27')](0x4)+_0x7bed('0x3a'));var _0x242f5c;return downloadFile(_0x21ac57,_0x3aba3e)['then'](function(){_0x242f5c=path[_0x7bed('0x39')](__dirname,_0x7bed('0x26'),rs['generate'](0x4)+_0x7bed('0x28'));return convertFile(_0x3aba3e,_0x242f5c);})['then'](function(){try{fs['unlink'](_0x3aba3e);fs[_0x7bed('0x2c')](_0x242f5c,_0x7bed('0x2d'));}catch(_0xb72ac2){logger['error'](_0xb72ac2);}return _0x242f5c[_0x7bed('0x2e')]('.')[0x0];});};exports[_0x7bed('0x79')]=function(_0x3aef41,_0x7435e5,_0x2cf63c,_0x4df056){var _0x3903bf=util['format'](_0x7bed('0x7a'),ISPEECH_API,_0x7435e5,_0x2cf63c,base64Encode(_0x3aef41),_0x4df056?util[_0x7bed('0x7b')]('model=%s',encodeURIComponent(_0x4df056)):_0x7bed('0x7c'));return uploadFile(_0x3903bf)[_0x7bed('0x2b')](function(_0x30bf32){return querystring[_0x7bed('0xa')](_0x30bf32);});};exports[_0x7bed('0x7d')]=function(_0x118bab,_0x18a371){return sestek[_0x7bed('0x7e')](_0x118bab,_0x18a371)[_0x7bed('0x2b')](function(_0x3563ca){logger[_0x7bed('0x1b')](JSON[_0x7bed('0x43')](_0x3563ca));var _0x4ca6ee={'speech':_0x3563ca[_0x7bed('0x7f')],'action':_0x3563ca[_0x7bed('0x80')]?_0x3563ca[_0x7bed('0x80')]['CustomAction']:undefined,'actiondata':_0x3563ca[_0x7bed('0x80')]?_0x3563ca['channelData'][_0x7bed('0x81')]:undefined};if(_0x3563ca[_0x7bed('0x80')]&&_0x3563ca[_0x7bed('0x80')][_0x7bed('0x82')]){return base64Decode(_0x3563ca[_0x7bed('0x80')][_0x7bed('0x82')]['Data'],path[_0x7bed('0x39')](__dirname,'tmp',rs['generate'](0x4)+_0x7bed('0x28')))[_0x7bed('0x2b')](function(_0x1caa6b){_0x4ca6ee['audiofile']=_0x1caa6b;return _0x4ca6ee;});}return _0x4ca6ee;});};exports[_0x7bed('0x83')]=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 c1d5403..4a5c51e 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 _0x9f6d=['exports'];(function(_0x4f7e75,_0x291708){var _0x4e350f=function(_0x556b28){while(--_0x556b28){_0x4f7e75['push'](_0x4f7e75['shift']());}};_0x4e350f(++_0x291708);}(_0x9f6d,0x1ea));var _0xd9f6=function(_0x389441,_0x3ab518){_0x389441=_0x389441-0x0;var _0x5e987a=_0x9f6d[_0x389441];return _0x5e987a;};var nda=require('./nda');module[_0xd9f6('0x0')]={'nda':nda}; \ No newline at end of file +var _0x149e=['exports','./nda'];(function(_0x151c21,_0xd5dc94){var _0x3b1cba=function(_0x16d995){while(--_0x16d995){_0x151c21['push'](_0x151c21['shift']());}};_0x3b1cba(++_0xd5dc94);}(_0x149e,0x1d1));var _0xe149=function(_0x3ccd7c,_0x4c5858){_0x3ccd7c=_0x3ccd7c-0x0;var _0x310b49=_0x149e[_0x3ccd7c];return _0x310b49;};var nda=require(_0xe149('0x0'));module[_0xe149('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index fef36ef..f7d9bbb 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 _0x43c8=['/token','password','username','then','ndassistant_url','message','uniqueid','callerid','calleridname','dnid','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','url','agi','exports','POST','resolve'];(function(_0x55f36e,_0x336ec3){var _0x29e495=function(_0x34706b){while(--_0x34706b){_0x55f36e['push'](_0x55f36e['shift']());}};_0x29e495(++_0x336ec3);}(_0x43c8,0xaf));var _0x843c=function(_0x4c6699,_0x12df33){_0x4c6699=_0x4c6699-0x0;var _0x1891bc=_0x43c8[_0x4c6699];return _0x1891bc;};'use strict';var rp=require('request-promise');var url=require(_0x843c('0x0'));var logger=require('../../../../../config/logger')(_0x843c('0x1'));module[_0x843c('0x2')]=function(_0x254ff3,_0x302fdb){var _0x227b2a={'method':_0x843c('0x3'),'uri':url[_0x843c('0x4')](_0x302fdb['ndauth_url'],_0x843c('0x5')),'form':{'grant_type':_0x843c('0x6'),'username':_0x302fdb[_0x843c('0x7')],'password':_0x302fdb[_0x843c('0x6')]},'json':!![]};return rp(_0x227b2a)[_0x843c('0x8')](function(_0x49aee7){var _0x327327={'method':_0x843c('0x3'),'uri':url['resolve'](_0x302fdb[_0x843c('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x302fdb['ndaactivity_type']||_0x843c('0xa'),'channelId':'Nda','conversation':{'id':_0x254ff3[_0x843c('0xb')]},'from':{'id':_0x254ff3[_0x843c('0xc')],'name':_0x254ff3[_0x843c('0xd')]},'recipient':{'id':_0x254ff3[_0x843c('0xe')],'name':_0x254ff3['extension']},'text':_0x302fdb[_0x843c('0xf')],'channelData':{}},'headers':{'Authorization':_0x843c('0x10')+_0x49aee7[_0x843c('0x11')]},'json':!![]};if(_0x302fdb[_0x843c('0x12')]){_0x327327[_0x843c('0x13')][_0x843c('0x14')][_0x843c('0x15')]=_0x302fdb[_0x843c('0x12')];}if(_0x302fdb[_0x843c('0x16')]=='1'){_0x327327[_0x843c('0x13')][_0x843c('0x14')][_0x843c('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x843c('0x18')};}if(_0x302fdb[_0x843c('0x19')]){_0x327327[_0x843c('0x13')]['channelData'][_0x843c('0x1a')]=_0x302fdb[_0x843c('0x19')];if(_0x302fdb[_0x843c('0x1b')]){_0x327327[_0x843c('0x13')][_0x843c('0x14')]['CustomActionData']=_0x302fdb[_0x843c('0x1b')];}}logger[_0x843c('0x1c')](JSON[_0x843c('0x1d')](_0x327327));return rp(_0x327327);});}; \ No newline at end of file +var _0xbf5c=['custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','exports','POST','resolve','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','dnid','text','Bearer\x20','access_token','channelData','project','ndagenerate_audio','body','custom_action'];(function(_0x312790,_0x47fa52){var _0x48f9c0=function(_0xa94a8f){while(--_0xa94a8f){_0x312790['push'](_0x312790['shift']());}};_0x48f9c0(++_0x47fa52);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x5cecc0,_0x524daf){_0x5cecc0=_0x5cecc0-0x0;var _0x4739a8=_0xbf5c[_0x5cecc0];return _0x4739a8;};'use strict';var rp=require(_0xcbf5('0x0'));var url=require(_0xcbf5('0x1'));var logger=require(_0xcbf5('0x2'))('agi');module[_0xcbf5('0x3')]=function(_0x3b2043,_0x3850e7){var _0x536351={'method':_0xcbf5('0x4'),'uri':url[_0xcbf5('0x5')](_0x3850e7['ndauth_url'],_0xcbf5('0x6')),'form':{'grant_type':_0xcbf5('0x7'),'username':_0x3850e7[_0xcbf5('0x8')],'password':_0x3850e7['password']},'json':!![]};return rp(_0x536351)[_0xcbf5('0x9')](function(_0x31b6d1){var _0x54d2d4={'method':'POST','uri':url[_0xcbf5('0x5')](_0x3850e7[_0xcbf5('0xa')],_0xcbf5('0xb')),'body':{'type':_0x3850e7['ndaactivity_type']||_0xcbf5('0xc'),'channelId':_0xcbf5('0xd'),'conversation':{'id':_0x3b2043[_0xcbf5('0xe')]},'from':{'id':_0x3b2043[_0xcbf5('0xf')],'name':_0x3b2043[_0xcbf5('0x10')]},'recipient':{'id':_0x3b2043[_0xcbf5('0x11')],'name':_0x3b2043['extension']},'text':_0x3850e7[_0xcbf5('0x12')],'channelData':{}},'headers':{'Authorization':_0xcbf5('0x13')+_0x31b6d1[_0xcbf5('0x14')]},'json':!![]};if(_0x3850e7['project']){_0x54d2d4['body'][_0xcbf5('0x15')]['ProjectName']=_0x3850e7[_0xcbf5('0x16')];}if(_0x3850e7[_0xcbf5('0x17')]=='1'){_0x54d2d4[_0xcbf5('0x18')][_0xcbf5('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3850e7[_0xcbf5('0x19')]){_0x54d2d4['body'][_0xcbf5('0x15')]['CustomAction']=_0x3850e7['custom_action'];if(_0x3850e7[_0xcbf5('0x1a')]){_0x54d2d4[_0xcbf5('0x18')][_0xcbf5('0x15')][_0xcbf5('0x1b')]=_0x3850e7[_0xcbf5('0x1a')];}}logger[_0xcbf5('0x1c')](JSON[_0xcbf5('0x1d')](_0x54d2d4));return rp(_0x54d2d4);});}; \ 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 1657cf0..87aabeb 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 _0xfe97=['./lib/api','exports'];(function(_0x2c1034,_0x200d0a){var _0xdaec76=function(_0x41346a){while(--_0x41346a){_0x2c1034['push'](_0x2c1034['shift']());}};_0xdaec76(++_0x200d0a);}(_0xfe97,0x140));var _0x7fe9=function(_0x56074b,_0x1fced1){_0x56074b=_0x56074b-0x0;var _0x54b63e=_0xfe97[_0x56074b];return _0x54b63e;};'use strict';var asr=require(_0x7fe9('0x0'));module[_0x7fe9('0x1')]=function(_0x405599,_0x4a2df4,_0x500a80,_0x2e3dbe){return asr(_0x405599,_0x4a2df4,_0x500a80,_0x2e3dbe);}; \ No newline at end of file +var _0xcc0a=['exports','./lib/api'];(function(_0x9d58e0,_0x5ee515){var _0x5eab07=function(_0x177eb4){while(--_0x177eb4){_0x9d58e0['push'](_0x9d58e0['shift']());}};_0x5eab07(++_0x5ee515);}(_0xcc0a,0x1c7));var _0xacc0=function(_0x4f3148,_0x1a17a9){_0x4f3148=_0x4f3148-0x0;var _0x294757=_0xcc0a[_0x4f3148];return _0x294757;};'use strict';var asr=require(_0xacc0('0x0'));module[_0xacc0('0x1')]=function(_0x232f78,_0x5d5676,_0x2c3edb,_0x140201){return asr(_0x232f78,_0x5d5676,_0x2c3edb,_0x140201);}; \ 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 ac9cbe8..8b9786a 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 _0x786b=['hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','data','send','close','EOS','error','terminate','parse','status','result','final','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.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','update','digest'];(function(_0x44425c,_0x278574){var _0x566013=function(_0x19e485){while(--_0x19e485){_0x44425c['push'](_0x44425c['shift']());}};_0x566013(++_0x278574);}(_0x786b,0x1d5));var _0xb786=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x786b[_0x46e363];return _0x3fb059;};'use strict';var BPromise=require(_0xb786('0x0'));var _=require(_0xb786('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb786('0x2'));var crypto=require(_0xb786('0x3'));var logger=require(_0xb786('0x4'))('agi');module[_0xb786('0x5')]=function(_0x460e1c,_0x14d4ad,_0x2bbe84,_0x59679d){return new BPromise(function(_0x29a867,_0x5856ee){logger[_0xb786('0x6')](_0xb786('0x7'),_0x59679d||_0xb786('0x8'));var _0x183781=new WebSocket(_0x59679d||_0xb786('0x8'),{'perMessageDeflate':![]});var _0x120120='';var _0x13ad1e='0';var _0x3b6792='1';var _0x506755='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x205c49(_0x207fc2){var _0x554507=crypto['createHash']('sha1');_0x554507[_0xb786('0x9')](_0x207fc2);return _0x554507[_0xb786('0xa')](_0xb786('0xb'));}function _0x47fc13(){try{logger[_0xb786('0x6')](_0xb786('0xc'));var _0x345a3e=moment()[_0xb786('0xd')]();var _0x2f10e4=_0x205c49(_0x345a3e+_0x14d4ad+_0x2bbe84);_0x183781['send'](JSON[_0xb786('0xe')]({'appID':_0x14d4ad,'timestamp':_0x345a3e,'appKey':_0x2f10e4}));var _0x2233b2=fs['createReadStream'](_0x460e1c);_0x2233b2['on'](_0xb786('0xf'),function(_0x77e390){_0x183781[_0xb786('0x10')](_0x77e390);});_0x2233b2['on'](_0xb786('0x11'),function(){_0x183781[_0xb786('0x10')](_0xb786('0x12'));});}catch(_0x5733d3){logger[_0xb786('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0xb786('0xe')](_0x5733d3));_0x183781[_0xb786('0x14')]();}}function _0x373b2a(_0x3af933){try{if(_0x3af933){var _0x4bc738=JSON[_0xb786('0x15')](_0x3af933);switch(_0x4bc738[_0xb786('0x16')]){case 0x0:if(_0x4bc738[_0xb786('0x17')]){if(_0x4bc738[_0xb786('0x17')][_0xb786('0x18')]){logger[_0xb786('0x6')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x4bc738[_0xb786('0x17')][_0xb786('0x19')]));_0x120120=_0x4bc738[_0xb786('0x17')][_0xb786('0x19')][0x0][_0xb786('0x1a')];_0x13ad1e=_0x4bc738[_0xb786('0x17')][_0xb786('0x19')][0x0][_0xb786('0x1b')];_0x3b6792='0';_0x506755=_0xb786('0x1c');_0x183781[_0xb786('0x14')]();}}break;case 0x1:logger[_0xb786('0x6')](_0xb786('0x1d'));_0x3b6792='1';_0x506755=_0xb786('0x1d');break;case 0x2:logger[_0xb786('0x6')](_0xb786('0x1e'));_0x3b6792='2';_0x506755='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0xb786('0x1f'));_0x3b6792='9';_0x506755=_0xb786('0x1f');break;case 0xa:logger[_0xb786('0x6')](_0xb786('0x20'));_0x3b6792='10';_0x506755=_0xb786('0x20');break;case 0xb:logger[_0xb786('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x3b6792='11';_0x506755=_0xb786('0x21');}}}catch(_0xaa7ee){logger[_0xb786('0x13')](_0xb786('0x22'),JSON[_0xb786('0xe')](_0xaa7ee));_0x183781[_0xb786('0x14')]();}}function _0x445ae6(){logger[_0xb786('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x29a867({'transcript':_0x120120,'confidence':_0x13ad1e,'status':_0x3b6792,'status_message':_0x506755});}function _0x22248f(_0x2535e3){logger[_0xb786('0x13')](_0xb786('0x23'));if(!_[_0xb786('0x24')](_0x2535e3)){logger[_0xb786('0x13')](_[_0xb786('0x25')](_0x2535e3)?JSON[_0xb786('0xe')](_0x2535e3):_0x2535e3);}}_0x183781['on'](_0xb786('0x26'),_0x47fc13);_0x183781['on'](_0xb786('0x27'),_0x373b2a);_0x183781['on'](_0xb786('0x11'),_0x445ae6);_0x183781['on']('error',_0x22248f);});}; \ No newline at end of file +var _0xd757=['wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','hex','unix','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','final','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Error\x20Tilde\x20ASR\x20socket','isObject','open','bluebird','lodash','moment','crypto','info'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd757,0x187));var _0x7d75=function(_0x26c159,_0x5d05fa){_0x26c159=_0x26c159-0x0;var _0x3e0481=_0xd757[_0x26c159];return _0x3e0481;};'use strict';var BPromise=require(_0x7d75('0x0'));var _=require(_0x7d75('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x7d75('0x2'));var crypto=require(_0x7d75('0x3'));var logger=require('../../../../../../config/logger')('agi');module['exports']=function(_0x17b18b,_0x24f6ed,_0x1b5f99,_0x29ed52){return new BPromise(function(_0x4394c9,_0x228b0f){logger[_0x7d75('0x4')]('Tilde\x20URI',_0x29ed52||_0x7d75('0x5'));var _0x1da3c3=new WebSocket(_0x29ed52||_0x7d75('0x5'),{'perMessageDeflate':![]});var _0x1cce94='';var _0x22be5d='0';var _0x103e43='1';var _0x3deb8b=_0x7d75('0x6');function _0x46eae1(_0xf28fb9){var _0x232b16=crypto[_0x7d75('0x7')](_0x7d75('0x8'));_0x232b16['update'](_0xf28fb9);return _0x232b16[_0x7d75('0x9')](_0x7d75('0xa'));}function _0x4786a2(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x47bccc=moment()[_0x7d75('0xb')]();var _0x526143=_0x46eae1(_0x47bccc+_0x24f6ed+_0x1b5f99);_0x1da3c3[_0x7d75('0xc')](JSON[_0x7d75('0xd')]({'appID':_0x24f6ed,'timestamp':_0x47bccc,'appKey':_0x526143}));var _0x5449d4=fs[_0x7d75('0xe')](_0x17b18b);_0x5449d4['on'](_0x7d75('0xf'),function(_0x394832){_0x1da3c3[_0x7d75('0xc')](_0x394832);});_0x5449d4['on'](_0x7d75('0x10'),function(){_0x1da3c3[_0x7d75('0xc')]('EOS');});}catch(_0x304df3){logger[_0x7d75('0x11')](_0x7d75('0x12'),JSON[_0x7d75('0xd')](_0x304df3));_0x1da3c3[_0x7d75('0x13')]();}}function _0x360ee1(_0x54d254){try{if(_0x54d254){var _0x290073=JSON[_0x7d75('0x14')](_0x54d254);switch(_0x290073['status']){case 0x0:if(_0x290073[_0x7d75('0x15')]){if(_0x290073[_0x7d75('0x15')][_0x7d75('0x16')]){logger[_0x7d75('0x4')]('Tilde\x20ASR\x20hypoteses',JSON[_0x7d75('0xd')](_0x290073['result']['hypotheses']));_0x1cce94=_0x290073[_0x7d75('0x15')][_0x7d75('0x17')][0x0][_0x7d75('0x18')];_0x22be5d=_0x290073[_0x7d75('0x15')]['hypotheses'][0x0]['likelihood'];_0x103e43='0';_0x3deb8b=_0x7d75('0x19');_0x1da3c3[_0x7d75('0x13')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x103e43='1';_0x3deb8b=_0x7d75('0x6');break;case 0x2:logger[_0x7d75('0x4')](_0x7d75('0x1a'));_0x103e43='2';_0x3deb8b=_0x7d75('0x1a');break;case 0x9:logger[_0x7d75('0x4')](_0x7d75('0x1b'));_0x103e43='9';_0x3deb8b='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x7d75('0x4')](_0x7d75('0x1c'));_0x103e43='10';_0x3deb8b='Authentication\x20failed.';break;case 0xb:logger[_0x7d75('0x4')](_0x7d75('0x1d'));_0x103e43='11';_0x3deb8b=_0x7d75('0x1d');}}}catch(_0x150f3d){logger[_0x7d75('0x11')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x150f3d));_0x1da3c3[_0x7d75('0x13')]();}}function _0x31a231(){logger[_0x7d75('0x4')]('Close\x20Tilde\x20ASR\x20socket');_0x4394c9({'transcript':_0x1cce94,'confidence':_0x22be5d,'status':_0x103e43,'status_message':_0x3deb8b});}function _0x1a65ec(_0x25a0c9){logger[_0x7d75('0x11')](_0x7d75('0x1e'));if(!_['isNil'](_0x25a0c9)){logger[_0x7d75('0x11')](_[_0x7d75('0x1f')](_0x25a0c9)?JSON[_0x7d75('0xd')](_0x25a0c9):_0x25a0c9);}}_0x1da3c3['on'](_0x7d75('0x20'),_0x4786a2);_0x1da3c3['on']('message',_0x360ee1);_0x1da3c3['on']('close',_0x31a231);_0x1da3c3['on'](_0x7d75('0x11'),_0x1a65ec);});}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 370c399..56632f6 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 _0x96fc=['127.0.0.1','call','createServer','listening','connection','getConnections','emit','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./error','./channel'];(function(_0xab3a95,_0x34b0d2){var _0x5c9ab8=function(_0x3dcef5){while(--_0x3dcef5){_0xab3a95['push'](_0xab3a95['shift']());}};_0x5c9ab8(++_0x34b0d2);}(_0x96fc,0x13f));var _0xc96f=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x96fc[_0x1cc8fe];return _0x230054;};'use strict';var util=require(_0xc96f('0x0'));var net=require(_0xc96f('0x1'));var EventEmitter=require(_0xc96f('0x2'))[_0xc96f('0x3')];var AGIError=require(_0xc96f('0x4'));var AGIChannel=require(_0xc96f('0x5'));var AGIServer=function(_0x1d2d65,_0x3afd1e,_0x284ed7){var _0x45282f=this,_0x1d2d65=_0x1d2d65||0x11dd,_0x3afd1e=_0x3afd1e||_0xc96f('0x6'),_0x7dc051=null,_0x4b779b=0x0;EventEmitter[_0xc96f('0x7')](_0x45282f);function _0x180297(){if(!_0x1d2d65){_0x45282f['emit']('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x7dc051=net[_0xc96f('0x8')]();_0x7dc051['listen'](_0x1d2d65,_0x3afd1e);_0x7dc051['on'](_0xc96f('0x9'),function(){_0x45282f['emit'](_0xc96f('0x9'));});_0x7dc051['on'](_0xc96f('0xa'),function(_0x84f2ad){_0x7dc051[_0xc96f('0xb')](function(_0x4acb9f,_0x3c77f8){if(_0x4acb9f){_0x45282f[_0xc96f('0xc')](_0xc96f('0xd'),new AGIError(_0xc96f('0xe'),_0x4acb9f));}else if(_0x284ed7&&_0x284ed7<0x0){_0x45282f['emit'](_0xc96f('0xd'),new AGIError(_0xc96f('0xf')));_0x84f2ad[_0xc96f('0x10')]();}else if(_0x284ed7&&_0x284ed7>0x0&&_0x284ed7<_0x3c77f8){_0x4b779b+=0x1;_0x45282f[_0xc96f('0xc')](_0xc96f('0xd'),new AGIError(_0xc96f('0x11'),_0x4b779b));_0x84f2ad['destroy']();}else{var _0x1e55c6=new AGIChannel(_0x84f2ad);_0x1e55c6['on'](_0xc96f('0x12'),function(){_0x45282f[_0xc96f('0xc')](_0xc96f('0xa'),_0x1e55c6);});}});});_0x7dc051['on'](_0xc96f('0xd'),function(_0x128b2f){_0x45282f[_0xc96f('0xc')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x128b2f[_0xc96f('0x13')]));});_0x7dc051['on'](_0xc96f('0x14'),function(){_0x45282f['emit'](_0xc96f('0x14'),new AGIError(_0xc96f('0x15')));});}process[_0xc96f('0x16')](function(){_0x180297();});};util[_0xc96f('0x17')](AGIServer,EventEmitter);module[_0xc96f('0x18')]=function(_0x517219,_0x4fa203,_0x51dccc){return new AGIServer(_0x517219,_0x4fa203,_0x51dccc);}; \ No newline at end of file +var _0x1060=['E_AGI_SERVER_MAXCONNECTION','ready','code','close','exports','net','EventEmitter','./error','./channel','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x35f969,_0x2c03bd){var _0x373c46=function(_0x480568){while(--_0x480568){_0x35f969['push'](_0x35f969['shift']());}};_0x373c46(++_0x2c03bd);}(_0x1060,0x194));var _0x0106=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x1060[_0x1694f5];return _0x5b4321;};'use strict';var util=require('util');var net=require(_0x0106('0x0'));var EventEmitter=require('events')[_0x0106('0x1')];var AGIError=require(_0x0106('0x2'));var AGIChannel=require(_0x0106('0x3'));var AGIServer=function(_0x1b7b83,_0x473137,_0x1c57dd){var _0x4c8636=this,_0x1b7b83=_0x1b7b83||0x11dd,_0x473137=_0x473137||'127.0.0.1',_0x20bab0=null,_0x3fa3d0=0x0;EventEmitter['call'](_0x4c8636);function _0x7bb1e9(){if(!_0x1b7b83){_0x4c8636[_0x0106('0x4')](_0x0106('0x5'),new AGIError(_0x0106('0x6')));return![];}_0x20bab0=net['createServer']();_0x20bab0[_0x0106('0x7')](_0x1b7b83,_0x473137);_0x20bab0['on']('listening',function(){_0x4c8636[_0x0106('0x4')](_0x0106('0x8'));});_0x20bab0['on'](_0x0106('0x9'),function(_0x239636){_0x20bab0[_0x0106('0xa')](function(_0x2a6c0f,_0x54be6f){if(_0x2a6c0f){_0x4c8636[_0x0106('0x4')]('error',new AGIError(_0x0106('0xb'),_0x2a6c0f));}else if(_0x1c57dd&&_0x1c57dd<0x0){_0x4c8636[_0x0106('0x4')](_0x0106('0x5'),new AGIError(_0x0106('0xc')));_0x239636[_0x0106('0xd')]();}else if(_0x1c57dd&&_0x1c57dd>0x0&&_0x1c57dd<_0x54be6f){_0x3fa3d0+=0x1;_0x4c8636[_0x0106('0x4')](_0x0106('0x5'),new AGIError(_0x0106('0xe'),_0x3fa3d0));_0x239636[_0x0106('0xd')]();}else{var _0x2d243c=new AGIChannel(_0x239636);_0x2d243c['on'](_0x0106('0xf'),function(){_0x4c8636[_0x0106('0x4')](_0x0106('0x9'),_0x2d243c);});}});});_0x20bab0['on'](_0x0106('0x5'),function(_0x4aed8e){_0x4c8636['emit'](_0x0106('0x5'),new AGIError(_0x0106('0xb'),_0x4aed8e[_0x0106('0x10')]));});_0x20bab0['on']('close',function(){_0x4c8636['emit'](_0x0106('0x11'),new AGIError('E_AGI_SERVER_CLOSE'));});}process['nextTick'](function(){_0x7bb1e9();});};util['inherits'](AGIServer,EventEmitter);module[_0x0106('0x12')]=function(_0x2b4b6b,_0x4cb259,_0x430b26){return new AGIServer(_0x2b4b6b,_0x4cb259,_0x430b26);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 8b797e3..0d08289 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 _0xb661=['extension','priority','accountcode','dnid','file','createSquareMessage','isEmpty','random','lastName','isNil','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','googleTTS','google_tts_language','restAPI','method','number','timeout','includes','POST','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','ispeechASR','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','tildeASR','appid','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','googleDialogflow','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','findBy','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','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','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','service','host','port','secure','authentication','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','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','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','exports','path','util','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','./scripts','rawHeaders','menu','getdigits','channel','rpc','mailRpc','prototype','getVariable','then','name','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context'];(function(_0x17c2d2,_0x1b6fb0){var _0x13eee1=function(_0x35b38d){while(--_0x35b38d){_0x17c2d2['push'](_0x17c2d2['shift']());}};_0x13eee1(++_0x1b6fb0);}(_0xb661,0x195));var _0x1b66=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xb661[_0x4709c0];return _0x13348b;};'use strict';var fs=require('fs');var path=require(_0x1b66('0x0'));var util=require(_0x1b66('0x1'));var _=require('lodash');var sh=require(_0x1b66('0x2'));var odbc=require(_0x1b66('0x3'))();var rs=require(_0x1b66('0x4'));var moment=require(_0x1b66('0x5'));var Mustache=require(_0x1b66('0x6'));var rp=require(_0x1b66('0x7'));var logger=require('../../config/logger')(_0x1b66('0x8'));var config=require(_0x1b66('0x9'));var scripts=require(_0x1b66('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x1b66('0xb'),'rawBody'];var verticesWithRetry=[_0x1b66('0xc'),_0x1b66('0xd'),'getsecretdigits'];var AGIVertices=function(_0x6e9539,_0x1bc0cc,_0x1e326b){this[_0x1b66('0xe')]=_0x6e9539;this[_0x1b66('0xf')]=_0x1bc0cc;this[_0x1b66('0x10')]=_0x1e326b;};AGIVertices[_0x1b66('0x11')][_0x1b66('0x12')]=function(_0x557ba4,_0x467e88){this[_0x1b66('0xf')]['getVariableById'](_0x557ba4)[_0x1b66('0x13')](function(_0x1a1bfc){_0x467e88(null,_0x1a1bfc?_0x1a1bfc[_0x1b66('0x14')]:![]);})[_0x1b66('0x15')](function(_0x41176c){_0x467e88(_0x41176c);});};AGIVertices[_0x1b66('0x11')]['getVoiceQueue']=function(_0x2ad6ff,_0x1416f5){this[_0x1b66('0xf')]['getVoiceQueueById'](_0x2ad6ff)[_0x1b66('0x13')](function(_0x25dd62){_0x1416f5(null,_0x25dd62?_0x25dd62[_0x1b66('0x14')]:![]);})[_0x1b66('0x15')](function(_0x2e0184){_0x1416f5(_0x2e0184);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x16')]=function(_0x3abd32,_0x1607a0){this['rpc'][_0x1b66('0x17')](_0x3abd32)['then'](function(_0x497e1e){_0x1607a0(null,_0x497e1e?_0x497e1e[_0x1b66('0x14')]:![]);})[_0x1b66('0x15')](function(_0x29e1a2){_0x1607a0(_0x29e1a2);});};AGIVertices['prototype'][_0x1b66('0x18')]=function(_0x5f0d02,_0x505468){this['rpc'][_0x1b66('0x19')](_0x5f0d02)['then'](function(_0x543a62){_0x505468(null,_0x543a62?_0x543a62['dsn']:![]);})[_0x1b66('0x15')](function(_0x23b2a9){_0x505468(_0x23b2a9);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x1a')]=function(_0x16fe0f,_0x4a7622){this[_0x1b66('0xf')][_0x1b66('0x1b')](_0x16fe0f)[_0x1b66('0x13')](function(_0x5e5bd3){_0x4a7622(null,_0x5e5bd3?_0x5e5bd3[_0x1b66('0x14')]:![]);})[_0x1b66('0x15')](function(_0x1c45e9){_0x4a7622(_0x1c45e9);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x1c')]=function(_0x259473,_0x427ee3){this[_0x1b66('0xf')][_0x1b66('0x1d')](_0x259473)[_0x1b66('0x13')](function(_0x23e3b7){_0x427ee3(null,_0x23e3b7?_0x23e3b7[_0x1b66('0x14')]:![]);})[_0x1b66('0x15')](function(_0xe0d42f){_0x427ee3(_0xe0d42f);});};AGIVertices['prototype'][_0x1b66('0x1e')]=function(_0x39d5d9,_0x4ee254){var _0x55d558=this;this[_0x1b66('0xf')][_0x1b66('0x1f')](_0x39d5d9)[_0x1b66('0x13')](function(_0x5030dd){_0x4ee254(null,_0x5030dd?_0x55d558[_0x1b66('0x20')](_0x5030dd[_0x1b66('0x21')]):![]);})[_0x1b66('0x15')](function(_0x10c526){_0x4ee254(_0x10c526);});};AGIVertices['prototype'][_0x1b66('0x22')]=function(_0x2b0df0,_0x29876f){this[_0x1b66('0xf')][_0x1b66('0x23')](_0x2b0df0)['then'](function(_0x12eaa3){_0x29876f(null,_0x12eaa3?_0x12eaa3:![]);})['catch'](function(_0x2256d0){_0x29876f(_0x2256d0);});};AGIVertices[_0x1b66('0x11')]['sendMailMessage']=function(_0x2931b6,_0x5a3d25,_0xfcd242){this[_0x1b66('0x10')][_0x1b66('0x24')](_0x2931b6,_0x5a3d25)['then'](function(){_0xfcd242(null);})['catch'](function(_0xf80599){_0xfcd242(_0xf80599);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x25')]=function(_0x26c8e1,_0x110be5){this[_0x1b66('0xf')][_0x1b66('0x26')](_0x26c8e1)[_0x1b66('0x13')](function(_0x49b408){if(_0x49b408){if(_0x49b408[_0x1b66('0x27')]){_0x110be5(null,[_0x49b408[_0x1b66('0x28')]]);}else{_0x110be5(null,_[_0x1b66('0x29')](_0x49b408['Intervals'],'interval'));}}else{_0x110be5(null,![]);}})[_0x1b66('0x15')](function(_0x2f371e){_0x110be5(_0x2f371e);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x20')]=function(_0xe3af8f){return util[_0x1b66('0x2a')](_0x1b66('0x2b'),FILES_PATH,_0xe3af8f);};AGIVertices[_0x1b66('0x11')]['getQueryOdbc']=function(_0x58ffb8,_0x24df96,_0x19bb2a){odbc['open'](_0x58ffb8,function(_0x4a5515){if(_0x4a5515){logger[_0x1b66('0x2c')](_0x1b66('0x2d'),_0x4a5515);_0x19bb2a(_0x4a5515);}else{logger[_0x1b66('0x2e')]('ODBC\x20connection\x20successfully');odbc[_0x1b66('0x2f')](_0x24df96,function(_0x4c6fb7,_0x44acc8){if(_0x4c6fb7){logger['info'](_0x1b66('0x30'),_0x24df96);_0x19bb2a(_0x4c6fb7);}else{logger[_0x1b66('0x2e')](_0x1b66('0x31'),_0x24df96);odbc[_0x1b66('0x32')](function(_0x3fd63f){if(_0x3fd63f){logger[_0x1b66('0x2c')](_0x1b66('0x33'),_0x3fd63f);}_0x19bb2a(null,_0x44acc8);});}});}});};AGIVertices[_0x1b66('0x11')]['getSmsAccount']=function(_0x4514bf,_0x5ad456){this[_0x1b66('0xf')][_0x1b66('0x34')](_0x4514bf)[_0x1b66('0x13')](function(_0x376c4e){_0x5ad456(null,_0x376c4e?_0x376c4e:![]);})[_0x1b66('0x15')](function(_0x560000){_0x5ad456(_0x560000);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x35')]=function(_0x1fb153,_0x5e65cb){this[_0x1b66('0xf')][_0x1b66('0x35')](_0x1fb153)[_0x1b66('0x13')](function(_0x4faba9){_0x5e65cb(null,_0x4faba9);})['catch'](function(_0x246e05){_0x5e65cb(_0x246e05);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x36')]=function(_0x3a6690,_0x50d2e2,_0x38b53b){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x1b66('0xe')][_0x1b66('0x37')],'node':_0x3a6690[_0x1b66('0x38')],'application':_0x3a6690[_0x1b66('0x39')],'data':_0x50d2e2||null,'project_name':this[_0x1b66('0xe')][_0x1b66('0x3a')],'callerid':this[_0x1b66('0xe')][_0x1b66('0x3b')]})['then'](function(_0x256a65){if(_0x38b53b){_0x38b53b(null,_0x256a65);}})[_0x1b66('0x15')](function(_0x24fb17){if(_0x38b53b){_0x38b53b(_0x24fb17);}});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x3c')]=function(_0x56f65e,_0x33841b,_0x119552,_0x5bb55b){this['rpc'][_0x1b66('0x3c')]({'uniqueid':this[_0x1b66('0xe')][_0x1b66('0x37')],'callerid':this[_0x1b66('0xe')][_0x1b66('0x3b')],'calleridname':this[_0x1b66('0xe')][_0x1b66('0x3d')],'context':this[_0x1b66('0xe')][_0x1b66('0x3e')],'extension':this[_0x1b66('0xe')][_0x1b66('0x3f')],'priority':this[_0x1b66('0xe')][_0x1b66('0x40')],'accountcode':this[_0x1b66('0xe')][_0x1b66('0x41')],'dnid':this[_0x1b66('0xe')][_0x1b66('0x42')],'projectName':this[_0x1b66('0xe')][_0x1b66('0x3a')],'saveName':_0x33841b,'filename':_0x56f65e[_0x1b66('0x43')]||_0x33841b,'savePath':_0x119552})[_0x1b66('0x13')](function(_0x4d4cfe){_0x5bb55b(null,_0x4d4cfe);})[_0x1b66('0x15')](function(_0x513b9b){_0x5bb55b(_0x513b9b);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x44')]=function(_0x17b741,_0x592c96,_0x3fa70d,_0x31b48a,_0x43db3f){this[_0x1b66('0xf')][_0x1b66('0x44')]({'uniqueid':this[_0x1b66('0xe')][_0x1b66('0x37')],'body':_0x17b741,'direction':_0x592c96,'providerName':_0x3fa70d,'providerResponse':_0x31b48a})['then'](function(_0x53b558){if(_0x43db3f){_0x43db3f(null,_0x53b558);}})[_0x1b66('0x15')](function(_0x219819){if(_0x43db3f){_0x43db3f(_0x219819);}});};AGIVertices[_0x1b66('0x11')]['createCmContact']=function(_0x10c158,_0x2869f5){this[_0x1b66('0xf')]['createCmContact']({'firstName':_[_0x1b66('0x45')](_0x10c158[_0x1b66('0x14')])||_['isNil'](_0x10c158[_0x1b66('0x14')])?'callback_'+Math[_0x1b66('0x46')]():_0x10c158[_0x1b66('0x14')],'lastName':_[_0x1b66('0x45')](_0x10c158[_0x1b66('0x47')])||_[_0x1b66('0x48')](_0x10c158[_0x1b66('0x47')])?null:_0x10c158[_0x1b66('0x47')],'phone':_0x10c158[_0x1b66('0x49')],'ListId':_0x10c158[_0x1b66('0x4a')],'scheduledat':_0x10c158['scheduledAt'],'callbackUniqueid':this[_0x1b66('0xe')][_0x1b66('0x37')],'tags':_0x1b66('0x4b'),'description':_0x1b66('0x4c')+_0x10c158[_0x1b66('0x4d')][_0x1b66('0x4e')](),'priority':_0x10c158['callback_priority']})[_0x1b66('0x13')](function(_0x1f72ad){_0x2869f5(null,_0x1f72ad);})[_0x1b66('0x15')](function(_0x4ff76e){_0x2869f5(_0x4ff76e);});};AGIVertices[_0x1b66('0x11')]['getPause']=function(_0x3eb82f,_0x47fc0c){this[_0x1b66('0xf')][_0x1b66('0x4f')](_0x3eb82f)['then'](function(_0x7a938e){_0x47fc0c(null,_0x7a938e?_0x7a938e[_0x1b66('0x14')]:![]);})[_0x1b66('0x15')](function(_0xf119ab){_0x47fc0c(_0xf119ab);});};AGIVertices[_0x1b66('0x11')]['agentPause']=function(_0x36b83f,_0x4d9a41,_0x3bde0e){var _0x1e9f79={'role':_0x1b66('0x50')};_0x1e9f79[_0x36b83f]=this[_0x1b66('0xe')][_0x1b66('0x3b')];this[_0x1b66('0xf')][_0x1b66('0x51')](_0x1e9f79,_0x4d9a41,this[_0x1b66('0xe')][_0x1b66('0x37')])['then'](function(_0x5f0f0a){_0x3bde0e(null,_['isNil'](_0x5f0f0a)?![]:!![]);})[_0x1b66('0x15')](function(_0x2db56a){logger['error'](_0x2db56a);_0x3bde0e(null,![]);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x52')]=function(_0x42fc22,_0x37ae92){var _0x3de7b1={'role':'agent'};_0x3de7b1[_0x42fc22]=this['channel'][_0x1b66('0x3b')];this[_0x1b66('0xf')]['agentUnpause'](_0x3de7b1)['then'](function(_0x4e86b5){_0x37ae92(null,_[_0x1b66('0x48')](_0x4e86b5)?![]:!![]);})[_0x1b66('0x15')](function(_0x166965){logger[_0x1b66('0x2c')](_0x166965);_0x37ae92(null,![]);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x53')]=function(_0x91844c,_0x380077){var _0x53d904={'role':_0x1b66('0x50')};_0x53d904[_0x91844c]=this[_0x1b66('0xe')][_0x1b66('0x3b')];this[_0x1b66('0xf')]['agentLogout'](_0x53d904)['then'](function(_0x1a4c98){_0x380077(null,_[_0x1b66('0x48')](_0x1a4c98)?![]:!![]);})[_0x1b66('0x15')](function(_0x632de4){logger[_0x1b66('0x2c')](_0x632de4);_0x380077(null,![]);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x54')]=function(_0x260fe5,_0x479098){var _0x1ac517={'role':_0x1b66('0x50')};_0x1ac517[_0x260fe5]=this['channel'][_0x1b66('0x3b')];var _0x510e7a=_0x260fe5!=_0x1b66('0x55')?util[_0x1b66('0x2a')](_0x1b66('0x56'),_0x1b66('0x57'),this[_0x1b66('0xe')][_0x1b66('0x3b')]):undefined;this['rpc'][_0x1b66('0x54')](_0x1ac517,_0x510e7a)[_0x1b66('0x13')](function(_0x1f8a68){_0x479098(null,_[_0x1b66('0x48')](_0x1f8a68)?![]:!![]);})[_0x1b66('0x15')](function(_0x5b1634){logger[_0x1b66('0x2c')](_0x5b1634);_0x479098(null,![]);});};AGIVertices['prototype'][_0x1b66('0x58')]=function(_0x9ea5e2,_0x1adf7c){sh[_0x1b66('0x59')](_['trim'](_0x9ea5e2),function(_0xa9b959,_0x50ddd0){var _0x1c201b=_0x50ddd0['replace'](/(\r\n|\n|\r)/gm,'');_0x1adf7c(null,_0x1c201b);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x5a')]=function(_0xf1c74f,_0x3726bd){scripts[_0x1b66('0x5a')](_0xf1c74f['apiKey'],_0xf1c74f[_0x1b66('0x5b')]||_0x1b66('0x5c'),_0xf1c74f['text'],_0xf1c74f[_0x1b66('0x5d')]||_0x1b66('0x5e'),_0xf1c74f[_0x1b66('0x5f')]||'MALE',_0xf1c74f[_0x1b66('0x60')]||'MP3')[_0x1b66('0x13')](function(_0x5c05b5){_0x3726bd(null,_0x5c05b5);})[_0x1b66('0x15')](function(_0x50cb9f){_0x3726bd(_0x50cb9f);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x61')]=function(_0x8ea01,_0x59222a){scripts[_0x1b66('0x61')](_0x8ea01[_0x1b66('0x5c')],_0x8ea01[_0x1b66('0x62')]||'en',0x1)[_0x1b66('0x13')](function(_0x3a854b){_0x59222a(null,_0x3a854b);})['catch'](function(_0x19a9fb){_0x59222a(_0x19a9fb);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x63')]=function(_0x4782aa,_0x47a730){var _0x1d95c6={'uri':_0x4782aa['url'],'method':_0x4782aa[_0x1b66('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4782aa['timeout'])===_0x1b66('0x65')&&parseInt(_0x4782aa['timeout'])>=0x1?parseInt(_0x4782aa[_0x1b66('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x1b66('0x67')]([_0x1b66('0x68'),'PUT'],_0x1d95c6['method'][_0x1b66('0x69')]())){try{_0x1d95c6[_0x1b66('0x6a')]=_0x4782aa[_0x1b66('0x6b')]?JSON[_0x1b66('0x6c')](_0x4782aa[_0x1b66('0x6b')]):{};}catch(_0x17d302){logger[_0x1b66('0x2c')](_0x1b66('0x6d'),_0x17d302);}}try{_0x1d95c6[_0x1b66('0x6e')]=_0x4782aa[_0x1b66('0xb')]?JSON[_0x1b66('0x6c')](_0x4782aa[_0x1b66('0xb')]):{};}catch(_0x1106df){logger[_0x1b66('0x2c')](_0x1b66('0x6f'),_0x1106df);}if(_0x4782aa[_0x1b66('0x70')]){try{var _0x5f5377=require(_0x4782aa[_0x1b66('0x70')])[_0x1b66('0x71')](this,_0x1d95c6);_0x1d95c6[_0x1b66('0x72')]=Mustache[_0x1b66('0x73')](_0x4782aa[_0x1b66('0x74')],_0x5f5377,{},['$$','$$']);if(_0x1d95c6[_0x1b66('0x6e')]){_0x1d95c6[_0x1b66('0x6e')]=JSON[_0x1b66('0x6c')](Mustache[_0x1b66('0x73')](JSON[_0x1b66('0x75')](_0x1d95c6[_0x1b66('0x6e')]),_0x5f5377,{},['$$','$$']));}if(_0x1d95c6['body']){_0x1d95c6[_0x1b66('0x6a')]=JSON[_0x1b66('0x6c')](Mustache[_0x1b66('0x73')](JSON[_0x1b66('0x75')](_0x1d95c6[_0x1b66('0x6a')]),_0x5f5377,{},['$$','$$']));}}catch(_0x1af0d5){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1af0d5);}}rp(_0x1d95c6)[_0x1b66('0x13')](function(_0x38cd43){var _0x102874={'statusCode':_0x38cd43[_0x1b66('0x76')]||0xc8,'statusMessage':_0x38cd43['statusMessage']||'OK','headers':_0x38cd43[_0x1b66('0x6e')]||{},'body':_0x38cd43['body']||{}};_0x47a730(null,_0x102874);})[_0x1b66('0x15')](function(_0x429b88){var _0x1ea421={'statusCode':_0x429b88[_0x1b66('0x76')]||0x1f4,'statusMessage':_0x429b88[_0x1b66('0x77')]||_0x1b66('0x78'),'headers':_0x429b88[_0x1b66('0x79')][_0x1b66('0x6e')]||{},'body':_0x429b88['options'][_0x1b66('0x6a')]||{}};_0x47a730(null,_0x1ea421);});};AGIVertices[_0x1b66('0x11')]['googleDialogflow']=function(_0x5d7df5,_0x1bcb49){scripts['googleDialogflow'](this[_0x1b66('0xe')][_0x1b66('0x37')],_0x5d7df5['key'],_0x5d7df5[_0x1b66('0x5c')],_0x5d7df5['dialogflow_language']||'en')['then'](function(_0x3a42d4){_0x1bcb49(null,_0x3a42d4);})[_0x1b66('0x15')](function(_0x4b8ebd){_0x1bcb49(_0x4b8ebd);});};AGIVertices['prototype'][_0x1b66('0x7a')]=function(_0x3f2614,_0xd718dd){scripts[_0x1b66('0x7a')](this['channel'][_0x1b66('0x37')],_0x3f2614[_0x1b66('0x7b')],_0x3f2614[_0x1b66('0x7c')],_0x3f2614[_0x1b66('0x7d')],_0x3f2614[_0x1b66('0x5c')],_0x3f2614[_0x1b66('0x7e')]||'en')[_0x1b66('0x13')](function(_0x153f22){_0xd718dd(null,_0x153f22);})['catch'](function(_0x442f72){_0xd718dd(_0x442f72);});};AGIVertices[_0x1b66('0x11')]['sestekNDA']=function(_0x1afa89,_0x1c7363){scripts[_0x1b66('0x7f')](this['channel'],_0x1afa89)['then'](function(_0x54583e){_0x1c7363(null,_0x54583e);})[_0x1b66('0x15')](function(_0x2ff06c){_0x1c7363(_0x2ff06c);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x80')]=function(_0x342fc6,_0x28b244){scripts[_0x1b66('0x80')](_0x342fc6[_0x1b66('0x81')],_0x342fc6[_0x1b66('0x5c')],_0x342fc6[_0x1b66('0x82')]||_0x1b66('0x5e'),_0x342fc6['speed'])[_0x1b66('0x13')](function(_0x434818){_0x28b244(null,_0x434818);})[_0x1b66('0x15')](function(_0x215409){_0x28b244(_0x215409);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x83')]=function(_0x18b152,_0x2ba532,_0x4789c4){scripts[_0x1b66('0x83')](_0x2ba532,_0x18b152['key'],_0x18b152['ispeech_asr_language']||_0x1b66('0x5e'),this[_0x1b66('0x84')](_0x18b152[_0x1b66('0x85')])?_0x18b152[_0x1b66('0x85')]:undefined)['then'](function(_0x533d59){_0x4789c4(null,_0x533d59);})[_0x1b66('0x15')](function(_0x52b66a){_0x4789c4(_0x52b66a);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x86')]=function(_0x1cb90d,_0x2905a9){scripts[_0x1b66('0x86')](_0x1cb90d[_0x1b66('0x87')],_0x1cb90d[_0x1b66('0x88')],_0x1cb90d[_0x1b66('0x89')],_0x1cb90d[_0x1b66('0x8a')]||_0x1b66('0x8b'),_0x1cb90d[_0x1b66('0x5c')],_0x1cb90d[_0x1b66('0x8c')]||_0x1b66('0x5c'))[_0x1b66('0x13')](function(_0x1abbc7){_0x2905a9(null,_0x1abbc7);})['catch'](function(_0xbc39d7){_0x2905a9(_0xbc39d7);});};AGIVertices['prototype'][_0x1b66('0x8d')]=function(_0xcec0ed,_0x3733f1){scripts[_0x1b66('0x8d')](this[_0x1b66('0xe')][_0x1b66('0x37')],_0xcec0ed[_0x1b66('0x87')],_0xcec0ed['aws_secret_access_key'],_0xcec0ed[_0x1b66('0x8e')],_0xcec0ed[_0x1b66('0x5c')],_0xcec0ed[_0x1b66('0x8f')])[_0x1b66('0x13')](function(_0x3b9ebc){_0x3733f1(null,_0x3b9ebc);})[_0x1b66('0x15')](function(_0x12e1dc){_0x3733f1(_0x12e1dc);});};AGIVertices[_0x1b66('0x11')][_0x1b66('0x90')]=function(_0x281d49,_0xd7cd06,_0x6734b4){scripts[_0x1b66('0x90')](_0xd7cd06,_0x281d49[_0x1b66('0x81')],_0x281d49[_0x1b66('0x91')]||_0x1b66('0x5e'))[_0x1b66('0x13')](function(_0x542a7e){_0x6734b4(null,_0x542a7e);})[_0x1b66('0x15')](function(_0x132521){_0x6734b4(_0x132521);});};AGIVertices[_0x1b66('0x11')]['tildeASR']=function(_0x3762b3,_0x1a4c6e,_0x1e659f){scripts[_0x1b66('0x92')](_0x1a4c6e,_0x3762b3[_0x1b66('0x93')],_0x3762b3[_0x1b66('0x94')],_0x3762b3[_0x1b66('0x72')])[_0x1b66('0x13')](function(_0x376424){_0x1e659f(null,_0x376424);})[_0x1b66('0x15')](function(_0x558f36){_0x1e659f(_0x558f36);});};AGIVertices[_0x1b66('0x11')]['clear']=function(_0x23f6f6){var _0x443a0d=_['includes'](verticesWithRetry,_0x23f6f6[_0x1b66('0x39')])?_0x23f6f6:_[_0x1b66('0x95')](_0x23f6f6);for(var _0x49f3d9 in _0x443a0d){if(_0x443a0d[_0x1b66('0x96')](_0x49f3d9)){if(_0x443a0d[_0x49f3d9]&&_[_0x1b66('0x97')](_0x443a0d[_0x49f3d9])){if(_[_0x1b66('0x67')](recursiveMapAttributes,_0x49f3d9)){_0x443a0d[_0x49f3d9]=this[_0x1b66('0x98')](_0x443a0d[_0x49f3d9]);}else{_0x443a0d[_0x49f3d9]=this[_0x1b66('0x99')](_0x443a0d[_0x49f3d9]);}}}}return _0x443a0d;};AGIVertices[_0x1b66('0x11')]['recursiveNodeIndex']=function(_0x2717b3){for(var _0x2de48f in _0x2717b3){if(_0x2717b3['hasOwnProperty'](_0x2de48f)){if(_['isPlainObject'](_0x2717b3[_0x2de48f])){this[_0x1b66('0x9a')](_0x2717b3[_0x2de48f]);}else if(_[_0x1b66('0x9b')](_0x2717b3[_0x2de48f])){for(var _0x445e7c=0x0;_0x445e7c<_0x2717b3[_0x2de48f][_0x1b66('0x9c')];_0x445e7c++){this[_0x1b66('0x9a')](_0x2717b3[_0x2de48f][_0x445e7c]);}}else if(_['isString'](_0x2717b3[_0x2de48f])){_0x2717b3[_0x2de48f]=this['replaceAllVariables'](_0x2717b3[_0x2de48f]);}}}};AGIVertices[_0x1b66('0x11')][_0x1b66('0x9d')]=function(_0x4c1e1f,_0x207354){for(var _0x17e4f2 in _0x4c1e1f){if(_0x4c1e1f[_0x1b66('0x96')](_0x17e4f2)){if(_['isPlainObject'](_0x4c1e1f[_0x17e4f2])){if(!_[_0x1b66('0x45')](_0x4c1e1f[_0x17e4f2])){this[_0x1b66('0x9d')](_0x4c1e1f[_0x17e4f2],util[_0x1b66('0x2a')]('%s.%s',_0x207354,_0x17e4f2));}}else if(_[_0x1b66('0x9b')](_0x4c1e1f[_0x17e4f2])){for(var _0x23912f=0x0;_0x23912f<_0x4c1e1f[_0x17e4f2][_0x1b66('0x9c')];_0x23912f++){this[_0x1b66('0x9d')](_0x4c1e1f[_0x17e4f2][_0x23912f],util[_0x1b66('0x2a')](_0x1b66('0x9e'),_0x207354,_0x17e4f2+'['+_0x23912f+']'));}}else{if(!_[_0x1b66('0x48')](_0x4c1e1f[_0x17e4f2])){this[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')](_0x1b66('0x9e'),_0x207354,_0x17e4f2),_0x4c1e1f[_0x17e4f2]);}}}}};AGIVertices[_0x1b66('0x11')][_0x1b66('0x98')]=function(_0x33071b){try{var _0x24a8c6=JSON[_0x1b66('0x6c')](_0x33071b);this[_0x1b66('0x9a')](_0x24a8c6);return JSON[_0x1b66('0x75')](_0x24a8c6);}catch(_0x551160){return this[_0x1b66('0x99')](_0x33071b);}};AGIVertices[_0x1b66('0x11')][_0x1b66('0x99')]=function(_0x36efa4){var _0x31c97c=_0x36efa4['split']('{');for(var _0x2557d0=0x1;_0x2557d0<_0x31c97c['length'];_0x2557d0+=0x1){var _0x447fff=_0x31c97c[_0x2557d0][_0x1b66('0xa0')]('}');if(_0x447fff[_0x1b66('0x9c')]>0x1){_0x36efa4=_0x36efa4[_0x1b66('0xa1')]('{'+_0x447fff[0x0]+'}',this[_0x1b66('0xe')][_0x1b66('0x12')](_0x447fff[0x0])[_0x1b66('0xa2')]||_0x447fff[0x0]);}}if(_0x31c97c[_0x1b66('0x9c')]===0x1){return _0x36efa4[_0x1b66('0x4e')]();}return this['replaceAllVariables'](_0x36efa4);};AGIVertices[_0x1b66('0x11')][_0x1b66('0xa3')]=function(_0x8cde7b,_0x4a3aa4){var _0x24d41c=this[_0x1b66('0xe')][_0x1b66('0x12')](_0x8cde7b);if(_0x24d41c[_0x1b66('0xa4')]===-0x1){return _0x24d41c;}logger['info'](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x4a3aa4,_0x24d41c[_0x1b66('0xa2')]));return this[_0x1b66('0xe')][_0x1b66('0x9f')](_0x4a3aa4,_0x24d41c['extra']);};AGIVertices[_0x1b66('0x11')][_0x1b66('0x84')]=function(_0x13516e){return _0x13516e&&_0x13516e!=='0'&&_0x13516e!=='-1'&&_0x13516e!=='';};AGIVertices[_0x1b66('0x11')][_0x1b66('0xa5')]=function(_0xcc1497){this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0xcc1497,'-');_0xcc1497[_0x1b66('0xa6')]=_0xcc1497[_0x1b66('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x1b66('0xa7')]=function(_0x33b268){logger['info'](util['format'](_0x1b66('0xa8'),_0x33b268[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x33b268[_0x1b66('0x5c')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xaa'));}var _0x5009c9='\x22'+_0x33b268[_0x1b66('0x5c')]+'\x22';if(this[_0x1b66('0x84')](_0x33b268['options'])){_0x5009c9+=','+_0x33b268[_0x1b66('0x79')];}var _0x2de7e0=this[_0x1b66('0xe')][_0x1b66('0x59')](_0x1b66('0xab'),_0x5009c9);if(_0x2de7e0[_0x1b66('0xa4')]===-0x1){return _0x2de7e0;}return this['channel'][_0x1b66('0xa9')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x5009c9));};AGIVertices[_0x1b66('0x11')][_0x1b66('0xac')]=function(_0x569297){logger['info'](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x569297[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x569297[_0x1b66('0xad')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xae'));}var _0x45e493=_0x569297[_0x1b66('0xad')];if(this['isConfigured'](_0x569297[_0x1b66('0x79')])){_0x45e493+=','+_0x569297[_0x1b66('0x79')];}var _0x576d55=this[_0x1b66('0xe')][_0x1b66('0x59')]('MRCPRecog',_0x45e493);if(_0x576d55[_0x1b66('0xa4')]===-0x1){return _0x576d55;}var _0x48c81f=this[_0x1b66('0xa3')](_0x1b66('0xaf'),_0x1b66('0xb0'));if(_0x48c81f[_0x1b66('0xa4')]===-0x1){return _0x48c81f;}var _0x3677f4=this[_0x1b66('0xa3')](_0x1b66('0xb1'),_0x1b66('0xb2'));if(_0x3677f4['result']===-0x1){return _0x3677f4;}var _0x1a4e25=this['getAndSetVariable'](_0x1b66('0xb3'),'MRCP_RECOG_INSTANCE');if(_0x1a4e25[_0x1b66('0xa4')]===-0x1){return _0x1a4e25;}return this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0xb4'),_0x45e493));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x8')]=function(_0x5c20d3){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0xb5'),_0x5c20d3[_0x1b66('0x38')]));return this['channel'][_0x1b66('0x8')]([_0x5c20d3[_0x1b66('0xb6')],_0x5c20d3['args']]);};AGIVertices['prototype']['answer']=function(_0x447f3a){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0xb7'),_0x447f3a['label']));if(this[_0x1b66('0x84')](_0x447f3a['timeout'])){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0xb8'),_0x447f3a[_0x1b66('0x66')]));var _0x78d414=this[_0x1b66('0xe')][_0x1b66('0xb9')](_0x447f3a['timeout']);if(_0x78d414[_0x1b66('0xa4')]===-0x1){return _0x78d414;}}return this[_0x1b66('0xe')][_0x1b66('0xba')]();};AGIVertices[_0x1b66('0x11')]['callback']=function(_0x324cb2){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0xbb'),_0x324cb2[_0x1b66('0x38')]));if(!this['isConfigured'](_0x324cb2[_0x1b66('0x4a')])){return this['channel'][_0x1b66('0x2c')](_0x324cb2,_0x1b66('0xbc'));}_0x324cb2['scheduledAt']=moment();if(this[_0x1b66('0x84')](_0x324cb2['delay'])){_0x324cb2[_0x1b66('0x4d')]=moment()[_0x1b66('0xbd')](_0x324cb2[_0x1b66('0xbe')],_0x1b66('0xbf'));}if(!this['isConfigured'](_0x324cb2['callback_priority'])){_0x324cb2[_0x1b66('0xc0')]=0x2;}this['createCmContact'][_0x1b66('0x71')](this,_0x324cb2);return this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0xc1'),_0x324cb2['phone'],_0x324cb2[_0x1b66('0x4a')],_0x324cb2['scheduledAt']));};AGIVertices[_0x1b66('0x11')][_0x1b66('0xc2')]=function(_0x437b3a){logger['info'](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x437b3a[_0x1b66('0x38')]));var _0x349099=this['channel']['exec'](_0x437b3a['application'],_0x437b3a[_0x1b66('0x79')]);if(_0x349099[_0x1b66('0xa4')]===-0x1){return _0x349099;}return this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0xc3'),_0x437b3a['application'],_0x437b3a['options']));};AGIVertices[_0x1b66('0x11')]['lumenvoxtts']=function(_0x427eb1){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0xc4'),_0x427eb1[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x427eb1[_0x1b66('0x5c')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xaa'));}var _0x3e10fa='\x22'+_0x427eb1[_0x1b66('0x5c')]+'\x22';if(this[_0x1b66('0x84')](_0x427eb1[_0x1b66('0x79')])){_0x3e10fa+=','+_0x427eb1['options'];}var _0x18f88a=this[_0x1b66('0xe')][_0x1b66('0x59')](_0x1b66('0xab'),_0x3e10fa);if(_0x18f88a[_0x1b66('0xa4')]===-0x1){return _0x18f88a;}return this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0xc5'),_0x3e10fa));};AGIVertices['prototype'][_0x1b66('0xc6')]=function(_0x5dafbf){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0xc7'),_0x5dafbf[_0x1b66('0x38')]));if(!this['isConfigured'](_0x5dafbf[_0x1b66('0x5c')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xaa'));}var _0x3207cd='\x22'+_0x5dafbf['text']+'\x22';if(this[_0x1b66('0x84')](_0x5dafbf['options'])){_0x3207cd+=','+_0x5dafbf[_0x1b66('0x79')];}var _0x35595c=this[_0x1b66('0xe')][_0x1b66('0x59')](_0x1b66('0xab'),_0x3207cd);if(_0x35595c[_0x1b66('0xa4')]===-0x1){return _0x35595c;}return this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x3207cd));};AGIVertices[_0x1b66('0x11')][_0x1b66('0xc8')]=function(_0x22b160){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0xc9'),_0x22b160[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x22b160[_0x1b66('0xad')])){return this['channel'][_0x1b66('0xa9')](_0x1b66('0xae'));}var _0x29cf3a=_0x22b160['grammar'];if(this[_0x1b66('0x84')](_0x22b160[_0x1b66('0x79')])){_0x29cf3a+=','+_0x22b160[_0x1b66('0x79')];}var _0x47d70f=this[_0x1b66('0xe')]['exec'](_0x1b66('0xca'),_0x29cf3a);if(_0x47d70f[_0x1b66('0xa4')]===-0x1){return _0x47d70f;}var _0x14dd24=this[_0x1b66('0xa3')](_0x1b66('0xaf'),_0x1b66('0xcb'));if(_0x14dd24[_0x1b66('0xa4')]===-0x1){return _0x14dd24;}var _0x19a89c=this['getAndSetVariable'](_0x1b66('0xb1'),_0x1b66('0xcc'));if(_0x19a89c[_0x1b66('0xa4')]===-0x1){return _0x19a89c;}var _0x59f5fb=this[_0x1b66('0xa3')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x59f5fb[_0x1b66('0xa4')]===-0x1){return _0x59f5fb;}return this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0xb4'),_0x29cf3a));};AGIVertices[_0x1b66('0x11')]['sestekasr']=function(_0x2b1c5a){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0xcd'),_0x2b1c5a[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x2b1c5a[_0x1b66('0xad')])){return this['channel'][_0x1b66('0xa9')]('no\x20grammar\x20configured');}var _0x1c8635=_0x2b1c5a['grammar'];if(this[_0x1b66('0x84')](_0x2b1c5a[_0x1b66('0x79')])){_0x1c8635+=','+_0x2b1c5a[_0x1b66('0x79')];}var _0x1bbbfd=this['channel'][_0x1b66('0x59')]('MRCPRecog',_0x1c8635);if(_0x1bbbfd['result']===-0x1){return _0x1bbbfd;}var _0x413f57=this['getAndSetVariable'](_0x1b66('0xaf'),_0x1b66('0xce'));if(_0x413f57[_0x1b66('0xa4')]===-0x1){return _0x413f57;}var _0x1b11c6=this[_0x1b66('0xa3')](_0x1b66('0xb1'),_0x1b66('0xcf'));if(_0x1b11c6['result']===-0x1){return _0x1b11c6;}var _0x155bde=this[_0x1b66('0xa3')](_0x1b66('0xb3'),_0x1b66('0xd0'));if(_0x155bde[_0x1b66('0xa4')]===-0x1){return _0x155bde;}return this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0xb4'),_0x1c8635));};AGIVertices[_0x1b66('0x11')][_0x1b66('0xd1')]=function(_0x291733){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0xd2'),_0x291733[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x291733[_0x1b66('0xd3')])){return this['channel'][_0x1b66('0x2c')](_0x291733,_0x1b66('0xd4'));}var _0x404d24=this[_0x1b66('0x18')]['sync'](this,_0x291733[_0x1b66('0xd3')]);if(!_0x404d24){return this['channel'][_0x1b66('0x2c')](_0x291733,_0x1b66('0xd5'));}if(!this['isConfigured'](_0x291733['query'])){return this[_0x1b66('0xe')]['error'](_0x291733,_0x1b66('0xd6'));}var _0x264def=_0x291733[_0x1b66('0x2f')][_0x1b66('0xd7')](/(\r\n|\n|\r)/gm,'\x20');this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format'](_0x1b66('0xd8'),_0x264def));var _0x13c6ca=this[_0x1b66('0xd9')][_0x1b66('0x71')](this,_0x404d24,_0x264def);this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x291733,_0x264def);if(!this[_0x1b66('0x84')](_0x291733[_0x1b66('0xda')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xdb'));}var _0x27a60f=this[_0x1b66('0x12')]['sync'](this,_0x291733[_0x1b66('0xda')]);if(!_0x27a60f){return this['channel'][_0x1b66('0x2c')](_0x291733,_0x1b66('0xdc'));}var _0x569ce9=this;_0x13c6ca[_0x1b66('0xdd')](function(_0x374b0f,_0x212f4c){Object[_0x1b66('0xde')](_0x374b0f)[_0x1b66('0xdd')](function(_0x56f90c){_0x569ce9[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')](_0x1b66('0xdf'),_0x27a60f,_0x212f4c,_0x56f90c),_0x374b0f[_0x56f90c]);});});this[_0x1b66('0xe')][_0x1b66('0x9f')](util['format'](_0x1b66('0xe0'),_0x27a60f),_0x13c6ca[_0x1b66('0x9c')]);return this['channel'][_0x1b66('0xa9')](util['format']('variable\x20%s\x20set',_0x27a60f));};AGIVertices['prototype'][_0x1b66('0xe1')]=function(_0x22f13d){logger[_0x1b66('0xe2')](util[_0x1b66('0x2a')](_0x1b66('0xe3'),_0x22f13d[_0x1b66('0x38')]));if(!this['isConfigured'](_0x22f13d[_0x1b66('0xe4')])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x22f13d,_0x1b66('0xe5'));}var _0x5cec7a=this['getUser'][_0x1b66('0x71')](this,_0x22f13d[_0x1b66('0xe4')]);if(!_0x5cec7a){return this[_0x1b66('0xe')]['error'](_0x22f13d,_0x1b66('0xe6'));}var _0x25efd0=this[_0x1b66('0xe')][_0x1b66('0x59')](_0x1b66('0xe7'),[util[_0x1b66('0x2a')](_0x1b66('0xe8'),_0x5cec7a),_0x22f13d[_0x1b66('0x66')],_0x22f13d[_0x1b66('0xe9')],_0x22f13d[_0x1b66('0x74')]]);if(_0x25efd0['result']===-0x1){return _0x25efd0;}return this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0xea'),_0x1b66('0xe7')));};AGIVertices[_0x1b66('0x11')][_0x1b66('0xeb')]=function(_0xcc5d50){logger['info'](util['format'](_0x1b66('0xec'),_0xcc5d50[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0xcc5d50[_0x1b66('0x81')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xed'));}if(!this[_0x1b66('0x84')](_0xcc5d50['text'])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xaa'));}this[_0x1b66('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0xcc5d50);this[_0x1b66('0x44')](_0xcc5d50[_0x1b66('0x5c')],'in','','');this[_0x1b66('0xe')]['noop'](util['format'](_0x1b66('0xee'),_0xcc5d50[_0x1b66('0x5c')]));var _0x80a3bf=this[_0x1b66('0xef')][_0x1b66('0x71')](this,_0xcc5d50);if(_0x80a3bf){for(var _0x4e0ed8 in _0x80a3bf){if(_0x80a3bf[_0x1b66('0x96')](_0x4e0ed8)){this[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')](_0x1b66('0xf0'),_0x4e0ed8[_0x1b66('0x69')]()),_0x80a3bf[_0x4e0ed8]);}}this['createSquareMessage'](_0x80a3bf['speech'],_0x1b66('0xf1'),_0x1b66('0xeb'),'');return this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format'](_0x1b66('0xf2'),_0x80a3bf[_0x1b66('0xf3')]));}return this['channel']['error'](_0xcc5d50,_0x1b66('0xf4'));};AGIVertices['prototype'][_0x1b66('0xf5')]=function(_0x3fa21e){logger['info'](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x3fa21e['label']));if(!this[_0x1b66('0x84')](_0x3fa21e[_0x1b66('0x7b')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x3fa21e[_0x1b66('0x7c')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xf6'));}if(!this[_0x1b66('0x84')](_0x3fa21e[_0x1b66('0x7d')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x3fa21e['dialogflowV2_language'])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xf7'));}if(!this[_0x1b66('0x84')](_0x3fa21e[_0x1b66('0x5c')])){return this['channel'][_0x1b66('0xa9')](_0x1b66('0xaa'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x3fa21e);this[_0x1b66('0x44')](_0x3fa21e[_0x1b66('0x5c')],'in','','');this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format'](_0x1b66('0xf8'),_0x3fa21e[_0x1b66('0x5c')]));var _0x599e21=this['googleDialogflowV2'][_0x1b66('0x71')](this,_0x3fa21e);if(_0x599e21){for(var _0x5d9648 in _0x599e21){if(_0x599e21[_0x1b66('0x96')](_0x5d9648)){if(_0x5d9648!==_0x1b66('0xf9')){this[_0x1b66('0xe')]['setVariable'](util[_0x1b66('0x2a')](_0x1b66('0xf0'),_0x5d9648['toUpperCase']()),_0x599e21[_0x5d9648]);}}}this[_0x1b66('0x44')](_0x599e21[_0x1b66('0xf3')],_0x1b66('0xf1'),_0x1b66('0xf5'),_0x599e21[_0x1b66('0xf9')]);return this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0xfa'),_0x599e21[_0x1b66('0xf3')]));}return this[_0x1b66('0xe')]['error'](_0x3fa21e,_0x1b66('0xfb'));};AGIVertices[_0x1b66('0x11')][_0x1b66('0xfc')]=function(_0x59fced){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x59fced[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x59fced['ndauth_url'])){return this[_0x1b66('0xe')]['noop'](_0x1b66('0xfd'));}if(!this['isConfigured'](_0x59fced[_0x1b66('0xfe')])){return this[_0x1b66('0xe')]['noop'](_0x1b66('0xff'));}if(!this[_0x1b66('0x84')](_0x59fced[_0x1b66('0x100')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0x101'));}if(!this[_0x1b66('0x84')](_0x59fced[_0x1b66('0x102')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xaa'));}this[_0x1b66('0xe')][_0x1b66('0x103')]=!![];this[_0x1b66('0x36')](_0x59fced);this[_0x1b66('0x44')](_0x59fced[_0x1b66('0x5c')],'in','','');this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format'](_0x1b66('0x104'),_0x59fced[_0x1b66('0x5c')]));var _0x1d3bca=this[_0x1b66('0x7f')][_0x1b66('0x71')](this,_0x59fced);if(_0x1d3bca){for(var _0x2ddc8d in _0x1d3bca){if(_0x1d3bca[_0x1b66('0x96')](_0x2ddc8d)){this[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')](_0x1b66('0x105'),_0x2ddc8d[_0x1b66('0x69')]()),_0x1d3bca[_0x2ddc8d]);}}this[_0x1b66('0x44')](_0x1d3bca[_0x1b66('0xf3')],'out','sesteknda','');if(_0x1d3bca[_0x1b66('0x106')]){this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x107'),_0x1d3bca['audiofile']));var _0xe8ac11=this[_0x1b66('0xe')][_0x1b66('0x108')](_0x1d3bca['audiofile']);try{fs['unlink'](_0x1d3bca[_0x1b66('0x106')]+_0x1b66('0x109'));}catch(_0x1cabe9){logger[_0x1b66('0x2c')](_0x1cabe9);}return _0xe8ac11;}else{return this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x10a'),_0x1d3bca['speech']));}}return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x59fced,_0x1b66('0x10b'));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x10c')]=function(_0x1172a5){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('Enter\x20in\x20END\x20(%s)\x20block',_0x1172a5[_0x1b66('0x38')]));return this[_0x1b66('0xe')][_0x1b66('0xa9')]('end');};AGIVertices[_0x1b66('0x11')]['ext_dial']=function(_0x665bf2){logger['info'](util[_0x1b66('0x2a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x665bf2[_0x1b66('0x38')]));var _0x2417eb='';if(_0x665bf2[_0x1b66('0x10d')]){if(!this[_0x1b66('0x84')](_0x665bf2[_0x1b66('0x10d')])){return this['channel'][_0x1b66('0x2c')](_0x665bf2,_0x1b66('0x10e'));}else{var _0x24798d=parseInt(_0x665bf2[_0x1b66('0x10d')],0xa);if(isNaN(_0x24798d)){_0x2417eb=_0x665bf2['trunk_id'];}else{_0x2417eb=this[_0x1b66('0x1c')][_0x1b66('0x71')](this,_0x665bf2['trunk_id']);if(!_0x2417eb){return this['channel'][_0x1b66('0x2c')](_0x665bf2,_0x1b66('0x10f'));}}}}else if(_0x665bf2[_0x1b66('0x110')]){_0x2417eb=_0x665bf2[_0x1b66('0x110')];}else{return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x665bf2,_0x1b66('0x10e'));}var _0x4a8cb4=this[_0x1b66('0xe')][_0x1b66('0x59')](_0x1b66('0xe7'),[util[_0x1b66('0x2a')]('SIP/%s/%s',_0x2417eb,_0x665bf2[_0x1b66('0x49')]),_0x665bf2['timeout'],_0x665bf2['opts'],_0x665bf2[_0x1b66('0x74')]]);if(_0x4a8cb4[_0x1b66('0xa4')]===-0x1){return _0x4a8cb4;}return this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format'](_0x1b66('0xea'),_0x1b66('0xe7')));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x111')]=function(_0x37b5a7){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x112'),_0x37b5a7[_0x1b66('0x38')]));return this['channel'][_0x1b66('0xa9')](_0x1b66('0x111'));};AGIVertices[_0x1b66('0x11')][_0x1b66('0xd')]=function(_0x4026a5){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0x113'),_0x4026a5['label']));if(_0x4026a5[_0x1b66('0xa6')]===0x0){return this['maxRetry'](_0x4026a5);}_0x4026a5['retry']-=0x1;if(!this[_0x1b66('0x84')](_0x4026a5[_0x1b66('0x114')])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x4026a5,'no\x20file\x20audio\x20selected');}var _0x1e6892=this[_0x1b66('0x1e')][_0x1b66('0x71')](this,_0x4026a5[_0x1b66('0x114')]);if(!_0x1e6892){return this[_0x1b66('0xe')]['error'](_0x4026a5,_0x1b66('0x115'));}if(!this[_0x1b66('0x84')](_0x4026a5['variable_id'])){return this[_0x1b66('0xe')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x395da0=this[_0x1b66('0xe')][_0x1b66('0x116')](_0x1e6892,_0x4026a5[_0x1b66('0x117')],_0x4026a5['maxdigit']);var _0x5b1036=_0x395da0[_0x1b66('0xa4')]?_0x395da0[_0x1b66('0xa4')][_0x1b66('0x4e')]():'';logger[_0x1b66('0x2e')](_0x1b66('0x118'),JSON[_0x1b66('0x75')](_0x395da0));if(_0x395da0[_0x1b66('0xa4')]===-0x1){this['createSquareDetailsReport'][_0x1b66('0x71')](this,_0x4026a5,_0x5b1036);return _0x395da0;}else if(_0x395da0[_0x1b66('0xa2')]===_0x1b66('0x66')){_0x395da0[_0x1b66('0xa4')]=_0x5b1036[_0x1b66('0x9c')]>=parseInt(_0x4026a5[_0x1b66('0x119')])?'x':'i';}else{_0x395da0['result']=_0x5b1036['length']>=parseInt(_0x4026a5['mindigit'])&&_0x5b1036[_0x1b66('0x9c')]<=parseInt(_0x4026a5[_0x1b66('0x11a')])?'x':'i';}var _0x506f73=this[_0x1b66('0x12')][_0x1b66('0x71')](this,_0x4026a5[_0x1b66('0xda')]);if(!_0x506f73){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x4026a5,_0x1b66('0xdc'));}this[_0x1b66('0xe')][_0x1b66('0x9f')](_0x506f73,_0x5b1036);if(this[_0x1b66('0x84')](_0x4026a5[_0x1b66('0x11b')])){var _0x9bfb13=parseInt(_0x4026a5[_0x1b66('0x11b')],0xa);var _0x431706=rs['generate']({'charset':'*','length':_0x9bfb13});var _0x3b28eb=_0x5b1036[_0x1b66('0x9c')];if(_0x3b28eb>0x0){if(_0x3b28eb>_0x9bfb13){this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x4026a5,_0x4026a5[_0x1b66('0x11c')]===_0x1b66('0x11d')?_0x431706+_0x5b1036[_0x1b66('0x11e')](_0x9bfb13):_0x5b1036[_0x1b66('0x11e')](0x0,_0x3b28eb-_0x9bfb13)+_0x431706);}else{this['createSquareDetailsReport'][_0x1b66('0x71')](this,_0x4026a5,rs[_0x1b66('0x11f')]({'charset':'*','length':_0x3b28eb}));}}else{this[_0x1b66('0x36')]['sync'](this,_0x4026a5,'');}}else{this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x4026a5,_0x5b1036);}return _0x395da0;};AGIVertices['prototype']['getsecretdigits']=function(_0x291e94){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0x120'),_0x291e94['label']));return this[_0x1b66('0xd')](_0x291e94);};AGIVertices[_0x1b66('0x11')][_0x1b66('0x121')]=function(_0x1c5a37){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x122'),_0x1c5a37[_0x1b66('0x38')]));this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x1c5a37,_0x1c5a37[_0x1b66('0x123')]);return this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x124'),_0x1c5a37[_0x1b66('0x123')]));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x125')]=function(_0x353f9d){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0x126'),_0x353f9d[_0x1b66('0x38')]));if(!this['isConfigured'](_0x353f9d[_0x1b66('0x87')])||!this[_0x1b66('0x84')](_0x353f9d[_0x1b66('0x88')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x1b66('0x84')](_0x353f9d[_0x1b66('0x5c')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xaa'));}this['channel']['noop'](util[_0x1b66('0x2a')](_0x1b66('0x127'),_0x353f9d['text']));var _0x47ad0a=this[_0x1b66('0x86')][_0x1b66('0x71')](this,_0x353f9d);if(_0x47ad0a){this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x128'),_0x47ad0a));var _0x75d1f6=this[_0x1b66('0xe')][_0x1b66('0x108')](_0x47ad0a);try{fs[_0x1b66('0x129')](_0x47ad0a+_0x1b66('0x109'));}catch(_0x26548b){logger[_0x1b66('0x2c')](_0x26548b);}return _0x75d1f6;}return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x353f9d,_0x1b66('0x12a'));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x12b')]=function(_0x3cf686){logger['info'](util['format'](_0x1b66('0x12c'),_0x3cf686['label']));if(!this[_0x1b66('0x84')](_0x3cf686['aws_access_key_id'])||!this[_0x1b66('0x84')](_0x3cf686['aws_secret_access_key'])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0x12d'));}if(!this['isConfigured'](_0x3cf686[_0x1b66('0x8f')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0x12e'));}if(!this[_0x1b66('0x84')](_0x3cf686[_0x1b66('0x5c')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')]('no\x20text\x20configured');}this['channel'][_0x1b66('0x103')]=!![];this[_0x1b66('0x36')](_0x3cf686);this[_0x1b66('0x44')](_0x3cf686[_0x1b66('0x5c')],'in','','');this['channel'][_0x1b66('0xa9')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x3cf686[_0x1b66('0x5c')]));var _0x598d93=this[_0x1b66('0x8d')][_0x1b66('0x71')](this,_0x3cf686);if(_0x598d93){for(var _0x2bfacb in _0x598d93){if(_0x598d93[_0x1b66('0x96')](_0x2bfacb)&&_[_0x1b66('0x97')](_0x598d93[_0x2bfacb])){this['channel']['setVariable'](util['format'](_0x1b66('0x12f'),_0x2bfacb[_0x1b66('0x69')]()),_0x598d93[_0x2bfacb]);}}if(_['isNil'](_0x598d93[_0x1b66('0x77')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0x130'));}else{this[_0x1b66('0x44')](_0x598d93[_0x1b66('0x77')],_0x1b66('0xf1'),_0x1b66('0x131'),'');return this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format'](_0x1b66('0x132'),_0x598d93[_0x1b66('0x77')]));}}return this[_0x1b66('0xe')]['error'](_0x3cf686,_0x1b66('0x133'));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x134')]=function(_0x2ae4a6){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x135'),_0x2ae4a6[_0x1b66('0x38')],_0x2ae4a6[_0x1b66('0x66')]));if(!this['isConfigured'](_0x2ae4a6[_0x1b66('0x81')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xed'));}var _0x50d403=_0x1b66('0x136');var _0x59506c=util[_0x1b66('0x2a')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x446713=util['format'](_0x1b66('0x9e'),_0x59506c,_0x50d403);var _0x35ab13=!![];if(_0x2ae4a6[_0x1b66('0x137')]===_0x1b66('0x138')){_0x35ab13=![];}var _0x1dd2f0=this[_0x1b66('0xe')][_0x1b66('0x139')](_0x59506c,_0x50d403,_0x2ae4a6[_0x1b66('0x13a')],_0x2ae4a6[_0x1b66('0x66')],undefined,_0x35ab13);if(_0x1dd2f0[_0x1b66('0xa4')]!==-0x1){this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format']('google\x20%s\x20file\x20created',_0x446713));var _0xd0fdd=this[_0x1b66('0x90')][_0x1b66('0x71')](this,_0x2ae4a6,_0x446713);if(_0xd0fdd){for(var _0xb842b8 in _0xd0fdd){if(_0xd0fdd[_0x1b66('0x96')](_0xb842b8)){this[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')]('GOOGLE_ASR_%s',_0xb842b8[_0x1b66('0x69')]()),_0xd0fdd[_0xb842b8]);}}return this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')]('GoogleASR\x20Result\x20%s',JSON[_0x1b66('0x75')](_0xd0fdd)));}}return _0x1dd2f0;};AGIVertices['prototype'][_0x1b66('0x13b')]=function(_0x240cd8){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0x13c'),_0x240cd8[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x240cd8[_0x1b66('0x93')])){return this['channel'][_0x1b66('0xa9')](_0x1b66('0x13d'));}if(!this['isConfigured'](_0x240cd8[_0x1b66('0x94')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0x13e'));}var _0x350a72='wav';var _0x30b4d9=util[_0x1b66('0x2a')](_0x1b66('0x13f'),FILES_PATH,rs[_0x1b66('0x11f')](0x4));var _0x373c20=util[_0x1b66('0x2a')](_0x1b66('0x9e'),_0x30b4d9,_0x350a72);var _0x398548=!![];if(_0x240cd8[_0x1b66('0x137')]===_0x1b66('0x138')){_0x398548=![];}var _0x2e6056=this[_0x1b66('0xe')][_0x1b66('0x139')](_0x30b4d9,_0x350a72,_0x240cd8[_0x1b66('0x13a')],_0x240cd8[_0x1b66('0x66')],undefined,_0x398548);if(_0x2e6056[_0x1b66('0xa4')]!==-0x1){this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x140'),_0x373c20));var _0xb560c3=this[_0x1b66('0x92')][_0x1b66('0x71')](this,_0x240cd8,_0x373c20);if(_0xb560c3){for(var _0x3ae886 in _0xb560c3){if(_0xb560c3['hasOwnProperty'](_0x3ae886)){this[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')]('TILDE_ASR_%s',_0x3ae886['toUpperCase']()),_0xb560c3[_0x3ae886]);}}return this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0x141'),JSON[_0x1b66('0x75')](_0xb560c3)));}}return _0x2e6056;};AGIVertices[_0x1b66('0x11')][_0x1b66('0x142')]=function(_0x3a25b8){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x143'),_0x3a25b8['label']));return this[_0x1b66('0xe')][_0x1b66('0x144')](_0x3a25b8[_0x1b66('0x3e')],_0x3a25b8[_0x1b66('0x3f')],_0x3a25b8[_0x1b66('0x40')]);};AGIVertices[_0x1b66('0x11')]['gotoif']=function(_0x11ae23){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x145'),_0x11ae23['label']));if(!this[_0x1b66('0x84')](_0x11ae23[_0x1b66('0x146')])){return this['channel']['error'](_0x11ae23,_0x1b66('0x147'));}try{var _0x44b045=eval(_0x11ae23[_0x1b66('0x146')])?_0x1b66('0x148'):_0x1b66('0x149');this['channel'][_0x1b66('0xa9')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x11ae23[_0x1b66('0x146')],_0x44b045));return{'code':0xc8,'result':_0x44b045};}catch(_0xe49792){return{'code':0xc8,'result':_0x1b66('0x149')};}};AGIVertices['prototype']['gotoiftime']=function(_0x46bf7d){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x14a'),_0x46bf7d[_0x1b66('0x38')]));if(!this['isConfigured'](_0x46bf7d[_0x1b66('0x14b')])){return this[_0x1b66('0xe')]['error'](_0x46bf7d,'no\x20interval\x20configured');}var _0x2cee3c=this['getIntervals']['sync'](this,_0x46bf7d['interval_id']);if(!_0x2cee3c){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x46bf7d,'no\x20intervals\x20found');}for(var _0x5cff69=0x0;_0x5cff69<_0x2cee3c[_0x1b66('0x9c')];_0x5cff69+=0x1){var _0x3848e2=this[_0x1b66('0xe')][_0x1b66('0x12')](util[_0x1b66('0x2a')](_0x1b66('0x14c'),_0x2cee3c[_0x5cff69]));if(_0x3848e2[_0x1b66('0xa4')]===-0x1){return _0x3848e2;}logger[_0x1b66('0x2e')](util['format']('IFTIME\x20%s\x20%s',_0x2cee3c[_0x5cff69],_0x3848e2[_0x1b66('0xa2')]));if(_0x3848e2[_0x1b66('0xa2')]===_0x1b66('0x148')){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('IFTIME\x20%s\x20%s',_0x2cee3c[_0x5cff69],_0x1b66('0x148')));this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format'](_0x1b66('0x14d'),_0x2cee3c[_0x5cff69],_0x1b66('0x148')));return{'code':0xc8,'result':'true'};}else{logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x14d'),_0x2cee3c[_0x5cff69],_0x1b66('0x149')));this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x14d'),_0x2cee3c[_0x5cff69],_0x1b66('0x149')));}}return{'code':0xc8,'result':_0x1b66('0x149')};};AGIVertices[_0x1b66('0x11')][_0x1b66('0x14e')]=function(_0x38b3c8){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x38b3c8[_0x1b66('0x38')]));return this[_0x1b66('0xe')]['hangup']();};AGIVertices['prototype'][_0x1b66('0x14f')]=function(_0x261f11){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0x150'),_0x261f11[_0x1b66('0x38')]));if(!this['isConfigured'](_0x261f11[_0x1b66('0x81')])){return this['channel'][_0x1b66('0xa9')]('no\x20key\x20configured');}var _0xf34d0e='wav';var _0x3f93e0=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x1b66('0x11f')](0x4));var _0xd701e6=util[_0x1b66('0x2a')](_0x1b66('0x9e'),_0x3f93e0,_0xf34d0e);var _0x3b6de9=!![];if(_0x261f11[_0x1b66('0x137')]==='NOBEEP'){_0x3b6de9=![];}var _0x1ecb5e=this[_0x1b66('0xe')]['recordFile'](_0x3f93e0,_0xf34d0e,_0x261f11[_0x1b66('0x13a')],_0x261f11[_0x1b66('0x66')],undefined,_0x3b6de9);if(_0x1ecb5e['result']!==-0x1){this[_0x1b66('0xe')]['noop'](util['format'](_0x1b66('0x151'),_0xd701e6));var _0x442971=this['ispeechASR'][_0x1b66('0x71')](this,_0x261f11,_0xd701e6);if(_0x442971){for(var _0x9178bf in _0x442971){if(_0x442971[_0x1b66('0x96')](_0x9178bf)){this[_0x1b66('0xe')]['setVariable'](util[_0x1b66('0x2a')](_0x1b66('0x152'),_0x9178bf[_0x1b66('0x69')]()),_0x442971[_0x9178bf]);}}return this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x153'),JSON[_0x1b66('0x75')](_0x442971)));}}return _0x1ecb5e;};AGIVertices[_0x1b66('0x11')][_0x1b66('0x154')]=function(_0x324460){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x324460[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x324460['key'])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xed'));}if(!this[_0x1b66('0x84')](_0x324460[_0x1b66('0x5c')])){return this['channel'][_0x1b66('0xa9')]('no\x20text\x20configured');}this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x155'),_0x324460[_0x1b66('0x5c')]));var _0x1103fe=this['ispeechTTS'][_0x1b66('0x71')](this,_0x324460);if(_0x1103fe){this['channel'][_0x1b66('0xa9')](util['format'](_0x1b66('0x151'),_0x1103fe));var _0x447ea6=this['channel']['streamFile'](_0x1103fe,_0x324460[_0x1b66('0x13a')]);try{fs['unlink'](_0x1103fe+_0x1b66('0x109'));}catch(_0x44061){logger[_0x1b66('0x2c')](_0x44061);}return _0x447ea6;}return this['channel'][_0x1b66('0x2c')](_0x324460,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x1b66('0x11')][_0x1b66('0x156')]=function(_0x2e86be){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0x157'),_0x2e86be[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x2e86be['findBy'])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x2e86be,_0x1b66('0x158'));}logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x159'),this[_0x1b66('0xe')]['callerid'],_0x2e86be['findBy']));var _0xa8853a=this[_0x1b66('0x54')][_0x1b66('0x71')](this,_0x2e86be['findBy']);if(_0xa8853a){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x15a'),this['channel'][_0x1b66('0x3b')],_0x2e86be[_0x1b66('0x15b')]));this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0x15a'),this[_0x1b66('0xe')]['callerid'],_0x2e86be[_0x1b66('0x15b')]));return{'code':0xc8,'result':_0x1b66('0x15c')};}else{logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x15d'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x2e86be[_0x1b66('0x15b')]));this['channel'][_0x1b66('0xa9')](util['format'](_0x1b66('0x15d'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x2e86be[_0x1b66('0x15b')]));return{'code':0xc8,'result':_0x1b66('0x15e')};}};AGIVertices['prototype'][_0x1b66('0x15f')]=function(_0x367f2d){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x367f2d[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x367f2d['findBy'])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x367f2d,_0x1b66('0x158'));}logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x367f2d[_0x1b66('0x15b')]));var _0x4d2685=this[_0x1b66('0x53')]['sync'](this,_0x367f2d['findBy']);if(_0x4d2685){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x15a'),this[_0x1b66('0xe')]['callerid'],_0x367f2d[_0x1b66('0x15b')]));this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x15a'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x367f2d[_0x1b66('0x15b')]));return{'code':0xc8,'result':'success'};}else{logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x367f2d[_0x1b66('0x15b')]));this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0x15d'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x367f2d[_0x1b66('0x15b')]));return{'code':0xc8,'result':_0x1b66('0x15e')};}};AGIVertices['prototype'][_0x1b66('0x160')]=function(_0x4d71ea){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x161'),_0x4d71ea[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x4d71ea['operation'])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x4d71ea,_0x1b66('0x162'));}this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')]('math\x20%s',_0x4d71ea[_0x1b66('0x163')]));var _0x23d0eb=eval(_0x4d71ea[_0x1b66('0x163')]);if(!this[_0x1b66('0x84')](_0x4d71ea[_0x1b66('0xda')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xdb'));}var _0x352f7e=this['getVariable'][_0x1b66('0x71')](this,_0x4d71ea[_0x1b66('0xda')]);if(!_0x352f7e){return this['channel'][_0x1b66('0x2c')](_0x4d71ea,_0x1b66('0xdc'));}if(_[_0x1b66('0x9b')](_0x23d0eb)){var _0x12b41b=this;_0x23d0eb[_0x1b66('0xdd')](function(_0xcd38e3,_0x579f5f){_0x12b41b[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')](_0x1b66('0x164'),_0x352f7e,_0x579f5f),_0xcd38e3);});return this[_0x1b66('0xe')]['noop'](util['format'](_0x1b66('0x165'),_0x352f7e));}else{return this[_0x1b66('0xe')][_0x1b66('0x9f')](_0x352f7e,_0x23d0eb);}};AGIVertices['prototype'][_0x1b66('0xc')]=function(_0x1c35a3){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x166'),_0x1c35a3['label']));if(_0x1c35a3[_0x1b66('0xa6')]===0x0){return this['maxRetry'](_0x1c35a3);}_0x1c35a3[_0x1b66('0xa6')]-=0x1;if(!this['isConfigured'](_0x1c35a3[_0x1b66('0x114')])){return this['channel'][_0x1b66('0x2c')](_0x1c35a3,_0x1b66('0x167'));}var _0x1b1b7a=this[_0x1b66('0x1e')][_0x1b66('0x71')](this,_0x1c35a3[_0x1b66('0x114')]);if(!_0x1b1b7a){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x1c35a3,_0x1b66('0x115'));}var _0x5ad514=this['channel'][_0x1b66('0x116')](_0x1b1b7a,_0x1c35a3[_0x1b66('0x117')],_0x1c35a3['digit']);var _0x34cac1=_0x5ad514[_0x1b66('0xa4')];if(_0x5ad514[_0x1b66('0xa4')]===-0x1){this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x1c35a3,'-1');return _0x5ad514;}else if(_0x5ad514['extra']===_0x1b66('0x66')){_0x5ad514[_0x1b66('0xa4')]=_0x5ad514[_0x1b66('0xa4')][_0x1b66('0x9c')]>0x0?_0x5ad514[_0x1b66('0xa4')]:'t';}else if(_['isEmpty'](_0x5ad514['result'])){_0x5ad514[_0x1b66('0xa4')]='#';_0x34cac1='#';}if(!this[_0x1b66('0x84')](_0x1c35a3[_0x1b66('0xda')])){this[_0x1b66('0xe')][_0x1b66('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x99c9a=this[_0x1b66('0x12')][_0x1b66('0x71')](this,_0x1c35a3[_0x1b66('0xda')]);if(!_0x99c9a){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x1c35a3,_0x1b66('0xdc'));}this[_0x1b66('0xe')][_0x1b66('0x9f')](_0x99c9a,_0x34cac1);}this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x1c35a3,_0x34cac1);return _0x5ad514;};AGIVertices[_0x1b66('0x11')][_0x1b66('0xa9')]=function(_0x4761cc){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x168'),_0x4761cc[_0x1b66('0x38')]));return this[_0x1b66('0xe')]['noop'](_0x4761cc[_0x1b66('0x169')]||_0x4761cc['label']);};AGIVertices[_0x1b66('0x11')][_0x1b66('0x16a')]=function(_0xe81378){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x16b'),_0xe81378['label']));if(!this[_0x1b66('0x84')](_0xe81378[_0x1b66('0x15b')])){return this['channel'][_0x1b66('0x2c')](_0xe81378,_0x1b66('0x158'));}logger[_0x1b66('0x2e')](util['format'](_0x1b66('0x159'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0xe81378[_0x1b66('0x15b')]));var _0x7b7aee=this[_0x1b66('0x16c')]['sync'](this,_0xe81378[_0x1b66('0x16d')]);var _0x273d3a=this[_0x1b66('0x51')][_0x1b66('0x71')](this,_0xe81378[_0x1b66('0x15b')],_0x7b7aee);if(_0x273d3a){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x15a'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0xe81378[_0x1b66('0x15b')]));this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0x15a'),this[_0x1b66('0xe')]['callerid'],_0xe81378['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x1b66('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1b66('0xe')][_0x1b66('0x3b')],_0xe81378[_0x1b66('0x15b')]));this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x15a'),this['channel'][_0x1b66('0x3b')],_0xe81378[_0x1b66('0x15b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x1b66('0x11')][_0x1b66('0x16e')]=function(_0x1ab5bc){logger['info'](util[_0x1b66('0x2a')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x1ab5bc[_0x1b66('0x38')]));if(!this['isConfigured'](_0x1ab5bc['file_id'])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x1ab5bc,_0x1b66('0x167'));}var _0x1dd94e=this[_0x1b66('0x1e')][_0x1b66('0x71')](this,_0x1ab5bc[_0x1b66('0x114')]);if(!_0x1dd94e){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x1ab5bc,_0x1b66('0x115'));}var _0x1b296b=this['channel'][_0x1b66('0x59')](_0x1b66('0x16f'),[_0x1dd94e,_0x1ab5bc[_0x1b66('0xe9')]]);if(_0x1b296b[_0x1b66('0xa4')]===-0x1){return _0x1b296b;}return this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0xc3'),_0x1b66('0x16f'),_0x1dd94e));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x170')]=function(_0x3f122f){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x171'),_0x3f122f[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x3f122f[_0x1b66('0x172')])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x3f122f,'no\x20queue\x20selected');}var _0x20a19c='';var _0x50af84=parseInt(_0x3f122f[_0x1b66('0x172')],0xa);if(isNaN(_0x50af84)){_0x20a19c=_0x3f122f[_0x1b66('0x172')];}else{_0x20a19c=this[_0x1b66('0x173')]['sync'](this,_0x3f122f['queue_id']);if(!_0x20a19c){return this['channel'][_0x1b66('0x2c')](_0x3f122f,_0x1b66('0x174'));}}var _0x2cf6a1='';if(this[_0x1b66('0x84')](_0x3f122f[_0x1b66('0x114')])){var _0x52ac4f=this[_0x1b66('0x1e')][_0x1b66('0x71')](this,_0x3f122f[_0x1b66('0x114')]);if(_0x52ac4f){_0x2cf6a1=_0x52ac4f;}}this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x3f122f,_0x20a19c);if(_0x3f122f['opts'][_0x1b66('0x175')]('x')<0x0){_0x3f122f[_0x1b66('0xe9')]+='x';}if(_0x3f122f[_0x1b66('0xe9')][_0x1b66('0x175')]('X')<0x0){_0x3f122f[_0x1b66('0xe9')]+='X';}this[_0x1b66('0xe')][_0x1b66('0x9f')](_0x1b66('0x176'),_0x20a19c?_0x20a19c['toLowerCase']():'');var _0x253c3b=this['channel'][_0x1b66('0x59')](_0x1b66('0x177'),[_0x20a19c,_0x3f122f[_0x1b66('0xe9')],_0x3f122f['url'],_0x2cf6a1,_0x3f122f[_0x1b66('0x66')],_0x3f122f[_0x1b66('0x8')],_0x3f122f['macro'],_0x3f122f[_0x1b66('0x178')],'',_0x3f122f[_0x1b66('0x179')]]);if(_0x253c3b[_0x1b66('0xa4')]===-0x1){return _0x253c3b;}return this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')]('Executed\x20command\x20%s\x20%s',_0x1b66('0x177'),_0x20a19c));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x17a')]=function(_0x5b5d6d){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x17b'),_0x5b5d6d[_0x1b66('0x38')]));var _0x16974c=_0x5b5d6d[_0x1b66('0x17c')]||'wav';var _0x29bc88=util[_0x1b66('0x2a')](_0x1b66('0x17d'),this['channel'][_0x1b66('0x37')],rs['generate'](0x5));var _0x17a8d0=util[_0x1b66('0x2a')](_0x1b66('0x17e'),FILES_PATH,_0x29bc88,_0x16974c);var _0x1281c2=util['format']('%s/recordings/%s',FILES_PATH,_0x29bc88);this[_0x1b66('0x3c')][_0x1b66('0x71')](this,_0x5b5d6d,_0x29bc88,_0x17a8d0);this['channel']['setVariable'](_0x1b66('0x17f'),_0x29bc88);logger[_0x1b66('0x2e')](_0x1b66('0x180'),_0x1281c2,_0x16974c,_0x5b5d6d[_0x1b66('0x181')],_0x5b5d6d['timeout']);return this['channel'][_0x1b66('0x139')](_0x1281c2,_0x16974c,_0x5b5d6d[_0x1b66('0x181')],_0x5b5d6d[_0x1b66('0x66')],undefined,!![]);};AGIVertices['prototype'][_0x1b66('0x182')]=function(_0x1005c8){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x1005c8['label']));if(!this['isConfigured'](_0x1005c8[_0x1b66('0x74')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')]('no\x20url\x20configured');}var _0x345b87=this[_0x1b66('0x63')][_0x1b66('0x71')](this,_0x1005c8);logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x183'),util[_0x1b66('0x184')](_0x345b87,{'showHidden':![],'depth':null})));if(!this[_0x1b66('0x84')](_0x1005c8[_0x1b66('0xda')])){return this['channel']['noop'](_0x1b66('0x185'));}var _0x1ee46d=this[_0x1b66('0x12')][_0x1b66('0x71')](this,_0x1005c8[_0x1b66('0xda')]);if(!_0x1ee46d){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x1005c8,_0x1b66('0xdc'));}this[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')](_0x1b66('0x186'),_0x1ee46d),_0x345b87[_0x1b66('0x76')]?_0x345b87[_0x1b66('0x76')]:_0x1b66('0x187'));this[_0x1b66('0xe')][_0x1b66('0x9f')](util[_0x1b66('0x2a')](_0x1b66('0x188'),_0x1ee46d),_0x345b87[_0x1b66('0x189')]?_0x345b87[_0x1b66('0x189')]:'OK');if(_0x345b87[_0x1b66('0x6a')]){try{this[_0x1b66('0x9d')](_0x345b87[_0x1b66('0x6a')],_0x1ee46d);}catch(_0x52cdec){logger[_0x1b66('0x2c')](util[_0x1b66('0x2a')](_0x1b66('0x18a'),_0x1ee46d));}}return this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0x18b'),_0x1ee46d));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x18c')]=function(_0x1473b5){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x18d'),_0x1473b5[_0x1b66('0x38')]));return this[_0x1b66('0xe')]['sayDigits'](_0x1473b5[_0x1b66('0x18e')][_0x1b66('0xd7')](/\s+/g,''),_0x1473b5[_0x1b66('0x181')]);};AGIVertices[_0x1b66('0x11')][_0x1b66('0x18f')]=function(_0x80e942){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x80e942['label']));return this[_0x1b66('0xe')][_0x1b66('0x190')](_0x80e942['number'][_0x1b66('0xd7')](/\s+/g,''),_0x80e942[_0x1b66('0x181')]);};AGIVertices[_0x1b66('0x11')][_0x1b66('0x191')]=function(_0x20751c){logger[_0x1b66('0x2e')](util['format'](_0x1b66('0x192'),_0x20751c[_0x1b66('0x38')]));return this[_0x1b66('0xe')][_0x1b66('0x193')](_0x20751c[_0x1b66('0x5c')],_0x20751c[_0x1b66('0x181')]);};AGIVertices['prototype'][_0x1b66('0x194')]=function(_0x390762){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x390762['label']));if(!this[_0x1b66('0x84')](_0x390762[_0x1b66('0x195')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0x196'));}var _0xe2b928=this[_0x1b66('0x22')][_0x1b66('0x71')](this,_0x390762[_0x1b66('0x195')]);if(!_0xe2b928||!_0xe2b928[_0x1b66('0x197')]){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x390762,_0x1b66('0x198'));}var _0x5ae4d0={'from':util['format'](_0x1b66('0x199'),_0xe2b928[_0x1b66('0x14')],_0xe2b928[_0x1b66('0x19a')]||_0xe2b928[_0x1b66('0x197')][_0x1b66('0x19b')]),'to':_0x390762['to']||'','cc':_0x390762['cc']||'','bcc':_0x390762['bcc']||'','subject':_0x390762['subject'],'html':_0x390762[_0x1b66('0x5c')],'text':_0x390762['text']};var _0x4a5a9d={'tls':{'rejectUnauthorized':![]}};if(_0xe2b928['Smtp'][_0x1b66('0x19c')]){_0x4a5a9d[_0x1b66('0x19c')]=_0xe2b928[_0x1b66('0x197')][_0x1b66('0x19c')];}else{_0x4a5a9d[_0x1b66('0x19d')]=_0xe2b928[_0x1b66('0x197')][_0x1b66('0x19d')];_0x4a5a9d[_0x1b66('0x19e')]=_0xe2b928['Smtp'][_0x1b66('0x19e')];_0x4a5a9d[_0x1b66('0x19f')]=_0xe2b928[_0x1b66('0x197')][_0x1b66('0x19f')];}if(_0xe2b928[_0x1b66('0x197')][_0x1b66('0x1a0')]){_0x4a5a9d['auth']={'user':_0xe2b928[_0x1b66('0x197')][_0x1b66('0x19b')],'pass':_0xe2b928[_0x1b66('0x197')][_0x1b66('0x1a1')]};}if(this[_0x1b66('0x84')](_0x390762[_0x1b66('0x1a2')])){}logger[_0x1b66('0xe2')]('sendMail\x20message',JSON['stringify'](_0x5ae4d0));this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x390762,_0x390762[_0x1b66('0x195')]);this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x1a3'),_0xe2b928['name']));this['sendMailMessage'][_0x1b66('0x71')](this,_0x4a5a9d,_0x5ae4d0);return this['channel']['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x1b66('0x11')][_0x1b66('0x1a4')]=function(_0x23b68a){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x1a5'),_0x23b68a[_0x1b66('0x38')]));return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0x1a6'));};AGIVertices[_0x1b66('0x11')]['sendSMS']=function(_0x37d1da){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x1a7'),_0x37d1da[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x37d1da[_0x1b66('0x1a8')])){return this[_0x1b66('0xe')][_0x1b66('0xa9')]('no\x20sms\x20account\x20configured');}var _0x23a0a5=this['getSmsAccount'][_0x1b66('0x71')](this,_0x37d1da['sms_account_id']);if(!_0x23a0a5){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x37d1da,_0x1b66('0x1a9'));}var _0x28972a={'body':_0x37d1da[_0x1b66('0x1aa')],'phone':_0x37d1da['to']||'','SmsAccountId':_0x23a0a5['id']};logger[_0x1b66('0xe2')]('sendSMS\x20message',JSON[_0x1b66('0x75')](_0x28972a));this[_0x1b66('0x36')]['sync'](this,_0x37d1da,_0x37d1da[_0x1b66('0x1a8')]);this[_0x1b66('0xe')]['noop'](util['format'](_0x1b66('0x1ab'),_0x23a0a5[_0x1b66('0x14')]));this[_0x1b66('0x35')]['sync'](this,_0x28972a);return this[_0x1b66('0xe')]['noop'](_0x1b66('0x1ac'));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x1ad')]=function(_0x54ea93){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x1ae'),_0x54ea93[_0x1b66('0x38')]));if(!this[_0x1b66('0x84')](_0x54ea93[_0x1b66('0xda')])){return this[_0x1b66('0xe')]['error'](_0x54ea93,_0x1b66('0x1af'));}var _0x54145c=this[_0x1b66('0x12')][_0x1b66('0x71')](this,_0x54ea93['variable_id']);if(!_0x54145c){return this[_0x1b66('0xe')]['error'](_0x54ea93,'no\x20variable\x20found');}return this[_0x1b66('0xe')]['setVariable'](_0x54145c,_0x54ea93[_0x1b66('0x1b0')]);};AGIVertices['prototype'][_0x1b66('0x1b1')]=function(_0x3f487e){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x1b2'),_0x3f487e[_0x1b66('0x38')]));this[_0x1b66('0xe')][_0x1b66('0xa9')]('START\x20CALLY\x20SQUARE');if(_0x3f487e['answer']===_0x1b66('0x1b3')){this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0x1b4'));return this['channel']['answer']();}return this['channel'][_0x1b66('0xa9')](_0x1b66('0x1b5'));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x1b6')]=function(_0x288cd3){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x1b7'),_0x288cd3['label']));if(!this['isConfigured'](_0x288cd3[_0x1b66('0x1b8')])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x288cd3,'no\x20subproject\x20selected');}var _0x392f36=this[_0x1b66('0x16')]['sync'](this,_0x288cd3[_0x1b66('0x1b8')]);if(!this[_0x1b66('0x84')](_0x392f36)){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x288cd3,util[_0x1b66('0x2a')](_0x1b66('0x1b9'),_0x288cd3['project_id']));}if(_0x392f36===this[_0x1b66('0xe')][_0x1b66('0x3a')]){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x288cd3,_0x1b66('0x1ba'));}this[_0x1b66('0x36')][_0x1b66('0x71')](this,_0x288cd3,_0x392f36);var _0x116666=this['channel'][_0x1b66('0x59')](_0x1b66('0x1bb'),util[_0x1b66('0x2a')](_0x1b66('0x1bc'),config[_0x1b66('0x8')]['host']||_0x1b66('0x1bd'),_0x392f36,this[_0x1b66('0xe')][_0x1b66('0x3a')]));if(_0x116666[_0x1b66('0xa4')]===-0x1){return _0x116666;}return this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0xc3'),_0x1b66('0x1bb'),_0x392f36));};AGIVertices[_0x1b66('0x11')][_0x1b66('0x1be')]=function(_0x201abe){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x1bf'),_0x201abe[_0x1b66('0x38')]));var _0x1240ee=this[_0x1b66('0x58')][_0x1b66('0x71')](this,_0x201abe['command']);this['createSquareDetailsReport'][_0x1b66('0x71')](this,_0x201abe,_0x201abe['command']);if(this[_0x1b66('0x84')](_0x201abe[_0x1b66('0xda')])){var _0x4ed41c=this[_0x1b66('0x12')]['sync'](this,_0x201abe[_0x1b66('0xda')]);if(_0x4ed41c){this[_0x1b66('0xe')][_0x1b66('0x9f')](_0x4ed41c,_0x1240ee);return this[_0x1b66('0xe')][_0x1b66('0xa9')](util['format'](_0x1b66('0x1c0'),_0x201abe[_0x1b66('0xb6')],_0x4ed41c));}}return this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x1c1'),_0x201abe[_0x1b66('0xb6')]));};AGIVertices[_0x1b66('0x11')]['google_cloud_tts']=function(_0x2be336){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x1c2'),_0x2be336[_0x1b66('0x38')]));_0x2be336['text']=_0x2be336[_0x1b66('0x5c')][_0x1b66('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1b66('0x84')](_0x2be336[_0x1b66('0x1c3')])){return this[_0x1b66('0xe')]['noop'](_0x1b66('0x1c4'));}if(!this[_0x1b66('0x84')](_0x2be336['text'])){return this[_0x1b66('0xe')][_0x1b66('0xa9')](_0x1b66('0xaa'));}this['channel'][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x1c5'),_0x2be336[_0x1b66('0x5c')]));var _0x360814=this[_0x1b66('0x5a')][_0x1b66('0x71')](this,_0x2be336);if(_0x360814){this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x1c6'),_0x360814));var _0x3f2823=this[_0x1b66('0xe')][_0x1b66('0x108')](_0x360814);try{fs['unlink'](_0x360814+_0x1b66('0x109'));}catch(_0x2e4ceb){logger[_0x1b66('0x2c')](_0x2e4ceb);}return _0x3f2823;}return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x2be336,_0x1b66('0x1c7'));};AGIVertices['prototype'][_0x1b66('0x1c8')]=function(_0x3b45f2){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x1c9'),_0x3b45f2[_0x1b66('0x38')]));_0x3b45f2[_0x1b66('0x5c')]=_0x3b45f2[_0x1b66('0x5c')][_0x1b66('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1b66('0x84')](_0x3b45f2[_0x1b66('0x5c')])){return this[_0x1b66('0xe')]['noop'](_0x1b66('0xaa'));}this[_0x1b66('0xe')]['noop'](util[_0x1b66('0x2a')](_0x1b66('0x1ca'),_0x3b45f2['text']));var _0x2f4aa4=this['googleTTS']['sync'](this,_0x3b45f2);if(_0x2f4aa4){this['channel']['noop'](util[_0x1b66('0x2a')](_0x1b66('0x1cb'),_0x2f4aa4));var _0x2b9fb1=this['channel'][_0x1b66('0x108')](_0x2f4aa4);try{fs[_0x1b66('0x129')](_0x2f4aa4+'.wav');}catch(_0x2c34f8){logger['error'](_0x2c34f8);}return _0x2b9fb1;}return this['channel'][_0x1b66('0x2c')](_0x3b45f2,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x1b66('0x1cc')]=function(_0x5abf64){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x1cd'),_0x5abf64['label']));if(!this[_0x1b66('0x84')](_0x5abf64[_0x1b66('0x15b')])){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x5abf64,_0x1b66('0x158'));}logger['info'](util['format'](_0x1b66('0x159'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x5abf64[_0x1b66('0x15b')]));var _0x4ececd=this[_0x1b66('0x52')][_0x1b66('0x71')](this,_0x5abf64[_0x1b66('0x15b')]);if(_0x4ececd){logger['info'](util[_0x1b66('0x2a')](_0x1b66('0x15a'),this['channel'][_0x1b66('0x3b')],_0x5abf64[_0x1b66('0x15b')]));this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1b66('0xe')]['callerid'],_0x5abf64[_0x1b66('0x15b')]));return{'code':0xc8,'result':_0x1b66('0x15c')};}else{logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x15d'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x5abf64[_0x1b66('0x15b')]));this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0x15d'),this[_0x1b66('0xe')][_0x1b66('0x3b')],_0x5abf64[_0x1b66('0x15b')]));return{'code':0xc8,'result':_0x1b66('0x15e')};}};AGIVertices[_0x1b66('0x11')][_0x1b66('0x1ce')]=function(_0x567101){logger[_0x1b66('0x2e')](util[_0x1b66('0x2a')](_0x1b66('0x1cf'),_0x567101[_0x1b66('0x38')]));var _0x453ad4=this[_0x1b66('0xe')][_0x1b66('0x59')](_0x1b66('0x1d0'),[_0x567101['mailbox'],_0x567101[_0x1b66('0x79')]]);if(_0x453ad4[_0x1b66('0xa4')]===-0x1){return _0x453ad4;}return this[_0x1b66('0xe')][_0x1b66('0xa9')](util[_0x1b66('0x2a')](_0x1b66('0xc3'),'VOICEMAIL',_0x567101[_0x1b66('0x1d1')]));};AGIVertices['prototype'][_0x1b66('0x1d2')]=function(_0x26c3b3){logger[_0x1b66('0x2e')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x26c3b3[_0x1b66('0x38')]));if(!this['isConfigured'](_0x26c3b3[_0x1b66('0xda')])){return this[_0x1b66('0xe')]['error'](_0x26c3b3,'no\x20variable\x20selected');}var _0x47b173=this[_0x1b66('0x12')][_0x1b66('0x71')](this,_0x26c3b3[_0x1b66('0xda')]);if(!_0x47b173){return this[_0x1b66('0xe')][_0x1b66('0x2c')](_0x26c3b3,_0x1b66('0xdc'));}var _0xb9a293=this[_0x1b66('0xe')][_0x1b66('0x12')](_0x47b173);return{'code':0xc8,'result':_0xb9a293[_0x1b66('0xa2')]?_0xb9a293[_0x1b66('0xa2')]:'-'};};String[_0x1b66('0x11')]['replaceAll']=function(_0x30e1b2,_0x1e643b){return this[_0x1b66('0xa0')](_0x30e1b2)['join'](_0x1e643b);};module[_0x1b66('0x1d3')]=AGIVertices; \ No newline at end of file +var _0xea08=['IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','beep','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','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','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','digit','output','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','position','Executed\x20command\x20%s\x20%s','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','authentication','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','start','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','channel','rpc','mailRpc','prototype','then','name','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getTrunk','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','Intervals','interval','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','arg_1','callerid','createSquareRecording','context','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','timeout','number','includes','POST','PUT','method','toUpperCase','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','render','url','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clear','agicommand','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','saveRestApiResult','%s.%s','length','setVariable','split','replaceAll','getVariable','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','sync','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','no\x20text\x20configured','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','DIAL','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','googleDialogflow','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DIALOGFLOW_%s','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xea08,0x7f));var _0x8ea0=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xea08[_0x59ee6f];return _0x4c0979;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x8ea0('0x0'));var _=require(_0x8ea0('0x1'));var sh=require(_0x8ea0('0x2'));var odbc=require(_0x8ea0('0x3'))();var rs=require(_0x8ea0('0x4'));var moment=require(_0x8ea0('0x5'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x8ea0('0x6'))(_0x8ea0('0x7'));var config=require(_0x8ea0('0x8'));var scripts=require(_0x8ea0('0x9'));var FILES_PATH=_0x8ea0('0xa');var recursiveMapAttributes=[_0x8ea0('0xb'),_0x8ea0('0xc')];var verticesWithRetry=[_0x8ea0('0xd'),_0x8ea0('0xe'),'getsecretdigits'];var AGIVertices=function(_0x2a90f6,_0x16bc6e,_0x137f9f){this[_0x8ea0('0xf')]=_0x2a90f6;this[_0x8ea0('0x10')]=_0x16bc6e;this[_0x8ea0('0x11')]=_0x137f9f;};AGIVertices[_0x8ea0('0x12')]['getVariable']=function(_0xc0f064,_0x145989){this['rpc']['getVariableById'](_0xc0f064)[_0x8ea0('0x13')](function(_0x5401f7){_0x145989(null,_0x5401f7?_0x5401f7[_0x8ea0('0x14')]:![]);})[_0x8ea0('0x15')](function(_0xab72eb){_0x145989(_0xab72eb);});};AGIVertices[_0x8ea0('0x12')]['getVoiceQueue']=function(_0x34efc3,_0x919215){this['rpc']['getVoiceQueueById'](_0x34efc3)[_0x8ea0('0x13')](function(_0x3e4e2c){_0x919215(null,_0x3e4e2c?_0x3e4e2c[_0x8ea0('0x14')]:![]);})[_0x8ea0('0x15')](function(_0x267d8d){_0x919215(_0x267d8d);});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x16')]=function(_0x39fd3a,_0x2df92b){this[_0x8ea0('0x10')][_0x8ea0('0x17')](_0x39fd3a)[_0x8ea0('0x13')](function(_0x4850a4){_0x2df92b(null,_0x4850a4?_0x4850a4['name']:![]);})['catch'](function(_0x346948){_0x2df92b(_0x346948);});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x18')]=function(_0x5c534e,_0x495514){this[_0x8ea0('0x10')][_0x8ea0('0x19')](_0x5c534e)[_0x8ea0('0x13')](function(_0x44b136){_0x495514(null,_0x44b136?_0x44b136['dsn']:![]);})[_0x8ea0('0x15')](function(_0xfe1b79){_0x495514(_0xfe1b79);});};AGIVertices['prototype']['getUser']=function(_0x577dc6,_0x2222de){this[_0x8ea0('0x10')]['getUserById'](_0x577dc6)['then'](function(_0x507e80){_0x2222de(null,_0x507e80?_0x507e80['name']:![]);})[_0x8ea0('0x15')](function(_0x4692d3){_0x2222de(_0x4692d3);});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x1a')]=function(_0x1ef936,_0xcb9ed5){this[_0x8ea0('0x10')]['getTrunkById'](_0x1ef936)[_0x8ea0('0x13')](function(_0x57598f){_0xcb9ed5(null,_0x57598f?_0x57598f['name']:![]);})[_0x8ea0('0x15')](function(_0x507c90){_0xcb9ed5(_0x507c90);});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x1b')]=function(_0x386e7b,_0x2ff74b){var _0x21f288=this;this[_0x8ea0('0x10')][_0x8ea0('0x1c')](_0x386e7b)[_0x8ea0('0x13')](function(_0x469ada){_0x2ff74b(null,_0x469ada?_0x21f288[_0x8ea0('0x1d')](_0x469ada[_0x8ea0('0x1e')]):![]);})['catch'](function(_0x18c129){_0x2ff74b(_0x18c129);});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x1f')]=function(_0xf2cc7d,_0x5c2d9c){this[_0x8ea0('0x10')][_0x8ea0('0x20')](_0xf2cc7d)['then'](function(_0x428556){_0x5c2d9c(null,_0x428556?_0x428556:![]);})[_0x8ea0('0x15')](function(_0x5a7dfd){_0x5c2d9c(_0x5a7dfd);});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x21')]=function(_0x344b14,_0x10bf65,_0x3c454a){this[_0x8ea0('0x11')]['sendMailMessage'](_0x344b14,_0x10bf65)[_0x8ea0('0x13')](function(){_0x3c454a(null);})[_0x8ea0('0x15')](function(_0x423fbd){_0x3c454a(_0x423fbd);});};AGIVertices['prototype'][_0x8ea0('0x22')]=function(_0x4fd09f,_0x52732c){this[_0x8ea0('0x10')][_0x8ea0('0x23')](_0x4fd09f)[_0x8ea0('0x13')](function(_0x5baba2){if(_0x5baba2){if(_0x5baba2[_0x8ea0('0x24')]){_0x52732c(null,[_0x5baba2['interval']]);}else{_0x52732c(null,_['map'](_0x5baba2[_0x8ea0('0x25')],_0x8ea0('0x26')));}}else{_0x52732c(null,![]);}})['catch'](function(_0x4e7225){_0x52732c(_0x4e7225);});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x1d')]=function(_0x2c9db2){return util[_0x8ea0('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x2c9db2);};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x28')]=function(_0x5865cb,_0x164b8f,_0x464cab){odbc[_0x8ea0('0x29')](_0x5865cb,function(_0x4f2c2f){if(_0x4f2c2f){logger[_0x8ea0('0x2a')](_0x8ea0('0x2b'),_0x4f2c2f);_0x464cab(_0x4f2c2f);}else{logger['info'](_0x8ea0('0x2c'));odbc['query'](_0x164b8f,function(_0x9814c6,_0x3a2f04){if(_0x9814c6){logger[_0x8ea0('0x2d')](_0x8ea0('0x2e'),_0x164b8f);_0x464cab(_0x9814c6);}else{logger[_0x8ea0('0x2d')](_0x8ea0('0x2f'),_0x164b8f);odbc[_0x8ea0('0x30')](function(_0x2554a1){if(_0x2554a1){logger[_0x8ea0('0x2a')](_0x8ea0('0x31'),_0x2554a1);}_0x464cab(null,_0x3a2f04);});}});}});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x32')]=function(_0x4ed2ac,_0x2e5157){this['rpc'][_0x8ea0('0x33')](_0x4ed2ac)[_0x8ea0('0x13')](function(_0x5156c5){_0x2e5157(null,_0x5156c5?_0x5156c5:![]);})[_0x8ea0('0x15')](function(_0x29f941){_0x2e5157(_0x29f941);});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x34')]=function(_0xc65af,_0x45c401){this[_0x8ea0('0x10')][_0x8ea0('0x34')](_0xc65af)[_0x8ea0('0x13')](function(_0x40e126){_0x45c401(null,_0x40e126);})[_0x8ea0('0x15')](function(_0x44e748){_0x45c401(_0x44e748);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x17fe0a,_0x3ea9bc,_0x36d4f3){this[_0x8ea0('0x10')][_0x8ea0('0x35')]({'uniqueid':this[_0x8ea0('0xf')][_0x8ea0('0x36')],'node':_0x17fe0a['label'],'application':_0x17fe0a['agicommand'],'data':_0x3ea9bc||null,'project_name':this['channel'][_0x8ea0('0x37')],'callerid':this[_0x8ea0('0xf')][_0x8ea0('0x38')]})['then'](function(_0xdd7876){if(_0x36d4f3){_0x36d4f3(null,_0xdd7876);}})[_0x8ea0('0x15')](function(_0x456aec){if(_0x36d4f3){_0x36d4f3(_0x456aec);}});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x39')]=function(_0x56f8c8,_0x445461,_0x39c72f,_0x53a8ca){this['rpc']['createSquareRecording']({'uniqueid':this[_0x8ea0('0xf')]['uniqueid'],'callerid':this[_0x8ea0('0xf')][_0x8ea0('0x38')],'calleridname':this[_0x8ea0('0xf')]['calleridname'],'context':this['channel'][_0x8ea0('0x3a')],'extension':this['channel']['extension'],'priority':this[_0x8ea0('0xf')]['priority'],'accountcode':this[_0x8ea0('0xf')][_0x8ea0('0x3b')],'dnid':this[_0x8ea0('0xf')][_0x8ea0('0x3c')],'projectName':this[_0x8ea0('0xf')][_0x8ea0('0x37')],'saveName':_0x445461,'filename':_0x56f8c8['file']||_0x445461,'savePath':_0x39c72f})[_0x8ea0('0x13')](function(_0x314637){_0x53a8ca(null,_0x314637);})['catch'](function(_0x553d65){_0x53a8ca(_0x553d65);});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x3d')]=function(_0x1acd25,_0x4c3735,_0x2d75df,_0x4f5fcc,_0x8239bd){this[_0x8ea0('0x10')][_0x8ea0('0x3d')]({'uniqueid':this[_0x8ea0('0xf')][_0x8ea0('0x36')],'body':_0x1acd25,'direction':_0x4c3735,'providerName':_0x2d75df,'providerResponse':_0x4f5fcc})[_0x8ea0('0x13')](function(_0x52ff6b){if(_0x8239bd){_0x8239bd(null,_0x52ff6b);}})['catch'](function(_0x4980c3){if(_0x8239bd){_0x8239bd(_0x4980c3);}});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x3e')]=function(_0x19cb2e,_0x8bc507){this[_0x8ea0('0x10')]['createCmContact']({'firstName':_[_0x8ea0('0x3f')](_0x19cb2e[_0x8ea0('0x14')])||_[_0x8ea0('0x40')](_0x19cb2e['name'])?'callback_'+Math[_0x8ea0('0x41')]():_0x19cb2e[_0x8ea0('0x14')],'lastName':_[_0x8ea0('0x3f')](_0x19cb2e[_0x8ea0('0x42')])||_['isNil'](_0x19cb2e[_0x8ea0('0x42')])?null:_0x19cb2e[_0x8ea0('0x42')],'phone':_0x19cb2e[_0x8ea0('0x43')],'ListId':_0x19cb2e[_0x8ea0('0x44')],'scheduledat':_0x19cb2e[_0x8ea0('0x45')],'callbackUniqueid':this[_0x8ea0('0xf')][_0x8ea0('0x36')],'tags':'callback','description':_0x8ea0('0x46')+_0x19cb2e[_0x8ea0('0x45')]['toString'](),'priority':_0x19cb2e['callback_priority']})[_0x8ea0('0x13')](function(_0xf8cf84){_0x8bc507(null,_0xf8cf84);})[_0x8ea0('0x15')](function(_0x3e232c){_0x8bc507(_0x3e232c);});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x47')]=function(_0x9ea4ab,_0x1d0b7d){this[_0x8ea0('0x10')][_0x8ea0('0x48')](_0x9ea4ab)[_0x8ea0('0x13')](function(_0x3a66a8){_0x1d0b7d(null,_0x3a66a8?_0x3a66a8[_0x8ea0('0x14')]:![]);})[_0x8ea0('0x15')](function(_0x2a0fe0){_0x1d0b7d(_0x2a0fe0);});};AGIVertices['prototype'][_0x8ea0('0x49')]=function(_0x5c2b43,_0x2272e1,_0x53afa6){var _0x24012c={'role':_0x8ea0('0x4a')};_0x24012c[_0x5c2b43]=this[_0x8ea0('0xf')][_0x8ea0('0x38')];this[_0x8ea0('0x10')][_0x8ea0('0x49')](_0x24012c,_0x2272e1,this[_0x8ea0('0xf')][_0x8ea0('0x36')])['then'](function(_0xe648a0){_0x53afa6(null,_[_0x8ea0('0x40')](_0xe648a0)?![]:!![]);})[_0x8ea0('0x15')](function(_0x51e820){logger['error'](_0x51e820);_0x53afa6(null,![]);});};AGIVertices[_0x8ea0('0x12')]['agentUnpause']=function(_0x184b80,_0xb4bf54){var _0xe68cd6={'role':_0x8ea0('0x4a')};_0xe68cd6[_0x184b80]=this[_0x8ea0('0xf')][_0x8ea0('0x38')];this['rpc'][_0x8ea0('0x4b')](_0xe68cd6)[_0x8ea0('0x13')](function(_0x139e4f){_0xb4bf54(null,_[_0x8ea0('0x40')](_0x139e4f)?![]:!![]);})[_0x8ea0('0x15')](function(_0x216bad){logger[_0x8ea0('0x2a')](_0x216bad);_0xb4bf54(null,![]);});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x4c')]=function(_0x809e70,_0x31eb35){var _0x6aa59e={'role':'agent'};_0x6aa59e[_0x809e70]=this[_0x8ea0('0xf')][_0x8ea0('0x38')];this[_0x8ea0('0x10')][_0x8ea0('0x4c')](_0x6aa59e)['then'](function(_0xd5a1fa){_0x31eb35(null,_[_0x8ea0('0x40')](_0xd5a1fa)?![]:!![]);})[_0x8ea0('0x15')](function(_0x1655cd){logger['error'](_0x1655cd);_0x31eb35(null,![]);});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x4d')]=function(_0x88da68,_0x50d396){var _0x3a95f5={'role':_0x8ea0('0x4a')};_0x3a95f5[_0x88da68]=this['channel']['callerid'];var _0xe7c2d5=_0x88da68!='internal'?util[_0x8ea0('0x27')](_0x8ea0('0x4e'),_0x8ea0('0x4f'),this['channel']['callerid']):undefined;this[_0x8ea0('0x10')]['agentLogin'](_0x3a95f5,_0xe7c2d5)[_0x8ea0('0x13')](function(_0x4f3a14){_0x50d396(null,_['isNil'](_0x4f3a14)?![]:!![]);})[_0x8ea0('0x15')](function(_0x30f9f5){logger[_0x8ea0('0x2a')](_0x30f9f5);_0x50d396(null,![]);});};AGIVertices[_0x8ea0('0x12')]['shellCommand']=function(_0x4b29d5,_0x304f6c){sh[_0x8ea0('0x50')](_['trim'](_0x4b29d5),function(_0x1183dd,_0x5d2dc6){var _0x538613=_0x5d2dc6[_0x8ea0('0x51')](/(\r\n|\n|\r)/gm,'');_0x304f6c(null,_0x538613);});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x52')]=function(_0x1796cc,_0x1182a9){scripts[_0x8ea0('0x52')](_0x1796cc[_0x8ea0('0x53')],_0x1796cc[_0x8ea0('0x54')]||'text',_0x1796cc[_0x8ea0('0x55')],_0x1796cc[_0x8ea0('0x56')]||_0x8ea0('0x57'),_0x1796cc['ssmlGender']||_0x8ea0('0x58'),_0x1796cc[_0x8ea0('0x59')]||_0x8ea0('0x5a'))[_0x8ea0('0x13')](function(_0x227c5a){_0x1182a9(null,_0x227c5a);})[_0x8ea0('0x15')](function(_0x488055){_0x1182a9(_0x488055);});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x5b')]=function(_0x217fdb,_0x206ecf){scripts[_0x8ea0('0x5b')](_0x217fdb[_0x8ea0('0x55')],_0x217fdb[_0x8ea0('0x5c')]||'en',0x1)[_0x8ea0('0x13')](function(_0x532de9){_0x206ecf(null,_0x532de9);})['catch'](function(_0x249e75){_0x206ecf(_0x249e75);});};AGIVertices[_0x8ea0('0x12')]['restAPI']=function(_0x300992,_0x2c4e03){var _0x471d80={'uri':_0x300992['url'],'method':_0x300992['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x300992[_0x8ea0('0x5d')])===_0x8ea0('0x5e')&&parseInt(_0x300992[_0x8ea0('0x5d')])>=0x1?parseInt(_0x300992[_0x8ea0('0x5d')])*0x3e8:0x5*0x3e8};if(_[_0x8ea0('0x5f')]([_0x8ea0('0x60'),_0x8ea0('0x61')],_0x471d80[_0x8ea0('0x62')][_0x8ea0('0x63')]())){try{_0x471d80['body']=_0x300992['rawBody']?JSON['parse'](_0x300992['rawBody']):{};}catch(_0x3c1de2){logger[_0x8ea0('0x2a')](_0x8ea0('0x64'),_0x3c1de2);}}try{_0x471d80[_0x8ea0('0x65')]=_0x300992[_0x8ea0('0xb')]?JSON[_0x8ea0('0x66')](_0x300992[_0x8ea0('0xb')]):{};}catch(_0x29457f){logger[_0x8ea0('0x2a')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x29457f);}if(_0x300992['computedVariables']){try{var _0x2c6bc0=require(_0x300992['computedVariables'])['sync'](this,_0x471d80);_0x471d80['uri']=Mustache[_0x8ea0('0x67')](_0x300992[_0x8ea0('0x68')],_0x2c6bc0,{},['$$','$$']);if(_0x471d80[_0x8ea0('0x65')]){_0x471d80[_0x8ea0('0x65')]=JSON[_0x8ea0('0x66')](Mustache[_0x8ea0('0x67')](JSON[_0x8ea0('0x69')](_0x471d80['headers']),_0x2c6bc0,{},['$$','$$']));}if(_0x471d80['body']){_0x471d80[_0x8ea0('0x6a')]=JSON[_0x8ea0('0x66')](Mustache[_0x8ea0('0x67')](JSON[_0x8ea0('0x69')](_0x471d80[_0x8ea0('0x6a')]),_0x2c6bc0,{},['$$','$$']));}}catch(_0x13d23e){logger['error'](_0x8ea0('0x6b'),_0x13d23e);}}rp(_0x471d80)[_0x8ea0('0x13')](function(_0xce3e53){var _0x13376f={'statusCode':_0xce3e53[_0x8ea0('0x6c')]||0xc8,'statusMessage':_0xce3e53[_0x8ea0('0x6d')]||'OK','headers':_0xce3e53[_0x8ea0('0x65')]||{},'body':_0xce3e53[_0x8ea0('0x6a')]||{}};_0x2c4e03(null,_0x13376f);})[_0x8ea0('0x15')](function(_0x4b488b){var _0x552307={'statusCode':_0x4b488b[_0x8ea0('0x6c')]||0x1f4,'statusMessage':_0x4b488b[_0x8ea0('0x6e')]||_0x8ea0('0x6f'),'headers':_0x4b488b[_0x8ea0('0x70')][_0x8ea0('0x65')]||{},'body':_0x4b488b[_0x8ea0('0x70')][_0x8ea0('0x6a')]||{}};_0x2c4e03(null,_0x552307);});};AGIVertices[_0x8ea0('0x12')]['googleDialogflow']=function(_0x25889f,_0x14a273){scripts['googleDialogflow'](this[_0x8ea0('0xf')][_0x8ea0('0x36')],_0x25889f[_0x8ea0('0x71')],_0x25889f['text'],_0x25889f[_0x8ea0('0x72')]||'en')[_0x8ea0('0x13')](function(_0x4d361d){_0x14a273(null,_0x4d361d);})[_0x8ea0('0x15')](function(_0x33df80){_0x14a273(_0x33df80);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x5088c9,_0x14773e){scripts['googleDialogflowV2'](this[_0x8ea0('0xf')][_0x8ea0('0x36')],_0x5088c9['dialogflowV2_project_id'],_0x5088c9[_0x8ea0('0x73')],_0x5088c9[_0x8ea0('0x74')],_0x5088c9[_0x8ea0('0x55')],_0x5088c9[_0x8ea0('0x75')]||'en')['then'](function(_0x2e2f57){_0x14773e(null,_0x2e2f57);})[_0x8ea0('0x15')](function(_0x4071d6){_0x14773e(_0x4071d6);});};AGIVertices['prototype'][_0x8ea0('0x76')]=function(_0x1d90bd,_0x15b002){scripts['sestekNDA'](this[_0x8ea0('0xf')],_0x1d90bd)['then'](function(_0x5d6158){_0x15b002(null,_0x5d6158);})[_0x8ea0('0x15')](function(_0x42d5f6){_0x15b002(_0x42d5f6);});};AGIVertices[_0x8ea0('0x12')]['ispeechTTS']=function(_0x5adc50,_0x8d874b){scripts[_0x8ea0('0x77')](_0x5adc50[_0x8ea0('0x71')],_0x5adc50[_0x8ea0('0x55')],_0x5adc50[_0x8ea0('0x78')]||'en-US',_0x5adc50[_0x8ea0('0x79')])[_0x8ea0('0x13')](function(_0x153355){_0x8d874b(null,_0x153355);})[_0x8ea0('0x15')](function(_0x29e90a){_0x8d874b(_0x29e90a);});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x7a')]=function(_0x2f2124,_0x49ef4d,_0x3c1218){scripts[_0x8ea0('0x7a')](_0x49ef4d,_0x2f2124[_0x8ea0('0x71')],_0x2f2124[_0x8ea0('0x7b')]||'en-US',this[_0x8ea0('0x7c')](_0x2f2124[_0x8ea0('0x7d')])?_0x2f2124[_0x8ea0('0x7d')]:undefined)[_0x8ea0('0x13')](function(_0x2fb948){_0x3c1218(null,_0x2fb948);})[_0x8ea0('0x15')](function(_0x5e4b53){_0x3c1218(_0x5e4b53);});};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x7e')]=function(_0x58a95d,_0x5653ac){scripts[_0x8ea0('0x7e')](_0x58a95d[_0x8ea0('0x7f')],_0x58a95d[_0x8ea0('0x80')],_0x58a95d['aws_polly_region'],_0x58a95d['aws_polly_voice']||_0x8ea0('0x81'),_0x58a95d[_0x8ea0('0x55')],_0x58a95d['aws_text_type']||_0x8ea0('0x55'))[_0x8ea0('0x13')](function(_0x2c102a){_0x5653ac(null,_0x2c102a);})[_0x8ea0('0x15')](function(_0x5d24cf){_0x5653ac(_0x5d24cf);});};AGIVertices['prototype'][_0x8ea0('0x82')]=function(_0x451bd4,_0x5e18e4){scripts[_0x8ea0('0x82')](this[_0x8ea0('0xf')]['uniqueid'],_0x451bd4[_0x8ea0('0x7f')],_0x451bd4[_0x8ea0('0x80')],_0x451bd4[_0x8ea0('0x83')],_0x451bd4[_0x8ea0('0x55')],_0x451bd4[_0x8ea0('0x84')])[_0x8ea0('0x13')](function(_0x176f68){_0x5e18e4(null,_0x176f68);})[_0x8ea0('0x15')](function(_0xb66359){_0x5e18e4(_0xb66359);});};AGIVertices[_0x8ea0('0x12')]['googleASR']=function(_0x53d524,_0x5c1b3f,_0x2d45bc){scripts[_0x8ea0('0x85')](_0x5c1b3f,_0x53d524[_0x8ea0('0x71')],_0x53d524[_0x8ea0('0x86')]||_0x8ea0('0x57'))['then'](function(_0x3c959d){_0x2d45bc(null,_0x3c959d);})[_0x8ea0('0x15')](function(_0x50f27f){_0x2d45bc(_0x50f27f);});};AGIVertices['prototype'][_0x8ea0('0x87')]=function(_0x195823,_0x82b6da,_0x280487){scripts[_0x8ea0('0x87')](_0x82b6da,_0x195823[_0x8ea0('0x88')],_0x195823[_0x8ea0('0x89')],_0x195823[_0x8ea0('0x8a')])[_0x8ea0('0x13')](function(_0x44e668){_0x280487(null,_0x44e668);})[_0x8ea0('0x15')](function(_0x5706d6){_0x280487(_0x5706d6);});};AGIVertices['prototype'][_0x8ea0('0x8b')]=function(_0x3edb97){var _0x320963=_['includes'](verticesWithRetry,_0x3edb97[_0x8ea0('0x8c')])?_0x3edb97:_[_0x8ea0('0x8d')](_0x3edb97);for(var _0x41c9dc in _0x320963){if(_0x320963['hasOwnProperty'](_0x41c9dc)){if(_0x320963[_0x41c9dc]&&_[_0x8ea0('0x8e')](_0x320963[_0x41c9dc])){if(_['includes'](recursiveMapAttributes,_0x41c9dc)){_0x320963[_0x41c9dc]=this[_0x8ea0('0x8f')](_0x320963[_0x41c9dc]);}else{_0x320963[_0x41c9dc]=this[_0x8ea0('0x90')](_0x320963[_0x41c9dc]);}}}}return _0x320963;};AGIVertices['prototype'][_0x8ea0('0x91')]=function(_0x32e28d){for(var _0x295414 in _0x32e28d){if(_0x32e28d[_0x8ea0('0x92')](_0x295414)){if(_[_0x8ea0('0x93')](_0x32e28d[_0x295414])){this['recursiveNodeIndex'](_0x32e28d[_0x295414]);}else if(_[_0x8ea0('0x94')](_0x32e28d[_0x295414])){for(var _0x5879da=0x0;_0x5879da<_0x32e28d[_0x295414]['length'];_0x5879da++){this[_0x8ea0('0x91')](_0x32e28d[_0x295414][_0x5879da]);}}else if(_[_0x8ea0('0x8e')](_0x32e28d[_0x295414])){_0x32e28d[_0x295414]=this[_0x8ea0('0x90')](_0x32e28d[_0x295414]);}}}};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x95')]=function(_0x1a377b,_0x1f83c8){for(var _0x4e2e7f in _0x1a377b){if(_0x1a377b['hasOwnProperty'](_0x4e2e7f)){if(_['isPlainObject'](_0x1a377b[_0x4e2e7f])){if(!_[_0x8ea0('0x3f')](_0x1a377b[_0x4e2e7f])){this[_0x8ea0('0x95')](_0x1a377b[_0x4e2e7f],util['format'](_0x8ea0('0x96'),_0x1f83c8,_0x4e2e7f));}}else if(_['isArray'](_0x1a377b[_0x4e2e7f])){for(var _0x4a441f=0x0;_0x4a441f<_0x1a377b[_0x4e2e7f][_0x8ea0('0x97')];_0x4a441f++){this[_0x8ea0('0x95')](_0x1a377b[_0x4e2e7f][_0x4a441f],util['format'](_0x8ea0('0x96'),_0x1f83c8,_0x4e2e7f+'['+_0x4a441f+']'));}}else{if(!_[_0x8ea0('0x40')](_0x1a377b[_0x4e2e7f])){this[_0x8ea0('0xf')][_0x8ea0('0x98')](util[_0x8ea0('0x27')](_0x8ea0('0x96'),_0x1f83c8,_0x4e2e7f),_0x1a377b[_0x4e2e7f]);}}}}};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x8f')]=function(_0x5919e3){try{var _0x4d1671=JSON[_0x8ea0('0x66')](_0x5919e3);this[_0x8ea0('0x91')](_0x4d1671);return JSON[_0x8ea0('0x69')](_0x4d1671);}catch(_0x5da36c){return this[_0x8ea0('0x90')](_0x5919e3);}};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x90')]=function(_0x31f6e6){var _0x1b027e=_0x31f6e6[_0x8ea0('0x99')]('{');for(var _0x2d0917=0x1;_0x2d0917<_0x1b027e['length'];_0x2d0917+=0x1){var _0x2023c6=_0x1b027e[_0x2d0917][_0x8ea0('0x99')]('}');if(_0x2023c6[_0x8ea0('0x97')]>0x1){_0x31f6e6=_0x31f6e6[_0x8ea0('0x9a')]('{'+_0x2023c6[0x0]+'}',this[_0x8ea0('0xf')][_0x8ea0('0x9b')](_0x2023c6[0x0])[_0x8ea0('0x9c')]||_0x2023c6[0x0]);}}if(_0x1b027e[_0x8ea0('0x97')]===0x1){return _0x31f6e6[_0x8ea0('0x9d')]();}return this[_0x8ea0('0x90')](_0x31f6e6);};AGIVertices['prototype'][_0x8ea0('0x9e')]=function(_0x17639c,_0x43f0e3){var _0x26c4b7=this[_0x8ea0('0xf')][_0x8ea0('0x9b')](_0x17639c);if(_0x26c4b7[_0x8ea0('0x9f')]===-0x1){return _0x26c4b7;}logger[_0x8ea0('0x2d')](util['format'](_0x8ea0('0xa0'),_0x43f0e3,_0x26c4b7[_0x8ea0('0x9c')]));return this[_0x8ea0('0xf')][_0x8ea0('0x98')](_0x43f0e3,_0x26c4b7['extra']);};AGIVertices['prototype'][_0x8ea0('0x7c')]=function(_0x33e6e3){return _0x33e6e3&&_0x33e6e3!=='0'&&_0x33e6e3!=='-1'&&_0x33e6e3!=='';};AGIVertices[_0x8ea0('0x12')]['maxRetry']=function(_0x5c2808){this[_0x8ea0('0x35')][_0x8ea0('0xa1')](this,_0x5c2808,'-');_0x5c2808[_0x8ea0('0xa2')]=_0x5c2808[_0x8ea0('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0xa4')]=function(_0x41293e){logger['info'](util[_0x8ea0('0x27')](_0x8ea0('0xa5'),_0x41293e[_0x8ea0('0xa6')]));if(!this['isConfigured'](_0x41293e[_0x8ea0('0x55')])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')]('no\x20text\x20configured');}var _0x136b9e='\x22'+_0x41293e['text']+'\x22';if(this['isConfigured'](_0x41293e['options'])){_0x136b9e+=','+_0x41293e[_0x8ea0('0x70')];}var _0xe6d916=this[_0x8ea0('0xf')][_0x8ea0('0x50')](_0x8ea0('0xa8'),_0x136b9e);if(_0xe6d916[_0x8ea0('0x9f')]===-0x1){return _0xe6d916;}return this['channel'][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0xa9'),_0x136b9e));};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0xaa')]=function(_0x2050fd){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0xab'),_0x2050fd[_0x8ea0('0xa6')]));if(!this['isConfigured'](_0x2050fd['grammar'])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')]('no\x20grammar\x20configured');}var _0x5c511f=_0x2050fd[_0x8ea0('0xac')];if(this['isConfigured'](_0x2050fd['options'])){_0x5c511f+=','+_0x2050fd[_0x8ea0('0x70')];}var _0x4a9d8d=this[_0x8ea0('0xf')]['exec'](_0x8ea0('0xad'),_0x5c511f);if(_0x4a9d8d[_0x8ea0('0x9f')]===-0x1){return _0x4a9d8d;}var _0x3f9d9e=this[_0x8ea0('0x9e')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x3f9d9e['result']===-0x1){return _0x3f9d9e;}var _0x19b038=this[_0x8ea0('0x9e')](_0x8ea0('0xae'),_0x8ea0('0xaf'));if(_0x19b038[_0x8ea0('0x9f')]===-0x1){return _0x19b038;}var _0x5023e4=this[_0x8ea0('0x9e')](_0x8ea0('0xb0'),_0x8ea0('0xb1'));if(_0x5023e4['result']===-0x1){return _0x5023e4;}return this[_0x8ea0('0xf')]['noop'](util[_0x8ea0('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5c511f));};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x7')]=function(_0x1abf05){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x1abf05['label']));return this[_0x8ea0('0xf')][_0x8ea0('0x7')]([_0x1abf05[_0x8ea0('0xb2')],_0x1abf05[_0x8ea0('0xb3')]]);};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0xb4')]=function(_0x792607){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0xb5'),_0x792607[_0x8ea0('0xa6')]));if(this[_0x8ea0('0x7c')](_0x792607['timeout'])){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0xb6'),_0x792607['timeout']));var _0x339a51=this[_0x8ea0('0xf')][_0x8ea0('0xb7')](_0x792607[_0x8ea0('0x5d')]);if(_0x339a51[_0x8ea0('0x9f')]===-0x1){return _0x339a51;}}return this[_0x8ea0('0xf')][_0x8ea0('0xb4')]();};AGIVertices[_0x8ea0('0x12')]['callback']=function(_0x2d25bd){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0xb8'),_0x2d25bd[_0x8ea0('0xa6')]));if(!this[_0x8ea0('0x7c')](_0x2d25bd[_0x8ea0('0x44')])){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x2d25bd,'no\x20list\x20selected');}_0x2d25bd[_0x8ea0('0x45')]=moment();if(this['isConfigured'](_0x2d25bd[_0x8ea0('0xb9')])){_0x2d25bd[_0x8ea0('0x45')]=moment()[_0x8ea0('0xba')](_0x2d25bd[_0x8ea0('0xb9')],_0x8ea0('0xbb'));}if(!this['isConfigured'](_0x2d25bd[_0x8ea0('0xbc')])){_0x2d25bd['callback_priority']=0x2;}this[_0x8ea0('0x3e')][_0x8ea0('0xa1')](this,_0x2d25bd);return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0xbd'),_0x2d25bd[_0x8ea0('0x43')],_0x2d25bd[_0x8ea0('0x44')],_0x2d25bd[_0x8ea0('0x45')]));};AGIVertices[_0x8ea0('0x12')]['custom_app']=function(_0x55d5c3){logger[_0x8ea0('0x2d')](util['format'](_0x8ea0('0xbe'),_0x55d5c3['label']));var _0x3bd935=this['channel'][_0x8ea0('0x50')](_0x55d5c3[_0x8ea0('0xbf')],_0x55d5c3[_0x8ea0('0x70')]);if(_0x3bd935[_0x8ea0('0x9f')]===-0x1){return _0x3bd935;}return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')]('Executed\x20command\x20%s\x20%s',_0x55d5c3[_0x8ea0('0xbf')],_0x55d5c3[_0x8ea0('0x70')]));};AGIVertices[_0x8ea0('0x12')]['lumenvoxtts']=function(_0x42f3b2){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0xc0'),_0x42f3b2[_0x8ea0('0xa6')]));if(!this[_0x8ea0('0x7c')](_0x42f3b2[_0x8ea0('0x55')])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')]('no\x20text\x20configured');}var _0x4a9632='\x22'+_0x42f3b2[_0x8ea0('0x55')]+'\x22';if(this[_0x8ea0('0x7c')](_0x42f3b2['options'])){_0x4a9632+=','+_0x42f3b2[_0x8ea0('0x70')];}var _0x1a9b0b=this['channel'][_0x8ea0('0x50')](_0x8ea0('0xa8'),_0x4a9632);if(_0x1a9b0b[_0x8ea0('0x9f')]===-0x1){return _0x1a9b0b;}return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0xa9'),_0x4a9632));};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0xc1')]=function(_0x4291ea){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x4291ea['label']));if(!this[_0x8ea0('0x7c')](_0x4291ea[_0x8ea0('0x55')])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0xc2'));}var _0x518da3='\x22'+_0x4291ea[_0x8ea0('0x55')]+'\x22';if(this[_0x8ea0('0x7c')](_0x4291ea[_0x8ea0('0x70')])){_0x518da3+=','+_0x4291ea[_0x8ea0('0x70')];}var _0x7b7dd2=this[_0x8ea0('0xf')]['exec'](_0x8ea0('0xa8'),_0x518da3);if(_0x7b7dd2['result']===-0x1){return _0x7b7dd2;}return this[_0x8ea0('0xf')]['noop'](util['format'](_0x8ea0('0xa9'),_0x518da3));};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0xc3')]=function(_0x53a6e4){logger['info'](util['format'](_0x8ea0('0xc4'),_0x53a6e4['label']));if(!this['isConfigured'](_0x53a6e4[_0x8ea0('0xac')])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0xc5'));}var _0xa0499=_0x53a6e4['grammar'];if(this[_0x8ea0('0x7c')](_0x53a6e4[_0x8ea0('0x70')])){_0xa0499+=','+_0x53a6e4[_0x8ea0('0x70')];}var _0x266708=this[_0x8ea0('0xf')]['exec'](_0x8ea0('0xad'),_0xa0499);if(_0x266708['result']===-0x1){return _0x266708;}var _0x5c7190=this[_0x8ea0('0x9e')](_0x8ea0('0xc6'),_0x8ea0('0xc7'));if(_0x5c7190['result']===-0x1){return _0x5c7190;}var _0x2726af=this[_0x8ea0('0x9e')]('RECOG_INPUT()',_0x8ea0('0xc8'));if(_0x2726af['result']===-0x1){return _0x2726af;}var _0x27e297=this[_0x8ea0('0x9e')]('RECOG_INSTANCE()',_0x8ea0('0xc9'));if(_0x27e297['result']===-0x1){return _0x27e297;}return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0xca'),_0xa0499));};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0xcb')]=function(_0x2b5238){logger[_0x8ea0('0x2d')](util['format'](_0x8ea0('0xcc'),_0x2b5238[_0x8ea0('0xa6')]));if(!this['isConfigured'](_0x2b5238[_0x8ea0('0xac')])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0xc5'));}var _0x5ac803=_0x2b5238['grammar'];if(this['isConfigured'](_0x2b5238['options'])){_0x5ac803+=','+_0x2b5238[_0x8ea0('0x70')];}var _0x4b3567=this[_0x8ea0('0xf')][_0x8ea0('0x50')](_0x8ea0('0xad'),_0x5ac803);if(_0x4b3567[_0x8ea0('0x9f')]===-0x1){return _0x4b3567;}var _0x352943=this[_0x8ea0('0x9e')]('RECOG_CONFIDENCE()',_0x8ea0('0xcd'));if(_0x352943[_0x8ea0('0x9f')]===-0x1){return _0x352943;}var _0xfadf73=this[_0x8ea0('0x9e')]('RECOG_INPUT()',_0x8ea0('0xce'));if(_0xfadf73['result']===-0x1){return _0xfadf73;}var _0x35b23b=this[_0x8ea0('0x9e')]('RECOG_INSTANCE()',_0x8ea0('0xcf'));if(_0x35b23b[_0x8ea0('0x9f')]===-0x1){return _0x35b23b;}return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5ac803));};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0xd0')]=function(_0x36cd8d){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x36cd8d['label']));if(!this[_0x8ea0('0x7c')](_0x36cd8d[_0x8ea0('0xd1')])){return this['channel'][_0x8ea0('0x2a')](_0x36cd8d,_0x8ea0('0xd2'));}var _0x5d685e=this[_0x8ea0('0x18')]['sync'](this,_0x36cd8d[_0x8ea0('0xd1')]);if(!_0x5d685e){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x36cd8d,_0x8ea0('0xd3'));}if(!this[_0x8ea0('0x7c')](_0x36cd8d['query'])){return this['channel']['error'](_0x36cd8d,'no\x20query\x20configured');}var _0x33a01b=_0x36cd8d[_0x8ea0('0xd4')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x8ea0('0xf')]['noop'](util[_0x8ea0('0x27')](_0x8ea0('0xd5'),_0x33a01b));var _0x42e713=this['getQueryOdbc'][_0x8ea0('0xa1')](this,_0x5d685e,_0x33a01b);this['createSquareDetailsReport'][_0x8ea0('0xa1')](this,_0x36cd8d,_0x33a01b);if(!this[_0x8ea0('0x7c')](_0x36cd8d[_0x8ea0('0xd6')])){return this[_0x8ea0('0xf')]['noop'](_0x8ea0('0xd7'));}var _0x50f8e2=this[_0x8ea0('0x9b')][_0x8ea0('0xa1')](this,_0x36cd8d[_0x8ea0('0xd6')]);if(!_0x50f8e2){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x36cd8d,_0x8ea0('0xd8'));}var _0x22152d=this;_0x42e713[_0x8ea0('0xd9')](function(_0x590192,_0x2ec96f){Object[_0x8ea0('0xda')](_0x590192)['forEach'](function(_0x5a1907){_0x22152d['channel'][_0x8ea0('0x98')](util[_0x8ea0('0x27')]('%s[%s][%s]',_0x50f8e2,_0x2ec96f,_0x5a1907),_0x590192[_0x5a1907]);});});this[_0x8ea0('0xf')][_0x8ea0('0x98')](util['format'](_0x8ea0('0xdb'),_0x50f8e2),_0x42e713[_0x8ea0('0x97')]);return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util['format'](_0x8ea0('0xdc'),_0x50f8e2));};AGIVertices[_0x8ea0('0x12')]['dial']=function(_0x49031d){logger[_0x8ea0('0xdd')](util[_0x8ea0('0x27')](_0x8ea0('0xde'),_0x49031d[_0x8ea0('0xa6')]));if(!this[_0x8ea0('0x7c')](_0x49031d[_0x8ea0('0xdf')])){return this['channel']['error'](_0x49031d,_0x8ea0('0xe0'));}var _0x31b0cf=this[_0x8ea0('0xe1')]['sync'](this,_0x49031d[_0x8ea0('0xdf')]);if(!_0x31b0cf){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x49031d,'no\x20user\x20found');}var _0xb1fa00=this['channel'][_0x8ea0('0x50')](_0x8ea0('0xe2'),[util[_0x8ea0('0x27')]('SIP/%s',_0x31b0cf),_0x49031d[_0x8ea0('0x5d')],_0x49031d[_0x8ea0('0xe3')],_0x49031d[_0x8ea0('0x68')]]);if(_0xb1fa00['result']===-0x1){return _0xb1fa00;}return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0xe4'),_0x8ea0('0xe2')));};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0xe5')]=function(_0x2b516f){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x2b516f[_0x8ea0('0xa6')]));if(!this['isConfigured'](_0x2b516f['key'])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0xe6'));}if(!this[_0x8ea0('0x7c')](_0x2b516f[_0x8ea0('0x55')])){return this['channel'][_0x8ea0('0xa7')](_0x8ea0('0xc2'));}this[_0x8ea0('0xf')][_0x8ea0('0xe7')]=!![];this[_0x8ea0('0x35')](_0x2b516f);this[_0x8ea0('0x3d')](_0x2b516f[_0x8ea0('0x55')],'in','','');this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util['format']('Trying\x20Dialogflow:\x20%s',_0x2b516f['text']));var _0x540845=this[_0x8ea0('0xe8')][_0x8ea0('0xa1')](this,_0x2b516f);if(_0x540845){for(var _0x1f4d27 in _0x540845){if(_0x540845[_0x8ea0('0x92')](_0x1f4d27)){this['channel'][_0x8ea0('0x98')](util['format']('DIALOGFLOW_%s',_0x1f4d27[_0x8ea0('0x63')]()),_0x540845[_0x1f4d27]);}}this[_0x8ea0('0x3d')](_0x540845[_0x8ea0('0xe9')],'out',_0x8ea0('0xe5'),'');return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0xea'),_0x540845['speech']));}return this[_0x8ea0('0xf')]['error'](_0x2b516f,_0x8ea0('0xeb'));};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0xec')]=function(_0x9d0118){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0xed'),_0x9d0118[_0x8ea0('0xa6')]));if(!this['isConfigured'](_0x9d0118['dialogflowV2_project_id'])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0xee'));}if(!this[_0x8ea0('0x7c')](_0x9d0118[_0x8ea0('0x73')])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0xef'));}if(!this[_0x8ea0('0x7c')](_0x9d0118['private_key'])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0xf0'));}if(!this['isConfigured'](_0x9d0118['dialogflowV2_language'])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0xf1'));}if(!this[_0x8ea0('0x7c')](_0x9d0118['text'])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0xc2'));}this[_0x8ea0('0xf')][_0x8ea0('0xe7')]=!![];this['createSquareDetailsReport'](_0x9d0118);this[_0x8ea0('0x3d')](_0x9d0118[_0x8ea0('0x55')],'in','','');this[_0x8ea0('0xf')]['noop'](util['format']('Trying\x20DialogflowV2:\x20%s',_0x9d0118[_0x8ea0('0x55')]));var _0x36a0e0=this['googleDialogflowV2'][_0x8ea0('0xa1')](this,_0x9d0118);if(_0x36a0e0){for(var _0x1cae4c in _0x36a0e0){if(_0x36a0e0[_0x8ea0('0x92')](_0x1cae4c)){if(_0x1cae4c!==_0x8ea0('0xf2')){this[_0x8ea0('0xf')][_0x8ea0('0x98')](util['format'](_0x8ea0('0xf3'),_0x1cae4c[_0x8ea0('0x63')]()),_0x36a0e0[_0x1cae4c]);}}}this[_0x8ea0('0x3d')](_0x36a0e0['speech'],_0x8ea0('0xf4'),_0x8ea0('0xec'),_0x36a0e0[_0x8ea0('0xf2')]);return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util['format'](_0x8ea0('0xf5'),_0x36a0e0['speech']));}return this[_0x8ea0('0xf')]['error'](_0x9d0118,_0x8ea0('0xf6'));};AGIVertices[_0x8ea0('0x12')]['sesteknda']=function(_0xe2863c){logger['info'](util['format'](_0x8ea0('0xf7'),_0xe2863c[_0x8ea0('0xa6')]));if(!this[_0x8ea0('0x7c')](_0xe2863c['ndauth_url'])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x8ea0('0x7c')](_0xe2863c[_0x8ea0('0xf8')])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0xf9'));}if(!this['isConfigured'](_0xe2863c[_0x8ea0('0xfa')])){return this['channel']['noop'](_0x8ea0('0xfb'));}if(!this['isConfigured'](_0xe2863c[_0x8ea0('0xfc')])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0xc2'));}this['channel']['bot']=!![];this[_0x8ea0('0x35')](_0xe2863c);this[_0x8ea0('0x3d')](_0xe2863c['text'],'in','','');this['channel']['noop'](util[_0x8ea0('0x27')](_0x8ea0('0xfd'),_0xe2863c[_0x8ea0('0x55')]));var _0x2f9393=this['sestekNDA'][_0x8ea0('0xa1')](this,_0xe2863c);if(_0x2f9393){for(var _0x4a1737 in _0x2f9393){if(_0x2f9393[_0x8ea0('0x92')](_0x4a1737)){this[_0x8ea0('0xf')][_0x8ea0('0x98')](util[_0x8ea0('0x27')]('SESTEK_NDA_%s',_0x4a1737[_0x8ea0('0x63')]()),_0x2f9393[_0x4a1737]);}}this[_0x8ea0('0x3d')](_0x2f9393[_0x8ea0('0xe9')],'out',_0x8ea0('0xfe'),'');if(_0x2f9393[_0x8ea0('0xff')]){this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x100'),_0x2f9393[_0x8ea0('0xff')]));var _0x67e52c=this['channel'][_0x8ea0('0x101')](_0x2f9393[_0x8ea0('0xff')]);try{fs['unlink'](_0x2f9393[_0x8ea0('0xff')]+_0x8ea0('0x102'));}catch(_0x60d7b9){logger[_0x8ea0('0x2a')](_0x60d7b9);}return _0x67e52c;}else{return this['channel'][_0x8ea0('0xa7')](util[_0x8ea0('0x27')]('SestekNDA\x20Result\x20%s',_0x2f9393[_0x8ea0('0xe9')]));}}return this[_0x8ea0('0xf')]['error'](_0xe2863c,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x103')]=function(_0x572a5d){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')]('Enter\x20in\x20END\x20(%s)\x20block',_0x572a5d['label']));return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0x103'));};AGIVertices['prototype'][_0x8ea0('0x104')]=function(_0x357fd3){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x105'),_0x357fd3[_0x8ea0('0xa6')]));var _0x9d30ff='';if(_0x357fd3[_0x8ea0('0x106')]){if(!this[_0x8ea0('0x7c')](_0x357fd3[_0x8ea0('0x106')])){return this[_0x8ea0('0xf')]['error'](_0x357fd3,'no\x20trunk\x20selected');}else{var _0x3bf8ec=parseInt(_0x357fd3[_0x8ea0('0x106')],0xa);if(isNaN(_0x3bf8ec)){_0x9d30ff=_0x357fd3[_0x8ea0('0x106')];}else{_0x9d30ff=this[_0x8ea0('0x1a')][_0x8ea0('0xa1')](this,_0x357fd3[_0x8ea0('0x106')]);if(!_0x9d30ff){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x357fd3,_0x8ea0('0x107'));}}}}else if(_0x357fd3[_0x8ea0('0x108')]){_0x9d30ff=_0x357fd3[_0x8ea0('0x108')];}else{return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x357fd3,_0x8ea0('0x109'));}var _0x49c6a4=this[_0x8ea0('0xf')][_0x8ea0('0x50')]('DIAL',[util[_0x8ea0('0x27')](_0x8ea0('0x10a'),_0x9d30ff,_0x357fd3[_0x8ea0('0x43')]),_0x357fd3[_0x8ea0('0x5d')],_0x357fd3[_0x8ea0('0xe3')],_0x357fd3[_0x8ea0('0x68')]]);if(_0x49c6a4[_0x8ea0('0x9f')]===-0x1){return _0x49c6a4;}return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0xe4'),_0x8ea0('0xe2')));};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x10b')]=function(_0x5d7026){logger['info'](util[_0x8ea0('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x5d7026['label']));return this[_0x8ea0('0xf')]['noop'](_0x8ea0('0x10b'));};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0xe')]=function(_0x407441){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x407441[_0x8ea0('0xa6')]));if(_0x407441[_0x8ea0('0xa2')]===0x0){return this[_0x8ea0('0xa3')](_0x407441);}_0x407441[_0x8ea0('0xa2')]-=0x1;if(!this[_0x8ea0('0x7c')](_0x407441[_0x8ea0('0x10c')])){return this[_0x8ea0('0xf')]['error'](_0x407441,_0x8ea0('0x10d'));}var _0x549a02=this['getSound'][_0x8ea0('0xa1')](this,_0x407441[_0x8ea0('0x10c')]);if(!_0x549a02){return this['channel'][_0x8ea0('0x2a')](_0x407441,_0x8ea0('0x10e'));}if(!this['isConfigured'](_0x407441['variable_id'])){return this[_0x8ea0('0xf')]['error'](_0x8ea0('0xd7'));}var _0x5dc025=this['channel'][_0x8ea0('0x10f')](_0x549a02,_0x407441[_0x8ea0('0x110')],_0x407441[_0x8ea0('0x111')]);var _0xcccf37=_0x5dc025[_0x8ea0('0x9f')]?_0x5dc025[_0x8ea0('0x9f')][_0x8ea0('0x9d')]():'';logger[_0x8ea0('0x2d')](_0x8ea0('0x112'),JSON[_0x8ea0('0x69')](_0x5dc025));if(_0x5dc025['result']===-0x1){this['createSquareDetailsReport'][_0x8ea0('0xa1')](this,_0x407441,_0xcccf37);return _0x5dc025;}else if(_0x5dc025['extra']===_0x8ea0('0x5d')){_0x5dc025[_0x8ea0('0x9f')]=_0xcccf37[_0x8ea0('0x97')]>=parseInt(_0x407441[_0x8ea0('0x113')])?'x':'i';}else{_0x5dc025[_0x8ea0('0x9f')]=_0xcccf37[_0x8ea0('0x97')]>=parseInt(_0x407441[_0x8ea0('0x113')])&&_0xcccf37[_0x8ea0('0x97')]<=parseInt(_0x407441['maxdigit'])?'x':'i';}var _0x315ce8=this[_0x8ea0('0x9b')][_0x8ea0('0xa1')](this,_0x407441[_0x8ea0('0xd6')]);if(!_0x315ce8){return this['channel']['error'](_0x407441,_0x8ea0('0xd8'));}this[_0x8ea0('0xf')][_0x8ea0('0x98')](_0x315ce8,_0xcccf37);if(this['isConfigured'](_0x407441[_0x8ea0('0x114')])){var _0x5846fa=parseInt(_0x407441[_0x8ea0('0x114')],0xa);var _0x148fa1=rs[_0x8ea0('0x115')]({'charset':'*','length':_0x5846fa});var _0x35c38d=_0xcccf37['length'];if(_0x35c38d>0x0){if(_0x35c38d>_0x5846fa){this[_0x8ea0('0x35')][_0x8ea0('0xa1')](this,_0x407441,_0x407441[_0x8ea0('0x116')]==='first'?_0x148fa1+_0xcccf37[_0x8ea0('0x117')](_0x5846fa):_0xcccf37['substr'](0x0,_0x35c38d-_0x5846fa)+_0x148fa1);}else{this['createSquareDetailsReport'][_0x8ea0('0xa1')](this,_0x407441,rs[_0x8ea0('0x115')]({'charset':'*','length':_0x35c38d}));}}else{this[_0x8ea0('0x35')][_0x8ea0('0xa1')](this,_0x407441,'');}}else{this[_0x8ea0('0x35')][_0x8ea0('0xa1')](this,_0x407441,_0xcccf37);}return _0x5dc025;};AGIVertices['prototype'][_0x8ea0('0x118')]=function(_0x1c0f25){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x119'),_0x1c0f25['label']));return this[_0x8ea0('0xe')](_0x1c0f25);};AGIVertices['prototype'][_0x8ea0('0x11a')]=function(_0x1be62c){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x11b'),_0x1be62c[_0x8ea0('0xa6')]));this[_0x8ea0('0x35')][_0x8ea0('0xa1')](this,_0x1be62c,_0x1be62c[_0x8ea0('0x11c')]);return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x11d'),_0x1be62c[_0x8ea0('0x11c')]));};AGIVertices['prototype'][_0x8ea0('0x11e')]=function(_0x49cb6a){logger['info'](util['format'](_0x8ea0('0x11f'),_0x49cb6a[_0x8ea0('0xa6')]));if(!this[_0x8ea0('0x7c')](_0x49cb6a[_0x8ea0('0x7f')])||!this['isConfigured'](_0x49cb6a[_0x8ea0('0x80')])){return this['channel']['noop'](_0x8ea0('0x120'));}if(!this[_0x8ea0('0x7c')](_0x49cb6a[_0x8ea0('0x55')])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')]('no\x20text\x20configured');}this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util['format'](_0x8ea0('0x121'),_0x49cb6a[_0x8ea0('0x55')]));var _0x4a5435=this[_0x8ea0('0x7e')][_0x8ea0('0xa1')](this,_0x49cb6a);if(_0x4a5435){this['channel']['noop'](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x4a5435));var _0x1a47b2=this[_0x8ea0('0xf')][_0x8ea0('0x101')](_0x4a5435);try{fs[_0x8ea0('0x122')](_0x4a5435+_0x8ea0('0x102'));}catch(_0x1522f8){logger[_0x8ea0('0x2a')](_0x1522f8);}return _0x1a47b2;}return this['channel'][_0x8ea0('0x2a')](_0x49cb6a,_0x8ea0('0x123'));};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x124')]=function(_0x44d5cf){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x125'),_0x44d5cf[_0x8ea0('0xa6')]));if(!this[_0x8ea0('0x7c')](_0x44d5cf[_0x8ea0('0x7f')])||!this[_0x8ea0('0x7c')](_0x44d5cf[_0x8ea0('0x80')])){return this['channel'][_0x8ea0('0xa7')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x8ea0('0x7c')](_0x44d5cf[_0x8ea0('0x84')])){return this[_0x8ea0('0xf')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x8ea0('0x7c')](_0x44d5cf[_0x8ea0('0x55')])){return this['channel'][_0x8ea0('0xa7')](_0x8ea0('0xc2'));}this[_0x8ea0('0xf')][_0x8ea0('0xe7')]=!![];this['createSquareDetailsReport'](_0x44d5cf);this['createSquareMessage'](_0x44d5cf[_0x8ea0('0x55')],'in','','');this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x126'),_0x44d5cf[_0x8ea0('0x55')]));var _0x1d95b9=this[_0x8ea0('0x82')][_0x8ea0('0xa1')](this,_0x44d5cf);if(_0x1d95b9){for(var _0x2d0976 in _0x1d95b9){if(_0x1d95b9['hasOwnProperty'](_0x2d0976)&&_['isString'](_0x1d95b9[_0x2d0976])){this[_0x8ea0('0xf')][_0x8ea0('0x98')](util[_0x8ea0('0x27')](_0x8ea0('0x127'),_0x2d0976[_0x8ea0('0x63')]()),_0x1d95b9[_0x2d0976]);}}if(_[_0x8ea0('0x40')](_0x1d95b9[_0x8ea0('0x6e')])){return this['channel']['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x8ea0('0x3d')](_0x1d95b9[_0x8ea0('0x6e')],_0x8ea0('0xf4'),'amazonlex','');return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x128'),_0x1d95b9[_0x8ea0('0x6e')]));}}return this[_0x8ea0('0xf')]['error'](_0x44d5cf,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x129')]=function(_0x409e20){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x12a'),_0x409e20[_0x8ea0('0xa6')],_0x409e20[_0x8ea0('0x5d')]));if(!this['isConfigured'](_0x409e20[_0x8ea0('0x71')])){return this['channel'][_0x8ea0('0xa7')]('no\x20key\x20configured');}var _0x1fee26='wav';var _0x5f09a7=util['format'](_0x8ea0('0x12b'),FILES_PATH,rs[_0x8ea0('0x115')](0x4));var _0x8ec1a=util[_0x8ea0('0x27')](_0x8ea0('0x96'),_0x5f09a7,_0x1fee26);var _0x473ca3=!![];if(_0x409e20['beep']==='NOBEEP'){_0x473ca3=![];}var _0x1e3c8b=this[_0x8ea0('0xf')][_0x8ea0('0x12c')](_0x5f09a7,_0x1fee26,_0x409e20[_0x8ea0('0x12d')],_0x409e20[_0x8ea0('0x5d')],undefined,_0x473ca3);if(_0x1e3c8b[_0x8ea0('0x9f')]!==-0x1){this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util['format'](_0x8ea0('0x12e'),_0x8ec1a));var _0x19ee88=this[_0x8ea0('0x85')]['sync'](this,_0x409e20,_0x8ec1a);if(_0x19ee88){for(var _0x460fa4 in _0x19ee88){if(_0x19ee88[_0x8ea0('0x92')](_0x460fa4)){this[_0x8ea0('0xf')][_0x8ea0('0x98')](util['format'](_0x8ea0('0x12f'),_0x460fa4[_0x8ea0('0x63')]()),_0x19ee88[_0x460fa4]);}}return this['channel']['noop'](util[_0x8ea0('0x27')](_0x8ea0('0x130'),JSON['stringify'](_0x19ee88)));}}return _0x1e3c8b;};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x131')]=function(_0x3382f7){logger[_0x8ea0('0x2d')](util['format'](_0x8ea0('0x132'),_0x3382f7[_0x8ea0('0xa6')]));if(!this['isConfigured'](_0x3382f7['appid'])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0x133'));}if(!this[_0x8ea0('0x7c')](_0x3382f7[_0x8ea0('0x89')])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0x134'));}var _0x16eb7d=_0x8ea0('0x135');var _0x28927f=util[_0x8ea0('0x27')](_0x8ea0('0x12b'),FILES_PATH,rs[_0x8ea0('0x115')](0x4));var _0x461b17=util['format'](_0x8ea0('0x96'),_0x28927f,_0x16eb7d);var _0x20a27f=!![];if(_0x3382f7['beep']===_0x8ea0('0x136')){_0x20a27f=![];}var _0x85e24b=this['channel'][_0x8ea0('0x12c')](_0x28927f,_0x16eb7d,_0x3382f7[_0x8ea0('0x12d')],_0x3382f7['timeout'],undefined,_0x20a27f);if(_0x85e24b['result']!==-0x1){this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x137'),_0x461b17));var _0x1d3e05=this[_0x8ea0('0x87')][_0x8ea0('0xa1')](this,_0x3382f7,_0x461b17);if(_0x1d3e05){for(var _0x1844d6 in _0x1d3e05){if(_0x1d3e05[_0x8ea0('0x92')](_0x1844d6)){this[_0x8ea0('0xf')]['setVariable'](util['format'](_0x8ea0('0x138'),_0x1844d6[_0x8ea0('0x63')]()),_0x1d3e05[_0x1844d6]);}}return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util['format'](_0x8ea0('0x139'),JSON[_0x8ea0('0x69')](_0x1d3e05)));}}return _0x85e24b;};AGIVertices[_0x8ea0('0x12')]['gotoc']=function(_0xdeb4ff){logger['info'](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0xdeb4ff[_0x8ea0('0xa6')]));return this[_0x8ea0('0xf')]['continueAt'](_0xdeb4ff['context'],_0xdeb4ff['extension'],_0xdeb4ff['priority']);};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x13a')]=function(_0x255f28){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x13b'),_0x255f28[_0x8ea0('0xa6')]));if(!this[_0x8ea0('0x7c')](_0x255f28[_0x8ea0('0x13c')])){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x255f28,_0x8ea0('0x13d'));}try{var _0x1c052e=eval(_0x255f28[_0x8ea0('0x13c')])?_0x8ea0('0x13e'):'false';this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')]('EVAL\x20CONDITION\x20%s\x20%s',_0x255f28['condition'],_0x1c052e));return{'code':0xc8,'result':_0x1c052e};}catch(_0x5b144a){return{'code':0xc8,'result':_0x8ea0('0x13f')};}};AGIVertices['prototype'][_0x8ea0('0x140')]=function(_0x4ebda1){logger[_0x8ea0('0x2d')](util['format'](_0x8ea0('0x141'),_0x4ebda1[_0x8ea0('0xa6')]));if(!this['isConfigured'](_0x4ebda1['interval_id'])){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x4ebda1,'no\x20interval\x20configured');}var _0x4d53bc=this['getIntervals'][_0x8ea0('0xa1')](this,_0x4ebda1[_0x8ea0('0x142')]);if(!_0x4d53bc){return this['channel'][_0x8ea0('0x2a')](_0x4ebda1,'no\x20intervals\x20found');}for(var _0x5990c7=0x0;_0x5990c7<_0x4d53bc[_0x8ea0('0x97')];_0x5990c7+=0x1){var _0x21f8a2=this[_0x8ea0('0xf')]['getVariable'](util[_0x8ea0('0x27')](_0x8ea0('0x143'),_0x4d53bc[_0x5990c7]));if(_0x21f8a2['result']===-0x1){return _0x21f8a2;}logger['info'](util[_0x8ea0('0x27')](_0x8ea0('0x144'),_0x4d53bc[_0x5990c7],_0x21f8a2[_0x8ea0('0x9c')]));if(_0x21f8a2[_0x8ea0('0x9c')]===_0x8ea0('0x13e')){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x144'),_0x4d53bc[_0x5990c7],'true'));this['channel'][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x144'),_0x4d53bc[_0x5990c7],_0x8ea0('0x13e')));return{'code':0xc8,'result':_0x8ea0('0x13e')};}else{logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x144'),_0x4d53bc[_0x5990c7],'false'));this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x144'),_0x4d53bc[_0x5990c7],'false'));}}return{'code':0xc8,'result':_0x8ea0('0x13f')};};AGIVertices[_0x8ea0('0x12')]['hangup']=function(_0x3b0ab4){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x3b0ab4[_0x8ea0('0xa6')]));return this[_0x8ea0('0xf')][_0x8ea0('0x145')]();};AGIVertices['prototype'][_0x8ea0('0x146')]=function(_0x1034fd){logger['info'](util['format'](_0x8ea0('0x147'),_0x1034fd['label']));if(!this[_0x8ea0('0x7c')](_0x1034fd[_0x8ea0('0x71')])){return this[_0x8ea0('0xf')]['noop'](_0x8ea0('0xe6'));}var _0x42d09b=_0x8ea0('0x135');var _0x11628a=util['format'](_0x8ea0('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x17e90d=util['format'](_0x8ea0('0x96'),_0x11628a,_0x42d09b);var _0x133dd2=!![];if(_0x1034fd[_0x8ea0('0x148')]==='NOBEEP'){_0x133dd2=![];}var _0x433658=this['channel']['recordFile'](_0x11628a,_0x42d09b,_0x1034fd['intKey'],_0x1034fd[_0x8ea0('0x5d')],undefined,_0x133dd2);if(_0x433658['result']!==-0x1){this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x149'),_0x17e90d));var _0xb05136=this['ispeechASR'][_0x8ea0('0xa1')](this,_0x1034fd,_0x17e90d);if(_0xb05136){for(var _0x1e516c in _0xb05136){if(_0xb05136['hasOwnProperty'](_0x1e516c)){this[_0x8ea0('0xf')][_0x8ea0('0x98')](util['format'](_0x8ea0('0x14a'),_0x1e516c[_0x8ea0('0x63')]()),_0xb05136[_0x1e516c]);}}return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x14b'),JSON['stringify'](_0xb05136)));}}return _0x433658;};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x14c')]=function(_0xe26344){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0xe26344[_0x8ea0('0xa6')]));if(!this[_0x8ea0('0x7c')](_0xe26344[_0x8ea0('0x71')])){return this['channel'][_0x8ea0('0xa7')]('no\x20key\x20configured');}if(!this[_0x8ea0('0x7c')](_0xe26344[_0x8ea0('0x55')])){return this[_0x8ea0('0xf')]['noop'](_0x8ea0('0xc2'));}this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x14d'),_0xe26344[_0x8ea0('0x55')]));var _0xe64003=this[_0x8ea0('0x77')][_0x8ea0('0xa1')](this,_0xe26344);if(_0xe64003){this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x149'),_0xe64003));var _0x300c43=this['channel'][_0x8ea0('0x101')](_0xe64003,_0xe26344[_0x8ea0('0x12d')]);try{fs[_0x8ea0('0x122')](_0xe64003+'.wav');}catch(_0x14ba4d){logger['error'](_0x14ba4d);}return _0x300c43;}return this['channel'][_0x8ea0('0x2a')](_0xe26344,_0x8ea0('0x14e'));};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x14f')]=function(_0x3771c5){logger[_0x8ea0('0x2d')](util['format'](_0x8ea0('0x150'),_0x3771c5[_0x8ea0('0xa6')]));if(!this['isConfigured'](_0x3771c5['findBy'])){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x3771c5,_0x8ea0('0x151'));}logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x152'),this[_0x8ea0('0xf')][_0x8ea0('0x38')],_0x3771c5[_0x8ea0('0x153')]));var _0x3df8b8=this[_0x8ea0('0x4d')][_0x8ea0('0xa1')](this,_0x3771c5[_0x8ea0('0x153')]);if(_0x3df8b8){logger['info'](util[_0x8ea0('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8ea0('0xf')]['callerid'],_0x3771c5[_0x8ea0('0x153')]));this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x154'),this['channel']['callerid'],_0x3771c5[_0x8ea0('0x153')]));return{'code':0xc8,'result':_0x8ea0('0x155')};}else{logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8ea0('0xf')][_0x8ea0('0x38')],_0x3771c5[_0x8ea0('0x153')]));this['channel'][_0x8ea0('0xa7')](util[_0x8ea0('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8ea0('0xf')][_0x8ea0('0x38')],_0x3771c5[_0x8ea0('0x153')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8ea0('0x12')]['logout']=function(_0x29654f){logger['info'](util[_0x8ea0('0x27')](_0x8ea0('0x156'),_0x29654f[_0x8ea0('0xa6')]));if(!this[_0x8ea0('0x7c')](_0x29654f[_0x8ea0('0x153')])){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x29654f,'no\x20find\x20by\x20configured');}logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x152'),this[_0x8ea0('0xf')][_0x8ea0('0x38')],_0x29654f[_0x8ea0('0x153')]));var _0x2f12a6=this['agentLogout'][_0x8ea0('0xa1')](this,_0x29654f['findBy']);if(_0x2f12a6){logger[_0x8ea0('0x2d')](util['format'](_0x8ea0('0x154'),this[_0x8ea0('0xf')][_0x8ea0('0x38')],_0x29654f[_0x8ea0('0x153')]));this['channel'][_0x8ea0('0xa7')](util['format'](_0x8ea0('0x154'),this[_0x8ea0('0xf')][_0x8ea0('0x38')],_0x29654f[_0x8ea0('0x153')]));return{'code':0xc8,'result':_0x8ea0('0x155')};}else{logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x157'),this[_0x8ea0('0xf')][_0x8ea0('0x38')],_0x29654f[_0x8ea0('0x153')]));this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x157'),this['channel'][_0x8ea0('0x38')],_0x29654f[_0x8ea0('0x153')]));return{'code':0xc8,'result':_0x8ea0('0x158')};}};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x159')]=function(_0x566ce6){logger[_0x8ea0('0x2d')](util['format'](_0x8ea0('0x15a'),_0x566ce6[_0x8ea0('0xa6')]));if(!this['isConfigured'](_0x566ce6[_0x8ea0('0x15b')])){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x566ce6,'no\x20operation\x20configured');}this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x15c'),_0x566ce6['operation']));var _0x46264e=eval(_0x566ce6[_0x8ea0('0x15b')]);if(!this['isConfigured'](_0x566ce6['variable_id'])){return this[_0x8ea0('0xf')]['noop'](_0x8ea0('0xd7'));}var _0x5f51c9=this[_0x8ea0('0x9b')][_0x8ea0('0xa1')](this,_0x566ce6[_0x8ea0('0xd6')]);if(!_0x5f51c9){return this[_0x8ea0('0xf')]['error'](_0x566ce6,_0x8ea0('0xd8'));}if(_[_0x8ea0('0x94')](_0x46264e)){var _0x68eef6=this;_0x46264e[_0x8ea0('0xd9')](function(_0x281d28,_0x5cf399){_0x68eef6[_0x8ea0('0xf')][_0x8ea0('0x98')](util[_0x8ea0('0x27')](_0x8ea0('0x15d'),_0x5f51c9,_0x5cf399),_0x281d28);});return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')]('variable\x20%s[key]\x20set',_0x5f51c9));}else{return this['channel']['setVariable'](_0x5f51c9,_0x46264e);}};AGIVertices[_0x8ea0('0x12')]['menu']=function(_0x421eb8){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x421eb8['label']));if(_0x421eb8[_0x8ea0('0xa2')]===0x0){return this[_0x8ea0('0xa3')](_0x421eb8);}_0x421eb8[_0x8ea0('0xa2')]-=0x1;if(!this[_0x8ea0('0x7c')](_0x421eb8['file_id'])){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x421eb8,_0x8ea0('0x10d'));}var _0x3fab02=this['getSound'][_0x8ea0('0xa1')](this,_0x421eb8[_0x8ea0('0x10c')]);if(!_0x3fab02){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x421eb8,'no\x20file\x20audio\x20found');}var _0xcb7a92=this['channel'][_0x8ea0('0x10f')](_0x3fab02,_0x421eb8[_0x8ea0('0x110')],_0x421eb8[_0x8ea0('0x15e')]);var _0x54d12f=_0xcb7a92[_0x8ea0('0x9f')];if(_0xcb7a92['result']===-0x1){this[_0x8ea0('0x35')][_0x8ea0('0xa1')](this,_0x421eb8,'-1');return _0xcb7a92;}else if(_0xcb7a92[_0x8ea0('0x9c')]==='timeout'){_0xcb7a92[_0x8ea0('0x9f')]=_0xcb7a92[_0x8ea0('0x9f')]['length']>0x0?_0xcb7a92[_0x8ea0('0x9f')]:'t';}else if(_[_0x8ea0('0x3f')](_0xcb7a92['result'])){_0xcb7a92['result']='#';_0x54d12f='#';}if(!this['isConfigured'](_0x421eb8['variable_id'])){this['channel'][_0x8ea0('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x17de7f=this['getVariable']['sync'](this,_0x421eb8[_0x8ea0('0xd6')]);if(!_0x17de7f){return this['channel']['error'](_0x421eb8,_0x8ea0('0xd8'));}this[_0x8ea0('0xf')][_0x8ea0('0x98')](_0x17de7f,_0x54d12f);}this[_0x8ea0('0x35')]['sync'](this,_0x421eb8,_0x54d12f);return _0xcb7a92;};AGIVertices[_0x8ea0('0x12')]['noop']=function(_0x237a0c){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x237a0c[_0x8ea0('0xa6')]));return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x237a0c[_0x8ea0('0x15f')]||_0x237a0c[_0x8ea0('0xa6')]);};AGIVertices['prototype']['pause']=function(_0x132aa1){logger['info'](util[_0x8ea0('0x27')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x132aa1[_0x8ea0('0xa6')]));if(!this['isConfigured'](_0x132aa1[_0x8ea0('0x153')])){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x132aa1,'no\x20find\x20by\x20configured');}logger['info'](util[_0x8ea0('0x27')](_0x8ea0('0x152'),this[_0x8ea0('0xf')][_0x8ea0('0x38')],_0x132aa1['findBy']));var _0x417cbe=this[_0x8ea0('0x47')]['sync'](this,_0x132aa1[_0x8ea0('0x160')]);var _0xf0c211=this[_0x8ea0('0x49')][_0x8ea0('0xa1')](this,_0x132aa1['findBy'],_0x417cbe);if(_0xf0c211){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x154'),this['channel'][_0x8ea0('0x38')],_0x132aa1[_0x8ea0('0x153')]));this[_0x8ea0('0xf')]['noop'](util[_0x8ea0('0x27')](_0x8ea0('0x154'),this[_0x8ea0('0xf')][_0x8ea0('0x38')],_0x132aa1[_0x8ea0('0x153')]));return{'code':0xc8,'result':_0x8ea0('0x155')};}else{logger[_0x8ea0('0x2d')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8ea0('0xf')]['callerid'],_0x132aa1['findBy']));this['channel'][_0x8ea0('0xa7')](util['format'](_0x8ea0('0x154'),this[_0x8ea0('0xf')][_0x8ea0('0x38')],_0x132aa1[_0x8ea0('0x153')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8ea0('0x12')]['playback']=function(_0x7882c5){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x161'),_0x7882c5[_0x8ea0('0xa6')]));if(!this[_0x8ea0('0x7c')](_0x7882c5[_0x8ea0('0x10c')])){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x7882c5,_0x8ea0('0x10d'));}var _0x38d7bf=this[_0x8ea0('0x1b')][_0x8ea0('0xa1')](this,_0x7882c5[_0x8ea0('0x10c')]);if(!_0x38d7bf){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x7882c5,_0x8ea0('0x10e'));}var _0x38fd68=this['channel'][_0x8ea0('0x50')](_0x8ea0('0x162'),[_0x38d7bf,_0x7882c5['opts']]);if(_0x38fd68[_0x8ea0('0x9f')]===-0x1){return _0x38fd68;}return this['channel'][_0x8ea0('0xa7')](util[_0x8ea0('0x27')]('Executed\x20command\x20%s\x20%s',_0x8ea0('0x162'),_0x38d7bf));};AGIVertices[_0x8ea0('0x12')]['queue']=function(_0x2b5230){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x163'),_0x2b5230[_0x8ea0('0xa6')]));if(!this[_0x8ea0('0x7c')](_0x2b5230[_0x8ea0('0x164')])){return this[_0x8ea0('0xf')]['error'](_0x2b5230,_0x8ea0('0x165'));}var _0x41d64a='';var _0xd88381=parseInt(_0x2b5230[_0x8ea0('0x164')],0xa);if(isNaN(_0xd88381)){_0x41d64a=_0x2b5230[_0x8ea0('0x164')];}else{_0x41d64a=this['getVoiceQueue'][_0x8ea0('0xa1')](this,_0x2b5230[_0x8ea0('0x164')]);if(!_0x41d64a){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x2b5230,_0x8ea0('0x166'));}}var _0x444884='';if(this[_0x8ea0('0x7c')](_0x2b5230[_0x8ea0('0x10c')])){var _0x29a675=this['getSound'][_0x8ea0('0xa1')](this,_0x2b5230['file_id']);if(_0x29a675){_0x444884=_0x29a675;}}this[_0x8ea0('0x35')]['sync'](this,_0x2b5230,_0x41d64a);if(_0x2b5230['opts']['indexOf']('x')<0x0){_0x2b5230[_0x8ea0('0xe3')]+='x';}if(_0x2b5230[_0x8ea0('0xe3')][_0x8ea0('0x167')]('X')<0x0){_0x2b5230[_0x8ea0('0xe3')]+='X';}this[_0x8ea0('0xf')][_0x8ea0('0x98')](_0x8ea0('0x168'),_0x41d64a?_0x41d64a[_0x8ea0('0x169')]():'');var _0x38d248=this['channel'][_0x8ea0('0x50')](_0x8ea0('0x16a'),[_0x41d64a,_0x2b5230[_0x8ea0('0xe3')],_0x2b5230[_0x8ea0('0x68')],_0x444884,_0x2b5230['timeout'],_0x2b5230[_0x8ea0('0x7')],_0x2b5230['macro'],_0x2b5230['gosub'],'',_0x2b5230[_0x8ea0('0x16b')]]);if(_0x38d248[_0x8ea0('0x9f')]===-0x1){return _0x38d248;}return this[_0x8ea0('0xf')]['noop'](util[_0x8ea0('0x27')](_0x8ea0('0x16c'),_0x8ea0('0x16a'),_0x41d64a));};AGIVertices['prototype'][_0x8ea0('0x16d')]=function(_0x543874){logger['info'](util[_0x8ea0('0x27')](_0x8ea0('0x16e'),_0x543874['label']));var _0x446439=_0x543874[_0x8ea0('0x16f')]||_0x8ea0('0x135');var _0x310662=util[_0x8ea0('0x27')](_0x8ea0('0x170'),this[_0x8ea0('0xf')][_0x8ea0('0x36')],rs[_0x8ea0('0x115')](0x5));var _0x2b09d8=util[_0x8ea0('0x27')](_0x8ea0('0x171'),FILES_PATH,_0x310662,_0x446439);var _0x5b6a51=util[_0x8ea0('0x27')](_0x8ea0('0x12b'),FILES_PATH,_0x310662);this[_0x8ea0('0x39')][_0x8ea0('0xa1')](this,_0x543874,_0x310662,_0x2b09d8);this[_0x8ea0('0xf')][_0x8ea0('0x98')](_0x8ea0('0x172'),_0x310662);logger['info'](_0x8ea0('0x173'),_0x5b6a51,_0x446439,_0x543874[_0x8ea0('0x174')],_0x543874[_0x8ea0('0x5d')]);return this['channel'][_0x8ea0('0x12c')](_0x5b6a51,_0x446439,_0x543874[_0x8ea0('0x174')],_0x543874['timeout'],undefined,!![]);};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x175')]=function(_0x49d53a){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x176'),_0x49d53a[_0x8ea0('0xa6')]));if(!this[_0x8ea0('0x7c')](_0x49d53a[_0x8ea0('0x68')])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0x177'));}var _0x294172=this['restAPI'][_0x8ea0('0xa1')](this,_0x49d53a);logger[_0x8ea0('0x2d')](util['format'](_0x8ea0('0x178'),util['inspect'](_0x294172,{'showHidden':![],'depth':null})));if(!this[_0x8ea0('0x7c')](_0x49d53a[_0x8ea0('0xd6')])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x159b66=this[_0x8ea0('0x9b')][_0x8ea0('0xa1')](this,_0x49d53a[_0x8ea0('0xd6')]);if(!_0x159b66){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x49d53a,_0x8ea0('0xd8'));}this['channel'][_0x8ea0('0x98')](util['format'](_0x8ea0('0x179'),_0x159b66),_0x294172['statusCode']?_0x294172[_0x8ea0('0x6c')]:_0x8ea0('0x17a'));this[_0x8ea0('0xf')][_0x8ea0('0x98')](util['format'](_0x8ea0('0x17b'),_0x159b66),_0x294172['statusMessage']?_0x294172[_0x8ea0('0x6d')]:'OK');if(_0x294172['body']){try{this[_0x8ea0('0x95')](_0x294172[_0x8ea0('0x6a')],_0x159b66);}catch(_0x4d2c27){logger[_0x8ea0('0x2a')](util[_0x8ea0('0x27')](_0x8ea0('0x17c'),_0x159b66));}}return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0xdc'),_0x159b66));};AGIVertices[_0x8ea0('0x12')]['saydigits']=function(_0x1dc2ee){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x1dc2ee[_0x8ea0('0xa6')]));return this[_0x8ea0('0xf')]['sayDigits'](_0x1dc2ee[_0x8ea0('0x17d')][_0x8ea0('0x51')](/\s+/g,''),_0x1dc2ee[_0x8ea0('0x174')]);};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x17e')]=function(_0x5a18c9){logger[_0x8ea0('0x2d')](util['format'](_0x8ea0('0x17f'),_0x5a18c9[_0x8ea0('0xa6')]));return this[_0x8ea0('0xf')][_0x8ea0('0x180')](_0x5a18c9[_0x8ea0('0x5e')][_0x8ea0('0x51')](/\s+/g,''),_0x5a18c9['escape_digits']);};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x181')]=function(_0x2ebadb){logger['info'](util[_0x8ea0('0x27')](_0x8ea0('0x182'),_0x2ebadb[_0x8ea0('0xa6')]));return this['channel']['sayPhonetic'](_0x2ebadb['text'],_0x2ebadb['escape_digits']);};AGIVertices[_0x8ea0('0x12')]['sendMail']=function(_0x24b772){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x24b772['label']));if(!this[_0x8ea0('0x7c')](_0x24b772[_0x8ea0('0x183')])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0x184'));}var _0x165ac4=this[_0x8ea0('0x1f')][_0x8ea0('0xa1')](this,_0x24b772[_0x8ea0('0x183')]);if(!_0x165ac4||!_0x165ac4[_0x8ea0('0x185')]){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x24b772,_0x8ea0('0x186'));}var _0x412a80={'from':util[_0x8ea0('0x27')](_0x8ea0('0x187'),_0x165ac4[_0x8ea0('0x14')],_0x165ac4[_0x8ea0('0x188')]||_0x165ac4['Smtp'][_0x8ea0('0x189')]),'to':_0x24b772['to']||'','cc':_0x24b772['cc']||'','bcc':_0x24b772[_0x8ea0('0x18a')]||'','subject':_0x24b772[_0x8ea0('0x18b')],'html':_0x24b772[_0x8ea0('0x55')],'text':_0x24b772[_0x8ea0('0x55')]};var _0x4749d4={'tls':{'rejectUnauthorized':![]}};if(_0x165ac4['Smtp'][_0x8ea0('0x18c')]){_0x4749d4[_0x8ea0('0x18c')]=_0x165ac4[_0x8ea0('0x185')][_0x8ea0('0x18c')];}else{_0x4749d4[_0x8ea0('0x18d')]=_0x165ac4[_0x8ea0('0x185')]['host'];_0x4749d4[_0x8ea0('0x18e')]=_0x165ac4[_0x8ea0('0x185')]['port'];_0x4749d4['secure']=_0x165ac4[_0x8ea0('0x185')]['secure'];}if(_0x165ac4[_0x8ea0('0x185')][_0x8ea0('0x18f')]){_0x4749d4['auth']={'user':_0x165ac4[_0x8ea0('0x185')][_0x8ea0('0x189')],'pass':_0x165ac4['Smtp'][_0x8ea0('0x190')]};}if(this[_0x8ea0('0x7c')](_0x24b772[_0x8ea0('0x191')])){}logger[_0x8ea0('0xdd')](_0x8ea0('0x192'),JSON[_0x8ea0('0x69')](_0x412a80));this[_0x8ea0('0x35')][_0x8ea0('0xa1')](this,_0x24b772,_0x24b772[_0x8ea0('0x183')]);this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x193'),_0x165ac4[_0x8ea0('0x14')]));this[_0x8ea0('0x21')][_0x8ea0('0xa1')](this,_0x4749d4,_0x412a80);return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0x194'));};AGIVertices['prototype']['sendFax']=function(_0x126d49){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x126d49[_0x8ea0('0xa6')]));return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0x195'));};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x196')]=function(_0x527333){logger[_0x8ea0('0x2d')](util['format'](_0x8ea0('0x197'),_0x527333['label']));if(!this[_0x8ea0('0x7c')](_0x527333['sms_account_id'])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0x198'));}var _0x3a2709=this[_0x8ea0('0x32')]['sync'](this,_0x527333[_0x8ea0('0x199')]);if(!_0x3a2709){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x527333,_0x8ea0('0x19a'));}var _0x34211f={'body':_0x527333[_0x8ea0('0x19b')],'phone':_0x527333['to']||'','SmsAccountId':_0x3a2709['id']};logger['debug']('sendSMS\x20message',JSON[_0x8ea0('0x69')](_0x34211f));this[_0x8ea0('0x35')][_0x8ea0('0xa1')](this,_0x527333,_0x527333['sms_account_id']);this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x3a2709['name']));this['createSmsMessage'][_0x8ea0('0xa1')](this,_0x34211f);return this['channel'][_0x8ea0('0xa7')](_0x8ea0('0x19c'));};AGIVertices['prototype']['set']=function(_0x5f1065){logger[_0x8ea0('0x2d')](util['format'](_0x8ea0('0x19d'),_0x5f1065[_0x8ea0('0xa6')]));if(!this[_0x8ea0('0x7c')](_0x5f1065[_0x8ea0('0xd6')])){return this[_0x8ea0('0xf')]['error'](_0x5f1065,'no\x20variable\x20selected');}var _0x408eae=this['getVariable'][_0x8ea0('0xa1')](this,_0x5f1065[_0x8ea0('0xd6')]);if(!_0x408eae){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x5f1065,_0x8ea0('0xd8'));}return this['channel']['setVariable'](_0x408eae,_0x5f1065['variable_value']);};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x19e')]=function(_0x12c8f2){logger['info'](util[_0x8ea0('0x27')]('Enter\x20in\x20START\x20(%s)\x20block',_0x12c8f2[_0x8ea0('0xa6')]));this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0x19f'));if(_0x12c8f2['answer']===_0x8ea0('0x1a0')){this[_0x8ea0('0xf')][_0x8ea0('0xa7')]('Answer');return this[_0x8ea0('0xf')][_0x8ea0('0xb4')]();}return this[_0x8ea0('0xf')]['noop'](_0x8ea0('0x1a1'));};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x1a2')]=function(_0x55b284){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x1a3'),_0x55b284[_0x8ea0('0xa6')]));if(!this['isConfigured'](_0x55b284[_0x8ea0('0x1a4')])){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x55b284,_0x8ea0('0x1a5'));}var _0x13d737=this[_0x8ea0('0x16')][_0x8ea0('0xa1')](this,_0x55b284[_0x8ea0('0x1a4')]);if(!this[_0x8ea0('0x7c')](_0x13d737)){return this[_0x8ea0('0xf')]['error'](_0x55b284,util[_0x8ea0('0x27')](_0x8ea0('0x1a6'),_0x55b284[_0x8ea0('0x1a4')]));}if(_0x13d737===this[_0x8ea0('0xf')][_0x8ea0('0x37')]){return this[_0x8ea0('0xf')]['error'](_0x55b284,_0x8ea0('0x1a7'));}this[_0x8ea0('0x35')][_0x8ea0('0xa1')](this,_0x55b284,_0x13d737);var _0x50017f=this[_0x8ea0('0xf')][_0x8ea0('0x50')](_0x8ea0('0x1a8'),util[_0x8ea0('0x27')](_0x8ea0('0x1a9'),config['agi'][_0x8ea0('0x18d')]||_0x8ea0('0x1aa'),_0x13d737,this[_0x8ea0('0xf')][_0x8ea0('0x37')]));if(_0x50017f[_0x8ea0('0x9f')]===-0x1){return _0x50017f;}return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')]('Executed\x20command\x20%s\x20%s',_0x8ea0('0x1a8'),_0x13d737));};AGIVertices['prototype'][_0x8ea0('0x1ab')]=function(_0x44de91){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x1ac'),_0x44de91[_0x8ea0('0xa6')]));var _0xb55ebe=this[_0x8ea0('0x1ad')][_0x8ea0('0xa1')](this,_0x44de91[_0x8ea0('0xb2')]);this[_0x8ea0('0x35')][_0x8ea0('0xa1')](this,_0x44de91,_0x44de91[_0x8ea0('0xb2')]);if(this['isConfigured'](_0x44de91[_0x8ea0('0xd6')])){var _0x3a4cfb=this[_0x8ea0('0x9b')][_0x8ea0('0xa1')](this,_0x44de91['variable_id']);if(_0x3a4cfb){this[_0x8ea0('0xf')]['setVariable'](_0x3a4cfb,_0xb55ebe);return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x44de91[_0x8ea0('0xb2')],_0x3a4cfb));}}return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x1ae'),_0x44de91[_0x8ea0('0xb2')]));};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x1af')]=function(_0x391022){logger[_0x8ea0('0x2d')](util['format'](_0x8ea0('0x1b0'),_0x391022[_0x8ea0('0xa6')]));_0x391022[_0x8ea0('0x55')]=_0x391022[_0x8ea0('0x55')][_0x8ea0('0x51')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8ea0('0x7c')](_0x391022[_0x8ea0('0x53')])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0x1b1'));}if(!this[_0x8ea0('0x7c')](_0x391022[_0x8ea0('0x55')])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0xc2'));}this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x1b2'),_0x391022[_0x8ea0('0x55')]));var _0x51d5dd=this[_0x8ea0('0x52')][_0x8ea0('0xa1')](this,_0x391022);if(_0x51d5dd){this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util['format'](_0x8ea0('0x1b3'),_0x51d5dd));var _0xddb784=this['channel'][_0x8ea0('0x101')](_0x51d5dd);try{fs[_0x8ea0('0x122')](_0x51d5dd+_0x8ea0('0x102'));}catch(_0x51ba4c){logger[_0x8ea0('0x2a')](_0x51ba4c);}return _0xddb784;}return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x391022,_0x8ea0('0x1b4'));};AGIVertices['prototype']['tts']=function(_0x50de1d){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x1b5'),_0x50de1d[_0x8ea0('0xa6')]));_0x50de1d['text']=_0x50de1d['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8ea0('0x7c')](_0x50de1d['text'])){return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](_0x8ea0('0xc2'));}this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x50de1d['text']));var _0x2f15a5=this[_0x8ea0('0x5b')][_0x8ea0('0xa1')](this,_0x50de1d);if(_0x2f15a5){this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x1b6'),_0x2f15a5));var _0x4fc0b5=this['channel'][_0x8ea0('0x101')](_0x2f15a5);try{fs[_0x8ea0('0x122')](_0x2f15a5+_0x8ea0('0x102'));}catch(_0x83526b){logger[_0x8ea0('0x2a')](_0x83526b);}return _0x4fc0b5;}return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x50de1d,_0x8ea0('0x1b7'));};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x1b8')]=function(_0x2b7a75){logger['info'](util[_0x8ea0('0x27')](_0x8ea0('0x1b9'),_0x2b7a75[_0x8ea0('0xa6')]));if(!this[_0x8ea0('0x7c')](_0x2b7a75[_0x8ea0('0x153')])){return this['channel']['error'](_0x2b7a75,_0x8ea0('0x151'));}logger['info'](util[_0x8ea0('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8ea0('0xf')]['callerid'],_0x2b7a75[_0x8ea0('0x153')]));var _0x25151d=this[_0x8ea0('0x4b')]['sync'](this,_0x2b7a75['findBy']);if(_0x25151d){logger[_0x8ea0('0x2d')](util['format'](_0x8ea0('0x154'),this[_0x8ea0('0xf')]['callerid'],_0x2b7a75[_0x8ea0('0x153')]));this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x8ea0('0x38')],_0x2b7a75[_0x8ea0('0x153')]));return{'code':0xc8,'result':_0x8ea0('0x155')};}else{logger[_0x8ea0('0x2d')](util['format'](_0x8ea0('0x157'),this[_0x8ea0('0xf')][_0x8ea0('0x38')],_0x2b7a75['findBy']));this['channel'][_0x8ea0('0xa7')](util['format'](_0x8ea0('0x157'),this[_0x8ea0('0xf')][_0x8ea0('0x38')],_0x2b7a75[_0x8ea0('0x153')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x1ba')]=function(_0x1af0fb){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x1bb'),_0x1af0fb[_0x8ea0('0xa6')]));var _0xe3cb5e=this['channel'][_0x8ea0('0x50')](_0x8ea0('0x1bc'),[_0x1af0fb['mailbox'],_0x1af0fb[_0x8ea0('0x70')]]);if(_0xe3cb5e[_0x8ea0('0x9f')]===-0x1){return _0xe3cb5e;}return this[_0x8ea0('0xf')][_0x8ea0('0xa7')](util[_0x8ea0('0x27')](_0x8ea0('0x16c'),_0x8ea0('0x1bc'),_0x1af0fb[_0x8ea0('0x1bd')]));};AGIVertices[_0x8ea0('0x12')][_0x8ea0('0x1be')]=function(_0x1b8355){logger[_0x8ea0('0x2d')](util[_0x8ea0('0x27')](_0x8ea0('0x1bf'),_0x1b8355[_0x8ea0('0xa6')]));if(!this['isConfigured'](_0x1b8355['variable_id'])){return this[_0x8ea0('0xf')][_0x8ea0('0x2a')](_0x1b8355,'no\x20variable\x20selected');}var _0x2c4e01=this[_0x8ea0('0x9b')][_0x8ea0('0xa1')](this,_0x1b8355['variable_id']);if(!_0x2c4e01){return this['channel']['error'](_0x1b8355,_0x8ea0('0xd8'));}var _0x561803=this[_0x8ea0('0xf')][_0x8ea0('0x9b')](_0x2c4e01);return{'code':0xc8,'result':_0x561803[_0x8ea0('0x9c')]?_0x561803['extra']:'-'};};String[_0x8ea0('0x12')][_0x8ea0('0x9a')]=function(_0xce699b,_0x54325c){return this[_0x8ea0('0x99')](_0xce699b)[_0x8ea0('0x1c0')](_0x54325c);};module[_0x8ea0('0x1c1')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index f5d9633..245e2e1 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 _0x2389=['uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][TIMERS]','stringify','acw','interface','syncAgentConnectPreview','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','lodash','moment','../ami','../../../config/logger','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','queue','ACW','mandatoryDispositionPause','name','QueuePause','getAgent','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x230902,_0x5b7c78){var _0x2feae9=function(_0x4f1660){while(--_0x4f1660){_0x230902['push'](_0x230902['shift']());}};_0x2feae9(++_0x5b7c78);}(_0x2389,0x192));var _0x9238=function(_0x2b0d88,_0x5b5ef2){_0x2b0d88=_0x2b0d88-0x0;var _0x1c9256=_0x2389[_0x2b0d88];return _0x1c9256;};'use strict';var util=require('util');var _=require(_0x9238('0x0'));var moment=require(_0x9238('0x1'));var ami=require(_0x9238('0x2'));var logger=require(_0x9238('0x3'))('acw');var RpcUser=require(_0x9238('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3676d4){this['voiceQueues']=_0x3676d4[_0x9238('0x5')];this[_0x9238('0x6')]=_0x3676d4[_0x9238('0x6')];this[_0x9238('0x7')]=_0x3676d4[_0x9238('0x7')];this[_0x9238('0x8')]={};ami['on'](_0x9238('0x9'),this[_0x9238('0xa')][_0x9238('0xb')](this));ami['on'](_0x9238('0xc'),this[_0x9238('0xd')]['bind'](this));ami['on'](_0x9238('0xe'),this['syncHangup'][_0x9238('0xb')](this));ami['on'](_0x9238('0xf'),this['syncAgentRingNoAnswer'][_0x9238('0xb')](this));ami['on'](_0x9238('0x10'),this[_0x9238('0x11')][_0x9238('0xb')](this));ami['on'](_0x9238('0x12'),this[_0x9238('0x13')][_0x9238('0xb')](this));ami['on'](_0x9238('0x14'),this['syncAgentConnectPreview'][_0x9238('0xb')](this));}function getDiff(_0x294c5d){var _0x11ff1e=moment()['milliseconds'](0x0);var _0x459387=moment(_0x294c5d)[_0x9238('0x15')](0x0);return _0x11ff1e[_0x9238('0x16')](_0x459387,_0x9238('0x17'));}Acw[_0x9238('0x18')]['startAcw']=function(_0x1781f){try{var _0x3f903d=this;var _0x5b5321=this[_0x9238('0x8')][_0x1781f]['interface'];var _0x2dca2d=this['channels'][_0x1781f][_0x9238('0x19')];var _0x215380=this[_0x9238('0x5')][_0x2dca2d];var _0x259f93=![];var _0x5e125d=_0x9238('0x1a');if(_0x215380['mandatoryDisposition']){if(_0x215380[_0x9238('0x1b')]['name']){_0x259f93=!![];_0x5e125d=_0x215380[_0x9238('0x1b')][_0x9238('0x1c')];}}ami['Action']({'action':_0x9238('0x1d'),'interface':_0x5b5321,'paused':!![],'reason':_0x5e125d})['then'](function(_0xbfdac3){if(_0x3f903d['agents'][_0x5b5321]){return RpcUser[_0x9238('0x1e')](_0x3f903d[_0x9238('0x6')][_0x5b5321]['id'])[_0x9238('0x1f')](function(_0x223162){if(_0x223162&&!_0x223162[_0x9238('0x20')]){logger[_0x9238('0x21')](_0x9238('0x22'),_0x1781f,_0x5b5321,_0x2dca2d);var _0xf46b5a=_0x3f903d[_0x9238('0x8')][_0x1781f]['attended']&&_0x3f903d[_0x9238('0x8')][_0x1781f][_0x9238('0x23')]?_0x3f903d[_0x9238('0x8')][_0x1781f][_0x9238('0x23')]:_0x1781f;return RpcUser[_0x9238('0x24')](_0x3f903d[_0x9238('0x6')][_0x5b5321],_0x5e125d,_0xf46b5a)[_0x9238('0x1f')](function(_0x5afa70){if(!_0x259f93){_0x3f903d[_0x9238('0x7')][_0x5b5321]={};logger[_0x9238('0x21')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1781f,_0x3f903d[_0x9238('0x5')][_0x2dca2d][_0x9238('0x25')],_0x5b5321,_0x2dca2d);_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x26')]=setTimeout(_0x3f903d[_0x9238('0x27')][_0x9238('0xb')](_0x3f903d,_0x5b5321),_0x3f903d[_0x9238('0x5')][_0x2dca2d][_0x9238('0x25')]*0x3e8);_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x28')]=moment()[_0x9238('0x29')](_0x9238('0x2a'));_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x2b')]=_0x1781f;_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x19')]=_0x2dca2d;_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x2c')]=function(){var _0x1717cd=getDiff(_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x28')]);clearTimeout(_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x26')]);_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x26')]=![];RpcVoiceAgentReport[_0x9238('0x2d')]({'acwtime':_0x1717cd},_0x3f903d[_0x9238('0x7')][_0x5b5321][_0x9238('0x2b')],_0x5b5321)[_0x9238('0x1f')](function(_0x43ff95){logger['info'](_0x9238('0x2e'),_0x1781f,_0x1717cd,_0x43ff95);})[_0x9238('0x2f')](function(_0x169efa){logger[_0x9238('0x30')](_0x9238('0x31'),_0x1781f,_0x169efa);});delete _0x3f903d[_0x9238('0x7')][_0x5b5321];};}});}else{logger['info'](_0x9238('0x32'),_0x1781f,_0x5b5321,_0x2dca2d);}});}})[_0x9238('0x2f')](function(_0x343ab4){logger[_0x9238('0x30')](_0x9238('0x33'),_0x1781f,_0x3f903d[_0x9238('0x5')][_0x2dca2d][_0x9238('0x25')],_0x5b5321,_0x2dca2d);})[_0x9238('0x34')](function(){delete _0x3f903d[_0x9238('0x8')][_0x1781f];});}catch(_0x3db5b3){logger[_0x9238('0x30')]('[ACW][START]\x20%s',_0x3db5b3[_0x9238('0x35')]);}};Acw[_0x9238('0x18')][_0x9238('0x27')]=function(_0x4600ac){try{var _0x3b82d4=this;if(_0x3b82d4[_0x9238('0x7')][_0x4600ac]){_0x3b82d4[_0x9238('0x7')][_0x4600ac][_0x9238('0x26')]=![];var _0x3b214d=_0x3b82d4['timers'][_0x4600ac][_0x9238('0x2b')];var _0x444c3d=_0x3b82d4[_0x9238('0x7')][_0x4600ac][_0x9238('0x19')];var _0x12fec9=_0x3b82d4['voiceQueues'][_0x444c3d][_0x9238('0x25')];logger['info'](_0x9238('0x36'),_0x3b214d,_0x4600ac);RpcUser[_0x9238('0x37')](this['agents'][_0x4600ac]);RpcVoiceAgentReport[_0x9238('0x2d')]({'acwtime':_0x12fec9,'agentacw':!![]},_0x3b214d,_0x4600ac)[_0x9238('0x1f')](function(_0x28646d){logger[_0x9238('0x21')](_0x9238('0x2e'),_0x3b214d,_0x12fec9,_0x28646d);})[_0x9238('0x2f')](function(_0x592622){logger['error'](_0x9238('0x31'),_0x3b214d,_0x592622);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x4600ac);if(_0x3b82d4[_0x9238('0x7')]){logger['info'](_0x9238('0x38'),JSON[_0x9238('0x39')](_0x3b82d4[_0x9238('0x7')]));}}}catch(_0x1c24fa){logger[_0x9238('0x30')]('[ACW][STOP]\x20%s',_0x1c24fa['message']);}};Acw[_0x9238('0x18')]['syncAgentConnect']=function(_0x5ba8dd){try{if(this['voiceQueues'][_0x5ba8dd[_0x9238('0x19')]]&&(this[_0x9238('0x5')][_0x5ba8dd[_0x9238('0x19')]][_0x9238('0x3a')]||this[_0x9238('0x5')][_0x5ba8dd[_0x9238('0x19')]]['mandatoryDisposition'])){if(this[_0x9238('0x6')][_0x5ba8dd[_0x9238('0x3b')]]){this[_0x9238('0x8')][_0x5ba8dd[_0x9238('0x2b')]]={'queue':_0x5ba8dd[_0x9238('0x19')],'interface':_0x5ba8dd[_0x9238('0x3b')],'destlinkedid':_0x5ba8dd[_0x9238('0x23')]};}}}catch(_0x383b4e){logger[_0x9238('0x30')]('[ACW][syncAgentConnect]\x20%s',_0x383b4e[_0x9238('0x35')]);}};Acw[_0x9238('0x18')][_0x9238('0x3c')]=function(_0x104728){try{if(this['voiceQueues'][_0x104728[_0x9238('0x19')]]&&(this[_0x9238('0x5')][_0x104728[_0x9238('0x19')]][_0x9238('0x3a')]||this[_0x9238('0x5')][_0x104728[_0x9238('0x19')]][_0x9238('0x3d')])){if(this[_0x9238('0x6')][_0x104728[_0x9238('0x3b')]]){this[_0x9238('0x8')][_0x104728['uniqueid']]={'queue':_0x104728['queue'],'interface':_0x104728['interface']};}}}catch(_0x5c2c4e){logger[_0x9238('0x30')](_0x9238('0x3e'),_0x5c2c4e[_0x9238('0x35')]);}};Acw['prototype'][_0x9238('0xd')]=function(_0x5e71ba){try{if(this[_0x9238('0x8')][_0x5e71ba[_0x9238('0x2b')]]&&_[_0x9238('0x3f')](this[_0x9238('0x8')][_0x5e71ba['uniqueid']][_0x9238('0x40')])){logger[_0x9238('0x21')](_0x9238('0x41'),_0x5e71ba['uniqueid']);this[_0x9238('0x42')](_0x5e71ba[_0x9238('0x2b')]);}else if(this[_0x9238('0x8')][_0x5e71ba[_0x9238('0x43')]]&&_[_0x9238('0x3f')](this[_0x9238('0x8')][_0x5e71ba[_0x9238('0x43')]][_0x9238('0x40')])){logger[_0x9238('0x21')]('[%s][HANGUP:LINKEDID]',_0x5e71ba[_0x9238('0x43')]);this[_0x9238('0x42')](_0x5e71ba[_0x9238('0x43')]);}}catch(_0x48b491){logger['error'](_0x9238('0x44'),_0x48b491[_0x9238('0x35')]);}};Acw['prototype'][_0x9238('0x45')]=function(_0x403d8a){try{if(this['channels'][_0x403d8a[_0x9238('0x2b')]]&&this[_0x9238('0x8')][_0x403d8a[_0x9238('0x2b')]]['attended']){logger[_0x9238('0x21')](_0x9238('0x46'),_0x403d8a[_0x9238('0x2b')]);this['startAcw'](_0x403d8a[_0x9238('0x2b')]);}else if(this['channels'][_0x403d8a['linkedid']]&&this['channels'][_0x403d8a[_0x9238('0x43')]][_0x9238('0x40')]){logger[_0x9238('0x21')](_0x9238('0x47'),_0x403d8a[_0x9238('0x43')]);this[_0x9238('0x42')](_0x403d8a[_0x9238('0x43')]);}}catch(_0x2f8022){logger['error'](_0x9238('0x48'),_0x2f8022['message']);}};Acw['prototype'][_0x9238('0x11')]=function(_0x123ebf){try{if(!_[_0x9238('0x49')](this[_0x9238('0x8')][_0x123ebf[_0x9238('0x4a')]])){this[_0x9238('0x42')](_0x123ebf[_0x9238('0x4a')]);if(this[_0x9238('0x8')][_0x123ebf[_0x9238('0x4b')]]){this[_0x9238('0x8')][_0x123ebf['secondtransfereruniqueid']]['attended']=!![];this['channels'][_0x123ebf[_0x9238('0x4c')]]=this[_0x9238('0x8')][_0x123ebf[_0x9238('0x4b')]];delete this[_0x9238('0x8')][_0x123ebf['secondtransfereruniqueid']];}}else if(!_[_0x9238('0x49')](this[_0x9238('0x8')][_0x123ebf[_0x9238('0x4c')]])){this[_0x9238('0x42')](_0x123ebf['transfertargetuniqueid']);if(this[_0x9238('0x8')][_0x123ebf[_0x9238('0x4d')]]){this[_0x9238('0x8')][_0x123ebf['origtransfereruniqueid']][_0x9238('0x40')]=!![];this[_0x9238('0x8')][_0x123ebf[_0x9238('0x4a')]]=this[_0x9238('0x8')][_0x123ebf[_0x9238('0x4d')]];delete this['channels'][_0x123ebf['origtransfereruniqueid']];}}}catch(_0x4f0504){logger[_0x9238('0x30')](_0x9238('0x4e'),_0x4f0504[_0x9238('0x35')]);}};Acw[_0x9238('0x18')]['syncBlindTransfer']=function(_0x262bb1){try{if(this[_0x9238('0x8')][_0x262bb1[_0x9238('0x4f')]]){logger[_0x9238('0x21')](_0x9238('0x50'),JSON[_0x9238('0x39')](_0x262bb1[_0x9238('0x4f')]));this[_0x9238('0x42')](_0x262bb1[_0x9238('0x4f')]);}else if(this[_0x9238('0x8')][_0x262bb1['transfererlinkedid']]){logger['info'](_0x9238('0x51'),JSON[_0x9238('0x39')](_0x262bb1[_0x9238('0x52')]));this[_0x9238('0x42')](_0x262bb1[_0x9238('0x52')]);}}catch(_0x28b051){logger[_0x9238('0x30')](_0x9238('0x53'),_0x28b051[_0x9238('0x35')]);}};Acw[_0x9238('0x18')][_0x9238('0x54')]=function(_0x264182){try{if(this['voiceQueues'][_0x264182[_0x9238('0x19')]]&&this[_0x9238('0x5')][_0x264182[_0x9238('0x19')]][_0x9238('0x55')]===_0x9238('0x56')){if(this[_0x9238('0x6')][_0x264182[_0x9238('0x3b')]]){logger[_0x9238('0x21')](_0x9238('0x57'),_0x264182[_0x9238('0x2b')],_0x264182[_0x9238('0x3b')],_0x264182[_0x9238('0x19')]);return RpcUser[_0x9238('0x24')](this[_0x9238('0x6')][_0x264182['interface']],'Auto-Pause',_0x264182['uniqueid']);}}}catch(_0x17628d){logger[_0x9238('0x30')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x17628d[_0x9238('0x35')]);}};module[_0x9238('0x58')]=Acw; \ No newline at end of file +var _0xcba6=['../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncAgentConnectPreview','milliseconds','diff','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami'];(function(_0x2f8ed3,_0x39907b){var _0x1842fa=function(_0x1464e2){while(--_0x1464e2){_0x2f8ed3['push'](_0x2f8ed3['shift']());}};_0x1842fa(++_0x39907b);}(_0xcba6,0xb1));var _0x6cba=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xcba6[_0xe66cf2];return _0x2d84e7;};'use strict';var util=require(_0x6cba('0x0'));var _=require('lodash');var moment=require(_0x6cba('0x1'));var ami=require(_0x6cba('0x2'));var logger=require(_0x6cba('0x3'))(_0x6cba('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x6cba('0x5'));function Acw(_0x4d0e0a){this[_0x6cba('0x6')]=_0x4d0e0a[_0x6cba('0x6')];this[_0x6cba('0x7')]=_0x4d0e0a['agents'];this[_0x6cba('0x8')]=_0x4d0e0a[_0x6cba('0x8')];this[_0x6cba('0x9')]={};ami['on'](_0x6cba('0xa'),this[_0x6cba('0xb')][_0x6cba('0xc')](this));ami['on'](_0x6cba('0xd'),this[_0x6cba('0xe')][_0x6cba('0xc')](this));ami['on'](_0x6cba('0xf'),this[_0x6cba('0x10')]['bind'](this));ami['on']('agentringnoanswer',this[_0x6cba('0x11')][_0x6cba('0xc')](this));ami['on'](_0x6cba('0x12'),this['syncAttendedTransfer'][_0x6cba('0xc')](this));ami['on'](_0x6cba('0x13'),this['syncBlindTransfer'][_0x6cba('0xc')](this));ami['on']('custom:agentConnectPreview',this[_0x6cba('0x14')][_0x6cba('0xc')](this));}function getDiff(_0x35affc){var _0x33a8ed=moment()[_0x6cba('0x15')](0x0);var _0x4f803b=moment(_0x35affc)[_0x6cba('0x15')](0x0);return _0x33a8ed[_0x6cba('0x16')](_0x4f803b,'seconds');}Acw[_0x6cba('0x17')][_0x6cba('0x18')]=function(_0x407d93){try{var _0x2c0c72=this;var _0x45abeb=this[_0x6cba('0x9')][_0x407d93]['interface'];var _0x4bec34=this[_0x6cba('0x9')][_0x407d93][_0x6cba('0x19')];var _0x5c1d08=this['voiceQueues'][_0x4bec34];var _0x47e2ef=![];var _0x2bd1e2=_0x6cba('0x1a');if(_0x5c1d08[_0x6cba('0x1b')]){if(_0x5c1d08[_0x6cba('0x1c')][_0x6cba('0x1d')]){_0x47e2ef=!![];_0x2bd1e2=_0x5c1d08[_0x6cba('0x1c')][_0x6cba('0x1d')];}}ami[_0x6cba('0x1e')]({'action':_0x6cba('0x1f'),'interface':_0x45abeb,'paused':!![],'reason':_0x2bd1e2})[_0x6cba('0x20')](function(_0x44b9c6){if(_0x2c0c72[_0x6cba('0x7')][_0x45abeb]){return RpcUser[_0x6cba('0x21')](_0x2c0c72[_0x6cba('0x7')][_0x45abeb]['id'])[_0x6cba('0x20')](function(_0x5111f5){if(_0x5111f5&&!_0x5111f5[_0x6cba('0x22')]){logger['info'](_0x6cba('0x23'),_0x407d93,_0x45abeb,_0x4bec34);var _0x460adb=_0x2c0c72['channels'][_0x407d93][_0x6cba('0x24')]&&_0x2c0c72[_0x6cba('0x9')][_0x407d93]['destlinkedid']?_0x2c0c72[_0x6cba('0x9')][_0x407d93][_0x6cba('0x25')]:_0x407d93;return RpcUser[_0x6cba('0x26')](_0x2c0c72[_0x6cba('0x7')][_0x45abeb],_0x2bd1e2,_0x460adb)[_0x6cba('0x20')](function(_0x489b18){if(!_0x47e2ef){_0x2c0c72[_0x6cba('0x8')][_0x45abeb]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x407d93,_0x2c0c72['voiceQueues'][_0x4bec34][_0x6cba('0x27')],_0x45abeb,_0x4bec34);_0x2c0c72['timers'][_0x45abeb][_0x6cba('0x28')]=setTimeout(_0x2c0c72[_0x6cba('0x29')][_0x6cba('0xc')](_0x2c0c72,_0x45abeb),_0x2c0c72[_0x6cba('0x6')][_0x4bec34][_0x6cba('0x27')]*0x3e8);_0x2c0c72[_0x6cba('0x8')][_0x45abeb][_0x6cba('0x2a')]=moment()['format'](_0x6cba('0x2b'));_0x2c0c72['timers'][_0x45abeb][_0x6cba('0x2c')]=_0x407d93;_0x2c0c72[_0x6cba('0x8')][_0x45abeb][_0x6cba('0x19')]=_0x4bec34;_0x2c0c72['timers'][_0x45abeb][_0x6cba('0x2d')]=function(){var _0x4396a4=getDiff(_0x2c0c72[_0x6cba('0x8')][_0x45abeb][_0x6cba('0x2a')]);clearTimeout(_0x2c0c72['timers'][_0x45abeb]['timer']);_0x2c0c72['timers'][_0x45abeb]['timer']=![];RpcVoiceAgentReport[_0x6cba('0x2e')]({'acwtime':_0x4396a4},_0x2c0c72[_0x6cba('0x8')][_0x45abeb][_0x6cba('0x2c')],_0x45abeb)[_0x6cba('0x20')](function(_0x459d1f){logger['info'](_0x6cba('0x2f'),_0x407d93,_0x4396a4,_0x459d1f);})[_0x6cba('0x30')](function(_0x223675){logger[_0x6cba('0x31')](_0x6cba('0x32'),_0x407d93,_0x223675);});delete _0x2c0c72[_0x6cba('0x8')][_0x45abeb];};}});}else{logger[_0x6cba('0x33')](_0x6cba('0x34'),_0x407d93,_0x45abeb,_0x4bec34);}});}})[_0x6cba('0x30')](function(_0x5d41d7){logger[_0x6cba('0x31')](_0x6cba('0x35'),_0x407d93,_0x2c0c72[_0x6cba('0x6')][_0x4bec34][_0x6cba('0x27')],_0x45abeb,_0x4bec34);})[_0x6cba('0x36')](function(){delete _0x2c0c72[_0x6cba('0x9')][_0x407d93];});}catch(_0x4e68fe){logger[_0x6cba('0x31')](_0x6cba('0x37'),_0x4e68fe[_0x6cba('0x38')]);}};Acw[_0x6cba('0x17')][_0x6cba('0x29')]=function(_0x30ea56){try{var _0x3543b4=this;if(_0x3543b4[_0x6cba('0x8')][_0x30ea56]){_0x3543b4[_0x6cba('0x8')][_0x30ea56][_0x6cba('0x28')]=![];var _0x45fca9=_0x3543b4['timers'][_0x30ea56][_0x6cba('0x2c')];var _0x183a3e=_0x3543b4[_0x6cba('0x8')][_0x30ea56][_0x6cba('0x19')];var _0x14ed3a=_0x3543b4['voiceQueues'][_0x183a3e][_0x6cba('0x27')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x45fca9,_0x30ea56);RpcUser[_0x6cba('0x39')](this[_0x6cba('0x7')][_0x30ea56]);RpcVoiceAgentReport[_0x6cba('0x2e')]({'acwtime':_0x14ed3a,'agentacw':!![]},_0x45fca9,_0x30ea56)[_0x6cba('0x20')](function(_0x4ad898){logger[_0x6cba('0x33')]('[%s][UPDATE][ACWTIME:%s]',_0x45fca9,_0x14ed3a,_0x4ad898);})['catch'](function(_0x4d66d1){logger[_0x6cba('0x31')](_0x6cba('0x32'),_0x45fca9,_0x4d66d1);});}else{logger[_0x6cba('0x31')](_0x6cba('0x3a'),_0x30ea56);if(_0x3543b4['timers']){logger[_0x6cba('0x33')](_0x6cba('0x3b'),JSON[_0x6cba('0x3c')](_0x3543b4[_0x6cba('0x8')]));}}}catch(_0x1a854e){logger['error'](_0x6cba('0x3d'),_0x1a854e['message']);}};Acw[_0x6cba('0x17')]['syncAgentConnect']=function(_0x1b0e39){try{if(this[_0x6cba('0x6')][_0x1b0e39[_0x6cba('0x19')]]&&(this['voiceQueues'][_0x1b0e39['queue']][_0x6cba('0x4')]||this[_0x6cba('0x6')][_0x1b0e39['queue']][_0x6cba('0x1b')])){if(this[_0x6cba('0x7')][_0x1b0e39[_0x6cba('0x3e')]]){this['channels'][_0x1b0e39['uniqueid']]={'queue':_0x1b0e39[_0x6cba('0x19')],'interface':_0x1b0e39['interface'],'destlinkedid':_0x1b0e39[_0x6cba('0x25')]};}}}catch(_0xec669d){logger['error'](_0x6cba('0x3f'),_0xec669d['message']);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x3976b9){try{if(this[_0x6cba('0x6')][_0x3976b9['queue']]&&(this['voiceQueues'][_0x3976b9[_0x6cba('0x19')]][_0x6cba('0x4')]||this['voiceQueues'][_0x3976b9[_0x6cba('0x19')]][_0x6cba('0x1b')])){if(this[_0x6cba('0x7')][_0x3976b9['interface']]){this[_0x6cba('0x9')][_0x3976b9['uniqueid']]={'queue':_0x3976b9[_0x6cba('0x19')],'interface':_0x3976b9['interface']};}}}catch(_0x42a5ac){logger[_0x6cba('0x31')](_0x6cba('0x40'),_0x42a5ac[_0x6cba('0x38')]);}};Acw[_0x6cba('0x17')]['syncHangupRequest']=function(_0x25895e){try{if(this['channels'][_0x25895e[_0x6cba('0x2c')]]&&_[_0x6cba('0x41')](this[_0x6cba('0x9')][_0x25895e[_0x6cba('0x2c')]][_0x6cba('0x24')])){logger[_0x6cba('0x33')]('[%s][HANGUP:UNIQUEID]',_0x25895e[_0x6cba('0x2c')]);this['startAcw'](_0x25895e[_0x6cba('0x2c')]);}else if(this[_0x6cba('0x9')][_0x25895e[_0x6cba('0x42')]]&&_[_0x6cba('0x41')](this[_0x6cba('0x9')][_0x25895e[_0x6cba('0x42')]][_0x6cba('0x24')])){logger[_0x6cba('0x33')](_0x6cba('0x43'),_0x25895e[_0x6cba('0x42')]);this['startAcw'](_0x25895e[_0x6cba('0x42')]);}}catch(_0x159568){logger[_0x6cba('0x31')](_0x6cba('0x44'),_0x159568['message']);}};Acw[_0x6cba('0x17')][_0x6cba('0x10')]=function(_0x29ca44){try{if(this[_0x6cba('0x9')][_0x29ca44['uniqueid']]&&this[_0x6cba('0x9')][_0x29ca44[_0x6cba('0x2c')]][_0x6cba('0x24')]){logger['info'](_0x6cba('0x45'),_0x29ca44['uniqueid']);this[_0x6cba('0x18')](_0x29ca44[_0x6cba('0x2c')]);}else if(this['channels'][_0x29ca44[_0x6cba('0x42')]]&&this[_0x6cba('0x9')][_0x29ca44[_0x6cba('0x42')]]['attended']){logger[_0x6cba('0x33')](_0x6cba('0x46'),_0x29ca44['linkedid']);this[_0x6cba('0x18')](_0x29ca44['linkedid']);}}catch(_0x5e933b){logger['error'](_0x6cba('0x47'),_0x5e933b[_0x6cba('0x38')]);}};Acw[_0x6cba('0x17')][_0x6cba('0x48')]=function(_0x30bab1){try{if(!_[_0x6cba('0x49')](this[_0x6cba('0x9')][_0x30bab1[_0x6cba('0x4a')]])){this[_0x6cba('0x18')](_0x30bab1[_0x6cba('0x4a')]);if(this['channels'][_0x30bab1['secondtransfereruniqueid']]){this['channels'][_0x30bab1[_0x6cba('0x4b')]]['attended']=!![];this[_0x6cba('0x9')][_0x30bab1[_0x6cba('0x4c')]]=this[_0x6cba('0x9')][_0x30bab1[_0x6cba('0x4b')]];delete this[_0x6cba('0x9')][_0x30bab1[_0x6cba('0x4b')]];}}else if(!_[_0x6cba('0x49')](this['channels'][_0x30bab1[_0x6cba('0x4c')]])){this['startAcw'](_0x30bab1['transfertargetuniqueid']);if(this[_0x6cba('0x9')][_0x30bab1['origtransfereruniqueid']]){this[_0x6cba('0x9')][_0x30bab1[_0x6cba('0x4d')]]['attended']=!![];this[_0x6cba('0x9')][_0x30bab1['transfereeuniqueid']]=this[_0x6cba('0x9')][_0x30bab1[_0x6cba('0x4d')]];delete this[_0x6cba('0x9')][_0x30bab1[_0x6cba('0x4d')]];}}}catch(_0x126a77){logger[_0x6cba('0x31')](_0x6cba('0x4e'),_0x126a77['message']);}};Acw[_0x6cba('0x17')][_0x6cba('0x4f')]=function(_0x43bf22){try{if(this['channels'][_0x43bf22[_0x6cba('0x50')]]){logger[_0x6cba('0x33')](_0x6cba('0x51'),JSON['stringify'](_0x43bf22['transfereruniqueid']));this['startAcw'](_0x43bf22[_0x6cba('0x50')]);}else if(this['channels'][_0x43bf22[_0x6cba('0x52')]]){logger[_0x6cba('0x33')](_0x6cba('0x53'),JSON['stringify'](_0x43bf22[_0x6cba('0x52')]));this[_0x6cba('0x18')](_0x43bf22[_0x6cba('0x52')]);}}catch(_0x28fbeb){logger[_0x6cba('0x31')](_0x6cba('0x54'),_0x28fbeb[_0x6cba('0x38')]);}};Acw['prototype'][_0x6cba('0x11')]=function(_0x592a2f){try{if(this[_0x6cba('0x6')][_0x592a2f[_0x6cba('0x19')]]&&this[_0x6cba('0x6')][_0x592a2f['queue']][_0x6cba('0x55')]===_0x6cba('0x56')){if(this['agents'][_0x592a2f['interface']]){logger[_0x6cba('0x33')](_0x6cba('0x57'),_0x592a2f[_0x6cba('0x2c')],_0x592a2f[_0x6cba('0x3e')],_0x592a2f[_0x6cba('0x19')]);return RpcUser[_0x6cba('0x26')](this[_0x6cba('0x7')][_0x592a2f['interface']],'Auto-Pause',_0x592a2f[_0x6cba('0x2c')]);}}}catch(_0x3e5d07){logger[_0x6cba('0x31')](_0x6cba('0x58'),_0x3e5d07[_0x6cba('0x38')]);}};module[_0x6cba('0x59')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 926309a..5da8a6a 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 _0x587a=['Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionDeviceStateList','actionQueueSummary','catch','log','asterisk-manager','moment','lodash','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect'];(function(_0x31c077,_0x5d69f6){var _0x20fecd=function(_0x3c8d7e){while(--_0x3c8d7e){_0x31c077['push'](_0x31c077['shift']());}};_0x20fecd(++_0x5d69f6);}(_0x587a,0x190));var _0xa587=function(_0x2fc1f6,_0x51543e){_0x2fc1f6=_0x2fc1f6-0x0;var _0x7a3346=_0x587a[_0x2fc1f6];return _0x7a3346;};'use strict';var Manager=require(_0xa587('0x0'));var BPromise=require('bluebird');var moment=require(_0xa587('0x1'));var util=require('util');var _=require(_0xa587('0x2'));var logger=require(_0xa587('0x3'))(_0xa587('0x4'));var config=require(_0xa587('0x5'));var ami=new Manager(config[_0xa587('0x6')][_0xa587('0x7')],config[_0xa587('0x6')]['ip'],config[_0xa587('0x6')][_0xa587('0x8')],config[_0xa587('0x6')][_0xa587('0x9')],!![]);ami[_0xa587('0xa')]();ami[_0xa587('0xb')]=BPromise[_0xa587('0xc')](ami[_0xa587('0xd')]);function error(_0x2f9e81){logger[_0xa587('0xe')](util[_0xa587('0xf')](_0xa587('0x10'),config[_0xa587('0x6')]['username'],config[_0xa587('0x6')]['ip'],config[_0xa587('0x6')]['port'],util[_0xa587('0x11')](_0x2f9e81,![],null)));}function close(){logger[_0xa587('0xe')](util[_0xa587('0xf')](_0xa587('0x12'),config[_0xa587('0x6')][_0xa587('0x8')],config[_0xa587('0x6')]['ip'],config['asterisk']['port']));}ami[_0xa587('0x13')]=function(){return function(){return ami[_0xa587('0xb')]({'action':_0xa587('0x14')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xa587('0xb')]({'action':_0xa587('0x15')});};};ami[_0xa587('0x16')]=function(){return function(){return ami[_0xa587('0xb')]({'action':_0xa587('0x17')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xa587('0xb')]({'action':'queuesummary'});};};ami[_0xa587('0x18')]=function(){return function(){return ami[_0xa587('0xb')]({'action':_0xa587('0x19')});};};function connect(_0x45cab8){logger[_0xa587('0x1a')](util['format'](_0xa587('0x1b'),config[_0xa587('0x6')][_0xa587('0x8')],config[_0xa587('0x6')]['ip'],config[_0xa587('0x6')][_0xa587('0x7')]));ami[_0xa587('0x1c')](_0xa587('0xe'),error);ami[_0xa587('0x1c')](_0xa587('0x1d'),close);}ami['on']('connect',connect);ami['on'](_0xa587('0x1e'),function(_0x2240ec){logger['info'](util[_0xa587('0xf')](_0xa587('0x1f'),config['asterisk'][_0xa587('0x8')],config[_0xa587('0x6')]['ip'],config['asterisk']['port'],util[_0xa587('0x11')](_0x2240ec,![],null)));});ami['on']('fullybooted',function(_0x19c495){logger[_0xa587('0x1a')](util[_0xa587('0xf')](_0xa587('0x20'),config[_0xa587('0x6')][_0xa587('0x8')],config[_0xa587('0x6')]['ip'],config[_0xa587('0x6')][_0xa587('0x7')]));return BPromise['resolve']()[_0xa587('0x21')](ami[_0xa587('0x13')]())[_0xa587('0x21')](ami[_0xa587('0x22')]())[_0xa587('0x21')](ami[_0xa587('0x16')]())[_0xa587('0x21')](ami[_0xa587('0x23')]())[_0xa587('0x21')](ami[_0xa587('0x18')]())[_0xa587('0x24')](function(_0x2ac485){console[_0xa587('0x25')](_0x2ac485);});});ami['once'](_0xa587('0xe'),error);ami[_0xa587('0x1c')]('close',close);module['exports']=ami; \ No newline at end of file +var _0x60f6=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','log','exports','bluebird','moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','username','keepConnected','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','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0x60f6,0x152));var _0x660f=function(_0x312bfa,_0x4b89b9){_0x312bfa=_0x312bfa-0x0;var _0xbc1425=_0x60f6[_0x312bfa];return _0xbc1425;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x660f('0x0'));var moment=require(_0x660f('0x1'));var util=require(_0x660f('0x2'));var _=require(_0x660f('0x3'));var logger=require(_0x660f('0x4'))(_0x660f('0x5'));var config=require(_0x660f('0x6'));var ami=new Manager(config[_0x660f('0x7')][_0x660f('0x8')],config[_0x660f('0x7')]['ip'],config[_0x660f('0x7')][_0x660f('0x9')],config['asterisk']['password'],!![]);ami[_0x660f('0xa')]();ami[_0x660f('0xb')]=BPromise[_0x660f('0xc')](ami[_0x660f('0xd')]);function error(_0x4cd6e8){logger[_0x660f('0xe')](util[_0x660f('0xf')](_0x660f('0x10'),config[_0x660f('0x7')]['username'],config[_0x660f('0x7')]['ip'],config[_0x660f('0x7')][_0x660f('0x8')],util['inspect'](_0x4cd6e8,![],null)));}function close(){logger['error'](util[_0x660f('0xf')](_0x660f('0x11'),config[_0x660f('0x7')]['username'],config[_0x660f('0x7')]['ip'],config[_0x660f('0x7')][_0x660f('0x8')]));}ami[_0x660f('0x12')]=function(){return function(){return ami[_0x660f('0xb')]({'action':'sipshowregistry'});};};ami[_0x660f('0x13')]=function(){return function(){return ami[_0x660f('0xb')]({'action':'devicestatelist'});};};ami[_0x660f('0x14')]=function(){return function(){return ami[_0x660f('0xb')]({'action':_0x660f('0x15')});};};ami[_0x660f('0x16')]=function(){return function(){return ami[_0x660f('0xb')]({'action':_0x660f('0x17')});};};ami[_0x660f('0x18')]=function(){return function(){return ami['Action']({'action':_0x660f('0x19')});};};function connect(_0x1417f4){logger[_0x660f('0x1a')](util[_0x660f('0xf')](_0x660f('0x1b'),config[_0x660f('0x7')][_0x660f('0x9')],config[_0x660f('0x7')]['ip'],config['asterisk'][_0x660f('0x8')]));ami[_0x660f('0x1c')](_0x660f('0xe'),error);ami['once'](_0x660f('0x1d'),close);}ami['on'](_0x660f('0x1e'),connect);ami['on'](_0x660f('0x1f'),function(_0xbb4b37){logger[_0x660f('0x1a')](util[_0x660f('0xf')](_0x660f('0x20'),config['asterisk'][_0x660f('0x9')],config[_0x660f('0x7')]['ip'],config[_0x660f('0x7')][_0x660f('0x8')],util[_0x660f('0x21')](_0xbb4b37,![],null)));});ami['on'](_0x660f('0x22'),function(_0x331b7d){logger[_0x660f('0x1a')](util[_0x660f('0xf')](_0x660f('0x23'),config[_0x660f('0x7')][_0x660f('0x9')],config[_0x660f('0x7')]['ip'],config[_0x660f('0x7')][_0x660f('0x8')]));return BPromise[_0x660f('0x24')]()[_0x660f('0x25')](ami[_0x660f('0x12')]())['then'](ami[_0x660f('0x13')]())[_0x660f('0x25')](ami[_0x660f('0x14')]())[_0x660f('0x25')](ami[_0x660f('0x16')]())[_0x660f('0x25')](ami[_0x660f('0x18')]())['catch'](function(_0xb8edeb){console[_0x660f('0x26')](_0xb8edeb);});});ami[_0x660f('0x1c')](_0x660f('0xe'),error);ami[_0x660f('0x1c')](_0x660f('0x1d'),close);module[_0x660f('0x27')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 7256921..843ccae 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x36940e,_0x11f338){var _0x3283f2=function(_0x418008){while(--_0x418008){_0x36940e['push'](_0x36940e['shift']());}};_0x3283f2(++_0x11f338);}(_0xb7e7,0x121));var _0x7b7e=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xb7e7[_0x17928f];return _0x500b63;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x292c8f,_0xe1d2b6){var _0x45fe91=function(_0x70ac7d){while(--_0x70ac7d){_0x292c8f['push'](_0x292c8f['shift']());}};_0x45fe91(++_0xe1d2b6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 6fd2e36..5c128b7 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a00=['CampaignId','ContactFirstName','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','exports','util','moment','string','isNil','voiceQueue','uniqueid','Contact','phone','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x43981b,_0x6db766){var _0x143b46=function(_0x3bbff6){while(--_0x3bbff6){_0x43981b['push'](_0x43981b['shift']());}};_0x143b46(++_0x6db766);}(_0x2a00,0x143));var _0x02a0=function(_0x51ce5f,_0x484b41){_0x51ce5f=_0x51ce5f-0x0;var _0x4cb4d5=_0x2a00[_0x51ce5f];return _0x4cb4d5;};'use strict';var util=require(_0x02a0('0x0'));var _=require('lodash');var moment=require(_0x02a0('0x1'));function checkNameSurname(_0x1fce82,_0x532f07,_0x5aaf68){var _0x50d7a5='';if(!_['isNil'](_0x532f07)&&_0x02a0('0x2')===typeof _0x532f07){_0x50d7a5+=_0x532f07;}if(!_[_0x02a0('0x3')](_0x5aaf68)&&_0x02a0('0x2')===typeof _0x5aaf68){_0x50d7a5+='\x20'+_0x5aaf68;}if(_0x50d7a5!==''){return _0x50d7a5;}return _0x1fce82;}function Action(_0x21558f,_0x19167c,_0x34bdf2){this[_0x02a0('0x4')]=_0x21558f;this[_0x02a0('0x5')]=_0x34bdf2||undefined;this['name']=checkNameSurname(_0x19167c[_0x02a0('0x6')][_0x02a0('0x7')],_0x19167c[_0x02a0('0x6')][_0x02a0('0x8')],_0x19167c[_0x02a0('0x6')][_0x02a0('0x9')]);this[_0x02a0('0xa')]=_0x19167c[_0x02a0('0x6')][_0x02a0('0x7')];this[_0x02a0('0xb')]=_0x21558f[_0x02a0('0xc')];this[_0x02a0('0xd')]=_0x19167c[_0x02a0('0xd')]||![];this[_0x02a0('0xe')]=_0x21558f[_0x02a0('0xe')];this[_0x02a0('0xf')]=_0x21558f[_0x02a0('0xf')]||0x3;this[_0x02a0('0x10')]=_0x19167c['scheduledat'];this[_0x02a0('0x11')]=_0x19167c['countbusyretry'];this[_0x02a0('0x12')]=_0x19167c[_0x02a0('0x12')];this[_0x02a0('0x13')]=_0x19167c[_0x02a0('0x13')];this[_0x02a0('0x14')]=_0x19167c[_0x02a0('0x14')];this[_0x02a0('0x15')]=_0x19167c[_0x02a0('0x15')];this[_0x02a0('0x16')]=_0x19167c['countabandonedretry'];this[_0x02a0('0x17')]=_0x19167c['countmachineretry'];this[_0x02a0('0x18')]=_0x19167c[_0x02a0('0x18')];this[_0x02a0('0x19')]=_0x19167c['ContactId'];this[_0x02a0('0x1a')]=_0x19167c[_0x02a0('0x1a')];this[_0x02a0('0x1b')]=_0x19167c[_0x02a0('0x1b')];this[_0x02a0('0x1c')]=_0x19167c[_0x02a0('0x1c')];this[_0x02a0('0x1d')]=_0x19167c[_0x02a0('0x1d')];this['idHopper']=_0x19167c['id'];this[_0x02a0('0x1e')]=_0x19167c[_0x02a0('0x6')][_0x02a0('0x8')]||'';this[_0x02a0('0x1f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x02a0('0x20')]=_0x19167c[_0x02a0('0x20')];this[_0x02a0('0x21')]=_0x19167c[_0x02a0('0x21')];this[_0x02a0('0x22')]=_0x19167c[_0x02a0('0x22')];this[_0x02a0('0x23')]=_0x19167c[_0x02a0('0x23')];this['originatecalleridnum']='';this[_0x02a0('0x24')]='';}Action[_0x02a0('0x25')][_0x02a0('0x26')]=function(){return util[_0x02a0('0x27')](_0x02a0('0x28'),this['name'],this['voiceQueue'][_0x02a0('0x29')]>0x0?this['number']['substring'](this['voiceQueue'][_0x02a0('0x29')]):this[_0x02a0('0xa')]);};Action['prototype'][_0x02a0('0x2a')]=function(){return this['queue'];};module[_0x02a0('0x2b')]=Action; \ No newline at end of file +var _0x0311=['starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','string','voiceQueue','name','Contact','phone','firstName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName'];(function(_0x2bf8c0,_0x156bc9){var _0x4eeb1=function(_0x27451a){while(--_0x27451a){_0x2bf8c0['push'](_0x2bf8c0['shift']());}};_0x4eeb1(++_0x156bc9);}(_0x0311,0xbc));var _0x1031=function(_0xca8433,_0x314a30){_0xca8433=_0xca8433-0x0;var _0x186312=_0x0311[_0xca8433];return _0x186312;};'use strict';var util=require(_0x1031('0x0'));var _=require(_0x1031('0x1'));var moment=require('moment');function checkNameSurname(_0x1a1b4e,_0x29491a,_0x516dae){var _0x4fbae1='';if(!_['isNil'](_0x29491a)&&_0x1031('0x2')===typeof _0x29491a){_0x4fbae1+=_0x29491a;}if(!_['isNil'](_0x516dae)&&_0x1031('0x2')===typeof _0x516dae){_0x4fbae1+='\x20'+_0x516dae;}if(_0x4fbae1!==''){return _0x4fbae1;}return _0x1a1b4e;}function Action(_0x1bcc0a,_0x16fcbf,_0x58a17e){this[_0x1031('0x3')]=_0x1bcc0a;this['uniqueid']=_0x58a17e||undefined;this[_0x1031('0x4')]=checkNameSurname(_0x16fcbf[_0x1031('0x5')][_0x1031('0x6')],_0x16fcbf[_0x1031('0x5')][_0x1031('0x7')],_0x16fcbf[_0x1031('0x5')]['lastName']);this[_0x1031('0x8')]=_0x16fcbf['Contact'][_0x1031('0x6')];this['queue']=_0x1bcc0a['name'];this[_0x1031('0x9')]=_0x16fcbf[_0x1031('0x9')]||![];this['type']=_0x1bcc0a[_0x1031('0xa')];this[_0x1031('0xb')]=_0x1bcc0a[_0x1031('0xb')]||0x3;this[_0x1031('0xc')]=_0x16fcbf[_0x1031('0xc')];this['countbusyretry']=_0x16fcbf[_0x1031('0xd')];this[_0x1031('0xe')]=_0x16fcbf['countcongestionretry'];this[_0x1031('0xf')]=_0x16fcbf['countnoanswerretry'];this[_0x1031('0x10')]=_0x16fcbf[_0x1031('0x10')];this['countdropretry']=_0x16fcbf[_0x1031('0x11')];this['countabandonedretry']=_0x16fcbf[_0x1031('0x12')];this['countmachineretry']=_0x16fcbf[_0x1031('0x13')];this['countagentrejectretry']=_0x16fcbf['countagentrejectretry'];this['ContactId']=_0x16fcbf[_0x1031('0x14')];this[_0x1031('0x15')]=_0x16fcbf[_0x1031('0x15')];this['UserId']=_0x16fcbf[_0x1031('0x16')];this[_0x1031('0x17')]=_0x16fcbf[_0x1031('0x17')];this['CampaignId']=_0x16fcbf[_0x1031('0x18')];this[_0x1031('0x19')]=_0x16fcbf['id'];this[_0x1031('0x1a')]=_0x16fcbf[_0x1031('0x5')][_0x1031('0x7')]||'';this[_0x1031('0x1b')]=moment()[_0x1031('0x1c')](_0x1031('0x1d'));this[_0x1031('0x1e')]=_0x16fcbf[_0x1031('0x1e')];this[_0x1031('0x1f')]=_0x16fcbf[_0x1031('0x1f')];this[_0x1031('0x20')]=_0x16fcbf[_0x1031('0x20')];this[_0x1031('0x21')]=_0x16fcbf['recallme'];this[_0x1031('0x22')]='';this[_0x1031('0x23')]='';}Action[_0x1031('0x24')][_0x1031('0x25')]=function(){return util['format'](_0x1031('0x26'),this[_0x1031('0x4')],this[_0x1031('0x3')][_0x1031('0x27')]>0x0?this['number'][_0x1031('0x28')](this[_0x1031('0x3')][_0x1031('0x27')]):this[_0x1031('0x8')]);};Action['prototype'][_0x1031('0x29')]=function(){return this['queue'];};module[_0x1031('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index a43b1d9..f89d5aa 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x846d=['countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','answertime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','milliseconds','diff','seconds','state','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0xddccb1,_0x468b7a){var _0x44ad80=function(_0x38ac38){while(--_0x38ac38){_0xddccb1['push'](_0xddccb1['shift']());}};_0x44ad80(++_0x468b7a);}(_0x846d,0x1e4));var _0xd846=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0x846d[_0x1afabf];return _0x497ff1;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x346394,_0x263188){var _0x28ecd0=moment(_0x346394)[_0xd846('0x0')](0x0);var _0x35253d=moment(_0x263188)['milliseconds'](0x0);return _0x28ecd0[_0xd846('0x1')](_0x35253d,_0xd846('0x2'));}function AgentComplete(_0x143622,_0x217956){this[_0xd846('0x3')]=0x4;this['statedesc']='Answer';this[_0xd846('0x4')]=_0x143622[_0xd846('0x4')];this[_0xd846('0x5')]=_0x143622[_0xd846('0x5')];this[_0xd846('0x6')]=_0x143622[_0xd846('0x5')]===_0xd846('0x7')?_0xd846('0x8'):_0x143622['type'];this['countbusyretry']=_0x143622[_0xd846('0x9')];this[_0xd846('0xa')]=_0x143622[_0xd846('0xa')];this[_0xd846('0xb')]=_0x143622[_0xd846('0xb')];this[_0xd846('0xc')]=_0x143622['countbusyretry']+_0x143622[_0xd846('0xa')]+_0x143622['countnoanswerretry']+_0x143622['countnosuchnumberretry']+_0x143622['countdropretry']+_0x143622[_0xd846('0xd')]+_0x143622['countmachineretry']+_0x143622[_0xd846('0xe')];this[_0xd846('0xf')]=_0x143622['countnosuchnumberretry'];this[_0xd846('0x10')]=_0x143622['countdropretry'];this[_0xd846('0xd')]=_0x143622['countabandonedretry'];this[_0xd846('0x11')]=_0x143622[_0xd846('0x11')];this['countagentrejectretry']=_0x143622[_0xd846('0xe')];this[_0xd846('0x12')]=_0x217956[_0xd846('0x12')];this[_0xd846('0x13')]=_0x143622['name'];this[_0xd846('0x14')]=_0x143622[_0xd846('0x15')];this[_0xd846('0x16')]=_0x143622['starttime'];this[_0xd846('0x17')]=_0x143622[_0xd846('0x17')];this['answertime']=_0x143622['answertime'];this[_0xd846('0x18')]=moment()[_0xd846('0x19')](_0xd846('0x1a'));this[_0xd846('0x1b')]=getSeconds(_0x143622[_0xd846('0x17')],_0x143622[_0xd846('0x16')]);this[_0xd846('0x1c')]=getSeconds(_0x143622[_0xd846('0x1d')],_0x143622['responsetime']);this[_0xd846('0x1e')]=getSeconds(this[_0xd846('0x18')],_0x143622[_0xd846('0x1d')]);this[_0xd846('0x8')]=_0x217956[_0xd846('0x8')];this['membername']=_0x217956[_0xd846('0x1f')];this[_0xd846('0x20')]=_0x217956[_0xd846('0x20')];this[_0xd846('0x21')]=_0x143622['callback'];this[_0xd846('0x22')]=_0x143622['callbackuniqueid'];this[_0xd846('0x23')]=_0x143622[_0xd846('0x23')];this[_0xd846('0x24')]=_0x143622[_0xd846('0x24')];this[_0xd846('0x25')]=_0x143622[_0xd846('0x25')];this['ListId']=_0x143622[_0xd846('0x26')];this[_0xd846('0x27')]=_0x143622[_0xd846('0x27')];this[_0xd846('0x28')]=_0x143622[_0xd846('0x28')];this['CampaignId']=_0x143622[_0xd846('0x29')];this[_0xd846('0x2a')]=_0x143622[_0xd846('0x2a')]||'';this[_0xd846('0x2b')]=_0x143622[_0xd846('0x2b')]||'';}module[_0xd846('0x2c')]=AgentComplete; \ No newline at end of file +var _0x428e=['membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x428e,0x164));var _0xe428=function(_0x565fed,_0xb85768){_0x565fed=_0x565fed-0x0;var _0x3e018f=_0x428e[_0x565fed];return _0x3e018f;};'use strict';var util=require(_0xe428('0x0'));var _=require(_0xe428('0x1'));var moment=require(_0xe428('0x2'));function getSeconds(_0x5a3bb6,_0x516c84){var _0x32666d=moment(_0x5a3bb6)['milliseconds'](0x0);var _0x56b7a0=moment(_0x516c84)[_0xe428('0x3')](0x0);return _0x32666d[_0xe428('0x4')](_0x56b7a0,_0xe428('0x5'));}function AgentComplete(_0x196c24,_0x5e1edb){this[_0xe428('0x6')]=0x4;this[_0xe428('0x7')]='Answer';this['scheduledat']=_0x196c24[_0xe428('0x8')];this[_0xe428('0x9')]=_0x196c24['type'];this[_0xe428('0xa')]=_0x196c24[_0xe428('0x9')]==='outbound'?'queue':_0x196c24['type'];this[_0xe428('0xb')]=_0x196c24[_0xe428('0xb')];this['countcongestionretry']=_0x196c24[_0xe428('0xc')];this['countnoanswerretry']=_0x196c24['countnoanswerretry'];this[_0xe428('0xd')]=_0x196c24[_0xe428('0xb')]+_0x196c24[_0xe428('0xc')]+_0x196c24['countnoanswerretry']+_0x196c24[_0xe428('0xe')]+_0x196c24[_0xe428('0xf')]+_0x196c24['countabandonedretry']+_0x196c24[_0xe428('0x10')]+_0x196c24[_0xe428('0x11')];this[_0xe428('0xe')]=_0x196c24['countnosuchnumberretry'];this['countdropretry']=_0x196c24[_0xe428('0xf')];this[_0xe428('0x12')]=_0x196c24[_0xe428('0x12')];this['countmachineretry']=_0x196c24['countmachineretry'];this[_0xe428('0x11')]=_0x196c24[_0xe428('0x11')];this[_0xe428('0x13')]=_0x5e1edb[_0xe428('0x13')];this['calleridname']=_0x196c24[_0xe428('0x14')];this[_0xe428('0x15')]=_0x196c24[_0xe428('0x16')];this[_0xe428('0x17')]=_0x196c24[_0xe428('0x17')];this['responsetime']=_0x196c24[_0xe428('0x18')];this[_0xe428('0x19')]=_0x196c24[_0xe428('0x19')];this[_0xe428('0x1a')]=moment()['format'](_0xe428('0x1b'));this[_0xe428('0x1c')]=getSeconds(_0x196c24[_0xe428('0x18')],_0x196c24[_0xe428('0x17')]);this['holdtime']=getSeconds(_0x196c24[_0xe428('0x19')],_0x196c24[_0xe428('0x18')]);this[_0xe428('0x1d')]=getSeconds(this['endtime'],_0x196c24['answertime']);this[_0xe428('0x1e')]=_0x5e1edb[_0xe428('0x1e')];this[_0xe428('0x1f')]=_0x5e1edb[_0xe428('0x1f')];this[_0xe428('0x20')]=_0x5e1edb[_0xe428('0x20')];this['callback']=_0x196c24[_0xe428('0x21')];this[_0xe428('0x22')]=_0x196c24[_0xe428('0x22')];this[_0xe428('0x23')]=_0x196c24[_0xe428('0x23')];this[_0xe428('0x24')]=_0x196c24[_0xe428('0x24')];this[_0xe428('0x25')]=_0x196c24[_0xe428('0x25')];this[_0xe428('0x26')]=_0x196c24[_0xe428('0x26')];this[_0xe428('0x27')]=_0x196c24[_0xe428('0x27')];this['VoiceQueueId']=_0x196c24['VoiceQueueId'];this[_0xe428('0x28')]=_0x196c24['CampaignId'];this[_0xe428('0x29')]=_0x196c24[_0xe428('0x29')]||'';this['originatecalleridname']=_0x196c24[_0xe428('0x2a')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 6c7ee61..680714d 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9009=['countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound'];(function(_0x56f274,_0x5c8379){var _0x10ddda=function(_0x44f1ab){while(--_0x44f1ab){_0x56f274['push'](_0x56f274['shift']());}};_0x10ddda(++_0x5c8379);}(_0x9009,0x1d4));var _0x9900=function(_0x50ebf5,_0x18b102){_0x50ebf5=_0x50ebf5-0x0;var _0x26986e=_0x9009[_0x50ebf5];return _0x26986e;};'use strict';var util=require(_0x9900('0x0'));var _=require('lodash');var moment=require(_0x9900('0x1'));function getSeconds(_0x2770ea,_0x5d0a60){var _0x12d637=moment(_0x2770ea)[_0x9900('0x2')](0x0);var _0x1f7ed9=moment(_0x5d0a60)[_0x9900('0x2')](0x0);return _0x12d637['diff'](_0x1f7ed9,_0x9900('0x3'));}function Final(_0x273e50){this['uniqueid']=_0x273e50['uniqueid'];this[_0x9900('0x4')]=_0x273e50[_0x9900('0x4')];this['type']=_0x273e50[_0x9900('0x5')];this[_0x9900('0x6')]=_0x273e50[_0x9900('0x5')]===_0x9900('0x7')?'queue':_0x273e50[_0x9900('0x5')];this[_0x9900('0x8')]=_0x273e50[_0x9900('0x8')];this[_0x9900('0x9')]=_0x273e50[_0x9900('0x9')];this['countnoanswerretry']=_0x273e50['countnoanswerretry'];this[_0x9900('0xa')]=_0x273e50[_0x9900('0x8')]+_0x273e50['countcongestionretry']+_0x273e50['countnoanswerretry']+_0x273e50[_0x9900('0xb')]+_0x273e50['countdropretry']+_0x273e50[_0x9900('0xc')]+_0x273e50[_0x9900('0xd')]+_0x273e50[_0x9900('0xe')];this[_0x9900('0xb')]=_0x273e50[_0x9900('0xb')];this[_0x9900('0xf')]=_0x273e50[_0x9900('0xf')];this[_0x9900('0xc')]=_0x273e50[_0x9900('0xc')];this[_0x9900('0xd')]=_0x273e50[_0x9900('0xd')];this[_0x9900('0xe')]=_0x273e50[_0x9900('0xe')];this[_0x9900('0x10')]=_0x273e50[_0x9900('0x10')];this[_0x9900('0x11')]=_0x273e50[_0x9900('0x11')];this['calleridnum']=_0x273e50['calleridnum'];this[_0x9900('0x12')]=_0x273e50[_0x9900('0x12')];this[_0x9900('0x13')]=_0x273e50[_0x9900('0x13')];this['endtime']=_0x273e50[_0x9900('0x13')];this['ringtime']=_0x273e50['ringtime']||0x0;this[_0x9900('0x14')]=_0x273e50['holdtime']||0x0;this[_0x9900('0x15')]=_0x273e50['talktime']||0x0;this['callback']=_0x273e50[_0x9900('0x16')];this[_0x9900('0x17')]=_0x273e50[_0x9900('0x17')];this[_0x9900('0x18')]=_0x273e50['callbackat'];this[_0x9900('0x19')]=_0x273e50[_0x9900('0x19')];this[_0x9900('0x1a')]=_0x273e50[_0x9900('0x1a')];this[_0x9900('0x1b')]=_0x273e50['ListId'];this[_0x9900('0x1c')]=_0x273e50[_0x9900('0x1c')];this['VoiceQueueId']=_0x273e50[_0x9900('0x1d')];this[_0x9900('0x1e')]=_0x273e50['CampaignId'];this['originatecalleridnum']=_0x273e50[_0x9900('0x1f')]||'';this[_0x9900('0x20')]=_0x273e50['originatecalleridname']||'';}module[_0x9900('0x21')]=Final; \ No newline at end of file +var _0x0bde=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x4bb5a1,_0x5bf265){var _0x2b58dc=function(_0x136ed4){while(--_0x136ed4){_0x4bb5a1['push'](_0x4bb5a1['shift']());}};_0x2b58dc(++_0x5bf265);}(_0x0bde,0x110));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0xe0bd('0x0'));var _=require('lodash');var moment=require(_0xe0bd('0x1'));function getSeconds(_0xab624e,_0x5644f8){var _0x28d5d7=moment(_0xab624e)[_0xe0bd('0x2')](0x0);var _0x2294a7=moment(_0x5644f8)['milliseconds'](0x0);return _0x28d5d7[_0xe0bd('0x3')](_0x2294a7,_0xe0bd('0x4'));}function Final(_0x17608f){this[_0xe0bd('0x5')]=_0x17608f[_0xe0bd('0x5')];this[_0xe0bd('0x6')]=_0x17608f[_0xe0bd('0x6')];this[_0xe0bd('0x7')]=_0x17608f[_0xe0bd('0x7')];this[_0xe0bd('0x8')]=_0x17608f[_0xe0bd('0x7')]===_0xe0bd('0x9')?_0xe0bd('0xa'):_0x17608f['type'];this[_0xe0bd('0xb')]=_0x17608f[_0xe0bd('0xb')];this['countcongestionretry']=_0x17608f[_0xe0bd('0xc')];this['countnoanswerretry']=_0x17608f[_0xe0bd('0xd')];this[_0xe0bd('0xe')]=_0x17608f[_0xe0bd('0xb')]+_0x17608f[_0xe0bd('0xc')]+_0x17608f[_0xe0bd('0xd')]+_0x17608f[_0xe0bd('0xf')]+_0x17608f[_0xe0bd('0x10')]+_0x17608f['countabandonedretry']+_0x17608f[_0xe0bd('0x11')]+_0x17608f[_0xe0bd('0x12')];this[_0xe0bd('0xf')]=_0x17608f['countnosuchnumberretry'];this[_0xe0bd('0x10')]=_0x17608f['countdropretry'];this[_0xe0bd('0x13')]=_0x17608f[_0xe0bd('0x13')];this[_0xe0bd('0x11')]=_0x17608f[_0xe0bd('0x11')];this[_0xe0bd('0x12')]=_0x17608f[_0xe0bd('0x12')];this[_0xe0bd('0xa')]=_0x17608f[_0xe0bd('0xa')];this['calleridname']=_0x17608f['calleridname'];this[_0xe0bd('0x14')]=_0x17608f[_0xe0bd('0x14')];this[_0xe0bd('0x15')]=_0x17608f[_0xe0bd('0x15')];this[_0xe0bd('0x16')]=_0x17608f[_0xe0bd('0x16')];this['endtime']=_0x17608f['responsetime'];this[_0xe0bd('0x17')]=_0x17608f[_0xe0bd('0x17')]||0x0;this[_0xe0bd('0x18')]=_0x17608f[_0xe0bd('0x18')]||0x0;this[_0xe0bd('0x19')]=_0x17608f[_0xe0bd('0x19')]||0x0;this[_0xe0bd('0x1a')]=_0x17608f['callback'];this['callbackuniqueid']=_0x17608f[_0xe0bd('0x1b')];this[_0xe0bd('0x1c')]=_0x17608f[_0xe0bd('0x1c')];this[_0xe0bd('0x1d')]=_0x17608f[_0xe0bd('0x1d')];this['ContactId']=_0x17608f[_0xe0bd('0x1e')];this['ListId']=_0x17608f[_0xe0bd('0x1f')];this[_0xe0bd('0x20')]=_0x17608f[_0xe0bd('0x20')];this['VoiceQueueId']=_0x17608f[_0xe0bd('0x21')];this[_0xe0bd('0x22')]=_0x17608f['CampaignId'];this[_0xe0bd('0x23')]=_0x17608f['originatecalleridnum']||'';this[_0xe0bd('0x24')]=_0x17608f['originatecalleridname']||'';}module[_0xe0bd('0x25')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index dad1d7f..4cff801 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27fa=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','holdtime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','seconds','statedesc','Answer','scheduledat','type','outbound','queue'];(function(_0x34c201,_0x3439f6){var _0x3e3d98=function(_0x2156b1){while(--_0x2156b1){_0x34c201['push'](_0x34c201['shift']());}};_0x3e3d98(++_0x3439f6);}(_0x27fa,0xc2));var _0xa27f=function(_0x260e06,_0xf5d231){_0x260e06=_0x260e06-0x0;var _0x65e2aa=_0x27fa[_0x260e06];return _0x65e2aa;};'use strict';var util=require(_0xa27f('0x0'));var _=require(_0xa27f('0x1'));var moment=require(_0xa27f('0x2'));function getSeconds(_0x4c067f,_0x5716bd){var _0x4398b3=moment(_0x4c067f)[_0xa27f('0x3')](0x0);var _0x49eb71=moment(_0x5716bd)[_0xa27f('0x3')](0x0);return _0x4398b3['diff'](_0x49eb71,_0xa27f('0x4'));}function Hangup(_0x10e73a,_0x5919c3){this['state']=0x4;this[_0xa27f('0x5')]=_0xa27f('0x6');this[_0xa27f('0x7')]=_0x10e73a['scheduledat'];this[_0xa27f('0x8')]=_0x10e73a[_0xa27f('0x8')];this['campaigntype']=_0x10e73a['type']===_0xa27f('0x9')?_0xa27f('0xa'):_0x10e73a['type'];this['countbusyretry']=_0x10e73a[_0xa27f('0xb')];this[_0xa27f('0xc')]=_0x10e73a[_0xa27f('0xc')];this[_0xa27f('0xd')]=_0x10e73a['countnoanswerretry'];this[_0xa27f('0xe')]=_0x10e73a[_0xa27f('0xb')]+_0x10e73a['countcongestionretry']+_0x10e73a[_0xa27f('0xd')]+_0x10e73a[_0xa27f('0xf')]+_0x10e73a['countdropretry']+_0x10e73a[_0xa27f('0x10')]+_0x10e73a[_0xa27f('0x11')]+_0x10e73a[_0xa27f('0x12')];this['countnosuchnumberretry']=_0x10e73a[_0xa27f('0xf')];this[_0xa27f('0x13')]=_0x10e73a[_0xa27f('0x13')];this[_0xa27f('0x10')]=_0x10e73a[_0xa27f('0x10')];this[_0xa27f('0x11')]=_0x10e73a['countmachineretry'];this[_0xa27f('0x12')]=_0x10e73a[_0xa27f('0x12')];this[_0xa27f('0x14')]=_0x5919c3[_0xa27f('0x14')];this[_0xa27f('0x15')]=_0x10e73a['name'];this[_0xa27f('0x16')]=_0x10e73a[_0xa27f('0x17')];this[_0xa27f('0x18')]=_0x10e73a['starttime'];this[_0xa27f('0x19')]=_0x10e73a[_0xa27f('0x19')];this[_0xa27f('0x1a')]=moment()['format'](_0xa27f('0x1b'));this['ringtime']=getSeconds(_0x10e73a['responsetime'],_0x10e73a[_0xa27f('0x18')]);this[_0xa27f('0x1c')]=0x0;this['talktime']=getSeconds(this[_0xa27f('0x1a')],_0x10e73a[_0xa27f('0x19')]);this[_0xa27f('0xa')]=_0x10e73a['queue'];this['membername']=_0xa27f('0x1d');this[_0xa27f('0x1e')]=_0x5919c3[_0xa27f('0x1f')];this[_0xa27f('0x20')]=_0x10e73a[_0xa27f('0x20')];this[_0xa27f('0x21')]=_0x10e73a[_0xa27f('0x21')];this[_0xa27f('0x22')]=_0x10e73a['callbackat'];this[_0xa27f('0x23')]=_0x10e73a[_0xa27f('0x23')];this['ContactId']=_0x10e73a[_0xa27f('0x24')];this[_0xa27f('0x25')]=_0x10e73a[_0xa27f('0x25')];this[_0xa27f('0x26')]=_0x10e73a[_0xa27f('0x26')];this['VoiceQueueId']=_0x10e73a[_0xa27f('0x27')];this[_0xa27f('0x28')]=_0x10e73a[_0xa27f('0x28')];}module['exports']=Hangup; \ No newline at end of file +var _0x06ec=['cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','state','statedesc','Answer','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','queue','membername','IVR'];(function(_0x537bcd,_0x13bae1){var _0x6cc881=function(_0x3d470f){while(--_0x3d470f){_0x537bcd['push'](_0x537bcd['shift']());}};_0x6cc881(++_0x13bae1);}(_0x06ec,0xb3));var _0xc06e=function(_0xb8bdf9,_0xb5ef9){_0xb8bdf9=_0xb8bdf9-0x0;var _0x1b0324=_0x06ec[_0xb8bdf9];return _0x1b0324;};'use strict';var util=require('util');var _=require(_0xc06e('0x0'));var moment=require(_0xc06e('0x1'));function getSeconds(_0x589337,_0x31dcac){var _0x3a298c=moment(_0x589337)[_0xc06e('0x2')](0x0);var _0x2f600c=moment(_0x31dcac)[_0xc06e('0x2')](0x0);return _0x3a298c['diff'](_0x2f600c,'seconds');}function Hangup(_0x1937bc,_0x4986ed){this[_0xc06e('0x3')]=0x4;this[_0xc06e('0x4')]=_0xc06e('0x5');this[_0xc06e('0x6')]=_0x1937bc[_0xc06e('0x6')];this['type']=_0x1937bc[_0xc06e('0x7')];this[_0xc06e('0x8')]=_0x1937bc[_0xc06e('0x7')]==='outbound'?'queue':_0x1937bc[_0xc06e('0x7')];this[_0xc06e('0x9')]=_0x1937bc['countbusyretry'];this['countcongestionretry']=_0x1937bc[_0xc06e('0xa')];this['countnoanswerretry']=_0x1937bc[_0xc06e('0xb')];this[_0xc06e('0xc')]=_0x1937bc[_0xc06e('0x9')]+_0x1937bc['countcongestionretry']+_0x1937bc[_0xc06e('0xb')]+_0x1937bc[_0xc06e('0xd')]+_0x1937bc[_0xc06e('0xe')]+_0x1937bc[_0xc06e('0xf')]+_0x1937bc[_0xc06e('0x10')]+_0x1937bc['countagentrejectretry'];this[_0xc06e('0xd')]=_0x1937bc[_0xc06e('0xd')];this[_0xc06e('0xe')]=_0x1937bc[_0xc06e('0xe')];this[_0xc06e('0xf')]=_0x1937bc[_0xc06e('0xf')];this['countmachineretry']=_0x1937bc[_0xc06e('0x10')];this[_0xc06e('0x11')]=_0x1937bc[_0xc06e('0x11')];this[_0xc06e('0x12')]=_0x4986ed['uniqueid'];this[_0xc06e('0x13')]=_0x1937bc[_0xc06e('0x14')];this[_0xc06e('0x15')]=_0x1937bc[_0xc06e('0x16')];this['starttime']=_0x1937bc[_0xc06e('0x17')];this[_0xc06e('0x18')]=_0x1937bc[_0xc06e('0x18')];this[_0xc06e('0x19')]=moment()[_0xc06e('0x1a')](_0xc06e('0x1b'));this['ringtime']=getSeconds(_0x1937bc[_0xc06e('0x18')],_0x1937bc[_0xc06e('0x17')]);this['holdtime']=0x0;this['talktime']=getSeconds(this[_0xc06e('0x19')],_0x1937bc['responsetime']);this[_0xc06e('0x1c')]=_0x1937bc[_0xc06e('0x1c')];this[_0xc06e('0x1d')]=_0xc06e('0x1e');this['reason']=_0x4986ed[_0xc06e('0x1f')];this[_0xc06e('0x20')]=_0x1937bc[_0xc06e('0x20')];this[_0xc06e('0x21')]=_0x1937bc['callbackuniqueid'];this[_0xc06e('0x22')]=_0x1937bc[_0xc06e('0x22')];this[_0xc06e('0x23')]=_0x1937bc[_0xc06e('0x23')];this[_0xc06e('0x24')]=_0x1937bc['ContactId'];this[_0xc06e('0x25')]=_0x1937bc[_0xc06e('0x25')];this[_0xc06e('0x26')]=_0x1937bc[_0xc06e('0x26')];this['VoiceQueueId']=_0x1937bc[_0xc06e('0x27')];this['CampaignId']=_0x1937bc[_0xc06e('0x28')];}module[_0xc06e('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 396cfe3..de2b4eb 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x610a=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x19311a,_0x2d2679){var _0x42617c=function(_0x43227d){while(--_0x43227d){_0x19311a['push'](_0x19311a['shift']());}};_0x42617c(++_0x2d2679);}(_0x610a,0x109));var _0xa610=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x610a[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xa610('0x0'));var _=require(_0xa610('0x1'));var moment=require('moment');function getSeconds(_0x1912ce,_0x2e1523){var _0x243454=moment(_0x1912ce)[_0xa610('0x2')](0x0);var _0x131c00=moment(_0x2e1523)[_0xa610('0x2')](0x0);return _0x243454['diff'](_0x131c00,'seconds');}function History(_0xae3c33){this[_0xa610('0x3')]=_0xae3c33[_0xa610('0x3')];this[_0xa610('0x4')]=_0xae3c33[_0xa610('0x4')]||undefined;this[_0xa610('0x5')]=_0xae3c33[_0xa610('0x5')];this[_0xa610('0x6')]=_0xae3c33[_0xa610('0x5')]==='outbound'?_0xa610('0x7'):_0xae3c33['type'];this[_0xa610('0x8')]=_0xae3c33[_0xa610('0x8')];this[_0xa610('0x9')]=_0xae3c33['countcongestionretry'];this[_0xa610('0xa')]=_0xae3c33['countnoanswerretry'];this['countglobal']=_0xae3c33[_0xa610('0x8')]+_0xae3c33[_0xa610('0x9')]+_0xae3c33[_0xa610('0xa')]+_0xae3c33[_0xa610('0xb')]+_0xae3c33[_0xa610('0xc')]+_0xae3c33[_0xa610('0xd')]+_0xae3c33[_0xa610('0xe')]+_0xae3c33[_0xa610('0xf')];this[_0xa610('0xb')]=_0xae3c33[_0xa610('0xb')];this[_0xa610('0xc')]=_0xae3c33[_0xa610('0xc')];this['countabandonedretry']=_0xae3c33[_0xa610('0xd')];this[_0xa610('0xe')]=_0xae3c33[_0xa610('0xe')];this[_0xa610('0xf')]=_0xae3c33[_0xa610('0xf')];this[_0xa610('0x7')]=_0xae3c33[_0xa610('0x7')];this['calleridname']=_0xae3c33[_0xa610('0x10')];this[_0xa610('0x11')]=_0xae3c33[_0xa610('0x12')];this[_0xa610('0x13')]=_0xae3c33[_0xa610('0x13')];this[_0xa610('0x14')]=_0xae3c33['responsetime'];this[_0xa610('0x15')]=_0xae3c33[_0xa610('0x14')];this[_0xa610('0x16')]=getSeconds(_0xae3c33['responsetime'],_0xae3c33[_0xa610('0x13')]);this[_0xa610('0x17')]=0x0;this[_0xa610('0x18')]=0x0;this['callback']=_0xae3c33[_0xa610('0x19')];this[_0xa610('0x1a')]=_0xae3c33[_0xa610('0x1a')];this[_0xa610('0x1b')]=_0xae3c33[_0xa610('0x1b')];this[_0xa610('0x1c')]=_0xae3c33[_0xa610('0x1c')];this[_0xa610('0x1d')]=_0xae3c33[_0xa610('0x1d')];this[_0xa610('0x1e')]=_0xae3c33[_0xa610('0x1e')];this[_0xa610('0x1f')]=_0xae3c33[_0xa610('0x1f')];this['VoiceQueueId']=_0xae3c33[_0xa610('0x20')];this['CampaignId']=_0xae3c33[_0xa610('0x21')];this['originatecalleridnum']=_0xae3c33[_0xa610('0x22')]||'';this[_0xa610('0x23')]=_0xae3c33['originatecalleridname']||'';}module[_0xa610('0x24')]=History; \ No newline at end of file +var _0x6108=['milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname','name','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment'];(function(_0x2ec13e,_0x2ea526){var _0xb48415=function(_0x5566e4){while(--_0x5566e4){_0x2ec13e['push'](_0x2ec13e['shift']());}};_0xb48415(++_0x2ea526);}(_0x6108,0xbd));var _0x8610=function(_0x3809d7,_0x5ef99f){_0x3809d7=_0x3809d7-0x0;var _0x88800e=_0x6108[_0x3809d7];return _0x88800e;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x8610('0x0'));function getSeconds(_0x20498d,_0x45ee54){var _0x299a6a=moment(_0x20498d)[_0x8610('0x1')](0x0);var _0x106817=moment(_0x45ee54)['milliseconds'](0x0);return _0x299a6a[_0x8610('0x2')](_0x106817,_0x8610('0x3'));}function History(_0xcd55a6){this[_0x8610('0x4')]=_0xcd55a6[_0x8610('0x4')];this[_0x8610('0x5')]=_0xcd55a6[_0x8610('0x5')]||undefined;this[_0x8610('0x6')]=_0xcd55a6[_0x8610('0x6')];this[_0x8610('0x7')]=_0xcd55a6[_0x8610('0x6')]===_0x8610('0x8')?_0x8610('0x9'):_0xcd55a6[_0x8610('0x6')];this[_0x8610('0xa')]=_0xcd55a6[_0x8610('0xa')];this['countcongestionretry']=_0xcd55a6['countcongestionretry'];this[_0x8610('0xb')]=_0xcd55a6[_0x8610('0xb')];this[_0x8610('0xc')]=_0xcd55a6[_0x8610('0xa')]+_0xcd55a6['countcongestionretry']+_0xcd55a6['countnoanswerretry']+_0xcd55a6['countnosuchnumberretry']+_0xcd55a6['countdropretry']+_0xcd55a6[_0x8610('0xd')]+_0xcd55a6[_0x8610('0xe')]+_0xcd55a6[_0x8610('0xf')];this[_0x8610('0x10')]=_0xcd55a6[_0x8610('0x10')];this[_0x8610('0x11')]=_0xcd55a6[_0x8610('0x11')];this[_0x8610('0xd')]=_0xcd55a6[_0x8610('0xd')];this['countmachineretry']=_0xcd55a6['countmachineretry'];this['countagentrejectretry']=_0xcd55a6['countagentrejectretry'];this[_0x8610('0x9')]=_0xcd55a6['queue'];this[_0x8610('0x12')]=_0xcd55a6[_0x8610('0x13')];this[_0x8610('0x14')]=_0xcd55a6['number'];this[_0x8610('0x15')]=_0xcd55a6[_0x8610('0x15')];this[_0x8610('0x16')]=_0xcd55a6[_0x8610('0x16')];this[_0x8610('0x17')]=_0xcd55a6[_0x8610('0x16')];this['ringtime']=getSeconds(_0xcd55a6[_0x8610('0x16')],_0xcd55a6['starttime']);this[_0x8610('0x18')]=0x0;this[_0x8610('0x19')]=0x0;this[_0x8610('0x1a')]=_0xcd55a6[_0x8610('0x1a')];this[_0x8610('0x1b')]=_0xcd55a6[_0x8610('0x1b')];this[_0x8610('0x1c')]=_0xcd55a6[_0x8610('0x1c')];this[_0x8610('0x1d')]=_0xcd55a6[_0x8610('0x1d')];this[_0x8610('0x1e')]=_0xcd55a6[_0x8610('0x1e')];this[_0x8610('0x1f')]=_0xcd55a6[_0x8610('0x1f')];this['UserId']=_0xcd55a6[_0x8610('0x20')];this[_0x8610('0x21')]=_0xcd55a6[_0x8610('0x21')];this[_0x8610('0x22')]=_0xcd55a6[_0x8610('0x22')];this[_0x8610('0x23')]=_0xcd55a6['originatecalleridnum']||'';this[_0x8610('0x24')]=_0xcd55a6['originatecalleridname']||'';}module[_0x8610('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index f886ce4..c7e8d30 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 _0x99e9=['dialTimezone','[syncQueueSummary]','checkIsTrunkReachable','dialGlobalInterval','\x5cw{0,','pow','replace','random','match','actionOriginate','Contact','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','outboundOriginateFailureCallsDay','[originate][error]','Error','originate\x20action\x20Error','responsetime','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','object','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','dialCongestionMaxRetry','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','reason','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','dialLimitQueue','ACTIVE','[getContactDialer2]','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','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','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','lodash','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','dialer','booked','../../../config/logger','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','prototype','tail','finally','sequence','preview','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','syncQueueCallerAbandon','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','stringify','diff','type','outbound','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalMultiplicativeFactor','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','md5','voice:queue:%s','campaign:ivr:%s','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','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','milliseconds','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','stack','inspect','length','error','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','state','statedesc','endtime','clearZombieChannels','[uniqueid]','[actions]','undefined','enqueue','isNil','Action','channel','No\x20such\x20channel','voiceQueues','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','loggerHandler','emptyContact','saveInDb','merge','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','active','status','reachable','SIP/%s','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','value','HangupInAMD','membername','AMD','emit','custom:amd','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr]','buildObj','dialGlobalMaxRetry','YYYY-MM-DD\x20HH:mm:ss','ContactId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','Unknow','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','dropreason','TIMEOUT','dialQueueProject2','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','Abandoned','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','paused','stateinterface','locked','push','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','pick','run','idHopper','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','Failure','timezones','TIMEZONE_UNKNOW','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','loggedIn'];(function(_0x31b40c,_0xfb8063){var _0x368041=function(_0xbbd32){while(--_0xbbd32){_0x31b40c['push'](_0x31b40c['shift']());}};_0x368041(++_0xfb8063);}(_0x99e9,0xb4));var _0x999e=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0x99e9[_0x38c632];return _0x12737e;};'use strict';var util=require('util');var _=require(_0x999e('0x0'));var BPromise=require(_0x999e('0x1'));var uuid=require(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x999e('0x4'));var ut=require(_0x999e('0x5'));var config=require(_0x999e('0x6'));var logger=require('../../../config/logger')(_0x999e('0x7'));var loggerBooked=require('../../../config/logger')(_0x999e('0x8'));var loggerPredictive=require(_0x999e('0x9'))(_0x999e('0xa'));var loggerPredictiveCalls=require(_0x999e('0x9'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x999e('0x9'))(_0x999e('0xb'));var ami=require(_0x999e('0xc'));config[_0x999e('0xd')]=_[_0x999e('0xe')](config[_0x999e('0xd')],{'host':_0x999e('0xf'),'port':0x18eb});var io=require(_0x999e('0x10'))(new Redis(config[_0x999e('0xd')]));var cmHopper=require(_0x999e('0x11'));var cmHopperHistory=require(_0x999e('0x12'));var cmHopperBlack=require(_0x999e('0x13'));var voiceQueueRt=require(_0x999e('0x14'));var Action=require(_0x999e('0x15'));var History=require(_0x999e('0x16'));var Final=require(_0x999e('0x17'));var AgentComplete=require(_0x999e('0x18'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x999e('0x19'));var ipAgi=process['env'][_0x999e('0x1a')]||_0x999e('0x1b');var strategy={'rrmemory':_0x999e('0x1c'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x999e('0x1d')]['enqueue']=function(_0xa44e4c){this['tail']=this['tail']?this[_0x999e('0x1e')][_0x999e('0x1f')](_0xa44e4c):_0xa44e4c();};function Dialer(_0x2dd5f4,_0x289e0e){this[_0x999e('0x20')]=new Sequence();this[_0x999e('0x21')]=_0x289e0e;this['voiceQueues']=_0x2dd5f4['voiceQueues'];this['campaigns']=_0x2dd5f4[_0x999e('0x22')];this[_0x999e('0x23')]=_0x2dd5f4[_0x999e('0x23')];this[_0x999e('0x24')]=_0x2dd5f4[_0x999e('0x24')];this[_0x999e('0x25')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x999e('0x26')]={};this[_0x999e('0x27')]={};this[_0x999e('0x28')]={};this['optionPredictive']={};this[_0x999e('0x29')]={};this[_0x999e('0x2a')]={};this[_0x999e('0x2b')]={};this[_0x999e('0x2c')]={};this[_0x999e('0x2d')]={};ami['on'](_0x999e('0x2e'),this[_0x999e('0x2f')]['bind'](this));ami['on']('queuecallerabandon',this[_0x999e('0x30')][_0x999e('0x31')](this));ami['on']('originateresponse',this[_0x999e('0x32')][_0x999e('0x31')](this));ami['on'](_0x999e('0x33'),this[_0x999e('0x34')][_0x999e('0x31')](this));ami['on'](_0x999e('0x35'),this['syncQueueSummary'][_0x999e('0x31')](this));ami['on'](_0x999e('0x36'),this[_0x999e('0x37')][_0x999e('0x31')](this));ami['on'](_0x999e('0x38'),this[_0x999e('0x39')][_0x999e('0x31')](this));ami['on']('varset',this[_0x999e('0x3a')]['bind'](this));ami['on']('queuemember',this[_0x999e('0x3b')][_0x999e('0x31')](this));ami['on'](_0x999e('0x3c'),this['syncQueueStatusComplete'][_0x999e('0x31')](this));this[_0x999e('0x3d')]();this[_0x999e('0x3e')]();}function isNotNull(_0x4339bf){return _0x4339bf!==null&&!_[_0x999e('0x3f')](_0x4339bf);}function checkIsLoggedIn(_0x327079,_0x82e067){return function(){if(_0x82e067<=0x0){_0x327079[_0x999e('0x40')]=_0x999e('0x41');throw _0x327079[_0x999e('0x42')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x1c8feb){return _0x1c8feb;}function checkIsActive(_0x1cd206,_0x371613){return function(){if(!isActive(_0x371613)){_0x1cd206['message']=_0x999e('0x43');throw _0x1cd206['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x28a228){return function(){if(!isNotNull(_0x28a228[_0x999e('0x44')])){_0x28a228['message']='INTERVAL_IS_NULL';throw _0x28a228[_0x999e('0x42')]+_0x999e('0x45');}if(!isNotNull(_0x28a228[_0x999e('0x44')][_0x999e('0x46')])){_0x28a228['message']=_0x999e('0x47');throw _0x28a228[_0x999e('0x42')]+_0x999e('0x45');}if(!isNotNull(_[_0x999e('0x48')](_0x28a228['Interval']['Intervals']))){_0x28a228[_0x999e('0x40')]='INTERVAL_IS_NULL';throw _0x28a228[_0x999e('0x42')]+_0x999e('0x45');}};}function msgResponse(_0x69e059,_0x14c9e0,_0x5ad3f1){return{'action':_0x69e059,'response':_0x14c9e0,'message':_0x5ad3f1,'stack':_0x5ad3f1};}function myreject(_0xebda67){return function(_0x28df26){return _0xebda67(msgResponse('[ifTime][Action]','Error',JSON[_0x999e('0x49')](_0x28df26)));};}function getSeconds(_0x4aa98c,_0xa0c150){var _0x5dac45=moment(_0x4aa98c)['milliseconds'](0x0);var _0x504ac1=moment(_0xa0c150)['milliseconds'](0x0);return _0x5dac45[_0x999e('0x4a')](_0x504ac1,'seconds');}function emit(_0x1be117,_0x5240a7,_0x4cfa34){io['to'](_0x1be117)['emit'](_0x5240a7,_0x4cfa34);}function emitVoiceQueueSummary(_0x2f7d79){if(_0x2f7d79[_0x999e('0x4b')]===_0x999e('0x4c')){var _0xe3c089={'id':_0x2f7d79['id'],'name':_0x2f7d79[_0x999e('0x42')],'strategy':_0x2f7d79[_0x999e('0x4d')],'answered':_0x2f7d79[_0x999e('0x4e')],'available':_0x2f7d79[_0x999e('0x4f')],'loggedIn':_0x2f7d79['loggedIn'],'pTalking':_0x2f7d79[_0x999e('0x50')],'sumBillable':_0x2f7d79[_0x999e('0x51')],'sumDuration':_0x2f7d79[_0x999e('0x52')],'sumHoldTime':_0x2f7d79[_0x999e('0x53')]||0x0,'talking':_0x2f7d79['talking'],'total':_0x2f7d79[_0x999e('0x54')],'type':_0x2f7d79['type'],'unmanaged':_0x2f7d79[_0x999e('0x55')],'abandoned':_0x2f7d79[_0x999e('0x56')],'waiting':_0x2f7d79[_0x999e('0x57')],'loggedInDb':_0x2f7d79[_0x999e('0x58')],'dialActive':_0x2f7d79['dialActive'],'dialMethod':_0x2f7d79[_0x999e('0x59')],'dialOriginateCallerIdName':_0x2f7d79[_0x999e('0x5a')],'dialOriginateCallerIdNumber':_0x2f7d79[_0x999e('0x5b')],'dialOriginateTimeout':_0x2f7d79['dialOriginateTimeout'],'dialPrefix':_0x2f7d79['dialPrefix'],'outboundAnswerAgiCallsDay':_0x2f7d79[_0x999e('0x5c')],'outboundAnswerCallsDay':_0x2f7d79[_0x999e('0x5d')],'outboundBlacklistCallsDay':_0x2f7d79[_0x999e('0x5e')],'outboundBusyCallsDay':_0x2f7d79[_0x999e('0x5f')],'outboundCongestionCallsDay':_0x2f7d79[_0x999e('0x60')],'outboundDropCallsDayACS':_0x2f7d79[_0x999e('0x61')],'outboundDropCallsDayCallersExit':_0x2f7d79[_0x999e('0x62')],'outboundDropCallsDayTimeout':_0x2f7d79[_0x999e('0x63')],'outboundNoAnswerCallsDay':_0x2f7d79[_0x999e('0x64')],'outboundNoSuchCallsDay':_0x2f7d79[_0x999e('0x65')],'outboundOriginateFailureCallsDay':_0x2f7d79['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x2f7d79['outboundReCallsDay'],'outboundRejectCallsDay':_0x2f7d79[_0x999e('0x66')],'outboundUnknownCallsDay':_0x2f7d79[_0x999e('0x67')],'predictiveIntervalAnsweredCalls':_0x2f7d79[_0x999e('0x68')],'predictiveIntervalAvgHoldtime':_0x2f7d79[_0x999e('0x69')],'predictiveIntervalAvgTalktime':_0x2f7d79[_0x999e('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x2f7d79[_0x999e('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x2f7d79['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x2f7d79[_0x999e('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x2f7d79['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x2f7d79['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x2f7d79[_0x999e('0x6d')],'predictiveIntervalPauses':_0x2f7d79['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x2f7d79['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x2f7d79['predictiveIntervalTotalCalls'],'message':_0x2f7d79['message'],'originated':_0x2f7d79[_0x999e('0x6e')],'erlangCalls':_0x2f7d79[_0x999e('0x6f')],'erlangCallToSecond':_0x2f7d79['erlangCallToSecond'],'erlangAbandonmentRate':_0x2f7d79[_0x999e('0x70')],'erlangBusyFactor':_0x2f7d79[_0x999e('0x71')],'startPredictive':_0x2f7d79[_0x999e('0x29')],'startProgressive':_0x2f7d79['startProgressive']};if(_0x2f7d79['Trunk']){_0xe3c089[_0x999e('0x72')]={'id':_0x2f7d79[_0x999e('0x72')]['id'],'name':_0x2f7d79[_0x999e('0x72')]['name'],'active':_0x2f7d79['Trunk']['active'],'callerid':_0x2f7d79['Trunk'][_0x999e('0x73')]};}if(_0x2f7d79['Interval']){_0xe3c089['Interval']={'id':_0x2f7d79[_0x999e('0x44')]['id'],'name':_0x2f7d79[_0x999e('0x44')]['name']};}var _0xa50dc6=md5(JSON[_0x999e('0x49')](_0xe3c089));if(_0x2f7d79['md5']!==_0xa50dc6){_0x2f7d79[_0x999e('0x74')]=_0xa50dc6;emit(util['format'](_0x999e('0x75'),_0xe3c089[_0x999e('0x42')]),'voice_queue:save',_0xe3c089);}}}function emitCampaignSummary(_0x210f1e){if(_0x210f1e[_0x999e('0x4b')]==='ivr'){emit(util['format'](_0x999e('0x76'),_0x210f1e['name']),'campaign:save',_0x210f1e);}}function checkGetDataPredictive(_0x4de2e8){if(isNotNull(_0x4de2e8)&&!_[_0x999e('0x48')](_0x4de2e8)){loggerPredictive[_0x999e('0x77')](_0x999e('0x78'));loggerPredictive[_0x999e('0x77')](_0x999e('0x79'),_0x4de2e8[_0x999e('0x7a')]);loggerPredictive['info'](_0x999e('0x7b'),_0x4de2e8[_0x999e('0x68')]);loggerPredictive['info'](_0x999e('0x7c'),_0x4de2e8[_0x999e('0x7d')]);loggerPredictive[_0x999e('0x77')](_0x999e('0x7e'),_0x4de2e8[_0x999e('0x6b')]);loggerPredictive[_0x999e('0x77')](_0x999e('0x7f'),_0x4de2e8[_0x999e('0x69')]);loggerPredictive[_0x999e('0x77')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4de2e8[_0x999e('0x6a')]);loggerPredictive[_0x999e('0x77')](_0x999e('0x80'));if(_0x4de2e8[_0x999e('0x7a')]>0x0){if(!_['isUndefined'](_0x4de2e8[_0x999e('0x6a')])&&_0x4de2e8[_0x999e('0x6a')]>0x0){return!![];}loggerPredictive[_0x999e('0x77')](_0x999e('0x81'));if(!_[_0x999e('0x3f')](_0x4de2e8[_0x999e('0x69')])&&_0x4de2e8[_0x999e('0x69')]>0x0){return!![];}loggerPredictive[_0x999e('0x77')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x999e('0x82'));}}else{loggerPredictive[_0x999e('0x77')](_0x999e('0x83'));}return![];}function mergeDataErlangB(_0xefd231){return function(_0x18ff7a){loggerPredictive[_0x999e('0x77')](_0x999e('0x84'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x18ff7a[_0x999e('0x6f')]);loggerPredictive[_0x999e('0x77')](_0x999e('0x85'),_0x18ff7a[_0x999e('0x86')]);loggerPredictive[_0x999e('0x77')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x18ff7a[_0x999e('0x70')]);loggerPredictive[_0x999e('0x77')](_0x999e('0x87'),_0x18ff7a[_0x999e('0x71')]);loggerPredictive[_0x999e('0x77')](_0x999e('0x88'),_0x18ff7a[_0x999e('0x70')]);loggerPredictive['info'](_0x999e('0x80'));_['merge'](_0xefd231,_0x18ff7a);};}function getDiff(_0xe35369){var _0x43217e=moment()[_0x999e('0x89')](0x0);var _0x25f6a6=moment(_0xe35369)[_0x999e('0x89')](0x0);return _0x43217e[_0x999e('0x4a')](_0x25f6a6,'seconds');}function ifInterval(_0x43bd68,_0x1a6ade){if(_[_0x999e('0x3f')](_0x1a6ade)){return![];}return getDiff(_0x1a6ade)<_0x43bd68*0x3c;}function freeVariablesPredictive(_0xe39e00){if(isNotNull(_0xe39e00)){if(!_[_0x999e('0x3f')](_0xe39e00[_0x999e('0x2a')])){_0xe39e00[_0x999e('0x2a')]=undefined;loggerPredictive[_0x999e('0x77')](_0xe39e00[_0x999e('0x42')],_0x999e('0x8a'));}if(!_[_0x999e('0x3f')](_0xe39e00[_0x999e('0x29')])){_0xe39e00[_0x999e('0x29')]=undefined;loggerPredictive[_0x999e('0x77')](_0xe39e00[_0x999e('0x42')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x999e('0x3f')](_0xe39e00[_0x999e('0x8b')])){clearInterval(_0xe39e00[_0x999e('0x8b')]);_0xe39e00[_0x999e('0x8b')]=undefined;loggerPredictive['info'](_0xe39e00['name'],_0x999e('0x8c'));}}}function erlangb(_0x2d398f,_0x67267d){if(_0x67267d===0x0){return 0x0;}var _0x33abdc=0x1;for(var _0x1c9b64=0x1;_0x1c9b64<=_0x67267d;_0x1c9b64+=0x1){_0x33abdc=0x1+_0x33abdc*_0x1c9b64/_0x2d398f;}return 0x1/_0x33abdc;}function isVoiceQueueOutbound(_0x19d934){return _0x19d934===_0x999e('0x4c');}function isNotPreview(_0x3e75a3){return _0x3e75a3!==_0x999e('0x21');}function isCampaignIvr(_0x5d4f50){return _0x5d4f50===_0x999e('0x8d');}function getCallerId(_0x47c693,_0x184b3e,_0x21a04a){if(!_['isUndefined'](_0x21a04a)&&typeof _0x21a04a===_0x999e('0x8e')&&!_[_0x999e('0x48')](_0x21a04a)){if(!_[_0x999e('0x3f')](_0x184b3e)&&typeof _0x184b3e===_0x999e('0x8e')&&!_[_0x999e('0x48')](_0x184b3e)){return util['format'](_0x999e('0x8f'),_0x184b3e,_0x21a04a);}return util[_0x999e('0x90')]('\x22%s\x22\x20<%s>',_0x21a04a,_0x21a04a);}if(!_['isUndefined'](_0x47c693)&&typeof _0x47c693==='string'&&!_[_0x999e('0x48')](_0x47c693)){return _0x47c693;}return _0x999e('0x91');}function loggerCatchQueueSummary(_0x3432fd,_0x378f60){return function(_0x8d988f){freeVariablesPredictive(_0x378f60);emitVoiceQueueSummary(_0x378f60);emitCampaignSummary(_0x378f60);loggerSyncQueueSummary['error'](_0x3432fd,util['inspect'](_0x8d988f,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4e229e,_0x49293d){return function(_0x513580){loggerPredictive['error'](_0x49293d[_0x999e('0x42')],_0x4e229e);loggerPredictive['error'](_0x513580[_0x999e('0x92')]);freeVariablesPredictive(_0x49293d);};}function loggerCatch(_0x3131c7){return function(_0xb5ac06){logger['error'](_0x3131c7,util[_0x999e('0x93')](_0xb5ac06,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3c2bce){return _0x3c2bce&&!_[_0x999e('0x3f')](_0x3c2bce)&&_0x3c2bce[_0x999e('0x94')]>0x0;}function decremetOriginate(_0x3f0baa){if(!_[_0x999e('0x3f')](_0x3f0baa)&&_0x3f0baa!==null){if(typeof _0x3f0baa[_0x999e('0x6e')]!=='undefined'){if(_0x3f0baa[_0x999e('0x6e')]>0x0){_0x3f0baa[_0x999e('0x6e')]-=0x1;}else{logger[_0x999e('0x95')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x999e('0x95')](_0x999e('0x96'));}}function checkContactLowerLimitOriginate(_0x4bffc5,_0x2f893b,_0x67c96d){if(_0x2f893b>_0x67c96d){for(var _0x3a404d=0x0;_0x3a404d<_0x2f893b-_0x67c96d;_0x3a404d+=0x1){decremetOriginate(_0x4bffc5);}}}function loggerGetContactDialer(_0x1f0dc3,_0xc02339,_0xd85ed7){return function(_0x42f36f){checkContactLowerLimitOriginate(_0xc02339,_0xd85ed7,0x0);logger[_0x999e('0x95')](_0x1f0dc3,util[_0x999e('0x93')](_0x42f36f,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x58fb9e){return function(_0xe27738){if(isNotNull(_0xe27738)&&isNotNull(_0xe27738[0x0])){if(_0xe27738[0x0][_0x999e('0x97')]>0x0){_0x58fb9e[_0x999e('0x40')]='RESCHEDULED_CONTACTS';logger[_0x999e('0x77')]('[getContactDialer2][ReScheduled]'+_0x58fb9e[_0x999e('0x42')],_0xe27738[0x0][_0x999e('0x97')],_0x999e('0x98'));}else{_0x58fb9e['message']=_0x999e('0x99');logger[_0x999e('0x77')](_0x999e('0x9a')+_0x58fb9e[_0x999e('0x42')]);}}};}function notSendMessagesQueue(_0x436bc5){if(_0x436bc5[_0x999e('0x9b')]){freeVariablesPredictive(_0x436bc5);if(_0x436bc5['originated']===0x0&&_0x436bc5[_0x999e('0x9c')]===0x0&&_0x436bc5['waiting']===0x0&&(_0x436bc5[_0x999e('0x50')]||0x0)===0x0){_0x436bc5['sendMessageOneNotActive']=![];_0x436bc5['available']=0x0;_0x436bc5[_0x999e('0x40')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x999e('0x95')](_0x999e('0x9d'),_0x436bc5['name'],_0x999e('0x9e'));}else{_0x436bc5[_0x999e('0x40')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x999e('0x95')](_0x999e('0x9d'),_0x436bc5[_0x999e('0x42')],_0x999e('0x9f'));}emitVoiceQueueSummary(_0x436bc5);}}function notSendMessagesCampaign(_0x382c65){if(_0x382c65[_0x999e('0x9b')]){if(_0x382c65[_0x999e('0x6e')]===0x0){_0x382c65[_0x999e('0x9b')]=![];_0x382c65['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x999e('0x95')](_0x999e('0xa0'),_0x382c65[_0x999e('0x42')],_0x999e('0x9e'));}else{_0x382c65[_0x999e('0x40')]=_0x999e('0xa1');loggerSyncQueueSummary['error'](_0x999e('0xa0'),_0x382c65[_0x999e('0x42')],'is\x20disactive');}emitCampaignSummary(_0x382c65);}}function createObjHistory(_0x2405f5,_0x404391,_0x40d407,_0x54742b,_0x389520){_0x2405f5[_0x999e('0x40')]=_0x40d407;var _0x328c2d=new Action(_0x2405f5,_0x404391);var _0x47eac1=new History(_0x328c2d);_0x47eac1[_0x999e('0xa2')]=_0x54742b;_0x47eac1[_0x999e('0xa3')]=_0x389520;_0x47eac1[_0x999e('0xa4')]=_0x328c2d['starttime'];return _0x47eac1;}Dialer['prototype'][_0x999e('0x3e')]=function(){var _0x47e5ce=this;setInterval(function(){_0x47e5ce[_0x999e('0xa5')](_0x47e5ce[_0x999e('0x28')],_0x999e('0xa6'));_0x47e5ce[_0x999e('0xa5')](_0x47e5ce[_0x999e('0x26')],_0x999e('0xa7'));},0x32c8);};Dialer[_0x999e('0x1d')]['clearZombieChannels']=function(_0x11e5d3,_0x540a9e){var _0x5a65c8=this;for(var _0x3dc18c in _0x11e5d3){if(typeof _0x11e5d3[_0x3dc18c]!==_0x999e('0xa8')){this[_0x999e('0x20')][_0x999e('0xa9')](function(){if(!_[_0x999e('0xaa')](_0x11e5d3[_0x3dc18c])){return ami[_0x999e('0xab')]({'action':'status','channel':_0x11e5d3[_0x3dc18c][_0x999e('0xac')]})['catch'](function(_0x302161){if(_0x302161[_0x999e('0x40')]===_0x999e('0xad')){setTimeout(function(){if(_0x11e5d3[_0x3dc18c]&&_0x11e5d3[_0x3dc18c]['type']!==_0x999e('0x8d')){_0x5a65c8['updateOriginated'](_0x5a65c8[_0x999e('0xae')][_0x11e5d3[_0x3dc18c][_0x999e('0xaf')]]);logger[_0x999e('0x95')](_0x999e('0xb0'),_0x540a9e,_0x3dc18c,_0x11e5d3[_0x3dc18c][_0x999e('0xaf')]);delete _0x11e5d3[_0x3dc18c];}if(_0x11e5d3[_0x3dc18c]&&_0x11e5d3[_0x3dc18c]['type']==='ivr'){_0x5a65c8[_0x999e('0xb1')](_0x5a65c8[_0x999e('0x22')][_0x11e5d3[_0x3dc18c][_0x999e('0xaf')]]);logger[_0x999e('0x95')](_0x999e('0xb2'),_0x540a9e,_0x3dc18c,_0x11e5d3[_0x3dc18c][_0x999e('0xaf')]);delete _0x11e5d3[_0x3dc18c];}},0x2328);}});}});}}};Dialer[_0x999e('0x1d')][_0x999e('0xb3')]=function(_0x4e502b){return BPromise[_0x999e('0xb4')]()[_0x999e('0xb5')](cmHopper[_0x999e('0xb3')](_0x4e502b))[_0x999e('0xb6')](loggerCatch(_0x999e('0xb7')));};Dialer[_0x999e('0x1d')][_0x999e('0xb8')]=function(_0x16d552){return BPromise['resolve']()[_0x999e('0xb5')](cmHopperBlack[_0x999e('0xb8')](_0x16d552))[_0x999e('0xb6')](loggerCatch(_0x999e('0xb9')));};Dialer[_0x999e('0x1d')][_0x999e('0xba')]=function(_0x203da5){return BPromise[_0x999e('0xb4')]()['then'](cmHopperBlack[_0x999e('0xba')](_0x203da5))[_0x999e('0xb6')](loggerCatch(_0x999e('0xbb')));};Dialer['prototype'][_0x999e('0xbc')]=function(_0x3edea2){return BPromise[_0x999e('0xb4')]()[_0x999e('0xb5')](cmHopperHistory[_0x999e('0xbd')](_0x3edea2))[_0x999e('0xb6')](loggerCatch(_0x999e('0xbe')));};Dialer[_0x999e('0x1d')][_0x999e('0xbf')]=function(_0x4ee1d4){return BPromise[_0x999e('0xb4')]()[_0x999e('0xb5')](cmHopper[_0x999e('0xbf')](_0x4ee1d4))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x999e('0x1d')][_0x999e('0xc0')]=function(_0x421f60,_0x544755,_0x3c93e4){return BPromise[_0x999e('0xb4')]()[_0x999e('0xb5')](cmHopper['unlockContact'](_0x421f60,_0x544755,_0x3c93e4))[_0x999e('0xb6')](loggerCatch(_0x999e('0xc1')));};Dialer['prototype'][_0x999e('0xc2')]=function(_0x5ac17e,_0x4cbe1d,_0xddffa3,_0x7026bb,_0x1ee576){return BPromise[_0x999e('0xb4')]()['then'](cmHopper[_0x999e('0xc2')](_0x5ac17e,_0x4cbe1d,_0xddffa3,_0x7026bb))[_0x999e('0xb6')](function(_0x76015d){_0x1ee576[_0x999e('0xc3')]-=_0xddffa3;_0x1ee576[_0x999e('0xc3')]=_0x1ee576['temp']>0x0?_0x1ee576[_0x999e('0xc3')]:0x0;loggerCatch(_0x999e('0xc4'))(_0x76015d);});};Dialer[_0x999e('0x1d')]['getContactDialerIvr']=function(_0x1916bc,_0x2c9720,_0x32c3ba,_0x3e7d2f){return BPromise[_0x999e('0xb4')]()[_0x999e('0xb5')](cmHopper[_0x999e('0xc5')](_0x1916bc,_0x2c9720,_0x32c3ba))[_0x999e('0xb6')](function(_0x57683c){_0x3e7d2f[_0x999e('0xc3')]-=_0x2c9720;_0x3e7d2f[_0x999e('0xc3')]=_0x3e7d2f[_0x999e('0xc3')]>0x0?_0x3e7d2f[_0x999e('0xc3')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x57683c);});};Dialer[_0x999e('0x1d')][_0x999e('0xc6')]=function(_0xada3ee){return BPromise[_0x999e('0xb4')]()[_0x999e('0xb5')](voiceQueueRt['getVoiceQueueRtPauses'](_0xada3ee))[_0x999e('0xb6')](loggerCatch(_0x999e('0xc7')));};Dialer[_0x999e('0x1d')][_0x999e('0xc8')]=function(_0x35a4e6){return BPromise[_0x999e('0xb4')]()['then'](cmHopper['moveContactManagedDialer'](_0x35a4e6))[_0x999e('0xb6')](loggerCatch(_0x999e('0xc9')));};Dialer['prototype'][_0x999e('0xca')]=function(_0x346afc){return BPromise['resolve']()[_0x999e('0xb5')](cmHopperHistory[_0x999e('0xca')](_0x346afc))[_0x999e('0xb6')](loggerCatch(_0x999e('0xcb')));};Dialer[_0x999e('0x1d')]['updateOriginated']=function(_0x21aeed){if(!_[_0x999e('0x3f')](_0x21aeed)&&_0x21aeed!==null){if(typeof _0x21aeed[_0x999e('0x6e')]!==_0x999e('0xa8')){if(_0x21aeed[_0x999e('0x6e')]>0x0){_0x21aeed[_0x999e('0x6e')]-=0x1;}else{logger[_0x999e('0x95')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x999e('0x95')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x999e('0x1d')][_0x999e('0xcc')]=function(_0x2c9520,_0x2bcab1){var _0x230486=this;return function(_0x2e3c17){_0x230486[_0x999e('0xb1')](_0x2bcab1);logger[_0x999e('0x95')](_0x2c9520,util[_0x999e('0x93')](_0x2e3c17,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x999e('0xcd')]=function(_0x4a0c88,_0x3699f6,_0x4a804c){var _0x3881ea={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x3699f6);this[_0x999e('0xce')](_[_0x999e('0xcf')](_0x3881ea,_['pick'](_0x4a804c,['ContactId',_0x999e('0xd0'),_0x999e('0xd1'),_0x999e('0xd2'),_0x999e('0xd3')])),_0x999e('0xd4'),'[emptyContact]');logger[_0x999e('0x95')](_0x4a0c88);};Dialer['prototype'][_0x999e('0xd5')]=function(_0x6664f7){return _0x6664f7===_0x999e('0xd6');};Dialer[_0x999e('0x1d')]['isTrunkReachable']=function(_0x121a36){return!_[_0x999e('0x3f')](_0x121a36)&&_0x121a36&&!_[_0x999e('0x3f')](_0x121a36[_0x999e('0x42')])&&!_[_0x999e('0x3f')](_0x121a36[_0x999e('0xd7')])&&_0x121a36[_0x999e('0xd7')]&&(this[_0x999e('0x24')][util[_0x999e('0x90')]('SIP/%s',_0x121a36[_0x999e('0x42')])][_0x999e('0xd8')]===_0x999e('0xd9')||this[_0x999e('0x24')][util[_0x999e('0x90')](_0x999e('0xda'),_0x121a36[_0x999e('0x42')])][_0x999e('0xd8')]==='unmonitored');};Dialer[_0x999e('0x1d')]['saveInDb']=function(_0x2edf92,_0x1b54f8,_0x56f1b3){this[_0x999e('0xca')](_0x2edf92)[_0x999e('0xb6')](loggerCatch(_0x1b54f8));this[_0x999e('0xc8')](_0x2edf92)[_0x999e('0xb6')](loggerCatch(_0x56f1b3));};Dialer[_0x999e('0x1d')]['syncVarSet']=function(_0x307a0d){var _0x52e6b0=this['uniqueId'][_0x307a0d[_0x999e('0xdb')]];var _0x16b8f4;if(!_[_0x999e('0xaa')](_0x307a0d)&&!_['isNil'](_0x307a0d[_0x999e('0xdc')])&&!_[_0x999e('0xaa')](_0x307a0d[_0x999e('0xdc')][_0x999e('0xdd')])&&_0x307a0d[_0x999e('0xde')]===_0x999e('0xdf')&&_0x52e6b0){if(_0x52e6b0[_0x999e('0x4b')]!=='ivr'&&this[_0x999e('0xae')][_0x52e6b0[_0x999e('0xaf')]]['dialAMDActive']&&_0x307a0d[_0x999e('0xe0')]==='HANGUP'){delete this[_0x999e('0x28')][_0x307a0d[_0x999e('0xdb')]];this['updateOriginated'](this['voiceQueues'][_0x52e6b0['queue']]);this['voiceQueues'][_0x52e6b0['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x999e('0xae')][_0x52e6b0[_0x999e('0xaf')]][_0x999e('0x5c')]+=0x1;_0x16b8f4=new Hangup(_0x52e6b0,_0x307a0d);_0x16b8f4[_0x999e('0xa2')]=0x12;_0x16b8f4[_0x999e('0xa3')]=_0x999e('0xe1');_0x16b8f4[_0x999e('0xe2')]=_0x999e('0xe3');ami[_0x999e('0xe4')](_0x999e('0xe5'),ut['buildObj'](_0x16b8f4,_0x999e('0xe6')));this[_0x999e('0xce')](_0x16b8f4,_0x999e('0xe7'),_0x999e('0xe8'));}if(_0x52e6b0[_0x999e('0x4b')]!==_0x999e('0x8d')&&this[_0x999e('0xae')][_0x52e6b0[_0x999e('0xaf')]][_0x999e('0xe9')]&&_0x307a0d[_0x999e('0xe0')]===_0x999e('0xea')){var _0x4e943f=this;return new BPromise(function(_0x246330,_0x3082d0){delete _0x4e943f[_0x999e('0x28')][_0x307a0d[_0x999e('0xdb')]];_0x4e943f['updateOriginated'](_0x4e943f[_0x999e('0xae')][_0x52e6b0['queue']]);_0x4e943f['voiceQueues'][_0x52e6b0[_0x999e('0xaf')]]['outboundAnswerCallsDay']+=0x1;_0x4e943f[_0x999e('0xae')][_0x52e6b0['queue']][_0x999e('0x5c')]+=0x1;var _0x5237a2=_0x4e943f[_0x999e('0xae')][_0x52e6b0['queue']];var _0x1f426f=new Hangup(_0x52e6b0,_0x307a0d);_0x1f426f[_0x999e('0xa2')]=0x13;_0x1f426f['statedesc']='Machine';_0x1f426f['membername']=_0x999e('0xe3');_0x1f426f[_0x999e('0xeb')]+=0x1;_0x1f426f[_0x999e('0xec')]+=0x1;_0x1f426f['amd']=!![];ami['emit'](_0x999e('0xe5'),ut['buildObj'](_0x1f426f,_0x999e('0xe6')));_0x4e943f[_0x999e('0xca')](_0x1f426f)[_0x999e('0xb6')](loggerCatch(_0x999e('0xed')));if(_0x1f426f[_0x999e('0xee')]+_0x1f426f[_0x999e('0xef')]+_0x1f426f[_0x999e('0xf0')]+_0x1f426f[_0x999e('0xf1')]+_0x1f426f[_0x999e('0xf2')]+_0x1f426f[_0x999e('0xf3')]+_0x1f426f['countmachineretry']+_0x1f426f[_0x999e('0xf4')]>=_0x5237a2['dialGlobalMaxRetry']){_0x4e943f[_0x999e('0xf5')](_0x1f426f,_0x246330,_0x3082d0,_0x999e('0xf6'));}else{if(_0x1f426f['countmachineretry']>=_0x5237a2[_0x999e('0xf7')]){_0x4e943f[_0x999e('0xf8')](_0x1f426f,_0x246330,_0x3082d0,_0x999e('0xf9'));}else{_0x4e943f[_0x999e('0xbf')]({'active':![],'countmachineretry':_0x1f426f['countmachineretry'],'scheduledat':moment()[_0x999e('0xfa')](_0x5237a2[_0x999e('0xfb')],_0x999e('0xfc'))[_0x999e('0x90')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1f426f['ContactId'],'ListId':_0x1f426f[_0x999e('0xd0')],'VoiceQueueId':_0x1f426f[_0x999e('0xd2')]||undefined,'CampaignId':_0x1f426f[_0x999e('0xd3')]||undefined})[_0x999e('0xb6')](loggerCatch(_0x999e('0xfd')));_0x246330({'reschedule':0x1});}}});}if(_0x52e6b0[_0x999e('0x4b')]==='ivr'&&this[_0x999e('0x22')][_0x52e6b0[_0x999e('0xaf')]]['dialAMDActive']&&_0x307a0d['value']===_0x999e('0xfe')){delete this[_0x999e('0x28')][_0x307a0d[_0x999e('0xdb')]];this['updateOriginated'](this[_0x999e('0x22')][_0x52e6b0[_0x999e('0xaf')]]);_0x16b8f4=new Hangup(_0x52e6b0,_0x307a0d);_0x16b8f4[_0x999e('0xa2')]=0x12;_0x16b8f4[_0x999e('0xa3')]='HangupInAMD';_0x16b8f4[_0x999e('0xe2')]=_0x999e('0xe3');ami[_0x999e('0xe4')]('custom:amd',ut['buildObj'](_0x16b8f4,'amd'));this[_0x999e('0xce')](_0x16b8f4,'[syncHangupInAMDIvr][createHistory]',_0x999e('0xff'));}if(_0x52e6b0[_0x999e('0x4b')]===_0x999e('0x8d')&&this[_0x999e('0x22')][_0x52e6b0[_0x999e('0xaf')]][_0x999e('0xe9')]&&_0x307a0d[_0x999e('0xe0')]===_0x999e('0xea')){var _0x4e943f=this;return new BPromise(function(_0x54c72a,_0x16a067){delete _0x4e943f[_0x999e('0x28')][_0x307a0d['uniqueid']];_0x4e943f[_0x999e('0xb1')](_0x4e943f['campaigns'][_0x52e6b0['queue']]);_0x4e943f[_0x999e('0x22')][_0x52e6b0[_0x999e('0xaf')]][_0x999e('0x5d')]+=0x1;_0x4e943f[_0x999e('0x22')][_0x52e6b0[_0x999e('0xaf')]][_0x999e('0x5c')]+=0x1;var _0x9adcb0=_0x4e943f[_0x999e('0x22')][_0x52e6b0[_0x999e('0xaf')]];var _0x4537ed=new Hangup(_0x52e6b0,_0x307a0d);_0x4537ed[_0x999e('0xa2')]=0x13;_0x4537ed['statedesc']='Machine';_0x4537ed[_0x999e('0xe2')]=_0x999e('0xe3');_0x4537ed['countmachineretry']+=0x1;_0x4537ed[_0x999e('0xec')]+=0x1;_0x4537ed['amd']=!![];ami[_0x999e('0xe4')](_0x999e('0xe5'),ut[_0x999e('0x100')](_0x4537ed,'amd'));_0x4e943f[_0x999e('0xca')](_0x4537ed)[_0x999e('0xb6')](loggerCatch(_0x999e('0xed')));if(_0x4537ed[_0x999e('0xee')]+_0x4537ed[_0x999e('0xef')]+_0x4537ed['countnoanswerretry']+_0x4537ed['countnosuchnumberretry']+_0x4537ed[_0x999e('0xf2')]+_0x4537ed[_0x999e('0xf3')]+_0x4537ed[_0x999e('0xeb')]+_0x4537ed[_0x999e('0xf4')]>=_0x9adcb0[_0x999e('0x101')]){_0x4e943f[_0x999e('0xf5')](_0x4537ed,_0x54c72a,_0x16a067,_0x999e('0xf6'));}else{if(_0x4537ed[_0x999e('0xeb')]>=_0x9adcb0['dialMachineMaxRetry']){_0x4e943f[_0x999e('0xf8')](_0x4537ed,_0x54c72a,_0x16a067,_0x999e('0xf9'));}else{_0x4e943f[_0x999e('0xbf')]({'active':![],'countmachineretry':_0x4537ed[_0x999e('0xeb')],'scheduledat':moment()[_0x999e('0xfa')](_0x9adcb0[_0x999e('0xfb')],'minutes')['format'](_0x999e('0x102')),'ContactId':_0x4537ed[_0x999e('0x103')],'ListId':_0x4537ed[_0x999e('0xd0')],'VoiceQueueId':_0x4537ed[_0x999e('0xd2')]||undefined,'CampaignId':_0x4537ed[_0x999e('0xd3')]||undefined})[_0x999e('0xb6')](loggerCatch(_0x999e('0xfd')));_0x54c72a({'reschedule':0x1});}}});}}};Dialer[_0x999e('0x1d')][_0x999e('0x37')]=function(_0x211c7d){var _0x1e4d3c=this[_0x999e('0x28')][_0x211c7d[_0x999e('0xdb')]];var _0x4a2fbb=this;var _0x990fe3;if(_0x1e4d3c&&_0x1e4d3c[_0x999e('0x4b')]==='ivr'){delete this[_0x999e('0x28')][_0x211c7d[_0x999e('0xdb')]];this[_0x999e('0xb1')](this[_0x999e('0x22')][_0x1e4d3c[_0x999e('0xaf')]]);this[_0x999e('0x22')][_0x1e4d3c[_0x999e('0xaf')]][_0x999e('0x104')]+=0x1;_0x990fe3=new Hangup(_0x1e4d3c,_0x211c7d);this['createHistory'](_0x990fe3)[_0x999e('0xb6')](loggerCatch(_0x999e('0x105')));this['moveContactManagedDialer'](_0x990fe3)[_0x999e('0xb6')](loggerCatch(_0x999e('0x106')));}if(_0x1e4d3c&&_0x1e4d3c[_0x999e('0x4b')]!==_0x999e('0x8d')&&isNotNull(this['voiceQueues'][_0x1e4d3c['queue']][_0x999e('0x107')])){delete this[_0x999e('0x28')][_0x211c7d[_0x999e('0xdb')]];this[_0x999e('0xb1')](this['voiceQueues'][_0x1e4d3c['queue']]);this[_0x999e('0xae')][_0x1e4d3c['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x999e('0xae')][_0x1e4d3c['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x990fe3=new Hangup(_0x1e4d3c,_0x211c7d);_0x990fe3[_0x999e('0xa2')]=0x10;_0x990fe3['statedesc']=_0x999e('0x108');_0x990fe3[_0x999e('0xe2')]=_0x999e('0x109');this[_0x999e('0xca')](_0x990fe3)[_0x999e('0xb6')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x999e('0xc8')](_0x990fe3)['catch'](loggerCatch(_0x999e('0x106')));}if(_0x1e4d3c&&_0x1e4d3c[_0x999e('0x4b')]!==_0x999e('0x8d')&&!isNotNull(this[_0x999e('0xae')][_0x1e4d3c[_0x999e('0xaf')]][_0x999e('0x107')])){delete this['uniqueId'][_0x211c7d[_0x999e('0xdb')]];this[_0x999e('0xb1')](this[_0x999e('0xae')][_0x1e4d3c[_0x999e('0xaf')]]);this[_0x999e('0xae')][_0x1e4d3c[_0x999e('0xaf')]]['outboundUnknownCallsDay']+=0x1;_0x990fe3=new Hangup(_0x1e4d3c,_0x211c7d);_0x990fe3[_0x999e('0xa2')]=0xc;_0x990fe3[_0x999e('0xa3')]=_0x211c7d['cause-txt'];_0x990fe3[_0x999e('0xe2')]=_0x999e('0x10a');this[_0x999e('0xca')](_0x990fe3)['catch'](loggerCatch(_0x999e('0x105')));this[_0x999e('0xc8')](_0x990fe3)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x999e('0x1d')]['syncAgentComplete']=function(_0x33bcf6){var _0x98f099=this[_0x999e('0x28')][_0x33bcf6[_0x999e('0xdb')]];var _0x2b62a7=this;if(this['voiceQueues'][_0x33bcf6['queue']]){if(_0x98f099&&_0x98f099[_0x999e('0x4b')]!==_0x999e('0x8d')){delete this['uniqueId'][_0x33bcf6[_0x999e('0xdb')]];this[_0x999e('0xae')][_0x33bcf6['queue']][_0x999e('0x5d')]+=0x1;var _0x4cf199=new AgentComplete(_0x98f099,_0x33bcf6);if(_0x33bcf6['reason']==='agent'){_0x4cf199[_0x999e('0x10b')]=this[_0x999e('0xae')][_0x33bcf6['queue']]['dialQueueProject2']&&this['voiceQueues'][_0x33bcf6[_0x999e('0xaf')]]['dialAgiAfterHangupAgent']?moment()[_0x999e('0x90')](_0x999e('0x102')):undefined;}this[_0x999e('0xca')](_0x4cf199)[_0x999e('0xb6')](loggerCatch(_0x999e('0x10c')));this[_0x999e('0xc8')](_0x4cf199)[_0x999e('0xb6')](loggerCatch(_0x999e('0x10d')));}}};Dialer['prototype']['syncAgentConnect']=function(_0x1b555d){if(this[_0x999e('0xae')][_0x1b555d[_0x999e('0xaf')]]){if(this[_0x999e('0x28')][_0x1b555d['uniqueid']]&&this['uniqueId'][_0x1b555d[_0x999e('0xdb')]][_0x999e('0x4b')]!==_0x999e('0x8d')){this[_0x999e('0xb1')](this[_0x999e('0xae')][_0x1b555d['queue']]);this[_0x999e('0x28')][_0x1b555d[_0x999e('0xdb')]][_0x999e('0x10e')]=moment()['format'](_0x999e('0x102'));}}};Dialer[_0x999e('0x1d')]['queueCallerAbandonCreateState']=function(_0x483dbf){this[_0x999e('0xca')](_0x483dbf)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x999e('0xc8')](_0x483dbf)[_0x999e('0xb6')](loggerCatch(_0x999e('0x10f')));};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x530dfa){var _0x5406b9=this['uniqueId'][_0x530dfa[_0x999e('0xdb')]];var _0x3b4217=this;if(this[_0x999e('0xae')][_0x530dfa['queue']]){if(_0x5406b9&&_0x5406b9[_0x999e('0x4b')]!==_0x999e('0x8d')){delete this[_0x999e('0x28')][_0x530dfa['uniqueid']];this[_0x999e('0xb1')](this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]]);_0x5406b9[_0x999e('0x110')]=moment()[_0x999e('0x90')](_0x999e('0x102'));var _0x588651=new QueueCallerAbandon(_0x5406b9,_0x530dfa);if(getSeconds(_0x5406b9[_0x999e('0x110')],_0x5406b9['responsetime'])>=_0x5406b9[_0x999e('0x111')]){this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]][_0x999e('0x7d')]+=0x1;this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x588651[_0x999e('0xa2')]=0xa;_0x588651['statedesc']='Drop';_0x588651[_0x999e('0x112')]=_0x999e('0x113');_0x588651[_0x999e('0x10b')]=this['voiceQueues'][_0x530dfa['queue']][_0x999e('0x114')]?moment()[_0x999e('0x90')](_0x999e('0x102')):undefined;_0x588651[_0x999e('0xf2')]+=0x1;_0x588651[_0x999e('0xec')]+=0x1;if(_0x588651['countdropretry']>=this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]][_0x999e('0x115')]){this[_0x999e('0x116')](_0x588651);}else{this[_0x999e('0xbf')]({'active':![],'countdropretry':_0x588651['countdropretry'],'scheduledat':moment()[_0x999e('0xfa')](this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]][_0x999e('0x117')],'minutes')[_0x999e('0x90')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5406b9[_0x999e('0x103')],'ListId':_0x5406b9[_0x999e('0xd0')],'VoiceQueueId':_0x5406b9['VoiceQueueId']||undefined,'CampaignId':_0x5406b9['CampaignId']||undefined})[_0x999e('0xb6')](loggerCatch(_0x999e('0x118')));var _0x352660=new History(_0x588651);_0x352660[_0x999e('0xa2')]=0xa;_0x352660[_0x999e('0xa3')]='Drop';_0x352660[_0x999e('0x119')]=moment()[_0x999e('0x90')](_0x999e('0x102'));_0x352660['endtime']=_0x352660[_0x999e('0x119')];_0x352660['calleridname']=_0x588651[_0x999e('0x11a')];_0x352660[_0x999e('0x11b')]=_0x588651[_0x999e('0x11b')];this[_0x999e('0xca')](_0x352660)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]][_0x999e('0x6b')]+=0x1;this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]][_0x999e('0x62')]+=0x1;_0x588651[_0x999e('0xa2')]=0xb;_0x588651['statedesc']=_0x999e('0x11c');_0x588651['dropreason']='CALLEREXIT';_0x588651[_0x999e('0xf3')]+=0x1;_0x588651[_0x999e('0xec')]+=0x1;if(_0x588651[_0x999e('0xf3')]>=this[_0x999e('0xae')][_0x530dfa[_0x999e('0xaf')]]['dialAbandonedMaxRetry']){this[_0x999e('0x116')](_0x588651);}else{this[_0x999e('0xbf')]({'active':![],'countabandonedretry':_0x588651[_0x999e('0xf3')],'scheduledat':moment()[_0x999e('0xfa')](this['voiceQueues'][_0x530dfa[_0x999e('0xaf')]][_0x999e('0x11d')],_0x999e('0xfc'))['format'](_0x999e('0x102')),'ContactId':_0x5406b9[_0x999e('0x103')],'ListId':_0x5406b9[_0x999e('0xd0')],'VoiceQueueId':_0x5406b9[_0x999e('0xd2')]||undefined,'CampaignId':_0x5406b9['CampaignId']||undefined})[_0x999e('0xb6')](loggerCatch(_0x999e('0x11e')));var _0x352660=new History(_0x588651);_0x352660[_0x999e('0xa2')]=0xb;_0x352660[_0x999e('0xa3')]=_0x999e('0x11c');_0x352660[_0x999e('0x119')]=moment()[_0x999e('0x90')]('YYYY-MM-DD\x20HH:mm:ss');_0x352660[_0x999e('0xa4')]=_0x352660['starttime'];_0x352660['calleridname']=_0x588651[_0x999e('0x11a')];_0x352660[_0x999e('0x11b')]=_0x588651[_0x999e('0x11b')];this[_0x999e('0xca')](_0x352660)['catch'](loggerCatch(_0x999e('0x11f')));}}}}};Dialer[_0x999e('0x1d')]['syncNewExten']=function(_0x114b6d){if(this[_0x999e('0x26')][_0x114b6d[_0x999e('0xdb')]]){this[_0x999e('0x26')][_0x114b6d[_0x999e('0xdb')]]['channel']=_0x114b6d[_0x999e('0xac')];}if(this['uniqueId'][_0x114b6d[_0x999e('0xdb')]]){this[_0x999e('0x28')][_0x114b6d[_0x999e('0xdb')]][_0x999e('0xac')]=_0x114b6d[_0x999e('0xac')];}};Dialer[_0x999e('0x1d')][_0x999e('0x3b')]=function(_0x260265){if(strategy[this['voiceQueues'][this[_0x999e('0x26')][_0x260265[_0x999e('0x120')]]['queue']][_0x999e('0x4d')]]==='roundrobin'){if(this[_0x999e('0x26')][_0x260265['actionid']]&&_['isNil'](this[_0x999e('0x26')][_0x260265[_0x999e('0x120')]]['locked'])&&_0x260265[_0x999e('0xd8')]==='1'&&_0x260265[_0x999e('0x121')]==='0'){if(this[_0x999e('0x23')][_0x260265[_0x999e('0x122')]]){if(!this[_0x999e('0x23')][_0x260265[_0x999e('0x122')]][_0x999e('0x123')]){this[_0x999e('0x23')][_0x260265['stateinterface']][_0x999e('0x123')]=!![];this[_0x999e('0x26')][_0x260265['actionid']]['locked']=!![];this[_0x999e('0x26')][_0x260265['actionid']][_0x999e('0x122')]=_0x260265[_0x999e('0x122')];}}}}else if((strategy[this[_0x999e('0xae')][this[_0x999e('0x26')][_0x260265['actionid']]['queue']][_0x999e('0x4d')]]||_0x999e('0x1c'))===_0x999e('0x1c')){if(this[_0x999e('0x26')][_0x260265[_0x999e('0x120')]]){if(this[_0x999e('0x23')][_0x260265[_0x999e('0x122')]]){this[_0x999e('0x26')][_0x260265['actionid']][_0x999e('0x122')]=_0x260265[_0x999e('0x122')];if(_['isNil'](this[_0x999e('0x2c')][this[_0x999e('0x26')][_0x260265['actionid']][_0x999e('0xaf')]])){this[_0x999e('0x2c')][this[_0x999e('0x26')][_0x260265[_0x999e('0x120')]]['queue']]=[];}this[_0x999e('0x2c')][this['actions'][_0x260265[_0x999e('0x120')]][_0x999e('0xaf')]][_0x999e('0x124')](_['merge'](_['pick'](this[_0x999e('0x26')][_0x260265[_0x999e('0x120')]],['idHopper',_0x999e('0x122')]),{'status':_0x260265[_0x999e('0xd8')],'paused':_0x260265[_0x999e('0x121')]}));}}}};function unlockQueueStatus(_0x159958,_0x4cd151){setTimeout(function(){if(_[_0x999e('0x3f')](_0x159958['queueStatusComplete'])){loggerBooked[_0x999e('0x95')](_0x999e('0x125'),_0x4cd151);}_0x159958[_0x999e('0x126')]=!![];loggerBooked[_0x999e('0x77')](_0x999e('0x127'),_0x4cd151,JSON[_0x999e('0x49')](_[_0x999e('0x128')](_0x159958,[_0x999e('0x42'),_0x999e('0x126')])));},0x1f3);}Dialer['prototype']['syncQueueStatusComplete']=function(_0x5f18f4){var _0x4f6673=this;var _0x55772c=_0x4f6673[_0x999e('0xae')][_0x4f6673[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]];if(strategy[this['voiceQueues'][this['actions'][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]][_0x999e('0x4d')]]==='roundrobin'){if(this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]]&&this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0x122')]){this[_0x999e('0x21')][_0x999e('0x129')](this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0x12a')],this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0x122')])[_0x999e('0xb6')](function(_0x552331){logger[_0x999e('0x95')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x999e('0x93')](_0x552331,{'showHidden':![],'depth':null}));})[_0x999e('0x1f')](function(){_0x4f6673[_0x999e('0xb1')](_0x4f6673['voiceQueues'][_0x4f6673[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]]);_0x4f6673[_0x999e('0x23')][_0x4f6673[_0x999e('0x26')][_0x5f18f4['actionid']][_0x999e('0x122')]][_0x999e('0x123')]=![];delete _0x4f6673[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]];unlockQueueStatus(_0x55772c);});}else{this[_0x999e('0xb1')](this[_0x999e('0xae')][this[_0x999e('0x26')][_0x5f18f4['actionid']][_0x999e('0xaf')]]);this[_0x999e('0xbf')]({'active':![],'ContactId':this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0x103')],'ListId':this[_0x999e('0x26')][_0x5f18f4['actionid']]['ListId'],'VoiceQueueId':this[_0x999e('0x26')][_0x5f18f4['actionid']][_0x999e('0xd2')]||undefined,'CampaignId':this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xd3')]||undefined})['catch'](loggerCatch(_0x999e('0x12b')));delete this['actions'][_0x5f18f4[_0x999e('0x120')]];unlockQueueStatus(_0x55772c);}}else if((strategy[this[_0x999e('0xae')][this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]][_0x999e('0x4d')]]||_0x999e('0x1c'))===_0x999e('0x1c')){var _0x28a7d5;if(this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]]&&!_[_0x999e('0x48')](this[_0x999e('0x2c')][this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]]['queue']])){if(this['queueBookedRR'][_0x4f6673['actions'][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]]){this[_0x999e('0x2d')][_0x4f6673[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]]['queue']]=this[_0x999e('0x2d')][this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]]?this[_0x999e('0x2d')][this[_0x999e('0x26')][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]]:this[_0x999e('0x2c')][this[_0x999e('0x26')][_0x5f18f4['actionid']][_0x999e('0xaf')]]?this[_0x999e('0x2c')][this['actions'][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]][_0x999e('0x12c')]||0x0:0x0;}this[_0x999e('0x2c')][this['actions'][_0x5f18f4['actionid']][_0x999e('0xaf')]]['_rr']=this['queueBookedRR'][this['actions'][_0x5f18f4[_0x999e('0x120')]][_0x999e('0xaf')]];for(var _0x1df955=0x0;_0x1df955=0x0;})[_0x999e('0xb6')](myreject(_0x1055c8)));}}else{_0x53bef5[_0x999e('0x124')](ami[_0x999e('0xab')]({'action':'command','command':util['format'](_0x999e('0x144'),_0x54e401,!_[_0x999e('0x3f')](config['timezones'][_0x504de6])?_0x504de6:'')})[_0x999e('0xb5')](function(_0x4b8bec){return _0x4b8bec['content'][_0x999e('0x147')](_0x999e('0x148'))>=0x0;})['catch'](myreject(_0x1055c8)));}BPromise[_0x999e('0x149')](_0x53bef5)[_0x999e('0xb5')](function(_0x75af7e){var _0xdc3dc1=_['some'](_0x75af7e);if(_0xdc3dc1){return _0x1aeaf1(_0xdc3dc1);}else{_0xddfbad['message']=_0x4baf36?_0x999e('0x14a'):_0x999e('0x14b');return _0x1055c8(msgResponse(_0x999e('0x14c'),_0x999e('0x13f'),_0x999e('0x14d')+_0x4baf36+'\x20'+_0x612199+'\x20Interval\x20is\x20overtime:\x20'+util[_0x999e('0x93')](_0x54e401,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x504de6));}})[_0x999e('0xb6')](function(_0x345961){return _0x1055c8(msgResponse(_0x999e('0x13c'),_0x999e('0x13f'),JSON['stringify'](_0x345961)));});});};Dialer[_0x999e('0x1d')][_0x999e('0x14e')]=function(_0xf44fc5){var _0xf402b4=this;return function(){switch(_0xf44fc5[_0x999e('0x59')]){case _0x999e('0x14f'):freeVariablesPredictive(_0xf44fc5);_0xf402b4[_0x999e('0x150')](_0xf44fc5,0x1);break;case _0x999e('0x151'):freeVariablesPredictive(_0xf44fc5);_0xf402b4['handlePower'](_0xf44fc5,_0xf44fc5[_0x999e('0x152')]);break;case'predictive':_0xf402b4[_0x999e('0xa')](_0xf44fc5);break;case _0x999e('0x8'):freeVariablesPredictive(_0xf44fc5);_0xf402b4[_0x999e('0x150')](_0xf44fc5,0x1);break;default:freeVariablesPredictive(_0xf44fc5);logger['error'](_0x999e('0x153'),_0xf44fc5[_0x999e('0x42')],_0x999e('0x154'));}};};Dialer['prototype'][_0x999e('0x155')]=function(_0x45098e){var _0x3ca17e=this;return function(){_0x3ca17e[_0x999e('0x156')](_0x45098e);};};Dialer['prototype'][_0x999e('0xb')]=function(_0x1007d3){var _0x343888=this;if(isNotPreview(_0x1007d3['dialMethod'])){if(isVoiceQueueOutbound(_0x1007d3[_0x999e('0x4b')])&&isActive(_0x1007d3[_0x999e('0x157')])){_0x1007d3[_0x999e('0x9b')]=!![];BPromise[_0x999e('0xb4')]()['then'](checkIsLoggedIn(_0x1007d3,_0x1007d3[_0x999e('0x158')]))['then'](checkIsActive(_0x1007d3,_0x1007d3['dialActive']))[_0x999e('0xb5')](checkInterval(_0x1007d3))[_0x999e('0xb5')](_0x343888['checkIsTrunkReachable'](_0x1007d3))[_0x999e('0xb5')](_0x343888[_0x999e('0x13b')](_0x1007d3['dialGlobalInterval'],_0x1007d3[_0x999e('0x159')],_0x1007d3[_0x999e('0x42')],_0x1007d3))[_0x999e('0xb5')](_0x343888['checkIfTimeIntervals'](_0x1007d3[_0x999e('0x44')],_0x1007d3[_0x999e('0x159')],_0x1007d3[_0x999e('0x42')],_0x1007d3))[_0x999e('0xb5')](_0x343888['checkDialMethod'](_0x1007d3))[_0x999e('0xb6')](loggerCatchQueueSummary(_0x999e('0x15a'),_0x1007d3));}else{notSendMessagesQueue(_0x1007d3);}}else{freeVariablesPredictive(_0x1007d3);}};Dialer[_0x999e('0x1d')][_0x999e('0x137')]=function(){var _0x5254be=this;var _0x470289;for(var _0x3a2e35 in this[_0x999e('0x22')]){if(typeof this['campaigns'][_0x3a2e35]!==_0x999e('0xa8')){_0x470289=this[_0x999e('0x22')][_0x3a2e35];if(isCampaignIvr(_0x470289[_0x999e('0x4b')])&&isActive(_0x470289['active'])){_0x470289[_0x999e('0x9b')]=!![];BPromise[_0x999e('0xb4')]()[_0x999e('0xb5')](checkIsActive(_0x470289,_0x470289[_0x999e('0xd7')]))['then'](checkInterval(_0x470289))[_0x999e('0xb5')](_0x5254be[_0x999e('0x15b')](_0x470289))[_0x999e('0xb5')](_0x5254be[_0x999e('0x13b')](_0x470289[_0x999e('0x15c')],_0x470289[_0x999e('0x159')],_0x470289['name'],_0x470289))[_0x999e('0xb5')](_0x5254be[_0x999e('0x13d')](_0x470289[_0x999e('0x44')],_0x470289['dialTimezone'],_0x470289[_0x999e('0x42')],_0x470289))[_0x999e('0xb5')](_0x5254be[_0x999e('0x155')](_0x470289))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x470289));}else{notSendMessagesCampaign(_0x470289);}}}};function getCallerIdRandom(_0x1ab0a4,_0x854fa8){var _0xc823fa;var _0x1ead8a;var _0x34feb4;if(_0x854fa8<=0x0){_0x854fa8=0x1;}_0xc823fa=new RegExp(_0x999e('0x15d')+_0x854fa8+'}$');_0x1ead8a=Math[_0x999e('0x15e')](0xa,_0x854fa8-0x1);_0x34feb4=Math[_0x999e('0x15e')](0xa,_0x854fa8)-0x1;return util[_0x999e('0x90')]('%s',_[_0x999e('0x15f')](_0x1ab0a4,_0xc823fa,_[_0x999e('0x160')](_0x1ead8a,_0x34feb4)));}function extractCalleridName(_0x500708){var _0x1033bb=_0x500708[_0x999e('0x161')](/"(.*?)"/);return _0x1033bb?_0x1033bb[0x1]:_0x500708;}function extractCalleridNumber(_0x251c20){var _0xa725cb=_0x251c20[_0x999e('0x161')](/<(.*?)>/);return _0xa725cb?_0xa725cb[0x1]:_0x251c20;}Dialer[_0x999e('0x1d')][_0x999e('0x162')]=function(_0x40593d,_0x51a2a6){var _0x478edf=this;var _0x5973ad=uuid['v4']();this['actions'][_0x5973ad]=new Action(_0x40593d,_0x51a2a6,_0x5973ad);return new BPromise(function(_0x57b2ba,_0x346c03){if(_[_0x999e('0x3f')](_0x40593d)&&typeof _0x40593d!=='object'){return _0x346c03(msgResponse('originate','Failure','voiceQueue\x20is\x20undefine'));}if(_[_0x999e('0x3f')](_0x51a2a6['Contact']['phone'])||_0x51a2a6[_0x999e('0x163')][_0x999e('0x164')]===null){return _0x346c03(msgResponse(_0x999e('0x165'),_0x999e('0x13f'),'contact\x20is\x20undefine'));}var _0x9184f={'XMD-CALLERID':_0x478edf['actions'][_0x5973ad][_0x999e('0x166')](),'XMD-AGI':_0x40593d[_0x999e('0x107')]?util[_0x999e('0x90')](_0x999e('0x167'),ipAgi,_0x40593d[_0x999e('0x107')]):_0x999e('0x168'),'XMD-AGIAFTER':_0x40593d['dialQueueProject2']?util[_0x999e('0x90')](_0x999e('0x167'),ipAgi,_0x40593d[_0x999e('0x114')]):'NONE','XMD-QUEUE':_0x40593d[_0x999e('0x4b')]==='outbound'?util['format']('\x22%s,%s%s,,,%s\x22',_0x40593d[_0x999e('0x42')],_0x40593d[_0x999e('0x169')]||'',_0x40593d[_0x999e('0x16a')]?'c':'',_0x40593d[_0x999e('0x111')]||0x3):_0x999e('0x168'),'XMD-CONTACTID':_0x51a2a6[_0x999e('0x103')],'XMD-CDRTYPE':_0x999e('0x7'),'CALLERID(all)':_0x478edf[_0x999e('0x26')][_0x5973ad][_0x999e('0x166')](),'XMD-AMD':_0x40593d[_0x999e('0xe9')]?'ACTIVE':_0x999e('0x168'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x40593d[_0x999e('0xe9')]){_0x9184f[_0x999e('0x16b')]=_0x40593d[_0x999e('0x16c')]||0x9c4;_0x9184f['XMD-AMDGREETING']=_0x40593d[_0x999e('0x16d')]||0x5dc;_0x9184f['XMD-AMDAFTERGREETINGSILENCE']=_0x40593d[_0x999e('0x16e')]||0x320;_0x9184f[_0x999e('0x16f')]=_0x40593d['dialAMDTotalAnalysisTime']||0x1388;_0x9184f[_0x999e('0x170')]=_0x40593d[_0x999e('0x171')]||0x64;_0x9184f['XMD-AMDBETWEENWORDSSILENCE']=_0x40593d[_0x999e('0x172')]||0x32;_0x9184f[_0x999e('0x173')]=_0x40593d[_0x999e('0x174')]||0x3;_0x9184f[_0x999e('0x175')]=_0x40593d[_0x999e('0x176')]||0x100;_0x9184f[_0x999e('0x177')]=_0x40593d[_0x999e('0x178')]||0x1388;}if(_0x40593d[_0x999e('0x4b')]===_0x999e('0x4c')){_0x9184f[_0x999e('0x179')]=_0x51a2a6[_0x999e('0xd2')];}else{_0x9184f[_0x999e('0x17a')]=_0x51a2a6[_0x999e('0xd3')];}for(var _0xdb2c7b in _0x51a2a6['Contact']){if(typeof _0x51a2a6[_0x999e('0x163')][_0xdb2c7b]!=='undefined'){if(isNotNull(_0x51a2a6[_0x999e('0x163')][_0xdb2c7b])&&_0xdb2c7b!=='id'&&_0xdb2c7b!==_0x999e('0x17b')&&_0xdb2c7b!=='createdAt'&&_0xdb2c7b!==_0x999e('0x17c')){_0x9184f[util[_0x999e('0x90')](_0x999e('0x17d'),_0x999e('0x17e'),_['toUpper'](_0xdb2c7b))]=_0x51a2a6[_0x999e('0x163')][_0xdb2c7b];}}}var _0x27f0fc=_0x478edf[_0x999e('0x138')](_0x40593d[_0x999e('0x72')])?getCallerId(_0x40593d[_0x999e('0x72')][_0x999e('0x73')],_0x40593d['dialOriginateCallerIdName'],_0x40593d[_0x999e('0x17f')]>0x0?getCallerIdRandom(_0x40593d['dialOriginateCallerIdNumber'],_0x40593d[_0x999e('0x17f')]):_0x40593d[_0x999e('0x5b')]):getCallerId(_[_0x999e('0xaa')](_0x40593d[_0x999e('0x139')])?_0x40593d['Trunk'][_0x999e('0x73')]:_0x40593d[_0x999e('0x139')]['callerid'],_0x40593d[_0x999e('0x5a')],_0x40593d[_0x999e('0x17f')]>0x0?getCallerIdRandom(_0x40593d[_0x999e('0x5b')],_0x40593d[_0x999e('0x17f')]):_0x40593d[_0x999e('0x5b')]);if(_0x27f0fc){_0x9184f[_0x999e('0x180')]=_0x478edf[_0x999e('0x26')][_0x5973ad][_0x999e('0x181')]=extractCalleridName(_0x27f0fc);_0x9184f['XMD-ORIGINATECALLERIDNUM']=_0x478edf[_0x999e('0x26')][_0x5973ad][_0x999e('0x182')]=extractCalleridNumber(_0x27f0fc);}return ami[_0x999e('0xab')]({'actionid':_0x5973ad,'action':_0x999e('0x165'),'channel':_0x478edf[_0x999e('0x138')](_0x40593d[_0x999e('0x72')])?util[_0x999e('0x90')](_0x999e('0x183'),_0x40593d['Trunk'][_0x999e('0x42')],isNotNull(_0x40593d[_0x999e('0x184')])?_0x40593d[_0x999e('0x184')][_0x999e('0x185')]()||'':'',_0x40593d['dialCutDigit']>0x0?_0x51a2a6[_0x999e('0x163')]['phone'][_0x999e('0x186')](_0x40593d[_0x999e('0x187')]):_0x51a2a6[_0x999e('0x163')][_0x999e('0x164')]):util[_0x999e('0x90')](_0x999e('0x183'),_[_0x999e('0xaa')](_0x40593d[_0x999e('0x139')])?_0x40593d[_0x999e('0x72')]['name']:_0x40593d[_0x999e('0x139')][_0x999e('0x42')],isNotNull(_0x40593d['dialPrefix'])?_0x40593d['dialPrefix']['trim']()||'':'',_0x40593d[_0x999e('0x187')]>0x0?_0x51a2a6[_0x999e('0x163')][_0x999e('0x164')][_0x999e('0x186')](_0x40593d[_0x999e('0x187')]):_0x51a2a6[_0x999e('0x163')][_0x999e('0x164')]),'callerid':_0x27f0fc,'Exten':_0x999e('0xdf'),'Context':'from-sip','Priority':'1','variable':_0x9184f,'timeout':(_0x40593d['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5973ad})['then'](function(_0x456f2a){return _0x57b2ba(_0x456f2a);})[_0x999e('0xb6')](function(_0x26a083){_0x40593d[_0x999e('0x188')]+=0x1;var _0x39fd24=new History(_0x478edf[_0x999e('0x26')][_0x5973ad]);logger[_0x999e('0x95')](util[_0x999e('0x90')]('[originateError]:\x20%s',JSON[_0x999e('0x49')](_0x26a083)));_0x39fd24[_0x999e('0xa2')]=0xe;_0x39fd24[_0x999e('0xa3')]='OriginateError';_0x39fd24[_0x999e('0x119')]=moment()[_0x999e('0x90')]('YYYY-MM-DD\x20HH:mm:ss');_0x39fd24[_0x999e('0xa4')]=_0x39fd24[_0x999e('0x119')];_0x478edf[_0x999e('0xca')](_0x39fd24)['catch'](loggerCatch(_0x999e('0x189')));_0x478edf['moveContactManagedDialer'](_0x39fd24)['catch'](loggerCatch(_0x999e('0x189')))[_0x999e('0x1f')](function(){delete _0x478edf[_0x999e('0x26')][_0x5973ad];return _0x346c03(msgResponse(_0x999e('0x165'),_0x999e('0x18a'),_0x999e('0x18b')));});});});};Dialer[_0x999e('0x1d')][_0x999e('0x32')]=function(_0x2029c1){var _0x4bc8fa=this[_0x999e('0x26')][_0x2029c1[_0x999e('0x120')]];if(_0x4bc8fa){delete this['actions'][_0x2029c1['actionid']];_0x4bc8fa[_0x999e('0x18c')]=moment()[_0x999e('0x90')](_0x999e('0x102'));var _0x6c93d2=_0x4bc8fa[_0x999e('0x4b')]===_0x999e('0x8d')?this['campaigns'][_0x4bc8fa[_0x999e('0xaf')]]:this['voiceQueues'][_0x4bc8fa['getQueue']()];if(!this['isSuccess'](_0x2029c1['response'])){this[_0x999e('0xb1')](_0x6c93d2);return this['callProgressDetecting'](_0x4bc8fa,_0x6c93d2,_0x2029c1)[_0x999e('0xb6')](loggerCatch(_0x999e('0x18d')));}this[_0x999e('0x28')][_0x2029c1['uniqueid']]=_0x4bc8fa;}};Dialer['prototype'][_0x999e('0x18e')]=function(_0x440e1b,_0x1ca49c,_0x110f6b){var _0x19204d=new History(_0x1ca49c);if(_0x19204d[_0x999e('0xee')]+_0x19204d[_0x999e('0xef')]+_0x19204d[_0x999e('0xf0')]+_0x19204d[_0x999e('0xf1')]+_0x19204d[_0x999e('0xf2')]+_0x19204d['countabandonedretry']+_0x19204d['countmachineretry']+_0x19204d[_0x999e('0xf4')]>=_0x110f6b[_0x999e('0x101')]-0x1){return!![];}switch(_0x440e1b){case 0x3:if(_0x19204d[_0x999e('0xf0')]>=_0x110f6b[_0x999e('0x18f')]-0x1){return!![];}this[_0x999e('0xbf')]({'active':![],'countnoanswerretry':_0x19204d['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x110f6b['dialNoAnswerRetryFrequency'],'minutes')[_0x999e('0x90')](_0x999e('0x102')),'ContactId':_0x19204d[_0x999e('0x103')],'ListId':_0x19204d['ListId'],'VoiceQueueId':_0x19204d[_0x999e('0xd2')]||undefined,'CampaignId':_0x19204d[_0x999e('0xd3')]||undefined})['catch'](loggerCatch(_0x999e('0x190')));break;case 0x5:if(_0x19204d['countbusyretry']>=_0x110f6b[_0x999e('0x191')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x19204d['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x110f6b['dialBusyRetryFrequency'],'minutes')['format'](_0x999e('0x102')),'ContactId':_0x19204d[_0x999e('0x103')],'ListId':_0x19204d[_0x999e('0xd0')],'VoiceQueueId':_0x19204d['VoiceQueueId']||undefined,'CampaignId':_0x19204d[_0x999e('0xd3')]||undefined})['catch'](loggerCatch(_0x999e('0x192')));break;case 0x8:if(_0x19204d[_0x999e('0xef')]>=_0x110f6b['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x19204d[_0x999e('0xef')]+=0x1,'scheduledat':moment()[_0x999e('0xfa')](_0x110f6b[_0x999e('0x193')],_0x999e('0xfc'))[_0x999e('0x90')](_0x999e('0x102')),'ContactId':_0x19204d['ContactId'],'ListId':_0x19204d[_0x999e('0xd0')],'VoiceQueueId':_0x19204d[_0x999e('0xd2')]||undefined,'CampaignId':_0x19204d['CampaignId']||undefined})['catch'](loggerCatch(_0x999e('0x194')));break;case 0x0:if(_0x19204d[_0x999e('0xf1')]>=_0x110f6b[_0x999e('0x195')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x19204d['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x999e('0xfa')](_0x110f6b[_0x999e('0x196')],_0x999e('0xfc'))[_0x999e('0x90')](_0x999e('0x102')),'ContactId':_0x19204d['ContactId'],'ListId':_0x19204d[_0x999e('0xd0')],'VoiceQueueId':_0x19204d['VoiceQueueId']||undefined,'CampaignId':_0x19204d['CampaignId']||undefined})['catch'](loggerCatch(_0x999e('0x197')));}break;case 0xa:if(_0x19204d[_0x999e('0xf2')]>=_0x110f6b[_0x999e('0x115')]-0x1){return!![];}this[_0x999e('0xbf')]({'active':![],'countdropretry':_0x19204d[_0x999e('0xf2')]+=0x1,'scheduledat':moment()['add'](_0x110f6b['dialDropRetryFrequency'],'minutes')[_0x999e('0x90')](_0x999e('0x102')),'ContactId':_0x19204d['ContactId'],'ListId':_0x19204d[_0x999e('0xd0')],'VoiceQueueId':_0x19204d[_0x999e('0xd2')]||undefined,'CampaignId':_0x19204d[_0x999e('0xd3')]||undefined})[_0x999e('0xb6')](loggerCatch(_0x999e('0x118')));break;case 0xb:if(_0x19204d[_0x999e('0xf3')]>=_0x110f6b[_0x999e('0x198')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x19204d['countabandonedretry']+=0x1,'scheduledat':moment()[_0x999e('0xfa')](_0x110f6b[_0x999e('0x11d')],_0x999e('0xfc'))['format'](_0x999e('0x102')),'ContactId':_0x19204d[_0x999e('0x103')],'ListId':_0x19204d[_0x999e('0xd0')],'VoiceQueueId':_0x19204d[_0x999e('0xd2')]||undefined,'CampaignId':_0x19204d['CampaignId']||undefined})[_0x999e('0xb6')](loggerCatch(_0x999e('0x11e')));break;case 0x13:if(_0x19204d[_0x999e('0xeb')]>=_0x110f6b[_0x999e('0xf7')]-0x1){return!![];}this[_0x999e('0xbf')]({'active':![],'countmachineretry':_0x19204d[_0x999e('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x110f6b[_0x999e('0xfb')],_0x999e('0xfc'))['format'](_0x999e('0x102')),'ContactId':_0x19204d[_0x999e('0x103')],'ListId':_0x19204d[_0x999e('0xd0')],'VoiceQueueId':_0x19204d[_0x999e('0xd2')]||undefined,'CampaignId':_0x19204d[_0x999e('0xd3')]||undefined})['catch'](loggerCatch(_0x999e('0xfd')));break;case 0x14:if(_0x19204d[_0x999e('0xf4')]>=_0x110f6b['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x999e('0xbf')]({'active':![],'countagentrejectretry':_0x19204d[_0x999e('0xf4')]+=0x1,'scheduledat':moment()[_0x999e('0xfa')](_0x110f6b[_0x999e('0x199')],'minutes')[_0x999e('0x90')](_0x999e('0x102')),'ContactId':_0x19204d[_0x999e('0x103')],'ListId':_0x19204d[_0x999e('0xd0')],'VoiceQueueId':_0x19204d['VoiceQueueId']||undefined,'CampaignId':_0x19204d[_0x999e('0xd3')]||undefined})[_0x999e('0xb6')](loggerCatch(_0x999e('0x19a')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x28fd86,_0x1e7f74,_0x1c46e5){var _0x53be45=this;var _0x44b897=new History(_0x28fd86);return new BPromise(function(_0x1e6b8c,_0x32900b){if(_[_0x999e('0x3f')](_0x1e7f74)&&typeof _0x1e7f74!=='object'){return _0x32900b(msgResponse(_0x999e('0x19b'),_0x999e('0x13f'),_0x999e('0x19c')));}if(_[_0x999e('0x3f')](_0x1c46e5)&&typeof _0x1c46e5!==_0x999e('0x19d')){return _0x32900b(msgResponse('[callProgressDetecting]',_0x999e('0x13f'),_0x999e('0x19e')));}switch(_0x1c46e5['reason']){case'0':_0x1e7f74[_0x999e('0x65')]+=0x1;_0x44b897[_0x999e('0xa2')]=0x0;_0x44b897[_0x999e('0xa3')]='NoSuchNumber';_0x44b897[_0x999e('0xf1')]+=0x1;_0x44b897[_0x999e('0xec')]+=0x1;ami[_0x999e('0xe4')](_0x999e('0x19f'),ut[_0x999e('0x100')](_0x28fd86,_0x999e('0x1a0')));_0x53be45[_0x999e('0xca')](_0x44b897)['catch'](loggerCatch(_0x999e('0xed')));if(_0x53be45['checkRetriveMax'](0x0,_0x28fd86,_0x1e7f74)){if(_0x44b897['countnosuchnumberretry']>=_0x1e7f74['dialNoSuchNumberMaxRetry']){_0x53be45['createStateFinal'](_0x44b897,_0x1e6b8c,_0x32900b,'reason\x200\x20no\x20such\x20number....');}else{_0x53be45['stateGlobal'](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1a1'));}}break;case'3':_0x1e7f74[_0x999e('0x64')]+=0x1;_0x44b897['state']=0x3;_0x44b897[_0x999e('0xa3')]='NoAnswer';_0x44b897[_0x999e('0xf0')]+=0x1;_0x44b897['countglobal']+=0x1;ami[_0x999e('0xe4')](_0x999e('0x1a2'),ut['buildObj'](_0x28fd86,'noanswer'));_0x53be45[_0x999e('0xca')](_0x44b897)[_0x999e('0xb6')](loggerCatch(_0x999e('0x1a3')));if(_0x53be45[_0x999e('0x18e')](0x3,_0x28fd86,_0x1e7f74)){if(_0x44b897['countnoanswerretry']>=_0x1e7f74[_0x999e('0x18f')]){_0x53be45[_0x999e('0xf8')](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1a4'));}else{_0x53be45[_0x999e('0xf5')](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1a4'));}}break;case'5':_0x1e7f74[_0x999e('0x5f')]+=0x1;_0x44b897[_0x999e('0xa2')]=0x5;_0x44b897['statedesc']=_0x999e('0x1a5');_0x44b897[_0x999e('0xee')]+=0x1;_0x44b897['countglobal']+=0x1;ami[_0x999e('0xe4')]('custom:agentbusy',ut['buildObj'](_0x28fd86,_0x999e('0x1a6')));_0x53be45[_0x999e('0xca')](_0x44b897)[_0x999e('0xb6')](loggerCatch(_0x999e('0x1a7')));if(_0x53be45[_0x999e('0x18e')](0x5,_0x28fd86,_0x1e7f74)){if(_0x44b897[_0x999e('0xee')]>=_0x1e7f74['dialBusyMaxRetry']){_0x53be45[_0x999e('0xf8')](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1a8'));}else{_0x53be45[_0x999e('0xf5')](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1a8'));}}break;case'8':_0x1e7f74[_0x999e('0x60')]+=0x1;_0x44b897['state']=0x8;_0x44b897[_0x999e('0xa3')]='Congestion';_0x44b897['countcongestionretry']+=0x1;_0x44b897[_0x999e('0xec')]+=0x1;ami[_0x999e('0xe4')](_0x999e('0x1a9'),ut[_0x999e('0x100')](_0x28fd86,'congestion'));_0x53be45[_0x999e('0xca')](_0x44b897)[_0x999e('0xb6')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x53be45[_0x999e('0x18e')](0x8,_0x28fd86,_0x1e7f74)){if(_0x44b897[_0x999e('0xef')]>=_0x1e7f74[_0x999e('0x1aa')]){_0x53be45[_0x999e('0xf8')](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1ab'));}else{_0x53be45[_0x999e('0xf5')](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1ab'));}}break;case'11':_0x1e7f74['outboundAbandonedCallsDay']+=0x1;_0x44b897[_0x999e('0xa2')]=0xb;_0x44b897[_0x999e('0xa3')]='Abandoned';_0x44b897[_0x999e('0xf3')]+=0x1;_0x44b897['countglobal']+=0x1;_0x53be45[_0x999e('0xca')](_0x44b897)['catch'](loggerCatch(_0x999e('0x11f')));if(_0x53be45['checkRetriveMax'](0xb,_0x28fd86,_0x1e7f74)){if(_0x44b897['countabandonedretry']>=_0x1e7f74[_0x999e('0x198')]){_0x53be45[_0x999e('0xf8')](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1ac'));}else{_0x53be45[_0x999e('0xf5')](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1ac'));}}break;case'20':_0x1e7f74[_0x999e('0x66')]+=0x1;_0x44b897[_0x999e('0xa2')]=0x14;_0x44b897[_0x999e('0xa3')]=_0x999e('0x1ad');_0x44b897[_0x999e('0xf4')]+=0x1;_0x44b897[_0x999e('0xec')]+=0x1;ami['emit']('custom:agentreject',ut['buildObj'](_0x28fd86,_0x999e('0x1ae')));_0x53be45[_0x999e('0xca')](_0x44b897)['catch'](loggerCatch(_0x999e('0x1af')));if(_0x53be45['checkRetriveMax'](0x14,_0x28fd86,_0x1e7f74)){if(_0x44b897['countagentrejectretry']>=_0x1e7f74[_0x999e('0x1b0')]){_0x53be45[_0x999e('0xf8')](_0x44b897,_0x1e6b8c,_0x32900b,'reason\x2020\x20agentreject');}else{_0x53be45['stateGlobal'](_0x44b897,_0x1e6b8c,_0x32900b,_0x999e('0x1b1'));}}break;default:_0x1e7f74[_0x999e('0x67')]+=0x1;_0x44b897[_0x999e('0xa2')]=0xc;_0x44b897[_0x999e('0xa3')]=_0x1c46e5[_0x999e('0x1b2')];_0x53be45[_0x999e('0xca')](_0x44b897)[_0x999e('0xb6')](loggerCatch(_0x999e('0x1b3')));if(_0x53be45[_0x999e('0x18e')](_0x1c46e5[_0x999e('0x1b2')],_0x28fd86,_0x1e7f74)){if(_0x44b897[_0x999e('0xee')]+_0x44b897[_0x999e('0xef')]+_0x44b897[_0x999e('0xf0')]+_0x44b897['countnosuchnumberretry']+_0x44b897[_0x999e('0xf2')]+_0x44b897[_0x999e('0xf3')]+_0x44b897[_0x999e('0xeb')]+_0x44b897[_0x999e('0xf4')]>=_0x1e7f74['dialGlobalMaxRetry']){_0x53be45[_0x999e('0xf5')](_0x44b897,_0x1e6b8c,_0x32900b,_0x1c46e5['reason']);}else{_0x53be45[_0x999e('0xf8')](_0x44b897,_0x1e6b8c,_0x32900b,_0x1c46e5[_0x999e('0x1b2')]);}}}});};Dialer[_0x999e('0x1d')][_0x999e('0xf5')]=function(_0xd56a5c,_0x1e3f51,_0x55ba5b,_0x4d82ae){var _0x47707f=new Final(_0xd56a5c);_0x47707f[_0x999e('0xa2')]=0xf;_0x47707f['statedesc']=_0x999e('0x1b4');this[_0x999e('0xf8')](_0x47707f,_0x1e3f51,_0x55ba5b,_0x4d82ae);};Dialer['prototype'][_0x999e('0xf8')]=function(_0x2e401d,_0x6bb222,_0x29b14a,_0x3c9505){this['moveContactManagedDialer'](_0x2e401d)[_0x999e('0xb5')](function(){return _0x6bb222(msgResponse(_0x999e('0x19b'),_0x999e('0xd6'),_0x3c9505));})[_0x999e('0xb6')](function(){return _0x29b14a(msgResponse(_0x999e('0x1b5'),_0x999e('0x13f'),_0x999e('0x1b6')));});};Dialer[_0x999e('0x1d')][_0x999e('0xa')]=function(_0x5bf558){var _0x39ed50=_0x5bf558[_0x999e('0x1b7')]/0x64;var _0x1500c6=_0x5bf558[_0x999e('0x63')]/(_0x5bf558[_0x999e('0x63')]+_0x5bf558[_0x999e('0x5d')]);var _0x270e47=Math[_0x999e('0x1b8')](_0x5bf558[_0x999e('0x1b9')]*(_0x5bf558[_0x999e('0x1ba')]/0x64));var _0xd36faf=Math[_0x999e('0x1b8')](_0x5bf558[_0x999e('0x1b9')]*(_0x5bf558[_0x999e('0x1bb')]/0x64));var _0x35a1bc=_0x5bf558[_0x999e('0x4f')]+_0x5bf558[_0x999e('0x9c')];var _0x2b2e63=Math[_0x999e('0x1bc')](_0x5bf558[_0x999e('0x6f')]*_0x5bf558['erlangAbandonmentRate']*_0x5bf558[_0x999e('0x1bd')]*_0x5bf558[_0x999e('0x6d')]);if(_['isUndefined'](_0x5bf558['startProgressive'])){if(!_['isUndefined'](_0x5bf558[_0x999e('0x29')])){_0x5bf558['startPredictive']=undefined;loggerPredictive[_0x999e('0x95')](_0x999e('0x1be'),_0x999e('0x1bf'));}if(!_[_0x999e('0x3f')](_0x5bf558['handlePredictive'])){loggerPredictive[_0x999e('0x95')]('[startMethodPredictive][StartProgressive]',_0x999e('0x1c0'));clearInterval(_0x5bf558[_0x999e('0x8b')]);_0x5bf558[_0x999e('0x8b')]=undefined;}_0x5bf558['startProgressive']=moment()[_0x999e('0x90')](_0x999e('0x102'));loggerPredictive[_0x999e('0x77')](_0x5bf558[_0x999e('0x42')],_0x999e('0x1c1'),_0x5bf558[_0x999e('0x2a')]);this[_0x999e('0x150')](_0x5bf558,0x1);}else if(ifInterval(_0x5bf558[_0x999e('0x1c2')],_0x5bf558[_0x999e('0x2a')])){this[_0x999e('0x150')](_0x5bf558,0x1);loggerPredictiveCalls['info'](_0x999e('0x1c3'),_0x5bf558[_0x999e('0x2a')],_0x5bf558['name']);_0x5bf558['erlangCalls']=0x0;_0x5bf558[_0x999e('0x1c4')]=0x0;}else if(_0x39ed50<_0x1500c6&&_0x5bf558[_0x999e('0x1c5')]===_0x999e('0x1c6')){freeVariablesPredictive(_0x5bf558);loggerPredictive[_0x999e('0x77')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x999e('0x1c7'),_0x1500c6,'startProgressive',_0x5bf558[_0x999e('0x42')]);}else if(_0x2b2e63<_0x5bf558[_0x999e('0x1c4')]&&_0x5bf558['dialPredictiveOptimization']===_0x999e('0x1c6')){freeVariablesPredictive(_0x5bf558);loggerPredictive['info'](_0x999e('0x1c8'),'Max\x20Drop\x20',_0x2b2e63,'Drop\x20in\x20this\x20interval',_0x5bf558['predictiveIntervalErlangCallsDroppedCalls'],_0x999e('0x2a'),_0x5bf558[_0x999e('0x42')]);}else if(!ifInterval(_0x5bf558[_0x999e('0x1c2')],_0x5bf558['startProgressive'])&&_['isUndefined'](_0x5bf558[_0x999e('0x29')])&&!_[_0x999e('0x3f')](_0x5bf558[_0x999e('0x2a')])){_0x5bf558[_0x999e('0x29')]=moment()[_0x999e('0x90')](_0x999e('0x102'));loggerPredictive[_0x999e('0x77')](_0x5bf558['name'],_0x999e('0x1c9'),_0x5bf558[_0x999e('0x29')]);this['averageHandleTime'](_0x5bf558['dialPredictiveInterval'])[_0x999e('0xb5')](this[_0x999e('0x1ca')](_0x5bf558))[_0x999e('0xb5')](mergeDataErlangB(_0x5bf558))[_0x999e('0xb5')](this['startMethodPredictive'](_0x5bf558))[_0x999e('0xb6')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x5bf558));}else if(!ifInterval(_0x5bf558[_0x999e('0x1c2')],_0x5bf558['startPredictive'])){_0x5bf558['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x5bf558['startPredictive']=moment()[_0x999e('0x90')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x999e('0x77')](_0x5bf558['name'],'recalculate\x20predictive\x20at',_0x5bf558[_0x999e('0x29')]);clearInterval(_0x5bf558[_0x999e('0x8b')]);_0x5bf558[_0x999e('0x8b')]=undefined;this['averageHandleTime'](_0x5bf558['dialPredictiveInterval'])['then'](this[_0x999e('0x1ca')](_0x5bf558))[_0x999e('0xb5')](mergeDataErlangB(_0x5bf558))[_0x999e('0xb5')](this[_0x999e('0x1cb')](_0x5bf558))[_0x999e('0xb6')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x5bf558));}else if(_0x5bf558[_0x999e('0x1b9')]&&_0x35a1bc<_0x5bf558[_0x999e('0x1b9')]-_0xd36faf){freeVariablesPredictive(_0x5bf558);loggerPredictive[_0x999e('0x77')](_0x5bf558[_0x999e('0x42')],_0x999e('0x1cc'),_0x35a1bc,_0x999e('0x1cd'),_0x5bf558[_0x999e('0x1b9')],'-',_0xd36faf,'=',_0x5bf558[_0x999e('0x1b9')]-_0xd36faf,')');}else if(_0x5bf558[_0x999e('0x1b9')]&&_0x35a1bc>_0x5bf558[_0x999e('0x1b9')]+_0x270e47){freeVariablesPredictive(_0x5bf558);loggerPredictive[_0x999e('0x77')](_0x5bf558[_0x999e('0x42')],_0x999e('0x1cc'),_0x35a1bc,')\x20are\x20more\x20than\x20threshold\x20(',_0x5bf558['predictiveIntervalAvailable'],'+',_0x270e47,'=',_0x5bf558['predictiveIntervalAvailable']+_0x270e47,')');}};Dialer[_0x999e('0x1d')][_0x999e('0x1ca')]=function(_0x1cb962){var _0x1f7ee9=this;return function(_0x3e166e){return new BPromise(function(_0x1abc31,_0x448a79){_[_0x999e('0xcf')](_0x1cb962,_0x3e166e[0x0]);if(checkGetDataPredictive(_0x3e166e[0x0])){var _0x3e3e12=_0x1cb962[_0x999e('0x1b9')]=_0x1cb962[_0x999e('0x9c')]+_0x1cb962[_0x999e('0x4f')];var _0x31f375=_0x1cb962['dialPredictiveInterval']*0x3c;var _0x167eeb=_0x3e166e[0x0][_0x999e('0x6a')]+_0x3e166e[0x0][_0x999e('0x69')];var _0x3e97ce=(_0x3e166e[0x0][_0x999e('0x68')]+_0x3e166e[0x0][_0x999e('0x7d')]+_0x3e166e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3e166e[0x0][_0x999e('0x7a')];_0x1cb962[_0x999e('0x1bd')]=_0x3e97ce>0x0?_0x3e97ce:0x1;switch(_0x1cb962[_0x999e('0x1c5')]){case _0x999e('0x1c6'):var _0x3b502f=_0x1cb962['dialPredictiveOptimizationPercentage']/0x64;return _0x1f7ee9[_0x999e('0x1ce')](_0x3e3e12,_0x31f375,_0x167eeb,_0x3e97ce,_0x3b502f)[_0x999e('0xb5')](function(_0x4328ec){return _0x1abc31(_0x4328ec);});case _0x999e('0x1cf'):var _0x49c278=_0x1cb962[_0x999e('0x1b7')]/0x64;return _0x1f7ee9[_0x999e('0x1d0')](_0x3e3e12,_0x31f375,_0x167eeb,_0x3e97ce,_0x49c278)[_0x999e('0xb5')](function(_0x9fc693){return _0x1abc31(_0x9fc693);});default:return _0x448a79(msgResponse(_0x999e('0x1d1'),_0x999e('0x13f'),_0x999e('0x1d2')));}}else{return _0x448a79(msgResponse(_0x999e('0x1d1'),'Failure',_0x999e('0x1d3')));}});};};Dialer['prototype'][_0x999e('0x1d4')]=function(_0xe5c22b){var _0xc79b3=this;return function(_0x33ccc5){return new BPromise(function(_0x5875ab,_0x364d5a){_['merge'](_0xe5c22b,_0x33ccc5[0x0]);if(checkGetDataPredictive(_0x33ccc5[0x0])){loggerPredictive[_0x999e('0x77')](JSON['stringify'](_0x33ccc5[0x0]));if(_0xe5c22b[_0x999e('0x1c5')]===_0x999e('0x1c6')){return _0xc79b3[_0x999e('0xc6')](_0xe5c22b['id'])[_0x999e('0xb5')](function(_0x38b372){var _0x1989e3=_0xe5c22b['loggedIn']-_0x38b372[0x0][_0x999e('0x1d5')];var _0x5d11fd=_0xe5c22b['dialPredictiveInterval']*0x3c;var _0x5e156b=_0x33ccc5[0x0][_0x999e('0x6a')]+_0x33ccc5[0x0][_0x999e('0x69')];var _0x574625=(_0x33ccc5[0x0][_0x999e('0x68')]+_0x33ccc5[0x0][_0x999e('0x7d')]+_0x33ccc5[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x33ccc5[0x0][_0x999e('0x7a')];var _0x31ce71=_0xe5c22b[_0x999e('0x1b7')]/0x64;_0xe5c22b[_0x999e('0x1d6')]=_0x38b372[0x0][_0x999e('0x1d5')]||0x0;_0xe5c22b[_0x999e('0x1bd')]=_0x574625>0x0?_0x574625:0x1;return _0xc79b3[_0x999e('0x1ce')](_0x1989e3,_0x5d11fd,_0x5e156b,_0x574625,_0x31ce71);})[_0x999e('0xb5')](function(_0x116da7){return _0x5875ab(_0x116da7);})[_0x999e('0xb6')](function(_0x11e71c){return _0x364d5a(msgResponse(_0x999e('0x1d7'),_0x999e('0x13f'),JSON[_0x999e('0x49')](_0x11e71c)));});}if(_0xe5c22b[_0x999e('0x1c5')]===_0x999e('0x1cf')){return _0xc79b3[_0x999e('0xc6')](_0xe5c22b['id'])[_0x999e('0xb5')](function(_0x482190){var _0x4442cf=_0xe5c22b['loggedIn']-_0x482190[0x0][_0x999e('0x1d5')];var _0x8431aa=_0xe5c22b[_0x999e('0x1c2')]*0x3c;var _0x41d0bd=_0x33ccc5[0x0][_0x999e('0x6a')]+_0x33ccc5[0x0][_0x999e('0x69')];var _0x3fbdb5=(_0x33ccc5[0x0][_0x999e('0x68')]+_0x33ccc5[0x0][_0x999e('0x7d')]+_0x33ccc5[0x0][_0x999e('0x6b')])/_0x33ccc5[0x0][_0x999e('0x7a')];var _0x5a17f1=_0xe5c22b[_0x999e('0x1b7')]/0x64;_0xe5c22b[_0x999e('0x1d6')]=_0x482190[0x0][_0x999e('0x1d5')]||0x0;_0xe5c22b[_0x999e('0x1bd')]=_0x3fbdb5>0x0?_0x3fbdb5:0x1;return _0xc79b3[_0x999e('0x1d0')](_0x4442cf,_0x8431aa,_0x41d0bd,_0x3fbdb5,_0x5a17f1);})[_0x999e('0xb5')](function(_0x17fb01){return _0x5875ab(_0x17fb01);})[_0x999e('0xb6')](function(_0x4072ae){return _0x364d5a(msgResponse(_0x999e('0x1d7'),_0x999e('0x13f'),JSON[_0x999e('0x49')](_0x4072ae)));});}}else{return _0x364d5a(msgResponse(_0x999e('0x1d1'),'Failure',_0x999e('0x1d3')));}});};};Dialer[_0x999e('0x1d')][_0x999e('0x1cb')]=function(_0x412609){var _0x53bd63=this;return function(){var _0x1ffc5e=0x0;var _0x3269b9=Math[_0x999e('0x1bc')](_0x412609[_0x999e('0x86')]*0x3e8);if(_0x3269b9>0x0){_0x3269b9=_0x3269b9<0x64?0x64:_0x3269b9;loggerPredictive[_0x999e('0x77')](_0x412609[_0x999e('0x42')],_0x999e('0x1d8'),_0x3269b9,_0x999e('0x89'));_0x412609['handlePredictive']=setInterval(function(){_0x53bd63[_0x999e('0x8b')](_0x412609);loggerPredictiveCalls[_0x999e('0x77')](_0x999e('0x1d9'),_0x1ffc5e+=0x1);},_0x3269b9);}else{loggerPredictive[_0x999e('0x77')](_0x412609[_0x999e('0x42')],_0x999e('0x1da'));}};};Dialer[_0x999e('0x1d')]['checkContactBlack']=function(_0x25ea92,_0x325ab3){var _0x4e7602=this;return function(_0x54569b){if(_[_0x999e('0x48')](_0x54569b)){if(_[_0x999e('0xaa')](_0x325ab3[_0x999e('0xd1')])||!_0x325ab3[_0x999e('0x1db')]){if(_0x25ea92['dialMethod']===_0x999e('0x8')){_0x25ea92[_0x999e('0x126')]=_[_0x999e('0x3f')](_0x25ea92[_0x999e('0x126')])?!![]:_0x25ea92['queueStatusComplete'];var _0x1ac2d2=uuid['v4']();_0x4e7602[_0x999e('0x26')][_0x1ac2d2]=new Action(_0x25ea92,_0x325ab3,_0x1ac2d2);loggerBooked[_0x999e('0x77')](_0x999e('0x1dc'),_0x1ac2d2,_0x999e('0x1dd'),JSON[_0x999e('0x49')](_0x25ea92['queueStatusComplete']),_0x999e('0x1de'),_0x25ea92['name']);if(_0x25ea92[_0x999e('0x126')]){_0x25ea92[_0x999e('0x126')]=![];_0x4e7602['queueBooked'][_0x4e7602[_0x999e('0x26')][_0x1ac2d2][_0x999e('0xaf')]]=[];ami['Action']({'actionid':_0x1ac2d2,'action':'queuestatus','queue':_0x25ea92[_0x999e('0x42')]})[_0x999e('0xb6')](function(){_0x4e7602[_0x999e('0xb1')](_0x25ea92);_0x4e7602['rescheduleContact']({'active':![],'ContactId':_0x4e7602[_0x999e('0x26')][_0x1ac2d2][_0x999e('0x103')],'ListId':_0x4e7602[_0x999e('0x26')][_0x1ac2d2]['ListId'],'VoiceQueueId':_0x4e7602['actions'][_0x1ac2d2]['VoiceQueueId']||undefined,'CampaignId':_0x4e7602[_0x999e('0x26')][_0x1ac2d2]['CampaignId']||undefined})[_0x999e('0xb6')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4e7602[_0x999e('0x26')][_0x1ac2d2];});}else{loggerBooked[_0x999e('0x77')](_0x999e('0x1df'),JSON[_0x999e('0x49')](_0x25ea92[_0x999e('0x126')]),'Queue:\x20',_0x25ea92['name']);_0x4e7602[_0x999e('0xb1')](_0x25ea92);_0x4e7602[_0x999e('0xbf')]({'active':![],'ContactId':_0x4e7602[_0x999e('0x26')][_0x1ac2d2][_0x999e('0x103')],'ListId':_0x4e7602[_0x999e('0x26')][_0x1ac2d2][_0x999e('0xd0')],'VoiceQueueId':_0x4e7602[_0x999e('0x26')][_0x1ac2d2][_0x999e('0xd2')]||undefined,'CampaignId':_0x4e7602[_0x999e('0x26')][_0x1ac2d2][_0x999e('0xd3')]||undefined})[_0x999e('0xb6')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4e7602[_0x999e('0x26')][_0x1ac2d2];}}else{return _0x4e7602[_0x999e('0x162')](_0x25ea92,_0x325ab3);}}else{if(getDiff(_0x325ab3['scheduledat'])<_0x25ea92[_0x999e('0x1e0')]*0x3c){if(_0x325ab3['Agent']&&!_0x325ab3[_0x999e('0x1e1')][_0x999e('0x1e2')]){_0x4e7602[_0x999e('0x21')][_0x999e('0x129')](_0x325ab3['id'])[_0x999e('0x1f')](function(){_0x4e7602[_0x999e('0xb1')](_0x25ea92);});}else{_0x4e7602[_0x999e('0xc0')]({'active':![]},_0x325ab3['id'],0x1)['finally'](function(){_0x4e7602[_0x999e('0xb1')](_0x25ea92);});}}else{_0x25ea92['outboundReCallsDay']+=0x1;_0x4e7602['updateOriginated'](_0x25ea92);if(_0x25ea92[_0x999e('0x1e3')]){_0x4e7602['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x325ab3[_0x999e('0x103')],'ListId':_0x325ab3[_0x999e('0xd0')],'VoiceQueueId':_0x325ab3[_0x999e('0xd2')]||undefined,'CampaignId':_0x325ab3[_0x999e('0xd3')]||undefined})[_0x999e('0xb6')](loggerCatch(_0x999e('0x1e4')));_0x4e7602[_0x999e('0xca')](createObjHistory(_0x25ea92,_0x325ab3,'RECALLINQUEUE',0x17,_0x999e('0x1e5')))[_0x999e('0xb6')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x4e7602[_0x999e('0xce')](createObjHistory(_0x25ea92,_0x325ab3,_0x999e('0x1e6'),0x16,'RecallFailedTimeout'),_0x999e('0x1e7'),_0x999e('0x1e8'));}}}}else{_0x25ea92[_0x999e('0x5e')]+=0x1;_0x4e7602[_0x999e('0xce')](createObjHistory(_0x25ea92,_0x325ab3,_0x999e('0x1e9'),0xd,_0x999e('0x1ea')),'[Originate][historyBlacklist]',_0x999e('0x1eb'));throw _0x999e('0x1ec');}};};Dialer[_0x999e('0x1d')][_0x999e('0x156')]=function(_0x50987f){var _0x3c0009=this;var _0x2cec45=_0x50987f[_0x999e('0x1ed')]-_0x50987f[_0x999e('0x6e')]-_0x50987f[_0x999e('0xc3')];emitCampaignSummary(_0x50987f);if(_0x2cec45>0x0){if(_0x2cec45>this[_0x999e('0x25')]){_0x2cec45=this['maxNumberOriginate'];}_0x50987f[_0x999e('0xc3')]+=_0x2cec45;this[_0x999e('0xc5')](_0x50987f['id'],_0x2cec45,_0x50987f['dialOrderByScheduledAt'],_0x50987f)[_0x999e('0xb5')](function(_0x5eb555){_0x50987f[_0x999e('0xc3')]-=_0x2cec45;_0x50987f[_0x999e('0xc3')]=_0x50987f[_0x999e('0xc3')]>0x0?_0x50987f[_0x999e('0xc3')]:0x0;if(!checkContactEmpty(_0x5eb555)){_0x50987f['message']='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x999e('0x1ee')+_0x50987f['name']);}else{_0x50987f['originated']+=_0x5eb555[_0x999e('0x94')];_0x50987f[_0x999e('0x40')]=_0x999e('0x1ef');for(var _0x1fd074=0x0;_0x1fd074<_0x5eb555['length'];_0x1fd074+=0x1){_0x50987f[_0x999e('0x1f0')]+=0x1;if(_[_0x999e('0xaa')](_0x5eb555[_0x1fd074])||_['isNil'](_0x5eb555[_0x1fd074][_0x999e('0x163')])||_[_0x999e('0xaa')](_0x5eb555[_0x1fd074][_0x999e('0x163')][_0x999e('0x164')])){_0x3c0009['emptyContact'](_0x999e('0x1f1'),_0x50987f,_0x5eb555[_0x1fd074]);}else{_0x3c0009[_0x999e('0xba')](_[_0x999e('0x128')](_0x5eb555[_0x1fd074],[_0x999e('0xd3'),_0x999e('0x1f2')]))[_0x999e('0xb5')](_0x3c0009[_0x999e('0x1f3')](_0x50987f,_0x5eb555[_0x1fd074]))[_0x999e('0xb6')](_0x3c0009['loggerHandler'](_0x999e('0x1f4'),_0x50987f));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x50987f,_0x2cec45));}};Dialer[_0x999e('0x1d')][_0x999e('0x150')]=function(_0x5ccd78,_0x145e94){var _0x36bd8d=this;var _0x2f5632=[];var _0x18a556=_0x145e94>=0x1?_0x145e94:0x1;if(_0x5ccd78[_0x999e('0x59')]===_0x999e('0x8')){_0x18a556=0x1;}var _0x3d2fa6=Math['floor'](_0x5ccd78[_0x999e('0x4f')]*_0x18a556)-_0x5ccd78[_0x999e('0x6e')]-_0x5ccd78[_0x999e('0xc3')];emitVoiceQueueSummary(_0x5ccd78);if(_0x5ccd78[_0x999e('0x1f5')]>0x0){var _0x57d318=_0x5ccd78['dialLimitQueue']-_0x5ccd78[_0x999e('0x6e')]-_0x5ccd78[_0x999e('0x9c')]-_0x5ccd78['temp']-_0x5ccd78[_0x999e('0x50')];if(_0x3d2fa6>_0x57d318){_0x3d2fa6=_0x57d318;}}if(_0x3d2fa6>0x0){if(_0x5ccd78[_0x999e('0x59')]===_0x999e('0x8')){_0x3d2fa6=0x1;}if(_0x3d2fa6>this['maxNumberOriginate']){_0x3d2fa6=this[_0x999e('0x25')];}_0x5ccd78[_0x999e('0xc3')]+=_0x3d2fa6;for(var _0x50eaa0 in this[_0x999e('0x23')]){if(typeof this['agents'][_0x50eaa0]!==_0x999e('0xa8')){if(this['agents'][_0x50eaa0]['state']==='not_inuse'&&this[_0x999e('0x23')][_0x50eaa0][_0x999e('0xd8')]===_0x999e('0xd9')){_0x2f5632[_0x999e('0x124')](this['agents'][_0x50eaa0]['id']);}}}this[_0x999e('0xc2')](_0x5ccd78['id'],_0x2f5632,_0x3d2fa6,_0x5ccd78['dialOrderByScheduledAt'],_0x5ccd78)[_0x999e('0xb5')](function(_0x13e3cb){_0x5ccd78[_0x999e('0xc3')]-=_0x3d2fa6;_0x5ccd78[_0x999e('0xc3')]=_0x5ccd78[_0x999e('0xc3')]>0x0?_0x5ccd78[_0x999e('0xc3')]:0x0;if(!checkContactEmpty(_0x13e3cb)){_0x36bd8d[_0x999e('0xb3')](_0x5ccd78)[_0x999e('0xb5')](sendMessageReschedule(_0x5ccd78))['catch'](loggerCatch(_0x999e('0xb7')));}else{_0x5ccd78['originated']+=_0x13e3cb[_0x999e('0x94')];_0x5ccd78[_0x999e('0x40')]=_0x5ccd78[_0x999e('0x59')]===_0x999e('0x8')?_0x999e('0x1f6'):'RUNNING';for(var _0x241fb0=0x0;_0x241fb0<_0x13e3cb['length'];_0x241fb0+=0x1){if(_[_0x999e('0xaa')](_0x13e3cb[_0x241fb0])||_[_0x999e('0xaa')](_0x13e3cb[_0x241fb0][_0x999e('0x163')])||_['isNil'](_0x13e3cb[_0x241fb0]['Contact'][_0x999e('0x164')])){_0x36bd8d['emptyContact'](_0x999e('0x1f1'),_0x5ccd78,_0x13e3cb[_0x241fb0]);}else{_0x36bd8d[_0x999e('0xb8')](_['pick'](_0x13e3cb[_0x241fb0],['VoiceQueueId',_0x999e('0x1f2')]))[_0x999e('0xb5')](_0x36bd8d[_0x999e('0x1f3')](_0x5ccd78,_0x13e3cb[_0x241fb0]))[_0x999e('0xb6')](_0x36bd8d[_0x999e('0xcc')](_0x999e('0x1f1'),_0x5ccd78));}}}})[_0x999e('0xb6')](loggerGetContactDialer(_0x999e('0x1f7'),_0x5ccd78,_0x3d2fa6));}};Dialer['prototype'][_0x999e('0x8b')]=function(_0x33f8c6){if(_0x33f8c6[_0x999e('0x1f5')]>0x0){var _0x1527cb=_0x33f8c6[_0x999e('0x1f5')]-_0x33f8c6[_0x999e('0x6e')]-_0x33f8c6[_0x999e('0x9c')];if(_0x1527cb>0x0){this['tryOriginatePredictive'](_0x33f8c6);}else{loggerPredictiveCalls[_0x999e('0x77')]('[handlePredictive][limitChannel]');}}else{this[_0x999e('0x1f8')](_0x33f8c6);}};Dialer[_0x999e('0x1d')]['tryOriginatePredictive']=function(_0x277ec0){var _0x579f9e=this;var _0x1adbec=[];_0x277ec0['originated']+=0x1;for(var _0x189b52 in this[_0x999e('0x23')]){if(typeof this[_0x999e('0x23')][_0x189b52]!=='undefined'){if(this[_0x999e('0x23')][_0x189b52]['state']===_0x999e('0x1f9')&&this[_0x999e('0x23')][_0x189b52][_0x999e('0xd8')]===_0x999e('0xd9')){_0x1adbec[_0x999e('0x124')](this[_0x999e('0x23')][_0x189b52]['id']);}}}this['getContactDialer'](_0x277ec0['id'],_0x1adbec,0x1,_0x277ec0[_0x999e('0x1fa')],_0x277ec0)['then'](function(_0x4beb11){if(!checkContactEmpty(_0x4beb11)){checkContactLowerLimitOriginate(_0x277ec0,0x1,0x0);_0x579f9e[_0x999e('0xb3')](_0x277ec0)['then'](sendMessageReschedule(_0x277ec0))[_0x999e('0xb6')](loggerCatch(_0x999e('0xb7')));}else{_0x277ec0[_0x999e('0x40')]=_0x999e('0x1ef');if(_[_0x999e('0xaa')](_0x4beb11[0x0])||_[_0x999e('0xaa')](_0x4beb11[0x0][_0x999e('0x163')])||_['isNil'](_0x4beb11[0x0][_0x999e('0x163')]['phone'])){_0x579f9e[_0x999e('0xcd')](_0x999e('0x1f1'),_0x277ec0,_0x4beb11[0x0]);}else{_0x579f9e[_0x999e('0xb8')](_[_0x999e('0x128')](_0x4beb11[0x0],[_0x999e('0xd2'),_0x999e('0x1f2')]))[_0x999e('0xb5')](_0x579f9e[_0x999e('0x1f3')](_0x277ec0,_0x4beb11[0x0]))[_0x999e('0xb6')](_0x579f9e[_0x999e('0xcc')](_0x999e('0x1fb'),_0x277ec0));}}})[_0x999e('0xb6')](loggerGetContactDialer(_0x999e('0x1fc'),_0x277ec0,0x1));emitVoiceQueueSummary(_0x277ec0);};Dialer[_0x999e('0x1d')][_0x999e('0x1ce')]=function(_0x32b2fa,_0x121b54,_0x411c05,_0x445a7a,_0x1e9ca3,_0x3437c9){loggerPredictive[_0x999e('0x77')](_0x999e('0x1fd'));loggerPredictive['info'](_0x999e('0x1fe'),_0x32b2fa);loggerPredictive[_0x999e('0x77')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x121b54);loggerPredictive[_0x999e('0x77')](_0x999e('0x1ff'),_0x411c05);loggerPredictive[_0x999e('0x77')](_0x999e('0x200'),_0x445a7a);loggerPredictive[_0x999e('0x77')](_0x999e('0x201'),_0x1e9ca3);loggerPredictive[_0x999e('0x77')](_0x999e('0x80'));return new BPromise(function(_0x3f6455,_0xe25df9){if(_0x32b2fa<=0x0||isNaN(_0x32b2fa)){return _0xe25df9(msgResponse(_0x999e('0x202'),_0x999e('0x18a'),_0x999e('0x203')+_0x32b2fa));}if(_0x411c05<=0x0||isNaN(_0x411c05)){return _0xe25df9(msgResponse('[abandonmentRate]',_0x999e('0x18a'),'Ts\x20=\x20'+_0x411c05));}if(_0x445a7a<=0x0||isNaN(_0x445a7a)){return _0xe25df9(msgResponse(_0x999e('0x202'),_0x999e('0x18a'),_0x999e('0x204')+_0x445a7a));}if(_0x121b54<=0x0||isNaN(_0x121b54)){return _0xe25df9(msgResponse(_0x999e('0x202'),_0x999e('0x18a'),_0x999e('0x205')+_0x121b54));}if(_0x1e9ca3<=0x0||isNaN(_0x1e9ca3)){return _0xe25df9(msgResponse('[abandonmentRate]',_0x999e('0x18a'),_0x999e('0x206')+_0x1e9ca3));}_0x3437c9=_0x3437c9||0x0;var _0x2ef926=0x1/_0x411c05;var _0xe5a9fe=0x0;var _0x335381=0x0;var _0x38addb=0x0;var _0xaabacb=0x0;for(var _0x173992=0x0;_0x38addb<_0x1e9ca3;_0x173992+=0x1){_0x335381=_0x173992/_0x121b54;_0xe5a9fe=(_0x445a7a*_0x335381+_0x3437c9)/_0x2ef926;_0x38addb=erlangb(_0xe5a9fe,_0x32b2fa);_0xaabacb=_0xe5a9fe/_0x32b2fa*(0x1-erlangb(_0xe5a9fe,_0x32b2fa));}return _0x3f6455({'erlangCalls':_0x173992,'erlangCallToSecond':_0x121b54/_0x173992,'erlangAbandonmentRate':_0x38addb,'erlangBusyFactor':_0xaabacb});});};Dialer[_0x999e('0x1d')]['busyFactor']=function(_0x5148d7,_0x2ac75c,_0x5ea386,_0x570871,_0x5c95c2,_0x4f447d){loggerPredictive[_0x999e('0x77')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x999e('0x77')](_0x999e('0x1fe'),_0x5148d7);loggerPredictive[_0x999e('0x77')](_0x999e('0x207'),_0x2ac75c);loggerPredictive[_0x999e('0x77')](_0x999e('0x1ff'),_0x5ea386);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',_0x570871);loggerPredictive[_0x999e('0x77')](_0x999e('0x208'),_0x5c95c2);loggerPredictive[_0x999e('0x77')](_0x999e('0x80'));return new BPromise(function(_0x1840cc,_0x3f4824){if(_0x5148d7<=0x0||isNaN(_0x5148d7)){return _0x3f4824(msgResponse(_0x999e('0x209'),_0x999e('0x18a'),_0x999e('0x203')+_0x5148d7));}if(_0x5ea386<=0x0||isNaN(_0x5ea386)){return _0x3f4824(msgResponse('[busyFactor]','Error',_0x999e('0x20a')+_0x5ea386));}if(_0x570871<=0x0||isNaN(_0x570871)){return _0x3f4824(msgResponse(_0x999e('0x209'),'Error',_0x999e('0x204')+_0x570871));}if(_0x2ac75c<=0x0||isNaN(_0x2ac75c)){return _0x3f4824(msgResponse(_0x999e('0x209'),_0x999e('0x18a'),_0x999e('0x205')+_0x2ac75c));}if(_0x5c95c2<=0x0||isNaN(_0x5c95c2)){return _0x3f4824(msgResponse(_0x999e('0x209'),_0x999e('0x18a'),_0x999e('0x20b')+_0x5c95c2));}_0x4f447d=_0x4f447d||0x0;var _0x4dba33=0x1/_0x5ea386;var _0x1af5d1=0x0;var _0xc50561=0x0;var _0x1bb1b0=0x0;var _0x40a3f0=0x0;for(var _0x126dc1=0x0;_0x40a3f0<_0x5c95c2;_0x126dc1+=0x1){_0xc50561=_0x126dc1/_0x2ac75c;_0x1af5d1=(_0x570871*_0xc50561+_0x4f447d)/_0x4dba33;_0x1bb1b0=erlangb(_0x1af5d1,_0x5148d7);_0x40a3f0=_0x1af5d1/_0x5148d7*(0x1-erlangb(_0x1af5d1,_0x5148d7));}return _0x1840cc({'erlangCalls':_0x126dc1,'erlangCallToSecond':_0x2ac75c/_0x126dc1,'erlangAbandonmentRate':_0x1bb1b0,'erlangBusyFactor':_0x40a3f0});});};module[_0x999e('0x20c')]=Dialer; \ No newline at end of file +var _0x705f=['[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialDropRetryFrequency','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','agentreject','reason\x2020\x20agentreject','reason','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','getDataPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','countReScheduled','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','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','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','bluebird','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','env','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startPredictive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','milliseconds','diff','emit','type','strategy','answered','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','callerid','stringify','voice:queue:%s','voice_queue:save','ivr','format','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20predictive','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','sequence','isNil','Action','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','then','catch','[countReScheduled]\x20','checkIsBlackList','resolve','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','status','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countdropretry','countmachineretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnoanswerretry','countnosuchnumberretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','AnswerAGI','AGI','cause-txt','Unknow','agent','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','TIMEOUT','agiafterat','[rescheduleContact][Drop]','calleridname','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridnum','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','iftime\x20%s,%s','interval','content','indexOf','true','command','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','syncQueueSummary','loggedIn','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','active','[syncCampaigns]','pow','replace','random','match','actionOriginate','originate','Contact','phone','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','outbound','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','trim','substring','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x705f,0x75));var _0xf705=function(_0x20ba6d,_0x256177){_0x20ba6d=_0x20ba6d-0x0;var _0x338188=_0x705f[_0x20ba6d];return _0x338188;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xf705('0x0'));var uuid=require('uuid');var moment=require(_0xf705('0x1'));var rr=require('rr');var md5=require(_0xf705('0x2'));var Redis=require(_0xf705('0x3'));var ut=require(_0xf705('0x4'));var config=require(_0xf705('0x5'));var logger=require(_0xf705('0x6'))(_0xf705('0x7'));var loggerBooked=require(_0xf705('0x6'))(_0xf705('0x8'));var loggerPredictive=require(_0xf705('0x6'))(_0xf705('0x9'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0xf705('0x6'))('syncQueueSummary');var ami=require(_0xf705('0xa'));config[_0xf705('0xb')]=_['defaults'](config['redis'],{'host':_0xf705('0xc'),'port':0x18eb});var io=require(_0xf705('0xd'))(new Redis(config[_0xf705('0xb')]));var cmHopper=require(_0xf705('0xe'));var cmHopperHistory=require(_0xf705('0xf'));var cmHopperBlack=require(_0xf705('0x10'));var voiceQueueRt=require(_0xf705('0x11'));var Action=require(_0xf705('0x12'));var History=require('./history');var Final=require(_0xf705('0x13'));var AgentComplete=require(_0xf705('0x14'));var QueueCallerAbandon=require(_0xf705('0x15'));var Hangup=require(_0xf705('0x16'));var ipAgi=process[_0xf705('0x17')]['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':_0xf705('0x18'),'roundrobin':_0xf705('0x19')};var Sequence=function(){};Sequence[_0xf705('0x1a')][_0xf705('0x1b')]=function(_0x57d132){this[_0xf705('0x1c')]=this[_0xf705('0x1c')]?this[_0xf705('0x1c')][_0xf705('0x1d')](_0x57d132):_0x57d132();};function Dialer(_0x572efc,_0x11dcbc){this['sequence']=new Sequence();this[_0xf705('0x1e')]=_0x11dcbc;this[_0xf705('0x1f')]=_0x572efc['voiceQueues'];this[_0xf705('0x20')]=_0x572efc['campaigns'];this[_0xf705('0x21')]=_0x572efc['agents'];this['trunks']=_0x572efc[_0xf705('0x22')];this[_0xf705('0x23')]=config[_0xf705('0x23')]||0x2;this['channels']={};this[_0xf705('0x24')]={};this[_0xf705('0x25')]={};this[_0xf705('0x26')]={};this['optionPredictive']={};this[_0xf705('0x27')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0xf705('0x28')]={};this[_0xf705('0x29')]={};ami['on'](_0xf705('0x2a'),this[_0xf705('0x2b')][_0xf705('0x2c')](this));ami['on'](_0xf705('0x2d'),this[_0xf705('0x2e')][_0xf705('0x2c')](this));ami['on'](_0xf705('0x2f'),this[_0xf705('0x30')][_0xf705('0x2c')](this));ami['on']('agentcomplete',this[_0xf705('0x31')]['bind'](this));ami['on'](_0xf705('0x32'),this['syncQueueSummary']['bind'](this));ami['on'](_0xf705('0x33'),this[_0xf705('0x34')]['bind'](this));ami['on']('newexten',this[_0xf705('0x35')][_0xf705('0x2c')](this));ami['on'](_0xf705('0x36'),this[_0xf705('0x37')][_0xf705('0x2c')](this));ami['on']('queuemember',this[_0xf705('0x38')][_0xf705('0x2c')](this));ami['on'](_0xf705('0x39'),this['syncQueueStatusComplete']['bind'](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0x2c35a3){return _0x2c35a3!==null&&!_['isUndefined'](_0x2c35a3);}function checkIsLoggedIn(_0x58189f,_0x29ac24){return function(){if(_0x29ac24<=0x0){_0x58189f[_0xf705('0x3a')]=_0xf705('0x3b');throw _0x58189f[_0xf705('0x3c')]+_0xf705('0x3d');}};}function isActive(_0x5b4560){return _0x5b4560;}function checkIsActive(_0x5a67d7,_0x105393){return function(){if(!isActive(_0x105393)){_0x5a67d7[_0xf705('0x3a')]=_0xf705('0x3e');throw _0x5a67d7[_0xf705('0x3c')]+_0xf705('0x3f');}};}function checkInterval(_0x12cde6){return function(){if(!isNotNull(_0x12cde6[_0xf705('0x40')])){_0x12cde6[_0xf705('0x3a')]='INTERVAL_IS_NULL';throw _0x12cde6[_0xf705('0x3c')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x12cde6[_0xf705('0x40')]['Intervals'])){_0x12cde6[_0xf705('0x3a')]=_0xf705('0x41');throw _0x12cde6[_0xf705('0x3c')]+_0xf705('0x42');}if(!isNotNull(_[_0xf705('0x43')](_0x12cde6[_0xf705('0x40')][_0xf705('0x44')]))){_0x12cde6['message']=_0xf705('0x41');throw _0x12cde6[_0xf705('0x3c')]+_0xf705('0x42');}};}function msgResponse(_0x549a3d,_0x5e20bf,_0x383503){return{'action':_0x549a3d,'response':_0x5e20bf,'message':_0x383503,'stack':_0x383503};}function myreject(_0x4e4253){return function(_0x2e82e3){return _0x4e4253(msgResponse(_0xf705('0x45'),_0xf705('0x46'),JSON['stringify'](_0x2e82e3)));};}function getSeconds(_0x1406a2,_0x4835c0){var _0x5ba49b=moment(_0x1406a2)[_0xf705('0x47')](0x0);var _0x452871=moment(_0x4835c0)['milliseconds'](0x0);return _0x5ba49b[_0xf705('0x48')](_0x452871,'seconds');}function emit(_0x34a5bd,_0xf6c721,_0x240e26){io['to'](_0x34a5bd)[_0xf705('0x49')](_0xf6c721,_0x240e26);}function emitVoiceQueueSummary(_0x38f9d5){if(_0x38f9d5[_0xf705('0x4a')]==='outbound'){var _0x2b9902={'id':_0x38f9d5['id'],'name':_0x38f9d5[_0xf705('0x3c')],'strategy':_0x38f9d5[_0xf705('0x4b')],'answered':_0x38f9d5[_0xf705('0x4c')],'available':_0x38f9d5['available'],'loggedIn':_0x38f9d5['loggedIn'],'pTalking':_0x38f9d5[_0xf705('0x4d')],'sumBillable':_0x38f9d5[_0xf705('0x4e')],'sumDuration':_0x38f9d5['sumDuration'],'sumHoldTime':_0x38f9d5[_0xf705('0x4f')]||0x0,'talking':_0x38f9d5[_0xf705('0x50')],'total':_0x38f9d5[_0xf705('0x51')],'type':_0x38f9d5['type'],'unmanaged':_0x38f9d5[_0xf705('0x52')],'abandoned':_0x38f9d5[_0xf705('0x53')],'waiting':_0x38f9d5['waiting'],'loggedInDb':_0x38f9d5[_0xf705('0x54')],'dialActive':_0x38f9d5[_0xf705('0x55')],'dialMethod':_0x38f9d5[_0xf705('0x56')],'dialOriginateCallerIdName':_0x38f9d5[_0xf705('0x57')],'dialOriginateCallerIdNumber':_0x38f9d5[_0xf705('0x58')],'dialOriginateTimeout':_0x38f9d5[_0xf705('0x59')],'dialPrefix':_0x38f9d5[_0xf705('0x5a')],'outboundAnswerAgiCallsDay':_0x38f9d5[_0xf705('0x5b')],'outboundAnswerCallsDay':_0x38f9d5[_0xf705('0x5c')],'outboundBlacklistCallsDay':_0x38f9d5[_0xf705('0x5d')],'outboundBusyCallsDay':_0x38f9d5[_0xf705('0x5e')],'outboundCongestionCallsDay':_0x38f9d5['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x38f9d5['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x38f9d5['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x38f9d5[_0xf705('0x5f')],'outboundNoAnswerCallsDay':_0x38f9d5[_0xf705('0x60')],'outboundNoSuchCallsDay':_0x38f9d5[_0xf705('0x61')],'outboundOriginateFailureCallsDay':_0x38f9d5['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x38f9d5[_0xf705('0x62')],'outboundRejectCallsDay':_0x38f9d5[_0xf705('0x63')],'outboundUnknownCallsDay':_0x38f9d5[_0xf705('0x64')],'predictiveIntervalAnsweredCalls':_0x38f9d5[_0xf705('0x65')],'predictiveIntervalAvgHoldtime':_0x38f9d5[_0xf705('0x66')],'predictiveIntervalAvgTalktime':_0x38f9d5[_0xf705('0x67')],'predictiveIntervalDroppedCallsCallersExit':_0x38f9d5['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x38f9d5['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x38f9d5[_0xf705('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x38f9d5[_0xf705('0x69')],'predictiveIntervalHitRate':_0x38f9d5['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x38f9d5[_0xf705('0x6a')],'predictiveIntervalPauses':_0x38f9d5[_0xf705('0x6b')],'predictiveIntervalAvailable':_0x38f9d5[_0xf705('0x6c')],'predictiveIntervalTotalCalls':_0x38f9d5[_0xf705('0x6d')],'message':_0x38f9d5['message'],'originated':_0x38f9d5[_0xf705('0x6e')],'erlangCalls':_0x38f9d5[_0xf705('0x6f')],'erlangCallToSecond':_0x38f9d5['erlangCallToSecond'],'erlangAbandonmentRate':_0x38f9d5[_0xf705('0x70')],'erlangBusyFactor':_0x38f9d5[_0xf705('0x71')],'startPredictive':_0x38f9d5[_0xf705('0x27')],'startProgressive':_0x38f9d5[_0xf705('0x72')]};if(_0x38f9d5[_0xf705('0x73')]){_0x2b9902[_0xf705('0x73')]={'id':_0x38f9d5[_0xf705('0x73')]['id'],'name':_0x38f9d5[_0xf705('0x73')][_0xf705('0x3c')],'active':_0x38f9d5['Trunk']['active'],'callerid':_0x38f9d5[_0xf705('0x73')][_0xf705('0x74')]};}if(_0x38f9d5['Interval']){_0x2b9902[_0xf705('0x40')]={'id':_0x38f9d5[_0xf705('0x40')]['id'],'name':_0x38f9d5[_0xf705('0x40')][_0xf705('0x3c')]};}var _0x99c560=md5(JSON[_0xf705('0x75')](_0x2b9902));if(_0x38f9d5['md5']!==_0x99c560){_0x38f9d5['md5']=_0x99c560;emit(util['format'](_0xf705('0x76'),_0x2b9902[_0xf705('0x3c')]),_0xf705('0x77'),_0x2b9902);}}}function emitCampaignSummary(_0x48f54f){if(_0x48f54f[_0xf705('0x4a')]===_0xf705('0x78')){emit(util[_0xf705('0x79')]('campaign:ivr:%s',_0x48f54f['name']),'campaign:save',_0x48f54f);}}function checkGetDataPredictive(_0x275d33){if(isNotNull(_0x275d33)&&!_[_0xf705('0x43')](_0x275d33)){loggerPredictive[_0xf705('0x7a')](_0xf705('0x7b'));loggerPredictive[_0xf705('0x7a')](_0xf705('0x7c'),_0x275d33['predictiveIntervalTotalCalls']);loggerPredictive[_0xf705('0x7a')](_0xf705('0x7d'),_0x275d33[_0xf705('0x65')]);loggerPredictive[_0xf705('0x7a')](_0xf705('0x7e'),_0x275d33[_0xf705('0x7f')]);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x275d33[_0xf705('0x80')]);loggerPredictive[_0xf705('0x7a')](_0xf705('0x81'),_0x275d33[_0xf705('0x66')]);loggerPredictive['info'](_0xf705('0x82'),_0x275d33[_0xf705('0x67')]);loggerPredictive[_0xf705('0x7a')](_0xf705('0x83'));if(_0x275d33[_0xf705('0x6d')]>0x0){if(!_[_0xf705('0x84')](_0x275d33[_0xf705('0x67')])&&_0x275d33[_0xf705('0x67')]>0x0){return!![];}loggerPredictive[_0xf705('0x7a')](_0xf705('0x85'));if(!_[_0xf705('0x84')](_0x275d33['predictiveIntervalAvgHoldtime'])&&_0x275d33[_0xf705('0x66')]>0x0){return!![];}loggerPredictive[_0xf705('0x7a')](_0xf705('0x86'));}else{loggerPredictive[_0xf705('0x7a')](_0xf705('0x87'));}}else{loggerPredictive[_0xf705('0x7a')](_0xf705('0x88'));}return![];}function mergeDataErlangB(_0x25f9b4){return function(_0x2ad859){loggerPredictive[_0xf705('0x7a')](_0xf705('0x89'));loggerPredictive[_0xf705('0x7a')](_0xf705('0x8a'),_0x2ad859['erlangCalls']);loggerPredictive[_0xf705('0x7a')](_0xf705('0x8b'),_0x2ad859[_0xf705('0x8c')]);loggerPredictive[_0xf705('0x7a')](_0xf705('0x8d'),_0x2ad859[_0xf705('0x70')]);loggerPredictive['info'](_0xf705('0x8e'),_0x2ad859[_0xf705('0x71')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ad859[_0xf705('0x70')]);loggerPredictive[_0xf705('0x7a')](_0xf705('0x83'));_['merge'](_0x25f9b4,_0x2ad859);};}function getDiff(_0x378f9a){var _0xef945d=moment()['milliseconds'](0x0);var _0x13a6ef=moment(_0x378f9a)['milliseconds'](0x0);return _0xef945d[_0xf705('0x48')](_0x13a6ef,'seconds');}function ifInterval(_0x3cc723,_0x1cc066){if(_[_0xf705('0x84')](_0x1cc066)){return![];}return getDiff(_0x1cc066)<_0x3cc723*0x3c;}function freeVariablesPredictive(_0x1cac76){if(isNotNull(_0x1cac76)){if(!_['isUndefined'](_0x1cac76['startProgressive'])){_0x1cac76[_0xf705('0x72')]=undefined;loggerPredictive[_0xf705('0x7a')](_0x1cac76[_0xf705('0x3c')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xf705('0x84')](_0x1cac76['startPredictive'])){_0x1cac76['startPredictive']=undefined;loggerPredictive[_0xf705('0x7a')](_0x1cac76[_0xf705('0x3c')],_0xf705('0x8f'));}if(!_[_0xf705('0x84')](_0x1cac76[_0xf705('0x90')])){clearInterval(_0x1cac76['handlePredictive']);_0x1cac76[_0xf705('0x90')]=undefined;loggerPredictive[_0xf705('0x7a')](_0x1cac76[_0xf705('0x3c')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x248924,_0x104f61){if(_0x104f61===0x0){return 0x0;}var _0x4fade7=0x1;for(var _0xba9345=0x1;_0xba9345<=_0x104f61;_0xba9345+=0x1){_0x4fade7=0x1+_0x4fade7*_0xba9345/_0x248924;}return 0x1/_0x4fade7;}function isVoiceQueueOutbound(_0x5131d4){return _0x5131d4==='outbound';}function isNotPreview(_0x5f934f){return _0x5f934f!==_0xf705('0x1e');}function isCampaignIvr(_0x3b76a2){return _0x3b76a2===_0xf705('0x78');}function getCallerId(_0x41410d,_0x3534d0,_0x384167){if(!_[_0xf705('0x84')](_0x384167)&&typeof _0x384167===_0xf705('0x91')&&!_[_0xf705('0x43')](_0x384167)){if(!_[_0xf705('0x84')](_0x3534d0)&&typeof _0x3534d0===_0xf705('0x91')&&!_[_0xf705('0x43')](_0x3534d0)){return util['format'](_0xf705('0x92'),_0x3534d0,_0x384167);}return util[_0xf705('0x79')](_0xf705('0x92'),_0x384167,_0x384167);}if(!_[_0xf705('0x84')](_0x41410d)&&typeof _0x41410d===_0xf705('0x91')&&!_[_0xf705('0x43')](_0x41410d)){return _0x41410d;}return _0xf705('0x93');}function loggerCatchQueueSummary(_0x2d6fc7,_0x302627){return function(_0x594712){freeVariablesPredictive(_0x302627);emitVoiceQueueSummary(_0x302627);emitCampaignSummary(_0x302627);loggerSyncQueueSummary['error'](_0x2d6fc7,util['inspect'](_0x594712,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xfbe9d0,_0x209eef){return function(_0x32a90f){loggerPredictive[_0xf705('0x94')](_0x209eef['name'],_0xfbe9d0);loggerPredictive[_0xf705('0x94')](_0x32a90f[_0xf705('0x95')]);freeVariablesPredictive(_0x209eef);};}function loggerCatch(_0x3cfabc){return function(_0x929cae){logger['error'](_0x3cfabc,util[_0xf705('0x96')](_0x929cae,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4b6f39){return _0x4b6f39&&!_[_0xf705('0x84')](_0x4b6f39)&&_0x4b6f39[_0xf705('0x97')]>0x0;}function decremetOriginate(_0x114316){if(!_['isUndefined'](_0x114316)&&_0x114316!==null){if(typeof _0x114316[_0xf705('0x6e')]!==_0xf705('0x98')){if(_0x114316[_0xf705('0x6e')]>0x0){_0x114316[_0xf705('0x6e')]-=0x1;}else{logger[_0xf705('0x94')](_0xf705('0x99'));}}}else{logger[_0xf705('0x94')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x1edf99,_0x3356e0,_0x17faff){if(_0x3356e0>_0x17faff){for(var _0x251151=0x0;_0x251151<_0x3356e0-_0x17faff;_0x251151+=0x1){decremetOriginate(_0x1edf99);}}}function loggerGetContactDialer(_0x1ab385,_0x452dd0,_0x26a857){return function(_0x39bf47){checkContactLowerLimitOriginate(_0x452dd0,_0x26a857,0x0);logger[_0xf705('0x94')](_0x1ab385,util[_0xf705('0x96')](_0x39bf47,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x54618c){return function(_0x2179ad){if(isNotNull(_0x2179ad)&&isNotNull(_0x2179ad[0x0])){if(_0x2179ad[0x0][_0xf705('0x9a')]>0x0){_0x54618c[_0xf705('0x3a')]=_0xf705('0x9b');logger[_0xf705('0x7a')]('[getContactDialer2][ReScheduled]'+_0x54618c[_0xf705('0x3c')],_0x2179ad[0x0]['contactsRescheduled'],_0xf705('0x9c'));}else{_0x54618c[_0xf705('0x3a')]=_0xf705('0x9d');logger['info'](_0xf705('0x9e')+_0x54618c[_0xf705('0x3c')]);}}};}function notSendMessagesQueue(_0x3d6756){if(_0x3d6756[_0xf705('0x9f')]){freeVariablesPredictive(_0x3d6756);if(_0x3d6756[_0xf705('0x6e')]===0x0&&_0x3d6756[_0xf705('0x50')]===0x0&&_0x3d6756[_0xf705('0xa0')]===0x0&&(_0x3d6756[_0xf705('0x4d')]||0x0)===0x0){_0x3d6756[_0xf705('0x9f')]=![];_0x3d6756[_0xf705('0xa1')]=0x0;_0x3d6756[_0xf705('0x3a')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xf705('0x94')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x3d6756[_0xf705('0x3c')],'is\x20not\x20active');}else{_0x3d6756[_0xf705('0x3a')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xf705('0x94')](_0xf705('0xa2'),_0x3d6756[_0xf705('0x3c')],'is\x20disactive');}emitVoiceQueueSummary(_0x3d6756);}}function notSendMessagesCampaign(_0x28ff25){if(_0x28ff25[_0xf705('0x9f')]){if(_0x28ff25['originated']===0x0){_0x28ff25['sendMessageOneNotActive']=![];_0x28ff25[_0xf705('0x3a')]=_0xf705('0x3e');loggerSyncQueueSummary[_0xf705('0x94')](_0xf705('0xa3'),_0x28ff25['name'],'is\x20not\x20active');}else{_0x28ff25[_0xf705('0x3a')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0xf705('0xa3'),_0x28ff25['name'],_0xf705('0xa4'));}emitCampaignSummary(_0x28ff25);}}function createObjHistory(_0x5e70fd,_0xbdd9a0,_0x5600f8,_0x4d1763,_0x158b2c){_0x5e70fd[_0xf705('0x3a')]=_0x5600f8;var _0x52b3cf=new Action(_0x5e70fd,_0xbdd9a0);var _0xb7c4a3=new History(_0x52b3cf);_0xb7c4a3[_0xf705('0xa5')]=_0x4d1763;_0xb7c4a3[_0xf705('0xa6')]=_0x158b2c;_0xb7c4a3[_0xf705('0xa7')]=_0x52b3cf[_0xf705('0xa8')];return _0xb7c4a3;}Dialer[_0xf705('0x1a')]['loopClearZombieChannels']=function(){var _0x3527dd=this;setInterval(function(){_0x3527dd[_0xf705('0xa9')](_0x3527dd[_0xf705('0x26')],_0xf705('0xaa'));_0x3527dd['clearZombieChannels'](_0x3527dd[_0xf705('0x24')],_0xf705('0xab'));},0x32c8);};Dialer[_0xf705('0x1a')][_0xf705('0xa9')]=function(_0x500d18,_0x132474){var _0x1a2e7d=this;for(var _0x4b28d6 in _0x500d18){if(typeof _0x500d18[_0x4b28d6]!==_0xf705('0x98')){this[_0xf705('0xac')][_0xf705('0x1b')](function(){if(!_[_0xf705('0xad')](_0x500d18[_0x4b28d6])){return ami[_0xf705('0xae')]({'action':'status','channel':_0x500d18[_0x4b28d6][_0xf705('0xaf')]})['catch'](function(_0x31545e){if(_0x31545e[_0xf705('0x3a')]===_0xf705('0xb0')){setTimeout(function(){if(_0x500d18[_0x4b28d6]&&_0x500d18[_0x4b28d6]['type']!=='ivr'){_0x1a2e7d[_0xf705('0xb1')](_0x1a2e7d['voiceQueues'][_0x500d18[_0x4b28d6][_0xf705('0xb2')]]);logger[_0xf705('0x94')]('[Dialer][checkChannel]',_0x132474,_0x4b28d6,_0x500d18[_0x4b28d6][_0xf705('0xb2')]);delete _0x500d18[_0x4b28d6];}if(_0x500d18[_0x4b28d6]&&_0x500d18[_0x4b28d6][_0xf705('0x4a')]===_0xf705('0x78')){_0x1a2e7d[_0xf705('0xb1')](_0x1a2e7d['campaigns'][_0x500d18[_0x4b28d6]['queue']]);logger[_0xf705('0x94')](_0xf705('0xb3'),_0x132474,_0x4b28d6,_0x500d18[_0x4b28d6][_0xf705('0xb2')]);delete _0x500d18[_0x4b28d6];}},0x2328);}});}});}}};Dialer[_0xf705('0x1a')]['countReScheduled']=function(_0x5193eb){return BPromise['resolve']()[_0xf705('0xb4')](cmHopper['countReScheduled'](_0x5193eb))[_0xf705('0xb5')](loggerCatch(_0xf705('0xb6')));};Dialer[_0xf705('0x1a')][_0xf705('0xb7')]=function(_0x104e23){return BPromise[_0xf705('0xb8')]()['then'](cmHopperBlack[_0xf705('0xb7')](_0x104e23))[_0xf705('0xb5')](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype'][_0xf705('0xb9')]=function(_0x3c9d65){return BPromise[_0xf705('0xb8')]()[_0xf705('0xb4')](cmHopperBlack[_0xf705('0xb9')](_0x3c9d65))[_0xf705('0xb5')](loggerCatch(_0xf705('0xba')));};Dialer[_0xf705('0x1a')]['averageHandleTime']=function(_0x53e2a6){return BPromise[_0xf705('0xb8')]()[_0xf705('0xb4')](cmHopperHistory[_0xf705('0xbb')](_0x53e2a6))[_0xf705('0xb5')](loggerCatch(_0xf705('0xbc')));};Dialer[_0xf705('0x1a')][_0xf705('0xbd')]=function(_0x2bca75){return BPromise[_0xf705('0xb8')]()[_0xf705('0xb4')](cmHopper[_0xf705('0xbd')](_0x2bca75))[_0xf705('0xb5')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xf705('0x1a')][_0xf705('0xbe')]=function(_0x34136a,_0x40917d,_0x2e51bd){return BPromise[_0xf705('0xb8')]()[_0xf705('0xb4')](cmHopper[_0xf705('0xbe')](_0x34136a,_0x40917d,_0x2e51bd))[_0xf705('0xb5')](loggerCatch('[unlockContact]\x20'));};Dialer[_0xf705('0x1a')][_0xf705('0xbf')]=function(_0x5b12f6,_0x5ba303,_0x13c58d,_0x33a820,_0x39cefe){return BPromise[_0xf705('0xb8')]()[_0xf705('0xb4')](cmHopper[_0xf705('0xbf')](_0x5b12f6,_0x5ba303,_0x13c58d,_0x33a820))[_0xf705('0xb5')](function(_0x483c74){_0x39cefe[_0xf705('0xc0')]-=_0x13c58d;_0x39cefe[_0xf705('0xc0')]=_0x39cefe['temp']>0x0?_0x39cefe[_0xf705('0xc0')]:0x0;loggerCatch(_0xf705('0xc1'))(_0x483c74);});};Dialer['prototype']['getContactDialerIvr']=function(_0x1a6285,_0x1fcb42,_0x15104c,_0x4a5f1f){return BPromise[_0xf705('0xb8')]()[_0xf705('0xb4')](cmHopper[_0xf705('0xc2')](_0x1a6285,_0x1fcb42,_0x15104c))['catch'](function(_0x5717e7){_0x4a5f1f['temp']-=_0x1fcb42;_0x4a5f1f['temp']=_0x4a5f1f[_0xf705('0xc0')]>0x0?_0x4a5f1f['temp']:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x5717e7);});};Dialer['prototype'][_0xf705('0xc3')]=function(_0x58f32d){return BPromise[_0xf705('0xb8')]()[_0xf705('0xb4')](voiceQueueRt[_0xf705('0xc3')](_0x58f32d))[_0xf705('0xb5')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xf705('0x1a')][_0xf705('0xc4')]=function(_0x2f61d4){return BPromise[_0xf705('0xb8')]()[_0xf705('0xb4')](cmHopper[_0xf705('0xc4')](_0x2f61d4))['catch'](loggerCatch(_0xf705('0xc5')));};Dialer['prototype']['createHistory']=function(_0x53738b){return BPromise[_0xf705('0xb8')]()[_0xf705('0xb4')](cmHopperHistory[_0xf705('0xc6')](_0x53738b))[_0xf705('0xb5')](loggerCatch(_0xf705('0xc7')));};Dialer[_0xf705('0x1a')][_0xf705('0xb1')]=function(_0x2309d6){if(!_[_0xf705('0x84')](_0x2309d6)&&_0x2309d6!==null){if(typeof _0x2309d6[_0xf705('0x6e')]!==_0xf705('0x98')){if(_0x2309d6[_0xf705('0x6e')]>0x0){_0x2309d6[_0xf705('0x6e')]-=0x1;}else{logger[_0xf705('0x94')](_0xf705('0xc8'));}}}else{logger[_0xf705('0x94')](_0xf705('0xc9'));}};Dialer[_0xf705('0x1a')][_0xf705('0xca')]=function(_0x3c9519,_0x57806a){var _0x2448b3=this;return function(_0x36a795){_0x2448b3[_0xf705('0xb1')](_0x57806a);logger[_0xf705('0x94')](_0x3c9519,util[_0xf705('0x96')](_0x36a795,{'showHidden':![],'depth':null}));};};Dialer[_0xf705('0x1a')][_0xf705('0xcb')]=function(_0x5a3c68,_0xa55c37,_0x9aa3){var _0x3f41ba={'state':0x19,'statedesc':_0xf705('0xcc')};this[_0xf705('0xb1')](_0xa55c37);this[_0xf705('0xcd')](_[_0xf705('0xce')](_0x3f41ba,_['pick'](_0x9aa3,[_0xf705('0xcf'),_0xf705('0xd0'),_0xf705('0xd1'),_0xf705('0xd2'),_0xf705('0xd3')])),_0xf705('0xd4'),_0xf705('0xd5'));logger[_0xf705('0x94')](_0x5a3c68);};Dialer[_0xf705('0x1a')][_0xf705('0xd6')]=function(_0x1ae451){return _0x1ae451===_0xf705('0xd7');};Dialer[_0xf705('0x1a')][_0xf705('0xd8')]=function(_0x4b29ad){return!_[_0xf705('0x84')](_0x4b29ad)&&_0x4b29ad&&!_[_0xf705('0x84')](_0x4b29ad[_0xf705('0x3c')])&&!_[_0xf705('0x84')](_0x4b29ad['active'])&&_0x4b29ad['active']&&(this[_0xf705('0x22')][util[_0xf705('0x79')](_0xf705('0xd9'),_0x4b29ad['name'])]['status']===_0xf705('0xda')||this['trunks'][util[_0xf705('0x79')](_0xf705('0xd9'),_0x4b29ad[_0xf705('0x3c')])][_0xf705('0xdb')]===_0xf705('0xdc'));};Dialer[_0xf705('0x1a')][_0xf705('0xcd')]=function(_0x569bd4,_0x4dc956,_0x41fd9a){this['createHistory'](_0x569bd4)[_0xf705('0xb5')](loggerCatch(_0x4dc956));this[_0xf705('0xc4')](_0x569bd4)['catch'](loggerCatch(_0x41fd9a));};Dialer[_0xf705('0x1a')][_0xf705('0x37')]=function(_0xd75dcf){var _0x4d648c=this['uniqueId'][_0xd75dcf[_0xf705('0xdd')]];var _0xfc1178;if(!_[_0xf705('0xad')](_0xd75dcf)&&!_['isNil'](_0xd75dcf[_0xf705('0xde')])&&!_[_0xf705('0xad')](_0xd75dcf[_0xf705('0xde')][_0xf705('0xdf')])&&_0xd75dcf[_0xf705('0xe0')]===_0xf705('0xe1')&&_0x4d648c){if(_0x4d648c[_0xf705('0x4a')]!==_0xf705('0x78')&&this['voiceQueues'][_0x4d648c[_0xf705('0xb2')]][_0xf705('0xe2')]&&_0xd75dcf[_0xf705('0xe3')]===_0xf705('0xe4')){delete this[_0xf705('0x26')][_0xd75dcf['uniqueid']];this[_0xf705('0xb1')](this[_0xf705('0x1f')][_0x4d648c[_0xf705('0xb2')]]);this['voiceQueues'][_0x4d648c[_0xf705('0xb2')]][_0xf705('0x5c')]+=0x1;this[_0xf705('0x1f')][_0x4d648c[_0xf705('0xb2')]][_0xf705('0x5b')]+=0x1;_0xfc1178=new Hangup(_0x4d648c,_0xd75dcf);_0xfc1178[_0xf705('0xa5')]=0x12;_0xfc1178['statedesc']=_0xf705('0xe5');_0xfc1178[_0xf705('0xe6')]=_0xf705('0xe7');ami[_0xf705('0x49')](_0xf705('0xe8'),ut[_0xf705('0xe9')](_0xfc1178,_0xf705('0xea')));this[_0xf705('0xcd')](_0xfc1178,_0xf705('0xeb'),_0xf705('0xec'));}if(_0x4d648c[_0xf705('0x4a')]!==_0xf705('0x78')&&this[_0xf705('0x1f')][_0x4d648c[_0xf705('0xb2')]][_0xf705('0xe2')]&&_0xd75dcf[_0xf705('0xe3')]===_0xf705('0xed')){var _0x5beb81=this;return new BPromise(function(_0x3f81d0,_0x1d5cf2){delete _0x5beb81['uniqueId'][_0xd75dcf[_0xf705('0xdd')]];_0x5beb81[_0xf705('0xb1')](_0x5beb81[_0xf705('0x1f')][_0x4d648c[_0xf705('0xb2')]]);_0x5beb81[_0xf705('0x1f')][_0x4d648c[_0xf705('0xb2')]]['outboundAnswerCallsDay']+=0x1;_0x5beb81[_0xf705('0x1f')][_0x4d648c[_0xf705('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4d88a9=_0x5beb81['voiceQueues'][_0x4d648c[_0xf705('0xb2')]];var _0x385fe2=new Hangup(_0x4d648c,_0xd75dcf);_0x385fe2[_0xf705('0xa5')]=0x13;_0x385fe2['statedesc']=_0xf705('0xee');_0x385fe2[_0xf705('0xe6')]=_0xf705('0xe7');_0x385fe2['countmachineretry']+=0x1;_0x385fe2[_0xf705('0xef')]+=0x1;_0x385fe2[_0xf705('0xea')]=!![];ami[_0xf705('0x49')](_0xf705('0xe8'),ut[_0xf705('0xe9')](_0x385fe2,_0xf705('0xea')));_0x5beb81['createHistory'](_0x385fe2)[_0xf705('0xb5')](loggerCatch(_0xf705('0xf0')));if(_0x385fe2[_0xf705('0xf1')]+_0x385fe2[_0xf705('0xf2')]+_0x385fe2['countnoanswerretry']+_0x385fe2['countnosuchnumberretry']+_0x385fe2[_0xf705('0xf3')]+_0x385fe2['countabandonedretry']+_0x385fe2[_0xf705('0xf4')]+_0x385fe2[_0xf705('0xf5')]>=_0x4d88a9['dialGlobalMaxRetry']){_0x5beb81['stateGlobal'](_0x385fe2,_0x3f81d0,_0x1d5cf2,_0xf705('0xf6'));}else{if(_0x385fe2[_0xf705('0xf4')]>=_0x4d88a9[_0xf705('0xf7')]){_0x5beb81[_0xf705('0xf8')](_0x385fe2,_0x3f81d0,_0x1d5cf2,_0xf705('0xf9'));}else{_0x5beb81[_0xf705('0xbd')]({'active':![],'countmachineretry':_0x385fe2[_0xf705('0xf4')],'scheduledat':moment()[_0xf705('0xfa')](_0x4d88a9[_0xf705('0xfb')],'minutes')[_0xf705('0x79')](_0xf705('0xfc')),'ContactId':_0x385fe2[_0xf705('0xcf')],'ListId':_0x385fe2[_0xf705('0xd0')],'VoiceQueueId':_0x385fe2[_0xf705('0xd2')]||undefined,'CampaignId':_0x385fe2[_0xf705('0xd3')]||undefined})[_0xf705('0xb5')](loggerCatch(_0xf705('0xfd')));_0x3f81d0({'reschedule':0x1});}}});}if(_0x4d648c[_0xf705('0x4a')]===_0xf705('0x78')&&this[_0xf705('0x20')][_0x4d648c['queue']][_0xf705('0xe2')]&&_0xd75dcf[_0xf705('0xe3')]==='HANGUP'){delete this[_0xf705('0x26')][_0xd75dcf[_0xf705('0xdd')]];this['updateOriginated'](this[_0xf705('0x20')][_0x4d648c[_0xf705('0xb2')]]);_0xfc1178=new Hangup(_0x4d648c,_0xd75dcf);_0xfc1178['state']=0x12;_0xfc1178['statedesc']='HangupInAMD';_0xfc1178[_0xf705('0xe6')]='AMD';ami['emit']('custom:amd',ut[_0xf705('0xe9')](_0xfc1178,_0xf705('0xea')));this[_0xf705('0xcd')](_0xfc1178,_0xf705('0xfe'),_0xf705('0xff'));}if(_0x4d648c[_0xf705('0x4a')]===_0xf705('0x78')&&this[_0xf705('0x20')][_0x4d648c[_0xf705('0xb2')]][_0xf705('0xe2')]&&_0xd75dcf[_0xf705('0xe3')]===_0xf705('0xed')){var _0x5beb81=this;return new BPromise(function(_0x2826de,_0x31bb99){delete _0x5beb81[_0xf705('0x26')][_0xd75dcf[_0xf705('0xdd')]];_0x5beb81[_0xf705('0xb1')](_0x5beb81['campaigns'][_0x4d648c['queue']]);_0x5beb81[_0xf705('0x20')][_0x4d648c['queue']][_0xf705('0x5c')]+=0x1;_0x5beb81[_0xf705('0x20')][_0x4d648c[_0xf705('0xb2')]][_0xf705('0x5b')]+=0x1;var _0x802f37=_0x5beb81['campaigns'][_0x4d648c[_0xf705('0xb2')]];var _0x1c2756=new Hangup(_0x4d648c,_0xd75dcf);_0x1c2756[_0xf705('0xa5')]=0x13;_0x1c2756['statedesc']=_0xf705('0xee');_0x1c2756[_0xf705('0xe6')]=_0xf705('0xe7');_0x1c2756[_0xf705('0xf4')]+=0x1;_0x1c2756[_0xf705('0xef')]+=0x1;_0x1c2756[_0xf705('0xea')]=!![];ami['emit'](_0xf705('0xe8'),ut[_0xf705('0xe9')](_0x1c2756,'amd'));_0x5beb81[_0xf705('0xc6')](_0x1c2756)[_0xf705('0xb5')](loggerCatch(_0xf705('0xf0')));if(_0x1c2756[_0xf705('0xf1')]+_0x1c2756[_0xf705('0xf2')]+_0x1c2756[_0xf705('0x100')]+_0x1c2756[_0xf705('0x101')]+_0x1c2756[_0xf705('0xf3')]+_0x1c2756[_0xf705('0x102')]+_0x1c2756[_0xf705('0xf4')]+_0x1c2756[_0xf705('0xf5')]>=_0x802f37[_0xf705('0x103')]){_0x5beb81[_0xf705('0x104')](_0x1c2756,_0x2826de,_0x31bb99,_0xf705('0xf6'));}else{if(_0x1c2756['countmachineretry']>=_0x802f37[_0xf705('0xf7')]){_0x5beb81[_0xf705('0xf8')](_0x1c2756,_0x2826de,_0x31bb99,_0xf705('0xf9'));}else{_0x5beb81[_0xf705('0xbd')]({'active':![],'countmachineretry':_0x1c2756[_0xf705('0xf4')],'scheduledat':moment()['add'](_0x802f37[_0xf705('0xfb')],_0xf705('0x105'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1c2756['ContactId'],'ListId':_0x1c2756[_0xf705('0xd0')],'VoiceQueueId':_0x1c2756['VoiceQueueId']||undefined,'CampaignId':_0x1c2756['CampaignId']||undefined})['catch'](loggerCatch(_0xf705('0xfd')));_0x2826de({'reschedule':0x1});}}});}}};Dialer[_0xf705('0x1a')][_0xf705('0x34')]=function(_0x55d8c6){var _0x56d016=this['uniqueId'][_0x55d8c6[_0xf705('0xdd')]];var _0x46d486=this;var _0x40a891;if(_0x56d016&&_0x56d016[_0xf705('0x4a')]===_0xf705('0x78')){delete this[_0xf705('0x26')][_0x55d8c6[_0xf705('0xdd')]];this[_0xf705('0xb1')](this['campaigns'][_0x56d016[_0xf705('0xb2')]]);this['campaigns'][_0x56d016[_0xf705('0xb2')]][_0xf705('0x106')]+=0x1;_0x40a891=new Hangup(_0x56d016,_0x55d8c6);this['createHistory'](_0x40a891)['catch'](loggerCatch(_0xf705('0x107')));this['moveContactManagedDialer'](_0x40a891)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x56d016&&_0x56d016[_0xf705('0x4a')]!=='ivr'&&isNotNull(this[_0xf705('0x1f')][_0x56d016[_0xf705('0xb2')]]['dialQueueProject'])){delete this[_0xf705('0x26')][_0x55d8c6[_0xf705('0xdd')]];this[_0xf705('0xb1')](this[_0xf705('0x1f')][_0x56d016[_0xf705('0xb2')]]);this[_0xf705('0x1f')][_0x56d016[_0xf705('0xb2')]][_0xf705('0x5c')]+=0x1;this['voiceQueues'][_0x56d016[_0xf705('0xb2')]][_0xf705('0x5b')]+=0x1;_0x40a891=new Hangup(_0x56d016,_0x55d8c6);_0x40a891['state']=0x10;_0x40a891[_0xf705('0xa6')]=_0xf705('0x108');_0x40a891[_0xf705('0xe6')]=_0xf705('0x109');this['createHistory'](_0x40a891)[_0xf705('0xb5')](loggerCatch(_0xf705('0x107')));this['moveContactManagedDialer'](_0x40a891)[_0xf705('0xb5')](loggerCatch('[syncHangupIvr]'));}if(_0x56d016&&_0x56d016['type']!==_0xf705('0x78')&&!isNotNull(this[_0xf705('0x1f')][_0x56d016['queue']]['dialQueueProject'])){delete this[_0xf705('0x26')][_0x55d8c6[_0xf705('0xdd')]];this[_0xf705('0xb1')](this[_0xf705('0x1f')][_0x56d016[_0xf705('0xb2')]]);this[_0xf705('0x1f')][_0x56d016['queue']][_0xf705('0x64')]+=0x1;_0x40a891=new Hangup(_0x56d016,_0x55d8c6);_0x40a891[_0xf705('0xa5')]=0xc;_0x40a891[_0xf705('0xa6')]=_0x55d8c6[_0xf705('0x10a')];_0x40a891[_0xf705('0xe6')]=_0xf705('0x10b');this[_0xf705('0xc6')](_0x40a891)[_0xf705('0xb5')](loggerCatch(_0xf705('0x107')));this[_0xf705('0xc4')](_0x40a891)[_0xf705('0xb5')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xf705('0x1a')][_0xf705('0x31')]=function(_0x169f79){var _0x1b8528=this[_0xf705('0x26')][_0x169f79['uniqueid']];var _0x4b7965=this;if(this[_0xf705('0x1f')][_0x169f79[_0xf705('0xb2')]]){if(_0x1b8528&&_0x1b8528['type']!==_0xf705('0x78')){delete this[_0xf705('0x26')][_0x169f79['uniqueid']];this[_0xf705('0x1f')][_0x169f79[_0xf705('0xb2')]]['outboundAnswerCallsDay']+=0x1;var _0x3dac55=new AgentComplete(_0x1b8528,_0x169f79);if(_0x169f79['reason']===_0xf705('0x10c')){_0x3dac55['agiafterat']=this[_0xf705('0x1f')][_0x169f79[_0xf705('0xb2')]]['dialQueueProject2']&&this[_0xf705('0x1f')][_0x169f79[_0xf705('0xb2')]][_0xf705('0x10d')]?moment()[_0xf705('0x79')](_0xf705('0xfc')):undefined;}this['createHistory'](_0x3dac55)[_0xf705('0xb5')](loggerCatch(_0xf705('0x10e')));this[_0xf705('0xc4')](_0x3dac55)['catch'](loggerCatch(_0xf705('0x10f')));}}};Dialer['prototype'][_0xf705('0x2b')]=function(_0x54de0e){if(this[_0xf705('0x1f')][_0x54de0e[_0xf705('0xb2')]]){if(this[_0xf705('0x26')][_0x54de0e[_0xf705('0xdd')]]&&this[_0xf705('0x26')][_0x54de0e[_0xf705('0xdd')]][_0xf705('0x4a')]!==_0xf705('0x78')){this[_0xf705('0xb1')](this[_0xf705('0x1f')][_0x54de0e['queue']]);this['uniqueId'][_0x54de0e[_0xf705('0xdd')]][_0xf705('0x110')]=moment()['format'](_0xf705('0xfc'));}}};Dialer[_0xf705('0x1a')][_0xf705('0x111')]=function(_0x5bf7bf){this[_0xf705('0xc6')](_0x5bf7bf)[_0xf705('0xb5')](loggerCatch(_0xf705('0x10e')));this[_0xf705('0xc4')](_0x5bf7bf)['catch'](loggerCatch(_0xf705('0x112')));};Dialer[_0xf705('0x1a')]['syncQueueCallerAbandon']=function(_0x59d4db){var _0x4bd52e=this['uniqueId'][_0x59d4db[_0xf705('0xdd')]];var _0x26803c=this;if(this[_0xf705('0x1f')][_0x59d4db['queue']]){if(_0x4bd52e&&_0x4bd52e[_0xf705('0x4a')]!==_0xf705('0x78')){delete this[_0xf705('0x26')][_0x59d4db['uniqueid']];this[_0xf705('0xb1')](this[_0xf705('0x1f')][_0x59d4db[_0xf705('0xb2')]]);_0x4bd52e[_0xf705('0x113')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x11354f=new QueueCallerAbandon(_0x4bd52e,_0x59d4db);if(getSeconds(_0x4bd52e[_0xf705('0x113')],_0x4bd52e[_0xf705('0x114')])>=_0x4bd52e['dialQueueTimeout']){this[_0xf705('0x1f')][_0x59d4db[_0xf705('0xb2')]][_0xf705('0x7f')]+=0x1;this['voiceQueues'][_0x59d4db[_0xf705('0xb2')]][_0xf705('0x5f')]+=0x1;this['voiceQueues'][_0x59d4db['queue']][_0xf705('0x69')]+=0x1;_0x11354f[_0xf705('0xa5')]=0xa;_0x11354f[_0xf705('0xa6')]=_0xf705('0x115');_0x11354f['dropreason']=_0xf705('0x116');_0x11354f[_0xf705('0x117')]=this[_0xf705('0x1f')][_0x59d4db[_0xf705('0xb2')]]['dialQueueProject2']?moment()['format'](_0xf705('0xfc')):undefined;_0x11354f[_0xf705('0xf3')]+=0x1;_0x11354f[_0xf705('0xef')]+=0x1;if(_0x11354f[_0xf705('0xf3')]>=this[_0xf705('0x1f')][_0x59d4db[_0xf705('0xb2')]]['dialDropMaxRetry']){this[_0xf705('0x111')](_0x11354f);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x11354f[_0xf705('0xf3')],'scheduledat':moment()['add'](this['voiceQueues'][_0x59d4db[_0xf705('0xb2')]]['dialDropRetryFrequency'],_0xf705('0x105'))[_0xf705('0x79')](_0xf705('0xfc')),'ContactId':_0x4bd52e[_0xf705('0xcf')],'ListId':_0x4bd52e[_0xf705('0xd0')],'VoiceQueueId':_0x4bd52e[_0xf705('0xd2')]||undefined,'CampaignId':_0x4bd52e[_0xf705('0xd3')]||undefined})[_0xf705('0xb5')](loggerCatch(_0xf705('0x118')));var _0x4da0a8=new History(_0x11354f);_0x4da0a8[_0xf705('0xa5')]=0xa;_0x4da0a8[_0xf705('0xa6')]=_0xf705('0x115');_0x4da0a8[_0xf705('0xa8')]=moment()[_0xf705('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x4da0a8[_0xf705('0xa7')]=_0x4da0a8[_0xf705('0xa8')];_0x4da0a8[_0xf705('0x119')]=_0x11354f[_0xf705('0x119')];_0x4da0a8['calleridnum']=_0x11354f['calleridnum'];this['createHistory'](_0x4da0a8)[_0xf705('0xb5')](loggerCatch(_0xf705('0x11a')));}}else{this[_0xf705('0x1f')][_0x59d4db['queue']][_0xf705('0x80')]+=0x1;this[_0xf705('0x1f')][_0x59d4db[_0xf705('0xb2')]][_0xf705('0x11b')]+=0x1;_0x11354f[_0xf705('0xa5')]=0xb;_0x11354f['statedesc']=_0xf705('0x11c');_0x11354f[_0xf705('0x11d')]=_0xf705('0x11e');_0x11354f['countabandonedretry']+=0x1;_0x11354f[_0xf705('0xef')]+=0x1;if(_0x11354f[_0xf705('0x102')]>=this['voiceQueues'][_0x59d4db['queue']][_0xf705('0x11f')]){this[_0xf705('0x111')](_0x11354f);}else{this[_0xf705('0xbd')]({'active':![],'countabandonedretry':_0x11354f[_0xf705('0x102')],'scheduledat':moment()['add'](this[_0xf705('0x1f')][_0x59d4db[_0xf705('0xb2')]][_0xf705('0x120')],_0xf705('0x105'))[_0xf705('0x79')](_0xf705('0xfc')),'ContactId':_0x4bd52e[_0xf705('0xcf')],'ListId':_0x4bd52e[_0xf705('0xd0')],'VoiceQueueId':_0x4bd52e['VoiceQueueId']||undefined,'CampaignId':_0x4bd52e['CampaignId']||undefined})[_0xf705('0xb5')](loggerCatch(_0xf705('0x121')));var _0x4da0a8=new History(_0x11354f);_0x4da0a8[_0xf705('0xa5')]=0xb;_0x4da0a8['statedesc']='Abandoned';_0x4da0a8[_0xf705('0xa8')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4da0a8['endtime']=_0x4da0a8[_0xf705('0xa8')];_0x4da0a8[_0xf705('0x119')]=_0x11354f[_0xf705('0x119')];_0x4da0a8[_0xf705('0x122')]=_0x11354f['calleridnum'];this[_0xf705('0xc6')](_0x4da0a8)[_0xf705('0xb5')](loggerCatch(_0xf705('0x123')));}}}}};Dialer['prototype'][_0xf705('0x35')]=function(_0xfd8b69){if(this[_0xf705('0x24')][_0xfd8b69['uniqueid']]){this[_0xf705('0x24')][_0xfd8b69[_0xf705('0xdd')]]['channel']=_0xfd8b69['channel'];}if(this[_0xf705('0x26')][_0xfd8b69[_0xf705('0xdd')]]){this[_0xf705('0x26')][_0xfd8b69[_0xf705('0xdd')]][_0xf705('0xaf')]=_0xfd8b69[_0xf705('0xaf')];}};Dialer[_0xf705('0x1a')]['syncQueueMember']=function(_0x344579){if(strategy[this[_0xf705('0x1f')][this[_0xf705('0x24')][_0x344579[_0xf705('0x124')]][_0xf705('0xb2')]]['strategy']]==='roundrobin'){if(this['actions'][_0x344579[_0xf705('0x124')]]&&_[_0xf705('0xad')](this['actions'][_0x344579[_0xf705('0x124')]][_0xf705('0x125')])&&_0x344579[_0xf705('0xdb')]==='1'&&_0x344579[_0xf705('0x126')]==='0'){if(this[_0xf705('0x21')][_0x344579['stateinterface']]){if(!this[_0xf705('0x21')][_0x344579['stateinterface']][_0xf705('0x125')]){this[_0xf705('0x21')][_0x344579[_0xf705('0x127')]][_0xf705('0x125')]=!![];this[_0xf705('0x24')][_0x344579[_0xf705('0x124')]][_0xf705('0x125')]=!![];this[_0xf705('0x24')][_0x344579[_0xf705('0x124')]][_0xf705('0x127')]=_0x344579['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this[_0xf705('0x24')][_0x344579[_0xf705('0x124')]][_0xf705('0xb2')]][_0xf705('0x4b')]]||'rrmemory')===_0xf705('0x18')){if(this['actions'][_0x344579['actionid']]){if(this['agents'][_0x344579[_0xf705('0x127')]]){this['actions'][_0x344579[_0xf705('0x124')]][_0xf705('0x127')]=_0x344579[_0xf705('0x127')];if(_[_0xf705('0xad')](this['queueBooked'][this[_0xf705('0x24')][_0x344579[_0xf705('0x124')]][_0xf705('0xb2')]])){this[_0xf705('0x28')][this[_0xf705('0x24')][_0x344579[_0xf705('0x124')]][_0xf705('0xb2')]]=[];}this[_0xf705('0x28')][this[_0xf705('0x24')][_0x344579[_0xf705('0x124')]]['queue']][_0xf705('0x128')](_[_0xf705('0xce')](_['pick'](this[_0xf705('0x24')][_0x344579[_0xf705('0x124')]],[_0xf705('0x129'),_0xf705('0x127')]),{'status':_0x344579[_0xf705('0xdb')],'paused':_0x344579[_0xf705('0x126')]}));}}}};function unlockQueueStatus(_0x23a985,_0x29bf40){setTimeout(function(){if(_[_0xf705('0x84')](_0x23a985[_0xf705('0x12a')])){loggerBooked[_0xf705('0x94')](_0xf705('0x12b'),_0x29bf40);}_0x23a985[_0xf705('0x12a')]=!![];loggerBooked['info'](_0xf705('0x12c'),_0x29bf40,JSON['stringify'](_[_0xf705('0x12d')](_0x23a985,[_0xf705('0x3c'),_0xf705('0x12a')])));},0x1f3);}Dialer['prototype'][_0xf705('0x12e')]=function(_0x563a0e){var _0x54c5e2=this;var _0x4d7502=_0x54c5e2['voiceQueues'][_0x54c5e2['actions'][_0x563a0e[_0xf705('0x124')]][_0xf705('0xb2')]];if(strategy[this['voiceQueues'][this[_0xf705('0x24')][_0x563a0e[_0xf705('0x124')]][_0xf705('0xb2')]][_0xf705('0x4b')]]===_0xf705('0x19')){if(this['actions'][_0x563a0e[_0xf705('0x124')]]&&this[_0xf705('0x24')][_0x563a0e['actionid']][_0xf705('0x127')]){this['preview'][_0xf705('0x12f')](this['actions'][_0x563a0e[_0xf705('0x124')]][_0xf705('0x129')],this['actions'][_0x563a0e[_0xf705('0x124')]][_0xf705('0x127')])[_0xf705('0xb5')](function(_0x21cf88){logger['error'](_0xf705('0x130'),util[_0xf705('0x96')](_0x21cf88,{'showHidden':![],'depth':null}));})[_0xf705('0x1d')](function(){_0x54c5e2[_0xf705('0xb1')](_0x54c5e2[_0xf705('0x1f')][_0x54c5e2[_0xf705('0x24')][_0x563a0e['actionid']][_0xf705('0xb2')]]);_0x54c5e2[_0xf705('0x21')][_0x54c5e2[_0xf705('0x24')][_0x563a0e[_0xf705('0x124')]][_0xf705('0x127')]]['locked']=![];delete _0x54c5e2[_0xf705('0x24')][_0x563a0e['actionid']];unlockQueueStatus(_0x4d7502);});}else{this[_0xf705('0xb1')](this['voiceQueues'][this[_0xf705('0x24')][_0x563a0e[_0xf705('0x124')]][_0xf705('0xb2')]]);this[_0xf705('0xbd')]({'active':![],'ContactId':this['actions'][_0x563a0e['actionid']][_0xf705('0xcf')],'ListId':this[_0xf705('0x24')][_0x563a0e[_0xf705('0x124')]][_0xf705('0xd0')],'VoiceQueueId':this[_0xf705('0x24')][_0x563a0e[_0xf705('0x124')]][_0xf705('0xd2')]||undefined,'CampaignId':this[_0xf705('0x24')][_0x563a0e[_0xf705('0x124')]][_0xf705('0xd3')]||undefined})[_0xf705('0xb5')](loggerCatch(_0xf705('0x131')));delete this[_0xf705('0x24')][_0x563a0e[_0xf705('0x124')]];unlockQueueStatus(_0x4d7502);}}else if((strategy[this[_0xf705('0x1f')][this[_0xf705('0x24')][_0x563a0e[_0xf705('0x124')]][_0xf705('0xb2')]][_0xf705('0x4b')]]||'rrmemory')===_0xf705('0x18')){var _0x14b79f;if(this[_0xf705('0x24')][_0x563a0e['actionid']]&&!_[_0xf705('0x43')](this[_0xf705('0x28')][this[_0xf705('0x24')][_0x563a0e[_0xf705('0x124')]]['queue']])){if(this[_0xf705('0x29')][_0x54c5e2['actions'][_0x563a0e[_0xf705('0x124')]]['queue']]){this[_0xf705('0x29')][_0x54c5e2[_0xf705('0x24')][_0x563a0e['actionid']][_0xf705('0xb2')]]=this[_0xf705('0x29')][this[_0xf705('0x24')][_0x563a0e[_0xf705('0x124')]][_0xf705('0xb2')]]?this[_0xf705('0x29')][this[_0xf705('0x24')][_0x563a0e[_0xf705('0x124')]][_0xf705('0xb2')]]:this['queueBooked'][this[_0xf705('0x24')][_0x563a0e[_0xf705('0x124')]][_0xf705('0xb2')]]?this[_0xf705('0x28')][this['actions'][_0x563a0e[_0xf705('0x124')]]['queue']][_0xf705('0x132')]||0x0:0x0;}this[_0xf705('0x28')][this['actions'][_0x563a0e[_0xf705('0x124')]][_0xf705('0xb2')]][_0xf705('0x132')]=this[_0xf705('0x29')][this[_0xf705('0x24')][_0x563a0e[_0xf705('0x124')]][_0xf705('0xb2')]];for(var _0x2f5e73=0x0;_0x2f5e73=0x0;})[_0xf705('0xb5')](myreject(_0x65d4a3)));}}else{_0x1457d9[_0xf705('0x128')](ami[_0xf705('0xae')]({'action':_0xf705('0x14e'),'command':util[_0xf705('0x79')](_0xf705('0x149'),_0x5468a4,!_[_0xf705('0x84')](config[_0xf705('0x146')][_0x31ebac])?_0x31ebac:'')})[_0xf705('0xb4')](function(_0x25c044){return _0x25c044[_0xf705('0x14b')][_0xf705('0x14c')](_0xf705('0x14d'))>=0x0;})[_0xf705('0xb5')](myreject(_0x65d4a3)));}BPromise['all'](_0x1457d9)['then'](function(_0x42273c){var _0x754469=_[_0xf705('0x14f')](_0x42273c);if(_0x754469){return _0x30a1bf(_0x754469);}else{_0x18bfe1[_0xf705('0x3a')]=_0xe50fbb?_0xf705('0x150'):'INTERVAL_IS_OVERTIME';return _0x65d4a3(msgResponse(_0xf705('0x151'),_0xf705('0x142'),_0xf705('0x152')+_0xe50fbb+'\x20'+_0x50efb5+_0xf705('0x153')+util['inspect'](_0x5468a4,{'showHidden':![],'depth':null})+_0xf705('0x154')+_0x31ebac));}})[_0xf705('0xb5')](function(_0x227d49){return _0x65d4a3(msgResponse(_0xf705('0x140'),_0xf705('0x142'),JSON[_0xf705('0x75')](_0x227d49)));});});};Dialer['prototype'][_0xf705('0x155')]=function(_0x3954e5){var _0x267ece=this;return function(){switch(_0x3954e5[_0xf705('0x56')]){case _0xf705('0x156'):freeVariablesPredictive(_0x3954e5);_0x267ece[_0xf705('0x157')](_0x3954e5,0x1);break;case'power':freeVariablesPredictive(_0x3954e5);_0x267ece[_0xf705('0x157')](_0x3954e5,_0x3954e5['dialPowerLevel']);break;case _0xf705('0x9'):_0x267ece[_0xf705('0x9')](_0x3954e5);break;case _0xf705('0x8'):freeVariablesPredictive(_0x3954e5);_0x267ece[_0xf705('0x157')](_0x3954e5,0x1);break;default:freeVariablesPredictive(_0x3954e5);logger[_0xf705('0x94')](_0xf705('0x158'),_0x3954e5[_0xf705('0x3c')],_0xf705('0x159'));}};};Dialer[_0xf705('0x1a')][_0xf705('0x15a')]=function(_0x229fc6){var _0x34c266=this;return function(){_0x34c266[_0xf705('0x15b')](_0x229fc6);};};Dialer['prototype'][_0xf705('0x15c')]=function(_0x45c20){var _0x40dd72=this;if(isNotPreview(_0x45c20[_0xf705('0x56')])){if(isVoiceQueueOutbound(_0x45c20[_0xf705('0x4a')])&&isActive(_0x45c20['dialActive'])){_0x45c20[_0xf705('0x9f')]=!![];BPromise['resolve']()[_0xf705('0xb4')](checkIsLoggedIn(_0x45c20,_0x45c20[_0xf705('0x15d')]))[_0xf705('0xb4')](checkIsActive(_0x45c20,_0x45c20['dialActive']))['then'](checkInterval(_0x45c20))[_0xf705('0xb4')](_0x40dd72[_0xf705('0x13d')](_0x45c20))[_0xf705('0xb4')](_0x40dd72[_0xf705('0x15e')](_0x45c20[_0xf705('0x15f')],_0x45c20[_0xf705('0x160')],_0x45c20[_0xf705('0x3c')],_0x45c20))[_0xf705('0xb4')](_0x40dd72['checkIfTimeIntervals'](_0x45c20[_0xf705('0x40')],_0x45c20[_0xf705('0x160')],_0x45c20[_0xf705('0x3c')],_0x45c20))['then'](_0x40dd72[_0xf705('0x155')](_0x45c20))['catch'](loggerCatchQueueSummary(_0xf705('0x161'),_0x45c20));}else{notSendMessagesQueue(_0x45c20);}}else{freeVariablesPredictive(_0x45c20);}};Dialer[_0xf705('0x1a')][_0xf705('0x13c')]=function(){var _0x1903cb=this;var _0x3fc470;for(var _0x47a3ea in this[_0xf705('0x20')]){if(typeof this[_0xf705('0x20')][_0x47a3ea]!==_0xf705('0x98')){_0x3fc470=this[_0xf705('0x20')][_0x47a3ea];if(isCampaignIvr(_0x3fc470['type'])&&isActive(_0x3fc470[_0xf705('0x162')])){_0x3fc470['sendMessageOneNotActive']=!![];BPromise[_0xf705('0xb8')]()[_0xf705('0xb4')](checkIsActive(_0x3fc470,_0x3fc470['active']))[_0xf705('0xb4')](checkInterval(_0x3fc470))[_0xf705('0xb4')](_0x1903cb[_0xf705('0x13d')](_0x3fc470))[_0xf705('0xb4')](_0x1903cb[_0xf705('0x15e')](_0x3fc470[_0xf705('0x15f')],_0x3fc470[_0xf705('0x160')],_0x3fc470[_0xf705('0x3c')],_0x3fc470))[_0xf705('0xb4')](_0x1903cb[_0xf705('0x141')](_0x3fc470[_0xf705('0x40')],_0x3fc470[_0xf705('0x160')],_0x3fc470[_0xf705('0x3c')],_0x3fc470))[_0xf705('0xb4')](_0x1903cb['launchHandleIvr'](_0x3fc470))[_0xf705('0xb5')](loggerCatchQueueSummary(_0xf705('0x163'),_0x3fc470));}else{notSendMessagesCampaign(_0x3fc470);}}}};function getCallerIdRandom(_0xc76fc1,_0x17e6b6){var _0x14439d;var _0x320d62;var _0x219112;if(_0x17e6b6<=0x0){_0x17e6b6=0x1;}_0x14439d=new RegExp('\x5cw{0,'+_0x17e6b6+'}$');_0x320d62=Math[_0xf705('0x164')](0xa,_0x17e6b6-0x1);_0x219112=Math['pow'](0xa,_0x17e6b6)-0x1;return util[_0xf705('0x79')]('%s',_[_0xf705('0x165')](_0xc76fc1,_0x14439d,_[_0xf705('0x166')](_0x320d62,_0x219112)));}function extractCalleridName(_0x328a2c){var _0x3e00b7=_0x328a2c[_0xf705('0x167')](/"(.*?)"/);return _0x3e00b7?_0x3e00b7[0x1]:_0x328a2c;}function extractCalleridNumber(_0x1755f2){var _0x3ae493=_0x1755f2[_0xf705('0x167')](/<(.*?)>/);return _0x3ae493?_0x3ae493[0x1]:_0x1755f2;}Dialer[_0xf705('0x1a')][_0xf705('0x168')]=function(_0x2de384,_0x46568f){var _0x4c988b=this;var _0x5f18d8=uuid['v4']();this[_0xf705('0x24')][_0x5f18d8]=new Action(_0x2de384,_0x46568f,_0x5f18d8);return new BPromise(function(_0x55003a,_0x2662bb){if(_['isUndefined'](_0x2de384)&&typeof _0x2de384!=='object'){return _0x2662bb(msgResponse(_0xf705('0x169'),_0xf705('0x142'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x46568f[_0xf705('0x16a')][_0xf705('0x16b')])||_0x46568f['Contact'][_0xf705('0x16b')]===null){return _0x2662bb(msgResponse(_0xf705('0x169'),'Failure','contact\x20is\x20undefine'));}var _0x36624e={'XMD-CALLERID':_0x4c988b['actions'][_0x5f18d8]['getCaller'](),'XMD-AGI':_0x2de384[_0xf705('0x16c')]?util['format'](_0xf705('0x16d'),ipAgi,_0x2de384[_0xf705('0x16c')]):_0xf705('0x16e'),'XMD-AGIAFTER':_0x2de384[_0xf705('0x16f')]?util[_0xf705('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2de384['dialQueueProject2']):_0xf705('0x16e'),'XMD-QUEUE':_0x2de384['type']===_0xf705('0x170')?util[_0xf705('0x79')](_0xf705('0x171'),_0x2de384[_0xf705('0x3c')],_0x2de384[_0xf705('0x172')]||'',_0x2de384[_0xf705('0x10d')]?'c':'',_0x2de384[_0xf705('0x173')]||0x3):_0xf705('0x16e'),'XMD-CONTACTID':_0x46568f[_0xf705('0xcf')],'XMD-CDRTYPE':_0xf705('0x7'),'CALLERID(all)':_0x4c988b[_0xf705('0x24')][_0x5f18d8][_0xf705('0x174')](),'XMD-AMD':_0x2de384[_0xf705('0xe2')]?_0xf705('0x175'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x2de384['dialAMDActive']){_0x36624e[_0xf705('0x176')]=_0x2de384[_0xf705('0x177')]||0x9c4;_0x36624e[_0xf705('0x178')]=_0x2de384[_0xf705('0x179')]||0x5dc;_0x36624e[_0xf705('0x17a')]=_0x2de384[_0xf705('0x17b')]||0x320;_0x36624e[_0xf705('0x17c')]=_0x2de384[_0xf705('0x17d')]||0x1388;_0x36624e[_0xf705('0x17e')]=_0x2de384[_0xf705('0x17f')]||0x64;_0x36624e[_0xf705('0x180')]=_0x2de384[_0xf705('0x181')]||0x32;_0x36624e[_0xf705('0x182')]=_0x2de384[_0xf705('0x183')]||0x3;_0x36624e['XMD-AMDSILENCETHRESHOLD']=_0x2de384[_0xf705('0x184')]||0x100;_0x36624e['XMD-AMDMAXIMUMWORDLENGTH']=_0x2de384[_0xf705('0x185')]||0x1388;}if(_0x2de384[_0xf705('0x4a')]==='outbound'){_0x36624e[_0xf705('0x186')]=_0x46568f[_0xf705('0xd2')];}else{_0x36624e['XMD-CAMPAIGNID']=_0x46568f[_0xf705('0xd3')];}for(var _0x25e08d in _0x46568f['Contact']){if(typeof _0x46568f[_0xf705('0x16a')][_0x25e08d]!=='undefined'){if(isNotNull(_0x46568f[_0xf705('0x16a')][_0x25e08d])&&_0x25e08d!=='id'&&_0x25e08d!==_0xf705('0x187')&&_0x25e08d!==_0xf705('0x188')&&_0x25e08d!==_0xf705('0x189')){_0x36624e[util[_0xf705('0x79')]('%s%s','XMD-',_['toUpper'](_0x25e08d))]=_0x46568f[_0xf705('0x16a')][_0x25e08d];}}}var _0x2d80a5=_0x4c988b[_0xf705('0xd8')](_0x2de384[_0xf705('0x73')])?getCallerId(_0x2de384[_0xf705('0x73')][_0xf705('0x74')],_0x2de384[_0xf705('0x57')],_0x2de384[_0xf705('0x18a')]>0x0?getCallerIdRandom(_0x2de384[_0xf705('0x58')],_0x2de384['dialRandomLastDigitCallerIdNumber']):_0x2de384[_0xf705('0x58')]):getCallerId(_['isNil'](_0x2de384[_0xf705('0x13e')])?_0x2de384[_0xf705('0x73')][_0xf705('0x74')]:_0x2de384[_0xf705('0x13e')][_0xf705('0x74')],_0x2de384[_0xf705('0x57')],_0x2de384[_0xf705('0x18a')]>0x0?getCallerIdRandom(_0x2de384[_0xf705('0x58')],_0x2de384[_0xf705('0x18a')]):_0x2de384['dialOriginateCallerIdNumber']);if(_0x2d80a5){_0x36624e[_0xf705('0x18b')]=_0x4c988b['actions'][_0x5f18d8][_0xf705('0x18c')]=extractCalleridName(_0x2d80a5);_0x36624e[_0xf705('0x18d')]=_0x4c988b[_0xf705('0x24')][_0x5f18d8][_0xf705('0x18e')]=extractCalleridNumber(_0x2d80a5);}return ami[_0xf705('0xae')]({'actionid':_0x5f18d8,'action':_0xf705('0x169'),'channel':_0x4c988b['isTrunkReachable'](_0x2de384[_0xf705('0x73')])?util[_0xf705('0x79')](_0xf705('0x18f'),_0x2de384[_0xf705('0x73')][_0xf705('0x3c')],isNotNull(_0x2de384['dialPrefix'])?_0x2de384[_0xf705('0x5a')]['trim']()||'':'',_0x2de384[_0xf705('0x190')]>0x0?_0x46568f[_0xf705('0x16a')][_0xf705('0x16b')]['substring'](_0x2de384['dialCutDigit']):_0x46568f[_0xf705('0x16a')]['phone']):util[_0xf705('0x79')](_0xf705('0x18f'),_[_0xf705('0xad')](_0x2de384[_0xf705('0x13e')])?_0x2de384[_0xf705('0x73')][_0xf705('0x3c')]:_0x2de384[_0xf705('0x13e')][_0xf705('0x3c')],isNotNull(_0x2de384[_0xf705('0x5a')])?_0x2de384[_0xf705('0x5a')][_0xf705('0x191')]()||'':'',_0x2de384[_0xf705('0x190')]>0x0?_0x46568f[_0xf705('0x16a')]['phone'][_0xf705('0x192')](_0x2de384['dialCutDigit']):_0x46568f['Contact'][_0xf705('0x16b')]),'callerid':_0x2d80a5,'Exten':_0xf705('0xe1'),'Context':_0xf705('0x193'),'Priority':'1','variable':_0x36624e,'timeout':(_0x2de384[_0xf705('0x59')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5f18d8})[_0xf705('0xb4')](function(_0x5e82a2){return _0x55003a(_0x5e82a2);})[_0xf705('0xb5')](function(_0x1e5e6b){_0x2de384['outboundOriginateFailureCallsDay']+=0x1;var _0x5b547f=new History(_0x4c988b[_0xf705('0x24')][_0x5f18d8]);logger['error'](util[_0xf705('0x79')]('[originateError]:\x20%s',JSON['stringify'](_0x1e5e6b)));_0x5b547f['state']=0xe;_0x5b547f[_0xf705('0xa6')]=_0xf705('0x194');_0x5b547f['starttime']=moment()['format'](_0xf705('0xfc'));_0x5b547f[_0xf705('0xa7')]=_0x5b547f[_0xf705('0xa8')];_0x4c988b[_0xf705('0xc6')](_0x5b547f)['catch'](loggerCatch(_0xf705('0x195')));_0x4c988b[_0xf705('0xc4')](_0x5b547f)[_0xf705('0xb5')](loggerCatch(_0xf705('0x195')))[_0xf705('0x1d')](function(){delete _0x4c988b[_0xf705('0x24')][_0x5f18d8];return _0x2662bb(msgResponse(_0xf705('0x169'),_0xf705('0x46'),_0xf705('0x196')));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x52b4fd){var _0x4a95af=this[_0xf705('0x24')][_0x52b4fd[_0xf705('0x124')]];if(_0x4a95af){delete this[_0xf705('0x24')][_0x52b4fd[_0xf705('0x124')]];_0x4a95af[_0xf705('0x114')]=moment()[_0xf705('0x79')](_0xf705('0xfc'));var _0x2ab109=_0x4a95af[_0xf705('0x4a')]===_0xf705('0x78')?this[_0xf705('0x20')][_0x4a95af[_0xf705('0xb2')]]:this[_0xf705('0x1f')][_0x4a95af[_0xf705('0x197')]()];if(!this[_0xf705('0xd6')](_0x52b4fd['response'])){this['updateOriginated'](_0x2ab109);return this[_0xf705('0x198')](_0x4a95af,_0x2ab109,_0x52b4fd)['catch'](loggerCatch(_0xf705('0x199')));}this[_0xf705('0x26')][_0x52b4fd[_0xf705('0xdd')]]=_0x4a95af;}};Dialer[_0xf705('0x1a')][_0xf705('0x19a')]=function(_0x16584d,_0x5406fb,_0x1bc8ef){var _0x5372b4=new History(_0x5406fb);if(_0x5372b4[_0xf705('0xf1')]+_0x5372b4[_0xf705('0xf2')]+_0x5372b4[_0xf705('0x100')]+_0x5372b4['countnosuchnumberretry']+_0x5372b4['countdropretry']+_0x5372b4[_0xf705('0x102')]+_0x5372b4['countmachineretry']+_0x5372b4[_0xf705('0xf5')]>=_0x1bc8ef[_0xf705('0x103')]-0x1){return!![];}switch(_0x16584d){case 0x3:if(_0x5372b4[_0xf705('0x100')]>=_0x1bc8ef[_0xf705('0x19b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x5372b4[_0xf705('0x100')]+=0x1,'scheduledat':moment()[_0xf705('0xfa')](_0x1bc8ef[_0xf705('0x19c')],_0xf705('0x105'))[_0xf705('0x79')](_0xf705('0xfc')),'ContactId':_0x5372b4[_0xf705('0xcf')],'ListId':_0x5372b4[_0xf705('0xd0')],'VoiceQueueId':_0x5372b4[_0xf705('0xd2')]||undefined,'CampaignId':_0x5372b4[_0xf705('0xd3')]||undefined})[_0xf705('0xb5')](loggerCatch(_0xf705('0x19d')));break;case 0x5:if(_0x5372b4[_0xf705('0xf1')]>=_0x1bc8ef['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x5372b4[_0xf705('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x1bc8ef[_0xf705('0x19e')],_0xf705('0x105'))['format'](_0xf705('0xfc')),'ContactId':_0x5372b4[_0xf705('0xcf')],'ListId':_0x5372b4['ListId'],'VoiceQueueId':_0x5372b4[_0xf705('0xd2')]||undefined,'CampaignId':_0x5372b4['CampaignId']||undefined})['catch'](loggerCatch(_0xf705('0x19f')));break;case 0x8:if(_0x5372b4[_0xf705('0xf2')]>=_0x1bc8ef[_0xf705('0x1a0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x5372b4['countcongestionretry']+=0x1,'scheduledat':moment()[_0xf705('0xfa')](_0x1bc8ef[_0xf705('0x1a1')],'minutes')[_0xf705('0x79')](_0xf705('0xfc')),'ContactId':_0x5372b4[_0xf705('0xcf')],'ListId':_0x5372b4['ListId'],'VoiceQueueId':_0x5372b4[_0xf705('0xd2')]||undefined,'CampaignId':_0x5372b4[_0xf705('0xd3')]||undefined})[_0xf705('0xb5')](loggerCatch(_0xf705('0x1a2')));break;case 0x0:if(_0x5372b4['countnosuchnumberretry']>=_0x1bc8ef[_0xf705('0x1a3')]-0x1){return!![];}else{this[_0xf705('0xbd')]({'active':![],'countnosuchnumberretry':_0x5372b4[_0xf705('0x101')]+=0x1,'scheduledat':moment()[_0xf705('0xfa')](_0x1bc8ef[_0xf705('0x1a4')],_0xf705('0x105'))['format'](_0xf705('0xfc')),'ContactId':_0x5372b4[_0xf705('0xcf')],'ListId':_0x5372b4[_0xf705('0xd0')],'VoiceQueueId':_0x5372b4[_0xf705('0xd2')]||undefined,'CampaignId':_0x5372b4['CampaignId']||undefined})[_0xf705('0xb5')](loggerCatch(_0xf705('0x1a5')));}break;case 0xa:if(_0x5372b4['countdropretry']>=_0x1bc8ef[_0xf705('0x1a6')]-0x1){return!![];}this[_0xf705('0xbd')]({'active':![],'countdropretry':_0x5372b4[_0xf705('0xf3')]+=0x1,'scheduledat':moment()[_0xf705('0xfa')](_0x1bc8ef[_0xf705('0x1a7')],_0xf705('0x105'))['format'](_0xf705('0xfc')),'ContactId':_0x5372b4[_0xf705('0xcf')],'ListId':_0x5372b4[_0xf705('0xd0')],'VoiceQueueId':_0x5372b4[_0xf705('0xd2')]||undefined,'CampaignId':_0x5372b4[_0xf705('0xd3')]||undefined})[_0xf705('0xb5')](loggerCatch(_0xf705('0x118')));break;case 0xb:if(_0x5372b4[_0xf705('0x102')]>=_0x1bc8ef['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xf705('0xbd')]({'active':![],'countabandonedretry':_0x5372b4[_0xf705('0x102')]+=0x1,'scheduledat':moment()[_0xf705('0xfa')](_0x1bc8ef['dialAbandonedRetryFrequency'],'minutes')['format'](_0xf705('0xfc')),'ContactId':_0x5372b4[_0xf705('0xcf')],'ListId':_0x5372b4[_0xf705('0xd0')],'VoiceQueueId':_0x5372b4[_0xf705('0xd2')]||undefined,'CampaignId':_0x5372b4['CampaignId']||undefined})[_0xf705('0xb5')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x5372b4[_0xf705('0xf4')]>=_0x1bc8ef['dialMachineMaxRetry']-0x1){return!![];}this[_0xf705('0xbd')]({'active':![],'countmachineretry':_0x5372b4[_0xf705('0xf4')]+=0x1,'scheduledat':moment()[_0xf705('0xfa')](_0x1bc8ef[_0xf705('0xfb')],_0xf705('0x105'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5372b4[_0xf705('0xcf')],'ListId':_0x5372b4[_0xf705('0xd0')],'VoiceQueueId':_0x5372b4[_0xf705('0xd2')]||undefined,'CampaignId':_0x5372b4['CampaignId']||undefined})['catch'](loggerCatch(_0xf705('0xfd')));break;case 0x14:if(_0x5372b4['countagentrejectretry']>=_0x1bc8ef[_0xf705('0x1a8')]-0x1){return!![];}this[_0xf705('0xbd')]({'active':![],'countagentrejectretry':_0x5372b4[_0xf705('0xf5')]+=0x1,'scheduledat':moment()[_0xf705('0xfa')](_0x1bc8ef['dialAgentRejectRetryFrequency'],_0xf705('0x105'))['format'](_0xf705('0xfc')),'ContactId':_0x5372b4[_0xf705('0xcf')],'ListId':_0x5372b4[_0xf705('0xd0')],'VoiceQueueId':_0x5372b4[_0xf705('0xd2')]||undefined,'CampaignId':_0x5372b4['CampaignId']||undefined})[_0xf705('0xb5')](loggerCatch(_0xf705('0x1a9')));break;default:return!![];}};Dialer[_0xf705('0x1a')][_0xf705('0x198')]=function(_0x1226b8,_0x5264f3,_0x52f00c){var _0x4ea1b9=this;var _0x2d6b3d=new History(_0x1226b8);return new BPromise(function(_0x4eda9b,_0x23138e){if(_[_0xf705('0x84')](_0x5264f3)&&typeof _0x5264f3!==_0xf705('0x1aa')){return _0x23138e(msgResponse('[callProgressDetecting]',_0xf705('0x142'),'entity\x20is\x20undefine'));}if(_[_0xf705('0x84')](_0x52f00c)&&typeof _0x52f00c!==_0xf705('0x1aa')){return _0x23138e(msgResponse(_0xf705('0x1ab'),'Failure','evt\x20is\x20undefine'));}switch(_0x52f00c['reason']){case'0':_0x5264f3[_0xf705('0x61')]+=0x1;_0x2d6b3d[_0xf705('0xa5')]=0x0;_0x2d6b3d[_0xf705('0xa6')]=_0xf705('0x1ac');_0x2d6b3d[_0xf705('0x101')]+=0x1;_0x2d6b3d[_0xf705('0xef')]+=0x1;ami[_0xf705('0x49')]('custom:agentnosuchnumber',ut[_0xf705('0xe9')](_0x1226b8,_0xf705('0x1ad')));_0x4ea1b9['createHistory'](_0x2d6b3d)[_0xf705('0xb5')](loggerCatch(_0xf705('0xf0')));if(_0x4ea1b9[_0xf705('0x19a')](0x0,_0x1226b8,_0x5264f3)){if(_0x2d6b3d[_0xf705('0x101')]>=_0x5264f3[_0xf705('0x1a3')]){_0x4ea1b9[_0xf705('0xf8')](_0x2d6b3d,_0x4eda9b,_0x23138e,'reason\x200\x20no\x20such\x20number....');}else{_0x4ea1b9[_0xf705('0x104')](_0x2d6b3d,_0x4eda9b,_0x23138e,_0xf705('0x1ae'));}}break;case'3':_0x5264f3[_0xf705('0x60')]+=0x1;_0x2d6b3d[_0xf705('0xa5')]=0x3;_0x2d6b3d[_0xf705('0xa6')]='NoAnswer';_0x2d6b3d[_0xf705('0x100')]+=0x1;_0x2d6b3d[_0xf705('0xef')]+=0x1;ami[_0xf705('0x49')](_0xf705('0x1af'),ut[_0xf705('0xe9')](_0x1226b8,_0xf705('0x1b0')));_0x4ea1b9[_0xf705('0xc6')](_0x2d6b3d)[_0xf705('0xb5')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x4ea1b9['checkRetriveMax'](0x3,_0x1226b8,_0x5264f3)){if(_0x2d6b3d[_0xf705('0x100')]>=_0x5264f3[_0xf705('0x19b')]){_0x4ea1b9[_0xf705('0xf8')](_0x2d6b3d,_0x4eda9b,_0x23138e,_0xf705('0x1b1'));}else{_0x4ea1b9['stateGlobal'](_0x2d6b3d,_0x4eda9b,_0x23138e,_0xf705('0x1b1'));}}break;case'5':_0x5264f3['outboundBusyCallsDay']+=0x1;_0x2d6b3d[_0xf705('0xa5')]=0x5;_0x2d6b3d['statedesc']=_0xf705('0x1b2');_0x2d6b3d[_0xf705('0xf1')]+=0x1;_0x2d6b3d[_0xf705('0xef')]+=0x1;ami[_0xf705('0x49')](_0xf705('0x1b3'),ut['buildObj'](_0x1226b8,'busy'));_0x4ea1b9[_0xf705('0xc6')](_0x2d6b3d)['catch'](loggerCatch(_0xf705('0x1b4')));if(_0x4ea1b9[_0xf705('0x19a')](0x5,_0x1226b8,_0x5264f3)){if(_0x2d6b3d[_0xf705('0xf1')]>=_0x5264f3[_0xf705('0x1b5')]){_0x4ea1b9[_0xf705('0xf8')](_0x2d6b3d,_0x4eda9b,_0x23138e,_0xf705('0x1b6'));}else{_0x4ea1b9[_0xf705('0x104')](_0x2d6b3d,_0x4eda9b,_0x23138e,_0xf705('0x1b6'));}}break;case'8':_0x5264f3['outboundCongestionCallsDay']+=0x1;_0x2d6b3d['state']=0x8;_0x2d6b3d[_0xf705('0xa6')]=_0xf705('0x1b7');_0x2d6b3d['countcongestionretry']+=0x1;_0x2d6b3d[_0xf705('0xef')]+=0x1;ami['emit'](_0xf705('0x1b8'),ut['buildObj'](_0x1226b8,_0xf705('0x1b9')));_0x4ea1b9[_0xf705('0xc6')](_0x2d6b3d)[_0xf705('0xb5')](loggerCatch(_0xf705('0x1ba')));if(_0x4ea1b9[_0xf705('0x19a')](0x8,_0x1226b8,_0x5264f3)){if(_0x2d6b3d[_0xf705('0xf2')]>=_0x5264f3[_0xf705('0x1a0')]){_0x4ea1b9[_0xf705('0xf8')](_0x2d6b3d,_0x4eda9b,_0x23138e,_0xf705('0x1bb'));}else{_0x4ea1b9['stateGlobal'](_0x2d6b3d,_0x4eda9b,_0x23138e,_0xf705('0x1bb'));}}break;case'11':_0x5264f3[_0xf705('0x1bc')]+=0x1;_0x2d6b3d[_0xf705('0xa5')]=0xb;_0x2d6b3d[_0xf705('0xa6')]=_0xf705('0x11c');_0x2d6b3d[_0xf705('0x102')]+=0x1;_0x2d6b3d[_0xf705('0xef')]+=0x1;_0x4ea1b9['createHistory'](_0x2d6b3d)[_0xf705('0xb5')](loggerCatch(_0xf705('0x123')));if(_0x4ea1b9[_0xf705('0x19a')](0xb,_0x1226b8,_0x5264f3)){if(_0x2d6b3d[_0xf705('0x102')]>=_0x5264f3[_0xf705('0x11f')]){_0x4ea1b9[_0xf705('0xf8')](_0x2d6b3d,_0x4eda9b,_0x23138e,'reason\x2011\x20abandoned');}else{_0x4ea1b9[_0xf705('0x104')](_0x2d6b3d,_0x4eda9b,_0x23138e,_0xf705('0x1bd'));}}break;case'20':_0x5264f3['outboundRejectCallsDay']+=0x1;_0x2d6b3d[_0xf705('0xa5')]=0x14;_0x2d6b3d[_0xf705('0xa6')]='AgentReject';_0x2d6b3d[_0xf705('0xf5')]+=0x1;_0x2d6b3d[_0xf705('0xef')]+=0x1;ami[_0xf705('0x49')]('custom:agentreject',ut[_0xf705('0xe9')](_0x1226b8,_0xf705('0x1be')));_0x4ea1b9[_0xf705('0xc6')](_0x2d6b3d)[_0xf705('0xb5')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x4ea1b9[_0xf705('0x19a')](0x14,_0x1226b8,_0x5264f3)){if(_0x2d6b3d[_0xf705('0xf5')]>=_0x5264f3['dialAgentRejectMaxRetry']){_0x4ea1b9[_0xf705('0xf8')](_0x2d6b3d,_0x4eda9b,_0x23138e,'reason\x2020\x20agentreject');}else{_0x4ea1b9['stateGlobal'](_0x2d6b3d,_0x4eda9b,_0x23138e,_0xf705('0x1bf'));}}break;default:_0x5264f3['outboundUnknownCallsDay']+=0x1;_0x2d6b3d[_0xf705('0xa5')]=0xc;_0x2d6b3d[_0xf705('0xa6')]=_0x52f00c[_0xf705('0x1c0')];_0x4ea1b9[_0xf705('0xc6')](_0x2d6b3d)[_0xf705('0xb5')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x4ea1b9[_0xf705('0x19a')](_0x52f00c[_0xf705('0x1c0')],_0x1226b8,_0x5264f3)){if(_0x2d6b3d[_0xf705('0xf1')]+_0x2d6b3d['countcongestionretry']+_0x2d6b3d[_0xf705('0x100')]+_0x2d6b3d[_0xf705('0x101')]+_0x2d6b3d[_0xf705('0xf3')]+_0x2d6b3d['countabandonedretry']+_0x2d6b3d['countmachineretry']+_0x2d6b3d[_0xf705('0xf5')]>=_0x5264f3[_0xf705('0x103')]){_0x4ea1b9[_0xf705('0x104')](_0x2d6b3d,_0x4eda9b,_0x23138e,_0x52f00c['reason']);}else{_0x4ea1b9[_0xf705('0xf8')](_0x2d6b3d,_0x4eda9b,_0x23138e,_0x52f00c[_0xf705('0x1c0')]);}}}});};Dialer[_0xf705('0x1a')]['stateGlobal']=function(_0x63c2c9,_0x681939,_0x55d049,_0x5e4a7f){var _0xeebd9b=new Final(_0x63c2c9);_0xeebd9b[_0xf705('0xa5')]=0xf;_0xeebd9b['statedesc']=_0xf705('0x1c1');this['createStateFinal'](_0xeebd9b,_0x681939,_0x55d049,_0x5e4a7f);};Dialer[_0xf705('0x1a')]['createStateFinal']=function(_0x381f01,_0x52f884,_0x3f335d,_0x26cc8d){this[_0xf705('0xc4')](_0x381f01)['then'](function(){return _0x52f884(msgResponse(_0xf705('0x1ab'),_0xf705('0xd7'),_0x26cc8d));})[_0xf705('0xb5')](function(){return _0x3f335d(msgResponse(_0xf705('0x1c2'),_0xf705('0x142'),_0xf705('0x1c3')));});};Dialer[_0xf705('0x1a')][_0xf705('0x9')]=function(_0x5cb3cf){var _0x58cdd9=_0x5cb3cf['dialPredictiveOptimizationPercentage']/0x64;var _0x2b1216=_0x5cb3cf['outboundDropCallsDayTimeout']/(_0x5cb3cf['outboundDropCallsDayTimeout']+_0x5cb3cf[_0xf705('0x5c')]);var _0x39c16d=Math['round'](_0x5cb3cf['predictiveIntervalAvailable']*(_0x5cb3cf[_0xf705('0x1c4')]/0x64));var _0xa78a31=Math[_0xf705('0x1c5')](_0x5cb3cf[_0xf705('0x6c')]*(_0x5cb3cf[_0xf705('0x1c6')]/0x64));var _0x8f8574=_0x5cb3cf[_0xf705('0xa1')]+_0x5cb3cf['talking'];var _0x5d4601=Math['floor'](_0x5cb3cf[_0xf705('0x6f')]*_0x5cb3cf[_0xf705('0x70')]*_0x5cb3cf[_0xf705('0x1c7')]*_0x5cb3cf['predictiveIntervalMultiplicativeFactor']);if(_[_0xf705('0x84')](_0x5cb3cf['startProgressive'])){if(!_['isUndefined'](_0x5cb3cf['startPredictive'])){_0x5cb3cf[_0xf705('0x27')]=undefined;loggerPredictive[_0xf705('0x94')](_0xf705('0x1c8'),_0xf705('0x1c9'));}if(!_['isUndefined'](_0x5cb3cf[_0xf705('0x90')])){loggerPredictive[_0xf705('0x94')]('[startMethodPredictive][StartProgressive]',_0xf705('0x1ca'));clearInterval(_0x5cb3cf['handlePredictive']);_0x5cb3cf[_0xf705('0x90')]=undefined;}_0x5cb3cf[_0xf705('0x72')]=moment()[_0xf705('0x79')](_0xf705('0xfc'));loggerPredictive[_0xf705('0x7a')](_0x5cb3cf[_0xf705('0x3c')],'collection\x20data\x20in\x20progressive\x20at',_0x5cb3cf[_0xf705('0x72')]);this[_0xf705('0x157')](_0x5cb3cf,0x1);}else if(ifInterval(_0x5cb3cf[_0xf705('0x1cb')],_0x5cb3cf[_0xf705('0x72')])){this[_0xf705('0x157')](_0x5cb3cf,0x1);loggerPredictiveCalls[_0xf705('0x7a')]('[startMethodPredictive][StartProgressive][Loop]',_0x5cb3cf[_0xf705('0x72')],_0x5cb3cf[_0xf705('0x3c')]);_0x5cb3cf['erlangCalls']=0x0;_0x5cb3cf['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x58cdd9<_0x2b1216&&_0x5cb3cf['dialPredictiveOptimization']===_0xf705('0x1cc')){freeVariablesPredictive(_0x5cb3cf);loggerPredictive[_0xf705('0x7a')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xf705('0x1cd'),_0x2b1216,'startProgressive',_0x5cb3cf[_0xf705('0x3c')]);}else if(_0x5d4601<_0x5cb3cf['predictiveIntervalErlangCallsDroppedCalls']&&_0x5cb3cf['dialPredictiveOptimization']===_0xf705('0x1cc')){freeVariablesPredictive(_0x5cb3cf);loggerPredictive['info'](_0xf705('0x1ce'),_0xf705('0x1cf'),_0x5d4601,_0xf705('0x1d0'),_0x5cb3cf[_0xf705('0x69')],_0xf705('0x72'),_0x5cb3cf[_0xf705('0x3c')]);}else if(!ifInterval(_0x5cb3cf[_0xf705('0x1cb')],_0x5cb3cf[_0xf705('0x72')])&&_[_0xf705('0x84')](_0x5cb3cf[_0xf705('0x27')])&&!_[_0xf705('0x84')](_0x5cb3cf[_0xf705('0x72')])){_0x5cb3cf[_0xf705('0x27')]=moment()[_0xf705('0x79')](_0xf705('0xfc'));loggerPredictive[_0xf705('0x7a')](_0x5cb3cf['name'],_0xf705('0x1d1'),_0x5cb3cf[_0xf705('0x27')]);this[_0xf705('0x1d2')](_0x5cb3cf['dialPredictiveInterval'])['then'](this['getDataPredictive'](_0x5cb3cf))[_0xf705('0xb4')](mergeDataErlangB(_0x5cb3cf))['then'](this[_0xf705('0x1d3')](_0x5cb3cf))[_0xf705('0xb5')](loggerCatchPredictive(_0xf705('0x1d4'),_0x5cb3cf));}else if(!ifInterval(_0x5cb3cf['dialPredictiveInterval'],_0x5cb3cf[_0xf705('0x27')])){_0x5cb3cf['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x5cb3cf[_0xf705('0x27')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xf705('0x7a')](_0x5cb3cf[_0xf705('0x3c')],'recalculate\x20predictive\x20at',_0x5cb3cf[_0xf705('0x27')]);clearInterval(_0x5cb3cf[_0xf705('0x90')]);_0x5cb3cf['handlePredictive']=undefined;this[_0xf705('0x1d2')](_0x5cb3cf['dialPredictiveInterval'])[_0xf705('0xb4')](this[_0xf705('0x1d5')](_0x5cb3cf))[_0xf705('0xb4')](mergeDataErlangB(_0x5cb3cf))[_0xf705('0xb4')](this[_0xf705('0x1d3')](_0x5cb3cf))[_0xf705('0xb5')](loggerCatchPredictive(_0xf705('0x1d6'),_0x5cb3cf));}else if(_0x5cb3cf[_0xf705('0x6c')]&&_0x8f8574<_0x5cb3cf['predictiveIntervalAvailable']-_0xa78a31){freeVariablesPredictive(_0x5cb3cf);loggerPredictive[_0xf705('0x7a')](_0x5cb3cf[_0xf705('0x3c')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x8f8574,_0xf705('0x1d7'),_0x5cb3cf[_0xf705('0x6c')],'-',_0xa78a31,'=',_0x5cb3cf['predictiveIntervalAvailable']-_0xa78a31,')');}else if(_0x5cb3cf[_0xf705('0x6c')]&&_0x8f8574>_0x5cb3cf[_0xf705('0x6c')]+_0x39c16d){freeVariablesPredictive(_0x5cb3cf);loggerPredictive[_0xf705('0x7a')](_0x5cb3cf[_0xf705('0x3c')],_0xf705('0x1d8'),_0x8f8574,')\x20are\x20more\x20than\x20threshold\x20(',_0x5cb3cf[_0xf705('0x6c')],'+',_0x39c16d,'=',_0x5cb3cf[_0xf705('0x6c')]+_0x39c16d,')');}};Dialer[_0xf705('0x1a')][_0xf705('0x1d5')]=function(_0x85bf94){var _0x2fb3c1=this;return function(_0x44de25){return new BPromise(function(_0x3bc446,_0x394575){_[_0xf705('0xce')](_0x85bf94,_0x44de25[0x0]);if(checkGetDataPredictive(_0x44de25[0x0])){var _0x465183=_0x85bf94[_0xf705('0x6c')]=_0x85bf94[_0xf705('0x50')]+_0x85bf94[_0xf705('0xa1')];var _0x1aef7a=_0x85bf94[_0xf705('0x1cb')]*0x3c;var _0x4a37ee=_0x44de25[0x0][_0xf705('0x67')]+_0x44de25[0x0][_0xf705('0x66')];var _0x3da023=(_0x44de25[0x0]['predictiveIntervalAnsweredCalls']+_0x44de25[0x0][_0xf705('0x7f')]+_0x44de25[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x44de25[0x0][_0xf705('0x6d')];_0x85bf94['predictiveIntervalHitRate']=_0x3da023>0x0?_0x3da023:0x1;switch(_0x85bf94[_0xf705('0x1d9')]){case _0xf705('0x1cc'):var _0x2f9cc2=_0x85bf94[_0xf705('0x1da')]/0x64;return _0x2fb3c1['abandonmentRate'](_0x465183,_0x1aef7a,_0x4a37ee,_0x3da023,_0x2f9cc2)[_0xf705('0xb4')](function(_0xccee79){return _0x3bc446(_0xccee79);});case _0xf705('0x1db'):var _0x4d7091=_0x85bf94[_0xf705('0x1da')]/0x64;return _0x2fb3c1[_0xf705('0x1dc')](_0x465183,_0x1aef7a,_0x4a37ee,_0x3da023,_0x4d7091)[_0xf705('0xb4')](function(_0x168c8e){return _0x3bc446(_0x168c8e);});default:return _0x394575(msgResponse(_0xf705('0x1dd'),_0xf705('0x142'),_0xf705('0x1de')));}}else{return _0x394575(msgResponse(_0xf705('0x1dd'),'Failure','check\x20failure'));}});};};Dialer['prototype'][_0xf705('0x1df')]=function(_0x873c54){var _0x248d9e=this;return function(_0x5af9e3){return new BPromise(function(_0x31cc97,_0x10a922){_[_0xf705('0xce')](_0x873c54,_0x5af9e3[0x0]);if(checkGetDataPredictive(_0x5af9e3[0x0])){loggerPredictive['info'](JSON[_0xf705('0x75')](_0x5af9e3[0x0]));if(_0x873c54[_0xf705('0x1d9')]===_0xf705('0x1cc')){return _0x248d9e[_0xf705('0xc3')](_0x873c54['id'])[_0xf705('0xb4')](function(_0x416e96){var _0x382dc6=_0x873c54[_0xf705('0x15d')]-_0x416e96[0x0][_0xf705('0x1e0')];var _0x3b69df=_0x873c54[_0xf705('0x1cb')]*0x3c;var _0x29c8fb=_0x5af9e3[0x0]['predictiveIntervalAvgTalktime']+_0x5af9e3[0x0][_0xf705('0x66')];var _0x1b748e=(_0x5af9e3[0x0][_0xf705('0x65')]+_0x5af9e3[0x0][_0xf705('0x7f')]+_0x5af9e3[0x0][_0xf705('0x80')])/_0x5af9e3[0x0][_0xf705('0x6d')];var _0xafc0bd=_0x873c54[_0xf705('0x1da')]/0x64;_0x873c54[_0xf705('0x6b')]=_0x416e96[0x0][_0xf705('0x1e0')]||0x0;_0x873c54['predictiveIntervalHitRate']=_0x1b748e>0x0?_0x1b748e:0x1;return _0x248d9e[_0xf705('0x1e1')](_0x382dc6,_0x3b69df,_0x29c8fb,_0x1b748e,_0xafc0bd);})[_0xf705('0xb4')](function(_0xfefd38){return _0x31cc97(_0xfefd38);})[_0xf705('0xb5')](function(_0x100a37){return _0x10a922(msgResponse(_0xf705('0x1e2'),_0xf705('0x142'),JSON[_0xf705('0x75')](_0x100a37)));});}if(_0x873c54[_0xf705('0x1d9')]===_0xf705('0x1db')){return _0x248d9e[_0xf705('0xc3')](_0x873c54['id'])[_0xf705('0xb4')](function(_0x3b07b6){var _0x3eeb30=_0x873c54['loggedIn']-_0x3b07b6[0x0]['outboundQueuePauses'];var _0xb09f98=_0x873c54[_0xf705('0x1cb')]*0x3c;var _0x4ff62a=_0x5af9e3[0x0][_0xf705('0x67')]+_0x5af9e3[0x0][_0xf705('0x66')];var _0x39dbc3=(_0x5af9e3[0x0][_0xf705('0x65')]+_0x5af9e3[0x0][_0xf705('0x7f')]+_0x5af9e3[0x0][_0xf705('0x80')])/_0x5af9e3[0x0]['predictiveIntervalTotalCalls'];var _0x506a60=_0x873c54[_0xf705('0x1da')]/0x64;_0x873c54['predictiveIntervalPauses']=_0x3b07b6[0x0][_0xf705('0x1e0')]||0x0;_0x873c54['predictiveIntervalHitRate']=_0x39dbc3>0x0?_0x39dbc3:0x1;return _0x248d9e[_0xf705('0x1dc')](_0x3eeb30,_0xb09f98,_0x4ff62a,_0x39dbc3,_0x506a60);})['then'](function(_0x159e39){return _0x31cc97(_0x159e39);})[_0xf705('0xb5')](function(_0x1d64de){return _0x10a922(msgResponse(_0xf705('0x1e2'),'Failure',JSON[_0xf705('0x75')](_0x1d64de)));});}}else{return _0x10a922(msgResponse(_0xf705('0x1dd'),_0xf705('0x142'),'check\x20failure'));}});};};Dialer['prototype'][_0xf705('0x1d3')]=function(_0x1fbd92){var _0x5c3c62=this;return function(){var _0x16e16e=0x0;var _0x2c4fd8=Math['floor'](_0x1fbd92['erlangCallToSecond']*0x3e8);if(_0x2c4fd8>0x0){_0x2c4fd8=_0x2c4fd8<0x64?0x64:_0x2c4fd8;loggerPredictive[_0xf705('0x7a')](_0x1fbd92[_0xf705('0x3c')],_0xf705('0x1e3'),_0x2c4fd8,'milliseconds');_0x1fbd92['handlePredictive']=setInterval(function(){_0x5c3c62[_0xf705('0x90')](_0x1fbd92);loggerPredictiveCalls[_0xf705('0x7a')](_0xf705('0x1e4'),_0x16e16e+=0x1);},_0x2c4fd8);}else{loggerPredictive[_0xf705('0x7a')](_0x1fbd92[_0xf705('0x3c')],_0xf705('0x1e5'));}};};Dialer[_0xf705('0x1a')][_0xf705('0x1e6')]=function(_0x1fb21b,_0x306202){var _0x223b9a=this;return function(_0x139ff2){if(_['isEmpty'](_0x139ff2)){if(_[_0xf705('0xad')](_0x306202[_0xf705('0xd1')])||!_0x306202['recallme']){if(_0x1fb21b[_0xf705('0x56')]===_0xf705('0x8')){_0x1fb21b[_0xf705('0x12a')]=_[_0xf705('0x84')](_0x1fb21b[_0xf705('0x12a')])?!![]:_0x1fb21b[_0xf705('0x12a')];var _0x14db94=uuid['v4']();_0x223b9a[_0xf705('0x24')][_0x14db94]=new Action(_0x1fb21b,_0x306202,_0x14db94);loggerBooked['info'](_0xf705('0x1e7'),_0x14db94,_0xf705('0x1e8'),JSON[_0xf705('0x75')](_0x1fb21b[_0xf705('0x12a')]),_0xf705('0x1e9'),_0x1fb21b['name']);if(_0x1fb21b['queueStatusComplete']){_0x1fb21b[_0xf705('0x12a')]=![];_0x223b9a[_0xf705('0x28')][_0x223b9a[_0xf705('0x24')][_0x14db94]['queue']]=[];ami[_0xf705('0xae')]({'actionid':_0x14db94,'action':_0xf705('0x1ea'),'queue':_0x1fb21b[_0xf705('0x3c')]})[_0xf705('0xb5')](function(){_0x223b9a[_0xf705('0xb1')](_0x1fb21b);_0x223b9a[_0xf705('0xbd')]({'active':![],'ContactId':_0x223b9a[_0xf705('0x24')][_0x14db94][_0xf705('0xcf')],'ListId':_0x223b9a[_0xf705('0x24')][_0x14db94]['ListId'],'VoiceQueueId':_0x223b9a[_0xf705('0x24')][_0x14db94][_0xf705('0xd2')]||undefined,'CampaignId':_0x223b9a[_0xf705('0x24')][_0x14db94][_0xf705('0xd3')]||undefined})[_0xf705('0xb5')](loggerCatch(_0xf705('0x1eb')));delete _0x223b9a['actions'][_0x14db94];});}else{loggerBooked[_0xf705('0x7a')]('[booked][checkContactBlack][else]',JSON[_0xf705('0x75')](_0x1fb21b[_0xf705('0x12a')]),_0xf705('0x1e9'),_0x1fb21b['name']);_0x223b9a[_0xf705('0xb1')](_0x1fb21b);_0x223b9a['rescheduleContact']({'active':![],'ContactId':_0x223b9a['actions'][_0x14db94][_0xf705('0xcf')],'ListId':_0x223b9a[_0xf705('0x24')][_0x14db94][_0xf705('0xd0')],'VoiceQueueId':_0x223b9a[_0xf705('0x24')][_0x14db94][_0xf705('0xd2')]||undefined,'CampaignId':_0x223b9a[_0xf705('0x24')][_0x14db94][_0xf705('0xd3')]||undefined})[_0xf705('0xb5')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x223b9a['actions'][_0x14db94];}}else{return _0x223b9a['actionOriginate'](_0x1fb21b,_0x306202);}}else{if(getDiff(_0x306202[_0xf705('0x1ec')])<_0x1fb21b[_0xf705('0x1ed')]*0x3c){if(_0x306202[_0xf705('0x1ee')]&&!_0x306202[_0xf705('0x1ee')][_0xf705('0x1ef')]){_0x223b9a[_0xf705('0x1e')]['run'](_0x306202['id'])[_0xf705('0x1d')](function(){_0x223b9a[_0xf705('0xb1')](_0x1fb21b);});}else{_0x223b9a[_0xf705('0xbe')]({'active':![]},_0x306202['id'],0x1)['finally'](function(){_0x223b9a[_0xf705('0xb1')](_0x1fb21b);});}}else{_0x1fb21b[_0xf705('0x62')]+=0x1;_0x223b9a[_0xf705('0xb1')](_0x1fb21b);if(_0x1fb21b['dialRecallInQueue']){_0x223b9a[_0xf705('0xbd')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x306202[_0xf705('0xcf')],'ListId':_0x306202['ListId'],'VoiceQueueId':_0x306202[_0xf705('0xd2')]||undefined,'CampaignId':_0x306202[_0xf705('0xd3')]||undefined})[_0xf705('0xb5')](loggerCatch(_0xf705('0x1f0')));_0x223b9a[_0xf705('0xc6')](createObjHistory(_0x1fb21b,_0x306202,_0xf705('0x1f1'),0x17,'RecallInQueue'))[_0xf705('0xb5')](loggerCatch(_0xf705('0x1f2')));}else{_0x223b9a[_0xf705('0xcd')](createObjHistory(_0x1fb21b,_0x306202,_0xf705('0x1f3'),0x16,_0xf705('0x1f4')),_0xf705('0x1f5'),_0xf705('0x1f6'));}}}}else{_0x1fb21b[_0xf705('0x5d')]+=0x1;_0x223b9a[_0xf705('0xcd')](createObjHistory(_0x1fb21b,_0x306202,_0xf705('0x1f7'),0xd,_0xf705('0x1f8')),_0xf705('0x1f9'),_0xf705('0x1fa'));throw'inBlackList';}};};Dialer[_0xf705('0x1a')]['handleIvr']=function(_0xca714e){var _0x479eaf=this;var _0x2022bd=_0xca714e[_0xf705('0x1fb')]-_0xca714e['originated']-_0xca714e[_0xf705('0xc0')];emitCampaignSummary(_0xca714e);if(_0x2022bd>0x0){if(_0x2022bd>this['maxNumberOriginate']){_0x2022bd=this['maxNumberOriginate'];}_0xca714e[_0xf705('0xc0')]+=_0x2022bd;this[_0xf705('0xc2')](_0xca714e['id'],_0x2022bd,_0xca714e[_0xf705('0x1fc')],_0xca714e)[_0xf705('0xb4')](function(_0x4d2627){_0xca714e[_0xf705('0xc0')]-=_0x2022bd;_0xca714e[_0xf705('0xc0')]=_0xca714e[_0xf705('0xc0')]>0x0?_0xca714e[_0xf705('0xc0')]:0x0;if(!checkContactEmpty(_0x4d2627)){_0xca714e[_0xf705('0x3a')]=_0xf705('0x9d');logger[_0xf705('0x7a')](_0xf705('0x1fd')+_0xca714e[_0xf705('0x3c')]);}else{_0xca714e[_0xf705('0x6e')]+=_0x4d2627[_0xf705('0x97')];_0xca714e[_0xf705('0x3a')]=_0xf705('0x1fe');for(var _0x101bb4=0x0;_0x101bb4<_0x4d2627[_0xf705('0x97')];_0x101bb4+=0x1){_0xca714e[_0xf705('0x1ff')]+=0x1;if(_[_0xf705('0xad')](_0x4d2627[_0x101bb4])||_[_0xf705('0xad')](_0x4d2627[_0x101bb4][_0xf705('0x16a')])||_[_0xf705('0xad')](_0x4d2627[_0x101bb4][_0xf705('0x16a')][_0xf705('0x16b')])){_0x479eaf[_0xf705('0xcb')](_0xf705('0x200'),_0xca714e,_0x4d2627[_0x101bb4]);}else{_0x479eaf[_0xf705('0xb9')](_[_0xf705('0x12d')](_0x4d2627[_0x101bb4],[_0xf705('0xd3'),_0xf705('0x201')]))['then'](_0x479eaf[_0xf705('0x1e6')](_0xca714e,_0x4d2627[_0x101bb4]))['catch'](_0x479eaf[_0xf705('0xca')](_0xf705('0x202'),_0xca714e));}}}})[_0xf705('0xb5')](loggerGetContactDialer(_0xf705('0x203'),_0xca714e,_0x2022bd));}};Dialer[_0xf705('0x1a')][_0xf705('0x157')]=function(_0x27c596,_0x4de321){var _0x3325f0=this;var _0x3de492=[];var _0x5023af=_0x4de321>=0x1?_0x4de321:0x1;if(_0x27c596[_0xf705('0x56')]==='booked'){_0x5023af=0x1;}var _0x4cc269=Math[_0xf705('0x204')](_0x27c596[_0xf705('0xa1')]*_0x5023af)-_0x27c596[_0xf705('0x6e')]-_0x27c596[_0xf705('0xc0')];emitVoiceQueueSummary(_0x27c596);if(_0x27c596['dialLimitQueue']>0x0){var _0x22ae18=_0x27c596[_0xf705('0x205')]-_0x27c596[_0xf705('0x6e')]-_0x27c596[_0xf705('0x50')]-_0x27c596[_0xf705('0xc0')]-_0x27c596[_0xf705('0x4d')];if(_0x4cc269>_0x22ae18){_0x4cc269=_0x22ae18;}}if(_0x4cc269>0x0){if(_0x27c596['dialMethod']===_0xf705('0x8')){_0x4cc269=0x1;}if(_0x4cc269>this[_0xf705('0x23')]){_0x4cc269=this['maxNumberOriginate'];}_0x27c596['temp']+=_0x4cc269;for(var _0x34de37 in this[_0xf705('0x21')]){if(typeof this[_0xf705('0x21')][_0x34de37]!=='undefined'){if(this['agents'][_0x34de37][_0xf705('0xa5')]===_0xf705('0x206')&&this[_0xf705('0x21')][_0x34de37][_0xf705('0xdb')]==='reachable'){_0x3de492['push'](this[_0xf705('0x21')][_0x34de37]['id']);}}}this[_0xf705('0xbf')](_0x27c596['id'],_0x3de492,_0x4cc269,_0x27c596[_0xf705('0x1fc')],_0x27c596)[_0xf705('0xb4')](function(_0x49a9a4){_0x27c596[_0xf705('0xc0')]-=_0x4cc269;_0x27c596[_0xf705('0xc0')]=_0x27c596[_0xf705('0xc0')]>0x0?_0x27c596[_0xf705('0xc0')]:0x0;if(!checkContactEmpty(_0x49a9a4)){_0x3325f0['countReScheduled'](_0x27c596)[_0xf705('0xb4')](sendMessageReschedule(_0x27c596))[_0xf705('0xb5')](loggerCatch(_0xf705('0xb6')));}else{_0x27c596[_0xf705('0x6e')]+=_0x49a9a4[_0xf705('0x97')];_0x27c596[_0xf705('0x3a')]=_0x27c596[_0xf705('0x56')]===_0xf705('0x8')?_0xf705('0x175'):'RUNNING';for(var _0x57bcf3=0x0;_0x57bcf3<_0x49a9a4['length'];_0x57bcf3+=0x1){if(_[_0xf705('0xad')](_0x49a9a4[_0x57bcf3])||_['isNil'](_0x49a9a4[_0x57bcf3][_0xf705('0x16a')])||_[_0xf705('0xad')](_0x49a9a4[_0x57bcf3][_0xf705('0x16a')]['phone'])){_0x3325f0['emptyContact'](_0xf705('0x200'),_0x27c596,_0x49a9a4[_0x57bcf3]);}else{_0x3325f0[_0xf705('0xb7')](_[_0xf705('0x12d')](_0x49a9a4[_0x57bcf3],[_0xf705('0xd2'),_0xf705('0x201')]))[_0xf705('0xb4')](_0x3325f0['checkContactBlack'](_0x27c596,_0x49a9a4[_0x57bcf3]))[_0xf705('0xb5')](_0x3325f0[_0xf705('0xca')]('[actionOriginate]\x20',_0x27c596));}}}})[_0xf705('0xb5')](loggerGetContactDialer(_0xf705('0x207'),_0x27c596,_0x4cc269));}};Dialer[_0xf705('0x1a')][_0xf705('0x90')]=function(_0x263e61){if(_0x263e61['dialLimitQueue']>0x0){var _0x392807=_0x263e61[_0xf705('0x205')]-_0x263e61[_0xf705('0x6e')]-_0x263e61['talking'];if(_0x392807>0x0){this[_0xf705('0x208')](_0x263e61);}else{loggerPredictiveCalls[_0xf705('0x7a')](_0xf705('0x209'));}}else{this['tryOriginatePredictive'](_0x263e61);}};Dialer[_0xf705('0x1a')][_0xf705('0x208')]=function(_0x455078){var _0x3ed4a6=this;var _0x2f32c5=[];_0x455078[_0xf705('0x6e')]+=0x1;for(var _0x1858f7 in this[_0xf705('0x21')]){if(typeof this[_0xf705('0x21')][_0x1858f7]!=='undefined'){if(this[_0xf705('0x21')][_0x1858f7][_0xf705('0xa5')]===_0xf705('0x206')&&this[_0xf705('0x21')][_0x1858f7][_0xf705('0xdb')]===_0xf705('0xda')){_0x2f32c5[_0xf705('0x128')](this[_0xf705('0x21')][_0x1858f7]['id']);}}}this[_0xf705('0xbf')](_0x455078['id'],_0x2f32c5,0x1,_0x455078['dialOrderByScheduledAt'],_0x455078)[_0xf705('0xb4')](function(_0x4c7ec5){if(!checkContactEmpty(_0x4c7ec5)){checkContactLowerLimitOriginate(_0x455078,0x1,0x0);_0x3ed4a6[_0xf705('0x20a')](_0x455078)['then'](sendMessageReschedule(_0x455078))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x455078['message']=_0xf705('0x1fe');if(_['isNil'](_0x4c7ec5[0x0])||_[_0xf705('0xad')](_0x4c7ec5[0x0][_0xf705('0x16a')])||_[_0xf705('0xad')](_0x4c7ec5[0x0][_0xf705('0x16a')][_0xf705('0x16b')])){_0x3ed4a6[_0xf705('0xcb')]('[actionOriginate]\x20',_0x455078,_0x4c7ec5[0x0]);}else{_0x3ed4a6['checkIsBlackList'](_[_0xf705('0x12d')](_0x4c7ec5[0x0],[_0xf705('0xd2'),_0xf705('0x201')]))[_0xf705('0xb4')](_0x3ed4a6['checkContactBlack'](_0x455078,_0x4c7ec5[0x0]))[_0xf705('0xb5')](_0x3ed4a6['loggerHandler'](_0xf705('0x20b'),_0x455078));}}})[_0xf705('0xb5')](loggerGetContactDialer(_0xf705('0x20c'),_0x455078,0x1));emitVoiceQueueSummary(_0x455078);};Dialer['prototype'][_0xf705('0x1e1')]=function(_0x33ba1f,_0x57791c,_0x461e31,_0x216acf,_0x82103e,_0x25b9f1){loggerPredictive[_0xf705('0x7a')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xf705('0x7a')]('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',_0x33ba1f);loggerPredictive[_0xf705('0x7a')](_0xf705('0x20d'),_0x57791c);loggerPredictive[_0xf705('0x7a')](_0xf705('0x20e'),_0x461e31);loggerPredictive[_0xf705('0x7a')](_0xf705('0x20f'),_0x216acf);loggerPredictive[_0xf705('0x7a')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x82103e);loggerPredictive[_0xf705('0x7a')](_0xf705('0x83'));return new BPromise(function(_0x5ea178,_0xe46811){if(_0x33ba1f<=0x0||isNaN(_0x33ba1f)){return _0xe46811(msgResponse('[abandonmentRate]',_0xf705('0x46'),_0xf705('0x210')+_0x33ba1f));}if(_0x461e31<=0x0||isNaN(_0x461e31)){return _0xe46811(msgResponse(_0xf705('0x211'),'Error',_0xf705('0x212')+_0x461e31));}if(_0x216acf<=0x0||isNaN(_0x216acf)){return _0xe46811(msgResponse(_0xf705('0x211'),_0xf705('0x46'),_0xf705('0x213')+_0x216acf));}if(_0x57791c<=0x0||isNaN(_0x57791c)){return _0xe46811(msgResponse(_0xf705('0x211'),_0xf705('0x46'),_0xf705('0x214')+_0x57791c));}if(_0x82103e<=0x0||isNaN(_0x82103e)){return _0xe46811(msgResponse(_0xf705('0x211'),_0xf705('0x46'),_0xf705('0x215')+_0x82103e));}_0x25b9f1=_0x25b9f1||0x0;var _0x294da9=0x1/_0x461e31;var _0x1ebef8=0x0;var _0x29d315=0x0;var _0xf0eb08=0x0;var _0x38ba40=0x0;for(var _0xb1261c=0x0;_0xf0eb08<_0x82103e;_0xb1261c+=0x1){_0x29d315=_0xb1261c/_0x57791c;_0x1ebef8=(_0x216acf*_0x29d315+_0x25b9f1)/_0x294da9;_0xf0eb08=erlangb(_0x1ebef8,_0x33ba1f);_0x38ba40=_0x1ebef8/_0x33ba1f*(0x1-erlangb(_0x1ebef8,_0x33ba1f));}return _0x5ea178({'erlangCalls':_0xb1261c,'erlangCallToSecond':_0x57791c/_0xb1261c,'erlangAbandonmentRate':_0xf0eb08,'erlangBusyFactor':_0x38ba40});});};Dialer['prototype'][_0xf705('0x1dc')]=function(_0x441472,_0x242a11,_0x1355fa,_0x1fcc31,_0x1226f7,_0xaedbd8){loggerPredictive[_0xf705('0x7a')](_0xf705('0x216'));loggerPredictive[_0xf705('0x7a')](_0xf705('0x217'),_0x441472);loggerPredictive[_0xf705('0x7a')](_0xf705('0x20d'),_0x242a11);loggerPredictive[_0xf705('0x7a')](_0xf705('0x20e'),_0x1355fa);loggerPredictive[_0xf705('0x7a')](_0xf705('0x20f'),_0x1fcc31);loggerPredictive[_0xf705('0x7a')](_0xf705('0x218'),_0x1226f7);loggerPredictive[_0xf705('0x7a')](_0xf705('0x83'));return new BPromise(function(_0x1ec5bc,_0x4a5d01){if(_0x441472<=0x0||isNaN(_0x441472)){return _0x4a5d01(msgResponse('[busyFactor]',_0xf705('0x46'),'m\x20=\x20'+_0x441472));}if(_0x1355fa<=0x0||isNaN(_0x1355fa)){return _0x4a5d01(msgResponse('[busyFactor]',_0xf705('0x46'),'Ts\x20=\x20'+_0x1355fa));}if(_0x1fcc31<=0x0||isNaN(_0x1fcc31)){return _0x4a5d01(msgResponse(_0xf705('0x219'),_0xf705('0x46'),_0xf705('0x213')+_0x1fcc31));}if(_0x242a11<=0x0||isNaN(_0x242a11)){return _0x4a5d01(msgResponse(_0xf705('0x219'),_0xf705('0x46'),_0xf705('0x214')+_0x242a11));}if(_0x1226f7<=0x0||isNaN(_0x1226f7)){return _0x4a5d01(msgResponse(_0xf705('0x219'),'Error','Umin\x20=\x20'+_0x1226f7));}_0xaedbd8=_0xaedbd8||0x0;var _0x41fd56=0x1/_0x1355fa;var _0x2c66c5=0x0;var _0x1465e9=0x0;var _0x3d1203=0x0;var _0x44569d=0x0;for(var _0x448519=0x0;_0x44569d<_0x1226f7;_0x448519+=0x1){_0x1465e9=_0x448519/_0x242a11;_0x2c66c5=(_0x1fcc31*_0x1465e9+_0xaedbd8)/_0x41fd56;_0x3d1203=erlangb(_0x2c66c5,_0x441472);_0x44569d=_0x2c66c5/_0x441472*(0x1-erlangb(_0x2c66c5,_0x441472));}return _0x1ec5bc({'erlangCalls':_0x448519,'erlangCallToSecond':_0x242a11/_0x448519,'erlangAbandonmentRate':_0x3d1203,'erlangBusyFactor':_0x44569d});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 4b0b6ae..829588d 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a0d=['starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum'];(function(_0x198fa1,_0x10d13e){var _0x34bb64=function(_0xea330b){while(--_0xea330b){_0x198fa1['push'](_0x198fa1['shift']());}};_0x34bb64(++_0x10d13e);}(_0x2a0d,0x1c4));var _0xd2a0=function(_0x2e6b63,_0x1a9190){_0x2e6b63=_0x2e6b63-0x0;var _0x38604f=_0x2a0d[_0x2e6b63];return _0x38604f;};'use strict';var util=require(_0xd2a0('0x0'));var _=require(_0xd2a0('0x1'));var moment=require(_0xd2a0('0x2'));function getSeconds(_0x136dad,_0x58f108){var _0x13df61=moment(_0x136dad)[_0xd2a0('0x3')](0x0);var _0x1f3baa=moment(_0x58f108)[_0xd2a0('0x3')](0x0);return _0x13df61['diff'](_0x1f3baa,_0xd2a0('0x4'));}function QueueCallerAbandon(_0x46b3c1,_0x1d1873){this[_0xd2a0('0x5')]=_0x46b3c1[_0xd2a0('0x5')];this[_0xd2a0('0x6')]=_0x46b3c1[_0xd2a0('0x6')];this[_0xd2a0('0x7')]=_0x46b3c1[_0xd2a0('0x6')]==='outbound'?'queue':_0x46b3c1['type'];this[_0xd2a0('0x8')]=_0x46b3c1[_0xd2a0('0x8')];this['countcongestionretry']=_0x46b3c1[_0xd2a0('0x9')];this[_0xd2a0('0xa')]=_0x46b3c1[_0xd2a0('0xa')];this[_0xd2a0('0xb')]=_0x46b3c1['countbusyretry']+_0x46b3c1[_0xd2a0('0x9')]+_0x46b3c1[_0xd2a0('0xa')]+_0x46b3c1[_0xd2a0('0xc')]+_0x46b3c1[_0xd2a0('0xd')]+_0x46b3c1['countabandonedretry']+_0x46b3c1[_0xd2a0('0xe')]+_0x46b3c1[_0xd2a0('0xf')];this[_0xd2a0('0xc')]=_0x46b3c1[_0xd2a0('0xc')];this[_0xd2a0('0xd')]=_0x46b3c1[_0xd2a0('0xd')];this[_0xd2a0('0x10')]=_0x46b3c1[_0xd2a0('0x10')];this[_0xd2a0('0xe')]=_0x46b3c1[_0xd2a0('0xe')];this['countagentrejectretry']=_0x46b3c1[_0xd2a0('0xf')];this[_0xd2a0('0x11')]=_0x1d1873['uniqueid'];this[_0xd2a0('0x12')]=_0x46b3c1[_0xd2a0('0x13')];this[_0xd2a0('0x14')]=_0x46b3c1['number'];this[_0xd2a0('0x15')]=_0x46b3c1[_0xd2a0('0x15')];this[_0xd2a0('0x16')]=_0x46b3c1['responsetime'];this[_0xd2a0('0x17')]=_0x46b3c1[_0xd2a0('0x17')];this[_0xd2a0('0x18')]=this[_0xd2a0('0x17')];this[_0xd2a0('0x19')]=getSeconds(_0x46b3c1[_0xd2a0('0x16')],_0x46b3c1[_0xd2a0('0x15')]);this[_0xd2a0('0x1a')]=getSeconds(this[_0xd2a0('0x17')],_0x46b3c1[_0xd2a0('0x16')]);this[_0xd2a0('0x1b')]=0x0;this[_0xd2a0('0x1c')]=_0x1d1873[_0xd2a0('0x1c')];this['membername']=_0x1d1873[_0xd2a0('0x1d')];this[_0xd2a0('0x1e')]=_0x1d1873[_0xd2a0('0x1e')];this[_0xd2a0('0x1f')]=_0x46b3c1[_0xd2a0('0x1f')];this['callbackuniqueid']=_0x46b3c1[_0xd2a0('0x20')];this[_0xd2a0('0x21')]=_0x46b3c1[_0xd2a0('0x21')];this[_0xd2a0('0x22')]=_0x46b3c1[_0xd2a0('0x22')];this['ContactId']=_0x46b3c1[_0xd2a0('0x23')];this[_0xd2a0('0x24')]=_0x46b3c1[_0xd2a0('0x24')];this[_0xd2a0('0x25')]=_0x46b3c1[_0xd2a0('0x25')];this['VoiceQueueId']=_0x46b3c1[_0xd2a0('0x26')];this['CampaignId']=_0x46b3c1[_0xd2a0('0x27')];this['originatecalleridnum']=_0x46b3c1[_0xd2a0('0x28')]||'';this[_0xd2a0('0x29')]=_0x46b3c1['originatecalleridname']||'';}module[_0xd2a0('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0x0ff9=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime','responsetime','droptime','endtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0x0ff9,0x7d));var _0x90ff=function(_0x54b40f,_0x1f47d3){_0x54b40f=_0x54b40f-0x0;var _0x5de0ac=_0x0ff9[_0x54b40f];return _0x5de0ac;};'use strict';var util=require('util');var _=require(_0x90ff('0x0'));var moment=require('moment');function getSeconds(_0x29ddc0,_0x3c451e){var _0x16b4dc=moment(_0x29ddc0)['milliseconds'](0x0);var _0x65f21=moment(_0x3c451e)[_0x90ff('0x1')](0x0);return _0x16b4dc[_0x90ff('0x2')](_0x65f21,_0x90ff('0x3'));}function QueueCallerAbandon(_0x40ae3b,_0x4776c6){this['scheduledat']=_0x40ae3b['scheduledat'];this[_0x90ff('0x4')]=_0x40ae3b[_0x90ff('0x4')];this['campaigntype']=_0x40ae3b[_0x90ff('0x4')]===_0x90ff('0x5')?_0x90ff('0x6'):_0x40ae3b[_0x90ff('0x4')];this['countbusyretry']=_0x40ae3b[_0x90ff('0x7')];this[_0x90ff('0x8')]=_0x40ae3b[_0x90ff('0x8')];this[_0x90ff('0x9')]=_0x40ae3b[_0x90ff('0x9')];this[_0x90ff('0xa')]=_0x40ae3b[_0x90ff('0x7')]+_0x40ae3b['countcongestionretry']+_0x40ae3b[_0x90ff('0x9')]+_0x40ae3b[_0x90ff('0xb')]+_0x40ae3b[_0x90ff('0xc')]+_0x40ae3b[_0x90ff('0xd')]+_0x40ae3b[_0x90ff('0xe')]+_0x40ae3b[_0x90ff('0xf')];this[_0x90ff('0xb')]=_0x40ae3b['countnosuchnumberretry'];this[_0x90ff('0xc')]=_0x40ae3b[_0x90ff('0xc')];this[_0x90ff('0xd')]=_0x40ae3b[_0x90ff('0xd')];this['countmachineretry']=_0x40ae3b[_0x90ff('0xe')];this['countagentrejectretry']=_0x40ae3b[_0x90ff('0xf')];this[_0x90ff('0x10')]=_0x4776c6[_0x90ff('0x10')];this[_0x90ff('0x11')]=_0x40ae3b['name'];this[_0x90ff('0x12')]=_0x40ae3b['number'];this['starttime']=_0x40ae3b[_0x90ff('0x13')];this[_0x90ff('0x14')]=_0x40ae3b[_0x90ff('0x14')];this[_0x90ff('0x15')]=_0x40ae3b[_0x90ff('0x15')];this[_0x90ff('0x16')]=this[_0x90ff('0x15')];this['ringtime']=getSeconds(_0x40ae3b[_0x90ff('0x14')],_0x40ae3b[_0x90ff('0x13')]);this[_0x90ff('0x17')]=getSeconds(this[_0x90ff('0x15')],_0x40ae3b['responsetime']);this['talktime']=0x0;this[_0x90ff('0x6')]=_0x4776c6[_0x90ff('0x6')];this[_0x90ff('0x18')]=_0x4776c6[_0x90ff('0x19')];this[_0x90ff('0x1a')]=_0x4776c6[_0x90ff('0x1a')];this[_0x90ff('0x1b')]=_0x40ae3b[_0x90ff('0x1b')];this[_0x90ff('0x1c')]=_0x40ae3b[_0x90ff('0x1c')];this[_0x90ff('0x1d')]=_0x40ae3b[_0x90ff('0x1d')];this[_0x90ff('0x1e')]=_0x40ae3b['recallme'];this['ContactId']=_0x40ae3b[_0x90ff('0x1f')];this[_0x90ff('0x20')]=_0x40ae3b[_0x90ff('0x20')];this[_0x90ff('0x21')]=_0x40ae3b[_0x90ff('0x21')];this['VoiceQueueId']=_0x40ae3b[_0x90ff('0x22')];this[_0x90ff('0x23')]=_0x40ae3b['CampaignId'];this['originatecalleridnum']=_0x40ae3b[_0x90ff('0x24')]||'';this['originatecalleridname']=_0x40ae3b[_0x90ff('0x25')]||'';}module[_0x90ff('0x26')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index ffeb6b4..c895c09 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(_0xc4171b,_0x1da910){var _0x413e12=function(_0x21c77b){while(--_0x21c77b){_0xc4171b['push'](_0xc4171b['shift']());}};_0x413e12(++_0x1da910);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x4c241d,_0x5b1280){var _0x1108e0=function(_0x3db4fb){while(--_0x3db4fb){_0x4c241d['push'](_0x4c241d['shift']());}};_0x1108e0(++_0x5b1280);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 41275e9..07f0153 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 _0xc403=['variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','newexten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','syncNewExten','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','fax','catch','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','actions','merge','response','reason','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action'];(function(_0x48f27a,_0x35d997){var _0x5f5de8=function(_0xe3bf3a){while(--_0xe3bf3a){_0x48f27a['push'](_0x48f27a['shift']());}};_0x5f5de8(++_0x35d997);}(_0xc403,0xf1));var _0x3c40=function(_0x10c5a8,_0x2f9bc5){_0x10c5a8=_0x10c5a8-0x0;var _0x5ba6e3=_0xc403[_0x10c5a8];return _0x5ba6e3;};'use strict';var util=require(_0x3c40('0x0'));var _=require(_0x3c40('0x1'));var BPromise=require('bluebird');var uuid=require(_0x3c40('0x2'));var moment=require(_0x3c40('0x3'));var path=require(_0x3c40('0x4'));var tiff2pdf=require(_0x3c40('0x5'));var gs=require(_0x3c40('0x6'));var logger=require('../../../config/logger')('fax');var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x3c40('0x7'));var ut=require(_0x3c40('0x8'));var Action=require('./action');var faxAccount=require(_0x3c40('0x9'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x3c40('0xa'));function Fax(_0x4c5d10){this[_0x3c40('0xb')]={};this[_0x3c40('0xc')]=_0x4c5d10[_0x3c40('0xc')];this[_0x3c40('0xd')]=_0x4c5d10[_0x3c40('0xd')];this['actions']={};ami['on'](_0x3c40('0xe'),this[_0x3c40('0xf')]['bind'](this));ami['on'](_0x3c40('0x10'),this[_0x3c40('0x11')][_0x3c40('0x12')](this));ami['on'](_0x3c40('0x13'),this['syncNewState'][_0x3c40('0x12')](this));ami['on'](_0x3c40('0x14'),this['syncNewExten'][_0x3c40('0x12')](this));ami['on'](_0x3c40('0x15'),this[_0x3c40('0x16')][_0x3c40('0x12')](this));ami['on'](_0x3c40('0x17'),this['syncReceiveFax'][_0x3c40('0x12')](this));ami['on'](_0x3c40('0x18'),this[_0x3c40('0x19')][_0x3c40('0x12')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x3c40('0x12')](this));}Fax[_0x3c40('0x1a')][_0x3c40('0xf')]=function(_0x25e946){if(_0x25e946[_0x3c40('0x1b')]===_0x3c40('0x1c')){for(var _0x2b7fb0 in this[_0x3c40('0xc')]){if(this['faxAccounts'][_0x3c40('0x1d')](_0x2b7fb0)){if(_0x25e946[_0x3c40('0x1e')]===this[_0x3c40('0xc')][_0x2b7fb0]['localstationid']){this[_0x3c40('0xb')][_0x25e946[_0x3c40('0x1f')]]={};this['channels'][_0x25e946['uniqueid']][_0x3c40('0x20')]=_0x25e946[_0x3c40('0x20')];this['channels'][_0x25e946[_0x3c40('0x1f')]]['id']=this['faxAccounts'][_0x2b7fb0]['id'];this['channels'][_0x25e946['uniqueid']][_0x3c40('0x21')]=this['faxAccounts'][_0x2b7fb0]['name'];logger[_0x3c40('0x22')](_0x25e946[_0x3c40('0x1f')],_0x3c40('0x23'));}}}}if(this['actions'][_0x25e946['uniqueid']]){this[_0x3c40('0xb')][_0x25e946[_0x3c40('0x1f')]]={};this[_0x3c40('0xb')][_0x25e946[_0x3c40('0x1f')]][_0x3c40('0x20')]=_0x25e946['channel'];logger[_0x3c40('0x22')](_0x25e946[_0x3c40('0x1f')],_0x3c40('0x23'));}};Fax[_0x3c40('0x1a')][_0x3c40('0x11')]=function(_0x590f52){if(this['channels'][_0x590f52[_0x3c40('0x1f')]]){for(var _0x227bfd in _0x590f52[_0x3c40('0x24')]){if(_0x590f52['variable'][_0x3c40('0x1d')](_0x227bfd)){this[_0x3c40('0xb')][_0x590f52[_0x3c40('0x1f')]][_0x227bfd]=_0x590f52['value'];}}}};Fax[_0x3c40('0x1a')]['syncNewState']=function(_0x3f22f5){if(this[_0x3c40('0xb')][_0x3f22f5[_0x3c40('0x1f')]]){this[_0x3c40('0xb')][_0x3f22f5[_0x3c40('0x1f')]][_0x3c40('0x25')]=_0x3f22f5['channelstate'];this[_0x3c40('0xb')][_0x3f22f5[_0x3c40('0x1f')]]['channelstatedesc']=_0x3f22f5[_0x3c40('0x26')];}};Fax[_0x3c40('0x1a')][_0x3c40('0x27')]=function(_0x47c3dd){if(this[_0x3c40('0xb')][_0x47c3dd[_0x3c40('0x1f')]]){for(var _0x41b066 in _0x47c3dd[_0x3c40('0x24')]){if(_0x47c3dd[_0x3c40('0x24')]['hasOwnProperty'](_0x41b066)){this[_0x3c40('0xb')][_0x47c3dd[_0x3c40('0x1f')]][_0x41b066]=_0x47c3dd[_0x3c40('0x28')];}}}};Fax[_0x3c40('0x1a')][_0x3c40('0x16')]=function(_0x2832d4){if(this[_0x3c40('0xb')][_0x2832d4[_0x3c40('0x1f')]]){this[_0x3c40('0xb')][_0x2832d4[_0x3c40('0x1f')]][_0x3c40('0x29')]=_0x2832d4[_0x3c40('0x29')];this[_0x3c40('0xb')][_0x2832d4['uniqueid']][_0x3c40('0x2a')]=_0x2832d4[_0x3c40('0x2a')];this[_0x3c40('0xb')][_0x2832d4['uniqueid']][_0x3c40('0x2b')]=_0x2832d4[_0x3c40('0x2b')];this[_0x3c40('0xb')][_0x2832d4[_0x3c40('0x1f')]]['filename']=_0x2832d4[_0x3c40('0x2c')];logger[_0x3c40('0x22')](_0x2832d4['uniqueid'],_0x3c40('0x2d'));}};Fax[_0x3c40('0x1a')]['syncReceiveFax']=function(_0x147528){var _0x38fe39=this;if(this[_0x3c40('0xb')][_0x147528[_0x3c40('0x1f')]]){var _0x5a03cf=this['channels'][_0x147528['uniqueid']]['id'];this[_0x3c40('0xb')][_0x147528['uniqueid']]['remotestationid']=_0x147528['remotestationid'];this[_0x3c40('0xb')][_0x147528[_0x3c40('0x1f')]][_0x3c40('0x2e')]=_0x147528[_0x3c40('0x2e')];this['channels'][_0x147528['uniqueid']]['localstationid']=_0x147528[_0x3c40('0x2b')];this[_0x3c40('0xb')][_0x147528[_0x3c40('0x1f')]][_0x3c40('0x2f')]=_0x147528[_0x3c40('0x2f')];this[_0x3c40('0xb')][_0x147528['uniqueid']][_0x3c40('0x30')]=_0x147528[_0x3c40('0x30')];this[_0x3c40('0xb')][_0x147528[_0x3c40('0x1f')]][_0x3c40('0x2c')]=_0x147528['filename'];this[_0x3c40('0xb')][_0x147528[_0x3c40('0x1f')]][_0x3c40('0x31')]=_0x147528[_0x3c40('0x31')];if(this['channels'][_0x147528[_0x3c40('0x1f')]][_0x3c40('0x2e')]>0x0){tiff2pdf(_0x147528[_0x3c40('0x2c')],'/var/opt/motion2/server/files/attachments/',function(_0x5a9f3c){logger['info'](_0x147528['uniqueid'],_0x3c40('0x32'),_0x5a9f3c[_0x3c40('0x33')]);attachment[_0x3c40('0x34')]({'name':path[_0x3c40('0x35')](_0x147528[_0x3c40('0x2c')])[_0x3c40('0x21')],'basename':path['parse'](_0x147528['filename'])[_0x3c40('0x21')]+_0x3c40('0x36'),'type':'application/pdf'})[_0x3c40('0x37')](function(_0x4c4534){faxAccount[_0x3c40('0x38')](_0x5a03cf,{'from':_0x147528[_0x3c40('0x31')],'mapKey':_0x3c40('0x39'),'body':path['parse'](_0x147528[_0x3c40('0x2c')])[_0x3c40('0x21')]+_0x3c40('0x36'),'AttachmentId':_0x4c4534['id']})[_0x3c40('0x3a')](function(_0x3cad82){logger['error'](_0x147528['uniqueid'],_0x3c40('0x3b'),JSON[_0x3c40('0x3c')](_0x3cad82));});})['catch'](function(_0x109fe2){logger['error'](_0x147528[_0x3c40('0x1f')],_0x3c40('0x3d'),JSON[_0x3c40('0x3c')](_0x109fe2));});});}logger[_0x3c40('0x22')](_0x147528['uniqueid'],_0x3c40('0x3d'));}};Fax['prototype'][_0x3c40('0x3e')]=function(_0x197953){if(this[_0x3c40('0x3f')][_0x197953[_0x3c40('0x1f')]]){_[_0x3c40('0x40')](this['channels'][_0x197953[_0x3c40('0x1f')]],_['pick'](_0x197953,[_0x3c40('0x41'),_0x3c40('0x42')]));}};function updateStatus(_0xd85136){if(_0xd85136[_0x3c40('0x43')]){faxMessage['update'](_0xd85136[_0x3c40('0x43')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x3c40('0x37')](function(_0x291fa9){ut[_0x3c40('0x44')](_0x3c40('0x45'),_0x291fa9);})[_0x3c40('0x3a')](function(_0x585d8c){ut[_0x3c40('0x44')]('[Fax][Message][Error][NoUpdate1]',_0x585d8c);});}else{ut[_0x3c40('0x44')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x3c40('0x1a')]['updateStatus']=function(_0x540ee0,_0x59b559,_0x36083d){var _0x3e4693=this;var _0x585c6c={};if(_0x59b559){_0x585c6c={'read':_0x59b559};}else{_0x585c6c={'failMessage':_0x36083d};}if(this['actions'][_0x540ee0][_0x3c40('0x43')]){faxMessage['update'](this[_0x3c40('0x3f')][_0x540ee0][_0x3c40('0x43')],_0x585c6c)['then'](function(_0xe86510){ut[_0x3c40('0x44')](_0x3c40('0x46'),_0xe86510);})[_0x3c40('0x3a')](function(_0x94a391){ut[_0x3c40('0x44')](_0x3c40('0x47'),_0x94a391);})[_0x3c40('0x48')](function(){delete _0x3e4693[_0x3c40('0xb')][_0x540ee0];delete _0x3e4693[_0x3c40('0x3f')][_0x540ee0];});}else{ut[_0x3c40('0x44')](_0x3c40('0x49'));delete this[_0x3c40('0xb')][_0x540ee0];delete this[_0x3c40('0x3f')][_0x540ee0];}};Fax[_0x3c40('0x1a')]['syncHangup']=function(_0xe8c7aa){var _0x31de2b=this;if(this[_0x3c40('0xb')][_0xe8c7aa[_0x3c40('0x1f')]]){if(this['actions'][_0xe8c7aa['uniqueid']]){this[_0x3c40('0xb')][_0xe8c7aa[_0x3c40('0x1f')]]['id']=this[_0x3c40('0x3f')][_0xe8c7aa['uniqueid']]['id'];this[_0x3c40('0xb')][_0xe8c7aa[_0x3c40('0x1f')]][_0x3c40('0x21')]=this[_0x3c40('0x3f')][_0xe8c7aa[_0x3c40('0x1f')]]['name'];}logger[_0x3c40('0x22')](_0xe8c7aa[_0x3c40('0x1f')],this['actions'][_0xe8c7aa[_0x3c40('0x1f')]]?_0x3c40('0x4a'):'\x20hangup\x20faxRiceive\x20',JSON[_0x3c40('0x3c')](this[_0x3c40('0xb')][_0xe8c7aa['uniqueid']]));if(this[_0x3c40('0x3f')][_0xe8c7aa['uniqueid']]){if(this[_0x3c40('0xb')][_0xe8c7aa[_0x3c40('0x1f')]][_0x3c40('0x4b')]>0x0&&this[_0x3c40('0xb')][_0xe8c7aa[_0x3c40('0x1f')]][_0x3c40('0x15')]===_0x3c40('0x4c')){this[_0x3c40('0x4d')](_0xe8c7aa[_0x3c40('0x1f')],!![]);}else{this[_0x3c40('0x4d')](_0xe8c7aa[_0x3c40('0x1f')],![],this[_0x3c40('0xb')][_0xe8c7aa[_0x3c40('0x1f')]][_0x3c40('0x4e')]?_0x3c40('0x4f')+this[_0x3c40('0xb')][_0xe8c7aa['uniqueid']][_0x3c40('0x4e')]:'SENDING\x20FAILED');}}}};Fax[_0x3c40('0x1a')][_0x3c40('0x50')]=function(_0x397ed3){var _0x34325b=this;return new BPromise(function(_0x22784f,_0x12abdd){_0x34325b[_0x3c40('0x51')](_0x397ed3,_0x34325b['faxAccounts'][_0x397ed3[_0x3c40('0x52')]])[_0x3c40('0x37')](function(_0x53b540){ut[_0x3c40('0x44')]('[Fax][execOriginate][success]',_0x53b540);_0x22784f(ut['message'](_0x3c40('0x53')));})['catch'](function(_0x498ea9){ut[_0x3c40('0x44')](_0x3c40('0x54'),_0x498ea9);updateStatus(_0x397ed3);_0x12abdd(ut[_0x3c40('0x33')](_0x3c40('0x55')));});});};Fax[_0x3c40('0x1a')][_0x3c40('0x56')]=function(_0x41b901){var _0x39dabe=this;return new BPromise(function(_0x3c3287,_0x4b9f84){var _0x2fcf82=_0x39dabe[_0x3c40('0x57')](_0x39dabe[_0x3c40('0xc')][_0x41b901[_0x3c40('0x52')]][_0x3c40('0x58')],_0x41b901);if(_0x2fcf82[_0x3c40('0x59')]){_0x3c3287(ut[_0x3c40('0x33')](_0x3c40('0x5a')));}else{_0x4b9f84(ut[_0x3c40('0x33')](_0x2fcf82[_0x3c40('0x33')]));}});};function originate(_0x5d480d,_0x2f578a,_0x3da0d3){return new BPromise(function(_0x3dab44,_0x2ea03f){if(_0x3da0d3){var _0x346824=util[_0x3c40('0x5b')](_0x3c40('0x5c'),path[_0x3c40('0x35')](_0x5d480d[_0x3c40('0x4')])[_0x3c40('0x21')],_0x5d480d[_0x3c40('0x4')]);gs[_0x3c40('0x5d')](_0x346824)[_0x3c40('0x37')](function(){_0x5d480d[_0x3c40('0x4')]=util['format']('%s/%s.tif',path['parse'](_0x5d480d[_0x3c40('0x4')])[_0x3c40('0x5e')],path[_0x3c40('0x35')](_0x5d480d[_0x3c40('0x4')])[_0x3c40('0x21')]);_0x2f578a[_0x3c40('0x5f')]=_0x5d480d[_0x3c40('0x4')];ut[_0x3c40('0x44')](_0x3c40('0x60'),'');ami[_0x3c40('0x61')](ut[_0x3c40('0x62')](_0x5d480d,_0x2f578a))[_0x3c40('0x37')](function(_0x533585){_0x3dab44(_0x533585);})[_0x3c40('0x3a')](function(_0x1b5b29){_0x2ea03f(_0x1b5b29);});})[_0x3c40('0x3a')](function(_0x5f43af){_0x2ea03f(_0x5f43af);});}else{ami['Action'](ut[_0x3c40('0x62')](_0x5d480d,_0x2f578a))[_0x3c40('0x37')](function(_0x556f54){_0x3dab44(_0x556f54);})[_0x3c40('0x3a')](function(_0xf79a93){_0x2ea03f(_0xf79a93);});}});}Fax['prototype'][_0x3c40('0x51')]=function(_0x4c32cd,_0x542f97){var _0x1bc986=this;return new BPromise(function(_0x4272e9,_0x2caa00){var _0x18a646=uuid['v4']();var _0x2133a0=ut['addVariables'](_0x4c32cd,_0x542f97);_0x1bc986[_0x3c40('0x3f')][_0x18a646]=new Action(_0x18a646,_0x542f97,_0x4c32cd);var _0x2d7711=_0x1bc986[_0x3c40('0x3f')][_0x18a646];if(path[_0x3c40('0x35')](_0x4c32cd[_0x3c40('0x4')])[_0x3c40('0x63')]==='.pdf'){originate(_0x2d7711,_0x2133a0,!![])[_0x3c40('0x37')](function(_0x4ea68a){_0x4272e9(_0x4ea68a);})[_0x3c40('0x3a')](function(_0x5f1b3c){_0x2caa00(_0x5f1b3c);});}else{originate(_0x2d7711,_0x2133a0,![])[_0x3c40('0x37')](function(_0x1e01d6){_0x4272e9(_0x1e01d6);})[_0x3c40('0x3a')](function(_0x26f02b){_0x2caa00(_0x26f02b);});}});};Fax[_0x3c40('0x1a')][_0x3c40('0x64')]=function(_0x16bea7){return!_[_0x3c40('0x65')](_0x16bea7)&&!_[_0x3c40('0x65')](_0x16bea7[_0x3c40('0x21')])&&!_['isNil'](_0x16bea7[_0x3c40('0x66')])&&_0x16bea7[_0x3c40('0x66')]&&!_[_0x3c40('0x65')](this[_0x3c40('0xd')][util[_0x3c40('0x5b')](_0x3c40('0x67'),_0x16bea7['name'])])&&!_[_0x3c40('0x65')](this['trunks'][util[_0x3c40('0x5b')](_0x3c40('0x67'),_0x16bea7[_0x3c40('0x21')])]['status'])&&(this[_0x3c40('0xd')][util['format'](_0x3c40('0x67'),_0x16bea7['name'])][_0x3c40('0x2a')]===_0x3c40('0x68')||this[_0x3c40('0xd')][util[_0x3c40('0x5b')](_0x3c40('0x67'),_0x16bea7[_0x3c40('0x21')])][_0x3c40('0x2a')]===_0x3c40('0x69'));};Fax[_0x3c40('0x1a')][_0x3c40('0x57')]=function(_0x3b0f89,_0x830426){if(!this[_0x3c40('0x64')](_0x3b0f89)){ut[_0x3c40('0x44')](_0x3c40('0x6a'),_[_0x3c40('0x65')](_0x3b0f89)?'':_0x3b0f89[_0x3c40('0x21')]+_0x3c40('0x6b'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x3c40('0x65')](_0x830426[_0x3c40('0x39')])){ut[_0x3c40('0x44')](_0x3c40('0x6c'),JSON[_0x3c40('0x3c')](_0x830426));return{'isValid':![],'message':_0x3c40('0x6d')};}if(_[_0x3c40('0x65')](_0x830426[_0x3c40('0x4')])){ut['logger'](_0x3c40('0x6e'),JSON[_0x3c40('0x3c')](_0x830426));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x3c40('0x6f')};};module[_0x3c40('0x70')]=Fax; \ No newline at end of file +var _0xe5df=['path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','actions','info','variable','value','channelstate','channelstatedesc','status','filename','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','error','\x20notify\x20','catch','\x20receiveFax\x20','stringify','merge','pick','response','reason','update','AttachmentId','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe5df,0xe5));var _0xfe5d=function(_0x1aea72,_0x2b7200){_0x1aea72=_0x1aea72-0x0;var _0x578034=_0xe5df[_0x1aea72];return _0x578034;};'use strict';var util=require(_0xfe5d('0x0'));var _=require(_0xfe5d('0x1'));var BPromise=require(_0xfe5d('0x2'));var uuid=require('uuid');var moment=require('moment');var path=require(_0xfe5d('0x3'));var tiff2pdf=require(_0xfe5d('0x4'));var gs=require(_0xfe5d('0x5'));var logger=require(_0xfe5d('0x6'))(_0xfe5d('0x7'));var ami=require(_0xfe5d('0x8'));var rpcDb=require(_0xfe5d('0x9'));var Channel=require('./channel');var ut=require('./util/util');var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xfe5d('0xa'));var faxMessage=require(_0xfe5d('0xb'));function Fax(_0x4471ce){this[_0xfe5d('0xc')]={};this[_0xfe5d('0xd')]=_0x4471ce['faxAccounts'];this[_0xfe5d('0xe')]=_0x4471ce[_0xfe5d('0xe')];this['actions']={};ami['on'](_0xfe5d('0xf'),this[_0xfe5d('0x10')][_0xfe5d('0x11')](this));ami['on']('varset',this[_0xfe5d('0x12')][_0xfe5d('0x11')](this));ami['on'](_0xfe5d('0x13'),this[_0xfe5d('0x14')][_0xfe5d('0x11')](this));ami['on'](_0xfe5d('0x15'),this[_0xfe5d('0x16')][_0xfe5d('0x11')](this));ami['on']('faxstatus',this[_0xfe5d('0x17')][_0xfe5d('0x11')](this));ami['on'](_0xfe5d('0x18'),this[_0xfe5d('0x19')][_0xfe5d('0x11')](this));ami['on'](_0xfe5d('0x1a'),this[_0xfe5d('0x1b')][_0xfe5d('0x11')](this));ami['on'](_0xfe5d('0x1c'),this[_0xfe5d('0x1d')][_0xfe5d('0x11')](this));}Fax[_0xfe5d('0x1e')][_0xfe5d('0x10')]=function(_0x2285a5){if(_0x2285a5[_0xfe5d('0x1f')]===_0xfe5d('0x20')){for(var _0xc78c in this['faxAccounts']){if(this[_0xfe5d('0xd')][_0xfe5d('0x21')](_0xc78c)){if(_0x2285a5['exten']===this['faxAccounts'][_0xc78c][_0xfe5d('0x22')]){this[_0xfe5d('0xc')][_0x2285a5[_0xfe5d('0x23')]]={};this['channels'][_0x2285a5[_0xfe5d('0x23')]][_0xfe5d('0x24')]=_0x2285a5[_0xfe5d('0x24')];this[_0xfe5d('0xc')][_0x2285a5[_0xfe5d('0x23')]]['id']=this[_0xfe5d('0xd')][_0xc78c]['id'];this[_0xfe5d('0xc')][_0x2285a5[_0xfe5d('0x23')]][_0xfe5d('0x25')]=this[_0xfe5d('0xd')][_0xc78c][_0xfe5d('0x25')];logger['info'](_0x2285a5[_0xfe5d('0x23')],_0xfe5d('0x26'));}}}}if(this[_0xfe5d('0x27')][_0x2285a5[_0xfe5d('0x23')]]){this[_0xfe5d('0xc')][_0x2285a5[_0xfe5d('0x23')]]={};this[_0xfe5d('0xc')][_0x2285a5[_0xfe5d('0x23')]]['channel']=_0x2285a5[_0xfe5d('0x24')];logger[_0xfe5d('0x28')](_0x2285a5[_0xfe5d('0x23')],_0xfe5d('0x26'));}};Fax[_0xfe5d('0x1e')]['syncVarSet']=function(_0x34597c){if(this[_0xfe5d('0xc')][_0x34597c[_0xfe5d('0x23')]]){for(var _0x284a39 in _0x34597c[_0xfe5d('0x29')]){if(_0x34597c['variable'][_0xfe5d('0x21')](_0x284a39)){this[_0xfe5d('0xc')][_0x34597c[_0xfe5d('0x23')]][_0x284a39]=_0x34597c[_0xfe5d('0x2a')];}}}};Fax['prototype'][_0xfe5d('0x14')]=function(_0xa4bbb){if(this[_0xfe5d('0xc')][_0xa4bbb['uniqueid']]){this[_0xfe5d('0xc')][_0xa4bbb['uniqueid']][_0xfe5d('0x2b')]=_0xa4bbb[_0xfe5d('0x2b')];this[_0xfe5d('0xc')][_0xa4bbb[_0xfe5d('0x23')]][_0xfe5d('0x2c')]=_0xa4bbb[_0xfe5d('0x2c')];}};Fax['prototype']['syncNewExten']=function(_0x44d1f6){if(this['channels'][_0x44d1f6[_0xfe5d('0x23')]]){for(var _0x4b7ec4 in _0x44d1f6[_0xfe5d('0x29')]){if(_0x44d1f6[_0xfe5d('0x29')][_0xfe5d('0x21')](_0x4b7ec4)){this[_0xfe5d('0xc')][_0x44d1f6[_0xfe5d('0x23')]][_0x4b7ec4]=_0x44d1f6[_0xfe5d('0x2a')];}}}};Fax[_0xfe5d('0x1e')][_0xfe5d('0x17')]=function(_0x5711cf){if(this[_0xfe5d('0xc')][_0x5711cf[_0xfe5d('0x23')]]){this[_0xfe5d('0xc')][_0x5711cf[_0xfe5d('0x23')]]['operation']=_0x5711cf['operation'];this[_0xfe5d('0xc')][_0x5711cf[_0xfe5d('0x23')]][_0xfe5d('0x2d')]=_0x5711cf[_0xfe5d('0x2d')];this[_0xfe5d('0xc')][_0x5711cf[_0xfe5d('0x23')]][_0xfe5d('0x22')]=_0x5711cf[_0xfe5d('0x22')];this[_0xfe5d('0xc')][_0x5711cf[_0xfe5d('0x23')]][_0xfe5d('0x2e')]=_0x5711cf[_0xfe5d('0x2e')];logger[_0xfe5d('0x28')](_0x5711cf[_0xfe5d('0x23')],_0xfe5d('0x2f'));}};Fax[_0xfe5d('0x1e')][_0xfe5d('0x19')]=function(_0x5355cc){var _0x444583=this;if(this[_0xfe5d('0xc')][_0x5355cc['uniqueid']]){var _0x22442e=this['channels'][_0x5355cc[_0xfe5d('0x23')]]['id'];this[_0xfe5d('0xc')][_0x5355cc['uniqueid']][_0xfe5d('0x30')]=_0x5355cc[_0xfe5d('0x30')];this[_0xfe5d('0xc')][_0x5355cc[_0xfe5d('0x23')]]['pagestransferred']=_0x5355cc['pagestransferred'];this[_0xfe5d('0xc')][_0x5355cc[_0xfe5d('0x23')]][_0xfe5d('0x22')]=_0x5355cc[_0xfe5d('0x22')];this[_0xfe5d('0xc')][_0x5355cc[_0xfe5d('0x23')]]['resolution']=_0x5355cc[_0xfe5d('0x31')];this[_0xfe5d('0xc')][_0x5355cc['uniqueid']][_0xfe5d('0x32')]=_0x5355cc[_0xfe5d('0x32')];this[_0xfe5d('0xc')][_0x5355cc['uniqueid']]['filename']=_0x5355cc['filename'];this[_0xfe5d('0xc')][_0x5355cc['uniqueid']]['calleridnum']=_0x5355cc[_0xfe5d('0x33')];if(this[_0xfe5d('0xc')][_0x5355cc[_0xfe5d('0x23')]][_0xfe5d('0x34')]>0x0){tiff2pdf(_0x5355cc[_0xfe5d('0x2e')],_0xfe5d('0x35'),function(_0x481bc3){logger[_0xfe5d('0x28')](_0x5355cc[_0xfe5d('0x23')],_0xfe5d('0x36'),_0x481bc3[_0xfe5d('0x37')]);attachment['create']({'name':path[_0xfe5d('0x38')](_0x5355cc[_0xfe5d('0x2e')])[_0xfe5d('0x25')],'basename':path[_0xfe5d('0x38')](_0x5355cc[_0xfe5d('0x2e')])[_0xfe5d('0x25')]+_0xfe5d('0x39'),'type':'application/pdf'})['then'](function(_0x1d5e3c){faxAccount['notify'](_0x22442e,{'from':_0x5355cc['calleridnum'],'mapKey':_0xfe5d('0x7'),'body':path[_0xfe5d('0x38')](_0x5355cc['filename'])[_0xfe5d('0x25')]+_0xfe5d('0x39'),'AttachmentId':_0x1d5e3c['id']})['catch'](function(_0x1292ea){logger[_0xfe5d('0x3a')](_0x5355cc['uniqueid'],_0xfe5d('0x3b'),JSON['stringify'](_0x1292ea));});})[_0xfe5d('0x3c')](function(_0x39f85d){logger[_0xfe5d('0x3a')](_0x5355cc[_0xfe5d('0x23')],_0xfe5d('0x3d'),JSON[_0xfe5d('0x3e')](_0x39f85d));});});}logger[_0xfe5d('0x28')](_0x5355cc[_0xfe5d('0x23')],_0xfe5d('0x3d'));}};Fax[_0xfe5d('0x1e')][_0xfe5d('0x1d')]=function(_0x1adec3){if(this['actions'][_0x1adec3[_0xfe5d('0x23')]]){_[_0xfe5d('0x3f')](this[_0xfe5d('0xc')][_0x1adec3['uniqueid']],_[_0xfe5d('0x40')](_0x1adec3,[_0xfe5d('0x41'),_0xfe5d('0x42')]));}};function updateStatus(_0x376349){if(_0x376349['AttachmentId']){faxMessage[_0xfe5d('0x43')](_0x376349[_0xfe5d('0x44')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xfe5d('0x45')](function(_0x41271b){ut[_0xfe5d('0x46')](_0xfe5d('0x47'),_0x41271b);})[_0xfe5d('0x3c')](function(_0x59bba6){ut[_0xfe5d('0x46')](_0xfe5d('0x48'),_0x59bba6);});}else{ut[_0xfe5d('0x46')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xfe5d('0x1e')][_0xfe5d('0x49')]=function(_0x2036a2,_0x1f9b0d,_0x825c61){var _0x1a849d=this;var _0x75b0a6={};if(_0x1f9b0d){_0x75b0a6={'read':_0x1f9b0d};}else{_0x75b0a6={'failMessage':_0x825c61};}if(this['actions'][_0x2036a2][_0xfe5d('0x44')]){faxMessage[_0xfe5d('0x43')](this[_0xfe5d('0x27')][_0x2036a2][_0xfe5d('0x44')],_0x75b0a6)[_0xfe5d('0x45')](function(_0x52500e){ut[_0xfe5d('0x46')]('[Fax][Message][Updated]',_0x52500e);})['catch'](function(_0x2681a8){ut[_0xfe5d('0x46')](_0xfe5d('0x4a'),_0x2681a8);})[_0xfe5d('0x4b')](function(){delete _0x1a849d[_0xfe5d('0xc')][_0x2036a2];delete _0x1a849d[_0xfe5d('0x27')][_0x2036a2];});}else{ut[_0xfe5d('0x46')](_0xfe5d('0x4c'));delete this[_0xfe5d('0xc')][_0x2036a2];delete this[_0xfe5d('0x27')][_0x2036a2];}};Fax['prototype'][_0xfe5d('0x1b')]=function(_0x2ba92d){var _0x50a1c7=this;if(this[_0xfe5d('0xc')][_0x2ba92d['uniqueid']]){if(this['actions'][_0x2ba92d[_0xfe5d('0x23')]]){this['channels'][_0x2ba92d[_0xfe5d('0x23')]]['id']=this[_0xfe5d('0x27')][_0x2ba92d[_0xfe5d('0x23')]]['id'];this[_0xfe5d('0xc')][_0x2ba92d['uniqueid']][_0xfe5d('0x25')]=this[_0xfe5d('0x27')][_0x2ba92d[_0xfe5d('0x23')]][_0xfe5d('0x25')];}logger[_0xfe5d('0x28')](_0x2ba92d[_0xfe5d('0x23')],this[_0xfe5d('0x27')][_0x2ba92d['uniqueid']]?_0xfe5d('0x4d'):_0xfe5d('0x4e'),JSON[_0xfe5d('0x3e')](this[_0xfe5d('0xc')][_0x2ba92d[_0xfe5d('0x23')]]));if(this['actions'][_0x2ba92d[_0xfe5d('0x23')]]){if(this[_0xfe5d('0xc')][_0x2ba92d[_0xfe5d('0x23')]]['faxpages']>0x0&&this[_0xfe5d('0xc')][_0x2ba92d[_0xfe5d('0x23')]][_0xfe5d('0x4f')]==='SUCCESS'){this['updateStatus'](_0x2ba92d[_0xfe5d('0x23')],!![]);}else{this[_0xfe5d('0x49')](_0x2ba92d['uniqueid'],![],this['channels'][_0x2ba92d[_0xfe5d('0x23')]][_0xfe5d('0x50')]?_0xfe5d('0x51')+this[_0xfe5d('0xc')][_0x2ba92d[_0xfe5d('0x23')]][_0xfe5d('0x50')]:_0xfe5d('0x52'));}}}};Fax[_0xfe5d('0x1e')][_0xfe5d('0x53')]=function(_0x3590a0){var _0x3cd990=this;return new BPromise(function(_0x1bd420,_0x5cce83){_0x3cd990[_0xfe5d('0x54')](_0x3590a0,_0x3cd990[_0xfe5d('0xd')][_0x3590a0[_0xfe5d('0x55')]])['then'](function(_0x2b3151){ut[_0xfe5d('0x46')]('[Fax][execOriginate][success]',_0x2b3151);_0x1bd420(ut[_0xfe5d('0x37')](_0xfe5d('0x56')));})[_0xfe5d('0x3c')](function(_0x49ff4a){ut[_0xfe5d('0x46')](_0xfe5d('0x57'),_0x49ff4a);updateStatus(_0x3590a0);_0x5cce83(ut[_0xfe5d('0x37')](_0xfe5d('0x58')));});});};Fax[_0xfe5d('0x1e')][_0xfe5d('0x59')]=function(_0x30b910){var _0x4fb1ce=this;return new BPromise(function(_0xf17236,_0x34fb72){var _0x3d16c5=_0x4fb1ce[_0xfe5d('0x5a')](_0x4fb1ce[_0xfe5d('0xd')][_0x30b910['FaxAccountId']][_0xfe5d('0x5b')],_0x30b910);if(_0x3d16c5[_0xfe5d('0x5c')]){_0xf17236(ut[_0xfe5d('0x37')](_0xfe5d('0x5d')));}else{_0x34fb72(ut[_0xfe5d('0x37')](_0x3d16c5[_0xfe5d('0x37')]));}});};function originate(_0x2a69b9,_0x2bf721,_0x6b5361){return new BPromise(function(_0x219586,_0x59210f){if(_0x6b5361){var _0x48d36f=util['format'](_0xfe5d('0x5e'),path['parse'](_0x2a69b9[_0xfe5d('0x3')])[_0xfe5d('0x25')],_0x2a69b9[_0xfe5d('0x3')]);gs[_0xfe5d('0x5f')](_0x48d36f)[_0xfe5d('0x45')](function(){_0x2a69b9[_0xfe5d('0x3')]=util[_0xfe5d('0x60')]('%s/%s.tif',path[_0xfe5d('0x38')](_0x2a69b9[_0xfe5d('0x3')])[_0xfe5d('0x61')],path[_0xfe5d('0x38')](_0x2a69b9[_0xfe5d('0x3')])['name']);_0x2bf721[_0xfe5d('0x62')]=_0x2a69b9[_0xfe5d('0x3')];ut['logger'](_0xfe5d('0x63'),'');ami['Action'](ut[_0xfe5d('0x64')](_0x2a69b9,_0x2bf721))[_0xfe5d('0x45')](function(_0x132909){_0x219586(_0x132909);})[_0xfe5d('0x3c')](function(_0x7d9afa){_0x59210f(_0x7d9afa);});})[_0xfe5d('0x3c')](function(_0x24e0e6){_0x59210f(_0x24e0e6);});}else{ami['Action'](ut[_0xfe5d('0x64')](_0x2a69b9,_0x2bf721))[_0xfe5d('0x45')](function(_0x3d6046){_0x219586(_0x3d6046);})[_0xfe5d('0x3c')](function(_0x3661ba){_0x59210f(_0x3661ba);});}});}Fax[_0xfe5d('0x1e')]['execOriginate']=function(_0x3b5e21,_0x3756c7){var _0x3d61cf=this;return new BPromise(function(_0xb5e743,_0xa73fb){var _0x3f95e9=uuid['v4']();var _0x2d2b8f=ut[_0xfe5d('0x65')](_0x3b5e21,_0x3756c7);_0x3d61cf[_0xfe5d('0x27')][_0x3f95e9]=new Action(_0x3f95e9,_0x3756c7,_0x3b5e21);var _0x37605a=_0x3d61cf[_0xfe5d('0x27')][_0x3f95e9];if(path[_0xfe5d('0x38')](_0x3b5e21[_0xfe5d('0x3')])[_0xfe5d('0x66')]===_0xfe5d('0x39')){originate(_0x37605a,_0x2d2b8f,!![])['then'](function(_0x1f4ac2){_0xb5e743(_0x1f4ac2);})['catch'](function(_0x9f8630){_0xa73fb(_0x9f8630);});}else{originate(_0x37605a,_0x2d2b8f,![])['then'](function(_0x51f661){_0xb5e743(_0x51f661);})[_0xfe5d('0x3c')](function(_0x3e7f2a){_0xa73fb(_0x3e7f2a);});}});};Fax[_0xfe5d('0x1e')][_0xfe5d('0x67')]=function(_0x4519f8){return!_[_0xfe5d('0x68')](_0x4519f8)&&!_[_0xfe5d('0x68')](_0x4519f8[_0xfe5d('0x25')])&&!_[_0xfe5d('0x68')](_0x4519f8['active'])&&_0x4519f8[_0xfe5d('0x69')]&&!_[_0xfe5d('0x68')](this[_0xfe5d('0xe')][util[_0xfe5d('0x60')](_0xfe5d('0x6a'),_0x4519f8[_0xfe5d('0x25')])])&&!_['isNil'](this['trunks'][util[_0xfe5d('0x60')](_0xfe5d('0x6a'),_0x4519f8[_0xfe5d('0x25')])][_0xfe5d('0x2d')])&&(this[_0xfe5d('0xe')][util[_0xfe5d('0x60')](_0xfe5d('0x6a'),_0x4519f8[_0xfe5d('0x25')])][_0xfe5d('0x2d')]===_0xfe5d('0x6b')||this['trunks'][util['format'](_0xfe5d('0x6a'),_0x4519f8['name'])][_0xfe5d('0x2d')]===_0xfe5d('0x6c'));};Fax[_0xfe5d('0x1e')][_0xfe5d('0x5a')]=function(_0x447204,_0x3c6132){if(!this[_0xfe5d('0x67')](_0x447204)){ut[_0xfe5d('0x46')](_0xfe5d('0x6d'),_[_0xfe5d('0x68')](_0x447204)?'':_0x447204[_0xfe5d('0x25')]+_0xfe5d('0x6e'));return{'isValid':![],'message':_0xfe5d('0x6f')};}if(_[_0xfe5d('0x68')](_0x3c6132['fax'])){ut[_0xfe5d('0x46')](_0xfe5d('0x70'),JSON['stringify'](_0x3c6132));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xfe5d('0x68')](_0x3c6132[_0xfe5d('0x3')])){ut[_0xfe5d('0x46')](_0xfe5d('0x71'),JSON[_0xfe5d('0x3e')](_0x3c6132));return{'isValid':![],'message':_0xfe5d('0x72')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xfe5d('0x73')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 831807b..a1c9853 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 _0x792f=['bluebird','../../../config/logger','preview','../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20','util'];(function(_0x1230b8,_0xa80c1f){var _0x149e66=function(_0x2ee33b){while(--_0x2ee33b){_0x1230b8['push'](_0x1230b8['shift']());}};_0x149e66(++_0xa80c1f);}(_0x792f,0x173));var _0xf792=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0x792f[_0x564821];return _0x2b604d;};'use strict';var util=require(_0xf792('0x0'));var BPromise=require(_0xf792('0x1'));var logger=require(_0xf792('0x2'))(_0xf792('0x3'));var _=require('lodash');var faxAccount=require(_0xf792('0x4'));function loggerCatch(_0x568f86){return function(_0x26b4f5){logger[_0xf792('0x5')](_0x568f86,util[_0xf792('0x6')](_0x26b4f5,{'showHidden':![],'depth':null}));};}exports[_0xf792('0x7')]=function(_0x425775,_0x2528b9){return BPromise[_0xf792('0x8')]()[_0xf792('0x9')](faxAccount['notify'](_0x425775,_0x2528b9))[_0xf792('0xa')](loggerCatch(_0xf792('0xb')));}; \ No newline at end of file +var _0xb02f=['[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','resolve','notify','catch'];(function(_0x1f4539,_0x4200c4){var _0x1980ca=function(_0x57502c){while(--_0x57502c){_0x1f4539['push'](_0x1f4539['shift']());}};_0x1980ca(++_0x4200c4);}(_0xb02f,0xd9));var _0xfb02=function(_0x417d71,_0x3c2981){_0x417d71=_0x417d71-0x0;var _0x167ff7=_0xb02f[_0x417d71];return _0x167ff7;};'use strict';var util=require(_0xfb02('0x0'));var BPromise=require(_0xfb02('0x1'));var logger=require(_0xfb02('0x2'))(_0xfb02('0x3'));var _=require(_0xfb02('0x4'));var faxAccount=require(_0xfb02('0x5'));function loggerCatch(_0x281dfa){return function(_0x47055f){logger[_0xfb02('0x6')](_0x281dfa,util[_0xfb02('0x7')](_0x47055f,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x356cea,_0x3653d7){return BPromise[_0xfb02('0x8')]()['then'](faxAccount[_0xfb02('0x9')](_0x356cea,_0x3653d7))[_0xfb02('0xa')](loggerCatch(_0xfb02('0xb')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 7bb799f..af86889 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 _0xd181=['fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x41e2a5,_0x4ee5eb){var _0x59449f=function(_0x3ee967){while(--_0x3ee967){_0x41e2a5['push'](_0x41e2a5['shift']());}};_0x59449f(++_0x4ee5eb);}(_0xd181,0x1ab));var _0x1d18=function(_0x1a2551,_0x393aa8){_0x1a2551=_0x1a2551-0x0;var _0x5b5b60=_0xd181[_0x1a2551];return _0x5b5b60;};'use strict';var util=require(_0x1d18('0x0'));var logger=require(_0x1d18('0x1'))(_0x1d18('0x2'));var BPromise=require(_0x1d18('0x3'));var exec=require(_0x1d18('0x4'))[_0x1d18('0x5')];exports[_0x1d18('0x6')]=function(_0x1df8c0){return new BPromise(function(_0xef07f3,_0x1b13ae){exec(_0x1df8c0,function(_0x72229e,_0x432532,_0x54f4e){logger[_0x1d18('0x7')](_0x1d18('0x8'),_0x432532);if(_0x72229e){logger[_0x1d18('0x7')](_0x1d18('0x8'),_0x1d18('0x9'),util[_0x1d18('0xa')](_0x72229e,{'showHidden':![],'depth':null}),_0x432532,_0x54f4e);_0x1b13ae(_0x72229e);}_0xef07f3(_0x432532);});});}; \ No newline at end of file +var _0x802f=['util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','inspect'];(function(_0x41fd78,_0x4fb3fe){var _0x2af932=function(_0x235106){while(--_0x235106){_0x41fd78['push'](_0x41fd78['shift']());}};_0x2af932(++_0x4fb3fe);}(_0x802f,0x1a4));var _0xf802=function(_0x2131f2,_0x2a190c){_0x2131f2=_0x2131f2-0x0;var _0x5a9475=_0x802f[_0x2131f2];return _0x5a9475;};'use strict';var util=require(_0xf802('0x0'));var logger=require(_0xf802('0x1'))(_0xf802('0x2'));var BPromise=require(_0xf802('0x3'));var exec=require(_0xf802('0x4'))[_0xf802('0x5')];exports[_0xf802('0x6')]=function(_0x2c4446){return new BPromise(function(_0x25f747,_0x407f53){exec(_0x2c4446,function(_0x4eecfa,_0x5cf28c,_0x5c018b){logger['info']('Exec\x20gs',_0x5cf28c);if(_0x4eecfa){logger[_0xf802('0x7')](_0xf802('0x8'),'\x20Error\x20:',util[_0xf802('0x9')](_0x4eecfa,{'showHidden':![],'depth':null}),_0x5cf28c,_0x5c018b);_0x407f53(_0x4eecfa);}_0x25f747(_0x5cf28c);});});}; \ 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 da08783..edf4341 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 _0x5681=['path','uniqueid','originate','channel','\x22%s\x22\x20<%s>','lodash','../../../../config/logger','logger','info','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid'];(function(_0x591f2c,_0x4a1ce7){var _0xbd8d=function(_0x52e657){while(--_0x52e657){_0x591f2c['push'](_0x591f2c['shift']());}};_0xbd8d(++_0x4a1ce7);}(_0x5681,0xe1));var _0x1568=function(_0x52a9b3,_0x4b1a25){_0x52a9b3=_0x52a9b3-0x0;var _0x1c1a69=_0x5681[_0x52a9b3];return _0x1c1a69;};'use strict';var util=require('util');var _=require(_0x1568('0x0'));var moment=require('moment');var logger=require(_0x1568('0x1'))('fax');exports['message']=function(_0x2989c5){return{'message':_0x2989c5};};exports[_0x1568('0x2')]=function(_0x4853c6,_0x208f2e){logger[_0x1568('0x3')](_0x4853c6,util['inspect'](_0x208f2e,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x354992,_0x50590c){var _0x30da5c={'XMF-ECM':_0x50590c[_0x1568('0x4')],'XMF-HEADERINFO':_0x50590c[_0x1568('0x5')],'XMF-MINRATE':_0x50590c[_0x1568('0x6')],'XMF-MAXRATE':_0x50590c[_0x1568('0x7')],'XMF-MODEM':util[_0x1568('0x8')](_0x1568('0x9'),_0x50590c[_0x1568('0xa')]),'XMF-GATEWAY':_0x50590c[_0x1568('0xb')],'XMF-FAXDETECT':_0x50590c[_0x1568('0xc')],'XMF-T38TIMEOUT':_0x50590c[_0x1568('0xd')],'XMF-LOCALSTATIONID':_0x50590c[_0x1568('0xe')],'XMF-PATH':_0x354992[_0x1568('0xf')]};return _0x30da5c;};exports['variablesAction']=function(_0x10ffe9,_0x49ba8b){return{'actionid':_0x10ffe9[_0x1568('0x10')],'action':_0x1568('0x11'),'channel':_0x10ffe9[_0x1568('0x12')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x1568('0x8')](_0x1568('0x13'),_0x10ffe9['headerinfo']?_0x10ffe9[_0x1568('0x5')]:'',_0x10ffe9['localstationid']),'variable':_0x49ba8b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x10ffe9[_0x1568('0x10')]};}; \ No newline at end of file +var _0xc8fb=['logger','info','inspect','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc8fb,0x119));var _0xbc8f=function(_0x18fae,_0x130a19){_0x18fae=_0x18fae-0x0;var _0x5bca02=_0xc8fb[_0x18fae];return _0x5bca02;};'use strict';var util=require(_0xbc8f('0x0'));var _=require(_0xbc8f('0x1'));var moment=require(_0xbc8f('0x2'));var logger=require(_0xbc8f('0x3'))(_0xbc8f('0x4'));exports['message']=function(_0x1c9548){return{'message':_0x1c9548};};exports[_0xbc8f('0x5')]=function(_0x246352,_0x1f1f77){logger[_0xbc8f('0x6')](_0x246352,util[_0xbc8f('0x7')](_0x1f1f77,{'showHidden':![],'depth':null}));};exports[_0xbc8f('0x8')]=function(_0x297ddf,_0x487945){var _0x5113e6={'XMF-ECM':_0x487945[_0xbc8f('0x9')],'XMF-HEADERINFO':_0x487945[_0xbc8f('0xa')],'XMF-MINRATE':_0x487945['minrate'],'XMF-MAXRATE':_0x487945[_0xbc8f('0xb')],'XMF-MODEM':util[_0xbc8f('0xc')](_0xbc8f('0xd'),_0x487945[_0xbc8f('0xe')]),'XMF-GATEWAY':_0x487945['gateway'],'XMF-FAXDETECT':_0x487945[_0xbc8f('0xf')],'XMF-T38TIMEOUT':_0x487945[_0xbc8f('0x10')],'XMF-LOCALSTATIONID':_0x487945[_0xbc8f('0x11')],'XMF-PATH':_0x297ddf[_0xbc8f('0x12')]};return _0x5113e6;};exports[_0xbc8f('0x13')]=function(_0x5656b9,_0x26943d){return{'actionid':_0x5656b9[_0xbc8f('0x14')],'action':_0xbc8f('0x15'),'channel':_0x5656b9[_0xbc8f('0x16')],'Exten':_0xbc8f('0x17'),'Context':_0xbc8f('0x18'),'Priority':'1','callerid':util[_0xbc8f('0xc')](_0xbc8f('0x19'),_0x5656b9['headerinfo']?_0x5656b9[_0xbc8f('0xa')]:'',_0x5656b9[_0xbc8f('0x11')]),'variable':_0x26943d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5656b9[_0xbc8f('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 0f516e6..29bf982 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 _0x103b=['initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','log','listen','sync','bluebird','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','getAgents','initAgents','then','getTrunks','initVoiceQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x103b,0x121));var _0xb103=function(_0x282aad,_0x404241){_0x282aad=_0x282aad-0x0;var _0x590f8d=_0x103b[_0x282aad];return _0x590f8d;};'use strict';var BPromise=require(_0xb103('0x0'));var util=require('util');var moment=require(_0xb103('0x1'));var server=require(_0xb103('0x2'));var Realtime=require(_0xb103('0x3'));var Report=require(_0xb103('0x4'));var Acw=require(_0xb103('0x5'));var Trigger=require(_0xb103('0x6'));var Dialer=require(_0xb103('0x7'));var Preview=require(_0xb103('0x8'));var Fax=require(_0xb103('0x9'));var user=require(_0xb103('0xa'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xb103('0xb'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0xb103('0xc'));var cmHopperHistory=require(_0xb103('0xd'));var campaign=require(_0xb103('0xe'));var voiceExtension=require(_0xb103('0xf'));var faxAccount=require(_0xb103('0x10'));var zendesk=require(_0xb103('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xb103('0x12'));var freshdesk=require(_0xb103('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xb103('0x14'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xb103('0x15'));var servicenow=require(_0xb103('0x16'));var dynamics365=require(_0xb103('0x17'));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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xb103('0x18')](_0xb103('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xb103('0x18')](_0xb103('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user[_0xb103('0x1a')]())['then'](realtime[_0xb103('0x1b')]())[_0xb103('0x1c')](user['getTelephones']())[_0xb103('0x1c')](realtime['initTelephones']())[_0xb103('0x1c')](trunk[_0xb103('0x1d')]())[_0xb103('0x1c')](realtime['initTrunks']())[_0xb103('0x1c')](voiceQueue['getVoiceQueues']())[_0xb103('0x1c')](realtime[_0xb103('0x1e')]())[_0xb103('0x1c')](trigger['getTriggers']())['then'](realtime[_0xb103('0x1f')]())[_0xb103('0x1c')](template[_0xb103('0x20')]())['then'](realtime[_0xb103('0x21')]())[_0xb103('0x1c')](zendesk[_0xb103('0x22')]())['then'](realtime[_0xb103('0x23')]())[_0xb103('0x1c')](salesforce[_0xb103('0x24')]())['then'](realtime['initSalesforceAccounts']())[_0xb103('0x1c')](sugarcrm[_0xb103('0x25')]())[_0xb103('0x1c')](realtime[_0xb103('0x26')]())[_0xb103('0x1c')](freshdesk[_0xb103('0x27')]())[_0xb103('0x1c')](realtime['initFreshdeskAccounts']())['then'](desk[_0xb103('0x28')]())[_0xb103('0x1c')](realtime[_0xb103('0x29')]())[_0xb103('0x1c')](zoho[_0xb103('0x2a')]())[_0xb103('0x1c')](realtime[_0xb103('0x2b')]())['then'](vtiger[_0xb103('0x2c')]())[_0xb103('0x1c')](realtime[_0xb103('0x2d')]())[_0xb103('0x1c')](freshsales['getFreshsalesAccounts']())[_0xb103('0x1c')](realtime[_0xb103('0x2e')]())[_0xb103('0x1c')](servicenow['getServicenowAccounts']())[_0xb103('0x1c')](realtime['initServicenowAccounts']())[_0xb103('0x1c')](dynamics365[_0xb103('0x2f')]())[_0xb103('0x1c')](realtime[_0xb103('0x30')]())[_0xb103('0x1c')](campaign[_0xb103('0x31')]())[_0xb103('0x1c')](realtime[_0xb103('0x32')]())['then'](voiceExtension[_0xb103('0x33')]())[_0xb103('0x1c')](realtime[_0xb103('0x34')]())[_0xb103('0x1c')](faxAccount[_0xb103('0x35')]())['then'](realtime[_0xb103('0x36')]())[_0xb103('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0xb103('0x37')]()[_0xb103('0x1c')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0xb103('0x38')]())[_0xb103('0x1c')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xb103('0x1c')](realtime['initVoiceQueueHopperHistory']())[_0xb103('0x1c')](cmHopperHistory[_0xb103('0x39')]())['then'](realtime[_0xb103('0x3a')]())[_0xb103('0x1c')](voiceCallReport['getVoiceCallReports']())[_0xb103('0x1c')](realtime[_0xb103('0x3b')]())[_0xb103('0x1c')](function(_0x2c7f4e){})[_0xb103('0x3c')](function(_0x304e6a){console[_0xb103('0x3d')](_0x304e6a);});}function main(){return server[_0xb103('0x3e')](realtime,preview,fax)['then'](function(_0x3f0540){return initRealtime();})[_0xb103('0x1c')](function(){return initParams();})['then'](function(){report[_0xb103('0x3f')]();setInterval(initRealtime,0x1388);})[_0xb103('0x3c')](function(_0x14060d){console[_0xb103('0x3d')](_0x14060d);});}main(); \ No newline at end of file +var _0x2227=['log','bluebird','util','moment','./server','./trigger','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x2227,0x1f1));var _0x7222=function(_0x43f489,_0x2b4fea){_0x43f489=_0x43f489-0x0;var _0x4134b4=_0x2227[_0x43f489];return _0x4134b4;};'use strict';var BPromise=require(_0x7222('0x0'));var util=require(_0x7222('0x1'));var moment=require(_0x7222('0x2'));var server=require(_0x7222('0x3'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0x7222('0x4'));var Dialer=require('./dialer');var Preview=require(_0x7222('0x5'));var Fax=require(_0x7222('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0x7222('0x7'));var voiceQueueReport=require(_0x7222('0x8'));var voiceCallReport=require(_0x7222('0x9'));var trunk=require(_0x7222('0xa'));var trigger=require('./rpc/trigger');var template=require(_0x7222('0xb'));var cmHopperHistory=require(_0x7222('0xc'));var campaign=require(_0x7222('0xd'));var voiceExtension=require(_0x7222('0xe'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x7222('0xf'));var salesforce=require(_0x7222('0x10'));var sugarcrm=require(_0x7222('0x11'));var freshdesk=require(_0x7222('0x12'));var desk=require(_0x7222('0x13'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x7222('0x14'));var dynamics365=require(_0x7222('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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7222('0x16')](_0x7222('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x7222('0x16')](_0x7222('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x7222('0x18')]()[_0x7222('0x19')](user['getAgents']())[_0x7222('0x19')](realtime[_0x7222('0x1a')]())[_0x7222('0x19')](user[_0x7222('0x1b')]())[_0x7222('0x19')](realtime[_0x7222('0x1c')]())['then'](trunk['getTrunks']())[_0x7222('0x19')](realtime[_0x7222('0x1d')]())['then'](voiceQueue[_0x7222('0x1e')]())[_0x7222('0x19')](realtime[_0x7222('0x1f')]())[_0x7222('0x19')](trigger[_0x7222('0x20')]())[_0x7222('0x19')](realtime[_0x7222('0x21')]())[_0x7222('0x19')](template['getTemplates']())[_0x7222('0x19')](realtime['initTemplates']())[_0x7222('0x19')](zendesk[_0x7222('0x22')]())[_0x7222('0x19')](realtime[_0x7222('0x23')]())[_0x7222('0x19')](salesforce['getSalesforceAccounts']())[_0x7222('0x19')](realtime[_0x7222('0x24')]())[_0x7222('0x19')](sugarcrm[_0x7222('0x25')]())['then'](realtime[_0x7222('0x26')]())[_0x7222('0x19')](freshdesk[_0x7222('0x27')]())[_0x7222('0x19')](realtime[_0x7222('0x28')]())[_0x7222('0x19')](desk[_0x7222('0x29')]())['then'](realtime[_0x7222('0x2a')]())[_0x7222('0x19')](zoho[_0x7222('0x2b')]())['then'](realtime['initZohoAccounts']())[_0x7222('0x19')](vtiger[_0x7222('0x2c')]())[_0x7222('0x19')](realtime[_0x7222('0x2d')]())[_0x7222('0x19')](freshsales[_0x7222('0x2e')]())[_0x7222('0x19')](realtime['initFreshsalesAccounts']())[_0x7222('0x19')](servicenow['getServicenowAccounts']())[_0x7222('0x19')](realtime[_0x7222('0x2f')]())[_0x7222('0x19')](dynamics365[_0x7222('0x30')]())[_0x7222('0x19')](realtime[_0x7222('0x31')]())[_0x7222('0x19')](campaign[_0x7222('0x32')]())[_0x7222('0x19')](realtime[_0x7222('0x33')]())['then'](voiceExtension['getVoiceExtensions']())[_0x7222('0x19')](realtime[_0x7222('0x34')]())[_0x7222('0x19')](faxAccount[_0x7222('0x35')]())[_0x7222('0x19')](realtime['initFaxAccounts']())[_0x7222('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0x7222('0x18')]()[_0x7222('0x19')](voiceQueueReport[_0x7222('0x36')]())[_0x7222('0x19')](realtime[_0x7222('0x37')]())[_0x7222('0x19')](cmHopperHistory[_0x7222('0x38')]())[_0x7222('0x19')](realtime[_0x7222('0x39')]())[_0x7222('0x19')](cmHopperHistory['getCampaignHopperHistory']())[_0x7222('0x19')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x7222('0x3a')]())['then'](realtime[_0x7222('0x3b')]())[_0x7222('0x19')](function(_0x6548cb){})[_0x7222('0x3c')](function(_0x50ebf2){console[_0x7222('0x3d')](_0x50ebf2);});}function main(){return server['listen'](realtime,preview,fax)[_0x7222('0x19')](function(_0x568e20){return initRealtime();})['then'](function(){return initParams();})[_0x7222('0x19')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x5d2761){console[_0x7222('0x3d')](_0x5d2761);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index f69f0b1..2467813 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 _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x514c5e,_0x8c0875){var _0x34c3e6=function(_0x3d78d2){while(--_0x3d78d2){_0x514c5e['push'](_0x514c5e['shift']());}};_0x34c3e6(++_0x8c0875);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file +var _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x4038da,_0x39653){var _0x48e415=function(_0x3f4057){while(--_0x3f4057){_0x4038da['push'](_0x4038da['shift']());}};_0x48e415(++_0x39653);}(_0xe706,0xa3));var _0x6e70=function(_0x30bb7c,_0x27a364){_0x30bb7c=_0x30bb7c-0x0;var _0x3b32be=_0xe706[_0x30bb7c];return _0x3b32be;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 46b8078..02cd08e 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 _0xf88a=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x1ae975,_0x70b40e){var _0x2576ca=function(_0x1b4e97){while(--_0x1b4e97){_0x1ae975['push'](_0x1ae975['shift']());}};_0x2576ca(++_0x70b40e);}(_0xf88a,0x1ee));var _0xaf88=function(_0x2fb6e9,_0x171e19){_0x2fb6e9=_0x2fb6e9-0x0;var _0x2cd8a4=_0xf88a[_0x2fb6e9];return _0x2cd8a4;};'use strict';function Campaign(_0x4b596a){this['id']=_0x4b596a['id']||0x0;this[_0xaf88('0x0')]=_0x4b596a['name']||'';this[_0xaf88('0x1')]=_0x4b596a[_0xaf88('0x1')]||_0xaf88('0x2');this[_0xaf88('0x3')]=0x0;this['temp']=0x0;this[_0xaf88('0x4')]=0x0;this[_0xaf88('0x5')]=0x0;this['message']='';this[_0xaf88('0x6')]=!![];this[_0xaf88('0x7')]=_0x4b596a[_0xaf88('0x7')];this[_0xaf88('0x8')]=_0x4b596a['limitCalls'];this['dialTimezone']=_0x4b596a['dialTimezone']||null;this[_0xaf88('0x9')]=_0x4b596a[_0xaf88('0x9')]?_0x4b596a[_0xaf88('0x9')]:null;this['dialOriginateCallerIdName']=_0x4b596a['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x4b596a[_0xaf88('0xa')];this[_0xaf88('0xb')]=_0x4b596a[_0xaf88('0xb')]||0x1e;this['dialCongestionMaxRetry']=_0x4b596a['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x4b596a[_0xaf88('0xc')];this['dialBusyMaxRetry']=_0x4b596a[_0xaf88('0xd')];this[_0xaf88('0xe')]=_0x4b596a[_0xaf88('0xe')];this[_0xaf88('0xf')]=_0x4b596a[_0xaf88('0xf')];this[_0xaf88('0x10')]=_0x4b596a[_0xaf88('0x10')];this[_0xaf88('0x11')]=_0x4b596a['dialGlobalMaxRetry'];this[_0xaf88('0x12')]=_0x4b596a['dialNoSuchNumberMaxRetry']||0x3;this[_0xaf88('0x13')]=_0x4b596a['dialNoSuchNumberRetryFrequency']||0x96;this[_0xaf88('0x14')]=_0x4b596a[_0xaf88('0x14')]||0x3;this['dialDropRetryFrequency']=_0x4b596a[_0xaf88('0x15')]||0x96;this['dialAbandonedMaxRetry']=_0x4b596a[_0xaf88('0x16')]||0x3;this[_0xaf88('0x17')]=_0x4b596a[_0xaf88('0x17')]||0x96;this[_0xaf88('0x18')]=_0x4b596a[_0xaf88('0x18')]||0x3;this[_0xaf88('0x19')]=_0x4b596a[_0xaf88('0x19')]||0x96;this['dialAgentRejectMaxRetry']=_0x4b596a[_0xaf88('0x1a')]||0x3;this[_0xaf88('0x1b')]=_0x4b596a['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x4b596a[_0xaf88('0x1c')]||_0xaf88('0x1d');this['dialPrefix']=_0x4b596a[_0xaf88('0x1e')]||undefined;this[_0xaf88('0x1f')]=_0x4b596a[_0xaf88('0x1f')]||undefined;this['dialCutDigit']=_0x4b596a['dialCutDigit']||undefined;this[_0xaf88('0x20')]=_0x4b596a[_0xaf88('0x20')]?_0x4b596a[_0xaf88('0x20')]:undefined;this[_0xaf88('0x21')]=_0x4b596a[_0xaf88('0x21')]?_0x4b596a['Trunk']:undefined;this[_0xaf88('0x22')]=_0x4b596a[_0xaf88('0x22')]?_0x4b596a[_0xaf88('0x22')]:undefined;this[_0xaf88('0x23')]=_0x4b596a[_0xaf88('0x23')]?_0x4b596a[_0xaf88('0x23')]:undefined;this[_0xaf88('0x24')]=_0x4b596a[_0xaf88('0x23')]?_0x4b596a['SquareProject']['name']:undefined;this[_0xaf88('0x25')]=_0x4b596a[_0xaf88('0x25')]||![];this[_0xaf88('0x26')]=_0x4b596a[_0xaf88('0x26')];this[_0xaf88('0x27')]=_0x4b596a['dialAMDGreeting'];this[_0xaf88('0x28')]=_0x4b596a[_0xaf88('0x28')];this[_0xaf88('0x29')]=_0x4b596a[_0xaf88('0x29')];this['dialAMDMinWordLength']=_0x4b596a[_0xaf88('0x2a')];this['dialAMDBetweenWordsSilence']=_0x4b596a['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x4b596a[_0xaf88('0x2b')];this[_0xaf88('0x2c')]=_0x4b596a['dialAMDSilenceThreshold'];this[_0xaf88('0x2d')]=_0x4b596a['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0x5d7c=['TrunkBackup','Trunk','Interval','dialQueueProject','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','ivrAnswerCallsDay','ivrTotalCallsDays','active','dialTimezone','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'];(function(_0x54b95b,_0x2f4847){var _0x288732=function(_0x6e12a){while(--_0x6e12a){_0x54b95b['push'](_0x54b95b['shift']());}};_0x288732(++_0x2f4847);}(_0x5d7c,0x1e5));var _0xc5d7=function(_0x5b4c44,_0x2e495e){_0x5b4c44=_0x5b4c44-0x0;var _0x58485a=_0x5d7c[_0x5b4c44];return _0x58485a;};'use strict';function Campaign(_0x247e7b){this['id']=_0x247e7b['id']||0x0;this[_0xc5d7('0x0')]=_0x247e7b[_0xc5d7('0x0')]||'';this[_0xc5d7('0x1')]=_0x247e7b['type']||_0xc5d7('0x2');this['originated']=0x0;this['temp']=0x0;this[_0xc5d7('0x3')]=0x0;this[_0xc5d7('0x4')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0xc5d7('0x5')]=_0x247e7b['active'];this['limitCalls']=_0x247e7b['limitCalls'];this[_0xc5d7('0x6')]=_0x247e7b[_0xc5d7('0x6')]||null;this[_0xc5d7('0x7')]=_0x247e7b[_0xc5d7('0x7')]?_0x247e7b['dialGlobalInterval']:null;this[_0xc5d7('0x8')]=_0x247e7b[_0xc5d7('0x8')];this[_0xc5d7('0x9')]=_0x247e7b['dialOriginateCallerIdNumber'];this[_0xc5d7('0xa')]=_0x247e7b['dialOriginateTimeout']||0x1e;this[_0xc5d7('0xb')]=_0x247e7b[_0xc5d7('0xb')];this[_0xc5d7('0xc')]=_0x247e7b[_0xc5d7('0xc')];this[_0xc5d7('0xd')]=_0x247e7b[_0xc5d7('0xd')];this[_0xc5d7('0xe')]=_0x247e7b['dialBusyRetryFrequency'];this[_0xc5d7('0xf')]=_0x247e7b[_0xc5d7('0xf')];this['dialNoAnswerRetryFrequency']=_0x247e7b[_0xc5d7('0x10')];this[_0xc5d7('0x11')]=_0x247e7b[_0xc5d7('0x11')];this['dialNoSuchNumberMaxRetry']=_0x247e7b[_0xc5d7('0x12')]||0x3;this[_0xc5d7('0x13')]=_0x247e7b[_0xc5d7('0x13')]||0x96;this['dialDropMaxRetry']=_0x247e7b[_0xc5d7('0x14')]||0x3;this[_0xc5d7('0x15')]=_0x247e7b[_0xc5d7('0x15')]||0x96;this['dialAbandonedMaxRetry']=_0x247e7b[_0xc5d7('0x16')]||0x3;this[_0xc5d7('0x17')]=_0x247e7b['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x247e7b[_0xc5d7('0x18')]||0x3;this[_0xc5d7('0x19')]=_0x247e7b[_0xc5d7('0x19')]||0x96;this['dialAgentRejectMaxRetry']=_0x247e7b[_0xc5d7('0x1a')]||0x3;this[_0xc5d7('0x1b')]=_0x247e7b[_0xc5d7('0x1b')]||0x96;this['dialOrderByScheduledAt']=_0x247e7b['dialOrderByScheduledAt']||_0xc5d7('0x1c');this[_0xc5d7('0x1d')]=_0x247e7b[_0xc5d7('0x1d')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x247e7b[_0xc5d7('0x1e')]||undefined;this[_0xc5d7('0x1f')]=_0x247e7b[_0xc5d7('0x1f')]||undefined;this['TrunkBackup']=_0x247e7b[_0xc5d7('0x20')]?_0x247e7b[_0xc5d7('0x20')]:undefined;this['Trunk']=_0x247e7b[_0xc5d7('0x21')]?_0x247e7b[_0xc5d7('0x21')]:undefined;this[_0xc5d7('0x22')]=_0x247e7b[_0xc5d7('0x22')]?_0x247e7b[_0xc5d7('0x22')]:undefined;this['SquareProject']=_0x247e7b['SquareProject']?_0x247e7b['SquareProject']:undefined;this[_0xc5d7('0x23')]=_0x247e7b[_0xc5d7('0x24')]?_0x247e7b[_0xc5d7('0x24')]['name']:undefined;this[_0xc5d7('0x25')]=_0x247e7b['dialAMDActive']||![];this[_0xc5d7('0x26')]=_0x247e7b[_0xc5d7('0x26')];this[_0xc5d7('0x27')]=_0x247e7b[_0xc5d7('0x27')];this[_0xc5d7('0x28')]=_0x247e7b[_0xc5d7('0x28')];this[_0xc5d7('0x29')]=_0x247e7b[_0xc5d7('0x29')];this['dialAMDMinWordLength']=_0x247e7b[_0xc5d7('0x2a')];this[_0xc5d7('0x2b')]=_0x247e7b['dialAMDBetweenWordsSilence'];this[_0xc5d7('0x2c')]=_0x247e7b[_0xc5d7('0x2c')];this[_0xc5d7('0x2d')]=_0x247e7b['dialAMDSilenceThreshold'];this[_0xc5d7('0x2e')]=_0x247e7b[_0xc5d7('0x2e')];}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 ccb05f0..eeeb2bb 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 _0x3cd0=['lastapplication','duration','billableseconds','holdtime','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','mohtime','exports','starttime','calleridnum','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','endtime','unmanaged'];(function(_0x158ed1,_0x2f7146){var _0x4375f6=function(_0x14afdc){while(--_0x14afdc){_0x158ed1['push'](_0x158ed1['shift']());}};_0x4375f6(++_0x2f7146);}(_0x3cd0,0x8a));var _0x03cd=function(_0x6dfbaa,_0x31eede){_0x6dfbaa=_0x6dfbaa-0x0;var _0xfbe02=_0x3cd0[_0x6dfbaa];return _0xfbe02;};'use strict';function Channel(){this[_0x03cd('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x03cd('0x1')]=0x0;this['calleridname']='';this[_0x03cd('0x2')]=undefined;this[_0x03cd('0x3')]=undefined;this[_0x03cd('0x4')]=0x0;this[_0x03cd('0x5')]='';this[_0x03cd('0x6')]=0x0;this['linkedid']=0x0;this[_0x03cd('0x7')]=0x0;this[_0x03cd('0x8')]=![];this[_0x03cd('0x9')]=null;this[_0x03cd('0xa')]=null;this[_0x03cd('0xb')]=![];this['abandoned']=![];this[_0x03cd('0xc')]='';this['lastdata']='';this[_0x03cd('0xd')]=0x0;this[_0x03cd('0xe')]=0x0;this[_0x03cd('0xf')]=0x0;this[_0x03cd('0x10')]=null;this['tag']=null;this[_0x03cd('0x11')]=null;this[_0x03cd('0x12')]=![];this[_0x03cd('0x13')]=null;this[_0x03cd('0x14')]=null;this[_0x03cd('0x15')]=[];this[_0x03cd('0x16')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x03cd('0x17')]=0x0;}module[_0x03cd('0x18')]=Channel; \ No newline at end of file +var _0x5d0a=['tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','starttime','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','holdtime','type'];(function(_0xebffa2,_0x1de424){var _0x5bf38a=function(_0x2958c9){while(--_0x2958c9){_0xebffa2['push'](_0xebffa2['shift']());}};_0x5bf38a(++_0x1de424);}(_0x5d0a,0x175));var _0xa5d0=function(_0x86c05b,_0x6b1c56){_0x86c05b=_0x86c05b-0x0;var _0x4763a2=_0x5d0a[_0x86c05b];return _0x4763a2;};'use strict';function Channel(){this[_0xa5d0('0x0')]=null;this['channel']='';this[_0xa5d0('0x1')]='';this['calleridnum']=0x0;this[_0xa5d0('0x2')]='';this[_0xa5d0('0x3')]=undefined;this[_0xa5d0('0x4')]=undefined;this[_0xa5d0('0x5')]=0x0;this['context']='';this[_0xa5d0('0x6')]=0x0;this[_0xa5d0('0x7')]=0x0;this[_0xa5d0('0x8')]=0x0;this[_0xa5d0('0x9')]=![];this[_0xa5d0('0xa')]=null;this[_0xa5d0('0xb')]=null;this[_0xa5d0('0xc')]=![];this[_0xa5d0('0xd')]=![];this[_0xa5d0('0xe')]='';this[_0xa5d0('0xf')]='';this[_0xa5d0('0x10')]=0x0;this['billableseconds']=0x0;this[_0xa5d0('0x11')]=0x0;this[_0xa5d0('0x12')]=null;this[_0xa5d0('0x13')]=null;this[_0xa5d0('0x14')]=null;this[_0xa5d0('0x15')]=![];this[_0xa5d0('0x16')]=null;this[_0xa5d0('0x17')]=null;this[_0xa5d0('0x18')]=[];this[_0xa5d0('0x19')]=undefined;this[_0xa5d0('0x1a')]=undefined;this['transferType']=undefined;this[_0xa5d0('0x1b')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 53d80bd..6f04efb 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 _0x3118=['serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x28f1de,_0x355054){var _0x5b5dad=function(_0x399b72){while(--_0x399b72){_0x28f1de['push'](_0x28f1de['shift']());}};_0x5b5dad(++_0x355054);}(_0x3118,0xe7));var _0x8311=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x3118[_0x525c7b];return _0x27b33e;};'use strict';function DeskAccount(_0x106447){this['id']=_0x106447['id']||0x0;this['name']=_0x106447[_0x8311('0x0')]||'';this['username']=_0x106447['username']||'';this[_0x8311('0x1')]=_0x106447[_0x8311('0x1')]||'';this[_0x8311('0x2')]=_0x106447[_0x8311('0x2')]||'';this[_0x8311('0x3')]=_0x106447[_0x8311('0x3')]||'';this['consumerKey']=_0x106447[_0x8311('0x4')]||'';this[_0x8311('0x5')]=_0x106447[_0x8311('0x5')]||'';this[_0x8311('0x6')]=_0x106447[_0x8311('0x6')]||'';this['tokenSecret']=_0x106447[_0x8311('0x7')]||'';this[_0x8311('0x8')]=_0x106447[_0x8311('0x8')]||'';this[_0x8311('0x9')]=_0x106447['serverUrl']||'';this[_0x8311('0xa')]=_0x106447[_0x8311('0xa')]||{};}module[_0x8311('0xb')]=DeskAccount; \ No newline at end of file +var _0x1a51=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','authType','password','consumerKey'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1a51,0xeb));var _0x11a5=function(_0x474125,_0x24b3bd){_0x474125=_0x474125-0x0;var _0x27b412=_0x1a51[_0x474125];return _0x27b412;};'use strict';function DeskAccount(_0x58e398){this['id']=_0x58e398['id']||0x0;this[_0x11a5('0x0')]=_0x58e398[_0x11a5('0x0')]||'';this[_0x11a5('0x1')]=_0x58e398[_0x11a5('0x1')]||'';this['remoteUri']=_0x58e398['remoteUri']||'';this[_0x11a5('0x2')]=_0x58e398[_0x11a5('0x2')]||'';this[_0x11a5('0x3')]=_0x58e398[_0x11a5('0x3')]||'';this[_0x11a5('0x4')]=_0x58e398[_0x11a5('0x4')]||'';this[_0x11a5('0x5')]=_0x58e398['consumerSecret']||'';this[_0x11a5('0x6')]=_0x58e398['token']||'';this[_0x11a5('0x7')]=_0x58e398['tokenSecret']||'';this[_0x11a5('0x8')]=_0x58e398['type']||'';this['serverUrl']=_0x58e398[_0x11a5('0x9')]||'';this[_0x11a5('0xa')]=_0x58e398[_0x11a5('0xa')]||{};}module[_0x11a5('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index ef6fcaf..3efd5f2 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 _0xe605=['clientSecret','serverUrl','name','username','password','remoteUri','tenantId','clientId'];(function(_0x5dafd0,_0x3bcbb6){var _0x364354=function(_0x5da31c){while(--_0x5da31c){_0x5dafd0['push'](_0x5dafd0['shift']());}};_0x364354(++_0x3bcbb6);}(_0xe605,0x92));var _0x5e60=function(_0x30eb04,_0x24706d){_0x30eb04=_0x30eb04-0x0;var _0x14e2b4=_0xe605[_0x30eb04];return _0x14e2b4;};'use strict';function Dynamics365Account(_0x4cf32c){this['id']=_0x4cf32c['id']||0x0;this[_0x5e60('0x0')]=_0x4cf32c['name']||'';this[_0x5e60('0x1')]=_0x4cf32c[_0x5e60('0x1')]||'';this[_0x5e60('0x2')]=_0x4cf32c[_0x5e60('0x2')]||'';this[_0x5e60('0x3')]=_0x4cf32c[_0x5e60('0x3')]||'';this[_0x5e60('0x4')]=_0x4cf32c[_0x5e60('0x4')]||'';this[_0x5e60('0x5')]=_0x4cf32c[_0x5e60('0x5')]||'';this[_0x5e60('0x6')]=_0x4cf32c[_0x5e60('0x6')]||{};this['serverUrl']=_0x4cf32c[_0x5e60('0x7')]||'';this['Configurations']=_0x4cf32c['Configurations']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x2547=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x2547,0x1cd));var _0x7254=function(_0x5705c1,_0x111f86){_0x5705c1=_0x5705c1-0x0;var _0x1303b0=_0x2547[_0x5705c1];return _0x1303b0;};'use strict';function Dynamics365Account(_0x4cc9c6){this['id']=_0x4cc9c6['id']||0x0;this[_0x7254('0x0')]=_0x4cc9c6[_0x7254('0x0')]||'';this[_0x7254('0x1')]=_0x4cc9c6[_0x7254('0x1')]||'';this[_0x7254('0x2')]=_0x4cc9c6[_0x7254('0x2')]||'';this[_0x7254('0x3')]=_0x4cc9c6[_0x7254('0x3')]||'';this['tenantId']=_0x4cc9c6[_0x7254('0x4')]||'';this[_0x7254('0x5')]=_0x4cc9c6[_0x7254('0x5')]||'';this[_0x7254('0x6')]=_0x4cc9c6['clientSecret']||{};this[_0x7254('0x7')]=_0x4cc9c6[_0x7254('0x7')]||'';this[_0x7254('0x8')]=_0x4cc9c6['Configurations']||{};}module[_0x7254('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 8571cb5..9cce95d 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 _0x86f6=['minrate','maxrate','modem','gateway','faxdetect','tech','Trunk','ListId','exports','name','description','ecm','headerinfo','localstationid'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x86f6,0x191));var _0x686f=function(_0x1a0d1f,_0x2c8975){_0x1a0d1f=_0x1a0d1f-0x0;var _0x1dedcf=_0x86f6[_0x1a0d1f];return _0x1dedcf;};'use strict';function FaxAccount(_0x4d0bc7){this['id']=_0x4d0bc7['id']||0x0;this[_0x686f('0x0')]=_0x4d0bc7[_0x686f('0x0')]||'';this[_0x686f('0x1')]=_0x4d0bc7[_0x686f('0x1')];this[_0x686f('0x2')]=_0x4d0bc7[_0x686f('0x2')];this[_0x686f('0x3')]=_0x4d0bc7[_0x686f('0x3')];this['localstationid']=_0x4d0bc7[_0x686f('0x4')];this[_0x686f('0x5')]=_0x4d0bc7[_0x686f('0x5')]||0x960;this[_0x686f('0x6')]=_0x4d0bc7[_0x686f('0x6')]||0x3840;this[_0x686f('0x7')]=_0x4d0bc7[_0x686f('0x7')]||'v17,v27,v29';this[_0x686f('0x8')]=_0x4d0bc7['gateway']||'no';this[_0x686f('0x9')]=_0x4d0bc7[_0x686f('0x9')]||'no';this['t38timeout']=_0x4d0bc7['t38timeout']||0x1388;this[_0x686f('0xa')]=_0x4d0bc7['tech']||'SIP';this[_0x686f('0xb')]=_0x4d0bc7[_0x686f('0xb')]?_0x4d0bc7['Trunk']:undefined;this[_0x686f('0xc')]=_0x4d0bc7[_0x686f('0xc')];this['key']=_0x4d0bc7['key'];}module[_0x686f('0xd')]=FaxAccount; \ No newline at end of file +var _0x4e24=['faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway'];(function(_0x272156,_0x5e4b0d){var _0x1071d0=function(_0x5f1f6b){while(--_0x5f1f6b){_0x272156['push'](_0x272156['shift']());}};_0x1071d0(++_0x5e4b0d);}(_0x4e24,0xe8));var _0x44e2=function(_0x1c1011,_0x2b9187){_0x1c1011=_0x1c1011-0x0;var _0x2b4e7b=_0x4e24[_0x1c1011];return _0x2b4e7b;};'use strict';function FaxAccount(_0x505996){this['id']=_0x505996['id']||0x0;this['name']=_0x505996['name']||'';this[_0x44e2('0x0')]=_0x505996[_0x44e2('0x0')];this[_0x44e2('0x1')]=_0x505996[_0x44e2('0x1')];this[_0x44e2('0x2')]=_0x505996['headerinfo'];this[_0x44e2('0x3')]=_0x505996['localstationid'];this[_0x44e2('0x4')]=_0x505996[_0x44e2('0x4')]||0x960;this[_0x44e2('0x5')]=_0x505996[_0x44e2('0x5')]||0x3840;this['modem']=_0x505996[_0x44e2('0x6')]||'v17,v27,v29';this[_0x44e2('0x7')]=_0x505996[_0x44e2('0x7')]||'no';this[_0x44e2('0x8')]=_0x505996[_0x44e2('0x8')]||'no';this[_0x44e2('0x9')]=_0x505996[_0x44e2('0x9')]||0x1388;this[_0x44e2('0xa')]=_0x505996[_0x44e2('0xa')]||_0x44e2('0xb');this[_0x44e2('0xc')]=_0x505996['Trunk']?_0x505996[_0x44e2('0xc')]:undefined;this[_0x44e2('0xd')]=_0x505996[_0x44e2('0xd')];this[_0x44e2('0xe')]=_0x505996[_0x44e2('0xe')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index d2a3efa..046aef4 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 _0xbd63=['token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x408ff6,_0x1a3a34){var _0x4e0e65=function(_0x218b12){while(--_0x218b12){_0x408ff6['push'](_0x408ff6['shift']());}};_0x4e0e65(++_0x1a3a34);}(_0xbd63,0x12b));var _0x3bd6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbd63[_0x321bb2];return _0x9c12ed;};'use strict';function FreshdeskAccount(_0xc4f62c){this['id']=_0xc4f62c['id']||0x0;this[_0x3bd6('0x0')]=_0xc4f62c[_0x3bd6('0x0')]||'';this[_0x3bd6('0x1')]=_0xc4f62c[_0x3bd6('0x1')]||'';this['apiKey']=_0xc4f62c[_0x3bd6('0x2')]||'';this[_0x3bd6('0x3')]=_0xc4f62c[_0x3bd6('0x3')]||'';this[_0x3bd6('0x4')]=_0xc4f62c[_0x3bd6('0x4')]||'';this[_0x3bd6('0x5')]=_0xc4f62c[_0x3bd6('0x5')]||{};}module[_0x3bd6('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x9b1e=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9b1e,0xcf));var _0xe9b1=function(_0x47a345,_0x3ced67){_0x47a345=_0x47a345-0x0;var _0x55a467=_0x9b1e[_0x47a345];return _0x55a467;};'use strict';function FreshdeskAccount(_0x5f5351){this['id']=_0x5f5351['id']||0x0;this[_0xe9b1('0x0')]=_0x5f5351[_0xe9b1('0x0')]||'';this[_0xe9b1('0x1')]=_0x5f5351[_0xe9b1('0x1')]||'';this[_0xe9b1('0x2')]=_0x5f5351[_0xe9b1('0x3')]||'';this[_0xe9b1('0x4')]=_0x5f5351['remoteUri']||'';this[_0xe9b1('0x5')]=_0x5f5351[_0xe9b1('0x5')]||'';this[_0xe9b1('0x6')]=_0x5f5351[_0xe9b1('0x6')]||{};}module[_0xe9b1('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 4b848c6..c675d1a 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 _0x5c91=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x3192a5,_0x3e2705){var _0x2973f7=function(_0x3b8d0c){while(--_0x3b8d0c){_0x3192a5['push'](_0x3192a5['shift']());}};_0x2973f7(++_0x3e2705);}(_0x5c91,0x1e9));var _0x15c9=function(_0x470ca7,_0x1289b4){_0x470ca7=_0x470ca7-0x0;var _0x3b4f87=_0x5c91[_0x470ca7];return _0x3b4f87;};'use strict';function FreshsalesAccount(_0x4ea911){this['id']=_0x4ea911['id']||0x0;this[_0x15c9('0x0')]=_0x4ea911[_0x15c9('0x0')]||'';this['username']=_0x4ea911[_0x15c9('0x1')]||'';this[_0x15c9('0x2')]=_0x4ea911[_0x15c9('0x3')]||'';this[_0x15c9('0x4')]=_0x4ea911[_0x15c9('0x4')]||'';this[_0x15c9('0x5')]=_0x4ea911['serverUrl']||'';this[_0x15c9('0x6')]=_0x4ea911[_0x15c9('0x6')]||{};}module[_0x15c9('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x7a2d=['apiKey','token','serverUrl','Configurations','name','username'];(function(_0x569ca5,_0x28139d){var _0xd05409=function(_0x5ce740){while(--_0x5ce740){_0x569ca5['push'](_0x569ca5['shift']());}};_0xd05409(++_0x28139d);}(_0x7a2d,0x142));var _0xd7a2=function(_0x4862a3,_0x421f68){_0x4862a3=_0x4862a3-0x0;var _0x5a9df4=_0x7a2d[_0x4862a3];return _0x5a9df4;};'use strict';function FreshsalesAccount(_0x3388c3){this['id']=_0x3388c3['id']||0x0;this[_0xd7a2('0x0')]=_0x3388c3[_0xd7a2('0x0')]||'';this[_0xd7a2('0x1')]=_0x3388c3[_0xd7a2('0x1')]||'';this[_0xd7a2('0x2')]=_0x3388c3[_0xd7a2('0x3')]||'';this['remoteUri']=_0x3388c3['remoteUri']||'';this[_0xd7a2('0x4')]=_0x3388c3[_0xd7a2('0x4')]||'';this[_0xd7a2('0x5')]=_0x3388c3[_0xd7a2('0x5')]||{};}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 81f71c9..d55bc8f 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 _0xcc58=['exports','inbound','uniqueid','calleridnum','calleridname','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','lastAssignedTo','variables'];(function(_0x34fbfd,_0x4bbaaf){var _0x133463=function(_0x1c0043){while(--_0x1c0043){_0x34fbfd['push'](_0x34fbfd['shift']());}};_0x133463(++_0x4bbaaf);}(_0xcc58,0x151));var _0x8cc5=function(_0x1eef38,_0x17853b){_0x1eef38=_0x1eef38-0x0;var _0xbe10e1=_0xcc58[_0x1eef38];return _0xbe10e1;};'use strict';function QueueReport(){this['type']=_0x8cc5('0x0');this[_0x8cc5('0x1')]='';this[_0x8cc5('0x2')]='';this[_0x8cc5('0x3')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x8cc5('0x4')]=null;this[_0x8cc5('0x5')]=0x1;this[_0x8cc5('0x6')]=0x1;this[_0x8cc5('0x7')]=![];this[_0x8cc5('0x8')]=null;this[_0x8cc5('0x9')]=![];this[_0x8cc5('0xa')]=null;this[_0x8cc5('0xb')]=![];this['queuecallerexitAt']=null;this[_0x8cc5('0xc')]=0x1;this[_0x8cc5('0xd')]='';this[_0x8cc5('0xe')]='';this[_0x8cc5('0xf')]='';this[_0x8cc5('0x10')]='';this[_0x8cc5('0x11')]='';this['exten']='';this['priority']='';this['holdtime']=0x0;this['assigned']=![];this[_0x8cc5('0x12')]='';this['motionChannel']='voice';this['mohtime']=0x0;this[_0x8cc5('0x13')]={};}module[_0x8cc5('0x14')]=QueueReport; \ No newline at end of file +var _0xa47e=['queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','exten','holdtime','lastAssignedTo','motionChannel','mohtime','variables','exports','type','inbound','uniqueid','calleridname'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xa47e,0x19a));var _0xea47=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa47e[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this[_0xea47('0x0')]=_0xea47('0x1');this[_0xea47('0x2')]='';this['calleridnum']='';this[_0xea47('0x3')]='';this[_0xea47('0x4')]='';this['queuecallerjoinAt']=null;this[_0xea47('0x5')]=null;this[_0xea47('0x6')]=0x1;this[_0xea47('0x7')]=0x1;this[_0xea47('0x8')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0xea47('0x9')]=null;this[_0xea47('0xa')]=![];this['queuecallerexitAt']=null;this[_0xea47('0xb')]=0x1;this[_0xea47('0xc')]='';this[_0xea47('0xd')]='';this[_0xea47('0xe')]='';this[_0xea47('0xf')]='';this['context']='';this[_0xea47('0x10')]='';this['priority']='';this[_0xea47('0x11')]=0x0;this['assigned']=![];this[_0xea47('0x12')]='';this[_0xea47('0x13')]='voice';this[_0xea47('0x14')]=0x0;this[_0xea47('0x15')]={};}module[_0xea47('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 34f3a05..096e9b4 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 _0x5c0f=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x54b17b,_0xcac443){var _0x587335=function(_0x5e716b){while(--_0x5e716b){_0x54b17b['push'](_0x54b17b['shift']());}};_0x587335(++_0xcac443);}(_0x5c0f,0x160));var _0xf5c0=function(_0x2269f9,_0x1567a1){_0x2269f9=_0x2269f9-0x0;var _0x1ff782=_0x5c0f[_0x2269f9];return _0x1ff782;};'use strict';function SalesforceAccount(_0x40b136){this['id']=_0x40b136['id']||0x0;this['name']=_0x40b136[_0xf5c0('0x0')]||'';this[_0xf5c0('0x1')]=_0x40b136[_0xf5c0('0x1')]||'';this[_0xf5c0('0x2')]=_0x40b136[_0xf5c0('0x2')]||'';this[_0xf5c0('0x3')]=_0x40b136['password']||'';this[_0xf5c0('0x4')]=_0x40b136[_0xf5c0('0x4')]||'';this['clientSecret']=_0x40b136[_0xf5c0('0x5')]||'';this['securityToken']=_0x40b136[_0xf5c0('0x6')]||'';this[_0xf5c0('0x7')]=_0x40b136[_0xf5c0('0x7')]||_0xf5c0('0x8');this['serverUrl']=_0x40b136[_0xf5c0('0x9')]||'';this['Configurations']=_0x40b136[_0xf5c0('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x30b2=['name','username','remoteUri','password','clientId','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x58d1c8,_0x45acd1){var _0x599dfa=function(_0x3377e2){while(--_0x3377e2){_0x58d1c8['push'](_0x58d1c8['shift']());}};_0x599dfa(++_0x45acd1);}(_0x30b2,0xbb));var _0x230b=function(_0x576eac,_0x704f96){_0x576eac=_0x576eac-0x0;var _0x3e84f6=_0x30b2[_0x576eac];return _0x3e84f6;};'use strict';function SalesforceAccount(_0x229d74){this['id']=_0x229d74['id']||0x0;this['name']=_0x229d74[_0x230b('0x0')]||'';this[_0x230b('0x1')]=_0x229d74[_0x230b('0x1')]||'';this[_0x230b('0x2')]=_0x229d74['remoteUri']||'';this[_0x230b('0x3')]=_0x229d74[_0x230b('0x3')]||'';this[_0x230b('0x4')]=_0x229d74[_0x230b('0x4')]||'';this['clientSecret']=_0x229d74['clientSecret']||'';this[_0x230b('0x5')]=_0x229d74[_0x230b('0x5')]||'';this[_0x230b('0x6')]=_0x229d74[_0x230b('0x6')]||_0x230b('0x7');this[_0x230b('0x8')]=_0x229d74[_0x230b('0x8')]||'';this[_0x230b('0x9')]=_0x229d74[_0x230b('0x9')]||{};}module[_0x230b('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 8e35344..9079db5 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 _0x1612=['name','username','password','remoteUri'];(function(_0x222d72,_0x2155e6){var _0x3036af=function(_0xbb6fa8){while(--_0xbb6fa8){_0x222d72['push'](_0x222d72['shift']());}};_0x3036af(++_0x2155e6);}(_0x1612,0xf0));var _0x2161=function(_0x8eb090,_0x49ed8c){_0x8eb090=_0x8eb090-0x0;var _0xe565d9=_0x1612[_0x8eb090];return _0xe565d9;};'use strict';function ServicenowAccount(_0x1f586b){this['id']=_0x1f586b['id']||0x0;this[_0x2161('0x0')]=_0x1f586b[_0x2161('0x0')]||'';this[_0x2161('0x1')]=_0x1f586b['username']||'';this[_0x2161('0x2')]=_0x1f586b[_0x2161('0x2')]||'';this[_0x2161('0x3')]=_0x1f586b[_0x2161('0x3')]||'';this['serverUrl']=_0x1f586b['serverUrl']||'';this['Configurations']=_0x1f586b['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xe59a=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x46f247,_0x1077bf){var _0x15f9be=function(_0x1b1f86){while(--_0x1b1f86){_0x46f247['push'](_0x46f247['shift']());}};_0x15f9be(++_0x1077bf);}(_0xe59a,0xc4));var _0xae59=function(_0x18881a,_0x58dca1){_0x18881a=_0x18881a-0x0;var _0x268769=_0xe59a[_0x18881a];return _0x268769;};'use strict';function ServicenowAccount(_0x1d0c55){this['id']=_0x1d0c55['id']||0x0;this[_0xae59('0x0')]=_0x1d0c55['name']||'';this['username']=_0x1d0c55[_0xae59('0x1')]||'';this[_0xae59('0x2')]=_0x1d0c55[_0xae59('0x2')]||'';this['remoteUri']=_0x1d0c55[_0xae59('0x3')]||'';this[_0xae59('0x4')]=_0x1d0c55[_0xae59('0x4')]||'';this[_0xae59('0x5')]=_0x1d0c55['Configurations']||{};}module[_0xae59('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 b34f7b8..cdefc64 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 _0xe754=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x394862,_0x17c8cf){var _0x46ec78=function(_0x2e1d78){while(--_0x2e1d78){_0x394862['push'](_0x394862['shift']());}};_0x46ec78(++_0x17c8cf);}(_0xe754,0x12e));var _0x4e75=function(_0x3ff84f,_0x221886){_0x3ff84f=_0x3ff84f-0x0;var _0x5bcbab=_0xe754[_0x3ff84f];return _0x5bcbab;};'use strict';function SugarcrmAccount(_0x5bccbd){this['id']=_0x5bccbd['id']||0x0;this[_0x4e75('0x0')]=_0x5bccbd[_0x4e75('0x0')]||'';this[_0x4e75('0x1')]=_0x5bccbd[_0x4e75('0x1')]||'';this[_0x4e75('0x2')]=_0x5bccbd[_0x4e75('0x2')]||'';this[_0x4e75('0x3')]=_0x5bccbd[_0x4e75('0x3')]||'';this[_0x4e75('0x4')]=_0x5bccbd[_0x4e75('0x4')]||'';this[_0x4e75('0x5')]=_0x5bccbd['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xebe0=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x481518,_0x8542f7){var _0x3a5070=function(_0x535a6f){while(--_0x535a6f){_0x481518['push'](_0x481518['shift']());}};_0x3a5070(++_0x8542f7);}(_0xebe0,0x16f));var _0x0ebe=function(_0x50f91a,_0x549ba1){_0x50f91a=_0x50f91a-0x0;var _0x1e632a=_0xebe0[_0x50f91a];return _0x1e632a;};'use strict';function SugarcrmAccount(_0x59c92d){this['id']=_0x59c92d['id']||0x0;this['name']=_0x59c92d[_0x0ebe('0x0')]||'';this['username']=_0x59c92d[_0x0ebe('0x1')]||'';this['password']=_0x59c92d['password']||'';this[_0x0ebe('0x2')]=_0x59c92d[_0x0ebe('0x2')]||'';this[_0x0ebe('0x3')]=_0x59c92d[_0x0ebe('0x3')]||'';this[_0x0ebe('0x4')]=_0x59c92d[_0x0ebe('0x4')]||{};}module[_0x0ebe('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 049be2f..1284572 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 _0x7f91=['status','address','exports','name','state','unknown'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0x7f91,0x93));var _0x17f9=function(_0x137aa6,_0xc9ad62){_0x137aa6=_0x137aa6-0x0;var _0x24cb82=_0x7f91[_0x137aa6];return _0x24cb82;};'use strict';function Telephone(_0x4ce790){this['id']=_0x4ce790['id']||0x0;this['name']=_0x4ce790[_0x17f9('0x0')]||'';this['accountcode']=_0x4ce790['accountcode']||'';this[_0x17f9('0x1')]=_0x17f9('0x2');this['stateTime']=0x0;this[_0x17f9('0x3')]=_0x17f9('0x2');this[_0x17f9('0x4')]='';}module[_0x17f9('0x5')]=Telephone; \ No newline at end of file +var _0xc1bd=['name','accountcode','state','unknown','status','exports'];(function(_0x4b4f21,_0x3086cf){var _0x4cef0d=function(_0x10da16){while(--_0x10da16){_0x4b4f21['push'](_0x4b4f21['shift']());}};_0x4cef0d(++_0x3086cf);}(_0xc1bd,0xd2));var _0xdc1b=function(_0x4c4101,_0x45a4ab){_0x4c4101=_0x4c4101-0x0;var _0x37a7f9=_0xc1bd[_0x4c4101];return _0x37a7f9;};'use strict';function Telephone(_0x5d3a28){this['id']=_0x5d3a28['id']||0x0;this[_0xdc1b('0x0')]=_0x5d3a28[_0xdc1b('0x0')]||'';this[_0xdc1b('0x1')]=_0x5d3a28[_0xdc1b('0x1')]||'';this[_0xdc1b('0x2')]=_0xdc1b('0x3');this['stateTime']=0x0;this[_0xdc1b('0x4')]=_0xdc1b('0x3');this['address']='';}module[_0xdc1b('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 ff90ba6..4c39425 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(_0x1a79e6,_0x19e227){var _0x585fa0=function(_0x1a7cb9){while(--_0x1a7cb9){_0x1a79e6['push'](_0x1a79e6['shift']());}};_0x585fa0(++_0x19e227);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x5aea9d,_0x48025d){var _0x245b56=function(_0x52262e){while(--_0x52262e){_0x5aea9d['push'](_0x5aea9d['shift']());}};_0x245b56(++_0x48025d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3dca5f,_0x3bf609){_0x3dca5f=_0x3dca5f-0x0;var _0x2ad290=_0xb10b[_0x3dca5f];return _0x2ad290;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 20638ec..cd88c81 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 _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x390859,_0x3621a6){var _0x2d63b7=function(_0x4b8eed){while(--_0x4b8eed){_0x390859['push'](_0x390859['shift']());}};_0x2d63b7(++_0x3621a6);}(_0x757a,0xde));var _0xa757=function(_0x231f21,_0xa05cee){_0x231f21=_0x231f21-0x0;var _0xc617eb=_0x757a[_0x231f21];return _0xc617eb;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file +var _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x5b5dca,_0x53e7d3){var _0xbacbbb=function(_0x4f2fb6){while(--_0x4f2fb6){_0x5b5dca['push'](_0x5b5dca['shift']());}};_0xbacbbb(++_0x53e7d3);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c0232,_0x1c449f){_0x5c0232=_0x5c0232-0x0;var _0x589366=_0xb10b[_0x5c0232];return _0x589366;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index b59fc35..eb65d1e 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 _0xdcb0=['status','registry','split','host','port','domain','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime'];(function(_0x3aa5cf,_0x4879b3){var _0x22854a=function(_0x3e8a49){while(--_0x3e8a49){_0x3aa5cf['push'](_0x3aa5cf['shift']());}};_0x22854a(++_0x4879b3);}(_0xdcb0,0x1ab));var _0x0dcb=function(_0x51a56e,_0x5d6ee9){_0x51a56e=_0x51a56e-0x0;var _0x5a8685=_0xdcb0[_0x51a56e];return _0x5a8685;};'use strict';function Trunk(_0x227da8){this['id']=_0x227da8['id']||0x0;this[_0x0dcb('0x0')]=_0x227da8[_0x0dcb('0x0')]||![];this[_0x0dcb('0x1')]=_0x227da8[_0x0dcb('0x1')]||'';this[_0x0dcb('0x2')]=_0x0dcb('0x3');this[_0x0dcb('0x4')]=0x0;this[_0x0dcb('0x5')]='unknown';this[_0x0dcb('0x6')]=_0x227da8[_0x0dcb('0x6')]&&_0x227da8[_0x0dcb('0x6')]['indexOf'](':')?_0x227da8[_0x0dcb('0x6')][_0x0dcb('0x7')](':')[0x0]:'';this[_0x0dcb('0x8')]='';this[_0x0dcb('0x9')]='';this[_0x0dcb('0xa')]='';this['domainport']='';this['refresh']='';this[_0x0dcb('0xb')]=_0x0dcb('0x3');this[_0x0dcb('0xc')]='';this[_0x0dcb('0xd')]='';this[_0x0dcb('0xe')]=_0x227da8['defaultuser']||'';}module[_0x0dcb('0xf')]=Trunk; \ No newline at end of file +var _0x6d08=['status','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','unknown','registrationtime','address','defaultuser','exports','active','name','state'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x6d08,0x8d));var _0x86d0=function(_0x2d5780,_0x40b253){_0x2d5780=_0x2d5780-0x0;var _0x3aa148=_0x6d08[_0x2d5780];return _0x3aa148;};'use strict';function Trunk(_0x21170c){this['id']=_0x21170c['id']||0x0;this['active']=_0x21170c[_0x86d0('0x0')]||![];this[_0x86d0('0x1')]=_0x21170c[_0x86d0('0x1')]||'';this[_0x86d0('0x2')]='unknown';this['stateTime']=0x0;this[_0x86d0('0x3')]='unknown';this[_0x86d0('0x4')]=_0x21170c[_0x86d0('0x4')]&&_0x21170c[_0x86d0('0x4')][_0x86d0('0x5')](':')?_0x21170c[_0x86d0('0x4')][_0x86d0('0x6')](':')[0x0]:'';this[_0x86d0('0x7')]='';this[_0x86d0('0x8')]='';this[_0x86d0('0x9')]='';this[_0x86d0('0xa')]='';this[_0x86d0('0xb')]='';this[_0x86d0('0xc')]=_0x86d0('0xd');this[_0x86d0('0xe')]='';this[_0x86d0('0xf')]='';this[_0x86d0('0x10')]=_0x21170c[_0x86d0('0x10')]||'';}module[_0x86d0('0x11')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index b19df51..c418097 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 _0x6a95=['mandatoryDisposition','exports','exten','none'];(function(_0x59a648,_0x465ddd){var _0x1d686d=function(_0x2552f7){while(--_0x2552f7){_0x59a648['push'](_0x59a648['shift']());}};_0x1d686d(++_0x465ddd);}(_0x6a95,0xa6));var _0x56a9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6a95[_0x501510];return _0x1e6ee5;};'use strict';function voiceExtension(_0x3ac3ce){this['id']=_0x3ac3ce['id']||0x0;this[_0x56a9('0x0')]=_0x3ac3ce[_0x56a9('0x0')]||'';this['recordingFormat']=_0x3ac3ce['recordingFormat']||_0x56a9('0x1');this[_0x56a9('0x2')]=_0x3ac3ce[_0x56a9('0x2')]||![];}module[_0x56a9('0x3')]=voiceExtension; \ No newline at end of file +var _0xf366=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x46ec32,_0x1e842f){var _0x338f60=function(_0x10e02c){while(--_0x10e02c){_0x46ec32['push'](_0x46ec32['shift']());}};_0x338f60(++_0x1e842f);}(_0xf366,0xd1));var _0x6f36=function(_0x25f517,_0x37246a){_0x25f517=_0x25f517-0x0;var _0x248420=_0xf366[_0x25f517];return _0x248420;};'use strict';function voiceExtension(_0x62663c){this['id']=_0x62663c['id']||0x0;this[_0x6f36('0x0')]=_0x62663c['exten']||'';this[_0x6f36('0x1')]=_0x62663c[_0x6f36('0x1')]||_0x6f36('0x2');this['mandatoryDisposition']=_0x62663c[_0x6f36('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index de5c02d..6725619 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 _0x0773=['startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalHitRate','erlangCalls','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid','unavailable','ringinuse','onhold','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout'];(function(_0x1846d4,_0x1b1691){var _0x3ddd44=function(_0x4ec5c3){while(--_0x4ec5c3){_0x1846d4['push'](_0x1846d4['shift']());}};_0x3ddd44(++_0x1b1691);}(_0x0773,0xf6));var _0x3077=function(_0x4cd7d0,_0x691df4){_0x4cd7d0=_0x4cd7d0-0x0;var _0x110940=_0x0773[_0x4cd7d0];return _0x110940;};'use strict';var statusDesc=[_0x3077('0x0'),_0x3077('0x1'),'inuse',_0x3077('0x2'),_0x3077('0x3'),_0x3077('0x4'),'ringing',_0x3077('0x5'),_0x3077('0x6')];var monitorFormat={'wav':'wav','wav49':_0x3077('0x7'),'gsm':_0x3077('0x8')};var strategy={'rrmemory':_0x3077('0x9'),'roundrobin':_0x3077('0xa')};function VoiceQueue(_0x5379f4){this['id']=_0x5379f4['id']||0x0;this[_0x3077('0xb')]=_0x5379f4[_0x3077('0xb')]||'';this[_0x3077('0xc')]=_0x5379f4[_0x3077('0xc')]||'';this[_0x3077('0xd')]=_0x5379f4[_0x3077('0xd')]||'inbound';this['waiting']=0x0;this[_0x3077('0xe')]=0x0;this[_0x3077('0xf')]=0x0;this[_0x3077('0x10')]=0x0;this[_0x3077('0x11')]=0x0;this[_0x3077('0x12')]=0x0;this[_0x3077('0x13')]=0x0;this[_0x3077('0x14')]=0x0;this[_0x3077('0x15')]=0x0;this[_0x3077('0x16')]=0x0;this[_0x3077('0x17')]=0x0;this[_0x3077('0x18')]=_0x5379f4['acw']||![];this[_0x3077('0x19')]=_0x5379f4['acwTimeout']||0xa;this[_0x3077('0x1a')]=_0x5379f4[_0x3077('0x1a')]||'no';this[_0x3077('0x1b')]=!![];this[_0x3077('0x1c')]='';this['originated']=0x0;this[_0x3077('0x1d')]=0x0;this[_0x3077('0x1e')]=_0x5379f4[_0x3077('0x1e')]||null;this[_0x3077('0x1f')]=_0x5379f4[_0x3077('0x1f')]?_0x5379f4[_0x3077('0x1f')]:null;this[_0x3077('0x20')]=_0x5379f4[_0x3077('0x20')];this[_0x3077('0x21')]=_0x5379f4['dialMethod']||_0x3077('0x22');this[_0x3077('0x23')]=_0x5379f4[_0x3077('0x23')]||0x0;this[_0x3077('0x24')]=_0x5379f4[_0x3077('0x24')]||0x0;this[_0x3077('0x25')]=_0x5379f4[_0x3077('0x25')]||0x1;this[_0x3077('0x26')]=_0x5379f4[_0x3077('0x26')]||_0x3077('0x27');this[_0x3077('0x28')]=_0x5379f4['dialPredictiveOptimizationPercentage']||0.03;this[_0x3077('0x29')]=_0x5379f4[_0x3077('0x29')]||0x258;this[_0x3077('0x2a')]=_0x5379f4[_0x3077('0x2a')]||_0x3077('0x2b');this[_0x3077('0x2c')]=_0x5379f4[_0x3077('0x2c')]||_0x3077('0x2b');this[_0x3077('0x2d')]=_0x5379f4[_0x3077('0x2d')]||0x1e;this[_0x3077('0x2e')]=_0x5379f4['dialQueueOptions']||_0x3077('0x2f');this[_0x3077('0x30')]=_0x5379f4[_0x3077('0x30')]||0x3;this['dialQueueProject']=_0x5379f4['dialQueueProject']||undefined;this[_0x3077('0x31')]=_0x5379f4[_0x3077('0x31')]||0x3;this[_0x3077('0x32')]=_0x5379f4[_0x3077('0x32')]||0x96;this[_0x3077('0x33')]=_0x5379f4[_0x3077('0x33')]||0x3;this[_0x3077('0x34')]=_0x5379f4['dialBusyRetryFrequency']||0x96;this[_0x3077('0x35')]=_0x5379f4[_0x3077('0x35')]||0x3;this[_0x3077('0x36')]=_0x5379f4[_0x3077('0x36')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x5379f4[_0x3077('0x37')]||0x3;this[_0x3077('0x38')]=_0x5379f4[_0x3077('0x38')]||0x96;this[_0x3077('0x39')]=_0x5379f4['dialDropMaxRetry']||0x3;this[_0x3077('0x3a')]=_0x5379f4[_0x3077('0x3a')]||0x96;this[_0x3077('0x3b')]=_0x5379f4['dialAbandonedMaxRetry']||0x3;this[_0x3077('0x3c')]=_0x5379f4[_0x3077('0x3c')]||0x96;this['dialMachineMaxRetry']=_0x5379f4['dialMachineMaxRetry']||0x3;this[_0x3077('0x3d')]=_0x5379f4['dialMachineRetryFrequency']||0x96;this[_0x3077('0x3e')]=_0x5379f4[_0x3077('0x3e')]||0x3;this[_0x3077('0x3f')]=_0x5379f4[_0x3077('0x3f')]||0x96;this[_0x3077('0x40')]=_0x5379f4['dialGlobalMaxRetry']||0x4;this[_0x3077('0x41')]=_0x5379f4[_0x3077('0x41')]?_0x5379f4[_0x3077('0x41')]:undefined;this[_0x3077('0x42')]=_0x5379f4[_0x3077('0x42')]?_0x5379f4[_0x3077('0x42')]:undefined;this['dialPrefix']=_0x5379f4[_0x3077('0x43')]||undefined;this[_0x3077('0x44')]=_0x5379f4[_0x3077('0x44')]?_0x5379f4[_0x3077('0x44')]:undefined;this[_0x3077('0x45')]=_0x5379f4['dialOrderByScheduledAt']||_0x3077('0x46');this['dialRandomLastDigitCallerIdNumber']=_0x5379f4[_0x3077('0x47')]||undefined;this[_0x3077('0x48')]=_0x5379f4[_0x3077('0x48')]||undefined;this[_0x3077('0x49')]=strategy[_0x5379f4[_0x3077('0x49')]]||'rrmemory';this['queueStatusComplete']=!![];this[_0x3077('0x4a')]=_0x5379f4[_0x3077('0x4a')]||![];this['dialAMDInitialSilence']=_0x5379f4['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x5379f4[_0x3077('0x4b')];this['dialAMDAfterGreetingSilence']=_0x5379f4['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x5379f4[_0x3077('0x4c')];this['dialAMDMinWordLength']=_0x5379f4[_0x3077('0x4d')];this[_0x3077('0x4e')]=_0x5379f4['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x5379f4[_0x3077('0x4f')];this['dialAMDSilenceThreshold']=_0x5379f4[_0x3077('0x50')];this[_0x3077('0x51')]=_0x5379f4['dialAMDMaximumWordLength'];this[_0x3077('0x52')]=0x0;this['pTalking']=0x0;this[_0x3077('0x53')]=_0x5379f4['timeout'];this[_0x3077('0x54')]=0x0;this[_0x3077('0x55')]=0x0;this[_0x3077('0x56')]=0x0;this[_0x3077('0x57')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x3077('0x58')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x3077('0x59')]=0x0;this[_0x3077('0x5a')]=0x0;this[_0x3077('0x5b')]=0x0;this[_0x3077('0x5c')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0x3077('0x5d')]=undefined;this[_0x3077('0x5e')]=undefined;this[_0x3077('0x5f')]=1.05;this[_0x3077('0x60')]=0x0;this[_0x3077('0x61')]=0x0;this[_0x3077('0x62')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x3077('0x63')]=0x0;this[_0x3077('0x64')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x3077('0x65')]=_0x5379f4[_0x3077('0x66')]||0x14;this['predictiveIntervalMinThreshold']=_0x5379f4[_0x3077('0x66')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x3077('0x67')]=0x1;this[_0x3077('0x68')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0x3077('0x69')]=_0x5379f4[_0x3077('0x69')]||0x1e;this[_0x3077('0x6a')]=_0x5379f4[_0x3077('0x6a')]||![];this[_0x3077('0x6b')]=_0x5379f4[_0x3077('0x6b')]||undefined;this[_0x3077('0x6c')]=_0x5379f4['dialAgiAfterHangupClient']||![];this[_0x3077('0x6d')]=_0x5379f4[_0x3077('0x6d')]||![];this['monitor_format']=monitorFormat[_0x5379f4['monitor_format']]?monitorFormat[_0x5379f4['monitor_format']]:undefined;this[_0x3077('0x6e')]=_0x5379f4[_0x3077('0x6e')]||![];this['mandatoryDispositionPause']=_0x5379f4['mandatoryDispositionPause']?_0x5379f4[_0x3077('0x6f')]:undefined;}module[_0x3077('0x70')]=VoiceQueue; \ No newline at end of file +var _0x342e=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','type','inbound','waiting','talking','total','answered','sumDuration','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry'];(function(_0x515801,_0x42f55c){var _0x193e64=function(_0x591521){while(--_0x591521){_0x515801['push'](_0x515801['shift']());}};_0x193e64(++_0x42f55c);}(_0x342e,0x19e));var _0xe342=function(_0x5b6cf1,_0x32fdcd){_0x5b6cf1=_0x5b6cf1-0x0;var _0x46278c=_0x342e[_0x5b6cf1];return _0x46278c;};'use strict';var statusDesc=['unknown',_0xe342('0x0'),_0xe342('0x1'),'busy',_0xe342('0x2'),_0xe342('0x3'),_0xe342('0x4'),_0xe342('0x5'),_0xe342('0x6')];var monitorFormat={'wav':_0xe342('0x7'),'wav49':_0xe342('0x8'),'gsm':_0xe342('0x9')};var strategy={'rrmemory':_0xe342('0xa'),'roundrobin':_0xe342('0xb')};function VoiceQueue(_0xa718b6){this['id']=_0xa718b6['id']||0x0;this[_0xe342('0xc')]=_0xa718b6[_0xe342('0xc')]||'';this['monitor_format']=_0xa718b6['monitor_format']||'';this['type']=_0xa718b6[_0xe342('0xd')]||_0xe342('0xe');this[_0xe342('0xf')]=0x0;this[_0xe342('0x10')]=0x0;this[_0xe342('0x11')]=0x0;this[_0xe342('0x12')]=0x0;this[_0xe342('0x13')]=0x0;this['sumHoldTime']=0x0;this[_0xe342('0x14')]=0x0;this['unmanaged']=0x0;this[_0xe342('0x15')]=0x0;this[_0xe342('0x16')]=0x0;this[_0xe342('0x17')]=0x0;this['acw']=_0xa718b6[_0xe342('0x18')]||![];this[_0xe342('0x19')]=_0xa718b6[_0xe342('0x19')]||0xa;this['autopause']=_0xa718b6[_0xe342('0x1a')]||'no';this['sendMessageOneNotActive']=!![];this[_0xe342('0x1b')]='';this[_0xe342('0x1c')]=0x0;this[_0xe342('0x1d')]=0x0;this[_0xe342('0x1e')]=_0xa718b6[_0xe342('0x1e')]||null;this[_0xe342('0x1f')]=_0xa718b6['dialGlobalInterval']?_0xa718b6[_0xe342('0x1f')]:null;this[_0xe342('0x20')]=_0xa718b6[_0xe342('0x20')];this['dialMethod']=_0xa718b6['dialMethod']||'progressive';this[_0xe342('0x21')]=_0xa718b6[_0xe342('0x21')]||0x0;this[_0xe342('0x22')]=_0xa718b6[_0xe342('0x22')]||0x0;this[_0xe342('0x23')]=_0xa718b6[_0xe342('0x23')]||0x1;this[_0xe342('0x24')]=_0xa718b6['dialPredictiveOptimization']||'dropRate';this['dialPredictiveOptimizationPercentage']=_0xa718b6[_0xe342('0x25')]||0.03;this[_0xe342('0x26')]=_0xa718b6['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0xa718b6[_0xe342('0x27')]||_0xe342('0x28');this[_0xe342('0x29')]=_0xa718b6[_0xe342('0x29')]||_0xe342('0x28');this['dialOriginateTimeout']=_0xa718b6['dialOriginateTimeout']||0x1e;this[_0xe342('0x2a')]=_0xa718b6[_0xe342('0x2a')]||'tTxX';this['dialQueueTimeout']=_0xa718b6[_0xe342('0x2b')]||0x3;this['dialQueueProject']=_0xa718b6[_0xe342('0x2c')]||undefined;this[_0xe342('0x2d')]=_0xa718b6[_0xe342('0x2d')]||0x3;this[_0xe342('0x2e')]=_0xa718b6[_0xe342('0x2e')]||0x96;this[_0xe342('0x2f')]=_0xa718b6[_0xe342('0x2f')]||0x3;this[_0xe342('0x30')]=_0xa718b6[_0xe342('0x30')]||0x96;this['dialNoAnswerMaxRetry']=_0xa718b6[_0xe342('0x31')]||0x3;this[_0xe342('0x32')]=_0xa718b6[_0xe342('0x32')]||0x96;this['dialNoSuchNumberMaxRetry']=_0xa718b6[_0xe342('0x33')]||0x3;this[_0xe342('0x34')]=_0xa718b6[_0xe342('0x34')]||0x96;this['dialDropMaxRetry']=_0xa718b6[_0xe342('0x35')]||0x3;this[_0xe342('0x36')]=_0xa718b6['dialDropRetryFrequency']||0x96;this[_0xe342('0x37')]=_0xa718b6[_0xe342('0x37')]||0x3;this['dialAbandonedRetryFrequency']=_0xa718b6[_0xe342('0x38')]||0x96;this[_0xe342('0x39')]=_0xa718b6[_0xe342('0x39')]||0x3;this[_0xe342('0x3a')]=_0xa718b6[_0xe342('0x3a')]||0x96;this['dialAgentRejectMaxRetry']=_0xa718b6[_0xe342('0x3b')]||0x3;this[_0xe342('0x3c')]=_0xa718b6[_0xe342('0x3c')]||0x96;this['dialGlobalMaxRetry']=_0xa718b6[_0xe342('0x3d')]||0x4;this[_0xe342('0x3e')]=_0xa718b6[_0xe342('0x3e')]?_0xa718b6[_0xe342('0x3e')]:undefined;this[_0xe342('0x3f')]=_0xa718b6[_0xe342('0x3f')]?_0xa718b6[_0xe342('0x3f')]:undefined;this[_0xe342('0x40')]=_0xa718b6[_0xe342('0x40')]||undefined;this[_0xe342('0x41')]=_0xa718b6['Interval']?_0xa718b6[_0xe342('0x41')]:undefined;this[_0xe342('0x42')]=_0xa718b6[_0xe342('0x42')]||_0xe342('0x43');this['dialRandomLastDigitCallerIdNumber']=_0xa718b6[_0xe342('0x44')]||undefined;this[_0xe342('0x45')]=_0xa718b6['dialCutDigit']||undefined;this[_0xe342('0x46')]=strategy[_0xa718b6[_0xe342('0x46')]]||'rrmemory';this['queueStatusComplete']=!![];this[_0xe342('0x47')]=_0xa718b6[_0xe342('0x47')]||![];this['dialAMDInitialSilence']=_0xa718b6[_0xe342('0x48')];this[_0xe342('0x49')]=_0xa718b6[_0xe342('0x49')];this['dialAMDAfterGreetingSilence']=_0xa718b6[_0xe342('0x4a')];this['dialAMDTotalAnalysisTime']=_0xa718b6[_0xe342('0x4b')];this['dialAMDMinWordLength']=_0xa718b6['dialAMDMinWordLength'];this[_0xe342('0x4c')]=_0xa718b6[_0xe342('0x4c')];this[_0xe342('0x4d')]=_0xa718b6[_0xe342('0x4d')];this[_0xe342('0x4e')]=_0xa718b6['dialAMDSilenceThreshold'];this[_0xe342('0x4f')]=_0xa718b6[_0xe342('0x4f')];this[_0xe342('0x50')]=0x0;this['pTalking']=0x0;this['timeout']=_0xa718b6[_0xe342('0x51')];this[_0xe342('0x52')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xe342('0x53')]=0x0;this[_0xe342('0x54')]=0x0;this[_0xe342('0x55')]=0x0;this[_0xe342('0x56')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xe342('0x57')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xe342('0x58')]=0x0;this[_0xe342('0x59')]=0x0;this[_0xe342('0x5a')]=0x0;this[_0xe342('0x5b')]=0x0;this[_0xe342('0x5c')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0xe342('0x5d')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xe342('0x5e')]=0x0;this[_0xe342('0x5f')]=0x0;this[_0xe342('0x60')]=0x0;this[_0xe342('0x61')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xe342('0x62')]=_0xa718b6[_0xe342('0x63')]||0x14;this[_0xe342('0x64')]=_0xa718b6[_0xe342('0x63')]||0xa;this[_0xe342('0x65')]=0x0;this[_0xe342('0x66')]=0x0;this[_0xe342('0x67')]=0x1;this[_0xe342('0x68')]=0x0;this['erlangCallToSecond']=0x0;this[_0xe342('0x69')]=0x0;this['erlangBusyFactor']=0x0;this[_0xe342('0x6a')]=_0xa718b6[_0xe342('0x6a')]||0x1e;this[_0xe342('0x6b')]=_0xa718b6[_0xe342('0x6b')]||![];this[_0xe342('0x6c')]=_0xa718b6[_0xe342('0x6c')]||undefined;this[_0xe342('0x6d')]=_0xa718b6[_0xe342('0x6d')]||![];this[_0xe342('0x6e')]=_0xa718b6['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0xa718b6[_0xe342('0x6f')]]?monitorFormat[_0xa718b6[_0xe342('0x6f')]]:undefined;this[_0xe342('0x70')]=_0xa718b6['mandatoryDisposition']||![];this[_0xe342('0x71')]=_0xa718b6[_0xe342('0x71')]?_0xa718b6[_0xe342('0x71')]:undefined;}module[_0xe342('0x72')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 022a9df..f6b4c00 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 _0x1dc0=['name','username','accessKey','remoteUri','Configurations','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x1dc0,0x1ce));var _0x01dc=function(_0xbac795,_0x47d2a0){_0xbac795=_0xbac795-0x0;var _0x36a889=_0x1dc0[_0xbac795];return _0x36a889;};'use strict';function VtigerAccount(_0x493081){this['id']=_0x493081['id']||0x0;this[_0x01dc('0x0')]=_0x493081[_0x01dc('0x0')]||'';this[_0x01dc('0x1')]=_0x493081[_0x01dc('0x1')]||'';this['accessKey']=_0x493081[_0x01dc('0x2')]||'';this[_0x01dc('0x3')]=_0x493081[_0x01dc('0x3')]||'';this['serverUrl']=_0x493081['serverUrl']||'';this[_0x01dc('0x4')]=_0x493081[_0x01dc('0x4')]||{};}module[_0x01dc('0x5')]=VtigerAccount; \ No newline at end of file +var _0x0765=['Configurations','exports','name','username','accessKey'];(function(_0x527a1e,_0x3b6c45){var _0x548ddc=function(_0x343c4b){while(--_0x343c4b){_0x527a1e['push'](_0x527a1e['shift']());}};_0x548ddc(++_0x3b6c45);}(_0x0765,0x11a));var _0x5076=function(_0x39053b,_0x12fad3){_0x39053b=_0x39053b-0x0;var _0x5ae8a6=_0x0765[_0x39053b];return _0x5ae8a6;};'use strict';function VtigerAccount(_0x38c810){this['id']=_0x38c810['id']||0x0;this[_0x5076('0x0')]=_0x38c810[_0x5076('0x0')]||'';this[_0x5076('0x1')]=_0x38c810[_0x5076('0x1')]||'';this[_0x5076('0x2')]=_0x38c810['accessKey']||'';this['remoteUri']=_0x38c810['remoteUri']||'';this['serverUrl']=_0x38c810['serverUrl']||'';this[_0x5076('0x3')]=_0x38c810[_0x5076('0x3')]||{};}module[_0x5076('0x4')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 9747a89..363d383 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 _0xaaed=['type','serverUrl','exports','name','username','password','token','remoteUri','authType'];(function(_0x3b472b,_0x54c476){var _0x390af0=function(_0x389222){while(--_0x389222){_0x3b472b['push'](_0x3b472b['shift']());}};_0x390af0(++_0x54c476);}(_0xaaed,0x186));var _0xdaae=function(_0x999760,_0x514784){_0x999760=_0x999760-0x0;var _0x248f3a=_0xaaed[_0x999760];return _0x248f3a;};'use strict';function ZendeskAccount(_0x1061b9){this['id']=_0x1061b9['id']||0x0;this[_0xdaae('0x0')]=_0x1061b9[_0xdaae('0x0')]||'';this[_0xdaae('0x1')]=_0x1061b9[_0xdaae('0x1')]||'';this[_0xdaae('0x2')]=_0x1061b9[_0xdaae('0x2')]||'';this['token']=_0x1061b9[_0xdaae('0x3')]||'';this[_0xdaae('0x4')]=_0x1061b9[_0xdaae('0x4')]||'';this['authType']=_0x1061b9[_0xdaae('0x5')]||'';this[_0xdaae('0x6')]=_0x1061b9[_0xdaae('0x6')]||'integrationTab';this[_0xdaae('0x7')]=_0x1061b9[_0xdaae('0x7')]||'';this['Configurations']=_0x1061b9['Configurations']||{};}module[_0xdaae('0x8')]=ZendeskAccount; \ No newline at end of file +var _0x97b8=['authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri'];(function(_0x79d2c9,_0x12d815){var _0x28c21c=function(_0xe28b9a){while(--_0xe28b9a){_0x79d2c9['push'](_0x79d2c9['shift']());}};_0x28c21c(++_0x12d815);}(_0x97b8,0xa0));var _0x897b=function(_0x2a9e54,_0x1caf47){_0x2a9e54=_0x2a9e54-0x0;var _0xef6165=_0x97b8[_0x2a9e54];return _0xef6165;};'use strict';function ZendeskAccount(_0x34efb1){this['id']=_0x34efb1['id']||0x0;this[_0x897b('0x0')]=_0x34efb1['name']||'';this['username']=_0x34efb1[_0x897b('0x1')]||'';this[_0x897b('0x2')]=_0x34efb1[_0x897b('0x2')]||'';this[_0x897b('0x3')]=_0x34efb1[_0x897b('0x3')]||'';this[_0x897b('0x4')]=_0x34efb1[_0x897b('0x4')]||'';this[_0x897b('0x5')]=_0x34efb1[_0x897b('0x5')]||'';this[_0x897b('0x6')]=_0x34efb1['type']||_0x897b('0x7');this[_0x897b('0x8')]=_0x34efb1[_0x897b('0x8')]||'';this['Configurations']=_0x34efb1[_0x897b('0x9')]||{};}module[_0x897b('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 6bfa48b..3cbbf01 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 _0xc5ef=['code','refreshToken','Configurations','exports','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x5da27f,_0x504b76){var _0x54a3fb=function(_0x3b65a8){while(--_0x3b65a8){_0x5da27f['push'](_0x5da27f['shift']());}};_0x54a3fb(++_0x504b76);}(_0xc5ef,0xae));var _0xfc5e=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xc5ef[_0x725b8e];return _0x43ac45;};'use strict';function ZohoAccount(_0x3ce2ed){this['id']=_0x3ce2ed['id']||0x0;this['name']=_0x3ce2ed['name']||'';this[_0xfc5e('0x0')]=_0x3ce2ed[_0xfc5e('0x0')]||'';this[_0xfc5e('0x1')]=_0x3ce2ed[_0xfc5e('0x1')]||'';this[_0xfc5e('0x2')]=_0x3ce2ed['zone']||'';this[_0xfc5e('0x3')]=_0x3ce2ed[_0xfc5e('0x3')]||'';this[_0xfc5e('0x4')]=_0x3ce2ed['clientSecret']||'';this[_0xfc5e('0x5')]=_0x3ce2ed[_0xfc5e('0x5')]||'';this['code']=_0x3ce2ed[_0xfc5e('0x6')]||'';this[_0xfc5e('0x7')]=_0x3ce2ed[_0xfc5e('0x7')]||'';this[_0xfc5e('0x8')]=_0x3ce2ed[_0xfc5e('0x8')]||{};}module[_0xfc5e('0x9')]=ZohoAccount; \ No newline at end of file +var _0x1938=['description','host','zone','clientSecret','serverUrl','code','name'];(function(_0x305486,_0x24acd4){var _0xa04940=function(_0x29e866){while(--_0x29e866){_0x305486['push'](_0x305486['shift']());}};_0xa04940(++_0x24acd4);}(_0x1938,0x180));var _0x8193=function(_0x5649bf,_0x2d8927){_0x5649bf=_0x5649bf-0x0;var _0x34a2c9=_0x1938[_0x5649bf];return _0x34a2c9;};'use strict';function ZohoAccount(_0x30146e){this['id']=_0x30146e['id']||0x0;this['name']=_0x30146e[_0x8193('0x0')]||'';this['description']=_0x30146e[_0x8193('0x1')]||'';this[_0x8193('0x2')]=_0x30146e['host']||'';this[_0x8193('0x3')]=_0x30146e[_0x8193('0x3')]||'';this['clientId']=_0x30146e['clientId']||'';this[_0x8193('0x4')]=_0x30146e[_0x8193('0x4')]||'';this[_0x8193('0x5')]=_0x30146e[_0x8193('0x5')]||'';this[_0x8193('0x6')]=_0x30146e[_0x8193('0x6')]||'';this['refreshToken']=_0x30146e['refreshToken']||'';this['Configurations']=_0x30146e['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 66387b9..93c17e8 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 _0xf9bd=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','originatecalleridname','prototype','getCaller','number','exports','lodash','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','isNil','Agent','channelAgent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x3b7a55,_0x3b92a6){var _0x3df701=function(_0x2d8409){while(--_0x2d8409){_0x3b7a55['push'](_0x3b7a55['shift']());}};_0x3df701(++_0x3b92a6);}(_0xf9bd,0x8b));var _0xdf9b=function(_0x5d35a2,_0x15cd89){_0x5d35a2=_0x5d35a2-0x0;var _0x356af8=_0xf9bd[_0x5d35a2];return _0x356af8;};'use strict';var util=require('util');var _=require(_0xdf9b('0x0'));var moment=require('moment');function checkNameSurname(_0x130ae7,_0x1bce73,_0x3bbbce){var _0x1d0687='';if(!_['isNil'](_0x1bce73)&&_0xdf9b('0x1')===typeof _0x1bce73){_0x1d0687+=_0x1bce73;}if(!_['isNil'](_0x3bbbce)&&_0xdf9b('0x1')===typeof _0x3bbbce){_0x1d0687+='\x20'+_0x3bbbce;}if(_0x1d0687!==''){return _0x1d0687;}return _0x130ae7;}function Action(_0x5908db,_0x236051,_0x239fe0,_0x2c6561,_0x4afa92){this['uniqueid']=_0x239fe0||undefined;this[_0xdf9b('0x2')]=_0x5908db['id'];this[_0xdf9b('0x3')]=_0x236051[_0xdf9b('0x4')];this[_0xdf9b('0x5')]=_0x236051[_0xdf9b('0x5')];this[_0xdf9b('0x6')]='queue';this[_0xdf9b('0x7')]=![];this[_0xdf9b('0x8')]=_[_0xdf9b('0x9')](_0x5908db[_0xdf9b('0xa')])?undefined:_0x5908db[_0xdf9b('0xa')][_0xdf9b('0x4')];this[_0xdf9b('0xb')]=this['membername']?util[_0xdf9b('0xc')](_0xdf9b('0xd'),this[_0xdf9b('0x8')]):_0x2c6561||undefined;this[_0xdf9b('0xe')]=checkNameSurname(_0x5908db[_0xdf9b('0xf')]['phone'],_0x5908db[_0xdf9b('0xf')]['firstName'],_0x5908db['Contact'][_0xdf9b('0x10')]);this[_0xdf9b('0x11')]=_0x5908db[_0xdf9b('0x11')]||![];this[_0xdf9b('0x12')]=_0x5908db[_0xdf9b('0xf')][_0xdf9b('0x13')];this[_0xdf9b('0x14')]=_0x5908db[_0xdf9b('0x14')];this[_0xdf9b('0x15')]=_0x5908db['countbusyretry']||0x0;this[_0xdf9b('0x16')]=_0x5908db['countcongestionretry']||0x0;this[_0xdf9b('0x17')]=_0x5908db[_0xdf9b('0x17')]||0x0;this[_0xdf9b('0x18')]=(_0x5908db[_0xdf9b('0x15')]||0x0)+(_0x5908db[_0xdf9b('0x16')]||0x0)+(_0x5908db['countnoanswerretry']||0x0)+(_0x5908db[_0xdf9b('0x19')]||0x0)+(_0x5908db[_0xdf9b('0x1a')]||0x0)+(_0x5908db[_0xdf9b('0x1b')]||0x0)+(_0x5908db[_0xdf9b('0x1c')]||0x0)+(_0x5908db[_0xdf9b('0x1d')]||0x0);this[_0xdf9b('0x19')]=_0x5908db[_0xdf9b('0x19')]||0x0;this[_0xdf9b('0x1a')]=_0x5908db['countdropretry']||0x0;this[_0xdf9b('0x1b')]=_0x5908db['countabandonedretry']||0x0;this[_0xdf9b('0x1c')]=_0x5908db['countmachineretry']||0x0;this[_0xdf9b('0x1d')]=_0x5908db[_0xdf9b('0x1d')]||0x0;this[_0xdf9b('0x1e')]=_0x5908db[_0xdf9b('0x1e')];this[_0xdf9b('0x1f')]=_0x5908db[_0xdf9b('0x1f')];this[_0xdf9b('0x20')]=_0x5908db[_0xdf9b('0x20')];this['recallme']=_0x5908db[_0xdf9b('0x21')];this['ContactId']=_0x5908db[_0xdf9b('0x22')];this['ListId']=_0x5908db['ListId'];this[_0xdf9b('0x23')]=_[_0xdf9b('0x9')](_0x5908db[_0xdf9b('0xa')])?_0x5908db['UserId']:_0x5908db['Agent']['id'];this['VoiceQueueId']=_0x5908db['VoiceQueueId'];this['originatecalleridnum']='';this[_0xdf9b('0x24')]='';}Action[_0xdf9b('0x25')][_0xdf9b('0x26')]=function(){return util[_0xdf9b('0xc')]('\x22%s\x22\x20<%s>',this[_0xdf9b('0xe')],this[_0xdf9b('0x27')]);};module[_0xdf9b('0x28')]=Action; \ No newline at end of file +var _0x35d1=['originatecalleridnum','originatecalleridname','prototype','getCaller','format','exports','util','lodash','moment','isNil','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId'];(function(_0x1fe11b,_0x141289){var _0x2070c4=function(_0x5daa9f){while(--_0x5daa9f){_0x1fe11b['push'](_0x1fe11b['shift']());}};_0x2070c4(++_0x141289);}(_0x35d1,0x8d));var _0x135d=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0x35d1[_0x2d4421];return _0x2d3b01;};'use strict';var util=require(_0x135d('0x0'));var _=require(_0x135d('0x1'));var moment=require(_0x135d('0x2'));function checkNameSurname(_0x564e05,_0x2be07d,_0x13f4d6){var _0x2aa437='';if(!_[_0x135d('0x3')](_0x2be07d)&&'string'===typeof _0x2be07d){_0x2aa437+=_0x2be07d;}if(!_[_0x135d('0x3')](_0x13f4d6)&&'string'===typeof _0x13f4d6){_0x2aa437+='\x20'+_0x13f4d6;}if(_0x2aa437!==''){return _0x2aa437;}return _0x564e05;}function Action(_0x114da1,_0x489233,_0xc92488,_0x39523c,_0x9a3443){this[_0x135d('0x4')]=_0xc92488||undefined;this[_0x135d('0x5')]=_0x114da1['id'];this[_0x135d('0x6')]=_0x489233[_0x135d('0x7')];this[_0x135d('0x8')]=_0x489233['type'];this[_0x135d('0x9')]='queue';this[_0x135d('0xa')]=![];this['membername']=_[_0x135d('0x3')](_0x114da1[_0x135d('0xb')])?undefined:_0x114da1[_0x135d('0xb')][_0x135d('0x7')];this[_0x135d('0xc')]=this[_0x135d('0xd')]?util['format'](_0x135d('0xe'),this[_0x135d('0xd')]):_0x39523c||undefined;this[_0x135d('0xf')]=checkNameSurname(_0x114da1['Contact']['phone'],_0x114da1[_0x135d('0x10')][_0x135d('0x11')],_0x114da1['Contact'][_0x135d('0x12')]);this['active']=_0x114da1[_0x135d('0x13')]||![];this[_0x135d('0x14')]=_0x114da1[_0x135d('0x10')][_0x135d('0x15')];this[_0x135d('0x16')]=_0x114da1[_0x135d('0x16')];this[_0x135d('0x17')]=_0x114da1[_0x135d('0x17')]||0x0;this[_0x135d('0x18')]=_0x114da1[_0x135d('0x18')]||0x0;this[_0x135d('0x19')]=_0x114da1[_0x135d('0x19')]||0x0;this[_0x135d('0x1a')]=(_0x114da1[_0x135d('0x17')]||0x0)+(_0x114da1[_0x135d('0x18')]||0x0)+(_0x114da1[_0x135d('0x19')]||0x0)+(_0x114da1[_0x135d('0x1b')]||0x0)+(_0x114da1[_0x135d('0x1c')]||0x0)+(_0x114da1[_0x135d('0x1d')]||0x0)+(_0x114da1[_0x135d('0x1e')]||0x0)+(_0x114da1[_0x135d('0x1f')]||0x0);this[_0x135d('0x1b')]=_0x114da1[_0x135d('0x1b')]||0x0;this[_0x135d('0x1c')]=_0x114da1['countdropretry']||0x0;this[_0x135d('0x1d')]=_0x114da1[_0x135d('0x1d')]||0x0;this[_0x135d('0x1e')]=_0x114da1[_0x135d('0x1e')]||0x0;this[_0x135d('0x1f')]=_0x114da1['countagentrejectretry']||0x0;this[_0x135d('0x20')]=_0x114da1['callback'];this[_0x135d('0x21')]=_0x114da1[_0x135d('0x21')];this[_0x135d('0x22')]=_0x114da1[_0x135d('0x22')];this[_0x135d('0x23')]=_0x114da1[_0x135d('0x23')];this[_0x135d('0x24')]=_0x114da1['ContactId'];this[_0x135d('0x25')]=_0x114da1[_0x135d('0x25')];this['UserId']=_[_0x135d('0x3')](_0x114da1[_0x135d('0xb')])?_0x114da1['UserId']:_0x114da1[_0x135d('0xb')]['id'];this[_0x135d('0x26')]=_0x114da1[_0x135d('0x26')];this[_0x135d('0x27')]='';this[_0x135d('0x28')]='';}Action[_0x135d('0x29')][_0x135d('0x2a')]=function(){return util[_0x135d('0x2b')]('\x22%s\x22\x20<%s>',this[_0x135d('0xf')],this['number']);};module[_0x135d('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 7573331..0158a6a 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 _0x7c6f=['totalGlobal','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','linkedid','outboundBusyCallsDay','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','countcongestionretry','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','createAgentHistory','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','called','Calling','[Preview][execCall][failure]','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','isTrunkReachable','trunks','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','Agent','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','substring','dialCutDigit','trim','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','Action','variablesAction','channelAgent','destconnectedlinenum','user:agentconnect','accountcode','calleridnum','[originated][increment]','OriginateError','actionid','logLookAgent','lookAgent','isFailure','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','addVariable','variables','filterKey','keys','variable','[syncVarSet][Preview]','inspect','syncAttendedTransfer','syncBlindTransfer','transfererlinkedid','util','uuid','md5','../../../config/logger','actionPreview','../ami','./action','redis','defaults','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncDialEnd','newexten','syncNewExten','syncVarSet','attendedtransfer','blindtransfer','loopCampaigns','emit','outbound','name','answered','available','pTalking','sumDuration','talking','total','type','abandoned','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','originated','sendMessageOneNotActive','paused','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','hasOwnProperty','preview','booked','clearZombieChannels','dialMethod','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','createCustomerFinal','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0x7c6f,0x1f2));var _0xf7c6=function(_0x4192b2,_0x2595a4){_0x4192b2=_0x4192b2-0x0;var _0x5387e9=_0x7c6f[_0x4192b2];return _0x5387e9;};'use strict';var util=require(_0xf7c6('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0xf7c6('0x1'));var moment=require('moment');var md5=require(_0xf7c6('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xf7c6('0x3'))('preview');var loggerAction=require(_0xf7c6('0x3'))(_0xf7c6('0x4'));var ami=require(_0xf7c6('0x5'));var rpcDb=require('./rpcDb');var Action=require(_0xf7c6('0x6'));var ut=require('./util/util');config[_0xf7c6('0x7')]=_[_0xf7c6('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf7c6('0x9'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xf7c6('0xa')][_0xf7c6('0xb')]=function(_0x121c58){this[_0xf7c6('0xc')]=this[_0xf7c6('0xc')]?this['tail'][_0xf7c6('0xd')](_0x121c58):_0x121c58();};function Preview(_0x1e3538){this[_0xf7c6('0xe')]=new Sequence();this[_0xf7c6('0xf')]=_0x1e3538['voiceQueues'];this['trunks']=_0x1e3538['trunks'];this[_0xf7c6('0x10')]={};this['agents']=_0x1e3538[_0xf7c6('0x11')];this[_0xf7c6('0x12')]=0x0;ami['on'](_0xf7c6('0x13'),this[_0xf7c6('0x14')][_0xf7c6('0x15')](this));ami['on'](_0xf7c6('0x16'),this[_0xf7c6('0x17')][_0xf7c6('0x15')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xf7c6('0x15')](this));ami['on']('dialend',this[_0xf7c6('0x18')][_0xf7c6('0x15')](this));ami['on'](_0xf7c6('0x19'),this[_0xf7c6('0x1a')][_0xf7c6('0x15')](this));ami['on']('varset',this[_0xf7c6('0x1b')]['bind'](this));ami['on'](_0xf7c6('0x1c'),this['syncAttendedTransfer'][_0xf7c6('0x15')](this));ami['on'](_0xf7c6('0x1d'),this['syncBlindTransfer'][_0xf7c6('0x15')](this));this[_0xf7c6('0x1e')](this[_0xf7c6('0xf')]);}function emit(_0x1cda22,_0x161ee7,_0x18a69d){io['to'](_0x1cda22)[_0xf7c6('0x1f')](_0x161ee7,_0x18a69d);}function emitCampaignPreview(_0x2fd04a){if(_0x2fd04a['type']===_0xf7c6('0x20')){var _0x4cd4f4={'id':_0x2fd04a['id'],'name':_0x2fd04a[_0xf7c6('0x21')],'strategy':_0x2fd04a['strategy'],'answered':_0x2fd04a[_0xf7c6('0x22')],'available':_0x2fd04a[_0xf7c6('0x23')],'loggedIn':_0x2fd04a['loggedIn'],'pTalking':_0x2fd04a[_0xf7c6('0x24')],'sumBillable':_0x2fd04a['sumBillable'],'sumDuration':_0x2fd04a[_0xf7c6('0x25')],'sumHoldTime':_0x2fd04a['sumHoldTime']||0x0,'talking':_0x2fd04a[_0xf7c6('0x26')],'total':_0x2fd04a[_0xf7c6('0x27')],'type':_0x2fd04a[_0xf7c6('0x28')],'unmanaged':_0x2fd04a['unmanaged'],'abandoned':_0x2fd04a[_0xf7c6('0x29')],'waiting':_0x2fd04a['waiting'],'loggedInDb':_0x2fd04a['loggedInDb'],'dialActive':_0x2fd04a[_0xf7c6('0x2a')],'dialMethod':_0x2fd04a['dialMethod'],'dialOriginateCallerIdName':_0x2fd04a['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x2fd04a[_0xf7c6('0x2b')],'dialOriginateTimeout':_0x2fd04a[_0xf7c6('0x2c')],'dialPrefix':_0x2fd04a[_0xf7c6('0x2d')],'outboundAnswerAgiCallsDay':_0x2fd04a[_0xf7c6('0x2e')],'outboundAnswerCallsDay':_0x2fd04a[_0xf7c6('0x2f')],'outboundBlacklistCallsDay':_0x2fd04a[_0xf7c6('0x30')],'outboundBusyCallsDay':_0x2fd04a['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x2fd04a[_0xf7c6('0x31')],'outboundDropCallsDayACS':_0x2fd04a[_0xf7c6('0x32')],'outboundDropCallsDayCallersExit':_0x2fd04a[_0xf7c6('0x33')],'outboundDropCallsDayTimeout':_0x2fd04a['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x2fd04a[_0xf7c6('0x34')],'outboundNoSuchCallsDay':_0x2fd04a[_0xf7c6('0x35')],'outboundOriginateFailureCallsDay':_0x2fd04a[_0xf7c6('0x36')],'outboundReCallsDay':_0x2fd04a[_0xf7c6('0x37')],'outboundRejectCallsDay':_0x2fd04a['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x2fd04a[_0xf7c6('0x38')],'outboundAbandonedCallsDay':_0x2fd04a[_0xf7c6('0x39')],'predictiveIntervalAnsweredCalls':_0x2fd04a['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x2fd04a[_0xf7c6('0x3a')],'predictiveIntervalAvgTalktime':_0x2fd04a[_0xf7c6('0x3b')],'predictiveIntervalDroppedCallsCallersExit':_0x2fd04a[_0xf7c6('0x3c')],'predictiveIntervalDroppedCallsTimeout':_0x2fd04a[_0xf7c6('0x3d')],'predictiveIntervalErlangCalls':_0x2fd04a[_0xf7c6('0x3e')],'predictiveIntervalErlangCallsDroppedCalls':_0x2fd04a[_0xf7c6('0x3f')],'predictiveIntervalHitRate':_0x2fd04a[_0xf7c6('0x40')],'predictiveIntervalMultiplicativeFactor':_0x2fd04a[_0xf7c6('0x41')],'predictiveIntervalPauses':_0x2fd04a[_0xf7c6('0x42')],'predictiveIntervalAvailable':_0x2fd04a[_0xf7c6('0x43')],'predictiveIntervalTotalCalls':_0x2fd04a[_0xf7c6('0x44')],'message':_0x2fd04a[_0xf7c6('0x45')],'originated':_0x2fd04a['originated'],'erlangCalls':_0x2fd04a[_0xf7c6('0x46')],'erlangCallToSecond':_0x2fd04a[_0xf7c6('0x47')],'erlangAbandonmentRate':_0x2fd04a[_0xf7c6('0x48')],'erlangBusyFactor':_0x2fd04a['erlangBusyFactor'],'startPredictive':_0x2fd04a[_0xf7c6('0x49')],'startProgressive':_0x2fd04a[_0xf7c6('0x4a')]};if(_0x2fd04a[_0xf7c6('0x4b')]){_0x4cd4f4[_0xf7c6('0x4b')]={'id':_0x2fd04a[_0xf7c6('0x4b')]['id'],'name':_0x2fd04a[_0xf7c6('0x4b')]['name'],'active':_0x2fd04a[_0xf7c6('0x4b')][_0xf7c6('0x4c')],'callerid':_0x2fd04a[_0xf7c6('0x4b')][_0xf7c6('0x4d')]};}if(_0x2fd04a['Interval']){_0x4cd4f4[_0xf7c6('0x4e')]={'id':_0x2fd04a[_0xf7c6('0x4e')]['id'],'name':_0x2fd04a[_0xf7c6('0x4e')][_0xf7c6('0x21')]};}var _0x2b98b2=md5(JSON[_0xf7c6('0x4f')](_0x4cd4f4));if(_0x2fd04a['md5']!==_0x2b98b2){_0x2fd04a[_0xf7c6('0x2')]=_0x2b98b2;emit(util[_0xf7c6('0x50')](_0xf7c6('0x51'),_0x4cd4f4['name']),_0xf7c6('0x52'),_0x4cd4f4);}}}function emitVoiceQueueChannelRemove(_0x3e4da3){logger[_0xf7c6('0x53')](_0xf7c6('0x54'),JSON[_0xf7c6('0x4f')](_0x3e4da3));emit(util['format'](_0xf7c6('0x51'),_0x3e4da3['name']),_0xf7c6('0x55'),_0x3e4da3);io[_0xf7c6('0x1f')](_0xf7c6('0x56'),_0x3e4da3);}function notSendMessagesQueue(_0x11be6f){if(_0x11be6f['sendMessageOneNotActive']){if(_0x11be6f[_0xf7c6('0x57')]===0x0&&_0x11be6f[_0xf7c6('0x24')]===0x0){_0x11be6f[_0xf7c6('0x58')]=![];_0x11be6f['available']=0x0;_0x11be6f[_0xf7c6('0x59')]=0x0;_0x11be6f['message']='NOT_ACTIVE';ut[_0xf7c6('0x5a')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x11be6f[_0xf7c6('0x21')]+_0xf7c6('0x5b'));}else{_0x11be6f['message']=_0xf7c6('0x5c');ut[_0xf7c6('0x5a')](_0xf7c6('0x5d'),_0x11be6f[_0xf7c6('0x21')]+_0xf7c6('0x5e'));}emitCampaignPreview(_0x11be6f);}}Preview[_0xf7c6('0xa')][_0xf7c6('0x1e')]=function(){var _0x4edb4f=this;setInterval(function(){_0x4edb4f[_0xf7c6('0x5f')]();},0x7cf);};Preview[_0xf7c6('0xa')][_0xf7c6('0x5f')]=function(){var _0x523af9=this['campaignsPreview'];this[_0xf7c6('0x12')]+=0x1;for(var _0x3c7542 in _0x523af9){if(_0x523af9[_0xf7c6('0x60')](_0x3c7542)&&(_0x523af9[_0x3c7542]['dialMethod']===_0xf7c6('0x61')||_0x523af9[_0x3c7542]['dialMethod']===_0xf7c6('0x62'))&&_0x523af9[_0x3c7542][_0xf7c6('0x28')]===_0xf7c6('0x20')){if(this[_0xf7c6('0x12')]>0x7){this[_0xf7c6('0x12')]=0x0;this[_0xf7c6('0x63')]();}}if(_0x523af9[_0xf7c6('0x60')](_0x3c7542)&&_0x523af9[_0x3c7542][_0xf7c6('0x64')]===_0xf7c6('0x61')&&_0x523af9[_0x3c7542]['type']==='outbound'){if(_0x523af9[_0x3c7542][_0xf7c6('0x2a')]){this[_0xf7c6('0x65')](_0x523af9[_0x3c7542]);this[_0xf7c6('0x66')](_0x523af9[_0x3c7542]);}else{notSendMessagesQueue(_0x523af9[_0x3c7542]);}}}};Preview[_0xf7c6('0xa')][_0xf7c6('0x67')]=function(_0x379746){var _0x13a43c=this;this[_0xf7c6('0xe')]['enqueue'](function(){if(!_[_0xf7c6('0x68')](_0x13a43c[_0xf7c6('0x10')][_0x379746])){loggerAction[_0xf7c6('0x53')](_0xf7c6('0x69'),_0x379746,_0xf7c6('0x6a'),_0x13a43c[_0xf7c6('0x10')][_0x379746][_0xf7c6('0x6b')],_0xf7c6('0x6c'),JSON['stringify'](_0x13a43c[_0xf7c6('0xf')][_0x13a43c[_0xf7c6('0x10')][_0x379746][_0xf7c6('0x6b')]][_0xf7c6('0x57')]),_0xf7c6('0x6d'),JSON['stringify'](_0x13a43c[_0xf7c6('0xf')][_0x13a43c['actions'][_0x379746][_0xf7c6('0x6b')]][_0xf7c6('0x24')]),JSON['stringify'](_0x13a43c[_0xf7c6('0x10')][_0x379746][_0xf7c6('0x6e')]),JSON['stringify'](_[_0xf7c6('0x6f')](_0x13a43c[_0xf7c6('0x10')][_0x379746],[_0xf7c6('0x70'),'UserId',_0xf7c6('0x71'),_0xf7c6('0x72')])));return ami['Action']({'action':_0xf7c6('0x73'),'channel':_0x13a43c[_0xf7c6('0x10')][_0x379746][_0xf7c6('0x74')]})[_0xf7c6('0x75')](function(_0x2dc9b2){if(_0x2dc9b2[_0xf7c6('0x45')]===_0xf7c6('0x76')){setTimeout(function(){if(_0x13a43c[_0xf7c6('0x10')][_0x379746]){ut[_0xf7c6('0x77')](_0x13a43c['campaignsPreview'][_0x13a43c['actions'][_0x379746][_0xf7c6('0x6b')]],_0xf7c6('0x78'));if(_0x13a43c[_0xf7c6('0x10')][_0x379746][_0xf7c6('0x6e')]===!![]){ut[_0xf7c6('0x79')](_0x13a43c['campaignsPreview'][_0x13a43c[_0xf7c6('0x10')][_0x379746][_0xf7c6('0x6b')]],_0xf7c6('0x78'));ut[_0xf7c6('0x7a')](_0xf7c6('0x7b')+_0x379746,_0x13a43c['actions'][_0x379746][_0xf7c6('0x6b')]);}ut[_0xf7c6('0x7a')](_0xf7c6('0x7c')+_0x379746,_0x13a43c[_0xf7c6('0x10')][_0x379746][_0xf7c6('0x6b')]);delete _0x13a43c[_0xf7c6('0x10')][_0x379746];}},0x2328);}});}});};Preview[_0xf7c6('0xa')][_0xf7c6('0x63')]=function(){var _0x3cfd65=this;loggerAction[_0xf7c6('0x53')](_0xf7c6('0x7d'),_[_0xf7c6('0x7e')](this[_0xf7c6('0x10')]));for(var _0x32c5be in this[_0xf7c6('0x10')]){if(_0x3cfd65['actions']['hasOwnProperty'](_0x32c5be)){_0x3cfd65['clearZombieChannel'](_0x32c5be);}}};Preview[_0xf7c6('0xa')][_0xf7c6('0x66')]=function(_0x5a17fd){var _0x2615d2=this;rpcDb[_0xf7c6('0x7f')](_0x5a17fd['id'],ut[_0xf7c6('0x80')](this[_0xf7c6('0x11')]))[_0xf7c6('0x81')](function(_0x24f2ff){if(!_[_0xf7c6('0x68')](_0x24f2ff)){for(var _0x2f5fa7=0x0;_0x2f5fa7<_0x24f2ff['length'];_0x2f5fa7+=0x1){if(ut[_0xf7c6('0x82')](_0x24f2ff[_0x2f5fa7][_0xf7c6('0x83')])<_0x5a17fd[_0xf7c6('0x84')]*0x3c){if(_0x24f2ff[_0x2f5fa7]['Agent']&&!_0x24f2ff[_0x2f5fa7]['Agent'][_0xf7c6('0x85')]){_0x2615d2['run'](_0x24f2ff[_0x2f5fa7]['id'])[_0xf7c6('0x81')](ut[_0xf7c6('0x86')](_0xf7c6('0x87')))[_0xf7c6('0x75')](ut[_0xf7c6('0x86')](_0xf7c6('0x87')));}else{rpcDb[_0xf7c6('0x88')](_0x24f2ff[_0x2f5fa7]['id']);}}else{var _0x4e3034=new Action(_0x24f2ff[_0x2f5fa7],_0x5a17fd);_0x4e3034[_0xf7c6('0x89')]=moment()['format'](_0xf7c6('0x8a'));_0x5a17fd[_0xf7c6('0x37')]+=0x1;ut[_0xf7c6('0x8b')](_0x4e3034,0x17,_0xf7c6('0x8c'));if(_0x5a17fd[_0xf7c6('0x8d')]){rpcDb[_0xf7c6('0x8e')](ut['createBody'](_0x24f2ff[_0x2f5fa7]));rpcDb['createCustomerHistory'](_0x4e3034,_0xf7c6('0x8f'));}else{ut[_0xf7c6('0x8b')](_0x4e3034,0x16,_0xf7c6('0x90'));rpcDb[_0xf7c6('0x91')](_0x4e3034,'[HistoryRecallClose]');rpcDb[_0xf7c6('0x92')](_0x4e3034,'[HistoryRecallClose]');}}}}})['catch'](ut[_0xf7c6('0x86')]('[getContactRecallMe]'));};Preview[_0xf7c6('0xa')][_0xf7c6('0x65')]=function(_0x549000){_0x549000[_0xf7c6('0x58')]=!![];if(ut[_0xf7c6('0x93')](_0x549000[_0xf7c6('0x94')])){_0x549000[_0xf7c6('0x45')]=_0xf7c6('0x95');}else if(!ut[_0xf7c6('0x96')](_0x549000['dialActive'])){_0x549000[_0xf7c6('0x45')]='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x549000[_0xf7c6('0x4b')])){if(!this['isTrunkReachable'](_0x549000[_0xf7c6('0x97')])){_0x549000['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x549000['message']=_0xf7c6('0x98');}}else{_0x549000[_0xf7c6('0x45')]=_0xf7c6('0x98');}emitCampaignPreview(_0x549000);};Preview[_0xf7c6('0xa')]['callProgressDetectingCustomer']=function(_0x2aa53e,_0x46d208,_0x225108){var _0x53d258=this;var _0x47b362=this[_0xf7c6('0x10')][_0x46d208];var _0x3ba111=this[_0xf7c6('0xf')][_0x47b362[_0xf7c6('0x6b')]];var _0x4aace1;if(_0x3ba111){switch(_0x225108){case'1':_0x3ba111[_0xf7c6('0x35')]+=0x1;_0x47b362[_0xf7c6('0x99')]+=0x1;_0x47b362[_0xf7c6('0x9a')]=ut['totalGlobal'](_0x47b362);ut[_0xf7c6('0x8b')](_0x47b362,0x0,_0xf7c6('0x9b'));ami['emit'](_0xf7c6('0x9c'),ut[_0xf7c6('0x9d')](_0x47b362,_0xf7c6('0x9e')));rpcDb[_0xf7c6('0x91')](_0x47b362,_0xf7c6('0x9f'));if(ut['totalGlobal'](_0x47b362)>=_0x3ba111[_0xf7c6('0xa0')]){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0xf,_0xf7c6('0xa2'));rpcDb[_0xf7c6('0x92')](_0x4aace1,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x47b362[_0xf7c6('0x99')]>=_0x3ba111[_0xf7c6('0xa3')]){rpcDb['createCustomerFinal'](_0x47b362,_0xf7c6('0xa4'));}else{rpcDb[_0xf7c6('0xa5')](ut[_0xf7c6('0xa6')](_0x47b362,_0xf7c6('0x99'),_0x3ba111[_0xf7c6('0xa7')]),_0x47b362['unlockAgent'],_0x47b362['activeContact']);}}delete this['actions'][_0x2aa53e['linkedid']];break;case'ANSWER':var _0x36201a=moment()[_0xf7c6('0x50')](_0xf7c6('0x8a'));_0x47b362[_0xf7c6('0xa8')]=_0x36201a;_0x47b362[_0xf7c6('0xa9')]=_0x36201a;_0x47b362[_0xf7c6('0x6e')]=!![];_0x3ba111[_0xf7c6('0x24')]+=0x1;logger[_0xf7c6('0x53')](_0xf7c6('0xaa'),_0x47b362[_0xf7c6('0xab')],'\x20Queue',_0x3ba111[_0xf7c6('0x21')],'pTalking:\x20',_0x3ba111['pTalking']);ami['emit'](_0xf7c6('0xac'),ut['buildObj'](_0x47b362,_0xf7c6('0xad'),this[_0xf7c6('0xf')][_0x47b362['queue']]));if(_0x3ba111[_0xf7c6('0xae')]){ami['emit'](_0xf7c6('0xaf'),ut['buildAcw'](_0x47b362));}break;case'16':ami[_0xf7c6('0x1f')](_0xf7c6('0xb0'),ut[_0xf7c6('0x9d')](_0x47b362,_0xf7c6('0xb1'),this[_0xf7c6('0xf')][_0x47b362[_0xf7c6('0x6b')]]));emitVoiceQueueChannelRemove(ut[_0xf7c6('0x9d')](_0x47b362,_0xf7c6('0xb1')));_0x3ba111[_0xf7c6('0x2f')]+=0x1;_0x3ba111['total']+=0x1;_0x3ba111['answered']+=0x1;ut[_0xf7c6('0x79')](_0x3ba111,'[16]');_0x47b362[_0xf7c6('0x9a')]=ut[_0xf7c6('0xb2')](_0x47b362);ut['logCustomer'](_0x47b362,0x4,'Answer');rpcDb['createCustomerHistory'](_0x47b362,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xf7c6('0x92')](_0x47b362,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x47b362);_0x3ba111[_0xf7c6('0x25')]+=_0x47b362[_0xf7c6('0xb3')];_0x3ba111[_0xf7c6('0xb4')]+=_0x47b362[_0xf7c6('0xb3')];logger['info'](_0xf7c6('0xb5'),_0x47b362[_0xf7c6('0xab')],_0xf7c6('0xb6'),_0x3ba111['name'],'pTalking:\x20',_0x3ba111['pTalking']);delete this[_0xf7c6('0x10')][_0x2aa53e[_0xf7c6('0xb7')]];break;case'BUSY':_0x3ba111[_0xf7c6('0xb8')]+=0x1;_0x47b362['countbusyretry']+=0x1;_0x47b362[_0xf7c6('0x9a')]=ut[_0xf7c6('0xb2')](_0x47b362);ut[_0xf7c6('0x8b')](_0x47b362,0x5,_0xf7c6('0xb9'));ami['emit'](_0xf7c6('0xba'),ut['buildObj'](_0x47b362,'busy'));rpcDb[_0xf7c6('0x91')](_0x47b362,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xf7c6('0xb2')](_0x47b362)>=_0x3ba111[_0xf7c6('0xa0')]){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0xf,_0xf7c6('0xa2'));rpcDb[_0xf7c6('0x92')](_0x4aace1,_0xf7c6('0xbb'));}else{if(_0x47b362[_0xf7c6('0xbc')]>=_0x3ba111[_0xf7c6('0xbd')]){rpcDb['createCustomerFinal'](_0x47b362,_0xf7c6('0xbe'));}else{rpcDb[_0xf7c6('0xa5')](ut[_0xf7c6('0xa6')](_0x47b362,_0xf7c6('0xbc'),_0x3ba111[_0xf7c6('0xbf')]),_0x47b362[_0xf7c6('0xc0')],_0x47b362[_0xf7c6('0xc1')]);}}break;case _0xf7c6('0xc2'):_0x3ba111[_0xf7c6('0x34')]+=0x1;_0x47b362['countnoanswerretry']+=0x1;_0x47b362[_0xf7c6('0x9a')]=ut[_0xf7c6('0xb2')](_0x47b362);ut[_0xf7c6('0x8b')](_0x47b362,0x3,'NoAnswer');ami[_0xf7c6('0x1f')](_0xf7c6('0xc3'),ut[_0xf7c6('0x9d')](_0x47b362,_0xf7c6('0xc4')));rpcDb['createCustomerHistory'](_0x47b362,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x47b362)>=_0x3ba111[_0xf7c6('0xa0')]){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0xf,_0xf7c6('0xa2'));rpcDb['createCustomerFinal'](_0x4aace1,_0xf7c6('0xc5'));}else{if(_0x47b362[_0xf7c6('0xc6')]>=_0x3ba111[_0xf7c6('0xc7')]){rpcDb[_0xf7c6('0x92')](_0x47b362,_0xf7c6('0xc8'));}else{rpcDb[_0xf7c6('0xa5')](ut['scheduledAt'](_0x47b362,_0xf7c6('0xc6'),_0x3ba111[_0xf7c6('0xc9')]),_0x47b362[_0xf7c6('0xc0')],_0x47b362[_0xf7c6('0xc1')]);}}break;case _0xf7c6('0xca'):_0x3ba111[_0xf7c6('0x31')]+=0x1;_0x47b362['countcongestionretry']+=0x1;_0x47b362[_0xf7c6('0x9a')]=ut['totalGlobal'](_0x47b362);ut[_0xf7c6('0x8b')](_0x47b362,0x8,_0xf7c6('0xcb'));ami['emit'](_0xf7c6('0xcc'),ut[_0xf7c6('0x9d')](_0x47b362,_0xf7c6('0xcd')));rpcDb['createCustomerHistory'](_0x47b362,_0xf7c6('0xce'));if(ut[_0xf7c6('0xb2')](_0x47b362)>=_0x3ba111[_0xf7c6('0xa0')]){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0xf,_0xf7c6('0xa2'));rpcDb[_0xf7c6('0x92')](_0x4aace1,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x47b362[_0xf7c6('0xcf')]>=_0x3ba111[_0xf7c6('0xd0')]){rpcDb['createCustomerFinal'](_0x47b362,_0xf7c6('0xce'));}else{rpcDb[_0xf7c6('0xa5')](ut['scheduledAt'](_0x47b362,_0xf7c6('0xcf'),_0x3ba111[_0xf7c6('0xbf')]),_0x47b362['unlockAgent'],_0x47b362[_0xf7c6('0xc1')]);}}break;case _0xf7c6('0xd1'):_0x3ba111['outboundRejectCallsDay']+=0x1;_0x47b362[_0xf7c6('0xd2')]+=0x1;_0x47b362['countglobal']=ut['totalGlobal'](_0x47b362);ut[_0xf7c6('0x8b')](_0x47b362,0x14,_0xf7c6('0xd3'));ami[_0xf7c6('0x1f')](_0xf7c6('0xd4'),ut[_0xf7c6('0x9d')](_0x47b362,_0xf7c6('0xd5')));rpcDb[_0xf7c6('0x91')](_0x47b362,_0xf7c6('0xd6'));if(ut['totalGlobal'](_0x47b362)>=_0x3ba111[_0xf7c6('0xa0')]){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0x14,_0xf7c6('0xd3'));rpcDb[_0xf7c6('0x92')](_0x4aace1,_0xf7c6('0xd7'));}else{if(_0x47b362[_0xf7c6('0xd2')]>=_0x3ba111[_0xf7c6('0xd8')]){rpcDb['createCustomerFinal'](_0x47b362,_0xf7c6('0xd7'));}else{rpcDb[_0xf7c6('0xa5')](ut[_0xf7c6('0xa6')](_0x47b362,_0xf7c6('0xd2'),_0x3ba111['dialAgentRejectRetryFrequency']),_0x47b362[_0xf7c6('0xc0')],_0x47b362[_0xf7c6('0xc1')]);}}break;case _0xf7c6('0xd9'):_0x3ba111['outboundAbandonedCallsDay']+=0x1;_0x47b362[_0xf7c6('0xda')]+=0x1;_0x47b362['countglobal']=ut[_0xf7c6('0xb2')](_0x47b362);ut['logCustomer'](_0x47b362,0xb,_0xf7c6('0xdb'));rpcDb[_0xf7c6('0x91')](_0x47b362,_0xf7c6('0xdc'));if(ut[_0xf7c6('0xb2')](_0x47b362)>=_0x3ba111['dialGlobalMaxRetry']){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0xf,'Global');rpcDb[_0xf7c6('0x92')](_0x4aace1,_0xf7c6('0xdc'));}else{if(_0x47b362['countabandonedetry']>=_0x3ba111[_0xf7c6('0xdd')]){rpcDb[_0xf7c6('0x92')](_0x47b362,_0xf7c6('0xdc'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x47b362,_0xf7c6('0xda'),_0x3ba111['dialAbandonedRetryFrequency']),_0x47b362[_0xf7c6('0xc0')],_0x47b362[_0xf7c6('0xc1')]);}}break;case'18':_0x3ba111['outboundUnknownCallsDay']+=0x1;_0x47b362[_0xf7c6('0xde')]+=0x1;_0x47b362['countglobal']=ut[_0xf7c6('0xb2')](_0x47b362);ut[_0xf7c6('0x8b')](_0x47b362,0x12,_0x2aa53e['cause-txt']||_0x2aa53e[_0xf7c6('0xdf')]);ami['emit'](_0xf7c6('0xe0'),ut[_0xf7c6('0x9d')](_0x47b362,_0xf7c6('0xe1')));rpcDb[_0xf7c6('0x91')](_0x47b362,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0xf7c6('0xb2')](_0x47b362)>=_0x3ba111[_0xf7c6('0xa0')]){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0xf,'Global');rpcDb[_0xf7c6('0x92')](_0x4aace1,_0xf7c6('0xe2'));}else{rpcDb[_0xf7c6('0x92')](_0x47b362,_0xf7c6('0xe2'));}delete this['actions'][_0x2aa53e['linkedid']];break;case'19':_0x3ba111[_0xf7c6('0x38')]+=0x1;_0x47b362[_0xf7c6('0x9a')]=ut['totalGlobal'](_0x47b362);ut[_0xf7c6('0x8b')](_0x47b362,0x13,_0x2aa53e[_0xf7c6('0xe3')]||_0x2aa53e[_0xf7c6('0xdf')]);ami[_0xf7c6('0x1f')]('custom:amd',ut[_0xf7c6('0x9d')](_0x47b362,_0xf7c6('0xe1')));rpcDb[_0xf7c6('0x91')](_0x47b362,'[callProgressDetectingCustomer][machine]');if(ut['totalGlobal'](_0x47b362)>=_0x3ba111[_0xf7c6('0xa0')]){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0xf,_0xf7c6('0xa2'));rpcDb['createCustomerFinal'](_0x4aace1,_0xf7c6('0xe4'));}else{rpcDb[_0xf7c6('0x92')](_0x47b362,_0xf7c6('0xe4'));}delete this[_0xf7c6('0x10')][_0x2aa53e[_0xf7c6('0xb7')]];break;default:if(_0x47b362[_0xf7c6('0x6e')]){ut[_0xf7c6('0x79')](_0x3ba111,_0xf7c6('0xe5'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x3ba111[_0xf7c6('0x21')],_0x2aa53e);}_0x3ba111[_0xf7c6('0x38')]+=0x1;_0x47b362[_0xf7c6('0x9a')]=ut[_0xf7c6('0xb2')](_0x47b362);ut['logCustomer'](_0x47b362,0xc,_0x2aa53e[_0xf7c6('0xe3')]||_0x2aa53e['dialstatus']);rpcDb[_0xf7c6('0x91')](_0x47b362,_0xf7c6('0xe6'));if(ut['totalGlobal'](_0x47b362)>=_0x3ba111[_0xf7c6('0xa0')]){_0x4aace1=ut[_0xf7c6('0xa1')](_0x47b362,0xf,'Global');rpcDb[_0xf7c6('0x92')](_0x4aace1,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xf7c6('0x92')](_0x47b362,_0xf7c6('0xe7'));}delete this[_0xf7c6('0x10')][_0x2aa53e[_0xf7c6('0xb7')]];}if(!(_0x47b362[_0xf7c6('0x6e')]&&_0x225108==='16')){ut[_0xf7c6('0x77')](_0x3ba111,'[callProgressDetectingCustomer]');logger[_0xf7c6('0x53')](_0xf7c6('0xe8'),_0x47b362['uniqueid'],'\x20Queue',_0x3ba111[_0xf7c6('0x21')],_0xf7c6('0x6c'),_0x3ba111[_0xf7c6('0x57')]);}if(_0x225108!==_0xf7c6('0xe9')){delete this['actions'][_0x2aa53e['linkedid']];delete this[_0xf7c6('0x10')][_0x2aa53e[_0xf7c6('0xea')]];}}};Preview['prototype'][_0xf7c6('0xeb')]=function(_0x4b05d5,_0x7fcd28,_0x562394){if(_[_0xf7c6('0xec')](_0x7fcd28)&&'object'!==typeof _0x7fcd28){return;}if(_[_0xf7c6('0xec')](_0x562394)&&'object'!==typeof _0x562394){return;}switch(_0x562394['reason']){case'0':ut[_0xf7c6('0xed')](_0x4b05d5,0x0,_0xf7c6('0x9b'));rpcDb['createAgentHistory'](_0x4b05d5,_0xf7c6('0xee'));break;case'3':ut[_0xf7c6('0xed')](_0x4b05d5,0x3,_0xf7c6('0xef'));rpcDb['createAgentHistory'](_0x4b05d5,_0xf7c6('0xf0'));break;case'5':ut[_0xf7c6('0xed')](_0x4b05d5,0x5,'Busy');rpcDb['createAgentHistory'](_0x4b05d5,_0xf7c6('0xf1'));break;case'8':ut['logAgent'](_0x4b05d5,0x8,'Congestion');rpcDb[_0xf7c6('0xf2')](_0x4b05d5,_0xf7c6('0xf3'));break;case'22':ut[_0xf7c6('0xed')](_0x4b05d5,0x16,_0xf7c6('0xf4'));rpcDb[_0xf7c6('0xf2')](_0x4b05d5,_0xf7c6('0xf5'));break;default:ut['logAgent'](_0x4b05d5,0xc,_0x562394[_0xf7c6('0xf6')]);rpcDb[_0xf7c6('0xf2')](_0x4b05d5,_0xf7c6('0xf3'));}ut[_0xf7c6('0x77')](_0x7fcd28,'[callProgressDetectingAgent]');logger['info'](_0xf7c6('0xf7'),_0x4b05d5[_0xf7c6('0xab')],_0xf7c6('0xb6'),_0x7fcd28[_0xf7c6('0x21')],'originated:\x20',_0x7fcd28[_0xf7c6('0x57')]);delete this[_0xf7c6('0x10')][_0x4b05d5[_0xf7c6('0xab')]];};Preview[_0xf7c6('0xa')][_0xf7c6('0xf8')]=function(_0x43c042,_0x2ca750,_0x129855,_0x168f62,_0x5d8f0c){var _0x2d3be1=this;return new BPromise(function(_0x7f10fd,_0x198c8c){if(_['isNil'](_0x2ca750)||_[_0xf7c6('0x68')](_0x2ca750[_0xf7c6('0xf9')])||_['isNil'](_0x2ca750[_0xf7c6('0xf9')][_0xf7c6('0xfa')])||_[_0xf7c6('0x68')](_0x2ca750[_0xf7c6('0x71')])){_0x198c8c(ut[_0xf7c6('0x45')](_0xf7c6('0xfb'),_0x168f62,_0x5d8f0c));return;}var _0x494abe=uuid['v4']();var _0x40ecf9=_0x2d3be1[_0xf7c6('0xf')][_0x2ca750[_0xf7c6('0x6a')][_0xf7c6('0x21')]];var _0x11c7be=_0x129855?_0x2d3be1[_0xf7c6('0x11')][_0x129855]['id']:undefined;_0x2d3be1[_0xf7c6('0x10')][_0x494abe]=new Action(_0x2ca750,_0x40ecf9,_0x494abe,_0x129855,_0x11c7be);var _0x2b75e0=_0x2d3be1[_0xf7c6('0x10')][_0x494abe];_0x2b75e0[_0xf7c6('0xc0')]=_0x168f62;_0x2b75e0[_0xf7c6('0xc1')]=_0x5d8f0c;_0x2b75e0['lookAgent']=_0x129855;if(_[_0xf7c6('0xfc')](_0x43c042)){_0x2d3be1[_0xf7c6('0xfd')](_0x2b75e0,_0x40ecf9,_0x2ca750,_0x129855)[_0xf7c6('0x81')](function(_0x4dd708){logger[_0xf7c6('0x53')](_0xf7c6('0xfe'),_0xf7c6('0xff')+_0x2b75e0[_0xf7c6('0x6b')]+_0xf7c6('0x100')+_0x2b75e0[_0xf7c6('0x101')],JSON[_0xf7c6('0x4f')](_0x4dd708));ami['emit']('custom:agentcalled',ut[_0xf7c6('0x9d')](_0x2b75e0,_0xf7c6('0x102'),_0x2d3be1[_0xf7c6('0xf')][_0x2b75e0[_0xf7c6('0x6b')]]));_0x7f10fd(ut[_0xf7c6('0x45')](_0xf7c6('0x103')));})[_0xf7c6('0x75')](function(_0x109bfd){ut[_0xf7c6('0x5a')](_0xf7c6('0x104'),_0x109bfd);_0x198c8c(ut['message']('Call\x20failed',_0x168f62,_0x5d8f0c));});}else{_0x40ecf9[_0xf7c6('0x30')]+=0x1;ut['logBlacklist'](_0x2b75e0);rpcDb[_0xf7c6('0x105')](_0x2b75e0,_0xf7c6('0x106'));delete _0x2d3be1[_0xf7c6('0x10')][_0x494abe];_0x198c8c(ut[_0xf7c6('0x45')](_0xf7c6('0x107'),_0x168f62,_0x5d8f0c));}});};Preview[_0xf7c6('0xa')][_0xf7c6('0x108')]=function(_0x84adb5){return!_[_0xf7c6('0x68')](_0x84adb5)&&!_['isNil'](_0x84adb5['name'])&&!_[_0xf7c6('0x68')](_0x84adb5[_0xf7c6('0x4c')])&&_0x84adb5[_0xf7c6('0x4c')]&&!_[_0xf7c6('0x68')](this[_0xf7c6('0x109')][util[_0xf7c6('0x50')](_0xf7c6('0x10a'),_0x84adb5[_0xf7c6('0x21')])])&&!_['isNil'](this[_0xf7c6('0x109')][util[_0xf7c6('0x50')](_0xf7c6('0x10a'),_0x84adb5[_0xf7c6('0x21')])][_0xf7c6('0x73')])&&(this[_0xf7c6('0x109')][util['format'](_0xf7c6('0x10a'),_0x84adb5[_0xf7c6('0x21')])][_0xf7c6('0x73')]===_0xf7c6('0x10b')||this[_0xf7c6('0x109')][util['format'](_0xf7c6('0x10a'),_0x84adb5[_0xf7c6('0x21')])][_0xf7c6('0x73')]===_0xf7c6('0x10c'));};Preview[_0xf7c6('0xa')]['run']=function(_0x39db15,_0x2a7e15){var _0x9ab03c=this;return new BPromise(function(_0x2d511f,_0x22ab0e){_0x9ab03c[_0xf7c6('0x10d')](_0x39db15,_0x2a7e15)[_0xf7c6('0x81')](function(_0x163015){_0x2d511f(_[_0xf7c6('0x6f')](_0x163015,[_0xf7c6('0x45')]));})['catch'](function(_0x246428){if(_0x246428[_0xf7c6('0x10e')]){rpcDb[_0xf7c6('0x10f')](_0x39db15);}if(_0x246428[_0xf7c6('0x4c')]){rpcDb[_0xf7c6('0x88')](_0x39db15);}_0x22ab0e(_[_0xf7c6('0x6f')](_0x246428,['message']));});});};Preview[_0xf7c6('0xa')][_0xf7c6('0x10d')]=function(_0x1f990d,_0x3284cd){var _0xeb2424=this;return new BPromise(function(_0x40c1b,_0x5b439f){var _0x22bb21,_0x594eef;rpcDb[_0xf7c6('0x110')](_0x1f990d)['then'](function(_0x2ec359){if(!_['isNil'](_0x2ec359[0x0])){_0x594eef=_0x2ec359[0x0][_0xf7c6('0x111')]?![]:!![];_0x22bb21=_0x2ec359[0x0]['recallme']?!![]:![];_0x22bb21=_0x3284cd?!![]:_0x22bb21;}var _0xbc2efd=_0xeb2424[_0xf7c6('0x112')](_0x2ec359);if(_0xbc2efd[_0xf7c6('0x113')]){rpcDb[_0xf7c6('0x114')](_[_0xf7c6('0x6f')](_0x2ec359[0x0],[_0xf7c6('0x71'),_0xf7c6('0x115')]))[_0xf7c6('0x81')](function(_0x446bd8){_0xeb2424[_0xf7c6('0xf8')](_0x446bd8,_0x2ec359[0x0],_0x3284cd,_0x594eef,_0x22bb21)['then'](function(_0x10be31){_0x40c1b(_0x10be31);})['catch'](function(_0x6317ed){_0x5b439f(_0x6317ed);});})[_0xf7c6('0x75')](function(_0x49569a){ut[_0xf7c6('0x5a')](_0xf7c6('0x116'),_0x49569a);_0x5b439f(ut[_0xf7c6('0x45')](_0xf7c6('0x117'),_0x594eef,_0x22bb21));});}else{_0x5b439f(ut[_0xf7c6('0x45')](_0xbc2efd['message'],_0x594eef,_0x22bb21));}})[_0xf7c6('0x75')](function(_0x21fab0){ut[_0xf7c6('0x5a')]('[Preview][getContactPreview]',_0x21fab0);_0x5b439f(ut[_0xf7c6('0x45')](_0xf7c6('0x117'),![],!![]));});});};Preview[_0xf7c6('0xa')][_0xf7c6('0x112')]=function(_0xdb77a1){if(_['isNil'](_0xdb77a1)||_[_0xf7c6('0xfc')](_0xdb77a1)||!_[_0xf7c6('0x68')](_0xdb77a1[0x0][_0xf7c6('0x118')])&&_[_0xf7c6('0x68')](_0xdb77a1[0x0][_0xf7c6('0x118')]['name'])){ut[_0xf7c6('0x5a')]('[Preview][validateContact][Empty\x20Contact]',_0xdb77a1);return{'isValid':![],'message':_0xf7c6('0x119')};}var _0x2913e7=this[_0xf7c6('0xf')][_0xdb77a1[0x0][_0xf7c6('0x6a')][_0xf7c6('0x21')]];_0x2913e7['message']='ACTIVE';if(_[_0xf7c6('0x68')](_0x2913e7)){ut['logger'](_0xf7c6('0x11a'),_0x2913e7);return{'isValid':![],'message':_0xf7c6('0x11b')};}if(!this['isTrunkReachable'](_0x2913e7[_0xf7c6('0x4b')])){ut['logger'](_0xf7c6('0x11c'),_0xf7c6('0x11d')+_0x2913e7[_0xf7c6('0x21')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xf7c6('0x108')](_0x2913e7[_0xf7c6('0x97')])){ut[_0xf7c6('0x5a')](_0xf7c6('0x11c'),_0x2913e7[_0xf7c6('0x21')]+_0xf7c6('0x11e'));return{'isValid':![],'message':_0xf7c6('0x11f')};}}if(!ut[_0xf7c6('0x96')](_0x2913e7[_0xf7c6('0x2a')])){ut[_0xf7c6('0x5a')](_0xf7c6('0x120'),_0x2913e7[_0xf7c6('0x21')]+_0xf7c6('0x121'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x2913e7[_0xf7c6('0x21')]+_0xf7c6('0x121')};}return{'isValid':!![],'message':_0xf7c6('0x122')};};Preview[_0xf7c6('0xa')][_0xf7c6('0xfd')]=function(_0x256843,_0x8eae55,_0x5a01a0,_0x1d495f){var _0x27e6e8=this;return new BPromise(function(_0x115983,_0x519986){var _0x3ef847=_0x256843[_0xf7c6('0xab')];var _0x3b3f05=_0x27e6e8['isTrunkReachable'](_0x8eae55[_0xf7c6('0x4b')])?util[_0xf7c6('0x50')](_0xf7c6('0x123'),_0x8eae55[_0xf7c6('0x4b')][_0xf7c6('0x21')],_[_0xf7c6('0x68')](_0x8eae55['dialPrefix'])?'':_0x8eae55['dialPrefix']['trim']()||'',_0x8eae55['dialCutDigit']>0x0?_0x5a01a0[_0xf7c6('0xf9')][_0xf7c6('0xfa')][_0xf7c6('0x124')](_0x8eae55[_0xf7c6('0x125')]):_0x5a01a0['Contact']['phone']):util[_0xf7c6('0x50')](_0xf7c6('0x123'),_[_0xf7c6('0x68')](_0x8eae55['TrunkBackup'])?_0x8eae55[_0xf7c6('0x4b')][_0xf7c6('0x21')]:_0x8eae55[_0xf7c6('0x97')]['name'],_[_0xf7c6('0x68')](_0x8eae55[_0xf7c6('0x2d')])?'':_0x8eae55[_0xf7c6('0x2d')][_0xf7c6('0x126')]()||'',_0x8eae55[_0xf7c6('0x125')]>0x0?_0x5a01a0[_0xf7c6('0xf9')]['phone']['substring'](_0x8eae55[_0xf7c6('0x125')]):_0x5a01a0[_0xf7c6('0xf9')]['phone']);var _0xc3cb79=_0x27e6e8['isTrunkReachable'](_0x8eae55[_0xf7c6('0x4b')])?ut[_0xf7c6('0x127')](_0x8eae55[_0xf7c6('0x4b')][_0xf7c6('0x4d')],_0x8eae55[_0xf7c6('0x128')],_0x8eae55[_0xf7c6('0x129')]>0x0?ut[_0xf7c6('0x12a')](_0x8eae55[_0xf7c6('0x2b')],_0x8eae55[_0xf7c6('0x129')]):_0x8eae55[_0xf7c6('0x2b')]):ut[_0xf7c6('0x127')](_[_0xf7c6('0x68')](_0x8eae55[_0xf7c6('0x97')])?_0x8eae55['Trunk'][_0xf7c6('0x4d')]:_0x8eae55[_0xf7c6('0x97')][_0xf7c6('0x4d')],_0x8eae55['dialOriginateCallerIdName'],_0x8eae55[_0xf7c6('0x129')]>0x0?ut[_0xf7c6('0x12a')](_0x8eae55[_0xf7c6('0x2b')],_0x8eae55[_0xf7c6('0x129')]):_0x8eae55[_0xf7c6('0x2b')]);if(_0xc3cb79){_0x256843[_0xf7c6('0x12b')]=ut[_0xf7c6('0x12c')](_0xc3cb79);_0x256843[_0xf7c6('0x12d')]=ut[_0xf7c6('0x12e')](_0xc3cb79);}var _0x22472f=ut['addVariables'](_0x8eae55,_0x5a01a0,_0x3b3f05,_0xc3cb79,_0x3ef847,_0x256843);_['merge'](_0x256843,ut['toLowerVariables'](_0x22472f));_0x256843['starttime']=moment()['format'](_0xf7c6('0x8a'));ami[_0xf7c6('0x12f')](ut[_0xf7c6('0x130')](_0x256843,_0x8eae55,_0x22472f,_0x256843[_0xf7c6('0xc1')],_0x1d495f))[_0xf7c6('0x81')](function(_0x1009d6){var _0x4e7343=_0x256843[_0xf7c6('0x131')];if(!_[_0xf7c6('0x68')](_0x4e7343)){if(!_['isNil'](_0x27e6e8[_0xf7c6('0x11')][_0x4e7343])){_0x27e6e8[_0xf7c6('0x11')][_0x4e7343][_0xf7c6('0x132')]=_0x256843['calleridnum'];emit(util[_0xf7c6('0x50')]('user:%s',_0x27e6e8[_0xf7c6('0x11')][_0x4e7343][_0xf7c6('0x21')]),_0xf7c6('0x133'),{'destaccountcode':_0x27e6e8[_0xf7c6('0x11')][_0x4e7343][_0xf7c6('0x134')],'destconnectedlinenum':_0x256843[_0xf7c6('0x135')]});}}_0x8eae55[_0xf7c6('0x57')]+=0x1;logger[_0xf7c6('0x53')](_0xf7c6('0x136'),_0x3ef847,_0xf7c6('0xb6'),_0x8eae55[_0xf7c6('0x21')],_0xf7c6('0x6c'),_0x8eae55[_0xf7c6('0x57')]);_0x115983(_0x1009d6);})[_0xf7c6('0x75')](function(_0x337dab){ut[_0xf7c6('0xed')](_0x256843,0xe,_0xf7c6('0x137'));rpcDb[_0xf7c6('0xf2')](_0x256843,'[originateFailure][logOriginateFailure]');_0x519986(_0x337dab);});});};Preview[_0xf7c6('0xa')][_0xf7c6('0x1a')]=function(_0x2f3f90){if(this[_0xf7c6('0x10')][_0x2f3f90[_0xf7c6('0xb7')]]){this[_0xf7c6('0x10')][_0x2f3f90[_0xf7c6('0xb7')]][_0xf7c6('0x74')]=_0x2f3f90['channel'];}};Preview['prototype'][_0xf7c6('0x14')]=function(_0x326d14){var _0x2f4d51=this;var _0x5093b1=this[_0xf7c6('0x10')][_0x326d14[_0xf7c6('0x138')]];if(_0x5093b1){if(_0x5093b1['lookAgent']&&this[_0xf7c6('0x11')][_0x5093b1['lookAgent']]){ut[_0xf7c6('0x139')](_0x5093b1,this[_0xf7c6('0x11')][_0x5093b1[_0xf7c6('0x13a')]][_0xf7c6('0x21')],this['agents'][_0x5093b1['lookAgent']]['id']);}var _0x35e12b=_['clone'](_0x5093b1);_0x35e12b[_0xf7c6('0xa8')]=moment()[_0xf7c6('0x50')]('YYYY-MM-DD\x20HH:mm:ss');var _0x39daeb=_0x2f4d51[_0xf7c6('0xf')][_0x5093b1[_0xf7c6('0x6b')]];if(ut[_0xf7c6('0x13b')](_0x326d14['response'])){if(_0x5093b1[_0xf7c6('0xc0')]){rpcDb[_0xf7c6('0x10f')](_0x5093b1['idContact']);}if(_0x5093b1[_0xf7c6('0xc1')]){rpcDb[_0xf7c6('0x88')](_0x5093b1[_0xf7c6('0x101')]);}ami[_0xf7c6('0x1f')]('custom:agentringnoanswer',ut[_0xf7c6('0x9d')](_0x5093b1,_0xf7c6('0x13c'),this[_0xf7c6('0xf')][_0x5093b1[_0xf7c6('0x6b')]]));this[_0xf7c6('0xeb')](_0x35e12b,_0x39daeb,_0x326d14);}else{_0x5093b1[_0xf7c6('0x89')]=moment()[_0xf7c6('0x50')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xf7c6('0xed')](_0x35e12b,0x4,_0xf7c6('0x13d'));rpcDb[_0xf7c6('0xf2')](_0x35e12b,_0xf7c6('0x13e'));}}};Preview['prototype'][_0xf7c6('0x17')]=function(_0x4f871d){var _0x465e41=this;var _0x14f031=this[_0xf7c6('0x10')][_0x4f871d[_0xf7c6('0xb7')]];var _0x1715e1;if(_0x14f031){_0x1715e1=this[_0xf7c6('0xf')][_0x14f031['queue']];logger[_0xf7c6('0x53')](_0xf7c6('0x13f'),_0x4f871d[_0xf7c6('0xb7')],_0xf7c6('0xb6'),_0x1715e1[_0xf7c6('0x21')],_0xf7c6('0x6d'),_0x1715e1['pTalking']);}if(this[_0xf7c6('0x10')][_0x4f871d[_0xf7c6('0xb7')]]&&_0x4f871d[_0xf7c6('0xb7')]!==_0x4f871d[_0xf7c6('0xab')]){if(_0x4f871d[_0xf7c6('0x140')]==='16'&&this[_0xf7c6('0x10')][_0x4f871d['linkedid']]['dialAnswer']){this[_0xf7c6('0x141')](_0x4f871d,_0x4f871d[_0xf7c6('0xb7')],_0x4f871d[_0xf7c6('0x140')]);}else if(this[_0xf7c6('0x10')][_0x4f871d[_0xf7c6('0xb7')]][_0xf7c6('0x6e')]){logger[_0xf7c6('0x53')]('[syncHangup][talking][cause]',_0x4f871d[_0xf7c6('0xb7')],_0x4f871d[_0xf7c6('0x140')],_0xf7c6('0xb6'),_0x1715e1[_0xf7c6('0x21')],'pTalking:\x20',_0x1715e1[_0xf7c6('0x24')]);this[_0xf7c6('0x141')](_0x4f871d,_0x4f871d[_0xf7c6('0xb7')],_0x4f871d[_0xf7c6('0x140')]);}}else if(_0x14f031&&_[_0xf7c6('0x68')](_0x14f031[_0xf7c6('0x142')])&&_0x1715e1[_0xf7c6('0x143')]&&_0x4f871d['linkedid']===_0x4f871d[_0xf7c6('0xab')]&&_[_0xf7c6('0x68')](_0x4f871d[_0xf7c6('0xf6')])&&_0x4f871d[_0xf7c6('0x140')]==='16'&&_0x4f871d[_0xf7c6('0x144')]==='6'&&_['isUndefined'](_0x14f031[_0xf7c6('0x145')])){if(_0x14f031[_0xf7c6('0xc0')]){rpcDb[_0xf7c6('0x10f')](_0x14f031[_0xf7c6('0x101')]);}if(_0x14f031[_0xf7c6('0xc1')]){rpcDb[_0xf7c6('0x88')](_0x14f031[_0xf7c6('0x101')]);}_0x4f871d[_0xf7c6('0xf6')]='22';this[_0xf7c6('0xeb')](_0x14f031,_0x1715e1,_0x4f871d);}else if(_0x14f031&&_0x14f031[_0xf7c6('0x145')]){if(_0x4f871d[_0xf7c6('0x140')]==='16'&&this[_0xf7c6('0x10')][_0x4f871d[_0xf7c6('0xb7')]][_0xf7c6('0x6e')]){logger[_0xf7c6('0x53')](_0xf7c6('0x146'),_0x4f871d[_0xf7c6('0xb7')],_0x4f871d['cause'],'\x20Queue',_0x1715e1[_0xf7c6('0x21')],'pTalking:\x20',_0x1715e1[_0xf7c6('0x24')]);this['callProgressDetectingCustomer'](_0x4f871d,_0x4f871d[_0xf7c6('0xb7')],_0x4f871d[_0xf7c6('0x140')]);}else if(this['actions'][_0x4f871d[_0xf7c6('0xb7')]]['dialAnswer']){logger[_0xf7c6('0x53')](_0xf7c6('0x147'),_0x4f871d[_0xf7c6('0xb7')],_0x4f871d['cause'],_0xf7c6('0xb6'),_0x1715e1['name'],_0xf7c6('0x6d'),_0x1715e1['pTalking']);this[_0xf7c6('0x141')](_0x4f871d,_0x4f871d[_0xf7c6('0xb7')],_0x4f871d['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x59c403){if(this[_0xf7c6('0x10')][_0x59c403['destlinkedid']]&&_0x59c403[_0xf7c6('0xea')]!==_0x59c403['destuniqueid']){this['callProgressDetectingCustomer'](_0x59c403,_0x59c403[_0xf7c6('0xea')],_0x59c403[_0xf7c6('0xdf')]);}};Preview[_0xf7c6('0xa')]['syncHangupRequest']=function(_0x34fc94){if(this['actions'][_0x34fc94[_0xf7c6('0xb7')]]&&_0x34fc94[_0xf7c6('0xb7')]!==_0x34fc94[_0xf7c6('0xab')]&&!this[_0xf7c6('0x10')][_0x34fc94['linkedid']][_0xf7c6('0x6e')]){if(_0x34fc94[_0xf7c6('0x140')]==='1'){this['callProgressDetectingCustomer'](_0x34fc94,_0x34fc94[_0xf7c6('0xb7')],_0x34fc94[_0xf7c6('0x140')]);}}};Preview['prototype'][_0xf7c6('0x148')]=function(_0x49c3df,_0x27ad9c,_0x3f2cf2){if(this[_0xf7c6('0x10')][_0x49c3df]){if(_[_0xf7c6('0x68')](this[_0xf7c6('0x10')][_0x49c3df]['variables'])){this[_0xf7c6('0x10')][_0x49c3df][_0xf7c6('0x149')]={};}this[_0xf7c6('0x10')][_0x49c3df]['variables'][_0x27ad9c]=_0x3f2cf2;}};Preview['prototype'][_0xf7c6('0x1b')]=function(_0x5be953){try{if(!_[_0xf7c6('0x68')](_0x5be953)){if(ut[_0xf7c6('0x14a')](_[_0xf7c6('0x14b')](_0x5be953['variable'])[0x0])){this['addVariable'](_0x5be953[_0xf7c6('0xab')],_[_0xf7c6('0x14b')](_0x5be953[_0xf7c6('0x14c')])[0x0],_0x5be953['value']);}}}catch(_0x21d0db){logger['error'](_0xf7c6('0x14d'),util[_0xf7c6('0x14e')](_0x21d0db,{'showHidden':![],'depth':null}));}};Preview[_0xf7c6('0xa')][_0xf7c6('0x14f')]=function(_0x2182fa){if(_0x2182fa){if(this[_0xf7c6('0x10')][_0x2182fa['transfertargetlinkedid']]){this[_0xf7c6('0x10')][_0x2182fa['transfertargetlinkedid']][_0xf7c6('0x145')]=!![];}}};Preview[_0xf7c6('0xa')][_0xf7c6('0x150')]=function(_0x438e1b){if(_0x438e1b){if(this[_0xf7c6('0x10')][_0x438e1b[_0xf7c6('0x151')]]){this[_0xf7c6('0x10')][_0x438e1b[_0xf7c6('0x151')]][_0xf7c6('0x145')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x5e1d=['unlockAgent','outboundNoAnswerCallsDay','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countagentrejectretry','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','YYYY-MM-DD\x20HH:mm:ss','Action','variablesAction','channelAgent','calleridnum','user:%s','accountcode','syncNewExten','syncOriginateResponse','actionid','lookAgent','clone','isFailure','response','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','syncHangupRequest','addVariable','variables','filterKey','keys','variable','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','../ami','./action','defaults','localhost','socket.io-emitter','redis','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','syncVarSet','attendedtransfer','syncAttendedTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','stringify','format','voice:queue:%s','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','paused','message','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','hasOwnProperty','dialMethod','clearZombieChannels','setMessage','clearZombieChannel','enqueue','isNil','info','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','starttime','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','sendMessageOneNotActive','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','buildAcw','complete','Answer','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5e1d,0x1e5));var _0xd5e1=function(_0x2b43ba,_0x3510f1){_0x2b43ba=_0x2b43ba-0x0;var _0x26d41e=_0x5e1d[_0x2b43ba];return _0x26d41e;};'use strict';var util=require(_0xd5e1('0x0'));var _=require(_0xd5e1('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xd5e1('0x2'));var md5=require(_0xd5e1('0x3'));var Redis=require(_0xd5e1('0x4'));var config=require(_0xd5e1('0x5'));var logger=require(_0xd5e1('0x6'))(_0xd5e1('0x7'));var loggerAction=require(_0xd5e1('0x6'))('actionPreview');var ami=require(_0xd5e1('0x8'));var rpcDb=require('./rpcDb');var Action=require(_0xd5e1('0x9'));var ut=require('./util/util');config['redis']=_[_0xd5e1('0xa')](config['redis'],{'host':_0xd5e1('0xb'),'port':0x18eb});var io=require(_0xd5e1('0xc'))(new Redis(config[_0xd5e1('0xd')]));var Sequence=function(){};Sequence[_0xd5e1('0xe')]['enqueue']=function(_0xf958ab){this['tail']=this[_0xd5e1('0xf')]?this['tail'][_0xd5e1('0x10')](_0xf958ab):_0xf958ab();};function Preview(_0x3f63a9){this[_0xd5e1('0x11')]=new Sequence();this[_0xd5e1('0x12')]=_0x3f63a9[_0xd5e1('0x13')];this[_0xd5e1('0x14')]=_0x3f63a9[_0xd5e1('0x14')];this[_0xd5e1('0x15')]={};this[_0xd5e1('0x16')]=_0x3f63a9['agents'];this[_0xd5e1('0x17')]=0x0;ami['on'](_0xd5e1('0x18'),this['syncOriginateResponse'][_0xd5e1('0x19')](this));ami['on']('hangup',this[_0xd5e1('0x1a')][_0xd5e1('0x19')](this));ami['on'](_0xd5e1('0x1b'),this['syncHangupRequest'][_0xd5e1('0x19')](this));ami['on'](_0xd5e1('0x1c'),this[_0xd5e1('0x1d')]['bind'](this));ami['on'](_0xd5e1('0x1e'),this['syncNewExten']['bind'](this));ami['on']('varset',this[_0xd5e1('0x1f')][_0xd5e1('0x19')](this));ami['on'](_0xd5e1('0x20'),this[_0xd5e1('0x21')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));this[_0xd5e1('0x22')](this[_0xd5e1('0x12')]);}function emit(_0x3d063a,_0x173337,_0x254095){io['to'](_0x3d063a)[_0xd5e1('0x23')](_0x173337,_0x254095);}function emitCampaignPreview(_0x311d3d){if(_0x311d3d[_0xd5e1('0x24')]===_0xd5e1('0x25')){var _0x19d055={'id':_0x311d3d['id'],'name':_0x311d3d[_0xd5e1('0x26')],'strategy':_0x311d3d[_0xd5e1('0x27')],'answered':_0x311d3d[_0xd5e1('0x28')],'available':_0x311d3d['available'],'loggedIn':_0x311d3d[_0xd5e1('0x29')],'pTalking':_0x311d3d[_0xd5e1('0x2a')],'sumBillable':_0x311d3d[_0xd5e1('0x2b')],'sumDuration':_0x311d3d[_0xd5e1('0x2c')],'sumHoldTime':_0x311d3d[_0xd5e1('0x2d')]||0x0,'talking':_0x311d3d[_0xd5e1('0x2e')],'total':_0x311d3d[_0xd5e1('0x2f')],'type':_0x311d3d[_0xd5e1('0x24')],'unmanaged':_0x311d3d['unmanaged'],'abandoned':_0x311d3d[_0xd5e1('0x30')],'waiting':_0x311d3d[_0xd5e1('0x31')],'loggedInDb':_0x311d3d[_0xd5e1('0x32')],'dialActive':_0x311d3d[_0xd5e1('0x33')],'dialMethod':_0x311d3d['dialMethod'],'dialOriginateCallerIdName':_0x311d3d[_0xd5e1('0x34')],'dialOriginateCallerIdNumber':_0x311d3d['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x311d3d[_0xd5e1('0x35')],'dialPrefix':_0x311d3d[_0xd5e1('0x36')],'outboundAnswerAgiCallsDay':_0x311d3d['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x311d3d[_0xd5e1('0x37')],'outboundBlacklistCallsDay':_0x311d3d[_0xd5e1('0x38')],'outboundBusyCallsDay':_0x311d3d[_0xd5e1('0x39')],'outboundCongestionCallsDay':_0x311d3d[_0xd5e1('0x3a')],'outboundDropCallsDayACS':_0x311d3d['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x311d3d[_0xd5e1('0x3b')],'outboundDropCallsDayTimeout':_0x311d3d[_0xd5e1('0x3c')],'outboundNoAnswerCallsDay':_0x311d3d['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x311d3d[_0xd5e1('0x3d')],'outboundOriginateFailureCallsDay':_0x311d3d[_0xd5e1('0x3e')],'outboundReCallsDay':_0x311d3d[_0xd5e1('0x3f')],'outboundRejectCallsDay':_0x311d3d['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x311d3d[_0xd5e1('0x40')],'outboundAbandonedCallsDay':_0x311d3d['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x311d3d[_0xd5e1('0x41')],'predictiveIntervalAvgHoldtime':_0x311d3d[_0xd5e1('0x42')],'predictiveIntervalAvgTalktime':_0x311d3d['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x311d3d[_0xd5e1('0x43')],'predictiveIntervalDroppedCallsTimeout':_0x311d3d['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x311d3d[_0xd5e1('0x44')],'predictiveIntervalErlangCallsDroppedCalls':_0x311d3d[_0xd5e1('0x45')],'predictiveIntervalHitRate':_0x311d3d[_0xd5e1('0x46')],'predictiveIntervalMultiplicativeFactor':_0x311d3d[_0xd5e1('0x47')],'predictiveIntervalPauses':_0x311d3d[_0xd5e1('0x48')],'predictiveIntervalAvailable':_0x311d3d[_0xd5e1('0x49')],'predictiveIntervalTotalCalls':_0x311d3d[_0xd5e1('0x4a')],'message':_0x311d3d['message'],'originated':_0x311d3d[_0xd5e1('0x4b')],'erlangCalls':_0x311d3d[_0xd5e1('0x4c')],'erlangCallToSecond':_0x311d3d[_0xd5e1('0x4d')],'erlangAbandonmentRate':_0x311d3d[_0xd5e1('0x4e')],'erlangBusyFactor':_0x311d3d[_0xd5e1('0x4f')],'startPredictive':_0x311d3d[_0xd5e1('0x50')],'startProgressive':_0x311d3d[_0xd5e1('0x51')]};if(_0x311d3d['Trunk']){_0x19d055[_0xd5e1('0x52')]={'id':_0x311d3d[_0xd5e1('0x52')]['id'],'name':_0x311d3d[_0xd5e1('0x52')][_0xd5e1('0x26')],'active':_0x311d3d[_0xd5e1('0x52')]['active'],'callerid':_0x311d3d[_0xd5e1('0x52')]['callerid']};}if(_0x311d3d[_0xd5e1('0x53')]){_0x19d055[_0xd5e1('0x53')]={'id':_0x311d3d['Interval']['id'],'name':_0x311d3d[_0xd5e1('0x53')][_0xd5e1('0x26')]};}var _0x563495=md5(JSON[_0xd5e1('0x54')](_0x19d055));if(_0x311d3d[_0xd5e1('0x3')]!==_0x563495){_0x311d3d[_0xd5e1('0x3')]=_0x563495;emit(util[_0xd5e1('0x55')](_0xd5e1('0x56'),_0x19d055['name']),_0xd5e1('0x57'),_0x19d055);}}}function emitVoiceQueueChannelRemove(_0x3adc1a){logger['info'](_0xd5e1('0x58'),JSON[_0xd5e1('0x54')](_0x3adc1a));emit(util['format'](_0xd5e1('0x56'),_0x3adc1a[_0xd5e1('0x26')]),_0xd5e1('0x59'),_0x3adc1a);io[_0xd5e1('0x23')]('voice_queue_presence:remove',_0x3adc1a);}function notSendMessagesQueue(_0xa0310c){if(_0xa0310c['sendMessageOneNotActive']){if(_0xa0310c[_0xd5e1('0x4b')]===0x0&&_0xa0310c[_0xd5e1('0x2a')]===0x0){_0xa0310c['sendMessageOneNotActive']=![];_0xa0310c['available']=0x0;_0xa0310c[_0xd5e1('0x5a')]=0x0;_0xa0310c[_0xd5e1('0x5b')]=_0xd5e1('0x5c');ut[_0xd5e1('0x5d')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0xa0310c['name']+_0xd5e1('0x5e'));}else{_0xa0310c['message']=_0xd5e1('0x5f');ut[_0xd5e1('0x5d')](_0xd5e1('0x60'),_0xa0310c[_0xd5e1('0x26')]+_0xd5e1('0x61'));}emitCampaignPreview(_0xa0310c);}}Preview[_0xd5e1('0xe')][_0xd5e1('0x22')]=function(){var _0x163b9c=this;setInterval(function(){_0x163b9c[_0xd5e1('0x62')]();},0x7cf);};Preview[_0xd5e1('0xe')]['syncCampaigns']=function(){var _0x2ef456=this[_0xd5e1('0x12')];this[_0xd5e1('0x17')]+=0x1;for(var _0x306dd6 in _0x2ef456){if(_0x2ef456[_0xd5e1('0x63')](_0x306dd6)&&(_0x2ef456[_0x306dd6]['dialMethod']===_0xd5e1('0x7')||_0x2ef456[_0x306dd6][_0xd5e1('0x64')]==='booked')&&_0x2ef456[_0x306dd6][_0xd5e1('0x24')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0xd5e1('0x65')]();}}if(_0x2ef456[_0xd5e1('0x63')](_0x306dd6)&&_0x2ef456[_0x306dd6][_0xd5e1('0x64')]===_0xd5e1('0x7')&&_0x2ef456[_0x306dd6][_0xd5e1('0x24')]===_0xd5e1('0x25')){if(_0x2ef456[_0x306dd6][_0xd5e1('0x33')]){this[_0xd5e1('0x66')](_0x2ef456[_0x306dd6]);this['recallMe'](_0x2ef456[_0x306dd6]);}else{notSendMessagesQueue(_0x2ef456[_0x306dd6]);}}}};Preview['prototype'][_0xd5e1('0x67')]=function(_0x46f24a){var _0x2056ce=this;this[_0xd5e1('0x11')][_0xd5e1('0x68')](function(){if(!_[_0xd5e1('0x69')](_0x2056ce[_0xd5e1('0x15')][_0x46f24a])){loggerAction[_0xd5e1('0x6a')](_0xd5e1('0x6b'),_0x46f24a,_0xd5e1('0x6c'),_0x2056ce[_0xd5e1('0x15')][_0x46f24a][_0xd5e1('0x6d')],'originated:\x20',JSON[_0xd5e1('0x54')](_0x2056ce['campaignsPreview'][_0x2056ce[_0xd5e1('0x15')][_0x46f24a][_0xd5e1('0x6d')]][_0xd5e1('0x4b')]),_0xd5e1('0x6e'),JSON[_0xd5e1('0x54')](_0x2056ce['campaignsPreview'][_0x2056ce['actions'][_0x46f24a][_0xd5e1('0x6d')]]['pTalking']),JSON['stringify'](_0x2056ce[_0xd5e1('0x15')][_0x46f24a][_0xd5e1('0x6f')]),JSON[_0xd5e1('0x54')](_[_0xd5e1('0x70')](_0x2056ce[_0xd5e1('0x15')][_0x46f24a],['contactId',_0xd5e1('0x71'),_0xd5e1('0x72'),_0xd5e1('0x73')])));return ami['Action']({'action':_0xd5e1('0x74'),'channel':_0x2056ce[_0xd5e1('0x15')][_0x46f24a][_0xd5e1('0x75')]})[_0xd5e1('0x76')](function(_0x4a0512){if(_0x4a0512[_0xd5e1('0x5b')]===_0xd5e1('0x77')){setTimeout(function(){if(_0x2056ce[_0xd5e1('0x15')][_0x46f24a]){ut[_0xd5e1('0x78')](_0x2056ce['campaignsPreview'][_0x2056ce['actions'][_0x46f24a][_0xd5e1('0x6d')]],'[clearZombieChannel]');if(_0x2056ce[_0xd5e1('0x15')][_0x46f24a][_0xd5e1('0x6f')]===!![]){ut[_0xd5e1('0x79')](_0x2056ce[_0xd5e1('0x12')][_0x2056ce[_0xd5e1('0x15')][_0x46f24a][_0xd5e1('0x6d')]],_0xd5e1('0x7a'));ut[_0xd5e1('0x7b')](_0xd5e1('0x7c')+_0x46f24a,_0x2056ce[_0xd5e1('0x15')][_0x46f24a]['queue']);}ut[_0xd5e1('0x7b')](_0xd5e1('0x7d')+_0x46f24a,_0x2056ce[_0xd5e1('0x15')][_0x46f24a][_0xd5e1('0x6d')]);delete _0x2056ce[_0xd5e1('0x15')][_0x46f24a];}},0x2328);}});}});};Preview[_0xd5e1('0xe')]['clearZombieChannels']=function(){var _0x2b29d8=this;loggerAction[_0xd5e1('0x6a')](_0xd5e1('0x7e'),_['size'](this[_0xd5e1('0x15')]));for(var _0x570b4f in this[_0xd5e1('0x15')]){if(_0x2b29d8[_0xd5e1('0x15')]['hasOwnProperty'](_0x570b4f)){_0x2b29d8[_0xd5e1('0x67')](_0x570b4f);}}};Preview[_0xd5e1('0xe')]['recallMe']=function(_0x1da003){var _0x243d30=this;rpcDb[_0xd5e1('0x7f')](_0x1da003['id'],ut[_0xd5e1('0x80')](this[_0xd5e1('0x16')]))[_0xd5e1('0x81')](function(_0x320551){if(!_['isNil'](_0x320551)){for(var _0x2c1b5c=0x0;_0x2c1b5c<_0x320551[_0xd5e1('0x82')];_0x2c1b5c+=0x1){if(ut[_0xd5e1('0x83')](_0x320551[_0x2c1b5c]['scheduledat'])<_0x1da003[_0xd5e1('0x84')]*0x3c){if(_0x320551[_0x2c1b5c][_0xd5e1('0x85')]&&!_0x320551[_0x2c1b5c][_0xd5e1('0x85')]['voicePause']){_0x243d30[_0xd5e1('0x86')](_0x320551[_0x2c1b5c]['id'])[_0xd5e1('0x81')](ut[_0xd5e1('0x87')](_0xd5e1('0x88')))[_0xd5e1('0x76')](ut[_0xd5e1('0x87')](_0xd5e1('0x88')));}else{rpcDb[_0xd5e1('0x89')](_0x320551[_0x2c1b5c]['id']);}}else{var _0x26e6e9=new Action(_0x320551[_0x2c1b5c],_0x1da003);_0x26e6e9[_0xd5e1('0x8a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1da003[_0xd5e1('0x3f')]+=0x1;ut[_0xd5e1('0x8b')](_0x26e6e9,0x17,_0xd5e1('0x8c'));if(_0x1da003[_0xd5e1('0x8d')]){rpcDb[_0xd5e1('0x8e')](ut[_0xd5e1('0x8f')](_0x320551[_0x2c1b5c]));rpcDb[_0xd5e1('0x90')](_0x26e6e9,_0xd5e1('0x91'));}else{ut['logCustomer'](_0x26e6e9,0x16,_0xd5e1('0x92'));rpcDb['createCustomerHistory'](_0x26e6e9,_0xd5e1('0x93'));rpcDb[_0xd5e1('0x94')](_0x26e6e9,_0xd5e1('0x93'));}}}}})[_0xd5e1('0x76')](ut[_0xd5e1('0x87')](_0xd5e1('0x95')));};Preview['prototype'][_0xd5e1('0x66')]=function(_0xa80d8c){_0xa80d8c[_0xd5e1('0x96')]=!![];if(ut[_0xd5e1('0x97')](_0xa80d8c[_0xd5e1('0x29')])){_0xa80d8c[_0xd5e1('0x5b')]='AGENTS_NOT_LOGGED';}else if(!ut[_0xd5e1('0x98')](_0xa80d8c[_0xd5e1('0x33')])){_0xa80d8c[_0xd5e1('0x5b')]=_0xd5e1('0x5c');}else if(!this[_0xd5e1('0x99')](_0xa80d8c['Trunk'])){if(!this['isTrunkReachable'](_0xa80d8c[_0xd5e1('0x9a')])){_0xa80d8c[_0xd5e1('0x5b')]=_0xd5e1('0x9b');}else{_0xa80d8c[_0xd5e1('0x5b')]=_0xd5e1('0x9c');}}else{_0xa80d8c[_0xd5e1('0x5b')]=_0xd5e1('0x9c');}emitCampaignPreview(_0xa80d8c);};Preview[_0xd5e1('0xe')][_0xd5e1('0x9d')]=function(_0x538ce3,_0x520be2,_0x1a3fc7){var _0x2a3a41=this;var _0x176cca=this[_0xd5e1('0x15')][_0x520be2];var _0x173512=this[_0xd5e1('0x12')][_0x176cca[_0xd5e1('0x6d')]];var _0x1dce95;if(_0x173512){switch(_0x1a3fc7){case'1':_0x173512[_0xd5e1('0x3d')]+=0x1;_0x176cca[_0xd5e1('0x9e')]+=0x1;_0x176cca[_0xd5e1('0x9f')]=ut[_0xd5e1('0xa0')](_0x176cca);ut['logCustomer'](_0x176cca,0x0,_0xd5e1('0xa1'));ami[_0xd5e1('0x23')](_0xd5e1('0xa2'),ut[_0xd5e1('0xa3')](_0x176cca,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x176cca,_0xd5e1('0xa4'));if(ut['totalGlobal'](_0x176cca)>=_0x173512[_0xd5e1('0xa5')]){_0x1dce95=ut[_0xd5e1('0xa6')](_0x176cca,0xf,_0xd5e1('0xa7'));rpcDb[_0xd5e1('0x94')](_0x1dce95,_0xd5e1('0xa8'));}else{if(_0x176cca[_0xd5e1('0x9e')]>=_0x173512['dialNoSuchNumberMaxRetry']){rpcDb[_0xd5e1('0x94')](_0x176cca,_0xd5e1('0xa8'));}else{rpcDb['rescheduleContact'](ut[_0xd5e1('0xa9')](_0x176cca,_0xd5e1('0x9e'),_0x173512[_0xd5e1('0xaa')]),_0x176cca['unlockAgent'],_0x176cca[_0xd5e1('0xab')]);}}delete this[_0xd5e1('0x15')][_0x538ce3[_0xd5e1('0xac')]];break;case _0xd5e1('0xad'):var _0x3fe80d=moment()[_0xd5e1('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x176cca[_0xd5e1('0xae')]=_0x3fe80d;_0x176cca[_0xd5e1('0xaf')]=_0x3fe80d;_0x176cca[_0xd5e1('0x6f')]=!![];_0x173512['pTalking']+=0x1;logger[_0xd5e1('0x6a')](_0xd5e1('0xb0'),_0x176cca[_0xd5e1('0xb1')],_0xd5e1('0xb2'),_0x173512[_0xd5e1('0x26')],'pTalking:\x20',_0x173512['pTalking']);ami['emit']('custom:agentconnect',ut['buildObj'](_0x176cca,_0xd5e1('0xb3'),this[_0xd5e1('0x12')][_0x176cca['queue']]));if(_0x173512[_0xd5e1('0xb4')]){ami[_0xd5e1('0x23')](_0xd5e1('0xb5'),ut[_0xd5e1('0xb6')](_0x176cca));}break;case'16':ami[_0xd5e1('0x23')]('custom:agentcomplete',ut[_0xd5e1('0xa3')](_0x176cca,'complete',this[_0xd5e1('0x12')][_0x176cca[_0xd5e1('0x6d')]]));emitVoiceQueueChannelRemove(ut[_0xd5e1('0xa3')](_0x176cca,_0xd5e1('0xb7')));_0x173512[_0xd5e1('0x37')]+=0x1;_0x173512[_0xd5e1('0x2f')]+=0x1;_0x173512[_0xd5e1('0x28')]+=0x1;ut[_0xd5e1('0x79')](_0x173512,'[16]');_0x176cca[_0xd5e1('0x9f')]=ut[_0xd5e1('0xa0')](_0x176cca);ut[_0xd5e1('0x8b')](_0x176cca,0x4,_0xd5e1('0xb8'));rpcDb[_0xd5e1('0x90')](_0x176cca,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xd5e1('0x94')](_0x176cca,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x176cca);_0x173512[_0xd5e1('0x2c')]+=_0x176cca[_0xd5e1('0xb9')];_0x173512[_0xd5e1('0x2b')]+=_0x176cca['talktime'];logger['info'](_0xd5e1('0xba'),_0x176cca[_0xd5e1('0xb1')],'\x20Queue',_0x173512[_0xd5e1('0x26')],_0xd5e1('0x6e'),_0x173512['pTalking']);delete this[_0xd5e1('0x15')][_0x538ce3[_0xd5e1('0xac')]];break;case _0xd5e1('0xbb'):_0x173512['outboundBusyCallsDay']+=0x1;_0x176cca[_0xd5e1('0xbc')]+=0x1;_0x176cca[_0xd5e1('0x9f')]=ut[_0xd5e1('0xa0')](_0x176cca);ut['logCustomer'](_0x176cca,0x5,_0xd5e1('0xbd'));ami[_0xd5e1('0x23')](_0xd5e1('0xbe'),ut['buildObj'](_0x176cca,_0xd5e1('0xbf')));rpcDb[_0xd5e1('0x90')](_0x176cca,_0xd5e1('0xc0'));if(ut['totalGlobal'](_0x176cca)>=_0x173512[_0xd5e1('0xa5')]){_0x1dce95=ut[_0xd5e1('0xa6')](_0x176cca,0xf,_0xd5e1('0xa7'));rpcDb[_0xd5e1('0x94')](_0x1dce95,_0xd5e1('0xc1'));}else{if(_0x176cca[_0xd5e1('0xbc')]>=_0x173512[_0xd5e1('0xc2')]){rpcDb[_0xd5e1('0x94')](_0x176cca,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xd5e1('0xc3')](ut[_0xd5e1('0xa9')](_0x176cca,'countbusyretry',_0x173512[_0xd5e1('0xc4')]),_0x176cca[_0xd5e1('0xc5')],_0x176cca[_0xd5e1('0xab')]);}}break;case'NOANSWER':_0x173512[_0xd5e1('0xc6')]+=0x1;_0x176cca[_0xd5e1('0xc7')]+=0x1;_0x176cca[_0xd5e1('0x9f')]=ut['totalGlobal'](_0x176cca);ut[_0xd5e1('0x8b')](_0x176cca,0x3,'NoAnswer');ami[_0xd5e1('0x23')](_0xd5e1('0xc8'),ut['buildObj'](_0x176cca,_0xd5e1('0xc9')));rpcDb[_0xd5e1('0x90')](_0x176cca,_0xd5e1('0xca'));if(ut[_0xd5e1('0xa0')](_0x176cca)>=_0x173512['dialGlobalMaxRetry']){_0x1dce95=ut['cloneAction'](_0x176cca,0xf,_0xd5e1('0xa7'));rpcDb[_0xd5e1('0x94')](_0x1dce95,_0xd5e1('0xcb'));}else{if(_0x176cca['countnoanswerretry']>=_0x173512[_0xd5e1('0xcc')]){rpcDb[_0xd5e1('0x94')](_0x176cca,_0xd5e1('0xca'));}else{rpcDb[_0xd5e1('0xc3')](ut[_0xd5e1('0xa9')](_0x176cca,_0xd5e1('0xc7'),_0x173512[_0xd5e1('0xcd')]),_0x176cca[_0xd5e1('0xc5')],_0x176cca[_0xd5e1('0xab')]);}}break;case _0xd5e1('0xce'):_0x173512['outboundCongestionCallsDay']+=0x1;_0x176cca[_0xd5e1('0xcf')]+=0x1;_0x176cca[_0xd5e1('0x9f')]=ut[_0xd5e1('0xa0')](_0x176cca);ut[_0xd5e1('0x8b')](_0x176cca,0x8,_0xd5e1('0xd0'));ami[_0xd5e1('0x23')](_0xd5e1('0xd1'),ut['buildObj'](_0x176cca,_0xd5e1('0xd2')));rpcDb[_0xd5e1('0x90')](_0x176cca,_0xd5e1('0xd3'));if(ut[_0xd5e1('0xa0')](_0x176cca)>=_0x173512[_0xd5e1('0xa5')]){_0x1dce95=ut['cloneAction'](_0x176cca,0xf,_0xd5e1('0xa7'));rpcDb[_0xd5e1('0x94')](_0x1dce95,_0xd5e1('0xd4'));}else{if(_0x176cca['countcongestionretry']>=_0x173512['dialCongestionMaxRetry']){rpcDb[_0xd5e1('0x94')](_0x176cca,_0xd5e1('0xd3'));}else{rpcDb[_0xd5e1('0xc3')](ut[_0xd5e1('0xa9')](_0x176cca,_0xd5e1('0xcf'),_0x173512[_0xd5e1('0xc4')]),_0x176cca[_0xd5e1('0xc5')],_0x176cca[_0xd5e1('0xab')]);}}break;case _0xd5e1('0xd5'):_0x173512['outboundRejectCallsDay']+=0x1;_0x176cca['countagentrejectretry']+=0x1;_0x176cca[_0xd5e1('0x9f')]=ut[_0xd5e1('0xa0')](_0x176cca);ut[_0xd5e1('0x8b')](_0x176cca,0x14,_0xd5e1('0xd6'));ami[_0xd5e1('0x23')](_0xd5e1('0xd7'),ut['buildObj'](_0x176cca,_0xd5e1('0xd8')));rpcDb[_0xd5e1('0x90')](_0x176cca,_0xd5e1('0xd9'));if(ut[_0xd5e1('0xa0')](_0x176cca)>=_0x173512[_0xd5e1('0xa5')]){_0x1dce95=ut[_0xd5e1('0xa6')](_0x176cca,0x14,_0xd5e1('0xd6'));rpcDb[_0xd5e1('0x94')](_0x1dce95,_0xd5e1('0xda'));}else{if(_0x176cca['countagentrejectretry']>=_0x173512[_0xd5e1('0xdb')]){rpcDb[_0xd5e1('0x94')](_0x176cca,_0xd5e1('0xda'));}else{rpcDb[_0xd5e1('0xc3')](ut[_0xd5e1('0xa9')](_0x176cca,_0xd5e1('0xdc'),_0x173512['dialAgentRejectRetryFrequency']),_0x176cca[_0xd5e1('0xc5')],_0x176cca['activeContact']);}}break;case _0xd5e1('0xdd'):_0x173512['outboundAbandonedCallsDay']+=0x1;_0x176cca['countabandonedretry']+=0x1;_0x176cca[_0xd5e1('0x9f')]=ut[_0xd5e1('0xa0')](_0x176cca);ut[_0xd5e1('0x8b')](_0x176cca,0xb,_0xd5e1('0xde'));rpcDb[_0xd5e1('0x90')](_0x176cca,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xd5e1('0xa0')](_0x176cca)>=_0x173512[_0xd5e1('0xa5')]){_0x1dce95=ut[_0xd5e1('0xa6')](_0x176cca,0xf,_0xd5e1('0xa7'));rpcDb[_0xd5e1('0x94')](_0x1dce95,_0xd5e1('0xdf'));}else{if(_0x176cca[_0xd5e1('0xe0')]>=_0x173512[_0xd5e1('0xe1')]){rpcDb['createCustomerFinal'](_0x176cca,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0xd5e1('0xa9')](_0x176cca,'countabandonedretry',_0x173512[_0xd5e1('0xe2')]),_0x176cca[_0xd5e1('0xc5')],_0x176cca[_0xd5e1('0xab')]);}}break;case'18':_0x173512[_0xd5e1('0x40')]+=0x1;_0x176cca['countmachineretry']+=0x1;_0x176cca[_0xd5e1('0x9f')]=ut[_0xd5e1('0xa0')](_0x176cca);ut[_0xd5e1('0x8b')](_0x176cca,0x12,_0x538ce3[_0xd5e1('0xe3')]||_0x538ce3[_0xd5e1('0xe4')]);ami[_0xd5e1('0x23')](_0xd5e1('0xe5'),ut[_0xd5e1('0xa3')](_0x176cca,_0xd5e1('0xe6')));rpcDb[_0xd5e1('0x90')](_0x176cca,_0xd5e1('0xe7'));if(ut[_0xd5e1('0xa0')](_0x176cca)>=_0x173512[_0xd5e1('0xa5')]){_0x1dce95=ut['cloneAction'](_0x176cca,0xf,'Global');rpcDb['createCustomerFinal'](_0x1dce95,_0xd5e1('0xe7'));}else{rpcDb[_0xd5e1('0x94')](_0x176cca,_0xd5e1('0xe7'));}delete this[_0xd5e1('0x15')][_0x538ce3[_0xd5e1('0xac')]];break;case'19':_0x173512['outboundUnknownCallsDay']+=0x1;_0x176cca[_0xd5e1('0x9f')]=ut['totalGlobal'](_0x176cca);ut[_0xd5e1('0x8b')](_0x176cca,0x13,_0x538ce3[_0xd5e1('0xe3')]||_0x538ce3[_0xd5e1('0xe4')]);ami[_0xd5e1('0x23')]('custom:amd',ut[_0xd5e1('0xa3')](_0x176cca,_0xd5e1('0xe6')));rpcDb[_0xd5e1('0x90')](_0x176cca,_0xd5e1('0xe8'));if(ut[_0xd5e1('0xa0')](_0x176cca)>=_0x173512[_0xd5e1('0xa5')]){_0x1dce95=ut[_0xd5e1('0xa6')](_0x176cca,0xf,_0xd5e1('0xa7'));rpcDb[_0xd5e1('0x94')](_0x1dce95,_0xd5e1('0xe8'));}else{rpcDb[_0xd5e1('0x94')](_0x176cca,_0xd5e1('0xe8'));}delete this[_0xd5e1('0x15')][_0x538ce3[_0xd5e1('0xac')]];break;default:if(_0x176cca[_0xd5e1('0x6f')]){ut['decrementTalkink'](_0x173512,_0xd5e1('0xe9'));ut[_0xd5e1('0x7b')](_0xd5e1('0xea')+_0x173512['name'],_0x538ce3);}_0x173512['outboundUnknownCallsDay']+=0x1;_0x176cca['countglobal']=ut[_0xd5e1('0xa0')](_0x176cca);ut[_0xd5e1('0x8b')](_0x176cca,0xc,_0x538ce3['cause-txt']||_0x538ce3['dialstatus']);rpcDb[_0xd5e1('0x90')](_0x176cca,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0xd5e1('0xa0')](_0x176cca)>=_0x173512[_0xd5e1('0xa5')]){_0x1dce95=ut[_0xd5e1('0xa6')](_0x176cca,0xf,_0xd5e1('0xa7'));rpcDb[_0xd5e1('0x94')](_0x1dce95,_0xd5e1('0xeb'));}else{rpcDb[_0xd5e1('0x94')](_0x176cca,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xd5e1('0x15')][_0x538ce3['linkedid']];}if(!(_0x176cca['dialAnswer']&&_0x1a3fc7==='16')){ut[_0xd5e1('0x78')](_0x173512,_0xd5e1('0xec'));logger[_0xd5e1('0x6a')](_0xd5e1('0xed'),_0x176cca[_0xd5e1('0xb1')],_0xd5e1('0xb2'),_0x173512[_0xd5e1('0x26')],_0xd5e1('0xee'),_0x173512['originated']);}if(_0x1a3fc7!==_0xd5e1('0xad')){delete this['actions'][_0x538ce3[_0xd5e1('0xac')]];delete this[_0xd5e1('0x15')][_0x538ce3['destlinkedid']];}}};Preview[_0xd5e1('0xe')][_0xd5e1('0xef')]=function(_0x34eaa9,_0x325da4,_0x19b934){if(_[_0xd5e1('0xf0')](_0x325da4)&&_0xd5e1('0xf1')!==typeof _0x325da4){return;}if(_['isUndefined'](_0x19b934)&&_0xd5e1('0xf1')!==typeof _0x19b934){return;}switch(_0x19b934['reason']){case'0':ut[_0xd5e1('0xf2')](_0x34eaa9,0x0,'NoSuchNumber');rpcDb[_0xd5e1('0xf3')](_0x34eaa9,_0xd5e1('0xf4'));break;case'3':ut[_0xd5e1('0xf2')](_0x34eaa9,0x3,_0xd5e1('0xf5'));rpcDb[_0xd5e1('0xf3')](_0x34eaa9,_0xd5e1('0xf6'));break;case'5':ut[_0xd5e1('0xf2')](_0x34eaa9,0x5,_0xd5e1('0xbd'));rpcDb[_0xd5e1('0xf3')](_0x34eaa9,_0xd5e1('0xf7'));break;case'8':ut[_0xd5e1('0xf2')](_0x34eaa9,0x8,'Congestion');rpcDb['createAgentHistory'](_0x34eaa9,_0xd5e1('0xf8'));break;case'22':ut[_0xd5e1('0xf2')](_0x34eaa9,0x16,'AnswerAGI');rpcDb[_0xd5e1('0xf3')](_0x34eaa9,_0xd5e1('0xf9'));break;default:ut['logAgent'](_0x34eaa9,0xc,_0x19b934[_0xd5e1('0xfa')]);rpcDb[_0xd5e1('0xf3')](_0x34eaa9,_0xd5e1('0xf8'));}ut[_0xd5e1('0x78')](_0x325da4,_0xd5e1('0xfb'));logger[_0xd5e1('0x6a')](_0xd5e1('0xfc'),_0x34eaa9['uniqueid'],_0xd5e1('0xb2'),_0x325da4['name'],_0xd5e1('0xee'),_0x325da4[_0xd5e1('0x4b')]);delete this['actions'][_0x34eaa9[_0xd5e1('0xb1')]];};Preview[_0xd5e1('0xe')][_0xd5e1('0xfd')]=function(_0x52cdc6,_0x248b95,_0x471a98,_0x2f9760,_0x46af4a){var _0xa001bb=this;return new BPromise(function(_0x3fe682,_0x162817){if(_[_0xd5e1('0x69')](_0x248b95)||_[_0xd5e1('0x69')](_0x248b95[_0xd5e1('0xfe')])||_[_0xd5e1('0x69')](_0x248b95[_0xd5e1('0xfe')][_0xd5e1('0xff')])||_['isNil'](_0x248b95[_0xd5e1('0x72')])){_0x162817(ut['message'](_0xd5e1('0x100'),_0x2f9760,_0x46af4a));return;}var _0x10fdee=uuid['v4']();var _0x2b45fe=_0xa001bb[_0xd5e1('0x12')][_0x248b95[_0xd5e1('0x6c')][_0xd5e1('0x26')]];var _0x55ee7a=_0x471a98?_0xa001bb[_0xd5e1('0x16')][_0x471a98]['id']:undefined;_0xa001bb['actions'][_0x10fdee]=new Action(_0x248b95,_0x2b45fe,_0x10fdee,_0x471a98,_0x55ee7a);var _0x5ef6c6=_0xa001bb[_0xd5e1('0x15')][_0x10fdee];_0x5ef6c6[_0xd5e1('0xc5')]=_0x2f9760;_0x5ef6c6[_0xd5e1('0xab')]=_0x46af4a;_0x5ef6c6['lookAgent']=_0x471a98;if(_[_0xd5e1('0x101')](_0x52cdc6)){_0xa001bb['execCall'](_0x5ef6c6,_0x2b45fe,_0x248b95,_0x471a98)['then'](function(_0x24a5cd){logger[_0xd5e1('0x6a')](_0xd5e1('0x102'),_0xd5e1('0x103')+_0x5ef6c6[_0xd5e1('0x6d')]+'\x20IdHopper:\x20'+_0x5ef6c6['idContact'],JSON[_0xd5e1('0x54')](_0x24a5cd));ami[_0xd5e1('0x23')](_0xd5e1('0x104'),ut[_0xd5e1('0xa3')](_0x5ef6c6,_0xd5e1('0x105'),_0xa001bb[_0xd5e1('0x12')][_0x5ef6c6[_0xd5e1('0x6d')]]));_0x3fe682(ut[_0xd5e1('0x5b')](_0xd5e1('0x106')));})['catch'](function(_0x26edca){ut[_0xd5e1('0x5d')](_0xd5e1('0x107'),_0x26edca);_0x162817(ut[_0xd5e1('0x5b')](_0xd5e1('0x108'),_0x2f9760,_0x46af4a));});}else{_0x2b45fe[_0xd5e1('0x38')]+=0x1;ut[_0xd5e1('0x109')](_0x5ef6c6);rpcDb[_0xd5e1('0x10a')](_0x5ef6c6,_0xd5e1('0x10b'));delete _0xa001bb[_0xd5e1('0x15')][_0x10fdee];_0x162817(ut[_0xd5e1('0x5b')](_0xd5e1('0x10c'),_0x2f9760,_0x46af4a));}});};Preview[_0xd5e1('0xe')][_0xd5e1('0x99')]=function(_0x513b2b){return!_[_0xd5e1('0x69')](_0x513b2b)&&!_[_0xd5e1('0x69')](_0x513b2b[_0xd5e1('0x26')])&&!_[_0xd5e1('0x69')](_0x513b2b[_0xd5e1('0x10d')])&&_0x513b2b[_0xd5e1('0x10d')]&&!_[_0xd5e1('0x69')](this[_0xd5e1('0x14')][util['format']('SIP/%s',_0x513b2b[_0xd5e1('0x26')])])&&!_['isNil'](this['trunks'][util['format'](_0xd5e1('0x10e'),_0x513b2b[_0xd5e1('0x26')])]['status'])&&(this[_0xd5e1('0x14')][util[_0xd5e1('0x55')](_0xd5e1('0x10e'),_0x513b2b[_0xd5e1('0x26')])][_0xd5e1('0x74')]===_0xd5e1('0x10f')||this[_0xd5e1('0x14')][util[_0xd5e1('0x55')](_0xd5e1('0x10e'),_0x513b2b[_0xd5e1('0x26')])][_0xd5e1('0x74')]==='unmonitored');};Preview[_0xd5e1('0xe')][_0xd5e1('0x86')]=function(_0x5120f8,_0x1f7ed9){var _0x392e28=this;return new BPromise(function(_0x20766a,_0x218c24){_0x392e28[_0xd5e1('0x110')](_0x5120f8,_0x1f7ed9)[_0xd5e1('0x81')](function(_0x1bce1a){_0x20766a(_[_0xd5e1('0x70')](_0x1bce1a,[_0xd5e1('0x5b')]));})['catch'](function(_0x3fc393){if(_0x3fc393[_0xd5e1('0x111')]){rpcDb[_0xd5e1('0x112')](_0x5120f8);}if(_0x3fc393[_0xd5e1('0x10d')]){rpcDb['disableContact'](_0x5120f8);}_0x218c24(_['pick'](_0x3fc393,[_0xd5e1('0x5b')]));});});};Preview['prototype'][_0xd5e1('0x110')]=function(_0x42016f,_0x28d05c){var _0x158ee7=this;return new BPromise(function(_0x5a4be4,_0x58abf9){var _0x374c89,_0x3d4c98;rpcDb[_0xd5e1('0x113')](_0x42016f)['then'](function(_0x20cc46){if(!_[_0xd5e1('0x69')](_0x20cc46[0x0])){_0x3d4c98=_0x20cc46[0x0]['recallme']?![]:!![];_0x374c89=_0x20cc46[0x0][_0xd5e1('0x114')]?!![]:![];_0x374c89=_0x28d05c?!![]:_0x374c89;}var _0x35db07=_0x158ee7[_0xd5e1('0x115')](_0x20cc46);if(_0x35db07[_0xd5e1('0x116')]){rpcDb[_0xd5e1('0x117')](_[_0xd5e1('0x70')](_0x20cc46[0x0],[_0xd5e1('0x72'),'Contact.phone']))[_0xd5e1('0x81')](function(_0x26b1c2){_0x158ee7[_0xd5e1('0xfd')](_0x26b1c2,_0x20cc46[0x0],_0x28d05c,_0x3d4c98,_0x374c89)[_0xd5e1('0x81')](function(_0x200799){_0x5a4be4(_0x200799);})[_0xd5e1('0x76')](function(_0x4ecbe0){_0x58abf9(_0x4ecbe0);});})['catch'](function(_0x3be0e5){ut[_0xd5e1('0x5d')](_0xd5e1('0x118'),_0x3be0e5);_0x58abf9(ut[_0xd5e1('0x5b')](_0xd5e1('0x119'),_0x3d4c98,_0x374c89));});}else{_0x58abf9(ut[_0xd5e1('0x5b')](_0x35db07[_0xd5e1('0x5b')],_0x3d4c98,_0x374c89));}})[_0xd5e1('0x76')](function(_0x4916d1){ut[_0xd5e1('0x5d')]('[Preview][getContactPreview]',_0x4916d1);_0x58abf9(ut[_0xd5e1('0x5b')](_0xd5e1('0x119'),![],!![]));});});};Preview['prototype'][_0xd5e1('0x115')]=function(_0x3640a3){if(_['isNil'](_0x3640a3)||_[_0xd5e1('0x101')](_0x3640a3)||!_['isNil'](_0x3640a3[0x0][_0xd5e1('0x85')])&&_[_0xd5e1('0x69')](_0x3640a3[0x0][_0xd5e1('0x85')][_0xd5e1('0x26')])){ut[_0xd5e1('0x5d')](_0xd5e1('0x11a'),_0x3640a3);return{'isValid':![],'message':_0xd5e1('0x11b')};}var _0x2a8de8=this['campaignsPreview'][_0x3640a3[0x0][_0xd5e1('0x6c')][_0xd5e1('0x26')]];_0x2a8de8[_0xd5e1('0x5b')]=_0xd5e1('0x9c');if(_[_0xd5e1('0x69')](_0x2a8de8)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x2a8de8);return{'isValid':![],'message':_0xd5e1('0x11c')};}if(!this['isTrunkReachable'](_0x2a8de8[_0xd5e1('0x52')])){ut[_0xd5e1('0x5d')]('[Preview][validateContact][Trunk\x20not\x20work]',_0xd5e1('0x11d')+_0x2a8de8[_0xd5e1('0x26')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xd5e1('0x99')](_0x2a8de8[_0xd5e1('0x9a')])){ut[_0xd5e1('0x5d')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x2a8de8[_0xd5e1('0x26')]+_0xd5e1('0x11e'));return{'isValid':![],'message':_0xd5e1('0x11f')};}}if(!ut[_0xd5e1('0x98')](_0x2a8de8['dialActive'])){ut[_0xd5e1('0x5d')](_0xd5e1('0x120'),_0x2a8de8[_0xd5e1('0x26')]+_0xd5e1('0x121'));return{'isValid':![],'message':_0xd5e1('0x11d')+_0x2a8de8[_0xd5e1('0x26')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xd5e1('0x122')};};Preview[_0xd5e1('0xe')]['execCall']=function(_0x194d85,_0x70c7ca,_0x3255fc,_0x112b4d){var _0x47cf03=this;return new BPromise(function(_0x4f006a,_0x43c3bf){var _0x3f09c4=_0x194d85['uniqueid'];var _0x1f771c=_0x47cf03['isTrunkReachable'](_0x70c7ca[_0xd5e1('0x52')])?util['format'](_0xd5e1('0x123'),_0x70c7ca['Trunk'][_0xd5e1('0x26')],_[_0xd5e1('0x69')](_0x70c7ca['dialPrefix'])?'':_0x70c7ca[_0xd5e1('0x36')][_0xd5e1('0x124')]()||'',_0x70c7ca[_0xd5e1('0x125')]>0x0?_0x3255fc[_0xd5e1('0xfe')]['phone'][_0xd5e1('0x126')](_0x70c7ca[_0xd5e1('0x125')]):_0x3255fc[_0xd5e1('0xfe')][_0xd5e1('0xff')]):util['format'](_0xd5e1('0x123'),_['isNil'](_0x70c7ca['TrunkBackup'])?_0x70c7ca['Trunk']['name']:_0x70c7ca[_0xd5e1('0x9a')][_0xd5e1('0x26')],_[_0xd5e1('0x69')](_0x70c7ca[_0xd5e1('0x36')])?'':_0x70c7ca[_0xd5e1('0x36')][_0xd5e1('0x124')]()||'',_0x70c7ca[_0xd5e1('0x125')]>0x0?_0x3255fc[_0xd5e1('0xfe')][_0xd5e1('0xff')]['substring'](_0x70c7ca['dialCutDigit']):_0x3255fc[_0xd5e1('0xfe')][_0xd5e1('0xff')]);var _0x55a517=_0x47cf03[_0xd5e1('0x99')](_0x70c7ca[_0xd5e1('0x52')])?ut[_0xd5e1('0x127')](_0x70c7ca[_0xd5e1('0x52')][_0xd5e1('0x128')],_0x70c7ca[_0xd5e1('0x34')],_0x70c7ca[_0xd5e1('0x129')]>0x0?ut[_0xd5e1('0x12a')](_0x70c7ca[_0xd5e1('0x12b')],_0x70c7ca['dialRandomLastDigitCallerIdNumber']):_0x70c7ca['dialOriginateCallerIdNumber']):ut[_0xd5e1('0x127')](_[_0xd5e1('0x69')](_0x70c7ca[_0xd5e1('0x9a')])?_0x70c7ca['Trunk'][_0xd5e1('0x128')]:_0x70c7ca[_0xd5e1('0x9a')][_0xd5e1('0x128')],_0x70c7ca['dialOriginateCallerIdName'],_0x70c7ca[_0xd5e1('0x129')]>0x0?ut['getCallerIdRandom'](_0x70c7ca[_0xd5e1('0x12b')],_0x70c7ca[_0xd5e1('0x129')]):_0x70c7ca['dialOriginateCallerIdNumber']);if(_0x55a517){_0x194d85[_0xd5e1('0x12c')]=ut[_0xd5e1('0x12d')](_0x55a517);_0x194d85[_0xd5e1('0x12e')]=ut[_0xd5e1('0x12f')](_0x55a517);}var _0x2e49aa=ut[_0xd5e1('0x130')](_0x70c7ca,_0x3255fc,_0x1f771c,_0x55a517,_0x3f09c4,_0x194d85);_[_0xd5e1('0x131')](_0x194d85,ut['toLowerVariables'](_0x2e49aa));_0x194d85[_0xd5e1('0x8a')]=moment()[_0xd5e1('0x55')](_0xd5e1('0x132'));ami[_0xd5e1('0x133')](ut[_0xd5e1('0x134')](_0x194d85,_0x70c7ca,_0x2e49aa,_0x194d85[_0xd5e1('0xab')],_0x112b4d))[_0xd5e1('0x81')](function(_0x560e13){var _0x367c41=_0x194d85[_0xd5e1('0x135')];if(!_[_0xd5e1('0x69')](_0x367c41)){if(!_[_0xd5e1('0x69')](_0x47cf03[_0xd5e1('0x16')][_0x367c41])){_0x47cf03[_0xd5e1('0x16')][_0x367c41]['destconnectedlinenum']=_0x194d85[_0xd5e1('0x136')];emit(util[_0xd5e1('0x55')](_0xd5e1('0x137'),_0x47cf03[_0xd5e1('0x16')][_0x367c41][_0xd5e1('0x26')]),'user:agentconnect',{'destaccountcode':_0x47cf03[_0xd5e1('0x16')][_0x367c41][_0xd5e1('0x138')],'destconnectedlinenum':_0x194d85[_0xd5e1('0x136')]});}}_0x70c7ca[_0xd5e1('0x4b')]+=0x1;logger[_0xd5e1('0x6a')]('[originated][increment]',_0x3f09c4,_0xd5e1('0xb2'),_0x70c7ca[_0xd5e1('0x26')],'originated:\x20',_0x70c7ca[_0xd5e1('0x4b')]);_0x4f006a(_0x560e13);})['catch'](function(_0x4c9cda){ut[_0xd5e1('0xf2')](_0x194d85,0xe,'OriginateError');rpcDb[_0xd5e1('0xf3')](_0x194d85,'[originateFailure][logOriginateFailure]');_0x43c3bf(_0x4c9cda);});});};Preview['prototype'][_0xd5e1('0x139')]=function(_0x545ff8){if(this['actions'][_0x545ff8['linkedid']]){this[_0xd5e1('0x15')][_0x545ff8[_0xd5e1('0xac')]]['channel']=_0x545ff8[_0xd5e1('0x75')];}};Preview['prototype'][_0xd5e1('0x13a')]=function(_0xaa8e8){var _0x1867d4=this;var _0x58db71=this[_0xd5e1('0x15')][_0xaa8e8[_0xd5e1('0x13b')]];if(_0x58db71){if(_0x58db71[_0xd5e1('0x13c')]&&this['agents'][_0x58db71[_0xd5e1('0x13c')]]){ut['logLookAgent'](_0x58db71,this[_0xd5e1('0x16')][_0x58db71[_0xd5e1('0x13c')]]['name'],this[_0xd5e1('0x16')][_0x58db71[_0xd5e1('0x13c')]]['id']);}var _0x5b0ef5=_[_0xd5e1('0x13d')](_0x58db71);_0x5b0ef5[_0xd5e1('0xae')]=moment()[_0xd5e1('0x55')](_0xd5e1('0x132'));var _0x416ef5=_0x1867d4['campaignsPreview'][_0x58db71[_0xd5e1('0x6d')]];if(ut[_0xd5e1('0x13e')](_0xaa8e8[_0xd5e1('0x13f')])){if(_0x58db71[_0xd5e1('0xc5')]){rpcDb['unlockContact'](_0x58db71[_0xd5e1('0x140')]);}if(_0x58db71[_0xd5e1('0xab')]){rpcDb['disableContact'](_0x58db71[_0xd5e1('0x140')]);}ami[_0xd5e1('0x23')](_0xd5e1('0x141'),ut[_0xd5e1('0xa3')](_0x58db71,_0xd5e1('0x142'),this['campaignsPreview'][_0x58db71[_0xd5e1('0x6d')]]));this[_0xd5e1('0xef')](_0x5b0ef5,_0x416ef5,_0xaa8e8);}else{_0x58db71['starttime']=moment()[_0xd5e1('0x55')](_0xd5e1('0x132'));ut['logAgent'](_0x5b0ef5,0x4,'Answer');rpcDb['createAgentHistory'](_0x5b0ef5,_0xd5e1('0x143'));}}};Preview[_0xd5e1('0xe')]['syncHangup']=function(_0x1a04a2){var _0x2dd03d=this;var _0x8f09bb=this['actions'][_0x1a04a2[_0xd5e1('0xac')]];var _0x33d342;if(_0x8f09bb){_0x33d342=this[_0xd5e1('0x12')][_0x8f09bb[_0xd5e1('0x6d')]];logger[_0xd5e1('0x6a')]('[syncHangup][talking]',_0x1a04a2['linkedid'],_0xd5e1('0xb2'),_0x33d342[_0xd5e1('0x26')],_0xd5e1('0x6e'),_0x33d342[_0xd5e1('0x2a')]);}if(this['actions'][_0x1a04a2[_0xd5e1('0xac')]]&&_0x1a04a2[_0xd5e1('0xac')]!==_0x1a04a2[_0xd5e1('0xb1')]){if(_0x1a04a2[_0xd5e1('0x144')]==='16'&&this[_0xd5e1('0x15')][_0x1a04a2[_0xd5e1('0xac')]][_0xd5e1('0x6f')]){this['callProgressDetectingCustomer'](_0x1a04a2,_0x1a04a2['linkedid'],_0x1a04a2['cause']);}else if(this[_0xd5e1('0x15')][_0x1a04a2[_0xd5e1('0xac')]][_0xd5e1('0x6f')]){logger[_0xd5e1('0x6a')](_0xd5e1('0x145'),_0x1a04a2[_0xd5e1('0xac')],_0x1a04a2[_0xd5e1('0x144')],_0xd5e1('0xb2'),_0x33d342[_0xd5e1('0x26')],_0xd5e1('0x6e'),_0x33d342[_0xd5e1('0x2a')]);this[_0xd5e1('0x9d')](_0x1a04a2,_0x1a04a2[_0xd5e1('0xac')],_0x1a04a2[_0xd5e1('0x144')]);}}else if(_0x8f09bb&&_[_0xd5e1('0x69')](_0x8f09bb['statedesc'])&&_0x33d342['dialQueueProject']&&_0x1a04a2[_0xd5e1('0xac')]===_0x1a04a2[_0xd5e1('0xb1')]&&_[_0xd5e1('0x69')](_0x1a04a2['reason'])&&_0x1a04a2['cause']==='16'&&_0x1a04a2[_0xd5e1('0x146')]==='6'&&_[_0xd5e1('0xf0')](_0x8f09bb[_0xd5e1('0x147')])){if(_0x8f09bb[_0xd5e1('0xc5')]){rpcDb[_0xd5e1('0x112')](_0x8f09bb[_0xd5e1('0x140')]);}if(_0x8f09bb[_0xd5e1('0xab')]){rpcDb['disableContact'](_0x8f09bb[_0xd5e1('0x140')]);}_0x1a04a2[_0xd5e1('0xfa')]='22';this[_0xd5e1('0xef')](_0x8f09bb,_0x33d342,_0x1a04a2);}else if(_0x8f09bb&&_0x8f09bb['transfer']){if(_0x1a04a2[_0xd5e1('0x144')]==='16'&&this[_0xd5e1('0x15')][_0x1a04a2[_0xd5e1('0xac')]]['dialAnswer']){logger['info'](_0xd5e1('0x148'),_0x1a04a2[_0xd5e1('0xac')],_0x1a04a2['cause'],'\x20Queue',_0x33d342[_0xd5e1('0x26')],_0xd5e1('0x6e'),_0x33d342['pTalking']);this[_0xd5e1('0x9d')](_0x1a04a2,_0x1a04a2['linkedid'],_0x1a04a2[_0xd5e1('0x144')]);}else if(this['actions'][_0x1a04a2[_0xd5e1('0xac')]][_0xd5e1('0x6f')]){logger['info'](_0xd5e1('0x145'),_0x1a04a2[_0xd5e1('0xac')],_0x1a04a2[_0xd5e1('0x144')],_0xd5e1('0xb2'),_0x33d342[_0xd5e1('0x26')],'pTalking:\x20',_0x33d342[_0xd5e1('0x2a')]);this[_0xd5e1('0x9d')](_0x1a04a2,_0x1a04a2[_0xd5e1('0xac')],_0x1a04a2['cause']);}}};Preview[_0xd5e1('0xe')]['syncDialEnd']=function(_0x2451e2){if(this['actions'][_0x2451e2[_0xd5e1('0x149')]]&&_0x2451e2[_0xd5e1('0x149')]!==_0x2451e2[_0xd5e1('0x14a')]){this[_0xd5e1('0x9d')](_0x2451e2,_0x2451e2[_0xd5e1('0x149')],_0x2451e2[_0xd5e1('0xe4')]);}};Preview[_0xd5e1('0xe')][_0xd5e1('0x14b')]=function(_0x37450f){if(this[_0xd5e1('0x15')][_0x37450f[_0xd5e1('0xac')]]&&_0x37450f[_0xd5e1('0xac')]!==_0x37450f[_0xd5e1('0xb1')]&&!this[_0xd5e1('0x15')][_0x37450f[_0xd5e1('0xac')]][_0xd5e1('0x6f')]){if(_0x37450f[_0xd5e1('0x144')]==='1'){this['callProgressDetectingCustomer'](_0x37450f,_0x37450f[_0xd5e1('0xac')],_0x37450f[_0xd5e1('0x144')]);}}};Preview[_0xd5e1('0xe')][_0xd5e1('0x14c')]=function(_0x3628e9,_0x21b80b,_0x530815){if(this[_0xd5e1('0x15')][_0x3628e9]){if(_[_0xd5e1('0x69')](this[_0xd5e1('0x15')][_0x3628e9][_0xd5e1('0x14d')])){this['actions'][_0x3628e9][_0xd5e1('0x14d')]={};}this[_0xd5e1('0x15')][_0x3628e9]['variables'][_0x21b80b]=_0x530815;}};Preview[_0xd5e1('0xe')]['syncVarSet']=function(_0x15679a){try{if(!_[_0xd5e1('0x69')](_0x15679a)){if(ut[_0xd5e1('0x14e')](_[_0xd5e1('0x14f')](_0x15679a[_0xd5e1('0x150')])[0x0])){this['addVariable'](_0x15679a[_0xd5e1('0xb1')],_[_0xd5e1('0x14f')](_0x15679a[_0xd5e1('0x150')])[0x0],_0x15679a['value']);}}}catch(_0x3fbac4){logger['error']('[syncVarSet][Preview]',util[_0xd5e1('0x151')](_0x3fbac4,{'showHidden':![],'depth':null}));}};Preview[_0xd5e1('0xe')][_0xd5e1('0x21')]=function(_0x2a58eb){if(_0x2a58eb){if(this[_0xd5e1('0x15')][_0x2a58eb['transfertargetlinkedid']]){this['actions'][_0x2a58eb[_0xd5e1('0x152')]][_0xd5e1('0x147')]=!![];}}};Preview[_0xd5e1('0xe')]['syncBlindTransfer']=function(_0x1cece2){if(_0x1cece2){if(this['actions'][_0x1cece2[_0xd5e1('0x153')]]){this[_0xd5e1('0x15')][_0x1cece2[_0xd5e1('0x153')]][_0xd5e1('0x147')]=!![];}}};module[_0xd5e1('0x154')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 9e34240..e6bfeb6 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 _0xdbd5=['[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','catch','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','assigned','queuecallerexitreason','create'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xdbd5,0x123));var _0x5dbd=function(_0xb0fe92,_0x147e42){_0xb0fe92=_0xb0fe92-0x0;var _0x41787f=_0xdbd5[_0xb0fe92];return _0x41787f;};'use strict';var util=require(_0x5dbd('0x0'));var BPromise=require('bluebird');var logger=require(_0x5dbd('0x1'))(_0x5dbd('0x2'));var _=require(_0x5dbd('0x3'));var cmHopper=require(_0x5dbd('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x5dbd('0x5'));var cmHopperBlack=require(_0x5dbd('0x6'));var voiceQueueRt=require(_0x5dbd('0x7'));var agentReportPreview=require(_0x5dbd('0x8'));var voiceQueueReport=require(_0x5dbd('0x9'));function loggerCatch(_0x4b384e){return function(_0x7388a0){logger[_0x5dbd('0xa')](_0x4b384e,util[_0x5dbd('0xb')](_0x7388a0,{'showHidden':![],'depth':null}));};}function create(_0x2082c2){return BPromise[_0x5dbd('0xc')]()[_0x5dbd('0xd')](cmHopperHistory['createHistory'](_0x2082c2))[_0x5dbd('0xe')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x4015f8){return BPromise[_0x5dbd('0xc')]()[_0x5dbd('0xd')](agentReportPreview[_0x5dbd('0xf')](_0x4015f8))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5160aa){return BPromise['resolve']()[_0x5dbd('0xd')](cmHopper[_0x5dbd('0x10')](_0x5160aa,!![]))['catch'](loggerCatch(_0x5dbd('0x11')));}exports[_0x5dbd('0x12')]=function(_0x221aab){return BPromise['resolve']()[_0x5dbd('0xd')](cmHopperBlack[_0x5dbd('0x12')](_0x221aab))[_0x5dbd('0xe')](loggerCatch(_0x5dbd('0x13')));};exports[_0x5dbd('0x14')]=function(_0x1158d2){return BPromise[_0x5dbd('0xc')]()[_0x5dbd('0xd')](cmHopper['getContactPreview'](_0x1158d2))[_0x5dbd('0xe')](loggerCatch(_0x5dbd('0x15')));};exports['createHistory']=function(_0x44e41a,_0x10c188){create(_0x44e41a)['catch'](loggerCatch(_0x10c188));moveContact(_0x44e41a)['catch'](loggerCatch(_0x10c188));};exports[_0x5dbd('0x16')]=function(_0x49262d,_0x328b58){createAgent(_0x49262d)[_0x5dbd('0xe')](loggerCatch(_0x328b58));};exports[_0x5dbd('0x17')]=function(_0x43ca42,_0x344898){create(_0x43ca42)[_0x5dbd('0xe')](loggerCatch(_0x344898));};exports[_0x5dbd('0x18')]=function(_0x35e961,_0x8a3c96){moveContact(_0x35e961)['catch'](loggerCatch(_0x8a3c96));};exports['rescheduleContact']=function(_0x592db1,_0x38997e,_0x23a8f4){if(_0x38997e){_0x592db1[_0x5dbd('0x19')]=null;}if(_0x23a8f4){_0x592db1[_0x5dbd('0x1a')]=![];}return BPromise['resolve']()[_0x5dbd('0xd')](cmHopper['rescheduleContact'](_0x592db1))[_0x5dbd('0xe')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x5dbd('0x1b')]=function(_0x17ffca){return BPromise[_0x5dbd('0xc')]()['then'](cmHopper['countReScheduled'](_0x17ffca))[_0x5dbd('0xe')](loggerCatch(_0x5dbd('0x1c')));};exports[_0x5dbd('0x1d')]=function(_0x65cf17){return BPromise[_0x5dbd('0xc')]()[_0x5dbd('0xd')](cmHopper['unlockContact']({'UserId':null},_0x65cf17,0x1))[_0x5dbd('0xe')](loggerCatch(_0x5dbd('0x1e')));};exports['disableContact']=function(_0x360da0){return BPromise[_0x5dbd('0xc')]()['then'](cmHopper[_0x5dbd('0x1d')]({'active':![]},_0x360da0,0x1))[_0x5dbd('0xe')](loggerCatch(_0x5dbd('0x1f')));};exports[_0x5dbd('0x20')]=function(_0x3eea53){var _0x26be25={};_0x26be25[_0x5dbd('0x21')]=_0x3eea53[_0x5dbd('0x21')];_0x26be25[_0x5dbd('0x22')]=_0x3eea53[_0x5dbd('0x22')];_0x26be25[_0x5dbd('0x23')]=_0x3eea53[_0x5dbd('0x23')];_0x26be25[_0x5dbd('0x24')]=_0x3eea53[_0x5dbd('0x24')];_0x26be25[_0x5dbd('0x25')]=_0x3eea53[_0x5dbd('0x25')];_0x26be25['queuecallerjoinAt']=_0x3eea53[_0x5dbd('0x26')];_0x26be25[_0x5dbd('0x27')]=_0x3eea53[_0x5dbd('0x26')];_0x26be25[_0x5dbd('0x28')]=0x1;_0x26be25[_0x5dbd('0x29')]=_0x3eea53[_0x5dbd('0x2a')];_0x26be25[_0x5dbd('0x2b')]=_0x3eea53[_0x5dbd('0x2c')];_0x26be25[_0x5dbd('0x2d')]=_0x5dbd('0x2e');_0x26be25['exten']=_0x5dbd('0x2f');_0x26be25['holdtime']=0x0;_0x26be25[_0x5dbd('0x30')]=0x1;_0x26be25['lastAssignedTo']=_0x3eea53[_0x5dbd('0x2c')];_0x26be25[_0x5dbd('0x31')]='COMPLETED';return BPromise[_0x5dbd('0xc')]()[_0x5dbd('0xd')](voiceQueueReport[_0x5dbd('0x32')](_0x26be25))[_0x5dbd('0xe')](loggerCatch(_0x5dbd('0x33')));};exports['getContactRecallMe']=function(_0x1d0790,_0x28d89a){return BPromise[_0x5dbd('0xc')]()[_0x5dbd('0xd')](cmHopper[_0x5dbd('0x34')](_0x1d0790,_0x28d89a))[_0x5dbd('0xe')](loggerCatch(_0x5dbd('0x35')));};exports[_0x5dbd('0x36')]=function(_0x5d29fe){return BPromise[_0x5dbd('0xc')]()[_0x5dbd('0xd')](cmHopper[_0x5dbd('0x37')](_0x5d29fe,!![],!![]))[_0x5dbd('0xe')](loggerCatch(_0x5dbd('0x38')));}; \ No newline at end of file +var _0xfeb5=['../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xfeb5,0x16d));var _0x5feb=function(_0x43cc69,_0x401eea){_0x43cc69=_0x43cc69-0x0;var _0xde43ae=_0xfeb5[_0x43cc69];return _0xde43ae;};'use strict';var util=require(_0x5feb('0x0'));var BPromise=require(_0x5feb('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0x5feb('0x2'));var cmHopper=require(_0x5feb('0x3'));var cmHopperFinal=require(_0x5feb('0x4'));var cmHopperHistory=require(_0x5feb('0x5'));var cmHopperBlack=require(_0x5feb('0x6'));var voiceQueueRt=require(_0x5feb('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x5feb('0x8'));function loggerCatch(_0xf42ab1){return function(_0x44f6c3){logger['error'](_0xf42ab1,util[_0x5feb('0x9')](_0x44f6c3,{'showHidden':![],'depth':null}));};}function create(_0xd70d9b){return BPromise[_0x5feb('0xa')]()[_0x5feb('0xb')](cmHopperHistory[_0x5feb('0xc')](_0xd70d9b))[_0x5feb('0xd')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x2e4fbe){return BPromise[_0x5feb('0xa')]()[_0x5feb('0xb')](agentReportPreview[_0x5feb('0xc')](_0x2e4fbe))['catch'](loggerCatch(_0x5feb('0xe')));}function moveContact(_0x1e3410){return BPromise['resolve']()['then'](cmHopper[_0x5feb('0xf')](_0x1e3410,!![]))[_0x5feb('0xd')](loggerCatch(_0x5feb('0x10')));}exports['checkIsBlackList']=function(_0x25ac1c){return BPromise['resolve']()[_0x5feb('0xb')](cmHopperBlack['checkIsBlackList'](_0x25ac1c))[_0x5feb('0xd')](loggerCatch(_0x5feb('0x11')));};exports[_0x5feb('0x12')]=function(_0x182509){return BPromise[_0x5feb('0xa')]()[_0x5feb('0xb')](cmHopper[_0x5feb('0x12')](_0x182509))[_0x5feb('0xd')](loggerCatch(_0x5feb('0x13')));};exports[_0x5feb('0xc')]=function(_0x2f0308,_0x35e23f){create(_0x2f0308)[_0x5feb('0xd')](loggerCatch(_0x35e23f));moveContact(_0x2f0308)['catch'](loggerCatch(_0x35e23f));};exports[_0x5feb('0x14')]=function(_0xeec051,_0x5fe1a4){createAgent(_0xeec051)[_0x5feb('0xd')](loggerCatch(_0x5fe1a4));};exports['createCustomerHistory']=function(_0x2f0a32,_0x19539f){create(_0x2f0a32)[_0x5feb('0xd')](loggerCatch(_0x19539f));};exports['createCustomerFinal']=function(_0x52f227,_0x1357ab){moveContact(_0x52f227)[_0x5feb('0xd')](loggerCatch(_0x1357ab));};exports[_0x5feb('0x15')]=function(_0xe6f69c,_0x3bedd5,_0x3889d0){if(_0x3bedd5){_0xe6f69c['UserId']=null;}if(_0x3889d0){_0xe6f69c[_0x5feb('0x16')]=![];}return BPromise['resolve']()[_0x5feb('0xb')](cmHopper[_0x5feb('0x15')](_0xe6f69c))['catch'](loggerCatch(_0x5feb('0x17')));};exports[_0x5feb('0x18')]=function(_0x1719a4){return BPromise[_0x5feb('0xa')]()[_0x5feb('0xb')](cmHopper[_0x5feb('0x18')](_0x1719a4))[_0x5feb('0xd')](loggerCatch(_0x5feb('0x19')));};exports[_0x5feb('0x1a')]=function(_0x29b9e8){return BPromise[_0x5feb('0xa')]()[_0x5feb('0xb')](cmHopper['unlockContact']({'UserId':null},_0x29b9e8,0x1))[_0x5feb('0xd')](loggerCatch(_0x5feb('0x1b')));};exports['disableContact']=function(_0x4ea881){return BPromise['resolve']()[_0x5feb('0xb')](cmHopper[_0x5feb('0x1a')]({'active':![]},_0x4ea881,0x1))[_0x5feb('0xd')](loggerCatch(_0x5feb('0x1c')));};exports[_0x5feb('0x1d')]=function(_0x544d95){var _0x3ae62d={};_0x3ae62d[_0x5feb('0x1e')]=_0x544d95[_0x5feb('0x1e')];_0x3ae62d['uniqueid']=_0x544d95[_0x5feb('0x1f')];_0x3ae62d[_0x5feb('0x20')]=_0x544d95[_0x5feb('0x20')];_0x3ae62d['calleridname']=_0x544d95[_0x5feb('0x21')];_0x3ae62d[_0x5feb('0x22')]=_0x544d95[_0x5feb('0x22')];_0x3ae62d[_0x5feb('0x23')]=_0x544d95[_0x5feb('0x24')];_0x3ae62d[_0x5feb('0x25')]=_0x544d95[_0x5feb('0x24')];_0x3ae62d['queuecallercomplete']=0x1;_0x3ae62d[_0x5feb('0x26')]=_0x544d95['endtime'];_0x3ae62d[_0x5feb('0x27')]=_0x544d95[_0x5feb('0x28')];_0x3ae62d[_0x5feb('0x29')]=_0x5feb('0x2a');_0x3ae62d[_0x5feb('0x2b')]='xcally-motion-preview';_0x3ae62d[_0x5feb('0x2c')]=0x0;_0x3ae62d[_0x5feb('0x2d')]=0x1;_0x3ae62d[_0x5feb('0x2e')]=_0x544d95['membername'];_0x3ae62d[_0x5feb('0x2f')]=_0x5feb('0x30');return BPromise[_0x5feb('0xa')]()[_0x5feb('0xb')](voiceQueueReport['create'](_0x3ae62d))[_0x5feb('0xd')](loggerCatch(_0x5feb('0x31')));};exports[_0x5feb('0x32')]=function(_0x2d1f78,_0x4398a1){return BPromise[_0x5feb('0xa')]()[_0x5feb('0xb')](cmHopper['getContactRecallMe'](_0x2d1f78,_0x4398a1))[_0x5feb('0xd')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x5feb('0x33')]=function(_0x482fe8){return BPromise['resolve']()[_0x5feb('0xb')](cmHopper['rescheduleContact'](_0x482fe8,!![],!![]))[_0x5feb('0xd')](loggerCatch(_0x5feb('0x34')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index d9cd05f..adcc81d 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 _0x1baa=['Blacklist','starttime','responsetime','endtime','logAgent','logLookAgent','membername','UserId','logCustomer','ringtime','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','Global','scheduledAt','active','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','motionChannel','voice','mandatoryDisposition','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countbusyretry','countglobal','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','preview','env','127.0.0.1','milliseconds','diff','seconds','loggerCatch','inspect','info','error','logger2','getCallerId','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','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','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x1baa,0x181));var _0xa1ba=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1baa[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0xa1ba('0x0'));var _=require(_0xa1ba('0x1'));var moment=require(_0xa1ba('0x2'));var logger=require('../../../../config/logger')(_0xa1ba('0x3'));var ipAgi=process[_0xa1ba('0x4')]['XCALLY_IP_AGI']||_0xa1ba('0x5');function getSeconds(_0x1929e1,_0x2bf40f){var _0x46cf44=moment(_0x1929e1)[_0xa1ba('0x6')](0x0);var _0x4ede17=moment(_0x2bf40f)[_0xa1ba('0x6')](0x0);return _0x46cf44[_0xa1ba('0x7')](_0x4ede17,_0xa1ba('0x8'));}exports[_0xa1ba('0x9')]=function(_0x2c982f){return function(_0x1708b0){logger['error'](_0x2c982f,util[_0xa1ba('0xa')](_0x1708b0,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5cfc07,_0xf3d69){logger[_0xa1ba('0xb')](_0x5cfc07,util[_0xa1ba('0xa')](_0xf3d69,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x4853aa,_0x5dd138){logger[_0xa1ba('0xc')](_0x4853aa,util[_0xa1ba('0xa')](_0x5dd138,{'showHidden':![],'depth':null}));};exports[_0xa1ba('0xd')]=function(_0x2cd629){return function(_0x3ca75c){logger[_0xa1ba('0xb')](_0x2cd629,util[_0xa1ba('0xa')](_0x3ca75c,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x2ec6f1,_0x7bd6b7,_0x3b68c0){return{'message':_0x2ec6f1,'unlock':_0x7bd6b7,'active':_0x3b68c0};};exports[_0xa1ba('0xe')]=function(_0x1d50e1,_0x363be1,_0x38baa){if(!_[_0xa1ba('0xf')](_0x38baa)&&'string'===typeof _0x38baa&&!_[_0xa1ba('0x10')](_0x38baa)){if(!_[_0xa1ba('0xf')](_0x363be1)&&'string'===typeof _0x363be1&&!_['isEmpty'](_0x363be1)){return util[_0xa1ba('0x11')](_0xa1ba('0x12'),_0x363be1,_0x38baa);}return util['format'](_0xa1ba('0x12'),_0x38baa,_0x38baa);}if(!_[_0xa1ba('0xf')](_0x1d50e1)&&_0xa1ba('0x13')===typeof _0x1d50e1&&!_[_0xa1ba('0x10')](_0x1d50e1)){return _0x1d50e1;}return _0xa1ba('0x14');};exports[_0xa1ba('0x15')]=function(_0x33a46e){if(_[_0xa1ba('0x16')](_0x33a46e)){return![];}return _0x33a46e;};exports[_0xa1ba('0x17')]=function(_0x745568,_0x514b4c,_0x26985a,_0x504107,_0x29940f,_0x4f6697){var _0xbc0640={'XMD-QUEUE':_0x514b4c['Queue']?_0x514b4c[_0xa1ba('0x18')]['name']:'','XMD-CALLERID':_0x504107,'XMD-CALLERID-PREVIEW':_0x4f6697?util['format'](_0xa1ba('0x12'),_0x4f6697[_0xa1ba('0x19')],_0x4f6697[_0xa1ba('0x1a')]):_0x504107,'XMD-DIALID':_0x29940f,'XMD-CONTACTID':_0x514b4c[_0xa1ba('0x1b')],'XMD-CDRTYPE':_0xa1ba('0x1c'),'CALLERID(all)':_0x504107,'XMD-VOICEQUEUEID':_0x514b4c[_0xa1ba('0x1d')],'XMD-DIALCHANNEL':_0x26985a,'XMD-DIALTIMEOUT':_0x745568[_0xa1ba('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xa1ba('0x11')](_0xa1ba('0x1f'),_0x745568[_0xa1ba('0x20')]?'g':'',_[_0xa1ba('0x10')](_0x745568[_0xa1ba('0x21')])?'':_0xa1ba('0x22')),'XMD-DIALURL':_0x745568[_0xa1ba('0x23')]||'','XMD-AGI':_0x745568[_0xa1ba('0x24')]?util[_0xa1ba('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x745568[_0xa1ba('0x24')]):_0xa1ba('0x25'),'XMD-AGIAFTER':_0x745568[_0xa1ba('0x20')]?util[_0xa1ba('0x11')](_0xa1ba('0x26'),ipAgi,_0x745568[_0xa1ba('0x20')]):_0xa1ba('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x4f6697?_0x4f6697[_0xa1ba('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x4f6697?_0x4f6697[_0xa1ba('0x28')]:'','XMD-DESTINATION':_0xa1ba('0x29')};if(!_[_0xa1ba('0x10')](_0x745568[_0xa1ba('0x21')])){_0xbc0640[util[_0xa1ba('0x11')]('%s',_0xa1ba('0x2a'))]=_0x745568[_0xa1ba('0x21')];_0xbc0640[util[_0xa1ba('0x11')]('%s',_0xa1ba('0x2b'))]=_0x29940f;}if(_0x514b4c&&_0x514b4c[_0xa1ba('0x2c')]){for(var _0x5f1d5a in _0x514b4c[_0xa1ba('0x2c')]){if(_0x514b4c[_0xa1ba('0x2c')][_0xa1ba('0x2d')](_0x5f1d5a)){if(!_['isNil'](_0x514b4c['Contact'][_0x5f1d5a])&&_0x5f1d5a!=='id'&&_0x5f1d5a!==_0xa1ba('0x2e')&&_0x5f1d5a!==_0xa1ba('0x2f')&&_0x5f1d5a!==_0xa1ba('0x30')){_0xbc0640[util['format'](_0xa1ba('0x31'),_0xa1ba('0x32'),_[_0xa1ba('0x33')](_0x5f1d5a))]=_0x514b4c[_0xa1ba('0x2c')][_0x5f1d5a];}}}}return _0xbc0640;};exports[_0xa1ba('0x34')]=function(_0x11c114){var _0x353d43={};for(var _0x34e0d1 in _0x11c114){if(_0x11c114[_0xa1ba('0x2d')](_0x34e0d1)){_0x353d43[util[_0xa1ba('0x11')]('%s',_[_0xa1ba('0x35')](_0x34e0d1))]=_0x11c114[_0x34e0d1];}}return{'variables':_0x353d43};};exports[_0xa1ba('0x36')]=function(_0xc00560,_0x45566f){if(!_[_0xa1ba('0x16')](_0xc00560)){if(_0xc00560[_0xa1ba('0x2d')](_0xa1ba('0x37'))){if(_0xc00560[_0xa1ba('0x37')]>0x0){_0xc00560['originated']-=0x1;}else{logger[_0xa1ba('0xc')](_0xa1ba('0x38'),_0x45566f);}}}else{logger['error'](_0xa1ba('0x39'),_0x45566f);}};exports[_0xa1ba('0x3a')]=function(_0x41650c){var _0x35ceb9=moment()[_0xa1ba('0x11')](_0xa1ba('0x3b'));_0x41650c[_0xa1ba('0x3c')]=0xd;_0x41650c[_0xa1ba('0x3d')]=_0xa1ba('0x3e');_0x41650c[_0xa1ba('0x3f')]=_0x35ceb9;_0x41650c[_0xa1ba('0x40')]=_0x35ceb9;_0x41650c[_0xa1ba('0x41')]=_0x35ceb9;};exports[_0xa1ba('0x42')]=function(_0x117b56,_0x4b215e,_0x170aba){var _0x56aad3=moment()[_0xa1ba('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x117b56[_0xa1ba('0x3c')]=_0x4b215e;_0x117b56[_0xa1ba('0x3d')]=_0x170aba;_0x117b56['responsetime']=_0x56aad3;_0x117b56['ringtime']=getSeconds(_0x117b56[_0xa1ba('0x40')],_0x117b56[_0xa1ba('0x3f')]);};exports[_0xa1ba('0x43')]=function(_0x4a27e8,_0x4cc15b,_0x2de840){_0x4a27e8[_0xa1ba('0x44')]=_0x4cc15b;_0x4a27e8[_0xa1ba('0x45')]=_0x2de840;};exports[_0xa1ba('0x46')]=function(_0x22f76c,_0x450ada,_0x2bbcbc){var _0x5d8b95=moment()[_0xa1ba('0x11')](_0xa1ba('0x3b'));_0x22f76c[_0xa1ba('0x3c')]=_0x450ada;_0x22f76c['statedesc']=_0x2bbcbc;_0x22f76c[_0xa1ba('0x40')]=_0x22f76c['responsetime']?_0x22f76c[_0xa1ba('0x40')]:_0x5d8b95;_0x22f76c['endtime']=_0x22f76c['endtime']?_0x22f76c[_0xa1ba('0x41')]:_0x5d8b95;_0x22f76c[_0xa1ba('0x47')]=getSeconds(_0x22f76c[_0xa1ba('0x40')]||0x0,_0x22f76c[_0xa1ba('0x3f')]||0x0);_0x22f76c[_0xa1ba('0x48')]=_0x22f76c[_0xa1ba('0x49')]?getSeconds(_0x22f76c[_0xa1ba('0x41')],_0x22f76c[_0xa1ba('0x49')]):0x0;};exports[_0xa1ba('0x4a')]=function(_0x213a15){return _0x213a15===_0xa1ba('0x4b');};exports['variablesAction']=function(_0x343808,_0x772f15,_0x493504,_0x5b362c,_0x56fb90){var _0x46cf7b=_0x5b362c?_0xa1ba('0x4c'):_0x343808[_0xa1ba('0x19')];_0x46cf7b=_0x56fb90?_0xa1ba('0x4d'):_0x46cf7b;return{'actionid':_0x343808[_0xa1ba('0x4e')],'action':_0xa1ba('0x4f'),'channel':_0x343808[_0xa1ba('0x50')],'callerid':util[_0xa1ba('0x11')](_0xa1ba('0x12'),_0x46cf7b,_0x343808['calleridnum']),'Exten':_0xa1ba('0x29'),'Context':_0xa1ba('0x51'),'Priority':'1','variable':_0x493504,'timeout':(_0x772f15[_0xa1ba('0x52')]||0x1e)*0x3e8,'async':!![],'channelid':_0x343808[_0xa1ba('0x4e')]};};exports['totalGlobal']=function(_0x3d96cb){return _0x3d96cb['countbusyretry']+_0x3d96cb[_0xa1ba('0x53')]+_0x3d96cb[_0xa1ba('0x54')]+_0x3d96cb[_0xa1ba('0x55')]+_0x3d96cb['countnosuchnumberretry'];};exports[_0xa1ba('0x56')]=function(_0x20dd65){var _0x161a97=_['clone'](_0x20dd65);_0x161a97[_0xa1ba('0x3c')]=0xf;_0x161a97[_0xa1ba('0x3d')]=_0xa1ba('0x57');return _0x161a97;};exports[_0xa1ba('0x58')]=function(_0x3957ca,_0x4969e6,_0x5b2069){var _0x42946c={};_0x42946c[_0x4969e6]=_0x3957ca[_0x4969e6];_0x42946c[_0xa1ba('0x59')]=![];_0x42946c[_0xa1ba('0x5a')]=moment()[_0xa1ba('0x5b')](_0x5b2069,_0xa1ba('0x5c'))[_0xa1ba('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x42946c[_0xa1ba('0x1b')]=_0x3957ca['ContactId'];_0x42946c[_0xa1ba('0x5d')]=_0x3957ca[_0xa1ba('0x5d')];_0x42946c['VoiceQueueId']=_0x3957ca[_0xa1ba('0x1d')]||undefined;return _0x42946c;};exports['decrementTalkink']=function(_0x559057,_0x3a1157){if(!_[_0xa1ba('0x16')](_0x559057)){if(_0x559057[_0xa1ba('0x5e')]>0x0){_0x559057[_0xa1ba('0x5e')]-=0x1;}else{logger[_0xa1ba('0xc')](_0x3a1157,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xa1ba('0xc')](_0x3a1157,_0xa1ba('0x5f'));}};exports[_0xa1ba('0x60')]=function(_0x1508fb){if(_0x1508fb<=0x0){return!![];}return![];};exports[_0xa1ba('0x61')]=function(_0x2fd84c,_0x24c5e2,_0x16e945){_0x2fd84c[_0xa1ba('0x62')]=_0x24c5e2;_0x2fd84c[_0xa1ba('0x63')]=_0x2fd84c[_0xa1ba('0x64')];_0x2fd84c['interface']=_0x2fd84c[_0xa1ba('0x50')];_0x2fd84c[_0xa1ba('0x65')]=_0xa1ba('0x66');if(_0x16e945){_0x2fd84c[_0xa1ba('0x67')]=_0x16e945['mandatoryDisposition'];}return _0x2fd84c;};exports['buildAcw']=function(_0x4b2dbf){var _0x6a1db2={};_0x6a1db2[_0xa1ba('0x64')]=_0x4b2dbf[_0xa1ba('0x64')];_0x6a1db2[_0xa1ba('0x68')]=_0x4b2dbf['channelAgent'];_0x6a1db2[_0xa1ba('0x4e')]=_0x4b2dbf[_0xa1ba('0x4e')];return _0x6a1db2;};exports[_0xa1ba('0x69')]=function(_0x2629ba){var _0x3aea47=[];for(var _0xbc437d in _0x2629ba){if(_0x2629ba[_0xa1ba('0x2d')](_0xbc437d)){if(!_[_0xa1ba('0x16')](_0x2629ba[_0xbc437d])&&_0x2629ba[_0xbc437d]['state']===_0xa1ba('0x6a')&&_0x2629ba[_0xbc437d][_0xa1ba('0x6b')]===_0xa1ba('0x6c')){_0x3aea47[_0xa1ba('0x6d')](_0x2629ba[_0xbc437d]['id']);}}}return _0x3aea47;};exports[_0xa1ba('0x6e')]=function(_0x4ebabb){var _0x31a395=moment()[_0xa1ba('0x6')](0x0);var _0x5b0389=moment(_0x4ebabb)[_0xa1ba('0x6')](0x0);return _0x31a395[_0xa1ba('0x7')](_0x5b0389,_0xa1ba('0x8'));};exports[_0xa1ba('0x6f')]=function(_0x2cd545){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2cd545[_0xa1ba('0x1b')],'ListId':_0x2cd545[_0xa1ba('0x5d')],'VoiceQueueId':_0x2cd545[_0xa1ba('0x1d')]||undefined,'CampaignId':_0x2cd545[_0xa1ba('0x70')]||undefined};};exports[_0xa1ba('0x71')]=function(_0x58abbe){if(_0x58abbe===_0xa1ba('0x4e')||_0x58abbe===_0xa1ba('0x72')||_0x58abbe===_0xa1ba('0x64')||_0x58abbe===_0xa1ba('0x73')||_0x58abbe===_0xa1ba('0x74')||_0x58abbe===_0xa1ba('0x75')||_0x58abbe===_0xa1ba('0x44')||_0x58abbe===_0xa1ba('0x50')||_0x58abbe===_0xa1ba('0x19')||_0x58abbe===_0xa1ba('0x59')||_0x58abbe===_0xa1ba('0x1a')||_0x58abbe===_0xa1ba('0x5a')||_0x58abbe===_0xa1ba('0x76')||_0x58abbe===_0xa1ba('0x53')||_0x58abbe==='countnoanswerretry'||_0x58abbe===_0xa1ba('0x77')||_0x58abbe==='callback'||_0x58abbe===_0xa1ba('0x78')||_0x58abbe===_0xa1ba('0x79')||_0x58abbe===_0xa1ba('0x7a')||_0x58abbe===_0xa1ba('0x1b')||_0x58abbe===_0xa1ba('0x5d')||_0x58abbe===_0xa1ba('0x45')||_0x58abbe===_0xa1ba('0x1d')||_0x58abbe==='sipcallid'||_0x58abbe===_0xa1ba('0x7b')||_0x58abbe===_0xa1ba('0x7c')||_0x58abbe===_0xa1ba('0x7d')||_0x58abbe==='xmd-listid'||_0x58abbe===_0xa1ba('0x7e')||_0x58abbe===_0xa1ba('0x7f')||_0x58abbe===_0xa1ba('0x80')||_0x58abbe===_0xa1ba('0x81')||_0x58abbe==='xmd-dialchannel'||_0x58abbe===_0xa1ba('0x82')||_0x58abbe===_0xa1ba('0x83')||_0x58abbe===_0xa1ba('0x84')||_0x58abbe==='xmd-agiafter'||_0x58abbe==='xmd-agi'||_0x58abbe==='rtpaudioqos'||_0x58abbe===_0xa1ba('0x85')||_0x58abbe===_0xa1ba('0x86')||_0x58abbe==='rtpaudioqosjitterbridged'||_0x58abbe==='rtpaudioqosloss'||_0x58abbe==='rtpaudioqoslossbridged'||_0x58abbe===_0xa1ba('0x87')||_0x58abbe===_0xa1ba('0x88')||_0x58abbe===_0xa1ba('0x89')||_0x58abbe===_0xa1ba('0x85')||_0x58abbe==='rtpaudioqosjitter'||_0x58abbe===_0xa1ba('0x8a')||_0x58abbe===_0xa1ba('0x8b')||_0x58abbe===_0xa1ba('0x8c')||_0x58abbe==='rtpaudioqosrtt'||_0x58abbe===_0xa1ba('0x88')||_0x58abbe===_0xa1ba('0x8d')||_0x58abbe===_0xa1ba('0x8e')||_0x58abbe==='state'||_0x58abbe==='statedesc'){return![];}return!![];};exports[_0xa1ba('0x8f')]=function(_0x249f5b,_0x3611a7){var _0x3ac1c5,_0x58fd2c,_0x387361;if(_0x3611a7<=0x0){_0x3611a7=0x1;}_0x3ac1c5=new RegExp('\x5cw{0,'+_0x3611a7+'}$');_0x58fd2c=Math['pow'](0xa,_0x3611a7-0x1);_0x387361=Math[_0xa1ba('0x90')](0xa,_0x3611a7)-0x1;return util[_0xa1ba('0x11')]('%s',_[_0xa1ba('0x91')](_0x249f5b,_0x3ac1c5,_['random'](_0x58fd2c,_0x387361)));};exports[_0xa1ba('0x92')]=function(_0x385b5e){var _0x1216d6=_0x385b5e[_0xa1ba('0x93')](/"(.*?)"/);return _0x1216d6?_0x1216d6[0x1]:_0x385b5e;};exports[_0xa1ba('0x94')]=function(_0x3541d7){var _0x5b0278=_0x3541d7[_0xa1ba('0x93')](/<(.*?)>/);return _0x5b0278?_0x5b0278[0x1]:_0x3541d7;}; \ No newline at end of file +var _0x7899=['ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','buildObj','queue','interface','channelAgent','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','membername','active','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','UserId','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','moment','../../../../config/logger','preview','env','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','%s%s','toUpper','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','starttime','logAgent','statedesc','responsetime','logLookAgent','logCustomer','endtime','ringtime','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','from-sip','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledat','minutes'];(function(_0x4914ad,_0x1d2474){var _0x5b8171=function(_0x243122){while(--_0x243122){_0x4914ad['push'](_0x4914ad['shift']());}};_0x5b8171(++_0x1d2474);}(_0x7899,0xc2));var _0x9789=function(_0x2d1971,_0x20b764){_0x2d1971=_0x2d1971-0x0;var _0x4d7759=_0x7899[_0x2d1971];return _0x4d7759;};'use strict';var util=require(_0x9789('0x0'));var _=require('lodash');var moment=require(_0x9789('0x1'));var logger=require(_0x9789('0x2'))(_0x9789('0x3'));var ipAgi=process[_0x9789('0x4')]['XCALLY_IP_AGI']||_0x9789('0x5');function getSeconds(_0x5d7a83,_0x458c0f){var _0x529522=moment(_0x5d7a83)[_0x9789('0x6')](0x0);var _0x5a10e4=moment(_0x458c0f)[_0x9789('0x6')](0x0);return _0x529522[_0x9789('0x7')](_0x5a10e4,_0x9789('0x8'));}exports[_0x9789('0x9')]=function(_0x43558d){return function(_0x40d99b){logger[_0x9789('0xa')](_0x43558d,util[_0x9789('0xb')](_0x40d99b,{'showHidden':![],'depth':null}));};};exports[_0x9789('0xc')]=function(_0x53f4cd,_0x5bc445){logger['info'](_0x53f4cd,util[_0x9789('0xb')](_0x5bc445,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x559d7b,_0x386b5e){logger[_0x9789('0xa')](_0x559d7b,util[_0x9789('0xb')](_0x386b5e,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x4f937e){return function(_0xb31623){logger[_0x9789('0xd')](_0x4f937e,util[_0x9789('0xb')](_0xb31623,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x16a88a,_0x324a02,_0x4e7e52){return{'message':_0x16a88a,'unlock':_0x324a02,'active':_0x4e7e52};};exports['getCallerId']=function(_0x5bf23a,_0x212ee0,_0x291655){if(!_[_0x9789('0xe')](_0x291655)&&'string'===typeof _0x291655&&!_[_0x9789('0xf')](_0x291655)){if(!_[_0x9789('0xe')](_0x212ee0)&&_0x9789('0x10')===typeof _0x212ee0&&!_[_0x9789('0xf')](_0x212ee0)){return util[_0x9789('0x11')](_0x9789('0x12'),_0x212ee0,_0x291655);}return util[_0x9789('0x11')]('\x22%s\x22\x20<%s>',_0x291655,_0x291655);}if(!_[_0x9789('0xe')](_0x5bf23a)&&_0x9789('0x10')===typeof _0x5bf23a&&!_[_0x9789('0xf')](_0x5bf23a)){return _0x5bf23a;}return _0x9789('0x13');};exports[_0x9789('0x14')]=function(_0x501535){if(_[_0x9789('0x15')](_0x501535)){return![];}return _0x501535;};exports['addVariables']=function(_0x37c0c9,_0x84c5e1,_0xd1fe3f,_0xb4e30,_0x4afeea,_0xd73909){var _0x2f38e8={'XMD-QUEUE':_0x84c5e1[_0x9789('0x16')]?_0x84c5e1['Queue'][_0x9789('0x17')]:'','XMD-CALLERID':_0xb4e30,'XMD-CALLERID-PREVIEW':_0xd73909?util[_0x9789('0x11')](_0x9789('0x12'),_0xd73909[_0x9789('0x18')],_0xd73909[_0x9789('0x19')]):_0xb4e30,'XMD-DIALID':_0x4afeea,'XMD-CONTACTID':_0x84c5e1[_0x9789('0x1a')],'XMD-CDRTYPE':_0x9789('0x1b'),'CALLERID(all)':_0xb4e30,'XMD-VOICEQUEUEID':_0x84c5e1[_0x9789('0x1c')],'XMD-DIALCHANNEL':_0xd1fe3f,'XMD-DIALTIMEOUT':_0x37c0c9[_0x9789('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x9789('0x11')](_0x9789('0x1e'),_0x37c0c9[_0x9789('0x1f')]?'g':'',_[_0x9789('0xf')](_0x37c0c9['monitor_format'])?'':_0x9789('0x20')),'XMD-DIALURL':_0x37c0c9[_0x9789('0x21')]||'','XMD-AGI':_0x37c0c9['dialQueueProject']?util[_0x9789('0x11')](_0x9789('0x22'),ipAgi,_0x37c0c9['dialQueueProject']):_0x9789('0x23'),'XMD-AGIAFTER':_0x37c0c9[_0x9789('0x1f')]?util[_0x9789('0x11')](_0x9789('0x22'),ipAgi,_0x37c0c9[_0x9789('0x1f')]):_0x9789('0x23'),'XMD-ORIGINATECALLERIDNUM':_0xd73909?_0xd73909['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0xd73909?_0xd73909[_0x9789('0x24')]:'','XMD-DESTINATION':_0x9789('0x25')};if(!_[_0x9789('0xf')](_0x37c0c9[_0x9789('0x26')])){_0x2f38e8[util[_0x9789('0x11')]('%s',_0x9789('0x27'))]=_0x37c0c9[_0x9789('0x26')];_0x2f38e8[util['format']('%s',_0x9789('0x28'))]=_0x4afeea;}if(_0x84c5e1&&_0x84c5e1[_0x9789('0x29')]){for(var _0x2de00f in _0x84c5e1[_0x9789('0x29')]){if(_0x84c5e1['Contact']['hasOwnProperty'](_0x2de00f)){if(!_[_0x9789('0x15')](_0x84c5e1[_0x9789('0x29')][_0x2de00f])&&_0x2de00f!=='id'&&_0x2de00f!==_0x9789('0x2a')&&_0x2de00f!=='createdAt'&&_0x2de00f!=='updatedAt'){_0x2f38e8[util[_0x9789('0x11')](_0x9789('0x2b'),'XMD-',_[_0x9789('0x2c')](_0x2de00f))]=_0x84c5e1[_0x9789('0x29')][_0x2de00f];}}}}return _0x2f38e8;};exports[_0x9789('0x2d')]=function(_0x4fece3){var _0x49c194={};for(var _0x2d5877 in _0x4fece3){if(_0x4fece3[_0x9789('0x2e')](_0x2d5877)){_0x49c194[util['format']('%s',_[_0x9789('0x2f')](_0x2d5877))]=_0x4fece3[_0x2d5877];}}return{'variables':_0x49c194};};exports[_0x9789('0x30')]=function(_0x15279b,_0x397a4c){if(!_[_0x9789('0x15')](_0x15279b)){if(_0x15279b[_0x9789('0x2e')](_0x9789('0x31'))){if(_0x15279b[_0x9789('0x31')]>0x0){_0x15279b[_0x9789('0x31')]-=0x1;}else{logger[_0x9789('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x397a4c);}}}else{logger[_0x9789('0xa')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x397a4c);}};exports[_0x9789('0x32')]=function(_0x420035){var _0x15a947=moment()[_0x9789('0x11')](_0x9789('0x33'));_0x420035[_0x9789('0x34')]=0xd;_0x420035['statedesc']='Blacklist';_0x420035[_0x9789('0x35')]=_0x15a947;_0x420035['responsetime']=_0x15a947;_0x420035['endtime']=_0x15a947;};exports[_0x9789('0x36')]=function(_0xfd0f0e,_0x597510,_0x2d21d7){var _0x3dc9ef=moment()[_0x9789('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0xfd0f0e[_0x9789('0x34')]=_0x597510;_0xfd0f0e[_0x9789('0x37')]=_0x2d21d7;_0xfd0f0e['responsetime']=_0x3dc9ef;_0xfd0f0e['ringtime']=getSeconds(_0xfd0f0e[_0x9789('0x38')],_0xfd0f0e[_0x9789('0x35')]);};exports[_0x9789('0x39')]=function(_0x3326b6,_0x52dea4,_0x58d737){_0x3326b6['membername']=_0x52dea4;_0x3326b6['UserId']=_0x58d737;};exports[_0x9789('0x3a')]=function(_0x215ff6,_0x30b3a0,_0x363d4b){var _0x5ec83a=moment()['format'](_0x9789('0x33'));_0x215ff6[_0x9789('0x34')]=_0x30b3a0;_0x215ff6[_0x9789('0x37')]=_0x363d4b;_0x215ff6['responsetime']=_0x215ff6[_0x9789('0x38')]?_0x215ff6[_0x9789('0x38')]:_0x5ec83a;_0x215ff6[_0x9789('0x3b')]=_0x215ff6[_0x9789('0x3b')]?_0x215ff6[_0x9789('0x3b')]:_0x5ec83a;_0x215ff6[_0x9789('0x3c')]=getSeconds(_0x215ff6[_0x9789('0x38')]||0x0,_0x215ff6['starttime']||0x0);_0x215ff6[_0x9789('0x3d')]=_0x215ff6[_0x9789('0x3e')]?getSeconds(_0x215ff6['endtime'],_0x215ff6[_0x9789('0x3e')]):0x0;};exports[_0x9789('0x3f')]=function(_0xf91247){return _0xf91247===_0x9789('0x40');};exports['variablesAction']=function(_0x29a069,_0x2e5a1e,_0x25be2e,_0x3cd7b7,_0x19dee7){var _0xc512b2=_0x3cd7b7?_0x9789('0x41'):_0x29a069[_0x9789('0x18')];_0xc512b2=_0x19dee7?_0x9789('0x42'):_0xc512b2;return{'actionid':_0x29a069[_0x9789('0x43')],'action':_0x9789('0x44'),'channel':_0x29a069['channelAgent'],'callerid':util[_0x9789('0x11')](_0x9789('0x12'),_0xc512b2,_0x29a069[_0x9789('0x19')]),'Exten':_0x9789('0x25'),'Context':_0x9789('0x45'),'Priority':'1','variable':_0x25be2e,'timeout':(_0x2e5a1e['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x29a069[_0x9789('0x43')]};};exports[_0x9789('0x46')]=function(_0x4fc0db){return _0x4fc0db['countbusyretry']+_0x4fc0db[_0x9789('0x47')]+_0x4fc0db[_0x9789('0x48')]+_0x4fc0db[_0x9789('0x49')]+_0x4fc0db[_0x9789('0x4a')];};exports[_0x9789('0x4b')]=function(_0x93addd){var _0x397242=_[_0x9789('0x4c')](_0x93addd);_0x397242[_0x9789('0x34')]=0xf;_0x397242[_0x9789('0x37')]=_0x9789('0x4d');return _0x397242;};exports['scheduledAt']=function(_0x30fadc,_0x1c02eb,_0x36fa1d){var _0x1a5a26={};_0x1a5a26[_0x1c02eb]=_0x30fadc[_0x1c02eb];_0x1a5a26['active']=![];_0x1a5a26[_0x9789('0x4e')]=moment()['add'](_0x36fa1d,_0x9789('0x4f'))[_0x9789('0x11')](_0x9789('0x33'));_0x1a5a26[_0x9789('0x1a')]=_0x30fadc['ContactId'];_0x1a5a26['ListId']=_0x30fadc[_0x9789('0x50')];_0x1a5a26[_0x9789('0x1c')]=_0x30fadc[_0x9789('0x1c')]||undefined;return _0x1a5a26;};exports['decrementTalkink']=function(_0x2d1882,_0x23bd59){if(!_[_0x9789('0x15')](_0x2d1882)){if(_0x2d1882[_0x9789('0x51')]>0x0){_0x2d1882[_0x9789('0x51')]-=0x1;}else{logger[_0x9789('0xa')](_0x23bd59,_0x9789('0x52'));}}else{logger[_0x9789('0xa')](_0x23bd59,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x26f765){if(_0x26f765<=0x0){return!![];}return![];};exports[_0x9789('0x53')]=function(_0x36de23,_0x500f23,_0x2976ff){_0x36de23['lastevent']=_0x500f23;_0x36de23[_0x9789('0x17')]=_0x36de23[_0x9789('0x54')];_0x36de23[_0x9789('0x55')]=_0x36de23[_0x9789('0x56')];_0x36de23['motionChannel']='voice';if(_0x2976ff){_0x36de23[_0x9789('0x57')]=_0x2976ff[_0x9789('0x57')];}return _0x36de23;};exports[_0x9789('0x58')]=function(_0x5c005d){var _0x1a8225={};_0x1a8225[_0x9789('0x54')]=_0x5c005d['queue'];_0x1a8225[_0x9789('0x55')]=_0x5c005d[_0x9789('0x56')];_0x1a8225[_0x9789('0x43')]=_0x5c005d[_0x9789('0x43')];return _0x1a8225;};exports[_0x9789('0x59')]=function(_0x485588){var _0x3cb013=[];for(var _0xfda49c in _0x485588){if(_0x485588['hasOwnProperty'](_0xfda49c)){if(!_['isNil'](_0x485588[_0xfda49c])&&_0x485588[_0xfda49c][_0x9789('0x34')]===_0x9789('0x5a')&&_0x485588[_0xfda49c][_0x9789('0x5b')]===_0x9789('0x5c')){_0x3cb013[_0x9789('0x5d')](_0x485588[_0xfda49c]['id']);}}}return _0x3cb013;};exports[_0x9789('0x5e')]=function(_0x295fe2){var _0x338496=moment()[_0x9789('0x6')](0x0);var _0x188f4f=moment(_0x295fe2)[_0x9789('0x6')](0x0);return _0x338496[_0x9789('0x7')](_0x188f4f,_0x9789('0x8'));};exports[_0x9789('0x5f')]=function(_0x5d86cd){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5d86cd[_0x9789('0x1a')],'ListId':_0x5d86cd['ListId'],'VoiceQueueId':_0x5d86cd['VoiceQueueId']||undefined,'CampaignId':_0x5d86cd[_0x9789('0x60')]||undefined};};exports['filterKey']=function(_0x25ceb1){if(_0x25ceb1===_0x9789('0x43')||_0x25ceb1===_0x9789('0x61')||_0x25ceb1===_0x9789('0x54')||_0x25ceb1===_0x9789('0x62')||_0x25ceb1===_0x9789('0x63')||_0x25ceb1===_0x9789('0x64')||_0x25ceb1===_0x9789('0x65')||_0x25ceb1===_0x9789('0x56')||_0x25ceb1===_0x9789('0x18')||_0x25ceb1===_0x9789('0x66')||_0x25ceb1===_0x9789('0x19')||_0x25ceb1===_0x9789('0x4e')||_0x25ceb1===_0x9789('0x67')||_0x25ceb1===_0x9789('0x47')||_0x25ceb1===_0x9789('0x48')||_0x25ceb1===_0x9789('0x68')||_0x25ceb1===_0x9789('0x69')||_0x25ceb1===_0x9789('0x6a')||_0x25ceb1===_0x9789('0x6b')||_0x25ceb1==='recallme'||_0x25ceb1===_0x9789('0x1a')||_0x25ceb1===_0x9789('0x50')||_0x25ceb1===_0x9789('0x6c')||_0x25ceb1===_0x9789('0x1c')||_0x25ceb1==='sipcallid'||_0x25ceb1==='xmd-voicequeueid'||_0x25ceb1===_0x9789('0x6d')||_0x25ceb1===_0x9789('0x6e')||_0x25ceb1===_0x9789('0x6f')||_0x25ceb1==='xmd-dialurl'||_0x25ceb1===_0x9789('0x70')||_0x25ceb1==='xmd-dialoptions'||_0x25ceb1===_0x9789('0x71')||_0x25ceb1===_0x9789('0x72')||_0x25ceb1===_0x9789('0x73')||_0x25ceb1===_0x9789('0x74')||_0x25ceb1===_0x9789('0x75')||_0x25ceb1===_0x9789('0x76')||_0x25ceb1==='xmd-agi'||_0x25ceb1==='rtpaudioqos'||_0x25ceb1===_0x9789('0x77')||_0x25ceb1===_0x9789('0x78')||_0x25ceb1===_0x9789('0x79')||_0x25ceb1===_0x9789('0x7a')||_0x25ceb1===_0x9789('0x7b')||_0x25ceb1===_0x9789('0x7c')||_0x25ceb1===_0x9789('0x7d')||_0x25ceb1===_0x9789('0x7e')||_0x25ceb1===_0x9789('0x77')||_0x25ceb1===_0x9789('0x78')||_0x25ceb1===_0x9789('0x79')||_0x25ceb1==='rtpaudioqosloss'||_0x25ceb1===_0x9789('0x7b')||_0x25ceb1===_0x9789('0x7c')||_0x25ceb1==='rtpaudioqosrttbridged'||_0x25ceb1===_0x9789('0x7f')||_0x25ceb1===_0x9789('0x80')||_0x25ceb1===_0x9789('0x34')||_0x25ceb1===_0x9789('0x37')){return![];}return!![];};exports[_0x9789('0x81')]=function(_0x1aed48,_0x2c8987){var _0x24379c,_0xf5148f,_0x13d6e9;if(_0x2c8987<=0x0){_0x2c8987=0x1;}_0x24379c=new RegExp(_0x9789('0x82')+_0x2c8987+'}$');_0xf5148f=Math[_0x9789('0x83')](0xa,_0x2c8987-0x1);_0x13d6e9=Math[_0x9789('0x83')](0xa,_0x2c8987)-0x1;return util['format']('%s',_[_0x9789('0x84')](_0x1aed48,_0x24379c,_[_0x9789('0x85')](_0xf5148f,_0x13d6e9)));};exports[_0x9789('0x86')]=function(_0x75cb67){var _0x199cc4=_0x75cb67[_0x9789('0x87')](/"(.*?)"/);return _0x199cc4?_0x199cc4[0x1]:_0x75cb67;};exports[_0x9789('0x88')]=function(_0x4cd26b){var _0x4bcaf4=_0x4cd26b[_0x9789('0x87')](/<(.*?)>/);return _0x4bcaf4?_0x4bcaf4[0x1]:_0x4cd26b;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 07063bc..48d38a1 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 _0x5e57=['queueremove','reload','voicechannel','voicequeuechannelhangup','queueadd','string','number'];(function(_0x50d2a0,_0x13168b){var _0x11fe24=function(_0x1d67c4){while(--_0x1d67c4){_0x50d2a0['push'](_0x50d2a0['shift']());}};_0x11fe24(++_0x13168b);}(_0x5e57,0x1bd));var _0x75e5=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5e57[_0x42cae2];return _0x5f256f;};'use strict';exports[_0x75e5('0x0')]={'queue':{'type':_0x75e5('0x1'),'required':!![]},'interface':{'type':_0x75e5('0x1'),'required':!![]},'membername':{'type':_0x75e5('0x1'),'required':!![]},'penalty':{'type':_0x75e5('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x75e5('0x3')]={'queue':{'type':_0x75e5('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0x75e5('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x75e5('0x1'),'required':![]}};exports[_0x75e5('0x4')]={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x75e5('0x1'),'required':!![]}};exports[_0x75e5('0x5')]={'uniqueid':{'type':_0x75e5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x75e5('0x1')},'mixmonitorid':{'type':_0x75e5('0x1')}};exports[_0x75e5('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x75e5('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x6bc5=['voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6bc5,0x11c));var _0x56bc=function(_0xea4c9d,_0x4a2d07){_0xea4c9d=_0xea4c9d-0x0;var _0x2c84e3=_0x6bc5[_0xea4c9d];return _0x2c84e3;};'use strict';exports[_0x56bc('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x56bc('0x1'),'required':!![]},'membername':{'type':_0x56bc('0x1'),'required':!![]},'penalty':{'type':_0x56bc('0x2'),'required':![]},'paused':{'type':_0x56bc('0x3'),'required':![]}};exports[_0x56bc('0x4')]={'queue':{'type':_0x56bc('0x1'),'required':!![]},'interface':{'type':_0x56bc('0x1'),'required':!![]}};exports[_0x56bc('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0x56bc('0x6')]={'uniqueid':{'type':_0x56bc('0x1'),'required':!![]}};exports[_0x56bc('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x56bc('0x1')},'format':{'type':_0x56bc('0x1')},'mixmonitorid':{'type':_0x56bc('0x1')}};exports[_0x56bc('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x56bc('0x9')]={'uniqueid':{'type':_0x56bc('0x1'),'required':!![]},'exten':{'type':_0x56bc('0x1'),'required':!![]},'context':{'type':_0x56bc('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 24cd5b0..79a420e 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 _0x9be7=['initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','trunks','voiceQueues','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','hasOwnProperty','isNil','interface','name','total','answered','sumHoldTime','sumDuration','sumBillable','ivrAnswerCallsDay','isEmpty','unmanaged','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','queueStatusComplete','agents','prototype','telephones','isUndefined','mergeFromDatabase','initTrunks','initTriggers','triggers','length','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0x9be7,0x1d0));var _0x79be=function(_0x2a558d,_0x2df0ff){_0x2a558d=_0x2a558d-0x0;var _0xa7bc9c=_0x9be7[_0x2a558d];return _0xa7bc9c;};'use strict';var BPromise=require(_0x79be('0x0'));var util=require(_0x79be('0x1'));var _=require(_0x79be('0x2'));var moment=require(_0x79be('0x3'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0x79be('0x4'));var VoiceQueue=require(_0x79be('0x5'));var Trigger=require(_0x79be('0x6'));var Template=require(_0x79be('0x7'));var Campaign=require(_0x79be('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x79be('0x9'));var SalesforceAccount=require(_0x79be('0xa'));var FreshdeskAccount=require(_0x79be('0xb'));var SugarcrmAccount=require(_0x79be('0xc'));var ZohoAccount=require(_0x79be('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x79be('0xe'));var ServicenowAccount=require(_0x79be('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x79be('0x10'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0x79be('0x11')]={};this[_0x79be('0x12')]={};this['triggers']={};this[_0x79be('0x13')]={};this['templates']={};this[_0x79be('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x79be('0x15')]={};this[_0x79be('0x16')]={};this[_0x79be('0x17')]={};this[_0x79be('0x18')]={};this[_0x79be('0x19')]={};this['settings']={};this[_0x79be('0x1a')]={};this[_0x79be('0x1b')]={};this[_0x79be('0x1c')]={};this[_0x79be('0x1d')]={};this[_0x79be('0x1e')]={};this[_0x79be('0x1f')]={};this['vtigerAccounts']={};this[_0x79be('0x20')]={};this[_0x79be('0x21')]={};this[_0x79be('0x22')]={};this[_0x79be('0x23')]={};};function freeIsNotKey(_0x148f1c,_0x2df46f,_0x2da9e1){var _0x480449=_['mapKeys'](_0x148f1c,function(_0x12fbf1,_0x167990){return _0x12fbf1[_0x2da9e1];});for(var _0x18e354 in _0x2df46f){if(_0x2df46f['hasOwnProperty'](_0x18e354)){if(!_0x480449[_0x18e354]){delete _0x2df46f[_0x18e354];}}}}function freeIsNotKeySip(_0x50a8a6,_0x27b4e0){var _0x2ad180=_[_0x79be('0x24')](_0x50a8a6,function(_0x2a4eea,_0x207198){return util[_0x79be('0x25')](_0x79be('0x26'),_0x2a4eea['name']);});for(var _0x4d4eed in _0x27b4e0){if(_0x27b4e0[_0x79be('0x27')](_0x4d4eed)){if(!_0x2ad180[_0x4d4eed]){delete _0x27b4e0[_0x4d4eed];}}}}function freeIsNotKeyAgent(_0x560f8c,_0x14b85a){var _0x3cf4e8=_[_0x79be('0x24')](_0x560f8c,function(_0x21dd8c,_0x471b9c){var _0x3b1cd7=_[_0x79be('0x28')](_0x21dd8c[_0x79be('0x29')])?util['format']('SIP/%s',_0x21dd8c[_0x79be('0x2a')]):_0x21dd8c[_0x79be('0x29')];return _0x3b1cd7;});for(var _0x2efaf5 in _0x14b85a){if(_0x14b85a[_0x79be('0x27')](_0x2efaf5)){if(!_0x3cf4e8[_0x2efaf5]){delete _0x14b85a[_0x2efaf5];}}}}function clearVoiceCallReports(_0x41b2e8){_0x41b2e8[_0x79be('0x2b')]=0x0;_0x41b2e8[_0x79be('0x2c')]=0x0;_0x41b2e8[_0x79be('0x2d')]=0x0;_0x41b2e8[_0x79be('0x2e')]=0x0;_0x41b2e8[_0x79be('0x2f')]=0x0;}function clearCampaigns(_0x9c2da8){if(!_['isEmpty'](_0x9c2da8)){for(var _0x62c51a in _0x9c2da8){if(_0x9c2da8[_0x79be('0x27')](_0x62c51a)){_0x9c2da8[_0x62c51a]['ivrTotalCallsDays']=0x0;_0x9c2da8[_0x62c51a][_0x79be('0x30')]=0x0;}}}}function clearVoiceQueues(_0x5ca0b1){if(!_[_0x79be('0x31')](_0x5ca0b1)){for(var _0x458439 in _0x5ca0b1){if(_0x5ca0b1['hasOwnProperty'](_0x458439)){_0x5ca0b1[_0x458439][_0x79be('0x2b')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x2c')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x32')]=0x0;_0x5ca0b1[_0x458439]['abandoned']=0x0;_0x5ca0b1[_0x458439][_0x79be('0x2d')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x2e')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x2f')]=0x0;_0x5ca0b1[_0x458439]['outboundAnswerAgiCallsDay']=0x0;_0x5ca0b1[_0x458439][_0x79be('0x33')]=0x0;_0x5ca0b1[_0x458439]['outboundBusyCallsDay']=0x0;_0x5ca0b1[_0x458439][_0x79be('0x34')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x35')]=0x0;_0x5ca0b1[_0x458439]['outboundUnknownCallsDay']=0x0;_0x5ca0b1[_0x458439][_0x79be('0x36')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x37')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x38')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x39')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x3a')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x3b')]=0x0;_0x5ca0b1[_0x458439][_0x79be('0x3c')]=0x0;_0x5ca0b1[_0x458439]['outboundAnswerCallsDay']=0x0;_0x5ca0b1[_0x458439][_0x79be('0x3d')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x162e82,_0x26f5ce){for(var _0x2acb0c in _0x26f5ce){if(_0x162e82[_0x79be('0x27')](_0x2acb0c)){_0x162e82[_0x2acb0c]=_0x26f5ce[_0x2acb0c];}}};Realtime['prototype']['initAgents']=function(){var _0x50d318=this;return function(_0x222afc){if(_0x222afc){freeIsNotKeyAgent(_0x222afc,_0x50d318[_0x79be('0x3e')]);for(var _0x1003e1=0x0,_0xbe0d20={},_0x2018e6={};_0x1003e1<_0x222afc['length'];_0x1003e1+=0x1){_0xbe0d20=_0x222afc[_0x1003e1];var _0x2b7ef4=_[_0x79be('0x28')](_0xbe0d20['interface'])?util[_0x79be('0x25')](_0x79be('0x26'),_0xbe0d20[_0x79be('0x2a')]):_0xbe0d20[_0x79be('0x29')];if(_['isUndefined'](_0x50d318['agents'][_0x2b7ef4])){_0x50d318[_0x79be('0x3e')][_0x2b7ef4]=new Agent(_0xbe0d20);}else{_0x50d318['mergeFromDatabase'](_0x50d318['agents'][_0x2b7ef4],_0xbe0d20);}}}return _0x50d318[_0x79be('0x3e')];};};Realtime[_0x79be('0x3f')]['initTelephones']=function(){var _0x594b9a=this;return function(_0xcf4f58){if(_0xcf4f58){freeIsNotKeySip(_0xcf4f58,_0x594b9a[_0x79be('0x40')]);for(var _0x44247e=0x0,_0x31b32={},_0x14d260={};_0x44247e<_0xcf4f58['length'];_0x44247e+=0x1){_0x31b32=_0xcf4f58[_0x44247e];if(_[_0x79be('0x41')](_0x594b9a[_0x79be('0x40')][util[_0x79be('0x25')]('SIP/%s',_0x31b32['name'])])){_0x594b9a[_0x79be('0x40')][util['format'](_0x79be('0x26'),_0x31b32[_0x79be('0x2a')])]=new Telephone(_0x31b32);}else{_0x594b9a[_0x79be('0x42')](_0x594b9a['telephones'][util[_0x79be('0x25')](_0x79be('0x26'),_0x31b32[_0x79be('0x2a')])],_0x31b32);}}}return _0x594b9a['telephones'];};};Realtime[_0x79be('0x3f')][_0x79be('0x43')]=function(){var _0xa8ff59=this;return function(_0x250f3e){if(_0x250f3e){freeIsNotKeySip(_0x250f3e,_0xa8ff59[_0x79be('0x11')]);for(var _0x107d4a=0x0,_0x384e38={},_0x2c4b35={};_0x107d4a<_0x250f3e['length'];_0x107d4a+=0x1){_0x384e38=_0x250f3e[_0x107d4a];if(_['isUndefined'](_0xa8ff59[_0x79be('0x11')][util[_0x79be('0x25')](_0x79be('0x26'),_0x384e38['name'])])){_0xa8ff59[_0x79be('0x11')][util[_0x79be('0x25')]('SIP/%s',_0x384e38[_0x79be('0x2a')])]=new Trunk(_0x384e38);}else{_0xa8ff59['mergeFromDatabase'](_0xa8ff59[_0x79be('0x11')][util[_0x79be('0x25')](_0x79be('0x26'),_0x384e38[_0x79be('0x2a')])],_0x384e38);}}}return _0xa8ff59[_0x79be('0x11')];};};Realtime[_0x79be('0x3f')]['initVoiceQueues']=function(){var _0x45e3d9=this;return function(_0x2886cd){if(_0x2886cd){freeIsNotKey(_0x2886cd,_0x45e3d9['voiceQueues'],'name');for(var _0x12615f=0x0,_0xd0329a={},_0x1e758e={};_0x12615f<_0x2886cd['length'];_0x12615f+=0x1){_0xd0329a=_0x2886cd[_0x12615f];if(_[_0x79be('0x41')](_0x45e3d9[_0x79be('0x12')][_0xd0329a['name']])){_0x45e3d9[_0x79be('0x12')][_0xd0329a['name']]=new VoiceQueue(_0xd0329a);}else{_0x45e3d9[_0x79be('0x42')](_0x45e3d9[_0x79be('0x12')][_0xd0329a[_0x79be('0x2a')]],_0xd0329a);}}}return _0x45e3d9[_0x79be('0x12')];};};Realtime[_0x79be('0x3f')][_0x79be('0x44')]=function(){var _0x1eb65f=this;return function(_0x2eebf4){if(_0x2eebf4){freeIsNotKey(_0x2eebf4,_0x1eb65f[_0x79be('0x45')],'id');for(var _0x1ca178=0x0,_0x3bbf0f={},_0x56660f={};_0x1ca178<_0x2eebf4[_0x79be('0x46')];_0x1ca178+=0x1){_0x3bbf0f=_0x2eebf4[_0x1ca178];if(_[_0x79be('0x41')](_0x1eb65f[_0x79be('0x45')][_0x3bbf0f['id']])){_0x1eb65f[_0x79be('0x45')][_0x3bbf0f['id']]=new Trigger(_0x3bbf0f);}else{_0x1eb65f[_0x79be('0x42')](_0x1eb65f['triggers'][_0x3bbf0f['id']],_0x3bbf0f);}}}return _0x1eb65f[_0x79be('0x45')];};};Realtime[_0x79be('0x3f')][_0x79be('0x47')]=function(){var _0x42b0ef=this;return function(_0x28b244){if(_0x28b244){freeIsNotKey(_0x28b244,_0x42b0ef[_0x79be('0x48')],'id');for(var _0x58fa7d=0x0,_0x484db6={},_0x8bfe8d={};_0x58fa7d<_0x28b244[_0x79be('0x46')];_0x58fa7d+=0x1){_0x484db6=_0x28b244[_0x58fa7d];if(_['isUndefined'](_0x42b0ef['templates'][_0x484db6['id']])){_0x42b0ef[_0x79be('0x48')][_0x484db6['id']]=new Template(_0x484db6);}else{_0x42b0ef[_0x79be('0x42')](_0x42b0ef['templates'][_0x484db6['id']],_0x484db6);}}}return _0x42b0ef[_0x79be('0x48')];};};Realtime['prototype'][_0x79be('0x49')]=function(){var _0x2209d6=this;return function(_0xc02dfd){if(_0xc02dfd){freeIsNotKey(_0xc02dfd,_0x2209d6[_0x79be('0x1a')],'id');for(var _0x547990=0x0,_0x3ba4ec={},_0xae2975={};_0x547990<_0xc02dfd[_0x79be('0x46')];_0x547990+=0x1){_0x3ba4ec=_0xc02dfd[_0x547990];if(_['isUndefined'](_0x2209d6[_0x79be('0x1a')][_0x3ba4ec['id']])){_0x2209d6[_0x79be('0x1a')][_0x3ba4ec['id']]=new ZendeskAccount(_0x3ba4ec);}else{_0x2209d6['mergeFromDatabase'](_0x2209d6[_0x79be('0x1a')][_0x3ba4ec['id']],_0x3ba4ec);}}}return _0x2209d6[_0x79be('0x1a')];};};Realtime[_0x79be('0x3f')][_0x79be('0x4a')]=function(){var _0x5cfba5=this;return function(_0x1e5f2c){if(_0x1e5f2c){freeIsNotKey(_0x1e5f2c,_0x5cfba5['salesforceAccounts'],'id');for(var _0x1bcb56=0x0,_0x449b03={},_0x117276={};_0x1bcb56<_0x1e5f2c[_0x79be('0x46')];_0x1bcb56+=0x1){_0x449b03=_0x1e5f2c[_0x1bcb56];if(_[_0x79be('0x41')](_0x5cfba5[_0x79be('0x1b')][_0x449b03['id']])){_0x5cfba5[_0x79be('0x1b')][_0x449b03['id']]=new SalesforceAccount(_0x449b03);}else{_0x5cfba5[_0x79be('0x42')](_0x5cfba5['salesforceAccounts'][_0x449b03['id']],_0x449b03);}}}return _0x5cfba5[_0x79be('0x1b')];};};Realtime[_0x79be('0x3f')][_0x79be('0x4b')]=function(){var _0x4cc6b3=this;return function(_0x46b189){if(_0x46b189){freeIsNotKey(_0x46b189,_0x4cc6b3[_0x79be('0x1d')],'id');for(var _0x5a3e59=0x0,_0x464375={},_0x179253={};_0x5a3e59<_0x46b189[_0x79be('0x46')];_0x5a3e59+=0x1){_0x464375=_0x46b189[_0x5a3e59];if(_[_0x79be('0x41')](_0x4cc6b3[_0x79be('0x1d')][_0x464375['id']])){_0x4cc6b3[_0x79be('0x1d')][_0x464375['id']]=new FreshdeskAccount(_0x464375);}else{_0x4cc6b3[_0x79be('0x42')](_0x4cc6b3[_0x79be('0x1d')][_0x464375['id']],_0x464375);}}}return _0x4cc6b3[_0x79be('0x1d')];};};Realtime['prototype'][_0x79be('0x4c')]=function(){var _0x344830=this;return function(_0xa6d21e){if(_0xa6d21e){freeIsNotKey(_0xa6d21e,_0x344830[_0x79be('0x1e')],'id');for(var _0xbd2df9=0x0,_0x194c3b={},_0x570404={};_0xbd2df9<_0xa6d21e[_0x79be('0x46')];_0xbd2df9+=0x1){_0x194c3b=_0xa6d21e[_0xbd2df9];if(_[_0x79be('0x41')](_0x344830['zohoAccounts'][_0x194c3b['id']])){_0x344830[_0x79be('0x1e')][_0x194c3b['id']]=new ZohoAccount(_0x194c3b);}else{_0x344830['mergeFromDatabase'](_0x344830['zohoAccounts'][_0x194c3b['id']],_0x194c3b);}}}return _0x344830[_0x79be('0x1e')];};};Realtime[_0x79be('0x3f')][_0x79be('0x4d')]=function(){var _0x434106=this;return function(_0x47b235){if(_0x47b235){freeIsNotKey(_0x47b235,_0x434106[_0x79be('0x1f')],'id');for(var _0x343506=0x0,_0x15464e={},_0x1b5ee8={};_0x343506<_0x47b235['length'];_0x343506+=0x1){_0x15464e=_0x47b235[_0x343506];if(_[_0x79be('0x41')](_0x434106['deskAccounts'][_0x15464e['id']])){_0x434106[_0x79be('0x1f')][_0x15464e['id']]=new DeskAccount(_0x15464e);}else{_0x434106['mergeFromDatabase'](_0x434106[_0x79be('0x1f')][_0x15464e['id']],_0x15464e);}}}return _0x434106[_0x79be('0x1f')];};};Realtime[_0x79be('0x3f')][_0x79be('0x4e')]=function(){var _0x4f8719=this;return function(_0x2e6c07){if(_0x2e6c07){freeIsNotKey(_0x2e6c07,_0x4f8719[_0x79be('0x1c')],'id');for(var _0x286894=0x0,_0x54193f={},_0x3febea={};_0x286894<_0x2e6c07['length'];_0x286894+=0x1){_0x54193f=_0x2e6c07[_0x286894];if(_[_0x79be('0x41')](_0x4f8719[_0x79be('0x1c')][_0x54193f['id']])){_0x4f8719[_0x79be('0x1c')][_0x54193f['id']]=new SugarcrmAccount(_0x54193f);}else{_0x4f8719['mergeFromDatabase'](_0x4f8719[_0x79be('0x1c')][_0x54193f['id']],_0x54193f);}}}return _0x4f8719[_0x79be('0x1c')];};};Realtime['prototype'][_0x79be('0x4f')]=function(){var _0x2a4378=this;return function(_0x5bc5e0){if(_0x5bc5e0){freeIsNotKey(_0x5bc5e0,_0x2a4378[_0x79be('0x50')],'id');for(var _0x25c6f6=0x0,_0x35303c={},_0x38943b={};_0x25c6f6<_0x5bc5e0[_0x79be('0x46')];_0x25c6f6+=0x1){_0x35303c=_0x5bc5e0[_0x25c6f6];if(_[_0x79be('0x41')](_0x2a4378[_0x79be('0x50')][_0x35303c['id']])){_0x2a4378[_0x79be('0x50')][_0x35303c['id']]=new VtigerAccount(_0x35303c);}else{_0x2a4378['mergeFromDatabase'](_0x2a4378[_0x79be('0x50')][_0x35303c['id']],_0x35303c);}}}return _0x2a4378[_0x79be('0x50')];};};Realtime[_0x79be('0x3f')]['initServicenowAccounts']=function(){var _0x25219a=this;return function(_0x49d9d8){if(_0x49d9d8){freeIsNotKey(_0x49d9d8,_0x25219a[_0x79be('0x20')],'id');for(var _0x28e0b9=0x0,_0x415007={},_0x5def30={};_0x28e0b9<_0x49d9d8[_0x79be('0x46')];_0x28e0b9+=0x1){_0x415007=_0x49d9d8[_0x28e0b9];if(_[_0x79be('0x41')](_0x25219a[_0x79be('0x20')][_0x415007['id']])){_0x25219a['servicenowAccounts'][_0x415007['id']]=new ServicenowAccount(_0x415007);}else{_0x25219a['mergeFromDatabase'](_0x25219a[_0x79be('0x20')][_0x415007['id']],_0x415007);}}}return _0x25219a['servicenowAccounts'];};};Realtime[_0x79be('0x3f')]['initDynamics365Accounts']=function(){var _0x47d5bd=this;return function(_0xbb469e){if(_0xbb469e){freeIsNotKey(_0xbb469e,_0x47d5bd[_0x79be('0x21')],'id');for(var _0x4a6d09=0x0,_0x25bb48={},_0x25775c={};_0x4a6d09<_0xbb469e[_0x79be('0x46')];_0x4a6d09+=0x1){_0x25bb48=_0xbb469e[_0x4a6d09];if(_[_0x79be('0x41')](_0x47d5bd[_0x79be('0x21')][_0x25bb48['id']])){_0x47d5bd[_0x79be('0x21')][_0x25bb48['id']]=new Dynamics365Account(_0x25bb48);}else{_0x47d5bd[_0x79be('0x42')](_0x47d5bd[_0x79be('0x21')][_0x25bb48['id']],_0x25bb48);}}}return _0x47d5bd[_0x79be('0x21')];};};Realtime[_0x79be('0x3f')][_0x79be('0x51')]=function(){var _0x235237=this;return function(_0x34815b){if(_0x34815b){freeIsNotKey(_0x34815b,_0x235237[_0x79be('0x22')],'id');for(var _0x486181=0x0,_0x437a32={},_0x51309a={};_0x486181<_0x34815b[_0x79be('0x46')];_0x486181+=0x1){_0x437a32=_0x34815b[_0x486181];if(_[_0x79be('0x41')](_0x235237['freshsalesAccounts'][_0x437a32['id']])){_0x235237['freshsalesAccounts'][_0x437a32['id']]=new FreshsalesAccount(_0x437a32);}else{_0x235237[_0x79be('0x42')](_0x235237[_0x79be('0x22')][_0x437a32['id']],_0x437a32);}}}return _0x235237['freshsalesAccounts'];};};Realtime[_0x79be('0x3f')][_0x79be('0x52')]=function(){var _0x484ae9=this;return function(_0x5bde23){for(var _0x46cd45=0x0;_0x46cd45<_0x5bde23[_0x79be('0x46')];_0x46cd45+=0x1){_[_0x79be('0x53')](_0x484ae9[_0x79be('0x12')][_0x5bde23[_0x46cd45]['name']],_0x5bde23[_0x46cd45]);}return _0x484ae9[_0x79be('0x12')];};};Realtime['prototype'][_0x79be('0x54')]=function(){var _0x49cc50=this;return function(_0x17f922){clearVoiceQueues(_0x49cc50[_0x79be('0x12')]);if(_0x17f922){_0x17f922=_['groupBy'](_0x17f922,_0x79be('0x55'));for(var _0xe6a0c6 in _0x17f922){if(_0x17f922['hasOwnProperty'](_0xe6a0c6)){var _0x151623={};for(var _0x2bbc00=0x0;_0x2bbc00<_0x17f922[_0xe6a0c6]['length'];_0x2bbc00+=0x1){var _0x5c115c=_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x56')];if(_0x49cc50[_0x79be('0x12')][_0x5c115c]){if(_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x57')]){_0x49cc50[_0x79be('0x12')][_0x5c115c][_0x79be('0x32')]+=0x1;}if(_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x58')]){_0x49cc50[_0x79be('0x12')][_0x5c115c][_0x79be('0x59')]+=0x1;}_0x49cc50['voiceQueues'][_0x5c115c][_0x79be('0x2d')]+=moment(_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x5a')])[_0x79be('0x5b')](moment(_0x17f922[_0xe6a0c6][_0x2bbc00]['queuecallerjoinAt']),_0x79be('0x5c'))||0x0;if(_0x2bbc00===_0x17f922[_0xe6a0c6][_0x79be('0x46')]-0x1){_0x49cc50[_0x79be('0x12')][_0x5c115c]['sumDuration']+=moment(_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x5d')]||_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x5e')]||_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x5f')])[_0x79be('0x5b')](moment(_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x60')]),_0x79be('0x5c'))||0x0;_0x49cc50[_0x79be('0x12')][_0x5c115c][_0x79be('0x2b')]+=0x1;if(_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x61')]){_0x49cc50['voiceQueues'][_0x5c115c][_0x79be('0x2c')]+=0x1;_0x49cc50[_0x79be('0x12')][_0x5c115c][_0x79be('0x2f')]+=moment(_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x5d')])[_0x79be('0x5b')](moment(_0x17f922[_0xe6a0c6][_0x2bbc00][_0x79be('0x5a')]),_0x79be('0x5c'))||0x0;}}else{_0x49cc50['voiceQueues'][_0x5c115c][_0x79be('0x2e')]+=_0x49cc50[_0x79be('0x12')][_0x5c115c][_0x79be('0x2d')]||0x0;}}}}}}return _0x49cc50['voiceQueues'];};};Realtime['prototype'][_0x79be('0x62')]=function(){var _0x19622e=this;return function(_0x189b0e){clearVoiceCallReports(_0x19622e[_0x79be('0x14')]);if(_0x189b0e){for(var _0x571ed0=0x0;_0x571ed0<_0x189b0e[_0x79be('0x46')];_0x571ed0+=0x1){_0x19622e[_0x79be('0x14')][_0x79be('0x2b')]+=0x1;_0x19622e[_0x79be('0x14')][_0x79be('0x2e')]+=_0x189b0e[_0x571ed0][_0x79be('0x63')];if(_0x189b0e[_0x571ed0]['disposition']===_0x79be('0x64')){_0x19622e[_0x79be('0x14')][_0x79be('0x2c')]+=0x1;_0x19622e['outbound']['sumHoldTime']+=_0x189b0e[_0x571ed0][_0x79be('0x63')]-_0x189b0e[_0x571ed0]['billableseconds']||0x0;_0x19622e[_0x79be('0x14')][_0x79be('0x2f')]+=_0x189b0e[_0x571ed0][_0x79be('0x65')];}}}return _0x19622e[_0x79be('0x14')];};};Realtime[_0x79be('0x3f')][_0x79be('0x66')]=function(){var _0x35b775=this;return function(_0x1d960d){if(_0x1d960d){freeIsNotKey(_0x1d960d,_0x35b775[_0x79be('0x13')],_0x79be('0x2a'));for(var _0x276e44=0x0,_0x189f72={};_0x276e44<_0x1d960d[_0x79be('0x46')];_0x276e44+=0x1){_0x189f72=_0x1d960d[_0x276e44];if(_[_0x79be('0x41')](_0x35b775[_0x79be('0x13')][_0x189f72[_0x79be('0x2a')]])){_0x35b775[_0x79be('0x13')][_0x189f72[_0x79be('0x2a')]]=new Campaign(_0x189f72);}else{_0x35b775['mergeFromDatabase'](_0x35b775[_0x79be('0x13')][_0x189f72[_0x79be('0x2a')]],_0x189f72);_0x35b775[_0x79be('0x13')][_0x189f72['name']][_0x79be('0x67')]=_0x189f72[_0x79be('0x68')]?_0x189f72['SquareProject'][_0x79be('0x2a')]:undefined;}}}return _0x35b775['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x2c48b6=this;return function(_0x11ceb0){if(_0x11ceb0){freeIsNotKey(_0x11ceb0,_0x2c48b6[_0x79be('0x15')],'id');for(var _0x1e6926=0x0,_0x3f7884={};_0x1e6926<_0x11ceb0[_0x79be('0x46')];_0x1e6926+=0x1){_0x3f7884=_0x11ceb0[_0x1e6926];if(_[_0x79be('0x41')](_0x2c48b6[_0x79be('0x15')][_0x3f7884['id']])){_0x2c48b6['voiceExtensions'][_0x3f7884['id']]=new VoiceExtension(_0x3f7884);}else{_0x2c48b6[_0x79be('0x42')](_0x2c48b6[_0x79be('0x15')][_0x3f7884['id']],_0x3f7884);}}}return _0x2c48b6[_0x79be('0x15')];};};Realtime['prototype'][_0x79be('0x69')]=function(){var _0x50ca32=this;return function(_0x438037){clearCampaigns(_0x50ca32[_0x79be('0x13')]);for(var _0x236899=0x0;_0x236899<_0x438037[_0x79be('0x46')];_0x236899+=0x1){_[_0x79be('0x53')](_0x50ca32[_0x79be('0x13')][_0x438037[_0x236899][_0x79be('0x2a')]],_0x438037[_0x236899]);}return _0x50ca32[_0x79be('0x13')];};};Realtime[_0x79be('0x3f')][_0x79be('0x6a')]=function(){var _0x85c33a=this;return function(_0x52ffaa){if(_0x52ffaa){freeIsNotKey(_0x52ffaa,_0x85c33a[_0x79be('0x23')],'id');for(var _0x4b6b65=0x0,_0x4422b8={},_0x2cb689={};_0x4b6b65<_0x52ffaa[_0x79be('0x46')];_0x4b6b65+=0x1){_0x4422b8=_0x52ffaa[_0x4b6b65];if(_[_0x79be('0x41')](_0x85c33a[_0x79be('0x23')][_0x4422b8['id']])){_0x85c33a[_0x79be('0x23')][_0x4422b8['id']]=new FaxAccount(_0x4422b8);}else{_0x85c33a[_0x79be('0x42')](_0x85c33a[_0x79be('0x23')][_0x4422b8['id']],_0x4422b8);}}}return _0x85c33a[_0x79be('0x23')];};};module[_0x79be('0x6b')]=Realtime; \ No newline at end of file +var _0x0002=['outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isNil','isUndefined','initTelephones','initTrunks','trunks','initVoiceQueues','mergeFromDatabase','initTemplates','initZendeskAccounts','initFreshdeskAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallercomplete','duration','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initFaxAccounts','exports','bluebird','util','lodash','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','telephones','voiceQueues','triggers','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','total','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit'];(function(_0x4e2e99,_0x488cd9){var _0x2c1205=function(_0xd7e145){while(--_0xd7e145){_0x4e2e99['push'](_0x4e2e99['shift']());}};_0x2c1205(++_0x488cd9);}(_0x0002,0x1f3));var _0x2000=function(_0x572877,_0xf77ed7){_0x572877=_0x572877-0x0;var _0x537f1f=_0x0002[_0x572877];return _0x537f1f;};'use strict';var BPromise=require(_0x2000('0x0'));var util=require(_0x2000('0x1'));var _=require(_0x2000('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0x2000('0x3'));var Trunk=require(_0x2000('0x4'));var VoiceQueue=require(_0x2000('0x5'));var Trigger=require('../model/trigger');var Template=require(_0x2000('0x6'));var Campaign=require(_0x2000('0x7'));var VoiceExtension=require(_0x2000('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x2000('0x9'));var FreshdeskAccount=require(_0x2000('0xa'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x2000('0xb'));var VtigerAccount=require(_0x2000('0xc'));var ServicenowAccount=require(_0x2000('0xd'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x2000('0xe'));var FaxAccount=require(_0x2000('0xf'));var Realtime=function(){this['agents']={};this[_0x2000('0x10')]={};this['trunks']={};this[_0x2000('0x11')]={};this[_0x2000('0x12')]={};this['campaigns']={};this[_0x2000('0x13')]={};this[_0x2000('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2000('0x15')]={};this[_0x2000('0x16')]={};this[_0x2000('0x17')]={};this[_0x2000('0x18')]={};this[_0x2000('0x19')]={};this[_0x2000('0x1a')]={};this[_0x2000('0x1b')]={};this['sugarcrmAccounts']={};this[_0x2000('0x1c')]={};this['zohoAccounts']={};this[_0x2000('0x1d')]={};this['vtigerAccounts']={};this[_0x2000('0x1e')]={};this['dynamics365Accounts']={};this[_0x2000('0x1f')]={};this[_0x2000('0x20')]={};};function freeIsNotKey(_0x4e3460,_0x935fc,_0x57d7dd){var _0xa40b75=_[_0x2000('0x21')](_0x4e3460,function(_0x3ee697,_0x56d84d){return _0x3ee697[_0x57d7dd];});for(var _0x262795 in _0x935fc){if(_0x935fc[_0x2000('0x22')](_0x262795)){if(!_0xa40b75[_0x262795]){delete _0x935fc[_0x262795];}}}}function freeIsNotKeySip(_0x1c18e0,_0x11cc52){var _0xca804f=_[_0x2000('0x21')](_0x1c18e0,function(_0x26407a,_0xc2d6d1){return util[_0x2000('0x23')](_0x2000('0x24'),_0x26407a[_0x2000('0x25')]);});for(var _0x33078f in _0x11cc52){if(_0x11cc52[_0x2000('0x22')](_0x33078f)){if(!_0xca804f[_0x33078f]){delete _0x11cc52[_0x33078f];}}}}function freeIsNotKeyAgent(_0x557859,_0x484baa){var _0x3c2282=_['mapKeys'](_0x557859,function(_0x2119e7,_0x7765b3){var _0x1cec2c=_['isNil'](_0x2119e7[_0x2000('0x26')])?util[_0x2000('0x23')](_0x2000('0x24'),_0x2119e7[_0x2000('0x25')]):_0x2119e7['interface'];return _0x1cec2c;});for(var _0x15f2d5 in _0x484baa){if(_0x484baa[_0x2000('0x22')](_0x15f2d5)){if(!_0x3c2282[_0x15f2d5]){delete _0x484baa[_0x15f2d5];}}}}function clearVoiceCallReports(_0x59e980){_0x59e980[_0x2000('0x27')]=0x0;_0x59e980['answered']=0x0;_0x59e980[_0x2000('0x28')]=0x0;_0x59e980[_0x2000('0x29')]=0x0;_0x59e980[_0x2000('0x2a')]=0x0;}function clearCampaigns(_0x37e1ad){if(!_[_0x2000('0x2b')](_0x37e1ad)){for(var _0x11ad6d in _0x37e1ad){if(_0x37e1ad[_0x2000('0x22')](_0x11ad6d)){_0x37e1ad[_0x11ad6d][_0x2000('0x2c')]=0x0;_0x37e1ad[_0x11ad6d][_0x2000('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3d218a){if(!_['isEmpty'](_0x3d218a)){for(var _0x14d3ea in _0x3d218a){if(_0x3d218a['hasOwnProperty'](_0x14d3ea)){_0x3d218a[_0x14d3ea][_0x2000('0x27')]=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x2e')]=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x2f')]=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x30')]=0x0;_0x3d218a[_0x14d3ea]['sumHoldTime']=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x29')]=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x2a')]=0x0;_0x3d218a[_0x14d3ea]['outboundAnswerAgiCallsDay']=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x31')]=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x32')]=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x33')]=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x34')]=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x35')]=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x36')]=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x37')]=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x38')]=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x39')]=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x3a')]=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x3b')]=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x3c')]=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x3d')]=0x0;_0x3d218a[_0x14d3ea][_0x2000('0x3e')]=!![];}}}}Realtime[_0x2000('0x3f')]['mergeFromDatabase']=function(_0x53a6ae,_0x1a0da2){for(var _0x1fb77d in _0x1a0da2){if(_0x53a6ae['hasOwnProperty'](_0x1fb77d)){_0x53a6ae[_0x1fb77d]=_0x1a0da2[_0x1fb77d];}}};Realtime[_0x2000('0x3f')][_0x2000('0x40')]=function(){var _0x19f645=this;return function(_0xa97d28){if(_0xa97d28){freeIsNotKeyAgent(_0xa97d28,_0x19f645[_0x2000('0x41')]);for(var _0x32612a=0x0,_0x3b6cff={},_0x286753={};_0x32612a<_0xa97d28[_0x2000('0x42')];_0x32612a+=0x1){_0x3b6cff=_0xa97d28[_0x32612a];var _0x393ba0=_[_0x2000('0x43')](_0x3b6cff['interface'])?util[_0x2000('0x23')](_0x2000('0x24'),_0x3b6cff[_0x2000('0x25')]):_0x3b6cff[_0x2000('0x26')];if(_[_0x2000('0x44')](_0x19f645[_0x2000('0x41')][_0x393ba0])){_0x19f645['agents'][_0x393ba0]=new Agent(_0x3b6cff);}else{_0x19f645['mergeFromDatabase'](_0x19f645['agents'][_0x393ba0],_0x3b6cff);}}}return _0x19f645[_0x2000('0x41')];};};Realtime[_0x2000('0x3f')][_0x2000('0x45')]=function(){var _0x131c37=this;return function(_0x2d6ea3){if(_0x2d6ea3){freeIsNotKeySip(_0x2d6ea3,_0x131c37['telephones']);for(var _0xd60afd=0x0,_0x20d9ad={},_0x47e959={};_0xd60afd<_0x2d6ea3[_0x2000('0x42')];_0xd60afd+=0x1){_0x20d9ad=_0x2d6ea3[_0xd60afd];if(_[_0x2000('0x44')](_0x131c37[_0x2000('0x10')][util[_0x2000('0x23')](_0x2000('0x24'),_0x20d9ad[_0x2000('0x25')])])){_0x131c37[_0x2000('0x10')][util['format'](_0x2000('0x24'),_0x20d9ad[_0x2000('0x25')])]=new Telephone(_0x20d9ad);}else{_0x131c37['mergeFromDatabase'](_0x131c37[_0x2000('0x10')][util[_0x2000('0x23')](_0x2000('0x24'),_0x20d9ad[_0x2000('0x25')])],_0x20d9ad);}}}return _0x131c37[_0x2000('0x10')];};};Realtime['prototype'][_0x2000('0x46')]=function(){var _0x524411=this;return function(_0x47c4cf){if(_0x47c4cf){freeIsNotKeySip(_0x47c4cf,_0x524411['trunks']);for(var _0x2e5510=0x0,_0x3ebc9f={},_0x236f9c={};_0x2e5510<_0x47c4cf[_0x2000('0x42')];_0x2e5510+=0x1){_0x3ebc9f=_0x47c4cf[_0x2e5510];if(_[_0x2000('0x44')](_0x524411[_0x2000('0x47')][util['format']('SIP/%s',_0x3ebc9f['name'])])){_0x524411[_0x2000('0x47')][util[_0x2000('0x23')]('SIP/%s',_0x3ebc9f['name'])]=new Trunk(_0x3ebc9f);}else{_0x524411['mergeFromDatabase'](_0x524411[_0x2000('0x47')][util['format'](_0x2000('0x24'),_0x3ebc9f[_0x2000('0x25')])],_0x3ebc9f);}}}return _0x524411[_0x2000('0x47')];};};Realtime[_0x2000('0x3f')][_0x2000('0x48')]=function(){var _0x5c088d=this;return function(_0x3b46f0){if(_0x3b46f0){freeIsNotKey(_0x3b46f0,_0x5c088d[_0x2000('0x11')],_0x2000('0x25'));for(var _0x6fad68=0x0,_0x351acc={},_0x93a453={};_0x6fad68<_0x3b46f0[_0x2000('0x42')];_0x6fad68+=0x1){_0x351acc=_0x3b46f0[_0x6fad68];if(_[_0x2000('0x44')](_0x5c088d[_0x2000('0x11')][_0x351acc[_0x2000('0x25')]])){_0x5c088d[_0x2000('0x11')][_0x351acc[_0x2000('0x25')]]=new VoiceQueue(_0x351acc);}else{_0x5c088d[_0x2000('0x49')](_0x5c088d[_0x2000('0x11')][_0x351acc['name']],_0x351acc);}}}return _0x5c088d['voiceQueues'];};};Realtime['prototype']['initTriggers']=function(){var _0x4baa6e=this;return function(_0x10077e){if(_0x10077e){freeIsNotKey(_0x10077e,_0x4baa6e[_0x2000('0x12')],'id');for(var _0x8fcffd=0x0,_0x28aeb4={},_0x529d6e={};_0x8fcffd<_0x10077e[_0x2000('0x42')];_0x8fcffd+=0x1){_0x28aeb4=_0x10077e[_0x8fcffd];if(_['isUndefined'](_0x4baa6e[_0x2000('0x12')][_0x28aeb4['id']])){_0x4baa6e[_0x2000('0x12')][_0x28aeb4['id']]=new Trigger(_0x28aeb4);}else{_0x4baa6e['mergeFromDatabase'](_0x4baa6e[_0x2000('0x12')][_0x28aeb4['id']],_0x28aeb4);}}}return _0x4baa6e[_0x2000('0x12')];};};Realtime[_0x2000('0x3f')][_0x2000('0x4a')]=function(){var _0x32965f=this;return function(_0x462bfb){if(_0x462bfb){freeIsNotKey(_0x462bfb,_0x32965f[_0x2000('0x13')],'id');for(var _0x57aacd=0x0,_0x2325b6={},_0x4e8e7b={};_0x57aacd<_0x462bfb[_0x2000('0x42')];_0x57aacd+=0x1){_0x2325b6=_0x462bfb[_0x57aacd];if(_[_0x2000('0x44')](_0x32965f[_0x2000('0x13')][_0x2325b6['id']])){_0x32965f[_0x2000('0x13')][_0x2325b6['id']]=new Template(_0x2325b6);}else{_0x32965f['mergeFromDatabase'](_0x32965f[_0x2000('0x13')][_0x2325b6['id']],_0x2325b6);}}}return _0x32965f['templates'];};};Realtime[_0x2000('0x3f')][_0x2000('0x4b')]=function(){var _0x16a342=this;return function(_0xd4d8cf){if(_0xd4d8cf){freeIsNotKey(_0xd4d8cf,_0x16a342[_0x2000('0x1a')],'id');for(var _0x5015e1=0x0,_0x406eac={},_0x2baf97={};_0x5015e1<_0xd4d8cf[_0x2000('0x42')];_0x5015e1+=0x1){_0x406eac=_0xd4d8cf[_0x5015e1];if(_[_0x2000('0x44')](_0x16a342['zendeskAccounts'][_0x406eac['id']])){_0x16a342[_0x2000('0x1a')][_0x406eac['id']]=new ZendeskAccount(_0x406eac);}else{_0x16a342['mergeFromDatabase'](_0x16a342[_0x2000('0x1a')][_0x406eac['id']],_0x406eac);}}}return _0x16a342[_0x2000('0x1a')];};};Realtime[_0x2000('0x3f')]['initSalesforceAccounts']=function(){var _0x22afda=this;return function(_0xfb5af9){if(_0xfb5af9){freeIsNotKey(_0xfb5af9,_0x22afda[_0x2000('0x1b')],'id');for(var _0x446443=0x0,_0x3f1d9e={},_0x434793={};_0x446443<_0xfb5af9[_0x2000('0x42')];_0x446443+=0x1){_0x3f1d9e=_0xfb5af9[_0x446443];if(_[_0x2000('0x44')](_0x22afda[_0x2000('0x1b')][_0x3f1d9e['id']])){_0x22afda[_0x2000('0x1b')][_0x3f1d9e['id']]=new SalesforceAccount(_0x3f1d9e);}else{_0x22afda['mergeFromDatabase'](_0x22afda[_0x2000('0x1b')][_0x3f1d9e['id']],_0x3f1d9e);}}}return _0x22afda[_0x2000('0x1b')];};};Realtime[_0x2000('0x3f')][_0x2000('0x4c')]=function(){var _0x37aae5=this;return function(_0x2bd407){if(_0x2bd407){freeIsNotKey(_0x2bd407,_0x37aae5[_0x2000('0x1c')],'id');for(var _0x3e611d=0x0,_0xe3491e={},_0xe6cd24={};_0x3e611d<_0x2bd407[_0x2000('0x42')];_0x3e611d+=0x1){_0xe3491e=_0x2bd407[_0x3e611d];if(_[_0x2000('0x44')](_0x37aae5[_0x2000('0x1c')][_0xe3491e['id']])){_0x37aae5['freshdeskAccounts'][_0xe3491e['id']]=new FreshdeskAccount(_0xe3491e);}else{_0x37aae5[_0x2000('0x49')](_0x37aae5[_0x2000('0x1c')][_0xe3491e['id']],_0xe3491e);}}}return _0x37aae5['freshdeskAccounts'];};};Realtime[_0x2000('0x3f')]['initZohoAccounts']=function(){var _0x5cf993=this;return function(_0x146f8c){if(_0x146f8c){freeIsNotKey(_0x146f8c,_0x5cf993[_0x2000('0x4d')],'id');for(var _0x5189c2=0x0,_0x1a861b={},_0x118746={};_0x5189c2<_0x146f8c[_0x2000('0x42')];_0x5189c2+=0x1){_0x1a861b=_0x146f8c[_0x5189c2];if(_['isUndefined'](_0x5cf993['zohoAccounts'][_0x1a861b['id']])){_0x5cf993[_0x2000('0x4d')][_0x1a861b['id']]=new ZohoAccount(_0x1a861b);}else{_0x5cf993[_0x2000('0x49')](_0x5cf993[_0x2000('0x4d')][_0x1a861b['id']],_0x1a861b);}}}return _0x5cf993[_0x2000('0x4d')];};};Realtime[_0x2000('0x3f')][_0x2000('0x4e')]=function(){var _0x52363a=this;return function(_0x2facde){if(_0x2facde){freeIsNotKey(_0x2facde,_0x52363a[_0x2000('0x1d')],'id');for(var _0x2a19e4=0x0,_0x42b8df={},_0x4ccf14={};_0x2a19e4<_0x2facde['length'];_0x2a19e4+=0x1){_0x42b8df=_0x2facde[_0x2a19e4];if(_[_0x2000('0x44')](_0x52363a[_0x2000('0x1d')][_0x42b8df['id']])){_0x52363a['deskAccounts'][_0x42b8df['id']]=new DeskAccount(_0x42b8df);}else{_0x52363a[_0x2000('0x49')](_0x52363a[_0x2000('0x1d')][_0x42b8df['id']],_0x42b8df);}}}return _0x52363a[_0x2000('0x1d')];};};Realtime[_0x2000('0x3f')][_0x2000('0x4f')]=function(){var _0x267b04=this;return function(_0x272ae9){if(_0x272ae9){freeIsNotKey(_0x272ae9,_0x267b04[_0x2000('0x50')],'id');for(var _0x35bec8=0x0,_0x95b677={},_0x571169={};_0x35bec8<_0x272ae9[_0x2000('0x42')];_0x35bec8+=0x1){_0x95b677=_0x272ae9[_0x35bec8];if(_[_0x2000('0x44')](_0x267b04[_0x2000('0x50')][_0x95b677['id']])){_0x267b04[_0x2000('0x50')][_0x95b677['id']]=new SugarcrmAccount(_0x95b677);}else{_0x267b04['mergeFromDatabase'](_0x267b04['sugarcrmAccounts'][_0x95b677['id']],_0x95b677);}}}return _0x267b04[_0x2000('0x50')];};};Realtime[_0x2000('0x3f')]['initVtigerAccounts']=function(){var _0x252115=this;return function(_0x155a04){if(_0x155a04){freeIsNotKey(_0x155a04,_0x252115[_0x2000('0x51')],'id');for(var _0x37f08f=0x0,_0x1f62ab={},_0x4dd0fb={};_0x37f08f<_0x155a04[_0x2000('0x42')];_0x37f08f+=0x1){_0x1f62ab=_0x155a04[_0x37f08f];if(_[_0x2000('0x44')](_0x252115[_0x2000('0x51')][_0x1f62ab['id']])){_0x252115['vtigerAccounts'][_0x1f62ab['id']]=new VtigerAccount(_0x1f62ab);}else{_0x252115[_0x2000('0x49')](_0x252115['vtigerAccounts'][_0x1f62ab['id']],_0x1f62ab);}}}return _0x252115['vtigerAccounts'];};};Realtime[_0x2000('0x3f')][_0x2000('0x52')]=function(){var _0x1a7f56=this;return function(_0x258b08){if(_0x258b08){freeIsNotKey(_0x258b08,_0x1a7f56[_0x2000('0x1e')],'id');for(var _0x3321aa=0x0,_0x2c0f0a={},_0x42583e={};_0x3321aa<_0x258b08[_0x2000('0x42')];_0x3321aa+=0x1){_0x2c0f0a=_0x258b08[_0x3321aa];if(_[_0x2000('0x44')](_0x1a7f56[_0x2000('0x1e')][_0x2c0f0a['id']])){_0x1a7f56[_0x2000('0x1e')][_0x2c0f0a['id']]=new ServicenowAccount(_0x2c0f0a);}else{_0x1a7f56[_0x2000('0x49')](_0x1a7f56[_0x2000('0x1e')][_0x2c0f0a['id']],_0x2c0f0a);}}}return _0x1a7f56[_0x2000('0x1e')];};};Realtime[_0x2000('0x3f')][_0x2000('0x53')]=function(){var _0x5dfba7=this;return function(_0x4d5564){if(_0x4d5564){freeIsNotKey(_0x4d5564,_0x5dfba7[_0x2000('0x54')],'id');for(var _0x5c0bb1=0x0,_0xe56c6d={},_0x23da9e={};_0x5c0bb1<_0x4d5564[_0x2000('0x42')];_0x5c0bb1+=0x1){_0xe56c6d=_0x4d5564[_0x5c0bb1];if(_[_0x2000('0x44')](_0x5dfba7[_0x2000('0x54')][_0xe56c6d['id']])){_0x5dfba7['dynamics365Accounts'][_0xe56c6d['id']]=new Dynamics365Account(_0xe56c6d);}else{_0x5dfba7[_0x2000('0x49')](_0x5dfba7[_0x2000('0x54')][_0xe56c6d['id']],_0xe56c6d);}}}return _0x5dfba7['dynamics365Accounts'];};};Realtime[_0x2000('0x3f')][_0x2000('0x55')]=function(){var _0x2f4318=this;return function(_0xb884e1){if(_0xb884e1){freeIsNotKey(_0xb884e1,_0x2f4318[_0x2000('0x1f')],'id');for(var _0x28cf99=0x0,_0x1070f4={},_0x380412={};_0x28cf99<_0xb884e1[_0x2000('0x42')];_0x28cf99+=0x1){_0x1070f4=_0xb884e1[_0x28cf99];if(_[_0x2000('0x44')](_0x2f4318[_0x2000('0x1f')][_0x1070f4['id']])){_0x2f4318[_0x2000('0x1f')][_0x1070f4['id']]=new FreshsalesAccount(_0x1070f4);}else{_0x2f4318[_0x2000('0x49')](_0x2f4318['freshsalesAccounts'][_0x1070f4['id']],_0x1070f4);}}}return _0x2f4318[_0x2000('0x1f')];};};Realtime[_0x2000('0x3f')][_0x2000('0x56')]=function(){var _0x44cfa8=this;return function(_0x466634){for(var _0x50c580=0x0;_0x50c580<_0x466634['length'];_0x50c580+=0x1){_[_0x2000('0x57')](_0x44cfa8[_0x2000('0x11')][_0x466634[_0x50c580]['name']],_0x466634[_0x50c580]);}return _0x44cfa8['voiceQueues'];};};Realtime[_0x2000('0x3f')][_0x2000('0x58')]=function(){var _0x4fd87e=this;return function(_0x2c9c50){clearVoiceQueues(_0x4fd87e['voiceQueues']);if(_0x2c9c50){_0x2c9c50=_['groupBy'](_0x2c9c50,_0x2000('0x59'));for(var _0x5a2c6f in _0x2c9c50){if(_0x2c9c50[_0x2000('0x22')](_0x5a2c6f)){var _0x10ea67={};for(var _0x5c2b4b=0x0;_0x5c2b4b<_0x2c9c50[_0x5a2c6f]['length'];_0x5c2b4b+=0x1){var _0x60006=_0x2c9c50[_0x5a2c6f][_0x5c2b4b][_0x2000('0x5a')];if(_0x4fd87e[_0x2000('0x11')][_0x60006]){if(_0x2c9c50[_0x5a2c6f][_0x5c2b4b][_0x2000('0x5b')]){_0x4fd87e[_0x2000('0x11')][_0x60006][_0x2000('0x2f')]+=0x1;}if(_0x2c9c50[_0x5a2c6f][_0x5c2b4b][_0x2000('0x5c')]){_0x4fd87e[_0x2000('0x11')][_0x60006][_0x2000('0x30')]+=0x1;}_0x4fd87e['voiceQueues'][_0x60006]['sumHoldTime']+=moment(_0x2c9c50[_0x5a2c6f][_0x5c2b4b][_0x2000('0x5d')])[_0x2000('0x5e')](moment(_0x2c9c50[_0x5a2c6f][_0x5c2b4b][_0x2000('0x5f')]),_0x2000('0x60'))||0x0;if(_0x5c2b4b===_0x2c9c50[_0x5a2c6f]['length']-0x1){_0x4fd87e[_0x2000('0x11')][_0x60006]['sumDuration']+=moment(_0x2c9c50[_0x5a2c6f][_0x5c2b4b][_0x2000('0x61')]||_0x2c9c50[_0x5a2c6f][_0x5c2b4b][_0x2000('0x62')]||_0x2c9c50[_0x5a2c6f][_0x5c2b4b]['queuecallerexitAt'])[_0x2000('0x5e')](moment(_0x2c9c50[_0x5a2c6f][_0x5c2b4b]['queuecallerjoinAt']),_0x2000('0x60'))||0x0;_0x4fd87e[_0x2000('0x11')][_0x60006][_0x2000('0x27')]+=0x1;if(_0x2c9c50[_0x5a2c6f][_0x5c2b4b][_0x2000('0x63')]){_0x4fd87e[_0x2000('0x11')][_0x60006][_0x2000('0x2e')]+=0x1;_0x4fd87e[_0x2000('0x11')][_0x60006][_0x2000('0x2a')]+=moment(_0x2c9c50[_0x5a2c6f][_0x5c2b4b][_0x2000('0x61')])[_0x2000('0x5e')](moment(_0x2c9c50[_0x5a2c6f][_0x5c2b4b][_0x2000('0x5d')]),'seconds')||0x0;}}else{_0x4fd87e[_0x2000('0x11')][_0x60006]['sumDuration']+=_0x4fd87e[_0x2000('0x11')][_0x60006][_0x2000('0x28')]||0x0;}}}}}}return _0x4fd87e[_0x2000('0x11')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x235bd7=this;return function(_0x212cb7){clearVoiceCallReports(_0x235bd7['outbound']);if(_0x212cb7){for(var _0x37f9a4=0x0;_0x37f9a4<_0x212cb7[_0x2000('0x42')];_0x37f9a4+=0x1){_0x235bd7[_0x2000('0x14')][_0x2000('0x27')]+=0x1;_0x235bd7[_0x2000('0x14')][_0x2000('0x29')]+=_0x212cb7[_0x37f9a4][_0x2000('0x64')];if(_0x212cb7[_0x37f9a4]['disposition']===_0x2000('0x65')){_0x235bd7[_0x2000('0x14')][_0x2000('0x2e')]+=0x1;_0x235bd7['outbound']['sumHoldTime']+=_0x212cb7[_0x37f9a4][_0x2000('0x64')]-_0x212cb7[_0x37f9a4][_0x2000('0x66')]||0x0;_0x235bd7['outbound']['sumBillable']+=_0x212cb7[_0x37f9a4][_0x2000('0x66')];}}}return _0x235bd7[_0x2000('0x14')];};};Realtime[_0x2000('0x3f')][_0x2000('0x67')]=function(){var _0xdad01=this;return function(_0x29aef4){if(_0x29aef4){freeIsNotKey(_0x29aef4,_0xdad01[_0x2000('0x68')],_0x2000('0x25'));for(var _0x45642e=0x0,_0x5267d3={};_0x45642e<_0x29aef4[_0x2000('0x42')];_0x45642e+=0x1){_0x5267d3=_0x29aef4[_0x45642e];if(_[_0x2000('0x44')](_0xdad01[_0x2000('0x68')][_0x5267d3[_0x2000('0x25')]])){_0xdad01[_0x2000('0x68')][_0x5267d3[_0x2000('0x25')]]=new Campaign(_0x5267d3);}else{_0xdad01[_0x2000('0x49')](_0xdad01[_0x2000('0x68')][_0x5267d3[_0x2000('0x25')]],_0x5267d3);_0xdad01['campaigns'][_0x5267d3['name']][_0x2000('0x69')]=_0x5267d3['SquareProject']?_0x5267d3[_0x2000('0x6a')][_0x2000('0x25')]:undefined;}}}return _0xdad01[_0x2000('0x68')];};};Realtime[_0x2000('0x3f')][_0x2000('0x6b')]=function(){var _0x6ac70e=this;return function(_0x4e238a){if(_0x4e238a){freeIsNotKey(_0x4e238a,_0x6ac70e[_0x2000('0x6c')],'id');for(var _0x2bc894=0x0,_0x5bf623={};_0x2bc894<_0x4e238a[_0x2000('0x42')];_0x2bc894+=0x1){_0x5bf623=_0x4e238a[_0x2bc894];if(_[_0x2000('0x44')](_0x6ac70e['voiceExtensions'][_0x5bf623['id']])){_0x6ac70e['voiceExtensions'][_0x5bf623['id']]=new VoiceExtension(_0x5bf623);}else{_0x6ac70e[_0x2000('0x49')](_0x6ac70e[_0x2000('0x6c')][_0x5bf623['id']],_0x5bf623);}}}return _0x6ac70e[_0x2000('0x6c')];};};Realtime[_0x2000('0x3f')]['initCampaignHopperHistory']=function(){var _0x5a7cb6=this;return function(_0x32cc41){clearCampaigns(_0x5a7cb6[_0x2000('0x68')]);for(var _0x1cc4dd=0x0;_0x1cc4dd<_0x32cc41[_0x2000('0x42')];_0x1cc4dd+=0x1){_[_0x2000('0x57')](_0x5a7cb6[_0x2000('0x68')][_0x32cc41[_0x1cc4dd][_0x2000('0x25')]],_0x32cc41[_0x1cc4dd]);}return _0x5a7cb6[_0x2000('0x68')];};};Realtime[_0x2000('0x3f')][_0x2000('0x6d')]=function(){var _0x44d4bf=this;return function(_0x1f5f39){if(_0x1f5f39){freeIsNotKey(_0x1f5f39,_0x44d4bf[_0x2000('0x20')],'id');for(var _0x454451=0x0,_0x5c3ff4={},_0x152aa6={};_0x454451<_0x1f5f39['length'];_0x454451+=0x1){_0x5c3ff4=_0x1f5f39[_0x454451];if(_[_0x2000('0x44')](_0x44d4bf[_0x2000('0x20')][_0x5c3ff4['id']])){_0x44d4bf[_0x2000('0x20')][_0x5c3ff4['id']]=new FaxAccount(_0x5c3ff4);}else{_0x44d4bf[_0x2000('0x49')](_0x44d4bf[_0x2000('0x20')][_0x5c3ff4['id']],_0x5c3ff4);}}}return _0x44d4bf[_0x2000('0x20')];};};module[_0x2000('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 1fd5314..fa58033 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 _0xcce1=['transfererlinkedid','exports','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','find','format','SIP/%s','voiceQueueReport','length','connectedlinenum','assigned','lastAssignedTo','interface','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','type','dialer','lastapplication','queue','lastdata','context','destination','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','uniqueid','blindTransfer','monitor','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile'];(function(_0x4329c5,_0x4bfad6){var _0x285b58=function(_0x4616bc){while(--_0x4616bc){_0x4329c5['push'](_0x4329c5['shift']());}};_0x285b58(++_0x4bfad6);}(_0xcce1,0x107));var _0x1cce=function(_0x3a4203,_0xa6ff2e){_0x3a4203=_0x3a4203-0x0;var _0x1a5661=_0xcce1[_0x3a4203];return _0x1a5661;};'use strict';var _=require(_0x1cce('0x0'));var moment=require(_0x1cce('0x1'));var util=require(_0x1cce('0x2'));var config=require('../../../config/environment');var ami=require(_0x1cce('0x3'));var RpcVoiceAgentReport=require(_0x1cce('0x4'));var RpcVoiceCallReport=require(_0x1cce('0x5'));var RpcVoiceDialReport=require(_0x1cce('0x6'));var RpcMemberReport=require(_0x1cce('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x1cce('0x8'));var RpcVoiceTransferReport=require(_0x1cce('0x9'));var VoiceQueueReport=require(_0x1cce('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x1cce('0xb'));var VoiceDialReport=require(_0x1cce('0xc'));var UserReport=require('./userReport');function Report(_0x3d30cb){this[_0x1cce('0xd')]=_0x3d30cb;this['agents']=_0x3d30cb[_0x1cce('0xe')];this[_0x1cce('0xf')]=_0x3d30cb['telephones'];}Report[_0x1cce('0x10')][_0x1cce('0x11')]=function(_0x452280){var _0x721db9=new VoiceQueueReport(this['realtime']);var _0x453d43=new VoiceAgentReport(this[_0x1cce('0xd')]);var _0x9232bb=new VoiceDialReport(this['realtime']);var _0x27578=new VoiceCallReport(this[_0x1cce('0xd')]);var _0x275127=new UserReport(this[_0x1cce('0xd')]);if(config['xdr']&&config[_0x1cce('0x12')][_0x1cce('0x13')]){ami['on'](_0x1cce('0x14'),this['voiceQueueReport'][_0x1cce('0x15')](this));ami['on'](_0x1cce('0x16'),this[_0x1cce('0x17')]['bind'](this));ami['on'](_0x1cce('0x18'),this[_0x1cce('0x19')]['bind'](this));ami['on']('custom:voiceDialReport',this[_0x1cce('0x1a')][_0x1cce('0x15')](this));ami['on'](_0x1cce('0x1b'),this['blindTransfer']['bind'](this));ami['on'](_0x1cce('0x1c'),this[_0x1cce('0x1d')]['bind'](this));}};Report[_0x1cce('0x10')][_0x1cce('0x1e')]=function(_0x5b2171){var _0xfe62ec;_0xfe62ec=_['find'](this[_0x1cce('0xe')],function(_0x24c09b){return _0x24c09b[_0x1cce('0x1f')]==_0x5b2171||_0x24c09b[_0x1cce('0x20')]==_0x5b2171;});if(_['isNil'](_0xfe62ec)){var _0x45a2cf=_[_0x1cce('0x21')](this[_0x1cce('0xf')],function(_0x29c508){return _0x29c508[_0x1cce('0x1f')]==_0x5b2171||_0x29c508['name']==_0x5b2171;});if(_0x45a2cf){_0xfe62ec=_[_0x1cce('0x21')](this['agents'],function(_0xd32bdf){return _0xd32bdf['interface']==util[_0x1cce('0x22')](_0x1cce('0x23'),_0x45a2cf[_0x1cce('0x20')]);});}}return _0xfe62ec;};Report[_0x1cce('0x10')][_0x1cce('0x24')]=function(_0x29e485){for(var _0x1a3b9a=0x0;_0x1a3b9a<_0x29e485[_0x1cce('0x25')];_0x1a3b9a+=0x1){var _0x288a93=this[_0x1cce('0x1e')](_0x29e485[_0x1a3b9a][_0x1cce('0x26')]);if(_0x288a93){_0x29e485[_0x1a3b9a][_0x1cce('0x1f')]=_0x288a93[_0x1cce('0x1f')];_0x29e485[_0x1a3b9a][_0x1cce('0x27')]=!![];_0x29e485[_0x1a3b9a][_0x1cce('0x28')]=_0x288a93['name'];_0x29e485[_0x1a3b9a][_0x1cce('0x29')]=_[_0x1cce('0x2a')](_0x288a93[_0x1cce('0x29')])?util['format'](_0x1cce('0x23'),_0x288a93[_0x1cce('0x20')]):_0x288a93[_0x1cce('0x29')];if(_0x29e485[_0x1a3b9a][_0x1cce('0x2b')]){_0x29e485[_0x1a3b9a][_0x1cce('0x2c')]=moment()['format'](_0x1cce('0x2d'));}if(_0x29e485[_0x1a3b9a][_0x1cce('0x2e')]){_0x29e485[_0x1a3b9a]['queuecallerexitAt']=moment()[_0x1cce('0x22')](_0x1cce('0x2d'));}RpcMemberReport[_0x1cce('0x24')](_0x29e485[_0x1a3b9a]);}RpcVoiceQueueReport[_0x1cce('0x2f')](_0x29e485[_0x1a3b9a]);}};function extractCalleridNumber(_0x1fdca5){var _0x47712e=_0x1fdca5[_0x1cce('0x30')](/<(.*?)>/);return _0x47712e?_0x47712e[0x1]:_0x1fdca5;}Report[_0x1cce('0x10')][_0x1cce('0x17')]=function(_0x30c025){_0x30c025['destination']=_0x30c025['destination']||_0x30c025['exten'];if(_0x30c025[_0x1cce('0x31')]==_0x1cce('0x32')){_0x30c025[_0x1cce('0x33')]=_0x1cce('0x34');_0x30c025[_0x1cce('0x35')]=_0x30c025[_0x1cce('0x34')];if(_0x30c025[_0x1cce('0x36')]=='from-voip-provider'){_0x30c025[_0x1cce('0x1f')]='';_0x30c025[_0x1cce('0x37')]=extractCalleridNumber(_0x30c025[_0x1cce('0x38')]);}else if(_0x30c025[_0x1cce('0x36')]==_0x1cce('0x39')){if(_0x30c025[_0x1cce('0x37')]==_0x1cce('0x3a')){_0x30c025[_0x1cce('0x37')]=extractCalleridNumber(_0x30c025[_0x1cce('0x3b')]);_0x30c025[_0x1cce('0x3c')]=_0x30c025[_0x1cce('0x3d')];_0x30c025[_0x1cce('0x3e')]=[_0x30c025['channel'],_0x30c025['channel']=_0x30c025[_0x1cce('0x3e')]][0x0];_0x30c025[_0x1cce('0x38')]=_0x30c025[_0x1cce('0x3b')];}else{_0x30c025['destination']=_0x30c025[_0x1cce('0x3c')];_0x30c025[_0x1cce('0x3c')]=_0x30c025[_0x1cce('0x3d')];if(_0x30c025['disposition']=='ANSWERED'){_0x30c025['accountcode']=_0x30c025[_0x1cce('0x26')];}else{_0x30c025[_0x1cce('0x1f')]='';}}}}else{_0x30c025[_0x1cce('0x38')]=util[_0x1cce('0x22')](_0x1cce('0x3f'),_0x30c025[_0x1cce('0x40')],_0x30c025[_0x1cce('0x3c')]);}if(RpcVoiceTransferReport['transfers'][_0x30c025[_0x1cce('0x41')]]){var _0x38ddc4=RpcVoiceTransferReport[_0x1cce('0x42')][_0x30c025[_0x1cce('0x41')]];_0x38ddc4['transfereelinkedid']=_0x30c025[_0x1cce('0x43')];RpcVoiceTransferReport[_0x1cce('0x44')](_0x38ddc4);delete RpcVoiceTransferReport[_0x1cce('0x42')][_0x30c025[_0x1cce('0x41')]];}RpcVoiceCallReport['create'](_0x30c025);if(_0x30c025[_0x1cce('0x45')]){for(var _0x21954f=0x0;_0x21954f<_0x30c025[_0x1cce('0x46')][_0x1cce('0x25')];_0x21954f+=0x1){_0x30c025[_0x1cce('0x47')]=_0x30c025[_0x1cce('0x46')][_0x21954f][_0x1cce('0x48')];_0x30c025[_0x1cce('0x49')]=_0x30c025['monitors'][_0x21954f]['createdAt'];if(_0x30c025[_0x1cce('0x4a')]==_0x1cce('0x3a')){_0x30c025[_0x1cce('0x3c')]=_0x30c025[_0x1cce('0x26')];_0x30c025['calleridname']=_0x30c025['connectedlinename'];_0x30c025[_0x1cce('0x26')]=_0x30c025[_0x1cce('0x1f')];_0x30c025[_0x1cce('0x4b')]=_0x30c025[_0x1cce('0x4c')];_0x30c025[_0x1cce('0x4a')]=_0x30c025[_0x1cce('0x3d')];}else if(_0x30c025[_0x1cce('0x4a')]==_0x1cce('0x4d')){_0x30c025[_0x1cce('0x3c')]=_0x30c025[_0x1cce('0x37')];_0x30c025['exten']=_0x30c025[_0x1cce('0x3d')];}RpcVoiceRecording[_0x1cce('0x2f')](_0x30c025);}}};Report[_0x1cce('0x10')][_0x1cce('0x19')]=function(_0x26eb21){if(_[_0x1cce('0x4e')](_0x26eb21)){_0x26eb21[_0x1cce('0x4f')](function(_0x2be2c4){RpcVoiceAgentReport[_0x1cce('0x2f')](_0x2be2c4);});}else{RpcVoiceAgentReport['create'](_0x26eb21);}};Report[_0x1cce('0x10')][_0x1cce('0x1a')]=function(_0x1e9807){RpcVoiceDialReport[_0x1cce('0x2f')](_0x1e9807);var _0x231a19;var _0xdd0af0;var _0x5919e8=_0x1e9807['channel'];if(_[_0x1cce('0x50')](_0x5919e8,_0x1cce('0x51'))){_0xdd0af0=_0x5919e8[_0x1cce('0x52')](_0x5919e8[_0x1cce('0x53')]('/')+0x1,_0x5919e8[_0x1cce('0x53')]('@'));_0x231a19=_[_0x1cce('0x21')](this[_0x1cce('0xe')],function(_0x265f49){return _0x265f49[_0x1cce('0x54')]==_0xdd0af0||_0x265f49['phone']==_0xdd0af0||_0x265f49['accountcode']==_0xdd0af0;});}else{_0xdd0af0=_0x5919e8['substring'](_0x5919e8[_0x1cce('0x53')]('/')+0x1,_0x5919e8['lastIndexOf']('-'));_0x231a19=this[_0x1cce('0x1e')](_0xdd0af0);}if(_0x231a19){_0x1e9807['interface']=_[_0x1cce('0x2a')](_0x231a19[_0x1cce('0x29')])?util['format'](_0x1cce('0x23'),_0x231a19[_0x1cce('0x20')]):_0x231a19[_0x1cce('0x29')];_0x1e9807['membername']=_0x231a19[_0x1cce('0x20')];_0x1e9807[_0x1cce('0x1f')]=_0x231a19[_0x1cce('0x1f')];RpcMemberReport[_0x1cce('0x1a')](_0x1e9807);}};Report[_0x1cce('0x10')][_0x1cce('0x44')]=function(_0x47fe25){RpcVoiceTransferReport[_0x1cce('0x42')][_0x47fe25[_0x1cce('0x55')]]=_0x47fe25;};Report[_0x1cce('0x10')]['attendedTransfer']=function(_0x2e6475){RpcVoiceTransferReport['attendedTransfer'](_0x2e6475);};module[_0x1cce('0x56')]=Report; \ No newline at end of file +var _0x1298=['indexOf','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','accountcode','name','isNil','find','interface','format','SIP/%s','length','findAgent','connectedlinenum','assigned','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','voiceCallReport','destination','dialer','queue','context','callerid','from-sip','calleridnum','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','monitor','monitors','filename','createdAt','connectedlinename','membername','exten','isArray','forEach','startsWith','Local','substring'];(function(_0x50f612,_0x50836e){var _0x262072=function(_0x3a8ddb){while(--_0x3a8ddb){_0x50f612['push'](_0x50f612['shift']());}};_0x262072(++_0x50836e);}(_0x1298,0x1e5));var _0x8129=function(_0x3e01e0,_0x2564b7){_0x3e01e0=_0x3e01e0-0x0;var _0x3cbfcc=_0x1298[_0x3e01e0];return _0x3cbfcc;};'use strict';var _=require(_0x8129('0x0'));var moment=require(_0x8129('0x1'));var util=require(_0x8129('0x2'));var config=require(_0x8129('0x3'));var ami=require(_0x8129('0x4'));var RpcVoiceAgentReport=require(_0x8129('0x5'));var RpcVoiceCallReport=require(_0x8129('0x6'));var RpcVoiceDialReport=require(_0x8129('0x7'));var RpcMemberReport=require(_0x8129('0x8'));var RpcVoiceQueueReport=require(_0x8129('0x9'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x8129('0xa'));var VoiceAgentReport=require(_0x8129('0xb'));var VoiceDialReport=require(_0x8129('0xc'));var UserReport=require('./userReport');function Report(_0x2b90ac){this[_0x8129('0xd')]=_0x2b90ac;this[_0x8129('0xe')]=_0x2b90ac[_0x8129('0xe')];this['telephones']=_0x2b90ac[_0x8129('0xf')];}Report[_0x8129('0x10')][_0x8129('0x11')]=function(_0x16e7f9){var _0x5260c2=new VoiceQueueReport(this[_0x8129('0xd')]);var _0x507ae2=new VoiceAgentReport(this[_0x8129('0xd')]);var _0x5a081b=new VoiceDialReport(this['realtime']);var _0x26102e=new VoiceCallReport(this['realtime']);var _0xa9a6c8=new UserReport(this['realtime']);if(config[_0x8129('0x12')]&&config[_0x8129('0x12')][_0x8129('0x13')]){ami['on']('custom:voiceQueueReport',this[_0x8129('0x14')][_0x8129('0x15')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0x8129('0x15')](this));ami['on'](_0x8129('0x16'),this[_0x8129('0x17')]['bind'](this));ami['on'](_0x8129('0x18'),this[_0x8129('0x19')][_0x8129('0x15')](this));ami['on']('blindtransfer',this[_0x8129('0x1a')]['bind'](this));ami['on'](_0x8129('0x1b'),this['attendedTransfer'][_0x8129('0x15')](this));}};Report[_0x8129('0x10')]['findAgent']=function(_0x2f1da7){var _0x4fd93f;_0x4fd93f=_['find'](this['agents'],function(_0x5bead5){return _0x5bead5[_0x8129('0x1c')]==_0x2f1da7||_0x5bead5[_0x8129('0x1d')]==_0x2f1da7;});if(_[_0x8129('0x1e')](_0x4fd93f)){var _0x52b14a=_[_0x8129('0x1f')](this['telephones'],function(_0x7df8ff){return _0x7df8ff[_0x8129('0x1c')]==_0x2f1da7||_0x7df8ff[_0x8129('0x1d')]==_0x2f1da7;});if(_0x52b14a){_0x4fd93f=_[_0x8129('0x1f')](this[_0x8129('0xe')],function(_0x7e6882){return _0x7e6882[_0x8129('0x20')]==util[_0x8129('0x21')](_0x8129('0x22'),_0x52b14a[_0x8129('0x1d')]);});}}return _0x4fd93f;};Report[_0x8129('0x10')]['voiceQueueReport']=function(_0x291569){for(var _0x46576a=0x0;_0x46576a<_0x291569[_0x8129('0x23')];_0x46576a+=0x1){var _0x586248=this[_0x8129('0x24')](_0x291569[_0x46576a][_0x8129('0x25')]);if(_0x586248){_0x291569[_0x46576a][_0x8129('0x1c')]=_0x586248[_0x8129('0x1c')];_0x291569[_0x46576a][_0x8129('0x26')]=!![];_0x291569[_0x46576a][_0x8129('0x27')]=_0x586248[_0x8129('0x1d')];_0x291569[_0x46576a][_0x8129('0x20')]=_[_0x8129('0x1e')](_0x586248[_0x8129('0x20')])?util[_0x8129('0x21')]('SIP/%s',_0x586248['name']):_0x586248[_0x8129('0x20')];if(_0x291569[_0x46576a]['queuecallercomplete']){_0x291569[_0x46576a][_0x8129('0x28')]=moment()[_0x8129('0x21')](_0x8129('0x29'));}if(_0x291569[_0x46576a][_0x8129('0x2a')]){_0x291569[_0x46576a][_0x8129('0x2b')]=moment()['format'](_0x8129('0x29'));}RpcMemberReport[_0x8129('0x14')](_0x291569[_0x46576a]);}RpcVoiceQueueReport[_0x8129('0x2c')](_0x291569[_0x46576a]);}};function extractCalleridNumber(_0x32f8b4){var _0x3958af=_0x32f8b4[_0x8129('0x2d')](/<(.*?)>/);return _0x3958af?_0x3958af[0x1]:_0x32f8b4;}Report[_0x8129('0x10')][_0x8129('0x2e')]=function(_0xe9c882){_0xe9c882[_0x8129('0x2f')]=_0xe9c882[_0x8129('0x2f')]||_0xe9c882['exten'];if(_0xe9c882['type']==_0x8129('0x30')){_0xe9c882['lastapplication']=_0x8129('0x31');_0xe9c882['lastdata']=_0xe9c882['queue'];if(_0xe9c882[_0x8129('0x32')]=='from-voip-provider'){_0xe9c882[_0x8129('0x1c')]='';_0xe9c882['destination']=extractCalleridNumber(_0xe9c882[_0x8129('0x33')]);}else if(_0xe9c882['context']==_0x8129('0x34')){if(_0xe9c882['destination']=='xcally-motion-preview'){_0xe9c882[_0x8129('0x2f')]=extractCalleridNumber(_0xe9c882['calleridpreview']);_0xe9c882[_0x8129('0x35')]=_0xe9c882[_0x8129('0x36')];_0xe9c882[_0x8129('0x37')]=[_0xe9c882[_0x8129('0x38')],_0xe9c882[_0x8129('0x38')]=_0xe9c882[_0x8129('0x37')]][0x0];_0xe9c882[_0x8129('0x33')]=_0xe9c882[_0x8129('0x39')];}else{_0xe9c882[_0x8129('0x2f')]=_0xe9c882['calleridnum'];_0xe9c882[_0x8129('0x35')]=_0xe9c882[_0x8129('0x36')];if(_0xe9c882[_0x8129('0x3a')]==_0x8129('0x3b')){_0xe9c882[_0x8129('0x1c')]=_0xe9c882[_0x8129('0x25')];}else{_0xe9c882[_0x8129('0x1c')]='';}}}}else{_0xe9c882[_0x8129('0x33')]=util[_0x8129('0x21')](_0x8129('0x3c'),_0xe9c882['calleridname'],_0xe9c882['calleridnum']);}if(RpcVoiceTransferReport['transfers'][_0xe9c882['linkedid']]){var _0x3b823d=RpcVoiceTransferReport[_0x8129('0x3d')][_0xe9c882[_0x8129('0x3e')]];_0x3b823d['transfereelinkedid']=_0xe9c882['uniqueid'];RpcVoiceTransferReport[_0x8129('0x1a')](_0x3b823d);delete RpcVoiceTransferReport[_0x8129('0x3d')][_0xe9c882[_0x8129('0x3e')]];}RpcVoiceCallReport[_0x8129('0x2c')](_0xe9c882);if(_0xe9c882[_0x8129('0x3f')]){for(var _0x3f223c=0x0;_0x3f223c<_0xe9c882[_0x8129('0x40')][_0x8129('0x23')];_0x3f223c+=0x1){_0xe9c882['monitorFilename']=_0xe9c882[_0x8129('0x40')][_0x3f223c][_0x8129('0x41')];_0xe9c882['createdAt']=_0xe9c882[_0x8129('0x40')][_0x3f223c][_0x8129('0x42')];if(_0xe9c882['exten']=='xcally-motion-preview'){_0xe9c882['calleridnum']=_0xe9c882['connectedlinenum'];_0xe9c882['calleridname']=_0xe9c882[_0x8129('0x43')];_0xe9c882['connectedlinenum']=_0xe9c882[_0x8129('0x1c')];_0xe9c882[_0x8129('0x43')]=_0xe9c882[_0x8129('0x44')];_0xe9c882[_0x8129('0x45')]=_0xe9c882[_0x8129('0x36')];}else if(_0xe9c882[_0x8129('0x45')]=='xcally-motion-dialer'){_0xe9c882[_0x8129('0x35')]=_0xe9c882['destination'];_0xe9c882[_0x8129('0x45')]=_0xe9c882[_0x8129('0x36')];}RpcVoiceRecording[_0x8129('0x2c')](_0xe9c882);}}};Report[_0x8129('0x10')][_0x8129('0x17')]=function(_0x1213f9){if(_[_0x8129('0x46')](_0x1213f9)){_0x1213f9[_0x8129('0x47')](function(_0x2baf54){RpcVoiceAgentReport[_0x8129('0x2c')](_0x2baf54);});}else{RpcVoiceAgentReport[_0x8129('0x2c')](_0x1213f9);}};Report['prototype'][_0x8129('0x19')]=function(_0x2a3e24){RpcVoiceDialReport[_0x8129('0x2c')](_0x2a3e24);var _0x4cbf39;var _0x3c55bc;var _0x4b4adb=_0x2a3e24[_0x8129('0x38')];if(_[_0x8129('0x48')](_0x4b4adb,_0x8129('0x49'))){_0x3c55bc=_0x4b4adb[_0x8129('0x4a')](_0x4b4adb[_0x8129('0x4b')]('/')+0x1,_0x4b4adb['indexOf']('@'));_0x4cbf39=_['find'](this['agents'],function(_0x6b0026){return _0x6b0026['mobile']==_0x3c55bc||_0x6b0026['phone']==_0x3c55bc||_0x6b0026[_0x8129('0x1c')]==_0x3c55bc;});}else{_0x3c55bc=_0x4b4adb[_0x8129('0x4a')](_0x4b4adb[_0x8129('0x4b')]('/')+0x1,_0x4b4adb[_0x8129('0x4c')]('-'));_0x4cbf39=this[_0x8129('0x24')](_0x3c55bc);}if(_0x4cbf39){_0x2a3e24[_0x8129('0x20')]=_[_0x8129('0x1e')](_0x4cbf39[_0x8129('0x20')])?util[_0x8129('0x21')](_0x8129('0x22'),_0x4cbf39['name']):_0x4cbf39['interface'];_0x2a3e24[_0x8129('0x44')]=_0x4cbf39[_0x8129('0x1d')];_0x2a3e24[_0x8129('0x1c')]=_0x4cbf39['accountcode'];RpcMemberReport[_0x8129('0x19')](_0x2a3e24);}};Report[_0x8129('0x10')]['blindTransfer']=function(_0x61979f){RpcVoiceTransferReport[_0x8129('0x3d')][_0x61979f[_0x8129('0x4d')]]=_0x61979f;};Report['prototype'][_0x8129('0x4e')]=function(_0x348230){RpcVoiceTransferReport[_0x8129('0x4e')](_0x348230);};module[_0x8129('0x4f')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 9cb6451..7133b85 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xecbd=['trunk:%s','name','trunk:save','debug','device','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','startsWith','Local','substring','indexOf','mobile','phone','accountcode','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','util','bluebird','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','then','actionDeviceStateList','[userReport][devicestatelist]','resolve','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isUndefined','emit','isNotNull','info','username','[userReport][registry]','find','state','merge','omit','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format'];(function(_0x8f581c,_0xfbd8c){var _0x2c0c22=function(_0x23e343){while(--_0x23e343){_0x8f581c['push'](_0x8f581c['shift']());}};_0x2c0c22(++_0xfbd8c);}(_0xecbd,0x66));var _0xdecb=function(_0x40d8cb,_0x3ae045){_0x40d8cb=_0x40d8cb-0x0;var _0x252853=_0xecbd[_0x40d8cb];return _0x252853;};'use strict';var _=require(_0xdecb('0x0'));var moment=require(_0xdecb('0x1'));var util=require(_0xdecb('0x2'));var Redis=require('ioredis');var BPromise=require(_0xdecb('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require(_0xdecb('0x4'));config['redis']=_[_0xdecb('0x5')](config[_0xdecb('0x6')],{'host':_0xdecb('0x7'),'port':0x18eb});var io=require(_0xdecb('0x8'))(new Redis(config['redis']));function UserReport(_0x4652ee){this[_0xdecb('0x9')]=_0x4652ee[_0xdecb('0x9')];this[_0xdecb('0xa')]=_0x4652ee[_0xdecb('0xa')];this[_0xdecb('0xb')]=_0x4652ee[_0xdecb('0xb')];ami['on'](_0xdecb('0xc'),this[_0xdecb('0xd')][_0xdecb('0xe')](this));ami['on'](_0xdecb('0xf'),this[_0xdecb('0xd')]['bind'](this));ami['on'](_0xdecb('0x10'),this[_0xdecb('0x11')][_0xdecb('0xe')](this));ami['on'](_0xdecb('0x12'),this[_0xdecb('0x13')][_0xdecb('0xe')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()['then'](ami[_0xdecb('0x14')]())[_0xdecb('0x15')](function(_0x5ead02){logger[_0xdecb('0x16')](_0xdecb('0x17'),util[_0xdecb('0x18')](_0x5ead02,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xdecb('0x19')](ami[_0xdecb('0x1a')]())['catch'](function(_0x355ed6){logger[_0xdecb('0x16')](_0xdecb('0x1b'),util['inspect'](_0x355ed6,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xdecb('0x1c')]()[_0xdecb('0x19')](ami[_0xdecb('0x1d')]())[_0xdecb('0x15')](function(_0x45a556){logger[_0xdecb('0x16')](_0xdecb('0x1e'),util[_0xdecb('0x18')](_0x45a556,{'showHidden':![],'depth':null}));});}UserReport[_0xdecb('0x1f')][_0xdecb('0x20')]=function(){setInterval(function(){BPromise['resolve']()[_0xdecb('0x19')](showSipRegistrations())['then'](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0xdecb('0x1f')]['isNotNull']=function(_0x223066){return _0x223066!==null&&!_[_0xdecb('0x21')](_0x223066);};UserReport[_0xdecb('0x1f')][_0xdecb('0x22')]=function(_0x58540e,_0x39bf7d,_0x738e4c){io['to'](_0x58540e)[_0xdecb('0x22')](_0x39bf7d,_0x738e4c);};UserReport['prototype'][_0xdecb('0xd')]=function(_0xb70701){try{if(this[_0xdecb('0x23')](_0xb70701)){logger[_0xdecb('0x24')]('[userReport][registry]\x20registry:%s\x20state:%s',_0xb70701[_0xdecb('0x25')],_0xb70701['state']);logger['debug'](_0xdecb('0x26'),util['inspect'](_0xb70701,{'showHidden':![],'depth':null}));var _0x3bdcb3=_[_0xdecb('0x27')](this[_0xdecb('0x9')],{'defaultuser':_0xb70701[_0xdecb('0x25')]});if(_0x3bdcb3){_0xb70701['stateRegistry']=_0xb70701[_0xdecb('0x28')];_[_0xdecb('0x29')](_0x3bdcb3,_[_0xdecb('0x2a')](_0xb70701,['event',_0xdecb('0x2b'),_0xdecb('0x25'),_0xdecb('0x28')]));logger['debug'](_0xdecb('0x2c'),util['inspect'](_0x3bdcb3,{'showHidden':![],'depth':null}));this[_0xdecb('0x22')](util[_0xdecb('0x2d')](_0xdecb('0x2e'),_0x3bdcb3[_0xdecb('0x2f')]),_0xdecb('0x30'),_0x3bdcb3);}}}catch(_0x110795){logger[_0xdecb('0x16')](_0xdecb('0x26'),util[_0xdecb('0x18')](_0x110795,{'showHidden':![],'depth':null}));}};UserReport[_0xdecb('0x1f')][_0xdecb('0x11')]=function(_0x5d083d){try{if(this['isNotNull'](_0x5d083d)){logger[_0xdecb('0x24')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x5d083d['device'],_0x5d083d['state']);logger[_0xdecb('0x31')]('[userReport][devicestatechange]',util[_0xdecb('0x18')](_0x5d083d,{'showHidden':![],'depth':null}));if(this[_0xdecb('0xa')][_0x5d083d['device']]){if(!this['agents'][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x33')]||_0x5d083d[_0xdecb('0x28')][_0xdecb('0x34')]()=='inuse'){this[_0xdecb('0xa')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x33')]=![];if(this[_0xdecb('0xa')][_0x5d083d['device']][_0xdecb('0x28')]!==_0x5d083d[_0xdecb('0x28')][_0xdecb('0x34')]()){this[_0xdecb('0xa')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x35')]=_[_0xdecb('0x36')](moment()['format']('x'));}this['agents'][_0x5d083d[_0xdecb('0x32')]]['state']=_0x5d083d[_0xdecb('0x28')][_0xdecb('0x34')]();this[_0xdecb('0xa')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x37')](_0x5d083d);}}else if(this[_0xdecb('0xb')][_0x5d083d['device']]){if(this[_0xdecb('0xb')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x28')]!==_0x5d083d[_0xdecb('0x28')][_0xdecb('0x34')]()){this[_0xdecb('0xb')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x35')]=_[_0xdecb('0x36')](moment()[_0xdecb('0x2d')]('x'));}this[_0xdecb('0xb')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x28')]=_0x5d083d[_0xdecb('0x28')][_0xdecb('0x34')]();logger[_0xdecb('0x31')](_0xdecb('0x38'),util[_0xdecb('0x18')](this[_0xdecb('0xb')][_0x5d083d[_0xdecb('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xdecb('0x39'),this[_0xdecb('0xb')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x2f')]),_0xdecb('0x3a'),this[_0xdecb('0xb')][_0x5d083d['device']]);}else if(this['trunks'][_0x5d083d[_0xdecb('0x32')]]){if(this[_0xdecb('0x9')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x28')]!==_0x5d083d[_0xdecb('0x28')][_0xdecb('0x34')]()){this[_0xdecb('0x9')][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x35')]=_[_0xdecb('0x36')](moment()[_0xdecb('0x2d')]('x'));}this['trunks'][_0x5d083d[_0xdecb('0x32')]][_0xdecb('0x28')]=_0x5d083d[_0xdecb('0x28')][_0xdecb('0x34')]();logger[_0xdecb('0x31')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xdecb('0x18')](this[_0xdecb('0x9')][_0x5d083d[_0xdecb('0x32')]],{'showHidden':![],'depth':null}));this[_0xdecb('0x22')](util['format'](_0xdecb('0x2e'),this[_0xdecb('0x9')][_0x5d083d['device']][_0xdecb('0x2f')]),_0xdecb('0x30'),this['trunks'][_0x5d083d[_0xdecb('0x32')]]);}else if(_[_0xdecb('0x3b')](_0x5d083d[_0xdecb('0x32')],_0xdecb('0x3c'))){var _0x59cf13=_0x5d083d[_0xdecb('0x32')];var _0x3b062c=_0x59cf13[_0xdecb('0x3d')](_0x59cf13[_0xdecb('0x3e')]('/')+0x1,_0x59cf13['indexOf']('@'));var _0x76b75e=_[_0xdecb('0x27')](this[_0xdecb('0xa')],function(_0xd9f1ff){return _0xd9f1ff[_0xdecb('0x3f')]==_0x3b062c||_0xd9f1ff[_0xdecb('0x40')]==_0x3b062c||_0xd9f1ff[_0xdecb('0x41')]==_0x3b062c;});if(_0x76b75e){if(_0x76b75e['state']!==_0x5d083d['state'][_0xdecb('0x34')]()){_0x76b75e[_0xdecb('0x35')]=_[_0xdecb('0x36')](moment()[_0xdecb('0x2d')]('x'));}_0x76b75e[_0xdecb('0x28')]=_0x5d083d[_0xdecb('0x28')][_0xdecb('0x34')]();_0x76b75e['local']=!![];_0x76b75e['updateStatusRealtime'](_0x5d083d);}}}}catch(_0x51616b){logger[_0xdecb('0x16')](_0xdecb('0x42'),util['inspect'](_0x51616b,{'showHidden':![],'depth':null}));}};UserReport[_0xdecb('0x1f')][_0xdecb('0x13')]=function(_0x3b546a){try{if(this[_0xdecb('0x23')](_0x3b546a)&&this[_0xdecb('0x23')](_0x3b546a['peerstatus'])){logger['info'](_0xdecb('0x43'),_0x3b546a[_0xdecb('0x44')],_0x3b546a[_0xdecb('0x45')],_0x3b546a[_0xdecb('0x12')]);logger[_0xdecb('0x31')](_0xdecb('0x46'),util[_0xdecb('0x18')](_0x3b546a,{'showHidden':![],'depth':null}));if(this['agents'][_0x3b546a[_0xdecb('0x44')]]){if(!this[_0xdecb('0xa')][_0x3b546a[_0xdecb('0x44')]]['local']||_0x3b546a['peerstatus']['toLowerCase']()=='registered'){this['agents'][_0x3b546a['peer']][_0xdecb('0x33')]=![];this[_0xdecb('0xa')][_0x3b546a[_0xdecb('0x44')]][_0xdecb('0x47')]=_0x3b546a[_0xdecb('0x12')]['toLowerCase']();this['agents'][_0x3b546a[_0xdecb('0x44')]][_0xdecb('0x45')]=_0x3b546a[_0xdecb('0x45')];this[_0xdecb('0xa')][_0x3b546a['peer']][_0xdecb('0x37')](_0x3b546a);}}else if(this['telephones'][_0x3b546a[_0xdecb('0x44')]]){this[_0xdecb('0xb')][_0x3b546a[_0xdecb('0x44')]][_0xdecb('0x47')]=_0x3b546a[_0xdecb('0x12')][_0xdecb('0x34')]();this[_0xdecb('0xb')][_0x3b546a['peer']][_0xdecb('0x45')]=_0x3b546a[_0xdecb('0x45')];logger[_0xdecb('0x31')](_0xdecb('0x48'),util[_0xdecb('0x18')](this[_0xdecb('0xb')][_0x3b546a[_0xdecb('0x44')]],{'showHidden':![],'depth':null}));this[_0xdecb('0x22')](util['format']('telephone:%s',this[_0xdecb('0xb')][_0x3b546a[_0xdecb('0x44')]]['name']),_0xdecb('0x3a'),this[_0xdecb('0xb')][_0x3b546a[_0xdecb('0x44')]]);}else if(this['trunks'][_0x3b546a[_0xdecb('0x44')]]){this['trunks'][_0x3b546a[_0xdecb('0x44')]]['status']=_0x3b546a[_0xdecb('0x12')][_0xdecb('0x34')]();this['trunks'][_0x3b546a[_0xdecb('0x44')]]['address']=_0x3b546a['address'];logger[_0xdecb('0x31')](_0xdecb('0x49'),util[_0xdecb('0x18')](this[_0xdecb('0x9')][_0x3b546a[_0xdecb('0x44')]],{'showHidden':![],'depth':null}));this[_0xdecb('0x22')](util[_0xdecb('0x2d')](_0xdecb('0x2e'),this[_0xdecb('0x9')][_0x3b546a['peer']][_0xdecb('0x2f')]),_0xdecb('0x30'),this[_0xdecb('0x9')][_0x3b546a[_0xdecb('0x44')]]);}}}catch(_0x38d60d){logger['error']('[userReport][peerstatus]',util['inspect'](_0x38d60d,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x96de=['emit','info','username','debug','merge','state','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','startsWith','Local','substring','indexOf','phone','accountcode','stateTime','syncPeerStatus','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','ioredis','bluebird','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncRealtimeShow','resolve','then','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','actionSipPeerStatus','prototype','isNotNull','isUndefined'];(function(_0x33f633,_0xbf6ff0){var _0x39d3bc=function(_0xd23b56){while(--_0xd23b56){_0x33f633['push'](_0x33f633['shift']());}};_0x39d3bc(++_0xbf6ff0);}(_0x96de,0x1d1));var _0xe96d=function(_0x49e0f3,_0x206f93){_0x49e0f3=_0x49e0f3-0x0;var _0x2a25f9=_0x96de[_0x49e0f3];return _0x2a25f9;};'use strict';var _=require(_0xe96d('0x0'));var moment=require(_0xe96d('0x1'));var util=require('util');var Redis=require(_0xe96d('0x2'));var BPromise=require(_0xe96d('0x3'));var config=require('../../../config/environment');var logger=require(_0xe96d('0x4'))(_0xe96d('0x5'));var ami=require(_0xe96d('0x6'));config[_0xe96d('0x7')]=_[_0xe96d('0x8')](config[_0xe96d('0x7')],{'host':_0xe96d('0x9'),'port':0x18eb});var io=require(_0xe96d('0xa'))(new Redis(config[_0xe96d('0x7')]));function UserReport(_0x38ed35){this[_0xe96d('0xb')]=_0x38ed35[_0xe96d('0xb')];this['agents']=_0x38ed35[_0xe96d('0xc')];this[_0xe96d('0xd')]=_0x38ed35[_0xe96d('0xd')];ami['on'](_0xe96d('0xe'),this[_0xe96d('0xf')][_0xe96d('0x10')](this));ami['on'](_0xe96d('0x11'),this[_0xe96d('0xf')]['bind'](this));ami['on'](_0xe96d('0x12'),this[_0xe96d('0x13')][_0xe96d('0x10')](this));ami['on']('peerstatus',this['syncPeerStatus'][_0xe96d('0x10')](this));return this[_0xe96d('0x14')]();}function showSipRegistrations(){Promise[_0xe96d('0x15')]()[_0xe96d('0x16')](ami['actionSipShowRegistry']())[_0xe96d('0x17')](function(_0x1dd941){logger[_0xe96d('0x18')](_0xe96d('0x19'),util[_0xe96d('0x1a')](_0x1dd941,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xe96d('0x15')]()[_0xe96d('0x16')](ami[_0xe96d('0x1b')]())['catch'](function(_0xb2715c){logger['error']('[userReport][devicestatelist]',util[_0xe96d('0x1a')](_0xb2715c,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xe96d('0x15')]()[_0xe96d('0x16')](ami[_0xe96d('0x1c')]())[_0xe96d('0x17')](function(_0xd9bef4){logger[_0xe96d('0x18')]('[userReport][sippeerstatus]',util[_0xe96d('0x1a')](_0xd9bef4,{'showHidden':![],'depth':null}));});}UserReport[_0xe96d('0x1d')][_0xe96d('0x14')]=function(){setInterval(function(){BPromise[_0xe96d('0x15')]()[_0xe96d('0x16')](showSipRegistrations())['then'](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0xe96d('0x1d')][_0xe96d('0x1e')]=function(_0x3a0182){return _0x3a0182!==null&&!_[_0xe96d('0x1f')](_0x3a0182);};UserReport[_0xe96d('0x1d')][_0xe96d('0x20')]=function(_0x4539e1,_0x130846,_0x156d93){io['to'](_0x4539e1)['emit'](_0x130846,_0x156d93);};UserReport[_0xe96d('0x1d')]['syncRegistry']=function(_0x5a718d){try{if(this[_0xe96d('0x1e')](_0x5a718d)){logger[_0xe96d('0x21')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x5a718d[_0xe96d('0x22')],_0x5a718d['state']);logger[_0xe96d('0x23')]('[userReport][registry]',util[_0xe96d('0x1a')](_0x5a718d,{'showHidden':![],'depth':null}));var _0x54bc3f=_['find'](this[_0xe96d('0xb')],{'defaultuser':_0x5a718d[_0xe96d('0x22')]});if(_0x54bc3f){_0x5a718d['stateRegistry']=_0x5a718d['state'];_[_0xe96d('0x24')](_0x54bc3f,_['omit'](_0x5a718d,['event','actionid',_0xe96d('0x22'),_0xe96d('0x25')]));logger[_0xe96d('0x23')](_0xe96d('0x26'),util[_0xe96d('0x1a')](_0x54bc3f,{'showHidden':![],'depth':null}));this['emit'](util[_0xe96d('0x27')](_0xe96d('0x28'),_0x54bc3f[_0xe96d('0x29')]),'trunk:save',_0x54bc3f);}}}catch(_0x52363f){logger['error'](_0xe96d('0x2a'),util[_0xe96d('0x1a')](_0x52363f,{'showHidden':![],'depth':null}));}};UserReport[_0xe96d('0x1d')][_0xe96d('0x13')]=function(_0x1a914b){try{if(this[_0xe96d('0x1e')](_0x1a914b)){logger[_0xe96d('0x21')](_0xe96d('0x2b'),_0x1a914b[_0xe96d('0x2c')],_0x1a914b['state']);logger[_0xe96d('0x23')](_0xe96d('0x2d'),util['inspect'](_0x1a914b,{'showHidden':![],'depth':null}));if(this[_0xe96d('0xc')][_0x1a914b[_0xe96d('0x2c')]]){if(!this[_0xe96d('0xc')][_0x1a914b[_0xe96d('0x2c')]][_0xe96d('0x2e')]||_0x1a914b[_0xe96d('0x25')][_0xe96d('0x2f')]()==_0xe96d('0x30')){this[_0xe96d('0xc')][_0x1a914b[_0xe96d('0x2c')]][_0xe96d('0x2e')]=![];if(this['agents'][_0x1a914b[_0xe96d('0x2c')]][_0xe96d('0x25')]!==_0x1a914b[_0xe96d('0x25')][_0xe96d('0x2f')]()){this[_0xe96d('0xc')][_0x1a914b[_0xe96d('0x2c')]]['stateTime']=_[_0xe96d('0x31')](moment()[_0xe96d('0x27')]('x'));}this[_0xe96d('0xc')][_0x1a914b['device']][_0xe96d('0x25')]=_0x1a914b['state'][_0xe96d('0x2f')]();this[_0xe96d('0xc')][_0x1a914b['device']][_0xe96d('0x32')](_0x1a914b);}}else if(this[_0xe96d('0xd')][_0x1a914b[_0xe96d('0x2c')]]){if(this[_0xe96d('0xd')][_0x1a914b[_0xe96d('0x2c')]][_0xe96d('0x25')]!==_0x1a914b['state'][_0xe96d('0x2f')]()){this['telephones'][_0x1a914b[_0xe96d('0x2c')]]['stateTime']=_[_0xe96d('0x31')](moment()[_0xe96d('0x27')]('x'));}this[_0xe96d('0xd')][_0x1a914b['device']][_0xe96d('0x25')]=_0x1a914b[_0xe96d('0x25')][_0xe96d('0x2f')]();logger[_0xe96d('0x23')](_0xe96d('0x33'),util[_0xe96d('0x1a')](this[_0xe96d('0xd')][_0x1a914b[_0xe96d('0x2c')]],{'showHidden':![],'depth':null}));this[_0xe96d('0x20')](util[_0xe96d('0x27')]('telephone:%s',this[_0xe96d('0xd')][_0x1a914b['device']][_0xe96d('0x29')]),_0xe96d('0x34'),this[_0xe96d('0xd')][_0x1a914b[_0xe96d('0x2c')]]);}else if(this[_0xe96d('0xb')][_0x1a914b[_0xe96d('0x2c')]]){if(this[_0xe96d('0xb')][_0x1a914b[_0xe96d('0x2c')]][_0xe96d('0x25')]!==_0x1a914b[_0xe96d('0x25')][_0xe96d('0x2f')]()){this[_0xe96d('0xb')][_0x1a914b[_0xe96d('0x2c')]]['stateTime']=_[_0xe96d('0x31')](moment()[_0xe96d('0x27')]('x'));}this[_0xe96d('0xb')][_0x1a914b[_0xe96d('0x2c')]]['state']=_0x1a914b[_0xe96d('0x25')][_0xe96d('0x2f')]();logger[_0xe96d('0x23')](_0xe96d('0x35'),util[_0xe96d('0x1a')](this[_0xe96d('0xb')][_0x1a914b[_0xe96d('0x2c')]],{'showHidden':![],'depth':null}));this[_0xe96d('0x20')](util[_0xe96d('0x27')](_0xe96d('0x28'),this['trunks'][_0x1a914b[_0xe96d('0x2c')]][_0xe96d('0x29')]),_0xe96d('0x36'),this[_0xe96d('0xb')][_0x1a914b[_0xe96d('0x2c')]]);}else if(_[_0xe96d('0x37')](_0x1a914b['device'],_0xe96d('0x38'))){var _0x4cff84=_0x1a914b['device'];var _0x3cfa97=_0x4cff84[_0xe96d('0x39')](_0x4cff84[_0xe96d('0x3a')]('/')+0x1,_0x4cff84[_0xe96d('0x3a')]('@'));var _0x55969d=_['find'](this[_0xe96d('0xc')],function(_0x429d9a){return _0x429d9a['mobile']==_0x3cfa97||_0x429d9a[_0xe96d('0x3b')]==_0x3cfa97||_0x429d9a[_0xe96d('0x3c')]==_0x3cfa97;});if(_0x55969d){if(_0x55969d[_0xe96d('0x25')]!==_0x1a914b[_0xe96d('0x25')][_0xe96d('0x2f')]()){_0x55969d[_0xe96d('0x3d')]=_[_0xe96d('0x31')](moment()[_0xe96d('0x27')]('x'));}_0x55969d[_0xe96d('0x25')]=_0x1a914b[_0xe96d('0x25')][_0xe96d('0x2f')]();_0x55969d['local']=!![];_0x55969d[_0xe96d('0x32')](_0x1a914b);}}}}catch(_0x8c7f46){logger[_0xe96d('0x18')]('[userReport][devicestatechange]',util['inspect'](_0x8c7f46,{'showHidden':![],'depth':null}));}};UserReport[_0xe96d('0x1d')][_0xe96d('0x3e')]=function(_0x4b4ce8){try{if(this['isNotNull'](_0x4b4ce8)&&this[_0xe96d('0x1e')](_0x4b4ce8[_0xe96d('0x3f')])){logger[_0xe96d('0x21')](_0xe96d('0x40'),_0x4b4ce8[_0xe96d('0x41')],_0x4b4ce8[_0xe96d('0x42')],_0x4b4ce8['peerstatus']);logger['debug'](_0xe96d('0x43'),util[_0xe96d('0x1a')](_0x4b4ce8,{'showHidden':![],'depth':null}));if(this['agents'][_0x4b4ce8[_0xe96d('0x41')]]){if(!this[_0xe96d('0xc')][_0x4b4ce8['peer']][_0xe96d('0x2e')]||_0x4b4ce8['peerstatus']['toLowerCase']()=='registered'){this[_0xe96d('0xc')][_0x4b4ce8[_0xe96d('0x41')]]['local']=![];this[_0xe96d('0xc')][_0x4b4ce8[_0xe96d('0x41')]][_0xe96d('0x44')]=_0x4b4ce8[_0xe96d('0x3f')][_0xe96d('0x2f')]();this[_0xe96d('0xc')][_0x4b4ce8[_0xe96d('0x41')]][_0xe96d('0x42')]=_0x4b4ce8[_0xe96d('0x42')];this[_0xe96d('0xc')][_0x4b4ce8[_0xe96d('0x41')]][_0xe96d('0x32')](_0x4b4ce8);}}else if(this[_0xe96d('0xd')][_0x4b4ce8[_0xe96d('0x41')]]){this[_0xe96d('0xd')][_0x4b4ce8[_0xe96d('0x41')]][_0xe96d('0x44')]=_0x4b4ce8[_0xe96d('0x3f')][_0xe96d('0x2f')]();this[_0xe96d('0xd')][_0x4b4ce8[_0xe96d('0x41')]][_0xe96d('0x42')]=_0x4b4ce8[_0xe96d('0x42')];logger[_0xe96d('0x23')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0xe96d('0x1a')](this[_0xe96d('0xd')][_0x4b4ce8['peer']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xe96d('0x45'),this[_0xe96d('0xd')][_0x4b4ce8[_0xe96d('0x41')]][_0xe96d('0x29')]),_0xe96d('0x34'),this['telephones'][_0x4b4ce8[_0xe96d('0x41')]]);}else if(this[_0xe96d('0xb')][_0x4b4ce8[_0xe96d('0x41')]]){this[_0xe96d('0xb')][_0x4b4ce8[_0xe96d('0x41')]][_0xe96d('0x44')]=_0x4b4ce8[_0xe96d('0x3f')][_0xe96d('0x2f')]();this[_0xe96d('0xb')][_0x4b4ce8[_0xe96d('0x41')]][_0xe96d('0x42')]=_0x4b4ce8[_0xe96d('0x42')];logger[_0xe96d('0x23')](_0xe96d('0x46'),util[_0xe96d('0x1a')](this[_0xe96d('0xb')][_0x4b4ce8[_0xe96d('0x41')]],{'showHidden':![],'depth':null}));this[_0xe96d('0x20')](util[_0xe96d('0x27')](_0xe96d('0x28'),this[_0xe96d('0xb')][_0x4b4ce8[_0xe96d('0x41')]][_0xe96d('0x29')]),'trunk:save',this[_0xe96d('0xb')][_0x4b4ce8[_0xe96d('0x41')]]);}}}catch(_0x5ba36d){logger[_0xe96d('0x18')](_0xe96d('0x43'),util[_0xe96d('0x1a')](_0x5ba36d,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index bb89255..f99895f 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c3e=['syncQueueCallerAbandon','agentcomplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','inbound','voice','merge','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','user:%s','user:called','error','isNotNull','[%s][voiceAgentReport][agentconnect]\x20event:','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','routealias','interface','pick','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswer','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','lastevent','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','hasOwnProperty','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','voiceChannels','voiceQueues','agents','variables','syncAgentCalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3c3e,0x86));var _0xe3c3=function(_0x4fda14,_0x6ab4cb){_0x4fda14=_0x4fda14-0x0;var _0x570673=_0x3c3e[_0x4fda14];return _0x570673;};'use strict';var _=require(_0xe3c3('0x0'));var moment=require(_0xe3c3('0x1'));var util=require(_0xe3c3('0x2'));var Redis=require('ioredis');var config=require(_0xe3c3('0x3'));var logger=require('../../../config/logger')(_0xe3c3('0x4'));var ami=require(_0xe3c3('0x5'));config[_0xe3c3('0x6')]=_[_0xe3c3('0x7')](config[_0xe3c3('0x6')],{'host':_0xe3c3('0x8'),'port':0x18eb});var io=require(_0xe3c3('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x2edc07){this['channels']={};this[_0xe3c3('0xa')]=_0x2edc07['channels'];this['voiceQueues']=_0x2edc07[_0xe3c3('0xb')];this['agents']=_0x2edc07[_0xe3c3('0xc')];this[_0xe3c3('0xd')]={};ami['on']('agentcalled',this[_0xe3c3('0xe')][_0xe3c3('0xf')](this));ami['on'](_0xe3c3('0x10'),this[_0xe3c3('0x11')][_0xe3c3('0xf')](this));ami['on']('agentringnoanswer',this[_0xe3c3('0x12')]['bind'](this));ami['on'](_0xe3c3('0x13'),this[_0xe3c3('0x14')][_0xe3c3('0xf')](this));ami['on'](_0xe3c3('0x15'),this['syncAgentComplete']['bind'](this));ami['on'](_0xe3c3('0x16'),this[_0xe3c3('0x17')][_0xe3c3('0xf')](this));ami['on'](_0xe3c3('0x18'),this[_0xe3c3('0x19')][_0xe3c3('0xf')](this));ami['on'](_0xe3c3('0x1a'),this[_0xe3c3('0x1b')]['bind'](this));ami['on'](_0xe3c3('0x1c'),this[_0xe3c3('0x1d')][_0xe3c3('0xf')](this));ami['on'](_0xe3c3('0x1e'),this[_0xe3c3('0x1f')][_0xe3c3('0xf')](this));ami['on'](_0xe3c3('0x20'),this[_0xe3c3('0x21')][_0xe3c3('0xf')](this));}VoiceAgentReport[_0xe3c3('0x22')]['emit']=function(_0x1d013c,_0x5813b5,_0xab72f8){io['to'](_0x1d013c)[_0xe3c3('0x23')](_0x5813b5,_0xab72f8);};VoiceAgentReport['prototype']['isNotNull']=function(_0x117dcc){return _0x117dcc!==null&&!_[_0xe3c3('0x24')](_0x117dcc);};VoiceAgentReport[_0xe3c3('0x22')]['syncAgentCalled']=function(_0x29fe7f){try{if(this['isNotNull'](_0x29fe7f)){logger['info'](_0xe3c3('0x25'),_0x29fe7f[_0xe3c3('0x26')],_0x29fe7f[_0xe3c3('0x27')],_0x29fe7f[_0xe3c3('0x28')]);logger[_0xe3c3('0x29')](_0xe3c3('0x2a'),_0x29fe7f[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x29fe7f,{'showHidden':![],'depth':null}));if(_[_0xe3c3('0x24')](this[_0xe3c3('0x2c')][_0x29fe7f[_0xe3c3('0x26')]])){this[_0xe3c3('0x2c')][_0x29fe7f[_0xe3c3('0x26')]]={};}if(_[_0xe3c3('0x24')](this[_0xe3c3('0x2c')][_0x29fe7f[_0xe3c3('0x26')]][_0x29fe7f['destuniqueid']])){this[_0xe3c3('0x2c')][_0x29fe7f['uniqueid']][_0x29fe7f[_0xe3c3('0x28')]]={'agentcalledAt':moment()[_0xe3c3('0x2d')](_0xe3c3('0x2e')),'lastevent':_0xe3c3('0x2f'),'mandatoryDisposition':this[_0xe3c3('0xb')][_0x29fe7f[_0xe3c3('0x30')]]?this[_0xe3c3('0xb')][_0x29fe7f['queue']][_0xe3c3('0x31')]||![]:![],'type':this[_0xe3c3('0xb')][_0x29fe7f[_0xe3c3('0x30')]]?this[_0xe3c3('0xb')][_0x29fe7f[_0xe3c3('0x30')]]['type']||_0xe3c3('0x32'):_0xe3c3('0x32'),'variables':this['variables'][_0x29fe7f[_0xe3c3('0x26')]],'motionChannel':_0xe3c3('0x33')};}_[_0xe3c3('0x34')](this['channels'][_0x29fe7f[_0xe3c3('0x26')]][_0x29fe7f[_0xe3c3('0x28')]],_[_0xe3c3('0x35')](_0x29fe7f,['event',_0xe3c3('0x36')]));logger[_0xe3c3('0x29')](_0xe3c3('0x37'),_0x29fe7f[_0xe3c3('0x26')],util['inspect'](this[_0xe3c3('0x2c')][_0x29fe7f[_0xe3c3('0x26')]][_0x29fe7f[_0xe3c3('0x28')]],{'showHidden':![],'depth':null}));ami[_0xe3c3('0x23')]('custom:agentcalled',this[_0xe3c3('0x2c')][_0x29fe7f[_0xe3c3('0x26')]][_0x29fe7f[_0xe3c3('0x28')]]);logger[_0xe3c3('0x29')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x29fe7f[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](this['channels'][_0x29fe7f[_0xe3c3('0x26')]][_0x29fe7f[_0xe3c3('0x28')]],{'showHidden':![],'depth':null}));this[_0xe3c3('0x23')](util['format'](_0xe3c3('0x38'),_0x29fe7f['membername']),_0xe3c3('0x39'),this[_0xe3c3('0x2c')][_0x29fe7f[_0xe3c3('0x26')]][_0x29fe7f['destuniqueid']]);}}catch(_0x19c537){logger[_0xe3c3('0x3a')]('[%s][voiceAgentReport][agentcalled]',_0x29fe7f[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x19c537,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe3c3('0x22')]['syncAgentConnect']=function(_0x22651d){try{if(this[_0xe3c3('0x3b')](_0x22651d)){if(this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]]){logger[_0xe3c3('0x29')](_0xe3c3('0x3c'),_0x22651d['uniqueid'],util['inspect'](_0x22651d,{'showHidden':![],'depth':null}));for(var _0x4997fc in this['channels'][_0x22651d[_0xe3c3('0x26')]]){if(this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]]['hasOwnProperty'](_0x4997fc)){if(_0x22651d[_0xe3c3('0x28')]===_0x4997fc){logger[_0xe3c3('0x3d')](_0xe3c3('0x3e'),_0x22651d[_0xe3c3('0x26')],_0x22651d[_0xe3c3('0x27')],_0x22651d[_0xe3c3('0x28')]);this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x3f')]=moment()[_0xe3c3('0x2d')](_0xe3c3('0x2e'));this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x40')]=_0x22651d[_0xe3c3('0x40')];this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x41')]=_0x22651d[_0xe3c3('0x41')];this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x42')]=_0x22651d[_0xe3c3('0x42')];this[_0xe3c3('0x2c')][_0x22651d['uniqueid']][_0x4997fc][_0xe3c3('0x43')]=_0x22651d['destchannelstatedesc'];this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc]['holdtime']=_0x22651d[_0xe3c3('0x44')];this['channels'][_0x22651d[_0xe3c3('0x26')]][_0x4997fc]['lastevent']=_0xe3c3('0x45');if(this[_0xe3c3('0xa')][this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x26')]]){var _0x1e2fbc=this[_0xe3c3('0xa')][this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x26')]][_0xe3c3('0x46')];this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x46')]=_0x1e2fbc;_0x22651d[_0xe3c3('0x46')]=_0x1e2fbc;}_[_0xe3c3('0x34')](this[_0xe3c3('0xc')][_0x22651d[_0xe3c3('0x47')]],_[_0xe3c3('0x48')](_0x22651d,['queue','destconnectedlinenum',_0xe3c3('0x46')]));logger[_0xe3c3('0x29')](_0xe3c3('0x49'),_0x22651d[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x22651d['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xe3c3('0x23')]('custom:agentconnect',this['channels'][_0x22651d[_0xe3c3('0x26')]][_0x22651d[_0xe3c3('0x28')]]);logger[_0xe3c3('0x29')](_0xe3c3('0x4a'),_0x22651d[_0xe3c3('0x26')],util['inspect'](this['channels'][_0x22651d[_0xe3c3('0x26')]][_0x22651d[_0xe3c3('0x28')]],{'showHidden':![],'depth':null}));this[_0xe3c3('0x23')](util['format'](_0xe3c3('0x38'),_0x22651d[_0xe3c3('0x27')]),_0xe3c3('0x4b'),this[_0xe3c3('0x2c')][_0x22651d['uniqueid']][_0x22651d[_0xe3c3('0x28')]]);}else if(!this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc]['agentringnoanswer']&&!this['channels'][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x15')]){logger['info'](_0xe3c3('0x4c'),_0x22651d['uniqueid'],this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x27')],_0x4997fc);this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc][_0xe3c3('0x4d')]=!![];this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc]['agentringnoanswerAt']=moment()[_0xe3c3('0x2d')](_0xe3c3('0x2e'));this['channels'][_0x22651d[_0xe3c3('0x26')]][_0x4997fc]['answeredelsewheredestinationuniqueid']=_0x22651d[_0xe3c3('0x28')];this['channels'][_0x22651d[_0xe3c3('0x26')]][_0x4997fc]['answeredelsewheremembername']=_0x22651d[_0xe3c3('0x27')];this['channels'][_0x22651d['uniqueid']][_0x4997fc]['lastevent']=_0xe3c3('0x4e');this[_0xe3c3('0x2c')][_0x22651d['uniqueid']][_0x4997fc][_0xe3c3('0x4f')]=_0xe3c3('0x4e');logger[_0xe3c3('0x29')](_0xe3c3('0x50'),_0x22651d[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](this['channels'][_0x22651d['uniqueid']][_0x4997fc],{'showHidden':![],'depth':null}));ami[_0xe3c3('0x23')](_0xe3c3('0x51'),this[_0xe3c3('0x2c')][_0x22651d[_0xe3c3('0x26')]][_0x4997fc]);}}}}}}catch(_0x4d51c4){logger[_0xe3c3('0x3a')](_0xe3c3('0x52'),_0x22651d[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x4d51c4,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe3c3('0x12')]=function(_0x19b793){try{if(this['isNotNull'](_0x19b793)){logger[_0xe3c3('0x29')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x19b793[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x19b793,{'showHidden':![],'depth':null}));if(this['channels'][_0x19b793[_0xe3c3('0x26')]]&&this[_0xe3c3('0x2c')][_0x19b793[_0xe3c3('0x26')]][_0x19b793['destuniqueid']]){logger[_0xe3c3('0x3d')](_0xe3c3('0x53'),_0x19b793[_0xe3c3('0x26')],_0x19b793[_0xe3c3('0x27')],_0x19b793[_0xe3c3('0x28')]);this['channels'][_0x19b793['uniqueid']][_0x19b793[_0xe3c3('0x28')]]['agentringnoanswer']=!![];this['channels'][_0x19b793[_0xe3c3('0x26')]][_0x19b793[_0xe3c3('0x28')]][_0xe3c3('0x54')]=moment()[_0xe3c3('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe3c3('0x2c')][_0x19b793[_0xe3c3('0x26')]][_0x19b793[_0xe3c3('0x28')]][_0xe3c3('0x55')]=_0xe3c3('0x56');this[_0xe3c3('0x2c')][_0x19b793[_0xe3c3('0x26')]][_0x19b793[_0xe3c3('0x28')]]['reason']='rejected';logger[_0xe3c3('0x29')](_0xe3c3('0x57'),_0x19b793[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](this['channels'][_0x19b793[_0xe3c3('0x26')]][_0x19b793[_0xe3c3('0x28')]],{'showHidden':![],'depth':null}));ami['emit'](_0xe3c3('0x58'),this[_0xe3c3('0x2c')][_0x19b793[_0xe3c3('0x26')]][_0x19b793[_0xe3c3('0x28')]]);}}}catch(_0x111495){logger[_0xe3c3('0x3a')]('[%s][voiceAgentReport][agentringnoanswer]',_0x19b793[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x111495,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe3c3('0x22')][_0xe3c3('0x14')]=function(_0x24a228){try{if(this[_0xe3c3('0x3b')](_0x24a228)){logger[_0xe3c3('0x29')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x24a228['uniqueid'],util[_0xe3c3('0x2b')](_0x24a228,{'showHidden':![],'depth':null}));if(this[_0xe3c3('0x2c')][_0x24a228['uniqueid']]){for(var _0x1fb140 in this[_0xe3c3('0x2c')][_0x24a228[_0xe3c3('0x26')]]){if(this[_0xe3c3('0x2c')][_0x24a228['uniqueid']][_0xe3c3('0x59')](_0x1fb140)&&!this['channels'][_0x24a228[_0xe3c3('0x26')]][_0x1fb140][_0xe3c3('0x4d')]&&!this[_0xe3c3('0x2c')][_0x24a228['uniqueid']][_0x1fb140][_0xe3c3('0x15')]){logger[_0xe3c3('0x3d')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x24a228['uniqueid'],this[_0xe3c3('0x2c')][_0x24a228[_0xe3c3('0x26')]][_0x1fb140][_0xe3c3('0x27')],_0x1fb140);this['channels'][_0x24a228['uniqueid']][_0x1fb140][_0xe3c3('0x4d')]=!![];this[_0xe3c3('0x2c')][_0x24a228[_0xe3c3('0x26')]][_0x1fb140]['agentringnoanswerAt']=moment()[_0xe3c3('0x2d')](_0xe3c3('0x2e'));this[_0xe3c3('0x2c')][_0x24a228[_0xe3c3('0x26')]][_0x1fb140][_0xe3c3('0x55')]=_0xe3c3('0x5a');this['channels'][_0x24a228[_0xe3c3('0x26')]][_0x1fb140][_0xe3c3('0x4f')]='abandoned';logger['debug'](_0xe3c3('0x5b'),_0x24a228[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](this[_0xe3c3('0x2c')][_0x24a228[_0xe3c3('0x26')]][_0x1fb140],{'showHidden':![],'depth':null}));ami[_0xe3c3('0x23')](_0xe3c3('0x5c'),this[_0xe3c3('0x2c')][_0x24a228['uniqueid']][_0x1fb140]);}}}}}catch(_0x1b6774){logger[_0xe3c3('0x3a')](_0xe3c3('0x5d'),_0x24a228['uniqueid'],util[_0xe3c3('0x2b')](_0x1b6774,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe3c3('0x5e')]=function(_0x4dd5c6){try{if(this[_0xe3c3('0x3b')](_0x4dd5c6)){logger[_0xe3c3('0x29')](_0xe3c3('0x5f'),_0x4dd5c6[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x4dd5c6,{'showHidden':![],'depth':null}));if(this[_0xe3c3('0x2c')][_0x4dd5c6[_0xe3c3('0x26')]]){for(var _0x2a5822 in this[_0xe3c3('0x2c')][_0x4dd5c6['uniqueid']]){if(this[_0xe3c3('0x2c')][_0x4dd5c6[_0xe3c3('0x26')]]['hasOwnProperty'](_0x2a5822)){if(this['channels'][_0x4dd5c6['uniqueid']][_0x2a5822][_0xe3c3('0x3f')]&&!this['channels'][_0x4dd5c6['uniqueid']][_0x2a5822][_0xe3c3('0x15')]){logger[_0xe3c3('0x3d')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4dd5c6[_0xe3c3('0x26')],this[_0xe3c3('0x2c')][_0x4dd5c6['uniqueid']][_0x2a5822][_0xe3c3('0x27')],_0x2a5822);this[_0xe3c3('0x2c')][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822][_0xe3c3('0x15')]=!![];this[_0xe3c3('0x2c')][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822][_0xe3c3('0x60')]=moment()[_0xe3c3('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe3c3('0x2c')][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822][_0xe3c3('0x55')]=_0xe3c3('0x61');this[_0xe3c3('0x2c')][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822][_0xe3c3('0x4f')]=_0x4dd5c6[_0xe3c3('0x4f')]==_0xe3c3('0x62')?_0xe3c3('0x63'):_0x4dd5c6[_0xe3c3('0x4f')];this['channels'][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822][_0xe3c3('0x64')]=_0x4dd5c6['talktime'];if(this[_0xe3c3('0xb')][_0x4dd5c6['queue']]&&this['voiceQueues'][_0x4dd5c6[_0xe3c3('0x30')]][_0xe3c3('0x65')]){this['channels'][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822][_0xe3c3('0x66')]=this['voiceQueues'][_0x4dd5c6[_0xe3c3('0x30')]][_0xe3c3('0x67')];this['channels'][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822][_0xe3c3('0x68')]=!![];}this[_0xe3c3('0xc')][_0x4dd5c6[_0xe3c3('0x47')]]=_[_0xe3c3('0x35')](this['agents'][_0x4dd5c6[_0xe3c3('0x47')]],[_0xe3c3('0x30'),'destconnectedlinenum']);logger[_0xe3c3('0x29')](_0xe3c3('0x69'),_0x4dd5c6[_0xe3c3('0x26')],util['inspect'](this['channels'][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822],{'showHidden':![],'depth':null}));ami[_0xe3c3('0x23')]('custom:agentcomplete',this[_0xe3c3('0x2c')][_0x4dd5c6['uniqueid']][_0x2a5822]);logger['debug'](_0xe3c3('0x6a'),_0x4dd5c6[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](this[_0xe3c3('0x2c')][_0x4dd5c6['uniqueid']][_0x2a5822],{'showHidden':![],'depth':null}));this[_0xe3c3('0x23')](util[_0xe3c3('0x2d')](_0xe3c3('0x38'),_0x4dd5c6[_0xe3c3('0x27')]),_0xe3c3('0x6b'),this[_0xe3c3('0x2c')][_0x4dd5c6[_0xe3c3('0x26')]][_0x2a5822]);}}}}}}catch(_0x13f327){logger[_0xe3c3('0x3a')]('[%s][voiceAgentReport][agentcomplete]',_0x4dd5c6[_0xe3c3('0x26')],util['inspect'](_0x13f327,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe3c3('0x22')][_0xe3c3('0x17')]=function(_0x18826c){try{if(this[_0xe3c3('0x3b')](_0x18826c)){logger[_0xe3c3('0x29')](_0xe3c3('0x6c'),_0x18826c['uniqueid'],util[_0xe3c3('0x2b')](_0x18826c,{'showHidden':![],'depth':null}));this[_0xe3c3('0x6d')](_0x18826c[_0xe3c3('0x26')],_[_0xe3c3('0x6e')](_0x18826c['variable'])[0x0],_0x18826c[_0xe3c3('0x6f')]);if(this[_0xe3c3('0x2c')][_0x18826c[_0xe3c3('0x26')]]){for(var _0x2c8eee in this[_0xe3c3('0x2c')][_0x18826c[_0xe3c3('0x26')]]){if(this[_0xe3c3('0x2c')][_0x18826c[_0xe3c3('0x26')]][_0xe3c3('0x59')](_0x2c8eee)){logger[_0xe3c3('0x3d')](_0xe3c3('0x70'),_0x18826c['uniqueid'],_0x2c8eee,_['keys'](_0x18826c[_0xe3c3('0x71')])[0x0],_0x18826c[_0xe3c3('0x6f')]);if(_[_0xe3c3('0x24')](this[_0xe3c3('0x2c')][_0x18826c[_0xe3c3('0x26')]][_0x2c8eee][_0xe3c3('0xd')])){this[_0xe3c3('0x2c')][_0x18826c[_0xe3c3('0x26')]][_0x2c8eee]['variables']={};}this['channels'][_0x18826c[_0xe3c3('0x26')]][_0x2c8eee]['variables']=this[_0xe3c3('0xd')][_0x18826c[_0xe3c3('0x26')]];}}}}}catch(_0x3d326c){logger['error']('[%s][voiceAgentReport][varset]',_0x18826c['uniqueid'],util[_0xe3c3('0x2b')](_0x3d326c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe3c3('0x22')][_0xe3c3('0x6d')]=function(_0x40e922,_0xd2dd01,_0x1b468f){var _0xd8c0f7=[_0xe3c3('0x72'),_0xe3c3('0x73'),_0xe3c3('0x74'),'rtpaudioqosjitterbridged',_0xe3c3('0x75'),_0xe3c3('0x76'),_0xe3c3('0x77'),_0xe3c3('0x78'),_0xe3c3('0x79'),_0xe3c3('0x7a'),_0xe3c3('0x7b'),_0xe3c3('0x7c'),_0xe3c3('0x7d'),_0xe3c3('0x7e'),_0xe3c3('0x7f'),'memberlastcall',_0xe3c3('0x27'),_0xe3c3('0x80'),_0xe3c3('0x81')];if(!_['isNil'](_0xd2dd01)&&!_[_0xe3c3('0x82')](_0xd8c0f7,_0xd2dd01)){if(_[_0xe3c3('0x24')](this[_0xe3c3('0xd')][_0x40e922])){this[_0xe3c3('0xd')][_0x40e922]={};}this[_0xe3c3('0xd')][_0x40e922][_0xd2dd01]=_0x1b468f;}};VoiceAgentReport[_0xe3c3('0x22')][_0xe3c3('0x19')]=function(_0x5964db){try{if(this[_0xe3c3('0x3b')](_0x5964db)){logger[_0xe3c3('0x29')](_0xe3c3('0x83'),_0x5964db[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x5964db,{'showHidden':![],'depth':null}));if(this[_0xe3c3('0x2c')][_0x5964db[_0xe3c3('0x26')]]){for(var _0x3f4a3c in this[_0xe3c3('0x2c')][_0x5964db[_0xe3c3('0x26')]]){if(this[_0xe3c3('0x2c')][_0x5964db[_0xe3c3('0x26')]][_0xe3c3('0x59')](_0x3f4a3c)){if(this[_0xe3c3('0x2c')][_0x5964db[_0xe3c3('0x26')]][_0x3f4a3c][_0xe3c3('0x4f')]==_0xe3c3('0x62')&&this['channels'][_0x5964db[_0xe3c3('0x26')]][_0x3f4a3c][_0xe3c3('0x15')]){logger[_0xe3c3('0x3d')](_0xe3c3('0x84'),_0x5964db['uniqueid'],_0x3f4a3c);this[_0xe3c3('0x2c')][_0x5964db[_0xe3c3('0x26')]][_0x3f4a3c][_0xe3c3('0x60')]=moment()['format'](_0xe3c3('0x2e'));}}}logger['debug']('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x5964db[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_[_0xe3c3('0x85')](this['channels'][_0x5964db[_0xe3c3('0x26')]]),{'showHidden':![],'depth':null}));ami['emit'](_0xe3c3('0x86'),_[_0xe3c3('0x85')](this[_0xe3c3('0x2c')][_0x5964db[_0xe3c3('0x26')]]));delete this['channels'][_0x5964db[_0xe3c3('0x26')]];}if(this[_0xe3c3('0xd')][_0x5964db['uniqueid']]){delete this['variables'][_0x5964db[_0xe3c3('0x26')]];}}}catch(_0x35d8b6){logger[_0xe3c3('0x3a')](_0xe3c3('0x87'),_0x5964db[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x35d8b6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe3c3('0x22')][_0xe3c3('0x1f')]=function(_0x1e170f){try{if(this[_0xe3c3('0x3b')](_0x1e170f)){logger[_0xe3c3('0x29')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x1e170f[_0xe3c3('0x26')],util['inspect'](_0x1e170f,{'showHidden':![],'depth':null}));if(this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]]){for(var _0x39936e in this['channels'][_0x1e170f[_0xe3c3('0x88')]]){if(this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]][_0xe3c3('0x59')](_0x39936e)){if(_0x1e170f[_0xe3c3('0x89')]===_0x39936e){logger[_0xe3c3('0x3d')](_0xe3c3('0x8a'),_0x1e170f[_0xe3c3('0x26')],this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]][_0x39936e][_0xe3c3('0x27')],_0x39936e);var _0x361326=moment();this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]][_0x39936e][_0xe3c3('0x15')]=!![];this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]][_0x39936e][_0xe3c3('0x60')]=moment()[_0xe3c3('0x2d')](_0xe3c3('0x2e'));this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]][_0x39936e]['lastevent']=_0xe3c3('0x61');this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]][_0x39936e][_0xe3c3('0x4f')]='transfer';this['channels'][_0x1e170f[_0xe3c3('0x88')]][_0x39936e]['talktime']=_0x361326[_0xe3c3('0x8b')](this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]][_0x39936e][_0xe3c3('0x3f')],'seconds');}}}}if(this[_0xe3c3('0x2c')][_0x1e170f['secondtransfereruniqueid']]){var _0x6bb35=this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x8c')]];this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x8c')]]=this[_0xe3c3('0x2c')][_0x1e170f[_0xe3c3('0x88')]];this[_0xe3c3('0x2c')][_0x1e170f['transfereeuniqueid']]=_0x6bb35;}}}catch(_0x2f1913){logger[_0xe3c3('0x3a')]('[%s][voiceAgentReport][attendedtransfer]',_0x1e170f[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x2f1913,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe3c3('0x21')]=function(_0x3efd1d){try{if(this['isNotNull'](_0x3efd1d)){logger['debug']('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x3efd1d[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x3efd1d,{'showHidden':![],'depth':null}));if(this['channels'][_0x3efd1d[_0xe3c3('0x88')]]){for(var _0x1a87c3 in this[_0xe3c3('0x2c')][_0x3efd1d[_0xe3c3('0x88')]]){if(this[_0xe3c3('0x2c')][_0x3efd1d[_0xe3c3('0x88')]][_0xe3c3('0x59')](_0x1a87c3)){if(_0x3efd1d[_0xe3c3('0x8d')]===_0x1a87c3){logger['info'](_0xe3c3('0x8e'),_0x3efd1d[_0xe3c3('0x26')],this[_0xe3c3('0x2c')][_0x3efd1d[_0xe3c3('0x88')]][_0x1a87c3]['membername'],_0x1a87c3);var _0x185461=moment();this[_0xe3c3('0x2c')][_0x3efd1d[_0xe3c3('0x88')]][_0x1a87c3][_0xe3c3('0x15')]=!![];this['channels'][_0x3efd1d[_0xe3c3('0x88')]][_0x1a87c3]['agentcompleteAt']=_0x185461;this[_0xe3c3('0x2c')][_0x3efd1d[_0xe3c3('0x88')]][_0x1a87c3][_0xe3c3('0x55')]=_0xe3c3('0x61');this[_0xe3c3('0x2c')][_0x3efd1d['transfereeuniqueid']][_0x1a87c3][_0xe3c3('0x4f')]='transfer';this[_0xe3c3('0x2c')][_0x3efd1d[_0xe3c3('0x88')]][_0x1a87c3]['talktime']=_0x185461[_0xe3c3('0x8b')](this[_0xe3c3('0x2c')][_0x3efd1d['transfereeuniqueid']][_0x1a87c3]['agentconnectAt'],_0xe3c3('0x8f'));}}}}}}catch(_0xd567a9){logger['error'](_0xe3c3('0x90'),_0x3efd1d[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0xd567a9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe3c3('0x22')][_0xe3c3('0x1b')]=function(_0x52ec4d){var _0x11e853='';try{if(this[_0xe3c3('0x3b')](_0x52ec4d)){logger[_0xe3c3('0x29')](_0xe3c3('0x91'),_0x52ec4d[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x52ec4d,{'showHidden':![],'depth':null}));if(_0x52ec4d[_0xe3c3('0x92')]){_0x11e853=_0x52ec4d[_0xe3c3('0x92')][_0xe3c3('0x93')](0x0,_0x52ec4d[_0xe3c3('0x92')][_0xe3c3('0x94')]('-'));if(this[_0xe3c3('0xc')][_0x11e853]){logger[_0xe3c3('0x3d')](_0xe3c3('0x95'),_0x52ec4d['uniqueid'],_0x11e853);this[_0xe3c3('0xc')][_0x11e853][_0xe3c3('0x96')]=!![];}}}}catch(_0x27e34c){logger[_0xe3c3('0x3a')](_0xe3c3('0x97'),_0x52ec4d[_0xe3c3('0x26')],util['inspect'](_0x27e34c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe3c3('0x22')]['syncMusicOnHoldStop']=function(_0x28cfff){var _0x56812e='';try{if(this[_0xe3c3('0x3b')](_0x28cfff)){logger[_0xe3c3('0x29')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x28cfff[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x28cfff,{'showHidden':![],'depth':null}));if(_0x28cfff['channel']){_0x56812e=_0x28cfff[_0xe3c3('0x92')]['substring'](0x0,_0x28cfff[_0xe3c3('0x92')][_0xe3c3('0x94')]('-'));if(this[_0xe3c3('0xc')][_0x56812e]){logger[_0xe3c3('0x3d')](_0xe3c3('0x98'),_0x28cfff['uniqueid'],_0x56812e);this['agents'][_0x56812e][_0xe3c3('0x96')]=![];}}}}catch(_0x384917){logger['error'](_0xe3c3('0x99'),_0x28cfff[_0xe3c3('0x26')],util[_0xe3c3('0x2b')](_0x384917,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x2d30=['membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','voice','merge','omit','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','agentconnectAt','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','interface','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answered_elsewhere','reason','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepvtcallid','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','channel','substring','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','moment','util','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid'];(function(_0x30aaf9,_0x226708){var _0x4337a3=function(_0xebd936){while(--_0xebd936){_0x30aaf9['push'](_0x30aaf9['shift']());}};_0x4337a3(++_0x226708);}(_0x2d30,0x72));var _0x02d3=function(_0x28089e,_0x530f8a){_0x28089e=_0x28089e-0x0;var _0x46a73c=_0x2d30[_0x28089e];return _0x46a73c;};'use strict';var _=require('lodash');var moment=require(_0x02d3('0x0'));var util=require(_0x02d3('0x1'));var Redis=require('ioredis');var config=require(_0x02d3('0x2'));var logger=require(_0x02d3('0x3'))(_0x02d3('0x4'));var ami=require('../ami');config[_0x02d3('0x5')]=_[_0x02d3('0x6')](config[_0x02d3('0x5')],{'host':_0x02d3('0x7'),'port':0x18eb});var io=require(_0x02d3('0x8'))(new Redis(config[_0x02d3('0x5')]));function VoiceAgentReport(_0x56ed97){this[_0x02d3('0x9')]={};this[_0x02d3('0xa')]=_0x56ed97[_0x02d3('0x9')];this[_0x02d3('0xb')]=_0x56ed97[_0x02d3('0xb')];this[_0x02d3('0xc')]=_0x56ed97[_0x02d3('0xc')];this[_0x02d3('0xd')]={};ami['on'](_0x02d3('0xe'),this['syncAgentCalled']['bind'](this));ami['on']('agentconnect',this['syncAgentConnect'][_0x02d3('0xf')](this));ami['on'](_0x02d3('0x10'),this[_0x02d3('0x11')][_0x02d3('0xf')](this));ami['on'](_0x02d3('0x12'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x02d3('0x13'),this[_0x02d3('0x14')]['bind'](this));ami['on'](_0x02d3('0x15'),this[_0x02d3('0x16')][_0x02d3('0xf')](this));ami['on'](_0x02d3('0x17'),this[_0x02d3('0x18')][_0x02d3('0xf')](this));ami['on'](_0x02d3('0x19'),this['syncMusicOnHoldStart'][_0x02d3('0xf')](this));ami['on'](_0x02d3('0x1a'),this[_0x02d3('0x1b')][_0x02d3('0xf')](this));ami['on'](_0x02d3('0x1c'),this[_0x02d3('0x1d')][_0x02d3('0xf')](this));ami['on']('blindtransfer',this[_0x02d3('0x1e')][_0x02d3('0xf')](this));}VoiceAgentReport[_0x02d3('0x1f')][_0x02d3('0x20')]=function(_0x8864b7,_0x41f28f,_0x2cb3bb){io['to'](_0x8864b7)[_0x02d3('0x20')](_0x41f28f,_0x2cb3bb);};VoiceAgentReport[_0x02d3('0x1f')][_0x02d3('0x21')]=function(_0x25d145){return _0x25d145!==null&&!_[_0x02d3('0x22')](_0x25d145);};VoiceAgentReport[_0x02d3('0x1f')]['syncAgentCalled']=function(_0x3c1f01){try{if(this[_0x02d3('0x21')](_0x3c1f01)){logger[_0x02d3('0x23')](_0x02d3('0x24'),_0x3c1f01[_0x02d3('0x25')],_0x3c1f01[_0x02d3('0x26')],_0x3c1f01[_0x02d3('0x27')]);logger['debug'](_0x02d3('0x28'),_0x3c1f01[_0x02d3('0x25')],util['inspect'](_0x3c1f01,{'showHidden':![],'depth':null}));if(_[_0x02d3('0x22')](this[_0x02d3('0x9')][_0x3c1f01['uniqueid']])){this[_0x02d3('0x9')][_0x3c1f01[_0x02d3('0x25')]]={};}if(_[_0x02d3('0x22')](this[_0x02d3('0x9')][_0x3c1f01[_0x02d3('0x25')]][_0x3c1f01['destuniqueid']])){this[_0x02d3('0x9')][_0x3c1f01[_0x02d3('0x25')]][_0x3c1f01[_0x02d3('0x27')]]={'agentcalledAt':moment()[_0x02d3('0x29')](_0x02d3('0x2a')),'lastevent':_0x02d3('0x2b'),'mandatoryDisposition':this[_0x02d3('0xb')][_0x3c1f01[_0x02d3('0x2c')]]?this['voiceQueues'][_0x3c1f01[_0x02d3('0x2c')]][_0x02d3('0x2d')]||![]:![],'type':this[_0x02d3('0xb')][_0x3c1f01[_0x02d3('0x2c')]]?this[_0x02d3('0xb')][_0x3c1f01[_0x02d3('0x2c')]][_0x02d3('0x2e')]||_0x02d3('0x2f'):'inbound','variables':this[_0x02d3('0xd')][_0x3c1f01['uniqueid']],'motionChannel':_0x02d3('0x30')};}_[_0x02d3('0x31')](this[_0x02d3('0x9')][_0x3c1f01[_0x02d3('0x25')]][_0x3c1f01['destuniqueid']],_[_0x02d3('0x32')](_0x3c1f01,[_0x02d3('0x33'),_0x02d3('0x34')]));logger[_0x02d3('0x35')](_0x02d3('0x36'),_0x3c1f01[_0x02d3('0x25')],util[_0x02d3('0x37')](this[_0x02d3('0x9')][_0x3c1f01['uniqueid']][_0x3c1f01['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x02d3('0x20')](_0x02d3('0x38'),this[_0x02d3('0x9')][_0x3c1f01[_0x02d3('0x25')]][_0x3c1f01[_0x02d3('0x27')]]);logger[_0x02d3('0x35')](_0x02d3('0x39'),_0x3c1f01[_0x02d3('0x25')],util[_0x02d3('0x37')](this[_0x02d3('0x9')][_0x3c1f01[_0x02d3('0x25')]][_0x3c1f01[_0x02d3('0x27')]],{'showHidden':![],'depth':null}));this[_0x02d3('0x20')](util['format'](_0x02d3('0x3a'),_0x3c1f01[_0x02d3('0x26')]),_0x02d3('0x3b'),this[_0x02d3('0x9')][_0x3c1f01[_0x02d3('0x25')]][_0x3c1f01[_0x02d3('0x27')]]);}}catch(_0x497134){logger['error'](_0x02d3('0x3c'),_0x3c1f01['uniqueid'],util[_0x02d3('0x37')](_0x497134,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x02d3('0x1f')][_0x02d3('0x3d')]=function(_0x4c859d){try{if(this[_0x02d3('0x21')](_0x4c859d)){if(this[_0x02d3('0x9')][_0x4c859d['uniqueid']]){logger[_0x02d3('0x35')](_0x02d3('0x3e'),_0x4c859d[_0x02d3('0x25')],util[_0x02d3('0x37')](_0x4c859d,{'showHidden':![],'depth':null}));for(var _0x3c1b8b in this[_0x02d3('0x9')][_0x4c859d[_0x02d3('0x25')]]){if(this[_0x02d3('0x9')][_0x4c859d[_0x02d3('0x25')]]['hasOwnProperty'](_0x3c1b8b)){if(_0x4c859d[_0x02d3('0x27')]===_0x3c1b8b){logger[_0x02d3('0x23')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4c859d[_0x02d3('0x25')],_0x4c859d[_0x02d3('0x26')],_0x4c859d[_0x02d3('0x27')]);this[_0x02d3('0x9')][_0x4c859d[_0x02d3('0x25')]][_0x3c1b8b][_0x02d3('0x3f')]=moment()['format'](_0x02d3('0x2a'));this[_0x02d3('0x9')][_0x4c859d[_0x02d3('0x25')]][_0x3c1b8b]['connectedlinename']=_0x4c859d['connectedlinename'];this[_0x02d3('0x9')][_0x4c859d[_0x02d3('0x25')]][_0x3c1b8b]['connectedlinenum']=_0x4c859d['connectedlinenum'];this[_0x02d3('0x9')][_0x4c859d[_0x02d3('0x25')]][_0x3c1b8b][_0x02d3('0x40')]=_0x4c859d[_0x02d3('0x40')];this[_0x02d3('0x9')][_0x4c859d['uniqueid']][_0x3c1b8b][_0x02d3('0x41')]=_0x4c859d['destchannelstatedesc'];this[_0x02d3('0x9')][_0x4c859d['uniqueid']][_0x3c1b8b][_0x02d3('0x42')]=_0x4c859d[_0x02d3('0x42')];this[_0x02d3('0x9')][_0x4c859d[_0x02d3('0x25')]][_0x3c1b8b][_0x02d3('0x43')]=_0x02d3('0x44');if(this[_0x02d3('0xa')][this[_0x02d3('0x9')][_0x4c859d[_0x02d3('0x25')]][_0x3c1b8b]['uniqueid']]){var _0x93dc68=this[_0x02d3('0xa')][this[_0x02d3('0x9')][_0x4c859d['uniqueid']][_0x3c1b8b][_0x02d3('0x25')]][_0x02d3('0x45')];this[_0x02d3('0x9')][_0x4c859d[_0x02d3('0x25')]][_0x3c1b8b][_0x02d3('0x45')]=_0x93dc68;_0x4c859d[_0x02d3('0x45')]=_0x93dc68;}_[_0x02d3('0x31')](this[_0x02d3('0xc')][_0x4c859d[_0x02d3('0x46')]],_['pick'](_0x4c859d,['queue',_0x02d3('0x47'),_0x02d3('0x45')]));logger[_0x02d3('0x35')](_0x02d3('0x48'),_0x4c859d['uniqueid'],util[_0x02d3('0x37')](this['channels'][_0x4c859d[_0x02d3('0x25')]][_0x4c859d[_0x02d3('0x27')]],{'showHidden':![],'depth':null}));ami['emit'](_0x02d3('0x49'),this[_0x02d3('0x9')][_0x4c859d[_0x02d3('0x25')]][_0x4c859d[_0x02d3('0x27')]]);logger[_0x02d3('0x35')](_0x02d3('0x4a'),_0x4c859d[_0x02d3('0x25')],util[_0x02d3('0x37')](this[_0x02d3('0x9')][_0x4c859d['uniqueid']][_0x4c859d[_0x02d3('0x27')]],{'showHidden':![],'depth':null}));this[_0x02d3('0x20')](util['format'](_0x02d3('0x3a'),_0x4c859d[_0x02d3('0x26')]),_0x02d3('0x4b'),this[_0x02d3('0x9')][_0x4c859d[_0x02d3('0x25')]][_0x4c859d[_0x02d3('0x27')]]);}else if(!this[_0x02d3('0x9')][_0x4c859d[_0x02d3('0x25')]][_0x3c1b8b]['agentringnoanswer']&&!this[_0x02d3('0x9')][_0x4c859d[_0x02d3('0x25')]][_0x3c1b8b][_0x02d3('0x13')]){logger[_0x02d3('0x23')](_0x02d3('0x4c'),_0x4c859d[_0x02d3('0x25')],this[_0x02d3('0x9')][_0x4c859d[_0x02d3('0x25')]][_0x3c1b8b]['membername'],_0x3c1b8b);this[_0x02d3('0x9')][_0x4c859d['uniqueid']][_0x3c1b8b][_0x02d3('0x10')]=!![];this[_0x02d3('0x9')][_0x4c859d['uniqueid']][_0x3c1b8b][_0x02d3('0x4d')]=moment()[_0x02d3('0x29')](_0x02d3('0x2a'));this[_0x02d3('0x9')][_0x4c859d['uniqueid']][_0x3c1b8b][_0x02d3('0x4e')]=_0x4c859d[_0x02d3('0x27')];this[_0x02d3('0x9')][_0x4c859d['uniqueid']][_0x3c1b8b]['answeredelsewheremembername']=_0x4c859d[_0x02d3('0x26')];this['channels'][_0x4c859d[_0x02d3('0x25')]][_0x3c1b8b][_0x02d3('0x43')]=_0x02d3('0x4f');this['channels'][_0x4c859d['uniqueid']][_0x3c1b8b][_0x02d3('0x50')]=_0x02d3('0x4f');logger[_0x02d3('0x35')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x4c859d[_0x02d3('0x25')],util[_0x02d3('0x37')](this[_0x02d3('0x9')][_0x4c859d[_0x02d3('0x25')]][_0x3c1b8b],{'showHidden':![],'depth':null}));ami[_0x02d3('0x20')]('custom:agentansweredelsewhere',this[_0x02d3('0x9')][_0x4c859d[_0x02d3('0x25')]][_0x3c1b8b]);}}}}}}catch(_0x50f8ee){logger[_0x02d3('0x51')](_0x02d3('0x52'),_0x4c859d[_0x02d3('0x25')],util[_0x02d3('0x37')](_0x50f8ee,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x02d3('0x1f')][_0x02d3('0x11')]=function(_0x2ce917){try{if(this['isNotNull'](_0x2ce917)){logger['debug'](_0x02d3('0x53'),_0x2ce917[_0x02d3('0x25')],util[_0x02d3('0x37')](_0x2ce917,{'showHidden':![],'depth':null}));if(this[_0x02d3('0x9')][_0x2ce917['uniqueid']]&&this['channels'][_0x2ce917[_0x02d3('0x25')]][_0x2ce917[_0x02d3('0x27')]]){logger[_0x02d3('0x23')](_0x02d3('0x54'),_0x2ce917[_0x02d3('0x25')],_0x2ce917[_0x02d3('0x26')],_0x2ce917[_0x02d3('0x27')]);this['channels'][_0x2ce917[_0x02d3('0x25')]][_0x2ce917[_0x02d3('0x27')]]['agentringnoanswer']=!![];this[_0x02d3('0x9')][_0x2ce917[_0x02d3('0x25')]][_0x2ce917[_0x02d3('0x27')]]['agentringnoanswerAt']=moment()[_0x02d3('0x29')](_0x02d3('0x2a'));this[_0x02d3('0x9')][_0x2ce917[_0x02d3('0x25')]][_0x2ce917[_0x02d3('0x27')]][_0x02d3('0x43')]=_0x02d3('0x55');this['channels'][_0x2ce917[_0x02d3('0x25')]][_0x2ce917[_0x02d3('0x27')]][_0x02d3('0x50')]=_0x02d3('0x55');logger[_0x02d3('0x35')](_0x02d3('0x56'),_0x2ce917['uniqueid'],util[_0x02d3('0x37')](this[_0x02d3('0x9')][_0x2ce917[_0x02d3('0x25')]][_0x2ce917[_0x02d3('0x27')]],{'showHidden':![],'depth':null}));ami['emit'](_0x02d3('0x57'),this[_0x02d3('0x9')][_0x2ce917[_0x02d3('0x25')]][_0x2ce917[_0x02d3('0x27')]]);}}}catch(_0x385395){logger[_0x02d3('0x51')](_0x02d3('0x58'),_0x2ce917[_0x02d3('0x25')],util[_0x02d3('0x37')](_0x385395,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x02d3('0x1f')][_0x02d3('0x59')]=function(_0x2bf899){try{if(this['isNotNull'](_0x2bf899)){logger[_0x02d3('0x35')](_0x02d3('0x5a'),_0x2bf899[_0x02d3('0x25')],util[_0x02d3('0x37')](_0x2bf899,{'showHidden':![],'depth':null}));if(this[_0x02d3('0x9')][_0x2bf899['uniqueid']]){for(var _0x5bcc4b in this[_0x02d3('0x9')][_0x2bf899[_0x02d3('0x25')]]){if(this['channels'][_0x2bf899[_0x02d3('0x25')]][_0x02d3('0x5b')](_0x5bcc4b)&&!this[_0x02d3('0x9')][_0x2bf899[_0x02d3('0x25')]][_0x5bcc4b]['agentringnoanswer']&&!this[_0x02d3('0x9')][_0x2bf899[_0x02d3('0x25')]][_0x5bcc4b][_0x02d3('0x13')]){logger['info'](_0x02d3('0x5c'),_0x2bf899[_0x02d3('0x25')],this[_0x02d3('0x9')][_0x2bf899[_0x02d3('0x25')]][_0x5bcc4b][_0x02d3('0x26')],_0x5bcc4b);this[_0x02d3('0x9')][_0x2bf899[_0x02d3('0x25')]][_0x5bcc4b][_0x02d3('0x10')]=!![];this[_0x02d3('0x9')][_0x2bf899['uniqueid']][_0x5bcc4b][_0x02d3('0x4d')]=moment()[_0x02d3('0x29')](_0x02d3('0x2a'));this[_0x02d3('0x9')][_0x2bf899[_0x02d3('0x25')]][_0x5bcc4b][_0x02d3('0x43')]=_0x02d3('0x5d');this[_0x02d3('0x9')][_0x2bf899[_0x02d3('0x25')]][_0x5bcc4b]['reason']='abandoned';logger[_0x02d3('0x35')](_0x02d3('0x5e'),_0x2bf899['uniqueid'],util[_0x02d3('0x37')](this['channels'][_0x2bf899[_0x02d3('0x25')]][_0x5bcc4b],{'showHidden':![],'depth':null}));ami['emit'](_0x02d3('0x5f'),this[_0x02d3('0x9')][_0x2bf899['uniqueid']][_0x5bcc4b]);}}}}}catch(_0x2396f1){logger[_0x02d3('0x51')](_0x02d3('0x60'),_0x2bf899[_0x02d3('0x25')],util[_0x02d3('0x37')](_0x2396f1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x02d3('0x1f')][_0x02d3('0x14')]=function(_0x1b254d){try{if(this[_0x02d3('0x21')](_0x1b254d)){logger[_0x02d3('0x35')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x1b254d[_0x02d3('0x25')],util[_0x02d3('0x37')](_0x1b254d,{'showHidden':![],'depth':null}));if(this[_0x02d3('0x9')][_0x1b254d[_0x02d3('0x25')]]){for(var _0x405316 in this[_0x02d3('0x9')][_0x1b254d[_0x02d3('0x25')]]){if(this[_0x02d3('0x9')][_0x1b254d[_0x02d3('0x25')]][_0x02d3('0x5b')](_0x405316)){if(this[_0x02d3('0x9')][_0x1b254d[_0x02d3('0x25')]][_0x405316][_0x02d3('0x3f')]&&!this[_0x02d3('0x9')][_0x1b254d[_0x02d3('0x25')]][_0x405316]['agentcomplete']){logger[_0x02d3('0x23')](_0x02d3('0x61'),_0x1b254d['uniqueid'],this[_0x02d3('0x9')][_0x1b254d['uniqueid']][_0x405316][_0x02d3('0x26')],_0x405316);this[_0x02d3('0x9')][_0x1b254d[_0x02d3('0x25')]][_0x405316][_0x02d3('0x13')]=!![];this[_0x02d3('0x9')][_0x1b254d[_0x02d3('0x25')]][_0x405316][_0x02d3('0x62')]=moment()[_0x02d3('0x29')](_0x02d3('0x2a'));this['channels'][_0x1b254d[_0x02d3('0x25')]][_0x405316]['lastevent']=_0x02d3('0x63');this['channels'][_0x1b254d[_0x02d3('0x25')]][_0x405316][_0x02d3('0x50')]=_0x1b254d[_0x02d3('0x50')]==_0x02d3('0x64')?_0x02d3('0x65'):_0x1b254d[_0x02d3('0x50')];this[_0x02d3('0x9')][_0x1b254d[_0x02d3('0x25')]][_0x405316][_0x02d3('0x66')]=_0x1b254d['talktime'];if(this[_0x02d3('0xb')][_0x1b254d[_0x02d3('0x2c')]]&&this['voiceQueues'][_0x1b254d[_0x02d3('0x2c')]][_0x02d3('0x67')]){this[_0x02d3('0x9')][_0x1b254d[_0x02d3('0x25')]][_0x405316][_0x02d3('0x68')]=this[_0x02d3('0xb')][_0x1b254d[_0x02d3('0x2c')]][_0x02d3('0x69')];this['channels'][_0x1b254d[_0x02d3('0x25')]][_0x405316][_0x02d3('0x6a')]=!![];}this['agents'][_0x1b254d['interface']]=_[_0x02d3('0x32')](this['agents'][_0x1b254d[_0x02d3('0x46')]],[_0x02d3('0x2c'),_0x02d3('0x47')]);logger['debug'](_0x02d3('0x6b'),_0x1b254d[_0x02d3('0x25')],util[_0x02d3('0x37')](this[_0x02d3('0x9')][_0x1b254d[_0x02d3('0x25')]][_0x405316],{'showHidden':![],'depth':null}));ami[_0x02d3('0x20')](_0x02d3('0x6c'),this['channels'][_0x1b254d[_0x02d3('0x25')]][_0x405316]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x1b254d[_0x02d3('0x25')],util['inspect'](this[_0x02d3('0x9')][_0x1b254d['uniqueid']][_0x405316],{'showHidden':![],'depth':null}));this['emit'](util[_0x02d3('0x29')](_0x02d3('0x3a'),_0x1b254d[_0x02d3('0x26')]),'user:agentcomplete',this[_0x02d3('0x9')][_0x1b254d[_0x02d3('0x25')]][_0x405316]);}}}}}}catch(_0x1a8f57){logger['error']('[%s][voiceAgentReport][agentcomplete]',_0x1b254d['uniqueid'],util[_0x02d3('0x37')](_0x1a8f57,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x02d3('0x1f')][_0x02d3('0x16')]=function(_0xfa43af){try{if(this[_0x02d3('0x21')](_0xfa43af)){logger['debug'](_0x02d3('0x6d'),_0xfa43af['uniqueid'],util['inspect'](_0xfa43af,{'showHidden':![],'depth':null}));this[_0x02d3('0x6e')](_0xfa43af[_0x02d3('0x25')],_[_0x02d3('0x6f')](_0xfa43af['variable'])[0x0],_0xfa43af[_0x02d3('0x70')]);if(this[_0x02d3('0x9')][_0xfa43af[_0x02d3('0x25')]]){for(var _0x1cb739 in this['channels'][_0xfa43af[_0x02d3('0x25')]]){if(this[_0x02d3('0x9')][_0xfa43af['uniqueid']]['hasOwnProperty'](_0x1cb739)){logger[_0x02d3('0x23')](_0x02d3('0x71'),_0xfa43af[_0x02d3('0x25')],_0x1cb739,_['keys'](_0xfa43af[_0x02d3('0x72')])[0x0],_0xfa43af[_0x02d3('0x70')]);if(_['isUndefined'](this['channels'][_0xfa43af[_0x02d3('0x25')]][_0x1cb739][_0x02d3('0xd')])){this['channels'][_0xfa43af[_0x02d3('0x25')]][_0x1cb739][_0x02d3('0xd')]={};}this['channels'][_0xfa43af[_0x02d3('0x25')]][_0x1cb739][_0x02d3('0xd')]=this[_0x02d3('0xd')][_0xfa43af[_0x02d3('0x25')]];}}}}}catch(_0x4adbe9){logger['error'](_0x02d3('0x73'),_0xfa43af['uniqueid'],util[_0x02d3('0x37')](_0x4adbe9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x02d3('0x6e')]=function(_0x4356b7,_0x5d1d36,_0x2e8fc2){var _0x44477e=[_0x02d3('0x74'),_0x02d3('0x75'),_0x02d3('0x76'),_0x02d3('0x77'),'rtpaudioqosloss',_0x02d3('0x78'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x02d3('0x79'),_0x02d3('0x7a'),'bridgepeer',_0x02d3('0x7b'),'membercalls','memberdynamic','memberinterface','memberlastcall',_0x02d3('0x26'),'memberpenalty',_0x02d3('0x7c')];if(!_['isNil'](_0x5d1d36)&&!_[_0x02d3('0x7d')](_0x44477e,_0x5d1d36)){if(_[_0x02d3('0x22')](this[_0x02d3('0xd')][_0x4356b7])){this[_0x02d3('0xd')][_0x4356b7]={};}this[_0x02d3('0xd')][_0x4356b7][_0x5d1d36]=_0x2e8fc2;}};VoiceAgentReport['prototype'][_0x02d3('0x18')]=function(_0xf74368){try{if(this[_0x02d3('0x21')](_0xf74368)){logger[_0x02d3('0x35')](_0x02d3('0x7e'),_0xf74368[_0x02d3('0x25')],util[_0x02d3('0x37')](_0xf74368,{'showHidden':![],'depth':null}));if(this[_0x02d3('0x9')][_0xf74368[_0x02d3('0x25')]]){for(var _0x1e157e in this[_0x02d3('0x9')][_0xf74368['uniqueid']]){if(this[_0x02d3('0x9')][_0xf74368['uniqueid']][_0x02d3('0x5b')](_0x1e157e)){if(this[_0x02d3('0x9')][_0xf74368['uniqueid']][_0x1e157e][_0x02d3('0x50')]==_0x02d3('0x64')&&this[_0x02d3('0x9')][_0xf74368[_0x02d3('0x25')]][_0x1e157e][_0x02d3('0x13')]){logger[_0x02d3('0x23')](_0x02d3('0x7f'),_0xf74368[_0x02d3('0x25')],_0x1e157e);this[_0x02d3('0x9')][_0xf74368[_0x02d3('0x25')]][_0x1e157e][_0x02d3('0x62')]=moment()[_0x02d3('0x29')](_0x02d3('0x2a'));}}}logger[_0x02d3('0x35')](_0x02d3('0x80'),_0xf74368[_0x02d3('0x25')],util['inspect'](_[_0x02d3('0x81')](this[_0x02d3('0x9')][_0xf74368[_0x02d3('0x25')]]),{'showHidden':![],'depth':null}));ami[_0x02d3('0x20')](_0x02d3('0x82'),_[_0x02d3('0x81')](this[_0x02d3('0x9')][_0xf74368[_0x02d3('0x25')]]));delete this[_0x02d3('0x9')][_0xf74368[_0x02d3('0x25')]];}if(this[_0x02d3('0xd')][_0xf74368[_0x02d3('0x25')]]){delete this[_0x02d3('0xd')][_0xf74368['uniqueid']];}}}catch(_0x18de8d){logger['error'](_0x02d3('0x83'),_0xf74368[_0x02d3('0x25')],util[_0x02d3('0x37')](_0x18de8d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x02d3('0x1d')]=function(_0x2a35a5){try{if(this[_0x02d3('0x21')](_0x2a35a5)){logger[_0x02d3('0x35')](_0x02d3('0x84'),_0x2a35a5['uniqueid'],util['inspect'](_0x2a35a5,{'showHidden':![],'depth':null}));if(this['channels'][_0x2a35a5[_0x02d3('0x85')]]){for(var _0x5b13bd in this[_0x02d3('0x9')][_0x2a35a5[_0x02d3('0x85')]]){if(this[_0x02d3('0x9')][_0x2a35a5['transfereeuniqueid']]['hasOwnProperty'](_0x5b13bd)){if(_0x2a35a5[_0x02d3('0x86')]===_0x5b13bd){logger[_0x02d3('0x23')](_0x02d3('0x87'),_0x2a35a5[_0x02d3('0x25')],this[_0x02d3('0x9')][_0x2a35a5[_0x02d3('0x85')]][_0x5b13bd]['membername'],_0x5b13bd);var _0x28f550=moment();this[_0x02d3('0x9')][_0x2a35a5[_0x02d3('0x85')]][_0x5b13bd][_0x02d3('0x13')]=!![];this['channels'][_0x2a35a5[_0x02d3('0x85')]][_0x5b13bd][_0x02d3('0x62')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x02d3('0x9')][_0x2a35a5[_0x02d3('0x85')]][_0x5b13bd][_0x02d3('0x43')]=_0x02d3('0x63');this[_0x02d3('0x9')][_0x2a35a5[_0x02d3('0x85')]][_0x5b13bd][_0x02d3('0x50')]='transfer';this[_0x02d3('0x9')][_0x2a35a5[_0x02d3('0x85')]][_0x5b13bd][_0x02d3('0x66')]=_0x28f550[_0x02d3('0x88')](this['channels'][_0x2a35a5[_0x02d3('0x85')]][_0x5b13bd]['agentconnectAt'],_0x02d3('0x89'));}}}}if(this[_0x02d3('0x9')][_0x2a35a5[_0x02d3('0x8a')]]){var _0x34a981=this[_0x02d3('0x9')][_0x2a35a5[_0x02d3('0x8a')]];this[_0x02d3('0x9')][_0x2a35a5['secondtransfereruniqueid']]=this['channels'][_0x2a35a5[_0x02d3('0x85')]];this[_0x02d3('0x9')][_0x2a35a5[_0x02d3('0x85')]]=_0x34a981;}}}catch(_0x21aa2d){logger['error'](_0x02d3('0x8b'),_0x2a35a5[_0x02d3('0x25')],util['inspect'](_0x21aa2d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncBlindTransfer']=function(_0x463cf2){try{if(this['isNotNull'](_0x463cf2)){logger[_0x02d3('0x35')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x463cf2[_0x02d3('0x25')],util[_0x02d3('0x37')](_0x463cf2,{'showHidden':![],'depth':null}));if(this[_0x02d3('0x9')][_0x463cf2[_0x02d3('0x85')]]){for(var _0x1fcd96 in this['channels'][_0x463cf2[_0x02d3('0x85')]]){if(this['channels'][_0x463cf2[_0x02d3('0x85')]][_0x02d3('0x5b')](_0x1fcd96)){if(_0x463cf2[_0x02d3('0x8c')]===_0x1fcd96){logger[_0x02d3('0x23')](_0x02d3('0x8d'),_0x463cf2['uniqueid'],this['channels'][_0x463cf2[_0x02d3('0x85')]][_0x1fcd96]['membername'],_0x1fcd96);var _0x1e717a=moment();this['channels'][_0x463cf2[_0x02d3('0x85')]][_0x1fcd96][_0x02d3('0x13')]=!![];this[_0x02d3('0x9')][_0x463cf2[_0x02d3('0x85')]][_0x1fcd96]['agentcompleteAt']=_0x1e717a;this[_0x02d3('0x9')][_0x463cf2['transfereeuniqueid']][_0x1fcd96][_0x02d3('0x43')]=_0x02d3('0x63');this[_0x02d3('0x9')][_0x463cf2['transfereeuniqueid']][_0x1fcd96][_0x02d3('0x50')]=_0x02d3('0x64');this['channels'][_0x463cf2[_0x02d3('0x85')]][_0x1fcd96][_0x02d3('0x66')]=_0x1e717a['diff'](this['channels'][_0x463cf2[_0x02d3('0x85')]][_0x1fcd96][_0x02d3('0x3f')],_0x02d3('0x89'));}}}}}}catch(_0x129a2c){logger['error'](_0x02d3('0x8e'),_0x463cf2['uniqueid'],util[_0x02d3('0x37')](_0x129a2c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x02d3('0x1f')][_0x02d3('0x8f')]=function(_0x35143f){var _0x55d3c1='';try{if(this[_0x02d3('0x21')](_0x35143f)){logger['debug']('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x35143f[_0x02d3('0x25')],util['inspect'](_0x35143f,{'showHidden':![],'depth':null}));if(_0x35143f[_0x02d3('0x90')]){_0x55d3c1=_0x35143f[_0x02d3('0x90')][_0x02d3('0x91')](0x0,_0x35143f['channel']['lastIndexOf']('-'));if(this[_0x02d3('0xc')][_0x55d3c1]){logger['info']('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x35143f[_0x02d3('0x25')],_0x55d3c1);this['agents'][_0x55d3c1][_0x02d3('0x92')]=!![];}}}}catch(_0x3ba236){logger['error'](_0x02d3('0x93'),_0x35143f[_0x02d3('0x25')],util['inspect'](_0x3ba236,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x02d3('0x1f')]['syncMusicOnHoldStop']=function(_0x2563f6){var _0x1521dd='';try{if(this[_0x02d3('0x21')](_0x2563f6)){logger[_0x02d3('0x35')](_0x02d3('0x94'),_0x2563f6[_0x02d3('0x25')],util[_0x02d3('0x37')](_0x2563f6,{'showHidden':![],'depth':null}));if(_0x2563f6[_0x02d3('0x90')]){_0x1521dd=_0x2563f6[_0x02d3('0x90')][_0x02d3('0x91')](0x0,_0x2563f6[_0x02d3('0x90')]['lastIndexOf']('-'));if(this[_0x02d3('0xc')][_0x1521dd]){logger[_0x02d3('0x23')](_0x02d3('0x95'),_0x2563f6['uniqueid'],_0x1521dd);this['agents'][_0x1521dd][_0x02d3('0x92')]=![];}}}}catch(_0x1ff3a5){logger[_0x02d3('0x51')](_0x02d3('0x96'),_0x2563f6[_0x02d3('0x25')],util['inspect'](_0x1ff3a5,{'showHidden':![],'depth':null}));}};module[_0x02d3('0x97')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index e926af6..e8fdece 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebe7=['syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','UserId','routealias','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','replace','.wav49','.WAV','monitorFilename','find','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','endtime','billableseconds','omit','user:agentcomplete','resolve','transferType','undefined','isEmpty','getSettings','then','stopRecordingOnTransfer','Action','StopMixMonitor','event','BlindTransfer','type','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','some','outbound','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','moment','util','path','ioredis','../../../config/environment','../../../config/logger','../ami','../model/channel','../rpc/setting','unknown','inuse','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','varset','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','merge','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','isUndefined','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','disposition','toNumber','channelstate','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','emit','[%s][voiceCallReport][newchannel]','linkedid','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','pick','lastdata','cdr(','match','[%s][voiceCallReport][newexten]'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0xebe7,0x66));var _0x7ebe=function(_0x3a31a0,_0x5d7bd){_0x3a31a0=_0x3a31a0-0x0;var _0x590926=_0xebe7[_0x3a31a0];return _0x590926;};'use strict';var BPromise=require(_0x7ebe('0x0'));var _=require('lodash');var moment=require(_0x7ebe('0x1'));var util=require(_0x7ebe('0x2'));var path=require(_0x7ebe('0x3'));var Redis=require(_0x7ebe('0x4'));var config=require(_0x7ebe('0x5'));var logger=require(_0x7ebe('0x6'))('ami');var ami=require(_0x7ebe('0x7'));var Channel=require(_0x7ebe('0x8'));var RpcSetting=require(_0x7ebe('0x9'));var statusDesc=[_0x7ebe('0xa'),'not_inuse',_0x7ebe('0xb'),'busy',_0x7ebe('0xc'),_0x7ebe('0xd'),_0x7ebe('0xe'),_0x7ebe('0xf'),_0x7ebe('0x10')];var applications=[_0x7ebe('0x11'),_0x7ebe('0x12'),_0x7ebe('0x13'),'dial','playback',_0x7ebe('0x14')];var dispositions=[_0x7ebe('0x15'),'FAILED','FAILED',_0x7ebe('0x15'),_0x7ebe('0x15'),_0x7ebe('0x15'),_0x7ebe('0x16'),_0x7ebe('0x17'),_0x7ebe('0x18'),_0x7ebe('0x18'),_0x7ebe('0x18')];var actions={};config[_0x7ebe('0x19')]=_[_0x7ebe('0x1a')](config[_0x7ebe('0x19')],{'host':'localhost','port':0x18eb});var io=require(_0x7ebe('0x1b'))(new Redis(config[_0x7ebe('0x19')]));function VoiceCallReport(_0x12d3ad){this[_0x7ebe('0x1c')]=_0x12d3ad['channels'];this[_0x7ebe('0x1d')]=_0x12d3ad[_0x7ebe('0x1d')];this[_0x7ebe('0x1e')]={};ami['on']('coreshowchannel',this[_0x7ebe('0x1f')][_0x7ebe('0x20')](this));ami['on'](_0x7ebe('0x21'),this[_0x7ebe('0x1f')]['bind'](this));ami['on'](_0x7ebe('0x22'),this[_0x7ebe('0x23')][_0x7ebe('0x20')](this));ami['on'](_0x7ebe('0x24'),this['syncNewState'][_0x7ebe('0x20')](this));ami['on'](_0x7ebe('0x25'),this['syncVarSet'][_0x7ebe('0x20')](this));ami['on'](_0x7ebe('0x26'),this[_0x7ebe('0x27')][_0x7ebe('0x20')](this));ami['on'](_0x7ebe('0x28'),this[_0x7ebe('0x29')][_0x7ebe('0x20')](this));ami['on'](_0x7ebe('0x2a'),this[_0x7ebe('0x2b')]['bind'](this));ami['on'](_0x7ebe('0x2c'),this[_0x7ebe('0x2d')][_0x7ebe('0x20')](this));ami['on'](_0x7ebe('0x2e'),this[_0x7ebe('0x2f')][_0x7ebe('0x20')](this));ami['on']('musiconholdstop',this[_0x7ebe('0x30')][_0x7ebe('0x20')](this));try{logger[_0x7ebe('0x31')](_0x7ebe('0x32'));ami['actionCoreShowChannels']();}catch(_0x549ed8){logger[_0x7ebe('0x33')](_0x7ebe('0x34'),util[_0x7ebe('0x35')](_0x549ed8,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x7ebe('0x36')]['isNotNull']=function(_0xc978ad){return _0xc978ad!==null&&!_['isUndefined'](_0xc978ad);};VoiceCallReport[_0x7ebe('0x36')]['emit']=function(_0x337f89,_0x2f95db,_0x88c9fc){io['to'](_0x337f89)['emit'](_0x2f95db,_0x88c9fc);};VoiceCallReport[_0x7ebe('0x36')][_0x7ebe('0x29')]=function(_0x3f3d15){try{if(this[_0x7ebe('0x37')](_0x3f3d15)){logger[_0x7ebe('0x31')](_0x7ebe('0x38'),_0x3f3d15[_0x7ebe('0x39')],_0x3f3d15[_0x7ebe('0x3a')],_0x3f3d15['calleridnum']);logger[_0x7ebe('0x3b')](_0x7ebe('0x3c'),_0x3f3d15['uniqueid'],util[_0x7ebe('0x35')](_0x3f3d15,{'showHidden':![],'depth':null}));if(_0x3f3d15['uniqueid']===_0x3f3d15['linkedid']){if(!_['isUndefined'](this[_0x7ebe('0x1c')][_0x3f3d15[_0x7ebe('0x39')]])){_[_0x7ebe('0x3d')](this[_0x7ebe('0x1c')][_0x3f3d15[_0x7ebe('0x39')]],_['pick'](_0x3f3d15,_[_0x7ebe('0x3e')](this[_0x7ebe('0x1c')][_0x3f3d15['uniqueid']])));}}if(_0x3f3d15[_0x7ebe('0x3f')]===_0x7ebe('0x40')){if(this[_0x7ebe('0x1d')][_0x3f3d15[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]]){if(_0x3f3d15[_0x7ebe('0x43')]==_0x7ebe('0x44')){this['agents'][_0x3f3d15[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x45')]=_0x3f3d15[_0x7ebe('0x46')];this['emit'](util[_0x7ebe('0x47')](_0x7ebe('0x48'),this['agents'][_0x3f3d15[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x49')]),_0x7ebe('0x4a'),{'destaccountcode':this['agents'][_0x3f3d15[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x3f3d15[_0x7ebe('0x46')]});}}}}}catch(_0x38057){logger['error'](_0x7ebe('0x4b'),_0x3f3d15[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x38057,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')]['syncNewChannel']=function(_0x43a549){try{if(this[_0x7ebe('0x37')](_0x43a549)){logger[_0x7ebe('0x3b')](_0x7ebe('0x4c'),_0x43a549['uniqueid'],util[_0x7ebe('0x35')](_0x43a549,{'showHidden':![],'depth':null}));if(_0x43a549[_0x7ebe('0x39')]===_0x43a549['linkedid']&&_0x43a549[_0x7ebe('0x41')]!=_0x7ebe('0x4d')){if(_[_0x7ebe('0x4e')](this[_0x7ebe('0x1c')][_0x43a549[_0x7ebe('0x39')]])){logger[_0x7ebe('0x31')](_0x7ebe('0x4f'),_0x43a549[_0x7ebe('0x39')],_0x43a549[_0x7ebe('0x3f')],_0x43a549[_0x7ebe('0x43')]);this[_0x7ebe('0x1c')][_0x43a549[_0x7ebe('0x39')]]=new Channel();this[_0x7ebe('0x1c')][_0x43a549['uniqueid']]['starttime']=moment()[_0x7ebe('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7ebe('0x1c')][_0x43a549[_0x7ebe('0x39')]][_0x7ebe('0x50')]=dispositions[_[_0x7ebe('0x51')](_0x43a549[_0x7ebe('0x52')])];_[_0x7ebe('0x3d')](this[_0x7ebe('0x1c')][_0x43a549[_0x7ebe('0x39')]],_['pick'](_0x43a549,_[_0x7ebe('0x3e')](this['channels'][_0x43a549[_0x7ebe('0x39')]])));if(_0x43a549[_0x7ebe('0x3f')]===_0x7ebe('0x40')){if(this[_0x7ebe('0x1d')][_0x43a549[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]]){if(_[_0x7ebe('0x4e')](this[_0x7ebe('0x1d')][_0x43a549[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x45')])){this[_0x7ebe('0x1d')][_0x43a549[_0x7ebe('0x41')]['split']('-')[0x0]][_0x7ebe('0x45')]=_0x43a549[_0x7ebe('0x43')];logger['debug'](_0x7ebe('0x53'),_0x43a549[_0x7ebe('0x39')],util[_0x7ebe('0x35')]({'destaccountcode':this[_0x7ebe('0x1d')][_0x43a549[_0x7ebe('0x41')]['split']('-')[0x0]][_0x7ebe('0x54')],'destconnectedlinenum':_0x43a549[_0x7ebe('0x43')]},{'showHidden':![],'depth':null}));this[_0x7ebe('0x55')](util[_0x7ebe('0x47')]('user:%s',this[_0x7ebe('0x1d')][_0x43a549['channel']['split']('-')[0x0]][_0x7ebe('0x49')]),_0x7ebe('0x4a'),{'destaccountcode':this['agents'][_0x43a549[_0x7ebe('0x41')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x43a549['exten']});}}}}}}}catch(_0x14ef22){logger['error'](_0x7ebe('0x56'),_0x43a549[_0x7ebe('0x39')],util['inspect'](_0x14ef22,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')][_0x7ebe('0x1f')]=function(_0xa0f085){try{if(this[_0x7ebe('0x37')](_0xa0f085)){logger[_0x7ebe('0x3b')]('[%s][voiceCallReport][newexten]\x20event:',_0xa0f085['uniqueid'],util[_0x7ebe('0x35')](_0xa0f085,{'showHidden':![],'depth':null}));if(_0xa0f085[_0x7ebe('0x39')]===_0xa0f085[_0x7ebe('0x57')]&&_0xa0f085[_0x7ebe('0x43')]!='h'&&_0xa0f085[_0x7ebe('0x41')]!=_0x7ebe('0x4d')){_0xa0f085[_0x7ebe('0x58')]=_0xa0f085[_0x7ebe('0x58')][_0x7ebe('0x59')]();_0xa0f085[_0x7ebe('0x5a')]=_0xa0f085['appdata']&&_0xa0f085[_0x7ebe('0x5b')][_0x7ebe('0x5c')](_0x7ebe('0x5d'))?_0xa0f085[_0x7ebe('0x5b')]:(_0xa0f085[_0x7ebe('0x5b')]||_0xa0f085[_0x7ebe('0x5a')])[_0x7ebe('0x59')]();logger['info'](_0x7ebe('0x5e'),_0xa0f085['uniqueid'],_0xa0f085[_0x7ebe('0x58')],_0xa0f085['applicationdata']);if(_[_0x7ebe('0x4e')](this['channels'][_0xa0f085[_0x7ebe('0x39')]])){this[_0x7ebe('0x1c')][_0xa0f085[_0x7ebe('0x39')]]=new Channel();this[_0x7ebe('0x1c')][_0xa0f085['uniqueid']][_0x7ebe('0x5f')]=_0xa0f085['duration']?moment()['subtract'](moment[_0x7ebe('0x60')](_0xa0f085[_0x7ebe('0x60')])[_0x7ebe('0x61')](),_0x7ebe('0x61'))[_0x7ebe('0x47')](_0x7ebe('0x62')):moment()[_0x7ebe('0x47')](_0x7ebe('0x62'));this[_0x7ebe('0x1c')][_0xa0f085[_0x7ebe('0x39')]][_0x7ebe('0x50')]=_0x7ebe('0x15');}_[_0x7ebe('0x3d')](this[_0x7ebe('0x1c')][_0xa0f085['uniqueid']],_[_0x7ebe('0x63')](_0xa0f085,_[_0x7ebe('0x3e')](this['channels'][_0xa0f085[_0x7ebe('0x39')]])));if(_['includes'](applications,_0xa0f085[_0x7ebe('0x58')])){this[_0x7ebe('0x1c')][_0xa0f085[_0x7ebe('0x39')]]['lastapplication']=_0xa0f085[_0x7ebe('0x58')];this[_0x7ebe('0x1c')][_0xa0f085[_0x7ebe('0x39')]][_0x7ebe('0x64')]=_0xa0f085[_0x7ebe('0x5a')];if(_0xa0f085[_0x7ebe('0x58')]==='set'&&_[_0x7ebe('0x5c')](_0xa0f085['applicationdata'][_0x7ebe('0x59')](),_0x7ebe('0x65'))){var _0x59d9ec=_0xa0f085['applicationdata'][_0x7ebe('0x42')]('=');var _0x11768e=_0x59d9ec[0x0]['toLowerCase']()[_0x7ebe('0x66')](/cdr\((.*)\)/);if(_0x11768e){this[_0x7ebe('0x1c')][_0xa0f085[_0x7ebe('0x39')]][_0x11768e[0x1]]=_0x59d9ec[0x1];}}else if(_0xa0f085[_0x7ebe('0x58')]===_0x7ebe('0x12')){this[_0x7ebe('0x1c')][_0xa0f085[_0x7ebe('0x39')]][_0x7ebe('0x12')]=_0xa0f085[_0x7ebe('0x5a')][_0x7ebe('0x42')](',')[0x0];}}}}}catch(_0x25bb7f){logger[_0x7ebe('0x33')](_0x7ebe('0x67'),_0xa0f085[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x25bb7f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x7ebe('0x68')]=function(_0x402838){try{if(this[_0x7ebe('0x37')](_0x402838)){logger[_0x7ebe('0x31')](_0x7ebe('0x69'),_0x402838[_0x7ebe('0x39')],_0x402838[_0x7ebe('0x57')],_0x402838[_0x7ebe('0x3a')],_0x402838[_0x7ebe('0x6a')]);logger[_0x7ebe('0x3b')](_0x7ebe('0x6b'),_0x402838[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x402838,{'showHidden':![],'depth':null}));if(_0x402838[_0x7ebe('0x39')]!==_0x402838[_0x7ebe('0x57')]){if(this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]]){if(_0x402838[_0x7ebe('0x52')]==='6'){if(!this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]][_0x7ebe('0x6c')]){var _0x162e2e=moment();this['channels'][_0x402838[_0x7ebe('0x57')]]['answered']=!![];this['channels'][_0x402838['linkedid']][_0x7ebe('0x6d')]=_0x162e2e[_0x7ebe('0x47')](_0x7ebe('0x62'));if(this[_0x7ebe('0x1c')][_0x402838['linkedid']][_0x7ebe('0x5f')]){this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]][_0x7ebe('0x6e')]=_0x162e2e[_0x7ebe('0x6f')](this[_0x7ebe('0x1c')][_0x402838['linkedid']][_0x7ebe('0x5f')],_0x7ebe('0x61'));}}this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]]['linkedid']=_0x402838[_0x7ebe('0x39')];if(_0x402838[_0x7ebe('0x6a')]!==_0x7ebe('0x44')){this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]][_0x7ebe('0x46')]=_0x402838[_0x7ebe('0x6a')];}this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]][_0x7ebe('0x70')]=_0x402838[_0x7ebe('0x3a')];this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]][_0x7ebe('0x71')]=_0x402838[_0x7ebe('0x41')];this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]][_0x7ebe('0x50')]=dispositions[_['toNumber'](_0x402838[_0x7ebe('0x52')])];if(this['agents'][_0x402838[_0x7ebe('0x41')]['split']('-')[0x0]]){this[_0x7ebe('0x1c')][_0x402838['linkedid']][_0x7ebe('0x72')]=this['agents'][_0x402838[_0x7ebe('0x41')]['split']('-')[0x0]]['id'];this[_0x7ebe('0x1c')][_0x402838['linkedid']]['membername']=this[_0x7ebe('0x1d')][_0x402838['channel']['split']('-')[0x0]][_0x7ebe('0x49')];}}}}else{if(this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x39')]]){if(_0x402838[_0x7ebe('0x52')]==='6'){if(this[_0x7ebe('0x1d')][_0x402838['channel'][_0x7ebe('0x42')]('-')[0x0]]){this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x39')]][_0x7ebe('0x72')]=this['agents'][_0x402838[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]]['id'];this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x39')]]['membername']=this[_0x7ebe('0x1d')][_0x402838[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x49')];}}}}if(_0x402838[_0x7ebe('0x52')]==='6'&&_0x402838[_0x7ebe('0x3f')]===_0x7ebe('0x40')){if(this[_0x7ebe('0x1d')][_0x402838[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]]){this[_0x7ebe('0x1d')][_0x402838[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x45')]=_0x402838[_0x7ebe('0x43')];var _0x4df87d;if(this['channels'][_0x402838[_0x7ebe('0x39')]])_0x4df87d=this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x39')]][_0x7ebe('0x73')];else if(this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]])_0x4df87d=this[_0x7ebe('0x1c')][_0x402838[_0x7ebe('0x57')]][_0x7ebe('0x73')];logger[_0x7ebe('0x3b')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x402838[_0x7ebe('0x39')],util[_0x7ebe('0x35')]({'destaccountcode':this[_0x7ebe('0x1d')][_0x402838[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x54')],'destconnectedlinenum':_0x402838[_0x7ebe('0x43')],'routealias':_0x4df87d},{'showHidden':![],'depth':null}));this[_0x7ebe('0x55')](util[_0x7ebe('0x47')](_0x7ebe('0x48'),this[_0x7ebe('0x1d')][_0x402838[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x49')]),_0x7ebe('0x4a'),{'destaccountcode':this[_0x7ebe('0x1d')][_0x402838['channel']['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x402838[_0x7ebe('0x43')],'routealias':_0x4df87d});}}}}catch(_0x4aa062){logger[_0x7ebe('0x33')]('[%s][voiceCallReport][newstate]',_0x402838[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x4aa062,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')][_0x7ebe('0x74')]=function(_0x40c50c,_0x1b3361){try{if(this[_0x7ebe('0x1c')][_0x40c50c]){logger[_0x7ebe('0x31')](_0x7ebe('0x75'),_0x40c50c,_0x1b3361);this['channels'][_0x40c50c]['monitor']=!![];if(_['endsWith'](_0x1b3361,'.wav49')){_0x1b3361=_0x1b3361[_0x7ebe('0x76')](_0x7ebe('0x77'),_0x7ebe('0x78'));}this[_0x7ebe('0x1c')][_0x40c50c][_0x7ebe('0x79')]=_0x1b3361;var _0x357b3b=_[_0x7ebe('0x7a')](this[_0x7ebe('0x1c')][_0x40c50c][_0x7ebe('0x7b')],{'filename':_0x1b3361});if(_[_0x7ebe('0x7c')](_0x357b3b)){this[_0x7ebe('0x1c')][_0x40c50c]['monitors'][_0x7ebe('0x7d')]({'filename':_0x1b3361,'createdAt':moment()[_0x7ebe('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x7ebe('0x7e')});}}}catch(_0xb301bb){logger['error'](_0x7ebe('0x7f'),_0x40c50c,util['inspect'](_0xb301bb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')][_0x7ebe('0x80')]=function(_0x5b658c){try{if(this[_0x7ebe('0x37')](_0x5b658c)){logger[_0x7ebe('0x3b')]('[%s][voiceCallReport][varset]\x20event:',_0x5b658c[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x5b658c,{'showHidden':![],'depth':null}));if(this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x39')]]&&_0x5b658c['channel']!=_0x7ebe('0x4d')){if(this['isNotNull'](_0x5b658c[_0x7ebe('0x81')])){if(this[_0x7ebe('0x37')](_0x5b658c[_0x7ebe('0x81')]['mixmonitor_filename'])){logger[_0x7ebe('0x31')](_0x7ebe('0x82'),_0x5b658c[_0x7ebe('0x39')],_0x5b658c['value']);this[_0x7ebe('0x74')](_0x5b658c[_0x7ebe('0x39')],_0x5b658c[_0x7ebe('0x83')]);}else if(this[_0x7ebe('0x37')](_0x5b658c[_0x7ebe('0x81')]['xmd-phone'])){logger['info'](_0x7ebe('0x84'),_0x5b658c[_0x7ebe('0x39')],_0x5b658c['value']);this[_0x7ebe('0x1c')][_0x5b658c['uniqueid']][_0x7ebe('0x6a')]=_0x5b658c[_0x7ebe('0x83')];}else if(this['isNotNull'](_0x5b658c[_0x7ebe('0x81')][_0x7ebe('0x85')])){logger[_0x7ebe('0x31')](_0x7ebe('0x86'),_0x5b658c[_0x7ebe('0x39')],_0x5b658c[_0x7ebe('0x83')]);this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x39')]][_0x7ebe('0x87')]=_0x5b658c[_0x7ebe('0x83')];}else if(this[_0x7ebe('0x37')](_0x5b658c['variable']['xmd-cdrtype'])){logger[_0x7ebe('0x31')](_0x7ebe('0x88'),_0x5b658c[_0x7ebe('0x39')],_0x5b658c['value']);this[_0x7ebe('0x1c')][_0x5b658c['uniqueid']]['type']=_0x5b658c['value'];}else if(this[_0x7ebe('0x37')](_0x5b658c[_0x7ebe('0x81')]['xmd-queue'])){logger[_0x7ebe('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x5b658c[_0x7ebe('0x39')],_0x5b658c[_0x7ebe('0x83')][_0x7ebe('0x42')](',')[0x0]);this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x39')]]['queue']=_0x5b658c[_0x7ebe('0x83')][_0x7ebe('0x42')](',')[0x0];}else if(this[_0x7ebe('0x37')](_0x5b658c[_0x7ebe('0x81')][_0x7ebe('0x89')])){logger[_0x7ebe('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5b658c[_0x7ebe('0x39')],_0x5b658c[_0x7ebe('0x83')]);this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x39')]][_0x7ebe('0x8a')]=_0x5b658c[_0x7ebe('0x83')];}else if(this['isNotNull'](_0x5b658c[_0x7ebe('0x81')][_0x7ebe('0x8b')])){logger[_0x7ebe('0x31')](_0x7ebe('0x8c'),_0x5b658c[_0x7ebe('0x39')],_0x5b658c['value']);this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x39')]][_0x7ebe('0x8d')]=_0x5b658c[_0x7ebe('0x83')];}else if(this['isNotNull'](_0x5b658c[_0x7ebe('0x81')][_0x7ebe('0x8e')])){logger[_0x7ebe('0x31')](_0x7ebe('0x8f'),_0x5b658c[_0x7ebe('0x39')],_0x5b658c[_0x7ebe('0x83')]);this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x39')]][_0x7ebe('0x90')]=_0x5b658c['value'];}else if(this[_0x7ebe('0x37')](_0x5b658c['variable'][_0x7ebe('0x91')])){logger[_0x7ebe('0x31')](_0x7ebe('0x92'),_0x5b658c[_0x7ebe('0x39')],_0x5b658c[_0x7ebe('0x83')]);this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x39')]][_0x7ebe('0x12')]=_0x5b658c[_0x7ebe('0x83')];}else if(this[_0x7ebe('0x37')](_0x5b658c[_0x7ebe('0x81')][_0x7ebe('0x93')])){logger['info'](_0x7ebe('0x94'),_0x5b658c['uniqueid'],_0x5b658c[_0x7ebe('0x83')]);this['channels'][_0x5b658c['uniqueid']][_0x7ebe('0x95')]=_0x5b658c[_0x7ebe('0x83')];}}}else if(this['isNotNull'](_0x5b658c[_0x7ebe('0x81')][_0x7ebe('0x96')])){if(_0x5b658c[_0x7ebe('0x83')]){var _0x4430c0=path[_0x7ebe('0x97')](_0x5b658c[_0x7ebe('0x83')])[_0x7ebe('0x49')];logger[_0x7ebe('0x31')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x4430c0,_0x5b658c[_0x7ebe('0x83')]);this[_0x7ebe('0x74')](_0x4430c0,_0x5b658c[_0x7ebe('0x83')]);}}else if(this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x57')]]){if(this[_0x7ebe('0x37')](_0x5b658c[_0x7ebe('0x81')])){if(this[_0x7ebe('0x37')](_0x5b658c[_0x7ebe('0x81')][_0x7ebe('0x93')])){logger[_0x7ebe('0x31')](_0x7ebe('0x94'),_0x5b658c[_0x7ebe('0x57')],_0x5b658c[_0x7ebe('0x83')]);this[_0x7ebe('0x1c')][_0x5b658c[_0x7ebe('0x57')]][_0x7ebe('0x98')]=_0x5b658c[_0x7ebe('0x83')];}}}}}catch(_0x13bef9){logger['error'](_0x7ebe('0x99'),_0x5b658c[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x13bef9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')]['syncHangup']=function(_0x3f95cf){try{if(this[_0x7ebe('0x37')](_0x3f95cf)){logger[_0x7ebe('0x3b')](_0x7ebe('0x9a'),_0x3f95cf[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x3f95cf,{'showHidden':![],'depth':null}));if(this[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']]){logger['info']('[%s][voiceCallReport][hangup]\x20reason:%s',_0x3f95cf[_0x7ebe('0x39')],_0x3f95cf['cause-txt']);var _0x22910a=moment();this[_0x7ebe('0x1c')][_0x3f95cf[_0x7ebe('0x39')]][_0x7ebe('0x9b')]=_0x22910a['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']][_0x7ebe('0x60')]=_0x22910a[_0x7ebe('0x6f')](this[_0x7ebe('0x1c')][_0x3f95cf[_0x7ebe('0x39')]][_0x7ebe('0x5f')],_0x7ebe('0x61'));if(this[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']][_0x7ebe('0x6c')]){this[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']][_0x7ebe('0x9c')]=_0x22910a[_0x7ebe('0x6f')](this[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']]['answertime'],_0x7ebe('0x61'));this[_0x7ebe('0x1c')][_0x3f95cf[_0x7ebe('0x39')]][_0x7ebe('0x6e')]=this[_0x7ebe('0x1c')][_0x3f95cf[_0x7ebe('0x39')]][_0x7ebe('0x60')]-this[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']][_0x7ebe('0x9c')];}if(_0x3f95cf['context']===_0x7ebe('0x40')){if(this['agents'][_0x3f95cf[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]]){this[_0x7ebe('0x1d')][_0x3f95cf[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]]=_[_0x7ebe('0x9d')](this[_0x7ebe('0x1d')][_0x3f95cf[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]],['destconnectedlinenum']);logger[_0x7ebe('0x3b')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x3f95cf[_0x7ebe('0x39')],util[_0x7ebe('0x35')]({'id':this['agents'][_0x3f95cf[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x3f95cf[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x54')]},{'showHidden':![],'depth':null}));this[_0x7ebe('0x55')](util['format'](_0x7ebe('0x48'),this[_0x7ebe('0x1d')][_0x3f95cf[_0x7ebe('0x41')]['split']('-')[0x0]]['name']),_0x7ebe('0x9e'),{'id':this['agents'][_0x3f95cf['channel'][_0x7ebe('0x42')]('-')[0x0]]['id'],'destaccountcode':this[_0x7ebe('0x1d')][_0x3f95cf[_0x7ebe('0x41')][_0x7ebe('0x42')]('-')[0x0]][_0x7ebe('0x54')]});}}var _0x3335b5=this;Promise[_0x7ebe('0x9f')]()['then'](function(){var _0x50693c=_0x3335b5[_0x7ebe('0x1c')][_0x3f95cf[_0x7ebe('0x39')]];if(typeof _0x50693c[_0x7ebe('0xa0')]===_0x7ebe('0xa1'))return;if(_[_0x7ebe('0xa2')](_0x50693c['monitors']))return;return RpcSetting[_0x7ebe('0xa3')]()[_0x7ebe('0xa4')](function(_0x582a37){if(!_0x582a37[_0x7ebe('0xa5')])return;return Promise[_0x7ebe('0x9f')]()[_0x7ebe('0xa4')](function(){return ami[_0x7ebe('0xa6')]({'action':'StopMixMonitor','channel':_0x50693c[_0x7ebe('0x41')]})['catch'](function(){});})[_0x7ebe('0xa4')](function(){return ami['Action']({'action':_0x7ebe('0xa7'),'channel':_0x50693c[_0x7ebe('0x71')]})['catch'](function(){})['finally'](function(){var _0x200fbe=_0x3335b5['agents'][_0x50693c[_0x7ebe('0x71')][_0x7ebe('0x42')]('-')[0x0]];if(!_0x200fbe)return;io[_0x7ebe('0x55')]('webbar:stopmonitors',{'agentId':_0x200fbe['id'],'uniqueid':_0x50693c[_0x7ebe('0x39')]});});});});})[_0x7ebe('0xa4')](function(){if(_0x3f95cf[_0x7ebe('0xa8')]===_0x7ebe('0xa9')){_0x3335b5['blindTransfers'][_0x3f95cf[_0x7ebe('0x39')]]=_0x3335b5['channels'][_0x3f95cf['uniqueid']];}else{if(_0x3335b5[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']][_0x7ebe('0xaa')]==='outbound'&&_0x3335b5[_0x7ebe('0x1e')][_0x3f95cf['uniqueid']]){_0x3335b5[_0x7ebe('0x1c')][_0x3f95cf[_0x7ebe('0x39')]]['uniqueid']=[_0x3335b5['channels'][_0x3f95cf[_0x7ebe('0x39')]][_0x7ebe('0x57')],_0x3335b5[_0x7ebe('0x1c')][_0x3f95cf[_0x7ebe('0x39')]][_0x7ebe('0x57')]=_0x3335b5[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']][_0x7ebe('0x39')]][0x0];delete _0x3335b5[_0x7ebe('0x1e')][_0x3f95cf[_0x7ebe('0x39')]];}}logger[_0x7ebe('0x3b')](_0x7ebe('0xab'),_0x3f95cf[_0x7ebe('0x39')],util['inspect'](_0x3335b5['channels'][_0x3f95cf[_0x7ebe('0x39')]],{'showHidden':![],'depth':null}));ami[_0x7ebe('0x55')](_0x7ebe('0xac'),_0x3335b5[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']]);delete _0x3335b5[_0x7ebe('0x1c')][_0x3f95cf['uniqueid']];});}}}catch(_0x3b9b8f){logger[_0x7ebe('0x33')](_0x7ebe('0xad'),_0x3f95cf[_0x7ebe('0x39')],util['inspect'](_0x3b9b8f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')][_0x7ebe('0x2b')]=function(_0x37c929){try{if(this[_0x7ebe('0x37')](_0x37c929)){logger[_0x7ebe('0x31')](_0x7ebe('0xae'),_0x37c929['uniqueid'],_0x37c929[_0x7ebe('0xaf')],_0x37c929[_0x7ebe('0xb0')]);logger['debug'](_0x7ebe('0xb1'),_0x37c929[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x37c929,{'showHidden':![],'depth':null}));if(this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb2')]]){this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb2')]][_0x7ebe('0xb3')]=_0x37c929[_0x7ebe('0xaf')];this[_0x7ebe('0x1c')][_0x37c929['transfereeuniqueid']]['transferconnectedlinenum']=_0x37c929[_0x7ebe('0xb0')];if(this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb4')]]){var _0x1d5ca8=this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb4')]];this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb4')]]=this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb2')]];this[_0x7ebe('0x1c')][_0x37c929['transfereeuniqueid']]=_0x1d5ca8;}}else if(this['channels'][_0x37c929[_0x7ebe('0xb5')]]){this['channels'][_0x37c929['transfertargetuniqueid']][_0x7ebe('0xb3')]=_0x37c929['origtransferercalleridnum'];this['channels'][_0x37c929[_0x7ebe('0xb5')]][_0x7ebe('0xb6')]=_0x37c929[_0x7ebe('0xb0')];if(this[_0x7ebe('0x1c')][_0x37c929['origtransfereruniqueid']]){var _0x1d5ca8=this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb7')]];this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb7')]]=this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb5')]];this['channels'][_0x37c929[_0x7ebe('0xb5')]]=_0x1d5ca8;}}if((this[_0x7ebe('0x1c')][_0x37c929['origtransfereruniqueid']]||this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb8')]])&&this['channels'][_0x37c929[_0x7ebe('0xb4')]]){var _0x2bb114=_[_0x7ebe('0xb9')]([this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb7')]],this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb8')]],this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb4')]]],function(_0x27e295){return _0x27e295&&_0x27e295[_0x7ebe('0xaa')]===_0x7ebe('0xba')&&_0x27e295[_0x7ebe('0xbb')];});if(_0x2bb114){if(this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb7')]])this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb7')]][_0x7ebe('0xa0')]=_0x7ebe('0xbc');if(this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb8')]])this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb8')]][_0x7ebe('0xa0')]='ATTENDED';this[_0x7ebe('0x1c')][_0x37c929[_0x7ebe('0xb4')]][_0x7ebe('0xa0')]=_0x7ebe('0xbc');}}}}catch(_0x362f9d){logger[_0x7ebe('0x33')](_0x7ebe('0xbd'),_0x37c929['uniqueid'],util[_0x7ebe('0x35')](_0x362f9d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')][_0x7ebe('0x2d')]=function(_0x56a352){try{if(this[_0x7ebe('0x37')](_0x56a352)){logger[_0x7ebe('0x31')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x56a352['uniqueid'],_0x56a352[_0x7ebe('0xbe')],_0x56a352['extension']);logger[_0x7ebe('0x3b')](_0x7ebe('0xbf'),_0x56a352[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x56a352,{'showHidden':![],'depth':null}));if(this['channels'][_0x56a352[_0x7ebe('0xb2')]]){this[_0x7ebe('0x1c')][_0x56a352[_0x7ebe('0xb2')]][_0x7ebe('0xb3')]=_0x56a352[_0x7ebe('0xbe')];this[_0x7ebe('0x1c')][_0x56a352[_0x7ebe('0xb2')]][_0x7ebe('0xb6')]=_0x56a352[_0x7ebe('0xc0')];this['channels'][_0x56a352[_0x7ebe('0xb2')]]['transferType']=_0x7ebe('0xc1');this[_0x7ebe('0x27')]({'event':_0x7ebe('0xa9'),'uniqueid':_0x56a352[_0x7ebe('0xb2')],'context':_0x56a352['context'],'channel':_0x56a352[_0x7ebe('0xc2')]});}else{this[_0x7ebe('0x1c')][_0x56a352[_0x7ebe('0xc3')]]['transferType']=_0x7ebe('0xc1');}}}catch(_0x405429){logger[_0x7ebe('0x33')](_0x7ebe('0xc4'),_0x56a352[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x405429,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')][_0x7ebe('0x2f')]=function(_0x20ffd8){try{if(this['isNotNull'](_0x20ffd8)){logger[_0x7ebe('0x3b')](_0x7ebe('0xc5'),_0x20ffd8['uniqueid'],util[_0x7ebe('0x35')](_0x20ffd8,{'showHidden':![],'depth':null}));if(this[_0x7ebe('0x1c')][_0x20ffd8[_0x7ebe('0x39')]]){if(!_[_0x7ebe('0x7c')](this[_0x7ebe('0x1c')][_0x20ffd8['uniqueid']][_0x7ebe('0x6d')])){this[_0x7ebe('0x1c')][_0x20ffd8[_0x7ebe('0x39')]][_0x7ebe('0xc6')]=moment()[_0x7ebe('0x47')](_0x7ebe('0x62'));logger['info'](_0x7ebe('0xc7'),_0x20ffd8['uniqueid'],this['channels'][_0x20ffd8['uniqueid']][_0x7ebe('0xc6')]);}}}}catch(_0x57438c){logger[_0x7ebe('0x33')]('[%s][voiceCallReport][musiconholdstart]',_0x20ffd8[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x57438c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ebe('0x36')]['syncMusicOnHoldStop']=function(_0x35a0b5){try{if(this[_0x7ebe('0x37')](_0x35a0b5)){logger['debug'](_0x7ebe('0xc8'),_0x35a0b5[_0x7ebe('0x39')],util[_0x7ebe('0x35')](_0x35a0b5,{'showHidden':![],'depth':null}));if(this[_0x7ebe('0x1c')][_0x35a0b5[_0x7ebe('0x39')]]){if(!_[_0x7ebe('0x7c')](this['channels'][_0x35a0b5[_0x7ebe('0x39')]][_0x7ebe('0xc6')])){this[_0x7ebe('0x1c')][_0x35a0b5[_0x7ebe('0x39')]]['mohtime']+=moment()[_0x7ebe('0xc9')](0x0)[_0x7ebe('0x6f')](this[_0x7ebe('0x1c')][_0x35a0b5['uniqueid']][_0x7ebe('0xc6')],_0x7ebe('0x61'));logger[_0x7ebe('0x31')](_0x7ebe('0xca'),_0x35a0b5[_0x7ebe('0x39')],this[_0x7ebe('0x1c')][_0x35a0b5[_0x7ebe('0x39')]][_0x7ebe('0xcb')]);delete this['channels'][_0x35a0b5[_0x7ebe('0x39')]][_0x7ebe('0xc6')];}}}}catch(_0x124b3b){logger[_0x7ebe('0x33')](_0x7ebe('0xcc'),_0x35a0b5['uniqueid'],util['inspect'](_0x124b3b,{'showHidden':![],'depth':null}));}};module[_0x7ebe('0xcd')]=VoiceCallReport; \ No newline at end of file +var _0xf88c=['newexten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','merge','keys','context','from-sip','channel','split','destconnectedlinenum','connectedlinenum','format','name','user:agentconnect','[%s][voiceCallReport][newcallerid]','debug','linkedid','OutgoingSpoolFailed','info','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','pick','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','appdata','startsWith','CDR(routeAlias)','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','lastapplication','lastdata','cdr(','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','starttime','holdtime','diff','xcally-motion-preview','connectedlinename','destinationchannel','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','user:%s','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','replace','.wav49','.WAV','monitorFilename','find','isNil','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','syncHangup','[%s][voiceCallReport][hangup]\x20event:','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','undefined','isEmpty','getSettings','stopRecordingOnTransfer','Action','catch','finally','webbar:stopmonitors','event','BlindTransfer','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','transferconnectedlinenum','origtransfereruniqueid','some','outbound','routeid','transferType','ATTENDED','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','transfereecalleridnum','extension','transfererchannel','transfereruniqueid','BLIND','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/environment','ami','../ami','unknown','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','redis','defaults','channels','agents','blindTransfers','coreshowchannel','syncNewExten'];(function(_0x766080,_0x32d34a){var _0x27f3b5=function(_0x3c6413){while(--_0x3c6413){_0x766080['push'](_0x766080['shift']());}};_0x27f3b5(++_0x32d34a);}(_0xf88c,0x17f));var _0xcf88=function(_0x1e77d2,_0x1f7c7b){_0x1e77d2=_0x1e77d2-0x0;var _0x2dc5ed=_0xf88c[_0x1e77d2];return _0x2dc5ed;};'use strict';var BPromise=require('bluebird');var _=require(_0xcf88('0x0'));var moment=require(_0xcf88('0x1'));var util=require(_0xcf88('0x2'));var path=require(_0xcf88('0x3'));var Redis=require(_0xcf88('0x4'));var config=require(_0xcf88('0x5'));var logger=require('../../../config/logger')(_0xcf88('0x6'));var ami=require(_0xcf88('0x7'));var Channel=require('../model/channel');var RpcSetting=require('../rpc/setting');var statusDesc=[_0xcf88('0x8'),'not_inuse',_0xcf88('0x9'),_0xcf88('0xa'),_0xcf88('0xb'),_0xcf88('0xc'),_0xcf88('0xd'),_0xcf88('0xe'),_0xcf88('0xf')];var applications=[_0xcf88('0x10'),_0xcf88('0x11'),_0xcf88('0x12'),_0xcf88('0x13'),_0xcf88('0x14'),_0xcf88('0x15')];var dispositions=[_0xcf88('0x16'),_0xcf88('0x17'),_0xcf88('0x17'),_0xcf88('0x16'),_0xcf88('0x16'),_0xcf88('0x16'),'ANSWERED','BUSY','FAILED',_0xcf88('0x17'),_0xcf88('0x17')];var actions={};config[_0xcf88('0x18')]=_[_0xcf88('0x19')](config[_0xcf88('0x18')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0x7873aa){this[_0xcf88('0x1a')]=_0x7873aa[_0xcf88('0x1a')];this[_0xcf88('0x1b')]=_0x7873aa['agents'];this[_0xcf88('0x1c')]={};ami['on'](_0xcf88('0x1d'),this[_0xcf88('0x1e')]['bind'](this));ami['on'](_0xcf88('0x1f'),this[_0xcf88('0x1e')][_0xcf88('0x20')](this));ami['on'](_0xcf88('0x21'),this[_0xcf88('0x22')][_0xcf88('0x20')](this));ami['on'](_0xcf88('0x23'),this[_0xcf88('0x24')][_0xcf88('0x20')](this));ami['on'](_0xcf88('0x25'),this[_0xcf88('0x26')][_0xcf88('0x20')](this));ami['on']('hangup',this['syncHangup'][_0xcf88('0x20')](this));ami['on'](_0xcf88('0x27'),this[_0xcf88('0x28')][_0xcf88('0x20')](this));ami['on']('attendedtransfer',this[_0xcf88('0x29')]['bind'](this));ami['on'](_0xcf88('0x2a'),this['syncBlindTransfer']['bind'](this));ami['on'](_0xcf88('0x2b'),this[_0xcf88('0x2c')][_0xcf88('0x20')](this));ami['on'](_0xcf88('0x2d'),this[_0xcf88('0x2e')][_0xcf88('0x20')](this));try{logger['info'](_0xcf88('0x2f'));ami[_0xcf88('0x30')]();}catch(_0xe6c65e){logger[_0xcf88('0x31')](_0xcf88('0x32'),util[_0xcf88('0x33')](_0xe6c65e,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xcf88('0x34')][_0xcf88('0x35')]=function(_0x45e9aa){return _0x45e9aa!==null&&!_[_0xcf88('0x36')](_0x45e9aa);};VoiceCallReport[_0xcf88('0x34')][_0xcf88('0x37')]=function(_0xd853ea,_0x5a7a2c,_0x53cdc0){io['to'](_0xd853ea)[_0xcf88('0x37')](_0x5a7a2c,_0x53cdc0);};VoiceCallReport[_0xcf88('0x34')][_0xcf88('0x28')]=function(_0x929966){try{if(this['isNotNull'](_0x929966)){logger['info'](_0xcf88('0x38'),_0x929966[_0xcf88('0x39')],_0x929966[_0xcf88('0x3a')],_0x929966[_0xcf88('0x3b')]);logger['debug'](_0xcf88('0x3c'),_0x929966[_0xcf88('0x39')],util['inspect'](_0x929966,{'showHidden':![],'depth':null}));if(_0x929966[_0xcf88('0x39')]===_0x929966['linkedid']){if(!_['isUndefined'](this['channels'][_0x929966[_0xcf88('0x39')]])){_[_0xcf88('0x3d')](this[_0xcf88('0x1a')][_0x929966[_0xcf88('0x39')]],_['pick'](_0x929966,_[_0xcf88('0x3e')](this[_0xcf88('0x1a')][_0x929966[_0xcf88('0x39')]])));}}if(_0x929966[_0xcf88('0x3f')]===_0xcf88('0x40')){if(this[_0xcf88('0x1b')][_0x929966[_0xcf88('0x41')]['split']('-')[0x0]]){if(_0x929966['exten']=='xcally-motion-preview'){this['agents'][_0x929966[_0xcf88('0x41')][_0xcf88('0x42')]('-')[0x0]][_0xcf88('0x43')]=_0x929966[_0xcf88('0x44')];this[_0xcf88('0x37')](util[_0xcf88('0x45')]('user:%s',this[_0xcf88('0x1b')][_0x929966[_0xcf88('0x41')]['split']('-')[0x0]][_0xcf88('0x46')]),_0xcf88('0x47'),{'destaccountcode':this[_0xcf88('0x1b')][_0x929966[_0xcf88('0x41')][_0xcf88('0x42')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x929966[_0xcf88('0x44')]});}}}}}catch(_0x2a011c){logger[_0xcf88('0x31')](_0xcf88('0x48'),_0x929966['uniqueid'],util['inspect'](_0x2a011c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcf88('0x34')][_0xcf88('0x22')]=function(_0x36ef44){try{if(this[_0xcf88('0x35')](_0x36ef44)){logger[_0xcf88('0x49')]('[%s][voiceCallReport][newchannel]\x20event:',_0x36ef44[_0xcf88('0x39')],util[_0xcf88('0x33')](_0x36ef44,{'showHidden':![],'depth':null}));if(_0x36ef44[_0xcf88('0x39')]===_0x36ef44[_0xcf88('0x4a')]&&_0x36ef44[_0xcf88('0x41')]!=_0xcf88('0x4b')){if(_[_0xcf88('0x36')](this['channels'][_0x36ef44['uniqueid']])){logger[_0xcf88('0x4c')](_0xcf88('0x4d'),_0x36ef44[_0xcf88('0x39')],_0x36ef44[_0xcf88('0x3f')],_0x36ef44['exten']);this[_0xcf88('0x1a')][_0x36ef44['uniqueid']]=new Channel();this[_0xcf88('0x1a')][_0x36ef44[_0xcf88('0x39')]]['starttime']=moment()[_0xcf88('0x45')](_0xcf88('0x4e'));this[_0xcf88('0x1a')][_0x36ef44[_0xcf88('0x39')]][_0xcf88('0x4f')]=dispositions[_[_0xcf88('0x50')](_0x36ef44[_0xcf88('0x51')])];_[_0xcf88('0x3d')](this[_0xcf88('0x1a')][_0x36ef44[_0xcf88('0x39')]],_[_0xcf88('0x52')](_0x36ef44,_[_0xcf88('0x3e')](this[_0xcf88('0x1a')][_0x36ef44[_0xcf88('0x39')]])));if(_0x36ef44[_0xcf88('0x3f')]===_0xcf88('0x40')){if(this[_0xcf88('0x1b')][_0x36ef44[_0xcf88('0x41')][_0xcf88('0x42')]('-')[0x0]]){if(_['isUndefined'](this['agents'][_0x36ef44[_0xcf88('0x41')]['split']('-')[0x0]][_0xcf88('0x43')])){this[_0xcf88('0x1b')][_0x36ef44[_0xcf88('0x41')][_0xcf88('0x42')]('-')[0x0]][_0xcf88('0x43')]=_0x36ef44[_0xcf88('0x53')];logger[_0xcf88('0x49')](_0xcf88('0x54'),_0x36ef44[_0xcf88('0x39')],util[_0xcf88('0x33')]({'destaccountcode':this['agents'][_0x36ef44[_0xcf88('0x41')][_0xcf88('0x42')]('-')[0x0]][_0xcf88('0x55')],'destconnectedlinenum':_0x36ef44['exten']},{'showHidden':![],'depth':null}));this[_0xcf88('0x37')](util[_0xcf88('0x45')]('user:%s',this[_0xcf88('0x1b')][_0x36ef44[_0xcf88('0x41')][_0xcf88('0x42')]('-')[0x0]]['name']),_0xcf88('0x47'),{'destaccountcode':this[_0xcf88('0x1b')][_0x36ef44[_0xcf88('0x41')]['split']('-')[0x0]][_0xcf88('0x55')],'destconnectedlinenum':_0x36ef44[_0xcf88('0x53')]});}}}}}}}catch(_0x22c49a){logger['error']('[%s][voiceCallReport][newchannel]',_0x36ef44[_0xcf88('0x39')],util['inspect'](_0x22c49a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x4810db){try{if(this[_0xcf88('0x35')](_0x4810db)){logger[_0xcf88('0x49')](_0xcf88('0x56'),_0x4810db[_0xcf88('0x39')],util[_0xcf88('0x33')](_0x4810db,{'showHidden':![],'depth':null}));if(_0x4810db[_0xcf88('0x39')]===_0x4810db['linkedid']&&_0x4810db[_0xcf88('0x53')]!='h'&&_0x4810db['channel']!=_0xcf88('0x4b')){_0x4810db['application']=_0x4810db[_0xcf88('0x57')][_0xcf88('0x58')]();_0x4810db['applicationdata']=_0x4810db[_0xcf88('0x59')]&&_0x4810db[_0xcf88('0x59')][_0xcf88('0x5a')](_0xcf88('0x5b'))?_0x4810db['appdata']:(_0x4810db[_0xcf88('0x59')]||_0x4810db[_0xcf88('0x5c')])[_0xcf88('0x58')]();logger[_0xcf88('0x4c')](_0xcf88('0x5d'),_0x4810db[_0xcf88('0x39')],_0x4810db['application'],_0x4810db[_0xcf88('0x5c')]);if(_[_0xcf88('0x36')](this['channels'][_0x4810db['uniqueid']])){this[_0xcf88('0x1a')][_0x4810db['uniqueid']]=new Channel();this['channels'][_0x4810db[_0xcf88('0x39')]]['starttime']=_0x4810db['duration']?moment()[_0xcf88('0x5e')](moment[_0xcf88('0x5f')](_0x4810db[_0xcf88('0x5f')])[_0xcf88('0x60')](),_0xcf88('0x60'))['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xcf88('0x45')](_0xcf88('0x4e'));this[_0xcf88('0x1a')][_0x4810db['uniqueid']][_0xcf88('0x4f')]=_0xcf88('0x16');}_[_0xcf88('0x3d')](this[_0xcf88('0x1a')][_0x4810db[_0xcf88('0x39')]],_[_0xcf88('0x52')](_0x4810db,_[_0xcf88('0x3e')](this[_0xcf88('0x1a')][_0x4810db[_0xcf88('0x39')]])));if(_['includes'](applications,_0x4810db[_0xcf88('0x57')])){this['channels'][_0x4810db[_0xcf88('0x39')]][_0xcf88('0x61')]=_0x4810db[_0xcf88('0x57')];this[_0xcf88('0x1a')][_0x4810db['uniqueid']][_0xcf88('0x62')]=_0x4810db['applicationdata'];if(_0x4810db['application']===_0xcf88('0x10')&&_[_0xcf88('0x5a')](_0x4810db[_0xcf88('0x5c')][_0xcf88('0x58')](),_0xcf88('0x63'))){var _0x46a19b=_0x4810db['applicationdata']['split']('=');var _0x2bcae6=_0x46a19b[0x0][_0xcf88('0x58')]()['match'](/cdr\((.*)\)/);if(_0x2bcae6){this[_0xcf88('0x1a')][_0x4810db[_0xcf88('0x39')]][_0x2bcae6[0x1]]=_0x46a19b[0x1];}}else if(_0x4810db[_0xcf88('0x57')]==='queue'){this['channels'][_0x4810db[_0xcf88('0x39')]][_0xcf88('0x11')]=_0x4810db[_0xcf88('0x5c')]['split'](',')[0x0];}}}}}catch(_0x64dfc){logger[_0xcf88('0x31')](_0xcf88('0x64'),_0x4810db[_0xcf88('0x39')],util[_0xcf88('0x33')](_0x64dfc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcf88('0x34')][_0xcf88('0x24')]=function(_0x3160d2){try{if(this['isNotNull'](_0x3160d2)){logger['info'](_0xcf88('0x65'),_0x3160d2[_0xcf88('0x39')],_0x3160d2['linkedid'],_0x3160d2['calleridname'],_0x3160d2['calleridnum']);logger['debug'](_0xcf88('0x66'),_0x3160d2[_0xcf88('0x39')],util[_0xcf88('0x33')](_0x3160d2,{'showHidden':![],'depth':null}));if(_0x3160d2[_0xcf88('0x39')]!==_0x3160d2[_0xcf88('0x4a')]){if(this['channels'][_0x3160d2['linkedid']]){if(_0x3160d2[_0xcf88('0x51')]==='6'){if(!this['channels'][_0x3160d2[_0xcf88('0x4a')]][_0xcf88('0x67')]){var _0x47c409=moment();this[_0xcf88('0x1a')][_0x3160d2['linkedid']][_0xcf88('0x67')]=!![];this['channels'][_0x3160d2[_0xcf88('0x4a')]][_0xcf88('0x68')]=_0x47c409[_0xcf88('0x45')](_0xcf88('0x4e'));if(this['channels'][_0x3160d2['linkedid']][_0xcf88('0x69')]){this[_0xcf88('0x1a')][_0x3160d2['linkedid']][_0xcf88('0x6a')]=_0x47c409[_0xcf88('0x6b')](this[_0xcf88('0x1a')][_0x3160d2[_0xcf88('0x4a')]][_0xcf88('0x69')],_0xcf88('0x60'));}}this[_0xcf88('0x1a')][_0x3160d2[_0xcf88('0x4a')]][_0xcf88('0x4a')]=_0x3160d2[_0xcf88('0x39')];if(_0x3160d2['calleridnum']!==_0xcf88('0x6c')){this[_0xcf88('0x1a')][_0x3160d2[_0xcf88('0x4a')]][_0xcf88('0x44')]=_0x3160d2[_0xcf88('0x3b')];}this[_0xcf88('0x1a')][_0x3160d2[_0xcf88('0x4a')]][_0xcf88('0x6d')]=_0x3160d2[_0xcf88('0x3a')];this['channels'][_0x3160d2[_0xcf88('0x4a')]][_0xcf88('0x6e')]=_0x3160d2[_0xcf88('0x41')];this[_0xcf88('0x1a')][_0x3160d2[_0xcf88('0x4a')]][_0xcf88('0x4f')]=dispositions[_[_0xcf88('0x50')](_0x3160d2[_0xcf88('0x51')])];if(this[_0xcf88('0x1b')][_0x3160d2['channel'][_0xcf88('0x42')]('-')[0x0]]){this[_0xcf88('0x1a')][_0x3160d2['linkedid']][_0xcf88('0x6f')]=this['agents'][_0x3160d2[_0xcf88('0x41')]['split']('-')[0x0]]['id'];this[_0xcf88('0x1a')][_0x3160d2[_0xcf88('0x4a')]]['membername']=this[_0xcf88('0x1b')][_0x3160d2[_0xcf88('0x41')]['split']('-')[0x0]][_0xcf88('0x46')];}}}}else{if(this['channels'][_0x3160d2[_0xcf88('0x39')]]){if(_0x3160d2[_0xcf88('0x51')]==='6'){if(this[_0xcf88('0x1b')][_0x3160d2[_0xcf88('0x41')]['split']('-')[0x0]]){this[_0xcf88('0x1a')][_0x3160d2[_0xcf88('0x39')]][_0xcf88('0x6f')]=this[_0xcf88('0x1b')][_0x3160d2['channel']['split']('-')[0x0]]['id'];this['channels'][_0x3160d2[_0xcf88('0x39')]][_0xcf88('0x70')]=this['agents'][_0x3160d2[_0xcf88('0x41')][_0xcf88('0x42')]('-')[0x0]][_0xcf88('0x46')];}}}}if(_0x3160d2['channelstate']==='6'&&_0x3160d2[_0xcf88('0x3f')]==='from-sip'){if(this['agents'][_0x3160d2['channel'][_0xcf88('0x42')]('-')[0x0]]){this[_0xcf88('0x1b')][_0x3160d2[_0xcf88('0x41')]['split']('-')[0x0]][_0xcf88('0x43')]=_0x3160d2['exten'];var _0x1884a6;if(this[_0xcf88('0x1a')][_0x3160d2['uniqueid']])_0x1884a6=this[_0xcf88('0x1a')][_0x3160d2['uniqueid']][_0xcf88('0x71')];else if(this[_0xcf88('0x1a')][_0x3160d2[_0xcf88('0x4a')]])_0x1884a6=this[_0xcf88('0x1a')][_0x3160d2[_0xcf88('0x4a')]][_0xcf88('0x71')];logger['debug'](_0xcf88('0x72'),_0x3160d2['uniqueid'],util[_0xcf88('0x33')]({'destaccountcode':this[_0xcf88('0x1b')][_0x3160d2[_0xcf88('0x41')][_0xcf88('0x42')]('-')[0x0]][_0xcf88('0x55')],'destconnectedlinenum':_0x3160d2[_0xcf88('0x53')],'routealias':_0x1884a6},{'showHidden':![],'depth':null}));this[_0xcf88('0x37')](util['format'](_0xcf88('0x73'),this[_0xcf88('0x1b')][_0x3160d2[_0xcf88('0x41')]['split']('-')[0x0]][_0xcf88('0x46')]),_0xcf88('0x47'),{'destaccountcode':this[_0xcf88('0x1b')][_0x3160d2[_0xcf88('0x41')][_0xcf88('0x42')]('-')[0x0]][_0xcf88('0x55')],'destconnectedlinenum':_0x3160d2['exten'],'routealias':_0x1884a6});}}}}catch(_0xdc2b1f){logger[_0xcf88('0x31')]('[%s][voiceCallReport][newstate]',_0x3160d2[_0xcf88('0x39')],util['inspect'](_0xdc2b1f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcf88('0x34')]['syncMixMonitorFilename']=function(_0x3fbadd,_0x39d0e9){try{if(this['channels'][_0x3fbadd]){logger[_0xcf88('0x4c')](_0xcf88('0x74'),_0x3fbadd,_0x39d0e9);this[_0xcf88('0x1a')][_0x3fbadd]['monitor']=!![];if(_[_0xcf88('0x75')](_0x39d0e9,'.wav49')){_0x39d0e9=_0x39d0e9[_0xcf88('0x76')](_0xcf88('0x77'),_0xcf88('0x78'));}this[_0xcf88('0x1a')][_0x3fbadd][_0xcf88('0x79')]=_0x39d0e9;var _0x24b58c=_[_0xcf88('0x7a')](this[_0xcf88('0x1a')][_0x3fbadd]['monitors'],{'filename':_0x39d0e9});if(_[_0xcf88('0x7b')](_0x24b58c)){this[_0xcf88('0x1a')][_0x3fbadd][_0xcf88('0x7c')][_0xcf88('0x7d')]({'filename':_0x39d0e9,'createdAt':moment()[_0xcf88('0x45')](_0xcf88('0x4e')),'mixmonitorid':'','status':_0xcf88('0x7e')});}}}catch(_0x32c0b5){logger[_0xcf88('0x31')](_0xcf88('0x7f'),_0x3fbadd,util[_0xcf88('0x33')](_0x32c0b5,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncVarSet']=function(_0x3a9132){try{if(this[_0xcf88('0x35')](_0x3a9132)){logger[_0xcf88('0x49')](_0xcf88('0x80'),_0x3a9132[_0xcf88('0x39')],util[_0xcf88('0x33')](_0x3a9132,{'showHidden':![],'depth':null}));if(this['channels'][_0x3a9132[_0xcf88('0x39')]]&&_0x3a9132[_0xcf88('0x41')]!=_0xcf88('0x4b')){if(this[_0xcf88('0x35')](_0x3a9132[_0xcf88('0x81')])){if(this[_0xcf88('0x35')](_0x3a9132[_0xcf88('0x81')][_0xcf88('0x82')])){logger[_0xcf88('0x4c')](_0xcf88('0x83'),_0x3a9132[_0xcf88('0x39')],_0x3a9132[_0xcf88('0x84')]);this[_0xcf88('0x85')](_0x3a9132[_0xcf88('0x39')],_0x3a9132[_0xcf88('0x84')]);}else if(this[_0xcf88('0x35')](_0x3a9132['variable'][_0xcf88('0x86')])){logger['info'](_0xcf88('0x87'),_0x3a9132['uniqueid'],_0x3a9132['value']);this[_0xcf88('0x1a')][_0x3a9132[_0xcf88('0x39')]][_0xcf88('0x3b')]=_0x3a9132[_0xcf88('0x84')];}else if(this[_0xcf88('0x35')](_0x3a9132[_0xcf88('0x81')][_0xcf88('0x88')])){logger[_0xcf88('0x4c')](_0xcf88('0x89'),_0x3a9132[_0xcf88('0x39')],_0x3a9132[_0xcf88('0x84')]);this[_0xcf88('0x1a')][_0x3a9132[_0xcf88('0x39')]][_0xcf88('0x8a')]=_0x3a9132['value'];}else if(this[_0xcf88('0x35')](_0x3a9132[_0xcf88('0x81')][_0xcf88('0x8b')])){logger[_0xcf88('0x4c')](_0xcf88('0x8c'),_0x3a9132[_0xcf88('0x39')],_0x3a9132[_0xcf88('0x84')]);this[_0xcf88('0x1a')][_0x3a9132['uniqueid']][_0xcf88('0x8d')]=_0x3a9132[_0xcf88('0x84')];}else if(this[_0xcf88('0x35')](_0x3a9132[_0xcf88('0x81')]['xmd-queue'])){logger[_0xcf88('0x4c')](_0xcf88('0x8e'),_0x3a9132[_0xcf88('0x39')],_0x3a9132[_0xcf88('0x84')][_0xcf88('0x42')](',')[0x0]);this['channels'][_0x3a9132[_0xcf88('0x39')]][_0xcf88('0x11')]=_0x3a9132[_0xcf88('0x84')][_0xcf88('0x42')](',')[0x0];}else if(this[_0xcf88('0x35')](_0x3a9132['variable'][_0xcf88('0x8f')])){logger[_0xcf88('0x4c')](_0xcf88('0x90'),_0x3a9132[_0xcf88('0x39')],_0x3a9132[_0xcf88('0x84')]);this[_0xcf88('0x1a')][_0x3a9132[_0xcf88('0x39')]]['originatecalleridnum']=_0x3a9132[_0xcf88('0x84')];}else if(this[_0xcf88('0x35')](_0x3a9132[_0xcf88('0x81')][_0xcf88('0x91')])){logger[_0xcf88('0x4c')](_0xcf88('0x92'),_0x3a9132['uniqueid'],_0x3a9132[_0xcf88('0x84')]);this[_0xcf88('0x1a')][_0x3a9132['uniqueid']]['destination']=_0x3a9132[_0xcf88('0x84')];}else if(this[_0xcf88('0x35')](_0x3a9132[_0xcf88('0x81')][_0xcf88('0x93')])){logger[_0xcf88('0x4c')](_0xcf88('0x94'),_0x3a9132['uniqueid'],_0x3a9132[_0xcf88('0x84')]);this[_0xcf88('0x1a')][_0x3a9132['uniqueid']][_0xcf88('0x95')]=_0x3a9132[_0xcf88('0x84')];}else if(this['isNotNull'](_0x3a9132[_0xcf88('0x81')][_0xcf88('0x96')])){logger[_0xcf88('0x4c')](_0xcf88('0x97'),_0x3a9132['uniqueid'],_0x3a9132['value']);this['channels'][_0x3a9132[_0xcf88('0x39')]][_0xcf88('0x11')]=_0x3a9132['value'];}else if(this[_0xcf88('0x35')](_0x3a9132[_0xcf88('0x81')][_0xcf88('0x98')])){logger[_0xcf88('0x4c')](_0xcf88('0x99'),_0x3a9132[_0xcf88('0x39')],_0x3a9132[_0xcf88('0x84')]);this['channels'][_0x3a9132['uniqueid']]['sipcalluniqueid']=_0x3a9132['value'];}}}else if(this[_0xcf88('0x35')](_0x3a9132['variable'][_0xcf88('0x82')])){if(_0x3a9132[_0xcf88('0x84')]){var _0x11fb05=path['parse'](_0x3a9132[_0xcf88('0x84')])[_0xcf88('0x46')];logger[_0xcf88('0x4c')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x11fb05,_0x3a9132[_0xcf88('0x84')]);this['syncMixMonitorFilename'](_0x11fb05,_0x3a9132[_0xcf88('0x84')]);}}else if(this['channels'][_0x3a9132['linkedid']]){if(this[_0xcf88('0x35')](_0x3a9132[_0xcf88('0x81')])){if(this[_0xcf88('0x35')](_0x3a9132[_0xcf88('0x81')]['sipcallid'])){logger[_0xcf88('0x4c')](_0xcf88('0x99'),_0x3a9132[_0xcf88('0x4a')],_0x3a9132[_0xcf88('0x84')]);this[_0xcf88('0x1a')][_0x3a9132[_0xcf88('0x4a')]][_0xcf88('0x9a')]=_0x3a9132['value'];}}}}}catch(_0x49e844){logger[_0xcf88('0x31')]('[%s][voiceCallReport][varset]',_0x3a9132['uniqueid'],util['inspect'](_0x49e844,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcf88('0x34')][_0xcf88('0x9b')]=function(_0x3b46e3){try{if(this[_0xcf88('0x35')](_0x3b46e3)){logger[_0xcf88('0x49')](_0xcf88('0x9c'),_0x3b46e3[_0xcf88('0x39')],util[_0xcf88('0x33')](_0x3b46e3,{'showHidden':![],'depth':null}));if(this[_0xcf88('0x1a')][_0x3b46e3['uniqueid']]){logger[_0xcf88('0x4c')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x3b46e3[_0xcf88('0x39')],_0x3b46e3[_0xcf88('0x9d')]);var _0x4d0d50=moment();this['channels'][_0x3b46e3[_0xcf88('0x39')]][_0xcf88('0x9e')]=_0x4d0d50['format'](_0xcf88('0x4e'));this[_0xcf88('0x1a')][_0x3b46e3[_0xcf88('0x39')]][_0xcf88('0x5f')]=_0x4d0d50[_0xcf88('0x6b')](this[_0xcf88('0x1a')][_0x3b46e3['uniqueid']][_0xcf88('0x69')],'seconds');if(this[_0xcf88('0x1a')][_0x3b46e3['uniqueid']]['answered']){this[_0xcf88('0x1a')][_0x3b46e3[_0xcf88('0x39')]][_0xcf88('0x9f')]=_0x4d0d50[_0xcf88('0x6b')](this[_0xcf88('0x1a')][_0x3b46e3[_0xcf88('0x39')]][_0xcf88('0x68')],'seconds');this[_0xcf88('0x1a')][_0x3b46e3[_0xcf88('0x39')]][_0xcf88('0x6a')]=this[_0xcf88('0x1a')][_0x3b46e3[_0xcf88('0x39')]][_0xcf88('0x5f')]-this[_0xcf88('0x1a')][_0x3b46e3[_0xcf88('0x39')]][_0xcf88('0x9f')];}if(_0x3b46e3['context']==='from-sip'){if(this[_0xcf88('0x1b')][_0x3b46e3[_0xcf88('0x41')][_0xcf88('0x42')]('-')[0x0]]){this[_0xcf88('0x1b')][_0x3b46e3[_0xcf88('0x41')][_0xcf88('0x42')]('-')[0x0]]=_[_0xcf88('0xa0')](this[_0xcf88('0x1b')][_0x3b46e3[_0xcf88('0x41')][_0xcf88('0x42')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0xcf88('0xa1'),_0x3b46e3[_0xcf88('0x39')],util['inspect']({'id':this[_0xcf88('0x1b')][_0x3b46e3[_0xcf88('0x41')][_0xcf88('0x42')]('-')[0x0]]['id'],'destaccountcode':this[_0xcf88('0x1b')][_0x3b46e3['channel'][_0xcf88('0x42')]('-')[0x0]][_0xcf88('0x55')]},{'showHidden':![],'depth':null}));this[_0xcf88('0x37')](util[_0xcf88('0x45')]('user:%s',this['agents'][_0x3b46e3[_0xcf88('0x41')]['split']('-')[0x0]][_0xcf88('0x46')]),_0xcf88('0xa2'),{'id':this[_0xcf88('0x1b')][_0x3b46e3[_0xcf88('0x41')][_0xcf88('0x42')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x3b46e3[_0xcf88('0x41')]['split']('-')[0x0]]['accountcode']});}}var _0x2ed078=this;Promise[_0xcf88('0xa3')]()[_0xcf88('0xa4')](function(){var _0x15811b=_0x2ed078[_0xcf88('0x1a')][_0x3b46e3[_0xcf88('0x39')]];if(typeof _0x15811b['transferType']===_0xcf88('0xa5'))return;if(_[_0xcf88('0xa6')](_0x15811b[_0xcf88('0x7c')]))return;return RpcSetting[_0xcf88('0xa7')]()[_0xcf88('0xa4')](function(_0x29827f){if(!_0x29827f[_0xcf88('0xa8')])return;return Promise[_0xcf88('0xa3')]()[_0xcf88('0xa4')](function(){return ami[_0xcf88('0xa9')]({'action':'StopMixMonitor','channel':_0x15811b[_0xcf88('0x41')]})[_0xcf88('0xaa')](function(){});})[_0xcf88('0xa4')](function(){return ami[_0xcf88('0xa9')]({'action':'StopMixMonitor','channel':_0x15811b[_0xcf88('0x6e')]})[_0xcf88('0xaa')](function(){})[_0xcf88('0xab')](function(){var _0x49fecd=_0x2ed078[_0xcf88('0x1b')][_0x15811b[_0xcf88('0x6e')][_0xcf88('0x42')]('-')[0x0]];if(!_0x49fecd)return;io[_0xcf88('0x37')](_0xcf88('0xac'),{'agentId':_0x49fecd['id'],'uniqueid':_0x15811b[_0xcf88('0x39')]});});});});})[_0xcf88('0xa4')](function(){if(_0x3b46e3[_0xcf88('0xad')]===_0xcf88('0xae')){_0x2ed078[_0xcf88('0x1c')][_0x3b46e3['uniqueid']]=_0x2ed078['channels'][_0x3b46e3[_0xcf88('0x39')]];}else{if(_0x2ed078[_0xcf88('0x1a')][_0x3b46e3[_0xcf88('0x39')]]['type']==='outbound'&&_0x2ed078[_0xcf88('0x1c')][_0x3b46e3[_0xcf88('0x39')]]){_0x2ed078[_0xcf88('0x1a')][_0x3b46e3[_0xcf88('0x39')]][_0xcf88('0x39')]=[_0x2ed078['channels'][_0x3b46e3[_0xcf88('0x39')]]['linkedid'],_0x2ed078[_0xcf88('0x1a')][_0x3b46e3[_0xcf88('0x39')]][_0xcf88('0x4a')]=_0x2ed078[_0xcf88('0x1a')][_0x3b46e3['uniqueid']][_0xcf88('0x39')]][0x0];delete _0x2ed078[_0xcf88('0x1c')][_0x3b46e3[_0xcf88('0x39')]];}}logger[_0xcf88('0x49')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x3b46e3[_0xcf88('0x39')],util[_0xcf88('0x33')](_0x2ed078[_0xcf88('0x1a')][_0x3b46e3[_0xcf88('0x39')]],{'showHidden':![],'depth':null}));ami[_0xcf88('0x37')](_0xcf88('0xaf'),_0x2ed078[_0xcf88('0x1a')][_0x3b46e3[_0xcf88('0x39')]]);delete _0x2ed078[_0xcf88('0x1a')][_0x3b46e3[_0xcf88('0x39')]];});}}}catch(_0x2fe32d){logger[_0xcf88('0x31')](_0xcf88('0xb0'),_0x3b46e3[_0xcf88('0x39')],util['inspect'](_0x2fe32d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcf88('0x34')][_0xcf88('0x29')]=function(_0x59de6a){try{if(this[_0xcf88('0x35')](_0x59de6a)){logger[_0xcf88('0x4c')](_0xcf88('0xb1'),_0x59de6a[_0xcf88('0x39')],_0x59de6a['origtransferercalleridnum'],_0x59de6a['transfertargetcalleridnum']);logger['debug'](_0xcf88('0xb2'),_0x59de6a[_0xcf88('0x39')],util[_0xcf88('0x33')](_0x59de6a,{'showHidden':![],'depth':null}));if(this[_0xcf88('0x1a')][_0x59de6a[_0xcf88('0xb3')]]){this[_0xcf88('0x1a')][_0x59de6a['transfereeuniqueid']]['transfercalleridnum']=_0x59de6a[_0xcf88('0xb4')];this[_0xcf88('0x1a')][_0x59de6a[_0xcf88('0xb3')]]['transferconnectedlinenum']=_0x59de6a[_0xcf88('0xb5')];if(this[_0xcf88('0x1a')][_0x59de6a[_0xcf88('0xb6')]]){var _0x2ed09a=this['channels'][_0x59de6a['secondtransfereruniqueid']];this[_0xcf88('0x1a')][_0x59de6a[_0xcf88('0xb6')]]=this[_0xcf88('0x1a')][_0x59de6a[_0xcf88('0xb3')]];this[_0xcf88('0x1a')][_0x59de6a[_0xcf88('0xb3')]]=_0x2ed09a;}}else if(this[_0xcf88('0x1a')][_0x59de6a[_0xcf88('0xb7')]]){this[_0xcf88('0x1a')][_0x59de6a[_0xcf88('0xb7')]][_0xcf88('0xb8')]=_0x59de6a['origtransferercalleridnum'];this[_0xcf88('0x1a')][_0x59de6a[_0xcf88('0xb7')]][_0xcf88('0xb9')]=_0x59de6a[_0xcf88('0xb5')];if(this[_0xcf88('0x1a')][_0x59de6a[_0xcf88('0xba')]]){var _0x2ed09a=this['channels'][_0x59de6a[_0xcf88('0xba')]];this[_0xcf88('0x1a')][_0x59de6a['origtransfereruniqueid']]=this[_0xcf88('0x1a')][_0x59de6a[_0xcf88('0xb7')]];this[_0xcf88('0x1a')][_0x59de6a['transfertargetuniqueid']]=_0x2ed09a;}}if((this[_0xcf88('0x1a')][_0x59de6a['origtransfereruniqueid']]||this['channels'][_0x59de6a['origtransfererlinkedid']])&&this[_0xcf88('0x1a')][_0x59de6a[_0xcf88('0xb6')]]){var _0xca35a0=_[_0xcf88('0xbb')]([this[_0xcf88('0x1a')][_0x59de6a[_0xcf88('0xba')]],this[_0xcf88('0x1a')][_0x59de6a['origtransfererlinkedid']],this[_0xcf88('0x1a')][_0x59de6a['secondtransfereruniqueid']]],function(_0x1fa72e){return _0x1fa72e&&_0x1fa72e['type']===_0xcf88('0xbc')&&_0x1fa72e[_0xcf88('0xbd')];});if(_0xca35a0){if(this[_0xcf88('0x1a')][_0x59de6a[_0xcf88('0xba')]])this['channels'][_0x59de6a[_0xcf88('0xba')]][_0xcf88('0xbe')]=_0xcf88('0xbf');if(this[_0xcf88('0x1a')][_0x59de6a[_0xcf88('0xc0')]])this[_0xcf88('0x1a')][_0x59de6a[_0xcf88('0xc0')]]['transferType']='ATTENDED';this[_0xcf88('0x1a')][_0x59de6a[_0xcf88('0xb6')]][_0xcf88('0xbe')]=_0xcf88('0xbf');}}}}catch(_0x1ada83){logger[_0xcf88('0x31')](_0xcf88('0xc1'),_0x59de6a['uniqueid'],util[_0xcf88('0x33')](_0x1ada83,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcf88('0x34')][_0xcf88('0xc2')]=function(_0x26cd04){try{if(this[_0xcf88('0x35')](_0x26cd04)){logger['info']('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x26cd04[_0xcf88('0x39')],_0x26cd04[_0xcf88('0xc3')],_0x26cd04[_0xcf88('0xc4')]);logger[_0xcf88('0x49')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x26cd04[_0xcf88('0x39')],util[_0xcf88('0x33')](_0x26cd04,{'showHidden':![],'depth':null}));if(this[_0xcf88('0x1a')][_0x26cd04[_0xcf88('0xb3')]]){this[_0xcf88('0x1a')][_0x26cd04[_0xcf88('0xb3')]][_0xcf88('0xb8')]=_0x26cd04[_0xcf88('0xc3')];this['channels'][_0x26cd04[_0xcf88('0xb3')]]['transferconnectedlinenum']=_0x26cd04[_0xcf88('0xc4')];this[_0xcf88('0x1a')][_0x26cd04[_0xcf88('0xb3')]]['transferType']='BLIND';this[_0xcf88('0x9b')]({'event':_0xcf88('0xae'),'uniqueid':_0x26cd04[_0xcf88('0xb3')],'context':_0x26cd04[_0xcf88('0x3f')],'channel':_0x26cd04[_0xcf88('0xc5')]});}else{this['channels'][_0x26cd04[_0xcf88('0xc6')]]['transferType']=_0xcf88('0xc7');}}}catch(_0x17b119){logger[_0xcf88('0x31')]('[%s][voiceCallReport][blindtransfer]',_0x26cd04['uniqueid'],util['inspect'](_0x17b119,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStart']=function(_0x59dfcb){try{if(this['isNotNull'](_0x59dfcb)){logger['debug'](_0xcf88('0xc8'),_0x59dfcb[_0xcf88('0x39')],util[_0xcf88('0x33')](_0x59dfcb,{'showHidden':![],'depth':null}));if(this[_0xcf88('0x1a')][_0x59dfcb[_0xcf88('0x39')]]){if(!_['isNil'](this[_0xcf88('0x1a')][_0x59dfcb['uniqueid']][_0xcf88('0x68')])){this[_0xcf88('0x1a')][_0x59dfcb['uniqueid']][_0xcf88('0xc9')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0xcf88('0x4c')](_0xcf88('0xca'),_0x59dfcb['uniqueid'],this[_0xcf88('0x1a')][_0x59dfcb[_0xcf88('0x39')]]['mohstarttime']);}}}}catch(_0x1f0f56){logger[_0xcf88('0x31')]('[%s][voiceCallReport][musiconholdstart]',_0x59dfcb['uniqueid'],util[_0xcf88('0x33')](_0x1f0f56,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xcf88('0x34')][_0xcf88('0x2e')]=function(_0x43d33e){try{if(this[_0xcf88('0x35')](_0x43d33e)){logger[_0xcf88('0x49')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x43d33e[_0xcf88('0x39')],util[_0xcf88('0x33')](_0x43d33e,{'showHidden':![],'depth':null}));if(this[_0xcf88('0x1a')][_0x43d33e[_0xcf88('0x39')]]){if(!_[_0xcf88('0x7b')](this['channels'][_0x43d33e[_0xcf88('0x39')]][_0xcf88('0xc9')])){this[_0xcf88('0x1a')][_0x43d33e[_0xcf88('0x39')]][_0xcf88('0xcb')]+=moment()[_0xcf88('0xcc')](0x0)[_0xcf88('0x6b')](this[_0xcf88('0x1a')][_0x43d33e['uniqueid']]['mohstarttime'],'seconds');logger[_0xcf88('0x4c')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x43d33e['uniqueid'],this['channels'][_0x43d33e[_0xcf88('0x39')]][_0xcf88('0xcb')]);delete this[_0xcf88('0x1a')][_0x43d33e['uniqueid']][_0xcf88('0xc9')];}}}}catch(_0x348a28){logger[_0xcf88('0x31')](_0xcf88('0xcd'),_0x43d33e[_0xcf88('0x39')],util['inspect'](_0x348a28,{'showHidden':![],'depth':null}));}};module[_0xcf88('0xce')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index f621efd..167396a 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e58=['connect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','YYYY-MM-DD\x20HH:mm:ss','duration','seconds','complete','answered','holdtime','starttime','billableseconds','diff','sumHoldTime','sumBillable','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','voice_outbound:save','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','newexten','syncNewExten','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','inspect','uniqueid','merge','format','called','substring','lastIndexOf','channel','omit','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x3e58,0x1a0));var _0x83e5=function(_0x3778d8,_0x5ce417){_0x3778d8=_0x3778d8-0x0;var _0x45a1b3=_0x3e58[_0x3778d8];return _0x45a1b3;};'use strict';var _=require('lodash');var moment=require(_0x83e5('0x0'));var util=require(_0x83e5('0x1'));var Redis=require(_0x83e5('0x2'));var config=require(_0x83e5('0x3'));var logger=require(_0x83e5('0x4'))(_0x83e5('0x5'));var ami=require('../ami');config[_0x83e5('0x6')]=_[_0x83e5('0x7')](config[_0x83e5('0x6')],{'host':_0x83e5('0x8'),'port':0x18eb});var io=require(_0x83e5('0x9'))(new Redis(config[_0x83e5('0x6')]));function VoiceDialReport(_0x47eb54){this[_0x83e5('0xa')]=_0x47eb54[_0x83e5('0xb')];this['outbound']=_0x47eb54[_0x83e5('0xc')];this[_0x83e5('0xd')]={};this[_0x83e5('0xe')]={};ami['on']('dialbegin',this[_0x83e5('0xf')][_0x83e5('0x10')](this));ami['on']('dialend',this[_0x83e5('0x11')]['bind'](this));ami['on'](_0x83e5('0x12'),this[_0x83e5('0x13')][_0x83e5('0x10')](this));ami['on'](_0x83e5('0x14'),this[_0x83e5('0x15')]['bind'](this));ami['on'](_0x83e5('0x16'),this[_0x83e5('0x17')][_0x83e5('0x10')](this));}VoiceDialReport[_0x83e5('0x18')][_0x83e5('0x19')]=function(_0xe7dd7){return _0xe7dd7!==null&&!_[_0x83e5('0x1a')](_0xe7dd7);};VoiceDialReport[_0x83e5('0x18')]['emit']=function(_0x2879aa,_0x37deed,_0x3d2ae6){io['to'](_0x2879aa)[_0x83e5('0x1b')](_0x37deed,_0x3d2ae6);};VoiceDialReport['prototype'][_0x83e5('0xf')]=function(_0x3ae14e){try{if(this[_0x83e5('0x19')](_0x3ae14e)){logger[_0x83e5('0x1c')](_0x83e5('0x1d'),_0x3ae14e['uniqueid'],util[_0x83e5('0x1e')](_0x3ae14e,{'showHidden':![],'depth':null}));if(this[_0x83e5('0xa')][_0x3ae14e[_0x83e5('0x1f')]]){_[_0x83e5('0x20')](this[_0x83e5('0xa')][_0x3ae14e[_0x83e5('0x1f')]],{'starttime':moment()[_0x83e5('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x83e5('0x22'),'interface':_0x3ae14e['channel'][_0x83e5('0x23')](0x0,_0x3ae14e['channel'][_0x83e5('0x24')]('-')),'membername':_0x3ae14e[_0x83e5('0x25')][_0x83e5('0x23')](_0x3ae14e[_0x83e5('0x25')][_0x83e5('0x24')]('/')+0x1,_0x3ae14e['channel'][_0x83e5('0x24')]('-'))},_[_0x83e5('0x26')](_0x3ae14e,['event',_0x83e5('0x27')]));logger[_0x83e5('0x28')](_0x83e5('0x29'),_0x3ae14e[_0x83e5('0x1f')],this[_0x83e5('0xa')][_0x3ae14e['uniqueid']][_0x83e5('0x2a')],this['channels'][_0x3ae14e[_0x83e5('0x1f')]][_0x83e5('0x2b')]);logger[_0x83e5('0x1c')](_0x83e5('0x2c'),_0x3ae14e[_0x83e5('0x1f')],util['inspect'](this[_0x83e5('0xa')][_0x3ae14e[_0x83e5('0x1f')]],{'showHidden':![],'depth':null}));if(this[_0x83e5('0xd')][_0x3ae14e[_0x83e5('0x1f')]])_[_0x83e5('0x20')](this[_0x83e5('0xa')][_0x3ae14e['uniqueid']],this[_0x83e5('0xd')][_0x3ae14e['uniqueid']]);this[_0x83e5('0x1b')](_0x83e5('0x2d'),_0x83e5('0x2e'),this['channels'][_0x3ae14e[_0x83e5('0x1f')]]);logger['debug'](_0x83e5('0x2f'),_0x3ae14e['uniqueid'],util[_0x83e5('0x1e')](this[_0x83e5('0xa')][_0x3ae14e[_0x83e5('0x1f')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialbegin',this[_0x83e5('0xa')][_0x3ae14e[_0x83e5('0x1f')]]);}}}catch(_0x37b865){logger[_0x83e5('0x30')](_0x83e5('0x31'),_0x3ae14e[_0x83e5('0x1f')],util[_0x83e5('0x1e')](_0x37b865,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x83e5('0x11')]=function(_0x545142){try{if(this[_0x83e5('0x19')](_0x545142)){logger['debug']('[%s][voiceDialReport][dialend]\x20event:',_0x545142['uniqueid'],util[_0x83e5('0x1e')](_0x545142,{'showHidden':![],'depth':null}));if(this[_0x83e5('0xa')][_0x545142['uniqueid']]){this['channels'][_0x545142[_0x83e5('0x1f')]]['dialstatus']=_0x545142[_0x83e5('0x32')];if(_0x545142[_0x83e5('0x32')]===_0x83e5('0x33')){this[_0x83e5('0xa')][_0x545142[_0x83e5('0x1f')]][_0x83e5('0x34')]=_0x545142[_0x83e5('0x34')];this[_0x83e5('0xa')][_0x545142[_0x83e5('0x1f')]][_0x83e5('0x35')]=_0x545142[_0x83e5('0x35')];this[_0x83e5('0xa')][_0x545142[_0x83e5('0x1f')]][_0x83e5('0x36')]=moment()[_0x83e5('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x545142[_0x83e5('0x1f')]][_0x83e5('0x37')]=_0x83e5('0x38');logger[_0x83e5('0x28')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x545142['uniqueid'],_0x545142[_0x83e5('0x25')][_0x83e5('0x23')](_0x545142['channel'][_0x83e5('0x24')]('/')+0x1,_0x545142[_0x83e5('0x25')]['lastIndexOf']('-')));logger[_0x83e5('0x1c')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x545142[_0x83e5('0x1f')],util['inspect'](this['channels'][_0x545142[_0x83e5('0x1f')]],{'showHidden':![],'depth':null}));ami[_0x83e5('0x1b')]('custom:dialconnect',this[_0x83e5('0xa')][_0x545142[_0x83e5('0x1f')]]);}logger[_0x83e5('0x1c')](_0x83e5('0x39'),_0x545142['uniqueid'],util[_0x83e5('0x1e')](this[_0x83e5('0xa')][_0x545142[_0x83e5('0x1f')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x83e5('0x2e'),this[_0x83e5('0xa')][_0x545142['uniqueid']]);}}}catch(_0x144add){logger[_0x83e5('0x30')]('[%s][voiceDialReport][dialend]',_0x545142[_0x83e5('0x1f')],util['inspect'](_0x144add,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x83e5('0x13')]=function(_0x5328b0){try{if(this['isNotNull'](_0x5328b0)){logger['debug'](_0x83e5('0x3a'),_0x5328b0[_0x83e5('0x1f')],util['inspect'](_0x5328b0,{'showHidden':![],'depth':null}));this[_0x83e5('0x3b')](_0x5328b0[_0x83e5('0x1f')],_[_0x83e5('0x3c')](_0x5328b0[_0x83e5('0x3d')])[0x0],_0x5328b0[_0x83e5('0x3e')]);if(this['isNotNull'](_0x5328b0['variable'])&&this['isNotNull'](_0x5328b0[_0x83e5('0x3d')][_0x83e5('0x3f')])){if(_[_0x83e5('0x1a')](this['channels'][_0x5328b0[_0x83e5('0x1f')]])){this[_0x83e5('0xa')][_0x5328b0['uniqueid']]={'routeId':_0x5328b0[_0x83e5('0x3e')],'variables':this[_0x83e5('0xe')][_0x5328b0[_0x83e5('0x1f')]],'motionChannel':_0x83e5('0x40')};logger[_0x83e5('0x28')](_0x83e5('0x41'),_0x5328b0[_0x83e5('0x1f')],_0x5328b0[_0x83e5('0x3d')][_0x83e5('0x3f')],_['keys'](_0x5328b0[_0x83e5('0x3d')])[0x0],_0x5328b0[_0x83e5('0x3e')]);logger[_0x83e5('0x1c')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x5328b0[_0x83e5('0x1f')],util[_0x83e5('0x1e')](this['channels'][_0x5328b0[_0x83e5('0x1f')]],{'showHidden':![],'depth':null}));this[_0x83e5('0x1b')](_0x83e5('0x2d'),_0x83e5('0x2e'),this[_0x83e5('0xa')][_0x5328b0['uniqueid']]);}}}}catch(_0x30db94){logger['error']('[%s][voiceDialReport][varset]',_0x5328b0[_0x83e5('0x1f')],util['inspect'](_0x30db94,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x83e5('0x18')][_0x83e5('0x3b')]=function(_0x12e419,_0x30f7ee,_0x339ff4){var _0xef5d15=['rtpaudioqos',_0x83e5('0x42'),_0x83e5('0x43'),_0x83e5('0x44'),'rtpaudioqosloss',_0x83e5('0x45'),_0x83e5('0x46'),_0x83e5('0x47'),_0x83e5('0x48'),_0x83e5('0x49'),'bridgepeer',_0x83e5('0x4a'),_0x83e5('0x4b'),_0x83e5('0x4c'),_0x83e5('0x4d'),_0x83e5('0x4e'),_0x83e5('0x2a'),_0x83e5('0x4f'),_0x83e5('0x50')];if(!_['isNil'](_0x30f7ee)&&!_['includes'](_0xef5d15,_0x30f7ee)){if(_['isUndefined'](this[_0x83e5('0xe')][_0x12e419])){this[_0x83e5('0xe')][_0x12e419]={};}this[_0x83e5('0xe')][_0x12e419][_0x30f7ee]=_0x339ff4;}};VoiceDialReport['prototype'][_0x83e5('0x17')]=function(_0x9271a1){try{if(this[_0x83e5('0x19')](_0x9271a1)){logger[_0x83e5('0x1c')](_0x83e5('0x51'),_0x9271a1[_0x83e5('0x1f')],util['inspect'](_0x9271a1,{'showHidden':![],'depth':null}));if(this[_0x83e5('0xa')][_0x9271a1['uniqueid']]){logger[_0x83e5('0x28')](_0x83e5('0x52'),_0x9271a1['uniqueid'],_0x9271a1[_0x83e5('0x53')]);this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x54')]=moment()[_0x83e5('0x21')](_0x83e5('0x55'));this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x56')]=moment(this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x54')])['diff'](this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]]['starttime'],_0x83e5('0x57'));this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]]['lastevent']=_0x83e5('0x58');this[_0x83e5('0xc')]['total']+=0x1;if(this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x36')]){this['outbound'][_0x83e5('0x59')]+=0x1;this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x5a')]=moment(this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]]['answertime'])['diff'](this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x5b')],'seconds');this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x5c')]=moment(this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x54')])[_0x83e5('0x5d')](this[_0x83e5('0xa')][_0x9271a1['uniqueid']][_0x83e5('0x36')],_0x83e5('0x57'));this[_0x83e5('0xc')][_0x83e5('0x5e')]+=this[_0x83e5('0xa')][_0x9271a1['uniqueid']][_0x83e5('0x5a')]||0x0;this[_0x83e5('0xc')][_0x83e5('0x5f')]+=this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]][_0x83e5('0x5c')];}this[_0x83e5('0xc')]['sumDuration']+=this[_0x83e5('0xa')][_0x9271a1['uniqueid']][_0x83e5('0x56')];logger[_0x83e5('0x1c')](_0x83e5('0x60'),_0x9271a1[_0x83e5('0x1f')],util[_0x83e5('0x1e')](this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]],{'showHidden':![],'depth':null}));ami[_0x83e5('0x1b')](_0x83e5('0x61'),this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]]);logger[_0x83e5('0x1c')](_0x83e5('0x62'),_0x9271a1[_0x83e5('0x1f')],util['inspect'](this[_0x83e5('0xa')][_0x9271a1['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x83e5('0x1b')]('custom:dialend',this[_0x83e5('0xa')][_0x9271a1['uniqueid']]);logger[_0x83e5('0x1c')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x9271a1[_0x83e5('0x1f')],util[_0x83e5('0x1e')](this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x83e5('0x63'),this['outbound']);logger[_0x83e5('0x28')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x83e5('0x64')](this['channels'][_0x9271a1['uniqueid']]));logger[_0x83e5('0x1c')](_0x83e5('0x65'),_0x9271a1[_0x83e5('0x1f')],util['inspect'](this['channels'][_0x9271a1[_0x83e5('0x1f')]],{'showHidden':![],'depth':null}));this[_0x83e5('0x1b')](_0x83e5('0x2d'),_0x83e5('0x66'),this['channels'][_0x9271a1['uniqueid']]);delete this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x1f')]];}else if(this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x67')]]){this[_0x83e5('0xa')][_0x9271a1[_0x83e5('0x67')]]['uniqueid']=this['channels'][_0x9271a1[_0x83e5('0x67')]][_0x83e5('0x68')];}if(this[_0x83e5('0xe')][_0x9271a1[_0x83e5('0x1f')]]){delete this[_0x83e5('0xe')][_0x9271a1[_0x83e5('0x1f')]];}}}catch(_0x2082e8){logger[_0x83e5('0x30')](_0x83e5('0x69'),_0x9271a1[_0x83e5('0x1f')],util['inspect'](_0x2082e8,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncNewExten']=function(_0x56f950){try{if(this[_0x83e5('0x19')](_0x56f950)){logger['debug'](_0x83e5('0x6a'),_0x56f950[_0x83e5('0x1f')],util[_0x83e5('0x1e')](_0x56f950,{'showHidden':![],'depth':null}));if(_0x56f950[_0x83e5('0x6b')][_0x83e5('0x6c')]()===_0x83e5('0x6d')){_0x56f950[_0x83e5('0x6e')]=(_0x56f950[_0x83e5('0x6f')]||_0x56f950[_0x83e5('0x6e')])[_0x83e5('0x6c')]();if(_[_0x83e5('0x70')](_0x56f950['applicationdata'],'cdr(')){if(_[_0x83e5('0x1a')](this[_0x83e5('0xd')][_0x56f950[_0x83e5('0x1f')]]))this[_0x83e5('0xd')][_0x56f950['uniqueid']]={};logger[_0x83e5('0x28')](_0x83e5('0x71'),_0x56f950[_0x83e5('0x1f')],_0x56f950[_0x83e5('0x6b')],_0x56f950[_0x83e5('0x6e')]);var _0x180827=_0x56f950[_0x83e5('0x6e')][_0x83e5('0x72')]('=');var _0x30a0e4=_0x180827[0x0][_0x83e5('0x73')](/cdr\((.*)\)/);if(_0x30a0e4)this['applications'][_0x56f950['uniqueid']][_0x30a0e4[0x1]]=_0x180827[0x1];}}}}catch(_0x408e64){logger['error'](_0x83e5('0x74'),_0x56f950[_0x83e5('0x1f')],util[_0x83e5('0x1e')](_0x408e64,{'showHidden':![],'depth':null}));}};module[_0x83e5('0x75')]=VoiceDialReport; \ No newline at end of file +var _0xc214=['[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinename','answertime','lastevent','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','keys','variable','outboundrouteid','isUndefined','value','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','format','seconds','total','diff','billableseconds','sumHoldTime','sumDuration','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','stringify','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','moment','util','../../../config/environment','redis','defaults','localhost','channels','outboundChannels','outbound','applications','variables','syncDialBegin','dialend','syncDialEnd','bind','varset','syncVarSet','newexten','syncNewExten','syncHangup','isNotNull','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','substring','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error'];(function(_0x59e165,_0x237e36){var _0x375706=function(_0x49f59c){while(--_0x49f59c){_0x59e165['push'](_0x59e165['shift']());}};_0x375706(++_0x237e36);}(_0xc214,0xb1));var _0x4c21=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc214[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var moment=require(_0x4c21('0x0'));var util=require(_0x4c21('0x1'));var Redis=require('ioredis');var config=require(_0x4c21('0x2'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');config[_0x4c21('0x3')]=_[_0x4c21('0x4')](config[_0x4c21('0x3')],{'host':_0x4c21('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4c21('0x3')]));function VoiceDialReport(_0x5e8bc5){this[_0x4c21('0x6')]=_0x5e8bc5[_0x4c21('0x7')];this[_0x4c21('0x8')]=_0x5e8bc5[_0x4c21('0x8')];this[_0x4c21('0x9')]={};this[_0x4c21('0xa')]={};ami['on']('dialbegin',this[_0x4c21('0xb')]['bind'](this));ami['on'](_0x4c21('0xc'),this[_0x4c21('0xd')][_0x4c21('0xe')](this));ami['on'](_0x4c21('0xf'),this[_0x4c21('0x10')][_0x4c21('0xe')](this));ami['on'](_0x4c21('0x11'),this[_0x4c21('0x12')][_0x4c21('0xe')](this));ami['on']('hangup',this[_0x4c21('0x13')][_0x4c21('0xe')](this));}VoiceDialReport['prototype'][_0x4c21('0x14')]=function(_0x2dad2b){return _0x2dad2b!==null&&!_['isUndefined'](_0x2dad2b);};VoiceDialReport[_0x4c21('0x15')]['emit']=function(_0x20642d,_0xb80ef2,_0x4617c0){io['to'](_0x20642d)[_0x4c21('0x16')](_0xb80ef2,_0x4617c0);};VoiceDialReport[_0x4c21('0x15')][_0x4c21('0xb')]=function(_0xc4ace1){try{if(this[_0x4c21('0x14')](_0xc4ace1)){logger[_0x4c21('0x17')](_0x4c21('0x18'),_0xc4ace1[_0x4c21('0x19')],util[_0x4c21('0x1a')](_0xc4ace1,{'showHidden':![],'depth':null}));if(this[_0x4c21('0x6')][_0xc4ace1[_0x4c21('0x19')]]){_[_0x4c21('0x1b')](this['channels'][_0xc4ace1[_0x4c21('0x19')]],{'starttime':moment()['format'](_0x4c21('0x1c')),'lastevent':'called','interface':_0xc4ace1[_0x4c21('0x1d')]['substring'](0x0,_0xc4ace1[_0x4c21('0x1d')][_0x4c21('0x1e')]('-')),'membername':_0xc4ace1[_0x4c21('0x1d')][_0x4c21('0x1f')](_0xc4ace1[_0x4c21('0x1d')]['lastIndexOf']('/')+0x1,_0xc4ace1[_0x4c21('0x1d')][_0x4c21('0x1e')]('-'))},_[_0x4c21('0x20')](_0xc4ace1,[_0x4c21('0x21'),_0x4c21('0x22')]));logger['info'](_0x4c21('0x23'),_0xc4ace1[_0x4c21('0x19')],this['channels'][_0xc4ace1[_0x4c21('0x19')]][_0x4c21('0x24')],this[_0x4c21('0x6')][_0xc4ace1[_0x4c21('0x19')]][_0x4c21('0x25')]);logger[_0x4c21('0x17')](_0x4c21('0x26'),_0xc4ace1[_0x4c21('0x19')],util[_0x4c21('0x1a')](this[_0x4c21('0x6')][_0xc4ace1[_0x4c21('0x19')]],{'showHidden':![],'depth':null}));if(this[_0x4c21('0x9')][_0xc4ace1['uniqueid']])_['merge'](this[_0x4c21('0x6')][_0xc4ace1[_0x4c21('0x19')]],this[_0x4c21('0x9')][_0xc4ace1[_0x4c21('0x19')]]);this[_0x4c21('0x16')](_0x4c21('0x27'),_0x4c21('0x28'),this[_0x4c21('0x6')][_0xc4ace1[_0x4c21('0x19')]]);logger[_0x4c21('0x17')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0xc4ace1[_0x4c21('0x19')],util[_0x4c21('0x1a')](this['channels'][_0xc4ace1[_0x4c21('0x19')]],{'showHidden':![],'depth':null}));ami[_0x4c21('0x16')](_0x4c21('0x29'),this[_0x4c21('0x6')][_0xc4ace1[_0x4c21('0x19')]]);}}}catch(_0x5b3075){logger[_0x4c21('0x2a')](_0x4c21('0x2b'),_0xc4ace1[_0x4c21('0x19')],util[_0x4c21('0x1a')](_0x5b3075,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x4c21('0xd')]=function(_0x3cfbf4){try{if(this[_0x4c21('0x14')](_0x3cfbf4)){logger[_0x4c21('0x17')](_0x4c21('0x2c'),_0x3cfbf4['uniqueid'],util[_0x4c21('0x1a')](_0x3cfbf4,{'showHidden':![],'depth':null}));if(this[_0x4c21('0x6')][_0x3cfbf4[_0x4c21('0x19')]]){this[_0x4c21('0x6')][_0x3cfbf4[_0x4c21('0x19')]][_0x4c21('0x2d')]=_0x3cfbf4[_0x4c21('0x2d')];if(_0x3cfbf4[_0x4c21('0x2d')]==='ANSWER'){this['channels'][_0x3cfbf4[_0x4c21('0x19')]]['connectedlinenum']=_0x3cfbf4['connectedlinenum'];this[_0x4c21('0x6')][_0x3cfbf4['uniqueid']][_0x4c21('0x2e')]=_0x3cfbf4[_0x4c21('0x2e')];this[_0x4c21('0x6')][_0x3cfbf4[_0x4c21('0x19')]][_0x4c21('0x2f')]=moment()['format'](_0x4c21('0x1c'));this[_0x4c21('0x6')][_0x3cfbf4['uniqueid']][_0x4c21('0x30')]='connect';logger[_0x4c21('0x31')](_0x4c21('0x32'),_0x3cfbf4['uniqueid'],_0x3cfbf4[_0x4c21('0x1d')][_0x4c21('0x1f')](_0x3cfbf4[_0x4c21('0x1d')][_0x4c21('0x1e')]('/')+0x1,_0x3cfbf4[_0x4c21('0x1d')]['lastIndexOf']('-')));logger[_0x4c21('0x17')](_0x4c21('0x33'),_0x3cfbf4[_0x4c21('0x19')],util[_0x4c21('0x1a')](this[_0x4c21('0x6')][_0x3cfbf4['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x4c21('0x16')](_0x4c21('0x34'),this[_0x4c21('0x6')][_0x3cfbf4['uniqueid']]);}logger[_0x4c21('0x17')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x3cfbf4[_0x4c21('0x19')],util[_0x4c21('0x1a')](this['channels'][_0x3cfbf4['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x4c21('0x27'),_0x4c21('0x28'),this[_0x4c21('0x6')][_0x3cfbf4['uniqueid']]);}}}catch(_0x3a4bb4){logger['error'](_0x4c21('0x35'),_0x3cfbf4[_0x4c21('0x19')],util['inspect'](_0x3a4bb4,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x4c21('0x10')]=function(_0x579223){try{if(this[_0x4c21('0x14')](_0x579223)){logger['debug'](_0x4c21('0x36'),_0x579223[_0x4c21('0x19')],util[_0x4c21('0x1a')](_0x579223,{'showHidden':![],'depth':null}));this['addVariable'](_0x579223[_0x4c21('0x19')],_[_0x4c21('0x37')](_0x579223[_0x4c21('0x38')])[0x0],_0x579223['value']);if(this[_0x4c21('0x14')](_0x579223[_0x4c21('0x38')])&&this[_0x4c21('0x14')](_0x579223['variable'][_0x4c21('0x39')])){if(_[_0x4c21('0x3a')](this['channels'][_0x579223[_0x4c21('0x19')]])){this[_0x4c21('0x6')][_0x579223['uniqueid']]={'routeId':_0x579223[_0x4c21('0x3b')],'variables':this[_0x4c21('0xa')][_0x579223[_0x4c21('0x19')]],'motionChannel':_0x4c21('0x3c')};logger[_0x4c21('0x31')](_0x4c21('0x3d'),_0x579223[_0x4c21('0x19')],_0x579223['variable']['outboundrouteid'],_[_0x4c21('0x37')](_0x579223[_0x4c21('0x38')])[0x0],_0x579223['value']);logger[_0x4c21('0x17')](_0x4c21('0x3e'),_0x579223[_0x4c21('0x19')],util[_0x4c21('0x1a')](this['channels'][_0x579223[_0x4c21('0x19')]],{'showHidden':![],'depth':null}));this[_0x4c21('0x16')](_0x4c21('0x27'),_0x4c21('0x28'),this['channels'][_0x579223[_0x4c21('0x19')]]);}}}}catch(_0x3b5354){logger['error']('[%s][voiceDialReport][varset]',_0x579223[_0x4c21('0x19')],util[_0x4c21('0x1a')](_0x3b5354,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x5c5a18,_0x42933a,_0x15b671){var _0x320d71=['rtpaudioqos',_0x4c21('0x3f'),_0x4c21('0x40'),'rtpaudioqosjitterbridged',_0x4c21('0x41'),_0x4c21('0x42'),'rtpaudioqosrtt',_0x4c21('0x43'),_0x4c21('0x44'),_0x4c21('0x45'),'bridgepeer',_0x4c21('0x46'),'membercalls',_0x4c21('0x47'),_0x4c21('0x48'),_0x4c21('0x49'),_0x4c21('0x24'),'memberpenalty',_0x4c21('0x4a')];if(!_[_0x4c21('0x4b')](_0x42933a)&&!_[_0x4c21('0x4c')](_0x320d71,_0x42933a)){if(_[_0x4c21('0x3a')](this[_0x4c21('0xa')][_0x5c5a18])){this[_0x4c21('0xa')][_0x5c5a18]={};}this['variables'][_0x5c5a18][_0x42933a]=_0x15b671;}};VoiceDialReport[_0x4c21('0x15')][_0x4c21('0x13')]=function(_0x2cb1cd){try{if(this[_0x4c21('0x14')](_0x2cb1cd)){logger[_0x4c21('0x17')]('[%s][voiceDialReport][hangup]\x20event:',_0x2cb1cd['uniqueid'],util[_0x4c21('0x1a')](_0x2cb1cd,{'showHidden':![],'depth':null}));if(this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x19')]]){logger['info'](_0x4c21('0x4d'),_0x2cb1cd['uniqueid'],_0x2cb1cd[_0x4c21('0x4e')]);this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x19')]][_0x4c21('0x4f')]=moment()[_0x4c21('0x50')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4c21('0x6')][_0x2cb1cd['uniqueid']]['duration']=moment(this[_0x4c21('0x6')][_0x2cb1cd['uniqueid']][_0x4c21('0x4f')])['diff'](this[_0x4c21('0x6')][_0x2cb1cd['uniqueid']]['starttime'],_0x4c21('0x51'));this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x19')]][_0x4c21('0x30')]='complete';this[_0x4c21('0x8')][_0x4c21('0x52')]+=0x1;if(this['channels'][_0x2cb1cd[_0x4c21('0x19')]][_0x4c21('0x2f')]){this['outbound']['answered']+=0x1;this[_0x4c21('0x6')][_0x2cb1cd['uniqueid']]['holdtime']=moment(this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x19')]]['answertime'])[_0x4c21('0x53')](this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x19')]]['starttime'],'seconds');this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x19')]][_0x4c21('0x54')]=moment(this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x19')]][_0x4c21('0x4f')])['diff'](this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x19')]]['answertime'],_0x4c21('0x51'));this['outbound'][_0x4c21('0x55')]+=this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x19')]]['holdtime']||0x0;this[_0x4c21('0x8')]['sumBillable']+=this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x19')]][_0x4c21('0x54')];}this[_0x4c21('0x8')][_0x4c21('0x56')]+=this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x19')]][_0x4c21('0x57')];logger[_0x4c21('0x17')](_0x4c21('0x58'),_0x2cb1cd[_0x4c21('0x19')],util[_0x4c21('0x1a')](this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x19')]],{'showHidden':![],'depth':null}));ami[_0x4c21('0x16')](_0x4c21('0x59'),this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x19')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x2cb1cd[_0x4c21('0x19')],util[_0x4c21('0x1a')](this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x19')]],{'showHidden':![],'depth':null}));ami[_0x4c21('0x16')](_0x4c21('0x5a'),this['channels'][_0x2cb1cd[_0x4c21('0x19')]]);logger[_0x4c21('0x17')](_0x4c21('0x5b'),_0x2cb1cd[_0x4c21('0x19')],util['inspect'](this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x19')]],{'showHidden':![],'depth':null}));this[_0x4c21('0x16')]('voice:outbound','voice_outbound:save',this['outbound']);logger['info']('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x4c21('0x5c')](this['channels'][_0x2cb1cd['uniqueid']]));logger[_0x4c21('0x17')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x2cb1cd[_0x4c21('0x19')],util[_0x4c21('0x1a')](this['channels'][_0x2cb1cd['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x4c21('0x27'),_0x4c21('0x5d'),this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x19')]]);delete this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x19')]];}else if(this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x5e')]]){this[_0x4c21('0x6')][_0x2cb1cd[_0x4c21('0x5e')]][_0x4c21('0x19')]=this[_0x4c21('0x6')][_0x2cb1cd['linkedid']][_0x4c21('0x5f')];}if(this[_0x4c21('0xa')][_0x2cb1cd['uniqueid']]){delete this['variables'][_0x2cb1cd[_0x4c21('0x19')]];}}}catch(_0x1de551){logger[_0x4c21('0x2a')](_0x4c21('0x60'),_0x2cb1cd[_0x4c21('0x19')],util[_0x4c21('0x1a')](_0x1de551,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4c21('0x15')][_0x4c21('0x12')]=function(_0x484205){try{if(this['isNotNull'](_0x484205)){logger[_0x4c21('0x17')](_0x4c21('0x61'),_0x484205[_0x4c21('0x19')],util[_0x4c21('0x1a')](_0x484205,{'showHidden':![],'depth':null}));if(_0x484205[_0x4c21('0x62')][_0x4c21('0x63')]()===_0x4c21('0x64')){_0x484205[_0x4c21('0x65')]=(_0x484205[_0x4c21('0x66')]||_0x484205[_0x4c21('0x65')])[_0x4c21('0x63')]();if(_[_0x4c21('0x67')](_0x484205['applicationdata'],_0x4c21('0x68'))){if(_['isUndefined'](this[_0x4c21('0x9')][_0x484205['uniqueid']]))this[_0x4c21('0x9')][_0x484205[_0x4c21('0x19')]]={};logger['info'](_0x4c21('0x69'),_0x484205['uniqueid'],_0x484205[_0x4c21('0x62')],_0x484205[_0x4c21('0x65')]);var _0x10e683=_0x484205[_0x4c21('0x65')][_0x4c21('0x6a')]('=');var _0x2e03ed=_0x10e683[0x0][_0x4c21('0x6b')](/cdr\((.*)\)/);if(_0x2e03ed)this[_0x4c21('0x9')][_0x484205[_0x4c21('0x19')]][_0x2e03ed[0x1]]=_0x10e683[0x1];}}}}catch(_0x110507){logger[_0x4c21('0x2a')](_0x4c21('0x6c'),_0x484205[_0x4c21('0x19')],util['inspect'](_0x110507,{'showHidden':![],'depth':null}));}};module[_0x4c21('0x6d')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index f65aeed..1c6fe9d 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffdc=['callers','toNumber','loggedIn','loggedin','available','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','push','emitVoiceQueueChannelSave','[%s][voiceQueueReport][queuecallerabandon]','queuecallercomplete','queuecallercompleteAt','originalposition','queuecallerabandonAt','lastAssignedTo','[%s][voiceQueueReport][queuecallerleave]','last','queuecallerleaveAt','connectedlinenum','connectedlinename','syncAgentConnect','[%s][voiceQueueReport][agentconnect]','queuecallerexitreason','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','holdtime','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','channel','toLowerCase','local/','linkedid','seconds','FORWARDTRANSFER','FORWARD','transferexten','destexten','transferuniqueid','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','queuestatus','CONTINUE','TIMEOUT','lastevent','timeout','custom:timeout','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberpenalty','isNil','includes','[%s][voiceQueueReport][hangup]','length','diff','milliseconds','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','secondtransfererexten','ATTENDEDTRANSFER','transfertype','secondtransfereruniqueid','transfereeuniqueid','transfertargetuniqueid','origtransfererexten','ATTENDED','origtransfereruniqueid','[%s][voiceQueueReport][attendedtransfer]','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','set','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','application','split','[%s][voiceQueueReport][newexten]','exports','lodash','moment','md5','ioredis','../../../config/logger','ami','../ami','../model/queueReport','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','agents','channels','queueChannels','flagQueueSummary','campaigns','queuesummary','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','bind','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','varset','syncVarSet','hangup','syncHangup','fullybooted','newexten','syncNewExten','musiconholdstart','syncMusicOnHoldStart','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','originated','talking','waiting','queueStatusComplete','clearZombieChannels','switch','Action','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','queueReports','[%s][voiceQueueReport][checkQueueReport]','inspect','variables','[%s][voiceQueueReport][checkVariables]','syncFullyBooted','[FullyBooted]\x20clear\x20realtime','clearQueueReport','hasOwnProperty','emitVoiceQueueChannelRemove','emit','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','voice:queue:%s','name','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','strategy','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','Trunk','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','queues','catch','[voiceQueueReport][queues]','then','[voiceQueueReport][queuesummary]','syncQueueSummary','isNotNull','queue','[voiceQueueReport][queuesummary]\x20event:','voiceQueues','[voiceQueueReport][queuesummary]\x20name:%s'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0xffdc,0x7f));var _0xcffd=function(_0x3be82b,_0x3ef4fb){_0x3be82b=_0x3be82b-0x0;var _0x293c0e=_0xffdc[_0x3be82b];return _0x293c0e;};'use strict';var _=require(_0xcffd('0x0'));var moment=require(_0xcffd('0x1'));var util=require('util');var md5=require(_0xcffd('0x2'));var Redis=require(_0xcffd('0x3'));var config=require('../../../config/environment');var logger=require(_0xcffd('0x4'))(_0xcffd('0x5'));var ami=require(_0xcffd('0x6'));var QueueReport=require(_0xcffd('0x7'));config[_0xcffd('0x8')]=_['defaults'](config[_0xcffd('0x8')],{'host':_0xcffd('0x9'),'port':0x18eb});var io=require(_0xcffd('0xa'))(new Redis(config[_0xcffd('0x8')]));var Sequence=function(){};Sequence[_0xcffd('0xb')][_0xcffd('0xc')]=function(_0x552fa7){this[_0xcffd('0xd')]=this[_0xcffd('0xd')]?this['tail'][_0xcffd('0xe')](_0x552fa7):_0x552fa7();};function VoiceQueueReport(_0x2fa32d){this[_0xcffd('0xf')]=new Sequence();this['queueReports']={};this[_0xcffd('0x10')]=_0x2fa32d[_0xcffd('0x10')];this[_0xcffd('0x11')]=_0x2fa32d[_0xcffd('0x12')];this['voiceQueues']=_0x2fa32d['voiceQueues'];this[_0xcffd('0x13')]=!![];this[_0xcffd('0x14')]=_0x2fa32d[_0xcffd('0x14')];this['variables']={};ami['on'](_0xcffd('0x15'),this['syncQueueSummary']['bind'](this));ami['on'](_0xcffd('0x16'),this[_0xcffd('0x17')]['bind'](this));ami['on'](_0xcffd('0x18'),this[_0xcffd('0x19')][_0xcffd('0x1a')](this));ami['on'](_0xcffd('0x1b'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xcffd('0x1c'),this[_0xcffd('0x1d')][_0xcffd('0x1a')](this));ami['on'](_0xcffd('0x1e'),this[_0xcffd('0x1f')]['bind'](this));ami['on'](_0xcffd('0x20'),this['syncAgentConnect'][_0xcffd('0x1a')](this));ami['on'](_0xcffd('0x21'),this[_0xcffd('0x22')][_0xcffd('0x1a')](this));ami['on'](_0xcffd('0x23'),this[_0xcffd('0x24')][_0xcffd('0x1a')](this));ami['on'](_0xcffd('0x25'),this['syncFullyBooted'][_0xcffd('0x1a')](this));ami['on'](_0xcffd('0x26'),this[_0xcffd('0x27')][_0xcffd('0x1a')](this));ami['on'](_0xcffd('0x28'),this[_0xcffd('0x29')][_0xcffd('0x1a')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0xcffd('0x1a')](this));ami['on'](_0xcffd('0x2a'),this[_0xcffd('0x2b')][_0xcffd('0x1a')](this));ami['on'](_0xcffd('0x2c'),this[_0xcffd('0x2d')][_0xcffd('0x1a')](this));this[_0xcffd('0x2e')]();this[_0xcffd('0x2f')]();}function clearChannels(_0x19e0d9){if(!_[_0xcffd('0x30')](_0x19e0d9)){for(var _0x1f232a in _0x19e0d9){if(_0x19e0d9['hasOwnProperty'](_0x1f232a)){delete _0x19e0d9[_0x1f232a];}}}}function clearCampaigns(_0x102f93){if(!_[_0xcffd('0x30')](_0x102f93)){for(var _0x2c66a7 in _0x102f93){if(_0x102f93['hasOwnProperty'](_0x2c66a7)){_0x102f93[_0x2c66a7][_0xcffd('0x31')]=0x0;}}}}function clearVoiceQueues(_0x9840b2){if(!_[_0xcffd('0x30')](_0x9840b2)){for(var _0x5d0859 in _0x9840b2){if(_0x9840b2['hasOwnProperty'](_0x5d0859)){_0x9840b2[_0x5d0859][_0xcffd('0x31')]=0x0;_0x9840b2[_0x5d0859][_0xcffd('0x32')]=0x0;_0x9840b2[_0x5d0859]['pTalking']=0x0;_0x9840b2[_0x5d0859][_0xcffd('0x33')]=0x0;_0x9840b2[_0x5d0859][_0xcffd('0x34')]=!![];}}}}function clearAgentBooked(_0x5a97cf){if(!_[_0xcffd('0x30')](_0x5a97cf)){for(var _0x3ab051 in _0x5a97cf){if(_0x5a97cf['hasOwnProperty'](_0x3ab051)){_0x5a97cf[_0x3ab051]['unlockRR']=!![];}}}}VoiceQueueReport[_0xcffd('0xb')][_0xcffd('0x35')]=function(){var _0x318cdf=this;for(var _0x5eea07 in this[_0xcffd('0x11')]){if(this[_0xcffd('0x11')]['hasOwnProperty'](_0x5eea07)&&!this[_0xcffd('0x11')][_0x5eea07][_0xcffd('0x36')]){this['sequence'][_0xcffd('0xc')](function(){if(!_['isNil'](_0x318cdf[_0xcffd('0x11')][_0x5eea07])){return ami[_0xcffd('0x37')]({'action':'status','channel':_0x318cdf[_0xcffd('0x11')][_0x5eea07]['channel']})['catch'](function(_0x15549b){if(_0x15549b[_0xcffd('0x38')]===_0xcffd('0x39')){setTimeout(function(){if(_0x318cdf['channels'][_0x5eea07]){delete _0x318cdf['channels'][_0x5eea07];logger[_0xcffd('0x3a')](_0xcffd('0x3b'),_0x5eea07,util['inspect'](_0x15549b,{'showHidden':![],'depth':null}));}if(_0x318cdf['queueReports'][_0x5eea07]){delete _0x318cdf[_0xcffd('0x3c')][_0x5eea07];logger['error'](_0xcffd('0x3d'),_0x5eea07,util[_0xcffd('0x3e')](_0x15549b,{'showHidden':![],'depth':null}));}if(_0x318cdf[_0xcffd('0x3f')][_0x5eea07]){delete _0x318cdf[_0xcffd('0x3f')][_0x5eea07];logger[_0xcffd('0x3a')](_0xcffd('0x40'),_0x5eea07,util['inspect'](_0x15549b,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xcffd('0xb')][_0xcffd('0x41')]=function(){logger[_0xcffd('0x3a')](_0xcffd('0x42'));clearChannels(this[_0xcffd('0x11')]);this[_0xcffd('0x43')](this['queueReports']);clearAgentBooked(this[_0xcffd('0x10')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0xcffd('0x14')]);};VoiceQueueReport['prototype'][_0xcffd('0x43')]=function(_0x408fc6){var _0xa94299=this;if(!_[_0xcffd('0x30')](_0x408fc6)){for(var _0x22eb39 in _0x408fc6){if(_0x408fc6[_0xcffd('0x44')](_0x22eb39)){_0xa94299[_0xcffd('0x45')](_0x408fc6[_0x22eb39],'clearqueuereport');delete _0x408fc6[_0x22eb39];}}}};VoiceQueueReport[_0xcffd('0xb')][_0xcffd('0x46')]=function(_0x10dc5b,_0x53823e,_0x125438){io['to'](_0x10dc5b)[_0xcffd('0x46')](_0x53823e,_0x125438);};VoiceQueueReport[_0xcffd('0xb')]['emitVoiceQueueChannelSave']=function(_0x5bb460,_0x5160e6){logger[_0xcffd('0x47')](_0xcffd('0x48')+_0x5160e6+_0xcffd('0x49'),_0x5bb460['uniqueid'],util[_0xcffd('0x3e')](_0x5bb460,{'showHidden':![],'depth':null}));this[_0xcffd('0x46')](util[_0xcffd('0x4a')](_0xcffd('0x4b'),_0x5bb460[_0xcffd('0x4c')]),_0xcffd('0x4d'),_0x5bb460);io['emit'](_0xcffd('0x4e'),_0x5bb460);};VoiceQueueReport[_0xcffd('0xb')]['emitVoiceQueueChannelRemove']=function(_0x454735,_0x587a53){logger['debug'](_0xcffd('0x48')+_0x587a53+_0xcffd('0x4f'),_0x454735[_0xcffd('0x50')],util[_0xcffd('0x3e')](_0x454735,{'showHidden':![],'depth':null}));this[_0xcffd('0x46')](util[_0xcffd('0x4a')](_0xcffd('0x4b'),_0x454735[_0xcffd('0x4c')]),_0xcffd('0x51'),_0x454735);io[_0xcffd('0x46')]('voice_queue_presence:remove',_0x454735);};VoiceQueueReport[_0xcffd('0xb')][_0xcffd('0x52')]=function(_0x5a45e4,_0x49505d){if(_0x5a45e4[_0xcffd('0x53')]===_0xcffd('0x54')){var _0xfa4a55={'id':_0x5a45e4['id'],'name':_0x5a45e4[_0xcffd('0x4c')],'strategy':_0x5a45e4[_0xcffd('0x55')],'answered':_0x5a45e4['answered'],'available':_0x5a45e4['available'],'loggedIn':_0x5a45e4['loggedIn'],'pTalking':_0x5a45e4[_0xcffd('0x56')],'sumBillable':_0x5a45e4[_0xcffd('0x57')],'sumDuration':_0x5a45e4[_0xcffd('0x58')],'sumHoldTime':_0x5a45e4[_0xcffd('0x59')]||0x0,'talking':_0x5a45e4[_0xcffd('0x32')],'total':_0x5a45e4[_0xcffd('0x5a')],'type':_0x5a45e4[_0xcffd('0x53')],'unmanaged':_0x5a45e4[_0xcffd('0x5b')],'abandoned':_0x5a45e4[_0xcffd('0x5c')],'waiting':_0x5a45e4[_0xcffd('0x33')]};if(_0x5a45e4[_0xcffd('0x5d')]){_0xfa4a55[_0xcffd('0x5d')]={'id':_0x5a45e4[_0xcffd('0x5d')]['id'],'name':_0x5a45e4[_0xcffd('0x5d')]['name'],'active':_0x5a45e4[_0xcffd('0x5d')]['active'],'callerid':_0x5a45e4['Trunk'][_0xcffd('0x5e')]};}if(_0x5a45e4['Interval']){_0xfa4a55[_0xcffd('0x5f')]={'id':_0x5a45e4[_0xcffd('0x5f')]['id'],'name':_0x5a45e4['Interval'][_0xcffd('0x4c')]};}var _0x314055=md5(JSON[_0xcffd('0x60')](_0xfa4a55));if(_0x5a45e4[_0xcffd('0x2')]!==_0x314055){_0x5a45e4[_0xcffd('0x2')]=_0x314055;logger['debug'](_0xcffd('0x61')+_0x49505d+_0xcffd('0x62'),util[_0xcffd('0x3e')](_0xfa4a55,{'showHidden':![],'depth':null}));this[_0xcffd('0x46')](util[_0xcffd('0x4a')](_0xcffd('0x4b'),_0xfa4a55[_0xcffd('0x4c')]),'voice_queue:save',_0xfa4a55);}}};VoiceQueueReport['prototype']['isNotNull']=function(_0x59ad1d){return _0x59ad1d!==null&&!_['isUndefined'](_0x59ad1d);};VoiceQueueReport[_0xcffd('0xb')]['loopQueueShow']=function(){var _0x53b879=this;setInterval(function(){_0x53b879[_0xcffd('0x35')]();ami[_0xcffd('0x37')]({'action':_0xcffd('0x63')})[_0xcffd('0x64')](function(_0x229766){logger[_0xcffd('0x3a')](_0xcffd('0x65'),util[_0xcffd('0x3e')](_0x229766,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xcffd('0xb')][_0xcffd('0x2e')]=function(){var _0x26aa37=this;setInterval(function(){if(_0x26aa37[_0xcffd('0x13')]){return ami[_0xcffd('0x37')]({'action':_0xcffd('0x15')})[_0xcffd('0x66')](function(_0x4a6820){_0x26aa37[_0xcffd('0x13')]=![];})[_0xcffd('0x64')](function(_0x25419b){logger[_0xcffd('0x3a')](_0xcffd('0x67'),util[_0xcffd('0x3e')](_0x25419b,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xcffd('0xb')][_0xcffd('0x68')]=function(_0xc624b8){try{if(this[_0xcffd('0x69')](_0xc624b8)&&this[_0xcffd('0x69')](_0xc624b8[_0xcffd('0x6a')])){logger[_0xcffd('0x47')](_0xcffd('0x6b'),util[_0xcffd('0x3e')](_0xc624b8,{'showHidden':![],'depth':null}));if(this[_0xcffd('0x6c')][_0xc624b8[_0xcffd('0x6a')]]){logger['info'](_0xcffd('0x6d'),_0xc624b8[_0xcffd('0x6a')]);var _0x55f73a=_['countBy'](this[_0xcffd('0x11')],_0xcffd('0x6a'))[_0xc624b8['queue']]||0x0;var _0x44cae9=_0x55f73a-_0xc624b8[_0xcffd('0x6e')];if(this[_0xcffd('0x6c')][_0xc624b8['queue']][_0xcffd('0x33')]!==_[_0xcffd('0x6f')](_0xc624b8[_0xcffd('0x6e')])||this[_0xcffd('0x6c')][_0xc624b8[_0xcffd('0x6a')]][_0xcffd('0x70')]!==_[_0xcffd('0x6f')](_0xc624b8[_0xcffd('0x71')])||this[_0xcffd('0x6c')][_0xc624b8[_0xcffd('0x6a')]][_0xcffd('0x72')]!==_[_0xcffd('0x6f')](_0xc624b8[_0xcffd('0x72')])||this[_0xcffd('0x6c')][_0xc624b8[_0xcffd('0x6a')]][_0xcffd('0x32')]!==_0x44cae9){this[_0xcffd('0x6c')][_0xc624b8[_0xcffd('0x6a')]][_0xcffd('0x33')]=_[_0xcffd('0x6f')](_0xc624b8[_0xcffd('0x6e')]);this[_0xcffd('0x6c')][_0xc624b8[_0xcffd('0x6a')]][_0xcffd('0x70')]=_[_0xcffd('0x6f')](_0xc624b8[_0xcffd('0x71')]);this[_0xcffd('0x6c')][_0xc624b8[_0xcffd('0x6a')]][_0xcffd('0x72')]=_['toNumber'](_0xc624b8[_0xcffd('0x72')]);this['voiceQueues'][_0xc624b8[_0xcffd('0x6a')]][_0xcffd('0x32')]=_0x44cae9>0x0?_0x44cae9:0x0;this[_0xcffd('0x6c')][_0xc624b8[_0xcffd('0x6a')]][_0xcffd('0x32')]=this[_0xcffd('0x6c')][_0xc624b8[_0xcffd('0x6a')]][_0xcffd('0x32')]>_[_0xcffd('0x6f')](_0xc624b8[_0xcffd('0x71')])?_[_0xcffd('0x6f')](_0xc624b8[_0xcffd('0x71')]):this['voiceQueues'][_0xc624b8['queue']][_0xcffd('0x32')];this[_0xcffd('0x52')](this[_0xcffd('0x6c')][_0xc624b8[_0xcffd('0x6a')]],_0xcffd('0x15'));}logger['debug'](_0xcffd('0x73'),util['inspect'](this[_0xcffd('0x6c')][_0xc624b8[_0xcffd('0x6a')]],{'showHidden':![],'depth':null}));ami[_0xcffd('0x46')](_0xcffd('0x74'),this[_0xcffd('0x6c')][_0xc624b8[_0xcffd('0x6a')]]);}}}catch(_0x4228a2){logger[_0xcffd('0x3a')](_0xcffd('0x67'),util[_0xcffd('0x3e')](_0x4228a2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcffd('0xb')]['syncQueueSummaryComplete']=function(_0x11fe1f){logger[_0xcffd('0x47')](_0xcffd('0x75'),util[_0xcffd('0x3e')](_0x11fe1f,{'showHidden':![],'depth':null}));this[_0xcffd('0x13')]=!![];};VoiceQueueReport[_0xcffd('0xb')]['syncQueueCallerJoin']=function(_0x30bc18){try{if(this['isNotNull'](_0x30bc18)){logger['debug'](_0xcffd('0x76'),_0x30bc18[_0xcffd('0x50')],util[_0xcffd('0x3e')](_0x30bc18,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xcffd('0x3c')][_0x30bc18[_0xcffd('0x50')]]))this[_0xcffd('0x3c')][_0x30bc18['uniqueid']]=[];if(_[_0xcffd('0x77')](this[_0xcffd('0x11')][_0x30bc18[_0xcffd('0x50')]]))this[_0xcffd('0x11')][_0x30bc18[_0xcffd('0x50')]]={};var _0x27decd=new QueueReport();_0x27decd[_0xcffd('0x4c')]=_0x30bc18[_0xcffd('0x6a')];_0x27decd[_0xcffd('0x53')]=this[_0xcffd('0x6c')][_0x27decd[_0xcffd('0x4c')]]&&this[_0xcffd('0x6c')][_0x27decd[_0xcffd('0x4c')]][_0xcffd('0x53')]?this['voiceQueues'][_0x27decd[_0xcffd('0x4c')]][_0xcffd('0x53')]||_0xcffd('0x54'):'inbound';_0x27decd[_0xcffd('0x6a')]=_0x30bc18[_0xcffd('0x6a')];_0x27decd[_0xcffd('0x78')]=moment()[_0xcffd('0x4a')](_0xcffd('0x79'));_0x27decd['position']=_0x30bc18[_0xcffd('0x7a')];_0x27decd[_0xcffd('0x7b')]=_0x30bc18[_0xcffd('0x7b')];_0x27decd['uniqueid']=_0x30bc18[_0xcffd('0x50')];_0x27decd[_0xcffd('0x7c')]=this[_0xcffd('0x11')][_0x30bc18['uniqueid']][_0xcffd('0x7c')];logger[_0xcffd('0x7d')](_0xcffd('0x7e'),_0x27decd['name'],_0x27decd[_0xcffd('0x53')]);_['merge'](_0x27decd,_[_0xcffd('0x7f')](_0x30bc18,_[_0xcffd('0x80')](_0x27decd)));this['queueReports'][_0x30bc18[_0xcffd('0x50')]][_0xcffd('0x81')](_0x27decd);this[_0xcffd('0x11')][_0x30bc18[_0xcffd('0x50')]]=_0x27decd;this[_0xcffd('0x82')](_0x27decd,_0xcffd('0x18'));}}catch(_0x2b83d8){logger[_0xcffd('0x3a')](_0xcffd('0x76'),_0x30bc18[_0xcffd('0x50')],util[_0xcffd('0x3e')](_0x2b83d8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcffd('0xb')]['syncQueueCallerAbandon']=function(_0x462618){try{if(this[_0xcffd('0x69')](_0x462618)){logger[_0xcffd('0x47')](_0xcffd('0x83'),_0x462618[_0xcffd('0x50')],util[_0xcffd('0x3e')](_0x462618,{'showHidden':![],'depth':null}));if(this[_0xcffd('0x3c')][_0x462618[_0xcffd('0x50')]]){var _0x54151c=_['last'](this['queueReports'][_0x462618['uniqueid']]);_0x54151c[_0xcffd('0x84')]=![];_0x54151c[_0xcffd('0x85')]=null;_0x54151c['holdtime']=_0x462618['holdtime'];_0x54151c[_0xcffd('0x86')]=_0x462618[_0xcffd('0x86')];_0x54151c[_0xcffd('0x1b')]=!![];_0x54151c[_0xcffd('0x87')]=moment()[_0xcffd('0x4a')](_0xcffd('0x79'));_0x54151c['queuecallerexitreason']='ABANDONED';_0x54151c[_0xcffd('0x88')]=null;logger[_0xcffd('0x7d')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x54151c[_0xcffd('0x4c')],_0x54151c[_0xcffd('0x53')]);this['channels'][_0x462618[_0xcffd('0x50')]]=_0x54151c;this[_0xcffd('0x45')](_0x54151c,'queuecallerabandon');}}}catch(_0x2fd946){logger[_0xcffd('0x3a')](_0xcffd('0x83'),_0x462618[_0xcffd('0x50')],util['inspect'](_0x2fd946,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcffd('0xb')][_0xcffd('0x1d')]=function(_0x901e31){try{if(this[_0xcffd('0x69')](_0x901e31)){logger[_0xcffd('0x47')](_0xcffd('0x89'),_0x901e31['uniqueid'],util[_0xcffd('0x3e')](_0x901e31,{'showHidden':![],'depth':null}));if(this[_0xcffd('0x3c')][_0x901e31[_0xcffd('0x50')]]){var _0x511eb3=_[_0xcffd('0x8a')](this[_0xcffd('0x3c')][_0x901e31[_0xcffd('0x50')]]);_0x511eb3[_0xcffd('0x8b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x511eb3[_0xcffd('0x8c')]=_0x901e31[_0xcffd('0x8c')];_0x511eb3[_0xcffd('0x8d')]=_0x901e31['connectedlinename'];logger[_0xcffd('0x7d')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x511eb3['name'],_0x511eb3[_0xcffd('0x53')],_0x901e31[_0xcffd('0x8c')],_0x901e31[_0xcffd('0x8d')]);this['channels'][_0x901e31['uniqueid']]=_0x511eb3;this[_0xcffd('0x82')](_0x511eb3,_0xcffd('0x1c'));}}}catch(_0x34c684){logger[_0xcffd('0x3a')](_0xcffd('0x89'),_0x901e31['uniqueid'],util[_0xcffd('0x3e')](_0x34c684,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcffd('0xb')][_0xcffd('0x8e')]=function(_0x38f667){try{if(this[_0xcffd('0x69')](_0x38f667)){logger['debug'](_0xcffd('0x8f'),_0x38f667[_0xcffd('0x50')],util['inspect'](_0x38f667,{'showHidden':![],'depth':null}));if(this[_0xcffd('0x3c')][_0x38f667[_0xcffd('0x50')]]){var _0x1d81ea=_[_0xcffd('0x8a')](this[_0xcffd('0x3c')][_0x38f667[_0xcffd('0x50')]]);_0x1d81ea[_0xcffd('0x84')]=!![];_0x1d81ea[_0xcffd('0x90')]=_0xcffd('0x91');logger['info'](_0xcffd('0x92'),_0x1d81ea['name'],_0x1d81ea[_0xcffd('0x53')]);}}}catch(_0x4d73a1){logger[_0xcffd('0x3a')](_0xcffd('0x8f'),_0x38f667[_0xcffd('0x50')],util[_0xcffd('0x3e')](_0x4d73a1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcffd('0xb')][_0xcffd('0x1f')]=function(_0x4f8384){try{if(this[_0xcffd('0x69')](_0x4f8384)){logger['debug'](_0xcffd('0x93'),_0x4f8384[_0xcffd('0x50')],util[_0xcffd('0x3e')](_0x4f8384,{'showHidden':![],'depth':null}));if(this[_0xcffd('0x3c')][_0x4f8384[_0xcffd('0x50')]]){var _0x4b9145=_['last'](this[_0xcffd('0x3c')][_0x4f8384[_0xcffd('0x50')]]);_0x4b9145[_0xcffd('0x1b')]=![];_0x4b9145[_0xcffd('0x87')]=null;_0x4b9145[_0xcffd('0x94')]=!![];_0x4b9145[_0xcffd('0x88')]=_0x4f8384[_0xcffd('0x95')];_0x4b9145[_0xcffd('0x96')]=_0x4f8384[_0xcffd('0x96')];_0x4b9145[_0xcffd('0x84')]=!![];_0x4b9145[_0xcffd('0x97')]=![];_0x4b9145[_0xcffd('0x98')]=null;if(!_0x4b9145[_0xcffd('0x99')]){if(_0x4f8384[_0xcffd('0x9a')]==_0xcffd('0x99')){_0x4b9145[_0xcffd('0x90')]=_0xcffd('0x9b');logger[_0xcffd('0x7d')](_0xcffd('0x9c'),_0x4b9145['name'],_0x4b9145[_0xcffd('0x53')]);}else{if(_['startsWith'](_0x4f8384[_0xcffd('0x9d')][_0xcffd('0x9e')](),_0xcffd('0x9f'))){if(this[_0xcffd('0x3c')][_0x4f8384['linkedid']]){var _0x298646=_[_0xcffd('0x8a')](this['queueReports'][_0x4f8384[_0xcffd('0xa0')]]);_0x298646['queuecallercomplete']=![];_0x298646[_0xcffd('0x97')]=!![];_0x298646[_0xcffd('0x98')]=moment(_0x4b9145['queuecallerjoinAt'])['add'](_0x4f8384['holdtime'],_0xcffd('0xa1'))[_0xcffd('0x4a')](_0xcffd('0x79'));_0x298646[_0xcffd('0x90')]=_0xcffd('0xa2');_0x298646[_0xcffd('0x99')]=!![];_0x298646['transfertype']=_0xcffd('0xa3');_0x298646[_0xcffd('0xa4')]=_0x4f8384[_0xcffd('0xa5')];_0x298646[_0xcffd('0xa6')]=_0x4f8384[_0xcffd('0x50')];logger[_0xcffd('0x7d')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x298646[_0xcffd('0x4c')],_0x298646[_0xcffd('0x53')]);var _0x3e7552=this[_0xcffd('0x3c')][_0x4f8384[_0xcffd('0xa0')]];this[_0xcffd('0x3c')][_0x4f8384[_0xcffd('0xa0')]]=this['queueReports'][_0x4f8384[_0xcffd('0x50')]];this[_0xcffd('0x3c')][_0x4f8384[_0xcffd('0x50')]]=_0x3e7552;}}else{_0x4b9145['queuecallerexitreason']='COMPLETEDBY'+_0x4f8384[_0xcffd('0x9a')][_0xcffd('0xa7')]();logger[_0xcffd('0x7d')](_0xcffd('0xa8'),_0x4b9145['name'],_0x4b9145['type'],_0x4b9145[_0xcffd('0x90')]);}}}this['channels'][_0x4f8384[_0xcffd('0x50')]]=_0x4b9145;this[_0xcffd('0x45')](_0x4b9145,'agentcomplete');}}}catch(_0x47d1ef){logger[_0xcffd('0x3a')]('[%s][voiceQueueReport][agentcomplete]',_0x4f8384['uniqueid'],util[_0xcffd('0x3e')](_0x47d1ef,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xcffd('0x22')]=function(_0x237794){try{if(this['isNotNull'](_0x237794)){logger[_0xcffd('0x47')](_0xcffd('0xa9'),_0x237794[_0xcffd('0x50')],util['inspect'](_0x237794,{'showHidden':![],'depth':null}));this[_0xcffd('0xaa')](_0x237794[_0xcffd('0x50')],_[_0xcffd('0x80')](_0x237794[_0xcffd('0xab')])[0x0],_0x237794[_0xcffd('0xac')]);if(this[_0xcffd('0x3c')][_0x237794[_0xcffd('0x50')]]){var _0x2e9455=_[_0xcffd('0x8a')](this[_0xcffd('0x3c')][_0x237794[_0xcffd('0x50')]]);if(_0x2e9455){if(this[_0xcffd('0x69')](_0x237794[_0xcffd('0xab')])&&this[_0xcffd('0x69')](_0x237794[_0xcffd('0xab')][_0xcffd('0xad')])){switch(_0x237794[_0xcffd('0xac')]){case _0xcffd('0xae'):_0x2e9455[_0xcffd('0x97')]=![];_0x2e9455[_0xcffd('0x98')]=null;break;case _0xcffd('0xaf'):_0x2e9455[_0xcffd('0xb0')]=_0xcffd('0xb1');_0x2e9455[_0xcffd('0x97')]=!![];_0x2e9455[_0xcffd('0x98')]=moment()['format'](_0xcffd('0x79'));_0x2e9455['queuecallerleaveAt']=moment()['format'](_0xcffd('0x79'));logger[_0xcffd('0x47')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x237794[_0xcffd('0x50')],util[_0xcffd('0x3e')](_0x2e9455,{'showHidden':![],'depth':null}));ami[_0xcffd('0x46')](_0xcffd('0xb2'),_0x2e9455);break;default:_0x2e9455[_0xcffd('0x97')]=!![];_0x2e9455[_0xcffd('0x98')]=moment()[_0xcffd('0x4a')](_0xcffd('0x79'));_0x2e9455['queuecallerleaveAt']=moment()[_0xcffd('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2e9455['queuecallerabandon']=![];_0x2e9455[_0xcffd('0x87')]=null;_0x2e9455[_0xcffd('0x90')]=_0x237794[_0xcffd('0xac')];this[_0xcffd('0x11')][_0x237794[_0xcffd('0x50')]]=_0x2e9455;this['emitVoiceQueueChannelRemove'](_0x2e9455,_0xcffd('0x21'));}else if(this[_0xcffd('0x69')](_0x237794[_0xcffd('0xab')])&&this['isNotNull'](_0x237794[_0xcffd('0xab')]['queueposition'])){if(!_0x2e9455['queuecallerabandon']){_0x2e9455['queuecallerexit']=!![];_0x2e9455[_0xcffd('0x98')]=moment()[_0xcffd('0x4a')](_0xcffd('0x79'));_0x2e9455[_0xcffd('0x90')]='EXITWITHKEY';_0x2e9455[_0xcffd('0x8b')]=moment()['format'](_0xcffd('0x79'));this[_0xcffd('0x11')][_0x237794[_0xcffd('0x50')]]=_0x2e9455;}}logger[_0xcffd('0x7d')](_0xcffd('0xb3'),_0x237794[_0xcffd('0x50')],_0x2e9455[_0xcffd('0x4c')],_0x2e9455[_0xcffd('0x53')],_[_0xcffd('0x80')](_0x237794[_0xcffd('0xab')])[0x0],_0x237794['value']);_0x2e9455['variables']=this[_0xcffd('0x3f')][_0x237794[_0xcffd('0x50')]];}}}}catch(_0x2dd264){logger[_0xcffd('0x3a')]('[%s][voiceQueueReport][varset]',_0x237794['uniqueid'],util[_0xcffd('0x3e')](_0x2dd264,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xcffd('0xaa')]=function(_0x39e92b,_0x9d0037,_0x58add7){var _0x41d69f=[_0xcffd('0xb4'),_0xcffd('0xb5'),'rtpaudioqosjitter',_0xcffd('0xb6'),'rtpaudioqosloss',_0xcffd('0xb7'),'rtpaudioqosrtt',_0xcffd('0xb8'),_0xcffd('0xb9'),_0xcffd('0xba'),_0xcffd('0xbb'),_0xcffd('0xbc'),_0xcffd('0xbd'),'memberdynamic',_0xcffd('0xbe'),'memberlastcall',_0xcffd('0x95'),_0xcffd('0xbf'),'memberrealtime'];if(!_[_0xcffd('0xc0')](_0x9d0037)&&!_[_0xcffd('0xc1')](_0x41d69f,_0x9d0037)){if(_['isUndefined'](this['variables'][_0x39e92b])){this[_0xcffd('0x3f')][_0x39e92b]={};}this[_0xcffd('0x3f')][_0x39e92b][_0x9d0037]=_0x58add7;}};VoiceQueueReport[_0xcffd('0xb')][_0xcffd('0x24')]=function(_0x252e1f){try{if(this[_0xcffd('0x69')](_0x252e1f)){logger['debug'](_0xcffd('0xc2'),_0x252e1f['uniqueid'],util['inspect'](_0x252e1f,{'showHidden':![],'depth':null}));if(this[_0xcffd('0x3c')][_0x252e1f[_0xcffd('0x50')]]){for(var _0x407073=0x0,_0x29f824={};_0x4070730x0?_0x4ef04d:0x0;this[_0x7c57('0x11')][_0x58973c['queue']][_0x7c57('0x5a')]=this[_0x7c57('0x11')][_0x58973c[_0x7c57('0x6f')]][_0x7c57('0x5a')]>_[_0x7c57('0x74')](_0x58973c[_0x7c57('0x75')])?_[_0x7c57('0x74')](_0x58973c[_0x7c57('0x75')]):this[_0x7c57('0x11')][_0x58973c[_0x7c57('0x6f')]][_0x7c57('0x5a')];this[_0x7c57('0x54')](this[_0x7c57('0x11')][_0x58973c[_0x7c57('0x6f')]],_0x7c57('0x6a'));}logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x7c57('0x3e')](this['voiceQueues'][_0x58973c['queue']],{'showHidden':![],'depth':null}));ami[_0x7c57('0x46')](_0x7c57('0x77'),this[_0x7c57('0x11')][_0x58973c[_0x7c57('0x6f')]]);}}}catch(_0x1c4219){logger[_0x7c57('0x3d')](_0x7c57('0x6c'),util['inspect'](_0x1c4219,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7c57('0x16')]=function(_0x51a8fd){logger[_0x7c57('0x48')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x7c57('0x3e')](_0x51a8fd,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport['prototype'][_0x7c57('0x19')]=function(_0x507a4a){try{if(this[_0x7c57('0x6e')](_0x507a4a)){logger[_0x7c57('0x48')](_0x7c57('0x78'),_0x507a4a[_0x7c57('0x4b')],util[_0x7c57('0x3e')](_0x507a4a,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x7c57('0x3f')][_0x507a4a[_0x7c57('0x4b')]]))this['queueReports'][_0x507a4a['uniqueid']]=[];if(_['isUndefined'](this[_0x7c57('0x35')][_0x507a4a[_0x7c57('0x4b')]]))this[_0x7c57('0x35')][_0x507a4a[_0x7c57('0x4b')]]={};var _0x41b0f8=new QueueReport();_0x41b0f8[_0x7c57('0x51')]=_0x507a4a[_0x7c57('0x6f')];_0x41b0f8[_0x7c57('0x79')]=this[_0x7c57('0x11')][_0x41b0f8['name']]&&this['voiceQueues'][_0x41b0f8['name']][_0x7c57('0x79')]?this[_0x7c57('0x11')][_0x41b0f8['name']]['type']||_0x7c57('0x55'):_0x7c57('0x55');_0x41b0f8['queue']=_0x507a4a[_0x7c57('0x6f')];_0x41b0f8['queuecallerjoinAt']=moment()[_0x7c57('0x50')](_0x7c57('0x7a'));_0x41b0f8[_0x7c57('0x7b')]=_0x507a4a[_0x7c57('0x7b')];_0x41b0f8['count']=_0x507a4a[_0x7c57('0x7c')];_0x41b0f8[_0x7c57('0x4b')]=_0x507a4a['uniqueid'];_0x41b0f8[_0x7c57('0x7d')]=this['channels'][_0x507a4a[_0x7c57('0x4b')]][_0x7c57('0x7d')];logger['info'](_0x7c57('0x7e'),_0x41b0f8['name'],_0x41b0f8['type']);_[_0x7c57('0x7f')](_0x41b0f8,_[_0x7c57('0x80')](_0x507a4a,_['keys'](_0x41b0f8)));this[_0x7c57('0x3f')][_0x507a4a[_0x7c57('0x4b')]][_0x7c57('0x81')](_0x41b0f8);this['channels'][_0x507a4a['uniqueid']]=_0x41b0f8;this['emitVoiceQueueChannelSave'](_0x41b0f8,'queuecallerjoin');}}catch(_0x3bd0d6){logger[_0x7c57('0x3d')](_0x7c57('0x78'),_0x507a4a[_0x7c57('0x4b')],util[_0x7c57('0x3e')](_0x3bd0d6,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7c57('0x1b')]=function(_0x114ecf){try{if(this[_0x7c57('0x6e')](_0x114ecf)){logger[_0x7c57('0x48')]('[%s][voiceQueueReport][queuecallerabandon]',_0x114ecf[_0x7c57('0x4b')],util[_0x7c57('0x3e')](_0x114ecf,{'showHidden':![],'depth':null}));if(this[_0x7c57('0x3f')][_0x114ecf[_0x7c57('0x4b')]]){var _0x5691d8=_[_0x7c57('0x82')](this[_0x7c57('0x3f')][_0x114ecf['uniqueid']]);_0x5691d8[_0x7c57('0x83')]=![];_0x5691d8['queuecallercompleteAt']=null;_0x5691d8[_0x7c57('0x84')]=_0x114ecf['holdtime'];_0x5691d8[_0x7c57('0x85')]=_0x114ecf[_0x7c57('0x85')];_0x5691d8[_0x7c57('0x1a')]=!![];_0x5691d8[_0x7c57('0x86')]=moment()['format'](_0x7c57('0x7a'));_0x5691d8[_0x7c57('0x87')]=_0x7c57('0x88');_0x5691d8['lastAssignedTo']=null;logger['info'](_0x7c57('0x89'),_0x5691d8[_0x7c57('0x51')],_0x5691d8[_0x7c57('0x79')]);this[_0x7c57('0x35')][_0x114ecf[_0x7c57('0x4b')]]=_0x5691d8;this[_0x7c57('0x44')](_0x5691d8,_0x7c57('0x1a'));}}}catch(_0x374eb0){logger[_0x7c57('0x3d')]('[%s][voiceQueueReport][queuecallerabandon]',_0x114ecf[_0x7c57('0x4b')],util['inspect'](_0x374eb0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7c57('0x33')][_0x7c57('0x1c')]=function(_0x3eab22){try{if(this[_0x7c57('0x6e')](_0x3eab22)){logger[_0x7c57('0x48')](_0x7c57('0x8a'),_0x3eab22[_0x7c57('0x4b')],util[_0x7c57('0x3e')](_0x3eab22,{'showHidden':![],'depth':null}));if(this[_0x7c57('0x3f')][_0x3eab22['uniqueid']]){var _0x5224d9=_[_0x7c57('0x82')](this['queueReports'][_0x3eab22['uniqueid']]);_0x5224d9[_0x7c57('0x8b')]=moment()[_0x7c57('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x5224d9[_0x7c57('0x8c')]=_0x3eab22[_0x7c57('0x8c')];_0x5224d9['connectedlinename']=_0x3eab22[_0x7c57('0x8d')];logger[_0x7c57('0x71')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5224d9[_0x7c57('0x51')],_0x5224d9[_0x7c57('0x79')],_0x3eab22[_0x7c57('0x8c')],_0x3eab22[_0x7c57('0x8d')]);this['channels'][_0x3eab22[_0x7c57('0x4b')]]=_0x5224d9;this[_0x7c57('0x47')](_0x5224d9,_0x7c57('0x8e'));}}}catch(_0x3c5605){logger[_0x7c57('0x3d')](_0x7c57('0x8a'),_0x3eab22[_0x7c57('0x4b')],util[_0x7c57('0x3e')](_0x3c5605,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7c57('0x33')][_0x7c57('0x1f')]=function(_0x59c089){try{if(this[_0x7c57('0x6e')](_0x59c089)){logger['debug'](_0x7c57('0x8f'),_0x59c089['uniqueid'],util[_0x7c57('0x3e')](_0x59c089,{'showHidden':![],'depth':null}));if(this[_0x7c57('0x3f')][_0x59c089[_0x7c57('0x4b')]]){var _0x43f769=_[_0x7c57('0x82')](this[_0x7c57('0x3f')][_0x59c089[_0x7c57('0x4b')]]);_0x43f769[_0x7c57('0x83')]=!![];_0x43f769[_0x7c57('0x87')]=_0x7c57('0x90');logger[_0x7c57('0x71')](_0x7c57('0x91'),_0x43f769[_0x7c57('0x51')],_0x43f769[_0x7c57('0x79')]);}}}catch(_0xa6878c){logger[_0x7c57('0x3d')](_0x7c57('0x8f'),_0x59c089['uniqueid'],util[_0x7c57('0x3e')](_0xa6878c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7c57('0x33')][_0x7c57('0x1e')]=function(_0x318b74){try{if(this[_0x7c57('0x6e')](_0x318b74)){logger[_0x7c57('0x48')](_0x7c57('0x92'),_0x318b74['uniqueid'],util[_0x7c57('0x3e')](_0x318b74,{'showHidden':![],'depth':null}));if(this[_0x7c57('0x3f')][_0x318b74[_0x7c57('0x4b')]]){var _0x436a07=_[_0x7c57('0x82')](this[_0x7c57('0x3f')][_0x318b74[_0x7c57('0x4b')]]);_0x436a07[_0x7c57('0x1a')]=![];_0x436a07['queuecallerabandonAt']=null;_0x436a07['assigned']=!![];_0x436a07[_0x7c57('0x93')]=_0x318b74['membername'];_0x436a07[_0x7c57('0x84')]=_0x318b74['holdtime'];_0x436a07['queuecallercomplete']=!![];_0x436a07[_0x7c57('0x94')]=![];_0x436a07[_0x7c57('0x95')]=null;if(!_0x436a07['transfer']){if(_0x318b74[_0x7c57('0x96')]==_0x7c57('0x97')){_0x436a07['queuecallerexitreason']=_0x7c57('0x98');logger[_0x7c57('0x71')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x436a07[_0x7c57('0x51')],_0x436a07['type']);}else{if(_[_0x7c57('0x99')](_0x318b74['channel'][_0x7c57('0x9a')](),'local/')){if(this[_0x7c57('0x3f')][_0x318b74[_0x7c57('0x9b')]]){var _0x497748=_[_0x7c57('0x82')](this[_0x7c57('0x3f')][_0x318b74['linkedid']]);_0x497748[_0x7c57('0x83')]=![];_0x497748[_0x7c57('0x94')]=!![];_0x497748[_0x7c57('0x95')]=moment(_0x436a07[_0x7c57('0x9c')])['add'](_0x318b74[_0x7c57('0x84')],_0x7c57('0x9d'))[_0x7c57('0x50')](_0x7c57('0x7a'));_0x497748[_0x7c57('0x87')]=_0x7c57('0x9e');_0x497748['transfer']=!![];_0x497748[_0x7c57('0x9f')]=_0x7c57('0xa0');_0x497748['transferexten']=_0x318b74[_0x7c57('0xa1')];_0x497748[_0x7c57('0xa2')]=_0x318b74[_0x7c57('0x4b')];logger[_0x7c57('0x71')](_0x7c57('0xa3'),_0x497748[_0x7c57('0x51')],_0x497748[_0x7c57('0x79')]);var _0x2eae60=this[_0x7c57('0x3f')][_0x318b74[_0x7c57('0x9b')]];this[_0x7c57('0x3f')][_0x318b74[_0x7c57('0x9b')]]=this['queueReports'][_0x318b74[_0x7c57('0x4b')]];this['queueReports'][_0x318b74[_0x7c57('0x4b')]]=_0x2eae60;}}else{_0x436a07[_0x7c57('0x87')]='COMPLETEDBY'+_0x318b74['reason'][_0x7c57('0xa4')]();logger[_0x7c57('0x71')](_0x7c57('0xa5'),_0x436a07[_0x7c57('0x51')],_0x436a07[_0x7c57('0x79')],_0x436a07[_0x7c57('0x87')]);}}}this['channels'][_0x318b74[_0x7c57('0x4b')]]=_0x436a07;this[_0x7c57('0x44')](_0x436a07,_0x7c57('0x1d'));}}}catch(_0x49e08c){logger[_0x7c57('0x3d')](_0x7c57('0x92'),_0x318b74['uniqueid'],util[_0x7c57('0x3e')](_0x49e08c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7c57('0x33')]['syncVarSet']=function(_0x29bbb6){try{if(this[_0x7c57('0x6e')](_0x29bbb6)){logger[_0x7c57('0x48')](_0x7c57('0xa6'),_0x29bbb6[_0x7c57('0x4b')],util[_0x7c57('0x3e')](_0x29bbb6,{'showHidden':![],'depth':null}));this[_0x7c57('0xa7')](_0x29bbb6['uniqueid'],_[_0x7c57('0xa8')](_0x29bbb6[_0x7c57('0xa9')])[0x0],_0x29bbb6['value']);if(this[_0x7c57('0x3f')][_0x29bbb6[_0x7c57('0x4b')]]){var _0x519f05=_[_0x7c57('0x82')](this[_0x7c57('0x3f')][_0x29bbb6[_0x7c57('0x4b')]]);if(_0x519f05){if(this[_0x7c57('0x6e')](_0x29bbb6['variable'])&&this['isNotNull'](_0x29bbb6['variable'][_0x7c57('0xaa')])){switch(_0x29bbb6['value']){case _0x7c57('0xab'):_0x519f05[_0x7c57('0x94')]=![];_0x519f05[_0x7c57('0x95')]=null;break;case'TIMEOUT':_0x519f05[_0x7c57('0xac')]=_0x7c57('0xad');_0x519f05[_0x7c57('0x94')]=!![];_0x519f05['queuecallerexitAt']=moment()[_0x7c57('0x50')](_0x7c57('0x7a'));_0x519f05[_0x7c57('0x8b')]=moment()[_0x7c57('0x50')](_0x7c57('0x7a'));logger['debug'](_0x7c57('0xae'),_0x29bbb6[_0x7c57('0x4b')],util[_0x7c57('0x3e')](_0x519f05,{'showHidden':![],'depth':null}));ami[_0x7c57('0x46')](_0x7c57('0xaf'),_0x519f05);break;default:_0x519f05[_0x7c57('0x94')]=!![];_0x519f05[_0x7c57('0x95')]=moment()[_0x7c57('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x519f05[_0x7c57('0x8b')]=moment()['format'](_0x7c57('0x7a'));}_0x519f05[_0x7c57('0x1a')]=![];_0x519f05[_0x7c57('0x86')]=null;_0x519f05['queuecallerexitreason']=_0x29bbb6[_0x7c57('0xb0')];this[_0x7c57('0x35')][_0x29bbb6[_0x7c57('0x4b')]]=_0x519f05;this[_0x7c57('0x44')](_0x519f05,'varset');}else if(this['isNotNull'](_0x29bbb6[_0x7c57('0xa9')])&&this[_0x7c57('0x6e')](_0x29bbb6[_0x7c57('0xa9')][_0x7c57('0xb1')])){if(!_0x519f05[_0x7c57('0x1a')]){_0x519f05[_0x7c57('0x94')]=!![];_0x519f05['queuecallerexitAt']=moment()['format'](_0x7c57('0x7a'));_0x519f05[_0x7c57('0x87')]=_0x7c57('0xb2');_0x519f05[_0x7c57('0x8b')]=moment()[_0x7c57('0x50')](_0x7c57('0x7a'));this[_0x7c57('0x35')][_0x29bbb6[_0x7c57('0x4b')]]=_0x519f05;}}logger[_0x7c57('0x71')](_0x7c57('0xb3'),_0x29bbb6[_0x7c57('0x4b')],_0x519f05[_0x7c57('0x51')],_0x519f05[_0x7c57('0x79')],_[_0x7c57('0xa8')](_0x29bbb6[_0x7c57('0xa9')])[0x0],_0x29bbb6['value']);_0x519f05[_0x7c57('0x14')]=this[_0x7c57('0x14')][_0x29bbb6[_0x7c57('0x4b')]];}}}}catch(_0x4aaaba){logger[_0x7c57('0x3d')](_0x7c57('0xa6'),_0x29bbb6[_0x7c57('0x4b')],util[_0x7c57('0x3e')](_0x4aaaba,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7c57('0x33')][_0x7c57('0xa7')]=function(_0x24e609,_0x10ce96,_0x5960b2){var _0x50332e=[_0x7c57('0xb4'),_0x7c57('0xb5'),_0x7c57('0xb6'),'rtpaudioqosjitterbridged',_0x7c57('0xb7'),_0x7c57('0xb8'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x7c57('0xb9'),_0x7c57('0xba'),_0x7c57('0xbb'),_0x7c57('0xbc'),_0x7c57('0xbd'),_0x7c57('0xbe'),_0x7c57('0xbf'),_0x7c57('0xc0'),'membername',_0x7c57('0xc1'),'memberrealtime'];if(!_[_0x7c57('0x38')](_0x10ce96)&&!_[_0x7c57('0xc2')](_0x50332e,_0x10ce96)){if(_[_0x7c57('0xc3')](this[_0x7c57('0x14')][_0x24e609])){this[_0x7c57('0x14')][_0x24e609]={};}this[_0x7c57('0x14')][_0x24e609][_0x10ce96]=_0x5960b2;}};VoiceQueueReport[_0x7c57('0x33')][_0x7c57('0x23')]=function(_0x1bee47){try{if(this[_0x7c57('0x6e')](_0x1bee47)){logger[_0x7c57('0x48')](_0x7c57('0xc4'),_0x1bee47[_0x7c57('0x4b')],util[_0x7c57('0x3e')](_0x1bee47,{'showHidden':![],'depth':null}));if(this[_0x7c57('0x3f')][_0x1bee47[_0x7c57('0x4b')]]){for(var _0x4b9945=0x0,_0x31bc09={};_0x4b9945=0x0?moment(_0x17d216[_0xb772('0x1b')])[_0xb772('0x1c')](_0x17d216[_0xb772('0x1a')],_0xb772('0x10')):null,'data1':_0xb772('0x1d'),'data2':_0x17d216[_0xb772('0x17')],'data3':_0x17d216[_0xb772('0x13')],'data4':_0x17d216['dialstring']||null,'role':_0xb772('0x15'),'internal':_0x17d216[_0xb772('0x17')]?_['toNumber'](_0x17d216['accountcode']):undefined,'uniqueid':_0x17d216[_0xb772('0x1e')]},'log':_0xb772('0x8')});}; \ No newline at end of file +var _0x652e=['voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','seconds','exten','queue','accountcode','toNumber','uniqueid','endtime','starttime','outbound','agent','moment','lodash','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport'];(function(_0x46cd14,_0x4d29ce){var _0x1effe1=function(_0x4312d0){while(--_0x4312d0){_0x46cd14['push'](_0x46cd14['shift']());}};_0x1effe1(++_0x4d29ce);}(_0x652e,0x14a));var _0xe652=function(_0x1cfcdb,_0x513a14){_0x1cfcdb=_0x1cfcdb-0x0;var _0x5d931b=_0x652e[_0x1cfcdb];return _0x5d931b;};'use strict';var moment=require(_0xe652('0x0'));var _=require(_0xe652('0x1'));var util=require('util');var client=require(_0xe652('0x2'));exports[_0xe652('0x3')]=function(_0x4fe55a){var _0x5adb6e=_0x4fe55a[_0xe652('0x4')]||_0x4fe55a[_0xe652('0x5')];return client[_0xe652('0x6')](_0xe652('0x7'),{'body':{'channel':_0xe652('0x8'),'membername':_0x4fe55a[_0xe652('0x9')],'interface':_[_0xe652('0xa')](_0x4fe55a[_0xe652('0xb')])?util[_0xe652('0xc')](_0xe652('0xd'),_0x4fe55a[_0xe652('0x9')]):_0x4fe55a['interface'],'type':_0xe652('0xe'),'enterAt':_0x4fe55a[_0xe652('0xf')],'exitAt':_0x5adb6e,'duration':moment(_0x5adb6e)['diff'](_0x4fe55a[_0xe652('0xf')],_0xe652('0x10')),'data1':'inbound','data2':_0x4fe55a['calleridnum'],'data3':_0x4fe55a[_0xe652('0x11')],'data4':null,'data5':_0x4fe55a[_0xe652('0x12')],'role':'agent','internal':_0x4fe55a[_0xe652('0x13')]?_[_0xe652('0x14')](_0x4fe55a['accountcode']):undefined,'uniqueid':_0x4fe55a[_0xe652('0x15')]},'log':_0xe652('0x7')});};exports['voiceDialReport']=function(_0x1b91c7){return client[_0xe652('0x6')](_0xe652('0x7'),{'body':{'channel':_0xe652('0x8'),'membername':_0x1b91c7['membername'],'interface':_0x1b91c7['interface'],'type':'TALKING','enterAt':_0x1b91c7['starttime'],'exitAt':_0x1b91c7[_0xe652('0x16')],'duration':moment(_0x1b91c7[_0xe652('0x16')])['diff'](_0x1b91c7[_0xe652('0x17')],_0xe652('0x10'))>=0x0?moment(_0x1b91c7[_0xe652('0x16')])['diff'](_0x1b91c7[_0xe652('0x17')],'seconds'):null,'data1':_0xe652('0x18'),'data2':_0x1b91c7['accountcode'],'data3':_0x1b91c7[_0xe652('0x11')],'data4':_0x1b91c7['dialstring']||null,'role':_0xe652('0x19'),'internal':_0x1b91c7['accountcode']?_['toNumber'](_0x1b91c7[_0xe652('0x13')]):undefined,'uniqueid':_0x1b91c7[_0xe652('0x15')]},'log':_0xe652('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 7c7d7d5..bb43536 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 _0x96d9=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','GetSettings'];(function(_0x4eacf4,_0x55df78){var _0x15213e=function(_0x5d2420){while(--_0x5d2420){_0x4eacf4['push'](_0x4eacf4['shift']());}};_0x15213e(++_0x55df78);}(_0x96d9,0xea));var _0x996d=function(_0x4b6527,_0x2f9238){_0x4b6527=_0x4b6527-0x0;var _0x303f1b=_0x96d9[_0x4b6527];return _0x303f1b;};'use strict';var client=require(_0x996d('0x0'));exports[_0x996d('0x1')]=function(){return client[_0x996d('0x2')](_0x996d('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x996d('0x4')]},'log':_0x996d('0x5')});}; \ No newline at end of file +var _0x59e0=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','GetSettings'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x59e0,0x1f4));var _0x059e=function(_0x803bf9,_0x32d7c6){_0x803bf9=_0x803bf9-0x0;var _0x4fc6c4=_0x59e0[_0x803bf9];return _0x4fc6c4;};'use strict';var client=require('../client');exports[_0x059e('0x0')]=function(){return client[_0x059e('0x1')](_0x059e('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x059e('0x3')]},'log':_0x059e('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 6f03bb0..0fedad2 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 _0x7e37=['GetTemplate','name','html','../client','getTemplates'];(function(_0x54fc8f,_0x59a85c){var _0x363efc=function(_0x57e401){while(--_0x57e401){_0x54fc8f['push'](_0x54fc8f['shift']());}};_0x363efc(++_0x59a85c);}(_0x7e37,0xf3));var _0x77e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e37[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x77e3('0x0'));exports[_0x77e3('0x1')]=function(_0x17bba7){return function(_0x5686e0){return client['Request'](_0x77e3('0x2'),{'options':{'raw':!![],'attributes':['id',_0x77e3('0x3'),_0x77e3('0x4')]},'log':_0x77e3('0x2')});};}; \ No newline at end of file +var _0xd0be=['../client','getTemplates','Request','GetTemplate','name'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xd0be,0xf5));var _0xed0b=function(_0x28278f,_0x574b0d){_0x28278f=_0x28278f-0x0;var _0x3d9f74=_0xd0be[_0x28278f];return _0x3d9f74;};'use strict';var client=require(_0xed0b('0x0'));exports[_0xed0b('0x1')]=function(_0x5f32a4){return function(_0x991fca){return client[_0xed0b('0x2')](_0xed0b('0x3'),{'options':{'raw':!![],'attributes':['id',_0xed0b('0x4'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 8d26899..7a3ebb8 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 _0x09df=['channel','status','Condition','AllConditions','field','value','AnyConditions','operator','Action','data1','data2','data3','data4','data6','data7','getTriggers','Request','GetTrigger','name'];(function(_0x2c276b,_0x34e779){var _0x5e7d60=function(_0x363375){while(--_0x363375){_0x2c276b['push'](_0x2c276b['shift']());}};_0x5e7d60(++_0x34e779);}(_0x09df,0x119));var _0xf09d=function(_0x7dbd65,_0x18da49){_0x7dbd65=_0x7dbd65-0x0;var _0x33d551=_0x09df[_0x7dbd65];return _0x33d551;};'use strict';var client=require('../client');exports[_0xf09d('0x0')]=function(_0x27a85a){return function(_0xc8876){return client[_0xf09d('0x1')](_0xf09d('0x2'),{'options':{'raw':![],'attributes':['id',_0xf09d('0x3'),_0xf09d('0x4'),_0xf09d('0x5')],'include':[{'model':_0xf09d('0x6'),'as':_0xf09d('0x7'),'attributes':['id',_0xf09d('0x8'),'operator',_0xf09d('0x9')]},{'model':_0xf09d('0x6'),'as':_0xf09d('0xa'),'attributes':['id','field',_0xf09d('0xb'),_0xf09d('0x9')]},{'model':_0xf09d('0xc'),'as':'Actions','attributes':['id','action',_0xf09d('0xd'),_0xf09d('0xe'),_0xf09d('0xf'),_0xf09d('0x10'),'data5',_0xf09d('0x11'),_0xf09d('0x12')]}]},'log':_0xf09d('0x2')});};}; \ No newline at end of file +var _0xd303=['../client','getTriggers','Request','channel','status','Condition','AllConditions','field','operator','Action','Actions','data1','data4','data5','data6','data7','GetTrigger'];(function(_0x849511,_0x1642bc){var _0x548702=function(_0x5cac75){while(--_0x5cac75){_0x849511['push'](_0x849511['shift']());}};_0x548702(++_0x1642bc);}(_0xd303,0x154));var _0x3d30=function(_0x19576c,_0x9f2567){_0x19576c=_0x19576c-0x0;var _0x26166b=_0xd303[_0x19576c];return _0x26166b;};'use strict';var client=require(_0x3d30('0x0'));exports[_0x3d30('0x1')]=function(_0x50539c){return function(_0x4c74a1){return client[_0x3d30('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0x3d30('0x3'),_0x3d30('0x4')],'include':[{'model':_0x3d30('0x5'),'as':_0x3d30('0x6'),'attributes':['id',_0x3d30('0x7'),_0x3d30('0x8'),'value']},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x3d30('0x7'),_0x3d30('0x8'),'value']},{'model':_0x3d30('0x9'),'as':_0x3d30('0xa'),'attributes':['id','action',_0x3d30('0xb'),'data2','data3',_0x3d30('0xc'),_0x3d30('0xd'),_0x3d30('0xe'),_0x3d30('0xf')]}]},'log':_0x3d30('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index a765372..6893796 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 _0x77a4=['defaultuser','../client','getTrunks','GetTrunk'];(function(_0x7314be,_0x5046a6){var _0x2adde1=function(_0x30d2a9){while(--_0x30d2a9){_0x7314be['push'](_0x7314be['shift']());}};_0x2adde1(++_0x5046a6);}(_0x77a4,0x155));var _0x477a=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x77a4[_0x44b3bd];return _0x1efc4a;};'use strict';var client=require(_0x477a('0x0'));exports[_0x477a('0x1')]=function(_0x14d0de){return function(_0x4a5c3f){return client['Request'](_0x477a('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0x477a('0x3')]},'log':_0x477a('0x2')});};}; \ No newline at end of file +var _0x3f54=['registry','defaultuser','getTrunks','Request','GetTrunk','name'];(function(_0x4955c9,_0x297c82){var _0x58007a=function(_0x2d4aac){while(--_0x2d4aac){_0x4955c9['push'](_0x4955c9['shift']());}};_0x58007a(++_0x297c82);}(_0x3f54,0x68));var _0x43f5=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0x3f54[_0x3cb30b];return _0x2ca717;};'use strict';var client=require('../client');exports[_0x43f5('0x0')]=function(_0x3c1d65){return function(_0xbc629d){return client[_0x43f5('0x1')](_0x43f5('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x43f5('0x3'),_0x43f5('0x4'),_0x43f5('0x5')]},'log':_0x43f5('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 335b2c3..65da79c 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x1f01e9,_0x47e086){var _0x265f36=function(_0x2f7910){while(--_0x2f7910){_0x1f01e9['push'](_0x1f01e9['shift']());}};_0x265f36(++_0x47e086);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xcb91[_0x50a0c2];return _0x5ebadd;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x47e2a1,_0x3dff9d){var _0x342079=function(_0x28444e){while(--_0x28444e){_0x47e2a1['push'](_0x47e2a1['shift']());}};_0x342079(++_0x3dff9d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 6fbf123..9229684 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 _0x13b9=['UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport','update'];(function(_0x353643,_0x568495){var _0x394b32=function(_0x3924ae){while(--_0x3924ae){_0x353643['push'](_0x353643['shift']());}};_0x394b32(++_0x568495);}(_0x13b9,0x114));var _0x913b=function(_0xdddbb,_0x2734bf){_0xdddbb=_0xdddbb-0x0;var _0x41d7a1=_0x13b9[_0xdddbb];return _0x41d7a1;};'use strict';var client=require(_0x913b('0x0'));exports['create']=function(_0x2e26ed){return client[_0x913b('0x1')](_0x913b('0x2'),{'body':_0x2e26ed,'log':'CreateVoiceAgentReport'});};exports[_0x913b('0x3')]=function(_0xd96fbb,_0x4fa044,_0x307b46){return client[_0x913b('0x1')](_0x913b('0x4'),{'body':_0xd96fbb,'options':{'where':{'uniqueid':_0x4fa044,'interface':_0x307b46,'agentcomplete':!![]}},'log':_0x913b('0x4')});}; \ No newline at end of file +var _0x5b18=['create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x2a939e,_0x42ba31){var _0x4dd5e1=function(_0x3371fa){while(--_0x3371fa){_0x2a939e['push'](_0x2a939e['shift']());}};_0x4dd5e1(++_0x42ba31);}(_0x5b18,0x8b));var _0x85b1=function(_0x5440e5,_0x56fac9){_0x5440e5=_0x5440e5-0x0;var _0x6c5beb=_0x5b18[_0x5440e5];return _0x6c5beb;};'use strict';var client=require(_0x85b1('0x0'));exports[_0x85b1('0x1')]=function(_0x39be30){return client[_0x85b1('0x2')](_0x85b1('0x3'),{'body':_0x39be30,'log':_0x85b1('0x3')});};exports['update']=function(_0x264038,_0x15ce8e,_0x2c89c2){return client[_0x85b1('0x2')](_0x85b1('0x4'),{'body':_0x264038,'options':{'where':{'uniqueid':_0x15ce8e,'interface':_0x2c89c2,'agentcomplete':!![]}},'log':_0x85b1('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index ef5becc..224679d 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 _0xbce0=['lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','moment','util'];(function(_0x1136a2,_0x10298c){var _0x54bae5=function(_0x52b85b){while(--_0x52b85b){_0x1136a2['push'](_0x1136a2['shift']());}};_0x54bae5(++_0x10298c);}(_0xbce0,0x76));var _0x0bce=function(_0x37660f,_0x5e460d){_0x37660f=_0x37660f-0x0;var _0xb7c4be=_0xbce0[_0x37660f];return _0xb7c4be;};'use strict';var moment=require(_0x0bce('0x0'));var util=require(_0x0bce('0x1'));var _=require(_0x0bce('0x2'));var client=require(_0x0bce('0x3'));exports[_0x0bce('0x4')]=function(_0x22298b){return client[_0x0bce('0x5')](_0x0bce('0x6'),{'body':_[_0x0bce('0x7')](_0x22298b,{'source':_0x22298b[_0x0bce('0x8')],'destinationcontext':_0x22298b[_0x0bce('0x9')],'callerid':_0x22298b['callerid'],'amaflags':_0x0bce('0xa')}),'log':_0x0bce('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x0bce('0x5')](_0x0bce('0xb'),{'options':{'where':{'type':[_0x0bce('0xc')],'createdAt':{'$between':[moment()['startOf'](_0x0bce('0xd'))[_0x0bce('0xe')](_0x0bce('0xf')),moment()[_0x0bce('0x10')]('day')['format'](_0x0bce('0xf'))]}},'attributes':['type',_0x0bce('0x11'),_0x0bce('0x12'),_0x0bce('0x13')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x16b6=['GetVoiceCallReports','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','billableseconds'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x16b6,0xd3));var _0x616b=function(_0xecb573,_0x40513d){_0xecb573=_0xecb573-0x0;var _0x24e538=_0x16b6[_0xecb573];return _0x24e538;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x616b('0x0'));var client=require(_0x616b('0x1'));exports[_0x616b('0x2')]=function(_0x17dc4d){return client[_0x616b('0x3')](_0x616b('0x4'),{'body':_[_0x616b('0x5')](_0x17dc4d,{'source':_0x17dc4d[_0x616b('0x6')],'destinationcontext':_0x17dc4d[_0x616b('0x7')],'callerid':_0x17dc4d[_0x616b('0x8')],'amaflags':_0x616b('0x9')}),'log':_0x616b('0x4')});};exports[_0x616b('0xa')]=function(){return function(){return client[_0x616b('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x616b('0xb')],'createdAt':{'$between':[moment()[_0x616b('0xc')](_0x616b('0xd'))[_0x616b('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x616b('0xf')](_0x616b('0xd'))[_0x616b('0xe')](_0x616b('0x10'))]}},'attributes':[_0x616b('0x11'),_0x616b('0x12'),'duration',_0x616b('0x13')]},'log':_0x616b('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 764c4cf..004d754 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 _0xc862=['create','Request','CreateVoiceDialReport','../client'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xc862,0xe7));var _0x2c86=function(_0x44b958,_0x594efd){_0x44b958=_0x44b958-0x0;var _0x89dd7e=_0xc862[_0x44b958];return _0x89dd7e;};'use strict';var client=require(_0x2c86('0x0'));exports[_0x2c86('0x1')]=function(_0x5c759f){return client[_0x2c86('0x2')](_0x2c86('0x3'),{'body':_0x5c759f,'log':_0x2c86('0x3')});}; \ No newline at end of file +var _0x76ed=['CreateVoiceDialReport','../client','create','Request'];(function(_0x43583c,_0x3c2c86){var _0x2de413=function(_0x76b798){while(--_0x76b798){_0x43583c['push'](_0x43583c['shift']());}};_0x2de413(++_0x3c2c86);}(_0x76ed,0x1c1));var _0xd76e=function(_0x513e92,_0x30bb3e){_0x513e92=_0x513e92-0x0;var _0x35dc5b=_0x76ed[_0x513e92];return _0x35dc5b;};'use strict';var client=require(_0xd76e('0x0'));exports[_0xd76e('0x1')]=function(_0x317b19){return client[_0xd76e('0x2')](_0xd76e('0x3'),{'body':_0x317b19,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 869424e..232364c 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 _0xa75b=['exten','recordingFormat','getVoiceExtensions','../client','GetVoiceExtension'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa75b,0x170));var _0xba75=function(_0x51842d,_0x29c7fd){_0x51842d=_0x51842d-0x0;var _0x2015de=_0xa75b[_0x51842d];return _0x2015de;};'use strict';var client=require(_0xba75('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0xba75('0x1'),{'options':{'raw':!![],'attributes':['id',_0xba75('0x2'),_0xba75('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xba75('0x4')});};}; \ No newline at end of file +var _0x25a3=['exten','../client','getVoiceExtensions','Request'];(function(_0xf6c207,_0x59db07){var _0x3104ea=function(_0x1a1bb3){while(--_0x1a1bb3){_0xf6c207['push'](_0xf6c207['shift']());}};_0x3104ea(++_0x59db07);}(_0x25a3,0x121));var _0x325a=function(_0x5bee65,_0x352dc3){_0x5bee65=_0x5bee65-0x0;var _0x298c94=_0x25a3[_0x5bee65];return _0x298c94;};'use strict';var client=require(_0x325a('0x0'));exports[_0x325a('0x1')]=function(){return function(){return client[_0x325a('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x325a('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x325a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index a8f9f92..e5a8f8c 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 _0x9b70=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x9b70,0x1cc));var _0x09b7=function(_0x40c62b,_0x2c2efe){_0x40c62b=_0x40c62b-0x0;var _0x568cf0=_0x9b70[_0x40c62b];return _0x568cf0;};'use strict';var client=require(_0x09b7('0x0'));exports[_0x09b7('0x1')]=function(){return function(){return client[_0x09b7('0x2')](_0x09b7('0x3'),{'options':{'raw':![],'attributes':['id',_0x09b7('0x4'),_0x09b7('0x5'),_0x09b7('0x6'),_0x09b7('0x7'),_0x09b7('0x8'),'type',_0x09b7('0x9'),_0x09b7('0xa'),_0x09b7('0xb'),_0x09b7('0xc'),_0x09b7('0xd'),_0x09b7('0xe'),_0x09b7('0xf'),_0x09b7('0x10'),_0x09b7('0x11'),_0x09b7('0x12'),_0x09b7('0x13'),'dialQueueOptions','dialQueueTimeout','dialQueueProject',_0x09b7('0x14'),_0x09b7('0x15'),'dialBusyMaxRetry',_0x09b7('0x16'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval',_0x09b7('0x17'),_0x09b7('0x18'),_0x09b7('0x19'),_0x09b7('0x1a'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0x09b7('0x1b'),'dialAMDMinWordLength',_0x09b7('0x1c'),_0x09b7('0x1d'),_0x09b7('0x1e'),_0x09b7('0x1f'),_0x09b7('0x20'),'dialRecallMeTimeout','dialRecallInQueue',_0x09b7('0x21'),_0x09b7('0x22'),'dialAgiAfterHangupClient',_0x09b7('0x23'),'monitor_format',_0x09b7('0x24'),'dialRandomLastDigitCallerIdNumber',_0x09b7('0x25'),_0x09b7('0x26'),_0x09b7('0x27'),_0x09b7('0x28'),_0x09b7('0x29'),_0x09b7('0x2a'),_0x09b7('0x2b'),_0x09b7('0x2c'),_0x09b7('0x2d'),'dialAgentRejectMaxRetry',_0x09b7('0x2e'),_0x09b7('0x2f'),_0x09b7('0x30'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x09b7('0x31'),'as':_0x09b7('0x31'),'attributes':['id',_0x09b7('0x4'),'callerid',_0x09b7('0x32')]},{'model':_0x09b7('0x33'),'as':'mandatoryDispositionPause','attributes':['id',_0x09b7('0x4')]},{'model':_0x09b7('0x31'),'as':_0x09b7('0x34'),'attributes':['id',_0x09b7('0x4'),'callerid','active']},{'model':_0x09b7('0x35'),'as':'Interval','attributes':['id',_0x09b7('0x4')],'include':[{'model':_0x09b7('0x35'),'as':_0x09b7('0x36'),'attributes':['id',_0x09b7('0x4'),_0x09b7('0x37')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0xc791=['dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialLimitChannel','dialPowerLevel'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0xc791,0x19a));var _0x1c79=function(_0x158b34,_0x2a8fb1){_0x158b34=_0x158b34-0x0;var _0x2f5449=_0xc791[_0x158b34];return _0x2f5449;};'use strict';var client=require('../client');exports[_0x1c79('0x0')]=function(){return function(){return client[_0x1c79('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x1c79('0x2'),_0x1c79('0x3'),_0x1c79('0x4'),_0x1c79('0x5'),_0x1c79('0x6'),_0x1c79('0x7'),'dialActive','dialMethod',_0x1c79('0x8'),'dialLimitQueue',_0x1c79('0x9'),_0x1c79('0xa'),'dialPredictiveOptimizationPercentage',_0x1c79('0xb'),_0x1c79('0xc'),'dialOriginateCallerIdNumber',_0x1c79('0xd'),_0x1c79('0xe'),_0x1c79('0xf'),_0x1c79('0x10'),'dialCongestionMaxRetry',_0x1c79('0x11'),_0x1c79('0x12'),_0x1c79('0x13'),_0x1c79('0x14'),_0x1c79('0x15'),_0x1c79('0x16'),_0x1c79('0x17'),_0x1c79('0x18'),_0x1c79('0x19'),_0x1c79('0x1a'),_0x1c79('0x1b'),_0x1c79('0x1c'),_0x1c79('0x1d'),'dialAMDAfterGreetingSilence',_0x1c79('0x1e'),_0x1c79('0x1f'),'dialAMDBetweenWordsSilence',_0x1c79('0x20'),_0x1c79('0x21'),_0x1c79('0x22'),_0x1c79('0x23'),'dialRecallMeTimeout',_0x1c79('0x24'),_0x1c79('0x25'),_0x1c79('0x26'),_0x1c79('0x27'),_0x1c79('0x28'),'monitor_format','strategy',_0x1c79('0x29'),_0x1c79('0x2a'),'dialNoSuchNumberMaxRetry',_0x1c79('0x2b'),_0x1c79('0x2c'),_0x1c79('0x2d'),_0x1c79('0x2e'),_0x1c79('0x2f'),_0x1c79('0x30'),'dialMachineRetryFrequency',_0x1c79('0x31'),_0x1c79('0x32'),_0x1c79('0x33'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x1c79('0x34'),'as':_0x1c79('0x34'),'attributes':['id',_0x1c79('0x2'),'callerid',_0x1c79('0x35')]},{'model':_0x1c79('0x36'),'as':_0x1c79('0x37'),'attributes':['id','name']},{'model':'Trunk','as':_0x1c79('0x38'),'attributes':['id',_0x1c79('0x2'),'callerid',_0x1c79('0x35')]},{'model':'Interval','as':_0x1c79('0x39'),'attributes':['id',_0x1c79('0x2')],'include':[{'model':_0x1c79('0x39'),'as':_0x1c79('0x3a'),'attributes':['id',_0x1c79('0x2'),_0x1c79('0x3b')]}]}]},'log':_0x1c79('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 335fc98..400c545 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(_0x369dcd,_0xbbbcbb){var _0x81072=function(_0x475df9){while(--_0x475df9){_0x369dcd['push'](_0x369dcd['shift']());}};_0x81072(++_0xbbbcbb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x6568af,_0x4780c4){var _0xca6d5a=function(_0x138b20){while(--_0x138b20){_0x6568af['push'](_0x6568af['shift']());}};_0xca6d5a(++_0x4780c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 accdd3c..b98ec58 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 _0x5e34=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0x299520,_0x5b1aab){var _0x3d0267=function(_0x181430){while(--_0x181430){_0x299520['push'](_0x299520['shift']());}};_0x3d0267(++_0x5b1aab);}(_0x5e34,0x83));var _0x45e3=function(_0x4a92ad,_0x39f2f7){_0x4a92ad=_0x4a92ad-0x0;var _0x1639e2=_0x5e34[_0x4a92ad];return _0x1639e2;};'use strict';var client=require(_0x45e3('0x0'));exports[_0x45e3('0x1')]=function(_0x45aee9){return function(){return client['Request'](_0x45e3('0x2'),{'options':{'where':{'VoiceQueueId':_0x45aee9,'paused':!![]},'raw':!![]},'log':_0x45e3('0x1')});};}; \ No newline at end of file +var _0x3940=['GetVoiceQueueRtPauses','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3940,0x1e3));var _0x0394=function(_0x34d9b7,_0x40ff98){_0x34d9b7=_0x34d9b7-0x0;var _0xf5e297=_0x3940[_0x34d9b7];return _0xf5e297;};'use strict';var client=require(_0x0394('0x0'));exports['getVoiceQueueRtPauses']=function(_0x3e7a96){return function(){return client['Request'](_0x0394('0x1'),{'options':{'where':{'VoiceQueueId':_0x3e7a96,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 0a8f9d4..39799e1 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(_0x2e6c89,_0x53f61a){var _0x5ae0d8=function(_0x53c487){while(--_0x53c487){_0x2e6c89['push'](_0x2e6c89['shift']());}};_0x5ae0d8(++_0x53f61a);}(_0x7a54,0x106));var _0x47a5=function(_0x22aba0,_0x398c6b){_0x22aba0=_0x22aba0-0x0;var _0x5d9c96=_0x7a54[_0x22aba0];return _0x5d9c96;};'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(_0x18d684,_0x656a81){var _0x1226ce=function(_0x49e91c){while(--_0x49e91c){_0x18d684['push'](_0x18d684['shift']());}};_0x1226ce(++_0x656a81);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 216ff89..49800ba 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 _0xe84d=['transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','extension','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','result'];(function(_0x3dd8dd,_0x369f8e){var _0x33e300=function(_0xf1a7db){while(--_0xf1a7db){_0x3dd8dd['push'](_0x3dd8dd['shift']());}};_0x33e300(++_0x369f8e);}(_0xe84d,0x1f3));var _0xde84=function(_0x29d5d5,_0x27c4e2){_0x29d5d5=_0x29d5d5-0x0;var _0x26c550=_0xe84d[_0x29d5d5];return _0x26c550;};'use strict';var client=require(_0xde84('0x0'));exports[_0xde84('0x1')]={};exports[_0xde84('0x2')]=function(_0x35c705){return client[_0xde84('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x35c705[_0xde84('0x4')],'transfererchannel':_0x35c705['transfererchannel'],'transferercalleridnum':_0x35c705[_0xde84('0x5')],'transferercalleridname':_0x35c705[_0xde84('0x6')],'transfererconnectedlinenum':_0x35c705[_0xde84('0x7')],'transfererconnectedlinename':_0x35c705[_0xde84('0x8')],'transfereraccountcode':_0x35c705['transfereraccountcode'],'transferercontext':_0x35c705['transferercontext'],'transfererexten':_0x35c705[_0xde84('0x9')],'transfererlinkedid':_0x35c705[_0xde84('0xa')],'transfereechannel':_0x35c705[_0xde84('0xb')],'transfereecalleridnum':_0x35c705[_0xde84('0xc')],'transfereecalleridname':_0x35c705[_0xde84('0xd')],'transfereeconnectedlinenum':_0x35c705[_0xde84('0xe')],'transfereeconnectedlinename':_0x35c705[_0xde84('0xf')],'transfereeaccountcode':_0x35c705[_0xde84('0x10')],'transfereecontext':_0x35c705['transfereecontext'],'transfereeexten':_0x35c705[_0xde84('0x11')],'transfereelinkedid':_0x35c705[_0xde84('0x12')],'isexternal':_0x35c705['isexternal'],'context':_0x35c705['context'],'extension':_0x35c705[_0xde84('0x13')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x3ad497){return client[_0xde84('0x3')](_0xde84('0x14'),{'body':{'result':_0x3ad497[_0xde84('0x4')],'transfererchannel':_0x3ad497[_0xde84('0x15')],'transferercalleridnum':_0x3ad497[_0xde84('0x16')],'transferercalleridname':_0x3ad497['origtransferercalleridname'],'transfererconnectedlinenum':_0x3ad497[_0xde84('0x17')],'transfererconnectedlinename':_0x3ad497[_0xde84('0x18')],'transfereraccountcode':_0x3ad497[_0xde84('0x19')],'transferercontext':_0x3ad497[_0xde84('0x1a')],'transfererexten':_0x3ad497[_0xde84('0x1b')],'transfererlinkedid':_0x3ad497['origtransfererlinkedid'],'transfereechannel':_0x3ad497['transfertargetchannel'],'transfereecalleridnum':_0x3ad497['transfertargetcalleridnum'],'transfereecalleridname':_0x3ad497[_0xde84('0x1c')],'transfereeconnectedlinenum':_0x3ad497['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3ad497['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3ad497[_0xde84('0x1d')],'transfereecontext':_0x3ad497[_0xde84('0x1e')],'transfereeexten':_0x3ad497[_0xde84('0x1f')],'transfereelinkedid':_0x3ad497[_0xde84('0x20')],'isexternal':_0x3ad497['isexternal'],'context':_0x3ad497[_0xde84('0x21')],'extension':_0x3ad497[_0xde84('0x22')],'type':_0xde84('0x23')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x0461=['transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','Request','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetcalleridname','transfertargetconnectedlinenum'];(function(_0xe10be5,_0x5e96e4){var _0x26de1b=function(_0x3fb0cd){while(--_0x3fb0cd){_0xe10be5['push'](_0xe10be5['shift']());}};_0x26de1b(++_0x5e96e4);}(_0x0461,0x1a1));var _0x1046=function(_0x3f748c,_0x2a3f3d){_0x3f748c=_0x3f748c-0x0;var _0x5c75fb=_0x0461[_0x3f748c];return _0x5c75fb;};'use strict';var client=require(_0x1046('0x0'));exports[_0x1046('0x1')]={};exports[_0x1046('0x2')]=function(_0x64a201){return client['Request'](_0x1046('0x3'),{'body':{'result':_0x64a201[_0x1046('0x4')],'transfererchannel':_0x64a201['transfererchannel'],'transferercalleridnum':_0x64a201[_0x1046('0x5')],'transferercalleridname':_0x64a201[_0x1046('0x6')],'transfererconnectedlinenum':_0x64a201[_0x1046('0x7')],'transfererconnectedlinename':_0x64a201[_0x1046('0x8')],'transfereraccountcode':_0x64a201[_0x1046('0x9')],'transferercontext':_0x64a201[_0x1046('0xa')],'transfererexten':_0x64a201[_0x1046('0xb')],'transfererlinkedid':_0x64a201[_0x1046('0xc')],'transfereechannel':_0x64a201['transfereechannel'],'transfereecalleridnum':_0x64a201[_0x1046('0xd')],'transfereecalleridname':_0x64a201[_0x1046('0xe')],'transfereeconnectedlinenum':_0x64a201[_0x1046('0xf')],'transfereeconnectedlinename':_0x64a201[_0x1046('0x10')],'transfereeaccountcode':_0x64a201[_0x1046('0x11')],'transfereecontext':_0x64a201[_0x1046('0x12')],'transfereeexten':_0x64a201[_0x1046('0x13')],'transfereelinkedid':_0x64a201[_0x1046('0x14')],'isexternal':_0x64a201[_0x1046('0x15')],'context':_0x64a201[_0x1046('0x16')],'extension':_0x64a201[_0x1046('0x17')],'type':_0x1046('0x18')},'log':'CreateVoiceTransferReport'});};exports[_0x1046('0x19')]=function(_0x1167f7){return client[_0x1046('0x1a')](_0x1046('0x3'),{'body':{'result':_0x1167f7['result'],'transfererchannel':_0x1167f7['origtransfererchannel'],'transferercalleridnum':_0x1167f7[_0x1046('0x1b')],'transferercalleridname':_0x1167f7[_0x1046('0x1c')],'transfererconnectedlinenum':_0x1167f7['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1167f7[_0x1046('0x1d')],'transfereraccountcode':_0x1167f7[_0x1046('0x1e')],'transferercontext':_0x1167f7['secondtransferercontext'],'transfererexten':_0x1167f7['secondtransfererexten'],'transfererlinkedid':_0x1167f7[_0x1046('0x1f')],'transfereechannel':_0x1167f7['transfertargetchannel'],'transfereecalleridnum':_0x1167f7['transfertargetcalleridnum'],'transfereecalleridname':_0x1167f7[_0x1046('0x20')],'transfereeconnectedlinenum':_0x1167f7[_0x1046('0x21')],'transfereeconnectedlinename':_0x1167f7[_0x1046('0x22')],'transfereeaccountcode':_0x1167f7[_0x1046('0x23')],'transfereecontext':_0x1167f7[_0x1046('0x24')],'transfereeexten':_0x1167f7[_0x1046('0x25')],'transfereelinkedid':_0x1167f7[_0x1046('0x26')],'isexternal':_0x1167f7['isexternal'],'context':_0x1167f7['origtransferercontext'],'extension':_0x1167f7[_0x1046('0x27')],'type':_0x1046('0x28')},'log':_0x1046('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 3e5309d..43a1878 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 _0xc7a3=['startPredictive','startProgressive','Trunk','Interval','push','length','omit','undefined','values','channels','ami\x20disconnected','map','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','toLowerCase','monitors','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','voicechannel','resolve','StopMixMonitor','destinationchannel','find','stop','/var/spool/asterisk/monitor/','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','trunks','campaigns','run','event','emit','custom:','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','listen','format','%s/%s','name','timers','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','pick','keys','module','Reload','then','message','catch','join','command','Command','Action','content','voiceQueues','hasOwnProperty','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x2efd55,_0x360ac1){_0x2efd55=_0x2efd55-0x0;var _0x5f2405=_0xc7a3[_0x2efd55];return _0x5f2405;};'use strict';var _=require('lodash');var util=require(_0x3c7a('0x0'));var jayson=require(_0x3c7a('0x1'));var schema=require(_0x3c7a('0x2'));var BPromise=require(_0x3c7a('0x3'));var moment=require(_0x3c7a('0x4'));var config=require(_0x3c7a('0x5'));var properties=require('../properties');var ami=require(_0x3c7a('0x6'));exports[_0x3c7a('0x7')]=function(_0x5b06db,_0x9c6b1a,_0x2051ce){return new BPromise(function(_0x2736c1,_0x48e820){var _0x115c8a={'QueuePause':function(_0x4f0608){return new Promise(function(_0x20d36c,_0x5a6fbf){var _0xf7733d=util[_0x3c7a('0x8')](_0x3c7a('0x9'),'SIP',_0x4f0608[_0x3c7a('0xa')]);if(_0x5b06db[_0x3c7a('0xb')]&&_0x5b06db['timers'][_0xf7733d]&&_0x5b06db[_0x3c7a('0xb')][_0xf7733d]['timer']){_0x5b06db[_0x3c7a('0xb')][_0xf7733d]['updateAcw']();}if(_0x5b06db[_0x3c7a('0xc')][_0xf7733d]){_0x5b06db[_0x3c7a('0xc')][_0xf7733d][_0x3c7a('0xd')]({'statePause':_0x4f0608[_0x3c7a('0xe')]?!![]:![]});}_0x20d36c({'code':0xc8,'message':_0x3c7a('0xf')});});},'Reload':function(_0x53e5d7){var _0x321e1b=this;return new Promise(function(_0xc61ff3,_0x4103db){if(ami[_0x3c7a('0x10')]()==![]){return _0x4103db(_0x321e1b[_0x3c7a('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x3c7a('0x12')][_0x3c7a('0x13')],'ami\x20disconnected']['join']('\x20')));}_0x53e5d7=_[_0x3c7a('0x14')](_0x53e5d7,_[_0x3c7a('0x15')](properties[_0x3c7a('0x16')]));_0x53e5d7['action']=_0x3c7a('0x17');return ami['Action'](_0x53e5d7)[_0x3c7a('0x18')](function(_0x22e7a5){_0xc61ff3({'code':0xc8,'message':_0x22e7a5[_0x3c7a('0x19')]});})[_0x3c7a('0x1a')](function(_0x3cb5bf){_0x4103db(_0x321e1b[_0x3c7a('0x11')](0x1f5,_0x3cb5bf['message']));});});},'Command':function(_0x1a11ef){var _0x2db9df=this;return new Promise(function(_0x3f0024,_0xbe7a8f){if(ami[_0x3c7a('0x10')]()==![]){return _0xbe7a8f(_0x2db9df[_0x3c7a('0x11')](0x1f4,[config[_0x3c7a('0x12')]['ip'],config[_0x3c7a('0x12')][_0x3c7a('0x13')],'ami\x20disconnected'][_0x3c7a('0x1b')]('\x20')));}_0x1a11ef=_['pick'](_0x1a11ef,_0x3c7a('0x1c'));_0x1a11ef['action']=_0x3c7a('0x1d');return ami[_0x3c7a('0x1e')](_0x1a11ef)[_0x3c7a('0x18')](function(_0x7dbe38){_0x3f0024({'code':0xc8,'message':_0x7dbe38[_0x3c7a('0x1f')]});})[_0x3c7a('0x1a')](function(_0x8251d4){_0xbe7a8f(_0x2db9df[_0x3c7a('0x11')](0x1f5,_0x8251d4[_0x3c7a('0x19')]));});});},'VoiceQueues':function(_0x42bcbe){return new Promise(function(_0x2cc413,_0x317fbd){var _0x56539f=[];for(var _0x3984a1 in _0x5b06db[_0x3c7a('0x20')]){if(_0x5b06db[_0x3c7a('0x20')][_0x3c7a('0x21')](_0x3984a1)){var _0x9b910c=_0x5b06db[_0x3c7a('0x20')][_0x3984a1];var _0x2c000f={'id':_0x9b910c['id'],'name':_0x9b910c[_0x3c7a('0xa')],'strategy':_0x9b910c['strategy'],'answered':_0x9b910c[_0x3c7a('0x22')],'available':_0x9b910c[_0x3c7a('0x23')],'loggedIn':_0x9b910c[_0x3c7a('0x24')],'pTalking':_0x9b910c[_0x3c7a('0x25')],'sumBillable':_0x9b910c[_0x3c7a('0x26')],'sumDuration':_0x9b910c[_0x3c7a('0x27')],'sumHoldTime':_0x9b910c[_0x3c7a('0x28')]||0x0,'talking':_0x9b910c[_0x3c7a('0x29')],'total':_0x9b910c[_0x3c7a('0x2a')],'type':_0x9b910c[_0x3c7a('0x2b')],'unmanaged':_0x9b910c[_0x3c7a('0x2c')],'abandoned':_0x9b910c[_0x3c7a('0x2d')],'waiting':_0x9b910c[_0x3c7a('0x2e')],'loggedInDb':_0x9b910c[_0x3c7a('0x2f')]};if(_0x9b910c[_0x3c7a('0x2b')]===_0x3c7a('0x30')){_0x2c000f[_0x3c7a('0x31')]=_0x9b910c[_0x3c7a('0x31')];_0x2c000f[_0x3c7a('0x32')]=_0x9b910c[_0x3c7a('0x32')];_0x2c000f[_0x3c7a('0x33')]=_0x9b910c[_0x3c7a('0x33')];_0x2c000f['dialOriginateCallerIdNumber']=_0x9b910c['dialOriginateCallerIdNumber'];_0x2c000f['dialOriginateTimeout']=_0x9b910c['dialOriginateTimeout'];_0x2c000f[_0x3c7a('0x34')]=_0x9b910c[_0x3c7a('0x34')];_0x2c000f[_0x3c7a('0x35')]=_0x9b910c[_0x3c7a('0x35')];_0x2c000f[_0x3c7a('0x36')]=_0x9b910c[_0x3c7a('0x36')];_0x2c000f[_0x3c7a('0x37')]=_0x9b910c[_0x3c7a('0x37')];_0x2c000f[_0x3c7a('0x38')]=_0x9b910c[_0x3c7a('0x38')];_0x2c000f[_0x3c7a('0x39')]=_0x9b910c[_0x3c7a('0x39')];_0x2c000f[_0x3c7a('0x3a')]=_0x9b910c[_0x3c7a('0x3a')];_0x2c000f['outboundDropCallsDayACS']=_0x9b910c[_0x3c7a('0x3b')];_0x2c000f[_0x3c7a('0x3c')]=_0x9b910c['outboundDropCallsDayCallersExit'];_0x2c000f[_0x3c7a('0x3d')]=_0x9b910c['outboundDropCallsDayTimeout'];_0x2c000f[_0x3c7a('0x3e')]=_0x9b910c[_0x3c7a('0x3e')];_0x2c000f['outboundNoSuchCallsDay']=_0x9b910c[_0x3c7a('0x3f')];_0x2c000f[_0x3c7a('0x40')]=_0x9b910c[_0x3c7a('0x40')];_0x2c000f[_0x3c7a('0x41')]=_0x9b910c[_0x3c7a('0x41')];_0x2c000f[_0x3c7a('0x42')]=_0x9b910c[_0x3c7a('0x42')];_0x2c000f[_0x3c7a('0x43')]=_0x9b910c[_0x3c7a('0x43')];_0x2c000f[_0x3c7a('0x44')]=_0x9b910c['predictiveIntervalAnsweredCalls'];_0x2c000f[_0x3c7a('0x45')]=_0x9b910c[_0x3c7a('0x45')];_0x2c000f[_0x3c7a('0x46')]=_0x9b910c[_0x3c7a('0x46')];_0x2c000f[_0x3c7a('0x47')]=_0x9b910c[_0x3c7a('0x47')];_0x2c000f[_0x3c7a('0x48')]=_0x9b910c[_0x3c7a('0x48')];_0x2c000f['predictiveIntervalErlangCalls']=_0x9b910c[_0x3c7a('0x49')];_0x2c000f[_0x3c7a('0x4a')]=_0x9b910c['predictiveIntervalErlangCallsDroppedCalls'];_0x2c000f[_0x3c7a('0x4b')]=_0x9b910c['predictiveIntervalHitRate'];_0x2c000f['predictiveIntervalMultiplicativeFactor']=_0x9b910c['predictiveIntervalMultiplicativeFactor'];_0x2c000f['predictiveIntervalPauses']=_0x9b910c[_0x3c7a('0x4c')];_0x2c000f[_0x3c7a('0x4d')]=_0x9b910c[_0x3c7a('0x4d')];_0x2c000f['predictiveIntervalTotalCalls']=_0x9b910c[_0x3c7a('0x4e')];_0x2c000f[_0x3c7a('0x19')]=_0x9b910c['message'];_0x2c000f['originated']=_0x9b910c['originated'];_0x2c000f[_0x3c7a('0x4f')]=_0x9b910c[_0x3c7a('0x4f')];_0x2c000f[_0x3c7a('0x50')]=_0x9b910c[_0x3c7a('0x50')];_0x2c000f[_0x3c7a('0x51')]=_0x9b910c[_0x3c7a('0x51')];_0x2c000f[_0x3c7a('0x52')]=_0x9b910c[_0x3c7a('0x52')];_0x2c000f[_0x3c7a('0x53')]=_0x9b910c[_0x3c7a('0x53')];_0x2c000f[_0x3c7a('0x54')]=_0x9b910c[_0x3c7a('0x54')];}if(_0x9b910c[_0x3c7a('0x55')]){_0x2c000f[_0x3c7a('0x55')]={'id':_0x9b910c[_0x3c7a('0x55')]['id'],'name':_0x9b910c['Trunk'][_0x3c7a('0xa')],'active':_0x9b910c[_0x3c7a('0x55')]['active'],'callerid':_0x9b910c['Trunk']['callerid']};}if(_0x9b910c[_0x3c7a('0x56')]){_0x2c000f[_0x3c7a('0x56')]={'id':_0x9b910c[_0x3c7a('0x56')]['id'],'name':_0x9b910c[_0x3c7a('0x56')][_0x3c7a('0xa')]};}_0x56539f[_0x3c7a('0x57')](_0x2c000f);}}_0x2cc413({'count':_0x56539f[_0x3c7a('0x58')],'rows':_0x56539f});});},'UpdateVoiceQueue':function(_0x3701c5){return new Promise(function(_0x1f70c4,_0x261cfc){var _0x446791=_['find'](_0x5b06db['voiceQueues'],{'id':parseInt(_0x3701c5['id'])});var _0x5bf455=_[_0x3c7a('0x59')](_0x3701c5,['id']);if(_0x446791){for(var _0x323a4d in _0x5bf455){if(typeof _0x5bf455[_0x323a4d]!==_0x3c7a('0x5a')&&typeof _0x446791[_0x323a4d]!==_0x3c7a('0x5a')){_0x446791[_0x323a4d]=_0x5bf455[_0x323a4d];}}_0x1f70c4(_0x446791);}else{_0x261cfc();}});},'VoiceChannels':function(_0x229862){return new Promise(function(_0x5d8062,_0xd67159){var _0x12b69a=_[_0x3c7a('0x5b')](_0x5b06db[_0x3c7a('0x5c')]);_0x5d8062({'count':_0x12b69a[_0x3c7a('0x58')],'rows':_0x12b69a});});},'VoiceChannelMixMonitor':function(_0x1e3cc7){var _0x330572=this;return new Promise(function(_0x5362ec,_0x519831){if(ami[_0x3c7a('0x10')]()==![]){return _0x519831(_0x330572[_0x3c7a('0x11')](0x1f4,[config[_0x3c7a('0x12')]['ip'],config[_0x3c7a('0x12')][_0x3c7a('0x13')],_0x3c7a('0x5d')]['join']('\x20')));}var _0x22fbd0=schema(properties['voicechannel'])['validate'](_0x1e3cc7);if(_0x22fbd0[_0x3c7a('0x58')]>0x0){return _0x519831(_0x330572[_0x3c7a('0x11')](0x1f4,_[_0x3c7a('0x5e')](_0x22fbd0,'message')['join'](',\x20')));}var _0x4ba11a=_['find'](_0x5b06db[_0x3c7a('0x5c')],{'uniqueid':_0x1e3cc7[_0x3c7a('0x5f')]});if(_0x4ba11a&&_0x4ba11a[_0x3c7a('0x60')]){var _0x1a26ed=util[_0x3c7a('0x8')](_0x3c7a('0x61'),_0x1e3cc7[_0x3c7a('0x62')]||_0x1e3cc7[_0x3c7a('0x5f')],_0x1e3cc7[_0x3c7a('0x8')]||_0x3c7a('0x63'));return ami[_0x3c7a('0x1e')]({'action':_0x3c7a('0x64'),'channel':_0x4ba11a[_0x3c7a('0x60')],'file':_0x1a26ed,'options':_0x3c7a('0x65')})[_0x3c7a('0x18')](function(_0x5eb534){var _0x565335=_['find'](_0x4ba11a['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x1a26ed[_0x3c7a('0x66')]()});if(_['isNil'](_0x565335)){_0x4ba11a[_0x3c7a('0x67')][_0x3c7a('0x57')]({'filename':'/var/spool/asterisk/monitor/'+_0x1a26ed[_0x3c7a('0x66')](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x5eb534[_0x3c7a('0x68')],'status':_0x3c7a('0x69')});}else{_0x565335[_0x3c7a('0x68')]=_0x5eb534['mixmonitorid'];_0x565335[_0x3c7a('0x6a')]='rec';}_0x5362ec({'code':0xc8,'message':[_0x1e3cc7[_0x3c7a('0x5f')],'MixMonitor\x20Success',_0x5eb534[_0x3c7a('0x68')]][_0x3c7a('0x1b')]('\x20'),'mixmonitorid':_0x5eb534['mixmonitorid']});})[_0x3c7a('0x1a')](function(_0x16ef19){_0x519831(_0x330572[_0x3c7a('0x11')](0x1f5,[_0x1e3cc7[_0x3c7a('0x5f')],_0x16ef19[_0x3c7a('0x19')][_0x3c7a('0x66')]()][_0x3c7a('0x1b')]('\x20')));});}else{return _0x519831(_0x330572['error'](0x1f5,_0x3c7a('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x1db008){var _0x5adbca=this;return new Promise(function(_0x2eeea4,_0x5d8d5d){if(ami[_0x3c7a('0x10')]()==![]){return _0x5d8d5d(_0x5adbca[_0x3c7a('0x11')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x3c7a('0x13')],_0x3c7a('0x5d')]['join']('\x20')));}var _0x3a3341=schema(properties[_0x3c7a('0x6c')])[_0x3c7a('0x2')](_0x1db008);if(_0x3a3341[_0x3c7a('0x58')]>0x0){return _0x5d8d5d(_0x5adbca['error'](0x1f4,_[_0x3c7a('0x5e')](_0x3a3341,'message')[_0x3c7a('0x1b')](',\x20')));}var _0x11c49f=_['find'](_0x5b06db['channels'],{'uniqueid':_0x1db008['uniqueid']});if(_0x11c49f){return BPromise[_0x3c7a('0x6d')]()[_0x3c7a('0x18')](function(){if(_0x11c49f[_0x3c7a('0x60')]){return ami[_0x3c7a('0x1e')]({'action':_0x3c7a('0x6e'),'channel':_0x11c49f[_0x3c7a('0x60')],'mixmonitorid':_0x1db008[_0x3c7a('0x68')]})['catch'](function(_0x115390){});}})[_0x3c7a('0x18')](function(){if(_0x11c49f['destinationchannel']){return ami['Action']({'action':_0x3c7a('0x6e'),'channel':_0x11c49f[_0x3c7a('0x6f')],'mixmonitorid':_0x1db008[_0x3c7a('0x68')]})['catch'](function(_0x3c7fb5){});}})[_0x3c7a('0x18')](function(_0x1ab8d9){var _0xd2170a=_[_0x3c7a('0x70')](_0x11c49f[_0x3c7a('0x67')],{'mixmonitorid':_0x1db008[_0x3c7a('0x68')]});if(_0xd2170a){_0xd2170a[_0x3c7a('0x6a')]=_0x3c7a('0x71');}})[_0x3c7a('0x18')](function(){var _0x5c36df=util[_0x3c7a('0x8')](_0x3c7a('0x61'),_0x1db008[_0x3c7a('0x62')]||_0x1db008['uniqueid'],_0x1db008[_0x3c7a('0x8')]||'wav');var _0x44829d=_['find'](_0x11c49f['monitors'],{'filename':_0x3c7a('0x72')+_0x5c36df[_0x3c7a('0x66')]()});if(_0x44829d){_0x44829d[_0x3c7a('0x6a')]='stop';}})[_0x3c7a('0x18')](function(){_0x2eeea4({'code':0xc8,'message':[_0x1db008[_0x3c7a('0x5f')],'StopMixMonitor\x20Success'][_0x3c7a('0x1b')]('\x20')});})[_0x3c7a('0x1a')](function(_0x2e6fe9){_0x5d8d5d(_0x5adbca['error'](0x1f5,[_0x1db008[_0x3c7a('0x5f')],_0x2e6fe9[_0x3c7a('0x19')][_0x3c7a('0x66')]()][_0x3c7a('0x1b')]('\x20')));});}else{return _0x5d8d5d(_0x5adbca[_0x3c7a('0x11')](0x1f5,_0x3c7a('0x6b')));}});},'VoiceQueuesChannels':function(_0x53a92a){return new Promise(function(_0x215fad,_0x1ced2f){var _0xb12efb=_['values'](_0x5b06db[_0x3c7a('0x73')]);_0x215fad({'count':_0xb12efb[_0x3c7a('0x58')],'rows':_0xb12efb});});},'VoiceQueuesChannel':function(_0x50b0e5){var _0x56bc3f=this;return new Promise(function(_0x3a2728,_0x55307f){var _0x3a0151=schema(properties[_0x3c7a('0x74')])[_0x3c7a('0x2')](_0x50b0e5);if(_0x3a0151['length']>0x0){return _0x55307f(_0x56bc3f[_0x3c7a('0x11')](0x1f4,_[_0x3c7a('0x5e')](_0x3a0151,_0x3c7a('0x19'))[_0x3c7a('0x1b')](',\x20')));}var _0x3e976b=_[_0x3c7a('0x70')](_0x5b06db[_0x3c7a('0x73')],{'uniqueid':_0x50b0e5[_0x3c7a('0x5f')]});if(_0x3e976b){_0x3a2728(_0x3e976b);}else{return _0x55307f(_0x56bc3f[_0x3c7a('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x2646db){var _0x205938=this;return new Promise(function(_0x589289,_0xd7d5d7){if(ami[_0x3c7a('0x10')]()==![]){return _0xd7d5d7(_0x205938[_0x3c7a('0x11')](0x1f4,[config[_0x3c7a('0x12')]['ip'],config['asterisk'][_0x3c7a('0x13')],'ami\x20disconnected']['join']('\x20')));}var _0x5d4f9f=schema(properties[_0x3c7a('0x75')])['validate'](_0x2646db);if(_0x5d4f9f[_0x3c7a('0x58')]>0x0){return _0xd7d5d7(_0x205938[_0x3c7a('0x11')](0x1f4,_[_0x3c7a('0x5e')](_0x5d4f9f,_0x3c7a('0x19'))[_0x3c7a('0x1b')](',\x20')));}var _0x3a0774=_[_0x3c7a('0x70')](_0x5b06db['queueChannels'],{'uniqueid':_0x2646db[_0x3c7a('0x5f')]});if(_0x3a0774&&_0x3a0774[_0x3c7a('0x60')]){return ami[_0x3c7a('0x1e')]({'action':_0x3c7a('0x76'),'channel':_0x3a0774['channel']})[_0x3c7a('0x18')](function(_0x177ca7){_0x589289({'code':0xc8,'message':[_0x2646db['uniqueid'],_0x177ca7[_0x3c7a('0x19')]['toLowerCase']()][_0x3c7a('0x1b')]('\x20')});})[_0x3c7a('0x1a')](function(_0x335694){_0xd7d5d7(_0x205938[_0x3c7a('0x11')](0x1f5,[_0x2646db[_0x3c7a('0x5f')],_0x335694[_0x3c7a('0x19')][_0x3c7a('0x66')]()][_0x3c7a('0x1b')]('\x20')));});}else{return _0xd7d5d7(_0x205938['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x23722c){var _0x4cdf9d=this;return new Promise(function(_0x44aad1,_0x33b91d){if(ami[_0x3c7a('0x10')]()==![]){return _0x33b91d(_0x4cdf9d[_0x3c7a('0x11')](0x1f4,[config[_0x3c7a('0x12')]['ip'],config[_0x3c7a('0x12')]['username'],'ami\x20disconnected'][_0x3c7a('0x1b')]('\x20')));}var _0x2b6c5f=schema(properties[_0x3c7a('0x77')])[_0x3c7a('0x2')](_0x23722c);if(_0x2b6c5f['length']>0x0){return _0x33b91d(_0x4cdf9d[_0x3c7a('0x11')](0x1f4,_['map'](_0x2b6c5f,'message')[_0x3c7a('0x1b')](',\x20')));}var _0x38ba3e=_[_0x3c7a('0x70')](_0x5b06db[_0x3c7a('0x73')],{'uniqueid':_0x23722c[_0x3c7a('0x5f')]});if(_0x38ba3e&&_0x38ba3e['channel']){return ami[_0x3c7a('0x1e')]({'action':_0x3c7a('0x78'),'channel':_0x38ba3e[_0x3c7a('0x60')],'exten':_0x23722c['exten'],'context':_0x23722c[_0x3c7a('0x79')]||_0x38ba3e[_0x3c7a('0x79')],'priority':0x1})['then'](function(_0x10b2fc){_0x44aad1({'code':0xc8,'message':[_0x23722c[_0x3c7a('0x5f')],_0x10b2fc[_0x3c7a('0x19')]['toLowerCase']()][_0x3c7a('0x1b')]('\x20')});})[_0x3c7a('0x1a')](function(_0x57f9b7){_0x33b91d(_0x4cdf9d[_0x3c7a('0x11')](0x1f5,[_0x23722c['uniqueid'],_0x57f9b7[_0x3c7a('0x19')][_0x3c7a('0x66')]()][_0x3c7a('0x1b')]('\x20')));});}else{return _0x33b91d(_0x4cdf9d[_0x3c7a('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x1d5b57){return new Promise(function(_0x29d45c,_0x3a1991){var _0x24c0a1=_[_0x3c7a('0x5b')](_0x5b06db[_0x3c7a('0xc')]);_0x29d45c({'count':_0x24c0a1[_0x3c7a('0x58')],'rows':_0x24c0a1});});},'Telephones':function(_0x3afc6b){return new Promise(function(_0xecd1f7,_0x4e0757){var _0x523f40=_[_0x3c7a('0x5b')](_0x5b06db['telephones']);_0xecd1f7({'count':_0x523f40['length'],'rows':_0x523f40});});},'Trunks':function(_0x1a9f26){return new Promise(function(_0x1354fd,_0x2acdc7){var _0x472d00=_[_0x3c7a('0x5b')](_0x5b06db[_0x3c7a('0x7a')]);_0x1354fd({'count':_0x472d00[_0x3c7a('0x58')],'rows':_0x472d00});});},'OutboundChannels':function(_0x54122c){return new Promise(function(_0x158c30,_0x423077){var _0x4ea13a=_[_0x3c7a('0x5b')](_0x5b06db['outboundChannels']);_0x158c30({'count':_0x4ea13a[_0x3c7a('0x58')],'rows':_0x4ea13a});});},'Outbound':function(_0x5ad537){return new Promise(function(_0x4b3074,_0x403f19){_0x4b3074(_0x5b06db[_0x3c7a('0x30')]);});},'Campaigns':function(_0x4268bf){return new Promise(function(_0x4593e2,_0x2efa30){var _0xada250=_[_0x3c7a('0x5b')](_0x5b06db[_0x3c7a('0x7b')]);_0x4593e2({'count':_0xada250[_0x3c7a('0x58')],'rows':_0xada250});});},'VoiceQueuesPreview':function(_0x577dc0){var _0x55fb9b=this;return new Promise(function(_0x22b0e2,_0x101d5e){_0x9c6b1a[_0x3c7a('0x7c')](_0x577dc0['id'])[_0x3c7a('0x18')](function(_0x298f3b){_0x22b0e2({'code':0xc8,'message':_0x298f3b[_0x3c7a('0x19')]});})[_0x3c7a('0x1a')](function(_0x13c3e1){_0x101d5e(_0x55fb9b['error'](0x1f4,_0x13c3e1[_0x3c7a('0x19')]));});});},'EventManager':function(_0x56ec85){var _0x7c618f=this;return new Promise(function(_0x36419c,_0x554f87){if(!_0x56ec85[_0x3c7a('0x7d')]){return _0x554f87(_0x7c618f[_0x3c7a('0x11')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x3c7a('0x7e')](_0x3c7a('0x7f')+_0x56ec85[_0x3c7a('0x7d')],_0x56ec85['message']);_0x36419c({'code':0xc8,'message':_0x56ec85});});},'FaxAccounts':function(_0x369e4a){return new Promise(function(_0x4f5b7f,_0x1846c8){var _0x34ba52=_[_0x3c7a('0x5b')](_0x5b06db[_0x3c7a('0x80')]);_0x4f5b7f({'count':_0x34ba52[_0x3c7a('0x58')],'rows':_0x34ba52});});},'SendFax':function(_0x1e5f89){var _0x37178b=this;return new Promise(function(_0x19fe75,_0x43496a){_0x2051ce[_0x3c7a('0x81')](_0x1e5f89)[_0x3c7a('0x18')](function(_0x50b5a5){_0x19fe75({'code':0xc8,'message':_0x50b5a5[_0x3c7a('0x19')]});})[_0x3c7a('0x1a')](function(_0x202508){_0x43496a(_0x37178b['error'](0x1f4,_0x202508['message']));});});},'CheckAfterSend':function(_0x4ed6ee){var _0x382022=this;return new Promise(function(_0x501c18,_0x369429){_0x2051ce[_0x3c7a('0x82')](_0x4ed6ee)['then'](function(_0x5266c7){_0x501c18({'code':0xc8,'message':_0x5266c7['message']});})[_0x3c7a('0x1a')](function(_0x53a5b7){_0x369429(_0x382022[_0x3c7a('0x11')](0x1f4,_0x53a5b7[_0x3c7a('0x19')]));});});}};var _0x13f2d0=jayson[_0x3c7a('0x83')](_0x115c8a)['http']();_0x13f2d0['on'](_0x3c7a('0x11'),function(_0x386355){return _0x48e820(_0x386355);});_0x13f2d0[_0x3c7a('0x7')](0x232a,_0x3c7a('0x84'),function(){console[_0x3c7a('0x85')](_0x3c7a('0x86'),0x232a);return _0x2736c1(_0x3c7a('0x87')+0x232a);});});}; \ No newline at end of file +var _0x187d=['outboundChannels','outbound','run','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','listen','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','pick','action','then','message','catch','error','Command','Action','hasOwnProperty','voiceQueues','strategy','answered','loggedIn','pTalking','sumBillable','sumHoldTime','total','type','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','join','uniqueid','channel','format','%s.%s','filename','wav','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','context','telephones'];(function(_0x4624f8,_0xded3a){var _0x27209b=function(_0x5dbfa0){while(--_0x5dbfa0){_0x4624f8['push'](_0x4624f8['shift']());}};_0x27209b(++_0xded3a);}(_0x187d,0x93));var _0xd187=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x187d[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var jayson=require(_0xd187('0x1'));var schema=require(_0xd187('0x2'));var BPromise=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var config=require(_0xd187('0x5'));var properties=require(_0xd187('0x6'));var ami=require('../ami');exports[_0xd187('0x7')]=function(_0x163807,_0x4ebc8d,_0x1d2533){return new BPromise(function(_0x58ee7,_0x444a60){var _0x1d3fe4={'QueuePause':function(_0x28ce2f){return new Promise(function(_0x2d6992,_0x358c45){var _0x461a44=util['format'](_0xd187('0x8'),_0xd187('0x9'),_0x28ce2f[_0xd187('0xa')]);if(_0x163807[_0xd187('0xb')]&&_0x163807[_0xd187('0xb')][_0x461a44]&&_0x163807[_0xd187('0xb')][_0x461a44]['timer']){_0x163807[_0xd187('0xb')][_0x461a44][_0xd187('0xc')]();}if(_0x163807[_0xd187('0xd')][_0x461a44]){_0x163807['agents'][_0x461a44][_0xd187('0xe')]({'statePause':_0x28ce2f[_0xd187('0xf')]?!![]:![]});}_0x2d6992({'code':0xc8,'message':_0xd187('0x10')});});},'Reload':function(_0x59ee4a){var _0x33e3d5=this;return new Promise(function(_0x18ce42,_0x37870e){if(ami[_0xd187('0x11')]()==![]){return _0x37870e(_0x33e3d5['error'](0x1f4,[config[_0xd187('0x12')]['ip'],config[_0xd187('0x12')][_0xd187('0x13')],_0xd187('0x14')]['join']('\x20')));}_0x59ee4a=_[_0xd187('0x15')](_0x59ee4a,_['keys'](properties['module']));_0x59ee4a[_0xd187('0x16')]='Reload';return ami['Action'](_0x59ee4a)[_0xd187('0x17')](function(_0x2b3290){_0x18ce42({'code':0xc8,'message':_0x2b3290[_0xd187('0x18')]});})[_0xd187('0x19')](function(_0x21df74){_0x37870e(_0x33e3d5[_0xd187('0x1a')](0x1f5,_0x21df74[_0xd187('0x18')]));});});},'Command':function(_0x369809){var _0x4f2f88=this;return new Promise(function(_0x46fca3,_0x170d5c){if(ami[_0xd187('0x11')]()==![]){return _0x170d5c(_0x4f2f88[_0xd187('0x1a')](0x1f4,[config['asterisk']['ip'],config[_0xd187('0x12')][_0xd187('0x13')],_0xd187('0x14')]['join']('\x20')));}_0x369809=_['pick'](_0x369809,'command');_0x369809[_0xd187('0x16')]=_0xd187('0x1b');return ami[_0xd187('0x1c')](_0x369809)['then'](function(_0x2c07c8){_0x46fca3({'code':0xc8,'message':_0x2c07c8['content']});})[_0xd187('0x19')](function(_0x5a7a23){_0x170d5c(_0x4f2f88[_0xd187('0x1a')](0x1f5,_0x5a7a23['message']));});});},'VoiceQueues':function(_0x4f3879){return new Promise(function(_0x2c76fd,_0x4d992b){var _0x12da33=[];for(var _0x598aa4 in _0x163807['voiceQueues']){if(_0x163807['voiceQueues'][_0xd187('0x1d')](_0x598aa4)){var _0xeff822=_0x163807[_0xd187('0x1e')][_0x598aa4];var _0x4a7f6f={'id':_0xeff822['id'],'name':_0xeff822['name'],'strategy':_0xeff822[_0xd187('0x1f')],'answered':_0xeff822[_0xd187('0x20')],'available':_0xeff822['available'],'loggedIn':_0xeff822[_0xd187('0x21')],'pTalking':_0xeff822[_0xd187('0x22')],'sumBillable':_0xeff822[_0xd187('0x23')],'sumDuration':_0xeff822['sumDuration'],'sumHoldTime':_0xeff822[_0xd187('0x24')]||0x0,'talking':_0xeff822['talking'],'total':_0xeff822[_0xd187('0x25')],'type':_0xeff822[_0xd187('0x26')],'unmanaged':_0xeff822[_0xd187('0x27')],'abandoned':_0xeff822[_0xd187('0x28')],'waiting':_0xeff822['waiting'],'loggedInDb':_0xeff822[_0xd187('0x29')]};if(_0xeff822[_0xd187('0x26')]==='outbound'){_0x4a7f6f['dialActive']=_0xeff822[_0xd187('0x2a')];_0x4a7f6f[_0xd187('0x2b')]=_0xeff822[_0xd187('0x2b')];_0x4a7f6f[_0xd187('0x2c')]=_0xeff822[_0xd187('0x2c')];_0x4a7f6f[_0xd187('0x2d')]=_0xeff822[_0xd187('0x2d')];_0x4a7f6f[_0xd187('0x2e')]=_0xeff822['dialOriginateTimeout'];_0x4a7f6f[_0xd187('0x2f')]=_0xeff822[_0xd187('0x2f')];_0x4a7f6f[_0xd187('0x30')]=_0xeff822['temp'];_0x4a7f6f[_0xd187('0x31')]=_0xeff822['outboundAnswerAgiCallsDay'];_0x4a7f6f[_0xd187('0x32')]=_0xeff822[_0xd187('0x32')];_0x4a7f6f[_0xd187('0x33')]=_0xeff822['outboundBlacklistCallsDay'];_0x4a7f6f['outboundBusyCallsDay']=_0xeff822[_0xd187('0x34')];_0x4a7f6f[_0xd187('0x35')]=_0xeff822['outboundCongestionCallsDay'];_0x4a7f6f[_0xd187('0x36')]=_0xeff822[_0xd187('0x36')];_0x4a7f6f[_0xd187('0x37')]=_0xeff822['outboundDropCallsDayCallersExit'];_0x4a7f6f['outboundDropCallsDayTimeout']=_0xeff822[_0xd187('0x38')];_0x4a7f6f[_0xd187('0x39')]=_0xeff822['outboundNoAnswerCallsDay'];_0x4a7f6f['outboundNoSuchCallsDay']=_0xeff822['outboundNoSuchCallsDay'];_0x4a7f6f[_0xd187('0x3a')]=_0xeff822['outboundOriginateFailureCallsDay'];_0x4a7f6f[_0xd187('0x3b')]=_0xeff822[_0xd187('0x3b')];_0x4a7f6f['outboundRejectCallsDay']=_0xeff822[_0xd187('0x3c')];_0x4a7f6f['outboundUnknownCallsDay']=_0xeff822[_0xd187('0x3d')];_0x4a7f6f[_0xd187('0x3e')]=_0xeff822['predictiveIntervalAnsweredCalls'];_0x4a7f6f[_0xd187('0x3f')]=_0xeff822[_0xd187('0x3f')];_0x4a7f6f['predictiveIntervalAvgTalktime']=_0xeff822[_0xd187('0x40')];_0x4a7f6f['predictiveIntervalDroppedCallsCallersExit']=_0xeff822['predictiveIntervalDroppedCallsCallersExit'];_0x4a7f6f[_0xd187('0x41')]=_0xeff822[_0xd187('0x41')];_0x4a7f6f[_0xd187('0x42')]=_0xeff822[_0xd187('0x42')];_0x4a7f6f[_0xd187('0x43')]=_0xeff822['predictiveIntervalErlangCallsDroppedCalls'];_0x4a7f6f[_0xd187('0x44')]=_0xeff822[_0xd187('0x44')];_0x4a7f6f[_0xd187('0x45')]=_0xeff822['predictiveIntervalMultiplicativeFactor'];_0x4a7f6f['predictiveIntervalPauses']=_0xeff822['predictiveIntervalPauses'];_0x4a7f6f['predictiveIntervalAvailable']=_0xeff822[_0xd187('0x46')];_0x4a7f6f[_0xd187('0x47')]=_0xeff822[_0xd187('0x47')];_0x4a7f6f[_0xd187('0x18')]=_0xeff822[_0xd187('0x18')];_0x4a7f6f[_0xd187('0x48')]=_0xeff822[_0xd187('0x48')];_0x4a7f6f[_0xd187('0x49')]=_0xeff822['erlangCalls'];_0x4a7f6f[_0xd187('0x4a')]=_0xeff822[_0xd187('0x4a')];_0x4a7f6f[_0xd187('0x4b')]=_0xeff822['erlangAbandonmentRate'];_0x4a7f6f[_0xd187('0x4c')]=_0xeff822['erlangBusyFactor'];_0x4a7f6f[_0xd187('0x4d')]=_0xeff822[_0xd187('0x4d')];_0x4a7f6f[_0xd187('0x4e')]=_0xeff822[_0xd187('0x4e')];}if(_0xeff822[_0xd187('0x4f')]){_0x4a7f6f['Trunk']={'id':_0xeff822[_0xd187('0x4f')]['id'],'name':_0xeff822[_0xd187('0x4f')][_0xd187('0xa')],'active':_0xeff822[_0xd187('0x4f')]['active'],'callerid':_0xeff822[_0xd187('0x4f')][_0xd187('0x50')]};}if(_0xeff822['Interval']){_0x4a7f6f[_0xd187('0x51')]={'id':_0xeff822[_0xd187('0x51')]['id'],'name':_0xeff822['Interval']['name']};}_0x12da33[_0xd187('0x52')](_0x4a7f6f);}}_0x2c76fd({'count':_0x12da33[_0xd187('0x53')],'rows':_0x12da33});});},'UpdateVoiceQueue':function(_0x505764){return new Promise(function(_0x4c9c5f,_0x4f616d){var _0x2f78da=_[_0xd187('0x54')](_0x163807[_0xd187('0x1e')],{'id':parseInt(_0x505764['id'])});var _0x248d6e=_[_0xd187('0x55')](_0x505764,['id']);if(_0x2f78da){for(var _0x60062b in _0x248d6e){if(typeof _0x248d6e[_0x60062b]!==_0xd187('0x56')&&typeof _0x2f78da[_0x60062b]!=='undefined'){_0x2f78da[_0x60062b]=_0x248d6e[_0x60062b];}}_0x4c9c5f(_0x2f78da);}else{_0x4f616d();}});},'VoiceChannels':function(_0x30bfb5){return new Promise(function(_0x12784c,_0x255c97){var _0x3ce4a1=_[_0xd187('0x57')](_0x163807[_0xd187('0x58')]);_0x12784c({'count':_0x3ce4a1[_0xd187('0x53')],'rows':_0x3ce4a1});});},'VoiceChannelMixMonitor':function(_0x3400a0){var _0x4e4a32=this;return new Promise(function(_0x368348,_0x2657be){if(ami[_0xd187('0x11')]()==![]){return _0x2657be(_0x4e4a32[_0xd187('0x1a')](0x1f4,[config[_0xd187('0x12')]['ip'],config['asterisk'][_0xd187('0x13')],_0xd187('0x14')]['join']('\x20')));}var _0x429c48=schema(properties[_0xd187('0x59')])['validate'](_0x3400a0);if(_0x429c48['length']>0x0){return _0x2657be(_0x4e4a32['error'](0x1f4,_['map'](_0x429c48,_0xd187('0x18'))[_0xd187('0x5a')](',\x20')));}var _0x12d448=_[_0xd187('0x54')](_0x163807[_0xd187('0x58')],{'uniqueid':_0x3400a0[_0xd187('0x5b')]});if(_0x12d448&&_0x12d448[_0xd187('0x5c')]){var _0x5104db=util[_0xd187('0x5d')](_0xd187('0x5e'),_0x3400a0[_0xd187('0x5f')]||_0x3400a0[_0xd187('0x5b')],_0x3400a0['format']||_0xd187('0x60'));return ami['Action']({'action':'MixMonitor','channel':_0x12d448[_0xd187('0x5c')],'file':_0x5104db,'options':'ai(mixmonitorid)'})[_0xd187('0x17')](function(_0x2d4837){var _0x260be7=_[_0xd187('0x54')](_0x12d448[_0xd187('0x61')],{'filename':_0xd187('0x62')+_0x5104db[_0xd187('0x63')]()});if(_[_0xd187('0x64')](_0x260be7)){_0x12d448[_0xd187('0x61')]['push']({'filename':_0xd187('0x62')+_0x5104db[_0xd187('0x63')](),'createdAt':moment()['format'](_0xd187('0x65')),'mixmonitorid':_0x2d4837[_0xd187('0x66')],'status':_0xd187('0x67')});}else{_0x260be7['mixmonitorid']=_0x2d4837[_0xd187('0x66')];_0x260be7[_0xd187('0x68')]='rec';}_0x368348({'code':0xc8,'message':[_0x3400a0[_0xd187('0x5b')],_0xd187('0x69'),_0x2d4837['mixmonitorid']][_0xd187('0x5a')]('\x20'),'mixmonitorid':_0x2d4837['mixmonitorid']});})[_0xd187('0x19')](function(_0x43f1c0){_0x2657be(_0x4e4a32[_0xd187('0x1a')](0x1f5,[_0x3400a0[_0xd187('0x5b')],_0x43f1c0[_0xd187('0x18')][_0xd187('0x63')]()][_0xd187('0x5a')]('\x20')));});}else{return _0x2657be(_0x4e4a32['error'](0x1f5,_0xd187('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0x298b46){var _0x1961c2=this;return new Promise(function(_0x56b36b,_0x374e30){if(ami[_0xd187('0x11')]()==![]){return _0x374e30(_0x1961c2[_0xd187('0x1a')](0x1f4,[config[_0xd187('0x12')]['ip'],config[_0xd187('0x12')][_0xd187('0x13')],_0xd187('0x14')][_0xd187('0x5a')]('\x20')));}var _0x27c36d=schema(properties[_0xd187('0x59')])[_0xd187('0x2')](_0x298b46);if(_0x27c36d[_0xd187('0x53')]>0x0){return _0x374e30(_0x1961c2[_0xd187('0x1a')](0x1f4,_[_0xd187('0x6b')](_0x27c36d,_0xd187('0x18'))[_0xd187('0x5a')](',\x20')));}var _0x42fb32=_[_0xd187('0x54')](_0x163807[_0xd187('0x58')],{'uniqueid':_0x298b46[_0xd187('0x5b')]});if(_0x42fb32){return BPromise['resolve']()[_0xd187('0x17')](function(){if(_0x42fb32['channel']){return ami[_0xd187('0x1c')]({'action':_0xd187('0x6c'),'channel':_0x42fb32[_0xd187('0x5c')],'mixmonitorid':_0x298b46[_0xd187('0x66')]})['catch'](function(_0x3d8507){});}})[_0xd187('0x17')](function(){if(_0x42fb32['destinationchannel']){return ami['Action']({'action':_0xd187('0x6c'),'channel':_0x42fb32[_0xd187('0x6d')],'mixmonitorid':_0x298b46[_0xd187('0x66')]})[_0xd187('0x19')](function(_0x550bc0){});}})[_0xd187('0x17')](function(_0x49543f){var _0x1971b2=_[_0xd187('0x54')](_0x42fb32[_0xd187('0x61')],{'mixmonitorid':_0x298b46[_0xd187('0x66')]});if(_0x1971b2){_0x1971b2['status']=_0xd187('0x6e');}})[_0xd187('0x17')](function(){var _0xd12560=util[_0xd187('0x5d')](_0xd187('0x5e'),_0x298b46['filename']||_0x298b46['uniqueid'],_0x298b46[_0xd187('0x5d')]||_0xd187('0x60'));var _0x167eaf=_[_0xd187('0x54')](_0x42fb32[_0xd187('0x61')],{'filename':_0xd187('0x62')+_0xd12560[_0xd187('0x63')]()});if(_0x167eaf){_0x167eaf[_0xd187('0x68')]=_0xd187('0x6e');}})[_0xd187('0x17')](function(){_0x56b36b({'code':0xc8,'message':[_0x298b46[_0xd187('0x5b')],_0xd187('0x6f')]['join']('\x20')});})[_0xd187('0x19')](function(_0x2cc729){_0x374e30(_0x1961c2['error'](0x1f5,[_0x298b46[_0xd187('0x5b')],_0x2cc729[_0xd187('0x18')]['toLowerCase']()]['join']('\x20')));});}else{return _0x374e30(_0x1961c2[_0xd187('0x1a')](0x1f5,_0xd187('0x6a')));}});},'VoiceQueuesChannels':function(_0x2ac56f){return new Promise(function(_0x2f743b,_0x492397){var _0x325929=_[_0xd187('0x57')](_0x163807['queueChannels']);_0x2f743b({'count':_0x325929['length'],'rows':_0x325929});});},'VoiceQueuesChannel':function(_0x3bca83){var _0x59ef7e=this;return new Promise(function(_0x33c168,_0x2c1153){var _0x557d1c=schema(properties[_0xd187('0x70')])['validate'](_0x3bca83);if(_0x557d1c[_0xd187('0x53')]>0x0){return _0x2c1153(_0x59ef7e['error'](0x1f4,_['map'](_0x557d1c,'message')[_0xd187('0x5a')](',\x20')));}var _0x243063=_[_0xd187('0x54')](_0x163807[_0xd187('0x71')],{'uniqueid':_0x3bca83[_0xd187('0x5b')]});if(_0x243063){_0x33c168(_0x243063);}else{return _0x2c1153(_0x59ef7e[_0xd187('0x1a')](0x1f5,_0xd187('0x6a')));}});},'VoiceQueuesChannelHangup':function(_0x3b61f3){var _0x5b7151=this;return new Promise(function(_0xf1cb15,_0x8b1873){if(ami[_0xd187('0x11')]()==![]){return _0x8b1873(_0x5b7151['error'](0x1f4,[config[_0xd187('0x12')]['ip'],config[_0xd187('0x12')][_0xd187('0x13')],_0xd187('0x14')]['join']('\x20')));}var _0x19cd0e=schema(properties[_0xd187('0x72')])['validate'](_0x3b61f3);if(_0x19cd0e[_0xd187('0x53')]>0x0){return _0x8b1873(_0x5b7151[_0xd187('0x1a')](0x1f4,_[_0xd187('0x6b')](_0x19cd0e,_0xd187('0x18'))['join'](',\x20')));}var _0xbfd74=_[_0xd187('0x54')](_0x163807['queueChannels'],{'uniqueid':_0x3b61f3[_0xd187('0x5b')]});if(_0xbfd74&&_0xbfd74['channel']){return ami['Action']({'action':'Hangup','channel':_0xbfd74[_0xd187('0x5c')]})[_0xd187('0x17')](function(_0x120a03){_0xf1cb15({'code':0xc8,'message':[_0x3b61f3[_0xd187('0x5b')],_0x120a03[_0xd187('0x18')][_0xd187('0x63')]()]['join']('\x20')});})[_0xd187('0x19')](function(_0x8af7bd){_0x8b1873(_0x5b7151['error'](0x1f5,[_0x3b61f3['uniqueid'],_0x8af7bd[_0xd187('0x18')][_0xd187('0x63')]()][_0xd187('0x5a')]('\x20')));});}else{return _0x8b1873(_0x5b7151[_0xd187('0x1a')](0x1f5,_0xd187('0x6a')));}});},'VoiceQueuesChannelRedirect':function(_0xd9d7ac){var _0x561c5e=this;return new Promise(function(_0x206819,_0x134cc2){if(ami[_0xd187('0x11')]()==![]){return _0x134cc2(_0x561c5e[_0xd187('0x1a')](0x1f4,[config[_0xd187('0x12')]['ip'],config[_0xd187('0x12')][_0xd187('0x13')],_0xd187('0x14')][_0xd187('0x5a')]('\x20')));}var _0xf31fac=schema(properties[_0xd187('0x73')])[_0xd187('0x2')](_0xd9d7ac);if(_0xf31fac['length']>0x0){return _0x134cc2(_0x561c5e['error'](0x1f4,_[_0xd187('0x6b')](_0xf31fac,_0xd187('0x18'))[_0xd187('0x5a')](',\x20')));}var _0x147c96=_[_0xd187('0x54')](_0x163807[_0xd187('0x71')],{'uniqueid':_0xd9d7ac['uniqueid']});if(_0x147c96&&_0x147c96[_0xd187('0x5c')]){return ami['Action']({'action':_0xd187('0x74'),'channel':_0x147c96['channel'],'exten':_0xd9d7ac['exten'],'context':_0xd9d7ac[_0xd187('0x75')]||_0x147c96['context'],'priority':0x1})[_0xd187('0x17')](function(_0x44ad5c){_0x206819({'code':0xc8,'message':[_0xd9d7ac[_0xd187('0x5b')],_0x44ad5c[_0xd187('0x18')][_0xd187('0x63')]()][_0xd187('0x5a')]('\x20')});})[_0xd187('0x19')](function(_0x37fd5a){_0x134cc2(_0x561c5e[_0xd187('0x1a')](0x1f5,[_0xd9d7ac[_0xd187('0x5b')],_0x37fd5a[_0xd187('0x18')][_0xd187('0x63')]()][_0xd187('0x5a')]('\x20')));});}else{return _0x134cc2(_0x561c5e[_0xd187('0x1a')](0x1f5,_0xd187('0x6a')));}});},'Agents':function(_0x5626ad){return new Promise(function(_0x524dca,_0x388508){var _0x26c6b6=_[_0xd187('0x57')](_0x163807['agents']);_0x524dca({'count':_0x26c6b6[_0xd187('0x53')],'rows':_0x26c6b6});});},'Telephones':function(_0x1fb212){return new Promise(function(_0x503788,_0x4c020b){var _0x20b680=_[_0xd187('0x57')](_0x163807[_0xd187('0x76')]);_0x503788({'count':_0x20b680[_0xd187('0x53')],'rows':_0x20b680});});},'Trunks':function(_0x371869){return new Promise(function(_0x475ea9,_0x4dd0c7){var _0x22900=_[_0xd187('0x57')](_0x163807['trunks']);_0x475ea9({'count':_0x22900[_0xd187('0x53')],'rows':_0x22900});});},'OutboundChannels':function(_0x2a07b9){return new Promise(function(_0x37f7d4,_0xf262d1){var _0x5b084a=_['values'](_0x163807[_0xd187('0x77')]);_0x37f7d4({'count':_0x5b084a[_0xd187('0x53')],'rows':_0x5b084a});});},'Outbound':function(_0x1cd0d2){return new Promise(function(_0x5f4122,_0x1d9420){_0x5f4122(_0x163807[_0xd187('0x78')]);});},'Campaigns':function(_0x3cbc08){return new Promise(function(_0x43975c,_0x516b48){var _0x17d7d6=_['values'](_0x163807['campaigns']);_0x43975c({'count':_0x17d7d6['length'],'rows':_0x17d7d6});});},'VoiceQueuesPreview':function(_0x54bf98){var _0x547f86=this;return new Promise(function(_0x4dad9e,_0x49d76d){_0x4ebc8d[_0xd187('0x79')](_0x54bf98['id'])[_0xd187('0x17')](function(_0x4c5879){_0x4dad9e({'code':0xc8,'message':_0x4c5879[_0xd187('0x18')]});})[_0xd187('0x19')](function(_0x1a5109){_0x49d76d(_0x547f86[_0xd187('0x1a')](0x1f4,_0x1a5109[_0xd187('0x18')]));});});},'EventManager':function(_0x4a1189){var _0x3ac4d0=this;return new Promise(function(_0x48d14c,_0x4902a7){if(!_0x4a1189[_0xd187('0x7a')]){return _0x4902a7(_0x3ac4d0[_0xd187('0x1a')](0x1f4,_0xd187('0x7b')));}ami[_0xd187('0x7c')](_0xd187('0x7d')+_0x4a1189[_0xd187('0x7a')],_0x4a1189['message']);_0x48d14c({'code':0xc8,'message':_0x4a1189});});},'FaxAccounts':function(_0x34dbd6){return new Promise(function(_0x138281,_0x4e358e){var _0x2afb14=_[_0xd187('0x57')](_0x163807['faxAccounts']);_0x138281({'count':_0x2afb14[_0xd187('0x53')],'rows':_0x2afb14});});},'SendFax':function(_0x3bd1d8){var _0x224312=this;return new Promise(function(_0x45b522,_0x78604d){_0x1d2533[_0xd187('0x7e')](_0x3bd1d8)[_0xd187('0x17')](function(_0xfd10ba){_0x45b522({'code':0xc8,'message':_0xfd10ba['message']});})[_0xd187('0x19')](function(_0x516cb3){_0x78604d(_0x224312[_0xd187('0x1a')](0x1f4,_0x516cb3[_0xd187('0x18')]));});});},'CheckAfterSend':function(_0x3dc2e7){var _0x400a9=this;return new Promise(function(_0x59ce2d,_0x4fcf43){_0x1d2533[_0xd187('0x7f')](_0x3dc2e7)[_0xd187('0x17')](function(_0x4ba785){_0x59ce2d({'code':0xc8,'message':_0x4ba785[_0xd187('0x18')]});})[_0xd187('0x19')](function(_0x2c1402){_0x4fcf43(_0x400a9[_0xd187('0x1a')](0x1f4,_0x2c1402[_0xd187('0x18')]));});});}};var _0x3415b2=jayson['server'](_0x1d3fe4)[_0xd187('0x80')]();_0x3415b2['on'](_0xd187('0x1a'),function(_0x259f1f){return _0x444a60(_0x259f1f);});_0x3415b2[_0xd187('0x7')](0x232a,_0xd187('0x81'),function(){console[_0xd187('0x82')](_0xd187('0x83'),0x232a);return _0x58ee7(_0xd187('0x84')+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 cff738d..058ca12 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 _0xddd8=['createdAt','updatedAt','then','getContacts','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','calleridnum','Unknown','user:%s','name','format','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','map','routeId','firstName','mobile','fax'];(function(_0x4ae263,_0x618f5a){var _0x41a5e5=function(_0x5a094d){while(--_0x5a094d){_0x4ae263['push'](_0x4ae263['shift']());}};_0x41a5e5(++_0x618f5a);}(_0xddd8,0x12a));var _0x8ddd=function(_0x2198d7,_0x5eb7df){_0x2198d7=_0x2198d7-0x0;var _0x43b02e=_0xddd8[_0x2198d7];return _0x43b02e;};'use strict';var _=require(_0x8ddd('0x0'));var BPromise=require(_0x8ddd('0x1'));var Redis=require(_0x8ddd('0x2'));var util=require(_0x8ddd('0x3'));var config=require(_0x8ddd('0x4'));var logger=require(_0x8ddd('0x5'))(_0x8ddd('0x6'));var cmContactRpc=require(_0x8ddd('0x7'));config[_0x8ddd('0x8')]=_['defaults'](config['redis'],{'host':_0x8ddd('0x9'),'port':0x18eb});var io=require(_0x8ddd('0xa'))(new Redis(config['redis']));function emit(_0x1086c5,_0x2affc8,_0x513ce3,_0x3a6feb,_0x1d1eb9){logger['info'](_0x8ddd('0xb'),_0x1086c5,_0x2affc8['id'],_0x513ce3,_0x3a6feb,JSON[_0x8ddd('0xc')](_0x1d1eb9));io['to'](_0x513ce3)[_0x8ddd('0xd')](_0x3a6feb,_0x1d1eb9);}exports[_0x8ddd('0xe')]=function(_0x48faa8,_0x9a7b86,_0x2c0682,_0x59c7cd){var _0x13a77d,_0x17e4b4;var _0x20b7ab={};var _0x51a5cc=Number(_0x2c0682[_0x8ddd('0xf')]);var _0x5a9ba0=_0x2c0682[_0x8ddd('0x10')]?Boolean(Number(_0x2c0682['data2'])):![];var _0x1ffd69;if(_0x59c7cd[_0x8ddd('0x11')]){_0x20b7ab['id']=_0x59c7cd[_0x8ddd('0x11')];}if(!_0x20b7ab['id']){_0x20b7ab[_0x8ddd('0x12')]=_0x51a5cc;_0x1ffd69=_0x2c0682[_0x8ddd('0x13')]&&_0x2c0682[_0x8ddd('0x13')]!=='0'?_0x2c0682[_0x8ddd('0x13')][_0x8ddd('0x14')](','):['phone'];_0x20b7ab['$or']=_[_0x8ddd('0x15')](_0x1ffd69,function(_0x5e099e){var _0x2d8359={};_0x2d8359[_0x5e099e]=_0x59c7cd[_0x8ddd('0x16')]?_0x59c7cd['destcalleridnum']:_0x59c7cd['calleridnum'];return _0x2d8359;});}var _0x1ec3b7=['id',_0x8ddd('0x17'),'lastName','phone',_0x8ddd('0x18'),_0x8ddd('0x19'),_0x8ddd('0x12'),_0x8ddd('0x1a'),'scheduledAt',_0x8ddd('0x1b')];var _0x419bf3=_['union'](_0x1ec3b7,_0x1ffd69);BPromise['resolve']()[_0x8ddd('0x1c')](cmContactRpc[_0x8ddd('0x1d')]({'attributes':_0x419bf3,'where':_0x20b7ab}))[_0x8ddd('0x1c')](function(_0x181b6c){_0x17e4b4=_0x181b6c;if(!_['isEmpty'](_0x17e4b4)){if(_0x17e4b4[_0x8ddd('0x1e')]===0x1){_0x13a77d=_0x17e4b4[0x0];logger[_0x8ddd('0x1f')](_0x8ddd('0x20'),_0x59c7cd[_0x8ddd('0x21')],_0x9a7b86['id'],_0x13a77d['id']);}else{logger[_0x8ddd('0x1f')](_0x8ddd('0x22'),_0x59c7cd[_0x8ddd('0x21')],_0x9a7b86['id'],_[_0x8ddd('0x15')](_0x17e4b4,'id')[_0x8ddd('0x23')](','));}return;}else{logger[_0x8ddd('0x1f')](_0x8ddd('0x24'),_0x59c7cd['uniqueid'],_0x9a7b86['id']);var _0x31d12b={'ListId':_0x51a5cc};var _0x167dc3=_0x2c0682[_0x8ddd('0x25')]&&_0x2c0682[_0x8ddd('0x25')]!=='0'?_0x2c0682['data4']:_0x8ddd('0x26');if(_0x5a9ba0){logger[_0x8ddd('0x1f')](_0x8ddd('0x27'),_0x59c7cd[_0x8ddd('0x21')],_0x9a7b86['id']);_0x31d12b[_0x167dc3]=_[_0x8ddd('0x28')](_0x59c7cd[_0x8ddd('0x16')])?_0x59c7cd['calleridnum']:_0x59c7cd['destcalleridnum'];if(_[_0x8ddd('0x28')](_0x59c7cd[_0x8ddd('0x16')])){_0x31d12b['firstName']=_0x59c7cd[_0x8ddd('0x29')]&&_0x59c7cd[_0x8ddd('0x29')]!==_0x8ddd('0x2a')?_0x59c7cd[_0x8ddd('0x29')]:'Unknown';}else{_0x31d12b[_0x8ddd('0x17')]=_0x59c7cd['destcalleridname']&&_0x59c7cd[_0x8ddd('0x2b')]!==_0x8ddd('0x2a')?_0x59c7cd['destcalleridname']:'Unknown';}return BPromise['resolve']()['then'](cmContactRpc[_0x8ddd('0x2c')](_0x31d12b))[_0x8ddd('0x1c')](function(_0x788491){_0x13a77d=_0x788491;_0x17e4b4[_0x8ddd('0x2d')](_0x788491);if(_0x13a77d){logger[_0x8ddd('0x1f')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x59c7cd[_0x8ddd('0x21')],_0x9a7b86['id'],_0x13a77d['id']);}return;});}else{logger[_0x8ddd('0x1f')](_0x8ddd('0x2e'),_0x59c7cd[_0x8ddd('0x21')],_0x9a7b86['id']);_0x31d12b[_0x167dc3]=_[_0x8ddd('0x28')](_0x59c7cd[_0x8ddd('0x16')])?_0x59c7cd[_0x8ddd('0x2f')]:_0x59c7cd['destcalleridnum'];if(_[_0x8ddd('0x28')](_0x59c7cd[_0x8ddd('0x16')])){_0x31d12b[_0x8ddd('0x17')]=_0x59c7cd[_0x8ddd('0x29')]&&_0x59c7cd[_0x8ddd('0x29')]!==''?_0x59c7cd[_0x8ddd('0x29')]:_0x8ddd('0x30');}else{_0x31d12b[_0x8ddd('0x17')]=_0x59c7cd[_0x8ddd('0x2b')]&&_0x59c7cd[_0x8ddd('0x2b')]!==_0x8ddd('0x2a')?_0x59c7cd[_0x8ddd('0x2b')]:_0x8ddd('0x30');}_0x13a77d=_0x31d12b;_0x17e4b4[_0x8ddd('0x2d')](_0x31d12b);return;}}})[_0x8ddd('0x1c')](function(){if(_0x48faa8){emit(_0x59c7cd[_0x8ddd('0x21')],_0x9a7b86,util['format'](_0x8ddd('0x31'),_0x48faa8[_0x8ddd('0x32')]),util[_0x8ddd('0x33')]('trigger:%s',_0x2c0682['action'][_0x8ddd('0x34')]()),{'evt':_[_0x8ddd('0x35')](_0x59c7cd,{'autoCreate':_0x5a9ba0}),'contact':_0x13a77d===undefined?{}:_0x13a77d,'contacts':_0x17e4b4[_0x8ddd('0x1e')]===0x0?undefined:_0x17e4b4});}});}; \ No newline at end of file +var _0x7ec4=['data1','data2','xmd-contactid','data3','split','phone','$or','map','routeId','calleridnum','firstName','mobile','fax','createdAt','scheduledAt','resolve','then','getContacts','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','destcalleridnum','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','length','lodash','bluebird','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit'];(function(_0x550048,_0x3ac364){var _0x3bff6d=function(_0x550a8f){while(--_0x550a8f){_0x550048['push'](_0x550048['shift']());}};_0x3bff6d(++_0x3ac364);}(_0x7ec4,0x13c));var _0x47ec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7ec4[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x47ec('0x0'));var BPromise=require(_0x47ec('0x1'));var Redis=require('ioredis');var util=require(_0x47ec('0x2'));var config=require('../../../../config/environment');var logger=require(_0x47ec('0x3'))(_0x47ec('0x4'));var cmContactRpc=require(_0x47ec('0x5'));config[_0x47ec('0x6')]=_[_0x47ec('0x7')](config['redis'],{'host':_0x47ec('0x8'),'port':0x18eb});var io=require(_0x47ec('0x9'))(new Redis(config[_0x47ec('0x6')]));function emit(_0x40367e,_0x35a43b,_0x2ae46d,_0xe5efdc,_0x2a04b4){logger[_0x47ec('0xa')](_0x47ec('0xb'),_0x40367e,_0x35a43b['id'],_0x2ae46d,_0xe5efdc,JSON[_0x47ec('0xc')](_0x2a04b4));io['to'](_0x2ae46d)[_0x47ec('0xd')](_0xe5efdc,_0x2a04b4);}exports['exec']=function(_0x258ca8,_0x3c4428,_0x76689b,_0x3bfa57){var _0x6a4d73,_0x409ccb;var _0x144439={};var _0x22f434=Number(_0x76689b[_0x47ec('0xe')]);var _0x5363f6=_0x76689b['data2']?Boolean(Number(_0x76689b[_0x47ec('0xf')])):![];var _0x120aa5;if(_0x3bfa57[_0x47ec('0x10')]){_0x144439['id']=_0x3bfa57[_0x47ec('0x10')];}if(!_0x144439['id']){_0x144439['ListId']=_0x22f434;_0x120aa5=_0x76689b[_0x47ec('0x11')]&&_0x76689b['data3']!=='0'?_0x76689b[_0x47ec('0x11')][_0x47ec('0x12')](','):[_0x47ec('0x13')];_0x144439[_0x47ec('0x14')]=_[_0x47ec('0x15')](_0x120aa5,function(_0x1dca2f){var _0x392fd3={};_0x392fd3[_0x1dca2f]=_0x3bfa57[_0x47ec('0x16')]?_0x3bfa57['destcalleridnum']:_0x3bfa57[_0x47ec('0x17')];return _0x392fd3;});}var _0x412f93=['id',_0x47ec('0x18'),'lastName',_0x47ec('0x13'),_0x47ec('0x19'),_0x47ec('0x1a'),'ListId',_0x47ec('0x1b'),_0x47ec('0x1c'),'updatedAt'];var _0x2da85f=_['union'](_0x412f93,_0x120aa5);BPromise[_0x47ec('0x1d')]()[_0x47ec('0x1e')](cmContactRpc[_0x47ec('0x1f')]({'attributes':_0x2da85f,'where':_0x144439}))[_0x47ec('0x1e')](function(_0xa3371d){_0x409ccb=_0xa3371d;if(!_['isEmpty'](_0x409ccb)){if(_0x409ccb['length']===0x1){_0x6a4d73=_0x409ccb[0x0];logger[_0x47ec('0xa')](_0x47ec('0x20'),_0x3bfa57[_0x47ec('0x21')],_0x3c4428['id'],_0x6a4d73['id']);}else{logger[_0x47ec('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x3bfa57[_0x47ec('0x21')],_0x3c4428['id'],_[_0x47ec('0x15')](_0x409ccb,'id')[_0x47ec('0x22')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x3bfa57[_0x47ec('0x21')],_0x3c4428['id']);var _0x5b80f5={'ListId':_0x22f434};var _0x5a182e=_0x76689b['data4']&&_0x76689b[_0x47ec('0x23')]!=='0'?_0x76689b[_0x47ec('0x23')]:'phone';if(_0x5363f6){logger[_0x47ec('0xa')](_0x47ec('0x24'),_0x3bfa57[_0x47ec('0x21')],_0x3c4428['id']);_0x5b80f5[_0x5a182e]=_[_0x47ec('0x25')](_0x3bfa57[_0x47ec('0x16')])?_0x3bfa57[_0x47ec('0x17')]:_0x3bfa57[_0x47ec('0x26')];if(_[_0x47ec('0x25')](_0x3bfa57['routeId'])){_0x5b80f5[_0x47ec('0x18')]=_0x3bfa57[_0x47ec('0x27')]&&_0x3bfa57[_0x47ec('0x27')]!==''?_0x3bfa57[_0x47ec('0x27')]:_0x47ec('0x28');}else{_0x5b80f5[_0x47ec('0x18')]=_0x3bfa57[_0x47ec('0x29')]&&_0x3bfa57[_0x47ec('0x29')]!==_0x47ec('0x2a')?_0x3bfa57['destcalleridname']:_0x47ec('0x28');}return BPromise[_0x47ec('0x1d')]()[_0x47ec('0x1e')](cmContactRpc[_0x47ec('0x2b')](_0x5b80f5))['then'](function(_0x3365f9){_0x6a4d73=_0x3365f9;_0x409ccb[_0x47ec('0x2c')](_0x3365f9);if(_0x6a4d73){logger[_0x47ec('0xa')](_0x47ec('0x2d'),_0x3bfa57['uniqueid'],_0x3c4428['id'],_0x6a4d73['id']);}return;});}else{logger['info'](_0x47ec('0x2e'),_0x3bfa57[_0x47ec('0x21')],_0x3c4428['id']);_0x5b80f5[_0x5a182e]=_[_0x47ec('0x25')](_0x3bfa57[_0x47ec('0x16')])?_0x3bfa57['calleridnum']:_0x3bfa57[_0x47ec('0x26')];if(_[_0x47ec('0x25')](_0x3bfa57[_0x47ec('0x16')])){_0x5b80f5[_0x47ec('0x18')]=_0x3bfa57['calleridname']&&_0x3bfa57['calleridname']!==''?_0x3bfa57[_0x47ec('0x27')]:_0x47ec('0x28');}else{_0x5b80f5[_0x47ec('0x18')]=_0x3bfa57[_0x47ec('0x29')]&&_0x3bfa57[_0x47ec('0x29')]!==''?_0x3bfa57[_0x47ec('0x29')]:_0x47ec('0x28');}_0x6a4d73=_0x5b80f5;_0x409ccb[_0x47ec('0x2c')](_0x5b80f5);return;}}})[_0x47ec('0x1e')](function(){if(_0x258ca8){emit(_0x3bfa57[_0x47ec('0x21')],_0x3c4428,util[_0x47ec('0x2f')](_0x47ec('0x30'),_0x258ca8[_0x47ec('0x31')]),util[_0x47ec('0x2f')](_0x47ec('0x32'),_0x76689b[_0x47ec('0x33')][_0x47ec('0x34')]()),{'evt':_[_0x47ec('0x35')](_0x3bfa57,{'autoCreate':_0x5363f6}),'contact':_0x6a4d73===undefined?{}:_0x6a4d73,'contacts':_0x409ccb[_0x47ec('0x36')]===0x0?undefined:_0x409ccb});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 2ec95e3..5e35725 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 _0x9b3e=['600','winApplication','winArguments','render','format','user:%s','name','trigger:%s:%s','toLowerCase','merge','jscripty','trigger:%s','exec','integration','queue','voiceExtensions','routeId','urlforward','script','parse','query','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','field','account','chat','ChatWebsiteId','operator','value','upperFirst','interaction','message','event','membername','lastevent','exports','util','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','trigger','redis','defaults','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','zohoAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','emit','info','stringify','prototype','clone','motionChannel','undefined','checkTriggers','interface','checkTrigger','variables','Actions','action','contactmanager','motionbar','browser','data1','TemplateId','html','data2','template\x20not\x20found','buildUri','data3','isNil','data4','location','uriLocation','windowWidth','800','data5','data6'];(function(_0x3af98d,_0x33169d){var _0x5bcfca=function(_0x5c1c54){while(--_0x5c1c54){_0x3af98d['push'](_0x3af98d['shift']());}};_0x5bcfca(++_0x33169d);}(_0x9b3e,0x11f));var _0xe9b3=function(_0x58056b,_0x1273eb){_0x58056b=_0x58056b-0x0;var _0x350e1e=_0x9b3e[_0x58056b];return _0x350e1e;};'use strict';var util=require(_0xe9b3('0x0'));var _=require('lodash');var url=require(_0xe9b3('0x1'));var Mustache=require(_0xe9b3('0x2'));var Redis=require(_0xe9b3('0x3'));var urlforward=require(_0xe9b3('0x4'));var integration=require(_0xe9b3('0x5'));var cmContact=require(_0xe9b3('0x6'));var script=require(_0xe9b3('0x7'));var config=require(_0xe9b3('0x8'));var logger=require('../../../config/logger')(_0xe9b3('0x9'));var ami=require('../ami');config[_0xe9b3('0xa')]=_[_0xe9b3('0xb')](config[_0xe9b3('0xa')],{'host':_0xe9b3('0xc'),'port':0x18eb});var io=require(_0xe9b3('0xd'))(new Redis(config['redis']));var operators={'equals':function(_0x1b9e42,_0x45eae2){return _0x1b9e42==_0x45eae2;},'not_equals':function(_0x3878fe,_0x5df07b){return _0x3878fe!=_0x5df07b;}};var barAndWebActions=['popup',_0xe9b3('0x1'),_0xe9b3('0xe')];function Trigger(_0x121335){this['triggers']=_0x121335[_0xe9b3('0xf')];this[_0xe9b3('0x10')]=_0x121335[_0xe9b3('0x10')];this[_0xe9b3('0x11')]=_0x121335[_0xe9b3('0x11')];this[_0xe9b3('0x12')]=_0x121335['templates'];this['voiceExtensions']=_0x121335['voiceExtensions'];this[_0xe9b3('0x13')]=_0x121335[_0xe9b3('0x13')];this[_0xe9b3('0x14')]=_0x121335[_0xe9b3('0x14')];this[_0xe9b3('0x15')]=_0x121335[_0xe9b3('0x15')];this['sugarcrmAccounts']=_0x121335[_0xe9b3('0x16')];this['zohoAccounts']=_0x121335['zohoAccounts'];this[_0xe9b3('0x17')]=_0x121335[_0xe9b3('0x17')];this['vtigerAccounts']=_0x121335[_0xe9b3('0x18')];this[_0xe9b3('0x19')]=_0x121335['servicenowAccounts'];this['dynamics365Accounts']=_0x121335[_0xe9b3('0x1a')];this[_0xe9b3('0x1b')]=_0x121335[_0xe9b3('0x1b')];this[_0xe9b3('0x1c')]={'zendesk':this[_0xe9b3('0x13')],'salesforce':this[_0xe9b3('0x15')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xe9b3('0x16')],'zoho':this[_0xe9b3('0x1d')],'desk':this[_0xe9b3('0x17')],'vtiger':this[_0xe9b3('0x18')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xe9b3('0x1b')],'servicenow':this[_0xe9b3('0x19')]};ami['on'](_0xe9b3('0x1e'),this[_0xe9b3('0x1f')][_0xe9b3('0x20')](this));ami['on'](_0xe9b3('0x21'),this[_0xe9b3('0x1f')]['bind'](this));ami['on'](_0xe9b3('0x22'),this[_0xe9b3('0x1f')][_0xe9b3('0x20')](this));ami['on'](_0xe9b3('0x23'),this[_0xe9b3('0x1f')][_0xe9b3('0x20')](this));ami['on'](_0xe9b3('0x24'),this[_0xe9b3('0x1f')][_0xe9b3('0x20')](this));ami['on'](_0xe9b3('0x25'),this[_0xe9b3('0x1f')][_0xe9b3('0x20')](this));ami['on'](_0xe9b3('0x26'),this[_0xe9b3('0x1f')]['bind'](this));ami['on'](_0xe9b3('0x27'),this[_0xe9b3('0x1f')][_0xe9b3('0x20')](this));ami['on'](_0xe9b3('0x28'),this[_0xe9b3('0x1f')][_0xe9b3('0x20')](this));ami['on'](_0xe9b3('0x29'),this[_0xe9b3('0x1f')][_0xe9b3('0x20')](this));ami['on'](_0xe9b3('0x2a'),this[_0xe9b3('0x1f')]['bind'](this));ami['on'](_0xe9b3('0x2b'),this[_0xe9b3('0x1f')][_0xe9b3('0x20')](this));ami['on'](_0xe9b3('0x2c'),this[_0xe9b3('0x2d')][_0xe9b3('0x20')](this));ami['on'](_0xe9b3('0x2e'),this[_0xe9b3('0x2d')][_0xe9b3('0x20')](this));ami['on'](_0xe9b3('0x2f'),this[_0xe9b3('0x2d')]['bind'](this));ami['on'](_0xe9b3('0x30'),this[_0xe9b3('0x1f')][_0xe9b3('0x20')](this));ami['on'](_0xe9b3('0x31'),this[_0xe9b3('0x1f')][_0xe9b3('0x20')](this));ami['on'](_0xe9b3('0x32'),this[_0xe9b3('0x1f')][_0xe9b3('0x20')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent'][_0xe9b3('0x20')](this));ami['on']('custom:acceptmessage',this[_0xe9b3('0x1f')][_0xe9b3('0x20')](this));ami['on']('custom:rejectmessage',this[_0xe9b3('0x1f')][_0xe9b3('0x20')](this));}Trigger['prototype'][_0xe9b3('0x33')]=function(_0x152d28,_0x158747,_0x27fcb1){logger[_0xe9b3('0x34')](_0x152d28,_0x158747,JSON[_0xe9b3('0x35')](_0x27fcb1));io['to'](_0x152d28)[_0xe9b3('0x33')](_0x158747,_0x27fcb1);};Trigger[_0xe9b3('0x36')][_0xe9b3('0x1f')]=function(_0x15eb74){var _0x334362=_[_0xe9b3('0x37')](_0x15eb74);if(typeof _0x334362[_0xe9b3('0x38')]===_0xe9b3('0x39')){_0x334362[_0xe9b3('0x38')]='voice';}this[_0xe9b3('0x3a')](_0x334362);};Trigger[_0xe9b3('0x36')][_0xe9b3('0x2d')]=function(_0xfb3e82){if(this[_0xe9b3('0x10')][_0xfb3e82[_0xe9b3('0x3b')]]){this[_0xe9b3('0x1f')](_0xfb3e82);}};Trigger[_0xe9b3('0x36')][_0xe9b3('0x3a')]=function(_0x2190ab){var _0x513490;for(var _0x59866d in this['triggers']){if(this[_0xe9b3('0xf')]['hasOwnProperty'](_0x59866d)){if(this['triggers'][_0x59866d]['status']){_0x513490=this[_0xe9b3('0x3c')](this['triggers'][_0x59866d],_0x2190ab);if(_0x513490){_['merge'](_0x2190ab,_0x2190ab[_0xe9b3('0x3d')]);for(var _0xc54b53=0x0,_0x1ce433,_0x41cfc6,_0x7ac039;_0xc54b530x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','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','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x3d2a00,_0x2af90e){var _0x2b35d5=function(_0x546fa7){while(--_0x546fa7){_0x3d2a00['push'](_0x3d2a00['shift']());}};_0x2b35d5(++_0x2af90e);}(_0x55ca,0x126));var _0xa55c=function(_0x3d5351,_0x27bc80){_0x3d5351=_0x3d5351-0x0;var _0x1db4db=_0x55ca[_0x3d5351];return _0x1db4db;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ 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 bec910b..e96e851 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 _0xd46b=['util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','username','password','clientSecret','catch','error',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','length','isdisabled','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','internalemailaddress','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','value','toUpperCase',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','nameField','customField','idField','indexOf','content','incidents','assign','getString','Descriptions','/contacts(','Fields','ticketType','phonecall','phonecalls','Subjects','callDirection','queue','format','user:%s','emit','trigger:browser:url','remoteUri','serverUrl','stripTrailingSlash','unmanaged','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0xd46b,0x12c));var _0xbd46=function(_0x10c778,_0x58ef9e){_0x10c778=_0x10c778-0x0;var _0x4e9fb2=_0xd46b[_0x10c778];return _0x4e9fb2;};'use strict';var _=require(_0xbd46('0x0'));var BPromise=require(_0xbd46('0x1'));var rp=require(_0xbd46('0x2'));var util=require(_0xbd46('0x3'));var intUtil=require(_0xbd46('0x4'));var md5=require('md5');var Redis=require(_0xbd46('0x5'));var logger=require(_0xbd46('0x6'))(_0xbd46('0x7'));var config=require(_0xbd46('0x8'));config[_0xbd46('0x9')]=_[_0xbd46('0xa')](config[_0xbd46('0x9')],{'host':_0xbd46('0xb'),'port':0x18eb});var io=require(_0xbd46('0xc'))(new Redis(config[_0xbd46('0x9')]));function getAuthToken(_0x15b7c0,_0x1a6e35,_0x36d235){var _0x411c19={'method':_0xbd46('0xd'),'uri':_0x1a6e35,'form':{'client_id':_0x15b7c0[_0xbd46('0xe')],'resource':_0x15b7c0['remoteUri'],'username':_0x15b7c0[_0xbd46('0xf')],'password':_0x15b7c0[_0xbd46('0x10')],'grant_type':'password','client_secret':_0x15b7c0[_0xbd46('0x11')]},'json':!![]};return rp(_0x411c19)['then'](function(_0x5ae9a2){return _0x5ae9a2['access_token'];})[_0xbd46('0x12')](function(_0x26c74e){logger[_0xbd46('0x13')]('['+[_0x36d235['toUpperCase']()]+_0xbd46('0x14'));return _0x26c74e[_0xbd46('0x15')];});}function getUser(_0x9c2d6b,_0x51c8a3,_0x44362c,_0x3af8a6,_0x38a8dd,_0x341033){return new BPromise(function(_0x5e0b66,_0x20d128){return getAuthToken(_0x51c8a3,_0x3af8a6,_0x341033)[_0xbd46('0x16')](function(_0x36dfeb){var _0x3fa5bc={'method':_0xbd46('0x17'),'uri':_0x38a8dd+_0xbd46('0x18'),'headers':{'Authorization':_0xbd46('0x19')+_0x36dfeb,'OData-Version':_0xbd46('0x1a')},'json':!![]};return rp(_0x3fa5bc);})[_0xbd46('0x16')](function(_0x51270f){var _0x2f738f=_0x51270f['value'];var _0x1f892a=![];var _0x5dfac1=null;if(!_[_0xbd46('0x1b')](_0x44362c)){if(intUtil[_0xbd46('0x1c')](_0x44362c[_0xbd46('0x1d')])){_0x9c2d6b['userEmail']=_0x44362c[_0xbd46('0x1d')];for(_0x5dfac1=0x0;_0x5dfac1<_0x2f738f[_0xbd46('0x1e')];_0x5dfac1++){if(_0x2f738f[_0x5dfac1]['internalemailaddress']===_0x44362c[_0xbd46('0x1d')]&&!_0x2f738f[_0x5dfac1][_0xbd46('0x1f')]){_0x1f892a=!![];logger[_0xbd46('0x20')]('['+[_0x341033['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x2f738f[_0x5dfac1][_0xbd46('0x21')]+'!');_0x9c2d6b['userId']=_0x2f738f[_0x5dfac1][_0xbd46('0x21')];}}}}if(!_0x1f892a){logger[_0xbd46('0x20')]('['+[_0x341033['toUpperCase']()]+_0xbd46('0x22'));_0x9c2d6b[_0xbd46('0x23')]=_0x51c8a3[_0xbd46('0xf')];for(_0x5dfac1=0x0;_0x5dfac1<_0x2f738f[_0xbd46('0x1e')];_0x5dfac1++){if(_0x2f738f[_0x5dfac1][_0xbd46('0x24')]===_0x51c8a3[_0xbd46('0xf')]){_0x9c2d6b[_0xbd46('0x25')]=_0x2f738f[_0x5dfac1]['systemuserid'];}}}_0x5e0b66(_0x9c2d6b);})[_0xbd46('0x12')](function(_0x1c5275){_0x20d128(_0x1c5275['message']);});});}function createEndUser(_0x5f29cb,_0x27a87c,_0x26557b,_0x1dfae5,_0xbed40,_0x1e8ead){return new BPromise(function(_0x4b1109,_0x67ba3c){return getAuthToken(_0x27a87c,_0x26557b,_0x1e8ead)[_0xbd46('0x16')](function(_0x48d03a){var _0x489315=_0x1e8ead[_0xbd46('0x26')]()===_0xbd46('0x27')?_0xbed40[_0xbd46('0x28')]:_0xbed40[_0xbd46('0x29')];var _0x1ac434={'method':_0xbd46('0xd'),'uri':_0x1dfae5+_0xbd46('0x2a'),'body':{'telephone1':_0x489315,'fullname':_0x489315,'firstname':_0x489315,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xbd46('0x2b')+_0x5f29cb['userId']+')'},'headers':{'Authorization':_0xbd46('0x19')+_0x48d03a,'OData-Version':_0xbd46('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1ac434);})[_0xbd46('0x16')](function(_0x464893){var _0x44ac76=_0x464893['headers'][_0xbd46('0x2c')];var _0x37ec63=_0x44ac76[_0xbd46('0x2d')](_0x44ac76[_0xbd46('0x2e')]('(')+0x1,_0x44ac76[_0xbd46('0x2e')](')'));_0x5f29cb[_0xbd46('0x2f')]=_0x37ec63;_0x4b1109(_0x5f29cb);})['catch'](function(_0x58928f){_0x67ba3c(_0x58928f['message']);});});}function getEndUser(_0x519347,_0xbb8cb1,_0x106204,_0x1aded9,_0x14719b,_0x360d4e){return new BPromise(function(_0x1fe131,_0x395234){var _0x5d3832=_0x360d4e[_0xbd46('0x26')]()==='outbound'?_0x14719b[_0xbd46('0x28')]:_0x14719b[_0xbd46('0x29')];return getAuthToken(_0xbb8cb1,_0x106204,_0x360d4e)['then'](function(_0x158ec3){var _0x94b888={'method':_0xbd46('0x17'),'uri':_0x1aded9+_0xbd46('0x30')+_0x5d3832[_0xbd46('0x31')]('+',_0xbd46('0x32'))+'\x27','headers':{'Authorization':_0xbd46('0x19')+_0x158ec3,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x94b888);})[_0xbd46('0x16')](function(_0x1af97e){var _0x2042c4=null;if(_0x1af97e){var _0x4441ec=_0x1af97e[_0xbd46('0x33')];var _0x5e93fe=![];for(_0x2042c4=0x0;_0x2042c4<_0x4441ec['length'];_0x2042c4++){if(_0x4441ec[_0x2042c4]['telephone1']===_0x5d3832){_0x5e93fe=!![];_0x519347['enduserId']=_0x4441ec[_0x2042c4]['contactid'];}}if(_0x5e93fe){_0x1fe131(_0x519347);}else{return createEndUser(_0x519347,_0xbb8cb1,_0x106204,_0x1aded9,_0x14719b,_0x360d4e)[_0xbd46('0x16')](function(_0xafe377){logger[_0xbd46('0x20')]('['+[_0x360d4e[_0xbd46('0x34')]()]+_0xbd46('0x35'),_0xafe377[_0xbd46('0x2f')]);_0x1fe131(_0xafe377);});}}else{return createEndUser(_0x519347,_0xbb8cb1,_0x106204,_0x1aded9,_0x14719b,_0x360d4e)['then'](function(_0x1c7506){logger[_0xbd46('0x20')]('['+[_0x360d4e[_0xbd46('0x34')]()]+_0xbd46('0x36'),_0x1c7506[_0xbd46('0x2f')]);_0x1fe131(_0x1c7506);});}});});}function getCustomFields(_0x2e7298,_0x20d951,_0x324075){var _0x9abcdf={};if(_0x2e7298[_0xbd46('0x1e')]>0x0){_[_0xbd46('0x37')](_0x2e7298,function(_0x50d9db){if(_[_0xbd46('0x38')]([_0xbd46('0x39'),_0xbd46('0x3a')],_0x50d9db['type'])&&_0x50d9db[_0xbd46('0x3b')]&&!_0x50d9db[_0xbd46('0x3c')]){var _0x423960=_0x50d9db[_0xbd46('0x3d')]['toLowerCase']();var _0x1201e5=_0x423960[_0xbd46('0x2d')](0x0,_0x423960['indexOf']('_'));var _0x579deb=_0x423960[_0xbd46('0x2d')](_0x423960[_0xbd46('0x3e')]('_')+0x1);if(_0x1201e5===_0x324075){_0x9abcdf[_0x579deb]=_0x50d9db[_0xbd46('0x3f')];}}});}return _0x9abcdf;}function getTicket(_0xd38dae,_0xc91a6d,_0x5ce52a,_0x54789e,_0x199dce,_0x2316d0,_0xd1ee85){return new BPromise(function(_0x31583a,_0x2c1e1b){var _0x43f549;return getAuthToken(_0xc91a6d,_0x5ce52a,_0xd1ee85)[_0xbd46('0x16')](function(_0xc70973){if(_0x2316d0['ticketType']==='incident'){_0x43f549={'method':'POST','uri':_0x54789e+_0xbd46('0x40'),'body':Object[_0xbd46('0x41')]({},{'title':intUtil[_0xbd46('0x42')](_0x2316d0['Subjects'],_0x199dce,'\x20'),'description':intUtil[_0xbd46('0x42')](_0x2316d0[_0xbd46('0x43')],_0x199dce,'\x0a'),'customerid_contact@odata.bind':_0xbd46('0x44')+_0xd38dae['enduserId']+')','ownerid@odata.bind':_0xbd46('0x2b')+_0xd38dae[_0xbd46('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x2316d0[_0xbd46('0x45')],_0x199dce,_0x2316d0['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0xc70973,'OData-Version':_0xbd46('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2316d0[_0xbd46('0x46')]===_0xbd46('0x47')){_0x43f549={'method':_0xbd46('0xd'),'uri':_0x54789e+_0xbd46('0x48'),'body':Object[_0xbd46('0x41')]({},{'subject':intUtil[_0xbd46('0x42')](_0x2316d0[_0xbd46('0x49')],_0x199dce,'\x20'),'phonenumber':String(_0x199dce[_0xbd46('0x29')]),'description':intUtil[_0xbd46('0x42')](_0x2316d0['Descriptions'],_0x199dce,'\x0a'),'regardingobjectid_contact@odata.bind':_0xbd46('0x44')+_0xd38dae['enduserId']+')','ownerid@odata.bind':_0xbd46('0x2b')+_0xd38dae[_0xbd46('0x25')]+')','directioncode':_0xd38dae[_0xbd46('0x4a')]===_0xbd46('0x4b')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xbd46('0x2b')+_0xd38dae['userId']+')','participationtypemask':_0xd38dae['callDirection']===_0xbd46('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0xbd46('0x44')+_0xd38dae[_0xbd46('0x2f')]+')','participationtypemask':_0xd38dae['callDirection']==='queue'?0x1:0x2}]},getCustomFields(_0x2316d0['Fields'],_0x199dce,_0x2316d0[_0xbd46('0x46')])),'headers':{'Authorization':_0xbd46('0x19')+_0xc70973,'OData-Version':_0xbd46('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x43f549);})['then'](function(_0x26eef1){var _0x21bac0=_0x26eef1['headers']['odata-entityid'];var _0x5c4284=_0x21bac0[_0xbd46('0x2d')](_0x21bac0[_0xbd46('0x2e')]('(')+0x1,_0x21bac0[_0xbd46('0x2e')](')'));_0xd38dae['ticketId']=_0x5c4284;_0x31583a(_0xd38dae);})[_0xbd46('0x12')](function(_0xeac7a3){_0x2c1e1b(_0xeac7a3[_0xbd46('0x15')]);});});}function emit(_0x1d9764,_0x203c09,_0x12fc3c,_0x40ef25){var _0x18f3e5={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x1d9764,_0x12fc3c,_0x40ef25)};io['to'](util[_0xbd46('0x4c')](_0xbd46('0x4d'),_0x203c09))[_0xbd46('0x4e')](_0xbd46('0x4f'),_0x18f3e5);}exports['cs']=function(_0xdb038,_0x5b77e1,_0xbdd509,_0x401be3,_0x3e8a35,_0x2f628b,_0x5e13af,_0x3d2a3b){var _0x1ddccf={};_0x2f628b['remoteUri']=intUtil['stripTrailingSlash'](_0x2f628b[_0xbd46('0x50')]);_0x2f628b[_0xbd46('0x51')]=intUtil[_0xbd46('0x52')](_0x2f628b['serverUrl']);_0x1ddccf[_0xbd46('0x4a')]=_0x3d2a3b==='queue'||_0x3d2a3b===_0xbd46('0x53')?_0xbd46('0x4b'):_0xbd46('0x27');var _0x33ff69=util['format']('%s/api/data/v9.0/',_0x2f628b[_0xbd46('0x50')]);var _0x3c1bda=util[_0xbd46('0x4c')]('https://login.microsoftonline.com/%s/oauth2/token',_0x2f628b[_0xbd46('0x54')]);var _0x5da1ea=util[_0xbd46('0x4c')](_0xbd46('0x55'),_0x2f628b[_0xbd46('0x51')],_0x5b77e1[_0xbd46('0x56')],md5(_0x5b77e1[_0xbd46('0x56')]));if(_0x3e8a35&&_0x3e8a35[_0xbd46('0x57')]){logger[_0xbd46('0x20')](_0xbd46('0x58'),_0xbd46('0x59'));_0x5b77e1[_0xbd46('0x5a')]=_0x5da1ea;}else if(_0x5e13af&&_0x5e13af[_0xbd46('0x5b')]&&_0x5e13af[_0xbd46('0x5b')]!==_0xbd46('0x5c')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5b77e1[_0xbd46('0x5a')]=_0x5da1ea;}else{_0x5b77e1[_0xbd46('0x5a')]='';}return getUser(_0x1ddccf,_0x2f628b,_0x401be3,_0x3c1bda,_0x33ff69,_0x3d2a3b)[_0xbd46('0x16')](function(_0x16f83f){logger[_0xbd46('0x20')]('['+_0x3d2a3b[_0xbd46('0x34')]()+_0xbd46('0x5d'),_0x16f83f[_0xbd46('0x25')]);logger[_0xbd46('0x20')]('['+_0x3d2a3b[_0xbd46('0x34')]()+_0xbd46('0x5e'),_0x16f83f[_0xbd46('0x23')]);return getEndUser(_0x16f83f,_0x2f628b,_0x3c1bda,_0x33ff69,_0x5b77e1,_0x3d2a3b);})['then'](function(_0x426366){logger['info']('['+_0x3d2a3b[_0xbd46('0x34')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x426366[_0xbd46('0x2f')]);logger[_0xbd46('0x20')]('['+_0x3d2a3b['toUpperCase']()+_0xbd46('0x5f'),_0x5b77e1['calleridnum']);return getTicket(_0x426366,_0x2f628b,_0x3c1bda,_0x33ff69,_0x5b77e1,_0xbdd509,_0x3d2a3b);})[_0xbd46('0x16')](function(_0x55d662){logger[_0xbd46('0x20')](util[_0xbd46('0x4c')]('['+_0x3d2a3b['toUpperCase']()+_0xbd46('0x60'),_0xbdd509[_0xbd46('0x46')],_0x55d662[_0xbd46('0x61')]));logger[_0xbd46('0x20')](util['format']('['+_0x3d2a3b[_0xbd46('0x34')]()+']\x20Call\x20direction:\x20%s',_0x3d2a3b));if(_0x3d2a3b!==_0xbd46('0x53')){logger[_0xbd46('0x20')]('['+_0x3d2a3b[_0xbd46('0x34')]()+']',_0xbd46('0x62'));emit(_0x2f628b[_0xbd46('0x50')],_0x401be3['name'],_0xbdd509[_0xbd46('0x46')],_0x55d662[_0xbd46('0x61')]);}})[_0xbd46('0x12')](function(_0x4be236){logger[_0xbd46('0x13')]('['+_0x3d2a3b['toUpperCase']()+_0xbd46('0x63'),util[_0xbd46('0x64')](_0x4be236,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x42d4=['telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','picklist','type','nameField','customField','idField','indexOf','ticketType','incident','Subjects','getString','Descriptions','/contacts(','Fields','phonecalls','assign','callDirection','queue','odata-entityid','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','./util','md5','ioredis','dynamics365','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','userEmail','email','length','internalemailaddress','info','toUpperCase','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','systemuserid','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','value'];(function(_0x2e91eb,_0x153281){var _0x11f891=function(_0x5d55a6){while(--_0x5d55a6){_0x2e91eb['push'](_0x2e91eb['shift']());}};_0x11f891(++_0x153281);}(_0x42d4,0x8f));var _0x442d=function(_0x2ce455,_0x827d73){_0x2ce455=_0x2ce455-0x0;var _0x84f1fe=_0x42d4[_0x2ce455];return _0x84f1fe;};'use strict';var _=require(_0x442d('0x0'));var BPromise=require(_0x442d('0x1'));var rp=require('request-promise');var util=require('util');var intUtil=require(_0x442d('0x2'));var md5=require(_0x442d('0x3'));var Redis=require(_0x442d('0x4'));var logger=require('../../../../config/logger')(_0x442d('0x5'));var config=require('../../../../config/environment');config['redis']=_[_0x442d('0x6')](config['redis'],{'host':_0x442d('0x7'),'port':0x18eb});var io=require(_0x442d('0x8'))(new Redis(config['redis']));function getAuthToken(_0x4139fa,_0x3d0587,_0x42ec2a){var _0x1056ac={'method':_0x442d('0x9'),'uri':_0x3d0587,'form':{'client_id':_0x4139fa[_0x442d('0xa')],'resource':_0x4139fa[_0x442d('0xb')],'username':_0x4139fa[_0x442d('0xc')],'password':_0x4139fa[_0x442d('0xd')],'grant_type':_0x442d('0xd'),'client_secret':_0x4139fa['clientSecret']},'json':!![]};return rp(_0x1056ac)[_0x442d('0xe')](function(_0x3e1bb1){return _0x3e1bb1[_0x442d('0xf')];})[_0x442d('0x10')](function(_0xee9d2d){logger[_0x442d('0x11')]('['+[_0x42ec2a['toUpperCase']()]+_0x442d('0x12'));return _0xee9d2d[_0x442d('0x13')];});}function getUser(_0x46c589,_0x93ad55,_0xf8f141,_0xbbcf,_0x7111,_0x1077d5){return new BPromise(function(_0x13606c,_0x2d692d){return getAuthToken(_0x93ad55,_0xbbcf,_0x1077d5)[_0x442d('0xe')](function(_0xcf2087){var _0x512c79={'method':_0x442d('0x14'),'uri':_0x7111+_0x442d('0x15'),'headers':{'Authorization':_0x442d('0x16')+_0xcf2087,'OData-Version':_0x442d('0x17')},'json':!![]};return rp(_0x512c79);})[_0x442d('0xe')](function(_0x5b9dd3){var _0x186621=_0x5b9dd3['value'];var _0x5b8843=![];var _0x28b125=null;if(!_['isNil'](_0xf8f141)){if(intUtil['validateEmail'](_0xf8f141['email'])){_0x46c589[_0x442d('0x18')]=_0xf8f141[_0x442d('0x19')];for(_0x28b125=0x0;_0x28b125<_0x186621[_0x442d('0x1a')];_0x28b125++){if(_0x186621[_0x28b125][_0x442d('0x1b')]===_0xf8f141['email']&&!_0x186621[_0x28b125]['isdisabled']){_0x5b8843=!![];logger[_0x442d('0x1c')]('['+[_0x1077d5[_0x442d('0x1d')]()]+']\x20Agent\x20found\x20'+_0x186621[_0x28b125]['systemuserid']+'!');_0x46c589[_0x442d('0x1e')]=_0x186621[_0x28b125]['systemuserid'];}}}}if(!_0x5b8843){logger[_0x442d('0x1c')]('['+[_0x1077d5[_0x442d('0x1d')]()]+_0x442d('0x1f'));_0x46c589[_0x442d('0x18')]=_0x93ad55[_0x442d('0xc')];for(_0x28b125=0x0;_0x28b125<_0x186621[_0x442d('0x1a')];_0x28b125++){if(_0x186621[_0x28b125]['internalemailaddress']===_0x93ad55[_0x442d('0xc')]){_0x46c589[_0x442d('0x1e')]=_0x186621[_0x28b125][_0x442d('0x20')];}}}_0x13606c(_0x46c589);})[_0x442d('0x10')](function(_0x381e6e){_0x2d692d(_0x381e6e['message']);});});}function createEndUser(_0x1f9757,_0x3d0057,_0x543e7b,_0xc831a0,_0x455672,_0x2e836d){return new BPromise(function(_0x50ede8,_0x34eb80){return getAuthToken(_0x3d0057,_0x543e7b,_0x2e836d)['then'](function(_0x18f0f6){var _0x52cffa=_0x2e836d[_0x442d('0x21')]()===_0x442d('0x22')?_0x455672[_0x442d('0x23')]:_0x455672[_0x442d('0x24')];var _0x1ee1c6={'method':_0x442d('0x9'),'uri':_0xc831a0+_0x442d('0x25'),'body':{'telephone1':_0x52cffa,'fullname':_0x52cffa,'firstname':_0x52cffa,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x442d('0x26')+_0x1f9757[_0x442d('0x1e')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x18f0f6,'OData-Version':_0x442d('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1ee1c6);})[_0x442d('0xe')](function(_0x18b900){var _0x57613c=_0x18b900[_0x442d('0x27')]['odata-entityid'];var _0x3b562f=_0x57613c[_0x442d('0x28')](_0x57613c[_0x442d('0x29')]('(')+0x1,_0x57613c[_0x442d('0x29')](')'));_0x1f9757[_0x442d('0x2a')]=_0x3b562f;_0x50ede8(_0x1f9757);})[_0x442d('0x10')](function(_0x290489){_0x34eb80(_0x290489[_0x442d('0x13')]);});});}function getEndUser(_0x56732e,_0x1ce193,_0x21ce11,_0x3b0ce0,_0x52c2d1,_0x3d5c5c){return new BPromise(function(_0x3a869d,_0x3385fb){var _0x4ce75a=_0x3d5c5c[_0x442d('0x21')]()===_0x442d('0x22')?_0x52c2d1[_0x442d('0x23')]:_0x52c2d1[_0x442d('0x24')];return getAuthToken(_0x1ce193,_0x21ce11,_0x3d5c5c)[_0x442d('0xe')](function(_0xcdce9e){var _0x488154={'method':_0x442d('0x14'),'uri':_0x3b0ce0+_0x442d('0x2b')+_0x4ce75a[_0x442d('0x2c')]('+',_0x442d('0x2d'))+'\x27','headers':{'Authorization':_0x442d('0x16')+_0xcdce9e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x488154);})['then'](function(_0x533250){var _0x2bd817=null;if(_0x533250){var _0x4acd72=_0x533250[_0x442d('0x2e')];var _0x1cb13b=![];for(_0x2bd817=0x0;_0x2bd817<_0x4acd72['length'];_0x2bd817++){if(_0x4acd72[_0x2bd817][_0x442d('0x2f')]===_0x4ce75a){_0x1cb13b=!![];_0x56732e[_0x442d('0x2a')]=_0x4acd72[_0x2bd817][_0x442d('0x30')];}}if(_0x1cb13b){_0x3a869d(_0x56732e);}else{return createEndUser(_0x56732e,_0x1ce193,_0x21ce11,_0x3b0ce0,_0x52c2d1,_0x3d5c5c)['then'](function(_0x523c80){logger[_0x442d('0x1c')]('['+[_0x3d5c5c[_0x442d('0x1d')]()]+_0x442d('0x31'),_0x523c80[_0x442d('0x2a')]);_0x3a869d(_0x523c80);});}}else{return createEndUser(_0x56732e,_0x1ce193,_0x21ce11,_0x3b0ce0,_0x52c2d1,_0x3d5c5c)[_0x442d('0xe')](function(_0xbd9948){logger[_0x442d('0x1c')]('['+[_0x3d5c5c[_0x442d('0x1d')]()]+_0x442d('0x32'),_0xbd9948[_0x442d('0x2a')]);_0x3a869d(_0xbd9948);});}});});}function getCustomFields(_0x3bf8c4,_0x33970b,_0x22d9fa){var _0x1665b1={};if(_0x3bf8c4['length']>0x0){_[_0x442d('0x33')](_0x3bf8c4,function(_0x540806){if(_[_0x442d('0x34')](['string',_0x442d('0x35')],_0x540806[_0x442d('0x36')])&&_0x540806[_0x442d('0x37')]&&!_0x540806[_0x442d('0x38')]){var _0x45f0b7=_0x540806[_0x442d('0x39')][_0x442d('0x21')]();var _0x43a4c0=_0x45f0b7[_0x442d('0x28')](0x0,_0x45f0b7[_0x442d('0x3a')]('_'));var _0xb71952=_0x45f0b7['substring'](_0x45f0b7[_0x442d('0x3a')]('_')+0x1);if(_0x43a4c0===_0x22d9fa){_0x1665b1[_0xb71952]=_0x540806['content'];}}});}return _0x1665b1;}function getTicket(_0x20b917,_0xab875f,_0x1b58c6,_0x5d6ed9,_0xcddd82,_0x2b6079,_0x3ad251){return new BPromise(function(_0x116b98,_0x59cdcb){var _0x557417;return getAuthToken(_0xab875f,_0x1b58c6,_0x3ad251)['then'](function(_0x11430d){if(_0x2b6079[_0x442d('0x3b')]===_0x442d('0x3c')){_0x557417={'method':_0x442d('0x9'),'uri':_0x5d6ed9+'incidents','body':Object['assign']({},{'title':intUtil['getString'](_0x2b6079[_0x442d('0x3d')],_0xcddd82,'\x20'),'description':intUtil[_0x442d('0x3e')](_0x2b6079[_0x442d('0x3f')],_0xcddd82,'\x0a'),'customerid_contact@odata.bind':_0x442d('0x40')+_0x20b917[_0x442d('0x2a')]+')','ownerid@odata.bind':'/systemusers('+_0x20b917[_0x442d('0x1e')]+')','caseorigincode':'1'},getCustomFields(_0x2b6079[_0x442d('0x41')],_0xcddd82,_0x2b6079[_0x442d('0x3b')])),'headers':{'Authorization':'Bearer\x20'+_0x11430d,'OData-Version':_0x442d('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2b6079[_0x442d('0x3b')]==='phonecall'){_0x557417={'method':_0x442d('0x9'),'uri':_0x5d6ed9+_0x442d('0x42'),'body':Object[_0x442d('0x43')]({},{'subject':intUtil['getString'](_0x2b6079[_0x442d('0x3d')],_0xcddd82,'\x20'),'phonenumber':String(_0xcddd82[_0x442d('0x24')]),'description':intUtil[_0x442d('0x3e')](_0x2b6079[_0x442d('0x3f')],_0xcddd82,'\x0a'),'regardingobjectid_contact@odata.bind':_0x442d('0x40')+_0x20b917['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x20b917['userId']+')','directioncode':_0x20b917[_0x442d('0x44')]===_0x442d('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x442d('0x26')+_0x20b917['userId']+')','participationtypemask':_0x20b917['callDirection']===_0x442d('0x45')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x20b917['enduserId']+')','participationtypemask':_0x20b917[_0x442d('0x44')]==='queue'?0x1:0x2}]},getCustomFields(_0x2b6079[_0x442d('0x41')],_0xcddd82,_0x2b6079[_0x442d('0x3b')])),'headers':{'Authorization':'Bearer\x20'+_0x11430d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x557417);})[_0x442d('0xe')](function(_0x3e1d06){var _0x22ecbb=_0x3e1d06[_0x442d('0x27')][_0x442d('0x46')];var _0x328d8b=_0x22ecbb[_0x442d('0x28')](_0x22ecbb['lastIndexOf']('(')+0x1,_0x22ecbb[_0x442d('0x29')](')'));_0x20b917['ticketId']=_0x328d8b;_0x116b98(_0x20b917);})[_0x442d('0x10')](function(_0x5857c3){_0x59cdcb(_0x5857c3[_0x442d('0x13')]);});});}function emit(_0x3c86d4,_0x1b207e,_0xe8ada6,_0x5867be){var _0x6ae619={'uri':util[_0x442d('0x47')](_0x442d('0x48'),_0x3c86d4,_0xe8ada6,_0x5867be)};io['to'](util['format'](_0x442d('0x49'),_0x1b207e))['emit'](_0x442d('0x4a'),_0x6ae619);}exports['cs']=function(_0x1038e2,_0x21cdb3,_0xa5204a,_0x3bdbc6,_0x574fff,_0x5bf541,_0x2b7f1c,_0x45987b){var _0x15de59={};_0x5bf541['remoteUri']=intUtil['stripTrailingSlash'](_0x5bf541[_0x442d('0xb')]);_0x5bf541['serverUrl']=intUtil[_0x442d('0x4b')](_0x5bf541['serverUrl']);_0x15de59[_0x442d('0x44')]=_0x45987b===_0x442d('0x45')||_0x45987b===_0x442d('0x4c')?_0x442d('0x45'):'outbound';var _0x3a74bd=util['format'](_0x442d('0x4d'),_0x5bf541[_0x442d('0xb')]);var _0x46196f=util[_0x442d('0x47')](_0x442d('0x4e'),_0x5bf541[_0x442d('0x4f')]);var _0x5a30fb=util[_0x442d('0x47')](_0x442d('0x50'),_0x5bf541['serverUrl'],_0x21cdb3['uniqueid'],md5(_0x21cdb3[_0x442d('0x51')]));if(_0x574fff&&_0x574fff['monitor_format']){logger[_0x442d('0x1c')](_0x442d('0x52'),_0x442d('0x53'));_0x21cdb3[_0x442d('0x54')]=_0x5a30fb;}else if(_0x2b7f1c&&_0x2b7f1c[_0x442d('0x55')]&&_0x2b7f1c[_0x442d('0x55')]!==_0x442d('0x56')){logger[_0x442d('0x1c')](_0x442d('0x57'),_0x442d('0x53'));_0x21cdb3[_0x442d('0x54')]=_0x5a30fb;}else{_0x21cdb3[_0x442d('0x54')]='';}return getUser(_0x15de59,_0x5bf541,_0x3bdbc6,_0x46196f,_0x3a74bd,_0x45987b)[_0x442d('0xe')](function(_0x103c22){logger['info']('['+_0x45987b[_0x442d('0x1d')]()+_0x442d('0x58'),_0x103c22[_0x442d('0x1e')]);logger['info']('['+_0x45987b[_0x442d('0x1d')]()+_0x442d('0x59'),_0x103c22['userEmail']);return getEndUser(_0x103c22,_0x5bf541,_0x46196f,_0x3a74bd,_0x21cdb3,_0x45987b);})[_0x442d('0xe')](function(_0x14b07a){logger['info']('['+_0x45987b[_0x442d('0x1d')]()+_0x442d('0x5a'),_0x14b07a[_0x442d('0x2a')]);logger['info']('['+_0x45987b['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x21cdb3['calleridnum']);return getTicket(_0x14b07a,_0x5bf541,_0x46196f,_0x3a74bd,_0x21cdb3,_0xa5204a,_0x45987b);})['then'](function(_0x3ebc2d){logger[_0x442d('0x1c')](util[_0x442d('0x47')]('['+_0x45987b[_0x442d('0x1d')]()+_0x442d('0x5b'),_0xa5204a[_0x442d('0x3b')],_0x3ebc2d[_0x442d('0x5c')]));logger[_0x442d('0x1c')](util[_0x442d('0x47')]('['+_0x45987b[_0x442d('0x1d')]()+']\x20Call\x20direction:\x20%s',_0x45987b));if(_0x45987b!==_0x442d('0x4c')){logger[_0x442d('0x1c')]('['+_0x45987b[_0x442d('0x1d')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5bf541[_0x442d('0xb')],_0x3bdbc6['name'],_0xa5204a[_0x442d('0x3b')],_0x3ebc2d['ticketId']);}})[_0x442d('0x10')](function(_0x2c667b){logger[_0x442d('0x11')]('['+_0x45987b[_0x442d('0x1d')]()+_0x442d('0x5d'),util[_0x442d('0x5e')](_0x2c667b,{'showHidden':!![],'depth':null}));});}; \ 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 db1a440..e09e400 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 _0x3588=['find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','apiKey','base64','debug','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','push','toString','variable','customField','variableName','Variable','queue','serverUrl','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Authorization','The\x20Enduser\x20ID\x20is:','stringify','unmanaged','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','toUpperCase','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','Subjects','getString','Descriptions','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Enduser\x20found!'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x3588,0x1ea));var _0x8358=function(_0x13fcd2,_0x4765b5){_0x13fcd2=_0x13fcd2-0x0;var _0x205d2a=_0x3588[_0x13fcd2];return _0x205d2a;};'use strict';var _=require('lodash');var rp=require(_0x8358('0x0'));var md5=require('md5');var util=require(_0x8358('0x1'));var Redis=require(_0x8358('0x2'));var intUtil=require(_0x8358('0x3'));var config=require(_0x8358('0x4'));var logger=require(_0x8358('0x5'))(_0x8358('0x6'));config[_0x8358('0x7')]=_[_0x8358('0x8')](config[_0x8358('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8358('0x7')]));var headers={'Content-Type':_0x8358('0x9'),'Accept':_0x8358('0x9')};function emit(_0x5899c0,_0x5aa39c,_0x59cd12){io['to'](_0x5899c0)['emit'](_0x5aa39c,_0x59cd12);}function getTicket(_0x54314a,_0x412bb9,_0x1072b3,_0x385952,_0x121ec6){logger[_0x8358('0xa')](_0x8358('0xb'));var _0x13a6c9=_[_0x8358('0xc')]({'responder_id':_0x412bb9['id'],'requester_id':_0x1072b3['id'],'name':util[_0x8358('0xd')](_0x8358('0xe'),_0x121ec6['calleridname']),'phone':_0x121ec6[_0x8358('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x385952[_0x8358('0x10')],_0x121ec6,'\x20'),'description':intUtil[_0x8358('0x11')](_0x385952[_0x8358('0x12')],_0x121ec6,'
'),'tags':getTags(_0x385952['Tags'],_0x8358('0x13'))},getCustomFields(_0x385952[_0x8358('0x14')],_0x121ec6));_0x13a6c9[_0x8358('0x15')]=_['mapValues'](_[_0x8358('0x16')](_0x13a6c9[_0x8358('0x15')],'id'),_0x8358('0x17'));return request({'uri':util[_0x8358('0xd')](_0x8358('0x18'),_0x54314a[_0x8358('0x19')]),'method':_0x8358('0x1a'),'body':_0x13a6c9})[_0x8358('0x1b')](function(_0x531dec){logger[_0x8358('0xa')](_0x8358('0x1c'));return _0x531dec;});}function getUser(_0x5d24e7,_0x298077){if(intUtil[_0x8358('0x1d')](_0x298077)){return request({'uri':util[_0x8358('0xd')]('%s/api/v2/agents',_0x5d24e7[_0x8358('0x19')]),'qs':{'email':_0x298077}})[_0x8358('0x1b')](function(_0x2da5bb){if(_0x2da5bb[_0x8358('0x1e')]){logger[_0x8358('0xa')]('Agent\x20found!');return _['find'](_0x2da5bb,function(_0x3ce30d){return _0x3ce30d[_0x8358('0x1f')][_0x8358('0x20')]===_0x298077;});}else{logger[_0x8358('0xa')](_0x8358('0x21'));return request({'uri':util[_0x8358('0xd')](_0x8358('0x22'),_0x5d24e7[_0x8358('0x19')])})[_0x8358('0x1b')](function(_0xd8f924){logger[_0x8358('0xa')]('Admin\x20account\x20selected.');return _0xd8f924;});}});}else{logger[_0x8358('0xa')](_0x8358('0x23'));return request({'uri':util[_0x8358('0xd')](_0x8358('0x22'),_0x5d24e7['remoteUri'])})['then'](function(_0x66e31b){logger[_0x8358('0xa')](_0x8358('0x24'));return _0x66e31b;});}}function getEndUser(_0x3a4da7,_0x162c5e,_0x30424b){logger[_0x8358('0xa')]('Searching\x20enduser\x20with\x20phone',_0x30424b);return request({'uri':util[_0x8358('0xd')]('%s/api/v2/contacts',_0x3a4da7[_0x8358('0x19')]),'qs':{'phone':_0x30424b}})['then'](function(_0x29203f){if(_0x29203f[_0x8358('0x1e')]){logger['info'](_0x8358('0x25'));return _[_0x8358('0x26')](_0x29203f,{'phone':_0x30424b});}else{logger['info'](_0x8358('0x27'));return request({'uri':util['format'](_0x8358('0x28'),_0x3a4da7[_0x8358('0x19')]),'method':_0x8358('0x1a'),'body':{'name':_0x162c5e,'phone':_0x30424b}})[_0x8358('0x1b')](function(_0x14a3e6){logger[_0x8358('0xa')](_0x8358('0x29'));return _0x14a3e6;});}});}function getAuth(_0x4bba60){return util['format']('Basic\x20%s',new Buffer(_0x4bba60[_0x8358('0x2a')]+':X')['toString'](_0x8358('0x2b')));}function request(_0x7e0730){logger[_0x8358('0x2c')]('[HTTP]',JSON['stringify'](_0x7e0730));return rp(_[_0x8358('0x8')](_0x7e0730,{'method':_0x8358('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x29f9b1,_0xb25f09){var _0x8e1a6e=[];if(_0x29f9b1&&_0x29f9b1['length']>0x0){_0x8e1a6e=_[_0x8358('0x2e')](_0x29f9b1,_0xb25f09);}return _0x8e1a6e;}function getCustomFields(_0x16b8d3,_0x1db710){var _0x16c186=[];var _0xeb9e26={'custom_fields':[]};if(_0x16b8d3[_0x8358('0x1e')]>0x0){_[_0x8358('0x2f')](_0x16b8d3,function(_0x4b17ab){if(_[_0x8358('0x30')]([_0x8358('0x31'),_0x8358('0x32')],_0x4b17ab[_0x8358('0x33')])&&_0x4b17ab['nameField']&&!_0x4b17ab['customField']){_0xeb9e26[_0x4b17ab[_0x8358('0x34')][_0x8358('0x35')]()]=_0x4b17ab[_0x8358('0x36')]['toString']();}else if(_[_0x8358('0x30')]([_0x8358('0x31'),'picklist'],_0x4b17ab['type'])&&_0x4b17ab[_0x8358('0x37')]&&_0x4b17ab['customField']){_0xeb9e26['custom_fields'][_0x8358('0x38')]({'id':_0x4b17ab[_0x8358('0x37')],'value':_0x4b17ab[_0x8358('0x36')][_0x8358('0x39')]()});}else if(_0x4b17ab[_0x8358('0x33')]===_0x8358('0x3a')&&_0x4b17ab['variableName']&&_0x4b17ab[_0x8358('0x37')]&&_0x4b17ab[_0x8358('0x3b')]){_0x1db710[_0x4b17ab['variableName']]&&_0xeb9e26[_0x8358('0x15')][_0x8358('0x38')]({'id':_0x4b17ab['idField'],'value':_0x1db710[_0x4b17ab[_0x8358('0x3c')]][_0x8358('0x39')]()});}else if(_0x4b17ab[_0x8358('0x33')]==='customVariable'&&_0x4b17ab[_0x8358('0x3d')]&&_0x4b17ab['Variable']['name']&&_0x4b17ab[_0x8358('0x37')]&&_0x4b17ab['customField']){_0x1db710[_0x4b17ab[_0x8358('0x3d')][_0x8358('0x13')][_0x8358('0x35')]()]&&_0xeb9e26[_0x8358('0x15')]['push']({'id':_0x4b17ab[_0x8358('0x37')],'value':_0x1db710[_0x4b17ab[_0x8358('0x3d')][_0x8358('0x13')][_0x8358('0x35')]()]['toString']()});}});}return _0xeb9e26;}exports[_0x8358('0x3e')]=function(_0x17796a,_0x5a1394,_0xdfa842,_0x8e17d0,_0x4751c5,_0x35631f){var _0x3f4671,_0x2e083d;_0x35631f[_0x8358('0x19')]=intUtil['stripTrailingSlash'](_0x35631f[_0x8358('0x19')]);_0x35631f['serverUrl']=intUtil['stripTrailingSlash'](_0x35631f[_0x8358('0x3f')]);if(_0x4751c5&&_0x4751c5['monitor_format']){logger[_0x8358('0xa')](_0x8358('0x40'),'Recording\x20is\x20enabled!');_0x5a1394[_0x8358('0x41')]=util[_0x8358('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35631f[_0x8358('0x3f')],_0x5a1394[_0x8358('0x42')],md5(_0x5a1394[_0x8358('0x42')]));}else{_0x5a1394['recordingURL']='';}headers['Authorization']=getAuth(_0x35631f);return getUser(_0x35631f,_0x8e17d0[_0x8358('0x20')])[_0x8358('0x1b')](function(_0x1487ff){_0x3f4671=_0x1487ff;logger[_0x8358('0xa')](_0x8358('0x43'),_0x3f4671['id']);return getEndUser(_0x35631f,_0x5a1394[_0x8358('0x44')],_0x5a1394[_0x8358('0xf')]);})[_0x8358('0x1b')](function(_0x49645e){_0x2e083d=_0x49645e;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2e083d['id']);return getTicket(_0x35631f,_0x3f4671,_0x2e083d,_0xdfa842,_0x5a1394);})['then'](function(_0x196e3c){if(_0x196e3c&&_0x196e3c['id']){logger[_0x8358('0xa')](_0x8358('0x1c'));logger['info'](_0x8358('0x45'),_0x196e3c['id']);logger[_0x8358('0xa')](_0x8358('0x40'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8358('0xd')](_0x8358('0x46'),_0x8e17d0[_0x8358('0x13')]),_0x8358('0x47'),{'uri':util['format'](_0x8358('0x48'),_0x35631f['remoteUri'],_0x196e3c['id'])});}})[_0x8358('0x49')](function(_0x407587){logger[_0x8358('0x4a')](_0x8358('0x40'),JSON['stringify'](_0x407587));});};exports[_0x8358('0x4b')]=function(_0x19d071,_0x278f92,_0x438bed,_0x50f1c0,_0x296474,_0x1351b5,_0x512281){var _0x41c831,_0x7b1b1b;_0x1351b5['remoteUri']=intUtil[_0x8358('0x4c')](_0x1351b5[_0x8358('0x19')]);_0x1351b5[_0x8358('0x3f')]=intUtil[_0x8358('0x4c')](_0x1351b5[_0x8358('0x3f')]);if(_0x512281&&_0x512281[_0x8358('0x4d')]&&_0x512281[_0x8358('0x4d')]!==_0x8358('0x4e')){logger['info'](_0x8358('0x4f'),'Recording\x20is\x20enabled!');_0x278f92[_0x8358('0x41')]=util[_0x8358('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1351b5[_0x8358('0x3f')],_0x278f92['uniqueid'],md5(_0x278f92[_0x8358('0x42')]));}headers[_0x8358('0x50')]=getAuth(_0x1351b5);return getUser(_0x1351b5,_0x50f1c0[_0x8358('0x20')])['then'](function(_0x3eb9a1){_0x41c831=_0x3eb9a1;logger[_0x8358('0xa')](_0x8358('0x43'),_0x41c831['id']);return getEndUser(_0x1351b5,_0x278f92['destcalleridname'],_0x278f92['destcalleridnum']);})[_0x8358('0x1b')](function(_0x168752){_0x7b1b1b=_0x168752;logger[_0x8358('0xa')](_0x8358('0x51'),_0x7b1b1b['id']);return getTicket(_0x1351b5,_0x41c831,_0x7b1b1b,_0x438bed,_0x278f92);})[_0x8358('0x1b')](function(_0x23a50a){if(_0x23a50a&&_0x23a50a['id']){logger[_0x8358('0xa')](_0x8358('0x1c'));logger[_0x8358('0xa')]('The\x20Ticket\x20ID\x20is:',_0x23a50a['id']);logger[_0x8358('0xa')](_0x8358('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8358('0xd')](_0x8358('0x46'),_0x50f1c0[_0x8358('0x13')]),'trigger:browser:url',{'uri':util['format'](_0x8358('0x48'),_0x1351b5[_0x8358('0x19')],_0x23a50a['id'])});}})[_0x8358('0x49')](function(_0x4173a1){logger['error'](_0x8358('0x4f'),JSON[_0x8358('0x52')](_0x4173a1));});};exports[_0x8358('0x53')]=function(_0x2040e1,_0x5badc3,_0x4a7432,_0x226d7f,_0x9926bd,_0xea4714){var _0x3c5866,_0x254108;_0xea4714[_0x8358('0x19')]=intUtil['stripTrailingSlash'](_0xea4714['remoteUri']);_0xea4714[_0x8358('0x3f')]=intUtil[_0x8358('0x4c')](_0xea4714[_0x8358('0x3f')]);if(_0x9926bd&&_0x9926bd[_0x8358('0x54')]){logger[_0x8358('0xa')]('['+_0x5badc3['lastevent']['toUpperCase']()+']',_0x8358('0x55'));_0x5badc3['recordingURL']=util[_0x8358('0xd')](_0x8358('0x56'),_0xea4714[_0x8358('0x3f')],_0x5badc3[_0x8358('0x42')],md5(_0x5badc3[_0x8358('0x42')]));}else{_0x5badc3['recordingURL']='';}headers['Authorization']=getAuth(_0xea4714);return getUser(_0xea4714,'')['then'](function(_0x35f919){_0x3c5866=_0x35f919;logger[_0x8358('0xa')](_0x8358('0x43'),_0x3c5866['id']);return getEndUser(_0xea4714,_0x5badc3[_0x8358('0x44')],_0x5badc3['calleridnum']);})['then'](function(_0x260842){_0x254108=_0x260842;logger[_0x8358('0xa')]('The\x20Enduser\x20ID\x20is:',_0x254108['id']);return getTicket(_0xea4714,_0x3c5866,_0x254108,_0x4a7432,_0x5badc3);})[_0x8358('0x1b')](function(_0x28f56d){if(_0x28f56d){logger[_0x8358('0xa')](_0x8358('0x1c'));logger[_0x8358('0xa')](_0x8358('0x45'),_0x28f56d['id']);}})['catch'](function(_0x5a4ad9){logger['error']('['+_0x5badc3['lastevent'][_0x8358('0x57')]()+']',JSON['stringify'](_0x5a4ad9));});}; \ No newline at end of file +var _0xb968=['getString','
','Tags','name','Fields','mapValues','keyBy','custom_fields','value','format','%s/api/v2/tickets','remoteUri','then','info','Ticket\x20created!','validateEmail','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','length','Enduser\x20found!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','defaults','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','idField','push','variableName','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','Authorization','destcalleridname','%s/helpdesk/tickets/%d','stringify','unmanaged','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','localhost','socket.io-emitter','redis','application/json','emit','Creating\x20new\x20ticket...','merge'];(function(_0x24a6b7,_0xee99f1){var _0x59bbbc=function(_0x2e6a14){while(--_0x2e6a14){_0x24a6b7['push'](_0x24a6b7['shift']());}};_0x59bbbc(++_0xee99f1);}(_0xb968,0x106));var _0x8b96=function(_0x1cf78b,_0x51a581){_0x1cf78b=_0x1cf78b-0x0;var _0x5568b5=_0xb968[_0x1cf78b];return _0x5568b5;};'use strict';var _=require(_0x8b96('0x0'));var rp=require('request-promise');var md5=require(_0x8b96('0x1'));var util=require(_0x8b96('0x2'));var Redis=require(_0x8b96('0x3'));var intUtil=require('./util');var config=require(_0x8b96('0x4'));var logger=require(_0x8b96('0x5'))(_0x8b96('0x6'));config['redis']=_['defaults'](config['redis'],{'host':_0x8b96('0x7'),'port':0x18eb});var io=require(_0x8b96('0x8'))(new Redis(config[_0x8b96('0x9')]));var headers={'Content-Type':_0x8b96('0xa'),'Accept':'application/json'};function emit(_0x220e8f,_0x2d7dab,_0x367fc0){io['to'](_0x220e8f)[_0x8b96('0xb')](_0x2d7dab,_0x367fc0);}function getTicket(_0x5adf42,_0x1ced59,_0x5cfca2,_0x183401,_0xf59807){logger['info'](_0x8b96('0xc'));var _0x8af01=_[_0x8b96('0xd')]({'responder_id':_0x1ced59['id'],'requester_id':_0x5cfca2['id'],'name':util['format']('Caller\x20-\x20%s',_0xf59807['calleridname']),'phone':_0xf59807['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8b96('0xe')](_0x183401['Subjects'],_0xf59807,'\x20'),'description':intUtil[_0x8b96('0xe')](_0x183401['Descriptions'],_0xf59807,_0x8b96('0xf')),'tags':getTags(_0x183401[_0x8b96('0x10')],_0x8b96('0x11'))},getCustomFields(_0x183401[_0x8b96('0x12')],_0xf59807));_0x8af01['custom_fields']=_[_0x8b96('0x13')](_[_0x8b96('0x14')](_0x8af01[_0x8b96('0x15')],'id'),_0x8b96('0x16'));return request({'uri':util[_0x8b96('0x17')](_0x8b96('0x18'),_0x5adf42[_0x8b96('0x19')]),'method':'POST','body':_0x8af01})[_0x8b96('0x1a')](function(_0x5d6956){logger[_0x8b96('0x1b')](_0x8b96('0x1c'));return _0x5d6956;});}function getUser(_0x340ef6,_0x560a3f){if(intUtil[_0x8b96('0x1d')](_0x560a3f)){return request({'uri':util[_0x8b96('0x17')]('%s/api/v2/agents',_0x340ef6[_0x8b96('0x19')]),'qs':{'email':_0x560a3f}})[_0x8b96('0x1a')](function(_0x25abf6){if(_0x25abf6['length']){logger[_0x8b96('0x1b')](_0x8b96('0x1e'));return _[_0x8b96('0x1f')](_0x25abf6,function(_0x28f62c){return _0x28f62c[_0x8b96('0x20')]['email']===_0x560a3f;});}else{logger[_0x8b96('0x1b')](_0x8b96('0x21'));return request({'uri':util['format'](_0x8b96('0x22'),_0x340ef6[_0x8b96('0x19')])})[_0x8b96('0x1a')](function(_0x4bcd71){logger[_0x8b96('0x1b')](_0x8b96('0x23'));return _0x4bcd71;});}});}else{logger[_0x8b96('0x1b')](_0x8b96('0x24'));return request({'uri':util[_0x8b96('0x17')](_0x8b96('0x22'),_0x340ef6[_0x8b96('0x19')])})[_0x8b96('0x1a')](function(_0x42af8f){logger[_0x8b96('0x1b')](_0x8b96('0x23'));return _0x42af8f;});}}function getEndUser(_0x36b496,_0x1235d7,_0x4b10d0){logger[_0x8b96('0x1b')](_0x8b96('0x25'),_0x4b10d0);return request({'uri':util['format']('%s/api/v2/contacts',_0x36b496['remoteUri']),'qs':{'phone':_0x4b10d0}})[_0x8b96('0x1a')](function(_0x13bff6){if(_0x13bff6[_0x8b96('0x26')]){logger[_0x8b96('0x1b')](_0x8b96('0x27'));return _['find'](_0x13bff6,{'phone':_0x4b10d0});}else{logger[_0x8b96('0x1b')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/api/v2/contacts',_0x36b496[_0x8b96('0x19')]),'method':_0x8b96('0x28'),'body':{'name':_0x1235d7,'phone':_0x4b10d0}})[_0x8b96('0x1a')](function(_0x11cf1a){logger[_0x8b96('0x1b')](_0x8b96('0x29'));return _0x11cf1a;});}});}function getAuth(_0x50c279){return util[_0x8b96('0x17')](_0x8b96('0x2a'),new Buffer(_0x50c279[_0x8b96('0x2b')]+':X')[_0x8b96('0x2c')](_0x8b96('0x2d')));}function request(_0x47ee78){logger[_0x8b96('0x2e')](_0x8b96('0x2f'),JSON['stringify'](_0x47ee78));return rp(_[_0x8b96('0x30')](_0x47ee78,{'method':_0x8b96('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x464ace,_0x19b868){var _0x369e42=[];if(_0x464ace&&_0x464ace['length']>0x0){_0x369e42=_[_0x8b96('0x32')](_0x464ace,_0x19b868);}return _0x369e42;}function getCustomFields(_0x24b673,_0x6e50f2){var _0x5f3ee4=[];var _0x1ce9ba={'custom_fields':[]};if(_0x24b673[_0x8b96('0x26')]>0x0){_[_0x8b96('0x33')](_0x24b673,function(_0xf3ed3f){if(_[_0x8b96('0x34')](['string',_0x8b96('0x35')],_0xf3ed3f[_0x8b96('0x36')])&&_0xf3ed3f[_0x8b96('0x37')]&&!_0xf3ed3f[_0x8b96('0x38')]){_0x1ce9ba[_0xf3ed3f['nameField'][_0x8b96('0x39')]()]=_0xf3ed3f[_0x8b96('0x3a')][_0x8b96('0x2c')]();}else if(_[_0x8b96('0x34')](['string','picklist'],_0xf3ed3f['type'])&&_0xf3ed3f[_0x8b96('0x3b')]&&_0xf3ed3f[_0x8b96('0x38')]){_0x1ce9ba[_0x8b96('0x15')][_0x8b96('0x3c')]({'id':_0xf3ed3f[_0x8b96('0x3b')],'value':_0xf3ed3f[_0x8b96('0x3a')][_0x8b96('0x2c')]()});}else if(_0xf3ed3f[_0x8b96('0x36')]==='variable'&&_0xf3ed3f[_0x8b96('0x3d')]&&_0xf3ed3f[_0x8b96('0x3b')]&&_0xf3ed3f[_0x8b96('0x38')]){_0x6e50f2[_0xf3ed3f['variableName']]&&_0x1ce9ba[_0x8b96('0x15')][_0x8b96('0x3c')]({'id':_0xf3ed3f[_0x8b96('0x3b')],'value':_0x6e50f2[_0xf3ed3f['variableName']]['toString']()});}else if(_0xf3ed3f['type']==='customVariable'&&_0xf3ed3f[_0x8b96('0x3e')]&&_0xf3ed3f[_0x8b96('0x3e')][_0x8b96('0x11')]&&_0xf3ed3f['idField']&&_0xf3ed3f[_0x8b96('0x38')]){_0x6e50f2[_0xf3ed3f[_0x8b96('0x3e')][_0x8b96('0x11')]['toLowerCase']()]&&_0x1ce9ba[_0x8b96('0x15')][_0x8b96('0x3c')]({'id':_0xf3ed3f[_0x8b96('0x3b')],'value':_0x6e50f2[_0xf3ed3f['Variable'][_0x8b96('0x11')][_0x8b96('0x39')]()][_0x8b96('0x2c')]()});}});}return _0x1ce9ba;}exports['queue']=function(_0x329172,_0x4c3423,_0x481c2e,_0x579823,_0x17a014,_0x3ff2a1){var _0x25903b,_0x4f1c5d;_0x3ff2a1[_0x8b96('0x19')]=intUtil[_0x8b96('0x3f')](_0x3ff2a1[_0x8b96('0x19')]);_0x3ff2a1[_0x8b96('0x40')]=intUtil[_0x8b96('0x3f')](_0x3ff2a1[_0x8b96('0x40')]);if(_0x17a014&&_0x17a014[_0x8b96('0x41')]){logger[_0x8b96('0x1b')](_0x8b96('0x42'),_0x8b96('0x43'));_0x4c3423['recordingURL']=util[_0x8b96('0x17')](_0x8b96('0x44'),_0x3ff2a1['serverUrl'],_0x4c3423[_0x8b96('0x45')],md5(_0x4c3423[_0x8b96('0x45')]));}else{_0x4c3423[_0x8b96('0x46')]='';}headers['Authorization']=getAuth(_0x3ff2a1);return getUser(_0x3ff2a1,_0x579823[_0x8b96('0x47')])['then'](function(_0x2b53ad){_0x25903b=_0x2b53ad;logger['info'](_0x8b96('0x48'),_0x25903b['id']);return getEndUser(_0x3ff2a1,_0x4c3423[_0x8b96('0x49')],_0x4c3423['calleridnum']);})[_0x8b96('0x1a')](function(_0x5687eb){_0x4f1c5d=_0x5687eb;logger[_0x8b96('0x1b')](_0x8b96('0x4a'),_0x4f1c5d['id']);return getTicket(_0x3ff2a1,_0x25903b,_0x4f1c5d,_0x481c2e,_0x4c3423);})[_0x8b96('0x1a')](function(_0x526346){if(_0x526346&&_0x526346['id']){logger[_0x8b96('0x1b')](_0x8b96('0x1c'));logger[_0x8b96('0x1b')](_0x8b96('0x4b'),_0x526346['id']);logger[_0x8b96('0x1b')]('[QUEUE]',_0x8b96('0x4c'));emit(util[_0x8b96('0x17')](_0x8b96('0x4d'),_0x579823[_0x8b96('0x11')]),_0x8b96('0x4e'),{'uri':util[_0x8b96('0x17')]('%s/helpdesk/tickets/%d',_0x3ff2a1[_0x8b96('0x19')],_0x526346['id'])});}})[_0x8b96('0x4f')](function(_0x3e994e){logger[_0x8b96('0x50')](_0x8b96('0x42'),JSON['stringify'](_0x3e994e));});};exports[_0x8b96('0x51')]=function(_0x3b3285,_0x2b9c47,_0xed262c,_0x370b54,_0x38b7bb,_0x4acfe9,_0x4c6ca7){var _0x5aa600,_0x554920;_0x4acfe9[_0x8b96('0x19')]=intUtil[_0x8b96('0x3f')](_0x4acfe9[_0x8b96('0x19')]);_0x4acfe9['serverUrl']=intUtil[_0x8b96('0x3f')](_0x4acfe9[_0x8b96('0x40')]);if(_0x4c6ca7&&_0x4c6ca7['recordingFormat']&&_0x4c6ca7[_0x8b96('0x52')]!==_0x8b96('0x53')){logger['info']('[OUTBOUND]',_0x8b96('0x43'));_0x2b9c47['recordingURL']=util['format'](_0x8b96('0x44'),_0x4acfe9[_0x8b96('0x40')],_0x2b9c47[_0x8b96('0x45')],md5(_0x2b9c47[_0x8b96('0x45')]));}headers[_0x8b96('0x54')]=getAuth(_0x4acfe9);return getUser(_0x4acfe9,_0x370b54[_0x8b96('0x47')])[_0x8b96('0x1a')](function(_0xc5b0bf){_0x5aa600=_0xc5b0bf;logger['info'](_0x8b96('0x48'),_0x5aa600['id']);return getEndUser(_0x4acfe9,_0x2b9c47[_0x8b96('0x55')],_0x2b9c47['destcalleridnum']);})[_0x8b96('0x1a')](function(_0x49bc2b){_0x554920=_0x49bc2b;logger[_0x8b96('0x1b')](_0x8b96('0x4a'),_0x554920['id']);return getTicket(_0x4acfe9,_0x5aa600,_0x554920,_0xed262c,_0x2b9c47);})[_0x8b96('0x1a')](function(_0x1b256b){if(_0x1b256b&&_0x1b256b['id']){logger['info']('Ticket\x20created!');logger[_0x8b96('0x1b')](_0x8b96('0x4b'),_0x1b256b['id']);logger['info']('[OUTBOUND]',_0x8b96('0x4c'));emit(util[_0x8b96('0x17')]('user:%s',_0x370b54[_0x8b96('0x11')]),_0x8b96('0x4e'),{'uri':util['format'](_0x8b96('0x56'),_0x4acfe9[_0x8b96('0x19')],_0x1b256b['id'])});}})[_0x8b96('0x4f')](function(_0x3342f6){logger[_0x8b96('0x50')]('[OUTBOUND]',JSON[_0x8b96('0x57')](_0x3342f6));});};exports[_0x8b96('0x58')]=function(_0x4ce74e,_0x3dabf3,_0x3c44da,_0x487821,_0x1a818c,_0x5acbeb){var _0x570d1e,_0x231514;_0x5acbeb[_0x8b96('0x19')]=intUtil[_0x8b96('0x3f')](_0x5acbeb[_0x8b96('0x19')]);_0x5acbeb[_0x8b96('0x40')]=intUtil[_0x8b96('0x3f')](_0x5acbeb[_0x8b96('0x40')]);if(_0x1a818c&&_0x1a818c[_0x8b96('0x41')]){logger['info']('['+_0x3dabf3[_0x8b96('0x59')][_0x8b96('0x5a')]()+']',_0x8b96('0x43'));_0x3dabf3[_0x8b96('0x46')]=util[_0x8b96('0x17')](_0x8b96('0x44'),_0x5acbeb[_0x8b96('0x40')],_0x3dabf3[_0x8b96('0x45')],md5(_0x3dabf3[_0x8b96('0x45')]));}else{_0x3dabf3['recordingURL']='';}headers[_0x8b96('0x54')]=getAuth(_0x5acbeb);return getUser(_0x5acbeb,'')[_0x8b96('0x1a')](function(_0x585e0c){_0x570d1e=_0x585e0c;logger[_0x8b96('0x1b')](_0x8b96('0x48'),_0x570d1e['id']);return getEndUser(_0x5acbeb,_0x3dabf3[_0x8b96('0x49')],_0x3dabf3[_0x8b96('0x5b')]);})['then'](function(_0x847983){_0x231514=_0x847983;logger[_0x8b96('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x231514['id']);return getTicket(_0x5acbeb,_0x570d1e,_0x231514,_0x3c44da,_0x3dabf3);})[_0x8b96('0x1a')](function(_0x3eaedf){if(_0x3eaedf){logger[_0x8b96('0x1b')](_0x8b96('0x1c'));logger[_0x8b96('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x3eaedf['id']);}})['catch'](function(_0x285d68){logger['error']('['+_0x3dabf3[_0x8b96('0x59')][_0x8b96('0x5a')]()+']',JSON[_0x8b96('0x57')](_0x285d68));});}; \ 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 ee032e4..8bac8f2 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 _0x2d29=['Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','/api/lookup?q=','&f=','&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:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','user:%s','emit','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','util','moment','bluebird','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0x2d29,0x8e));var _0x92d2=function(_0x592da3,_0x4bc81d){_0x592da3=_0x592da3-0x0;var _0x5dd68e=_0x2d29[_0x592da3];return _0x5dd68e;};'use strict';var _=require(_0x92d2('0x0'));var rp=require(_0x92d2('0x1'));var md5=require('md5');var util=require(_0x92d2('0x2'));var moment=require(_0x92d2('0x3'));var Promise=require(_0x92d2('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x92d2('0x5'));config[_0x92d2('0x6')]=_[_0x92d2('0x7')](config[_0x92d2('0x6')],{'host':_0x92d2('0x8'),'port':0x18eb});var io=require(_0x92d2('0x9'))(new Redis(config[_0x92d2('0x6')]));function getAdminId(_0x495b22,_0x416335,_0x32a57a,_0x2322fa){return new Promise(function(_0x50bbce,_0x819063){var _0x14c78c=![];var _0x520386={'method':_0x92d2('0xa'),'uri':_0x2322fa+_0x92d2('0xb'),'json':!![]};_0x520386[_0x92d2('0xc')]=_0x32a57a;logger[_0x92d2('0xd')](_0x92d2('0xe'));return rp(_0x520386)[_0x92d2('0xf')](function(_0x403e68){if(_0x403e68){var _0x32f20e=_0x403e68[_0x92d2('0x10')];var _0x214a46=null;for(_0x214a46=0x0;_0x214a46<_0x32f20e['length'];_0x214a46++){if(_0x32f20e[_0x214a46][_0x92d2('0x11')]===_0x495b22[_0x92d2('0x12')]){_0x495b22[_0x92d2('0x13')]=_0x32f20e[_0x214a46]['id'];_0x14c78c=!![];}}if(_0x14c78c){logger[_0x92d2('0xd')](_0x92d2('0x14'),_0x495b22['adminId']);_0x50bbce(_0x495b22);}else{_0x819063({'statusCode':0x194,'message':_0x92d2('0x15')});}}else{_0x819063({'statusCode':0x194,'message':_0x92d2('0x15')});}})[_0x92d2('0x16')](function(_0x5aa088){logger[_0x92d2('0x17')]('['+[_0x416335[_0x92d2('0x18')]()]+']',_0x5aa088[_0x92d2('0x19')]);_0x819063(_0x5aa088);});});}function getUser(_0x19187a,_0x29ac3a,_0xfc2544){return function(_0x378335){return new Promise(function(_0x15fbbd,_0x17028f){var _0x419917={'method':_0x92d2('0xa'),'uri':_0xfc2544+'/api/selector/owners','json':!![]};_0x419917[_0x92d2('0xc')]=_0x29ac3a;logger[_0x92d2('0xd')](_0x92d2('0x1a'));return rp(_0x419917)[_0x92d2('0xf')](function(_0x2d35da){if(_0x2d35da){var _0x3bc5cb=_0x2d35da[_0x92d2('0x10')];var _0x329891=![];var _0x2a74ed=null;if(_0x378335[_0x92d2('0x1b')]!==null){logger[_0x92d2('0xd')](_0x92d2('0x1c'),_0x378335[_0x92d2('0x1b')]);_0x378335[_0x92d2('0x1d')]=_0x378335['agentEmail'];for(_0x2a74ed=0x0;_0x2a74ed<_0x3bc5cb['length'];_0x2a74ed++){if(_0x3bc5cb[_0x2a74ed][_0x92d2('0x11')]===_0x378335[_0x92d2('0x1b')]){_0x329891=!![];_0x378335['userId']=_0x3bc5cb[_0x2a74ed]['id'];logger[_0x92d2('0xd')](_0x92d2('0x1e'),_0x378335['userId']);}}}if(!_0x329891){logger[_0x92d2('0xd')]('Admin\x20selected');_0x378335['userEmail']=_0x378335['adminEmail'];_0x378335[_0x92d2('0x1f')]=_0x378335[_0x92d2('0x13')];_0x329891=!![];}if(_0x329891){_0x15fbbd(_0x378335);}else{_0x17028f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x17028f({'statusCode':0x194,'message':_0x92d2('0x15')});}})[_0x92d2('0x16')](function(_0x36eeef){logger['error']('['+[_0x19187a[_0x92d2('0x18')]()]+']',_0x36eeef['message']);_0x17028f(_0x36eeef);});});};}function searchContact(_0x958375,_0x270d0d,_0x1a84b6,_0x38be2f){return new Promise(function(_0x3270e0,_0x548bf9){var _0x5eb892={'method':'GET','headers':_0x270d0d,'uri':_0x958375+_0x92d2('0x20')+_0x38be2f+_0x92d2('0x21')+_0x1a84b6+_0x92d2('0x22'),'json':!![]};rp(_0x5eb892)[_0x92d2('0xf')](function(_0x51ed15){var _0x590728=_[_0x92d2('0x23')](_0x51ed15[_0x92d2('0x24')][_0x92d2('0x24')],[_0x1a84b6,_0x38be2f]);_0x3270e0(_0x590728);})[_0x92d2('0x16')](function(_0xf9e9e4){_0x548bf9(_0xf9e9e4);});});}function getEndUser(_0x1b140e,_0x1fafdc,_0x10af91){return function(_0x118ee4){return new Promise(function(_0x83f7ae,_0x575ded){logger[_0x92d2('0xd')](util[_0x92d2('0x25')](_0x92d2('0x26'),_0x118ee4[_0x92d2('0x27')]));searchContact(_0x10af91,_0x1fafdc,_0x92d2('0x28'),_0x118ee4['contactNumber'])[_0x92d2('0xf')](function(_0x1c598e){if(_0x1c598e){_0x118ee4[_0x92d2('0x29')]=_0x1c598e['id'];logger['info'](_0x92d2('0x2a'),_0x118ee4[_0x92d2('0x29')]);return _0x83f7ae(_0x118ee4);}searchContact(_0x10af91,_0x1fafdc,_0x92d2('0x2b'),_0x118ee4[_0x92d2('0x27')])['then'](function(_0x585235){if(_0x585235){_0x118ee4[_0x92d2('0x29')]=_0x585235['id'];logger[_0x92d2('0xd')](_0x92d2('0x2c'),_0x118ee4[_0x92d2('0x29')]);return _0x83f7ae(_0x118ee4);}createEndUser(_0x118ee4,_0x1b140e,_0x1fafdc,_0x10af91)[_0x92d2('0xf')](function(_0x57eab7){logger['info'](_0x92d2('0x2d'),_0x57eab7[_0x92d2('0x29')]);return _0x83f7ae(_0x57eab7);});});})['catch'](function(_0x25cb76){_0x575ded(_0x25cb76);});});};}function createEndUser(_0xf56f06,_0x287c51,_0x411179,_0x411cc5){return new Promise(function(_0x2264dc,_0x157716){var _0x5d8068=moment();var _0x480250={'method':_0x92d2('0x2e'),'uri':_0x411cc5+_0x92d2('0x2f'),'body':{'contact':{'last_name':_0xf56f06[_0x92d2('0x27')],'work_number':_0xf56f06[_0x92d2('0x27')],'mobile_number':_0xf56f06[_0x92d2('0x27')],'owner_id':_0xf56f06['userId'],'created_at':_0x5d8068[_0x92d2('0x25')](_0x92d2('0x30'))}},'json':!![]};_0x480250[_0x92d2('0xc')]=_0x411179;logger['info'](_0x92d2('0x31'));return rp(_0x480250)[_0x92d2('0xf')](function(_0x3db47e){_0xf56f06[_0x92d2('0x29')]=_0x3db47e[_0x92d2('0x32')]['id'];_0x2264dc(_0xf56f06);})[_0x92d2('0x16')](function(_0x5d55c8){logger['error']('['+[_0x287c51[_0x92d2('0x18')]()]+']',_0x5d55c8[_0x92d2('0x19')]);_0x157716(_0x5d55c8[_0x92d2('0x19')]);});});}function getTicket(_0x1f0861,_0x1a76ec,_0x21f040,_0xf22d98,_0x4d6fee){return function(_0x30f4dc){logger[_0x92d2('0xd')](_0x92d2('0x33'));return new Promise(function(_0xbf415e,_0x57ec94){var _0x2972e9=moment();var _0x329c46={'method':'POST','uri':_0x21f040+_0x92d2('0x34'),'body':{'title':intUtil[_0x92d2('0x35')](_0xf22d98[_0x92d2('0x36')],_0x4d6fee,'\x20'),'description':intUtil[_0x92d2('0x35')](_0xf22d98[_0x92d2('0x37')],_0x4d6fee,'\x0a'),'owner_id':_0x30f4dc[_0x92d2('0x1f')],'creater_id':_0x30f4dc[_0x92d2('0x13')],'targetable_id':_0x30f4dc[_0x92d2('0x29')],'targetable_type':_0x92d2('0x38'),'created_at':_0x2972e9[_0x92d2('0x25')](_0x92d2('0x30')),'due_date':_0x2972e9[_0x92d2('0x39')](0x1e,'m')[_0x92d2('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x329c46['headers']=_0x1a76ec;return rp(_0x329c46)[_0x92d2('0xf')](function(_0x12d502){_0x30f4dc[_0x92d2('0x3a')]=_0x12d502['task']['id'];logger['info']('Task\x20created:',_0x30f4dc[_0x92d2('0x3a')]);_0xbf415e(_0x30f4dc);})[_0x92d2('0x16')](function(_0x56b69e){logger['error']('['+[_0x1f0861[_0x92d2('0x18')]()]+']',_0x56b69e[_0x92d2('0x19')]);_0x57ec94(_0x56b69e[_0x92d2('0x19')]);});});};}function emit(_0xc20dc7,_0x39c13c,_0x517186){var _0x5d20b3={'uri':_0xc20dc7+'/contacts/'+_0x517186};io['to'](util['format'](_0x92d2('0x3b'),_0x39c13c))[_0x92d2('0x3c')]('trigger:browser:url',_0x5d20b3);}exports['cs']=function(_0x5b94c6,_0x50ca9b,_0x4a3a1,_0x571b2f,_0x29021e,_0x30040c,_0x3ad986,_0x53cbde){var _0x5727ad={};var _0x6a0c67={'Authorization':'Token\x20token='+_0x30040c['apiKey']};_0x30040c[_0x92d2('0x3d')]=intUtil[_0x92d2('0x3e')](_0x30040c[_0x92d2('0x3d')]);_0x30040c[_0x92d2('0x3f')]=intUtil[_0x92d2('0x3e')](_0x30040c[_0x92d2('0x3f')]);var _0x27d6c4=_0x30040c['remoteUri'];_0x5727ad[_0x92d2('0x12')]=_0x30040c[_0x92d2('0x40')];_0x5727ad[_0x92d2('0x27')]=_0x53cbde[_0x92d2('0x41')]()==='outbound'?_0x50ca9b[_0x92d2('0x42')]:_0x50ca9b[_0x92d2('0x43')];_0x5727ad[_0x92d2('0x44')]=_0x53cbde===_0x92d2('0x45')||_0x53cbde===_0x92d2('0x46')?_0x92d2('0x45'):'outbound';if(_0x571b2f){_0x5727ad[_0x92d2('0x1b')]=_0x571b2f[_0x92d2('0x11')];}var _0x2c1d25=util[_0x92d2('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x30040c['serverUrl'],_0x50ca9b[_0x92d2('0x47')],md5(_0x50ca9b[_0x92d2('0x47')]));if(_0x29021e&&_0x29021e['monitor_format']){logger[_0x92d2('0xd')](_0x92d2('0x48'),'Recording\x20is\x20enabled!');_0x50ca9b[_0x92d2('0x49')]=_0x2c1d25;}else if(_0x3ad986&&_0x3ad986[_0x92d2('0x4a')]&&_0x3ad986['recordingFormat']!==_0x92d2('0x4b')){logger['info'](_0x92d2('0x4c'),_0x92d2('0x4d'));_0x50ca9b[_0x92d2('0x49')]=_0x2c1d25;}else{_0x50ca9b[_0x92d2('0x49')]='';}return getAdminId(_0x5727ad,_0x53cbde,_0x6a0c67,_0x27d6c4)[_0x92d2('0xf')](getUser(_0x53cbde,_0x6a0c67,_0x27d6c4))[_0x92d2('0xf')](getEndUser(_0x53cbde,_0x6a0c67,_0x27d6c4))['then'](getTicket(_0x53cbde,_0x6a0c67,_0x27d6c4,_0x4a3a1,_0x50ca9b))[_0x92d2('0xf')](function(_0x5eb95a){logger[_0x92d2('0xd')](util[_0x92d2('0x25')](_0x92d2('0x4e'),_0x5eb95a[_0x92d2('0x3a')]));if(_0x53cbde!==_0x92d2('0x46')){logger['info']('['+[_0x53cbde[_0x92d2('0x18')]()]+']',_0x92d2('0x4f'));emit(_0x27d6c4,_0x571b2f['name'],_0x5eb95a[_0x92d2('0x29')]);}})[_0x92d2('0x16')](function(_0x4fd1cf){logger[_0x92d2('0x17')]('['+[_0x53cbde[_0x92d2('0x18')]()]+_0x92d2('0x50'),util['inspect'](_0x4fd1cf,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xfaec=['bluebird','./util','../../../../config/environment','freshsales','defaults','redis','socket.io-emitter','GET','/api/selector/owners','info','then','users','length','email','adminEmail','adminId','message','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Descriptions','Contact','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','lodash','request-promise','md5','util','moment'];(function(_0xf422e7,_0x1f750c){var _0x141bb2=function(_0xa25918){while(--_0xa25918){_0xf422e7['push'](_0xf422e7['shift']());}};_0x141bb2(++_0x1f750c);}(_0xfaec,0x1db));var _0xcfae=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xfaec[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xcfae('0x0'));var rp=require(_0xcfae('0x1'));var md5=require(_0xcfae('0x2'));var util=require(_0xcfae('0x3'));var moment=require(_0xcfae('0x4'));var Promise=require(_0xcfae('0x5'));var Redis=require('ioredis');var intUtil=require(_0xcfae('0x6'));var config=require(_0xcfae('0x7'));var logger=require('../../../../config/logger')(_0xcfae('0x8'));config['redis']=_[_0xcfae('0x9')](config[_0xcfae('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xcfae('0xb'))(new Redis(config[_0xcfae('0xa')]));function getAdminId(_0x4b349f,_0x15852a,_0x373c91,_0x2bf3d8){return new Promise(function(_0x5734ae,_0x1cc564){var _0x4cad96=![];var _0x546f35={'method':_0xcfae('0xc'),'uri':_0x2bf3d8+_0xcfae('0xd'),'json':!![]};_0x546f35['headers']=_0x373c91;logger[_0xcfae('0xe')]('Getting\x20admin\x20information');return rp(_0x546f35)[_0xcfae('0xf')](function(_0x56eab4){if(_0x56eab4){var _0x9c001d=_0x56eab4[_0xcfae('0x10')];var _0x57bf75=null;for(_0x57bf75=0x0;_0x57bf75<_0x9c001d[_0xcfae('0x11')];_0x57bf75++){if(_0x9c001d[_0x57bf75][_0xcfae('0x12')]===_0x4b349f[_0xcfae('0x13')]){_0x4b349f[_0xcfae('0x14')]=_0x9c001d[_0x57bf75]['id'];_0x4cad96=!![];}}if(_0x4cad96){logger[_0xcfae('0xe')]('Admin\x20found:',_0x4b349f[_0xcfae('0x14')]);_0x5734ae(_0x4b349f);}else{_0x1cc564({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x1cc564({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x47dde3){logger['error']('['+[_0x15852a['toUpperCase']()]+']',_0x47dde3[_0xcfae('0x15')]);_0x1cc564(_0x47dde3);});});}function getUser(_0xa7a2ee,_0x494232,_0x3d1541){return function(_0x4693c3){return new Promise(function(_0x4dff82,_0x1275e7){var _0x4d8a87={'method':_0xcfae('0xc'),'uri':_0x3d1541+'/api/selector/owners','json':!![]};_0x4d8a87[_0xcfae('0x16')]=_0x494232;logger[_0xcfae('0xe')](_0xcfae('0x17'));return rp(_0x4d8a87)[_0xcfae('0xf')](function(_0x1d55d1){if(_0x1d55d1){var _0x13286a=_0x1d55d1[_0xcfae('0x10')];var _0x24698f=![];var _0x2461b3=null;if(_0x4693c3[_0xcfae('0x18')]!==null){logger[_0xcfae('0xe')](_0xcfae('0x19'),_0x4693c3[_0xcfae('0x18')]);_0x4693c3[_0xcfae('0x1a')]=_0x4693c3[_0xcfae('0x18')];for(_0x2461b3=0x0;_0x2461b3<_0x13286a[_0xcfae('0x11')];_0x2461b3++){if(_0x13286a[_0x2461b3][_0xcfae('0x12')]===_0x4693c3[_0xcfae('0x18')]){_0x24698f=!![];_0x4693c3[_0xcfae('0x1b')]=_0x13286a[_0x2461b3]['id'];logger[_0xcfae('0xe')]('User\x20found:',_0x4693c3['userId']);}}}if(!_0x24698f){logger[_0xcfae('0xe')](_0xcfae('0x1c'));_0x4693c3[_0xcfae('0x1a')]=_0x4693c3[_0xcfae('0x13')];_0x4693c3[_0xcfae('0x1b')]=_0x4693c3[_0xcfae('0x14')];_0x24698f=!![];}if(_0x24698f){_0x4dff82(_0x4693c3);}else{_0x1275e7({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x1275e7({'statusCode':0x194,'message':_0xcfae('0x1d')});}})[_0xcfae('0x1e')](function(_0x6e72f8){logger[_0xcfae('0x1f')]('['+[_0xa7a2ee[_0xcfae('0x20')]()]+']',_0x6e72f8[_0xcfae('0x15')]);_0x1275e7(_0x6e72f8);});});};}function searchContact(_0x3fb3d7,_0x135fcd,_0xe9977a,_0x3ea37b){return new Promise(function(_0x3b60f9,_0x199cf3){var _0x55433d={'method':_0xcfae('0xc'),'headers':_0x135fcd,'uri':_0x3fb3d7+_0xcfae('0x21')+_0x3ea37b+_0xcfae('0x22')+_0xe9977a+_0xcfae('0x23'),'json':!![]};rp(_0x55433d)['then'](function(_0x649347){var _0xbdf20f=_[_0xcfae('0x24')](_0x649347[_0xcfae('0x25')][_0xcfae('0x25')],[_0xe9977a,_0x3ea37b]);_0x3b60f9(_0xbdf20f);})[_0xcfae('0x1e')](function(_0x696558){_0x199cf3(_0x696558);});});}function getEndUser(_0x257f16,_0x1f2477,_0x18f353){return function(_0x1f30eb){return new Promise(function(_0x3cd7b3,_0x3e5b5b){logger['info'](util['format'](_0xcfae('0x26'),_0x1f30eb['contactNumber']));searchContact(_0x18f353,_0x1f2477,'mobile_number',_0x1f30eb[_0xcfae('0x27')])['then'](function(_0x1c4452){if(_0x1c4452){_0x1f30eb[_0xcfae('0x28')]=_0x1c4452['id'];logger[_0xcfae('0xe')]('Contact\x20found\x20mobile_number:',_0x1f30eb[_0xcfae('0x28')]);return _0x3cd7b3(_0x1f30eb);}searchContact(_0x18f353,_0x1f2477,'work_number',_0x1f30eb['contactNumber'])['then'](function(_0x483c4d){if(_0x483c4d){_0x1f30eb[_0xcfae('0x28')]=_0x483c4d['id'];logger[_0xcfae('0xe')]('Contact\x20found\x20work_number:',_0x1f30eb[_0xcfae('0x28')]);return _0x3cd7b3(_0x1f30eb);}createEndUser(_0x1f30eb,_0x257f16,_0x1f2477,_0x18f353)['then'](function(_0x54b7ed){logger[_0xcfae('0xe')](_0xcfae('0x29'),_0x54b7ed['endUserId']);return _0x3cd7b3(_0x54b7ed);});});})[_0xcfae('0x1e')](function(_0x234fd3){_0x3e5b5b(_0x234fd3);});});};}function createEndUser(_0xbf0d9c,_0x5b4835,_0x822d3a,_0x45128e){return new Promise(function(_0x374865,_0x227159){var _0x1fb5d3=moment();var _0x2a9661={'method':_0xcfae('0x2a'),'uri':_0x45128e+_0xcfae('0x2b'),'body':{'contact':{'last_name':_0xbf0d9c['contactNumber'],'work_number':_0xbf0d9c[_0xcfae('0x27')],'mobile_number':_0xbf0d9c['contactNumber'],'owner_id':_0xbf0d9c[_0xcfae('0x1b')],'created_at':_0x1fb5d3[_0xcfae('0x2c')](_0xcfae('0x2d'))}},'json':!![]};_0x2a9661[_0xcfae('0x16')]=_0x822d3a;logger[_0xcfae('0xe')](_0xcfae('0x2e'));return rp(_0x2a9661)[_0xcfae('0xf')](function(_0x19f3d1){_0xbf0d9c[_0xcfae('0x28')]=_0x19f3d1[_0xcfae('0x2f')]['id'];_0x374865(_0xbf0d9c);})['catch'](function(_0x23dd28){logger[_0xcfae('0x1f')]('['+[_0x5b4835['toUpperCase']()]+']',_0x23dd28['message']);_0x227159(_0x23dd28['message']);});});}function getTicket(_0x5a42df,_0x815cf8,_0x533696,_0x51e527,_0x3e8075){return function(_0x22f7ce){logger[_0xcfae('0xe')](_0xcfae('0x30'));return new Promise(function(_0x40e046,_0x29215c){var _0x53ab09=moment();var _0x253582={'method':_0xcfae('0x2a'),'uri':_0x533696+'/api/tasks','body':{'title':intUtil[_0xcfae('0x31')](_0x51e527['Subjects'],_0x3e8075,'\x20'),'description':intUtil[_0xcfae('0x31')](_0x51e527[_0xcfae('0x32')],_0x3e8075,'\x0a'),'owner_id':_0x22f7ce['userId'],'creater_id':_0x22f7ce[_0xcfae('0x14')],'targetable_id':_0x22f7ce[_0xcfae('0x28')],'targetable_type':_0xcfae('0x33'),'created_at':_0x53ab09['format'](_0xcfae('0x2d')),'due_date':_0x53ab09[_0xcfae('0x34')](0x1e,'m')['format'](_0xcfae('0x2d'))},'json':!![]};_0x253582[_0xcfae('0x16')]=_0x815cf8;return rp(_0x253582)[_0xcfae('0xf')](function(_0x3fb103){_0x22f7ce[_0xcfae('0x35')]=_0x3fb103['task']['id'];logger[_0xcfae('0xe')](_0xcfae('0x36'),_0x22f7ce['ticketId']);_0x40e046(_0x22f7ce);})[_0xcfae('0x1e')](function(_0x2eb01c){logger['error']('['+[_0x5a42df[_0xcfae('0x20')]()]+']',_0x2eb01c[_0xcfae('0x15')]);_0x29215c(_0x2eb01c['message']);});});};}function emit(_0x2717ae,_0x4194d0,_0x567e1f){var _0x102a7d={'uri':_0x2717ae+_0xcfae('0x37')+_0x567e1f};io['to'](util['format'](_0xcfae('0x38'),_0x4194d0))[_0xcfae('0x39')](_0xcfae('0x3a'),_0x102a7d);}exports['cs']=function(_0x702b1,_0x146d30,_0x125e75,_0x54af88,_0x28c48c,_0x20807d,_0xed6d6d,_0x570239){var _0x41c436={};var _0x37ba0f={'Authorization':_0xcfae('0x3b')+_0x20807d[_0xcfae('0x3c')]};_0x20807d[_0xcfae('0x3d')]=intUtil[_0xcfae('0x3e')](_0x20807d[_0xcfae('0x3d')]);_0x20807d['serverUrl']=intUtil['stripTrailingSlash'](_0x20807d[_0xcfae('0x3f')]);var _0x275fba=_0x20807d[_0xcfae('0x3d')];_0x41c436[_0xcfae('0x13')]=_0x20807d['username'];_0x41c436['contactNumber']=_0x570239[_0xcfae('0x40')]()===_0xcfae('0x41')?_0x146d30[_0xcfae('0x42')]:_0x146d30[_0xcfae('0x43')];_0x41c436[_0xcfae('0x44')]=_0x570239===_0xcfae('0x45')||_0x570239==='unmanaged'?_0xcfae('0x45'):_0xcfae('0x41');if(_0x54af88){_0x41c436[_0xcfae('0x18')]=_0x54af88[_0xcfae('0x12')];}var _0x51783b=util[_0xcfae('0x2c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20807d[_0xcfae('0x3f')],_0x146d30[_0xcfae('0x46')],md5(_0x146d30[_0xcfae('0x46')]));if(_0x28c48c&&_0x28c48c[_0xcfae('0x47')]){logger[_0xcfae('0xe')](_0xcfae('0x48'),'Recording\x20is\x20enabled!');_0x146d30[_0xcfae('0x49')]=_0x51783b;}else if(_0xed6d6d&&_0xed6d6d[_0xcfae('0x4a')]&&_0xed6d6d[_0xcfae('0x4a')]!==_0xcfae('0x4b')){logger[_0xcfae('0xe')]('[OUTBOUND]',_0xcfae('0x4c'));_0x146d30['recordingURL']=_0x51783b;}else{_0x146d30['recordingURL']='';}return getAdminId(_0x41c436,_0x570239,_0x37ba0f,_0x275fba)[_0xcfae('0xf')](getUser(_0x570239,_0x37ba0f,_0x275fba))[_0xcfae('0xf')](getEndUser(_0x570239,_0x37ba0f,_0x275fba))[_0xcfae('0xf')](getTicket(_0x570239,_0x37ba0f,_0x275fba,_0x125e75,_0x146d30))[_0xcfae('0xf')](function(_0x1d703e){logger[_0xcfae('0xe')](util['format'](_0xcfae('0x4d'),_0x1d703e[_0xcfae('0x35')]));if(_0x570239!==_0xcfae('0x4e')){logger['info']('['+[_0x570239['toUpperCase']()]+']',_0xcfae('0x4f'));emit(_0x275fba,_0x54af88['name'],_0x1d703e['endUserId']);}})[_0xcfae('0x1e')](function(_0x34fe3c){logger[_0xcfae('0x1f')]('['+[_0x570239[_0xcfae('0x20')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x34fe3c,{'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 d53aac5..9277da0 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 _0xecab=['vtiger','dynamics365','servicenow','exec','includes','toLowerCase','data2','find','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','data1','zendesk','freshsales','log','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','../../../../config/logger','lodash','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk'];(function(_0x657e67,_0x518f58){var _0x29e86d=function(_0x3afc81){while(--_0x3afc81){_0x657e67['push'](_0x657e67['shift']());}};_0x29e86d(++_0x518f58);}(_0xecab,0x114));var _0xbeca=function(_0x4bc0fc,_0x57c1b2){_0x4bc0fc=_0x4bc0fc-0x0;var _0x19b0c7=_0xecab[_0x4bc0fc];return _0x19b0c7;};'use strict';var _=require(_0xbeca('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0xbeca('0x1'));var freshdesk=require(_0xbeca('0x2'));var zoho=require('./zoho');var desk=require(_0xbeca('0x3'));var vtiger=require(_0xbeca('0x4'));var servicenow=require(_0xbeca('0x5'));var dynamics365=require('./dynamics365');var freshsales=require(_0xbeca('0x6'));var integrations=['zendesk',_0xbeca('0x7'),_0xbeca('0x8'),_0xbeca('0x9'),_0xbeca('0xa'),_0xbeca('0xb'),_0xbeca('0xc'),_0xbeca('0xd'),'freshsales',_0xbeca('0xe')];exports[_0xbeca('0xf')]=function(_0x75ca7e,_0x477395,_0x456de7,_0x4abe0d,_0xdf7a6c,_0x37f96b){if(_0x456de7){if(_[_0xbeca('0x10')](integrations,_0x75ca7e['data1'][_0xbeca('0x11')]())){try{var _0x1b1d6f=null;var _0x1f861a='';var _0x7fee3f=_0x456de7[_0x75ca7e['data1']['toLowerCase']()];if(_0x7fee3f){var _0x395ff5=_0x7fee3f[_0x75ca7e[_0xbeca('0x12')]];if(_0x395ff5){var _0x170ac9=_[_0xbeca('0x13')](_0x395ff5['Configurations'],{'id':parseInt(_0x75ca7e['data3'],0xa)});if(_0x170ac9){if(_0x4abe0d){if(_0xdf7a6c&&_0x477395[_0xbeca('0x14')]){_0x1f861a=_0xbeca('0x14');}else if(_0x477395[_0xbeca('0x15')]){_0x1f861a=_0xbeca('0x16');}else{console['log'](_0xbeca('0x17'),_0x477395);}}else{_0x1f861a=_0xbeca('0x18');}switch(_0x75ca7e[_0xbeca('0x19')][_0xbeca('0x11')]()){case _0xbeca('0x1a'):zendesk[_0x1f861a](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b);break;case _0xbeca('0x7'):salesforce[_0x1f861a](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b);break;case _0xbeca('0x8'):sugarcrm[_0x1f861a](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b);break;case _0xbeca('0x9'):freshdesk[_0x1f861a](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b);break;case _0xbeca('0xa'):zoho[_0x1f861a](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b);break;case _0xbeca('0xb'):desk[_0x1f861a](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b);break;case _0xbeca('0xc'):vtiger[_0x1f861a](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b);break;case _0xbeca('0x1b'):freshsales['cs'](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b,_0x1f861a);break;case _0xbeca('0xe'):servicenow['cs'](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b,_0x1f861a);break;case _0xbeca('0xd'):dynamics365['cs'](_0x75ca7e,_0x477395,_0x170ac9,_0x4abe0d,_0xdf7a6c,_0x395ff5,_0x37f96b,_0x1f861a);break;default:console[_0xbeca('0x1c')](_0xbeca('0x1d'));}}else{_0x1b1d6f=require('../../../../config/logger')(_0x75ca7e[_0xbeca('0x19')][_0xbeca('0x11')]());_0x1b1d6f[_0xbeca('0x1e')](_0xbeca('0x1f'),util[_0xbeca('0x20')](_0xbeca('0x21'),_0x75ca7e[_0xbeca('0x19')][_0xbeca('0x11')](),_0x75ca7e[_0xbeca('0x22')]));}}else{_0x1b1d6f=require(_0xbeca('0x23'))(_0x75ca7e[_0xbeca('0x19')][_0xbeca('0x11')]());_0x1b1d6f[_0xbeca('0x1e')](_0xbeca('0x1f'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x75ca7e[_0xbeca('0x19')][_0xbeca('0x11')](),_0x75ca7e[_0xbeca('0x12')]));}}else{}}catch(_0x553bdf){console[_0xbeca('0x1e')](_0x553bdf);}}}}; \ No newline at end of file +var _0x66d4=['data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./freshsales','zendesk','sugarcrm','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data1','data2','find','Configurations'];(function(_0x4a5729,_0x30f494){var _0x14ffa6=function(_0xcc97f6){while(--_0xcc97f6){_0x4a5729['push'](_0x4a5729['shift']());}};_0x14ffa6(++_0x30f494);}(_0x66d4,0x15b));var _0x466d=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0x66d4[_0x5581ba];return _0x1e927f;};'use strict';var _=require('lodash');var util=require(_0x466d('0x0'));var zendesk=require(_0x466d('0x1'));var salesforce=require(_0x466d('0x2'));var sugarcrm=require(_0x466d('0x3'));var freshdesk=require(_0x466d('0x4'));var zoho=require(_0x466d('0x5'));var desk=require('./desk');var vtiger=require(_0x466d('0x6'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0x466d('0x7'));var integrations=[_0x466d('0x8'),'salesforce',_0x466d('0x9'),'freshdesk',_0x466d('0xa'),_0x466d('0xb'),_0x466d('0xc'),_0x466d('0xd'),_0x466d('0xe'),_0x466d('0xf')];exports[_0x466d('0x10')]=function(_0x50cc39,_0x37806b,_0x1ff967,_0xb187c4,_0x2bb3d3,_0x5f69a7){if(_0x1ff967){if(_[_0x466d('0x11')](integrations,_0x50cc39['data1'][_0x466d('0x12')]())){try{var _0x50d759=null;var _0x2d1fc2='';var _0x5608cd=_0x1ff967[_0x50cc39[_0x466d('0x13')][_0x466d('0x12')]()];if(_0x5608cd){var _0x26583f=_0x5608cd[_0x50cc39[_0x466d('0x14')]];if(_0x26583f){var _0x139b3e=_[_0x466d('0x15')](_0x26583f[_0x466d('0x16')],{'id':parseInt(_0x50cc39[_0x466d('0x17')],0xa)});if(_0x139b3e){if(_0xb187c4){if(_0x2bb3d3&&_0x37806b[_0x466d('0x18')]){_0x2d1fc2=_0x466d('0x18');}else if(_0x37806b[_0x466d('0x19')]){_0x2d1fc2='outbound';}else{console[_0x466d('0x1a')](_0x466d('0x1b'),_0x37806b);}}else{_0x2d1fc2=_0x466d('0x1c');}switch(_0x50cc39['data1']['toLowerCase']()){case _0x466d('0x8'):zendesk[_0x2d1fc2](_0x50cc39,_0x37806b,_0x139b3e,_0xb187c4,_0x2bb3d3,_0x26583f,_0x5f69a7);break;case'salesforce':salesforce[_0x2d1fc2](_0x50cc39,_0x37806b,_0x139b3e,_0xb187c4,_0x2bb3d3,_0x26583f,_0x5f69a7);break;case _0x466d('0x9'):sugarcrm[_0x2d1fc2](_0x50cc39,_0x37806b,_0x139b3e,_0xb187c4,_0x2bb3d3,_0x26583f,_0x5f69a7);break;case _0x466d('0x1d'):freshdesk[_0x2d1fc2](_0x50cc39,_0x37806b,_0x139b3e,_0xb187c4,_0x2bb3d3,_0x26583f,_0x5f69a7);break;case _0x466d('0xa'):zoho[_0x2d1fc2](_0x50cc39,_0x37806b,_0x139b3e,_0xb187c4,_0x2bb3d3,_0x26583f,_0x5f69a7);break;case _0x466d('0xb'):desk[_0x2d1fc2](_0x50cc39,_0x37806b,_0x139b3e,_0xb187c4,_0x2bb3d3,_0x26583f,_0x5f69a7);break;case'vtiger':vtiger[_0x2d1fc2](_0x50cc39,_0x37806b,_0x139b3e,_0xb187c4,_0x2bb3d3,_0x26583f,_0x5f69a7);break;case _0x466d('0xe'):freshsales['cs'](_0x50cc39,_0x37806b,_0x139b3e,_0xb187c4,_0x2bb3d3,_0x26583f,_0x5f69a7,_0x2d1fc2);break;case _0x466d('0xf'):servicenow['cs'](_0x50cc39,_0x37806b,_0x139b3e,_0xb187c4,_0x2bb3d3,_0x26583f,_0x5f69a7,_0x2d1fc2);break;case _0x466d('0xd'):dynamics365['cs'](_0x50cc39,_0x37806b,_0x139b3e,_0xb187c4,_0x2bb3d3,_0x26583f,_0x5f69a7,_0x2d1fc2);break;default:console['log'](_0x466d('0x1e'));}}else{_0x50d759=require(_0x466d('0x1f'))(_0x50cc39[_0x466d('0x13')][_0x466d('0x12')]());_0x50d759[_0x466d('0x20')]('[EXEC]',util[_0x466d('0x21')](_0x466d('0x22'),_0x50cc39['data1']['toLowerCase'](),_0x50cc39[_0x466d('0x17')]));}}else{_0x50d759=require(_0x466d('0x1f'))(_0x50cc39[_0x466d('0x13')]['toLowerCase']());_0x50d759[_0x466d('0x20')](_0x466d('0x23'),util[_0x466d('0x21')](_0x466d('0x24'),_0x50cc39[_0x466d('0x13')][_0x466d('0x12')](),_0x50cc39[_0x466d('0x14')]));}}else{}}catch(_0xf538f0){console[_0x466d('0x20')](_0xf538f0);}}}}; \ 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 841be68..a737446 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 _0x53ef=['newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','destcalleridname','destcalleridnum','Fields','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','endUserType','contact','account','WhatId','Case','ContactId','AccountId','lead','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','length','find','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','cloneDeep','additionalSearchContact','$or','execute','additionalSearchLead','merge','Lead','account_contact_lead','Account','Contact','additionalSearchAccount','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Caller\x20-\x20%s','','Company','No\x20Company','upperFirst','forEach','includes','string','type','idField','content','toString','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x53ef,0x8f));var _0xf53e=function(_0x3f6b1b,_0x58d3d6){_0x3f6b1b=_0x3f6b1b-0x0;var _0x4a3d2b=_0x53ef[_0x3f6b1b];return _0x4a3d2b;};'use strict';var _=require(_0xf53e('0x0'));var rp=require(_0xf53e('0x1'));var moment=require(_0xf53e('0x2'));var BPromise=require(_0xf53e('0x3'));var md5=require('md5');var jsforce=require(_0xf53e('0x4'));var util=require(_0xf53e('0x5'));var Redis=require(_0xf53e('0x6'));var intUtil=require(_0xf53e('0x7'));var config=require(_0xf53e('0x8'));var logger=require(_0xf53e('0x9'))('salesforce');config[_0xf53e('0xa')]=_['defaults'](config[_0xf53e('0xa')],{'host':_0xf53e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf53e('0xa')]));function emit(_0x223637,_0x1a3d81,_0x1f438a){io['to'](_0x223637)[_0xf53e('0xc')](_0x1a3d81,_0x1f438a);}function getTicket(_0x192448,_0x6d8851,_0x206dd7,_0x4ad8f4,_0x101ac8,_0x4fb00f,_0x2e6fee,_0x642dbd){var _0x514138=Object[_0xf53e('0xd')]({},{'OwnerId':_0x6d8851['id'],'Subject':intUtil[_0xf53e('0xe')](_0x4ad8f4[_0xf53e('0xf')],_0x101ac8,'\x20'),'Description':intUtil['getString'](_0x4ad8f4[_0xf53e('0x10')],_0x101ac8,'\x0a')},getCustomFields(_0x4fb00f,_0x101ac8));if(_0x206dd7){if(_0x4ad8f4[_0xf53e('0x11')]===_0xf53e('0x12')){_0x514138[_0xf53e('0x13')]=moment[_0xf53e('0x14')]();_0x514138[_0xf53e('0x15')]=![];_0x514138['IsRecurrence']=![];if(_0x206dd7[_0xf53e('0x16')]===_0xf53e('0x17')||_0x206dd7[_0xf53e('0x16')]==='lead'){_0x514138['WhoId']=_0x206dd7['id'];}else if(_0x206dd7[_0xf53e('0x16')]===_0xf53e('0x18')){_0x514138[_0xf53e('0x19')]=_0x206dd7['id'];}}else if(_0x4ad8f4[_0xf53e('0x11')]===_0xf53e('0x1a')){if(_0x206dd7['endUserType']===_0xf53e('0x17')){_0x514138[_0xf53e('0x1b')]=_0x206dd7['id'];}else if(_0x206dd7[_0xf53e('0x16')]===_0xf53e('0x18')){_0x514138[_0xf53e('0x1c')]=_0x206dd7['id'];}else if(_0x206dd7['endUserType']===_0xf53e('0x1d')&&_0x4ad8f4['leadId']){_0x514138[_0x4ad8f4['leadId']]=_0x206dd7['id'];}else{logger[_0xf53e('0x1e')](_0xf53e('0x1f'));}}}return _0x2e6fee[_0xf53e('0x20')](_0x4ad8f4[_0xf53e('0x11')])[_0xf53e('0x21')](_0x514138);}function getUser(_0x5b6fc3,_0x14e0cd,_0x4ba348){if(!_[_0xf53e('0x22')](_0x14e0cd)&&intUtil[_0xf53e('0x23')](_0x14e0cd)){var _0x4c6ebb={'Email':_0x14e0cd};var _0x19c847={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4ba348['sobject'](_0xf53e('0x24'))['find'](_0x4c6ebb,_0x19c847)['execute']()['then'](function(_0xa9e366){if(_0xa9e366[_0xf53e('0x25')]){var _0x4d7a7b=_[_0xf53e('0x26')](_0xa9e366,function(_0x27f26a){return _0x27f26a[_0xf53e('0x27')]===_0x14e0cd;});if(_0x4d7a7b){logger['info'](_0xf53e('0x28'),_0x14e0cd);return BPromise['resolve']({'id':_0x4d7a7b['Id'],'name':_0x4d7a7b[_0xf53e('0x29')]});}}else{logger[_0xf53e('0x1e')](_0xf53e('0x2a'),_0x14e0cd);return _0x4ba348[_0xf53e('0x2b')]()[_0xf53e('0x2c')](function(_0x68dbb7){return BPromise[_0xf53e('0x2d')]({'id':_0x68dbb7[_0xf53e('0x2e')],'name':_0x68dbb7[_0xf53e('0x2f')]});});}});}else{logger[_0xf53e('0x1e')](_0xf53e('0x2a'),_0x14e0cd);return _0x4ba348[_0xf53e('0x2b')]()['then'](function(_0x59f6f7){return BPromise[_0xf53e('0x2d')]({'id':_0x59f6f7[_0xf53e('0x2e')],'name':_0x59f6f7[_0xf53e('0x2f')]});});}}function getEndUser(_0x7bdc5d,_0x44f87e,_0x1dba04,_0x20a1af,_0x3874e8){var _0x3efc24={'$or':{'Phone':_0x20a1af}};var _0x207eb9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xf53e('0x2d')]()[_0xf53e('0x2c')](function(){logger[_0xf53e('0x1e')](_0xf53e('0x30'),_0x20a1af,_0x44f87e['moduleSearch']);switch(_0x44f87e['moduleSearch']){case'contact_lead':var _0x3710c8=_[_0xf53e('0x31')](_0x3efc24);if(_0x44f87e[_0xf53e('0x32')]){var _0x4af4c6={};_0x4af4c6[_0x44f87e['additionalSearchContact']]=_0x20a1af;_['merge'](_0x3710c8[_0xf53e('0x33')],_0x4af4c6);}return _0x3874e8['sobject']('Contact')['find'](_0x3710c8,_0x207eb9)[_0xf53e('0x34')]()[_0xf53e('0x2c')](function(_0x2f19a5){if(_0x2f19a5&&_0x2f19a5['length']){return _0x2f19a5;}else{var _0x517365=_[_0xf53e('0x31')](_0x3efc24);if(_0x44f87e[_0xf53e('0x35')]){var _0x3d88da={};_0x3d88da[_0x44f87e['additionalSearchLead']]=_0x20a1af;_[_0xf53e('0x36')](_0x517365[_0xf53e('0x33')],_0x3d88da);}return _0x3874e8[_0xf53e('0x20')](_0xf53e('0x37'))[_0xf53e('0x26')](_0x517365,_0x207eb9);}});case _0xf53e('0x38'):var _0x391339=_[_0xf53e('0x31')](_0x3efc24);if(_0x44f87e['additionalSearchAccount']){var _0x4af4c6={};_0x4af4c6[_0x44f87e['additionalSearchAccount']]=_0x20a1af;_[_0xf53e('0x36')](_0x391339[_0xf53e('0x33')],_0x4af4c6);}return _0x3874e8[_0xf53e('0x20')](_0xf53e('0x39'))[_0xf53e('0x26')](_0x391339,_0x207eb9)['execute']()[_0xf53e('0x2c')](function(_0x18f1bd){if(_0x18f1bd&&_0x18f1bd[_0xf53e('0x25')]){return _0x18f1bd;}else{var _0x39b475=_[_0xf53e('0x31')](_0x3efc24);if(_0x44f87e[_0xf53e('0x32')]){var _0x4eff46={};_0x4eff46[_0x44f87e[_0xf53e('0x32')]]=_0x20a1af;_[_0xf53e('0x36')](_0x39b475[_0xf53e('0x33')],_0x4eff46);}return _0x3874e8[_0xf53e('0x20')]('Contact')['find'](_0x39b475,_0x207eb9)[_0xf53e('0x2c')](function(_0x35f548){if(_0x35f548&&_0x35f548['length']){return _0x35f548;}else{var _0x563c9d=_['cloneDeep'](_0x3efc24);if(_0x44f87e['additionalSearchLead']){var _0x15fcb9={};_0x15fcb9[_0x44f87e[_0xf53e('0x35')]]=_0x20a1af;_[_0xf53e('0x36')](_0x563c9d[_0xf53e('0x33')],_0x15fcb9);}return _0x3874e8['sobject'](_0xf53e('0x37'))[_0xf53e('0x26')](_0x563c9d,_0x207eb9);}});}});case _0xf53e('0x17'):var _0x3710c8=_['cloneDeep'](_0x3efc24);if(_0x44f87e[_0xf53e('0x32')]){var _0x4af4c6={};_0x4af4c6[_0x44f87e[_0xf53e('0x32')]]=_0x20a1af;_[_0xf53e('0x36')](_0x3710c8['$or'],_0x4af4c6);}return _0x3874e8[_0xf53e('0x20')](_0xf53e('0x3a'))['find'](_0x3710c8,_0x207eb9)[_0xf53e('0x34')]();case'lead':var _0x38392f=_[_0xf53e('0x31')](_0x3efc24);if(_0x44f87e[_0xf53e('0x35')]){var _0x4af4c6={};_0x4af4c6[_0x44f87e['additionalSearchLead']]=_0x20a1af;_[_0xf53e('0x36')](_0x38392f['$or'],_0x4af4c6);}return _0x3874e8[_0xf53e('0x20')](_0xf53e('0x37'))['find'](_0x38392f,_0x207eb9);case _0xf53e('0x18'):var _0x391339=_[_0xf53e('0x31')](_0x3efc24);if(_0x44f87e[_0xf53e('0x3b')]){var _0x4af4c6={};_0x4af4c6[_0x44f87e[_0xf53e('0x3b')]]=_0x20a1af;_[_0xf53e('0x36')](_0x391339['$or'],_0x4af4c6);}return _0x3874e8[_0xf53e('0x20')]('Account')[_0xf53e('0x26')](_0x391339,_0x207eb9);default:return null;}})[_0xf53e('0x2c')](function(_0x45074f){if(_0x45074f&&_0x45074f[_0xf53e('0x25')]){var _0x3ae521=_[_0xf53e('0x3c')](_0x45074f);if(_0x3ae521){return BPromise[_0xf53e('0x2d')]({'id':_0x3ae521['Id'],'name':_0x3ae521['Name'],'phone':_0x3ae521[_0xf53e('0x3d')],'endUserType':_0x3ae521[_0xf53e('0x3e')]['type'][_0xf53e('0x3f')]()});}}})['then'](function(_0x13cee6){if(_0x13cee6){logger[_0xf53e('0x1e')](_0xf53e('0x40'),_0x13cee6[_0xf53e('0x16')],_0x20a1af);return BPromise[_0xf53e('0x2d')](_0x13cee6);}else{logger[_0xf53e('0x1e')](_0xf53e('0x41'),_0x20a1af);var _0x332c54={'Phone':_0x20a1af};if(_0x44f87e['moduleCreate']){if(_0x44f87e[_0xf53e('0x42')]===_0xf53e('0x17')){logger[_0xf53e('0x1e')](_0xf53e('0x43'),_0x20a1af,_0x44f87e[_0xf53e('0x42')]);_0x332c54['LastName']=_0x1dba04!==''?_0x1dba04:util[_0xf53e('0x44')](_0xf53e('0x45'),_0x20a1af);}else if(_0x44f87e[_0xf53e('0x42')]===_0xf53e('0x1d')){logger[_0xf53e('0x1e')](_0xf53e('0x43'),_0x20a1af,_0x44f87e[_0xf53e('0x42')]);_0x332c54['LastName']=_0x1dba04!==_0xf53e('0x46')?_0x1dba04:util[_0xf53e('0x44')]('Caller\x20-\x20%s',_0x20a1af);_0x332c54[_0xf53e('0x47')]=_0xf53e('0x48');}else if(_0x44f87e[_0xf53e('0x42')]===_0xf53e('0x18')){logger[_0xf53e('0x1e')](_0xf53e('0x43'),_0x20a1af,_0x44f87e[_0xf53e('0x42')]);_0x332c54[_0xf53e('0x29')]=_0x1dba04!==''?_0x1dba04:util['format']('Caller\x20-\x20%s',_0x20a1af);}else{return null;}}return _0x3874e8[_0xf53e('0x20')](_[_0xf53e('0x49')](_0x44f87e[_0xf53e('0x42')]))['create'](_0x332c54)[_0xf53e('0x2c')](function(_0xc0b4a2){return BPromise[_0xf53e('0x2d')]({'id':_0xc0b4a2['id'],'endUserType':_0x44f87e[_0xf53e('0x42')]});});}});}function getCustomFields(_0x4ebe5c,_0xd94b27){var _0x15a84a={};if(_0x4ebe5c['length']>0x0){_[_0xf53e('0x4a')](_0x4ebe5c,function(_0x14dcfd){if(_[_0xf53e('0x4b')]([_0xf53e('0x4c'),'picklist'],_0x14dcfd[_0xf53e('0x4d')])&&_0x14dcfd[_0xf53e('0x4e')]){_0x15a84a[_0x14dcfd['idField']]=_0x14dcfd[_0xf53e('0x4f')][_0xf53e('0x50')]();}else if(_0x14dcfd[_0xf53e('0x4d')]==='variable'&&_0x14dcfd[_0xf53e('0x51')]&&_0x14dcfd[_0xf53e('0x4e')]){_0xd94b27[_0x14dcfd[_0xf53e('0x51')]]&&(_0x15a84a[_0x14dcfd[_0xf53e('0x4e')]]=_0xd94b27[_0x14dcfd[_0xf53e('0x51')]][_0xf53e('0x50')]());}else if(_0x14dcfd[_0xf53e('0x4d')]===_0xf53e('0x52')&&_0x14dcfd[_0xf53e('0x53')]&&_0x14dcfd[_0xf53e('0x53')][_0xf53e('0x54')]&&_0x14dcfd['idField']){_0xd94b27[_0x14dcfd[_0xf53e('0x53')][_0xf53e('0x54')][_0xf53e('0x3f')]()]&&(_0x15a84a[_0x14dcfd['idField']]=_0xd94b27[_0x14dcfd[_0xf53e('0x53')][_0xf53e('0x54')]['toLowerCase']()][_0xf53e('0x50')]());}});}return _0x15a84a;}function getConnection(_0x120c6b){var _0x489059=_0x120c6b[_0xf53e('0x55')][_0xf53e('0x56')](_0x120c6b[_0xf53e('0x57')]);var _0x389e28=new jsforce['Connection']({'oauth2':{'loginUrl':_0x120c6b[_0xf53e('0x58')]||_0xf53e('0x59'),'clientId':_0x120c6b[_0xf53e('0x5a')],'clientSecret':_0x120c6b[_0xf53e('0x5b')]}});return _0x389e28['login'](_0x120c6b[_0xf53e('0x5c')],_0x489059)[_0xf53e('0x2c')](function(){logger[_0xf53e('0x1e')](_0xf53e('0x5d'));return _0x389e28;});}exports[_0xf53e('0x5e')]=function(_0x5676f7,_0x217d2e,_0x40926f,_0x419e63,_0x5da00c,_0x2af26a){var _0x8325af,_0x37f0ba,_0x16d1ba,_0x1e42fe;_0x2af26a[_0xf53e('0x5f')]=intUtil[_0xf53e('0x60')](_0x2af26a[_0xf53e('0x5f')]);_0x2af26a[_0xf53e('0x58')]=intUtil[_0xf53e('0x60')](_0x2af26a[_0xf53e('0x58')]);if(_0x5da00c&&_0x5da00c['monitor_format']){logger[_0xf53e('0x1e')](_0xf53e('0x61'),_0xf53e('0x62'));_0x217d2e[_0xf53e('0x63')]=util['format'](_0xf53e('0x64'),_0x2af26a[_0xf53e('0x5f')],_0x217d2e[_0xf53e('0x65')],md5(_0x217d2e['uniqueid']));}else{_0x217d2e[_0xf53e('0x63')]='';}return getConnection(_0x2af26a)[_0xf53e('0x2c')](function(_0x567532){_0x1e42fe=_0x567532;return getUser(_0x2af26a,_0x419e63[_0xf53e('0x66')],_0x1e42fe);})[_0xf53e('0x2c')](function(_0x3d687e){_0x8325af=_0x3d687e;return getEndUser(_0x2af26a,_0x40926f,_0x217d2e[_0xf53e('0x67')],_0x217d2e[_0xf53e('0x68')],_0x1e42fe);})['then'](function(_0x1f222c){_0x37f0ba=_0x1f222c;return getTicket(_0x2af26a,_0x8325af,_0x37f0ba,_0x40926f,_0x217d2e,_0x40926f['Fields'],_0x1e42fe,_0xf53e('0x5e'));})['then'](function(_0x491b21){_0x16d1ba=_0x491b21;logger[_0xf53e('0x1e')](_0xf53e('0x69'),_0x16d1ba['id']);logger[_0xf53e('0x1e')](_0xf53e('0x6a'),_0x16d1ba['id'],_0x419e63[_0xf53e('0x54')],_0x2af26a[_0xf53e('0x4d')]);switch(_0x2af26a['type']){case _0xf53e('0x6b'):emit(util[_0xf53e('0x44')]('user:%s',_0x419e63['name']),_0xf53e('0x6c'),{'recordId':_0x16d1ba['id']});break;case _0xf53e('0x6d'):emit(util[_0xf53e('0x44')](_0xf53e('0x6e'),_0x419e63[_0xf53e('0x54')]),_0xf53e('0x6f'),{'uri':util[_0xf53e('0x44')](_0xf53e('0x70'),_0x1e42fe[_0xf53e('0x71')],_0x16d1ba['id'])});break;default:logger[_0xf53e('0x72')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xf53e('0x73')](function(_0x20bd3e){logger[_0xf53e('0x72')](_0xf53e('0x61'),_0x20bd3e);});};exports[_0xf53e('0x74')]=function(_0x2ddc28,_0x28b5c3,_0xb4a1b6,_0x229925,_0x14e359,_0xb4e3fe,_0x46c408){var _0x2b8424,_0x48629f,_0x576a43,_0x3f0125;_0xb4e3fe[_0xf53e('0x5f')]=intUtil[_0xf53e('0x60')](_0xb4e3fe[_0xf53e('0x5f')]);_0xb4e3fe[_0xf53e('0x58')]=intUtil[_0xf53e('0x60')](_0xb4e3fe[_0xf53e('0x58')]);if(_0x46c408&&_0x46c408[_0xf53e('0x75')]&&_0x46c408[_0xf53e('0x75')]!=='none'){logger[_0xf53e('0x1e')]('[OUTBOUND]',_0xf53e('0x62'));_0x28b5c3['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xb4e3fe[_0xf53e('0x5f')],_0x28b5c3[_0xf53e('0x65')],md5(_0x28b5c3[_0xf53e('0x65')]));}return getConnection(_0xb4e3fe)['then'](function(_0x2dccf2){_0x3f0125=_0x2dccf2;return getUser(_0xb4e3fe,_0x229925[_0xf53e('0x66')],_0x3f0125);})[_0xf53e('0x2c')](function(_0x2067d6){_0x2b8424=_0x2067d6;return getEndUser(_0xb4e3fe,_0xb4a1b6,_0x28b5c3[_0xf53e('0x76')],_0x28b5c3[_0xf53e('0x77')],_0x3f0125);})[_0xf53e('0x2c')](function(_0x954463){_0x48629f=_0x954463;return getTicket(_0xb4e3fe,_0x2b8424,_0x48629f,_0xb4a1b6,_0x28b5c3,_0xb4a1b6[_0xf53e('0x78')],_0x3f0125,_0xf53e('0x74'));})[_0xf53e('0x2c')](function(_0xba2854){_0x576a43=_0xba2854;logger[_0xf53e('0x1e')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x576a43['id']);logger[_0xf53e('0x1e')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x576a43['id'],_0x229925[_0xf53e('0x54')],_0xb4e3fe[_0xf53e('0x4d')]);switch(_0xb4e3fe[_0xf53e('0x4d')]){case _0xf53e('0x6b'):emit(util[_0xf53e('0x44')](_0xf53e('0x6e'),_0x229925[_0xf53e('0x54')]),'trigger:salesforce:display',{'recordId':_0x576a43['id']});break;case _0xf53e('0x6d'):emit(util[_0xf53e('0x44')](_0xf53e('0x6e'),_0x229925[_0xf53e('0x54')]),'trigger:browser:url',{'uri':util[_0xf53e('0x44')](_0xf53e('0x70'),_0x3f0125[_0xf53e('0x71')],_0x576a43['id'])});break;default:logger['error'](_0xf53e('0x79'),_0xf53e('0x7a'));}})[_0xf53e('0x73')](function(_0x582c43){logger[_0xf53e('0x72')](_0xf53e('0x79'),_0x582c43);});};exports[_0xf53e('0x7b')]=function(_0x199d9e,_0x321a95,_0x26041c,_0x2d1997,_0x31207b,_0x3c6b11){var _0x13fa1a,_0x1cabca,_0x2acff7,_0xd3232f;_0x3c6b11[_0xf53e('0x5f')]=intUtil['stripTrailingSlash'](_0x3c6b11['serverUrl']);_0x3c6b11[_0xf53e('0x58')]=intUtil[_0xf53e('0x60')](_0x3c6b11['remoteUri']);if(_0x31207b&&_0x31207b['monitor_format']){logger[_0xf53e('0x1e')]('['+_0x321a95[_0xf53e('0x7c')][_0xf53e('0x7d')]()+']',_0xf53e('0x62'));_0x321a95[_0xf53e('0x63')]=util[_0xf53e('0x44')](_0xf53e('0x64'),_0x3c6b11[_0xf53e('0x5f')],_0x321a95[_0xf53e('0x65')],md5(_0x321a95[_0xf53e('0x65')]));}else{_0x321a95[_0xf53e('0x63')]='';}return getConnection(_0x3c6b11)[_0xf53e('0x2c')](function(_0xb32c8b){_0xd3232f=_0xb32c8b;if(!_[_0xf53e('0x22')](_0x2d1997)){return getUser(_0x3c6b11,_0x2d1997[_0xf53e('0x54')],_0xd3232f);}else{return getUser(_0x3c6b11,null,_0xd3232f);}})[_0xf53e('0x2c')](function(_0x5aade2){_0x13fa1a=_0x5aade2;return getEndUser(_0x3c6b11,_0x26041c,_0x321a95[_0xf53e('0x67')],_0x321a95['calleridnum'],_0xd3232f);})[_0xf53e('0x2c')](function(_0x8ca0ee){_0x1cabca=_0x8ca0ee;return getTicket(_0x3c6b11,_0x13fa1a,_0x1cabca,_0x26041c,_0x321a95,_0x26041c['Fields'],_0xd3232f);})['then'](function(_0x606501){_0x2acff7=_0x606501;logger[_0xf53e('0x1e')]('['+_0x321a95[_0xf53e('0x7c')][_0xf53e('0x7d')]()+']\x20Ticket\x20%s\x20created.',_0x2acff7['id']);logger[_0xf53e('0x1e')]('['+_0x321a95[_0xf53e('0x7c')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x3c6b11[_0xf53e('0x4d')]);})['catch'](function(_0xad3a8c){logger[_0xf53e('0x72')]('['+_0x321a95['lastevent'][_0xf53e('0x7d')]()+']',_0xad3a8c);});}; \ No newline at end of file +var _0x4b0a=['isNil','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','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','$or','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','[OUTBOUND]','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','jsforce','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','account','WhatId','Case','ContactId','leadId','info','sobject','create'];(function(_0x3c6cc9,_0x483e1e){var _0x2c6508=function(_0xa5c6dc){while(--_0xa5c6dc){_0x3c6cc9['push'](_0x3c6cc9['shift']());}};_0x2c6508(++_0x483e1e);}(_0x4b0a,0xe0));var _0xa4b0=function(_0x5296b5,_0x170b8b){_0x5296b5=_0x5296b5-0x0;var _0x15e1c6=_0x4b0a[_0x5296b5];return _0x15e1c6;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0xa4b0('0x0'));var BPromise=require(_0xa4b0('0x1'));var md5=require('md5');var jsforce=require(_0xa4b0('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa4b0('0x3'));var config=require(_0xa4b0('0x4'));var logger=require(_0xa4b0('0x5'))(_0xa4b0('0x6'));config[_0xa4b0('0x7')]=_[_0xa4b0('0x8')](config[_0xa4b0('0x7')],{'host':_0xa4b0('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa4b0('0x7')]));function emit(_0x5dee3d,_0x502f4b,_0x2204a0){io['to'](_0x5dee3d)[_0xa4b0('0xa')](_0x502f4b,_0x2204a0);}function getTicket(_0x54c892,_0x2f42e0,_0x1e6b84,_0x568ffd,_0x467bfe,_0x2b8b67,_0x18285b,_0x384872){var _0x18416f=Object[_0xa4b0('0xb')]({},{'OwnerId':_0x2f42e0['id'],'Subject':intUtil[_0xa4b0('0xc')](_0x568ffd[_0xa4b0('0xd')],_0x467bfe,'\x20'),'Description':intUtil[_0xa4b0('0xc')](_0x568ffd[_0xa4b0('0xe')],_0x467bfe,'\x0a')},getCustomFields(_0x2b8b67,_0x467bfe));if(_0x1e6b84){if(_0x568ffd[_0xa4b0('0xf')]===_0xa4b0('0x10')){_0x18416f[_0xa4b0('0x11')]=moment[_0xa4b0('0x12')]();_0x18416f[_0xa4b0('0x13')]=![];_0x18416f[_0xa4b0('0x14')]=![];if(_0x1e6b84[_0xa4b0('0x15')]===_0xa4b0('0x16')||_0x1e6b84[_0xa4b0('0x15')]===_0xa4b0('0x17')){_0x18416f['WhoId']=_0x1e6b84['id'];}else if(_0x1e6b84[_0xa4b0('0x15')]===_0xa4b0('0x18')){_0x18416f[_0xa4b0('0x19')]=_0x1e6b84['id'];}}else if(_0x568ffd['ticketType']===_0xa4b0('0x1a')){if(_0x1e6b84['endUserType']==='contact'){_0x18416f[_0xa4b0('0x1b')]=_0x1e6b84['id'];}else if(_0x1e6b84['endUserType']===_0xa4b0('0x18')){_0x18416f['AccountId']=_0x1e6b84['id'];}else if(_0x1e6b84[_0xa4b0('0x15')]===_0xa4b0('0x17')&&_0x568ffd[_0xa4b0('0x1c')]){_0x18416f[_0x568ffd[_0xa4b0('0x1c')]]=_0x1e6b84['id'];}else{logger[_0xa4b0('0x1d')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x18285b[_0xa4b0('0x1e')](_0x568ffd['ticketType'])[_0xa4b0('0x1f')](_0x18416f);}function getUser(_0x479706,_0xe2e49d,_0x455bb6){if(!_[_0xa4b0('0x20')](_0xe2e49d)&&intUtil['validateEmail'](_0xe2e49d)){var _0x5458cc={'Email':_0xe2e49d};var _0x1b143c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x455bb6[_0xa4b0('0x1e')](_0xa4b0('0x21'))[_0xa4b0('0x22')](_0x5458cc,_0x1b143c)[_0xa4b0('0x23')]()[_0xa4b0('0x24')](function(_0x988f9c){if(_0x988f9c[_0xa4b0('0x25')]){var _0x449ec9=_['find'](_0x988f9c,function(_0x88ba0a){return _0x88ba0a[_0xa4b0('0x26')]===_0xe2e49d;});if(_0x449ec9){logger[_0xa4b0('0x1d')](_0xa4b0('0x27'),_0xe2e49d);return BPromise[_0xa4b0('0x28')]({'id':_0x449ec9['Id'],'name':_0x449ec9[_0xa4b0('0x29')]});}}else{logger[_0xa4b0('0x1d')](_0xa4b0('0x2a'),_0xe2e49d);return _0x455bb6[_0xa4b0('0x2b')]()['then'](function(_0x2ddb85){return BPromise['resolve']({'id':_0x2ddb85['user_id'],'name':_0x2ddb85['display_name']});});}});}else{logger['info'](_0xa4b0('0x2a'),_0xe2e49d);return _0x455bb6[_0xa4b0('0x2b')]()[_0xa4b0('0x24')](function(_0x3cdad5){return BPromise[_0xa4b0('0x28')]({'id':_0x3cdad5[_0xa4b0('0x2c')],'name':_0x3cdad5[_0xa4b0('0x2d')]});});}}function getEndUser(_0x147c71,_0x6a6895,_0xe75678,_0x4ab244,_0x39ab34){var _0x3b3467={'$or':{'Phone':_0x4ab244}};var _0x3913d8={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xa4b0('0x28')]()[_0xa4b0('0x24')](function(){logger[_0xa4b0('0x1d')](_0xa4b0('0x2e'),_0x4ab244,_0x6a6895[_0xa4b0('0x2f')]);switch(_0x6a6895[_0xa4b0('0x2f')]){case _0xa4b0('0x30'):var _0xa7d559=_[_0xa4b0('0x31')](_0x3b3467);if(_0x6a6895[_0xa4b0('0x32')]){var _0x12d0d3={};_0x12d0d3[_0x6a6895[_0xa4b0('0x32')]]=_0x4ab244;_[_0xa4b0('0x33')](_0xa7d559[_0xa4b0('0x34')],_0x12d0d3);}return _0x39ab34[_0xa4b0('0x1e')]('Contact')[_0xa4b0('0x22')](_0xa7d559,_0x3913d8)[_0xa4b0('0x23')]()[_0xa4b0('0x24')](function(_0x134ed9){if(_0x134ed9&&_0x134ed9[_0xa4b0('0x25')]){return _0x134ed9;}else{var _0x4b7364=_[_0xa4b0('0x31')](_0x3b3467);if(_0x6a6895[_0xa4b0('0x35')]){var _0x478aab={};_0x478aab[_0x6a6895[_0xa4b0('0x35')]]=_0x4ab244;_['merge'](_0x4b7364['$or'],_0x478aab);}return _0x39ab34[_0xa4b0('0x1e')](_0xa4b0('0x36'))[_0xa4b0('0x22')](_0x4b7364,_0x3913d8);}});case _0xa4b0('0x37'):var _0x470008=_[_0xa4b0('0x31')](_0x3b3467);if(_0x6a6895[_0xa4b0('0x38')]){var _0x12d0d3={};_0x12d0d3[_0x6a6895[_0xa4b0('0x38')]]=_0x4ab244;_[_0xa4b0('0x33')](_0x470008[_0xa4b0('0x34')],_0x12d0d3);}return _0x39ab34[_0xa4b0('0x1e')](_0xa4b0('0x39'))[_0xa4b0('0x22')](_0x470008,_0x3913d8)[_0xa4b0('0x23')]()[_0xa4b0('0x24')](function(_0x279b36){if(_0x279b36&&_0x279b36['length']){return _0x279b36;}else{var _0x324661=_[_0xa4b0('0x31')](_0x3b3467);if(_0x6a6895['additionalSearchContact']){var _0x2a361b={};_0x2a361b[_0x6a6895[_0xa4b0('0x32')]]=_0x4ab244;_['merge'](_0x324661[_0xa4b0('0x34')],_0x2a361b);}return _0x39ab34[_0xa4b0('0x1e')](_0xa4b0('0x3a'))['find'](_0x324661,_0x3913d8)[_0xa4b0('0x24')](function(_0x28114a){if(_0x28114a&&_0x28114a[_0xa4b0('0x25')]){return _0x28114a;}else{var _0x120625=_[_0xa4b0('0x31')](_0x3b3467);if(_0x6a6895[_0xa4b0('0x35')]){var _0x17135f={};_0x17135f[_0x6a6895[_0xa4b0('0x35')]]=_0x4ab244;_[_0xa4b0('0x33')](_0x120625[_0xa4b0('0x34')],_0x17135f);}return _0x39ab34[_0xa4b0('0x1e')](_0xa4b0('0x36'))[_0xa4b0('0x22')](_0x120625,_0x3913d8);}});}});case _0xa4b0('0x16'):var _0xa7d559=_[_0xa4b0('0x31')](_0x3b3467);if(_0x6a6895['additionalSearchContact']){var _0x12d0d3={};_0x12d0d3[_0x6a6895[_0xa4b0('0x32')]]=_0x4ab244;_[_0xa4b0('0x33')](_0xa7d559[_0xa4b0('0x34')],_0x12d0d3);}return _0x39ab34[_0xa4b0('0x1e')](_0xa4b0('0x3a'))[_0xa4b0('0x22')](_0xa7d559,_0x3913d8)['execute']();case'lead':var _0x469b08=_[_0xa4b0('0x31')](_0x3b3467);if(_0x6a6895[_0xa4b0('0x35')]){var _0x12d0d3={};_0x12d0d3[_0x6a6895[_0xa4b0('0x35')]]=_0x4ab244;_[_0xa4b0('0x33')](_0x469b08[_0xa4b0('0x34')],_0x12d0d3);}return _0x39ab34['sobject'](_0xa4b0('0x36'))[_0xa4b0('0x22')](_0x469b08,_0x3913d8);case _0xa4b0('0x18'):var _0x470008=_['cloneDeep'](_0x3b3467);if(_0x6a6895[_0xa4b0('0x38')]){var _0x12d0d3={};_0x12d0d3[_0x6a6895[_0xa4b0('0x38')]]=_0x4ab244;_[_0xa4b0('0x33')](_0x470008['$or'],_0x12d0d3);}return _0x39ab34[_0xa4b0('0x1e')](_0xa4b0('0x39'))[_0xa4b0('0x22')](_0x470008,_0x3913d8);default:return null;}})['then'](function(_0x18346b){if(_0x18346b&&_0x18346b[_0xa4b0('0x25')]){var _0xe953a2=_['first'](_0x18346b);if(_0xe953a2){return BPromise[_0xa4b0('0x28')]({'id':_0xe953a2['Id'],'name':_0xe953a2[_0xa4b0('0x29')],'phone':_0xe953a2[_0xa4b0('0x3b')],'endUserType':_0xe953a2['attributes'][_0xa4b0('0x3c')][_0xa4b0('0x3d')]()});}}})['then'](function(_0x15ade2){if(_0x15ade2){logger['info'](_0xa4b0('0x3e'),_0x15ade2['endUserType'],_0x4ab244);return BPromise[_0xa4b0('0x28')](_0x15ade2);}else{logger['info'](_0xa4b0('0x3f'),_0x4ab244);var _0x5ea2b4={'Phone':_0x4ab244};if(_0x6a6895[_0xa4b0('0x40')]){if(_0x6a6895['moduleCreate']===_0xa4b0('0x16')){logger[_0xa4b0('0x1d')](_0xa4b0('0x41'),_0x4ab244,_0x6a6895[_0xa4b0('0x40')]);_0x5ea2b4[_0xa4b0('0x42')]=_0xe75678!==_0xa4b0('0x43')?_0xe75678:util[_0xa4b0('0x44')](_0xa4b0('0x45'),_0x4ab244);}else if(_0x6a6895[_0xa4b0('0x40')]===_0xa4b0('0x17')){logger[_0xa4b0('0x1d')](_0xa4b0('0x41'),_0x4ab244,_0x6a6895['moduleCreate']);_0x5ea2b4[_0xa4b0('0x42')]=_0xe75678!==''?_0xe75678:util['format'](_0xa4b0('0x45'),_0x4ab244);_0x5ea2b4[_0xa4b0('0x46')]=_0xa4b0('0x47');}else if(_0x6a6895[_0xa4b0('0x40')]==='account'){logger['info'](_0xa4b0('0x41'),_0x4ab244,_0x6a6895[_0xa4b0('0x40')]);_0x5ea2b4[_0xa4b0('0x29')]=_0xe75678!==_0xa4b0('0x43')?_0xe75678:util[_0xa4b0('0x44')](_0xa4b0('0x45'),_0x4ab244);}else{return null;}}return _0x39ab34[_0xa4b0('0x1e')](_['upperFirst'](_0x6a6895['moduleCreate']))[_0xa4b0('0x1f')](_0x5ea2b4)[_0xa4b0('0x24')](function(_0x54a904){return BPromise[_0xa4b0('0x28')]({'id':_0x54a904['id'],'endUserType':_0x6a6895[_0xa4b0('0x40')]});});}});}function getCustomFields(_0x38a5be,_0x74f30){var _0x38fc87={};if(_0x38a5be[_0xa4b0('0x25')]>0x0){_[_0xa4b0('0x48')](_0x38a5be,function(_0x5e6a85){if(_[_0xa4b0('0x49')]([_0xa4b0('0x4a'),_0xa4b0('0x4b')],_0x5e6a85[_0xa4b0('0x3c')])&&_0x5e6a85[_0xa4b0('0x4c')]){_0x38fc87[_0x5e6a85['idField']]=_0x5e6a85[_0xa4b0('0x4d')][_0xa4b0('0x4e')]();}else if(_0x5e6a85[_0xa4b0('0x3c')]===_0xa4b0('0x4f')&&_0x5e6a85[_0xa4b0('0x50')]&&_0x5e6a85[_0xa4b0('0x4c')]){_0x74f30[_0x5e6a85[_0xa4b0('0x50')]]&&(_0x38fc87[_0x5e6a85[_0xa4b0('0x4c')]]=_0x74f30[_0x5e6a85['variableName']][_0xa4b0('0x4e')]());}else if(_0x5e6a85['type']===_0xa4b0('0x51')&&_0x5e6a85[_0xa4b0('0x52')]&&_0x5e6a85[_0xa4b0('0x52')]['name']&&_0x5e6a85['idField']){_0x74f30[_0x5e6a85['Variable'][_0xa4b0('0x53')][_0xa4b0('0x3d')]()]&&(_0x38fc87[_0x5e6a85['idField']]=_0x74f30[_0x5e6a85[_0xa4b0('0x52')][_0xa4b0('0x53')]['toLowerCase']()][_0xa4b0('0x4e')]());}});}return _0x38fc87;}function getConnection(_0x3bb016){var _0x107106=_0x3bb016[_0xa4b0('0x54')]['concat'](_0x3bb016['securityToken']);var _0xfcf865=new jsforce[(_0xa4b0('0x55'))]({'oauth2':{'loginUrl':_0x3bb016[_0xa4b0('0x56')]||_0xa4b0('0x57'),'clientId':_0x3bb016[_0xa4b0('0x58')],'clientSecret':_0x3bb016[_0xa4b0('0x59')]}});return _0xfcf865[_0xa4b0('0x5a')](_0x3bb016[_0xa4b0('0x5b')],_0x107106)['then'](function(){logger[_0xa4b0('0x1d')](_0xa4b0('0x5c'));return _0xfcf865;});}exports[_0xa4b0('0x5d')]=function(_0x5d5798,_0x4ed11a,_0xb13a3e,_0x35ed3b,_0x447589,_0x5de89f){var _0x36cea0,_0x1127df,_0x3a47d1,_0x47c82a;_0x5de89f[_0xa4b0('0x5e')]=intUtil[_0xa4b0('0x5f')](_0x5de89f[_0xa4b0('0x5e')]);_0x5de89f['remoteUri']=intUtil[_0xa4b0('0x5f')](_0x5de89f[_0xa4b0('0x56')]);if(_0x447589&&_0x447589[_0xa4b0('0x60')]){logger[_0xa4b0('0x1d')](_0xa4b0('0x61'),_0xa4b0('0x62'));_0x4ed11a['recordingURL']=util[_0xa4b0('0x44')](_0xa4b0('0x63'),_0x5de89f[_0xa4b0('0x5e')],_0x4ed11a[_0xa4b0('0x64')],md5(_0x4ed11a[_0xa4b0('0x64')]));}else{_0x4ed11a[_0xa4b0('0x65')]='';}return getConnection(_0x5de89f)['then'](function(_0x9cde6c){_0x47c82a=_0x9cde6c;return getUser(_0x5de89f,_0x35ed3b[_0xa4b0('0x66')],_0x47c82a);})['then'](function(_0x3ce98a){_0x36cea0=_0x3ce98a;return getEndUser(_0x5de89f,_0xb13a3e,_0x4ed11a[_0xa4b0('0x67')],_0x4ed11a[_0xa4b0('0x68')],_0x47c82a);})[_0xa4b0('0x24')](function(_0x5cff47){_0x1127df=_0x5cff47;return getTicket(_0x5de89f,_0x36cea0,_0x1127df,_0xb13a3e,_0x4ed11a,_0xb13a3e['Fields'],_0x47c82a,'queue');})[_0xa4b0('0x24')](function(_0x489d63){_0x3a47d1=_0x489d63;logger['info'](_0xa4b0('0x69'),_0x3a47d1['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3a47d1['id'],_0x35ed3b[_0xa4b0('0x53')],_0x5de89f['type']);switch(_0x5de89f[_0xa4b0('0x3c')]){case _0xa4b0('0x6a'):emit(util[_0xa4b0('0x44')]('user:%s',_0x35ed3b[_0xa4b0('0x53')]),_0xa4b0('0x6b'),{'recordId':_0x3a47d1['id']});break;case _0xa4b0('0x6c'):emit(util[_0xa4b0('0x44')]('user:%s',_0x35ed3b[_0xa4b0('0x53')]),_0xa4b0('0x6d'),{'uri':util['format'](_0xa4b0('0x6e'),_0x47c82a['instanceUrl'],_0x3a47d1['id'])});break;default:logger[_0xa4b0('0x6f')](_0xa4b0('0x70'));}})[_0xa4b0('0x71')](function(_0x1a94c8){logger[_0xa4b0('0x6f')]('[QUEUE]',_0x1a94c8);});};exports[_0xa4b0('0x72')]=function(_0x214975,_0xfb5e82,_0x26eb62,_0x1a19d6,_0x38e7c6,_0x502731,_0x9eca09){var _0x48e61d,_0x359e6e,_0x3f6e78,_0x54b904;_0x502731['serverUrl']=intUtil[_0xa4b0('0x5f')](_0x502731[_0xa4b0('0x5e')]);_0x502731[_0xa4b0('0x56')]=intUtil[_0xa4b0('0x5f')](_0x502731[_0xa4b0('0x56')]);if(_0x9eca09&&_0x9eca09[_0xa4b0('0x73')]&&_0x9eca09[_0xa4b0('0x73')]!=='none'){logger[_0xa4b0('0x1d')](_0xa4b0('0x74'),_0xa4b0('0x62'));_0xfb5e82[_0xa4b0('0x65')]=util[_0xa4b0('0x44')](_0xa4b0('0x63'),_0x502731[_0xa4b0('0x5e')],_0xfb5e82['uniqueid'],md5(_0xfb5e82[_0xa4b0('0x64')]));}return getConnection(_0x502731)[_0xa4b0('0x24')](function(_0x193f5d){_0x54b904=_0x193f5d;return getUser(_0x502731,_0x1a19d6['email'],_0x54b904);})[_0xa4b0('0x24')](function(_0x244a14){_0x48e61d=_0x244a14;return getEndUser(_0x502731,_0x26eb62,_0xfb5e82[_0xa4b0('0x75')],_0xfb5e82['destcalleridnum'],_0x54b904);})[_0xa4b0('0x24')](function(_0x3e9c81){_0x359e6e=_0x3e9c81;return getTicket(_0x502731,_0x48e61d,_0x359e6e,_0x26eb62,_0xfb5e82,_0x26eb62[_0xa4b0('0x76')],_0x54b904,_0xa4b0('0x72'));})[_0xa4b0('0x24')](function(_0x38a248){_0x3f6e78=_0x38a248;logger['info'](_0xa4b0('0x77'),_0x3f6e78['id']);logger['info'](_0xa4b0('0x78'),_0x3f6e78['id'],_0x1a19d6[_0xa4b0('0x53')],_0x502731['type']);switch(_0x502731['type']){case _0xa4b0('0x6a'):emit(util[_0xa4b0('0x44')](_0xa4b0('0x79'),_0x1a19d6[_0xa4b0('0x53')]),_0xa4b0('0x6b'),{'recordId':_0x3f6e78['id']});break;case _0xa4b0('0x6c'):emit(util[_0xa4b0('0x44')](_0xa4b0('0x79'),_0x1a19d6[_0xa4b0('0x53')]),_0xa4b0('0x6d'),{'uri':util['format'](_0xa4b0('0x6e'),_0x54b904[_0xa4b0('0x7a')],_0x3f6e78['id'])});break;default:logger[_0xa4b0('0x6f')](_0xa4b0('0x74'),_0xa4b0('0x7b'));}})[_0xa4b0('0x71')](function(_0x4e49f3){logger[_0xa4b0('0x6f')](_0xa4b0('0x74'),_0x4e49f3);});};exports[_0xa4b0('0x7c')]=function(_0x880e4d,_0x5c7ec8,_0x4dc387,_0x37c2df,_0x1c8ef8,_0x33486d){var _0x1bd805,_0x103d4e,_0x46f238,_0x18c535;_0x33486d['serverUrl']=intUtil['stripTrailingSlash'](_0x33486d[_0xa4b0('0x5e')]);_0x33486d['remoteUri']=intUtil['stripTrailingSlash'](_0x33486d['remoteUri']);if(_0x1c8ef8&&_0x1c8ef8[_0xa4b0('0x60')]){logger[_0xa4b0('0x1d')]('['+_0x5c7ec8[_0xa4b0('0x7d')]['toUpperCase']()+']',_0xa4b0('0x62'));_0x5c7ec8[_0xa4b0('0x65')]=util[_0xa4b0('0x44')](_0xa4b0('0x63'),_0x33486d[_0xa4b0('0x5e')],_0x5c7ec8[_0xa4b0('0x64')],md5(_0x5c7ec8[_0xa4b0('0x64')]));}else{_0x5c7ec8['recordingURL']='';}return getConnection(_0x33486d)[_0xa4b0('0x24')](function(_0x16f4e0){_0x18c535=_0x16f4e0;if(!_[_0xa4b0('0x20')](_0x37c2df)){return getUser(_0x33486d,_0x37c2df[_0xa4b0('0x53')],_0x18c535);}else{return getUser(_0x33486d,null,_0x18c535);}})['then'](function(_0x1e0c85){_0x1bd805=_0x1e0c85;return getEndUser(_0x33486d,_0x4dc387,_0x5c7ec8[_0xa4b0('0x67')],_0x5c7ec8[_0xa4b0('0x68')],_0x18c535);})[_0xa4b0('0x24')](function(_0x38cfb6){_0x103d4e=_0x38cfb6;return getTicket(_0x33486d,_0x1bd805,_0x103d4e,_0x4dc387,_0x5c7ec8,_0x4dc387[_0xa4b0('0x76')],_0x18c535);})[_0xa4b0('0x24')](function(_0x2fd842){_0x46f238=_0x2fd842;logger[_0xa4b0('0x1d')]('['+_0x5c7ec8['lastevent'][_0xa4b0('0x7e')]()+']\x20Ticket\x20%s\x20created.',_0x46f238['id']);logger[_0xa4b0('0x1d')]('['+_0x5c7ec8[_0xa4b0('0x7d')][_0xa4b0('0x7e')]()+_0xa4b0('0x7f'),_0x33486d[_0xa4b0('0x3c')]);})[_0xa4b0('0x71')](function(_0x10e2b9){logger[_0xa4b0('0x6f')]('['+_0x5c7ec8[_0xa4b0('0x7d')][_0xa4b0('0x7e')]()+']',_0x10e2b9);});}; \ 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 a8d6e41..106caca 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 _0x48c3=['content','variable','variableName','toString','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','POST','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','calleridnum','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','servicenow','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','length','result','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','userId','adminId','userEmail','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','picklist','type','nameField','customField','includes','idField','toLowerCase'];(function(_0x564a84,_0x5c25a2){var _0x376607=function(_0x24ff63){while(--_0x24ff63){_0x564a84['push'](_0x564a84['shift']());}};_0x376607(++_0x5c25a2);}(_0x48c3,0xac));var _0x348c=function(_0x1b0c4d,_0x349c1e){_0x1b0c4d=_0x1b0c4d-0x0;var _0x2af477=_0x48c3[_0x1b0c4d];return _0x2af477;};'use strict';var _=require('lodash');var Promise=require(_0x348c('0x0'));var rp=require(_0x348c('0x1'));var util=require(_0x348c('0x2'));var md5=require('md5');var Redis=require(_0x348c('0x3'));var intUtil=require(_0x348c('0x4'));var config=require(_0x348c('0x5'));var logger=require('../../../../config/logger')(_0x348c('0x6'));config[_0x348c('0x7')]=_['defaults'](config[_0x348c('0x7')],{'host':_0x348c('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x6fa659,_0x5767ea,_0x26d7b0,_0x5b831e,_0x3c9597,_0x36c649){return new Promise(function(_0x4f5053,_0x356e3c){var _0x5037c2={'method':_0x348c('0x9'),'uri':_0x5b831e+_0x348c('0xa')+'&'+_0x3c9597+'&'+_0x36c649,'auth':_0x5767ea,'json':!![]};return rp(_0x5037c2)['then'](function(_0x3c1889){if(_0x3c1889['result'][_0x348c('0xb')]>0x0){_0x26d7b0['adminId']=_0x3c1889[_0x348c('0xc')][0x0][_0x348c('0xd')];}logger['info']('['+[_0x6fa659[_0x348c('0xe')]()]+_0x348c('0xf'),_0x26d7b0);_0x4f5053(_0x26d7b0);})[_0x348c('0x10')](function(_0x15efa6){logger[_0x348c('0x11')]('['+[_0x6fa659[_0x348c('0xe')]()]+']',_0x15efa6[_0x348c('0x12')]);_0x356e3c(_0x15efa6['message']);});});}function getUser(_0x22b1a9,_0x56ac22,_0x1b29ca,_0xd55f38,_0x8bd4fb){return function(_0x482e93){logger[_0x348c('0x13')]('['+[_0x22b1a9[_0x348c('0xe')]()]+_0x348c('0x14'),_0x482e93);return new Promise(function(_0x1f302b,_0x195cfc){if(intUtil[_0x348c('0x15')](_0x482e93['userEmail'])){var _0x2d05dc={'method':'GET','uri':_0x1b29ca+_0x348c('0x16')+_0x482e93['userEmail']+'&'+_0xd55f38+'&'+_0x8bd4fb,'auth':_0x56ac22,'json':!![]};logger[_0x348c('0x13')]('['+[_0x22b1a9['toUpperCase']()]+_0x348c('0x17'),_0x2d05dc);return rp(_0x2d05dc)[_0x348c('0x18')](function(_0x7b5b6b){logger['info']('['+[_0x22b1a9[_0x348c('0xe')]()]+_0x348c('0x19'),_0x7b5b6b);if(_0x7b5b6b[_0x348c('0xc')][_0x348c('0xb')]>0x0&&String(_0x7b5b6b['result'][0x0][_0x348c('0x1a')])==='true'){_0x482e93[_0x348c('0x1b')]=_0x7b5b6b[_0x348c('0xc')][0x0][_0x348c('0xd')];}else{_0x482e93[_0x348c('0x1b')]=_0x482e93[_0x348c('0x1c')];_0x482e93[_0x348c('0x1d')]=_0x482e93[_0x348c('0x1e')];}logger[_0x348c('0x13')]('['+[_0x22b1a9[_0x348c('0xe')]()]+'],\x20getUser\x20crm',_0x482e93);_0x1f302b(_0x482e93);})[_0x348c('0x10')](function(_0x344a26){logger['error']('['+[_0x22b1a9[_0x348c('0xe')]()]+']',_0x344a26[_0x348c('0x12')]);_0x195cfc(_0x344a26[_0x348c('0x12')]);});}else{logger[_0x348c('0x13')]('['+[_0x22b1a9[_0x348c('0xe')]()]+_0x348c('0x1f'));_0x482e93['userId']=_0x482e93[_0x348c('0x1c')];_0x482e93[_0x348c('0x1d')]=_0x482e93[_0x348c('0x1e')];_0x1f302b(_0x482e93);}});};}function createEndUser(_0x38e663,_0x40ca6b,_0x34bfef,_0x1df4e2,_0x1b5d4d){logger[_0x348c('0x13')]('['+[_0x38e663['toUpperCase']()]+_0x348c('0x20'),_0x34bfef);return new Promise(function(_0x54eb18,_0x4decb2){var _0x58a713={'method':'POST','uri':_0x1df4e2+_0x348c('0x21')+_0x1b5d4d,'body':{'user_name':_0x34bfef[_0x348c('0x22')],'roles':'user','first_name':_0x34bfef[_0x348c('0x22')],'active':_0x348c('0x23'),'date_format':_0x348c('0x24'),'phone':_0x34bfef['endUserNumber']},'auth':_0x40ca6b,'json':!![]};return rp(_0x58a713)[_0x348c('0x18')](function(_0x3560e5){logger[_0x348c('0x13')]('['+[_0x38e663[_0x348c('0xe')]()]+_0x348c('0x25'),_0x3560e5[_0x348c('0xc')]);_0x34bfef[_0x348c('0x26')]=_0x3560e5['result']['sys_id'];_0x54eb18(_0x34bfef);})[_0x348c('0x10')](function(_0x537ad7){logger[_0x348c('0x11')]('['+[_0x38e663['toUpperCase']()]+']',_0x537ad7[_0x348c('0x12')]);_0x4decb2(_0x537ad7[_0x348c('0x12')]);});});}function getEndUser(_0x172b0c,_0x1f362c,_0x2176dc,_0x4e2bf6,_0x48bf9d){return function(_0x4e82d3){logger[_0x348c('0x13')]('['+[_0x172b0c[_0x348c('0xe')]()]+_0x348c('0x27'),_0x4e82d3);return new Promise(function(_0x187c4a,_0x1ca48b){var _0xa93115={'method':_0x348c('0x9'),'uri':_0x2176dc+'sys_user?sysparm_query=phone%3D'+_0x4e82d3[_0x348c('0x22')]+'&'+_0x4e2bf6+'&'+_0x48bf9d,'auth':_0x1f362c,'json':!![]};return rp(_0xa93115)[_0x348c('0x18')](function(_0x3c4999){if(_0x3c4999[_0x348c('0xc')][_0x348c('0xb')]>0x0){_0x4e82d3[_0x348c('0x26')]=_0x3c4999[_0x348c('0xc')][0x0][_0x348c('0xd')];logger[_0x348c('0x13')]('['+[_0x172b0c[_0x348c('0xe')]()]+_0x348c('0x28'),_0x4e82d3);_0x187c4a(_0x4e82d3);}else{return createEndUser(_0x172b0c,_0x1f362c,_0x4e82d3,_0x2176dc,_0x4e2bf6)[_0x348c('0x18')](function(_0x1726d3){logger[_0x348c('0x13')]('['+[_0x172b0c[_0x348c('0xe')]()]+_0x348c('0x29'),_0x1726d3);_0x187c4a(_0x1726d3);});}})['catch'](function(_0x2e42ef){logger[_0x348c('0x11')]('['+[_0x172b0c[_0x348c('0xe')]()]+']',_0x2e42ef[_0x348c('0x12')]);_0x1ca48b(_0x2e42ef[_0x348c('0x12')]);});});};}function getCustomFields(_0x1ff097,_0x4a9033){var _0x1ba86a={};if(_0x1ff097[_0x348c('0xb')]>0x0){_[_0x348c('0x2a')](_0x1ff097,function(_0x456755){if(_['includes'](['string',_0x348c('0x2b')],_0x456755[_0x348c('0x2c')])&&_0x456755[_0x348c('0x2d')]&&!_0x456755[_0x348c('0x2e')]){_0x1ba86a[_0x456755[_0x348c('0x2d')]['toLowerCase']()]=_0x456755['content']['toString']();}else if(_[_0x348c('0x2f')](['string','picklist'],_0x456755[_0x348c('0x2c')])&&_0x456755['idField']&&_0x456755[_0x348c('0x2e')]){_0x1ba86a[_0x456755[_0x348c('0x30')][_0x348c('0x31')]()]=_0x456755[_0x348c('0x32')]['toString']();}else if(_0x456755['type']===_0x348c('0x33')&&_0x456755[_0x348c('0x34')]&&_0x456755['idField']&&_0x456755['customField']){_0x1ba86a[_0x456755[_0x348c('0x30')][_0x348c('0x31')]()]=_0x4a9033[_0x456755[_0x348c('0x34')]][_0x348c('0x35')]();}else if(_0x456755[_0x348c('0x2c')]===_0x348c('0x36')&&_0x456755[_0x348c('0x37')]&&_0x456755[_0x348c('0x37')][_0x348c('0x38')]&&_0x456755['idField']&&_0x456755[_0x348c('0x2e')]){_0x1ba86a[_0x456755[_0x348c('0x30')][_0x348c('0x31')]()]=_0x4a9033[_0x456755[_0x348c('0x37')][_0x348c('0x38')][_0x348c('0x31')]()]['toString']();}});}return _0x1ba86a;}function getTicket(_0x32e35f,_0x31dfeb,_0x4ccaa8,_0x3bb7e5,_0x4cd7b8,_0xac6418){return function(_0x17b949){logger[_0x348c('0x13')]('['+[_0x32e35f['toUpperCase']()]+_0x348c('0x39'),_0x17b949);return new Promise(function(_0x5adfd4,_0x455c84){var _0x3da848=_0x32e35f[_0x348c('0x31')]()===_0x348c('0x3a')?_0x17b949[_0x348c('0x1b')]:_0x17b949[_0x348c('0x26')];var _0xe4645f={'method':'POST','uri':_0x4ccaa8+_0x348c('0x3b')+'?'+_0xac6418,'body':Object[_0x348c('0x3c')]({},{'active':_0x348c('0x23'),'caller_id':_0x3da848,'assigned_to':_0x17b949[_0x348c('0x1b')],'short_description':intUtil[_0x348c('0x3d')](_0x3bb7e5['Subjects'],_0x4cd7b8,'\x20'),'description':intUtil[_0x348c('0x3d')](_0x3bb7e5[_0x348c('0x3e')],_0x4cd7b8,'\x0a')},getCustomFields(_0x3bb7e5[_0x348c('0x3f')],_0x4cd7b8)),'auth':_0x31dfeb,'json':!![]};return rp(_0xe4645f)[_0x348c('0x18')](function(_0x206383){logger[_0x348c('0x13')]('['+[_0x32e35f[_0x348c('0xe')]()]+_0x348c('0x40'),_0x206383[_0x348c('0xc')]);_0x17b949[_0x348c('0x41')]=_0x206383[_0x348c('0xc')][_0x348c('0xd')];_0x17b949[_0x348c('0x42')]=_0x206383[_0x348c('0xc')][_0x348c('0x43')];logger[_0x348c('0x13')]('['+[_0x32e35f[_0x348c('0xe')]()]+_0x348c('0x44'),_0x17b949);_0x5adfd4(_0x17b949);})[_0x348c('0x10')](function(_0xae7336){logger[_0x348c('0x11')]('['+[_0x32e35f[_0x348c('0xe')]()]+']',_0xae7336[_0x348c('0x12')]);_0x455c84(_0xae7336[_0x348c('0x12')]);});});};}function createRemoteTag(_0x2a7e3a,_0x4725ae,_0x2d9883,_0x5910b9){return new Promise(function(_0x24c25d,_0x401f60){var _0x57bbc2={'method':_0x348c('0x45'),'uri':_0x2d9883+_0x348c('0x46')+'?'+_0x5910b9,'body':{'short_description':_0x2a7e3a,'global':!![],'active':!![],'name':_0x2a7e3a},'auth':_0x4725ae,'json':!![]};return rp(_0x57bbc2)[_0x348c('0x18')](function(_0xa9b544){var _0x56e4e2=_0xa9b544[_0x348c('0xc')][_0x348c('0xd')];_0x24c25d(_0x56e4e2);});});}function getRemoteTag(_0x20dcd9,_0x5b697b,_0x5da581,_0x5623d8,_0x3e890b){return new Promise(function(_0x451254,_0x3cd2f0){var _0x537d96={'method':'GET','uri':_0x5da581+_0x348c('0x46')+_0x348c('0x47')+_0x20dcd9+'&'+_0x5623d8,'auth':_0x5b697b,'json':!![]};return rp(_0x537d96)[_0x348c('0x18')](function(_0x2c4ce1){if(_0x2c4ce1[_0x348c('0xc')][_0x348c('0xb')]>0x0){var _0x3aeded=_0x2c4ce1[_0x348c('0xc')][0x0][_0x348c('0xd')];_0x451254(_0x3aeded);}else{return createRemoteTag(_0x20dcd9,_0x5b697b,_0x5da581,_0x5623d8)['then'](function(_0x1b1f17){_0x451254(_0x1b1f17);});}});});}function assignTagToIncident(_0x1803e6,_0x5a33d6,_0x542eb8,_0x239b18,_0x34d742){return new Promise(function(_0x56e154,_0x482340){var _0x118888={'method':_0x348c('0x45'),'uri':_0x542eb8+_0x348c('0x48')+'?'+_0x34d742,'body':{'label':_0x1803e6,'table':_0x348c('0x3b'),'id_type':_0x348c('0x49'),'table_key':_0x239b18[_0x348c('0x41')],'title':_0x348c('0x4a')+_0x239b18[_0x348c('0x42')],'id_display':_0x239b18[_0x348c('0x42')]},'auth':_0x5a33d6,'json':!![]};return rp(_0x118888)[_0x348c('0x18')](function(_0x52d16e){_0x56e154();})[_0x348c('0x10')](function(){_0x56e154();});});}function manageTags(_0xd2a669,_0x22f90c,_0x5e7662,_0x4c02a4,_0x3aa89c,_0x2d35ea,_0x56d7ce){return new Promise(function(_0x592b2e,_0x4add06){var _0x62cada=[];_0x22f90c[_0x348c('0x2a')](function(_0xb69dd7){_0x62cada[_0x348c('0x4b')](getRemoteTag(_0xb69dd7,_0x5e7662,_0x4c02a4,_0x2d35ea,_0x56d7ce));});return Promise[_0x348c('0x4c')](_0x62cada)[_0x348c('0x18')](function(_0x57c8a0){if(_0x57c8a0[_0x348c('0xb')]){logger[_0x348c('0x13')]('['+[_0xd2a669[_0x348c('0xe')]()]+_0x348c('0x4d'),_0x57c8a0);var _0x2f3f15=[];_0x57c8a0[_0x348c('0x2a')](function(_0x1d303a){_0x2f3f15[_0x348c('0x4b')](assignTagToIncident(_0x1d303a,_0x5e7662,_0x4c02a4,_0x3aa89c,_0x2d35ea));});return Promise['all'](_0x2f3f15)['then'](function(){_0x592b2e();})[_0x348c('0x10')](function(){_0x592b2e();});}else{_0x592b2e();}});});}function getTags(_0x11b85b,_0x353658,_0x13c9ac,_0x172282,_0x37958f,_0x41b4f0){return function(_0x2defcf){return new Promise(function(_0x2edb8b,_0x2c2dd3){var _0x5b72ea=[];var _0x53c263=_0x172282[_0x348c('0x4e')];if(_0x53c263&&_0x53c263[_0x348c('0xb')]>0x0){_0x5b72ea=_[_0x348c('0x4f')](_0x53c263,_0x348c('0x38'));}if(_0x5b72ea[_0x348c('0xb')]>0x0){return manageTags(_0x11b85b,_0x5b72ea,_0x353658,_0x13c9ac,_0x2defcf,_0x37958f,_0x41b4f0)['then'](function(){_0x2edb8b(_0x2defcf);});}else{_0x2edb8b(_0x2defcf);}});};}function emit(_0x1046a0,_0x5ef321,_0x42eb51){var _0x12bd18=_0x348c('0x50')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x348c('0x51')+_0x348c('0x52');var _0x26ea4b={'uri':_0x1046a0+_0x348c('0x53')+_0x42eb51+_0x12bd18};io['to'](util['format']('user:%s',_0x5ef321))[_0x348c('0x54')](_0x348c('0x55'),_0x26ea4b);}exports['cs']=function(_0x1489e3,_0x30cd16,_0x18b9ed,_0x144b0e,_0x565c1d,_0x5e3080,_0x1ba942,_0x39ce2f){var _0x420dca={};var _0xbab031={'user':_0x5e3080[_0x348c('0x56')],'pass':_0x5e3080[_0x348c('0x57')]};var _0x1ea484=_0x348c('0x58');var _0x36c14=_0x348c('0x59');_0x5e3080[_0x348c('0x5a')]=intUtil[_0x348c('0x5b')](_0x5e3080[_0x348c('0x5a')]);_0x5e3080[_0x348c('0x5c')]=intUtil[_0x348c('0x5b')](_0x5e3080['serverUrl']);var _0x1fa2dd=util[_0x348c('0x5d')](_0x348c('0x5e'),_0x5e3080[_0x348c('0x5a')]);_0x420dca[_0x348c('0x1d')]=!_[_0x348c('0x5f')](_0x144b0e)?_0x144b0e['email']:null;_0x420dca['adminEmail']=_0x5e3080[_0x348c('0x60')];_0x420dca[_0x348c('0x22')]=_0x39ce2f[_0x348c('0x31')]()===_0x348c('0x3a')?_0x30cd16['destcalleridnum']:_0x30cd16[_0x348c('0x61')];_0x420dca['callDirection']=_0x39ce2f==='queue'||_0x39ce2f===_0x348c('0x62')?_0x348c('0x63'):_0x348c('0x3a');var _0x1f74e1=util[_0x348c('0x5d')](_0x348c('0x64'),_0x5e3080[_0x348c('0x5c')],_0x30cd16['uniqueid'],md5(_0x30cd16[_0x348c('0x65')]));if(_0x565c1d&&_0x565c1d[_0x348c('0x66')]){logger[_0x348c('0x13')](_0x348c('0x67'),_0x348c('0x68'));_0x30cd16[_0x348c('0x69')]=_0x1f74e1;}else if(_0x1ba942&&_0x1ba942[_0x348c('0x6a')]&&_0x1ba942[_0x348c('0x6a')]!==_0x348c('0x6b')){logger[_0x348c('0x13')](_0x348c('0x6c'),_0x348c('0x68'));_0x30cd16[_0x348c('0x69')]=_0x1f74e1;}else{_0x30cd16[_0x348c('0x69')]='';}return getAdminUser(_0x39ce2f,_0xbab031,_0x420dca,_0x1fa2dd,_0x36c14,_0x1ea484)[_0x348c('0x18')](getUser(_0x39ce2f,_0xbab031,_0x1fa2dd,_0x36c14,_0x1ea484))[_0x348c('0x18')](getEndUser(_0x39ce2f,_0xbab031,_0x1fa2dd,_0x36c14,_0x1ea484))[_0x348c('0x18')](getTicket(_0x39ce2f,_0xbab031,_0x1fa2dd,_0x18b9ed,_0x30cd16,_0x36c14))[_0x348c('0x18')](function(_0x1b60c8){logger[_0x348c('0x13')](util[_0x348c('0x5d')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1b60c8['ticketId']));logger[_0x348c('0x13')](util[_0x348c('0x5d')](_0x348c('0x6d'),_0x39ce2f));if(_0x39ce2f!==_0x348c('0x62')){logger[_0x348c('0x13')]('['+[_0x39ce2f[_0x348c('0xe')]()]+']',_0x348c('0x6e'));emit(_0x5e3080['remoteUri'],_0x144b0e[_0x348c('0x38')],_0x1b60c8[_0x348c('0x41')]);}})[_0x348c('0x10')](function(_0x2b479f){logger[_0x348c('0x11')]('['+[_0x39ce2f[_0x348c('0xe')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x2b479f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x22bc=['Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','isNil','email','outbound','destcalleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','type','nameField','toLowerCase','content','toString','picklist','idField','customField','variable','variableName','customVariable','Variable','name','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','number',']\x20getTicket\x20crm','label'];(function(_0x3011ff,_0x36a939){var _0xd22e7e=function(_0x20f165){while(--_0x20f165){_0x3011ff['push'](_0x3011ff['shift']());}};_0xd22e7e(++_0x36a939);}(_0x22bc,0x1da));var _0xc22b=function(_0x36ee41,_0x3e8583){_0x36ee41=_0x36ee41-0x0;var _0x5271b0=_0x22bc[_0x36ee41];return _0x5271b0;};'use strict';var _=require(_0xc22b('0x0'));var Promise=require('bluebird');var rp=require(_0xc22b('0x1'));var util=require(_0xc22b('0x2'));var md5=require(_0xc22b('0x3'));var Redis=require(_0xc22b('0x4'));var intUtil=require('./util');var config=require(_0xc22b('0x5'));var logger=require(_0xc22b('0x6'))(_0xc22b('0x7'));config[_0xc22b('0x8')]=_[_0xc22b('0x9')](config[_0xc22b('0x8')],{'host':_0xc22b('0xa'),'port':0x18eb});var io=require(_0xc22b('0xb'))(new Redis(config[_0xc22b('0x8')]));function getAdminUser(_0x54b17c,_0x424418,_0x565d37,_0x2bb1ab,_0x217a4b,_0x20b202){return new Promise(function(_0x23aae7,_0x249d64){var _0x3ff6de={'method':_0xc22b('0xc'),'uri':_0x2bb1ab+_0xc22b('0xd')+'&'+_0x217a4b+'&'+_0x20b202,'auth':_0x424418,'json':!![]};return rp(_0x3ff6de)[_0xc22b('0xe')](function(_0xa0033f){if(_0xa0033f[_0xc22b('0xf')][_0xc22b('0x10')]>0x0){_0x565d37[_0xc22b('0x11')]=_0xa0033f[_0xc22b('0xf')][0x0][_0xc22b('0x12')];}logger[_0xc22b('0x13')]('['+[_0x54b17c[_0xc22b('0x14')]()]+_0xc22b('0x15'),_0x565d37);_0x23aae7(_0x565d37);})[_0xc22b('0x16')](function(_0x36eb00){logger[_0xc22b('0x17')]('['+[_0x54b17c[_0xc22b('0x14')]()]+']',_0x36eb00['message']);_0x249d64(_0x36eb00[_0xc22b('0x18')]);});});}function getUser(_0x117219,_0x2ee915,_0x201d80,_0x27ca19,_0x24f403){return function(_0x42ebb6){logger['info']('['+[_0x117219[_0xc22b('0x14')]()]+_0xc22b('0x19'),_0x42ebb6);return new Promise(function(_0x4bd80c,_0x5f26f5){if(intUtil['validateEmail'](_0x42ebb6[_0xc22b('0x1a')])){var _0x6221fa={'method':_0xc22b('0xc'),'uri':_0x201d80+_0xc22b('0x1b')+_0x42ebb6['userEmail']+'&'+_0x27ca19+'&'+_0x24f403,'auth':_0x2ee915,'json':!![]};logger[_0xc22b('0x13')]('['+[_0x117219[_0xc22b('0x14')]()]+_0xc22b('0x1c'),_0x6221fa);return rp(_0x6221fa)['then'](function(_0x3a5177){logger[_0xc22b('0x13')]('['+[_0x117219[_0xc22b('0x14')]()]+_0xc22b('0x1d'),_0x3a5177);if(_0x3a5177[_0xc22b('0xf')]['length']>0x0&&String(_0x3a5177[_0xc22b('0xf')][0x0][_0xc22b('0x1e')])==='true'){_0x42ebb6[_0xc22b('0x1f')]=_0x3a5177[_0xc22b('0xf')][0x0]['sys_id'];}else{_0x42ebb6[_0xc22b('0x1f')]=_0x42ebb6[_0xc22b('0x11')];_0x42ebb6['userEmail']=_0x42ebb6[_0xc22b('0x20')];}logger[_0xc22b('0x13')]('['+[_0x117219[_0xc22b('0x14')]()]+_0xc22b('0x21'),_0x42ebb6);_0x4bd80c(_0x42ebb6);})[_0xc22b('0x16')](function(_0x4b3a62){logger['error']('['+[_0x117219[_0xc22b('0x14')]()]+']',_0x4b3a62[_0xc22b('0x18')]);_0x5f26f5(_0x4b3a62['message']);});}else{logger[_0xc22b('0x13')]('['+[_0x117219['toUpperCase']()]+_0xc22b('0x22'));_0x42ebb6[_0xc22b('0x1f')]=_0x42ebb6[_0xc22b('0x11')];_0x42ebb6[_0xc22b('0x1a')]=_0x42ebb6[_0xc22b('0x20')];_0x4bd80c(_0x42ebb6);}});};}function createEndUser(_0x55df37,_0x4707d2,_0xdd7f12,_0x101193,_0x416fa4){logger['info']('['+[_0x55df37[_0xc22b('0x14')]()]+_0xc22b('0x23'),_0xdd7f12);return new Promise(function(_0x2c223f,_0x578ab0){var _0xb65cd8={'method':_0xc22b('0x24'),'uri':_0x101193+_0xc22b('0x25')+_0x416fa4,'body':{'user_name':_0xdd7f12[_0xc22b('0x26')],'roles':_0xc22b('0x27'),'first_name':_0xdd7f12[_0xc22b('0x26')],'active':_0xc22b('0x28'),'date_format':_0xc22b('0x29'),'phone':_0xdd7f12[_0xc22b('0x26')]},'auth':_0x4707d2,'json':!![]};return rp(_0xb65cd8)[_0xc22b('0xe')](function(_0x3cccc2){logger[_0xc22b('0x13')]('['+[_0x55df37['toUpperCase']()]+'],\x20EndUser\x20schema',_0x3cccc2['result']);_0xdd7f12[_0xc22b('0x2a')]=_0x3cccc2[_0xc22b('0xf')][_0xc22b('0x12')];_0x2c223f(_0xdd7f12);})[_0xc22b('0x16')](function(_0xb8b201){logger[_0xc22b('0x17')]('['+[_0x55df37['toUpperCase']()]+']',_0xb8b201[_0xc22b('0x18')]);_0x578ab0(_0xb8b201['message']);});});}function getEndUser(_0x31d8e1,_0x45a7bc,_0x5fd2b5,_0x23537a,_0x26d3fc){return function(_0x423bc4){logger['info']('['+[_0x31d8e1[_0xc22b('0x14')]()]+_0xc22b('0x2b'),_0x423bc4);return new Promise(function(_0x52aeeb,_0x18ab39){var _0x4f3632={'method':'GET','uri':_0x5fd2b5+_0xc22b('0x2c')+_0x423bc4[_0xc22b('0x26')]+'&'+_0x23537a+'&'+_0x26d3fc,'auth':_0x45a7bc,'json':!![]};return rp(_0x4f3632)['then'](function(_0x4d1de2){if(_0x4d1de2[_0xc22b('0xf')][_0xc22b('0x10')]>0x0){_0x423bc4[_0xc22b('0x2a')]=_0x4d1de2[_0xc22b('0xf')][0x0][_0xc22b('0x12')];logger[_0xc22b('0x13')]('['+[_0x31d8e1['toUpperCase']()]+_0xc22b('0x2d'),_0x423bc4);_0x52aeeb(_0x423bc4);}else{return createEndUser(_0x31d8e1,_0x45a7bc,_0x423bc4,_0x5fd2b5,_0x23537a)['then'](function(_0x5ce479){logger[_0xc22b('0x13')]('['+[_0x31d8e1[_0xc22b('0x14')]()]+_0xc22b('0x2e'),_0x5ce479);_0x52aeeb(_0x5ce479);});}})['catch'](function(_0x1f4562){logger[_0xc22b('0x17')]('['+[_0x31d8e1['toUpperCase']()]+']',_0x1f4562[_0xc22b('0x18')]);_0x18ab39(_0x1f4562['message']);});});};}function getCustomFields(_0x583d9b,_0x4279f7){var _0x20a0d5={};if(_0x583d9b[_0xc22b('0x10')]>0x0){_[_0xc22b('0x2f')](_0x583d9b,function(_0x268b35){if(_['includes']([_0xc22b('0x30'),'picklist'],_0x268b35[_0xc22b('0x31')])&&_0x268b35[_0xc22b('0x32')]&&!_0x268b35['customField']){_0x20a0d5[_0x268b35[_0xc22b('0x32')][_0xc22b('0x33')]()]=_0x268b35[_0xc22b('0x34')][_0xc22b('0x35')]();}else if(_['includes']([_0xc22b('0x30'),_0xc22b('0x36')],_0x268b35[_0xc22b('0x31')])&&_0x268b35[_0xc22b('0x37')]&&_0x268b35[_0xc22b('0x38')]){_0x20a0d5[_0x268b35['idField'][_0xc22b('0x33')]()]=_0x268b35[_0xc22b('0x34')][_0xc22b('0x35')]();}else if(_0x268b35['type']===_0xc22b('0x39')&&_0x268b35[_0xc22b('0x3a')]&&_0x268b35[_0xc22b('0x37')]&&_0x268b35[_0xc22b('0x38')]){_0x20a0d5[_0x268b35[_0xc22b('0x37')][_0xc22b('0x33')]()]=_0x4279f7[_0x268b35['variableName']][_0xc22b('0x35')]();}else if(_0x268b35[_0xc22b('0x31')]===_0xc22b('0x3b')&&_0x268b35[_0xc22b('0x3c')]&&_0x268b35['Variable'][_0xc22b('0x3d')]&&_0x268b35['idField']&&_0x268b35['customField']){_0x20a0d5[_0x268b35[_0xc22b('0x37')][_0xc22b('0x33')]()]=_0x4279f7[_0x268b35[_0xc22b('0x3c')][_0xc22b('0x3d')][_0xc22b('0x33')]()][_0xc22b('0x35')]();}});}return _0x20a0d5;}function getTicket(_0x423b71,_0x13890e,_0x32b97c,_0x5cd20a,_0x2b8b6d,_0x29ff1b){return function(_0x430242){logger['info']('['+[_0x423b71['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0x430242);return new Promise(function(_0x7c7b32,_0x55546b){var _0x1965cc=_0x423b71[_0xc22b('0x33')]()==='outbound'?_0x430242[_0xc22b('0x1f')]:_0x430242[_0xc22b('0x2a')];var _0x250c19={'method':_0xc22b('0x24'),'uri':_0x32b97c+_0xc22b('0x3e')+'?'+_0x29ff1b,'body':Object[_0xc22b('0x3f')]({},{'active':'true','caller_id':_0x1965cc,'assigned_to':_0x430242[_0xc22b('0x1f')],'short_description':intUtil[_0xc22b('0x40')](_0x5cd20a[_0xc22b('0x41')],_0x2b8b6d,'\x20'),'description':intUtil[_0xc22b('0x40')](_0x5cd20a[_0xc22b('0x42')],_0x2b8b6d,'\x0a')},getCustomFields(_0x5cd20a['Fields'],_0x2b8b6d)),'auth':_0x13890e,'json':!![]};return rp(_0x250c19)[_0xc22b('0xe')](function(_0x3105a3){logger[_0xc22b('0x13')]('['+[_0x423b71[_0xc22b('0x14')]()]+_0xc22b('0x43'),_0x3105a3[_0xc22b('0xf')]);_0x430242['ticketId']=_0x3105a3[_0xc22b('0xf')]['sys_id'];_0x430242['ticketNumber']=_0x3105a3[_0xc22b('0xf')][_0xc22b('0x44')];logger[_0xc22b('0x13')]('['+[_0x423b71['toUpperCase']()]+_0xc22b('0x45'),_0x430242);_0x7c7b32(_0x430242);})[_0xc22b('0x16')](function(_0x35c4a4){logger[_0xc22b('0x17')]('['+[_0x423b71[_0xc22b('0x14')]()]+']',_0x35c4a4['message']);_0x55546b(_0x35c4a4[_0xc22b('0x18')]);});});};}function createRemoteTag(_0xf25982,_0x2b00de,_0x1bb97e,_0x3f978b){return new Promise(function(_0x2f2a43,_0x1869d5){var _0x53eccf={'method':_0xc22b('0x24'),'uri':_0x1bb97e+_0xc22b('0x46')+'?'+_0x3f978b,'body':{'short_description':_0xf25982,'global':!![],'active':!![],'name':_0xf25982},'auth':_0x2b00de,'json':!![]};return rp(_0x53eccf)[_0xc22b('0xe')](function(_0x114c05){var _0x769cdd=_0x114c05['result'][_0xc22b('0x12')];_0x2f2a43(_0x769cdd);});});}function getRemoteTag(_0xdaca22,_0xada63c,_0x58aed6,_0x52d71c,_0x4ce01d){return new Promise(function(_0x4f3aee,_0xcd8892){var _0x1ea377={'method':'GET','uri':_0x58aed6+'label'+'?sysparm_query=name%3D'+_0xdaca22+'&'+_0x52d71c,'auth':_0xada63c,'json':!![]};return rp(_0x1ea377)[_0xc22b('0xe')](function(_0x58e4ce){if(_0x58e4ce[_0xc22b('0xf')][_0xc22b('0x10')]>0x0){var _0x3de826=_0x58e4ce['result'][0x0]['sys_id'];_0x4f3aee(_0x3de826);}else{return createRemoteTag(_0xdaca22,_0xada63c,_0x58aed6,_0x52d71c)['then'](function(_0x1f0d47){_0x4f3aee(_0x1f0d47);});}});});}function assignTagToIncident(_0x4be1a2,_0x585094,_0x3cfc47,_0x1166bb,_0x28315b){return new Promise(function(_0x59e491,_0x5ed850){var _0x42ab73={'method':_0xc22b('0x24'),'uri':_0x3cfc47+'label_entry'+'?'+_0x28315b,'body':{'label':_0x4be1a2,'table':_0xc22b('0x3e'),'id_type':_0xc22b('0x47'),'table_key':_0x1166bb[_0xc22b('0x48')],'title':_0xc22b('0x49')+_0x1166bb[_0xc22b('0x4a')],'id_display':_0x1166bb[_0xc22b('0x4a')]},'auth':_0x585094,'json':!![]};return rp(_0x42ab73)[_0xc22b('0xe')](function(_0x12b128){_0x59e491();})[_0xc22b('0x16')](function(){_0x59e491();});});}function manageTags(_0xf27223,_0x129316,_0x44562c,_0x590c73,_0x13aa4e,_0x392a91,_0xc39db3){return new Promise(function(_0x26fe39,_0x1f16b7){var _0x593250=[];_0x129316[_0xc22b('0x2f')](function(_0x20fc07){_0x593250[_0xc22b('0x4b')](getRemoteTag(_0x20fc07,_0x44562c,_0x590c73,_0x392a91,_0xc39db3));});return Promise[_0xc22b('0x4c')](_0x593250)[_0xc22b('0xe')](function(_0x46400e){if(_0x46400e[_0xc22b('0x10')]){logger[_0xc22b('0x13')]('['+[_0xf27223[_0xc22b('0x14')]()]+_0xc22b('0x4d'),_0x46400e);var _0x29defa=[];_0x46400e[_0xc22b('0x2f')](function(_0x101558){_0x29defa[_0xc22b('0x4b')](assignTagToIncident(_0x101558,_0x44562c,_0x590c73,_0x13aa4e,_0x392a91));});return Promise[_0xc22b('0x4c')](_0x29defa)[_0xc22b('0xe')](function(){_0x26fe39();})['catch'](function(){_0x26fe39();});}else{_0x26fe39();}});});}function getTags(_0x13d853,_0x51804f,_0x26fdf3,_0x3909e7,_0x166210,_0x4cbd6e){return function(_0x359f56){return new Promise(function(_0x5d5435,_0x3aed99){var _0x46b445=[];var _0x4dd9e9=_0x3909e7[_0xc22b('0x4e')];if(_0x4dd9e9&&_0x4dd9e9[_0xc22b('0x10')]>0x0){_0x46b445=_[_0xc22b('0x4f')](_0x4dd9e9,'name');}if(_0x46b445['length']>0x0){return manageTags(_0x13d853,_0x46b445,_0x51804f,_0x26fdf3,_0x359f56,_0x166210,_0x4cbd6e)[_0xc22b('0xe')](function(){_0x5d5435(_0x359f56);});}else{_0x5d5435(_0x359f56);}});};}function emit(_0x215d80,_0x6faa24,_0x1efd6e){var _0x5de975='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xc22b('0x50')+_0xc22b('0x51');var _0xd18dbf={'uri':_0x215d80+_0xc22b('0x52')+_0x1efd6e+_0x5de975};io['to'](util[_0xc22b('0x53')](_0xc22b('0x54'),_0x6faa24))[_0xc22b('0x55')](_0xc22b('0x56'),_0xd18dbf);}exports['cs']=function(_0xa22158,_0x34ea22,_0x1a914b,_0x19ee25,_0x5f1d74,_0x3901c3,_0x5d0740,_0x14a103){var _0x57df10={};var _0x4f5215={'user':_0x3901c3[_0xc22b('0x57')],'pass':_0x3901c3[_0xc22b('0x58')]};var _0x148d6b=_0xc22b('0x59');var _0x1dbf6f='sysparm_display_value=true';_0x3901c3[_0xc22b('0x5a')]=intUtil[_0xc22b('0x5b')](_0x3901c3[_0xc22b('0x5a')]);_0x3901c3['serverUrl']=intUtil[_0xc22b('0x5b')](_0x3901c3[_0xc22b('0x5c')]);var _0x1c9ea0=util[_0xc22b('0x53')]('%s/api/now/table/',_0x3901c3[_0xc22b('0x5a')]);_0x57df10['userEmail']=!_[_0xc22b('0x5d')](_0x19ee25)?_0x19ee25[_0xc22b('0x5e')]:null;_0x57df10[_0xc22b('0x20')]=_0x3901c3[_0xc22b('0x5e')];_0x57df10[_0xc22b('0x26')]=_0x14a103[_0xc22b('0x33')]()===_0xc22b('0x5f')?_0x34ea22[_0xc22b('0x60')]:_0x34ea22['calleridnum'];_0x57df10[_0xc22b('0x61')]=_0x14a103===_0xc22b('0x62')||_0x14a103===_0xc22b('0x63')?_0xc22b('0x62'):_0xc22b('0x5f');var _0x3d58f7=util[_0xc22b('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3901c3['serverUrl'],_0x34ea22[_0xc22b('0x64')],md5(_0x34ea22['uniqueid']));if(_0x5f1d74&&_0x5f1d74[_0xc22b('0x65')]){logger[_0xc22b('0x13')](_0xc22b('0x66'),_0xc22b('0x67'));_0x34ea22['recordingURL']=_0x3d58f7;}else if(_0x5d0740&&_0x5d0740['recordingFormat']&&_0x5d0740[_0xc22b('0x68')]!==_0xc22b('0x69')){logger[_0xc22b('0x13')]('[OUTBOUND]',_0xc22b('0x67'));_0x34ea22[_0xc22b('0x6a')]=_0x3d58f7;}else{_0x34ea22[_0xc22b('0x6a')]='';}return getAdminUser(_0x14a103,_0x4f5215,_0x57df10,_0x1c9ea0,_0x1dbf6f,_0x148d6b)[_0xc22b('0xe')](getUser(_0x14a103,_0x4f5215,_0x1c9ea0,_0x1dbf6f,_0x148d6b))[_0xc22b('0xe')](getEndUser(_0x14a103,_0x4f5215,_0x1c9ea0,_0x1dbf6f,_0x148d6b))[_0xc22b('0xe')](getTicket(_0x14a103,_0x4f5215,_0x1c9ea0,_0x1a914b,_0x34ea22,_0x1dbf6f))[_0xc22b('0xe')](function(_0x2c6e04){logger[_0xc22b('0x13')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x2c6e04[_0xc22b('0x48')]));logger[_0xc22b('0x13')](util[_0xc22b('0x53')]('call\x20direction:\x20%s',_0x14a103));if(_0x14a103!==_0xc22b('0x63')){logger['info']('['+[_0x14a103[_0xc22b('0x14')]()]+']',_0xc22b('0x6b'));emit(_0x3901c3['remoteUri'],_0x19ee25[_0xc22b('0x3d')],_0x2c6e04[_0xc22b('0x48')]);}})['catch'](function(_0x145d42){logger[_0xc22b('0x17')]('['+[_0x14a103[_0xc22b('0x14')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xc22b('0x6c')](_0x145d42,{'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 0a6ecce..8c9fbc6 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 _0x04c0=['outbound','stripTrailingSlash','uri','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','error','unmanaged','lastevent','Recording\x20is\x20enabled!','calleridname','toUpperCase','request-promise','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','duration_minutes','parent_id','Contacts','direction','forEach','variableName','idField','JSON','stringify','Calls','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','user_name','then','entry_list','length','find','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20found!','Caller\x20-\x20%s','first_name','debug','[HTTP]','merge','map','type','string','nameField','custom_fields','push','content','variable','Variable','toLowerCase','POST','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','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','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch'];(function(_0x845fcc,_0x518cfb){var _0x3a0e79=function(_0x240732){while(--_0x240732){_0x845fcc['push'](_0x845fcc['shift']());}};_0x3a0e79(++_0x518cfb);}(_0x04c0,0x170));var _0x004c=function(_0x96ade1,_0x2d00fc){_0x96ade1=_0x96ade1-0x0;var _0x33dfcd=_0x04c0[_0x96ade1];return _0x33dfcd;};'use strict';var _=require('lodash');var rp=require(_0x004c('0x0'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x004c('0x1'));var intUtil=require(_0x004c('0x2'));var config=require(_0x004c('0x3'));var logger=require('../../../../config/logger')(_0x004c('0x4'));config[_0x004c('0x5')]=_[_0x004c('0x6')](config[_0x004c('0x5')],{'host':_0x004c('0x7'),'port':0x18eb});var io=require(_0x004c('0x8'))(new Redis(config[_0x004c('0x5')]));var def={'method':'POST','json':!![]};function emit(_0x4593f6,_0x5433a5,_0x1f1892){io['to'](_0x4593f6)[_0x004c('0x9')](_0x5433a5,_0x1f1892);}function getTicket(_0x528064,_0x423ed1,_0x3fc513,_0x30e89c,_0x29fa3e,_0x5626e1,_0x367db8,_0x2ce327){logger[_0x004c('0xa')](_0x004c('0xb'));var _0x2c5d10=new Date();var _0x30f5e0=[{'name':_0x004c('0xc'),'value':intUtil[_0x004c('0xd')](_0x30e89c[_0x004c('0xe')],_0x29fa3e,'\x20')},{'name':_0x004c('0xf'),'value':_0x423ed1['id']},{'name':_0x004c('0x10'),'value':_0x423ed1['id']},{'name':_0x004c('0x11'),'value':intUtil[_0x004c('0xd')](_0x30e89c[_0x004c('0x12')],_0x29fa3e,'\x0a')},{'name':_0x004c('0x13'),'value':_0x2c5d10[_0x004c('0x14')]()[_0x004c('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x004c('0x16'),'value':'15'},{'name':_0x004c('0x17'),'value':_0x3fc513['id']},{'name':'parent_type','value':_0x004c('0x18')},{'name':'parent_name','value':_0x3fc513[_0x004c('0xc')]},{'name':_0x004c('0x19'),'value':_0x2ce327}];if(_0x5626e1['length']){_[_0x004c('0x1a')](_0x5626e1,function(_0x37fb83){if(_0x29fa3e[_0x37fb83[_0x004c('0x1b')]]){_0x30f5e0['push']({'name':_0x37fb83[_0x004c('0x1c')],'value':_0x29fa3e[_0x37fb83[_0x004c('0x1b')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x004c('0x1d'),'response_type':_0x004c('0x1d'),'rest_data':JSON[_0x004c('0x1e')]({'session':_0x367db8['id'],'module_name':_0x004c('0x1f'),'name_value_list':_0x30f5e0})}});}function getAuth(_0x33e860){return util['format']('Basic\x20%s',new Buffer(_0x33e860[_0x004c('0x20')]+':X')[_0x004c('0x21')](_0x004c('0x22')));}function getServerInfo(_0x15c928){return request({'form':{'method':_0x004c('0x23'),'input_type':_0x004c('0x1d'),'response_type':_0x004c('0x1d'),'rest_data':JSON['stringify']({'session':_0x15c928['id']})}});}function getUser(_0x2fc1f5,_0x330c83,_0x4f4cc4){if(!_[_0x004c('0x24')](_0x330c83)){logger[_0x004c('0xa')](_0x004c('0x25'),_0x330c83);return request({'form':{'method':_0x004c('0x26'),'input_type':'JSON','response_type':_0x004c('0x1d'),'rest_data':JSON[_0x004c('0x1e')]({'session':_0x4f4cc4['id'],'module_name':_0x004c('0x27'),'query':util[_0x004c('0x28')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x330c83),'order_by':'','offset':'0','select_fields':['id',_0x004c('0xc'),_0x004c('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x004c('0x2a')](function(_0x272e6){if(_0x272e6[_0x004c('0x2b')][_0x004c('0x2c')]){var _0x41d13b=_[_0x004c('0x2d')](_0x272e6[_0x004c('0x2b')],function(_0x55ba41){return _0x55ba41[_0x004c('0x2e')]['user_name'][_0x004c('0x2f')]===_0x330c83;});if(_0x41d13b){logger[_0x004c('0xa')](_0x004c('0x30'));return BPromise[_0x004c('0x31')]({'id':_0x41d13b[_0x004c('0x2e')]['id'][_0x004c('0x2f')],'name':_0x41d13b['name_value_list'][_0x004c('0xc')][_0x004c('0x2f')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x004c('0x31')]({'id':_0x4f4cc4['name_value_list'][_0x004c('0x32')][_0x004c('0x2f')],'name':_0x4f4cc4[_0x004c('0x2e')][_0x004c('0x29')][_0x004c('0x2f')]});});}else{logger['info'](_0x004c('0x33'));return BPromise[_0x004c('0x31')]({'id':_0x4f4cc4[_0x004c('0x2e')][_0x004c('0x32')][_0x004c('0x2f')],'name':_0x4f4cc4[_0x004c('0x2e')][_0x004c('0x29')][_0x004c('0x2f')]});}}function getEndUser(_0x3c9f6c,_0x2bfbfb,_0x43a25d,_0x32a2ba){logger[_0x004c('0xa')](_0x004c('0x34'),_0x43a25d);return request({'form':{'method':_0x004c('0x26'),'input_type':_0x004c('0x1d'),'response_type':_0x004c('0x1d'),'rest_data':JSON[_0x004c('0x1e')]({'session':_0x32a2ba['id'],'module_name':'Contacts','query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x43a25d),'order_by':'','offset':'0','select_fields':['id',_0x004c('0xc'),_0x004c('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x004c('0x2a')](function(_0x5f1eeb){if(_0x5f1eeb[_0x004c('0x2b')][_0x004c('0x2c')]){var _0x12c727=_[_0x004c('0x2d')](_0x5f1eeb['entry_list'],function(_0x5b1e07){return _0x5b1e07[_0x004c('0x2e')][_0x004c('0x35')][_0x004c('0x2f')]===_0x43a25d;});if(_0x12c727){logger['info'](_0x004c('0x36'));return BPromise[_0x004c('0x31')]({'id':_0x12c727[_0x004c('0x2e')]['id'][_0x004c('0x2f')],'name':_0x12c727[_0x004c('0x2e')][_0x004c('0xc')][_0x004c('0x2f')],'phone':_0x12c727[_0x004c('0x2e')]['phone_home']['value']});}}else{logger[_0x004c('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x004c('0x1d'),'response_type':_0x004c('0x1d'),'rest_data':JSON[_0x004c('0x1e')]({'session':_0x32a2ba['id'],'module_name':_0x004c('0x18'),'name_value_list':[{'name':'first_name','value':_0x2bfbfb!==''?_0x2bfbfb:util[_0x004c('0x28')](_0x004c('0x37'),_0x43a25d)},{'name':_0x004c('0x35'),'value':_0x43a25d}]})}})[_0x004c('0x2a')](function(_0x16b419){logger[_0x004c('0xa')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x16b419['id'],'name':_0x16b419['entry_list'][_0x004c('0x38')][_0x004c('0x2f')],'phone':_0x16b419[_0x004c('0x2b')][_0x004c('0x35')][_0x004c('0x2f')]});});}});}function request(_0x204753){logger[_0x004c('0x39')](_0x004c('0x3a'),JSON['stringify'](_0x204753));return rp(_[_0x004c('0x3b')](def,_0x204753));}function getTags(_0xfd9b8c,_0x1caa1e){var _0x5e8e76=[];if(_0xfd9b8c&&_0xfd9b8c[_0x004c('0x2c')]>0x0){_0x5e8e76=_[_0x004c('0x3c')](_0xfd9b8c,_0x1caa1e);}return _0x5e8e76;}function getCustomFields(_0x58f5ba,_0x3972de){var _0x3775f8=[];var _0x1e89e1={'custom_fields':[]};if(_0x58f5ba['length']>0x0){_[_0x004c('0x1a')](_0x58f5ba,function(_0x2ad0ca){if(_0x2ad0ca[_0x004c('0x3d')]===_0x004c('0x3e')&&_0x2ad0ca[_0x004c('0x3f')]&&!_0x2ad0ca['customField']){_0x1e89e1[_0x2ad0ca['nameField']['toLowerCase']()]=_0x2ad0ca['content']['toString']();}else if(_0x2ad0ca[_0x004c('0x3d')]==='string'&&_0x2ad0ca[_0x004c('0x1c')]&&_0x2ad0ca['customField']){_0x1e89e1[_0x004c('0x40')][_0x004c('0x41')]({'id':_0x2ad0ca[_0x004c('0x1c')],'value':_0x2ad0ca[_0x004c('0x42')][_0x004c('0x21')]()});}else if(_0x2ad0ca['type']===_0x004c('0x43')&&_0x2ad0ca[_0x004c('0x1b')]&&_0x2ad0ca[_0x004c('0x1c')]&&_0x2ad0ca['customField']){_0x3972de[_0x2ad0ca['variableName']]&&_0x1e89e1[_0x004c('0x40')][_0x004c('0x41')]({'id':_0x2ad0ca[_0x004c('0x1c')],'value':_0x3972de[_0x2ad0ca[_0x004c('0x1b')]]['toString']()});}else if(_0x2ad0ca['type']==='customVariable'&&_0x2ad0ca[_0x004c('0x44')]&&_0x2ad0ca[_0x004c('0x44')]['name']&&_0x2ad0ca['idField']&&_0x2ad0ca['customField']){_0x3972de[_0x2ad0ca[_0x004c('0x44')]['name'][_0x004c('0x45')]()]&&_0x1e89e1[_0x004c('0x40')][_0x004c('0x41')]({'id':_0x2ad0ca[_0x004c('0x1c')],'value':_0x3972de[_0x2ad0ca[_0x004c('0x44')][_0x004c('0xc')][_0x004c('0x45')]()][_0x004c('0x21')]()});}});}return _0x1e89e1;}function getConnection(_0x3ba369){return request({'method':_0x004c('0x46'),'form':{'method':_0x004c('0x47'),'input_type':_0x004c('0x1d'),'response_type':_0x004c('0x1d'),'rest_data':JSON[_0x004c('0x1e')]({'user_auth':{'user_name':_0x3ba369[_0x004c('0x48')],'password':_0x3ba369[_0x004c('0x49')],'encryption':'PLAIN'},'application':_0x004c('0x4a')})}})[_0x004c('0x2a')](function(_0x53e867){var _0x5e4ce1=_0x53e867;if(_0x5e4ce1['id']){def[_0x004c('0x4b')]=_0x5e4ce1['id'];return BPromise[_0x004c('0x31')](_0x5e4ce1);}else{throw new Error(util[_0x004c('0x28')](_0x004c('0x4c'),_0x3ba369['id']));}});}function setRelationship(_0x3b2ca7,_0x40c9a1,_0x31a7f2,_0x5110d1){return request({'form':{'method':_0x004c('0x4d'),'input_type':_0x004c('0x1d'),'response_type':_0x004c('0x1d'),'rest_data':JSON['stringify']({'session':_0x3b2ca7['id'],'module_name':_0x004c('0x1f'),'module_id':_0x31a7f2['id'],'link_field_name':_0x5110d1,'related_ids':[_0x40c9a1['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x004c('0x4e')]=function(_0x34f3a8,_0x47d661,_0x2b039c,_0x430f7e,_0x3f3d2f,_0x560db5){var _0x3feb38,_0x256a78,_0x8239ef,_0x39f364;_0x560db5[_0x004c('0x4f')]=intUtil['stripTrailingSlash'](_0x560db5[_0x004c('0x4f')]);_0x560db5[_0x004c('0x50')]=intUtil['stripTrailingSlash'](_0x560db5[_0x004c('0x50')]);def['uri']=util[_0x004c('0x28')](_0x004c('0x51'),_0x560db5['remoteUri']);if(_0x3f3d2f&&_0x3f3d2f[_0x004c('0x52')]){logger['info'](_0x004c('0x53'),'Recording\x20is\x20enabled!');_0x47d661[_0x004c('0x54')]=util['format'](_0x004c('0x55'),_0x560db5[_0x004c('0x50')],_0x47d661[_0x004c('0x56')],md5(_0x47d661['uniqueid']));}else{_0x47d661[_0x004c('0x54')]='';}return getConnection(_0x560db5)[_0x004c('0x2a')](function(_0x3585d0){_0x39f364=_0x3585d0;return getUser(_0x560db5,_0x430f7e['name'],_0x39f364);})['then'](function(_0x4f16a5){_0x3feb38=_0x4f16a5;logger['info']('The\x20User\x20ID\x20is:',_0x3feb38['id']);return getEndUser(_0x560db5,_0x47d661['calleridname'],_0x47d661[_0x004c('0x57')],_0x39f364);})[_0x004c('0x2a')](function(_0x28a432){_0x256a78=_0x28a432;logger[_0x004c('0xa')](_0x004c('0x58'),_0x256a78['id']);return getTicket(_0x560db5,_0x3feb38,_0x256a78,_0x2b039c,_0x47d661,_0x2b039c[_0x004c('0x59')],_0x39f364,_0x004c('0x5a'));})['then'](function(_0x5065bb){_0x8239ef=_0x5065bb;logger[_0x004c('0xa')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x8239ef['id']);return setRelationship(_0x39f364,_0x3feb38,_0x8239ef,_0x004c('0x5b'));})[_0x004c('0x2a')](function(){return setRelationship(_0x39f364,_0x256a78,_0x8239ef,_0x004c('0x5c'));})[_0x004c('0x2a')](function(){return getServerInfo(_0x39f364);})[_0x004c('0x2a')](function(_0x475a84){var _0x379778=parseInt(_0x475a84[_0x004c('0x5d')][_0x004c('0x5e')](0x0));var _0x5ba7ca=util['format'](_0x004c('0x5f'),_0x560db5[_0x004c('0x4f')],_0x8239ef['id']);if(_0x379778>0x6){_0x5ba7ca=util['format'](_0x004c('0x60'),_0x560db5['remoteUri'],_0x8239ef['id']);}logger[_0x004c('0xa')](_0x004c('0x53'),_0x004c('0x61'));emit(util['format'](_0x004c('0x62'),_0x430f7e[_0x004c('0xc')]),'trigger:browser:url',{'uri':_0x5ba7ca});})[_0x004c('0x63')](function(_0x4cb5ec){logger['error'](_0x004c('0x53'),JSON[_0x004c('0x1e')](_0x4cb5ec));});};exports[_0x004c('0x64')]=function(_0x347159,_0x4b66d8,_0x3e9f55,_0x4a1b9f,_0x43dbe4,_0x616da0,_0x493423){var _0x12a929,_0x96e082,_0x5bc3c0,_0x522784;_0x616da0[_0x004c('0x4f')]=intUtil[_0x004c('0x65')](_0x616da0['remoteUri']);_0x616da0[_0x004c('0x50')]=intUtil[_0x004c('0x65')](_0x616da0[_0x004c('0x50')]);def[_0x004c('0x66')]=util[_0x004c('0x28')](_0x004c('0x51'),_0x616da0[_0x004c('0x4f')]);if(_0x493423&&_0x493423[_0x004c('0x67')]&&_0x493423[_0x004c('0x67')]!=='none'){logger[_0x004c('0xa')](_0x004c('0x68'),'Recording\x20is\x20enabled!');_0x4b66d8[_0x004c('0x54')]=util[_0x004c('0x28')](_0x004c('0x55'),_0x616da0['serverUrl'],_0x4b66d8[_0x004c('0x56')],md5(_0x4b66d8['uniqueid']));}return getConnection(_0x616da0)[_0x004c('0x2a')](function(_0x4e8a1e){_0x522784=_0x4e8a1e;return getUser(_0x616da0,_0x4a1b9f[_0x004c('0xc')],_0x522784);})['then'](function(_0x4122d2){_0x12a929=_0x4122d2;logger[_0x004c('0xa')](_0x004c('0x69'),_0x12a929['id']);return getEndUser(_0x616da0,_0x4b66d8[_0x004c('0x6a')],_0x4b66d8[_0x004c('0x6b')],_0x522784);})[_0x004c('0x2a')](function(_0x9057b9){_0x96e082=_0x9057b9;logger[_0x004c('0xa')](_0x004c('0x58'),_0x96e082['id']);return getTicket(_0x616da0,_0x12a929,_0x96e082,_0x3e9f55,_0x4b66d8,_0x3e9f55[_0x004c('0x59')],_0x522784,_0x004c('0x6c'));})['then'](function(_0x2a069a){_0x5bc3c0=_0x2a069a;logger[_0x004c('0xa')](_0x004c('0x6d'));logger[_0x004c('0xa')](_0x004c('0x6e'),_0x5bc3c0['id']);return setRelationship(_0x522784,_0x12a929,_0x5bc3c0,'users');})['then'](function(){return setRelationship(_0x522784,_0x96e082,_0x5bc3c0,_0x004c('0x5c'));})[_0x004c('0x2a')](function(){return getServerInfo(_0x522784);})[_0x004c('0x2a')](function(_0x453724){var _0x379a3f=parseInt(_0x453724['version'][_0x004c('0x5e')](0x0));var _0x217c14=util[_0x004c('0x28')](_0x004c('0x5f'),_0x616da0[_0x004c('0x4f')],_0x5bc3c0['id']);if(_0x379a3f>0x6){_0x217c14=util[_0x004c('0x28')](_0x004c('0x60'),_0x616da0['remoteUri'],_0x5bc3c0['id']);}logger[_0x004c('0xa')](_0x004c('0x68'),_0x004c('0x61'));emit(util[_0x004c('0x28')](_0x004c('0x62'),_0x4a1b9f['name']),'trigger:browser:url',{'uri':_0x217c14});})[_0x004c('0x63')](function(_0x18361c){logger[_0x004c('0x6f')]('[OUTBOUND]',JSON[_0x004c('0x1e')](_0x18361c));});};exports[_0x004c('0x70')]=function(_0x13355e,_0x2509e4,_0x315fe6,_0x5cd8f4,_0x56ac58,_0xac29e7){var _0x441a86,_0x536999,_0x3432d6,_0x2c8b23;_0xac29e7['remoteUri']=intUtil[_0x004c('0x65')](_0xac29e7[_0x004c('0x4f')]);_0xac29e7[_0x004c('0x50')]=intUtil[_0x004c('0x65')](_0xac29e7[_0x004c('0x50')]);def['uri']=util[_0x004c('0x28')]('%s/service/v4_1/rest.php',_0xac29e7[_0x004c('0x4f')]);if(_0x56ac58&&_0x56ac58[_0x004c('0x52')]){logger['info']('['+_0x2509e4[_0x004c('0x71')]['toUpperCase']()+']',_0x004c('0x72'));_0x2509e4['recordingURL']=util[_0x004c('0x28')](_0x004c('0x55'),_0xac29e7[_0x004c('0x50')],_0x2509e4[_0x004c('0x56')],md5(_0x2509e4['uniqueid']));}else{_0x2509e4[_0x004c('0x54')]='';}return getConnection(_0xac29e7)[_0x004c('0x2a')](function(_0x4d1ba1){_0x2c8b23=_0x4d1ba1;if(!_[_0x004c('0x24')](_0x5cd8f4)){return getUser(_0xac29e7,_0x5cd8f4[_0x004c('0xc')],_0x2c8b23);}else{return getUser(_0xac29e7,null,_0x2c8b23);}})[_0x004c('0x2a')](function(_0x298d3b){_0x441a86=_0x298d3b;logger[_0x004c('0xa')](_0x004c('0x69'),_0x441a86['id']);return getEndUser(_0xac29e7,_0x2509e4[_0x004c('0x73')],_0x2509e4['calleridnum'],_0x2c8b23);})['then'](function(_0x37668b){_0x536999=_0x37668b;logger[_0x004c('0xa')]('The\x20Enduser\x20ID\x20is:',_0x536999['id']);return getTicket(_0xac29e7,_0x441a86,_0x536999,_0x315fe6,_0x2509e4,_0x315fe6[_0x004c('0x59')],_0x2c8b23,_0x004c('0x5a'));})[_0x004c('0x2a')](function(_0x2b5379){_0x3432d6=_0x2b5379;logger['info'](_0x004c('0x6d'));logger[_0x004c('0xa')](_0x004c('0x6e'),_0x3432d6['id']);return setRelationship(_0x2c8b23,_0x441a86,_0x3432d6,_0x004c('0x5b'));})['then'](function(){return setRelationship(_0x2c8b23,_0x536999,_0x3432d6,'contacts');})[_0x004c('0x2a')](function(){return getServerInfo(_0x2c8b23);})[_0x004c('0x63')](function(_0x421786){logger[_0x004c('0x6f')]('['+_0x2509e4[_0x004c('0x71')][_0x004c('0x74')]()+']',JSON['stringify'](_0x421786));});}; \ No newline at end of file +var _0xe4e3=['assigned_user_id','description','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','length','forEach','variableName','push','idField','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','stringify','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','value','Agent\x20found!','resolve','name_value_list','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','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','Enduser\x20created.','debug','[HTTP]','merge','map','string','nameField','customField','toLowerCase','content','custom_fields','toString','type','variable','customVariable','Variable','login','username','password','xCALLY\x20Motion\x20integration','then','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','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','user:%s','catch','error','outbound','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Outbound','[OUTBOUND]','unmanaged','toUpperCase','Recording\x20is\x20enabled!','isNil','calleridname','Ticket\x20created!','lastevent','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects'];(function(_0x192ad3,_0x4ec054){var _0x210043=function(_0x27d670){while(--_0x27d670){_0x192ad3['push'](_0x192ad3['shift']());}};_0x210043(++_0x4ec054);}(_0xe4e3,0x67));var _0x3e4e=function(_0x144ff2,_0x58e071){_0x144ff2=_0x144ff2-0x0;var _0x26c0b7=_0xe4e3[_0x144ff2];return _0x26c0b7;};'use strict';var _=require(_0x3e4e('0x0'));var rp=require(_0x3e4e('0x1'));var BPromise=require('bluebird');var md5=require(_0x3e4e('0x2'));var util=require(_0x3e4e('0x3'));var Redis=require(_0x3e4e('0x4'));var intUtil=require(_0x3e4e('0x5'));var config=require(_0x3e4e('0x6'));var logger=require(_0x3e4e('0x7'))(_0x3e4e('0x8'));config[_0x3e4e('0x9')]=_[_0x3e4e('0xa')](config[_0x3e4e('0x9')],{'host':_0x3e4e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3e4e('0x9')]));var def={'method':_0x3e4e('0xc'),'json':!![]};function emit(_0x25cdc4,_0x3cb587,_0x24b26d){io['to'](_0x25cdc4)[_0x3e4e('0xd')](_0x3cb587,_0x24b26d);}function getTicket(_0x5a325e,_0x46eed0,_0x13a825,_0x1256d9,_0x2717d3,_0x11ca8d,_0x5ed06f,_0x17195b){logger[_0x3e4e('0xe')](_0x3e4e('0xf'));var _0x193cfe=new Date();var _0x564e28=[{'name':_0x3e4e('0x10'),'value':intUtil[_0x3e4e('0x11')](_0x1256d9[_0x3e4e('0x12')],_0x2717d3,'\x20')},{'name':_0x3e4e('0x13'),'value':_0x46eed0['id']},{'name':'created_by','value':_0x46eed0['id']},{'name':_0x3e4e('0x14'),'value':intUtil[_0x3e4e('0x11')](_0x1256d9['Descriptions'],_0x2717d3,'\x0a')},{'name':'date_start','value':_0x193cfe[_0x3e4e('0x15')]()[_0x3e4e('0x16')](0x0,0x13)[_0x3e4e('0x17')]('T','\x20')},{'name':_0x3e4e('0x18'),'value':'0'},{'name':_0x3e4e('0x19'),'value':'15'},{'name':'parent_id','value':_0x13a825['id']},{'name':_0x3e4e('0x1a'),'value':_0x3e4e('0x1b')},{'name':_0x3e4e('0x1c'),'value':_0x13a825[_0x3e4e('0x10')]},{'name':'direction','value':_0x17195b}];if(_0x11ca8d[_0x3e4e('0x1d')]){_[_0x3e4e('0x1e')](_0x11ca8d,function(_0x472878){if(_0x2717d3[_0x472878[_0x3e4e('0x1f')]]){_0x564e28[_0x3e4e('0x20')]({'name':_0x472878[_0x3e4e('0x21')],'value':_0x2717d3[_0x472878[_0x3e4e('0x1f')]]});}});}return request({'form':{'method':_0x3e4e('0x22'),'input_type':_0x3e4e('0x23'),'response_type':_0x3e4e('0x23'),'rest_data':JSON['stringify']({'session':_0x5ed06f['id'],'module_name':_0x3e4e('0x24'),'name_value_list':_0x564e28})}});}function getAuth(_0x5ac6d8){return util[_0x3e4e('0x25')](_0x3e4e('0x26'),new Buffer(_0x5ac6d8[_0x3e4e('0x27')]+':X')['toString'](_0x3e4e('0x28')));}function getServerInfo(_0x52f56f){return request({'form':{'method':_0x3e4e('0x29'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x3e4e('0x2a')]({'session':_0x52f56f['id']})}});}function getUser(_0x124c03,_0x18c5d5,_0x230242){if(!_['isNil'](_0x18c5d5)){logger[_0x3e4e('0xe')]('Getting\x20agent\x20with\x20name',_0x18c5d5);return request({'form':{'method':_0x3e4e('0x2b'),'input_type':_0x3e4e('0x23'),'response_type':_0x3e4e('0x23'),'rest_data':JSON[_0x3e4e('0x2a')]({'session':_0x230242['id'],'module_name':_0x3e4e('0x2c'),'query':util['format'](_0x3e4e('0x2d'),_0x18c5d5),'order_by':'','offset':'0','select_fields':['id',_0x3e4e('0x10'),_0x3e4e('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x36e3a9){if(_0x36e3a9[_0x3e4e('0x2f')]['length']){var _0x6c3bbf=_[_0x3e4e('0x30')](_0x36e3a9['entry_list'],function(_0x5041c4){return _0x5041c4['name_value_list'][_0x3e4e('0x2e')][_0x3e4e('0x31')]===_0x18c5d5;});if(_0x6c3bbf){logger[_0x3e4e('0xe')](_0x3e4e('0x32'));return BPromise[_0x3e4e('0x33')]({'id':_0x6c3bbf['name_value_list']['id']['value'],'name':_0x6c3bbf['name_value_list'][_0x3e4e('0x10')]['value']});}}logger[_0x3e4e('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x3e4e('0x33')]({'id':_0x230242[_0x3e4e('0x34')][_0x3e4e('0x35')][_0x3e4e('0x31')],'name':_0x230242['name_value_list'][_0x3e4e('0x2e')][_0x3e4e('0x31')]});});}else{logger['info'](_0x3e4e('0x36'));return BPromise[_0x3e4e('0x33')]({'id':_0x230242[_0x3e4e('0x34')][_0x3e4e('0x35')]['value'],'name':_0x230242[_0x3e4e('0x34')][_0x3e4e('0x2e')]['value']});}}function getEndUser(_0x6cf09e,_0x3dcc5a,_0x49a446,_0xba61ea){logger[_0x3e4e('0xe')](_0x3e4e('0x37'),_0x49a446);return request({'form':{'method':_0x3e4e('0x2b'),'input_type':_0x3e4e('0x23'),'response_type':'JSON','rest_data':JSON[_0x3e4e('0x2a')]({'session':_0xba61ea['id'],'module_name':_0x3e4e('0x1b'),'query':util[_0x3e4e('0x25')](_0x3e4e('0x38'),_0x49a446),'order_by':'','offset':'0','select_fields':['id',_0x3e4e('0x10'),_0x3e4e('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3f59a9){if(_0x3f59a9[_0x3e4e('0x2f')][_0x3e4e('0x1d')]){var _0x2f03ba=_['find'](_0x3f59a9[_0x3e4e('0x2f')],function(_0x36ea0c){return _0x36ea0c[_0x3e4e('0x34')]['phone_home'][_0x3e4e('0x31')]===_0x49a446;});if(_0x2f03ba){logger[_0x3e4e('0xe')](_0x3e4e('0x3a'));return BPromise[_0x3e4e('0x33')]({'id':_0x2f03ba[_0x3e4e('0x34')]['id'][_0x3e4e('0x31')],'name':_0x2f03ba[_0x3e4e('0x34')]['name'][_0x3e4e('0x31')],'phone':_0x2f03ba['name_value_list'][_0x3e4e('0x39')]['value']});}}else{logger[_0x3e4e('0xe')](_0x3e4e('0x3b'));return request({'form':{'method':_0x3e4e('0x22'),'input_type':'JSON','response_type':_0x3e4e('0x23'),'rest_data':JSON[_0x3e4e('0x2a')]({'session':_0xba61ea['id'],'module_name':_0x3e4e('0x1b'),'name_value_list':[{'name':_0x3e4e('0x3c'),'value':_0x3dcc5a!==''?_0x3dcc5a:util[_0x3e4e('0x25')](_0x3e4e('0x3d'),_0x49a446)},{'name':_0x3e4e('0x39'),'value':_0x49a446}]})}})['then'](function(_0x17193b){logger[_0x3e4e('0xe')](_0x3e4e('0x3e'));return BPromise[_0x3e4e('0x33')]({'id':_0x17193b['id'],'name':_0x17193b[_0x3e4e('0x2f')][_0x3e4e('0x3c')][_0x3e4e('0x31')],'phone':_0x17193b[_0x3e4e('0x2f')][_0x3e4e('0x39')][_0x3e4e('0x31')]});});}});}function request(_0x4b2932){logger[_0x3e4e('0x3f')](_0x3e4e('0x40'),JSON[_0x3e4e('0x2a')](_0x4b2932));return rp(_[_0x3e4e('0x41')](def,_0x4b2932));}function getTags(_0x2388e7,_0x2af8a2){var _0x6256c=[];if(_0x2388e7&&_0x2388e7[_0x3e4e('0x1d')]>0x0){_0x6256c=_[_0x3e4e('0x42')](_0x2388e7,_0x2af8a2);}return _0x6256c;}function getCustomFields(_0x432dde,_0x57e260){var _0x174bc4=[];var _0x56551a={'custom_fields':[]};if(_0x432dde[_0x3e4e('0x1d')]>0x0){_[_0x3e4e('0x1e')](_0x432dde,function(_0x16059f){if(_0x16059f['type']===_0x3e4e('0x43')&&_0x16059f[_0x3e4e('0x44')]&&!_0x16059f[_0x3e4e('0x45')]){_0x56551a[_0x16059f[_0x3e4e('0x44')][_0x3e4e('0x46')]()]=_0x16059f[_0x3e4e('0x47')]['toString']();}else if(_0x16059f['type']==='string'&&_0x16059f['idField']&&_0x16059f[_0x3e4e('0x45')]){_0x56551a[_0x3e4e('0x48')][_0x3e4e('0x20')]({'id':_0x16059f[_0x3e4e('0x21')],'value':_0x16059f[_0x3e4e('0x47')][_0x3e4e('0x49')]()});}else if(_0x16059f[_0x3e4e('0x4a')]===_0x3e4e('0x4b')&&_0x16059f['variableName']&&_0x16059f[_0x3e4e('0x21')]&&_0x16059f['customField']){_0x57e260[_0x16059f[_0x3e4e('0x1f')]]&&_0x56551a[_0x3e4e('0x48')][_0x3e4e('0x20')]({'id':_0x16059f[_0x3e4e('0x21')],'value':_0x57e260[_0x16059f[_0x3e4e('0x1f')]][_0x3e4e('0x49')]()});}else if(_0x16059f['type']===_0x3e4e('0x4c')&&_0x16059f[_0x3e4e('0x4d')]&&_0x16059f['Variable'][_0x3e4e('0x10')]&&_0x16059f['idField']&&_0x16059f[_0x3e4e('0x45')]){_0x57e260[_0x16059f[_0x3e4e('0x4d')][_0x3e4e('0x10')][_0x3e4e('0x46')]()]&&_0x56551a['custom_fields'][_0x3e4e('0x20')]({'id':_0x16059f[_0x3e4e('0x21')],'value':_0x57e260[_0x16059f[_0x3e4e('0x4d')]['name'][_0x3e4e('0x46')]()][_0x3e4e('0x49')]()});}});}return _0x56551a;}function getConnection(_0x21ad60){return request({'method':_0x3e4e('0xc'),'form':{'method':_0x3e4e('0x4e'),'input_type':_0x3e4e('0x23'),'response_type':_0x3e4e('0x23'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x21ad60[_0x3e4e('0x4f')],'password':_0x21ad60[_0x3e4e('0x50')],'encryption':'PLAIN'},'application':_0x3e4e('0x51')})}})[_0x3e4e('0x52')](function(_0xabafdf){var _0x41b7db=_0xabafdf;if(_0x41b7db['id']){def['sessionID']=_0x41b7db['id'];return BPromise['resolve'](_0x41b7db);}else{throw new Error(util[_0x3e4e('0x25')](_0x3e4e('0x53'),_0x21ad60['id']));}});}function setRelationship(_0x4d6630,_0x2178eb,_0x43a5d0,_0x52a9b0){return request({'form':{'method':_0x3e4e('0x54'),'input_type':'JSON','response_type':_0x3e4e('0x23'),'rest_data':JSON[_0x3e4e('0x2a')]({'session':_0x4d6630['id'],'module_name':_0x3e4e('0x24'),'module_id':_0x43a5d0['id'],'link_field_name':_0x52a9b0,'related_ids':[_0x2178eb['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x3e4e('0x55')]=function(_0x5e78a9,_0x81c209,_0x590a7b,_0x4d5bf5,_0x475a44,_0xf2f90d){var _0x2e63de,_0x4cea4f,_0x198c57,_0x3c5a4d;_0xf2f90d[_0x3e4e('0x56')]=intUtil['stripTrailingSlash'](_0xf2f90d[_0x3e4e('0x56')]);_0xf2f90d['serverUrl']=intUtil[_0x3e4e('0x57')](_0xf2f90d[_0x3e4e('0x58')]);def['uri']=util[_0x3e4e('0x25')](_0x3e4e('0x59'),_0xf2f90d[_0x3e4e('0x56')]);if(_0x475a44&&_0x475a44[_0x3e4e('0x5a')]){logger[_0x3e4e('0xe')](_0x3e4e('0x5b'),'Recording\x20is\x20enabled!');_0x81c209[_0x3e4e('0x5c')]=util[_0x3e4e('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xf2f90d[_0x3e4e('0x58')],_0x81c209[_0x3e4e('0x5d')],md5(_0x81c209[_0x3e4e('0x5d')]));}else{_0x81c209[_0x3e4e('0x5c')]='';}return getConnection(_0xf2f90d)[_0x3e4e('0x52')](function(_0x190c9d){_0x3c5a4d=_0x190c9d;return getUser(_0xf2f90d,_0x4d5bf5[_0x3e4e('0x10')],_0x3c5a4d);})['then'](function(_0x2c9546){_0x2e63de=_0x2c9546;logger[_0x3e4e('0xe')](_0x3e4e('0x5e'),_0x2e63de['id']);return getEndUser(_0xf2f90d,_0x81c209['calleridname'],_0x81c209[_0x3e4e('0x5f')],_0x3c5a4d);})[_0x3e4e('0x52')](function(_0x573931){_0x4cea4f=_0x573931;logger['info'](_0x3e4e('0x60'),_0x4cea4f['id']);return getTicket(_0xf2f90d,_0x2e63de,_0x4cea4f,_0x590a7b,_0x81c209,_0x590a7b[_0x3e4e('0x61')],_0x3c5a4d,_0x3e4e('0x62'));})[_0x3e4e('0x52')](function(_0x41e77c){_0x198c57=_0x41e77c;logger[_0x3e4e('0xe')]('Ticket\x20created!');logger[_0x3e4e('0xe')](_0x3e4e('0x63'),_0x198c57['id']);return setRelationship(_0x3c5a4d,_0x2e63de,_0x198c57,_0x3e4e('0x64'));})[_0x3e4e('0x52')](function(){return setRelationship(_0x3c5a4d,_0x4cea4f,_0x198c57,_0x3e4e('0x65'));})['then'](function(){return getServerInfo(_0x3c5a4d);})[_0x3e4e('0x52')](function(_0x58e7d1){var _0x237152=parseInt(_0x58e7d1[_0x3e4e('0x66')][_0x3e4e('0x67')](0x0));var _0x1dadb9=util[_0x3e4e('0x25')](_0x3e4e('0x68'),_0xf2f90d[_0x3e4e('0x56')],_0x198c57['id']);if(_0x237152>0x6){_0x1dadb9=util[_0x3e4e('0x25')](_0x3e4e('0x69'),_0xf2f90d['remoteUri'],_0x198c57['id']);}logger[_0x3e4e('0xe')](_0x3e4e('0x5b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3e4e('0x25')](_0x3e4e('0x6a'),_0x4d5bf5['name']),'trigger:browser:url',{'uri':_0x1dadb9});})[_0x3e4e('0x6b')](function(_0x165ca8){logger[_0x3e4e('0x6c')](_0x3e4e('0x5b'),JSON[_0x3e4e('0x2a')](_0x165ca8));});};exports[_0x3e4e('0x6d')]=function(_0x156cda,_0x8208af,_0x4e4883,_0x5c4db0,_0x147e80,_0x4d5cbe,_0x5f08e5){var _0x58047c,_0x3d0b9f,_0x469ab8,_0x155246;_0x4d5cbe[_0x3e4e('0x56')]=intUtil[_0x3e4e('0x57')](_0x4d5cbe['remoteUri']);_0x4d5cbe[_0x3e4e('0x58')]=intUtil['stripTrailingSlash'](_0x4d5cbe[_0x3e4e('0x58')]);def['uri']=util[_0x3e4e('0x25')](_0x3e4e('0x59'),_0x4d5cbe[_0x3e4e('0x56')]);if(_0x5f08e5&&_0x5f08e5['recordingFormat']&&_0x5f08e5['recordingFormat']!==_0x3e4e('0x6e')){logger[_0x3e4e('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x8208af['recordingURL']=util[_0x3e4e('0x25')](_0x3e4e('0x6f'),_0x4d5cbe[_0x3e4e('0x58')],_0x8208af[_0x3e4e('0x5d')],md5(_0x8208af['uniqueid']));}return getConnection(_0x4d5cbe)['then'](function(_0x342710){_0x155246=_0x342710;return getUser(_0x4d5cbe,_0x5c4db0['name'],_0x155246);})['then'](function(_0x38b517){_0x58047c=_0x38b517;logger['info'](_0x3e4e('0x5e'),_0x58047c['id']);return getEndUser(_0x4d5cbe,_0x8208af['destcalleridname'],_0x8208af[_0x3e4e('0x70')],_0x155246);})[_0x3e4e('0x52')](function(_0x22f3df){_0x3d0b9f=_0x22f3df;logger[_0x3e4e('0xe')](_0x3e4e('0x60'),_0x3d0b9f['id']);return getTicket(_0x4d5cbe,_0x58047c,_0x3d0b9f,_0x4e4883,_0x8208af,_0x4e4883[_0x3e4e('0x61')],_0x155246,_0x3e4e('0x71'));})[_0x3e4e('0x52')](function(_0xab5a0c){_0x469ab8=_0xab5a0c;logger[_0x3e4e('0xe')]('Ticket\x20created!');logger[_0x3e4e('0xe')]('The\x20Ticket\x20ID\x20is:',_0x469ab8['id']);return setRelationship(_0x155246,_0x58047c,_0x469ab8,'users');})[_0x3e4e('0x52')](function(){return setRelationship(_0x155246,_0x3d0b9f,_0x469ab8,_0x3e4e('0x65'));})['then'](function(){return getServerInfo(_0x155246);})['then'](function(_0x2281c6){var _0x367b18=parseInt(_0x2281c6['version']['charAt'](0x0));var _0x564a86=util[_0x3e4e('0x25')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x4d5cbe['remoteUri'],_0x469ab8['id']);if(_0x367b18>0x6){_0x564a86=util['format'](_0x3e4e('0x69'),_0x4d5cbe[_0x3e4e('0x56')],_0x469ab8['id']);}logger[_0x3e4e('0xe')](_0x3e4e('0x72'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x3e4e('0x6a'),_0x5c4db0[_0x3e4e('0x10')]),'trigger:browser:url',{'uri':_0x564a86});})[_0x3e4e('0x6b')](function(_0xf8e970){logger[_0x3e4e('0x6c')](_0x3e4e('0x72'),JSON[_0x3e4e('0x2a')](_0xf8e970));});};exports[_0x3e4e('0x73')]=function(_0x14a985,_0x3a573b,_0xafc4a8,_0x55e5a5,_0x4b4612,_0x8b4702){var _0x16601b,_0x4a806d,_0x4cc61d,_0x4603cf;_0x8b4702[_0x3e4e('0x56')]=intUtil[_0x3e4e('0x57')](_0x8b4702[_0x3e4e('0x56')]);_0x8b4702[_0x3e4e('0x58')]=intUtil['stripTrailingSlash'](_0x8b4702['serverUrl']);def['uri']=util[_0x3e4e('0x25')](_0x3e4e('0x59'),_0x8b4702[_0x3e4e('0x56')]);if(_0x4b4612&&_0x4b4612['monitor_format']){logger[_0x3e4e('0xe')]('['+_0x3a573b['lastevent'][_0x3e4e('0x74')]()+']',_0x3e4e('0x75'));_0x3a573b[_0x3e4e('0x5c')]=util[_0x3e4e('0x25')](_0x3e4e('0x6f'),_0x8b4702[_0x3e4e('0x58')],_0x3a573b['uniqueid'],md5(_0x3a573b['uniqueid']));}else{_0x3a573b[_0x3e4e('0x5c')]='';}return getConnection(_0x8b4702)[_0x3e4e('0x52')](function(_0x5b1bf2){_0x4603cf=_0x5b1bf2;if(!_[_0x3e4e('0x76')](_0x55e5a5)){return getUser(_0x8b4702,_0x55e5a5[_0x3e4e('0x10')],_0x4603cf);}else{return getUser(_0x8b4702,null,_0x4603cf);}})[_0x3e4e('0x52')](function(_0x1266af){_0x16601b=_0x1266af;logger[_0x3e4e('0xe')]('The\x20User\x20ID\x20is:',_0x16601b['id']);return getEndUser(_0x8b4702,_0x3a573b[_0x3e4e('0x77')],_0x3a573b['calleridnum'],_0x4603cf);})['then'](function(_0x33be74){_0x4a806d=_0x33be74;logger[_0x3e4e('0xe')]('The\x20Enduser\x20ID\x20is:',_0x4a806d['id']);return getTicket(_0x8b4702,_0x16601b,_0x4a806d,_0xafc4a8,_0x3a573b,_0xafc4a8[_0x3e4e('0x61')],_0x4603cf,_0x3e4e('0x62'));})[_0x3e4e('0x52')](function(_0x21f824){_0x4cc61d=_0x21f824;logger[_0x3e4e('0xe')](_0x3e4e('0x78'));logger[_0x3e4e('0xe')](_0x3e4e('0x63'),_0x4cc61d['id']);return setRelationship(_0x4603cf,_0x16601b,_0x4cc61d,_0x3e4e('0x64'));})[_0x3e4e('0x52')](function(){return setRelationship(_0x4603cf,_0x4a806d,_0x4cc61d,'contacts');})[_0x3e4e('0x52')](function(){return getServerInfo(_0x4603cf);})[_0x3e4e('0x6b')](function(_0x45664a){logger[_0x3e4e('0x6c')]('['+_0x3a573b[_0x3e4e('0x79')][_0x3e4e('0x74')]()+']',JSON[_0x3e4e('0x2a')](_0x45664a));});}; \ 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 95e4048..410a02f 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 _0x9a1b=['%s:\x20%s','join','slice','substring','validateEmail','test','lodash','util','length','push','content','type','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','format','key','keyContent','variable'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x9a1b,0xf6));var _0xb9a1=function(_0x3c881a,_0x3a750d){_0x3c881a=_0x3c881a-0x0;var _0x116609=_0x9a1b[_0x3c881a];return _0x116609;};'use strict';var _=require(_0xb9a1('0x0'));var util=require(_0xb9a1('0x1'));exports['getString']=function(_0x180686,_0x572525,_0x5e0dad){var _0xe33ff8=[];if(_0x180686['length']>0x0){var _0x221982=_['sortBy'](_0x180686,['id']);for(var _0x2f6ab7=0x0;_0x2f6ab7<_0x221982[_0xb9a1('0x2')];_0x2f6ab7++){var _0x26a595=_0x221982[_0x2f6ab7];if(_0x26a595['type']==='string'){_0xe33ff8[_0xb9a1('0x3')](_0x26a595[_0xb9a1('0x4')]);}else if(_0x26a595[_0xb9a1('0x5')]==='variable'&&_0x26a595[_0xb9a1('0x6')]){_0x572525[_0x26a595[_0xb9a1('0x6')]]&&_0xe33ff8[_0xb9a1('0x3')](_0x572525[_0x26a595[_0xb9a1('0x6')]][_0xb9a1('0x7')]());}else if(_0x26a595[_0xb9a1('0x5')]===_0xb9a1('0x8')&&_0x26a595[_0xb9a1('0x9')]&&_0x26a595[_0xb9a1('0x9')][_0xb9a1('0xa')]){_0x572525[_0x26a595[_0xb9a1('0x9')][_0xb9a1('0xa')][_0xb9a1('0xb')]()]&&_0xe33ff8['push'](_0x572525[_0x26a595[_0xb9a1('0x9')][_0xb9a1('0xa')]['toLowerCase']()][_0xb9a1('0x7')]());}else if(_0x26a595[_0xb9a1('0x5')]===_0xb9a1('0xc')){if(_0x26a595[_0xb9a1('0xd')]==='string'&&_0x26a595['key']){_0xe33ff8[_0xb9a1('0x3')](util[_0xb9a1('0xe')]('%s:\x20%s',_0x26a595[_0xb9a1('0xf')],_0x26a595[_0xb9a1('0x10')]));}else if(_0x26a595[_0xb9a1('0xd')]===_0xb9a1('0x11')&&_0x26a595[_0xb9a1('0x6')]&&_0x26a595[_0xb9a1('0xf')]){_0x572525[_0x26a595[_0xb9a1('0x6')]]&&_0xe33ff8[_0xb9a1('0x3')](util[_0xb9a1('0xe')](_0xb9a1('0x12'),_0x26a595['key'],_0x572525[_0x26a595[_0xb9a1('0x6')]]));}else if(_0x26a595['keyType']===_0xb9a1('0x8')&&_0x26a595[_0xb9a1('0x9')]&&_0x26a595[_0xb9a1('0x9')][_0xb9a1('0xa')]&&_0x26a595['key']){_0x572525[_0x26a595[_0xb9a1('0x9')][_0xb9a1('0xa')][_0xb9a1('0xb')]()]&&_0xe33ff8['push'](util[_0xb9a1('0xe')](_0xb9a1('0x12'),_0x26a595['key'],_0x572525[_0x26a595[_0xb9a1('0x9')][_0xb9a1('0xa')]['toLowerCase']()]));}}}}return _0xe33ff8[_0xb9a1('0x13')](_0x5e0dad);};exports['stripTrailingSlash']=function(_0x217990){var _0xdc2e52=_0x217990[_0xb9a1('0x14')](-0x1);if(_0xdc2e52==='/'){_0x217990=_0x217990[_0xb9a1('0x15')](0x0,_0x217990['lastIndexOf'](_0xdc2e52));}return _0x217990;};exports[_0xb9a1('0x16')]=function(_0x8cbfff){if(!_['isNil'](_0x8cbfff)&&_0x8cbfff!==''){var _0x3091ff=/^(([^<>()\[\]\\.,;:\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 _0x3091ff[_0xb9a1('0x17')](String(_0x8cbfff)[_0xb9a1('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x1e41=['variableName','customVariable','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyContent','variable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','lodash','getString','length','type','string','push','content'];(function(_0x1b852e,_0x185f0d){var _0x2fd5cf=function(_0x1dc638){while(--_0x1dc638){_0x1b852e['push'](_0x1b852e['shift']());}};_0x2fd5cf(++_0x185f0d);}(_0x1e41,0x10c));var _0x11e4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1e41[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x11e4('0x0'));var util=require('util');exports[_0x11e4('0x1')]=function(_0x404ed8,_0x33a023,_0x4598cd){var _0x4edf79=[];if(_0x404ed8[_0x11e4('0x2')]>0x0){var _0x2b5bb8=_['sortBy'](_0x404ed8,['id']);for(var _0x353f64=0x0;_0x353f64<_0x2b5bb8['length'];_0x353f64++){var _0x15d779=_0x2b5bb8[_0x353f64];if(_0x15d779[_0x11e4('0x3')]===_0x11e4('0x4')){_0x4edf79[_0x11e4('0x5')](_0x15d779[_0x11e4('0x6')]);}else if(_0x15d779[_0x11e4('0x3')]==='variable'&&_0x15d779[_0x11e4('0x7')]){_0x33a023[_0x15d779[_0x11e4('0x7')]]&&_0x4edf79['push'](_0x33a023[_0x15d779['variableName']]['toString']());}else if(_0x15d779[_0x11e4('0x3')]===_0x11e4('0x8')&&_0x15d779[_0x11e4('0x9')]&&_0x15d779['Variable'][_0x11e4('0xa')]){_0x33a023[_0x15d779[_0x11e4('0x9')][_0x11e4('0xa')][_0x11e4('0xb')]()]&&_0x4edf79['push'](_0x33a023[_0x15d779[_0x11e4('0x9')][_0x11e4('0xa')][_0x11e4('0xb')]()]['toString']());}else if(_0x15d779[_0x11e4('0x3')]===_0x11e4('0xc')){if(_0x15d779['keyType']===_0x11e4('0x4')&&_0x15d779[_0x11e4('0xd')]){_0x4edf79[_0x11e4('0x5')](util[_0x11e4('0xe')](_0x11e4('0xf'),_0x15d779[_0x11e4('0xd')],_0x15d779[_0x11e4('0x10')]));}else if(_0x15d779['keyType']===_0x11e4('0x11')&&_0x15d779[_0x11e4('0x7')]&&_0x15d779['key']){_0x33a023[_0x15d779[_0x11e4('0x7')]]&&_0x4edf79['push'](util[_0x11e4('0xe')](_0x11e4('0xf'),_0x15d779['key'],_0x33a023[_0x15d779[_0x11e4('0x7')]]));}else if(_0x15d779['keyType']===_0x11e4('0x8')&&_0x15d779[_0x11e4('0x9')]&&_0x15d779[_0x11e4('0x9')]['name']&&_0x15d779[_0x11e4('0xd')]){_0x33a023[_0x15d779[_0x11e4('0x9')][_0x11e4('0xa')][_0x11e4('0xb')]()]&&_0x4edf79['push'](util[_0x11e4('0xe')](_0x11e4('0xf'),_0x15d779[_0x11e4('0xd')],_0x33a023[_0x15d779[_0x11e4('0x9')][_0x11e4('0xa')][_0x11e4('0xb')]()]));}}}}return _0x4edf79[_0x11e4('0x12')](_0x4598cd);};exports[_0x11e4('0x13')]=function(_0x3a579a){var _0x4bf54d=_0x3a579a[_0x11e4('0x14')](-0x1);if(_0x4bf54d==='/'){_0x3a579a=_0x3a579a[_0x11e4('0x15')](0x0,_0x3a579a[_0x11e4('0x16')](_0x4bf54d));}return _0x3a579a;};exports[_0x11e4('0x17')]=function(_0x28913d){if(!_['isNil'](_0x28913d)&&_0x28913d!==''){var _0x2f6c85=/^(([^<>()\[\]\\.,;:\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 _0x2f6c85[_0x11e4('0x18')](String(_0x28913d)[_0x11e4('0xb')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index a7d9afd..7394188 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x273d02,_0x176ba7){var _0x59e4a8=function(_0x1afebc){while(--_0x1afebc){_0x273d02['push'](_0x273d02['shift']());}};_0x59e4a8(++_0x176ba7);}(_0xe706,0xa3));var _0x6e70=function(_0x487ee4,_0x3d3e66){_0x487ee4=_0x487ee4-0x0;var _0x3b0877=_0xe706[_0x487ee4];return _0x3b0877;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _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(_0x43ad9f,_0x264cc8){var _0x28f53a=function(_0x2b9c5a){while(--_0x2b9c5a){_0x43ad9f['push'](_0x43ad9f['shift']());}};_0x28f53a(++_0x264cc8);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'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 diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 0cd0a6a..51b1420 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 _0xf5f7=['localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','name','getString','Subjects','Descriptions','info','Ticket\x20created!','ticket','validateEmail','%s/search.json','then','Agent\x20found!','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','user','Admin\x20account\x20selected.','type:user\x20role:end-user\x20phone:%s','results','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','idField','custom_fields','content','variableName','push','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','newTab','[OUTBOUND]','%s/agent/tickets/%s','unmanaged','lastevent','calleridname','The\x20Enduser\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','redis'];(function(_0x3dc485,_0x358065){var _0x163fd0=function(_0x5bfb36){while(--_0x5bfb36){_0x3dc485['push'](_0x3dc485['shift']());}};_0x163fd0(++_0x358065);}(_0xf5f7,0xd3));var _0x7f5f=function(_0x24b4d0,_0x29ae7e){_0x24b4d0=_0x24b4d0-0x0;var _0x1c4fb7=_0xf5f7[_0x24b4d0];return _0x1c4fb7;};'use strict';var _=require(_0x7f5f('0x0'));var rp=require(_0x7f5f('0x1'));var md5=require(_0x7f5f('0x2'));var util=require('util');var Redis=require(_0x7f5f('0x3'));var intUtil=require('./util');var config=require(_0x7f5f('0x4'));var logger=require(_0x7f5f('0x5'))('zendesk');config['redis']=_['defaults'](config[_0x7f5f('0x6')],{'host':_0x7f5f('0x7'),'port':0x18eb});var io=require(_0x7f5f('0x8'))(new Redis(config[_0x7f5f('0x6')]));function emit(_0x380f7d,_0xa4d8c0,_0x1c9a48){io['to'](_0x380f7d)[_0x7f5f('0x9')](_0xa4d8c0,_0x1c9a48);}var headers={'Content-Type':_0x7f5f('0xa'),'Accept':_0x7f5f('0xa')};function getTicket(_0x14c278,_0x4c906f,_0x409930,_0x3b3583,_0x2f2c4c){logger['info'](_0x7f5f('0xb'));return request({'uri':util[_0x7f5f('0xc')](_0x7f5f('0xd'),_0x14c278['remoteUri']),'method':_0x7f5f('0xe'),'body':{'ticket':_[_0x7f5f('0xf')]({'requester_id':_0x409930['id'],'submitter_id':_0x4c906f?_0x4c906f['id']:undefined,'assignee_id':_0x4c906f?_0x4c906f['id']:undefined,'tags':getTags(_0x3b3583['Tags'],_0x7f5f('0x10')),'subject':intUtil[_0x7f5f('0x11')](_0x3b3583[_0x7f5f('0x12')],_0x2f2c4c,'\x20'),'description':intUtil[_0x7f5f('0x11')](_0x3b3583[_0x7f5f('0x13')],_0x2f2c4c,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7f5f('0x11')](_0x3b3583[_0x7f5f('0x13')],_0x2f2c4c,'\x0a')}},getCustomFields(_0x3b3583['Fields'],_0x2f2c4c))}})['then'](function(_0x667f40){logger[_0x7f5f('0x14')](_0x7f5f('0x15'));return _0x667f40[_0x7f5f('0x16')];});}function getUser(_0x2dd2ab,_0x368d0f){if(intUtil[_0x7f5f('0x17')](_0x368d0f)){logger['info']('Getting\x20agent\x20with\x20email',_0x368d0f);return request({'uri':util[_0x7f5f('0xc')](_0x7f5f('0x18'),_0x2dd2ab['remoteUri']),'qs':{'query':util[_0x7f5f('0xc')]('type:user\x20role:agent\x20email:%s',_0x368d0f)}})[_0x7f5f('0x19')](function(_0x10dad2){if(_0x10dad2['count']){logger[_0x7f5f('0x14')](_0x7f5f('0x1a'));return _['find'](_0x10dad2['results'],{'email':_0x368d0f,'role':_0x7f5f('0x1b')});}else{logger[_0x7f5f('0x14')](_0x7f5f('0x1c'));return request({'uri':util[_0x7f5f('0xc')](_0x7f5f('0x1d'),_0x2dd2ab[_0x7f5f('0x1e')])})[_0x7f5f('0x19')](function(_0x2a64a1){logger[_0x7f5f('0x14')]('Admin\x20account\x20selected.');return _0x2a64a1[_0x7f5f('0x1f')];});}});}else{logger[_0x7f5f('0x14')](_0x7f5f('0x1c'));return request({'uri':util[_0x7f5f('0xc')](_0x7f5f('0x1d'),_0x2dd2ab[_0x7f5f('0x1e')])})[_0x7f5f('0x19')](function(_0x294b4a){logger[_0x7f5f('0x14')](_0x7f5f('0x20'));return _0x294b4a['user'];});}}function getEndUser(_0x5eb72f,_0x4945f6,_0x232699){logger['info']('Searching\x20enduser\x20with\x20phone',_0x232699);return request({'uri':util[_0x7f5f('0xc')](_0x7f5f('0x18'),_0x5eb72f[_0x7f5f('0x1e')]),'qs':{'query':util[_0x7f5f('0xc')](_0x7f5f('0x21'),_0x232699)}})[_0x7f5f('0x19')](function(_0x5c5836){var _0x9fa505;if(_0x5c5836[_0x7f5f('0x22')][_0x7f5f('0x23')]){_0x5c5836[_0x7f5f('0x22')]=_['filter'](_0x5c5836[_0x7f5f('0x22')],{'suspended':![],'role':'end-user'});if(_0x5c5836[_0x7f5f('0x22')][_0x7f5f('0x23')]){_0x9fa505=_[_0x7f5f('0x24')](_0x5c5836[_0x7f5f('0x22')]);}}if(_0x9fa505){logger['info'](_0x7f5f('0x25'));return _0x9fa505;}else{logger[_0x7f5f('0x14')](_0x7f5f('0x26'));return request({'uri':util[_0x7f5f('0xc')](_0x7f5f('0x27'),_0x5eb72f[_0x7f5f('0x1e')]),'method':'POST','body':{'user':{'role':_0x7f5f('0x28'),'name':util['format'](_0x7f5f('0x29'),_0x4945f6||_0x232699),'phone':_0x232699}}})['then'](function(_0x4bbf25){logger[_0x7f5f('0x14')](_0x7f5f('0x2a'));return _0x4bbf25[_0x7f5f('0x1f')];});}});}function getAuth(_0x28495c){var _0x33806c;if(_0x28495c[_0x7f5f('0x2b')]===_0x7f5f('0x2c')){_0x33806c=util[_0x7f5f('0xc')](_0x7f5f('0x2d'),_0x28495c[_0x7f5f('0x2e')],_0x28495c['password']);}else if(_0x28495c[_0x7f5f('0x2b')]===_0x7f5f('0x2f')){_0x33806c=util[_0x7f5f('0xc')]('%s/token:%s',_0x28495c['username'],_0x28495c[_0x7f5f('0x2f')]);}return util['format'](_0x7f5f('0x30'),new Buffer(_0x33806c)[_0x7f5f('0x31')](_0x7f5f('0x32')));}function request(_0x143e56){logger[_0x7f5f('0x33')](_0x7f5f('0x34'),JSON[_0x7f5f('0x35')](_0x143e56));return rp(_[_0x7f5f('0x36')](_0x143e56,{'method':_0x7f5f('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x763fe7,_0x3f2460){var _0x4476cd=[];if(_0x763fe7&&_0x763fe7['length']>0x0){_0x4476cd=_[_0x7f5f('0x38')](_0x763fe7,_0x3f2460);}return _0x4476cd;}function getCustomFields(_0x384fce,_0x172d16){var _0x183bd3=[];var _0x51acda={'custom_fields':[]};if(_0x384fce[_0x7f5f('0x23')]>0x0){_[_0x7f5f('0x39')](_0x384fce,function(_0x281b44){if(_[_0x7f5f('0x3a')]([_0x7f5f('0x3b'),_0x7f5f('0x3c')],_0x281b44[_0x7f5f('0x3d')])&&_0x281b44[_0x7f5f('0x3e')]&&!_0x281b44['customField']){_0x51acda[_0x281b44[_0x7f5f('0x3e')][_0x7f5f('0x3f')]()]=_0x281b44['content']['toString']();}else if(_[_0x7f5f('0x3a')](['string',_0x7f5f('0x3c')],_0x281b44[_0x7f5f('0x3d')])&&_0x281b44[_0x7f5f('0x40')]&&_0x281b44['customField']){_0x51acda[_0x7f5f('0x41')]['push']({'id':_0x281b44['idField'],'value':_0x281b44[_0x7f5f('0x42')][_0x7f5f('0x31')]()});}else if(_0x281b44[_0x7f5f('0x3d')]==='variable'&&_0x281b44[_0x7f5f('0x43')]&&_0x281b44[_0x7f5f('0x40')]&&_0x281b44['customField']){_0x172d16[_0x281b44[_0x7f5f('0x43')]]&&_0x51acda[_0x7f5f('0x41')][_0x7f5f('0x44')]({'id':_0x281b44[_0x7f5f('0x40')],'value':_0x172d16[_0x281b44[_0x7f5f('0x43')]][_0x7f5f('0x31')]()});}else if(_0x281b44[_0x7f5f('0x3d')]==='customVariable'&&_0x281b44[_0x7f5f('0x45')]&&_0x281b44[_0x7f5f('0x45')][_0x7f5f('0x10')]&&_0x281b44[_0x7f5f('0x40')]&&_0x281b44['customField']){_0x172d16[_0x281b44[_0x7f5f('0x45')]['name'][_0x7f5f('0x3f')]()]&&_0x51acda[_0x7f5f('0x41')][_0x7f5f('0x44')]({'id':_0x281b44[_0x7f5f('0x40')],'value':_0x172d16[_0x281b44['Variable'][_0x7f5f('0x10')][_0x7f5f('0x3f')]()][_0x7f5f('0x31')]()});}});}return _0x51acda;}exports[_0x7f5f('0x46')]=function(_0x3d49e8,_0x1d6c70,_0x181e77,_0x28fe5f,_0x7678c7,_0x589677){var _0x38259f,_0x557eab;_0x589677[_0x7f5f('0x1e')]=intUtil[_0x7f5f('0x47')](_0x589677['remoteUri']);_0x589677[_0x7f5f('0x48')]=intUtil[_0x7f5f('0x47')](_0x589677[_0x7f5f('0x48')]);if(_0x7678c7&&_0x7678c7[_0x7f5f('0x49')]){logger[_0x7f5f('0x14')](_0x7f5f('0x4a'),'Recording\x20is\x20enabled!');_0x1d6c70[_0x7f5f('0x4b')]=util[_0x7f5f('0xc')](_0x7f5f('0x4c'),_0x589677[_0x7f5f('0x48')],_0x1d6c70[_0x7f5f('0x4d')],md5(_0x1d6c70['uniqueid']));}else{_0x1d6c70[_0x7f5f('0x4b')]='';}headers[_0x7f5f('0x4e')]=getAuth(_0x589677);return getUser(_0x589677,_0x28fe5f[_0x7f5f('0x4f')])[_0x7f5f('0x19')](function(_0x1d68ca){_0x38259f=_0x1d68ca;logger['info'](_0x7f5f('0x50'),_0x38259f['id']);return getEndUser(_0x589677,_0x1d6c70['calleridname'],_0x1d6c70[_0x7f5f('0x51')]);})[_0x7f5f('0x19')](function(_0x20e798){_0x557eab=_0x20e798;logger[_0x7f5f('0x14')]('The\x20Enduser\x20ID\x20is:',_0x557eab['id']);return getTicket(_0x589677,_0x38259f,_0x557eab,_0x181e77,_0x1d6c70);})[_0x7f5f('0x19')](function(_0x42b803){if(_0x42b803){logger[_0x7f5f('0x14')](_0x7f5f('0x52'),_0x42b803['id']);switch(_0x589677[_0x7f5f('0x3d')]){case _0x7f5f('0x53'):logger['info'](_0x7f5f('0x4a'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x7f5f('0x54'),_0x589677[_0x7f5f('0x1e')],_0x38259f['id'],_0x42b803['id']),'method':_0x7f5f('0xe')});case'newTab':logger[_0x7f5f('0x14')](_0x7f5f('0x4a'),_0x7f5f('0x55'));emit(util['format'](_0x7f5f('0x56'),_0x28fe5f[_0x7f5f('0x10')]),_0x7f5f('0x57'),{'uri':util[_0x7f5f('0xc')]('%s/agent/tickets/%s',_0x589677[_0x7f5f('0x1e')][_0x7f5f('0x58')](_0x7f5f('0x59'),''),_0x42b803['id'])});break;default:logger[_0x7f5f('0x5a')](_0x7f5f('0x4a'),_0x7f5f('0x5b'));}}})[_0x7f5f('0x5c')](function(_0x50f925){logger['error'](_0x7f5f('0x5d'),util[_0x7f5f('0x5e')](_0x50f925,{'showHidden':!![],'depth':null}));});};exports[_0x7f5f('0x5f')]=function(_0x1cd584,_0x3b7b00,_0x1368b1,_0x5d66b8,_0x3c0e6e,_0x17c6e4,_0x14597d){var _0x2671b6,_0x1af3a0;_0x17c6e4[_0x7f5f('0x1e')]=intUtil[_0x7f5f('0x47')](_0x17c6e4['remoteUri']);_0x17c6e4['serverUrl']=intUtil[_0x7f5f('0x47')](_0x17c6e4['serverUrl']);if(_0x14597d&&_0x14597d[_0x7f5f('0x60')]&&_0x14597d['recordingFormat']!==_0x7f5f('0x61')){logger[_0x7f5f('0x14')]('[OUTBOUND]',_0x7f5f('0x62'));_0x3b7b00[_0x7f5f('0x4b')]=util['format'](_0x7f5f('0x4c'),_0x17c6e4[_0x7f5f('0x48')],_0x3b7b00[_0x7f5f('0x4d')],md5(_0x3b7b00['uniqueid']));}headers[_0x7f5f('0x4e')]=getAuth(_0x17c6e4);return getUser(_0x17c6e4,_0x5d66b8['email'])[_0x7f5f('0x19')](function(_0x1e878d){_0x2671b6=_0x1e878d;logger[_0x7f5f('0x14')](_0x7f5f('0x50'),_0x2671b6['id']);return getEndUser(_0x17c6e4,_0x3b7b00[_0x7f5f('0x63')],_0x3b7b00[_0x7f5f('0x64')]);})[_0x7f5f('0x19')](function(_0x3f63e2){_0x1af3a0=_0x3f63e2;logger[_0x7f5f('0x14')]('The\x20Enduser\x20ID\x20is:',_0x1af3a0['id']);return getTicket(_0x17c6e4,_0x2671b6,_0x1af3a0,_0x1368b1,_0x3b7b00);})['then'](function(_0x49aa55){if(_0x49aa55){logger['info'](_0x7f5f('0x52'),_0x49aa55['id']);switch(_0x17c6e4[_0x7f5f('0x3d')]){case'integrationTab':logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x7f5f('0xc')](_0x7f5f('0x54'),_0x17c6e4[_0x7f5f('0x1e')],_0x2671b6['id'],_0x49aa55['id']),'method':_0x7f5f('0xe')});case _0x7f5f('0x65'):logger[_0x7f5f('0x14')](_0x7f5f('0x66'),_0x7f5f('0x55'));emit(util['format'](_0x7f5f('0x56'),_0x5d66b8['name']),_0x7f5f('0x57'),{'uri':util[_0x7f5f('0xc')](_0x7f5f('0x67'),_0x17c6e4[_0x7f5f('0x1e')][_0x7f5f('0x58')](_0x7f5f('0x59'),''),_0x49aa55['id'])});break;default:logger[_0x7f5f('0x5a')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x7f5f('0x5c')](function(_0x1a3afe){logger[_0x7f5f('0x5a')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x7f5f('0x5e')](_0x1a3afe,{'showHidden':!![],'depth':null}));});};exports[_0x7f5f('0x68')]=function(_0x31f0a1,_0x16879b,_0x2a4e7a,_0x4b2580,_0x483cfa,_0x2f6d19){var _0xf50922,_0x540c3b;_0x2f6d19[_0x7f5f('0x1e')]=intUtil[_0x7f5f('0x47')](_0x2f6d19['remoteUri']);_0x2f6d19[_0x7f5f('0x48')]=intUtil['stripTrailingSlash'](_0x2f6d19['serverUrl']);if(_0x483cfa&&_0x483cfa[_0x7f5f('0x49')]){logger[_0x7f5f('0x14')]('['+_0x16879b[_0x7f5f('0x69')]['toUpperCase']()+']',_0x7f5f('0x62'));_0x16879b[_0x7f5f('0x4b')]=util['format'](_0x7f5f('0x4c'),_0x2f6d19['serverUrl'],_0x16879b[_0x7f5f('0x4d')],md5(_0x16879b['uniqueid']));}else{_0x16879b['recordingURL']='';}headers[_0x7f5f('0x4e')]=getAuth(_0x2f6d19);return getUser(_0x2f6d19)[_0x7f5f('0x19')](function(_0x591148){_0xf50922=_0x591148;logger[_0x7f5f('0x14')](_0x7f5f('0x50'),_0xf50922['id']);return getEndUser(_0x2f6d19,_0x16879b[_0x7f5f('0x6a')],_0x16879b[_0x7f5f('0x51')]);})['then'](function(_0x25795f){_0x540c3b=_0x25795f;logger[_0x7f5f('0x14')](_0x7f5f('0x6b'),_0x540c3b['id']);return getTicket(_0x2f6d19,_0xf50922,_0x540c3b,_0x2a4e7a,_0x16879b);})[_0x7f5f('0x19')](function(_0x1f6af7){if(_0x1f6af7){logger[_0x7f5f('0x14')]('The\x20Ticket\x20ID\x20is:',_0x1f6af7['id']);}})[_0x7f5f('0x5c')](function(_0xb0bafe){logger[_0x7f5f('0x5a')]('['+_0x16879b[_0x7f5f('0x69')]['toUpperCase']()+']'+_0x7f5f('0x6c'),util[_0x7f5f('0x5e')](_0xb0bafe,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb2a8=['Basic\x20%s','debug','stringify','GET','map','forEach','picklist','type','nameField','customField','toLowerCase','content','toString','includes','idField','custom_fields','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','/api/v2','error','catch','inspect','recordingFormat','email','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','user:%s','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','info','format','%s/tickets.json','POST','Tags','name','getString','Subjects','Descriptions','Fields','ticket','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','user','authType','password','%s:%s','%s/token:%s','username'];(function(_0x2bc384,_0x5ebf9e){var _0x790a53=function(_0x373176){while(--_0x373176){_0x2bc384['push'](_0x2bc384['shift']());}};_0x790a53(++_0x5ebf9e);}(_0xb2a8,0x111));var _0x8b2a=function(_0xc441b5,_0xa58567){_0xc441b5=_0xc441b5-0x0;var _0x4f5e7c=_0xb2a8[_0xc441b5];return _0x4f5e7c;};'use strict';var _=require(_0x8b2a('0x0'));var rp=require('request-promise');var md5=require(_0x8b2a('0x1'));var util=require(_0x8b2a('0x2'));var Redis=require(_0x8b2a('0x3'));var intUtil=require(_0x8b2a('0x4'));var config=require(_0x8b2a('0x5'));var logger=require(_0x8b2a('0x6'))(_0x8b2a('0x7'));config[_0x8b2a('0x8')]=_[_0x8b2a('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8b2a('0xa'))(new Redis(config[_0x8b2a('0x8')]));function emit(_0x272847,_0x468c54,_0x5e417d){io['to'](_0x272847)[_0x8b2a('0xb')](_0x468c54,_0x5e417d);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x112df3,_0x5917c3,_0x62de80,_0x45328e,_0x15a8f4){logger[_0x8b2a('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x8b2a('0xd')](_0x8b2a('0xe'),_0x112df3['remoteUri']),'method':_0x8b2a('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x62de80['id'],'submitter_id':_0x5917c3?_0x5917c3['id']:undefined,'assignee_id':_0x5917c3?_0x5917c3['id']:undefined,'tags':getTags(_0x45328e[_0x8b2a('0x10')],_0x8b2a('0x11')),'subject':intUtil[_0x8b2a('0x12')](_0x45328e[_0x8b2a('0x13')],_0x15a8f4,'\x20'),'description':intUtil['getString'](_0x45328e[_0x8b2a('0x14')],_0x15a8f4,'\x0a'),'comment':{'public':![],'body':intUtil[_0x8b2a('0x12')](_0x45328e[_0x8b2a('0x14')],_0x15a8f4,'\x0a')}},getCustomFields(_0x45328e[_0x8b2a('0x15')],_0x15a8f4))}})['then'](function(_0x2775f0){logger[_0x8b2a('0xc')]('Ticket\x20created!');return _0x2775f0[_0x8b2a('0x16')];});}function getUser(_0x47097d,_0x4dce32){if(intUtil['validateEmail'](_0x4dce32)){logger['info']('Getting\x20agent\x20with\x20email',_0x4dce32);return request({'uri':util['format'](_0x8b2a('0x17'),_0x47097d[_0x8b2a('0x18')]),'qs':{'query':util[_0x8b2a('0xd')](_0x8b2a('0x19'),_0x4dce32)}})[_0x8b2a('0x1a')](function(_0x95b1d1){if(_0x95b1d1[_0x8b2a('0x1b')]){logger[_0x8b2a('0xc')](_0x8b2a('0x1c'));return _[_0x8b2a('0x1d')](_0x95b1d1[_0x8b2a('0x1e')],{'email':_0x4dce32,'role':_0x8b2a('0x1f')});}else{logger[_0x8b2a('0xc')](_0x8b2a('0x20'));return request({'uri':util[_0x8b2a('0xd')](_0x8b2a('0x21'),_0x47097d[_0x8b2a('0x18')])})[_0x8b2a('0x1a')](function(_0x154f6a){logger[_0x8b2a('0xc')](_0x8b2a('0x22'));return _0x154f6a['user'];});}});}else{logger[_0x8b2a('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x8b2a('0xd')](_0x8b2a('0x21'),_0x47097d[_0x8b2a('0x18')])})[_0x8b2a('0x1a')](function(_0x3a2d13){logger[_0x8b2a('0xc')](_0x8b2a('0x22'));return _0x3a2d13['user'];});}}function getEndUser(_0x3e2a4d,_0x29ff9a,_0x40dcd0){logger[_0x8b2a('0xc')](_0x8b2a('0x23'),_0x40dcd0);return request({'uri':util[_0x8b2a('0xd')](_0x8b2a('0x17'),_0x3e2a4d[_0x8b2a('0x18')]),'qs':{'query':util[_0x8b2a('0xd')](_0x8b2a('0x24'),_0x40dcd0)}})[_0x8b2a('0x1a')](function(_0x42cda7){var _0x178893;if(_0x42cda7[_0x8b2a('0x1e')][_0x8b2a('0x25')]){_0x42cda7[_0x8b2a('0x1e')]=_[_0x8b2a('0x26')](_0x42cda7[_0x8b2a('0x1e')],{'suspended':![],'role':_0x8b2a('0x27')});if(_0x42cda7['results'][_0x8b2a('0x25')]){_0x178893=_[_0x8b2a('0x28')](_0x42cda7['results']);}}if(_0x178893){logger[_0x8b2a('0xc')](_0x8b2a('0x29'));return _0x178893;}else{logger['info'](_0x8b2a('0x2a'));return request({'uri':util[_0x8b2a('0xd')]('%s/users.json',_0x3e2a4d[_0x8b2a('0x18')]),'method':'POST','body':{'user':{'role':_0x8b2a('0x27'),'name':util[_0x8b2a('0xd')](_0x8b2a('0x2b'),_0x29ff9a||_0x40dcd0),'phone':_0x40dcd0}}})[_0x8b2a('0x1a')](function(_0x1de0b9){logger['info'](_0x8b2a('0x2c'));return _0x1de0b9[_0x8b2a('0x2d')];});}});}function getAuth(_0x4dfa51){var _0xf42ebe;if(_0x4dfa51[_0x8b2a('0x2e')]===_0x8b2a('0x2f')){_0xf42ebe=util['format'](_0x8b2a('0x30'),_0x4dfa51['username'],_0x4dfa51['password']);}else if(_0x4dfa51[_0x8b2a('0x2e')]==='token'){_0xf42ebe=util[_0x8b2a('0xd')](_0x8b2a('0x31'),_0x4dfa51[_0x8b2a('0x32')],_0x4dfa51['token']);}return util[_0x8b2a('0xd')](_0x8b2a('0x33'),new Buffer(_0xf42ebe)['toString']('base64'));}function request(_0x541550){logger[_0x8b2a('0x34')]('[HTTP]',JSON[_0x8b2a('0x35')](_0x541550));return rp(_[_0x8b2a('0x9')](_0x541550,{'method':_0x8b2a('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x434926,_0x15fe60){var _0x3d124f=[];if(_0x434926&&_0x434926[_0x8b2a('0x25')]>0x0){_0x3d124f=_[_0x8b2a('0x37')](_0x434926,_0x15fe60);}return _0x3d124f;}function getCustomFields(_0x1b8305,_0x4e31a4){var _0x572f2e=[];var _0x4cc696={'custom_fields':[]};if(_0x1b8305[_0x8b2a('0x25')]>0x0){_[_0x8b2a('0x38')](_0x1b8305,function(_0x17ebd2){if(_['includes'](['string',_0x8b2a('0x39')],_0x17ebd2[_0x8b2a('0x3a')])&&_0x17ebd2[_0x8b2a('0x3b')]&&!_0x17ebd2[_0x8b2a('0x3c')]){_0x4cc696[_0x17ebd2[_0x8b2a('0x3b')][_0x8b2a('0x3d')]()]=_0x17ebd2[_0x8b2a('0x3e')][_0x8b2a('0x3f')]();}else if(_[_0x8b2a('0x40')](['string',_0x8b2a('0x39')],_0x17ebd2[_0x8b2a('0x3a')])&&_0x17ebd2[_0x8b2a('0x41')]&&_0x17ebd2[_0x8b2a('0x3c')]){_0x4cc696[_0x8b2a('0x42')]['push']({'id':_0x17ebd2[_0x8b2a('0x41')],'value':_0x17ebd2['content'][_0x8b2a('0x3f')]()});}else if(_0x17ebd2[_0x8b2a('0x3a')]===_0x8b2a('0x43')&&_0x17ebd2[_0x8b2a('0x44')]&&_0x17ebd2['idField']&&_0x17ebd2['customField']){_0x4e31a4[_0x17ebd2[_0x8b2a('0x44')]]&&_0x4cc696[_0x8b2a('0x42')][_0x8b2a('0x45')]({'id':_0x17ebd2[_0x8b2a('0x41')],'value':_0x4e31a4[_0x17ebd2[_0x8b2a('0x44')]]['toString']()});}else if(_0x17ebd2[_0x8b2a('0x3a')]===_0x8b2a('0x46')&&_0x17ebd2['Variable']&&_0x17ebd2[_0x8b2a('0x47')][_0x8b2a('0x11')]&&_0x17ebd2[_0x8b2a('0x41')]&&_0x17ebd2[_0x8b2a('0x3c')]){_0x4e31a4[_0x17ebd2[_0x8b2a('0x47')][_0x8b2a('0x11')][_0x8b2a('0x3d')]()]&&_0x4cc696[_0x8b2a('0x42')][_0x8b2a('0x45')]({'id':_0x17ebd2[_0x8b2a('0x41')],'value':_0x4e31a4[_0x17ebd2['Variable'][_0x8b2a('0x11')][_0x8b2a('0x3d')]()]['toString']()});}});}return _0x4cc696;}exports[_0x8b2a('0x48')]=function(_0x1b0ed3,_0x5a55d2,_0x244a9b,_0x3958de,_0xa78707,_0x3229af){var _0xa67912,_0x36458b;_0x3229af['remoteUri']=intUtil[_0x8b2a('0x49')](_0x3229af['remoteUri']);_0x3229af[_0x8b2a('0x4a')]=intUtil[_0x8b2a('0x49')](_0x3229af[_0x8b2a('0x4a')]);if(_0xa78707&&_0xa78707[_0x8b2a('0x4b')]){logger[_0x8b2a('0xc')](_0x8b2a('0x4c'),_0x8b2a('0x4d'));_0x5a55d2[_0x8b2a('0x4e')]=util[_0x8b2a('0xd')](_0x8b2a('0x4f'),_0x3229af[_0x8b2a('0x4a')],_0x5a55d2[_0x8b2a('0x50')],md5(_0x5a55d2['uniqueid']));}else{_0x5a55d2[_0x8b2a('0x4e')]='';}headers[_0x8b2a('0x51')]=getAuth(_0x3229af);return getUser(_0x3229af,_0x3958de['email'])[_0x8b2a('0x1a')](function(_0x10ac3f){_0xa67912=_0x10ac3f;logger[_0x8b2a('0xc')](_0x8b2a('0x52'),_0xa67912['id']);return getEndUser(_0x3229af,_0x5a55d2[_0x8b2a('0x53')],_0x5a55d2[_0x8b2a('0x54')]);})[_0x8b2a('0x1a')](function(_0x454fd3){_0x36458b=_0x454fd3;logger['info'](_0x8b2a('0x55'),_0x36458b['id']);return getTicket(_0x3229af,_0xa67912,_0x36458b,_0x244a9b,_0x5a55d2);})[_0x8b2a('0x1a')](function(_0x2a6c11){if(_0x2a6c11){logger[_0x8b2a('0xc')]('The\x20Ticket\x20ID\x20is:',_0x2a6c11['id']);switch(_0x3229af[_0x8b2a('0x3a')]){case _0x8b2a('0x56'):logger['info'](_0x8b2a('0x4c'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x8b2a('0xd')](_0x8b2a('0x57'),_0x3229af[_0x8b2a('0x18')],_0xa67912['id'],_0x2a6c11['id']),'method':'POST'});case _0x8b2a('0x58'):logger['info'](_0x8b2a('0x4c'),_0x8b2a('0x59'));emit(util[_0x8b2a('0xd')]('user:%s',_0x3958de[_0x8b2a('0x11')]),_0x8b2a('0x5a'),{'uri':util['format']('%s/agent/tickets/%s',_0x3229af[_0x8b2a('0x18')][_0x8b2a('0x5b')](_0x8b2a('0x5c'),''),_0x2a6c11['id'])});break;default:logger[_0x8b2a('0x5d')](_0x8b2a('0x4c'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x8b2a('0x5e')](function(_0x57ac37){logger[_0x8b2a('0x5d')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x8b2a('0x5f')](_0x57ac37,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x425239,_0x146599,_0x1b0c01,_0x153380,_0x146d79,_0x25dca4,_0x477501){var _0x277bed,_0x9bde25;_0x25dca4[_0x8b2a('0x18')]=intUtil[_0x8b2a('0x49')](_0x25dca4[_0x8b2a('0x18')]);_0x25dca4['serverUrl']=intUtil[_0x8b2a('0x49')](_0x25dca4[_0x8b2a('0x4a')]);if(_0x477501&&_0x477501[_0x8b2a('0x60')]&&_0x477501[_0x8b2a('0x60')]!=='none'){logger[_0x8b2a('0xc')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x146599[_0x8b2a('0x4e')]=util['format'](_0x8b2a('0x4f'),_0x25dca4[_0x8b2a('0x4a')],_0x146599[_0x8b2a('0x50')],md5(_0x146599['uniqueid']));}headers[_0x8b2a('0x51')]=getAuth(_0x25dca4);return getUser(_0x25dca4,_0x153380[_0x8b2a('0x61')])[_0x8b2a('0x1a')](function(_0x174f23){_0x277bed=_0x174f23;logger[_0x8b2a('0xc')]('The\x20User\x20ID\x20is:',_0x277bed['id']);return getEndUser(_0x25dca4,_0x146599['destcalleridname'],_0x146599['destcalleridnum']);})[_0x8b2a('0x1a')](function(_0xa67761){_0x9bde25=_0xa67761;logger['info'](_0x8b2a('0x55'),_0x9bde25['id']);return getTicket(_0x25dca4,_0x277bed,_0x9bde25,_0x1b0c01,_0x146599);})[_0x8b2a('0x1a')](function(_0x56b4dd){if(_0x56b4dd){logger[_0x8b2a('0xc')]('The\x20Ticket\x20ID\x20is:',_0x56b4dd['id']);switch(_0x25dca4[_0x8b2a('0x3a')]){case'integrationTab':logger[_0x8b2a('0xc')](_0x8b2a('0x62'),_0x8b2a('0x63'));return request({'uri':util[_0x8b2a('0xd')](_0x8b2a('0x57'),_0x25dca4[_0x8b2a('0x18')],_0x277bed['id'],_0x56b4dd['id']),'method':_0x8b2a('0xf')});case'newTab':logger[_0x8b2a('0xc')](_0x8b2a('0x62'),_0x8b2a('0x59'));emit(util[_0x8b2a('0xd')](_0x8b2a('0x64'),_0x153380[_0x8b2a('0x11')]),'trigger:browser:url',{'uri':util['format'](_0x8b2a('0x65'),_0x25dca4[_0x8b2a('0x18')][_0x8b2a('0x5b')](_0x8b2a('0x5c'),''),_0x56b4dd['id'])});break;default:logger[_0x8b2a('0x5d')]('[OUTBOUND]',_0x8b2a('0x66'));}}})[_0x8b2a('0x5e')](function(_0x2f8a2b){logger[_0x8b2a('0x5d')](_0x8b2a('0x67'),util[_0x8b2a('0x5f')](_0x2f8a2b,{'showHidden':!![],'depth':null}));});};exports[_0x8b2a('0x68')]=function(_0x3c69b3,_0x4b52fe,_0x427760,_0x114ede,_0x58424a,_0x2f9d28){var _0x122eee,_0x3f40fb;_0x2f9d28[_0x8b2a('0x18')]=intUtil[_0x8b2a('0x49')](_0x2f9d28['remoteUri']);_0x2f9d28['serverUrl']=intUtil[_0x8b2a('0x49')](_0x2f9d28['serverUrl']);if(_0x58424a&&_0x58424a['monitor_format']){logger[_0x8b2a('0xc')]('['+_0x4b52fe[_0x8b2a('0x69')][_0x8b2a('0x6a')]()+']','Recording\x20is\x20enabled!');_0x4b52fe['recordingURL']=util[_0x8b2a('0xd')](_0x8b2a('0x4f'),_0x2f9d28[_0x8b2a('0x4a')],_0x4b52fe['uniqueid'],md5(_0x4b52fe[_0x8b2a('0x50')]));}else{_0x4b52fe['recordingURL']='';}headers[_0x8b2a('0x51')]=getAuth(_0x2f9d28);return getUser(_0x2f9d28)[_0x8b2a('0x1a')](function(_0x86d630){_0x122eee=_0x86d630;logger[_0x8b2a('0xc')](_0x8b2a('0x52'),_0x122eee['id']);return getEndUser(_0x2f9d28,_0x4b52fe[_0x8b2a('0x53')],_0x4b52fe[_0x8b2a('0x54')]);})['then'](function(_0x559fbd){_0x3f40fb=_0x559fbd;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3f40fb['id']);return getTicket(_0x2f9d28,_0x122eee,_0x3f40fb,_0x427760,_0x4b52fe);})[_0x8b2a('0x1a')](function(_0x212f1f){if(_0x212f1f){logger[_0x8b2a('0xc')](_0x8b2a('0x6b'),_0x212f1f['id']);}})[_0x8b2a('0x5e')](function(_0x5d718b){logger[_0x8b2a('0x5d')]('['+_0x4b52fe[_0x8b2a('0x69')][_0x8b2a('0x6a')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x8b2a('0x5f')](_0x5d718b,{'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 e1b6b47..5e70df4 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 _0x29fc=['stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','Outbound','user:%s','unmanaged','toUpperCase','request-promise','util','ioredis','../../../../config/environment','zoho','defaults','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Agent\x20found!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','nothing','Contacts','lead','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','connect','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','stack','err','queue'];(function(_0x20d9ff,_0x1bcc4b){var _0x1f78aa=function(_0x4ab48e){while(--_0x4ab48e){_0x20d9ff['push'](_0x20d9ff['shift']());}};_0x1f78aa(++_0x1bcc4b);}(_0x29fc,0xb0));var _0xc29f=function(_0x247b5f,_0x2f8c6d){_0x247b5f=_0x247b5f-0x0;var _0x5bc28e=_0x29fc[_0x247b5f];return _0x5bc28e;};'use strict';var _=require('lodash');var rp=require(_0xc29f('0x0'));var md5=require('md5');var util=require(_0xc29f('0x1'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0xc29f('0x2'));var BPromise=require('bluebird');var config=require(_0xc29f('0x3'));var logger=require('../../../../config/logger')(_0xc29f('0x4'));config['redis']=_[_0xc29f('0x5')](config['redis'],{'host':_0xc29f('0x6'),'port':0x18eb});var io=require(_0xc29f('0x7'))(new Redis(config['redis']));function emit(_0x58a5a2,_0x25b854,_0x279063){io['to'](_0x58a5a2)['emit'](_0x25b854,_0x279063);}function request(_0x5e0618){logger[_0xc29f('0x8')](_0xc29f('0x9'),JSON[_0xc29f('0xa')](_0x5e0618));return rp(_0x5e0618);}function getCustomFields(_0xbc7980,_0x54bd28){var _0x3974e9={};if(_0xbc7980[_0xc29f('0xb')]>0x0){_[_0xc29f('0xc')](_0xbc7980,function(_0x6ab648){if(_[_0xc29f('0xd')]([_0xc29f('0xe'),_0xc29f('0xf')],_0x6ab648['type'])&&_0x6ab648[_0xc29f('0x10')]){_0x3974e9[_0x6ab648[_0xc29f('0x10')]]=_0x6ab648[_0xc29f('0x11')]['toString']();}else if(_0x6ab648[_0xc29f('0x12')]===_0xc29f('0x13')&&_0x6ab648['variableName']&&_0x6ab648['idField']&&_0x54bd28[_0x6ab648['variableName']]){_0x3974e9[_0x6ab648[_0xc29f('0x10')]]=_0x54bd28[_0x6ab648[_0xc29f('0x14')]][_0xc29f('0x15')]();}else if(_0x6ab648[_0xc29f('0x12')]===_0xc29f('0x16')&&_0x6ab648[_0xc29f('0x17')]&&_0x6ab648[_0xc29f('0x17')]['name']&&_0x6ab648[_0xc29f('0x10')]&&_0x54bd28[_0x6ab648['Variable'][_0xc29f('0x18')][_0xc29f('0x19')]()]){_0x3974e9[_0x6ab648['idField']]=_0x54bd28[_0x6ab648[_0xc29f('0x17')][_0xc29f('0x18')][_0xc29f('0x19')]()]['toString']();}});}return _0x3974e9;}function getName(_0x1c44a4){if(_0x1c44a4[_0xc29f('0x1a')]('\x20')>0x0){var _0x4d4b27=_0x1c44a4['split'](/ (.+)/);if(_0x4d4b27[0x1]){return _0x4d4b27;}}return[_0x1c44a4,_0x1c44a4];}var accountsTokens={};function getAccessToken(_0x3da9d6){return new Promise(function(_0x5a3002,_0x57e913){if(!_[_0xc29f('0x1b')](accountsTokens[_0x3da9d6['id']])&&!_[_0xc29f('0x1b')](accountsTokens[_0x3da9d6['id']][_0xc29f('0x1c')])){if(moment()['isBefore'](accountsTokens[_0x3da9d6['id']]['expires_in'])){_0x5a3002(accountsTokens[_0x3da9d6['id']][_0xc29f('0x1c')]);}}var _0x77a2a;switch(_0x3da9d6[_0xc29f('0x1d')]){case'US':_0x77a2a=_0xc29f('0x1e');break;case'AU':_0x77a2a=_0xc29f('0x1f');break;case'EU':_0x77a2a=_0xc29f('0x20');break;case'IN':_0x77a2a=_0xc29f('0x21');break;case'CN':_0x77a2a=_0xc29f('0x22');break;default:_0x77a2a=_0xc29f('0x20');break;}var _0x35bc22={'method':_0xc29f('0x23'),'uri':_0x77a2a+_0xc29f('0x24'),'qs':{'refresh_token':_0x3da9d6['refreshToken'],'client_id':_0x3da9d6[_0xc29f('0x25')],'client_secret':_0x3da9d6[_0xc29f('0x26')],'grant_type':_0xc29f('0x27')},'json':!![]};return rp(_0x35bc22)[_0xc29f('0x28')](function(_0x152461){accountsTokens[_0x3da9d6['id']]={'access_token':_0x152461['access_token'],'expires_in':moment()['add'](_0x152461[_0xc29f('0x29')],_0xc29f('0x2a'))};_0x5a3002(_0x152461[_0xc29f('0x1c')]);})[_0xc29f('0x2b')](function(_0x3f30a7){logger[_0xc29f('0x2c')](_0xc29f('0x2d'),_0x3f30a7['stack']);_0x57e913(_0x3f30a7);});});}function getUser(_0x4b4a78,_0x27daf5,_0x15ff56,_0x425628){logger[_0xc29f('0x2e')](_0xc29f('0x2f'));return request({'method':_0xc29f('0x30'),'uri':util[_0xc29f('0x31')]('https://www.zohoapis.%s/crm/v2/users',_0x27daf5),'qs':{'type':_0xc29f('0x32')},'headers':{'Authorization':_0xc29f('0x33')+_0x4b4a78},'json':!![]})[_0xc29f('0x28')](function(_0xbf4638){if(_0xbf4638['users']){var _0x2bbd32=-0x1;if(_[_0xc29f('0x34')](_0xbf4638[_0xc29f('0x35')])){if(!_[_0xc29f('0x1b')](_0x425628)){_0x2bbd32=_[_0xc29f('0x36')](_0xbf4638[_0xc29f('0x35')],function(_0x4a187d){return _0x4a187d[_0xc29f('0x37')]===_0x425628;});}if(_0x2bbd32>=0x0){logger[_0xc29f('0x2e')](_0xc29f('0x38'));}else{logger[_0xc29f('0x2e')]('Using\x20the\x20admin\x20account!');_0x2bbd32=_['findIndex'](_0xbf4638[_0xc29f('0x35')],function(_0x162ca2){return _0x162ca2[_0xc29f('0x39')][_0xc29f('0x18')]===_0xc29f('0x3a');});}return _0xbf4638[_0xc29f('0x35')][_0x2bbd32];}else{if(_0xbf4638['user'][_0xc29f('0x39')][_0xc29f('0x18')]==='Administrator'){logger[_0xc29f('0x2e')]('Using\x20the\x20admin\x20account!');user=_0xbf4638[_0xc29f('0x3b')];return user;}else{logger[_0xc29f('0x2c')](_0xc29f('0x3c'),JSON[_0xc29f('0xa')](_0xbf4638));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xc29f('0xa')](_0xbf4638));}}}else{logger['error'](_0xc29f('0x3c'),JSON['stringify'](_0xbf4638));throw new Error(_0xc29f('0x3d')+JSON[_0xc29f('0xa')](_0xbf4638));}})[_0xc29f('0x2b')](function(_0x5887cb){console[_0xc29f('0x2c')](_0x5887cb);});}function getZohoUser(_0xa06c24,_0x59e4c8){return new BPromise(function(_0x3709bb,_0x5e21d4){request(_0xa06c24)[_0xc29f('0x28')](function(_0x1ce91c){var _0x44c35f=null;if(_0x1ce91c){_0x44c35f=_0x1ce91c[_0xc29f('0x3e')][0x0];_0x44c35f[_0xc29f('0x3f')]=_0x59e4c8;}_0x3709bb(_0x44c35f);})[_0xc29f('0x2b')](function(_0x56ec29){_0x5e21d4(_0x56ec29);});});}function createEndUser(_0x2688d6,_0x3d00e5,_0x11198b,_0x2305ed,_0x36f5ef,_0x11614c){var _0x11198b=getName(_0x11198b);return request({'method':_0xc29f('0x23'),'uri':_0xc29f('0x40')+_0x3d00e5+_0xc29f('0x41')+_[_0xc29f('0x42')](_0x11614c[_0xc29f('0x43')])+'s','body':{'data':[{'Last_Name':_0x11198b[0x1],'First_Name':_0x11198b[0x0],'Phone':_0x2305ed,'Owner':{'name':!_[_0xc29f('0x1b')](_0x36f5ef[_0xc29f('0x44')]['name'])?_0x36f5ef[_0xc29f('0x44')][_0xc29f('0x18')]:!_[_0xc29f('0x1b')](_0x36f5ef['first_name'])?_0x36f5ef[_0xc29f('0x45')]+'\x20'+_0x36f5ef[_0xc29f('0x46')]:_0x36f5ef[_0xc29f('0x46')],'id':_0x36f5ef['id']}}]},'headers':{'Authorization':_0xc29f('0x33')+_0x2688d6},'json':!![]})['then'](function(_0x151102){if(_0x151102&&_0x151102['data'][0x0][_0xc29f('0x47')]===_0xc29f('0x48')){var _0x2ef0d8=_0x151102[_0xc29f('0x3e')][0x0][_0xc29f('0x49')];_0x2ef0d8[_0xc29f('0x3f')]=_[_0xc29f('0x42')](_0x11614c['moduleCreate'])+'s';return _0x2ef0d8;}logger['error'](_0xc29f('0x3c'),JSON[_0xc29f('0xa')](data));throw new Error(_0xc29f('0x4a')+JSON['stringify'](data));})['catch'](function(_0x5d99a0){console['log'](_0xc29f('0x4b'),_0x5d99a0);});}function getEndUser(_0x1a6d86,_0x184c7a,_0x541121,_0x535bcf,_0x4f5dbc,_0x1fb55d,_0x3eaa78){var _0x1ec70a={'method':_0xc29f('0x30'),'uri':'','headers':{'Authorization':_0xc29f('0x33')+_0x1a6d86},'json':!![]};switch(_0x3eaa78['moduleSearch']){case _0xc29f('0x4c'):_0x1ec70a[_0xc29f('0x4d')]=_0xc29f('0x40')+_0x184c7a+_0xc29f('0x4e')+_0x4f5dbc+'))';return getZohoUser(_0x1ec70a,'Contacts')[_0xc29f('0x28')](function(_0x5f1ad2){if(_0x5f1ad2)return _0x5f1ad2;_0x1ec70a['uri']=_0xc29f('0x40')+_0x184c7a+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4f5dbc+'))';return getZohoUser(_0x1ec70a,_0xc29f('0x4f'))[_0xc29f('0x28')](function(_0x29060d){if(_0x29060d)return _0x29060d;if(_0x3eaa78[_0xc29f('0x43')]!=_0xc29f('0x50')){return createEndUser(_0x1a6d86,_0x184c7a,_0x535bcf,_0x4f5dbc,_0x1fb55d,_0x3eaa78);}else{return{};}});});break;case'contact':_0x1ec70a[_0xc29f('0x4d')]=_0xc29f('0x40')+_0x184c7a+_0xc29f('0x4e')+_0x4f5dbc+'))';return getZohoUser(_0x1ec70a,_0xc29f('0x51'))[_0xc29f('0x28')](function(_0x5c01ea){if(_0x5c01ea)return _0x5c01ea;if(_0x3eaa78[_0xc29f('0x43')]!=_0xc29f('0x50')){return createEndUser(_0x1a6d86,_0x184c7a,_0x535bcf,_0x4f5dbc,_0x1fb55d,_0x3eaa78);}else{return{};}});break;case _0xc29f('0x52'):_0x1ec70a[_0xc29f('0x4d')]=_0xc29f('0x40')+_0x184c7a+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4f5dbc+'))';return getZohoUser(_0x1ec70a,_0xc29f('0x4f'))[_0xc29f('0x28')](function(_0x219cd6){if(_0x219cd6)return _0x219cd6;if(_0x3eaa78[_0xc29f('0x43')]!=_0xc29f('0x50')){return createEndUser(_0x1a6d86,_0x184c7a,_0x535bcf,_0x4f5dbc,_0x1fb55d,_0x3eaa78);}else{return{};}});break;}}function getCall(_0x2d6253,_0x2ed2bd,_0x52b716,_0x763d24,_0x2d08ee,_0x484b01,_0x5d6b44,_0x34c88f){logger[_0xc29f('0x2e')]('Creating\x20new\x20call...');var _0x4a4d45={};_0x4a4d45['Owner']={'name':!_[_0xc29f('0x1b')](_0x763d24[_0xc29f('0x44')][_0xc29f('0x18')])&&!_[_0xc29f('0x1b')](_0x763d24[_0xc29f('0x39')][_0xc29f('0x18')])&&_0x763d24['profile'][_0xc29f('0x18')]===_0xc29f('0x53')?_0x763d24[_0xc29f('0x44')][_0xc29f('0x18')]:!_[_0xc29f('0x1b')](_0x763d24[_0xc29f('0x45')])?_0x763d24[_0xc29f('0x45')]+'\x20'+_0x763d24['last_name']:_0x763d24[_0xc29f('0x46')],'id':_0x763d24['id']};_0x4a4d45[_0xc29f('0x54')]=intUtil[_0xc29f('0x55')](_0x484b01[_0xc29f('0x56')],_0x5d6b44,'\x20');_0x4a4d45['Description']=intUtil['getString'](_0x484b01[_0xc29f('0x57')],_0x5d6b44,'\x0a');if(_0x2d08ee['enduserType']==='Contacts'){_0x4a4d45[_0xc29f('0x58')]={'name':!_[_0xc29f('0x1b')](_0x2d08ee[_0xc29f('0x59')])?_0x2d08ee[_0xc29f('0x59')]:!_['isNil'](_0x2d08ee[_0xc29f('0x5a')])?_0x2d08ee[_0xc29f('0x5a')]+'\x20'+_0x2d08ee[_0xc29f('0x5b')]:_0x2d08ee[_0xc29f('0x5b')],'id':_0x2d08ee['id']};}if(_0x2d08ee[_0xc29f('0x3f')]==='Leads'){_0x4a4d45[_0xc29f('0x5c')]={'name':!_[_0xc29f('0x1b')](_0x2d08ee[_0xc29f('0x59')])?_0x2d08ee[_0xc29f('0x59')]:!_[_0xc29f('0x1b')](_0x2d08ee[_0xc29f('0x5a')])?_0x2d08ee[_0xc29f('0x5a')]+'\x20'+_0x2d08ee[_0xc29f('0x5b')]:_0x2d08ee[_0xc29f('0x5b')],'id':_0x2d08ee['id']};_0x4a4d45[_0xc29f('0x5d')]=_[_0xc29f('0x42')](_0x2d08ee['enduserType']);}if(_0x5d6b44[_0xc29f('0x5e')]){_0x4a4d45['Call_Duration']=moment[_0xc29f('0x5f')](parseInt(_0x5d6b44[_0xc29f('0x5e')])*0x3e8)[_0xc29f('0x31')]('mm:ss');}else if(_0x5d6b44['answertime']&&_0x5d6b44[_0xc29f('0x60')]){_0x4a4d45[_0xc29f('0x61')]=moment['utc'](moment(_0x5d6b44['endtime'],_0xc29f('0x62'))[_0xc29f('0x63')](moment(_0x5d6b44[_0xc29f('0x64')],_0xc29f('0x62'))))['format'](_0xc29f('0x65'));}switch(_0x5d6b44[_0xc29f('0x66')]){case _0xc29f('0x67'):_0x4a4d45[_0xc29f('0x68')]='Called';break;case'complete':case _0xc29f('0x69'):_0x4a4d45['Call_Result']='Answered';break;case _0xc29f('0x6a'):_0x4a4d45['Call_Result']=_0xc29f('0x6b');break;case _0xc29f('0x6c'):_0x4a4d45[_0xc29f('0x68')]=_0xc29f('0x6d');break;case'timeout':_0x4a4d45[_0xc29f('0x68')]=_0xc29f('0x6e');default:}_0x4a4d45[_0xc29f('0x6f')]=(_0x34c88f===_0xc29f('0x70')?moment(_0x5d6b44[_0xc29f('0x64')])[_0xc29f('0x31')](_0xc29f('0x62')):moment(_0x5d6b44[_0xc29f('0x71')])[_0xc29f('0x31')](_0xc29f('0x62')))||moment()[_0xc29f('0x31')]('YYYY-MM-DDTHH:mm:ss');_0x4a4d45[_0xc29f('0x72')]=_0x34c88f||'Inbound';_0x4a4d45=_[_0xc29f('0x73')](_0x4a4d45,getCustomFields(_0x484b01[_0xc29f('0x74')],_0x5d6b44));return request({'method':_0xc29f('0x23'),'uri':_0xc29f('0x40')+_0x2ed2bd+_0xc29f('0x75'),'headers':{'Authorization':_0xc29f('0x33')+_0x2d6253},'body':{'data':[_0x4a4d45]},'json':!![]})[_0xc29f('0x28')](function(_0x4d4c72){if(_0x4d4c72&&_0x4d4c72['data'][0x0][_0xc29f('0x47')]===_0xc29f('0x48')){logger[_0xc29f('0x2e')](_0xc29f('0x76'));return{'id':_0x4d4c72[_0xc29f('0x3e')][0x0]['details']['id']};}})[_0xc29f('0x2b')](function(_0xf71ab3){logger[_0xc29f('0x2e')]('err',_0xf71ab3[_0xc29f('0x77')]);console['log'](_0xc29f('0x78'),_0xf71ab3);});}exports[_0xc29f('0x79')]=function(_0x50a69a,_0xaf95a3,_0x56f6a9,_0x3373ac,_0x47e73e,_0x2500b0){var _0x19e539,_0x5e6ae9,_0x661346;_0x2500b0['host']=intUtil[_0xc29f('0x7a')](_0x2500b0[_0xc29f('0x7b')]);_0x2500b0[_0xc29f('0x7c')]=intUtil[_0xc29f('0x7a')](_0x2500b0['serverUrl']);if(_0x47e73e&&_0x47e73e[_0xc29f('0x7d')]){logger[_0xc29f('0x2e')](_0xc29f('0x7e'),'Recording\x20is\x20enabled!');_0xaf95a3[_0xc29f('0x7f')]=_0x2500b0[_0xc29f('0x7c')]+_0xc29f('0x80')+_0xaf95a3[_0xc29f('0x81')]+_0xc29f('0x82')+md5(_0xaf95a3[_0xc29f('0x81')]);}else{_0xaf95a3[_0xc29f('0x7f')]='';}var _0x581356=_0x2500b0[_0xc29f('0x7b')]===_0xc29f('0x83')?'eu':_0xc29f('0x84');return getAccessToken(_0x2500b0)[_0xc29f('0x28')](function(_0x4121d7){_0x661346=_0x4121d7;return getUser(_0x661346,_0x581356,_0x2500b0,_0x3373ac[_0xc29f('0x37')]);})['then'](function(_0x193981){_0x19e539=_0x193981;logger['info']('The\x20User\x20ID\x20is:',_0x19e539['id']);return getEndUser(_0x661346,_0x581356,_0x2500b0,_0xaf95a3[_0xc29f('0x85')],_0xaf95a3['calleridnum'],_0x19e539,_0x56f6a9);})['then'](function(_0x1071b5){_0x5e6ae9=_0x1071b5;return getCall(_0x661346,_0x581356,_0x2500b0,_0x19e539,_0x5e6ae9,_0x56f6a9,_0xaf95a3,_0xc29f('0x86'));})[_0xc29f('0x28')](function(_0x4c127e){if(_0x4c127e){logger[_0xc29f('0x2e')](_0xc29f('0x87'),_0x4c127e['id']);logger[_0xc29f('0x2e')](_0xc29f('0x7e'),_0xc29f('0x88'));emit(util[_0xc29f('0x31')]('user:%s',_0x3373ac[_0xc29f('0x18')]),_0xc29f('0x89'),{'uri':_0xc29f('0x8a')+_0x2500b0['host']+_0xc29f('0x8b')+_0x4c127e['id']});}})[_0xc29f('0x2b')](function(_0x416f2a){logger['error'](_0xc29f('0x7e'),JSON[_0xc29f('0xa')](_0x416f2a));});};exports[_0xc29f('0x70')]=function(_0x37abbb,_0x3ee159,_0x5d1121,_0x280bed,_0x4415ad,_0x5dacee,_0x56ac87){var _0x9bcabe,_0x4cd6ac,_0x1040a9;_0x5dacee['host']=intUtil[_0xc29f('0x7a')](_0x5dacee[_0xc29f('0x7b')]);_0x5dacee[_0xc29f('0x7c')]=intUtil['stripTrailingSlash'](_0x5dacee[_0xc29f('0x7c')]);if(_0x56ac87&&_0x56ac87[_0xc29f('0x8c')]&&_0x56ac87[_0xc29f('0x8c')]!==_0xc29f('0x8d')){logger[_0xc29f('0x2e')](_0xc29f('0x8e'),_0xc29f('0x8f'));_0x3ee159[_0xc29f('0x7f')]=_0x5dacee[_0xc29f('0x7c')]+_0xc29f('0x80')+_0x3ee159['uniqueid']+_0xc29f('0x82')+md5(_0x3ee159['uniqueid']);}var _0x39550e=_0x5dacee[_0xc29f('0x7b')]===_0xc29f('0x83')?'eu':_0xc29f('0x84');return getAccessToken(_0x5dacee)[_0xc29f('0x28')](function(_0x33c990){_0x1040a9=_0x33c990;return getUser(_0x1040a9,_0x39550e,_0x5dacee,_0x280bed[_0xc29f('0x37')]);})[_0xc29f('0x28')](function(_0x44bb41){_0x9bcabe=_0x44bb41;logger[_0xc29f('0x2e')]('The\x20User\x20ID\x20is:',_0x9bcabe['id']);return getEndUser(_0x1040a9,_0x39550e,_0x5dacee,_0x3ee159[_0xc29f('0x90')],_0x3ee159['destcalleridnum'],_0x9bcabe,_0x5d1121);})[_0xc29f('0x28')](function(_0x59b31b){_0x4cd6ac=_0x59b31b;return getCall(_0x1040a9,_0x39550e,_0x5dacee,_0x9bcabe,_0x4cd6ac,_0x5d1121,_0x3ee159,_0xc29f('0x91'));})[_0xc29f('0x28')](function(_0x11c4d4){if(_0x11c4d4){logger[_0xc29f('0x2e')](_0xc29f('0x87'),_0x11c4d4['id']);logger[_0xc29f('0x2e')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xc29f('0x92'),_0x280bed[_0xc29f('0x18')]),'trigger:browser:url',{'uri':_0xc29f('0x8a')+_0x5dacee['host']+_0xc29f('0x8b')+_0x11c4d4['id']});}})[_0xc29f('0x2b')](function(_0x3f9854){logger[_0xc29f('0x2c')](_0xc29f('0x8e'),JSON['stringify'](_0x3f9854));});};exports[_0xc29f('0x93')]=function(_0x3104f5,_0x34cf3d,_0x6a43d3,_0x36b455,_0x378641,_0x46a7be){var _0x11cc18,_0xb2d44e,_0x2b533a;_0x46a7be[_0xc29f('0x7b')]=intUtil[_0xc29f('0x7a')](_0x46a7be[_0xc29f('0x7b')]);_0x46a7be['serverUrl']=intUtil[_0xc29f('0x7a')](_0x46a7be[_0xc29f('0x7c')]);if(_0x378641&&_0x378641[_0xc29f('0x7d')]){logger[_0xc29f('0x2e')]('['+_0x34cf3d[_0xc29f('0x66')][_0xc29f('0x94')]()+']','Recording\x20is\x20enabled!');_0x34cf3d[_0xc29f('0x7f')]=_0x46a7be[_0xc29f('0x7c')]+'/api/voice/recordings/'+_0x34cf3d[_0xc29f('0x81')]+_0xc29f('0x82')+md5(_0x34cf3d[_0xc29f('0x81')]);}else{_0x34cf3d[_0xc29f('0x7f')]='';}var _0x1ff480=_0x46a7be[_0xc29f('0x7b')]===_0xc29f('0x83')?'eu':_0xc29f('0x84');return getAccessToken(_0x46a7be)[_0xc29f('0x28')](function(_0x472e07){_0x2b533a=_0x472e07;return getUser(_0x2b533a,_0x1ff480,_0x46a7be);})[_0xc29f('0x28')](function(_0x34d16f){_0x11cc18=_0x34d16f;logger[_0xc29f('0x2e')]('The\x20User\x20ID\x20is:',_0x11cc18['id']);return getEndUser(_0x2b533a,_0x1ff480,_0x46a7be,_0x34cf3d[_0xc29f('0x85')],_0x34cf3d['calleridnum'],_0x11cc18,_0x6a43d3);})['then'](function(_0x4512d1){_0xb2d44e=_0x4512d1;return getCall(_0x2b533a,_0x1ff480,_0x46a7be,_0x11cc18,_0xb2d44e,_0x6a43d3,_0x34cf3d,_0xc29f('0x86'));})[_0xc29f('0x28')](function(_0x4aa040){if(_0x4aa040){logger[_0xc29f('0x2e')](_0xc29f('0x87'),_0x4aa040['id']);}})[_0xc29f('0x2b')](function(_0x1edb3d){logger[_0xc29f('0x2c')]('['+_0x34cf3d[_0xc29f('0x66')]['toUpperCase']()+']',JSON['stringify'](_0x1edb3d));});}; \ No newline at end of file +var _0x2902=['merge','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','error','unmanaged','monitor_format','toUpperCase','calleridnum','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','Variable','toLowerCase','name','indexOf','isNil','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','add','expires_in','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','ActiveUsers','users','isArrayLikeObject','email','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','moduleCreate','Error:\x20','moduleSearch','contact_lead','uri','Contacts','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','starttime','mm:ss','lastevent','called','Called','complete','connect','Answered','rejected','abandoned','Call_Result','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Inbound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2902,0xc1));var _0x2290=function(_0x37cc52,_0x459a9b){_0x37cc52=_0x37cc52-0x0;var _0x2b4a90=_0x2902[_0x37cc52];return _0x2b4a90;};'use strict';var _=require(_0x2290('0x0'));var rp=require(_0x2290('0x1'));var md5=require(_0x2290('0x2'));var util=require(_0x2290('0x3'));var intUtil=require(_0x2290('0x4'));var moment=require(_0x2290('0x5'));var Redis=require(_0x2290('0x6'));var BPromise=require(_0x2290('0x7'));var config=require(_0x2290('0x8'));var logger=require(_0x2290('0x9'))(_0x2290('0xa'));config[_0x2290('0xb')]=_[_0x2290('0xc')](config[_0x2290('0xb')],{'host':_0x2290('0xd'),'port':0x18eb});var io=require(_0x2290('0xe'))(new Redis(config[_0x2290('0xb')]));function emit(_0x212d1a,_0x1144e6,_0x429cf5){io['to'](_0x212d1a)[_0x2290('0xf')](_0x1144e6,_0x429cf5);}function request(_0x5c2a99){logger[_0x2290('0x10')]('[HTTP]',JSON[_0x2290('0x11')](_0x5c2a99));return rp(_0x5c2a99);}function getCustomFields(_0xe08bec,_0x3ccf86){var _0xcf9bfc={};if(_0xe08bec[_0x2290('0x12')]>0x0){_[_0x2290('0x13')](_0xe08bec,function(_0x1ca369){if(_[_0x2290('0x14')]([_0x2290('0x15'),'picklist'],_0x1ca369[_0x2290('0x16')])&&_0x1ca369[_0x2290('0x17')]){_0xcf9bfc[_0x1ca369['idField']]=_0x1ca369[_0x2290('0x18')][_0x2290('0x19')]();}else if(_0x1ca369[_0x2290('0x16')]===_0x2290('0x1a')&&_0x1ca369[_0x2290('0x1b')]&&_0x1ca369[_0x2290('0x17')]&&_0x3ccf86[_0x1ca369[_0x2290('0x1b')]]){_0xcf9bfc[_0x1ca369[_0x2290('0x17')]]=_0x3ccf86[_0x1ca369[_0x2290('0x1b')]][_0x2290('0x19')]();}else if(_0x1ca369[_0x2290('0x16')]===_0x2290('0x1c')&&_0x1ca369['Variable']&&_0x1ca369[_0x2290('0x1d')]['name']&&_0x1ca369[_0x2290('0x17')]&&_0x3ccf86[_0x1ca369[_0x2290('0x1d')]['name'][_0x2290('0x1e')]()]){_0xcf9bfc[_0x1ca369['idField']]=_0x3ccf86[_0x1ca369['Variable'][_0x2290('0x1f')]['toLowerCase']()][_0x2290('0x19')]();}});}return _0xcf9bfc;}function getName(_0x133d0a){if(_0x133d0a[_0x2290('0x20')]('\x20')>0x0){var _0x38ea2a=_0x133d0a['split'](/ (.+)/);if(_0x38ea2a[0x1]){return _0x38ea2a;}}return[_0x133d0a,_0x133d0a];}var accountsTokens={};function getAccessToken(_0x165433){return new Promise(function(_0x33505a,_0x4f54f5){if(!_[_0x2290('0x21')](accountsTokens[_0x165433['id']])&&!_[_0x2290('0x21')](accountsTokens[_0x165433['id']][_0x2290('0x22')])){if(moment()['isBefore'](accountsTokens[_0x165433['id']]['expires_in'])){_0x33505a(accountsTokens[_0x165433['id']][_0x2290('0x22')]);}}var _0x5301ff;switch(_0x165433[_0x2290('0x23')]){case'US':_0x5301ff=_0x2290('0x24');break;case'AU':_0x5301ff=_0x2290('0x25');break;case'EU':_0x5301ff='https://accounts.zoho.eu';break;case'IN':_0x5301ff='https://accounts.zoho.in';break;case'CN':_0x5301ff=_0x2290('0x26');break;default:_0x5301ff=_0x2290('0x27');break;}var _0xbe9dfe={'method':'POST','uri':_0x5301ff+_0x2290('0x28'),'qs':{'refresh_token':_0x165433[_0x2290('0x29')],'client_id':_0x165433['clientId'],'client_secret':_0x165433[_0x2290('0x2a')],'grant_type':_0x2290('0x2b')},'json':!![]};return rp(_0xbe9dfe)[_0x2290('0x2c')](function(_0x7b09eb){accountsTokens[_0x165433['id']]={'access_token':_0x7b09eb['access_token'],'expires_in':moment()[_0x2290('0x2d')](_0x7b09eb[_0x2290('0x2e')],_0x2290('0x2f'))};_0x33505a(_0x7b09eb[_0x2290('0x22')]);})[_0x2290('0x30')](function(_0x2f5062){logger['error'](_0x2290('0x31'),_0x2f5062[_0x2290('0x32')]);_0x4f54f5(_0x2f5062);});});}function getUser(_0x2597f9,_0x21e2dd,_0x24d1ba,_0xa7fb0f){logger[_0x2290('0x33')]('Search\x20user');return request({'method':_0x2290('0x34'),'uri':util[_0x2290('0x35')]('https://www.zohoapis.%s/crm/v2/users',_0x21e2dd),'qs':{'type':_0x2290('0x36')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2597f9},'json':!![]})[_0x2290('0x2c')](function(_0x2687e6){if(_0x2687e6[_0x2290('0x37')]){var _0x3f9462=-0x1;if(_[_0x2290('0x38')](_0x2687e6[_0x2290('0x37')])){if(!_[_0x2290('0x21')](_0xa7fb0f)){_0x3f9462=_['findIndex'](_0x2687e6[_0x2290('0x37')],function(_0xc53217){return _0xc53217[_0x2290('0x39')]===_0xa7fb0f;});}if(_0x3f9462>=0x0){logger[_0x2290('0x33')]('Agent\x20found!');}else{logger['info'](_0x2290('0x3a'));_0x3f9462=_[_0x2290('0x3b')](_0x2687e6[_0x2290('0x37')],function(_0x43d69d){return _0x43d69d[_0x2290('0x3c')]['name']===_0x2290('0x3d');});}return _0x2687e6[_0x2290('0x37')][_0x3f9462];}else{if(_0x2687e6[_0x2290('0x3e')][_0x2290('0x3c')][_0x2290('0x1f')]==='Administrator'){logger[_0x2290('0x33')](_0x2290('0x3a'));user=_0x2687e6['user'];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x2687e6));throw new Error(_0x2290('0x3f')+JSON[_0x2290('0x11')](_0x2687e6));}}}else{logger['error'](_0x2290('0x40'),JSON[_0x2290('0x11')](_0x2687e6));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x2290('0x11')](_0x2687e6));}})[_0x2290('0x30')](function(_0x41eefe){console['error'](_0x41eefe);});}function getZohoUser(_0x39c59e,_0x42f223){return new BPromise(function(_0x38df51,_0x26fc98){request(_0x39c59e)[_0x2290('0x2c')](function(_0x2c7d36){var _0xdfadae=null;if(_0x2c7d36){_0xdfadae=_0x2c7d36[_0x2290('0x41')][0x0];_0xdfadae[_0x2290('0x42')]=_0x42f223;}_0x38df51(_0xdfadae);})['catch'](function(_0x399cc2){_0x26fc98(_0x399cc2);});});}function createEndUser(_0x306db2,_0x460768,_0x2ddf70,_0x52bbde,_0x3afa8a,_0x36a22b){var _0x2ddf70=getName(_0x2ddf70);return request({'method':_0x2290('0x43'),'uri':_0x2290('0x44')+_0x460768+_0x2290('0x45')+_[_0x2290('0x46')](_0x36a22b['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x2ddf70[0x1],'First_Name':_0x2ddf70[0x0],'Phone':_0x52bbde,'Owner':{'name':!_['isNil'](_0x3afa8a[_0x2290('0x47')]['name'])?_0x3afa8a[_0x2290('0x47')][_0x2290('0x1f')]:!_[_0x2290('0x21')](_0x3afa8a[_0x2290('0x48')])?_0x3afa8a[_0x2290('0x48')]+'\x20'+_0x3afa8a['last_name']:_0x3afa8a[_0x2290('0x49')],'id':_0x3afa8a['id']}}]},'headers':{'Authorization':_0x2290('0x4a')+_0x306db2},'json':!![]})[_0x2290('0x2c')](function(_0x4bb248){if(_0x4bb248&&_0x4bb248[_0x2290('0x41')][0x0][_0x2290('0x4b')]===_0x2290('0x4c')){var _0xcebd25=_0x4bb248['data'][0x0][_0x2290('0x4d')];_0xcebd25['enduserType']=_[_0x2290('0x46')](_0x36a22b[_0x2290('0x4e')])+'s';return _0xcebd25;}logger['error'](_0x2290('0x40'),JSON[_0x2290('0x11')](data));throw new Error(_0x2290('0x4f')+JSON['stringify'](data));})[_0x2290('0x30')](function(_0x32b951){console['log']('CREATE\x20ERROR',_0x32b951);});}function getEndUser(_0x13cb41,_0x47ef72,_0x406d64,_0x4f37c0,_0x219856,_0x4249fe,_0x91038){var _0x4e6fe8={'method':'GET','uri':'','headers':{'Authorization':_0x2290('0x4a')+_0x13cb41},'json':!![]};switch(_0x91038[_0x2290('0x50')]){case _0x2290('0x51'):_0x4e6fe8[_0x2290('0x52')]='https://www.zohoapis.'+_0x47ef72+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x219856+'))';return getZohoUser(_0x4e6fe8,_0x2290('0x53'))[_0x2290('0x2c')](function(_0x2f67a6){if(_0x2f67a6)return _0x2f67a6;_0x4e6fe8['uri']=_0x2290('0x44')+_0x47ef72+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x219856+'))';return getZohoUser(_0x4e6fe8,'Leads')[_0x2290('0x2c')](function(_0x350352){if(_0x350352)return _0x350352;if(_0x91038[_0x2290('0x4e')]!=_0x2290('0x54')){return createEndUser(_0x13cb41,_0x47ef72,_0x4f37c0,_0x219856,_0x4249fe,_0x91038);}else{return{};}});});break;case _0x2290('0x55'):_0x4e6fe8[_0x2290('0x52')]='https://www.zohoapis.'+_0x47ef72+_0x2290('0x56')+_0x219856+'))';return getZohoUser(_0x4e6fe8,'Contacts')['then'](function(_0x5d426c){if(_0x5d426c)return _0x5d426c;if(_0x91038[_0x2290('0x4e')]!=_0x2290('0x54')){return createEndUser(_0x13cb41,_0x47ef72,_0x4f37c0,_0x219856,_0x4249fe,_0x91038);}else{return{};}});break;case _0x2290('0x57'):_0x4e6fe8[_0x2290('0x52')]=_0x2290('0x44')+_0x47ef72+_0x2290('0x58')+_0x219856+'))';return getZohoUser(_0x4e6fe8,_0x2290('0x59'))[_0x2290('0x2c')](function(_0xacc004){if(_0xacc004)return _0xacc004;if(_0x91038['moduleCreate']!=_0x2290('0x54')){return createEndUser(_0x13cb41,_0x47ef72,_0x4f37c0,_0x219856,_0x4249fe,_0x91038);}else{return{};}});break;}}function getCall(_0x35bb1b,_0x34af89,_0x1ec51a,_0x9aa795,_0x24a880,_0x4ae7bf,_0x45d498,_0x575420){logger['info']('Creating\x20new\x20call...');var _0x542bfb={};_0x542bfb[_0x2290('0x5a')]={'name':!_[_0x2290('0x21')](_0x9aa795[_0x2290('0x47')][_0x2290('0x1f')])&&!_[_0x2290('0x21')](_0x9aa795['profile'][_0x2290('0x1f')])&&_0x9aa795[_0x2290('0x3c')][_0x2290('0x1f')]===_0x2290('0x5b')?_0x9aa795['role'][_0x2290('0x1f')]:!_[_0x2290('0x21')](_0x9aa795[_0x2290('0x48')])?_0x9aa795['first_name']+'\x20'+_0x9aa795[_0x2290('0x49')]:_0x9aa795[_0x2290('0x49')],'id':_0x9aa795['id']};_0x542bfb[_0x2290('0x5c')]=intUtil['getString'](_0x4ae7bf[_0x2290('0x5d')],_0x45d498,'\x20');_0x542bfb[_0x2290('0x5e')]=intUtil[_0x2290('0x5f')](_0x4ae7bf[_0x2290('0x60')],_0x45d498,'\x0a');if(_0x24a880[_0x2290('0x42')]===_0x2290('0x53')){_0x542bfb[_0x2290('0x61')]={'name':!_[_0x2290('0x21')](_0x24a880['Full_Name'])?_0x24a880[_0x2290('0x62')]:!_[_0x2290('0x21')](_0x24a880[_0x2290('0x63')])?_0x24a880[_0x2290('0x63')]+'\x20'+_0x24a880[_0x2290('0x64')]:_0x24a880[_0x2290('0x64')],'id':_0x24a880['id']};}if(_0x24a880['enduserType']===_0x2290('0x59')){_0x542bfb[_0x2290('0x65')]={'name':!_[_0x2290('0x21')](_0x24a880[_0x2290('0x62')])?_0x24a880[_0x2290('0x62')]:!_[_0x2290('0x21')](_0x24a880[_0x2290('0x63')])?_0x24a880[_0x2290('0x63')]+'\x20'+_0x24a880[_0x2290('0x64')]:_0x24a880[_0x2290('0x64')],'id':_0x24a880['id']};_0x542bfb[_0x2290('0x66')]=_[_0x2290('0x46')](_0x24a880[_0x2290('0x42')]);}if(_0x45d498[_0x2290('0x67')]){_0x542bfb['Call_Duration']=moment[_0x2290('0x68')](parseInt(_0x45d498[_0x2290('0x67')])*0x3e8)[_0x2290('0x35')]('mm:ss');}else if(_0x45d498['answertime']&&_0x45d498[_0x2290('0x69')]){_0x542bfb[_0x2290('0x6a')]=moment[_0x2290('0x68')](moment(_0x45d498[_0x2290('0x69')],_0x2290('0x6b'))['diff'](moment(_0x45d498[_0x2290('0x6c')],_0x2290('0x6b'))))['format'](_0x2290('0x6d'));}switch(_0x45d498[_0x2290('0x6e')]){case _0x2290('0x6f'):_0x542bfb['Call_Result']=_0x2290('0x70');break;case _0x2290('0x71'):case _0x2290('0x72'):_0x542bfb['Call_Result']=_0x2290('0x73');break;case _0x2290('0x74'):_0x542bfb['Call_Result']='Rejected';break;case _0x2290('0x75'):_0x542bfb[_0x2290('0x76')]=_0x2290('0x77');break;case _0x2290('0x78'):_0x542bfb['Call_Result']='Timeout';default:}_0x542bfb[_0x2290('0x79')]=(_0x575420===_0x2290('0x7a')?moment(_0x45d498[_0x2290('0x6c')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x45d498[_0x2290('0x7b')])[_0x2290('0x35')](_0x2290('0x6b')))||moment()['format'](_0x2290('0x6b'));_0x542bfb['Call_Type']=_0x575420||_0x2290('0x7c');_0x542bfb=_[_0x2290('0x7d')](_0x542bfb,getCustomFields(_0x4ae7bf['Fields'],_0x45d498));return request({'method':_0x2290('0x43'),'uri':_0x2290('0x44')+_0x34af89+_0x2290('0x7e'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x35bb1b},'body':{'data':[_0x542bfb]},'json':!![]})[_0x2290('0x2c')](function(_0x2455cf){if(_0x2455cf&&_0x2455cf[_0x2290('0x41')][0x0]['code']==='SUCCESS'){logger[_0x2290('0x33')](_0x2290('0x7f'));return{'id':_0x2455cf[_0x2290('0x41')][0x0][_0x2290('0x4d')]['id']};}})[_0x2290('0x30')](function(_0xb709cc){logger[_0x2290('0x33')](_0x2290('0x80'),_0xb709cc[_0x2290('0x32')]);console['log'](_0x2290('0x80'),_0xb709cc);});}exports[_0x2290('0x81')]=function(_0x28d05e,_0x30f372,_0x44eff1,_0x566d76,_0x2657be,_0x55bf85){var _0x26b2cc,_0x390881,_0x17e64f;_0x55bf85[_0x2290('0x82')]=intUtil[_0x2290('0x83')](_0x55bf85[_0x2290('0x82')]);_0x55bf85[_0x2290('0x84')]=intUtil[_0x2290('0x83')](_0x55bf85['serverUrl']);if(_0x2657be&&_0x2657be['monitor_format']){logger[_0x2290('0x33')](_0x2290('0x85'),_0x2290('0x86'));_0x30f372[_0x2290('0x87')]=_0x55bf85['serverUrl']+_0x2290('0x88')+_0x30f372[_0x2290('0x89')]+_0x2290('0x8a')+md5(_0x30f372['uniqueid']);}else{_0x30f372['recordingURL']='';}var _0x332434=_0x55bf85[_0x2290('0x82')]===_0x2290('0x8b')?'eu':_0x2290('0x8c');return getAccessToken(_0x55bf85)[_0x2290('0x2c')](function(_0x376ca4){_0x17e64f=_0x376ca4;return getUser(_0x17e64f,_0x332434,_0x55bf85,_0x566d76[_0x2290('0x39')]);})[_0x2290('0x2c')](function(_0x5a4b4c){_0x26b2cc=_0x5a4b4c;logger[_0x2290('0x33')](_0x2290('0x8d'),_0x26b2cc['id']);return getEndUser(_0x17e64f,_0x332434,_0x55bf85,_0x30f372[_0x2290('0x8e')],_0x30f372['calleridnum'],_0x26b2cc,_0x44eff1);})['then'](function(_0xca31a1){_0x390881=_0xca31a1;return getCall(_0x17e64f,_0x332434,_0x55bf85,_0x26b2cc,_0x390881,_0x44eff1,_0x30f372,_0x2290('0x7c'));})[_0x2290('0x2c')](function(_0x57f1e4){if(_0x57f1e4){logger['info'](_0x2290('0x8f'),_0x57f1e4['id']);logger[_0x2290('0x33')]('[QUEUE]',_0x2290('0x90'));emit(util[_0x2290('0x35')]('user:%s',_0x566d76[_0x2290('0x1f')]),_0x2290('0x91'),{'uri':_0x2290('0x92')+_0x55bf85['host']+_0x2290('0x93')+_0x57f1e4['id']});}})[_0x2290('0x30')](function(_0x442c1e){logger['error'](_0x2290('0x85'),JSON['stringify'](_0x442c1e));});};exports['outbound']=function(_0x5e0500,_0x115628,_0x540d12,_0x215dbd,_0x2a9edb,_0x3972a8,_0x54763d){var _0x5072f3,_0x1bd6ed,_0x288fb3;_0x3972a8[_0x2290('0x82')]=intUtil[_0x2290('0x83')](_0x3972a8['host']);_0x3972a8[_0x2290('0x84')]=intUtil[_0x2290('0x83')](_0x3972a8[_0x2290('0x84')]);if(_0x54763d&&_0x54763d[_0x2290('0x94')]&&_0x54763d[_0x2290('0x94')]!==_0x2290('0x95')){logger[_0x2290('0x33')]('[OUTBOUND]',_0x2290('0x86'));_0x115628['recordingURL']=_0x3972a8[_0x2290('0x84')]+_0x2290('0x88')+_0x115628[_0x2290('0x89')]+_0x2290('0x8a')+md5(_0x115628[_0x2290('0x89')]);}var _0x5ac931=_0x3972a8[_0x2290('0x82')]==='zoho.eu'?'eu':_0x2290('0x8c');return getAccessToken(_0x3972a8)['then'](function(_0x4d5e3d){_0x288fb3=_0x4d5e3d;return getUser(_0x288fb3,_0x5ac931,_0x3972a8,_0x215dbd[_0x2290('0x39')]);})['then'](function(_0x293a7e){_0x5072f3=_0x293a7e;logger[_0x2290('0x33')](_0x2290('0x8d'),_0x5072f3['id']);return getEndUser(_0x288fb3,_0x5ac931,_0x3972a8,_0x115628[_0x2290('0x96')],_0x115628[_0x2290('0x97')],_0x5072f3,_0x540d12);})[_0x2290('0x2c')](function(_0x20a5e3){_0x1bd6ed=_0x20a5e3;return getCall(_0x288fb3,_0x5ac931,_0x3972a8,_0x5072f3,_0x1bd6ed,_0x540d12,_0x115628,_0x2290('0x98'));})[_0x2290('0x2c')](function(_0x2b8901){if(_0x2b8901){logger['info']('The\x20Call\x20ID\x20is:',_0x2b8901['id']);logger[_0x2290('0x33')](_0x2290('0x99'),_0x2290('0x90'));emit(util[_0x2290('0x35')]('user:%s',_0x215dbd[_0x2290('0x1f')]),_0x2290('0x91'),{'uri':_0x2290('0x92')+_0x3972a8[_0x2290('0x82')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2b8901['id']});}})[_0x2290('0x30')](function(_0xc0754){logger[_0x2290('0x9a')](_0x2290('0x99'),JSON[_0x2290('0x11')](_0xc0754));});};exports[_0x2290('0x9b')]=function(_0x37594b,_0xc40ebb,_0x4b676d,_0x519032,_0x118a11,_0x2f9cf0){var _0x2e0b5d,_0x44c953,_0x3e4a7c;_0x2f9cf0['host']=intUtil[_0x2290('0x83')](_0x2f9cf0[_0x2290('0x82')]);_0x2f9cf0[_0x2290('0x84')]=intUtil[_0x2290('0x83')](_0x2f9cf0[_0x2290('0x84')]);if(_0x118a11&&_0x118a11[_0x2290('0x9c')]){logger['info']('['+_0xc40ebb[_0x2290('0x6e')][_0x2290('0x9d')]()+']',_0x2290('0x86'));_0xc40ebb[_0x2290('0x87')]=_0x2f9cf0[_0x2290('0x84')]+_0x2290('0x88')+_0xc40ebb[_0x2290('0x89')]+_0x2290('0x8a')+md5(_0xc40ebb[_0x2290('0x89')]);}else{_0xc40ebb[_0x2290('0x87')]='';}var _0x18d373=_0x2f9cf0['host']===_0x2290('0x8b')?'eu':'com';return getAccessToken(_0x2f9cf0)[_0x2290('0x2c')](function(_0x3aeec7){_0x3e4a7c=_0x3aeec7;return getUser(_0x3e4a7c,_0x18d373,_0x2f9cf0);})[_0x2290('0x2c')](function(_0xb73d77){_0x2e0b5d=_0xb73d77;logger['info'](_0x2290('0x8d'),_0x2e0b5d['id']);return getEndUser(_0x3e4a7c,_0x18d373,_0x2f9cf0,_0xc40ebb[_0x2290('0x8e')],_0xc40ebb[_0x2290('0x9e')],_0x2e0b5d,_0x4b676d);})[_0x2290('0x2c')](function(_0x156fd6){_0x44c953=_0x156fd6;return getCall(_0x3e4a7c,_0x18d373,_0x2f9cf0,_0x2e0b5d,_0x44c953,_0x4b676d,_0xc40ebb,_0x2290('0x7c'));})[_0x2290('0x2c')](function(_0x4a8cd9){if(_0x4a8cd9){logger[_0x2290('0x33')]('The\x20Call\x20ID\x20is:',_0x4a8cd9['id']);}})[_0x2290('0x30')](function(_0x5a1f20){logger[_0x2290('0x9a')]('['+_0xc40ebb[_0x2290('0x6e')][_0x2290('0x9d')]()+']',JSON[_0x2290('0x11')](_0x5a1f20));});}; \ 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 5189190..9ab655f 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 _0x7296=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0x328f43,_0x22767a){var _0x220f8c=function(_0x551505){while(--_0x551505){_0x328f43['push'](_0x328f43['shift']());}};_0x220f8c(++_0x22767a);}(_0x7296,0x1cf));var _0x6729=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x7296[_0xf48cce];return _0x2a5c38;};'use strict';var util=require(_0x6729('0x0'));var sh=require(_0x6729('0x1'));var Mustache=require(_0x6729('0x2'));var logger=require(_0x6729('0x3'))(_0x6729('0x4'));exports[_0x6729('0x5')]=function(_0x21ce1d,_0x30cc10){var _0x5e63cd=_0x21ce1d[_0x6729('0x6')]?_0x21ce1d[_0x6729('0x6')]:_0x6729('0x7');var _0x28f3d4=_0x21ce1d[_0x6729('0x8')]?Mustache['render'](_0x21ce1d['data3'],_0x30cc10):_0x30cc10;sh[_0x6729('0x5')](_0x28f3d4,function(_0x509d51,_0x37212f,_0x33eab9){if(_0x509d51!==0x0){logger[_0x6729('0x9')](util[_0x6729('0xa')](_0x6729('0xb'),_0x5e63cd,_0x28f3d4,_0x509d51,_0x33eab9));}else{logger[_0x6729('0xc')](util['format'](_0x6729('0xd'),_0x5e63cd,_0x28f3d4,_0x37212f));}});}; \ No newline at end of file +var _0x2842=['%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','error'];(function(_0x333bc5,_0x3968e9){var _0x409126=function(_0x4d28e8){while(--_0x4d28e8){_0x333bc5['push'](_0x333bc5['shift']());}};_0x409126(++_0x3968e9);}(_0x2842,0x85));var _0x2284=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x2842[_0x167cc1];return _0x10bc4b;};'use strict';var util=require(_0x2284('0x0'));var sh=require(_0x2284('0x1'));var Mustache=require(_0x2284('0x2'));var logger=require(_0x2284('0x3'))(_0x2284('0x4'));exports[_0x2284('0x5')]=function(_0x4b59d3,_0x4cf9ed){var _0x572640=_0x4b59d3[_0x2284('0x6')]?_0x4b59d3['data2']:_0x2284('0x7');var _0x1a18dd=_0x4b59d3['data3']?Mustache['render'](_0x4b59d3[_0x2284('0x8')],_0x4cf9ed):_0x4cf9ed;sh[_0x2284('0x5')](_0x1a18dd,function(_0x569556,_0x3e7b4c,_0x3cdff0){if(_0x569556!==0x0){logger[_0x2284('0x9')](util['format'](_0x2284('0xa'),_0x572640,_0x1a18dd,_0x569556,_0x3cdff0));}else{logger[_0x2284('0xb')](util[_0x2284('0xc')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x572640,_0x1a18dd,_0x3e7b4c));}});}; \ 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 53ed6cb..2f3a79a 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 _0x5509=['number','headers','data6','parse','stack','POST','PUT','data7','body','error','format','data2','stringify','isNil',',\x20request\x20body:\x20','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data5'];(function(_0x50c6fa,_0x2cc909){var _0x43e6e7=function(_0x28408c){while(--_0x28408c){_0x50c6fa['push'](_0x50c6fa['shift']());}};_0x43e6e7(++_0x2cc909);}(_0x5509,0x1d3));var _0x9550=function(_0x19545a,_0x48debb){_0x19545a=_0x19545a-0x0;var _0xee3687=_0x5509[_0x19545a];return _0xee3687;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x9550('0x0'));var Mustache=require(_0x9550('0x1'));var logger=require(_0x9550('0x2'))(_0x9550('0x3'));exports[_0x9550('0x4')]=function(_0x3e1fa6,_0x5b8898){var _0x2c08e6,_0x217e92;var _0x46e325={'method':_0x3e1fa6[_0x9550('0x5')][_0x9550('0x6')](),'uri':Mustache[_0x9550('0x7')](_0x3e1fa6['data2'],_0x5b8898),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3e1fa6[_0x9550('0x8')])===_0x9550('0x9')&&parseInt(_0x3e1fa6[_0x9550('0x8')])>=0x1&&parseInt(_0x3e1fa6['data5'])<=0xa?parseInt(_0x3e1fa6['data5'])*0x3e8:0x5*0x3e8};try{_0x46e325[_0x9550('0xa')]=_0x3e1fa6[_0x9550('0xb')]?JSON[_0x9550('0xc')](Mustache[_0x9550('0x7')](_0x3e1fa6['data6'],_0x5b8898)):{};}catch(_0x19aebd){logger['error'](_0x19aebd[_0x9550('0xd')]);}switch(_0x3e1fa6[_0x9550('0x5')][_0x9550('0x6')]()){case'GET':case'DELETE':_0x2c08e6=null;_0x46e325['qs']=_0x5b8898;break;case _0x9550('0xe'):case _0x9550('0xf'):if(_0x3e1fa6['data7']){try{_0x2c08e6=JSON[_0x9550('0xc')](Mustache[_0x9550('0x7')](_0x3e1fa6[_0x9550('0x10')],_0x5b8898));_0x46e325[_0x9550('0x11')]=_0x2c08e6;}catch(_0x1af31b){logger['error'](_0x1af31b['stack']);logger[_0x9550('0x12')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2c08e6=_0x5b8898;_0x46e325['body']=_0x2c08e6;}break;}logger['info'](util[_0x9550('0x13')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x3e1fa6[_0x9550('0x5')],_0x3e1fa6[_0x9550('0x14')],JSON[_0x9550('0x15')](_0x46e325)));rp(_0x46e325)['then'](function(_0x526913){_0x2c08e6=!_[_0x9550('0x16')](_0x2c08e6)?_0x9550('0x17')+_0x2c08e6:'';_0x217e92=typeof _0x526913['body']==='object'?JSON[_0x9550('0x15')](_0x526913[_0x9550('0x11')]):_0x526913[_0x9550('0x11')];logger[_0x9550('0x18')](util[_0x9550('0x13')](_0x9550('0x19'),_0x3e1fa6[_0x9550('0x5')],_0x3e1fa6[_0x9550('0x14')],_0x526913['statusCode'],_0x217e92));})['catch'](function(_0x33abb6){logger[_0x9550('0x12')](util[_0x9550('0x13')](_0x9550('0x1a'),_0x3e1fa6[_0x9550('0x5')],_0x3e1fa6[_0x9550('0x14')],_0x33abb6['statusCode'],_0x33abb6['name'],_0x33abb6[_0x9550('0x1b')]));});}; \ No newline at end of file +var _0x7972=['util','lodash','mustache','../../../../config/logger','exec','data1','toUpperCase','render','data2','data5','data6','error','stack','GET','POST','PUT','data7','parse','body','info','then',',\x20request\x20body:\x20','object','stringify','format','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise'];(function(_0x3aea25,_0x1fe848){var _0x2224dd=function(_0x20a278){while(--_0x20a278){_0x3aea25['push'](_0x3aea25['shift']());}};_0x2224dd(++_0x1fe848);}(_0x7972,0x173));var _0x2797=function(_0x5640db,_0xa1ae4){_0x5640db=_0x5640db-0x0;var _0x19835c=_0x7972[_0x5640db];return _0x19835c;};'use strict';var rp=require(_0x2797('0x0'));var util=require(_0x2797('0x1'));var _=require(_0x2797('0x2'));var Mustache=require(_0x2797('0x3'));var logger=require(_0x2797('0x4'))('trigger');exports[_0x2797('0x5')]=function(_0x27b6aa,_0x8c218b){var _0x18a985,_0x3cf86c;var _0x8b4f3a={'method':_0x27b6aa[_0x2797('0x6')][_0x2797('0x7')](),'uri':Mustache[_0x2797('0x8')](_0x27b6aa[_0x2797('0x9')],_0x8c218b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x27b6aa[_0x2797('0xa')])==='number'&&parseInt(_0x27b6aa['data5'])>=0x1&&parseInt(_0x27b6aa[_0x2797('0xa')])<=0xa?parseInt(_0x27b6aa[_0x2797('0xa')])*0x3e8:0x5*0x3e8};try{_0x8b4f3a['headers']=_0x27b6aa[_0x2797('0xb')]?JSON['parse'](Mustache[_0x2797('0x8')](_0x27b6aa[_0x2797('0xb')],_0x8c218b)):{};}catch(_0x1750b8){logger[_0x2797('0xc')](_0x1750b8[_0x2797('0xd')]);}switch(_0x27b6aa['data1'][_0x2797('0x7')]()){case _0x2797('0xe'):case'DELETE':_0x18a985=null;_0x8b4f3a['qs']=_0x8c218b;break;case _0x2797('0xf'):case _0x2797('0x10'):if(_0x27b6aa[_0x2797('0x11')]){try{_0x18a985=JSON[_0x2797('0x12')](Mustache[_0x2797('0x8')](_0x27b6aa[_0x2797('0x11')],_0x8c218b));_0x8b4f3a[_0x2797('0x13')]=_0x18a985;}catch(_0x4c4e7d){logger[_0x2797('0xc')](_0x4c4e7d[_0x2797('0xd')]);logger[_0x2797('0xc')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x18a985=_0x8c218b;_0x8b4f3a[_0x2797('0x13')]=_0x18a985;}break;}logger[_0x2797('0x14')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x27b6aa[_0x2797('0x6')],_0x27b6aa[_0x2797('0x9')],JSON['stringify'](_0x8b4f3a)));rp(_0x8b4f3a)[_0x2797('0x15')](function(_0x24c084){_0x18a985=!_['isNil'](_0x18a985)?_0x2797('0x16')+_0x18a985:'';_0x3cf86c=typeof _0x24c084[_0x2797('0x13')]===_0x2797('0x17')?JSON[_0x2797('0x18')](_0x24c084[_0x2797('0x13')]):_0x24c084['body'];logger['info'](util[_0x2797('0x19')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x27b6aa[_0x2797('0x6')],_0x27b6aa[_0x2797('0x9')],_0x24c084[_0x2797('0x1a')],_0x3cf86c));})[_0x2797('0x1b')](function(_0x3f2911){logger[_0x2797('0xc')](util[_0x2797('0x19')](_0x2797('0x1c'),_0x27b6aa[_0x2797('0x6')],_0x27b6aa['data2'],_0x3f2911[_0x2797('0x1a')],_0x3f2911[_0x2797('0x1d')],_0x3f2911[_0x2797('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index da2a677..02ee7c4 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 _0xdf83=['debug','rpc','routing','error','message','result','catch','jayson/promise','bluebird','../../config/logger','client'];(function(_0xb91441,_0x285e27){var _0x5cb8ac=function(_0x328739){while(--_0x328739){_0xb91441['push'](_0xb91441['shift']());}};_0x5cb8ac(++_0x285e27);}(_0xdf83,0x1ca));var _0x3df8=function(_0x7f4e44,_0x5b88e9){_0x7f4e44=_0x7f4e44-0x0;var _0x4235c8=_0xdf83[_0x7f4e44];return _0x4235c8;};'use strict';var jayson=require(_0x3df8('0x0'));var BPromise=require(_0x3df8('0x1'));var logger=require(_0x3df8('0x2'))('routing');var client=jayson[_0x3df8('0x3')]['http']({'port':0x2329});client['Request']=function(_0x2aa414,_0xa0c0c5){return new BPromise(function(_0x3dd15b,_0x554010){return client['request'](_0x2aa414,_0xa0c0c5)['then'](function(_0x540094){logger[_0x3df8('0x4')](_0x3df8('0x5'),_0x3df8('0x6'),_0x2aa414,_0xa0c0c5,_0x540094);if(_0x540094[_0x3df8('0x7')]){logger[_0x3df8('0x7')](_0x3df8('0x5'),'routing',_0x2aa414,_0x540094[_0x3df8('0x7')][_0x3df8('0x8')],_0xa0c0c5);return _0x554010(_0x540094[_0x3df8('0x7')]['message']);}else{return _0x3dd15b(_0x540094[_0x3df8('0x9')]);}})[_0x3df8('0xa')](function(_0xabc7d2){logger[_0x3df8('0x7')](_0x3df8('0x5'),_0x3df8('0x6'),_0x2aa414,_0xabc7d2,_0xa0c0c5);return _0x554010(_0xabc7d2);});});};module['exports']=client; \ No newline at end of file +var _0x6e34=['rpc','exports','bluebird','../../config/logger','client','http','Request','request','then','debug','error','routing','message','result'];(function(_0x49a4e3,_0x1cc52e){var _0x1e96be=function(_0x184bdd){while(--_0x184bdd){_0x49a4e3['push'](_0x49a4e3['shift']());}};_0x1e96be(++_0x1cc52e);}(_0x6e34,0xb8));var _0x46e3=function(_0x158a10,_0x2c629b){_0x158a10=_0x158a10-0x0;var _0x2a60fa=_0x6e34[_0x158a10];return _0x2a60fa;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x46e3('0x0'));var logger=require(_0x46e3('0x1'))('routing');var client=jayson[_0x46e3('0x2')][_0x46e3('0x3')]({'port':0x2329});client[_0x46e3('0x4')]=function(_0x539aa1,_0x323e2c){return new BPromise(function(_0x27d5ad,_0x32f52e){return client[_0x46e3('0x5')](_0x539aa1,_0x323e2c)[_0x46e3('0x6')](function(_0x4b4fe6){logger[_0x46e3('0x7')]('rpc','routing',_0x539aa1,_0x323e2c,_0x4b4fe6);if(_0x4b4fe6[_0x46e3('0x8')]){logger[_0x46e3('0x8')]('rpc',_0x46e3('0x9'),_0x539aa1,_0x4b4fe6[_0x46e3('0x8')][_0x46e3('0xa')],_0x323e2c);return _0x32f52e(_0x4b4fe6[_0x46e3('0x8')][_0x46e3('0xa')]);}else{return _0x27d5ad(_0x4b4fe6[_0x46e3('0xb')]);}})['catch'](function(_0x3fc6ec){logger[_0x46e3('0x8')](_0x46e3('0xc'),_0x46e3('0x9'),_0x539aa1,_0x3fc6ec,_0x323e2c);return _0x32f52e(_0x3fc6ec);});});};module[_0x46e3('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 1daf605..0b1db6b 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 _0x8976=['./rpc/setting','then','getMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','log','bluebird','./realtime','./lib/email'];(function(_0x3d84e9,_0x74d483){var _0x11a630=function(_0x4b72d8){while(--_0x4b72d8){_0x3d84e9['push'](_0x3d84e9['shift']());}};_0x11a630(++_0x74d483);}(_0x8976,0x1e9));var _0x6897=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8976[_0x2641f9];return _0x585741;};'use strict';var BPromise=require(_0x6897('0x0'));var server=require('./server');var Realtime=require(_0x6897('0x1'));var EmailChannel=require(_0x6897('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x6897('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0x6897('0x4')](mailAccount[_0x6897('0x5')]())[_0x6897('0x4')](realtime['initMailAccounts']())[_0x6897('0x4')](function(){email[_0x6897('0x6')](realtime[_0x6897('0x7')]);return realtime;});}function main(){return server[_0x6897('0x8')](realtime,email)[_0x6897('0x4')](function(){return initRealtime();})[_0x6897('0x4')](function(){return setting[_0x6897('0x9')]();})[_0x6897('0x4')](function(_0x562fa3){return setInterval(initRealtime,_0x562fa3[_0x6897('0xa')]*0x3e8);})['catch'](function(_0x2c2930){console[_0x6897('0xb')](_0x2c2930);});}main(); \ No newline at end of file +var _0x111c=['./rpc/setting','resolve','then','getMailAccounts','initMailAccounts','refresh','getSettings','loginMailFrequency','catch','log','./realtime'];(function(_0x492166,_0x13e62c){var _0x5e20e0=function(_0xcfd551){while(--_0xcfd551){_0x492166['push'](_0x492166['shift']());}};_0x5e20e0(++_0x13e62c);}(_0x111c,0x11d));var _0xc111=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x111c[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0xc111('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require(_0xc111('0x1'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xc111('0x2')]()[_0xc111('0x3')](mailAccount[_0xc111('0x4')]())[_0xc111('0x3')](realtime[_0xc111('0x5')]())[_0xc111('0x3')](function(){email[_0xc111('0x6')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0xc111('0x3')](function(){return setting[_0xc111('0x7')]();})[_0xc111('0x3')](function(_0x8a915){return setInterval(initRealtime,_0x8a915[_0xc111('0x8')]*0x3e8);})[_0xc111('0x9')](function(_0x314c06){console[_0xc111('0xa')](_0x314c06);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index c267ec0..ccf5c1d 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 _0x83c8=['../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','emit','key','active','Imap','total','md5','mailAccount:update','prototype','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','status','disabled','messageStatus','connected','name','messages','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','handleImapError','send','verifySmtp','isNil','Smtp','verify','verified','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./smtp'];(function(_0x21bf49,_0x15eeef){var _0x365754=function(_0x55e337){while(--_0x55e337){_0x21bf49['push'](_0x21bf49['shift']());}};_0x365754(++_0x15eeef);}(_0x83c8,0x1e4));var _0x883c=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0x83c8[_0x1f7839];return _0x36b42e;};'use strict';var _=require(_0x883c('0x0'));var moment=require(_0x883c('0x1'));var BPromise=require(_0x883c('0x2'));var md5=require('md5');var Redis=require(_0x883c('0x3'));var config=require(_0x883c('0x4'));var logger=require(_0x883c('0x5'))(_0x883c('0x6'));config[_0x883c('0x7')]=_['defaults'](config[_0x883c('0x7')],{'host':_0x883c('0x8'),'port':0x18eb});var io=require(_0x883c('0x9'))(new Redis(config[_0x883c('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x883c('0xa'));var mailAccount=require(_0x883c('0xb'));var md5Accounts={};function EmailChannel(_0x6d9392){logger[_0x883c('0xc')]('start\x20email\x20channel');this[_0x883c('0xd')]=_0x6d9392['mailAccounts'];this[_0x883c('0xe')]={};this[_0x883c('0xf')]=new EmailSmtp();}EmailChannel['prototype'][_0x883c('0x10')]=function(_0x2acac9){var _0x4b5520=this[_0x883c('0xd')][_0x2acac9];var _0x4b895a={'id':_0x4b5520['id'],'name':_0x4b5520['name'],'key':_0x4b5520[_0x883c('0x11')],'active':_0x4b5520[_0x883c('0x12')],'Imap':{'status':_0x4b5520[_0x883c('0x13')]['status'],'messageStatus':_0x4b5520[_0x883c('0x13')]['messageStatus'],'total':_0x4b5520['Imap'][_0x883c('0x14')]}};if(_['isNil'](md5Accounts[_0x2acac9])){md5Accounts[_0x2acac9]={};}var _0x33ec3e=md5(JSON['stringify'](_0x4b895a));if(md5Accounts[_0x2acac9]['md5']!==_0x33ec3e){md5Accounts[_0x2acac9][_0x883c('0x15')]=_0x33ec3e;io['emit'](_0x883c('0x16'),_0x4b895a);}};EmailChannel[_0x883c('0x17')]['refresh']=function(_0x2ab2ac){for(var _0x4ae51a in _0x2ab2ac){if(_0x2ab2ac['hasOwnProperty'](_0x4ae51a)){if(_0x2ab2ac[_0x4ae51a]['Imap']&&_0x2ab2ac[_0x4ae51a][_0x883c('0x12')]){var _0x3b3461=_0x2ab2ac[_0x4ae51a][_0x883c('0x13')];if(!this[_0x883c('0xe')][_0x883c('0x18')](_0x3b3461['id'])){this[_0x883c('0xe')][_0x3b3461['id']]=new EmailImap(_0x3b3461,_0x2ab2ac[_0x4ae51a]['email']);this[_0x883c('0xe')][_0x3b3461['id']]['on'](_0x883c('0x19'),this[_0x883c('0x1a')][_0x883c('0x1b')](this,_0x4ae51a));this[_0x883c('0xe')][_0x3b3461['id']]['on'](_0x883c('0x6'),this[_0x883c('0x1c')]['bind'](this,_0x4ae51a));this[_0x883c('0xe')][_0x3b3461['id']]['on'](_0x883c('0x1d'),this[_0x883c('0x1e')][_0x883c('0x1b')](this,_0x4ae51a));this['imapAccounts'][_0x3b3461['id']]['on'](_0x883c('0x1f'),this['handleImapError']['bind'](this,_0x4ae51a));}}else{if(_['isNil'](this['mailAccounts'][_0x4ae51a][_0x883c('0x13')])){this[_0x883c('0xd')][_0x4ae51a][_0x883c('0x13')]={};}this[_0x883c('0xd')][_0x4ae51a]['Imap'][_0x883c('0x20')]=_0x883c('0x21');this[_0x883c('0xd')][_0x4ae51a][_0x883c('0x13')][_0x883c('0x22')]='';this['emit'](_0x4ae51a);}}}};EmailChannel['prototype'][_0x883c('0x1a')]=function(_0x425d0d,_0x508df0){if(this[_0x883c('0xd')][_0x425d0d]){this['mailAccounts'][_0x425d0d]['Imap'][_0x883c('0x20')]=_0x883c('0x23');this['mailAccounts'][_0x425d0d][_0x883c('0x13')][_0x883c('0x22')]=_0x508df0[_0x883c('0x24')];if(_0x508df0[_0x883c('0x25')]){this[_0x883c('0xd')][_0x425d0d]['Imap'][_0x883c('0x14')]=_0x508df0[_0x883c('0x25')][_0x883c('0x14')];}return this[_0x883c('0x10')](_0x425d0d);}};EmailChannel[_0x883c('0x17')][_0x883c('0x1c')]=function(_0x4100b0,_0x348047){logger[_0x883c('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x348047[_0x883c('0x26')],_0x348047[_0x883c('0x27')],_0x348047['from'],_0x4100b0);if(this['mailAccounts'][_0x4100b0]){return mailAccount[_0x883c('0x28')](_0x4100b0,_0x348047)[_0x883c('0x29')](function(_0x2486b2){if(_0x2486b2){logger[_0x883c('0xc')](_0x883c('0x2a'));}})[_0x883c('0x2b')](function(_0x305983){logger['error'](_0x883c('0x2c'),JSON[_0x883c('0x2d')](_0x305983));});}};EmailChannel[_0x883c('0x17')]['handleImapEnd']=function(_0x40e23f){if(this['mailAccounts'][_0x40e23f]&&this['mailAccounts'][_0x40e23f][_0x883c('0x13')]){if(this[_0x883c('0xe')][this['mailAccounts'][_0x40e23f][_0x883c('0x13')]['id']]){delete this[_0x883c('0xe')][this[_0x883c('0xd')][_0x40e23f]['Imap']['id']];}this[_0x883c('0xd')][_0x40e23f][_0x883c('0x13')][_0x883c('0x2e')]=moment();this['emit'](_0x40e23f);}};EmailChannel['prototype'][_0x883c('0x2f')]=function(_0x165720,_0x15baae){if(this['mailAccounts'][_0x165720]){this['mailAccounts'][_0x165720][_0x883c('0x13')][_0x883c('0x20')]=_0x883c('0x1f');this['mailAccounts'][_0x165720][_0x883c('0x13')][_0x883c('0x22')]=_0x15baae;return this[_0x883c('0x10')](_0x165720);}};EmailChannel[_0x883c('0x17')]['sendMail']=function(_0x3e282f,_0x543060){return this[_0x883c('0xf')][_0x883c('0x30')](_0x3e282f,_0x543060);};EmailChannel['prototype'][_0x883c('0x31')]=function(_0x6c8062){var _0x968e59=this;if(this['mailAccounts'][_0x6c8062['id']]){if(_[_0x883c('0x32')](this[_0x883c('0xd')][_0x6c8062['id']][_0x883c('0x33')])){this[_0x883c('0xd')][_0x6c8062['id']][_0x883c('0x33')]={};}this[_0x883c('0xd')][_0x6c8062['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x40eedc,_0x4c230c){return _0x968e59['smtp'][_0x883c('0x34')](_0x6c8062)['then'](function(_0x1aa63f){_0x968e59[_0x883c('0xd')][_0x6c8062['id']][_0x883c('0x33')][_0x883c('0x20')]=_0x883c('0x35');_0x968e59[_0x883c('0xd')][_0x6c8062['id']][_0x883c('0x33')]['messageStatus']='';_0x968e59[_0x883c('0x10')](_0x6c8062['id']);_0x40eedc(_0x1aa63f);})['catch'](function(_0xc86160){_0x968e59[_0x883c('0xd')][_0x6c8062['id']]['Smtp'][_0x883c('0x20')]=_0x883c('0x1f');_0x968e59[_0x883c('0xd')][_0x6c8062['id']][_0x883c('0x33')][_0x883c('0x22')]=_0xc86160;_0x968e59[_0x883c('0x10')](_0x6c8062['id']);_0x4c230c(_0xc86160);});});}return this['smtp'][_0x883c('0x34')](_0x6c8062);};module[_0x883c('0x36')]=EmailChannel; \ No newline at end of file +var _0xc623=['handleImapEnd','handleImapError','status','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','lastSync','send','verify','Smtp','verified','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','defaults','redis','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name','key','active','Imap','messageStatus','total','isNil','stringify','emit','mailAccount:update','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc623,0x193));var _0x3c62=function(_0x1cb3d5,_0x2072bf){_0x1cb3d5=_0x1cb3d5-0x0;var _0x51e9cb=_0xc623[_0x1cb3d5];return _0x51e9cb;};'use strict';var _=require(_0x3c62('0x0'));var moment=require(_0x3c62('0x1'));var BPromise=require(_0x3c62('0x2'));var md5=require(_0x3c62('0x3'));var Redis=require(_0x3c62('0x4'));var config=require(_0x3c62('0x5'));var logger=require(_0x3c62('0x6'))(_0x3c62('0x7'));config['redis']=_[_0x3c62('0x8')](config[_0x3c62('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x3c62('0xa'))(new Redis(config[_0x3c62('0x9')]));var EmailImap=require(_0x3c62('0xb'));var EmailSmtp=require(_0x3c62('0xc'));var mailAccount=require(_0x3c62('0xd'));var md5Accounts={};function EmailChannel(_0x311ab6){logger[_0x3c62('0xe')](_0x3c62('0xf'));this[_0x3c62('0x10')]=_0x311ab6[_0x3c62('0x10')];this[_0x3c62('0x11')]={};this[_0x3c62('0x12')]=new EmailSmtp();}EmailChannel[_0x3c62('0x13')]['emit']=function(_0x147813){var _0xe9ad99=this[_0x3c62('0x10')][_0x147813];var _0x50a02b={'id':_0xe9ad99['id'],'name':_0xe9ad99[_0x3c62('0x14')],'key':_0xe9ad99[_0x3c62('0x15')],'active':_0xe9ad99[_0x3c62('0x16')],'Imap':{'status':_0xe9ad99[_0x3c62('0x17')]['status'],'messageStatus':_0xe9ad99[_0x3c62('0x17')][_0x3c62('0x18')],'total':_0xe9ad99['Imap'][_0x3c62('0x19')]}};if(_[_0x3c62('0x1a')](md5Accounts[_0x147813])){md5Accounts[_0x147813]={};}var _0x3abbf3=md5(JSON[_0x3c62('0x1b')](_0x50a02b));if(md5Accounts[_0x147813][_0x3c62('0x3')]!==_0x3abbf3){md5Accounts[_0x147813][_0x3c62('0x3')]=_0x3abbf3;io[_0x3c62('0x1c')](_0x3c62('0x1d'),_0x50a02b);}};EmailChannel['prototype'][_0x3c62('0x1e')]=function(_0x320a72){for(var _0x2ca3cf in _0x320a72){if(_0x320a72[_0x3c62('0x1f')](_0x2ca3cf)){if(_0x320a72[_0x2ca3cf][_0x3c62('0x17')]&&_0x320a72[_0x2ca3cf][_0x3c62('0x16')]){var _0x676ce9=_0x320a72[_0x2ca3cf][_0x3c62('0x17')];if(!this[_0x3c62('0x11')][_0x3c62('0x1f')](_0x676ce9['id'])){this[_0x3c62('0x11')][_0x676ce9['id']]=new EmailImap(_0x676ce9,_0x320a72[_0x2ca3cf][_0x3c62('0x7')]);this['imapAccounts'][_0x676ce9['id']]['on'](_0x3c62('0x20'),this[_0x3c62('0x21')][_0x3c62('0x22')](this,_0x2ca3cf));this[_0x3c62('0x11')][_0x676ce9['id']]['on'](_0x3c62('0x7'),this[_0x3c62('0x23')][_0x3c62('0x22')](this,_0x2ca3cf));this['imapAccounts'][_0x676ce9['id']]['on'](_0x3c62('0x24'),this[_0x3c62('0x25')]['bind'](this,_0x2ca3cf));this[_0x3c62('0x11')][_0x676ce9['id']]['on']('error',this[_0x3c62('0x26')]['bind'](this,_0x2ca3cf));}}else{if(_[_0x3c62('0x1a')](this[_0x3c62('0x10')][_0x2ca3cf][_0x3c62('0x17')])){this[_0x3c62('0x10')][_0x2ca3cf][_0x3c62('0x17')]={};}this['mailAccounts'][_0x2ca3cf][_0x3c62('0x17')]['status']='disabled';this[_0x3c62('0x10')][_0x2ca3cf][_0x3c62('0x17')][_0x3c62('0x18')]='';this[_0x3c62('0x1c')](_0x2ca3cf);}}}};EmailChannel[_0x3c62('0x13')][_0x3c62('0x21')]=function(_0x29da93,_0x44830d){if(this[_0x3c62('0x10')][_0x29da93]){this['mailAccounts'][_0x29da93][_0x3c62('0x17')][_0x3c62('0x27')]=_0x3c62('0x28');this['mailAccounts'][_0x29da93][_0x3c62('0x17')]['messageStatus']=_0x44830d['name'];if(_0x44830d['messages']){this[_0x3c62('0x10')][_0x29da93][_0x3c62('0x17')][_0x3c62('0x19')]=_0x44830d[_0x3c62('0x29')]['total'];}return this[_0x3c62('0x1c')](_0x29da93);}};EmailChannel['prototype'][_0x3c62('0x23')]=function(_0x5a673e,_0x3000fb){logger[_0x3c62('0xe')](_0x3c62('0x2a'),_0x3000fb[_0x3c62('0x2b')],_0x3000fb[_0x3c62('0x2c')],_0x3000fb['from'],_0x5a673e);if(this[_0x3c62('0x10')][_0x5a673e]){return mailAccount[_0x3c62('0x2d')](_0x5a673e,_0x3000fb)[_0x3c62('0x2e')](function(_0x4684ef){if(_0x4684ef){logger['info'](_0x3c62('0x2f'));}})[_0x3c62('0x30')](function(_0xb468c2){logger[_0x3c62('0x31')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x3c62('0x1b')](_0xb468c2));});}};EmailChannel[_0x3c62('0x13')][_0x3c62('0x25')]=function(_0x2ed30d){if(this[_0x3c62('0x10')][_0x2ed30d]&&this[_0x3c62('0x10')][_0x2ed30d][_0x3c62('0x17')]){if(this['imapAccounts'][this[_0x3c62('0x10')][_0x2ed30d][_0x3c62('0x17')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x2ed30d][_0x3c62('0x17')]['id']];}this['mailAccounts'][_0x2ed30d][_0x3c62('0x17')][_0x3c62('0x32')]=moment();this[_0x3c62('0x1c')](_0x2ed30d);}};EmailChannel[_0x3c62('0x13')][_0x3c62('0x26')]=function(_0x56b993,_0x8195e3){if(this['mailAccounts'][_0x56b993]){this[_0x3c62('0x10')][_0x56b993][_0x3c62('0x17')][_0x3c62('0x27')]=_0x3c62('0x31');this[_0x3c62('0x10')][_0x56b993][_0x3c62('0x17')]['messageStatus']=_0x8195e3;return this[_0x3c62('0x1c')](_0x56b993);}};EmailChannel[_0x3c62('0x13')]['sendMail']=function(_0xb6c571,_0x2ef413){return this[_0x3c62('0x12')][_0x3c62('0x33')](_0xb6c571,_0x2ef413);};EmailChannel[_0x3c62('0x13')]['verifySmtp']=function(_0x132dbf){var _0x48c9a8=this;if(this['mailAccounts'][_0x132dbf['id']]){if(_[_0x3c62('0x1a')](this['mailAccounts'][_0x132dbf['id']]['Smtp'])){this[_0x3c62('0x10')][_0x132dbf['id']]['Smtp']={};}this[_0x3c62('0x10')][_0x132dbf['id']]['Smtp'][_0x3c62('0x32')]=moment();return new BPromise(function(_0x1a7c2a,_0x7bf02){return _0x48c9a8['smtp'][_0x3c62('0x34')](_0x132dbf)[_0x3c62('0x2e')](function(_0x333adb){_0x48c9a8[_0x3c62('0x10')][_0x132dbf['id']][_0x3c62('0x35')][_0x3c62('0x27')]=_0x3c62('0x36');_0x48c9a8[_0x3c62('0x10')][_0x132dbf['id']]['Smtp'][_0x3c62('0x18')]='';_0x48c9a8[_0x3c62('0x1c')](_0x132dbf['id']);_0x1a7c2a(_0x333adb);})['catch'](function(_0x379381){_0x48c9a8[_0x3c62('0x10')][_0x132dbf['id']][_0x3c62('0x35')][_0x3c62('0x27')]=_0x3c62('0x31');_0x48c9a8[_0x3c62('0x10')][_0x132dbf['id']][_0x3c62('0x35')][_0x3c62('0x18')]=_0x379381;_0x48c9a8[_0x3c62('0x1c')](_0x132dbf['id']);_0x7bf02(_0x379381);});});}return this['smtp'][_0x3c62('0x34')](_0x132dbf);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 9ed5125..97a729d 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 _0x6a27=['required','getHost','email','anonymous@xcally.com','openBox','handleOpenBox','box','readUnseen','handleCloseBox','handleError','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchEnd','closeBox','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','lodash','randomstring','mailparser','iconv','Iconv','events','./utils','../../../config/logger','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','user','password','host','port','tls'];(function(_0x31158d,_0x1b8db6){var _0x536df7=function(_0x3c0c5f){while(--_0x3c0c5f){_0x31158d['push'](_0x31158d['shift']());}};_0x536df7(++_0x1b8db6);}(_0x6a27,0x152));var _0x76a2=function(_0x42a9cb,_0x8966ee){_0x42a9cb=_0x42a9cb-0x0;var _0x5efe3a=_0x6a27[_0x42a9cb];return _0x5efe3a;};'use strict';var fs=require('fs');var path=require(_0x76a2('0x0'));var util=require(_0x76a2('0x1'));var Imap=require(_0x76a2('0x2'));var _=require(_0x76a2('0x3'));var rs=require(_0x76a2('0x4'));var simpleParser=require(_0x76a2('0x5'))['simpleParser'];var Iconv=require(_0x76a2('0x6'))[_0x76a2('0x7')];var EventEmitter=require(_0x76a2('0x8'))['EventEmitter'];var utils=require(_0x76a2('0x9'));var logger=require(_0x76a2('0xa'))('email');function EmailImap(_0x44753c,_0x34225c){this[_0x76a2('0xb')]=_0x76a2('0xc');this[_0x76a2('0xd')]=this[_0x76a2('0xe')](_0x44753c,_0x34225c);this['imap']=new Imap(this[_0x76a2('0xd')]);this[_0x76a2('0x2')][_0x76a2('0xf')](_0x76a2('0x10'),this[_0x76a2('0x11')][_0x76a2('0x12')](this));this[_0x76a2('0x2')][_0x76a2('0xf')](_0x76a2('0x13'),this[_0x76a2('0x14')][_0x76a2('0x12')](this));this[_0x76a2('0x2')]['on'](_0x76a2('0x15'),this['handleError'][_0x76a2('0x12')](this));this['imap'][_0x76a2('0x16')]();}util[_0x76a2('0x17')](EmailImap,EventEmitter);EmailImap[_0x76a2('0x18')][_0x76a2('0xe')]=function(_0x5d73bd,_0x5a1ebb){var _0x38dced={'connTimeout':_0x5d73bd['connTimeout']?_0x5d73bd[_0x76a2('0x19')]*0x3e8:0x2710,'authTimeout':_0x5d73bd[_0x76a2('0x1a')]?_0x5d73bd[_0x76a2('0x1a')]*0x3e8:0x1388};if(_[_0x76a2('0x1b')](_0x5d73bd[_0x76a2('0x1c')])){if(_0x5d73bd['authentication']){_0x38dced[_0x76a2('0x1d')]=_0x5d73bd[_0x76a2('0x1d')];_0x38dced[_0x76a2('0x1e')]=_0x5d73bd[_0x76a2('0x1e')];}_0x38dced[_0x76a2('0x1f')]=_0x5d73bd[_0x76a2('0x1f')];_0x38dced['port']=_0x5d73bd[_0x76a2('0x20')]||0x3e1;if(_0x5d73bd[_0x76a2('0x21')]){_0x38dced[_0x76a2('0x21')]=!![];}else{_0x38dced['tls']=![];_0x38dced['autotls']=_0x76a2('0x22');}}else{_0x38dced[_0x76a2('0x1d')]=_0x5d73bd['user'];_0x38dced[_0x76a2('0x1e')]=_0x5d73bd['password'];_0x38dced[_0x76a2('0x1f')]=utils[_0x76a2('0x23')](_0x5d73bd[_0x76a2('0x1c')]);_0x38dced[_0x76a2('0x20')]=0x3e1;_0x38dced[_0x76a2('0x21')]=!![];}_0x38dced[_0x76a2('0x24')]=_0x5a1ebb||_0x5d73bd['user']||_0x76a2('0x25');return _0x38dced;};EmailImap[_0x76a2('0x18')][_0x76a2('0x11')]=function(){this[_0x76a2('0x2')][_0x76a2('0x26')](this[_0x76a2('0xb')],![],this[_0x76a2('0x27')][_0x76a2('0x12')](this));};EmailImap[_0x76a2('0x18')]['handleOpenBox']=function(_0x2f6af4,_0x135a6a){if(_0x2f6af4){this['handleError'](_0x2f6af4,!![]);}else{this['emit'](_0x76a2('0x28'),_0x135a6a);this[_0x76a2('0x29')]();}};EmailImap[_0x76a2('0x18')][_0x76a2('0x2a')]=function(_0x36911e){if(_0x36911e){this[_0x76a2('0x2b')](_0x36911e,!![]);}else{this[_0x76a2('0x2')]['end']();}};EmailImap['prototype'][_0x76a2('0x29')]=function(){this[_0x76a2('0x2')]['search']([_0x76a2('0x2c')],this[_0x76a2('0x2d')][_0x76a2('0x12')](this));};EmailImap[_0x76a2('0x18')][_0x76a2('0x2d')]=function(_0x3b35bf,_0x2ab023){if(_0x3b35bf){this[_0x76a2('0x2b')](_0x3b35bf,!![]);}else{if(_0x2ab023[_0x76a2('0x2e')]){try{var _0x4c4e8d=this[_0x76a2('0x2')][_0x76a2('0x2f')](_0x2ab023,{'bodies':'','markSeen':!![]});_0x4c4e8d['on']('message',this[_0x76a2('0x30')][_0x76a2('0x12')](this));_0x4c4e8d[_0x76a2('0xf')](_0x76a2('0x15'),this['handleFetchError'][_0x76a2('0x12')](this));_0x4c4e8d[_0x76a2('0xf')](_0x76a2('0x13'),this[_0x76a2('0x31')]['bind'](this));}catch(_0x3b46c1){logger['error'](_0x3b46c1);}}else{this[_0x76a2('0x2')][_0x76a2('0x32')](!![],this[_0x76a2('0x2a')][_0x76a2('0x12')](this));}}};EmailImap['prototype'][_0x76a2('0x30')]=function(_0x2b838a,_0x224c1a){_0x2b838a['on']('body',this[_0x76a2('0x33')][_0x76a2('0x12')](this));_0x2b838a['once']('attributes',this[_0x76a2('0x34')][_0x76a2('0x12')](this));_0x2b838a[_0x76a2('0xf')](_0x76a2('0x13'),this[_0x76a2('0x35')][_0x76a2('0x12')](this));};EmailImap['prototype'][_0x76a2('0x33')]=function(_0x489aea,_0x4b19c4){simpleParser(_0x489aea,{'Iconv':Iconv},this[_0x76a2('0x36')]['bind'](this));};EmailImap[_0x76a2('0x18')][_0x76a2('0x34')]=function(_0x27c6ec){};EmailImap[_0x76a2('0x18')][_0x76a2('0x35')]=function(){};EmailImap[_0x76a2('0x18')][_0x76a2('0x36')]=function(_0x3cefb3,_0x4dcbe6){if(_0x3cefb3){logger[_0x76a2('0x15')](_0x3cefb3);}else{var _0x121e26=this;utils[_0x76a2('0x37')](this[_0x76a2('0xd')],_0x4dcbe6,function(_0x2c2d37){_0x121e26[_0x76a2('0x38')](_0x76a2('0x24'),_0x2c2d37);});}};EmailImap[_0x76a2('0x18')][_0x76a2('0x31')]=function(){this[_0x76a2('0x2')]['closeBox'](!![],this[_0x76a2('0x2a')]['bind'](this));};EmailImap[_0x76a2('0x18')]['handleFetchError']=function(_0x3a9d5e){this[_0x76a2('0x2b')](_0x3a9d5e);this[_0x76a2('0x2')][_0x76a2('0x32')](!![],this['handleCloseBox'][_0x76a2('0x12')](this));};EmailImap[_0x76a2('0x18')][_0x76a2('0x14')]=function(){this[_0x76a2('0x38')](_0x76a2('0x13'));};EmailImap[_0x76a2('0x18')][_0x76a2('0x2b')]=function(_0x53c314,_0x4d8ed6){logger[_0x76a2('0x15')]('handleError',this[_0x76a2('0xd')][_0x76a2('0x24')],JSON[_0x76a2('0x39')](_0x53c314));var _0x5ccecd='';if(_0x53c314){if(_0x53c314['textCode']){_0x5ccecd=_0x53c314[_0x76a2('0x3a')];}else{for(var _0x4ad4d1 in _0x53c314){if(_0x53c314[_0x76a2('0x3b')](_0x4ad4d1)){_0x5ccecd+=_[_0x76a2('0x3c')](_0x4ad4d1)+':\x20'+_0x53c314[_0x4ad4d1]+'\x0a';}}}}if(_0x4d8ed6){this[_0x76a2('0x2')][_0x76a2('0x13')]();}else{this[_0x76a2('0x38')](_0x76a2('0x15'),_0x5ccecd);this[_0x76a2('0x38')](_0x76a2('0x13'));}};module[_0x76a2('0x3d')]=EmailImap; \ No newline at end of file +var _0xe8f8=['attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleFetchError','handleEnd','stringify','textCode','upperFirst','exports','path','imap','randomstring','mailparser','iconv','EventEmitter','./utils','email','mailbox','getAccount','account','once','ready','handleReady','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','readUnseen','end','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','handleCloseBox','handleMessageBody'];(function(_0x37e528,_0x2458d6){var _0x3cf2ad=function(_0x4dc6ea){while(--_0x4dc6ea){_0x37e528['push'](_0x37e528['shift']());}};_0x3cf2ad(++_0x2458d6);}(_0xe8f8,0x1da));var _0x8e8f=function(_0xad47dd,_0x346929){_0xad47dd=_0xad47dd-0x0;var _0x40b88f=_0xe8f8[_0xad47dd];return _0x40b88f;};'use strict';var fs=require('fs');var path=require(_0x8e8f('0x0'));var util=require('util');var Imap=require(_0x8e8f('0x1'));var _=require('lodash');var rs=require(_0x8e8f('0x2'));var simpleParser=require(_0x8e8f('0x3'))['simpleParser'];var Iconv=require(_0x8e8f('0x4'))['Iconv'];var EventEmitter=require('events')[_0x8e8f('0x5')];var utils=require(_0x8e8f('0x6'));var logger=require('../../../config/logger')(_0x8e8f('0x7'));function EmailImap(_0x388dc2,_0x1b227d){this[_0x8e8f('0x8')]='INBOX';this['account']=this[_0x8e8f('0x9')](_0x388dc2,_0x1b227d);this[_0x8e8f('0x1')]=new Imap(this[_0x8e8f('0xa')]);this['imap'][_0x8e8f('0xb')](_0x8e8f('0xc'),this[_0x8e8f('0xd')][_0x8e8f('0xe')](this));this[_0x8e8f('0x1')][_0x8e8f('0xb')]('end',this['handleEnd'][_0x8e8f('0xe')](this));this[_0x8e8f('0x1')]['on'](_0x8e8f('0xf'),this[_0x8e8f('0x10')][_0x8e8f('0xe')](this));this[_0x8e8f('0x1')][_0x8e8f('0x11')]();}util[_0x8e8f('0x12')](EmailImap,EventEmitter);EmailImap[_0x8e8f('0x13')][_0x8e8f('0x9')]=function(_0xc68ee,_0xfac75c){var _0x363de0={'connTimeout':_0xc68ee[_0x8e8f('0x14')]?_0xc68ee['connTimeout']*0x3e8:0x2710,'authTimeout':_0xc68ee[_0x8e8f('0x15')]?_0xc68ee[_0x8e8f('0x15')]*0x3e8:0x1388};if(_['isNil'](_0xc68ee[_0x8e8f('0x16')])){if(_0xc68ee[_0x8e8f('0x17')]){_0x363de0[_0x8e8f('0x18')]=_0xc68ee['user'];_0x363de0[_0x8e8f('0x19')]=_0xc68ee[_0x8e8f('0x19')];}_0x363de0['host']=_0xc68ee[_0x8e8f('0x1a')];_0x363de0[_0x8e8f('0x1b')]=_0xc68ee[_0x8e8f('0x1b')]||0x3e1;if(_0xc68ee[_0x8e8f('0x1c')]){_0x363de0[_0x8e8f('0x1c')]=!![];}else{_0x363de0[_0x8e8f('0x1c')]=![];_0x363de0[_0x8e8f('0x1d')]=_0x8e8f('0x1e');}}else{_0x363de0['user']=_0xc68ee[_0x8e8f('0x18')];_0x363de0[_0x8e8f('0x19')]=_0xc68ee['password'];_0x363de0[_0x8e8f('0x1a')]=utils[_0x8e8f('0x1f')](_0xc68ee[_0x8e8f('0x16')]);_0x363de0[_0x8e8f('0x1b')]=0x3e1;_0x363de0['tls']=!![];}_0x363de0['email']=_0xfac75c||_0xc68ee[_0x8e8f('0x18')]||_0x8e8f('0x20');return _0x363de0;};EmailImap[_0x8e8f('0x13')][_0x8e8f('0xd')]=function(){this['imap'][_0x8e8f('0x21')](this[_0x8e8f('0x8')],![],this[_0x8e8f('0x22')][_0x8e8f('0xe')](this));};EmailImap[_0x8e8f('0x13')][_0x8e8f('0x22')]=function(_0x100365,_0xd66b5d){if(_0x100365){this[_0x8e8f('0x10')](_0x100365,!![]);}else{this[_0x8e8f('0x23')]('box',_0xd66b5d);this[_0x8e8f('0x24')]();}};EmailImap[_0x8e8f('0x13')]['handleCloseBox']=function(_0x411aaf){if(_0x411aaf){this['handleError'](_0x411aaf,!![]);}else{this[_0x8e8f('0x1')][_0x8e8f('0x25')]();}};EmailImap[_0x8e8f('0x13')][_0x8e8f('0x24')]=function(){this['imap'][_0x8e8f('0x26')]([_0x8e8f('0x27')],this[_0x8e8f('0x28')][_0x8e8f('0xe')](this));};EmailImap[_0x8e8f('0x13')][_0x8e8f('0x28')]=function(_0x67c934,_0x4924ba){if(_0x67c934){this[_0x8e8f('0x10')](_0x67c934,!![]);}else{if(_0x4924ba['length']){try{var _0x230171=this[_0x8e8f('0x1')][_0x8e8f('0x29')](_0x4924ba,{'bodies':'','markSeen':!![]});_0x230171['on'](_0x8e8f('0x2a'),this[_0x8e8f('0x2b')][_0x8e8f('0xe')](this));_0x230171[_0x8e8f('0xb')](_0x8e8f('0xf'),this['handleFetchError'][_0x8e8f('0xe')](this));_0x230171[_0x8e8f('0xb')](_0x8e8f('0x25'),this[_0x8e8f('0x2c')][_0x8e8f('0xe')](this));}catch(_0x23f8bb){logger[_0x8e8f('0xf')](_0x23f8bb);}}else{this['imap'][_0x8e8f('0x2d')](!![],this[_0x8e8f('0x2e')][_0x8e8f('0xe')](this));}}};EmailImap[_0x8e8f('0x13')][_0x8e8f('0x2b')]=function(_0x5b9538,_0x121e82){_0x5b9538['on']('body',this[_0x8e8f('0x2f')]['bind'](this));_0x5b9538[_0x8e8f('0xb')](_0x8e8f('0x30'),this[_0x8e8f('0x31')][_0x8e8f('0xe')](this));_0x5b9538['once'](_0x8e8f('0x25'),this[_0x8e8f('0x32')][_0x8e8f('0xe')](this));};EmailImap[_0x8e8f('0x13')]['handleMessageBody']=function(_0x42264a,_0x38475b){simpleParser(_0x42264a,{'Iconv':Iconv},this['handleSimpleParser'][_0x8e8f('0xe')](this));};EmailImap['prototype']['handleMessageAttributes']=function(_0x30318e){};EmailImap[_0x8e8f('0x13')][_0x8e8f('0x32')]=function(){};EmailImap[_0x8e8f('0x13')][_0x8e8f('0x33')]=function(_0x2dda81,_0x1eb4f8){if(_0x2dda81){logger[_0x8e8f('0xf')](_0x2dda81);}else{var _0x4a131c=this;utils['parser'](this[_0x8e8f('0xa')],_0x1eb4f8,function(_0xf9fd23){_0x4a131c[_0x8e8f('0x23')](_0x8e8f('0x7'),_0xf9fd23);});}};EmailImap[_0x8e8f('0x13')]['handleFetchEnd']=function(){this['imap']['closeBox'](!![],this[_0x8e8f('0x2e')][_0x8e8f('0xe')](this));};EmailImap[_0x8e8f('0x13')][_0x8e8f('0x34')]=function(_0x44207e){this[_0x8e8f('0x10')](_0x44207e);this[_0x8e8f('0x1')][_0x8e8f('0x2d')](!![],this[_0x8e8f('0x2e')][_0x8e8f('0xe')](this));};EmailImap['prototype'][_0x8e8f('0x35')]=function(){this[_0x8e8f('0x23')]('end');};EmailImap[_0x8e8f('0x13')][_0x8e8f('0x10')]=function(_0x3bd108,_0x3390ae){logger['error'](_0x8e8f('0x10'),this[_0x8e8f('0xa')][_0x8e8f('0x7')],JSON[_0x8e8f('0x36')](_0x3bd108));var _0x586dd3='';if(_0x3bd108){if(_0x3bd108[_0x8e8f('0x37')]){_0x586dd3=_0x3bd108[_0x8e8f('0x37')];}else{for(var _0x81b3f3 in _0x3bd108){if(_0x3bd108['hasOwnProperty'](_0x81b3f3)){_0x586dd3+=_[_0x8e8f('0x38')](_0x81b3f3)+':\x20'+_0x3bd108[_0x81b3f3]+'\x0a';}}}}if(_0x3390ae){this[_0x8e8f('0x1')]['end']();}else{this[_0x8e8f('0x23')](_0x8e8f('0xf'),_0x586dd3);this[_0x8e8f('0x23')](_0x8e8f('0x25'));}};module[_0x8e8f('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 26541ef..c0e6571 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 _0xe51c=['nodemailer-plugin-inline-base64','prototype','send','createTransport','use','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','bluebird'];(function(_0x2c645b,_0x37bce6){var _0x109b76=function(_0x2b3e84){while(--_0x2b3e84){_0x2c645b['push'](_0x2c645b['shift']());}};_0x109b76(++_0x37bce6);}(_0xe51c,0xfa));var _0xce51=function(_0x305ad3,_0x244a36){_0x305ad3=_0x305ad3-0x0;var _0x3df215=_0xe51c[_0x305ad3];return _0x3df215;};'use strict';var nodemailer=require(_0xce51('0x0'));var BPromise=require(_0xce51('0x1'));var inlineBase64=require(_0xce51('0x2'));function EmailSmtp(){}EmailSmtp[_0xce51('0x3')][_0xce51('0x4')]=function(_0x389342,_0x383f43){return new BPromise(function(_0x3fe714,_0x3ed440){var _0x240c8b=nodemailer[_0xce51('0x5')](_0x389342);_0x240c8b[_0xce51('0x6')]('compile',inlineBase64());_0x240c8b[_0xce51('0x7')](_0x383f43,function(_0x3057d2,_0x12b3fb){if(_0x3057d2){_0x3ed440(_0x3057d2[_0xce51('0x8')]());}else{_0x3fe714(_0x12b3fb);}});});};EmailSmtp[_0xce51('0x3')][_0xce51('0x9')]=function(_0xb7dca4){return new BPromise(function(_0x219ee7,_0x96f29){var _0x89d7d6=nodemailer[_0xce51('0x5')](_0xb7dca4);_0x89d7d6[_0xce51('0x9')](function(_0x5becff,_0xdd426e){if(_0x5becff){_0x96f29(_0x5becff[_0xce51('0x8')]());}else{if(_0xdd426e){_0x219ee7(_0xdd426e);}else{_0x96f29(_0xce51('0xa'));}}});});};module[_0xce51('0xb')]=EmailSmtp; \ No newline at end of file +var _0xea68=['Not\x20verifired','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail','toString','verify'];(function(_0x4311c7,_0x2cc7a4){var _0x313012=function(_0x4b7490){while(--_0x4b7490){_0x4311c7['push'](_0x4311c7['shift']());}};_0x313012(++_0x2cc7a4);}(_0xea68,0xa9));var _0x8ea6=function(_0x603507,_0x400036){_0x603507=_0x603507-0x0;var _0x3fdb19=_0xea68[_0x603507];return _0x3fdb19;};'use strict';var nodemailer=require(_0x8ea6('0x0'));var BPromise=require(_0x8ea6('0x1'));var inlineBase64=require(_0x8ea6('0x2'));function EmailSmtp(){}EmailSmtp[_0x8ea6('0x3')][_0x8ea6('0x4')]=function(_0x4871a4,_0x15d1f3){return new BPromise(function(_0x32136e,_0x4644b3){var _0x25a5a4=nodemailer[_0x8ea6('0x5')](_0x4871a4);_0x25a5a4[_0x8ea6('0x6')](_0x8ea6('0x7'),inlineBase64());_0x25a5a4[_0x8ea6('0x8')](_0x15d1f3,function(_0x212a3d,_0x313879){if(_0x212a3d){_0x4644b3(_0x212a3d[_0x8ea6('0x9')]());}else{_0x32136e(_0x313879);}});});};EmailSmtp['prototype'][_0x8ea6('0xa')]=function(_0x5861da){return new BPromise(function(_0x3dbba5,_0x16f93c){var _0x41e7c5=nodemailer['createTransport'](_0x5861da);_0x41e7c5['verify'](function(_0x4d8122,_0x599faf){if(_0x4d8122){_0x16f93c(_0x4d8122['toString']());}else{if(_0x599faf){_0x3dbba5(_0x599faf);}else{_0x16f93c(_0x8ea6('0xb'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 0bef075..e173645 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 _0x7d8a=['line','isAutoreply','from','date','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','format','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','Attachments','Title','imap.gmail.com','yahoo','imap.mail.yahoo.com','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','indexOf','length','slice','join','Anonymous','split','pop','isEmpty','html','test','includes','attachments','forEach','push','filename','replace','_IMG','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x51eb9e[_0xa7d8('0x12')](0x0,-0x1)[_0xa7d8('0x13')]('\x20'):_0xb1602['name'];}return _0xa7d8('0x14');}function getLastName(_0x137919){var _0x5c8151=_['head'](_0x137919['value']);if(_0x5c8151&&_0x5c8151[_0xa7d8('0xf')]){var _0x1121d=_0x5c8151[_0xa7d8('0xf')][_0xa7d8('0x15')](/\s+/);return _0x1121d[_0xa7d8('0x11')]>0x1?_0x1121d[_0xa7d8('0x16')]():'';}return'';}function getMails(_0x2bbaf4,_0x21bc56){var _0x42e957='';for(var _0xfc0284=0x0;_0xfc0284<_0x21bc56[_0xa7d8('0xa')][_0xa7d8('0x11')];_0xfc0284+=0x1){if(_0x21bc56[_0xa7d8('0xa')][_0xfc0284]['address']!==_0x2bbaf4){if(!_[_0xa7d8('0x17')](_0x42e957)){_0x42e957+=',';}_0x42e957+=_0x21bc56[_0xa7d8('0xa')][_0xfc0284]['name']||_0x21bc56[_0xa7d8('0xa')][_0xfc0284][_0xa7d8('0xb')]||'';_0x42e957+='\x20<';_0x42e957+=_0x21bc56[_0xa7d8('0xa')][_0xfc0284][_0xa7d8('0xb')]?_0x21bc56['value'][_0xfc0284][_0xa7d8('0xb')]:'anonymous'+random[_0xa7d8('0xd')](0x6)+_0xa7d8('0xe');_0x42e957+='>';}}return _0x42e957;}function parseEmail(_0x559771,_0x381fca,_0x108a6d){if(_0x381fca[_0xa7d8('0x18')]){var _0x426a20=/)<[^<]*)*<\/script>/gi;while(_0x426a20[_0xa7d8('0x19')](_0x381fca['html'])){_0x381fca[_0xa7d8('0x18')]=_0x381fca[_0xa7d8('0x18')]['replace'](_0x426a20,'');}if(_0x381fca[_0xa7d8('0x18')][_0xa7d8('0x1a')]('{_0xd09e17[_0xa7d8('0x1d')](_0x22a1f2[_0xa7d8('0x1e')]);});var _0x2d3f0d=/]+>/g;var _0x5392a1=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2aed5b=_0x381fca['html'][_0xa7d8('0x1f')](_0x5392a1,'_SRC');var _0x53c475=_0x2aed5b['replace'](_0x2d3f0d,'_IMG');for(let _0x45b800=0x0;_0x45b800<_0xd09e17[_0xa7d8('0x11')];_0x45b800++){var _0x5ae36c=_0x53c475[_0xa7d8('0x1f')](_0xa7d8('0x20'),_0xa7d8('0x21')+_0xd09e17[_0x45b800]+'\x20]');_0x53c475=_0x5ae36c;}_0x381fca[_0xa7d8('0x18')]=_0x53c475;}_0x108a6d[_0xa7d8('0x22')]=_0x381fca[_0xa7d8('0x18')];}else{_0x108a6d['body']=_0x381fca[_0xa7d8('0x23')];}if(_0x108a6d[_0xa7d8('0x22')]){_0x108a6d['body']=_0x108a6d['body'][_0xa7d8('0x1f')](/0x0){var _0x2d8699=[_0xa7d8('0x32'),_0xa7d8('0x33'),_0xa7d8('0x34')];for(var _0x13e9f2=0x0;_0x13e9f2<_0x381fca[_0xa7d8('0x31')][_0xa7d8('0x11')];_0x13e9f2++){var _0x2ef2be=_[_0xa7d8('0x10')](_0x2d8699,_0x381fca[_0xa7d8('0x31')][_0x13e9f2][_0xa7d8('0x35')]);if(_0x2ef2be>=0x0){_0x108a6d[_0xa7d8('0x36')]=!![];}}}return _0x108a6d;}exports['parser']=function(_0x506efa,_0x1e8896,_0x2c7dd6){var _0xc8f95a={'from':getAddress(_0x1e8896[_0xa7d8('0x37')]),'firstName':getFirstName(_0x1e8896[_0xa7d8('0x37')]),'lastName':getLastName(_0x1e8896['from']),'mapKey':_0xa7d8('0x7'),'message':{'from':getMails(_0x506efa[_0xa7d8('0x7')],_0x1e8896[_0xa7d8('0x37')]),'to':_0x506efa[_0xa7d8('0x7')],'cc':'','subject':_0x1e8896['subject']||'','messageId':_0x1e8896['messageId'],'inReplyTo':_0x1e8896['inReplyTo'],'sentAt':moment(_0x1e8896[_0xa7d8('0x38')])['format'](_0xa7d8('0x39')),'attach':![],'attachments':[]}};if(!_0x1e8896[_0xa7d8('0x18')]&&!_0x1e8896[_0xa7d8('0x23')]){var _0x48763c=_['filter'](_0x1e8896[_0xa7d8('0x1b')],{'contentType':_0xa7d8('0x3a')});if(_0x48763c[_0xa7d8('0x11')]){logger[_0xa7d8('0x3b')](util[_0xa7d8('0x3c')](_0xa7d8('0x3d'),_0x1e8896[_0xa7d8('0x3e')]));tnef[_0xa7d8('0x3f')](_[_0xa7d8('0x40')](_0x48763c)[_0xa7d8('0x30')],function(_0x141f47,_0x430297){if(_0x430297){_0x1e8896['html']=_0x430297[_0xa7d8('0x41')]||'

Empty\x20message

';if(_0x430297[_0xa7d8('0x42')]){for(var _0x5666e6=0x0;_0x5666e6<_0x430297[_0xa7d8('0x42')][_0xa7d8('0x11')];_0x5666e6++){var _0x284dbc=_0x430297[_0xa7d8('0x42')][_0x5666e6];_0xc8f95a[_0xa7d8('0x25')][_0xa7d8('0x1b')]['push']({'filename':_0x284dbc[_0xa7d8('0x43')],'content':Buffer[_0xa7d8('0x37')](_0x284dbc['Data'])});}}}_0x2c7dd6(parseEmail(_0x506efa,_0x1e8896,_0xc8f95a));});}else{_0x1e8896['html']='

Empty\x20message

';_0x2c7dd6(parseEmail(_0x506efa,_0x1e8896,_0xc8f95a));}}else{_0x2c7dd6(parseEmail(_0x506efa,_0x1e8896,_0xc8f95a));}};exports['getHost']=function(_0x3e089c){switch(_0x3e089c){case'gmail':return _0xa7d8('0x44');case _0xa7d8('0x45'):return _0xa7d8('0x46');case'hotmail':return'imap-mail.outlook.com';case'outlook365':return _0xa7d8('0x47');}return _0xa7d8('0x48');}; \ No newline at end of file +var _0xc1d3=['Empty\x20message

','Attachments','Data','getHost','gmail','yahoo','imap.mail.yahoo.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','head','address','anonymous','generate','@xcally.com','value','name','substring','indexOf','split','length','join','pop','html','replace','includes','\x20[Attachment:\x20','\x20]','textAsHtml','body'];(function(_0x15625f,_0x23a10){var _0x467117=function(_0x3b6631){while(--_0x3b6631){_0x15625f['push'](_0x15625f['shift']());}};_0x467117(++_0x23a10);}(_0xc1d3,0x147));var _0x3c1d=function(_0x19cfe3,_0x5bbb6b){_0x19cfe3=_0x19cfe3-0x0;var _0x591042=_0xc1d3[_0x19cfe3];return _0x591042;};'use strict';var _=require(_0x3c1d('0x0'));var moment=require(_0x3c1d('0x1'));var random=require(_0x3c1d('0x2'));var fs=require('fs');var path=require(_0x3c1d('0x3'));var util=require(_0x3c1d('0x4'));var tnef=require(_0x3c1d('0x5'));var logger=require(_0x3c1d('0x6'))('email');var config=require('../../../config/environment');function getAddress(_0x280eb3){var _0x25cdae=_[_0x3c1d('0x7')](_0x280eb3['value']);return _0x25cdae&&_0x25cdae[_0x3c1d('0x8')]?_0x25cdae[_0x3c1d('0x8')]:_0x3c1d('0x9')+random[_0x3c1d('0xa')](0x6)+_0x3c1d('0xb');}function getFirstName(_0x58e08c){var _0x182b4c=_[_0x3c1d('0x7')](_0x58e08c[_0x3c1d('0xc')]);if(_0x182b4c&&_0x182b4c[_0x3c1d('0xd')]){if(_0x182b4c[_0x3c1d('0xd')]==_0x182b4c[_0x3c1d('0x8')]){return _0x182b4c[_0x3c1d('0xd')][_0x3c1d('0xe')](0x0,_0x182b4c['name'][_0x3c1d('0xf')]('@'));}var _0x1eaabc=_0x182b4c[_0x3c1d('0xd')][_0x3c1d('0x10')](/\s+/);return _0x1eaabc[_0x3c1d('0x11')]>0x1?_0x1eaabc['slice'](0x0,-0x1)[_0x3c1d('0x12')]('\x20'):_0x182b4c[_0x3c1d('0xd')];}return'Anonymous';}function getLastName(_0x1c6e40){var _0x5731c9=_['head'](_0x1c6e40['value']);if(_0x5731c9&&_0x5731c9[_0x3c1d('0xd')]){var _0x2dcdd7=_0x5731c9[_0x3c1d('0xd')][_0x3c1d('0x10')](/\s+/);return _0x2dcdd7[_0x3c1d('0x11')]>0x1?_0x2dcdd7[_0x3c1d('0x13')]():'';}return'';}function getMails(_0x4e6157,_0x4cb888){var _0x2098d8='';for(var _0x5ab3b0=0x0;_0x5ab3b0<_0x4cb888[_0x3c1d('0xc')][_0x3c1d('0x11')];_0x5ab3b0+=0x1){if(_0x4cb888['value'][_0x5ab3b0]['address']!==_0x4e6157){if(!_['isEmpty'](_0x2098d8)){_0x2098d8+=',';}_0x2098d8+=_0x4cb888[_0x3c1d('0xc')][_0x5ab3b0][_0x3c1d('0xd')]||_0x4cb888[_0x3c1d('0xc')][_0x5ab3b0][_0x3c1d('0x8')]||'';_0x2098d8+='\x20<';_0x2098d8+=_0x4cb888[_0x3c1d('0xc')][_0x5ab3b0]['address']?_0x4cb888['value'][_0x5ab3b0][_0x3c1d('0x8')]:_0x3c1d('0x9')+random[_0x3c1d('0xa')](0x6)+_0x3c1d('0xb');_0x2098d8+='>';}}return _0x2098d8;}function parseEmail(_0x3db1b7,_0x5b2720,_0x129be7){if(_0x5b2720[_0x3c1d('0x14')]){var _0xa5fd81=/)<[^<]*)*<\/script>/gi;while(_0xa5fd81['test'](_0x5b2720[_0x3c1d('0x14')])){_0x5b2720[_0x3c1d('0x14')]=_0x5b2720[_0x3c1d('0x14')][_0x3c1d('0x15')](_0xa5fd81,'');}if(_0x5b2720[_0x3c1d('0x14')][_0x3c1d('0x16')](_0x3c1d('0x17'))){var _0x2d6774=[];_0x5b2720[_0x3c1d('0x18')]['forEach'](_0x2c0132=>{_0x2d6774[_0x3c1d('0x19')](_0x2c0132[_0x3c1d('0x1a')]);});var _0x4f7cd8=/]+>/g;var _0x2d1694=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3bde45=_0x5b2720['html'][_0x3c1d('0x15')](_0x2d1694,_0x3c1d('0x1b'));var _0x268ad2=_0x3bde45['replace'](_0x4f7cd8,_0x3c1d('0x1c'));for(let _0x52edae=0x0;_0x52edae<_0x2d6774[_0x3c1d('0x11')];_0x52edae++){var _0x295b7b=_0x268ad2['replace']('_IMG',_0x3c1d('0x1d')+_0x2d6774[_0x52edae]+_0x3c1d('0x1e'));_0x268ad2=_0x295b7b;}_0x5b2720[_0x3c1d('0x14')]=_0x268ad2;}_0x129be7['body']=_0x5b2720[_0x3c1d('0x14')];}else{_0x129be7['body']=_0x5b2720[_0x3c1d('0x1f')];}if(_0x129be7[_0x3c1d('0x20')]){_0x129be7[_0x3c1d('0x20')]=_0x129be7['body'][_0x3c1d('0x15')](/0x0){var _0x1093a9=[_0x3c1d('0x30'),_0x3c1d('0x31'),_0x3c1d('0x32')];for(var _0x15f809=0x0;_0x15f809<_0x5b2720[_0x3c1d('0x33')][_0x3c1d('0x11')];_0x15f809++){var _0x122d4c=_[_0x3c1d('0xf')](_0x1093a9,_0x5b2720[_0x3c1d('0x33')][_0x15f809][_0x3c1d('0x34')]);if(_0x122d4c>=0x0){_0x129be7['isAutoreply']=!![];}}}return _0x129be7;}exports[_0x3c1d('0x35')]=function(_0x5ca02c,_0x415a61,_0x4a358e){var _0x4319d8={'from':getAddress(_0x415a61['from']),'firstName':getFirstName(_0x415a61[_0x3c1d('0x36')]),'lastName':getLastName(_0x415a61[_0x3c1d('0x36')]),'mapKey':_0x3c1d('0x24'),'message':{'from':getMails(_0x5ca02c[_0x3c1d('0x24')],_0x415a61['from']),'to':_0x5ca02c[_0x3c1d('0x24')],'cc':'','subject':_0x415a61['subject']||'','messageId':_0x415a61[_0x3c1d('0x37')],'inReplyTo':_0x415a61[_0x3c1d('0x38')],'sentAt':moment(_0x415a61[_0x3c1d('0x39')])[_0x3c1d('0x2a')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x415a61[_0x3c1d('0x14')]&&!_0x415a61[_0x3c1d('0x1f')]){var _0x3d97a3=_[_0x3c1d('0x3a')](_0x415a61[_0x3c1d('0x18')],{'contentType':'application/ms-tnef'});if(_0x3d97a3[_0x3c1d('0x11')]){logger[_0x3c1d('0x3b')](util[_0x3c1d('0x2a')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x415a61['messageId']));tnef[_0x3c1d('0x3c')](_[_0x3c1d('0x3d')](_0x3d97a3)[_0x3c1d('0x2e')],function(_0x10ace4,_0x104a81){if(_0x104a81){_0x415a61[_0x3c1d('0x14')]=_0x104a81['BodyHTML']||_0x3c1d('0x3e');if(_0x104a81['Attachments']){for(var _0x34ad3a=0x0;_0x34ad3a<_0x104a81[_0x3c1d('0x3f')][_0x3c1d('0x11')];_0x34ad3a++){var _0x1da399=_0x104a81[_0x3c1d('0x3f')][_0x34ad3a];_0x4319d8[_0x3c1d('0x22')][_0x3c1d('0x18')]['push']({'filename':_0x1da399['Title'],'content':Buffer['from'](_0x1da399[_0x3c1d('0x40')])});}}}_0x4a358e(parseEmail(_0x5ca02c,_0x415a61,_0x4319d8));});}else{_0x415a61[_0x3c1d('0x14')]=_0x3c1d('0x3e');_0x4a358e(parseEmail(_0x5ca02c,_0x415a61,_0x4319d8));}}else{_0x4a358e(parseEmail(_0x5ca02c,_0x415a61,_0x4319d8));}};exports[_0x3c1d('0x41')]=function(_0x206be2){switch(_0x206be2){case _0x3c1d('0x42'):return'imap.gmail.com';case _0x3c1d('0x43'):return _0x3c1d('0x44');case'hotmail':return'imap-mail.outlook.com';case _0x3c1d('0x45'):return _0x3c1d('0x46');}return _0x3c1d('0x47');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 3a0999e..3763735 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 _0xb5dd=['exports','lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x4403b3,_0x4b73ae){var _0x281a6e=function(_0x20afa2){while(--_0x20afa2){_0x4403b3['push'](_0x4403b3['shift']());}};_0x281a6e(++_0x4b73ae);}(_0xb5dd,0xd9));var _0xdb5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb5dd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdb5d('0x0'));function MailAccount(_0x2cf077){this['id']=_0x2cf077['id']||0x0;this[_0xdb5d('0x1')]=_0x2cf077[_0xdb5d('0x1')]||_0xdb5d('0x2');this['key']=_0x2cf077[_0xdb5d('0x3')]||_0xdb5d('0x4');this[_0xdb5d('0x5')]=_0x2cf077['active']||![];this[_0xdb5d('0x6')]=_0x2cf077[_0xdb5d('0x6')]||[];this[_0xdb5d('0x7')]=_0x2cf077[_0xdb5d('0x7')]||[];}module[_0xdb5d('0x8')]=MailAccount; \ No newline at end of file +var _0x67cd=['name','Service','key','SERV','active','Imap','exports','lodash'];(function(_0x517ccf,_0x24224a){var _0x578916=function(_0x49e206){while(--_0x49e206){_0x517ccf['push'](_0x517ccf['shift']());}};_0x578916(++_0x24224a);}(_0x67cd,0x117));var _0xd67c=function(_0x396e83,_0x2d51e2){_0x396e83=_0x396e83-0x0;var _0x4a42cc=_0x67cd[_0x396e83];return _0x4a42cc;};'use strict';var _=require(_0xd67c('0x0'));function MailAccount(_0x2966aa){this['id']=_0x2966aa['id']||0x0;this[_0xd67c('0x1')]=_0x2966aa['name']||_0xd67c('0x2');this[_0xd67c('0x3')]=_0x2966aa[_0xd67c('0x3')]||_0xd67c('0x4');this[_0xd67c('0x5')]=_0x2966aa[_0xd67c('0x5')]||![];this[_0xd67c('0x6')]=_0x2966aa['Imap']||[];this['Smtp']=_0x2966aa['Smtp']||[];}module[_0xd67c('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 95a70d4..688447c 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 _0x54e2=['hasOwnProperty','prototype','initMailAccounts','length','merge','exports','lodash','mailAccounts','mapKeys'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x54e2,0x180));var _0x254e=function(_0x3b04a9,_0x203337){_0x3b04a9=_0x3b04a9-0x0;var _0x47ef88=_0x54e2[_0x3b04a9];return _0x47ef88;};'use strict';var _=require(_0x254e('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x254e('0x1')]={};};function freeIsNotKey(_0x3c1534,_0x2c576b,_0x45bf41){var _0xdae4=_[_0x254e('0x2')](_0x3c1534,function(_0x419047,_0x5e90d6){return _0x419047[_0x45bf41];});for(var _0x38ea6c in _0x2c576b){if(_0x2c576b[_0x254e('0x3')](_0x38ea6c)){if(!_0xdae4[_0x38ea6c]){delete _0x2c576b[_0x38ea6c];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x100115,_0x1ae2a1){for(var _0x2d22cc in _0x1ae2a1){if(_0x100115[_0x254e('0x3')](_0x2d22cc)){_0x100115[_0x2d22cc]=_0x1ae2a1[_0x2d22cc];}}};Realtime[_0x254e('0x4')][_0x254e('0x5')]=function(){var _0x158a34=this;return function(_0x329e00){if(_0x329e00){freeIsNotKey(_0x329e00,_0x158a34[_0x254e('0x1')],'id');for(var _0x3b7dfd=0x0,_0x25f1f4={},_0x5c18b3={};_0x3b7dfd<_0x329e00[_0x254e('0x6')];_0x3b7dfd+=0x1){_0x25f1f4=_0x329e00[_0x3b7dfd];if(_['isUndefined'](_0x158a34[_0x254e('0x1')][_0x25f1f4['id']])){_0x158a34[_0x254e('0x1')][_0x25f1f4['id']]=new MailAccount(_0x25f1f4);}else{_[_0x254e('0x7')](_0x158a34[_0x254e('0x1')][_0x25f1f4['id']],_0x25f1f4);}}}return _0x158a34['mailAccounts'];};};module[_0x254e('0x8')]=Realtime; \ No newline at end of file +var _0x2d80=['exports','../model/mailAccount','mailAccounts','mapKeys','prototype','mergeFromDatabase','initMailAccounts','isUndefined','merge'];(function(_0xb4df2d,_0x3a6dce){var _0x52f182=function(_0x39d71){while(--_0x39d71){_0xb4df2d['push'](_0xb4df2d['shift']());}};_0x52f182(++_0x3a6dce);}(_0x2d80,0x1a8));var _0x02d8=function(_0x16a496,_0x2380e2){_0x16a496=_0x16a496-0x0;var _0x5d2c35=_0x2d80[_0x16a496];return _0x5d2c35;};'use strict';var _=require('lodash');var MailAccount=require(_0x02d8('0x0'));var Realtime=function(){this[_0x02d8('0x1')]={};};function freeIsNotKey(_0x15ac8f,_0x475f49,_0x95abd2){var _0x291b7d=_[_0x02d8('0x2')](_0x15ac8f,function(_0x442e18,_0x2b9168){return _0x442e18[_0x95abd2];});for(var _0x44e2f6 in _0x475f49){if(_0x475f49['hasOwnProperty'](_0x44e2f6)){if(!_0x291b7d[_0x44e2f6]){delete _0x475f49[_0x44e2f6];}}}}Realtime[_0x02d8('0x3')][_0x02d8('0x4')]=function(_0x2ebbc9,_0x47c043){for(var _0x41b0be in _0x47c043){if(_0x2ebbc9['hasOwnProperty'](_0x41b0be)){_0x2ebbc9[_0x41b0be]=_0x47c043[_0x41b0be];}}};Realtime[_0x02d8('0x3')][_0x02d8('0x5')]=function(){var _0x2345ca=this;return function(_0x3538bf){if(_0x3538bf){freeIsNotKey(_0x3538bf,_0x2345ca[_0x02d8('0x1')],'id');for(var _0x1e0175=0x0,_0x12222b={},_0x57d3f0={};_0x1e0175<_0x3538bf['length'];_0x1e0175+=0x1){_0x12222b=_0x3538bf[_0x1e0175];if(_[_0x02d8('0x6')](_0x2345ca['mailAccounts'][_0x12222b['id']])){_0x2345ca[_0x02d8('0x1')][_0x12222b['id']]=new MailAccount(_0x12222b);}else{_[_0x02d8('0x7')](_0x2345ca[_0x02d8('0x1')][_0x12222b['id']],_0x12222b);}}}return _0x2345ca['mailAccounts'];};};module[_0x02d8('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 9e9b4dd..86c0c8d 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 _0x1537=['MailServerOut','Smtp','getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name','service','email','active','ListId','MailServerIn'];(function(_0x55fbc1,_0x169019){var _0x17e813=function(_0x1c7a54){while(--_0x1c7a54){_0x55fbc1['push'](_0x55fbc1['shift']());}};_0x17e813(++_0x169019);}(_0x1537,0x132));var _0x7153=function(_0x54416f,_0xd5dc73){_0x54416f=_0x54416f-0x0;var _0x4792b3=_0x1537[_0x54416f];return _0x4792b3;};'use strict';var client=require(_0x7153('0x0'));exports[_0x7153('0x1')]=function(){return function(){return client['Request'](_0x7153('0x2'),{'options':{'attributes':['id',_0x7153('0x3'),_0x7153('0x4'),_0x7153('0x5'),_0x7153('0x6'),'key',_0x7153('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0x7153('0x8'),'as':'Imap'},{'model':_0x7153('0x9'),'as':_0x7153('0xa')}]},'log':_0x7153('0xb')});};};exports[_0x7153('0xc')]=function(_0x399c45,_0x2baa85){return client[_0x7153('0xd')]('NotifyMailAccount',{'account':{'id':_0x399c45},'body':_0x2baa85,'log':_0x7153('0xe')});}; \ No newline at end of file +var _0x43d7=['Imap','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','name','active','key','MailServerIn'];(function(_0x327a1c,_0xe641eb){var _0x28e691=function(_0x108e11){while(--_0x108e11){_0x327a1c['push'](_0x327a1c['shift']());}};_0x28e691(++_0xe641eb);}(_0x43d7,0x7b));var _0x743d=function(_0x4eecda,_0x49bd5b){_0x4eecda=_0x4eecda-0x0;var _0x407669=_0x43d7[_0x4eecda];return _0x407669;};'use strict';var client=require(_0x743d('0x0'));exports[_0x743d('0x1')]=function(){return function(){return client[_0x743d('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x743d('0x3'),'service','email',_0x743d('0x4'),_0x743d('0x5'),'ListId','TemplateId'],'raw':![],'include':[{'model':_0x743d('0x6'),'as':_0x743d('0x7')},{'model':_0x743d('0x8'),'as':_0x743d('0x9')}]},'log':_0x743d('0xa')});};};exports[_0x743d('0xb')]=function(_0x5671f8,_0x4c9015){return client[_0x743d('0x2')](_0x743d('0xc'),{'account':{'id':_0x5671f8},'body':_0x4c9015,'log':_0x743d('0xc')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 6988801..60311b0 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 _0xd72c=['loginMailFrequency','GetSettings','Request','ShowSetting'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd72c,0x1e6));var _0xcd72=function(_0x4f22d0,_0x348a25){_0x4f22d0=_0x4f22d0-0x0;var _0x32324d=_0xd72c[_0x4f22d0];return _0x32324d;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xcd72('0x0')](_0xcd72('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xcd72('0x2')]},'log':_0xcd72('0x3')});}; \ No newline at end of file +var _0xc041=['loginMailFrequency','GetSettings','../client','getSettings','Request'];(function(_0x3fdb01,_0x49c8a8){var _0x148f73=function(_0xe681ac){while(--_0xe681ac){_0x3fdb01['push'](_0x3fdb01['shift']());}};_0x148f73(++_0x49c8a8);}(_0xc041,0x1f1));var _0x1c04=function(_0x55a787,_0x1466a3){_0x55a787=_0x55a787-0x0;var _0x5d90a0=_0xc041[_0x55a787];return _0x5d90a0;};'use strict';var client=require(_0x1c04('0x0'));exports[_0x1c04('0x1')]=function(){return client[_0x1c04('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x1c04('0x3')]},'log':_0x1c04('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index ddbe29f..047a4e8 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 7a6a77e..bb9e409 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 _0xd440=['adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','timeout','listen','port','websocket','redis','localhost'];(function(_0x258559,_0x3756b7){var _0x5d3d25=function(_0x16f97e){while(--_0x16f97e){_0x258559['push'](_0x258559['shift']());}};_0x5d3d25(++_0x3756b7);}(_0xd440,0xba));var _0x0d44=function(_0xd9706e,_0x272e1c){_0xd9706e=_0xd9706e-0x0;var _0x54c7b7=_0xd440[_0xd9706e];return _0x54c7b7;};'use strict';var _=require(_0x0d44('0x0'));var http=require(_0x0d44('0x1'));var express=require(_0x0d44('0x2'));var sticky=require(_0x0d44('0x3'));var Redis=require(_0x0d44('0x4'));var config=require(_0x0d44('0x5'));var app=express();var server=http['createServer'](app);server[_0x0d44('0x6')]=0xdbba0;if(sticky[_0x0d44('0x7')](server,config[_0x0d44('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0x0d44('0x9'),'polling']});config[_0x0d44('0xa')]=_['defaults'](config[_0x0d44('0xa')],{'host':_0x0d44('0xb'),'port':0x18eb});socketio[_0x0d44('0xc')](require(_0x0d44('0xd'))({'pubClient':new Redis(config[_0x0d44('0xa')]),'subClient':new Redis(config['redis'])}));require(_0x0d44('0xe'))['default']();require(_0x0d44('0xf'))[_0x0d44('0x10')](socketio);require('../../config/express')['default'](app);require('../../routes')[_0x0d44('0x10')](app);}else{server[_0x0d44('0x11')](_0x0d44('0x12'),function(){console[_0x0d44('0x13')](_0x0d44('0x14'),config[_0x0d44('0x8')]);});}exports=module[_0x0d44('0x15')]=app; \ No newline at end of file +var _0x98f5=['../../config/triggers','default','../../config/socketio','../../config/express','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','defaults','redis','adapter'];(function(_0x377654,_0x48f224){var _0x3fa852=function(_0x23f47d){while(--_0x23f47d){_0x377654['push'](_0x377654['shift']());}};_0x3fa852(++_0x48f224);}(_0x98f5,0x160));var _0x598f=function(_0x51832d,_0x3746c5){_0x51832d=_0x51832d-0x0;var _0x455cc3=_0x98f5[_0x51832d];return _0x455cc3;};'use strict';var _=require(_0x598f('0x0'));var http=require(_0x598f('0x1'));var express=require(_0x598f('0x2'));var sticky=require(_0x598f('0x3'));var Redis=require(_0x598f('0x4'));var config=require(_0x598f('0x5'));var app=express();var server=http[_0x598f('0x6')](app);server[_0x598f('0x7')]=0xdbba0;if(sticky[_0x598f('0x8')](server,config[_0x598f('0x9')])){var socketio=require(_0x598f('0xa'))(server,{'transports':[_0x598f('0xb'),_0x598f('0xc')]});config['redis']=_[_0x598f('0xd')](config[_0x598f('0xe')],{'host':'localhost','port':0x18eb});socketio[_0x598f('0xf')](require('socket.io-redis')({'pubClient':new Redis(config[_0x598f('0xe')]),'subClient':new Redis(config[_0x598f('0xe')])}));require(_0x598f('0x10'))[_0x598f('0x11')]();require(_0x598f('0x12'))[_0x598f('0x11')](socketio);require(_0x598f('0x13'))[_0x598f('0x11')](app);require('../../routes')[_0x598f('0x11')](app);}else{server[_0x598f('0x14')](_0x598f('0x15'),function(){console['log'](_0x598f('0x16'),config[_0x598f('0x9')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 7d4235c..306c473 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 _0x3fc9=['rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','Request','request','then','debug'];(function(_0x3a6a48,_0x21d59b){var _0x2e5386=function(_0x3f8ebc){while(--_0x3f8ebc){_0x3a6a48['push'](_0x3a6a48['shift']());}};_0x2e5386(++_0x21d59b);}(_0x3fc9,0x12c));var _0x93fc=function(_0x3feccc,_0x5534c7){_0x3feccc=_0x3feccc-0x0;var _0x2c13b5=_0x3fc9[_0x3feccc];return _0x2c13b5;};'use strict';var jayson=require(_0x93fc('0x0'));var BPromise=require(_0x93fc('0x1'));var logger=require(_0x93fc('0x2'))(_0x93fc('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x93fc('0x4')]=function(_0x33d283,_0x37610e){return new BPromise(function(_0x824469,_0x4572f7){return client[_0x93fc('0x5')](_0x33d283,_0x37610e)[_0x93fc('0x6')](function(_0x14deb1){logger[_0x93fc('0x7')]('rpc',_0x93fc('0x3'),_0x33d283,_0x37610e,_0x14deb1);if(_0x14deb1['error']){logger['error'](_0x93fc('0x8'),_0x93fc('0x3'),_0x33d283,_0x14deb1[_0x93fc('0x9')][_0x93fc('0xa')],_0x37610e);return _0x4572f7(_0x14deb1[_0x93fc('0x9')][_0x93fc('0xa')]);}else{return _0x824469(_0x14deb1[_0x93fc('0xb')]);}})[_0x93fc('0xc')](function(_0x3f66ca){logger[_0x93fc('0x9')]('rpc',_0x93fc('0x3'),_0x33d283,_0x3f66ca,_0x37610e);return _0x4572f7(_0x3f66ca);});});};module[_0x93fc('0xd')]=client; \ No newline at end of file +var _0x1765=['client','request','then','error','rpc','message','result','jayson/promise','bluebird','routing'];(function(_0x24af20,_0xb1b03b){var _0x20bbc5=function(_0x11d66c){while(--_0x11d66c){_0x24af20['push'](_0x24af20['shift']());}};_0x20bbc5(++_0xb1b03b);}(_0x1765,0x133));var _0x5176=function(_0x5cbace,_0x33943c){_0x5cbace=_0x5cbace-0x0;var _0x6de5b8=_0x1765[_0x5cbace];return _0x6de5b8;};'use strict';var jayson=require(_0x5176('0x0'));var BPromise=require(_0x5176('0x1'));var logger=require('../../config/logger')(_0x5176('0x2'));var client=jayson[_0x5176('0x3')]['http']({'port':0x2329});client['Request']=function(_0x470d75,_0x3cc905){return new BPromise(function(_0x309ce7,_0x3b8449){return client[_0x5176('0x4')](_0x470d75,_0x3cc905)[_0x5176('0x5')](function(_0x572136){logger['debug']('rpc',_0x5176('0x2'),_0x470d75,_0x3cc905,_0x572136);if(_0x572136[_0x5176('0x6')]){logger[_0x5176('0x6')](_0x5176('0x7'),'routing',_0x470d75,_0x572136['error'][_0x5176('0x8')],_0x3cc905);return _0x3b8449(_0x572136[_0x5176('0x6')][_0x5176('0x8')]);}else{return _0x309ce7(_0x572136[_0x5176('0x9')]);}})['catch'](function(_0x33ea4b){logger[_0x5176('0x6')]('rpc',_0x5176('0x2'),_0x470d75,_0x33ea4b,_0x3cc905);return _0x3b8449(_0x33ea4b);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 9f7050d..8a2f63a 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 _0xbc51=['initWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','getAgents','initAgents','then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues'];(function(_0x1fb197,_0x2a09f8){var _0x254c10=function(_0x5cd3f8){while(--_0x5cd3f8){_0x1fb197['push'](_0x1fb197['shift']());}};_0x254c10(++_0x2a09f8);}(_0xbc51,0x117));var _0x1bc5=function(_0x4c2f30,_0xa91340){_0x4c2f30=_0x4c2f30-0x0;var _0xb8854d=_0xbc51[_0x4c2f30];return _0xb8854d;};'use strict';var BPromise=require('bluebird');var server=require(_0x1bc5('0x0'));var Realtime=require(_0x1bc5('0x1'));var user=require(_0x1bc5('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x1bc5('0x3'));var chatQueue=require(_0x1bc5('0x4'));var smsQueue=require(_0x1bc5('0x5'));var mailQueue=require(_0x1bc5('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user[_0x1bc5('0x7')]())['then'](realtime[_0x1bc5('0x8')]())[_0x1bc5('0x9')](interval[_0x1bc5('0xa')]())[_0x1bc5('0x9')](realtime[_0x1bc5('0xb')]())[_0x1bc5('0x9')](openchannelQueue[_0x1bc5('0xc')]())['then'](realtime[_0x1bc5('0xd')]())[_0x1bc5('0x9')](chatQueue['getChatQueues']())[_0x1bc5('0x9')](realtime[_0x1bc5('0xe')]())['then'](smsQueue[_0x1bc5('0xf')]())[_0x1bc5('0x9')](realtime['initSmsQueues']())['then'](mailQueue[_0x1bc5('0x10')]())['then'](realtime[_0x1bc5('0x11')]())[_0x1bc5('0x9')](faxQueue[_0x1bc5('0x12')]())['then'](realtime[_0x1bc5('0x13')]())[_0x1bc5('0x9')](whatsappQueue[_0x1bc5('0x14')]())[_0x1bc5('0x9')](realtime[_0x1bc5('0x15')]())[_0x1bc5('0x9')](function(){return realtime;});}function main(){return server[_0x1bc5('0x16')](realtime)[_0x1bc5('0x9')](function(_0x4646a2){return initRealtime();})[_0x1bc5('0x9')](function(_0x1c1446){return setInterval(initRealtime,0x1388);})[_0x1bc5('0x17')](function(_0x46d503){console[_0x1bc5('0x18')](_0x46d503);});}main(); \ No newline at end of file +var _0x0671=['then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','listen','bluebird','./server','./realtime','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','resolve'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0671,0x19c));var _0x1067=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0671[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x1067('0x0'));var server=require(_0x1067('0x1'));var Realtime=require(_0x1067('0x2'));var user=require('./rpc/user');var interval=require(_0x1067('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x1067('0x4'));var smsQueue=require(_0x1067('0x5'));var mailQueue=require(_0x1067('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x1067('0x7')]()[_0x1067('0x8')](user['getAgents']())[_0x1067('0x8')](realtime[_0x1067('0x9')]())[_0x1067('0x8')](interval[_0x1067('0xa')]())['then'](realtime[_0x1067('0xb')]())[_0x1067('0x8')](openchannelQueue[_0x1067('0xc')]())[_0x1067('0x8')](realtime['initOpenchannelQueues']())['then'](chatQueue[_0x1067('0xd')]())['then'](realtime['initChatQueues']())[_0x1067('0x8')](smsQueue[_0x1067('0xe')]())['then'](realtime[_0x1067('0xf')]())['then'](mailQueue[_0x1067('0x10')]())[_0x1067('0x8')](realtime[_0x1067('0x11')]())[_0x1067('0x8')](faxQueue['getFaxQueues']())['then'](realtime[_0x1067('0x12')]())[_0x1067('0x8')](whatsappQueue[_0x1067('0x13')]())['then'](realtime['initWhatsappQueues']())[_0x1067('0x8')](function(){return realtime;});}function main(){return server[_0x1067('0x14')](realtime)['then'](function(_0x17c384){return initRealtime();})[_0x1067('0x8')](function(_0x4d48bc){return setInterval(initRealtime,0x1388);})['catch'](function(_0x34af59){console['log'](_0x34af59);});}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 91e5bb4..df92324 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 _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x2d0012,_0x86a59a){var _0x221577=function(_0x3406e9){while(--_0x3406e9){_0x2d0012['push'](_0x2d0012['shift']());}};_0x221577(++_0x86a59a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc4aa[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x2b808c,_0x1083b7){var _0x355725=function(_0x4c5e3c){while(--_0x4c5e3c){_0x2b808c['push'](_0x2b808c['shift']());}};_0x355725(++_0x1083b7);}(_0xe14b,0x93));var _0xbe14=function(_0x3c157f,_0x25bb5b){_0x3c157f=_0x3c157f-0x0;var _0x2dbe37=_0xe14b[_0x3c157f];return _0x2dbe37;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index d852f1a..d63bfd0 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 _0x8e57=['bluebird','jayson/promise','request','then','error','message','result','sendMailMessage','SendMail'];(function(_0x18ac3f,_0x386630){var _0x4c6563=function(_0xcc161f){while(--_0xcc161f){_0x18ac3f['push'](_0x18ac3f['shift']());}};_0x4c6563(++_0x386630);}(_0x8e57,0x6c));var _0x78e5=function(_0x125ab5,_0x3bd65b){_0x125ab5=_0x125ab5-0x0;var _0x4a34f6=_0x8e57[_0x125ab5];return _0x4a34f6;};'use strict';var BPromise=require(_0x78e5('0x0'));var jayson=require(_0x78e5('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x5ad184,_0x14f84f){return new BPromise(function(_0x19276d,_0x4b12ad){return client[_0x78e5('0x2')](_0x5ad184,_0x14f84f)[_0x78e5('0x3')](function(_0x44d906){if(_0x44d906[_0x78e5('0x4')]){return _0x4b12ad(_0x44d906[_0x78e5('0x4')][_0x78e5('0x5')]);}else{return _0x19276d(_0x44d906[_0x78e5('0x6')]);}})['catch'](function(_0x2be9d0){return _0x4b12ad(_0x2be9d0);});});}exports[_0x78e5('0x7')]=function(_0x2fd251,_0x27b5e4){return request(_0x78e5('0x8'),{'account':_0x2fd251,'message':_0x27b5e4});}; \ No newline at end of file +var _0xddc4=['bluebird','jayson/promise','client','then','error','message','result','catch','sendMailMessage','SendMail'];(function(_0x4424c6,_0x251b24){var _0x13f670=function(_0x1c961e){while(--_0x1c961e){_0x4424c6['push'](_0x4424c6['shift']());}};_0x13f670(++_0x251b24);}(_0xddc4,0x1f4));var _0x4ddc=function(_0x5fb67e,_0x2322da){_0x5fb67e=_0x5fb67e-0x0;var _0xc2ce46=_0xddc4[_0x5fb67e];return _0xc2ce46;};'use strict';var BPromise=require(_0x4ddc('0x0'));var jayson=require(_0x4ddc('0x1'));var client=jayson[_0x4ddc('0x2')]['http']({'port':0x232b});function request(_0x5c4757,_0x1adf9b){return new BPromise(function(_0x3b0c86,_0x3a6feb){return client['request'](_0x5c4757,_0x1adf9b)[_0x4ddc('0x3')](function(_0x19ecfc){if(_0x19ecfc['error']){return _0x3a6feb(_0x19ecfc[_0x4ddc('0x4')][_0x4ddc('0x5')]);}else{return _0x3b0c86(_0x19ecfc[_0x4ddc('0x6')]);}})[_0x4ddc('0x7')](function(_0x4d52a9){return _0x3a6feb(_0x4d52a9);});});}exports[_0x4ddc('0x8')]=function(_0x5e0730,_0xb0bc46){return request(_0x4ddc('0x9'),{'account':_0x5e0730,'message':_0xb0bc46});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 00e510c..d8c7fd8 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 _0x0490=['whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busy','busyQueue','md5','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','whatsapp','length','getChannelStatus','StatusTime','format','Status','mailStatus','smsStatusTime','openchannelStatusTime','openchannelCurrentCapacity','stringify','emit','user:save','moment','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus'];(function(_0x2f2e22,_0x155b32){var _0x18589d=function(_0x4ffa20){while(--_0x4ffa20){_0x2f2e22['push'](_0x2f2e22['shift']());}};_0x18589d(++_0x155b32);}(_0x0490,0x147));var _0x0049=function(_0xa50975,_0x50bff1){_0xa50975=_0xa50975-0x0;var _0x4779c9=_0x0490[_0xa50975];return _0x4779c9;};'use strict';var _=require('lodash');var moment=require(_0x0049('0x0'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x0049('0x1')](config[_0x0049('0x2')],{'host':_0x0049('0x3'),'port':0x18eb});var io=require(_0x0049('0x4'))(new Redis(config[_0x0049('0x2')]));function Agent(_0x4a59b9){this['id']=_0x4a59b9['id']||0x0;this[_0x0049('0x5')]=_0x4a59b9[_0x0049('0x5')]||'';this[_0x0049('0x6')]=_0x4a59b9['online']||!![];this[_0x0049('0x7')]=_0x4a59b9[_0x0049('0x7')]||![];this[_0x0049('0x8')]=_0x4a59b9['chatPause']||![];this[_0x0049('0x9')]=_0x4a59b9[_0x0049('0x9')]||![];this[_0x0049('0xa')]=_0x4a59b9[_0x0049('0xa')]||![];this[_0x0049('0xb')]=_0x4a59b9[_0x0049('0xb')]||![];this[_0x0049('0xc')]=_0x4a59b9[_0x0049('0xc')]||![];this[_0x0049('0xd')]='unknown';this[_0x0049('0xe')]=0x0;this[_0x0049('0xf')]=_0x4a59b9[_0x0049('0xf')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0x0049('0x10');this[_0x0049('0x11')]=0x0;this[_0x0049('0x12')]=_0x4a59b9[_0x0049('0x12')]||0x0;this[_0x0049('0x13')]=0x0;this['faxStatus']=_0x0049('0x10');this[_0x0049('0x14')]=0x0;this['faxCapacity']=_0x4a59b9[_0x0049('0x15')]||0x0;this[_0x0049('0x16')]=0x0;this[_0x0049('0x17')]=_0x0049('0x10');this['smsStatusTime']=0x0;this['smsCapacity']=_0x4a59b9[_0x0049('0x18')]||0x0;this[_0x0049('0x19')]=0x0;this[_0x0049('0x1a')]=_0x0049('0x10');this[_0x0049('0x1b')]=0x0;this[_0x0049('0x1c')]=_0x4a59b9[_0x0049('0x1c')]||0x0;this[_0x0049('0x1d')]=0x0;this[_0x0049('0x1e')]=_0x0049('0x10');this['openchannelStatusTime']=0x0;this[_0x0049('0x1f')]=_0x4a59b9[_0x0049('0x1f')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x0049('0x20')]=![];this[_0x0049('0x21')]=undefined;this[_0x0049('0x22')]='';this[_0x0049('0x23')]();}Agent[_0x0049('0x24')]['getChannelStatus']=function(_0x26a9fb){if(this[_0x26a9fb+_0x0049('0x25')]>0x0){if(this[_0x26a9fb+'Capacity']>0x0&&this[_0x26a9fb+_0x0049('0x25')]>=this[_0x26a9fb+_0x0049('0x26')]){return _0x0049('0x27');}else{return _0x0049('0x28');}}else{return _0x0049('0x29');}};Agent[_0x0049('0x24')][_0x0049('0x23')]=function(){var _0x457bb3=[_0x0049('0x2a'),_0x0049('0x2b'),_0x0049('0x2c'),_0x0049('0x2d'),'sms',_0x0049('0x2e')];for(var _0x2813d2=0x0;_0x2813d2<_0x457bb3[_0x0049('0x2f')];_0x2813d2+=0x1){var _0x118bc0=this[_0x0049('0x30')](_0x457bb3[_0x2813d2]);if(this[_0x457bb3[_0x2813d2]+'Status']!==_0x118bc0){this[_0x457bb3[_0x2813d2]+_0x0049('0x31')]=_['toNumber'](moment()[_0x0049('0x32')]('x'));}this[_0x457bb3[_0x2813d2]+_0x0049('0x33')]=_0x118bc0;}var _0x450698={'id':this['id'],'name':this[_0x0049('0x5')],'online':this['online'],'voicePause':this[_0x0049('0x7')],'chatPause':this[_0x0049('0x8')],'mailPause':this[_0x0049('0x9')],'smsPause':this[_0x0049('0xb')],'faxPause':this[_0x0049('0xa')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x0049('0xd')],'chatStatusTime':this[_0x0049('0xe')],'chatCapacity':this[_0x0049('0xf')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x0049('0x34')],'mailStatusTime':this[_0x0049('0x11')],'mailCapacity':this[_0x0049('0x12')],'mailCurrentCapacity':this[_0x0049('0x13')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x0049('0x14')],'faxCapacity':this[_0x0049('0x15')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x0049('0x17')],'smsStatusTime':this[_0x0049('0x35')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x0049('0x19')],'whatsappStatus':this[_0x0049('0x1a')],'whatsappStatusTime':this[_0x0049('0x1b')],'whatsappCapacity':this[_0x0049('0x1c')],'whatsappCurrentCapacity':this[_0x0049('0x1d')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x0049('0x36')],'openchannelCapacity':this[_0x0049('0x1f')],'openchannelCurrentCapacity':this[_0x0049('0x37')],'busy':this[_0x0049('0x20')],'busyQueue':this[_0x0049('0x21')]};var _0x5bdc33=md5(JSON[_0x0049('0x38')](_0x450698));if(this['md5']!==_0x5bdc33){this[_0x0049('0x22')]=_0x5bdc33;io[_0x0049('0x39')](_0x0049('0x3a'),_0x450698);}};module['exports']=Agent; \ No newline at end of file +var _0x83f2=['openchannelCapacity','openchannelCurrentCapacity','busyQueue','md5','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','chat','whatsapp','length','Status','StatusTime','toNumber','chatStatusTime','smsStatus','busy','emit','user:save','exports','moment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime'];(function(_0x142f0a,_0x90d4c6){var _0x148f4a=function(_0x149a95){while(--_0x149a95){_0x142f0a['push'](_0x142f0a['shift']());}};_0x148f4a(++_0x90d4c6);}(_0x83f2,0x87));var _0x283f=function(_0x317f68,_0x183db2){_0x317f68=_0x317f68-0x0;var _0x2662c9=_0x83f2[_0x317f68];return _0x2662c9;};'use strict';var _=require('lodash');var moment=require(_0x283f('0x0'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x283f('0x1')]=_[_0x283f('0x2')](config[_0x283f('0x1')],{'host':_0x283f('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x3039ff){this['id']=_0x3039ff['id']||0x0;this[_0x283f('0x4')]=_0x3039ff[_0x283f('0x4')]||'';this['online']=_0x3039ff[_0x283f('0x5')]||!![];this[_0x283f('0x6')]=_0x3039ff[_0x283f('0x6')]||![];this[_0x283f('0x7')]=_0x3039ff[_0x283f('0x7')]||![];this[_0x283f('0x8')]=_0x3039ff[_0x283f('0x8')]||![];this[_0x283f('0x9')]=_0x3039ff['faxPause']||![];this['smsPause']=_0x3039ff[_0x283f('0xa')]||![];this['openchannelPause']=_0x3039ff[_0x283f('0xb')]||![];this[_0x283f('0xc')]='unknown';this['chatStatusTime']=0x0;this[_0x283f('0xd')]=_0x3039ff[_0x283f('0xd')]||0x0;this[_0x283f('0xe')]=0x0;this[_0x283f('0xf')]=_0x283f('0x10');this[_0x283f('0x11')]=0x0;this[_0x283f('0x12')]=_0x3039ff['mailCapacity']||0x0;this[_0x283f('0x13')]=0x0;this[_0x283f('0x14')]=_0x283f('0x10');this[_0x283f('0x15')]=0x0;this[_0x283f('0x16')]=_0x3039ff['faxCapacity']||0x0;this[_0x283f('0x17')]=0x0;this['smsStatus']=_0x283f('0x10');this[_0x283f('0x18')]=0x0;this[_0x283f('0x19')]=_0x3039ff['smsCapacity']||0x0;this[_0x283f('0x1a')]=0x0;this[_0x283f('0x1b')]='unknown';this[_0x283f('0x1c')]=0x0;this[_0x283f('0x1d')]=_0x3039ff[_0x283f('0x1d')]||0x0;this[_0x283f('0x1e')]=0x0;this[_0x283f('0x1f')]=_0x283f('0x10');this[_0x283f('0x20')]=0x0;this[_0x283f('0x21')]=_0x3039ff[_0x283f('0x21')]||0x0;this[_0x283f('0x22')]=0x0;this['busy']=![];this[_0x283f('0x23')]=undefined;this[_0x283f('0x24')]='';this[_0x283f('0x25')]();}Agent['prototype'][_0x283f('0x26')]=function(_0x531da8){if(this[_0x531da8+_0x283f('0x27')]>0x0){if(this[_0x531da8+_0x283f('0x28')]>0x0&&this[_0x531da8+_0x283f('0x27')]>=this[_0x531da8+'Capacity']){return'maxcapacity';}else{return _0x283f('0x29');}}else{return _0x283f('0x2a');}};Agent['prototype'][_0x283f('0x25')]=function(){var _0x1f3469=[_0x283f('0x2b'),_0x283f('0x2c'),'openchannel','fax','sms',_0x283f('0x2d')];for(var _0x662aca=0x0;_0x662aca<_0x1f3469[_0x283f('0x2e')];_0x662aca+=0x1){var _0x373914=this[_0x283f('0x26')](_0x1f3469[_0x662aca]);if(this[_0x1f3469[_0x662aca]+_0x283f('0x2f')]!==_0x373914){this[_0x1f3469[_0x662aca]+_0x283f('0x30')]=_[_0x283f('0x31')](moment()['format']('x'));}this[_0x1f3469[_0x662aca]+_0x283f('0x2f')]=_0x373914;}var _0x17d583={'id':this['id'],'name':this[_0x283f('0x4')],'online':this[_0x283f('0x5')],'voicePause':this[_0x283f('0x6')],'chatPause':this['chatPause'],'mailPause':this[_0x283f('0x8')],'smsPause':this[_0x283f('0xa')],'faxPause':this['faxPause'],'openchannelPause':this[_0x283f('0xb')],'chatStatus':this[_0x283f('0xc')],'chatStatusTime':this[_0x283f('0x32')],'chatCapacity':this[_0x283f('0xd')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x283f('0x11')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x283f('0x13')],'faxStatus':this[_0x283f('0x14')],'faxStatusTime':this[_0x283f('0x15')],'faxCapacity':this[_0x283f('0x16')],'faxCurrentCapacity':this[_0x283f('0x17')],'smsStatus':this[_0x283f('0x33')],'smsStatusTime':this[_0x283f('0x18')],'smsCapacity':this[_0x283f('0x19')],'smsCurrentCapacity':this[_0x283f('0x1a')],'whatsappStatus':this[_0x283f('0x1b')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x283f('0x1d')],'whatsappCurrentCapacity':this[_0x283f('0x1e')],'openchannelStatus':this[_0x283f('0x1f')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x283f('0x21')],'openchannelCurrentCapacity':this[_0x283f('0x22')],'busy':this[_0x283f('0x34')],'busyQueue':this[_0x283f('0x23')]};var _0x29fe61=md5(JSON['stringify'](_0x17d583));if(this[_0x283f('0x24')]!==_0x29fe61){this['md5']=_0x29fe61;io[_0x283f('0x35')](_0x283f('0x36'),_0x17d583);}};module[_0x283f('0x37')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 4eac524..6d0b0a2 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 _0xda09=['length','online','loggedIn','available','format','chat:queue:%s','emit','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xda09,0xf0));var _0x9da0=function(_0x43d663,_0x483e9d){_0x43d663=_0x43d663-0x0;var _0x54f3d5=_0xda09[_0x43d663];return _0x54f3d5;};'use strict';var _=require(_0x9da0('0x0'));var md5=require(_0x9da0('0x1'));var util=require(_0x9da0('0x2'));var Redis=require(_0x9da0('0x3'));var config=require(_0x9da0('0x4'));config['redis']=_['defaults'](config[_0x9da0('0x5')],{'host':_0x9da0('0x6'),'port':0x18eb});var io=require(_0x9da0('0x7'))(new Redis(config[_0x9da0('0x5')]));function ChatQueue(_0x1a7215){this['id']=_0x1a7215['id']||0x0;this[_0x9da0('0x8')]=_0x1a7215[_0x9da0('0x8')]||'';this[_0x9da0('0x9')]=_0x1a7215['timeout']||0xa;this[_0x9da0('0xa')]=_0x1a7215[_0x9da0('0xa')]||_0x9da0('0xb');this[_0x9da0('0xc')]=_0x1a7215[_0x9da0('0xc')];this[_0x9da0('0xd')]={};this[_0x9da0('0xe')]=0x0;this[_0x9da0('0x1')]='';this[_0x9da0('0xf')]();this[_0x9da0('0x10')]();}ChatQueue[_0x9da0('0x11')][_0x9da0('0xf')]=function(){var _0x39b999=this[_0x9da0('0xd')][_0x9da0('0x12')];this[_0x9da0('0xd')]=_[_0x9da0('0x13')](this['Agents'],'id');this[_0x9da0('0xd')][_0x9da0('0x12')]=_0x39b999;};ChatQueue[_0x9da0('0x11')][_0x9da0('0x10')]=function(){this['loggedIn']=0x0;this[_0x9da0('0x14')]=0x0;for(var _0x5ccac2=0x0;_0x5ccac2=0x0?this[_0x9da0('0x18')]:0x0;var _0x3f071a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9da0('0x17')],'name':this[_0x9da0('0x8')],'paused':this['paused'],'waiting':this[_0x9da0('0xe')]};var _0x2928c6=md5(JSON['stringify'](_0x3f071a));if(this['md5']!==_0x2928c6){this[_0x9da0('0x1')]=_0x2928c6;io['to'](util[_0x9da0('0x19')](_0x9da0('0x1a'),_0x3f071a[_0x9da0('0x8')]))[_0x9da0('0x1b')](_0x9da0('0x1c'),_0x3f071a);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xa316=['waiting','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','online','chatPause','available','paused','name','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','Agents','mapAgentsId'];(function(_0x1c2f29,_0x5a2668){var _0x258465=function(_0x30332f){while(--_0x30332f){_0x1c2f29['push'](_0x1c2f29['shift']());}};_0x258465(++_0x5a2668);}(_0xa316,0x15c));var _0x6a31=function(_0x45006d,_0x859751){_0x45006d=_0x45006d-0x0;var _0x4115f0=_0xa316[_0x45006d];return _0x4115f0;};'use strict';var _=require(_0x6a31('0x0'));var md5=require('md5');var util=require(_0x6a31('0x1'));var Redis=require(_0x6a31('0x2'));var config=require(_0x6a31('0x3'));config[_0x6a31('0x4')]=_[_0x6a31('0x5')](config[_0x6a31('0x4')],{'host':_0x6a31('0x6'),'port':0x18eb});var io=require(_0x6a31('0x7'))(new Redis(config[_0x6a31('0x4')]));function ChatQueue(_0x4c64a1){this['id']=_0x4c64a1['id']||0x0;this['name']=_0x4c64a1['name']||'';this['timeout']=_0x4c64a1[_0x6a31('0x8')]||0xa;this[_0x6a31('0x9')]=_0x4c64a1[_0x6a31('0x9')]||'beepall';this['Agents']=_0x4c64a1[_0x6a31('0xa')];this[_0x6a31('0xb')]={};this[_0x6a31('0xc')]=0x0;this[_0x6a31('0xd')]='';this[_0x6a31('0xe')]();this[_0x6a31('0xf')]();}ChatQueue[_0x6a31('0x10')][_0x6a31('0xe')]=function(){var _0x1198ee=this[_0x6a31('0xb')][_0x6a31('0x11')];this[_0x6a31('0xb')]=_['map'](this[_0x6a31('0xa')],'id');this[_0x6a31('0xb')]['_rr']=_0x1198ee;};ChatQueue[_0x6a31('0x10')][_0x6a31('0xf')]=function(){this[_0x6a31('0x12')]=0x0;this['paused']=0x0;for(var _0x363752=0x0;_0x363752=0x0?this['available']:0x0;var _0x2290ca={'id':this['id'],'available':this[_0x6a31('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x6a31('0x18')],'paused':this[_0x6a31('0x17')],'waiting':this[_0x6a31('0xc')]};var _0x2aca88=md5(JSON[_0x6a31('0x19')](_0x2290ca));if(this[_0x6a31('0xd')]!==_0x2aca88){this['md5']=_0x2aca88;io['to'](util['format'](_0x6a31('0x1a'),_0x2290ca[_0x6a31('0x18')]))[_0x6a31('0x1b')](_0x6a31('0x1c'),_0x2290ca);}};module[_0x6a31('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 440aa4a..9be2e6e 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 _0x53a8=['ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused','length','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x53a8,0x76));var _0x853a=function(_0x2bac85,_0x11f5d4){_0x2bac85=_0x2bac85-0x0;var _0x112b88=_0x53a8[_0x2bac85];return _0x112b88;};'use strict';var _=require(_0x853a('0x0'));var md5=require(_0x853a('0x1'));var util=require('util');var Redis=require(_0x853a('0x2'));var config=require(_0x853a('0x3'));config[_0x853a('0x4')]=_[_0x853a('0x5')](config[_0x853a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x853a('0x6'))(new Redis(config[_0x853a('0x4')]));function FaxQueue(_0x489c32){this['id']=_0x489c32['id']||0x0;this[_0x853a('0x7')]=_0x489c32['name']||'';this[_0x853a('0x8')]=_0x489c32[_0x853a('0x8')]||0xa;this['strategy']=_0x489c32[_0x853a('0x9')]||_0x853a('0xa');this[_0x853a('0xb')]=_0x489c32[_0x853a('0xb')];this['mapAgentsId']={};this[_0x853a('0xc')]=0x0;this['md5']='';this[_0x853a('0xd')]();this[_0x853a('0xe')]();}FaxQueue[_0x853a('0xf')][_0x853a('0xd')]=function(){var _0x3a487a=this['mapAgentsId'][_0x853a('0x10')];this[_0x853a('0x11')]=_[_0x853a('0x12')](this[_0x853a('0xb')],'id');this[_0x853a('0x11')][_0x853a('0x10')]=_0x3a487a;};FaxQueue[_0x853a('0xf')][_0x853a('0xe')]=function(){this[_0x853a('0x13')]=0x0;this[_0x853a('0x14')]=0x0;for(var _0x10c42b=0x0;_0x10c42b=0x0?this[_0x853a('0x17')]:0x0;var _0x3a9ae8={'id':this['id'],'available':this[_0x853a('0x17')],'loggedIn':this[_0x853a('0x13')],'name':this[_0x853a('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x54ca95=md5(JSON[_0x853a('0x18')](_0x3a9ae8));if(this[_0x853a('0x1')]!==_0x54ca95){this['md5']=_0x54ca95;io['to'](util[_0x853a('0x19')](_0x853a('0x1a'),_0x3a9ae8[_0x853a('0x7')]))[_0x853a('0x1b')](_0x853a('0x1c'),_0x3a9ae8);}};module[_0x853a('0x1d')]=FaxQueue; \ No newline at end of file +var _0x5b6d=['stringify','fax:queue:%s','fax_queue:save','exports','lodash','md5','ioredis','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','available'];(function(_0x3dc51d,_0x5388d8){var _0x5485a4=function(_0x166395){while(--_0x166395){_0x3dc51d['push'](_0x3dc51d['shift']());}};_0x5485a4(++_0x5388d8);}(_0x5b6d,0x1ad));var _0xd5b6=function(_0x5e7ee9,_0x4dbc4b){_0x5e7ee9=_0x5e7ee9-0x0;var _0xadb900=_0x5b6d[_0x5e7ee9];return _0xadb900;};'use strict';var _=require(_0xd5b6('0x0'));var md5=require(_0xd5b6('0x1'));var util=require('util');var Redis=require(_0xd5b6('0x2'));var config=require('../../../config/environment');config[_0xd5b6('0x3')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd5b6('0x4'))(new Redis(config[_0xd5b6('0x3')]));function FaxQueue(_0x4eebf4){this['id']=_0x4eebf4['id']||0x0;this[_0xd5b6('0x5')]=_0x4eebf4[_0xd5b6('0x5')]||'';this[_0xd5b6('0x6')]=_0x4eebf4[_0xd5b6('0x6')]||0xa;this[_0xd5b6('0x7')]=_0x4eebf4[_0xd5b6('0x7')]||'beepall';this[_0xd5b6('0x8')]=_0x4eebf4[_0xd5b6('0x8')];this[_0xd5b6('0x9')]={};this[_0xd5b6('0xa')]=0x0;this['md5']='';this['updateRouting']();this[_0xd5b6('0xb')]();}FaxQueue[_0xd5b6('0xc')][_0xd5b6('0xd')]=function(){var _0x247b9d=this['mapAgentsId'][_0xd5b6('0xe')];this[_0xd5b6('0x9')]=_[_0xd5b6('0xf')](this[_0xd5b6('0x8')],'id');this[_0xd5b6('0x9')][_0xd5b6('0xe')]=_0x247b9d;};FaxQueue[_0xd5b6('0xc')]['updateRealtime']=function(){this[_0xd5b6('0x10')]=0x0;this[_0xd5b6('0x11')]=0x0;for(var _0x2c88ca=0x0;_0x2c88ca=0x0?this[_0xd5b6('0x14')]:0x0;var _0x46b179={'id':this['id'],'available':this[_0xd5b6('0x14')],'loggedIn':this['loggedIn'],'name':this[_0xd5b6('0x5')],'paused':this[_0xd5b6('0x11')],'waiting':this['waiting']};var _0x495301=md5(JSON[_0xd5b6('0x15')](_0x46b179));if(this['md5']!==_0x495301){this['md5']=_0x495301;io['to'](util['format'](_0xd5b6('0x16'),_0x46b179[_0xd5b6('0x5')]))['emit'](_0xd5b6('0x17'),_0x46b179);}};module[_0xd5b6('0x18')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index ebffe80..879aab3 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 _0x4ec3=['name','Intervals'];(function(_0x18733b,_0x189b90){var _0x429157=function(_0xafc0df){while(--_0xafc0df){_0x18733b['push'](_0x18733b['shift']());}};_0x429157(++_0x189b90);}(_0x4ec3,0xd0));var _0x34ec=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0x4ec3[_0x21bfab];return _0x4db318;};'use strict';function Interval(_0x348977){this['id']=_0x348977['id']||0x0;this[_0x34ec('0x0')]=_0x348977[_0x34ec('0x0')]||'';this['Intervals']=_0x348977[_0x34ec('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xa6bc=['name','Intervals','exports'];(function(_0x40f46f,_0x16bba2){var _0x9d21a=function(_0x2ad948){while(--_0x2ad948){_0x40f46f['push'](_0x40f46f['shift']());}};_0x9d21a(++_0x16bba2);}(_0xa6bc,0xa5));var _0xca6b=function(_0xc67084,_0x3e2efc){_0xc67084=_0xc67084-0x0;var _0x4d06c6=_0xa6bc[_0xc67084];return _0x4d06c6;};'use strict';function Interval(_0x4c0a8a){this['id']=_0x4c0a8a['id']||0x0;this[_0xca6b('0x0')]=_0x4c0a8a[_0xca6b('0x0')]||'';this[_0xca6b('0x1')]=_0x4c0a8a['Intervals']||{};}module[_0xca6b('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 1358e52..ba63521 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 _0xb9e5=['paused','available','format','mail:queue:%s','exports','lodash','util','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','_rr','mapAgentsId','prototype','loggedIn','length','online','mailPause'];(function(_0xea343d,_0x311197){var _0x2c6e9c=function(_0x454bd6){while(--_0x454bd6){_0xea343d['push'](_0xea343d['shift']());}};_0x2c6e9c(++_0x311197);}(_0xb9e5,0x18b));var _0x5b9e=function(_0x56feee,_0x4d26c7){_0x56feee=_0x56feee-0x0;var _0x554d3e=_0xb9e5[_0x56feee];return _0x554d3e;};'use strict';var _=require(_0x5b9e('0x0'));var md5=require('md5');var util=require(_0x5b9e('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x5b9e('0x2')],{'host':_0x5b9e('0x3'),'port':0x18eb});var io=require(_0x5b9e('0x4'))(new Redis(config[_0x5b9e('0x2')]));function MailQueue(_0x4d32f1){this['id']=_0x4d32f1['id']||0x0;this['name']=_0x4d32f1[_0x5b9e('0x5')]||'';this['timeout']=_0x4d32f1[_0x5b9e('0x6')]||0xa;this[_0x5b9e('0x7')]=_0x4d32f1[_0x5b9e('0x7')]||_0x5b9e('0x8');this[_0x5b9e('0x9')]=_0x4d32f1['Agents'];this['mapAgentsId']={};this[_0x5b9e('0xa')]=0x0;this[_0x5b9e('0xb')]='';this[_0x5b9e('0xc')]();this[_0x5b9e('0xd')]();}MailQueue['prototype']['updateRouting']=function(){var _0x4890f8=this['mapAgentsId'][_0x5b9e('0xe')];this[_0x5b9e('0xf')]=_['map'](this[_0x5b9e('0x9')],'id');this[_0x5b9e('0xf')][_0x5b9e('0xe')]=_0x4890f8;};MailQueue[_0x5b9e('0x10')][_0x5b9e('0xd')]=function(){this[_0x5b9e('0x11')]=0x0;this['paused']=0x0;for(var _0x5cb1ac=0x0;_0x5cb1ac=0x0?this[_0x5b9e('0x16')]:0x0;var _0x22dbed={'id':this['id'],'available':this[_0x5b9e('0x16')],'loggedIn':this[_0x5b9e('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x5b9e('0xa')]};var _0x558df1=md5(JSON['stringify'](_0x22dbed));if(this[_0x5b9e('0xb')]!==_0x558df1){this[_0x5b9e('0xb')]=_0x558df1;io['to'](util[_0x5b9e('0x17')](_0x5b9e('0x18'),_0x22dbed[_0x5b9e('0x5')]))['emit']('mail_queue:save',_0x22dbed);}};module[_0x5b9e('0x19')]=MailQueue; \ No newline at end of file +var _0x3759=['updateRealtime','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr'];(function(_0x25b037,_0x5cc348){var _0x2ae5a3=function(_0x57399a){while(--_0x57399a){_0x25b037['push'](_0x25b037['shift']());}};_0x2ae5a3(++_0x5cc348);}(_0x3759,0x69));var _0x9375=function(_0x18a76e,_0x162fd1){_0x18a76e=_0x18a76e-0x0;var _0x1bf17e=_0x3759[_0x18a76e];return _0x1bf17e;};'use strict';var _=require(_0x9375('0x0'));var md5=require(_0x9375('0x1'));var util=require(_0x9375('0x2'));var Redis=require(_0x9375('0x3'));var config=require(_0x9375('0x4'));config['redis']=_[_0x9375('0x5')](config[_0x9375('0x6')],{'host':_0x9375('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9375('0x6')]));function MailQueue(_0x3604aa){this['id']=_0x3604aa['id']||0x0;this[_0x9375('0x8')]=_0x3604aa[_0x9375('0x8')]||'';this[_0x9375('0x9')]=_0x3604aa[_0x9375('0x9')]||0xa;this[_0x9375('0xa')]=_0x3604aa[_0x9375('0xa')]||_0x9375('0xb');this[_0x9375('0xc')]=_0x3604aa[_0x9375('0xc')];this[_0x9375('0xd')]={};this[_0x9375('0xe')]=0x0;this['md5']='';this[_0x9375('0xf')]();this['updateRealtime']();}MailQueue[_0x9375('0x10')]['updateRouting']=function(){var _0x10f7e4=this[_0x9375('0xd')]['_rr'];this[_0x9375('0xd')]=_[_0x9375('0x11')](this[_0x9375('0xc')],'id');this['mapAgentsId'][_0x9375('0x12')]=_0x10f7e4;};MailQueue[_0x9375('0x10')][_0x9375('0x13')]=function(){this[_0x9375('0x14')]=0x0;this[_0x9375('0x15')]=0x0;for(var _0x2a079c=0x0;_0x2a079c=0x0?this[_0x9375('0x19')]:0x0;var _0x36f4e7={'id':this['id'],'available':this[_0x9375('0x19')],'loggedIn':this[_0x9375('0x14')],'name':this['name'],'paused':this[_0x9375('0x15')],'waiting':this[_0x9375('0xe')]};var _0x25b75d=md5(JSON[_0x9375('0x1a')](_0x36f4e7));if(this[_0x9375('0x1')]!==_0x25b75d){this['md5']=_0x25b75d;io['to'](util[_0x9375('0x1b')](_0x9375('0x1c'),_0x36f4e7[_0x9375('0x8')]))['emit'](_0x9375('0x1d'),_0x36f4e7);}};module[_0x9375('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 824f49f..badcdcb 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 _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(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'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 +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x49225d,_0x312d6c){var _0x2c228f=function(_0x183ff5){while(--_0x183ff5){_0x49225d['push'](_0x49225d['shift']());}};_0x2c228f(++_0x312d6c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0x5fc3[_0x4c9380];return _0x49a523;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 62f943d..919a15b 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 _0x12c9=['localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRealtime','updateRouting','_rr','map','prototype','loggedIn','online','smsPause','paused','available','waiting','stringify','format','sms:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis'];(function(_0x1c6838,_0x5d6e29){var _0x29dca3=function(_0x239c33){while(--_0x239c33){_0x1c6838['push'](_0x1c6838['shift']());}};_0x29dca3(++_0x5d6e29);}(_0x12c9,0x1c9));var _0x912c=function(_0x9e9dec,_0x54b3d4){_0x9e9dec=_0x9e9dec-0x0;var _0x253d9b=_0x12c9[_0x9e9dec];return _0x253d9b;};'use strict';var _=require(_0x912c('0x0'));var md5=require(_0x912c('0x1'));var util=require(_0x912c('0x2'));var Redis=require(_0x912c('0x3'));var config=require(_0x912c('0x4'));config['redis']=_[_0x912c('0x5')](config[_0x912c('0x6')],{'host':_0x912c('0x7'),'port':0x18eb});var io=require(_0x912c('0x8'))(new Redis(config[_0x912c('0x6')]));function SmsQueue(_0x505262){this['id']=_0x505262['id']||0x0;this['name']=_0x505262[_0x912c('0x9')]||'';this[_0x912c('0xa')]=_0x505262[_0x912c('0xa')]||0xa;this[_0x912c('0xb')]=_0x505262[_0x912c('0xb')]||'beepall';this[_0x912c('0xc')]=_0x505262['Agents'];this[_0x912c('0xd')]={};this['waiting']=0x0;this[_0x912c('0x1')]='';this['updateRouting']();this[_0x912c('0xe')]();}SmsQueue['prototype'][_0x912c('0xf')]=function(){var _0x4f16b0=this['mapAgentsId'][_0x912c('0x10')];this['mapAgentsId']=_[_0x912c('0x11')](this[_0x912c('0xc')],'id');this[_0x912c('0xd')][_0x912c('0x10')]=_0x4f16b0;};SmsQueue[_0x912c('0x12')]['updateRealtime']=function(){this[_0x912c('0x13')]=0x0;this['paused']=0x0;for(var _0x28cdb4=0x0;_0x28cdb4=0x0?this[_0x912c('0x17')]:0x0;var _0x32fb2e={'id':this['id'],'available':this[_0x912c('0x17')],'loggedIn':this[_0x912c('0x13')],'name':this[_0x912c('0x9')],'paused':this[_0x912c('0x16')],'waiting':this[_0x912c('0x18')]};var _0x272010=md5(JSON[_0x912c('0x19')](_0x32fb2e));if(this['md5']!==_0x272010){this['md5']=_0x272010;io['to'](util[_0x912c('0x1a')](_0x912c('0x1b'),_0x32fb2e['name']))['emit']('sms_queue:save',_0x32fb2e);}};module[_0x912c('0x1c')]=SmsQueue; \ No newline at end of file +var _0xc36d=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','available','format','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0xc36d,0x7d));var _0xdc36=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xc36d[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xdc36('0x0'));var md5=require(_0xdc36('0x1'));var util=require(_0xdc36('0x2'));var Redis=require(_0xdc36('0x3'));var config=require(_0xdc36('0x4'));config[_0xdc36('0x5')]=_['defaults'](config[_0xdc36('0x5')],{'host':_0xdc36('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdc36('0x5')]));function SmsQueue(_0xbc5223){this['id']=_0xbc5223['id']||0x0;this[_0xdc36('0x7')]=_0xbc5223[_0xdc36('0x7')]||'';this[_0xdc36('0x8')]=_0xbc5223['timeout']||0xa;this[_0xdc36('0x9')]=_0xbc5223[_0xdc36('0x9')]||_0xdc36('0xa');this[_0xdc36('0xb')]=_0xbc5223['Agents'];this[_0xdc36('0xc')]={};this[_0xdc36('0xd')]=0x0;this['md5']='';this[_0xdc36('0xe')]();this[_0xdc36('0xf')]();}SmsQueue[_0xdc36('0x10')]['updateRouting']=function(){var _0x251189=this[_0xdc36('0xc')]['_rr'];this['mapAgentsId']=_[_0xdc36('0x11')](this[_0xdc36('0xb')],'id');this[_0xdc36('0xc')][_0xdc36('0x12')]=_0x251189;};SmsQueue['prototype'][_0xdc36('0xf')]=function(){this[_0xdc36('0x13')]=0x0;this[_0xdc36('0x14')]=0x0;for(var _0xae6ad3=0x0;_0xae6ad3=0x0?this[_0xdc36('0x17')]:0x0;var _0x160d70={'id':this['id'],'available':this[_0xdc36('0x17')],'loggedIn':this[_0xdc36('0x13')],'name':this[_0xdc36('0x7')],'paused':this['paused'],'waiting':this[_0xdc36('0xd')]};var _0x12d4bf=md5(JSON['stringify'](_0x160d70));if(this[_0xdc36('0x1')]!==_0x12d4bf){this[_0xdc36('0x1')]=_0x12d4bf;io['to'](util[_0xdc36('0x18')]('sms:queue:%s',_0x160d70[_0xdc36('0x7')]))[_0xdc36('0x19')]('sms_queue:save',_0x160d70);}};module[_0xdc36('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 0d58b7d..a386db4 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 _0x0209=['prototype','_rr','map','paused','online','loggedIn','whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x18f242,_0xd717b6){var _0x3b429f=function(_0x2b6283){while(--_0x2b6283){_0x18f242['push'](_0x18f242['shift']());}};_0x3b429f(++_0xd717b6);}(_0x0209,0x1dd));var _0x9020=function(_0x466701,_0x39a5d4){_0x466701=_0x466701-0x0;var _0x1e0e89=_0x0209[_0x466701];return _0x1e0e89;};'use strict';var _=require(_0x9020('0x0'));var md5=require(_0x9020('0x1'));var util=require(_0x9020('0x2'));var Redis=require('ioredis');var config=require(_0x9020('0x3'));config[_0x9020('0x4')]=_[_0x9020('0x5')](config[_0x9020('0x4')],{'host':_0x9020('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9020('0x4')]));function WhatsappQueue(_0x27af98){this['id']=_0x27af98['id']||0x0;this['name']=_0x27af98[_0x9020('0x7')]||'';this[_0x9020('0x8')]=_0x27af98[_0x9020('0x8')]||0xa;this[_0x9020('0x9')]=_0x27af98[_0x9020('0x9')]||_0x9020('0xa');this[_0x9020('0xb')]=_0x27af98[_0x9020('0xb')];this[_0x9020('0xc')]={};this[_0x9020('0xd')]=0x0;this['md5']='';this[_0x9020('0xe')]();this[_0x9020('0xf')]();}WhatsappQueue[_0x9020('0x10')][_0x9020('0xe')]=function(){var _0x7ac92c=this['mapAgentsId'][_0x9020('0x11')];this[_0x9020('0xc')]=_[_0x9020('0x12')](this[_0x9020('0xb')],'id');this[_0x9020('0xc')][_0x9020('0x11')]=_0x7ac92c;};WhatsappQueue[_0x9020('0x10')][_0x9020('0xf')]=function(){this['loggedIn']=0x0;this[_0x9020('0x13')]=0x0;for(var _0x5c6ac7=0x0;_0x5c6ac7=0x0?this[_0x9020('0x17')]:0x0;var _0x3b107a={'id':this['id'],'available':this[_0x9020('0x17')],'loggedIn':this[_0x9020('0x15')],'name':this[_0x9020('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x1c428a=md5(JSON[_0x9020('0x18')](_0x3b107a));if(this[_0x9020('0x1')]!==_0x1c428a){this[_0x9020('0x1')]=_0x1c428a;io['to'](util['format'](_0x9020('0x19'),_0x3b107a[_0x9020('0x7')]))[_0x9020('0x1a')](_0x9020('0x1b'),_0x3b107a);}};module[_0x9020('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0xe053=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','whatsappPause','available','md5','format','emit','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x4f964a,_0x41f80b){var _0x22142b=function(_0x2c969c){while(--_0x2c969c){_0x4f964a['push'](_0x4f964a['shift']());}};_0x22142b(++_0x41f80b);}(_0xe053,0x64));var _0x3e05=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0xe053[_0x5a2285];return _0x48f6ed;};'use strict';var _=require(_0x3e05('0x0'));var md5=require('md5');var util=require(_0x3e05('0x1'));var Redis=require(_0x3e05('0x2'));var config=require(_0x3e05('0x3'));config[_0x3e05('0x4')]=_[_0x3e05('0x5')](config[_0x3e05('0x4')],{'host':_0x3e05('0x6'),'port':0x18eb});var io=require(_0x3e05('0x7'))(new Redis(config[_0x3e05('0x4')]));function WhatsappQueue(_0x27b586){this['id']=_0x27b586['id']||0x0;this[_0x3e05('0x8')]=_0x27b586['name']||'';this[_0x3e05('0x9')]=_0x27b586[_0x3e05('0x9')]||0xa;this[_0x3e05('0xa')]=_0x27b586['strategy']||_0x3e05('0xb');this[_0x3e05('0xc')]=_0x27b586[_0x3e05('0xc')];this[_0x3e05('0xd')]={};this[_0x3e05('0xe')]=0x0;this['md5']='';this[_0x3e05('0xf')]();this[_0x3e05('0x10')]();}WhatsappQueue[_0x3e05('0x11')][_0x3e05('0xf')]=function(){var _0x468c08=this['mapAgentsId'][_0x3e05('0x12')];this[_0x3e05('0xd')]=_['map'](this['Agents'],'id');this[_0x3e05('0xd')]['_rr']=_0x468c08;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0x3e05('0x13')]=0x0;this[_0x3e05('0x14')]=0x0;for(var _0x6b53f3=0x0;_0x6b53f3=0x0?this[_0x3e05('0x17')]:0x0;var _0x3e3c27={'id':this['id'],'available':this[_0x3e05('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x3e05('0x8')],'paused':this[_0x3e05('0x14')],'waiting':this[_0x3e05('0xe')]};var _0x435e70=md5(JSON['stringify'](_0x3e3c27));if(this[_0x3e05('0x18')]!==_0x435e70){this[_0x3e05('0x18')]=_0x435e70;io['to'](util[_0x3e05('0x19')]('whatsapp:queue:%s',_0x3e3c27['name']))[_0x3e05('0x1a')]('whatsapp_queue:save',_0x3e3c27);}};module[_0x3e05('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 21d7f02..1eec635 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(_0x38b76b,_0x1327c0){var _0x44cb63=function(_0x5c95d7){while(--_0x5c95d7){_0x38b76b['push'](_0x38b76b['shift']());}};_0x44cb63(++_0x1327c0);}(_0xb10b,0x12a));var _0xbb10=function(_0x14474a,_0x5be492){_0x14474a=_0x14474a-0x0;var _0x1f8b71=_0xb10b[_0x14474a];return _0x1f8b71;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x2e0621,_0x396248){var _0x21aee4=function(_0x2df122){while(--_0x2df122){_0x2e0621['push'](_0x2e0621['shift']());}};_0x21aee4(++_0x396248);}(_0xb10b,0x12a));var _0xbb10=function(_0x34967e,_0x11f483){_0x34967e=_0x34967e-0x0;var _0x406971=_0xb10b[_0x34967e];return _0x406971;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 69c4ca3..52a9bf8 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 _0xe2d5=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe2d5,0xcb));var _0x5e2d=function(_0x5d1e69,_0x509003){_0x5d1e69=_0x5d1e69-0x0;var _0x582d72=_0xe2d5[_0x5d1e69];return _0x582d72;};'use strict';var client=require(_0x5e2d('0x0'));exports[_0x5e2d('0x1')]=function(_0xdbd63e,_0x3d9a24){return client[_0x5e2d('0x2')](_0x5e2d('0x3'),{'body':_0x3d9a24,'options':{'where':{'id':_0xdbd63e}},'log':_0x5e2d('0x4')});};exports[_0x5e2d('0x5')]=function(_0x531dd4,_0x43ff8c){return client[_0x5e2d('0x2')](_0x5e2d('0x6'),{'body':_0x43ff8c,'options':{'where':{'id':_0x531dd4}},'log':_0x5e2d('0x7')});}; \ No newline at end of file +var _0x75c7=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction'];(function(_0x35d5a9,_0xdd93ae){var _0xa89a37=function(_0x6eb44e){while(--_0x6eb44e){_0x35d5a9['push'](_0x35d5a9['shift']());}};_0xa89a37(++_0xdd93ae);}(_0x75c7,0x104));var _0x775c=function(_0xe583a6,_0x4e6939){_0xe583a6=_0xe583a6-0x0;var _0x4af66f=_0x75c7[_0xe583a6];return _0x4af66f;};'use strict';var client=require(_0x775c('0x0'));exports[_0x775c('0x1')]=function(_0x4c9796,_0x2c277b){return client[_0x775c('0x2')](_0x775c('0x3'),{'body':_0x2c277b,'options':{'where':{'id':_0x4c9796}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x2aca77,_0x158c56){return client['Request'](_0x775c('0x4'),{'body':_0x158c56,'options':{'where':{'id':_0x2aca77}},'log':_0x775c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index c31e499..132ef09 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 _0x1fc2=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x8e73a6,_0x1bcb3b){var _0x257d5c=function(_0x53015d){while(--_0x53015d){_0x8e73a6['push'](_0x8e73a6['shift']());}};_0x257d5c(++_0x1bcb3b);}(_0x1fc2,0xc4));var _0x21fc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1fc2[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x21fc('0x0'));exports[_0x21fc('0x1')]=function(_0x1ab80e){return client[_0x21fc('0x2')](_0x21fc('0x3'),{'body':_0x1ab80e,'log':_0x21fc('0x4')});}; \ No newline at end of file +var _0xb98a=['create','Request','CreateChatMessage','../client'];(function(_0x23f3fe,_0x37a19c){var _0x1b1cb1=function(_0x1a96a7){while(--_0x1a96a7){_0x23f3fe['push'](_0x23f3fe['shift']());}};_0x1b1cb1(++_0x37a19c);}(_0xb98a,0xeb));var _0xab98=function(_0x49cf57,_0x428742){_0x49cf57=_0x49cf57-0x0;var _0x15eca3=_0xb98a[_0x49cf57];return _0x15eca3;};'use strict';var client=require(_0xab98('0x0'));exports[_0xab98('0x1')]=function(_0xc0608){return client[_0xab98('0x2')](_0xab98('0x3'),{'body':_0xc0608,'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 a7b4684..c155124 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 _0x35d0=['getChatQueues','GetChatQueue','name','timeout','strategy','User','Agents','online','chatPause','../client'];(function(_0x20d618,_0x53f866){var _0x9c7225=function(_0x5892f1){while(--_0x5892f1){_0x20d618['push'](_0x20d618['shift']());}};_0x9c7225(++_0x53f866);}(_0x35d0,0xf9));var _0x035d=function(_0x57cbfb,_0x2de760){_0x57cbfb=_0x57cbfb-0x0;var _0x4cb933=_0x35d0[_0x57cbfb];return _0x4cb933;};'use strict';var client=require(_0x035d('0x0'));exports[_0x035d('0x1')]=function(){return function(){return client['Request'](_0x035d('0x2'),{'options':{'raw':![],'attributes':['id',_0x035d('0x3'),_0x035d('0x4'),_0x035d('0x5')],'include':[{'model':_0x035d('0x6'),'as':_0x035d('0x7'),'attributes':['id','name',_0x035d('0x8'),_0x035d('0x9')]}]},'log':_0x035d('0x1')});};}; \ No newline at end of file +var _0xbe52=['name','strategy','User','Agents','online','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x2832f0,_0x987b9c){var _0x9ca6e=function(_0x216033){while(--_0x216033){_0x2832f0['push'](_0x2832f0['shift']());}};_0x9ca6e(++_0x987b9c);}(_0xbe52,0x164));var _0x2be5=function(_0x1f5089,_0x550ee4){_0x1f5089=_0x1f5089-0x0;var _0x375b0e=_0xbe52[_0x1f5089];return _0x375b0e;};'use strict';var client=require(_0x2be5('0x0'));exports[_0x2be5('0x1')]=function(){return function(){return client[_0x2be5('0x2')](_0x2be5('0x3'),{'options':{'raw':![],'attributes':['id',_0x2be5('0x4'),'timeout',_0x2be5('0x5')],'include':[{'model':_0x2be5('0x6'),'as':_0x2be5('0x7'),'attributes':['id',_0x2be5('0x4'),_0x2be5('0x8'),_0x2be5('0x9')]}]},'log':_0x2be5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index f0403f9..b0fe9e1 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 _0x8e63=['update','Request','UpdateChatQueueReport','DESC','create','CreateChatQueueReport'];(function(_0x235ece,_0x457036){var _0x3fc816=function(_0xc8ba0e){while(--_0xc8ba0e){_0x235ece['push'](_0x235ece['shift']());}};_0x3fc816(++_0x457036);}(_0x8e63,0x7c));var _0x38e6=function(_0x59ad5f,_0x3117b4){_0x59ad5f=_0x59ad5f-0x0;var _0x25fa93=_0x8e63[_0x59ad5f];return _0x25fa93;};'use strict';var client=require('../client');exports[_0x38e6('0x0')]=function(_0x5221a4){return client['Request'](_0x38e6('0x1'),{'body':_0x5221a4,'log':_0x38e6('0x1')});};exports[_0x38e6('0x2')]=function(_0x5e5a71,_0x4c85e7){return client[_0x38e6('0x3')](_0x38e6('0x4'),{'body':_0x4c85e7,'options':{'where':{'uniqueid':_0x5e5a71},'order':[['id',_0x38e6('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x9234=['../client','Request','CreateChatQueueReport','UpdateChatQueueReport','DESC'];(function(_0x30ca54,_0x42999e){var _0x36605e=function(_0x1f206d){while(--_0x1f206d){_0x30ca54['push'](_0x30ca54['shift']());}};_0x36605e(++_0x42999e);}(_0x9234,0x1bd));var _0x4923=function(_0x24a88e,_0x22a0b8){_0x24a88e=_0x24a88e-0x0;var _0x232cbb=_0x9234[_0x24a88e];return _0x232cbb;};'use strict';var client=require(_0x4923('0x0'));exports['create']=function(_0x1ece6e){return client[_0x4923('0x1')](_0x4923('0x2'),{'body':_0x1ece6e,'log':_0x4923('0x2')});};exports['update']=function(_0x1ca221,_0x436ce1){return client['Request'](_0x4923('0x3'),{'body':_0x436ce1,'options':{'where':{'uniqueid':_0x1ca221},'order':[['id',_0x4923('0x4')]],'limit':0x1},'log':_0x4923('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 9ebcd8e..a83e688 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(_0x82c763,_0x2534f0){var _0x435d71=function(_0x47acd0){while(--_0x47acd0){_0x82c763['push'](_0x82c763['shift']());}};_0x435d71(++_0x2534f0);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x242a98,_0x13988e){var _0x580999=function(_0x341927){while(--_0x341927){_0x242a98['push'](_0x242a98['shift']());}};_0x580999(++_0x13988e);}(_0x7a54,0x106));var _0x47a5=function(_0x58a9a2,_0x13f54b){_0x58a9a2=_0x58a9a2-0x0;var _0x7abd5e=_0x7a54[_0x58a9a2];return _0x7abd5e;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 62325c8..93c3745 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 _0x52d4=['createFaxMessage','../client','create'];(function(_0x6d7060,_0x119c08){var _0x195046=function(_0x3a4923){while(--_0x3a4923){_0x6d7060['push'](_0x6d7060['shift']());}};_0x195046(++_0x119c08);}(_0x52d4,0x1a8));var _0x452d=function(_0x513119,_0x425e6f){_0x513119=_0x513119-0x0;var _0x587511=_0x52d4[_0x513119];return _0x587511;};'use strict';var client=require(_0x452d('0x0'));exports[_0x452d('0x1')]=function(_0x33aa80){return client['Request']('CreateFaxMessage',{'body':_0x33aa80,'log':_0x452d('0x2')});}; \ No newline at end of file +var _0x7f9d=['createFaxMessage','../client','create','CreateFaxMessage'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x7f9d,0x6d));var _0xd7f9=function(_0x2b81de,_0xa1aab5){_0x2b81de=_0x2b81de-0x0;var _0x36dc32=_0x7f9d[_0x2b81de];return _0x36dc32;};'use strict';var client=require(_0xd7f9('0x0'));exports[_0xd7f9('0x1')]=function(_0x15cdf3){return client['Request'](_0xd7f9('0x2'),{'body':_0x15cdf3,'log':_0xd7f9('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index e0b6a7c..df519be 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 _0x9e1b=['strategy','User','Agents','online','faxPause','../client','getFaxQueues','GetFaxQueue','name'];(function(_0x5e3721,_0x3e50b1){var _0x345ff2=function(_0x146a32){while(--_0x146a32){_0x5e3721['push'](_0x5e3721['shift']());}};_0x345ff2(++_0x3e50b1);}(_0x9e1b,0x19a));var _0xb9e1=function(_0x245712,_0x4e1f6a){_0x245712=_0x245712-0x0;var _0x227cf9=_0x9e1b[_0x245712];return _0x227cf9;};'use strict';var client=require(_0xb9e1('0x0'));exports[_0xb9e1('0x1')]=function(){return function(){return client['Request'](_0xb9e1('0x2'),{'options':{'raw':![],'attributes':['id',_0xb9e1('0x3'),'timeout',_0xb9e1('0x4')],'include':[{'model':_0xb9e1('0x5'),'as':_0xb9e1('0x6'),'attributes':['id',_0xb9e1('0x3'),_0xb9e1('0x7'),_0xb9e1('0x8')]}]},'log':_0xb9e1('0x1')});};}; \ No newline at end of file +var _0x47c0=['User','Agents','online','faxPause','../client','GetFaxQueue','name','timeout','strategy'];(function(_0x4040f5,_0x37537a){var _0x13391d=function(_0x3e25b0){while(--_0x3e25b0){_0x4040f5['push'](_0x4040f5['shift']());}};_0x13391d(++_0x37537a);}(_0x47c0,0xd3));var _0x047c=function(_0x28aff0,_0x596412){_0x28aff0=_0x28aff0-0x0;var _0x4b4200=_0x47c0[_0x28aff0];return _0x4b4200;};'use strict';var client=require(_0x047c('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request'](_0x047c('0x1'),{'options':{'raw':![],'attributes':['id',_0x047c('0x2'),_0x047c('0x3'),_0x047c('0x4')],'include':[{'model':_0x047c('0x5'),'as':_0x047c('0x6'),'attributes':['id',_0x047c('0x2'),_0x047c('0x7'),_0x047c('0x8')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index a9e2d93..546de53 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 _0xf9dd=['CreateFaxQueueReport','update','Request','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x40a1e2,_0x19e376){var _0x1f5d36=function(_0x30aad5){while(--_0x30aad5){_0x40a1e2['push'](_0x40a1e2['shift']());}};_0x1f5d36(++_0x19e376);}(_0xf9dd,0x6e));var _0xdf9d=function(_0x404dfb,_0x4ec49e){_0x404dfb=_0x404dfb-0x0;var _0x43b2ba=_0xf9dd[_0x404dfb];return _0x43b2ba;};'use strict';var client=require(_0xdf9d('0x0'));exports[_0xdf9d('0x1')]=function(_0x521f8c){return client['Request'](_0xdf9d('0x2'),{'body':_0x521f8c,'log':_0xdf9d('0x2')});};exports[_0xdf9d('0x3')]=function(_0x1da175,_0x141e34){return client[_0xdf9d('0x4')](_0xdf9d('0x5'),{'body':_0x141e34,'options':{'where':{'uniqueid':_0x1da175},'order':[['id',_0xdf9d('0x6')]],'limit':0x1},'log':_0xdf9d('0x5')});}; \ No newline at end of file +var _0x5845=['Request','update','UpdateFaxQueueReport','../client','create'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5845,0x80));var _0x5584=function(_0x1c45e9,_0x508369){_0x1c45e9=_0x1c45e9-0x0;var _0x52ffd2=_0x5845[_0x1c45e9];return _0x52ffd2;};'use strict';var client=require(_0x5584('0x0'));exports[_0x5584('0x1')]=function(_0x8263fb){return client[_0x5584('0x2')]('CreateFaxQueueReport',{'body':_0x8263fb,'log':'CreateFaxQueueReport'});};exports[_0x5584('0x3')]=function(_0x557e4a,_0x1f37e8){return client['Request'](_0x5584('0x4'),{'body':_0x1f37e8,'options':{'where':{'uniqueid':_0x557e4a},'order':[['id','DESC']],'limit':0x1},'log':_0x5584('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 99dd154..bb1a830 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 _0x6388=['getIntervals','Request','GetInterval','Interval','Intervals','interval'];(function(_0x5d19ad,_0x383799){var _0x8408d3=function(_0x5e3bc7){while(--_0x5e3bc7){_0x5d19ad['push'](_0x5d19ad['shift']());}};_0x8408d3(++_0x383799);}(_0x6388,0x1ce));var _0x8638=function(_0xdd96a1,_0x5c0080){_0xdd96a1=_0xdd96a1-0x0;var _0x2f0dc7=_0x6388[_0xdd96a1];return _0x2f0dc7;};'use strict';var client=require('../client');exports[_0x8638('0x0')]=function(){return function(){return client[_0x8638('0x1')](_0x8638('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x8638('0x3'),'as':_0x8638('0x4'),'attributes':['id','name',_0x8638('0x5')]}]},'log':_0x8638('0x0')});};}; \ No newline at end of file +var _0x07af=['../client','getIntervals','Request','GetInterval','name','Interval','Intervals'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x07af,0x13b));var _0xf07a=function(_0x3255fb,_0x20000f){_0x3255fb=_0x3255fb-0x0;var _0x139c27=_0x07af[_0x3255fb];return _0x139c27;};'use strict';var client=require(_0xf07a('0x0'));exports[_0xf07a('0x1')]=function(){return function(){return client[_0xf07a('0x2')](_0xf07a('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xf07a('0x4')],'include':[{'model':_0xf07a('0x5'),'as':_0xf07a('0x6'),'attributes':['id',_0xf07a('0x4'),'interval']}]},'log':_0xf07a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index f615678..e7778db 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 _0x28f2=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x3f1420,_0x57bc12){var _0x31e09e=function(_0x9139e4){while(--_0x9139e4){_0x3f1420['push'](_0x3f1420['shift']());}};_0x31e09e(++_0x57bc12);}(_0x28f2,0x193));var _0x228f=function(_0x36524e,_0x807c3c){_0x36524e=_0x36524e-0x0;var _0x51a070=_0x28f2[_0x36524e];return _0x51a070;};'use strict';var client=require(_0x228f('0x0'));exports[_0x228f('0x1')]=function(_0x108337,_0x2e5e0b){return client[_0x228f('0x2')]('UpdateMailInteraction',{'body':_0x2e5e0b,'options':{'where':{'id':_0x108337}},'log':_0x228f('0x3')});};exports[_0x228f('0x4')]=function(_0x79ed5f,_0x4303c3){return client[_0x228f('0x2')](_0x228f('0x5'),{'body':_0x4303c3,'options':{'where':{'id':_0x79ed5f}},'log':_0x228f('0x6')});}; \ No newline at end of file +var _0x77e6=['addTags','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x5e7bd1,_0x3634dd){var _0x33d089=function(_0x5f03b5){while(--_0x5f03b5){_0x5e7bd1['push'](_0x5e7bd1['shift']());}};_0x33d089(++_0x3634dd);}(_0x77e6,0x1a6));var _0x677e=function(_0x256b3d,_0x2cb9be){_0x256b3d=_0x256b3d-0x0;var _0xcccde1=_0x77e6[_0x256b3d];return _0xcccde1;};'use strict';var client=require(_0x677e('0x0'));exports[_0x677e('0x1')]=function(_0x3855c7,_0xa48f0c){return client[_0x677e('0x2')](_0x677e('0x3'),{'body':_0xa48f0c,'options':{'where':{'id':_0x3855c7}},'log':_0x677e('0x4')});};exports[_0x677e('0x5')]=function(_0x50231c,_0x2f0307){return client[_0x677e('0x2')]('AddTagsToMailInteraction',{'body':_0x2f0307,'options':{'where':{'id':_0x50231c}},'log':_0x677e('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 3d11668..4025440 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 _0x5be7=['../client','create','CreateMailMessage','createMailMessage'];(function(_0x3a7368,_0x185789){var _0x1aa883=function(_0x41b7b6){while(--_0x41b7b6){_0x3a7368['push'](_0x3a7368['shift']());}};_0x1aa883(++_0x185789);}(_0x5be7,0x94));var _0x75be=function(_0x1d4fe4,_0x5d7f8c){_0x1d4fe4=_0x1d4fe4-0x0;var _0x2adb27=_0x5be7[_0x1d4fe4];return _0x2adb27;};'use strict';var client=require(_0x75be('0x0'));exports[_0x75be('0x1')]=function(_0x5f0200){return client['Request'](_0x75be('0x2'),{'body':_0x5f0200,'log':_0x75be('0x3')});}; \ No newline at end of file +var _0x9bf1=['createMailMessage','CreateMailMessage'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x9bf1,0x6b));var _0x19bf=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x9bf1[_0x4e5552];return _0x60a338;};'use strict';var client=require('../client');exports['create']=function(_0x1dfcb1){return client['Request'](_0x19bf('0x0'),{'body':_0x1dfcb1,'log':_0x19bf('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 33a880d..7880de6 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 _0x183e=['mailPause','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','online'];(function(_0x2e1ddd,_0x15a251){var _0x4655b7=function(_0x31eb8b){while(--_0x31eb8b){_0x2e1ddd['push'](_0x2e1ddd['shift']());}};_0x4655b7(++_0x15a251);}(_0x183e,0x17e));var _0xe183=function(_0x184f37,_0x4f6ba7){_0x184f37=_0x184f37-0x0;var _0x5d1931=_0x183e[_0x184f37];return _0x5d1931;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0xe183('0x0')](_0xe183('0x1'),{'options':{'raw':![],'attributes':['id',_0xe183('0x2'),_0xe183('0x3'),_0xe183('0x4')],'include':[{'model':_0xe183('0x5'),'as':_0xe183('0x6'),'attributes':['id','name',_0xe183('0x7'),_0xe183('0x8')]}]},'log':_0xe183('0x9')});};}; \ No newline at end of file +var _0x1dad=['name','timeout','User','online','mailPause','GetMailQueue'];(function(_0xf9a1b0,_0x47c8dd){var _0x1e40b6=function(_0x5749cc){while(--_0x5749cc){_0xf9a1b0['push'](_0xf9a1b0['shift']());}};_0x1e40b6(++_0x47c8dd);}(_0x1dad,0xb9));var _0xd1da=function(_0x41eeef,_0x377713){_0x41eeef=_0x41eeef-0x0;var _0x43d469=_0x1dad[_0x41eeef];return _0x43d469;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client['Request'](_0xd1da('0x0'),{'options':{'raw':![],'attributes':['id',_0xd1da('0x1'),_0xd1da('0x2'),'strategy'],'include':[{'model':_0xd1da('0x3'),'as':'Agents','attributes':['id','name',_0xd1da('0x4'),_0xd1da('0x5')]}]},'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 0888480..8bba555 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 _0xfcd3=['create','Request','UpdateMailQueueReport','DESC'];(function(_0x395667,_0x45593a){var _0x5cdb8f=function(_0x2be0fd){while(--_0x2be0fd){_0x395667['push'](_0x395667['shift']());}};_0x5cdb8f(++_0x45593a);}(_0xfcd3,0xdc));var _0x3fcd=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0xfcd3[_0x305c31];return _0x17f39f;};'use strict';var client=require('../client');exports[_0x3fcd('0x0')]=function(_0x332214){return client[_0x3fcd('0x1')]('CreateMailQueueReport',{'body':_0x332214,'log':'CreateMailQueueReport'});};exports['update']=function(_0x51059d,_0x39aefd){return client[_0x3fcd('0x1')](_0x3fcd('0x2'),{'body':_0x39aefd,'options':{'where':{'uniqueid':_0x51059d},'order':[['id',_0x3fcd('0x3')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x9a05=['Request','UpdateMailQueueReport','DESC','../client','create','CreateMailQueueReport'];(function(_0x3b7b42,_0x31badd){var _0x1ebaad=function(_0x3655d9){while(--_0x3655d9){_0x3b7b42['push'](_0x3b7b42['shift']());}};_0x1ebaad(++_0x31badd);}(_0x9a05,0xf3));var _0x59a0=function(_0x26ca3a,_0x3a1959){_0x26ca3a=_0x26ca3a-0x0;var _0x246cd9=_0x9a05[_0x26ca3a];return _0x246cd9;};'use strict';var client=require(_0x59a0('0x0'));exports[_0x59a0('0x1')]=function(_0x4afe40){return client['Request'](_0x59a0('0x2'),{'body':_0x4afe40,'log':_0x59a0('0x2')});};exports['update']=function(_0x4b87c6,_0x4d5c6b){return client[_0x59a0('0x3')](_0x59a0('0x4'),{'body':_0x4d5c6b,'options':{'where':{'uniqueid':_0x4b87c6},'order':[['id',_0x59a0('0x5')]],'limit':0x1},'log':_0x59a0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 161bd55..be48749 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 _0x6604=['update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x2457b1,_0x34c892){var _0x5491e4=function(_0x163fa5){while(--_0x163fa5){_0x2457b1['push'](_0x2457b1['shift']());}};_0x5491e4(++_0x34c892);}(_0x6604,0x156));var _0x4660=function(_0x36b635,_0x68a7f){_0x36b635=_0x36b635-0x0;var _0x11385b=_0x6604[_0x36b635];return _0x11385b;};'use strict';var client=require(_0x4660('0x0'));exports[_0x4660('0x1')]=function(_0x22468f,_0x750d4a){return client['Request'](_0x4660('0x2'),{'body':_0x750d4a,'options':{'where':{'id':_0x22468f}},'log':_0x4660('0x3')});};exports[_0x4660('0x4')]=function(_0x4c17c4,_0x504755){return client['Request'](_0x4660('0x5'),{'body':_0x504755,'options':{'where':{'id':_0x4c17c4}},'log':_0x4660('0x6')});}; \ No newline at end of file +var _0x6fe0=['addTagsToChatInteraction','../client','update','addTags','Request'];(function(_0x3d3ddd,_0x59b504){var _0x52a4f9=function(_0x349a69){while(--_0x349a69){_0x3d3ddd['push'](_0x3d3ddd['shift']());}};_0x52a4f9(++_0x59b504);}(_0x6fe0,0xb5));var _0x06fe=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x6fe0[_0x57d13b];return _0x467696;};'use strict';var client=require(_0x06fe('0x0'));exports[_0x06fe('0x1')]=function(_0x5552fb,_0x4f54ea){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x4f54ea,'options':{'where':{'id':_0x5552fb}},'log':'updateOpenchannelInteraction'});};exports[_0x06fe('0x2')]=function(_0x155b8c,_0x37c78c){return client[_0x06fe('0x3')]('AddTagsToOpenchannelInteraction',{'body':_0x37c78c,'options':{'where':{'id':_0x155b8c}},'log':_0x06fe('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 315c083..07f2a3d 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 _0xf7f6=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x193fef,_0x230d9f){var _0x4eb704=function(_0x5787c4){while(--_0x5787c4){_0x193fef['push'](_0x193fef['shift']());}};_0x4eb704(++_0x230d9f);}(_0xf7f6,0x95));var _0x6f7f=function(_0xa93c7f,_0x4e4f5c){_0xa93c7f=_0xa93c7f-0x0;var _0x2fe7d3=_0xf7f6[_0xa93c7f];return _0x2fe7d3;};'use strict';var client=require(_0x6f7f('0x0'));exports[_0x6f7f('0x1')]=function(_0x4894f9){return client[_0x6f7f('0x2')](_0x6f7f('0x3'),{'body':_0x4894f9,'log':_0x6f7f('0x4')});}; \ No newline at end of file +var _0xbc87=['create','Request','createOpenchannelMessage'];(function(_0x3c7695,_0xacfd3b){var _0x5dba83=function(_0x2bf556){while(--_0x2bf556){_0x3c7695['push'](_0x3c7695['shift']());}};_0x5dba83(++_0xacfd3b);}(_0xbc87,0x1b0));var _0x7bc8=function(_0x10e80a,_0x37bc49){_0x10e80a=_0x10e80a-0x0;var _0xc600ee=_0xbc87[_0x10e80a];return _0xc600ee;};'use strict';var client=require('../client');exports[_0x7bc8('0x0')]=function(_0x1ecc36){return client[_0x7bc8('0x1')]('CreateOpenchannelMessage',{'body':_0x1ecc36,'log':_0x7bc8('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 95b0ce6..c466fa6 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 _0x1a5b=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','User','Agents','online','openchannelPause','../client'];(function(_0xe67abb,_0x45528b){var _0x4f8889=function(_0x1e8a04){while(--_0x1e8a04){_0xe67abb['push'](_0xe67abb['shift']());}};_0x4f8889(++_0x45528b);}(_0x1a5b,0x153));var _0xb1a5=function(_0xd5268f,_0x423434){_0xd5268f=_0xd5268f-0x0;var _0x2e65f8=_0x1a5b[_0xd5268f];return _0x2e65f8;};'use strict';var client=require(_0xb1a5('0x0'));exports[_0xb1a5('0x1')]=function(){return function(){return client[_0xb1a5('0x2')](_0xb1a5('0x3'),{'options':{'raw':![],'attributes':['id',_0xb1a5('0x4'),'timeout',_0xb1a5('0x5')],'include':[{'model':_0xb1a5('0x6'),'as':_0xb1a5('0x7'),'attributes':['id',_0xb1a5('0x4'),_0xb1a5('0x8'),_0xb1a5('0x9')]}]},'log':_0xb1a5('0x1')});};}; \ No newline at end of file +var _0x3b36=['name','timeout','strategy','User','Agents','online','openchannelPause','getOpenchannelQueues','GetOpenchannelQueue'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3b36,0x181));var _0x63b3=function(_0x3b0f99,_0x2e58a0){_0x3b0f99=_0x3b0f99-0x0;var _0x49793e=_0x3b36[_0x3b0f99];return _0x49793e;};'use strict';var client=require('../client');exports[_0x63b3('0x0')]=function(){return function(){return client['Request'](_0x63b3('0x1'),{'options':{'raw':![],'attributes':['id',_0x63b3('0x2'),_0x63b3('0x3'),_0x63b3('0x4')],'include':[{'model':_0x63b3('0x5'),'as':_0x63b3('0x6'),'attributes':['id',_0x63b3('0x2'),_0x63b3('0x7'),_0x63b3('0x8')]}]},'log':_0x63b3('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 183ad20..79c2d41 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 _0x7dc5=['create','CreateOpenchannelQueueReport','update','Request','DESC','UpdateOpenchannelQueueReport','../client'];(function(_0x4f46f1,_0x2a39b9){var _0x5e146b=function(_0x5aed22){while(--_0x5aed22){_0x4f46f1['push'](_0x4f46f1['shift']());}};_0x5e146b(++_0x2a39b9);}(_0x7dc5,0x13a));var _0x57dc=function(_0x5bccd3,_0x4e2b7b){_0x5bccd3=_0x5bccd3-0x0;var _0x322dbc=_0x7dc5[_0x5bccd3];return _0x322dbc;};'use strict';var client=require(_0x57dc('0x0'));exports[_0x57dc('0x1')]=function(_0x41f4e5){return client['Request'](_0x57dc('0x2'),{'body':_0x41f4e5,'log':_0x57dc('0x2')});};exports[_0x57dc('0x3')]=function(_0x268af0,_0x1aa2c8){return client[_0x57dc('0x4')]('UpdateOpenchannelQueueReport',{'body':_0x1aa2c8,'options':{'where':{'uniqueid':_0x268af0},'order':[['id',_0x57dc('0x5')]],'limit':0x1},'log':_0x57dc('0x6')});}; \ No newline at end of file +var _0x652b=['UpdateOpenchannelQueueReport','../client','Request','CreateOpenchannelQueueReport','update'];(function(_0x5914d1,_0x3a2175){var _0x6b109c=function(_0x2eaa44){while(--_0x2eaa44){_0x5914d1['push'](_0x5914d1['shift']());}};_0x6b109c(++_0x3a2175);}(_0x652b,0xd8));var _0xb652=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x652b[_0x2f1762];return _0x8ab21;};'use strict';var client=require(_0xb652('0x0'));exports['create']=function(_0x37c472){return client[_0xb652('0x1')](_0xb652('0x2'),{'body':_0x37c472,'log':_0xb652('0x2')});};exports[_0xb652('0x3')]=function(_0x57b736,_0x432d9b){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x432d9b,'options':{'where':{'uniqueid':_0x57b736},'order':[['id','DESC']],'limit':0x1},'log':_0xb652('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index fd4edc3..ff01804 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 _0x4b47=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','Request'];(function(_0x1ab379,_0xec9685){var _0x575b2a=function(_0x396a3b){while(--_0x396a3b){_0x1ab379['push'](_0x1ab379['shift']());}};_0x575b2a(++_0xec9685);}(_0x4b47,0x1b4));var _0x74b4=function(_0x20c199,_0x3b2930){_0x20c199=_0x20c199-0x0;var _0x2df087=_0x4b47[_0x20c199];return _0x2df087;};'use strict';var client=require(_0x74b4('0x0'));exports['update']=function(_0xf50408,_0x2542ff){return client[_0x74b4('0x1')](_0x74b4('0x2'),{'body':_0x2542ff,'options':{'where':{'id':_0xf50408}},'log':_0x74b4('0x3')});};exports[_0x74b4('0x4')]=function(_0x565f6b,_0x4ed4fe){return client[_0x74b4('0x1')](_0x74b4('0x5'),{'body':_0x4ed4fe,'options':{'where':{'id':_0x565f6b}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xae79=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x56b07a,_0x4de01c){var _0x3cdb49=function(_0x36e2db){while(--_0x36e2db){_0x56b07a['push'](_0x56b07a['shift']());}};_0x3cdb49(++_0x4de01c);}(_0xae79,0x1d3));var _0x9ae7=function(_0x3a57d4,_0x2c13ad){_0x3a57d4=_0x3a57d4-0x0;var _0x106fff=_0xae79[_0x3a57d4];return _0x106fff;};'use strict';var client=require(_0x9ae7('0x0'));exports[_0x9ae7('0x1')]=function(_0x799af5,_0x453855){return client[_0x9ae7('0x2')](_0x9ae7('0x3'),{'body':_0x453855,'options':{'where':{'id':_0x799af5}},'log':_0x9ae7('0x4')});};exports[_0x9ae7('0x5')]=function(_0x988f5e,_0x27817e){return client[_0x9ae7('0x2')](_0x9ae7('0x6'),{'body':_0x27817e,'options':{'where':{'id':_0x988f5e}},'log':_0x9ae7('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 422f19d..9da3621 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 _0x318d=['../client','Request','createSmsMessage'];(function(_0x44671c,_0x571fad){var _0x17b588=function(_0x27fb57){while(--_0x27fb57){_0x44671c['push'](_0x44671c['shift']());}};_0x17b588(++_0x571fad);}(_0x318d,0xff));var _0xd318=function(_0x2b89f4,_0x1c8ba5){_0x2b89f4=_0x2b89f4-0x0;var _0x264891=_0x318d[_0x2b89f4];return _0x264891;};'use strict';var client=require(_0xd318('0x0'));exports['create']=function(_0x1c8843){return client[_0xd318('0x1')]('CreateSmsMessage',{'body':_0x1c8843,'log':_0xd318('0x2')});}; \ No newline at end of file +var _0x9b9a=['create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x152341,_0x8f0c56){var _0x440e1b=function(_0x33918f){while(--_0x33918f){_0x152341['push'](_0x152341['shift']());}};_0x440e1b(++_0x8f0c56);}(_0x9b9a,0xe0));var _0xa9b9=function(_0x4733ad,_0x5d60f0){_0x4733ad=_0x4733ad-0x0;var _0x1fe11e=_0x9b9a[_0x4733ad];return _0x1fe11e;};'use strict';var client=require('../client');exports[_0xa9b9('0x0')]=function(_0x13a5d3){return client[_0xa9b9('0x1')](_0xa9b9('0x2'),{'body':_0x13a5d3,'log':_0xa9b9('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index b42a545..52ed444 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 _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x5d5bcb,_0x25e2ea){var _0x4ea5eb=function(_0x36782b){while(--_0x36782b){_0x5d5bcb['push'](_0x5d5bcb['shift']());}};_0x4ea5eb(++_0x25e2ea);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x722103,_0x5732f3){var _0x3e2435=function(_0x44c44a){while(--_0x44c44a){_0x722103['push'](_0x722103['shift']());}};_0x3e2435(++_0x5732f3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 6464744..50f174b 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x3e9645,_0x2399cb){var _0x332da7=function(_0x295cf8){while(--_0x295cf8){_0x3e9645['push'](_0x3e9645['shift']());}};_0x332da7(++_0x2399cb);}(_0x55ca,0x126));var _0xa55c=function(_0x263cfa,_0x443531){_0x263cfa=_0x263cfa-0x0;var _0x14b8ec=_0x55ca[_0x263cfa];return _0x14b8ec;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x49c188,_0x1dbc5c){var _0x15efc0=function(_0x1301d1){while(--_0x1301d1){_0x49c188['push'](_0x49c188['shift']());}};_0x15efc0(++_0x1dbc5c);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 34e5acb..2153284 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(_0x3a104e,_0x32ad1b){var _0x413098=function(_0x29cd2d){while(--_0x29cd2d){_0x3a104e['push'](_0x3a104e['shift']());}};_0x413098(++_0x32ad1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x12fb50,_0x4a7e68){var _0x1269e5=function(_0x45e7f5){while(--_0x45e7f5){_0x12fb50['push'](_0x12fb50['shift']());}};_0x1269e5(++_0x4a7e68);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 02edf79..656c1a5 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 _0x677a=['UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request'];(function(_0xe8a0e6,_0x55ab62){var _0x9ccc53=function(_0x2772ef){while(--_0x2772ef){_0xe8a0e6['push'](_0xe8a0e6['shift']());}};_0x9ccc53(++_0x55ab62);}(_0x677a,0xd6));var _0xa677=function(_0x5da5ea,_0x24b96c){_0x5da5ea=_0x5da5ea-0x0;var _0x741d54=_0x677a[_0x5da5ea];return _0x741d54;};'use strict';var client=require(_0xa677('0x0'));exports['update']=function(_0x3896be,_0x1a14cf){return client[_0xa677('0x1')](_0xa677('0x2'),{'body':_0x1a14cf,'options':{'where':{'id':_0x3896be}},'log':_0xa677('0x3')});};exports['addTags']=function(_0x1ca988,_0x2e46f8){return client[_0xa677('0x1')](_0xa677('0x4'),{'body':_0x2e46f8,'options':{'where':{'id':_0x1ca988}},'log':_0xa677('0x5')});}; \ No newline at end of file +var _0x5d17=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction'];(function(_0x446803,_0x5d56df){var _0x233069=function(_0x27e78e){while(--_0x27e78e){_0x446803['push'](_0x446803['shift']());}};_0x233069(++_0x5d56df);}(_0x5d17,0x114));var _0x75d1=function(_0x14f681,_0xa0808e){_0x14f681=_0x14f681-0x0;var _0x1d4cb2=_0x5d17[_0x14f681];return _0x1d4cb2;};'use strict';var client=require(_0x75d1('0x0'));exports[_0x75d1('0x1')]=function(_0x58fb6b,_0x5b3ed3){return client[_0x75d1('0x2')](_0x75d1('0x3'),{'body':_0x5b3ed3,'options':{'where':{'id':_0x58fb6b}},'log':_0x75d1('0x4')});};exports['addTags']=function(_0x177460,_0x45d03a){return client[_0x75d1('0x2')](_0x75d1('0x5'),{'body':_0x45d03a,'options':{'where':{'id':_0x177460}},'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 ec65031..240c722 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 _0xfae9=['CreateWhatsappMessage'];(function(_0x27bd2c,_0x24bd98){var _0x3784ea=function(_0x4ca802){while(--_0x4ca802){_0x27bd2c['push'](_0x27bd2c['shift']());}};_0x3784ea(++_0x24bd98);}(_0xfae9,0x121));var _0x9fae=function(_0x4bbb86,_0x385744){_0x4bbb86=_0x4bbb86-0x0;var _0x2cf22b=_0xfae9[_0x4bbb86];return _0x2cf22b;};'use strict';var client=require('../client');exports['create']=function(_0x212354){return client['Request'](_0x9fae('0x0'),{'body':_0x212354,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x2ed0=['CreateWhatsappMessage','createWhatsappMessage','Request'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x2ed0,0x1a9));var _0x02ed=function(_0x141e45,_0x242c8b){_0x141e45=_0x141e45-0x0;var _0x529b3d=_0x2ed0[_0x141e45];return _0x529b3d;};'use strict';var client=require('../client');exports['create']=function(_0x159481){return client[_0x02ed('0x0')](_0x02ed('0x1'),{'body':_0x159481,'log':_0x02ed('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 7ce612c..d79b8e7 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 _0x7923=['Agents','online','whatsappPause','getWhatsappQueues','GetWhatsappQueue','name','strategy','User'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7923,0x18b));var _0x3792=function(_0x344c66,_0x4ad0ac){_0x344c66=_0x344c66-0x0;var _0x2d9bfb=_0x7923[_0x344c66];return _0x2d9bfb;};'use strict';var client=require('../client');exports[_0x3792('0x0')]=function(){return function(){return client['Request'](_0x3792('0x1'),{'options':{'raw':![],'attributes':['id',_0x3792('0x2'),'timeout',_0x3792('0x3')],'include':[{'model':_0x3792('0x4'),'as':_0x3792('0x5'),'attributes':['id','name',_0x3792('0x6'),_0x3792('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x4346=['whatsappPause','../client','getWhatsappQueues','Request','name','strategy','User','Agents'];(function(_0x1ae4a9,_0x4c0ed9){var _0x54d0b0=function(_0x4fff20){while(--_0x4fff20){_0x1ae4a9['push'](_0x1ae4a9['shift']());}};_0x54d0b0(++_0x4c0ed9);}(_0x4346,0x189));var _0x6434=function(_0x3cb21e,_0x11849a){_0x3cb21e=_0x3cb21e-0x0;var _0xeacd6a=_0x4346[_0x3cb21e];return _0xeacd6a;};'use strict';var client=require(_0x6434('0x0'));exports[_0x6434('0x1')]=function(){return function(){return client[_0x6434('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x6434('0x3'),'timeout',_0x6434('0x4')],'include':[{'model':_0x6434('0x5'),'as':_0x6434('0x6'),'attributes':['id',_0x6434('0x3'),'online',_0x6434('0x7')]}]},'log':_0x6434('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index a1d97b4..dfc0fb6 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 _0x424c=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0xc101a1,_0x41077f){var _0x1042e1=function(_0x52672e){while(--_0x52672e){_0xc101a1['push'](_0xc101a1['shift']());}};_0x1042e1(++_0x41077f);}(_0x424c,0x8a));var _0xc424=function(_0x3d45ea,_0x16f9ec){_0x3d45ea=_0x3d45ea-0x0;var _0x13fc7f=_0x424c[_0x3d45ea];return _0x13fc7f;};'use strict';var client=require(_0xc424('0x0'));exports[_0xc424('0x1')]=function(_0x2e4f48){return client[_0xc424('0x2')](_0xc424('0x3'),{'body':_0x2e4f48,'log':_0xc424('0x3')});};exports[_0xc424('0x4')]=function(_0x468d8d,_0x5935fe){return client[_0xc424('0x2')]('UpdateWhatsappQueueReport',{'body':_0x5935fe,'options':{'where':{'uniqueid':_0x468d8d},'order':[['id','DESC']],'limit':0x1},'log':_0xc424('0x5')});}; \ No newline at end of file +var _0x8cf2=['create','Request','update','DESC','UpdateWhatsappQueueReport','../client'];(function(_0x4a519e,_0x5be3c4){var _0x1c7154=function(_0x2a0bde){while(--_0x2a0bde){_0x4a519e['push'](_0x4a519e['shift']());}};_0x1c7154(++_0x5be3c4);}(_0x8cf2,0x71));var _0x28cf=function(_0x36cd77,_0x1328bc){_0x36cd77=_0x36cd77-0x0;var _0xc57407=_0x8cf2[_0x36cd77];return _0xc57407;};'use strict';var client=require(_0x28cf('0x0'));exports[_0x28cf('0x1')]=function(_0x5d860c){return client[_0x28cf('0x2')]('CreateWhatsappQueueReport',{'body':_0x5d860c,'log':'CreateWhatsappQueueReport'});};exports[_0x28cf('0x3')]=function(_0x5dd074,_0x3cb308){return client[_0x28cf('0x2')]('UpdateWhatsappQueueReport',{'body':_0x3cb308,'options':{'where':{'uniqueid':_0x5dd074},'order':[['id',_0x28cf('0x4')]],'limit':0x1},'log':_0x28cf('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 664fae6..72ed4a7 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 _0x1ab4=['../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','map','message','stop','find','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue'];(function(_0x5483eb,_0x102101){var _0x1c071d=function(_0x5c3f23){while(--_0x5c3f23){_0x5483eb['push'](_0x5483eb['shift']());}};_0x1c071d(++_0x102101);}(_0x1ab4,0xbc));var _0x41ab=function(_0x443e0c,_0x51ca0e){_0x443e0c=_0x443e0c-0x0;var _0x963c7e=_0x1ab4[_0x443e0c];return _0x963c7e;};'use strict';var schema=require(_0x41ab('0x0'));var _=require(_0x41ab('0x1'));var util=require(_0x41ab('0x2'));var seqqueue=require(_0x41ab('0x3'));var logger=require(_0x41ab('0x4'))(_0x41ab('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x41ab('0x6'),'required':!![],'message':_0x41ab('0x7')},'timeout':{'type':'number','message':_0x41ab('0x8')}});function writeLog(_0x59662f,_0x1f265a,_0x2ab961){return logger[_0x41ab('0x9')](util[_0x41ab('0xa')](_0x41ab('0xb'),_0x59662f,_0x1f265a[_0x41ab('0xc')],_0x2ab961));}function handleFindAgent(_0x10d289){return function(_0x31c973){return _0x31c973['name'][_0x41ab('0xd')]()===_0x10d289[_0x41ab('0xd')]();};}exports['consequence']=function(_0x195b64,_0x4e46c3,_0x463059,_0x3b00d0){return function(_0x16c672){try{var _0x4580bf={'name':_0x4e46c3[0x0],'timeout':_0x4e46c3[0x1]};var _0x3cd7e8=queue['validate'](_0x4580bf,{'typecast':!![]});if(_0x3cd7e8[_0x41ab('0xe')]){logger[_0x41ab('0xf')]('[%s][AGENT]\x20%s',_0x195b64,_[_0x41ab('0x10')](_0x3cd7e8,_0x41ab('0x11'))['join'](',\x20'));_0x16c672[_0x41ab('0x12')]();}else{var _0x63045d=_[_0x41ab('0x13')](_0x463059['agents'],handleFindAgent(_0x4580bf[_0x41ab('0xc')]));if(_0x63045d){var _0x2f8703=(_0x4580bf['timeout']||0xa)*0x3e8;var _0x33019e,_0xaabef4;var _0x504458=seqqueue['createQueue'](_0x2f8703);_0x504458['id']=_0x195b64;_0x504458['atimeout']=_0x2f8703;_0x504458[_0x41ab('0x14')]=_0x3b00d0[_0x41ab('0x14')];writeLog(_0x195b64,_0x63045d,util[_0x41ab('0xa')](_0x41ab('0x15'),_0x2f8703));_0x463059[_0x41ab('0x16')][_0x195b64]['on']('end',function(){logger[_0x41ab('0x9')](_0x41ab('0x17'),_0x195b64);clearTimeout(_0xaabef4);_0xaabef4=undefined;_0x504458[_0x41ab('0x18')]();if(_0x463059[_0x41ab('0x16')][_0x195b64]){delete _0x463059[_0x41ab('0x16')][_0x195b64];}_0x16c672[_0x41ab('0x12')]();});_0x463059[_0x41ab('0x16')][_0x195b64]['on'](_0x41ab('0x19'),function(){if(_0x463059[_0x41ab('0x16')][_0x195b64]){delete _0x463059['rules'][_0x195b64];}});_0xaabef4=setTimeout(function(){logger[_0x41ab('0x9')](_0x41ab('0x1a'),_0x195b64);clearTimeout(_0xaabef4);_0x504458[_0x41ab('0x18')]();_0x16c672[_0x41ab('0x1b')]();},_0x2f8703);strategy[_0x41ab('0x1c')](_0x504458,_0x63045d,_0x463059,_0x3b00d0);}else{logger['error'](_0x41ab('0x1d'),_0x195b64,_0x4580bf['name']);_0x16c672[_0x41ab('0x12')]();}}}catch(_0x48fbab){console[_0x41ab('0x1e')](_0x48fbab);logger[_0x41ab('0xf')](_0x41ab('0x1f'),_0x195b64,_0x48fbab['stack']);_0x16c672[_0x41ab('0x12')]();}};}; \ No newline at end of file +var _0xf77c=['map','message','join','stop','find','agents','timeout','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','next','agent','log','[%s][QUEUE]\x20%s','stack','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error'];(function(_0x2278fa,_0x253766){var _0x439fda=function(_0x13dd4d){while(--_0x13dd4d){_0x2278fa['push'](_0x2278fa['shift']());}};_0x439fda(++_0x253766);}(_0xf77c,0x1a0));var _0xcf77=function(_0x3f2397,_0x154b0b){_0x3f2397=_0x3f2397-0x0;var _0x3d4ed5=_0xf77c[_0x3f2397];return _0x3d4ed5;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xcf77('0x0'));var seqqueue=require(_0xcf77('0x1'));var logger=require(_0xcf77('0x2'))(_0xcf77('0x3'));var strategy=require(_0xcf77('0x4'));var queue=schema({'name':{'type':_0xcf77('0x5'),'required':!![],'message':_0xcf77('0x6')},'timeout':{'type':_0xcf77('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0xb8c661,_0xfafc1a,_0xdef53a){return logger[_0xcf77('0x8')](util[_0xcf77('0x9')](_0xcf77('0xa'),_0xb8c661,_0xfafc1a['name'],_0xdef53a));}function handleFindAgent(_0x4034c1){return function(_0x34f532){return _0x34f532[_0xcf77('0xb')][_0xcf77('0xc')]()===_0x4034c1[_0xcf77('0xc')]();};}exports[_0xcf77('0xd')]=function(_0x17f47f,_0x33d533,_0x3b585a,_0x542b89){return function(_0xb24d4e){try{var _0x370d1f={'name':_0x33d533[0x0],'timeout':_0x33d533[0x1]};var _0x24d55d=queue['validate'](_0x370d1f,{'typecast':!![]});if(_0x24d55d[_0xcf77('0xe')]){logger[_0xcf77('0xf')]('[%s][AGENT]\x20%s',_0x17f47f,_[_0xcf77('0x10')](_0x24d55d,_0xcf77('0x11'))[_0xcf77('0x12')](',\x20'));_0xb24d4e[_0xcf77('0x13')]();}else{var _0x5cd5d1=_[_0xcf77('0x14')](_0x3b585a[_0xcf77('0x15')],handleFindAgent(_0x370d1f[_0xcf77('0xb')]));if(_0x5cd5d1){var _0x10b606=(_0x370d1f[_0xcf77('0x16')]||0xa)*0x3e8;var _0x3987c8,_0x246f80;var _0x2cec61=seqqueue['createQueue'](_0x10b606);_0x2cec61['id']=_0x17f47f;_0x2cec61[_0xcf77('0x17')]=_0x10b606;_0x2cec61[_0xcf77('0x18')]=_0x542b89[_0xcf77('0x18')];writeLog(_0x17f47f,_0x5cd5d1,util[_0xcf77('0x9')](_0xcf77('0x19'),_0x10b606));_0x3b585a['rules'][_0x17f47f]['on'](_0xcf77('0x1a'),function(){logger[_0xcf77('0x8')](_0xcf77('0x1b'),_0x17f47f);clearTimeout(_0x246f80);_0x246f80=undefined;_0x2cec61[_0xcf77('0x1c')]();if(_0x3b585a[_0xcf77('0x1d')][_0x17f47f]){delete _0x3b585a[_0xcf77('0x1d')][_0x17f47f];}_0xb24d4e['stop']();});_0x3b585a[_0xcf77('0x1d')][_0x17f47f]['on'](_0xcf77('0x1e'),function(){if(_0x3b585a[_0xcf77('0x1d')][_0x17f47f]){delete _0x3b585a[_0xcf77('0x1d')][_0x17f47f];}});_0x246f80=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x17f47f);clearTimeout(_0x246f80);_0x2cec61[_0xcf77('0x1c')]();_0xb24d4e[_0xcf77('0x1f')]();},_0x10b606);strategy[_0xcf77('0x20')](_0x2cec61,_0x5cd5d1,_0x3b585a,_0x542b89);}else{logger[_0xcf77('0xf')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x17f47f,_0x370d1f[_0xcf77('0xb')]);_0xb24d4e['stop']();}}}catch(_0x2f49f3){console[_0xcf77('0x21')](_0x2f49f3);logger[_0xcf77('0xf')](_0xcf77('0x22'),_0x17f47f,_0x2f49f3[_0xcf77('0x23')]);_0xb24d4e['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 1fb50c9..0f51433 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 _0x19c5=['stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','postText','message','amazonlex','providerName','providerResponse','stringify','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','isEmpty','body','getMustacheRender','Message','create','then','catch','error','finally'];(function(_0x1e8124,_0x35dd90){var _0x10d852=function(_0x4137e4){while(--_0x4137e4){_0x1e8124['push'](_0x1e8124['shift']());}};_0x10d852(++_0x35dd90);}(_0x19c5,0x14a));var _0x519c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x19c5[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x519c('0x0'));var moment=require(_0x519c('0x1'));var AWS=require(_0x519c('0x2'));var utils=require(_0x519c('0x3'));var logger=require(_0x519c('0x4'))(_0x519c('0x5'));var rpc={'chatMessage':require(_0x519c('0x6')),'openchannelMessage':require(_0x519c('0x7')),'mailMessage':require(_0x519c('0x8')),'smsMessage':require(_0x519c('0x9')),'faxMessage':require(_0x519c('0xa')),'whatsappMessage':require(_0x519c('0xb'))};exports['consequence']=function(_0x1bab7d,_0x308995){return function(_0x5dfee6){try{if(!_[_0x519c('0xc')](this[_0x519c('0xd')][_0x519c('0xe')])){logger[_0x519c('0xf')](_0x519c('0x10'),_0x1bab7d,_0x519c('0x11'));return _0x5dfee6[_0x519c('0x12')]();}var _0xb6357f={'ContactId':this[_0x519c('0x13')]['id'],'sentAt':moment()[_0x519c('0x14')](_0x519c('0x15')),'direction':'out'};if(this[_0x519c('0x16')]===_0x519c('0x17')||this['channel']===_0x519c('0x18')){_0xb6357f[_0x519c('0x19')]=this['interaction'][_0x519c('0x19')];}var _0x462ed4=this['channel'];if(_0x462ed4===_0x519c('0x1a')){_0xb6357f[_0x519c('0x1b')]=this[_0x519c('0x1c')]['id'];}else{_0xb6357f[_['upperFirst'](_0x462ed4)+_0x519c('0x1d')]=this['account']['id'];}_0xb6357f[_[_0x519c('0x1e')](_0x462ed4)+_0x519c('0x1f')]=this[_0x519c('0xd')]['id'];if(this['interaction']['created']){var _0x2c0dcf=_0x308995[0x4];if(!_[_0x519c('0x20')](_0x2c0dcf)){_0xb6357f[_0x519c('0x21')]=utils[_0x519c('0x22')](_0x2c0dcf,this);return rpc[_0x462ed4+_0x519c('0x23')][_0x519c('0x24')](_0xb6357f)[_0x519c('0x25')](function(_0x59faa8){logger[_0x519c('0xf')](_0x519c('0x10'),_0x1bab7d,_0xb6357f[_0x519c('0x21')]);})[_0x519c('0x26')](function(_0x265199){logger[_0x519c('0x27')]('[%s][AMAZONLEX]\x20%s',_0x1bab7d,JSON['stringify'](_0x265199));})[_0x519c('0x28')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1bab7d);_0x5dfee6[_0x519c('0x29')]();});}else{logger[_0x519c('0xf')](_0x519c('0x2a'),_0x1bab7d);_0x5dfee6[_0x519c('0x29')]();}}else{var _0x33608e=this;var _0x2dd2ba=new AWS[(_0x519c('0x2b'))]({'accessKeyId':_0x308995[0x0],'secretAccessKey':_0x308995[0x1],'region':_0x308995[0x2]});var _0x3da8a0={'botAlias':_0x519c('0x2c'),'botName':_0x308995[0x3],'inputText':this['message']['body'],'userId':this[_0x519c('0x16')]+':'+this[_0x519c('0xd')]['id'][_0x519c('0x2d')]()};_0x2dd2ba[_0x519c('0x2e')](_0x3da8a0,function(_0x606456,_0x520d29){if(_0x606456){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1bab7d,_0x606456[_0x519c('0x2f')]);_0x5dfee6[_0x519c('0x12')]();}else if(_0x520d29&&_0x520d29[_0x519c('0x2f')]){_0x33608e[_0x519c('0x21')][_0x519c('0x30')]=_0x520d29;_0xb6357f[_0x519c('0x21')]=_0x520d29['message'];_0xb6357f[_0x519c('0x31')]=_0x519c('0x30');_0xb6357f[_0x519c('0x32')]=JSON[_0x519c('0x33')](_0x520d29);return rpc[_0x462ed4+_0x519c('0x23')][_0x519c('0x24')](_0xb6357f)[_0x519c('0x25')](function(_0x3fa5c5){logger[_0x519c('0xf')](_0x519c('0x10'),_0x1bab7d,_0xb6357f[_0x519c('0x21')]);if(_0x520d29['dialogState']==_0x519c('0x34')){_0x5dfee6[_0x519c('0x12')]();}else{_0x5dfee6['stop']();}})[_0x519c('0x26')](function(_0x22624a){logger['error'](_0x519c('0x10'),_0x1bab7d,JSON[_0x519c('0x33')](_0x22624a));_0x5dfee6[_0x519c('0x12')]();});}else{_0x5dfee6['next']();}});}}catch(_0x4521d8){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1bab7d,JSON[_0x519c('0x33')](_0x4521d8));_0x5dfee6[_0x519c('0x29')]();}};}; \ No newline at end of file +var _0xa442=['dialogState','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','error','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','stringify','then'];(function(_0x5448e1,_0x1179dd){var _0x1f74d3=function(_0x5fc112){while(--_0x5fc112){_0x5448e1['push'](_0x5448e1['shift']());}};_0x1f74d3(++_0x1179dd);}(_0xa442,0x12e));var _0x2a44=function(_0x5be595,_0x334dff){_0x5be595=_0x5be595-0x0;var _0x440b47=_0xa442[_0x5be595];return _0x440b47;};'use strict';var _=require(_0x2a44('0x0'));var moment=require(_0x2a44('0x1'));var AWS=require(_0x2a44('0x2'));var utils=require(_0x2a44('0x3'));var logger=require('../../../../config/logger')(_0x2a44('0x4'));var rpc={'chatMessage':require(_0x2a44('0x5')),'openchannelMessage':require(_0x2a44('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2a44('0x7')),'faxMessage':require(_0x2a44('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x2a44('0x9')]=function(_0x2feb5f,_0x438f44){return function(_0x482a27){try{if(!_[_0x2a44('0xa')](this[_0x2a44('0xb')][_0x2a44('0xc')])){logger[_0x2a44('0xd')](_0x2a44('0xe'),_0x2feb5f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x482a27[_0x2a44('0xf')]();}var _0x42df0d={'ContactId':this[_0x2a44('0x10')]['id'],'sentAt':moment()[_0x2a44('0x11')](_0x2a44('0x12')),'direction':_0x2a44('0x13')};if(this[_0x2a44('0x14')]==='sms'||this['channel']===_0x2a44('0x15')){_0x42df0d[_0x2a44('0x16')]=this[_0x2a44('0xb')]['phone'];}var _0x5171bb=this[_0x2a44('0x14')];if(_0x5171bb===_0x2a44('0x17')){_0x42df0d[_0x2a44('0x18')]=this['account']['id'];}else{_0x42df0d[_[_0x2a44('0x19')](_0x5171bb)+_0x2a44('0x1a')]=this[_0x2a44('0x1b')]['id'];}_0x42df0d[_[_0x2a44('0x19')](_0x5171bb)+_0x2a44('0x1c')]=this[_0x2a44('0xb')]['id'];if(this[_0x2a44('0xb')][_0x2a44('0x1d')]){var _0x4e9871=_0x438f44[0x4];if(!_[_0x2a44('0x1e')](_0x4e9871)){_0x42df0d[_0x2a44('0x1f')]=utils[_0x2a44('0x20')](_0x4e9871,this);return rpc[_0x5171bb+_0x2a44('0x21')]['create'](_0x42df0d)['then'](function(_0x221bdb){logger[_0x2a44('0xd')]('[%s][AMAZONLEX]\x20%s',_0x2feb5f,_0x42df0d['body']);})['catch'](function(_0x4fc57c){logger[_0x2a44('0x22')](_0x2a44('0xe'),_0x2feb5f,JSON['stringify'](_0x4fc57c));})[_0x2a44('0x23')](function(){logger[_0x2a44('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2feb5f);_0x482a27[_0x2a44('0x24')]();});}else{logger['info'](_0x2a44('0x25'),_0x2feb5f);_0x482a27[_0x2a44('0x24')]();}}else{var _0x236bbc=this;var _0x3fc16e=new AWS[(_0x2a44('0x26'))]({'accessKeyId':_0x438f44[0x0],'secretAccessKey':_0x438f44[0x1],'region':_0x438f44[0x2]});var _0x2413d9={'botAlias':_0x2a44('0x27'),'botName':_0x438f44[0x3],'inputText':this[_0x2a44('0x28')][_0x2a44('0x1f')],'userId':this[_0x2a44('0x14')]+':'+this[_0x2a44('0xb')]['id'][_0x2a44('0x29')]()};_0x3fc16e[_0x2a44('0x2a')](_0x2413d9,function(_0x306b21,_0x45e4b6){if(_0x306b21){logger[_0x2a44('0x22')](_0x2a44('0xe'),_0x2feb5f,_0x306b21[_0x2a44('0x28')]);_0x482a27[_0x2a44('0xf')]();}else if(_0x45e4b6&&_0x45e4b6[_0x2a44('0x28')]){_0x236bbc[_0x2a44('0x1f')][_0x2a44('0x2b')]=_0x45e4b6;_0x42df0d[_0x2a44('0x1f')]=_0x45e4b6[_0x2a44('0x28')];_0x42df0d[_0x2a44('0x2c')]=_0x2a44('0x2b');_0x42df0d[_0x2a44('0x2d')]=JSON[_0x2a44('0x2e')](_0x45e4b6);return rpc[_0x5171bb+_0x2a44('0x21')]['create'](_0x42df0d)[_0x2a44('0x2f')](function(_0x18967c){logger[_0x2a44('0xd')](_0x2a44('0xe'),_0x2feb5f,_0x42df0d[_0x2a44('0x1f')]);if(_0x45e4b6[_0x2a44('0x30')]==_0x2a44('0x31')){_0x482a27[_0x2a44('0xf')]();}else{_0x482a27[_0x2a44('0x24')]();}})['catch'](function(_0x50af76){logger[_0x2a44('0x22')](_0x2a44('0xe'),_0x2feb5f,JSON[_0x2a44('0x2e')](_0x50af76));_0x482a27[_0x2a44('0xf')]();});}else{_0x482a27[_0x2a44('0xf')]();}});}}catch(_0x5073e2){logger[_0x2a44('0x22')](_0x2a44('0xe'),_0x2feb5f,JSON['stringify'](_0x5073e2));_0x482a27[_0x2a44('0x24')]();}};}; \ 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 bd4c329..3376900 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 _0xce9c=['../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','interaction','created','info','Autoreply\x20already\x20sent','next','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','out','channel','getMustacheRender','message','mail','phone','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','Message','service','host','port','Smtp','secure','authentication','auth','user','pass','inReplyTo','messageId','html','','replace','','headers','sendMailMessage','then','create','stringify','catch','error','finally','autoreplyExecuted','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xce9c,0xc3));var _0xcce9=function(_0x5a78ec,_0x160e3f){_0x5a78ec=_0x5a78ec-0x0;var _0x3bba26=_0xce9c[_0x5a78ec];return _0x3bba26;};'use strict';var _=require(_0xcce9('0x0'));var moment=require('moment');var utils=require(_0xcce9('0x1'));var logger=require('../../../../config/logger')(_0xcce9('0x2'));var rpc={'chatMessage':require(_0xcce9('0x3')),'openchannelMessage':require(_0xcce9('0x4')),'mailMessage':require(_0xcce9('0x5')),'smsMessage':require(_0xcce9('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xcce9('0x7')),'mailInteraction':require(_0xcce9('0x8')),'smsInteraction':require(_0xcce9('0x9')),'faxInteraction':require(_0xcce9('0xa')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0xcce9('0xb'));exports['consequence']=function(_0x5e2a7a,_0x34f7e8,_0x238676,_0x5b367a){return function(_0x794cd5){try{var _0x53e72c=this['channel'];if(_0x53e72c==='mail'&&_0x5b367a[_0xcce9('0xc')][_0xcce9('0xd')]){logger['info'](_0xcce9('0xe'),_0x5e2a7a,_0xcce9('0xf'));return _0x794cd5['next']();}if(_0x34f7e8[0x0]==='1'&&(_['isNil'](this[_0xcce9('0x10')][_0xcce9('0x11')])||!this[_0xcce9('0x10')][_0xcce9('0x11')])){logger[_0xcce9('0x12')]('[%s][AUTOREPLY]\x20%s',_0x5e2a7a,_0xcce9('0x13'));return _0x794cd5[_0xcce9('0x14')]();}if(_0x34f7e8[0x0]==='2'&&this[_0xcce9('0x10')]['autoreplyExecuted']){logger[_0xcce9('0x12')](_0xcce9('0x15'),_0x5e2a7a,'One\x20Time\x20already\x20sent');return _0x794cd5[_0xcce9('0x14')]();}var _0x3d7815={'ContactId':this[_0xcce9('0x16')]['id'],'sentAt':moment()[_0xcce9('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xcce9('0x18')};if(this[_0xcce9('0x19')]==='mail'){_0x3d7815[_0xcce9('0xc')]=utils[_0xcce9('0x1a')](_0x34f7e8[0x2],this);}else{_0x3d7815['body']=utils[_0xcce9('0x1a')](_0x34f7e8[0x1],this);}if(this[_0xcce9('0x1b')]){_0x3d7815['to']=this['message']['from']||'';if(this['channel']===_0xcce9('0x1c')&&_0x34f7e8[0x1]==='1'){_0x3d7815['cc']=this[_0xcce9('0x1b')]['cc']||'';}_0x3d7815['from']=this['message']['to']||'';_0x3d7815[_0xcce9('0x1d')]=this[_0xcce9('0x1b')][_0xcce9('0x1d')]||'';_0x3d7815['read']=!![];if(this[_0xcce9('0x1b')][_0xcce9('0x1e')]){_0x3d7815[_0xcce9('0x1e')]='';_0x3d7815[_0xcce9('0x1e')]+=_[_0xcce9('0x1f')](this['message'][_0xcce9('0x1e')],_0xcce9('0x20'))?'':_0xcce9('0x21');_0x3d7815[_0xcce9('0x1e')]+=this[_0xcce9('0x1b')]['subject'];}}if(this[_0xcce9('0x19')]==='chat'){_0x3d7815[_0xcce9('0x22')]=this[_0xcce9('0x23')]['id'];}else{_0x3d7815[_[_0xcce9('0x24')](this[_0xcce9('0x19')])+_0xcce9('0x25')]=this[_0xcce9('0x23')]['id'];}_0x3d7815[_[_0xcce9('0x24')](this[_0xcce9('0x19')])+'InteractionId']=this[_0xcce9('0x10')]['id'];var _0x204fcd=this[_0xcce9('0x10')];if(rpc[this[_0xcce9('0x19')]+_0xcce9('0x26')]){if(this['channel']==='mail'){var _0x51b724={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp'][_0xcce9('0x27')]){_0x51b724[_0xcce9('0x27')]=this[_0xcce9('0x23')]['Smtp'][_0xcce9('0x27')];}else{_0x51b724[_0xcce9('0x28')]=this[_0xcce9('0x23')]['Smtp'][_0xcce9('0x28')];_0x51b724[_0xcce9('0x29')]=this[_0xcce9('0x23')][_0xcce9('0x2a')][_0xcce9('0x29')];_0x51b724[_0xcce9('0x2b')]=this[_0xcce9('0x23')]['Smtp'][_0xcce9('0x2b')];}if(this[_0xcce9('0x23')][_0xcce9('0x2a')][_0xcce9('0x2c')]){_0x51b724[_0xcce9('0x2d')]={'user':this['account'][_0xcce9('0x2a')][_0xcce9('0x2e')],'pass':this[_0xcce9('0x23')]['Smtp'][_0xcce9('0x2f')]};}_0x3d7815[_0xcce9('0x30')]=this[_0xcce9('0x1b')][_0xcce9('0x31')];_0x3d7815[_0xcce9('0x32')]=_0xcce9('0x33')+_[_0xcce9('0x34')](_0x3d7815[_0xcce9('0xc')],'','','headers','auto-replied','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','autoreplyExecuted','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','update','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','One\x20Time\x20already\x20sent','contact','format','out','getMustacheRender','body','message'];(function(_0x47804d,_0x269d3b){var _0x560e77=function(_0xf783cb){while(--_0xf783cb){_0x47804d['push'](_0x47804d['shift']());}};_0x560e77(++_0x269d3b);}(_0x2bfb,0xbf));var _0xb2bf=function(_0x49e4d8,_0x3eba1d){_0x49e4d8=_0x49e4d8-0x0;var _0x39e955=_0x2bfb[_0x49e4d8];return _0x39e955;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0xb2bf('0x0'));var logger=require(_0xb2bf('0x1'))(_0xb2bf('0x2'));var rpc={'chatMessage':require(_0xb2bf('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb2bf('0x4')),'smsMessage':require(_0xb2bf('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xb2bf('0x6')),'chatInteraction':require(_0xb2bf('0x7')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xb2bf('0x8')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xb2bf('0x9')),'whatsappInteraction':require(_0xb2bf('0xa'))};var mailRpc=require(_0xb2bf('0xb'));exports[_0xb2bf('0xc')]=function(_0x351804,_0x5d7dd8,_0xad8c16,_0x1a5285){return function(_0x3ad90a){try{var _0x84d768=this[_0xb2bf('0xd')];if(_0x84d768===_0xb2bf('0xe')&&_0x1a5285['body'][_0xb2bf('0xf')]){logger[_0xb2bf('0x10')](_0xb2bf('0x11'),_0x351804,_0xb2bf('0x12'));return _0x3ad90a[_0xb2bf('0x13')]();}if(_0x5d7dd8[0x0]==='1'&&(_[_0xb2bf('0x14')](this[_0xb2bf('0x15')][_0xb2bf('0x16')])||!this[_0xb2bf('0x15')][_0xb2bf('0x16')])){logger[_0xb2bf('0x10')](_0xb2bf('0x11'),_0x351804,_0xb2bf('0x17'));return _0x3ad90a[_0xb2bf('0x13')]();}if(_0x5d7dd8[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x351804,_0xb2bf('0x18'));return _0x3ad90a[_0xb2bf('0x13')]();}var _0x36cc22={'ContactId':this[_0xb2bf('0x19')]['id'],'sentAt':moment()[_0xb2bf('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xb2bf('0x1b')};if(this[_0xb2bf('0xd')]==='mail'){_0x36cc22['body']=utils[_0xb2bf('0x1c')](_0x5d7dd8[0x2],this);}else{_0x36cc22[_0xb2bf('0x1d')]=utils['getMustacheRender'](_0x5d7dd8[0x1],this);}if(this[_0xb2bf('0x1e')]){_0x36cc22['to']=this[_0xb2bf('0x1e')]['from']||'';if(this[_0xb2bf('0xd')]===_0xb2bf('0xe')&&_0x5d7dd8[0x1]==='1'){_0x36cc22['cc']=this[_0xb2bf('0x1e')]['cc']||'';}_0x36cc22[_0xb2bf('0x1f')]=this[_0xb2bf('0x1e')]['to']||'';_0x36cc22[_0xb2bf('0x20')]=this[_0xb2bf('0x1e')][_0xb2bf('0x20')]||'';_0x36cc22[_0xb2bf('0x21')]=!![];if(this[_0xb2bf('0x1e')][_0xb2bf('0x22')]){_0x36cc22[_0xb2bf('0x22')]='';_0x36cc22[_0xb2bf('0x22')]+=_[_0xb2bf('0x23')](this[_0xb2bf('0x1e')]['subject'],_0xb2bf('0x24'))?'':_0xb2bf('0x25');_0x36cc22[_0xb2bf('0x22')]+=this[_0xb2bf('0x1e')][_0xb2bf('0x22')];}}if(this[_0xb2bf('0xd')]===_0xb2bf('0x26')){_0x36cc22['ChatWebsiteId']=this['account']['id'];}else{_0x36cc22[_[_0xb2bf('0x27')](this['channel'])+_0xb2bf('0x28')]=this['account']['id'];}_0x36cc22[_['upperFirst'](this[_0xb2bf('0xd')])+'InteractionId']=this[_0xb2bf('0x15')]['id'];var _0xa75713=this[_0xb2bf('0x15')];if(rpc[this[_0xb2bf('0xd')]+_0xb2bf('0x29')]){if(this[_0xb2bf('0xd')]===_0xb2bf('0xe')){var _0x3add6b={'tls':{'rejectUnauthorized':![]}};if(this[_0xb2bf('0x2a')][_0xb2bf('0x2b')]['service']){_0x3add6b[_0xb2bf('0x2c')]=this[_0xb2bf('0x2a')][_0xb2bf('0x2b')][_0xb2bf('0x2c')];}else{_0x3add6b[_0xb2bf('0x2d')]=this['account'][_0xb2bf('0x2b')][_0xb2bf('0x2d')];_0x3add6b['port']=this[_0xb2bf('0x2a')]['Smtp'][_0xb2bf('0x2e')];_0x3add6b[_0xb2bf('0x2f')]=this[_0xb2bf('0x2a')][_0xb2bf('0x2b')][_0xb2bf('0x2f')];}if(this[_0xb2bf('0x2a')][_0xb2bf('0x2b')]['authentication']){_0x3add6b[_0xb2bf('0x30')]={'user':this[_0xb2bf('0x2a')][_0xb2bf('0x2b')][_0xb2bf('0x31')],'pass':this[_0xb2bf('0x2a')][_0xb2bf('0x2b')][_0xb2bf('0x32')]};}_0x36cc22['inReplyTo']=this[_0xb2bf('0x1e')][_0xb2bf('0x33')];_0x36cc22['html']=_0xb2bf('0x34')+_['replace'](_0x36cc22['body'],_0xb2bf('0x35'),_0xb2bf('0x36'))+_0xb2bf('0x37');_0x36cc22[_0xb2bf('0x38')]={'Auto-Submitted':_0xb2bf('0x39'),'X-Auto-Response-Suppress':'All','Precedence':_0xb2bf('0x3a')};return mailRpc[_0xb2bf('0x3b')](_0x3add6b,_0x36cc22)[_0xb2bf('0x3c')](function(_0x136b6c){logger[_0xb2bf('0x10')](_0xb2bf('0x3d'),_0x351804);_0x36cc22['messageId']=_0x136b6c[_0xb2bf('0x1e')][_0xb2bf('0x33')];return rpc[_0x84d768+'Message'][_0xb2bf('0x3e')](_0x36cc22);})[_0xb2bf('0x3c')](function(_0x340675){logger['info'](_0xb2bf('0x11'),_0x351804,JSON[_0xb2bf('0x3f')](_0x340675));})[_0xb2bf('0x40')](function(_0x1373ac){logger[_0xb2bf('0x41')](_0xb2bf('0x42'),_0x351804,JSON[_0xb2bf('0x3f')](_0x1373ac));})[_0xb2bf('0x43')](function(){Promise['resolve']()[_0xb2bf('0x3c')](function(){if(_0x5d7dd8[0x0]!=='2'||_0xa75713[_0xb2bf('0x44')])return;return rpc[_0x84d768+_0xb2bf('0x45')]['update'](_0xa75713['id'],{'autoreplyExecuted':!![]})[_0xb2bf('0x3c')](function(_0x28d768){logger[_0xb2bf('0x10')](_0xb2bf('0x46'),_0x351804,JSON[_0xb2bf('0x3f')](_0x28d768));})['catch'](function(_0x390bb7){logger[_0xb2bf('0x41')](_0xb2bf('0x47'),_0x351804,JSON['stringify'](_0x390bb7));});})[_0xb2bf('0x3c')](function(){_0x3ad90a['next']();});});}else{return rpc[this[_0xb2bf('0xd')]+_0xb2bf('0x29')]['create'](_0x36cc22)[_0xb2bf('0x3c')](function(_0x1b1092){logger[_0xb2bf('0x10')](_0xb2bf('0x11'),_0x351804,_0x36cc22[_0xb2bf('0x1d')]);})[_0xb2bf('0x40')](function(_0x1edca8){logger['error'](_0xb2bf('0x11'),_0x351804,JSON['stringify'](_0x1edca8));})['finally'](function(){Promise[_0xb2bf('0x48')]()['then'](function(){if(_0x5d7dd8[0x0]!=='2'||_0xa75713[_0xb2bf('0x44')])return;return rpc[_0x84d768+_0xb2bf('0x45')][_0xb2bf('0x49')](_0xa75713['id'],{'autoreplyExecuted':!![]})[_0xb2bf('0x3c')](function(_0x1adfb5){logger[_0xb2bf('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x351804,JSON[_0xb2bf('0x3f')](_0x1adfb5));})[_0xb2bf('0x40')](function(_0x9949ea){logger[_0xb2bf('0x41')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x351804,JSON[_0xb2bf('0x3f')](_0x9949ea));});})[_0xb2bf('0x3c')](function(){_0x3ad90a[_0xb2bf('0x13')]();});});}}}catch(_0x1f9039){logger[_0xb2bf('0x41')](_0xb2bf('0x11'),_0x351804,JSON['stringify'](_0x1f9039));_0x3ad90a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index f7529e5..051d82a 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc25a=['interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update'];(function(_0x29e9fc,_0x31053a){var _0x4a6715=function(_0x1c512b){while(--_0x1c512b){_0x29e9fc['push'](_0x29e9fc['shift']());}};_0x4a6715(++_0x31053a);}(_0xc25a,0xc5));var _0xac25=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xc25a[_0x5f309e];return _0x487b5e;};'use strict';var moment=require('moment');var logger=require(_0xac25('0x0'))('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xac25('0x1')),'smsInteraction':require(_0xac25('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xac25('0x3')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xac25('0x4')]=function(_0x1e8839,_0x54274f,_0x98b3d4,_0x1b46e8){return function(_0x46b65f){try{logger[_0xac25('0x5')](_0xac25('0x6'),_0x1e8839,_0x54274f[0x0]);var _0x8ac53={'closed':0x1,'closedAt':moment()['format'](_0xac25('0x7')),'closeReason':_0xac25('0x8'),'disposition':_0x54274f[0x0]};if(rpc[_0x1b46e8['channel']+_0xac25('0x9')]){rpc[_0x1b46e8[_0xac25('0xa')]+_0xac25('0x9')][_0xac25('0xb')](_0x1b46e8[_0xac25('0xc')]['id'],_0x8ac53)['then'](function(_0x541cc5){logger[_0xac25('0x5')](_0xac25('0xd'),_0x1e8839,_0x1b46e8[_0xac25('0xc')]['id']);})['catch'](function(_0x5d02e2){logger[_0xac25('0xe')](_0xac25('0xf'),_0x1e8839,JSON[_0xac25('0x10')](_0x5d02e2));})[_0xac25('0x11')](function(){_0x46b65f[_0xac25('0x12')]();});}}catch(_0x302966){logger['error']('[%s][CLOSE]\x20%s',_0x1e8839,JSON[_0xac25('0x10')](_0x302966));_0x46b65f[_0xac25('0x12')]();}};}; \ No newline at end of file +var _0x2c28=['stringify','finally','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s'];(function(_0x2d234d,_0x1f1328){var _0x23d20d=function(_0x1180af){while(--_0x1180af){_0x2d234d['push'](_0x2d234d['shift']());}};_0x23d20d(++_0x1f1328);}(_0x2c28,0x153));var _0x82c2=function(_0x266905,_0x1f529a){_0x266905=_0x266905-0x0;var _0x51c674=_0x2c28[_0x266905];return _0x51c674;};'use strict';var moment=require(_0x82c2('0x0'));var logger=require('../../../../config/logger')(_0x82c2('0x1'));var rpc={'chatInteraction':require(_0x82c2('0x2')),'openchannelInteraction':require(_0x82c2('0x3')),'smsInteraction':require(_0x82c2('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x82c2('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x82c2('0x6')]=function(_0x3d2fd5,_0x15502b,_0x3e5990,_0x15cfda){return function(_0x21ba40){try{logger[_0x82c2('0x7')](_0x82c2('0x8'),_0x3d2fd5,_0x15502b[0x0]);var _0x4b1fd2={'closed':0x1,'closedAt':moment()['format'](_0x82c2('0x9')),'closeReason':_0x82c2('0xa'),'disposition':_0x15502b[0x0]};if(rpc[_0x15cfda[_0x82c2('0xb')]+'Interaction']){rpc[_0x15cfda[_0x82c2('0xb')]+_0x82c2('0xc')]['update'](_0x15cfda[_0x82c2('0xd')]['id'],_0x4b1fd2)[_0x82c2('0xe')](function(_0x2bc0fb){logger[_0x82c2('0x7')](_0x82c2('0xf'),_0x3d2fd5,_0x15cfda[_0x82c2('0xd')]['id']);})[_0x82c2('0x10')](function(_0x17ce87){logger['error'](_0x82c2('0x11'),_0x3d2fd5,JSON[_0x82c2('0x12')](_0x17ce87));})[_0x82c2('0x13')](function(){_0x21ba40[_0x82c2('0x14')]();});}}catch(_0x356065){logger['error'](_0x82c2('0x11'),_0x3d2fd5,JSON['stringify'](_0x356065));_0x21ba40[_0x82c2('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 4979ad4..0c89ab4 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1224=['[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','providerName','dialogflow','providerResponse','result','metadata','catch','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','body','getMustacheRender','Message','create','then','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop'];(function(_0x384076,_0x491e1c){var _0x1d8f5d=function(_0x594e4c){while(--_0x594e4c){_0x384076['push'](_0x384076['shift']());}};_0x1d8f5d(++_0x491e1c);}(_0x1224,0x10d));var _0x4122=function(_0x4080dd,_0x5b595d){_0x4080dd=_0x4080dd-0x0;var _0x4ecf85=_0x1224[_0x4080dd];return _0x4ecf85;};'use strict';var _=require(_0x4122('0x0'));var moment=require(_0x4122('0x1'));var apiai=require(_0x4122('0x2'));var md5=require(_0x4122('0x3'));var utils=require(_0x4122('0x4'));var logger=require(_0x4122('0x5'))('routing');var rpc={'chatMessage':require(_0x4122('0x6')),'openchannelMessage':require(_0x4122('0x7')),'mailMessage':require(_0x4122('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x4122('0x9')),'whatsappMessage':require(_0x4122('0xa'))};exports[_0x4122('0xb')]=function(_0x40b5e4,_0x2a952c){return function(_0x431470){try{if(!_[_0x4122('0xc')](this[_0x4122('0xd')][_0x4122('0xe')])){logger[_0x4122('0xf')](_0x4122('0x10'),_0x40b5e4,_0x4122('0x11'));return _0x431470[_0x4122('0x12')]();}var _0x35160c={'ContactId':this[_0x4122('0x13')]['id'],'sentAt':moment()[_0x4122('0x14')](_0x4122('0x15')),'direction':_0x4122('0x16')};if(this[_0x4122('0x17')]===_0x4122('0x18')||this[_0x4122('0x17')]===_0x4122('0x19')){_0x35160c[_0x4122('0x1a')]=this[_0x4122('0xd')][_0x4122('0x1a')];}var _0x292932=this[_0x4122('0x17')];if(_0x292932===_0x4122('0x1b')){_0x35160c[_0x4122('0x1c')]=this[_0x4122('0x1d')]['id'];}else{_0x35160c[_[_0x4122('0x1e')](_0x292932)+'AccountId']=this[_0x4122('0x1d')]['id'];}_0x35160c[_[_0x4122('0x1e')](_0x292932)+_0x4122('0x1f')]=this[_0x4122('0xd')]['id'];if(this['interaction'][_0x4122('0x20')]){var _0x19684e=_0x2a952c[0x2];if(!_['isEmpty'](_0x19684e)){_0x35160c[_0x4122('0x21')]=utils[_0x4122('0x22')](_0x19684e,this);return rpc[_0x292932+_0x4122('0x23')][_0x4122('0x24')](_0x35160c)[_0x4122('0x25')](function(_0x42374d){logger[_0x4122('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x40b5e4,_0x35160c['body']);})['catch'](function(_0x43ebe7){logger[_0x4122('0x26')](_0x4122('0x10'),_0x40b5e4,JSON[_0x4122('0x27')](_0x43ebe7));})[_0x4122('0x28')](function(){logger[_0x4122('0xf')](_0x4122('0x29'),_0x40b5e4);_0x431470[_0x4122('0x2a')]();});}else{logger['info'](_0x4122('0x2b'),_0x40b5e4);_0x431470['stop']();}}else{var _0x4f949a=this;var _0x508cd7=apiai(_0x2a952c[0x0],{'language':_0x2a952c[0x1]||'en'});return _0x508cd7[_0x4122('0x2c')](this[_0x4122('0x2d')][_0x4122('0x21')],{'sessionId':md5(this['interaction']['id'])})[_0x4122('0x25')](function(_0x386cdc){_0x4f949a['body']['dialogflow']=_0x386cdc;_0x35160c[_0x4122('0x21')]=_0x386cdc['result']['fulfillment']['speech'];_0x35160c[_0x4122('0x2e')]=_0x4122('0x2f');_0x35160c[_0x4122('0x30')]=JSON[_0x4122('0x27')](_0x386cdc);return rpc[_0x292932+_0x4122('0x23')][_0x4122('0x24')](_0x35160c)[_0x4122('0x25')](function(_0x7fe50d){logger[_0x4122('0xf')](_0x4122('0x10'),_0x40b5e4,_0x35160c[_0x4122('0x21')]);if(_0x386cdc[_0x4122('0x31')][_0x4122('0x32')]['endConversation']){_0x431470[_0x4122('0x12')]();}else{_0x431470[_0x4122('0x2a')]();}})[_0x4122('0x33')](function(_0x31f141){logger['error'](_0x4122('0x10'),_0x40b5e4,JSON['stringify'](_0x31f141));_0x431470[_0x4122('0x12')]();});})[_0x4122('0x33')](function(_0x3a9633){logger[_0x4122('0x26')](_0x4122('0x10'),_0x40b5e4,_0x3a9633[_0x4122('0x2d')]);_0x431470[_0x4122('0x12')]();});}}catch(_0x427e8a){logger['error'](_0x4122('0x10'),_0x40b5e4,JSON[_0x4122('0x27')](_0x427e8a));_0x431470['stop']();}};}; \ No newline at end of file +var _0x6003=['interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','upperFirst','AccountId','account','InteractionId','isEmpty','body','create','then','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','speech','stringify','Message','endConversation','catch','lodash','moment','apiai-promise','md5','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence'];(function(_0x29d8df,_0x120dba){var _0x602ef6=function(_0x6fb85e){while(--_0x6fb85e){_0x29d8df['push'](_0x29d8df['shift']());}};_0x602ef6(++_0x120dba);}(_0x6003,0xae));var _0x3600=function(_0x21a9ad,_0xf9042f){_0x21a9ad=_0x21a9ad-0x0;var _0x4c01e7=_0x6003[_0x21a9ad];return _0x4c01e7;};'use strict';var _=require(_0x3600('0x0'));var moment=require(_0x3600('0x1'));var apiai=require(_0x3600('0x2'));var md5=require(_0x3600('0x3'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x3600('0x4'));var rpc={'chatMessage':require(_0x3600('0x5')),'openchannelMessage':require(_0x3600('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x3600('0x7')),'faxMessage':require(_0x3600('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x3600('0x9')]=function(_0x4f4130,_0x4880c7){return function(_0x177f11){try{if(!_['isNil'](this[_0x3600('0xa')]['UserId'])){logger[_0x3600('0xb')](_0x3600('0xc'),_0x4f4130,_0x3600('0xd'));return _0x177f11[_0x3600('0xe')]();}var _0x5b30c1={'ContactId':this[_0x3600('0xf')]['id'],'sentAt':moment()[_0x3600('0x10')](_0x3600('0x11')),'direction':_0x3600('0x12')};if(this[_0x3600('0x13')]===_0x3600('0x14')||this[_0x3600('0x13')]===_0x3600('0x15')){_0x5b30c1[_0x3600('0x16')]=this[_0x3600('0xa')][_0x3600('0x16')];}var _0x3c1d78=this['channel'];if(_0x3c1d78===_0x3600('0x17')){_0x5b30c1['ChatWebsiteId']=this['account']['id'];}else{_0x5b30c1[_[_0x3600('0x18')](_0x3c1d78)+_0x3600('0x19')]=this[_0x3600('0x1a')]['id'];}_0x5b30c1[_['upperFirst'](_0x3c1d78)+_0x3600('0x1b')]=this['interaction']['id'];if(this[_0x3600('0xa')]['created']){var _0x28260c=_0x4880c7[0x2];if(!_[_0x3600('0x1c')](_0x28260c)){_0x5b30c1[_0x3600('0x1d')]=utils['getMustacheRender'](_0x28260c,this);return rpc[_0x3c1d78+'Message'][_0x3600('0x1e')](_0x5b30c1)[_0x3600('0x1f')](function(_0xcb98b5){logger[_0x3600('0xb')]('[%s][DIALOGFLOW]\x20%s',_0x4f4130,_0x5b30c1[_0x3600('0x1d')]);})['catch'](function(_0x157c9d){logger[_0x3600('0x20')](_0x3600('0xc'),_0x4f4130,JSON['stringify'](_0x157c9d));})[_0x3600('0x21')](function(){logger['info'](_0x3600('0x22'),_0x4f4130);_0x177f11[_0x3600('0x23')]();});}else{logger[_0x3600('0xb')](_0x3600('0x24'),_0x4f4130);_0x177f11[_0x3600('0x23')]();}}else{var _0x47d58c=this;var _0x7e30a0=apiai(_0x4880c7[0x0],{'language':_0x4880c7[0x1]||'en'});return _0x7e30a0[_0x3600('0x25')](this[_0x3600('0x26')][_0x3600('0x1d')],{'sessionId':md5(this[_0x3600('0xa')]['id'])})[_0x3600('0x1f')](function(_0x1e5492){_0x47d58c[_0x3600('0x1d')][_0x3600('0x27')]=_0x1e5492;_0x5b30c1[_0x3600('0x1d')]=_0x1e5492[_0x3600('0x28')]['fulfillment'][_0x3600('0x29')];_0x5b30c1['providerName']=_0x3600('0x27');_0x5b30c1['providerResponse']=JSON[_0x3600('0x2a')](_0x1e5492);return rpc[_0x3c1d78+_0x3600('0x2b')][_0x3600('0x1e')](_0x5b30c1)[_0x3600('0x1f')](function(_0x2a4257){logger[_0x3600('0xb')]('[%s][DIALOGFLOW]\x20%s',_0x4f4130,_0x5b30c1[_0x3600('0x1d')]);if(_0x1e5492[_0x3600('0x28')]['metadata'][_0x3600('0x2c')]){_0x177f11[_0x3600('0xe')]();}else{_0x177f11[_0x3600('0x23')]();}})[_0x3600('0x2d')](function(_0x3e3ce0){logger[_0x3600('0x20')](_0x3600('0xc'),_0x4f4130,JSON[_0x3600('0x2a')](_0x3e3ce0));_0x177f11['next']();});})['catch'](function(_0x386e47){logger['error'](_0x3600('0xc'),_0x4f4130,_0x386e47[_0x3600('0x26')]);_0x177f11[_0x3600('0xe')]();});}}catch(_0x5b222a){logger['error'](_0x3600('0xc'),_0x4f4130,JSON[_0x3600('0x2a')](_0x5b222a));_0x177f11['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index fe28d5b..c19230c 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7b6=['./utils','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','stringify','isNil','UserId','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','Message','create','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','interaction','message','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','next','lodash','dialogflow','bluebird','../../../../config/logger'];(function(_0x5589aa,_0x427af0){var _0x132ce1=function(_0x5c8805){while(--_0x5c8805){_0x5589aa['push'](_0x5589aa['shift']());}};_0x132ce1(++_0x427af0);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x4aa39f,_0x4ef1e9){_0x4aa39f=_0x4aa39f-0x0;var _0xd1aab3=_0xb7b6[_0x4aa39f];return _0xd1aab3;};'use strict';var _=require(_0x6b7b('0x0'));var dialogflow=require(_0x6b7b('0x1'));var md5=require('md5');var moment=require('moment');var Promise=require(_0x6b7b('0x2'));var logger=require(_0x6b7b('0x3'))('routing');var utils=require(_0x6b7b('0x4'));var rpc={'chatMessage':require(_0x6b7b('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x6b7b('0x6')),'faxMessage':require(_0x6b7b('0x7')),'whatsappMessage':require(_0x6b7b('0x8'))};function createMessage(_0xff519e,_0x24359f,_0x483b9c,_0x49a6c8){return new Promise(function(_0x2bb86d,_0x1a29b4){var _0x233bbf=_[_0x6b7b('0x9')](_0x483b9c);_0x233bbf['body']=_0x49a6c8;return rpc[_0x24359f+'Message']['create'](_0x233bbf)[_0x6b7b('0xa')](function(){logger[_0x6b7b('0xb')](_0x6b7b('0xc'),_0xff519e,_0x233bbf[_0x6b7b('0xd')]);_0x2bb86d();})[_0x6b7b('0xe')](function(_0x2e84d5){logger['error'](_0x6b7b('0xc'),_0xff519e,JSON[_0x6b7b('0xf')](_0x2e84d5));_0x1a29b4(_0x2e84d5);});});}exports['consequence']=function(_0xc4ad78,_0x31ee5a){return function(_0x5d0d97){try{if(!_[_0x6b7b('0x10')](this['interaction'][_0x6b7b('0x11')])){logger[_0x6b7b('0xb')](_0x6b7b('0xc'),_0xc4ad78,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5d0d97['next']();}var _0xa8e568={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x6b7b('0x12')),'direction':_0x6b7b('0x13')};if(this['channel']===_0x6b7b('0x14')||this[_0x6b7b('0x15')]===_0x6b7b('0x16')){_0xa8e568[_0x6b7b('0x17')]=this['interaction'][_0x6b7b('0x17')];}var _0x2036ec=this[_0x6b7b('0x15')];if(_0x2036ec===_0x6b7b('0x18')){_0xa8e568[_0x6b7b('0x19')]=this[_0x6b7b('0x1a')]['id'];}else{_0xa8e568[_[_0x6b7b('0x1b')](_0x2036ec)+_0x6b7b('0x1c')]=this['account']['id'];}_0xa8e568[_['upperFirst'](_0x2036ec)+_0x6b7b('0x1d')]=this['interaction']['id'];if(this['interaction']['created']){var _0x5a22c2=_0x31ee5a[0x4];if(!_[_0x6b7b('0x1e')](_0x5a22c2)){_0xa8e568[_0x6b7b('0xd')]=utils['getMustacheRender'](_0x5a22c2,this);return rpc[_0x2036ec+_0x6b7b('0x1f')][_0x6b7b('0x20')](_0xa8e568)['then'](function(_0xb33256){logger[_0x6b7b('0xb')](_0x6b7b('0xc'),_0xc4ad78,_0xa8e568[_0x6b7b('0xd')]);})[_0x6b7b('0xe')](function(_0x473bf2){logger[_0x6b7b('0x21')](_0x6b7b('0xc'),_0xc4ad78,JSON[_0x6b7b('0xf')](_0x473bf2));})[_0x6b7b('0x22')](function(){logger[_0x6b7b('0xb')](_0x6b7b('0x23'),_0xc4ad78);_0x5d0d97[_0x6b7b('0x24')]();});}else{logger[_0x6b7b('0xb')](_0x6b7b('0x25'),_0xc4ad78);_0x5d0d97['stop']();}}else{var _0x5309e1=this;var _0x3120a3=_0x31ee5a[0x2][_0x6b7b('0x26')](/\\n/g,'\x0a');var _0x31729e={'credentials':{'private_key':_0x3120a3,'client_email':_0x31ee5a[0x1]}};var _0x48a122=new dialogflow[(_0x6b7b('0x27'))](_0x31729e);var _0x489bc6=_0x48a122[_0x6b7b('0x28')](_0x31ee5a[0x0],md5(_0x5309e1[_0x6b7b('0x29')]['id']));var _0xb9d22a={'session':_0x489bc6,'queryInput':{'text':{'text':_0x5309e1[_0x6b7b('0x2a')]['body'],'languageCode':_0x31ee5a[0x3]||'en'}}};return _0x48a122['detectIntent'](_0xb9d22a)[_0x6b7b('0xa')](function(_0x269f50){if(_0x269f50&&_0x269f50[_0x6b7b('0x2b')]){_0x5309e1[_0x6b7b('0xd')][_0x6b7b('0x2c')]=_0x269f50;var _0xef8922=_0x269f50[0x0];var _0xb9bff1=_0xef8922['queryResult']['diagnosticInfo']&&_0xef8922[_0x6b7b('0x2d')][_0x6b7b('0x2e')][_0x6b7b('0x2f')]?_0xef8922[_0x6b7b('0x2d')]['diagnosticInfo']['fields'][_0x6b7b('0x30')][_0x6b7b('0x31')]:![];_0x5309e1['body'][_0x6b7b('0x32')]=_0xef8922[_0x6b7b('0x2d')][_0x6b7b('0x33')];_0x5309e1[_0x6b7b('0xd')][_0x6b7b('0x34')]=_0xef8922['queryResult'][_0x6b7b('0x35')];_0x5309e1[_0x6b7b('0xd')][_0x6b7b('0x36')]=_0xef8922['queryResult'][_0x6b7b('0x2e')]&&_0xef8922[_0x6b7b('0x2d')][_0x6b7b('0x2e')]['fields']?_0xef8922[_0x6b7b('0x2d')][_0x6b7b('0x2e')][_0x6b7b('0x2f')][_0x6b7b('0x30')][_0x6b7b('0x31')]:![];_0x5309e1['body'][_0x6b7b('0x37')]=_0xef8922[_0x6b7b('0x2d')][_0x6b7b('0x38')][_0x6b7b('0x39')];_0x5309e1[_0x6b7b('0xd')][_0x6b7b('0x3a')]=_0xef8922[_0x6b7b('0x2d')][_0x6b7b('0x38')][_0x6b7b('0x3b')];_0x5309e1['body'][_0x6b7b('0x3c')]=_0xef8922[_0x6b7b('0x2d')][_0x6b7b('0x38')][_0x6b7b('0x3d')];_0x5309e1[_0x6b7b('0xd')][_0x6b7b('0x3e')]=_0xef8922[_0x6b7b('0x2d')]['languageCode'];_0x5309e1[_0x6b7b('0xd')][_0x6b7b('0x3f')]=_0xef8922[_0x6b7b('0x2d')][_0x6b7b('0x40')];_0x5309e1[_0x6b7b('0xd')][_0x6b7b('0x41')]=_0xef8922[_0x6b7b('0x2d')][_0x6b7b('0x42')];_0xa8e568[_0x6b7b('0x43')]=_0x6b7b('0x2c');_0xa8e568[_0x6b7b('0x44')]=JSON['stringify'](_0x269f50);var _0x438f15=[];for(var _0x343829=0x0;_0x343829<_0x269f50[_0x6b7b('0x2b')];_0x343829++){var _0x501839=_0x269f50[_0x343829];if(_0x501839&&_0x501839[_0x6b7b('0x2d')]&&_0x501839[_0x6b7b('0x2d')][_0x6b7b('0x45')]){_0x438f15['push'](createMessage(_0xc4ad78,_0x2036ec,_0xa8e568,_0x501839[_0x6b7b('0x2d')][_0x6b7b('0x45')]));}}return Promise['all'](_0x438f15)[_0x6b7b('0xa')](function(){if(_0xb9bff1){_0x5d0d97[_0x6b7b('0x46')]();}else{_0x5d0d97[_0x6b7b('0x24')]();}})[_0x6b7b('0xe')](function(_0x5dbd7f){logger['error'](_0x6b7b('0xc'),_0xc4ad78,JSON[_0x6b7b('0xf')](_0x5dbd7f));_0x5d0d97[_0x6b7b('0x46')]();});}})['catch'](function(_0x4da4ee){logger[_0x6b7b('0x21')](_0x6b7b('0xc'),_0xc4ad78,_0x4da4ee[_0x6b7b('0x2a')]);_0x5d0d97[_0x6b7b('0x46')]();});}}catch(_0x29a68c){logger[_0x6b7b('0x21')]('[%s][DIALOGFLOWV2]\x20%s',_0xc4ad78,JSON['stringify'](_0x29a68c));_0x5d0d97[_0x6b7b('0x24')]();}};}; \ No newline at end of file +var _0x7d86=['../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','isNil','interaction','UserId','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','isEmpty','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','queryText','DIALOGFLOWV2_SCORE','providerName','fulfillmentText','all','error','message','lodash','md5','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7d86,0x86));var _0x67d8=function(_0x3e7aff,_0x49fcdc){_0x3e7aff=_0x3e7aff-0x0;var _0x2b7104=_0x7d86[_0x3e7aff];return _0x2b7104;};'use strict';var _=require(_0x67d8('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x67d8('0x1'));var moment=require(_0x67d8('0x2'));var Promise=require(_0x67d8('0x3'));var logger=require(_0x67d8('0x4'))(_0x67d8('0x5'));var utils=require(_0x67d8('0x6'));var rpc={'chatMessage':require(_0x67d8('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x67d8('0x8')),'smsMessage':require(_0x67d8('0x9')),'faxMessage':require(_0x67d8('0xa')),'whatsappMessage':require(_0x67d8('0xb'))};function createMessage(_0x2485fa,_0x282b7a,_0x30c690,_0x16e834){return new Promise(function(_0x31726a,_0x23ffff){var _0x46738e=_[_0x67d8('0xc')](_0x30c690);_0x46738e[_0x67d8('0xd')]=_0x16e834;return rpc[_0x282b7a+_0x67d8('0xe')][_0x67d8('0xf')](_0x46738e)[_0x67d8('0x10')](function(){logger[_0x67d8('0x11')](_0x67d8('0x12'),_0x2485fa,_0x46738e[_0x67d8('0xd')]);_0x31726a();})[_0x67d8('0x13')](function(_0x148d9c){logger['error'](_0x67d8('0x12'),_0x2485fa,JSON[_0x67d8('0x14')](_0x148d9c));_0x23ffff(_0x148d9c);});});}exports[_0x67d8('0x15')]=function(_0x4ea2e9,_0x159982){return function(_0xfa31ae){try{if(!_[_0x67d8('0x16')](this[_0x67d8('0x17')][_0x67d8('0x18')])){logger[_0x67d8('0x11')](_0x67d8('0x12'),_0x4ea2e9,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xfa31ae[_0x67d8('0x19')]();}var _0x2f83e9={'ContactId':this[_0x67d8('0x1a')]['id'],'sentAt':moment()['format'](_0x67d8('0x1b')),'direction':_0x67d8('0x1c')};if(this['channel']===_0x67d8('0x1d')||this[_0x67d8('0x1e')]===_0x67d8('0x1f')){_0x2f83e9[_0x67d8('0x20')]=this[_0x67d8('0x17')][_0x67d8('0x20')];}var _0x5117d0=this[_0x67d8('0x1e')];if(_0x5117d0===_0x67d8('0x21')){_0x2f83e9[_0x67d8('0x22')]=this[_0x67d8('0x23')]['id'];}else{_0x2f83e9[_[_0x67d8('0x24')](_0x5117d0)+'AccountId']=this[_0x67d8('0x23')]['id'];}_0x2f83e9[_[_0x67d8('0x24')](_0x5117d0)+'InteractionId']=this['interaction']['id'];if(this[_0x67d8('0x17')]['created']){var _0x2481eb=_0x159982[0x4];if(!_[_0x67d8('0x25')](_0x2481eb)){_0x2f83e9[_0x67d8('0xd')]=utils['getMustacheRender'](_0x2481eb,this);return rpc[_0x5117d0+'Message'][_0x67d8('0xf')](_0x2f83e9)[_0x67d8('0x10')](function(_0x43694a){logger[_0x67d8('0x11')](_0x67d8('0x12'),_0x4ea2e9,_0x2f83e9['body']);})[_0x67d8('0x13')](function(_0x29613c){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x4ea2e9,JSON[_0x67d8('0x14')](_0x29613c));})[_0x67d8('0x26')](function(){logger['info'](_0x67d8('0x27'),_0x4ea2e9);_0xfa31ae[_0x67d8('0x28')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4ea2e9);_0xfa31ae[_0x67d8('0x28')]();}}else{var _0x32802e=this;var _0x5873f5=_0x159982[0x2][_0x67d8('0x29')](/\\n/g,'\x0a');var _0x2d2506={'credentials':{'private_key':_0x5873f5,'client_email':_0x159982[0x1]}};var _0x59e3c3=new dialogflow[(_0x67d8('0x2a'))](_0x2d2506);var _0x5c7f05=_0x59e3c3[_0x67d8('0x2b')](_0x159982[0x0],md5(_0x32802e[_0x67d8('0x17')]['id']));var _0x300bc7={'session':_0x5c7f05,'queryInput':{'text':{'text':_0x32802e['message']['body'],'languageCode':_0x159982[0x3]||'en'}}};return _0x59e3c3['detectIntent'](_0x300bc7)[_0x67d8('0x10')](function(_0x51bcfc){if(_0x51bcfc&&_0x51bcfc[_0x67d8('0x2c')]){_0x32802e[_0x67d8('0xd')][_0x67d8('0x2d')]=_0x51bcfc;var _0xbb3471=_0x51bcfc[0x0];var _0x5d994b=_0xbb3471[_0x67d8('0x2e')][_0x67d8('0x2f')]&&_0xbb3471[_0x67d8('0x2e')][_0x67d8('0x2f')]['fields']?_0xbb3471['queryResult'][_0x67d8('0x2f')][_0x67d8('0x30')]['end_conversation'][_0x67d8('0x31')]:![];_0x32802e[_0x67d8('0xd')][_0x67d8('0x32')]=_0xbb3471[_0x67d8('0x2e')][_0x67d8('0x33')];_0x32802e[_0x67d8('0xd')][_0x67d8('0x34')]=_0xbb3471[_0x67d8('0x2e')]['allRequiredParamsPresent'];_0x32802e['body'][_0x67d8('0x35')]=_0xbb3471[_0x67d8('0x2e')]['diagnosticInfo']&&_0xbb3471[_0x67d8('0x2e')][_0x67d8('0x2f')][_0x67d8('0x30')]?_0xbb3471[_0x67d8('0x2e')][_0x67d8('0x2f')]['fields']['end_conversation'][_0x67d8('0x31')]:![];_0x32802e[_0x67d8('0xd')][_0x67d8('0x36')]=_0xbb3471[_0x67d8('0x2e')]['intent'][_0x67d8('0x37')];_0x32802e['body'][_0x67d8('0x38')]=_0xbb3471[_0x67d8('0x2e')][_0x67d8('0x39')][_0x67d8('0x3a')];_0x32802e[_0x67d8('0xd')][_0x67d8('0x3b')]=_0xbb3471[_0x67d8('0x2e')]['intent'][_0x67d8('0x3c')];_0x32802e[_0x67d8('0xd')][_0x67d8('0x3d')]=_0xbb3471['queryResult']['languageCode'];_0x32802e[_0x67d8('0xd')]['DIALOGFLOWV2_QUERYTEXT']=_0xbb3471[_0x67d8('0x2e')][_0x67d8('0x3e')];_0x32802e[_0x67d8('0xd')][_0x67d8('0x3f')]=_0xbb3471[_0x67d8('0x2e')]['intentDetectionConfidence'];_0x2f83e9[_0x67d8('0x40')]=_0x67d8('0x2d');_0x2f83e9['providerResponse']=JSON[_0x67d8('0x14')](_0x51bcfc);var _0x3f881f=[];for(var _0xf8c4d0=0x0;_0xf8c4d0<_0x51bcfc[_0x67d8('0x2c')];_0xf8c4d0++){var _0x40f375=_0x51bcfc[_0xf8c4d0];if(_0x40f375&&_0x40f375[_0x67d8('0x2e')]&&_0x40f375['queryResult'][_0x67d8('0x41')]){_0x3f881f['push'](createMessage(_0x4ea2e9,_0x5117d0,_0x2f83e9,_0x40f375[_0x67d8('0x2e')][_0x67d8('0x41')]));}}return Promise[_0x67d8('0x42')](_0x3f881f)[_0x67d8('0x10')](function(){if(_0x5d994b){_0xfa31ae[_0x67d8('0x19')]();}else{_0xfa31ae[_0x67d8('0x28')]();}})[_0x67d8('0x13')](function(_0x425c87){logger[_0x67d8('0x43')](_0x67d8('0x12'),_0x4ea2e9,JSON[_0x67d8('0x14')](_0x425c87));_0xfa31ae[_0x67d8('0x19')]();});}})[_0x67d8('0x13')](function(_0xa0619b){logger[_0x67d8('0x43')](_0x67d8('0x12'),_0x4ea2e9,_0xa0619b[_0x67d8('0x44')]);_0xfa31ae[_0x67d8('0x19')]();});}}catch(_0x3448ec){logger[_0x67d8('0x43')](_0x67d8('0x12'),_0x4ea2e9,JSON[_0x67d8('0x14')](_0x3448ec));_0xfa31ae[_0x67d8('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 76fa52f..7ec31df 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0800=['map','join','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','message','stringify','validate','lodash','html-to-text','./utils','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x0800,0xa9));var _0x0080=function(_0x1d21bb,_0x66aa27){_0x1d21bb=_0x1d21bb-0x0;var _0x34cb4e=_0x0800[_0x1d21bb];return _0x34cb4e;};'use strict';var schema=require(_0x0080('0x0'));var _=require(_0x0080('0x1'));var htmlToText=require(_0x0080('0x2'));var utils=require(_0x0080('0x3'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0x0080('0x4'),'required':!![],'message':_0x0080('0x5')},'priorityTrue':{'type':_0x0080('0x6'),'message':_0x0080('0x7')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x240e20,_0x2d7e24){return function(_0x4b7508){try{var _0x24bfc7={'condition':htmlToText['fromString'](utils[_0x0080('0x8')](_0x2d7e24[0x0],this),{'wordwrap':![]})[_0x0080('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2d7e24[0x1],'priorityFalse':_0x2d7e24[0x2]};var _0x2b86a0=gotoif[_0x0080('0x0')](_0x24bfc7,{'typecast':!![]});if(_0x2b86a0[_0x0080('0xa')]){logger[_0x0080('0xb')](_0x0080('0xc'),_0x240e20,_[_0x0080('0xd')](_0x2b86a0,'message')[_0x0080('0xe')](',\x20'));_0x4b7508[_0x0080('0xf')]();}else{try{var _0x144cbc=eval('('+_0x24bfc7[_0x0080('0x10')]+')');var _0x4479dc=_0x144cbc?_0x24bfc7[_0x0080('0x11')]:_0x24bfc7[_0x0080('0x12')];logger['info'](_0x0080('0x13'),_0x240e20,_0x24bfc7[_0x0080('0x10')],_0x144cbc,_0x4479dc||_0x0080('0x14'));if(_0x4479dc){var _0x57623d=_['findIndex'](_0x4b7508[_0x0080('0x15')](),{'p':_0x4479dc});if(_0x57623d>=0x0){logger[_0x0080('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x240e20,_0x4479dc||'next',_0x57623d);_0x4b7508[_0x0080('0x14')](_0x57623d);}else{logger['info'](_0x0080('0x17'),_0x240e20,_0x4479dc||_0x0080('0x14'));_0x4b7508[_0x0080('0xf')]();}}else{_0x4b7508[_0x0080('0x14')]();}}catch(_0x375d6a){logger[_0x0080('0xb')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x240e20,_0x375d6a[_0x0080('0x18')]);_0x4b7508[_0x0080('0xf')]();}}}catch(_0x4ae5f1){logger[_0x0080('0xb')]('[%s][GOTOIF]\x20%s',_0x240e20,JSON[_0x0080('0x19')](_0x4ae5f1));_0x4b7508[_0x0080('0xf')]();}};}; \ No newline at end of file +var _0xc057=['priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','error','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number'];(function(_0x14ca60,_0x4ef0f7){var _0x1f0291=function(_0x303c72){while(--_0x303c72){_0x14ca60['push'](_0x14ca60['shift']());}};_0x1f0291(++_0x4ef0f7);}(_0xc057,0xa6));var _0x7c05=function(_0x592c0d,_0x1a8ed9){_0x592c0d=_0x592c0d-0x0;var _0x551b1c=_0xc057[_0x592c0d];return _0x551b1c;};'use strict';var schema=require(_0x7c05('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0x7c05('0x1'));var logger=require(_0x7c05('0x2'))(_0x7c05('0x3'));var gotoif=schema({'condition':{'type':_0x7c05('0x4'),'required':!![],'message':_0x7c05('0x5')},'priorityTrue':{'type':_0x7c05('0x6'),'message':_0x7c05('0x7')},'priorityFalse':{'type':_0x7c05('0x6'),'message':_0x7c05('0x8')}});exports[_0x7c05('0x9')]=function(_0x457c5c,_0xecd13f){return function(_0x2d9765){try{var _0x3cdfd4={'condition':htmlToText[_0x7c05('0xa')](utils[_0x7c05('0xb')](_0xecd13f[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xecd13f[0x1],'priorityFalse':_0xecd13f[0x2]};var _0x2cf907=gotoif[_0x7c05('0x0')](_0x3cdfd4,{'typecast':!![]});if(_0x2cf907[_0x7c05('0xc')]){logger[_0x7c05('0xd')]('[%s][GOTOIF]\x20%s',_0x457c5c,_[_0x7c05('0xe')](_0x2cf907,_0x7c05('0xf'))[_0x7c05('0x10')](',\x20'));_0x2d9765[_0x7c05('0x11')]();}else{try{var _0x1d3b3c=eval('('+_0x3cdfd4[_0x7c05('0x12')]+')');var _0x2d60a6=_0x1d3b3c?_0x3cdfd4[_0x7c05('0x13')]:_0x3cdfd4[_0x7c05('0x14')];logger[_0x7c05('0x15')](_0x7c05('0x16'),_0x457c5c,_0x3cdfd4[_0x7c05('0x12')],_0x1d3b3c,_0x2d60a6||'next');if(_0x2d60a6){var _0xea8386=_[_0x7c05('0x17')](_0x2d9765['rules'](),{'p':_0x2d60a6});if(_0xea8386>=0x0){logger[_0x7c05('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x457c5c,_0x2d60a6||'next',_0xea8386);_0x2d9765[_0x7c05('0x18')](_0xea8386);}else{logger[_0x7c05('0x15')](_0x7c05('0x19'),_0x457c5c,_0x2d60a6||_0x7c05('0x18'));_0x2d9765[_0x7c05('0x11')]();}}else{_0x2d9765[_0x7c05('0x18')]();}}catch(_0x53538b){logger['error'](_0x7c05('0x1a'),_0x457c5c,_0x53538b['message']);_0x2d9765[_0x7c05('0x11')]();}}}catch(_0x559e2b){logger[_0x7c05('0xd')](_0x7c05('0x1b'),_0x457c5c,JSON[_0x7c05('0x1c')](_0x559e2b));_0x2d9765[_0x7c05('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 72b34af..78bc04c 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 _0xccb5=['priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','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'];(function(_0x5e11e0,_0x496f6c){var _0x32964e=function(_0x292a9a){while(--_0x292a9a){_0x5e11e0['push'](_0x5e11e0['shift']());}};_0x32964e(++_0x496f6c);}(_0xccb5,0xe9));var _0x5ccb=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xccb5[_0x397e5f];return _0x5302b8;};'use strict';var schema=require(_0x5ccb('0x0'));var _=require(_0x5ccb('0x1'));var logger=require(_0x5ccb('0x2'))(_0x5ccb('0x3'));var gotop=schema({'priority':{'type':_0x5ccb('0x4'),'required':!![],'message':_0x5ccb('0x5')}});exports[_0x5ccb('0x6')]=function(_0x3eb07,_0x43134b){return function(_0x478dd6){try{var _0xddad33={'priority':_0x43134b[0x0]};var _0x5caa7f=gotop[_0x5ccb('0x0')](_0xddad33,{'typecast':!![]});if(_0x5caa7f[_0x5ccb('0x7')]){logger[_0x5ccb('0x8')](_0x5ccb('0x9'),_0x3eb07,_['map'](_0x5caa7f,_0x5ccb('0xa'))[_0x5ccb('0xb')](',\x20'));_0x478dd6[_0x5ccb('0xc')]();}else{logger[_0x5ccb('0xd')]('[%s][GOTOP]\x20priority\x20%s',_0x3eb07,_0xddad33[_0x5ccb('0xe')]);if(_0xddad33[_0x5ccb('0xe')]){var _0x293dd5=_[_0x5ccb('0xf')](_0x478dd6[_0x5ccb('0x10')](),{'p':_0xddad33[_0x5ccb('0xe')]});if(_0x293dd5>=0x0){logger[_0x5ccb('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3eb07,_0xddad33[_0x5ccb('0xe')]||'next',_0x293dd5);_0x478dd6[_0x5ccb('0x11')](_0x293dd5);}else{logger[_0x5ccb('0xd')](_0x5ccb('0x12'),_0x3eb07,_0xddad33['priority']||_0x5ccb('0x11'));_0x478dd6[_0x5ccb('0xc')]();}}else{_0x478dd6[_0x5ccb('0x11')]();}}}catch(_0x4947ca){logger[_0x5ccb('0x8')](_0x5ccb('0x9'),_0x3eb07,JSON['stringify'](_0x4947ca));_0x478dd6[_0x5ccb('0xc')]();}};}; \ No newline at end of file +var _0x78f1=['stringify','validate','lodash','../../../../config/logger','routing','number','consequence','length','error','[%s][GOTOP]\x20%s','message','join','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','stop'];(function(_0x5ec544,_0x31a0c5){var _0x15d14e=function(_0x2435bf){while(--_0x2435bf){_0x5ec544['push'](_0x5ec544['shift']());}};_0x15d14e(++_0x31a0c5);}(_0x78f1,0x79));var _0x178f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x78f1[_0x2c91e9];return _0x13f0ff;};'use strict';var schema=require(_0x178f('0x0'));var _=require(_0x178f('0x1'));var logger=require(_0x178f('0x2'))(_0x178f('0x3'));var gotop=schema({'priority':{'type':_0x178f('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x178f('0x5')]=function(_0x1188fa,_0x421c6f){return function(_0x2a8775){try{var _0x3c6c4d={'priority':_0x421c6f[0x0]};var _0x19ddfe=gotop[_0x178f('0x0')](_0x3c6c4d,{'typecast':!![]});if(_0x19ddfe[_0x178f('0x6')]){logger[_0x178f('0x7')](_0x178f('0x8'),_0x1188fa,_['map'](_0x19ddfe,_0x178f('0x9'))[_0x178f('0xa')](',\x20'));_0x2a8775['stop']();}else{logger['info'](_0x178f('0xb'),_0x1188fa,_0x3c6c4d[_0x178f('0xc')]);if(_0x3c6c4d[_0x178f('0xc')]){var _0x489103=_[_0x178f('0xd')](_0x2a8775[_0x178f('0xe')](),{'p':_0x3c6c4d[_0x178f('0xc')]});if(_0x489103>=0x0){logger['info'](_0x178f('0xf'),_0x1188fa,_0x3c6c4d[_0x178f('0xc')]||_0x178f('0x10'),_0x489103);_0x2a8775['next'](_0x489103);}else{logger[_0x178f('0x11')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x1188fa,_0x3c6c4d['priority']||'next');_0x2a8775[_0x178f('0x12')]();}}else{_0x2a8775[_0x178f('0x10')]();}}}catch(_0x3a5ebf){logger[_0x178f('0x7')](_0x178f('0x8'),_0x1188fa,JSON[_0x178f('0x13')](_0x3a5ebf));_0x2a8775[_0x178f('0x12')]();}};}; \ 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 e0ae89f..2eef646 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 _0xdb8d=['AccountId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','error','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','getMustacheRender','chat','account','upperFirst','channel'];(function(_0x5d6e1b,_0x406561){var _0x2a9bbf=function(_0x5de0c6){while(--_0x5de0c6){_0x5d6e1b['push'](_0x5d6e1b['shift']());}};_0x2a9bbf(++_0x406561);}(_0xdb8d,0x136));var _0xddb8=function(_0xab5f15,_0x5c1860){_0xab5f15=_0xab5f15-0x0;var _0x56290a=_0xdb8d[_0xab5f15];return _0x56290a;};'use strict';var _=require(_0xddb8('0x0'));var utils=require(_0xddb8('0x1'));var logger=require(_0xddb8('0x2'))(_0xddb8('0x3'));var rpc={'chatMessage':require(_0xddb8('0x4')),'openchannelMessage':require(_0xddb8('0x5')),'mailMessage':require(_0xddb8('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xddb8('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xddb8('0x8')]=function(_0x53bc58,_0x1c6e71){return function(_0x42e0f9){try{var _0x520d02={'body':utils[_0xddb8('0x9')](_0x1c6e71[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0xddb8('0xa')){_0x520d02['ChatWebsiteId']=this[_0xddb8('0xb')]['id'];}else{_0x520d02[_[_0xddb8('0xc')](this[_0xddb8('0xd')])+_0xddb8('0xe')]=this[_0xddb8('0xb')]['id'];}_0x520d02[_['upperFirst'](this['channel'])+'InteractionId']=this[_0xddb8('0xf')]['id'];if(rpc[this['channel']+_0xddb8('0x10')]){return rpc[this[_0xddb8('0xd')]+_0xddb8('0x10')][_0xddb8('0x11')](_0x520d02)[_0xddb8('0x12')](function(_0x10cb5d){logger[_0xddb8('0x13')](_0xddb8('0x14'),_0x53bc58,_0x520d02[_0xddb8('0x15')]);_0x42e0f9[_0xddb8('0x16')]();})[_0xddb8('0x17')](function(_0x1d328c){logger['error'](_0xddb8('0x14'),_0x53bc58,JSON[_0xddb8('0x18')](_0x1d328c));_0x42e0f9[_0xddb8('0x19')]();});}}catch(_0x14bf86){logger[_0xddb8('0x1a')](_0xddb8('0x14'),_0x53bc58,JSON['stringify'](_0x14bf86));_0x42e0f9[_0xddb8('0x19')]();}};}; \ No newline at end of file +var _0x42cf=['catch','error','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','chat','account','upperFirst','channel','AccountId','InteractionId','interaction','Message','[%s][MESSAGE]\x20%s','body','next'];(function(_0x42e7a6,_0x61af6e){var _0x50f7e4=function(_0x48f8b3){while(--_0x48f8b3){_0x42e7a6['push'](_0x42e7a6['shift']());}};_0x50f7e4(++_0x61af6e);}(_0x42cf,0x123));var _0xf42c=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x42cf[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0xf42c('0x0'));var utils=require(_0xf42c('0x1'));var logger=require('../../../../config/logger')(_0xf42c('0x2'));var rpc={'chatMessage':require(_0xf42c('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf42c('0x4')),'smsMessage':require(_0xf42c('0x5')),'faxMessage':require(_0xf42c('0x6')),'whatsappMessage':require(_0xf42c('0x7'))};exports['consequence']=function(_0x75de20,_0x5aa589){return function(_0x2ecdb3){try{var _0xa252f1={'body':utils[_0xf42c('0x8')](_0x5aa589[0x0],this),'ContactId':this[_0xf42c('0x9')]['id']};if(this['channel']===_0xf42c('0xa')){_0xa252f1['ChatWebsiteId']=this[_0xf42c('0xb')]['id'];}else{_0xa252f1[_[_0xf42c('0xc')](this[_0xf42c('0xd')])+_0xf42c('0xe')]=this[_0xf42c('0xb')]['id'];}_0xa252f1[_[_0xf42c('0xc')](this['channel'])+_0xf42c('0xf')]=this[_0xf42c('0x10')]['id'];if(rpc[this[_0xf42c('0xd')]+_0xf42c('0x11')]){return rpc[this['channel']+_0xf42c('0x11')]['create'](_0xa252f1)['then'](function(_0x376b78){logger['info'](_0xf42c('0x12'),_0x75de20,_0xa252f1[_0xf42c('0x13')]);_0x2ecdb3[_0xf42c('0x14')]();})[_0xf42c('0x15')](function(_0x55d6b5){logger[_0xf42c('0x16')](_0xf42c('0x12'),_0x75de20,JSON['stringify'](_0x55d6b5));_0x2ecdb3[_0xf42c('0x17')]();});}}catch(_0x5e76cf){logger[_0xf42c('0x16')](_0xf42c('0x12'),_0x75de20,JSON['stringify'](_0x5e76cf));_0x2ecdb3['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 3756b0e..6de417a 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 _0x41db=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','./utils','../../../../config/logger','info'];(function(_0x718f1f,_0x2e2338){var _0x48b289=function(_0x524e31){while(--_0x524e31){_0x718f1f['push'](_0x718f1f['shift']());}};_0x48b289(++_0x2e2338);}(_0x41db,0x13d));var _0xb41d=function(_0x21dff6,_0x443d2b){_0x21dff6=_0x21dff6-0x0;var _0x338ce8=_0x41db[_0x21dff6];return _0x338ce8;};'use strict';var utils=require(_0xb41d('0x0'));var logger=require(_0xb41d('0x1'))('routing');exports['consequence']=function(_0x5a4ff4,_0x4de64d){return function(_0x23bd8f){try{logger[_0xb41d('0x2')](_0xb41d('0x3'),_0x5a4ff4,utils[_0xb41d('0x4')](_0x4de64d[0x0],this));_0x23bd8f[_0xb41d('0x5')]();}catch(_0x16332c){logger[_0xb41d('0x6')]('[%s][NOOP]\x20%s',_0x5a4ff4,JSON[_0xb41d('0x7')](_0x16332c));_0x23bd8f['stop']();}};}; \ No newline at end of file +var _0xb06e=['info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','./utils','../../../../config/logger','routing'];(function(_0x426ddd,_0x31a70b){var _0x25cb4b=function(_0x20fb16){while(--_0x20fb16){_0x426ddd['push'](_0x426ddd['shift']());}};_0x25cb4b(++_0x31a70b);}(_0xb06e,0x1e3));var _0xeb06=function(_0x1e09b3,_0x31d2ee){_0x1e09b3=_0x1e09b3-0x0;var _0x3a3b5d=_0xb06e[_0x1e09b3];return _0x3a3b5d;};'use strict';var utils=require(_0xeb06('0x0'));var logger=require(_0xeb06('0x1'))(_0xeb06('0x2'));exports['consequence']=function(_0x38be7f,_0x349558){return function(_0x4bc41d){try{logger[_0xeb06('0x3')](_0xeb06('0x4'),_0x38be7f,utils[_0xeb06('0x5')](_0x349558[0x0],this));_0x4bc41d[_0xeb06('0x6')]();}catch(_0xa4ab47){logger[_0xeb06('0x7')](_0xeb06('0x4'),_0x38be7f,JSON[_0xeb06('0x8')](_0xa4ab47));_0x4bc41d['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 aae3fb8..9ce4282 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 _0x923c=['info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','accepted','update','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','Queues','atimeout','qtimeout','rules','end','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','ioredis','../../../../config/environment','routing','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','account','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','WebsiteId'];(function(_0x5480fd,_0x46600d){var _0x2ec312=function(_0x32797c){while(--_0x32797c){_0x5480fd['push'](_0x5480fd['shift']());}};_0x2ec312(++_0x46600d);}(_0x923c,0x157));var _0xc923=function(_0x4585ca,_0x3a8e79){_0x4585ca=_0x4585ca-0x0;var _0x254f99=_0x923c[_0x4585ca];return _0x254f99;};'use strict';var schema=require(_0xc923('0x0'));var _=require(_0xc923('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0xc923('0x2'));var config=require(_0xc923('0x3'));var logger=require('../../../../config/logger')(_0xc923('0x4'));var strategy=require('./strategy');config[_0xc923('0x5')]=_['defaults'](config[_0xc923('0x5')],{'host':_0xc923('0x6'),'port':0x18eb});var io=require(_0xc923('0x7'))(new Redis(config['redis']));var attributes=['id',_0xc923('0x8'),'account',_0xc923('0x9'),_0xc923('0xa'),_0xc923('0xb')];function emit(_0x4bbd6c,_0x53c703,_0x2d5b2d){io['to'](_0x4bbd6c)[_0xc923('0xc')](_0x53c703,_0x2d5b2d);}function emitChannelQueueInteraction(_0x1697ee,_0x50b800,_0x1e87b8,_0x4a447,_0x1cd366,_0x54d021,_0x191c32,_0x6e93){var _0x3e286f=_[_0xc923('0xd')](_0x1e87b8);_0x3e286f[_0xc923('0x8')]=_0x6e93;_0x3e286f[_0xc923('0x9')]=_0x50b800;_0x3e286f[_0xc923('0xe')]=_0x4a447;_0x3e286f['id']=_0x1cd366;if(_0x54d021){_0x191c32[util[_0xc923('0xf')](_0xc923('0x10'),_0x1697ee)][_0x1cd366]=_[_0xc923('0x11')](_0x3e286f,attributes);}else{delete _0x191c32[util[_0xc923('0xf')](_0xc923('0x10'),_0x1697ee)][_0x1cd366];}emit(util['format']('%s:queue:%s',_0x1697ee,_0x50b800),util[_0xc923('0xf')](_0xc923('0x12'),_0x1697ee,_0x54d021?_0xc923('0x13'):'remove'),_[_0xc923('0x11')](_0x3e286f,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xc923('0x14')),'chatQueueReport':require(_0xc923('0x15')),'smsQueueReport':require(_0xc923('0x16')),'faxQueueReport':require(_0xc923('0x17')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xc923('0x18'),'required':!![],'message':_0xc923('0x19')},'timeout':{'type':_0xc923('0x1a'),'message':_0xc923('0x1b')}});function startRouting(_0x45b2c7,_0x4de949,_0x7d98dc,_0x588570){if(_0x45b2c7&&_0x4de949&&_0x7d98dc){_0x4de949[_0xc923('0x1c')]+=0x1;var _0x1ffb3b={'uniqueid':_0x45b2c7,'from':_0x7d98dc[_0xc923('0x1d')]?_0x7d98dc[_0xc923('0x1d')][_0xc923('0xa')]:'','joinAt':moment()[_0xc923('0xf')](_0xc923('0x1e')),'ContactId':_0x7d98dc[_0xc923('0x1f')]?_0x7d98dc[_0xc923('0x1f')]['id']:null,'ListId':_0x7d98dc[_0xc923('0x20')]?_0x7d98dc[_0xc923('0x20')]['id']:null};_0x1ffb3b[_[_0xc923('0x21')](_0x7d98dc[_0xc923('0x22')])+_0xc923('0x23')]=_0x4de949['id']||null;_0x1ffb3b[_['upperFirst'](_0x7d98dc['channel'])+'InteractionId']=_0x7d98dc[_0xc923('0x24')]?_0x7d98dc['interaction']['id']:null;_0x1ffb3b[_[_0xc923('0x21')](_0x7d98dc['channel'])+_0xc923('0x25')]=_0x7d98dc[_0xc923('0x26')]?_0x7d98dc[_0xc923('0x26')]['id']:null;_0x1ffb3b[_['upperFirst'](_0x7d98dc['channel'])+(_0x7d98dc['channel']!==_0xc923('0x27')?_0xc923('0x28'):_0xc923('0x29'))]=_0x7d98dc[_0xc923('0xe')]?_0x7d98dc[_0xc923('0xe')]['id']:null;logger[_0xc923('0x2a')](util[_0xc923('0xf')](_0xc923('0x2b'),_0x45b2c7,_0x4de949[_0xc923('0x2c')]));emitChannelQueueInteraction(_0x7d98dc['channel'],_0x4de949[_0xc923('0x2c')],_0x1ffb3b,_0x7d98dc[_0xc923('0xe')]['name'],_0x7d98dc[_0xc923('0x26')]['id'],!![],_0x588570,_0x4de949['id']);if(rpc[_0x7d98dc[_0xc923('0x22')]+_0xc923('0x2d')]){return rpc[_0x7d98dc[_0xc923('0x22')]+'QueueReport'][_0xc923('0x2e')](_0x1ffb3b)[_0xc923('0x2f')](function(_0x12bb28){logger['error'](_0xc923('0x30'));});}}}function stopRouting(_0x1e920f,_0x4c122f,_0x50a0f5,_0x20907f){if(_0x1e920f&&_0x4c122f){_0x4c122f[_0xc923('0x1c')]-=0x1;var _0x5806c3={'leaveAt':moment()[_0xc923('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xc923('0xf')](_0xc923('0x1e')),'reason':_0xc923('0x31')};logger[_0xc923('0x2a')](util[_0xc923('0xf')]('[%s][STOP:QUEUE][NAME:%s]',_0x1e920f,_0x4c122f[_0xc923('0x2c')]));emitChannelQueueInteraction(_0x50a0f5[_0xc923('0x22')],_0x4c122f['name'],_0x50a0f5[_0xc923('0x1d')],_0x50a0f5['account'][_0xc923('0x2c')],_0x50a0f5['message']['id'],![],_0x20907f,_0x4c122f['id']);if(rpc[_0x50a0f5[_0xc923('0x22')]+_0xc923('0x2d')]){return rpc[_0x50a0f5[_0xc923('0x22')]+'QueueReport'][_0xc923('0x32')](_0x1e920f,_0x5806c3)[_0xc923('0x2f')](function(_0x179dbb){logger[_0xc923('0x33')](_0xc923('0x34'));});}}}function endRouting(_0x2ff617,_0x4b00fc,_0x5d1cb8,_0x3c5909){if(_0x2ff617&&_0x4b00fc){_0x4b00fc[_0xc923('0x1c')]-=0x1;var _0x4af6f6={'leaveAt':moment()['format'](_0xc923('0x1e')),'exitAt':moment()[_0xc923('0xf')](_0xc923('0x1e')),'reason':_0xc923('0x35')};logger[_0xc923('0x2a')](util['format'](_0xc923('0x36'),_0x2ff617,_0x4b00fc['name']));emitChannelQueueInteraction(_0x5d1cb8[_0xc923('0x22')],_0x4b00fc[_0xc923('0x2c')],_0x5d1cb8[_0xc923('0x1d')],_0x5d1cb8[_0xc923('0xe')][_0xc923('0x2c')],_0x5d1cb8[_0xc923('0x26')]['id'],![],_0x3c5909);if(rpc[_0x5d1cb8[_0xc923('0x22')]+_0xc923('0x2d')]){return rpc[_0x5d1cb8[_0xc923('0x22')]+_0xc923('0x2d')][_0xc923('0x32')](_0x2ff617,_0x4af6f6)[_0xc923('0x2f')](function(_0x59f985){logger[_0xc923('0x33')](_0xc923('0x34'));});}}}function handleFindQueue(_0x1a2c3d){return function(_0x5d2114){return _0x5d2114['name'][_0xc923('0x37')]()===_0x1a2c3d[_0xc923('0x37')]();};}exports[_0xc923('0x38')]=function(_0x308272,_0x327252,_0x7b0eb1,_0x25fbf5){return function(_0x41a848){try{var _0x55b1d7={'name':_0x327252[0x0],'timeout':_0x327252[0x1]};var _0x50aa87=queue[_0xc923('0x0')](_0x55b1d7,{'typecast':!![]});if(_0x50aa87[_0xc923('0x39')]){logger[_0xc923('0x33')](_0xc923('0x3a'),_0x308272,_[_0xc923('0x3b')](_0x50aa87,_0xc923('0x26'))[_0xc923('0x3c')](',\x20'));_0x41a848['stop']();}else{var _0x4a8763=_[_0xc923('0x3d')](_0x7b0eb1[_0x25fbf5[_0xc923('0x22')]+_0xc923('0x3e')],handleFindQueue(_0x55b1d7[_0xc923('0x2c')]));if(_0x4a8763){startRouting(_0x308272,_0x4a8763,_0x25fbf5,_0x7b0eb1);var _0xdd0f36=(_0x4a8763[_0xc923('0x35')]||0xa)*0x3e8;var _0x21723e=(_0x55b1d7['timeout']||0x14)*0x3e8;var _0x55ddf8,_0xa8913f;if(_0xdd0f36>_0x21723e){_0x21723e=_0xdd0f36;}var _0x25866b=seqqueue['createQueue'](_0xdd0f36);_0x25866b['id']=_0x308272;_0x25866b[_0xc923('0x3f')]=_0xdd0f36;_0x25866b[_0xc923('0x40')]=_0x21723e;_0x25866b[_0xc923('0x22')]=_0x25fbf5[_0xc923('0x22')];_0x7b0eb1[_0xc923('0x41')][_0x308272]['on'](_0xc923('0x42'),function(){logger[_0xc923('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x308272);stopRouting(_0x308272,_0x4a8763,_0x25fbf5,_0x7b0eb1);clearTimeout(_0x55ddf8);_0x55ddf8=undefined;_0x25866b[_0xc923('0x43')](!![]);if(_0x7b0eb1[_0xc923('0x41')][_0x308272]){delete _0x7b0eb1['rules'][_0x308272];}_0x41a848[_0xc923('0x44')]();});_0x7b0eb1[_0xc923('0x41')][_0x308272]['on'](_0xc923('0x45'),function(){if(_0x7b0eb1[_0xc923('0x41')][_0x308272]){delete _0x7b0eb1['rules'][_0x308272];}});_0x55ddf8=setTimeout(function(){logger[_0xc923('0x2a')](_0xc923('0x46'),_0x308272);endRouting(_0x308272,_0x4a8763,_0x25fbf5,_0x7b0eb1);clearTimeout(_0x55ddf8);_0x25866b[_0xc923('0x43')](!![]);_0x41a848[_0xc923('0x47')]();},_0x21723e);switch(_0x4a8763[_0xc923('0x48')]){case'rrmemory':strategy['rrmemory'](_0x25866b,_0x4a8763,_0x7b0eb1,_0x25fbf5);break;default:strategy[_0xc923('0x49')](_0x25866b,_0x4a8763,_0x7b0eb1,_0x25fbf5);}}else{logger['error'](_0xc923('0x4a'),_0x308272,_0x55b1d7['name']);_0x41a848[_0xc923('0x44')]();}}}catch(_0x2fc157){console[_0xc923('0x4b')](_0x2fc157);logger[_0xc923('0x33')](_0xc923('0x3a'),_0x308272,_0x2fc157[_0xc923('0x4c')]);_0x41a848[_0xc923('0x44')]();}};}; \ No newline at end of file +var _0xf99f=['QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','info','update','update\x20queue\x20report','waiting','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','map','join','stop','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20%s','stack','lodash','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','localhost','socket.io-emitter','queue_id','from','joinAt','emit','account','pick','%sQueuesWaitingInteractions','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','body','list','channel','upperFirst','interaction','MessageId','message','chat','AccountId','WebsiteId','name'];(function(_0x1bd390,_0x46b8fa){var _0x136193=function(_0x4e0bc6){while(--_0x4e0bc6){_0x1bd390['push'](_0x1bd390['shift']());}};_0x136193(++_0x46b8fa);}(_0xf99f,0xb5));var _0xff99=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0xf99f[_0x11a220];return _0x20d8fe;};'use strict';var schema=require('validate');var _=require(_0xff99('0x0'));var util=require('util');var seqqueue=require(_0xff99('0x1'));var moment=require('moment');var Redis=require(_0xff99('0x2'));var config=require(_0xff99('0x3'));var logger=require(_0xff99('0x4'))(_0xff99('0x5'));var strategy=require('./strategy');config['redis']=_['defaults'](config[_0xff99('0x6')],{'host':_0xff99('0x7'),'port':0x18eb});var io=require(_0xff99('0x8'))(new Redis(config['redis']));var attributes=['id',_0xff99('0x9'),'account','queue',_0xff99('0xa'),_0xff99('0xb')];function emit(_0x2dc123,_0x4fd052,_0x3af353){io['to'](_0x2dc123)[_0xff99('0xc')](_0x4fd052,_0x3af353);}function emitChannelQueueInteraction(_0x5558bf,_0x1710e8,_0x441a6c,_0x2df196,_0x51c1e1,_0x13c76e,_0x38ec4e,_0x1fbf0e){var _0x483f6d=_['clone'](_0x441a6c);_0x483f6d[_0xff99('0x9')]=_0x1fbf0e;_0x483f6d['queue']=_0x1710e8;_0x483f6d[_0xff99('0xd')]=_0x2df196;_0x483f6d['id']=_0x51c1e1;if(_0x13c76e){_0x38ec4e[util['format']('%sQueuesWaitingInteractions',_0x5558bf)][_0x51c1e1]=_[_0xff99('0xe')](_0x483f6d,attributes);}else{delete _0x38ec4e[util['format'](_0xff99('0xf'),_0x5558bf)][_0x51c1e1];}emit(util[_0xff99('0x10')](_0xff99('0x11'),_0x5558bf,_0x1710e8),util[_0xff99('0x10')](_0xff99('0x12'),_0x5558bf,_0x13c76e?'save':_0xff99('0x13')),_[_0xff99('0xe')](_0x483f6d,attributes));}var rpc={'openchannelQueueReport':require(_0xff99('0x14')),'mailQueueReport':require(_0xff99('0x15')),'chatQueueReport':require(_0xff99('0x16')),'smsQueueReport':require(_0xff99('0x17')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xff99('0x18'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xff99('0x19')},'timeout':{'type':'number','message':_0xff99('0x1a')}});function startRouting(_0x28b5de,_0x48042f,_0x2130b5,_0x42f5af){if(_0x28b5de&&_0x48042f&&_0x2130b5){_0x48042f['waiting']+=0x1;var _0x39fae6={'uniqueid':_0x28b5de,'from':_0x2130b5[_0xff99('0x1b')]?_0x2130b5[_0xff99('0x1b')]['from']:'','joinAt':moment()[_0xff99('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2130b5['contact']?_0x2130b5['contact']['id']:null,'ListId':_0x2130b5[_0xff99('0x1c')]?_0x2130b5['list']['id']:null};_0x39fae6[_['upperFirst'](_0x2130b5[_0xff99('0x1d')])+'QueueId']=_0x48042f['id']||null;_0x39fae6[_[_0xff99('0x1e')](_0x2130b5[_0xff99('0x1d')])+'InteractionId']=_0x2130b5[_0xff99('0x1f')]?_0x2130b5[_0xff99('0x1f')]['id']:null;_0x39fae6[_['upperFirst'](_0x2130b5['channel'])+_0xff99('0x20')]=_0x2130b5[_0xff99('0x21')]?_0x2130b5[_0xff99('0x21')]['id']:null;_0x39fae6[_[_0xff99('0x1e')](_0x2130b5[_0xff99('0x1d')])+(_0x2130b5['channel']!==_0xff99('0x22')?_0xff99('0x23'):_0xff99('0x24'))]=_0x2130b5[_0xff99('0xd')]?_0x2130b5['account']['id']:null;logger['info'](util[_0xff99('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x28b5de,_0x48042f['name']));emitChannelQueueInteraction(_0x2130b5[_0xff99('0x1d')],_0x48042f[_0xff99('0x25')],_0x39fae6,_0x2130b5[_0xff99('0xd')][_0xff99('0x25')],_0x2130b5[_0xff99('0x21')]['id'],!![],_0x42f5af,_0x48042f['id']);if(rpc[_0x2130b5['channel']+_0xff99('0x26')]){return rpc[_0x2130b5['channel']+'QueueReport'][_0xff99('0x27')](_0x39fae6)[_0xff99('0x28')](function(_0x398ea6){logger[_0xff99('0x29')](_0xff99('0x2a'));});}}}function stopRouting(_0x5cd7bc,_0x79f98b,_0x45a6ca,_0x286d56){if(_0x5cd7bc&&_0x79f98b){_0x79f98b['waiting']-=0x1;var _0x10b087={'leaveAt':moment()[_0xff99('0x10')](_0xff99('0x2b')),'acceptAt':moment()['format'](_0xff99('0x2b')),'reason':_0xff99('0x2c')};logger[_0xff99('0x2d')](util[_0xff99('0x10')]('[%s][STOP:QUEUE][NAME:%s]',_0x5cd7bc,_0x79f98b['name']));emitChannelQueueInteraction(_0x45a6ca[_0xff99('0x1d')],_0x79f98b[_0xff99('0x25')],_0x45a6ca[_0xff99('0x1b')],_0x45a6ca[_0xff99('0xd')][_0xff99('0x25')],_0x45a6ca[_0xff99('0x21')]['id'],![],_0x286d56,_0x79f98b['id']);if(rpc[_0x45a6ca[_0xff99('0x1d')]+'QueueReport']){return rpc[_0x45a6ca[_0xff99('0x1d')]+_0xff99('0x26')][_0xff99('0x2e')](_0x5cd7bc,_0x10b087)[_0xff99('0x28')](function(_0x3cbf17){logger[_0xff99('0x29')](_0xff99('0x2f'));});}}}function endRouting(_0x33eb30,_0x576b35,_0x261378,_0xb3982a){if(_0x33eb30&&_0x576b35){_0x576b35[_0xff99('0x30')]-=0x1;var _0x5ce060={'leaveAt':moment()[_0xff99('0x10')](_0xff99('0x2b')),'exitAt':moment()[_0xff99('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xff99('0x31')};logger[_0xff99('0x2d')](util['format'](_0xff99('0x32'),_0x33eb30,_0x576b35[_0xff99('0x25')]));emitChannelQueueInteraction(_0x261378[_0xff99('0x1d')],_0x576b35[_0xff99('0x25')],_0x261378[_0xff99('0x1b')],_0x261378[_0xff99('0xd')][_0xff99('0x25')],_0x261378['message']['id'],![],_0xb3982a);if(rpc[_0x261378[_0xff99('0x1d')]+_0xff99('0x26')]){return rpc[_0x261378[_0xff99('0x1d')]+'QueueReport']['update'](_0x33eb30,_0x5ce060)[_0xff99('0x28')](function(_0x21dade){logger[_0xff99('0x29')](_0xff99('0x2f'));});}}}function handleFindQueue(_0x2415bc){return function(_0x1be199){return _0x1be199[_0xff99('0x25')][_0xff99('0x33')]()===_0x2415bc[_0xff99('0x33')]();};}exports[_0xff99('0x34')]=function(_0x114cb5,_0x52f7b7,_0x3440d8,_0x50e157){return function(_0x4cd94b){try{var _0x194d8b={'name':_0x52f7b7[0x0],'timeout':_0x52f7b7[0x1]};var _0x4e0436=queue[_0xff99('0x35')](_0x194d8b,{'typecast':!![]});if(_0x4e0436['length']){logger['error']('[%s][QUEUE]\x20%s',_0x114cb5,_[_0xff99('0x36')](_0x4e0436,_0xff99('0x21'))[_0xff99('0x37')](',\x20'));_0x4cd94b[_0xff99('0x38')]();}else{var _0x3bcb1f=_['find'](_0x3440d8[_0x50e157[_0xff99('0x1d')]+_0xff99('0x39')],handleFindQueue(_0x194d8b[_0xff99('0x25')]));if(_0x3bcb1f){startRouting(_0x114cb5,_0x3bcb1f,_0x50e157,_0x3440d8);var _0x2d1754=(_0x3bcb1f['timeout']||0xa)*0x3e8;var _0x4ea0f9=(_0x194d8b[_0xff99('0x31')]||0x14)*0x3e8;var _0xbaeacc,_0xa2f4a9;if(_0x2d1754>_0x4ea0f9){_0x4ea0f9=_0x2d1754;}var _0x1c1ce9=seqqueue[_0xff99('0x3a')](_0x2d1754);_0x1c1ce9['id']=_0x114cb5;_0x1c1ce9[_0xff99('0x3b')]=_0x2d1754;_0x1c1ce9[_0xff99('0x3c')]=_0x4ea0f9;_0x1c1ce9[_0xff99('0x1d')]=_0x50e157[_0xff99('0x1d')];_0x3440d8[_0xff99('0x3d')][_0x114cb5]['on'](_0xff99('0x3e'),function(){logger[_0xff99('0x2d')](_0xff99('0x3f'),_0x114cb5);stopRouting(_0x114cb5,_0x3bcb1f,_0x50e157,_0x3440d8);clearTimeout(_0xbaeacc);_0xbaeacc=undefined;_0x1c1ce9[_0xff99('0x40')](!![]);if(_0x3440d8[_0xff99('0x3d')][_0x114cb5]){delete _0x3440d8[_0xff99('0x3d')][_0x114cb5];}_0x4cd94b[_0xff99('0x38')]();});_0x3440d8[_0xff99('0x3d')][_0x114cb5]['on'](_0xff99('0x41'),function(){if(_0x3440d8[_0xff99('0x3d')][_0x114cb5]){delete _0x3440d8[_0xff99('0x3d')][_0x114cb5];}});_0xbaeacc=setTimeout(function(){logger['info'](_0xff99('0x42'),_0x114cb5);endRouting(_0x114cb5,_0x3bcb1f,_0x50e157,_0x3440d8);clearTimeout(_0xbaeacc);_0x1c1ce9[_0xff99('0x40')](!![]);_0x4cd94b[_0xff99('0x43')]();},_0x4ea0f9);switch(_0x3bcb1f[_0xff99('0x44')]){case _0xff99('0x45'):strategy[_0xff99('0x45')](_0x1c1ce9,_0x3bcb1f,_0x3440d8,_0x50e157);break;default:strategy[_0xff99('0x46')](_0x1c1ce9,_0x3bcb1f,_0x3440d8,_0x50e157);}}else{logger[_0xff99('0x29')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x114cb5,_0x194d8b['name']);_0x4cd94b['stop']();}}}catch(_0xf2a167){console['log'](_0xf2a167);logger['error'](_0xff99('0x47'),_0x114cb5,_0xf2a167[_0xff99('0x48')]);_0x4cd94b[_0xff99('0x38')]();}};}; \ 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 b60c58a..c8444bd 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 _0x5efb=['prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','handleTimeout','bind','drained','handleDrained'];(function(_0x3ad2e5,_0x94d414){var _0xc4e565=function(_0x2c96e3){while(--_0x2c96e3){_0x3ad2e5['push'](_0x3ad2e5['shift']());}};_0xc4e565(++_0x94d414);}(_0x5efb,0xd9));var _0xb5ef=function(_0x170a07,_0x4917dc){_0x170a07=_0x170a07-0x0;var _0x4525f7=_0x5efb[_0x170a07];return _0x4525f7;};'use strict';var _=require(_0xb5ef('0x0'));var uuid=require(_0xb5ef('0x1'));var util=require('./util');var logger=require(_0xb5ef('0x2'))(_0xb5ef('0x3'));var Agent=function(_0x4b78b8,_0x2cb873,_0x39d43b,_0x3956d1){this[_0xb5ef('0x4')]=uuid['v4']();this[_0xb5ef('0x5')]=_0x4b78b8;this[_0xb5ef('0x6')]=_0x2cb873;this[_0xb5ef('0x7')]=_0x39d43b;this['routing']=_0x3956d1;this[_0xb5ef('0x5')][_0xb5ef('0x8')](this[_0xb5ef('0x9')]['bind'](this),this[_0xb5ef('0xa')][_0xb5ef('0xb')](this));this[_0xb5ef('0x5')]['on']('timeout',this['handleTimeout'][_0xb5ef('0xb')](this));this[_0xb5ef('0x5')]['on'](_0xb5ef('0xc'),this[_0xb5ef('0xd')][_0xb5ef('0xb')](this));};Agent[_0xb5ef('0xe')][_0xb5ef('0x8')]=function(){this['squeue'][_0xb5ef('0x8')](this[_0xb5ef('0x9')][_0xb5ef('0xb')](this),this['handleTimeout'][_0xb5ef('0xb')](this));};Agent[_0xb5ef('0xe')][_0xb5ef('0xd')]=function(){this[_0xb5ef('0xa')](!![]);};Agent[_0xb5ef('0xe')][_0xb5ef('0x9')]=function(_0x17d01a){logger[_0xb5ef('0xf')](_0xb5ef('0x10'),this[_0xb5ef('0x5')]['id'],this[_0xb5ef('0x6')]['id']);if(_['isNil'](this[_0xb5ef('0x7')][_0xb5ef('0x11')][this['agent']['id']])){logger[_0xb5ef('0xf')](_0xb5ef('0x12'),this[_0xb5ef('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xb5ef('0x8')][_0xb5ef('0xb')](this),0x3e8);}else{if(this[_0xb5ef('0x3')][_0xb5ef('0x13')]||util[_0xb5ef('0x14')](this[_0xb5ef('0x5')]['id'],this[_0xb5ef('0x7')][_0xb5ef('0x11')][this[_0xb5ef('0x6')]['id']],this[_0xb5ef('0x5')][_0xb5ef('0x15')],![])){this[_0xb5ef('0x7')][_0xb5ef('0x11')][this[_0xb5ef('0x6')]['id']][_0xb5ef('0x16')]=!![];this[_0xb5ef('0x7')][_0xb5ef('0x11')][this[_0xb5ef('0x6')]['id']][_0xb5ef('0x17')]=undefined;util[_0xb5ef('0x18')](this['notificationId'],this[_0xb5ef('0x5')]['id'],this[_0xb5ef('0x7')][_0xb5ef('0x11')][this['agent']['id']],null,this[_0xb5ef('0x3')]);util[_0xb5ef('0x19')](this['squeue']['id'],this[_0xb5ef('0x7')][_0xb5ef('0x11')][this[_0xb5ef('0x6')]['id']],_0xb5ef('0x1a')+(this[_0xb5ef('0x3')][_0xb5ef('0x13')]?_0xb5ef('0x1b'):''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xb5ef('0x5')]['id'],this[_0xb5ef('0x6')]['id']);setTimeout(this[_0xb5ef('0x8')][_0xb5ef('0xb')](this),0x3e8);}}};Agent[_0xb5ef('0xe')][_0xb5ef('0xa')]=function(_0x1f6209){if(_[_0xb5ef('0x1c')](this[_0xb5ef('0x7')][_0xb5ef('0x11')][this[_0xb5ef('0x6')]['id']])){return logger[_0xb5ef('0xf')](_0xb5ef('0x12'),this['squeue']['id'],this['agent']['id']);}else{logger['info'](_0xb5ef('0x1d'),this['squeue']['id'],this[_0xb5ef('0x6')]['id']);util[_0xb5ef('0x1e')](this[_0xb5ef('0x4')],this[_0xb5ef('0x5')]['id'],this[_0xb5ef('0x7')]['agents'][this[_0xb5ef('0x6')]['id']],null,this[_0xb5ef('0x3')]);this[_0xb5ef('0x7')][_0xb5ef('0x11')][this[_0xb5ef('0x6')]['id']][_0xb5ef('0x16')]=![];this[_0xb5ef('0x7')][_0xb5ef('0x11')][this[_0xb5ef('0x6')]['id']]['busyQueue']=undefined;util[_0xb5ef('0x19')](this['squeue']['id'],this['realtime'][_0xb5ef('0x11')][this[_0xb5ef('0x6')]['id']],_0x1f6209?_0xb5ef('0x1f'):_0xb5ef('0x20'));}if(!_0x1f6209){setTimeout(this[_0xb5ef('0x8')][_0xb5ef('0xb')](this),0x3e8);}};function agent(_0x2aef19,_0x4aa0ac,_0x4d6eeb,_0x43b06c){return new Agent(_0x2aef19,_0x4aa0ac,_0x4d6eeb,_0x43b06c);}module['exports']=agent; \ No newline at end of file +var _0xf2aa=['channel','busy','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','exports','uuid','./util','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','handleRun','handleTimeout','bind','drained','handleDrained','prototype','push','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xf2aa,0xaa));var _0xaf2a=function(_0x5ec9db,_0x4f051e){_0x5ec9db=_0x5ec9db-0x0;var _0xfc7061=_0xf2aa[_0x5ec9db];return _0xfc7061;};'use strict';var _=require('lodash');var uuid=require(_0xaf2a('0x0'));var util=require(_0xaf2a('0x1'));var logger=require(_0xaf2a('0x2'))(_0xaf2a('0x3'));var Agent=function(_0x4a96af,_0x83e01e,_0x1441f7,_0x17a4f1){this[_0xaf2a('0x4')]=uuid['v4']();this['squeue']=_0x4a96af;this[_0xaf2a('0x5')]=_0x83e01e;this[_0xaf2a('0x6')]=_0x1441f7;this[_0xaf2a('0x3')]=_0x17a4f1;this[_0xaf2a('0x7')]['push'](this[_0xaf2a('0x8')]['bind'](this),this[_0xaf2a('0x9')][_0xaf2a('0xa')](this));this[_0xaf2a('0x7')]['on']('timeout',this[_0xaf2a('0x9')][_0xaf2a('0xa')](this));this[_0xaf2a('0x7')]['on'](_0xaf2a('0xb'),this[_0xaf2a('0xc')][_0xaf2a('0xa')](this));};Agent[_0xaf2a('0xd')]['push']=function(){this[_0xaf2a('0x7')][_0xaf2a('0xe')](this[_0xaf2a('0x8')][_0xaf2a('0xa')](this),this[_0xaf2a('0x9')][_0xaf2a('0xa')](this));};Agent[_0xaf2a('0xd')][_0xaf2a('0xc')]=function(){this[_0xaf2a('0x9')](!![]);};Agent['prototype'][_0xaf2a('0x8')]=function(_0x1ef8be){logger[_0xaf2a('0xf')](_0xaf2a('0x10'),this[_0xaf2a('0x7')]['id'],this[_0xaf2a('0x5')]['id']);if(_[_0xaf2a('0x11')](this[_0xaf2a('0x6')][_0xaf2a('0x12')][this['agent']['id']])){logger[_0xaf2a('0xf')](_0xaf2a('0x13'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0xaf2a('0xa')](this),0x3e8);}else{if(this[_0xaf2a('0x3')][_0xaf2a('0x14')]||util[_0xaf2a('0x15')](this[_0xaf2a('0x7')]['id'],this['realtime'][_0xaf2a('0x12')][this[_0xaf2a('0x5')]['id']],this[_0xaf2a('0x7')][_0xaf2a('0x16')],![])){this[_0xaf2a('0x6')]['agents'][this['agent']['id']][_0xaf2a('0x17')]=!![];this[_0xaf2a('0x6')][_0xaf2a('0x12')][this[_0xaf2a('0x5')]['id']]['busyQueue']=undefined;util[_0xaf2a('0x18')](this[_0xaf2a('0x4')],this[_0xaf2a('0x7')]['id'],this[_0xaf2a('0x6')][_0xaf2a('0x12')][this[_0xaf2a('0x5')]['id']],null,this[_0xaf2a('0x3')]);util[_0xaf2a('0x19')](this[_0xaf2a('0x7')]['id'],this[_0xaf2a('0x6')][_0xaf2a('0x12')][this[_0xaf2a('0x5')]['id']],_0xaf2a('0x1a')+(this[_0xaf2a('0x3')][_0xaf2a('0x14')]?_0xaf2a('0x1b'):''));}else{logger[_0xaf2a('0xf')](_0xaf2a('0x1c'),this[_0xaf2a('0x7')]['id'],this[_0xaf2a('0x5')]['id']);setTimeout(this[_0xaf2a('0xe')][_0xaf2a('0xa')](this),0x3e8);}}};Agent[_0xaf2a('0xd')][_0xaf2a('0x9')]=function(_0x706067){if(_[_0xaf2a('0x11')](this[_0xaf2a('0x6')][_0xaf2a('0x12')][this['agent']['id']])){return logger[_0xaf2a('0xf')](_0xaf2a('0x13'),this['squeue']['id'],this[_0xaf2a('0x5')]['id']);}else{logger[_0xaf2a('0xf')](_0xaf2a('0x1d'),this[_0xaf2a('0x7')]['id'],this['agent']['id']);util['hideNotification'](this[_0xaf2a('0x4')],this[_0xaf2a('0x7')]['id'],this[_0xaf2a('0x6')][_0xaf2a('0x12')][this[_0xaf2a('0x5')]['id']],null,this[_0xaf2a('0x3')]);this['realtime'][_0xaf2a('0x12')][this[_0xaf2a('0x5')]['id']][_0xaf2a('0x17')]=![];this[_0xaf2a('0x6')][_0xaf2a('0x12')][this['agent']['id']][_0xaf2a('0x1e')]=undefined;util[_0xaf2a('0x19')](this[_0xaf2a('0x7')]['id'],this[_0xaf2a('0x6')][_0xaf2a('0x12')][this['agent']['id']],_0x706067?'STOP':'TIMEOUT');}if(!_0x706067){setTimeout(this['push'][_0xaf2a('0xa')](this),0x3e8);}};function agent(_0x111123,_0x445148,_0x4005b1,_0x2b8382){return new Agent(_0x111123,_0x445148,_0x4005b1,_0x2b8382);}module[_0xaf2a('0x1f')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 64ac493..a8c47d2 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 _0x79d3=['RINGING','name','showNotification','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','STOP','TIMEOUT','busy','busyQueue','exports','lodash','./util','routing','notificationId','squeue','queue','realtime','push','bind','handleTimeout','timeout','drained','handleDrained','handleRun','prototype','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog'];(function(_0x1ec586,_0x331aba){var _0x39b0f0=function(_0x5569ff){while(--_0x5569ff){_0x1ec586['push'](_0x1ec586['shift']());}};_0x39b0f0(++_0x331aba);}(_0x79d3,0x15f));var _0x379d=function(_0x5e95c,_0x5d0943){_0x5e95c=_0x5e95c-0x0;var _0x3ff5b8=_0x79d3[_0x5e95c];return _0x3ff5b8;};'use strict';var _=require(_0x379d('0x0'));var uuid=require('uuid');var util=require(_0x379d('0x1'));var logger=require('../../../../../config/logger')(_0x379d('0x2'));var Beepall=function(_0x3cbcb1,_0x5af1c4,_0xde90b8,_0x2be235){this[_0x379d('0x3')]=uuid['v4']();this[_0x379d('0x4')]=_0x3cbcb1;this[_0x379d('0x5')]=_0x5af1c4;this[_0x379d('0x6')]=_0xde90b8;this[_0x379d('0x2')]=_0x2be235;this['squeue'][_0x379d('0x7')](this['handleRun'][_0x379d('0x8')](this),this[_0x379d('0x9')][_0x379d('0x8')](this));this['squeue']['on'](_0x379d('0xa'),this['handleTimeout']['bind'](this));this['squeue']['on'](_0x379d('0xb'),this[_0x379d('0xc')][_0x379d('0x8')](this));};Beepall['prototype'][_0x379d('0x7')]=function(){this[_0x379d('0x4')][_0x379d('0x7')](this[_0x379d('0xd')]['bind'](this),this[_0x379d('0x9')][_0x379d('0x8')](this));};Beepall[_0x379d('0xe')][_0x379d('0xc')]=function(_0x202546){this[_0x379d('0x9')](!![]);};Beepall['prototype']['handleRun']=function(_0x368182){var _0x54132b=!![];if(!_[_0x379d('0xf')](this[_0x379d('0x5')])&&!_[_0x379d('0xf')](this[_0x379d('0x5')]['Agents'])&&this[_0x379d('0x5')]['Agents']['length']>0x0){for(var _0x489343=0x0,_0x460ac3;_0x4893430x0){for(var _0x18564a=0x0,_0x559c9d;_0x18564a0x0&&_0x11ecf7[_0x300be8+_0xae3d('0x28')]>=_0x11ecf7[_0x300be8+_0xae3d('0x27')]){writeLog(_0x3224ff,_0x11ecf7,_0x300be8[_0xae3d('0x29')]()+_0xae3d('0x2a'));return![];}}return!![];};exports[_0xae3d('0x2b')]=function(_0x54c1e1,_0x57864e,_0x12e3a5,_0x1281aa,_0x3a5840){return sendNotification(!![],_0x54c1e1,_0x57864e,_0x12e3a5,_0x1281aa,_0x3a5840);};exports[_0xae3d('0x2c')]=function(_0xb69ec9,_0x561371,_0x1d1483,_0x3a2434,_0x5a39c5){return sendNotification(![],_0xb69ec9,_0x561371,_0x1d1483,_0x3a2434,_0x5a39c5);};exports[_0xae3d('0x2d')]=writeLog; \ No newline at end of file +var _0x4991=['hideNotification','lodash','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','emit','user:%s','name','user:save','\x20interaction','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY'];(function(_0x4fdb79,_0x12c116){var _0x3ec15b=function(_0x50c82e){while(--_0x50c82e){_0x4fdb79['push'](_0x4fdb79['shift']());}};_0x3ec15b(++_0x12c116);}(_0x4991,0xf7));var _0x1499=function(_0x1dfea2,_0x3e3bf6){_0x1dfea2=_0x1dfea2-0x0;var _0x4d441f=_0x4991[_0x1dfea2];return _0x4d441f;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var utils=require(_0x1499('0x1'));var Mustache=require('mustache');var Redis=require(_0x1499('0x2'));var config=require(_0x1499('0x3'));var logger=require(_0x1499('0x4'))(_0x1499('0x5'));config[_0x1499('0x6')]=_[_0x1499('0x7')](config[_0x1499('0x6')],{'host':_0x1499('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1499('0x6')]));function emit(_0x1c3bd7,_0x1c65c3,_0x33b261){io['to'](_0x1c3bd7)[_0x1499('0x9')](_0x1c65c3,_0x33b261);}function sendNotification(_0x380e48,_0x3277b3,_0x15b291,_0x48d2ca,_0x16e8ad,_0x36a053){io['to'](util['format'](_0x1499('0xa'),_0x48d2ca[_0x1499('0xb')]))['emit'](_0x1499('0xc'),_0x48d2ca);var _0x2867b1=_0x36a053||{};var _0x5de9a2=_0x15b291['split']('.');var _0x4dd594={'uniqueid':_0x3277b3,'channel':_0x5de9a2[0x0],'id':_0x5de9a2[0x1],'title':_0x5de9a2[0x0]+_0x1499('0xd'),'interactionId':_0x5de9a2[0x2],'queue':_0x16e8ad?_0x16e8ad[_0x1499('0xb')]:null,'sound':_0x2867b1[_0x1499('0xe')][_0x1499('0xf')],'shake':_0x2867b1[_0x1499('0xe')]['notificationShake']};try{if(!_0x2867b1['body']){_0x2867b1[_0x1499('0x10')]={};}if(_0x16e8ad){_0x2867b1['body'][_0x1499('0x11')]=_0x16e8ad;}else if(_0x2867b1[_0x1499('0x10')][_0x1499('0x11')]){delete _0x2867b1[_0x1499('0x10')]['queue'];}_0x4dd594[_0x1499('0x12')]=utils[_0x1499('0x13')](_0x2867b1['account'][_0x1499('0x14')],_0x2867b1);}catch(_0x2d405f){_0x4dd594[_0x1499('0x12')]=_0x1499('0x15');logger[_0x1499('0x16')](util[_0x1499('0x17')]('[%s][QUEUE]\x20%s',_0x3277b3,_0x2d405f['message']));}io['to'](util['format'](_0x1499('0xa'),_0x48d2ca[_0x1499('0xb')]))['emit'](util[_0x1499('0x17')](_0x1499('0x18'),_0x380e48?_0x1499('0x19'):_0x1499('0x1a')),_0x4dd594);}function writeLog(_0x21e887,_0x2911ab,_0x2b0458){return logger[_0x1499('0x1b')](util[_0x1499('0x17')](_0x1499('0x1c'),_0x21e887,_0x2911ab[_0x1499('0xb')],_0x2b0458));}exports[_0x1499('0x1d')]=function(_0x223f4c,_0x3b73f6,_0x4ec57a,_0x1e2c51){if(_0x3b73f6[_0x1499('0x1e')]){writeLog(_0x223f4c,_0x3b73f6,'BUSY');return![];}if(!_0x3b73f6[_0x1499('0x1f')]){writeLog(_0x223f4c,_0x3b73f6,_0x1499('0x20'));return![];}if(_0x3b73f6[_0x4ec57a+_0x1499('0x21')]){writeLog(_0x223f4c,_0x3b73f6,_0x1499('0x22'));return![];}if(_0x1e2c51&&_0x3b73f6[_0x1499('0x23')](_0x4ec57a+_0x1499('0x24'))&&_0x3b73f6['hasOwnProperty'](_0x4ec57a+'CurrentCapacity')){if(_0x3b73f6[_0x4ec57a+_0x1499('0x24')]>0x0&&_0x3b73f6[_0x4ec57a+_0x1499('0x25')]>=_0x3b73f6[_0x4ec57a+_0x1499('0x24')]){writeLog(_0x223f4c,_0x3b73f6,_0x4ec57a[_0x1499('0x26')]()+_0x1499('0x27'));return![];}}return!![];};exports['showNotification']=function(_0x3e5ed1,_0x573b51,_0x5022a4,_0x516f29,_0x21d204){return sendNotification(!![],_0x3e5ed1,_0x573b51,_0x5022a4,_0x516f29,_0x21d204);};exports[_0x1499('0x28')]=function(_0x40932a,_0x1b460b,_0x3dad86,_0x388513,_0x3dd534){return sendNotification(![],_0x40932a,_0x1b460b,_0x3dad86,_0x388513,_0x3dd534);};exports['writeLog']=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 f7959e5..0dafaf5 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 _0x68a5=['[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0x1418b6,_0x2b905e){var _0x1072dc=function(_0x2fd915){while(--_0x2fd915){_0x1418b6['push'](_0x1418b6['shift']());}};_0x1072dc(++_0x2b905e);}(_0x68a5,0x67));var _0x568a=function(_0x1aaf62,_0x49f3b1){_0x1aaf62=_0x1aaf62-0x0;var _0x2e5fd2=_0x68a5[_0x1aaf62];return _0x2e5fd2;};'use strict';var schema=require(_0x568a('0x0'));var sh=require(_0x568a('0x1'));var _=require(_0x568a('0x2'));var utils=require(_0x568a('0x3'));var logger=require(_0x568a('0x4'))('routing');var system=schema({'command':{'type':_0x568a('0x5'),'required':!![],'message':_0x568a('0x6')}});exports['consequence']=function(_0x551c4b,_0x265a36){return function(_0x28a0c8){try{var _0x9d91df={'command':_0x265a36[0x0]};var _0x5d6e11=system[_0x568a('0x0')](_0x9d91df,{'typecast':!![]});if(_0x5d6e11[_0x568a('0x7')]){logger[_0x568a('0x8')]('[%s][SYSTEM]\x20%s',_0x551c4b,_[_0x568a('0x9')](_0x5d6e11,_0x568a('0xa'))[_0x568a('0xb')](',\x20'));logger[_0x568a('0xc')](_0x568a('0xd'),_0x551c4b);_0x28a0c8[_0x568a('0xe')]();}else{var _0x1a2c33=this;var _0x3cdc94=utils['getMustacheRender'](_0x265a36[0x0],this);logger[_0x568a('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x551c4b,_0x3cdc94);sh['exec'](_[_0x568a('0xf')](_0x3cdc94),function(_0x5be685,_0xf4546f){logger['info'](_0x568a('0x10'),_0x551c4b,_0x5be685);if(_0x5be685==0x0){var _0x4fdc2c=_0xf4546f['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x568a('0x11')](_0x265a36[0x1])||_[_0x568a('0x12')](_0x265a36[0x1])){logger[_0x568a('0xc')](_0x568a('0x13'),_0x551c4b);_0x1a2c33[_0x568a('0x14')][_0x265a36[0x1]]=_0x4fdc2c;}else{logger['info'](_0x568a('0x15'),_0x551c4b,_0x265a36[0x1],_0x4fdc2c);_0x1a2c33[_0x568a('0x14')][_0x265a36[0x1]]=_0x4fdc2c;}}_0x28a0c8['next']();});}}catch(_0x3019ae){logger[_0x568a('0x8')](_0x568a('0x16'),_0x551c4b,_[_0x568a('0x17')](_0x3019ae)?JSON[_0x568a('0x18')](_0x3019ae):_0x3019ae);logger[_0x568a('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x551c4b);_0x28a0c8[_0x568a('0xe')]();}};}; \ No newline at end of file +var _0x0ffd=['isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','trim','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0x32d46b,_0x391ee4){var _0x1dec7d=function(_0x4dedae){while(--_0x4dedae){_0x32d46b['push'](_0x32d46b['shift']());}};_0x1dec7d(++_0x391ee4);}(_0x0ffd,0xa4));var _0xd0ff=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x0ffd[_0x4243a3];return _0x1b2a33;};'use strict';var schema=require(_0xd0ff('0x0'));var sh=require(_0xd0ff('0x1'));var _=require(_0xd0ff('0x2'));var utils=require(_0xd0ff('0x3'));var logger=require('../../../../config/logger')(_0xd0ff('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0xd0ff('0x5')}});exports['consequence']=function(_0x217795,_0x47b9a8){return function(_0x3d3e70){try{var _0x52552a={'command':_0x47b9a8[0x0]};var _0x441d2=system['validate'](_0x52552a,{'typecast':!![]});if(_0x441d2[_0xd0ff('0x6')]){logger['error'](_0xd0ff('0x7'),_0x217795,_[_0xd0ff('0x8')](_0x441d2,_0xd0ff('0x9'))[_0xd0ff('0xa')](',\x20'));logger[_0xd0ff('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x217795);_0x3d3e70[_0xd0ff('0xc')]();}else{var _0xaa6d27=this;var _0x7689a3=utils[_0xd0ff('0xd')](_0x47b9a8[0x0],this);logger[_0xd0ff('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x217795,_0x7689a3);sh['exec'](_[_0xd0ff('0xe')](_0x7689a3),function(_0x539b15,_0x4a65c4){logger[_0xd0ff('0xb')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x217795,_0x539b15);if(_0x539b15==0x0){var _0x48f8c4=_0x4a65c4[_0xd0ff('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0xd0ff('0x10')](_0x47b9a8[0x1])||_[_0xd0ff('0x11')](_0x47b9a8[0x1])){logger[_0xd0ff('0xb')]('[%s][SYSTEM]\x20no\x20variable',_0x217795);_0xaa6d27[_0xd0ff('0x12')][_0x47b9a8[0x1]]=_0x48f8c4;}else{logger['info'](_0xd0ff('0x13'),_0x217795,_0x47b9a8[0x1],_0x48f8c4);_0xaa6d27[_0xd0ff('0x12')][_0x47b9a8[0x1]]=_0x48f8c4;}}_0x3d3e70['next']();});}}catch(_0x552a90){logger['error'](_0xd0ff('0x7'),_0x217795,_[_0xd0ff('0x14')](_0x552a90)?JSON[_0xd0ff('0x15')](_0x552a90):_0x552a90);logger[_0xd0ff('0xb')](_0xd0ff('0x16'),_0x217795);_0x3d3e70[_0xd0ff('0xc')]();}};}; \ 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 1089153..be9d0bf 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 _0xca07=['error','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','catch','stringify','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x2fb2d7,_0x748a6){var _0x23ab8b=function(_0x2a0658){while(--_0x2a0658){_0x2fb2d7['push'](_0x2fb2d7['shift']());}};_0x23ab8b(++_0x748a6);}(_0xca07,0x69));var _0x7ca0=function(_0x49621c,_0xa7e906){_0x49621c=_0x49621c-0x0;var _0x38e8a8=_0xca07[_0x49621c];return _0x38e8a8;};'use strict';var schema=require(_0x7ca0('0x0'));var _=require(_0x7ca0('0x1'));var rpc={'chatInteraction':require(_0x7ca0('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x7ca0('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x7ca0('0x4')),'whatsappInteraction':require(_0x7ca0('0x5'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0x7ca0('0x6'),'required':!![],'message':_0x7ca0('0x7')}});exports[_0x7ca0('0x8')]=function(_0x3b58ee,_0x237c40,_0x4aed8f,_0x1e4e4e){return function(_0xa604a8){try{var _0x26506e={'tag':_0x237c40[0x0]};var _0x1cdc89=tag['validate'](_0x26506e,{'typecast':!![]});if(_0x1cdc89[_0x7ca0('0x9')]){logger[_0x7ca0('0xa')](_0x7ca0('0xb'),_0x3b58ee,_[_0x7ca0('0xc')](_0x1cdc89,'message')['join'](',\x20'));logger[_0x7ca0('0xd')](_0x7ca0('0xe'),_0x3b58ee);_0xa604a8[_0x7ca0('0xf')]();}else{var _0x14a381={'ids':[_0x237c40[0x0]]};if(rpc[_0x1e4e4e[_0x7ca0('0x10')]+_0x7ca0('0x11')]){rpc[_0x1e4e4e[_0x7ca0('0x10')]+_0x7ca0('0x11')][_0x7ca0('0x12')](_0x1e4e4e[_0x7ca0('0x13')]['id'],_0x14a381)['then'](function(_0xedb7d3){logger[_0x7ca0('0xd')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x3b58ee,_0x237c40[0x1],_0x1e4e4e[_0x7ca0('0x10')],_0x1e4e4e[_0x7ca0('0x13')]['id']);})[_0x7ca0('0x14')](function(_0x388de0){logger[_0x7ca0('0xa')](_0x7ca0('0xb'),_0x3b58ee,JSON[_0x7ca0('0x15')](_0x388de0));logger[_0x7ca0('0xd')](_0x7ca0('0xe'),_0x3b58ee);})[_0x7ca0('0x16')](function(){_0xa604a8[_0x7ca0('0xf')]();});}}}catch(_0x23bd8e){logger['error'](_0x7ca0('0xb'),_0x3b58ee,_['isObject'](_0x23bd8e)?JSON[_0x7ca0('0x15')](_0x23bd8e):_0x23bd8e);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3b58ee);_0xa604a8[_0x7ca0('0xf')]();}};}; \ No newline at end of file +var _0x6c5b=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','finally','isObject','next','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','number'];(function(_0x9bda6e,_0x34d5ea){var _0x49e11d=function(_0x4489dd){while(--_0x4489dd){_0x9bda6e['push'](_0x9bda6e['shift']());}};_0x49e11d(++_0x34d5ea);}(_0x6c5b,0x7b));var _0xb6c5=function(_0x51df56,_0x554a4e){_0x51df56=_0x51df56-0x0;var _0x5133ca=_0x6c5b[_0x51df56];return _0x5133ca;};'use strict';var schema=require('validate');var _=require(_0xb6c5('0x0'));var rpc={'chatInteraction':require(_0xb6c5('0x1')),'openchannelInteraction':require(_0xb6c5('0x2')),'smsInteraction':require(_0xb6c5('0x3')),'mailInteraction':require(_0xb6c5('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xb6c5('0x5'))('routing');var tag=schema({'tag':{'type':_0xb6c5('0x6'),'required':!![],'message':_0xb6c5('0x7')}});exports['consequence']=function(_0x275a61,_0x303306,_0x301340,_0x965d0e){return function(_0x5e3e46){try{var _0x2952f4={'tag':_0x303306[0x0]};var _0x2898cb=tag['validate'](_0x2952f4,{'typecast':!![]});if(_0x2898cb[_0xb6c5('0x8')]){logger[_0xb6c5('0x9')]('[%s][TAG]\x20%s',_0x275a61,_[_0xb6c5('0xa')](_0x2898cb,_0xb6c5('0xb'))[_0xb6c5('0xc')](',\x20'));logger[_0xb6c5('0xd')](_0xb6c5('0xe'),_0x275a61);_0x5e3e46['next']();}else{var _0x3194ed={'ids':[_0x303306[0x0]]};if(rpc[_0x965d0e[_0xb6c5('0xf')]+_0xb6c5('0x10')]){rpc[_0x965d0e[_0xb6c5('0xf')]+_0xb6c5('0x10')][_0xb6c5('0x11')](_0x965d0e['interaction']['id'],_0x3194ed)[_0xb6c5('0x12')](function(_0x3cf852){logger[_0xb6c5('0xd')](_0xb6c5('0x13'),_0x275a61,_0x303306[0x1],_0x965d0e[_0xb6c5('0xf')],_0x965d0e['interaction']['id']);})[_0xb6c5('0x14')](function(_0x214d9e){logger[_0xb6c5('0x9')](_0xb6c5('0x15'),_0x275a61,JSON[_0xb6c5('0x16')](_0x214d9e));logger[_0xb6c5('0xd')](_0xb6c5('0xe'),_0x275a61);})[_0xb6c5('0x17')](function(){_0x5e3e46['next']();});}}}catch(_0x434074){logger[_0xb6c5('0x9')](_0xb6c5('0x15'),_0x275a61,_[_0xb6c5('0x18')](_0x434074)?JSON[_0xb6c5('0x16')](_0x434074):_0x434074);logger[_0xb6c5('0xd')](_0xb6c5('0xe'),_0x275a61);_0x5e3e46[_0xb6c5('0x19')]();}};}; \ 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 5307051..2474a4c 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0xf6eb2c,_0x4d4c17){var _0x48ba8f=function(_0x3b331c){while(--_0x3b331c){_0xf6eb2c['push'](_0xf6eb2c['shift']());}};_0x48ba8f(++_0x4d4c17);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x75315,_0xd94ca7){var _0x2baee3=function(_0x4a29b7){while(--_0x4a29b7){_0x75315['push'](_0x75315['shift']());}};_0x2baee3(++_0xd94ca7);}(_0xe706,0xa3));var _0x6e70=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0xe706[_0x292f93];return _0x5a94b1;};'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 ba4c46b..b7c4db0 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 _0x9058=['openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','applications','isArray','length','existsSync','join','.js','app','toLowerCase','appdata','split','channel','mail','push','slice','dialogflowv2','tag','TagId','condition','consequence','info','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','emit','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','stack','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues'];(function(_0x1cada6,_0x3667b3){var _0x485132=function(_0x3a6ba2){while(--_0x3a6ba2){_0x1cada6['push'](_0x1cada6['shift']());}};_0x485132(++_0x3667b3);}(_0x9058,0x17e));var _0x8905=function(_0x52ce74,_0xfcf94){_0x52ce74=_0x52ce74-0x0;var _0x27edc7=_0x9058[_0x52ce74];return _0x27edc7;};'use strict';var _=require(_0x8905('0x0'));var util=require('util');var path=require(_0x8905('0x1'));var fs=require('fs');var jayson=require(_0x8905('0x2'));var BPromise=require(_0x8905('0x3'));var uuid=require(_0x8905('0x4'));var config=require(_0x8905('0x5'));var logger=require(_0x8905('0x6'))(_0x8905('0x7'));var rpc={'openchannelQueueReport':require(_0x8905('0x8')),'mailQueueReport':require(_0x8905('0x9')),'chatQueueReport':require(_0x8905('0xa')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x8905('0xb')),'whatsappQueueReport':require(_0x8905('0xc'))};var RuleEngine=require(_0x8905('0xd'));function getId(_0x583e56,_0x3ef49a,_0x30c5bb){return util['format'](_0x8905('0xe'),_0x583e56,_0x3ef49a||0x0,_0x30c5bb||0x0);}function getIntervals(_0xff16a3,_0x547ab3){var _0x5ce40f=[];if(!_[_0x8905('0xf')](_0x547ab3[_0x8905('0x10')])&&!_[_0x8905('0xf')](_0xff16a3[_0x547ab3['IntervalId']])&&!_[_0x8905('0xf')](_0xff16a3[_0x547ab3[_0x8905('0x10')]][_0x8905('0x11')])){_0x5ce40f=_[_0x8905('0x12')](_0xff16a3[_0x547ab3['IntervalId']]['Intervals'],_0x8905('0x13'));}else if(!_[_0x8905('0xf')](_0x547ab3['interval'])){_0x5ce40f=[_0x547ab3[_0x8905('0x13')]];}return _0x5ce40f;}exports[_0x8905('0x14')]=function(_0xfe719f){_0xfe719f[_0x8905('0x15')]={};return new BPromise(function(_0x1e243d,_0xa3ec98){var _0x51dc0c={'Start':function(_0x484fa5){var _0x3258ca=this;return new Promise(function(_0x5cf577,_0x6c3af1){if(_0x484fa5){try{var _0x1359af=[];var _0x274c35=getId(_0x484fa5['channel'],_0x484fa5[_0x8905('0x16')]?_0x484fa5[_0x8905('0x16')]['id']:0x0,_0x484fa5[_0x8905('0x17')]?_0x484fa5[_0x8905('0x17')]['id']:0x0);if(_0x484fa5[_0x8905('0x18')]&&_[_0x8905('0x19')](_0x484fa5[_0x8905('0x18')])&&_0x484fa5[_0x8905('0x18')][_0x8905('0x1a')]){for(var _0x1ffd57=0x0;_0x1ffd57<_0x484fa5['applications']['length'];_0x1ffd57+=0x1){var _0x508654=_0x484fa5[_0x8905('0x18')][_0x1ffd57];if(fs[_0x8905('0x1b')](path[_0x8905('0x1c')](__dirname,_0x8905('0x18'),_0x508654['app']+_0x8905('0x1d')))){var _0x344f04=[];switch(_0x508654[_0x8905('0x1e')][_0x8905('0x1f')]()){case'autoreply':var _0x58a88f=_0x508654[_0x8905('0x20')][_0x8905('0x21')](',');if(_0x484fa5[_0x8905('0x22')]===_0x8905('0x23')){_0x344f04[_0x8905('0x24')](_0x58a88f[0x0]);_0x344f04[_0x8905('0x24')](_0x58a88f[0x1]);_0x344f04[_0x8905('0x24')](_0x58a88f[_0x8905('0x25')](0x2,_0x58a88f[_0x8905('0x1a')])[_0x8905('0x1c')](','));}else{_0x344f04['push'](_0x58a88f[0x0]);_0x344f04[_0x8905('0x24')](_0x58a88f[_0x8905('0x25')](0x1,_0x58a88f[_0x8905('0x1a')])[_0x8905('0x1c')](','));}break;case'dialogflow':var _0x4f6603=_0x508654[_0x8905('0x20')][_0x8905('0x21')](',');_0x344f04[_0x8905('0x24')](_0x4f6603[0x0]);_0x344f04[_0x8905('0x24')](_0x4f6603[0x1]);_0x344f04[_0x8905('0x24')](_0x4f6603['slice'](0x2,_0x4f6603[_0x8905('0x1a')])[_0x8905('0x1c')](','));break;case _0x8905('0x26'):var _0x2138f0=_0x508654[_0x8905('0x20')]['split'](',');_0x344f04[_0x8905('0x24')](_0x2138f0[0x0]);_0x344f04[_0x8905('0x24')](_0x2138f0[0x1]);_0x344f04[_0x8905('0x24')](_0x2138f0[0x2]);_0x344f04[_0x8905('0x24')](_0x2138f0[0x3]);_0x344f04[_0x8905('0x24')](_0x2138f0[_0x8905('0x25')](0x4,_0x2138f0[_0x8905('0x1a')])[_0x8905('0x1c')](','));break;case'amazonlex':var _0xc6086d=_0x508654[_0x8905('0x20')][_0x8905('0x21')](',');_0x344f04['push'](_0xc6086d[0x0]);_0x344f04['push'](_0xc6086d[0x1]);_0x344f04[_0x8905('0x24')](_0xc6086d[0x2]);_0x344f04[_0x8905('0x24')](_0xc6086d[0x3]);_0x344f04['push'](_0xc6086d[_0x8905('0x25')](0x4,_0xc6086d[_0x8905('0x1a')])[_0x8905('0x1c')](','));break;case _0x8905('0x16'):_0x344f04[_0x8905('0x24')](_0x508654[_0x8905('0x20')]);break;case _0x8905('0x27'):_0x344f04[_0x8905('0x24')](_0x508654[_0x8905('0x28')]);_0x344f04['push'](_0x508654['appdata']);break;default:_0x344f04=_[_0x8905('0xf')](_0x508654['appdata'])?[]:_0x508654[_0x8905('0x20')][_0x8905('0x21')](',');}var _0x5a41df={'id':util['format']('%s:%s:%s',_0x274c35,_0x508654['id'],_0x508654[_0x8905('0x1e')]),'condition':require('./interval')[_0x8905('0x29')](_0x274c35,getIntervals(_0xfe719f['intervals'],_0x508654),_0xfe719f),'consequence':require('./applications/'+_0x508654[_0x8905('0x1e')])[_0x8905('0x2a')](_0x274c35,_0x344f04,_0xfe719f,_0x484fa5),'p':_0x508654['priority']||0x0};logger[_0x8905('0x2b')]('Push\x20new\x20rule',_0x5a41df['id'],_0x8905('0x2c'),getIntervals(_0xfe719f[_0x8905('0x2d')],_0x508654)['join'](_0x8905('0x2e')));_0x1359af[_0x8905('0x24')](_0x5a41df);}else{logger[_0x8905('0x2f')](_0x8905('0x30'),path['join'](__dirname,_0x8905('0x18'),_0x508654['app']+'.js'));}}_0xfe719f['rules'][_0x274c35]=new RuleEngine(_0x1359af);_0xfe719f[_0x8905('0x15')][_0x274c35][_0x8905('0x31')](_0x484fa5,function(_0x51c6d6){logger[_0x8905('0x2b')](_0x8905('0x32'),JSON['stringify'](_0x51c6d6['matchPath']));if(_0xfe719f[_0x8905('0x15')][_0x274c35]){_0xfe719f[_0x8905('0x15')][_0x274c35][_0x8905('0x33')](_0x8905('0x34'));}});return _0x5cf577({'code':0xc8,'message':_0x484fa5});}else{logger[_0x8905('0x2b')](_0x8905('0x35'));return _0x5cf577({'code':0xc8,'message':_0x484fa5});}}catch(_0x3f2b43){logger[_0x8905('0x2f')](_0x3f2b43['stack']);return _0x6c3af1(_0x3258ca[_0x8905('0x2f')](0x1f4,_0x3f2b43));}}return _0x6c3af1(_0x8905('0x36'));});},'AcceptMessage':function(_0xe61f95){var _0x21db37=this;return new Promise(function(_0x3e51e0,_0x2a4063){if(_0xe61f95['agent']&&_0xe61f95[_0x8905('0x37')]['id']){if(_0xfe719f[_0x8905('0x38')][_0xe61f95[_0x8905('0x37')]['id']]){_0xfe719f[_0x8905('0x38')][_0xe61f95[_0x8905('0x37')]['id']][_0x8905('0x39')]=![];_0xfe719f[_0x8905('0x38')][_0xe61f95['agent']['id']][_0x8905('0x3a')]=undefined;}}if(_0xe61f95['message']&&_0xe61f95[_0x8905('0x16')]['id']){try{var _0x390567=getId(_0xe61f95[_0x8905('0x22')],_0xe61f95[_0x8905('0x16')]?_0xe61f95[_0x8905('0x16')]['id']:0x0,_0xe61f95[_0x8905('0x17')]?_0xe61f95[_0x8905('0x17')]['id']:0x0);if(_0xfe719f[_0x8905('0x15')][_0x390567]){_0xfe719f[_0x8905('0x15')][_0x390567][_0x8905('0x33')](_0x8905('0x3b'));if(rpc[_0xe61f95[_0x8905('0x22')]+_0x8905('0x3c')]){rpc[_0xe61f95['channel']+_0x8905('0x3c')]['update'](_0x390567,{'UserId':_0xe61f95[_0x8905('0x16')][_0x8905('0x3d')]})[_0x8905('0x3e')](function(_0x3429ff){logger[_0x8905('0x2f')](_0x8905('0x3f'));});}}return _0x3e51e0({'code':0xc8,'message':_0xe61f95});}catch(_0x5c3cba){logger[_0x8905('0x2f')](_0x5c3cba['stack']);return _0x2a4063(_0x21db37['error'](0x1f4,_0x5c3cba));}}logger[_0x8905('0x2f')](_0x8905('0x40'));return _0x2a4063(_0x21db37['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x46fd5b){var _0x41615d=this;return new Promise(function(_0x2b8650,_0x52dcf1){if(_0x46fd5b[_0x8905('0x37')]&&_0x46fd5b[_0x8905('0x37')]['id']){try{if(_0xfe719f[_0x8905('0x38')][_0x46fd5b['agent']['id']]){_0xfe719f[_0x8905('0x38')][_0x46fd5b['agent']['id']][_0x8905('0x39')]=![];_0xfe719f[_0x8905('0x38')][_0x46fd5b[_0x8905('0x37')]['id']][_0x8905('0x3a')]=undefined;}return _0x2b8650({'code':0xc8,'message':_0x46fd5b});}catch(_0xef0cd5){logger[_0x8905('0x2f')](_0xef0cd5[_0x8905('0x41')]);return _0x52dcf1(_0x41615d['error'](0x1f4,_0xef0cd5));}}logger['error'](_0x8905('0x40'));return _0x52dcf1(_0x41615d[_0x8905('0x2f')](0x1f4,_0x8905('0x40')));});},'AbandonInteraction':function(_0x3c047e){var _0x167fb7=this;return new Promise(function(_0x51fede,_0x2c5a2d){if(_0x3c047e[_0x8905('0x22')]&&_0x3c047e[_0x8905('0x17')]&&_0x3c047e[_0x8905('0x17')]['id']){try{var _0x47eb60=getId(_0x3c047e[_0x8905('0x22')],_0x3c047e[_0x8905('0x16')]?_0x3c047e[_0x8905('0x16')]['id']:0x0,_0x3c047e['interaction']?_0x3c047e['interaction']['id']:0x0);if(_0xfe719f[_0x8905('0x15')][_0x47eb60]){_0xfe719f[_0x8905('0x15')][_0x47eb60][_0x8905('0x33')](_0x8905('0x3b'));}return _0x51fede({'code':0xc8,'message':_0x3c047e});}catch(_0x27b313){logger['error'](_0x27b313[_0x8905('0x41')]);return _0x2c5a2d(_0x167fb7['error'](0x1f4,_0x27b313));}}logger['error'](_0x8905('0x40'));return _0x2c5a2d(_0x167fb7[_0x8905('0x2f')](0x1f4,_0x8905('0x40')));});},'AgentCapacity':function(_0x2d9da1){var _0x5276cd=this;return new Promise(function(_0x4dd044,_0x4f4ba0){if(_0xfe719f['agents'][_0x8905('0x42')](_0x2d9da1['id'])){for(var _0x4d0eb0 in _0x2d9da1[_0x8905('0x43')]){if(_0x2d9da1[_0x8905('0x43')][_0x8905('0x42')](_0x4d0eb0)){if(_0xfe719f[_0x8905('0x38')][_0x2d9da1['id']][_0x8905('0x42')](_0x4d0eb0+_0x8905('0x44'))){_0xfe719f[_0x8905('0x38')][_0x2d9da1['id']][_0x4d0eb0+_0x8905('0x44')]=parseInt(_0x2d9da1['capacity'][_0x4d0eb0],0xa);}}}_0xfe719f[_0x8905('0x38')][_0x2d9da1['id']][_0x8905('0x45')]();return _0x4dd044({'code':0xc8,'message':_0xfe719f['agents'][_0x2d9da1['id']]});}else{return _0x4f4ba0(_0x5276cd[_0x8905('0x2f')](0x1f4,_0x8905('0x46')));}});},'Agents':function(_0x149d12){return new Promise(function(_0x58d769,_0x2c08dd){var _0x58f5a1=_[_0x8905('0x47')](_0xfe719f[_0x8905('0x38')]);_0x58d769({'count':_0x58f5a1[_0x8905('0x1a')],'rows':_0x58f5a1});});},'ChatQueues':function(_0x35efb7){return new Promise(function(_0x153ba8,_0x445c4a){var _0x1d9a30=[];for(var _0x18ccb5 in _0xfe719f[_0x8905('0x48')]){if(_0xfe719f[_0x8905('0x48')][_0x8905('0x42')](_0x18ccb5)){var _0x4e2ddd=_0xfe719f['chatQueues'][_0x18ccb5];var _0x1f3e98={'id':_0x4e2ddd['id'],'available':_0x4e2ddd[_0x8905('0x49')],'loggedIn':_0x4e2ddd[_0x8905('0x4a')],'name':_0x4e2ddd['name'],'paused':_0x4e2ddd[_0x8905('0x4b')],'waiting':_0x4e2ddd[_0x8905('0x4c')]};_0x1d9a30[_0x8905('0x24')](_0x1f3e98);}}_0x153ba8({'count':_0x1d9a30[_0x8905('0x1a')],'rows':_0x1d9a30});});},'MailQueues':function(_0x37346a){return new Promise(function(_0xb67818,_0x21dfe3){var _0x5af991=[];for(var _0x420436 in _0xfe719f[_0x8905('0x4d')]){if(_0xfe719f['mailQueues'][_0x8905('0x42')](_0x420436)){var _0x4188f0=_0xfe719f[_0x8905('0x4d')][_0x420436];var _0x57cbbf={'id':_0x4188f0['id'],'available':_0x4188f0['available'],'loggedIn':_0x4188f0[_0x8905('0x4a')],'name':_0x4188f0[_0x8905('0x4e')],'paused':_0x4188f0['paused'],'waiting':_0x4188f0[_0x8905('0x4c')]};_0x5af991[_0x8905('0x24')](_0x57cbbf);}}_0xb67818({'count':_0x5af991[_0x8905('0x1a')],'rows':_0x5af991});});},'OpenchannelQueues':function(_0x503a6d){return new Promise(function(_0xa66f3b,_0x412357){var _0x110de6=[];for(var _0x500bc8 in _0xfe719f[_0x8905('0x4f')]){if(_0xfe719f[_0x8905('0x4f')]['hasOwnProperty'](_0x500bc8)){var _0x1dbe37=_0xfe719f[_0x8905('0x4f')][_0x500bc8];var _0x54e51e={'id':_0x1dbe37['id'],'available':_0x1dbe37[_0x8905('0x49')],'loggedIn':_0x1dbe37['loggedIn'],'name':_0x1dbe37[_0x8905('0x4e')],'paused':_0x1dbe37[_0x8905('0x4b')],'waiting':_0x1dbe37['waiting']};_0x110de6[_0x8905('0x24')](_0x54e51e);}}_0xa66f3b({'count':_0x110de6[_0x8905('0x1a')],'rows':_0x110de6});});},'SmsQueues':function(_0x3c17ca){return new Promise(function(_0x402486,_0x18720a){var _0x26e12f=[];for(var _0xf2b310 in _0xfe719f['smsQueues']){if(_0xfe719f[_0x8905('0x50')][_0x8905('0x42')](_0xf2b310)){var _0x2ed4fd=_0xfe719f[_0x8905('0x50')][_0xf2b310];var _0x200cbd={'id':_0x2ed4fd['id'],'available':_0x2ed4fd[_0x8905('0x49')],'loggedIn':_0x2ed4fd['loggedIn'],'name':_0x2ed4fd[_0x8905('0x4e')],'paused':_0x2ed4fd[_0x8905('0x4b')],'waiting':_0x2ed4fd['waiting']};_0x26e12f['push'](_0x200cbd);}}_0x402486({'count':_0x26e12f[_0x8905('0x1a')],'rows':_0x26e12f});});},'FaxQueues':function(_0x5b6b6f){return new Promise(function(_0x33560b,_0x189e6a){var _0x42ef2b=[];for(var _0x37b82a in _0xfe719f['faxQueues']){if(_0xfe719f[_0x8905('0x51')][_0x8905('0x42')](_0x37b82a)){var _0x4d98a3=_0xfe719f['faxQueues'][_0x37b82a];var _0x572334={'id':_0x4d98a3['id'],'available':_0x4d98a3[_0x8905('0x49')],'loggedIn':_0x4d98a3[_0x8905('0x4a')],'name':_0x4d98a3[_0x8905('0x4e')],'paused':_0x4d98a3[_0x8905('0x4b')],'waiting':_0x4d98a3[_0x8905('0x4c')]};_0x42ef2b[_0x8905('0x24')](_0x572334);}}_0x33560b({'count':_0x42ef2b['length'],'rows':_0x42ef2b});});},'WhatsappQueues':function(_0x4736d1){return new Promise(function(_0x2ebc39,_0x48b839){var _0x3e9004=[];for(var _0xdccce1 in _0xfe719f[_0x8905('0x52')]){if(_0xfe719f[_0x8905('0x52')]['hasOwnProperty'](_0xdccce1)){var _0x384ece=_0xfe719f[_0x8905('0x52')][_0xdccce1];var _0x2fcc45={'id':_0x384ece['id'],'available':_0x384ece['available'],'loggedIn':_0x384ece[_0x8905('0x4a')],'name':_0x384ece['name'],'paused':_0x384ece['paused'],'waiting':_0x384ece[_0x8905('0x4c')]};_0x3e9004[_0x8905('0x24')](_0x2fcc45);}}_0x2ebc39({'count':_0x3e9004[_0x8905('0x1a')],'rows':_0x3e9004});});},'ChatQueuesWaitingInteractions':function(_0x211d01){return new Promise(function(_0x369f71,_0x52aee1){var _0x5c716b=_[_0x8905('0x47')](_0xfe719f['chatQueuesWaitingInteractions']);_0x369f71({'count':_0x5c716b['length'],'rows':_0x5c716b});});},'MailQueuesWaitingInteractions':function(_0x35d817){return new Promise(function(_0x1e1321,_0x4c2028){var _0x59250b=_[_0x8905('0x47')](_0xfe719f['mailQueuesWaitingInteractions']);_0x1e1321({'count':_0x59250b[_0x8905('0x1a')],'rows':_0x59250b});});},'OpenchannelQueuesWaitingInteractions':function(_0x5bfd8d){return new Promise(function(_0x313097,_0x2f2937){var _0x4d92c1=_['values'](_0xfe719f[_0x8905('0x53')]);_0x313097({'count':_0x4d92c1[_0x8905('0x1a')],'rows':_0x4d92c1});});},'SmsQueuesWaitingInteractions':function(_0x7798a7){return new Promise(function(_0x58fd0d,_0x1d834d){var _0x2c926b=_[_0x8905('0x47')](_0xfe719f[_0x8905('0x54')]);_0x58fd0d({'count':_0x2c926b[_0x8905('0x1a')],'rows':_0x2c926b});});},'FaxQueuesWaitingInteractions':function(_0x213504){return new Promise(function(_0x1fb33b,_0x39f591){var _0x2d55bc=_['values'](_0xfe719f[_0x8905('0x55')]);_0x1fb33b({'count':_0x2d55bc[_0x8905('0x1a')],'rows':_0x2d55bc});});},'WhatsappQueuesWaitingInteractions':function(_0x1d12d9){return new Promise(function(_0x2bfe68,_0x487dff){var _0x5c48b6=_[_0x8905('0x47')](_0xfe719f[_0x8905('0x56')]);_0x2bfe68({'count':_0x5c48b6[_0x8905('0x1a')],'rows':_0x5c48b6});});}};var _0x228f01=jayson[_0x8905('0x57')](_0x51dc0c)['http']();_0x228f01['on'](_0x8905('0x2f'),function(_0x457005){logger['error'](JSON[_0x8905('0x58')](_0x457005));return _0xa3ec98(_0x457005);});_0x228f01['listen'](0x232c,_0x8905('0x59'),function(){console[_0x8905('0x5a')](_0x8905('0x5b'),0x232c);return _0x1e243d(_0x8905('0x5c')+0x232c);});});}; \ No newline at end of file +var _0x598c=['intervals','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','complete','info','stack','error','routing\x20is\x20empty','agent','agents','busyQueue','channel','emit','end','QueueReport','update','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','isNil','IntervalId','Intervals','interval','listen','rules','message','interaction','isArray','applications','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','./interval','./applications/','consequence','priority','on\x20interval'];(function(_0x235ba6,_0x315773){var _0x2aa7c4=function(_0x4d7040){while(--_0x4d7040){_0x235ba6['push'](_0x235ba6['shift']());}};_0x2aa7c4(++_0x315773);}(_0x598c,0x8e));var _0xc598=function(_0x4d5209,_0x2651f3){_0x4d5209=_0x4d5209-0x0;var _0x94211=_0x598c[_0x4d5209];return _0x94211;};'use strict';var _=require('lodash');var util=require(_0xc598('0x0'));var path=require(_0xc598('0x1'));var fs=require('fs');var jayson=require(_0xc598('0x2'));var BPromise=require(_0xc598('0x3'));var uuid=require(_0xc598('0x4'));var config=require('../../../config/environment');var logger=require(_0xc598('0x5'))(_0xc598('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xc598('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xc598('0x8')),'whatsappQueueReport':require(_0xc598('0x9'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x2ffa67,_0xd089ae,_0x123a21){return util[_0xc598('0xa')]('%s.%s.%s',_0x2ffa67,_0xd089ae||0x0,_0x123a21||0x0);}function getIntervals(_0x477e3b,_0x8734f3){var _0x1855ed=[];if(!_[_0xc598('0xb')](_0x8734f3[_0xc598('0xc')])&&!_[_0xc598('0xb')](_0x477e3b[_0x8734f3['IntervalId']])&&!_['isNil'](_0x477e3b[_0x8734f3[_0xc598('0xc')]][_0xc598('0xd')])){_0x1855ed=_['map'](_0x477e3b[_0x8734f3['IntervalId']][_0xc598('0xd')],'interval');}else if(!_['isNil'](_0x8734f3['interval'])){_0x1855ed=[_0x8734f3[_0xc598('0xe')]];}return _0x1855ed;}exports[_0xc598('0xf')]=function(_0x3205d1){_0x3205d1[_0xc598('0x10')]={};return new BPromise(function(_0xf58f90,_0x12e187){var _0x75fa5e={'Start':function(_0x11c7b8){var _0x306641=this;return new Promise(function(_0x378e0f,_0x186b47){if(_0x11c7b8){try{var _0x174bde=[];var _0x2ede29=getId(_0x11c7b8['channel'],_0x11c7b8[_0xc598('0x11')]?_0x11c7b8[_0xc598('0x11')]['id']:0x0,_0x11c7b8[_0xc598('0x12')]?_0x11c7b8[_0xc598('0x12')]['id']:0x0);if(_0x11c7b8['applications']&&_[_0xc598('0x13')](_0x11c7b8[_0xc598('0x14')])&&_0x11c7b8[_0xc598('0x14')]['length']){for(var _0x48ec9a=0x0;_0x48ec9a<_0x11c7b8[_0xc598('0x14')][_0xc598('0x15')];_0x48ec9a+=0x1){var _0x231b82=_0x11c7b8['applications'][_0x48ec9a];if(fs[_0xc598('0x16')](path[_0xc598('0x17')](__dirname,_0xc598('0x14'),_0x231b82[_0xc598('0x18')]+'.js'))){var _0x13ba25=[];switch(_0x231b82[_0xc598('0x18')][_0xc598('0x19')]()){case _0xc598('0x1a'):var _0x19670a=_0x231b82[_0xc598('0x1b')][_0xc598('0x1c')](',');if(_0x11c7b8['channel']===_0xc598('0x1d')){_0x13ba25['push'](_0x19670a[0x0]);_0x13ba25[_0xc598('0x1e')](_0x19670a[0x1]);_0x13ba25[_0xc598('0x1e')](_0x19670a[_0xc598('0x1f')](0x2,_0x19670a[_0xc598('0x15')])['join'](','));}else{_0x13ba25[_0xc598('0x1e')](_0x19670a[0x0]);_0x13ba25[_0xc598('0x1e')](_0x19670a[_0xc598('0x1f')](0x1,_0x19670a[_0xc598('0x15')])[_0xc598('0x17')](','));}break;case'dialogflow':var _0x1fc18f=_0x231b82[_0xc598('0x1b')][_0xc598('0x1c')](',');_0x13ba25[_0xc598('0x1e')](_0x1fc18f[0x0]);_0x13ba25[_0xc598('0x1e')](_0x1fc18f[0x1]);_0x13ba25[_0xc598('0x1e')](_0x1fc18f[_0xc598('0x1f')](0x2,_0x1fc18f['length'])[_0xc598('0x17')](','));break;case _0xc598('0x20'):var _0x404dbf=_0x231b82['appdata'][_0xc598('0x1c')](',');_0x13ba25[_0xc598('0x1e')](_0x404dbf[0x0]);_0x13ba25[_0xc598('0x1e')](_0x404dbf[0x1]);_0x13ba25[_0xc598('0x1e')](_0x404dbf[0x2]);_0x13ba25['push'](_0x404dbf[0x3]);_0x13ba25['push'](_0x404dbf[_0xc598('0x1f')](0x4,_0x404dbf[_0xc598('0x15')])['join'](','));break;case _0xc598('0x21'):var _0x52c16a=_0x231b82['appdata'][_0xc598('0x1c')](',');_0x13ba25[_0xc598('0x1e')](_0x52c16a[0x0]);_0x13ba25[_0xc598('0x1e')](_0x52c16a[0x1]);_0x13ba25[_0xc598('0x1e')](_0x52c16a[0x2]);_0x13ba25['push'](_0x52c16a[0x3]);_0x13ba25[_0xc598('0x1e')](_0x52c16a[_0xc598('0x1f')](0x4,_0x52c16a[_0xc598('0x15')])[_0xc598('0x17')](','));break;case _0xc598('0x11'):_0x13ba25[_0xc598('0x1e')](_0x231b82[_0xc598('0x1b')]);break;case _0xc598('0x22'):_0x13ba25[_0xc598('0x1e')](_0x231b82[_0xc598('0x23')]);_0x13ba25[_0xc598('0x1e')](_0x231b82['appdata']);break;default:_0x13ba25=_[_0xc598('0xb')](_0x231b82[_0xc598('0x1b')])?[]:_0x231b82[_0xc598('0x1b')][_0xc598('0x1c')](',');}var _0x249d4b={'id':util[_0xc598('0xa')](_0xc598('0x24'),_0x2ede29,_0x231b82['id'],_0x231b82[_0xc598('0x18')]),'condition':require(_0xc598('0x25'))['condition'](_0x2ede29,getIntervals(_0x3205d1['intervals'],_0x231b82),_0x3205d1),'consequence':require(_0xc598('0x26')+_0x231b82[_0xc598('0x18')])[_0xc598('0x27')](_0x2ede29,_0x13ba25,_0x3205d1,_0x11c7b8),'p':_0x231b82[_0xc598('0x28')]||0x0};logger['info']('Push\x20new\x20rule',_0x249d4b['id'],_0xc598('0x29'),getIntervals(_0x3205d1[_0xc598('0x2a')],_0x231b82)[_0xc598('0x17')](_0xc598('0x2b')));_0x174bde[_0xc598('0x1e')](_0x249d4b);}else{logger['error'](_0xc598('0x2c'),path[_0xc598('0x17')](__dirname,_0xc598('0x14'),_0x231b82[_0xc598('0x18')]+_0xc598('0x2d')));}}_0x3205d1['rules'][_0x2ede29]=new RuleEngine(_0x174bde);_0x3205d1[_0xc598('0x10')][_0x2ede29][_0xc598('0x2e')](_0x11c7b8,function(_0x3bfda2){logger['info'](_0xc598('0x2f'),JSON['stringify'](_0x3bfda2['matchPath']));if(_0x3205d1[_0xc598('0x10')][_0x2ede29]){_0x3205d1[_0xc598('0x10')][_0x2ede29]['emit'](_0xc598('0x30'));}});return _0x378e0f({'code':0xc8,'message':_0x11c7b8});}else{logger[_0xc598('0x31')]('No\x20applications\x20to\x20execute');return _0x378e0f({'code':0xc8,'message':_0x11c7b8});}}catch(_0x409647){logger['error'](_0x409647[_0xc598('0x32')]);return _0x186b47(_0x306641[_0xc598('0x33')](0x1f4,_0x409647));}}return _0x186b47(_0xc598('0x34'));});},'AcceptMessage':function(_0x89a8a7){var _0x389d0d=this;return new Promise(function(_0xc1a5b0,_0x292395){if(_0x89a8a7[_0xc598('0x35')]&&_0x89a8a7[_0xc598('0x35')]['id']){if(_0x3205d1[_0xc598('0x36')][_0x89a8a7['agent']['id']]){_0x3205d1['agents'][_0x89a8a7[_0xc598('0x35')]['id']]['busy']=![];_0x3205d1['agents'][_0x89a8a7['agent']['id']][_0xc598('0x37')]=undefined;}}if(_0x89a8a7[_0xc598('0x11')]&&_0x89a8a7[_0xc598('0x11')]['id']){try{var _0x47238e=getId(_0x89a8a7[_0xc598('0x38')],_0x89a8a7[_0xc598('0x11')]?_0x89a8a7[_0xc598('0x11')]['id']:0x0,_0x89a8a7[_0xc598('0x12')]?_0x89a8a7[_0xc598('0x12')]['id']:0x0);if(_0x3205d1[_0xc598('0x10')][_0x47238e]){_0x3205d1['rules'][_0x47238e][_0xc598('0x39')](_0xc598('0x3a'));if(rpc[_0x89a8a7[_0xc598('0x38')]+_0xc598('0x3b')]){rpc[_0x89a8a7['channel']+_0xc598('0x3b')][_0xc598('0x3c')](_0x47238e,{'UserId':_0x89a8a7[_0xc598('0x11')]['UserId']})['catch'](function(_0x40ab93){logger['error'](_0xc598('0x3d'));});}}return _0xc1a5b0({'code':0xc8,'message':_0x89a8a7});}catch(_0x4de483){logger[_0xc598('0x33')](_0x4de483['stack']);return _0x292395(_0x389d0d[_0xc598('0x33')](0x1f4,_0x4de483));}}logger[_0xc598('0x33')](_0xc598('0x3e'));return _0x292395(_0x389d0d[_0xc598('0x33')](0x1f4,_0xc598('0x3e')));});},'RejectMessage':function(_0x94ebdc){var _0x362974=this;return new Promise(function(_0x3e2f38,_0x56590b){if(_0x94ebdc[_0xc598('0x35')]&&_0x94ebdc[_0xc598('0x35')]['id']){try{if(_0x3205d1['agents'][_0x94ebdc[_0xc598('0x35')]['id']]){_0x3205d1[_0xc598('0x36')][_0x94ebdc[_0xc598('0x35')]['id']][_0xc598('0x3f')]=![];_0x3205d1[_0xc598('0x36')][_0x94ebdc[_0xc598('0x35')]['id']][_0xc598('0x37')]=undefined;}return _0x3e2f38({'code':0xc8,'message':_0x94ebdc});}catch(_0x1e219a){logger[_0xc598('0x33')](_0x1e219a['stack']);return _0x56590b(_0x362974[_0xc598('0x33')](0x1f4,_0x1e219a));}}logger[_0xc598('0x33')](_0xc598('0x3e'));return _0x56590b(_0x362974[_0xc598('0x33')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x30d415){var _0x2eefb1=this;return new Promise(function(_0x1f6ddb,_0x569538){if(_0x30d415[_0xc598('0x38')]&&_0x30d415[_0xc598('0x12')]&&_0x30d415[_0xc598('0x12')]['id']){try{var _0x14e0e6=getId(_0x30d415[_0xc598('0x38')],_0x30d415[_0xc598('0x11')]?_0x30d415[_0xc598('0x11')]['id']:0x0,_0x30d415[_0xc598('0x12')]?_0x30d415['interaction']['id']:0x0);if(_0x3205d1[_0xc598('0x10')][_0x14e0e6]){_0x3205d1[_0xc598('0x10')][_0x14e0e6]['emit']('end');}return _0x1f6ddb({'code':0xc8,'message':_0x30d415});}catch(_0x3ef856){logger[_0xc598('0x33')](_0x3ef856[_0xc598('0x32')]);return _0x569538(_0x2eefb1['error'](0x1f4,_0x3ef856));}}logger['error'](_0xc598('0x3e'));return _0x569538(_0x2eefb1[_0xc598('0x33')](0x1f4,_0xc598('0x3e')));});},'AgentCapacity':function(_0x29f07a){var _0x253ac8=this;return new Promise(function(_0x4f9ddc,_0x49e9e9){if(_0x3205d1[_0xc598('0x36')][_0xc598('0x40')](_0x29f07a['id'])){for(var _0x78d466 in _0x29f07a[_0xc598('0x41')]){if(_0x29f07a[_0xc598('0x41')][_0xc598('0x40')](_0x78d466)){if(_0x3205d1[_0xc598('0x36')][_0x29f07a['id']][_0xc598('0x40')](_0x78d466+_0xc598('0x42'))){_0x3205d1[_0xc598('0x36')][_0x29f07a['id']][_0x78d466+_0xc598('0x42')]=parseInt(_0x29f07a[_0xc598('0x41')][_0x78d466],0xa);}}}_0x3205d1[_0xc598('0x36')][_0x29f07a['id']]['updateRealtime']();return _0x4f9ddc({'code':0xc8,'message':_0x3205d1['agents'][_0x29f07a['id']]});}else{return _0x49e9e9(_0x253ac8[_0xc598('0x33')](0x1f4,_0xc598('0x43')));}});},'Agents':function(_0x4a081c){return new Promise(function(_0x50554b,_0x4345f1){var _0x26053d=_['values'](_0x3205d1[_0xc598('0x36')]);_0x50554b({'count':_0x26053d['length'],'rows':_0x26053d});});},'ChatQueues':function(_0x4b7ecf){return new Promise(function(_0x5a39d6,_0x3cf9bd){var _0x3677fe=[];for(var _0x2ccdcf in _0x3205d1[_0xc598('0x44')]){if(_0x3205d1[_0xc598('0x44')]['hasOwnProperty'](_0x2ccdcf)){var _0x387214=_0x3205d1[_0xc598('0x44')][_0x2ccdcf];var _0x1c3108={'id':_0x387214['id'],'available':_0x387214[_0xc598('0x45')],'loggedIn':_0x387214[_0xc598('0x46')],'name':_0x387214[_0xc598('0x47')],'paused':_0x387214['paused'],'waiting':_0x387214[_0xc598('0x48')]};_0x3677fe[_0xc598('0x1e')](_0x1c3108);}}_0x5a39d6({'count':_0x3677fe[_0xc598('0x15')],'rows':_0x3677fe});});},'MailQueues':function(_0x24d146){return new Promise(function(_0x415a7e,_0x5c034d){var _0x1557fa=[];for(var _0x51d6d0 in _0x3205d1['mailQueues']){if(_0x3205d1[_0xc598('0x49')][_0xc598('0x40')](_0x51d6d0)){var _0x654bdf=_0x3205d1['mailQueues'][_0x51d6d0];var _0x5e48cc={'id':_0x654bdf['id'],'available':_0x654bdf[_0xc598('0x45')],'loggedIn':_0x654bdf[_0xc598('0x46')],'name':_0x654bdf['name'],'paused':_0x654bdf[_0xc598('0x4a')],'waiting':_0x654bdf[_0xc598('0x48')]};_0x1557fa[_0xc598('0x1e')](_0x5e48cc);}}_0x415a7e({'count':_0x1557fa[_0xc598('0x15')],'rows':_0x1557fa});});},'OpenchannelQueues':function(_0x1d8bdb){return new Promise(function(_0x4f5368,_0x2d5554){var _0x134037=[];for(var _0x2e1a81 in _0x3205d1['openchannelQueues']){if(_0x3205d1['openchannelQueues'][_0xc598('0x40')](_0x2e1a81)){var _0x3828e3=_0x3205d1['openchannelQueues'][_0x2e1a81];var _0x38a696={'id':_0x3828e3['id'],'available':_0x3828e3['available'],'loggedIn':_0x3828e3[_0xc598('0x46')],'name':_0x3828e3[_0xc598('0x47')],'paused':_0x3828e3[_0xc598('0x4a')],'waiting':_0x3828e3[_0xc598('0x48')]};_0x134037['push'](_0x38a696);}}_0x4f5368({'count':_0x134037[_0xc598('0x15')],'rows':_0x134037});});},'SmsQueues':function(_0x1b9498){return new Promise(function(_0x2b11a7,_0x311ab0){var _0x4cc87f=[];for(var _0x3e97e4 in _0x3205d1[_0xc598('0x4b')]){if(_0x3205d1[_0xc598('0x4b')][_0xc598('0x40')](_0x3e97e4)){var _0x3a98a9=_0x3205d1['smsQueues'][_0x3e97e4];var _0xf69d1f={'id':_0x3a98a9['id'],'available':_0x3a98a9['available'],'loggedIn':_0x3a98a9[_0xc598('0x46')],'name':_0x3a98a9['name'],'paused':_0x3a98a9[_0xc598('0x4a')],'waiting':_0x3a98a9[_0xc598('0x48')]};_0x4cc87f[_0xc598('0x1e')](_0xf69d1f);}}_0x2b11a7({'count':_0x4cc87f[_0xc598('0x15')],'rows':_0x4cc87f});});},'FaxQueues':function(_0x505c02){return new Promise(function(_0x39aa5f,_0x4bc973){var _0x592886=[];for(var _0x32ac50 in _0x3205d1['faxQueues']){if(_0x3205d1[_0xc598('0x4c')][_0xc598('0x40')](_0x32ac50)){var _0x1c3c2e=_0x3205d1[_0xc598('0x4c')][_0x32ac50];var _0x14ef56={'id':_0x1c3c2e['id'],'available':_0x1c3c2e[_0xc598('0x45')],'loggedIn':_0x1c3c2e['loggedIn'],'name':_0x1c3c2e['name'],'paused':_0x1c3c2e[_0xc598('0x4a')],'waiting':_0x1c3c2e['waiting']};_0x592886[_0xc598('0x1e')](_0x14ef56);}}_0x39aa5f({'count':_0x592886[_0xc598('0x15')],'rows':_0x592886});});},'WhatsappQueues':function(_0x55604d){return new Promise(function(_0x3944fa,_0x4bb379){var _0x222524=[];for(var _0x1188ed in _0x3205d1['whatsappQueues']){if(_0x3205d1[_0xc598('0x4d')][_0xc598('0x40')](_0x1188ed)){var _0xa0316d=_0x3205d1['whatsappQueues'][_0x1188ed];var _0x5cab33={'id':_0xa0316d['id'],'available':_0xa0316d[_0xc598('0x45')],'loggedIn':_0xa0316d[_0xc598('0x46')],'name':_0xa0316d[_0xc598('0x47')],'paused':_0xa0316d['paused'],'waiting':_0xa0316d['waiting']};_0x222524['push'](_0x5cab33);}}_0x3944fa({'count':_0x222524[_0xc598('0x15')],'rows':_0x222524});});},'ChatQueuesWaitingInteractions':function(_0x4846c2){return new Promise(function(_0x42d8b9,_0x378500){var _0x4b3c33=_[_0xc598('0x4e')](_0x3205d1[_0xc598('0x4f')]);_0x42d8b9({'count':_0x4b3c33[_0xc598('0x15')],'rows':_0x4b3c33});});},'MailQueuesWaitingInteractions':function(_0x2c1835){return new Promise(function(_0x307658,_0xbd523){var _0x1c10b7=_['values'](_0x3205d1[_0xc598('0x50')]);_0x307658({'count':_0x1c10b7['length'],'rows':_0x1c10b7});});},'OpenchannelQueuesWaitingInteractions':function(_0x5a9186){return new Promise(function(_0x17ed67,_0x381050){var _0x4efb10=_[_0xc598('0x4e')](_0x3205d1[_0xc598('0x51')]);_0x17ed67({'count':_0x4efb10['length'],'rows':_0x4efb10});});},'SmsQueuesWaitingInteractions':function(_0x284247){return new Promise(function(_0x239248,_0x53f37d){var _0x5a84b0=_[_0xc598('0x4e')](_0x3205d1[_0xc598('0x52')]);_0x239248({'count':_0x5a84b0[_0xc598('0x15')],'rows':_0x5a84b0});});},'FaxQueuesWaitingInteractions':function(_0x9c8307){return new Promise(function(_0x4a6caf,_0x5c88d6){var _0x110ebe=_['values'](_0x3205d1[_0xc598('0x53')]);_0x4a6caf({'count':_0x110ebe['length'],'rows':_0x110ebe});});},'WhatsappQueuesWaitingInteractions':function(_0x51b432){return new Promise(function(_0x1e5e30,_0xb0081e){var _0x2c1fcd=_['values'](_0x3205d1[_0xc598('0x54')]);_0x1e5e30({'count':_0x2c1fcd[_0xc598('0x15')],'rows':_0x2c1fcd});});}};var _0x5289ab=jayson[_0xc598('0x55')](_0x75fa5e)[_0xc598('0x56')]();_0x5289ab['on'](_0xc598('0x33'),function(_0xccb55b){logger[_0xc598('0x33')](JSON[_0xc598('0x57')](_0xccb55b));return _0x12e187(_0xccb55b);});_0x5289ab[_0xc598('0xf')](0x232c,_0xc598('0x58'),function(){console[_0xc598('0x59')](_0xc598('0x5a'),0x232c);return _0xf58f90(_0xc598('0x5b')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index d5c7fd5..ee303e3 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 _0x237c=['when','log','join','\x20|\x20','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','iftime\x20%s','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0x237c,0x109));var _0xc237=function(_0x31c319,_0x23bcd6){_0x31c319=_0x31c319-0x0;var _0x5bb85b=_0x237c[_0x31c319];return _0x5bb85b;};'use strict';var util=require(_0xc237('0x0'));var BPromise=require(_0xc237('0x1'));var jayson=require(_0xc237('0x2'));var _=require(_0xc237('0x3'));var logger=require(_0xc237('0x4'))(_0xc237('0x5'));var client=jayson[_0xc237('0x6')][_0xc237('0x7')]({'port':0x232a});function request(_0x38d70d,_0x57ecf1){return new BPromise(function(_0x25dd49,_0x33b7b1){return client[_0xc237('0x8')](_0x38d70d,_0x57ecf1)[_0xc237('0x9')](function(_0x42cce1){if(_0x42cce1[_0xc237('0xa')]){return _0x33b7b1(_0x42cce1['error'][_0xc237('0xb')]);}else{return _0x25dd49(_0x42cce1[_0xc237('0xc')]);}})[_0xc237('0xd')](function(_0x28fcf9){return _0x33b7b1(_0x28fcf9);});});}exports[_0xc237('0xe')]=function(_0x28cacc,_0x44e3da,_0x4f4212){return function(_0x16e1a0){if(_0x4f4212[_0xc237('0xf')]&&!_0x4f4212['rules'][_0x28cacc]){logger[_0xc237('0x10')](_0xc237('0x11'),_0x28cacc);return _0x16e1a0['stop']();}var _0x15326d=[];for(var _0x4edd58=0x0;_0x4edd58<_0x44e3da[_0xc237('0x12')];_0x4edd58+=0x1){_0x15326d[_0xc237('0x13')](request('Command',{'command':util['format'](_0xc237('0x14'),_0x44e3da[_0x4edd58])})[_0xc237('0x9')](function(_0x7bc7f3){return _0x7bc7f3&&_0x7bc7f3['message']&&_0x7bc7f3[_0xc237('0xb')]['indexOf'](_0xc237('0x15'))>=0x0?!![]:![];})['catch'](function(_0x1e59ae){logger['error'](_0xc237('0x16'),_0x28cacc,_0x44e3da[_0x4edd58]);}));}BPromise[_0xc237('0x17')](_0x15326d)[_0xc237('0x9')](function(_0x26320f){var _0x5dfb2c=_['some'](_0x26320f);logger[_0xc237('0x10')](_0xc237('0x18'),_0x28cacc,_0x44e3da['join']('\x20|\x20'),_0x5dfb2c);_0x16e1a0[_0xc237('0x19')](_0x5dfb2c);})[_0xc237('0xd')](function(_0x59c4cb){console[_0xc237('0x1a')](_0x59c4cb);logger[_0xc237('0xa')](_0xc237('0x18'),_0x28cacc,_0x44e3da[_0xc237('0x1b')](_0xc237('0x1c')),_0x59c4cb['stack']);_0x16e1a0['stop']();});};}; \ No newline at end of file +var _0x719b=['iftime\x20%s','true','[%s][INTERVAL]\x20%s','then','some','[%s][INTERVAL]\x20%s\x20%s','when','log','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','client','request','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format'];(function(_0x557c42,_0x158914){var _0x195efa=function(_0x5e7c49){while(--_0x5e7c49){_0x557c42['push'](_0x557c42['shift']());}};_0x195efa(++_0x158914);}(_0x719b,0x105));var _0xb719=function(_0x12ec50,_0x5c868a){_0x12ec50=_0x12ec50-0x0;var _0x32dd5e=_0x719b[_0x12ec50];return _0x32dd5e;};'use strict';var util=require(_0xb719('0x0'));var BPromise=require(_0xb719('0x1'));var jayson=require(_0xb719('0x2'));var _=require(_0xb719('0x3'));var logger=require(_0xb719('0x4'))('routing');var client=jayson[_0xb719('0x5')]['http']({'port':0x232a});function request(_0x133fb4,_0x4b57c5){return new BPromise(function(_0x3e489b,_0x481034){return client[_0xb719('0x6')](_0x133fb4,_0x4b57c5)['then'](function(_0x5820bd){if(_0x5820bd[_0xb719('0x7')]){return _0x481034(_0x5820bd[_0xb719('0x7')][_0xb719('0x8')]);}else{return _0x3e489b(_0x5820bd[_0xb719('0x9')]);}})[_0xb719('0xa')](function(_0x297eb1){return _0x481034(_0x297eb1);});});}exports[_0xb719('0xb')]=function(_0x565724,_0x11a8dc,_0x23170e){return function(_0x2c0ca8){if(_0x23170e['rules']&&!_0x23170e[_0xb719('0xc')][_0x565724]){logger[_0xb719('0xd')](_0xb719('0xe'),_0x565724);return _0x2c0ca8[_0xb719('0xf')]();}var _0xaedbc5=[];for(var _0x24c2aa=0x0;_0x24c2aa<_0x11a8dc[_0xb719('0x10')];_0x24c2aa+=0x1){_0xaedbc5[_0xb719('0x11')](request('Command',{'command':util[_0xb719('0x12')](_0xb719('0x13'),_0x11a8dc[_0x24c2aa])})['then'](function(_0x2bae8b){return _0x2bae8b&&_0x2bae8b[_0xb719('0x8')]&&_0x2bae8b['message']['indexOf'](_0xb719('0x14'))>=0x0?!![]:![];})[_0xb719('0xa')](function(_0x151342){logger[_0xb719('0x7')](_0xb719('0x15'),_0x565724,_0x11a8dc[_0x24c2aa]);}));}BPromise['all'](_0xaedbc5)[_0xb719('0x16')](function(_0x14c0fe){var _0x564e5c=_[_0xb719('0x17')](_0x14c0fe);logger[_0xb719('0xd')](_0xb719('0x18'),_0x565724,_0x11a8dc['join']('\x20|\x20'),_0x564e5c);_0x2c0ca8[_0xb719('0x19')](_0x564e5c);})[_0xb719('0xa')](function(_0x12eaff){console[_0xb719('0x1a')](_0x12eaff);logger[_0xb719('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x565724,_0x11a8dc['join']('\x20|\x20'),_0x12eaff[_0xb719('0x1b')]);_0x2c0ca8['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 07b252f..1e13add 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 _0x0713=['cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','./utils','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','destuniqueid','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','forIn','includes','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','[%s][agents][agentcomplete]','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]'];(function(_0x1aea01,_0x738e1a){var _0x3ead21=function(_0x3a39fb){while(--_0x3a39fb){_0x1aea01['push'](_0x1aea01['shift']());}};_0x3ead21(++_0x738e1a);}(_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 utils=require(_0x3071('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2afa91,_0x27405a){utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2afa91[_0x3071('0x3')],_0x2afa91[_0x3071('0x4')],_0x2afa91[_0x3071('0x5')],_0x2afa91[_0x3071('0x6')],_0x2afa91[_0x3071('0x7')],_0x2afa91[_0x3071('0x8')],_0x2afa91[_0x3071('0x9')],_0x2afa91[_0x3071('0xa')]));if(_0x2afa91[_0x3071('0x5')]){utils[_0x3071('0xb')](_0x2afa91[_0x3071('0x5')])[_0x3071('0xc')](function(_0x1a868e){if(_0x1a868e){_0x2afa91['type']=_0x1a868e[_0x3071('0xd')];_0x2afa91[_0x3071('0xe')]=_0x2afa91[_0x3071('0xf')]?_0x1a868e[_0x3071('0x10')]:![];_0x2afa91[_0x3071('0x11')]=_0x2afa91['agentacw']?_0x1a868e[_0x3071('0x12')]:0x0;}utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);});}else{utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);}if(_0x27405a){delete transfers[_0x2afa91['uniqueid']];}else{delete agents[_0x2afa91['destuniqueid']];}}exports[_0x3071('0x15')]=function(_0x5dc13b){try{utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][agentcalled]',_0x5dc13b[_0x3071('0x3')]),_0x5dc13b);agents[_0x5dc13b['destuniqueid']]=_0x5dc13b;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x18')]=utils[_0x3071('0x19')]();agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x1a');agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x9')]=null;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x1b')]=null;utils['info'](util[_0x3071('0x2')](_0x3071('0x1c'),_0x5dc13b[_0x3071('0x3')],agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x6')],_0x5dc13b[_0x3071('0x17')]));}catch(_0x105bbb){utils[_0x3071('0x1d')](util['format'](_0x3071('0x1e'),_0x5dc13b[_0x3071('0x3')]),_0x105bbb);}};exports[_0x3071('0x1f')]=function(_0x56c267){try{if(!_[_0x3071('0x20')](agents[_0x56c267['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x56c267);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x22'),_0x56c267[_0x3071('0x3')],agents[_0x56c267['destuniqueid']]['membername'],_0x56c267[_0x3071('0x17')]));agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x1f')]=!![];agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x23')]=utils[_0x3071('0x19')]();agents[_0x56c267[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x24');agents[_0x56c267['destuniqueid']][_0x3071('0x25')]=_0x3071('0x24');agents[_0x56c267[_0x3071('0x17')]]['holdtime']=_0x56c267[_0x3071('0x26')]?parseInt(_0x56c267[_0x3071('0x26')])/0x3e8:0x0;agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x27')]=0x0;unanswered[_0x3071('0x28')](_0x56c267[_0x3071('0x17')]);}}catch(_0x177b5f){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x177b5f);}};exports['queuecallerabandon']=function(_0x4f1484){try{_[_0x3071('0x29')](agents,function(_0x149e0d,_0x6ddf96){if(_0x149e0d[_0x3071('0x3')]==_0x4f1484[_0x3071('0x3')]&&!_[_0x3071('0x2a')](unanswered,_0x149e0d[_0x3071('0x17')])){utils[_0x3071('0x16')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484['uniqueid']),_0x4f1484);utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4f1484[_0x3071('0x3')],_0x149e0d[_0x3071('0x6')],_0x149e0d[_0x3071('0x17')]));_0x149e0d[_0x3071('0x1f')]=!![];_0x149e0d['agentringnoanswerAt']=utils[_0x3071('0x19')]();_0x149e0d[_0x3071('0xa')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x25')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x2c')]=_0x4f1484[_0x3071('0x2c')];_0x149e0d[_0x3071('0x27')]=0x0;writeDB(_0x149e0d);}});}catch(_0x596cc3){utils[_0x3071('0x1d')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484[_0x3071('0x3')]),_0x596cc3);}};exports[_0x3071('0x2d')]=function(_0x54d9c3){try{if(agents[_0x54d9c3[_0x3071('0x17')]]){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x54d9c3);utils[_0x3071('0x1')](util['format'](_0x3071('0x2f'),_0x54d9c3[_0x3071('0x3')],agents[_0x54d9c3['destuniqueid']][_0x3071('0x6')],_0x54d9c3['destuniqueid']));agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0x30')]=utils['now']();agents[_0x54d9c3['destuniqueid']][_0x3071('0x9')]=_0x54d9c3[_0x3071('0x9')];agents[_0x54d9c3[_0x3071('0x17')]]['connectedlinename']=_0x54d9c3[_0x3071('0x1b')];agents[_0x54d9c3['destuniqueid']][_0x3071('0x2c')]=_0x54d9c3['ringtime'];agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x31');_[_0x3071('0x29')](agents,function(_0x30ab68,_0x593c9c){if(_0x30ab68['destuniqueid']!=_0x54d9c3[_0x3071('0x17')]&&_0x30ab68[_0x3071('0x3')]==_0x54d9c3[_0x3071('0x3')]){_0x30ab68[_0x3071('0x27')]=0x0;_0x30ab68['holdtime']=_0x54d9c3[_0x3071('0x26')];_0x30ab68[_0x3071('0x1f')]=!![];_0x30ab68[_0x3071('0x23')]=utils[_0x3071('0x19')]();_0x30ab68[_0x3071('0xa')]=_0x3071('0x32');_0x30ab68['reason']=_0x3071('0x32');_0x30ab68['answeredelsewheredestinationuniqueid']=_0x54d9c3['destuniqueid'];_0x30ab68['answeredelsewheremembername']=_0x54d9c3['membername'];writeDB(_0x30ab68);}});}}catch(_0x2992e6){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x2992e6);}};exports[_0x3071('0xf')]=function(_0xa711b5){try{if(!_[_0x3071('0x20')](agents[_0xa711b5['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x33'),_0xa711b5[_0x3071('0x3')]),_0xa711b5);utils[_0x3071('0x1')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xa711b5[_0x3071('0x3')],agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x6')],_0xa711b5[_0x3071('0x17')]));agents[_0xa711b5[_0x3071('0x17')]]['agentcomplete']=!![];agents[_0xa711b5[_0x3071('0x17')]]['agentcompleteAt']=utils[_0x3071('0x19')]();agents[_0xa711b5['destuniqueid']]['talktime']=utils[_0x3071('0x34')](agents[_0xa711b5['destuniqueid']][_0x3071('0x35')],agents[_0xa711b5['destuniqueid']][_0x3071('0x30')]);agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x25')]=_0xa711b5[_0x3071('0x25')];agents[_0xa711b5['destuniqueid']][_0x3071('0xa')]='complete';writeDB(agents[_0xa711b5[_0x3071('0x17')]]);}}catch(_0x4b6bbb){utils[_0x3071('0x1d')](util[_0x3071('0x2')]('[%s][agents][agentcomplete]',_0xa711b5[_0x3071('0x3')]),_0x4b6bbb);}};exports[_0x3071('0x36')]=function(_0x224a70){try{if(!_[_0x3071('0x20')](agents[_0x224a70[_0x3071('0x37')]])){utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x224a70);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x38'),_0x224a70['uniqueid'],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x6')],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')]));agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x39')]=!![];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3a')]=_0x3071('0x3b');agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3c')]=_0x224a70[_0x3071('0x3d')];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3e')]=agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')];}}catch(_0x596cdd){utils['error'](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x596cdd);}};exports[_0x3071('0x3f')]=function(_0x15c6f8){try{utils['debug'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x15c6f8);if(_0x15c6f8['origtransfereruniqueid']==_0x15c6f8[_0x3071('0x41')]){if(!_[_0x3071('0x20')](agents[_0x15c6f8[_0x3071('0x42')]])){utils[_0x3071('0x1')](util['format'](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x42')]]['transfer']=!![];agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3a')]=_0x3071('0x45');agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x46')];agents[_0x15c6f8[_0x3071('0x42')]]['transferuniqueid']=_0x15c6f8['origtransfereruniqueid'];}if(_0x15c6f8[_0x3071('0x47')]&&agents[_0x15c6f8['transfereeuniqueid']]){agents[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x1;transfers[_0x15c6f8['transfereeuniqueid']]=_[_0x3071('0x49')](agents[_0x15c6f8[_0x3071('0x47')]]);transfers[_0x15c6f8['transfereeuniqueid']][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x8')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x4a')]=agents[_0x15c6f8['secondtransfereruniqueid']][_0x3071('0x4a')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x18')]=utils['now']();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x2;}}else if(_0x15c6f8[_0x3071('0x42')]==_0x15c6f8[_0x3071('0x4b')]){if(!_['isNil'](agents[_0x15c6f8[_0x3071('0x44')]])){utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x39')]=!![];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3a')]='ATTENDED';agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x4c')];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3e')]=_0x15c6f8[_0x3071('0x42')];}if(_0x15c6f8[_0x3071('0x4d')]&&agents[_0x15c6f8[_0x3071('0x4d')]]){agents[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x48')]=0x1;transfers[_0x15c6f8[_0x3071('0x4d')]]=_['clone'](agents[_0x15c6f8['transfertargetuniqueid']]);transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x8')];transfers[_0x15c6f8['transfertargetuniqueid']]['calleridname']=agents[_0x15c6f8[_0x3071('0x44')]]['calleridname'];transfers[_0x15c6f8['transfertargetuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x48')]=0x2;}}}catch(_0x19a03d){utils['error'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x19a03d);}};exports[_0x3071('0x4e')]=function(_0x29ee70){try{utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70[_0x3071('0x3')]),_0x29ee70);if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']]['reason']===_0x3071('0x24')){if(_0x29ee70[_0x3071('0x50')]==='21'){agents[_0x29ee70[_0x3071('0x3')]]['reason']='rejected';agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x51');}utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]]['membername'],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);var _0x2fbac7=unanswered[_0x3071('0x53')](_0x29ee70[_0x3071('0x3')]);if(_0x2fbac7>-0x1){unanswered[_0x3071('0x54')](_0x2fbac7,0x1);}}if(transfers[_0x29ee70[_0x3071('0x3')]]){transfers[_0x29ee70['uniqueid']][_0x3071('0xf')]=!![];transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils['now']();transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](transfers[_0x29ee70['uniqueid']]['agentcompleteAt'],transfers[_0x29ee70[_0x3071('0x3')]]['agentconnectAt']);transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')]=_0x3071('0x55');transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x56');utils[_0x3071('0x1')](util['format'](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(transfers[_0x29ee70['uniqueid']],!![]);}if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']][_0x3071('0x30')]){agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xf')]=!![];agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils[_0x3071('0x19')]();agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](agents[_0x29ee70[_0x3071('0x3')]]['agentcompleteAt'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x30')]);agents[_0x29ee70['uniqueid']][_0x3071('0x25')]=agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x39')]?_0x3071('0x39'):_0x3071('0x55');agents[_0x29ee70['uniqueid']]['lastevent']=_0x3071('0x56');utils['info'](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);}}catch(_0x291bb9){utils['error'](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70['uniqueid']),_0x291bb9);}}; \ No newline at end of file +var _0xfe57=['agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','holdtime','agentconnect','connectedlinename','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','splice','agent','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','type','agentcomplete','acw','agentacw','CreateVoiceAgentReport','request','agentcalled','destuniqueid','agentcalledAt','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error'];(function(_0x563ee7,_0x403565){var _0x331b51=function(_0x4a0a80){while(--_0x4a0a80){_0x563ee7['push'](_0x563ee7['shift']());}};_0x331b51(++_0x403565);}(_0xfe57,0x195));var _0x7fe5=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xfe57[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x7fe5('0x0'));var util=require(_0x7fe5('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x581f71,_0x3f7dca){utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x4'),_0x581f71[_0x7fe5('0x5')],_0x581f71[_0x7fe5('0x6')],_0x581f71[_0x7fe5('0x7')],_0x581f71[_0x7fe5('0x8')],_0x581f71[_0x7fe5('0x9')],_0x581f71[_0x7fe5('0xa')],_0x581f71[_0x7fe5('0xb')],_0x581f71[_0x7fe5('0xc')]));if(_0x581f71[_0x7fe5('0x7')]){utils['getVoiceQueueByName'](_0x581f71[_0x7fe5('0x7')])['then'](function(_0x3564f1){if(_0x3564f1){_0x581f71[_0x7fe5('0xd')]=_0x3564f1['type'];_0x581f71['agentacw']=_0x581f71[_0x7fe5('0xe')]?_0x3564f1[_0x7fe5('0xf')]:![];_0x581f71['acwtime']=_0x581f71[_0x7fe5('0x10')]?_0x3564f1['acwTimeout']:0x0;}utils['request'](_0x7fe5('0x11'),_0x581f71);});}else{utils[_0x7fe5('0x12')](_0x7fe5('0x11'),_0x581f71);}if(_0x3f7dca){delete transfers[_0x581f71[_0x7fe5('0x5')]];}else{delete agents[_0x581f71['destuniqueid']];}}exports[_0x7fe5('0x13')]=function(_0x16bed9){try{utils['debug'](util[_0x7fe5('0x3')]('[%s][agents][agentcalled]',_0x16bed9[_0x7fe5('0x5')]),_0x16bed9);agents[_0x16bed9[_0x7fe5('0x14')]]=_0x16bed9;agents[_0x16bed9['destuniqueid']][_0x7fe5('0x15')]=utils['now']();agents[_0x16bed9[_0x7fe5('0x14')]][_0x7fe5('0xc')]=_0x7fe5('0x16');agents[_0x16bed9[_0x7fe5('0x14')]][_0x7fe5('0xb')]=null;agents[_0x16bed9[_0x7fe5('0x14')]]['connectedlinename']=null;utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x17'),_0x16bed9[_0x7fe5('0x5')],agents[_0x16bed9[_0x7fe5('0x14')]][_0x7fe5('0x8')],_0x16bed9[_0x7fe5('0x14')]));}catch(_0x29b0bd){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')]('[%s][agents][agentcalled]',_0x16bed9['uniqueid']),_0x29b0bd);}};exports[_0x7fe5('0x19')]=function(_0x459c2d){try{if(!_[_0x7fe5('0x1a')](agents[_0x459c2d[_0x7fe5('0x14')]])){utils[_0x7fe5('0x1b')](util[_0x7fe5('0x3')](_0x7fe5('0x1c'),_0x459c2d[_0x7fe5('0x5')]),_0x459c2d);utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x1d'),_0x459c2d[_0x7fe5('0x5')],agents[_0x459c2d['destuniqueid']][_0x7fe5('0x8')],_0x459c2d[_0x7fe5('0x14')]));agents[_0x459c2d[_0x7fe5('0x14')]]['agentringnoanswer']=!![];agents[_0x459c2d[_0x7fe5('0x14')]]['agentringnoanswerAt']=utils[_0x7fe5('0x1e')]();agents[_0x459c2d['destuniqueid']][_0x7fe5('0xc')]=_0x7fe5('0x1f');agents[_0x459c2d[_0x7fe5('0x14')]][_0x7fe5('0x20')]=_0x7fe5('0x1f');agents[_0x459c2d[_0x7fe5('0x14')]]['holdtime']=_0x459c2d['ringtime']?parseInt(_0x459c2d[_0x7fe5('0x21')])/0x3e8:0x0;agents[_0x459c2d[_0x7fe5('0x14')]][_0x7fe5('0x22')]=0x0;unanswered[_0x7fe5('0x23')](_0x459c2d['destuniqueid']);}}catch(_0x46f816){utils['error'](util[_0x7fe5('0x3')](_0x7fe5('0x1c'),_0x459c2d[_0x7fe5('0x5')]),_0x46f816);}};exports[_0x7fe5('0x24')]=function(_0x1f8572){try{_[_0x7fe5('0x25')](agents,function(_0x5c07f0,_0xe521c6){if(_0x5c07f0[_0x7fe5('0x5')]==_0x1f8572['uniqueid']&&!_[_0x7fe5('0x26')](unanswered,_0x5c07f0[_0x7fe5('0x14')])){utils[_0x7fe5('0x1b')](util[_0x7fe5('0x3')](_0x7fe5('0x27'),_0x1f8572['uniqueid']),_0x1f8572);utils['info'](util[_0x7fe5('0x3')](_0x7fe5('0x28'),_0x1f8572[_0x7fe5('0x5')],_0x5c07f0[_0x7fe5('0x8')],_0x5c07f0['destuniqueid']));_0x5c07f0[_0x7fe5('0x19')]=!![];_0x5c07f0[_0x7fe5('0x29')]=utils[_0x7fe5('0x1e')]();_0x5c07f0[_0x7fe5('0xc')]=_0x7fe5('0x2a');_0x5c07f0[_0x7fe5('0x20')]='abandoned';_0x5c07f0[_0x7fe5('0x2b')]=_0x1f8572[_0x7fe5('0x2b')];_0x5c07f0[_0x7fe5('0x22')]=0x0;writeDB(_0x5c07f0);}});}catch(_0x39cfe9){utils['error'](util['format'](_0x7fe5('0x27'),_0x1f8572['uniqueid']),_0x39cfe9);}};exports[_0x7fe5('0x2c')]=function(_0x513680){try{if(agents[_0x513680[_0x7fe5('0x14')]]){utils['debug'](util['format']('[%s][agents][agentconnect]',_0x513680['uniqueid']),_0x513680);utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x513680[_0x7fe5('0x5')],agents[_0x513680[_0x7fe5('0x14')]]['membername'],_0x513680[_0x7fe5('0x14')]));agents[_0x513680['destuniqueid']]['agentconnectAt']=utils[_0x7fe5('0x1e')]();agents[_0x513680[_0x7fe5('0x14')]][_0x7fe5('0xb')]=_0x513680[_0x7fe5('0xb')];agents[_0x513680[_0x7fe5('0x14')]]['connectedlinename']=_0x513680[_0x7fe5('0x2d')];agents[_0x513680[_0x7fe5('0x14')]]['holdtime']=_0x513680[_0x7fe5('0x21')];agents[_0x513680[_0x7fe5('0x14')]][_0x7fe5('0xc')]=_0x7fe5('0x2e');_[_0x7fe5('0x25')](agents,function(_0x1c81c8,_0x1a14e3){if(_0x1c81c8['destuniqueid']!=_0x513680['destuniqueid']&&_0x1c81c8[_0x7fe5('0x5')]==_0x513680['uniqueid']){_0x1c81c8[_0x7fe5('0x22')]=0x0;_0x1c81c8[_0x7fe5('0x2b')]=_0x513680['ringtime'];_0x1c81c8[_0x7fe5('0x19')]=!![];_0x1c81c8[_0x7fe5('0x29')]=utils[_0x7fe5('0x1e')]();_0x1c81c8[_0x7fe5('0xc')]=_0x7fe5('0x2f');_0x1c81c8[_0x7fe5('0x20')]=_0x7fe5('0x2f');_0x1c81c8['answeredelsewheredestinationuniqueid']=_0x513680['destuniqueid'];_0x1c81c8[_0x7fe5('0x30')]=_0x513680['membername'];writeDB(_0x1c81c8);}});}}catch(_0xad0b05){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')](_0x7fe5('0x31'),_0x513680['uniqueid']),_0xad0b05);}};exports[_0x7fe5('0xe')]=function(_0x5439bc){try{if(!_['isNil'](agents[_0x5439bc[_0x7fe5('0x14')]])){utils[_0x7fe5('0x1b')](util['format'](_0x7fe5('0x32'),_0x5439bc[_0x7fe5('0x5')]),_0x5439bc);utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x33'),_0x5439bc['uniqueid'],agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x8')],_0x5439bc['destuniqueid']));agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0xe')]=!![];agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x34')]=utils['now']();agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x22')]=utils[_0x7fe5('0x35')](agents[_0x5439bc['destuniqueid']][_0x7fe5('0x34')],agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x36')]);agents[_0x5439bc['destuniqueid']][_0x7fe5('0x20')]=_0x5439bc[_0x7fe5('0x20')];agents[_0x5439bc[_0x7fe5('0x14')]]['lastevent']=_0x7fe5('0x37');writeDB(agents[_0x5439bc[_0x7fe5('0x14')]]);}}catch(_0x1ac93a){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')](_0x7fe5('0x32'),_0x5439bc[_0x7fe5('0x5')]),_0x1ac93a);}};exports[_0x7fe5('0x38')]=function(_0x446f01){try{if(!_[_0x7fe5('0x1a')](agents[_0x446f01[_0x7fe5('0x39')]])){utils['debug'](util['format']('[%s][agents][blindtransfer]',_0x446f01['uniqueid']),_0x446f01);utils[_0x7fe5('0x2')](util['format'](_0x7fe5('0x3a'),_0x446f01[_0x7fe5('0x5')],agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x8')],agents[_0x446f01[_0x7fe5('0x39')]]['uniqueid']));agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x3b')]=!![];agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x3c')]=_0x7fe5('0x3d');agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x3e')]=_0x446f01[_0x7fe5('0x3f')];agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x40')]=agents[_0x446f01['transfereruniqueid']][_0x7fe5('0x5')];}}catch(_0x401d05){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')](_0x7fe5('0x41'),_0x446f01[_0x7fe5('0x5')]),_0x401d05);}};exports['attendedtransfer']=function(_0x31a196){try{utils[_0x7fe5('0x1b')](util[_0x7fe5('0x3')](_0x7fe5('0x42'),_0x31a196[_0x7fe5('0x43')]),_0x31a196);if(_0x31a196[_0x7fe5('0x43')]==_0x31a196[_0x7fe5('0x44')]){if(!_['isNil'](agents[_0x31a196[_0x7fe5('0x45')]])){utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x46'),_0x31a196[_0x7fe5('0x43')],agents[_0x31a196['secondtransfereruniqueid']][_0x7fe5('0x8')]));agents[_0x31a196[_0x7fe5('0x45')]][_0x7fe5('0x3b')]=!![];agents[_0x31a196[_0x7fe5('0x45')]]['transfertype']=_0x7fe5('0x47');agents[_0x31a196[_0x7fe5('0x45')]][_0x7fe5('0x3e')]=_0x31a196[_0x7fe5('0x48')];agents[_0x31a196[_0x7fe5('0x45')]][_0x7fe5('0x40')]=_0x31a196[_0x7fe5('0x43')];}if(_0x31a196[_0x7fe5('0x49')]&&agents[_0x31a196[_0x7fe5('0x49')]]){agents[_0x31a196[_0x7fe5('0x49')]][_0x7fe5('0x4a')]=0x1;transfers[_0x31a196['transfereeuniqueid']]=_[_0x7fe5('0x4b')](agents[_0x31a196[_0x7fe5('0x49')]]);transfers[_0x31a196[_0x7fe5('0x49')]]['calleridnum']=agents[_0x31a196['secondtransfereruniqueid']][_0x7fe5('0xa')];transfers[_0x31a196['transfereeuniqueid']][_0x7fe5('0x4c')]=agents[_0x31a196[_0x7fe5('0x45')]]['calleridname'];transfers[_0x31a196[_0x7fe5('0x49')]]['agentcalledAt']=utils[_0x7fe5('0x1e')]();transfers[_0x31a196[_0x7fe5('0x49')]][_0x7fe5('0x36')]=utils[_0x7fe5('0x1e')]();transfers[_0x31a196[_0x7fe5('0x49')]][_0x7fe5('0x2b')]=0x0;transfers[_0x31a196['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x31a196[_0x7fe5('0x45')]==_0x31a196[_0x7fe5('0x4d')]){if(!_[_0x7fe5('0x1a')](agents[_0x31a196[_0x7fe5('0x43')]])){utils[_0x7fe5('0x2')](util['format'](_0x7fe5('0x46'),_0x31a196[_0x7fe5('0x43')],agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x8')]));agents[_0x31a196[_0x7fe5('0x43')]]['transfer']=!![];agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x3c')]=_0x7fe5('0x47');agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x3e')]=_0x31a196[_0x7fe5('0x4e')];agents[_0x31a196[_0x7fe5('0x43')]]['transferuniqueid']=_0x31a196[_0x7fe5('0x45')];}if(_0x31a196[_0x7fe5('0x4f')]&&agents[_0x31a196[_0x7fe5('0x4f')]]){agents[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x4a')]=0x1;transfers[_0x31a196[_0x7fe5('0x4f')]]=_[_0x7fe5('0x4b')](agents[_0x31a196['transfertargetuniqueid']]);transfers[_0x31a196['transfertargetuniqueid']][_0x7fe5('0xa')]=agents[_0x31a196['origtransfereruniqueid']][_0x7fe5('0xa')];transfers[_0x31a196['transfertargetuniqueid']][_0x7fe5('0x4c')]=agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x4c')];transfers[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x15')]=utils[_0x7fe5('0x1e')]();transfers[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x36')]=utils['now']();transfers[_0x31a196[_0x7fe5('0x4f')]]['holdtime']=0x0;transfers[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x4a')]=0x2;}}}catch(_0x36ac40){utils['error'](util[_0x7fe5('0x3')](_0x7fe5('0x42'),_0x31a196[_0x7fe5('0x43')]),_0x36ac40);}};exports[_0x7fe5('0x50')]=function(_0x31404b){try{utils[_0x7fe5('0x1b')](util['format'](_0x7fe5('0x51'),_0x31404b[_0x7fe5('0x5')]),_0x31404b);if(agents[_0x31404b['uniqueid']]&&agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')]==='timeout'){if(_0x31404b[_0x7fe5('0x52')]==='21'){agents[_0x31404b['uniqueid']][_0x7fe5('0x20')]=_0x7fe5('0x53');agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xc')]=_0x7fe5('0x53');}utils['info'](util[_0x7fe5('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31404b[_0x7fe5('0x5')],agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x8')],agents[_0x31404b[_0x7fe5('0x5')]]['reason'],agents[_0x31404b[_0x7fe5('0x5')]]['lastevent']));writeDB(agents[_0x31404b[_0x7fe5('0x5')]]);var _0x2e3b94=unanswered['indexOf'](_0x31404b[_0x7fe5('0x5')]);if(_0x2e3b94>-0x1){unanswered[_0x7fe5('0x54')](_0x2e3b94,0x1);}}if(transfers[_0x31404b['uniqueid']]){transfers[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xe')]=!![];transfers[_0x31404b[_0x7fe5('0x5')]]['agentcompleteAt']=utils[_0x7fe5('0x1e')]();transfers[_0x31404b[_0x7fe5('0x5')]]['talktime']=utils[_0x7fe5('0x35')](transfers[_0x31404b[_0x7fe5('0x5')]]['agentcompleteAt'],transfers[_0x31404b[_0x7fe5('0x5')]]['agentconnectAt']);transfers[_0x31404b['uniqueid']][_0x7fe5('0x20')]=_0x7fe5('0x55');transfers[_0x31404b['uniqueid']]['lastevent']=_0x7fe5('0x37');utils['info'](util[_0x7fe5('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31404b[_0x7fe5('0x5')],transfers[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x8')],transfers[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')],transfers[_0x31404b['uniqueid']][_0x7fe5('0xc')]));writeDB(transfers[_0x31404b[_0x7fe5('0x5')]],!![]);}if(agents[_0x31404b[_0x7fe5('0x5')]]&&agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x36')]){agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xe')]=!![];agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x34')]=utils[_0x7fe5('0x1e')]();agents[_0x31404b['uniqueid']][_0x7fe5('0x22')]=utils[_0x7fe5('0x35')](agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x34')],agents[_0x31404b[_0x7fe5('0x5')]]['agentconnectAt']);agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')]=agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x3b')]?_0x7fe5('0x3b'):_0x7fe5('0x55');agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xc')]=_0x7fe5('0x37');utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31404b[_0x7fe5('0x5')],agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x8')],agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')],agents[_0x31404b['uniqueid']][_0x7fe5('0xc')]));writeDB(agents[_0x31404b[_0x7fe5('0x5')]]);}}catch(_0x226ada){utils['error'](util['format']('[%s][agents][hangup]',_0x31404b[_0x7fe5('0x5')]),_0x226ada);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index aeb9781..27bd0c5 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 _0xe4e0=['appdata','cdr','split','lastIndexOf','includes','noop','execif','gotoif','lodash','./utils','./transfers.controller','NO\x20ANSWER','BUSY','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','channel','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','disposition','toNumber','ANSWERED','hangup','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','answertime','error','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','destinationchannel','musiconholdstart','debug','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','[%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','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith'];(function(_0x34bff6,_0x36f01d){var _0x2704ee=function(_0x2fea17){while(--_0x2fea17){_0x34bff6['push'](_0x34bff6['shift']());}};_0x2704ee(++_0x36f01d);}(_0xe4e0,0x79));var _0x0e4e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe4e0[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x0e4e('0x0'));var util=require('util');var utils=require(_0x0e4e('0x1'));var transfers=require(_0x0e4e('0x2'));var dispositions=[_0x0e4e('0x3'),'FAILED','FAILED',_0x0e4e('0x3'),_0x0e4e('0x3'),_0x0e4e('0x3'),'ANSWERED',_0x0e4e('0x4'),_0x0e4e('0x5'),_0x0e4e('0x5'),'FAILED'];var channels={};function writeDB(_0x25d354){var _0x41cdf7;if(transfers[_0x0e4e('0x6')][_0x25d354[_0x0e4e('0x7')]]){_0x41cdf7=_0x25d354['uniqueid'];_0x25d354[_0x0e4e('0x7')]=transfers[_0x0e4e('0x6')][_0x25d354['uniqueid']][_0x0e4e('0x8')];}utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x25d354['uniqueid'],_0x25d354[_0x0e4e('0xb')],_0x25d354[_0x0e4e('0xc')],_0x25d354['membername'],_0x25d354[_0x0e4e('0xd')],_0x25d354[_0x0e4e('0xe')],_0x25d354[_0x0e4e('0xf')],_0x25d354[_0x0e4e('0x10')]));if(_0x25d354[_0x0e4e('0x11')]){utils[_0x0e4e('0x12')](_0x25d354[_0x0e4e('0x11')])[_0x0e4e('0x13')](function(_0x535692){if(_0x535692){_0x25d354['UserId']=_0x535692['id'];}utils[_0x0e4e('0x14')](_0x0e4e('0x15'),_0x25d354);});}else{utils['request']('CreateVoiceCallReport',_0x25d354);}if(channels[_0x25d354[_0x0e4e('0x7')]]){delete channels[_0x25d354[_0x0e4e('0x7')]];}else if(_0x41cdf7&&channels[_0x41cdf7]){delete transfers[_0x0e4e('0x6')][_0x41cdf7];delete channels[_0x41cdf7];}}exports[_0x0e4e('0x16')]=function(_0x42c94d){try{utils['debug'](util[_0x0e4e('0xa')](_0x0e4e('0x17'),_0x42c94d[_0x0e4e('0x7')]),_0x42c94d);if(_0x42c94d[_0x0e4e('0x7')]==_0x42c94d[_0x0e4e('0x18')]&&_0x42c94d[_0x0e4e('0xb')]!=_0x0e4e('0x19')){utils['info'](util['format'](_0x0e4e('0x1a'),_0x42c94d['uniqueid'],_0x42c94d['context'],_0x42c94d[_0x0e4e('0x1b')]));channels[_0x42c94d[_0x0e4e('0x7')]]={'uniqueid':_0x42c94d[_0x0e4e('0x7')],'accountcode':_0x42c94d[_0x0e4e('0x11')],'source':_0x42c94d['calleridnum'],'destination':_0x42c94d[_0x0e4e('0x1b')],'destinationcontext':_0x42c94d[_0x0e4e('0x1c')],'channel':_0x42c94d[_0x0e4e('0xb')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x0e4e('0x3'),'amaflags':_0x0e4e('0x1d')};}}catch(_0x3d540c){utils['error'](util[_0x0e4e('0xa')](_0x0e4e('0x17'),_0x42c94d[_0x0e4e('0x7')]),_0x3d540c);}};exports[_0x0e4e('0x1e')]=function(_0x5dc3b3){try{utils['debug'](util[_0x0e4e('0xa')](_0x0e4e('0x1f'),_0x5dc3b3['uniqueid']),_0x5dc3b3);if(!_[_0x0e4e('0x20')](channels[_0x5dc3b3[_0x0e4e('0x7')]])&&_0x5dc3b3[_0x0e4e('0x21')]==0x6){utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')](_0x0e4e('0x22'),_0x5dc3b3[_0x0e4e('0x7')],_0x5dc3b3['context'],_0x5dc3b3[_0x0e4e('0xb')]));if(_[_0x0e4e('0x20')](channels[_0x5dc3b3['uniqueid']]['systemanswertime'])){channels[_0x5dc3b3[_0x0e4e('0x7')]][_0x0e4e('0x23')]=utils[_0x0e4e('0x24')]();}}else if(!_['isNil'](channels[_0x5dc3b3[_0x0e4e('0x18')]])&&_0x5dc3b3[_0x0e4e('0x21')]==0x6&&_0x5dc3b3[_0x0e4e('0x1c')]!=_0x0e4e('0x25')){utils['info'](util[_0x0e4e('0xa')](_0x0e4e('0x26'),_0x5dc3b3['uniqueid'],_0x5dc3b3[_0x0e4e('0x18')],_0x5dc3b3[_0x0e4e('0x1c')],_0x5dc3b3[_0x0e4e('0xb')]));channels[_0x5dc3b3[_0x0e4e('0x18')]][_0x0e4e('0x11')]=_0x5dc3b3['accountcode'];channels[_0x5dc3b3[_0x0e4e('0x18')]]['destinationchannel']=_0x5dc3b3[_0x0e4e('0xb')];if(_[_0x0e4e('0x20')](channels[_0x5dc3b3[_0x0e4e('0x18')]]['answertime'])){channels[_0x5dc3b3['linkedid']]['answertime']=utils[_0x0e4e('0x24')]();}channels[_0x5dc3b3[_0x0e4e('0x18')]][_0x0e4e('0x27')]=dispositions[_[_0x0e4e('0x28')](_0x5dc3b3[_0x0e4e('0x21')])]||_0x0e4e('0x29');}}catch(_0x4d7aeb){utils['error'](util[_0x0e4e('0xa')]('[%s][calls][newstate]',_0x5dc3b3[_0x0e4e('0x7')]),_0x4d7aeb);}};exports[_0x0e4e('0x2a')]=function(_0x3f1509){try{if(!_[_0x0e4e('0x20')](channels[_0x3f1509[_0x0e4e('0x7')]])){utils['debug'](util[_0x0e4e('0xa')]('[%s][calls][hangup]',_0x3f1509[_0x0e4e('0x7')]),_0x3f1509);if(_[_0x0e4e('0x20')](channels[_0x3f1509[_0x0e4e('0x7')]][_0x0e4e('0x2b')])){channels[_0x3f1509[_0x0e4e('0x7')]][_0x0e4e('0x2b')]=_0x3f1509[_0x0e4e('0x2c')]+'\x20<'+_0x3f1509[_0x0e4e('0xe')]+'>';}utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x3f1509[_0x0e4e('0x7')],channels[_0x3f1509['uniqueid']][_0x0e4e('0x2b')],_0x3f1509[_0x0e4e('0x2d')]));channels[_0x3f1509[_0x0e4e('0x7')]][_0x0e4e('0x2e')]=utils[_0x0e4e('0x24')]();channels[_0x3f1509[_0x0e4e('0x7')]][_0x0e4e('0x2f')]=utils[_0x0e4e('0x30')](channels[_0x3f1509[_0x0e4e('0x7')]][_0x0e4e('0x2e')],channels[_0x3f1509['uniqueid']][_0x0e4e('0x31')]);channels[_0x3f1509['uniqueid']]['billableseconds']=channels[_0x3f1509['uniqueid']][_0x0e4e('0x32')]?utils[_0x0e4e('0x30')](channels[_0x3f1509['uniqueid']][_0x0e4e('0x2e')],channels[_0x3f1509[_0x0e4e('0x7')]][_0x0e4e('0x32')]):0x0;writeDB(channels[_0x3f1509[_0x0e4e('0x7')]]);}}catch(_0x6a89fd){utils[_0x0e4e('0x33')](util[_0x0e4e('0xa')](_0x0e4e('0x34'),_0x3f1509[_0x0e4e('0x7')]),_0x6a89fd);}};exports[_0x0e4e('0x35')]=function(_0x2b0590){try{if(!_['isNil'](channels[_0x2b0590[_0x0e4e('0x36')]])){utils['debug'](util['format'](_0x0e4e('0x37'),_0x2b0590[_0x0e4e('0x38')]),_0x2b0590);if(channels[_0x2b0590[_0x0e4e('0x36')]][_0x0e4e('0xb')]==_0x2b0590['transfereechannel']){utils[_0x0e4e('0x9')](util['format'](_0x0e4e('0x39'),_0x2b0590[_0x0e4e('0x38')],_0x2b0590[_0x0e4e('0x36')],_0x2b0590[_0x0e4e('0x3a')]));channels[_0x2b0590[_0x0e4e('0x36')]]['destinationchannel']=_0x2b0590[_0x0e4e('0x3a')];channels[_0x2b0590[_0x0e4e('0x36')]][_0x0e4e('0x3b')]=_0x0e4e('0x3c');}else if(channels[_0x2b0590[_0x0e4e('0x36')]][_0x0e4e('0xb')]=_0x2b0590[_0x0e4e('0x3d')]){utils['info'](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x2b0590[_0x0e4e('0x38')],_0x2b0590[_0x0e4e('0x36')],_0x2b0590[_0x0e4e('0x3e')]));channels[_0x2b0590[_0x0e4e('0x36')]][_0x0e4e('0x3f')]=_0x2b0590[_0x0e4e('0x3e')];channels[_0x2b0590[_0x0e4e('0x36')]][_0x0e4e('0x3b')]=_0x0e4e('0x3c');}}}catch(_0x507ca2){utils[_0x0e4e('0x33')](util['format'](_0x0e4e('0x37'),_0x2b0590[_0x0e4e('0x38')]),_0x507ca2);}};exports[_0x0e4e('0x40')]=function(_0x2ebc24){try{if(!_['isNil'](channels[_0x2ebc24[_0x0e4e('0x7')]])){utils[_0x0e4e('0x41')](util[_0x0e4e('0xa')](_0x0e4e('0x42'),_0x2ebc24[_0x0e4e('0x7')]),_0x2ebc24);channels[_0x2ebc24[_0x0e4e('0x7')]][_0x0e4e('0x43')]=utils[_0x0e4e('0x24')]();utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')](_0x0e4e('0x44'),_0x2ebc24[_0x0e4e('0x7')],channels[_0x2ebc24[_0x0e4e('0x7')]][_0x0e4e('0x43')]));}}catch(_0xcb343f){utils['error'](util[_0x0e4e('0xa')](_0x0e4e('0x42'),_0x2ebc24['uniqueid']),_0xcb343f);}};exports[_0x0e4e('0x45')]=function(_0x7f42f8){try{if(!_['isNil'](channels[_0x7f42f8['uniqueid']])){utils['debug'](util['format'](_0x0e4e('0x46'),_0x7f42f8['uniqueid']),_0x7f42f8);if(!_['isNil'](channels[_0x7f42f8[_0x0e4e('0x7')]]['musiconholdstartAt'])){channels[_0x7f42f8[_0x0e4e('0x7')]][_0x0e4e('0x47')]+=utils[_0x0e4e('0x30')](utils['now'](),channels[_0x7f42f8[_0x0e4e('0x7')]][_0x0e4e('0x43')]);utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x7f42f8[_0x0e4e('0x7')],channels[_0x7f42f8['uniqueid']][_0x0e4e('0x47')]));delete channels[_0x7f42f8[_0x0e4e('0x7')]][_0x0e4e('0x43')];}}}catch(_0x1c112e){utils[_0x0e4e('0x33')](util['format'](_0x0e4e('0x46'),_0x7f42f8[_0x0e4e('0x7')]),_0x1c112e);}};exports['varset']=function(_0x27f95d){try{if(!_[_0x0e4e('0x20')](channels[_0x27f95d[_0x0e4e('0x7')]])){utils['debug'](util[_0x0e4e('0xa')]('[%s][calls][varset]',_0x27f95d[_0x0e4e('0x7')]),_0x27f95d);if(!_[_0x0e4e('0x20')](_0x27f95d['variable'][_0x0e4e('0x48')])){utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')](_0x0e4e('0x49'),_0x27f95d[_0x0e4e('0x7')],_0x27f95d[_0x0e4e('0x4a')]));channels[_0x27f95d['uniqueid']][_0x0e4e('0x4b')]=_0x27f95d[_0x0e4e('0x4a')];}if(!_['isNil'](_0x27f95d[_0x0e4e('0x4c')]['xmd-phone'])){utils['info'](util[_0x0e4e('0xa')](_0x0e4e('0x4d'),_0x27f95d[_0x0e4e('0x7')],_0x27f95d[_0x0e4e('0x4a')]));channels[_0x27f95d['uniqueid']][_0x0e4e('0x4e')]=_0x27f95d[_0x0e4e('0x4a')];channels[_0x27f95d[_0x0e4e('0x7')]]['callerid']='\x22'+_0x27f95d[_0x0e4e('0x4a')]+_0x0e4e('0x4f')+_0x27f95d[_0x0e4e('0x4a')]+'>';}if(!_[_0x0e4e('0x20')](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x50')])||!_['isNil'](_0x27f95d[_0x0e4e('0x4c')]['xmd-callerid'])){utils[_0x0e4e('0x9')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x27f95d[_0x0e4e('0x7')],!_[_0x0e4e('0x20')](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x50')])?_0x0e4e('0x50'):_0x0e4e('0x51'),_0x27f95d[_0x0e4e('0x4a')]));channels[_0x27f95d[_0x0e4e('0x7')]][_0x0e4e('0x2b')]=_0x27f95d['value'];}if(!_['isNil'](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x52')])||!_['isNil'](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x53')])){utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')](_0x0e4e('0x54'),_0x27f95d[_0x0e4e('0x7')],!_[_0x0e4e('0x20')](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x52')])?_0x0e4e('0x52'):_0x0e4e('0x53'),_0x27f95d[_0x0e4e('0x4a')]));channels[_0x27f95d[_0x0e4e('0x7')]][_0x0e4e('0x55')]=_0x0e4e('0x56');channels[_0x27f95d['uniqueid']][_0x0e4e('0x57')]=_0x27f95d[_0x0e4e('0x4a')];channels[_0x27f95d[_0x0e4e('0x7')]][_0x0e4e('0xc')]=!![];}if(!_[_0x0e4e('0x20')](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x58')])){utils['info'](util[_0x0e4e('0xa')](_0x0e4e('0x59'),_0x27f95d[_0x0e4e('0x7')],_0x27f95d[_0x0e4e('0x4a')]));channels[_0x27f95d[_0x0e4e('0x7')]]['ContactId']=_0x27f95d[_0x0e4e('0x4a')];}if(!_[_0x0e4e('0x20')](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x5a')])){utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')](_0x0e4e('0x5b'),_0x27f95d[_0x0e4e('0x7')],_0x27f95d['value']));channels[_0x27f95d[_0x0e4e('0x7')]][_0x0e4e('0x5c')]=_0x27f95d[_0x0e4e('0x4a')];}if(!_['isNil'](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x5d')])){utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')](_0x0e4e('0x5e'),_0x27f95d[_0x0e4e('0x7')],_0x27f95d['value']));channels[_0x27f95d[_0x0e4e('0x7')]][_0x0e4e('0x5f')]=_0x27f95d[_0x0e4e('0x4a')];}if(!_[_0x0e4e('0x20')](_0x27f95d[_0x0e4e('0x4c')][_0x0e4e('0x60')])){utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')](_0x0e4e('0x61'),_0x27f95d[_0x0e4e('0x7')],_0x27f95d['value']));channels[_0x27f95d[_0x0e4e('0x7')]][_0x0e4e('0x60')]=_0x27f95d[_0x0e4e('0x4a')];}}}catch(_0x5548b0){utils[_0x0e4e('0x33')](util[_0x0e4e('0xa')]('[%s][calls][varset]',_0x27f95d[_0x0e4e('0x7')]),_0x5548b0);}};exports[_0x0e4e('0x62')]=function(_0x31270b){try{if(!_[_0x0e4e('0x20')](channels[_0x31270b['uniqueid']])){utils[_0x0e4e('0x41')](util[_0x0e4e('0xa')](_0x0e4e('0x63'),_0x31270b[_0x0e4e('0x7')]),_0x31270b);utils[_0x0e4e('0x9')](util[_0x0e4e('0xa')](_0x0e4e('0x64'),_0x31270b[_0x0e4e('0x7')],_0x31270b[_0x0e4e('0x65')],_0x31270b['appdata']));if(_0x31270b['application'][_0x0e4e('0x66')]()==_0x0e4e('0x67')&&_[_0x0e4e('0x68')](_0x31270b[_0x0e4e('0x69')][_0x0e4e('0x66')](),_0x0e4e('0x6a'))){var _0x522293=_0x31270b[_0x0e4e('0x69')][_0x0e4e('0x6b')]('=');var _0xe20207=_0x522293[0x0]['substring'](_0x522293[0x0][_0x0e4e('0x6c')]('(')+0x1,_0x522293[0x0][_0x0e4e('0x6c')](')'));var _0x1eba73=_0x522293[0x1];channels[_0x31270b[_0x0e4e('0x7')]][_0xe20207]=_0x1eba73;}if(!_[_0x0e4e('0x6d')]([_0x0e4e('0x2a'),_0x0e4e('0x6e'),_0x0e4e('0x6f'),_0x0e4e('0x67'),_0x0e4e('0x70')],_0x31270b['application'][_0x0e4e('0x66')]())){channels[_0x31270b[_0x0e4e('0x7')]][_0x0e4e('0x55')]=_0x31270b['application'];channels[_0x31270b[_0x0e4e('0x7')]][_0x0e4e('0x57')]=_0x31270b[_0x0e4e('0x69')];}}}catch(_0x10512b){utils['error'](util['format'](_0x0e4e('0x63'),_0x31270b[_0x0e4e('0x7')]),_0x10512b);}}; \ No newline at end of file +var _0x1edf=['application','toLowerCase','cdr','split','substring','lastIndexOf','includes','execif','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','membername','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','then','UserId','CreateVoiceCallReport','request','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','debug','isNil','channel','systemanswertime','answertime','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmcs-queue','xmd-queue','lastapplication','Queue','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata'];(function(_0x5db99b,_0xdee23a){var _0x4b2d0e=function(_0x4deee1){while(--_0x4deee1){_0x5db99b['push'](_0x5db99b['shift']());}};_0x4b2d0e(++_0xdee23a);}(_0x1edf,0x1a8));var _0xf1ed=function(_0x5a4514,_0x195f3e){_0x5a4514=_0x5a4514-0x0;var _0x120fd7=_0x1edf[_0x5a4514];return _0x120fd7;};'use strict';var _=require(_0xf1ed('0x0'));var util=require(_0xf1ed('0x1'));var utils=require(_0xf1ed('0x2'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0xf1ed('0x3'),_0xf1ed('0x3'),'NO\x20ANSWER','NO\x20ANSWER',_0xf1ed('0x4'),_0xf1ed('0x5'),_0xf1ed('0x6'),_0xf1ed('0x3'),'FAILED',_0xf1ed('0x3')];var channels={};function writeDB(_0x79eb80){var _0x184207;if(transfers[_0xf1ed('0x7')][_0x79eb80[_0xf1ed('0x8')]]){_0x184207=_0x79eb80['uniqueid'];_0x79eb80[_0xf1ed('0x8')]=transfers[_0xf1ed('0x7')][_0x79eb80['uniqueid']][_0xf1ed('0x9')];}utils[_0xf1ed('0xa')](util[_0xf1ed('0xb')](_0xf1ed('0xc'),_0x79eb80['uniqueid'],_0x79eb80['channel'],_0x79eb80['queue'],_0x79eb80[_0xf1ed('0xd')],_0x79eb80[_0xf1ed('0xe')],_0x79eb80[_0xf1ed('0xf')],_0x79eb80[_0xf1ed('0x10')],_0x79eb80[_0xf1ed('0x11')]));if(_0x79eb80['accountcode']){utils[_0xf1ed('0x12')](_0x79eb80[_0xf1ed('0x13')])[_0xf1ed('0x14')](function(_0x283695){if(_0x283695){_0x79eb80[_0xf1ed('0x15')]=_0x283695['id'];}utils['request'](_0xf1ed('0x16'),_0x79eb80);});}else{utils[_0xf1ed('0x17')](_0xf1ed('0x16'),_0x79eb80);}if(channels[_0x79eb80[_0xf1ed('0x8')]]){delete channels[_0x79eb80[_0xf1ed('0x8')]];}else if(_0x184207&&channels[_0x184207]){delete transfers['blinds'][_0x184207];delete channels[_0x184207];}}exports[_0xf1ed('0x18')]=function(_0xdfdb36){try{utils['debug'](util[_0xf1ed('0xb')](_0xf1ed('0x19'),_0xdfdb36[_0xf1ed('0x8')]),_0xdfdb36);if(_0xdfdb36[_0xf1ed('0x8')]==_0xdfdb36[_0xf1ed('0x1a')]&&_0xdfdb36['channel']!=_0xf1ed('0x1b')){utils[_0xf1ed('0xa')](util['format'](_0xf1ed('0x1c'),_0xdfdb36[_0xf1ed('0x8')],_0xdfdb36[_0xf1ed('0x1d')],_0xdfdb36[_0xf1ed('0x1e')]));channels[_0xdfdb36['uniqueid']]={'uniqueid':_0xdfdb36[_0xf1ed('0x8')],'accountcode':_0xdfdb36[_0xf1ed('0x13')],'source':_0xdfdb36[_0xf1ed('0xf')],'destination':_0xdfdb36[_0xf1ed('0x1e')],'destinationcontext':_0xdfdb36[_0xf1ed('0x1d')],'channel':_0xdfdb36['channel'],'starttime':utils[_0xf1ed('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xf1ed('0x4'),'amaflags':_0xf1ed('0x20')};}}catch(_0x128e92){utils[_0xf1ed('0x21')](util['format'](_0xf1ed('0x19'),_0xdfdb36[_0xf1ed('0x8')]),_0x128e92);}};exports[_0xf1ed('0x22')]=function(_0x44f470){try{utils[_0xf1ed('0x23')](util['format']('[%s][calls][newstate]',_0x44f470['uniqueid']),_0x44f470);if(!_[_0xf1ed('0x24')](channels[_0x44f470[_0xf1ed('0x8')]])&&_0x44f470['channelstate']==0x6){utils[_0xf1ed('0xa')](util[_0xf1ed('0xb')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x44f470['uniqueid'],_0x44f470[_0xf1ed('0x1d')],_0x44f470[_0xf1ed('0x25')]));if(_[_0xf1ed('0x24')](channels[_0x44f470[_0xf1ed('0x8')]][_0xf1ed('0x26')])){channels[_0x44f470[_0xf1ed('0x8')]][_0xf1ed('0x26')]=utils[_0xf1ed('0x1f')]();}}else if(!_[_0xf1ed('0x24')](channels[_0x44f470[_0xf1ed('0x1a')]])&&_0x44f470['channelstate']==0x6&&_0x44f470[_0xf1ed('0x1d')]!='transfer'){utils['info'](util[_0xf1ed('0xb')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x44f470[_0xf1ed('0x8')],_0x44f470[_0xf1ed('0x1a')],_0x44f470['context'],_0x44f470['channel']));channels[_0x44f470[_0xf1ed('0x1a')]][_0xf1ed('0x13')]=_0x44f470[_0xf1ed('0x13')];channels[_0x44f470[_0xf1ed('0x1a')]]['destinationchannel']=_0x44f470[_0xf1ed('0x25')];if(_[_0xf1ed('0x24')](channels[_0x44f470[_0xf1ed('0x1a')]][_0xf1ed('0x27')])){channels[_0x44f470[_0xf1ed('0x1a')]][_0xf1ed('0x27')]=utils[_0xf1ed('0x1f')]();}channels[_0x44f470[_0xf1ed('0x1a')]]['disposition']=dispositions[_['toNumber'](_0x44f470['channelstate'])]||_0xf1ed('0x5');}}catch(_0x17a7ce){utils['error'](util[_0xf1ed('0xb')](_0xf1ed('0x28'),_0x44f470[_0xf1ed('0x8')]),_0x17a7ce);}};exports[_0xf1ed('0x29')]=function(_0x128adb){try{if(!_['isNil'](channels[_0x128adb[_0xf1ed('0x8')]])){utils[_0xf1ed('0x23')](util[_0xf1ed('0xb')](_0xf1ed('0x2a'),_0x128adb[_0xf1ed('0x8')]),_0x128adb);if(_[_0xf1ed('0x24')](channels[_0x128adb['uniqueid']][_0xf1ed('0x2b')])){channels[_0x128adb['uniqueid']][_0xf1ed('0x2b')]=_0x128adb['calleridname']+'\x20<'+_0x128adb[_0xf1ed('0xf')]+'>';}utils['info'](util['format'](_0xf1ed('0x2c'),_0x128adb['uniqueid'],channels[_0x128adb[_0xf1ed('0x8')]]['callerid'],_0x128adb['cause-txt']));channels[_0x128adb[_0xf1ed('0x8')]][_0xf1ed('0x2d')]=utils[_0xf1ed('0x1f')]();channels[_0x128adb[_0xf1ed('0x8')]][_0xf1ed('0x2e')]=utils[_0xf1ed('0x2f')](channels[_0x128adb[_0xf1ed('0x8')]][_0xf1ed('0x2d')],channels[_0x128adb['uniqueid']][_0xf1ed('0x30')]);channels[_0x128adb[_0xf1ed('0x8')]][_0xf1ed('0x31')]=channels[_0x128adb[_0xf1ed('0x8')]][_0xf1ed('0x27')]?utils[_0xf1ed('0x2f')](channels[_0x128adb[_0xf1ed('0x8')]]['endtime'],channels[_0x128adb['uniqueid']]['answertime']):0x0;writeDB(channels[_0x128adb[_0xf1ed('0x8')]]);}}catch(_0x34e01a){utils[_0xf1ed('0x21')](util[_0xf1ed('0xb')](_0xf1ed('0x2a'),_0x128adb['uniqueid']),_0x34e01a);}};exports[_0xf1ed('0x32')]=function(_0x480570){try{if(!_['isNil'](channels[_0x480570['localtwolinkedid']])){utils['debug'](util['format'](_0xf1ed('0x33'),_0x480570[_0xf1ed('0x34')]),_0x480570);if(channels[_0x480570[_0xf1ed('0x35')]][_0xf1ed('0x25')]==_0x480570[_0xf1ed('0x36')]){utils['info'](util[_0xf1ed('0xb')](_0xf1ed('0x37'),_0x480570[_0xf1ed('0x34')],_0x480570[_0xf1ed('0x35')],_0x480570[_0xf1ed('0x38')]));channels[_0x480570[_0xf1ed('0x35')]][_0xf1ed('0x39')]=_0x480570['secondtransfererchannel'];channels[_0x480570['localtwolinkedid']][_0xf1ed('0x3a')]=_0xf1ed('0x3b');}else if(channels[_0x480570[_0xf1ed('0x35')]][_0xf1ed('0x25')]=_0x480570[_0xf1ed('0x3c')]){utils[_0xf1ed('0xa')](util[_0xf1ed('0xb')](_0xf1ed('0x37'),_0x480570[_0xf1ed('0x34')],_0x480570[_0xf1ed('0x35')],_0x480570[_0xf1ed('0x3d')]));channels[_0x480570[_0xf1ed('0x35')]]['destinationchannel']=_0x480570['origtransfererchannel'];channels[_0x480570[_0xf1ed('0x35')]][_0xf1ed('0x3a')]=_0xf1ed('0x3b');}}}catch(_0x573f31){utils[_0xf1ed('0x21')](util[_0xf1ed('0xb')](_0xf1ed('0x33'),_0x480570[_0xf1ed('0x34')]),_0x573f31);}};exports[_0xf1ed('0x3e')]=function(_0x28a616){try{if(!_['isNil'](channels[_0x28a616['uniqueid']])){utils['debug'](util[_0xf1ed('0xb')](_0xf1ed('0x3f'),_0x28a616['uniqueid']),_0x28a616);channels[_0x28a616['uniqueid']][_0xf1ed('0x40')]=utils[_0xf1ed('0x1f')]();utils[_0xf1ed('0xa')](util[_0xf1ed('0xb')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x28a616[_0xf1ed('0x8')],channels[_0x28a616['uniqueid']][_0xf1ed('0x40')]));}}catch(_0xd05d26){utils[_0xf1ed('0x21')](util['format'](_0xf1ed('0x3f'),_0x28a616[_0xf1ed('0x8')]),_0xd05d26);}};exports['musiconholdstop']=function(_0x3862f4){try{if(!_['isNil'](channels[_0x3862f4['uniqueid']])){utils[_0xf1ed('0x23')](util[_0xf1ed('0xb')](_0xf1ed('0x41'),_0x3862f4[_0xf1ed('0x8')]),_0x3862f4);if(!_[_0xf1ed('0x24')](channels[_0x3862f4[_0xf1ed('0x8')]]['musiconholdstartAt'])){channels[_0x3862f4[_0xf1ed('0x8')]][_0xf1ed('0x42')]+=utils[_0xf1ed('0x2f')](utils[_0xf1ed('0x1f')](),channels[_0x3862f4[_0xf1ed('0x8')]][_0xf1ed('0x40')]);utils[_0xf1ed('0xa')](util['format'](_0xf1ed('0x43'),_0x3862f4[_0xf1ed('0x8')],channels[_0x3862f4[_0xf1ed('0x8')]][_0xf1ed('0x42')]));delete channels[_0x3862f4[_0xf1ed('0x8')]][_0xf1ed('0x40')];}}}catch(_0x540fbf){utils['error'](util['format']('[%s][calls][musiconholdstop]',_0x3862f4['uniqueid']),_0x540fbf);}};exports['varset']=function(_0x475b91){try{if(!_[_0xf1ed('0x24')](channels[_0x475b91[_0xf1ed('0x8')]])){utils[_0xf1ed('0x23')](util[_0xf1ed('0xb')](_0xf1ed('0x44'),_0x475b91['uniqueid']),_0x475b91);if(!_[_0xf1ed('0x24')](_0x475b91[_0xf1ed('0x45')]['xmd-originatecalleridnum'])){utils['info'](util['format'](_0xf1ed('0x46'),_0x475b91[_0xf1ed('0x8')],_0x475b91[_0xf1ed('0x47')]));channels[_0x475b91[_0xf1ed('0x8')]][_0xf1ed('0x48')]=_0x475b91[_0xf1ed('0x47')];}if(!_[_0xf1ed('0x24')](_0x475b91[_0xf1ed('0x45')][_0xf1ed('0x49')])){utils[_0xf1ed('0xa')](util[_0xf1ed('0xb')](_0xf1ed('0x4a'),_0x475b91[_0xf1ed('0x8')],_0x475b91[_0xf1ed('0x47')]));channels[_0x475b91[_0xf1ed('0x8')]][_0xf1ed('0x4b')]=_0x475b91[_0xf1ed('0x47')];channels[_0x475b91[_0xf1ed('0x8')]][_0xf1ed('0x2b')]='\x22'+_0x475b91[_0xf1ed('0x47')]+_0xf1ed('0x4c')+_0x475b91[_0xf1ed('0x47')]+'>';}if(!_['isNil'](_0x475b91[_0xf1ed('0x45')][_0xf1ed('0x4d')])||!_[_0xf1ed('0x24')](_0x475b91['variable']['xmd-callerid'])){utils[_0xf1ed('0xa')](util[_0xf1ed('0xb')](_0xf1ed('0x4e'),_0x475b91[_0xf1ed('0x8')],!_[_0xf1ed('0x24')](_0x475b91['variable'][_0xf1ed('0x4d')])?_0xf1ed('0x4d'):_0xf1ed('0x4f'),_0x475b91[_0xf1ed('0x47')]));channels[_0x475b91[_0xf1ed('0x8')]]['callerid']=_0x475b91[_0xf1ed('0x47')];}if(!_[_0xf1ed('0x24')](_0x475b91[_0xf1ed('0x45')]['xmd-queue'])||!_[_0xf1ed('0x24')](_0x475b91['variable'][_0xf1ed('0x50')])){utils[_0xf1ed('0xa')](util[_0xf1ed('0xb')](_0xf1ed('0x4e'),_0x475b91[_0xf1ed('0x8')],!_[_0xf1ed('0x24')](_0x475b91['variable'][_0xf1ed('0x51')])?_0xf1ed('0x51'):_0xf1ed('0x50'),_0x475b91[_0xf1ed('0x47')]));channels[_0x475b91[_0xf1ed('0x8')]][_0xf1ed('0x52')]=_0xf1ed('0x53');channels[_0x475b91[_0xf1ed('0x8')]]['lastdata']=_0x475b91[_0xf1ed('0x47')];channels[_0x475b91[_0xf1ed('0x8')]][_0xf1ed('0x54')]=!![];}if(!_[_0xf1ed('0x24')](_0x475b91[_0xf1ed('0x45')][_0xf1ed('0x55')])){utils[_0xf1ed('0xa')](util[_0xf1ed('0xb')](_0xf1ed('0x56'),_0x475b91[_0xf1ed('0x8')],_0x475b91[_0xf1ed('0x47')]));channels[_0x475b91[_0xf1ed('0x8')]]['ContactId']=_0x475b91[_0xf1ed('0x47')];}if(!_['isNil'](_0x475b91[_0xf1ed('0x45')][_0xf1ed('0x57')])){utils[_0xf1ed('0xa')](util[_0xf1ed('0xb')](_0xf1ed('0x58'),_0x475b91[_0xf1ed('0x8')],_0x475b91[_0xf1ed('0x47')]));channels[_0x475b91[_0xf1ed('0x8')]][_0xf1ed('0x59')]=_0x475b91['value'];}if(!_[_0xf1ed('0x24')](_0x475b91['variable'][_0xf1ed('0x5a')])){utils[_0xf1ed('0xa')](util[_0xf1ed('0xb')](_0xf1ed('0x5b'),_0x475b91[_0xf1ed('0x8')],_0x475b91[_0xf1ed('0x47')]));channels[_0x475b91['uniqueid']]['routeid']=_0x475b91[_0xf1ed('0x47')];}if(!_[_0xf1ed('0x24')](_0x475b91['variable']['sipcallid'])){utils['info'](util[_0xf1ed('0xb')](_0xf1ed('0x5c'),_0x475b91[_0xf1ed('0x8')],_0x475b91['value']));channels[_0x475b91['uniqueid']][_0xf1ed('0x5d')]=_0x475b91[_0xf1ed('0x47')];}}}catch(_0x164e59){utils[_0xf1ed('0x21')](util[_0xf1ed('0xb')](_0xf1ed('0x44'),_0x475b91[_0xf1ed('0x8')]),_0x164e59);}};exports['newexten']=function(_0x34020a){try{if(!_['isNil'](channels[_0x34020a[_0xf1ed('0x8')]])){utils[_0xf1ed('0x23')](util['format']('[%s][calls][newexten]',_0x34020a['uniqueid']),_0x34020a);utils[_0xf1ed('0xa')](util[_0xf1ed('0xb')](_0xf1ed('0x5e'),_0x34020a[_0xf1ed('0x8')],_0x34020a['application'],_0x34020a[_0xf1ed('0x5f')]));if(_0x34020a[_0xf1ed('0x60')][_0xf1ed('0x61')]()=='set'&&_['startsWith'](_0x34020a['appdata'][_0xf1ed('0x61')](),_0xf1ed('0x62'))){var _0x55ee07=_0x34020a['appdata'][_0xf1ed('0x63')]('=');var _0x34169d=_0x55ee07[0x0][_0xf1ed('0x64')](_0x55ee07[0x0][_0xf1ed('0x65')]('(')+0x1,_0x55ee07[0x0][_0xf1ed('0x65')](')'));var _0x5cf754=_0x55ee07[0x1];channels[_0x34020a[_0xf1ed('0x8')]][_0x34169d]=_0x5cf754;}if(!_[_0xf1ed('0x66')](['hangup','noop',_0xf1ed('0x67'),'set','gotoif'],_0x34020a['application'][_0xf1ed('0x61')]())){channels[_0x34020a['uniqueid']][_0xf1ed('0x52')]=_0x34020a[_0xf1ed('0x60')];channels[_0x34020a[_0xf1ed('0x8')]]['lastdata']=_0x34020a[_0xf1ed('0x5f')];}}}catch(_0x23c256){utils[_0xf1ed('0x21')](util[_0xf1ed('0xb')]('[%s][calls][newexten]',_0x34020a['uniqueid']),_0x23c256);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 31152f1..853a545 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 _0xde02=['[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x493bda,_0x3f74d9){var _0x19e839=function(_0x166f67){while(--_0x166f67){_0x493bda['push'](_0x493bda['shift']());}};_0x19e839(++_0x3f74d9);}(_0xde02,0xd5));var _0x2de0=function(_0x1877de,_0x38d29b){_0x1877de=_0x1877de-0x0;var _0x32b37d=_0xde02[_0x1877de];return _0x32b37d;};'use strict';var utils=require(_0x2de0('0x0'));exports[_0x2de0('0x1')]=function(){utils[_0x2de0('0x2')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0x2de0('0x2')](_0x2de0('0x3'));};exports[_0x2de0('0x4')]=function(){utils['info'](_0x2de0('0x5'));};exports[_0x2de0('0x6')]=function(_0x34f414){utils[_0x2de0('0x6')](_0x2de0('0x7'),_0x34f414);};exports[_0x2de0('0x8')]=function(){utils[_0x2de0('0x2')](_0x2de0('0x9'));};exports[_0x2de0('0xa')]=function(_0x3eee21){}; \ No newline at end of file +var _0x30d3=['./utils','connect','shutdown','info','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent'];(function(_0xefa6d8,_0x40668f){var _0x57ddee=function(_0x21e528){while(--_0x21e528){_0xefa6d8['push'](_0xefa6d8['shift']());}};_0x57ddee(++_0x40668f);}(_0x30d3,0xc6));var _0x330d=function(_0x4d7185,_0x52d3ab){_0x4d7185=_0x4d7185-0x0;var _0x2d8aa1=_0x30d3[_0x4d7185];return _0x2d8aa1;};'use strict';var utils=require(_0x330d('0x0'));exports[_0x330d('0x1')]=function(){utils['info']('[core]\x20connected');};exports[_0x330d('0x2')]=function(){utils[_0x330d('0x3')](_0x330d('0x4'));};exports[_0x330d('0x5')]=function(){utils[_0x330d('0x3')]('[core]\x20fullybooted');};exports['error']=function(_0x27ffc8){utils[_0x330d('0x6')](_0x330d('0x7'),_0x27ffc8);};exports[_0x330d('0x8')]=function(){utils[_0x330d('0x3')](_0x330d('0x9'));};exports[_0x330d('0xa')]=function(_0x1484b2){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index f70b781..97db035 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 _0x8149=['[%s][dials][hangup]','cause-txt','duration','endtime','holdtime','diffTime','billableseconds','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','application','appdata','toLowerCase','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s'];(function(_0x1be0f3,_0x34ee94){var _0x5e331b=function(_0x2627dd){while(--_0x2627dd){_0x1be0f3['push'](_0x1be0f3['shift']());}};_0x5e331b(++_0x34ee94);}(_0x8149,0x17f));var _0x9814=function(_0x4048c2,_0x4abba8){_0x4048c2=_0x4048c2-0x0;var _0x1b58ee=_0x8149[_0x4048c2];return _0x1b58ee;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x9814('0x0'));var dials={};function writeDB(_0x4bbd8c){utils[_0x9814('0x1')](util[_0x9814('0x2')](_0x9814('0x3'),_0x4bbd8c[_0x9814('0x4')],_0x4bbd8c[_0x9814('0x5')],_0x4bbd8c[_0x9814('0x6')],_0x4bbd8c[_0x9814('0x7')],_0x4bbd8c[_0x9814('0x8')],_0x4bbd8c['dialstatus']));utils[_0x9814('0x9')](_0x9814('0xa'),_0x4bbd8c);delete dials[_0x4bbd8c[_0x9814('0x4')]];}exports[_0x9814('0xb')]=function(_0x184be8){try{utils[_0x9814('0xc')](util['format'](_0x9814('0xd'),_0x184be8['uniqueid']),_0x184be8);utils['info'](util[_0x9814('0x2')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x184be8['uniqueid'],_0x184be8[_0x9814('0xe')],_0x184be8['appdata']));if(_0x184be8[_0x9814('0xe')]['toLowerCase']()=='set'&&_['startsWith'](_0x184be8[_0x9814('0xf')][_0x9814('0x10')](),_0x9814('0x11'))){var _0x1abb30=_0x184be8[_0x9814('0xf')][_0x9814('0x12')]('=');dials[_0x184be8[_0x9814('0x4')]]={'routeId':_0x1abb30[0x1]};}}catch(_0x5193c3){utils[_0x9814('0x13')](util['format'](_0x9814('0xd'),_0x184be8['uniqueid']),_0x5193c3);}};exports[_0x9814('0x14')]=function(_0x3b8079){try{utils[_0x9814('0xc')](util[_0x9814('0x2')](_0x9814('0x15'),_0x3b8079[_0x9814('0x4')]),_0x3b8079);if(!_[_0x9814('0x16')](_0x3b8079[_0x9814('0x17')]['outboundrouteid'])){utils[_0x9814('0x1')](util[_0x9814('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x3b8079['uniqueid'],_0x3b8079['value']));dials[_0x3b8079[_0x9814('0x4')]]={'routeId':_0x3b8079[_0x9814('0x18')]};}}catch(_0x4993a9){utils['error'](util[_0x9814('0x2')](_0x9814('0x15'),_0x3b8079[_0x9814('0x4')]),_0x4993a9);}};exports[_0x9814('0x19')]=function(_0x181ee2){try{if(!_['isNil'](dials[_0x181ee2[_0x9814('0x4')]])){utils[_0x9814('0xc')](util['format'](_0x9814('0x1a'),_0x181ee2[_0x9814('0x4')]),_0x181ee2);dials[_0x181ee2[_0x9814('0x4')]]=_[_0x9814('0x1b')](dials[_0x181ee2[_0x9814('0x4')]],_0x181ee2);dials[_0x181ee2['uniqueid']][_0x9814('0x1c')]=utils[_0x9814('0x1d')]();dials[_0x181ee2[_0x9814('0x4')]][_0x9814('0x1e')]=_0x9814('0x1f');utils[_0x9814('0x1')](util[_0x9814('0x2')](_0x9814('0x20'),_0x181ee2[_0x9814('0x4')],dials[_0x181ee2['uniqueid']][_0x9814('0x1c')]));}}catch(_0xa9d909){utils[_0x9814('0x13')](util[_0x9814('0x2')]('[%s][dials][dialbegin]',_0x181ee2[_0x9814('0x4')]),_0xa9d909);}};exports[_0x9814('0x21')]=function(_0xa61fb0){try{if(!_[_0x9814('0x16')](dials[_0xa61fb0['uniqueid']])){utils['debug'](util['format'](_0x9814('0x22'),_0xa61fb0['uniqueid']),_0xa61fb0);dials[_0xa61fb0[_0x9814('0x4')]][_0x9814('0x23')]=_0xa61fb0[_0x9814('0x23')];if(_0xa61fb0[_0x9814('0x23')]==_0x9814('0x24')){dials[_0xa61fb0[_0x9814('0x4')]]=_[_0x9814('0x1b')](dials[_0xa61fb0[_0x9814('0x4')]],_0xa61fb0);dials[_0xa61fb0[_0x9814('0x4')]][_0x9814('0x25')]=utils[_0x9814('0x1d')]();dials[_0xa61fb0['uniqueid']][_0x9814('0x1e')]='connect';utils[_0x9814('0x1')](util['format'](_0x9814('0x26'),_0xa61fb0['uniqueid'],_0xa61fb0['dialstatus'],dials[_0xa61fb0['uniqueid']][_0x9814('0x25')]));}else{utils[_0x9814('0x1')](util['format'](_0x9814('0x27'),_0xa61fb0[_0x9814('0x4')],_0xa61fb0['dialstatus']));}}}catch(_0x4da12c){utils[_0x9814('0x13')](util['format'](_0x9814('0x22'),_0xa61fb0[_0x9814('0x4')]),_0x4da12c);}};exports['hangup']=function(_0x57dbea){try{if(!_[_0x9814('0x16')](dials[_0x57dbea[_0x9814('0x4')]])){utils[_0x9814('0xc')](util['format'](_0x9814('0x28'),_0x57dbea[_0x9814('0x4')]),_0x57dbea);utils[_0x9814('0x1')](util[_0x9814('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x57dbea[_0x9814('0x4')],_0x57dbea['calleridnum'],_0x57dbea['calleridname'],_0x57dbea[_0x9814('0x29')]));dials[_0x57dbea[_0x9814('0x4')]]=_[_0x9814('0x1b')](dials[_0x57dbea[_0x9814('0x4')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x57dbea[_0x9814('0x4')]][_0x9814('0x2a')]=utils['diffTime'](dials[_0x57dbea[_0x9814('0x4')]][_0x9814('0x2b')],dials[_0x57dbea[_0x9814('0x4')]][_0x9814('0x1c')]);dials[_0x57dbea['uniqueid']][_0x9814('0x2c')]=utils[_0x9814('0x2d')](dials[_0x57dbea[_0x9814('0x4')]][_0x9814('0x25')]||dials[_0x57dbea['uniqueid']]['endtime'],dials[_0x57dbea[_0x9814('0x4')]]['starttime']);dials[_0x57dbea[_0x9814('0x4')]][_0x9814('0x2e')]=dials[_0x57dbea[_0x9814('0x4')]][_0x9814('0x25')]?utils[_0x9814('0x2d')](dials[_0x57dbea[_0x9814('0x4')]][_0x9814('0x2b')],dials[_0x57dbea[_0x9814('0x4')]][_0x9814('0x25')]):0x0;writeDB(dials[_0x57dbea[_0x9814('0x4')]]);}}catch(_0x543f25){utils[_0x9814('0x13')](util[_0x9814('0x2')](_0x9814('0x28'),_0x57dbea[_0x9814('0x4')]),_0x543f25);}}; \ No newline at end of file +var _0x82a4=['complete','duration','diffTime','endtime','holdtime','billableseconds','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','starttime','now','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','assign','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','calleridnum','calleridname','cause-txt'];(function(_0x1dcb51,_0x512092){var _0x40184e=function(_0x5e756d){while(--_0x5e756d){_0x1dcb51['push'](_0x1dcb51['shift']());}};_0x40184e(++_0x512092);}(_0x82a4,0xd2));var _0x482a=function(_0x74060b,_0x4f4d40){_0x74060b=_0x74060b-0x0;var _0xb49647=_0x82a4[_0x74060b];return _0xb49647;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x482a('0x0'));var dials={};function writeDB(_0x4fd1cb){utils[_0x482a('0x1')](util['format'](_0x482a('0x2'),_0x4fd1cb[_0x482a('0x3')],_0x4fd1cb['channel'],_0x4fd1cb['dialstring'],_0x4fd1cb['calleridnum'],_0x4fd1cb[_0x482a('0x4')],_0x4fd1cb[_0x482a('0x5')]));utils[_0x482a('0x6')](_0x482a('0x7'),_0x4fd1cb);delete dials[_0x4fd1cb[_0x482a('0x3')]];}exports[_0x482a('0x8')]=function(_0x2462e5){try{utils[_0x482a('0x9')](util['format'](_0x482a('0xa'),_0x2462e5[_0x482a('0x3')]),_0x2462e5);utils[_0x482a('0x1')](util[_0x482a('0xb')](_0x482a('0xc'),_0x2462e5[_0x482a('0x3')],_0x2462e5['application'],_0x2462e5[_0x482a('0xd')]));if(_0x2462e5[_0x482a('0xe')][_0x482a('0xf')]()=='set'&&_[_0x482a('0x10')](_0x2462e5[_0x482a('0xd')]['toLowerCase'](),_0x482a('0x11'))){var _0x5082fe=_0x2462e5[_0x482a('0xd')][_0x482a('0x12')]('=');dials[_0x2462e5[_0x482a('0x3')]]={'routeId':_0x5082fe[0x1]};}}catch(_0x23c5eb){utils[_0x482a('0x13')](util[_0x482a('0xb')]('[%s][dials][newexten]',_0x2462e5[_0x482a('0x3')]),_0x23c5eb);}};exports[_0x482a('0x14')]=function(_0x19e758){try{utils[_0x482a('0x9')](util[_0x482a('0xb')](_0x482a('0x15'),_0x19e758[_0x482a('0x3')]),_0x19e758);if(!_[_0x482a('0x16')](_0x19e758[_0x482a('0x17')][_0x482a('0x18')])){utils[_0x482a('0x1')](util['format'](_0x482a('0x19'),_0x19e758[_0x482a('0x3')],_0x19e758[_0x482a('0x1a')]));dials[_0x19e758[_0x482a('0x3')]]={'routeId':_0x19e758[_0x482a('0x1a')]};}}catch(_0x273ba3){utils['error'](util['format'](_0x482a('0x15'),_0x19e758['uniqueid']),_0x273ba3);}};exports[_0x482a('0x1b')]=function(_0xf09d83){try{if(!_[_0x482a('0x16')](dials[_0xf09d83[_0x482a('0x3')]])){utils[_0x482a('0x9')](util[_0x482a('0xb')](_0x482a('0x1c'),_0xf09d83[_0x482a('0x3')]),_0xf09d83);dials[_0xf09d83['uniqueid']]=_['assign'](dials[_0xf09d83['uniqueid']],_0xf09d83);dials[_0xf09d83[_0x482a('0x3')]][_0x482a('0x1d')]=utils[_0x482a('0x1e')]();dials[_0xf09d83[_0x482a('0x3')]]['lastevent']='called';utils[_0x482a('0x1')](util[_0x482a('0xb')](_0x482a('0x1f'),_0xf09d83['uniqueid'],dials[_0xf09d83[_0x482a('0x3')]][_0x482a('0x1d')]));}}catch(_0x25668d){utils[_0x482a('0x13')](util[_0x482a('0xb')](_0x482a('0x1c'),_0xf09d83['uniqueid']),_0x25668d);}};exports[_0x482a('0x20')]=function(_0x365336){try{if(!_[_0x482a('0x16')](dials[_0x365336['uniqueid']])){utils[_0x482a('0x9')](util['format'](_0x482a('0x21'),_0x365336[_0x482a('0x3')]),_0x365336);dials[_0x365336['uniqueid']][_0x482a('0x5')]=_0x365336[_0x482a('0x5')];if(_0x365336[_0x482a('0x5')]==_0x482a('0x22')){dials[_0x365336[_0x482a('0x3')]]=_[_0x482a('0x23')](dials[_0x365336[_0x482a('0x3')]],_0x365336);dials[_0x365336['uniqueid']]['answertime']=utils['now']();dials[_0x365336[_0x482a('0x3')]][_0x482a('0x24')]=_0x482a('0x25');utils[_0x482a('0x1')](util[_0x482a('0xb')](_0x482a('0x26'),_0x365336['uniqueid'],_0x365336[_0x482a('0x5')],dials[_0x365336[_0x482a('0x3')]][_0x482a('0x27')]));}else{utils[_0x482a('0x1')](util['format'](_0x482a('0x28'),_0x365336['uniqueid'],_0x365336[_0x482a('0x5')]));}}}catch(_0x435fe0){utils['error'](util[_0x482a('0xb')](_0x482a('0x21'),_0x365336[_0x482a('0x3')]),_0x435fe0);}};exports['hangup']=function(_0x25f1d2){try{if(!_[_0x482a('0x16')](dials[_0x25f1d2[_0x482a('0x3')]])){utils[_0x482a('0x9')](util[_0x482a('0xb')](_0x482a('0x29'),_0x25f1d2[_0x482a('0x3')]),_0x25f1d2);utils[_0x482a('0x1')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x25f1d2[_0x482a('0x3')],_0x25f1d2[_0x482a('0x2a')],_0x25f1d2[_0x482a('0x2b')],_0x25f1d2[_0x482a('0x2c')]));dials[_0x25f1d2[_0x482a('0x3')]]=_[_0x482a('0x23')](dials[_0x25f1d2[_0x482a('0x3')]],{'endtime':utils[_0x482a('0x1e')](),'lastevent':_0x482a('0x2d')});dials[_0x25f1d2[_0x482a('0x3')]][_0x482a('0x2e')]=utils[_0x482a('0x2f')](dials[_0x25f1d2[_0x482a('0x3')]][_0x482a('0x30')],dials[_0x25f1d2[_0x482a('0x3')]]['starttime']);dials[_0x25f1d2[_0x482a('0x3')]][_0x482a('0x31')]=utils[_0x482a('0x2f')](dials[_0x25f1d2['uniqueid']][_0x482a('0x27')]||dials[_0x25f1d2[_0x482a('0x3')]][_0x482a('0x30')],dials[_0x25f1d2[_0x482a('0x3')]][_0x482a('0x1d')]);dials[_0x25f1d2[_0x482a('0x3')]][_0x482a('0x32')]=dials[_0x25f1d2['uniqueid']][_0x482a('0x27')]?utils['diffTime'](dials[_0x25f1d2[_0x482a('0x3')]][_0x482a('0x30')],dials[_0x25f1d2['uniqueid']][_0x482a('0x27')]):0x0;writeDB(dials[_0x25f1d2[_0x482a('0x3')]]);}}catch(_0x513090){utils[_0x482a('0x13')](util[_0x482a('0xb')](_0x482a('0x29'),_0x25f1d2[_0x482a('0x3')]),_0x513090);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 4d9f8b8..7e924e8 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 _0xde4b=['./core.controller','connect','shutdown','fullybooted','error','close','managerevent','[%s][index][devicestatechange]','device','devicestatechange','format','agentcalled','[%s][index][agentcalled]','agentringnoanswer','debug','[%s][index][agentringnoanswer]','uniqueid','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','asterisk','port','username','password','keepConnected','xdr','disabled','XDR\x20DISABLED','./queues.controller','./recordings.controller','./members.controller','./transfers.controller'];(function(_0x83285d,_0x21123b){var _0x21d926=function(_0x59802a){while(--_0x59802a){_0x83285d['push'](_0x83285d['shift']());}};_0x21d926(++_0x21123b);}(_0xde4b,0x189));var _0xbde4=function(_0xaa2b0d,_0x3a95b5){_0xaa2b0d=_0xaa2b0d-0x0;var _0x304ce5=_0xde4b[_0xaa2b0d];return _0x304ce5;};var AsteriskManager=require(_0xbde4('0x0'));var config=require(_0xbde4('0x1'));var utils=require(_0xbde4('0x2'));var util=require('util');var ami=new AsteriskManager(config[_0xbde4('0x3')][_0xbde4('0x4')],config['asterisk']['ip'],config[_0xbde4('0x3')][_0xbde4('0x5')],config['asterisk'][_0xbde4('0x6')],!![]);ami[_0xbde4('0x7')]();if(config[_0xbde4('0x8')]&&config[_0xbde4('0x8')][_0xbde4('0x9')]){utils['info'](_0xbde4('0xa'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0xbde4('0xb'));var recordings=require(_0xbde4('0xc'));var members=require(_0xbde4('0xd'));var dials=require('./dials.controller');var transfers=require(_0xbde4('0xe'));var core=require(_0xbde4('0xf'));ami['on']('connect',core[_0xbde4('0x10')]);ami['on'](_0xbde4('0x11'),core[_0xbde4('0x11')]);ami['on'](_0xbde4('0x12'),core[_0xbde4('0x12')]);ami['on']('error',core[_0xbde4('0x13')]);ami['on']('close',core[_0xbde4('0x14')]);ami['on'](_0xbde4('0x15'),core[_0xbde4('0x15')]);ami['on']('devicestatechange',function(_0x5164bf){try{utils['debug'](util['format'](_0xbde4('0x16'),_0x5164bf[_0xbde4('0x17')]),_0x5164bf);members[_0xbde4('0x18')](_0x5164bf);}catch(_0x498dad){utils[_0xbde4('0x13')](util[_0xbde4('0x19')]('[%s][index][devicestatechange]',_0x5164bf['device']),_0x498dad);}});ami['on'](_0xbde4('0x1a'),function(_0x3786fa){try{utils['debug'](util[_0xbde4('0x19')](_0xbde4('0x1b'),_0x3786fa['uniqueid']),_0x3786fa);agents[_0xbde4('0x1a')](_0x3786fa);}catch(_0x1989b5){utils[_0xbde4('0x13')](util[_0xbde4('0x19')](_0xbde4('0x1b'),_0x3786fa['uniqueid']),_0x1989b5);}});ami['on'](_0xbde4('0x1c'),function(_0x2e60a6){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x1e'),_0x2e60a6['uniqueid']),_0x2e60a6);agents[_0xbde4('0x1c')](_0x2e60a6);}catch(_0x42a3c1){utils[_0xbde4('0x13')](util[_0xbde4('0x19')](_0xbde4('0x1e'),_0x2e60a6[_0xbde4('0x1f')]),_0x42a3c1);}});ami['on'](_0xbde4('0x20'),function(_0x25656c){try{utils['debug'](util[_0xbde4('0x19')](_0xbde4('0x21'),_0x25656c[_0xbde4('0x1f')]),_0x25656c);agents['agentconnect'](_0x25656c);queues[_0xbde4('0x20')](_0x25656c);}catch(_0x1de6ac){utils[_0xbde4('0x13')](util[_0xbde4('0x19')]('[%s][index][agentconnect]',_0x25656c[_0xbde4('0x1f')]),_0x1de6ac);}});ami['on'](_0xbde4('0x22'),function(_0x1940a1){try{utils['debug'](util[_0xbde4('0x19')]('[%s][index][agentcomplete]',_0x1940a1[_0xbde4('0x1f')]),_0x1940a1);agents[_0xbde4('0x22')](_0x1940a1);queues['agentcomplete'](_0x1940a1);members[_0xbde4('0x22')](_0x1940a1);}catch(_0x20210a){utils[_0xbde4('0x13')](util[_0xbde4('0x19')](_0xbde4('0x23'),_0x1940a1['uniqueid']),_0x20210a);}});ami['on'](_0xbde4('0x24'),function(_0x182110){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x25'),_0x182110['uniqueid']),_0x182110);agents['queuecallerabandon'](_0x182110);queues[_0xbde4('0x24')](_0x182110);}catch(_0x24aee9){utils[_0xbde4('0x13')](util['format'](_0xbde4('0x25'),_0x182110['uniqueid']),_0x24aee9);}});ami['on'](_0xbde4('0x26'),function(_0x2b0386){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x27'),_0x2b0386[_0xbde4('0x1f')]),_0x2b0386);queues[_0xbde4('0x26')](_0x2b0386);recordings['queuecallerjoin'](_0x2b0386);}catch(_0x385088){utils['error'](util['format'](_0xbde4('0x27'),_0x2b0386[_0xbde4('0x1f')]),_0x385088);}});ami['on'](_0xbde4('0x28'),function(_0x10d0ca){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x29'),_0x10d0ca[_0xbde4('0x1f')]),_0x10d0ca);queues[_0xbde4('0x28')](_0x10d0ca);}catch(_0x1a0c81){utils[_0xbde4('0x13')](util[_0xbde4('0x19')]('[%s][index][queuecallerleave]',_0x10d0ca[_0xbde4('0x1f')]),_0x1a0c81);}});ami['on'](_0xbde4('0x2a'),function(_0x5f191b){try{utils['debug'](util[_0xbde4('0x19')](_0xbde4('0x2b'),_0x5f191b[_0xbde4('0x1f')]),_0x5f191b);queues[_0xbde4('0x2a')](_0x5f191b);calls[_0xbde4('0x2a')](_0x5f191b);}catch(_0x214ac3){utils[_0xbde4('0x13')](util[_0xbde4('0x19')]('[%s][index][musiconholdstart]',_0x5f191b[_0xbde4('0x1f')]),_0x214ac3);}});ami['on'](_0xbde4('0x2c'),function(_0x130cf3){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x2d'),_0x130cf3[_0xbde4('0x1f')]),_0x130cf3);queues[_0xbde4('0x2c')](_0x130cf3);calls[_0xbde4('0x2c')](_0x130cf3);}catch(_0x226924){utils[_0xbde4('0x13')](util[_0xbde4('0x19')](_0xbde4('0x2d'),_0x130cf3[_0xbde4('0x1f')]),_0x226924);}});ami['on'](_0xbde4('0x2e'),function(_0x5d9e83){try{utils[_0xbde4('0x1d')](util['format'](_0xbde4('0x2f'),_0x5d9e83[_0xbde4('0x1f')]),_0x5d9e83);calls[_0xbde4('0x2e')](_0x5d9e83);recordings[_0xbde4('0x2e')](_0x5d9e83);}catch(_0x23c047){utils[_0xbde4('0x13')](util[_0xbde4('0x19')](_0xbde4('0x2f'),_0x5d9e83[_0xbde4('0x1f')]),_0x23c047);}});ami['on'](_0xbde4('0x30'),function(_0x5bdc10){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x31'),_0x5bdc10['uniqueid']),_0x5bdc10);calls[_0xbde4('0x30')](_0x5bdc10);recordings['hangup'](_0x5bdc10);dials['hangup'](_0x5bdc10);agents[_0xbde4('0x30')](_0x5bdc10);queues[_0xbde4('0x30')](_0x5bdc10);}catch(_0x19919d){utils[_0xbde4('0x13')](util['format'](_0xbde4('0x31'),_0x5bdc10[_0xbde4('0x1f')]),_0x19919d);}});ami['on'](_0xbde4('0x32'),function(_0x277a52){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x33'),_0x277a52['uniqueid']),_0x277a52);members[_0xbde4('0x32')](_0x277a52);}catch(_0x5948bf){utils[_0xbde4('0x13')](util['format'](_0xbde4('0x33'),_0x277a52[_0xbde4('0x1f')]),_0x5948bf);}});ami['on'](_0xbde4('0x34'),function(_0x238088){try{utils['debug'](util[_0xbde4('0x19')](_0xbde4('0x35'),_0x238088[_0xbde4('0x1f')]),_0x238088);queues[_0xbde4('0x34')](_0x238088);agents[_0xbde4('0x34')](_0x238088);transfers[_0xbde4('0x34')](_0x238088);}catch(_0x7dda37){utils[_0xbde4('0x13')](util[_0xbde4('0x19')](_0xbde4('0x35'),_0x238088[_0xbde4('0x1f')]),_0x7dda37);}});ami['on'](_0xbde4('0x36'),function(_0x2b2d0b){try{utils['debug'](util['format'](_0xbde4('0x37'),_0x2b2d0b[_0xbde4('0x38')]),_0x2b2d0b);queues[_0xbde4('0x36')](_0x2b2d0b);transfers[_0xbde4('0x36')](_0x2b2d0b);agents['attendedtransfer'](_0x2b2d0b);calls[_0xbde4('0x36')](_0x2b2d0b);}catch(_0xe30307){utils['error'](util['format'](_0xbde4('0x37'),_0x2b2d0b[_0xbde4('0x38')]),_0xe30307);}});ami['on'](_0xbde4('0x39'),function(_0xab968c){try{utils[_0xbde4('0x1d')](util['format'](_0xbde4('0x3a'),_0xab968c['uniqueid']),_0xab968c);queues['varset'](_0xab968c);recordings['varset'](_0xab968c);calls['varset'](_0xab968c);dials[_0xbde4('0x39')](_0xab968c);}catch(_0xda68d8){utils['error'](util['format'](_0xbde4('0x3a'),_0xab968c[_0xbde4('0x1f')]),_0xda68d8);}});ami['on'](_0xbde4('0x3b'),function(_0x5025d1){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x3c'),_0x5025d1['uniqueid']),_0x5025d1);calls[_0xbde4('0x3b')](_0x5025d1);recordings[_0xbde4('0x3b')](_0x5025d1);dials[_0xbde4('0x3b')](_0x5025d1);}catch(_0x1c6cae){utils[_0xbde4('0x13')](util['format'](_0xbde4('0x3c'),_0x5025d1[_0xbde4('0x1f')]),_0x1c6cae);}});ami['on'](_0xbde4('0x3d'),function(_0x299b0c){try{utils[_0xbde4('0x1d')](util['format'](_0xbde4('0x3e'),_0x299b0c['uniqueid']),_0x299b0c);calls[_0xbde4('0x3d')](_0x299b0c);recordings[_0xbde4('0x3d')](_0x299b0c);}catch(_0x196dda){utils[_0xbde4('0x13')](util[_0xbde4('0x19')]('[%s][index][newchannel]',_0x299b0c['uniqueid']),_0x196dda);}});ami['on'](_0xbde4('0x3f'),function(_0x4c630a){try{utils[_0xbde4('0x1d')](util[_0xbde4('0x19')](_0xbde4('0x40'),_0x4c630a[_0xbde4('0x1f')]),_0x4c630a);dials[_0xbde4('0x3f')](_0x4c630a);}catch(_0x4d7adf){utils[_0xbde4('0x13')](util[_0xbde4('0x19')](_0xbde4('0x41'),_0x4c630a[_0xbde4('0x1f')]),_0x4d7adf);}});ami['on'](_0xbde4('0x42'),function(_0x8db5f0){try{utils[_0xbde4('0x1d')](util['format'](_0xbde4('0x43'),_0x8db5f0[_0xbde4('0x1f')]),_0x8db5f0);dials[_0xbde4('0x42')](_0x8db5f0);}catch(_0x524971){utils[_0xbde4('0x13')](util[_0xbde4('0x19')](_0xbde4('0x43'),_0x8db5f0[_0xbde4('0x1f')]),_0x524971);}});} \ No newline at end of file +var _0xa8db=['debug','device','format','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','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','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','port','username','password','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','shutdown','fullybooted','error','close','managerevent'];(function(_0x234c25,_0x11d5a6){var _0x521230=function(_0x490545){while(--_0x490545){_0x234c25['push'](_0x234c25['shift']());}};_0x521230(++_0x11d5a6);}(_0xa8db,0x141));var _0xba8d=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0xa8db[_0x305c31];return _0x17f39f;};var AsteriskManager=require(_0xba8d('0x0'));var config=require(_0xba8d('0x1'));var utils=require(_0xba8d('0x2'));var util=require(_0xba8d('0x3'));var ami=new AsteriskManager(config[_0xba8d('0x4')][_0xba8d('0x5')],config[_0xba8d('0x4')]['ip'],config[_0xba8d('0x4')][_0xba8d('0x6')],config[_0xba8d('0x4')][_0xba8d('0x7')],!![]);ami['keepConnected']();if(config[_0xba8d('0x8')]&&config[_0xba8d('0x8')][_0xba8d('0x9')]){utils[_0xba8d('0xa')](_0xba8d('0xb'));}else{var agents=require(_0xba8d('0xc'));var calls=require(_0xba8d('0xd'));var queues=require(_0xba8d('0xe'));var recordings=require(_0xba8d('0xf'));var members=require(_0xba8d('0x10'));var dials=require(_0xba8d('0x11'));var transfers=require('./transfers.controller');var core=require(_0xba8d('0x12'));ami['on']('connect',core['connect']);ami['on']('shutdown',core[_0xba8d('0x13')]);ami['on']('fullybooted',core[_0xba8d('0x14')]);ami['on'](_0xba8d('0x15'),core[_0xba8d('0x15')]);ami['on'](_0xba8d('0x16'),core[_0xba8d('0x16')]);ami['on'](_0xba8d('0x17'),core['managerevent']);ami['on']('devicestatechange',function(_0x1d13d8){try{utils[_0xba8d('0x18')](util['format']('[%s][index][devicestatechange]',_0x1d13d8[_0xba8d('0x19')]),_0x1d13d8);members['devicestatechange'](_0x1d13d8);}catch(_0x5b89fc){utils[_0xba8d('0x15')](util[_0xba8d('0x1a')](_0xba8d('0x1b'),_0x1d13d8[_0xba8d('0x19')]),_0x5b89fc);}});ami['on'](_0xba8d('0x1c'),function(_0x5f3716){try{utils['debug'](util['format']('[%s][index][agentcalled]',_0x5f3716['uniqueid']),_0x5f3716);agents[_0xba8d('0x1c')](_0x5f3716);}catch(_0x4697ad){utils[_0xba8d('0x15')](util[_0xba8d('0x1a')](_0xba8d('0x1d'),_0x5f3716[_0xba8d('0x1e')]),_0x4697ad);}});ami['on'](_0xba8d('0x1f'),function(_0x2b62a6){try{utils[_0xba8d('0x18')](util[_0xba8d('0x1a')](_0xba8d('0x20'),_0x2b62a6[_0xba8d('0x1e')]),_0x2b62a6);agents['agentringnoanswer'](_0x2b62a6);}catch(_0x51c65e){utils[_0xba8d('0x15')](util[_0xba8d('0x1a')](_0xba8d('0x20'),_0x2b62a6[_0xba8d('0x1e')]),_0x51c65e);}});ami['on'](_0xba8d('0x21'),function(_0x26104d){try{utils[_0xba8d('0x18')](util[_0xba8d('0x1a')](_0xba8d('0x22'),_0x26104d[_0xba8d('0x1e')]),_0x26104d);agents[_0xba8d('0x21')](_0x26104d);queues[_0xba8d('0x21')](_0x26104d);}catch(_0x1d8430){utils[_0xba8d('0x15')](util[_0xba8d('0x1a')](_0xba8d('0x22'),_0x26104d[_0xba8d('0x1e')]),_0x1d8430);}});ami['on'](_0xba8d('0x23'),function(_0x3835aa){try{utils[_0xba8d('0x18')](util[_0xba8d('0x1a')](_0xba8d('0x24'),_0x3835aa[_0xba8d('0x1e')]),_0x3835aa);agents[_0xba8d('0x23')](_0x3835aa);queues[_0xba8d('0x23')](_0x3835aa);members['agentcomplete'](_0x3835aa);}catch(_0x444353){utils[_0xba8d('0x15')](util['format']('[%s][index][agentcomplete]',_0x3835aa[_0xba8d('0x1e')]),_0x444353);}});ami['on'](_0xba8d('0x25'),function(_0x4fb84c){try{utils['debug'](util[_0xba8d('0x1a')](_0xba8d('0x26'),_0x4fb84c[_0xba8d('0x1e')]),_0x4fb84c);agents['queuecallerabandon'](_0x4fb84c);queues[_0xba8d('0x25')](_0x4fb84c);}catch(_0x2adb30){utils[_0xba8d('0x15')](util[_0xba8d('0x1a')](_0xba8d('0x26'),_0x4fb84c[_0xba8d('0x1e')]),_0x2adb30);}});ami['on']('queuecallerjoin',function(_0x5a37c7){try{utils[_0xba8d('0x18')](util[_0xba8d('0x1a')](_0xba8d('0x27'),_0x5a37c7[_0xba8d('0x1e')]),_0x5a37c7);queues[_0xba8d('0x28')](_0x5a37c7);recordings[_0xba8d('0x28')](_0x5a37c7);}catch(_0x3c3cac){utils[_0xba8d('0x15')](util[_0xba8d('0x1a')]('[%s][index][queuecallerjoin]',_0x5a37c7[_0xba8d('0x1e')]),_0x3c3cac);}});ami['on'](_0xba8d('0x29'),function(_0x256711){try{utils[_0xba8d('0x18')](util['format'](_0xba8d('0x2a'),_0x256711[_0xba8d('0x1e')]),_0x256711);queues['queuecallerleave'](_0x256711);}catch(_0x548f49){utils[_0xba8d('0x15')](util['format'](_0xba8d('0x2a'),_0x256711[_0xba8d('0x1e')]),_0x548f49);}});ami['on'](_0xba8d('0x2b'),function(_0x3d5bb0){try{utils[_0xba8d('0x18')](util[_0xba8d('0x1a')]('[%s][index][musiconholdstart]',_0x3d5bb0[_0xba8d('0x1e')]),_0x3d5bb0);queues[_0xba8d('0x2b')](_0x3d5bb0);calls[_0xba8d('0x2b')](_0x3d5bb0);}catch(_0x1e1f42){utils[_0xba8d('0x15')](util[_0xba8d('0x1a')](_0xba8d('0x2c'),_0x3d5bb0['uniqueid']),_0x1e1f42);}});ami['on'](_0xba8d('0x2d'),function(_0x3cd6ce){try{utils[_0xba8d('0x18')](util['format'](_0xba8d('0x2e'),_0x3cd6ce[_0xba8d('0x1e')]),_0x3cd6ce);queues[_0xba8d('0x2d')](_0x3cd6ce);calls[_0xba8d('0x2d')](_0x3cd6ce);}catch(_0x34da7b){utils[_0xba8d('0x15')](util[_0xba8d('0x1a')](_0xba8d('0x2e'),_0x3cd6ce[_0xba8d('0x1e')]),_0x34da7b);}});ami['on']('newstate',function(_0x57edb3){try{utils[_0xba8d('0x18')](util['format'](_0xba8d('0x2f'),_0x57edb3[_0xba8d('0x1e')]),_0x57edb3);calls[_0xba8d('0x30')](_0x57edb3);recordings[_0xba8d('0x30')](_0x57edb3);}catch(_0xa61d52){utils[_0xba8d('0x15')](util[_0xba8d('0x1a')](_0xba8d('0x2f'),_0x57edb3[_0xba8d('0x1e')]),_0xa61d52);}});ami['on']('hangup',function(_0xb68823){try{utils[_0xba8d('0x18')](util['format'](_0xba8d('0x31'),_0xb68823[_0xba8d('0x1e')]),_0xb68823);calls[_0xba8d('0x32')](_0xb68823);recordings[_0xba8d('0x32')](_0xb68823);dials[_0xba8d('0x32')](_0xb68823);agents['hangup'](_0xb68823);queues['hangup'](_0xb68823);}catch(_0x4550a4){utils[_0xba8d('0x15')](util[_0xba8d('0x1a')](_0xba8d('0x31'),_0xb68823[_0xba8d('0x1e')]),_0x4550a4);}});ami['on'](_0xba8d('0x33'),function(_0x2a61eb){try{utils[_0xba8d('0x18')](util[_0xba8d('0x1a')](_0xba8d('0x34'),_0x2a61eb[_0xba8d('0x1e')]),_0x2a61eb);members['cdr'](_0x2a61eb);}catch(_0x1c4881){utils[_0xba8d('0x15')](util[_0xba8d('0x1a')](_0xba8d('0x34'),_0x2a61eb[_0xba8d('0x1e')]),_0x1c4881);}});ami['on'](_0xba8d('0x35'),function(_0x3039d9){try{utils[_0xba8d('0x18')](util['format'](_0xba8d('0x36'),_0x3039d9[_0xba8d('0x1e')]),_0x3039d9);queues[_0xba8d('0x35')](_0x3039d9);agents['blindtransfer'](_0x3039d9);transfers['blindtransfer'](_0x3039d9);}catch(_0x4cec3e){utils['error'](util[_0xba8d('0x1a')](_0xba8d('0x36'),_0x3039d9[_0xba8d('0x1e')]),_0x4cec3e);}});ami['on'](_0xba8d('0x37'),function(_0x98cf0){try{utils[_0xba8d('0x18')](util[_0xba8d('0x1a')](_0xba8d('0x38'),_0x98cf0[_0xba8d('0x39')]),_0x98cf0);queues[_0xba8d('0x37')](_0x98cf0);transfers[_0xba8d('0x37')](_0x98cf0);agents['attendedtransfer'](_0x98cf0);calls[_0xba8d('0x37')](_0x98cf0);}catch(_0x4544a6){utils['error'](util[_0xba8d('0x1a')](_0xba8d('0x38'),_0x98cf0[_0xba8d('0x39')]),_0x4544a6);}});ami['on'](_0xba8d('0x3a'),function(_0x3697ab){try{utils[_0xba8d('0x18')](util[_0xba8d('0x1a')](_0xba8d('0x3b'),_0x3697ab[_0xba8d('0x1e')]),_0x3697ab);queues['varset'](_0x3697ab);recordings[_0xba8d('0x3a')](_0x3697ab);calls[_0xba8d('0x3a')](_0x3697ab);dials[_0xba8d('0x3a')](_0x3697ab);}catch(_0x31e870){utils[_0xba8d('0x15')](util['format'](_0xba8d('0x3b'),_0x3697ab[_0xba8d('0x1e')]),_0x31e870);}});ami['on']('newexten',function(_0xf48555){try{utils[_0xba8d('0x18')](util[_0xba8d('0x1a')](_0xba8d('0x3c'),_0xf48555['uniqueid']),_0xf48555);calls[_0xba8d('0x3d')](_0xf48555);recordings[_0xba8d('0x3d')](_0xf48555);dials['newexten'](_0xf48555);}catch(_0x1f600d){utils[_0xba8d('0x15')](util[_0xba8d('0x1a')]('[%s][index][newexten]',_0xf48555[_0xba8d('0x1e')]),_0x1f600d);}});ami['on'](_0xba8d('0x3e'),function(_0x58368a){try{utils[_0xba8d('0x18')](util[_0xba8d('0x1a')](_0xba8d('0x3f'),_0x58368a[_0xba8d('0x1e')]),_0x58368a);calls[_0xba8d('0x3e')](_0x58368a);recordings[_0xba8d('0x3e')](_0x58368a);}catch(_0x575d22){utils[_0xba8d('0x15')](util['format']('[%s][index][newchannel]',_0x58368a['uniqueid']),_0x575d22);}});ami['on']('dialbegin',function(_0x5842cd){try{utils[_0xba8d('0x18')](util[_0xba8d('0x1a')](_0xba8d('0x40'),_0x5842cd[_0xba8d('0x1e')]),_0x5842cd);dials[_0xba8d('0x41')](_0x5842cd);}catch(_0x459524){utils[_0xba8d('0x15')](util[_0xba8d('0x1a')](_0xba8d('0x42'),_0x5842cd[_0xba8d('0x1e')]),_0x459524);}});ami['on'](_0xba8d('0x43'),function(_0x6632d6){try{utils[_0xba8d('0x18')](util[_0xba8d('0x1a')](_0xba8d('0x44'),_0x6632d6[_0xba8d('0x1e')]),_0x6632d6);dials[_0xba8d('0x43')](_0x6632d6);}catch(_0x33bad7){utils[_0xba8d('0x15')](util[_0xba8d('0x1a')](_0xba8d('0x44'),_0x6632d6[_0xba8d('0x1e')]),_0x33bad7);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 7361849..828a7d8 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 _0x1fe2=['isNil','exitAt','duration','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data3','destination','data1','destinationchannel','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','name','getUserByName','split','internal','request','CreateMemberReport','error','[%s][members][writeDB]','uniqueid','devicestatechange','debug','[%s][members][devicestatechange]','device','state','BUSY','voice','TALKING','now','NOT_INUSE'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x1fe2,0x72));var _0x21fe=function(_0x4d9253,_0x24c0e9){_0x4d9253=_0x4d9253-0x0;var _0x529cc5=_0x1fe2[_0x4d9253];return _0x529cc5;};'use strict';var _=require(_0x21fe('0x0'));var util=require(_0x21fe('0x1'));var utils=require(_0x21fe('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x21fe('0x3')];function writeDB(_0x315b11){utils[_0x21fe('0x4')](util[_0x21fe('0x5')](_0x21fe('0x6'),_0x315b11['uniqueid'],_0x315b11[_0x21fe('0x7')],_0x315b11[_0x21fe('0x8')],_0x315b11[_0x21fe('0x9')],_0x315b11[_0x21fe('0xa')],_0x315b11[_0x21fe('0xb')]));if(_0x315b11['interface']){utils[_0x21fe('0xc')](_0x315b11[_0x21fe('0x7')])[_0x21fe('0xd')](function(_0x1d8720){if(_0x1d8720){_0x315b11['membername']=_0x1d8720[_0x21fe('0xe')];_0x315b11['internal']=_0x1d8720['internal'];utils['request']('CreateMemberReport',_0x315b11);}else{utils[_0x21fe('0xf')](_0x315b11[_0x21fe('0x7')][_0x21fe('0x10')]('/')[0x1])['then'](function(_0x27d5ab){if(_0x27d5ab){_0x315b11[_0x21fe('0xa')]=_0x27d5ab[_0x21fe('0xe')];_0x315b11['internal']=_0x27d5ab[_0x21fe('0x11')];utils[_0x21fe('0x12')](_0x21fe('0x13'),_0x315b11);}});}})['catch'](function(_0x3d63a4){utils[_0x21fe('0x14')](util[_0x21fe('0x5')](_0x21fe('0x15'),_0x315b11[_0x21fe('0x16')]),_0x3d63a4);});}delete members[_0x315b11[_0x21fe('0x7')]];}function startsWith(_0x1fa00c,_0x38d9ab){return _['some'](_0x1fa00c,function(_0x15f42c){return _['startsWith'](_0x38d9ab,_0x15f42c);});}exports[_0x21fe('0x17')]=function(_0x3fa079){try{utils[_0x21fe('0x18')](util[_0x21fe('0x5')](_0x21fe('0x19'),members[_0x3fa079[_0x21fe('0x1a')]]?members[_0x3fa079[_0x21fe('0x1a')]][_0x21fe('0x16')]:_0x3fa079[_0x21fe('0x1a')]),_0x3fa079);utils['info'](util[_0x21fe('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x3fa079[_0x21fe('0x1a')]]?members[_0x3fa079[_0x21fe('0x1a')]][_0x21fe('0x16')]:_0x3fa079[_0x21fe('0x1a')],_0x3fa079[_0x21fe('0x1b')],_0x3fa079[_0x21fe('0x1a')]));switch(_0x3fa079[_0x21fe('0x1b')]){case'INUSE':case _0x21fe('0x1c'):if(!startsWith(exclude,_0x3fa079[_0x21fe('0x1a')])){members[_0x3fa079[_0x21fe('0x1a')]]={'channel':_0x21fe('0x1d'),'interface':_0x3fa079[_0x21fe('0x1a')],'type':_0x21fe('0x1e'),'enterAt':utils[_0x21fe('0x1f')](),'role':'agent'};}break;case _0x21fe('0x20'):if(!_[_0x21fe('0x21')](members[_0x3fa079[_0x21fe('0x1a')]])){members[_0x3fa079[_0x21fe('0x1a')]][_0x21fe('0x22')]=utils[_0x21fe('0x1f')]();members[_0x3fa079[_0x21fe('0x1a')]][_0x21fe('0x23')]=utils[_0x21fe('0x24')](members[_0x3fa079[_0x21fe('0x1a')]][_0x21fe('0x22')],members[_0x3fa079[_0x21fe('0x1a')]][_0x21fe('0x25')]);if(members[_0x3fa079[_0x21fe('0x1a')]][_0x21fe('0x16')]){writeDB(members[_0x3fa079['device']]);}}break;default:break;}}catch(_0x33372f){utils[_0x21fe('0x14')](util['format']('[%s][members][devicestatechange]',members[_0x3fa079[_0x21fe('0x1a')]]?members[_0x3fa079[_0x21fe('0x1a')]]['uniqueid']:_0x3fa079[_0x21fe('0x1a')]),_0x33372f);}};exports['agentcomplete']=function(_0x5acd67){try{if(!_[_0x21fe('0x21')](members[_0x5acd67['interface']])){utils[_0x21fe('0x18')](util[_0x21fe('0x5')](_0x21fe('0x26'),_0x5acd67[_0x21fe('0x16')]),_0x5acd67);utils[_0x21fe('0x4')](util[_0x21fe('0x5')](_0x21fe('0x27'),_0x5acd67[_0x21fe('0x16')],_0x5acd67[_0x21fe('0x7')],_0x5acd67[_0x21fe('0x28')]));members[_0x5acd67[_0x21fe('0x7')]]=_[_0x21fe('0x29')](members[_0x5acd67[_0x21fe('0x7')]],{'data4':_0x5acd67['queue'],'uniqueid':_0x5acd67[_0x21fe('0x16')]});}}catch(_0x5ac779){utils[_0x21fe('0x14')](util[_0x21fe('0x5')](_0x21fe('0x26'),_0x5acd67[_0x21fe('0x16')]),_0x5ac779);}};exports['cdr']=function(_0x42781d){try{utils[_0x21fe('0x18')](util[_0x21fe('0x5')](_0x21fe('0x2a'),_0x42781d[_0x21fe('0x16')]),_0x42781d);if(_0x42781d[_0x21fe('0x8')]){var _0x3090ab=_0x42781d['channel'][_0x21fe('0x10')]('-')[0x0];if(!_[_0x21fe('0x21')](members[_0x3090ab])){members[_0x3090ab]=_['assign'](members[_0x3090ab],{'data1':members[_0x3090ab]['data1']||_0x42781d[_0x21fe('0xb')],'data2':members[_0x3090ab][_0x21fe('0x9')]||_0x42781d['source'],'data3':members[_0x3090ab][_0x21fe('0x2b')]||_0x42781d[_0x21fe('0x2c')],'uniqueid':members[_0x3090ab][_0x21fe('0x16')]||_0x42781d[_0x21fe('0x16')]});utils[_0x21fe('0x4')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x42781d[_0x21fe('0x16')],members[_0x3090ab][_0x21fe('0x2d')],members[_0x3090ab][_0x21fe('0x9')],members[_0x3090ab][_0x21fe('0x2b')]));if(members[_0x3090ab][_0x21fe('0x22')]){writeDB(members[_0x3090ab]);}}}if(_0x42781d['destinationchannel']){var _0x209556=_0x42781d[_0x21fe('0x2e')][_0x21fe('0x10')]('-')[0x0];if(!_[_0x21fe('0x21')](members[_0x209556])){members[_0x209556]=_['assign'](members[_0x209556],{'data1':members[_0x209556][_0x21fe('0x2d')]||_0x42781d[_0x21fe('0xb')],'data2':members[_0x209556]['data2']||_0x42781d[_0x21fe('0x2f')],'data3':members[_0x209556][_0x21fe('0x2b')]||_0x42781d[_0x21fe('0x2c')],'uniqueid':members[_0x209556][_0x21fe('0x16')]||_0x42781d[_0x21fe('0x16')]});utils[_0x21fe('0x4')](util['format'](_0x21fe('0x30'),_0x42781d[_0x21fe('0x16')],members[_0x209556]['data1'],members[_0x209556][_0x21fe('0x9')],members[_0x209556][_0x21fe('0x2b')]));if(members[_0x209556][_0x21fe('0x22')]){writeDB(members[_0x209556]);}}}}catch(_0x3c43b6){utils[_0x21fe('0x14')](util[_0x21fe('0x5')](_0x21fe('0x2a'),_0x42781d[_0x21fe('0x16')]),_0x3c43b6);}}; \ No newline at end of file +var _0x1455=['format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','now','exitAt','duration','diffTime','enterAt','agentcomplete','isNil','debug','[%s][members][agentcomplete]','queue','error','cdr','[%s][members][cdr]','channel','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','assign','lodash','util','./utils','Queue:','info'];(function(_0x848e40,_0x1b8239){var _0x19b524=function(_0x364589){while(--_0x364589){_0x848e40['push'](_0x848e40['shift']());}};_0x19b524(++_0x1b8239);}(_0x1455,0x97));var _0x5145=function(_0x7e77a3,_0x11c994){_0x7e77a3=_0x7e77a3-0x0;var _0x2cfb61=_0x1455[_0x7e77a3];return _0x2cfb61;};'use strict';var _=require(_0x5145('0x0'));var util=require(_0x5145('0x1'));var utils=require(_0x5145('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x5145('0x3')];function writeDB(_0x3b3228){utils[_0x5145('0x4')](util[_0x5145('0x5')](_0x5145('0x6'),_0x3b3228[_0x5145('0x7')],_0x3b3228[_0x5145('0x8')],_0x3b3228['channel'],_0x3b3228[_0x5145('0x9')],_0x3b3228[_0x5145('0xa')],_0x3b3228[_0x5145('0xb')]));if(_0x3b3228['interface']){utils[_0x5145('0xc')](_0x3b3228[_0x5145('0x8')])[_0x5145('0xd')](function(_0x3a0dfc){if(_0x3a0dfc){_0x3b3228['membername']=_0x3a0dfc[_0x5145('0xe')];_0x3b3228[_0x5145('0xf')]=_0x3a0dfc[_0x5145('0xf')];utils[_0x5145('0x10')](_0x5145('0x11'),_0x3b3228);}else{utils[_0x5145('0x12')](_0x3b3228[_0x5145('0x8')][_0x5145('0x13')]('/')[0x1])[_0x5145('0xd')](function(_0x1667dc){if(_0x1667dc){_0x3b3228[_0x5145('0xa')]=_0x1667dc[_0x5145('0xe')];_0x3b3228[_0x5145('0xf')]=_0x1667dc[_0x5145('0xf')];utils['request'](_0x5145('0x11'),_0x3b3228);}});}})['catch'](function(_0x3bd5ab){utils['error'](util[_0x5145('0x5')](_0x5145('0x14'),_0x3b3228[_0x5145('0x7')]),_0x3bd5ab);});}delete members[_0x3b3228['interface']];}function startsWith(_0x3ec453,_0x1c3f0c){return _[_0x5145('0x15')](_0x3ec453,function(_0x3b8555){return _[_0x5145('0x16')](_0x1c3f0c,_0x3b8555);});}exports[_0x5145('0x17')]=function(_0x51a4f7){try{utils['debug'](util[_0x5145('0x5')](_0x5145('0x18'),members[_0x51a4f7['device']]?members[_0x51a4f7[_0x5145('0x19')]]['uniqueid']:_0x51a4f7[_0x5145('0x19')]),_0x51a4f7);utils[_0x5145('0x4')](util['format'](_0x5145('0x1a'),members[_0x51a4f7['device']]?members[_0x51a4f7[_0x5145('0x19')]][_0x5145('0x7')]:_0x51a4f7[_0x5145('0x19')],_0x51a4f7[_0x5145('0x1b')],_0x51a4f7[_0x5145('0x19')]));switch(_0x51a4f7['state']){case _0x5145('0x1c'):case'BUSY':if(!startsWith(exclude,_0x51a4f7[_0x5145('0x19')])){members[_0x51a4f7['device']]={'channel':_0x5145('0x1d'),'interface':_0x51a4f7[_0x5145('0x19')],'type':_0x5145('0x1e'),'enterAt':utils[_0x5145('0x1f')](),'role':'agent'};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x51a4f7[_0x5145('0x19')]])){members[_0x51a4f7[_0x5145('0x19')]][_0x5145('0x20')]=utils['now']();members[_0x51a4f7[_0x5145('0x19')]][_0x5145('0x21')]=utils[_0x5145('0x22')](members[_0x51a4f7['device']]['exitAt'],members[_0x51a4f7[_0x5145('0x19')]][_0x5145('0x23')]);if(members[_0x51a4f7[_0x5145('0x19')]][_0x5145('0x7')]){writeDB(members[_0x51a4f7['device']]);}}break;default:break;}}catch(_0x50657e){utils['error'](util[_0x5145('0x5')](_0x5145('0x18'),members[_0x51a4f7[_0x5145('0x19')]]?members[_0x51a4f7[_0x5145('0x19')]][_0x5145('0x7')]:_0x51a4f7[_0x5145('0x19')]),_0x50657e);}};exports[_0x5145('0x24')]=function(_0x19360c){try{if(!_[_0x5145('0x25')](members[_0x19360c[_0x5145('0x8')]])){utils[_0x5145('0x26')](util[_0x5145('0x5')](_0x5145('0x27'),_0x19360c[_0x5145('0x7')]),_0x19360c);utils[_0x5145('0x4')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x19360c[_0x5145('0x7')],_0x19360c[_0x5145('0x8')],_0x19360c[_0x5145('0x28')]));members[_0x19360c[_0x5145('0x8')]]=_['assign'](members[_0x19360c[_0x5145('0x8')]],{'data4':_0x19360c[_0x5145('0x28')],'uniqueid':_0x19360c[_0x5145('0x7')]});}}catch(_0x465129){utils[_0x5145('0x29')](util[_0x5145('0x5')](_0x5145('0x27'),_0x19360c[_0x5145('0x7')]),_0x465129);}};exports[_0x5145('0x2a')]=function(_0x1df5f3){try{utils['debug'](util[_0x5145('0x5')](_0x5145('0x2b'),_0x1df5f3[_0x5145('0x7')]),_0x1df5f3);if(_0x1df5f3[_0x5145('0x2c')]){var _0x554743=_0x1df5f3[_0x5145('0x2c')][_0x5145('0x13')]('-')[0x0];if(!_['isNil'](members[_0x554743])){members[_0x554743]=_['assign'](members[_0x554743],{'data1':members[_0x554743][_0x5145('0x2d')]||_0x1df5f3[_0x5145('0xb')],'data2':members[_0x554743][_0x5145('0x9')]||_0x1df5f3[_0x5145('0x2e')],'data3':members[_0x554743][_0x5145('0x2f')]||_0x1df5f3[_0x5145('0x30')],'uniqueid':members[_0x554743][_0x5145('0x7')]||_0x1df5f3[_0x5145('0x7')]});utils[_0x5145('0x4')](util[_0x5145('0x5')](_0x5145('0x31'),_0x1df5f3[_0x5145('0x7')],members[_0x554743]['data1'],members[_0x554743]['data2'],members[_0x554743][_0x5145('0x2f')]));if(members[_0x554743][_0x5145('0x20')]){writeDB(members[_0x554743]);}}}if(_0x1df5f3['destinationchannel']){var _0x429ace=_0x1df5f3[_0x5145('0x32')][_0x5145('0x13')]('-')[0x0];if(!_[_0x5145('0x25')](members[_0x429ace])){members[_0x429ace]=_[_0x5145('0x33')](members[_0x429ace],{'data1':members[_0x429ace][_0x5145('0x2d')]||_0x1df5f3['type'],'data2':members[_0x429ace][_0x5145('0x9')]||_0x1df5f3[_0x5145('0x2e')],'data3':members[_0x429ace][_0x5145('0x2f')]||_0x1df5f3[_0x5145('0x30')],'uniqueid':members[_0x429ace][_0x5145('0x7')]||_0x1df5f3[_0x5145('0x7')]});utils[_0x5145('0x4')](util[_0x5145('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1df5f3[_0x5145('0x7')],members[_0x429ace][_0x5145('0x2d')],members[_0x429ace][_0x5145('0x9')],members[_0x429ace][_0x5145('0x2f')]));if(members[_0x429ace][_0x5145('0x20')]){writeDB(members[_0x429ace]);}}}}catch(_0x1044ed){utils['error'](util[_0x5145('0x5')](_0x5145('0x2b'),_0x1df5f3[_0x5145('0x7')]),_0x1044ed);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 7d8487a..dc26f8b 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 _0xe647=['position','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','now','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','ABANDONED','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','agentcomplete','assigned','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','origtransfererlinkedid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s'];(function(_0x599361,_0x402973){var _0x5370d1=function(_0x34ba6b){while(--_0x34ba6b){_0x599361['push'](_0x599361['shift']());}};_0x5370d1(++_0x402973);}(_0xe647,0xc2));var _0x7e64=function(_0x4414fb,_0x4d5b34){_0x4414fb=_0x4414fb-0x0;var _0x3f7335=_0xe647[_0x4414fb];return _0x3f7335;};'use strict';var _=require(_0x7e64('0x0'));var util=require(_0x7e64('0x1'));var utils=require(_0x7e64('0x2'));var queues={};function writeDB(_0x43cd25){utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x5'),_0x43cd25[_0x7e64('0x6')],_0x43cd25[_0x7e64('0x7')],_0x43cd25[_0x7e64('0x8')],_0x43cd25['lastAssignedTo'],_0x43cd25[_0x7e64('0x9')],_0x43cd25[_0x7e64('0xa')],_0x43cd25[_0x7e64('0xb')]));if(_0x43cd25[_0x7e64('0x8')]){utils[_0x7e64('0xc')](_0x43cd25[_0x7e64('0x8')])['then'](function(_0x288097){if(_0x288097){_0x43cd25[_0x7e64('0xd')]=_0x288097[_0x7e64('0xd')];}utils['request']('CreateVoiceQueueReport',_0x43cd25);});}else{utils[_0x7e64('0xe')]('CreateVoiceQueueReport',_0x43cd25);}if(_0x43cd25['transfereduniqueid']){delete queues[_0x43cd25[_0x7e64('0xf')]];}else{delete queues[_0x43cd25[_0x7e64('0x6')]];}}exports[_0x7e64('0x10')]=function(_0x497354){try{utils[_0x7e64('0x11')](util[_0x7e64('0x4')](_0x7e64('0x12'),_0x497354[_0x7e64('0x6')]),_0x497354);utils[_0x7e64('0x3')](util['format'](_0x7e64('0x13'),_0x497354[_0x7e64('0x6')],_0x497354[_0x7e64('0x8')],_0x497354[_0x7e64('0x14')]));queues[_0x497354[_0x7e64('0x6')]]=_['assign'](_0x497354,{'originalposition':_0x497354[_0x7e64('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x3bdb94){utils[_0x7e64('0x15')](util[_0x7e64('0x4')](_0x7e64('0x12'),_0x497354[_0x7e64('0x6')]),_0x3bdb94);}};exports[_0x7e64('0x16')]=function(_0x3caf77){try{if(!_[_0x7e64('0x17')](queues[_0x3caf77['uniqueid']])){utils[_0x7e64('0x11')](util[_0x7e64('0x4')](_0x7e64('0x18'),_0x3caf77[_0x7e64('0x6')]),_0x3caf77);if(queues[_0x3caf77['uniqueid']][_0x7e64('0x19')]){if(!queues[_0x3caf77[_0x7e64('0x6')]][_0x7e64('0x1a')]&&!queues[_0x3caf77['uniqueid']][_0x7e64('0x1b')]){queues[_0x3caf77['uniqueid']][_0x7e64('0x1c')]=!![];queues[_0x3caf77['uniqueid']][_0x7e64('0x1d')]=utils['now']();queues[_0x3caf77[_0x7e64('0x6')]][_0x7e64('0xb')]=_0x7e64('0x1e');}utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x1f'),_0x3caf77[_0x7e64('0x6')],queues[_0x3caf77['uniqueid']][_0x7e64('0x20')],queues[_0x3caf77[_0x7e64('0x6')]][_0x7e64('0xb')]));writeDB(queues[_0x3caf77[_0x7e64('0x6')]]);}else if(queues[_0x3caf77['uniqueid']]['transfereduniqueid']){utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x21'),_0x3caf77[_0x7e64('0x6')],queues[_0x3caf77['uniqueid']][_0x7e64('0x20')],queues[_0x3caf77[_0x7e64('0x6')]][_0x7e64('0xf')]));queues[queues[_0x3caf77[_0x7e64('0x6')]][_0x7e64('0xf')]]=queues[_0x3caf77['uniqueid']];queues[queues[_0x3caf77[_0x7e64('0x6')]]['transfereduniqueid']][_0x7e64('0x22')]=0x2;delete queues[_0x3caf77['uniqueid']];}}}catch(_0x1137e9){utils[_0x7e64('0x15')](util[_0x7e64('0x4')](_0x7e64('0x18'),_0x3caf77[_0x7e64('0x6')]),_0x1137e9);}};exports[_0x7e64('0x23')]=function(_0x370425){try{utils[_0x7e64('0x11')](util[_0x7e64('0x4')](_0x7e64('0x24'),_0x370425['uniqueid']),_0x370425);if(!_[_0x7e64('0x17')](_0x370425[_0x7e64('0x25')][_0x7e64('0x26')])&&_0x370425[_0x7e64('0x27')][_0x7e64('0x28')]()!==_0x7e64('0x29')){if(!_[_0x7e64('0x17')](queues[_0x370425[_0x7e64('0x6')]])){queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0x1a')]=![];queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0x2a')]=null;queues[_0x370425['uniqueid']]['queuecallerexit']=!![];queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0x2b')]=utils[_0x7e64('0x2c')]();queues[_0x370425['uniqueid']][_0x7e64('0xb')]=_0x370425[_0x7e64('0x27')]['toUpperCase']();utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x2d'),_0x370425['uniqueid'],queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0x20')],_0x370425['value'],queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0xb')]));writeDB(queues[_0x370425[_0x7e64('0x6')]]);}}else if(!_[_0x7e64('0x17')](_0x370425[_0x7e64('0x25')][_0x7e64('0x2e')])){if(!_['isNil'](queues[_0x370425[_0x7e64('0x6')]])&&!queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0x1a')]){queues[_0x370425['uniqueid']][_0x7e64('0x1a')]=![];queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0x2a')]=null;queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0x1b')]=!![];queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0x2b')]=utils[_0x7e64('0x2c')]();queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0xb')]=_0x7e64('0x2f');utils[_0x7e64('0x3')](util[_0x7e64('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x370425[_0x7e64('0x6')],queues[_0x370425['uniqueid']][_0x7e64('0x20')],_0x370425[_0x7e64('0x27')],queues[_0x370425[_0x7e64('0x6')]][_0x7e64('0xb')]));}}}catch(_0x2e17ec){utils[_0x7e64('0x15')](util[_0x7e64('0x4')](_0x7e64('0x24'),_0x370425['uniqueid']),_0x2e17ec);}};exports[_0x7e64('0x1a')]=function(_0x424755){try{if(!_[_0x7e64('0x17')](queues[_0x424755['uniqueid']])){utils[_0x7e64('0x11')](util['format']('[%s][queues][queuecallerabandon]',_0x424755[_0x7e64('0x6')]),_0x424755);queues[_0x424755[_0x7e64('0x6')]][_0x7e64('0x1b')]=![];queues[_0x424755[_0x7e64('0x6')]][_0x7e64('0x2b')]=null;queues[_0x424755['uniqueid']][_0x7e64('0x1a')]=!![];queues[_0x424755[_0x7e64('0x6')]][_0x7e64('0x2a')]=utils['now']();queues[_0x424755[_0x7e64('0x6')]][_0x7e64('0xb')]=_0x7e64('0x30');utils['info'](util[_0x7e64('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x424755[_0x7e64('0x6')],queues[_0x424755[_0x7e64('0x6')]]['name'],queues[_0x424755['uniqueid']][_0x7e64('0xb')]));}}catch(_0x2bc173){utils['error'](util['format'](_0x7e64('0x31'),_0x424755[_0x7e64('0x6')]),_0x2bc173);}};exports['queuecallerleave']=function(_0x10bf7d){try{if(!_[_0x7e64('0x17')](queues[_0x10bf7d[_0x7e64('0x6')]])){utils[_0x7e64('0x11')](util[_0x7e64('0x4')](_0x7e64('0x32'),_0x10bf7d[_0x7e64('0x6')]),_0x10bf7d);utils['info'](util[_0x7e64('0x4')](_0x7e64('0x33'),_0x10bf7d[_0x7e64('0x6')],queues[_0x10bf7d[_0x7e64('0x6')]]['name'],_0x10bf7d[_0x7e64('0x34')],_0x10bf7d[_0x7e64('0x35')]));queues[_0x10bf7d[_0x7e64('0x6')]][_0x7e64('0x36')]=!![];queues[_0x10bf7d[_0x7e64('0x6')]]['queuecallerleaveAt']=utils[_0x7e64('0x2c')]();queues[_0x10bf7d['uniqueid']][_0x7e64('0x37')]=utils['diffTime'](queues[_0x10bf7d[_0x7e64('0x6')]]['queuecallerleaveAt'],queues[_0x10bf7d['uniqueid']][_0x7e64('0x38')]);queues[_0x10bf7d[_0x7e64('0x6')]][_0x7e64('0x14')]=_0x10bf7d[_0x7e64('0x14')];queues[_0x10bf7d[_0x7e64('0x6')]][_0x7e64('0x39')]=_0x10bf7d[_0x7e64('0x39')];queues[_0x10bf7d[_0x7e64('0x6')]]['connectedlinenum']=_0x10bf7d[_0x7e64('0x34')];queues[_0x10bf7d['uniqueid']][_0x7e64('0x35')]=_0x10bf7d['connectedlinename'];}}catch(_0x30b1b8){utils[_0x7e64('0x15')](util[_0x7e64('0x4')](_0x7e64('0x32'),_0x10bf7d[_0x7e64('0x6')]),_0x30b1b8);}};exports[_0x7e64('0x3a')]=function(_0x50dec5){try{if(!_[_0x7e64('0x17')](queues[_0x50dec5[_0x7e64('0x6')]])){utils[_0x7e64('0x11')](util[_0x7e64('0x4')](_0x7e64('0x3b'),_0x50dec5[_0x7e64('0x6')]),_0x50dec5);utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x3c'),_0x50dec5[_0x7e64('0x6')],queues[_0x50dec5[_0x7e64('0x6')]][_0x7e64('0x20')],_0x50dec5[_0x7e64('0x3d')],_0x50dec5[_0x7e64('0x3e')]));queues[_0x50dec5[_0x7e64('0x6')]][_0x7e64('0x1a')]=![];queues[_0x50dec5['uniqueid']][_0x7e64('0x1a')]=![];queues[_0x50dec5['uniqueid']]['queuecallerabandonAt']=null;queues[_0x50dec5['uniqueid']][_0x7e64('0x1b')]=![];queues[_0x50dec5[_0x7e64('0x6')]][_0x7e64('0xb')]=null;queues[_0x50dec5[_0x7e64('0x6')]]['queuecallerexitAt']=null;queues[_0x50dec5[_0x7e64('0x6')]]['assigned']=!![];queues[_0x50dec5[_0x7e64('0x6')]]['accountcode']=_0x50dec5[_0x7e64('0x3e')];queues[_0x50dec5[_0x7e64('0x6')]][_0x7e64('0x3f')]=_0x50dec5[_0x7e64('0x3d')];}}catch(_0x4d4661){utils[_0x7e64('0x15')](util[_0x7e64('0x4')](_0x7e64('0x3b'),_0x50dec5[_0x7e64('0x6')]),_0x4d4661);}};exports[_0x7e64('0x40')]=function(_0x58b13b){try{if(!_['isNil'](queues[_0x58b13b['uniqueid']])){if(queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0x19')]){utils[_0x7e64('0x11')](util[_0x7e64('0x4')]('[%s][queues][agentcomplete]',_0x58b13b[_0x7e64('0x6')]),_0x58b13b);queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0x1a')]=![];queues[_0x58b13b['uniqueid']][_0x7e64('0x1a')]=![];queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0x2a')]=null;queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0x1b')]=![];queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0x2b')]=null;queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0x41')]=!![];queues[_0x58b13b['uniqueid']][_0x7e64('0x3f')]=_0x58b13b[_0x7e64('0x3d')];queues[_0x58b13b[_0x7e64('0x6')]]['queuecallercomplete']=!![];queues[_0x58b13b['uniqueid']]['queuecallercompleteAt']=utils['now']();if(_0x58b13b['reason']==_0x7e64('0x42')){if(!queues[_0x58b13b[_0x7e64('0x6')]]['transfer']){queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0xb')]=_0x7e64('0x43');}}else{queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0xb')]=_0x7e64('0x44')+_0x58b13b[_0x7e64('0x45')][_0x7e64('0x28')]();}utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x46'),_0x58b13b[_0x7e64('0x6')],queues[_0x58b13b['uniqueid']][_0x7e64('0x20')],_0x58b13b[_0x7e64('0x3d')],queues[_0x58b13b[_0x7e64('0x6')]][_0x7e64('0xb')]));writeDB(queues[_0x58b13b[_0x7e64('0x6')]]);}}}catch(_0xfbcfd4){utils['error'](util['format'](_0x7e64('0x47'),_0x58b13b[_0x7e64('0x6')]),_0xfbcfd4);}};exports[_0x7e64('0x48')]=function(_0x33983b){try{if(!_['isNil'](queues[_0x33983b['transfereeuniqueid']])){utils[_0x7e64('0x11')](util['format'](_0x7e64('0x49'),_0x33983b[_0x7e64('0x6')]),_0x33983b);queues[_0x33983b['transfereeuniqueid']][_0x7e64('0x42')]=!![];queues[_0x33983b[_0x7e64('0x4a')]][_0x7e64('0x4b')]=_0x7e64('0x4c');queues[_0x33983b[_0x7e64('0x4a')]][_0x7e64('0x4d')]=_0x33983b[_0x7e64('0x4e')];queues[_0x33983b['transfereeuniqueid']]['transferuniqueid']=_0x33983b[_0x7e64('0x4a')];queues[_0x33983b[_0x7e64('0x4a')]]['queuecallerexitreason']=_0x7e64('0x4f');utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x50'),_0x33983b[_0x7e64('0x6')],queues[_0x33983b[_0x7e64('0x4a')]][_0x7e64('0x20')],_0x33983b[_0x7e64('0x4a')],_0x33983b[_0x7e64('0x4e')]));}}catch(_0x3d430c){utils[_0x7e64('0x15')](util[_0x7e64('0x4')](_0x7e64('0x49'),_0x33983b[_0x7e64('0x6')]),_0x3d430c);}};exports[_0x7e64('0x51')]=function(_0x4179f4){try{utils['debug'](util[_0x7e64('0x4')]('[%s][queues][attendedtransfer]',_0x4179f4[_0x7e64('0x52')]),_0x4179f4);if(_0x4179f4[_0x7e64('0x52')]==_0x4179f4['origtransfererlinkedid']){if(!_[_0x7e64('0x17')](queues[_0x4179f4[_0x7e64('0x53')]])){utils[_0x7e64('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4179f4[_0x7e64('0x52')],queues[_0x4179f4[_0x7e64('0x53')]][_0x7e64('0x20')],_0x4179f4[_0x7e64('0x54')]));queues[_0x4179f4[_0x7e64('0x53')]][_0x7e64('0x42')]=!![];queues[_0x4179f4[_0x7e64('0x53')]]['transfertype']=_0x7e64('0x55');queues[_0x4179f4[_0x7e64('0x53')]][_0x7e64('0x4d')]=_0x4179f4[_0x7e64('0x54')];queues[_0x4179f4[_0x7e64('0x53')]][_0x7e64('0x56')]=_0x4179f4['origtransfereruniqueid'];queues[_0x4179f4[_0x7e64('0x53')]]['queuecallerexitreason']=_0x7e64('0x57');}if(!_[_0x7e64('0x17')](queues[_0x4179f4['origtransfererlinkedid']])){if(_0x4179f4[_0x7e64('0x58')]&&queues[_0x4179f4[_0x7e64('0x58')]]){queues[_0x4179f4[_0x7e64('0x58')]][_0x7e64('0x22')]=0x1;queues[_0x4179f4['transfereeuniqueid']]=_['clone'](queues[_0x4179f4['transfereelinkedid']]);queues[_0x4179f4['transfereeuniqueid']][_0x7e64('0xf')]=_0x4179f4['transfertargetuniqueid'];queues[_0x4179f4[_0x7e64('0x4a')]][_0x7e64('0x22')]=0x2;queues[_0x4179f4[_0x7e64('0x4a')]]['calleridnum']=queues[_0x4179f4[_0x7e64('0x53')]][_0x7e64('0x9')];queues[_0x4179f4['transfereeuniqueid']]['calleridname']=queues[_0x4179f4['secondtransfererlinkedid']][_0x7e64('0x59')];queues[_0x4179f4[_0x7e64('0x4a')]][_0x7e64('0x38')]=utils['now']();queues[_0x4179f4[_0x7e64('0x4a')]][_0x7e64('0x19')]=utils[_0x7e64('0x2c')]();queues[_0x4179f4[_0x7e64('0x4a')]][_0x7e64('0x37')]=0x0;queues[_0x4179f4[_0x7e64('0x4a')]][_0x7e64('0x5a')]=0x0;utils['info'](util[_0x7e64('0x4')](_0x7e64('0x5b'),_0x4179f4[_0x7e64('0x52')],queues[_0x4179f4[_0x7e64('0x4a')]]['name'],queues[_0x4179f4['transfereeuniqueid']][_0x7e64('0x9')],queues[_0x4179f4['transfereeuniqueid']][_0x7e64('0x59')]));}else{utils['info'](util[_0x7e64('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x4179f4[_0x7e64('0x52')],queues[_0x4179f4[_0x7e64('0x5c')]][_0x7e64('0x20')],_0x4179f4[_0x7e64('0x53')]));queues[_0x4179f4[_0x7e64('0x5c')]][_0x7e64('0xf')]=_0x4179f4['secondtransfererlinkedid'];}}}else if(_0x4179f4[_0x7e64('0x5d')]==_0x4179f4['secondtransfererlinkedid']){if(!_[_0x7e64('0x17')](queues[_0x4179f4[_0x7e64('0x5c')]])){utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x5e'),_0x4179f4[_0x7e64('0x52')],queues[_0x4179f4['origtransfererlinkedid']][_0x7e64('0x20')],_0x4179f4[_0x7e64('0x5d')],_0x4179f4[_0x7e64('0x5f')]));queues[_0x4179f4[_0x7e64('0x5c')]][_0x7e64('0x42')]=!![];queues[_0x4179f4[_0x7e64('0x5c')]][_0x7e64('0x4b')]=_0x7e64('0x55');queues[_0x4179f4[_0x7e64('0x5c')]][_0x7e64('0x4d')]=_0x4179f4[_0x7e64('0x5f')];queues[_0x4179f4['origtransfererlinkedid']][_0x7e64('0x56')]=_0x4179f4[_0x7e64('0x5d')];queues[_0x4179f4[_0x7e64('0x5c')]][_0x7e64('0xb')]=_0x7e64('0x57');}if(!_[_0x7e64('0x17')](queues[_0x4179f4['secondtransfererlinkedid']])){if(_0x4179f4['transfertargetlinkedid']&&queues[_0x4179f4['transfertargetlinkedid']]){queues[_0x4179f4[_0x7e64('0x60')]][_0x7e64('0x22')]=0x1;queues[_0x4179f4[_0x7e64('0x61')]]=_[_0x7e64('0x62')](queues[_0x4179f4['transfertargetlinkedid']]);queues[_0x4179f4[_0x7e64('0x61')]][_0x7e64('0xf')]=_0x4179f4[_0x7e64('0x61')];queues[_0x4179f4[_0x7e64('0x61')]][_0x7e64('0x22')]=0x2;queues[_0x4179f4['transfertargetuniqueid']]['calleridnum']=queues[_0x4179f4['origtransfererlinkedid']]['calleridnum'];queues[_0x4179f4[_0x7e64('0x61')]][_0x7e64('0x59')]=queues[_0x4179f4[_0x7e64('0x5c')]][_0x7e64('0x59')];queues[_0x4179f4[_0x7e64('0x61')]][_0x7e64('0x38')]=utils[_0x7e64('0x2c')]();queues[_0x4179f4['transfertargetuniqueid']][_0x7e64('0x19')]=utils[_0x7e64('0x2c')]();queues[_0x4179f4[_0x7e64('0x61')]][_0x7e64('0x37')]=0x0;queues[_0x4179f4['transfertargetuniqueid']][_0x7e64('0x5a')]=0x0;utils[_0x7e64('0x3')](util[_0x7e64('0x4')](_0x7e64('0x63'),_0x4179f4['origtransfereruniqueid'],queues[_0x4179f4[_0x7e64('0x61')]][_0x7e64('0x20')],queues[_0x4179f4[_0x7e64('0x61')]]['transfereduniqueid'],queues[_0x4179f4[_0x7e64('0x61')]][_0x7e64('0x9')],queues[_0x4179f4[_0x7e64('0x61')]][_0x7e64('0x59')]));}else{utils['info'](util[_0x7e64('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x4179f4[_0x7e64('0x52')],queues[_0x4179f4['secondtransfererlinkedid']][_0x7e64('0x20')],_0x4179f4[_0x7e64('0x5c')]));queues[_0x4179f4[_0x7e64('0x53')]][_0x7e64('0xf')]=_0x4179f4[_0x7e64('0x5c')];}}}}catch(_0x3ce4e5){utils[_0x7e64('0x15')](util['format'](_0x7e64('0x64'),_0x4179f4[_0x7e64('0x52')]),_0x3ce4e5);}};exports['musiconholdstart']=function(_0x41a2e8){try{if(!_[_0x7e64('0x17')](queues[_0x41a2e8['uniqueid']])){utils['debug'](util[_0x7e64('0x4')](_0x7e64('0x65'),_0x41a2e8[_0x7e64('0x6')]),_0x41a2e8);queues[_0x41a2e8[_0x7e64('0x6')]][_0x7e64('0x66')]=utils[_0x7e64('0x2c')]();utils[_0x7e64('0x3')](util['format'](_0x7e64('0x67'),_0x41a2e8[_0x7e64('0x6')],queues[_0x41a2e8[_0x7e64('0x6')]][_0x7e64('0x20')],queues[_0x41a2e8[_0x7e64('0x6')]]['musiconholdstartAt']));}}catch(_0x4e52fe){utils[_0x7e64('0x15')](util[_0x7e64('0x4')](_0x7e64('0x65'),_0x41a2e8[_0x7e64('0x6')]),_0x4e52fe);}};exports[_0x7e64('0x68')]=function(_0x21f19a){try{if(!_[_0x7e64('0x17')](queues[_0x21f19a[_0x7e64('0x6')]])){if(!_[_0x7e64('0x17')](queues[_0x21f19a[_0x7e64('0x6')]][_0x7e64('0x66')])){utils['debug'](util['format']('[%s][queues][musiconholdstop]',_0x21f19a['uniqueid']),_0x21f19a);queues[_0x21f19a['uniqueid']][_0x7e64('0x5a')]+=utils['diffTime'](utils[_0x7e64('0x2c')](),queues[_0x21f19a[_0x7e64('0x6')]][_0x7e64('0x66')]);utils['info'](util[_0x7e64('0x4')](_0x7e64('0x69'),_0x21f19a[_0x7e64('0x6')],queues[_0x21f19a[_0x7e64('0x6')]][_0x7e64('0x20')],queues[_0x21f19a[_0x7e64('0x6')]][_0x7e64('0x5a')]));delete queues[_0x21f19a[_0x7e64('0x6')]]['musiconholdstartAt'];}}}catch(_0x28c2a3){utils[_0x7e64('0x15')](util[_0x7e64('0x4')](_0x7e64('0x6a'),_0x21f19a[_0x7e64('0x6')]),_0x28c2a3);}}; \ No newline at end of file +var _0x3721=['format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','isNil','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','agentcomplete','membername','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','uniqueid','channel','lastAssignedTo','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin'];(function(_0x3a5ae1,_0x21c1b8){var _0x4a25a8=function(_0x39e425){while(--_0x39e425){_0x3a5ae1['push'](_0x3a5ae1['shift']());}};_0x4a25a8(++_0x21c1b8);}(_0x3721,0x134));var _0x1372=function(_0xabe5ea,_0x2e1b43){_0xabe5ea=_0xabe5ea-0x0;var _0x3f3306=_0x3721[_0xabe5ea];return _0x3f3306;};'use strict';var _=require(_0x1372('0x0'));var util=require('util');var utils=require(_0x1372('0x1'));var queues={};function writeDB(_0x45eef3){utils[_0x1372('0x2')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x45eef3[_0x1372('0x3')],_0x45eef3[_0x1372('0x4')],_0x45eef3['queue'],_0x45eef3[_0x1372('0x5')],_0x45eef3['calleridnum'],_0x45eef3[_0x1372('0x6')],_0x45eef3[_0x1372('0x7')]));if(_0x45eef3[_0x1372('0x8')]){utils[_0x1372('0x9')](_0x45eef3['queue'])[_0x1372('0xa')](function(_0x47beff){if(_0x47beff){_0x45eef3[_0x1372('0xb')]=_0x47beff[_0x1372('0xb')];}utils[_0x1372('0xc')](_0x1372('0xd'),_0x45eef3);});}else{utils[_0x1372('0xc')](_0x1372('0xd'),_0x45eef3);}if(_0x45eef3[_0x1372('0xe')]){delete queues[_0x45eef3['transfereduniqueid']];}else{delete queues[_0x45eef3['uniqueid']];}}exports[_0x1372('0xf')]=function(_0x363924){try{utils['debug'](util[_0x1372('0x10')](_0x1372('0x11'),_0x363924['uniqueid']),_0x363924);utils[_0x1372('0x2')](util[_0x1372('0x10')](_0x1372('0x12'),_0x363924['uniqueid'],_0x363924[_0x1372('0x8')],_0x363924[_0x1372('0x13')]));queues[_0x363924['uniqueid']]=_[_0x1372('0x14')](_0x363924,{'originalposition':_0x363924[_0x1372('0x13')],'queuecallerjoinAt':utils[_0x1372('0x15')](),'mohtime':0x0});}catch(_0x2f600a){utils[_0x1372('0x16')](util['format'](_0x1372('0x11'),_0x363924[_0x1372('0x3')]),_0x2f600a);}};exports[_0x1372('0x17')]=function(_0xb3dfd3){try{if(!_['isNil'](queues[_0xb3dfd3[_0x1372('0x3')]])){utils[_0x1372('0x18')](util[_0x1372('0x10')](_0x1372('0x19'),_0xb3dfd3[_0x1372('0x3')]),_0xb3dfd3);if(queues[_0xb3dfd3[_0x1372('0x3')]][_0x1372('0x1a')]){if(!queues[_0xb3dfd3[_0x1372('0x3')]][_0x1372('0x1b')]&&!queues[_0xb3dfd3[_0x1372('0x3')]][_0x1372('0x1c')]){queues[_0xb3dfd3[_0x1372('0x3')]][_0x1372('0x1d')]=!![];queues[_0xb3dfd3[_0x1372('0x3')]][_0x1372('0x1e')]=utils[_0x1372('0x15')]();queues[_0xb3dfd3[_0x1372('0x3')]][_0x1372('0x7')]='COMPLETEDBYAGENT';}utils[_0x1372('0x2')](util[_0x1372('0x10')](_0x1372('0x1f'),_0xb3dfd3[_0x1372('0x3')],queues[_0xb3dfd3[_0x1372('0x3')]][_0x1372('0x20')],queues[_0xb3dfd3[_0x1372('0x3')]][_0x1372('0x7')]));writeDB(queues[_0xb3dfd3['uniqueid']]);}else if(queues[_0xb3dfd3['uniqueid']][_0x1372('0xe')]){utils[_0x1372('0x2')](util[_0x1372('0x10')](_0x1372('0x21'),_0xb3dfd3[_0x1372('0x3')],queues[_0xb3dfd3[_0x1372('0x3')]]['name'],queues[_0xb3dfd3[_0x1372('0x3')]]['transfereduniqueid']));queues[queues[_0xb3dfd3[_0x1372('0x3')]]['transfereduniqueid']]=queues[_0xb3dfd3[_0x1372('0x3')]];queues[queues[_0xb3dfd3[_0x1372('0x3')]][_0x1372('0xe')]][_0x1372('0x22')]=0x2;delete queues[_0xb3dfd3['uniqueid']];}}}catch(_0x8c20bc){utils[_0x1372('0x16')](util[_0x1372('0x10')](_0x1372('0x19'),_0xb3dfd3[_0x1372('0x3')]),_0x8c20bc);}};exports['varset']=function(_0x58f456){try{utils[_0x1372('0x18')](util[_0x1372('0x10')](_0x1372('0x23'),_0x58f456[_0x1372('0x3')]),_0x58f456);if(!_[_0x1372('0x24')](_0x58f456['variable'][_0x1372('0x25')])&&_0x58f456[_0x1372('0x26')][_0x1372('0x27')]()!==_0x1372('0x28')){if(!_[_0x1372('0x24')](queues[_0x58f456[_0x1372('0x3')]])){queues[_0x58f456[_0x1372('0x3')]][_0x1372('0x1b')]=![];queues[_0x58f456[_0x1372('0x3')]][_0x1372('0x29')]=null;queues[_0x58f456[_0x1372('0x3')]][_0x1372('0x1c')]=!![];queues[_0x58f456['uniqueid']][_0x1372('0x2a')]=utils[_0x1372('0x15')]();queues[_0x58f456[_0x1372('0x3')]][_0x1372('0x7')]=_0x58f456[_0x1372('0x26')]['toUpperCase']();utils[_0x1372('0x2')](util[_0x1372('0x10')](_0x1372('0x2b'),_0x58f456[_0x1372('0x3')],queues[_0x58f456[_0x1372('0x3')]]['name'],_0x58f456[_0x1372('0x26')],queues[_0x58f456[_0x1372('0x3')]][_0x1372('0x7')]));writeDB(queues[_0x58f456[_0x1372('0x3')]]);}}else if(!_[_0x1372('0x24')](_0x58f456[_0x1372('0x2c')]['queueposition'])){if(!_['isNil'](queues[_0x58f456[_0x1372('0x3')]])&&!queues[_0x58f456[_0x1372('0x3')]]['queuecallerabandon']){queues[_0x58f456['uniqueid']]['queuecallerabandon']=![];queues[_0x58f456[_0x1372('0x3')]]['queuecallerabandonAt']=null;queues[_0x58f456[_0x1372('0x3')]][_0x1372('0x1c')]=!![];queues[_0x58f456[_0x1372('0x3')]][_0x1372('0x2a')]=utils[_0x1372('0x15')]();queues[_0x58f456[_0x1372('0x3')]][_0x1372('0x7')]=_0x1372('0x2d');utils[_0x1372('0x2')](util[_0x1372('0x10')](_0x1372('0x2e'),_0x58f456[_0x1372('0x3')],queues[_0x58f456[_0x1372('0x3')]][_0x1372('0x20')],_0x58f456['value'],queues[_0x58f456[_0x1372('0x3')]][_0x1372('0x7')]));}}}catch(_0x4384e2){utils[_0x1372('0x16')](util[_0x1372('0x10')]('[%s][queues][varset]',_0x58f456['uniqueid']),_0x4384e2);}};exports[_0x1372('0x1b')]=function(_0x393335){try{if(!_[_0x1372('0x24')](queues[_0x393335['uniqueid']])){utils['debug'](util[_0x1372('0x10')](_0x1372('0x2f'),_0x393335[_0x1372('0x3')]),_0x393335);queues[_0x393335[_0x1372('0x3')]][_0x1372('0x1c')]=![];queues[_0x393335['uniqueid']][_0x1372('0x2a')]=null;queues[_0x393335[_0x1372('0x3')]][_0x1372('0x1b')]=!![];queues[_0x393335['uniqueid']][_0x1372('0x29')]=utils[_0x1372('0x15')]();queues[_0x393335[_0x1372('0x3')]][_0x1372('0x7')]=_0x1372('0x30');utils[_0x1372('0x2')](util[_0x1372('0x10')](_0x1372('0x31'),_0x393335[_0x1372('0x3')],queues[_0x393335[_0x1372('0x3')]]['name'],queues[_0x393335[_0x1372('0x3')]]['queuecallerexitreason']));}}catch(_0x2c507b){utils[_0x1372('0x16')](util[_0x1372('0x10')](_0x1372('0x2f'),_0x393335[_0x1372('0x3')]),_0x2c507b);}};exports['queuecallerleave']=function(_0xc1d647){try{if(!_[_0x1372('0x24')](queues[_0xc1d647['uniqueid']])){utils[_0x1372('0x18')](util[_0x1372('0x10')](_0x1372('0x32'),_0xc1d647[_0x1372('0x3')]),_0xc1d647);utils['info'](util[_0x1372('0x10')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xc1d647[_0x1372('0x3')],queues[_0xc1d647[_0x1372('0x3')]]['name'],_0xc1d647[_0x1372('0x33')],_0xc1d647[_0x1372('0x34')]));queues[_0xc1d647[_0x1372('0x3')]][_0x1372('0x35')]=!![];queues[_0xc1d647[_0x1372('0x3')]][_0x1372('0x1a')]=utils['now']();queues[_0xc1d647['uniqueid']][_0x1372('0x36')]=utils[_0x1372('0x37')](queues[_0xc1d647[_0x1372('0x3')]]['queuecallerleaveAt'],queues[_0xc1d647[_0x1372('0x3')]][_0x1372('0x38')]);queues[_0xc1d647['uniqueid']]['position']=_0xc1d647['position'];queues[_0xc1d647['uniqueid']][_0x1372('0x39')]=_0xc1d647[_0x1372('0x39')];queues[_0xc1d647['uniqueid']][_0x1372('0x33')]=_0xc1d647[_0x1372('0x33')];queues[_0xc1d647['uniqueid']][_0x1372('0x34')]=_0xc1d647[_0x1372('0x34')];}}catch(_0x1095ba){utils[_0x1372('0x16')](util['format']('[%s][queues][queuecallerleave]',_0xc1d647[_0x1372('0x3')]),_0x1095ba);}};exports['agentconnect']=function(_0x14cae8){try{if(!_[_0x1372('0x24')](queues[_0x14cae8[_0x1372('0x3')]])){utils[_0x1372('0x18')](util[_0x1372('0x10')](_0x1372('0x3a'),_0x14cae8[_0x1372('0x3')]),_0x14cae8);utils[_0x1372('0x2')](util[_0x1372('0x10')](_0x1372('0x3b'),_0x14cae8[_0x1372('0x3')],queues[_0x14cae8['uniqueid']][_0x1372('0x20')],_0x14cae8['membername'],_0x14cae8[_0x1372('0x3c')]));queues[_0x14cae8['uniqueid']][_0x1372('0x1b')]=![];queues[_0x14cae8[_0x1372('0x3')]][_0x1372('0x1b')]=![];queues[_0x14cae8['uniqueid']][_0x1372('0x29')]=null;queues[_0x14cae8[_0x1372('0x3')]][_0x1372('0x1c')]=![];queues[_0x14cae8[_0x1372('0x3')]][_0x1372('0x7')]=null;queues[_0x14cae8['uniqueid']]['queuecallerexitAt']=null;queues[_0x14cae8[_0x1372('0x3')]][_0x1372('0x3d')]=!![];queues[_0x14cae8[_0x1372('0x3')]]['accountcode']=_0x14cae8[_0x1372('0x3c')];queues[_0x14cae8[_0x1372('0x3')]][_0x1372('0x5')]=_0x14cae8['membername'];}}catch(_0x21d5bf){utils[_0x1372('0x16')](util[_0x1372('0x10')](_0x1372('0x3a'),_0x14cae8[_0x1372('0x3')]),_0x21d5bf);}};exports[_0x1372('0x3e')]=function(_0x22f165){try{if(!_['isNil'](queues[_0x22f165[_0x1372('0x3')]])){if(queues[_0x22f165[_0x1372('0x3')]][_0x1372('0x1a')]){utils[_0x1372('0x18')](util[_0x1372('0x10')]('[%s][queues][agentcomplete]',_0x22f165['uniqueid']),_0x22f165);queues[_0x22f165['uniqueid']][_0x1372('0x1b')]=![];queues[_0x22f165[_0x1372('0x3')]][_0x1372('0x1b')]=![];queues[_0x22f165['uniqueid']][_0x1372('0x29')]=null;queues[_0x22f165[_0x1372('0x3')]][_0x1372('0x1c')]=![];queues[_0x22f165['uniqueid']][_0x1372('0x2a')]=null;queues[_0x22f165['uniqueid']][_0x1372('0x3d')]=!![];queues[_0x22f165[_0x1372('0x3')]]['lastAssignedTo']=_0x22f165[_0x1372('0x3f')];queues[_0x22f165[_0x1372('0x3')]][_0x1372('0x1d')]=!![];queues[_0x22f165[_0x1372('0x3')]]['queuecallercompleteAt']=utils[_0x1372('0x15')]();if(_0x22f165['reason']==_0x1372('0x40')){if(!queues[_0x22f165[_0x1372('0x3')]]['transfer']){queues[_0x22f165[_0x1372('0x3')]][_0x1372('0x7')]=_0x1372('0x41');}}else{queues[_0x22f165[_0x1372('0x3')]][_0x1372('0x7')]=_0x1372('0x42')+_0x22f165[_0x1372('0x43')][_0x1372('0x27')]();}utils[_0x1372('0x2')](util[_0x1372('0x10')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x22f165[_0x1372('0x3')],queues[_0x22f165[_0x1372('0x3')]][_0x1372('0x20')],_0x22f165[_0x1372('0x3f')],queues[_0x22f165[_0x1372('0x3')]][_0x1372('0x7')]));writeDB(queues[_0x22f165[_0x1372('0x3')]]);}}}catch(_0x459fe0){utils[_0x1372('0x16')](util[_0x1372('0x10')](_0x1372('0x44'),_0x22f165[_0x1372('0x3')]),_0x459fe0);}};exports[_0x1372('0x45')]=function(_0x5968e6){try{if(!_['isNil'](queues[_0x5968e6[_0x1372('0x46')]])){utils[_0x1372('0x18')](util['format'](_0x1372('0x47'),_0x5968e6[_0x1372('0x3')]),_0x5968e6);queues[_0x5968e6[_0x1372('0x46')]][_0x1372('0x40')]=!![];queues[_0x5968e6['transfereeuniqueid']]['transfertype']=_0x1372('0x48');queues[_0x5968e6[_0x1372('0x46')]][_0x1372('0x49')]=_0x5968e6[_0x1372('0x4a')];queues[_0x5968e6[_0x1372('0x46')]][_0x1372('0x4b')]=_0x5968e6[_0x1372('0x46')];queues[_0x5968e6[_0x1372('0x46')]][_0x1372('0x7')]=_0x1372('0x4c');utils[_0x1372('0x2')](util[_0x1372('0x10')](_0x1372('0x4d'),_0x5968e6[_0x1372('0x3')],queues[_0x5968e6[_0x1372('0x46')]]['name'],_0x5968e6[_0x1372('0x46')],_0x5968e6[_0x1372('0x4a')]));}}catch(_0x14698a){utils['error'](util['format'](_0x1372('0x47'),_0x5968e6[_0x1372('0x3')]),_0x14698a);}};exports[_0x1372('0x4e')]=function(_0x6808e8){try{utils[_0x1372('0x18')](util[_0x1372('0x10')](_0x1372('0x4f'),_0x6808e8['origtransfereruniqueid']),_0x6808e8);if(_0x6808e8[_0x1372('0x50')]==_0x6808e8[_0x1372('0x51')]){if(!_[_0x1372('0x24')](queues[_0x6808e8[_0x1372('0x52')]])){utils[_0x1372('0x2')](util[_0x1372('0x10')](_0x1372('0x53'),_0x6808e8[_0x1372('0x50')],queues[_0x6808e8[_0x1372('0x52')]][_0x1372('0x20')],_0x6808e8[_0x1372('0x54')]));queues[_0x6808e8[_0x1372('0x52')]]['transfer']=!![];queues[_0x6808e8[_0x1372('0x52')]][_0x1372('0x55')]=_0x1372('0x56');queues[_0x6808e8[_0x1372('0x52')]][_0x1372('0x49')]=_0x6808e8[_0x1372('0x54')];queues[_0x6808e8[_0x1372('0x52')]][_0x1372('0x4b')]=_0x6808e8[_0x1372('0x50')];queues[_0x6808e8['secondtransfererlinkedid']][_0x1372('0x7')]=_0x1372('0x57');}if(!_[_0x1372('0x24')](queues[_0x6808e8[_0x1372('0x51')]])){if(_0x6808e8['transfereelinkedid']&&queues[_0x6808e8['transfereelinkedid']]){queues[_0x6808e8[_0x1372('0x58')]]['queuecallerenterreason']=0x1;queues[_0x6808e8[_0x1372('0x46')]]=_[_0x1372('0x59')](queues[_0x6808e8['transfereelinkedid']]);queues[_0x6808e8['transfereeuniqueid']][_0x1372('0xe')]=_0x6808e8[_0x1372('0x5a')];queues[_0x6808e8['transfereeuniqueid']][_0x1372('0x22')]=0x2;queues[_0x6808e8[_0x1372('0x46')]][_0x1372('0x5b')]=queues[_0x6808e8['secondtransfererlinkedid']][_0x1372('0x5b')];queues[_0x6808e8[_0x1372('0x46')]]['calleridname']=queues[_0x6808e8[_0x1372('0x52')]][_0x1372('0x5c')];queues[_0x6808e8['transfereeuniqueid']][_0x1372('0x38')]=utils[_0x1372('0x15')]();queues[_0x6808e8['transfereeuniqueid']][_0x1372('0x1a')]=utils[_0x1372('0x15')]();queues[_0x6808e8[_0x1372('0x46')]]['holdtime']=0x0;queues[_0x6808e8[_0x1372('0x46')]][_0x1372('0x5d')]=0x0;utils[_0x1372('0x2')](util['format'](_0x1372('0x5e'),_0x6808e8[_0x1372('0x50')],queues[_0x6808e8[_0x1372('0x46')]][_0x1372('0x20')],queues[_0x6808e8['transfereeuniqueid']][_0x1372('0x5b')],queues[_0x6808e8[_0x1372('0x46')]][_0x1372('0x5c')]));}else{utils[_0x1372('0x2')](util[_0x1372('0x10')](_0x1372('0x5f'),_0x6808e8['origtransfereruniqueid'],queues[_0x6808e8[_0x1372('0x51')]][_0x1372('0x20')],_0x6808e8['secondtransfererlinkedid']));queues[_0x6808e8[_0x1372('0x51')]][_0x1372('0xe')]=_0x6808e8['secondtransfererlinkedid'];}}}else if(_0x6808e8[_0x1372('0x60')]==_0x6808e8[_0x1372('0x52')]){if(!_[_0x1372('0x24')](queues[_0x6808e8[_0x1372('0x51')]])){utils[_0x1372('0x2')](util['format'](_0x1372('0x61'),_0x6808e8[_0x1372('0x50')],queues[_0x6808e8[_0x1372('0x51')]]['name'],_0x6808e8['secondtransfereruniqueid'],_0x6808e8[_0x1372('0x62')]));queues[_0x6808e8[_0x1372('0x51')]][_0x1372('0x40')]=!![];queues[_0x6808e8[_0x1372('0x51')]][_0x1372('0x55')]=_0x1372('0x56');queues[_0x6808e8[_0x1372('0x51')]]['transferexten']=_0x6808e8['secondtransfererexten'];queues[_0x6808e8[_0x1372('0x51')]]['transferuniqueid']=_0x6808e8['secondtransfereruniqueid'];queues[_0x6808e8[_0x1372('0x51')]][_0x1372('0x7')]=_0x1372('0x57');}if(!_[_0x1372('0x24')](queues[_0x6808e8['secondtransfererlinkedid']])){if(_0x6808e8[_0x1372('0x63')]&&queues[_0x6808e8[_0x1372('0x63')]]){queues[_0x6808e8[_0x1372('0x63')]][_0x1372('0x22')]=0x1;queues[_0x6808e8[_0x1372('0x5a')]]=_[_0x1372('0x59')](queues[_0x6808e8['transfertargetlinkedid']]);queues[_0x6808e8[_0x1372('0x5a')]][_0x1372('0xe')]=_0x6808e8['transfertargetuniqueid'];queues[_0x6808e8[_0x1372('0x5a')]][_0x1372('0x22')]=0x2;queues[_0x6808e8[_0x1372('0x5a')]][_0x1372('0x5b')]=queues[_0x6808e8[_0x1372('0x51')]][_0x1372('0x5b')];queues[_0x6808e8[_0x1372('0x5a')]][_0x1372('0x5c')]=queues[_0x6808e8[_0x1372('0x51')]]['calleridname'];queues[_0x6808e8['transfertargetuniqueid']][_0x1372('0x38')]=utils[_0x1372('0x15')]();queues[_0x6808e8[_0x1372('0x5a')]][_0x1372('0x1a')]=utils['now']();queues[_0x6808e8[_0x1372('0x5a')]]['holdtime']=0x0;queues[_0x6808e8[_0x1372('0x5a')]][_0x1372('0x5d')]=0x0;utils[_0x1372('0x2')](util[_0x1372('0x10')](_0x1372('0x64'),_0x6808e8[_0x1372('0x50')],queues[_0x6808e8[_0x1372('0x5a')]][_0x1372('0x20')],queues[_0x6808e8['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x6808e8[_0x1372('0x5a')]][_0x1372('0x5b')],queues[_0x6808e8['transfertargetuniqueid']][_0x1372('0x5c')]));}else{utils[_0x1372('0x2')](util[_0x1372('0x10')](_0x1372('0x5f'),_0x6808e8[_0x1372('0x50')],queues[_0x6808e8[_0x1372('0x52')]][_0x1372('0x20')],_0x6808e8[_0x1372('0x51')]));queues[_0x6808e8['secondtransfererlinkedid']][_0x1372('0xe')]=_0x6808e8[_0x1372('0x51')];}}}}catch(_0x1162b8){utils[_0x1372('0x16')](util[_0x1372('0x10')](_0x1372('0x4f'),_0x6808e8[_0x1372('0x50')]),_0x1162b8);}};exports[_0x1372('0x65')]=function(_0x2fb86c){try{if(!_[_0x1372('0x24')](queues[_0x2fb86c['uniqueid']])){utils['debug'](util['format'](_0x1372('0x66'),_0x2fb86c[_0x1372('0x3')]),_0x2fb86c);queues[_0x2fb86c[_0x1372('0x3')]]['musiconholdstartAt']=utils[_0x1372('0x15')]();utils[_0x1372('0x2')](util[_0x1372('0x10')](_0x1372('0x67'),_0x2fb86c[_0x1372('0x3')],queues[_0x2fb86c[_0x1372('0x3')]][_0x1372('0x20')],queues[_0x2fb86c[_0x1372('0x3')]][_0x1372('0x68')]));}}catch(_0x44d2d8){utils[_0x1372('0x16')](util[_0x1372('0x10')]('[%s][queues][musiconholdstart]',_0x2fb86c[_0x1372('0x3')]),_0x44d2d8);}};exports[_0x1372('0x69')]=function(_0x46df69){try{if(!_[_0x1372('0x24')](queues[_0x46df69[_0x1372('0x3')]])){if(!_[_0x1372('0x24')](queues[_0x46df69[_0x1372('0x3')]][_0x1372('0x68')])){utils[_0x1372('0x18')](util[_0x1372('0x10')](_0x1372('0x6a'),_0x46df69['uniqueid']),_0x46df69);queues[_0x46df69[_0x1372('0x3')]][_0x1372('0x5d')]+=utils[_0x1372('0x37')](utils[_0x1372('0x15')](),queues[_0x46df69['uniqueid']][_0x1372('0x68')]);utils[_0x1372('0x2')](util[_0x1372('0x10')](_0x1372('0x6b'),_0x46df69['uniqueid'],queues[_0x46df69[_0x1372('0x3')]][_0x1372('0x20')],queues[_0x46df69[_0x1372('0x3')]]['mohtime']));delete queues[_0x46df69[_0x1372('0x3')]][_0x1372('0x68')];}}}catch(_0x37e726){utils[_0x1372('0x16')](util['format']('[%s][queues][musiconholdstop]',_0x46df69[_0x1372('0x3')]),_0x37e726);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 51bd169..e6aabc7 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 _0x3cde=['[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','debug','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','format','[%s][recordings][writeDB]','getUserByInternal','accountcode','then','membername','name','UserId','CreateVoiceRecording','request','[%s][recordings][newchannel]','uniqueid','linkedid','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3cde,0x1b8));var _0xe3cd=function(_0x4854a9,_0x1f24bb){_0x4854a9=_0x4854a9-0x0;var _0x584bfd=_0x3cde[_0x4854a9];return _0x584bfd;};'use strict';var _=require(_0xe3cd('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x21a133){utils['info'](util[_0xe3cd('0x1')](_0xe3cd('0x2'),_0x21a133['uniqueid']));if(_0x21a133['accountcode']){utils[_0xe3cd('0x3')](_0x21a133[_0xe3cd('0x4')])[_0xe3cd('0x5')](function(_0x355272){if(_0x355272){_0x21a133[_0xe3cd('0x6')]=_0x355272[_0xe3cd('0x7')];_0x21a133[_0xe3cd('0x8')]=_0x355272['id'];}utils['request'](_0xe3cd('0x9'),_0x21a133);});}else{utils[_0xe3cd('0xa')](_0xe3cd('0x9'),_0x21a133);}}exports['newchannel']=function(_0x565358){try{utils['debug'](util['format'](_0xe3cd('0xb'),_0x565358[_0xe3cd('0xc')]),_0x565358);if(_0x565358['uniqueid']==_0x565358[_0xe3cd('0xd')]){utils[_0xe3cd('0xe')](util[_0xe3cd('0x1')](_0xe3cd('0xf'),_0x565358[_0xe3cd('0xc')],_0x565358[_0xe3cd('0x10')],_0x565358[_0xe3cd('0x11')]));recordings[_0x565358[_0xe3cd('0xc')]]={'uniqueid':_0x565358[_0xe3cd('0xc')],'accountcode':_0x565358[_0xe3cd('0x4')],'exten':_0x565358[_0xe3cd('0x11')],'context':_0x565358['context'],'channel':_0x565358['channel'],'monitors':[]};}}catch(_0x35b341){utils[_0xe3cd('0x12')](util[_0xe3cd('0x1')](_0xe3cd('0xb'),_0x565358[_0xe3cd('0xc')]),_0x35b341);}};exports['newstate']=function(_0x318e59){try{utils['debug'](util[_0xe3cd('0x1')]('[%s][recordings][newstate]',_0x318e59[_0xe3cd('0xc')]),_0x318e59);if(!_[_0xe3cd('0x13')](recordings[_0x318e59[_0xe3cd('0xc')]])&&_0x318e59[_0xe3cd('0x14')]==0x6){utils[_0xe3cd('0xe')](util[_0xe3cd('0x1')](_0xe3cd('0x15'),_0x318e59[_0xe3cd('0xc')],_0x318e59[_0xe3cd('0x10')],_0x318e59[_0xe3cd('0x16')]));}else if(!_[_0xe3cd('0x13')](recordings[_0x318e59[_0xe3cd('0xd')]])&&_0x318e59[_0xe3cd('0x14')]==0x6&&_0x318e59[_0xe3cd('0x10')]!=_0xe3cd('0x17')){utils[_0xe3cd('0xe')](util['format'](_0xe3cd('0x18'),_0x318e59[_0xe3cd('0xc')],_0x318e59[_0xe3cd('0xd')],_0x318e59[_0xe3cd('0x10')],_0x318e59[_0xe3cd('0x16')]));recordings[_0x318e59[_0xe3cd('0xd')]]['accountcode']=_0x318e59[_0xe3cd('0x4')];}}catch(_0x34edbf){utils[_0xe3cd('0x12')](util[_0xe3cd('0x1')]('[%s][recordings][newstate]',_0x318e59[_0xe3cd('0xc')]),_0x34edbf);}};exports[_0xe3cd('0x19')]=function(_0x1dec3a){try{if(!_['isNil'](_0x1dec3a[_0xe3cd('0x1a')])&&!_['isNil'](_0x1dec3a[_0xe3cd('0x1a')][_0xe3cd('0x1b')])){utils[_0xe3cd('0x1c')](util[_0xe3cd('0x1')](_0xe3cd('0x1d'),_0x1dec3a[_0xe3cd('0xc')]),_0x1dec3a);utils['info'](util['format'](_0xe3cd('0x1e'),_0x1dec3a[_0xe3cd('0xc')],_0x1dec3a[_0xe3cd('0x1a')],_0x1dec3a[_0xe3cd('0x1f')]));if(_[_0xe3cd('0x20')](_0x1dec3a[_0xe3cd('0x1f')],_0xe3cd('0x21'))){_0x1dec3a[_0xe3cd('0x1f')]=_0x1dec3a[_0xe3cd('0x1f')][_0xe3cd('0x22')](_0xe3cd('0x21'),_0xe3cd('0x23'));}if(recordings[_0x1dec3a[_0xe3cd('0xd')]]){var _0xd6e74c=_[_0xe3cd('0x24')](recordings[_0x1dec3a['linkedid']][_0xe3cd('0x25')],{'value':_0x1dec3a[_0xe3cd('0x1f')]});if(_[_0xe3cd('0x13')](_0xd6e74c)){recordings[_0x1dec3a[_0xe3cd('0xd')]][_0xe3cd('0x25')][_0xe3cd('0x26')]({'value':_0x1dec3a[_0xe3cd('0x1f')]});}}}}catch(_0x14d705){utils[_0xe3cd('0x12')](util[_0xe3cd('0x1')](_0xe3cd('0x1d'),_0x1dec3a['uniqueid']),_0x14d705);}};exports[_0xe3cd('0x27')]=function(_0x4dcfb2){try{if(!_[_0xe3cd('0x13')](recordings[_0x4dcfb2['uniqueid']])){utils[_0xe3cd('0x1c')](util[_0xe3cd('0x1')]('[%s][recordings][hangup]',_0x4dcfb2['uniqueid']),_0x4dcfb2);utils[_0xe3cd('0xe')](util[_0xe3cd('0x1')](_0xe3cd('0x28'),_0x4dcfb2[_0xe3cd('0xc')],_0x4dcfb2[_0xe3cd('0x29')],_0x4dcfb2['calleridname'],_0x4dcfb2[_0xe3cd('0x2a')]));recordings[_0x4dcfb2['uniqueid']][_0xe3cd('0x29')]=_0x4dcfb2[_0xe3cd('0x29')];recordings[_0x4dcfb2[_0xe3cd('0xc')]][_0xe3cd('0x2b')]=_0x4dcfb2[_0xe3cd('0x2b')];recordings[_0x4dcfb2[_0xe3cd('0xc')]][_0xe3cd('0x2c')]=_0x4dcfb2[_0xe3cd('0x2c')];recordings[_0x4dcfb2[_0xe3cd('0xc')]][_0xe3cd('0x2d')]=_0x4dcfb2['connectedlinename'];if(recordings[_0x4dcfb2[_0xe3cd('0xc')]]['type']==_0xe3cd('0x2e')&&recordings[_0x4dcfb2[_0xe3cd('0xc')]][_0xe3cd('0x4')]){recordings[_0x4dcfb2['uniqueid']][_0xe3cd('0x2c')]=recordings[_0x4dcfb2[_0xe3cd('0xc')]]['accountcode'];recordings[_0x4dcfb2[_0xe3cd('0xc')]]['connectedlinename']='';}recordings[_0x4dcfb2[_0xe3cd('0xc')]]['monitors'][_0xe3cd('0x2f')](function(_0x8f025d){var _0x4a8a40=_[_0xe3cd('0x30')](recordings[_0x4dcfb2[_0xe3cd('0xc')]]);_0x4a8a40[_0xe3cd('0x1f')]=_0x8f025d[_0xe3cd('0x1f')];writeDB(_0x4a8a40);});delete recordings[_0x4dcfb2['uniqueid']];}}catch(_0x51bc59){utils[_0xe3cd('0x12')](util[_0xe3cd('0x1')](_0xe3cd('0x31'),_0x4dcfb2['uniqueid']),_0x51bc59);}};exports[_0xe3cd('0x32')]=function(_0x1a20be){try{if(!_['isNil'](recordings[_0x1a20be['uniqueid']])){utils[_0xe3cd('0x1c')](util[_0xe3cd('0x1')](_0xe3cd('0x33'),_0x1a20be[_0xe3cd('0xc')]),_0x1a20be);utils['info'](util[_0xe3cd('0x1')](_0xe3cd('0x34'),_0x1a20be['uniqueid'],_0x1a20be[_0xe3cd('0x35')],_0x1a20be[_0xe3cd('0x36')]));if(_0x1a20be['application'][_0xe3cd('0x37')]()==_0xe3cd('0x38')&&_[_0xe3cd('0x39')](_0x1a20be[_0xe3cd('0x36')]['toLowerCase'](),_0xe3cd('0x3a'))){var _0x109cf8=_0x1a20be[_0xe3cd('0x36')][_0xe3cd('0x3b')]('=');var _0xbf3737=_0x109cf8[0x0][_0xe3cd('0x3c')](_0x109cf8[0x0]['lastIndexOf']('(')+0x1,_0x109cf8[0x0][_0xe3cd('0x3d')](')'));var _0x3e65cc=_0x109cf8[0x1];recordings[_0x1a20be[_0xe3cd('0xc')]][_0xbf3737]=_0x3e65cc;}}}catch(_0x1dd266){utils['error'](util['format'](_0xe3cd('0x33'),_0x1a20be['uniqueid']),_0x1dd266);}};exports['queuecallerjoin']=function(_0x501a5c){try{if(!_[_0xe3cd('0x13')](recordings[_0x501a5c[_0xe3cd('0xc')]])){utils[_0xe3cd('0x1c')](util[_0xe3cd('0x1')](_0xe3cd('0x3e'),_0x501a5c[_0xe3cd('0xc')]),_0x501a5c);utils['info'](util['format'](_0xe3cd('0x3f'),_0x501a5c[_0xe3cd('0xc')],_0x501a5c[_0xe3cd('0x40')]));recordings[_0x501a5c[_0xe3cd('0xc')]][_0xe3cd('0x40')]=_0x501a5c['queue'];}}catch(_0x4363f6){utils[_0xe3cd('0x12')](util[_0xe3cd('0x1')](_0xe3cd('0x3e'),_0x501a5c[_0xe3cd('0xc')]),_0x4363f6);}}; \ No newline at end of file +var _0x8dac=['push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','uniqueid','accountcode','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','channelstate','info','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','isNil','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors'];(function(_0x315860,_0x142502){var _0x4a60f4=function(_0x158648){while(--_0x158648){_0x315860['push'](_0x315860['shift']());}};_0x4a60f4(++_0x142502);}(_0x8dac,0x1ac));var _0xc8da=function(_0x240bfb,_0x2fa43b){_0x240bfb=_0x240bfb-0x0;var _0x2465af=_0x8dac[_0x240bfb];return _0x2465af;};'use strict';var _=require(_0xc8da('0x0'));var util=require(_0xc8da('0x1'));var utils=require(_0xc8da('0x2'));var recordings={};function writeDB(_0x5a8832){utils['info'](util[_0xc8da('0x3')](_0xc8da('0x4'),_0x5a8832[_0xc8da('0x5')]));if(_0x5a8832[_0xc8da('0x6')]){utils['getUserByInternal'](_0x5a8832[_0xc8da('0x6')])['then'](function(_0x4bc345){if(_0x4bc345){_0x5a8832[_0xc8da('0x7')]=_0x4bc345[_0xc8da('0x8')];_0x5a8832[_0xc8da('0x9')]=_0x4bc345['id'];}utils[_0xc8da('0xa')](_0xc8da('0xb'),_0x5a8832);});}else{utils[_0xc8da('0xa')](_0xc8da('0xb'),_0x5a8832);}}exports[_0xc8da('0xc')]=function(_0x16a615){try{utils[_0xc8da('0xd')](util[_0xc8da('0x3')](_0xc8da('0xe'),_0x16a615[_0xc8da('0x5')]),_0x16a615);if(_0x16a615[_0xc8da('0x5')]==_0x16a615[_0xc8da('0xf')]){utils['info'](util[_0xc8da('0x3')](_0xc8da('0x10'),_0x16a615[_0xc8da('0x5')],_0x16a615[_0xc8da('0x11')],_0x16a615['exten']));recordings[_0x16a615[_0xc8da('0x5')]]={'uniqueid':_0x16a615[_0xc8da('0x5')],'accountcode':_0x16a615[_0xc8da('0x6')],'exten':_0x16a615[_0xc8da('0x12')],'context':_0x16a615[_0xc8da('0x11')],'channel':_0x16a615[_0xc8da('0x13')],'monitors':[]};}}catch(_0x1e498f){utils[_0xc8da('0x14')](util[_0xc8da('0x3')](_0xc8da('0xe'),_0x16a615['uniqueid']),_0x1e498f);}};exports[_0xc8da('0x15')]=function(_0x76a1e4){try{utils['debug'](util[_0xc8da('0x3')](_0xc8da('0x16'),_0x76a1e4['uniqueid']),_0x76a1e4);if(!_['isNil'](recordings[_0x76a1e4[_0xc8da('0x5')]])&&_0x76a1e4[_0xc8da('0x17')]==0x6){utils[_0xc8da('0x18')](util[_0xc8da('0x3')](_0xc8da('0x19'),_0x76a1e4[_0xc8da('0x5')],_0x76a1e4[_0xc8da('0x11')],_0x76a1e4['channel']));}else if(!_['isNil'](recordings[_0x76a1e4['linkedid']])&&_0x76a1e4[_0xc8da('0x17')]==0x6&&_0x76a1e4['context']!=_0xc8da('0x1a')){utils[_0xc8da('0x18')](util['format'](_0xc8da('0x1b'),_0x76a1e4['uniqueid'],_0x76a1e4[_0xc8da('0xf')],_0x76a1e4[_0xc8da('0x11')],_0x76a1e4[_0xc8da('0x13')]));recordings[_0x76a1e4[_0xc8da('0xf')]][_0xc8da('0x6')]=_0x76a1e4['accountcode'];}}catch(_0x4728b0){utils['error'](util[_0xc8da('0x3')]('[%s][recordings][newstate]',_0x76a1e4[_0xc8da('0x5')]),_0x4728b0);}};exports[_0xc8da('0x1c')]=function(_0x599008){try{if(!_[_0xc8da('0x1d')](_0x599008[_0xc8da('0x1e')])&&!_[_0xc8da('0x1d')](_0x599008[_0xc8da('0x1e')][_0xc8da('0x1f')])){utils[_0xc8da('0xd')](util[_0xc8da('0x3')](_0xc8da('0x20'),_0x599008[_0xc8da('0x5')]),_0x599008);utils['info'](util[_0xc8da('0x3')](_0xc8da('0x21'),_0x599008[_0xc8da('0x5')],_0x599008[_0xc8da('0x1e')],_0x599008[_0xc8da('0x22')]));if(_[_0xc8da('0x23')](_0x599008[_0xc8da('0x22')],_0xc8da('0x24'))){_0x599008[_0xc8da('0x22')]=_0x599008[_0xc8da('0x22')][_0xc8da('0x25')](_0xc8da('0x24'),_0xc8da('0x26'));}if(recordings[_0x599008[_0xc8da('0xf')]]){var _0x4407ee=_[_0xc8da('0x27')](recordings[_0x599008['linkedid']][_0xc8da('0x28')],{'value':_0x599008[_0xc8da('0x22')]});if(_[_0xc8da('0x1d')](_0x4407ee)){recordings[_0x599008[_0xc8da('0xf')]][_0xc8da('0x28')][_0xc8da('0x29')]({'value':_0x599008[_0xc8da('0x22')]});}}}}catch(_0x56c7de){utils[_0xc8da('0x14')](util[_0xc8da('0x3')](_0xc8da('0x20'),_0x599008[_0xc8da('0x5')]),_0x56c7de);}};exports['hangup']=function(_0x146508){try{if(!_[_0xc8da('0x1d')](recordings[_0x146508['uniqueid']])){utils[_0xc8da('0xd')](util[_0xc8da('0x3')](_0xc8da('0x2a'),_0x146508[_0xc8da('0x5')]),_0x146508);utils['info'](util['format'](_0xc8da('0x2b'),_0x146508['uniqueid'],_0x146508['calleridnum'],_0x146508[_0xc8da('0x2c')],_0x146508[_0xc8da('0x2d')]));recordings[_0x146508[_0xc8da('0x5')]][_0xc8da('0x2e')]=_0x146508[_0xc8da('0x2e')];recordings[_0x146508['uniqueid']][_0xc8da('0x2c')]=_0x146508[_0xc8da('0x2c')];recordings[_0x146508[_0xc8da('0x5')]][_0xc8da('0x2f')]=_0x146508[_0xc8da('0x2f')];recordings[_0x146508[_0xc8da('0x5')]][_0xc8da('0x30')]=_0x146508[_0xc8da('0x30')];if(recordings[_0x146508[_0xc8da('0x5')]][_0xc8da('0x31')]==_0xc8da('0x32')&&recordings[_0x146508['uniqueid']]['accountcode']){recordings[_0x146508[_0xc8da('0x5')]][_0xc8da('0x2f')]=recordings[_0x146508[_0xc8da('0x5')]][_0xc8da('0x6')];recordings[_0x146508['uniqueid']][_0xc8da('0x30')]='';}recordings[_0x146508['uniqueid']][_0xc8da('0x28')]['forEach'](function(_0x2ee7ba){var _0x165a65=_[_0xc8da('0x33')](recordings[_0x146508['uniqueid']]);_0x165a65['value']=_0x2ee7ba[_0xc8da('0x22')];writeDB(_0x165a65);});delete recordings[_0x146508['uniqueid']];}}catch(_0x1d29bc){utils[_0xc8da('0x14')](util[_0xc8da('0x3')](_0xc8da('0x2a'),_0x146508['uniqueid']),_0x1d29bc);}};exports[_0xc8da('0x34')]=function(_0x110763){try{if(!_[_0xc8da('0x1d')](recordings[_0x110763['uniqueid']])){utils[_0xc8da('0xd')](util[_0xc8da('0x3')]('[%s][recordings][newexten]',_0x110763['uniqueid']),_0x110763);utils[_0xc8da('0x18')](util[_0xc8da('0x3')](_0xc8da('0x35'),_0x110763[_0xc8da('0x5')],_0x110763[_0xc8da('0x36')],_0x110763[_0xc8da('0x37')]));if(_0x110763[_0xc8da('0x36')][_0xc8da('0x38')]()==_0xc8da('0x39')&&_[_0xc8da('0x3a')](_0x110763[_0xc8da('0x37')][_0xc8da('0x38')](),_0xc8da('0x3b'))){var _0x5ab9b9=_0x110763[_0xc8da('0x37')][_0xc8da('0x3c')]('=');var _0x588629=_0x5ab9b9[0x0][_0xc8da('0x3d')](_0x5ab9b9[0x0][_0xc8da('0x3e')]('(')+0x1,_0x5ab9b9[0x0][_0xc8da('0x3e')](')'));var _0x42537d=_0x5ab9b9[0x1];recordings[_0x110763['uniqueid']][_0x588629]=_0x42537d;}}}catch(_0xe4625f){utils['error'](util[_0xc8da('0x3')](_0xc8da('0x3f'),_0x110763[_0xc8da('0x5')]),_0xe4625f);}};exports[_0xc8da('0x40')]=function(_0x5a9463){try{if(!_[_0xc8da('0x1d')](recordings[_0x5a9463[_0xc8da('0x5')]])){utils['debug'](util[_0xc8da('0x3')](_0xc8da('0x41'),_0x5a9463[_0xc8da('0x5')]),_0x5a9463);utils['info'](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x5a9463[_0xc8da('0x5')],_0x5a9463[_0xc8da('0x42')]));recordings[_0x5a9463[_0xc8da('0x5')]]['queue']=_0x5a9463[_0xc8da('0x42')];}}catch(_0x35b12d){utils[_0xc8da('0x14')](util[_0xc8da('0x3')](_0xc8da('0x41'),_0x5a9463['uniqueid']),_0x35b12d);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 2924d02..9299d31 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 _0x9e68=['assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blinds','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum'];(function(_0x241046,_0x4eba99){var _0x4a502c=function(_0x2ffa81){while(--_0x2ffa81){_0x241046['push'](_0x241046['shift']());}};_0x4a502c(++_0x4eba99);}(_0x9e68,0x19f));var _0x89e6=function(_0x53f205,_0xa378e2){_0x53f205=_0x53f205-0x0;var _0x19c74e=_0x9e68[_0x53f205];return _0x19c74e;};'use strict';var _=require('lodash');var util=require(_0x89e6('0x0'));var utils=require('./utils');function writeDB(_0x170146){utils[_0x89e6('0x1')](util[_0x89e6('0x2')](_0x89e6('0x3'),_0x170146[_0x89e6('0x4')]===_0x89e6('0x5')?_0x170146[_0x89e6('0x6')]:_0x170146[_0x89e6('0x7')],_0x170146['type']));utils[_0x89e6('0x8')]('CreateVoiceTransferReport',_0x170146);}exports['blinds']={};exports[_0x89e6('0x9')]=function(_0x54a2e8){try{utils[_0x89e6('0xa')](util[_0x89e6('0x2')](_0x89e6('0xb'),_0x54a2e8[_0x89e6('0x7')]),_0x54a2e8);utils[_0x89e6('0x1')](util[_0x89e6('0x2')](_0x89e6('0xc'),_0x54a2e8['uniqueid'],_0x54a2e8[_0x89e6('0xd')],_0x54a2e8[_0x89e6('0xe')],_0x54a2e8[_0x89e6('0xf')],_0x54a2e8['transfereecalleridname']));_0x54a2e8[_0x89e6('0x4')]='blind';exports[_0x89e6('0x10')][_0x54a2e8[_0x89e6('0x11')]]=_0x54a2e8;writeDB(_0x54a2e8);}catch(_0x562bfe){utils[_0x89e6('0x12')](util[_0x89e6('0x2')](_0x89e6('0xb'),_0x54a2e8[_0x89e6('0x7')]),_0x562bfe);}};exports[_0x89e6('0x13')]=function(_0x521954){try{utils['debug'](util[_0x89e6('0x2')](_0x89e6('0x14'),_0x521954[_0x89e6('0x6')]),_0x521954);utils[_0x89e6('0x1')](util[_0x89e6('0x2')](_0x89e6('0x15'),_0x521954[_0x89e6('0x6')],_0x521954[_0x89e6('0x16')],_0x521954[_0x89e6('0x17')],_0x521954[_0x89e6('0x18')],_0x521954['transfertargetcalleridname']));_0x521954=_[_0x89e6('0x19')](_0x521954,{'transfererchannel':_0x521954[_0x89e6('0x1a')],'transferercalleridnum':_0x521954[_0x89e6('0x16')],'transferercalleridname':_0x521954[_0x89e6('0x17')],'transfererconnectedlinenum':_0x521954[_0x89e6('0x1b')],'transfererconnectedlinename':_0x521954['secondtransfererconnectedlinename'],'transfereraccountcode':_0x521954['origtransfereraccountcode'],'transferercontext':_0x521954['secondtransferercontext'],'transfererexten':_0x521954[_0x89e6('0x1c')],'transfererlinkedid':_0x521954[_0x89e6('0x1d')],'context':_0x521954[_0x89e6('0x1e')],'extension':_0x521954[_0x89e6('0x1f')],'type':_0x89e6('0x5')});if(_[_0x89e6('0x20')](_0x521954[_0x89e6('0x21')])){_0x521954=_[_0x89e6('0x19')](_0x521954,{'transfereechannel':_0x521954[_0x89e6('0x22')],'transfereecalleridnum':_0x521954[_0x89e6('0x18')],'transfereecalleridname':_0x521954[_0x89e6('0x23')],'transfereeconnectedlinenum':_0x521954[_0x89e6('0x24')],'transfereeconnectedlinename':_0x521954[_0x89e6('0x25')],'transfereeaccountcode':_0x521954['transfertargetaccountcode'],'transfereecontext':_0x521954[_0x89e6('0x26')],'transfereeexten':_0x521954['transfertargetexten'],'transfereelinkedid':_0x521954[_0x89e6('0x27')]});}writeDB(_0x521954);}catch(_0x232ae5){utils[_0x89e6('0x12')](util['format']('[%s][transfers][attendedtransfer]',_0x521954[_0x89e6('0x6')]),_0x232ae5);}}; \ No newline at end of file +var _0xe632=['uniqueid','request','blinds','blindtransfer','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','error','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended'];(function(_0x489243,_0x256a8a){var _0x70acca=function(_0x2d8834){while(--_0x2d8834){_0x489243['push'](_0x489243['shift']());}};_0x70acca(++_0x256a8a);}(_0xe632,0x19b));var _0x2e63=function(_0x4d0a15,_0x2025a3){_0x4d0a15=_0x4d0a15-0x0;var _0x5c06e3=_0xe632[_0x4d0a15];return _0x5c06e3;};'use strict';var _=require(_0x2e63('0x0'));var util=require(_0x2e63('0x1'));var utils=require(_0x2e63('0x2'));function writeDB(_0x4b5e83){utils['info'](util[_0x2e63('0x3')](_0x2e63('0x4'),_0x4b5e83[_0x2e63('0x5')]===_0x2e63('0x6')?_0x4b5e83['origtransfereruniqueid']:_0x4b5e83[_0x2e63('0x7')],_0x4b5e83[_0x2e63('0x5')]));utils[_0x2e63('0x8')]('CreateVoiceTransferReport',_0x4b5e83);}exports[_0x2e63('0x9')]={};exports[_0x2e63('0xa')]=function(_0x2038a6){try{utils['debug'](util[_0x2e63('0x3')](_0x2e63('0xb'),_0x2038a6['uniqueid']),_0x2038a6);utils[_0x2e63('0xc')](util[_0x2e63('0x3')](_0x2e63('0xd'),_0x2038a6[_0x2e63('0x7')],_0x2038a6[_0x2e63('0xe')],_0x2038a6[_0x2e63('0xf')],_0x2038a6[_0x2e63('0x10')],_0x2038a6['transfereecalleridname']));_0x2038a6[_0x2e63('0x5')]='blind';exports['blinds'][_0x2038a6['transfereruniqueid']]=_0x2038a6;writeDB(_0x2038a6);}catch(_0x12f66c){utils[_0x2e63('0x11')](util[_0x2e63('0x3')](_0x2e63('0xb'),_0x2038a6[_0x2e63('0x7')]),_0x12f66c);}};exports['attendedtransfer']=function(_0x5cbaf2){try{utils['debug'](util[_0x2e63('0x3')](_0x2e63('0x12'),_0x5cbaf2[_0x2e63('0x13')]),_0x5cbaf2);utils[_0x2e63('0xc')](util[_0x2e63('0x3')](_0x2e63('0x14'),_0x5cbaf2[_0x2e63('0x13')],_0x5cbaf2[_0x2e63('0x15')],_0x5cbaf2[_0x2e63('0x16')],_0x5cbaf2[_0x2e63('0x17')],_0x5cbaf2[_0x2e63('0x18')]));_0x5cbaf2=_[_0x2e63('0x19')](_0x5cbaf2,{'transfererchannel':_0x5cbaf2[_0x2e63('0x1a')],'transferercalleridnum':_0x5cbaf2['origtransferercalleridnum'],'transferercalleridname':_0x5cbaf2[_0x2e63('0x16')],'transfererconnectedlinenum':_0x5cbaf2[_0x2e63('0x1b')],'transfererconnectedlinename':_0x5cbaf2[_0x2e63('0x1c')],'transfereraccountcode':_0x5cbaf2['origtransfereraccountcode'],'transferercontext':_0x5cbaf2['secondtransferercontext'],'transfererexten':_0x5cbaf2[_0x2e63('0x1d')],'transfererlinkedid':_0x5cbaf2[_0x2e63('0x1e')],'context':_0x5cbaf2[_0x2e63('0x1f')],'extension':_0x5cbaf2[_0x2e63('0x20')],'type':_0x2e63('0x6')});if(_[_0x2e63('0x21')](_0x5cbaf2[_0x2e63('0x22')])){_0x5cbaf2=_[_0x2e63('0x19')](_0x5cbaf2,{'transfereechannel':_0x5cbaf2['transfertargetchannel'],'transfereecalleridnum':_0x5cbaf2[_0x2e63('0x17')],'transfereecalleridname':_0x5cbaf2['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5cbaf2[_0x2e63('0x23')],'transfereeconnectedlinename':_0x5cbaf2[_0x2e63('0x24')],'transfereeaccountcode':_0x5cbaf2['transfertargetaccountcode'],'transfereecontext':_0x5cbaf2[_0x2e63('0x25')],'transfereeexten':_0x5cbaf2['transfertargetexten'],'transfereelinkedid':_0x5cbaf2['transfertargetlinkedid']});}writeDB(_0x5cbaf2);}catch(_0x23584a){utils[_0x2e63('0x11')](util['format']('[%s][transfers][attendedtransfer]',_0x5cbaf2[_0x2e63('0x13')]),_0x23584a);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 69e6f92..9b11a05 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 _0x3627=['getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','internal','interface','[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]'];(function(_0xd674c2,_0x5aab8f){var _0x56ca35=function(_0x5a6a25){while(--_0x5a6a25){_0xd674c2['push'](_0xd674c2['shift']());}};_0x56ca35(++_0x5aab8f);}(_0x3627,0x170));var _0x7362=function(_0x4c2dca,_0x389823){_0x4c2dca=_0x4c2dca-0x0;var _0x58230f=_0x3627[_0x4c2dca];return _0x58230f;};'use strict';var BPromise=require(_0x7362('0x0'));var jayson=require('jayson/promise');var moment=require(_0x7362('0x1'));var util=require(_0x7362('0x2'));var client=jayson[_0x7362('0x3')][_0x7362('0x4')]({'port':0x2329});var logger=require(_0x7362('0x5'))('xdr');exports['info']=function(_0x4a4d7a,_0xc45a8e){logger[_0x7362('0x6')](_0x4a4d7a,_0xc45a8e?util[_0x7362('0x7')](_0xc45a8e,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0xd47322,_0x268b53){logger[_0x7362('0x8')](_0xd47322,_0x268b53?util[_0x7362('0x7')](_0x268b53,{'showHidden':![],'depth':null}):'');};exports[_0x7362('0x9')]=function(_0x41e9e7,_0x2c7b2a){logger[_0x7362('0x9')](_0x41e9e7,_0x2c7b2a?util[_0x7362('0x7')](_0x2c7b2a,{'showHidden':![],'depth':null}):'');};exports[_0x7362('0xa')]=function(_0x4ffca4,_0x4b8f30){return client[_0x7362('0xa')](_0x4ffca4,{'body':_0x4b8f30})[_0x7362('0xb')](function(_0x44e10f){logger[_0x7362('0x8')](_0x7362('0xc'),_0x4ffca4,_0x44e10f?util[_0x7362('0x7')](_0x44e10f,{'showHidden':![],'depth':null}):'');})[_0x7362('0xd')](function(_0x1da49b){logger[_0x7362('0x9')](_0x7362('0xc'),_0x4ffca4,_0x1da49b?util[_0x7362('0x7')](_0x1da49b,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3707d9){return client[_0x7362('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x7362('0xe'),'name',_0x7362('0xf')],'where':_0x3707d9,'limit':0x1}})[_0x7362('0xb')](function(_0x5b3553){logger[_0x7362('0x8')](_0x7362('0x10'),JSON[_0x7362('0x11')](_0x3707d9),_0x5b3553?util[_0x7362('0x7')](_0x5b3553,{'showHidden':![],'depth':null}):'');return _0x5b3553[_0x7362('0x12')][_0x7362('0x13')]?_0x5b3553[_0x7362('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x4e6d68){return new BPromise(function(_0x35fdb7,_0x37f218){if(_0x4e6d68){return getUser({'internal':_0x4e6d68})[_0x7362('0xb')](function(_0xeafcb8){logger[_0x7362('0x6')](_0x7362('0x14'),_0x4e6d68,_0xeafcb8?_0x7362('0x15'):_0x7362('0x16'));return _0x35fdb7(_0xeafcb8);})[_0x7362('0xd')](function(_0x3865c0){logger[_0x7362('0x9')](_0x7362('0x17'),_0x3865c0?util['inspect'](_0x3865c0,{'showHidden':![],'depth':null}):'');return _0x35fdb7(null);});}return _0x35fdb7(null);});};exports[_0x7362('0x18')]=function(_0x347ca4){return new BPromise(function(_0x42a6f0,_0x151c68){if(_0x347ca4){return getUser({'interface':_0x347ca4})[_0x7362('0xb')](function(_0x50253c){logger[_0x7362('0x6')](_0x7362('0x19'),_0x347ca4,_0x50253c?'found':_0x7362('0x16'));return _0x42a6f0(_0x50253c);})[_0x7362('0xd')](function(_0x55bfcf){logger[_0x7362('0x9')]('[utils][getUserByInterface]',_0x55bfcf?util[_0x7362('0x7')](_0x55bfcf,{'showHidden':![],'depth':null}):'');return _0x42a6f0(null);});}return _0x42a6f0(null);});};exports[_0x7362('0x1a')]=function(_0x23fa53){return new BPromise(function(_0x56076b,_0x2dba1b){if(_0x23fa53){return getUser({'name':_0x23fa53})[_0x7362('0xb')](function(_0x4e0675){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x23fa53,_0x4e0675?'found':_0x7362('0x16'));return _0x56076b(_0x4e0675);})[_0x7362('0xd')](function(_0x5b87b2){logger['error'](_0x7362('0x1b'),_0x5b87b2?util[_0x7362('0x7')](_0x5b87b2,{'showHidden':![],'depth':null}):'');return _0x56076b(null);});}return _0x56076b(null);});};exports[_0x7362('0x1c')]=function(_0x92c37d){return new BPromise(function(_0x4640f7,_0x1c8c37){if(_0x92c37d){return client[_0x7362('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x7362('0x1d'),_0x7362('0x1e'),'acwTimeout'],'where':{'name':_0x92c37d},'limit':0x1}})[_0x7362('0xb')](function(_0x593a9a){logger[_0x7362('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x92c37d,_0x593a9a?util[_0x7362('0x7')](_0x593a9a,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x92c37d,_0x593a9a?'found':_0x7362('0x16'));return _0x4640f7(_0x593a9a[_0x7362('0x12')]['length']?_0x593a9a[_0x7362('0x12')][0x0]:null);})[_0x7362('0xd')](function(_0x1e95aa){logger[_0x7362('0x9')](_0x7362('0x1f'),_0x1e95aa?util[_0x7362('0x7')](_0x1e95aa,{'showHidden':![],'depth':null}):'');return _0x4640f7(null);});}return _0x4640f7(null);});};exports[_0x7362('0x20')]=function(_0x335ebb,_0x5db624){return moment(_0x335ebb)[_0x7362('0x21')](_0x5db624,_0x7362('0x22'))[_0x7362('0x23')](_0x7362('0x24'));};exports[_0x7362('0x25')]=function(_0x5e41e3,_0x20c3cd){return moment(_0x5e41e3)[_0x7362('0x26')](_0x20c3cd,_0x7362('0x22'))[_0x7362('0x23')](_0x7362('0x24'));};exports['diffTime']=function(_0x514ace,_0x351041){return moment(_0x514ace)[_0x7362('0x27')](moment(_0x351041),_0x7362('0x22'));};exports[_0x7362('0x28')]=function(_0x1a2368,_0x69a967){return parseInt(_0x1a2368,0xa)+parseInt(_0x69a967,0xa);};exports[_0x7362('0x29')]=function(){return moment()['format'](_0x7362('0x24'));};exports[_0x7362('0x2a')]=function(_0xd47e26,_0x3d85c1){if(_0x3d85c1){return moment(_0xd47e26)[_0x7362('0x2a')](_0x3d85c1);}return!![];};exports[_0x7362('0x2b')]=function(_0x49c5bd,_0x149f7b){if(_0x149f7b){return moment(_0x49c5bd)[_0x7362('0x2b')](_0x149f7b);}else if(_0x49c5bd){return!![];}return![];}; \ No newline at end of file +var _0x39f3=['info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','../../config/logger','xdr'];(function(_0x12467c,_0x235df4){var _0x5a7c52=function(_0x32b89a){while(--_0x32b89a){_0x12467c['push'](_0x12467c['shift']());}};_0x5a7c52(++_0x235df4);}(_0x39f3,0x181));var _0x339f=function(_0x4569b0,_0x580de7){_0x4569b0=_0x4569b0-0x0;var _0x3e22a7=_0x39f3[_0x4569b0];return _0x3e22a7;};'use strict';var BPromise=require(_0x339f('0x0'));var jayson=require(_0x339f('0x1'));var moment=require(_0x339f('0x2'));var util=require('util');var client=jayson[_0x339f('0x3')][_0x339f('0x4')]({'port':0x2329});var logger=require(_0x339f('0x5'))(_0x339f('0x6'));exports[_0x339f('0x7')]=function(_0x4d0524,_0x3bc813){logger[_0x339f('0x7')](_0x4d0524,_0x3bc813?util[_0x339f('0x8')](_0x3bc813,{'showHidden':![],'depth':null}):'');};exports[_0x339f('0x9')]=function(_0x1e6235,_0x40908a){logger['debug'](_0x1e6235,_0x40908a?util['inspect'](_0x40908a,{'showHidden':![],'depth':null}):'');};exports[_0x339f('0xa')]=function(_0x1ce1f5,_0x7295c0){logger[_0x339f('0xa')](_0x1ce1f5,_0x7295c0?util['inspect'](_0x7295c0,{'showHidden':![],'depth':null}):'');};exports[_0x339f('0xb')]=function(_0x243882,_0xe85fe9){return client[_0x339f('0xb')](_0x243882,{'body':_0xe85fe9})[_0x339f('0xc')](function(_0x1ca1f4){logger[_0x339f('0x9')](_0x339f('0xd'),_0x243882,_0x1ca1f4?util[_0x339f('0x8')](_0x1ca1f4,{'showHidden':![],'depth':null}):'');})[_0x339f('0xe')](function(_0x2823bf){logger[_0x339f('0xa')](_0x339f('0xd'),_0x243882,_0x2823bf?util[_0x339f('0x8')](_0x2823bf,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1fd65c){return client[_0x339f('0xb')](_0x339f('0xf'),{'options':{'raw':!![],'attributes':['id',_0x339f('0x10'),_0x339f('0x11'),_0x339f('0x12')],'where':_0x1fd65c,'limit':0x1}})['then'](function(_0x557cbb){logger[_0x339f('0x9')](_0x339f('0x13'),JSON[_0x339f('0x14')](_0x1fd65c),_0x557cbb?util[_0x339f('0x8')](_0x557cbb,{'showHidden':![],'depth':null}):'');return _0x557cbb[_0x339f('0x15')][_0x339f('0x16')]?_0x557cbb[_0x339f('0x15')][0x0]:null;});}exports[_0x339f('0x17')]=function(_0x328993){return new BPromise(function(_0x16331d,_0x4fc0e1){if(_0x328993){return getUser({'internal':_0x328993})[_0x339f('0xc')](function(_0x1e3235){logger[_0x339f('0x7')](_0x339f('0x18'),_0x328993,_0x1e3235?_0x339f('0x19'):_0x339f('0x1a'));return _0x16331d(_0x1e3235);})['catch'](function(_0x189d90){logger[_0x339f('0xa')](_0x339f('0x1b'),_0x189d90?util[_0x339f('0x8')](_0x189d90,{'showHidden':![],'depth':null}):'');return _0x16331d(null);});}return _0x16331d(null);});};exports['getUserByInterface']=function(_0xabb295){return new BPromise(function(_0x3d71f4,_0xcde8e8){if(_0xabb295){return getUser({'interface':_0xabb295})[_0x339f('0xc')](function(_0x22467e){logger[_0x339f('0x7')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0xabb295,_0x22467e?'found':_0x339f('0x1a'));return _0x3d71f4(_0x22467e);})[_0x339f('0xe')](function(_0x1a8008){logger[_0x339f('0xa')]('[utils][getUserByInterface]',_0x1a8008?util['inspect'](_0x1a8008,{'showHidden':![],'depth':null}):'');return _0x3d71f4(null);});}return _0x3d71f4(null);});};exports['getUserByName']=function(_0xbf1305){return new BPromise(function(_0x50258c,_0x923315){if(_0xbf1305){return getUser({'name':_0xbf1305})['then'](function(_0x32fd08){logger['info'](_0x339f('0x1c'),_0xbf1305,_0x32fd08?_0x339f('0x19'):'notfound');return _0x50258c(_0x32fd08);})[_0x339f('0xe')](function(_0x473d46){logger[_0x339f('0xa')](_0x339f('0x1d'),_0x473d46?util[_0x339f('0x8')](_0x473d46,{'showHidden':![],'depth':null}):'');return _0x50258c(null);});}return _0x50258c(null);});};exports[_0x339f('0x1e')]=function(_0x31d922){return new BPromise(function(_0x3de159,_0x3026db){if(_0x31d922){return client[_0x339f('0xb')](_0x339f('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x339f('0x11'),_0x339f('0x20'),_0x339f('0x21'),'acwTimeout'],'where':{'name':_0x31d922},'limit':0x1}})['then'](function(_0x174d9f){logger['debug'](_0x339f('0x22'),_0x31d922,_0x174d9f?util[_0x339f('0x8')](_0x174d9f,{'showHidden':![],'depth':null}):'');logger['info'](_0x339f('0x23'),_0x31d922,_0x174d9f?_0x339f('0x19'):_0x339f('0x1a'));return _0x3de159(_0x174d9f[_0x339f('0x15')][_0x339f('0x16')]?_0x174d9f[_0x339f('0x15')][0x0]:null);})['catch'](function(_0x45156f){logger[_0x339f('0xa')](_0x339f('0x24'),_0x45156f?util[_0x339f('0x8')](_0x45156f,{'showHidden':![],'depth':null}):'');return _0x3de159(null);});}return _0x3de159(null);});};exports[_0x339f('0x25')]=function(_0x3375ad,_0x251138){return moment(_0x3375ad)[_0x339f('0x26')](_0x251138,_0x339f('0x27'))['format'](_0x339f('0x28'));};exports[_0x339f('0x29')]=function(_0x66c1ab,_0x44e49b){return moment(_0x66c1ab)[_0x339f('0x2a')](_0x44e49b,'seconds')[_0x339f('0x2b')](_0x339f('0x28'));};exports[_0x339f('0x2c')]=function(_0x549dcd,_0x1fe1b4){return moment(_0x549dcd)[_0x339f('0x2d')](moment(_0x1fe1b4),_0x339f('0x27'));};exports['sumTime']=function(_0x36572c,_0x191d60){return parseInt(_0x36572c,0xa)+parseInt(_0x191d60,0xa);};exports[_0x339f('0x2e')]=function(){return moment()[_0x339f('0x2b')](_0x339f('0x28'));};exports[_0x339f('0x2f')]=function(_0x136de8,_0x5015a0){if(_0x5015a0){return moment(_0x136de8)['isAfter'](_0x5015a0);}return!![];};exports[_0x339f('0x30')]=function(_0x1cb663,_0x5ed1b4){if(_0x5ed1b4){return moment(_0x1cb663)[_0x339f('0x30')](_0x5ed1b4);}else if(_0x1cb663){return!![];}return![];}; \ No newline at end of file